summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.cargo/.gitignore1
-rw-r--r--.cargo/config.in6
-rw-r--r--CLOBBER2
-rw-r--r--Makefile.in16
-rw-r--r--README.md6
-rw-r--r--accessible/base/nsAccessibilityService.cpp10
-rw-r--r--accessible/tests/mochitest/jsat/test_output.html9
-rw-r--r--accessible/windows/msaa/IUnknownImpl.cpp4
-rw-r--r--aclocal.m41
-rw-r--r--application/palemoon/app.mozbuild2
-rw-r--r--application/palemoon/app/Makefile.in10
-rw-r--r--application/palemoon/app/blocklist.xml14
-rw-r--r--application/palemoon/app/macbuild/Contents/Info.plist.in5
-rw-r--r--application/palemoon/app/macversion.py2
-rw-r--r--application/palemoon/app/moz.build33
-rw-r--r--application/palemoon/app/nsBrowserApp.cpp336
-rw-r--r--application/palemoon/app/profile/palemoon.js4
-rw-r--r--application/palemoon/base/content/abouthome/aboutHome.js4
-rw-r--r--application/palemoon/base/content/autocomplete.css17
-rw-r--r--application/palemoon/base/content/autocomplete.xml2128
-rw-r--r--application/palemoon/base/content/autorecovery.js6
-rw-r--r--application/palemoon/base/content/baseMenuOverlay.xul2
-rw-r--r--application/palemoon/base/content/browser-addons.js4
-rw-r--r--application/palemoon/base/content/browser-appmenu.inc35
-rw-r--r--application/palemoon/base/content/browser-devtools-theme.js91
-rw-r--r--application/palemoon/base/content/browser-fullScreen.js5
-rw-r--r--application/palemoon/base/content/browser-fullZoom.js210
-rw-r--r--application/palemoon/base/content/browser-gestureSupport.js4
-rw-r--r--application/palemoon/base/content/browser-menubar.inc31
-rw-r--r--application/palemoon/base/content/browser-places.js23
-rw-r--r--application/palemoon/base/content/browser-plugins.js20
-rw-r--r--application/palemoon/base/content/browser-sets.inc78
-rw-r--r--application/palemoon/base/content/browser-syncui.js2
-rw-r--r--application/palemoon/base/content/browser-thumbnails.js11
-rw-r--r--application/palemoon/base/content/browser-uacompat.js45
-rw-r--r--application/palemoon/base/content/browser-webrtcUI.js2
-rw-r--r--application/palemoon/base/content/browser.css83
-rw-r--r--application/palemoon/base/content/browser.js694
-rw-r--r--application/palemoon/base/content/browser.xul62
-rw-r--r--application/palemoon/base/content/content.js127
-rw-r--r--application/palemoon/base/content/global-devtools-theme-scripts.inc6
-rw-r--r--application/palemoon/base/content/macBrowserOverlay.xul3
-rw-r--r--application/palemoon/base/content/newtab/drag.js2
-rw-r--r--application/palemoon/base/content/newtab/dragDataHelper.js2
-rw-r--r--application/palemoon/base/content/newtab/drop.js2
-rw-r--r--application/palemoon/base/content/newtab/dropPreview.js2
-rw-r--r--application/palemoon/base/content/newtab/dropTargetShim.js2
-rw-r--r--application/palemoon/base/content/newtab/grid.js16
-rw-r--r--application/palemoon/base/content/newtab/newTab.js6
-rw-r--r--application/palemoon/base/content/newtab/page.js2
-rw-r--r--application/palemoon/base/content/newtab/transformations.js2
-rw-r--r--application/palemoon/base/content/newtab/undo.js2
-rw-r--r--application/palemoon/base/content/newtab/updater.js2
-rw-r--r--application/palemoon/base/content/nsContextMenu.js69
-rw-r--r--application/palemoon/base/content/openLocation.js81
-rw-r--r--application/palemoon/base/content/padlock.js6
-rw-r--r--application/palemoon/base/content/pageinfo/pageInfo.js7
-rw-r--r--application/palemoon/base/content/pageinfo/permissions.js68
-rw-r--r--application/palemoon/base/content/popup-notifications.inc13
-rw-r--r--application/palemoon/base/content/sanitize.js19
-rw-r--r--application/palemoon/base/content/sync/aboutSyncTabs.js2
-rw-r--r--application/palemoon/base/content/sync/addDevice.js2
-rw-r--r--application/palemoon/base/content/sync/genericChange.js2
-rw-r--r--application/palemoon/base/content/sync/progress.js4
-rw-r--r--application/palemoon/base/content/sync/quota.js4
-rw-r--r--application/palemoon/base/content/sync/utils.js2
-rw-r--r--application/palemoon/base/content/tabbrowser.xml363
-rw-r--r--application/palemoon/base/content/urlbarBindings.xml377
-rw-r--r--application/palemoon/base/content/utilityOverlay.js57
-rw-r--r--application/palemoon/base/jar.mn5
-rw-r--r--application/palemoon/branding/official/moz.build6
-rw-r--r--application/palemoon/branding/official/pref/palemoon-branding.js2
-rw-r--r--application/palemoon/branding/shared/branding.mozbuild97
-rw-r--r--application/palemoon/branding/shared/pref/preferences.inc8
-rw-r--r--application/palemoon/branding/shared/pref/uaoverrides.inc2
-rw-r--r--application/palemoon/branding/unofficial/moz.build6
-rw-r--r--application/palemoon/branding/unstable/moz.build6
-rw-r--r--application/palemoon/branding/unstable/pref/palemoon-branding.js2
-rw-r--r--application/palemoon/build.mk24
-rw-r--r--application/palemoon/components/about/AboutRedirector.cpp123
-rw-r--r--application/palemoon/components/build/moz.build7
-rw-r--r--application/palemoon/components/build/nsBrowserCompsCID.h8
-rw-r--r--application/palemoon/components/build/nsModule.cpp21
-rw-r--r--application/palemoon/components/dirprovider/DirectoryProvider.cpp52
-rw-r--r--application/palemoon/components/downloads/DownloadsCommon.jsm18
-rw-r--r--application/palemoon/components/downloads/content/allDownloadsViewOverlay.js70
-rw-r--r--application/palemoon/components/downloads/content/contentAreaDownloadsView.js2
-rw-r--r--application/palemoon/components/downloads/content/downloads.js17
-rw-r--r--application/palemoon/components/downloads/content/indicator.js33
-rw-r--r--application/palemoon/components/feeds/FeedConverter.js2
-rw-r--r--application/palemoon/components/feeds/FeedWriter.js23
-rw-r--r--application/palemoon/components/feeds/moz.build2
-rw-r--r--application/palemoon/components/feeds/nsFeedSniffer.cpp4
-rw-r--r--application/palemoon/components/feeds/nsFeedSniffer.h14
-rw-r--r--application/palemoon/components/fuel/fuelApplication.js2
-rw-r--r--application/palemoon/components/migration/BrowserProfileMigrators.manifest14
-rw-r--r--application/palemoon/components/migration/ChromeProfileMigrator.js463
-rw-r--r--application/palemoon/components/migration/FirefoxProfileMigrator.js117
-rw-r--r--application/palemoon/components/migration/IEProfileMigrator.js521
-rw-r--r--application/palemoon/components/migration/MigrationUtils.jsm644
-rw-r--r--application/palemoon/components/migration/ProfileMigrator.js21
-rw-r--r--application/palemoon/components/migration/SafariProfileMigrator.js416
-rw-r--r--application/palemoon/components/migration/content/migration.js474
-rw-r--r--application/palemoon/components/migration/content/migration.xul96
-rw-r--r--application/palemoon/components/migration/jar.mn7
-rw-r--r--application/palemoon/components/migration/moz.build53
-rw-r--r--application/palemoon/components/migration/nsIBrowserProfileMigrator.idl63
-rw-r--r--application/palemoon/components/migration/nsIEHistoryEnumerator.cpp139
-rw-r--r--application/palemoon/components/migration/nsIEHistoryEnumerator.h37
-rw-r--r--application/palemoon/components/moz.build1
-rw-r--r--application/palemoon/components/nsBrowserContentHandler.js14
-rw-r--r--application/palemoon/components/nsBrowserGlue.js258
-rw-r--r--application/palemoon/components/places/BrowserPlaces.manifest2
-rw-r--r--application/palemoon/components/places/PlacesProtocolHandler.js49
-rw-r--r--application/palemoon/components/places/content/controller.js2
-rw-r--r--application/palemoon/components/places/content/editBookmarkOverlay.js47
-rw-r--r--application/palemoon/components/places/content/places.js13
-rw-r--r--application/palemoon/components/places/content/places.xul7
-rw-r--r--application/palemoon/components/places/content/treeView.js7
-rw-r--r--application/palemoon/components/places/moz.build4
-rw-r--r--application/palemoon/components/preferences/aboutPermissions.js171
-rw-r--r--application/palemoon/components/preferences/aboutPermissions.xul5
-rw-r--r--application/palemoon/components/preferences/advanced.js49
-rw-r--r--application/palemoon/components/preferences/cookies.js74
-rw-r--r--application/palemoon/components/preferences/cookies.xul11
-rw-r--r--application/palemoon/components/preferences/handlers.xml2
-rw-r--r--application/palemoon/components/preferences/jar.mn6
-rw-r--r--application/palemoon/components/preferences/permissions.js308
-rw-r--r--application/palemoon/components/preferences/permissions.xul36
-rw-r--r--application/palemoon/components/preferences/sanitize.js2
-rw-r--r--application/palemoon/components/preferences/security.js41
-rw-r--r--application/palemoon/components/preferences/sync.js2
-rw-r--r--application/palemoon/components/search/content/engineManager.js17
-rw-r--r--application/palemoon/components/search/content/engineManager.xul2
-rw-r--r--application/palemoon/components/sessionstore/SessionStorage.jsm4
-rw-r--r--application/palemoon/components/sessionstore/SessionStore.jsm36
-rw-r--r--application/palemoon/components/sessionstore/_SessionFile.jsm9
-rw-r--r--application/palemoon/components/sessionstore/nsSessionStartup.js13
-rw-r--r--application/palemoon/components/shell/Makefile.in11
-rw-r--r--application/palemoon/components/shell/ShellService.jsm114
-rw-r--r--application/palemoon/components/shell/content/setDesktopBackground.js253
-rw-r--r--application/palemoon/components/shell/jar.mn2
-rw-r--r--application/palemoon/components/shell/moz.build12
-rw-r--r--application/palemoon/components/shell/nsGNOMEShellService.cpp77
-rw-r--r--application/palemoon/components/shell/nsGNOMEShellService.h16
-rw-r--r--application/palemoon/components/shell/nsIGNOMEShellService.idl19
-rw-r--r--application/palemoon/components/shell/nsIMacShellService.idl2
-rw-r--r--application/palemoon/components/shell/nsIShellService.idl19
-rw-r--r--application/palemoon/components/shell/nsIWindowsShellService.idl2
-rw-r--r--application/palemoon/components/shell/nsMacShellService.cpp76
-rw-r--r--application/palemoon/components/shell/nsMacShellService.h4
-rw-r--r--application/palemoon/components/shell/nsSetDefaultBrowser.js11
-rw-r--r--application/palemoon/components/shell/nsShellService.h2
-rw-r--r--application/palemoon/components/shell/nsWindowsShellService.cpp349
-rw-r--r--application/palemoon/components/shell/nsWindowsShellService.h8
-rw-r--r--application/palemoon/components/statusbar/Downloads.jsm1256
-rw-r--r--application/palemoon/components/statusbar/Progress.jsm324
-rw-r--r--application/palemoon/components/statusbar/Status.jsm870
-rw-r--r--application/palemoon/components/statusbar/Status4Evar.jsm458
-rw-r--r--application/palemoon/components/statusbar/Toolbars.jsm386
-rw-r--r--application/palemoon/components/statusbar/content/overlay.css5
-rw-r--r--application/palemoon/components/statusbar/content/overlay.js8
-rw-r--r--application/palemoon/components/statusbar/content/overlay.xul92
-rw-r--r--application/palemoon/components/statusbar/content/prefs.css5
-rw-r--r--application/palemoon/components/statusbar/content/prefs.js474
-rw-r--r--application/palemoon/components/statusbar/content/prefs.xml1370
-rw-r--r--application/palemoon/components/statusbar/content/prefs.xul542
-rw-r--r--application/palemoon/components/statusbar/content/tabbrowser.xml410
-rw-r--r--application/palemoon/components/statusbar/status4evar.idl88
-rw-r--r--application/palemoon/components/statusbar/status4evar.js1342
-rw-r--r--application/palemoon/config/version.txt2
-rw-r--r--application/palemoon/configure.in7
-rw-r--r--application/palemoon/confvars.sh129
-rw-r--r--application/palemoon/fonts/EmojiOneMozilla.ttfbin1227260 -> 0 bytes
-rw-r--r--application/palemoon/fonts/README.txt8
-rw-r--r--application/palemoon/fonts/TwemojiMozilla.ttfbin0 -> 1075912 bytes
-rw-r--r--application/palemoon/fonts/moz.build4
-rw-r--r--application/palemoon/installer/Makefile.in25
-rw-r--r--application/palemoon/installer/package-manifest.in600
-rw-r--r--application/palemoon/installer/removed-files.in25
-rw-r--r--application/palemoon/installer/windows/Makefile.in28
-rw-r--r--application/palemoon/installer/windows/moz.build7
-rw-r--r--application/palemoon/installer/windows/nsis/defines.nsi.in47
-rw-r--r--application/palemoon/installer/windows/nsis/installer.nsi371
-rw-r--r--application/palemoon/installer/windows/nsis/maintenanceservice_installer.nsi332
-rw-r--r--application/palemoon/installer/windows/nsis/shared.nsh462
-rw-r--r--application/palemoon/installer/windows/nsis/uninstaller.nsi318
-rw-r--r--application/palemoon/installer/windows/stub.tag4
-rw-r--r--application/palemoon/locales/Makefile.in14
-rw-r--r--application/palemoon/locales/en-US/chrome/browser/browser.dtd3
-rw-r--r--application/palemoon/locales/en-US/chrome/browser/browser.properties27
-rw-r--r--application/palemoon/locales/en-US/chrome/browser/migration/migration.dtd36
-rw-r--r--application/palemoon/locales/en-US/chrome/browser/migration/migration.properties51
-rw-r--r--application/palemoon/locales/en-US/chrome/browser/places/places.dtd2
-rw-r--r--application/palemoon/locales/en-US/chrome/browser/preferences/aboutPermissions.dtd2
-rw-r--r--application/palemoon/locales/en-US/chrome/browser/preferences/cookies.dtd5
-rw-r--r--application/palemoon/locales/en-US/chrome/browser/preferences/permissions.dtd8
-rw-r--r--application/palemoon/locales/en-US/chrome/browser/preferences/preferences.properties27
-rw-r--r--application/palemoon/locales/en-US/chrome/overrides/netError.dtd69
-rw-r--r--application/palemoon/locales/generic/install.rdf30
-rw-r--r--application/palemoon/locales/jar.mn4
-rw-r--r--application/palemoon/locales/l10n.ini8
-rw-r--r--application/palemoon/modules/AboutHomeUtils.jsm2
-rw-r--r--application/palemoon/modules/AutoCompletePopup.jsm293
-rw-r--r--application/palemoon/modules/BrowserNewTabPreloader.jsm8
-rw-r--r--application/palemoon/modules/FormSubmitObserver.jsm16
-rw-r--r--application/palemoon/modules/FormValidationHandler.jsm10
-rw-r--r--application/palemoon/modules/NetworkPrioritizer.jsm8
-rw-r--r--application/palemoon/modules/PopupNotifications.jsm189
-rw-r--r--application/palemoon/modules/QuotaManager.jsm14
-rw-r--r--application/palemoon/modules/SharedFrame.jsm2
-rw-r--r--application/palemoon/modules/WindowsPreviewPerTab.jsm64
-rw-r--r--application/palemoon/modules/moz.build12
-rw-r--r--application/palemoon/modules/openLocationLastURL.jsm8
-rw-r--r--application/palemoon/modules/promise.js2
-rw-r--r--application/palemoon/modules/webrtcUI.jsm130
-rw-r--r--application/palemoon/moz.configure7
-rw-r--r--application/palemoon/themes/linux/Push-16.pngbin0 -> 606 bytes
-rw-r--r--application/palemoon/themes/linux/Push-64.pngbin0 -> 8056 bytes
-rw-r--r--application/palemoon/themes/linux/autocomplete.css210
-rw-r--r--application/palemoon/themes/linux/browser.css62
-rw-r--r--application/palemoon/themes/linux/jar.mn8
-rw-r--r--application/palemoon/themes/linux/notification-16.pngbin610 -> 0 bytes
-rw-r--r--application/palemoon/themes/linux/notification-64.pngbin3373 -> 0 bytes
-rw-r--r--application/palemoon/themes/linux/preferences/aboutPermissions.css2
-rw-r--r--application/palemoon/themes/linux/sync-notification-24.pngbin1565 -> 0 bytes
-rw-r--r--application/palemoon/themes/linux/web-notifications-icon.svg15
-rw-r--r--application/palemoon/themes/linux/web-notifications-tray.svg23
-rw-r--r--application/palemoon/themes/osx/Push-16.pngbin0 -> 312 bytes
-rw-r--r--application/palemoon/themes/osx/Push-64.pngbin0 -> 8490 bytes
-rw-r--r--application/palemoon/themes/osx/autocomplete.css198
-rw-r--r--application/palemoon/themes/osx/browser.css79
-rw-r--r--application/palemoon/themes/osx/jar.mn8
-rw-r--r--application/palemoon/themes/osx/notification-16.pngbin610 -> 0 bytes
-rw-r--r--application/palemoon/themes/osx/notification-64.pngbin3373 -> 0 bytes
-rw-r--r--application/palemoon/themes/osx/preferences/aboutPermissions.css2
-rw-r--r--application/palemoon/themes/osx/shared.inc2
-rw-r--r--application/palemoon/themes/osx/sync-notification-24.pngbin1119 -> 0 bytes
-rw-r--r--application/palemoon/themes/osx/web-notifications-icon.svg15
-rw-r--r--application/palemoon/themes/osx/web-notifications-tray.svg23
-rw-r--r--application/palemoon/themes/shared/browser.inc5
-rw-r--r--application/palemoon/themes/windows/Push-16.pngbin0 -> 704 bytes
-rw-r--r--application/palemoon/themes/windows/Push-64.pngbin0 -> 8388 bytes
-rw-r--r--application/palemoon/themes/windows/autocomplete.css238
-rw-r--r--application/palemoon/themes/windows/browser.css76
-rw-r--r--application/palemoon/themes/windows/jar.mn10
-rw-r--r--application/palemoon/themes/windows/notification-16.pngbin610 -> 0 bytes
-rw-r--r--application/palemoon/themes/windows/notification-64.pngbin3373 -> 0 bytes
-rw-r--r--application/palemoon/themes/windows/preferences/aboutPermissions.css2
-rw-r--r--application/palemoon/themes/windows/sync-notification-24.pngbin1119 -> 0 bytes
-rw-r--r--application/palemoon/themes/windows/web-notifications-icon.svg15
-rw-r--r--application/palemoon/themes/windows/web-notifications-tray.svg23
-rw-r--r--application/xulrunner/README.xulrunner13
-rw-r--r--application/xulrunner/app.mozbuild13
-rw-r--r--application/xulrunner/app/Makefile.in75
-rw-r--r--application/xulrunner/app/default16.pngbin0 -> 744 bytes
-rw-r--r--application/xulrunner/app/default32.pngbin0 -> 2084 bytes
-rw-r--r--application/xulrunner/app/default48.pngbin0 -> 3846 bytes
-rw-r--r--application/xulrunner/app/document.icobin0 -> 22486 bytes
-rw-r--r--application/xulrunner/app/install_app.py221
-rw-r--r--application/xulrunner/app/macbuild/Info.plist.in31
-rw-r--r--application/xulrunner/app/macbuild/InfoPlist.stringsbin0 -> 280 bytes
-rw-r--r--application/xulrunner/app/moz.build70
-rw-r--r--application/xulrunner/app/nsXULRunnerApp.cpp294
-rw-r--r--application/xulrunner/app/splash.rc22
-rw-r--r--application/xulrunner/app/xulrunner.exe.manifest38
-rw-r--r--application/xulrunner/app/xulrunner.icobin0 -> 22486 bytes
-rw-r--r--application/xulrunner/app/xulrunner.js26
-rw-r--r--application/xulrunner/config/mozconfig9
-rw-r--r--application/xulrunner/config/mozconfigs/common7
-rw-r--r--application/xulrunner/config/mozconfigs/common.override8
-rw-r--r--application/xulrunner/config/mozconfigs/linux32/xulrunner9
-rw-r--r--application/xulrunner/config/mozconfigs/linux32/xulrunner-qt15
-rw-r--r--application/xulrunner/config/mozconfigs/linux64/xulrunner9
-rw-r--r--application/xulrunner/config/mozconfigs/macosx-universal/xulrunner9
-rw-r--r--application/xulrunner/config/mozconfigs/win32/xulrunner16
-rw-r--r--application/xulrunner/config/mozconfigs/win64/xulrunner15
-rw-r--r--application/xulrunner/configure.in11
-rw-r--r--application/xulrunner/confvars.sh28
-rw-r--r--application/xulrunner/examples/moz.build7
-rw-r--r--application/xulrunner/examples/simple/application.ini43
-rw-r--r--application/xulrunner/examples/simple/components/moz.build7
-rw-r--r--application/xulrunner/examples/simple/components/public/moz.build13
-rw-r--r--application/xulrunner/examples/simple/components/public/nsISimpleTest.idl15
-rw-r--r--application/xulrunner/examples/simple/components/src/SimpleTest.cpp54
-rw-r--r--application/xulrunner/examples/simple/components/src/SimpleTest.js27
-rw-r--r--application/xulrunner/examples/simple/components/src/SimpleTest.manifest2
-rw-r--r--application/xulrunner/examples/simple/components/src/moz.build21
-rw-r--r--application/xulrunner/examples/simple/content/contents.rdf (renamed from memory/jemalloc/src/config.stamp.in)0
-rw-r--r--application/xulrunner/examples/simple/content/simple.js17
-rw-r--r--application/xulrunner/examples/simple/content/simple.xul20
-rw-r--r--application/xulrunner/examples/simple/icons/simple.icobin0 -> 29310 bytes
-rw-r--r--application/xulrunner/examples/simple/jar.mn12
-rw-r--r--application/xulrunner/examples/simple/locale/simple.dtd7
-rw-r--r--application/xulrunner/examples/simple/moz.build22
-rw-r--r--application/xulrunner/examples/simple/simple-prefs.js6
-rw-r--r--application/xulrunner/installer/Makefile.in148
-rw-r--r--application/xulrunner/installer/debian/changelog.in7
-rw-r--r--application/xulrunner/installer/debian/compat1
-rw-r--r--application/xulrunner/installer/debian/control48
-rw-r--r--application/xulrunner/installer/debian/icon_base6436
-rw-r--r--application/xulrunner/installer/debian/menu2
-rw-r--r--application/xulrunner/installer/debian/postinst.in42
-rw-r--r--application/xulrunner/installer/debian/prerm.in29
-rw-r--r--application/xulrunner/installer/debian/xulrunner.links.in2
-rw-r--r--application/xulrunner/installer/debian/xulrunner.service.in4
-rw-r--r--application/xulrunner/installer/libxul-embedding.pc.in10
-rw-r--r--application/xulrunner/installer/libxul.pc.in11
-rw-r--r--application/xulrunner/installer/moz.build6
-rw-r--r--application/xulrunner/installer/mozilla-js.pc.in10
-rw-r--r--application/xulrunner/installer/mozilla-nspr.pc.in11
-rw-r--r--application/xulrunner/installer/mozilla-nss.pc.in10
-rw-r--r--application/xulrunner/installer/mozilla-plugin.pc.in8
-rw-r--r--application/xulrunner/locales/all-locales39
-rw-r--r--application/xulrunner/moz.build11
-rw-r--r--application/xulrunner/moz.configure7
-rw-r--r--application/xulrunner/stub/Makefile.in11
-rw-r--r--application/xulrunner/stub/moz.build51
-rw-r--r--application/xulrunner/stub/nsXULStub.cpp445
-rw-r--r--application/xulrunner/stub/xulrunner-stub.exe.manifest38
-rw-r--r--application/xulrunner/stub/xulrunner-stub.rc6
-rw-r--r--application/xulrunner/tools/redit/Makefile.in11
-rw-r--r--application/xulrunner/tools/redit/moz.build15
-rw-r--r--application/xulrunner/tools/redit/redit.cpp187
-rw-r--r--browser/LICENSE10
-rw-r--r--browser/app/blocklist.xml6
-rw-r--r--browser/app/macbuild/Contents/Info.plist.in5
-rw-r--r--browser/app/nsBrowserApp.cpp5
-rw-r--r--browser/app/profile/firefox.js16
-rw-r--r--browser/base/content/abouthome/aboutHome.css59
-rw-r--r--browser/base/content/abouthome/aboutHome.js280
-rw-r--r--browser/base/content/abouthome/aboutHome.xhtml11
-rw-r--r--browser/base/content/browser-context.inc2
-rw-r--r--browser/base/content/browser-media.js58
-rw-r--r--browser/base/content/browser-places.js33
-rw-r--r--browser/base/content/browser-plugins.js40
-rw-r--r--browser/base/content/browser-syncui.js12
-rw-r--r--browser/base/content/browser.css3
-rwxr-xr-xbrowser/base/content/browser.js69
-rw-r--r--browser/base/content/browser.xul10
-rw-r--r--browser/base/content/nsContextMenu.js3
-rw-r--r--browser/base/content/sync/aboutSyncTabs.js13
-rw-r--r--browser/base/content/tab-content.js5
-rw-r--r--browser/base/content/utilityOverlay.js7
-rw-r--r--browser/base/jar.mn6
-rw-r--r--browser/branding/official/locales/en-US/brand.dtd1
-rw-r--r--browser/branding/shared/preferences.inc2
-rw-r--r--browser/branding/shared/uaoverrides.inc7
-rw-r--r--browser/branding/unofficial/VisualElements_150.pngbin37693 -> 16524 bytes
-rw-r--r--browser/branding/unofficial/VisualElements_70.pngbin11763 -> 6827 bytes
-rw-r--r--browser/branding/unofficial/basilisk.VisualElementsManifest.xml8
-rw-r--r--browser/branding/unofficial/branding.nsi18
-rw-r--r--browser/branding/unofficial/configure.sh2
-rw-r--r--browser/branding/unofficial/content/about-background.pngbin88500 -> 63599 bytes
-rw-r--r--browser/branding/unofficial/content/about-logo.pngbin30469 -> 16835 bytes
-rw-r--r--browser/branding/unofficial/content/about-logo@2x.pngbin81662 -> 41517 bytes
-rw-r--r--browser/branding/unofficial/content/about-wordmark.svg101
-rw-r--r--browser/branding/unofficial/content/about.pngbin54712 -> 22324 bytes
-rw-r--r--browser/branding/unofficial/content/icon48.pngbin3442 -> 2909 bytes
-rw-r--r--browser/branding/unofficial/content/icon64.pngbin5096 -> 3850 bytes
-rw-r--r--browser/branding/unofficial/default16.pngbin901 -> 793 bytes
-rw-r--r--browser/branding/unofficial/default32.pngbin2037 -> 1748 bytes
-rw-r--r--browser/branding/unofficial/default48.pngbin3441 -> 2909 bytes
-rw-r--r--browser/branding/unofficial/firefox.icnsbin648208 -> 69916 bytes
-rw-r--r--browser/branding/unofficial/firefox.icobin74588 -> 45953 bytes
-rw-r--r--browser/branding/unofficial/locales/en-US/brand.dtd9
-rw-r--r--browser/branding/unofficial/locales/en-US/brand.properties9
-rw-r--r--browser/branding/unofficial/mozicon128.pngbin13817 -> 9246 bytes
-rw-r--r--browser/branding/unofficial/serpent.VisualElementsManifest.xml8
-rw-r--r--browser/components/about/AboutRedirector.cpp124
-rw-r--r--browser/components/build/nsModule.cpp1
-rw-r--r--browser/components/migration/FirefoxProfileMigrator.js2
-rw-r--r--browser/components/migration/MigrationUtils.jsm1
-rw-r--r--browser/components/moz.build5
-rw-r--r--browser/components/nsBrowserContentHandler.js2
-rw-r--r--browser/components/nsBrowserGlue.js13
-rw-r--r--browser/components/places/content/controller.js3
-rw-r--r--browser/components/places/content/editBookmarkOverlay.js72
-rw-r--r--browser/components/preferences/cookies.js19
-rw-r--r--browser/components/preferences/cookies.xul2
-rw-r--r--browser/components/preferences/in-content/advanced.js3
-rw-r--r--browser/components/preferences/in-content/advanced.xul23
-rw-r--r--browser/components/preferences/in-content/security.js12
-rw-r--r--browser/components/preferences/in-content/security.xul8
-rw-r--r--browser/components/sessionstore/content/aboutSessionRestore.js52
-rw-r--r--browser/components/webextensions/ext-commands.js29
-rwxr-xr-xbrowser/confvars.sh3
-rw-r--r--browser/experiments/.eslintrc.js11
-rw-r--r--browser/experiments/Experiments.jsm2354
-rw-r--r--browser/experiments/Experiments.manifest6
-rw-r--r--browser/experiments/ExperimentsService.js118
-rw-r--r--browser/experiments/Makefile.in16
-rw-r--r--browser/experiments/docs/index.rst13
-rw-r--r--browser/experiments/docs/manifest.rst429
-rw-r--r--browser/experiments/moz.build18
-rw-r--r--browser/experiments/test/addons/experiment-1/install.rdf16
-rw-r--r--browser/experiments/test/addons/experiment-1a/install.rdf16
-rw-r--r--browser/experiments/test/addons/experiment-2/install.rdf16
-rw-r--r--browser/experiments/test/addons/experiment-racybranch/bootstrap.js35
-rw-r--r--browser/experiments/test/addons/experiment-racybranch/install.rdf16
-rw-r--r--browser/experiments/test/xpcshell/.eslintrc.js15
-rw-r--r--browser/experiments/test/xpcshell/experiments_1.manifest19
-rw-r--r--browser/experiments/test/xpcshell/head.js199
-rw-r--r--browser/experiments/test/xpcshell/test_activate.js151
-rw-r--r--browser/experiments/test/xpcshell/test_api.js1647
-rw-r--r--browser/experiments/test/xpcshell/test_cache.js399
-rw-r--r--browser/experiments/test/xpcshell/test_cacherace.js102
-rw-r--r--browser/experiments/test/xpcshell/test_conditions.js325
-rw-r--r--browser/experiments/test/xpcshell/test_disableExperiments.js180
-rw-r--r--browser/experiments/test/xpcshell/test_fetch.js68
-rw-r--r--browser/experiments/test/xpcshell/test_nethang_bug1012924.js47
-rw-r--r--browser/experiments/test/xpcshell/test_previous_provider.js179
-rw-r--r--browser/experiments/test/xpcshell/test_telemetry.js294
-rw-r--r--browser/experiments/test/xpcshell/test_telemetry_disabled.js21
-rw-r--r--browser/experiments/test/xpcshell/test_upgrade.js52
-rw-r--r--browser/experiments/test/xpcshell/xpcshell.ini31
-rw-r--r--browser/extensions/aushelper/bootstrap.js189
-rw-r--r--browser/extensions/aushelper/install.rdf.in32
-rw-r--r--browser/extensions/aushelper/moz.build16
-rw-r--r--browser/extensions/e10srollout/bootstrap.js197
-rw-r--r--browser/extensions/e10srollout/install.rdf.in32
-rw-r--r--browser/extensions/e10srollout/moz.build16
-rw-r--r--browser/extensions/flyweb/bootstrap.js297
-rw-r--r--browser/extensions/flyweb/install.rdf.in32
-rw-r--r--browser/extensions/flyweb/jar.mn10
-rw-r--r--browser/extensions/flyweb/moz.build18
-rw-r--r--browser/extensions/flyweb/skin/flyweb-icon.svg40
-rw-r--r--browser/extensions/flyweb/skin/linux/flyweb.css5
-rw-r--r--browser/extensions/flyweb/skin/linux/icon-16.pngbin1251 -> 0 bytes
-rw-r--r--browser/extensions/flyweb/skin/linux/icon-32-anchored.pngbin2711 -> 0 bytes
-rw-r--r--browser/extensions/flyweb/skin/linux/icon-32.pngbin699 -> 0 bytes
-rw-r--r--browser/extensions/flyweb/skin/linux/icon-64-anchored.pngbin6468 -> 0 bytes
-rw-r--r--browser/extensions/flyweb/skin/linux/icon-64.pngbin1311 -> 0 bytes
-rw-r--r--browser/extensions/flyweb/skin/osx/flyweb.css5
-rw-r--r--browser/extensions/flyweb/skin/osx/icon-16.pngbin1646 -> 0 bytes
-rw-r--r--browser/extensions/flyweb/skin/osx/icon-32-anchored.pngbin2711 -> 0 bytes
-rw-r--r--browser/extensions/flyweb/skin/osx/icon-32.pngbin2595 -> 0 bytes
-rw-r--r--browser/extensions/flyweb/skin/osx/icon-64-anchored.pngbin6468 -> 0 bytes
-rw-r--r--browser/extensions/flyweb/skin/osx/icon-64.pngbin3168 -> 0 bytes
-rw-r--r--browser/extensions/flyweb/skin/shared/flyweb.css54
-rw-r--r--browser/extensions/flyweb/skin/windows/flyweb.css5
-rw-r--r--browser/extensions/flyweb/skin/windows/icon-16.pngbin1251 -> 0 bytes
-rw-r--r--browser/extensions/flyweb/skin/windows/icon-32-anchored.pngbin2711 -> 0 bytes
-rw-r--r--browser/extensions/flyweb/skin/windows/icon-32.pngbin699 -> 0 bytes
-rw-r--r--browser/extensions/flyweb/skin/windows/icon-64-anchored.pngbin6468 -> 0 bytes
-rw-r--r--browser/extensions/flyweb/skin/windows/icon-64.pngbin1311 -> 0 bytes
-rw-r--r--browser/extensions/formautofill/.eslintrc.js474
-rw-r--r--browser/extensions/formautofill/bootstrap.js12
-rw-r--r--browser/extensions/formautofill/content/FormAutofillContent.jsm134
-rw-r--r--browser/extensions/formautofill/content/FormAutofillParent.jsm173
-rw-r--r--browser/extensions/formautofill/content/ProfileStorage.jsm251
-rw-r--r--browser/extensions/formautofill/install.rdf.in32
-rw-r--r--browser/extensions/formautofill/jar.mn7
-rw-r--r--browser/extensions/formautofill/moz.build18
-rw-r--r--browser/extensions/moz.build10
-rw-r--r--browser/extensions/pdfjs/content/PdfStreamConverter.jsm35
-rw-r--r--browser/extensions/pdfjs/content/build/pdf.worker.js67
-rw-r--r--browser/extensions/pocket/bootstrap.js511
-rw-r--r--browser/extensions/pocket/content/AboutPocket.jsm93
-rw-r--r--browser/extensions/pocket/content/Pocket.jsm93
-rw-r--r--browser/extensions/pocket/content/main.js737
-rw-r--r--browser/extensions/pocket/content/panels/css/firasans.css6
-rw-r--r--browser/extensions/pocket/content/panels/css/normalize.css424
-rw-r--r--browser/extensions/pocket/content/panels/css/saved.css825
-rw-r--r--browser/extensions/pocket/content/panels/css/signup.css424
-rw-r--r--browser/extensions/pocket/content/panels/fonts/FiraSans-Regular.woffbin179188 -> 0 bytes
-rw-r--r--browser/extensions/pocket/content/panels/img/pocket.svg22
-rw-r--r--browser/extensions/pocket/content/panels/img/pocketerror@1x.pngbin1479 -> 0 bytes
-rw-r--r--browser/extensions/pocket/content/panels/img/pocketerror@2x.pngbin3131 -> 0 bytes
-rw-r--r--browser/extensions/pocket/content/panels/img/pocketlogo@1x.pngbin3539 -> 0 bytes
-rw-r--r--browser/extensions/pocket/content/panels/img/pocketlogo@2x.pngbin7378 -> 0 bytes
-rw-r--r--browser/extensions/pocket/content/panels/img/pocketlogosolo@1x.pngbin1256 -> 0 bytes
-rw-r--r--browser/extensions/pocket/content/panels/img/pocketlogosolo@2x.pngbin2566 -> 0 bytes
-rw-r--r--browser/extensions/pocket/content/panels/img/pocketmenuitem16.pngbin264 -> 0 bytes
-rw-r--r--browser/extensions/pocket/content/panels/img/pocketmenuitem16@2x.pngbin641 -> 0 bytes
-rw-r--r--browser/extensions/pocket/content/panels/img/pocketsignup_button@1x.pngbin7315 -> 0 bytes
-rw-r--r--browser/extensions/pocket/content/panels/img/pocketsignup_button@2x.pngbin13480 -> 0 bytes
-rw-r--r--browser/extensions/pocket/content/panels/img/pocketsignup_devices@1x.pngbin22496 -> 0 bytes
-rw-r--r--browser/extensions/pocket/content/panels/img/pocketsignup_devices@2x.pngbin73925 -> 0 bytes
-rw-r--r--browser/extensions/pocket/content/panels/img/pocketsignup_hero@1x.pngbin44964 -> 0 bytes
-rw-r--r--browser/extensions/pocket/content/panels/img/pocketsignup_hero@2x.pngbin148877 -> 0 bytes
-rw-r--r--browser/extensions/pocket/content/panels/img/signup_firefoxlogo@1x.pngbin635 -> 0 bytes
-rw-r--r--browser/extensions/pocket/content/panels/img/signup_firefoxlogo@2x.pngbin1375 -> 0 bytes
-rw-r--r--browser/extensions/pocket/content/panels/img/signup_help@1x.pngbin659 -> 0 bytes
-rw-r--r--browser/extensions/pocket/content/panels/img/signup_help@2x.pngbin1420 -> 0 bytes
-rw-r--r--browser/extensions/pocket/content/panels/img/signup_or@1x.pngbin1843 -> 0 bytes
-rw-r--r--browser/extensions/pocket/content/panels/img/signup_or@2x.pngbin2925 -> 0 bytes
-rw-r--r--browser/extensions/pocket/content/panels/img/tag_close@1x.pngbin287 -> 0 bytes
-rw-r--r--browser/extensions/pocket/content/panels/img/tag_close@2x.pngbin508 -> 0 bytes
-rw-r--r--browser/extensions/pocket/content/panels/img/tag_closeactive@1x.pngbin208 -> 0 bytes
-rw-r--r--browser/extensions/pocket/content/panels/img/tag_closeactive@2x.pngbin354 -> 0 bytes
-rw-r--r--browser/extensions/pocket/content/panels/js/messages.js78
-rw-r--r--browser/extensions/pocket/content/panels/js/saved.js608
-rw-r--r--browser/extensions/pocket/content/panels/js/signup.js193
-rw-r--r--browser/extensions/pocket/content/panels/js/tmpl.js242
-rw-r--r--browser/extensions/pocket/content/panels/js/vendor/handlebars.runtime.js660
-rw-r--r--browser/extensions/pocket/content/panels/js/vendor/jquery-2.1.1.min.js4
-rw-r--r--browser/extensions/pocket/content/panels/js/vendor/jquery.tokeninput.min.js954
-rw-r--r--browser/extensions/pocket/content/panels/license.txt35
-rw-r--r--browser/extensions/pocket/content/panels/saved.html19
-rw-r--r--browser/extensions/pocket/content/panels/signup.html18
-rw-r--r--browser/extensions/pocket/content/panels/tmpl/saved_premiumextras.handlebars2
-rw-r--r--browser/extensions/pocket/content/panels/tmpl/saved_premiumshell.handlebars6
-rw-r--r--browser/extensions/pocket/content/panels/tmpl/saved_shell.handlebars29
-rw-r--r--browser/extensions/pocket/content/panels/tmpl/signup_shell.handlebars32
-rw-r--r--browser/extensions/pocket/content/panels/tmpl/signupstoryboard_shell.handlebars43
-rw-r--r--browser/extensions/pocket/content/pktApi.jsm657
-rw-r--r--browser/extensions/pocket/content/pocket-content-process.js54
-rw-r--r--browser/extensions/pocket/install.rdf.in32
-rw-r--r--browser/extensions/pocket/jar.mn32
-rw-r--r--browser/extensions/pocket/locale/ast/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/az/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/bg/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/bn-BD/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/cs/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/da/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/de/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/dsb/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/en-GB/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/en-US/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/es-AR/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/es-CL/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/es-ES/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/es-MX/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/et/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/fi/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/fr/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/fy-NL/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/gu-IN/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/hr/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/hsb/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/hu/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/it/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/ja/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/jar.mn33
-rw-r--r--browser/extensions/pocket/locale/ka/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/kab/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/lt/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/lv/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/moz.build7
-rw-r--r--browser/extensions/pocket/locale/mr/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/ms/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/nl/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/nn-NO/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/or/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/pl/pocket.properties48
-rw-r--r--browser/extensions/pocket/locale/pt-BR/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/pt-PT/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/rm/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/ro/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/ru/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/sk/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/sl/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/sq/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/sr/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/sv-SE/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/te/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/th/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/tr/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/uk/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/zh-CN/pocket.properties43
-rw-r--r--browser/extensions/pocket/locale/zh-TW/pocket.properties43
-rw-r--r--browser/extensions/pocket/moz.build20
-rw-r--r--browser/extensions/pocket/skin/linux/Toolbar-inverted.pngbin743 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/linux/Toolbar-inverted@2x.pngbin2299 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/linux/Toolbar.pngbin975 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/linux/Toolbar@2x.pngbin3223 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/linux/menuPanel.pngbin1377 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/linux/menuPanel@2x.pngbin2671 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/linux/pocket.css10
-rw-r--r--browser/extensions/pocket/skin/osx/Toolbar-inverted.pngbin1438 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/osx/Toolbar-inverted@2x.pngbin3323 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/osx/Toolbar-yosemite.pngbin958 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/osx/Toolbar-yosemite@2x.pngbin2129 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/osx/Toolbar.pngbin1571 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/osx/Toolbar@2x.pngbin3613 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/osx/menuPanel-yosemite.pngbin1570 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/osx/menuPanel-yosemite@2x.pngbin3316 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/osx/menuPanel.pngbin1976 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/osx/menuPanel@2x.pngbin3861 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/osx/pocket.css42
-rw-r--r--browser/extensions/pocket/skin/shared/pocket.css79
-rw-r--r--browser/extensions/pocket/skin/windows/Toolbar-XP.pngbin1141 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/windows/Toolbar-aero.pngbin1163 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/windows/Toolbar-aero@2x.pngbin2612 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/windows/Toolbar-inverted.pngbin825 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/windows/Toolbar-inverted@2x.pngbin1767 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/windows/Toolbar-lunaSilver.pngbin1155 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/windows/Toolbar-win8.pngbin649 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/windows/Toolbar-win8@2x.pngbin1036 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/windows/Toolbar.pngbin635 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/windows/Toolbar@2x.pngbin1001 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/windows/menuPanel-aero.pngbin2097 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/windows/menuPanel-aero@2x.pngbin5063 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/windows/menuPanel.pngbin1377 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/windows/menuPanel@2x.pngbin2671 -> 0 bytes
-rw-r--r--browser/extensions/pocket/skin/windows/pocket.css16
-rw-r--r--browser/extensions/webcompat/bootstrap.js9
-rw-r--r--browser/extensions/webcompat/install.rdf.in32
-rw-r--r--browser/extensions/webcompat/moz.build16
-rw-r--r--browser/fonts/EmojiOneMozilla.ttfbin1227260 -> 0 bytes
-rw-r--r--browser/fonts/README.txt6
-rw-r--r--browser/fonts/TwemojiMozilla.ttfbin0 -> 1057104 bytes
-rw-r--r--browser/fonts/moz.build2
-rw-r--r--browser/installer/package-manifest.in24
-rw-r--r--browser/locales/Makefile.in9
-rw-r--r--browser/locales/en-US/chrome/browser/preferences/cookies.dtd7
-rw-r--r--browser/locales/en-US/chrome/browser/preferences/preferences.properties20
-rw-r--r--browser/locales/en-US/firefox-l10n.js4
-rw-r--r--browser/locales/search/list.json30
-rw-r--r--browser/modules/AboutHome.jsm27
-rw-r--r--browser/modules/ContentCrashHandlers.jsm121
-rw-r--r--browser/modules/ContentWebRTC.jsm1
-rw-r--r--browser/modules/PluginContent.jsm26
-rw-r--r--browser/modules/webrtcUI.jsm8
-rw-r--r--browser/moz.build1
-rw-r--r--browser/moz.configure5
-rw-r--r--browser/themes/shared/tabs.inc.css5
-rw-r--r--build/application.ini13
-rw-r--r--build/autoconf/compiler-opts.m415
-rw-r--r--build/autoconf/jemalloc.m4114
-rw-r--r--build/automation-build.mk4
-rw-r--r--build/automation.py.in6
-rw-r--r--build/directive4.py1
-rw-r--r--build/mobile/b2gautomation.py4
-rw-r--r--build/mobile/remoteautomation.py37
-rw-r--r--build/moz.build9
-rw-r--r--build/moz.configure/memory.configure38
-rw-r--r--build/moz.configure/old.configure1
-rw-r--r--build/pgo/profileserver.py1
-rw-r--r--build/valgrind/mach_commands.py1
-rw-r--r--build/valgrind/x86_64-redhat-linux-gnu.sup1
-rw-r--r--caps/BasePrincipal.cpp7
-rw-r--r--caps/nsNullPrincipalURI.cpp26
-rw-r--r--chrome/nsChromeRegistry.cpp5
-rw-r--r--config/external/icu/data/icudt58l.datbin10912128 -> 10912368 bytes
-rw-r--r--config/external/nss/Makefile.in11
-rw-r--r--config/external/nss/nss.symbols8
-rw-r--r--config/milestone.txt2
-rw-r--r--config/rules.mk26
-rw-r--r--config/version.mk2
-rw-r--r--db/sqlite3/src/sqlite3.c13276
-rw-r--r--db/sqlite3/src/sqlite3.h493
-rwxr-xr-x[-rw-r--r--]devtools/client/canvasdebugger/test/browser_profiling-canvas.js2
-rw-r--r--devtools/client/commandline/test/browser_cmd_csscoverage_startstop.js1
-rw-r--r--devtools/client/debugger/test/mochitest/browser_dbg_closure-inspection.js4
-rw-r--r--devtools/client/framework/browser-menus.js98
-rw-r--r--devtools/client/framework/devtools-browser.js109
-rw-r--r--devtools/client/framework/moz.build5
-rw-r--r--devtools/client/framework/test/browser_keybindings_01.js3
-rw-r--r--devtools/client/framework/test/browser_toolbox_textbox_context_menu.js9
-rw-r--r--devtools/client/inspector/computed/test/browser_computed_search-filter_context-menu.js9
-rw-r--r--devtools/client/inspector/markup/test/browser_markup_events3.js4
-rw-r--r--devtools/client/inspector/rules/test/browser_rules_search-filter_context-menu.js9
-rw-r--r--devtools/client/inspector/test/browser_inspector_search-filter_context-menu.js7
-rw-r--r--devtools/client/menus.js4
-rw-r--r--devtools/client/netmonitor/request-list-context-menu.js1
-rw-r--r--devtools/client/scratchpad/test/head.js1
-rw-r--r--devtools/client/shared/developer-toolbar.js20
-rw-r--r--devtools/client/shared/widgets/TableWidget.js9
-rw-r--r--devtools/client/storage/ui.js42
-rw-r--r--devtools/client/webconsole/new-console-output/test/mochitest/head.js1
-rw-r--r--devtools/client/webconsole/test/browser_webconsole_closure_inspection.js2
-rw-r--r--devtools/client/webconsole/test/browser_webconsole_jsterm.js1
-rw-r--r--devtools/client/webconsole/test/browser_webconsole_output_02.js4
-rw-r--r--devtools/client/webconsole/webconsole.xul2
-rw-r--r--devtools/server/actors/errordocs.js1
-rw-r--r--devtools/server/actors/object.js5
-rw-r--r--devtools/server/actors/webconsole.js6
-rw-r--r--devtools/server/event-parsers.js76
-rwxr-xr-x[-rw-r--r--]devtools/server/tests/mochitest/test_memory_allocations_05.html5
-rw-r--r--devtools/server/tests/unit/test_functiongrips-01.js2
-rw-r--r--devtools/shared/webconsole/test/test_page_errors.html10
-rw-r--r--docs/CONTRIBUTING.md86
-rw-r--r--docshell/base/nsAboutRedirector.cpp32
-rw-r--r--docshell/base/nsDSURIContentListener.cpp9
-rw-r--r--docshell/base/nsDocShell.cpp139
-rw-r--r--docshell/base/nsDocShell.h2
-rw-r--r--docshell/base/nsDocShellLoadInfo.cpp15
-rw-r--r--docshell/base/nsDocShellLoadInfo.h1
-rw-r--r--docshell/base/nsIDocShell.idl3
-rw-r--r--docshell/base/nsIDocShellLoadInfo.idl6
-rw-r--r--docshell/base/nsIRefreshURI.idl15
-rw-r--r--docshell/base/nsIWebNavigation.idl6
-rw-r--r--docshell/build/nsDocShellModule.cpp6
-rwxr-xr-x[-rw-r--r--]docshell/test/chrome/test_bug453650.xul4
-rw-r--r--docshell/test/navigation/file_contentpolicy_block_window.html5
-rw-r--r--docshell/test/navigation/mochitest.ini2
-rw-r--r--docshell/test/navigation/test_contentpolicy_block_window.html96
-rw-r--r--docshell/test/unit/test_nsDefaultURIFixup_info.js6
-rw-r--r--docshell/test/unit/test_nsDefaultURIFixup_search.js2
-rw-r--r--dom/base/Element.cpp24
-rwxr-xr-x[-rw-r--r--]dom/base/File.cpp3
-rw-r--r--dom/base/FragmentOrElement.cpp1
-rw-r--r--dom/base/IdleRequest.cpp119
-rw-r--r--dom/base/IdleRequest.h40
-rw-r--r--dom/base/Location.cpp21
-rwxr-xr-x[-rw-r--r--]dom/base/MultipartBlobImpl.cpp4
-rw-r--r--dom/base/Timeout.h8
-rw-r--r--dom/base/TimeoutHandler.cpp43
-rw-r--r--dom/base/TimeoutHandler.h50
-rwxr-xr-xdom/base/TimerClamping.cpp35
-rwxr-xr-xdom/base/TimerClamping.h22
-rwxr-xr-x[-rw-r--r--]dom/base/moz.build4
-rw-r--r--dom/base/nsContentPolicy.cpp6
-rw-r--r--dom/base/nsContentUtils.cpp24
-rw-r--r--dom/base/nsContentUtils.h16
-rw-r--r--dom/base/nsDOMNavigationTiming.cpp138
-rw-r--r--dom/base/nsDOMNavigationTiming.h125
-rw-r--r--dom/base/nsDocument.cpp37
-rw-r--r--dom/base/nsDocumentEncoder.cpp2
-rw-r--r--dom/base/nsFrameMessageManager.cpp4
-rw-r--r--dom/base/nsGkAtomList.h1
-rw-r--r--dom/base/nsGlobalWindow.cpp380
-rw-r--r--dom/base/nsGlobalWindow.h31
-rw-r--r--dom/base/nsIDocument.h3
-rw-r--r--dom/base/nsINode.cpp4
-rw-r--r--dom/base/nsRange.cpp2
-rwxr-xr-x[-rw-r--r--]dom/base/nsXHTMLContentSerializer.cpp2
-rw-r--r--dom/base/test/mochitest.ini1
-rw-r--r--dom/base/test/test_bug403852.html7
-rw-r--r--dom/base/test/test_file_negative_date.html6
-rw-r--r--dom/bindings/BindingUtils.cpp20
-rw-r--r--dom/bindings/Codegen.py14
-rw-r--r--dom/bindings/ErrorResult.h2
-rw-r--r--dom/bindings/test/test_promise_rejections_from_jsimplemented.html2
-rw-r--r--dom/cache/Cache.cpp2
-rw-r--r--dom/canvas/CanvasRenderingContext2D.cpp26
-rw-r--r--dom/canvas/CanvasRenderingContext2D.h4
-rw-r--r--dom/canvas/DocumentRendererChild.cpp94
-rw-r--r--dom/canvas/DocumentRendererChild.h37
-rw-r--r--dom/canvas/DocumentRendererParent.cpp63
-rw-r--r--dom/canvas/DocumentRendererParent.h44
-rw-r--r--dom/canvas/WebGL2ContextState.cpp1
-rw-r--r--dom/canvas/WebGLContextDraw.cpp1
-rw-r--r--dom/canvas/WebGLContextExtensions.cpp4
-rw-r--r--dom/canvas/WebGLFramebuffer.cpp3
-rw-r--r--dom/canvas/WebGLObjectModel.h12
-rw-r--r--dom/canvas/WebGLProgram.cpp1
-rw-r--r--dom/canvas/WebGLTransformFeedback.cpp1
-rw-r--r--dom/canvas/moz.build7
-rw-r--r--dom/canvas/test/webgl-mochitest/mochitest.ini2
-rwxr-xr-x[-rw-r--r--]dom/console/Console.cpp6
-rw-r--r--dom/console/Console.h10
-rwxr-xr-x[-rw-r--r--]dom/events/Event.cpp48
-rwxr-xr-x[-rw-r--r--]dom/events/Event.h5
-rw-r--r--dom/events/EventDispatcher.cpp5
-rw-r--r--dom/events/EventListenerManager.cpp5
-rw-r--r--dom/events/EventNameList.h4
-rw-r--r--dom/events/EventStateManager.cpp125
-rw-r--r--dom/events/EventStateManager.h10
-rw-r--r--dom/events/PointerEvent.cpp14
-rw-r--r--dom/events/PointerEvent.h2
-rw-r--r--dom/events/WheelHandlingHelper.cpp1
-rw-r--r--dom/events/test/mochitest.ini1
-rw-r--r--dom/events/test/pointerevents/mochitest.ini17
-rw-r--r--dom/events/test/pointerevents/pointerevent_releasepointercapture_events_to_original_target-manual.html65
-rw-r--r--dom/events/test/pointerevents/test_bug1285128.html7
-rw-r--r--dom/events/test/pointerevents/test_bug1323158.html93
-rw-r--r--dom/events/test/pointerevents/test_pointerevent_capture_suppressing_mouse-manual.html3
-rw-r--r--dom/events/test/pointerevents/test_pointerevent_releasepointercapture_events_to_original_target-manual.html27
-rw-r--r--dom/events/test/pointerevents/test_pointerevent_setpointercapture_relatedtarget-manual.html4
-rw-r--r--dom/events/test/pointerevents/test_trigger_fullscreen_by_pointer_events.html57
-rw-r--r--dom/events/test/pointerevents/test_trigger_popup_by_pointer_events.html76
-rw-r--r--dom/events/test/test_bug1304044.html133
-rw-r--r--dom/events/test/test_eventTimeStamp.html48
-rw-r--r--dom/fetch/InternalHeaders.cpp58
-rw-r--r--dom/fetch/InternalHeaders.h31
-rw-r--r--dom/fetch/Response.cpp8
-rw-r--r--dom/fetch/Response.h2
-rw-r--r--dom/html/HTMLInputElement.cpp443
-rw-r--r--dom/html/HTMLInputElement.h96
-rw-r--r--dom/html/crashtests/1350972.html22
-rw-r--r--dom/html/crashtests/crashtests.list1
-rw-r--r--dom/html/nsHTMLDocument.cpp30
-rw-r--r--dom/html/nsHTMLDocument.h1
-rw-r--r--dom/html/nsIFormControl.h2
-rw-r--r--dom/html/nsTextEditorState.cpp31
-rw-r--r--dom/html/nsTextEditorState.h2
-rw-r--r--dom/html/test/forms/mochitest.ini8
-rw-r--r--dom/html/test/forms/test_input_date_key_events.html228
-rw-r--r--dom/html/test/forms/test_input_datetime_focus_blur.html28
-rw-r--r--dom/html/test/forms/test_input_datetime_focus_blur_events.html90
-rw-r--r--dom/html/test/forms/test_input_datetime_input_change_events.html88
-rw-r--r--dom/html/test/forms/test_input_datetime_tabindex.html47
-rw-r--r--dom/html/test/forms/test_input_time_focus_blur_events.html82
-rw-r--r--dom/html/test/forms/test_input_types_pref.html48
-rw-r--r--dom/html/test/forms/test_input_typing_sanitization.html28
-rw-r--r--dom/html/test/forms/test_max_attribute.html47
-rw-r--r--dom/html/test/forms/test_min_attribute.html49
-rw-r--r--dom/html/test/forms/test_step_attribute.html102
-rw-r--r--dom/html/test/forms/test_stepup_stepdown.html174
-rw-r--r--dom/html/test/forms/test_valueAsDate_pref.html8
-rw-r--r--dom/html/test/forms/test_valueasdate_attribute.html108
-rw-r--r--dom/html/test/forms/test_valueasnumber_attribute.html123
-rw-r--r--dom/html/test/test_bug558788-1.html5
-rw-r--r--dom/indexedDB/test/browser_forgetThisSite.js7
-rw-r--r--dom/ipc/ContentChild.cpp39
-rw-r--r--dom/ipc/ContentParent.cpp86
-rw-r--r--dom/ipc/CrashReporterParent.cpp83
-rw-r--r--dom/ipc/CrashReporterParent.h236
-rw-r--r--dom/ipc/DatePickerParent.cpp87
-rw-r--r--dom/ipc/DatePickerParent.h61
-rw-r--r--dom/ipc/PBrowser.ipdl28
-rw-r--r--dom/ipc/PDatePicker.ipdl27
-rw-r--r--dom/ipc/PDocumentRenderer.ipdl25
-rw-r--r--dom/ipc/ProcessHangMonitor.cpp36
-rw-r--r--dom/ipc/TabChild.cpp75
-rw-r--r--dom/ipc/TabChild.h25
-rw-r--r--dom/ipc/TabMessageUtils.h8
-rw-r--r--dom/ipc/TabParent.cpp34
-rw-r--r--dom/ipc/TabParent.h15
-rw-r--r--dom/ipc/moz.build3
-rw-r--r--dom/locales/en-US/chrome/layout/HtmlForm.properties1
-rw-r--r--dom/locales/en-US/chrome/plugins.properties3
-rw-r--r--dom/locales/en-US/chrome/security/security.properties3
-rw-r--r--dom/media/AudioConverter.cpp8
-rw-r--r--dom/media/Benchmark.cpp2
-rwxr-xr-x[-rw-r--r--]dom/media/DOMMediaStream.cpp5
-rw-r--r--dom/media/GraphDriver.cpp1
-rw-r--r--dom/media/MediaData.cpp2
-rw-r--r--dom/media/MediaStreamGraph.cpp4
-rw-r--r--dom/media/MediaStreamTrack.cpp12
-rw-r--r--dom/media/gmp/GMPChild.cpp4
-rw-r--r--dom/media/gmp/GMPParent.cpp154
-rw-r--r--dom/media/gmp/GMPParent.h15
-rw-r--r--dom/media/gmp/GMPServiceParent.cpp109
-rw-r--r--dom/media/gmp/GMPServiceParent.h18
-rw-r--r--dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp4
-rwxr-xr-x[-rw-r--r--]dom/media/test/test_background_video_suspend.html4
-rwxr-xr-x[-rw-r--r--]dom/media/test/test_streams_element_capture.html3
-rwxr-xr-x[-rw-r--r--]dom/media/test/test_streams_element_capture_createObjectURL.html3
-rwxr-xr-x[-rw-r--r--]dom/media/webaudio/AudioContext.cpp3
-rwxr-xr-x[-rw-r--r--]dom/performance/Performance.cpp54
-rw-r--r--dom/performance/Performance.h36
-rw-r--r--dom/performance/PerformanceEntry.h21
-rw-r--r--dom/performance/PerformanceMainThread.cpp99
-rw-r--r--dom/performance/PerformanceMainThread.h21
-rw-r--r--dom/performance/PerformanceNavigationTiming.cpp96
-rw-r--r--dom/performance/PerformanceNavigationTiming.h71
-rw-r--r--dom/performance/PerformanceObserver.cpp14
-rw-r--r--dom/performance/PerformanceObserverEntryList.cpp15
-rw-r--r--dom/performance/PerformanceResourceTiming.cpp49
-rw-r--r--dom/performance/PerformanceResourceTiming.h12
-rw-r--r--dom/performance/PerformanceService.cpp46
-rw-r--r--dom/performance/PerformanceService.h48
-rwxr-xr-x[-rw-r--r--]dom/performance/PerformanceTiming.cpp122
-rwxr-xr-x[-rw-r--r--]dom/performance/PerformanceTiming.h45
-rw-r--r--dom/performance/PerformanceWorker.cpp35
-rw-r--r--dom/performance/PerformanceWorker.h14
-rw-r--r--dom/performance/moz.build4
-rw-r--r--dom/performance/tests/mochitest.ini3
-rw-r--r--dom/performance/tests/performance_observer.html74
-rw-r--r--dom/performance/tests/test_performance_observer.html52
-rw-r--r--dom/performance/tests/test_performance_user_timing.js23
-rw-r--r--dom/performance/tests/test_timeOrigin.html68
-rw-r--r--dom/performance/tests/test_worker_observer.html13
-rw-r--r--dom/performance/tests/test_worker_performance_now.js48
-rw-r--r--dom/performance/tests/worker_performance_observer.html32
-rw-r--r--dom/plugins/base/nsPluginHost.cpp10
-rw-r--r--dom/plugins/base/nsPluginInstanceOwner.cpp3
-rw-r--r--dom/plugins/base/nsPluginsDirDarwin.cpp19
-rw-r--r--dom/plugins/ipc/PluginMessageUtils.h3
-rw-r--r--dom/plugins/ipc/PluginModuleChild.cpp4
-rwxr-xr-xdom/plugins/ipc/PluginModuleParent.cpp528
-rw-r--r--dom/plugins/ipc/PluginModuleParent.h44
-rw-r--r--dom/plugins/test/mochitest/test_crash_notify_no_report.xul11
-rw-r--r--dom/plugins/test/mochitest/test_crash_submit.xul12
-rw-r--r--dom/plugins/test/mochitest/test_hang_submit.xul11
-rw-r--r--dom/promise/Promise.cpp30
-rw-r--r--dom/promise/Promise.h19
-rw-r--r--dom/security/nsCSPContext.cpp13
-rw-r--r--dom/security/nsContentSecurityManager.cpp140
-rw-r--r--dom/security/nsContentSecurityManager.h2
-rw-r--r--dom/security/test/csp/file_child-src_worker-redirect.html7
-rw-r--r--dom/security/test/csp/file_frame_ancestors_ro.html1
-rw-r--r--dom/security/test/csp/file_frame_ancestors_ro.html^headers^1
-rw-r--r--dom/security/test/csp/mochitest.ini3
-rw-r--r--dom/security/test/csp/test_frame_ancestors_ro.html69
-rw-r--r--dom/security/test/general/browser.ini14
-rw-r--r--dom/security/test/general/browser_test_data_download.js37
-rw-r--r--dom/security/test/general/browser_test_data_text_csv.js37
-rw-r--r--dom/security/test/general/browser_test_toplevel_data_navigations.js54
-rw-r--r--dom/security/test/general/browser_test_view_image_data_navigation.js30
-rw-r--r--dom/security/test/general/file_block_toplevel_data_navigation.html14
-rw-r--r--dom/security/test/general/file_block_toplevel_data_navigation2.html29
-rw-r--r--dom/security/test/general/file_block_toplevel_data_navigation3.html13
-rw-r--r--dom/security/test/general/file_block_toplevel_data_redirect.sjs14
-rw-r--r--dom/security/test/general/file_data_download.html14
-rw-r--r--dom/security/test/general/file_data_text_csv.html14
-rw-r--r--dom/security/test/general/file_toplevel_data_meta_redirect.html10
-rw-r--r--dom/security/test/general/file_toplevel_data_navigations.sjs14
-rw-r--r--dom/security/test/general/file_view_image_data_navigation.html12
-rw-r--r--dom/security/test/general/mochitest.ini12
-rw-r--r--dom/security/test/general/test_allow_opening_data_json.html39
-rw-r--r--dom/security/test/general/test_allow_opening_data_pdf.html41
-rw-r--r--dom/security/test/general/test_block_script_wrong_mime.html6
-rw-r--r--dom/security/test/general/test_block_toplevel_data_img_navigation.html53
-rw-r--r--dom/security/test/general/test_block_toplevel_data_navigation.html86
-rw-r--r--dom/security/test/general/test_contentpolicytype_targeted_link_iframe.html1
-rw-r--r--dom/security/test/moz.build1
-rw-r--r--dom/svg/DOMSVGPathSegList.cpp21
-rw-r--r--dom/svg/SVGClipPathElement.cpp7
-rw-r--r--dom/svg/SVGClipPathElement.h4
-rw-r--r--dom/svg/SVGTextContentElement.h1
-rwxr-xr-x[-rw-r--r--]dom/tests/browser/browser.ini2
-rwxr-xr-xdom/tests/browser/browser_performanceAPI.js139
-rwxr-xr-xdom/tests/browser/file_workerPerformance.js65
-rw-r--r--dom/tests/mochitest/fetch/test_headers_common.js10
-rwxr-xr-x[-rw-r--r--]dom/tests/mochitest/general/mochitest.ini3
-rw-r--r--dom/tests/mochitest/general/test_interfaces.html6
-rwxr-xr-xdom/tests/mochitest/general/test_reduce_time_precision.html143
-rwxr-xr-xdom/tests/mochitest/general/worker_child.js28
-rwxr-xr-xdom/tests/mochitest/general/worker_grandchild.js10
-rw-r--r--dom/url/URL.cpp40
-rw-r--r--dom/url/tests/test_url.html12
-rw-r--r--dom/webidl/CanvasRenderingContext2D.webidl3
-rw-r--r--dom/webidl/Document.webidl6
-rw-r--r--dom/webidl/EventHandler.webidl1
-rw-r--r--dom/webidl/HTMLDocument.webidl4
-rw-r--r--dom/webidl/HTMLInputElement.webidl19
-rw-r--r--dom/webidl/Performance.webidl3
-rw-r--r--dom/webidl/PerformanceNavigationTiming.webidl33
-rw-r--r--dom/webidl/PerformanceObserver.webidl1
-rw-r--r--dom/webidl/PerformanceResourceTiming.webidl8
-rw-r--r--dom/webidl/PerformanceTiming.webidl6
-rw-r--r--dom/webidl/PointerEvent.webidl4
-rw-r--r--dom/webidl/Response.webidl2
-rw-r--r--dom/webidl/Selection.webidl3
-rw-r--r--dom/webidl/moz.build1
-rw-r--r--dom/workers/RuntimeService.cpp4
-rw-r--r--dom/workers/ServiceWorkerEvents.cpp14
-rw-r--r--dom/workers/ServiceWorkerPrivate.cpp45
-rw-r--r--dom/workers/ServiceWorkerPrivate.h1
-rw-r--r--dom/workers/WorkerPrivate.cpp147
-rw-r--r--dom/workers/WorkerPrivate.h16
-rw-r--r--dom/workers/test/serviceworkers/chrome.ini3
-rw-r--r--dom/workers/test/serviceworkers/test_devtools_serviceworker_interception.html168
-rw-r--r--dom/workers/test/serviceworkers/test_serviceworker_interfaces.js4
-rw-r--r--dom/workers/test/test_404.html1
-rw-r--r--dom/workers/test/test_bug1036484.html1
-rw-r--r--dom/workers/test/test_loadError.html8
-rw-r--r--dom/workers/test/test_worker_interfaces.js4
-rw-r--r--dom/xhr/XMLHttpRequestMainThread.cpp69
-rw-r--r--dom/xhr/XMLHttpRequestMainThread.h5
-rw-r--r--dom/xhr/XMLHttpRequestWorker.cpp11
-rw-r--r--dom/xhr/XMLHttpRequestWorker.h7
-rw-r--r--dom/xslt/xpath/txXPCOMExtensionFunction.cpp2
-rw-r--r--editor/libeditor/EditorBase.cpp9
-rw-r--r--editor/libeditor/HTMLEditorDataTransfer.cpp38
-rw-r--r--editor/libeditor/TextEditorDataTransfer.cpp7
-rw-r--r--editor/libeditor/tests/chrome.ini1
-rw-r--r--editor/libeditor/tests/mochitest.ini6
-rw-r--r--editor/libeditor/tests/test_bug1306532.html64
-rw-r--r--editor/libeditor/tests/test_bug1352799.html98
-rw-r--r--editor/libeditor/tests/test_pasteImgTextarea.html20
-rw-r--r--editor/libeditor/tests/test_pasteImgTextarea.xul27
-rw-r--r--extensions/cookie/test/unit/test_bug526789.js12
-rw-r--r--gfx/2d/FilterNodeSoftware.cpp2
-rw-r--r--gfx/cairo/cairo/src/cairo-mutex-impl-private.h23
-rw-r--r--gfx/gl/GLTextureImage.cpp3
-rw-r--r--gfx/gl/GLUploadHelpers.cpp31
-rw-r--r--gfx/gl/GLUploadHelpers.h2
-rw-r--r--gfx/gl/GfxTexturesReporter.cpp8
-rw-r--r--gfx/gl/TextureImageEGL.cpp4
-rw-r--r--gfx/ipc/GPUChild.cpp9
-rw-r--r--gfx/ipc/GPUParent.cpp8
-rw-r--r--gfx/layers/ImageContainer.cpp23
-rw-r--r--gfx/layers/apz/src/APZCTreeManager.cpp1
-rw-r--r--gfx/layers/composite/TextureHost.cpp65
-rw-r--r--gfx/layers/composite/X11TextureHost.cpp13
-rw-r--r--gfx/layers/d3d11/TextureD3D11.cpp6
-rw-r--r--gfx/layers/opengl/CompositingRenderTargetOGL.cpp2
-rw-r--r--gfx/layers/opengl/CompositingRenderTargetOGL.h2
-rw-r--r--gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp8
-rw-r--r--gfx/layers/opengl/TextureHostOGL.cpp27
-rw-r--r--gfx/skia/skia/include/core/SkTypes.h6
-rw-r--r--gfx/skia/skia/include/private/SkTDArray.h8
-rw-r--r--gfx/skia/skia/src/core/SkMallocPixelRef.cpp13
-rw-r--r--gfx/skia/skia/src/core/SkMath.cpp15
-rw-r--r--gfx/skia/skia/src/core/SkSafeMath.h106
-rw-r--r--gfx/src/DriverCrashGuard.cpp19
-rw-r--r--gfx/src/gfxCrashReporterUtils.cpp4
-rw-r--r--gfx/tests/gtest/TestGfxPrefs.cpp24
-rw-r--r--gfx/tests/gtest/TestLayers.h16
-rw-r--r--gfx/tests/gtest/TestTextures.cpp7
-rw-r--r--gfx/thebes/gfxFT2Utils.cpp30
-rw-r--r--gfx/thebes/gfxFcPlatformFontList.cpp29
-rw-r--r--gfx/thebes/gfxFcPlatformFontList.h4
-rw-r--r--gfx/thebes/gfxPlatform.cpp8
-rw-r--r--gfx/thebes/gfxPlatformGtk.cpp6
-rwxr-xr-xgfx/thebes/gfxWindowsPlatform.cpp8
-rw-r--r--image/Downscaler.cpp14
-rw-r--r--image/DownscalingFilter.h14
-rw-r--r--image/VectorImage.cpp22
-rw-r--r--image/decoders/icon/nsIconURI.cpp26
-rw-r--r--intl/icu/source/common/umutex.h2
-rw-r--r--intl/tzdata/SVN-INFO8
-rw-r--r--intl/tzdata/source/be/metaZones.resbin41088 -> 41184 bytes
-rw-r--r--intl/tzdata/source/be/windowsZones.resbin22368 -> 22400 bytes
-rw-r--r--intl/tzdata/source/be/zoneinfo64.resbin152208 -> 152320 bytes
-rw-r--r--intl/tzdata/source/ee/metaZones.resbin41088 -> 41184 bytes
-rw-r--r--intl/tzdata/source/ee/windowsZones.resbin22368 -> 22400 bytes
-rw-r--r--intl/tzdata/source/ee/zoneinfo64.resbin152208 -> 152320 bytes
-rw-r--r--intl/tzdata/source/le/metaZones.resbin41088 -> 41184 bytes
-rw-r--r--intl/tzdata/source/le/windowsZones.resbin22368 -> 22400 bytes
-rw-r--r--intl/tzdata/source/le/zoneinfo64.resbin152208 -> 152320 bytes
-rw-r--r--intl/tzdata/source/metaZones.txt15
-rw-r--r--intl/tzdata/source/windowsZones.txt9
-rw-r--r--intl/tzdata/source/zoneinfo64.txt69
-rw-r--r--intl/uconv/nsScriptableUConv.cpp16
-rw-r--r--intl/uconv/ucvtw/nsBIG5ToUnicode.cpp12
-rw-r--r--intl/uconv/ucvtw/nsUnicodeToBIG5.cpp21
-rw-r--r--ipc/glue/BackgroundUtils.cpp4
-rw-r--r--ipc/glue/CrashReporterHost.cpp103
-rw-r--r--ipc/glue/CrashReporterHost.h20
-rw-r--r--ipc/glue/CrashReporterMetadataShmem.cpp23
-rw-r--r--ipc/glue/CrashReporterMetadataShmem.h4
-rw-r--r--ipc/glue/GeckoChildProcessHost.cpp31
-rw-r--r--ipc/glue/IPCMessageUtils.h11
-rw-r--r--ipc/glue/MessageChannel.h4
-rw-r--r--ipc/glue/MessageLink.cpp7
-rw-r--r--ipc/glue/ProtocolUtils.cpp67
-rw-r--r--ipc/glue/ProtocolUtils.h12
-rw-r--r--ipc/ipdl/ipdl/lower.py7
-rw-r--r--js/public/CallArgs.h2
-rw-r--r--js/public/Date.h8
-rw-r--r--js/public/Proxy.h4
-rw-r--r--js/public/TraceKind.h8
-rw-r--r--js/public/Value.h109
-rw-r--r--js/src/Makefile.in7
-rw-r--r--js/src/aclocal.m41
-rw-r--r--js/src/builtin/Array.js50
-rw-r--r--js/src/builtin/Classes.js2
-rw-r--r--js/src/builtin/Intl.cpp483
-rw-r--r--js/src/builtin/Intl.h54
-rw-r--r--js/src/builtin/Intl.js602
-rw-r--r--js/src/builtin/IntlTimeZoneData.h2
-rw-r--r--js/src/builtin/Map.js27
-rw-r--r--js/src/builtin/ModuleObject.cpp4
-rw-r--r--js/src/builtin/Promise.cpp53
-rw-r--r--js/src/builtin/ReflectParse.cpp6
-rw-r--r--js/src/builtin/RegExp.cpp140
-rw-r--r--js/src/builtin/RegExp.js134
-rw-r--r--js/src/builtin/RegExpLocalReplaceOpt.h.js36
-rw-r--r--js/src/builtin/Set.js29
-rw-r--r--js/src/builtin/TestingFunctions.cpp2
-rw-r--r--js/src/builtin/TypedArray.js79
-rw-r--r--js/src/builtin/TypedObject.cpp2
-rw-r--r--js/src/builtin/Utilities.js12
-rw-r--r--js/src/builtin/WeakMap.js27
-rw-r--r--js/src/builtin/WeakSet.js29
-rw-r--r--js/src/frontend/BytecodeCompiler.cpp152
-rw-r--r--js/src/frontend/BytecodeCompiler.h41
-rw-r--r--js/src/frontend/BytecodeEmitter.cpp2180
-rw-r--r--js/src/frontend/BytecodeEmitter.h54
-rw-r--r--js/src/frontend/FullParseHandler.h7
-rw-r--r--js/src/frontend/ParseNode-inl.h2
-rw-r--r--js/src/frontend/ParseNode.cpp18
-rw-r--r--js/src/frontend/ParseNode.h19
-rw-r--r--js/src/frontend/Parser.cpp105
-rw-r--r--js/src/frontend/Parser.h16
-rw-r--r--js/src/frontend/SharedContext.h8
-rw-r--r--js/src/frontend/SyntaxParseHandler.h3
-rw-r--r--js/src/frontend/TokenStream.cpp149
-rw-r--r--js/src/frontend/TokenStream.h1
-rw-r--r--js/src/gc/Allocator.cpp8
-rw-r--r--js/src/gc/Barrier.cpp2
-rw-r--r--js/src/gc/Barrier.h2
-rw-r--r--js/src/gc/Marking.cpp4
-rw-r--r--js/src/gc/Marking.h2
-rw-r--r--js/src/jit-test/tests/auto-regress/for-of-iterator-close-debugger.js15
-rw-r--r--js/src/jit-test/tests/basic/constructor-name.js2
-rw-r--r--js/src/jit-test/tests/basic/destructuring-default.js5
-rw-r--r--js/src/jit-test/tests/basic/destructuring-rest.js7
-rw-r--r--js/src/jit-test/tests/basic/functionnames.js32
-rw-r--r--js/src/jit-test/tests/basic/regexpLastIndexReset.js4
-rw-r--r--js/src/jit-test/tests/debug/Memory-drainAllocationsLog-16.js2
-rw-r--r--js/src/jit-test/tests/debug/Script-gc-02.js2
-rw-r--r--js/src/jit-test/tests/debug/Script-gc-03.js2
-rw-r--r--js/src/jit-test/tests/debug/Script-sourceStart-04.js4
-rw-r--r--js/src/jit-test/tests/for-of/bug-1331444.js7
-rw-r--r--js/src/jit-test/tests/for-of/bug-1341339.js9
-rw-r--r--js/src/jit-test/tests/gc/bug-1323868.js5
-rw-r--r--js/src/jit-test/tests/ion/bug1333946.js8
-rw-r--r--js/src/jit-test/tests/ion/bug1334314.js16
-rw-r--r--js/src/jit-test/tests/parser/bug-1357075.js10
-rw-r--r--js/src/jit-test/tests/proxy/testWrapWithProtoIter.js1
-rw-r--r--js/src/jit-test/tests/proxy/testWrapWithProtoTypedArray.js19
-rw-r--r--js/src/jit-test/tests/saved-stacks/function-display-name.js5
-rw-r--r--js/src/jit-test/tests/self-test/assertDeepEq.js3
-rw-r--r--js/src/jit/BaselineBailouts.cpp35
-rw-r--r--js/src/jit/BaselineCompiler.cpp95
-rw-r--r--js/src/jit/BaselineCompiler.h13
-rw-r--r--js/src/jit/BaselineFrameInfo.h4
-rw-r--r--js/src/jit/CodeGenerator.cpp127
-rw-r--r--js/src/jit/CodeGenerator.h8
-rw-r--r--js/src/jit/IonAnalysis.cpp6
-rw-r--r--js/src/jit/IonBuilder.cpp81
-rw-r--r--js/src/jit/IonBuilder.h4
-rw-r--r--js/src/jit/JitFrames.cpp101
-rw-r--r--js/src/jit/Lowering.cpp27
-rw-r--r--js/src/jit/Lowering.h2
-rw-r--r--js/src/jit/MIR.h60
-rw-r--r--js/src/jit/MIRGraph.cpp13
-rw-r--r--js/src/jit/MIRGraph.h3
-rw-r--r--js/src/jit/MOpcodes.h2
-rw-r--r--js/src/jit/MacroAssembler.cpp6
-rw-r--r--js/src/jit/ProcessExecutableMemory.cpp8
-rw-r--r--js/src/jit/ProcessExecutableMemory.h8
-rw-r--r--js/src/jit/RegisterSets.h8
-rw-r--r--js/src/jit/RematerializedFrame.cpp14
-rw-r--r--js/src/jit/VMFunctions.cpp9
-rw-r--r--js/src/jit/VMFunctions.h4
-rw-r--r--js/src/jit/arm/MacroAssembler-arm.cpp12
-rw-r--r--js/src/jit/arm/MacroAssembler-arm.h16
-rw-r--r--js/src/jit/arm64/MacroAssembler-arm64.h8
-rw-r--r--js/src/jit/mips32/MacroAssembler-mips32.cpp4
-rw-r--r--js/src/jit/mips32/MacroAssembler-mips32.h4
-rw-r--r--js/src/jit/mips64/MacroAssembler-mips64.cpp2
-rw-r--r--js/src/jit/mips64/MacroAssembler-mips64.h6
-rw-r--r--js/src/jit/shared/IonAssemblerBuffer.h4
-rw-r--r--js/src/jit/shared/LIR-shared.h40
-rw-r--r--js/src/jit/shared/LOpcodes-shared.h2
-rw-r--r--js/src/jit/x64/MacroAssembler-x64.h8
-rw-r--r--js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h32
-rw-r--r--js/src/jit/x86/MacroAssembler-x86.cpp4
-rw-r--r--js/src/jit/x86/MacroAssembler-x86.h12
-rw-r--r--js/src/js.msg9
-rw-r--r--js/src/jsapi.cpp81
-rw-r--r--js/src/jsapi.h34
-rw-r--r--js/src/jsarray.cpp2
-rw-r--r--js/src/jsatom.cpp8
-rw-r--r--js/src/jscntxt.cpp2
-rw-r--r--js/src/jscompartmentinlines.h2
-rwxr-xr-x[-rw-r--r--]js/src/jsdate.cpp17
-rw-r--r--js/src/jsexn.cpp226
-rw-r--r--js/src/jsexn.h9
-rw-r--r--js/src/jsfriendapi.h2
-rw-r--r--js/src/jsfun.cpp428
-rw-r--r--js/src/jsfun.h68
-rw-r--r--js/src/jsfuninlines.h2
-rw-r--r--js/src/jsiter.cpp52
-rw-r--r--js/src/jsiter.h3
-rw-r--r--js/src/jsobj.cpp5
-rw-r--r--js/src/jsopcode.cpp60
-rw-r--r--js/src/jsopcode.h1
-rw-r--r--js/src/jsopcodeinlines.h3
-rw-r--r--js/src/jsscript.cpp43
-rw-r--r--js/src/jsscript.h49
-rw-r--r--js/src/jsstr.cpp2
-rw-r--r--js/src/jsstr.h3
-rw-r--r--js/src/jstypes.h4
-rwxr-xr-xjs/src/make-source-package.sh5
-rw-r--r--js/src/moz.build2
-rw-r--r--js/src/old-configure.in13
-rw-r--r--js/src/shell/js.cpp46
-rw-r--r--js/src/tests/Intl/Collator/construct-newtarget.js81
-rw-r--r--js/src/tests/Intl/DateTimeFormat/construct-newtarget.js81
-rw-r--r--js/src/tests/Intl/DateTimeFormat/timeZone_backward_links.js2
-rw-r--r--js/src/tests/Intl/DateTimeFormat/timeZone_backzone.js3
-rw-r--r--js/src/tests/Intl/DateTimeFormat/timeZone_backzone_links.js2
-rw-r--r--js/src/tests/Intl/DateTimeFormat/timeZone_notbackward_links.js2
-rw-r--r--js/src/tests/Intl/NumberFormat/construct-newtarget.js81
-rw-r--r--js/src/tests/Intl/PluralRules/resolvedOptions-overridden-species.js27
-rw-r--r--js/src/tests/Intl/getCanonicalLocales-overridden-species.js23
-rw-r--r--js/src/tests/Intl/getDisplayNames.js238
-rw-r--r--js/src/tests/ecma_2017/AsyncFunctions/construct-newtarget.js79
-rw-r--r--js/src/tests/ecma_2017/AsyncFunctions/subclass.js31
-rw-r--r--js/src/tests/ecma_2017/lastIndex-exec.js80
-rw-r--r--js/src/tests/ecma_2017/lastIndex-match-or-replace.js122
-rw-r--r--js/src/tests/ecma_2017/lastIndex-search.js118
-rw-r--r--js/src/tests/ecma_3/String/15.5.4.11.js2
-rw-r--r--js/src/tests/ecma_5/Function/arguments-caller-callee.js12
-rw-r--r--js/src/tests/ecma_5/Function/arguments-property-attributes.js8
-rw-r--r--js/src/tests/ecma_5/RegExp/exec.js2
-rw-r--r--js/src/tests/ecma_5/RegExp/instance-property-storage-introspection.js5
-rw-r--r--js/src/tests/ecma_5/extensions/error-tostring-function.js4
-rw-r--r--js/src/tests/ecma_6/Array/from-iterator-close.js183
-rw-r--r--js/src/tests/ecma_6/Class/className.js20
-rw-r--r--js/src/tests/ecma_6/Destructuring/array-default-class.js25
-rw-r--r--js/src/tests/ecma_6/Destructuring/array-iterator-close.js93
-rw-r--r--js/src/tests/ecma_6/Destructuring/order-super.js727
-rw-r--r--js/src/tests/ecma_6/Destructuring/order.js745
-rw-r--r--js/src/tests/ecma_6/Error/constructor-proto.js17
-rw-r--r--js/src/tests/ecma_6/Error/prototype-properties.js24
-rw-r--r--js/src/tests/ecma_6/Error/prototype.js18
-rw-r--r--js/src/tests/ecma_6/Error/shell.js0
-rw-r--r--js/src/tests/ecma_6/Function/function-name-assignment.js139
-rw-r--r--js/src/tests/ecma_6/Function/function-name-binding.js54
-rw-r--r--js/src/tests/ecma_6/Function/function-name-class.js32
-rw-r--r--js/src/tests/ecma_6/Function/function-name-for.js31
-rw-r--r--js/src/tests/ecma_6/Function/function-name-method.js70
-rw-r--r--js/src/tests/ecma_6/Function/function-name-property.js58
-rw-r--r--js/src/tests/ecma_6/Function/invalid-parameter-list.js27
-rw-r--r--js/src/tests/ecma_6/Generators/construct-newtarget.js79
-rw-r--r--js/src/tests/ecma_6/Generators/delegating-yield-2.js20
-rw-r--r--js/src/tests/ecma_6/Generators/subclass.js33
-rw-r--r--js/src/tests/ecma_6/Generators/yield-iterator-close.js58
-rw-r--r--js/src/tests/ecma_6/Generators/yield-star-iterator-close.js153
-rw-r--r--js/src/tests/ecma_6/Map/constructor-iterator-close.js253
-rw-r--r--js/src/tests/ecma_6/Object/accessor-name.js9
-rw-r--r--js/src/tests/ecma_6/Promise/iterator-close.js234
-rw-r--r--js/src/tests/ecma_6/RegExp/compile-lastIndex.js34
-rw-r--r--js/src/tests/ecma_6/RegExp/compile-symbol.js14
-rw-r--r--js/src/tests/ecma_6/RegExp/constructor-symbol.js14
-rw-r--r--js/src/tests/ecma_6/RegExp/match-local-tolength-recompilation.js75
-rw-r--r--js/src/tests/ecma_6/RegExp/prototype.js31
-rw-r--r--js/src/tests/ecma_6/RegExp/replace-local-tolength-lastindex.js22
-rw-r--r--js/src/tests/ecma_6/RegExp/replace-local-tolength-recompilation.js75
-rw-r--r--js/src/tests/ecma_6/RegExp/search-trace.js2
-rw-r--r--js/src/tests/ecma_6/Statements/for-inof-finally.js78
-rw-r--r--js/src/tests/ecma_6/Statements/for-of-iterator-close-throw.js35
-rw-r--r--js/src/tests/ecma_6/Statements/for-of-iterator-close.js102
-rw-r--r--js/src/tests/ecma_6/Syntax/identifiers-with-extended-unicode-escape.js18
-rw-r--r--js/src/tests/ecma_6/shell.js52
-rw-r--r--js/src/tests/js1_8_5/extensions/clone-regexp.js1
-rw-r--r--js/src/tests/jstests.list10
-rw-r--r--js/src/threading/windows/ConditionVariable.cpp8
-rw-r--r--js/src/threading/windows/MutexImpl.cpp47
-rw-r--r--js/src/threading/windows/MutexPlatformData.h2
-rw-r--r--js/src/vm/ArgumentsObject.cpp6
-rw-r--r--js/src/vm/AsyncFunction.cpp24
-rw-r--r--js/src/vm/AsyncFunction.h3
-rw-r--r--js/src/vm/CommonPropertyNames.h2
-rw-r--r--js/src/vm/Debugger.cpp11
-rw-r--r--js/src/vm/ErrorObject.cpp69
-rw-r--r--js/src/vm/ErrorObject.h8
-rw-r--r--js/src/vm/ForOfIterator.cpp51
-rw-r--r--js/src/vm/GlobalObject.cpp4
-rw-r--r--js/src/vm/GlobalObject.h17
-rw-r--r--js/src/vm/Interpreter.cpp135
-rw-r--r--js/src/vm/Interpreter.h9
-rw-r--r--js/src/vm/ObjectGroup.cpp4
-rw-r--r--js/src/vm/Opcodes.h55
-rw-r--r--js/src/vm/ProxyObject.cpp2
-rw-r--r--js/src/vm/RegExpObject.cpp13
-rw-r--r--js/src/vm/RegExpObject.h4
-rw-r--r--js/src/vm/SelfHosting.cpp11
-rw-r--r--js/src/vm/Shape.cpp8
-rw-r--r--js/src/vm/Stack.cpp2
-rw-r--r--js/src/vm/StructuredClone.cpp7
-rw-r--r--js/src/vm/TypeInference.cpp2
-rw-r--r--js/src/vm/TypedArrayObject.cpp2
-rw-r--r--js/src/vm/Unicode.cpp879
-rw-r--r--js/src/vm/Unicode.h28
-rw-r--r--js/src/vm/UnicodeNonBMP.h10
-rwxr-xr-xjs/src/vm/make_unicode.py111
-rw-r--r--js/src/wasm/AsmJS.cpp99
-rw-r--r--js/xpconnect/loader/mozJSSubScriptLoader.cpp4
-rw-r--r--js/xpconnect/src/ExportHelpers.cpp11
-rw-r--r--js/xpconnect/src/XPCJSContext.cpp30
-rw-r--r--js/xpconnect/src/XPCShellImpl.cpp23
-rw-r--r--js/xpconnect/src/XPCVariant.cpp8
-rw-r--r--js/xpconnect/src/XPCWrappedNative.cpp7
-rw-r--r--js/xpconnect/tests/chrome/test_xrayToJS.xul18
-rw-r--r--js/xpconnect/tests/unit/test_exportFunction.js3
-rw-r--r--js/xpconnect/tests/unit/test_xray_regexp.js9
-rw-r--r--js/xpconnect/tests/unit/xpcshell.ini1
-rw-r--r--js/xpconnect/wrappers/XrayWrapper.cpp20
-rw-r--r--layout/base/RestyleManagerBase.cpp63
-rw-r--r--layout/base/nsCSSFrameConstructor.cpp19
-rw-r--r--layout/base/nsCaret.cpp4
-rw-r--r--layout/base/nsChangeHint.h55
-rw-r--r--layout/base/nsDocumentViewer.cpp7
-rw-r--r--layout/base/nsIDocumentViewerPrint.h2
-rw-r--r--layout/base/nsIPresShell.h14
-rw-r--r--layout/base/nsPresContext.cpp9
-rw-r--r--layout/base/nsPresContext.h22
-rw-r--r--layout/base/nsPresShell.cpp144
-rw-r--r--layout/base/tests/bug1078327_inner.html8
-rw-r--r--layout/base/tests/bug1162990_inner_1.html4
-rw-r--r--layout/base/tests/bug1162990_inner_2.html2
-rw-r--r--layout/base/tests/bug976963_inner.html241
-rw-r--r--layout/base/tests/bug977003_inner_5.html8
-rw-r--r--layout/base/tests/bug977003_inner_6.html6
-rw-r--r--layout/base/tests/mochitest.ini2
-rw-r--r--layout/base/tests/test_bug976963.html35
-rw-r--r--layout/forms/nsDateTimeControlFrame.cpp3
-rw-r--r--layout/generic/Selection.h3
-rw-r--r--layout/generic/nsFlexContainerFrame.cpp155
-rw-r--r--layout/generic/nsFlexContainerFrame.h15
-rw-r--r--layout/generic/nsSelection.cpp12
-rw-r--r--layout/generic/nsTextFrame.cpp6
-rw-r--r--layout/printing/nsPagePrintTimer.cpp10
-rw-r--r--layout/reftests/forms/input/datetime/reftest.list11
-rw-r--r--layout/reftests/forms/input/datetime/time-content-left-aligned-ref.html9
-rw-r--r--layout/reftests/forms/input/datetime/time-content-left-aligned.html9
-rw-r--r--layout/reftests/forms/input/datetime/time-reset-button-right-aligned-ref.html9
-rw-r--r--layout/reftests/forms/input/datetime/time-reset-button-right-aligned.html10
-rw-r--r--layout/reftests/forms/input/datetime/time-small-height-ref.html18
-rw-r--r--layout/reftests/forms/input/datetime/time-small-height.html19
-rw-r--r--layout/reftests/forms/input/datetime/time-small-width-height-ref.html18
-rw-r--r--layout/reftests/forms/input/datetime/time-small-width-height.html19
-rw-r--r--layout/reftests/forms/input/datetime/time-small-width-ref.html19
-rw-r--r--layout/reftests/forms/input/datetime/time-small-width.html20
-rw-r--r--layout/reftests/scrolling/propagated-overflow-style-1-ref.html18
-rw-r--r--layout/reftests/scrolling/propagated-overflow-style-1a.html23
-rw-r--r--layout/reftests/scrolling/propagated-overflow-style-1b.html23
-rw-r--r--layout/reftests/scrolling/propagated-overflow-style-1c.html19
-rw-r--r--layout/reftests/scrolling/propagated-overflow-style-2-ref.html15
-rw-r--r--layout/reftests/scrolling/propagated-overflow-style-2a.html26
-rw-r--r--layout/reftests/scrolling/propagated-overflow-style-2b.html26
-rw-r--r--layout/reftests/scrolling/propagated-overflow-style-2c.html24
-rw-r--r--layout/reftests/scrolling/propagated-overflow-style-2d.html24
-rw-r--r--layout/reftests/scrolling/propagated-overflow-style-2e.html15
-rw-r--r--layout/reftests/scrolling/reftest.list10
-rw-r--r--layout/reftests/w3c-css/submitted/flexbox/flexbox-align-items-center-nested-001-ref.html16
-rw-r--r--layout/reftests/w3c-css/submitted/flexbox/flexbox-align-items-center-nested-001.html47
-rw-r--r--layout/reftests/w3c-css/submitted/flexbox/reftest.list2
-rw-r--r--layout/reftests/xul/css-flex-1-ref.html18
-rw-r--r--layout/reftests/xul/css-flex-1.xul153
-rw-r--r--layout/reftests/xul/reftest.list2
-rw-r--r--layout/style/FontFaceSet.cpp12
-rw-r--r--layout/style/nsLayoutStylesheetCache.cpp293
-rw-r--r--layout/style/nsStyleStruct.cpp23
-rw-r--r--layout/style/nsStyleStruct.h11
-rw-r--r--layout/style/res/forms.css5
-rw-r--r--layout/style/res/html.css5
-rw-r--r--layout/style/test/mochitest.ini1
-rw-r--r--layout/style/test/test_dynamic_change_causing_reflow.html107
-rw-r--r--layout/style/test/test_viewport_scrollbar_causing_reflow.html125
-rw-r--r--layout/svg/SVGTextFrame.cpp4
-rw-r--r--layout/svg/nsSVGUtils.cpp3
-rw-r--r--media/ffvpx/COPYING.GPLv2339
-rw-r--r--media/ffvpx/COPYING.GPLv3674
-rw-r--r--media/ffvpx/CREDITS6
-rw-r--r--media/ffvpx/Changelog1476
-rw-r--r--media/ffvpx/FILES282
-rw-r--r--media/ffvpx/INSTALL.md17
-rw-r--r--media/ffvpx/LICENSE.md114
-rw-r--r--media/ffvpx/MAINTAINERS619
-rw-r--r--media/ffvpx/README.md49
-rw-r--r--media/ffvpx/README_MCP48
-rw-r--r--media/ffvpx/README_MOZILLA39
-rw-r--r--media/ffvpx/RELEASE1
-rw-r--r--media/ffvpx/RELEASE_NOTES15
-rw-r--r--media/ffvpx/changes.patch13
-rw-r--r--media/ffvpx/compat/atomics/win32/stdatomic.h181
-rw-r--r--media/ffvpx/compat/w32pthreads.h38
-rw-r--r--media/ffvpx/config_common.h1
-rw-r--r--media/ffvpx/config_darwin32.h1570
-rw-r--r--media/ffvpx/config_darwin64.asm1754
-rw-r--r--media/ffvpx/config_darwin64.h1762
-rw-r--r--media/ffvpx/config_unix32.h1750
-rw-r--r--media/ffvpx/config_unix64.asm1752
-rw-r--r--media/ffvpx/config_unix64.h1759
-rw-r--r--media/ffvpx/config_win32.asm1752
-rw-r--r--media/ffvpx/config_win32.h1761
-rw-r--r--media/ffvpx/config_win64.asm1754
-rw-r--r--media/ffvpx/config_win64.h1760
-rw-r--r--media/ffvpx/defaults_disabled.asm1674
-rw-r--r--media/ffvpx/defaults_disabled.h1674
-rw-r--r--media/ffvpx/ffvpxcommon.mozbuild5
-rw-r--r--media/ffvpx/libavcodec/allcodecs.c81
-rw-r--r--media/ffvpx/libavcodec/avcodec.h322
-rw-r--r--media/ffvpx/libavcodec/avdct.h84
-rw-r--r--media/ffvpx/libavcodec/avpacket.c64
-rw-r--r--media/ffvpx/libavcodec/bitstream.c20
-rw-r--r--media/ffvpx/libavcodec/bitstream_filter.c185
-rw-r--r--media/ffvpx/libavcodec/bitstream_filters.c91
-rw-r--r--media/ffvpx/libavcodec/blockdsp.h3
-rw-r--r--media/ffvpx/libavcodec/bsf.c542
-rw-r--r--media/ffvpx/libavcodec/bsf_list.c3
-rw-r--r--media/ffvpx/libavcodec/bytestream.h2
-rw-r--r--media/ffvpx/libavcodec/codec_desc.c269
-rw-r--r--media/ffvpx/libavcodec/dct.h68
-rw-r--r--media/ffvpx/libavcodec/decode.c1761
-rw-r--r--media/ffvpx/libavcodec/decode.h39
-rw-r--r--media/ffvpx/libavcodec/dummy_funcs.c73
-rw-r--r--media/ffvpx/libavcodec/error_resilience.h4
-rw-r--r--media/ffvpx/libavcodec/ff_options_table.h30
-rw-r--r--media/ffvpx/libavcodec/flac.c11
-rw-r--r--media/ffvpx/libavcodec/flac.h4
-rw-r--r--media/ffvpx/libavcodec/flac_parser.c4
-rw-r--r--media/ffvpx/libavcodec/flacdec.c34
-rw-r--r--media/ffvpx/libavcodec/flacdsp.c12
-rw-r--r--media/ffvpx/libavcodec/flacdsp.h1
-rw-r--r--media/ffvpx/libavcodec/flacdsp_template.c2
-rw-r--r--media/ffvpx/libavcodec/get_bits.h20
-rw-r--r--media/ffvpx/libavcodec/golomb.h55
-rw-r--r--media/ffvpx/libavcodec/h264chroma.h3
-rw-r--r--media/ffvpx/libavcodec/hpeldsp.h2
-rw-r--r--media/ffvpx/libavcodec/hwaccel.h24
-rw-r--r--media/ffvpx/libavcodec/idctdsp.h20
-rw-r--r--media/ffvpx/libavcodec/internal.h70
-rw-r--r--media/ffvpx/libavcodec/mathops.h19
-rw-r--r--media/ffvpx/libavcodec/me_cmp.h2
-rw-r--r--media/ffvpx/libavcodec/moz.build11
-rw-r--r--media/ffvpx/libavcodec/mpegvideo.h3
-rw-r--r--media/ffvpx/libavcodec/null_bsf.c43
-rw-r--r--media/ffvpx/libavcodec/options.c48
-rw-r--r--media/ffvpx/libavcodec/options_table.h594
-rw-r--r--media/ffvpx/libavcodec/parser.c7
-rw-r--r--media/ffvpx/libavcodec/pixblockdsp.h15
-rw-r--r--media/ffvpx/libavcodec/profiles.c12
-rw-r--r--media/ffvpx/libavcodec/profiles.h1
-rw-r--r--media/ffvpx/libavcodec/pthread_frame.c318
-rw-r--r--media/ffvpx/libavcodec/pthread_slice.c146
-rw-r--r--media/ffvpx/libavcodec/put_bits.h109
-rw-r--r--media/ffvpx/libavcodec/ratecontrol.h4
-rw-r--r--media/ffvpx/libavcodec/raw.c14
-rw-r--r--media/ffvpx/libavcodec/thread.h6
-rw-r--r--media/ffvpx/libavcodec/utils.c2040
-rw-r--r--media/ffvpx/libavcodec/version.h23
-rw-r--r--media/ffvpx/libavcodec/videodsp.c2
-rw-r--r--media/ffvpx/libavcodec/videodsp.h1
-rw-r--r--media/ffvpx/libavcodec/vlc.h20
-rw-r--r--media/ffvpx/libavcodec/vorbis_parser.h3
-rw-r--r--media/ffvpx/libavcodec/vp3dsp.h10
-rw-r--r--media/ffvpx/libavcodec/vp56.h12
-rw-r--r--media/ffvpx/libavcodec/vp56dsp.h18
-rw-r--r--media/ffvpx/libavcodec/vp56rac.c5
-rw-r--r--media/ffvpx/libavcodec/vp8.c158
-rw-r--r--media/ffvpx/libavcodec/vp8.h31
-rw-r--r--media/ffvpx/libavcodec/vp8_parser.c49
-rw-r--r--media/ffvpx/libavcodec/vp8dsp.c38
-rw-r--r--media/ffvpx/libavcodec/vp8dsp.h4
-rw-r--r--media/ffvpx/libavcodec/vp9.c3972
-rw-r--r--media/ffvpx/libavcodec/vp9.h142
-rw-r--r--media/ffvpx/libavcodec/vp9_mc_template.c210
-rw-r--r--media/ffvpx/libavcodec/vp9block.c1449
-rw-r--r--media/ffvpx/libavcodec/vp9data.c2247
-rw-r--r--media/ffvpx/libavcodec/vp9data.h2292
-rw-r--r--media/ffvpx/libavcodec/vp9dec.h240
-rw-r--r--media/ffvpx/libavcodec/vp9dsp.c58
-rw-r--r--media/ffvpx/libavcodec/vp9dsp.h10
-rw-r--r--media/ffvpx/libavcodec/vp9dsp_template.c63
-rw-r--r--media/ffvpx/libavcodec/vp9lpf.c202
-rw-r--r--media/ffvpx/libavcodec/vp9mvs.c364
-rw-r--r--media/ffvpx/libavcodec/vp9prob.c274
-rw-r--r--media/ffvpx/libavcodec/vp9recon.c644
-rw-r--r--media/ffvpx/libavcodec/vp9shared.h169
-rw-r--r--media/ffvpx/libavcodec/x86/constants.h1
-rw-r--r--media/ffvpx/libavcodec/x86/flacdsp_init.c4
-rw-r--r--media/ffvpx/libavcodec/x86/h264_i386.h212
-rw-r--r--media/ffvpx/libavcodec/x86/h264_intrapred.asm102
-rw-r--r--media/ffvpx/libavcodec/x86/h264_intrapred_10bit.asm77
-rw-r--r--media/ffvpx/libavcodec/x86/h264_intrapred_init.c7
-rw-r--r--media/ffvpx/libavcodec/x86/videodsp.asm2
-rw-r--r--media/ffvpx/libavcodec/x86/videodsp_init.c8
-rw-r--r--media/ffvpx/libavcodec/x86/vp8dsp.asm31
-rw-r--r--media/ffvpx/libavcodec/x86/vp8dsp_init.c21
-rw-r--r--media/ffvpx/libavcodec/x86/vp8dsp_loopfilter.asm6
-rw-r--r--media/ffvpx/libavcodec/x86/vp9dsp_init.c16
-rw-r--r--media/ffvpx/libavcodec/x86/vp9dsp_init_16bpp.c18
-rw-r--r--media/ffvpx/libavcodec/x86/vp9dsp_init_16bpp_template.c8
-rw-r--r--media/ffvpx/libavcodec/x86/vp9intrapred_16bpp.asm257
-rw-r--r--media/ffvpx/libavcodec/x86/vp9itxfm.asm188
-rw-r--r--media/ffvpx/libavcodec/x86/vp9mc.asm7
-rw-r--r--media/ffvpx/libavutil/atomic_gcc.h17
-rw-r--r--media/ffvpx/libavutil/atomic_suncc.h54
-rw-r--r--media/ffvpx/libavutil/attributes.h5
-rw-r--r--media/ffvpx/libavutil/avconfig.h1
-rw-r--r--media/ffvpx/libavutil/avstring.c23
-rw-r--r--media/ffvpx/libavutil/avstring.h5
-rw-r--r--media/ffvpx/libavutil/avutil.h20
-rw-r--r--media/ffvpx/libavutil/avutil.symbols11
-rw-r--r--media/ffvpx/libavutil/buffer.c96
-rw-r--r--media/ffvpx/libavutil/buffer.h7
-rw-r--r--media/ffvpx/libavutil/buffer_internal.h7
-rw-r--r--media/ffvpx/libavutil/channel_layout.c22
-rw-r--r--media/ffvpx/libavutil/channel_layout.h21
-rw-r--r--media/ffvpx/libavutil/cpu.c61
-rw-r--r--media/ffvpx/libavutil/cpu.h16
-rw-r--r--media/ffvpx/libavutil/cpu_internal.h5
-rw-r--r--media/ffvpx/libavutil/display.c73
-rw-r--r--media/ffvpx/libavutil/display.h87
-rw-r--r--media/ffvpx/libavutil/dummy_funcs.c67
-rw-r--r--media/ffvpx/libavutil/eval.c18
-rw-r--r--media/ffvpx/libavutil/ffversion.h2
-rw-r--r--media/ffvpx/libavutil/float_dsp.c9
-rw-r--r--media/ffvpx/libavutil/float_dsp.h16
-rw-r--r--media/ffvpx/libavutil/frame.c173
-rw-r--r--media/ffvpx/libavutil/frame.h130
-rw-r--r--media/ffvpx/libavutil/hwcontext.h161
-rw-r--r--media/ffvpx/libavutil/imgutils.c271
-rw-r--r--media/ffvpx/libavutil/imgutils.h70
-rw-r--r--media/ffvpx/libavutil/imgutils_internal.h30
-rw-r--r--media/ffvpx/libavutil/internal.h15
-rw-r--r--media/ffvpx/libavutil/intreadwrite.h29
-rw-r--r--media/ffvpx/libavutil/log.c6
-rw-r--r--media/ffvpx/libavutil/lzo.c205
-rw-r--r--media/ffvpx/libavutil/lzo.h66
-rw-r--r--media/ffvpx/libavutil/mathematics.c4
-rw-r--r--media/ffvpx/libavutil/mem.c36
-rw-r--r--media/ffvpx/libavutil/mem.h5
-rw-r--r--media/ffvpx/libavutil/motion_vector.h57
-rw-r--r--media/ffvpx/libavutil/moz.build3
-rw-r--r--media/ffvpx/libavutil/opt.c2025
-rw-r--r--media/ffvpx/libavutil/opt.h1
-rw-r--r--media/ffvpx/libavutil/parseutils.c28
-rw-r--r--media/ffvpx/libavutil/pixdesc.c308
-rw-r--r--media/ffvpx/libavutil/pixdesc.h36
-rw-r--r--media/ffvpx/libavutil/pixfmt.h68
-rw-r--r--media/ffvpx/libavutil/reverse.h28
-rw-r--r--media/ffvpx/libavutil/slicethread.c259
-rw-r--r--media/ffvpx/libavutil/slicethread.h52
-rw-r--r--media/ffvpx/libavutil/thread.h9
-rw-r--r--media/ffvpx/libavutil/threadmessage.c2
-rw-r--r--media/ffvpx/libavutil/time.c18
-rw-r--r--media/ffvpx/libavutil/timecode.c3
-rw-r--r--media/ffvpx/libavutil/timecode.h2
-rw-r--r--media/ffvpx/libavutil/timer.h71
-rw-r--r--media/ffvpx/libavutil/utils.c25
-rw-r--r--media/ffvpx/libavutil/version.h6
-rw-r--r--media/ffvpx/libavutil/wchar_filename.h45
-rw-r--r--media/ffvpx/libavutil/x86/cpu.c37
-rw-r--r--media/ffvpx/libavutil/x86/cpu.h6
-rw-r--r--media/ffvpx/libavutil/x86/emms.asm4
-rw-r--r--media/ffvpx/libavutil/x86/emms.h4
-rw-r--r--media/ffvpx/libavutil/x86/float_dsp.asm86
-rw-r--r--media/ffvpx/libavutil/x86/float_dsp_init.c17
-rw-r--r--media/ffvpx/libavutil/x86/imgutils.asm53
-rw-r--r--media/ffvpx/libavutil/x86/imgutils_init.c49
-rw-r--r--media/ffvpx/libavutil/x86/moz.build2
-rw-r--r--media/ffvpx/libavutil/x86/x86inc.asm94
-rw-r--r--media/ffvpx/libavutil/x86/x86util.asm161
-rw-r--r--media/ffvpx/libavutil_visibility.h9
-rw-r--r--media/libtremor/lib/tremor_codebook.c18
-rw-r--r--media/libvorbis/lib/vorbis_codebook.c48
-rw-r--r--media/libvpx/vp9/encoder/x86/vp9_quantize_ssse3_x86_64.asm2
-rw-r--r--media/libvpx/vpx/src/vpx_encoder.c55
-rw-r--r--media/webrtc/signaling/src/jsep/JsepTrack.cpp29
-rw-r--r--memory/build/jemalloc_config.cpp154
-rw-r--r--memory/build/moz.build16
-rw-r--r--memory/build/mozjemalloc_compat.c182
-rw-r--r--memory/build/mozmemory_wrap.h64
-rw-r--r--memory/build/replace_malloc.c10
-rw-r--r--memory/jemalloc/README.mozilla9
-rwxr-xr-xmemory/jemalloc/helper/git8
-rw-r--r--memory/jemalloc/moz.build81
-rw-r--r--memory/jemalloc/src/.appveyor.yml28
-rw-r--r--memory/jemalloc/src/.travis.yml29
-rw-r--r--memory/jemalloc/src/COPYING27
-rw-r--r--memory/jemalloc/src/ChangeLog981
-rw-r--r--memory/jemalloc/src/INSTALL414
-rw-r--r--memory/jemalloc/src/Makefile.in506
-rw-r--r--memory/jemalloc/src/README20
-rw-r--r--memory/jemalloc/src/VERSION1
-rwxr-xr-xmemory/jemalloc/src/autogen.sh17
-rw-r--r--memory/jemalloc/src/bin/jemalloc-config.in79
-rw-r--r--memory/jemalloc/src/bin/jemalloc.sh.in9
-rw-r--r--memory/jemalloc/src/bin/jeprof.in5611
-rwxr-xr-xmemory/jemalloc/src/build-aux/config.guess1420
-rwxr-xr-xmemory/jemalloc/src/build-aux/config.sub1797
-rwxr-xr-xmemory/jemalloc/src/build-aux/install-sh250
-rwxr-xr-xmemory/jemalloc/src/configure10773
-rw-r--r--memory/jemalloc/src/configure.ac1970
-rwxr-xr-xmemory/jemalloc/src/coverage.sh16
-rw-r--r--memory/jemalloc/src/doc/html.xsl.in5
-rw-r--r--memory/jemalloc/src/doc/jemalloc.xml.in2966
-rw-r--r--memory/jemalloc/src/doc/manpages.xsl.in4
-rw-r--r--memory/jemalloc/src/doc/stylesheet.xsl10
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/arena.h1516
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/assert.h45
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/atomic.h651
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/base.h25
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/bitmap.h274
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/chunk.h96
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/chunk_dss.h37
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/chunk_mmap.h21
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/ckh.h86
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/ctl.h118
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/extent.h239
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/hash.h357
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/huge.h35
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/jemalloc_internal.h.in1288
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/jemalloc_internal_decls.h75
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/jemalloc_internal_defs.h.in307
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/jemalloc_internal_macros.h57
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/mb.h115
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/mutex.h147
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/nstime.h48
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/pages.h27
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/ph.h345
-rwxr-xr-xmemory/jemalloc/src/include/jemalloc/internal/private_namespace.sh5
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/private_symbols.txt626
-rwxr-xr-xmemory/jemalloc/src/include/jemalloc/internal/private_unnamespace.sh5
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/prng.h207
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/prof.h547
-rwxr-xr-xmemory/jemalloc/src/include/jemalloc/internal/public_namespace.sh6
-rwxr-xr-xmemory/jemalloc/src/include/jemalloc/internal/public_unnamespace.sh6
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/ql.h81
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/qr.h69
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/quarantine.h60
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/rb.h1003
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/rtree.h366
-rwxr-xr-xmemory/jemalloc/src/include/jemalloc/internal/size_classes.sh318
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/smoothstep.h246
-rwxr-xr-xmemory/jemalloc/src/include/jemalloc/internal/smoothstep.sh115
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/spin.h51
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/stats.h201
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/tcache.h469
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/ticker.h75
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/tsd.h787
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/util.h338
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/valgrind.h114
-rw-r--r--memory/jemalloc/src/include/jemalloc/internal/witness.h266
-rwxr-xr-xmemory/jemalloc/src/include/jemalloc/jemalloc.sh28
-rw-r--r--memory/jemalloc/src/include/jemalloc/jemalloc_defs.h.in45
-rw-r--r--memory/jemalloc/src/include/jemalloc/jemalloc_macros.h.in103
-rwxr-xr-xmemory/jemalloc/src/include/jemalloc/jemalloc_mangle.sh45
-rw-r--r--memory/jemalloc/src/include/jemalloc/jemalloc_protos.h.in66
-rwxr-xr-xmemory/jemalloc/src/include/jemalloc/jemalloc_rename.sh22
-rw-r--r--memory/jemalloc/src/include/jemalloc/jemalloc_typedefs.h.in57
-rw-r--r--memory/jemalloc/src/include/msvc_compat/C99/stdbool.h20
-rw-r--r--memory/jemalloc/src/include/msvc_compat/C99/stdint.h247
-rw-r--r--memory/jemalloc/src/include/msvc_compat/strings.h59
-rw-r--r--memory/jemalloc/src/include/msvc_compat/windows_extra.h6
-rw-r--r--memory/jemalloc/src/jemalloc.pc.in12
-rw-r--r--memory/jemalloc/src/msvc/ReadMe.txt24
-rw-r--r--memory/jemalloc/src/msvc/jemalloc_vc2015.sln63
-rw-r--r--memory/jemalloc/src/msvc/projects/vc2015/jemalloc/jemalloc.vcxproj402
-rw-r--r--memory/jemalloc/src/msvc/projects/vc2015/jemalloc/jemalloc.vcxproj.filters272
-rw-r--r--memory/jemalloc/src/msvc/projects/vc2015/test_threads/test_threads.cpp89
-rw-r--r--memory/jemalloc/src/msvc/projects/vc2015/test_threads/test_threads.h3
-rw-r--r--memory/jemalloc/src/msvc/projects/vc2015/test_threads/test_threads.vcxproj327
-rw-r--r--memory/jemalloc/src/msvc/projects/vc2015/test_threads/test_threads.vcxproj.filters26
-rw-r--r--memory/jemalloc/src/msvc/projects/vc2015/test_threads/test_threads_main.cpp12
-rw-r--r--memory/jemalloc/src/src/arena.c3781
-rw-r--r--memory/jemalloc/src/src/atomic.c2
-rw-r--r--memory/jemalloc/src/src/base.c177
-rw-r--r--memory/jemalloc/src/src/bitmap.c111
-rw-r--r--memory/jemalloc/src/src/chunk.c783
-rw-r--r--memory/jemalloc/src/src/chunk_dss.c237
-rw-r--r--memory/jemalloc/src/src/chunk_mmap.c78
-rw-r--r--memory/jemalloc/src/src/ckh.c569
-rw-r--r--memory/jemalloc/src/src/ctl.c2254
-rw-r--r--memory/jemalloc/src/src/extent.c53
-rw-r--r--memory/jemalloc/src/src/hash.c2
-rw-r--r--memory/jemalloc/src/src/huge.c473
-rw-r--r--memory/jemalloc/src/src/jemalloc.c2897
-rw-r--r--memory/jemalloc/src/src/mb.c2
-rw-r--r--memory/jemalloc/src/src/mutex.c158
-rw-r--r--memory/jemalloc/src/src/nstime.c194
-rw-r--r--memory/jemalloc/src/src/pages.c273
-rw-r--r--memory/jemalloc/src/src/prng.c2
-rw-r--r--memory/jemalloc/src/src/prof.c2355
-rw-r--r--memory/jemalloc/src/src/quarantine.c183
-rw-r--r--memory/jemalloc/src/src/rtree.c132
-rw-r--r--memory/jemalloc/src/src/spin.c2
-rw-r--r--memory/jemalloc/src/src/stats.c1153
-rw-r--r--memory/jemalloc/src/src/tcache.c555
-rw-r--r--memory/jemalloc/src/src/ticker.c2
-rw-r--r--memory/jemalloc/src/src/tsd.c197
-rw-r--r--memory/jemalloc/src/src/util.c666
-rw-r--r--memory/jemalloc/src/src/valgrind.c34
-rw-r--r--memory/jemalloc/src/src/witness.c136
-rw-r--r--memory/jemalloc/src/src/zone.c330
-rw-r--r--memory/jemalloc/src/test/include/test/SFMT-alti.h186
-rw-r--r--memory/jemalloc/src/test/include/test/SFMT-params.h132
-rw-r--r--memory/jemalloc/src/test/include/test/SFMT-params11213.h81
-rw-r--r--memory/jemalloc/src/test/include/test/SFMT-params1279.h81
-rw-r--r--memory/jemalloc/src/test/include/test/SFMT-params132049.h81
-rw-r--r--memory/jemalloc/src/test/include/test/SFMT-params19937.h81
-rw-r--r--memory/jemalloc/src/test/include/test/SFMT-params216091.h81
-rw-r--r--memory/jemalloc/src/test/include/test/SFMT-params2281.h81
-rw-r--r--memory/jemalloc/src/test/include/test/SFMT-params4253.h81
-rw-r--r--memory/jemalloc/src/test/include/test/SFMT-params44497.h81
-rw-r--r--memory/jemalloc/src/test/include/test/SFMT-params607.h81
-rw-r--r--memory/jemalloc/src/test/include/test/SFMT-params86243.h81
-rw-r--r--memory/jemalloc/src/test/include/test/SFMT-sse2.h157
-rw-r--r--memory/jemalloc/src/test/include/test/SFMT.h171
-rw-r--r--memory/jemalloc/src/test/include/test/btalloc.h31
-rw-r--r--memory/jemalloc/src/test/include/test/jemalloc_test.h.in163
-rw-r--r--memory/jemalloc/src/test/include/test/jemalloc_test_defs.h.in9
-rw-r--r--memory/jemalloc/src/test/include/test/math.h311
-rw-r--r--memory/jemalloc/src/test/include/test/mq.h109
-rw-r--r--memory/jemalloc/src/test/include/test/mtx.h23
-rw-r--r--memory/jemalloc/src/test/include/test/test.h333
-rw-r--r--memory/jemalloc/src/test/include/test/thd.h9
-rw-r--r--memory/jemalloc/src/test/include/test/timer.h11
-rw-r--r--memory/jemalloc/src/test/integration/MALLOCX_ARENA.c69
-rw-r--r--memory/jemalloc/src/test/integration/aligned_alloc.c139
-rw-r--r--memory/jemalloc/src/test/integration/allocated.c125
-rw-r--r--memory/jemalloc/src/test/integration/chunk.c293
-rw-r--r--memory/jemalloc/src/test/integration/mallocx.c234
-rw-r--r--memory/jemalloc/src/test/integration/overflow.c49
-rw-r--r--memory/jemalloc/src/test/integration/posix_memalign.c133
-rw-r--r--memory/jemalloc/src/test/integration/rallocx.c259
-rw-r--r--memory/jemalloc/src/test/integration/sdallocx.c57
-rw-r--r--memory/jemalloc/src/test/integration/thread_arena.c79
-rw-r--r--memory/jemalloc/src/test/integration/thread_tcache_enabled.c113
-rw-r--r--memory/jemalloc/src/test/integration/xallocx.c497
-rw-r--r--memory/jemalloc/src/test/src/SFMT.c719
-rw-r--r--memory/jemalloc/src/test/src/btalloc.c8
-rw-r--r--memory/jemalloc/src/test/src/btalloc_0.c3
-rw-r--r--memory/jemalloc/src/test/src/btalloc_1.c3
-rw-r--r--memory/jemalloc/src/test/src/math.c2
-rw-r--r--memory/jemalloc/src/test/src/mq.c29
-rw-r--r--memory/jemalloc/src/test/src/mtx.c73
-rw-r--r--memory/jemalloc/src/test/src/test.c133
-rw-r--r--memory/jemalloc/src/test/src/thd.c39
-rw-r--r--memory/jemalloc/src/test/src/timer.c60
-rw-r--r--memory/jemalloc/src/test/stress/microbench.c182
-rw-r--r--memory/jemalloc/src/test/test.sh.in53
-rw-r--r--memory/jemalloc/src/test/unit/SFMT.c1605
-rw-r--r--memory/jemalloc/src/test/unit/a0.c19
-rw-r--r--memory/jemalloc/src/test/unit/arena_reset.c159
-rw-r--r--memory/jemalloc/src/test/unit/atomic.c122
-rw-r--r--memory/jemalloc/src/test/unit/bitmap.c163
-rw-r--r--memory/jemalloc/src/test/unit/ckh.c214
-rw-r--r--memory/jemalloc/src/test/unit/decay.c374
-rw-r--r--memory/jemalloc/src/test/unit/fork.c64
-rw-r--r--memory/jemalloc/src/test/unit/hash.c185
-rw-r--r--memory/jemalloc/src/test/unit/junk.c253
-rw-r--r--memory/jemalloc/src/test/unit/junk_alloc.c3
-rw-r--r--memory/jemalloc/src/test/unit/junk_free.c3
-rw-r--r--memory/jemalloc/src/test/unit/lg_chunk.c26
-rw-r--r--memory/jemalloc/src/test/unit/mallctl.c731
-rw-r--r--memory/jemalloc/src/test/unit/math.c398
-rw-r--r--memory/jemalloc/src/test/unit/mq.c93
-rw-r--r--memory/jemalloc/src/test/unit/mtx.c60
-rw-r--r--memory/jemalloc/src/test/unit/nstime.c227
-rw-r--r--memory/jemalloc/src/test/unit/ph.c290
-rw-r--r--memory/jemalloc/src/test/unit/prng.c263
-rw-r--r--memory/jemalloc/src/test/unit/prof_accum.c91
-rw-r--r--memory/jemalloc/src/test/unit/prof_active.c136
-rw-r--r--memory/jemalloc/src/test/unit/prof_gdump.c81
-rw-r--r--memory/jemalloc/src/test/unit/prof_idump.c51
-rw-r--r--memory/jemalloc/src/test/unit/prof_reset.c303
-rw-r--r--memory/jemalloc/src/test/unit/prof_thread_name.c129
-rw-r--r--memory/jemalloc/src/test/unit/ql.c209
-rw-r--r--memory/jemalloc/src/test/unit/qr.c248
-rw-r--r--memory/jemalloc/src/test/unit/quarantine.c108
-rw-r--r--memory/jemalloc/src/test/unit/rb.c354
-rw-r--r--memory/jemalloc/src/test/unit/rtree.c151
-rw-r--r--memory/jemalloc/src/test/unit/run_quantize.c149
-rw-r--r--memory/jemalloc/src/test/unit/size_classes.c184
-rw-r--r--memory/jemalloc/src/test/unit/smoothstep.c106
-rw-r--r--memory/jemalloc/src/test/unit/stats.c447
-rw-r--r--memory/jemalloc/src/test/unit/ticker.c76
-rw-r--r--memory/jemalloc/src/test/unit/tsd.c112
-rw-r--r--memory/jemalloc/src/test/unit/util.c317
-rw-r--r--memory/jemalloc/src/test/unit/witness.c278
-rw-r--r--memory/jemalloc/src/test/unit/zero.c80
-rwxr-xr-xmemory/jemalloc/update.sh20
-rw-r--r--memory/jemalloc/upstream.info2
-rw-r--r--memory/moz.build4
-rw-r--r--memory/mozjemalloc/Makefile.in2
-rw-r--r--memory/mozjemalloc/jemalloc.c393
-rw-r--r--memory/mozjemalloc/jemalloc_types.h2
-rw-r--r--memory/mozjemalloc/linkedlist.h2
-rw-r--r--memory/mozjemalloc/moz.build19
-rw-r--r--memory/mozjemalloc/osx_zone_types.h2
-rw-r--r--memory/mozjemalloc/ql.h2
-rw-r--r--memory/mozjemalloc/qr.h2
-rw-r--r--memory/mozjemalloc/rb.h2
-rw-r--r--memory/replace/jemalloc/moz.build31
-rw-r--r--memory/replace/jemalloc/pthread_atfork.c10
-rw-r--r--memory/replace/logalloc/replay/Replay.cpp4
-rw-r--r--memory/replace/moz.build4
-rw-r--r--mfbt/Compression.cpp11
-rw-r--r--mfbt/TextUtils.h58
-rw-r--r--mfbt/lz4.c1593
-rw-r--r--mfbt/lz4.h531
-rw-r--r--mfbt/moz.build1
-rw-r--r--mfbt/tests/TestTextUtils.cpp106
-rw-r--r--mfbt/tests/moz.build1
-rw-r--r--mobile/android/app/build.gradle4
-rw-r--r--mobile/android/app/mobile.js4
-rw-r--r--mobile/android/base/AndroidManifest.xml.in14
-rw-r--r--mobile/android/base/AppConstants.java.in7
-rw-r--r--mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java6
-rw-r--r--mobile/android/base/moz.build6
-rw-r--r--mobile/android/geckoview/src/main/java/org/mozilla/gecko/CrashHandler.java4
-rw-r--r--mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java4
-rw-r--r--mobile/android/installer/package-manifest.in8
-rw-r--r--mobile/android/tests/browser/robocop/robocop_head.js19
-rw-r--r--modules/libjar/nsJARURI.cpp1
-rw-r--r--modules/libjar/nsJARURI.h1
-rw-r--r--modules/libpref/init/all.js63
-rw-r--r--modules/libpref/nsPrefBranch.cpp14
-rw-r--r--moz.build2
-rw-r--r--moz.configure32
-rw-r--r--mozglue/android/NSSBridge.cpp114
-rw-r--r--mozglue/android/NSSBridge.h4
-rw-r--r--mozglue/build/moz.build2
-rw-r--r--netwerk/base/LoadInfo.cpp60
-rw-r--r--netwerk/base/LoadInfo.h11
-rw-r--r--netwerk/base/moz.build1
-rw-r--r--netwerk/base/nsBufferedStreams.h8
-rw-r--r--netwerk/base/nsILoadInfo.idl22
-rw-r--r--netwerk/base/nsINetworkInterceptController.idl28
-rw-r--r--netwerk/base/nsIOService.cpp10
-rw-r--r--netwerk/base/nsIOService.h4
-rw-r--r--netwerk/base/nsITimedChannel.idl18
-rw-r--r--netwerk/base/nsIURI.idl60
-rw-r--r--netwerk/base/nsIURIWithQuery.idl30
-rw-r--r--netwerk/base/nsIURL.idl6
-rw-r--r--netwerk/base/nsSimpleURI.cpp6
-rw-r--r--netwerk/base/nsSimpleURI.h4
-rw-r--r--netwerk/base/nsStandardURL.cpp108
-rw-r--r--netwerk/base/nsStandardURL.h1
-rw-r--r--netwerk/base/security-prefs.js2
-rw-r--r--netwerk/ipc/NeckoChannelParams.ipdlh9
-rw-r--r--netwerk/ipc/NeckoMessageUtils.h11
-rw-r--r--netwerk/protocol/http/Http2Session.cpp18
-rw-r--r--netwerk/protocol/http/Http2Stream.cpp14
-rw-r--r--netwerk/protocol/http/Http2Stream.h1
-rw-r--r--netwerk/protocol/http/HttpBaseChannel.cpp164
-rw-r--r--netwerk/protocol/http/HttpBaseChannel.h10
-rw-r--r--netwerk/protocol/http/HttpChannelChild.cpp7
-rw-r--r--netwerk/protocol/http/HttpChannelParent.cpp27
-rw-r--r--netwerk/protocol/http/HttpChannelParent.h10
-rw-r--r--netwerk/protocol/http/InterceptedChannel.cpp35
-rw-r--r--netwerk/protocol/http/InterceptedChannel.h51
-rw-r--r--netwerk/protocol/http/NullHttpChannel.cpp106
-rw-r--r--netwerk/protocol/http/nsHttpChannel.cpp4
-rw-r--r--netwerk/protocol/http/nsHttpHandler.h2
-rw-r--r--netwerk/sctp/datachannel/DataChannel.cpp5
-rw-r--r--netwerk/test/unit/test_URIs.js26
-rw-r--r--netwerk/test/unit/test_standardurl.js39
-rw-r--r--nsprpub/TAG-INFO1
-rwxr-xr-xnsprpub/configure17
-rw-r--r--nsprpub/configure.in11
-rw-r--r--nsprpub/pr/include/md/_pth.h71
-rw-r--r--nsprpub/pr/include/prinet.h2
-rw-r--r--nsprpub/pr/include/prinit.h4
-rw-r--r--nsprpub/pr/include/private/primpl.h22
-rw-r--r--nsprpub/pr/src/Makefile.in4
-rw-r--r--nsprpub/pr/src/io/prio.c71
-rw-r--r--nsprpub/pr/src/io/prsocket.c68
-rw-r--r--nsprpub/pr/src/md/unix/unix.c17
-rw-r--r--nsprpub/pr/src/md/unix/uxproces.c4
-rw-r--r--nsprpub/pr/src/md/windows/ntthread.c23
-rw-r--r--nsprpub/pr/src/md/windows/w95sock.c5
-rw-r--r--nsprpub/pr/src/md/windows/w95thred.c51
-rw-r--r--nsprpub/pr/src/md/windows/win32_errors.c8
-rw-r--r--nsprpub/pr/src/misc/pratom.c6
-rw-r--r--nsprpub/pr/src/pthreads/ptio.c17
-rw-r--r--nsprpub/pr/src/pthreads/ptsynch.c14
-rw-r--r--nsprpub/pr/src/pthreads/ptthread.c158
-rw-r--r--nsprpub/pr/src/threads/prrwlock.c2
-rw-r--r--nsprpub/pr/tests/Makefile.in3
-rw-r--r--nsprpub/pr/tests/attach.c12
-rw-r--r--nsprpub/pr/tests/dceemu.c9
-rw-r--r--nsprpub/pr/tests/foreign.c8
-rw-r--r--nsprpub/pr/tests/forktest.c47
-rw-r--r--nsprpub/pr/tests/provider.c12
-rw-r--r--nsprpub/pr/tests/socket.c6
-rw-r--r--nsprpub/pr/tests/testfile.c6
-rw-r--r--nsprpub/pr/tests/thrpool_client.c2
-rw-r--r--nsprpub/pr/tests/thrpool_server.c2
-rw-r--r--nsprpub/pr/tests/vercheck.c7
-rw-r--r--old-configure.in192
-rw-r--r--python/mozbuild/mozbuild/mach_commands.py4
-rwxr-xr-xpython/mozbuild/mozbuild/mozinfo.py3
-rwxr-xr-xpython/mozbuild/mozbuild/test/test_mozinfo.py1
-rw-r--r--security/certverifier/CertVerifier.cpp3
-rw-r--r--security/certverifier/NSSCertDBTrustDomain.cpp10
-rw-r--r--security/manager/ssl/tests/unit/test_cert_trust.js28
-rw-r--r--security/nss/.taskcluster.yml2
-rw-r--r--security/nss/TAG-INFO1
-rw-r--r--security/nss/automation/abi-check/expected-report-libnspr4.so.txt8
-rw-r--r--security/nss/automation/abi-check/expected-report-libssl3.so.txt3
-rw-r--r--security/nss/automation/abi-check/previous-nss-release2
-rwxr-xr-xsecurity/nss/automation/buildbot-slave/build.sh37
-rw-r--r--security/nss/automation/clang-format/run_clang_format.sh21
-rw-r--r--security/nss/automation/clang-format/setup.sh4
-rw-r--r--security/nss/automation/release/nspr-version.txt2
-rw-r--r--security/nss/automation/taskcluster/docker-clang-3.9/setup.sh4
-rw-r--r--security/nss/automation/taskcluster/docker-decision/Dockerfile3
-rw-r--r--security/nss/automation/taskcluster/docker-decision/bin/checkout.sh5
-rw-r--r--security/nss/automation/taskcluster/docker-gcc-4.4/Dockerfile30
-rw-r--r--security/nss/automation/taskcluster/docker-gcc-4.4/bin/checkout.sh20
-rw-r--r--security/nss/automation/taskcluster/docker-gcc-4.4/setup.sh30
-rw-r--r--security/nss/automation/taskcluster/docker-hacl/Dockerfile30
-rw-r--r--security/nss/automation/taskcluster/docker-hacl/bin/checkout.sh20
-rw-r--r--security/nss/automation/taskcluster/docker-hacl/license.txt15
-rw-r--r--security/nss/automation/taskcluster/docker-hacl/setup-user.sh26
-rw-r--r--security/nss/automation/taskcluster/docker-hacl/setup.sh30
-rw-r--r--security/nss/automation/taskcluster/docker/setup.sh4
-rw-r--r--security/nss/automation/taskcluster/graph/src/context_hash.js16
-rw-r--r--security/nss/automation/taskcluster/graph/src/extend.js232
-rw-r--r--security/nss/automation/taskcluster/graph/src/image_builder.js11
-rw-r--r--security/nss/automation/taskcluster/graph/src/try_syntax.js9
-rw-r--r--security/nss/automation/taskcluster/image_builder/Dockerfile23
-rw-r--r--security/nss/automation/taskcluster/image_builder/VERSION1
-rw-r--r--security/nss/automation/taskcluster/image_builder/bin/checkout.sh15
-rwxr-xr-xsecurity/nss/automation/taskcluster/scripts/build_gyp.sh9
-rw-r--r--security/nss/automation/taskcluster/scripts/build_image.sh24
-rwxr-xr-xsecurity/nss/automation/taskcluster/scripts/gen_certs.sh9
-rw-r--r--security/nss/automation/taskcluster/scripts/run_hacl.sh40
-rw-r--r--security/nss/automation/taskcluster/scripts/split.sh6
-rw-r--r--security/nss/automation/taskcluster/windows/releng.manifest8
-rw-r--r--security/nss/automation/taskcluster/windows/setup.sh6
-rw-r--r--security/nss/automation/taskcluster/windows/setup32.sh6
-rw-r--r--security/nss/automation/taskcluster/windows/setup64.sh6
-rwxr-xr-xsecurity/nss/build.sh11
-rw-r--r--security/nss/cmd/bltest/blapitest.c72
-rw-r--r--security/nss/cmd/certcgi/certcgi.c3
-rw-r--r--security/nss/cmd/certutil/certutil.c334
-rw-r--r--security/nss/cmd/certutil/keystuff.c13
-rw-r--r--security/nss/cmd/crlutil/crlgen.c3
-rw-r--r--security/nss/cmd/fipstest/fipstest.c9
-rw-r--r--security/nss/cmd/fipstest/runtest.sh3
-rw-r--r--security/nss/cmd/lib/secutil.c127
-rw-r--r--security/nss/cmd/libpkix/pkix/util/test_list2.c6
-rw-r--r--security/nss/cmd/listsuites/listsuites.c48
-rw-r--r--security/nss/cmd/manifest.mn1
-rw-r--r--security/nss/cmd/modutil/error.h6
-rw-r--r--security/nss/cmd/modutil/install-ds.c3
-rw-r--r--security/nss/cmd/modutil/modutil.c2
-rw-r--r--security/nss/cmd/modutil/modutil.h1
-rw-r--r--security/nss/cmd/modutil/pk11.c35
-rw-r--r--security/nss/cmd/multinit/multinit.c3
-rw-r--r--security/nss/cmd/pk11mode/pk11mode.c58
-rw-r--r--security/nss/cmd/pk12util/pk12util.c107
-rw-r--r--security/nss/cmd/pp/pp.c4
-rw-r--r--security/nss/cmd/rsaperf/rsaperf.c3
-rw-r--r--security/nss/cmd/rsapoptst/rsapoptst.c185
-rw-r--r--security/nss/cmd/rsapoptst/rsapoptst.gyp25
-rw-r--r--security/nss/cmd/selfserv/selfserv.c26
-rw-r--r--security/nss/cmd/signtool/javascript.c3
-rw-r--r--security/nss/cmd/signtool/signtool.c4
-rw-r--r--security/nss/cmd/smimetools/cmsutil.c5
-rw-r--r--security/nss/cmd/ssltap/ssltap.c12
-rw-r--r--security/nss/cmd/strsclnt/strsclnt.c6
-rw-r--r--security/nss/cmd/tstclnt/tstclnt.c301
-rw-r--r--security/nss/coreconf/config.gypi11
-rw-r--r--security/nss/coreconf/config.mk11
-rw-r--r--security/nss/coreconf/coreconf.dep1
-rw-r--r--security/nss/coreconf/werror.py2
-rw-r--r--security/nss/cpputil/.clang-format4
-rw-r--r--security/nss/cpputil/Makefile49
-rw-r--r--security/nss/cpputil/README11
-rw-r--r--security/nss/cpputil/config.mk15
-rw-r--r--security/nss/cpputil/cpputil.gyp29
-rw-r--r--security/nss/cpputil/cpputil.h12
-rw-r--r--security/nss/cpputil/databuffer.cc127
-rw-r--r--security/nss/cpputil/databuffer.h110
-rw-r--r--security/nss/cpputil/dummy_io.cc225
-rw-r--r--security/nss/cpputil/dummy_io.h62
-rw-r--r--security/nss/cpputil/dummy_io_fwd.cc162
-rw-r--r--security/nss/cpputil/manifest.mn24
-rw-r--r--security/nss/cpputil/scoped_ptrs.h74
-rw-r--r--security/nss/cpputil/scoped_ptrs_util.h39
-rw-r--r--security/nss/cpputil/tls_parser.cc73
-rw-r--r--security/nss/cpputil/tls_parser.h145
-rw-r--r--security/nss/doc/certutil.xml10
-rw-r--r--security/nss/doc/html/certutil.html43
-rw-r--r--security/nss/doc/html/pk12util.html12
-rw-r--r--security/nss/doc/nroff/certutil.137
-rw-r--r--security/nss/doc/nroff/pk12util.1279
-rw-r--r--security/nss/doc/pk12util.xml74
-rw-r--r--security/nss/fuzz/config/clone_libfuzzer.sh2
-rw-r--r--security/nss/fuzz/config/git-copy.sh27
-rw-r--r--security/nss/fuzz/mpi_expmod_target.cc9
-rw-r--r--security/nss/fuzz/mpi_helper.cc6
-rw-r--r--security/nss/fuzz/mpi_helper.h1
-rw-r--r--security/nss/fuzz/tls_mutators.cc31
-rw-r--r--security/nss/fuzz/tls_socket.h1
-rw-r--r--security/nss/gtests/certdb_gtest/alg1485_unittest.cc20
-rw-r--r--security/nss/gtests/common/util.h2
-rw-r--r--security/nss/gtests/cryptohi_gtest/Makefile43
-rw-r--r--security/nss/gtests/cryptohi_gtest/cryptohi_gtest.gyp29
-rw-r--r--security/nss/gtests/cryptohi_gtest/cryptohi_unittest.cc373
-rw-r--r--security/nss/gtests/cryptohi_gtest/manifest.mn22
-rw-r--r--security/nss/gtests/freebl_gtest/blake2b_unittest.cc277
-rw-r--r--security/nss/gtests/freebl_gtest/freebl_gtest.gyp73
-rw-r--r--security/nss/gtests/freebl_gtest/kat/blake2b_kat.h4646
-rw-r--r--security/nss/gtests/freebl_gtest/rsa_unittest.cc61
-rw-r--r--security/nss/gtests/manifest.mn6
-rw-r--r--security/nss/gtests/nss_bogo_shim/Makefile6
-rw-r--r--security/nss/gtests/nss_bogo_shim/config.json15
-rw-r--r--security/nss/gtests/pk11_gtest/manifest.mn9
-rw-r--r--security/nss/gtests/pk11_gtest/pk11_ecdsa_unittest.cc126
-rw-r--r--security/nss/gtests/pk11_gtest/pk11_encrypt_derive_unittest.cc210
-rw-r--r--security/nss/gtests/pk11_gtest/pk11_gtest.gyp2
-rw-r--r--security/nss/gtests/pk11_gtest/pk11_rsapss_unittest.cc157
-rw-r--r--security/nss/gtests/pk11_gtest/pk11_signature_test.h140
-rw-r--r--security/nss/gtests/softoken_gtest/Makefile45
-rw-r--r--security/nss/gtests/softoken_gtest/manifest.mn25
-rw-r--r--security/nss/gtests/softoken_gtest/softoken_gtest.cc360
-rw-r--r--security/nss/gtests/softoken_gtest/softoken_gtest.gyp51
-rw-r--r--security/nss/gtests/ssl_gtest/Makefile4
-rw-r--r--security/nss/gtests/ssl_gtest/bloomfilter_unittest.cc108
-rw-r--r--security/nss/gtests/ssl_gtest/libssl_internals.c139
-rw-r--r--security/nss/gtests/ssl_gtest/libssl_internals.h20
-rw-r--r--security/nss/gtests/ssl_gtest/manifest.mn7
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_0rtt_unittest.cc271
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_agent_unittest.cc17
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_auth_unittest.cc32
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_cert_ext_unittest.cc25
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_ciphersuite_unittest.cc53
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_custext_unittest.cc503
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_damage_unittest.cc24
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_dhe_unittest.cc74
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_drop_unittest.cc742
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_ecdh_unittest.cc22
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_exporter_unittest.cc1
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_extension_unittest.cc80
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_fragment_unittest.cc10
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_fuzz_unittest.cc63
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_gtest.cc2
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_gtest.gyp7
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_hrr_unittest.cc678
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_keylog_unittest.cc118
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_keyupdate_unittest.cc178
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_loopback_unittest.cc251
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_misc_unittest.cc20
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_record_unittest.cc73
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_renegotiation_unittest.cc212
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_resumption_unittest.cc274
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_skip_unittest.cc35
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_staticrsa_unittest.cc4
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_tls13compat_unittest.cc337
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_v2_client_hello_unittest.cc11
-rw-r--r--security/nss/gtests/ssl_gtest/ssl_version_unittest.cc117
-rw-r--r--security/nss/gtests/ssl_gtest/test_io.cc9
-rw-r--r--security/nss/gtests/ssl_gtest/test_io.h20
-rw-r--r--security/nss/gtests/ssl_gtest/tls_agent.cc205
-rw-r--r--security/nss/gtests/ssl_gtest/tls_agent.h19
-rw-r--r--security/nss/gtests/ssl_gtest/tls_connect.cc190
-rw-r--r--security/nss/gtests/ssl_gtest/tls_connect.h31
-rw-r--r--security/nss/gtests/ssl_gtest/tls_filter.cc321
-rw-r--r--security/nss/gtests/ssl_gtest/tls_filter.h192
-rw-r--r--security/nss/gtests/ssl_gtest/tls_hkdf_unittest.cc14
-rw-r--r--security/nss/gtests/ssl_gtest/tls_protect.cc6
-rw-r--r--security/nss/gtests/ssl_gtest/tls_protect.h9
-rw-r--r--security/nss/gtests/util_gtest/manifest.mn2
-rw-r--r--security/nss/gtests/util_gtest/util_aligned_malloc_unittest.cc82
-rw-r--r--security/nss/gtests/util_gtest/util_gtest.gyp2
-rw-r--r--security/nss/gtests/util_gtest/util_memcmpzero_unittest.cc45
-rw-r--r--security/nss/help.txt48
-rw-r--r--security/nss/lib/certdb/alg1485.c22
-rw-r--r--security/nss/lib/certdb/cert.h8
-rw-r--r--security/nss/lib/certdb/certdb.c1
-rw-r--r--security/nss/lib/certdb/crl.c3
-rw-r--r--security/nss/lib/certdb/stanpcertdb.c56
-rw-r--r--security/nss/lib/ckfw/builtins/certdata.txt6981
-rw-r--r--security/nss/lib/ckfw/builtins/nssckbi.h4
-rw-r--r--security/nss/lib/ckfw/capi/cfind.c3
-rw-r--r--security/nss/lib/cryptohi/cryptohi.h61
-rw-r--r--security/nss/lib/cryptohi/keyi.h3
-rw-r--r--security/nss/lib/cryptohi/seckey.c122
-rw-r--r--security/nss/lib/cryptohi/secsign.c378
-rw-r--r--security/nss/lib/cryptohi/secvfy.c149
-rw-r--r--security/nss/lib/dbm/src/h_page.c15
-rw-r--r--security/nss/lib/dbm/src/hash.c3
-rw-r--r--security/nss/lib/dev/devutil.c8
-rw-r--r--security/nss/lib/freebl/Makefile29
-rw-r--r--security/nss/lib/freebl/aes-x86.c157
-rw-r--r--security/nss/lib/freebl/blake2b.c430
-rw-r--r--security/nss/lib/freebl/blake2b.h23
-rw-r--r--security/nss/lib/freebl/blapi.h78
-rw-r--r--security/nss/lib/freebl/blapii.h2
-rw-r--r--security/nss/lib/freebl/blapit.h32
-rw-r--r--security/nss/lib/freebl/chacha20.c104
-rw-r--r--security/nss/lib/freebl/chacha20poly1305.c51
-rw-r--r--security/nss/lib/freebl/config.mk5
-rw-r--r--security/nss/lib/freebl/crypto_primitives.c36
-rw-r--r--security/nss/lib/freebl/crypto_primitives.h51
-rw-r--r--security/nss/lib/freebl/det_rng.c27
-rw-r--r--security/nss/lib/freebl/ec.c44
-rw-r--r--security/nss/lib/freebl/ecdecode.c4
-rw-r--r--security/nss/lib/freebl/ecl/curve25519_64.c508
-rw-r--r--security/nss/lib/freebl/ecl/ecp_25519.c6
-rw-r--r--security/nss/lib/freebl/exports.gyp1
-rw-r--r--security/nss/lib/freebl/fipsfreebl.c14
-rw-r--r--security/nss/lib/freebl/freebl.gyp72
-rw-r--r--security/nss/lib/freebl/freebl_base.gypi48
-rw-r--r--security/nss/lib/freebl/gcm-x86.c127
-rw-r--r--security/nss/lib/freebl/gcm.c171
-rw-r--r--security/nss/lib/freebl/gcm.h14
-rw-r--r--security/nss/lib/freebl/ldvector.c24
-rw-r--r--security/nss/lib/freebl/loader.c111
-rw-r--r--security/nss/lib/freebl/loader.h25
-rw-r--r--security/nss/lib/freebl/manifest.mn24
-rw-r--r--security/nss/lib/freebl/mpi/README41
-rw-r--r--security/nss/lib/freebl/mpi/mpi-config.h8
-rw-r--r--security/nss/lib/freebl/mpi/mpi.c15
-rw-r--r--security/nss/lib/freebl/nsslowhash.c6
-rw-r--r--security/nss/lib/freebl/poly1305.h2
-rw-r--r--security/nss/lib/freebl/rijndael.c294
-rw-r--r--security/nss/lib/freebl/rijndael.h18
-rw-r--r--security/nss/lib/freebl/rsa.c35
-rw-r--r--security/nss/lib/freebl/sha512.c45
-rw-r--r--security/nss/lib/freebl/shvfy.c22
-rw-r--r--security/nss/lib/freebl/stubs.c67
-rw-r--r--security/nss/lib/freebl/stubs.h3
-rw-r--r--security/nss/lib/freebl/verified/FStar.c255
-rw-r--r--security/nss/lib/freebl/verified/FStar.h69
-rw-r--r--security/nss/lib/freebl/verified/Hacl_Chacha20.c270
-rw-r--r--security/nss/lib/freebl/verified/Hacl_Chacha20.h81
-rw-r--r--security/nss/lib/freebl/verified/Hacl_Curve25519.c845
-rw-r--r--security/nss/lib/freebl/verified/Hacl_Curve25519.h57
-rw-r--r--security/nss/lib/freebl/verified/Hacl_Poly1305_64.c485
-rw-r--r--security/nss/lib/freebl/verified/Hacl_Poly1305_64.h99
-rw-r--r--security/nss/lib/freebl/verified/kremlib.h672
-rw-r--r--security/nss/lib/freebl/verified/kremlib_base.h191
-rw-r--r--security/nss/lib/freebl/verified/specs/Spec.CTR.fst98
-rw-r--r--security/nss/lib/freebl/verified/specs/Spec.Chacha20.fst169
-rw-r--r--security/nss/lib/freebl/verified/specs/Spec.Curve25519.fst168
-rw-r--r--security/nss/lib/freebl/verified/specs/Spec.Poly1305.fst107
-rw-r--r--security/nss/lib/nss/nss.def18
-rw-r--r--security/nss/lib/nss/nss.h15
-rw-r--r--security/nss/lib/nss/nssoptions.c8
-rw-r--r--security/nss/lib/nss/utilwrap.c14
-rw-r--r--security/nss/lib/pk11wrap/pk11load.c3
-rw-r--r--security/nss/lib/pk11wrap/pk11merge.c6
-rw-r--r--security/nss/lib/pk11wrap/pk11obj.c39
-rw-r--r--security/nss/lib/pk11wrap/pk11pars.c3
-rw-r--r--security/nss/lib/pk11wrap/pk11pbe.c19
-rw-r--r--security/nss/lib/pk11wrap/pk11pk12.c23
-rw-r--r--security/nss/lib/pk11wrap/pk11pub.h4
-rw-r--r--security/nss/lib/pk11wrap/pk11skey.c4
-rw-r--r--security/nss/lib/pk11wrap/pk11slot.c5
-rw-r--r--security/nss/lib/pk11wrap/pk11util.c9
-rw-r--r--security/nss/lib/pk11wrap/secmodti.h1
-rw-r--r--security/nss/lib/pkcs12/p12d.c63
-rw-r--r--security/nss/lib/pkcs12/p12local.c3
-rw-r--r--security/nss/lib/pkcs7/p7create.c8
-rw-r--r--security/nss/lib/pki/pki3hack.c4
-rw-r--r--security/nss/lib/smime/cmsdecode.c3
-rw-r--r--security/nss/lib/smime/cmsencode.c3
-rw-r--r--security/nss/lib/softoken/fipstest.c9
-rw-r--r--security/nss/lib/softoken/fipstokn.c33
-rw-r--r--security/nss/lib/softoken/legacydb/keydb.c8
-rw-r--r--security/nss/lib/softoken/legacydb/lgattr.c12
-rw-r--r--security/nss/lib/softoken/legacydb/lgcreate.c15
-rw-r--r--security/nss/lib/softoken/legacydb/lgfips.c4
-rw-r--r--security/nss/lib/softoken/legacydb/lginit.c4
-rw-r--r--security/nss/lib/softoken/legacydb/lowcert.c2
-rw-r--r--security/nss/lib/softoken/legacydb/lowkey.c7
-rw-r--r--security/nss/lib/softoken/legacydb/lowkeyi.h5
-rw-r--r--security/nss/lib/softoken/legacydb/lowkeyti.h2
-rw-r--r--security/nss/lib/softoken/legacydb/pcertdb.c10
-rw-r--r--security/nss/lib/softoken/lowkey.c12
-rw-r--r--security/nss/lib/softoken/lowkeyi.h2
-rw-r--r--security/nss/lib/softoken/lowkeyti.h2
-rw-r--r--security/nss/lib/softoken/pkcs11.c66
-rw-r--r--security/nss/lib/softoken/pkcs11c.c239
-rw-r--r--security/nss/lib/softoken/pkcs11i.h1
-rw-r--r--security/nss/lib/softoken/pkcs11u.c8
-rw-r--r--security/nss/lib/softoken/sdb.c105
-rw-r--r--security/nss/lib/softoken/sdb.h4
-rw-r--r--security/nss/lib/softoken/sftkdb.c84
-rw-r--r--security/nss/lib/softoken/sftkdbti.h1
-rw-r--r--security/nss/lib/softoken/sftkpwd.c7
-rw-r--r--security/nss/lib/softoken/softkver.h10
-rw-r--r--security/nss/lib/softoken/softoknt.h3
-rw-r--r--security/nss/lib/ssl/SSLerrs.h33
-rw-r--r--security/nss/lib/ssl/authcert.c3
-rw-r--r--security/nss/lib/ssl/config.mk5
-rw-r--r--security/nss/lib/ssl/dtls13con.c457
-rw-r--r--security/nss/lib/ssl/dtls13con.h29
-rw-r--r--security/nss/lib/ssl/dtlscon.c720
-rw-r--r--security/nss/lib/ssl/dtlscon.h48
-rw-r--r--security/nss/lib/ssl/exports.gyp1
-rw-r--r--security/nss/lib/ssl/manifest.mn8
-rw-r--r--security/nss/lib/ssl/selfencrypt.c57
-rw-r--r--security/nss/lib/ssl/selfencrypt.h1
-rw-r--r--security/nss/lib/ssl/ssl.def6
-rw-r--r--security/nss/lib/ssl/ssl.gyp15
-rw-r--r--security/nss/lib/ssl/ssl.h49
-rw-r--r--security/nss/lib/ssl/ssl3con.c4622
-rw-r--r--security/nss/lib/ssl/ssl3ecc.c160
-rw-r--r--security/nss/lib/ssl/ssl3ext.c709
-rw-r--r--security/nss/lib/ssl/ssl3ext.h114
-rw-r--r--security/nss/lib/ssl/ssl3exthandle.c1311
-rw-r--r--security/nss/lib/ssl/ssl3exthandle.h174
-rw-r--r--security/nss/lib/ssl/ssl3gthr.c50
-rw-r--r--security/nss/lib/ssl/ssl3prot.h126
-rw-r--r--security/nss/lib/ssl/sslbloom.c94
-rw-r--r--security/nss/lib/ssl/sslbloom.h32
-rw-r--r--security/nss/lib/ssl/sslcert.c10
-rw-r--r--security/nss/lib/ssl/sslencode.c296
-rw-r--r--security/nss/lib/ssl/sslencode.h69
-rw-r--r--security/nss/lib/ssl/sslerr.h14
-rw-r--r--security/nss/lib/ssl/sslexp.h358
-rw-r--r--security/nss/lib/ssl/sslimpl.h483
-rw-r--r--security/nss/lib/ssl/sslinfo.c160
-rw-r--r--security/nss/lib/ssl/sslnonce.c13
-rw-r--r--security/nss/lib/ssl/sslreveal.c22
-rw-r--r--security/nss/lib/ssl/sslsecur.c141
-rw-r--r--security/nss/lib/ssl/sslsnce.c59
-rw-r--r--security/nss/lib/ssl/sslsock.c475
-rw-r--r--security/nss/lib/ssl/sslspec.c273
-rw-r--r--security/nss/lib/ssl/sslspec.h194
-rw-r--r--security/nss/lib/ssl/sslt.h41
-rw-r--r--security/nss/lib/ssl/tls13con.c2419
-rw-r--r--security/nss/lib/ssl/tls13con.h71
-rw-r--r--security/nss/lib/ssl/tls13err.h28
-rw-r--r--security/nss/lib/ssl/tls13exthandle.c813
-rw-r--r--security/nss/lib/ssl/tls13exthandle.h118
-rw-r--r--security/nss/lib/ssl/tls13hashstate.c181
-rw-r--r--security/nss/lib/ssl/tls13hashstate.h25
-rw-r--r--security/nss/lib/ssl/tls13hkdf.c53
-rw-r--r--security/nss/lib/ssl/tls13replay.c276
-rw-r--r--security/nss/lib/util/nssb64d.c2
-rw-r--r--security/nss/lib/util/nssrwlk.c2
-rw-r--r--security/nss/lib/util/nssutil.def16
-rw-r--r--security/nss/lib/util/nssutil.h6
-rw-r--r--security/nss/lib/util/pkcs11uri.c2
-rw-r--r--security/nss/lib/util/quickder.c3
-rw-r--r--security/nss/lib/util/secasn1d.c4
-rw-r--r--security/nss/lib/util/secoid.c20
-rw-r--r--security/nss/lib/util/secport.c62
-rw-r--r--security/nss/lib/util/secport.h7
-rw-r--r--security/nss/lib/util/utilmod.c190
-rw-r--r--security/nss/lib/util/utilpars.c7
-rw-r--r--security/nss/lib/util/utilpars.h6
-rw-r--r--security/nss/lib/util/utilparst.h2
-rw-r--r--security/nss/lib/util/utilrename.h2
-rw-r--r--security/nss/mach219
-rw-r--r--security/nss/nss-tool/.clang-format4
-rw-r--r--security/nss/nss-tool/common/argparse.cc23
-rw-r--r--security/nss/nss-tool/common/argparse.h30
-rw-r--r--security/nss/nss-tool/common/tool.h20
-rw-r--r--security/nss/nss-tool/common/util.cc216
-rw-r--r--security/nss/nss-tool/common/util.h32
-rw-r--r--security/nss/nss-tool/db/dbtool.cc497
-rw-r--r--security/nss/nss-tool/db/dbtool.h28
-rw-r--r--security/nss/nss-tool/digest/digesttool.cc161
-rw-r--r--security/nss/nss-tool/digest/digesttool.h20
-rw-r--r--security/nss/nss-tool/enc/enctool.cc464
-rw-r--r--security/nss/nss-tool/enc/enctool.h62
-rw-r--r--security/nss/nss-tool/nss_tool.cc70
-rw-r--r--security/nss/nss-tool/nss_tool.gyp31
-rw-r--r--security/nss/nss.gyp10
-rw-r--r--security/nss/readme.md96
-rwxr-xr-xsecurity/nss/tests/all.sh64
-rw-r--r--security/nss/tests/cert/TestCA-bogus-rsa-pss1.crt26
-rw-r--r--security/nss/tests/cert/TestCA-bogus-rsa-pss2.crt24
-rwxr-xr-xsecurity/nss/tests/cert/cert.sh560
-rwxr-xr-xsecurity/nss/tests/cipher/cipher.sh16
-rw-r--r--security/nss/tests/common/init.sh14
-rwxr-xr-xsecurity/nss/tests/gtests/gtests.sh2
-rwxr-xr-xsecurity/nss/tests/merge/merge.sh2
-rwxr-xr-xsecurity/nss/tests/pkits/pkits.sh2
-rw-r--r--security/nss/tests/remote/Makefile1
-rwxr-xr-xsecurity/nss/tests/smime/smime.sh50
-rwxr-xr-xsecurity/nss/tests/ssl/ssl.sh344
-rw-r--r--security/nss/tests/ssl/sslstress.txt1
-rwxr-xr-xsecurity/nss/tests/ssl_gtests/ssl_gtests.sh14
-rw-r--r--security/nss/tests/tools/TestOldAES128CA.p12bin2628 -> 0 bytes
-rw-r--r--security/nss/tests/tools/TestOldCA.p12bin2588 -> 0 bytes
-rw-r--r--security/nss/tests/tools/tools.sh88
-rw-r--r--security/sandbox/linux/glue/SandboxCrash.cpp6
-rw-r--r--services/fxaccounts/tests/xpcshell/test_oauth_grant_client.js2
-rw-r--r--services/fxaccounts/tests/xpcshell/test_profile_client.js2
-rw-r--r--services/sync/tests/unit/test_service_login.js2
-rw-r--r--services/sync/tests/unit/test_syncscheduler.js2
-rw-r--r--storage/moz.build3
-rwxr-xr-xtaskcluster/scripts/builder/build-l10n.sh1
-rwxr-xr-xtaskcluster/scripts/builder/build-linux.sh1
-rw-r--r--testing/gtest/mozilla/GTestRunner.cpp25
-rw-r--r--testing/gtest/rungtests.py1
-rw-r--r--testing/marionette/client/marionette_driver/geckoinstance.py3
-rw-r--r--testing/marionette/element.js16
-rw-r--r--testing/marionette/error.js21
-rw-r--r--testing/marionette/harness/marionette_harness/tests/unit/test_click.py17
-rw-r--r--testing/marionette/interaction.js50
-rw-r--r--testing/marionette/listener.js4
-rw-r--r--testing/marionette/test_error.js20
-rw-r--r--testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm9
-rw-r--r--testing/mozbase/mozrunner/mozrunner/base/browser.py1
-rw-r--r--testing/mozbase/mozrunner/mozrunner/base/device.py3
-rwxr-xr-xtesting/mozbase/mozrunner/mozrunner/utils.py1
-rw-r--r--testing/profiles/prefs_general.js1
-rwxr-xr-xtesting/runcppunittests.py1
-rw-r--r--testing/talos/talos/ffsetup.py5
-rw-r--r--testing/web-platform/meta/MANIFEST.json22
-rw-r--r--testing/web-platform/meta/XMLHttpRequest/open-url-bogus.htm.ini11
-rw-r--r--testing/web-platform/meta/dom/events/EventTarget-dispatchEvent.html.ini4
-rw-r--r--testing/web-platform/meta/dom/nodes/Document-createEvent.html.ini24
-rw-r--r--testing/web-platform/meta/fetch/api/headers/headers-basic.html.ini14
-rw-r--r--testing/web-platform/meta/fetch/nosniff/worker.html.ini3
-rw-r--r--testing/web-platform/meta/html/semantics/forms/constraints/form-validation-checkValidity.html.ini22
-rw-r--r--testing/web-platform/meta/html/semantics/forms/constraints/form-validation-reportValidity.html.ini21
-rw-r--r--testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-rangeOverflow.html.ini18
-rw-r--r--testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-rangeUnderflow.html.ini18
-rw-r--r--testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-stepMismatch.html.ini4
-rw-r--r--testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-valid.html.ini13
-rw-r--r--testing/web-platform/meta/html/semantics/selectors/pseudo-classes/inrange-outofrange.html.ini20
-rwxr-xr-x[-rw-r--r--]testing/web-platform/meta/media-source/mediasource-getvideoplaybackquality.html.ini2
-rw-r--r--testing/web-platform/meta/selection/getSelection.html.ini9
-rwxr-xr-x[-rw-r--r--]testing/web-platform/meta/service-workers/service-worker/performance-timeline.https.html.ini2
-rw-r--r--testing/web-platform/meta/service-workers/service-worker/resource-timing.https.html.ini7
-rw-r--r--testing/web-platform/meta/url/url-constructor.html.ini3
-rwxr-xr-xtesting/web-platform/meta/webaudio/the-audio-api/the-audioparam-interface/retrospective-setValueAtTime.html.ini3
-rwxr-xr-xtesting/web-platform/meta/webaudio/the-audio-api/the-offlineaudiocontext-interface/current-time-block-size.html.ini3
-rw-r--r--testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_1.html30
-rw-r--r--testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1.html30
-rw-r--r--testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1_ref.html (renamed from testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_1_ref.html)0
-rw-r--r--testing/web-platform/tests/fetch/api/response/response-init-002.html5
-rw-r--r--testing/web-platform/tests/fetch/nosniff/script.html4
-rw-r--r--testing/web-platform/tests/html/webappapis/idle-callbacks/callback-suspended.html93
-rw-r--r--testing/web-platform/tests/html/webappapis/idle-callbacks/callback-timeout.html15
-rw-r--r--testing/web-platform/tests/html/webappapis/idle-callbacks/cancel-invoked.html6
-rw-r--r--testing/web-platform/tests/html/webappapis/idle-callbacks/resources/post_name_on_load.html7
-rw-r--r--testing/web-platform/tests/service-workers/service-worker/resource-timing.https.html4
-rw-r--r--testing/web-platform/tests/service-workers/service-worker/resources/resource-timing-worker.js6
-rw-r--r--testing/web-platform/tests/user-timing/resources/webperftestharness.js2
-rw-r--r--testing/web-platform/tests/user-timing/test_user_timing_mark_and_measure_exception_when_invoke_with_timing_attributes.html32
-rw-r--r--testing/web-platform/tests/user-timing/test_user_timing_mark_and_measure_exception_when_invoke_with_timing_attributes.js14
-rw-r--r--testing/web-platform/tests/workers/Worker_cross_origin_security_err.htm2
-rw-r--r--testing/web-platform/tests/workers/constructors/SharedWorker/same-origin.html2
-rw-r--r--testing/web-platform/tests/workers/constructors/Worker/same-origin.html2
-rw-r--r--testing/xpcshell/head.js17
-rwxr-xr-xtesting/xpcshell/runxpcshelltests.py3
-rw-r--r--toolkit/components/aboutcache/content/aboutCache.js4
-rw-r--r--toolkit/components/alerts/resources/content/alert.css1
-rw-r--r--toolkit/components/alerts/resources/content/alert.js10
-rw-r--r--toolkit/components/autocomplete/nsAutoCompleteController.cpp122
-rw-r--r--toolkit/components/autocomplete/nsAutoCompleteSimpleResult.cpp23
-rw-r--r--toolkit/components/autocomplete/nsAutoCompleteSimpleResult.h2
-rw-r--r--toolkit/components/autocomplete/nsIAutoCompleteResult.idl7
-rw-r--r--toolkit/components/autocomplete/nsIAutoCompleteSimpleResult.idl6
-rw-r--r--toolkit/components/autocomplete/tests/unit/head_autocomplete.js5
-rw-r--r--toolkit/components/autocomplete/tests/unit/test_hiddenResult.js76
-rw-r--r--toolkit/components/autocomplete/tests/unit/test_popupSelectionVsDefaultCompleteValue.js71
-rw-r--r--toolkit/components/autocomplete/tests/unit/xpcshell.ini2
-rw-r--r--toolkit/components/filepicker/nsFileView.cpp7
-rw-r--r--toolkit/components/jsdownloads/src/DownloadIntegration.jsm40
-rw-r--r--toolkit/components/moz.build3
-rw-r--r--toolkit/components/mozintl/MozIntl.cpp26
-rw-r--r--toolkit/components/mozintl/mozIMozIntl.idl1
-rw-r--r--toolkit/components/mozintl/test/test_mozintl.js14
-rw-r--r--toolkit/components/passwordmgr/content/passwordManager.js8
-rw-r--r--toolkit/components/passwordmgr/content/passwordManager.xul3
-rw-r--r--toolkit/components/passwordmgr/jar.mn2
-rw-r--r--toolkit/components/passwordmgr/nsLoginManagerPrompter.js29
-rw-r--r--toolkit/components/passwordmgr/test/unit/test_logins_search.js1
-rw-r--r--toolkit/components/places/UnifiedComplete.js2
-rw-r--r--toolkit/components/places/moz.build2
-rw-r--r--toolkit/components/places/nsNavBookmarks.cpp2
-rw-r--r--toolkit/components/places/nsNavHistory.cpp6
-rw-r--r--toolkit/components/places/nsPlacesAutoComplete.js1778
-rw-r--r--toolkit/components/places/nsPlacesAutoComplete.manifest6
-rw-r--r--toolkit/components/places/nsTaggingService.js4
-rw-r--r--toolkit/components/places/tests/cpp/places_test_harness_tail.h29
-rw-r--r--toolkit/components/protobuf/moz.build5
-rw-r--r--toolkit/components/satchel/test/test_form_autocomplete.html12
-rw-r--r--toolkit/components/telemetry/TelemetryEnvironment.jsm30
-rw-r--r--toolkit/components/terminator/nsTerminator.cpp11
-rw-r--r--toolkit/components/url-classifier/HashStore.cpp3
-rw-r--r--toolkit/components/url-classifier/nsCheckSummedOutputStream.cpp17
-rw-r--r--toolkit/components/url-classifier/nsCheckSummedOutputStream.h24
-rw-r--r--toolkit/components/webextensions/ExtensionChild.jsm28
-rw-r--r--toolkit/components/webextensions/ExtensionCommon.jsm3
-rw-r--r--toolkit/components/webextensions/ExtensionContent.jsm4
-rw-r--r--toolkit/components/webextensions/LegacyExtensionsUtils.jsm2
-rw-r--r--toolkit/components/webextensions/ext-c-runtime.js5
-rw-r--r--toolkit/components/webextensions/schemas/runtime.json2
-rw-r--r--toolkit/components/webextensions/test/mochitest/mochitest.ini1
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_all_apis.js2
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_external_messaging.html111
-rw-r--r--toolkit/components/webextensions/test/mochitest/test_ext_sendmessage_reply2.html144
-rw-r--r--toolkit/components/webextensions/test/xpcshell/test_ext_legacy_extension_context.js4
-rw-r--r--toolkit/components/xulstore/XULStore.js18
-rw-r--r--toolkit/content/about.js23
-rw-r--r--toolkit/content/about.xhtml3
-rw-r--r--toolkit/content/aboutSupport.js119
-rw-r--r--toolkit/content/aboutSupport.xhtml67
-rw-r--r--toolkit/content/browser-child.js26
-rw-r--r--toolkit/content/browser-content.js16
-rw-r--r--toolkit/content/customizeToolbar.js24
-rw-r--r--toolkit/content/datepicker.xhtml60
-rw-r--r--toolkit/content/jar.mn13
-rw-r--r--toolkit/content/license.html48
-rw-r--r--toolkit/content/logopage.xhtml36
-rw-r--r--toolkit/content/memoriam.xhtml76
-rw-r--r--toolkit/content/mozilla.css36
-rw-r--r--toolkit/content/mozilla.xhtml35
-rw-r--r--toolkit/content/plugins.html14
-rw-r--r--toolkit/content/tests/browser/browser.ini1
-rw-r--r--toolkit/content/tests/browser/browser_datetime_datepicker.js284
-rw-r--r--toolkit/content/tests/browser/head.js90
-rw-r--r--toolkit/content/tests/widgets/test_videocontrols.html2
-rw-r--r--toolkit/content/timepicker.xhtml2
-rw-r--r--toolkit/content/widgets/calendar.js171
-rw-r--r--toolkit/content/widgets/datekeeper.js336
-rw-r--r--toolkit/content/widgets/datepicker.js376
-rw-r--r--toolkit/content/widgets/datetimebox.css12
-rw-r--r--toolkit/content/widgets/datetimebox.xml782
-rw-r--r--toolkit/content/widgets/datetimepicker.xml6
-rw-r--r--toolkit/content/widgets/datetimepopup.xml171
-rw-r--r--toolkit/content/widgets/findbar.xml58
-rw-r--r--toolkit/content/widgets/menulist.xml18
-rw-r--r--toolkit/content/widgets/spinner.js47
-rw-r--r--toolkit/content/widgets/timekeeper.js12
-rw-r--r--toolkit/content/widgets/timepicker.js39
-rw-r--r--toolkit/content/widgets/toolbar.xml55
-rw-r--r--toolkit/forgetaboutsite/ForgetAboutSite.jsm244
-rw-r--r--toolkit/forgetaboutsite/test/browser/browser_clearplugindata.js9
-rw-r--r--toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js68
-rw-r--r--toolkit/jetpack/modules/system/Startup.js1
-rw-r--r--toolkit/jetpack/moz.build25
-rw-r--r--toolkit/jetpack/sdk/addon/bootstrap.js2
-rw-r--r--toolkit/jetpack/sdk/clipboard.js1
-rw-r--r--toolkit/jetpack/sdk/context-menu.js1
-rw-r--r--toolkit/jetpack/sdk/panel.js1
-rw-r--r--toolkit/jetpack/sdk/places/bookmarks.js1
-rw-r--r--toolkit/jetpack/sdk/places/events.js1
-rw-r--r--toolkit/jetpack/sdk/places/favicon.js1
-rw-r--r--toolkit/jetpack/sdk/places/history.js1
-rw-r--r--toolkit/jetpack/sdk/places/host/host-bookmarks.js1
-rw-r--r--toolkit/jetpack/sdk/places/host/host-query.js1
-rw-r--r--toolkit/jetpack/sdk/places/host/host-tags.js1
-rw-r--r--toolkit/jetpack/sdk/places/utils.js1
-rw-r--r--toolkit/jetpack/sdk/selection.js1
-rw-r--r--toolkit/jetpack/sdk/system/xul-app.jsm1
-rw-r--r--toolkit/jetpack/sdk/ui.js3
-rw-r--r--toolkit/jetpack/sdk/ui/button/action.js1
-rw-r--r--toolkit/jetpack/sdk/ui/button/toggle.js1
-rw-r--r--toolkit/jetpack/sdk/ui/button/view.js45
-rw-r--r--toolkit/jetpack/sdk/ui/button/view/events.js1
-rw-r--r--toolkit/jetpack/sdk/ui/buttons.js198
-rw-r--r--toolkit/jetpack/sdk/ui/state.js1
-rw-r--r--toolkit/jetpack/sdk/ui/state/events.js1
-rw-r--r--toolkit/locales/Makefile.in8
-rw-r--r--toolkit/locales/en-US/chrome/global/about.dtd7
-rw-r--r--toolkit/locales/en-US/chrome/global/aboutRights.dtd19
-rw-r--r--toolkit/locales/en-US/chrome/global/autocomplete.properties5
-rw-r--r--toolkit/locales/en-US/chrome/global/customizeToolbar.properties1
-rw-r--r--toolkit/locales/en-US/chrome/global/datetimebox.dtd9
-rw-r--r--toolkit/locales/en-US/chrome/global/findbar.dtd4
-rw-r--r--toolkit/locales/en-US/chrome/mozapps/preferences/changemp.dtd2
-rw-r--r--toolkit/locales/en-US/chrome/passwordmgr/passwordManager.dtd2
-rw-r--r--toolkit/locales/en-US/chrome/passwordmgr/passwordmgr.properties11
-rw-r--r--toolkit/locales/en-US/chrome/places/places.properties1
-rw-r--r--toolkit/locales/jar.mn1
-rw-r--r--toolkit/locales/l10n.mk8
-rw-r--r--toolkit/modules/AppConstants.jsm20
-rw-r--r--toolkit/modules/DateTimePickerHelper.jsm29
-rw-r--r--toolkit/modules/ResetProfile.jsm6
-rw-r--r--toolkit/modules/Services.jsm9
-rw-r--r--toolkit/modules/Troubleshoot.jsm32
-rw-r--r--toolkit/modules/addons/WebRequestContent.js10
-rw-r--r--toolkit/modules/sessionstore/FormData.jsm2
-rw-r--r--toolkit/moz.build3
-rw-r--r--toolkit/moz.configure24
-rw-r--r--toolkit/mozapps/extensions/AddonManager.jsm6
-rw-r--r--toolkit/mozapps/extensions/AddonPathService.cpp10
-rw-r--r--toolkit/mozapps/extensions/DeferredSave.jsm6
-rw-r--r--toolkit/mozapps/extensions/addonManager.js4
-rw-r--r--toolkit/mozapps/extensions/amIAddonPathService.idl8
-rw-r--r--toolkit/mozapps/extensions/amInstallTrigger.js2
-rw-r--r--toolkit/mozapps/extensions/amWebInstallListener.js2
-rw-r--r--toolkit/mozapps/extensions/content/extensions.js85
-rw-r--r--toolkit/mozapps/extensions/content/update.js4
-rw-r--r--toolkit/mozapps/extensions/internal/AddonRepository.jsm4
-rw-r--r--toolkit/mozapps/extensions/internal/AddonRepository_SQLiteMigrator.jsm8
-rw-r--r--toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm2
-rw-r--r--toolkit/mozapps/extensions/internal/Content.js4
-rw-r--r--toolkit/mozapps/extensions/internal/GMPProvider.jsm8
-rw-r--r--toolkit/mozapps/extensions/internal/LightweightThemeImageOptimizer.jsm8
-rw-r--r--toolkit/mozapps/extensions/internal/PluginProvider.jsm2
-rw-r--r--toolkit/mozapps/extensions/internal/XPIProvider.jsm72
-rw-r--r--toolkit/mozapps/extensions/internal/XPIProviderUtils.js2
-rw-r--r--toolkit/mozapps/extensions/nsBlocklistService.js2
-rw-r--r--toolkit/mozapps/extensions/test/addons/test_bootstrap_const/bootstrap.js5
-rw-r--r--toolkit/mozapps/extensions/test/addons/test_bootstrap_const/install.rdf24
-rw-r--r--toolkit/mozapps/extensions/test/browser/browser-common.ini2
-rw-r--r--toolkit/mozapps/extensions/test/browser/browser_experiments.js645
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_const.js17
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/test_mapURIToAddonID.js4
-rw-r--r--toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini1
-rw-r--r--toolkit/mozapps/installer/find-dupes.py115
-rw-r--r--toolkit/mozapps/installer/packager.mk2
-rw-r--r--toolkit/mozapps/preferences/changemp.js12
-rw-r--r--toolkit/mozapps/preferences/changemp.xul7
-rw-r--r--toolkit/mozapps/webextensions/content/extensions.js84
-rw-r--r--toolkit/mozapps/webextensions/internal/XPIProvider.jsm10
-rw-r--r--toolkit/mozapps/webextensions/test/browser/browser-common.ini1
-rw-r--r--toolkit/mozapps/webextensions/test/browser/browser_experiments.js654
-rw-r--r--toolkit/pluginproblem/content/pluginProblemBinding.css5
-rw-r--r--toolkit/pluginproblem/content/pluginProblemContent.css6
-rw-r--r--toolkit/pluginproblem/jar.mn4
-rw-r--r--toolkit/profile/nsProfileLock.cpp4
-rw-r--r--toolkit/themes/linux/global/findBar.css151
-rw-r--r--toolkit/themes/linux/global/icons/find.pngbin0 -> 1498 bytes
-rw-r--r--toolkit/themes/linux/global/inContentUI.css41
-rw-r--r--toolkit/themes/linux/global/jar.mn8
-rw-r--r--toolkit/themes/linux/mozapps/jar.mn49
-rw-r--r--toolkit/themes/linux/mozapps/passwordmgr/key-16.pngbin0 -> 773 bytes
-rw-r--r--toolkit/themes/linux/mozapps/passwordmgr/key-64.pngbin0 -> 6142 bytes
-rw-r--r--toolkit/themes/linux/mozapps/passwordmgr/key.pngbin0 -> 658 bytes
-rw-r--r--toolkit/themes/osx/global/findBar.css257
-rw-r--r--toolkit/themes/osx/global/inContentUI.css144
-rw-r--r--toolkit/themes/osx/global/jar.mn1
-rw-r--r--toolkit/themes/osx/mozapps/jar.mn3
-rw-r--r--toolkit/themes/osx/mozapps/passwordmgr/key-16.pngbin0 -> 773 bytes
-rw-r--r--toolkit/themes/osx/mozapps/passwordmgr/key-64.pngbin0 -> 6142 bytes
-rw-r--r--toolkit/themes/osx/mozapps/passwordmgr/key.pngbin0 -> 658 bytes
-rw-r--r--toolkit/themes/shared/about.css8
-rw-r--r--toolkit/themes/shared/datetimeinputpickers.css377
-rw-r--r--toolkit/themes/shared/datetimepopup.css11
-rw-r--r--toolkit/themes/shared/icons/calendar-arrows.svg13
-rw-r--r--toolkit/themes/shared/icons/spinner-arrows.svg13
-rw-r--r--toolkit/themes/shared/jar.inc.mn5
-rw-r--r--toolkit/themes/shared/non-mac.jar.inc.mn2
-rw-r--r--toolkit/themes/shared/timepicker.css153
-rw-r--r--toolkit/themes/windows/global/findBar.css159
-rw-r--r--toolkit/themes/windows/global/icons/find.pngbin0 -> 1736 bytes
-rw-r--r--toolkit/themes/windows/global/icons/question-32.pngbin0 -> 1962 bytes
-rw-r--r--toolkit/themes/windows/global/icons/question-48.pngbin0 -> 2851 bytes
-rw-r--r--toolkit/themes/windows/global/inContentUI.css159
-rw-r--r--toolkit/themes/windows/global/jar.mn2
-rw-r--r--toolkit/themes/windows/mozapps/jar.mn4
-rw-r--r--toolkit/themes/windows/mozapps/passwordmgr/key-16.pngbin0 -> 773 bytes
-rw-r--r--toolkit/themes/windows/mozapps/passwordmgr/key-64.pngbin0 -> 6142 bytes
-rw-r--r--toolkit/themes/windows/mozapps/passwordmgr/key.pngbin0 -> 658 bytes
-rw-r--r--toolkit/themes/windows/mozapps/plugins/pluginGeneric-16.pngbin539 -> 635 bytes
-rw-r--r--toolkit/themes/windows/mozapps/plugins/pluginGeneric-48.pngbin0 -> 2174 bytes
-rw-r--r--toolkit/themes/windows/mozapps/plugins/pluginGeneric.pngbin971 -> 1334 bytes
-rw-r--r--toolkit/toolkit.mozbuild4
-rw-r--r--toolkit/xre/MozMeegoAppService.h28
-rw-r--r--toolkit/xre/ProfileReset.cpp12
-rw-r--r--toolkit/xre/ProfileReset.h1
-rw-r--r--toolkit/xre/nsAndroidStartup.cpp9
-rw-r--r--toolkit/xre/nsAppRunner.cpp701
-rw-r--r--toolkit/xre/nsEmbedFunctions.cpp79
-rw-r--r--toolkit/xre/nsWindowsWMain.cpp4
-rw-r--r--toolkit/xre/nsX11ErrorHandler.cpp12
-rw-r--r--tools/profiler/moz.build17
-rw-r--r--tools/rewriting/ThirdPartyPaths.txt1
-rw-r--r--widget/BasicEvents.h1
-rw-r--r--widget/EventMessageList.h1
-rw-r--r--widget/GfxInfoBase.cpp4
-rw-r--r--widget/GfxInfoX11.cpp19
-rw-r--r--widget/MouseEvents.h21
-rw-r--r--widget/WidgetEventImpl.cpp1
-rw-r--r--widget/android/GfxInfo.cpp22
-rw-r--r--widget/android/jni/Utils.cpp10
-rw-r--r--widget/android/nsAppShell.cpp5
-rw-r--r--widget/cocoa/GfxInfo.mm34
-rw-r--r--widget/cocoa/nsChildView.mm20
-rw-r--r--widget/gtk/WidgetStyleCache.cpp159
-rw-r--r--widget/gtk/gtk3drawing.cpp285
-rw-r--r--widget/gtk/gtkdrawing.h18
-rw-r--r--widget/gtk/nsLookAndFeel.cpp201
-rw-r--r--widget/gtk/nsLookAndFeel.h3
-rw-r--r--widget/gtk/nsWindow.cpp16
-rw-r--r--widget/moz.build2
-rw-r--r--widget/nsBaseAppShell.cpp9
-rw-r--r--widget/nsBaseWidget.cpp1
-rw-r--r--widget/nsContentProcessWidgetFactory.cpp6
-rw-r--r--widget/nsDatePickerProxy.cpp61
-rw-r--r--widget/nsDatePickerProxy.h33
-rw-r--r--widget/nsGUIEventIPC.h39
-rw-r--r--widget/nsIDatePicker.idl50
-rw-r--r--widget/nsWidgetsCID.h5
-rw-r--r--widget/windows/GfxInfo.cpp100
-rw-r--r--widget/windows/KeyboardLayout.cpp117
-rw-r--r--widget/windows/LSPAnnotator.cpp156
-rw-r--r--widget/windows/WinUtils.cpp3
-rw-r--r--widget/windows/moz.build5
-rw-r--r--widget/windows/nsAppShell.cpp4
-rw-r--r--widget/windows/nsClipboard.cpp2
-rw-r--r--widget/windows/nsDataObj.cpp99
-rw-r--r--widget/windows/nsDataObj.h1
-rw-r--r--xpcom/base/CycleCollectedJSContext.cpp26
-rw-r--r--xpcom/base/nsCrashOnException.cpp11
-rw-r--r--xpcom/base/nsCycleCollector.cpp14
-rw-r--r--xpcom/base/nsCycleCollectorTraceJSHelpers.cpp2
-rw-r--r--xpcom/base/nsDebugImpl.cpp22
-rw-r--r--xpcom/base/nsMemoryReporterManager.cpp2
-rw-r--r--xpcom/base/nsObjCExceptions.h15
-rw-r--r--xpcom/build/nsXULAppAPI.h11
-rw-r--r--xpcom/glue/PLDHashTable.cpp10
-rw-r--r--xpcom/io/nsEscape.cpp2
-rw-r--r--xpcom/reflect/xptcall/md/unix/Makefile.in11
-rw-r--r--xpcom/reflect/xptcall/md/unix/moz.build17
-rw-r--r--xpcom/reflect/xptcall/status.html15
-rw-r--r--xpcom/reflect/xptcall/xptcall.h2
-rw-r--r--xpcom/system/moz.build5
-rw-r--r--xpcom/system/nsIXULRuntime.idl2
-rw-r--r--xpcom/tests/gtest/TestDeadlockDetector.cpp14
-rw-r--r--xpcom/tests/gtest/TestPLDHash.cpp15
-rw-r--r--xpcom/tests/gtest/TestSTLWrappers.cpp14
-rw-r--r--xpcom/threads/HangMonitor.cpp13
-rw-r--r--xpcom/threads/nsThread.cpp79
-rw-r--r--xpcom/threads/nsThread.h10
2578 files changed, 90213 insertions, 189346 deletions
diff --git a/.cargo/.gitignore b/.cargo/.gitignore
deleted file mode 100644
index 04204c7c9d..0000000000
--- a/.cargo/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-config
diff --git a/.cargo/config.in b/.cargo/config.in
deleted file mode 100644
index 06587c765e..0000000000
--- a/.cargo/config.in
+++ /dev/null
@@ -1,6 +0,0 @@
-[source.crates-io]
-registry = 'https://github.com/rust-lang/crates.io-index'
-replace-with = 'vendored-sources'
-
-[source.vendored-sources]
-directory = '@top_srcdir@/third_party/rust'
diff --git a/CLOBBER b/CLOBBER
index 5dd4ee07f1..ebe3d9f8c7 100644
--- a/CLOBBER
+++ b/CLOBBER
@@ -22,4 +22,4 @@
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
# don't change CLOBBER for WebIDL changes any more.
-Clobber for un-folding browsercomps \ No newline at end of file
+Clobber for updating ffvpx
diff --git a/Makefile.in b/Makefile.in
index f196af5450..26cd688d48 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -299,13 +299,6 @@ MAKE_SYM_STORE_ARGS += --install-manifest=$(DEPTH)/_build_manifests/install/dist
SYM_STORE_SOURCE_DIRS := $(topsrcdir)
-ifdef MOZ_CRASHREPORTER
-include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
-
-SYMBOL_INDEX_NAME = \
- $(MOZ_APP_NAME)-$(MOZ_APP_VERSION)-$(OS_TARGET)-$(BUILDID)-$(CPU_ARCH)-symbols.txt
-endif
-
.PHONY: generatesymbols
generatesymbols:
echo building symbol store
@@ -337,18 +330,9 @@ symbolsarchive: generatesymbols
cd $(DIST)/crashreporter-symbols && \
zip -r5D '../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' . -i '*.sym' -i '*.txt'
-ifdef MOZ_CRASHREPORTER
-buildsymbols: symbolsfullarchive symbolsarchive
-else
buildsymbols:
-endif
uploadsymbols:
-ifdef MOZ_CRASHREPORTER
-ifdef SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE
- $(PYTHON) -u $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.py '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
-endif
-endif
.PHONY: update-packaging
update-packaging:
diff --git a/README.md b/README.md
index 32cdf9b042..69f81ca3be 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,12 @@ applications.
This repository will contain at least one application to demonstrate and make use
of the platform: The Basilisk web browser, a close twin to Mozilla's Firefox.
+## Additional documentation
+
+Additional documentation relevant to this source code can be found in the `/docs`
+directory. This will contain relevant documentation regarding contributing,
+using and distributing this code and its binaries.
+
### A note about trademarks and branding
Although this repository is licensed under Mozilla Public License v2.0, the
diff --git a/accessible/base/nsAccessibilityService.cpp b/accessible/base/nsAccessibilityService.cpp
index 2590969a09..46d4dde01b 100644
--- a/accessible/base/nsAccessibilityService.cpp
+++ b/accessible/base/nsAccessibilityService.cpp
@@ -53,10 +53,6 @@
#include "Logging.h"
#endif
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
-
#include "nsImageFrame.h"
#include "nsIObserverService.h"
#include "nsLayoutUtils.h"
@@ -1283,12 +1279,6 @@ nsAccessibilityService::Init()
NS_ADDREF(gApplicationAccessible); // will release in Shutdown()
gApplicationAccessible->Init();
-#ifdef MOZ_CRASHREPORTER
- CrashReporter::
- AnnotateCrashReport(NS_LITERAL_CSTRING("Accessibility"),
- NS_LITERAL_CSTRING("Active"));
-#endif
-
#ifdef XP_WIN
sPendingPlugins = new nsTArray<nsCOMPtr<nsIContent> >;
sPluginTimers = new nsTArray<nsCOMPtr<nsITimer> >;
diff --git a/accessible/tests/mochitest/jsat/test_output.html b/accessible/tests/mochitest/jsat/test_output.html
index ec2b289bea..5256426070 100644
--- a/accessible/tests/mochitest/jsat/test_output.html
+++ b/accessible/tests/mochitest/jsat/test_output.html
@@ -125,14 +125,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=753984
{"string": "listAbbr"},
{"string": "cellInfoAbbr", "args": [ 1, 1]}]]
}, {
- accOrElmOrID: "date",
- expectedUtterance: [[{"string": "textInputType_date"},
- {"string": "entry"}, "2011-09-29"], ["2011-09-29",
- {"string": "textInputType_date"}, {"string": "entry"}]],
- expectedBraille: [[{"string": "textInputType_date"},
- {"string": "entryAbbr"}, "2011-09-29"], ["2011-09-29",
- {"string": "textInputType_date"}, {"string": "entryAbbr"}]]
- }, {
accOrElmOrID: "email",
expectedUtterance: [[{"string": "textInputType_email"},
{"string": "entry"}, "test@example.com"], ["test@example.com",
@@ -619,7 +611,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=753984
<label for="password">Secret Password</label><input id="password" type="password"></input>
<label for="radio_unselected">any old radio button</label><input id="radio_unselected" type="radio"></input>
<label for="radio_selected">a unique radio button</label><input id="radio_selected" type="radio" checked></input>
- <input id="date" type="date" value="2011-09-29" />
<input id="email" type="email" value="test@example.com" />
<input id="search" type="search" value="This is a search" />
<input id="tel" type="tel" value="555-5555" />
diff --git a/accessible/windows/msaa/IUnknownImpl.cpp b/accessible/windows/msaa/IUnknownImpl.cpp
index c74f86e335..c5e614b601 100644
--- a/accessible/windows/msaa/IUnknownImpl.cpp
+++ b/accessible/windows/msaa/IUnknownImpl.cpp
@@ -9,10 +9,6 @@
#include "nsDebug.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
-
namespace mozilla {
namespace a11y {
diff --git a/aclocal.m4 b/aclocal.m4
index fe8419da2d..a4c84a3863 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -27,7 +27,6 @@ builtin(include, build/autoconf/icu.m4)dnl
builtin(include, build/autoconf/clang-plugin.m4)dnl
builtin(include, build/autoconf/alloc.m4)dnl
builtin(include, build/autoconf/ios.m4)dnl
-builtin(include, build/autoconf/jemalloc.m4)dnl
builtin(include, build/autoconf/sanitize.m4)dnl
MOZ_PROG_CHECKMSYS()
diff --git a/application/palemoon/app.mozbuild b/application/palemoon/app.mozbuild
index 0cbce0f723..1727d4f6bf 100644
--- a/application/palemoon/app.mozbuild
+++ b/application/palemoon/app.mozbuild
@@ -13,5 +13,5 @@ DIRS += ['/%s' % CONFIG['MOZ_BRANDING_DIRECTORY']]
# Never add tier dirs after browser because they apparently won't get
# packaged properly on Mac.
-DIRS += ['/browser']
+DIRS += ['/application/palemoon']
diff --git a/application/palemoon/app/Makefile.in b/application/palemoon/app/Makefile.in
index 580fcb1640..c0f01212c2 100644
--- a/application/palemoon/app/Makefile.in
+++ b/application/palemoon/app/Makefile.in
@@ -54,14 +54,6 @@ GARBAGE += $(addprefix $(FINAL_TARGET)/defaults/pref/, palemoon.js)
endif
-ifdef MOZ_WIDGET_GTK
-libs::
- $(INSTALL) $(IFLAGS1) $(DIST)/branding/mozicon128.png $(FINAL_TARGET)/icons
- $(INSTALL) $(IFLAGS1) $(DIST)/branding/default16.png $(FINAL_TARGET)/chrome/icons/default
- $(INSTALL) $(IFLAGS1) $(DIST)/branding/default32.png $(FINAL_TARGET)/chrome/icons/default
- $(INSTALL) $(IFLAGS1) $(DIST)/branding/default48.png $(FINAL_TARGET)/chrome/icons/default
-endif
-
ifndef LIBXUL_SDK
# channel-prefs.js is handled separate from other prefs due to bug 756325
libs:: $(srcdir)/profile/channel-prefs.js
@@ -84,7 +76,7 @@ AB := $(firstword $(subst -, ,$(AB_CD)))
clean clobber repackage::
$(RM) -r $(dist_dest)
-MAC_BUNDLE_VERSION = $(shell $(PYTHON) $(srcdir)/macversion.py --version=$(MOZ_APP_VERSION) --buildid=$(DEPTH)/config/buildid)
+MAC_BUNDLE_VERSION = $(shell $(PYTHON) $(srcdir)/macversion.py --version=$(MOZ_APP_VERSION) --buildid=$(DEPTH)/buildid.h)
.PHONY: repackage
tools repackage:: $(PROGRAM)
diff --git a/application/palemoon/app/blocklist.xml b/application/palemoon/app/blocklist.xml
index 9c64af9879..296b8ad244 100644
--- a/application/palemoon/app/blocklist.xml
+++ b/application/palemoon/app/blocklist.xml
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
-<blocklist lastupdate="1508456048000"
+<blocklist lastupdate="1521130300000"
xmlns="http://www.mozilla.org/2006/addons-blocklist">
<emItems>
<emItem blockID="i545" id="superlrcs@svenyor.net">
@@ -2441,6 +2441,18 @@ xmlns="http://www.mozilla.org/2006/addons-blocklist">
<versionRange minVersion="4.0.0a" maxVersion="4.1.20a"
severity="1" />
</emItem>
+ <emItem blockID="2447476f-043b-4d0b-9d3c-8e859c97d950" id="{44e4b2cf-77ba-4f76-aca7-f3fcbc2dda2f}">
+ <prefs/>
+ <versionRange minVersion="0" maxVersion="*" severity="3"/>
+ </emItem>
+ <emItem blockID="f58729ec-f93c-41d9-870d-dd9c9fd811b6" id="/^(addon@fasterweb\.com|\{5f398d3f-25db-47f5-b422-aa2364ff6c0b\}|addon@fasterp\.com|addon@calculator)$/">
+ <prefs/>
+ <versionRange minVersion="0" maxVersion="*" severity="3"/>
+ </emItem>
+ <emItem blockID="3d55fab0-ec1a-4bca-84c9-3b74f5d01509" id="/^.*extension.*@asdf\.pl$/">
+ <prefs/>
+ <versionRange minVersion="0" maxVersion="*" severity="3"/>
+ </emItem>
<emItem blockID="pm100" id="{d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}">
<versionRange minVersion="0" maxVersion="*" severity="1">
</versionRange>
diff --git a/application/palemoon/app/macbuild/Contents/Info.plist.in b/application/palemoon/app/macbuild/Contents/Info.plist.in
index c77ab1ec5c..b224064cf6 100644
--- a/application/palemoon/app/macbuild/Contents/Info.plist.in
+++ b/application/palemoon/app/macbuild/Contents/Info.plist.in
@@ -205,6 +205,11 @@
<true/>
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
+ <key>LSEnvironment</key>
+ <dict>
+ <key>MallocNanoZone</key>
+ <string>0</string>
+ </dict>
<key>LSMinimumSystemVersion</key>
<string>10.6</string>
<key>LSMinimumSystemVersionByArchitecture</key>
diff --git a/application/palemoon/app/macversion.py b/application/palemoon/app/macversion.py
index 8c360368e9..839aac1ffc 100644
--- a/application/palemoon/app/macversion.py
+++ b/application/palemoon/app/macversion.py
@@ -28,7 +28,7 @@ if not options.version:
# builds), but also so that newly-built older versions (e.g. beta build) aren't
# considered "newer" than previously-built newer versions (e.g. a trunk nightly)
-buildid = open(options.buildid, 'r').read()
+define, MOZ_BUILDID, buildid = open(options.buildid, 'r').read().split()
# extract only the major version (i.e. "14" from "14.0b1")
majorVersion = re.match(r'^(\d+)[^\d].*', options.version).group(1)
diff --git a/application/palemoon/app/moz.build b/application/palemoon/app/moz.build
index 929139a6a3..8b358b6228 100644
--- a/application/palemoon/app/moz.build
+++ b/application/palemoon/app/moz.build
@@ -7,12 +7,9 @@
DIRS += ['profile/extensions']
-if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['MOZ_ASAN']:
- GoannaProgram(CONFIG['MOZ_APP_NAME'])
-else:
- GoannaProgram(CONFIG['MOZ_APP_NAME'], msvcrt='static')
+GeckoProgram(CONFIG['MOZ_APP_NAME'])
-JS_PREFERENCE_FILES += [
+JS_PREFERENCE_PP_FILES += [
'profile/palemoon.js',
]
@@ -30,14 +27,8 @@ FINAL_TARGET_FILES.defaults.profile += ['profile/prefs.js']
DEFINES['APP_VERSION'] = CONFIG['MOZ_APP_VERSION']
-for var in ('MOZILLA_OFFICIAL', 'LIBXUL_SDK'):
- if CONFIG[var]:
- DEFINES[var] = True
-
-DEFINES['XPCOM_GLUE'] = True
-
-GENERATED_INCLUDES += [
- '/build',
+LOCAL_INCLUDES += [
+ '!/build',
]
LOCAL_INCLUDES += [
@@ -46,11 +37,9 @@ LOCAL_INCLUDES += [
'/xpcom/build',
]
-DELAYLOAD_DLLS += [
- 'mozglue.dll',
+USE_LIBS += [
+ 'mozglue',
]
-USE_STATIC_LIBS = True
-
if CONFIG['_MSC_VER']:
# Always enter a Windows program through wmain, whether or not we're
@@ -72,16 +61,6 @@ if CONFIG['OS_ARCH'] == 'WINNT':
if CONFIG['OS_ARCH'] == 'WINNT' and not CONFIG['GNU_CC']:
LDFLAGS += ['/HEAP:0x40000']
-if CONFIG['OS_ARCH'] == 'WINNT':
- USE_LIBS += [
- 'mozglue',
- 'xpcomglue_staticruntime',
- ]
-else:
- USE_LIBS += [
- 'xpcomglue',
- ]
-
DISABLE_STL_WRAPPING = True
if CONFIG['MOZ_LINKER']:
diff --git a/application/palemoon/app/nsBrowserApp.cpp b/application/palemoon/app/nsBrowserApp.cpp
index f9645b0c69..5b866d6b45 100644
--- a/application/palemoon/app/nsBrowserApp.cpp
+++ b/application/palemoon/app/nsBrowserApp.cpp
@@ -8,25 +8,13 @@
#include "application.ini.h"
#include "nsXPCOMGlue.h"
#if defined(XP_WIN)
-#undef _WIN32_WINNT
-#define _WIN32_WINNT 0x0600
#include <windows.h>
-#include <winbase.h>
-#include <VersionHelpers.h>
#include <stdlib.h>
-#include <io.h>
-#include <fcntl.h>
#elif defined(XP_UNIX)
#include <sys/resource.h>
-#include <time.h>
#include <unistd.h>
#endif
-#ifdef XP_MACOSX
-#include <mach/mach_time.h>
-#include "MacQuirks.h"
-#endif
-
#include <stdio.h>
#include <stdarg.h>
#include <time.h>
@@ -35,20 +23,26 @@
#include "nsIFile.h"
#include "nsStringGlue.h"
-// Easy access to a five second startup delay used to get
-// a debugger attached in the metro environment.
-// #define DEBUG_delay_start_metro
-
#ifdef XP_WIN
-// we want a wmain entry point
-#include "nsWindowsWMain.cpp"
-#define snprintf _snprintf
+#define XRE_WANT_ENVIRON
#define strcasecmp _stricmp
+#ifdef MOZ_SANDBOX
+#include "mozilla/sandboxing/SandboxInitialization.h"
+#endif
#endif
#include "BinaryPath.h"
#include "nsXPCOMPrivate.h" // for MAXPATHLEN and XPCOM_DLL
-#include "mozilla/StartupTimeline.h"
+
+#include "mozilla/Sprintf.h"
+#include "mozilla/Telemetry.h"
+#include "mozilla/WindowsDllBlocklist.h"
+
+#if !defined(MOZ_WIDGET_COCOA) && !defined(MOZ_WIDGET_ANDROID) \
+ && !(defined(XP_LINUX) && defined(MOZ_SANDBOX))
+#define MOZ_BROWSER_CAN_BE_CONTENTPROC
+#include "../../ipc/contentproc/plugin-container.cpp"
+#endif
using namespace mozilla;
@@ -56,12 +50,6 @@ using namespace mozilla;
#define kOSXResourcesFolder "Resources"
#endif
#define kDesktopFolder "browser"
-#define kMetroFolder "metro"
-#define kMetroAppIniFilename "metroapp.ini"
-#ifdef XP_WIN
-#define kMetroTestFile "tests.ini"
-const char* kMetroConsoleIdParam = "testconsoleid=";
-#endif
static void Output(const char *fmt, ... )
{
@@ -84,10 +72,19 @@ static void Output(const char *fmt, ... )
#if MOZ_WINCONSOLE
fwprintf_s(stderr, wide_msg);
#else
- MessageBoxW(nullptr,
- wide_msg,
- L"Pale Moon",
- MB_OK | MB_ICONERROR | MB_SETFOREGROUND);
+ // Linking user32 at load-time interferes with the DLL blocklist (bug 932100).
+ // This is a rare codepath, so we can load user32 at run-time instead.
+ HMODULE user32 = LoadLibraryW(L"user32.dll");
+ if (user32) {
+ decltype(MessageBoxW)* messageBoxW =
+ (decltype(MessageBoxW)*) GetProcAddress(user32, "MessageBoxW");
+ if (messageBoxW) {
+ messageBoxW(nullptr, wide_msg, L"Pale Moon", MB_OK
+ | MB_ICONERROR
+ | MB_SETFOREGROUND);
+ }
+ FreeLibrary(user32);
+ }
#endif
#endif
@@ -114,76 +111,60 @@ static bool IsArg(const char* arg, const char* s)
return false;
}
-#ifdef XP_WIN
-/*
- * AttachToTestHarness - Windows helper for when we are running
- * in the immersive environment. Firefox is launched by Windows in
- * response to a request by metrotestharness, which is launched by
- * runtests.py. As such stdout in fx doesn't point to the right
- * stream. This helper touches up stdout such that test output gets
- * routed to a named pipe metrotestharness creates and dumps to its
- * stdout.
- */
-static void AttachToTestHarness()
-{
- // attach to the metrotestharness named logging pipe
- HANDLE winOut = CreateFileA("\\\\.\\pipe\\metrotestharness",
- GENERIC_WRITE,
- FILE_SHARE_WRITE, 0,
- OPEN_EXISTING, 0, 0);
-
- if (winOut == INVALID_HANDLE_VALUE) {
- OutputDebugStringW(L"Could not create named logging pipe.\n");
- return;
- }
-
- // Set the c runtime handle
- int stdOut = _open_osfhandle((intptr_t)winOut, _O_APPEND);
- if (stdOut == -1) {
- OutputDebugStringW(L"Could not open c-runtime handle.\n");
- return;
- }
- FILE *fp = _fdopen(stdOut, "a");
- *stdout = *fp;
-}
-#endif
-
XRE_GetFileFromPathType XRE_GetFileFromPath;
XRE_CreateAppDataType XRE_CreateAppData;
XRE_FreeAppDataType XRE_FreeAppData;
-#ifdef XRE_HAS_DLL_BLOCKLIST
-XRE_SetupDllBlocklistType XRE_SetupDllBlocklist;
-#endif
+XRE_TelemetryAccumulateType XRE_TelemetryAccumulate;
XRE_StartupTimelineRecordType XRE_StartupTimelineRecord;
XRE_mainType XRE_main;
XRE_StopLateWriteChecksType XRE_StopLateWriteChecks;
+XRE_XPCShellMainType XRE_XPCShellMain;
+XRE_GetProcessTypeType XRE_GetProcessType;
+XRE_SetProcessTypeType XRE_SetProcessType;
+XRE_InitChildProcessType XRE_InitChildProcess;
+XRE_EnableSameExecutableForContentProcType XRE_EnableSameExecutableForContentProc;
+#ifdef LIBFUZZER
+XRE_LibFuzzerSetMainType XRE_LibFuzzerSetMain;
+XRE_LibFuzzerGetFuncsType XRE_LibFuzzerGetFuncs;
+#endif
static const nsDynamicFunctionLoad kXULFuncs[] = {
{ "XRE_GetFileFromPath", (NSFuncPtr*) &XRE_GetFileFromPath },
{ "XRE_CreateAppData", (NSFuncPtr*) &XRE_CreateAppData },
{ "XRE_FreeAppData", (NSFuncPtr*) &XRE_FreeAppData },
-#ifdef XRE_HAS_DLL_BLOCKLIST
- { "XRE_SetupDllBlocklist", (NSFuncPtr*) &XRE_SetupDllBlocklist },
-#endif
+ { "XRE_TelemetryAccumulate", (NSFuncPtr*) &XRE_TelemetryAccumulate },
{ "XRE_StartupTimelineRecord", (NSFuncPtr*) &XRE_StartupTimelineRecord },
{ "XRE_main", (NSFuncPtr*) &XRE_main },
{ "XRE_StopLateWriteChecks", (NSFuncPtr*) &XRE_StopLateWriteChecks },
+ { "XRE_XPCShellMain", (NSFuncPtr*) &XRE_XPCShellMain },
+ { "XRE_GetProcessType", (NSFuncPtr*) &XRE_GetProcessType },
+ { "XRE_SetProcessType", (NSFuncPtr*) &XRE_SetProcessType },
+ { "XRE_InitChildProcess", (NSFuncPtr*) &XRE_InitChildProcess },
+ { "XRE_EnableSameExecutableForContentProc", (NSFuncPtr*) &XRE_EnableSameExecutableForContentProc },
+#ifdef LIBFUZZER
+ { "XRE_LibFuzzerSetMain", (NSFuncPtr*) &XRE_LibFuzzerSetMain },
+ { "XRE_LibFuzzerGetFuncs", (NSFuncPtr*) &XRE_LibFuzzerGetFuncs },
+#endif
{ nullptr, nullptr }
};
-static int do_main(int argc, char* argv[], nsIFile *xreDirectory)
+#ifdef LIBFUZZER
+int libfuzzer_main(int argc, char **argv);
+
+/* This wrapper is used by the libFuzzer main to call into libxul */
+
+void libFuzzerGetFuncs(const char* moduleName, LibFuzzerInitFunc* initFunc,
+ LibFuzzerTestingFunc* testingFunc) {
+ return XRE_LibFuzzerGetFuncs(moduleName, initFunc, testingFunc);
+}
+#endif
+
+static int do_main(int argc, char* argv[], char* envp[], nsIFile *xreDirectory)
{
nsCOMPtr<nsIFile> appini;
nsresult rv;
uint32_t mainFlags = 0;
-#ifdef XP_WIN
- if (!IsWindowsVistaOrGreater()) {
- Output("Couldn't load valid PE image.\n");
- return 255;
- }
-
-#endif
// Allow palemoon.exe to launch XULRunner apps via -app <application.ini>
// Note that -app must be the *first* argument.
const char *appDataFile = getenv("XUL_APP_FILE");
@@ -207,14 +188,26 @@ static int do_main(int argc, char* argv[], nsIFile *xreDirectory)
}
char appEnv[MAXPATHLEN];
- snprintf(appEnv, MAXPATHLEN, "XUL_APP_FILE=%s", argv[2]);
- if (putenv(appEnv)) {
+ SprintfLiteral(appEnv, "XUL_APP_FILE=%s", argv[2]);
+ if (putenv(strdup(appEnv))) {
Output("Couldn't set %s.\n", appEnv);
return 255;
}
argv[2] = argv[0];
argv += 2;
argc -= 2;
+ } else if (argc > 1 && IsArg(argv[1], "xpcshell")) {
+ for (int i = 1; i < argc; i++) {
+ argv[i] = argv[i + 1];
+ }
+
+ XREShellData shellData;
+#if defined(XP_WIN) && defined(MOZ_SANDBOX)
+ shellData.sandboxBrokerServices =
+ sandboxing::GetInitializedBrokerServices();
+#endif
+
+ return XRE_XPCShellMain(--argc, argv, envp, &shellData);
}
if (appini) {
@@ -224,6 +217,13 @@ static int do_main(int argc, char* argv[], nsIFile *xreDirectory)
Output("Couldn't read application.ini");
return 255;
}
+#if defined(HAS_DLL_BLOCKLIST)
+ // The dll blocklist operates in the exe vs. xullib. Pass a flag to
+ // xullib so automated tests can check the result once the browser
+ // is up and running.
+ appData->flags |=
+ DllBlocklist_CheckStatus() ? NS_XRE_DLL_BLOCKLIST_ENABLED : 0;
+#endif
// xreDirectory already has a refcount from NS_NewLocalFile
appData->xreDirectory = xreDirectory;
int result = XRE_main(argc, argv, appData, mainFlags);
@@ -231,7 +231,6 @@ static int do_main(int argc, char* argv[], nsIFile *xreDirectory)
return result;
}
- // Desktop browser launch
ScopedAppData appData(&sAppData);
nsCOMPtr<nsIFile> exeFile;
rv = mozilla::BinaryPath::GetFile(argv[0], getter_AddRefs(exeFile));
@@ -243,10 +242,7 @@ static int do_main(int argc, char* argv[], nsIFile *xreDirectory)
nsCOMPtr<nsIFile> greDir;
exeFile->GetParent(getter_AddRefs(greDir));
#ifdef XP_MACOSX
- nsCOMPtr<nsIFile> parent;
- greDir->GetParent(getter_AddRefs(parent));
- greDir = parent.forget();
- greDir->AppendNative(NS_LITERAL_CSTRING(kOSXResourcesFolder));
+ greDir->SetNativeLeafName(NS_LITERAL_CSTRING(kOSXResourcesFolder));
#endif
nsCOMPtr<nsIFile> appSubdir;
greDir->Clone(getter_AddRefs(appSubdir));
@@ -256,33 +252,29 @@ static int do_main(int argc, char* argv[], nsIFile *xreDirectory)
// xreDirectory already has a refcount from NS_NewLocalFile
appData.xreDirectory = xreDirectory;
- return XRE_main(argc, argv, &appData, mainFlags);
-}
+#if defined(HAS_DLL_BLOCKLIST)
+ appData.flags |=
+ DllBlocklist_CheckStatus() ? NS_XRE_DLL_BLOCKLIST_ENABLED : 0;
+#endif
-/**
- * Local TimeStamp::Now()-compatible implementation used to record timestamps
- * which will be passed to XRE_StartupTimelineRecord().
- */
-static uint64_t
-TimeStamp_Now()
-{
-#ifdef XP_WIN
- LARGE_INTEGER freq;
- ::QueryPerformanceFrequency(&freq);
- return GetTickCount64() * freq.QuadPart;
-#elif defined(XP_MACOSX)
- return mach_absolute_time();
-#elif defined(HAVE_CLOCK_MONOTONIC)
- struct timespec ts;
- int rv = clock_gettime(CLOCK_MONOTONIC, &ts);
-
- if (rv != 0) {
- return 0;
+#if defined(XP_WIN) && defined(MOZ_SANDBOX)
+ sandbox::BrokerServices* brokerServices =
+ sandboxing::GetInitializedBrokerServices();
+#if defined(MOZ_CONTENT_SANDBOX)
+ if (!brokerServices) {
+ Output("Couldn't initialize the broker services.\n");
+ return 255;
}
+#endif
+ appData.sandboxBrokerServices = brokerServices;
+#endif
- uint64_t baseNs = (uint64_t)ts.tv_sec * 1000000000;
- return baseNs + (uint64_t)ts.tv_nsec;
+#ifdef LIBFUZZER
+ if (getenv("LIBFUZZER"))
+ XRE_LibFuzzerSetMain(argc, argv, libfuzzer_main);
#endif
+
+ return XRE_main(argc, argv, &appData, mainFlags);
}
static bool
@@ -298,11 +290,6 @@ FileExists(const char *path)
#endif
}
-#ifdef LIBXUL_SDK
-# define XPCOM_PATH "xulrunner" XPCOM_FILE_PATH_SEPARATOR XPCOM_DLL
-#else
-# define XPCOM_PATH XPCOM_DLL
-#endif
static nsresult
InitXPCOMGlue(const char *argv0, nsIFile **xreDirectory)
{
@@ -315,55 +302,13 @@ InitXPCOMGlue(const char *argv0, nsIFile **xreDirectory)
}
char *lastSlash = strrchr(exePath, XPCOM_FILE_PATH_SEPARATOR[0]);
- if (!lastSlash || (size_t(lastSlash - exePath) > MAXPATHLEN - sizeof(XPCOM_PATH) - 1))
+ if (!lastSlash ||
+ (size_t(lastSlash - exePath) > MAXPATHLEN - sizeof(XPCOM_DLL) - 1))
return NS_ERROR_FAILURE;
- strcpy(lastSlash + 1, XPCOM_PATH);
- lastSlash += sizeof(XPCOM_PATH) - sizeof(XPCOM_DLL);
+ strcpy(lastSlash + 1, XPCOM_DLL);
if (!FileExists(exePath)) {
-#if defined(LIBXUL_SDK) && defined(XP_MACOSX)
- // Check for <bundle>/Contents/Frameworks/XUL.framework/libxpcom.dylib
- bool greFound = false;
- CFBundleRef appBundle = CFBundleGetMainBundle();
- if (!appBundle)
- return NS_ERROR_FAILURE;
- CFURLRef fwurl = CFBundleCopyPrivateFrameworksURL(appBundle);
- CFURLRef absfwurl = nullptr;
- if (fwurl) {
- absfwurl = CFURLCopyAbsoluteURL(fwurl);
- CFRelease(fwurl);
- }
- if (absfwurl) {
- CFURLRef xulurl =
- CFURLCreateCopyAppendingPathComponent(nullptr, absfwurl,
- CFSTR("XUL.framework"),
- true);
-
- if (xulurl) {
- CFURLRef xpcomurl =
- CFURLCreateCopyAppendingPathComponent(nullptr, xulurl,
- CFSTR("libxpcom.dylib"),
- false);
-
- if (xpcomurl) {
- if (CFURLGetFileSystemRepresentation(xpcomurl, true,
- (UInt8*) exePath,
- sizeof(exePath)) &&
- access(tbuffer, R_OK | X_OK) == 0) {
- if (realpath(tbuffer, exePath)) {
- greFound = true;
- }
- }
- CFRelease(xpcomurl);
- }
- CFRelease(xulurl);
- }
- CFRelease(absfwurl);
- }
- }
- if (!greFound) {
-#endif
Output("Could not find the Mozilla runtime.\n");
return NS_ERROR_FAILURE;
}
@@ -383,45 +328,72 @@ InitXPCOMGlue(const char *argv0, nsIFile **xreDirectory)
return rv;
}
+ // This will set this thread as the main thread.
NS_LogInit();
- // chop XPCOM_DLL off exePath
- *lastSlash = '\0';
+ if (xreDirectory) {
+ // chop XPCOM_DLL off exePath
+ *lastSlash = '\0';
#ifdef XP_MACOSX
- lastSlash = strrchr(exePath, XPCOM_FILE_PATH_SEPARATOR[0]);
- strcpy(lastSlash + 1, kOSXResourcesFolder);
+ lastSlash = strrchr(exePath, XPCOM_FILE_PATH_SEPARATOR[0]);
+ strcpy(lastSlash + 1, kOSXResourcesFolder);
#endif
#ifdef XP_WIN
- rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(exePath), false,
- xreDirectory);
+ rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(exePath), false,
+ xreDirectory);
#else
- rv = NS_NewNativeLocalFile(nsDependentCString(exePath), false,
- xreDirectory);
+ rv = NS_NewNativeLocalFile(nsDependentCString(exePath), false,
+ xreDirectory);
#endif
+ }
return rv;
}
-int main(int argc, char* argv[])
+int main(int argc, char* argv[], char* envp[])
{
-#ifdef DEBUG_delay_start_metro
- Sleep(5000);
+ mozilla::TimeStamp start = mozilla::TimeStamp::Now();
+
+#ifdef HAS_DLL_BLOCKLIST
+ DllBlocklist_Initialize();
+
+#ifdef DEBUG
+ // In order to be effective against AppInit DLLs, the blocklist must be
+ // initialized before user32.dll is loaded into the process (bug 932100).
+ if (GetModuleHandleA("user32.dll")) {
+ fprintf(stderr, "DLL blocklist was unable to intercept AppInit DLLs.\n");
+ }
+#endif
#endif
- uint64_t start = TimeStamp_Now();
-#ifdef XP_MACOSX
- TriggerQuirks();
+#ifdef MOZ_BROWSER_CAN_BE_CONTENTPROC
+ // We are launching as a content process, delegate to the appropriate
+ // main
+ if (argc > 1 && IsArg(argv[1], "contentproc")) {
+#if defined(XP_WIN) && defined(MOZ_SANDBOX)
+ // We need to initialize the sandbox TargetServices before InitXPCOMGlue
+ // because we might need the sandbox broker to give access to some files.
+ if (IsSandboxedProcess() && !sandboxing::GetInitializedTargetServices()) {
+ Output("Failed to initialize the sandbox target services.");
+ return 255;
+ }
#endif
- int gotCounters;
-#if defined(XP_UNIX)
- struct rusage initialRUsage;
- gotCounters = !getrusage(RUSAGE_SELF, &initialRUsage);
-#elif defined(XP_WIN)
- IO_COUNTERS ioCounters;
- gotCounters = GetProcessIoCounters(GetCurrentProcess(), &ioCounters);
+ nsresult rv = InitXPCOMGlue(argv[0], nullptr);
+ if (NS_FAILED(rv)) {
+ return 255;
+ }
+
+ int result = content_process_main(argc, argv);
+
+ // InitXPCOMGlue calls NS_LogInit, so we need to balance it here.
+ NS_LogTerm();
+
+ return result;
+ }
#endif
+
nsIFile *xreDirectory;
nsresult rv = InitXPCOMGlue(argv[0], &xreDirectory);
@@ -431,11 +403,11 @@ int main(int argc, char* argv[])
XRE_StartupTimelineRecord(mozilla::StartupTimeline::START, start);
-#ifdef XRE_HAS_DLL_BLOCKLIST
- XRE_SetupDllBlocklist();
+#ifdef MOZ_BROWSER_CAN_BE_CONTENTPROC
+ XRE_EnableSameExecutableForContentProc();
#endif
- int result = do_main(argc, argv, xreDirectory);
+ int result = do_main(argc, argv, envp, xreDirectory);
NS_LogTerm();
diff --git a/application/palemoon/app/profile/palemoon.js b/application/palemoon/app/profile/palemoon.js
index 7338a83a2f..20919eca4e 100644
--- a/application/palemoon/app/profile/palemoon.js
+++ b/application/palemoon/app/profile/palemoon.js
@@ -756,6 +756,7 @@ pref("goanna.handlerService.allowRegisterFromDifferentHost", false);
pref("browser.geolocation.warning.infoURL", "http://www.palemoon.org/info-url/geolocation.shtml");
pref("browser.mixedcontent.warning.infoURL", "http://www.palemoon.org/info-url/mixedcontent.shtml");
+pref("browser.push.warning.infoURL", "https://www.mozilla.org/%LOCALE%/firefox/push/");
pref("browser.EULA.version", 3);
pref("browser.rights.version", 3);
@@ -1036,6 +1037,9 @@ pref("browser.newtab.preload", false);
// Toggles the content of 'about:newtab'. Shows the grid when enabled.
pref("browser.newtabpage.enabled", true);
+// XXX: Remove this when "enhanced" tiles are dead
+pref("browser.newtabpage.enhanced", false);
+
// number of columns of newtab grid
pref("browser.newtabpage.columns", 4);
diff --git a/application/palemoon/base/content/abouthome/aboutHome.js b/application/palemoon/base/content/abouthome/aboutHome.js
index 9e826b69e9..6a970acd6f 100644
--- a/application/palemoon/base/content/abouthome/aboutHome.js
+++ b/application/palemoon/base/content/abouthome/aboutHome.js
@@ -234,8 +234,8 @@ const SEARCH_ENGINES = {
};
// This global tracks if the page has been set up before, to prevent double inits
-let gInitialized = false;
-let gObserver = new MutationObserver(function (mutations) {
+var gInitialized = false;
+var gObserver = new MutationObserver(function (mutations) {
for (let mutation of mutations) {
if (mutation.attributeName == "searchEngineURL") {
setupSearchEngine();
diff --git a/application/palemoon/base/content/autocomplete.css b/application/palemoon/base/content/autocomplete.css
new file mode 100644
index 0000000000..960bdc456d
--- /dev/null
+++ b/application/palemoon/base/content/autocomplete.css
@@ -0,0 +1,17 @@
+/* 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/. */
+
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+@namespace html url("http://www.w3.org/1999/xhtml");
+
+/* Apply crisp rendering for favicons at exactly 2dppx resolution */
+@media (resolution: 2dppx) {
+ .ac-site-icon {
+ image-rendering: -moz-crisp-edges;
+ }
+}
+
+richlistitem > .ac-title-box > .ac-title > .ac-comment:not([selected]) > html|span.ac-selected-text {
+ display: none;
+}
diff --git a/application/palemoon/base/content/autocomplete.xml b/application/palemoon/base/content/autocomplete.xml
new file mode 100644
index 0000000000..bd0928436f
--- /dev/null
+++ b/application/palemoon/base/content/autocomplete.xml
@@ -0,0 +1,2128 @@
+<?xml version="1.0"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+<bindings id="privateAutocompleteBindings"
+ xmlns="http://www.mozilla.org/xbl"
+ xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
+ xmlns:xbl="http://www.mozilla.org/xbl">
+
+ <binding id="private-autocomplete" role="xul:combobox"
+ extends="chrome://global/content/bindings/textbox.xml#textbox">
+ <resources>
+ <stylesheet src="chrome://browser/content/autocomplete.css"/>
+ <stylesheet src="chrome://browser/skin/autocomplete.css"/>
+ </resources>
+
+ <content sizetopopup="pref">
+ <xul:hbox class="private-autocomplete-textbox-container" flex="1" xbl:inherits="focused">
+ <children includes="image|deck|stack|box">
+ <xul:image class="private-autocomplete-icon" allowevents="true"/>
+ </children>
+
+ <xul:hbox anonid="textbox-input-box" class="textbox-input-box" flex="1" xbl:inherits="tooltiptext=inputtooltiptext">
+ <children/>
+ <html:input anonid="input" class="private-autocomplete-textbox textbox-input"
+ allowevents="true"
+ xbl:inherits="tooltiptext=inputtooltiptext,value,type=inputtype,maxlength,disabled,size,readonly,placeholder,tabindex,accesskey,mozactionhint"/>
+ </xul:hbox>
+ <children includes="hbox"/>
+ </xul:hbox>
+
+ <xul:dropmarker anonid="historydropmarker" class="private-autocomplete-history-dropmarker"
+ allowevents="true"
+ xbl:inherits="open,enablehistory,parentfocused=focused"/>
+
+ <xul:popupset anonid="popupset" class="private-autocomplete-result-popupset"/>
+
+ <children includes="toolbarbutton"/>
+ </content>
+
+ <implementation implements="nsIAutoCompleteInput, nsIDOMXULMenuListElement">
+ <field name="mController">null</field>
+ <field name="mSearchNames">null</field>
+ <field name="mIgnoreInput">false</field>
+ <field name="mEnterEvent">null</field>
+
+ <field name="_searchBeginHandler">null</field>
+ <field name="_searchCompleteHandler">null</field>
+ <field name="_textEnteredHandler">null</field>
+ <field name="_textRevertedHandler">null</field>
+
+ <constructor><![CDATA[
+ this.mController = Components.classes["@mozilla.org/autocomplete/controller;1"].
+ getService(Components.interfaces.nsIAutoCompleteController);
+
+ this._searchBeginHandler = this.initEventHandler("searchbegin");
+ this._searchCompleteHandler = this.initEventHandler("searchcomplete");
+ this._textEnteredHandler = this.initEventHandler("textentered");
+ this._textRevertedHandler = this.initEventHandler("textreverted");
+
+ // For security reasons delay searches on pasted values.
+ this.inputField.controllers.insertControllerAt(0, this._pasteController);
+ ]]></constructor>
+
+ <destructor><![CDATA[
+ this.inputField.controllers.removeController(this._pasteController);
+ ]]></destructor>
+
+ <!-- =================== nsIAutoCompleteInput =================== -->
+
+ <field name="popup"><![CDATA[
+ // Wrap in a block so that the let statements don't
+ // create properties on 'this' (bug 635252).
+ {
+ let popup = null;
+ let popupId = this.getAttribute("autocompletepopup");
+ if (popupId)
+ popup = document.getElementById(popupId);
+ if (!popup) {
+ popup = document.createElement("panel");
+ popup.setAttribute("type", "autocomplete");
+ popup.setAttribute("noautofocus", "true");
+
+ let popupset = document.getAnonymousElementByAttribute(this, "anonid", "popupset");
+ popupset.appendChild(popup);
+ }
+ popup.mInput = this;
+ popup;
+ }
+ ]]></field>
+
+ <property name="controller" onget="return this.mController;" readonly="true"/>
+
+ <property name="popupOpen"
+ onget="return this.popup.popupOpen;"
+ onset="if (val) this.openPopup(); else this.closePopup();"/>
+
+ <property name="disableAutoComplete"
+ onset="this.setAttribute('disableautocomplete', val); return val;"
+ onget="return this.getAttribute('disableautocomplete') == 'true';"/>
+
+ <property name="completeDefaultIndex"
+ onset="this.setAttribute('completedefaultindex', val); return val;"
+ onget="return this.getAttribute('completedefaultindex') == 'true';"/>
+
+ <property name="completeSelectedIndex"
+ onset="this.setAttribute('completeselectedindex', val); return val;"
+ onget="return this.getAttribute('completeselectedindex') == 'true';"/>
+
+ <property name="forceComplete"
+ onset="this.setAttribute('forcecomplete', val); return val;"
+ onget="return this.getAttribute('forcecomplete') == 'true';"/>
+
+ <property name="minResultsForPopup"
+ onset="this.setAttribute('minresultsforpopup', val); return val;"
+ onget="var m = parseInt(this.getAttribute('minresultsforpopup')); return isNaN(m) ? 1 : m;"/>
+
+ <property name="showCommentColumn"
+ onset="this.setAttribute('showcommentcolumn', val); return val;"
+ onget="return this.getAttribute('showcommentcolumn') == 'true';"/>
+
+ <property name="showImageColumn"
+ onset="this.setAttribute('showimagecolumn', val); return val;"
+ onget="return this.getAttribute('showimagecolumn') == 'true';"/>
+
+ <property name="timeout"
+ onset="this.setAttribute('timeout', val); return val;">
+ <getter><![CDATA[
+ // For security reasons delay searches on pasted values.
+ if (this._valueIsPasted) {
+ let t = parseInt(this.getAttribute('pastetimeout'));
+ return isNaN(t) ? 1000 : t;
+ }
+
+ let t = parseInt(this.getAttribute('timeout'));
+ return isNaN(t) ? 50 : t;
+ ]]></getter>
+ </property>
+
+ <property name="searchParam"
+ onget="return this.getAttribute('autocompletesearchparam') || '';"
+ onset="this.setAttribute('autocompletesearchparam', val); return val;"/>
+
+ <property name="searchCount" readonly="true"
+ onget="this.initSearchNames(); return this.mSearchNames.length;"/>
+
+ <field name="shrinkDelay" readonly="true">
+ parseInt(this.getAttribute("shrinkdelay")) || 0
+ </field>
+
+ <field name="PrivateBrowsingUtils" readonly="true">
+ {
+ let utils = {};
+ Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm", utils);
+ utils.PrivateBrowsingUtils
+ }
+ </field>
+
+ <property name="inPrivateContext" readonly="true"
+ onget="return this.PrivateBrowsingUtils.isWindowPrivate(window);"/>
+
+ <property name="noRollupOnCaretMove" readonly="true"
+ onget="return this.popup.getAttribute('norolluponanchor') == 'true'"/>
+
+ <!-- This is the maximum number of drop-down rows we get when we
+ hit the drop marker beside fields that have it (like the URLbar).-->
+ <field name="maxDropMarkerRows" readonly="true">14</field>
+
+ <method name="getSearchAt">
+ <parameter name="aIndex"/>
+ <body><![CDATA[
+ this.initSearchNames();
+ return this.mSearchNames[aIndex];
+ ]]></body>
+ </method>
+
+ <property name="textValue"
+ onget="return this.value;">
+ <setter><![CDATA[
+ // Completing a result should simulate the user typing the result,
+ // so fire an input event.
+ // Trim popup selected values, but never trim results coming from
+ // autofill.
+ if (this.popup.selectedIndex == -1)
+ this._disableTrim = true;
+ this.value = val;
+ this._disableTrim = false;
+
+ var evt = document.createEvent("UIEvents");
+ evt.initUIEvent("input", true, false, window, 0);
+ this.mIgnoreInput = true;
+ this.dispatchEvent(evt);
+ this.mIgnoreInput = false;
+ return this.value;
+ ]]></setter>
+ </property>
+
+ <method name="selectTextRange">
+ <parameter name="aStartIndex"/>
+ <parameter name="aEndIndex"/>
+ <body><![CDATA[
+ this.inputField.setSelectionRange(aStartIndex, aEndIndex);
+ ]]></body>
+ </method>
+
+ <method name="onSearchBegin">
+ <body><![CDATA[
+ if (this.popup && typeof this.popup.onSearchBegin == "function")
+ this.popup.onSearchBegin();
+ if (this._searchBeginHandler)
+ this._searchBeginHandler();
+ ]]></body>
+ </method>
+
+ <method name="onSearchComplete">
+ <body><![CDATA[
+ if (this.mController.matchCount == 0)
+ this.setAttribute("nomatch", "true");
+ else
+ this.removeAttribute("nomatch");
+
+ if (this.ignoreBlurWhileSearching && !this.focused) {
+ this.handleEnter();
+ this.detachController();
+ }
+
+ if (this._searchCompleteHandler)
+ this._searchCompleteHandler();
+ ]]></body>
+ </method>
+
+ <method name="onTextEntered">
+ <body><![CDATA[
+ let rv = false;
+ if (this._textEnteredHandler)
+ rv = this._textEnteredHandler(this.mEnterEvent);
+ this.mEnterEvent = null;
+ return rv;
+ ]]></body>
+ </method>
+
+ <method name="onTextReverted">
+ <body><![CDATA[
+ if (this._textRevertedHandler)
+ return this._textRevertedHandler();
+ return false;
+ ]]></body>
+ </method>
+
+ <!-- =================== nsIDOMXULMenuListElement =================== -->
+
+ <property name="editable" readonly="true"
+ onget="return true;" />
+
+ <property name="crop"
+ onset="this.setAttribute('crop',val); return val;"
+ onget="return this.getAttribute('crop');"/>
+
+ <property name="open"
+ onget="return this.getAttribute('open') == 'true';">
+ <setter><![CDATA[
+ if (val)
+ this.showHistoryPopup();
+ else
+ this.closePopup();
+ ]]></setter>
+ </property>
+
+ <!-- =================== PUBLIC MEMBERS =================== -->
+
+ <field name="valueIsTyped">false</field>
+ <field name="_disableTrim">false</field>
+ <property name="value">
+ <getter><![CDATA[
+ if (typeof this.onBeforeValueGet == "function") {
+ var result = this.onBeforeValueGet();
+ if (result)
+ return result.value;
+ }
+ return this.inputField.value;
+ ]]></getter>
+ <setter><![CDATA[
+ this.mIgnoreInput = true;
+
+ if (typeof this.onBeforeValueSet == "function")
+ val = this.onBeforeValueSet(val);
+
+ if (typeof this.trimValue == "function" && !this._disableTrim)
+ val = this.trimValue(val);
+
+ this.valueIsTyped = false;
+ this.inputField.value = val;
+
+ if (typeof this.formatValue == "function")
+ this.formatValue();
+
+ this.mIgnoreInput = false;
+ var event = document.createEvent('Events');
+ event.initEvent('ValueChange', true, true);
+ this.inputField.dispatchEvent(event);
+ return val;
+ ]]></setter>
+ </property>
+
+ <property name="focused" readonly="true"
+ onget="return this.getAttribute('focused') == 'true';"/>
+
+ <!-- maximum number of rows to display at a time -->
+ <property name="maxRows"
+ onset="this.setAttribute('maxrows', val); return val;"
+ onget="return parseInt(this.getAttribute('maxrows')) || 0;"/>
+
+ <!-- option to allow scrolling through the list via the tab key, rather than
+ tab moving focus out of the textbox -->
+ <property name="tabScrolling"
+ onset="this.setAttribute('tabscrolling', val); return val;"
+ onget="return this.getAttribute('tabscrolling') == 'true';"/>
+
+ <!-- option to completely ignore any blur events while searches are
+ still going on. -->
+ <property name="ignoreBlurWhileSearching"
+ onset="this.setAttribute('ignoreblurwhilesearching', val); return val;"
+ onget="return this.getAttribute('ignoreblurwhilesearching') == 'true';"/>
+
+ <!-- disable key navigation handling in the popup results -->
+ <property name="disableKeyNavigation"
+ onset="this.setAttribute('disablekeynavigation', val); return val;"
+ onget="return this.getAttribute('disablekeynavigation') == 'true';"/>
+
+ <!-- option to highlight entries that don't have any matches -->
+ <property name="highlightNonMatches"
+ onset="this.setAttribute('highlightnonmatches', val); return val;"
+ onget="return this.getAttribute('highlightnonmatches') == 'true';"/>
+
+ <!-- =================== PRIVATE MEMBERS =================== -->
+
+ <!-- ::::::::::::: autocomplete controller ::::::::::::: -->
+
+ <method name="attachController">
+ <body><![CDATA[
+ this.mController.input = this;
+ ]]></body>
+ </method>
+
+ <method name="detachController">
+ <body><![CDATA[
+ if (this.mController.input == this)
+ this.mController.input = null;
+ ]]></body>
+ </method>
+
+ <!-- ::::::::::::: popup opening ::::::::::::: -->
+
+ <method name="openPopup">
+ <body><![CDATA[
+ if (this.focused)
+ this.popup.openAutocompletePopup(this, this);
+ ]]></body>
+ </method>
+
+ <method name="closePopup">
+ <body><![CDATA[
+ this.popup.closePopup();
+ ]]></body>
+ </method>
+
+ <method name="showHistoryPopup">
+ <body><![CDATA[
+ // history dropmarker pushed state
+ function cleanup(popup) {
+ popup.removeEventListener("popupshowing", onShow, false);
+ }
+ function onShow(event) {
+ var popup = event.target, input = popup.input;
+ cleanup(popup);
+ input.setAttribute("open", "true");
+ function onHide() {
+ input.removeAttribute("open");
+ popup.removeEventListener("popuphiding", onHide, false);
+ }
+ popup.addEventListener("popuphiding", onHide, false);
+ }
+ this.popup.addEventListener("popupshowing", onShow, false);
+ setTimeout(cleanup, 1000, this.popup);
+
+ // Store our "normal" maxRows on the popup, so that it can reset the
+ // value when the popup is hidden.
+ this.popup._normalMaxRows = this.maxRows;
+
+ // Increase our maxRows temporarily, since we want the dropdown to
+ // be bigger in this case. The popup's popupshowing/popuphiding
+ // handlers will take care of resetting this.
+ this.maxRows = this.maxDropMarkerRows;
+
+ // Ensure that we have focus.
+ if (!this.focused)
+ this.focus();
+ this.attachController();
+ this.mController.startSearch("");
+ ]]></body>
+ </method>
+
+ <method name="toggleHistoryPopup">
+ <body><![CDATA[
+ // If this method is called on the same event tick as the popup gets
+ // hidden, do nothing to avoid re-opening the popup when the drop
+ // marker is clicked while the popup is still open.
+ if (!this.popup.isPopupHidingTick && !this.popup.popupOpen)
+ this.showHistoryPopup();
+ else
+ this.closePopup();
+ ]]></body>
+ </method>
+
+ <!-- ::::::::::::: event dispatching ::::::::::::: -->
+
+ <method name="initEventHandler">
+ <parameter name="aEventType"/>
+ <body><![CDATA[
+ let handlerString = this.getAttribute("on" + aEventType);
+ if (handlerString) {
+ return (new Function("eventType", "param", handlerString)).bind(this, aEventType);
+ }
+ return null;
+ ]]></body>
+ </method>
+
+ <!-- ::::::::::::: key handling ::::::::::::: -->
+
+ <field name="_selectionDetails">null</field>
+ <method name="onKeyPress">
+ <parameter name="aEvent"/>
+ <body><![CDATA[
+ return this.handleKeyPress(aEvent);
+ ]]></body>
+ </method>
+
+ <method name="handleKeyPress">
+ <parameter name="aEvent"/>
+ <body><![CDATA[
+ if (aEvent.target.localName != "textbox")
+ return true; // Let child buttons of autocomplete take input
+
+ //XXXpch this is so bogus...
+ if (aEvent.defaultPrevented)
+ return false;
+
+ var cancel = false;
+
+ let { AppConstants } =
+ Components.utils.import("resource://gre/modules/AppConstants.jsm", {});
+ // Catch any keys that could potentially move the caret. Ctrl can be
+ // used in combination with these keys on Windows and Linux; and Alt
+ // can be used on OS X, so make sure the unused one isn't used.
+ let metaKey = AppConstants.platform == "macosx" ? aEvent.ctrlKey : aEvent.altKey;
+ if (!this.disableKeyNavigation && !metaKey) {
+ switch (aEvent.keyCode) {
+ case KeyEvent.DOM_VK_LEFT:
+ case KeyEvent.DOM_VK_RIGHT:
+ case KeyEvent.DOM_VK_HOME:
+ cancel = this.mController.handleKeyNavigation(aEvent.keyCode);
+ break;
+ }
+ }
+
+ // Handle keys that are not part of a keyboard shortcut (no Ctrl or Alt)
+ if (!this.disableKeyNavigation && !aEvent.ctrlKey && !aEvent.altKey) {
+ switch (aEvent.keyCode) {
+ case KeyEvent.DOM_VK_TAB:
+ if (this.tabScrolling && this.popup.popupOpen)
+ cancel = this.mController.handleKeyNavigation(aEvent.shiftKey ?
+ KeyEvent.DOM_VK_UP :
+ KeyEvent.DOM_VK_DOWN);
+ else if (this.forceComplete && this.mController.matchCount >= 1)
+ this.mController.handleTab();
+ break;
+ case KeyEvent.DOM_VK_UP:
+ case KeyEvent.DOM_VK_DOWN:
+ case KeyEvent.DOM_VK_PAGE_UP:
+ case KeyEvent.DOM_VK_PAGE_DOWN:
+ cancel = this.mController.handleKeyNavigation(aEvent.keyCode);
+ break;
+ }
+ }
+
+ // Handle keys we know aren't part of a shortcut, even with Alt or
+ // Ctrl.
+ switch (aEvent.keyCode) {
+ case KeyEvent.DOM_VK_ESCAPE:
+ cancel = this.mController.handleEscape();
+ break;
+ case KeyEvent.DOM_VK_RETURN:
+ if (AppConstants.platform == "macosx") {
+ // Prevent the default action, since it will beep on Mac
+ if (aEvent.metaKey)
+ aEvent.preventDefault();
+ }
+ this.mEnterEvent = aEvent;
+ if (this.mController.selection) {
+ this._selectionDetails = {
+ index: this.mController.selection.currentIndex,
+ kind: "key"
+ };
+ }
+ cancel = this.handleEnter();
+ break;
+ case KeyEvent.DOM_VK_DELETE:
+ if (AppConstants.platform == "macosx" && !aEvent.shiftKey) {
+ break;
+ }
+ cancel = this.handleDelete();
+ break;
+ case KeyEvent.DOM_VK_BACK_SPACE:
+ if (AppConstants.platform == "macosx" && aEvent.shiftKey) {
+ cancel = this.handleDelete();
+ }
+ break;
+ case KeyEvent.DOM_VK_DOWN:
+ case KeyEvent.DOM_VK_UP:
+ if (aEvent.altKey)
+ this.toggleHistoryPopup();
+ break;
+ case KeyEvent.DOM_VK_F4:
+ if (AppConstants.platform != "macosx") {
+ this.toggleHistoryPopup();
+ }
+ break;
+ }
+
+ if (cancel) {
+ aEvent.stopPropagation();
+ aEvent.preventDefault();
+ }
+
+ return true;
+ ]]></body>
+ </method>
+
+ <method name="handleEnter">
+ <body><![CDATA[
+ return this.mController.handleEnter(false);
+ ]]></body>
+ </method>
+
+ <method name="handleDelete">
+ <body><![CDATA[
+ return this.mController.handleDelete();
+ ]]></body>
+ </method>
+
+ <!-- ::::::::::::: miscellaneous ::::::::::::: -->
+
+ <method name="initSearchNames">
+ <body><![CDATA[
+ if (!this.mSearchNames) {
+ var names = this.getAttribute("autocompletesearch");
+ if (!names)
+ this.mSearchNames = [];
+ else
+ this.mSearchNames = names.split(" ");
+ }
+ ]]></body>
+ </method>
+
+ <method name="_focus">
+ <!-- doesn't reset this.mController -->
+ <body><![CDATA[
+ this._dontBlur = true;
+ this.focus();
+ this._dontBlur = false;
+ ]]></body>
+ </method>
+
+ <method name="resetActionType">
+ <body><![CDATA[
+ if (this.mIgnoreInput)
+ return;
+ this.removeAttribute("actiontype");
+ ]]></body>
+ </method>
+
+ <field name="_valueIsPasted">false</field>
+ <field name="_pasteController"><![CDATA[
+ ({
+ _autocomplete: this,
+ _kGlobalClipboard: Components.interfaces.nsIClipboard.kGlobalClipboard,
+ supportsCommand: aCommand => aCommand == "cmd_paste",
+ doCommand: function(aCommand) {
+ this._autocomplete._valueIsPasted = true;
+ this._autocomplete.editor.paste(this._kGlobalClipboard);
+ this._autocomplete._valueIsPasted = false;
+ },
+ isCommandEnabled: function(aCommand) {
+ return this._autocomplete.editor.isSelectionEditable &&
+ this._autocomplete.editor.canPaste(this._kGlobalClipboard);
+ },
+ onEvent: function() {}
+ })
+ ]]></field>
+
+ <method name="onInput">
+ <parameter name="aEvent"/>
+ <body><![CDATA[
+ if (!this.mIgnoreInput && this.mController.input == this) {
+ this.valueIsTyped = true;
+ this.mController.handleText();
+ }
+ this.resetActionType();
+ ]]></body>
+ </method>
+ </implementation>
+
+ <handlers>
+ <handler event="input"><![CDATA[
+ this.onInput(event);
+ ]]></handler>
+
+ <handler event="keypress" phase="capturing"
+ action="return this.onKeyPress(event);"/>
+
+ <handler event="compositionstart" phase="capturing"
+ action="if (this.mController.input == this) this.mController.handleStartComposition();"/>
+
+ <handler event="compositionend" phase="capturing"
+ action="if (this.mController.input == this) this.mController.handleEndComposition();"/>
+
+ <handler event="focus" phase="capturing"
+ action="this.attachController();"/>
+
+ <handler event="blur" phase="capturing"><![CDATA[
+ if (!this._dontBlur) {
+ if (this.forceComplete && this.mController.matchCount >= 1) {
+ // mousemove sets selected index. Don't blindly use that selected
+ // index in this blur handler since if the popup is open you can
+ // easily "select" another match just by moving the mouse over it.
+ let filledVal = this.value.replace(/.+ >> /, "").toLowerCase();
+ let selectedVal = null;
+ if (this.popup.selectedIndex >= 0) {
+ selectedVal = this.mController.getFinalCompleteValueAt(
+ this.popup.selectedIndex);
+ }
+ if (selectedVal && filledVal != selectedVal.toLowerCase()) {
+ for (let i = 0; i < this.mController.matchCount; i++) {
+ let matchVal = this.mController.getFinalCompleteValueAt(i);
+ if (matchVal.toLowerCase() == filledVal) {
+ this.popup.selectedIndex = i;
+ break;
+ }
+ }
+ }
+ this.mController.handleEnter(false);
+ }
+ if (!this.ignoreBlurWhileSearching)
+ this.detachController();
+ }
+ ]]></handler>
+ </handlers>
+ </binding>
+
+ <binding id="private-autocomplete-result-popup" extends="chrome://browser/content/autocomplete.xml#private-autocomplete-base-popup">
+ <resources>
+ <stylesheet src="chrome://browser/content/autocomplete.css"/>
+ <stylesheet src="chrome://global/skin/tree.css"/>
+ <stylesheet src="chrome://browser/skin/autocomplete.css"/>
+ </resources>
+
+ <content ignorekeys="true" level="top" consumeoutsideclicks="never">
+ <xul:tree anonid="tree" class="private-autocomplete-tree plain" hidecolumnpicker="true" flex="1" seltype="single">
+ <xul:treecols anonid="treecols">
+ <xul:treecol id="treecolAutoCompleteValue" class="private-autocomplete-treecol" flex="1" overflow="true"/>
+ </xul:treecols>
+ <xul:treechildren class="private-autocomplete-treebody"/>
+ </xul:tree>
+ </content>
+
+ <implementation>
+ <field name="mShowCommentColumn">false</field>
+ <field name="mShowImageColumn">false</field>
+
+ <property name="showCommentColumn"
+ onget="return this.mShowCommentColumn;">
+ <setter>
+ <![CDATA[
+ if (!val && this.mShowCommentColumn) {
+ // reset the flex on the value column and remove the comment column
+ document.getElementById("treecolAutoCompleteValue").setAttribute("flex", 1);
+ this.removeColumn("treecolAutoCompleteComment");
+ } else if (val && !this.mShowCommentColumn) {
+ // reset the flex on the value column and add the comment column
+ document.getElementById("treecolAutoCompleteValue").setAttribute("flex", 2);
+ this.addColumn({id: "treecolAutoCompleteComment", flex: 1});
+ }
+ this.mShowCommentColumn = val;
+ return val;
+ ]]>
+ </setter>
+ </property>
+
+ <property name="showImageColumn"
+ onget="return this.mShowImageColumn;">
+ <setter>
+ <![CDATA[
+ if (!val && this.mShowImageColumn) {
+ // remove the image column
+ this.removeColumn("treecolAutoCompleteImage");
+ } else if (val && !this.mShowImageColumn) {
+ // add the image column
+ this.addColumn({id: "treecolAutoCompleteImage", flex: 1});
+ }
+ this.mShowImageColumn = val;
+ return val;
+ ]]>
+ </setter>
+ </property>
+
+
+ <method name="addColumn">
+ <parameter name="aAttrs"/>
+ <body>
+ <![CDATA[
+ var col = document.createElement("treecol");
+ col.setAttribute("class", "private-autocomplete-treecol");
+ for (var name in aAttrs)
+ col.setAttribute(name, aAttrs[name]);
+ this.treecols.appendChild(col);
+ return col;
+ ]]>
+ </body>
+ </method>
+
+ <method name="removeColumn">
+ <parameter name="aColId"/>
+ <body>
+ <![CDATA[
+ return this.treecols.removeChild(document.getElementById(aColId));
+ ]]>
+ </body>
+ </method>
+
+ <property name="selectedIndex"
+ onget="return this.tree.currentIndex;">
+ <setter>
+ <![CDATA[
+ this.tree.view.selection.select(val);
+ if (this.tree.treeBoxObject.height > 0)
+ this.tree.treeBoxObject.ensureRowIsVisible(val < 0 ? 0 : val);
+ // Fire select event on xul:tree so that accessibility API
+ // support layer can fire appropriate accessibility events.
+ var event = document.createEvent('Events');
+ event.initEvent("select", true, true);
+ this.tree.dispatchEvent(event);
+ return val;
+ ]]></setter>
+ </property>
+
+ <method name="adjustHeight">
+ <body>
+ <![CDATA[
+ // detect the desired height of the tree
+ var bx = this.tree.treeBoxObject;
+ var view = this.tree.view;
+ if (!view)
+ return;
+ var rows = this.maxRows;
+ if (!view.rowCount || (rows && view.rowCount < rows))
+ rows = view.rowCount;
+
+ var height = rows * bx.rowHeight;
+
+ if (height == 0) {
+ this.tree.setAttribute("collapsed", "true");
+ } else {
+ if (this.tree.hasAttribute("collapsed"))
+ this.tree.removeAttribute("collapsed");
+
+ this.tree.setAttribute("height", height);
+ }
+ this.tree.setAttribute("hidescrollbar", view.rowCount <= rows);
+ ]]>
+ </body>
+ </method>
+
+ <method name="openAutocompletePopup">
+ <parameter name="aInput"/>
+ <parameter name="aElement"/>
+ <body><![CDATA[
+ // until we have "baseBinding", (see bug #373652) this allows
+ // us to override openAutocompletePopup(), but still call
+ // the method on the base class
+ this._openAutocompletePopup(aInput, aElement);
+ ]]></body>
+ </method>
+
+ <method name="_openAutocompletePopup">
+ <parameter name="aInput"/>
+ <parameter name="aElement"/>
+ <body><![CDATA[
+ if (!this.mPopupOpen) {
+ this.mInput = aInput;
+ this.view = aInput.controller.QueryInterface(Components.interfaces.nsITreeView);
+ this.invalidate();
+
+ this.showCommentColumn = this.mInput.showCommentColumn;
+ this.showImageColumn = this.mInput.showImageColumn;
+
+ var rect = aElement.getBoundingClientRect();
+ var nav = aElement.ownerDocument.defaultView.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
+ .getInterface(Components.interfaces.nsIWebNavigation);
+ var docShell = nav.QueryInterface(Components.interfaces.nsIDocShell);
+ var docViewer = docShell.contentViewer;
+ var width = (rect.right - rect.left) * docViewer.fullZoom;
+ this.setAttribute("width", width > 100 ? width : 100);
+
+ // Adjust the direction of the autocomplete popup list based on the textbox direction, bug 649840
+ var popupDirection = aElement.ownerDocument.defaultView.getComputedStyle(aElement).direction;
+ this.style.direction = popupDirection;
+
+ this.openPopup(aElement, "after_start", 0, 0, false, false);
+ }
+ ]]></body>
+ </method>
+
+ <method name="invalidate">
+ <body><![CDATA[
+ this.adjustHeight();
+ this.tree.treeBoxObject.invalidate();
+ ]]></body>
+ </method>
+
+ <method name="selectBy">
+ <parameter name="aReverse"/>
+ <parameter name="aPage"/>
+ <body><![CDATA[
+ try {
+ var amount = aPage ? 5 : 1;
+ this.selectedIndex = this.getNextIndex(aReverse, amount, this.selectedIndex, this.tree.view.rowCount-1);
+ if (this.selectedIndex == -1) {
+ this.input._focus();
+ }
+ } catch (ex) {
+ // do nothing - occasionally timer-related js errors happen here
+ // e.g. "this.selectedIndex has no properties", when you type fast and hit a
+ // navigation key before this popup has opened
+ }
+ ]]></body>
+ </method>
+
+ <!-- =================== PUBLIC MEMBERS =================== -->
+
+ <field name="tree">
+ document.getAnonymousElementByAttribute(this, "anonid", "tree");
+ </field>
+
+ <field name="treecols">
+ document.getAnonymousElementByAttribute(this, "anonid", "treecols");
+ </field>
+
+ <property name="view"
+ onget="return this.mView;">
+ <setter><![CDATA[
+ // We must do this by hand because the tree binding may not be ready yet
+ this.mView = val;
+ this.tree.boxObject.view = val;
+ ]]></setter>
+ </property>
+
+ </implementation>
+ </binding>
+
+ <binding id="private-autocomplete-base-popup" role="none"
+extends="chrome://global/content/bindings/popup.xml#popup">
+ <implementation implements="nsIAutoCompletePopup">
+ <field name="mInput">null</field>
+ <field name="mPopupOpen">false</field>
+ <field name="mIsPopupHidingTick">false</field>
+
+ <!-- =================== nsIAutoCompletePopup =================== -->
+
+ <property name="input" readonly="true"
+ onget="return this.mInput"/>
+
+ <property name="overrideValue" readonly="true"
+ onget="return null;"/>
+
+ <property name="popupOpen" readonly="true"
+ onget="return this.mPopupOpen;"/>
+
+ <property name="isPopupHidingTick" readonly="true"
+ onget="return this.mIsPopupHidingTick;"/>
+
+ <method name="closePopup">
+ <body>
+ <![CDATA[
+ if (this.mPopupOpen) {
+ this.hidePopup();
+ this.removeAttribute("width");
+ }
+ ]]>
+ </body>
+ </method>
+
+ <!-- This is the default number of rows that we give the autocomplete
+ popup when the textbox doesn't have a "maxrows" attribute
+ for us to use. -->
+ <field name="defaultMaxRows" readonly="true">6</field>
+
+ <!-- In some cases (e.g. when the input's dropmarker button is clicked),
+ the input wants to display a popup with more rows. In that case, it
+ should increase its maxRows property and store the "normal" maxRows
+ in this field. When the popup is hidden, we restore the input's
+ maxRows to the value stored in this field.
+
+ This field is set to -1 between uses so that we can tell when it's
+ been set by the input and when we need to set it in the popupshowing
+ handler. -->
+ <field name="_normalMaxRows">-1</field>
+
+ <property name="maxRows" readonly="true">
+ <getter>
+ <![CDATA[
+ return (this.mInput && this.mInput.maxRows) || this.defaultMaxRows;
+ ]]>
+ </getter>
+ </property>
+
+ <method name="getNextIndex">
+ <parameter name="aReverse"/>
+ <parameter name="aAmount"/>
+ <parameter name="aIndex"/>
+ <parameter name="aMaxRow"/>
+ <body><![CDATA[
+ if (aMaxRow < 0)
+ return -1;
+
+ var newIdx = aIndex + (aReverse?-1:1)*aAmount;
+ if (aReverse && aIndex == -1 || newIdx > aMaxRow && aIndex != aMaxRow)
+ newIdx = aMaxRow;
+ else if (!aReverse && aIndex == -1 || newIdx < 0 && aIndex != 0)
+ newIdx = 0;
+
+ if (newIdx < 0 && aIndex == 0 || newIdx > aMaxRow && aIndex == aMaxRow)
+ aIndex = -1;
+ else
+ aIndex = newIdx;
+
+ return aIndex;
+ ]]></body>
+ </method>
+
+ <method name="onPopupClick">
+ <parameter name="aEvent"/>
+ <body><![CDATA[
+ var controller = this.view.QueryInterface(Components.interfaces.nsIAutoCompleteController);
+ controller.handleEnter(true);
+ ]]></body>
+ </method>
+ </implementation>
+
+ <handlers>
+ <handler event="popupshowing"><![CDATA[
+ // If normalMaxRows wasn't already set by the input, then set it here
+ // so that we restore the correct number when the popup is hidden.
+
+ // Null-check this.mInput; see bug 1017914
+ if (this._normalMaxRows < 0 && this.mInput) {
+ this._normalMaxRows = this.mInput.maxRows;
+ }
+
+ // Set an attribute for styling the popup based on the input.
+ let inputID = "";
+ if (this.mInput && this.mInput.ownerDocument &&
+ this.mInput.ownerDocument.documentURIObject.schemeIs("chrome")) {
+ inputID = this.mInput.id;
+ // Take care of elements with no id that are inside xbl bindings
+ if (!inputID) {
+ let bindingParent = this.mInput.ownerDocument.getBindingParent(this.mInput);
+ if (bindingParent) {
+ inputID = bindingParent.id;
+ }
+ }
+ }
+ this.setAttribute("autocompleteinput", inputID);
+
+ this.mPopupOpen = true;
+ ]]></handler>
+
+ <handler event="popuphiding"><![CDATA[
+ var isListActive = true;
+ if (this.selectedIndex == -1)
+ isListActive = false;
+ var controller = this.view.QueryInterface(Components.interfaces.nsIAutoCompleteController);
+ controller.stopSearch();
+
+ this.removeAttribute("autocompleteinput");
+ this.mPopupOpen = false;
+
+ // Prevent opening popup from historydropmarker mousedown handler
+ // on the same event tick the popup is hidden by the same mousedown
+ // event.
+ this.mIsPopupHidingTick = true;
+ setTimeout(() => {
+ this.mIsPopupHidingTick = false;
+ }, 0);
+
+ // Reset the maxRows property to the cached "normal" value, and reset
+ // _normalMaxRows so that we can detect whether it was set by the input
+ // when the popupshowing handler runs.
+
+ // Null-check this.mInput; see bug 1017914
+ if (this.mInput)
+ this.mInput.maxRows = this._normalMaxRows;
+ this._normalMaxRows = -1;
+ // If the list was being navigated and then closed, make sure
+ // we fire accessible focus event back to textbox
+
+ // Null-check this.mInput; see bug 1017914
+ if (isListActive && this.mInput) {
+ this.mInput.mIgnoreFocus = true;
+ this.mInput._focus();
+ this.mInput.mIgnoreFocus = false;
+ }
+ ]]></handler>
+ </handlers>
+ </binding>
+
+ <binding id="private-autocomplete-rich-result-popup" extends="chrome://browser/content/autocomplete.xml#private-autocomplete-base-popup">
+ <resources>
+ <stylesheet src="chrome://browser/content/autocomplete.css"/>
+ <stylesheet src="chrome://browser/skin/autocomplete.css"/>
+ </resources>
+
+ <content ignorekeys="true" level="top" consumeoutsideclicks="never">
+ <xul:richlistbox anonid="richlistbox" class="private-autocomplete-richlistbox" flex="1"/>
+ <xul:hbox>
+ <children/>
+ </xul:hbox>
+ </content>
+
+ <implementation implements="nsIAutoCompletePopup">
+ <field name="_currentIndex">0</field>
+ <field name="_rowHeight">0</field>
+ <field name="_rlbAnimated">false</field>
+
+ <!-- =================== nsIAutoCompletePopup =================== -->
+
+ <property name="selectedIndex"
+ onget="return this.richlistbox.selectedIndex;">
+ <setter>
+ <![CDATA[
+ this.richlistbox.selectedIndex = val;
+
+ // when clearing the selection (val == -1, so selectedItem will be
+ // null), we want to scroll back to the top. see bug #406194
+ this.richlistbox.ensureElementIsVisible(
+ this.richlistbox.selectedItem || this.richlistbox.firstChild);
+
+ return val;
+ ]]>
+ </setter>
+ </property>
+
+ <method name="onSearchBegin">
+ <body><![CDATA[
+ this.richlistbox.mouseSelectedIndex = -1;
+ ]]></body>
+ </method>
+
+ <method name="openAutocompletePopup">
+ <parameter name="aInput"/>
+ <parameter name="aElement"/>
+ <body>
+ <![CDATA[
+ // until we have "baseBinding", (see bug #373652) this allows
+ // us to override openAutocompletePopup(), but still call
+ // the method on the base class
+ this._openAutocompletePopup(aInput, aElement);
+ ]]>
+ </body>
+ </method>
+
+ <method name="_openAutocompletePopup">
+ <parameter name="aInput"/>
+ <parameter name="aElement"/>
+ <body>
+ <![CDATA[
+ if (!this.mPopupOpen) {
+ this.mInput = aInput;
+ // clear any previous selection, see bugs 400671 and 488357
+ this.selectedIndex = -1;
+
+ var width = aElement.getBoundingClientRect().width;
+ this.setAttribute("width", width > 100 ? width : 100);
+ // invalidate() depends on the width attribute
+ this._invalidate();
+
+ this.openPopup(aElement, "after_start", 0, 0, false, false);
+ }
+ ]]>
+ </body>
+ </method>
+
+ <method name="invalidate">
+ <parameter name="reason"/>
+ <body>
+ <![CDATA[
+ // Don't bother doing work if we're not even showing
+ if (!this.mPopupOpen)
+ return;
+
+ this._invalidate(reason);
+ ]]>
+ </body>
+ </method>
+
+ <method name="_invalidate">
+ <parameter name="reason"/>
+ <body>
+ <![CDATA[
+ // collapsed if no matches
+ this.richlistbox.collapsed = (this._matchCount == 0);
+
+ // Update the richlistbox height.
+ if (this._adjustHeightTimeout) {
+ clearTimeout(this._adjustHeightTimeout);
+ }
+ if (this._shrinkTimeout) {
+ clearTimeout(this._shrinkTimeout);
+ }
+ this._adjustHeightTimeout = setTimeout(() => this.adjustHeight(), 0);
+
+ this._currentIndex = 0;
+ if (this._appendResultTimeout) {
+ clearTimeout(this._appendResultTimeout);
+ }
+ this._appendCurrentResult(reason);
+ ]]>
+ </body>
+ </method>
+
+ <property name="maxResults" readonly="true">
+ <getter>
+ <![CDATA[
+ // this is how many richlistitems will be kept around
+ // (note, this getter may be overridden)
+ return 20;
+ ]]>
+ </getter>
+ </property>
+
+ <property name="_matchCount" readonly="true">
+ <getter>
+ <![CDATA[
+ return Math.min(this.mInput.controller.matchCount, this.maxResults);
+ ]]>
+ </getter>
+ </property>
+
+ <method name="_collapseUnusedItems">
+ <body>
+ <![CDATA[
+ let existingItemsCount = this.richlistbox.childNodes.length;
+ for (let i = this._matchCount; i < existingItemsCount; ++i) {
+ this.richlistbox.childNodes[i].collapsed = true;
+ }
+ ]]>
+ </body>
+ </method>
+
+ <method name="adjustHeight">
+ <body>
+ <![CDATA[
+ // Figure out how many rows to show
+ let rows = this.richlistbox.childNodes;
+ let numRows = Math.min(this._matchCount, this.maxRows, rows.length);
+
+ this.removeAttribute("height");
+
+ // Default the height to 0 if we have no rows to show
+ let height = 0;
+ if (numRows) {
+ if (!this._rowHeight) {
+ let firstRowRect = rows[0].getBoundingClientRect();
+ this._rowHeight = firstRowRect.height;
+
+ let transition =
+ window.getComputedStyle(this.richlistbox).transitionProperty;
+ this._rlbAnimated = transition && transition != "none";
+
+ // Set a fixed max-height to avoid flicker when growing the panel.
+ this.richlistbox.style.maxHeight = (this._rowHeight * this.maxRows) + "px";
+ }
+
+ // Calculate the height to have the first row to last row shown
+ height = this._rowHeight * numRows;
+ }
+
+ let animate = this._rlbAnimated &&
+ this.getAttribute("dontanimate") != "true";
+ let currentHeight = this.richlistbox.getBoundingClientRect().height;
+ if (height > currentHeight) {
+ // Grow immediately.
+ if (animate) {
+ this.richlistbox.removeAttribute("height");
+ this.richlistbox.style.height = height + "px";
+ } else {
+ this.richlistbox.style.removeProperty("height");
+ this.richlistbox.height = height;
+ }
+ } else {
+ // Delay shrinking to avoid flicker.
+ this._shrinkTimeout = setTimeout(() => {
+ this._collapseUnusedItems();
+ if (animate) {
+ this.richlistbox.removeAttribute("height");
+ this.richlistbox.style.height = height + "px";
+ } else {
+ this.richlistbox.style.removeProperty("height");
+ this.richlistbox.height = height;
+ }
+ }, this.mInput.shrinkDelay);
+ }
+ ]]>
+ </body>
+ </method>
+
+ <method name="_appendCurrentResult">
+ <parameter name="invalidateReason"/>
+ <body>
+ <![CDATA[
+ var controller = this.mInput.controller;
+ var matchCount = this._matchCount;
+ var existingItemsCount = this.richlistbox.childNodes.length;
+
+ // Process maxRows per chunk to improve performance and user experience
+ for (let i = 0; i < this.maxRows; i++) {
+ if (this._currentIndex >= matchCount)
+ break;
+
+ var item;
+
+ // trim the leading/trailing whitespace
+ var trimmedSearchString = controller.searchString.replace(/^\s+/, "").replace(/\s+$/, "");
+
+ let url = controller.getValueAt(this._currentIndex);
+
+ if (this._currentIndex < existingItemsCount) {
+ // re-use the existing item
+ item = this.richlistbox.childNodes[this._currentIndex];
+
+ // Completely reuse the existing richlistitem for invalidation
+ // due to new results, but only when: the item is the same, *OR*
+ // we are about to replace the currently mouse-selected item, to
+ // avoid surprising the user.
+ let iface = Components.interfaces.nsIAutoCompletePopup;
+ if (item.getAttribute("text") == trimmedSearchString &&
+ invalidateReason == iface.INVALIDATE_REASON_NEW_RESULT &&
+ (item.getAttribute("url") == url ||
+ this.richlistbox.mouseSelectedIndex === this._currentIndex)) {
+ item.collapsed = false;
+ this._currentIndex++;
+ continue;
+ }
+ }
+ else {
+ // need to create a new item
+ item = document.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul", "richlistitem");
+ }
+
+ // set these attributes before we set the class
+ // so that we can use them from the constructor
+ let iconURI = controller.getImageAt(this._currentIndex);
+ item.setAttribute("image", iconURI);
+ item.setAttribute("url", url);
+ item.setAttribute("title", controller.getCommentAt(this._currentIndex));
+ item.setAttribute("type", controller.getStyleAt(this._currentIndex));
+ item.setAttribute("text", trimmedSearchString);
+
+ if (this._currentIndex < existingItemsCount) {
+ // re-use the existing item
+ item._adjustAcItem();
+ item.collapsed = false;
+ }
+ else {
+ // set the class at the end so we can use the attributes
+ // in the xbl constructor
+ item.className = "private-autocomplete-richlistitem";
+ this.richlistbox.appendChild(item);
+ }
+
+ this._currentIndex++;
+ }
+
+ if (typeof this.onResultsAdded == "function")
+ this.onResultsAdded();
+
+ if (this._currentIndex < matchCount) {
+ // yield after each batch of items so that typing the url bar is
+ // responsive
+ this._appendResultTimeout = setTimeout(() => this._appendCurrentResult(), 0);
+ }
+ ]]>
+ </body>
+ </method>
+
+ <method name="selectBy">
+ <parameter name="aReverse"/>
+ <parameter name="aPage"/>
+ <body>
+ <![CDATA[
+ try {
+ var amount = aPage ? 5 : 1;
+
+ // because we collapsed unused items, we can't use this.richlistbox.getRowCount(), we need to use the matchCount
+ this.selectedIndex = this.getNextIndex(aReverse, amount, this.selectedIndex, this._matchCount - 1);
+ if (this.selectedIndex == -1) {
+ this.input._focus();
+ }
+ } catch (ex) {
+ // do nothing - occasionally timer-related js errors happen here
+ // e.g. "this.selectedIndex has no properties", when you type fast and hit a
+ // navigation key before this popup has opened
+ }
+ ]]>
+ </body>
+ </method>
+
+ <field name="richlistbox">
+ document.getAnonymousElementByAttribute(this, "anonid", "richlistbox");
+ </field>
+
+ <property name="view"
+ onget="return this.mInput.controller;"
+ onset="return val;"/>
+
+ </implementation>
+ </binding>
+
+ <binding id="private-autocomplete-richlistitem" extends="chrome://global/content/bindings/richlistbox.xml#richlistitem">
+ <content>
+ <xul:hbox align="center" class="ac-title-box">
+ <xul:image xbl:inherits="src=image" class="ac-site-icon"/>
+ <xul:hbox anonid="title-box" class="ac-title" flex="1"
+ onunderflow="_doUnderflow('_title');"
+ onoverflow="_doOverflow('_title');">
+ <xul:description anonid="title" class="ac-normal-text ac-comment" xbl:inherits="selected"/>
+ </xul:hbox>
+ <xul:label anonid="title-overflow-ellipsis" xbl:inherits="selected"
+ class="ac-ellipsis-after ac-comment"/>
+ <xul:hbox anonid="extra-box" class="ac-extra" align="center" hidden="true">
+ <xul:image class="ac-result-type-tag"/>
+ <xul:label class="ac-normal-text ac-comment" xbl:inherits="selected" value=":"/>
+ <xul:description anonid="extra" class="ac-normal-text ac-comment" xbl:inherits="selected"/>
+ </xul:hbox>
+ <xul:image anonid="type-image" class="ac-type-icon" xbl:inherits="selected"/>
+ </xul:hbox>
+ <xul:hbox align="center" class="ac-url-box">
+ <xul:spacer class="ac-site-icon"/>
+ <xul:image class="ac-action-icon"/>
+ <xul:hbox anonid="url-box" class="ac-url" flex="1"
+ onunderflow="_doUnderflow('_url');"
+ onoverflow="_doOverflow('_url');">
+ <xul:description anonid="url" class="ac-normal-text ac-url-text"
+ xbl:inherits="selected type"/>
+ <xul:description anonid="action" class="ac-normal-text ac-action-text"
+ xbl:inherits="selected type"/>
+ </xul:hbox>
+ <xul:label anonid="url-overflow-ellipsis" xbl:inherits="selected"
+ class="ac-ellipsis-after ac-url-text"/>
+ <xul:spacer class="ac-type-icon"/>
+ </xul:hbox>
+ </content>
+ <implementation implements="nsIDOMXULSelectControlItemElement">
+ <constructor>
+ <![CDATA[
+ let ellipsis = "\u2026";
+ try {
+ ellipsis = Components.classes["@mozilla.org/preferences-service;1"].
+ getService(Components.interfaces.nsIPrefBranch).
+ getComplexValue("intl.ellipsis",
+ Components.interfaces.nsIPrefLocalizedString).data;
+ } catch (ex) {
+ // Do nothing.. we already have a default
+ }
+
+ this._urlOverflowEllipsis = document.getAnonymousElementByAttribute(this, "anonid", "url-overflow-ellipsis");
+ this._titleOverflowEllipsis = document.getAnonymousElementByAttribute(this, "anonid", "title-overflow-ellipsis");
+
+ this._urlOverflowEllipsis.value = ellipsis;
+ this._titleOverflowEllipsis.value = ellipsis;
+
+ this._typeImage = document.getAnonymousElementByAttribute(this, "anonid", "type-image");
+
+ this._urlBox = document.getAnonymousElementByAttribute(this, "anonid", "url-box");
+ this._url = document.getAnonymousElementByAttribute(this, "anonid", "url");
+ this._action = document.getAnonymousElementByAttribute(this, "anonid", "action");
+
+ this._titleBox = document.getAnonymousElementByAttribute(this, "anonid", "title-box");
+ this._title = document.getAnonymousElementByAttribute(this, "anonid", "title");
+
+ this._extraBox = document.getAnonymousElementByAttribute(this, "anonid", "extra-box");
+ this._extra = document.getAnonymousElementByAttribute(this, "anonid", "extra");
+
+ this._adjustAcItem();
+ ]]>
+ </constructor>
+
+ <property name="label" readonly="true">
+ <getter>
+ <![CDATA[
+ // This property is a string that is read aloud by screen readers,
+ // so it must not contain anything that should not be user-facing.
+
+ let parts = [
+ this.getAttribute("title"),
+ this.getAttribute("displayurl"),
+ ];
+ let label = parts.filter(str => str).join(" ")
+
+ // allow consumers that have extended popups to override
+ // the label values for the richlistitems
+ let panel = this.parentNode.parentNode;
+ if (panel.createResultLabel) {
+ return panel.createResultLabel(this, label);
+ }
+
+ return label;
+ ]]>
+ </getter>
+ </property>
+
+ <property name="_stringBundle">
+ <getter><![CDATA[
+ if (!this.__stringBundle) {
+ this.__stringBundle = Services.strings.createBundle("chrome://global/locale/autocomplete.properties");
+ }
+ return this.__stringBundle;
+ ]]></getter>
+ </property>
+
+ <field name="_boundaryCutoff">null</field>
+
+ <property name="boundaryCutoff" readonly="true">
+ <getter>
+ <![CDATA[
+ if (!this._boundaryCutoff) {
+ this._boundaryCutoff =
+ Components.classes["@mozilla.org/preferences-service;1"].
+ getService(Components.interfaces.nsIPrefBranch).
+ getIntPref("toolkit.autocomplete.richBoundaryCutoff");
+ }
+ return this._boundaryCutoff;
+ ]]>
+ </getter>
+ </property>
+
+ <method name="_getBoundaryIndices">
+ <parameter name="aText"/>
+ <parameter name="aSearchTokens"/>
+ <body>
+ <![CDATA[
+ // Short circuit for empty search ([""] == "")
+ if (aSearchTokens == "")
+ return [0, aText.length];
+
+ // Find which regions of text match the search terms
+ let regions = [];
+ for (let search of Array.prototype.slice.call(aSearchTokens)) {
+ let matchIndex = -1;
+ let searchLen = search.length;
+
+ // Find all matches of the search terms, but stop early for perf
+ let lowerText = aText.substr(0, this.boundaryCutoff).toLowerCase();
+ while ((matchIndex = lowerText.indexOf(search, matchIndex + 1)) >= 0) {
+ regions.push([matchIndex, matchIndex + searchLen]);
+ }
+ }
+
+ // Sort the regions by start position then end position
+ regions = regions.sort((a, b) => {
+ let start = a[0] - b[0];
+ return (start == 0) ? a[1] - b[1] : start;
+ });
+
+ // Generate the boundary indices from each region
+ let start = 0;
+ let end = 0;
+ let boundaries = [];
+ let len = regions.length;
+ for (let i = 0; i < len; i++) {
+ // We have a new boundary if the start of the next is past the end
+ let region = regions[i];
+ if (region[0] > end) {
+ // First index is the beginning of match
+ boundaries.push(start);
+ // Second index is the beginning of non-match
+ boundaries.push(end);
+
+ // Track the new region now that we've stored the previous one
+ start = region[0];
+ }
+
+ // Push back the end index for the current or new region
+ end = Math.max(end, region[1]);
+ }
+
+ // Add the last region
+ boundaries.push(start);
+ boundaries.push(end);
+
+ // Put on the end boundary if necessary
+ if (end < aText.length)
+ boundaries.push(aText.length);
+
+ // Skip the first item because it's always 0
+ return boundaries.slice(1);
+ ]]>
+ </body>
+ </method>
+
+ <method name="_getSearchTokens">
+ <parameter name="aSearch"/>
+ <body>
+ <![CDATA[
+ let search = aSearch.toLowerCase();
+ return search.split(/\s+/);
+ ]]>
+ </body>
+ </method>
+
+ <method name="_setUpDescription">
+ <parameter name="aDescriptionElement"/>
+ <parameter name="aText"/>
+ <parameter name="aNoEmphasis"/>
+ <body>
+ <![CDATA[
+ // Get rid of all previous text
+ while (aDescriptionElement.hasChildNodes())
+ aDescriptionElement.removeChild(aDescriptionElement.firstChild);
+
+ // If aNoEmphasis is specified, don't add any emphasis
+ if (aNoEmphasis) {
+ aDescriptionElement.appendChild(document.createTextNode(aText));
+ return;
+ }
+
+ // Get the indices that separate match and non-match text
+ let search = this.getAttribute("text");
+ let tokens = this._getSearchTokens(search);
+ let indices = this._getBoundaryIndices(aText, tokens);
+
+ let next;
+ let start = 0;
+ let len = indices.length;
+ // Even indexed boundaries are matches, so skip the 0th if it's empty
+ for (let i = indices[0] == 0 ? 1 : 0; i < len; i++) {
+ next = indices[i];
+ let text = aText.substr(start, next - start);
+ start = next;
+
+ if (i % 2 == 0) {
+ // Emphasize the text for even indices
+ let span = aDescriptionElement.appendChild(
+ document.createElementNS("http://www.w3.org/1999/xhtml", "span"));
+ span.className = "ac-emphasize-text";
+ span.textContent = text;
+ } else {
+ // Otherwise, it's plain text
+ aDescriptionElement.appendChild(document.createTextNode(text));
+ }
+ }
+ ]]>
+ </body>
+ </method>
+
+ <!--
+ This will generate an array of emphasis pairs for use with
+ _setUpEmphasisedSections(). Each pair is a tuple (array) that
+ represents a block of text - containing the text of that block, and a
+ boolean for whether that block should have an emphasis styling applied
+ to it.
+
+ These pairs are generated by parsing a localised string (aSourceString)
+ with parameters, in the format that is used by
+ nsIStringBundle.formatStringFromName():
+
+ "textA %1$S textB textC %2$S"
+
+ Or:
+
+ "textA %S"
+
+ Where "%1$S", "%2$S", and "%S" are intended to be replaced by provided
+ replacement strings. These are specified an array of tuples
+ (aReplacements), each containing the replacement text and a boolean for
+ whether that text should have an emphasis styling applied. This is used
+ as a 1-based array - ie, "%1$S" is replaced by the item in the first
+ index of aReplacements, "%2$S" by the second, etc. "%S" will always
+ match the first index.
+ -->
+ <method name="_generateEmphasisPairs">
+ <parameter name="aSourceString"/>
+ <parameter name="aReplacements"/>
+ <body>
+ <![CDATA[
+ let pairs = [];
+
+ // Split on %S, %1$S, %2$S, etc. ie:
+ // "textA %S"
+ // becomes ["textA ", "%S"]
+ // "textA %1$S textB textC %2$S"
+ // becomes ["textA ", "%1$S", " textB textC ", "%2$S"]
+ let parts = aSourceString.split(/(%(?:[0-9]+\$)?S)/);
+
+ for (let part of parts) {
+ // The above regex will actually give us an empty string at the
+ // end - we don't want that, as we don't want to later generate an
+ // empty text node for it.
+ if (part.length === 0)
+ continue;
+
+ // Determine if this token is a replacement token or a normal text
+ // token. If it is a replacement token, we want to extract the
+ // numerical number. However, we still want to match on "$S".
+ let match = part.match(/^%(?:([0-9]+)\$)?S$/);
+
+ if (match) {
+ // "%S" doesn't have a numerical number in it, but will always
+ // be assumed to be 1. Furthermore, the input string specifies
+ // these with a 1-based index, but we want a 0-based index.
+ let index = (match[1] || 1) - 1;
+
+ if (index >= 0 && index < aReplacements.length) {
+ pairs.push([...aReplacements[index]]);
+ }
+ } else {
+ pairs.push([part]);
+ }
+ }
+
+ return pairs;
+ ]]>
+ </body>
+ </method>
+
+ <!--
+ _setUpEmphasisedSections() has the same use as _setUpDescription,
+ except instead of taking a string and highlighting given tokens, it takes
+ an array of pairs generated by _generateEmphasisPairs(). This allows
+ control over emphasising based on specific blocks of text, rather than
+ search for substrings.
+ -->
+ <method name="_setUpEmphasisedSections">
+ <parameter name="aDescriptionElement"/>
+ <parameter name="aTextPairs"/>
+ <body>
+ <![CDATA[
+ // Get rid of all previous text
+ while (aDescriptionElement.hasChildNodes())
+ aDescriptionElement.firstChild.remove();
+
+ for (let [text, emphasise] of aTextPairs) {
+ if (emphasise) {
+ let span = aDescriptionElement.appendChild(
+ document.createElementNS("http://www.w3.org/1999/xhtml", "span"));
+ span.textContent = text;
+ switch(emphasise) {
+ case "match":
+ span.className = "ac-emphasize-text";
+ break;
+ case "selected":
+ span.className = "ac-selected-text";
+ break;
+ }
+ } else {
+ aDescriptionElement.appendChild(document.createTextNode(text));
+ }
+ }
+ ]]>
+ </body>
+ </method>
+
+ <field name="_textToSubURI">null</field>
+ <method name="_unescapeUrl">
+ <parameter name="url"/>
+ <body>
+ <![CDATA[
+ if (!this._textToSubURI) {
+ this._textToSubURI =
+ Components.classes["@mozilla.org/intl/texttosuburi;1"]
+ .getService(Components.interfaces.nsITextToSubURI);
+ }
+ return this._textToSubURI.unEscapeURIForUI("UTF-8", url);
+ ]]>
+ </body>
+ </method>
+
+ <method name="_adjustAcItem">
+ <body>
+ <![CDATA[
+ let originalUrl = this.getAttribute("url");
+ let title = this.getAttribute("title");
+ let type = this.getAttribute("type");
+
+ let displayUrl;
+ let emphasiseTitle = true;
+ let emphasiseUrl = true;
+
+ // Hide the title's extra box by default, until we find out later if
+ // we need extra stuff.
+ this._extraBox.hidden = true;
+ this._titleBox.flex = 1;
+ this._typeImage.hidden = false;
+
+ this.removeAttribute("actiontype");
+ this.classList.remove("overridable-action");
+
+ // The ellipses are hidden via their visibility so that they always
+ // take up space and don't pop in on top of text when shown. For
+ // keyword searches, however, the title ellipsis should not take up
+ // space when hidden. Setting the hidden property accomplishes that.
+ this._titleOverflowEllipsis.hidden = false;
+
+ let types = new Set(type.split(/\s+/));
+
+ // Remove types that should ultimately not be in the `type` string.
+ let initialTypes = new Set(types);
+ types.delete("action");
+ types.delete("autofill");
+ types.delete("heuristic");
+ types.delete("search");
+
+ type = [...types][0] || "";
+
+ // If the type includes an action, set up the item appropriately.
+ if (initialTypes.has("action")) {
+ let action = this._parseActionUrl(originalUrl);
+ this.setAttribute("actiontype", action.type);
+
+ if (action.type == "switchtab") {
+ this.classList.add("overridable-action");
+ displayUrl = this._unescapeUrl(action.params.url);
+ let desc = this._stringBundle.GetStringFromName("switchToTab");
+ this._setUpDescription(this._action, desc, true);
+ } else if (action.type == "remotetab") {
+ displayUrl = this._unescapeUrl(action.params.url);
+ let desc = action.params.deviceName;
+ this._setUpDescription(this._action, desc, true);
+ } else if (action.type == "searchengine") {
+ emphasiseUrl = false;
+
+ // The order here is not localizable, we default to appending
+ // "- Search with Engine" to the search string, to be able to
+ // properly generate emphasis pairs. That said, no localization
+ // changed the order while it was possible, so doesn't look like
+ // there's a strong need for that.
+ let {engineName, searchSuggestion, searchQuery} = action.params;
+ let engineStr = " - " +
+ this._stringBundle.formatStringFromName("searchWithEngine",
+ [engineName], 1);
+
+ // Make the title by generating an array of pairs and its
+ // corresponding interpolation string (e.g., "%1$S") to pass to
+ // _generateEmphasisPairs.
+ let pairs;
+ if (searchSuggestion) {
+ // Check if the search query appears in the suggestion. It may
+ // not. If it does, then emphasize the query in the suggestion
+ // and otherwise just include the suggestion without emphasis.
+ let idx = searchSuggestion.indexOf(searchQuery);
+ if (idx >= 0) {
+ pairs = [
+ [searchSuggestion.substring(0, idx), ""],
+ [searchQuery, "match"],
+ [searchSuggestion.substring(idx + searchQuery.length), ""],
+ ];
+ } else {
+ pairs = [
+ [searchSuggestion, ""],
+ ];
+ }
+ } else {
+ pairs = [
+ [searchQuery, ""],
+ ];
+ }
+ pairs.push([engineStr, "selected"]);
+ let interpStr = pairs.map((pair, i) => `%${i + 1}$S`).join("");
+ title = this._generateEmphasisPairs(interpStr, pairs);
+
+ // If this is a default search match, we remove the image so we
+ // can style it ourselves with a generic search icon.
+ // We don't do this when matching an aliased search engine,
+ // because the icon helps with recognising which engine will be
+ // used (when using the default engine, we don't need that
+ // recognition).
+ if (!action.params.alias) {
+ this.removeAttribute("image");
+ }
+ } else if (action.type == "visiturl") {
+ emphasiseUrl = false;
+ displayUrl = this._unescapeUrl(action.params.url);
+ let sourceStr = this._stringBundle.GetStringFromName("visitURL");
+ title = this._generateEmphasisPairs(sourceStr, [
+ [displayUrl, "match"],
+ ]);
+ }
+ }
+
+ // Check if we have a search engine name
+ if (initialTypes.has("search")) {
+ emphasiseUrl = false;
+
+ const TITLE_SEARCH_ENGINE_SEPARATOR = " \u00B7\u2013\u00B7 ";
+
+ let searchEngine = "";
+ [title, searchEngine] = title.split(TITLE_SEARCH_ENGINE_SEPARATOR);
+ displayUrl = this._stringBundle.formatStringFromName("searchWithEngine", [searchEngine], 1);
+ }
+
+ if (!displayUrl) {
+ let input = this.parentNode.parentNode.input;
+ let url = typeof(input.trimValue) == "function" ?
+ input.trimValue(originalUrl) :
+ originalUrl;
+ displayUrl = this._unescapeUrl(url);
+ }
+ this.setAttribute("displayurl", displayUrl);
+
+ // Check if we have an auto-fill URL
+ if (initialTypes.has("autofill")) {
+ emphasiseUrl = false;
+
+ let sourceStr = this._stringBundle.GetStringFromName("visitURL");
+ title = this._generateEmphasisPairs(sourceStr, [
+ [displayUrl, "match"],
+ ]);
+ }
+
+ // If we have a tag match, show the tags and icon
+ if (type == "tag" || type == "bookmark-tag") {
+ // Configure the extra box for tags display
+ this._extraBox.hidden = false;
+ this._extraBox.childNodes[0].hidden = false;
+ this._extraBox.childNodes[1].hidden = true;
+ this._extraBox.pack = "end";
+ this._titleBox.flex = 1;
+
+ // The title is separated from the tags by an endash
+ let tags;
+ [, title, tags] = title.match(/^(.+) \u2013 (.+)$/);
+
+ // Each tag is split by a comma in an undefined order, so sort it
+ let sortedTags = tags.split(",").sort().join(", ");
+
+ // Emphasize the matching text in the tags
+ this._setUpDescription(this._extra, sortedTags);
+
+ // If we're suggesting bookmarks, then treat tagged matches as
+ // bookmarks for the star.
+ if (type == "bookmark-tag") {
+ type = "bookmark";
+ } else {
+ this._typeImage.hidden = true;
+ }
+ // keyword and favicon type results for search engines
+ // have an extra magnifying glass icon after them
+ } else if (type == "keyword" || (initialTypes.has("search") &&
+ initialTypes.has("favicon"))) {
+ // Configure the extra box for keyword display
+ this._extraBox.hidden = false;
+ this._extraBox.childNodes[0].hidden = true;
+ // The second child node is ":" and it should be hidden for non keyword types
+ this._extraBox.childNodes[1].hidden = type == "keyword" ? false : true;
+ this._extraBox.pack = "start";
+ this._titleBox.flex = 0;
+
+ // Hide the ellipsis so it doesn't take up space.
+ this._titleOverflowEllipsis.hidden = true;
+
+ if (type == "keyword") {
+ // Put the parameters next to the title if we have any
+ let search = this.getAttribute("text");
+ let params = "";
+ let paramsIndex = search.indexOf(" ");
+ if (paramsIndex != -1)
+ params = search.substr(paramsIndex + 1);
+
+ // Emphasize the keyword parameters
+ this._setUpDescription(this._extra, params);
+
+ // Don't emphasize keyword searches in the title or url
+ emphasiseUrl = false;
+ emphasiseTitle = false;
+ } else {
+ // Don't show any description for non keyword types.
+ this._setUpDescription(this._extra, "", true);
+ }
+ // If the result has the type favicon and a known search provider,
+ // customize it the same way as a keyword result.
+ type = "keyword";
+ }
+
+ // Give the image the icon style and a special one for the type
+ this._typeImage.className = "ac-type-icon" +
+ (type ? " ac-result-type-" + type : "");
+
+ // Show the domain as the title if we don't have a title.
+ if (title == "") {
+ title = displayUrl;
+ try {
+ let uri = Services.io.newURI(originalUrl, null, null);
+ // Not all valid URLs have a domain.
+ if (uri.host)
+ title = uri.host;
+ } catch (e) {}
+ }
+
+ // Emphasize the matching search terms for the description
+ if (Array.isArray(title))
+ this._setUpEmphasisedSections(this._title, title);
+ else
+ this._setUpDescription(this._title, title, !emphasiseTitle);
+
+ this._setUpDescription(this._url, displayUrl, !emphasiseUrl);
+
+ // Set up overflow on a timeout because the contents of the box
+ // might not have a width yet even though we just changed them
+ setTimeout(this._setUpOverflow, 0, this._titleBox, this._titleOverflowEllipsis);
+ setTimeout(this._setUpOverflow, 0, this._urlBox, this._urlOverflowEllipsis);
+ ]]>
+ </body>
+ </method>
+
+ <method name="_parseActionUrl">
+ <parameter name="aUrl"/>
+ <body><![CDATA[
+ if (!aUrl.startsWith("moz-action:"))
+ return null;
+
+ // URL is in the format moz-action:ACTION,PARAMS
+ // Where PARAMS is a JSON encoded object.
+ let [, type, params] = aUrl.match(/^moz-action:([^,]+),(.*)$/);
+
+ let action = {
+ type: type,
+ };
+
+ try {
+ action.params = JSON.parse(params);
+ for (let key in action.params) {
+ action.params[key] = decodeURIComponent(action.params[key]);
+ }
+ } catch (e) {
+ // If this failed, we assume that params is not a JSON object, and
+ // is instead just a flat string. This will happen when
+ // UnifiedComplete is disabled - in which case, the param is always
+ // a URL.
+ action.params = {
+ url: params,
+ }
+ }
+
+ return action;
+ ]]></body>
+ </method>
+
+ <method name="_setUpOverflow">
+ <parameter name="aParentBox"/>
+ <parameter name="aEllipsis"/>
+ <body>
+ <![CDATA[
+ // Hide the ellipsis incase there's just enough to not underflow
+ aEllipsis.style.visibility = "hidden";
+
+ // Start with the parent's width and subtract off its children
+ let tooltip = [];
+ let children = aParentBox.childNodes;
+ let widthDiff = aParentBox.boxObject.width;
+
+ for (let i = 0; i < children.length; i++) {
+ // Only consider a child if it actually takes up space
+ let childWidth = children[i].boxObject.width;
+ if (childWidth > 0) {
+ // Subtract a little less to account for subpixel rounding
+ widthDiff -= childWidth - .5;
+
+ // Add to the tooltip if it's not hidden and has text
+ let childText = children[i].textContent;
+ if (childText)
+ tooltip.push(childText);
+ }
+ }
+
+ // If the children take up more space than the parent.. overflow!
+ if (widthDiff < 0) {
+ // Re-show the ellipsis now that we know it's needed
+ aEllipsis.style.visibility = "visible";
+
+ // Separate text components with a ndash --
+ aParentBox.tooltipText = tooltip.join(" \u2013 ");
+ }
+ ]]>
+ </body>
+ </method>
+
+ <method name="_doUnderflow">
+ <parameter name="aName"/>
+ <body>
+ <![CDATA[
+ // Hide the ellipsis right when we know we're underflowing instead of
+ // waiting for the timeout to trigger the _setUpOverflow calculations
+ this[aName + "Box"].tooltipText = "";
+ this[aName + "OverflowEllipsis"].style.visibility = "hidden";
+ ]]>
+ </body>
+ </method>
+
+ <method name="_doOverflow">
+ <parameter name="aName"/>
+ <body>
+ <![CDATA[
+ this._setUpOverflow(this[aName + "Box"],
+ this[aName + "OverflowEllipsis"]);
+ ]]>
+ </body>
+ </method>
+
+ </implementation>
+ </binding>
+
+ <binding id="private-autocomplete-tree" extends="chrome://global/content/bindings/tree.xml#tree">
+ <content>
+ <children includes="treecols"/>
+ <xul:treerows class="private-autocomplete-treerows tree-rows" xbl:inherits="hidescrollbar" flex="1">
+ <children/>
+ </xul:treerows>
+ </content>
+ </binding>
+
+ <binding id="private-autocomplete-richlistbox" extends="chrome://global/content/bindings/richlistbox.xml#richlistbox">
+ <implementation>
+ <field name="mLastMoveTime">Date.now()</field>
+ <field name="mouseSelectedIndex">-1</field>
+ </implementation>
+ <handlers>
+ <handler event="mouseup">
+ <![CDATA[
+ // don't call onPopupClick for the scrollbar buttons, thumb, slider, etc.
+ let item = event.originalTarget;
+ while (item && item.localName != "richlistitem") {
+ item = item.parentNode;
+ }
+
+ if (!item)
+ return;
+
+ this.parentNode.onPopupClick(event);
+ ]]>
+ </handler>
+
+ <handler event="mousemove">
+ <![CDATA[
+ if (Date.now() - this.mLastMoveTime > 30) {
+ let item = event.target;
+ while (item && item.localName != "richlistitem") {
+ item = item.parentNode;
+ }
+
+ if (!item)
+ return;
+
+ let index = this.getIndexOfItem(item);
+ if (index != this.selectedIndex) {
+ this.mouseSelectedIndex = this.selectedIndex = index;
+ }
+
+ this.mLastMoveTime = Date.now();
+ }
+ ]]>
+ </handler>
+ </handlers>
+ </binding>
+
+ <binding id="private-autocomplete-treebody">
+ <implementation>
+ <field name="mLastMoveTime">Date.now()</field>
+ </implementation>
+
+ <handlers>
+ <handler event="mouseup" action="this.parentNode.parentNode.onPopupClick(event);"/>
+
+ <handler event="mousedown"><![CDATA[
+ var rc = this.parentNode.treeBoxObject.getRowAt(event.clientX, event.clientY);
+ if (rc != this.parentNode.currentIndex)
+ this.parentNode.view.selection.select(rc);
+ ]]></handler>
+
+ <handler event="mousemove"><![CDATA[
+ if (Date.now() - this.mLastMoveTime > 30) {
+ var rc = this.parentNode.treeBoxObject.getRowAt(event.clientX, event.clientY);
+ if (rc != this.parentNode.currentIndex)
+ this.parentNode.view.selection.select(rc);
+ this.mLastMoveTime = Date.now();
+ }
+ ]]></handler>
+ </handlers>
+ </binding>
+
+ <binding id="private-autocomplete-treerows">
+ <content>
+ <xul:hbox flex="1" class="tree-bodybox">
+ <children/>
+ </xul:hbox>
+ <xul:scrollbar xbl:inherits="collapsed=hidescrollbar" orient="vertical" class="tree-scrollbar"/>
+ </content>
+ </binding>
+
+ <binding id="private-history-dropmarker" extends="chrome://global/content/bindings/general.xml#dropmarker">
+ <handlers>
+ <handler event="mousedown" button="0"><![CDATA[
+ document.getBindingParent(this).toggleHistoryPopup();
+ ]]></handler>
+ </handlers>
+ </binding>
+
+</bindings>
diff --git a/application/palemoon/base/content/autorecovery.js b/application/palemoon/base/content/autorecovery.js
index 29ccaed3fe..01a092f5cc 100644
--- a/application/palemoon/base/content/autorecovery.js
+++ b/application/palemoon/base/content/autorecovery.js
@@ -10,9 +10,9 @@
* have been properly initialized already.
*/
-let Cc = Components.classes;
-let Ci = Components.interfaces;
-let Cu = Components.utils;
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cu = Components.utils;
// Services = object with smart getters for common XPCOM services
Cu.import("resource://gre/modules/Services.jsm");
diff --git a/application/palemoon/base/content/baseMenuOverlay.xul b/application/palemoon/base/content/baseMenuOverlay.xul
index c6c1b16dc7..f61348c9f2 100644
--- a/application/palemoon/base/content/baseMenuOverlay.xul
+++ b/application/palemoon/base/content/baseMenuOverlay.xul
@@ -29,7 +29,7 @@
<menuitem id="menu_mac_show_all" label="&showAllAppsCmdMac.label;"/>
</menupopup>
<!-- Mac window menu -->
-#include ../../../toolkit/content/macWindowMenu.inc
+#include ../../../../toolkit/content/macWindowMenu.inc
#endif
#ifdef XP_WIN
diff --git a/application/palemoon/base/content/browser-addons.js b/application/palemoon/base/content/browser-addons.js
index 7993a0c9c9..f5c398f33a 100644
--- a/application/palemoon/base/content/browser-addons.js
+++ b/application/palemoon/base/content/browser-addons.js
@@ -226,7 +226,7 @@ const gXPInstallObserver = {
* - If an add-on was installed, incrementing the count, show the bar.
* - If an add-on was uninstalled, and no more items are left, hide the bar.
*/
-let AddonsMgrListener = {
+var AddonsMgrListener = {
get addonBar() document.getElementById("addon-bar"),
get statusBar() document.getElementById("status-bar"),
getAddonBarItemCount: function() {
@@ -461,7 +461,7 @@ var LightWeightThemeWebInstaller = {
/*
* Listen for Lightweight Theme styling changes and update the browser's theme accordingly.
*/
-let LightweightThemeListener = {
+var LightweightThemeListener = {
_modifiedStyles: [],
init: function () {
diff --git a/application/palemoon/base/content/browser-appmenu.inc b/application/palemoon/base/content/browser-appmenu.inc
index 835bf22bcf..cfc855484a 100644
--- a/application/palemoon/base/content/browser-appmenu.inc
+++ b/application/palemoon/base/content/browser-appmenu.inc
@@ -132,38 +132,8 @@
</splitmenu>
<menuseparator class="appmenu-menuseparator"/>
<splitmenu id="appmenu_webDeveloper"
- command="Tools:DevToolbox"
label="&appMenuWebDeveloper.label;">
<menupopup id="appmenu_webDeveloper_popup">
-#ifdef MOZ_DEVTOOLS
- <menuitem id="appmenu_devToolbox"
- observes="devtoolsMenuBroadcaster_DevToolbox"/>
- <menuseparator id="appmenu_devtools_separator"/>
- <menuitem id="appmenu_devToolbar"
- observes="devtoolsMenuBroadcaster_DevToolbar"/>
- <menuitem id="appmenu_chromeDebugger"
- observes="devtoolsMenuBroadcaster_ChromeDebugger"/>
- <menuitem id="appmenu_browserConsole"
- observes="devtoolsMenuBroadcaster_BrowserConsole"/>
- <menuitem id="appmenu_responsiveUI"
- observes="devtoolsMenuBroadcaster_ResponsiveUI"/>
- <menuitem id="appmenu_eyedropper"
- observes="devtoolsMenuBroadcaster_Eyedropper"/>
- <menuitem id="appmenu_scratchpad"
- observes="devtoolsMenuBroadcaster_Scratchpad"/>
-#endif
- <menuitem id="appmenu_pageSource"
- observes="devtoolsMenuBroadcaster_PageSource"/>
- <menuitem id="appmenu_errorConsole"
- observes="devtoolsMenuBroadcaster_ErrorConsole"/>
-#ifdef MOZ_DEVTOOLS
- <menuitem id="appmenu_devtools_connect"
- observes="devtoolsMenuBroadcaster_connect"/>
-#endif
- <menuseparator id="appmenu_devToolsEndSeparator"/>
- <menuitem id="appmenu_getMoreDevtools"
- observes="devtoolsMenuBroadcaster_GetMoreTools"/>
- <menuseparator/>
#define ID_PREFIX appmenu_developer_
#define OMIT_ACCESSKEYS
#include browser-charsetmenu.inc
@@ -173,6 +143,11 @@
type="checkbox"
observes="workOfflineMenuitemState"
oncommand="BrowserOffline.toggleOfflineStatus();"/>
+ <menuseparator/>
+ <menuitem id="appmenu_pageSource"
+ observes="devtoolsMenuBroadcaster_PageSource"/>
+ <menuitem id="appmenu_javascriptConsole"
+ observes="devtoolsMenuBroadcaster_ErrorConsole"/>
</menupopup>
</splitmenu>
<menuseparator class="appmenu-menuseparator"/>
diff --git a/application/palemoon/base/content/browser-devtools-theme.js b/application/palemoon/base/content/browser-devtools-theme.js
new file mode 100644
index 0000000000..7b21ddedc0
--- /dev/null
+++ b/application/palemoon/base/content/browser-devtools-theme.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/. */
+
+/**
+ * Listeners for the DevTools theme.
+ */
+var DevToolsTheme = {
+ _devtoolsThemePrefName: "devtools.theme",
+ styleSheet: null,
+ initialized: false,
+
+ get isStyleSheetEnabled() {
+ return this.styleSheet && !this.styleSheet.sheet.disabled;
+ },
+
+ init: function () {
+ this.initialized = true;
+ Services.prefs.addObserver(this._devtoolsThemePrefName, this, false);
+ Services.obs.addObserver(this, "lightweight-theme-styling-update", false);
+ Services.obs.addObserver(this, "lightweight-theme-window-updated", false);
+ this._updateDevtoolsThemeAttribute();
+ },
+
+ observe: function (subject, topic, data) {
+ if (topic == "lightweight-theme-styling-update") {
+ let newTheme = JSON.parse(data);
+ this._toggleStyleSheet();
+ }
+
+ if (topic == "nsPref:changed" && data == this._devtoolsThemePrefName) {
+ this._updateDevtoolsThemeAttribute();
+ }
+ },
+
+ _inferBrightness: function() {
+ ToolbarIconColor.inferFromText();
+ // Get an inverted full screen button if the dark theme is applied.
+ if (this.isStyleSheetEnabled &&
+ document.documentElement.getAttribute("devtoolstheme") == "dark") {
+ document.documentElement.setAttribute("brighttitlebarforeground", "true");
+ } else {
+ document.documentElement.removeAttribute("brighttitlebarforeground");
+ }
+ },
+
+ _updateDevtoolsThemeAttribute: function() {
+ // Set an attribute on root element to make it possible
+ // to change colors based on the selected devtools theme.
+ let devtoolsTheme = Services.prefs.getCharPref(this._devtoolsThemePrefName);
+ if (devtoolsTheme != "dark") {
+ devtoolsTheme = "light";
+ }
+ document.documentElement.setAttribute("devtoolstheme", devtoolsTheme);
+ this._inferBrightness();
+ },
+
+ handleEvent: function(e) {
+ if (e.type === "load") {
+ this.styleSheet.removeEventListener("load", this);
+ this.refreshBrowserDisplay();
+ }
+ },
+
+ refreshBrowserDisplay: function() {
+ // Don't touch things on the browser if gBrowserInit.onLoad hasn't
+ // yet fired.
+ if (this.initialized) {
+ gBrowser.tabContainer._positionPinnedTabs();
+ this._inferBrightness();
+ }
+ },
+
+ _toggleStyleSheet: function() {
+ let wasEnabled = this.isStyleSheetEnabled;
+ if (wasEnabled) {
+ this.styleSheet.sheet.disabled = true;
+ this.refreshBrowserDisplay();
+ }
+ },
+
+ uninit: function () {
+ Services.prefs.removeObserver(this._devtoolsThemePrefName, this);
+ Services.obs.removeObserver(this, "lightweight-theme-styling-update", false);
+ Services.obs.removeObserver(this, "lightweight-theme-window-updated", false);
+ if (this.styleSheet) {
+ this.styleSheet.removeEventListener("load", this);
+ }
+ this.styleSheet = null;
+ }
+};
diff --git a/application/palemoon/base/content/browser-fullScreen.js b/application/palemoon/base/content/browser-fullScreen.js
index b8a29199ee..73b10ae850 100644
--- a/application/palemoon/base/content/browser-fullScreen.js
+++ b/application/palemoon/base/content/browser-fullScreen.js
@@ -304,7 +304,7 @@ var FullScreen = {
},
_cancelAnimation: function() {
- window.mozCancelAnimationFrame(this._animationHandle);
+ window.cancelAnimationFrame(this._animationHandle);
this._animationHandle = 0;
clearTimeout(this._animationTimeout);
this._isAnimating = false;
@@ -354,11 +354,10 @@ var FullScreen = {
"fullscreen",
Services.perms.ALLOW_ACTION,
Services.perms.EXPIRE_SESSION);
- let host = uri.host;
var onFullscreenchange = function onFullscreenchange(event) {
if (event.target == document && document.mozFullScreenElement == null) {
// The chrome document has left fullscreen. Remove the temporary permission grant.
- Services.perms.remove(host, "fullscreen");
+ Services.perms.remove(uri, "fullscreen");
document.removeEventListener("mozfullscreenchange", onFullscreenchange);
}
}
diff --git a/application/palemoon/base/content/browser-fullZoom.js b/application/palemoon/base/content/browser-fullZoom.js
index 0837bf7c22..890cd84403 100644
--- a/application/palemoon/base/content/browser-fullZoom.js
+++ b/application/palemoon/base/content/browser-fullZoom.js
@@ -1,14 +1,6 @@
-/*
-#ifdef 0
- * This Source Code Form is subject to the terms of the Mozilla Public
+/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#endif
- */
-
-// One of the possible values for the mousewheel.* preferences.
-// From nsEventStateManager.cpp.
-const MOUSE_SCROLL_ZOOM = 3;
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/**
* Controls the "full zoom" setting and its site-specific preferences.
@@ -36,7 +28,6 @@ var FullZoom = {
return this._siteSpecificPref;
},
- //**************************************************************************//
// nsISupports
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMEventListener,
@@ -45,12 +36,10 @@ var FullZoom = {
Ci.nsISupportsWeakReference,
Ci.nsISupports]),
- //**************************************************************************//
// Initialization & Destruction
init: function FullZoom_init() {
- // Listen for scrollwheel events so we can save scrollwheel-based changes.
- window.addEventListener("DOMMouseScroll", this, false);
+ gBrowser.addEventListener("ZoomChangeUsingMouseWheel", this);
// Register ourselves with the service so we know when our pref changes.
this._cps2 = Cc["@mozilla.org/content-pref/service;1"].
@@ -74,76 +63,30 @@ var FullZoom = {
}
// This should be nulled after initialization.
- this._initialLocations.clear();
this._initialLocations = null;
},
destroy: function FullZoom_destroy() {
gPrefService.removeObserver("browser.zoom.", this);
this._cps2.removeObserverForName(this.name, this);
- window.removeEventListener("DOMMouseScroll", this, false);
+ gBrowser.removeEventListener("ZoomChangeUsingMouseWheel", this);
},
- //**************************************************************************//
// Event Handlers
// nsIDOMEventListener
handleEvent: function FullZoom_handleEvent(event) {
switch (event.type) {
- case "DOMMouseScroll":
- this._handleMouseScrolled(event);
+ case "ZoomChangeUsingMouseWheel":
+ let browser = this._getTargetedBrowser(event);
+ this._ignorePendingZoomAccesses(browser);
+ this._applyZoomToPref(browser);
break;
}
},
- _handleMouseScrolled: function FullZoom__handleMouseScrolled(event) {
- // Construct the "mousewheel action" pref key corresponding to this event.
- // Based on nsEventStateManager::WheelPrefs::GetBasePrefName().
- var pref = "mousewheel.";
-
- var pressedModifierCount = event.shiftKey + event.ctrlKey + event.altKey +
- event.metaKey + event.getModifierState("OS");
- if (pressedModifierCount != 1) {
- pref += "default.";
- } else if (event.shiftKey) {
- pref += "with_shift.";
- } else if (event.ctrlKey) {
- pref += "with_control.";
- } else if (event.altKey) {
- pref += "with_alt.";
- } else if (event.metaKey) {
- pref += "with_meta.";
- } else {
- pref += "with_win.";
- }
-
- pref += "action";
-
- // Don't do anything if this isn't a "zoom" scroll event.
- var isZoomEvent = false;
- try {
- isZoomEvent = (gPrefService.getIntPref(pref) == MOUSE_SCROLL_ZOOM);
- } catch (e) {}
- if (!isZoomEvent)
- return;
-
- // XXX Lazily cache all the possible action prefs so we don't have to get
- // them anew from the pref service for every scroll event? We'd have to
- // make sure to observe them so we can update the cache when they change.
-
- // We have to call _applyZoomToPref in a timeout because we handle the
- // event before the event state manager has a chance to apply the zoom
- // during nsEventStateManager::PostHandleEvent.
- let browser = gBrowser.selectedBrowser;
- let token = this._getBrowserToken(browser);
- window.setTimeout(function () {
- if (token.isCurrent)
- this._applyZoomToPref(browser);
- }.bind(this), 0);
- },
-
// nsIObserver
observe: function (aSubject, aTopic, aData) {
@@ -165,12 +108,12 @@ var FullZoom = {
// nsIContentPrefObserver
- onContentPrefSet: function FullZoom_onContentPrefSet(aGroup, aName, aValue) {
- this._onContentPrefChanged(aGroup, aValue);
+ onContentPrefSet: function FullZoom_onContentPrefSet(aGroup, aName, aValue, aIsPrivate) {
+ this._onContentPrefChanged(aGroup, aValue, aIsPrivate);
},
- onContentPrefRemoved: function FullZoom_onContentPrefRemoved(aGroup, aName) {
- this._onContentPrefChanged(aGroup, undefined);
+ onContentPrefRemoved: function FullZoom_onContentPrefRemoved(aGroup, aName, aIsPrivate) {
+ this._onContentPrefChanged(aGroup, undefined, aIsPrivate);
},
/**
@@ -181,7 +124,7 @@ var FullZoom = {
* @param aValue The new value of the changed preference. Pass undefined to
* indicate the preference's removal.
*/
- _onContentPrefChanged: function FullZoom__onContentPrefChanged(aGroup, aValue) {
+ _onContentPrefChanged: function FullZoom__onContentPrefChanged(aGroup, aValue, aIsPrivate) {
if (this._isNextContentPrefChangeInternal) {
// Ignore changes that FullZoom itself makes. This works because the
// content pref service calls callbacks before notifying observers, and it
@@ -194,9 +137,10 @@ var FullZoom = {
if (!browser.currentURI)
return;
+ let ctxt = this._loadContextFromBrowser(browser);
let domain = this._cps2.extractDomain(browser.currentURI.spec);
if (aGroup) {
- if (aGroup == domain)
+ if (aGroup == domain && ctxt.usePrivateBrowsing == aIsPrivate)
this._applyPrefToZoom(aValue, browser);
return;
}
@@ -208,10 +152,9 @@ var FullZoom = {
// zoom should be set to the new global preference now that the global
// preference has changed.
let hasPref = false;
- let ctxt = this._loadContextFromBrowser(browser);
let token = this._getBrowserToken(browser);
this._cps2.getByDomainAndName(browser.currentURI.spec, this.name, ctxt, {
- handleResult: function () hasPref = true,
+ handleResult: function () { hasPref = true; },
handleCompletion: function () {
if (!hasPref && token.isCurrent)
this._applyPrefToZoom(undefined, browser);
@@ -234,6 +177,7 @@ var FullZoom = {
*/
onLocationChange: function FullZoom_onLocationChange(aURI, aIsTabSwitch, aBrowser) {
let browser = aBrowser || gBrowser.selectedBrowser;
+
// If we haven't been initialized yet but receive an onLocationChange
// notification then let's store and replay it upon initialization.
if (this._initialLocations) {
@@ -247,14 +191,14 @@ var FullZoom = {
this._ignorePendingZoomAccesses(browser);
if (!aURI || (aIsTabSwitch && !this.siteSpecific)) {
- this._notifyOnLocationChange();
+ this._notifyOnLocationChange(browser);
return;
}
// Avoid the cps roundtrip and apply the default/global pref.
if (aURI.spec == "about:blank") {
this._applyPrefToZoom(undefined, browser,
- this._notifyOnLocationChange.bind(this));
+ this._notifyOnLocationChange.bind(this, browser));
return;
}
@@ -262,7 +206,7 @@ var FullZoom = {
if (!aIsTabSwitch && browser.isSyntheticDocument) {
ZoomManager.setZoomForBrowser(browser, 1);
// _ignorePendingZoomAccesses already called above, so no need here.
- this._notifyOnLocationChange();
+ this._notifyOnLocationChange(browser);
return;
}
@@ -271,7 +215,7 @@ var FullZoom = {
let pref = this._cps2.getCachedByDomainAndName(aURI.spec, this.name, ctxt);
if (pref) {
this._applyPrefToZoom(pref.value, browser,
- this._notifyOnLocationChange.bind(this));
+ this._notifyOnLocationChange.bind(this, browser));
return;
}
@@ -279,14 +223,14 @@ var FullZoom = {
let value = undefined;
let token = this._getBrowserToken(browser);
this._cps2.getByDomainAndName(aURI.spec, this.name, ctxt, {
- handleResult: function (resultPref) value = resultPref.value,
+ handleResult: function (resultPref) { value = resultPref.value; },
handleCompletion: function () {
if (!token.isCurrent) {
- this._notifyOnLocationChange();
+ this._notifyOnLocationChange(browser);
return;
}
this._applyPrefToZoom(value, browser,
- this._notifyOnLocationChange.bind(this));
+ this._notifyOnLocationChange.bind(this, browser));
}.bind(this)
});
},
@@ -299,7 +243,6 @@ var FullZoom = {
menuItem.setAttribute("checked", !ZoomManager.useFullZoom);
},
- //**************************************************************************//
// Setting & Pref Manipulation
/**
@@ -323,19 +266,32 @@ var FullZoom = {
},
/**
- * Sets the zoom level of the page in the current browser to the global zoom
+ * Sets the zoom level for the given browser to the given floating
+ * point value, where 1 is the default zoom level.
+ */
+ setZoom: function (value, browser = gBrowser.selectedBrowser) {
+ ZoomManager.setZoomForBrowser(browser, value);
+ this._ignorePendingZoomAccesses(browser);
+ this._applyZoomToPref(browser);
+ },
+
+ /**
+ * Sets the zoom level of the page in the given browser to the global zoom
* level.
+ *
+ * @return A promise which resolves when the zoom reset has been applied.
*/
- reset: function FullZoom_reset() {
- let browser = gBrowser.selectedBrowser;
+ reset: function FullZoom_reset(browser = gBrowser.selectedBrowser) {
let token = this._getBrowserToken(browser);
- this._getGlobalValue(browser, function (value) {
+ let result = this._getGlobalValue(browser).then(value => {
if (token.isCurrent) {
ZoomManager.setZoomForBrowser(browser, value === undefined ? 1 : value);
this._ignorePendingZoomAccesses(browser);
+ Services.obs.notifyObservers(browser, "browser-fullZoom:zoomReset", "");
}
});
this._removePref(browser);
+ return result;
},
/**
@@ -383,7 +339,7 @@ var FullZoom = {
}
let token = this._getBrowserToken(aBrowser);
- this._getGlobalValue(aBrowser, function (value) {
+ this._getGlobalValue(aBrowser).then(value => {
if (token.isCurrent) {
ZoomManager.setZoomForBrowser(aBrowser, value === undefined ? 1 : value);
this._ignorePendingZoomAccesses(aBrowser);
@@ -399,6 +355,7 @@ var FullZoom = {
* @param browser The zoom of this browser will be saved. Required.
*/
_applyZoomToPref: function FullZoom__applyZoomToPref(browser) {
+ Services.obs.notifyObservers(browser, "browser-fullZoom:zoomChange", "");
if (!this.siteSpecific ||
gInPrintPreviewMode ||
browser.isSyntheticDocument)
@@ -419,6 +376,7 @@ var FullZoom = {
* @param browser The zoom of this browser will be removed. Required.
*/
_removePref: function FullZoom__removePref(browser) {
+ Services.obs.notifyObservers(browser, "browser-fullZoom:zoomReset", "");
if (browser.isSyntheticDocument)
return;
let ctxt = this._loadContextFromBrowser(browser);
@@ -429,7 +387,6 @@ var FullZoom = {
});
},
- //**************************************************************************//
// Utilities
/**
@@ -462,6 +419,30 @@ var FullZoom = {
},
/**
+ * Returns the browser that the supplied zoom event is associated with.
+ * @param event The ZoomChangeUsingMouseWheel event.
+ * @return The associated browser element, if one exists, otherwise null.
+ */
+ _getTargetedBrowser: function FullZoom__getTargetedBrowser(event) {
+ let target = event.originalTarget;
+
+ // With remote content browsers, the event's target is the browser
+ // we're looking for.
+ const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
+ if (target instanceof window.XULElement &&
+ target.localName == "browser" &&
+ target.namespaceURI == XUL_NS)
+ return target;
+
+ // With in-process content browsers, the event's target is the content
+ // document.
+ if (target.nodeType == Node.DOCUMENT_NODE)
+ return gBrowser.getBrowserForDocument(target);
+
+ throw new Error("Unexpected ZoomChangeUsingMouseWheel event source");
+ },
+
+ /**
* Increments the zoom change token for the given browser so that pending
* async operations know that it may be unsafe to access they zoom when they
* finish.
@@ -491,54 +472,49 @@ var FullZoom = {
/**
* Gets the global browser.content.full-zoom content preference.
*
- * WARNING: callback may be called synchronously or asynchronously. The
- * reason is that it's usually desirable to avoid turns of the event loop
- * where possible, since they can lead to visible, jarring jumps in zoom
- * level. It's not always possible to avoid them, though. As a convenience,
- * then, this method takes a callback and returns nothing.
- *
- * @param browser The content browser pertaining to the zoom.
- * @param callback Synchronously or asynchronously called when done. It's
- * bound to this object (FullZoom) and called as:
- * callback(prefValue)
+ * @param browser The browser pertaining to the zoom.
+ * @returns Promise<prefValue>
+ * Resolves to the preference value when done.
*/
- _getGlobalValue: function FullZoom__getGlobalValue(browser, callback) {
+ _getGlobalValue: function FullZoom__getGlobalValue(browser) {
// * !("_globalValue" in this) => global value not yet cached.
// * this._globalValue === undefined => global value known not to exist.
// * Otherwise, this._globalValue is a number, the global value.
- if ("_globalValue" in this) {
- callback.call(this, this._globalValue, true);
- return;
- }
- let value = undefined;
- this._cps2.getGlobal(this.name, this._loadContextFromBrowser(browser), {
- handleResult: function (pref) value = pref.value,
- handleCompletion: function (reason) {
- this._globalValue = this._ensureValid(value);
- callback.call(this, this._globalValue);
- }.bind(this)
+ return new Promise(resolve => {
+ if ("_globalValue" in this) {
+ resolve(this._globalValue);
+ return;
+ }
+ let value = undefined;
+ this._cps2.getGlobal(this.name, this._loadContextFromBrowser(browser), {
+ handleResult: function (pref) { value = pref.value; },
+ handleCompletion: (reason) => {
+ this._globalValue = this._ensureValid(value);
+ resolve(this._globalValue);
+ }
+ });
});
},
/**
- * Gets the load context from the given content browser.
+ * Gets the load context from the given Browser.
*
* @param Browser The Browser whose load context will be returned.
- * @return The nsILoadContext of the given Browser.
+ * @return The nsILoadContext of the given Browser.
*/
_loadContextFromBrowser: function FullZoom__loadContextFromBrowser(browser) {
return browser.loadContext;
},
/**
- * Asynchronously broadcasts a "browser-fullZoom:locationChange" notification
- * so that tests can select tabs, load pages, etc. and be notified when the
- * zoom levels on those pages change. The notification is always asynchronous
- * so that observers are guaranteed a consistent behavior.
+ * Asynchronously broadcasts "browser-fullZoom:location-change" so that
+ * listeners can be notified when the zoom levels on those pages change.
+ * The notification is always asynchronous so that observers are guaranteed a
+ * consistent behavior.
*/
- _notifyOnLocationChange: function FullZoom__notifyOnLocationChange() {
+ _notifyOnLocationChange: function FullZoom__notifyOnLocationChange(browser) {
this._executeSoon(function () {
- Services.obs.notifyObservers(null, "browser-fullZoom:locationChange", "");
+ Services.obs.notifyObservers(browser, "browser-fullZoom:location-change", "");
});
},
diff --git a/application/palemoon/base/content/browser-gestureSupport.js b/application/palemoon/base/content/browser-gestureSupport.js
index d88f47c793..13eb71b995 100644
--- a/application/palemoon/base/content/browser-gestureSupport.js
+++ b/application/palemoon/base/content/browser-gestureSupport.js
@@ -13,7 +13,7 @@
// chrome-only, we must listen for the simple gesture events during
// the capturing phase and call stopPropagation on every event.
-let gGestureSupport = {
+var gGestureSupport = {
_currentRotation: 0,
_lastRotateDelta: 0,
_rotateMomentumThreshold: .75,
@@ -532,7 +532,7 @@ let gGestureSupport = {
};
// History Swipe Animation Support (bug 678392)
-let gHistorySwipeAnimation = {
+var gHistorySwipeAnimation = {
active: false,
isLTR: false,
diff --git a/application/palemoon/base/content/browser-menubar.inc b/application/palemoon/base/content/browser-menubar.inc
index fa9d7f0f44..fc6bc76943 100644
--- a/application/palemoon/base/content/browser-menubar.inc
+++ b/application/palemoon/base/content/browser-menubar.inc
@@ -534,43 +534,12 @@
label="&webDeveloperMenu.label;"
accesskey="&webDeveloperMenu.accesskey;">
<menupopup id="menuWebDeveloperPopup">
-#ifdef MOZ_DEVTOOLS
- <menuitem id="menu_devToolbox"
- observes="devtoolsMenuBroadcaster_DevToolbox"
- accesskey="&devToolboxMenuItem.accesskey;"/>
- <menuseparator id="menu_devtools_separator"/>
- <menuitem id="menu_devToolbar"
- observes="devtoolsMenuBroadcaster_DevToolbar"
- accesskey="&devToolbarMenu.accesskey;"/>
- <menuitem id="menu_chromeDebugger"
- observes="devtoolsMenuBroadcaster_ChromeDebugger"/>
- <menuitem id="menu_browserConsole"
- observes="devtoolsMenuBroadcaster_BrowserConsole"
- accesskey="&browserConsoleCmd.accesskey;"/>
- <menuitem id="menu_responsiveUI"
- observes="devtoolsMenuBroadcaster_ResponsiveUI"
- accesskey="&responsiveDesignTool.accesskey;"/>
- <menuitem id="menu_eyedropper"
- observes="devtoolsMenuBroadcaster_Eyedropper"
- accesskey="&eyedropper.accesskey;"/>
- <menuitem id="menu_scratchpad"
- observes="devtoolsMenuBroadcaster_Scratchpad"
- accesskey="&scratchpad.accesskey;"/>
-#endif
<menuitem id="menu_pageSource"
observes="devtoolsMenuBroadcaster_PageSource"
accesskey="&pageSourceCmd.accesskey;"/>
<menuitem id="javascriptConsole"
observes="devtoolsMenuBroadcaster_ErrorConsole"
accesskey="&errorConsoleCmd.accesskey;"/>
-#ifdef MOZ_DEVTOOLS
- <menuitem id="menu_devtools_connect"
- observes="devtoolsMenuBroadcaster_connect"/>
-#endif
- <menuseparator id="devToolsEndSeparator"/>
- <menuitem id="getMoreDevtools"
- observes="devtoolsMenuBroadcaster_GetMoreTools"
- accesskey="&getMoreDevtoolsCmd.accesskey;"/>
</menupopup>
</menu>
<menuitem id="menu_pageInfo"
diff --git a/application/palemoon/base/content/browser-places.js b/application/palemoon/base/content/browser-places.js
index cf9c28597f..590fe7ecd9 100644
--- a/application/palemoon/base/content/browser-places.js
+++ b/application/palemoon/base/content/browser-places.js
@@ -189,11 +189,24 @@ var StarUI = {
this._itemId = aItemId !== undefined ? aItemId : this._itemId;
this.beginBatch();
- this.panel.openPopup(aAnchorElement, aPosition);
-
+ let onPanelReady = fn => {
+ let target = this.panel;
+ if (target.parentNode) {
+ // By targeting the panel's parent and using a capturing listener, we
+ // can have our listener called before others waiting for the panel to
+ // be shown (which probably expect the panel to be fully initialized)
+ target = target.parentNode;
+ }
+ target.addEventListener("popupshown", function(event) {
+ fn();
+ }, {"capture": true, "once": true});
+ };
gEditItemOverlay.initPanel(this._itemId,
- { hiddenRows: ["description", "location",
+ { onPanelReady,
+ hiddenRows: ["description", "location",
"loadInSidebar", "keyword"] });
+
+ this.panel.openPopup(aAnchorElement, aPosition);
},
panelShown:
@@ -959,7 +972,7 @@ var PlacesMenuDNDHandler = {
* This object handles the initialization and uninitialization of the bookmarks
* toolbar.
*/
-let PlacesToolbarHelper = {
+var PlacesToolbarHelper = {
_place: "place:folder=TOOLBAR",
get _viewElt() {
@@ -1006,7 +1019,7 @@ let PlacesToolbarHelper = {
* menu button.
*/
-let BookmarkingUI = {
+var BookmarkingUI = {
get button() {
if (!this._button) {
this._button = document.getElementById("bookmarks-menu-button");
diff --git a/application/palemoon/base/content/browser-plugins.js b/application/palemoon/base/content/browser-plugins.js
index 769ac6d8af..8382682038 100644
--- a/application/palemoon/base/content/browser-plugins.js
+++ b/application/palemoon/base/content/browser-plugins.js
@@ -470,28 +470,12 @@ var gPluginHandler = {
}
},
- // Match the behaviour of nsPermissionManager
- _getHostFromPrincipal: function PH_getHostFromPrincipal(principal) {
- if (!principal.URI || principal.URI.schemeIs("moz-nullprincipal")) {
- return "(null)";
- }
-
- try {
- if (principal.URI.host)
- return principal.URI.host;
- } catch (e) {}
-
- return principal.origin;
- },
-
_makeCenterActions: function PH_makeCenterActions(notification) {
let contentWindow = notification.browser.contentWindow;
let cwu = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
let principal = contentWindow.document.nodePrincipal;
- // This matches the behavior of nsPermssionManager, used for display purposes only
- let principalHost = this._getHostFromPrincipal(principal);
let centerActions = [];
let pluginsFound = new Set();
@@ -517,11 +501,11 @@ var gPluginHandler = {
let permissionObj = Services.perms.
getPermissionObject(principal, pluginInfo.permissionString, false);
if (permissionObj) {
- pluginInfo.pluginPermissionHost = permissionObj.host;
+ pluginInfo.pluginPermissionPrePath = permissionObj.principal.originNoSuffix;
pluginInfo.pluginPermissionType = permissionObj.expireType;
}
else {
- pluginInfo.pluginPermissionHost = principalHost;
+ pluginInfo.pluginPermissionPrePath = principal.originNoSuffix;
pluginInfo.pluginPermissionType = undefined;
}
diff --git a/application/palemoon/base/content/browser-sets.inc b/application/palemoon/base/content/browser-sets.inc
index 78cfb7faad..64228678ec 100644
--- a/application/palemoon/base/content/browser-sets.inc
+++ b/application/palemoon/base/content/browser-sets.inc
@@ -92,24 +92,9 @@
<command id="Tools:Search" oncommand="BrowserSearch.webSearch();"/>
<command id="Tools:Downloads" oncommand="BrowserDownloadsUI();"/>
-#ifdef MOZ_DEVTOOLS
- <command id="Tools:DevToolbox" oncommand="gDevToolsBrowser.toggleToolboxCommand(gBrowser);"/>
- <command id="Tools:DevToolbar" oncommand="DeveloperToolbar.toggle();" disabled="true" hidden="true"/>
- <command id="Tools:DevToolbarFocus" oncommand="DeveloperToolbar.focusToggle();" disabled="true"/>
- <command id="Tools:DevAppMgr" oncommand="gDevToolsBrowser.openAppManager(gBrowser);" disabled="true" hidden="true"/>
- <command id="Tools:WebIDE" oncommand="gDevToolsBrowser.openWebIDE();" disabled="true" hidden="true"/>
- <command id="Tools:ChromeDebugger" oncommand="BrowserToolboxProcess.init();" disabled="true" hidden="true"/>
- <command id="Tools:BrowserConsole" oncommand="HUDService.openBrowserConsoleOrFocus();"/>
- <command id="Tools:Scratchpad" oncommand="Scratchpad.openScratchpad();" disabled="true" hidden="true"/>
- <command id="Tools:ResponsiveUI" oncommand="ResponsiveUI.toggle();" disabled="true" hidden="true"/>
- <command id="Tools:Eyedropper" oncommand="openEyedropper();"/>
-#endif
<command id="Tools:Addons" oncommand="BrowserOpenAddonsMgr();"/>
<command id="Tools:Permissions" oncommand="BrowserOpenPermissionsMgr();"/>
<command id="Tools:ErrorConsole" oncommand="toJavaScriptConsole()" disabled="true" hidden="true"/>
-#ifdef MOZ_DEVTOOLS
- <command id="Tools:DevToolsConnect" oncommand="gDevToolsBrowser.openConnectScreen(gBrowser)" disabled="true" hidden="true"/>
-#endif
<command id="Tools:Sanitize"
oncommand="Cc['@mozilla.org/browser/browserglue;1'].getService(Ci.nsIBrowserGlue).sanitize(window);"/>
<command id="Tools:PrivateBrowsing"
@@ -170,46 +155,6 @@
#endif
<broadcaster id="workOfflineMenuitemState"/>
-#ifdef MOZ_DEVTOOLS
- <!-- DevTools broadcasters -->
- <broadcaster id="devtoolsMenuBroadcaster_DevToolbox"
- label="&devToolboxMenuItem.label;"
- type="checkbox" autocheck="false"
- command="Tools:DevToolbox"
- key="key_devToolbox"/>
- <broadcaster id="devtoolsMenuBroadcaster_DevToolbar"
- label="&devToolbarMenu.label;"
- type="checkbox" autocheck="false"
- command="Tools:DevToolbar"
- key="key_devToolbar"/>
- <broadcaster id="devtoolsMenuBroadcaster_DevAppMgr"
- label="&devAppMgrMenu.label;"
- command="Tools:DevAppMgr"/>
- <broadcaster id="devtoolsMenuBroadcaster_webide"
- label="&webide.label;"
- command="Tools:WebIDE"
- key="key_webide"/>
- <broadcaster id="devtoolsMenuBroadcaster_ChromeDebugger"
- label="&chromeDebuggerMenu.label;"
- command="Tools:ChromeDebugger"/>
- <broadcaster id="devtoolsMenuBroadcaster_BrowserConsole"
- label="&browserConsoleCmd.label;"
- key="key_browserConsole"
- command="Tools:BrowserConsole"/>
- <broadcaster id="devtoolsMenuBroadcaster_Scratchpad"
- label="&scratchpad.label;"
- command="Tools:Scratchpad"
- key="key_scratchpad"/>
- <broadcaster id="devtoolsMenuBroadcaster_ResponsiveUI"
- label="&responsiveDesignTool.label;"
- type="checkbox" autocheck="false"
- command="Tools:ResponsiveUI"
- key="key_responsiveUI"/>
- <broadcaster id="devtoolsMenuBroadcaster_Eyedropper"
- label="&eyedropper.label;"
- type="checkbox" autocheck="false"
- command="Tools:Eyedropper"/>
-#endif
<broadcaster id="devtoolsMenuBroadcaster_PageSource"
label="&pageSourceCmd.label;"
key="key_viewSource"
@@ -217,14 +162,6 @@
<broadcaster id="devtoolsMenuBroadcaster_ErrorConsole"
label="&errorConsoleCmd.label;"
command="Tools:ErrorConsole"/>
- <broadcaster id="devtoolsMenuBroadcaster_GetMoreTools"
- label="&getMoreDevtoolsCmd.label;"
- oncommand="openUILinkIn(gPrefService.getCharPref('browser.getdevtools.url'), 'tab');"/>
-#ifdef MOZ_DEVTOOLS
- <broadcaster id="devtoolsMenuBroadcaster_connect"
- label="&devtoolsConnect.label;"
- command="Tools:DevToolsConnect"/>
-#endif
</broadcasterset>
<keyset id="mainKeyset">
@@ -271,21 +208,6 @@
<key id="key_openDownloads" key="&downloads.commandkey;" command="Tools:Downloads" modifiers="accel"/>
#endif
<key id="key_openAddons" key="&addons.commandkey;" command="Tools:Addons" modifiers="accel,shift"/>
-#ifdef MOZ_DEVTOOLS
- <key id="key_browserConsole" key="&browserConsoleCmd.commandkey;" command="Tools:BrowserConsole" modifiers="accel,shift"/>
- <key id="key_devToolbox" keycode="VK_F12" keytext="F12" command="Tools:DevToolbox"/>
- <key id="key_devToolbar" keycode="&devToolbar.keycode;" modifiers="shift"
- keytext="&devToolbar.keytext;" command="Tools:DevToolbarFocus"/>
- <key id="key_responsiveUI" key="&responsiveDesignTool.commandkey;" command="Tools:ResponsiveUI"
-#ifdef XP_MACOSX
- modifiers="accel,alt"
-#else
- modifiers="accel,shift"
-#endif
- />
- <key id="key_scratchpad" keycode="&scratchpad.keycode;" modifiers="shift"
- keytext="&scratchpad.keytext;" command="Tools:Scratchpad"/>
-#endif
<key id="openFileKb" key="&openFileCmd.commandkey;" command="Browser:OpenFile" modifiers="accel"/>
<key id="key_savePage" key="&savePageCmd.commandkey;" command="Browser:SavePage" modifiers="accel"/>
<key id="printKb" key="&printCmd.commandkey;" command="cmd_print" modifiers="accel"/>
diff --git a/application/palemoon/base/content/browser-syncui.js b/application/palemoon/base/content/browser-syncui.js
index fc8c7f0162..67056e2210 100644
--- a/application/palemoon/base/content/browser-syncui.js
+++ b/application/palemoon/base/content/browser-syncui.js
@@ -3,7 +3,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
// gSyncUI handles updating the tools menu
-let gSyncUI = {
+var gSyncUI = {
_obs: ["weave:service:sync:start",
"weave:service:sync:delayed",
"weave:service:quota:remaining",
diff --git a/application/palemoon/base/content/browser-thumbnails.js b/application/palemoon/base/content/browser-thumbnails.js
index dbe33e3ed2..079b0ac1be 100644
--- a/application/palemoon/base/content/browser-thumbnails.js
+++ b/application/palemoon/base/content/browser-thumbnails.js
@@ -7,7 +7,7 @@
/**
* Keeps thumbnails of open web pages up-to-date.
*/
-let gBrowserThumbnails = {
+var gBrowserThumbnails = {
/**
* Pref that controls whether we can store SSL content on disk
*/
@@ -92,7 +92,12 @@ let gBrowserThumbnails = {
filterForThumbnailExpiration:
function Thumbnails_filterForThumbnailExpiration(aCallback) {
- aCallback([browser.currentURI.spec for (browser of gBrowser.browsers)]);
+ // Tycho: aCallback([browser.currentURI.spec for (browser of gBrowser.browsers)]);
+ let result = [];
+ for (let browser of gBrowser.browsers) {
+ result.push(browser.currentURI.spec);
+ }
+ aCallback(result);
},
/**
@@ -137,7 +142,7 @@ let gBrowserThumbnails = {
// FIXME Bug 720575 - Don't capture thumbnails for SVG or XML documents as
// that currently regresses Talos SVG tests.
- if (doc instanceof SVGDocument || doc instanceof XMLDocument)
+ if (doc instanceof XMLDocument)
return false;
// There's no point in taking screenshot of loading pages.
diff --git a/application/palemoon/base/content/browser-uacompat.js b/application/palemoon/base/content/browser-uacompat.js
new file mode 100644
index 0000000000..933aa55d16
--- /dev/null
+++ b/application/palemoon/base/content/browser-uacompat.js
@@ -0,0 +1,45 @@
+/* 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 UserAgentCompatibility = {
+ PREF_UA_COMPAT: "general.useragent.compatMode",
+ PREF_UA_COMPAT_GECKO: "general.useragent.compatMode.gecko",
+ PREF_UA_COMPAT_FIREFOX: "general.useragent.compatMode.firefox",
+
+ init: function() {
+ this.checkPreferences();
+ Services.prefs.addObserver(this.PREF_UA_COMPAT, this, false);
+ Services.prefs.addObserver(this.PREF_UA_COMPAT_GECKO, this, false);
+ Services.prefs.addObserver(this.PREF_UA_COMPAT_FIREFOX, this, false);
+ },
+
+ uninit: function() {
+ Services.prefs.removeObserver(this.PREF_UA_COMPAT, this, false);
+ Services.prefs.removeObserver(this.PREF_UA_COMPAT_GECKO, this, false);
+ Services.prefs.removeObserver(this.PREF_UA_COMPAT_FIREFOX, this, false);
+ },
+
+ observe: function() {
+ this.checkPreferences();
+ },
+
+ checkPreferences: function() {
+ var compatMode = Services.prefs.getIntPref(this.PREF_UA_COMPAT);
+
+ switch(compatMode) {
+ case 0:
+ Services.prefs.setBoolPref(this.PREF_UA_COMPAT_GECKO, false);
+ Services.prefs.setBoolPref(this.PREF_UA_COMPAT_FIREFOX, false);
+ break;
+ case 1:
+ Services.prefs.setBoolPref(this.PREF_UA_COMPAT_GECKO, true);
+ Services.prefs.setBoolPref(this.PREF_UA_COMPAT_FIREFOX, false);
+ break;
+ case 2:
+ Services.prefs.setBoolPref(this.PREF_UA_COMPAT_GECKO, true);
+ Services.prefs.setBoolPref(this.PREF_UA_COMPAT_FIREFOX, true);
+ break;
+ }
+ }
+};
diff --git a/application/palemoon/base/content/browser-webrtcUI.js b/application/palemoon/base/content/browser-webrtcUI.js
index a6c9008ca9..d59134ce53 100644
--- a/application/palemoon/base/content/browser-webrtcUI.js
+++ b/application/palemoon/base/content/browser-webrtcUI.js
@@ -3,7 +3,7 @@
# 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/.
-let WebrtcIndicator = {
+var WebrtcIndicator = {
init: function () {
let temp = {};
Cu.import("resource:///modules/webrtcUI.jsm", temp);
diff --git a/application/palemoon/base/content/browser.css b/application/palemoon/base/content/browser.css
index 2c8ba3e694..6586559702 100644
--- a/application/palemoon/base/content/browser.css
+++ b/application/palemoon/base/content/browser.css
@@ -115,8 +115,17 @@ toolbar[printpreview="true"] {
#titlebar {
-moz-binding: url("chrome://global/content/bindings/general.xml#windowdragbox");
+ -moz-window-dragging: drag;
}
+%ifdef XP_WIN
+#main-window[tabsontop="true"] #TabsToolbar,
+#main-window[tabsontop="true"] #toolbar-menubar,
+#main-window[tabsontop="true"] #navigator-toolbox > toolbar:-moz-lwtheme {
+ -moz-window-dragging: drag;
+}
+%endif
+
#titlebar-spacer {
pointer-events: none;
}
@@ -271,6 +280,10 @@ panel[noactions] > richlistbox > richlistitem[type~="action"] > .ac-url-box > .a
-moz-binding: url("chrome://browser/content/urlbarBindings.xml#urlbar-rich-result-popup");
}
+#DateTimePickerPanel[active="true"] {
+ -moz-binding: url("chrome://global/content/bindings/datetimepopup.xml#datetime-popup");
+}
+
/* Pale Moon: Address bar: Feeds */
#ub-feed-button > .button-box > .box-inherit > .button-text,
#ub-feed-button > .button-box > .button-menu-dropmarker {
@@ -315,6 +328,66 @@ panel[noactions] > richlistbox > richlistitem[type~="action"] > .ac-url-box > .a
visibility: hidden;
}
+/* Private Autocomplete */
+textbox[type="private-autocomplete"] {
+ -moz-binding: url("chrome://browser/content/autocomplete.xml#autocomplete");
+}
+
+panel[type="private-autocomplete"] {
+ -moz-binding: url("chrome://browser/content/autocomplete.xml#autocomplete-result-popup");
+}
+
+panel[type="private-autocomplete-richlistbox"] {
+ -moz-binding: url("chrome://browser/content/autocomplete.xml#private-autocomplete-rich-result-popup");
+}
+
+.private-autocomplete-tree {
+ -moz-binding: url("chrome://browser/content/autocomplete.xml#private-autocomplete-tree");
+ -moz-user-focus: ignore;
+}
+
+.private-autocomplete-treebody {
+ -moz-binding: url("chrome://browser/content/autocomplete.xml#private-autocomplete-treebody");
+}
+
+.private-autocomplete-richlistbox {
+ -moz-binding: url("chrome://browser/content/autocomplete.xml#private-autocomplete-richlistbox");
+ -moz-user-focus: ignore;
+}
+
+.private-autocomplete-richlistbox > scrollbox {
+ overflow-x: hidden !important;
+}
+
+.private-autocomplete-richlistitem {
+ -moz-binding: url("chrome://browser/content/autocomplete.xml#private-autocomplete-richlistitem");
+ -moz-box-orient: vertical;
+ overflow: -moz-hidden-unscrollable;
+}
+
+.private-autocomplete-treerows {
+ -moz-binding: url("chrome://browser/content/autocomplete.xml#private-autocomplete-treerows");
+}
+
+.private-autocomplete-history-dropmarker {
+ display: none;
+}
+
+.private-autocomplete-history-dropmarker[enablehistory="true"] {
+ display: -moz-box;
+ -moz-binding: url("chrome://browser/content/autocomplete.xml#private-history-dropmarker");
+}
+
+.ac-ellipsis-after {
+ visibility: hidden;
+}
+
+.ac-url-text[type~="action"],
+.ac-action-text:not([type~="action"]) {
+ visibility: collapse;
+}
+
+
/* ::::: Unified Back-/Forward Button ::::: */
#back-button > .toolbarbutton-menu-dropmarker,
#forward-button > .toolbarbutton-menu-dropmarker {
@@ -533,11 +606,11 @@ window[chromehidden~="toolbar"] toolbar:not(.toolbar-primary):not(#nav-bar):not(
max-width: 280px;
}
-.form-validation-anchor {
+.popup-anchor {
/* should occupy space but not be visible */
opacity: 0;
- visibility: hidden;
pointer-events: none;
+ -moz-stack-sizing: ignore;
}
#addon-progress-notification {
@@ -618,10 +691,6 @@ statuspanel[inactive][previoustype=overLink] {
-moz-box-align: end;
}
-.panel-inner-arrowcontentfooter[footertype="promobox"] {
- -moz-binding: url("chrome://browser/content/urlbarBindings.xml#promobox");
-}
-
/* highlighter */
%include highlighter.css
@@ -681,7 +750,7 @@ toolbarbutton[type="badged"] {
}
/* Strict icon size for PMkit 'ui/button' */
-toolbarbutton[pmkit-button="true"] > .toolbarbutton-badge-container > .toolbarbutton-icon {
+toolbarbutton[pmkit-button="true"] > .toolbarbutton-badge-stack > .toolbarbutton-icon {
width: 16px;
height: 16px;
}
diff --git a/application/palemoon/base/content/browser.js b/application/palemoon/base/content/browser.js
index 34b91b6cb1..9f4d66c07d 100644
--- a/application/palemoon/base/content/browser.js
+++ b/application/palemoon/base/content/browser.js
@@ -3,12 +3,16 @@
# 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/.
-let Ci = Components.interfaces;
-let Cu = Components.utils;
+var Ci = Components.interfaces;
+var Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource:///modules/RecentWindow.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "Task",
+ "resource://gre/modules/Task.jsm");
+
XPCOMUtils.defineLazyModuleGetter(this, "CharsetMenu",
"resource:///modules/CharsetMenu.jsm");
@@ -65,6 +69,9 @@ XPCOMUtils.defineLazyGetter(window, "gFindBar", function() {
return findbar;
});
+XPCOMUtils.defineLazyModuleGetter(this, "BrowserUtils",
+ "resource://gre/modules/BrowserUtils.jsm");
+
XPCOMUtils.defineLazyGetter(this, "gPrefService", function() {
return Services.prefs;
});
@@ -79,14 +86,8 @@ this.__defineSetter__("AddonManager", function (val) {
return this.AddonManager = val;
});
-this.__defineGetter__("PluralForm", function() {
- Cu.import("resource://gre/modules/PluralForm.jsm");
- return this.PluralForm;
-});
-this.__defineSetter__("PluralForm", function (val) {
- delete this.PluralForm;
- return this.PluralForm = val;
-});
+XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
+ "resource://gre/modules/PluralForm.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AboutHomeUtils",
"resource:///modules/AboutHomeUtils.jsm");
@@ -109,20 +110,6 @@ XPCOMUtils.defineLazyGetter(this, "PopupNotifications", function () {
}
});
-#ifdef MOZ_DEVTOOLS
-XPCOMUtils.defineLazyGetter(this, "DeveloperToolbar", function() {
- let tmp = {};
- Cu.import("resource://gre/modules/devtools/DeveloperToolbar.jsm", tmp);
- return new tmp.DeveloperToolbar(window, document.getElementById("developer-toolbar"));
-});
-
-XPCOMUtils.defineLazyGetter(this, "BrowserToolboxProcess", function() {
- let tmp = {};
- Cu.import("resource://gre/modules/devtools/ToolboxProcess.jsm", tmp);
- return tmp.BrowserToolboxProcess;
-});
-#endif
-
XPCOMUtils.defineLazyModuleGetter(this, "PageThumbs",
"resource://gre/modules/PageThumbs.jsm");
@@ -135,7 +122,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
XPCOMUtils.defineLazyModuleGetter(this, "FormValidationHandler",
"resource:///modules/FormValidationHandler.jsm");
-let gInitialPages = [
+var gInitialPages = [
"about:blank",
"about:newtab",
"about:home",
@@ -152,7 +139,12 @@ let gInitialPages = [
#include browser-plugins.js
#include browser-tabPreviews.js
#include browser-thumbnails.js
+#include browser-uacompat.js
+
+#ifdef MOZ_WEBRTC
#include browser-webrtcUI.js
+#endif
+
#include browser-gestureSupport.js
#ifdef MOZ_SERVICES_SYNC
@@ -336,6 +328,48 @@ const gSessionHistoryObserver = {
}
};
+var gURLBarSettings = {
+ prefSuggest: "browser.urlbar.suggest.",
+ /*
+ For searching in the source code:
+ browser.urlbar.suggest.bookmark
+ browser.urlbar.suggest.history
+ browser.urlbar.suggest.openpage
+ */
+ prefSuggests: [
+ "bookmark",
+ "history",
+ "openpage"
+ ],
+ prefKeyword: "keyword.enabled",
+
+ observe: function(aSubject, aTopic, aData) {
+ if (aTopic != "nsPref:changed")
+ return;
+
+ this.writePlaceholder();
+ },
+
+ writePlaceholder: function() {
+ let attribute = "placeholder";
+ let prefs = this.prefSuggests.map(pref => {
+ return this.prefSuggest + pref;
+ });
+ prefs.push(this.prefKeyword);
+ let placeholderDefault = prefs.some(pref => {
+ return gPrefService.getBoolPref(pref);
+ });
+
+ if (placeholderDefault) {
+ gURLBar.setAttribute(
+ attribute, gNavigatorBundle.getString("urlbar.placeholder"));
+ } else {
+ gURLBar.setAttribute(
+ attribute, gNavigatorBundle.getString("urlbar.placeholderURLOnly"));
+ }
+ }
+};
+
/**
* Given a starting docshell and a URI to look up, find the docshell the URI
* is loaded in.
@@ -663,6 +697,8 @@ const gXSSObserver = {
};
var gBrowserInit = {
+ delayedStartupFinished: false,
+
onLoad: function() {
gMultiProcessBrowser = gPrefService.getBoolPref("browser.tabs.remote");
@@ -685,6 +721,14 @@ var gBrowserInit = {
window.addEventListener("AppCommand", HandleAppCommandEvent, true);
+ // These routines add message listeners. They must run before
+ // loading the frame script to ensure that we don't miss any
+ // message sent between when the frame script is loaded and when
+ // the listener is registered.
+#ifdef MOZ_DEVTOOLS
+ DevToolsTheme.init();
+#endif
+
messageManager.loadFrameScript("chrome://browser/content/content.js", true);
messageManager.loadFrameScript("chrome://browser/content/content-sessionStore.js", true);
@@ -872,6 +916,7 @@ var gBrowserInit = {
TabsInTitlebar.init();
retrieveToolbarIconsizesFromTheme();
ToolbarIconColor.init();
+ UserAgentCompatibility.init();
#ifdef XP_WIN
if (window.matchMedia("(-moz-os-version: windows-win8)").matches &&
@@ -945,12 +990,23 @@ var gBrowserInit = {
gBrowser.swapBrowsersAndCloseOther(gBrowser.selectedTab, uriToLoad);
}
- // window.arguments[2]: referrer (nsIURI)
+ // window.arguments[2]: referrer (nsIURI | string)
// [3]: postData (nsIInputStream)
// [4]: allowThirdPartyFixup (bool)
+ // [5]: referrerPolicy (int)
else if (window.arguments.length >= 3) {
- loadURI(uriToLoad, window.arguments[2], window.arguments[3] || null,
- window.arguments[4] || false);
+ let referrerURI = window.arguments[2];
+ if (typeof(referrerURI) == "string") {
+ try {
+ referrerURI = makeURI(referrerURI);
+ } catch (e) {
+ referrerURI = null;
+ }
+ }
+ let referrerPolicy = (window.arguments[5] != undefined ?
+ window.arguments[5] : Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT);
+ loadURI(uriToLoad, referrerURI, window.arguments[3] || null,
+ window.arguments[4] || false, referrerPolicy);
window.focus();
}
// Note: loadOneOrMoreURIs *must not* be called if window.arguments.length >= 3.
@@ -968,11 +1024,18 @@ var gBrowserInit = {
Services.obs.addObserver(gXPInstallObserver, "addon-install-complete", false);
Services.obs.addObserver(gXSSObserver, "xss-on-violate-policy", false);
+ gPrefService.addObserver(gURLBarSettings.prefSuggest, gURLBarSettings, false);
+ gPrefService.addObserver(gURLBarSettings.prefKeyword, gURLBarSettings, false);
+
+ gURLBarSettings.writePlaceholder();
+
BrowserOffline.init();
OfflineApps.init();
IndexedDBPromptHelper.init();
AddonManager.addAddonListener(AddonsMgrListener);
+#ifdef MOZ_WEBRTC
WebrtcIndicator.init();
+#endif
// Ensure login manager is up and running.
Services.logins;
@@ -1114,27 +1177,6 @@ var gBrowserInit = {
setUrlAndSearchBarWidthForConditionalForwardButton();
});
-#ifdef MOZ_DEVTOOLS
- // Enable Chrome Debugger?
- let chromeEnabled = gPrefService.getBoolPref("devtools.chrome.enabled");
- let remoteEnabled = chromeEnabled &&
- gPrefService.getBoolPref("devtools.debugger.chrome-enabled") &&
- gPrefService.getBoolPref("devtools.debugger.remote-enabled");
- if (remoteEnabled) {
- let cmd = document.getElementById("Tools:ChromeDebugger");
- cmd.removeAttribute("disabled");
- cmd.removeAttribute("hidden");
- }
-
- // Enable Scratchpad in the UI, if the preference allows this.
- let scratchpadEnabled = gPrefService.getBoolPref(Scratchpad.prefEnabledName);
- if (scratchpadEnabled) {
- let cmd = document.getElementById("Tools:Scratchpad");
- cmd.removeAttribute("disabled");
- cmd.removeAttribute("hidden");
- }
-#endif
-
// Enable Error Console?
let consoleEnabled = gPrefService.getBoolPref("devtools.errorconsole.enabled");
if (consoleEnabled) {
@@ -1152,19 +1194,6 @@ var gBrowserInit = {
document.getElementById("appmenu_charsetMenu").hidden = true;
#endif
-#ifdef MOZ_DEVTOOLS
- // Enable Responsive UI?
- let responsiveUIEnabled = gPrefService.getBoolPref("devtools.responsiveUI.enabled");
- if (responsiveUIEnabled) {
- let cmd = document.getElementById("Tools:ResponsiveUI");
- cmd.removeAttribute("disabled");
- cmd.removeAttribute("hidden");
- }
-
- // Add Devtools menuitems and listeners
- gDevToolsBrowser.registerBrowserWindow(window);
-#endif
-
let appMenuButton = document.getElementById("appmenu-button");
let appMenuPopup = document.getElementById("appmenu-popup");
if (appMenuButton && appMenuPopup) {
@@ -1205,6 +1234,8 @@ var gBrowserInit = {
setTimeout(function () { BrowserChromeTest.markAsReady(); }, 0);
});
+ this.delayedStartupFinished = true;
+
Services.obs.notifyObservers(window, "browser-delayed-startup-finished", "");
},
@@ -1240,15 +1271,6 @@ var gBrowserInit = {
if (!this._loadHandled)
return;
-#ifdef MOZ_DEVTOOLS
- gDevToolsBrowser.forgetBrowserWindow(window);
-
- let desc = Object.getOwnPropertyDescriptor(window, "DeveloperToolbar");
- if (desc && !desc.get) {
- DeveloperToolbar.destroy();
- }
-#endif
-
// First clean up services initialized in gBrowserInit.onLoad (or those whose
// uninit methods don't depend on the services having been initialized).
@@ -1278,6 +1300,12 @@ var gBrowserInit = {
ToolbarIconColor.uninit();
+#ifdef MOZ_DEVTOOLS
+ DevToolsTheme.uninit();
+#endif
+
+ UserAgentCompatibility.uninit();
+
var enumerator = Services.wm.getEnumerator(null);
enumerator.getNext();
if (!enumerator.hasMoreElements()) {
@@ -1314,6 +1342,13 @@ var gBrowserInit = {
Services.obs.removeObserver(gXSSObserver, "xss-on-violate-policy");
try {
+ gPrefService.removeObserver(gURLBarSettings.prefSuggest, gURLBarSettings);
+ gPrefService.removeObserver(gURLBarSettings.prefKeyword, gURLBarSettings);
+ } catch (ex) {
+ Cu.reportError(ex);
+ }
+
+ try {
gPrefService.removeObserver(gHomeButton.prefDomain, gHomeButton);
} catch (ex) {
Cu.reportError(ex);
@@ -1859,7 +1894,7 @@ function BrowserTryToCloseWindow()
window.close(); // WindowIsClosing does all the necessary checks
}
-function loadURI(uri, referrer, postData, allowThirdPartyFixup) {
+function loadURI(uri, referrer, postData, allowThirdPartyFixup, referrerPolicy) {
if (postData === undefined)
postData = null;
@@ -1870,92 +1905,135 @@ function loadURI(uri, referrer, postData, allowThirdPartyFixup) {
}
try {
- gBrowser.loadURIWithFlags(uri, flags, referrer, null, postData);
+ gBrowser.loadURIWithFlags(uri, {
+ flags: flags,
+ referrerURI: referrer,
+ referrerPolicy: referrerPolicy,
+ postData: postData,
+ });
} catch (e) {}
}
-function getShortcutOrURI(aURL, aPostDataRef, aMayInheritPrincipal) {
- // Initialize outparam to false
- if (aMayInheritPrincipal)
- aMayInheritPrincipal.value = false;
+/**
+ * Given a urlbar value, discerns between URIs, keywords and aliases.
+ *
+ * @param url
+ * The urlbar value.
+ * @param callback (optional, deprecated)
+ * The callback function invoked when done. This parameter is
+ * deprecated, please use the Promise that is returned.
+ *
+ * @return Promise<{ postData, url, mayInheritPrincipal }>
+ */
+function getShortcutOrURIAndPostData(url, callback = null) {
+ if (callback) {
+ Deprecated.warning("Please use the Promise returned by " +
+ "getShortcutOrURIAndPostData() instead of passing a " +
+ "callback",
+ "https://bugzilla.mozilla.org/show_bug.cgi?id=1100294");
+ }
- var shortcutURL = null;
- var keyword = aURL;
- var param = "";
+ return Task.spawn(function* () {
+ let mayInheritPrincipal = false;
+ let postData = null;
+ let shortcutURL = null;
+ let keyword = url;
+ let param = "";
- var offset = aURL.indexOf(" ");
- if (offset > 0) {
- keyword = aURL.substr(0, offset);
- param = aURL.substr(offset + 1);
- }
+ let offset = url.indexOf(" ");
+ if (offset > 0) {
+ keyword = url.substr(0, offset);
+ param = url.substr(offset + 1);
+ }
- if (!aPostDataRef)
- aPostDataRef = {};
+ let engine = Services.search.getEngineByAlias(keyword);
+ if (engine) {
+ let submission = engine.getSubmission(param, null, "keyword");
+ postData = submission.postData;
+ return { postData: submission.postData, url: submission.uri.spec,
+ mayInheritPrincipal };
+ }
- var engine = Services.search.getEngineByAlias(keyword);
- if (engine) {
- var submission = engine.getSubmission(param);
- aPostDataRef.value = submission.postData;
- return submission.uri.spec;
- }
+ let entry = yield PlacesUtils.keywords.fetch(keyword);
+ if (entry) {
+ shortcutURL = entry.url.href;
+ postData = entry.postData;
+ }
- [shortcutURL, aPostDataRef.value] =
- PlacesUtils.getURLAndPostDataForKeyword(keyword);
+ if (!shortcutURL) {
+ return { postData, url, mayInheritPrincipal };
+ }
- if (!shortcutURL)
- return aURL;
+ let escapedPostData = "";
+ if (postData)
+ escapedPostData = unescape(postData);
- var postData = "";
- if (aPostDataRef.value)
- postData = unescape(aPostDataRef.value);
+ if (/%s/i.test(shortcutURL) || /%s/i.test(escapedPostData)) {
+ let charset = "";
+ const re = /^(.*)\&mozcharset=([a-zA-Z][_\-a-zA-Z0-9]+)\s*$/;
+ let matches = shortcutURL.match(re);
- if (/%s/i.test(shortcutURL) || /%s/i.test(postData)) {
- var charset = "";
- const re = /^(.*)\&mozcharset=([a-zA-Z][_\-a-zA-Z0-9]+)\s*$/;
- var matches = shortcutURL.match(re);
- if (matches)
- [, shortcutURL, charset] = matches;
- else {
- // Try to get the saved character-set.
- try {
- // makeURI throws if URI is invalid.
- // Will return an empty string if character-set is not found.
- charset = PlacesUtils.history.getCharsetForURI(makeURI(shortcutURL));
- } catch (e) {}
- }
+ if (matches) {
+ [, shortcutURL, charset] = matches;
+ } else {
+ let uri;
+ try {
+ // makeURI() throws if URI is invalid.
+ uri = makeURI(shortcutURL);
+ } catch (ex) {}
+
+ if (uri) {
+ // Try to get the saved character-set.
+ // Will return an empty string if character-set is not found.
+ charset = yield PlacesUtils.getCharsetForURI(uri);
+ }
+ }
- // encodeURIComponent produces UTF-8, and cannot be used for other charsets.
- // escape() works in those cases, but it doesn't uri-encode +, @, and /.
- // Therefore we need to manually replace these ASCII characters by their
- // encodeURIComponent result, to match the behavior of nsEscape() with
- // url_XPAlphas
- var encodedParam = "";
- if (charset && charset != "UTF-8")
- encodedParam = escape(convertFromUnicode(charset, param)).
- replace(/[+@\/]+/g, encodeURIComponent);
- else // Default charset is UTF-8
- encodedParam = encodeURIComponent(param);
+ // encodeURIComponent produces UTF-8, and cannot be used for other charsets.
+ // escape() works in those cases, but it doesn't uri-encode +, @, and /.
+ // Therefore we need to manually replace these ASCII characters by their
+ // encodeURIComponent result, to match the behavior of nsEscape() with
+ // url_XPAlphas
+ let encodedParam = "";
+ if (charset && charset != "UTF-8")
+ encodedParam = escape(convertFromUnicode(charset, param)).
+ replace(/[+@\/]+/g, encodeURIComponent);
+ else // Default charset is UTF-8
+ encodedParam = encodeURIComponent(param);
- shortcutURL = shortcutURL.replace(/%s/g, encodedParam).replace(/%S/g, param);
+ shortcutURL = shortcutURL.replace(/%s/g, encodedParam).replace(/%S/g, param);
- if (/%s/i.test(postData)) // POST keyword
- aPostDataRef.value = getPostDataStream(postData, param, encodedParam,
- "application/x-www-form-urlencoded");
- }
- else if (param) {
- // This keyword doesn't take a parameter, but one was provided. Just return
- // the original URL.
- aPostDataRef.value = null;
+ if (/%s/i.test(escapedPostData)) // POST keyword
+ postData = getPostDataStream(escapedPostData, param, encodedParam,
+ "application/x-www-form-urlencoded");
- return aURL;
- }
+ // This URL came from a bookmark, so it's safe to let it inherit the current
+ // document's principal.
+ mayInheritPrincipal = true;
+
+ return { postData, url: shortcutURL, mayInheritPrincipal };
+ }
+
+ if (param) {
+ // This keyword doesn't take a parameter, but one was provided. Just return
+ // the original URL.
+ postData = null;
+
+ return { postData, url, mayInheritPrincipal };
+ }
+
+ // This URL came from a bookmark, so it's safe to let it inherit the current
+ // document's principal.
+ mayInheritPrincipal = true;
- // This URL came from a bookmark, so it's safe to let it inherit the current
- // document's principal.
- if (aMayInheritPrincipal)
- aMayInheritPrincipal.value = true;
+ return { postData, url: shortcutURL, mayInheritPrincipal };
+ }).then(data => {
+ if (callback) {
+ callback(data);
+ }
- return shortcutURL;
+ return data;
+ });
}
function getPostDataStream(aStringData, aKeyword, aEncKeyword, aType) {
@@ -2010,49 +2088,43 @@ function readFromClipboard()
return url;
}
-function BrowserViewSourceOfDocument(aDocument)
+function BrowserViewSourceOfDocument(aArgsOrDocument)
{
- var pageCookie;
- var webNav;
+ let args;
+
+ if (aArgsOrDocument instanceof Document) {
+ let doc = aArgsOrDocument;
+
+ let requestor = doc.defaultView
+ .QueryInterface(Ci.nsIInterfaceRequestor);
+ let browser = requestor.getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShell)
+ .chromeEventHandler;
+ let outerWindowID = requestor.getInterface(Ci.nsIDOMWindowUtils)
+ .outerWindowID;
+ let URL = browser.currentURI.spec;
+ args = { browser, outerWindowID, URL };
+ } else {
+ args = aArgsOrDocument;
+ }
- // Get the document charset
- var docCharset = "charset=" + aDocument.characterSet;
+ let viewInternal = () => {
+ top.gViewSourceUtils.viewSource(args);
+ }
- // Get the nsIWebNavigation associated with the document
- try {
- var win;
- var ifRequestor;
-
- // Get the DOMWindow for the requested document. If the DOMWindow
- // cannot be found, then just use the content window...
- //
- // XXX: This is a bit of a hack...
- win = aDocument.defaultView;
- if (win == window) {
- win = content;
+ // Check if external view source is enabled. If so, try it. If it fails,
+ // fallback to internal view source.
+ if (Services.prefs.getBoolPref("view_source.editor.external")) {
+ top.gViewSourceUtils
+ .openInExternalEditor(args, null, null, null, result => {
+ if (!result) {
+ viewInternal();
}
- ifRequestor = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor);
-
- webNav = ifRequestor.getInterface(nsIWebNavigation);
- } catch(err) {
- // If nsIWebNavigation cannot be found, just get the one for the whole
- // window...
- webNav = gBrowser.webNavigation;
- }
- //
- // Get the 'PageDescriptor' for the current document. This allows the
- // view-source to access the cached copy of the content rather than
- // refetching it from the network...
- //
- try{
- var PageLoader = webNav.QueryInterface(Components.interfaces.nsIWebPageDescriptor);
-
- pageCookie = PageLoader.currentDescriptor;
- } catch(err) {
- // If no page descriptor is available, just use the view-source URL...
+ });
+ } else {
+ // Display using internal view source
+ viewInternal();
}
-
- top.gViewSourceUtils.viewSource(webNav.currentURI.spec, pageCookie, aDocument);
}
// doc - document to use for source, or null for this window's document
@@ -2313,7 +2385,7 @@ function BrowserOnAboutPageLoad(doc) {
/**
* Handle command events bubbling up from error page content
*/
-let BrowserOnClick = {
+var BrowserOnClick = {
handleEvent: function BrowserOnClick_handleEvent(aEvent) {
if (!aEvent.isTrusted || // Don't trust synthetic events
aEvent.button == 2 || aEvent.target.localName != "button") {
@@ -2620,8 +2692,8 @@ var browserDragAndDrop = {
}
},
- drop: function (aEvent, aName, aDisallowInherit) {
- return Services.droppedLinkHandler.dropLink(aEvent, aName, aDisallowInherit);
+ dropLinks: function (aEvent, aDisallowInherit) {
+ return Services.droppedLinkHandler.dropLinks(aEvent, aDisallowInherit);
}
};
@@ -2629,8 +2701,10 @@ var homeButtonObserver = {
onDrop: function (aEvent)
{
// disallow setting home pages that inherit the principal
- let url = browserDragAndDrop.drop(aEvent, {}, true);
- setTimeout(openHomeDialog, 0, url);
+ let links = browserDragAndDrop.dropLinks(aEvent, true);
+ if (links.length) {
+ setTimeout(openHomeDialog, 0, links.map(link => link.url).join("|"));
+ }
},
onDragOver: function (aEvent)
@@ -2646,18 +2720,24 @@ var homeButtonObserver = {
function openHomeDialog(aURL)
{
var promptTitle = gNavigatorBundle.getString("droponhometitle");
- var promptMsg = gNavigatorBundle.getString("droponhomemsg");
+ var promptMsg;
+ if (aURL.includes("|")) {
+ promptMsg = gNavigatorBundle.getString("droponhomemsgMultiple");
+ } else {
+ promptMsg = gNavigatorBundle.getString("droponhomemsg");
+ }
+
var pressedVal = Services.prompt.confirmEx(window, promptTitle, promptMsg,
Services.prompt.STD_YES_NO_BUTTONS,
null, null, null, null, {value:0});
if (pressedVal == 0) {
try {
- var str = Components.classes["@mozilla.org/supports-string;1"]
- .createInstance(Components.interfaces.nsISupportsString);
- str.data = aURL;
+ var homepageStr = Components.classes["@mozilla.org/supports-string;1"]
+ .createInstance(Components.interfaces.nsISupportsString);
+ homepageStr.data = aURL;
gPrefService.setComplexValue("browser.startup.homepage",
- Components.interfaces.nsISupportsString, str);
+ Components.interfaces.nsISupportsString, homepageStr);
} catch (ex) {
dump("Failed to set the home page.\n"+ex+"\n");
}
@@ -2705,13 +2785,16 @@ var newTabButtonObserver = {
onDrop: function (aEvent)
{
- let url = browserDragAndDrop.drop(aEvent, { });
- var postData = {};
- url = getShortcutOrURI(url, postData);
- if (url) {
- // allow third-party services to fixup this URL
- openNewTabWith(url, null, postData.value, aEvent, true);
- }
+ let links = browserDragAndDrop.dropLinks(aEvent);
+ Task.spawn(function*() {
+ for (let link of links) {
+ let data = yield getShortcutOrURIAndPostData(link.url);
+ if (data.url) {
+ // allow third-party services to fixup this URL
+ openNewTabWith(data.url, null, data.postData, aEvent, true);
+ }
+ }
+ });
}
}
@@ -2725,13 +2808,16 @@ var newWindowButtonObserver = {
},
onDrop: function (aEvent)
{
- let url = browserDragAndDrop.drop(aEvent, { });
- var postData = {};
- url = getShortcutOrURI(url, postData);
- if (url) {
- // allow third-party services to fixup this URL
- openNewWindowWith(url, null, postData.value, true);
- }
+ let links = browserDragAndDrop.dropLinks(aEvent);
+ Task.spawn(function*() {
+ for (let link of links) {
+ let data = yield getShortcutOrURIAndPostData(link.url);
+ if (data.url) {
+ // allow third-party services to fixup this URL
+ openNewWindowWith(data.url, null, data.postData, true);
+ }
+ }
+ });
}
}
@@ -2833,7 +2919,7 @@ const DOMLinkHandler = {
break;
let tab = gBrowser.tabs[browserIndex];
- gBrowser.setIcon(tab, uri.spec);
+ gBrowser.setIcon(tab, uri.spec, link.ownerDocument.nodePrincipal);
iconAdded = true;
}
break;
@@ -3425,26 +3511,6 @@ function updateCharacterEncodingMenuState()
}
}
-/**
- * Returns true if |aMimeType| is text-based, false otherwise.
- *
- * @param aMimeType
- * The MIME type to check.
- *
- * If adding types to this function, please also check the similar
- * function in findbar.xml
- */
-function mimeTypeIsTextBased(aMimeType)
-{
- return aMimeType.startsWith("text/") ||
- aMimeType.endsWith("+xml") ||
- aMimeType == "application/x-javascript" ||
- aMimeType == "application/javascript" ||
- aMimeType == "application/json" ||
- aMimeType == "application/xml" ||
- aMimeType == "mozilla.application/cached-xul";
-}
-
var XULBrowserWindow = {
// Stored Status, Link and Loading values
status: "",
@@ -3668,7 +3734,7 @@ var XULBrowserWindow = {
this.setDefaultStatus(msg);
// Disable menu entries for images, enable otherwise
- if (!gMultiProcessBrowser && content.document && mimeTypeIsTextBased(content.document.contentType))
+ if (!gMultiProcessBrowser && content.document && BrowserUtils.mimeTypeIsTextBased(content.document.contentType))
this.isImage.removeAttribute('disabled');
else
this.isImage.setAttribute('disabled', 'true');
@@ -3716,7 +3782,7 @@ var XULBrowserWindow = {
}
// Disable menu entries for images, enable otherwise
- if (!gMultiProcessBrowser && content.document && mimeTypeIsTextBased(content.document.contentType))
+ if (!gMultiProcessBrowser && content.document && BrowserUtils.mimeTypeIsTextBased(content.document.contentType))
this.isImage.removeAttribute('disabled');
else
this.isImage.setAttribute('disabled', 'true');
@@ -3814,11 +3880,16 @@ var XULBrowserWindow = {
gFindBar.close();
}
+ // XXX
+ // See: https://github.com/MoonchildProductions/Pale-Moon/issues/364
+ // An actual preference: findbar.highlightAll
+ /*
if (!(gPrefService.getBoolPref("accessibility.typeaheadfind.highlightallremember") ||
gPrefService.getBoolPref("accessibility.typeaheadfind.highlightallbydefault"))) {
// fix bug 253793 - turn off highlight when page changes
gFindBar.getElement("highlight").checked = false;
}
+ */
}
}
UpdateBackForwardCommands(gBrowser.webNavigation);
@@ -4233,6 +4304,13 @@ nsBrowserAccess.prototype = {
else
aWhere = gPrefService.getIntPref("browser.link.open_newwindow");
}
+
+ let referrer = aOpener ? makeURI(aOpener.location.href) : null;
+ let referrerPolicy = Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT;
+ if (aOpener && aOpener.document) {
+ referrerPolicy = aOpener.document.referrerPolicy;
+ }
+
switch (aWhere) {
case Ci.nsIBrowserDOMWindow.OPEN_NEWWINDOW :
// FIXME: Bug 408379. So how come this doesn't send the
@@ -4271,6 +4349,7 @@ nsBrowserAccess.prototype = {
let tab = win.gBrowser.loadOneTab(aURI ? aURI.spec : "about:blank", {
referrerURI: referrer,
+ referrerPolicy: referrerPolicy,
fromExternal: isExternal,
inBackground: loadInBackground});
let browser = win.gBrowser.getBrowserForTab(tab);
@@ -4286,11 +4365,14 @@ nsBrowserAccess.prototype = {
default : // OPEN_CURRENTWINDOW or an illegal value
newWindow = content;
if (aURI) {
- let referrer = aOpener ? makeURI(aOpener.location.href) : null;
let loadflags = isExternal ?
Ci.nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL :
Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
- gBrowser.loadURIWithFlags(aURI.spec, loadflags, referrer, null, null);
+ gBrowser.loadURIWithFlags(aURI.spec, {
+ flags: loadflags,
+ referrerURI: referrer,
+ referrerPolicy: referrerPolicy,
+ });
}
if (!gPrefService.getBoolPref("browser.tabs.loadDivertedInBackground"))
window.focus();
@@ -5020,7 +5102,8 @@ function handleLinkClick(event, href, linkNode) {
urlSecurityCheck(href, doc.nodePrincipal);
openLinkIn(href, where, { referrerURI: doc.documentURIObject,
- charset: doc.characterSet });
+ charset: doc.characterSet,
+ referrerPolicy: doc.referrerPolicy });
event.preventDefault();
return true;
}
@@ -5034,36 +5117,81 @@ function middleMousePaste(event) {
// bar's behavior (stripsurroundingwhitespace)
clipboard = clipboard.replace(/\s*\n\s*/g, "");
- let mayInheritPrincipal = { value: false };
- let url = getShortcutOrURI(clipboard, mayInheritPrincipal);
- try {
- makeURI(url);
- } catch (ex) {
- // Not a valid URI.
- return;
+ // if it's not the current tab, we don't need to do anything because the
+ // browser doesn't exist.
+ let where = whereToOpenLink(event, true, false);
+ let lastLocationChange;
+ if (where == "current") {
+ lastLocationChange = gBrowser.selectedBrowser.lastLocationChange;
}
- try {
- addToUrlbarHistory(url);
- } catch (ex) {
- // Things may go wrong when adding url to session history,
- // but don't let that interfere with the loading of the url.
- Cu.reportError(ex);
- }
+ getShortcutOrURIAndPostData(clipboard).then(data => {
+ try {
+ makeURI(data.url);
+ } catch (ex) {
+ // Not a valid URI.
+ return;
+ }
+
+ try {
+ addToUrlbarHistory(data.url);
+ } catch (ex) {
+ // Things may go wrong when adding url to session history,
+ // but don't let that interfere with the loading of the url.
+ Cu.reportError(ex);
+ }
- openUILink(url, event,
- { ignoreButton: true,
- disallowInheritPrincipal: !mayInheritPrincipal.value });
+ if (where != "current" ||
+ lastLocationChange == gBrowser.selectedBrowser.lastLocationChange) {
+ openUILink(data.url, event,
+ { ignoreButton: true,
+ disallowInheritPrincipal: !data.mayInheritPrincipal,
+ initiatingDoc: event ? event.target.ownerDocument : null });
+ }
+ });
event.stopPropagation();
}
-function handleDroppedLink(event, url, name)
+// handleDroppedLink has the following 2 overloads:
+// handleDroppedLink(event, url, name)
+// handleDroppedLink(event, links)
+function handleDroppedLink(event, urlOrLinks, name)
{
- let postData = { };
- let uri = getShortcutOrURI(url, postData);
- if (uri)
- loadURI(uri, null, postData.value, false);
+ let links;
+ if (Array.isArray(urlOrLinks)) {
+ links = urlOrLinks;
+ } else {
+ links = [{ url: urlOrLinks, name, type: "" }];
+ }
+
+ let lastLocationChange = gBrowser.selectedBrowser.lastLocationChange;
+
+ let userContextId = gBrowser.selectedBrowser
+ .getAttribute("usercontextid") || 0;
+
+ let inBackground = Services.prefs.getBoolPref("browser.tabs.loadInBackground");
+ if (event.shiftKey)
+ inBackground = !inBackground;
+
+ Task.spawn(function*() {
+ let urls = [];
+ let postDatas = [];
+ for (let link of links) {
+ let data = yield getShortcutOrURIAndPostData(link.url);
+ urls.push(data.url);
+ postDatas.push(data.postData);
+ }
+ if (lastLocationChange == gBrowser.selectedBrowser.lastLocationChange) {
+ gBrowser.loadTabs(urls, {
+ inBackground,
+ replace: true,
+ allowThirdPartyFixup: false,
+ postDatas,
+ userContextId,
+ });
+ }
+ });
// Keep the event from being handled by the dragDrop listeners
// built-in to goanna if they happen to be above us.
@@ -5178,7 +5306,6 @@ function charsetLoadListener() {
}
}
-
var gPageStyleMenu = {
_getAllStyleSheets: function (frameset) {
@@ -6825,20 +6952,9 @@ var TabContextMenu = {
};
#ifdef MOZ_DEVTOOLS
+// Note: Do not delete! It is used for: base/content/nsContextMenu.js
XPCOMUtils.defineLazyModuleGetter(this, "gDevTools",
- "resource://gre/modules/devtools/gDevTools.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "gDevToolsBrowser",
- "resource://gre/modules/devtools/gDevTools.jsm");
-
-Object.defineProperty(this, "HUDService", {
- get: function HUDService_getter() {
- let devtools = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools;
- return devtools.require("devtools/webconsole/hudservice").HUDService;
- },
- configurable: true,
- enumerable: true
-});
+ "resource://devtools/client/framework/gDevTools.jsm");
#endif
// Prompt user to restart the browser in safe mode or normally
@@ -6929,49 +7045,6 @@ function toggleAddonBar() {
setToolbarVisibility(addonBar, addonBar.collapsed);
}
-#ifdef MOZ_DEVTOOLS
-var Scratchpad = {
- prefEnabledName: "devtools.scratchpad.enabled",
-
- openScratchpad: function SP_openScratchpad() {
- return this.ScratchpadManager.openScratchpad();
- }
-};
-
-XPCOMUtils.defineLazyGetter(Scratchpad, "ScratchpadManager", function() {
- let tmp = {};
- Cu.import("resource://gre/modules/devtools/scratchpad-manager.jsm", tmp);
- return tmp.ScratchpadManager;
-});
-
-var ResponsiveUI = {
- toggle: function RUI_toggle() {
- this.ResponsiveUIManager.toggle(window, gBrowser.selectedTab);
- }
-};
-
-XPCOMUtils.defineLazyGetter(ResponsiveUI, "ResponsiveUIManager", function() {
- let tmp = {};
- Cu.import("resource://gre/modules/devtools/responsivedesign.jsm", tmp);
- return tmp.ResponsiveUIManager;
-});
-
-function openEyedropper() {
- var eyedropper = new this.Eyedropper(this, { context: "menu",
- copyOnSelect: true });
- eyedropper.open();
-}
-
-Object.defineProperty(this, "Eyedropper", {
- get: function() {
- let devtools = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools;
- return devtools.require("devtools/eyedropper/eyedropper").Eyedropper;
- },
- configurable: true,
- enumerable: true
-});
-#endif
-
XPCOMUtils.defineLazyGetter(window, "gShowPageResizers", function () {
#ifdef XP_WIN
// Only show resizers on Windows 2000 and XP
@@ -7051,7 +7124,8 @@ function focusNextFrame(event) {
if (element.ownerDocument == document)
focusAndSelectUrlBar();
}
-let BrowserChromeTest = {
+
+var BrowserChromeTest = {
_cb: null,
_ready: false,
markAsReady: function () {
@@ -7069,7 +7143,7 @@ let BrowserChromeTest = {
}
};
-let ToolbarIconColor = {
+var ToolbarIconColor = {
init: function () {
this._initialized = true;
diff --git a/application/palemoon/base/content/browser.xul b/application/palemoon/base/content/browser.xul
index f830100232..c2553f2956 100644
--- a/application/palemoon/base/content/browser.xul
+++ b/application/palemoon/base/content/browser.xul
@@ -13,7 +13,7 @@
<?xml-stylesheet href="chrome://browser/content/places/places.css" type="text/css"?>
#ifdef MOZ_DEVTOOLS
-<?xml-stylesheet href="chrome://global/skin/devtools/common.css" type="text/css"?>
+<?xml-stylesheet href="chrome://devtools/skin/devtools-browser.css" type="text/css"?>
#endif
<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
@@ -65,6 +65,9 @@
# wishes to include *must* go into the global-scripts.inc file
# so that they can be shared by macBrowserOverlay.xul.
#include global-scripts.inc
+#ifdef MOZ_DEVTOOLS
+#include global-devtools-theme-scripts.inc
+#endif
<script type="application/javascript" src="chrome://browser/content/nsContextMenu.js"/>
<script type="application/javascript" src="chrome://global/content/contentAreaUtils.js"/>
@@ -125,9 +128,25 @@
<!-- for search and content formfill/pw manager -->
<panel type="autocomplete" id="PopupAutoComplete" noautofocus="true" hidden="true"/>
+ <panel type="private-autocomplete" id="PopupAutoComplete" noautofocus="true" hidden="true"/>
<!-- for url bar autocomplete -->
<panel type="autocomplete-richlistbox" id="PopupAutoCompleteRichResult" noautofocus="true" hidden="true"/>
+ <panel type="private-autocomplete-richlistbox" id="PopupAutoCompleteRichResult" noautofocus="true" hidden="true"/>
+
+ <!-- for date/time picker. consumeoutsideclicks is set to never, so that
+ clicks on the anchored input box are never consumed. -->
+ <panel id="DateTimePickerPanel"
+ type="arrow"
+ hidden="true"
+ orient="vertical"
+ noautofocus="true"
+ norolluponanchor="true"
+ consumeoutsideclicks="never"
+ level="parent"
+ tabspecific="true">
+ <iframe id="dateTimePopupFrame"/>
+ </panel>
<!-- for invalid form error message -->
<panel id="invalid-form-popup" type="arrow" orient="vertical" noautofocus="true" hidden="true" level="parent">
@@ -136,7 +155,6 @@
<panel id="editBookmarkPanel"
type="arrow"
- footertype="promobox"
orient="vertical"
ignorekeys="true"
consumeoutsideclicks="true"
@@ -410,8 +428,8 @@
<toolbaritem id="urlbar-container" align="center" flex="400" persist="width" combined="true"
title="&locationItem.title;" class="chromeclass-location" removable="true">
<textbox id="urlbar" flex="1"
- placeholder="&urlbar.placeholder2;"
- type="autocomplete"
+ placeholder=""
+ type="private-autocomplete"
autocompletesearch="urlinline history"
autocompletesearchparam="enable-actions"
autocompletepopup="PopupAutoCompleteRichResult"
@@ -440,8 +458,10 @@
<image id="alert-plugins-notification-icon" class="notification-anchor-icon" role="button"/>
<image id="blocked-plugins-notification-icon" class="notification-anchor-icon" role="button"/>
<image id="mixed-content-blocked-notification-icon" class="notification-anchor-icon" role="button"/>
+#ifdef MOZ_WEBRTC
<image id="webRTC-shareDevices-notification-icon" class="notification-anchor-icon" role="button"/>
<image id="webRTC-sharingDevices-notification-icon" class="notification-anchor-icon" role="button"/>
+#endif
<image id="pointerLock-notification-icon" class="notification-anchor-icon" role="button"/>
<image id="servicesInstall-notification-icon" class="notification-anchor-icon" role="button"/>
</box>
@@ -513,7 +533,7 @@
flex="100" persist="width" removable="true">
<searchbar id="searchbar" flex="1"/>
</toolbaritem>
-
+#ifdef MOZ_WEBRTC
<toolbarbutton id="webrtc-status-button"
class="toolbarbutton-1 chromeclass-toolbar-additional"
type="menu"
@@ -525,7 +545,7 @@
onpopuphiding="WebrtcIndicator.clearPopup(this);"
oncommand="WebrtcIndicator.menuCommand(event.target);"/>
</toolbarbutton>
-
+#endif
<toolbarbutton id="bookmarks-menu-button"
class="toolbarbutton-1 chromeclass-toolbar-additional"
persist="class"
@@ -941,7 +961,8 @@
flex="1" contenttooltip="aHTMLTooltip"
tabcontainer="tabbrowser-tabs"
contentcontextmenu="contentAreaContextMenu"
- autocompletepopup="PopupAutoComplete"/>
+ autocompletepopup="PopupAutoComplete"
+ datetimepicker="DateTimePickerPanel"/>
<chatbar id="pinnedchats" layer="true" mousethrough="always" hidden="true"/>
<statuspanel id="statusbar-display" inactive="true"/>
</vbox>
@@ -971,33 +992,6 @@
<vbox id="browser-bottombox" layer="true">
<notificationbox id="global-notificationbox"/>
-#ifdef MOZ_DEVTOOLS
- <toolbar id="developer-toolbar"
- class="devtools-toolbar"
- hidden="true">
-#ifdef XP_MACOSX
- <toolbarbutton id="developer-toolbar-closebutton"
- class="devtools-closebutton"
- oncommand="DeveloperToolbar.hide();"
- tooltiptext="&devToolbarCloseButton.tooltiptext;"/>
-#endif
- <stack class="gclitoolbar-stack-node" flex="1">
- <textbox class="gclitoolbar-input-node" rows="1"/>
- <hbox class="gclitoolbar-complete-node"/>
- </stack>
- <toolbarbutton id="developer-toolbar-toolbox-button"
- class="developer-toolbar-button"
- observes="devtoolsMenuBroadcaster_DevToolbox"
- tooltiptext="&devToolbarToolsButton.tooltip;"/>
-#ifndef XP_MACOSX
- <toolbarbutton id="developer-toolbar-closebutton"
- class="devtools-closebutton"
- oncommand="DeveloperToolbar.hide();"
- tooltiptext="&devToolbarCloseButton.tooltiptext;"/>
-#endif
- </toolbar>
-#endif
-
<toolbar id="addon-bar"
toolbarname="&statusBar.label;" accesskey="&statusBar.accesskey;"
collapsed="true"
diff --git a/application/palemoon/base/content/content.js b/application/palemoon/base/content/content.js
index 19032eb84f..653dac3e3f 100644
--- a/application/palemoon/base/content/content.js
+++ b/application/palemoon/base/content/content.js
@@ -3,9 +3,9 @@
* 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/. */
-let Cc = Components.classes;
-let Ci = Components.interfaces;
-let Cu = Components.utils;
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
@@ -13,6 +13,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "BrowserUtils",
"resource://gre/modules/BrowserUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "LoginManagerContent",
"resource://gre/modules/LoginManagerContent.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "LoginFormFactory",
+ "resource://gre/modules/LoginManagerContent.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "InsecurePasswordUtils",
"resource://gre/modules/InsecurePasswordUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "FormSubmitObserver",
@@ -47,8 +49,9 @@ addMessageListener("Browser:HideSessionRestoreButton", function (message) {
});
addEventListener("DOMFormHasPassword", function(event) {
- InsecurePasswordUtils.checkForInsecurePasswords(event.target);
- LoginManagerContent.onFormPassword(event);
+ LoginManagerContent.onDOMFormHasPassword(event, content);
+ let formLike = LoginFormFactory.createFromForm(event.target);
+ InsecurePasswordUtils.reportInsecurePasswords(formLike);
});
addEventListener("DOMAutoComplete", function(event) {
LoginManagerContent.onUsernameInput(event);
@@ -57,8 +60,120 @@ addEventListener("blur", function(event) {
LoginManagerContent.onUsernameInput(event);
});
+// Provide gContextMenuContentData for 'sdk/context-menu'
+var handleContentContextMenu = function (event) {
+ let defaultPrevented = event.defaultPrevented;
+ if (!Services.prefs.getBoolPref("dom.event.contextmenu.enabled")) {
+ let plugin = null;
+ try {
+ plugin = event.target.QueryInterface(Ci.nsIObjectLoadingContent);
+ } catch (e) {}
+ if (plugin && plugin.displayedType == Ci.nsIObjectLoadingContent.TYPE_PLUGIN) {
+ // Don't open a context menu for plugins.
+ return;
+ }
+
+ defaultPrevented = false;
+ }
+
+ if (defaultPrevented)
+ return;
+
+ let addonInfo = {};
+ let subject = {
+ event: event,
+ addonInfo: addonInfo,
+ };
+ subject.wrappedJSObject = subject;
+ Services.obs.notifyObservers(subject, "content-contextmenu", null);
+
+ let doc = event.target.ownerDocument;
+ let docLocation = doc.mozDocumentURIIfNotForErrorPages;
+ docLocation = docLocation && docLocation.spec;
+ let charSet = doc.characterSet;
+ let baseURI = doc.baseURI;
+ let referrer = doc.referrer;
+ let referrerPolicy = doc.referrerPolicy;
+ let frameOuterWindowID = doc.defaultView.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindowUtils)
+ .outerWindowID;
+ let loginFillInfo = LoginManagerContent.getFieldContext(event.target);
+
+ // The same-origin check will be done in nsContextMenu.openLinkInTab.
+ let parentAllowsMixedContent = !!docShell.mixedContentChannel;
+
+ // get referrer attribute from clicked link and parse it
+ // if per element referrer is enabled, the element referrer overrules
+ // the document wide referrer
+ if (Services.prefs.getBoolPref("network.http.enablePerElementReferrer")) {
+ let referrerAttrValue = Services.netUtils.parseAttributePolicyString(event.target.
+ getAttribute("referrerpolicy"));
+ if (referrerAttrValue !== Ci.nsIHttpChannel.REFERRER_POLICY_UNSET) {
+ referrerPolicy = referrerAttrValue;
+ }
+ }
+
+ // Media related cache info parent needs for saving
+ let contentType = null;
+ let contentDisposition = null;
+ if (event.target.nodeType == Ci.nsIDOMNode.ELEMENT_NODE &&
+ event.target instanceof Ci.nsIImageLoadingContent &&
+ event.target.currentURI) {
+
+ try {
+ let imageCache =
+ Cc["@mozilla.org/image/tools;1"].getService(Ci.imgITools)
+ .getImgCacheForDocument(doc);
+ let props =
+ imageCache.findEntryProperties(event.target.currentURI, doc);
+ try {
+ contentType = props.get("type", Ci.nsISupportsCString).data;
+ } catch (e) {}
+ try {
+ contentDisposition =
+ props.get("content-disposition", Ci.nsISupportsCString).data;
+ } catch (e) {}
+ } catch (e) {}
+ }
+
+ let selectionInfo = BrowserUtils.getSelectionDetails(content);
+
+ let loadContext = docShell.QueryInterface(Ci.nsILoadContext);
+ let userContextId = loadContext.originAttributes.userContextId;
+
+ let browser = docShell.chromeEventHandler;
+ let mainWin = browser.ownerGlobal;
+
+ mainWin.gContextMenuContentData = {
+ isRemote: false,
+ event: event,
+ popupNode: event.target,
+ browser: browser,
+ addonInfo: addonInfo,
+ documentURIObject: doc.documentURIObject,
+ docLocation: docLocation,
+ charSet: charSet,
+ referrer: referrer,
+ referrerPolicy: referrerPolicy,
+ contentType: contentType,
+ contentDisposition: contentDisposition,
+ selectionInfo: selectionInfo,
+ loginFillInfo,
+ parentAllowsMixedContent,
+ userContextId,
+ };
+}
+
+Cc["@mozilla.org/eventlistenerservice;1"]
+ .getService(Ci.nsIEventListenerService)
+ .addSystemEventListener(global, "contextmenu", handleContentContextMenu, false);
+
// Lazily load the finder code
addMessageListener("Finder:Initialize", function () {
let {RemoteFinderListener} = Cu.import("resource://gre/modules/RemoteFinder.jsm", {});
new RemoteFinderListener(global);
-}); \ No newline at end of file
+});
+
+addEventListener("DOMWebNotificationClicked", function(event) {
+ sendAsyncMessage("DOMWebNotificationClicked", {});
+}, false);
diff --git a/application/palemoon/base/content/global-devtools-theme-scripts.inc b/application/palemoon/base/content/global-devtools-theme-scripts.inc
new file mode 100644
index 0000000000..408728ed56
--- /dev/null
+++ b/application/palemoon/base/content/global-devtools-theme-scripts.inc
@@ -0,0 +1,6 @@
+# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+<script type="application/javascript" src="chrome://browser/content/browser-devtools-theme.js"/>
diff --git a/application/palemoon/base/content/macBrowserOverlay.xul b/application/palemoon/base/content/macBrowserOverlay.xul
index a4d583e16f..b1ae838d0f 100644
--- a/application/palemoon/base/content/macBrowserOverlay.xul
+++ b/application/palemoon/base/content/macBrowserOverlay.xul
@@ -24,6 +24,9 @@
# wishes to include *must* go into the global-scripts.inc file
# so that they can be shared by this overlay.
#include global-scripts.inc
+#ifdef MOZ_DEVTOOLS
+#include global-devtools-theme-scripts.inc
+#endif
<script type="application/javascript">
function OpenBrowserWindowFromDockMenu(options) {
diff --git a/application/palemoon/base/content/newtab/drag.js b/application/palemoon/base/content/newtab/drag.js
index 8f0bf674ee..fbd688faa7 100644
--- a/application/palemoon/base/content/newtab/drag.js
+++ b/application/palemoon/base/content/newtab/drag.js
@@ -7,7 +7,7 @@
/**
* This singleton implements site dragging functionality.
*/
-let gDrag = {
+var gDrag = {
/**
* The site offset to the drag start point.
*/
diff --git a/application/palemoon/base/content/newtab/dragDataHelper.js b/application/palemoon/base/content/newtab/dragDataHelper.js
index a66e4e87e9..54348ab144 100644
--- a/application/palemoon/base/content/newtab/dragDataHelper.js
+++ b/application/palemoon/base/content/newtab/dragDataHelper.js
@@ -4,7 +4,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#endif
-let gDragDataHelper = {
+var gDragDataHelper = {
get mimeType() {
return "text/x-moz-url";
},
diff --git a/application/palemoon/base/content/newtab/drop.js b/application/palemoon/base/content/newtab/drop.js
index d7bf305068..748652455c 100644
--- a/application/palemoon/base/content/newtab/drop.js
+++ b/application/palemoon/base/content/newtab/drop.js
@@ -11,7 +11,7 @@ const DELAY_REARRANGE_MS = 100;
/**
* This singleton implements site dropping functionality.
*/
-let gDrop = {
+var gDrop = {
/**
* The last drop target.
*/
diff --git a/application/palemoon/base/content/newtab/dropPreview.js b/application/palemoon/base/content/newtab/dropPreview.js
index 9037623457..fd7587a35e 100644
--- a/application/palemoon/base/content/newtab/dropPreview.js
+++ b/application/palemoon/base/content/newtab/dropPreview.js
@@ -9,7 +9,7 @@
* indicate the transformation that results from dropping a cell at a certain
* position.
*/
-let gDropPreview = {
+var gDropPreview = {
/**
* Rearranges the sites currently contained in the grid when a site would be
* dropped onto the given cell.
diff --git a/application/palemoon/base/content/newtab/dropTargetShim.js b/application/palemoon/base/content/newtab/dropTargetShim.js
index a85a6ccd65..046dbea1eb 100644
--- a/application/palemoon/base/content/newtab/dropTargetShim.js
+++ b/application/palemoon/base/content/newtab/dropTargetShim.js
@@ -9,7 +9,7 @@
* the default DnD target detection relies on the cursor's position. We want
* to pick a drop target based on the dragged site's position.
*/
-let gDropTargetShim = {
+var gDropTargetShim = {
/**
* Cache for the position of all cells, cleaned after drag finished.
*/
diff --git a/application/palemoon/base/content/newtab/grid.js b/application/palemoon/base/content/newtab/grid.js
index 37559a0631..a614d03968 100644
--- a/application/palemoon/base/content/newtab/grid.js
+++ b/application/palemoon/base/content/newtab/grid.js
@@ -7,7 +7,7 @@
/**
* This singleton represents the grid that contains all sites.
*/
-let gGrid = {
+var gGrid = {
/**
* The DOM node of the grid.
*/
@@ -59,8 +59,13 @@ let gGrid = {
* Refreshes the grid and re-creates all sites.
*/
refresh: function Grid_refresh() {
+ let cells = this.cells;
+ if (!cells) {
+ return;
+ }
+
// Remove all sites.
- this.cells.forEach(function (cell) {
+ cells.forEach(function (cell) {
let node = cell.node;
let child = node.firstElementChild;
@@ -109,7 +114,12 @@ let gGrid = {
// (Re-)initialize all cells.
let cellElements = this.node.querySelectorAll(".newtab-cell");
- this._cells = [new Cell(this, cell) for (cell of cellElements)];
+ // Tycho: this._cells = [new Cell(this, cell) for (cell of cellElements)];
+ this.cells = [];
+
+ for (let cellItem of cellElements) {
+ this.cells.push(new Cell(this, cellItem));
+ }
},
/**
diff --git a/application/palemoon/base/content/newtab/newTab.js b/application/palemoon/base/content/newtab/newTab.js
index 77c929125c..bba73fd7aa 100644
--- a/application/palemoon/base/content/newtab/newTab.js
+++ b/application/palemoon/base/content/newtab/newTab.js
@@ -4,8 +4,8 @@
"use strict";
-let Cu = Components.utils;
-let Ci = Components.interfaces;
+var Cu = Components.utils;
+var Ci = Components.interfaces;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
@@ -18,7 +18,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "Rect",
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
"resource://gre/modules/PrivateBrowsingUtils.jsm");
-let {
+var {
links: gLinks,
allPages: gAllPages,
linkChecker: gLinkChecker,
diff --git a/application/palemoon/base/content/newtab/page.js b/application/palemoon/base/content/newtab/page.js
index afe5bfba8a..fc836a55e4 100644
--- a/application/palemoon/base/content/newtab/page.js
+++ b/application/palemoon/base/content/newtab/page.js
@@ -8,7 +8,7 @@
* This singleton represents the whole 'New Tab Page' and takes care of
* initializing all its components.
*/
-let gPage = {
+var gPage = {
/**
* Initializes the page.
*/
diff --git a/application/palemoon/base/content/newtab/transformations.js b/application/palemoon/base/content/newtab/transformations.js
index 6d1554f5ff..0711d7d0a9 100644
--- a/application/palemoon/base/content/newtab/transformations.js
+++ b/application/palemoon/base/content/newtab/transformations.js
@@ -9,7 +9,7 @@
* in the DOM and by showing or hiding the node. It additionally provides
* convenience methods to work with a site's DOM node.
*/
-let gTransformation = {
+var gTransformation = {
/**
* Returns the width of the left and top border of a cell. We need to take it
* into account when measuring and comparing site and cell positions.
diff --git a/application/palemoon/base/content/newtab/undo.js b/application/palemoon/base/content/newtab/undo.js
index 5f619e9806..b856914d2c 100644
--- a/application/palemoon/base/content/newtab/undo.js
+++ b/application/palemoon/base/content/newtab/undo.js
@@ -8,7 +8,7 @@
* Dialog allowing to undo the removal of single site or to completely restore
* the grid's original state.
*/
-let gUndoDialog = {
+var gUndoDialog = {
/**
* The undo dialog's timeout in miliseconds.
*/
diff --git a/application/palemoon/base/content/newtab/updater.js b/application/palemoon/base/content/newtab/updater.js
index 7b483e037f..e6da37f87b 100644
--- a/application/palemoon/base/content/newtab/updater.js
+++ b/application/palemoon/base/content/newtab/updater.js
@@ -8,7 +8,7 @@
* This singleton provides functionality to update the current grid to a new
* set of pinned and blocked sites. It adds, moves and removes sites.
*/
-let gUpdater = {
+var gUpdater = {
/**
* Updates the current grid according to its pinned and blocked sites.
* This removes old, moves existing and creates new sites to fill gaps.
diff --git a/application/palemoon/base/content/nsContextMenu.js b/application/palemoon/base/content/nsContextMenu.js
index 8e6bc96c23..f389491d3f 100644
--- a/application/palemoon/base/content/nsContextMenu.js
+++ b/application/palemoon/base/content/nsContextMenu.js
@@ -4,6 +4,8 @@
Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
+var gContextMenuContentData = null;
+
function nsContextMenu(aXulMenu, aIsShift) {
this.shouldDisplay = true;
this.initMenu(aXulMenu, aIsShift);
@@ -39,6 +41,7 @@ nsContextMenu.prototype = {
},
hiding: function CM_hiding() {
+ gContextMenuContentData = null;
InlineSpellCheckerUI.clearSuggestionsFromMenu();
InlineSpellCheckerUI.clearDictionaryListFromMenu();
InlineSpellCheckerUI.uninit();
@@ -265,7 +268,7 @@ nsContextMenu.prototype = {
// Hide menu entries for images, show otherwise
if (this.inFrame) {
- if (mimeTypeIsTextBased(this.target.ownerDocument.contentType))
+ if (BrowserUtils.mimeTypeIsTextBased(this.target.ownerDocument.contentType))
this.isFrameImage.removeAttribute('hidden');
else
this.isFrameImage.setAttribute('hidden', 'true');
@@ -422,12 +425,17 @@ nsContextMenu.prototype = {
},
inspectNode: function CM_inspectNode() {
- let {devtools} = Cu.import("resource://gre/modules/devtools/Loader.jsm", {});
+ let {devtools} = Cu.import("resource://devtools/shared/Loader.jsm", {});
let gBrowser = this.browser.ownerDocument.defaultView.gBrowser;
- let tt = devtools.TargetFactory.forTab(gBrowser.selectedTab);
- return gDevTools.showToolbox(tt, "inspector").then(function(toolbox) {
+ let target = devtools.TargetFactory.forTab(gBrowser.selectedTab);
+
+ return gDevTools.showToolbox(target, "inspector").then(function(toolbox) {
let inspector = toolbox.getCurrentPanel();
- inspector.selection.setNode(this.target, "browser-context-menu");
+
+ this.browser.messageManager.sendAsyncMessage("debug:inspect", {}, {node: this.target});
+ inspector.walker.findInspectingNode().then(nodeFront => {
+ inspector.selection.setNodeFront(nodeFront, "browser-context-menu");
+ });
}.bind(this));
},
@@ -745,7 +753,8 @@ nsContextMenu.prototype = {
urlSecurityCheck(this.linkURL, doc.nodePrincipal);
openLinkIn(this.linkURL, "window",
{ charset: doc.characterSet,
- referrerURI: doc.documentURIObject });
+ referrerURI: doc.documentURIObject,
+ referrerPolicy: doc.referrerPolicy });
},
// Open linked-to URL in a new private window.
@@ -755,6 +764,7 @@ nsContextMenu.prototype = {
openLinkIn(this.linkURL, "window",
{ charset: doc.characterSet,
referrerURI: doc.documentURIObject,
+ referrerPolicy: doc.referrerPolicy,
private: true });
},
@@ -764,7 +774,8 @@ nsContextMenu.prototype = {
urlSecurityCheck(this.linkURL, doc.nodePrincipal);
openLinkIn(this.linkURL, "tab",
{ charset: doc.characterSet,
- referrerURI: doc.documentURIObject });
+ referrerURI: doc.documentURIObject,
+ referrerPolicy: doc.referrerPolicy });
},
// open URL in current tab
@@ -901,11 +912,15 @@ nsContextMenu.prototype = {
Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT);
let doc = this.target.ownerDocument;
openUILink(viewURL, e, { disallowInheritPrincipal: true,
- referrerURI: doc.documentURIObject });
+ referrerURI: doc.documentURIObject,
+ forceAllowDataURI: true });
}
},
saveVideoFrameAsImage: function () {
+ let referrerURI = document.documentURIObject;
+ let isPrivate = PrivateBrowsingUtils.isBrowserPrivate(this.browser);
+
urlSecurityCheck(this.mediaURL, this.browser.contentPrincipal,
Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT);
let name = "";
@@ -923,7 +938,9 @@ nsContextMenu.prototype = {
canvas.height = video.videoHeight;
var ctxDraw = canvas.getContext("2d");
ctxDraw.drawImage(video, 0, 0);
- saveImageURL(canvas.toDataURL("image/jpeg", ""), name, "SaveImageTitle", true, false, document.documentURIObject, this.target.ownerDocument);
+ saveImageURL(canvas.toDataURL("image/jpeg", ""), name, "SaveImageTitle",
+ true, false, referrerURI, null, null, null,
+ isPrivate);
},
fullScreenVideo: function () {
@@ -1106,10 +1123,17 @@ nsContextMenu.prototype = {
}
}
- // set up a channel to do the saving
- var ioService = Cc["@mozilla.org/network/io-service;1"].
- getService(Ci.nsIIOService);
- var channel = ioService.newChannelFromURI(makeURI(linkURL));
+ // setting up a new channel for 'right click - save link as ...'
+ // ideally we should use:
+ // * doc - as the loadingNode, and/or
+ // * this.principal - as the loadingPrincipal
+ // for now lets use systemPrincipal to bypass mixedContentBlocker
+ // checks after redirects, see bug: 1136055
+ var channel = NetUtil.newChannel({
+ uri: makeURI(linkURL),
+ loadUsingSystemPrincipal: true
+ });
+
if (linkDownload)
channel.contentDispositionFilename = linkDownload;
if (channel instanceof Ci.nsIPrivateBrowsingChannel) {
@@ -1142,7 +1166,7 @@ nsContextMenu.prototype = {
timer.TYPE_ONE_SHOT);
// kick off the channel with our proxy object as the listener
- channel.asyncOpen(new saveAsListener(), null);
+ channel.asyncOpen2(new saveAsListener());
},
// Save URL of clicked-on link.
@@ -1174,6 +1198,8 @@ nsContextMenu.prototype = {
// Save URL of the clicked upon image, video, or audio.
saveMedia: function() {
var doc = this.target.ownerDocument;
+ let referrerURI = doc.documentURIObject;
+ let isPrivate = PrivateBrowsingUtils.isBrowserPrivate(this.browser);
if (this.onCanvas) {
// Bypass cache, since it's a blob: URL.
var target = this.target;
@@ -1189,14 +1215,16 @@ nsContextMenu.prototype = {
resolve(win.URL.createObjectURL(blob));
})
}}).then(function (blobURL) {
- saveImageURL(blobURL, "canvas.png", "SaveImageTitle", true,
- false, doc.documentURIObject, doc);
+ saveImageURL(blobURL, "canvas.png", "SaveImageTitle",
+ true, false, referrerURI, null, null, null,
+ isPrivate);
}, Components.utils.reportError);
}
} else if (this.onImage) {
urlSecurityCheck(this.mediaURL, doc.nodePrincipal);
- saveImageURL(this.mediaURL, null, "SaveImageTitle", false,
- false, doc.documentURIObject, doc);
+ saveImageURL(this.mediaURL, null, "SaveImageTitle",
+ false, false, referrerURI, doc, null, null,
+ isPrivate);
} else if (this.onVideo || this.onAudio) {
urlSecurityCheck(this.mediaURL, doc.nodePrincipal);
var dialogTitle = this.onVideo ? "SaveVideoTitle" : "SaveAudioTitle";
@@ -1373,9 +1401,8 @@ nsContextMenu.prototype = {
isDisabledForEvents: function(aNode) {
let ownerDoc = aNode.ownerDocument;
- return
- ownerDoc.defaultView &&
- ownerDoc.defaultView
+ return ownerDoc.defaultView &&
+ ownerDoc.defaultView
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils)
.isNodeDisabledForEvents(aNode);
diff --git a/application/palemoon/base/content/openLocation.js b/application/palemoon/base/content/openLocation.js
index 5b731c7e86..1a10334c79 100644
--- a/application/palemoon/base/content/openLocation.js
+++ b/application/palemoon/base/content/openLocation.js
@@ -7,7 +7,7 @@
var browser;
var dialog = {};
var pref = null;
-let openLocationModule = {};
+var openLocationModule = {};
try {
pref = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
@@ -16,7 +16,7 @@ try {
}
Components.utils.import("resource:///modules/openLocationLastURL.jsm", openLocationModule);
-let gOpenLocationLastURL = new openLocationModule.OpenLocationLastURL(window.opener);
+var gOpenLocationLastURL = new openLocationModule.OpenLocationLastURL(window.opener);
function onLoad()
{
@@ -61,45 +61,52 @@ function doEnabling()
function open()
{
- var url;
- var postData = {};
- var mayInheritPrincipal = {value: false};
- if (browser)
- url = browser.getShortcutOrURI(dialog.input.value, postData, mayInheritPrincipal);
- else
- url = dialog.input.value;
+ getShortcutOrURIAndPostData(dialog.input.value).then(data => {
+ let url;
+ let postData = null;
+ let mayInheritPrincipal = false;
+
+ if (browser) {
+ url = data.url;
+ postData = data.postData;
+ mayInheritPrincipal = data.mayInheritPrincipal;
+ } else {
+ url = dialog.input.value;
+ }
- try {
- // Whichever target we use for the load, we allow third-party services to
- // fixup the URI
- switch (dialog.openWhereList.value) {
- case "0":
- var webNav = Components.interfaces.nsIWebNavigation;
- var flags = webNav.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
- webNav.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
- if (!mayInheritPrincipal.value)
- flags |= webNav.LOAD_FLAGS_DISALLOW_INHERIT_OWNER;
- browser.gBrowser.loadURIWithFlags(url, flags, null, null, postData.value);
- break;
- case "1":
- window.opener.delayedOpenWindow(getBrowserURL(), "all,dialog=no",
- url, postData.value, null, null, true);
- break;
- case "3":
- browser.delayedOpenTab(url, null, null, postData.value, true);
- break;
+ try {
+ // Whichever target we use for the load, we allow third-party services to
+ // fixup the URI
+ switch (dialog.openWhereList.value) {
+ case "0":
+ var webNav = Components.interfaces.nsIWebNavigation;
+ var flags = webNav.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
+ webNav.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
+ if (!mayInheritPrincipal)
+ flags |= webNav.LOAD_FLAGS_DISALLOW_INHERIT_OWNER;
+ browser.gBrowser.loadURIWithFlags(url, flags, null, null, postData);
+ break;
+ case "1":
+ window.opener.delayedOpenWindow(getBrowserURL(), "all,dialog=no",
+ url, postData, null, null, true);
+ break;
+ case "3":
+ browser.delayedOpenTab(url, null, null, postData, true);
+ break;
+ }
+ }
+ catch(exception) {
}
- }
- catch(exception) {
- }
- if (pref) {
- gOpenLocationLastURL.value = dialog.input.value;
- pref.setIntPref("general.open_location.last_window_choice", dialog.openWhereList.value);
- }
+ if (pref) {
+ gOpenLocationLastURL.value = dialog.input.value;
+ pref.setIntPref("general.open_location.last_window_choice", dialog.openWhereList.value);
+ }
+
+ // Delay closing slightly to avoid timing bug on Linux.
+ window.close();
+ });
- // Delay closing slightly to avoid timing bug on Linux.
- window.close();
return false;
}
diff --git a/application/palemoon/base/content/padlock.js b/application/palemoon/base/content/padlock.js
index 53477fd171..9c29524ce4 100644
--- a/application/palemoon/base/content/padlock.js
+++ b/application/palemoon/base/content/padlock.js
@@ -1,6 +1,6 @@
-let Cc = Components.classes;
-let Ci = Components.interfaces;
-let Cu = Components.utils;
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
var padlock_PadLock =
diff --git a/application/palemoon/base/content/pageinfo/pageInfo.js b/application/palemoon/base/content/pageinfo/pageInfo.js
index ba93ee8179..6b02bc370a 100644
--- a/application/palemoon/base/content/pageinfo/pageInfo.js
+++ b/application/palemoon/base/content/pageinfo/pageInfo.js
@@ -359,7 +359,7 @@ function loadPageInfo()
makeTabs(gDocument, gWindow);
initFeedTab();
- onLoadPermission();
+ onLoadPermission(gDocument.nodePrincipal);
/* Call registered overlay init functions */
onLoadRegistry.forEach(function(func) { func(); });
@@ -857,7 +857,7 @@ function onBlockImage()
if (checkbox.checked)
permissionManager.add(uri, "image", nsIPermissionManager.DENY_ACTION);
else
- permissionManager.remove(uri.host, "image");
+ permissionManager.remove(uri, "image");
}
function onImageSelect()
@@ -1112,8 +1112,9 @@ var imagePermissionObserver = {
var row = getSelectedRow(imageTree);
var item = gImageView.data[row][COL_IMAGE_NODE];
var url = gImageView.data[row][COL_IMAGE_ADDRESS];
- if (makeURI(url).host == permission.host)
+ if (permission.matchesURI(makeURI(url), true)) {
makeBlockImage(url);
+ }
}
}
}
diff --git a/application/palemoon/base/content/pageinfo/permissions.js b/application/palemoon/base/content/pageinfo/permissions.js
index 7a0006b61f..68261ce6e5 100644
--- a/application/palemoon/base/content/pageinfo/permissions.js
+++ b/application/palemoon/base/content/pageinfo/permissions.js
@@ -12,9 +12,10 @@ const IMAGE_DENY = 2;
const COOKIE_DENY = 2;
const COOKIE_SESSION = 2;
-const nsIQuotaManager = Components.interfaces.nsIQuotaManager;
+const nsIQuotaManagerService = Components.interfaces.nsIQuotaManagerService;
var gPermURI;
+var gPermPrincipal;
var gPrefs;
var gUsageRequest;
@@ -97,7 +98,7 @@ var permissionObserver = {
if (aTopic == "perm-changed") {
var permission = aSubject.QueryInterface(
Components.interfaces.nsIPermission);
- if (permission.host == gPermURI.host) {
+ if (permission.matchesURI(gPermURI, true)) {
if (permission.type in gPermObj)
initRow(permission.type);
else if (permission.type.startsWith("plugin"))
@@ -107,7 +108,7 @@ var permissionObserver = {
}
};
-function onLoadPermission()
+function onLoadPermission(principal)
{
gPrefs = Components.classes[PREFERENCES_CONTRACTID]
.getService(Components.interfaces.nsIPrefBranch);
@@ -116,8 +117,9 @@ function onLoadPermission()
var permTab = document.getElementById("permTab");
if (/^https?$/.test(uri.scheme)) {
gPermURI = uri;
+ gPermPrincipal = principal;
var hostText = document.getElementById("hostText");
- hostText.value = gPermURI.host;
+ hostText.value = gPermURI.prePath;
for (var i in gPermObj)
initRow(i);
@@ -187,7 +189,7 @@ function onCheckboxClick(aPartId)
var command = document.getElementById("cmd_" + aPartId + "Toggle");
var checkbox = document.getElementById(aPartId + "Def");
if (checkbox.checked) {
- permissionManager.remove(gPermURI.host, aPartId);
+ permissionManager.remove(gPermURI, aPartId);
command.setAttribute("disabled", "true");
var perm = gPermObj[aPartId]();
setRadioState(aPartId, perm);
@@ -211,7 +213,7 @@ function onRadioClick(aPartId)
var id = radioGroup.selectedItem.id;
var permission = id.split('#')[1];
if (permission == UNKNOWN) {
- permissionManager.remove(gPermURI.host, aPartId);
+ permissionManager.remove(gPermURI, aPartId);
} else {
permissionManager.add(gPermURI, aPartId, permission);
}
@@ -230,10 +232,13 @@ function initIndexedDBRow()
row.appendChild(extras);
- var quotaManager = Components.classes["@mozilla.org/dom/quota/manager;1"]
- .getService(nsIQuotaManager);
+ var quotaManagerService =
+ Components.classes["@mozilla.org/dom/quota-manager-service;1"]
+ .getService(nsIQuotaManagerService);
+
gUsageRequest =
- quotaManager.getUsageForURI(gPermURI, onIndexedDBUsageCallback);
+ quotaManagerService.getUsageForPrincipal(gPermPrincipal,
+ onIndexedDBUsageCallback);
var status = document.getElementById("indexedDBStatus");
var button = document.getElementById("indexedDBClear");
@@ -245,22 +250,24 @@ function initIndexedDBRow()
function onIndexedDBClear()
{
- Components.classes["@mozilla.org/dom/quota/manager;1"]
- .getService(nsIQuotaManager)
- .clearStoragesForURI(gPermURI);
+ Components.classes["@mozilla.org/dom/quota-manager-service;1"]
+ .getService(nsIQuotaManagerService)
+ .clearStoragesForPrincipal(gPermPrincipal);
var permissionManager = Components.classes[PERMISSION_CONTRACTID]
.getService(nsIPermissionManager);
- permissionManager.remove(gPermURI.host, "indexedDB");
+ permissionManager.remove(gPermURI, "indexedDB");
initIndexedDBRow();
}
-function onIndexedDBUsageCallback(uri, usage, fileUsage)
+function onIndexedDBUsageCallback(request)
{
+ let uri = request.principal.URI;
if (!uri.equals(gPermURI)) {
- throw new Error("Callback received for bad URI: " + uri);
+ throw new Error("Callback received for bad URI: " + uri.spec);
}
+ let usage = request.result.usage;
if (usage) {
if (!("DownloadUtils" in window)) {
Components.utils.import("resource://gre/modules/DownloadUtils.jsm");
@@ -355,20 +362,33 @@ function initPluginsRow() {
}
}
- let entries = [
- {
+ // Tycho:
+ // let entries = [
+ // {
+ // "permission": item[0],
+ // "obj": item[1],
+ // }
+ // for (item of permissionMap)
+ // ];
+ let entries = [];
+ for (let item of permissionMap) {
+ entries.push({
"permission": item[0],
- "obj": item[1],
- }
- for (item of permissionMap)
- ];
+ "obj": item[1]
+ });
+ }
entries.sort(function(a, b) {
return ((a.obj.name < b.obj.name) ? -1 : (a.obj.name == b.obj.name ? 0 : 1));
});
- let permissionEntries = [
- fillInPluginPermissionTemplate(p.permission, p.obj) for (p of entries)
- ];
+ // Tycho:
+ // let permissionEntries = [
+ // fillInPluginPermissionTemplate(p.permission, p.obj) for (p of entries)
+ // ];
+ let permissionEntries = [];
+ entries.forEach(function (p) {
+ permissionEntries.push(fillInPluginPermissionTemplate(p.permission, p.obj));
+ });
let permPluginsRow = document.getElementById("permPluginsRow");
clearPluginPermissionTemplate();
diff --git a/application/palemoon/base/content/popup-notifications.inc b/application/palemoon/base/content/popup-notifications.inc
index 04f4cb5b78..31a72b4890 100644
--- a/application/palemoon/base/content/popup-notifications.inc
+++ b/application/palemoon/base/content/popup-notifications.inc
@@ -2,7 +2,6 @@
<panel id="notification-popup"
type="arrow"
- footertype="promobox"
position="after_start"
hidden="true"
orient="vertical"
@@ -54,7 +53,7 @@
</hbox>
</panel>
-
+#ifdef MOZ_WEBRTC
<popupnotification id="webRTC-shareDevices-notification" hidden="true">
<popupnotificationcontent id="webRTC-selectCamera" orient="vertical">
<separator class="thin"/>
@@ -75,7 +74,7 @@
</menulist>
</popupnotificationcontent>
</popupnotification>
-
+#endif
<popupnotification id="servicesInstall-notification" hidden="true">
<popupnotificationcontent orient="vertical" align="start">
<!-- XXX bug 974146, tests are looking for this, can't remove yet. -->
@@ -89,6 +88,14 @@
</popupnotificationcontent>
</popupnotification>
+ <popupnotification id="password-notification" hidden="true">
+ <popupnotificationcontent orient="vertical">
+ <textbox id="password-notification-username"/>
+ <textbox id="password-notification-password" type="password" show-content=""/>
+ <checkbox id="password-notification-visibilityToggle" hidden="true"/>
+ </popupnotificationcontent>
+ </popupnotification>
+
<popupnotification id="mixed-content-blocked-notification" hidden="true">
<popupnotificationcontent orient="vertical" align="start">
<separator/>
diff --git a/application/palemoon/base/content/sanitize.js b/application/palemoon/base/content/sanitize.js
index 89843c86d3..f2eb24a556 100644
--- a/application/palemoon/base/content/sanitize.js
+++ b/application/palemoon/base/content/sanitize.js
@@ -15,7 +15,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "Promise",
XPCOMUtils.defineLazyModuleGetter(this, "Task",
"resource://gre/modules/Task.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "console",
- "resource://gre/modules/devtools/Console.jsm");
+ "resource://gre/modules/Console.jsm");
function Sanitizer() {}
Sanitizer.prototype = {
@@ -148,7 +148,8 @@ Sanitizer.prototype = {
if (cookie.creationTime > this.range[0])
// This cookie was created after our cutoff, clear it
- cookieMgr.remove(cookie.host, cookie.name, cookie.path, false);
+ cookieMgr.remove(cookie.host, cookie.name, cookie.path,
+ false, cookie.originAttributes);
}
}
else {
@@ -213,10 +214,16 @@ Sanitizer.prototype = {
history: {
clear: function ()
{
- if (this.range)
- PlacesUtils.history.removeVisitsByTimeframe(this.range[0], this.range[1]);
- else
- PlacesUtils.history.removeAllPages();
+ if (this.range) {
+ PlacesUtils.history.removeVisitsByFilter({
+ beginDate: new Date(this.range[0] / 1000),
+ endDate: new Date(this.range[1] / 1000)
+ }).catch(Components.utils.reportError);;
+ } else {
+ // Remove everything.
+ PlacesUtils.history.clear()
+ .catch(Components.utils.reportError);
+ }
try {
var os = Components.classes["@mozilla.org/observer-service;1"]
diff --git a/application/palemoon/base/content/sync/aboutSyncTabs.js b/application/palemoon/base/content/sync/aboutSyncTabs.js
index 535c43e561..bc624a4592 100644
--- a/application/palemoon/base/content/sync/aboutSyncTabs.js
+++ b/application/palemoon/base/content/sync/aboutSyncTabs.js
@@ -11,7 +11,7 @@ Cu.import("resource://gre/modules/PlacesUtils.jsm", this);
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-let RemoteTabViewer = {
+var RemoteTabViewer = {
_tabsList: null,
init: function () {
diff --git a/application/palemoon/base/content/sync/addDevice.js b/application/palemoon/base/content/sync/addDevice.js
index 556e757687..40862a7916 100644
--- a/application/palemoon/base/content/sync/addDevice.js
+++ b/application/palemoon/base/content/sync/addDevice.js
@@ -15,7 +15,7 @@ const ADD_DEVICE_PAGE = 0;
const SYNC_KEY_PAGE = 1;
const DEVICE_CONNECTED_PAGE = 2;
-let gSyncAddDevice = {
+var gSyncAddDevice = {
init: function init() {
this.pin1.setAttribute("maxlength", PIN_PART_LENGTH);
diff --git a/application/palemoon/base/content/sync/genericChange.js b/application/palemoon/base/content/sync/genericChange.js
index 6d1ce94856..0c6dc145e8 100644
--- a/application/palemoon/base/content/sync/genericChange.js
+++ b/application/palemoon/base/content/sync/genericChange.js
@@ -8,7 +8,7 @@ const Cc = Components.classes;
Components.utils.import("resource://services-sync/main.js");
Components.utils.import("resource://gre/modules/Services.jsm");
-let Change = {
+var Change = {
_dialog: null,
_dialogType: null,
_status: null,
diff --git a/application/palemoon/base/content/sync/progress.js b/application/palemoon/base/content/sync/progress.js
index 2063f612a8..101160fa87 100644
--- a/application/palemoon/base/content/sync/progress.js
+++ b/application/palemoon/base/content/sync/progress.js
@@ -6,8 +6,8 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://services-sync/main.js");
-let gProgressBar;
-let gCounter = 0;
+var gProgressBar;
+var gCounter = 0;
function onLoad(event) {
Services.obs.addObserver(onEngineSync, "weave:engine:sync:finish", false);
diff --git a/application/palemoon/base/content/sync/quota.js b/application/palemoon/base/content/sync/quota.js
index 7117a2ddfa..4540527548 100644
--- a/application/palemoon/base/content/sync/quota.js
+++ b/application/palemoon/base/content/sync/quota.js
@@ -10,7 +10,7 @@ const Cu = Components.utils;
Cu.import("resource://services-sync/main.js");
Cu.import("resource://gre/modules/DownloadUtils.jsm");
-let gSyncQuota = {
+var gSyncQuota = {
init: function init() {
this.bundle = document.getElementById("quotaStrings");
@@ -86,7 +86,7 @@ let gSyncQuota = {
};
-let gUsageTreeView = {
+var gUsageTreeView = {
_ignored: {keys: true,
meta: true,
diff --git a/application/palemoon/base/content/sync/utils.js b/application/palemoon/base/content/sync/utils.js
index 0c02b5bc02..d41ecf18a3 100644
--- a/application/palemoon/base/content/sync/utils.js
+++ b/application/palemoon/base/content/sync/utils.js
@@ -8,7 +8,7 @@
const PERMISSIONS_RWUSR = 0x180;
// Weave should always exist before before this file gets included.
-let gSyncUtils = {
+var gSyncUtils = {
get bundle() {
delete this.bundle;
return this.bundle = Services.strings.createBundle("chrome://browser/locale/syncSetup.properties");
diff --git a/application/palemoon/base/content/tabbrowser.xml b/application/palemoon/base/content/tabbrowser.xml
index b8d5f3e41c..1b8099785f 100644
--- a/application/palemoon/base/content/tabbrowser.xml
+++ b/application/palemoon/base/content/tabbrowser.xml
@@ -30,7 +30,7 @@
<xul:vbox flex="1" class="browserContainer">
<xul:stack flex="1" class="browserStack" anonid="browserStack">
<xul:browser anonid="initialBrowser" type="content-primary" message="true" disablehistory="true"
- xbl:inherits="tooltip=contenttooltip,contextmenu=contentcontextmenu,autocompletepopup"/>
+ xbl:inherits="tooltip=contenttooltip,contextmenu=contentcontextmenu,autocompletepopup,datetimepicker"/>
</xul:stack>
</xul:vbox>
</xul:hbox>
@@ -138,19 +138,19 @@
]]></getter>
</property>
- <property name="formValidationAnchor" readonly="true">
+ <property name="popupAnchor" readonly="true">
<getter><![CDATA[
- if (this.mCurrentTab._formValidationAnchor) {
- return this.mCurrentTab._formValidationAnchor;
+ if (this.mCurrentTab._popupAnchor) {
+ return this.mCurrentTab._popupAnchor;
}
let stack = this.mCurrentBrowser.parentNode;
- // Create an anchor for the form validation popup
+ // Create an anchor for the popup
const NS_XUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
- let formValidationAnchor = document.createElementNS(NS_XUL, "hbox");
- formValidationAnchor.className = "form-validation-anchor";
- formValidationAnchor.hidden = true;
- stack.appendChild(formValidationAnchor);
- return this.mCurrentTab._formValidationAnchor = formValidationAnchor;
+ let popupAnchor = document.createElementNS(NS_XUL, "hbox");
+ popupAnchor.className = "popup-anchor";
+ popupAnchor.hidden = true;
+ stack.appendChild(popupAnchor);
+ return this.mCurrentTab._popupAnchor = popupAnchor;
]]></getter>
</property>
@@ -302,6 +302,16 @@
</body>
</method>
+ <method name="getBrowserForContentWindow">
+ <parameter name="aWindow"/>
+ <body>
+ <![CDATA[
+ var tab = this._getTabForContentWindow(aWindow);
+ return tab ? tab.linkedBrowser : null;
+ ]]>
+ </body>
+ </method>
+
<method name="getBrowserForOuterWindowID">
<parameter name="aID"/>
<body>
@@ -560,6 +570,12 @@
const nsIWebProgressListener = Components.interfaces.nsIWebProgressListener;
const nsIChannel = Components.interfaces.nsIChannel;
+ let location, originalLocation;
+ try {
+ aRequest.QueryInterface(nsIChannel)
+ location = aRequest.URI;
+ originalLocation = aRequest.originalURI;
+ } catch (ex) {}
if (aStateFlags & nsIWebProgressListener.STATE_START) {
this.mRequestCount++;
@@ -578,16 +594,8 @@
if (aStateFlags & nsIWebProgressListener.STATE_START &&
aStateFlags & nsIWebProgressListener.STATE_IS_NETWORK) {
- // It's okay to clear what the user typed when we start
- // loading a document. If the user types, this counter gets
- // set to zero, if the document load ends without an
- // onLocationChange, this counter gets decremented
- // (so we keep it while switching tabs after failed loads)
- // We need to add 2 because loadURIWithFlags may have
- // cancelled a pending load which would have cleared
- // its anchor scroll detection temporary increment.
if (aWebProgress.isTopLevel)
- this.mBrowser.userTypedClear += 2;
+ this.mBrowser.urlbarChangeTracker.startedLoad();
if (this._shouldShowProgress(aRequest)) {
if (!(aStateFlags & nsIWebProgressListener.STATE_RESTORING)) {
@@ -615,8 +623,8 @@
this.mTab.removeAttribute("progress");
if (aWebProgress.isTopLevel) {
- if (!Components.isSuccessCode(aStatus) &&
- !isTabEmpty(this.mTab)) {
+ let isSuccessful = Components.isSuccessCode(aStatus);
+ if (!isSuccessful && !isTabEmpty(this.mTab)) {
// Restore the current document's location in case the
// request was stopped (possibly from a content script)
// before the location changed.
@@ -625,14 +633,8 @@
if (this.mTab.selected && gURLBar)
URLBarSetURI();
- } else {
- // The document is done loading, we no longer want the
- // value cleared.
-
- if (this.mBrowser.userTypedClear > 1)
- this.mBrowser.userTypedClear -= 2;
- else if (this.mBrowser.userTypedClear > 0)
- this.mBrowser.userTypedClear--;
+ } else if (isSuccessful) {
+ this.mBrowser.urlbarChangeTracker.finishedLoad();
}
if (!this.mBrowser.mIconURL)
@@ -642,8 +644,6 @@
if (this.mBlank)
this.mBlank = false;
- var location = aRequest.QueryInterface(nsIChannel).URI;
-
// For keyword URIs clear the user typed value since they will be changed into real URIs
if (location.scheme == "keyword")
this.mBrowser.userTypedValue = null;
@@ -686,13 +686,12 @@
let topLevel = aWebProgress.isTopLevel;
if (topLevel) {
- // If userTypedClear > 0, the document loaded correctly and we should be
- // clearing the user typed value. We also need to clear the typed value
+ // We need to clear the typed value
// if the document failed to load, to make sure the urlbar reflects the
// failed URI (particularly for SSL errors). However, don't clear the value
// if the error page's URI is about:blank, because that causes complete
// loss of urlbar contents for invalid URI errors (see bug 867957).
- if (this.mBrowser.userTypedClear > 0 ||
+ if (this.mBrowser.didStartLoadSinceLastUserTyping() ||
((aFlags & Ci.nsIWebProgressListener.LOCATION_CHANGE_ERROR_PAGE) &&
aLocation.spec != "about:blank"))
this.mBrowser.userTypedValue = null;
@@ -707,7 +706,8 @@
let autocomplete = this.mTabBrowser._placesAutocomplete;
if (this.mBrowser.registeredOpenURI) {
- autocomplete.unregisterOpenPage(this.mBrowser.registeredOpenURI);
+ autocomplete.unregisterOpenPage(this.mBrowser.registeredOpenURI,
+ this.mBrowser.getAttribute("usercontextid") || 0);
delete this.mBrowser.registeredOpenURI;
}
// Tabs in private windows aren't registered as "Open" so
@@ -715,7 +715,8 @@
if (!isBlankPageURL(aLocation.spec) &&
(!PrivateBrowsingUtils.isWindowPrivate(window) ||
PrivateBrowsingUtils.permanentPrivateBrowsing)) {
- autocomplete.registerOpenPage(aLocation);
+ autocomplete.registerOpenPage(aLocation,
+ this.mBrowser.getAttribute("usercontextid") || 0);
this.mBrowser.registeredOpenURI = aLocation;
}
}
@@ -726,8 +727,10 @@
aFlags]);
}
- if (topLevel)
+ if (topLevel) {
this.mBrowser.lastURI = aLocation;
+ this.mBrowser.lastLocationChange = Date.now();
+ }
},
onStatusChange: function (aWebProgress, aRequest, aStatus, aMessage) {
@@ -766,19 +769,28 @@
<method name="setIcon">
<parameter name="aTab"/>
<parameter name="aURI"/>
+ <parameter name="aLoadingPrincipal"/>
<body>
<![CDATA[
- var browser = this.getBrowserForTab(aTab);
+ let browser = this.getBrowserForTab(aTab);
browser.mIconURL = aURI instanceof Ci.nsIURI ? aURI.spec : aURI;
if (aURI && this.mFaviconService) {
- if (!(aURI instanceof Ci.nsIURI))
+ if (!(aURI instanceof Ci.nsIURI)) {
aURI = makeURI(aURI);
- this.mFaviconService.setAndFetchFaviconForPage(browser.currentURI,
- aURI, false,
- PrivateBrowsingUtils.isWindowPrivate(window) ?
- this.mFaviconService.FAVICON_LOAD_PRIVATE :
- this.mFaviconService.FAVICON_LOAD_NON_PRIVATE);
+ }
+ // We do not serialize the principal from within SessionStore.jsm,
+ // hence if aLoadingPrincipal is null we default to the
+ // systemPrincipal which will allow the favicon to load.
+ let loadingPrincipal = aLoadingPrincipal
+ ? aLoadingPrincipal
+ : Services.scriptSecurityManager.getSystemPrincipal();
+ let loadType = PrivateBrowsingUtils.isWindowPrivate(window)
+ ? this.mFaviconService.FAVICON_LOAD_PRIVATE
+ : this.mFaviconService.FAVICON_LOAD_NON_PRIVATE;
+
+ this.mFaviconService.setAndFetchFaviconForPage(
+ browser.currentURI, aURI, false, loadType, null, loadingPrincipal);
}
let sizedIconUrl = browser.mIconURL || "";
@@ -874,7 +886,7 @@
if (!this.isFailedIcon(url))
icon = url;
}
- this.setIcon(aTab, icon);
+ this.setIcon(aTab, icon, browser.contentPrincipal);
]]>
</body>
</method>
@@ -1252,6 +1264,7 @@
<parameter name="aAllowThirdPartyFixup"/>
<body>
<![CDATA[
+ var aReferrerPolicy;
var aFromExternal;
var aRelatedToCurrent;
if (arguments.length == 2 &&
@@ -1259,6 +1272,7 @@
!(arguments[1] instanceof Ci.nsIURI)) {
let params = arguments[1];
aReferrerURI = params.referrerURI;
+ aReferrerPolicy = params.referrerPolicy;
aCharset = params.charset;
aPostData = params.postData;
aLoadInBackground = params.inBackground;
@@ -1272,6 +1286,7 @@
var owner = bgLoad ? null : this.selectedTab;
var tab = this.addTab(aURI, {
referrerURI: aReferrerURI,
+ referrerPolicy: aReferrerPolicy,
charset: aCharset,
postData: aPostData,
ownerTab: owner,
@@ -1291,6 +1306,24 @@
<parameter name="aLoadInBackground"/>
<parameter name="aReplace"/>
<body><![CDATA[
+ let aAllowThirdPartyFixup;
+ let aTargetTab;
+ let aNewIndex = -1;
+ let aPostDatas = [];
+ let aUserContextId;
+ if (arguments.length == 2 &&
+ typeof arguments[1] == "object") {
+ let params = arguments[1];
+ aLoadInBackground = params.inBackground;
+ aReplace = params.replace;
+ aAllowThirdPartyFixup = params.allowThirdPartyFixup;
+ aTargetTab = params.targetTab;
+ aNewIndex = typeof params.newIndex === "number" ?
+ params.newIndex : aNewIndex;
+ aPostDatas = params.postDatas || aPostDatas;
+ aUserContextId = params.userContextId;
+ }
+
if (!aURIs.length)
return;
@@ -1308,22 +1341,53 @@
var multiple = aURIs.length > 1;
var owner = multiple || aLoadInBackground ? null : this.selectedTab;
var firstTabAdded = null;
+ var targetTabIndex = -1;
if (aReplace) {
+ let browser;
+ if (aTargetTab) {
+ browser = this.getBrowserForTab(aTargetTab);
+ targetTabIndex = aTargetTab._tPos;
+ } else {
+ browser = this.mCurrentBrowser;
+ targetTabIndex = this.tabContainer.selectedIndex;
+ }
+ let flags = Ci.nsIWebNavigation.LOAD_FLAGS_NONE;
+ if (aAllowThirdPartyFixup) {
+ flags |= Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
+ Ci.nsIWebNavigation.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
+ }
try {
- this.loadURI(aURIs[0], null, null);
+ browser.loadURIWithFlags(aURIs[0], {
+ flags, postData: aPostDatas[0]
+ });
} catch (e) {
// Ignore failure in case a URI is wrong, so we can continue
// opening the next ones.
}
+ } else {
+ firstTabAdded = this.addTab(aURIs[0], {
+ ownerTab: owner,
+ skipAnimation: multiple,
+ allowThirdPartyFixup: aAllowThirdPartyFixup,
+ postData: aPostDatas[0],
+ userContextId: aUserContextId
+ });
+ if (aNewIndex !== -1) {
+ this.moveTabTo(firstTabAdded, aNewIndex);
+ targetTabIndex = firstTabAdded._tPos;
+ }
}
- else
- firstTabAdded = this.addTab(aURIs[0], {ownerTab: owner, skipAnimation: multiple});
- var tabNum = this.tabContainer.selectedIndex;
+ let tabNum = targetTabIndex;
for (let i = 1; i < aURIs.length; ++i) {
- let tab = this.addTab(aURIs[i], {skipAnimation: true});
- if (aReplace)
+ let tab = this.addTab(aURIs[i], {
+ skipAnimation: true,
+ allowThirdPartyFixup: aAllowThirdPartyFixup,
+ postData: aPostDatas[i],
+ userContextId: aUserContextId
+ });
+ if (targetTabIndex !== -1)
this.moveTabTo(tab, ++tabNum);
}
@@ -1348,6 +1412,7 @@
<body>
<![CDATA[
const NS_XUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
+ var aReferrerPolicy;
var aFromExternal;
var aRelatedToCurrent;
var aSkipAnimation;
@@ -1356,6 +1421,7 @@
!(arguments[1] instanceof Ci.nsIURI)) {
let params = arguments[1];
aReferrerURI = params.referrerURI;
+ aReferrerPolicy = params.referrerPolicy;
aCharset = params.charset;
aPostData = params.postData;
aOwner = params.ownerTab;
@@ -1430,6 +1496,10 @@
b.setAttribute("autocompletepopup", this.getAttribute("autocompletepopup"));
b.setAttribute("autoscrollpopup", this._autoScrollPopup.id);
+ if (this.hasAttribute("datetimepicker")) {
+ b.setAttribute("datetimepicker", this.getAttribute("datetimepicker"));
+ }
+
// Create the browserStack container
var stack = document.createElementNS(NS_XUL, "stack");
stack.className = "browserStack";
@@ -1523,7 +1593,13 @@
if (aFromExternal)
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL;
try {
- b.loadURIWithFlags(aURI, flags, aReferrerURI, aCharset, aPostData);
+ b.loadURIWithFlags(aURI, {
+ flags: flags,
+ referrerURI: aReferrerURI,
+ referrerPolicy: aReferrerPolicy,
+ charset: aCharset,
+ postData: aPostData,
+ });
} catch (ex) {
Cu.reportError(ex);
}
@@ -1566,7 +1642,7 @@
}
if (animate) {
- mozRequestAnimationFrame(function () {
+ requestAnimationFrame(function () {
this.tabContainer._handleTabTelemetryStart(t, aURI);
// kick the animation off
@@ -1865,7 +1941,8 @@
this.mTabListeners[aTab._tPos].destroy();
if (browser.registeredOpenURI && !aTabWillBeMoved) {
- this._placesAutocomplete.unregisterOpenPage(browser.registeredOpenURI);
+ this._placesAutocomplete.unregisterOpenPage(browser.registeredOpenURI,
+ browser.getAttribute("usercontextid") || 0);
delete browser.registeredOpenURI;
}
@@ -2133,7 +2210,7 @@
// Workarounds for bug 458697
// Icon might have been set on DOMLinkAdded, don't override that.
if (!ourBrowser.mIconURL && otherBrowser.mIconURL)
- this.setIcon(aOurTab, otherBrowser.mIconURL);
+ this.setIcon(aOurTab, otherBrowser.mIconURL, otherBrowser.contentPrincipal);
var isBusy = aOtherTab.hasAttribute("busy");
if (isBusy) {
aOurTab.setAttribute("busy", "true");
@@ -2209,7 +2286,8 @@
<![CDATA[
// If the current URI is registered as open remove it from the list.
if (aOurBrowser.registeredOpenURI) {
- this._placesAutocomplete.unregisterOpenPage(aOurBrowser.registeredOpenURI);
+ this._placesAutocomplete.unregisterOpenPage(aOurBrowser.registeredOpenURI,
+ aOurBrowser.getAttribute("usercontextid") || 0);
delete aOurBrowser.registeredOpenURI;
}
@@ -2633,6 +2711,11 @@
<parameter name="aPostData"/>
<body>
<![CDATA[
+ // Note - the callee understands both:
+ // (a) loadURIWithFlags(aURI, aFlags, ...)
+ // (b) loadURIWithFlags(aURI, { flags: aFlags, ... })
+ // Forwarding it as (a) here actually supports both (a) and (b),
+ // so you can call us either way too.
return this.mCurrentBrowser.loadURIWithFlags(aURI, aFlags, aReferrerURI, aCharset, aPostData);
]]>
</body>
@@ -2716,6 +2799,9 @@
get finder() {
return this.mTabBrowser.mCurrentBrowser.finder;
},
+ destroy: function() {
+ this.finder.destroy();
+ },
addResultListener: function(aListener) {
this.mListeners.add(aListener);
this.finder.addResultListener(aListener);
@@ -2736,21 +2822,33 @@
set caseSensitive(val) {
return this.finder.caseSensitive = val;
},
- fastFind: function(aSearchString, aLinksOnly, aDrawOutline) {
- this.finder.fastFind(aSearchString, aLinksOnly, aDrawOutline);
+ set entireWord(val) {
+ return this.finder.entireWord = val;
+ },
+ get highlighter() {
+ return this.finder.highlighter;
},
- findAgain: function(aFindBackwards, aLinksOnly, aDrawOutline) {
- this.finder.findAgain(aFindBackwards, aLinksOnly, aDrawOutline);
+ get matchesCountLimit() {
+ return this.finder.matchesCountLimit;
+ },
+ fastFind: function(...args) {
+ this.finder.fastFind(...args);
+ },
+ findAgain: function(...args) {
+ this.finder.findAgain(...args);
},
setSearchStringToSelection: function() {
return this.finder.setSearchStringToSelection();
},
- highlight: function(aHighlight, aWord) {
- this.finder.highlight(aHighlight, aWord);
+ highlight: function(...args) {
+ this.finder.highlight(...args);
},
getInitialSelection: function() {
this.finder.getInitialSelection();
},
+ getActiveSelectionText: function() {
+ return this.finder.getActiveSelectionText();
+ },
enableSelection: function() {
this.finder.enableSelection();
},
@@ -2760,11 +2858,38 @@
focusContent: function() {
this.finder.focusContent();
},
+ onFindbarClose: function() {
+ this.finder.onFindbarClose();
+ },
+ onFindbarOpen: function() {
+ this.finder.onFindbarOpen();
+ },
+ onModalHighlightChange: function(...args) {
+ return this.finder.onModalHighlightChange(...args);
+ },
+ onHighlightAllChange: function(...args) {
+ return this.finder.onHighlightAllChange(...args);
+ },
keyPress: function(aEvent) {
this.finder.keyPress(aEvent);
},
- requestMatchesCount: function(aWord, aMatchLimit, aLinksOnly) {
- this.finder.requestMatchesCount(aWord, aMatchLimit, aLinksOnly);
+ requestMatchesCount: function(...args) {
+ this.finder.requestMatchesCount(...args);
+ },
+ onIteratorRangeFound: function(...args) {
+ this.finder.onIteratorRangeFound(...args);
+ },
+ onIteratorReset: function() {
+ this.finder.onIteratorReset();
+ },
+ onIteratorRestart: function(...args) {
+ this.finder.onIteratorRestart(...args);
+ },
+ onIteratorStart: function(...args) {
+ this.finder.onIteratorStart(...args);
+ },
+ onLocationChange: function(...args) {
+ this.finder.onLocationChange(...args);
}
})
]]></field>
@@ -2773,6 +2898,19 @@
onget="return this.mCurrentBrowser.docShell"
readonly="true"/>
+ <property name="messageManager"
+ readonly="true">
+ <getter>
+ <![CDATA[
+ let frameLoader = this.mCurrentBrowser.frameLoader;
+ if (!frameLoader) {
+ return null;
+ }
+ return frameLoader.messageManager;
+ ]]>
+ </getter>
+ </property>
+
<property name="webNavigation"
onget="return this.mCurrentBrowser.webNavigation"
readonly="true"/>
@@ -2789,6 +2927,10 @@
readonly="true"
onget="return this.mCurrentBrowser.contentWindow"/>
+ <property name="contentWindowAsCPOW"
+ readonly="true"
+ onget="return this.mCurrentBrowser.contentWindow;"/>
+
<property name="sessionHistory"
onget="return this.mCurrentBrowser.sessionHistory;"
readonly="true"/>
@@ -2809,6 +2951,10 @@
onget="return this.mCurrentBrowser.contentDocument;"
readonly="true"/>
+ <property name="contentDocumentAsCPOW"
+ onget="return this.mCurrentBrowser.contentDocument;"
+ readonly="true"/>
+
<property name="contentTitle"
onget="return this.mCurrentBrowser.contentTitle;"
readonly="true"/>
@@ -2859,23 +3005,6 @@
}
}
- // We need to take care of FAYT-watching as long as the findbar
- // isn't initialized. The checks on aEvent are copied from
- // _shouldFastFind (see findbar.xml).
- if (!gFindBarInitialized &&
- !(aEvent.ctrlKey || aEvent.metaKey) &&
- !aEvent.defaultPrevented) {
- let charCode = aEvent.charCode;
- if (charCode) {
- let char = String.fromCharCode(charCode);
- if (char == "'" || char == "/" ||
- Services.prefs.getBoolPref("accessibility.typeaheadfind")) {
- gFindBar._onBrowserKeypress(aEvent);
- return;
- }
- }
- }
-
#ifdef XP_MACOSX
if (!aEvent.metaKey)
return;
@@ -2903,10 +3032,6 @@
]]></body>
</method>
- <property name="userTypedClear"
- onget="return this.mCurrentBrowser.userTypedClear;"
- onset="return this.mCurrentBrowser.userTypedClear = val;"/>
-
<property name="userTypedValue"
onget="return this.mCurrentBrowser.userTypedValue;"
onset="return this.mCurrentBrowser.userTypedValue = val;"/>
@@ -2950,13 +3075,31 @@
let browser = aMessage.target;
switch (aMessage.name) {
- case "DOMTitleChanged":
+ case "DOMTitleChanged": {
let tab = this.getTabForBrowser(browser);
if (!tab)
return;
let titleChanged = this.setTabTitle(tab);
if (titleChanged && !tab.selected && !tab.hasAttribute("busy"))
tab.setAttribute("titlechanged", "true");
+ break;
+ }
+ case "DOMWebNotificationClicked": {
+ let tab = this.getTabForBrowser(browser);
+ if (!tab)
+ return;
+ this.selectedTab = tab;
+ window.focus();
+ break;
+ }
+ case "Findbar:Keypress":
+ if (!gFindBarInitialized) {
+ // If the find bar for this tab is not yet alive, change that,
+ // and make sure we return the result:
+ return gFindBar.receiveMessage(aMessage);
+ }
+ break;
+
}
]]></body>
</method>
@@ -3022,6 +3165,8 @@
this._outerWindowIDBrowserMap.set(this.mCurrentBrowser.outerWindowID,
this.mCurrentBrowser);
}
+ messageManager.addMessageListener("DOMWebNotificationClicked", this);
+ messageManager.addMessageListener("Findbar:Keypress", this);
]]>
</constructor>
@@ -3055,7 +3200,8 @@
for (var i = 0; i < this.mTabListeners.length; ++i) {
let browser = this.getBrowserAtIndex(i);
if (browser.registeredOpenURI) {
- this._placesAutocomplete.unregisterOpenPage(browser.registeredOpenURI);
+ this._placesAutocomplete.unregisterOpenPage(browser.registeredOpenURI,
+ browser.getAttribute("usercontextid") || 0);
delete browser.registeredOpenURI;
}
browser.webProgress.removeProgressListener(this.mTabFilters[i]);
@@ -4362,40 +4508,35 @@
this.tabbrowser.updateCurrentBrowser(true);
} else {
// Pass true to disallow dropping javascript: or data: urls
- let url;
+ let links;
try {
- url = browserDragAndDrop.drop(event, { }, true);
+ links = browserDragAndDrop.dropLinks(event, true);
} catch (ex) {}
// // valid urls don't contain spaces ' '; if we have a space it isn't a valid url.
// if (!url || url.includes(" ")) //PMed
- if (!url) //FF
+ if (!links || links.length === 0) //FF
return;
- let bgLoad = Services.prefs.getBoolPref("browser.tabs.loadInBackground");
+ let inBackground = Services.prefs.getBoolPref("browser.tabs.loadInBackground");
if (event.shiftKey)
- bgLoad = !bgLoad;
+ inBackground = !inBackground;
- let tab = this._getDragTargetTab(event);
- if (!tab || dropEffect == "copy") {
- // We're adding a new tab.
- let newIndex = this._getDropIndex(event);
- let newTab = this.tabbrowser.loadOneTab(url, {inBackground: bgLoad, allowThirdPartyFixup: true});
- this.tabbrowser.moveTabTo(newTab, newIndex);
- } else {
- // Load in an existing tab.
- try {
- let webNav = Ci.nsIWebNavigation;
- let flags = webNav.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
- webNav.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
- this.tabbrowser.getBrowserForTab(tab).loadURIWithFlags(url, flags);
- if (!bgLoad)
- this.selectedItem = tab;
- } catch(ex) {
- // Just ignore invalid urls
- }
- }
+ let targetTab = this._getDragTargetTab(event);
+ let userContextId = this.selectedItem
+ .getAttribute("usercontextid") || 0;
+ let replace = !(!targetTab || dropEffect == "copy");
+ let newIndex = this._getDropIndex(event);
+ let urls = links.map(link => link.url);
+ this.tabbrowser.loadTabs(urls, {
+ inBackground,
+ replace,
+ allowThirdPartyFixup: true,
+ targetTab,
+ newIndex,
+ userContextId,
+ });
}
if (draggedTab) {
diff --git a/application/palemoon/base/content/urlbarBindings.xml b/application/palemoon/base/content/urlbarBindings.xml
index c99819f0d3..985769ec2d 100644
--- a/application/palemoon/base/content/urlbarBindings.xml
+++ b/application/palemoon/base/content/urlbarBindings.xml
@@ -17,32 +17,32 @@
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
- <binding id="urlbar" extends="chrome://global/content/bindings/autocomplete.xml#autocomplete">
+ <binding id="urlbar" extends="chrome://browser/content/autocomplete.xml#private-autocomplete">
<content sizetopopup="pref">
<xul:hbox anonid="textbox-container"
- class="autocomplete-textbox-container urlbar-textbox-container"
+ class="private-autocomplete-textbox-container urlbar-textbox-container"
flex="1" xbl:inherits="focused">
<children includes="image|deck|stack|box">
- <xul:image class="autocomplete-icon" allowevents="true"/>
+ <xul:image class="private-autocomplete-icon" allowevents="true"/>
</children>
<xul:hbox anonid="textbox-input-box"
class="textbox-input-box urlbar-input-box"
flex="1" xbl:inherits="tooltiptext=inputtooltiptext">
<children/>
<html:input anonid="input"
- class="autocomplete-textbox urlbar-input textbox-input uri-element-right-align"
+ class="private-autocomplete-textbox urlbar-input textbox-input uri-element-right-align"
allowevents="true"
xbl:inherits="tooltiptext=inputtooltiptext,value,type,maxlength,disabled,size,readonly,placeholder,tabindex,accesskey"/>
</xul:hbox>
<children includes="hbox"/>
</xul:hbox>
<xul:dropmarker anonid="historydropmarker"
- class="autocomplete-history-dropmarker urlbar-history-dropmarker"
+ class="private-autocomplete-history-dropmarker urlbar-history-dropmarker"
allowevents="true"
xbl:inherits="open,enablehistory,parentfocused=focused"/>
<xul:popupset anonid="popupset"
- class="autocomplete-result-popupset"/>
+ class="private-autocomplete-result-popupset"/>
<children includes="toolbarbutton"/>
</content>
@@ -263,6 +263,9 @@
var postData = null;
var action = this._parseActionUrl(url);
+ let lastLocationChange = gBrowser.selectedBrowser.lastLocationChange;
+
+ let matchLastLocationChange = true;
if (action) {
url = action.param;
if (this.hasAttribute("actiontype")) {
@@ -275,82 +278,94 @@
}
return;
}
+ continueOperation.call(this);
}
else {
- [url, postData, mayInheritPrincipal] = this._canonizeURL(aTriggeringEvent);
- if (!url)
- return;
- }
-
- this.value = url;
- gBrowser.userTypedValue = url;
- try {
- addToUrlbarHistory(url);
- } catch (ex) {
- // Things may go wrong when adding url to session history,
- // but don't let that interfere with the loading of the url.
- Cu.reportError(ex);
+ this._canonizeURL(aTriggeringEvent, response => {
+ [url, postData, mayInheritPrincipal] = response;
+ if (url) {
+ matchLastLocationChange = (lastLocationChange ==
+ gBrowser.selectedBrowser.lastLocationChange);
+ continueOperation.call(this);
+ }
+ });
}
- function loadCurrent() {
- let webnav = Ci.nsIWebNavigation;
- let flags = webnav.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP |
- webnav.LOAD_FLAGS_FIXUP_SCHEME_TYPOS;
- // Pass LOAD_FLAGS_DISALLOW_INHERIT_OWNER to prevent any loads from
- // inheriting the currently loaded document's principal, unless this
- // URL is marked as safe to inherit (e.g. came from a bookmark
- // keyword).
- if (!mayInheritPrincipal)
- flags |= Ci.nsIWebNavigation.LOAD_FLAGS_DISALLOW_INHERIT_OWNER;
- gBrowser.loadURIWithFlags(url, flags, null, null, postData);
- }
+ function continueOperation()
+ {
+ this.value = url;
+ gBrowser.userTypedValue = url;
+ try {
+ addToUrlbarHistory(url);
+ } catch (ex) {
+ // Things may go wrong when adding url to session history,
+ // but don't let that interfere with the loading of the url.
+ Cu.reportError(ex);
+ }
- // Focus the content area before triggering loads, since if the load
- // occurs in a new tab, we want focus to be restored to the content
- // area when the current tab is re-selected.
- gBrowser.selectedBrowser.focus();
+ function loadCurrent() {
+ let flags = Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP;
+ // Pass LOAD_FLAGS_DISALLOW_INHERIT_OWNER to prevent any loads from
+ // inheriting the currently loaded document's principal, unless this
+ // URL is marked as safe to inherit (e.g. came from a bookmark
+ // keyword).
+ if (!mayInheritPrincipal)
+ flags |= Ci.nsIWebNavigation.LOAD_FLAGS_DISALLOW_INHERIT_OWNER;
+ // If the value wasn't typed, we know that we decoded the value as
+ // UTF-8 (see losslessDecodeURI)
+ if (!this.valueIsTyped)
+ flags |= Ci.nsIWebNavigation.LOAD_FLAGS_URI_IS_UTF8;
+ gBrowser.loadURIWithFlags(url, flags, null, null, postData);
+ }
- let isMouseEvent = aTriggeringEvent instanceof MouseEvent;
- let altEnter = !isMouseEvent && aTriggeringEvent && aTriggeringEvent.altKey;
+ // Focus the content area before triggering loads, since if the load
+ // occurs in a new tab, we want focus to be restored to the content
+ // area when the current tab is re-selected.
+ gBrowser.selectedBrowser.focus();
- if (altEnter) {
- // XXX This was added a long time ago, and I'm not sure why it is
- // necessary. Alt+Enter's default action might cause a system beep,
- // or something like that?
- aTriggeringEvent.preventDefault();
- aTriggeringEvent.stopPropagation();
- }
+ let isMouseEvent = aTriggeringEvent instanceof MouseEvent;
- // If the current tab is empty, ignore Alt+Enter (just reuse this tab)
- altEnter = altEnter && !isTabEmpty(gBrowser.selectedTab);
+ // If the current tab is empty, ignore Alt+Enter (just reuse this tab)
+ let altEnter = !isMouseEvent && aTriggeringEvent &&
+ aTriggeringEvent.altKey && !isTabEmpty(gBrowser.selectedTab);
- if (isMouseEvent || altEnter) {
- // Use the standard UI link behaviors for clicks or Alt+Enter
- let where = "tab";
- if (isMouseEvent)
- where = whereToOpenLink(aTriggeringEvent, false, false);
+ if (isMouseEvent || altEnter) {
+ // Use the standard UI link behaviors for clicks or Alt+Enter
+ let where = "tab";
+ if (isMouseEvent)
+ where = whereToOpenLink(aTriggeringEvent, false, false);
- if (where == "current") {
- loadCurrent();
+ if (where == "current") {
+ if (matchLastLocationChange) {
+ loadCurrent();
+ }
+ } else {
+ this.handleRevert();
+ let params = { allowThirdPartyFixup: true,
+ postData: postData,
+ initiatingDoc: document };
+ if (!this.valueIsTyped)
+ params.isUTF8 = true;
+ openUILinkIn(url, where, params);
+ }
} else {
- this.handleRevert();
- let params = { allowThirdPartyFixup: true,
- postData: postData,
- initiatingDoc: document };
- openUILinkIn(url, where, params);
+ if (matchLastLocationChange) {
+ loadCurrent();
+ }
}
- } else {
- loadCurrent();
}
]]></body>
</method>
<method name="_canonizeURL">
<parameter name="aTriggeringEvent"/>
+ <parameter name="aCallback"/>
<body><![CDATA[
var url = this.value;
- if (!url)
- return ["", null, false];
+ if (!url) {
+ aCallback(["", null, false]);
+ return;
+ }
// Only add the suffix when the URL bar value isn't already "URL-like",
// and only if we get a keyboard event, to match user expectations.
@@ -403,11 +418,9 @@
}
}
- var postData = {};
- var mayInheritPrincipal = { value: false };
- url = getShortcutOrURI(url, postData, mayInheritPrincipal);
-
- return [url, postData.value, mayInheritPrincipal.value];
+ getShortcutOrURIAndPostData(url).then(data => {
+ aCallback([data.url, data.postData, data.mayInheritPrincipal]);
+ });
]]></body>
</method>
@@ -442,11 +455,12 @@
<method name="onDrop">
<parameter name="aEvent"/>
<body><![CDATA[
- let url = browserDragAndDrop.drop(aEvent, { })
+ let links = browserDragAndDrop.dropLinks(aEvent);
// The URL bar automatically handles inputs with newline characters,
// so we can get away with treating text/x-moz-url flavours as text/plain.
- if (url) {
+ if (links.length > 0 && links[0].url) {
+ let url = links[0].url;
aEvent.preventDefault();
this.value = url;
SetPageProxyState("invalid");
@@ -823,7 +837,7 @@
</implementation>
</binding>
- <binding id="urlbar-rich-result-popup" extends="chrome://global/content/bindings/autocomplete.xml#autocomplete-rich-result-popup">
+ <binding id="urlbar-rich-result-popup" extends="chrome://browser/content/autocomplete.xml#private-autocomplete-rich-result-popup">
<implementation>
<field name="_maxResults">0</field>
@@ -990,9 +1004,11 @@
document.getAnonymousElementByAttribute(this, "anonid", "cancel");
</field>
<field name="DownloadUtils" readonly="true">
- let utils = {};
- Components.utils.import("resource://gre/modules/DownloadUtils.jsm", utils);
- utils.DownloadUtils;
+ {
+ let utils = {};
+ Components.utils.import("resource://gre/modules/DownloadUtils.jsm", utils);
+ utils.DownloadUtils;
+ }
</field>
<method name="destroy">
@@ -1354,8 +1370,8 @@
return;
}
- let host = gPluginHandler._getHostFromPrincipal(this.notification.browser.contentWindow.document.nodePrincipal);
- this._setupDescription("pluginActivateMultiple.message", null, host);
+ let prePath = this.notification.browser.contentWindow.document.nodePrincipal.URI.prePath;
+ this._setupDescription("pluginActivateMultiple.message", null, prePath);
var showBox = document.getAnonymousElementByAttribute(this, "anonid", "plugin-notification-showbox");
@@ -1394,7 +1410,7 @@
<method name="_setupSingleState">
<body><![CDATA[
var action = this.notification.options.centerActions[0];
- var host = action.pluginPermissionHost;
+ var prePath = action.pluginPermissionPrePath;
let label, linkLabel, linkUrl, button1, button2;
@@ -1489,7 +1505,7 @@
Cu.reportError(Error("Unexpected blocklist state"));
}
}
- this._setupDescription(label, action.pluginName, host);
+ this._setupDescription(label, action.pluginName, prePath);
this._setupLink(linkLabel, action.detailsLink);
this._primaryButton.label = gNavigatorBundle.getString(button1.label);
@@ -1510,7 +1526,7 @@
<method name="_setupDescription">
<parameter name="baseString" />
<parameter name="pluginName" /> <!-- null for the multiple-plugin case -->
- <parameter name="host" />
+ <parameter name="prePath" />
<body><![CDATA[
var bsn = this._brandShortName;
var span = document.getAnonymousElementByAttribute(this, "anonid", "click-to-play-plugins-notification-description");
@@ -1518,17 +1534,17 @@
span.removeChild(span.lastChild);
}
- var args = ["__host__", this._brandShortName];
+ var args = ["__prepath__", this._brandShortName];
if (pluginName) {
args.unshift(pluginName);
}
var bases = gNavigatorBundle.getFormattedString(baseString, args).
- split("__host__", 2);
+ split("__prepath__", 2);
span.appendChild(document.createTextNode(bases[0]));
- var hostSpan = document.createElementNS("http://www.w3.org/1999/xhtml", "em");
- hostSpan.appendChild(document.createTextNode(host));
- span.appendChild(hostSpan);
+ var prePathSpan = document.createElementNS("http://www.w3.org/1999/xhtml", "em");
+ prePathSpan.appendChild(document.createTextNode(prePath));
+ span.appendChild(prePathSpan);
span.appendChild(document.createTextNode(bases[1] + " "));
]]></body>
</method>
@@ -1764,203 +1780,14 @@
</implementation>
</binding>
- <binding id="promobox">
- <content>
- <xul:hbox class="panel-promo-box" align="start" flex="1">
- <xul:hbox align="center" flex="1">
- <xul:image class="panel-promo-icon"/>
- <xul:description anonid="promo-message" class="panel-promo-message" flex="1">
- <xul:description anonid="promo-link"
- class="plain text-link inline-link"
- onclick="document.getBindingParent(this).onLinkClick();"/>
- </xul:description>
- </xul:hbox>
- <xul:toolbarbutton class="panel-promo-closebutton close-icon"
- oncommand="document.getBindingParent(this).onCloseButtonCommand();"
- tooltiptext="&closeNotification.tooltip;"/>
- </xul:hbox>
- </content>
-
- <implementation implements="nsIDOMEventListener">
- <constructor><![CDATA[
- this._panel.addEventListener("popupshowing", this, false);
- ]]></constructor>
-
- <destructor><![CDATA[
- this._panel.removeEventListener("popupshowing", this, false);
- ]]></destructor>
-
- <field name="_panel" readonly="true"><![CDATA[
- let node = this.parentNode;
- while(node && node.localName != "panel") {
- node = node.parentNode;
- }
- node;
- ]]></field>
- <field name="_promomessage" readonly="true">
- document.getAnonymousElementByAttribute(this, "anonid", "promo-message");
- </field>
- <field name="_promolink" readonly="true">
- document.getAnonymousElementByAttribute(this, "anonid", "promo-link");
- </field>
- <field name="_brandBundle" readonly="true">
- Services.strings.createBundle("chrome://branding/locale/brand.properties");
- </field>
- <property name="_viewsLeftMap">
- <getter><![CDATA[
- let viewsLeftMap = {};
- try {
- viewsLeftMap = JSON.parse(Services.prefs.getCharPref("browser.syncPromoViewsLeftMap"));
- } catch (ex) {
- // If the old preference exists, migrate it to the new one.
- try {
- let oldPref = Services.prefs.getIntPref("browser.syncPromoViewsLeft");
- Services.prefs.clearUserPref("browser.syncPromoViewsLeft");
- viewsLeftMap.bookmarks = oldPref;
- viewsLeftMap.passwords = oldPref;
- Services.prefs.setCharPref("browser.syncPromoViewsLeftMap",
- JSON.stringify(viewsLeftMap));
- } catch (ex2) {}
- }
- return viewsLeftMap;
- ]]></getter>
- </property>
- <property name="_viewsLeft">
- <getter><![CDATA[
- let views = 5;
- let map = this._viewsLeftMap;
- if (this._notificationType in map) {
- views = map[this._notificationType];
- }
- return views;
- ]]></getter>
- <setter><![CDATA[
- let map = this._viewsLeftMap;
- map[this._notificationType] = val;
- Services.prefs.setCharPref("browser.syncPromoViewsLeftMap",
- JSON.stringify(map));
- return val;
- ]]></setter>
- </property>
- <property name="_notificationType">
- <getter><![CDATA[
- // Use the popupid attribute to identify the notification type,
- // otherwise just rely on the panel id for common arrowpanels.
- let type = this._panel.firstChild.getAttribute("popupid") ||
- this._panel.id;
- if (type.startsWith("password-"))
- return "passwords";
- if (type == "editBookmarkPanel")
- return "bookmarks";
- if (type == "addon-install-complete") {
- if (!Services.prefs.prefHasUserValue("services.sync.username"))
- return "addons";
- if (!Services.prefs.getBoolPref("services.sync.engine.addons"))
- return "addons-sync-disabled";
- }
- return null;
- ]]></getter>
- </property>
- <property name="_notificationMessage">
- <getter><![CDATA[
- return gNavigatorBundle.getFormattedString(
- "syncPromoNotification." + this._notificationType + ".description",
- [this._brandBundle.GetStringFromName("syncBrandShortName")]
- );
- ]]></getter>
- </property>
- <property name="_notificationLink">
- <getter><![CDATA[
- if (this._notificationType == "addons-sync-disabled") {
- return "https://forum.palemoon.org/viewforum.php?f=52";
- }
- return "http://www.palemoon.org/sync/";
- ]]></getter>
- </property>
- <method name="onCloseButtonCommand">
- <body><![CDATA[
- this._viewsLeft = 0;
- this.hidden = true;
- ]]></body>
- </method>
- <method name="onLinkClick">
- <body><![CDATA[
- // Open a new selected tab and close the current panel.
- gBrowser.loadOneTab(this._promolink.getAttribute("href"),
- { inBackground: false });
- this._panel.hidePopup();
- ]]></body>
- </method>
- <method name="handleEvent">
- <parameter name="event"/>
- <body><![CDATA[
- if (event.type != "popupshowing" || event.target != this._panel)
- return;
-
- // A previous notification may have unhidden this.
- this.hidden = true;
-
- // Only handle supported notification panels.
- if (!this._notificationType) {
- return;
- }
-
- let viewsLeft = this._viewsLeft;
- if (viewsLeft) {
- // XXX: Short-circuit this for now.
- // TO-DO: Clean up this code for sync promotion
- this._viewsLeft = 0;
- viewsLeft = 0;
- return;
- // XXX
-
- if (Services.prefs.prefHasUserValue("services.sync.username") &&
- this._notificationType != "addons-sync-disabled") {
- // If the user has already setup Sync, don't show the notification.
- this._viewsLeft = 0;
- // Be sure to hide the panel, in case it was visible and the user
- // decided to setup Sync after noticing it.
- viewsLeft = 0;
- // The panel is still hidden, just bail out.
- return;
- }
- else {
- this._viewsLeft = viewsLeft - 1;
- }
-
- this._promolink.setAttribute("href", this._notificationLink);
- this._promolink.value = gNavigatorBundle.getString("syncPromoNotification.learnMoreLinkText");
-
- this.hidden = false;
-
- // HACK: The description element doesn't wrap correctly in panels,
- // thus set a width on it, based on the available space, before
- // setting its textContent. Then set its height as well, to
- // fix wrong height calculation on Linux (bug 659578).
- this._panel.addEventListener("popupshown", function panelShown() {
- this._panel.removeEventListener("popupshown", panelShown, true);
- // Previous popupShown events may close the panel or change
- // its contents, so ensure this is still valid.
- if (this._panel.state != "open" || !this._notificationType)
- return;
- this._promomessage.width = this._promomessage.getBoundingClientRect().width;
- this._promomessage.firstChild.textContent = this._notificationMessage;
- this._promomessage.height = this._promomessage.getBoundingClientRect().height;
- }.bind(this), true);
- }
- ]]></body>
- </method>
- </implementation>
- </binding>
-
<binding id="toolbarbutton-badged" display="xul:button"
extends="chrome://global/content/bindings/toolbarbutton.xml#toolbarbutton">
<content>
<children includes="observes|template|menupopup|panel|tooltip"/>
- <xul:hbox class="toolbarbutton-badge-container" align="start" pack="end" flex="1">
- <xul:hbox class="toolbarbutton-badge" xbl:inherits="badge"/>
+ <xul:stack class="toolbarbutton-badge-stack">
<xul:image class="toolbarbutton-icon" xbl:inherits="validate,src=image,label"/>
- </xul:hbox>
+ <xul:label class="toolbarbutton-badge" xbl:inherits="value=badge" top="0" end="0"/>
+ </xul:stack>
<xul:label class="toolbarbutton-text" crop="right" flex="1"
xbl:inherits="value=label,accesskey,crop"/>
</content>
diff --git a/application/palemoon/base/content/utilityOverlay.js b/application/palemoon/base/content/utilityOverlay.js
index b1e78d6a95..9763891ba6 100644
--- a/application/palemoon/base/content/utilityOverlay.js
+++ b/application/palemoon/base/content/utilityOverlay.js
@@ -104,7 +104,8 @@ function openUILink(url, event, aIgnoreButton, aIgnoreAlt, aAllowThirdPartyFixup
allowThirdPartyFixup: aAllowThirdPartyFixup,
postData: aPostData,
referrerURI: aReferrerURI,
- initiatingDoc: event ? event.target.ownerDocument : null
+ referrerPolicy: Components.interfaces.nsIHttpChannel.REFERRER_POLICY_DEFAULT,
+ initiatingDoc: event ? event.target.ownerDocument : null,
};
}
@@ -196,7 +197,8 @@ function openUILinkIn(url, where, aAllowThirdPartyFixup, aPostData, aReferrerURI
params = {
allowThirdPartyFixup: aAllowThirdPartyFixup,
postData: aPostData,
- referrerURI: aReferrerURI
+ referrerURI: aReferrerURI,
+ referrerPolicy: Components.interfaces.nsIHttpChannel.REFERRER_POLICY_DEFAULT,
};
}
@@ -205,16 +207,22 @@ function openUILinkIn(url, where, aAllowThirdPartyFixup, aPostData, aReferrerURI
openLinkIn(url, where, params);
}
+/* eslint-disable complexity */
function openLinkIn(url, where, params) {
if (!where || !url)
return;
+ const Cc = Components.classes;
+ const Ci = Components.interfaces;
var aFromChrome = params.fromChrome;
var aAllowThirdPartyFixup = params.allowThirdPartyFixup;
var aPostData = params.postData;
var aCharset = params.charset;
var aReferrerURI = params.referrerURI;
+ var aReferrerPolicy = ('referrerPolicy' in params ?
+ params.referrerPolicy : Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT);
var aRelatedToCurrent = params.relatedToCurrent;
+ var aForceAllowDataURI = params.forceAllowDataURI;
var aInBackground = params.inBackground;
var aDisallowInheritPrincipal = params.disallowInheritPrincipal;
var aInitiatingDoc = params.initiatingDoc;
@@ -227,11 +235,10 @@ function openLinkIn(url, where, params) {
"where == 'save' but without initiatingDoc. See bug 814264.");
return;
}
+ // TODO(1073187): propagate referrerPolicy.
saveURL(url, null, null, true, null, aReferrerURI, aInitiatingDoc);
return;
}
- const Cc = Components.classes;
- const Ci = Components.interfaces;
var w = getTopWin();
if ((where == "tab" || where == "tabshifted") &&
@@ -241,6 +248,7 @@ function openLinkIn(url, where, params) {
}
if (!w || where == "window") {
+ // This propagates to window.arguments.
// Strip referrer data when opening a new private window, to prevent
// regular browsing data from leaking into it.
if (aIsPrivate) {
@@ -265,12 +273,23 @@ function openLinkIn(url, where, params) {
createInstance(Ci.nsISupportsPRBool);
allowThirdPartyFixupSupports.data = aAllowThirdPartyFixup;
+ var referrerURISupports = null;
+ if (aReferrerURI && sendReferrerURI) {
+ referrerURISupports = Cc["@mozilla.org/supports-string;1"].
+ createInstance(Ci.nsISupportsString);
+ referrerURISupports.data = aReferrerURI.spec;
+ }
+
+ var referrerPolicySupports = Cc["@mozilla.org/supports-PRUint32;1"].
+ createInstance(Ci.nsISupportsPRUint32);
+ referrerPolicySupports.data = aReferrerPolicy;
+
sa.AppendElement(wuri);
sa.AppendElement(charset);
- if (sendReferrerURI)
- sa.AppendElement(aReferrerURI);
+ sa.AppendElement(referrerURISupports);
sa.AppendElement(aPostData);
sa.AppendElement(allowThirdPartyFixupSupports);
+ sa.AppendElement(referrerPolicySupports);
let features = "chrome,dialog=no,all";
if (aIsPrivate) {
@@ -315,7 +334,15 @@ function openLinkIn(url, where, params) {
}
if (aDisallowInheritPrincipal)
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_DISALLOW_INHERIT_OWNER;
- w.gBrowser.loadURIWithFlags(url, flags, aReferrerURI, null, aPostData);
+ if (aForceAllowDataURI) {
+ flags |= Ci.nsIWebNavigation.LOAD_FLAGS_FORCE_ALLOW_DATA_URI;
+ }
+ w.gBrowser.loadURIWithFlags(url, {
+ flags: flags,
+ referrerURI: aReferrerURI,
+ referrerPolicy: aReferrerPolicy,
+ postData: aPostData,
+ });
break;
case "tabshifted":
loadInBackground = !loadInBackground;
@@ -324,6 +351,7 @@ function openLinkIn(url, where, params) {
let browser = w.gBrowser;
browser.loadOneTab(url, {
referrerURI: aReferrerURI,
+ referrerPolicy: aReferrerPolicy,
charset: aCharset,
postData: aPostData,
inBackground: loadInBackground,
@@ -572,9 +600,11 @@ function makeURLAbsolute(aBase, aUrl)
* @param [optional] aReferrer
* If aDocument is null, then this will be used as the referrer.
* There will be no security check.
+ * @param [optional] aReferrerPolicy
+ * Referrer policy - Ci.nsIHttpChannel.REFERRER_POLICY_*.
*/
function openNewTabWith(aURL, aDocument, aPostData, aEvent,
- aAllowThirdPartyFixup, aReferrer) {
+ aAllowThirdPartyFixup, aReferrer, aReferrerPolicy) {
if (aDocument)
urlSecurityCheck(aURL, aDocument.nodePrincipal);
@@ -589,10 +619,13 @@ function openNewTabWith(aURL, aDocument, aPostData, aEvent,
{ charset: originCharset,
postData: aPostData,
allowThirdPartyFixup: aAllowThirdPartyFixup,
- referrerURI: aDocument ? aDocument.documentURIObject : aReferrer });
+ referrerURI: aDocument ? aDocument.documentURIObject : aReferrer,
+ referrerPolicy: aReferrerPolicy,
+ });
}
-function openNewWindowWith(aURL, aDocument, aPostData, aAllowThirdPartyFixup, aReferrer) {
+function openNewWindowWith(aURL, aDocument, aPostData, aAllowThirdPartyFixup,
+ aReferrer, aReferrerPolicy) {
if (aDocument)
urlSecurityCheck(aURL, aDocument.nodePrincipal);
@@ -609,7 +642,9 @@ function openNewWindowWith(aURL, aDocument, aPostData, aAllowThirdPartyFixup, aR
{ charset: originCharset,
postData: aPostData,
allowThirdPartyFixup: aAllowThirdPartyFixup,
- referrerURI: aDocument ? aDocument.documentURIObject : aReferrer });
+ referrerURI: aDocument ? aDocument.documentURIObject : aReferrer,
+ referrerPolicy: aReferrerPolicy,
+ });
}
/**
diff --git a/application/palemoon/base/jar.mn b/application/palemoon/base/jar.mn
index 9031f3beb4..fd2df79e17 100644
--- a/application/palemoon/base/jar.mn
+++ b/application/palemoon/base/jar.mn
@@ -53,6 +53,9 @@ browser.jar:
content/browser/browser-title.css (content/browser-title.css)
* content/browser/browser.js (content/browser.js)
* content/browser/browser.xul (content/browser.xul)
+#ifdef MOZ_DEVTOOLS
+ content/browser/browser-devtools-theme.js (content/browser-devtools-theme.js)
+#endif
* content/browser/browser-tabPreviews.xml (content/browser-tabPreviews.xml)
content/browser/content.js (content/content.js)
content/browser/padlock.xul (content/padlock.xul)
@@ -105,6 +108,8 @@ browser.jar:
* content/browser/sanitize.xul (content/sanitize.xul)
* content/browser/sanitizeDialog.js (content/sanitizeDialog.js)
content/browser/sanitizeDialog.css (content/sanitizeDialog.css)
+* content/browser/autocomplete.css (content/autocomplete.css)
+* content/browser/autocomplete.xml (content/autocomplete.xml)
content/browser/tabbrowser.css (content/tabbrowser.css)
* content/browser/tabbrowser.xml (content/tabbrowser.xml)
* content/browser/urlbarBindings.xml (content/urlbarBindings.xml)
diff --git a/application/palemoon/branding/official/moz.build b/application/palemoon/branding/official/moz.build
index 847510ec00..8cb90130f8 100644
--- a/application/palemoon/branding/official/moz.build
+++ b/application/palemoon/branding/official/moz.build
@@ -4,4 +4,10 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+DIRS += ['content', 'locales']
+
+DIST_SUBDIR = 'browser'
+export('DIST_SUBDIR')
+
include('../shared/branding.mozbuild')
+ApplicationBranding()
diff --git a/application/palemoon/branding/official/pref/palemoon-branding.js b/application/palemoon/branding/official/pref/palemoon-branding.js
index 4f5d196d75..8e8703fb7c 100644
--- a/application/palemoon/branding/official/pref/palemoon-branding.js
+++ b/application/palemoon/branding/official/pref/palemoon-branding.js
@@ -8,6 +8,8 @@ pref("app.releaseNotesURL", "http://www.palemoon.org/releasenotes.shtml");
// Enable Firefox compatmode by default.
pref("general.useragent.compatMode", 2);
+pref("general.useragent.compatMode.gecko", true);
+pref("general.useragent.compatMode.firefox", true);
// ========================= updates ========================
#if defined(XP_WIN)
diff --git a/application/palemoon/branding/shared/branding.mozbuild b/application/palemoon/branding/shared/branding.mozbuild
index 0636be64a3..284520add8 100644
--- a/application/palemoon/branding/shared/branding.mozbuild
+++ b/application/palemoon/branding/shared/branding.mozbuild
@@ -4,52 +4,55 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-DIRS += ['content', 'locales']
-
-DIST_SUBDIR = 'browser'
-export('DIST_SUBDIR')
-
-JS_PREFERENCE_FILES += [
- 'pref/palemoon-branding.js',
-]
-
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
- FINAL_TARGET_FILES['..'] += [
- 'palemoon.VisualElementsManifest.xml',
- ]
- FINAL_TARGET_FILES.VisualElements += [
- 'VisualElements_150.png',
- 'VisualElements_70.png',
- ]
- BRANDING_FILES += [
- '../shared/newtab.ico',
- '../shared/newwindow.ico',
- '../shared/pbmode.ico',
- 'appname.bmp',
- 'branding.nsi',
- 'document.ico',
- 'firefox.ico',
- 'wizHeader.bmp',
- 'wizHeaderRTL.bmp',
- 'wizWatermark.bmp',
- ]
-elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
- BRANDING_FILES += [
- '../shared/background.png',
- 'disk.icns',
- 'document.icns',
- 'dsstore',
- 'firefox.icns',
- ]
-elif CONFIG['MOZ_WIDGET_GTK']:
- BRANDING_FILES += [
- 'default16.png',
- 'default32.png',
- 'default48.png',
- 'mozicon128.png',
+@template
+def ApplicationBranding():
+ JS_PREFERENCE_PP_FILES += [
+ 'pref/palemoon-branding.js',
]
-DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION']
-DEFINES['MOZ_BRANDING_DIRECTORY'] = CONFIG['MOZ_BRANDING_DIRECTORY']
-DEFINES['MOZILLA_UAVERSION_U'] = CONFIG['MOZILLA_UAVERSION_U']
-DEFINES['MOZILLA_COMPATVERSION_U'] = CONFIG['MOZILLA_COMPATVERSION_U'] \ No newline at end of file
+ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
+ FINAL_TARGET_FILES['..'] += [
+ 'palemoon.VisualElementsManifest.xml',
+ ]
+ FINAL_TARGET_FILES.VisualElements += [
+ 'VisualElements_150.png',
+ 'VisualElements_70.png',
+ ]
+ BRANDING_FILES += [
+ '../shared/newtab.ico',
+ '../shared/newwindow.ico',
+ '../shared/pbmode.ico',
+ 'appname.bmp',
+ 'branding.nsi',
+ 'document.ico',
+ 'firefox.ico',
+ 'wizHeader.bmp',
+ 'wizHeaderRTL.bmp',
+ 'wizWatermark.bmp',
+ ]
+ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
+ BRANDING_FILES += [
+ '../shared/background.png',
+ 'disk.icns',
+ 'document.icns',
+ 'dsstore',
+ 'firefox.icns',
+ ]
+ elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
+ BRANDING_FILES += [
+ 'default16.png',
+ 'default32.png',
+ 'default48.png',
+ 'mozicon128.png',
+ ]
+ FINAL_TARGET_FILES.icons += ['mozicon128.png']
+ FINAL_TARGET_FILES.chrome.icons.default += [
+ 'default16.png',
+ 'default32.png',
+ 'default48.png',
+ ]
+
+ DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION']
+ DEFINES['MOZ_BRANDING_DIRECTORY'] = CONFIG['MOZ_BRANDING_DIRECTORY']
+ DEFINES['MOZILLA_UAVERSION_U'] = CONFIG['MOZILLA_UAVERSION_U']
+ DEFINES['MOZILLA_COMPATVERSION_U'] = "52.9"
diff --git a/application/palemoon/branding/shared/pref/preferences.inc b/application/palemoon/branding/shared/pref/preferences.inc
index a45870b019..a3cfcd1383 100644
--- a/application/palemoon/branding/shared/pref/preferences.inc
+++ b/application/palemoon/branding/shared/pref/preferences.inc
@@ -119,3 +119,11 @@ pref("browser.sessionstore.interval",60000); //every minute instead of every 10
pref("accessibility.force_disabled", 1);
// ============================================================================
+
+// ===| DevTools |=============================================================
+
+// Number of usages of the web console or scratchpad.
+// If this is less than 5, then pasting code into the web console or scratchpad is disabled
+pref("devtools.selfxss.count", 100);
+
+// ============================================================================
diff --git a/application/palemoon/branding/shared/pref/uaoverrides.inc b/application/palemoon/branding/shared/pref/uaoverrides.inc
index 20cc3ab869..db9ccaffa8 100644
--- a/application/palemoon/branding/shared/pref/uaoverrides.inc
+++ b/application/palemoon/branding/shared/pref/uaoverrides.inc
@@ -36,6 +36,7 @@ pref("@GUAO_PREF@.yahoo.com","Mozilla/5.0 (@OS_SLICE@ rv:99.9) @GK_SLICE@ Firefo
pref("@GUAO_PREF@.youtube.com","Mozilla/5.0 (@OS_SLICE@ rv:42.0) @GK_SLICE@ Firefox/42.0 @PM_SLICE@");
pref("@GUAO_PREF@.gaming.youtube.com","Mozilla/5.0 (@OS_SLICE@ rv:42.0) @GK_SLICE@ Firefox/42.0");
+pref("@GUAO_PREF@.dropbox.com","Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko");
pref("@GUAO_PREF@.players.brightcove.net","Mozilla/5.0 (Windows NT 6.1; Trident/7.0; rv:11.0) like Gecko");
// The never-ending Facebook debacle...
@@ -60,7 +61,6 @@ pref("@GUAO_PREF@.dailymotion.com","Mozilla/5.0 (@OS_SLICE@ rv:52.0) @GK_SLICE@
// The following requires native mode. Or it blocks.. "too old firefox", breakage, etc.
pref("@GUAO_PREF@.deviantart.com","Mozilla/5.0 (@OS_SLICE@ rv:@GRE_VERSION@) @GRE_DATE_SLICE@ @PM_SLICE@");
pref("@GUAO_PREF@.deviantart.net","Mozilla/5.0 (@OS_SLICE@ rv:@GRE_VERSION@) @GRE_DATE_SLICE@ @PM_SLICE@");
-pref("@GUAO_PREF@.dropbox.com","Mozilla/5.0 (@OS_SLICE@ rv:@GRE_VERSION@) @GRE_DATE_SLICE@ @PM_SLICE@");
// UA-Sniffing domains below have indicated no interest in supporting Pale Moon (BOO!)
pref("@GUAO_PREF@.humblebundle.com","Mozilla/5.0 (@OS_SLICE@ rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ (Pale Moon)");
diff --git a/application/palemoon/branding/unofficial/moz.build b/application/palemoon/branding/unofficial/moz.build
index 847510ec00..8cb90130f8 100644
--- a/application/palemoon/branding/unofficial/moz.build
+++ b/application/palemoon/branding/unofficial/moz.build
@@ -4,4 +4,10 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+DIRS += ['content', 'locales']
+
+DIST_SUBDIR = 'browser'
+export('DIST_SUBDIR')
+
include('../shared/branding.mozbuild')
+ApplicationBranding()
diff --git a/application/palemoon/branding/unstable/moz.build b/application/palemoon/branding/unstable/moz.build
index 847510ec00..8cb90130f8 100644
--- a/application/palemoon/branding/unstable/moz.build
+++ b/application/palemoon/branding/unstable/moz.build
@@ -4,4 +4,10 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+DIRS += ['content', 'locales']
+
+DIST_SUBDIR = 'browser'
+export('DIST_SUBDIR')
+
include('../shared/branding.mozbuild')
+ApplicationBranding()
diff --git a/application/palemoon/branding/unstable/pref/palemoon-branding.js b/application/palemoon/branding/unstable/pref/palemoon-branding.js
index 4c088f76d9..dda6f86a5f 100644
--- a/application/palemoon/branding/unstable/pref/palemoon-branding.js
+++ b/application/palemoon/branding/unstable/pref/palemoon-branding.js
@@ -8,6 +8,8 @@ pref("app.releaseNotesURL", "http://www.palemoon.org/unstable/releasenotes.shtml
// Enable Firefox compatmode by default.
pref("general.useragent.compatMode", 2);
+pref("general.useragent.compatMode.gecko", true);
+pref("general.useragent.compatMode.firefox", true);
// ========================= updates ========================
#if defined(XP_WIN)
diff --git a/application/palemoon/build.mk b/application/palemoon/build.mk
index fc692eda5f..ae490aca71 100644
--- a/application/palemoon/build.mk
+++ b/application/palemoon/build.mk
@@ -3,40 +3,40 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
installer:
- @$(MAKE) -C browser/installer installer
+ @$(MAKE) -C application/palemoon/installer installer
package:
- @$(MAKE) -C browser/installer
+ @$(MAKE) -C application/palemoon/installer
package-compare:
- @$(MAKE) -C browser/installer package-compare
+ @$(MAKE) -C application/palemoon/installer package-compare
stage-package:
- @$(MAKE) -C browser/installer stage-package
+ @$(MAKE) -C application/palemoon/installer stage-package
install::
- @$(MAKE) -C browser/installer install
+ @$(MAKE) -C application/palemoon/installer install
clean::
- @$(MAKE) -C browser/installer clean
+ @$(MAKE) -C application/palemoon/installer clean
distclean::
- @$(MAKE) -C browser/installer distclean
+ @$(MAKE) -C application/palemoon/installer distclean
source-package::
- @$(MAKE) -C browser/installer source-package
+ @$(MAKE) -C application/palemoon/installer source-package
upload::
- @$(MAKE) -C browser/installer upload
+ @$(MAKE) -C application/palemoon/installer upload
source-upload::
- @$(MAKE) -C browser/installer source-upload
+ @$(MAKE) -C application/palemoon/installer source-upload
hg-bundle::
- @$(MAKE) -C browser/installer hg-bundle
+ @$(MAKE) -C application/palemoon/installer hg-bundle
l10n-check::
- @$(MAKE) -C browser/locales l10n-check
+ @$(MAKE) -C application/palemoon/locales l10n-check
ifdef ENABLE_TESTS
# Implemented in testing/testsuite-targets.mk
diff --git a/application/palemoon/components/about/AboutRedirector.cpp b/application/palemoon/components/about/AboutRedirector.cpp
index d927b79363..27f6540b23 100644
--- a/application/palemoon/components/about/AboutRedirector.cpp
+++ b/application/palemoon/components/about/AboutRedirector.cpp
@@ -9,8 +9,6 @@
#include "nsNetUtil.h"
#include "nsIScriptSecurityManager.h"
#include "mozilla/ArrayUtils.h"
-#include "nsDOMString.h"
-
namespace mozilla {
namespace browser {
@@ -21,7 +19,6 @@ struct RedirEntry {
const char* id;
const char* url;
uint32_t flags;
- const char* idbOriginPostfix;
};
/*
@@ -33,17 +30,47 @@ struct RedirEntry {
URI_SAFE_FOR_UNTRUSTED_CONTENT.
*/
static RedirEntry kRedirMap[] = {
- { "certerror", "chrome://browser/content/certerror/aboutCertError.xhtml",
+ {
+ "certerror", "chrome://browser/content/certerror/aboutCertError.xhtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::ALLOW_SCRIPT |
- nsIAboutModule::HIDE_FROM_ABOUTABOUT },
- { "feeds", "chrome://browser/content/feeds/subscribe.xhtml",
+ nsIAboutModule::HIDE_FROM_ABOUTABOUT
+ },
+ {
+ "downloads", "chrome://browser/content/downloads/contentAreaDownloadsView.xul",
+ nsIAboutModule::ALLOW_SCRIPT
+ },
+ {
+ "feeds", "chrome://browser/content/feeds/subscribe.xhtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::ALLOW_SCRIPT |
- nsIAboutModule::HIDE_FROM_ABOUTABOUT },
- { "privatebrowsing", "chrome://browser/content/aboutPrivateBrowsing.xhtml",
- nsIAboutModule::ALLOW_SCRIPT },
- { "rights",
+ nsIAboutModule::HIDE_FROM_ABOUTABOUT
+ },
+ {
+ "home", "chrome://browser/content/abouthome/aboutHome.xhtml",
+ nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
+ nsIAboutModule::MAKE_LINKABLE |
+ nsIAboutModule::ALLOW_SCRIPT
+ },
+ {
+ "newtab", "chrome://browser/content/newtab/newTab.xul",
+ nsIAboutModule::ALLOW_SCRIPT
+ },
+ {
+ "palemoon", "chrome://global/content/memoriam.xhtml",
+ nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
+ nsIAboutModule::HIDE_FROM_ABOUTABOUT
+ },
+ {
+ "permissions", "chrome://browser/content/preferences/aboutPermissions.xul",
+ nsIAboutModule::ALLOW_SCRIPT
+ },
+ {
+ "privatebrowsing", "chrome://browser/content/aboutPrivateBrowsing.xhtml",
+ nsIAboutModule::ALLOW_SCRIPT
+ },
+ {
+ "rights",
#ifdef MOZ_OFFICIAL_BRANDING
"chrome://global/content/aboutRights.xhtml",
#else
@@ -51,34 +78,27 @@ static RedirEntry kRedirMap[] = {
#endif
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::MAKE_LINKABLE |
- nsIAboutModule::ALLOW_SCRIPT },
- { "palemoon", "chrome://global/content/palemoon.xhtml",
+ nsIAboutModule::ALLOW_SCRIPT
+ },
+ {
+ "robots", "chrome://browser/content/aboutRobots.xhtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
- nsIAboutModule::HIDE_FROM_ABOUTABOUT },
- { "logopage", "chrome://global/content/logopage.xhtml",
- nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
- nsIAboutModule::HIDE_FROM_ABOUTABOUT },
- { "robots", "chrome://browser/content/aboutRobots.xhtml",
- nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
- nsIAboutModule::ALLOW_SCRIPT },
- { "sessionrestore", "chrome://browser/content/aboutSessionRestore.xhtml",
- nsIAboutModule::ALLOW_SCRIPT },
+ nsIAboutModule::ALLOW_SCRIPT
+ },
+ {
+ "sessionrestore", "chrome://browser/content/aboutSessionRestore.xhtml",
+ nsIAboutModule::ALLOW_SCRIPT
+ },
#ifdef MOZ_SERVICES_SYNC
- { "sync-progress", "chrome://browser/content/sync/progress.xhtml",
- nsIAboutModule::ALLOW_SCRIPT },
- { "sync-tabs", "chrome://browser/content/sync/aboutSyncTabs.xul",
- nsIAboutModule::ALLOW_SCRIPT },
+ {
+ "sync-progress", "chrome://browser/content/sync/progress.xhtml",
+ nsIAboutModule::ALLOW_SCRIPT
+ },
+ {
+ "sync-tabs", "chrome://browser/content/sync/aboutSyncTabs.xul",
+ nsIAboutModule::ALLOW_SCRIPT
+ },
#endif
- { "home", "chrome://browser/content/abouthome/aboutHome.xhtml",
- nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
- nsIAboutModule::MAKE_LINKABLE |
- nsIAboutModule::ALLOW_SCRIPT },
- { "newtab", "chrome://browser/content/newtab/newTab.xul",
- nsIAboutModule::ALLOW_SCRIPT },
- { "permissions", "chrome://browser/content/preferences/aboutPermissions.xul",
- nsIAboutModule::ALLOW_SCRIPT },
- { "downloads", "chrome://browser/content/downloads/contentAreaDownloadsView.xul",
- nsIAboutModule::ALLOW_SCRIPT },
};
static const int kRedirTotal = ArrayLength(kRedirMap);
@@ -117,8 +137,13 @@ AboutRedirector::NewChannel(nsIURI* aURI,
for (int i = 0; i < kRedirTotal; i++) {
if (!strcmp(path.get(), kRedirMap[i].id)) {
nsCOMPtr<nsIChannel> tempChannel;
- rv = ioService->NewChannel(nsDependentCString(kRedirMap[i].url),
- nullptr, nullptr, getter_AddRefs(tempChannel));
+ nsCOMPtr<nsIURI> tempURI;
+ rv = NS_NewURI(getter_AddRefs(tempURI),
+ nsDependentCString(kRedirMap[i].url));
+ NS_ENSURE_SUCCESS(rv, rv);
+ rv = NS_NewChannelInternal(getter_AddRefs(tempChannel),
+ tempURI,
+ aLoadInfo);
NS_ENSURE_SUCCESS(rv, rv);
tempChannel->SetOriginalURI(aURI);
@@ -148,30 +173,6 @@ AboutRedirector::GetURIFlags(nsIURI *aURI, uint32_t *result)
return NS_ERROR_ILLEGAL_VALUE;
}
-NS_IMETHODIMP
-AboutRedirector::GetIndexedDBOriginPostfix(nsIURI *aURI, nsAString &result)
-{
- NS_ENSURE_ARG_POINTER(aURI);
-
- nsAutoCString name = GetAboutModuleName(aURI);
-
- for (int i = 0; i < kRedirTotal; i++) {
- if (name.Equals(kRedirMap[i].id)) {
- const char* postfix = kRedirMap[i].idbOriginPostfix;
- if (!postfix) {
- break;
- }
-
- result.AssignASCII(postfix);
- return NS_OK;
- }
- }
-
- SetDOMStringToNull(result);
- return NS_ERROR_ILLEGAL_VALUE;
-}
-
-
nsresult
AboutRedirector::Create(nsISupports *aOuter, REFNSIID aIID, void **result)
{
diff --git a/application/palemoon/components/build/moz.build b/application/palemoon/components/build/moz.build
index f8073907ea..c85723e16e 100644
--- a/application/palemoon/components/build/moz.build
+++ b/application/palemoon/components/build/moz.build
@@ -18,17 +18,22 @@ LOCAL_INCLUDES += [
'../about',
'../dirprovider',
'../feeds',
- '../migration',
'../shell',
]
if CONFIG['OS_ARCH'] == 'WINNT':
OS_LIBS += [
+ 'esent',
+ 'netapi32',
'ole32',
'shell32',
'shlwapi',
'version',
]
+ DELAYLOAD_DLLS += [
+ 'esent.dll',
+ 'netapi32.dll',
+ ]
# Mac: Need to link with CoreFoundation for Mac Migrators (PList reading code)
# GTK2: Need to link with glib for GNOME shell service
diff --git a/application/palemoon/components/build/nsBrowserCompsCID.h b/application/palemoon/components/build/nsBrowserCompsCID.h
index e325e43d4f..23670ae807 100644
--- a/application/palemoon/components/build/nsBrowserCompsCID.h
+++ b/application/palemoon/components/build/nsBrowserCompsCID.h
@@ -4,14 +4,6 @@
/////////////////////////////////////////////////////////////////////////////
-#ifdef XP_WIN
-#define NS_WINIEHISTORYENUMERATOR_CID \
-{ 0x93480624, 0x806e, 0x4756, { 0xb7, 0xcb, 0x0f, 0xb7, 0xdd, 0x74, 0x6a, 0x8f } }
-
-#define NS_IEHISTORYENUMERATOR_CONTRACTID \
- "@mozilla.org/profile/migrator/iehistoryenumerator;1"
-#endif
-
#define NS_SHELLSERVICE_CID \
{ 0x63c7b9f4, 0xcc8, 0x43f8, { 0xb6, 0x66, 0xa, 0x66, 0x16, 0x55, 0xcb, 0x73 } }
diff --git a/application/palemoon/components/build/nsModule.cpp b/application/palemoon/components/build/nsModule.cpp
index d5b79b455d..304280ca97 100644
--- a/application/palemoon/components/build/nsModule.cpp
+++ b/application/palemoon/components/build/nsModule.cpp
@@ -16,10 +16,6 @@
#include "nsGNOMEShellService.h"
#endif
-#if defined(XP_WIN)
-#include "nsIEHistoryEnumerator.h"
-#endif
-
#include "rdf.h"
#include "nsFeedSniffer.h"
#include "AboutRedirector.h"
@@ -40,10 +36,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsMacShellService)
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsGNOMEShellService, Init)
#endif
-#if defined(XP_WIN)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsIEHistoryEnumerator)
-#endif
-
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFeedSniffer)
NS_DEFINE_NAMED_CID(NS_BROWSERDIRECTORYPROVIDER_CID);
@@ -54,9 +46,7 @@ NS_DEFINE_NAMED_CID(NS_SHELLSERVICE_CID);
#endif
NS_DEFINE_NAMED_CID(NS_FEEDSNIFFER_CID);
NS_DEFINE_NAMED_CID(NS_BROWSER_ABOUT_REDIRECTOR_CID);
-#if defined(XP_WIN)
-NS_DEFINE_NAMED_CID(NS_WINIEHISTORYENUMERATOR_CID);
-#elif defined(XP_MACOSX)
+#ifdef XP_MACOSX
NS_DEFINE_NAMED_CID(NS_SHELLSERVICE_CID);
#endif
@@ -69,9 +59,7 @@ static const mozilla::Module::CIDEntry kBrowserCIDs[] = {
#endif
{ &kNS_FEEDSNIFFER_CID, false, nullptr, nsFeedSnifferConstructor },
{ &kNS_BROWSER_ABOUT_REDIRECTOR_CID, false, nullptr, AboutRedirector::Create },
-#if defined(XP_WIN)
- { &kNS_WINIEHISTORYENUMERATOR_CID, false, nullptr, nsIEHistoryEnumeratorConstructor },
-#elif defined(XP_MACOSX)
+#ifdef XP_MACOSX
{ &kNS_SHELLSERVICE_CID, false, nullptr, nsMacShellServiceConstructor },
#endif
{ nullptr }
@@ -91,7 +79,6 @@ static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "privatebrowsing", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "rights", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "palemoon", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
- { NS_ABOUT_MODULE_CONTRACTID_PREFIX "logopage", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "robots", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "sessionrestore", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
#ifdef MOZ_SERVICES_SYNC
@@ -102,9 +89,7 @@ static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "newtab", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "permissions", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "downloads", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
-#if defined(XP_WIN)
- { NS_IEHISTORYENUMERATOR_CONTRACTID, &kNS_WINIEHISTORYENUMERATOR_CID },
-#elif defined(XP_MACOSX)
+#ifdef XP_MACOSX
{ NS_SHELLSERVICE_CONTRACTID, &kNS_SHELLSERVICE_CID },
#endif
{ nullptr }
diff --git a/application/palemoon/components/dirprovider/DirectoryProvider.cpp b/application/palemoon/components/dirprovider/DirectoryProvider.cpp
index 4d3993b7f4..85728b3510 100644
--- a/application/palemoon/components/dirprovider/DirectoryProvider.cpp
+++ b/application/palemoon/components/dirprovider/DirectoryProvider.cpp
@@ -34,57 +34,7 @@ NS_IMPL_ISUPPORTS(DirectoryProvider,
NS_IMETHODIMP
DirectoryProvider::GetFile(const char *aKey, bool *aPersist, nsIFile* *aResult)
{
- nsresult rv;
-
- *aResult = nullptr;
-
- // NOTE: This function can be reentrant through the NS_GetSpecialDirectory
- // call, so be careful not to cause infinite recursion.
-
- nsCOMPtr<nsIFile> file;
-
- char const* leafName = nullptr;
-
- if (!strcmp(aKey, NS_APP_BOOKMARKS_50_FILE)) {
- leafName = "bookmarks.html";
-
- nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
- if (prefs) {
- nsCString path;
- rv = prefs->GetCharPref("browser.bookmarks.file", getter_Copies(path));
- if (NS_SUCCEEDED(rv)) {
- NS_NewNativeLocalFile(path, true, getter_AddRefs(file));
- }
- }
- }
- else {
- return NS_ERROR_FAILURE;
- }
-
- nsDependentCString leafstr(leafName);
-
- nsCOMPtr<nsIFile> parentDir;
- if (file) {
- rv = file->GetParent(getter_AddRefs(parentDir));
- if (NS_FAILED(rv))
- return rv;
- }
- else {
- rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(parentDir));
- if (NS_FAILED(rv))
- return rv;
-
- rv = parentDir->Clone(getter_AddRefs(file));
- if (NS_FAILED(rv))
- return rv;
-
- file->AppendNative(leafstr);
- }
-
- *aPersist = true;
- NS_ADDREF(*aResult = file);
-
- return NS_OK;
+ return NS_ERROR_FAILURE;
}
static void
diff --git a/application/palemoon/components/downloads/DownloadsCommon.jsm b/application/palemoon/components/downloads/DownloadsCommon.jsm
index b90baaf9ca..c6614e7806 100644
--- a/application/palemoon/components/downloads/DownloadsCommon.jsm
+++ b/application/palemoon/components/downloads/DownloadsCommon.jsm
@@ -104,7 +104,7 @@ const kPartialDownloadSuffix = ".part";
const kPrefBranch = Services.prefs.getBranch("browser.download.");
-let PrefObserver = {
+var PrefObserver = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver,
Ci.nsISupportsWeakReference]),
getPref: function PO_getPref(name) {
@@ -867,9 +867,19 @@ DownloadsDataCtor.prototype = {
// Sort backwards by start time, ensuring that the most recent
// downloads are added first regardless of their state.
- let loadedItemsArray = [dataItem
- for each (dataItem in this.dataItems)
- if (dataItem)];
+ // Tycho:
+ //let loadedItemsArray = [dataItem
+ // for each (dataItem in this.dataItems)
+ // if (dataItem)];
+
+ let loadedItemsArray = [];
+
+ for each (let dataItem in this.dataItems) {
+ if (dataItem) {
+ loadedItemsArray.push(dataItem);
+ }
+ }
+
loadedItemsArray.sort(function(a, b) b.startTime - a.startTime);
loadedItemsArray.forEach(
function (dataItem) aView.onDataItemAdded(dataItem, false)
diff --git a/application/palemoon/components/downloads/content/allDownloadsViewOverlay.js b/application/palemoon/components/downloads/content/allDownloadsViewOverlay.js
index e1d0e75d42..054f0405f4 100644
--- a/application/palemoon/components/downloads/content/allDownloadsViewOverlay.js
+++ b/application/palemoon/components/downloads/content/allDownloadsViewOverlay.js
@@ -8,9 +8,9 @@
* ON IT AS AN API.
*/
-let Cu = Components.utils;
-let Ci = Components.interfaces;
-let Cc = Components.classes;
+var Cu = Components.utils;
+var Ci = Components.interfaces;
+var Cc = Components.classes;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
@@ -41,22 +41,6 @@ const DOWNLOAD_VIEW_SUPPORTED_COMMANDS =
const NOT_AVAILABLE = Number.MAX_VALUE;
/**
- * Download a URL.
- *
- * @param aURL
- * the url to download (nsIURI object)
- * @param [optional] aFileName
- * the destination file name
- */
-function DownloadURL(aURL, aFileName) {
- // For private browsing, try to get document out of the most recent browser
- // window, or provide our own if there's no browser window.
- let browserWin = RecentWindow.getMostRecentBrowserWindow();
- let initiatingDoc = browserWin ? browserWin.document : document;
- saveURL(aURL, aFileName, null, true, true, undefined, initiatingDoc);
-}
-
-/**
* A download element shell is responsible for handling the commands and the
* displayed data for a single download view element. The download element
* could represent either a past download (for which we get data from places) or
@@ -654,7 +638,10 @@ DownloadElementShell.prototype = {
// In future we may try to download into the same original target uri, when
// we have it. Though that requires verifying the path is still valid and
// may surprise the user if he wants to be requested every time.
- DownloadURL(this.downloadURI, this.getDownloadMetaData().fileName);
+ let browserWin = RecentWindow.getMostRecentBrowserWindow();
+ let initiatingDoc = browserWin ? browserWin.document : document;
+ DownloadURL(this.downloadURI, this.getDownloadMetaData().fileName,
+ initiatingDoc);
},
/* nsIController */
@@ -1407,11 +1394,11 @@ DownloadsPlacesView.prototype = {
_copySelectedDownloadsToClipboard:
function DPV__copySelectedDownloadsToClipboard() {
- let selectedElements = this._richlistbox.selectedItems;
- let urls = [e._shell.downloadURI for each (e in selectedElements)];
+ let urls = [for (element of this._richlistbox.selectedItems)
+ element._shell.downloadURI];
Cc["@mozilla.org/widget/clipboardhelper;1"].
- getService(Ci.nsIClipboardHelper).copyString(urls.join("\n"), document);
+ getService(Ci.nsIClipboardHelper).copyString(urls.join("\n"));
},
_getURLFromClipboardData: function DPV__getURLFromClipboardData() {
@@ -1445,10 +1432,16 @@ DownloadsPlacesView.prototype = {
_downloadURLFromClipboard: function DPV__downloadURLFromClipboard() {
let [url, name] = this._getURLFromClipboardData();
- DownloadURL(url, name);
+ let browserWin = RecentWindow.getMostRecentBrowserWindow();
+ let initiatingDoc = browserWin ? browserWin.document : document;
+ DownloadURL(url, name, initiatingDoc);
},
doCommand: function DPV_doCommand(aCommand) {
+ // Commands may be invoked with keyboard shortcuts even if disabled.
+ if (!this.isCommandEnabled(aCommand)) {
+ return;
+ }
switch (aCommand) {
case "cmd_copy":
this._copySelectedDownloadsToClipboard();
@@ -1471,11 +1464,11 @@ DownloadsPlacesView.prototype = {
goUpdateCommand("downloadsCmd_clearDownloads");
break;
default: {
- // Slicing the array to get a freezed list of selected items. Otherwise,
- // the selectedItems array is live and doCommand may alter the selection
- // while we are trying to do one particular action, like removing items
- // from history.
- let selectedElements = this._richlistbox.selectedItems.slice();
+ // Cloning the nodelist into an array to get a frozen list of selected items.
+ // Otherwise, the selectedItems nodelist is live and doCommand may alter the
+ // selection while we are trying to do one particular action, like removing
+ // items from history.
+ let selectedElements = [...this._richlistbox.selectedItems];
for (let element of selectedElements) {
element._shell.doCommand(aCommand);
}
@@ -1499,6 +1492,11 @@ DownloadsPlacesView.prototype = {
else
contextMenu.removeAttribute("state");
+ if (state == nsIDM.DOWNLOAD_DOWNLOADING) {
+ // The resumable property of a download may change at any time, so
+ // ensure we update the related command now.
+ goUpdateCommand("downloadsCmd_pauseResume");
+ }
return true;
},
@@ -1589,10 +1587,16 @@ DownloadsPlacesView.prototype = {
if (dt.mozGetDataAt("application/x-moz-file", 0))
return;
- let name = { };
- let url = Services.droppedLinkHandler.dropLink(aEvent, name);
- if (url)
- DownloadURL(url, name.value);
+ let links = Services.droppedLinkHandler.dropLinks(aEvent);
+ if (!links.length)
+ return;
+ let browserWin = RecentWindow.getMostRecentBrowserWindow();
+ let initiatingDoc = browserWin ? browserWin.document : document;
+ for (let link of links) {
+ if (link.url.startsWith("about:"))
+ continue;
+ DownloadURL(link.url, link.name, initiatingDoc);
+ }
}
};
diff --git a/application/palemoon/components/downloads/content/contentAreaDownloadsView.js b/application/palemoon/components/downloads/content/contentAreaDownloadsView.js
index 29e2e368c2..fbb18ab04f 100644
--- a/application/palemoon/components/downloads/content/contentAreaDownloadsView.js
+++ b/application/palemoon/components/downloads/content/contentAreaDownloadsView.js
@@ -4,7 +4,7 @@
Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
-let ContentAreaDownloadsView = {
+var ContentAreaDownloadsView = {
init: function CADV_init() {
let view = new DownloadsPlacesView(document.getElementById("downloadsRichListBox"));
// Do not display the Places downloads in private windows
diff --git a/application/palemoon/components/downloads/content/downloads.js b/application/palemoon/components/downloads/content/downloads.js
index 1a22880416..833d7d72ff 100644
--- a/application/palemoon/components/downloads/content/downloads.js
+++ b/application/palemoon/components/downloads/content/downloads.js
@@ -507,8 +507,7 @@ const DownloadsPanel = {
let uri = NetUtil.newURI(url);
DownloadsCommon.log("Pasted URL seems valid. Starting download.");
- saveURL(uri.spec, name || uri.spec, null, true, true,
- undefined, document);
+ DownloadURL(uri.spec, name, document);
} catch (ex) {}
},
@@ -590,6 +589,8 @@ const DownloadsPanel = {
}
};
+XPCOMUtils.defineConstant(this, "DownloadsPanel", DownloadsPanel);
+
////////////////////////////////////////////////////////////////////////////////
//// DownloadsOverlayLoader
@@ -677,6 +678,8 @@ const DownloadsOverlayLoader = {
}
};
+XPCOMUtils.defineConstant(this, "DownloadsOverlayLoader", DownloadsOverlayLoader);
+
////////////////////////////////////////////////////////////////////////////////
//// DownloadsView
@@ -1053,6 +1056,8 @@ const DownloadsView = {
}
}
+XPCOMUtils.defineConstant(this, "DownloadsView", DownloadsView);
+
////////////////////////////////////////////////////////////////////////////////
//// DownloadsViewItem
@@ -1414,6 +1419,8 @@ const DownloadsViewController = {
}
};
+XPCOMUtils.defineConstant(this, "DownloadsViewController", DownloadsViewController);
+
////////////////////////////////////////////////////////////////////////////////
//// DownloadsViewItemController
@@ -1754,7 +1761,9 @@ const DownloadsSummary = {
delete this._detailsNode;
return this._detailsNode = node;
}
-}
+};
+
+XPCOMUtils.defineConstant(this, "DownloadsSummary", DownloadsSummary);
////////////////////////////////////////////////////////////////////////////////
//// DownloadsFooter
@@ -1811,3 +1820,5 @@ const DownloadsFooter = {
return this._footerNode = node;
}
};
+
+XPCOMUtils.defineConstant(this, "DownloadsFooter", DownloadsFooter);
diff --git a/application/palemoon/components/downloads/content/indicator.js b/application/palemoon/components/downloads/content/indicator.js
index b0e3217e5b..1a2175a92a 100644
--- a/application/palemoon/components/downloads/content/indicator.js
+++ b/application/palemoon/components/downloads/content/indicator.js
@@ -254,6 +254,12 @@ const DownloadsButton = {
}
};
+Object.defineProperty(this, "DownloadsButton", {
+ value: DownloadsButton,
+ enumerable: true,
+ writable: false
+});
+
////////////////////////////////////////////////////////////////////////////////
//// DownloadsIndicatorView
@@ -542,15 +548,18 @@ const DownloadsIndicatorView = {
if (dt.mozGetDataAt("application/x-moz-file", 0))
return;
- let name = {};
- let url = browserDragAndDrop.drop(aEvent, name);
- if (url) {
- if (url.startsWith("about:")) {
- return;
- }
-
- let sourceDoc = dt.mozSourceNode ? dt.mozSourceNode.ownerDocument : document;
- saveURL(url, name.value, null, true, true, null, sourceDoc);
+ let links = browserDragAndDrop.dropLinks(aEvent);
+ if (!links.length)
+ return;
+ let sourceDoc = dt.mozSourceNode ? dt.mozSourceNode.ownerDocument : document;
+ let handled = false;
+ for (let link of links) {
+ if (link.url.startsWith("about:"))
+ continue;
+ saveURL(link.url, link.name, null, true, true, null, sourceDoc);
+ handled = true;
+ }
+ if (handled) {
aEvent.preventDefault();
}
},
@@ -592,3 +601,9 @@ const DownloadsIndicatorView = {
document.getElementById("downloads-indicator-progress");
}
};
+
+Object.defineProperty(this, "DownloadsIndicatorView", {
+ value: DownloadsIndicatorView,
+ enumerable: true,
+ writable: false
+});
diff --git a/application/palemoon/components/feeds/FeedConverter.js b/application/palemoon/components/feeds/FeedConverter.js
index 75115cc94d..d0f5737743 100644
--- a/application/palemoon/components/feeds/FeedConverter.js
+++ b/application/palemoon/components/feeds/FeedConverter.js
@@ -260,7 +260,7 @@ FeedConverter.prototype = {
}
chromeChannel.loadGroup = this._request.loadGroup;
- chromeChannel.asyncOpen(this._listener, null);
+ chromeChannel.asyncOpen2(this._listener);
}
finally {
this._releaseHandles();
diff --git a/application/palemoon/components/feeds/FeedWriter.js b/application/palemoon/components/feeds/FeedWriter.js
index 2afa35a5bf..cbb1465643 100644
--- a/application/palemoon/components/feeds/FeedWriter.js
+++ b/application/palemoon/components/feeds/FeedWriter.js
@@ -9,6 +9,7 @@ const Cr = Components.results;
const Cu = Components.utils;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+Cu.import("resource://gre/modules/NetUtil.jsm");
const FEEDWRITER_CID = Components.ID("{49bb6593-3aff-4eb3-a068-2712c28bd58e}");
const FEEDWRITER_CONTRACTID = "@mozilla.org/browser/feeds/result-writer;1";
@@ -1137,16 +1138,14 @@ FeedWriter.prototype = {
var nullPrincipal = Cc["@mozilla.org/nullprincipal;1"].
createInstance(Ci.nsIPrincipal);
- var resolvedURI = Cc["@mozilla.org/network/io-service;1"].
- getService(Ci.nsIIOService).
- newChannel2("about:feeds",
- null,
- null,
- null, // aLoadingNode
- nullPrincipal,
- null, // aTriggeringPrincipal
- Ci.nsILoadInfo.SEC_NORMAL,
- Ci.nsIContentPolicy.TYPE_OTHER).URI;
+ // this channel is not going to be openend, use a nullPrincipal
+ // and the most restrctive securityFlag.
+ let resolvedURI = NetUtil.newChannel({
+ uri: "about:feeds",
+ loadingPrincipal: nullPrincipal,
+ securityFlags: Ci.nsILoadInfo.SEC_REQUIRE_SAME_ORIGIN_DATA_IS_BLOCKED,
+ contentPolicyType: Ci.nsIContentPolicy.TYPE_OTHER
+ }).URI;
if (resolvedURI.equals(chan.URI))
return chan.originalURI;
@@ -1395,6 +1394,8 @@ FeedWriter.prototype = {
.QueryInterface(Ci.nsIDocShell)
.QueryInterface(Ci.nsILoadContext)
.usePrivateBrowsing;
+ var nullPrincipal = Cc["@mozilla.org/nullprincipal;1"]
+ .createInstance(Ci.nsIPrincipal);
this._faviconService.setAndFetchFaviconForPage(readerURI, faviconURI, false,
usePrivateBrowsing ? this._faviconService.FAVICON_LOAD_PRIVATE
: this._faviconService.FAVICON_LOAD_NON_PRIVATE,
@@ -1409,7 +1410,7 @@ FeedWriter.prototype = {
self._contentSandbox.menuItem = null;
self._contentSandbox.dataURL = null;
}
- });
+ }, nullPrincipal);
},
classID: FEEDWRITER_CID,
diff --git a/application/palemoon/components/feeds/moz.build b/application/palemoon/components/feeds/moz.build
index 1dea0ce77e..7ae9141aa4 100644
--- a/application/palemoon/components/feeds/moz.build
+++ b/application/palemoon/components/feeds/moz.build
@@ -35,5 +35,3 @@ for var in ('MOZ_APP_NAME', 'MOZ_MACBUNDLE_NAME'):
LOCAL_INCLUDES += [
'../build',
]
-
-FAIL_ON_WARNINGS = True
diff --git a/application/palemoon/components/feeds/nsFeedSniffer.cpp b/application/palemoon/components/feeds/nsFeedSniffer.cpp
index 61cc77bdd7..f314d3d3bd 100644
--- a/application/palemoon/components/feeds/nsFeedSniffer.cpp
+++ b/application/palemoon/components/feeds/nsFeedSniffer.cpp
@@ -135,7 +135,7 @@ FindChar(char c, const char *begin, const char *end)
* it's possible that someone embedded one of these tags inside a document of
* another type, e.g. a HTML document, and we don't want to show the preview
* page if the document isn't actually a feed.
- *
+ *
* @param start
* The beginning of the data being sniffed
* @param end
@@ -331,7 +331,7 @@ nsFeedSniffer::OnStartRequest(nsIRequest* request, nsISupports* context)
return NS_OK;
}
-NS_METHOD
+nsresult
nsFeedSniffer::AppendSegmentToString(nsIInputStream* inputStream,
void* closure,
const char* rawSegment,
diff --git a/application/palemoon/components/feeds/nsFeedSniffer.h b/application/palemoon/components/feeds/nsFeedSniffer.h
index 57e10d954d..a0eb9862ce 100644
--- a/application/palemoon/components/feeds/nsFeedSniffer.h
+++ b/application/palemoon/components/feeds/nsFeedSniffer.h
@@ -10,7 +10,7 @@
#include "mozilla/Attributes.h"
class nsFeedSniffer final : public nsIContentSniffer,
- nsIStreamListener
+ nsIStreamListener
{
public:
NS_DECL_ISUPPORTS
@@ -18,12 +18,12 @@ public:
NS_DECL_NSIREQUESTOBSERVER
NS_DECL_NSISTREAMLISTENER
- static NS_METHOD AppendSegmentToString(nsIInputStream* inputStream,
- void* closure,
- const char* rawSegment,
- uint32_t toOffset,
- uint32_t count,
- uint32_t* writeCount);
+ static nsresult AppendSegmentToString(nsIInputStream* inputStream,
+ void* closure,
+ const char* rawSegment,
+ uint32_t toOffset,
+ uint32_t count,
+ uint32_t* writeCount);
protected:
~nsFeedSniffer() {}
diff --git a/application/palemoon/components/fuel/fuelApplication.js b/application/palemoon/components/fuel/fuelApplication.js
index 89d568ae13..017813143b 100644
--- a/application/palemoon/components/fuel/fuelApplication.js
+++ b/application/palemoon/components/fuel/fuelApplication.js
@@ -729,7 +729,7 @@ var ApplicationFactory = {
};
-#include ../../../toolkit/components/exthelper/extApplication.js
+#include ../../../../toolkit/components/exthelper/extApplication.js
//=================================================
// Application constructor
diff --git a/application/palemoon/components/migration/BrowserProfileMigrators.manifest b/application/palemoon/components/migration/BrowserProfileMigrators.manifest
deleted file mode 100644
index d7fec75e35..0000000000
--- a/application/palemoon/components/migration/BrowserProfileMigrators.manifest
+++ /dev/null
@@ -1,14 +0,0 @@
-component {6F8BB968-C14F-4D6F-9733-6C6737B35DCE} ProfileMigrator.js
-contract @mozilla.org/toolkit/profile-migrator;1 {6F8BB968-C14F-4D6F-9733-6C6737B35DCE}
-component {4cec1de4-1671-4fc3-a53e-6c539dc77a26} ChromeProfileMigrator.js
-contract @mozilla.org/profile/migrator;1?app=browser&type=chrome {4cec1de4-1671-4fc3-a53e-6c539dc77a26}
-component {91185366-ba97-4438-acba-48deaca63386} FirefoxProfileMigrator.js
-contract @mozilla.org/profile/migrator;1?app=browser&type=firefox {91185366-ba97-4438-acba-48deaca63386}
-#ifdef HAS_IE_MIGRATOR
-component {3d2532e3-4932-4774-b7ba-968f5899d3a4} IEProfileMigrator.js
-contract @mozilla.org/profile/migrator;1?app=browser&type=ie {3d2532e3-4932-4774-b7ba-968f5899d3a4}
-#endif
-#ifdef HAS_SAFARI_MIGRATOR
-component {4b609ecf-60b2-4655-9df4-dc149e474da1} SafariProfileMigrator.js
-contract @mozilla.org/profile/migrator;1?app=browser&type=safari {4b609ecf-60b2-4655-9df4-dc149e474da1}
-#endif
diff --git a/application/palemoon/components/migration/ChromeProfileMigrator.js b/application/palemoon/components/migration/ChromeProfileMigrator.js
deleted file mode 100644
index 61955fbb49..0000000000
--- a/application/palemoon/components/migration/ChromeProfileMigrator.js
+++ /dev/null
@@ -1,463 +0,0 @@
-/* -*- Mode: js; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=2 ts=2 sts=2 et */
-/* 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";
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
-const Cr = Components.results;
-
-const FILE_INPUT_STREAM_CID = "@mozilla.org/network/file-input-stream;1";
-
-const S100NS_FROM1601TO1970 = 0x19DB1DED53E8000;
-const S100NS_PER_MS = 10;
-
-const AUTH_TYPE = {
- SCHEME_HTML: 0,
- SCHEME_BASIC: 1,
- SCHEME_DIGEST: 2
-};
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/NetUtil.jsm");
-Cu.import("resource://gre/modules/FileUtils.jsm");
-Cu.import("resource:///modules/MigrationUtils.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
- "resource://gre/modules/PlacesUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "OSCrypto",
- "resource://gre/modules/OSCrypto.jsm");
-
-/**
- * Convert Chrome time format to Date object
- *
- * @param aTime
- * Chrome time
- * @return converted Date object
- * @note Google Chrome uses FILETIME / 10 as time.
- * FILETIME is based on same structure of Windows.
- */
-function chromeTimeToDate(aTime)
-{
- return new Date((aTime * S100NS_PER_MS - S100NS_FROM1601TO1970 ) / 10000);
-}
-
-/**
- * Insert bookmark items into specific folder.
- *
- * @param aFolderId
- * id of folder where items will be inserted
- * @param aItems
- * bookmark items to be inserted
- */
-function insertBookmarkItems(aFolderId, aItems)
-{
- for (let i = 0; i < aItems.length; i++) {
- let item = aItems[i];
-
- try {
- if (item.type == "url") {
- PlacesUtils.bookmarks.insertBookmark(aFolderId,
- NetUtil.newURI(item.url),
- PlacesUtils.bookmarks.DEFAULT_INDEX,
- item.name);
- } else if (item.type == "folder") {
- let newFolderId =
- PlacesUtils.bookmarks.createFolder(aFolderId,
- item.name,
- PlacesUtils.bookmarks.DEFAULT_INDEX);
-
- insertBookmarkItems(newFolderId, item.children);
- }
- } catch (e) {
- Cu.reportError(e);
- }
- }
-}
-
-
-function ChromeProfileMigrator() {
- let chromeUserDataFolder = FileUtils.getDir(
-#ifdef XP_WIN
- "LocalAppData", ["Google", "Chrome", "User Data"]
-#elifdef XP_MACOSX
- "ULibDir", ["Application Support", "Google", "Chrome"]
-#else
- "Home", [".config", "google-chrome"]
-#endif
- , false);
- this._chromeUserDataFolder = chromeUserDataFolder.exists() ?
- chromeUserDataFolder : null;
-}
-
-ChromeProfileMigrator.prototype = Object.create(MigratorPrototype);
-
-ChromeProfileMigrator.prototype.getResources =
- function Chrome_getResources(aProfile) {
- if (this._chromeUserDataFolder) {
- let profileFolder = this._chromeUserDataFolder.clone();
- profileFolder.append(aProfile.id);
- if (profileFolder.exists()) {
- let possibleResources = [GetBookmarksResource(profileFolder),
- GetHistoryResource(profileFolder),
- GetCookiesResource(profileFolder),
-#ifdef XP_WIN
- GetWindowsPasswordsResource(profileFolder)
-#endif
- ];
- return [r for each (r in possibleResources) if (r != null)];
- }
- }
- return [];
- };
-
-Object.defineProperty(ChromeProfileMigrator.prototype, "sourceProfiles", {
- get: function Chrome_sourceProfiles() {
- if ("__sourceProfiles" in this)
- return this.__sourceProfiles;
-
- if (!this._chromeUserDataFolder)
- return [];
-
- let profiles = [];
- try {
- // Local State is a JSON file that contains profile info.
- let localState = this._chromeUserDataFolder.clone();
- localState.append("Local State");
- if (!localState.exists())
- throw new Error("Chrome's 'Local State' file does not exist.");
- if (!localState.isReadable())
- throw new Error("Chrome's 'Local State' file could not be read.");
-
- let fstream = Cc[FILE_INPUT_STREAM_CID].createInstance(Ci.nsIFileInputStream);
- fstream.init(localState, -1, 0, 0);
- let inputStream = NetUtil.readInputStreamToString(fstream, fstream.available(),
- { charset: "UTF-8" });
- let info_cache = JSON.parse(inputStream).profile.info_cache;
- for (let profileFolderName in info_cache) {
- let profileFolder = this._chromeUserDataFolder.clone();
- profileFolder.append(profileFolderName);
- profiles.push({
- id: profileFolderName,
- name: info_cache[profileFolderName].name || profileFolderName,
- });
- }
- } catch (e) {
- Cu.reportError("Error detecting Chrome profiles: " + e);
- // If we weren't able to detect any profiles above, fallback to the Default profile.
- let defaultProfileFolder = this._chromeUserDataFolder.clone();
- defaultProfileFolder.append("Default");
- if (defaultProfileFolder.exists()) {
- profiles = [{
- id: "Default",
- name: "Default",
- }];
- }
- }
-
- // Only list profiles from which any data can be imported
- return this.__sourceProfiles = profiles.filter(function(profile) {
- let resources = this.getResources(profile);
- return resources && resources.length > 0;
- }, this);
- }
-});
-
-Object.defineProperty(ChromeProfileMigrator.prototype, "sourceHomePageURL", {
- get: function Chrome_sourceHomePageURL() {
- let prefsFile = this._chromeUserDataFolder.clone();
- prefsFile.append("Preferences");
- if (prefsFile.exists()) {
- // XXX reading and parsing JSON is synchronous.
- let fstream = Cc[FILE_INPUT_STREAM_CID].
- createInstance(Ci.nsIFileInputStream);
- fstream.init(file, -1, 0, 0);
- try {
- return JSON.parse(
- NetUtil.readInputStreamToString(fstream, fstream.available(),
- { charset: "UTF-8" })
- ).homepage;
- }
- catch(e) {
- Cu.reportError("Error parsing Chrome's preferences file: " + e);
- }
- }
- return "";
- }
-});
-
-function GetBookmarksResource(aProfileFolder) {
- let bookmarksFile = aProfileFolder.clone();
- bookmarksFile.append("Bookmarks");
- if (!bookmarksFile.exists())
- return null;
-
- return {
- type: MigrationUtils.resourceTypes.BOOKMARKS,
-
- migrate: function(aCallback) {
- NetUtil.asyncFetch(bookmarksFile, MigrationUtils.wrapMigrateFunction(
- function(aInputStream, aResultCode) {
- if (!Components.isSuccessCode(aResultCode))
- throw new Error("Could not read Bookmarks file");
-
- // Parse Chrome bookmark file that is JSON format
- let bookmarkJSON = NetUtil.readInputStreamToString(
- aInputStream, aInputStream.available(), { charset : "UTF-8" });
- let roots = JSON.parse(bookmarkJSON).roots;
- PlacesUtils.bookmarks.runInBatchMode({
- runBatched: function() {
- // Importing bookmark bar items
- if (roots.bookmark_bar.children &&
- roots.bookmark_bar.children.length > 0) {
- // Toolbar
- let parentId = PlacesUtils.toolbarFolderId;
- if (!MigrationUtils.isStartupMigration) {
- parentId = MigrationUtils.createImportedBookmarksFolder(
- "Chrome", parentId);
- }
- insertBookmarkItems(parentId, roots.bookmark_bar.children);
- }
-
- // Importing bookmark menu items
- if (roots.other.children &&
- roots.other.children.length > 0) {
- // Bookmark menu
- let parentId = PlacesUtils.bookmarksMenuFolderId;
- if (!MigrationUtils.isStartupMigration) {
- parentId = MigrationUtils.createImportedBookmarksFolder(
- "Chrome", parentId);
- }
- insertBookmarkItems(parentId, roots.other.children);
- }
- }
- }, null);
- }, aCallback));
- }
- };
-}
-
-function GetHistoryResource(aProfileFolder) {
- let historyFile = aProfileFolder.clone();
- historyFile.append("History");
- if (!historyFile.exists())
- return null;
-
- return {
- type: MigrationUtils.resourceTypes.HISTORY,
-
- migrate: function(aCallback) {
- let dbConn = Services.storage.openUnsharedDatabase(historyFile);
- let stmt = dbConn.createAsyncStatement(
- "SELECT url, title, last_visit_time, typed_count FROM urls WHERE hidden = 0");
-
- stmt.executeAsync({
- handleResult : function(aResults) {
- let places = [];
- for (let row = aResults.getNextRow(); row; row = aResults.getNextRow()) {
- try {
- // if having typed_count, we changes transition type to typed.
- let transType = PlacesUtils.history.TRANSITION_LINK;
- if (row.getResultByName("typed_count") > 0)
- transType = PlacesUtils.history.TRANSITION_TYPED;
-
- places.push({
- uri: NetUtil.newURI(row.getResultByName("url")),
- title: row.getResultByName("title"),
- visits: [{
- transitionType: transType,
- visitDate: chromeTimeToDate(
- row.getResultByName(
- "last_visit_time")) * 1000,
- }],
- });
- } catch (e) {
- Cu.reportError(e);
- }
- }
-
- try {
- PlacesUtils.asyncHistory.updatePlaces(places);
- } catch (e) {
- Cu.reportError(e);
- }
- },
-
- handleError : function(aError) {
- Cu.reportError("Async statement execution returned with '" +
- aError.result + "', '" + aError.message + "'");
- },
-
- handleCompletion : function(aReason) {
- dbConn.asyncClose();
- aCallback(aReason == Ci.mozIStorageStatementCallback.REASON_FINISHED);
- }
- });
- stmt.finalize();
- }
- };
-}
-
-function GetCookiesResource(aProfileFolder) {
- let cookiesFile = aProfileFolder.clone();
- cookiesFile.append("Cookies");
- if (!cookiesFile.exists())
- return null;
-
- return {
- type: MigrationUtils.resourceTypes.COOKIES,
-
- migrate: function(aCallback) {
- let dbConn = Services.storage.openUnsharedDatabase(cookiesFile);
- let stmt = dbConn.createAsyncStatement(
- "SELECT host_key, path, name, value, secure, httponly, expires_utc FROM cookies");
-
- stmt.executeAsync({
- handleResult : function(aResults) {
- for (let row = aResults.getNextRow(); row; row = aResults.getNextRow()) {
- let host_key = row.getResultByName("host_key");
- if (host_key.match(/^\./)) {
- // 1st character of host_key may be ".", so we have to remove it
- host_key = host_key.substr(1);
- }
-
- try {
- let expiresUtc =
- chromeTimeToDate(row.getResultByName("expires_utc")) / 1000;
- Services.cookies.add(host_key,
- row.getResultByName("path"),
- row.getResultByName("name"),
- row.getResultByName("value"),
- row.getResultByName("secure"),
- row.getResultByName("httponly"),
- false,
- parseInt(expiresUtc));
- } catch (e) {
- Cu.reportError(e);
- }
- }
- },
-
- handleError : function(aError) {
- Cu.reportError("Async statement execution returned with '" +
- aError.result + "', '" + aError.message + "'");
- },
-
- handleCompletion : function(aReason) {
- dbConn.asyncClose();
- aCallback(aReason == Ci.mozIStorageStatementCallback.REASON_FINISHED);
- },
- });
- stmt.finalize();
- }
- }
-}
-
-function GetWindowsPasswordsResource(aProfileFolder) {
- let loginFile = aProfileFolder.clone();
- loginFile.append("Login Data");
- if (!loginFile.exists())
- return null;
-
- return {
- type: MigrationUtils.resourceTypes.PASSWORDS,
-
- migrate(aCallback) {
- let dbConn = Services.storage.openUnsharedDatabase(loginFile);
- let stmt = dbConn.createAsyncStatement(`
- SELECT origin_url, action_url, username_element, username_value,
- password_element, password_value, signon_realm, scheme, date_created,
- times_used FROM logins WHERE blacklisted_by_user = 0`);
- let crypto = new OSCrypto();
- let utf8Converter = Cc["@mozilla.org/intl/utf8converterservice;1"].getService(Ci.nsIUTF8ConverterService);
-
- stmt.executeAsync({
- _rowToLoginInfo(row) {
- let loginInfo = {
- username: utf8Converter.convertURISpecToUTF8(row.getResultByName("username_value"), "UTF-8"),
- password: utf8Converter.convertURISpecToUTF8(
- crypto.decryptData(crypto.arrayToString(row.getResultByName("password_value")), null),
- "UTF-8"),
- hostName: NetUtil.newURI(row.getResultByName("origin_url")).prePath,
- submitURL: null,
- httpRealm: null,
- usernameElement: row.getResultByName("username_element"),
- passwordElement: row.getResultByName("password_element"),
- timeCreated: chromeTimeToDate(row.getResultByName("date_created") + 0).getTime(),
- timesUsed: row.getResultByName("times_used") + 0,
- };
-
- switch (row.getResultByName("scheme")) {
- case AUTH_TYPE.SCHEME_HTML:
- loginInfo.submitURL = NetUtil.newURI(row.getResultByName("action_url")).prePath;
- break;
- case AUTH_TYPE.SCHEME_BASIC:
- case AUTH_TYPE.SCHEME_DIGEST:
- // signon_realm format is URIrealm, so we need remove URI
- loginInfo.httpRealm = row.getResultByName("signon_realm")
- .substring(loginInfo.hostName.length + 1);
- break;
- default:
- throw new Error("Login data scheme type not supported: " +
- row.getResultByName("scheme"));
- }
-
- return loginInfo;
- },
-
- handleResult(aResults) {
- for (let row = aResults.getNextRow(); row; row = aResults.getNextRow()) {
- try {
- let loginInfo = this._rowToLoginInfo(row);
- let login = Cc["@mozilla.org/login-manager/loginInfo;1"].createInstance(Ci.nsILoginInfo);
-
- login.init(loginInfo.hostName, loginInfo.submitURL, loginInfo.httpRealm,
- loginInfo.username, loginInfo.password, loginInfo.usernameElement,
- loginInfo.passwordElement);
- login.QueryInterface(Ci.nsILoginMetaInfo);
- login.timeCreated = loginInfo.timeCreated;
- login.timeLastUsed = loginInfo.timeCreated;
- login.timePasswordChanged = loginInfo.timeCreated;
- login.timesUsed = loginInfo.timesUsed;
-
- // Add the login only if there's not an existing entry
- let logins = Services.logins.findLogins({}, login.hostname,
- login.formSubmitURL,
- login.httpRealm);
-
- // Bug 1187190: Password changes should be propagated depending on timestamps.
- if (!logins.some(l => login.matches(l, true))) {
- Services.logins.addLogin(login);
- }
- } catch (e) {
- Cu.reportError(e);
- }
- }
- },
-
- handleError(aError) {
- Cu.reportError("Async statement execution returned with '" +
- aError.result + "', '" + aError.message + "'");
- },
-
- handleCompletion(aReason) {
- dbConn.asyncClose();
- aCallback(aReason == Ci.mozIStorageStatementCallback.REASON_FINISHED);
- crypto.finalize();
- },
- });
- stmt.finalize();
- }
- };
-}
-
-ChromeProfileMigrator.prototype.classDescription = "Chrome Profile Migrator";
-ChromeProfileMigrator.prototype.contractID = "@mozilla.org/profile/migrator;1?app=browser&type=chrome";
-ChromeProfileMigrator.prototype.classID = Components.ID("{4cec1de4-1671-4fc3-a53e-6c539dc77a26}");
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ChromeProfileMigrator]);
diff --git a/application/palemoon/components/migration/FirefoxProfileMigrator.js b/application/palemoon/components/migration/FirefoxProfileMigrator.js
deleted file mode 100644
index ab4ae55fb4..0000000000
--- a/application/palemoon/components/migration/FirefoxProfileMigrator.js
+++ /dev/null
@@ -1,117 +0,0 @@
-/* -*- Mode: js; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=2 ts=2 sts=2 et */
- /* 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";
-
-/*
- * Migrates from a Pale Moon profile in a lossy manner in order to clean up a
- * user's profile. Data is only migrated where the benefits outweigh the
- * potential problems caused by importing undesired/invalid configurations
- * from the source profile.
- */
-
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-Components.utils.import("resource:///modules/MigrationUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "PlacesBackups",
- "resource://gre/modules/PlacesBackups.jsm");
-
-function FirefoxProfileMigrator() { }
-
-FirefoxProfileMigrator.prototype = Object.create(MigratorPrototype);
-
-FirefoxProfileMigrator.prototype._getAllProfiles = function () {
- let allProfiles = new Map();
- let profiles =
- Components.classes["@mozilla.org/toolkit/profile-service;1"]
- .getService(Components.interfaces.nsIToolkitProfileService)
- .profiles;
- while (profiles.hasMoreElements()) {
- let profile = profiles.getNext().QueryInterface(Components.interfaces.nsIToolkitProfile);
- let rootDir = profile.rootDir;
-
- if (rootDir.exists() && rootDir.isReadable() &&
- !rootDir.equals(MigrationUtils.profileStartup.directory)) {
- allProfiles.set(profile.name, rootDir);
- }
- }
- return allProfiles;
-};
-
-function sorter(a, b) {
- return a.id.toLocaleLowerCase().localeCompare(b.id.toLocaleLowerCase());
-}
-
-Object.defineProperty(FirefoxProfileMigrator.prototype, "sourceProfiles", {
- get: function() {
- return [{id: x, name: x} for (x of this._getAllProfiles().keys())].sort(sorter);
- }
-});
-
-FirefoxProfileMigrator.prototype.getResources = function(aProfile) {
- let sourceProfileDir = aProfile ? this._getAllProfiles().get(aProfile.id) :
- Components.classes["@mozilla.org/toolkit/profile-service;1"]
- .getService(Components.interfaces.nsIToolkitProfileService)
- .selectedProfile.rootDir;
- if (!sourceProfileDir || !sourceProfileDir.exists() ||
- !sourceProfileDir.isReadable())
- return null;
-
- // Being a startup-only migrator, we can rely on
- // MigrationUtils.profileStartup being set.
- let currentProfileDir = MigrationUtils.profileStartup.directory;
-
- // Surely data cannot be imported from the current profile.
- if (sourceProfileDir.equals(currentProfileDir))
- return null;
-
- let getFileResource = function(aMigrationType, aFileNames) {
- let files = [];
- for (let fileName of aFileNames) {
- let file = sourceProfileDir.clone();
- file.append(fileName);
-
- if (file.exists()) {
- files.push(file);
- }
- }
- if (!files.length) {
- return null;
- }
- return {
- type: aMigrationType,
- migrate: function(aCallback) {
- for (let file of files) {
- file.copyTo(currentProfileDir, "");
- }
- aCallback(true);
- }
- };
- };
-
- let types = MigrationUtils.resourceTypes;
- let places = getFileResource(types.HISTORY, ["places.sqlite", "places.sqlite-wal"]);
- let cookies = getFileResource(types.COOKIES, ["cookies.sqlite", "cookies.sqlite-wal"]);
- let passwords = getFileResource(types.PASSWORDS,
- ["signons.sqlite", "logins.json", "key3.db"]);
- let formData = getFileResource(types.FORMDATA, ["formhistory.sqlite"]);
- let bookmarksBackups = getFileResource(types.OTHERDATA,
- [PlacesBackups.profileRelativeFolderPath]);
- let dictionary = getFileResource(types.OTHERDATA, ["persdict.dat"]);
-
- return [r for each (r in [places, cookies, passwords, formData,
- dictionary, bookmarksBackups]) if (r)];
-}
-
-Object.defineProperty(FirefoxProfileMigrator.prototype, "startupOnlyMigrator", {
- get: function() true
-});
-
-
-FirefoxProfileMigrator.prototype.classDescription = "Firefox Profile Migrator";
-FirefoxProfileMigrator.prototype.contractID = "@mozilla.org/profile/migrator;1?app=browser&type=firefox";
-FirefoxProfileMigrator.prototype.classID = Components.ID("{91185366-ba97-4438-acba-48deaca63386}");
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([FirefoxProfileMigrator]);
diff --git a/application/palemoon/components/migration/IEProfileMigrator.js b/application/palemoon/components/migration/IEProfileMigrator.js
deleted file mode 100644
index a46deae68e..0000000000
--- a/application/palemoon/components/migration/IEProfileMigrator.js
+++ /dev/null
@@ -1,521 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
-const Cr = Components.results;
-
-const kMainKey = "Software\\Microsoft\\Internet Explorer\\Main";
-const kRegMultiSz = 7;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/NetUtil.jsm");
-Cu.import("resource:///modules/MigrationUtils.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
- "resource://gre/modules/PlacesUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "ctypes",
- "resource://gre/modules/ctypes.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "WindowsRegistry",
- "resource://gre/modules/WindowsRegistry.jsm");
-
-Cu.importGlobalProperties(["File"]);
-
-////////////////////////////////////////////////////////////////////////////////
-//// Helpers.
-
-let CtypesHelpers = {
- _structs: {},
- _functions: {},
- _libs: {},
-
- /**
- * Must be invoked once before first use of any of the provided helpers.
- */
- initialize: function CH_initialize() {
- const WORD = ctypes.uint16_t;
- const DWORD = ctypes.uint32_t;
- const BOOL = ctypes.int;
-
- this._structs.SYSTEMTIME = new ctypes.StructType('SYSTEMTIME', [
- {wYear: WORD},
- {wMonth: WORD},
- {wDayOfWeek: WORD},
- {wDay: WORD},
- {wHour: WORD},
- {wMinute: WORD},
- {wSecond: WORD},
- {wMilliseconds: WORD}
- ]);
-
- this._structs.FILETIME = new ctypes.StructType('FILETIME', [
- {dwLowDateTime: DWORD},
- {dwHighDateTime: DWORD}
- ]);
-
- try {
- this._libs.kernel32 = ctypes.open("Kernel32");
- this._functions.FileTimeToSystemTime =
- this._libs.kernel32.declare("FileTimeToSystemTime",
- ctypes.default_abi,
- BOOL,
- this._structs.FILETIME.ptr,
- this._structs.SYSTEMTIME.ptr);
- } catch (ex) {
- this.finalize();
- }
- },
-
- /**
- * Must be invoked once after last use of any of the provided helpers.
- */
- finalize: function CH_finalize() {
- this._structs = {};
- this._functions = {};
- for each (let lib in this._libs) {
- try {
- lib.close();
- } catch (ex) {}
- }
- this._libs = {};
- },
-
- /**
- * Converts a FILETIME struct (2 DWORDS), to a SYSTEMTIME struct.
- *
- * @param aTimeHi
- * Least significant DWORD.
- * @param aTimeLo
- * Most significant DWORD.
- * @return a Date object representing the converted datetime.
- */
- fileTimeToDate: function CH_fileTimeToDate(aTimeHi, aTimeLo) {
- let fileTime = this._structs.FILETIME();
- fileTime.dwLowDateTime = aTimeLo;
- fileTime.dwHighDateTime = aTimeHi;
- let systemTime = this._structs.SYSTEMTIME();
- let result = this._functions.FileTimeToSystemTime(fileTime.address(),
- systemTime.address());
- if (result == 0)
- throw new Error(ctypes.winLastError);
-
- return new Date(systemTime.wYear,
- systemTime.wMonth - 1,
- systemTime.wDay,
- systemTime.wHour,
- systemTime.wMinute,
- systemTime.wSecond,
- systemTime.wMilliseconds);
- }
-};
-
-/**
- * Checks whether an host is an IP (v4 or v6) address.
- *
- * @param aHost
- * The host to check.
- * @return whether aHost is an IP address.
- */
-function hostIsIPAddress(aHost) {
- try {
- Services.eTLD.getBaseDomainFromHost(aHost);
- } catch (e if e.result == Cr.NS_ERROR_HOST_IS_IP_ADDRESS) {
- return true;
- } catch (e) {}
- return false;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-//// Resources
-
-function Bookmarks() {
-}
-
-Bookmarks.prototype = {
- type: MigrationUtils.resourceTypes.BOOKMARKS,
-
- get exists() !!this._favoritesFolder,
-
- __favoritesFolder: null,
- get _favoritesFolder() {
- if (!this.__favoritesFolder) {
- let favoritesFolder = Services.dirsvc.get("Favs", Ci.nsIFile);
- if (favoritesFolder.exists() && favoritesFolder.isReadable())
- this.__favoritesFolder = favoritesFolder;
- }
- return this.__favoritesFolder;
- },
-
- __toolbarFolderName: null,
- get _toolbarFolderName() {
- if (!this.__toolbarFolderName) {
- // Retrieve the name of IE's favorites subfolder that holds the bookmarks
- // in the toolbar. This was previously stored in the registry and changed
- // in IE7 to always be called "Links".
- let folderName = WindowsRegistry.readRegKey(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
- "Software\\Microsoft\\Internet Explorer\\Toolbar",
- "LinksFolderName");
- this.__toolbarFolderName = folderName || "Links";
- }
- return this.__toolbarFolderName;
- },
-
- migrate: function B_migrate(aCallback) {
- PlacesUtils.bookmarks.runInBatchMode({
- runBatched: (function migrateBatched() {
- // Import to the bookmarks menu.
- let destFolderId = PlacesUtils.bookmarksMenuFolderId;
- if (!MigrationUtils.isStartupMigration) {
- destFolderId =
- MigrationUtils.createImportedBookmarksFolder("IE", destFolderId);
- }
-
- this._migrateFolder(this._favoritesFolder, destFolderId);
-
- aCallback(true);
- }).bind(this)
- }, null);
- },
-
- _migrateFolder: function B__migrateFolder(aSourceFolder, aDestFolderId) {
- // TODO (bug 741993): the favorites order is stored in the Registry, at
- // HCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Favorites
- // Until we support it, bookmarks are imported in alphabetical order.
- let entries = aSourceFolder.directoryEntries;
- while (entries.hasMoreElements()) {
- let entry = entries.getNext().QueryInterface(Ci.nsIFile);
-
- // Make sure that entry.path == entry.target to not follow .lnk folder
- // shortcuts which could lead to infinite cycles.
- if (entry.isDirectory() && entry.path == entry.target) {
- let destFolderId;
- if (entry.leafName == this._toolbarFolderName &&
- entry.parent.equals(this._favoritesFolder)) {
- // Import to the bookmarks toolbar.
- destFolderId = PlacesUtils.toolbarFolderId;
- if (!MigrationUtils.isStartupMigration) {
- destFolderId =
- MigrationUtils.createImportedBookmarksFolder("IE", destFolderId);
- }
- }
- else {
- // Import to a new folder.
- destFolderId =
- PlacesUtils.bookmarks.createFolder(aDestFolderId, entry.leafName,
- PlacesUtils.bookmarks.DEFAULT_INDEX);
- }
-
- if (entry.isReadable()) {
- // Recursively import the folder.
- this._migrateFolder(entry, destFolderId);
- }
- }
- else {
- // Strip the .url extension, to both check this is a valid link file,
- // and get the associated title.
- let matches = entry.leafName.match(/(.+)\.url$/i);
- if (matches) {
- let fileHandler = Cc["@mozilla.org/network/protocol;1?name=file"].
- getService(Ci.nsIFileProtocolHandler);
- let uri = fileHandler.readURLFile(entry);
- let title = matches[1];
-
- PlacesUtils.bookmarks.insertBookmark(aDestFolderId,
- uri,
- PlacesUtils.bookmarks.DEFAULT_INDEX,
- title);
- }
- }
- }
- }
-};
-
-function History() {
-}
-
-History.prototype = {
- type: MigrationUtils.resourceTypes.HISTORY,
-
- get exists() true,
-
- __typedURLs: null,
- get _typedURLs() {
- if (!this.__typedURLs) {
- // The list of typed URLs is a sort of annotation stored in the registry.
- // Currently, IE stores 25 entries and this value is not configurable,
- // but we just keep reading up to the first non-existing entry to support
- // possible future bumps of this limit.
- this.__typedURLs = {};
- let registry = Cc["@mozilla.org/windows-registry-key;1"].
- createInstance(Ci.nsIWindowsRegKey);
- try {
- registry.open(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
- "Software\\Microsoft\\Internet Explorer\\TypedURLs",
- Ci.nsIWindowsRegKey.ACCESS_READ);
- for (let entry = 1; registry.hasValue("url" + entry); entry++) {
- let url = registry.readStringValue("url" + entry);
- this.__typedURLs[url] = true;
- }
- } catch (ex) {
- } finally {
- registry.close();
- }
- }
- return this.__typedURLs;
- },
-
- migrate: function H_migrate(aCallback) {
- let places = [];
- let historyEnumerator = Cc["@mozilla.org/profile/migrator/iehistoryenumerator;1"].
- createInstance(Ci.nsISimpleEnumerator);
- while (historyEnumerator.hasMoreElements()) {
- let entry = historyEnumerator.getNext().QueryInterface(Ci.nsIPropertyBag2);
- let uri = entry.get("uri").QueryInterface(Ci.nsIURI);
- // MSIE stores some types of URLs in its history that we don't handle,
- // like HTMLHelp and others. Since we don't properly map handling for
- // all of them we just avoid importing them.
- if (["http", "https", "ftp", "file"].indexOf(uri.scheme) == -1) {
- continue;
- }
-
- let title = entry.get("title");
- // Embed visits have no title and don't need to be imported.
- if (title.length == 0) {
- continue;
- }
-
- // The typed urls are already fixed-up, so we can use them for comparison.
- let transitionType = this._typedURLs[uri.spec] ?
- Ci.nsINavHistoryService.TRANSITION_TYPED :
- Ci.nsINavHistoryService.TRANSITION_LINK;
- let lastVisitTime = entry.get("time");
-
- places.push(
- { uri: uri,
- title: title,
- visits: [{ transitionType: transitionType,
- visitDate: lastVisitTime }]
- }
- );
- }
-
- // Check whether there is any history to import.
- if (places.length == 0) {
- aCallback(true);
- return;
- }
-
- PlacesUtils.asyncHistory.updatePlaces(places, {
- _success: false,
- handleResult: function() {
- // Importing any entry is considered a successful import.
- this._success = true;
- },
- handleError: function() {},
- handleCompletion: function() {
- aCallback(this._success);
- }
- });
- }
-};
-
-function Cookies() {
-}
-
-Cookies.prototype = {
- type: MigrationUtils.resourceTypes.COOKIES,
-
- get exists() !!this._cookiesFolder,
-
- __cookiesFolder: null,
- get _cookiesFolder() {
- // Cookies are stored in txt files, in a Cookies folder whose path varies
- // across the different OS versions. CookD takes care of most of these
- // cases, though, in Windows Vista/7, UAC makes a difference.
- // If UAC is enabled, the most common destination is CookD/Low. Though,
- // if the user runs the application in administrator mode or disables UAC,
- // cookies are stored in the original CookD destination. Cause running the
- // browser in administrator mode is unsafe and discouraged, we just care
- // about the UAC state.
- if (!this.__cookiesFolder) {
- let cookiesFolder = Services.dirsvc.get("CookD", Ci.nsIFile);
- if (cookiesFolder.exists() && cookiesFolder.isReadable()) {
- // Check if UAC is enabled.
- if (Services.appinfo.QueryInterface(Ci.nsIWinAppHelper).userCanElevate) {
- cookiesFolder.append("Low");
- }
- this.__cookiesFolder = cookiesFolder;
- }
- }
- return this.__cookiesFolder;
- },
-
- migrate: function C_migrate(aCallback) {
- CtypesHelpers.initialize();
-
- let cookiesGenerator = (function genCookie() {
- let success = false;
- let entries = this._cookiesFolder.directoryEntries;
- while (entries.hasMoreElements()) {
- let entry = entries.getNext().QueryInterface(Ci.nsIFile);
- // Skip eventual bogus entries.
- if (!entry.isFile() || !/\.txt$/.test(entry.leafName))
- continue;
-
- this._readCookieFile(entry, function(aSuccess) {
- // Importing even a single cookie file is considered a success.
- if (aSuccess)
- success = true;
- try {
- cookiesGenerator.next();
- } catch (ex) {}
- });
-
- yield;
- }
-
- CtypesHelpers.finalize();
-
- aCallback(success);
- }).apply(this);
- cookiesGenerator.next();
- },
-
- _readCookieFile: function C__readCookieFile(aFile, aCallback) {
- let fileReader = Cc["@mozilla.org/files/filereader;1"].
- createInstance(Ci.nsIDOMFileReader);
- fileReader.addEventListener("loadend", (function onLoadEnd() {
- fileReader.removeEventListener("loadend", onLoadEnd, false);
-
- if (fileReader.readyState != fileReader.DONE) {
- Cu.reportError("Could not read cookie contents: " + fileReader.error);
- aCallback(false);
- return;
- }
-
- let success = true;
- try {
- this._parseCookieBuffer(fileReader.result);
- } catch (ex) {
- Components.utils.reportError("Unable to migrate cookie: " + ex);
- success = false;
- } finally {
- aCallback(success);
- }
- }).bind(this), false);
- fileReader.readAsText(new File(aFile));
- },
-
- /**
- * Parses a cookie file buffer and returns an array of the contained cookies.
- *
- * The cookie file format is a newline-separated-values with a "*" used as
- * delimeter between multiple records.
- * Each cookie has the following fields:
- * - name
- * - value
- * - host/path
- * - flags
- * - Expiration time most significant integer
- * - Expiration time least significant integer
- * - Creation time most significant integer
- * - Creation time least significant integer
- * - Record delimiter "*"
- *
- * @note All the times are in FILETIME format.
- */
- _parseCookieBuffer: function C__parseCookieBuffer(aTextBuffer) {
- // Note the last record is an empty string.
- let records = [r for each (r in aTextBuffer.split("*\n")) if (r)];
- for (let record of records) {
- let [name, value, hostpath, flags,
- expireTimeLo, expireTimeHi] = record.split("\n");
-
- // IE stores deleted cookies with a zero-length value, skip them.
- if (value.length == 0)
- continue;
-
- let hostLen = hostpath.indexOf("/");
- let host = hostpath.substr(0, hostLen);
- let path = hostpath.substr(hostLen);
-
- // For a non-null domain, assume it's what Mozilla considers
- // a domain cookie. See bug 222343.
- if (host.length > 0) {
- // Fist delete any possible extant matching host cookie.
- Services.cookies.remove(host, name, path, false);
- // Now make it a domain cookie.
- if (host[0] != "." && !hostIsIPAddress(host))
- host = "." + host;
- }
-
- let expireTime = CtypesHelpers.fileTimeToDate(Number(expireTimeHi),
- Number(expireTimeLo));
- Services.cookies.add(host,
- path,
- name,
- value,
- Number(flags) & 0x1, // secure
- false, // httpOnly
- false, // session
- expireTime);
- }
- }
-};
-
-
-////////////////////////////////////////////////////////////////////////////////
-//// Migrator
-
-function IEProfileMigrator()
-{
-}
-
-IEProfileMigrator.prototype = Object.create(MigratorPrototype);
-
-IEProfileMigrator.prototype.getResources = function IE_getResources() {
- let resources = [
- new Bookmarks()
- , new History()
- , new Cookies()
- ];
- return [r for each (r in resources) if (r.exists)];
-};
-
-Object.defineProperty(IEProfileMigrator.prototype, "sourceHomePageURL", {
- get: function IE_get_sourceHomePageURL() {
- let defaultStartPage = WindowsRegistry.readRegKey(Ci.nsIWindowsRegKey.ROOT_KEY_LOCAL_MACHINE,
- kMainKey, "Default_Page_URL");
- let startPage = WindowsRegistry.readRegKey(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
- kMainKey, "Start Page");
- // If the user didn't customize the Start Page, he is still on the default
- // page, that may be considered the equivalent of our about:home. There's
- // no reason to retain it, since it is heavily targeted to IE.
- let homepage = startPage != defaultStartPage ? startPage : "";
-
- // IE7+ supports secondary home pages located in a REG_MULTI_SZ key. These
- // are in addition to the Start Page, and no empty entries are possible,
- // thus a Start Page is always defined if any of these exists, though it
- // may be the default one.
- let secondaryPages = WindowsRegistry.readRegKey(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
- kMainKey, "Secondary Start Pages");
- if (secondaryPages) {
- if (homepage)
- secondaryPages.unshift(homepage);
- homepage = secondaryPages.join("|");
- }
-
- return homepage;
- }
-});
-
-IEProfileMigrator.prototype.classDescription = "IE Profile Migrator";
-IEProfileMigrator.prototype.contractID = "@mozilla.org/profile/migrator;1?app=browser&type=ie";
-IEProfileMigrator.prototype.classID = Components.ID("{3d2532e3-4932-4774-b7ba-968f5899d3a4}");
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([IEProfileMigrator]);
diff --git a/application/palemoon/components/migration/MigrationUtils.jsm b/application/palemoon/components/migration/MigrationUtils.jsm
deleted file mode 100644
index fcd73a7984..0000000000
--- a/application/palemoon/components/migration/MigrationUtils.jsm
+++ /dev/null
@@ -1,644 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-this.EXPORTED_SYMBOLS = ["MigrationUtils", "MigratorPrototype"];
-
-const Cu = Components.utils;
-const Ci = Components.interfaces;
-const Cc = Components.classes;
-
-const TOPIC_WILL_IMPORT_BOOKMARKS = "initial-migration-will-import-default-bookmarks";
-const TOPIC_DID_IMPORT_BOOKMARKS = "initial-migration-did-import-default-bookmarks";
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "Dict",
- "resource://gre/modules/Dict.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
- "resource://gre/modules/PlacesUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
- "resource://gre/modules/NetUtil.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "BookmarkHTMLUtils",
- "resource://gre/modules/BookmarkHTMLUtils.jsm");
-
-let gMigrators = null;
-let gProfileStartup = null;
-let gMigrationBundle = null;
-
-function getMigrationBundle() {
- if (!gMigrationBundle) {
- gMigrationBundle = Services.strings.createBundle(
- "chrome://browser/locale/migration/migration.properties");
- }
- return gMigrationBundle;
-}
-
-/**
- * Figure out what is the default browser, and if there is a migrator
- * for it, return that migrator's internal name.
- * For the time being, the "internal name" of a migraotr is its contract-id
- * trailer (e.g. ie for @mozilla.org/profile/migrator;1?app=browser&type=ie),
- * but it will soon be exposed properly.
- */
-function getMigratorKeyForDefaultBrowser() {
- const APP_DESC_TO_KEY = {
- "Internet Explorer": "ie",
- "Safari": "safari",
- "Pale Moon web browser": "firefox",
- "Google Chrome": "chrome", // Windows, Linux
- "Chrome": "chrome", // OS X
- };
-
- let browserDesc = "";
- try {
- let browserDesc =
- Cc["@mozilla.org/uriloader/external-protocol-service;1"].
- getService(Ci.nsIExternalProtocolService).
- getApplicationDescription("http");
- return APP_DESC_TO_KEY[browserDesc] || "";
- }
- catch(ex) {
- Cu.reportError("Could not detect default browser: " + ex);
- }
- return "";
-}
-
-/**
- * Shared prototype for migrators, implementing nsIBrowserProfileMigrator.
- *
- * To implement a migrator:
- * 1. Import this module.
- * 2. Create the prototype for the migrator, extending MigratorPrototype.
- * Namely: MosaicMigrator.prototype = Object.create(MigratorPrototype);
- * 3. Set classDescription, contractID and classID for your migrator, and set
- * NSGetFactory appropriately.
- * 4. If the migrator supports multiple profiles, override the sourceProfiles
- * Here we default for single-profile migrator.
- * 5. Implement getResources(aProfile) (see below).
- * 6. If the migrator supports reading the home page of the source browser,
- * override |sourceHomePageURL| getter.
- * 7. For startup-only migrators, override |startupOnlyMigrator|.
- */
-this.MigratorPrototype = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIBrowserProfileMigrator]),
-
- /**
- * OVERRIDE IF AND ONLY IF the source supports multiple profiles.
- *
- * Returns array of profile objects from which data may be imported. The object
- * should have the following keys:
- * id - a unique string identifier for the profile
- * name - a pretty name to display to the user in the UI
- *
- * Only profiles from which data can be imported should be listed. Otherwise
- * the behavior of the migration wizard isn't well-defined.
- *
- * For a single-profile source (e.g. safari, ie), this returns null,
- * and not an empty array. That is the default implementation.
- */
- get sourceProfiles() null,
-
- /**
- * MUST BE OVERRIDDEN.
- *
- * Returns an array of "migration resources" objects for the given profile,
- * or for the "default" profile, if the migrator does not support multiple
- * profiles.
- *
- * Each migration resource should provide:
- * - a |type| getter, retunring any of the migration types (see
- * nsIBrowserProfileMigrator).
- *
- * - a |migrate| method, taking a single argument, aCallback(bool success),
- * for migrating the data for this resource. It may do its job
- * synchronously or asynchronously. Either way, it must call
- * aCallback(bool aSuccess) when it's done. In the case of an exception
- * thrown from |migrate|, it's taken as if aCallback(false) is called.
- *
- * Note: In the case of a simple asynchronous implementation, you may find
- * MigrationUtils.wrapMigrateFunction handy for handling aCallback easily.
- *
- * For each migration type listed in nsIBrowserProfileMigrator, multiple
- * migration resources may be provided. This practice is useful when the
- * data for a certain migration type is independently stored in few
- * locations. For example, the mac version of Safari stores its "reading list"
- * bookmarks in a separate property list.
- *
- * Note that the importation of a particular migration type is reported as
- * successful if _any_ of its resources succeeded to import (that is, called,
- * |aCallback(true)|). However, completion-status for a particular migration
- * type is reported to the UI only once all of its migrators have called
- * aCallback.
- *
- * @note The returned array should only include resources from which data
- * can be imported. So, for example, before adding a resource for the
- * BOOKMARKS migration type, you should check if you should check that the
- * bookmarks file exists.
- *
- * @param aProfile
- * The profile from which data may be imported, or an empty string
- * in the case of a single-profile migrator.
- * In the case of multiple-profiles migrator, it is guaranteed that
- * aProfile is a value returned by the sourceProfiles getter (see
- * above).
- */
- getResources: function MP_getResources(aProfile) {
- throw new Error("getResources must be overridden");
- },
-
- /**
- * OVERRIDE IF AND ONLY IF the migrator is a startup-only migrator (For now,
- * that is just the Firefox migrator, see bug 737381). Default: false.
- *
- * Startup-only migrators are different in two ways:
- * - they may only be used during startup.
- * - the user-profile is half baked during migration. The folder exists,
- * but it's only accessible through MigrationUtils.profileStartup.
- * The migrator can call MigrationUtils.profileStartup.doStartup
- * at any point in order to initialize the profile.
- */
- get startupOnlyMigrator() false,
-
- /**
- * OVERRIDE IF AND ONLY IF your migrator supports importing the homepage.
- * @see nsIBrowserProfileMigrator
- */
- get sourceHomePageURL() "",
-
- /**
- * DO NOT OVERRIDE - After deCOMing migration, the UI will just call
- * getResources.
- *
- * @see nsIBrowserProfileMigrator
- */
- getMigrateData: function MP_getMigrateData(aProfile) {
- let types = [r.type for each (r in this._getMaybeCachedResources(aProfile))];
- return types.reduce(function(a, b) a |= b, 0);
- },
-
- /**
- * DO NOT OVERRIDE - After deCOMing migration, the UI will just call
- * migrate for each resource.
- *
- * @see nsIBrowserProfileMigrator
- */
- migrate: function MP_migrate(aItems, aStartup, aProfile) {
- let resources = this._getMaybeCachedResources(aProfile);
- if (resources.length == 0)
- throw new Error("migrate called for a non-existent source");
-
- if (aItems != Ci.nsIBrowserProfileMigrator.ALL)
- resources = [r for each (r in resources) if (aItems & r.type)];
-
- // Called either directly or through the bookmarks import callback.
- function doMigrate() {
- // TODO: use Map (for the items) and Set (for the resources)
- // once they are iterable.
- let resourcesGroupedByItems = new Dict();
- resources.forEach(function(resource) {
- if (resourcesGroupedByItems.has(resource.type))
- resourcesGroupedByItems.get(resource.type).push(resource);
- else
- resourcesGroupedByItems.set(resource.type, [resource]);
- });
-
- if (resourcesGroupedByItems.count == 0)
- throw new Error("No items to import");
-
- let notify = function(aMsg, aItemType) {
- Services.obs.notifyObservers(null, aMsg, aItemType);
- }
-
- notify("Migration:Started");
- resourcesGroupedByItems.listkeys().forEach(function(migrationType) {
- let migrationTypeA = migrationType;
- let itemResources = resourcesGroupedByItems.get(migrationType);
- notify("Migration:ItemBeforeMigrate", migrationType);
-
- let itemSuccess = false;
- itemResources.forEach(function(resource) {
- let resourceDone = function(aSuccess) {
- let resourceIndex = itemResources.indexOf(resource);
- if (resourceIndex != -1) {
- itemResources.splice(resourceIndex, 1);
- itemSuccess |= aSuccess;
- if (itemResources.length == 0) {
- resourcesGroupedByItems.del(migrationType);
- notify(itemSuccess ?
- "Migration:ItemAfterMigrate" : "Migration:ItemError",
- migrationType);
- if (resourcesGroupedByItems.count == 0)
- notify("Migration:Ended");
- }
- }
- };
-
- Services.tm.mainThread.dispatch(function() {
- // If migrate throws, an error occurred, and the callback
- // (itemMayBeDone) might haven't been called.
- try {
- resource.migrate(resourceDone);
- }
- catch(ex) {
- Cu.reportError(ex);
- resourceDone(false);
- }
- }, Ci.nsIThread.DISPATCH_NORMAL);
- });
- });
- }
-
- if (MigrationUtils.isStartupMigration && !this.startupOnlyMigrator) {
- MigrationUtils.profileStartup.doStartup();
-
- // If we're about to migrate bookmarks, first import the default bookmarks.
- // Note We do not need to do so for the Firefox migrator
- // (=startupOnlyMigrator), as it just copies over the places database
- // from another profile.
- const BOOKMARKS = MigrationUtils.resourceTypes.BOOKMARKS;
- let migratingBookmarks = resources.some(function(r) r.type == BOOKMARKS);
- if (migratingBookmarks) {
- let browserGlue = Cc["@mozilla.org/browser/browserglue;1"].
- getService(Ci.nsIObserver);
- browserGlue.observe(null, TOPIC_WILL_IMPORT_BOOKMARKS, "");
-
- // Note doMigrate doesn't care about the success of the import.
- let onImportComplete = function() {
- browserGlue.observe(null, TOPIC_DID_IMPORT_BOOKMARKS, "");
- doMigrate();
- };
- BookmarkHTMLUtils.importFromURL(
- "resource:///defaults/profile/bookmarks.html", true).then(
- onImportComplete, onImportComplete);
- return;
- }
- }
- doMigrate();
- },
-
- /**
- * DO NOT OVERRIDE - After deCOMing migration, this code
- * won't be part of the migrator itself.
- *
- * @see nsIBrowserProfileMigrator
- */
- get sourceExists() {
- if (this.startupOnlyMigrator && !MigrationUtils.isStartupMigration)
- return false;
-
- // For a single-profile source, check if any data is available.
- // For multiple-profiles source, make sure that at least one
- // profile is available.
- let exists = false;
- try {
- let profiles = this.sourceProfiles;
- if (!profiles) {
- let resources = this._getMaybeCachedResources("");
- if (resources && resources.length > 0)
- exists = true;
- }
- else {
- exists = profiles.length > 0;
- }
- }
- catch(ex) {
- Cu.reportError(ex);
- }
- return exists;
- },
-
- /*** PRIVATE STUFF - DO NOT OVERRIDE ***/
- _getMaybeCachedResources: function PMB__getMaybeCachedResources(aProfile) {
- let profileKey = aProfile ? aProfile.id : "";
- if (this._resourcesByProfile) {
- if (profileKey in this._resourcesByProfile)
- return this._resourcesByProfile[profileKey];
- }
- else {
- this._resourcesByProfile = { };
- }
- return this._resourcesByProfile[profileKey] = this.getResources(aProfile);
- }
-};
-
-this.MigrationUtils = Object.freeze({
- resourceTypes: {
- SETTINGS: Ci.nsIBrowserProfileMigrator.SETTINGS,
- COOKIES: Ci.nsIBrowserProfileMigrator.COOKIES,
- HISTORY: Ci.nsIBrowserProfileMigrator.HISTORY,
- FORMDATA: Ci.nsIBrowserProfileMigrator.FORMDATA,
- PASSWORDS: Ci.nsIBrowserProfileMigrator.PASSWORDS,
- BOOKMARKS: Ci.nsIBrowserProfileMigrator.BOOKMARKS,
- OTHERDATA: Ci.nsIBrowserProfileMigrator.OTHERDATA
- },
-
- /**
- * Helper for implementing simple asynchronous cases of migration resources'
- * |migrate(aCallback)| (see MigratorPrototype). If your |migrate| method
- * just waits for some file to be read, for example, and then migrates
- * everything right away, you can wrap the async-function with this helper
- * and not worry about notifying the callback.
- *
- * For example, instead of writing:
- * setTimeout(function() {
- * try {
- * ....
- * aCallback(true);
- * }
- * catch() {
- * aCallback(false);
- * }
- * }, 0);
- *
- * You may write:
- * setTimeout(MigrationUtils.wrapMigrateFunction(function() {
- * if (importingFromMosaic)
- * throw Cr.NS_ERROR_UNEXPECTED;
- * }, aCallback), 0);
- *
- * ... and aCallback will be called with aSuccess=false when importing
- * from Mosaic, or with aSuccess=true otherwise.
- *
- * @param aFunction
- * the function that will be called sometime later. If aFunction
- * throws when it's called, aCallback(false) is called, otherwise
- * aCallback(true) is called.
- * @param aCallback
- * the callback function passed to |migrate|.
- * @return the wrapped function.
- */
- wrapMigrateFunction: function MU_wrapMigrateFunction(aFunction, aCallback) {
- return function() {
- let success = false;
- try {
- aFunction.apply(null, arguments);
- success = true;
- }
- catch(ex) {
- Cu.reportError(ex);
- }
- // Do not change this to call aCallback directly in try try & catch
- // blocks, because if aCallback throws, we may end up calling aCallback
- // twice.
- aCallback(success);
- }
- },
-
- /**
- * Gets a string from the migration bundle. Shorthand for
- * nsIStringBundle.GetStringFromName, if aReplacements isn't passed, or for
- * nsIStringBundle.formatStringFromName if it is.
- *
- * This method also takes care of "bumped" keys (See bug 737381 comment 8 for
- * details).
- *
- * @param aKey
- * The key of the string to retrieve.
- * @param aReplacemts
- * [optioanl] Array of replacements to run on the retrieved string.
- * @return the retrieved string.
- *
- * @see nsIStringBundle
- */
- getLocalizedString: function MU_getLocalizedString(aKey, aReplacements) {
- const OVERRIDES = {
- "4_firefox": "4_firefox_history_and_bookmarks",
- "64_firefox": "64_firefox_other"
- };
- aKey = OVERRIDES[aKey] || aKey;
-
- if (aReplacements === undefined)
- return getMigrationBundle().GetStringFromName(aKey);
- return getMigrationBundle().formatStringFromName(
- aKey, aReplacements, aReplacements.length);
- },
-
- /**
- * Helper for creating a folder for imported bookmarks from a particular
- * migration source. The folder is created at the end of the given folder.
- *
- * @param aSourceNameStr
- * the source name (first letter capitalized). This is used
- * for reading the localized source name from the migration
- * bundle (e.g. if aSourceNameStr is Mosaic, this will try to read
- * sourceNameMosaic from the migration bundle).
- * @param aParentId
- * the item-id of the folder in which the new folder should be
- * created.
- * @return the item-id of the new folder.
- */
- createImportedBookmarksFolder:
- function MU_createImportedBookmarksFolder(aSourceNameStr, aParentId) {
- let source = this.getLocalizedString("sourceName" + aSourceNameStr);
- let label = this.getLocalizedString("importedBookmarksFolder", [source]);
- return PlacesUtils.bookmarks.createFolder(
- aParentId, label, PlacesUtils.bookmarks.DEFAULT_INDEX);
- },
-
- get _migrators() gMigrators ? gMigrators : gMigrators = new Dict(),
-
- /*
- * Returns the migrator for the given source, if any data is available
- * for this source, or null otherwise.
- *
- * @param aKey internal name of the migration source.
- * Supported values: ie (windows),
- * safari (mac/windows),
- * chrome (mac/windows/linux),
- * firefox.
- *
- * If null is returned, either no data can be imported
- * for the given migrator, or aMigratorKey is invalid (e.g. ie on mac,
- * or mosaic everywhere). This method should be used rather than direct
- * getService for future compatibility (see bug 718280).
- *
- * @return profile migrator implementing nsIBrowserProfileMigrator, if it can
- * import any data, null otherwise.
- */
- getMigrator: function MU_getMigrator(aKey) {
- let migrator = null;
- if (this._migrators.has(aKey)) {
- migrator = this._migrators.get(aKey);
- }
- else {
- try {
- migrator = Cc["@mozilla.org/profile/migrator;1?app=browser&type=" +
- aKey].createInstance(Ci.nsIBrowserProfileMigrator);
- }
- catch(ex) { }
- this._migrators.set(aKey, migrator);
- }
-
- return migrator && migrator.sourceExists ? migrator : null;
- },
-
- // Iterates the available migrators, in the most suitable
- // order for the running platform.
- get migrators() {
- let migratorKeysOrdered = [
-#ifdef XP_WIN
- "firefox", "ie", "chrome", "safari"
-#elifdef XP_MACOSX
- "firefox", "safari", "chrome"
-#elifdef XP_UNIX
- "firefox", "chrome"
-#endif
- ];
-
- // If a supported default browser is found check it first
- // so that the wizard defaults to import from that browser.
- let defaultBrowserKey = getMigratorKeyForDefaultBrowser();
- if (defaultBrowserKey)
- migratorKeysOrdered.sort(function (a, b) b == defaultBrowserKey ? 1 : 0);
-
- for (let migratorKey of migratorKeysOrdered) {
- let migrator = this.getMigrator(migratorKey);
- if (migrator)
- yield migrator;
- }
- },
-
- // Whether or not we're in the process of startup migration
- get isStartupMigration() gProfileStartup != null,
-
- /**
- * In the case of startup migration, this is set to the nsIProfileStartup
- * instance passed to ProfileMigrator's migrate.
- *
- * @see showMigrationWizard
- */
- get profileStartup() gProfileStartup,
-
- /**
- * Show the migration wizard. On mac, this may just focus the wizard if it's
- * already running, in which case aOpener and aParams are ignored.
- *
- * @param [optional] aOpener
- * the window that asks to open the wizard.
- * @param [optional] aParams
- * arguments for the migration wizard, in the form of an nsIArray.
- * This is passed as-is for the params argument of
- * nsIWindowWatcher.openWindow.
- */
- showMigrationWizard:
- function MU_showMigrationWizard(aOpener, aParams) {
- let features = "chrome,dialog,modal,centerscreen,titlebar,resizable=no";
-#ifdef XP_MACOSX
- if (!this.isStartupMigration) {
- let win = Services.wm.getMostRecentWindow("Browser:MigrationWizard");
- if (win) {
- win.focus();
- return;
- }
- // On mac, the migration wiazrd should only be modal in the case of
- // startup-migration.
- features = "centerscreen,chrome,resizable=no";
- }
-#endif
-
- Services.ww.openWindow(aOpener,
- "chrome://browser/content/migration/migration.xul",
- "_blank",
- features,
- aParams);
- },
-
- /**
- * Show the migration wizard for startup-migration. This should only be
- * called by ProfileMigrator (see ProfileMigrator.js), which implements
- * nsIProfileMigrator.
- *
- * @param aProfileStartup
- * the nsIProfileStartup instance provided to ProfileMigrator.migrate.
- * @param [optional] aMigratorKey
- * If set, the migration wizard will import from the corresponding
- * migrator, bypassing the source-selection page. Otherwise, the
- * source-selection page will be displayed, either with the default
- * browser selected, if it could be detected and if there is a
- * migrator for it, or with the first option selected as a fallback
- * (The first option is hardcoded to be the most common browser for
- * the OS we run on. See migration.xul).
- * @param [optional] aProfileToMigrate
- * If set, the migration wizard will import from the profile indicated.
- *
- * @throws if aMigratorKey is invalid or if it points to a non-existent
- * source.
- */
- startupMigration:
- function MU_startupMigrator(aProfileStartup, aMigratorKey, aProfileToMigrate) {
- if (!aProfileStartup) {
- throw new Error("a profile-startup instance is required for startup-migration");
- }
- gProfileStartup = aProfileStartup;
-
- let skipSourcePage = false, migrator = null, migratorKey = "";
- if (aMigratorKey) {
- migrator = this.getMigrator(aMigratorKey);
- if (!migrator) {
- // aMigratorKey must point to a valid source, so, if it doesn't
- // cleanup and throw.
- this.finishMigration();
- throw new Error("startMigration was asked to open auto-migrate from " +
- "a non-existent source: " + aMigratorKey);
- }
- migratorKey = aMigratorKey;
- skipSourcePage = true;
- }
- else {
- let defaultBrowserKey = getMigratorKeyForDefaultBrowser();
- if (defaultBrowserKey) {
- migrator = this.getMigrator(defaultBrowserKey);
- if (migrator)
- migratorKey = defaultBrowserKey;
- }
- }
-
- if (!migrator) {
- // If there's no migrator set so far, ensure that there is at least one
- // migrator available before opening the wizard.
- try {
- this.migrators.next();
- }
- catch(ex) {
- this.finishMigration();
- if (!(ex instanceof StopIteration))
- throw ex;
- return;
- }
- }
-
- let params = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
- let keyCSTR = Cc["@mozilla.org/supports-cstring;1"].
- createInstance(Ci.nsISupportsCString);
- keyCSTR.data = migratorKey;
- let skipImportSourcePageBool = Cc["@mozilla.org/supports-PRBool;1"].
- createInstance(Ci.nsISupportsPRBool);
- skipImportSourcePageBool.data = skipSourcePage;
- let profileToMigrate = null;
- if (aProfileToMigrate) {
- profileToMigrate = Cc["@mozilla.org/supports-string;1"].
- createInstance(Ci.nsISupportsString);
- profileToMigrate.data = aProfileToMigrate;
- }
- params.appendElement(keyCSTR, false);
- params.appendElement(migrator, false);
- params.appendElement(aProfileStartup, false);
- params.appendElement(skipImportSourcePageBool, false);
- params.appendElement(profileToMigrate, false);
-
- this.showMigrationWizard(null, params);
- },
-
- /**
- * Cleans up references to migrators and nsIProfileInstance instances.
- */
- finishMigration: function MU_finishMigration() {
- gMigrators = null;
- gProfileStartup = null;
- gMigrationBundle = null;
- }
-});
diff --git a/application/palemoon/components/migration/ProfileMigrator.js b/application/palemoon/components/migration/ProfileMigrator.js
deleted file mode 100644
index f67823bae7..0000000000
--- a/application/palemoon/components/migration/ProfileMigrator.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-Components.utils.import("resource:///modules/MigrationUtils.jsm");
-
-function ProfileMigrator() {
-}
-
-ProfileMigrator.prototype = {
- migrate: MigrationUtils.startupMigration.bind(MigrationUtils),
- QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIProfileMigrator]),
- classDescription: "Profile Migrator",
- contractID: "@mozilla.org/toolkit/profile-migrator;1",
- classID: Components.ID("6F8BB968-C14F-4D6F-9733-6C6737B35DCE")
-};
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ProfileMigrator]);
diff --git a/application/palemoon/components/migration/SafariProfileMigrator.js b/application/palemoon/components/migration/SafariProfileMigrator.js
deleted file mode 100644
index 70804793d9..0000000000
--- a/application/palemoon/components/migration/SafariProfileMigrator.js
+++ /dev/null
@@ -1,416 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-let Cc = Components.classes;
-let Ci = Components.interfaces;
-let Cu = Components.utils;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/FileUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource:///modules/MigrationUtils.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "PropertyListUtils",
- "resource://gre/modules/PropertyListUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
- "resource://gre/modules/PlacesUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
- "resource://gre/modules/NetUtil.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "FormHistory",
- "resource://gre/modules/FormHistory.jsm");
-
-function Bookmarks(aBookmarksFile) {
- this._file = aBookmarksFile;
-}
-Bookmarks.prototype = {
- type: MigrationUtils.resourceTypes.BOOKMARKS,
-
- migrate: function B_migrate(aCallback) {
- PropertyListUtils.read(this._file,
- MigrationUtils.wrapMigrateFunction(function migrateBookmarks(aDict) {
- if (!aDict)
- throw new Error("Could not read Bookmarks.plist");
-
- let children = aDict.get("Children");;
- if (!children)
- throw new Error("Invalid Bookmarks.plist format");
-
- PlacesUtils.bookmarks.runInBatchMode({
- runBatched: function() {
- let collection = aDict.get("Title") == "com.apple.ReadingList" ?
- this.READING_LIST_COLLECTION : this.ROOT_COLLECTION;
- this._migrateCollection(children, collection);
- }.bind(this)
- }, null);
- }.bind(this), aCallback));
- },
-
- // Bookmarks collections in Safari. Constants for migrateCollection.
- ROOT_COLLECTION: 0,
- MENU_COLLECTION: 1,
- TOOLBAR_COLLECTION: 2,
- READING_LIST_COLLECTION: 3,
-
- /**
- * Recursively migrate a Safari collection of bookmarks.
- *
- * @param aEntries
- * the collection's children
- * @param aCollection
- * one of the values above.
- */
- _migrateCollection: function B__migrateCollection(aEntries, aCollection) {
- // A collection of bookmarks in Safari resembles places roots. In the
- // property list files (Bookmarks.plist, ReadingList.plist) they are
- // stored as regular bookmarks folders, and thus can only be distinguished
- // from by their names and places in the hierarchy.
-
- let entriesFiltered = [];
- if (aCollection == this.ROOT_COLLECTION) {
- for (let entry of aEntries) {
- let type = entry.get("WebBookmarkType");
- if (type == "WebBookmarkTypeList" && entry.has("Children")) {
- let title = entry.get("Title");
- let children = entry.get("Children");
- if (title == "BookmarksBar")
- this._migrateCollection(children, this.TOOLBAR_COLLECTION);
- else if (title == "BookmarksMenu")
- this._migrateCollection(children, this.MENU_COLLECTION);
- else if (title == "com.apple.ReadingList")
- this._migrateCollection(children, this.READING_LIST_COLLECTION);
- else if (entry.get("ShouldOmitFromUI") !== true)
- entriesFiltered.push(entry);
- }
- else if (type == "WebBookmarkTypeLeaf") {
- entriesFiltered.push(entry);
- }
- }
- }
- else {
- entriesFiltered = aEntries;
- }
-
- if (entriesFiltered.length == 0)
- return;
-
- let folder = -1;
- switch (aCollection) {
- case this.ROOT_COLLECTION: {
- // In Safari, it is possible (though quite cumbersome) to move
- // bookmarks to the bookmarks root, which is the parent folder of
- // all bookmarks "collections". That is somewhat in parallel with
- // both the places root and the unfiled-bookmarks root.
- // Because the former is only an implementation detail in our UI,
- // the unfiled root seems to be the best choice.
- folder = PlacesUtils.unfiledBookmarksFolderId;
- break;
- }
- case this.MENU_COLLECTION: {
- folder = PlacesUtils.bookmarksMenuFolderId;
- if (!MigrationUtils.isStartupMigration) {
- folder = MigrationUtils.createImportedBookmarksFolder("Safari",
- folder);
- }
- break;
- }
- case this.TOOLBAR_COLLECTION: {
- folder = PlacesUtils.toolbarFolderId;
- if (!MigrationUtils.isStartupMigration) {
- folder = MigrationUtils.createImportedBookmarksFolder("Safari",
- folder);
- }
- break;
- }
- case this.READING_LIST_COLLECTION: {
- // Reading list items are imported as regular bookmarks.
- // They are imported under their own folder, created either under the
- // bookmarks menu (in the case of startup migration).
- folder = PlacesUtils.bookmarks.createFolder(
- PlacesUtils.bookmarksMenuFolderId,
- MigrationUtils.getLocalizedString("importedSafariReadingList"),
- PlacesUtils.bookmarks.DEFAULT_INDEX);
- break;
- }
- default:
- throw new Error("Unexpected value for aCollection!");
- }
-
- this._migrateEntries(entriesFiltered, folder);
- },
-
- // migrate the given array of safari bookmarks to the given places
- // folder.
- _migrateEntries: function B__migrateEntries(aEntries, aFolderId) {
- for (let entry of aEntries) {
- let type = entry.get("WebBookmarkType");
- if (type == "WebBookmarkTypeList" && entry.has("Children")) {
- let title = entry.get("Title");
- let folderId = PlacesUtils.bookmarks.createFolder(
- aFolderId, title, PlacesUtils.bookmarks.DEFAULT_INDEX);
-
- // Empty folders may not have a children array.
- if (entry.has("Children"))
- this._migrateEntries(entry.get("Children"), folderId, false);
- }
- else if (type == "WebBookmarkTypeLeaf" && entry.has("URLString")) {
- let title, uri;
- if (entry.has("URIDictionary"))
- title = entry.get("URIDictionary").get("title");
-
- try {
- uri = NetUtil.newURI(entry.get("URLString"));
- }
- catch(ex) {
- Cu.reportError("Invalid uri set for Safari bookmark: " + entry.get("URLString"));
- }
- if (uri) {
- PlacesUtils.bookmarks.insertBookmark(aFolderId, uri,
- PlacesUtils.bookmarks.DEFAULT_INDEX, title);
- }
- }
- }
- }
-};
-
-function History(aHistoryFile) {
- this._file = aHistoryFile;
-}
-History.prototype = {
- type: MigrationUtils.resourceTypes.HISTORY,
-
- // Helper method for converting the visit date property to a PRTime value.
- // The visit date is stored as a string, so it's not read as a Date
- // object by PropertyListUtils.
- _parseCocoaDate: function H___parseCocoaDate(aCocoaDateStr) {
- let asDouble = parseFloat(aCocoaDateStr);
- if (!isNaN(asDouble)) {
- // reference date of NSDate.
- let date = new Date("1 January 2001, GMT");
- date.setMilliseconds(asDouble * 1000);
- return date * 1000;
- }
- return 0;
- },
-
- migrate: function H_migrate(aCallback) {
- PropertyListUtils.read(this._file, function migrateHistory(aDict) {
- try {
- if (!aDict)
- throw new Error("Could not read history property list");
- if (!aDict.has("WebHistoryDates"))
- throw new Error("Unexpected history-property list format");
-
- // Safari's History file contains only top-level urls. It does not
- // distinguish between typed urls and linked urls.
- let transType = PlacesUtils.history.TRANSITION_LINK;
-
- let places = [];
- let entries = aDict.get("WebHistoryDates");
- for (let entry of entries) {
- if (entry.has("lastVisitedDate")) {
- let visitDate = this._parseCocoaDate(entry.get("lastVisitedDate"));
- places.push({ uri: NetUtil.newURI(entry.get("")),
- title: entry.get("title"),
- visits: [{ transitionType: transType,
- visitDate: visitDate }] });
- }
- }
- if (places.length > 0) {
- PlacesUtils.asyncHistory.updatePlaces(places, {
- _success: false,
- handleResult: function() {
- // Importing any entry is considered a successful import.
- this._success = true;
- },
- handleError: function() {},
- handleCompletion: function() {
- aCallback(this._success);
- }
- });
- }
- else {
- aCallback(false);
- }
- }
- catch(ex) {
- Cu.reportError(ex);
- aCallback(false);
- }
- }.bind(this));
- }
-};
-
-/**
- * Safari's preferences property list is independently used for three purposes:
- * (a) importation of preferences
- * (b) importation of search strings
- * (c) retrieving the home page.
- *
- * So, rather than reading it three times, it's cached and managed here.
- */
-function MainPreferencesPropertyList(aPreferencesFile) {
- this._file = aPreferencesFile;
- this._callbacks = [];
-}
-MainPreferencesPropertyList.prototype = {
- /**
- * @see PropertyListUtils.read
- */
- read: function MPPL_read(aCallback) {
- if ("_dict" in this) {
- aCallback(this._dict);
- return;
- }
-
- let alreadyReading = this._callbacks.length > 0;
- this._callbacks.push(aCallback);
- if (!alreadyReading) {
- PropertyListUtils.read(this._file, function readPrefs(aDict) {
- this._dict = aDict;
- for (let callback of this._callbacks) {
- try {
- callback(aDict);
- }
- catch(ex) {
- Cu.reportError(ex);
- }
- }
- this._callbacks.splice(0);
- }.bind(this));
- }
- },
-
- // Workaround for nsIBrowserProfileMigrator.sourceHomePageURL until
- // it's replaced with an async method.
- _readSync: function MPPL__readSync() {
- if ("_dict" in this)
- return this._dict;
-
- let inputStream = Cc["@mozilla.org/network/file-input-stream;1"].
- createInstance(Ci.nsIFileInputStream);
- inputStream.init(this._file, -1, -1, 0);
- let binaryStream = Cc["@mozilla.org/binaryinputstream;1"].
- createInstance(Ci.nsIBinaryInputStream);
- binaryStream.setInputStream(inputStream);
- let bytes = binaryStream.readByteArray(inputStream.available());
- this._dict = PropertyListUtils._readFromArrayBufferSync(
- Uint8Array(bytes).buffer);
- return this._dict;
- }
-};
-
-function SearchStrings(aMainPreferencesPropertyListInstance) {
- this._mainPreferencesPropertyList = aMainPreferencesPropertyListInstance;
-}
-SearchStrings.prototype = {
- type: MigrationUtils.resourceTypes.OTHERDATA,
-
- migrate: function SS_migrate(aCallback) {
- this._mainPreferencesPropertyList.read(MigrationUtils.wrapMigrateFunction(
- function migrateSearchStrings(aDict) {
- if (!aDict)
- throw new Error("Could not get preferences dictionary");
-
- if (aDict.has("RecentSearchStrings")) {
- let recentSearchStrings = aDict.get("RecentSearchStrings");
- if (recentSearchStrings && recentSearchStrings.length > 0) {
- let changes = [{op: "add",
- fieldname: "searchbar-history",
- value: searchString}
- for (searchString of recentSearchStrings)];
- FormHistory.update(changes);
- }
- }
- }.bind(this), aCallback));
- }
-};
-
-function SafariProfileMigrator() {
-}
-
-SafariProfileMigrator.prototype = Object.create(MigratorPrototype);
-
-SafariProfileMigrator.prototype.getResources = function SM_getResources() {
- let profileDir =
-#ifdef XP_MACOSX
- FileUtils.getDir("ULibDir", ["Safari"], false);
-#else
- FileUtils.getDir("AppData", ["Apple Computer", "Safari"], false);
-#endif
- if (!profileDir.exists())
- return null;
-
- let resources = [];
- let pushProfileFileResource = function(aFileName, aConstructor) {
- let file = profileDir.clone();
- file.append(aFileName);
- if (file.exists())
- resources.push(new aConstructor(file));
- };
-
- pushProfileFileResource("History.plist", History);
- pushProfileFileResource("Bookmarks.plist", Bookmarks);
-
- // The Reading List feature was introduced at the same time in Windows and
- // Mac versions of Safari. Not surprisingly, they are stored in the same
- // format in both versions. Surpsingly, only on Windows there is a
- // separate property list for it. This isn't #ifdefed out on mac, because
- // Apple may fix this at some point.
- pushProfileFileResource("ReadingList.plist", Bookmarks);
-
- let prefsDir =
-#ifdef XP_MACOSX
- FileUtils.getDir("UsrPrfs", [], false);
-#else
- FileUtils.getDir("AppData", ["Apple Computer", "Preferences"], false);
-#endif
-
- let prefs = this.mainPreferencesPropertyList;
- if (prefs) {
- resources.push(new SearchStrings(prefs));
- }
-
- return resources;
-};
-
-Object.defineProperty(SafariProfileMigrator.prototype, "mainPreferencesPropertyList", {
- get: function get_mainPreferencesPropertyList() {
- if (this._mainPreferencesPropertyList === undefined) {
- let file =
-#ifdef XP_MACOSX
- FileUtils.getDir("UsrPrfs", [], false);
-#else
- FileUtils.getDir("AppData", ["Apple Computer", "Preferences"], false);
-#endif
- if (file.exists()) {
- file.append("com.apple.Safari.plist");
- if (file.exists()) {
- return this._mainPreferencesPropertyList =
- new MainPreferencesPropertyList(file);
- }
- }
- return this._mainPreferencesPropertyList = null;
- }
- return this._mainPreferencesPropertyList;
- }
-});
-
-Object.defineProperty(SafariProfileMigrator.prototype, "sourceHomePageURL", {
- get: function get_sourceHomePageURL() {
- if (this.mainPreferencesPropertyList) {
- let dict = this.mainPreferencesPropertyList._readSync();
- if (dict.has("HomePage"))
- return dict.get("HomePage");
- }
- return "";
- }
-});
-
-SafariProfileMigrator.prototype.classDescription = "Safari Profile Migrator";
-SafariProfileMigrator.prototype.contractID = "@mozilla.org/profile/migrator;1?app=browser&type=safari";
-SafariProfileMigrator.prototype.classID = Components.ID("{4b609ecf-60b2-4655-9df4-dc149e474da1}");
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SafariProfileMigrator]);
diff --git a/application/palemoon/components/migration/content/migration.js b/application/palemoon/components/migration/content/migration.js
deleted file mode 100644
index 512197b8b5..0000000000
--- a/application/palemoon/components/migration/content/migration.js
+++ /dev/null
@@ -1,474 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
-
-const kIMig = Ci.nsIBrowserProfileMigrator;
-const kIPStartup = Ci.nsIProfileStartup;
-
-Cu.import("resource:///modules/MigrationUtils.jsm");
-
-var MigrationWizard = {
- _source: "", // Source Profile Migrator ContractID suffix
- _itemsFlags: kIMig.ALL, // Selected Import Data Sources (16-bit bitfield)
- _selectedProfile: null, // Selected Profile name to import from
- _wiz: null,
- _migrator: null,
- _autoMigrate: null,
-
- init: function ()
- {
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
- os.addObserver(this, "Migration:Started", false);
- os.addObserver(this, "Migration:ItemBeforeMigrate", false);
- os.addObserver(this, "Migration:ItemAfterMigrate", false);
- os.addObserver(this, "Migration:ItemError", false);
- os.addObserver(this, "Migration:Ended", false);
-
- this._wiz = document.documentElement;
-
- if ("arguments" in window && window.arguments.length > 1) {
- this._source = window.arguments[0];
- this._migrator = window.arguments[1] instanceof kIMig ?
- window.arguments[1] : null;
- this._autoMigrate = window.arguments[2].QueryInterface(kIPStartup);
- this._skipImportSourcePage = window.arguments[3];
- if (this._migrator && window.arguments[4]) {
- let sourceProfiles = this._migrator.sourceProfiles;
- this._selectedProfile = sourceProfiles.find(profile => profile.id == window.arguments[4]);
- }
-
- if (this._autoMigrate) {
- // Show the "nothing" option in the automigrate case to provide an
- // easily identifiable way to avoid migration and create a new profile.
- var nothing = document.getElementById("nothing");
- nothing.hidden = false;
- }
- }
-
- this.onImportSourcePageShow();
- },
-
- uninit: function ()
- {
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
- os.removeObserver(this, "Migration:Started");
- os.removeObserver(this, "Migration:ItemBeforeMigrate");
- os.removeObserver(this, "Migration:ItemAfterMigrate");
- os.removeObserver(this, "Migration:ItemError");
- os.removeObserver(this, "Migration:Ended");
- MigrationUtils.finishMigration();
- },
-
- // 1 - Import Source
- onImportSourcePageShow: function ()
- {
- this._wiz.canRewind = false;
-
- var selectedMigrator = null;
-
- // Figure out what source apps are are available to import from:
- var group = document.getElementById("importSourceGroup");
- for (var i = 0; i < group.childNodes.length; ++i) {
- var migratorKey = group.childNodes[i].id;
- if (migratorKey != "nothing") {
- var migrator = MigrationUtils.getMigrator(migratorKey);
- if (migrator) {
- // Save this as the first selectable item, if we don't already have
- // one, or if it is the migrator that was passed to us.
- if (!selectedMigrator || this._source == migratorKey)
- selectedMigrator = group.childNodes[i];
- } else {
- // Hide this option
- group.childNodes[i].hidden = true;
- }
- }
- }
-
- if (selectedMigrator)
- group.selectedItem = selectedMigrator;
- else {
- // We didn't find a migrator, notify the user
- document.getElementById("noSources").hidden = false;
-
- this._wiz.canAdvance = false;
-
- document.getElementById("importBookmarks").hidden = true;
- document.getElementById("importAll").hidden = true;
- }
-
- // Advance to the next page if the caller told us to.
- if (this._migrator && this._skipImportSourcePage) {
- this._wiz.advance();
- this._wiz.canRewind = false;
- }
- },
-
- onImportSourcePageAdvanced: function ()
- {
- var newSource = document.getElementById("importSourceGroup").selectedItem.id;
-
- if (newSource == "nothing") {
- document.documentElement.cancel();
- return false;
- }
-
- if (!this._migrator || (newSource != this._source)) {
- // Create the migrator for the selected source.
- this._migrator = MigrationUtils.getMigrator(newSource);
-
- this._itemsFlags = kIMig.ALL;
- this._selectedProfile = null;
- }
- this._source = newSource;
-
- // check for more than one source profile
- var sourceProfiles = this._migrator.sourceProfiles;
- if (this._skipImportSourcePage) {
- this._wiz.currentPage.next = "homePageImport";
- }
- else if (sourceProfiles && sourceProfiles.length > 1) {
- this._wiz.currentPage.next = "selectProfile";
- }
- else {
- if (this._autoMigrate)
- this._wiz.currentPage.next = "homePageImport";
- else
- this._wiz.currentPage.next = "importItems";
-
- if (sourceProfiles && sourceProfiles.length == 1)
- this._selectedProfile = sourceProfiles[0];
- else
- this._selectedProfile = null;
- }
- },
-
- // 2 - [Profile Selection]
- onSelectProfilePageShow: function ()
- {
- // Disabling this for now, since we ask about import sources in automigration
- // too and don't want to disable the back button
- // if (this._autoMigrate)
- // document.documentElement.getButton("back").disabled = true;
-
- var profiles = document.getElementById("profiles");
- while (profiles.hasChildNodes())
- profiles.removeChild(profiles.firstChild);
-
- // Note that this block is still reached even if the user chose 'From File'
- // and we canceled the dialog. When that happens, _migrator will be null.
- if (this._migrator) {
- var sourceProfiles = this._migrator.sourceProfiles;
-
- for (let profile of sourceProfiles) {
- var item = document.createElement("radio");
- item.id = profile.id;
- item.setAttribute("label", profile.name);
- profiles.appendChild(item);
- }
- }
-
- profiles.selectedItem = this._selectedProfile ? document.getElementById(this._selectedProfile.id) : profiles.firstChild;
- },
-
- onSelectProfilePageRewound: function ()
- {
- var profiles = document.getElementById("profiles");
- this._selectedProfile = this._migrator.sourceProfiles.find(
- profile => profile.id == profiles.selectedItem.id
- ) || null;
- },
-
- onSelectProfilePageAdvanced: function ()
- {
- var profiles = document.getElementById("profiles");
- this._selectedProfile = this._migrator.sourceProfiles.find(
- profile => profile.id == profiles.selectedItem.id
- ) || null;
-
- // If we're automigrating or just doing bookmarks don't show the item selection page
- if (this._autoMigrate)
- this._wiz.currentPage.next = "homePageImport";
- },
-
- // 3 - ImportItems
- onImportItemsPageShow: function ()
- {
- var dataSources = document.getElementById("dataSources");
- while (dataSources.hasChildNodes())
- dataSources.removeChild(dataSources.firstChild);
-
- var items = this._migrator.getMigrateData(this._selectedProfile, this._autoMigrate);
- for (var i = 0; i < 16; ++i) {
- var itemID = (items >> i) & 0x1 ? Math.pow(2, i) : 0;
- if (itemID > 0) {
- var checkbox = document.createElement("checkbox");
- checkbox.id = itemID;
- checkbox.setAttribute("label",
- MigrationUtils.getLocalizedString(itemID + "_" + this._source));
- dataSources.appendChild(checkbox);
- if (!this._itemsFlags || this._itemsFlags & itemID)
- checkbox.checked = true;
- }
- }
- },
-
- onImportItemsPageRewound: function ()
- {
- this._wiz.canAdvance = true;
- this.onImportItemsPageAdvanced();
- },
-
- onImportItemsPageAdvanced: function ()
- {
- var dataSources = document.getElementById("dataSources");
- this._itemsFlags = 0;
- for (var i = 0; i < dataSources.childNodes.length; ++i) {
- var checkbox = dataSources.childNodes[i];
- if (checkbox.localName == "checkbox" && checkbox.checked)
- this._itemsFlags |= parseInt(checkbox.id);
- }
- },
-
- onImportItemCommand: function (aEvent)
- {
- var items = document.getElementById("dataSources");
- var checkboxes = items.getElementsByTagName("checkbox");
-
- var oneChecked = false;
- for (var i = 0; i < checkboxes.length; ++i) {
- if (checkboxes[i].checked) {
- oneChecked = true;
- break;
- }
- }
-
- this._wiz.canAdvance = oneChecked;
- },
-
- // 4 - Home Page Selection
- onHomePageMigrationPageShow: function ()
- {
- // only want this on the first run
- if (!this._autoMigrate) {
- this._wiz.advance();
- return;
- }
-
- var brandBundle = document.getElementById("brandBundle");
- // These strings don't exist when not using official branding. If that's
- // the case, just skip this page.
- try {
- var pageTitle = brandBundle.getString("homePageMigrationPageTitle");
- var pageDesc = brandBundle.getString("homePageMigrationDescription");
- var mainStr = brandBundle.getString("homePageSingleStartMain");
- }
- catch (e) {
- this._wiz.advance();
- return;
- }
-
- document.getElementById("homePageImport").setAttribute("label", pageTitle);
- document.getElementById("homePageImportDesc").setAttribute("value", pageDesc);
-
- this._wiz._adjustWizardHeader();
-
- var singleStart = document.getElementById("homePageSingleStart");
- singleStart.setAttribute("label", mainStr);
- singleStart.setAttribute("value", "DEFAULT");
-
- var source = null;
- switch (this._source) {
- case "ie":
- source = "sourceNameIE";
- break;
- case "safari":
- source = "sourceNameSafari";
- break;
- case "chrome":
- source = "sourceNameChrome";
- break;
- case "firefox":
- source = "sourceNameFirefox";
- break;
- }
-
- // semi-wallpaper for crash when multiple profiles exist, since we haven't initialized mSourceProfile in places
- this._migrator.getMigrateData(this._selectedProfile, this._autoMigrate);
-
- var oldHomePageURL = this._migrator.sourceHomePageURL;
-
- if (oldHomePageURL && source) {
- var appName = MigrationUtils.getLocalizedString(source);
- var oldHomePageLabel =
- brandBundle.getFormattedString("homePageImport", [appName]);
- var oldHomePage = document.getElementById("oldHomePage");
- oldHomePage.setAttribute("label", oldHomePageLabel);
- oldHomePage.setAttribute("value", oldHomePageURL);
- oldHomePage.removeAttribute("hidden");
- }
- else {
- // if we don't have at least two options, just advance
- this._wiz.advance();
- }
- },
-
- onHomePageMigrationPageAdvanced: function ()
- {
- // we might not have a selectedItem if we're in fallback mode
- try {
- var radioGroup = document.getElementById("homePageRadiogroup");
-
- this._newHomePage = radioGroup.selectedItem.value;
- } catch(ex) {}
- },
-
- // 5 - Migrating
- onMigratingPageShow: function ()
- {
- this._wiz.getButton("cancel").disabled = true;
- this._wiz.canRewind = false;
- this._wiz.canAdvance = false;
-
- // When automigrating, show all of the data that can be received from this source.
- if (this._autoMigrate)
- this._itemsFlags = this._migrator.getMigrateData(this._selectedProfile, this._autoMigrate);
-
- this._listItems("migratingItems");
- setTimeout(this.onMigratingMigrate, 0, this);
- },
-
- onMigratingMigrate: function (aOuter)
- {
- aOuter._migrator.migrate(aOuter._itemsFlags, aOuter._autoMigrate, aOuter._selectedProfile);
- },
-
- _listItems: function (aID)
- {
- var items = document.getElementById(aID);
- while (items.hasChildNodes())
- items.removeChild(items.firstChild);
-
- var brandBundle = document.getElementById("brandBundle");
- var itemID;
- for (var i = 0; i < 16; ++i) {
- var itemID = (this._itemsFlags >> i) & 0x1 ? Math.pow(2, i) : 0;
- if (itemID > 0) {
- var label = document.createElement("label");
- label.id = itemID + "_migrated";
- try {
- label.setAttribute("value",
- MigrationUtils.getLocalizedString(itemID + "_" + this._source));
- items.appendChild(label);
- }
- catch (e) {
- // if the block above throws, we've enumerated all the import data types we
- // currently support and are now just wasting time, break.
- break;
- }
- }
- }
- },
-
- observe: function (aSubject, aTopic, aData)
- {
- switch (aTopic) {
- case "Migration:Started":
- break;
- case "Migration:ItemBeforeMigrate":
- var label = document.getElementById(aData + "_migrated");
- if (label)
- label.setAttribute("style", "font-weight: bold");
- break;
- case "Migration:ItemAfterMigrate":
- var label = document.getElementById(aData + "_migrated");
- if (label)
- label.removeAttribute("style");
- break;
- case "Migration:Ended":
- if (this._autoMigrate) {
- if (this._newHomePage) {
- try {
- // set homepage properly
- var prefSvc = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefService);
- var prefBranch = prefSvc.getBranch(null);
-
- if (this._newHomePage == "DEFAULT") {
- prefBranch.clearUserPref("browser.startup.homepage");
- }
- else {
- var str = Components.classes["@mozilla.org/supports-string;1"]
- .createInstance(Components.interfaces.nsISupportsString);
- str.data = this._newHomePage;
- prefBranch.setComplexValue("browser.startup.homepage",
- Components.interfaces.nsISupportsString,
- str);
- }
-
- var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
- .getService(Components.interfaces.nsIProperties);
- var prefFile = dirSvc.get("ProfDS", Components.interfaces.nsIFile);
- prefFile.append("prefs.js");
- prefSvc.savePrefFile(prefFile);
- } catch(ex) {
- dump(ex);
- }
- }
-
- // We're done now.
- this._wiz.canAdvance = true;
- this._wiz.advance();
-
- setTimeout(close, 5000);
- }
- else {
- this._wiz.canAdvance = true;
- var nextButton = this._wiz.getButton("next");
- nextButton.click();
- }
- break;
- case "Migration:ItemError":
- var type = "undefined";
- switch (parseInt(aData)) {
- case Ci.nsIBrowserProfileMigrator.SETTINGS:
- type = "settings";
- break;
- case Ci.nsIBrowserProfileMigrator.COOKIES:
- type = "cookies";
- break;
- case Ci.nsIBrowserProfileMigrator.HISTORY:
- type = "history";
- break;
- case Ci.nsIBrowserProfileMigrator.FORMDATA:
- type = "form data";
- break;
- case Ci.nsIBrowserProfileMigrator.PASSWORDS:
- type = "passwords";
- break;
- case Ci.nsIBrowserProfileMigrator.BOOKMARKS:
- type = "bookmarks";
- break;
- case Ci.nsIBrowserProfileMigrator.OTHERDATA:
- type = "misc. data";
- break;
- }
- Cc["@mozilla.org/consoleservice;1"]
- .getService(Ci.nsIConsoleService)
- .logStringMessage("some " + type + " did not successfully migrate.");
- break;
- }
- },
-
- onDonePageShow: function ()
- {
- this._wiz.getButton("cancel").disabled = true;
- this._wiz.canRewind = false;
- this._listItems("doneItems");
- }
-};
diff --git a/application/palemoon/components/migration/content/migration.xul b/application/palemoon/components/migration/content/migration.xul
deleted file mode 100644
index 2c8df7b3ea..0000000000
--- a/application/palemoon/components/migration/content/migration.xul
+++ /dev/null
@@ -1,96 +0,0 @@
-<?xml version="1.0"?>
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-
-<!DOCTYPE dialog SYSTEM "chrome://browser/locale/migration/migration.dtd" >
-
-<wizard id="migrationWizard"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
- windowtype="Browser:MigrationWizard"
- title="&migrationWizard.title;"
- onload="MigrationWizard.init()"
- onunload="MigrationWizard.uninit()"
- style="width: 40em;"
- buttons="accept,cancel"
- branded="true">
-
- <script type="application/javascript" src="chrome://browser/content/migration/migration.js"/>
-
- <stringbundle id="brandBundle" src="chrome://branding/locale/brand.properties"/>
-
- <wizardpage id="importSource" pageid="importSource" next="selectProfile"
- label="&importSource.title;"
- onpageadvanced="return MigrationWizard.onImportSourcePageAdvanced();">
- <description id="importAll" control="importSourceGroup">&importFrom.label;</description>
- <description id="importBookmarks" control="importSourceGroup" hidden="true">&importFromBookmarks.label;</description>
-
- <radiogroup id="importSourceGroup" align="start">
- <radio id="firefox" label="&importFromFirefox.label;" accesskey="&importFromFirefox.accesskey;"/>
-#ifdef XP_WIN
- <radio id="ie" label="&importFromIE.label;" accesskey="&importFromIE.accesskey;"/>
- <radio id="chrome" label="&importFromChrome.label;" accesskey="&importFromChrome.accesskey;"/>
- <radio id="safari" label="&importFromSafari.label;" accesskey="&importFromSafari.accesskey;"/>
-#elifdef XP_MACOSX
- <radio id="safari" label="&importFromSafari.label;" accesskey="&importFromSafari.accesskey;"/>
- <radio id="chrome" label="&importFromChrome.label;" accesskey="&importFromChrome.accesskey;"/>
-#elifdef XP_UNIX
- <radio id="chrome" label="&importFromChrome.label;" accesskey="&importFromChrome.accesskey;"/>
-#endif
- <radio id="nothing" label="&importFromNothing.label;" accesskey="&importFromNothing.accesskey;" hidden="true"/>
- </radiogroup>
- <label id="noSources" hidden="true">&noMigrationSources.label;</label>
- </wizardpage>
-
- <wizardpage id="selectProfile" pageid="selectProfile" label="&selectProfile.title;"
- next="importItems"
- onpageshow="return MigrationWizard.onSelectProfilePageShow();"
- onpagerewound="return MigrationWizard.onSelectProfilePageRewound();"
- onpageadvanced="return MigrationWizard.onSelectProfilePageAdvanced();">
- <description control="profiles">&selectProfile.label;</description>
-
- <radiogroup id="profiles" align="left"/>
- </wizardpage>
-
- <wizardpage id="importItems" pageid="importItems" label="&importItems.title;"
- next="homePageImport"
- onpageshow="return MigrationWizard.onImportItemsPageShow();"
- onpagerewound="return MigrationWizard.onImportItemsPageRewound();"
- onpageadvanced="return MigrationWizard.onImportItemsPageAdvanced();"
- oncommand="MigrationWizard.onImportItemCommand();">
- <description control="dataSources">&importItems.label;</description>
-
- <vbox id="dataSources" style="overflow: auto; -moz-appearance: listbox" align="left" flex="1" role="group"/>
- </wizardpage>
-
- <wizardpage id="homePageImport" pageid="homePageImport"
- next="migrating"
- onpageshow="return MigrationWizard.onHomePageMigrationPageShow();"
- onpageadvanced="return MigrationWizard.onHomePageMigrationPageAdvanced();">
-
- <description id="homePageImportDesc" control="homePageRadioGroup"/>
- <radiogroup id="homePageRadiogroup">
- <radio id="homePageSingleStart" selected="true" />
- <radio id="oldHomePage" hidden="true" />
- </radiogroup>
- </wizardpage>
-
- <wizardpage id="migrating" pageid="migrating" label="&migrating.title;"
- next="done"
- onpageshow="MigrationWizard.onMigratingPageShow();">
- <description control="migratingItems">&migrating.label;</description>
-
- <vbox id="migratingItems" style="overflow: auto;" align="left" role="group"/>
- </wizardpage>
-
- <wizardpage id="done" pageid="done" label="&done.title;"
- onpageshow="MigrationWizard.onDonePageShow();">
- <description control="doneItems">&done.label;</description>
-
- <vbox id="doneItems" style="overflow: auto;" align="left" role="group"/>
- </wizardpage>
-
-</wizard>
-
diff --git a/application/palemoon/components/migration/jar.mn b/application/palemoon/components/migration/jar.mn
deleted file mode 100644
index b369ee1dcd..0000000000
--- a/application/palemoon/components/migration/jar.mn
+++ /dev/null
@@ -1,7 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-browser.jar:
-* content/browser/migration/migration.xul (content/migration.xul)
- content/browser/migration/migration.js (content/migration.js)
diff --git a/application/palemoon/components/migration/moz.build b/application/palemoon/components/migration/moz.build
deleted file mode 100644
index 4cbf7b8ea2..0000000000
--- a/application/palemoon/components/migration/moz.build
+++ /dev/null
@@ -1,53 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-JAR_MANIFESTS += ['jar.mn']
-
-XPIDL_SOURCES += [
- 'nsIBrowserProfileMigrator.idl',
-]
-
-XPIDL_MODULE = 'migration'
-
-if CONFIG['OS_ARCH'] == 'WINNT':
- SOURCES += [
- 'nsIEHistoryEnumerator.cpp',
- ]
-
-EXTRA_COMPONENTS += [
- 'FirefoxProfileMigrator.js',
- 'ProfileMigrator.js',
-]
-
-if CONFIG['OS_ARCH'] == 'WINNT':
- EXTRA_COMPONENTS += [
- 'IEProfileMigrator.js',
- ]
- DEFINES['HAS_IE_MIGRATOR'] = True
-
-EXTRA_PP_COMPONENTS += [
- 'BrowserProfileMigrators.manifest',
- 'ChromeProfileMigrator.js',
-]
-
-if CONFIG['OS_ARCH'] == 'WINNT':
- EXTRA_PP_COMPONENTS += [
- 'SafariProfileMigrator.js',
- ]
- DEFINES['HAS_SAFARI_MIGRATOR'] = True
-
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
- EXTRA_PP_COMPONENTS += [
- 'SafariProfileMigrator.js',
- ]
- DEFINES['HAS_SAFARI_MIGRATOR'] = True
-
-EXTRA_PP_JS_MODULES += [
- 'MigrationUtils.jsm',
-]
-
-FINAL_LIBRARY = 'browsercomps'
-
diff --git a/application/palemoon/components/migration/nsIBrowserProfileMigrator.idl b/application/palemoon/components/migration/nsIBrowserProfileMigrator.idl
deleted file mode 100644
index ebff4628c7..0000000000
--- a/application/palemoon/components/migration/nsIBrowserProfileMigrator.idl
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsISupports.idl"
-
-interface nsIArray;
-interface nsIProfileStartup;
-
-[scriptable, uuid(30e5a7ec-f71e-4f41-9dbd-7429c02132ec)]
-interface nsIBrowserProfileMigrator : nsISupports
-{
- /**
- * profile items to migrate. use with migrate().
- */
- const unsigned short ALL = 0x0000;
- const unsigned short SETTINGS = 0x0001;
- const unsigned short COOKIES = 0x0002;
- const unsigned short HISTORY = 0x0004;
- const unsigned short FORMDATA = 0x0008;
- const unsigned short PASSWORDS = 0x0010;
- const unsigned short BOOKMARKS = 0x0020;
- const unsigned short OTHERDATA = 0x0040;
-
- /**
- * Copy user profile information to the current active profile.
- * @param aItems list of data items to migrate. see above for values.
- * @param aStartup helper interface which is non-null if called during startup.
- * @param aProfile profile to migrate from, if there is more than one.
- */
- void migrate(in unsigned short aItems, in nsIProfileStartup aStartup, in jsval aProfile);
-
- /**
- * A bit field containing profile items that this migrator
- * offers for import.
- * @param aProfile the profile that we are looking for available data
- * to import
- * @param aDoingStartup "true" if the profile is not currently being used.
- * @return bit field containing profile items (see above)
- * @note a return value of 0 represents no items rather than ALL.
- */
- unsigned short getMigrateData(in jsval aProfile, in boolean aDoingStartup);
-
- /**
- * Whether or not there is any data that can be imported from this
- * browser (i.e. whether or not it is installed, and there exists
- * a user profile)
- */
- readonly attribute boolean sourceExists;
-
-
- /**
- * An enumeration of available profiles. If the import source does
- * not support profiles, this attribute is null.
- */
- readonly attribute jsval sourceProfiles;
-
- /**
- * The import source homepage. Returns null if not present/available
- */
- readonly attribute AUTF8String sourceHomePageURL;
-};
diff --git a/application/palemoon/components/migration/nsIEHistoryEnumerator.cpp b/application/palemoon/components/migration/nsIEHistoryEnumerator.cpp
deleted file mode 100644
index 7fe31a666e..0000000000
--- a/application/palemoon/components/migration/nsIEHistoryEnumerator.cpp
+++ /dev/null
@@ -1,139 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsIEHistoryEnumerator.h"
-
-#include <urlhist.h>
-#include <shlguid.h>
-
-#include "nsStringAPI.h"
-#include "nsNetUtil.h"
-#include "nsIVariant.h"
-#include "nsCOMArray.h"
-#include "nsArrayEnumerator.h"
-
-namespace {
-
- PRTime FileTimeToPRTime(FILETIME* filetime)
- {
- SYSTEMTIME st;
- ::FileTimeToSystemTime(filetime, &st);
- PRExplodedTime prt;
- prt.tm_year = st.wYear;
- // SYSTEMTIME's day-of-month parameter is 1-based,
- // PRExplodedTime's is 0-based.
- prt.tm_month = st.wMonth - 1;
- prt.tm_mday = st.wDay;
- prt.tm_hour = st.wHour;
- prt.tm_min = st.wMinute;
- prt.tm_sec = st.wSecond;
- prt.tm_usec = st.wMilliseconds * 1000;
- prt.tm_wday = 0;
- prt.tm_yday = 0;
- prt.tm_params.tp_gmt_offset = 0;
- prt.tm_params.tp_dst_offset = 0;
- return PR_ImplodeTime(&prt);
- }
-
-} // Anonymous namespace.
-
-////////////////////////////////////////////////////////////////////////////////
-//// nsIEHistoryEnumerator
-
-NS_IMPL_ISUPPORTS(nsIEHistoryEnumerator, nsISimpleEnumerator)
-
-nsIEHistoryEnumerator::nsIEHistoryEnumerator()
-{
- ::CoInitialize(nullptr);
-}
-
-nsIEHistoryEnumerator::~nsIEHistoryEnumerator()
-{
- ::CoUninitialize();
-}
-
-void
-nsIEHistoryEnumerator::EnsureInitialized()
-{
- if (mURLEnumerator)
- return;
-
- HRESULT hr = ::CoCreateInstance(CLSID_CUrlHistory,
- nullptr,
- CLSCTX_INPROC_SERVER,
- IID_IUrlHistoryStg2,
- getter_AddRefs(mIEHistory));
- if (FAILED(hr))
- return;
-
- hr = mIEHistory->EnumUrls(getter_AddRefs(mURLEnumerator));
- if (FAILED(hr))
- return;
-}
-
-NS_IMETHODIMP
-nsIEHistoryEnumerator::HasMoreElements(bool* _retval)
-{
- *_retval = false;
-
- EnsureInitialized();
- MOZ_ASSERT(mURLEnumerator, "Should have instanced an IE History URLEnumerator");
- if (!mURLEnumerator)
- return NS_OK;
-
- STATURL statURL;
- ULONG fetched;
-
- // First argument is not implemented, so doesn't matter what we pass.
- HRESULT hr = mURLEnumerator->Next(1, &statURL, &fetched);
- if (FAILED(hr) || fetched != 1UL) {
- // Reached the last entry.
- return NS_OK;
- }
-
- nsCOMPtr<nsIURI> uri;
- if (statURL.pwcsUrl) {
- nsDependentString url(statURL.pwcsUrl);
- nsresult rv = NS_NewURI(getter_AddRefs(uri), url);
- ::CoTaskMemFree(statURL.pwcsUrl);
- if (NS_FAILED(rv)) {
- // Got a corrupt or invalid URI, continue to the next entry.
- return HasMoreElements(_retval);
- }
- }
-
- nsDependentString title(statURL.pwcsTitle);
-
- PRTime lastVisited = FileTimeToPRTime(&(statURL.ftLastVisited));
-
- mCachedNextEntry = do_CreateInstance("@mozilla.org/hash-property-bag;1");
- MOZ_ASSERT(mCachedNextEntry, "Should have instanced a new property bag");
- if (mCachedNextEntry) {
- mCachedNextEntry->SetPropertyAsInterface(NS_LITERAL_STRING("uri"), uri);
- mCachedNextEntry->SetPropertyAsAString(NS_LITERAL_STRING("title"), title);
- mCachedNextEntry->SetPropertyAsInt64(NS_LITERAL_STRING("time"), lastVisited);
-
- *_retval = true;
- }
-
- if (statURL.pwcsTitle)
- ::CoTaskMemFree(statURL.pwcsTitle);
-
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsIEHistoryEnumerator::GetNext(nsISupports** _retval)
-{
- *_retval = nullptr;
-
- if (!mCachedNextEntry)
- return NS_ERROR_FAILURE;
-
- NS_ADDREF(*_retval = mCachedNextEntry);
- // Release the cached entry, so it can't be returned twice.
- mCachedNextEntry = nullptr;
-
- return NS_OK;
-}
diff --git a/application/palemoon/components/migration/nsIEHistoryEnumerator.h b/application/palemoon/components/migration/nsIEHistoryEnumerator.h
deleted file mode 100644
index fc14198598..0000000000
--- a/application/palemoon/components/migration/nsIEHistoryEnumerator.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef iehistoryenumerator___h___
-#define iehistoryenumerator___h___
-
-#include <urlhist.h>
-
-#include "mozilla/Attributes.h"
-#include "nsISimpleEnumerator.h"
-#include "nsIWritablePropertyBag2.h"
-#include "nsAutoPtr.h"
-
-class nsIEHistoryEnumerator final : public nsISimpleEnumerator
-{
-public:
- NS_DECL_ISUPPORTS
- NS_DECL_NSISIMPLEENUMERATOR
-
- nsIEHistoryEnumerator();
-
-private:
- ~nsIEHistoryEnumerator();
-
- /**
- * Initializes the history reader, if needed.
- */
- void EnsureInitialized();
-
- nsRefPtr<IUrlHistoryStg2> mIEHistory;
- nsRefPtr<IEnumSTATURL> mURLEnumerator;
-
- nsCOMPtr<nsIWritablePropertyBag2> mCachedNextEntry;
-};
-
-#endif
diff --git a/application/palemoon/components/moz.build b/application/palemoon/components/moz.build
index 1c1098f0a2..6e83936a94 100644
--- a/application/palemoon/components/moz.build
+++ b/application/palemoon/components/moz.build
@@ -17,7 +17,6 @@ DIRS += [
'search',
'sessionstore',
'shell',
- 'migration',
]
if CONFIG['MOZ_BROWSER_STATUSBAR']:
diff --git a/application/palemoon/components/nsBrowserContentHandler.js b/application/palemoon/components/nsBrowserContentHandler.js
index 13ea9da12f..6a75b40f28 100644
--- a/application/palemoon/components/nsBrowserContentHandler.js
+++ b/application/palemoon/components/nsBrowserContentHandler.js
@@ -518,16 +518,16 @@ nsBrowserContentHandler.prototype = {
#endif
},
- helpInfo : " -browser Open a browser window.\n" +
- " -new-window <url> Open <url> in a new window.\n" +
- " -new-tab <url> Open <url> in a new tab.\n" +
- " -private-window <url> Open <url> in a new private window.\n" +
+ helpInfo : " --browser Open a browser window.\n" +
+ " --new-window <url> Open <url> in a new window.\n" +
+ " --new-tab <url> Open <url> in a new tab.\n" +
+ " --private-window <url> Open <url> in a new private window.\n" +
#ifdef XP_WIN
- " -preferences Open Options dialog.\n" +
+ " --preferences Open Options dialog.\n" +
#else
- " -preferences Open Preferences dialog.\n" +
+ " --preferences Open Preferences dialog.\n" +
#endif
- " -search <term> Search <term> with your default search engine.\n",
+ " --search <term> Search <term> with your default search engine.\n",
/* nsIBrowserHandler */
diff --git a/application/palemoon/components/nsBrowserGlue.js b/application/palemoon/components/nsBrowserGlue.js
index 705593b590..6563df4e62 100644
--- a/application/palemoon/components/nsBrowserGlue.js
+++ b/application/palemoon/components/nsBrowserGlue.js
@@ -13,59 +13,34 @@ const XULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "AddonManager",
- "resource://gre/modules/AddonManager.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
- "resource://gre/modules/NetUtil.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "UserAgentOverrides",
- "resource://gre/modules/UserAgentOverrides.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
- "resource://gre/modules/FileUtils.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
- "resource://gre/modules/PlacesUtils.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "BookmarkHTMLUtils",
- "resource://gre/modules/BookmarkHTMLUtils.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "BookmarkJSONUtils",
- "resource://gre/modules/BookmarkJSONUtils.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "PageThumbs",
- "resource://gre/modules/PageThumbs.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "NewTabUtils",
- "resource://gre/modules/NewTabUtils.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "BrowserNewTabPreloader",
- "resource:///modules/BrowserNewTabPreloader.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "webrtcUI",
- "resource:///modules/webrtcUI.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
- "resource://gre/modules/PrivateBrowsingUtils.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "RecentWindow",
- "resource:///modules/RecentWindow.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "Task",
- "resource://gre/modules/Task.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "PlacesBackups",
- "resource://gre/modules/PlacesBackups.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "OS",
- "resource://gre/modules/osfile.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "LoginManagerParent",
- "resource://gre/modules/LoginManagerParent.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "FormValidationHandler",
- "resource:///modules/FormValidationHandler.jsm");
+// Define Lazy Module Gitters
+[
+ ["AddonManager", "resource://gre/modules/AddonManager.jsm"],
+ ["NetUtil", "resource://gre/modules/NetUtil.jsm"],
+ ["UserAgentOverrides", "resource://gre/modules/UserAgentOverrides.jsm"],
+ ["FileUtils", "resource://gre/modules/FileUtils.jsm"],
+ ["PlacesUtils", "resource://gre/modules/PlacesUtils.jsm"],
+ ["BookmarkHTMLUtils", "resource://gre/modules/BookmarkHTMLUtils.jsm"],
+ ["BookmarkJSONUtils", "resource://gre/modules/BookmarkJSONUtils.jsm"],
+ ["PageThumbs", "resource://gre/modules/PageThumbs.jsm"],
+ ["NewTabUtils", "resource://gre/modules/NewTabUtils.jsm"],
+ ["BrowserNewTabPreloader", "resource:///modules/BrowserNewTabPreloader.jsm"],
+#ifdef MOZ_WEBRTC
+ ["webrtcUI", "resource:///modules/webrtcUI.jsm"],
+#endif
+ ["PrivateBrowsingUtils", "resource://gre/modules/PrivateBrowsingUtils.jsm"],
+ ["RecentWindow", "resource:///modules/RecentWindow.jsm"],
+ ["Task", "resource://gre/modules/Task.jsm"],
+ ["PlacesBackups", "resource://gre/modules/PlacesBackups.jsm"],
+ ["OS", "resource://gre/modules/osfile.jsm"],
+ ["LoginManagerParent", "resource://gre/modules/LoginManagerParent.jsm"],
+ ["FormValidationHandler", "resource:///modules/FormValidationHandler.jsm"],
+ ["AutoCompletePopup", "resource:///modules/AutoCompletePopup.jsm"],
+ ["DateTimePickerHelper", "resource://gre/modules/DateTimePickerHelper.jsm"],
+].forEach(([name, resource]) => XPCOMUtils.defineLazyModuleGetter(this, name, resource));
+
+XPCOMUtils.defineLazyServiceGetter(this, "AlertsService",
+ "@mozilla.org/alerts-service;1", "nsIAlertsService");
const PREF_PLUGINS_NOTIFYUSER = "plugins.update.notifyUser";
const PREF_PLUGINS_UPDATEURL = "plugins.update.url";
@@ -197,6 +172,7 @@ BrowserGlue.prototype = {
} catch (e) {
Cu.reportError("Could not end startup crash tracking in quit-application-granted: " + e);
}
+ DateTimePickerHelper.uninit();
break;
#ifdef OBSERVE_LASTWINDOW_CLOSE_TOPICS
case "browser-lastwindow-close-requested":
@@ -284,7 +260,8 @@ BrowserGlue.prototype = {
if (!linkHandled.data) {
let win = this.getMostRecentBrowserWindow();
if (win) {
- win.openUILinkIn(data, "tab");
+ data = JSON.parse(data);
+ win.openUILinkIn(data.href, "tab");
linkHandled.data = true;
}
}
@@ -427,16 +404,15 @@ BrowserGlue.prototype = {
PageThumbs.init();
NewTabUtils.init();
BrowserNewTabPreloader.init();
+#ifdef MOZ_WEBRTC
webrtcUI.init();
+#endif
FormValidationHandler.init();
+ AutoCompletePopup.init();
+
LoginManagerParent.init();
- // Make sure conflicting MSE prefs don't coexist
- if (Services.prefs.getBoolPref('media.mediasource.format-reader', true)) {
- Services.prefs.setBoolPref('media.mediasource.webm.enabled', false);
- }
-
Services.obs.notifyObservers(null, "browser-ui-startup-complete", "");
},
@@ -528,6 +504,8 @@ BrowserGlue.prototype = {
}
#endif
+ DateTimePickerHelper.init();
+
this._trackSlowStartup();
},
@@ -539,8 +517,11 @@ BrowserGlue.prototype = {
_onProfileShutdown: function BG__onProfileShutdown() {
BrowserNewTabPreloader.uninit();
UserAgentOverrides.uninit();
+#ifdef MOZ_WEBRTC
webrtcUI.uninit();
+#endif
FormValidationHandler.uninit();
+ AutoCompletePopup.uninit();
this._dispose();
},
@@ -847,16 +828,6 @@ BrowserGlue.prototype = {
if (actions.indexOf("showAlert") == -1)
return;
- let notifier;
- try {
- notifier = Cc["@mozilla.org/alerts-service;1"].
- getService(Ci.nsIAlertsService);
- }
- catch (e) {
- // nsIAlertsService is not available for this platform
- return;
- }
-
let title = getNotifyString({propName: "alertTitle",
stringName: "puAlertTitle",
stringParams: [appName]});
@@ -878,10 +849,11 @@ BrowserGlue.prototype = {
try {
// This will throw NS_ERROR_NOT_AVAILABLE if the notification cannot
// be displayed per the idl.
- notifier.showAlertNotification(null, title, text,
- true, url, clickCallback);
+ AlertsService.showAlertNotification(null, title, text,
+ true, url, clickCallback);
}
catch (e) {
+ Cu.reportError(e);
}
},
@@ -1213,7 +1185,7 @@ BrowserGlue.prototype = {
},
_migrateUI: function BG__migrateUI() {
- const UI_VERSION = 14;
+ const UI_VERSION = 17;
const BROWSER_DOCURL = "chrome://browser/content/browser.xul#";
let currentUIVersion = 0;
try {
@@ -1395,7 +1367,7 @@ BrowserGlue.prototype = {
}
}
- if (currentUIVersion < 14) {
+ if (currentUIVersion < 16) {
// Migrate Sync from pmsync.palemoon.net to pmsync.palemoon.org
try {
let syncURL = Services.prefs.getCharPref("services.sync.clusterURL");
@@ -1408,6 +1380,10 @@ BrowserGlue.prototype = {
}
}
+ if (currentUIVersion < 17) {
+ this._notifyNotificationsUpgrade();
+ }
+
if (this._dirty)
this._dataSource.QueryInterface(Ci.nsIRDFRemoteDataSource).Flush();
@@ -1418,6 +1394,52 @@ BrowserGlue.prototype = {
Services.prefs.setIntPref("browser.migration.version", UI_VERSION);
},
+ _hasExistingNotificationPermission: function BG__hasExistingNotificationPermission() {
+ let enumerator = Services.perms.enumerator;
+ while (enumerator.hasMoreElements()) {
+ let permission = enumerator.getNext().QueryInterface(Ci.nsIPermission);
+ if (permission.type == "desktop-notification") {
+ return true;
+ }
+ }
+ return false;
+ },
+
+ _notifyNotificationsUpgrade: function BG__notifyNotificationsUpgrade() {
+ if (!this._hasExistingNotificationPermission()) {
+ return;
+ }
+ function clickCallback(subject, topic, data) {
+ if (topic != "alertclickcallback")
+ return;
+ let win = RecentWindow.getMostRecentBrowserWindow();
+ win.openUILinkIn(data, "tab");
+ }
+ // Show the application icon for XUL notifications. We assume system-level
+ // notifications will include their own icon.
+ let imageURL = this._hasSystemAlertsService() ? "" :
+ "chrome://branding/content/about-logo.png";
+ let title = gBrowserBundle.GetStringFromName("webNotifications.upgradeTitle");
+ let text = gBrowserBundle.GetStringFromName("webNotifications.upgradeBody");
+ let url = Services.urlFormatter.formatURLPref("browser.push.warning.infoURL");
+
+ try {
+ AlertsService.showAlertNotification(imageURL, title, text,
+ true, url, clickCallback);
+ }
+ catch (e) {
+ Cu.reportError(e);
+ }
+ },
+
+ _hasSystemAlertsService: function() {
+ try {
+ return !!Cc["@mozilla.org/system-alerts-service;1"].getService(
+ Ci.nsIAlertsService);
+ } catch (e) {}
+ return false;
+ },
+
_getPersist: function BG__getPersist(aSource, aProperty) {
var target = this._dataSource.GetTarget(aSource, aProperty, true);
if (target instanceof Ci.nsIRDFLiteral)
@@ -1667,6 +1689,16 @@ ContentPermissionPrompt.prototype = {
return chromeWin;
},
+ _getBrowserForRequest: function (aRequest) {
+ let requestingWindow = aRequest.window.top;
+ // find the requesting browser or iframe
+ let browser = requestingWindow.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShell)
+ .chromeEventHandler;
+ return browser;
+ },
+
/**
* Show a permission prompt.
*
@@ -1831,30 +1863,49 @@ ContentPermissionPrompt.prototype = {
var message = browserBundle.formatStringFromName("webNotifications.showFromSite",
[requestingURI.host], 1);
- var actions = [
- {
- stringId: "webNotifications.showForSession",
- action: Ci.nsIPermissionManager.ALLOW_ACTION,
- expireType: Ci.nsIPermissionManager.EXPIRE_SESSION,
- callback: function() {},
- },
- {
- stringId: "webNotifications.alwaysShow",
- action: Ci.nsIPermissionManager.ALLOW_ACTION,
- expireType: null,
- callback: function() {},
- },
- {
- stringId: "webNotifications.neverShow",
- action: Ci.nsIPermissionManager.DENY_ACTION,
- expireType: null,
- callback: function() {},
- },
- ];
+ var actions;
+
+ var browser = this._getBrowserForRequest(aRequest);
+ // Only show "allow for session" in PB mode, we don't
+ // support "allow for session" in non-PB mode.
+ if (PrivateBrowsingUtils.isBrowserPrivate(browser)) {
+ actions = [
+ {
+ stringId: "webNotifications.showForSession",
+ action: Ci.nsIPermissionManager.ALLOW_ACTION,
+ expireType: Ci.nsIPermissionManager.EXPIRE_SESSION,
+ callback: function() {},
+ },
+ ];
+ } else {
+ actions = [
+ {
+ stringId: "webNotifications.showForSession",
+ action: Ci.nsIPermissionManager.ALLOW_ACTION,
+ expireType: Ci.nsIPermissionManager.EXPIRE_SESSION,
+ callback: function() {},
+ },
+ {
+ stringId: "webNotifications.alwaysShow",
+ action: Ci.nsIPermissionManager.ALLOW_ACTION,
+ expireType: null,
+ callback: function() {},
+ },
+ {
+ stringId: "webNotifications.neverShow",
+ action: Ci.nsIPermissionManager.DENY_ACTION,
+ expireType: null,
+ callback: function() {},
+ },
+ ];
+ }
+ var options = {
+ learnMoreURL: Services.urlFormatter.formatURLPref("browser.push.warning.infoURL"),
+ };
this._showPrompt(aRequest, message, "desktop-notification", actions,
"web-notifications",
- "web-notifications-notification-icon", null);
+ "web-notifications-notification-icon", options);
},
_promptPointerLock: function CPP_promtPointerLock(aRequest, autoAllow) {
@@ -1897,7 +1948,6 @@ ContentPermissionPrompt.prototype = {
},
prompt: function CPP_prompt(request) {
-
// Only allow exactly one permission rquest here.
let types = request.types.QueryInterface(Ci.nsIArray);
if (types.length != 1) {
@@ -1943,15 +1993,15 @@ ContentPermissionPrompt.prototype = {
// Show the prompt.
switch (perm.type) {
- case "geolocation":
- this._promptGeo(request);
- break;
- case "desktop-notification":
- this._promptWebNotifications(request);
- break;
- case "pointerLock":
- this._promptPointerLock(request, autoAllow);
- break;
+ case "geolocation":
+ this._promptGeo(request);
+ break;
+ case "desktop-notification":
+ this._promptWebNotifications(request);
+ break;
+ case "pointerLock":
+ this._promptPointerLock(request, autoAllow);
+ break;
}
},
diff --git a/application/palemoon/components/places/BrowserPlaces.manifest b/application/palemoon/components/places/BrowserPlaces.manifest
deleted file mode 100644
index 3b25f50f44..0000000000
--- a/application/palemoon/components/places/BrowserPlaces.manifest
+++ /dev/null
@@ -1,2 +0,0 @@
-component {6bcb9bde-9018-4443-a071-c32653469597} PlacesProtocolHandler.js
-contract @mozilla.org/network/protocol;1?name=place {6bcb9bde-9018-4443-a071-c32653469597}
diff --git a/application/palemoon/components/places/PlacesProtocolHandler.js b/application/palemoon/components/places/PlacesProtocolHandler.js
deleted file mode 100644
index ebffd2e28c..0000000000
--- a/application/palemoon/components/places/PlacesProtocolHandler.js
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * vim: sw=2 ts=2 sts=2 et
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-
-Components.utils.import("resource://gre/modules/NetUtil.jsm");
-Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-
-const SCHEME = "place";
-const URL = "chrome://browser/content/places/content-ui/controller.xhtml";
-
-function PlacesProtocolHandler() {}
-
-PlacesProtocolHandler.prototype = {
- scheme: SCHEME,
- defaultPort: -1,
- protocolFlags: Ci.nsIProtocolHandler.URI_DANGEROUS_TO_LOAD |
- Ci.nsIProtocolHandler.URI_IS_LOCAL_RESOURCE |
- Ci.nsIProtocolHandler.URI_NORELATIVE |
- Ci.nsIProtocolHandler.URI_NOAUTH,
-
- newURI: function PPH_newURI(aSpec, aOriginCharset, aBaseUri) {
- let uri = Cc["@mozilla.org/network/simple-uri;1"].createInstance(Ci.nsIURI);
- uri.spec = aSpec;
- return uri;
- },
-
- newChannel: function PPH_newChannel(aUri) {
- let chan = NetUtil.newChannel(URL);
- chan.originalURI = aUri;
- return chan;
- },
-
- allowPort: function PPH_allowPort(aPort, aScheme) {
- return false;
- },
-
- QueryInterface: XPCOMUtils.generateQI([
- Ci.nsIProtocolHandler
- ]),
-
- classID: Components.ID("{6bcb9bde-9018-4443-a071-c32653469597}")
-};
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([PlacesProtocolHandler]);
diff --git a/application/palemoon/components/places/content/controller.js b/application/palemoon/components/places/content/controller.js
index 4d3773905f..e2ae2afb04 100644
--- a/application/palemoon/components/places/content/controller.js
+++ b/application/palemoon/components/places/content/controller.js
@@ -1603,7 +1603,7 @@ PlacesController.prototype = {
* the view that the item(s) have been dropped on was not necessarily active.
* Drop functions are passed the view that is being dropped on.
*/
-let PlacesControllerDragHelper = {
+var PlacesControllerDragHelper = {
/**
* DOM Element currently being dragged over
*/
diff --git a/application/palemoon/components/places/content/editBookmarkOverlay.js b/application/palemoon/components/places/content/editBookmarkOverlay.js
index 98bfcccd77..43645cc73b 100644
--- a/application/palemoon/components/places/content/editBookmarkOverlay.js
+++ b/application/palemoon/components/places/content/editBookmarkOverlay.js
@@ -16,6 +16,7 @@ var gEditItemOverlay = {
_itemType: -1,
_readOnly: false,
_hiddenRows: [],
+ _onPanelReady: false,
_observersAdded: false,
_staticFoldersListBuilt: false,
_initialized: false,
@@ -50,6 +51,7 @@ var gEditItemOverlay = {
this._readOnly = aInfo && aInfo.forceReadOnly;
this._titleOverride = aInfo && aInfo.titleOverride ? aInfo.titleOverride
: "";
+ this._onPanelReady = aInfo && aInfo.onPanelReady;
},
_showHideRows: function EIO__showHideRows() {
@@ -219,7 +221,15 @@ var gEditItemOverlay = {
this._observersAdded = true;
}
- this._initialized = true;
+ let focusElement = () => {
+ this._initialized = true;
+ };
+
+ if (this._onPanelReady) {
+ this._onPanelReady(focusElement);
+ } else {
+ focusElement();
+ }
},
/**
@@ -243,11 +253,7 @@ var gEditItemOverlay = {
if (field.value != aValue) {
field.value = aValue;
-
- // clear the undo stack
- var editor = field.editor;
- if (editor)
- editor.transactionManager.clear();
+ this._editorTransactionManagerClear(field);
}
},
@@ -352,6 +358,26 @@ var gEditItemOverlay = {
return document.getElementById("editBMPanel_" + aID);
},
+ _editorTransactionManagerClear: function EIO__editorTransactionManagerClear(aItem) {
+ // Clear the editor's undo stack
+ let transactionManager;
+ try {
+ transactionManager = aItem.editor.transactionManager;
+ } catch (e) {
+ // When retrieving the transaction manager, editor may be null resulting
+ // in a TypeError. Additionally, the transaction manager may not
+ // exist yet, which causes access to it to throw NS_ERROR_FAILURE.
+ // In either event, the transaction manager doesn't exist it, so we
+ // don't need to worry about clearing it.
+ if (!(e instanceof TypeError) && e.result != Cr.NS_ERROR_FAILURE) {
+ throw e;
+ }
+ }
+ if (transactionManager) {
+ transactionManager.clear();
+ }
+ },
+
_getItemStaticTitle: function EIO__getItemStaticTitle() {
if (this._titleOverride)
return this._titleOverride;
@@ -370,11 +396,7 @@ var gEditItemOverlay = {
var namePicker = this._element("namePicker");
namePicker.value = this._getItemStaticTitle();
namePicker.readOnly = this._readOnly;
-
- // clear the undo stack
- var editor = namePicker.editor;
- if (editor)
- editor.transactionManager.clear();
+ this._editorTransactionManagerClear(namePicker);
},
uninitPanel: function EIO_uninitPanel(aHideCollapsibleElements) {
@@ -963,8 +985,7 @@ var gEditItemOverlay = {
var namePicker = this._element("namePicker");
if (namePicker.value != aValue) {
namePicker.value = aValue;
- // clear undo stack
- namePicker.editor.transactionManager.clear();
+ this._editorTransactionManagerClear(namePicker);
}
break;
case "uri":
diff --git a/application/palemoon/components/places/content/places.js b/application/palemoon/components/places/content/places.js
index af254a7fbf..a941938237 100644
--- a/application/palemoon/components/places/content/places.js
+++ b/application/palemoon/components/places/content/places.js
@@ -4,7 +4,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
-Components.utils.import("resource:///modules/MigrationUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Task",
"resource://gre/modules/Task.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "BookmarkJSONUtils",
@@ -335,14 +334,6 @@ var PlacesOrganizer = {
},
/**
- * Show the migration wizard for importing passwords,
- * cookies, history, preferences, and bookmarks.
- */
- importFromBrowser: function PO_importFromBrowser() {
- MigrationUtils.showMigrationWizard(window);
- },
-
- /**
* Open a file-picker and import the selected file into the bookmarks store
*/
importFromFile: function PO_importFromFile() {
@@ -1386,7 +1377,7 @@ var ViewMenu = {
}
}
-let ContentArea = {
+var ContentArea = {
_specialViews: new Map(),
init: function CA_init() {
@@ -1520,7 +1511,7 @@ let ContentArea = {
}
};
-let ContentTree = {
+var ContentTree = {
init: function CT_init() {
this._view = document.getElementById("placeContent");
},
diff --git a/application/palemoon/components/places/content/places.xul b/application/palemoon/components/places/content/places.xul
index ee1f2ff485..92e8a70e9c 100644
--- a/application/palemoon/components/places/content/places.xul
+++ b/application/palemoon/components/places/content/places.xul
@@ -68,8 +68,6 @@
oncommand="PlacesOrganizer.exportBookmarks();"/>
<command id="OrganizerCommand_import"
oncommand="PlacesOrganizer.importFromFile();"/>
- <command id="OrganizerCommand_browserImport"
- oncommand="PlacesOrganizer.importFromBrowser();"/>
<command id="OrganizerCommand_backup"
oncommand="PlacesOrganizer.backupBookmarks();"/>
<command id="OrganizerCommand_restoreFromFile"
@@ -312,11 +310,6 @@
command="OrganizerCommand_export"
label="&exportBookmarksToHTML.label;"
accesskey="&exportBookmarksToHTML.accesskey;"/>
- <menuseparator/>
- <menuitem id="browserImport"
- command="OrganizerCommand_browserImport"
- label="&importOtherBrowser.label;"
- accesskey="&importOtherBrowser.accesskey;"/>
</menupopup>
#ifdef XP_MACOSX
</toolbarbutton>
diff --git a/application/palemoon/components/places/content/treeView.js b/application/palemoon/components/places/content/treeView.js
index c1879aacf1..aba7314700 100644
--- a/application/palemoon/components/places/content/treeView.js
+++ b/application/palemoon/components/places/content/treeView.js
@@ -144,7 +144,12 @@ PlacesTreeView.prototype = {
// A node is removed form the view either if it has no parent or if its
// root-ancestor is not the root node (in which case that's the node
// for which nodeRemoved was called).
- let ancestors = [x for (x of PlacesUtils.nodeAncestors(aNode))];
+ // Tycho: let ancestors = [x for (x of PlacesUtils.nodeAncestors(aNode))];
+ let ancestors = [];
+ for (let x of PlacesUtils.nodeAncestors(aNode)) {
+ ancestors.push(x);
+ }
+
if (ancestors.length == 0 ||
ancestors[ancestors.length - 1] != this._rootNode) {
throw new Error("Removed node passed to _getRowForNode");
diff --git a/application/palemoon/components/places/moz.build b/application/palemoon/components/places/moz.build
index fc69beed92..2e35e19514 100644
--- a/application/palemoon/components/places/moz.build
+++ b/application/palemoon/components/places/moz.build
@@ -6,9 +6,5 @@
JAR_MANIFESTS += ['jar.mn']
-EXTRA_COMPONENTS += [
- 'BrowserPlaces.manifest',
- 'PlacesProtocolHandler.js',
-]
EXTRA_JS_MODULES += [ 'PlacesUIUtils.jsm' ]
diff --git a/application/palemoon/components/preferences/aboutPermissions.js b/application/palemoon/components/preferences/aboutPermissions.js
index 4d803145dd..531bb061fa 100644
--- a/application/palemoon/components/preferences/aboutPermissions.js
+++ b/application/palemoon/components/preferences/aboutPermissions.js
@@ -2,27 +2,35 @@
* 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/. */
-let Ci = Components.interfaces;
-let Cc = Components.classes;
-let Cu = Components.utils;
+"use strict";
+var Ci = Components.interfaces;
+var Cc = Components.classes;
+var Cu = Components.utils;
+
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/PluralForm.jsm");
Cu.import("resource://gre/modules/DownloadUtils.jsm");
Cu.import("resource://gre/modules/AddonManager.jsm");
Cu.import("resource://gre/modules/NetUtil.jsm");
Cu.import("resource://gre/modules/ForgetAboutSite.jsm");
-let gFaviconService = Cc["@mozilla.org/browser/favicon-service;1"].
+XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
+ "resource://gre/modules/PluralForm.jsm");
+
+var gSecMan = Cc["@mozilla.org/scriptsecuritymanager;1"].
+ getService(Ci.nsIScriptSecurityManager);
+
+var gFaviconService = Cc["@mozilla.org/browser/favicon-service;1"].
getService(Ci.nsIFaviconService);
-let gPlacesDatabase = Cc["@mozilla.org/browser/nav-history-service;1"].
+var gPlacesDatabase = Cc["@mozilla.org/browser/nav-history-service;1"].
getService(Ci.nsPIPlacesDatabase).
DBConnection.
clone(true);
-let gSitesStmt = gPlacesDatabase.createAsyncStatement(
- "SELECT get_unreversed_host(rev_host) AS host " +
+var gSitesStmt = gPlacesDatabase.createAsyncStatement(
+ "SELECT url " +
"FROM moz_places " +
"WHERE rev_host > '.' " +
"AND visit_count > 0 " +
@@ -30,12 +38,12 @@ let gSitesStmt = gPlacesDatabase.createAsyncStatement(
"ORDER BY MAX(frecency) DESC " +
"LIMIT :limit");
-let gVisitStmt = gPlacesDatabase.createAsyncStatement(
+var gVisitStmt = gPlacesDatabase.createAsyncStatement(
"SELECT SUM(visit_count) AS count " +
"FROM moz_places " +
"WHERE rev_host = :rev_host");
-let gFlash = {
+var gFlash = {
name: "Shockwave Flash",
betterName: "Adobe Flash",
type: "application/x-shockwave-flash",
@@ -54,14 +62,11 @@ const MASTER_PASSWORD_MESSAGE = "User canceled master password entry";
const TEST_EXACT_PERM_TYPES = ["desktop-notification", "geo", "pointerLock"];
/**
- * Site object represents a single site, uniquely identified by a host.
+ * Site object represents a single site, uniquely identified by a principal.
*/
-function Site(host) {
- this.host = host;
+function Site(principal) {
+ this.principal = principal;
this.listitem = null;
-
- this.httpURI = NetUtil.newURI("http://" + this.host);
- this.httpsURI = NetUtil.newURI("https://" + this.host);
}
Site.prototype = {
@@ -83,16 +88,10 @@ Site.prototype = {
}
}
- // Try to find favicon for both URIs, but always prefer the https favicon.
- gFaviconService.getFaviconURLForPage(this.httpsURI, function(aURI) {
+ // Get the favicon for the origin
+ gFaviconService.getFaviconURLForPage(this.principal.URI, function (aURI) {
if (aURI) {
invokeCallback(aURI);
- } else {
- gFaviconService.getFaviconURLForPage(this.httpURI, function(aURI) {
- if (aURI) {
- invokeCallback(aURI);
- }
- });
}
}.bind(this));
},
@@ -104,7 +103,9 @@ Site.prototype = {
* A function that takes the visit count (a number) as a parameter.
*/
getVisitCount: function Site_getVisitCount(aCallback) {
- let rev_host = this.host.split("").reverse().join("") + ".";
+ // XXX This won't be a very reliable system, as it will count both http: and https: visits
+ // Unfortunately, I don't think that there is a much better way to do it right now.
+ let rev_host = this.principal.URI.host.split("").reverse().join("") + ".";
gVisitStmt.params.rev_host = rev_host;
gVisitStmt.executeAsync({
handleResult: function(aResults) {
@@ -147,9 +148,9 @@ Site.prototype = {
let permissionValue;
if (TEST_EXACT_PERM_TYPES.indexOf(aType) == -1) {
- permissionValue = Services.perms.testPermission(this.httpURI, aType);
+ permissionValue = Services.perms.testPermissionFromPrincipal(this.principal, aType);
} else {
- permissionValue = Services.perms.testExactPermission(this.httpURI, aType);
+ permissionValue = Services.perms.testExactPermissionFromPrincipal(this.principal, aType);
}
aResultObj.value = permissionValue;
@@ -187,9 +188,7 @@ Site.prototype = {
}
}
- // Using httpURI is kind of bogus, but the permission manager stores
- // the permission for the host, so the right thing happens in the end.
- Services.perms.add(this.httpURI, aType, aPerm);
+ Services.perms.addFromPrincipal(this.principal, aType, aPerm);
},
/**
@@ -200,7 +199,7 @@ Site.prototype = {
* e.g. "cookie", "geo", "indexedDB", "popup", "image"
*/
clearPermission: function Site_clearPermission(aType) {
- Services.perms.remove(this.host, aType);
+ Services.perms.removeFromPrincipal(this.principal, aType);
},
/**
@@ -210,11 +209,9 @@ Site.prototype = {
*/
get logins() {
try {
- let httpLogins = Services.logins.findLogins(
- {}, this.httpURI.prePath, "", "");
- let httpsLogins = Services.logins.findLogins(
- {}, this.httpsURI.prePath, "", "");
- return httpLogins.concat(httpsLogins);
+ let logins = Services.logins.findLogins({},
+ this.principal.originNoSuffix, "", "");
+ return logins;
} catch (e) {
if (!e.message.includes(MASTER_PASSWORD_MESSAGE)) {
Cu.reportError("AboutPermissions: " + e);
@@ -227,8 +224,7 @@ Site.prototype = {
// Only say that login saving is blocked if it is blocked for both
// http and https.
try {
- return Services.logins.getLoginSavingEnabled(this.httpURI.prePath) &&
- Services.logins.getLoginSavingEnabled(this.httpsURI.prePath);
+ return Services.logins.getLoginSavingEnabled(this.principal.originNoSuffix);
} catch (e) {
if (!e.message.includes(MASTER_PASSWORD_MESSAGE)) {
Cu.reportError("AboutPermissions: " + e);
@@ -239,8 +235,7 @@ Site.prototype = {
set loginSavingEnabled(isEnabled) {
try {
- Services.logins.setLoginSavingEnabled(this.httpURI.prePath, isEnabled);
- Services.logins.setLoginSavingEnabled(this.httpsURI.prePath, isEnabled);
+ Services.logins.setLoginSavingEnabled(this.principal.originNoSuffix, isEnabled);
} catch (e) {
if (!e.message.includes(MASTER_PASSWORD_MESSAGE)) {
Cu.reportError("AboutPermissions: " + e);
@@ -279,7 +274,11 @@ Site.prototype = {
* Removes all data from the browser corresponding to the site.
*/
forgetSite: function Site_forgetSite() {
- ForgetAboutSite.removeDataFromDomain(this.host)
+ // XXX This removes data for an entire domain, rather than just
+ // an origin. This may produce confusing results, as data will
+ // be cleared for the http:// as well as the https:// domain
+ // if you try to forget the https:// site.
+ ForgetAboutSite.removeDataFromDomain(this.principal.URI.host)
.catch(Cu.reportError);
}
}
@@ -290,7 +289,7 @@ Site.prototype = {
*
* Inspired by pageinfo/permissions.js
*/
-let PermissionDefaults = {
+var PermissionDefaults = {
UNKNOWN: Ci.nsIPermissionManager.UNKNOWN_ACTION, // 0
ALLOW: Ci.nsIPermissionManager.ALLOW_ACTION, // 1
DENY: Ci.nsIPermissionManager.DENY_ACTION, // 2
@@ -449,7 +448,7 @@ let PermissionDefaults = {
/**
* AboutPermissions manages the about:permissions page.
*/
-let AboutPermissions = {
+var AboutPermissions = {
/**
* Maximum number of sites to return from the places database.
*/
@@ -461,10 +460,18 @@ let AboutPermissions = {
LIST_BUILD_DELAY: 100, // delay between intervals
/**
- * Stores a mapping of host strings to Site objects.
+ * Stores a mapping of origin strings to Site objects.
*/
_sites: {},
+ /**
+ * Using a getter for sitesFilter to avoid races with tests.
+ */
+ get sitesFilter () {
+ delete this.sitesFilter;
+ return this.sitesFilter = document.getElementById("sites-filter");
+ },
+
sitesList: null,
_selectedSite: null,
@@ -721,9 +728,9 @@ let AboutPermissions = {
break;
}
let permission = aSubject.QueryInterface(Ci.nsIPermission);
- // We can't compare selectedSite.host and permission.host here because
- // we need to handle the case where a parent domain was changed in
- // a way that affects the subdomain.
+ // We can't compare selectedSite.principal and permission.principal here
+ // because we need to handle the case where a parent domain was changed
+ // in a way that affects the subdomain.
if (this._supportedPermissions.indexOf(permission.type) != -1) {
this.updatePermission(permission.type);
}
@@ -798,8 +805,11 @@ let AboutPermissions = {
AboutPermissions.startSitesListBatch();
let row;
while (row = aResults.getNextRow()) {
- let host = row.getResultByName("host");
- AboutPermissions.addHost(host);
+ let spec = row.getResultByName("url");
+ let uri = NetUtil.newURI(spec);
+ let principal = gSecMan.getNoAppCodebasePrincipal(uri);
+
+ AboutPermissions.addPrincipal(principal);
}
AboutPermissions.endSitesListBatch();
},
@@ -853,7 +863,8 @@ let AboutPermissions = {
// i.e.: "chrome://weave" (Sync)
if (!aLogin.hostname.startsWith(schemeChrome + ":")) {
let uri = NetUtil.newURI(aLogin.hostname);
- this.addHost(uri.host);
+ let principal = gSecMan.getNoAppCodebasePrincipal(uri);
+ this.addPrincipal(principal);
}
} catch (e) {
Cu.reportError("AboutPermissions: " + e);
@@ -869,7 +880,8 @@ let AboutPermissions = {
// i.e.: "chrome://weave" (Sync)
if (!aHostname.startsWith(schemeChrome + ":")) {
let uri = NetUtil.newURI(aHostname);
- this.addHost(uri.host);
+ let principal = gSecMan.getNoAppCodebasePrincipal(uri);
+ this.addPrincipal(principal);
}
} catch (e) {
Cu.reportError("AboutPermissions: " + e);
@@ -887,7 +899,7 @@ let AboutPermissions = {
let permission = enumerator.getNext().QueryInterface(Ci.nsIPermission);
// Only include sites with exceptions set for supported permission types.
if (this._supportedPermissions.indexOf(permission.type) != -1) {
- this.addHost(permission.host);
+ this.addPrincipal(permission.principal);
}
itemCnt++;
}
@@ -898,15 +910,15 @@ let AboutPermissions = {
/**
* Creates a new Site and adds it to _sites if it's not already there.
*
- * @param aHost
- * A host string.
+ * @param aPrincipal
+ * A principal.
*/
- addHost: function(aHost) {
- if (aHost in this._sites) {
+ addPrincipal: function(aPrincipal) {
+ if (aPrincipal.origin in this._sites) {
return;
}
- let site = new Site(aHost);
- this._sites[aHost] = site;
+ let site = new Site(aPrincipal);
+ this._sites[aPrincipal.origin] = site;
this.addToSitesList(site);
},
@@ -919,7 +931,7 @@ let AboutPermissions = {
addToSitesList: function(aSite) {
let item = document.createElement("richlistitem");
item.setAttribute("class", "site");
- item.setAttribute("value", aSite.host);
+ item.setAttribute("value", aSite.principal.origin);
aSite.getFavicon(function(aURL) {
item.setAttribute("favicon", aURL);
@@ -927,9 +939,8 @@ let AboutPermissions = {
aSite.listitem = item;
// Make sure to only display relevant items when list is filtered.
- let filterValue =
- document.getElementById("sites-filter").value.toLowerCase();
- item.collapsed = aSite.host.toLowerCase().indexOf(filterValue) == -1;
+ let filterValue = this.sitesFilter.value.toLowerCase();
+ item.collapsed = aSite.principal.origin.toLowerCase().indexOf(filterValue) == -1;
(this._listFragment || this.sitesList).appendChild(item);
},
@@ -951,8 +962,7 @@ let AboutPermissions = {
*/
filterSitesList: function() {
let siteItems = this.sitesList.children;
- let filterValue =
- document.getElementById("sites-filter").value.toLowerCase();
+ let filterValue = this.sitesFilter.value.toLowerCase();
if (filterValue == "") {
for (let i = 0, iLen = siteItems.length; i < iLen; i++) {
@@ -983,9 +993,9 @@ let AboutPermissions = {
* The host string corresponding to the site to delete.
*/
deleteFromSitesList: function(aHost) {
- for (let host in this._sites) {
- let site = this._sites[host];
- if (site.host.hasRootDomain(aHost)) {
+ for (let origin in this._sites) {
+ let site = this._sites[origin];
+ if (site.principal.URI.host.hasRootDomain(aHost)) {
if (site == this._selectedSite) {
// Replace site-specific interface with "All Sites" interface.
this.sitesList.selectedItem =
@@ -993,7 +1003,7 @@ let AboutPermissions = {
}
this.sitesList.removeChild(site.listitem);
- delete this._sites[site.host];
+ delete this._sites[site.principal.origin];
}
}
},
@@ -1009,9 +1019,9 @@ let AboutPermissions = {
return;
}
- let host = event.target.value;
- let site = this._selectedSite = this._sites[host];
- document.getElementById("site-label").value = host;
+ let origin = event.target.value;
+ let site = this._selectedSite = this._sites[origin];
+ document.getElementById("site-label").value = origin;
document.getElementById("header-deck").selectedPanel =
document.getElementById("site-header");
@@ -1245,19 +1255,19 @@ let AboutPermissions = {
* Opens password manager dialog.
*/
managePasswords: function() {
- let selectedHost = "";
+ let selectedOrigin = "";
if (this._selectedSite) {
- selectedHost = this._selectedSite.host;
+ selectedOrigin = this._selectedSite.principal.URI.prePath;
}
let win = Services.wm.getMostRecentWindow("Toolkit:PasswordManager");
if (win) {
- win.setFilter(selectedHost);
+ win.setFilter(selectedOrigin);
win.focus();
} else {
window.openDialog("chrome://passwordmgr/content/passwordManager.xul",
"Toolkit:PasswordManager", "",
- {filterString : selectedHost});
+ {filterString : selectedOrigin});
}
},
@@ -1313,10 +1323,12 @@ let AboutPermissions = {
* Opens cookie manager dialog.
*/
manageCookies: function() {
+ // Cookies are stored by-host, and thus we filter the cookie window
+ // using only the host of the selected principal's origin
let selectedHost = "";
let selectedDomain = "";
if (this._selectedSite) {
- selectedHost = this._selectedSite.host;
+ selectedHost = this._selectedSite.principal.URI.host;
selectedDomain = this.domainFromHost(selectedHost);
}
@@ -1328,6 +1340,13 @@ let AboutPermissions = {
window.openDialog("chrome://browser/content/preferences/cookies.xul",
"Browser:Cookies", "", {filterString : selectedDomain});
}
+ },
+
+ /**
+ * Focusses the filter box.
+ */
+ focusFilterBox: function() {
+ this.sitesFilter.focus();
}
}
diff --git a/application/palemoon/components/preferences/aboutPermissions.xul b/application/palemoon/components/preferences/aboutPermissions.xul
index bd5a205c7a..c099161f25 100644
--- a/application/palemoon/components/preferences/aboutPermissions.xul
+++ b/application/palemoon/components/preferences/aboutPermissions.xul
@@ -25,6 +25,10 @@
<script type="application/javascript"
src="chrome://browser/content/preferences/aboutPermissions.js"/>
+ <keyset>
+ <key key="&focusSearch.key;" modifiers="accel" oncommand="AboutPermissions.focusFilterBox();"/>
+ </keyset>
+
<hbox flex="1" id="permissions-header">
<label id="permissions-pagetitle">&permissionsManager.title;</label>
</hbox>
@@ -390,7 +394,6 @@
</hbox>
</vbox>
</hbox>
-
</vbox>
</hbox>
diff --git a/application/palemoon/components/preferences/advanced.js b/application/palemoon/components/preferences/advanced.js
index 429a0c419e..0803496fee 100644
--- a/application/palemoon/components/preferences/advanced.js
+++ b/application/palemoon/components/preferences/advanced.js
@@ -8,6 +8,7 @@ Components.utils.import("resource://gre/modules/DownloadUtils.jsm");
Components.utils.import("resource://gre/modules/ctypes.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/LoadContextInfo.jsm");
+Components.utils.import("resource://gre/modules/BrowserUtils.jsm");
var gAdvancedPane = {
_inited: false,
@@ -377,7 +378,7 @@ var gAdvancedPane = {
},
// XXX: duplicated in browser.js
- _getOfflineAppUsage: function (host, groups)
+ _getOfflineAppUsage: function (perm, groups)
{
var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
getService(Components.interfaces.nsIApplicationCacheService);
@@ -390,7 +391,7 @@ var gAdvancedPane = {
var usage = 0;
for (var i = 0; i < groups.length; i++) {
var uri = ios.newURI(groups[i], null, null);
- if (uri.asciiHost == host) {
+ if (perm.matchesURI(uri, true)) {
var cache = cacheService.getActiveCache(groups[i]);
usage += cache.usage;
}
@@ -427,9 +428,9 @@ var gAdvancedPane = {
var row = document.createElement("listitem");
row.id = "";
row.className = "offlineapp";
- row.setAttribute("host", perm.host);
+ row.setAttribute("origin", perm.principal.origin);
var converted = DownloadUtils.
- convertByteUnits(this._getOfflineAppUsage(perm.host, groups));
+ convertByteUnits(this._getOfflineAppUsage(perm, groups));
row.setAttribute("usage",
bundle.getFormattedString("offlineAppUsage",
converted));
@@ -453,7 +454,8 @@ var gAdvancedPane = {
{
var list = document.getElementById("offlineAppsList");
var item = list.selectedItem;
- var host = item.getAttribute("host");
+ var origin = item.getAttribute("origin");
+ var principal = BrowserUtils.principalFromOrigin(origin);
var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
@@ -462,35 +464,34 @@ var gAdvancedPane = {
var bundle = document.getElementById("bundlePreferences");
var title = bundle.getString("offlineAppRemoveTitle");
- var prompt = bundle.getFormattedString("offlineAppRemovePrompt", [host]);
+ var prompt = bundle.getFormattedString("offlineAppRemovePrompt", [principal.URI.prePath]);
var confirm = bundle.getString("offlineAppRemoveConfirm");
var result = prompts.confirmEx(window, title, prompt, flags, confirm,
null, null, null, {});
if (result != 0)
return;
- // clear offline cache entries
- var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
- getService(Components.interfaces.nsIApplicationCacheService);
- var ios = Components.classes["@mozilla.org/network/io-service;1"].
- getService(Components.interfaces.nsIIOService);
- var groups = cacheService.getGroups();
- for (var i = 0; i < groups.length; i++) {
- var uri = ios.newURI(groups[i], null, null);
- if (uri.asciiHost == host) {
+ // get the permission
+ var pm = Components.classes["@mozilla.org/permissionmanager;1"]
+ .getService(Components.interfaces.nsIPermissionManager);
+ var perm = pm.getPermissionObject(principal, "offline-app");
+ if (perm) {
+ // clear offline cache entries
+ try {
+ var cacheService = Components.classes["@mozilla.org/network/application-cache-service;1"].
+ getService(Components.interfaces.nsIApplicationCacheService);
+ var groups = cacheService.getGroups();
+ for (var i = 0; i < groups.length; i++) {
+ var uri = Services.io.newURI(groups[i], null, null);
+ if (perm.matchesURI(uri, true)) {
var cache = cacheService.getActiveCache(groups[i]);
cache.discard();
+ }
}
- }
-
- // remove the permission
- var pm = Components.classes["@mozilla.org/permissionmanager;1"]
- .getService(Components.interfaces.nsIPermissionManager);
- pm.remove(host, "offline-app",
- Components.interfaces.nsIPermissionManager.ALLOW_ACTION);
- pm.remove(host, "offline-app",
- Components.interfaces.nsIOfflineCacheUpdateService.ALLOW_NO_WARN);
+ } catch (e) {}
+ pm.removePermission(perm);
+ }
list.removeChild(item);
gAdvancedPane.offlineAppSelected();
this.updateActualAppCacheSize();
diff --git a/application/palemoon/components/preferences/cookies.js b/application/palemoon/components/preferences/cookies.js
index c0455d679f..4ef30d48e0 100644
--- a/application/palemoon/components/preferences/cookies.js
+++ b/application/palemoon/components/preferences/cookies.js
@@ -5,6 +5,8 @@
const nsICookie = Components.interfaces.nsICookie;
+Components.utils.import("resource://gre/modules/PluralForm.jsm");
+
var gCookiesWindow = {
_cm : Components.classes["@mozilla.org/cookiemanager;1"]
.getService(Components.interfaces.nsICookieManager),
@@ -24,6 +26,11 @@ var gCookiesWindow = {
this._bundle = document.getElementById("bundlePreferences");
this._tree = document.getElementById("cookiesList");
+ let removeAllCookies = document.getElementById("removeAllCookies");
+ removeAllCookies.setAttribute("accesskey", this._bundle.getString("removeAllCookies.accesskey"));
+ let removeSelectedCookies = document.getElementById("removeSelectedCookies");
+ removeSelectedCookies.setAttribute("accesskey", this._bundle.getString("removeSelectedCookies.accesskey"));
+
this._populateList(true);
document.getElementById("filter").focus();
@@ -63,7 +70,9 @@ var gCookiesWindow = {
_cookieEquals: function (aCookieA, aCookieB, aStrippedHost) {
return aCookieA.rawHost == aStrippedHost &&
aCookieA.name == aCookieB.name &&
- aCookieA.path == aCookieB.path;
+ aCookieA.path == aCookieB.path &&
+ ChromeUtils.isOriginAttributesEqual(aCookieA.originAttributes,
+ aCookieB.originAttributes);
},
observe: function (aCookie, aTopic, aData) {
@@ -268,15 +277,19 @@ var gCookiesWindow = {
var item = this._getItemAtIndex(aIndex);
if (!item) return;
this._invalidateCache(aIndex - 1);
- if (item.container)
+ if (item.container) {
gCookiesWindow._hosts[item.rawHost] = null;
- else {
+ } else {
var parent = this._getItemAtIndex(item.parentIndex);
for (var i = 0; i < parent.cookies.length; ++i) {
var cookie = parent.cookies[i];
if (item.rawHost == cookie.rawHost &&
- item.name == cookie.name && item.path == cookie.path)
+ item.name == cookie.name &&
+ item.path == cookie.path &&
+ ChromeUtils.isOriginAttributesEqual(item.originAttributes,
+ cookie.originAttributes)) {
parent.cookies.splice(i, removeCount);
+ }
}
}
},
@@ -451,16 +464,17 @@ var gCookiesWindow = {
_makeCookieObject: function (aStrippedHost, aCookie) {
var host = aCookie.host;
var formattedHost = host.charAt(0) == "." ? host.substring(1, host.length) : host;
- var c = { name : aCookie.name,
- value : aCookie.value,
- isDomain : aCookie.isDomain,
- host : aCookie.host,
- rawHost : aStrippedHost,
- path : aCookie.path,
- isSecure : aCookie.isSecure,
- expires : aCookie.expires,
- level : 1,
- container : false };
+ var c = { name : aCookie.name,
+ value : aCookie.value,
+ isDomain : aCookie.isDomain,
+ host : aCookie.host,
+ rawHost : aStrippedHost,
+ path : aCookie.path,
+ isSecure : aCookie.isSecure,
+ expires : aCookie.expires,
+ level : 1,
+ container : false,
+ originAttributes: aCookie.originAttributes };
return c;
},
@@ -551,12 +565,12 @@ var gCookiesWindow = {
if (item && seln.count == 1 && item.container && item.open)
selectedCookieCount += 2;
- var removeCookie = document.getElementById("removeCookie");
- var removeCookies = document.getElementById("removeCookies");
- removeCookie.parentNode.selectedPanel =
- selectedCookieCount == 1 ? removeCookie : removeCookies;
+ let buttonLabel = this._bundle.getString("removeSelectedCookies.label");
+ let removeSelectedCookies = document.getElementById("removeSelectedCookies");
+ removeSelectedCookies.label = PluralForm.get(selectedCookieCount, buttonLabel)
+ .replace("#1", selectedCookieCount);
- removeCookie.disabled = removeCookies.disabled = !(seln.count > 0);
+ removeSelectedCookies.disabled = !(seln.count > 0);
},
performDeletion: function gCookiesWindow_performDeletion(deleteItems) {
@@ -567,7 +581,8 @@ var gCookiesWindow = {
blockFutureCookies = psvc.getBoolPref("network.cookie.blockFutureCookies");
for (var i = 0; i < deleteItems.length; ++i) {
var item = deleteItems[i];
- this._cm.remove(item.host, item.name, item.path, blockFutureCookies);
+ this._cm.remove(item.host, item.name, item.path,
+ blockFutureCookies, item.originAttributes);
}
},
@@ -717,8 +732,13 @@ var gCookiesWindow = {
},
onCookieKeyPress: function (aEvent) {
- if (aEvent.keyCode == 46)
+ if (aEvent.keyCode == KeyEvent.DOM_VK_DELETE
+#ifdef XP_MACOSX
+ || aEvent.keyCode == KeyEvent.DOM_VK_BACK_SPACE
+#endif
+ ) {
this.deleteCookie();
+ }
},
_lastSortProperty : "",
@@ -860,7 +880,17 @@ var gCookiesWindow = {
},
_updateRemoveAllButton: function gCookiesWindow__updateRemoveAllButton() {
- document.getElementById("removeAllCookies").disabled = this._view._rowCount == 0;
+ let removeAllCookies = document.getElementById("removeAllCookies");
+ removeAllCookies.disabled = this._view._rowCount == 0;
+
+ let labelStringID = "removeAllCookies.label";
+ let accessKeyStringID = "removeAllCookies.accesskey";
+ if (this._view._filtered) {
+ labelStringID = "removeAllShownCookies.label";
+ accessKeyStringID = "removeAllShownCookies.accesskey";
+ }
+ removeAllCookies.setAttribute("label", this._bundle.getString(labelStringID));
+ removeAllCookies.setAttribute("accesskey", this._bundle.getString(accessKeyStringID));
},
filter: function () {
diff --git a/application/palemoon/components/preferences/cookies.xul b/application/palemoon/components/preferences/cookies.xul
index 8ff0d90ec3..60725e9d84 100644
--- a/application/palemoon/components/preferences/cookies.xul
+++ b/application/palemoon/components/preferences/cookies.xul
@@ -91,16 +91,9 @@
</vbox>
<hbox align="end">
<hbox class="actionButtons" flex="1">
- <deck oncommand="gCookiesWindow.deleteCookie();">
- <button id="removeCookie" disabled="true" icon="remove"
- label="&button.removecookie.label;"
- accesskey="&button.removecookie.accesskey;"/>
- <button id="removeCookies" disabled="true" icon="remove"
- label="&button.removecookies.label;"
- accesskey="&button.removecookie.accesskey;"/>
- </deck>
+ <button id="removeSelectedCookies" disabled="true" icon="clear"
+ oncommand="gCookiesWindow.deleteCookie();"/>
<button id="removeAllCookies" disabled="true" icon="clear"
- label="&button.removeallcookies.label;" accesskey="&button.removeallcookies.accesskey;"
oncommand="gCookiesWindow.deleteAllCookies();"/>
<spacer flex="1"/>
#ifndef XP_MACOSX
diff --git a/application/palemoon/components/preferences/handlers.xml b/application/palemoon/components/preferences/handlers.xml
index d607928039..5fb915ceef 100644
--- a/application/palemoon/components/preferences/handlers.xml
+++ b/application/palemoon/components/preferences/handlers.xml
@@ -72,7 +72,7 @@
extends="chrome://global/content/bindings/listbox.xml#listitem">
<content>
<children>
- <xul:listcell xbl:inherits="label=host"/>
+ <xul:listcell xbl:inherits="label=origin"/>
<xul:listcell xbl:inherits="label=usage"/>
</children>
</content>
diff --git a/application/palemoon/components/preferences/jar.mn b/application/palemoon/components/preferences/jar.mn
index a277843051..798a2dae4a 100644
--- a/application/palemoon/components/preferences/jar.mn
+++ b/application/palemoon/components/preferences/jar.mn
@@ -15,7 +15,7 @@ browser.jar:
* content/browser/preferences/applicationManager.js
* content/browser/preferences/colors.xul
* content/browser/preferences/cookies.xul
- content/browser/preferences/cookies.js
+* content/browser/preferences/cookies.js
content/browser/preferences/content.xul
content/browser/preferences/content.js
* content/browser/preferences/connection.xul
@@ -28,8 +28,8 @@ browser.jar:
content/browser/preferences/languages.js
* content/browser/preferences/main.xul
content/browser/preferences/main.js
-* content/browser/preferences/permissions.xul
- content/browser/preferences/permissions.js
+ content/browser/preferences/permissions.xul
+* content/browser/preferences/permissions.js
* content/browser/preferences/preferences.xul
content/browser/preferences/privacy.xul
content/browser/preferences/privacy.js
diff --git a/application/palemoon/components/preferences/permissions.js b/application/palemoon/components/preferences/permissions.js
index 785e26d5e0..4b1bf41b2e 100644
--- a/application/palemoon/components/preferences/permissions.js
+++ b/application/palemoon/components/preferences/permissions.js
@@ -3,38 +3,40 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+Components.utils.import("resource://gre/modules/Services.jsm");
+
const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
const nsICookiePermission = Components.interfaces.nsICookiePermission;
const NOTIFICATION_FLUSH_PERMISSIONS = "flush-pending-permissions";
-function Permission(host, rawHost, type, capability, perm)
+function Permission(principal, type, capability)
{
- this.host = host;
- this.rawHost = rawHost;
+ this.principal = principal;
+ this.origin = principal.origin;
this.type = type;
this.capability = capability;
- this.perm = perm;
}
var gPermissionManager = {
- _type : "",
- _permissions : [],
- _pm : Components.classes["@mozilla.org/permissionmanager;1"]
- .getService(Components.interfaces.nsIPermissionManager),
- _bundle : null,
- _tree : null,
-
+ _type : "",
+ _permissions : [],
+ _permissionsToAdd : new Map(),
+ _permissionsToDelete : new Map(),
+ _bundle : null,
+ _tree : null,
+ _observerRemoved : false,
+
_view: {
_rowCount: 0,
- get rowCount()
- {
- return this._rowCount;
+ get rowCount()
+ {
+ return this._rowCount;
},
getCellText: function (aRow, aColumn)
{
if (aColumn.id == "siteCol")
- return gPermissionManager._permissions[aRow].rawHost;
+ return gPermissionManager._permissions[aRow].origin;
else if (aColumn.id == "statusCol")
return gPermissionManager._permissions[aRow].capability;
return "";
@@ -57,7 +59,7 @@ var gPermissionManager = {
return "";
}
},
-
+
_getCapabilityString: function (aCapability)
{
var stringKey = null;
@@ -77,44 +79,66 @@ var gPermissionManager = {
}
return this._bundle.getString(stringKey);
},
-
+
addPermission: function (aCapability)
{
var textbox = document.getElementById("url");
- var host = textbox.value.replace(/^\s*([-\w]*:\/+)?/, ""); // trim any leading space and scheme
+ var input_url = textbox.value.replace(/^\s*/, ""); // trim any leading space
+ let principal;
try {
- var ioService = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
- var uri = ioService.newURI("http://"+host, null, null);
- host = uri.host;
+ // The origin accessor on the principal object will throw if the
+ // principal doesn't have a canonical origin representation. This will
+ // help catch cases where the URI parser parsed something like
+ // `localhost:8080` as having the scheme `localhost`, rather than being
+ // an invalid URI. A canonical origin representation is required by the
+ // permission manager for storage, so this won't prevent any valid
+ // permissions from being entered by the user.
+ let uri;
+ try {
+ uri = Services.io.newURI(input_url, null, null);
+ principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(uri);
+ // If we have ended up with an unknown scheme, the following will throw.
+ principal.origin;
+ } catch(ex) {
+ uri = Services.io.newURI("http://" + input_url, null, null);
+ principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(uri);
+ // If we have ended up with an unknown scheme, the following will throw.
+ principal.origin;
+ }
} catch(ex) {
- var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
- .getService(Components.interfaces.nsIPromptService);
var message = this._bundle.getString("invalidURI");
var title = this._bundle.getString("invalidURITitle");
- promptService.alert(window, title, message);
+ Services.prompt.alert(window, title, message);
return;
}
var capabilityString = this._getCapabilityString(aCapability);
// check whether the permission already exists, if not, add it
- var exists = false;
+ let permissionExists = false;
+ let capabilityExists = false;
for (var i = 0; i < this._permissions.length; ++i) {
- if (this._permissions[i].rawHost == host) {
- // Avoid calling the permission manager if the capability settings are
- // the same. Otherwise allow the call to the permissions manager to
- // update the listbox for us.
- exists = this._permissions[i].perm == aCapability;
+ if (this._permissions[i].principal.equals(principal)) {
+ permissionExists = true;
+ capabilityExists = this._permissions[i].capability == capabilityString;
+ if (!capabilityExists) {
+ this._permissions[i].capability = capabilityString;
+ }
break;
}
}
- if (!exists) {
- host = (host.charAt(0) == ".") ? host.substring(1,host.length) : host;
- var uri = ioService.newURI("http://" + host, null, null);
- this._pm.add(uri, this._type, aCapability);
+
+ let permissionParams = {principal: principal, type: this._type, capability: aCapability};
+ if (!permissionExists) {
+ this._permissionsToAdd.set(principal.origin, permissionParams);
+ this._addPermission(permissionParams);
+ }
+ else if (!capabilityExists) {
+ this._permissionsToAdd.set(principal.origin, permissionParams);
+ this._handleCapabilityChange();
}
+
textbox.value = "";
textbox.focus();
@@ -124,14 +148,58 @@ var gPermissionManager = {
// enable "remove all" button as needed
document.getElementById("removeAllPermissions").disabled = this._permissions.length == 0;
},
-
+
+ _removePermission: function(aPermission)
+ {
+ this._removePermissionFromList(aPermission.principal);
+
+ // If this permission was added during this session, let's remove
+ // it from the pending adds list to prevent calls to the
+ // permission manager.
+ let isNewPermission = this._permissionsToAdd.delete(aPermission.principal.origin);
+
+ if (!isNewPermission) {
+ this._permissionsToDelete.set(aPermission.principal.origin, aPermission);
+ }
+
+ },
+
+ _handleCapabilityChange: function ()
+ {
+ // Re-do the sort, if the status changed from Block to Allow
+ // or vice versa, since if we're sorted on status, we may no
+ // longer be in order.
+ if (this._lastPermissionSortColumn == "statusCol") {
+ this._resortPermissions();
+ }
+ this._tree.treeBoxObject.invalidate();
+ },
+
+ _addPermission: function(aPermission)
+ {
+ this._addPermissionToList(aPermission);
+ ++this._view._rowCount;
+ this._tree.treeBoxObject.rowCountChanged(this._view.rowCount - 1, 1);
+ // Re-do the sort, since we inserted this new item at the end.
+ this._resortPermissions();
+ },
+
+ _resortPermissions: function()
+ {
+ gTreeUtils.sort(this._tree, this._view, this._permissions,
+ this._lastPermissionSortColumn,
+ this._permissionsComparator,
+ this._lastPermissionSortColumn,
+ !this._lastPermissionSortAscending); // keep sort direction
+ },
+
onHostInput: function (aSiteField)
{
document.getElementById("btnSession").disabled = !aSiteField.value;
document.getElementById("btnBlock").disabled = !aSiteField.value;
document.getElementById("btnAllow").disabled = !aSiteField.value;
},
-
+
onWindowKeyPress: function (aEvent)
{
if (aEvent.keyCode == KeyEvent.DOM_VK_ESCAPE)
@@ -143,14 +211,14 @@ var gPermissionManager = {
if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN)
document.getElementById("btnAllow").click();
},
-
+
onLoad: function ()
{
this._bundle = document.getElementById("bundlePreferences");
var params = window.arguments[0];
this.init(params);
},
-
+
init: function (aParams)
{
if (this._type) {
@@ -160,14 +228,14 @@ var gPermissionManager = {
this._type = aParams.permissionType;
this._manageCapability = aParams.manageCapability;
-
+
var permissionsText = document.getElementById("permissionsText");
while (permissionsText.hasChildNodes())
permissionsText.removeChild(permissionsText.firstChild);
permissionsText.appendChild(document.createTextNode(aParams.introText));
document.title = aParams.windowTitle;
-
+
document.getElementById("btnBlock").hidden = !aParams.blockVisible;
document.getElementById("btnSession").hidden = !aParams.sessionVisible;
document.getElementById("btnAllow").hidden = !aParams.allowVisible;
@@ -183,64 +251,64 @@ var gPermissionManager = {
var urlLabel = document.getElementById("urlLabel");
urlLabel.hidden = !urlFieldVisible;
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
- os.notifyObservers(null, NOTIFICATION_FLUSH_PERMISSIONS, this._type);
- os.addObserver(this, "perm-changed", false);
+ let treecols = document.getElementsByTagName("treecols")[0];
+ treecols.addEventListener("click", event => {
+ if (event.target.nodeName != "treecol" || event.button != 0) {
+ return;
+ }
+
+ let sortField = event.target.getAttribute("data-field-name");
+ if (!sortField) {
+ return;
+ }
+
+ gPermissionManager.onPermissionSort(sortField);
+ });
+
+ Services.obs.notifyObservers(null, NOTIFICATION_FLUSH_PERMISSIONS, this._type);
+ Services.obs.addObserver(this, "perm-changed", false);
this._loadPermissions();
-
+
urlField.focus();
},
-
+
uninit: function ()
{
- var os = Components.classes["@mozilla.org/observer-service;1"]
- .getService(Components.interfaces.nsIObserverService);
- os.removeObserver(this, "perm-changed");
+ if (!this._observerRemoved) {
+ Services.obs.removeObserver(this, "perm-changed");
+
+ this._observerRemoved = true;
+ }
},
-
+
observe: function (aSubject, aTopic, aData)
{
if (aTopic == "perm-changed") {
var permission = aSubject.QueryInterface(Components.interfaces.nsIPermission);
+
+ // Ignore unrelated permission types.
+ if (permission.type != this._type)
+ return;
+
if (aData == "added") {
- this._addPermissionToList(permission);
- ++this._view._rowCount;
- this._tree.treeBoxObject.rowCountChanged(this._view.rowCount - 1, 1);
- // Re-do the sort, since we inserted this new item at the end.
- gTreeUtils.sort(this._tree, this._view, this._permissions,
- this._lastPermissionSortColumn,
- this._permissionsComparator,
- this._lastPermissionSortColumn,
- !this._lastPermissionSortAscending); // keep sort direction
+ this._addPermission(permission);
}
else if (aData == "changed") {
for (var i = 0; i < this._permissions.length; ++i) {
- if (this._permissions[i].host == permission.host) {
+ if (permission.matches(this._permissions[i].principal, true)) {
this._permissions[i].capability = this._getCapabilityString(permission.capability);
break;
}
}
- // Re-do the sort, if the status changed from Block to Allow
- // or vice versa, since if we're sorted on status, we may no
- // longer be in order.
- if (this._lastPermissionSortColumn == "statusCol") {
- gTreeUtils.sort(this._tree, this._view, this._permissions,
- this._lastPermissionSortColumn,
- this._permissionsComparator,
- this._lastPermissionSortColumn,
- !this._lastPermissionSortAscending); // keep sort direction
- }
- this._tree.treeBoxObject.invalidate();
+ this._handleCapabilityChange();
+ }
+ else if (aData == "deleted") {
+ this._removePermissionFromList(permission.principal);
}
- // No UI other than this window causes this method to be sent a "deleted"
- // notification, so we don't need to implement it since Delete is handled
- // directly by the Permission Removal handlers. If that ever changes, those
- // implementations will have to move into here.
}
},
-
+
onPermissionSelected: function ()
{
var hasSelection = this._tree.view.selection.count > 0;
@@ -257,8 +325,8 @@ var gPermissionManager = {
gTreeUtils.deleteSelectedItems(this._tree, this._view, this._permissions, removedPermissions);
for (var i = 0; i < removedPermissions.length; ++i) {
var p = removedPermissions[i];
- this._pm.remove(p.host, p.type);
- }
+ this._removePermission(p);
+ }
document.getElementById("removePermission").disabled = !this._permissions.length;
document.getElementById("removeAllPermissions").disabled = !this._permissions.length;
},
@@ -271,18 +339,23 @@ var gPermissionManager = {
gTreeUtils.deleteAll(this._tree, this._view, this._permissions, removedPermissions);
for (var i = 0; i < removedPermissions.length; ++i) {
var p = removedPermissions[i];
- this._pm.remove(p.host, p.type);
- }
+ this._removePermission(p);
+ }
document.getElementById("removePermission").disabled = true;
document.getElementById("removeAllPermissions").disabled = true;
},
-
+
onPermissionKeyPress: function (aEvent)
{
- if (aEvent.keyCode == 46)
+ if (aEvent.keyCode == KeyEvent.DOM_VK_DELETE
+#ifdef XP_MACOSX
+ || aEvent.keyCode == KeyEvent.DOM_VK_BACK_SPACE
+#endif
+ ) {
this.onPermissionDeleted();
+ }
},
-
+
_lastPermissionSortColumn: "",
_lastPermissionSortAscending: false,
_permissionsComparator : function (a, b)
@@ -293,16 +366,34 @@ var gPermissionManager = {
onPermissionSort: function (aColumn)
{
- this._lastPermissionSortAscending = gTreeUtils.sort(this._tree,
- this._view,
+ this._lastPermissionSortAscending = gTreeUtils.sort(this._tree,
+ this._view,
this._permissions,
aColumn,
this._permissionsComparator,
- this._lastPermissionSortColumn,
+ this._lastPermissionSortColumn,
this._lastPermissionSortAscending);
this._lastPermissionSortColumn = aColumn;
},
-
+
+ onApplyChanges: function()
+ {
+ // Stop observing permission changes since we are about
+ // to write out the pending adds/deletes and don't need
+ // to update the UI
+ this.uninit();
+
+ for (let permissionParams of this._permissionsToAdd.values()) {
+ Services.perms.addFromPrincipal(permissionParams.principal, permissionParams.type, permissionParams.capability);
+ }
+
+ for (let p of this._permissionsToDelete.values()) {
+ Services.perms.removeFromPrincipal(p.principal, p.type);
+ }
+
+ window.close();
+ },
+
_loadPermissions: function ()
{
this._tree = document.getElementById("permissionsTree");
@@ -310,48 +401,59 @@ var gPermissionManager = {
// load permissions into a table
var count = 0;
- var enumerator = this._pm.enumerator;
+ var enumerator = Services.perms.enumerator;
while (enumerator.hasMoreElements()) {
var nextPermission = enumerator.getNext().QueryInterface(Components.interfaces.nsIPermission);
this._addPermissionToList(nextPermission);
}
-
+
this._view._rowCount = this._permissions.length;
// sort and display the table
this._tree.view = this._view;
- this.onPermissionSort("rawHost");
+ this.onPermissionSort("origin");
// disable "remove all" button if there are none
document.getElementById("removeAllPermissions").disabled = this._permissions.length == 0;
},
-
+
_addPermissionToList: function (aPermission)
{
if (aPermission.type == this._type &&
(!this._manageCapability ||
(aPermission.capability == this._manageCapability))) {
- var host = aPermission.host;
+ var principal = aPermission.principal;
var capabilityString = this._getCapabilityString(aPermission.capability);
- var p = new Permission(host,
- (host.charAt(0) == ".") ? host.substring(1,host.length) : host,
+ var p = new Permission(principal,
aPermission.type,
- capabilityString,
- aPermission.capability);
+ capabilityString);
this._permissions.push(p);
- }
+ }
},
-
- setHost: function (aHost)
+
+ _removePermissionFromList: function (aPrincipal)
+ {
+ for (let i = 0; i < this._permissions.length; ++i) {
+ if (this._permissions[i].principal.equals(aPrincipal)) {
+ this._permissions.splice(i, 1);
+ this._view._rowCount--;
+ this._tree.treeBoxObject.rowCountChanged(this._view.rowCount - 1, -1);
+ this._tree.treeBoxObject.invalidate();
+ break;
+ }
+ }
+ },
+
+ setOrigin: function (aOrigin)
{
- document.getElementById("url").value = aHost;
+ document.getElementById("url").value = aOrigin;
}
};
-function setHost(aHost)
+function setOrigin(aOrigin)
{
- gPermissionManager.setHost(aHost);
+ gPermissionManager.setOrigin(aOrigin);
}
function initWithParams(aParams)
diff --git a/application/palemoon/components/preferences/permissions.xul b/application/palemoon/components/preferences/permissions.xul
index fd550e8f7d..33806cc277 100644
--- a/application/palemoon/components/preferences/permissions.xul
+++ b/application/palemoon/components/preferences/permissions.xul
@@ -1,12 +1,12 @@
<?xml version="1.0"?>
-# -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+<!-- -*- 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/. -->
-<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
-<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css" type="text/css"?>
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="chrome://browser/skin/preferences/preferences.css" type="text/css"?>
<!DOCTYPE dialog SYSTEM "chrome://browser/locale/preferences/permissions.dtd" >
@@ -35,7 +35,7 @@
<separator class="thin"/>
<label id="urlLabel" control="url" value="&address.label;" accesskey="&address.accesskey;"/>
<hbox align="start">
- <textbox id="url" flex="1"
+ <textbox id="url" flex="1"
oninput="gPermissionManager.onHostInput(event.target);"
onkeypress="gPermissionManager.onHostKeyPress(event);"/>
</hbox>
@@ -54,30 +54,32 @@
onselect="gPermissionManager.onPermissionSelected();">
<treecols>
<treecol id="siteCol" label="&treehead.sitename.label;" flex="3"
- onclick="gPermissionManager.onPermissionSort('rawHost');" persist="width"/>
+ data-field-name="origin" persist="width"/>
<splitter class="tree-splitter"/>
<treecol id="statusCol" label="&treehead.status.label;" flex="1"
- onclick="gPermissionManager.onPermissionSort('capability');" persist="width"/>
+ data-field-name="capability" persist="width"/>
</treecols>
<treechildren/>
</tree>
</vbox>
- <hbox align="end">
- <hbox class="actionButtons" flex="1">
+ <vbox>
+ <hbox class="actionButtons" align="left" flex="1">
<button id="removePermission" disabled="true"
accesskey="&removepermission.accesskey;"
icon="remove" label="&removepermission.label;"
oncommand="gPermissionManager.onPermissionDeleted();"/>
<button id="removeAllPermissions"
icon="clear" label="&removeallpermissions.label;"
- accesskey="&removeallpermissions.accesskey;"
+ accesskey="&removeallpermissions.accesskey;"
oncommand="gPermissionManager.onAllPermissionsDeleted();"/>
- <spacer flex="1"/>
-#ifndef XP_MACOSX
+ </hbox>
+ <spacer flex="1"/>
+ <hbox class="actionButtons" align="right" flex="1">
<button oncommand="close();" icon="close"
- label="&button.close.label;" accesskey="&button.close.accesskey;"/>
-#endif
+ label="&button.cancel.label;" accesskey="&button.cancel.accesskey;" />
+ <button id="btnApplyChanges" oncommand="gPermissionManager.onApplyChanges();" icon="save"
+ label="&button.ok.label;" accesskey="&button.ok.accesskey;"/>
</hbox>
<resizer type="window" dir="bottomend"/>
- </hbox>
+ </vbox>
</window>
diff --git a/application/palemoon/components/preferences/sanitize.js b/application/palemoon/components/preferences/sanitize.js
index 893155e627..15e6f58f48 100644
--- a/application/palemoon/components/preferences/sanitize.js
+++ b/application/palemoon/components/preferences/sanitize.js
@@ -3,7 +3,7 @@
* 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/. */
-let gSanitizeDialog = Object.freeze({
+var gSanitizeDialog = Object.freeze({
onClearHistoryChanged: function () {
let downloadsPref = document.getElementById("privacy.clearOnShutdown.downloads");
let historyPref = document.getElementById("privacy.clearOnShutdown.history");
diff --git a/application/palemoon/components/preferences/security.js b/application/palemoon/components/preferences/security.js
index a337f398c3..9d5f302a21 100644
--- a/application/palemoon/components/preferences/security.js
+++ b/application/palemoon/components/preferences/security.js
@@ -3,6 +3,9 @@
* 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.defineLazyModuleGetter(this, "LoginHelper",
+ "resource://gre/modules/LoginHelper.jsm");
+
Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
var gSecurityPane = {
@@ -128,9 +131,21 @@ var gSecurityPane = {
*/
showPasswordExceptions: function ()
{
+ let bundlePrefs = document.getElementById("bundlePreferences");
+ let params = {
+ blockVisible: true,
+ sessionVisible: false,
+ allowVisible: false,
+ hideStatusColumn: true,
+ prefilledHost: "",
+ permissionType: "login-saving",
+ windowTitle: bundlePrefs.getString("savedLoginsExceptions_title"),
+ introText: bundlePrefs.getString("savedLoginsExceptions_desc")
+ };
+
document.documentElement.openWindow("Toolkit:PasswordManagerExceptions",
- "chrome://passwordmgr/content/passwordManagerExceptions.xul",
- "", null);
+ "chrome://browser/content/preferences/permissions.xul",
+ null, params);
},
/**
@@ -141,7 +156,7 @@ var gSecurityPane = {
*/
_initMasterPasswordUI: function ()
{
- var noMP = !this._masterPasswordSet();
+ var noMP = !LoginHelper.isMasterPasswordSet();
var button = document.getElementById("changeMasterPassword");
button.disabled = noMP;
@@ -151,26 +166,6 @@ var gSecurityPane = {
},
/**
- * Returns true if the user has a master password set and false otherwise.
- */
- _masterPasswordSet: function ()
- {
- const Cc = Components.classes, Ci = Components.interfaces;
- var secmodDB = Cc["@mozilla.org/security/pkcs11moduledb;1"].
- getService(Ci.nsIPKCS11ModuleDB);
- var slot = secmodDB.findSlotByName("");
- if (slot) {
- var status = slot.status;
- var hasMP = status != Ci.nsIPKCS11Slot.SLOT_UNINITIALIZED &&
- status != Ci.nsIPKCS11Slot.SLOT_READY;
- return hasMP;
- } else {
- // XXX I have no bloody idea what this means
- return false;
- }
- },
-
- /**
* Enables/disables the master password button depending on the state of the
* "use master password" checkbox, and prompts for master password removal if
* one is set.
diff --git a/application/palemoon/components/preferences/sync.js b/application/palemoon/components/preferences/sync.js
index 9c7f1aa1fe..f29728dbfc 100644
--- a/application/palemoon/components/preferences/sync.js
+++ b/application/palemoon/components/preferences/sync.js
@@ -9,7 +9,7 @@ const PAGE_NO_ACCOUNT = 0;
const PAGE_HAS_ACCOUNT = 1;
const PAGE_NEEDS_UPDATE = 2;
-let gSyncPane = {
+var gSyncPane = {
_stringBundle: null,
prefArray: ["engine.bookmarks", "engine.passwords", "engine.prefs",
"engine.tabs", "engine.history"],
diff --git a/application/palemoon/components/search/content/engineManager.js b/application/palemoon/components/search/content/engineManager.js
index 92b6d59b77..993d48b06d 100644
--- a/application/palemoon/components/search/content/engineManager.js
+++ b/application/palemoon/components/search/content/engineManager.js
@@ -2,7 +2,12 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
+ "resource://gre/modules/PlacesUtils.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "Task",
+ "resource://gre/modules/Task.jsm");
const Ci = Components.interfaces;
const Cc = Components.classes;
@@ -105,7 +110,7 @@ var gEngineManagerDialog = {
document.getElementById("engineList").focus();
},
- editKeyword: function engineManager_editKeyword() {
+ editKeyword: Task.async(function* engineManager_editKeyword() {
var selectedEngine = gEngineView.selectedEngine;
if (!selectedEngine)
return;
@@ -121,12 +126,8 @@ var gEngineManagerDialog = {
var dupName = "";
if (alias.value != "") {
- try {
- let bmserv = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].
- getService(Ci.nsINavBookmarksService);
- if (bmserv.getURIForKeyword(alias.value))
- bduplicate = true;
- } catch(ex) {}
+ // Check for duplicates in Places keywords.
+ bduplicate = !!(yield PlacesUtils.keywords.fetch(alias.value));
// Check for duplicates in changes we haven't committed yet
let engines = gEngineView._engineStore.engines;
@@ -154,7 +155,7 @@ var gEngineManagerDialog = {
break;
}
}
- },
+ }),
onSelect: function engineManager_onSelect() {
// Buttons only work if an engine is selected and it's not the last engine,
diff --git a/application/palemoon/components/search/content/engineManager.xul b/application/palemoon/components/search/content/engineManager.xul
index 50181c066e..1152ef8db3 100644
--- a/application/palemoon/components/search/content/engineManager.xul
+++ b/application/palemoon/components/search/content/engineManager.xul
@@ -36,7 +36,7 @@
oncommand="gEngineManagerDialog.bump(-1);"
disabled="true"/>
<command id="cmd_editkeyword"
- oncommand="gEngineManagerDialog.editKeyword();"
+ oncommand="gEngineManagerDialog.editKeyword().catch(Components.utils.reportError);"
disabled="true"/>
</commandset>
diff --git a/application/palemoon/components/sessionstore/SessionStorage.jsm b/application/palemoon/components/sessionstore/SessionStorage.jsm
index 192352c494..64aef35a52 100644
--- a/application/palemoon/components/sessionstore/SessionStorage.jsm
+++ b/application/palemoon/components/sessionstore/SessionStorage.jsm
@@ -38,7 +38,7 @@ this.SessionStorage = {
Object.freeze(SessionStorage);
-let DomStorage = {
+var DomStorage = {
/**
* Reads all session storage data from the given docShell.
* @param aDocShell
@@ -142,7 +142,7 @@ let DomStorage = {
}
};
-let History = {
+var History = {
/**
* Returns a given history entry's URI.
* @param aHistory
diff --git a/application/palemoon/components/sessionstore/SessionStore.jsm b/application/palemoon/components/sessionstore/SessionStore.jsm
index b74e68a2f2..b8d126e217 100644
--- a/application/palemoon/components/sessionstore/SessionStore.jsm
+++ b/application/palemoon/components/sessionstore/SessionStore.jsm
@@ -88,7 +88,7 @@ XPCOMUtils.defineLazyServiceGetter(this, "gScreenManager",
// retrieved from a given docShell if not already collected before.
// This is made so they're automatically in sync with all nsIDocShell.allow*
// properties.
-let gDocShellCapabilities = (function () {
+var gDocShellCapabilities = (function () {
let caps;
return docShell => {
@@ -106,12 +106,12 @@ XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
#ifdef MOZ_DEVTOOLS
XPCOMUtils.defineLazyModuleGetter(this, "ScratchpadManager",
- "resource://gre/modules/devtools/scratchpad-manager.jsm");
+ "resource://devtools/client/scratchpad/scratchpad-manager.jsm");
Object.defineProperty(this, "HUDService", {
get: function HUDService_getter() {
- let devtools = Cu.import("resource://gre/modules/devtools/Loader.jsm", {}).devtools;
- return devtools.require("devtools/webconsole/hudservice").HUDService;
+ let devtools = Cu.import("resource://devtools/shared/Loader.jsm", {}).devtools;
+ return devtools.require("devtools/client/webconsole/hudservice").HUDService;
},
configurable: true,
enumerable: true
@@ -247,7 +247,7 @@ this.SessionStore = {
// Freeze the SessionStore object. We don't want anyone to modify it.
Object.freeze(SessionStore);
-let SessionStoreInternal = {
+var SessionStoreInternal = {
QueryInterface: XPCOMUtils.generateQI([
Ci.nsIDOMEventListener,
Ci.nsIObserver,
@@ -1951,7 +1951,13 @@ let SessionStoreInternal = {
// userTypedValue.
if (browser.userTypedValue) {
tabData.userTypedValue = browser.userTypedValue;
- tabData.userTypedClear = browser.userTypedClear;
+ // We always used to keep track of the loading state as an integer, where
+ // '0' indicated the user had typed since the last load (or no load was
+ // ongoing), and any positive value indicated we had started a load since
+ // the last time the user typed in the URL bar. Mimic this to keep the
+ // session store representation in sync, even though we now represent this
+ // more explicitly:
+ tabData.userTypedClear = browser.didStartLoadSinceLastUserTyping() ? 1 : 0;
} else {
delete tabData.userTypedValue;
delete tabData.userTypedClear;
@@ -2404,7 +2410,7 @@ let SessionStoreInternal = {
for (var [host, isPinned] in Iterator(internalWindow.hosts)) {
let list;
try {
- list = Services.cookies.getCookiesFromHost(host);
+ list = Services.cookies.getCookiesFromHost(host, {});
}
catch (ex) {
debug("getCookiesFromHost failed. Host: " + host);
@@ -3131,7 +3137,11 @@ let SessionStoreInternal = {
// Restore the tab icon.
if ("image" in tabData) {
- aWindow.gBrowser.setIcon(tab, tabData.image);
+ // Using null as the loadingPrincipal because serializing
+ // the principal would be overkill. Within SetIcon we
+ // default to the systemPrincipal if aLoadingPrincipal is
+ // null which will allow the favicon to load.
+ aWindow.gBrowser.setIcon(tab, tabData.image, null);
}
if (tabData.storage && browser.docShell instanceof Ci.nsIDocShell)
@@ -3651,7 +3661,7 @@ let SessionStoreInternal = {
try {
Services.cookies.add(cookie.host, cookie.path || "", cookie.name || "",
cookie.value, !!cookie.secure, !!cookie.httponly, true,
- "expiry" in cookie ? cookie.expiry : MAX_EXPIRY);
+ "expiry" in cookie ? cookie.expiry : MAX_EXPIRY, {});
}
catch (ex) { Cu.reportError(ex); } // don't let a single cookie stop recovering
}
@@ -4467,7 +4477,7 @@ let SessionStoreInternal = {
* pinned, visible and hidden tabs in that and FIFO order. Hidden tabs are only
* restored with restore_hidden_tabs=true.
*/
-let TabRestoreQueue = {
+var TabRestoreQueue = {
// The separate buckets used to store tabs.
tabs: {priority: [], visible: [], hidden: []},
@@ -4604,7 +4614,7 @@ let TabRestoreQueue = {
// A map storing a closed window's state data until it goes aways (is GC'ed).
// This ensures that API clients can still read (but not write) states of
// windows they still hold a reference to but we don't.
-let DyingWindowCache = {
+var DyingWindowCache = {
_data: new WeakMap(),
has: function (window) {
@@ -4627,7 +4637,7 @@ let DyingWindowCache = {
// A set of tab attributes to persist. We will read a given list of tab
// attributes when collecting tab data and will re-set those attributes when
// the given tab data is restored to a new tab.
-let TabAttributes = {
+var TabAttributes = {
_attrs: new Set(),
// We never want to directly read or write those attributes.
@@ -4673,7 +4683,7 @@ let TabAttributes = {
// This is used to help meter the number of restoring tabs. This is the control
// point for telling the next tab to restore. It gets attached to each gBrowser
// via gBrowser.addTabsProgressListener
-let gRestoreTabsProgressListener = {
+var gRestoreTabsProgressListener = {
onStateChange: function(aBrowser, aWebProgress, aRequest, aStateFlags, aStatus) {
// Ignore state changes on browsers that we've already restored and state
// changes that aren't applicable.
diff --git a/application/palemoon/components/sessionstore/_SessionFile.jsm b/application/palemoon/components/sessionstore/_SessionFile.jsm
index 7e1b05f749..62b4d1687b 100644
--- a/application/palemoon/components/sessionstore/_SessionFile.jsm
+++ b/application/palemoon/components/sessionstore/_SessionFile.jsm
@@ -41,7 +41,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "FileUtils",
XPCOMUtils.defineLazyModuleGetter(this, "Task",
"resource://gre/modules/Task.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "console",
- "resource://gre/modules/devtools/Console.jsm");
+ "resource://gre/modules/Console.jsm");
// An encoder to UTF-8.
XPCOMUtils.defineLazyGetter(this, "gEncoder", function () {
@@ -130,7 +130,7 @@ const TaskUtils = {
}
};
-let SessionFileInternal = {
+var SessionFileInternal = {
/**
* A promise fulfilled once initialization is complete
*/
@@ -156,7 +156,10 @@ let SessionFileInternal = {
let text;
try {
let file = new FileUtils.File(aPath);
- let chan = NetUtil.newChannel(file);
+ let chan = NetUtil.newChannel({
+ uri: NetUtil.newURI(file),
+ loadUsingSystemPrincipal: true
+ });
let stream = chan.open();
text = NetUtil.readInputStreamToString(stream, stream.available(),
{charset: "utf-8"});
diff --git a/application/palemoon/components/sessionstore/nsSessionStartup.js b/application/palemoon/components/sessionstore/nsSessionStartup.js
index 024246619c..04037c10e0 100644
--- a/application/palemoon/components/sessionstore/nsSessionStartup.js
+++ b/application/palemoon/components/sessionstore/nsSessionStartup.js
@@ -50,7 +50,7 @@ function debug(aMsg) {
Services.console.logStringMessage(aMsg);
}
-let gOnceInitializedDeferred = Promise.defer();
+var gOnceInitializedDeferred = Promise.defer();
/* :::::::: The Service ::::::::::::::: */
@@ -77,9 +77,14 @@ SessionStartup.prototype = {
return;
}
- _SessionFile.read().then(
- this._onSessionFileRead.bind(this)
- );
+ if (Services.prefs.getBoolPref("browser.sessionstore.resume_session_once") ||
+ Services.prefs.getIntPref("browser.startup.page") == 3) {
+ this._ensureInitialized();
+ } else {
+ _SessionFile.read().then(
+ this._onSessionFileRead.bind(this)
+ );
+ }
},
// Wrap a string as a nsISupports
diff --git a/application/palemoon/components/shell/Makefile.in b/application/palemoon/components/shell/Makefile.in
deleted file mode 100644
index df084b709d..0000000000
--- a/application/palemoon/components/shell/Makefile.in
+++ /dev/null
@@ -1,11 +0,0 @@
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-include $(topsrcdir)/config/rules.mk
-
-CXXFLAGS += $(TK_CFLAGS)
-
-clobber::
- rm -f $(DIST)/lib/$(LIBRARY_NAME).lib
diff --git a/application/palemoon/components/shell/ShellService.jsm b/application/palemoon/components/shell/ShellService.jsm
new file mode 100644
index 0000000000..74632b6926
--- /dev/null
+++ b/application/palemoon/components/shell/ShellService.jsm
@@ -0,0 +1,114 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+* License, v. 2.0. If a copy of the MPL was not distributed with this file,
+* You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+"use strict";
+
+this.EXPORTED_SYMBOLS = ["ShellService"];
+
+const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
+
+Cu.import("resource://gre/modules/AppConstants.jsm");
+Cu.import("resource://gre/modules/Services.jsm");
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "WindowsRegistry",
+ "resource://gre/modules/WindowsRegistry.jsm");
+
+/**
+ * Internal functionality to save and restore the docShell.allow* properties.
+ */
+var ShellServiceInternal = {
+ /**
+ * Used to determine whether or not to offer "Set as desktop background"
+ * functionality. Even if shell service is available it is not
+ * guaranteed that it is able to set the background for every desktop
+ * which is especially true for Linux with its many different desktop
+ * environments.
+ */
+ get canSetDesktopBackground() {
+ if (AppConstants.platform == "win" ||
+ AppConstants.platform == "macosx") {
+ return true;
+ }
+
+ if (AppConstants.platform == "linux") {
+ if (this.shellService) {
+ let linuxShellService = this.shellService
+ .QueryInterface(Ci.nsIGNOMEShellService);
+ return linuxShellService.canSetDesktopBackground;
+ }
+ }
+
+ return false;
+ },
+
+ /**
+ * Used to determine whether or not to show a "Set Default Browser"
+ * query dialog. This attribute is true if the application is starting
+ * up and "browser.shell.checkDefaultBrowser" is true, otherwise it
+ * is false.
+ */
+ _checkedThisSession: false,
+ get shouldCheckDefaultBrowser() {
+ // If we've already checked, the browser has been started and this is a
+ // new window open, and we don't want to check again.
+ if (this._checkedThisSession) {
+ return false;
+ }
+
+ if (!Services.prefs.getBoolPref("browser.shell.checkDefaultBrowser")) {
+ return false;
+ }
+
+ if (AppConstants.platform == "win") {
+ let optOutValue = WindowsRegistry.readRegKey(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
+ "Software\\Mozilla\\PaleMoon",
+ "DefaultBrowserOptOut");
+ WindowsRegistry.removeRegKey(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
+ "Software\\Mozilla\\PaleMoon",
+ "DefaultBrowserOptOut");
+ if (optOutValue == "True") {
+ Services.prefs.setBoolPref("browser.shell.checkDefaultBrowser", false);
+ return false;
+ }
+ }
+
+ return true;
+ },
+
+ set shouldCheckDefaultBrowser(shouldCheck) {
+ Services.prefs.setBoolPref("browser.shell.checkDefaultBrowser", !!shouldCheck);
+ },
+
+ isDefaultBrowser(startupCheck, forAllTypes) {
+ // If this is the first browser window, maintain internal state that we've
+ // checked this session (so that subsequent window opens don't show the
+ // default browser dialog).
+ if (startupCheck) {
+ this._checkedThisSession = true;
+ }
+ if (this.shellService) {
+ return this.shellService.isDefaultBrowser(startupCheck, forAllTypes);
+ }
+ return false;
+ }
+};
+
+XPCOMUtils.defineLazyServiceGetter(ShellServiceInternal, "shellService",
+ "@mozilla.org/browser/shell-service;1", Ci.nsIShellService);
+
+/**
+ * The external API exported by this module.
+ */
+this.ShellService = new Proxy(ShellServiceInternal, {
+ get(target, name) {
+ if (name in target) {
+ return target[name];
+ }
+ if (target.shellService) {
+ return target.shellService[name];
+ }
+ Services.console.logStringMessage(`${name} not found in ShellService: ${target.shellService}`);
+ return undefined;
+ }
+});
diff --git a/application/palemoon/components/shell/content/setDesktopBackground.js b/application/palemoon/components/shell/content/setDesktopBackground.js
index e90a32d034..53cc70db0d 100644
--- a/application/palemoon/components/shell/content/setDesktopBackground.js
+++ b/application/palemoon/components/shell/content/setDesktopBackground.js
@@ -1,16 +1,14 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+Components.utils.import("resource://gre/modules/AppConstants.jsm");
var Ci = Components.interfaces;
var gSetBackground = {
-#ifndef XP_MACOSX
- _position : "",
- _backgroundColor : 0,
-#else
- _position : "STRETCH",
-#endif
+ _position : AppConstants.platform == "macosx" ? "STRETCH" : "",
+ _backgroundColor : AppConstants.platform != "macosx" ? 0 : undefined,
_screenWidth : 0,
_screenHeight : 0,
_image : null,
@@ -27,23 +25,23 @@ var gSetBackground = {
this._canvas = document.getElementById("screen");
this._screenWidth = screen.width;
this._screenHeight = screen.height;
-#ifdef XP_MACOSX
- document.documentElement.getButton("accept").hidden = true;
-#endif
+ if (AppConstants.platform == "macosx") {
+ document.documentElement.getButton("accept").hidden = true;
+ }
if (this._screenWidth / this._screenHeight >= 1.6)
document.getElementById("monitor").setAttribute("aspectratio", "16:10");
-#ifdef XP_WIN
- // hide fill + fit options if <win7 since don't work
- var version = Components.classes["@mozilla.org/system-info;1"]
- .getService(Ci.nsIPropertyBag2)
- .getProperty("version");
- var isWindows7OrHigher = (parseFloat(version) >= 6.1);
- if (!isWindows7OrHigher) {
- document.getElementById("fillPosition").hidden = true;
- document.getElementById("fitPosition").hidden = true;
+ if (AppConstants.platform == "win") {
+ // Hide fill + fit options if < Win7 since they don't work.
+ var version = Components.classes["@mozilla.org/system-info;1"]
+ .getService(Ci.nsIPropertyBag2)
+ .getProperty("version");
+ var isWindows7OrHigher = (parseFloat(version) >= 6.1);
+ if (!isWindows7OrHigher) {
+ document.getElementById("fillPosition").hidden = true;
+ document.getElementById("fitPosition").hidden = true;
+ }
}
-#endif
// make sure that the correct dimensions will be used
setTimeout(function(self) {
@@ -62,92 +60,37 @@ var gSetBackground = {
var ctx = this._canvas.getContext("2d");
ctx.scale(this._canvas.clientWidth / this._screenWidth, this._canvas.clientHeight / this._screenHeight);
-#ifndef XP_MACOSX
- this._initColor();
-#else
- // Make sure to reset the button state in case the user has already
- // set an image as their desktop background.
- var setDesktopBackground = document.getElementById("setDesktopBackground");
- setDesktopBackground.hidden = false;
- var bundle = document.getElementById("backgroundBundle");
- setDesktopBackground.label = bundle.getString("DesktopBackgroundSet");
- setDesktopBackground.disabled = false;
-
- document.getElementById("showDesktopPreferences").hidden = true;
-#endif
+ if (AppConstants.platform != "macosx") {
+ this._initColor();
+ } else {
+ // Make sure to reset the button state in case the user has already
+ // set an image as their desktop background.
+ var setDesktopBackground = document.getElementById("setDesktopBackground");
+ setDesktopBackground.hidden = false;
+ var bundle = document.getElementById("backgroundBundle");
+ setDesktopBackground.label = bundle.getString("DesktopBackgroundSet");
+ setDesktopBackground.disabled = false;
+
+ document.getElementById("showDesktopPreferences").hidden = true;
+ }
this.updatePosition();
},
-#ifndef XP_MACOSX
- _initColor: function ()
- {
- var color = this._shell.desktopBackgroundColor;
-
- const rMask = 4294901760;
- const gMask = 65280;
- const bMask = 255;
- var r = (color & rMask) >> 16;
- var g = (color & gMask) >> 8;
- var b = (color & bMask);
- this.updateColor(this._rgbToHex(r, g, b));
-
- var colorpicker = document.getElementById("desktopColor");
- colorpicker.color = this._backgroundColor;
- },
-
- updateColor: function (aColor)
- {
- this._backgroundColor = aColor;
- this._canvas.style.backgroundColor = aColor;
- },
-
- // Converts a color string in the format "#RRGGBB" to an integer.
- _hexStringToLong: function (aString)
- {
- return parseInt(aString.substring(1,3), 16) << 16 |
- parseInt(aString.substring(3,5), 16) << 8 |
- parseInt(aString.substring(5,7), 16);
- },
-
- _rgbToHex: function (aR, aG, aB)
- {
- return "#" + [aR, aG, aB].map(function(aInt) aInt.toString(16).replace(/^(.)$/, "0$1"))
- .join("").toUpperCase();
- },
-#else
- observe: function (aSubject, aTopic, aData)
+ setDesktopBackground: function ()
{
- if (aTopic == "shell:desktop-background-changed") {
- document.getElementById("setDesktopBackground").hidden = true;
- document.getElementById("showDesktopPreferences").hidden = false;
-
+ if (AppConstants.platform != "macosx") {
+ document.persist("menuPosition", "value");
+ this._shell.desktopBackgroundColor = this._hexStringToLong(this._backgroundColor);
+ } else {
Components.classes["@mozilla.org/observer-service;1"]
.getService(Ci.nsIObserverService)
- .removeObserver(this, "shell:desktop-background-changed");
- }
- },
-
- showDesktopPrefs: function()
- {
- this._shell.openApplication(Ci.nsIMacShellService.APPLICATION_DESKTOP);
- },
-#endif
+ .addObserver(this, "shell:desktop-background-changed", false);
- setDesktopBackground: function ()
- {
-#ifndef XP_MACOSX
- document.persist("menuPosition", "value");
- this._shell.desktopBackgroundColor = this._hexStringToLong(this._backgroundColor);
-#else
- Components.classes["@mozilla.org/observer-service;1"]
- .getService(Ci.nsIObserverService)
- .addObserver(this, "shell:desktop-background-changed", false);
-
- var bundle = document.getElementById("backgroundBundle");
- var setDesktopBackground = document.getElementById("setDesktopBackground");
- setDesktopBackground.disabled = true;
- setDesktopBackground.label = bundle.getString("DesktopBackgroundDownloading");
-#endif
+ var bundle = document.getElementById("backgroundBundle");
+ var setDesktopBackground = document.getElementById("setDesktopBackground");
+ setDesktopBackground.disabled = true;
+ setDesktopBackground.label = bundle.getString("DesktopBackgroundDownloading");
+ }
this._shell.setDesktopBackground(this._image,
Ci.nsIShellService["BACKGROUND_" + this._position]);
},
@@ -157,9 +100,9 @@ var gSetBackground = {
var ctx = this._canvas.getContext("2d");
ctx.clearRect(0, 0, this._screenWidth, this._screenHeight);
-#ifndef XP_MACOSX
- this._position = document.getElementById("menuPosition").value;
-#endif
+ if (AppConstants.platform != "macosx") {
+ this._position = document.getElementById("menuPosition").value;
+ }
switch (this._position) {
case "TILE":
@@ -171,43 +114,101 @@ var gSetBackground = {
case "STRETCH":
ctx.drawImage(this._image, 0, 0, this._screenWidth, this._screenHeight);
break;
- case "CENTER":
- var x = (this._screenWidth - this._image.naturalWidth) / 2;
- var y = (this._screenHeight - this._image.naturalHeight) / 2;
+ case "CENTER": {
+ let x = (this._screenWidth - this._image.naturalWidth) / 2;
+ let y = (this._screenHeight - this._image.naturalHeight) / 2;
ctx.drawImage(this._image, x, y);
break;
- case "FILL":
- //Try maxing width first, overflow height
- var widthRatio = this._screenWidth / this._image.naturalWidth;
- var width = this._image.naturalWidth * widthRatio;
- var height = this._image.naturalHeight * widthRatio;
+ }
+ case "FILL": {
+ // Try maxing width first, overflow height.
+ let widthRatio = this._screenWidth / this._image.naturalWidth;
+ let width = this._image.naturalWidth * widthRatio;
+ let height = this._image.naturalHeight * widthRatio;
if (height < this._screenHeight) {
- //height less than screen, max height and overflow width
- var heightRatio = this._screenHeight / this._image.naturalHeight;
+ // Height less than screen, max height and overflow width.
+ let heightRatio = this._screenHeight / this._image.naturalHeight;
width = this._image.naturalWidth * heightRatio;
height = this._image.naturalHeight * heightRatio;
}
- var x = (this._screenWidth - width) / 2;
- var y = (this._screenHeight - height) / 2;
+ let x = (this._screenWidth - width) / 2;
+ let y = (this._screenHeight - height) / 2;
ctx.drawImage(this._image, x, y, width, height);
break;
- case "FIT":
- //Try maxing width first, top and bottom borders
- var widthRatio = this._screenWidth / this._image.naturalWidth;
- var width = this._image.naturalWidth * widthRatio;
- var height = this._image.naturalHeight * widthRatio;
- var x = 0;
- var y = (this._screenHeight - height) / 2;
+ }
+ case "FIT": {
+ // Try maxing width first, top and bottom borders.
+ let widthRatio = this._screenWidth / this._image.naturalWidth;
+ let width = this._image.naturalWidth * widthRatio;
+ let height = this._image.naturalHeight * widthRatio;
+ let x = 0;
+ let y = (this._screenHeight - height) / 2;
if (height > this._screenHeight) {
- //height overflow, maximise height, side borders
- var heightRatio = this._screenHeight / this._image.naturalHeight;
+ // Height overflow, maximise height, side borders.
+ let heightRatio = this._screenHeight / this._image.naturalHeight;
width = this._image.naturalWidth * heightRatio;
height = this._image.naturalHeight * heightRatio;
x = (this._screenWidth - width) / 2;
y = 0;
}
ctx.drawImage(this._image, x, y, width, height);
- break;
+ break;
+ }
}
}
};
+
+if (AppConstants.platform != "macosx") {
+ gSetBackground["_initColor"] = function ()
+ {
+ var color = this._shell.desktopBackgroundColor;
+
+ const rMask = 4294901760;
+ const gMask = 65280;
+ const bMask = 255;
+ var r = (color & rMask) >> 16;
+ var g = (color & gMask) >> 8;
+ var b = (color & bMask);
+ this.updateColor(this._rgbToHex(r, g, b));
+
+ var colorpicker = document.getElementById("desktopColor");
+ colorpicker.color = this._backgroundColor;
+ };
+
+ gSetBackground["updateColor"] = function (aColor)
+ {
+ this._backgroundColor = aColor;
+ this._canvas.style.backgroundColor = aColor;
+ };
+
+ // Converts a color string in the format "#RRGGBB" to an integer.
+ gSetBackground["_hexStringToLong"] = function (aString)
+ {
+ return parseInt(aString.substring(1, 3), 16) << 16 |
+ parseInt(aString.substring(3, 5), 16) << 8 |
+ parseInt(aString.substring(5, 7), 16);
+ };
+
+ gSetBackground["_rgbToHex"] = function (aR, aG, aB)
+ {
+ return "#" + [aR, aG, aB].map(aInt => aInt.toString(16).replace(/^(.)$/, "0$1"))
+ .join("").toUpperCase();
+ };
+} else {
+ gSetBackground["observe"] = function (aSubject, aTopic, aData)
+ {
+ if (aTopic == "shell:desktop-background-changed") {
+ document.getElementById("setDesktopBackground").hidden = true;
+ document.getElementById("showDesktopPreferences").hidden = false;
+
+ Components.classes["@mozilla.org/observer-service;1"]
+ .getService(Ci.nsIObserverService)
+ .removeObserver(this, "shell:desktop-background-changed");
+ }
+ };
+
+ gSetBackground["showDesktopPrefs"] = function()
+ {
+ this._shell.openApplication(Ci.nsIMacShellService.APPLICATION_DESKTOP);
+ };
+}
diff --git a/application/palemoon/components/shell/jar.mn b/application/palemoon/components/shell/jar.mn
index eed15c3978..1f33b5d56c 100644
--- a/application/palemoon/components/shell/jar.mn
+++ b/application/palemoon/components/shell/jar.mn
@@ -4,4 +4,4 @@
browser.jar:
* content/browser/setDesktopBackground.xul (content/setDesktopBackground.xul)
-* content/browser/setDesktopBackground.js (content/setDesktopBackground.js)
+ content/browser/setDesktopBackground.js (content/setDesktopBackground.js)
diff --git a/application/palemoon/components/shell/moz.build b/application/palemoon/components/shell/moz.build
index 38965c5d78..94ec885714 100644
--- a/application/palemoon/components/shell/moz.build
+++ b/application/palemoon/components/shell/moz.build
@@ -1,4 +1,4 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -18,6 +18,10 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
XPIDL_SOURCES += [
'nsIMacShellService.idl',
]
+elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
+ XPIDL_SOURCES += [
+ 'nsIGNOMEShellService.idl',
+ ]
XPIDL_MODULE = 'shellservice'
@@ -29,7 +33,7 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
SOURCES += [
'nsMacShellService.cpp',
]
-elif CONFIG['MOZ_WIDGET_GTK']:
+elif 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
SOURCES += [
'nsGNOMEShellService.cpp',
]
@@ -42,6 +46,10 @@ EXTRA_COMPONENTS += [
'nsSetDefaultBrowser.manifest',
]
+EXTRA_JS_MODULES += [
+ 'ShellService.jsm',
+]
+
for var in ('MOZ_APP_NAME', 'MOZ_APP_VERSION'):
DEFINES[var] = '"%s"' % CONFIG[var]
diff --git a/application/palemoon/components/shell/nsGNOMEShellService.cpp b/application/palemoon/components/shell/nsGNOMEShellService.cpp
index 14510d1113..9bc5f59130 100644
--- a/application/palemoon/components/shell/nsGNOMEShellService.cpp
+++ b/application/palemoon/components/shell/nsGNOMEShellService.cpp
@@ -21,12 +21,13 @@
#include "nsIStringBundle.h"
#include "nsIOutputStream.h"
#include "nsIProcess.h"
-#include "nsNetUtil.h"
+#include "nsServiceManagerUtils.h"
+#include "nsComponentManagerUtils.h"
#include "nsIDOMHTMLImageElement.h"
#include "nsIImageLoadingContent.h"
#include "imgIRequest.h"
#include "imgIContainer.h"
-#include "prprf.h"
+#include "mozilla/Sprintf.h"
#if defined(MOZ_WIDGET_GTK)
#include "nsIImageToPixbuf.h"
#endif
@@ -116,7 +117,7 @@ nsGNOMEShellService::Init()
return appPath->GetNativePath(mAppPath);
}
-NS_IMPL_ISUPPORTS(nsGNOMEShellService, nsIShellService)
+NS_IMPL_ISUPPORTS(nsGNOMEShellService, nsIGNOMEShellService, nsIShellService)
bool
nsGNOMEShellService::GetAppPathFromLauncher()
@@ -152,7 +153,8 @@ nsGNOMEShellService::KeyMatchesAppName(const char *aKeyValue) const
gchar *commandPath;
if (mUseLocaleFilenames) {
- gchar *nativePath = g_filename_from_utf8(aKeyValue, -1, nullptr, nullptr, nullptr);
+ gchar *nativePath = g_filename_from_utf8(aKeyValue, -1,
+ nullptr, nullptr, nullptr);
if (!nativePath) {
NS_ERROR("Error converting path to filesystem encoding");
return false;
@@ -199,8 +201,6 @@ nsGNOMEShellService::IsDefaultBrowser(bool aStartupCheck,
bool* aIsDefaultBrowser)
{
*aIsDefaultBrowser = false;
- if (aStartupCheck)
- mCheckedThisSession = true;
nsCOMPtr<nsIGConfService> gconf = do_GetService(NS_GCONFSERVICE_CONTRACTID);
nsCOMPtr<nsIGIOService> giovfs = do_GetService(NS_GIOSERVICE_CONTRACTID);
@@ -284,7 +284,7 @@ nsGNOMEShellService::SetDefaultBrowser(bool aClaimAllTypes,
NS_ENSURE_SUCCESS(rv, rv);
nsString brandShortName;
- brandBundle->GetStringFromName(MOZ_UTF16("brandShortName"),
+ brandBundle->GetStringFromName(u"brandShortName",
getter_Copies(brandShortName));
// use brandShortName as the application id.
@@ -312,41 +312,14 @@ nsGNOMEShellService::SetDefaultBrowser(bool aClaimAllTypes,
}
}
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGNOMEShellService::GetShouldCheckDefaultBrowser(bool* aResult)
-{
- // If we've already checked, the browser has been started and this is a
- // new window open, and we don't want to check again.
- if (mCheckedThisSession) {
- *aResult = false;
- return NS_OK;
+ nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
+ if (prefs) {
+ (void) prefs->SetBoolPref(PREF_CHECKDEFAULTBROWSER, true);
+ // Reset the number of times the dialog should be shown
+ // before it is silenced.
+ (void) prefs->SetIntPref(PREF_DEFAULTBROWSERCHECKCOUNT, 0);
}
- nsCOMPtr<nsIPrefBranch> prefs;
- nsCOMPtr<nsIPrefService> pserve(do_GetService(NS_PREFSERVICE_CONTRACTID));
- if (pserve)
- pserve->GetBranch("", getter_AddRefs(prefs));
-
- if (prefs)
- prefs->GetBoolPref(PREF_CHECKDEFAULTBROWSER, aResult);
-
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsGNOMEShellService::SetShouldCheckDefaultBrowser(bool aShouldCheck)
-{
- nsCOMPtr<nsIPrefBranch> prefs;
- nsCOMPtr<nsIPrefService> pserve(do_GetService(NS_PREFSERVICE_CONTRACTID));
- if (pserve)
- pserve->GetBranch("", getter_AddRefs(prefs));
-
- if (prefs)
- prefs->SetBoolPref(PREF_CHECKDEFAULTBROWSER, aShouldCheck);
-
return NS_OK;
}
@@ -386,7 +359,7 @@ WriteImage(const nsCString& aPath, imgIContainer* aImage)
return res ? NS_OK : NS_ERROR_FAILURE;
#endif
}
-
+
NS_IMETHODIMP
nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement,
int32_t aPosition)
@@ -407,15 +380,15 @@ nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement,
// Set desktop wallpaper filling style
nsAutoCString options;
if (aPosition == BACKGROUND_TILE)
- options.Assign("wallpaper");
+ options.AssignLiteral("wallpaper");
else if (aPosition == BACKGROUND_STRETCH)
- options.Assign("stretched");
+ options.AssignLiteral("stretched");
else if (aPosition == BACKGROUND_FILL)
- options.Assign("zoom");
+ options.AssignLiteral("zoom");
else if (aPosition == BACKGROUND_FIT)
- options.Assign("scaled");
+ options.AssignLiteral("scaled");
else
- options.Assign("centered");
+ options.AssignLiteral("centered");
// Write the background file to the home directory.
nsAutoCString filePath(PR_GetEnv("HOME"));
@@ -429,7 +402,7 @@ nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement,
rv = bundleService->CreateBundle(BRAND_PROPERTIES,
getter_AddRefs(brandBundle));
if (NS_SUCCEEDED(rv) && brandBundle) {
- rv = brandBundle->GetStringFromName(MOZ_UTF16("brandShortName"),
+ rv = brandBundle->GetStringFromName(u"brandShortName",
getter_Copies(brandName));
NS_ENSURE_SUCCESS(rv, rv);
}
@@ -438,7 +411,7 @@ nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement,
// build the file name
filePath.Append('/');
filePath.Append(NS_ConvertUTF16toUTF8(brandName));
- filePath.Append("_wallpaper.png");
+ filePath.AppendLiteral("_wallpaper.png");
// write the image to a file in the home dir
rv = WriteImage(filePath, container);
@@ -478,7 +451,7 @@ nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement,
// Set the image to an empty string first to force a refresh
// (since we could be writing a new image on top of an existing
- // Firefox_wallpaper.png and nautilus doesn't monitor the file for changes)
+ // PaleMoon_wallpaper.png and nautilus doesn't monitor the file for changes)
gconf->SetString(NS_LITERAL_CSTRING(kDesktopImageKey),
EmptyCString());
@@ -543,7 +516,7 @@ ColorToCString(uint32_t aColor, nsCString& aResult)
uint16_t green = COLOR_8_TO_16_BIT((aColor >> 8) & 0xff);
uint16_t blue = COLOR_8_TO_16_BIT(aColor & 0xff);
- PR_snprintf(buf, 14, "#%04x%04x%04x", red, green, blue);
+ snprintf(buf, 14, "#%04x%04x%04x", red, green, blue);
}
NS_IMETHODIMP
@@ -580,9 +553,9 @@ nsGNOMEShellService::OpenApplication(int32_t aApplication)
{
nsAutoCString scheme;
if (aApplication == APPLICATION_MAIL)
- scheme.Assign("mailto");
+ scheme.AssignLiteral("mailto");
else if (aApplication == APPLICATION_NEWS)
- scheme.Assign("news");
+ scheme.AssignLiteral("news");
else
return NS_ERROR_NOT_AVAILABLE;
diff --git a/application/palemoon/components/shell/nsGNOMEShellService.h b/application/palemoon/components/shell/nsGNOMEShellService.h
index 36a4a0c420..a7b0038021 100644
--- a/application/palemoon/components/shell/nsGNOMEShellService.h
+++ b/application/palemoon/components/shell/nsGNOMEShellService.h
@@ -6,28 +6,28 @@
#ifndef nsgnomeshellservice_h____
#define nsgnomeshellservice_h____
-#include "nsIShellService.h"
+#include "nsIGNOMEShellService.h"
#include "nsStringAPI.h"
#include "mozilla/Attributes.h"
-class nsGNOMEShellService final : public nsIShellService
+class nsGNOMEShellService final : public nsIGNOMEShellService
{
public:
- nsGNOMEShellService() : mCheckedThisSession(false), mAppIsInPath(false) { }
+ nsGNOMEShellService() : mAppIsInPath(false) { }
NS_DECL_ISUPPORTS
NS_DECL_NSISHELLSERVICE
+ NS_DECL_NSIGNOMESHELLSERVICE
- nsresult Init() NS_HIDDEN;
+ nsresult Init();
private:
~nsGNOMEShellService() {}
- NS_HIDDEN_(bool) KeyMatchesAppName(const char *aKeyValue) const;
- NS_HIDDEN_(bool) CheckHandlerMatchesAppName(const nsACString& handler) const;
+ bool KeyMatchesAppName(const char *aKeyValue) const;
+ bool CheckHandlerMatchesAppName(const nsACString& handler) const;
- NS_HIDDEN_(bool) GetAppPathFromLauncher();
- bool mCheckedThisSession;
+ bool GetAppPathFromLauncher();
bool mUseLocaleFilenames;
nsCString mAppPath;
bool mAppIsInPath;
diff --git a/application/palemoon/components/shell/nsIGNOMEShellService.idl b/application/palemoon/components/shell/nsIGNOMEShellService.idl
new file mode 100644
index 0000000000..842ce5e8a7
--- /dev/null
+++ b/application/palemoon/components/shell/nsIGNOMEShellService.idl
@@ -0,0 +1,19 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsIShellService.idl"
+
+[scriptable, uuid(2ce5c803-edcd-443d-98eb-ceba86d02d13)]
+interface nsIGNOMEShellService : nsIShellService
+{
+ /**
+ * Used to determine whether or not to offer "Set as desktop background"
+ * functionality. Even if shell service is available it is not
+ * guaranteed that it is able to set the background for every desktop
+ * which is especially true for Linux with its many different desktop
+ * environments.
+ */
+ readonly attribute boolean canSetDesktopBackground;
+};
+
diff --git a/application/palemoon/components/shell/nsIMacShellService.idl b/application/palemoon/components/shell/nsIMacShellService.idl
index 3c2f42315d..6a532bbd0b 100644
--- a/application/palemoon/components/shell/nsIMacShellService.idl
+++ b/application/palemoon/components/shell/nsIMacShellService.idl
@@ -5,7 +5,7 @@
#include "nsIShellService.idl"
-[scriptable, uuid(7f8ca08e-1df4-4735-86e9-50dedb48e5e8)]
+[scriptable, uuid(387fdc80-0077-4b60-a0d9-d9e80a83ba64)]
interface nsIMacShellService : nsIShellService
{
const long APPLICATION_KEYCHAIN_ACCESS = 2;
diff --git a/application/palemoon/components/shell/nsIShellService.idl b/application/palemoon/components/shell/nsIShellService.idl
index 4825741b3e..3e7e94b00a 100644
--- a/application/palemoon/components/shell/nsIShellService.idl
+++ b/application/palemoon/components/shell/nsIShellService.idl
@@ -8,7 +8,7 @@
interface nsIDOMElement;
interface nsIFile;
-[scriptable, uuid(99d2e9f1-3c86-40f7-81fd-3060c18489f0)]
+[scriptable, uuid(2d1a95e4-5bd8-4eeb-b0a8-c1455fd2a357)]
interface nsIShellService : nsISupports
{
/**
@@ -39,23 +39,6 @@ interface nsIShellService : nsISupports
void setDefaultBrowser(in boolean aClaimAllTypes, in boolean aForAllUsers);
/**
- * Used to determine whether or not to show a "Set Default Browser"
- * query dialog. This attribute is true if the application is starting
- * up and "browser.shell.checkDefaultBrowser" is true, otherwise it
- * is false.
- */
- attribute boolean shouldCheckDefaultBrowser;
-
- /**
- * Used to determine whether or not to offer "Set as desktop background"
- * functionality. Even if shell service is available it is not
- * guaranteed that it is able to set the background for every desktop
- * which is especially true for Linux with its many different desktop
- * environments.
- */
- readonly attribute boolean canSetDesktopBackground;
-
- /**
* Flags for positioning/sizing of the Desktop Background image.
*/
const long BACKGROUND_TILE = 1;
diff --git a/application/palemoon/components/shell/nsIWindowsShellService.idl b/application/palemoon/components/shell/nsIWindowsShellService.idl
index 913eb42929..57ed370555 100644
--- a/application/palemoon/components/shell/nsIWindowsShellService.idl
+++ b/application/palemoon/components/shell/nsIWindowsShellService.idl
@@ -5,7 +5,7 @@
#include "nsIShellService.idl"
-[scriptable, uuid(89b0a761-d9a0-4c39-ab83-d81566459a31)]
+[scriptable, uuid(f8a26b94-49e5-4441-8fbc-315e0b4f22ef)]
interface nsIWindowsShellService : nsIShellService
{
/**
diff --git a/application/palemoon/components/shell/nsMacShellService.cpp b/application/palemoon/components/shell/nsMacShellService.cpp
index 914b9ae653..d8d64039d3 100644
--- a/application/palemoon/components/shell/nsMacShellService.cpp
+++ b/application/palemoon/components/shell/nsMacShellService.cpp
@@ -17,13 +17,13 @@
#include "nsIURL.h"
#include "nsIWebBrowserPersist.h"
#include "nsMacShellService.h"
-#include "nsNetUtil.h"
+#include "nsIProperties.h"
+#include "nsServiceManagerUtils.h"
#include "nsShellService.h"
#include "nsStringAPI.h"
#include "nsIDocShell.h"
#include "nsILoadContext.h"
-
#include <CoreFoundation/CoreFoundation.h>
#include <ApplicationServices/ApplicationServices.h>
@@ -49,19 +49,14 @@ nsMacShellService::IsDefaultBrowser(bool aStartupCheck,
return NS_ERROR_FAILURE;
}
- // Get the default http handler's bundle ID (or nullptr if it has not been explicitly set)
+ // Get the default http handler's bundle ID (or nullptr if it has not been
+ // explicitly set)
CFStringRef defaultBrowserID = ::LSCopyDefaultHandlerForURLScheme(CFSTR("http"));
if (defaultBrowserID) {
*aIsDefaultBrowser = ::CFStringCompare(firefoxID, defaultBrowserID, 0) == kCFCompareEqualTo;
::CFRelease(defaultBrowserID);
}
- // If this is the first browser window, maintain internal state that we've
- // checked this session (so that subsequent window opens don't show the
- // default browser dialog).
- if (aStartupCheck)
- mCheckedThisSession = true;
-
return NS_OK;
}
@@ -90,47 +85,15 @@ nsMacShellService::SetDefaultBrowser(bool aClaimAllTypes, bool aForAllUsers)
return NS_ERROR_FAILURE;
}
}
-
- return NS_OK;
-}
-NS_IMETHODIMP
-nsMacShellService::GetShouldCheckDefaultBrowser(bool* aResult)
-{
- // If we've already checked, the browser has been started and this is a
- // new window open, and we don't want to check again.
- if (mCheckedThisSession) {
- *aResult = false;
- return NS_OK;
+ nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
+ if (prefs) {
+ (void) prefs->SetBoolPref(PREF_CHECKDEFAULTBROWSER, true);
+ // Reset the number of times the dialog should be shown
+ // before it is silenced.
+ (void) prefs->SetIntPref(PREF_DEFAULTBROWSERCHECKCOUNT, 0);
}
- nsCOMPtr<nsIPrefBranch> prefs;
- nsCOMPtr<nsIPrefService> pserve(do_GetService(NS_PREFSERVICE_CONTRACTID));
- if (pserve)
- pserve->GetBranch("", getter_AddRefs(prefs));
-
- prefs->GetBoolPref(PREF_CHECKDEFAULTBROWSER, aResult);
-
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsMacShellService::SetShouldCheckDefaultBrowser(bool aShouldCheck)
-{
- nsCOMPtr<nsIPrefBranch> prefs;
- nsCOMPtr<nsIPrefService> pserve(do_GetService(NS_PREFSERVICE_CONTRACTID));
- if (pserve)
- pserve->GetBranch("", getter_AddRefs(prefs));
-
- prefs->SetBoolPref(PREF_CHECKDEFAULTBROWSER, aShouldCheck);
-
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsMacShellService::GetCanSetDesktopBackground(bool* aResult)
-{
- *aResult = true;
return NS_OK;
}
@@ -202,8 +165,10 @@ nsMacShellService::SetDesktopBackground(nsIDOMElement* aElement,
loadContext = do_QueryInterface(docShell);
}
- return wbp->SaveURI(imageURI, nullptr, docURI, content->OwnerDoc()->GetReferrerPolicy(),
- nullptr, nullptr, mBackgroundFile, loadContext);
+ return wbp->SaveURI(imageURI, nullptr,
+ docURI, content->OwnerDoc()->GetReferrerPolicy(),
+ nullptr, nullptr,
+ mBackgroundFile, loadContext);
}
NS_IMETHODIMP
@@ -269,7 +234,8 @@ nsMacShellService::OnStateChange(nsIWebProgress* aWebProgress,
OSStatus status;
// Convert the path into a FSRef
- status = ::FSPathMakeRef((const UInt8*)nativePath.get(), &pictureRef, nullptr);
+ status = ::FSPathMakeRef((const UInt8*)nativePath.get(), &pictureRef,
+ nullptr);
if (status == noErr) {
err = ::FSNewAlias(nil, &pictureRef, &aliasHandle);
if (err == noErr && aliasHandle == nil)
@@ -336,8 +302,8 @@ nsMacShellService::OpenApplication(int32_t aApplication)
}
break;
case nsIMacShellService::APPLICATION_KEYCHAIN_ACCESS:
- err = ::LSGetApplicationForInfo('APPL', 'kcmr', nullptr, kLSRolesAll, nullptr,
- &appURL);
+ err = ::LSGetApplicationForInfo('APPL', 'kcmr', nullptr, kLSRolesAll,
+ nullptr, &appURL);
break;
case nsIMacShellService::APPLICATION_NETWORK:
{
@@ -349,8 +315,7 @@ nsMacShellService::OpenApplication(int32_t aApplication)
if (!exists)
return NS_ERROR_FILE_NOT_FOUND;
return lf->Launch();
- }
- break;
+ }
case nsIMacShellService::APPLICATION_DESKTOP:
{
nsCOMPtr<nsIFile> lf;
@@ -361,8 +326,7 @@ nsMacShellService::OpenApplication(int32_t aApplication)
if (!exists)
return NS_ERROR_FILE_NOT_FOUND;
return lf->Launch();
- }
- break;
+ }
}
if (appURL && err == noErr) {
diff --git a/application/palemoon/components/shell/nsMacShellService.h b/application/palemoon/components/shell/nsMacShellService.h
index 7ca1c71ac3..db95278092 100644
--- a/application/palemoon/components/shell/nsMacShellService.h
+++ b/application/palemoon/components/shell/nsMacShellService.h
@@ -15,7 +15,7 @@ class nsMacShellService : public nsIMacShellService,
public nsIWebProgressListener
{
public:
- nsMacShellService() : mCheckedThisSession(false) {};
+ nsMacShellService() {};
NS_DECL_ISUPPORTS
NS_DECL_NSISHELLSERVICE
@@ -27,8 +27,6 @@ protected:
private:
nsCOMPtr<nsIFile> mBackgroundFile;
-
- bool mCheckedThisSession;
};
#endif // nsmacshellservice_h____
diff --git a/application/palemoon/components/shell/nsSetDefaultBrowser.js b/application/palemoon/components/shell/nsSetDefaultBrowser.js
index d1d1e72cb6..c7a78c5388 100644
--- a/application/palemoon/components/shell/nsSetDefaultBrowser.js
+++ b/application/palemoon/components/shell/nsSetDefaultBrowser.js
@@ -2,13 +2,14 @@
* 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/. */
-/*
- * -setDefaultBrowser commandline handler
+/*
+ * --setDefaultBrowser commandline handler
* Makes the current executable the "default browser".
*/
const Cc = Components.classes;
const Ci = Components.interfaces;
+Components.utils.import("resource:///modules/ShellService.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
function nsSetDefaultBrowser() {}
@@ -16,13 +17,11 @@ function nsSetDefaultBrowser() {}
nsSetDefaultBrowser.prototype = {
handle: function nsSetDefault_handle(aCmdline) {
if (aCmdline.handleFlag("setDefaultBrowser", false)) {
- var shell = Cc["@mozilla.org/browser/shell-service;1"].
- getService(Ci.nsIShellService);
- shell.setDefaultBrowser(true, true);
+ ShellService.setDefaultBrowser(true, true);
}
},
- helpInfo: " -setDefaultBrowser Set this app as the default browser.\n",
+ helpInfo: " --setDefaultBrowser Set this app as the default browser.\n",
classID: Components.ID("{F57899D0-4E2C-4ac6-9E29-50C736103B0C}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsICommandLineHandler]),
diff --git a/application/palemoon/components/shell/nsShellService.h b/application/palemoon/components/shell/nsShellService.h
index d5fade37bb..516a8423ab 100644
--- a/application/palemoon/components/shell/nsShellService.h
+++ b/application/palemoon/components/shell/nsShellService.h
@@ -4,6 +4,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#define PREF_CHECKDEFAULTBROWSER "browser.shell.checkDefaultBrowser"
+#define PREF_SKIPDEFAULTBROWSERCHECK "browser.shell.skipDefaultBrowserCheck"
+#define PREF_DEFAULTBROWSERCHECKCOUNT "browser.shell.defaultBrowserCheckCount"
#define SHELLSERVICE_PROPERTIES "chrome://browser/locale/shellservice.properties"
#define BRAND_PROPERTIES "chrome://branding/locale/brand.properties"
diff --git a/application/palemoon/components/shell/nsWindowsShellService.cpp b/application/palemoon/components/shell/nsWindowsShellService.cpp
index 813ec4fe12..c4039b95a3 100644
--- a/application/palemoon/components/shell/nsWindowsShellService.cpp
+++ b/application/palemoon/components/shell/nsWindowsShellService.cpp
@@ -3,6 +3,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+#include "nsWindowsShellService.h"
+
#include "imgIContainer.h"
#include "imgIRequest.h"
#include "mozilla/gfx/2D.h"
@@ -15,8 +17,8 @@
#include "nsIServiceManager.h"
#include "nsIStringBundle.h"
#include "nsNetUtil.h"
+#include "nsServiceManagerUtils.h"
#include "nsShellService.h"
-#include "nsWindowsShellService.h"
#include "nsIProcess.h"
#include "nsICategoryManager.h"
#include "nsBrowserCompsCID.h"
@@ -27,6 +29,7 @@
#include "nsUnicharUtils.h"
#include "nsIWinTaskbar.h"
#include "nsISupportsPrimitives.h"
+#include "nsIURLFormatter.h"
#include "nsThreadUtils.h"
#include "nsXULAppAPI.h"
#include "mozilla/WindowsVersion.h"
@@ -47,6 +50,9 @@
#include <mbstring.h>
#include <shlwapi.h>
+#include <lm.h>
+#undef ACCESS_READ
+
#ifndef MAX_BUF
#define MAX_BUF 4096
#endif
@@ -129,7 +135,7 @@ OpenKeyForReading(HKEY aKeyRoot, const nsAString& aKeyName, HKEY* aKey)
// The following keys are set to make PaleMoon appear in the Start Menu as the
// browser:
//
-// HKCU\SOFTWARE\Clients\StartMenuInternet\FIREFOX.EXE\
+// HKCU\SOFTWARE\Clients\StartMenuInternet\PaleMoon.EXE\
// (default) REG_SZ <appname>
// DefaultIcon (default) REG_SZ <apppath>,0
// InstallInfo HideIconsCommand REG_SZ <uninstpath> /HideShortcuts
@@ -278,20 +284,15 @@ nsWindowsShellService::ShortcutMaintenance()
return NS_ERROR_UNEXPECTED;
NS_NAMED_LITERAL_CSTRING(prefName, "browser.taskbar.lastgroupid");
- nsCOMPtr<nsIPrefService> prefs =
+ nsCOMPtr<nsIPrefBranch> prefs =
do_GetService(NS_PREFSERVICE_CONTRACTID);
if (!prefs)
return NS_ERROR_UNEXPECTED;
- nsCOMPtr<nsIPrefBranch> prefBranch;
- prefs->GetBranch(nullptr, getter_AddRefs(prefBranch));
- if (!prefBranch)
- return NS_ERROR_UNEXPECTED;
-
nsCOMPtr<nsISupportsString> prefString;
- rv = prefBranch->GetComplexValue(prefName.get(),
- NS_GET_IID(nsISupportsString),
- getter_AddRefs(prefString));
+ rv = prefs->GetComplexValue(prefName.get(),
+ NS_GET_IID(nsISupportsString),
+ getter_AddRefs(prefString));
if (NS_SUCCEEDED(rv)) {
nsAutoString version;
prefString->GetData(version);
@@ -307,9 +308,9 @@ nsWindowsShellService::ShortcutMaintenance()
return rv;
prefString->SetData(appId);
- rv = prefBranch->SetComplexValue(prefName.get(),
- NS_GET_IID(nsISupportsString),
- prefString);
+ rv = prefs->SetComplexValue(prefName.get(),
+ NS_GET_IID(nsISupportsString),
+ prefString);
if (NS_FAILED(rv)) {
NS_WARNING("Couldn't set last user model id!");
return NS_ERROR_UNEXPECTED;
@@ -325,38 +326,47 @@ nsWindowsShellService::ShortcutMaintenance()
}
static bool
-IsAARDefaultHTTP(IApplicationAssociationRegistration* pAAR,
- bool* aIsDefaultBrowser)
+IsAARDefault(const RefPtr<IApplicationAssociationRegistration>& pAAR,
+ LPCWSTR aClassName)
{
// Make sure the Prog ID matches what we have
LPWSTR registeredApp;
- HRESULT hr = pAAR->QueryCurrentDefault(L"http", AT_URLPROTOCOL, AL_EFFECTIVE,
+ bool isProtocol = *aClassName != L'.';
+ ASSOCIATIONTYPE queryType = isProtocol ? AT_URLPROTOCOL : AT_FILEEXTENSION;
+ HRESULT hr = pAAR->QueryCurrentDefault(aClassName, queryType, AL_EFFECTIVE,
&registeredApp);
- if (SUCCEEDED(hr)) {
- LPCWSTR firefoxHTTPProgID = L"PaleMoonURL";
- *aIsDefaultBrowser = !wcsicmp(registeredApp, firefoxHTTPProgID);
- CoTaskMemFree(registeredApp);
- } else {
- *aIsDefaultBrowser = false;
+ if (FAILED(hr)) {
+ return false;
}
- return SUCCEEDED(hr);
+
+ LPCWSTR progID = isProtocol ? L"PaleMoonURL" : L"PaleMoonHTML";
+ bool isDefault = !wcsicmp(registeredApp, progID);
+ CoTaskMemFree(registeredApp);
+
+ return isDefault;
}
-static bool
-IsAARDefaultHTML(IApplicationAssociationRegistration* pAAR,
- bool* aIsDefaultBrowser)
+static void
+IsDefaultBrowserWin8(bool aCheckAllTypes, bool* aIsDefaultBrowser)
{
- LPWSTR registeredApp;
- HRESULT hr = pAAR->QueryCurrentDefault(L".html", AT_FILEEXTENSION, AL_EFFECTIVE,
- &registeredApp);
- if (SUCCEEDED(hr)) {
- LPCWSTR firefoxHTMLProgID = L"PaleMoonHTML";
- *aIsDefaultBrowser = !wcsicmp(registeredApp, firefoxHTMLProgID);
- CoTaskMemFree(registeredApp);
- } else {
- *aIsDefaultBrowser = false;
+ RefPtr<IApplicationAssociationRegistration> pAAR;
+ HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistration,
+ nullptr,
+ CLSCTX_INPROC,
+ IID_IApplicationAssociationRegistration,
+ getter_AddRefs(pAAR));
+ if (FAILED(hr)) {
+ return;
+ }
+
+ bool res = IsAARDefault(pAAR, L"http");
+ if (*aIsDefaultBrowser) {
+ *aIsDefaultBrowser = res;
+ }
+ res = IsAARDefault(pAAR, L".html");
+ if (*aIsDefaultBrowser && aCheckAllTypes) {
+ *aIsDefaultBrowser = res;
}
- return SUCCEEDED(hr);
}
/*
@@ -369,37 +379,27 @@ bool
nsWindowsShellService::IsDefaultBrowserVista(bool aCheckAllTypes,
bool* aIsDefaultBrowser)
{
- IApplicationAssociationRegistration* pAAR;
+ RefPtr<IApplicationAssociationRegistration> pAAR;
HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistration,
nullptr,
CLSCTX_INPROC,
IID_IApplicationAssociationRegistration,
- (void**)&pAAR);
-
- if (SUCCEEDED(hr)) {
- if (aCheckAllTypes) {
- BOOL res;
- hr = pAAR->QueryAppIsDefaultAll(AL_EFFECTIVE,
- APP_REG_NAME,
- &res);
- *aIsDefaultBrowser = res;
-
- // If we have all defaults, let's make sure that our ProgID
- // is explicitly returned as well. Needed only for Windows 8.
- if (*aIsDefaultBrowser && IsWin8OrLater()) {
- IsAARDefaultHTTP(pAAR, aIsDefaultBrowser);
- if (*aIsDefaultBrowser) {
- IsAARDefaultHTML(pAAR, aIsDefaultBrowser);
- }
- }
- } else {
- IsAARDefaultHTTP(pAAR, aIsDefaultBrowser);
- }
+ getter_AddRefs(pAAR));
+ if (FAILED(hr)) {
+ return false;
+ }
- pAAR->Release();
- return true;
+ if (aCheckAllTypes) {
+ BOOL res;
+ hr = pAAR->QueryAppIsDefaultAll(AL_EFFECTIVE,
+ APP_REG_NAME,
+ &res);
+ *aIsDefaultBrowser = res;
+ } else if (!IsWin8OrLater()) {
+ *aIsDefaultBrowser = IsAARDefault(pAAR, L"http");
}
- return false;
+
+ return true;
}
NS_IMETHODIMP
@@ -407,12 +407,6 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
bool aForAllTypes,
bool* aIsDefaultBrowser)
{
- // If this is the first browser window, maintain internal state that we've
- // checked this session (so that subsequent window opens don't show the
- // default browser dialog).
- if (aStartupCheck)
- mCheckedThisSession = true;
-
// Assume we're the default unless one of the several checks below tell us
// otherwise.
*aIsDefaultBrowser = true;
@@ -499,6 +493,9 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
// previous checks show that PaleMoon is the default browser.
if (*aIsDefaultBrowser) {
IsDefaultBrowserVista(aForAllTypes, aIsDefaultBrowser);
+ if (IsWin8OrLater()) {
+ IsDefaultBrowserWin8(aForAllTypes, aIsDefaultBrowser);
+ }
}
// To handle the case where DDE isn't disabled due for a user because there
@@ -603,13 +600,6 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
return NS_OK;
}
-NS_IMETHODIMP
-nsWindowsShellService::GetCanSetDesktopBackground(bool* aResult)
-{
- *aResult = true;
- return NS_OK;
-}
-
static nsresult
DynSHOpenWithDialog(HWND hwndParent, const OPENASINFO *poainfo)
{
@@ -628,14 +618,34 @@ DynSHOpenWithDialog(HWND hwndParent, const OPENASINFO *poainfo)
return NS_ERROR_FAILURE;
}
- nsresult rv =
- SUCCEEDED(SHOpenWithDialogFn(hwndParent, poainfo)) ? NS_OK :
- NS_ERROR_FAILURE;
+ nsresult rv;
+ HRESULT hr = SHOpenWithDialogFn(hwndParent, poainfo);
+ if (SUCCEEDED(hr) || (hr == HRESULT_FROM_WIN32(ERROR_CANCELLED))) {
+ rv = NS_OK;
+ } else {
+ rv = NS_ERROR_FAILURE;
+ }
FreeLibrary(shellDLL);
return rv;
}
nsresult
+nsWindowsShellService::LaunchControlPanelDefaultsSelectionUI()
+{
+ IApplicationAssociationRegistrationUI* pAARUI;
+ HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistrationUI,
+ NULL,
+ CLSCTX_INPROC,
+ IID_IApplicationAssociationRegistrationUI,
+ (void**)&pAARUI);
+ if (SUCCEEDED(hr)) {
+ hr = pAARUI->LaunchAdvancedAssociationUI(APP_REG_NAME);
+ pAARUI->Release();
+ }
+ return SUCCEEDED(hr) ? NS_OK : NS_ERROR_FAILURE;
+}
+
+nsresult
nsWindowsShellService::LaunchControlPanelDefaultPrograms()
{
// Build the path control.exe path safely
@@ -651,7 +661,8 @@ nsWindowsShellService::LaunchControlPanelDefaultPrograms()
return NS_ERROR_FAILURE;
}
- WCHAR params[] = L"control.exe /name Microsoft.DefaultPrograms /page pageDefaultProgram";
+ WCHAR params[] = L"control.exe /name Microsoft.DefaultPrograms /page "
+ "pageDefaultProgram\\pageAdvancedSettings?pszAppName=" APP_REG_NAME;
STARTUPINFOW si = {sizeof(si), 0};
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_SHOWDEFAULT;
@@ -666,9 +677,62 @@ nsWindowsShellService::LaunchControlPanelDefaultPrograms()
return NS_OK;
}
+static bool
+IsWindowsLogonConnected()
+{
+ WCHAR userName[UNLEN + 1];
+ DWORD size = ArrayLength(userName);
+ if (!GetUserNameW(userName, &size)) {
+ return false;
+ }
+
+ LPUSER_INFO_24 info;
+ if (NetUserGetInfo(nullptr, userName, 24, (LPBYTE *)&info)
+ != NERR_Success) {
+ return false;
+ }
+ bool connected = info->usri24_internet_identity;
+ NetApiBufferFree(info);
+
+ return connected;
+}
+
+static bool
+SettingsAppBelievesConnected()
+{
+ nsresult rv;
+ nsCOMPtr<nsIWindowsRegKey> regKey =
+ do_CreateInstance("@mozilla.org/windows-registry-key;1", &rv);
+ if (NS_FAILED(rv)) {
+ return false;
+ }
+
+ rv = regKey->Open(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER,
+ NS_LITERAL_STRING("SOFTWARE\\Microsoft\\Windows\\Shell\\Associations"),
+ nsIWindowsRegKey::ACCESS_READ);
+ if (NS_FAILED(rv)) {
+ return false;
+ }
+
+ uint32_t value;
+ rv = regKey->ReadIntValue(NS_LITERAL_STRING("IsConnectedAtLogon"), &value);
+ if (NS_FAILED(rv)) {
+ return false;
+ }
+
+ return !!value;
+}
+
nsresult
nsWindowsShellService::LaunchModernSettingsDialogDefaultApps()
{
+ if (!IsWindowsBuildOrLater(14965) &&
+ !IsWindowsLogonConnected() && SettingsAppBelievesConnected()) {
+ // Use the classic Control Panel to work around a bug of older
+ // builds of Windows 10.
+ return LaunchControlPanelDefaultPrograms();
+ }
+
IApplicationActivationManager* pActivator;
HRESULT hr = CoCreateInstance(CLSID_ApplicationActivationManager,
nullptr,
@@ -682,6 +746,15 @@ nsWindowsShellService::LaunchModernSettingsDialogDefaultApps()
L"windows.immersivecontrolpanel_cw5n1h2txyewy"
L"!microsoft.windows.immersivecontrolpanel",
L"page=SettingsPageAppsDefaults", AO_NONE, &pid);
+ if (SUCCEEDED(hr)) {
+ // Do not check error because we could at least open
+ // the "Default apps" setting.
+ pActivator->ActivateApplication(
+ L"windows.immersivecontrolpanel_cw5n1h2txyewy"
+ L"!microsoft.windows.immersivecontrolpanel",
+ L"page=SettingsPageAppsDefaults"
+ L"&target=SystemSettings_DefaultApps_Browser", AO_NONE, &pid);
+ }
pActivator->Release();
return SUCCEEDED(hr) ? NS_OK : NS_ERROR_FAILURE;
}
@@ -689,6 +762,36 @@ nsWindowsShellService::LaunchModernSettingsDialogDefaultApps()
}
nsresult
+nsWindowsShellService::InvokeHTTPOpenAsVerb()
+{
+ nsCOMPtr<nsIURLFormatter> formatter(
+ do_GetService("@mozilla.org/toolkit/URLFormatterService;1"));
+ if (!formatter) {
+ return NS_ERROR_UNEXPECTED;
+ }
+
+ nsString urlStr;
+ nsresult rv = formatter->FormatURLPref(
+ NS_LITERAL_STRING("app.support.baseURL"), urlStr);
+ if (NS_FAILED(rv)) {
+ return rv;
+ }
+ if (!StringBeginsWith(urlStr, NS_LITERAL_STRING("https://"))) {
+ return NS_ERROR_FAILURE;
+ }
+ urlStr.AppendLiteral("win10-default-browser");
+
+ SHELLEXECUTEINFOW seinfo = { sizeof(SHELLEXECUTEINFOW) };
+ seinfo.lpVerb = L"openas";
+ seinfo.lpFile = urlStr.get();
+ seinfo.nShow = SW_SHOWNORMAL;
+ if (!ShellExecuteExW(&seinfo)) {
+ return NS_ERROR_FAILURE;
+ }
+ return NS_OK;
+}
+
+nsresult
nsWindowsShellService::LaunchHTTPHandlerPane()
{
OPENASINFO info;
@@ -716,16 +819,23 @@ nsWindowsShellService::SetDefaultBrowser(bool aClaimAllTypes, bool aForAllUsers)
nsresult rv = LaunchHelper(appHelperPath);
if (NS_SUCCEEDED(rv) && IsWin8OrLater()) {
if (aClaimAllTypes) {
- rv = LaunchControlPanelDefaultPrograms();
+ if (IsWin10OrLater()) {
+ rv = LaunchModernSettingsDialogDefaultApps();
+ } else {
+ rv = LaunchControlPanelDefaultsSelectionUI();
+ }
// The above call should never really fail, but just in case
// fall back to showing the HTTP association screen only.
if (NS_FAILED(rv)) {
- rv = LaunchHTTPHandlerPane();
+ if (IsWin10OrLater()) {
+ rv = InvokeHTTPOpenAsVerb();
+ } else {
+ rv = LaunchHTTPHandlerPane();
+ }
}
} else {
- // Windows 10 blocks attempts to load the HTTP Handler
- // association dialog, so the modern Settings dialog
- // is opened with the Default Apps view loaded.
+ // Windows 10 blocks attempts to load the
+ // HTTP Handler association dialog.
if (IsWin10OrLater()) {
rv = LaunchModernSettingsDialogDefaultApps();
} else {
@@ -735,50 +845,20 @@ nsWindowsShellService::SetDefaultBrowser(bool aClaimAllTypes, bool aForAllUsers)
// The above call should never really fail, but just in case
// fall back to showing control panel for all defaults
if (NS_FAILED(rv)) {
- rv = LaunchControlPanelDefaultPrograms();
+ rv = LaunchControlPanelDefaultsSelectionUI();
}
}
}
- return rv;
-}
-
-NS_IMETHODIMP
-nsWindowsShellService::GetShouldCheckDefaultBrowser(bool* aResult)
-{
- NS_ENSURE_ARG_POINTER(aResult);
-
- // If we've already checked, the browser has been started and this is a
- // new window open, and we don't want to check again.
- if (mCheckedThisSession) {
- *aResult = false;
- return NS_OK;
+ nsCOMPtr<nsIPrefBranch> prefs(do_GetService(NS_PREFSERVICE_CONTRACTID));
+ if (prefs) {
+ (void) prefs->SetBoolPref(PREF_CHECKDEFAULTBROWSER, true);
+ // Reset the number of times the dialog should be shown
+ // before it is silenced.
+ (void) prefs->SetIntPref(PREF_DEFAULTBROWSERCHECKCOUNT, 0);
}
- nsCOMPtr<nsIPrefBranch> prefs;
- nsresult rv;
- nsCOMPtr<nsIPrefService> pserve(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
- NS_ENSURE_SUCCESS(rv, rv);
-
- rv = pserve->GetBranch("", getter_AddRefs(prefs));
- NS_ENSURE_SUCCESS(rv, rv);
-
- return prefs->GetBoolPref(PREF_CHECKDEFAULTBROWSER, aResult);
-}
-
-NS_IMETHODIMP
-nsWindowsShellService::SetShouldCheckDefaultBrowser(bool aShouldCheck)
-{
- nsCOMPtr<nsIPrefBranch> prefs;
- nsresult rv;
-
- nsCOMPtr<nsIPrefService> pserve(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
- NS_ENSURE_SUCCESS(rv, rv);
-
- rv = pserve->GetBranch("", getter_AddRefs(prefs));
- NS_ENSURE_SUCCESS(rv, rv);
-
- return prefs->SetBoolPref(PREF_CHECKDEFAULTBROWSER, aShouldCheck);
+ return rv;
}
static nsresult
@@ -912,7 +992,7 @@ nsWindowsShellService::SetDesktopBackground(nsIDOMElement* aElement,
// e.g. "Desktop Background.bmp"
nsString fileLeafName;
rv = shellBundle->GetStringFromName
- (MOZ_UTF16("desktopBackgroundLeafNameWin"),
+ (u"desktopBackgroundLeafNameWin",
getter_Copies(fileLeafName));
NS_ENSURE_SUCCESS(rv, rv);
@@ -948,24 +1028,24 @@ nsWindowsShellService::SetDesktopBackground(nsIDOMElement* aElement,
nsAutoString style;
switch (aPosition) {
case BACKGROUND_TILE:
- style.AssignLiteral("0");
- tile.AssignLiteral("1");
+ style.Assign('0');
+ tile.Assign('1');
break;
case BACKGROUND_CENTER:
- style.AssignLiteral("0");
- tile.AssignLiteral("0");
+ style.Assign('0');
+ tile.Assign('0');
break;
case BACKGROUND_STRETCH:
- style.AssignLiteral("2");
- tile.AssignLiteral("0");
+ style.Assign('2');
+ tile.Assign('0');
break;
case BACKGROUND_FILL:
style.AssignLiteral("10");
- tile.AssignLiteral("0");
+ tile.Assign('0');
break;
case BACKGROUND_FIT:
- style.AssignLiteral("6");
- tile.AssignLiteral("0");
+ style.Assign('6');
+ tile.Assign('0');
break;
}
@@ -1023,7 +1103,7 @@ nsWindowsShellService::OpenApplication(int32_t aApplication)
::RegCloseKey(theKey);
// Find the "open" command
- application.AppendLiteral("\\");
+ application.Append('\\');
application.Append(buf);
application.AppendLiteral("\\shell\\open\\command");
@@ -1122,8 +1202,7 @@ nsWindowsShellService::SetDesktopBackgroundColor(uint32_t aColor)
return regKey->Close();
}
-nsWindowsShellService::nsWindowsShellService() :
- mCheckedThisSession(false)
+nsWindowsShellService::nsWindowsShellService()
{
}
diff --git a/application/palemoon/components/shell/nsWindowsShellService.h b/application/palemoon/components/shell/nsWindowsShellService.h
index f856ffd35b..06c6c3c9bb 100644
--- a/application/palemoon/components/shell/nsWindowsShellService.h
+++ b/application/palemoon/components/shell/nsWindowsShellService.h
@@ -16,9 +16,10 @@
class nsWindowsShellService : public nsIWindowsShellService
{
+ virtual ~nsWindowsShellService();
+
public:
nsWindowsShellService();
- virtual ~nsWindowsShellService();
NS_DECL_ISUPPORTS
NS_DECL_NSISHELLSERVICE
@@ -26,12 +27,11 @@ public:
protected:
bool IsDefaultBrowserVista(bool aCheckAllTypes, bool* aIsDefaultBrowser);
+ nsresult LaunchControlPanelDefaultsSelectionUI();
nsresult LaunchControlPanelDefaultPrograms();
nsresult LaunchModernSettingsDialogDefaultApps();
+ nsresult InvokeHTTPOpenAsVerb();
nsresult LaunchHTTPHandlerPane();
-
-private:
- bool mCheckedThisSession;
};
#endif // nswindowsshellservice_h____
diff --git a/application/palemoon/components/statusbar/Downloads.jsm b/application/palemoon/components/statusbar/Downloads.jsm
index 74bc421449..091fdad2e3 100644
--- a/application/palemoon/components/statusbar/Downloads.jsm
+++ b/application/palemoon/components/statusbar/Downloads.jsm
@@ -18,657 +18,657 @@ CU.import("resource://gre/modules/XPCOMUtils.jsm");
function S4EDownloadService(window, gBrowser, service, getters)
{
- this._window = window;
- this._gBrowser = gBrowser;
- this._service = service;
- this._getters = getters;
+ this._window = window;
+ this._gBrowser = gBrowser;
+ this._service = service;
+ this._getters = getters;
- this._handler = new JSTransferHandler(this._window, this);
+ this._handler = new JSTransferHandler(this._window, this);
}
S4EDownloadService.prototype =
{
- _window: null,
- _gBrowser: null,
- _service: null,
- _getters: null,
-
- _handler: null,
- _listening: false,
-
- _binding: false,
- _customizing: false,
-
- _lastTime: Infinity,
-
- _dlActive: false,
- _dlPaused: false,
- _dlFinished: false,
-
- _dlCountStr: null,
- _dlTimeStr: null,
-
- _dlProgressAvg: 0,
- _dlProgressMax: 0,
- _dlProgressMin: 0,
- _dlProgressType: "active",
-
- _dlNotifyTimer: 0,
- _dlNotifyGlowTimer: 0,
-
- init: function()
- {
- if(!this._getters.downloadButton)
- {
- this.uninit();
- return;
- }
-
- if(this._listening)
- {
- return;
- }
-
- this._handler.start();
- this._listening = true;
-
- this._lastTime = Infinity;
-
- this.updateBinding();
- this.updateStatus();
- },
-
- uninit: function()
- {
- if(!this._listening)
- {
- return;
- }
-
- this._listening = false;
- this._handler.stop();
-
- this.releaseBinding();
- },
-
- destroy: function()
- {
- this.uninit();
- this._handler.destroy();
-
- ["_window", "_gBrowser", "_service", "_getters", "_handler"].forEach(function(prop)
- {
- delete this[prop];
- }, this);
- },
-
- updateBinding: function()
- {
- if(!this._listening)
- {
- this.releaseBinding();
- return;
- }
-
- switch(this._service.downloadButtonAction)
- {
- case 1: // Default
- this.attachBinding();
- break;
- default:
- this.releaseBinding();
- break;
- }
- },
-
- attachBinding: function()
- {
- if(this._binding)
- {
- return;
- }
-
- let db = this._window.DownloadsButton;
-
- db._getAnchorS4EBackup = db.getAnchor;
- db.getAnchor = this.getAnchor.bind(this);
-
- db._releaseAnchorS4EBackup = db.releaseAnchor;
- db.releaseAnchor = function() {};
-
- this._binding = true;
- },
-
- releaseBinding: function()
- {
- if(!this._binding)
- {
- return;
- }
-
- let db = this._window.DownloadsButton;
-
- db.getAnchor = db._getAnchorS4EBackup;
- db.releaseAnchor = db._releaseAnchorS4EBackup;
-
- this._binding = false;
- },
-
- customizing: function(val)
- {
- this._customizing = val;
- },
-
- updateStatus: function(lastFinished)
- {
- if(!this._getters.downloadButton)
- {
- this.uninit();
- return;
- }
-
- let numActive = 0;
- let numPaused = 0;
- let activeTotalSize = 0;
- let activeTransferred = 0;
- let activeMaxProgress = -Infinity;
- let activeMinProgress = Infinity;
- let pausedTotalSize = 0;
- let pausedTransferred = 0;
- let pausedMaxProgress = -Infinity;
- let pausedMinProgress = Infinity;
- let maxTime = -Infinity;
-
- let dls = ((this.isPrivateWindow) ? this._handler.activePrivateEntries() : this._handler.activeEntries());
- for(let dl of dls)
- {
- if(dl.state == CI.nsIDownloadManager.DOWNLOAD_DOWNLOADING)
- {
- numActive++;
- if(dl.size > 0)
- {
- if(dl.speed > 0)
- {
- maxTime = Math.max(maxTime, (dl.size - dl.transferred) / dl.speed);
- }
-
- activeTotalSize += dl.size;
- activeTransferred += dl.transferred;
-
- let currentProgress = ((dl.transferred * 100) / dl.size);
- activeMaxProgress = Math.max(activeMaxProgress, currentProgress);
- activeMinProgress = Math.min(activeMinProgress, currentProgress);
- }
- }
- else if(dl.state == CI.nsIDownloadManager.DOWNLOAD_PAUSED)
- {
- numPaused++;
- if(dl.size > 0)
- {
- pausedTotalSize += dl.size;
- pausedTransferred += dl.transferred;
-
- let currentProgress = ((dl.transferred * 100) / dl.size);
- pausedMaxProgress = Math.max(pausedMaxProgress, currentProgress);
- pausedMinProgress = Math.min(pausedMinProgress, currentProgress);
- }
- }
- }
-
- if((numActive + numPaused) == 0)
- {
- this._dlActive = false;
- this._dlFinished = lastFinished;
- this.updateButton();
- this._lastTime = Infinity;
- return;
- }
-
- let dlPaused = (numActive == 0);
- let dlStatus = ((dlPaused) ? this._getters.strings.getString("pausedDownloads")
- : this._getters.strings.getString("activeDownloads"));
- let dlCount = ((dlPaused) ? numPaused : numActive);
- let dlTotalSize = ((dlPaused) ? pausedTotalSize : activeTotalSize);
- let dlTransferred = ((dlPaused) ? pausedTransferred : activeTransferred);
- let dlMaxProgress = ((dlPaused) ? pausedMaxProgress : activeMaxProgress);
- let dlMinProgress = ((dlPaused) ? pausedMinProgress : activeMinProgress);
- let dlProgressType = ((dlPaused) ? "paused" : "active");
-
- [this._dlTimeStr, this._lastTime] = DownloadUtils.getTimeLeft(maxTime, this._lastTime);
- this._dlCountStr = PluralForm.get(dlCount, dlStatus).replace("#1", dlCount);
- this._dlProgressAvg = ((dlTotalSize == 0) ? 100 : ((dlTransferred * 100) / dlTotalSize));
- this._dlProgressMax = ((dlTotalSize == 0) ? 100 : dlMaxProgress);
- this._dlProgressMin = ((dlTotalSize == 0) ? 100 : dlMinProgress);
- this._dlProgressType = dlProgressType + ((dlTotalSize == 0) ? "-unknown" : "");
- this._dlPaused = dlPaused;
- this._dlActive = true;
- this._dlFinished = false;
-
- this.updateButton();
- },
-
- updateButton: function()
- {
- let download_button = this._getters.downloadButton;
- let download_tooltip = this._getters.downloadButtonTooltip;
- let download_progress = this._getters.downloadButtonProgress;
- let download_label = this._getters.downloadButtonLabel;
- if(!download_button)
- {
- return;
- }
-
- if(!this._dlActive)
- {
- download_button.collapsed = true;
- download_label.value = download_tooltip.label = this._getters.strings.getString("noDownloads");
-
- download_progress.collapsed = true;
- download_progress.value = 0;
-
- if(this._dlFinished && this._handler.hasPBAPI && !this.isUIShowing)
- {
- this.callAttention(download_button);
- }
- return;
- }
-
- switch(this._service.downloadProgress)
- {
- case 2:
- download_progress.value = this._dlProgressMax;
- break;
- case 3:
- download_progress.value = this._dlProgressMin;
- break;
- default:
- download_progress.value = this._dlProgressAvg;
- break;
- }
- download_progress.setAttribute("pmType", this._dlProgressType);
- download_progress.collapsed = (this._service.downloadProgress == 0);
-
- download_label.value = this.buildString(this._service.downloadLabel);
- download_tooltip.label = this.buildString(this._service.downloadTooltip);
-
- this.clearAttention(download_button);
- download_button.collapsed = false;
- },
-
- callAttention: function(download_button)
- {
- if(this._dlNotifyGlowTimer != 0)
- {
- this._window.clearTimeout(this._dlNotifyGlowTimer);
- this._dlNotifyGlowTimer = 0;
- }
-
- download_button.setAttribute("attention", "true");
-
- if(this._service.downloadNotifyTimeout)
- {
- this._dlNotifyGlowTimer = this._window.setTimeout(function(self, button)
- {
- self._dlNotifyGlowTimer = 0;
- button.removeAttribute("attention");
- }, this._service.downloadNotifyTimeout, this, download_button);
- }
- },
-
- clearAttention: function(download_button)
- {
- if(this._dlNotifyGlowTimer != 0)
- {
- this._window.clearTimeout(this._dlNotifyGlowTimer);
- this._dlNotifyGlowTimer = 0;
- }
-
- download_button.removeAttribute("attention");
- },
-
- notify: function()
- {
- if(this._dlNotifyTimer == 0 && this._service.downloadNotifyAnimate)
- {
- let download_button_anchor = this._getters.downloadButtonAnchor;
- let download_notify_anchor = this._getters.downloadNotifyAnchor;
- if(download_button_anchor)
- {
- if(!download_notify_anchor.style.transform)
- {
- let bAnchorRect = download_button_anchor.getBoundingClientRect();
- let nAnchorRect = download_notify_anchor.getBoundingClientRect();
-
- let translateX = bAnchorRect.left - nAnchorRect.left;
- translateX += .5 * (bAnchorRect.width - nAnchorRect.width);
-
- let translateY = bAnchorRect.top - nAnchorRect.top;
- translateY += .5 * (bAnchorRect.height - nAnchorRect.height);
-
- download_notify_anchor.style.transform = "translate(" + translateX + "px, " + translateY + "px)";
- }
-
- download_notify_anchor.setAttribute("notification", "finish");
- this._dlNotifyTimer = this._window.setTimeout(function(self, anchor)
- {
- self._dlNotifyTimer = 0;
- anchor.removeAttribute("notification");
- anchor.style.transform = "";
- }, 1000, this, download_notify_anchor);
- }
- }
- },
-
- clearFinished: function()
- {
- this._dlFinished = false;
- let download_button = this._getters.downloadButton;
- if(download_button)
- {
- this.clearAttention(download_button);
- }
- },
-
- getAnchor: function(aCallback)
- {
- if(this._customizing)
- {
- aCallback(null);
- return;
- }
-
- aCallback(this._getters.downloadButtonAnchor);
- },
-
- openUI: function(aEvent)
- {
- this.clearFinished();
-
- switch(this._service.downloadButtonAction)
- {
- case 1: // Firefox Default
- this._handler.openUINative();
- break;
- case 2: // Show Library
- this._window.PlacesCommandHook.showPlacesOrganizer("Downloads");
- break;
- case 3: // Show Tab
- let found = this._gBrowser.browsers.some(function(browser, index)
- {
- if("about:downloads" == browser.currentURI.spec)
- {
- this._gBrowser.selectedTab = this._gBrowser.tabContainer.childNodes[index];
- return true;
- }
- }, this);
-
- if(!found)
- {
- this._window.openUILinkIn("about:downloads", "tab");
- }
- break;
- case 4: // External Command
- let command = this._service.downloadButtonActionCommand;
- if(commend)
- {
- this._window.goDoCommand(command);
- }
- break;
- default: // Nothing
- break;
- }
-
- aEvent.stopPropagation();
- },
-
- get isPrivateWindow()
- {
- return this._handler.hasPBAPI && PrivateBrowsingUtils.isWindowPrivate(this._window);
- },
-
- get isUIShowing()
- {
- switch(this._service.downloadButtonAction)
- {
- case 1: // Firefox Default
- return this._handler.isUIShowingNative;
- case 2: // Show Library
- var organizer = Services.wm.getMostRecentWindow("Places:Organizer");
- if(organizer)
- {
- let selectedNode = organizer.PlacesOrganizer._places.selectedNode;
- let downloadsItemId = organizer.PlacesUIUtils.leftPaneQueries["Downloads"];
- return selectedNode && selectedNode.itemId === downloadsItemId;
- }
- return false;
- case 3: // Show tab
- let currentURI = this._gBrowser.currentURI;
- return currentURI && currentURI.spec == "about:downloads";
- default: // Nothing
- return false;
- }
- },
-
- buildString: function(mode)
- {
- switch(mode)
- {
- case 0:
- return this._dlCountStr;
- case 1:
- return ((this._dlPaused) ? this._dlCountStr : this._dlTimeStr);
- default:
- let compStr = this._dlCountStr;
- if(!this._dlPaused)
- {
- compStr += " (" + this._dlTimeStr + ")";
- }
- return compStr;
- }
- }
+ _window: null,
+ _gBrowser: null,
+ _service: null,
+ _getters: null,
+
+ _handler: null,
+ _listening: false,
+
+ _binding: false,
+ _customizing: false,
+
+ _lastTime: Infinity,
+
+ _dlActive: false,
+ _dlPaused: false,
+ _dlFinished: false,
+
+ _dlCountStr: null,
+ _dlTimeStr: null,
+
+ _dlProgressAvg: 0,
+ _dlProgressMax: 0,
+ _dlProgressMin: 0,
+ _dlProgressType: "active",
+
+ _dlNotifyTimer: 0,
+ _dlNotifyGlowTimer: 0,
+
+ init: function()
+ {
+ if(!this._getters.downloadButton)
+ {
+ this.uninit();
+ return;
+ }
+
+ if(this._listening)
+ {
+ return;
+ }
+
+ this._handler.start();
+ this._listening = true;
+
+ this._lastTime = Infinity;
+
+ this.updateBinding();
+ this.updateStatus();
+ },
+
+ uninit: function()
+ {
+ if(!this._listening)
+ {
+ return;
+ }
+
+ this._listening = false;
+ this._handler.stop();
+
+ this.releaseBinding();
+ },
+
+ destroy: function()
+ {
+ this.uninit();
+ this._handler.destroy();
+
+ ["_window", "_gBrowser", "_service", "_getters", "_handler"].forEach(function(prop)
+ {
+ delete this[prop];
+ }, this);
+ },
+
+ updateBinding: function()
+ {
+ if(!this._listening)
+ {
+ this.releaseBinding();
+ return;
+ }
+
+ switch(this._service.downloadButtonAction)
+ {
+ case 1: // Default
+ this.attachBinding();
+ break;
+ default:
+ this.releaseBinding();
+ break;
+ }
+ },
+
+ attachBinding: function()
+ {
+ if(this._binding)
+ {
+ return;
+ }
+
+ let db = this._window.DownloadsButton;
+
+ db._getAnchorS4EBackup = db.getAnchor;
+ db.getAnchor = this.getAnchor.bind(this);
+
+ db._releaseAnchorS4EBackup = db.releaseAnchor;
+ db.releaseAnchor = function() {};
+
+ this._binding = true;
+ },
+
+ releaseBinding: function()
+ {
+ if(!this._binding)
+ {
+ return;
+ }
+
+ let db = this._window.DownloadsButton;
+
+ db.getAnchor = db._getAnchorS4EBackup;
+ db.releaseAnchor = db._releaseAnchorS4EBackup;
+
+ this._binding = false;
+ },
+
+ customizing: function(val)
+ {
+ this._customizing = val;
+ },
+
+ updateStatus: function(lastFinished)
+ {
+ if(!this._getters.downloadButton)
+ {
+ this.uninit();
+ return;
+ }
+
+ let numActive = 0;
+ let numPaused = 0;
+ let activeTotalSize = 0;
+ let activeTransferred = 0;
+ let activeMaxProgress = -Infinity;
+ let activeMinProgress = Infinity;
+ let pausedTotalSize = 0;
+ let pausedTransferred = 0;
+ let pausedMaxProgress = -Infinity;
+ let pausedMinProgress = Infinity;
+ let maxTime = -Infinity;
+
+ let dls = ((this.isPrivateWindow) ? this._handler.activePrivateEntries() : this._handler.activeEntries());
+ for(let dl of dls)
+ {
+ if(dl.state == CI.nsIDownloadManager.DOWNLOAD_DOWNLOADING)
+ {
+ numActive++;
+ if(dl.size > 0)
+ {
+ if(dl.speed > 0)
+ {
+ maxTime = Math.max(maxTime, (dl.size - dl.transferred) / dl.speed);
+ }
+
+ activeTotalSize += dl.size;
+ activeTransferred += dl.transferred;
+
+ let currentProgress = ((dl.transferred * 100) / dl.size);
+ activeMaxProgress = Math.max(activeMaxProgress, currentProgress);
+ activeMinProgress = Math.min(activeMinProgress, currentProgress);
+ }
+ }
+ else if(dl.state == CI.nsIDownloadManager.DOWNLOAD_PAUSED)
+ {
+ numPaused++;
+ if(dl.size > 0)
+ {
+ pausedTotalSize += dl.size;
+ pausedTransferred += dl.transferred;
+
+ let currentProgress = ((dl.transferred * 100) / dl.size);
+ pausedMaxProgress = Math.max(pausedMaxProgress, currentProgress);
+ pausedMinProgress = Math.min(pausedMinProgress, currentProgress);
+ }
+ }
+ }
+
+ if((numActive + numPaused) == 0)
+ {
+ this._dlActive = false;
+ this._dlFinished = lastFinished;
+ this.updateButton();
+ this._lastTime = Infinity;
+ return;
+ }
+
+ let dlPaused = (numActive == 0);
+ let dlStatus = ((dlPaused) ? this._getters.strings.getString("pausedDownloads")
+ : this._getters.strings.getString("activeDownloads"));
+ let dlCount = ((dlPaused) ? numPaused : numActive);
+ let dlTotalSize = ((dlPaused) ? pausedTotalSize : activeTotalSize);
+ let dlTransferred = ((dlPaused) ? pausedTransferred : activeTransferred);
+ let dlMaxProgress = ((dlPaused) ? pausedMaxProgress : activeMaxProgress);
+ let dlMinProgress = ((dlPaused) ? pausedMinProgress : activeMinProgress);
+ let dlProgressType = ((dlPaused) ? "paused" : "active");
+
+ [this._dlTimeStr, this._lastTime] = DownloadUtils.getTimeLeft(maxTime, this._lastTime);
+ this._dlCountStr = PluralForm.get(dlCount, dlStatus).replace("#1", dlCount);
+ this._dlProgressAvg = ((dlTotalSize == 0) ? 100 : ((dlTransferred * 100) / dlTotalSize));
+ this._dlProgressMax = ((dlTotalSize == 0) ? 100 : dlMaxProgress);
+ this._dlProgressMin = ((dlTotalSize == 0) ? 100 : dlMinProgress);
+ this._dlProgressType = dlProgressType + ((dlTotalSize == 0) ? "-unknown" : "");
+ this._dlPaused = dlPaused;
+ this._dlActive = true;
+ this._dlFinished = false;
+
+ this.updateButton();
+ },
+
+ updateButton: function()
+ {
+ let download_button = this._getters.downloadButton;
+ let download_tooltip = this._getters.downloadButtonTooltip;
+ let download_progress = this._getters.downloadButtonProgress;
+ let download_label = this._getters.downloadButtonLabel;
+ if(!download_button)
+ {
+ return;
+ }
+
+ if(!this._dlActive)
+ {
+ download_button.collapsed = true;
+ download_label.value = download_tooltip.label = this._getters.strings.getString("noDownloads");
+
+ download_progress.collapsed = true;
+ download_progress.value = 0;
+
+ if(this._dlFinished && this._handler.hasPBAPI && !this.isUIShowing)
+ {
+ this.callAttention(download_button);
+ }
+ return;
+ }
+
+ switch(this._service.downloadProgress)
+ {
+ case 2:
+ download_progress.value = this._dlProgressMax;
+ break;
+ case 3:
+ download_progress.value = this._dlProgressMin;
+ break;
+ default:
+ download_progress.value = this._dlProgressAvg;
+ break;
+ }
+ download_progress.setAttribute("pmType", this._dlProgressType);
+ download_progress.collapsed = (this._service.downloadProgress == 0);
+
+ download_label.value = this.buildString(this._service.downloadLabel);
+ download_tooltip.label = this.buildString(this._service.downloadTooltip);
+
+ this.clearAttention(download_button);
+ download_button.collapsed = false;
+ },
+
+ callAttention: function(download_button)
+ {
+ if(this._dlNotifyGlowTimer != 0)
+ {
+ this._window.clearTimeout(this._dlNotifyGlowTimer);
+ this._dlNotifyGlowTimer = 0;
+ }
+
+ download_button.setAttribute("attention", "true");
+
+ if(this._service.downloadNotifyTimeout)
+ {
+ this._dlNotifyGlowTimer = this._window.setTimeout(function(self, button)
+ {
+ self._dlNotifyGlowTimer = 0;
+ button.removeAttribute("attention");
+ }, this._service.downloadNotifyTimeout, this, download_button);
+ }
+ },
+
+ clearAttention: function(download_button)
+ {
+ if(this._dlNotifyGlowTimer != 0)
+ {
+ this._window.clearTimeout(this._dlNotifyGlowTimer);
+ this._dlNotifyGlowTimer = 0;
+ }
+
+ download_button.removeAttribute("attention");
+ },
+
+ notify: function()
+ {
+ if(this._dlNotifyTimer == 0 && this._service.downloadNotifyAnimate)
+ {
+ let download_button_anchor = this._getters.downloadButtonAnchor;
+ let download_notify_anchor = this._getters.downloadNotifyAnchor;
+ if(download_button_anchor)
+ {
+ if(!download_notify_anchor.style.transform)
+ {
+ let bAnchorRect = download_button_anchor.getBoundingClientRect();
+ let nAnchorRect = download_notify_anchor.getBoundingClientRect();
+
+ let translateX = bAnchorRect.left - nAnchorRect.left;
+ translateX += .5 * (bAnchorRect.width - nAnchorRect.width);
+
+ let translateY = bAnchorRect.top - nAnchorRect.top;
+ translateY += .5 * (bAnchorRect.height - nAnchorRect.height);
+
+ download_notify_anchor.style.transform = "translate(" + translateX + "px, " + translateY + "px)";
+ }
+
+ download_notify_anchor.setAttribute("notification", "finish");
+ this._dlNotifyTimer = this._window.setTimeout(function(self, anchor)
+ {
+ self._dlNotifyTimer = 0;
+ anchor.removeAttribute("notification");
+ anchor.style.transform = "";
+ }, 1000, this, download_notify_anchor);
+ }
+ }
+ },
+
+ clearFinished: function()
+ {
+ this._dlFinished = false;
+ let download_button = this._getters.downloadButton;
+ if(download_button)
+ {
+ this.clearAttention(download_button);
+ }
+ },
+
+ getAnchor: function(aCallback)
+ {
+ if(this._customizing)
+ {
+ aCallback(null);
+ return;
+ }
+
+ aCallback(this._getters.downloadButtonAnchor);
+ },
+
+ openUI: function(aEvent)
+ {
+ this.clearFinished();
+
+ switch(this._service.downloadButtonAction)
+ {
+ case 1: // Firefox Default
+ this._handler.openUINative();
+ break;
+ case 2: // Show Library
+ this._window.PlacesCommandHook.showPlacesOrganizer("Downloads");
+ break;
+ case 3: // Show Tab
+ let found = this._gBrowser.browsers.some(function(browser, index)
+ {
+ if("about:downloads" == browser.currentURI.spec)
+ {
+ this._gBrowser.selectedTab = this._gBrowser.tabContainer.childNodes[index];
+ return true;
+ }
+ }, this);
+
+ if(!found)
+ {
+ this._window.openUILinkIn("about:downloads", "tab");
+ }
+ break;
+ case 4: // External Command
+ let command = this._service.downloadButtonActionCommand;
+ if(commend)
+ {
+ this._window.goDoCommand(command);
+ }
+ break;
+ default: // Nothing
+ break;
+ }
+
+ aEvent.stopPropagation();
+ },
+
+ get isPrivateWindow()
+ {
+ return this._handler.hasPBAPI && PrivateBrowsingUtils.isWindowPrivate(this._window);
+ },
+
+ get isUIShowing()
+ {
+ switch(this._service.downloadButtonAction)
+ {
+ case 1: // Firefox Default
+ return this._handler.isUIShowingNative;
+ case 2: // Show Library
+ var organizer = Services.wm.getMostRecentWindow("Places:Organizer");
+ if(organizer)
+ {
+ let selectedNode = organizer.PlacesOrganizer._places.selectedNode;
+ let downloadsItemId = organizer.PlacesUIUtils.leftPaneQueries["Downloads"];
+ return selectedNode && selectedNode.itemId === downloadsItemId;
+ }
+ return false;
+ case 3: // Show tab
+ let currentURI = this._gBrowser.currentURI;
+ return currentURI && currentURI.spec == "about:downloads";
+ default: // Nothing
+ return false;
+ }
+ },
+
+ buildString: function(mode)
+ {
+ switch(mode)
+ {
+ case 0:
+ return this._dlCountStr;
+ case 1:
+ return ((this._dlPaused) ? this._dlCountStr : this._dlTimeStr);
+ default:
+ let compStr = this._dlCountStr;
+ if(!this._dlPaused)
+ {
+ compStr += " (" + this._dlTimeStr + ")";
+ }
+ return compStr;
+ }
+ }
};
function JSTransferHandler(window, downloadService)
{
- this._window = window;
+ this._window = window;
- let api = CU.import("resource://gre/modules/Downloads.jsm", {}).Downloads;
+ let api = CU.import("resource://gre/modules/Downloads.jsm", {}).Downloads;
- this._activePublic = new JSTransferListener(downloadService, api.getList(api.PUBLIC), false);
- this._activePrivate = new JSTransferListener(downloadService, api.getList(api.PRIVATE), true);
+ this._activePublic = new JSTransferListener(downloadService, api.getList(api.PUBLIC), false);
+ this._activePrivate = new JSTransferListener(downloadService, api.getList(api.PRIVATE), true);
}
JSTransferHandler.prototype =
{
- _window: null,
- _activePublic: null,
- _activePrivate: null,
-
- destroy: function()
- {
- this._activePublic.destroy();
- this._activePrivate.destroy();
-
- ["_window", "_activePublic", "_activePrivate"].forEach(function(prop)
- {
- delete this[prop];
- }, this);
- },
-
- start: function()
- {
- this._activePublic.start();
- this._activePrivate.start();
- },
-
- stop: function()
- {
- this._activePublic.stop();
- this._activePrivate.stop();
- },
-
- get hasPBAPI()
- {
- return true;
- },
-
- openUINative: function()
- {
- this._window.DownloadsPanel.showPanel();
- },
-
- get isUIShowingNative()
- {
- return this._window.DownloadsPanel.isPanelShowing;
- },
-
- activeEntries: function()
- {
- return this._activePublic.downloads();
- },
-
- activePrivateEntries: function()
- {
- return this._activePrivate.downloads();
- }
+ _window: null,
+ _activePublic: null,
+ _activePrivate: null,
+
+ destroy: function()
+ {
+ this._activePublic.destroy();
+ this._activePrivate.destroy();
+
+ ["_window", "_activePublic", "_activePrivate"].forEach(function(prop)
+ {
+ delete this[prop];
+ }, this);
+ },
+
+ start: function()
+ {
+ this._activePublic.start();
+ this._activePrivate.start();
+ },
+
+ stop: function()
+ {
+ this._activePublic.stop();
+ this._activePrivate.stop();
+ },
+
+ get hasPBAPI()
+ {
+ return true;
+ },
+
+ openUINative: function()
+ {
+ this._window.DownloadsPanel.showPanel();
+ },
+
+ get isUIShowingNative()
+ {
+ return this._window.DownloadsPanel.isPanelShowing;
+ },
+
+ activeEntries: function()
+ {
+ return this._activePublic.downloads();
+ },
+
+ activePrivateEntries: function()
+ {
+ return this._activePrivate.downloads();
+ }
};
function JSTransferListener(downloadService, listPromise, isPrivate)
{
- this._downloadService = downloadService;
- this._isPrivate = isPrivate;
- this._downloads = new Map();
+ this._downloadService = downloadService;
+ this._isPrivate = isPrivate;
+ this._downloads = new Map();
- listPromise.then(this.initList.bind(this)).then(null, CU.reportError);
+ listPromise.then(this.initList.bind(this)).then(null, CU.reportError);
}
JSTransferListener.prototype =
{
- _downloadService: null,
- _list: null,
- _downloads: null,
- _isPrivate: false,
- _wantsStart: false,
-
- initList: function(list)
- {
- this._list = list;
- if(this._wantsStart) {
- this.start();
- }
-
- this._list.getAll().then(this.initDownloads.bind(this)).then(null, CU.reportError);
- },
-
- initDownloads: function(downloads)
- {
- downloads.forEach(function(download)
- {
- this.onDownloadAdded(download);
- }, this);
- },
-
- destroy: function()
- {
- this._downloads.clear();
-
- ["_downloadService", "_list", "_downloads"].forEach(function(prop)
- {
- delete this[prop];
- }, this);
- },
-
- start: function()
- {
- if(!this._list)
- {
- this._wantsStart = true;
- return;
- }
-
- this._list.addView(this);
- },
-
- stop: function()
- {
- if(!this._list)
- {
- this._wantsStart = false;
- return;
- }
-
- this._list.removeView(this);
- },
-
- downloads: function()
- {
- return this._downloads.values();
- },
-
- convertToState: function(dl)
- {
- if(dl.succeeded)
- {
- return CI.nsIDownloadManager.DOWNLOAD_FINISHED;
- }
- if(dl.error && dl.error.becauseBlockedByParentalControls)
- {
- return CI.nsIDownloadManager.DOWNLOAD_BLOCKED_PARENTAL;
- }
- if(dl.error)
- {
- return CI.nsIDownloadManager.DOWNLOAD_FAILED;
- }
- if(dl.canceled && dl.hasPartialData)
- {
- return CI.nsIDownloadManager.DOWNLOAD_PAUSED;
- }
- if(dl.canceled)
- {
- return CI.nsIDownloadManager.DOWNLOAD_CANCELED;
- }
- if(dl.stopped)
- {
- return CI.nsIDownloadManager.DOWNLOAD_NOTSTARTED;
- }
- return CI.nsIDownloadManager.DOWNLOAD_DOWNLOADING;
- },
-
- onDownloadAdded: function(aDownload)
- {
- let dl = this._downloads.get(aDownload);
- if(!dl)
- {
- dl = {};
- this._downloads.set(aDownload, dl);
- }
-
- dl.state = this.convertToState(aDownload);
- dl.size = aDownload.totalBytes;
- dl.speed = aDownload.speed;
- dl.transferred = aDownload.currentBytes;
- },
-
- onDownloadChanged: function(aDownload)
- {
- this.onDownloadAdded(aDownload);
-
- if(this._isPrivate != this._downloadService.isPrivateWindow)
- {
- return;
- }
-
- this._downloadService.updateStatus(aDownload.succeeded);
-
- if(aDownload.succeeded)
- {
- this._downloadService.notify()
- }
- },
-
- onDownloadRemoved: function(aDownload)
- {
- this._downloads.delete(aDownload);
- }
+ _downloadService: null,
+ _list: null,
+ _downloads: null,
+ _isPrivate: false,
+ _wantsStart: false,
+
+ initList: function(list)
+ {
+ this._list = list;
+ if(this._wantsStart) {
+ this.start();
+ }
+
+ this._list.getAll().then(this.initDownloads.bind(this)).then(null, CU.reportError);
+ },
+
+ initDownloads: function(downloads)
+ {
+ downloads.forEach(function(download)
+ {
+ this.onDownloadAdded(download);
+ }, this);
+ },
+
+ destroy: function()
+ {
+ this._downloads.clear();
+
+ ["_downloadService", "_list", "_downloads"].forEach(function(prop)
+ {
+ delete this[prop];
+ }, this);
+ },
+
+ start: function()
+ {
+ if(!this._list)
+ {
+ this._wantsStart = true;
+ return;
+ }
+
+ this._list.addView(this);
+ },
+
+ stop: function()
+ {
+ if(!this._list)
+ {
+ this._wantsStart = false;
+ return;
+ }
+
+ this._list.removeView(this);
+ },
+
+ downloads: function()
+ {
+ return this._downloads.values();
+ },
+
+ convertToState: function(dl)
+ {
+ if(dl.succeeded)
+ {
+ return CI.nsIDownloadManager.DOWNLOAD_FINISHED;
+ }
+ if(dl.error && dl.error.becauseBlockedByParentalControls)
+ {
+ return CI.nsIDownloadManager.DOWNLOAD_BLOCKED_PARENTAL;
+ }
+ if(dl.error)
+ {
+ return CI.nsIDownloadManager.DOWNLOAD_FAILED;
+ }
+ if(dl.canceled && dl.hasPartialData)
+ {
+ return CI.nsIDownloadManager.DOWNLOAD_PAUSED;
+ }
+ if(dl.canceled)
+ {
+ return CI.nsIDownloadManager.DOWNLOAD_CANCELED;
+ }
+ if(dl.stopped)
+ {
+ return CI.nsIDownloadManager.DOWNLOAD_NOTSTARTED;
+ }
+ return CI.nsIDownloadManager.DOWNLOAD_DOWNLOADING;
+ },
+
+ onDownloadAdded: function(aDownload)
+ {
+ let dl = this._downloads.get(aDownload);
+ if(!dl)
+ {
+ dl = {};
+ this._downloads.set(aDownload, dl);
+ }
+
+ dl.state = this.convertToState(aDownload);
+ dl.size = aDownload.totalBytes;
+ dl.speed = aDownload.speed;
+ dl.transferred = aDownload.currentBytes;
+ },
+
+ onDownloadChanged: function(aDownload)
+ {
+ this.onDownloadAdded(aDownload);
+
+ if(this._isPrivate != this._downloadService.isPrivateWindow)
+ {
+ return;
+ }
+
+ this._downloadService.updateStatus(aDownload.succeeded);
+
+ if(aDownload.succeeded)
+ {
+ this._downloadService.notify()
+ }
+ },
+
+ onDownloadRemoved: function(aDownload)
+ {
+ this._downloads.delete(aDownload);
+ }
};
diff --git a/application/palemoon/components/statusbar/Progress.jsm b/application/palemoon/components/statusbar/Progress.jsm
index c03a254501..69d55db49b 100644
--- a/application/palemoon/components/statusbar/Progress.jsm
+++ b/application/palemoon/components/statusbar/Progress.jsm
@@ -12,172 +12,172 @@ const CU = Components.utils;
CU.import("resource://gre/modules/XPCOMUtils.jsm");
function S4EProgressService(gBrowser, service, getters, statusService) {
- this._gBrowser = gBrowser;
- this._service = service;
- this._getters = getters;
- this._statusService = statusService;
+ this._gBrowser = gBrowser;
+ this._service = service;
+ this._getters = getters;
+ this._statusService = statusService;
- this._gBrowser.addProgressListener(this);
+ this._gBrowser.addProgressListener(this);
}
S4EProgressService.prototype =
{
- _gBrowser: null,
- _service: null,
- _getters: null,
- _statusService: null,
-
- _busyUI: false,
-
- set value(val)
- {
- let toolbar_progress = this._getters.toolbarProgress;
- if(toolbar_progress)
- {
- toolbar_progress.value = val;
- }
-
- let throbber_progress = this._getters.throbberProgress;
- if(throbber_progress)
- {
- if(val)
- {
- throbber_progress.setAttribute("progress", val);
- }
- else
- {
- throbber_progress.removeAttribute("progress");
- }
- }
- },
-
- set collapsed(val)
- {
- let toolbar_progress = this._getters.toolbarProgress;
- if(toolbar_progress)
- {
- toolbar_progress.collapsed = val;
- }
-
- let throbber_progress = this._getters.throbberProgress;
- if(throbber_progress)
- {
- if(val)
- {
- throbber_progress.removeAttribute("busy");
- }
- else
- {
- throbber_progress.setAttribute("busy", true);
- }
- }
- },
-
- destroy: function()
- {
- this._gBrowser.removeProgressListener(this);
-
- ["_gBrowser", "_service", "_getters", "_statusService"].forEach(function(prop)
- {
- delete this[prop];
- }, this);
- },
-
- onStatusChange: function(aWebProgress, aRequest, aStatus, aMessage)
- {
- this._statusService.setNetworkStatus(aMessage, this._busyUI);
- },
-
- onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus)
- {
- let nsIWPL = CI.nsIWebProgressListener;
-
- if(!this._busyUI
- && aStateFlags & nsIWPL.STATE_START
- && aStateFlags & nsIWPL.STATE_IS_NETWORK
- && !(aStateFlags & nsIWPL.STATE_RESTORING))
- {
- this._busyUI = true;
- this.value = 0;
- this.collapsed = false;
- }
- else if(aStateFlags & nsIWPL.STATE_STOP)
- {
- if(aRequest)
- {
- let msg = "";
- let location;
- if(aRequest instanceof CI.nsIChannel || "URI" in aRequest)
- {
- location = aRequest.URI;
- if(location.spec != "about:blank")
- {
- switch (aStatus)
- {
- case Components.results.NS_BINDING_ABORTED:
- msg = this._getters.strings.getString("nv_stopped");
- break;
- case Components.results.NS_ERROR_NET_TIMEOUT:
- msg = this._getters.strings.getString("nv_timeout");
- break;
- }
- }
- }
-
- if(!msg && (!location || location.spec != "about:blank"))
- {
- msg = this._getters.strings.getString("nv_done");
- }
-
- this._statusService.setDefaultStatus(msg);
- this._statusService.setNetworkStatus("", this._busyUI);
- }
-
- if(this._busyUI)
- {
- this._busyUI = false;
- this.collapsed = true;
- this.value = 0;
- }
- }
- },
-
- onUpdateCurrentBrowser: function(aStateFlags, aStatus, aMessage, aTotalProgress)
- {
- let nsIWPL = CI.nsIWebProgressListener;
- let loadingDone = aStateFlags & nsIWPL.STATE_STOP;
-
- this.onStateChange(
- this._gBrowser.webProgress,
- { URI: this._gBrowser.currentURI },
- ((loadingDone ? nsIWPL.STATE_STOP : nsIWPL.STATE_START) | (aStateFlags & nsIWPL.STATE_IS_NETWORK)),
- aStatus
- );
-
- if(!loadingDone)
- {
- this.onProgressChange(this._gBrowser.webProgress, null, 0, 0, aTotalProgress, 1);
- this.onStatusChange(this._gBrowser.webProgress, null, 0, aMessage);
- }
- },
-
- onProgressChange: function(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress)
- {
- if (aMaxTotalProgress > 0 && this._busyUI)
- {
- // This is highly optimized. Don't touch this code unless
- // you are intimately familiar with the cost of setting
- // attrs on XUL elements. -- hyatt
- let percentage = (aCurTotalProgress * 100) / aMaxTotalProgress;
- this.value = percentage;
- }
- },
-
- onProgressChange64: function(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress)
- {
- return this.onProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress);
- },
-
- QueryInterface: XPCOMUtils.generateQI([ CI.nsIWebProgressListener, CI.nsIWebProgressListener2 ])
+ _gBrowser: null,
+ _service: null,
+ _getters: null,
+ _statusService: null,
+
+ _busyUI: false,
+
+ set value(val)
+ {
+ let toolbar_progress = this._getters.toolbarProgress;
+ if(toolbar_progress)
+ {
+ toolbar_progress.value = val;
+ }
+
+ let throbber_progress = this._getters.throbberProgress;
+ if(throbber_progress)
+ {
+ if(val)
+ {
+ throbber_progress.setAttribute("progress", val);
+ }
+ else
+ {
+ throbber_progress.removeAttribute("progress");
+ }
+ }
+ },
+
+ set collapsed(val)
+ {
+ let toolbar_progress = this._getters.toolbarProgress;
+ if(toolbar_progress)
+ {
+ toolbar_progress.collapsed = val;
+ }
+
+ let throbber_progress = this._getters.throbberProgress;
+ if(throbber_progress)
+ {
+ if(val)
+ {
+ throbber_progress.removeAttribute("busy");
+ }
+ else
+ {
+ throbber_progress.setAttribute("busy", true);
+ }
+ }
+ },
+
+ destroy: function()
+ {
+ this._gBrowser.removeProgressListener(this);
+
+ ["_gBrowser", "_service", "_getters", "_statusService"].forEach(function(prop)
+ {
+ delete this[prop];
+ }, this);
+ },
+
+ onStatusChange: function(aWebProgress, aRequest, aStatus, aMessage)
+ {
+ this._statusService.setNetworkStatus(aMessage, this._busyUI);
+ },
+
+ onStateChange: function(aWebProgress, aRequest, aStateFlags, aStatus)
+ {
+ let nsIWPL = CI.nsIWebProgressListener;
+
+ if(!this._busyUI
+ && aStateFlags & nsIWPL.STATE_START
+ && aStateFlags & nsIWPL.STATE_IS_NETWORK
+ && !(aStateFlags & nsIWPL.STATE_RESTORING))
+ {
+ this._busyUI = true;
+ this.value = 0;
+ this.collapsed = false;
+ }
+ else if(aStateFlags & nsIWPL.STATE_STOP)
+ {
+ if(aRequest)
+ {
+ let msg = "";
+ let location;
+ if(aRequest instanceof CI.nsIChannel || "URI" in aRequest)
+ {
+ location = aRequest.URI;
+ if(location.spec != "about:blank")
+ {
+ switch (aStatus)
+ {
+ case Components.results.NS_BINDING_ABORTED:
+ msg = this._getters.strings.getString("nv_stopped");
+ break;
+ case Components.results.NS_ERROR_NET_TIMEOUT:
+ msg = this._getters.strings.getString("nv_timeout");
+ break;
+ }
+ }
+ }
+
+ if(!msg && (!location || location.spec != "about:blank"))
+ {
+ msg = this._getters.strings.getString("nv_done");
+ }
+
+ this._statusService.setDefaultStatus(msg);
+ this._statusService.setNetworkStatus("", this._busyUI);
+ }
+
+ if(this._busyUI)
+ {
+ this._busyUI = false;
+ this.collapsed = true;
+ this.value = 0;
+ }
+ }
+ },
+
+ onUpdateCurrentBrowser: function(aStateFlags, aStatus, aMessage, aTotalProgress)
+ {
+ let nsIWPL = CI.nsIWebProgressListener;
+ let loadingDone = aStateFlags & nsIWPL.STATE_STOP;
+
+ this.onStateChange(
+ this._gBrowser.webProgress,
+ { URI: this._gBrowser.currentURI },
+ ((loadingDone ? nsIWPL.STATE_STOP : nsIWPL.STATE_START) | (aStateFlags & nsIWPL.STATE_IS_NETWORK)),
+ aStatus
+ );
+
+ if(!loadingDone)
+ {
+ this.onProgressChange(this._gBrowser.webProgress, null, 0, 0, aTotalProgress, 1);
+ this.onStatusChange(this._gBrowser.webProgress, null, 0, aMessage);
+ }
+ },
+
+ onProgressChange: function(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress)
+ {
+ if (aMaxTotalProgress > 0 && this._busyUI)
+ {
+ // This is highly optimized. Don't touch this code unless
+ // you are intimately familiar with the cost of setting
+ // attrs on XUL elements. -- hyatt
+ let percentage = (aCurTotalProgress * 100) / aMaxTotalProgress;
+ this.value = percentage;
+ }
+ },
+
+ onProgressChange64: function(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress)
+ {
+ return this.onProgressChange(aWebProgress, aRequest, aCurSelfProgress, aMaxSelfProgress, aCurTotalProgress, aMaxTotalProgress);
+ },
+
+ QueryInterface: XPCOMUtils.generateQI([ CI.nsIWebProgressListener, CI.nsIWebProgressListener2 ])
};
diff --git a/application/palemoon/components/statusbar/Status.jsm b/application/palemoon/components/statusbar/Status.jsm
index 3795545a3a..d888c7d94c 100644
--- a/application/palemoon/components/statusbar/Status.jsm
+++ b/application/palemoon/components/statusbar/Status.jsm
@@ -13,452 +13,452 @@ CU.import("resource://gre/modules/XPCOMUtils.jsm");
function S4EStatusService(window, service, getters)
{
- this._window = window;
- this._service = service;
- this._getters = getters;
+ this._window = window;
+ this._service = service;
+ this._getters = getters;
- this._overLinkService = new S4EOverlinkService(this._window, this._service, this);
+ this._overLinkService = new S4EOverlinkService(this._window, this._service, this);
}
S4EStatusService.prototype =
{
- _window: null,
- _service: null,
- _getters: null,
- _overLinkService: null,
-
- _overLink: { val: "", type: "" },
- _network: { val: "", type: "" },
- _networkXHR: { val: "", type: "" },
- _status: { val: "", type: "" },
- _jsStatus: { val: "", type: "" },
- _defaultStatus: { val: "", type: "" },
-
- _isFullScreen: false,
- _isFullScreenVideo: false,
-
- _statusText: { val: "", type: "" },
- _noUpdate: false,
- _statusChromeTimeoutID: 0,
- _statusContentTimeoutID: 0,
-
- getCompositeStatusText: function()
- {
- return this._statusText.val;
- },
-
- getStatusText: function()
- {
- return this._status.val;
- },
-
- setNetworkStatus: function(status, busy)
- {
- if(busy)
- {
- this._network = { val: status, type: "network" };
- this._networkXHR = { val: "", type: "network xhr" };
- }
- else
- {
- this._networkXHR = { val: status, type: "network xhr" };
- }
- this.updateStatusField();
- },
-
- setStatusText: function(status)
- {
- this._status = { val: status, type: "status chrome" };
- this.updateStatusField();
- },
-
- setJSStatus: function(status)
- {
- this._jsStatus = { val: status, type: "status content" };
- this.updateStatusField();
- },
-
- setJSDefaultStatus: function(status)
- {
- // This was removed from Firefox in Bug 862917
- },
-
- setDefaultStatus: function(status)
- {
- this._defaultStatus = { val: status, type: "status chrome default" };
- this.updateStatusField();
- },
-
- setOverLink: function(link, aAnchor)
- {
- this._overLinkService.update(link, aAnchor);
- },
-
- setOverLinkInternal: function(link, aAnchor)
- {
- let status = this._service.status;
- let statusLinkOver = this._service.statusLinkOver;
-
- if(statusLinkOver)
- {
- link = link.replace(/[\u200e\u200f\u202a\u202b\u202c\u202d\u202e]/g, encodeURIComponent);
- if(status == statusLinkOver)
- {
- this._overLink = { val: link, type: "overLink", anchor: aAnchor };
- this.updateStatusField();
- }
- else
- {
- this.setStatusField(statusLinkOver, { val: link, type: "overLink", anchor: aAnchor }, true);
- }
- }
- },
-
- setNoUpdate: function(nu)
- {
- this._noUpdate = nu;
- },
-
- buildBinding: function() {
- let XULBWPropHandler = function(prop, oldval, newval) {
- CU.reportError("Attempt to modify XULBrowserWindow." + prop);
- return oldval;
- };
-
- ["updateStatusField", "onStatusChange"].forEach(function(prop)
- {
- this._window.XULBrowserWindow.unwatch(prop);
- this._window.XULBrowserWindow[prop] = function() {};
- this._window.XULBrowserWindow.watch(prop, XULBWPropHandler);
- }, this);
-
- ["getCompositeStatusText", "getStatusText", "setStatusText", "setJSStatus",
- "setJSDefaultStatus", "setDefaultStatus", "setOverLink"].forEach(function(prop)
- {
- this._window.XULBrowserWindow.unwatch(prop);
- this._window.XULBrowserWindow[prop] = this[prop].bind(this);
- this._window.XULBrowserWindow.watch(prop, XULBWPropHandler);
- }, this);
-
- let XULBWHandler = function(prop, oldval, newval) {
- if(!newval)
- {
- return newval;
- }
- CU.reportError("XULBrowserWindow changed. Updating S4E bindings.");
- this._window.setTimeout(function(self)
- {
- self.buildBinding();
- }, 0, this);
- return newval;
- };
-
- this._window.watch("XULBrowserWindow", XULBWHandler);
- },
-
- destroy: function()
- {
- // No need to unbind from the XULBrowserWindow, it's already null at this point
-
- this.clearTimer("_statusChromeTimeoutID");
- this.clearTimer("_statusContentTimeoutID");
-
- this._overLinkService.destroy();
-
- ["_overLink", "_network", "_networkXHR", "_status", "_jsStatus", "_defaultStatus",
- "_statusText", "_window", "_service", "_getters", "_overLinkService"].forEach(function(prop)
- {
- delete this[prop];
- }, this);
- },
-
- buildTextOrder: function()
- {
- this.__defineGetter__("_textOrder", function()
- {
- let textOrder = ["_overLink"];
- if(this._service.statusNetwork)
- {
- textOrder.push("_network");
- if(this._service.statusNetworkXHR)
- {
- textOrder.push("_networkXHR");
- }
- }
- textOrder.push("_status", "_jsStatus");
- if(this._service.statusDefault)
- {
- textOrder.push("_defaultStatus");
- }
-
- delete this._textOrder;
- return this._textOrder = textOrder;
- });
- },
-
- updateStatusField: function(force)
- {
- let text = { val: "", type: "" };
- for(let i = 0; !text.val && i < this._textOrder.length; i++)
- {
- text = this[this._textOrder[i]];
- }
-
- if(this._statusText.val != text.val || force)
- {
- if(this._noUpdate)
- {
- return;
- }
-
- this._statusText = text;
-
- this.setStatusField(this._service.status, text, false);
-
- if(text.val && this._service.statusTimeout)
- {
- this.setTimer(text.type);
- }
- }
- },
-
- updateFullScreen: function()
- {
- this._isFullScreen = this._window.fullScreen;
- this._isFullScreenVideo = false;
- if(this._isFullScreen)
- {
- let fsEl = this._window.content.document.mozFullScreenElement;
- if(fsEl && (fsEl.nodeName == "VIDEO" || fsEl.getElementsByTagName("VIDEO").length > 0))
- {
- this._isFullScreenVideo = true;
- }
- }
-
- this.clearStatusField();
- this.updateStatusField(true);
- },
-
- setTimer: function(type)
- {
- let typeArgs = type.split(" ", 3);
-
- if(typeArgs.length < 2 || typeArgs[0] != "status")
- {
- return;
- }
-
- if(typeArgs[1] == "chrome")
- {
- this.clearTimer("_statusChromeTimeoutID");
- this._statusChromeTimeoutID = this._window.setTimeout(function(self, isDefault)
- {
- self._statusChromeTimeoutID = 0;
- if(isDefault)
- {
- self.setDefaultStatus("");
- }
- else
- {
- self.setStatusText("");
- }
- }, this._service.statusTimeout, this, (typeArgs.length == 3 && typeArgs[2] == "default"));
- }
- else
- {
- this.clearTimer("_statusContentTimeoutID");
- this._statusContentTimeoutID = this._window.setTimeout(function(self)
- {
- self._statusContentTimeoutID = 0;
- self.setJSStatus("");
- }, this._service.statusTimeout, this);
- }
- },
-
- clearTimer: function(timerName)
- {
- if(this[timerName] != 0)
- {
- this._window.clearTimeout(this[timerName]);
- this[timerName] = 0;
- }
- },
-
- clearStatusField: function()
- {
- this._getters.statusOverlay.value = "";
-
- let status_label = this._getters.statusWidgetLabel;
- if(status_label)
- {
- status_label.value = "";
- }
-
- },
-
- setStatusField: function(location, text, allowTooltip)
- {
- if(!location)
- {
- return;
- }
-
- let label = null;
-
- if(this._isFullScreen && this._service.advancedStatusDetectFullScreen)
- {
- switch(location)
- {
- case 1: // Toolbar
- location = 3
- break;
- case 2: // URL bar
- if(Services.prefs.getBoolPref("browser.fullscreen.autohide"))
- {
- location = 3
- }
- break;
- }
- }
-
- switch(location)
- {
- case 1: // Toolbar
- label = this._getters.statusWidgetLabel;
- break;
- case 2: // URL Bar
- break;
- case 3: // Popup
- default:
- if(this._isFullScreenVideo && this._service.advancedStatusDetectVideo)
- {
- return;
- }
- label = this._getters.statusOverlay;
- break;
- }
-
- if(label)
- {
- label.setAttribute("previoustype", label.getAttribute("type"));
- label.setAttribute("type", text.type);
- label.value = text.val;
- label.setAttribute("crop", text.type == "overLink" ? "center" : "end");
- }
- }
+ _window: null,
+ _service: null,
+ _getters: null,
+ _overLinkService: null,
+
+ _overLink: { val: "", type: "" },
+ _network: { val: "", type: "" },
+ _networkXHR: { val: "", type: "" },
+ _status: { val: "", type: "" },
+ _jsStatus: { val: "", type: "" },
+ _defaultStatus: { val: "", type: "" },
+
+ _isFullScreen: false,
+ _isFullScreenVideo: false,
+
+ _statusText: { val: "", type: "" },
+ _noUpdate: false,
+ _statusChromeTimeoutID: 0,
+ _statusContentTimeoutID: 0,
+
+ getCompositeStatusText: function()
+ {
+ return this._statusText.val;
+ },
+
+ getStatusText: function()
+ {
+ return this._status.val;
+ },
+
+ setNetworkStatus: function(status, busy)
+ {
+ if(busy)
+ {
+ this._network = { val: status, type: "network" };
+ this._networkXHR = { val: "", type: "network xhr" };
+ }
+ else
+ {
+ this._networkXHR = { val: status, type: "network xhr" };
+ }
+ this.updateStatusField();
+ },
+
+ setStatusText: function(status)
+ {
+ this._status = { val: status, type: "status chrome" };
+ this.updateStatusField();
+ },
+
+ setJSStatus: function(status)
+ {
+ this._jsStatus = { val: status, type: "status content" };
+ this.updateStatusField();
+ },
+
+ setJSDefaultStatus: function(status)
+ {
+ // This was removed from Firefox in Bug 862917
+ },
+
+ setDefaultStatus: function(status)
+ {
+ this._defaultStatus = { val: status, type: "status chrome default" };
+ this.updateStatusField();
+ },
+
+ setOverLink: function(link, aAnchor)
+ {
+ this._overLinkService.update(link, aAnchor);
+ },
+
+ setOverLinkInternal: function(link, aAnchor)
+ {
+ let status = this._service.status;
+ let statusLinkOver = this._service.statusLinkOver;
+
+ if(statusLinkOver)
+ {
+ link = link.replace(/[\u200e\u200f\u202a\u202b\u202c\u202d\u202e]/g, encodeURIComponent);
+ if(status == statusLinkOver)
+ {
+ this._overLink = { val: link, type: "overLink", anchor: aAnchor };
+ this.updateStatusField();
+ }
+ else
+ {
+ this.setStatusField(statusLinkOver, { val: link, type: "overLink", anchor: aAnchor }, true);
+ }
+ }
+ },
+
+ setNoUpdate: function(nu)
+ {
+ this._noUpdate = nu;
+ },
+
+ buildBinding: function() {
+ let XULBWPropHandler = function(prop, oldval, newval) {
+ CU.reportError("Attempt to modify XULBrowserWindow." + prop);
+ return oldval;
+ };
+
+ ["updateStatusField", "onStatusChange"].forEach(function(prop)
+ {
+ this._window.XULBrowserWindow.unwatch(prop);
+ this._window.XULBrowserWindow[prop] = function() {};
+ this._window.XULBrowserWindow.watch(prop, XULBWPropHandler);
+ }, this);
+
+ ["getCompositeStatusText", "getStatusText", "setStatusText", "setJSStatus",
+ "setJSDefaultStatus", "setDefaultStatus", "setOverLink"].forEach(function(prop)
+ {
+ this._window.XULBrowserWindow.unwatch(prop);
+ this._window.XULBrowserWindow[prop] = this[prop].bind(this);
+ this._window.XULBrowserWindow.watch(prop, XULBWPropHandler);
+ }, this);
+
+ let XULBWHandler = function(prop, oldval, newval) {
+ if(!newval)
+ {
+ return newval;
+ }
+ CU.reportError("XULBrowserWindow changed. Updating S4E bindings.");
+ this._window.setTimeout(function(self)
+ {
+ self.buildBinding();
+ }, 0, this);
+ return newval;
+ };
+
+ this._window.watch("XULBrowserWindow", XULBWHandler);
+ },
+
+ destroy: function()
+ {
+ // No need to unbind from the XULBrowserWindow, it's already null at this point
+
+ this.clearTimer("_statusChromeTimeoutID");
+ this.clearTimer("_statusContentTimeoutID");
+
+ this._overLinkService.destroy();
+
+ ["_overLink", "_network", "_networkXHR", "_status", "_jsStatus", "_defaultStatus",
+ "_statusText", "_window", "_service", "_getters", "_overLinkService"].forEach(function(prop)
+ {
+ delete this[prop];
+ }, this);
+ },
+
+ buildTextOrder: function()
+ {
+ this.__defineGetter__("_textOrder", function()
+ {
+ let textOrder = ["_overLink"];
+ if(this._service.statusNetwork)
+ {
+ textOrder.push("_network");
+ if(this._service.statusNetworkXHR)
+ {
+ textOrder.push("_networkXHR");
+ }
+ }
+ textOrder.push("_status", "_jsStatus");
+ if(this._service.statusDefault)
+ {
+ textOrder.push("_defaultStatus");
+ }
+
+ delete this._textOrder;
+ return this._textOrder = textOrder;
+ });
+ },
+
+ updateStatusField: function(force)
+ {
+ let text = { val: "", type: "" };
+ for(let i = 0; !text.val && i < this._textOrder.length; i++)
+ {
+ text = this[this._textOrder[i]];
+ }
+
+ if(this._statusText.val != text.val || force)
+ {
+ if(this._noUpdate)
+ {
+ return;
+ }
+
+ this._statusText = text;
+
+ this.setStatusField(this._service.status, text, false);
+
+ if(text.val && this._service.statusTimeout)
+ {
+ this.setTimer(text.type);
+ }
+ }
+ },
+
+ updateFullScreen: function()
+ {
+ this._isFullScreen = this._window.fullScreen;
+ this._isFullScreenVideo = false;
+ if(this._isFullScreen)
+ {
+ let fsEl = this._window.content.document.mozFullScreenElement;
+ if(fsEl && (fsEl.nodeName == "VIDEO" || fsEl.getElementsByTagName("VIDEO").length > 0))
+ {
+ this._isFullScreenVideo = true;
+ }
+ }
+
+ this.clearStatusField();
+ this.updateStatusField(true);
+ },
+
+ setTimer: function(type)
+ {
+ let typeArgs = type.split(" ", 3);
+
+ if(typeArgs.length < 2 || typeArgs[0] != "status")
+ {
+ return;
+ }
+
+ if(typeArgs[1] == "chrome")
+ {
+ this.clearTimer("_statusChromeTimeoutID");
+ this._statusChromeTimeoutID = this._window.setTimeout(function(self, isDefault)
+ {
+ self._statusChromeTimeoutID = 0;
+ if(isDefault)
+ {
+ self.setDefaultStatus("");
+ }
+ else
+ {
+ self.setStatusText("");
+ }
+ }, this._service.statusTimeout, this, (typeArgs.length == 3 && typeArgs[2] == "default"));
+ }
+ else
+ {
+ this.clearTimer("_statusContentTimeoutID");
+ this._statusContentTimeoutID = this._window.setTimeout(function(self)
+ {
+ self._statusContentTimeoutID = 0;
+ self.setJSStatus("");
+ }, this._service.statusTimeout, this);
+ }
+ },
+
+ clearTimer: function(timerName)
+ {
+ if(this[timerName] != 0)
+ {
+ this._window.clearTimeout(this[timerName]);
+ this[timerName] = 0;
+ }
+ },
+
+ clearStatusField: function()
+ {
+ this._getters.statusOverlay.value = "";
+
+ let status_label = this._getters.statusWidgetLabel;
+ if(status_label)
+ {
+ status_label.value = "";
+ }
+
+ },
+
+ setStatusField: function(location, text, allowTooltip)
+ {
+ if(!location)
+ {
+ return;
+ }
+
+ let label = null;
+
+ if(this._isFullScreen && this._service.advancedStatusDetectFullScreen)
+ {
+ switch(location)
+ {
+ case 1: // Toolbar
+ location = 3
+ break;
+ case 2: // URL bar
+ if(Services.prefs.getBoolPref("browser.fullscreen.autohide"))
+ {
+ location = 3
+ }
+ break;
+ }
+ }
+
+ switch(location)
+ {
+ case 1: // Toolbar
+ label = this._getters.statusWidgetLabel;
+ break;
+ case 2: // URL Bar
+ break;
+ case 3: // Popup
+ default:
+ if(this._isFullScreenVideo && this._service.advancedStatusDetectVideo)
+ {
+ return;
+ }
+ label = this._getters.statusOverlay;
+ break;
+ }
+
+ if(label)
+ {
+ label.setAttribute("previoustype", label.getAttribute("type"));
+ label.setAttribute("type", text.type);
+ label.value = text.val;
+ label.setAttribute("crop", text.type == "overLink" ? "center" : "end");
+ }
+ }
};
function S4EOverlinkService(window, service, statusService) {
- this._window = window;
- this._service = service;
- this._statusService = statusService;
+ this._window = window;
+ this._service = service;
+ this._statusService = statusService;
}
S4EOverlinkService.prototype =
{
- _window: null,
- _service: null,
- _statusService: null,
-
- _timer: 0,
- _currentLink: { link: "", anchor: null },
- _pendingLink: { link: "", anchor: null },
- _listening: false,
-
- update: function(aLink, aAnchor)
- {
- this.clearTimer();
- this.stopListen();
- this._pendingLink = { link: aLink, anchor: aAnchor };
-
- if(!aLink)
- {
- if(this._window.XULBrowserWindow.hideOverLinkImmediately || !this._service.statusLinkOverDelayHide)
- {
- this._show();
- }
- else
- {
- this._showDelayed();
- }
- }
- else if(this._currentLink.link || !this._service.statusLinkOverDelayShow)
- {
- this._show();
- }
- else
- {
- this._showDelayed();
- this.startListen();
- }
- },
-
- destroy: function()
- {
- this.clearTimer();
- this.stopListen();
-
- ["_currentLink", "_pendingLink", "_statusService", "_window"].forEach(function(prop)
- {
- delete this[prop];
- }, this);
- },
-
- startListen: function()
- {
- if(!this._listening)
- {
- this._window.addEventListener("mousemove", this, true);
- this._listening = true;
- }
- },
-
- stopListen: function()
- {
- if(this._listening)
- {
- this._window.removeEventListener("mousemove", this, true);
- this._listening = false;
- }
- },
-
- clearTimer: function()
- {
- if(this._timer != 0)
- {
- this._window.clearTimeout(this._timer);
- this._timer = 0;
- }
- },
-
- handleEvent: function(event)
- {
- switch(event.type)
- {
- case "mousemove":
- this.clearTimer();
- this._showDelayed();
- }
- },
-
- _showDelayed: function()
- {
- let delay = ((this._pendingLink.link)
- ? this._service.statusLinkOverDelayShow
- : this._service.statusLinkOverDelayHide);
-
- this._timer = this._window.setTimeout(function(self)
- {
- self._timer = 0;
- self._show();
- self.stopListen();
- }, delay, this);
- },
-
- _show: function()
- {
- this._currentLink = this._pendingLink;
- this._statusService.setOverLinkInternal(this._currentLink.link, this._currentLink.anchor);
- }
+ _window: null,
+ _service: null,
+ _statusService: null,
+
+ _timer: 0,
+ _currentLink: { link: "", anchor: null },
+ _pendingLink: { link: "", anchor: null },
+ _listening: false,
+
+ update: function(aLink, aAnchor)
+ {
+ this.clearTimer();
+ this.stopListen();
+ this._pendingLink = { link: aLink, anchor: aAnchor };
+
+ if(!aLink)
+ {
+ if(this._window.XULBrowserWindow.hideOverLinkImmediately || !this._service.statusLinkOverDelayHide)
+ {
+ this._show();
+ }
+ else
+ {
+ this._showDelayed();
+ }
+ }
+ else if(this._currentLink.link || !this._service.statusLinkOverDelayShow)
+ {
+ this._show();
+ }
+ else
+ {
+ this._showDelayed();
+ this.startListen();
+ }
+ },
+
+ destroy: function()
+ {
+ this.clearTimer();
+ this.stopListen();
+
+ ["_currentLink", "_pendingLink", "_statusService", "_window"].forEach(function(prop)
+ {
+ delete this[prop];
+ }, this);
+ },
+
+ startListen: function()
+ {
+ if(!this._listening)
+ {
+ this._window.addEventListener("mousemove", this, true);
+ this._listening = true;
+ }
+ },
+
+ stopListen: function()
+ {
+ if(this._listening)
+ {
+ this._window.removeEventListener("mousemove", this, true);
+ this._listening = false;
+ }
+ },
+
+ clearTimer: function()
+ {
+ if(this._timer != 0)
+ {
+ this._window.clearTimeout(this._timer);
+ this._timer = 0;
+ }
+ },
+
+ handleEvent: function(event)
+ {
+ switch(event.type)
+ {
+ case "mousemove":
+ this.clearTimer();
+ this._showDelayed();
+ }
+ },
+
+ _showDelayed: function()
+ {
+ let delay = ((this._pendingLink.link)
+ ? this._service.statusLinkOverDelayShow
+ : this._service.statusLinkOverDelayHide);
+
+ this._timer = this._window.setTimeout(function(self)
+ {
+ self._timer = 0;
+ self._show();
+ self.stopListen();
+ }, delay, this);
+ },
+
+ _show: function()
+ {
+ this._currentLink = this._pendingLink;
+ this._statusService.setOverLinkInternal(this._currentLink.link, this._currentLink.anchor);
+ }
};
diff --git a/application/palemoon/components/statusbar/Status4Evar.jsm b/application/palemoon/components/statusbar/Status4Evar.jsm
index 03e899afca..055306a88c 100644
--- a/application/palemoon/components/statusbar/Status4Evar.jsm
+++ b/application/palemoon/components/statusbar/Status4Evar.jsm
@@ -23,257 +23,257 @@ CU.import("resource:///modules/statusbar/Toolbars.jsm");
function Status4Evar(window, gBrowser, toolbox)
{
- this._window = window;
- this._toolbox = toolbox;
+ this._window = window;
+ this._toolbox = toolbox;
- this.getters = new S4EWindowGetters(this._window);
- this.toolbars = new S4EToolbars(this._window, gBrowser, this._toolbox, s4e_service, this.getters);
- this.statusService = new S4EStatusService(this._window, s4e_service, this.getters);
- this.progressMeter = new S4EProgressService(gBrowser, s4e_service, this.getters, this.statusService);
- this.downloadStatus = new S4EDownloadService(this._window, gBrowser, s4e_service, this.getters);
- this.sizeModeService = new SizeModeService(this._window, this);
+ this.getters = new S4EWindowGetters(this._window);
+ this.toolbars = new S4EToolbars(this._window, gBrowser, this._toolbox, s4e_service, this.getters);
+ this.statusService = new S4EStatusService(this._window, s4e_service, this.getters);
+ this.progressMeter = new S4EProgressService(gBrowser, s4e_service, this.getters, this.statusService);
+ this.downloadStatus = new S4EDownloadService(this._window, gBrowser, s4e_service, this.getters);
+ this.sizeModeService = new SizeModeService(this._window, this);
- this._window.addEventListener("unload", this, false);
+ this._window.addEventListener("unload", this, false);
}
Status4Evar.prototype =
{
- _window: null,
- _toolbox: null,
-
- getters: null,
- toolbars: null,
- statusService: null,
- progressMeter: null,
- downloadStatus: null,
- sizeModeService: null,
-
- setup: function()
- {
- this._toolbox.addEventListener("beforecustomization", this, false);
- this._toolbox.addEventListener("aftercustomization", this, false);
-
- this.toolbars.setup();
- this.updateWindow();
-
- // OMFG HAX! If a page is already loading, fake a network start event
- if(this._window.XULBrowserWindow._busyUI)
- {
- let nsIWPL = CI.nsIWebProgressListener;
- this.progressMeter.onStateChange(0, null, nsIWPL.STATE_START | nsIWPL.STATE_IS_NETWORK, 0);
- }
- },
-
- destroy: function()
- {
- this._window.removeEventListener("unload", this, false);
- this._toolbox.removeEventListener("aftercustomization", this, false);
- this._toolbox.removeEventListener("beforecustomization", this, false);
-
- this.getters.destroy();
- this.statusService.destroy();
- this.downloadStatus.destroy();
- this.progressMeter.destroy();
- this.toolbars.destroy();
- this.sizeModeService.destroy();
-
- ["_window", "_toolbox", "getters", "statusService", "downloadStatus",
- "progressMeter", "toolbars", "sizeModeService"].forEach(function(prop)
- {
- delete this[prop];
- }, this);
- },
-
- handleEvent: function(aEvent)
- {
- switch(aEvent.type)
- {
- case "unload":
- this.destroy();
- break;
- case "beforecustomization":
- this.beforeCustomization();
- break;
- case "aftercustomization":
- this.updateWindow();
- break;
- }
- },
-
- beforeCustomization: function()
- {
- this.toolbars.updateSplitters(false);
- this.toolbars.updateWindowGripper(false);
-
- this.statusService.setNoUpdate(true);
- let status_label = this.getters.statusWidgetLabel;
- if(status_label)
- {
- status_label.value = this.getters.strings.getString("statusText");
- }
-
- this.downloadStatus.customizing(true);
- },
-
- updateWindow: function()
- {
- this.statusService.setNoUpdate(false);
- this.getters.resetGetters();
- this.statusService.buildTextOrder();
- this.statusService.buildBinding();
- this.downloadStatus.init();
- this.downloadStatus.customizing(false);
- this.toolbars.updateSplitters(true);
-
- s4e_service.updateWindow(this._window);
- // This also handles the following:
- // * buildTextOrder()
- // * updateStatusField(true)
- // * updateWindowGripper(true)
- },
-
- launchOptions: function(currentWindow)
- {
- let optionsURL = "chrome://browser/content/statusbar/prefs.xul";
- let windows = Services.wm.getEnumerator(null);
- while (windows.hasMoreElements())
- {
- let win = windows.getNext();
- if (win.document.documentURI == optionsURL)
- {
- win.focus();
- return;
- }
- }
-
- let features = "chrome,titlebar,toolbar,centerscreen";
- try
- {
- let instantApply = Services.prefs.getBoolPref("browser.preferences.instantApply");
- features += instantApply ? ",dialog=no" : ",modal";
- }
- catch(e)
- {
- features += ",modal";
- }
- currentWindow.openDialog(optionsURL, "", features);
- }
+ _window: null,
+ _toolbox: null,
+
+ getters: null,
+ toolbars: null,
+ statusService: null,
+ progressMeter: null,
+ downloadStatus: null,
+ sizeModeService: null,
+
+ setup: function()
+ {
+ this._toolbox.addEventListener("beforecustomization", this, false);
+ this._toolbox.addEventListener("aftercustomization", this, false);
+
+ this.toolbars.setup();
+ this.updateWindow();
+
+ // OMFG HAX! If a page is already loading, fake a network start event
+ if(this._window.XULBrowserWindow._busyUI)
+ {
+ let nsIWPL = CI.nsIWebProgressListener;
+ this.progressMeter.onStateChange(0, null, nsIWPL.STATE_START | nsIWPL.STATE_IS_NETWORK, 0);
+ }
+ },
+
+ destroy: function()
+ {
+ this._window.removeEventListener("unload", this, false);
+ this._toolbox.removeEventListener("aftercustomization", this, false);
+ this._toolbox.removeEventListener("beforecustomization", this, false);
+
+ this.getters.destroy();
+ this.statusService.destroy();
+ this.downloadStatus.destroy();
+ this.progressMeter.destroy();
+ this.toolbars.destroy();
+ this.sizeModeService.destroy();
+
+ ["_window", "_toolbox", "getters", "statusService", "downloadStatus",
+ "progressMeter", "toolbars", "sizeModeService"].forEach(function(prop)
+ {
+ delete this[prop];
+ }, this);
+ },
+
+ handleEvent: function(aEvent)
+ {
+ switch(aEvent.type)
+ {
+ case "unload":
+ this.destroy();
+ break;
+ case "beforecustomization":
+ this.beforeCustomization();
+ break;
+ case "aftercustomization":
+ this.updateWindow();
+ break;
+ }
+ },
+
+ beforeCustomization: function()
+ {
+ this.toolbars.updateSplitters(false);
+ this.toolbars.updateWindowGripper(false);
+
+ this.statusService.setNoUpdate(true);
+ let status_label = this.getters.statusWidgetLabel;
+ if(status_label)
+ {
+ status_label.value = this.getters.strings.getString("statusText");
+ }
+
+ this.downloadStatus.customizing(true);
+ },
+
+ updateWindow: function()
+ {
+ this.statusService.setNoUpdate(false);
+ this.getters.resetGetters();
+ this.statusService.buildTextOrder();
+ this.statusService.buildBinding();
+ this.downloadStatus.init();
+ this.downloadStatus.customizing(false);
+ this.toolbars.updateSplitters(true);
+
+ s4e_service.updateWindow(this._window);
+ // This also handles the following:
+ // * buildTextOrder()
+ // * updateStatusField(true)
+ // * updateWindowGripper(true)
+ },
+
+ launchOptions: function(currentWindow)
+ {
+ let optionsURL = "chrome://browser/content/statusbar/prefs.xul";
+ let windows = Services.wm.getEnumerator(null);
+ while (windows.hasMoreElements())
+ {
+ let win = windows.getNext();
+ if (win.document.documentURI == optionsURL)
+ {
+ win.focus();
+ return;
+ }
+ }
+
+ let features = "chrome,titlebar,toolbar,centerscreen";
+ try
+ {
+ let instantApply = Services.prefs.getBoolPref("browser.preferences.instantApply");
+ features += instantApply ? ",dialog=no" : ",modal";
+ }
+ catch(e)
+ {
+ features += ",modal";
+ }
+ currentWindow.openDialog(optionsURL, "", features);
+ }
};
function S4EWindowGetters(window)
{
- this._window = window;
+ this._window = window;
}
S4EWindowGetters.prototype =
{
- _window: null,
- _getterMap:
- [
- ["addonbar", "addon-bar"],
- ["addonbarCloseButton", "addonbar-closebutton"],
- ["browserBottomBox", "browser-bottombox"],
- ["downloadButton", "status4evar-download-button"],
- ["downloadButtonTooltip", "status4evar-download-tooltip"],
- ["downloadButtonProgress", "status4evar-download-progress-bar"],
- ["downloadButtonLabel", "status4evar-download-label"],
- ["downloadButtonAnchor", "status4evar-download-anchor"],
- ["downloadNotifyAnchor", "status4evar-download-notification-anchor"],
- ["statusBar", "status4evar-status-bar"],
- ["statusWidget", "status4evar-status-widget"],
- ["statusWidgetLabel", "status4evar-status-text"],
- ["strings", "bundle_status4evar"],
- ["throbberProgress", "status4evar-throbber-widget"],
- ["toolbarProgress", "status4evar-progress-bar"]
- ],
-
- resetGetters: function()
- {
- let document = this._window.document;
-
- this._getterMap.forEach(function(getter)
- {
- let [prop, id] = getter;
- delete this[prop];
- this.__defineGetter__(prop, function()
- {
- delete this[prop];
- return this[prop] = document.getElementById(id);
- });
- }, this);
-
- delete this.statusOverlay;
- this.__defineGetter__("statusOverlay", function()
- {
- let so = this._window.XULBrowserWindow.statusTextField;
- if(!so)
- {
- return null;
- }
-
- delete this.statusOverlay;
- return this.statusOverlay = so;
- });
- },
-
- destroy: function()
- {
- this._getterMap.forEach(function(getter)
- {
- let [prop, id] = getter;
- delete this[prop];
- }, this);
-
- ["statusOverlay", "statusOverlay", "_window"].forEach(function(prop)
- {
- delete this[prop];
- }, this);
- }
+ _window: null,
+ _getterMap:
+ [
+ ["addonbar", "addon-bar"],
+ ["addonbarCloseButton", "addonbar-closebutton"],
+ ["browserBottomBox", "browser-bottombox"],
+ ["downloadButton", "status4evar-download-button"],
+ ["downloadButtonTooltip", "status4evar-download-tooltip"],
+ ["downloadButtonProgress", "status4evar-download-progress-bar"],
+ ["downloadButtonLabel", "status4evar-download-label"],
+ ["downloadButtonAnchor", "status4evar-download-anchor"],
+ ["downloadNotifyAnchor", "status4evar-download-notification-anchor"],
+ ["statusBar", "status4evar-status-bar"],
+ ["statusWidget", "status4evar-status-widget"],
+ ["statusWidgetLabel", "status4evar-status-text"],
+ ["strings", "bundle_status4evar"],
+ ["throbberProgress", "status4evar-throbber-widget"],
+ ["toolbarProgress", "status4evar-progress-bar"]
+ ],
+
+ resetGetters: function()
+ {
+ let document = this._window.document;
+
+ this._getterMap.forEach(function(getter)
+ {
+ let [prop, id] = getter;
+ delete this[prop];
+ this.__defineGetter__(prop, function()
+ {
+ delete this[prop];
+ return this[prop] = document.getElementById(id);
+ });
+ }, this);
+
+ delete this.statusOverlay;
+ this.__defineGetter__("statusOverlay", function()
+ {
+ let so = this._window.XULBrowserWindow.statusTextField;
+ if(!so)
+ {
+ return null;
+ }
+
+ delete this.statusOverlay;
+ return this.statusOverlay = so;
+ });
+ },
+
+ destroy: function()
+ {
+ this._getterMap.forEach(function(getter)
+ {
+ let [prop, id] = getter;
+ delete this[prop];
+ }, this);
+
+ ["statusOverlay", "statusOverlay", "_window"].forEach(function(prop)
+ {
+ delete this[prop];
+ }, this);
+ }
};
function SizeModeService(window, s4e)
{
- this._window = window;
- this._s4e = s4e;
+ this._window = window;
+ this._s4e = s4e;
- this.lastFullScreen = this._window.fullScreen;
- this.lastwindowState = this._window.windowState;
- this._window.addEventListener("sizemodechange", this, false);
+ this.lastFullScreen = this._window.fullScreen;
+ this.lastwindowState = this._window.windowState;
+ this._window.addEventListener("sizemodechange", this, false);
}
SizeModeService.prototype =
{
- _window: null,
- _s4e: null,
-
- lastFullScreen: null,
- lastwindowState: null,
-
- destroy: function()
- {
- this._window.removeEventListener("sizemodechange", this, false);
-
- ["_window", "_s4e"].forEach(function(prop)
- {
- delete this[prop];
- }, this);
- },
-
- handleEvent: function(e)
- {
- if(this._window.fullScreen != this.lastFullScreen)
- {
- this.lastFullScreen = this._window.fullScreen;
- this._s4e.statusService.updateFullScreen();
- }
-
- if(this._window.windowState != this.lastwindowState)
- {
- this.lastwindowState = this._window.windowState;
- this._s4e.toolbars.updateWindowGripper(true);
- }
- },
-
- QueryInterface: XPCOMUtils.generateQI([ CI.nsIDOMEventListener ])
+ _window: null,
+ _s4e: null,
+
+ lastFullScreen: null,
+ lastwindowState: null,
+
+ destroy: function()
+ {
+ this._window.removeEventListener("sizemodechange", this, false);
+
+ ["_window", "_s4e"].forEach(function(prop)
+ {
+ delete this[prop];
+ }, this);
+ },
+
+ handleEvent: function(e)
+ {
+ if(this._window.fullScreen != this.lastFullScreen)
+ {
+ this.lastFullScreen = this._window.fullScreen;
+ this._s4e.statusService.updateFullScreen();
+ }
+
+ if(this._window.windowState != this.lastwindowState)
+ {
+ this.lastwindowState = this._window.windowState;
+ this._s4e.toolbars.updateWindowGripper(true);
+ }
+ },
+
+ QueryInterface: XPCOMUtils.generateQI([ CI.nsIDOMEventListener ])
};
diff --git a/application/palemoon/components/statusbar/Toolbars.jsm b/application/palemoon/components/statusbar/Toolbars.jsm
index dda8565fd1..321efd0921 100644
--- a/application/palemoon/components/statusbar/Toolbars.jsm
+++ b/application/palemoon/components/statusbar/Toolbars.jsm
@@ -13,209 +13,209 @@ CU.import("resource://gre/modules/Services.jsm");
function S4EToolbars(window, gBrowser, toolbox, service, getters)
{
- this._window = window;
- this._toolbox = toolbox;
- this._service = service;
- this._getters = getters;
- this._handler = new ClassicS4EToolbars(this._window, this._toolbox);
+ this._window = window;
+ this._toolbox = toolbox;
+ this._service = service;
+ this._getters = getters;
+ this._handler = new ClassicS4EToolbars(this._window, this._toolbox);
}
S4EToolbars.prototype =
{
- _window: null,
- _toolbox: null,
- _service: null,
- _getters: null,
-
- _handler: null,
-
- setup: function()
- {
- this.updateSplitters(false);
- this.updateWindowGripper(false);
- this._handler.setup(this._service.firstRun);
- },
-
- destroy: function()
- {
- this._handler.destroy();
-
- ["_window", "_toolbox", "_service", "_getters", "_handler"].forEach(function(prop)
- {
- delete this[prop];
- }, this);
- },
-
- updateSplitters: function(action)
- {
- let document = this._window.document;
-
- let splitter_before = document.getElementById("status4evar-status-splitter-before");
- if(splitter_before)
- {
- splitter_before.parentNode.removeChild(splitter_before);
- }
-
- let splitter_after = document.getElementById("status4evar-status-splitter-after");
- if(splitter_after)
- {
- splitter_after.parentNode.removeChild(splitter_after);
- }
-
- let status = this._getters.statusWidget;
- if(!action || !status)
- {
- return;
- }
-
- let urlbar = document.getElementById("urlbar-container");
- let stop = document.getElementById("stop-button");
- let fullscreenflex = document.getElementById("fullscreenflex");
-
- let nextSibling = status.nextSibling;
- let previousSibling = status.previousSibling;
-
- function getSplitter(splitter, suffix)
- {
- if(!splitter)
- {
- splitter = document.createElement("splitter");
- splitter.id = "status4evar-status-splitter-" + suffix;
- splitter.setAttribute("resizebefore", "flex");
- splitter.setAttribute("resizeafter", "flex");
- splitter.className = "chromeclass-toolbar-additional status4evar-status-splitter";
- }
- return splitter;
- }
-
- if((previousSibling && previousSibling.flex > 0)
- || (urlbar && stop && urlbar.getAttribute("combined") && stop == previousSibling))
- {
- status.parentNode.insertBefore(getSplitter(splitter_before, "before"), status);
- }
-
- if(nextSibling && nextSibling.flex > 0 && nextSibling != fullscreenflex)
- {
- status.parentNode.insertBefore(getSplitter(splitter_after, "after"), nextSibling);
- }
- },
-
- updateWindowGripper: function(action)
- {
- let document = this._window.document;
-
- let gripper = document.getElementById("status4evar-window-gripper");
- let toolbar = this._getters.statusBar || this._getters.addonbar;
-
- if(!action || !toolbar || !this._service.addonbarWindowGripper
- || this._window.windowState != CI.nsIDOMChromeWindow.STATE_NORMAL || toolbar.toolbox.customizing)
- {
- if(gripper)
- {
- gripper.parentNode.removeChild(gripper);
- }
- return;
- }
-
- gripper = this._handler.buildGripper(toolbar, gripper, "status4evar-window-gripper");
-
- toolbar.appendChild(gripper);
- }
+ _window: null,
+ _toolbox: null,
+ _service: null,
+ _getters: null,
+
+ _handler: null,
+
+ setup: function()
+ {
+ this.updateSplitters(false);
+ this.updateWindowGripper(false);
+ this._handler.setup(this._service.firstRun);
+ },
+
+ destroy: function()
+ {
+ this._handler.destroy();
+
+ ["_window", "_toolbox", "_service", "_getters", "_handler"].forEach(function(prop)
+ {
+ delete this[prop];
+ }, this);
+ },
+
+ updateSplitters: function(action)
+ {
+ let document = this._window.document;
+
+ let splitter_before = document.getElementById("status4evar-status-splitter-before");
+ if(splitter_before)
+ {
+ splitter_before.parentNode.removeChild(splitter_before);
+ }
+
+ let splitter_after = document.getElementById("status4evar-status-splitter-after");
+ if(splitter_after)
+ {
+ splitter_after.parentNode.removeChild(splitter_after);
+ }
+
+ let status = this._getters.statusWidget;
+ if(!action || !status)
+ {
+ return;
+ }
+
+ let urlbar = document.getElementById("urlbar-container");
+ let stop = document.getElementById("stop-button");
+ let fullscreenflex = document.getElementById("fullscreenflex");
+
+ let nextSibling = status.nextSibling;
+ let previousSibling = status.previousSibling;
+
+ function getSplitter(splitter, suffix)
+ {
+ if(!splitter)
+ {
+ splitter = document.createElement("splitter");
+ splitter.id = "status4evar-status-splitter-" + suffix;
+ splitter.setAttribute("resizebefore", "flex");
+ splitter.setAttribute("resizeafter", "flex");
+ splitter.className = "chromeclass-toolbar-additional status4evar-status-splitter";
+ }
+ return splitter;
+ }
+
+ if((previousSibling && previousSibling.flex > 0)
+ || (urlbar && stop && urlbar.getAttribute("combined") && stop == previousSibling))
+ {
+ status.parentNode.insertBefore(getSplitter(splitter_before, "before"), status);
+ }
+
+ if(nextSibling && nextSibling.flex > 0 && nextSibling != fullscreenflex)
+ {
+ status.parentNode.insertBefore(getSplitter(splitter_after, "after"), nextSibling);
+ }
+ },
+
+ updateWindowGripper: function(action)
+ {
+ let document = this._window.document;
+
+ let gripper = document.getElementById("status4evar-window-gripper");
+ let toolbar = this._getters.statusBar || this._getters.addonbar;
+
+ if(!action || !toolbar || !this._service.addonbarWindowGripper
+ || this._window.windowState != CI.nsIDOMChromeWindow.STATE_NORMAL || toolbar.toolbox.customizing)
+ {
+ if(gripper)
+ {
+ gripper.parentNode.removeChild(gripper);
+ }
+ return;
+ }
+
+ gripper = this._handler.buildGripper(toolbar, gripper, "status4evar-window-gripper");
+
+ toolbar.appendChild(gripper);
+ }
};
function ClassicS4EToolbars(window, toolbox)
{
- this._window = window;
- this._toolbox = toolbox;
+ this._window = window;
+ this._toolbox = toolbox;
}
ClassicS4EToolbars.prototype =
{
- _window: null,
- _toolbox: null,
-
- setup: function(firstRun)
- {
- let document = this._window.document;
-
- let addon_bar = document.getElementById("addon-bar");
- if(addon_bar)
- {
- let baseSet = "addonbar-closebutton"
- + ",status4evar-status-widget"
- + ",status4evar-progress-widget";
-
- // Update the defaultSet
- let defaultSet = baseSet;
- let defaultSetIgnore = ["addonbar-closebutton", "spring", "status-bar"];
- addon_bar.getAttribute("defaultset").split(",").forEach(function(item)
- {
- if(defaultSetIgnore.indexOf(item) == -1)
- {
- defaultSet += "," + item;
- }
- });
- defaultSet += ",status-bar"
- addon_bar.setAttribute("defaultset", defaultSet);
-
- // Update the currentSet
- if(firstRun)
- {
- let isCustomizableToolbar = function(aElt)
- {
- return aElt.localName == "toolbar" && aElt.getAttribute("customizable") == "true";
- }
-
- let isCustomizedAlready = false;
- let toolbars = Array.filter(this._toolbox.childNodes, isCustomizableToolbar).concat(
- Array.filter(this._toolbox.externalToolbars, isCustomizableToolbar));
- toolbars.forEach(function(toolbar)
- {
- if(toolbar.currentSet.indexOf("status4evar") > -1)
- {
- isCustomizedAlready = true;
- }
- });
-
- if(!isCustomizedAlready)
- {
- let currentSet = baseSet;
- let currentSetIgnore = ["addonbar-closebutton", "spring"];
- addon_bar.currentSet.split(",").forEach(function(item)
- {
- if(currentSetIgnore.indexOf(item) == -1)
- {
- currentSet += "," + item;
- }
- });
- addon_bar.currentSet = currentSet;
- addon_bar.setAttribute("currentset", currentSet);
- document.persist(addon_bar.id, "currentset");
- this._window.setToolbarVisibility(addon_bar, true);
- }
- }
- }
- },
-
- destroy: function()
- {
- ["_window", "_toolbox"].forEach(function(prop)
- {
- delete this[prop];
- }, this);
- },
-
- buildGripper: function(toolbar, gripper, id)
- {
- if(!gripper)
- {
- let document = this._window.document;
-
- gripper = document.createElement("resizer");
- gripper.id = id;
- gripper.dir = "bottomend";
- }
-
- return gripper;
- }
+ _window: null,
+ _toolbox: null,
+
+ setup: function(firstRun)
+ {
+ let document = this._window.document;
+
+ let addon_bar = document.getElementById("addon-bar");
+ if(addon_bar)
+ {
+ let baseSet = "addonbar-closebutton"
+ + ",status4evar-status-widget"
+ + ",status4evar-progress-widget";
+
+ // Update the defaultSet
+ let defaultSet = baseSet;
+ let defaultSetIgnore = ["addonbar-closebutton", "spring", "status-bar"];
+ addon_bar.getAttribute("defaultset").split(",").forEach(function(item)
+ {
+ if(defaultSetIgnore.indexOf(item) == -1)
+ {
+ defaultSet += "," + item;
+ }
+ });
+ defaultSet += ",status-bar"
+ addon_bar.setAttribute("defaultset", defaultSet);
+
+ // Update the currentSet
+ if(firstRun)
+ {
+ let isCustomizableToolbar = function(aElt)
+ {
+ return aElt.localName == "toolbar" && aElt.getAttribute("customizable") == "true";
+ }
+
+ let isCustomizedAlready = false;
+ let toolbars = Array.filter(this._toolbox.childNodes, isCustomizableToolbar).concat(
+ Array.filter(this._toolbox.externalToolbars, isCustomizableToolbar));
+ toolbars.forEach(function(toolbar)
+ {
+ if(toolbar.currentSet.indexOf("status4evar") > -1)
+ {
+ isCustomizedAlready = true;
+ }
+ });
+
+ if(!isCustomizedAlready)
+ {
+ let currentSet = baseSet;
+ let currentSetIgnore = ["addonbar-closebutton", "spring"];
+ addon_bar.currentSet.split(",").forEach(function(item)
+ {
+ if(currentSetIgnore.indexOf(item) == -1)
+ {
+ currentSet += "," + item;
+ }
+ });
+ addon_bar.currentSet = currentSet;
+ addon_bar.setAttribute("currentset", currentSet);
+ document.persist(addon_bar.id, "currentset");
+ this._window.setToolbarVisibility(addon_bar, true);
+ }
+ }
+ }
+ },
+
+ destroy: function()
+ {
+ ["_window", "_toolbox"].forEach(function(prop)
+ {
+ delete this[prop];
+ }, this);
+ },
+
+ buildGripper: function(toolbar, gripper, id)
+ {
+ if(!gripper)
+ {
+ let document = this._window.document;
+
+ gripper = document.createElement("resizer");
+ gripper.id = id;
+ gripper.dir = "bottomend";
+ }
+
+ return gripper;
+ }
};
diff --git a/application/palemoon/components/statusbar/content/overlay.css b/application/palemoon/components/statusbar/content/overlay.css
index 6375b8ef84..fd34521191 100644
--- a/application/palemoon/components/statusbar/content/overlay.css
+++ b/application/palemoon/components/statusbar/content/overlay.css
@@ -8,8 +8,7 @@
* Status Popup
*/
-statuspanel
-{
- -moz-binding: url("chrome://browser/content/statusbar/tabbrowser.xml#statuspanel");
+statuspanel {
+ -moz-binding: url("chrome://browser/content/statusbar/tabbrowser.xml#statuspanel");
}
diff --git a/application/palemoon/components/statusbar/content/overlay.js b/application/palemoon/components/statusbar/content/overlay.js
index cf6cfe2962..b868aaf0e5 100644
--- a/application/palemoon/components/statusbar/content/overlay.js
+++ b/application/palemoon/components/statusbar/content/overlay.js
@@ -6,11 +6,11 @@ if(!caligon) var caligon = {};
window.addEventListener("load", function buildS4E()
{
- window.removeEventListener("load", buildS4E, false);
+ window.removeEventListener("load", buildS4E, false);
- Components.utils.import("resource:///modules/statusbar/Status4Evar.jsm");
+ Components.utils.import("resource:///modules/statusbar/Status4Evar.jsm");
- caligon.status4evar = new Status4Evar(window, gBrowser, gNavToolbox);
- caligon.status4evar.setup();
+ caligon.status4evar = new Status4Evar(window, gBrowser, gNavToolbox);
+ caligon.status4evar.setup();
}, false);
diff --git a/application/palemoon/components/statusbar/content/overlay.xul b/application/palemoon/components/statusbar/content/overlay.xul
index f9a61a92ec..b9934ee656 100644
--- a/application/palemoon/components/statusbar/content/overlay.xul
+++ b/application/palemoon/components/statusbar/content/overlay.xul
@@ -13,23 +13,23 @@
<overlay id="status4evar-overlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <stringbundleset id="stringbundleset">
- <stringbundle id="bundle_status4evar" src="chrome://browser/locale/statusbar/overlay.properties" />
- </stringbundleset>
+ <stringbundleset id="stringbundleset">
+ <stringbundle id="bundle_status4evar" src="chrome://browser/locale/statusbar/overlay.properties" />
+ </stringbundleset>
- <script type="application/javascript" src="chrome://browser/content/statusbar/overlay.js" />
+ <script type="application/javascript" src="chrome://browser/content/statusbar/overlay.js" />
- <commandset>
- <command id="S4E:Options" oncommand="caligon.status4evar.launchOptions(window);"/>
- </commandset>
+ <commandset>
+ <command id="S4E:Options" oncommand="caligon.status4evar.launchOptions(window);"/>
+ </commandset>
- <popupset id="mainPopupSet">
- <hbox id="status4evar-download-notification-container" mousethrough="always">
- <vbox id="status4evar-download-notification-anchor">
- <vbox id="status4evar-download-notification-icon" />
- </vbox>
- </hbox>
- </popupset>
+ <popupset id="mainPopupSet">
+ <hbox id="status4evar-download-notification-container" mousethrough="always">
+ <vbox id="status4evar-download-notification-anchor">
+ <vbox id="status4evar-download-notification-icon" />
+ </vbox>
+ </hbox>
+ </popupset>
<menupopup id="menu_ToolsPopup">
<menuitem id="statusbar-options-fx" command="S4E:Options"
@@ -41,41 +41,41 @@
label="&status4evar.menu.options.label;"/>
</menupopup>
- <toolbarpalette id="BrowserToolbarPalette">
- <toolbaritem id="status4evar-status-widget"
- title="&status4evar.status.widget.title;"
- removable="true" flex="1" persist="width" width="100">
- <label id="status4evar-status-text" flex="1" crop="end" value="&status4evar.status.widget.title;" />
- </toolbaritem>
+ <toolbarpalette id="BrowserToolbarPalette">
+ <toolbaritem id="status4evar-status-widget"
+ title="&status4evar.status.widget.title;"
+ removable="true" flex="1" persist="width" width="100">
+ <label id="status4evar-status-text" flex="1" crop="end" value="&status4evar.status.widget.title;" />
+ </toolbaritem>
- <toolbarbutton id="status4evar-download-button"
- title="&status4evar.download.widget.title;"
- class="toolbarbutton-1 chromeclass-toolbar-additional"
- removable="true" collapsed="true" tooltip="_child"
- oncommand="caligon.status4evar.downloadStatus.openUI(event)">
- <stack id="status4evar-download-anchor" class="toolbarbutton-icon">
- <vbox id="status4evar-download-icon" />
- <vbox pack="end">
- <progressmeter id="status4evar-download-progress-bar" mode="normal" value="0" collapsed="true" min="0" max="100" />
- </vbox>
- </stack>
- <tooltip id="status4evar-download-tooltip" />
- <label id="status4evar-download-label" value="&status4evar.download.widget.title;" class="toolbarbutton-text" crop="right" flex="1" />
- </toolbarbutton>
+ <toolbarbutton id="status4evar-download-button"
+ title="&status4evar.download.widget.title;"
+ class="toolbarbutton-1 chromeclass-toolbar-additional"
+ removable="true" collapsed="true" tooltip="_child"
+ oncommand="caligon.status4evar.downloadStatus.openUI(event)">
+ <stack id="status4evar-download-anchor" class="toolbarbutton-icon">
+ <vbox id="status4evar-download-icon" />
+ <vbox pack="end">
+ <progressmeter id="status4evar-download-progress-bar" mode="normal" value="0" collapsed="true" min="0" max="100" />
+ </vbox>
+ </stack>
+ <tooltip id="status4evar-download-tooltip" />
+ <label id="status4evar-download-label" value="&status4evar.download.widget.title;" class="toolbarbutton-text" crop="right" flex="1" />
+ </toolbarbutton>
- <toolbaritem id="status4evar-progress-widget"
- title="&status4evar.progress.widget.title;"
- removable="true">
- <progressmeter id="status4evar-progress-bar" class="progressmeter-statusbar"
- mode="normal" value="0" collapsed="true" min="0" max="100" />
- </toolbaritem>
+ <toolbaritem id="status4evar-progress-widget"
+ title="&status4evar.progress.widget.title;"
+ removable="true">
+ <progressmeter id="status4evar-progress-bar" class="progressmeter-statusbar"
+ mode="normal" value="0" collapsed="true" min="0" max="100" />
+ </toolbaritem>
- <toolbarbutton id="status4evar-options-button"
- title="&status4evar.options.widget.title;"
- class="toolbarbutton-1 chromeclass-toolbar-additional"
- label="&status4evar.options.widget.label;"
- removable="true" command="S4E:Options" tooltiptext="&status4evar.options.widget.title;" />
- </toolbarpalette>
+ <toolbarbutton id="status4evar-options-button"
+ title="&status4evar.options.widget.title;"
+ class="toolbarbutton-1 chromeclass-toolbar-additional"
+ label="&status4evar.options.widget.label;"
+ removable="true" command="S4E:Options" tooltiptext="&status4evar.options.widget.title;" />
+ </toolbarpalette>
<statusbar id="status-bar" ordinal="1" />
</overlay>
diff --git a/application/palemoon/components/statusbar/content/prefs.css b/application/palemoon/components/statusbar/content/prefs.css
index c627f78fb0..bafaa6129a 100644
--- a/application/palemoon/components/statusbar/content/prefs.css
+++ b/application/palemoon/components/statusbar/content/prefs.css
@@ -4,8 +4,7 @@
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
-.css-bg-editor
-{
- -moz-binding: url("chrome://browser/content/statusbar/prefs.xml#css-bg-editor");
+.css-bg-editor {
+ -moz-binding: url("chrome://browser/content/statusbar/prefs.xml#css-bg-editor");
}
diff --git a/application/palemoon/components/statusbar/content/prefs.js b/application/palemoon/components/statusbar/content/prefs.js
index ed81fb2716..47fd4b63d1 100644
--- a/application/palemoon/components/statusbar/content/prefs.js
+++ b/application/palemoon/components/statusbar/content/prefs.js
@@ -6,267 +6,267 @@ Components.utils.import("resource://gre/modules/Services.jsm");
var status4evarPrefs =
{
- get dynamicProgressStyle()
- {
- let styleSheets = window.document.styleSheets;
- for(let i = 0; i < styleSheets.length; i++)
- {
- let styleSheet = styleSheets[i];
- if(styleSheet.href == "chrome://browser/skin/statusbar/dynamic.css")
- {
- delete this.dynamicProgressStyle;
- return this.dynamicProgressStyle = styleSheet;
- }
- }
-
- return null;
- },
+ get dynamicProgressStyle()
+ {
+ let styleSheets = window.document.styleSheets;
+ for(let i = 0; i < styleSheets.length; i++)
+ {
+ let styleSheet = styleSheets[i];
+ if(styleSheet.href == "chrome://browser/skin/statusbar/dynamic.css")
+ {
+ delete this.dynamicProgressStyle;
+ return this.dynamicProgressStyle = styleSheet;
+ }
+ }
+
+ return null;
+ },
//
// Status timeout management
//
- get statusTimeoutPref()
- {
- delete this.statusTimeoutPref;
- return this.statusTimeoutPref = document.getElementById("status4evar-pref-status-timeout");
- },
-
- get statusTimeoutCheckbox()
- {
- delete this.statusTimeoutCheckbox;
- return this.statusTimeoutCheckbox = document.getElementById("status4evar-status-timeout-check");
- },
-
- statusTimeoutChanged: function()
- {
- if(this.statusTimeoutPref.value > 0)
- {
- this.statusTimeoutPref.disabled = false;
- this.statusTimeoutCheckbox.checked = true;
- }
- else
- {
- this.statusTimeoutPref.disabled = true;
- this.statusTimeoutCheckbox.checked = false;
- }
- },
-
- statusTimeoutSync: function()
- {
- this.statusTimeoutChanged();
- return undefined;
- },
-
- statusTimeoutToggle: function()
- {
- if(this.statusTimeoutPref.disabled == this.statusTimeoutCheckbox.checked)
- {
- if(this.statusTimeoutCheckbox.checked)
- {
- this.statusTimeoutPref.value = 10;
- }
- else
- {
- this.statusTimeoutPref.value = 0;
- }
- }
- },
+ get statusTimeoutPref()
+ {
+ delete this.statusTimeoutPref;
+ return this.statusTimeoutPref = document.getElementById("status4evar-pref-status-timeout");
+ },
+
+ get statusTimeoutCheckbox()
+ {
+ delete this.statusTimeoutCheckbox;
+ return this.statusTimeoutCheckbox = document.getElementById("status4evar-status-timeout-check");
+ },
+
+ statusTimeoutChanged: function()
+ {
+ if(this.statusTimeoutPref.value > 0)
+ {
+ this.statusTimeoutPref.disabled = false;
+ this.statusTimeoutCheckbox.checked = true;
+ }
+ else
+ {
+ this.statusTimeoutPref.disabled = true;
+ this.statusTimeoutCheckbox.checked = false;
+ }
+ },
+
+ statusTimeoutSync: function()
+ {
+ this.statusTimeoutChanged();
+ return undefined;
+ },
+
+ statusTimeoutToggle: function()
+ {
+ if(this.statusTimeoutPref.disabled == this.statusTimeoutCheckbox.checked)
+ {
+ if(this.statusTimeoutCheckbox.checked)
+ {
+ this.statusTimeoutPref.value = 10;
+ }
+ else
+ {
+ this.statusTimeoutPref.value = 0;
+ }
+ }
+ },
//
// Status network management
//
- get statusNetworkPref()
- {
- delete this.statusNetworkPref;
- return this.statusNetworkPref = document.getElementById("status4evar-pref-status-network");
- },
-
- get statusNetworkXHRPref()
- {
- delete this.statusNetworkXHRPref;
- return this.statusNetworkXHRPref = document.getElementById("status4evar-pref-status-network-xhr");
- },
-
- statusNetworkChanged: function()
- {
- this.statusNetworkXHRPref.disabled = ! this.statusNetworkPref.value;
- },
-
- statusNetworkSync: function()
- {
- this.statusNetworkChanged();
- return undefined;
- },
+ get statusNetworkPref()
+ {
+ delete this.statusNetworkPref;
+ return this.statusNetworkPref = document.getElementById("status4evar-pref-status-network");
+ },
+
+ get statusNetworkXHRPref()
+ {
+ delete this.statusNetworkXHRPref;
+ return this.statusNetworkXHRPref = document.getElementById("status4evar-pref-status-network-xhr");
+ },
+
+ statusNetworkChanged: function()
+ {
+ this.statusNetworkXHRPref.disabled = ! this.statusNetworkPref.value;
+ },
+
+ statusNetworkSync: function()
+ {
+ this.statusNetworkChanged();
+ return undefined;
+ },
//
// Status Text langth managment
//
- get textMaxLengthPref()
- {
- delete this.textMaxLengthPref;
- return this.textMaxLengthPref = document.getElementById("status4evar-pref-status-toolbar-maxLength");
- },
-
- get textMaxLengthCheckbox()
- {
- delete this.textMaxLengthCheckbox;
- return this.textMaxLengthCheckbox = document.getElementById("status4evar-status-toolbar-maxLength-check");
- },
-
- textLengthChanged: function()
- {
- if(this.textMaxLengthPref.value > 0)
- {
- this.textMaxLengthPref.disabled = false;
- this.textMaxLengthCheckbox.checked = true;
- }
- else
- {
- this.textMaxLengthPref.disabled = true;
- this.textMaxLengthCheckbox.checked = false;
- }
- },
-
- textLengthSync: function()
- {
- this.textLengthChanged();
- return undefined;
- },
-
- textLengthToggle: function()
- {
- if(this.textMaxLengthPref.disabled == this.textMaxLengthCheckbox.checked)
- {
- if(this.textMaxLengthCheckbox.checked)
- {
- this.textMaxLengthPref.value = 800;
- }
- else
- {
- this.textMaxLengthPref.value = 0;
- }
- }
- },
+ get textMaxLengthPref()
+ {
+ delete this.textMaxLengthPref;
+ return this.textMaxLengthPref = document.getElementById("status4evar-pref-status-toolbar-maxLength");
+ },
+
+ get textMaxLengthCheckbox()
+ {
+ delete this.textMaxLengthCheckbox;
+ return this.textMaxLengthCheckbox = document.getElementById("status4evar-status-toolbar-maxLength-check");
+ },
+
+ textLengthChanged: function()
+ {
+ if(this.textMaxLengthPref.value > 0)
+ {
+ this.textMaxLengthPref.disabled = false;
+ this.textMaxLengthCheckbox.checked = true;
+ }
+ else
+ {
+ this.textMaxLengthPref.disabled = true;
+ this.textMaxLengthCheckbox.checked = false;
+ }
+ },
+
+ textLengthSync: function()
+ {
+ this.textLengthChanged();
+ return undefined;
+ },
+
+ textLengthToggle: function()
+ {
+ if(this.textMaxLengthPref.disabled == this.textMaxLengthCheckbox.checked)
+ {
+ if(this.textMaxLengthCheckbox.checked)
+ {
+ this.textMaxLengthPref.value = 800;
+ }
+ else
+ {
+ this.textMaxLengthPref.value = 0;
+ }
+ }
+ },
//
// Toolbar progress style management
//
- get progressToolbarStylePref()
- {
- delete this.progressToolbarStylePref;
- return this.progressToolbarStylePref = document.getElementById("status4evar-pref-progress-toolbar-style");
- },
-
- get progressToolbarCSSPref()
- {
- delete this.progressToolbarCSSPref;
- return this.progressToolbarCSSPref = document.getElementById("status4evar-pref-progress-toolbar-css");
- },
-
- get progressToolbarProgress()
- {
- delete this.progressToolbarProgress;
- return this.progressToolbarProgress = document.getElementById("status4evar-progress-bar");
- },
-
- progressToolbarCSSChanged: function()
- {
- if(!this.progressToolbarCSSPref.value)
- {
- this.progressToolbarCSSPref.value = "#33FF33";
- }
- this.dynamicProgressStyle.cssRules[1].style.background = this.progressToolbarCSSPref.value;
- },
-
- progressToolbarStyleChanged: function()
- {
- this.progressToolbarCSSChanged();
- this.progressToolbarCSSPref.disabled = !this.progressToolbarStylePref.value;
- if(this.progressToolbarStylePref.value)
- {
- this.progressToolbarProgress.setAttribute("s4estyle", true);
- }
- else
- {
- this.progressToolbarProgress.removeAttribute("s4estyle");
- }
- },
-
- progressToolbarStyleSync: function()
- {
- this.progressToolbarStyleChanged();
- return undefined;
- },
+ get progressToolbarStylePref()
+ {
+ delete this.progressToolbarStylePref;
+ return this.progressToolbarStylePref = document.getElementById("status4evar-pref-progress-toolbar-style");
+ },
+
+ get progressToolbarCSSPref()
+ {
+ delete this.progressToolbarCSSPref;
+ return this.progressToolbarCSSPref = document.getElementById("status4evar-pref-progress-toolbar-css");
+ },
+
+ get progressToolbarProgress()
+ {
+ delete this.progressToolbarProgress;
+ return this.progressToolbarProgress = document.getElementById("status4evar-progress-bar");
+ },
+
+ progressToolbarCSSChanged: function()
+ {
+ if(!this.progressToolbarCSSPref.value)
+ {
+ this.progressToolbarCSSPref.value = "#33FF33";
+ }
+ this.dynamicProgressStyle.cssRules[1].style.background = this.progressToolbarCSSPref.value;
+ },
+
+ progressToolbarStyleChanged: function()
+ {
+ this.progressToolbarCSSChanged();
+ this.progressToolbarCSSPref.disabled = !this.progressToolbarStylePref.value;
+ if(this.progressToolbarStylePref.value)
+ {
+ this.progressToolbarProgress.setAttribute("s4estyle", true);
+ }
+ else
+ {
+ this.progressToolbarProgress.removeAttribute("s4estyle");
+ }
+ },
+
+ progressToolbarStyleSync: function()
+ {
+ this.progressToolbarStyleChanged();
+ return undefined;
+ },
//
// Download progress management
//
- get downloadProgressCheck()
- {
- delete this.downloadProgressCheck;
- return this.downloadProgressCheck = document.getElementById("status4evar-download-progress-check");
- },
-
- get downloadProgressPref()
- {
- delete this.downloadProgressPref;
- return this.downloadProgressPref = document.getElementById("status4evar-pref-download-progress");
- },
-
- get downloadProgressColorActivePref()
- {
- delete this.downloadProgressActiveColorPref;
- return this.downloadProgressActiveColorPref = document.getElementById("status4evar-pref-download-color-active");
- },
-
- get downloadProgressColorPausedPref()
- {
- delete this.downloadProgressPausedColorPref;
- return this.downloadProgressPausedColorPref = document.getElementById("status4evar-pref-download-color-paused");
- },
-
- downloadProgressSync: function()
- {
- let val = this.downloadProgressPref.value;
- this.downloadProgressColorActivePref.disabled = (val == 0);
- this.downloadProgressColorPausedPref.disabled = (val == 0);
- this.downloadProgressPref.disabled = (val == 0);
- this.downloadProgressCheck.checked = (val != 0);
- return ((val == 0) ? 1 : val);
- },
-
- downloadProgressToggle: function()
- {
- let enabled = this.downloadProgressCheck.checked;
- this.downloadProgressPref.value = ((enabled) ? 1 : 0);
- },
+ get downloadProgressCheck()
+ {
+ delete this.downloadProgressCheck;
+ return this.downloadProgressCheck = document.getElementById("status4evar-download-progress-check");
+ },
+
+ get downloadProgressPref()
+ {
+ delete this.downloadProgressPref;
+ return this.downloadProgressPref = document.getElementById("status4evar-pref-download-progress");
+ },
+
+ get downloadProgressColorActivePref()
+ {
+ delete this.downloadProgressActiveColorPref;
+ return this.downloadProgressActiveColorPref = document.getElementById("status4evar-pref-download-color-active");
+ },
+
+ get downloadProgressColorPausedPref()
+ {
+ delete this.downloadProgressPausedColorPref;
+ return this.downloadProgressPausedColorPref = document.getElementById("status4evar-pref-download-color-paused");
+ },
+
+ downloadProgressSync: function()
+ {
+ let val = this.downloadProgressPref.value;
+ this.downloadProgressColorActivePref.disabled = (val == 0);
+ this.downloadProgressColorPausedPref.disabled = (val == 0);
+ this.downloadProgressPref.disabled = (val == 0);
+ this.downloadProgressCheck.checked = (val != 0);
+ return ((val == 0) ? 1 : val);
+ },
+
+ downloadProgressToggle: function()
+ {
+ let enabled = this.downloadProgressCheck.checked;
+ this.downloadProgressPref.value = ((enabled) ? 1 : 0);
+ },
//
// Pref Window load
//
- get downloadButtonActionCommandPref()
- {
- delete this.downloadButtonActionCommandPref;
- return this.downloadButtonActionCommandPref = document.getElementById("status4evar-pref-download-button-action-command");
- },
-
- get downloadButtonActionThirdPartyItem()
- {
- delete this.downloadButtonActionThirdPartyItem;
- return this.downloadButtonActionThirdPartyItem = document.getElementById("status4evar-download-button-action-menu-thirdparty");
- },
-
- onPrefWindowLoad: function()
- {
- if(!this.downloadButtonActionCommandPref.value)
- {
- this.downloadButtonActionThirdPartyItem.disabled = true;
- }
- },
-
- onPrefWindowUnLoad: function()
- {
- }
+ get downloadButtonActionCommandPref()
+ {
+ delete this.downloadButtonActionCommandPref;
+ return this.downloadButtonActionCommandPref = document.getElementById("status4evar-pref-download-button-action-command");
+ },
+
+ get downloadButtonActionThirdPartyItem()
+ {
+ delete this.downloadButtonActionThirdPartyItem;
+ return this.downloadButtonActionThirdPartyItem = document.getElementById("status4evar-download-button-action-menu-thirdparty");
+ },
+
+ onPrefWindowLoad: function()
+ {
+ if(!this.downloadButtonActionCommandPref.value)
+ {
+ this.downloadButtonActionThirdPartyItem.disabled = true;
+ }
+ },
+
+ onPrefWindowUnLoad: function()
+ {
+ }
}
var XULBrowserWindow = {
diff --git a/application/palemoon/components/statusbar/content/prefs.xml b/application/palemoon/components/statusbar/content/prefs.xml
index cf4a00bb8d..44baab18d3 100644
--- a/application/palemoon/components/statusbar/content/prefs.xml
+++ b/application/palemoon/components/statusbar/content/prefs.xml
@@ -11,694 +11,694 @@
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
- <binding id="css-bg-editor">
- <content sizetopopup="pref">
- <xul:vbox flex="1">
- <xul:deck anonid="css-bg-editor-deck" flex="1">
- <xul:vbox>
- <xul:hbox align="center">
- <xul:label xbl:inherits="disabled">&status4evar.editor.css.color.label;</xul:label>
- <xul:colorpicker anonid="css-bg-editor-color" type="button" onchange="this._editor._buildCSS();" xbl:inherits="disabled" />
- </xul:hbox>
-
- <xul:hbox align="center">
- <xul:label xbl:inherits="disabled">&status4evar.editor.css.image.label;</xul:label>
- <xul:textbox anonid="css-bg-editor-image" readonly="true" flex="1" xbl:inherits="disabled" />
- <xul:button anonid="css-bg-editor-image-browse" label="&status4evar.option.browse;" oncommand="this._editor._imageBrowse();" xbl:inherits="disabled" />
- </xul:hbox>
- <xul:hbox align="center" pack="end">
- <xul:button anonid="css-bg-editor-image-clear" label="&status4evar.option.clear;" oncommand="this._editor._imageClear();" xbl:inherits="disabled=no-image" />
- </xul:hbox>
-
- <xul:hbox>
- <xul:groupbox pack="center">
- <xul:caption label="" />
- <xul:hbox flex="1" align="center">
- <xul:label>X</xul:label>
- </xul:hbox>
- <xul:separator class="groove" orient="horizontal" />
- <xul:hbox flex="1" align="center">
- <xul:label>Y</xul:label>
- </xul:hbox>
- </xul:groupbox>
-
- <xul:groupbox>
- <xul:caption label="&status4evar.editor.css.image.repeat;" xbl:inherits="disabled=no-image" />
- <xul:menulist anonid="css-bg-editor-image-repeat-x" sizetopopup="always" onselect="this._editor._buildCSS();" xbl:inherits="disabled=no-image">
- <xul:menupopup>
- <xul:menuitem label="&status4evar.option.no-repeat;" value="no-repeat" />
- <xul:menuitem label="&status4evar.option.repeat;" value="repeat" />
+ <binding id="css-bg-editor">
+ <content sizetopopup="pref">
+ <xul:vbox flex="1">
+ <xul:deck anonid="css-bg-editor-deck" flex="1">
+ <xul:vbox>
+ <xul:hbox align="center">
+ <xul:label xbl:inherits="disabled">&status4evar.editor.css.color.label;</xul:label>
+ <xul:colorpicker anonid="css-bg-editor-color" type="button" onchange="this._editor._buildCSS();" xbl:inherits="disabled" />
+ </xul:hbox>
+
+ <xul:hbox align="center">
+ <xul:label xbl:inherits="disabled">&status4evar.editor.css.image.label;</xul:label>
+ <xul:textbox anonid="css-bg-editor-image" readonly="true" flex="1" xbl:inherits="disabled" />
+ <xul:button anonid="css-bg-editor-image-browse" label="&status4evar.option.browse;" oncommand="this._editor._imageBrowse();" xbl:inherits="disabled" />
+ </xul:hbox>
+ <xul:hbox align="center" pack="end">
+ <xul:button anonid="css-bg-editor-image-clear" label="&status4evar.option.clear;" oncommand="this._editor._imageClear();" xbl:inherits="disabled=no-image" />
+ </xul:hbox>
+
+ <xul:hbox>
+ <xul:groupbox pack="center">
+ <xul:caption label="" />
+ <xul:hbox flex="1" align="center">
+ <xul:label>X</xul:label>
+ </xul:hbox>
+ <xul:separator class="groove" orient="horizontal" />
+ <xul:hbox flex="1" align="center">
+ <xul:label>Y</xul:label>
+ </xul:hbox>
+ </xul:groupbox>
+
+ <xul:groupbox>
+ <xul:caption label="&status4evar.editor.css.image.repeat;" xbl:inherits="disabled=no-image" />
+ <xul:menulist anonid="css-bg-editor-image-repeat-x" sizetopopup="always" onselect="this._editor._buildCSS();" xbl:inherits="disabled=no-image">
+ <xul:menupopup>
+ <xul:menuitem label="&status4evar.option.no-repeat;" value="no-repeat" />
+ <xul:menuitem label="&status4evar.option.repeat;" value="repeat" />
<!--
- <xul:menuitem label="&status4evar.option.space;" value="space" />
- <xul:menuitem label="&status4evar.option.round;" value="round" />
+ <xul:menuitem label="&status4evar.option.space;" value="space" />
+ <xul:menuitem label="&status4evar.option.round;" value="round" />
-->
- </xul:menupopup>
- </xul:menulist>
- <xul:separator class="groove" orient="horizontal" />
- <xul:menulist anonid="css-bg-editor-image-repeat-y" sizetopopup="always" onselect="this._editor._buildCSS();" xbl:inherits="disabled=no-image">
- <xul:menupopup>
- <xul:menuitem label="&status4evar.option.no-repeat;" value="no-repeat" />
- <xul:menuitem label="&status4evar.option.repeat;" value="repeat" />
+ </xul:menupopup>
+ </xul:menulist>
+ <xul:separator class="groove" orient="horizontal" />
+ <xul:menulist anonid="css-bg-editor-image-repeat-y" sizetopopup="always" onselect="this._editor._buildCSS();" xbl:inherits="disabled=no-image">
+ <xul:menupopup>
+ <xul:menuitem label="&status4evar.option.no-repeat;" value="no-repeat" />
+ <xul:menuitem label="&status4evar.option.repeat;" value="repeat" />
<!--
- <xul:menuitem label="&status4evar.option.space;" value="space" />
- <xul:menuitem label="&status4evar.option.round;" value="round" />
+ <xul:menuitem label="&status4evar.option.space;" value="space" />
+ <xul:menuitem label="&status4evar.option.round;" value="round" />
-->
- </xul:menupopup>
- </xul:menulist>
- </xul:groupbox>
-
- <xul:groupbox>
- <xul:caption label="&status4evar.editor.css.image.position;" xbl:inherits="disabled=no-image" />
- <xul:menulist anonid="css-bg-editor-image-position-x" sizetopopup="always" onselect="this._editor._updatePositionX();" xbl:inherits="disabled=no-image">
- <xul:menupopup>
- <xul:menuitem label="&status4evar.option.left;" value="left" />
- <xul:menuitem label="&status4evar.option.center;" value="center" />
- <xul:menuitem label="&status4evar.option.right;" value="right" />
- <xul:menuitem label="&status4evar.option.offset;" value="offset" />
- </xul:menupopup>
- </xul:menulist>
- <xul:separator class="groove" orient="horizontal" />
- <xul:menulist anonid="css-bg-editor-image-position-y" sizetopopup="always" onselect="this._editor._updatePositionY();" xbl:inherits="disabled=no-image">
- <xul:menupopup>
- <xul:menuitem label="&status4evar.option.top;" value="top" />
- <xul:menuitem label="&status4evar.option.center;" value="center" />
- <xul:menuitem label="&status4evar.option.bottom;" value="bottom" />
- <xul:menuitem label="&status4evar.option.offset;" value="offset" />
- </xul:menupopup>
- </xul:menulist>
- </xul:groupbox>
-
- <xul:groupbox>
- <xul:caption label="&status4evar.editor.css.image.offset;" xbl:inherits="disabled=no-image" />
- <xul:hbox>
- <xul:textbox anonid="css-bg-editor-image-offset-x" type="number" size="4" min="-65535" onchange="this._editor._buildCSS();" />
- <xul:menulist anonid="css-bg-editor-image-offset-unit-x" sizetopopup="always" onselect="this._editor._buildCSS();">
- <xul:menupopup>
- <xul:menuitem label="%" value="%" />
- <xul:menuitem label="px" value="px" />
- <xul:menuitem label="em" value="em" />
- <xul:menuitem label="in" value="in" />
- <xul:menuitem label="cm" value="cm" />
- <xul:menuitem label="mm" value="mm" />
- <xul:menuitem label="pt" value="pt" />
- <xul:menuitem label="pc" value="pc" />
- </xul:menupopup>
- </xul:menulist>
- </xul:hbox>
- <xul:separator class="groove" orient="horizontal" />
- <xul:hbox>
- <xul:textbox anonid="css-bg-editor-image-offset-y" type="number" size="4" min="-65535" onchange="this._editor._buildCSS();" />
- <xul:menulist anonid="css-bg-editor-image-offset-unit-y" sizetopopup="always" onselect="this._editor._buildCSS();">
- <xul:menupopup>
- <xul:menuitem label="%" value="%" />
- <xul:menuitem label="px" value="px" />
- <xul:menuitem label="em" value="em" />
- <xul:menuitem label="in" value="in" />
- <xul:menuitem label="cm" value="cm" />
- <xul:menuitem label="mm" value="mm" />
- <xul:menuitem label="pt" value="pt" />
- <xul:menuitem label="pc" value="pc" />
- </xul:menupopup>
- </xul:menulist>
- </xul:hbox>
- </xul:groupbox>
- </xul:hbox>
- </xul:vbox>
-
- <xul:textbox anonid="css-bg-editor-css-text" multiline="true" rows="6" xbl:inherits="disabled" />
- </xul:deck>
- </xul:vbox>
-
- <xul:hbox align="center" pack="end">
- <children includes="progressmeter|toolbox" />
- <xul:label xbl:inherits="disabled">&status4evar.editor.label;</xul:label>
- <xul:menulist anonid="css-bg-editor-mode-menu" sizetopopup="always" onselect="this._editor._updateMode();" xbl:inherits="disabled">
- <xul:menupopup>
- <xul:menuitem label="&status4evar.option.simple;" />
- <xul:menuitem label="&status4evar.option.advanced;" />
- </xul:menupopup>
- </xul:menulist>
- </xul:hbox>
- </content>
-
- <implementation>
- <constructor><![CDATA[
- [
- "_editorColor",
- "_editorImageBrowse",
- "_editorImageClear",
- "_editorImageRepeatX",
- "_editorImageRepeatY",
- "_editorImagePositionX",
- "_editorImagePositionY",
- "_editorImageOffsetX",
- "_editorImageOffsetY",
- "_editorImageOffsetUnitX",
- "_editorImageOffsetUnitY",
- "_editorMode"
- ].forEach(function(prop)
- {
- this[prop]._editor = this;
- }, this);
-
- this.setAdvanced(true, false);
- ]]></constructor>
-
- <destructor><![CDATA[
- ]]></destructor>
-
- <field name="_disableBuildCSS"><![CDATA[
- true
- ]]></field>
-
- <field name="_editorColor" readonly="true"><![CDATA[
- document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-color");
- ]]></field>
-
- <field name="_editorCSS" readonly="true"><![CDATA[
- document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-css-text");
- ]]></field>
-
- <field name="_editorDeck" readonly="true"><![CDATA[
- document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-deck");
- ]]></field>
-
- <field name="_editorImage" readonly="true"><![CDATA[
- document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image");
- ]]></field>
-
- <field name="_editorImageBrowse" readonly="true"><![CDATA[
- document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-browse");
- ]]></field>
-
- <field name="_editorImageClear" readonly="true"><![CDATA[
- document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-clear");
- ]]></field>
-
- <field name="_editorImageRepeatX" readonly="true"><![CDATA[
- document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-repeat-x");
- ]]></field>
-
- <field name="_editorImageRepeatY" readonly="true"><![CDATA[
- document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-repeat-y");
- ]]></field>
-
- <field name="_editorImagePositionX" readonly="true"><![CDATA[
- document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-position-x");
- ]]></field>
-
- <field name="_editorImagePositionY" readonly="true"><![CDATA[
- document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-position-y");
- ]]></field>
-
- <field name="_editorImageOffsetX" readonly="true"><![CDATA[
- document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-offset-x");
- ]]></field>
-
- <field name="_editorImageOffsetY" readonly="true"><![CDATA[
- document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-offset-y");
- ]]></field>
-
- <field name="_editorImageOffsetUnitX" readonly="true"><![CDATA[
- document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-offset-unit-x");
- ]]></field>
-
- <field name="_editorImageOffsetUnitY" readonly="true"><![CDATA[
- document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-offset-unit-y");
- ]]></field>
-
- <field name="_editorMode" readonly="true"><![CDATA[
- document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-mode-menu");
- ]]></field>
-
- <field name="_initialized"><![CDATA[
- false
- ]]></field>
-
- <field name="_reRGB" readonly="true"><![CDATA[
- /^rgb\((\d+), (\d+), (\d+)\)$/
- ]]></field>
-
- <field name="_reURL" readonly="true"><![CDATA[
- /^url\(\s*['"]?(.+?)['"]?\s*\)$/
- ]]></field>
-
- <field name="_reBgPosition" readonly="true"><![CDATA[
- /^(left|center|right)? ?(-?\d+[^\s\d]+)? ?(top|center|bottom)? ?(-?\d+[^\s\d]+)?$/
- ]]></field>
-
- <field name="_reCSSUnit" readonly="true"><![CDATA[
- /^(-?\d+)([^\s\d]+)$/
- ]]></field>
-
- <field name="_strings" readonly="true"><![CDATA[
- document.getElementById("bundle_status4evar");
- ]]></field>
-
- <property name="value">
- <getter><![CDATA[
- return this._editorCSS.value;
- ]]></getter>
- <setter><![CDATA[
- this._editorCSS.value = val;
-
- if(!this._initialized)
- {
- this.setAdvanced(false, false);
- this._initialized = true;
- }
-
- return val;
- ]]></setter>
- </property>
-
- <property name="disabled">
- <getter><![CDATA[
- return this.getAttribute("disabled") == "true";
- ]]></getter>
- <setter><![CDATA[
- if(val)
- {
- this.setAttribute("disabled", "true");
- }
- else
- {
- this.removeAttribute("disabled");
- }
-
- this._updateImageControllDisable();
-
- return val;
- ]]></setter>
- </property>
-
- <method name="setAdvanced">
- <parameter name="aVal"/>
- <parameter name="aPrompt"/>
- <body><![CDATA[
- if(!aVal)
- {
- let success = this._parseCSS();
- if(!success)
- {
- let result = aPrompt && Services.prompt.confirm(window,
- this._strings.getString("simpleEditorTitle"),
- this._strings.getString("simpleEditorMessage"));
- if(result)
- { // Continue to simple mode
- this._buildCSS();
- }
- else
- { // Stay on advanced mode
- aVal = true;
- }
- }
- }
-
- this._disableBuildCSS = aVal;
- this._editorDeck.selectedIndex = ((aVal) ? 1 : 0);
- this._editorMode.selectedIndex = ((aVal) ? 1 : 0);
- ]]></body>
- </method>
-
- <method name="_buildCSS">
- <body><![CDATA[
- if(this._disableBuildCSS)
- {
- return;
- }
-
- let cssVal = this._editorColor.color;
- let imgVal = this._editorImage.value;
- if(imgVal)
- {
- cssVal += " url(\"" + imgVal + "\")";
-
- //
- // Print the background repeat
- //
- let bgRX = this._editorImageRepeatX.value;
- let bgRY = this._editorImageRepeatY.value;
- if(bgRX == "repeat" && bgRY == "no-repeat")
- {
- cssVal += " repeat-x";
- }
- else if(bgRX == "no-repeat" && bgRY == "repeat")
- {
- cssVal += " repeat-y";
- }
- else
- {
- cssVal += " " + bgRX;
- if(bgRX != bgRY)
- {
- cssVal += " " + bgRY;
- }
- }
-
- //
- // Print the background position
- //
- let bgPX = this._editorImagePositionX.value;
- let bgPOX = this._editorImageOffsetX.value;
- if(bgPX != "offset")
- {
- cssVal += " " + bgPX;
- }
- else
- {
- cssVal += " " + bgPOX + this._editorImageOffsetUnitX.value;
- }
-
- let bgPY = this._editorImagePositionY.value;
- let bgPOY = this._editorImageOffsetY.value;
- if(bgPY != "offset")
- {
- cssVal += " " + bgPY;
- }
- else
- {
- cssVal += " " + bgPOY + this._editorImageOffsetUnitY.value;
- }
- }
-
- this._editorCSS.value = cssVal;
-
- let event = document.createEvent("Event");
- event.initEvent("change", true, true);
- this._editorCSS.dispatchEvent(event);
- ]]></body>
- </method>
-
- <method name="_parseCSS">
- <body><![CDATA[
- let retVal = true;
-
- let cssParser = document.createElement("div");
- cssParser.style.background = this._editorCSS.value;
- if(!cssParser.style.background)
- {
- Components.utils.reportError("Error parsing background CSS rule: " + this._editorCSS.value);
- cssParser.style.background = "#33FF33";
- retVal = false;
- }
-
- //
- // Parse the background color
- //
- let bgC = cssParser.style.backgroundColor;
- if(this._reRGB.test(bgC))
- {
- let digits = this._reRGB.exec(bgC);
-
- let red = parseInt(digits[1]);
- let green = parseInt(digits[2]);
- let blue = parseInt(digits[3]);
-
- let rgb = blue | (green << 8) | (red << 16);
- bgC = "#" + rgb.toString(16);
- }
- else
- {
- Components.utils.reportError("Error parsing background-color value: " + bgC);
- bgC = "#33FF33";
- retVal = false;
- }
-
- //
- // Parse the background image
- //
- let bgI = cssParser.style.backgroundImage;
- if(bgI != "none" && !this._reURL.test(bgI))
- {
- Components.utils.reportError("Error parsing background-image value: " + bgI);
- bgI = "none";
- retVal = false;
- }
- bgI = ((bgI != "none") ? this._reURL.exec(bgI)[1].trim() : "");
-
- //
- // Parse the background repeat
- //
- let bgR = cssParser.style.backgroundRepeat.split(" ");
- let bgRX = bgR[0];
- if(bgRX == "repeat-x")
- {
- bgRX = "repeat";
- }
- else if(bgRX == "repeat-y")
- {
- bgRX = "no-repeat";
- }
-
- let bgRY = bgR[bgR.length - 1];
- if(bgRY == "repeat-x")
- {
- bgRY = "no-repeat";
- }
- else if(bgRY == "repeat-y")
- {
- bgRY = "repeat";
- }
-
- //
- // Parse the background position
- //
- let bgP = cssParser.style.backgroundPosition;
- let bgPParts = this._reBgPosition.exec(bgP);
- let bgPValues = new Array();
- for(let i = 1; i <= 4; i++)
- {
- if(bgPParts[i])
- {
- bgPValues.push({
- "value": bgPParts[i],
- "group": i
- });
- }
- }
-
- if(bgPValues.length == 1)
- {
- bgPValues.splice(((bgPValues[0].group == 2) ? 0 : 1), 0, {
- "value": "center",
- "group": ((bgPValues[0].group == 2) ? 0 : 2)
- });
- }
-
- if(bgPValues.length == 2 && bgPValues[1].group == 2)
- {
- bgPValues[1].group = 4;
- }
-
- for(let i = 0; i < 4; i++)
- {
- let group = (i + 1);
- if(bgPValues[i] != undefined && bgPValues[i].group == group)
- {
- continue;
- }
-
- let tmp = "0px";
- switch(i)
- {
- case 0:
- tmp = "offset";
- break;
- case 2:
- tmp = "offset";
- break;
- }
-
- bgPValues.splice(i, 0, {
- "value": tmp,
- "group": group
- });
- }
-
- let bgPOXParts = this._reCSSUnit.exec(bgPValues[1].value);
- let bgPOYParts = this._reCSSUnit.exec(bgPValues[3].value);
-
- //
- // Parse the background size
- //
-
- //
- // Initialize the UI
- //
- let disableBuildCSS = this._disableBuildCSS;
- this._disableBuildCSS = true;
-
- this._editorColor.color = bgC;
- this._editorImage.value = bgI;
- this._editorImageOffsetX.value = bgPOXParts[1];
- this._editorImageOffsetY.value = bgPOYParts[1];
-
- [
- [this._editorImageRepeatX, bgRX, "repeat", "repeat X"],
- [this._editorImageRepeatY, bgRY, "repeat", "repeat Y"],
- [this._editorImagePositionX, bgPValues[0].value, "left", "position X"],
- [this._editorImagePositionY, bgPValues[2].value, "top", "position Y"],
- [this._editorImageOffsetUnitX, bgPOXParts[2], "px", "offset X unit"],
- [this._editorImageOffsetUnitY, bgPOYParts[2], "px", "offset Y unit"]
- ].forEach(function(info)
- {
- if(!this._setSelectedItemSafe(info[0], info[1], info[2]))
- {
- Components.utils.reportError("Error setting " + info[3] + " to " + info[1]);
- retVal = false;
- }
- }, this);
-
- this._updateImageControllDisable();
-
- this._disableBuildCSS = disableBuildCSS;
-
- return retVal;
- ]]></body>
- </method>
-
- <method name="_imageBrowse">
- <body><![CDATA[
- let nsIFilePicker = Components.interfaces.nsIFilePicker;
- let filePicker = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
- filePicker.init(window, this._strings.getString("imageSelectTitle"), nsIFilePicker.modeOpen);
- filePicker.appendFilters(nsIFilePicker.filterImages);
-
- let res = filePicker.show();
- if(res == nsIFilePicker.returnOK)
- {
- this._editorImage.value = Services.io.newFileURI(filePicker.file).spec;
- this._updateImageControllDisable();
- this._buildCSS();
- }
- ]]></body>
- </method>
-
- <method name="_imageClear">
- <body><![CDATA[
- this._editorImage.value = "";
- this._editorImageRepeatX.value = "repeat";
- this._editorImageRepeatY.value = "repeat";
- this._editorImagePositionX.value = "left";
- this._editorImagePositionY.value = "top";
- this._editorImageOffsetX.value = 0;
- this._editorImageOffsetY.value = 0;
- this._editorImageOffsetUnitX.value = "px";
- this._editorImageOffsetUnitY.value = "px";
- this._updateImageControllDisable();
- this._buildCSS();
- ]]></body>
- </method>
-
- <method name="_processEvent">
- <parameter name="event"/>
- <body><![CDATA[
- if(!("css-bg-editor-css-text" == event.originalTarget.getAttribute("anonid")
- || "css-bg-editor-css-text" == document.getBindingParent(event.originalTarget).getAttribute("anonid")))
- {
- event.stopPropagation();
- }
-
- //Components.utils.reportError("Editor event " + event.type + " on " + event.originalTarget.tagName + "::" + event.originalTarget.getAttribute("anonid"));
- ]]></body>
- </method>
-
- <method name="_setSelectedItemSafe">
- <parameter name="aElement"/>
- <parameter name="aValue"/>
- <parameter name="aDefault"/>
- <body><![CDATA[
- aElement.value = aValue;
- if(!aElement.selectedItem || aElement.selectedItem.value != aValue)
- {
- aElement.value = aDefault;
- return false;
- }
- return true;
- ]]></body>
- </method>
-
- <method name="_updateImageControllDisable">
- <body><![CDATA[
- if(this.disabled || !this._editorImage.value)
- {
- this.setAttribute("no-image", "true");
- this._updatePositionOffsetXDisabled(true);
- this._updatePositionOffsetYDisabled(true);
- }
- else
- {
- this.removeAttribute("no-image");
- this._updatePositionOffsetXDisabled(false);
- this._updatePositionOffsetYDisabled(false);
- }
- ]]></body>
- </method>
-
- <method name="_updateMode">
- <body><![CDATA[
- if(this._editorMode.selectedIndex == this._editorDeck.selectedIndex)
- {
- return;
- }
-
- this.setAdvanced(((this._editorMode.selectedIndex == 1) ? true : false), true);
- ]]></body>
- </method>
-
- <method name="_updatePositionOffsetXDisabled">
- <parameter name="aVal"/>
- <body><![CDATA[
- let bgPX = this._editorImagePositionX.value;
- let disableOffsetX = aVal || (bgPX != "offset");// || bgPX == "center");
- this._editorImageOffsetX.disabled = disableOffsetX;
- this._editorImageOffsetUnitX.disabled = disableOffsetX;
- ]]></body>
- </method>
-
- <method name="_updatePositionOffsetYDisabled">
- <parameter name="aVal"/>
- <body><![CDATA[
- let bgPY = this._editorImagePositionY.value;
- var disableOffsetY = aVal || (bgPY != "offset");// || bgPY == "center");
- this._editorImageOffsetY.disabled = disableOffsetY;
- this._editorImageOffsetUnitY.disabled = disableOffsetY;
- ]]></body>
- </method>
-
- <method name="_updatePositionX">
- <body><![CDATA[
- this._updatePositionOffsetXDisabled(false);
- this._buildCSS();
- ]]></body>
- </method>
-
- <method name="_updatePositionY">
- <body><![CDATA[
- this._updatePositionOffsetYDisabled(false);
- this._buildCSS();
- ]]></body>
- </method>
- </implementation>
-
- <handlers>
- <handler event="command"><![CDATA[
- this._processEvent(event);
- ]]></handler>
-
- <handler event="change"><![CDATA[
- this._processEvent(event);
- ]]></handler>
-
- <handler event="input"><![CDATA[
- this._processEvent(event);
- ]]></handler>
-
- <handler event="select"><![CDATA[
- this._processEvent(event);
- ]]></handler>
- </handlers>
- </binding>
+ </xul:menupopup>
+ </xul:menulist>
+ </xul:groupbox>
+
+ <xul:groupbox>
+ <xul:caption label="&status4evar.editor.css.image.position;" xbl:inherits="disabled=no-image" />
+ <xul:menulist anonid="css-bg-editor-image-position-x" sizetopopup="always" onselect="this._editor._updatePositionX();" xbl:inherits="disabled=no-image">
+ <xul:menupopup>
+ <xul:menuitem label="&status4evar.option.left;" value="left" />
+ <xul:menuitem label="&status4evar.option.center;" value="center" />
+ <xul:menuitem label="&status4evar.option.right;" value="right" />
+ <xul:menuitem label="&status4evar.option.offset;" value="offset" />
+ </xul:menupopup>
+ </xul:menulist>
+ <xul:separator class="groove" orient="horizontal" />
+ <xul:menulist anonid="css-bg-editor-image-position-y" sizetopopup="always" onselect="this._editor._updatePositionY();" xbl:inherits="disabled=no-image">
+ <xul:menupopup>
+ <xul:menuitem label="&status4evar.option.top;" value="top" />
+ <xul:menuitem label="&status4evar.option.center;" value="center" />
+ <xul:menuitem label="&status4evar.option.bottom;" value="bottom" />
+ <xul:menuitem label="&status4evar.option.offset;" value="offset" />
+ </xul:menupopup>
+ </xul:menulist>
+ </xul:groupbox>
+
+ <xul:groupbox>
+ <xul:caption label="&status4evar.editor.css.image.offset;" xbl:inherits="disabled=no-image" />
+ <xul:hbox>
+ <xul:textbox anonid="css-bg-editor-image-offset-x" type="number" size="4" min="-65535" onchange="this._editor._buildCSS();" />
+ <xul:menulist anonid="css-bg-editor-image-offset-unit-x" sizetopopup="always" onselect="this._editor._buildCSS();">
+ <xul:menupopup>
+ <xul:menuitem label="%" value="%" />
+ <xul:menuitem label="px" value="px" />
+ <xul:menuitem label="em" value="em" />
+ <xul:menuitem label="in" value="in" />
+ <xul:menuitem label="cm" value="cm" />
+ <xul:menuitem label="mm" value="mm" />
+ <xul:menuitem label="pt" value="pt" />
+ <xul:menuitem label="pc" value="pc" />
+ </xul:menupopup>
+ </xul:menulist>
+ </xul:hbox>
+ <xul:separator class="groove" orient="horizontal" />
+ <xul:hbox>
+ <xul:textbox anonid="css-bg-editor-image-offset-y" type="number" size="4" min="-65535" onchange="this._editor._buildCSS();" />
+ <xul:menulist anonid="css-bg-editor-image-offset-unit-y" sizetopopup="always" onselect="this._editor._buildCSS();">
+ <xul:menupopup>
+ <xul:menuitem label="%" value="%" />
+ <xul:menuitem label="px" value="px" />
+ <xul:menuitem label="em" value="em" />
+ <xul:menuitem label="in" value="in" />
+ <xul:menuitem label="cm" value="cm" />
+ <xul:menuitem label="mm" value="mm" />
+ <xul:menuitem label="pt" value="pt" />
+ <xul:menuitem label="pc" value="pc" />
+ </xul:menupopup>
+ </xul:menulist>
+ </xul:hbox>
+ </xul:groupbox>
+ </xul:hbox>
+ </xul:vbox>
+
+ <xul:textbox anonid="css-bg-editor-css-text" multiline="true" rows="6" xbl:inherits="disabled" />
+ </xul:deck>
+ </xul:vbox>
+
+ <xul:hbox align="center" pack="end">
+ <children includes="progressmeter|toolbox" />
+ <xul:label xbl:inherits="disabled">&status4evar.editor.label;</xul:label>
+ <xul:menulist anonid="css-bg-editor-mode-menu" sizetopopup="always" onselect="this._editor._updateMode();" xbl:inherits="disabled">
+ <xul:menupopup>
+ <xul:menuitem label="&status4evar.option.simple;" />
+ <xul:menuitem label="&status4evar.option.advanced;" />
+ </xul:menupopup>
+ </xul:menulist>
+ </xul:hbox>
+ </content>
+
+ <implementation>
+ <constructor><![CDATA[
+ [
+ "_editorColor",
+ "_editorImageBrowse",
+ "_editorImageClear",
+ "_editorImageRepeatX",
+ "_editorImageRepeatY",
+ "_editorImagePositionX",
+ "_editorImagePositionY",
+ "_editorImageOffsetX",
+ "_editorImageOffsetY",
+ "_editorImageOffsetUnitX",
+ "_editorImageOffsetUnitY",
+ "_editorMode"
+ ].forEach(function(prop)
+ {
+ this[prop]._editor = this;
+ }, this);
+
+ this.setAdvanced(true, false);
+ ]]></constructor>
+
+ <destructor><![CDATA[
+ ]]></destructor>
+
+ <field name="_disableBuildCSS"><![CDATA[
+ true
+ ]]></field>
+
+ <field name="_editorColor" readonly="true"><![CDATA[
+ document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-color");
+ ]]></field>
+
+ <field name="_editorCSS" readonly="true"><![CDATA[
+ document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-css-text");
+ ]]></field>
+
+ <field name="_editorDeck" readonly="true"><![CDATA[
+ document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-deck");
+ ]]></field>
+
+ <field name="_editorImage" readonly="true"><![CDATA[
+ document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image");
+ ]]></field>
+
+ <field name="_editorImageBrowse" readonly="true"><![CDATA[
+ document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-browse");
+ ]]></field>
+
+ <field name="_editorImageClear" readonly="true"><![CDATA[
+ document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-clear");
+ ]]></field>
+
+ <field name="_editorImageRepeatX" readonly="true"><![CDATA[
+ document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-repeat-x");
+ ]]></field>
+
+ <field name="_editorImageRepeatY" readonly="true"><![CDATA[
+ document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-repeat-y");
+ ]]></field>
+
+ <field name="_editorImagePositionX" readonly="true"><![CDATA[
+ document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-position-x");
+ ]]></field>
+
+ <field name="_editorImagePositionY" readonly="true"><![CDATA[
+ document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-position-y");
+ ]]></field>
+
+ <field name="_editorImageOffsetX" readonly="true"><![CDATA[
+ document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-offset-x");
+ ]]></field>
+
+ <field name="_editorImageOffsetY" readonly="true"><![CDATA[
+ document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-offset-y");
+ ]]></field>
+
+ <field name="_editorImageOffsetUnitX" readonly="true"><![CDATA[
+ document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-offset-unit-x");
+ ]]></field>
+
+ <field name="_editorImageOffsetUnitY" readonly="true"><![CDATA[
+ document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-image-offset-unit-y");
+ ]]></field>
+
+ <field name="_editorMode" readonly="true"><![CDATA[
+ document.getAnonymousElementByAttribute(this, "anonid", "css-bg-editor-mode-menu");
+ ]]></field>
+
+ <field name="_initialized"><![CDATA[
+ false
+ ]]></field>
+
+ <field name="_reRGB" readonly="true"><![CDATA[
+ /^rgb\((\d+), (\d+), (\d+)\)$/
+ ]]></field>
+
+ <field name="_reURL" readonly="true"><![CDATA[
+ /^url\(\s*['"]?(.+?)['"]?\s*\)$/
+ ]]></field>
+
+ <field name="_reBgPosition" readonly="true"><![CDATA[
+ /^(left|center|right)? ?(-?\d+[^\s\d]+)? ?(top|center|bottom)? ?(-?\d+[^\s\d]+)?$/
+ ]]></field>
+
+ <field name="_reCSSUnit" readonly="true"><![CDATA[
+ /^(-?\d+)([^\s\d]+)$/
+ ]]></field>
+
+ <field name="_strings" readonly="true"><![CDATA[
+ document.getElementById("bundle_status4evar");
+ ]]></field>
+
+ <property name="value">
+ <getter><![CDATA[
+ return this._editorCSS.value;
+ ]]></getter>
+ <setter><![CDATA[
+ this._editorCSS.value = val;
+
+ if(!this._initialized)
+ {
+ this.setAdvanced(false, false);
+ this._initialized = true;
+ }
+
+ return val;
+ ]]></setter>
+ </property>
+
+ <property name="disabled">
+ <getter><![CDATA[
+ return this.getAttribute("disabled") == "true";
+ ]]></getter>
+ <setter><![CDATA[
+ if(val)
+ {
+ this.setAttribute("disabled", "true");
+ }
+ else
+ {
+ this.removeAttribute("disabled");
+ }
+
+ this._updateImageControllDisable();
+
+ return val;
+ ]]></setter>
+ </property>
+
+ <method name="setAdvanced">
+ <parameter name="aVal"/>
+ <parameter name="aPrompt"/>
+ <body><![CDATA[
+ if(!aVal)
+ {
+ let success = this._parseCSS();
+ if(!success)
+ {
+ let result = aPrompt && Services.prompt.confirm(window,
+ this._strings.getString("simpleEditorTitle"),
+ this._strings.getString("simpleEditorMessage"));
+ if(result)
+ { // Continue to simple mode
+ this._buildCSS();
+ }
+ else
+ { // Stay on advanced mode
+ aVal = true;
+ }
+ }
+ }
+
+ this._disableBuildCSS = aVal;
+ this._editorDeck.selectedIndex = ((aVal) ? 1 : 0);
+ this._editorMode.selectedIndex = ((aVal) ? 1 : 0);
+ ]]></body>
+ </method>
+
+ <method name="_buildCSS">
+ <body><![CDATA[
+ if(this._disableBuildCSS)
+ {
+ return;
+ }
+
+ let cssVal = this._editorColor.color;
+ let imgVal = this._editorImage.value;
+ if(imgVal)
+ {
+ cssVal += " url(\"" + imgVal + "\")";
+
+ //
+ // Print the background repeat
+ //
+ let bgRX = this._editorImageRepeatX.value;
+ let bgRY = this._editorImageRepeatY.value;
+ if(bgRX == "repeat" && bgRY == "no-repeat")
+ {
+ cssVal += " repeat-x";
+ }
+ else if(bgRX == "no-repeat" && bgRY == "repeat")
+ {
+ cssVal += " repeat-y";
+ }
+ else
+ {
+ cssVal += " " + bgRX;
+ if(bgRX != bgRY)
+ {
+ cssVal += " " + bgRY;
+ }
+ }
+
+ //
+ // Print the background position
+ //
+ let bgPX = this._editorImagePositionX.value;
+ let bgPOX = this._editorImageOffsetX.value;
+ if(bgPX != "offset")
+ {
+ cssVal += " " + bgPX;
+ }
+ else
+ {
+ cssVal += " " + bgPOX + this._editorImageOffsetUnitX.value;
+ }
+
+ let bgPY = this._editorImagePositionY.value;
+ let bgPOY = this._editorImageOffsetY.value;
+ if(bgPY != "offset")
+ {
+ cssVal += " " + bgPY;
+ }
+ else
+ {
+ cssVal += " " + bgPOY + this._editorImageOffsetUnitY.value;
+ }
+ }
+
+ this._editorCSS.value = cssVal;
+
+ let event = document.createEvent("Event");
+ event.initEvent("change", true, true);
+ this._editorCSS.dispatchEvent(event);
+ ]]></body>
+ </method>
+
+ <method name="_parseCSS">
+ <body><![CDATA[
+ let retVal = true;
+
+ let cssParser = document.createElement("div");
+ cssParser.style.background = this._editorCSS.value;
+ if(!cssParser.style.background)
+ {
+ Components.utils.reportError("Error parsing background CSS rule: " + this._editorCSS.value);
+ cssParser.style.background = "#33FF33";
+ retVal = false;
+ }
+
+ //
+ // Parse the background color
+ //
+ let bgC = cssParser.style.backgroundColor;
+ if(this._reRGB.test(bgC))
+ {
+ let digits = this._reRGB.exec(bgC);
+
+ let red = parseInt(digits[1]);
+ let green = parseInt(digits[2]);
+ let blue = parseInt(digits[3]);
+
+ let rgb = blue | (green << 8) | (red << 16);
+ bgC = "#" + rgb.toString(16);
+ }
+ else
+ {
+ Components.utils.reportError("Error parsing background-color value: " + bgC);
+ bgC = "#33FF33";
+ retVal = false;
+ }
+
+ //
+ // Parse the background image
+ //
+ let bgI = cssParser.style.backgroundImage;
+ if(bgI != "none" && !this._reURL.test(bgI))
+ {
+ Components.utils.reportError("Error parsing background-image value: " + bgI);
+ bgI = "none";
+ retVal = false;
+ }
+ bgI = ((bgI != "none") ? this._reURL.exec(bgI)[1].trim() : "");
+
+ //
+ // Parse the background repeat
+ //
+ let bgR = cssParser.style.backgroundRepeat.split(" ");
+ let bgRX = bgR[0];
+ if(bgRX == "repeat-x")
+ {
+ bgRX = "repeat";
+ }
+ else if(bgRX == "repeat-y")
+ {
+ bgRX = "no-repeat";
+ }
+
+ let bgRY = bgR[bgR.length - 1];
+ if(bgRY == "repeat-x")
+ {
+ bgRY = "no-repeat";
+ }
+ else if(bgRY == "repeat-y")
+ {
+ bgRY = "repeat";
+ }
+
+ //
+ // Parse the background position
+ //
+ let bgP = cssParser.style.backgroundPosition;
+ let bgPParts = this._reBgPosition.exec(bgP);
+ let bgPValues = new Array();
+ for(let i = 1; i <= 4; i++)
+ {
+ if(bgPParts[i])
+ {
+ bgPValues.push({
+ "value": bgPParts[i],
+ "group": i
+ });
+ }
+ }
+
+ if(bgPValues.length == 1)
+ {
+ bgPValues.splice(((bgPValues[0].group == 2) ? 0 : 1), 0, {
+ "value": "center",
+ "group": ((bgPValues[0].group == 2) ? 0 : 2)
+ });
+ }
+
+ if(bgPValues.length == 2 && bgPValues[1].group == 2)
+ {
+ bgPValues[1].group = 4;
+ }
+
+ for(let i = 0; i < 4; i++)
+ {
+ let group = (i + 1);
+ if(bgPValues[i] != undefined && bgPValues[i].group == group)
+ {
+ continue;
+ }
+
+ let tmp = "0px";
+ switch(i)
+ {
+ case 0:
+ tmp = "offset";
+ break;
+ case 2:
+ tmp = "offset";
+ break;
+ }
+
+ bgPValues.splice(i, 0, {
+ "value": tmp,
+ "group": group
+ });
+ }
+
+ let bgPOXParts = this._reCSSUnit.exec(bgPValues[1].value);
+ let bgPOYParts = this._reCSSUnit.exec(bgPValues[3].value);
+
+ //
+ // Parse the background size
+ //
+
+ //
+ // Initialize the UI
+ //
+ let disableBuildCSS = this._disableBuildCSS;
+ this._disableBuildCSS = true;
+
+ this._editorColor.color = bgC;
+ this._editorImage.value = bgI;
+ this._editorImageOffsetX.value = bgPOXParts[1];
+ this._editorImageOffsetY.value = bgPOYParts[1];
+
+ [
+ [this._editorImageRepeatX, bgRX, "repeat", "repeat X"],
+ [this._editorImageRepeatY, bgRY, "repeat", "repeat Y"],
+ [this._editorImagePositionX, bgPValues[0].value, "left", "position X"],
+ [this._editorImagePositionY, bgPValues[2].value, "top", "position Y"],
+ [this._editorImageOffsetUnitX, bgPOXParts[2], "px", "offset X unit"],
+ [this._editorImageOffsetUnitY, bgPOYParts[2], "px", "offset Y unit"]
+ ].forEach(function(info)
+ {
+ if(!this._setSelectedItemSafe(info[0], info[1], info[2]))
+ {
+ Components.utils.reportError("Error setting " + info[3] + " to " + info[1]);
+ retVal = false;
+ }
+ }, this);
+
+ this._updateImageControllDisable();
+
+ this._disableBuildCSS = disableBuildCSS;
+
+ return retVal;
+ ]]></body>
+ </method>
+
+ <method name="_imageBrowse">
+ <body><![CDATA[
+ let nsIFilePicker = Components.interfaces.nsIFilePicker;
+ let filePicker = Components.classes["@mozilla.org/filepicker;1"].createInstance(nsIFilePicker);
+ filePicker.init(window, this._strings.getString("imageSelectTitle"), nsIFilePicker.modeOpen);
+ filePicker.appendFilters(nsIFilePicker.filterImages);
+
+ let res = filePicker.show();
+ if(res == nsIFilePicker.returnOK)
+ {
+ this._editorImage.value = Services.io.newFileURI(filePicker.file).spec;
+ this._updateImageControllDisable();
+ this._buildCSS();
+ }
+ ]]></body>
+ </method>
+
+ <method name="_imageClear">
+ <body><![CDATA[
+ this._editorImage.value = "";
+ this._editorImageRepeatX.value = "repeat";
+ this._editorImageRepeatY.value = "repeat";
+ this._editorImagePositionX.value = "left";
+ this._editorImagePositionY.value = "top";
+ this._editorImageOffsetX.value = 0;
+ this._editorImageOffsetY.value = 0;
+ this._editorImageOffsetUnitX.value = "px";
+ this._editorImageOffsetUnitY.value = "px";
+ this._updateImageControllDisable();
+ this._buildCSS();
+ ]]></body>
+ </method>
+
+ <method name="_processEvent">
+ <parameter name="event"/>
+ <body><![CDATA[
+ if(!("css-bg-editor-css-text" == event.originalTarget.getAttribute("anonid")
+ || "css-bg-editor-css-text" == document.getBindingParent(event.originalTarget).getAttribute("anonid")))
+ {
+ event.stopPropagation();
+ }
+
+ //Components.utils.reportError("Editor event " + event.type + " on " + event.originalTarget.tagName + "::" + event.originalTarget.getAttribute("anonid"));
+ ]]></body>
+ </method>
+
+ <method name="_setSelectedItemSafe">
+ <parameter name="aElement"/>
+ <parameter name="aValue"/>
+ <parameter name="aDefault"/>
+ <body><![CDATA[
+ aElement.value = aValue;
+ if(!aElement.selectedItem || aElement.selectedItem.value != aValue)
+ {
+ aElement.value = aDefault;
+ return false;
+ }
+ return true;
+ ]]></body>
+ </method>
+
+ <method name="_updateImageControllDisable">
+ <body><![CDATA[
+ if(this.disabled || !this._editorImage.value)
+ {
+ this.setAttribute("no-image", "true");
+ this._updatePositionOffsetXDisabled(true);
+ this._updatePositionOffsetYDisabled(true);
+ }
+ else
+ {
+ this.removeAttribute("no-image");
+ this._updatePositionOffsetXDisabled(false);
+ this._updatePositionOffsetYDisabled(false);
+ }
+ ]]></body>
+ </method>
+
+ <method name="_updateMode">
+ <body><![CDATA[
+ if(this._editorMode.selectedIndex == this._editorDeck.selectedIndex)
+ {
+ return;
+ }
+
+ this.setAdvanced(((this._editorMode.selectedIndex == 1) ? true : false), true);
+ ]]></body>
+ </method>
+
+ <method name="_updatePositionOffsetXDisabled">
+ <parameter name="aVal"/>
+ <body><![CDATA[
+ let bgPX = this._editorImagePositionX.value;
+ let disableOffsetX = aVal || (bgPX != "offset");// || bgPX == "center");
+ this._editorImageOffsetX.disabled = disableOffsetX;
+ this._editorImageOffsetUnitX.disabled = disableOffsetX;
+ ]]></body>
+ </method>
+
+ <method name="_updatePositionOffsetYDisabled">
+ <parameter name="aVal"/>
+ <body><![CDATA[
+ let bgPY = this._editorImagePositionY.value;
+ var disableOffsetY = aVal || (bgPY != "offset");// || bgPY == "center");
+ this._editorImageOffsetY.disabled = disableOffsetY;
+ this._editorImageOffsetUnitY.disabled = disableOffsetY;
+ ]]></body>
+ </method>
+
+ <method name="_updatePositionX">
+ <body><![CDATA[
+ this._updatePositionOffsetXDisabled(false);
+ this._buildCSS();
+ ]]></body>
+ </method>
+
+ <method name="_updatePositionY">
+ <body><![CDATA[
+ this._updatePositionOffsetYDisabled(false);
+ this._buildCSS();
+ ]]></body>
+ </method>
+ </implementation>
+
+ <handlers>
+ <handler event="command"><![CDATA[
+ this._processEvent(event);
+ ]]></handler>
+
+ <handler event="change"><![CDATA[
+ this._processEvent(event);
+ ]]></handler>
+
+ <handler event="input"><![CDATA[
+ this._processEvent(event);
+ ]]></handler>
+
+ <handler event="select"><![CDATA[
+ this._processEvent(event);
+ ]]></handler>
+ </handlers>
+ </binding>
</bindings>
diff --git a/application/palemoon/components/statusbar/content/prefs.xul b/application/palemoon/components/statusbar/content/prefs.xul
index d10dc006af..dd41582465 100644
--- a/application/palemoon/components/statusbar/content/prefs.xul
+++ b/application/palemoon/components/statusbar/content/prefs.xul
@@ -5,8 +5,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!DOCTYPE prefwindow [
- <!ENTITY % prefsDTD SYSTEM "chrome://browser/locale/statusbar/statusbar-prefs.dtd">
- %prefsDTD;
+ <!ENTITY % prefsDTD SYSTEM "chrome://browser/locale/statusbar/statusbar-prefs.dtd">
+ %prefsDTD;
]>
<?xml-stylesheet href="chrome://global/skin/config.css" type="text/css" ?>
@@ -23,275 +23,275 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="status4evarPrefs.onPrefWindowLoad();" onunload="status4evarPrefs.onPrefWindowUnLoad();">
- <stringbundleset id="stringbundleset">
- <stringbundle id="bundle_status4evar" src="chrome://browser/locale/statusbar/prefs.properties" />
- </stringbundleset>
- <script type="application/javascript" src="chrome://browser/content/statusbar/prefs.js" />
+ <stringbundleset id="stringbundleset">
+ <stringbundle id="bundle_status4evar" src="chrome://browser/locale/statusbar/prefs.properties" />
+ </stringbundleset>
+ <script type="application/javascript" src="chrome://browser/content/statusbar/prefs.js" />
- <prefpane id="status4evar-pane-status" label="&status4evar.pane.status;">
- <preferences>
- <preference id="status4evar-pref-status" name="status4evar.status" type="int" />
- <preference id="status4evar-pref-status-default" name="status4evar.status.default" type="bool" />
- <preference id="status4evar-pref-status-network" name="status4evar.status.network" type="bool"
- onchange="status4evarPrefs.statusNetworkChanged();" />
- <preference id="status4evar-pref-status-network-xhr" name="status4evar.status.network.xhr" type="bool" />
- <preference id="status4evar-pref-status-timeout" name="status4evar.status.timeout" type="int"
- onchange="status4evarPrefs.statusTimeoutChanged();" />
- <preference id="status4evar-pref-status-linkOver" name="status4evar.status.linkOver" type="int" />
- <preference id="status4evar-pref-status-linkOver-delay-show" name="status4evar.status.linkOver.delay.show" type="int" />
- <preference id="status4evar-pref-status-linkOver-delay-hide" name="status4evar.status.linkOver.delay.hide" type="int" />
- <preference id="status4evar-pref-status-toolbar-maxLength" name="status4evar.status.toolbar.maxLength" type="int"
- onchange="status4evarPrefs.textLengthChanged();" />
- <preference id="status4evar-pref-status-popup-invertMirror" name="status4evar.status.popup.invertMirror" type="bool" />
- <preference id="status4evar-pref-status-popup-mouseMirror" name="status4evar.status.popup.mouseMirror" type="bool" />
- <preference id="toolkit-pref-dom-status-change" name="dom.disable_window_status_change" type="bool" inverted="true" />
- </preferences>
-
- <commandset id="status4evar-commandset-status">
- <command id="status4evar-command-status-timeout" oncommand="status4evarPrefs.statusTimeoutToggle();" />
- <command id="status4evar-command-status-toolbar-maxLength" oncommand="status4evarPrefs.textLengthToggle();" />
- </commandset>
-
- <tabbox id="status4evar-tabbox-status" flex="1">
- <tabs id="status4evar-tabs-status">
- <tab id="status4evar-tab-status-general" label="&status4evar.tab.general;" />
- <tab id="status4evar-tab-status-toolbar" label="&status4evar.tab.toolbar;" />
- <tab id="status4evar-tab-status-popup" label="&status4evar.tab.popup;" />
- </tabs>
-
- <tabpanels id="status4evar-tabpanels-status" flex="1">
- <tabpanel id="status4evar-tabpanel-status-general" orient="vertical">
- <groupbox id="status4evar-status-general-status">
- <caption label="&status4evar.status.general.status.caption;" />
-
- <hbox align="center">
- <label id="status4evar-status-label" control="status4evar-status-menu">&status4evar.status.label;</label>
- <menulist id="status4evar-status-menu" preference="status4evar-pref-status" sizetopopup="always">
- <menupopup>
- <menuitem label="&status4evar.option.none;" value="0" />
- <menuitem label="&status4evar.option.toolbar;" value="1" />
- <menuitem label="&status4evar.option.popup;" value="3" />
- </menupopup>
- </menulist>
- </hbox>
-
- <hbox align="center">
- <checkbox id="status4evar-status-timeout-check" label="&status4evar.status.timeout.label;"
- command="status4evar-command-status-timeout" />
- <textbox id="status4evar-status-timeout-value" preference="status4evar-pref-status-timeout" type="number" size="4"
- onsyncfrompreference="return status4evarPrefs.statusTimeoutSync();" />
- <label id="status4evar-status-timeout-unit">&status4evar.unit.seconds;</label>
- </hbox>
-
- <checkbox id="status4evar-status-default-check" preference="status4evar-pref-status-default" label="&status4evar.status.default.label;" />
-
- <checkbox id="status4evar-status-network-check" preference="status4evar-pref-status-network" label="&status4evar.status.network.label;"
- onsyncfrompreference="return status4evarPrefs.statusNetworkSync();" />
-
- <hbox align="center" class="indent">
- <checkbox id="status4evar-status-network-xhr-check" preference="status4evar-pref-status-network-xhr" label="&status4evar.status.network.xhr.label;" />
- </hbox>
-
- <checkbox id="toolkit-dom-status-change-check" preference="toolkit-pref-dom-status-change" label="&toolkit.dom.status.change.label;" />
- </groupbox>
-
- <groupbox id="status4evar-status-general-linkOver">
- <caption label="&status4evar.status.general.linkOver.caption;" />
-
- <hbox align="center">
- <label id="status4evar-status-linkOver-label" control="status4evar-status-linkOver-menu">&status4evar.status.linkOver.label;</label>
- <menulist id="status4evar-status-linkOver-menu" preference="status4evar-pref-status-linkOver" sizetopopup="always">
- <menupopup>
- <menuitem label="&status4evar.option.none;" value="0" />
- <menuitem label="&status4evar.option.toolbar;" value="1" />
- <menuitem label="&status4evar.option.popup;" value="3" />
- </menupopup>
- </menulist>
- </hbox>
-
- <hbox align="center">
- <label id="status4evar-status-linkOver-delay-show-label" control="status4evar-status-linkOver-delay-show-value">&status4evar.status.linkOver.delay.show.label;</label>
- <textbox id="status4evar-status-linkOver-delay-show-value" preference="status4evar-pref-status-linkOver-delay-show" type="number" size="5" />
- <label id="status4evar-status-linkOver-delay-show-unit">&status4evar.unit.milliseconds;</label>
- </hbox>
-
- <hbox align="center">
- <label id="status4evar-status-linkOver-delay-hide-label" control="status4evar-status-linkOver-delay-hide-value">&status4evar.status.linkOver.delay.hide.label;</label>
- <textbox id="status4evar-status-linkOver-delay-hide-value" preference="status4evar-pref-status-linkOver-delay-hide" type="number" size="5" />
- <label id="status4evar-status-linkOver-delay-hide-unit">&status4evar.unit.milliseconds;</label>
- </hbox>
- </groupbox>
-
- </tabpanel>
-
- <tabpanel id="status4evar-tabpanel-status-toolbar" orient="vertical">
- <hbox align="center">
- <checkbox id="status4evar-status-toolbar-maxLength-check" label="&status4evar.status.toolbar.maxLength.label;"
- command="status4evar-command-status-toolbar-maxLength" />
- <textbox id="status4evar-status-toolbar-maxLength-value" preference="status4evar-pref-status-toolbar-maxLength" type="number" size="4"
- onsyncfrompreference="return status4evarPrefs.textLengthSync();" />
- <label id="status4evar-status-toolbar-maxLength-unit">&status4evar.unit.px;</label>
- </hbox>
- </tabpanel>
-
- <tabpanel id="status4evar-tabpanel-status-popup" orient="vertical">
- <checkbox id="status4evar-status-popup-invertMirror-check" preference="status4evar-pref-status-popup-invertMirror" label="&status4evar.status.popup.invertMirror.label;" />
-
- <checkbox id="status4evar-status-popup-mouseMirror-check" preference="status4evar-pref-status-popup-mouseMirror" label="&status4evar.status.popup.mouseMirror.label;" />
- </tabpanel>
-
- </tabpanels>
- </tabbox>
- </prefpane>
-
- <prefpane id="status4evar-pane-progress" label="&status4evar.pane.progress;">
- <preferences>
- <preference id="status4evar-pref-progress-toolbar-force" name="status4evar.progress.toolbar.force" type="bool" />
- <preference id="status4evar-pref-progress-toolbar-style" name="status4evar.progress.toolbar.style" type="bool"
- onchange="status4evarPrefs.progressToolbarStyleChanged();" />
- <preference id="status4evar-pref-progress-toolbar-css" name="status4evar.progress.toolbar.css" type="string"
- onchange="status4evarPrefs.progressToolbarCSSChanged();" />
- </preferences>
-
- <commandset id="status4evar-commandset-status">
- </commandset>
-
- <checkbox id="status4evar-progress-toolbar-force-check" preference="status4evar-pref-progress-toolbar-force" label="&status4evar.progress.toolbar.force.label;" />
-
- <checkbox id="status4evar-progress-toolbar-style-check" preference="status4evar-pref-progress-toolbar-style" label="&status4evar.progress.style.label;"
- onsyncfrompreference="return status4evarPrefs.progressToolbarStyleSync();" />
-
- <vbox class="css-bg-editor" preference="status4evar-pref-progress-toolbar-css" preference-editable="true" flex="1">
- <progressmeter id="status4evar-progress-bar" value="75" flex="1" />
- </vbox>
- </prefpane>
-
- <prefpane id="status4evar-pane-download" label="&status4evar.pane.download;">
- <preferences>
- <preference id="status4evar-pref-download-button-action" name="status4evar.download.button.action" type="int" />
- <preference id="status4evar-pref-download-color-active" name="status4evar.download.color.active" type="string" />
- <preference id="status4evar-pref-download-color-paused" name="status4evar.download.color.paused" type="string" />
- <preference id="status4evar-pref-download-force" name="status4evar.download.force" type="bool" />
- <preference id="status4evar-pref-download-label" name="status4evar.download.label" type="int" />
- <preference id="status4evar-pref-download-label-force" name="status4evar.download.label.force" type="bool" />
- <preference id="status4evar-pref-download-notify-animate" name="status4evar.download.notify.animate" type="bool" />
- <preference id="status4evar-pref-download-notify-timeout" name="status4evar.download.notify.timeout" type="int" />
- <preference id="status4evar-pref-download-progress" name="status4evar.download.progress" type="int" />
- <preference id="status4evar-pref-download-tooltip" name="status4evar.download.tooltip" type="int" />
-
- <preference id="status4evar-pref-download-button-action-command" name="status4evar.download.button.action.command" type="string"/>
- </preferences>
-
- <commandset id="status4evar-commandset-download">
- <command id="status4evar-command-download-progress" oncommand="status4evarPrefs.downloadProgressToggle();" />
- </commandset>
-
- <checkbox id="status4evar-download-force-check" preference="status4evar-pref-download-force" label="&status4evar.download.force.label;" />
-
- <checkbox id="status4evar-download-label-force-check" preference="status4evar-pref-download-label-force" label="&status4evar.download.label.force.label;" />
-
- <hbox align="center">
- <label id="status4evar-download-label-label" control="status4evar-download-label-menu">&status4evar.download.label.label;</label>
- <menulist id="status4evar-download-label-menu" preference="status4evar-pref-download-label" sizetopopup="always">
- <menupopup>
- <menuitem value="0" label="&status4evar.option.dlcount;" />
- <menuitem value="1" label="&status4evar.option.dltime;" />
- <menuitem value="2" label="&status4evar.option.both;" />
- </menupopup>
- </menulist>
- </hbox>
-
- <hbox align="center">
- <label id="status4evar-download-tooltip-label" control="status4evar-download-tooltip-menu">&status4evar.download.tooltip.label;</label>
- <menulist id="status4evar-download-tooltip-menu" preference="status4evar-pref-download-tooltip" sizetopopup="always">
- <menupopup>
- <menuitem value="0" label="&status4evar.option.dlcount;" />
- <menuitem value="1" label="&status4evar.option.dltime;" />
- <menuitem value="2" label="&status4evar.option.both;" />
- </menupopup>
- </menulist>
- </hbox>
-
- <hbox align="center">
- <label id="status4evar-download-button-action-label" control="status4evar-download-button-action-menu">&status4evar.download.button.action.label;</label>
- <menulist id="status4evar-download-button-action-menu" preference="status4evar-pref-download-button-action" sizetopopup="always">
- <menupopup>
- <menuitem value="0" label="&status4evar.option.nothing;" />
- <menuitem value="1" label="&status4evar.option.firefoxdefault;" />
- <menuitem value="2" label="&status4evar.option.download.library;" />
- <menuitem value="3" label="&status4evar.option.download.tab;" />
- <menuitem value="4" label="&status4evar.option.download.thirdparty;" id="status4evar-download-button-action-menu-thirdparty" />
- </menupopup>
- </menulist>
- </hbox>
-
- <hbox align="center">
- <label id="status4evar-download-notify-timeout-label" control="status4evar-download-notify-timeout-value">&status4evar.download.notify.timeout.label;</label>
- <textbox id="status4evar-download-notify-timeout-value" preference="status4evar-pref-download-notify-timeout" type="number" size="3" />
- <label id="status4evar-download-notify-timeout-unit">&status4evar.unit.seconds;</label>
- </hbox>
-
- <checkbox id="status4evar-download-notify-animate-check" preference="status4evar-pref-download-notify-animate" label="&status4evar.download.notify.animate.label;" />
-
- <checkbox id="status4evar-download-progress-check" command="status4evar-command-download-progress" label="&status4evar.download.progress.label;" />
-
- <vbox class="indent">
- <hbox align="center">
- <radiogroup id="status4evar-download-progress-radiogroup" preference="status4evar-pref-download-progress"
- onsyncfrompreference="return status4evarPrefs.downloadProgressSync();">
- <radio value="1" label="&status4evar.download.progress.average.label;" />
- <radio value="2" label="&status4evar.download.progress.max.label;" />
- <radio value="3" label="&status4evar.download.progress.min.label;" />
- </radiogroup>
- </hbox>
-
- <hbox align="center">
- <label id="status4evar-download-color-active-label" control="status4evar-download-color-active-picker">&status4evar.download.color.active.label;</label>
- <colorpicker id="status4evar-download-color-active-picker" preference="status4evar-pref-download-color-active" type="button" />
- </hbox>
-
- <hbox align="center">
- <label id="status4evar-download-color-paused-label" control="status4evar-download-color-paused-picker">&status4evar.download.color.paused.label;</label>
- <colorpicker id="status4evar-download-color-paused-picker" preference="status4evar-pref-download-color-paused" type="button" />
- </hbox>
- </vbox>
- </prefpane>
-
- <prefpane id="status4evar-pane-addonbar" label="&status4evar.pane.statusbar;">
- <preferences>
- <preference id="status4evar-pref-addonbar-borderStyle" name="status4evar.addonbar.borderStyle" type="bool" />
- <preference id="status4evar-pref-addonbar-closeButton" name="status4evar.addonbar.closeButton" type="bool" />
- <preference id="status4evar-pref-addonbar-windowGripper" name="status4evar.addonbar.windowGripper" type="bool" />
- </preferences>
-
- <checkbox id="status4evar-addonbar-borderStyle-check" preference="status4evar-pref-addonbar-borderStyle" label="&status4evar.addonbar.borderStyle;" />
-
- <checkbox id="status4evar-addonbar-closeButton-check" preference="status4evar-pref-addonbar-closeButton" label="&status4evar.addonbar.closeButton;" />
-
- <checkbox id="status4evar-addonbar-windowGripper-check" preference="status4evar-pref-addonbar-windowGripper" label="&status4evar.addonbar.windowGripper;" />
- </prefpane>
-
- <prefpane id="status4evar-pane-advanced" label="&status4evar.pane.advanced;">
- <preferences>
- <preference id="status4evar-pref-advanced-status-detectFullScreen" name="status4evar.advanced.status.detectFullScreen" type="bool" />
- <preference id="status4evar-pref-advanced-status-detectVideo" name="status4evar.advanced.status.detectVideo" type="bool" />
- <preference id="browser-pref-urlbar-trimming-enabled" name="browser.urlbar.trimURLs" type="bool" />
- </preferences>
-
- <vbox flex="1">
- <groupbox id="status4evar-status-urlbar-builtin">
- <caption label="&status4evar.status.urlbar.firefox.builtin.caption;" />
-
- <checkbox id="browser-urlbar-trimming-enabled-ckeck" preference="browser-pref-urlbar-trimming-enabled" label="&browser.urlbar.trimming.enabled.label;" />
- </groupbox>
-
- <groupbox id="status4evar-advanced-status">
- <caption label="&status4evar.pane.status;" />
-
- <checkbox id="status4evar-advanced-status-detectFullScreen-check" preference="status4evar-pref-advanced-status-detectFullScreen" label="&status4evar.advanced.status.detectFullScreen;" />
- <checkbox id="status4evar-advanced-status-detectVideo-check" preference="status4evar-pref-advanced-status-detectVideo" label="&status4evar.advanced.status.detectVideo;" />
- </groupbox>
- </vbox>
- </prefpane>
+ <prefpane id="status4evar-pane-status" label="&status4evar.pane.status;">
+ <preferences>
+ <preference id="status4evar-pref-status" name="status4evar.status" type="int" />
+ <preference id="status4evar-pref-status-default" name="status4evar.status.default" type="bool" />
+ <preference id="status4evar-pref-status-network" name="status4evar.status.network" type="bool"
+ onchange="status4evarPrefs.statusNetworkChanged();" />
+ <preference id="status4evar-pref-status-network-xhr" name="status4evar.status.network.xhr" type="bool" />
+ <preference id="status4evar-pref-status-timeout" name="status4evar.status.timeout" type="int"
+ onchange="status4evarPrefs.statusTimeoutChanged();" />
+ <preference id="status4evar-pref-status-linkOver" name="status4evar.status.linkOver" type="int" />
+ <preference id="status4evar-pref-status-linkOver-delay-show" name="status4evar.status.linkOver.delay.show" type="int" />
+ <preference id="status4evar-pref-status-linkOver-delay-hide" name="status4evar.status.linkOver.delay.hide" type="int" />
+ <preference id="status4evar-pref-status-toolbar-maxLength" name="status4evar.status.toolbar.maxLength" type="int"
+ onchange="status4evarPrefs.textLengthChanged();" />
+ <preference id="status4evar-pref-status-popup-invertMirror" name="status4evar.status.popup.invertMirror" type="bool" />
+ <preference id="status4evar-pref-status-popup-mouseMirror" name="status4evar.status.popup.mouseMirror" type="bool" />
+ <preference id="toolkit-pref-dom-status-change" name="dom.disable_window_status_change" type="bool" inverted="true" />
+ </preferences>
+
+ <commandset id="status4evar-commandset-status">
+ <command id="status4evar-command-status-timeout" oncommand="status4evarPrefs.statusTimeoutToggle();" />
+ <command id="status4evar-command-status-toolbar-maxLength" oncommand="status4evarPrefs.textLengthToggle();" />
+ </commandset>
+
+ <tabbox id="status4evar-tabbox-status" flex="1">
+ <tabs id="status4evar-tabs-status">
+ <tab id="status4evar-tab-status-general" label="&status4evar.tab.general;" />
+ <tab id="status4evar-tab-status-toolbar" label="&status4evar.tab.toolbar;" />
+ <tab id="status4evar-tab-status-popup" label="&status4evar.tab.popup;" />
+ </tabs>
+
+ <tabpanels id="status4evar-tabpanels-status" flex="1">
+ <tabpanel id="status4evar-tabpanel-status-general" orient="vertical">
+ <groupbox id="status4evar-status-general-status">
+ <caption label="&status4evar.status.general.status.caption;" />
+
+ <hbox align="center">
+ <label id="status4evar-status-label" control="status4evar-status-menu">&status4evar.status.label;</label>
+ <menulist id="status4evar-status-menu" preference="status4evar-pref-status" sizetopopup="always">
+ <menupopup>
+ <menuitem label="&status4evar.option.none;" value="0" />
+ <menuitem label="&status4evar.option.toolbar;" value="1" />
+ <menuitem label="&status4evar.option.popup;" value="3" />
+ </menupopup>
+ </menulist>
+ </hbox>
+
+ <hbox align="center">
+ <checkbox id="status4evar-status-timeout-check" label="&status4evar.status.timeout.label;"
+ command="status4evar-command-status-timeout" />
+ <textbox id="status4evar-status-timeout-value" preference="status4evar-pref-status-timeout" type="number" size="4"
+ onsyncfrompreference="return status4evarPrefs.statusTimeoutSync();" />
+ <label id="status4evar-status-timeout-unit">&status4evar.unit.seconds;</label>
+ </hbox>
+
+ <checkbox id="status4evar-status-default-check" preference="status4evar-pref-status-default" label="&status4evar.status.default.label;" />
+
+ <checkbox id="status4evar-status-network-check" preference="status4evar-pref-status-network" label="&status4evar.status.network.label;"
+ onsyncfrompreference="return status4evarPrefs.statusNetworkSync();" />
+
+ <hbox align="center" class="indent">
+ <checkbox id="status4evar-status-network-xhr-check" preference="status4evar-pref-status-network-xhr" label="&status4evar.status.network.xhr.label;" />
+ </hbox>
+
+ <checkbox id="toolkit-dom-status-change-check" preference="toolkit-pref-dom-status-change" label="&toolkit.dom.status.change.label;" />
+ </groupbox>
+
+ <groupbox id="status4evar-status-general-linkOver">
+ <caption label="&status4evar.status.general.linkOver.caption;" />
+
+ <hbox align="center">
+ <label id="status4evar-status-linkOver-label" control="status4evar-status-linkOver-menu">&status4evar.status.linkOver.label;</label>
+ <menulist id="status4evar-status-linkOver-menu" preference="status4evar-pref-status-linkOver" sizetopopup="always">
+ <menupopup>
+ <menuitem label="&status4evar.option.none;" value="0" />
+ <menuitem label="&status4evar.option.toolbar;" value="1" />
+ <menuitem label="&status4evar.option.popup;" value="3" />
+ </menupopup>
+ </menulist>
+ </hbox>
+
+ <hbox align="center">
+ <label id="status4evar-status-linkOver-delay-show-label" control="status4evar-status-linkOver-delay-show-value">&status4evar.status.linkOver.delay.show.label;</label>
+ <textbox id="status4evar-status-linkOver-delay-show-value" preference="status4evar-pref-status-linkOver-delay-show" type="number" size="5" />
+ <label id="status4evar-status-linkOver-delay-show-unit">&status4evar.unit.milliseconds;</label>
+ </hbox>
+
+ <hbox align="center">
+ <label id="status4evar-status-linkOver-delay-hide-label" control="status4evar-status-linkOver-delay-hide-value">&status4evar.status.linkOver.delay.hide.label;</label>
+ <textbox id="status4evar-status-linkOver-delay-hide-value" preference="status4evar-pref-status-linkOver-delay-hide" type="number" size="5" />
+ <label id="status4evar-status-linkOver-delay-hide-unit">&status4evar.unit.milliseconds;</label>
+ </hbox>
+ </groupbox>
+
+ </tabpanel>
+
+ <tabpanel id="status4evar-tabpanel-status-toolbar" orient="vertical">
+ <hbox align="center">
+ <checkbox id="status4evar-status-toolbar-maxLength-check" label="&status4evar.status.toolbar.maxLength.label;"
+ command="status4evar-command-status-toolbar-maxLength" />
+ <textbox id="status4evar-status-toolbar-maxLength-value" preference="status4evar-pref-status-toolbar-maxLength" type="number" size="4"
+ onsyncfrompreference="return status4evarPrefs.textLengthSync();" />
+ <label id="status4evar-status-toolbar-maxLength-unit">&status4evar.unit.px;</label>
+ </hbox>
+ </tabpanel>
+
+ <tabpanel id="status4evar-tabpanel-status-popup" orient="vertical">
+ <checkbox id="status4evar-status-popup-invertMirror-check" preference="status4evar-pref-status-popup-invertMirror" label="&status4evar.status.popup.invertMirror.label;" />
+
+ <checkbox id="status4evar-status-popup-mouseMirror-check" preference="status4evar-pref-status-popup-mouseMirror" label="&status4evar.status.popup.mouseMirror.label;" />
+ </tabpanel>
+
+ </tabpanels>
+ </tabbox>
+ </prefpane>
+
+ <prefpane id="status4evar-pane-progress" label="&status4evar.pane.progress;">
+ <preferences>
+ <preference id="status4evar-pref-progress-toolbar-force" name="status4evar.progress.toolbar.force" type="bool" />
+ <preference id="status4evar-pref-progress-toolbar-style" name="status4evar.progress.toolbar.style" type="bool"
+ onchange="status4evarPrefs.progressToolbarStyleChanged();" />
+ <preference id="status4evar-pref-progress-toolbar-css" name="status4evar.progress.toolbar.css" type="string"
+ onchange="status4evarPrefs.progressToolbarCSSChanged();" />
+ </preferences>
+
+ <commandset id="status4evar-commandset-status">
+ </commandset>
+
+ <checkbox id="status4evar-progress-toolbar-force-check" preference="status4evar-pref-progress-toolbar-force" label="&status4evar.progress.toolbar.force.label;" />
+
+ <checkbox id="status4evar-progress-toolbar-style-check" preference="status4evar-pref-progress-toolbar-style" label="&status4evar.progress.style.label;"
+ onsyncfrompreference="return status4evarPrefs.progressToolbarStyleSync();" />
+
+ <vbox class="css-bg-editor" preference="status4evar-pref-progress-toolbar-css" preference-editable="true" flex="1">
+ <progressmeter id="status4evar-progress-bar" value="75" flex="1" />
+ </vbox>
+ </prefpane>
+
+ <prefpane id="status4evar-pane-download" label="&status4evar.pane.download;">
+ <preferences>
+ <preference id="status4evar-pref-download-button-action" name="status4evar.download.button.action" type="int" />
+ <preference id="status4evar-pref-download-color-active" name="status4evar.download.color.active" type="string" />
+ <preference id="status4evar-pref-download-color-paused" name="status4evar.download.color.paused" type="string" />
+ <preference id="status4evar-pref-download-force" name="status4evar.download.force" type="bool" />
+ <preference id="status4evar-pref-download-label" name="status4evar.download.label" type="int" />
+ <preference id="status4evar-pref-download-label-force" name="status4evar.download.label.force" type="bool" />
+ <preference id="status4evar-pref-download-notify-animate" name="status4evar.download.notify.animate" type="bool" />
+ <preference id="status4evar-pref-download-notify-timeout" name="status4evar.download.notify.timeout" type="int" />
+ <preference id="status4evar-pref-download-progress" name="status4evar.download.progress" type="int" />
+ <preference id="status4evar-pref-download-tooltip" name="status4evar.download.tooltip" type="int" />
+
+ <preference id="status4evar-pref-download-button-action-command" name="status4evar.download.button.action.command" type="string"/>
+ </preferences>
+
+ <commandset id="status4evar-commandset-download">
+ <command id="status4evar-command-download-progress" oncommand="status4evarPrefs.downloadProgressToggle();" />
+ </commandset>
+
+ <checkbox id="status4evar-download-force-check" preference="status4evar-pref-download-force" label="&status4evar.download.force.label;" />
+
+ <checkbox id="status4evar-download-label-force-check" preference="status4evar-pref-download-label-force" label="&status4evar.download.label.force.label;" />
+
+ <hbox align="center">
+ <label id="status4evar-download-label-label" control="status4evar-download-label-menu">&status4evar.download.label.label;</label>
+ <menulist id="status4evar-download-label-menu" preference="status4evar-pref-download-label" sizetopopup="always">
+ <menupopup>
+ <menuitem value="0" label="&status4evar.option.dlcount;" />
+ <menuitem value="1" label="&status4evar.option.dltime;" />
+ <menuitem value="2" label="&status4evar.option.both;" />
+ </menupopup>
+ </menulist>
+ </hbox>
+
+ <hbox align="center">
+ <label id="status4evar-download-tooltip-label" control="status4evar-download-tooltip-menu">&status4evar.download.tooltip.label;</label>
+ <menulist id="status4evar-download-tooltip-menu" preference="status4evar-pref-download-tooltip" sizetopopup="always">
+ <menupopup>
+ <menuitem value="0" label="&status4evar.option.dlcount;" />
+ <menuitem value="1" label="&status4evar.option.dltime;" />
+ <menuitem value="2" label="&status4evar.option.both;" />
+ </menupopup>
+ </menulist>
+ </hbox>
+
+ <hbox align="center">
+ <label id="status4evar-download-button-action-label" control="status4evar-download-button-action-menu">&status4evar.download.button.action.label;</label>
+ <menulist id="status4evar-download-button-action-menu" preference="status4evar-pref-download-button-action" sizetopopup="always">
+ <menupopup>
+ <menuitem value="0" label="&status4evar.option.nothing;" />
+ <menuitem value="1" label="&status4evar.option.firefoxdefault;" />
+ <menuitem value="2" label="&status4evar.option.download.library;" />
+ <menuitem value="3" label="&status4evar.option.download.tab;" />
+ <menuitem value="4" label="&status4evar.option.download.thirdparty;" id="status4evar-download-button-action-menu-thirdparty" />
+ </menupopup>
+ </menulist>
+ </hbox>
+
+ <hbox align="center">
+ <label id="status4evar-download-notify-timeout-label" control="status4evar-download-notify-timeout-value">&status4evar.download.notify.timeout.label;</label>
+ <textbox id="status4evar-download-notify-timeout-value" preference="status4evar-pref-download-notify-timeout" type="number" size="3" />
+ <label id="status4evar-download-notify-timeout-unit">&status4evar.unit.seconds;</label>
+ </hbox>
+
+ <checkbox id="status4evar-download-notify-animate-check" preference="status4evar-pref-download-notify-animate" label="&status4evar.download.notify.animate.label;" />
+
+ <checkbox id="status4evar-download-progress-check" command="status4evar-command-download-progress" label="&status4evar.download.progress.label;" />
+
+ <vbox class="indent">
+ <hbox align="center">
+ <radiogroup id="status4evar-download-progress-radiogroup" preference="status4evar-pref-download-progress"
+ onsyncfrompreference="return status4evarPrefs.downloadProgressSync();">
+ <radio value="1" label="&status4evar.download.progress.average.label;" />
+ <radio value="2" label="&status4evar.download.progress.max.label;" />
+ <radio value="3" label="&status4evar.download.progress.min.label;" />
+ </radiogroup>
+ </hbox>
+
+ <hbox align="center">
+ <label id="status4evar-download-color-active-label" control="status4evar-download-color-active-picker">&status4evar.download.color.active.label;</label>
+ <colorpicker id="status4evar-download-color-active-picker" preference="status4evar-pref-download-color-active" type="button" />
+ </hbox>
+
+ <hbox align="center">
+ <label id="status4evar-download-color-paused-label" control="status4evar-download-color-paused-picker">&status4evar.download.color.paused.label;</label>
+ <colorpicker id="status4evar-download-color-paused-picker" preference="status4evar-pref-download-color-paused" type="button" />
+ </hbox>
+ </vbox>
+ </prefpane>
+
+ <prefpane id="status4evar-pane-addonbar" label="&status4evar.pane.statusbar;">
+ <preferences>
+ <preference id="status4evar-pref-addonbar-borderStyle" name="status4evar.addonbar.borderStyle" type="bool" />
+ <preference id="status4evar-pref-addonbar-closeButton" name="status4evar.addonbar.closeButton" type="bool" />
+ <preference id="status4evar-pref-addonbar-windowGripper" name="status4evar.addonbar.windowGripper" type="bool" />
+ </preferences>
+
+ <checkbox id="status4evar-addonbar-borderStyle-check" preference="status4evar-pref-addonbar-borderStyle" label="&status4evar.addonbar.borderStyle;" />
+
+ <checkbox id="status4evar-addonbar-closeButton-check" preference="status4evar-pref-addonbar-closeButton" label="&status4evar.addonbar.closeButton;" />
+
+ <checkbox id="status4evar-addonbar-windowGripper-check" preference="status4evar-pref-addonbar-windowGripper" label="&status4evar.addonbar.windowGripper;" />
+ </prefpane>
+
+ <prefpane id="status4evar-pane-advanced" label="&status4evar.pane.advanced;">
+ <preferences>
+ <preference id="status4evar-pref-advanced-status-detectFullScreen" name="status4evar.advanced.status.detectFullScreen" type="bool" />
+ <preference id="status4evar-pref-advanced-status-detectVideo" name="status4evar.advanced.status.detectVideo" type="bool" />
+ <preference id="browser-pref-urlbar-trimming-enabled" name="browser.urlbar.trimURLs" type="bool" />
+ </preferences>
+
+ <vbox flex="1">
+ <groupbox id="status4evar-status-urlbar-builtin">
+ <caption label="&status4evar.status.urlbar.firefox.builtin.caption;" />
+
+ <checkbox id="browser-urlbar-trimming-enabled-ckeck" preference="browser-pref-urlbar-trimming-enabled" label="&browser.urlbar.trimming.enabled.label;" />
+ </groupbox>
+
+ <groupbox id="status4evar-advanced-status">
+ <caption label="&status4evar.pane.status;" />
+
+ <checkbox id="status4evar-advanced-status-detectFullScreen-check" preference="status4evar-pref-advanced-status-detectFullScreen" label="&status4evar.advanced.status.detectFullScreen;" />
+ <checkbox id="status4evar-advanced-status-detectVideo-check" preference="status4evar-pref-advanced-status-detectVideo" label="&status4evar.advanced.status.detectVideo;" />
+ </groupbox>
+ </vbox>
+ </prefpane>
</prefwindow>
diff --git a/application/palemoon/components/statusbar/content/tabbrowser.xml b/application/palemoon/components/statusbar/content/tabbrowser.xml
index 5119fa58a3..2f475771d1 100644
--- a/application/palemoon/components/statusbar/content/tabbrowser.xml
+++ b/application/palemoon/components/statusbar/content/tabbrowser.xml
@@ -9,210 +9,210 @@
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
- <binding id="statuspanel" display="xul:hbox" extends="chrome://browser/content/tabbrowser.xml#statuspanel">
- <implementation>
- <!-- -->
- <!-- Inverted mirror handling -->
- <!-- -->
-
- <field name="_invertMirror"><![CDATA[
- false
- ]]></field>
-
- <property name="invertMirror">
- <setter><![CDATA[
- this._invertMirror = val;
- this.mirror = this._isMirrored;
- return val;
- ]]></setter>
- <getter><![CDATA[
- return this._invertMirror;
- ]]></getter>
- </property>
-
- <!-- -->
- <!-- Mouse mirror handling -->
- <!-- -->
-
- <field name="_mouseMirror"><![CDATA[
- true
- ]]></field>
-
- <field name="_mouseMirrorListen"><![CDATA[
- false
- ]]></field>
-
- <property name="mouseMirror">
- <setter><![CDATA[
- this._mouseMirror = val;
- this.setupMouseMirror(this.value);
- return val;
- ]]></setter>
- <getter><![CDATA[
- return this._mouseMirror;
- ]]></getter>
- </property>
-
- <method name="setupMouseMirror">
- <parameter name="val"/>
- <body><![CDATA[
- if(val && this._mouseMirror)
- {
- this._calcMouseTargetRect();
- if(!this._mouseMirrorListen)
- {
- MousePosTracker.addListener(this);
- this._mouseMirrorListen = true;
- }
- }
- else
- {
- this.mirror = false;
- if(this._mouseMirrorListen)
- {
- MousePosTracker.removeListener(this);
- this._mouseMirrorListen = false;
- }
- }
- ]]></body>
- </method>
-
- <method name="_calcMouseTargetRect">
- <body><![CDATA[
- let alignRight = false;
- let isRTL = (getComputedStyle(document.documentElement).direction == "rtl");
- if((this._invertMirror && !isRTL) || (!this._invertMirror && isRTL))
- {
- alignRight = true;
- }
-
- let rect = this.getBoundingClientRect();
- this._mouseTargetRect =
- {
- top: rect.top,
- bottom: rect.bottom,
- left: ((alignRight) ? window.innerWidth - rect.width : 0),
- right: ((alignRight) ? window.innerWidth : rect.width)
- };
- ]]></body>
- </method>
-
- <method name="onMouseEnter">
- <body><![CDATA[
- this.mirror = true;
- ]]></body>
- </method>
-
- <method name="onMouseLeave">
- <body><![CDATA[
- this.mirror = false;
- ]]></body>
- </method>
-
- <!-- -->
- <!-- Mirror handling -->
- <!-- -->
-
- <field name="_isMirrored"><![CDATA[
- false
- ]]></field>
-
- <property name="mirror">
- <setter><![CDATA[
- this._isMirrored = val;
- if(this._invertMirror)
- {
- val = !val;
- }
-
- this.setBooleanAttr("mirror", val);
- ]]></setter>
- <getter><![CDATA[
- return this._isMirrored;
- ]]></getter>
- </property>
-
- <method name="_mirror">
- <body><![CDATA[
- this.mirror = !this._isMirrored;
- ]]></body>
- </method>
-
- <!-- -->
- <!-- Value handling -->
- <!-- -->
-
- <property name="label">
- <setter><![CDATA[
- if(window.caligon && window.caligon.status4evar)
- {
- window.caligon.status4evar.statusService.setStatusText(val);
- }
- return undefined;
- ]]></setter>
- <getter><![CDATA[
- if(window.caligon && window.caligon.status4evar)
- {
- return window.caligon.status4evar.statusService.getStatusText();
- }
- return "";
- ]]></getter>
- </property>
-
- <property name="value">
- <setter><![CDATA[
- this.setValue(val);
- this.setupMouseMirror(val);
- return val;
- ]]></setter>
- <getter><![CDATA[
- return ((this.hasAttribute("inactive")) ? "" : this.getAttribute("label"));
- ]]></getter>
- </property>
-
- <method name="setValue">
- <parameter name="val"/>
- <body><![CDATA[
- if((this.getAttribute("type") || "").indexOf("network") > -1 && (this.getAttribute("previoustype") || "").indexOf("network") > -1)
- {
- this.style.minWidth = getComputedStyle(this).width;
- }
- else
- {
- this.style.minWidth = "";
- }
-
- if(val)
- {
- this.setAttribute("label", val);
- this.setBooleanAttr("inactive", false);
- }
- else
- {
- this.setBooleanAttr("inactive", true);
- }
- ]]></body>
- </method>
-
- <!-- -->
- <!-- Helpers -->
- <!-- -->
-
- <method name="setBooleanAttr">
- <parameter name="name"/>
- <parameter name="val"/>
- <body><![CDATA[
- if(val)
- {
- this.setAttribute(name, "true");
- }
- else
- {
- this.removeAttribute(name);
- }
- ]]></body>
- </method>
- </implementation>
- </binding>
+ <binding id="statuspanel" display="xul:hbox" extends="chrome://browser/content/tabbrowser.xml#statuspanel">
+ <implementation>
+ <!-- -->
+ <!-- Inverted mirror handling -->
+ <!-- -->
+
+ <field name="_invertMirror"><![CDATA[
+ false
+ ]]></field>
+
+ <property name="invertMirror">
+ <setter><![CDATA[
+ this._invertMirror = val;
+ this.mirror = this._isMirrored;
+ return val;
+ ]]></setter>
+ <getter><![CDATA[
+ return this._invertMirror;
+ ]]></getter>
+ </property>
+
+ <!-- -->
+ <!-- Mouse mirror handling -->
+ <!-- -->
+
+ <field name="_mouseMirror"><![CDATA[
+ true
+ ]]></field>
+
+ <field name="_mouseMirrorListen"><![CDATA[
+ false
+ ]]></field>
+
+ <property name="mouseMirror">
+ <setter><![CDATA[
+ this._mouseMirror = val;
+ this.setupMouseMirror(this.value);
+ return val;
+ ]]></setter>
+ <getter><![CDATA[
+ return this._mouseMirror;
+ ]]></getter>
+ </property>
+
+ <method name="setupMouseMirror">
+ <parameter name="val"/>
+ <body><![CDATA[
+ if(val && this._mouseMirror)
+ {
+ this._calcMouseTargetRect();
+ if(!this._mouseMirrorListen)
+ {
+ MousePosTracker.addListener(this);
+ this._mouseMirrorListen = true;
+ }
+ }
+ else
+ {
+ this.mirror = false;
+ if(this._mouseMirrorListen)
+ {
+ MousePosTracker.removeListener(this);
+ this._mouseMirrorListen = false;
+ }
+ }
+ ]]></body>
+ </method>
+
+ <method name="_calcMouseTargetRect">
+ <body><![CDATA[
+ let alignRight = false;
+ let isRTL = (getComputedStyle(document.documentElement).direction == "rtl");
+ if((this._invertMirror && !isRTL) || (!this._invertMirror && isRTL))
+ {
+ alignRight = true;
+ }
+
+ let rect = this.getBoundingClientRect();
+ this._mouseTargetRect =
+ {
+ top: rect.top,
+ bottom: rect.bottom,
+ left: ((alignRight) ? window.innerWidth - rect.width : 0),
+ right: ((alignRight) ? window.innerWidth : rect.width)
+ };
+ ]]></body>
+ </method>
+
+ <method name="onMouseEnter">
+ <body><![CDATA[
+ this.mirror = true;
+ ]]></body>
+ </method>
+
+ <method name="onMouseLeave">
+ <body><![CDATA[
+ this.mirror = false;
+ ]]></body>
+ </method>
+
+ <!-- -->
+ <!-- Mirror handling -->
+ <!-- -->
+
+ <field name="_isMirrored"><![CDATA[
+ false
+ ]]></field>
+
+ <property name="mirror">
+ <setter><![CDATA[
+ this._isMirrored = val;
+ if(this._invertMirror)
+ {
+ val = !val;
+ }
+
+ this.setBooleanAttr("mirror", val);
+ ]]></setter>
+ <getter><![CDATA[
+ return this._isMirrored;
+ ]]></getter>
+ </property>
+
+ <method name="_mirror">
+ <body><![CDATA[
+ this.mirror = !this._isMirrored;
+ ]]></body>
+ </method>
+
+ <!-- -->
+ <!-- Value handling -->
+ <!-- -->
+
+ <property name="label">
+ <setter><![CDATA[
+ if(window.caligon && window.caligon.status4evar)
+ {
+ window.caligon.status4evar.statusService.setStatusText(val);
+ }
+ return undefined;
+ ]]></setter>
+ <getter><![CDATA[
+ if(window.caligon && window.caligon.status4evar)
+ {
+ return window.caligon.status4evar.statusService.getStatusText();
+ }
+ return "";
+ ]]></getter>
+ </property>
+
+ <property name="value">
+ <setter><![CDATA[
+ this.setValue(val);
+ this.setupMouseMirror(val);
+ return val;
+ ]]></setter>
+ <getter><![CDATA[
+ return ((this.hasAttribute("inactive")) ? "" : this.getAttribute("label"));
+ ]]></getter>
+ </property>
+
+ <method name="setValue">
+ <parameter name="val"/>
+ <body><![CDATA[
+ if((this.getAttribute("type") || "").indexOf("network") > -1 && (this.getAttribute("previoustype") || "").indexOf("network") > -1)
+ {
+ this.style.minWidth = getComputedStyle(this).width;
+ }
+ else
+ {
+ this.style.minWidth = "";
+ }
+
+ if(val)
+ {
+ this.setAttribute("label", val);
+ this.setBooleanAttr("inactive", false);
+ }
+ else
+ {
+ this.setBooleanAttr("inactive", true);
+ }
+ ]]></body>
+ </method>
+
+ <!-- -->
+ <!-- Helpers -->
+ <!-- -->
+
+ <method name="setBooleanAttr">
+ <parameter name="name"/>
+ <parameter name="val"/>
+ <body><![CDATA[
+ if(val)
+ {
+ this.setAttribute(name, "true");
+ }
+ else
+ {
+ this.removeAttribute(name);
+ }
+ ]]></body>
+ </method>
+ </implementation>
+ </binding>
</bindings>
diff --git a/application/palemoon/components/statusbar/status4evar.idl b/application/palemoon/components/statusbar/status4evar.idl
index d14fcbcd13..534dea31c0 100644
--- a/application/palemoon/components/statusbar/status4evar.idl
+++ b/application/palemoon/components/statusbar/status4evar.idl
@@ -9,49 +9,49 @@ interface nsIDOMWindow;
[scriptable, uuid(33d0433d-07be-4dc4-87fd-954057310efd)]
interface nsIStatus4Evar : nsISupports
{
- readonly attribute boolean addonbarBorderStyle;
- readonly attribute boolean addonbarCloseButton;
- readonly attribute boolean addonbarLegacyShim;
- readonly attribute boolean addonbarWindowGripper;
-
- readonly attribute boolean advancedStatusDetectFullScreen;
- readonly attribute boolean advancedStatusDetectVideo;
-
- readonly attribute long downloadButtonAction;
- readonly attribute ACString downloadButtonActionCommand;
- readonly attribute ACString downloadColorActive;
- readonly attribute ACString downloadColorPaused;
- readonly attribute boolean downloadForce;
- readonly attribute long downloadLabel;
- readonly attribute boolean downloadLabelForce;
- readonly attribute boolean downloadNotifyAnimate;
- readonly attribute long downloadNotifyTimeout;
- readonly attribute long downloadProgress;
- readonly attribute long downloadTooltip;
-
- readonly attribute boolean firstRun;
- readonly attribute boolean firstRunAustralis;
-
- readonly attribute ACString progressToolbarCSS;
- readonly attribute boolean progressToolbarForce;
- readonly attribute boolean progressToolbarStyle;
- readonly attribute boolean progressToolbarStyleAdvanced;
-
- readonly attribute long status;
- readonly attribute boolean statusDefault;
- readonly attribute boolean statusNetwork;
- readonly attribute boolean statusNetworkXHR;
- readonly attribute long statusTimeout;
- readonly attribute long statusLinkOver;
- readonly attribute long statusLinkOverDelayShow;
- readonly attribute long statusLinkOverDelayHide;
-
- readonly attribute long statusToolbarMaxLength;
-
- readonly attribute boolean statusToolbarInvertMirror;
- readonly attribute boolean statusToolbarMouseMirror;
-
- void resetPrefs();
- void updateWindow(in nsIDOMWindow win);
+ readonly attribute boolean addonbarBorderStyle;
+ readonly attribute boolean addonbarCloseButton;
+ readonly attribute boolean addonbarLegacyShim;
+ readonly attribute boolean addonbarWindowGripper;
+
+ readonly attribute boolean advancedStatusDetectFullScreen;
+ readonly attribute boolean advancedStatusDetectVideo;
+
+ readonly attribute long downloadButtonAction;
+ readonly attribute ACString downloadButtonActionCommand;
+ readonly attribute ACString downloadColorActive;
+ readonly attribute ACString downloadColorPaused;
+ readonly attribute boolean downloadForce;
+ readonly attribute long downloadLabel;
+ readonly attribute boolean downloadLabelForce;
+ readonly attribute boolean downloadNotifyAnimate;
+ readonly attribute long downloadNotifyTimeout;
+ readonly attribute long downloadProgress;
+ readonly attribute long downloadTooltip;
+
+ readonly attribute boolean firstRun;
+ readonly attribute boolean firstRunAustralis;
+
+ readonly attribute ACString progressToolbarCSS;
+ readonly attribute boolean progressToolbarForce;
+ readonly attribute boolean progressToolbarStyle;
+ readonly attribute boolean progressToolbarStyleAdvanced;
+
+ readonly attribute long status;
+ readonly attribute boolean statusDefault;
+ readonly attribute boolean statusNetwork;
+ readonly attribute boolean statusNetworkXHR;
+ readonly attribute long statusTimeout;
+ readonly attribute long statusLinkOver;
+ readonly attribute long statusLinkOverDelayShow;
+ readonly attribute long statusLinkOverDelayHide;
+
+ readonly attribute long statusToolbarMaxLength;
+
+ readonly attribute boolean statusToolbarInvertMirror;
+ readonly attribute boolean statusToolbarMouseMirror;
+
+ void resetPrefs();
+ void updateWindow(in nsIDOMWindow win);
};
diff --git a/application/palemoon/components/statusbar/status4evar.js b/application/palemoon/components/statusbar/status4evar.js
index abc6c9175c..4aa2e3e78d 100644
--- a/application/palemoon/components/statusbar/status4evar.js
+++ b/application/palemoon/components/statusbar/status4evar.js
@@ -18,677 +18,677 @@ function Status_4_Evar(){}
Status_4_Evar.prototype =
{
- classID: Components.ID("{33d0433d-07be-4dc4-87fd-954057310efd}"),
- QueryInterface: XPCOMUtils.generateQI([
- CI.nsISupportsWeakReference,
- CI.nsIObserver,
- CI.nsIStatus4Evar
- ]),
-
- prefs: null,
-
- addonbarBorderStyle: false,
- addonbarCloseButton: false,
- addonbarWindowGripper: true,
-
- advancedStatusDetectFullScreen: true,
- advancedStatusDetectVideo: true,
-
- downloadButtonAction: 1,
- downloadButtonActionCommand: "",
- downloadColorActive: null,
- downloadColorPaused: null,
- downloadForce: false,
- downloadLabel: 0,
- downloadLabelForce: true,
- downloadNotifyAnimate: true,
- downloadNotifyTimeout: 60000,
- downloadProgress: 1,
- downloadTooltip: 1,
-
- firstRun: true,
-
- progressToolbarCSS: null,
- progressToolbarForce: false,
- progressToolbarStyle: false,
-
- status: 1,
- statusDefault: true,
- statusNetwork: true,
- statusTimeout: 10000,
- statusLinkOver: 1,
- statusLinkOverDelayShow: 70,
- statusLinkOverDelayHide: 150,
-
- statusToolbarMaxLength: 0,
-
- statusToolbarInvertMirror: false,
- statusToolbarMouseMirror: true,
-
- pref_registry:
- {
- "addonbar.borderStyle":
- {
- update: function()
- {
- this.addonbarBorderStyle = this.prefs.getBoolPref("addonbar.borderStyle");
- },
- updateWindow: function(win)
- {
- let browser_bottom_box = win.caligon.status4evar.getters.browserBottomBox;
- if(browser_bottom_box)
- {
- this.setBoolElementAttribute(browser_bottom_box, "s4eboarder", this.addonbarBorderStyle);
- }
- }
- },
-
- "addonbar.closeButton":
- {
- update: function()
- {
- this.addonbarCloseButton = this.prefs.getBoolPref("addonbar.closeButton");
- },
- updateWindow: function(win)
- {
- let addonbar_close_button = win.caligon.status4evar.getters.addonbarCloseButton;
- if(addonbar_close_button)
- {
- addonbar_close_button.hidden = !this.addonbarCloseButton;
- }
- }
- },
-
- "addonbar.windowGripper":
- {
- update: function()
- {
- this.addonbarWindowGripper = this.prefs.getBoolPref("addonbar.windowGripper");
- },
- updateWindow: function(win)
- {
- win.caligon.status4evar.toolbars.updateWindowGripper(true);
- }
- },
-
- "advanced.status.detectFullScreen":
- {
- update: function()
- {
- this.advancedStatusDetectFullScreen = this.prefs.getBoolPref("advanced.status.detectFullScreen");
- }
- },
-
- "advanced.status.detectVideo":
- {
- update: function()
- {
- this.advancedStatusDetectVideo = this.prefs.getBoolPref("advanced.status.detectVideo");
- }
- },
-
- "download.button.action":
- {
- update: function()
- {
- this.downloadButtonAction = this.prefs.getIntPref("download.button.action");
- },
- updateWindow: function(win)
- {
- win.caligon.status4evar.downloadStatus.updateBinding();
- }
- },
-
- "download.button.action.command":
- {
- update: function()
- {
- this.downloadButtonActionCommand = this.prefs.getCharPref("download.button.action.command");
- }
- },
-
- "download.color.active":
- {
- update: function()
- {
- this.downloadColorActive = this.prefs.getCharPref("download.color.active");
- },
- updateDynamicStyle: function(sheet)
- {
- sheet.cssRules[2].style.backgroundColor = this.downloadColorActive;
- }
- },
-
- "download.color.paused":
- {
- update: function()
- {
- this.downloadColorPaused = this.prefs.getCharPref("download.color.paused");
- },
- updateDynamicStyle: function(sheet)
- {
- sheet.cssRules[3].style.backgroundColor = this.downloadColorPaused;
- }
- },
-
- "download.force":
- {
- update: function()
- {
- this.downloadForce = this.prefs.getBoolPref("download.force");
- },
- updateWindow: function(win)
- {
- let download_button = win.caligon.status4evar.getters.downloadButton;
- if(download_button)
- {
- this.setBoolElementAttribute(download_button, "forcevisible", this.downloadForce);
- }
-
- let download_notify_anchor = win.caligon.status4evar.getters.downloadNotifyAnchor;
- this.setBoolElementAttribute(download_notify_anchor, "forcevisible", this.downloadForce);
- }
- },
-
- "download.label":
- {
- update: function()
- {
- this.downloadLabel = this.prefs.getIntPref("download.label");
- },
- updateWindow: function(win)
- {
- win.caligon.status4evar.downloadStatus.updateButton();
- }
- },
-
- "download.label.force":
- {
- update: function()
- {
- this.downloadLabelForce = this.prefs.getBoolPref("download.label.force");
- },
- updateWindow: function(win)
- {
- let download_button = win.caligon.status4evar.getters.downloadButton;
- if(download_button)
- {
- this.setBoolElementAttribute(download_button, "forcelabel", this.downloadLabelForce);
- }
- }
- },
-
- "download.notify.animate":
- {
- update: function()
- {
- this.downloadNotifyAnimate = this.prefs.getBoolPref("download.notify.animate");
- }
- },
-
- "download.notify.timeout":
- {
- update: function()
- {
- this.downloadNotifyTimeout = (this.prefs.getIntPref("download.notify.timeout") * 1000);
- }
- },
-
- "download.progress":
- {
- update: function()
- {
- this.downloadProgress = this.prefs.getIntPref("download.progress");
- },
- updateWindow: function(win)
- {
- win.caligon.status4evar.downloadStatus.updateButton();
- }
- },
-
- "download.tooltip":
- {
- update: function()
- {
- this.downloadTooltip = this.prefs.getIntPref("download.tooltip");
- },
- updateWindow: function(win)
- {
- win.caligon.status4evar.downloadStatus.updateButton();
- }
- },
-
- "progress.toolbar.css":
- {
- update: function()
- {
- this.progressToolbarCSS = this.prefs.getCharPref("progress.toolbar.css");
- },
- updateDynamicStyle: function(sheet)
- {
- sheet.cssRules[1].style.background = this.progressToolbarCSS;
- }
- },
-
- "progress.toolbar.force":
- {
- update: function()
- {
- this.progressToolbarForce = this.prefs.getBoolPref("progress.toolbar.force");
- },
- updateWindow: function(win)
- {
- let toolbar_progress = win.caligon.status4evar.getters.toolbarProgress;
- if(toolbar_progress)
- {
- this.setBoolElementAttribute(toolbar_progress, "forcevisible", this.progressToolbarForce);
- }
- }
- },
-
- "progress.toolbar.style":
- {
- update: function()
- {
- this.progressToolbarStyle = this.prefs.getBoolPref("progress.toolbar.style");
- },
- updateWindow: function(win)
- {
- let toolbar_progress = win.caligon.status4evar.getters.toolbarProgress;
- if(toolbar_progress)
- {
- this.setBoolElementAttribute(toolbar_progress, "s4estyle", this.progressToolbarStyle);
- }
- }
- },
-
- "status":
- {
- update: function()
- {
- this.status = this.prefs.getIntPref("status");
- },
- updateWindow: function(win)
- {
- win.caligon.status4evar.statusService.clearStatusField();
- win.caligon.status4evar.statusService.updateStatusField(true);
- }
- },
-
- "status.default":
- {
- update: function()
- {
- this.statusDefault = this.prefs.getBoolPref("status.default");
- },
- updateWindow: function(win)
- {
- win.caligon.status4evar.statusService.buildTextOrder();
- win.caligon.status4evar.statusService.updateStatusField(true);
- }
- },
-
- "status.linkOver":
- {
- update: function()
- {
- this.statusLinkOver = this.prefs.getIntPref("status.linkOver");
- }
- },
-
- "status.linkOver.delay.show":
- {
- update: function()
- {
- this.statusLinkOverDelayShow = this.prefs.getIntPref("status.linkOver.delay.show");
- }
- },
-
- "status.linkOver.delay.hide":
- {
- update: function()
- {
- this.statusLinkOverDelayHide = this.prefs.getIntPref("status.linkOver.delay.hide");
- }
- },
-
- "status.network":
- {
- update: function()
- {
- this.statusNetwork = this.prefs.getBoolPref("status.network");
- },
- updateWindow: function(win)
- {
- win.caligon.status4evar.statusService.buildTextOrder();
- }
- },
-
- "status.network.xhr":
- {
- update: function()
- {
- this.statusNetworkXHR = this.prefs.getBoolPref("status.network.xhr");
- },
- updateWindow: function(win)
- {
- win.caligon.status4evar.statusService.buildTextOrder();
- }
- },
-
- "status.timeout":
- {
- update: function()
- {
- this.statusTimeout = (this.prefs.getIntPref("status.timeout") * 1000);
- },
- updateWindow: function(win)
- {
- win.caligon.status4evar.statusService.updateStatusField(true);
- }
- },
-
- "status.toolbar.maxLength":
- {
- update: function()
- {
- this.statusToolbarMaxLength = this.prefs.getIntPref("status.toolbar.maxLength");
- },
- updateWindow: function(win)
- {
- let status_widget = win.caligon.status4evar.getters.statusWidget;
- if(status_widget)
- {
- status_widget.maxWidth = (this.statusToolbarMaxLength || "");
- }
- }
- },
-
- "status.popup.invertMirror":
- {
- update: function()
- {
- this.statusToolbarInvertMirror = this.prefs.getBoolPref("status.popup.invertMirror");
- },
- updateWindow: function(win)
- {
- let statusOverlay = win.caligon.status4evar.getters.statusOverlay;
- if(statusOverlay)
- {
- statusOverlay.invertMirror = this.statusToolbarInvertMirror;
- }
- }
- },
-
- "status.popup.mouseMirror":
- {
- update: function()
- {
- this.statusToolbarMouseMirror = this.prefs.getBoolPref("status.popup.mouseMirror");
- },
- updateWindow: function(win)
- {
- let statusOverlay = win.caligon.status4evar.getters.statusOverlay;
- if(statusOverlay)
- {
- statusOverlay.mouseMirror = this.statusToolbarMouseMirror;
- }
- }
- }
-
- },
-
- // nsIObserver
- observe: function(subject, topic, data)
- {
- try
- {
- switch(topic)
- {
- case "profile-after-change":
- this.startup();
- break;
- case "quit-application":
- this.shutdown();
- break;
- case "nsPref:changed":
- this.updatePref(data, true);
- break;
- }
- }
- catch(e)
- {
- CU.reportError(e);
- }
- },
-
- startup: function()
- {
- this.prefs = Services.prefs.getBranch("status4evar.").QueryInterface(CI.nsIPrefBranch2);
-
- this.firstRun = this.prefs.getBoolPref("firstRun");
- if(this.firstRun)
- {
- this.prefs.setBoolPref("firstRun", false);
- }
-
- this.migrate();
-
- for(let pref in this.pref_registry)
- {
- let pro = this.pref_registry[pref];
-
- pro.update = pro.update.bind(this);
- if(pro.updateWindow)
- {
- pro.updateWindow = pro.updateWindow.bind(this);
- }
- if(pro.updateDynamicStyle)
- {
- pro.updateDynamicStyle = pro.updateDynamicStyle.bind(this);
- }
-
- this.prefs.addObserver(pref, this, true);
-
- this.updatePref(pref, false);
- }
-
- Services.obs.addObserver(this, "quit-application", true);
- },
-
- shutdown: function()
- {
- Services.obs.removeObserver(this, "quit-application");
-
- for(let pref in this.pref_registry)
- {
- this.prefs.removeObserver(pref, this);
- }
-
- this.prefs = null;
- },
-
- migrate: function()
- {
- if(!this.firstRun)
- {
- let migration = 0;
- try
- {
- migration = this.prefs.getIntPref("migration");
- }
- catch(e) {}
-
- switch(migration)
- {
- case 5:
- this.migrateBoolPref("status.detectFullScreen", "advanced.status.detectFullScreen");
- case 6:
- let oldDownloadAction = this.prefs.getIntPref("download.button.action");
- let newDownloadAction = 1;
- switch(oldDownloadAction)
- {
- case 2:
- newDownloadAction = 1;
- break;
- case 3:
- newDownloadAction = 2;
- break;
- case 4:
- newDownloadAction = 1;
- break;
- }
- this.prefs.setIntPref("download.button.action", newDownloadAction);
- case 7:
- let progressLocation = this.prefs.getIntPref("status");
- if (progressLocation == 2)
- this.prefs.setIntPref("status", 1);
- let linkOverLocation = this.prefs.getIntPref("status.linkOver");
- if (linkOverLocation == 2)
- this.prefs.setIntPref("status.linkOver", 1);
- break;
- case CURRENT_MIGRATION:
- break;
- }
- }
-
- this.prefs.setIntPref("migration", CURRENT_MIGRATION);
- },
-
- migrateBoolPref: function(oldPref, newPref)
- {
- if(this.prefs.prefHasUserValue(oldPref))
- {
- this.prefs.setBoolPref(newPref, this.prefs.getBoolPref(oldPref));
- this.prefs.clearUserPref(oldPref);
- }
- },
-
- migrateIntPref: function(oldPref, newPref)
- {
- if(this.prefs.prefHasUserValue(oldPref))
- {
- this.prefs.setIntPref(newPref, this.prefs.getIntPref(oldPref));
- this.prefs.clearUserPref(oldPref);
- }
- },
-
- migrateCharPref: function(oldPref, newPref)
- {
- if(this.prefs.prefHasUserValue(oldPref))
- {
- this.prefs.setCharPref(newPref, this.prefs.getCharPref(oldPref));
- this.prefs.clearUserPref(oldPref);
- }
- },
-
- updatePref: function(pref, updateWindows)
- {
- if(!(pref in this.pref_registry))
- {
- return;
- }
- let pro = this.pref_registry[pref];
-
- pro.update();
-
- if(updateWindows)
- {
- let windowsEnum = Services.wm.getEnumerator("navigator:browser");
- while(windowsEnum.hasMoreElements())
- {
- this.updateWindow(windowsEnum.getNext(), pro);
- }
- }
-
- if(pro.alsoUpdate)
- {
- pro.alsoUpdate.forEach(function (alsoPref)
- {
- this.updatePref(alsoPref);
- }, this);
- }
- },
-
- // Updtate a browser window
- updateWindow: function(win, pro)
- {
- if(!(win instanceof CI.nsIDOMWindow)
- || !(win.document.documentElement.getAttribute("windowtype") == "navigator:browser"))
- {
- return;
- }
-
- if(pro)
- {
- this.handlePro(win, pro);
- }
- else
- {
- for(let pref in this.pref_registry)
- {
- this.handlePro(win, this.pref_registry[pref]);
- }
- }
- },
-
- handlePro: function(win, pro)
- {
- if(pro.updateWindow)
- {
- pro.updateWindow(win);
- }
-
- if(pro.updateDynamicStyle)
- {
- let styleSheets = win.document.styleSheets;
- for(let i = 0; i < styleSheets.length; i++)
- {
- let styleSheet = styleSheets[i];
- if(styleSheet.href == "chrome://browser/skin/statusbar/dynamic.css")
- {
- pro.updateDynamicStyle(styleSheet);
- break;
- }
- }
- }
- },
-
- setBoolElementAttribute: function(elem, attr, val)
- {
- if(val)
- {
- elem.setAttribute(attr, "true");
- }
- else
- {
- elem.removeAttribute(attr);
- }
- },
-
- setStringElementAttribute: function(elem, attr, val)
- {
- if(val)
- {
- elem.setAttribute(attr, val);
- }
- else
- {
- elem.removeAttribute(attr);
- }
- },
-
- resetPrefs: function()
- {
- let childPrefs = this.prefs.getChildList("");
- childPrefs.forEach(function(pref)
- {
- if(this.prefs.prefHasUserValue(pref))
- {
- this.prefs.clearUserPref(pref);
- }
- }, this);
- }
+ classID: Components.ID("{33d0433d-07be-4dc4-87fd-954057310efd}"),
+ QueryInterface: XPCOMUtils.generateQI([
+ CI.nsISupportsWeakReference,
+ CI.nsIObserver,
+ CI.nsIStatus4Evar
+ ]),
+
+ prefs: null,
+
+ addonbarBorderStyle: false,
+ addonbarCloseButton: false,
+ addonbarWindowGripper: true,
+
+ advancedStatusDetectFullScreen: true,
+ advancedStatusDetectVideo: true,
+
+ downloadButtonAction: 1,
+ downloadButtonActionCommand: "",
+ downloadColorActive: null,
+ downloadColorPaused: null,
+ downloadForce: false,
+ downloadLabel: 0,
+ downloadLabelForce: true,
+ downloadNotifyAnimate: true,
+ downloadNotifyTimeout: 60000,
+ downloadProgress: 1,
+ downloadTooltip: 1,
+
+ firstRun: true,
+
+ progressToolbarCSS: null,
+ progressToolbarForce: false,
+ progressToolbarStyle: false,
+
+ status: 1,
+ statusDefault: true,
+ statusNetwork: true,
+ statusTimeout: 10000,
+ statusLinkOver: 1,
+ statusLinkOverDelayShow: 70,
+ statusLinkOverDelayHide: 150,
+
+ statusToolbarMaxLength: 0,
+
+ statusToolbarInvertMirror: false,
+ statusToolbarMouseMirror: true,
+
+ pref_registry:
+ {
+ "addonbar.borderStyle":
+ {
+ update: function()
+ {
+ this.addonbarBorderStyle = this.prefs.getBoolPref("addonbar.borderStyle");
+ },
+ updateWindow: function(win)
+ {
+ let browser_bottom_box = win.caligon.status4evar.getters.browserBottomBox;
+ if(browser_bottom_box)
+ {
+ this.setBoolElementAttribute(browser_bottom_box, "s4eboarder", this.addonbarBorderStyle);
+ }
+ }
+ },
+
+ "addonbar.closeButton":
+ {
+ update: function()
+ {
+ this.addonbarCloseButton = this.prefs.getBoolPref("addonbar.closeButton");
+ },
+ updateWindow: function(win)
+ {
+ let addonbar_close_button = win.caligon.status4evar.getters.addonbarCloseButton;
+ if(addonbar_close_button)
+ {
+ addonbar_close_button.hidden = !this.addonbarCloseButton;
+ }
+ }
+ },
+
+ "addonbar.windowGripper":
+ {
+ update: function()
+ {
+ this.addonbarWindowGripper = this.prefs.getBoolPref("addonbar.windowGripper");
+ },
+ updateWindow: function(win)
+ {
+ win.caligon.status4evar.toolbars.updateWindowGripper(true);
+ }
+ },
+
+ "advanced.status.detectFullScreen":
+ {
+ update: function()
+ {
+ this.advancedStatusDetectFullScreen = this.prefs.getBoolPref("advanced.status.detectFullScreen");
+ }
+ },
+
+ "advanced.status.detectVideo":
+ {
+ update: function()
+ {
+ this.advancedStatusDetectVideo = this.prefs.getBoolPref("advanced.status.detectVideo");
+ }
+ },
+
+ "download.button.action":
+ {
+ update: function()
+ {
+ this.downloadButtonAction = this.prefs.getIntPref("download.button.action");
+ },
+ updateWindow: function(win)
+ {
+ win.caligon.status4evar.downloadStatus.updateBinding();
+ }
+ },
+
+ "download.button.action.command":
+ {
+ update: function()
+ {
+ this.downloadButtonActionCommand = this.prefs.getCharPref("download.button.action.command");
+ }
+ },
+
+ "download.color.active":
+ {
+ update: function()
+ {
+ this.downloadColorActive = this.prefs.getCharPref("download.color.active");
+ },
+ updateDynamicStyle: function(sheet)
+ {
+ sheet.cssRules[2].style.backgroundColor = this.downloadColorActive;
+ }
+ },
+
+ "download.color.paused":
+ {
+ update: function()
+ {
+ this.downloadColorPaused = this.prefs.getCharPref("download.color.paused");
+ },
+ updateDynamicStyle: function(sheet)
+ {
+ sheet.cssRules[3].style.backgroundColor = this.downloadColorPaused;
+ }
+ },
+
+ "download.force":
+ {
+ update: function()
+ {
+ this.downloadForce = this.prefs.getBoolPref("download.force");
+ },
+ updateWindow: function(win)
+ {
+ let download_button = win.caligon.status4evar.getters.downloadButton;
+ if(download_button)
+ {
+ this.setBoolElementAttribute(download_button, "forcevisible", this.downloadForce);
+ }
+
+ let download_notify_anchor = win.caligon.status4evar.getters.downloadNotifyAnchor;
+ this.setBoolElementAttribute(download_notify_anchor, "forcevisible", this.downloadForce);
+ }
+ },
+
+ "download.label":
+ {
+ update: function()
+ {
+ this.downloadLabel = this.prefs.getIntPref("download.label");
+ },
+ updateWindow: function(win)
+ {
+ win.caligon.status4evar.downloadStatus.updateButton();
+ }
+ },
+
+ "download.label.force":
+ {
+ update: function()
+ {
+ this.downloadLabelForce = this.prefs.getBoolPref("download.label.force");
+ },
+ updateWindow: function(win)
+ {
+ let download_button = win.caligon.status4evar.getters.downloadButton;
+ if(download_button)
+ {
+ this.setBoolElementAttribute(download_button, "forcelabel", this.downloadLabelForce);
+ }
+ }
+ },
+
+ "download.notify.animate":
+ {
+ update: function()
+ {
+ this.downloadNotifyAnimate = this.prefs.getBoolPref("download.notify.animate");
+ }
+ },
+
+ "download.notify.timeout":
+ {
+ update: function()
+ {
+ this.downloadNotifyTimeout = (this.prefs.getIntPref("download.notify.timeout") * 1000);
+ }
+ },
+
+ "download.progress":
+ {
+ update: function()
+ {
+ this.downloadProgress = this.prefs.getIntPref("download.progress");
+ },
+ updateWindow: function(win)
+ {
+ win.caligon.status4evar.downloadStatus.updateButton();
+ }
+ },
+
+ "download.tooltip":
+ {
+ update: function()
+ {
+ this.downloadTooltip = this.prefs.getIntPref("download.tooltip");
+ },
+ updateWindow: function(win)
+ {
+ win.caligon.status4evar.downloadStatus.updateButton();
+ }
+ },
+
+ "progress.toolbar.css":
+ {
+ update: function()
+ {
+ this.progressToolbarCSS = this.prefs.getCharPref("progress.toolbar.css");
+ },
+ updateDynamicStyle: function(sheet)
+ {
+ sheet.cssRules[1].style.background = this.progressToolbarCSS;
+ }
+ },
+
+ "progress.toolbar.force":
+ {
+ update: function()
+ {
+ this.progressToolbarForce = this.prefs.getBoolPref("progress.toolbar.force");
+ },
+ updateWindow: function(win)
+ {
+ let toolbar_progress = win.caligon.status4evar.getters.toolbarProgress;
+ if(toolbar_progress)
+ {
+ this.setBoolElementAttribute(toolbar_progress, "forcevisible", this.progressToolbarForce);
+ }
+ }
+ },
+
+ "progress.toolbar.style":
+ {
+ update: function()
+ {
+ this.progressToolbarStyle = this.prefs.getBoolPref("progress.toolbar.style");
+ },
+ updateWindow: function(win)
+ {
+ let toolbar_progress = win.caligon.status4evar.getters.toolbarProgress;
+ if(toolbar_progress)
+ {
+ this.setBoolElementAttribute(toolbar_progress, "s4estyle", this.progressToolbarStyle);
+ }
+ }
+ },
+
+ "status":
+ {
+ update: function()
+ {
+ this.status = this.prefs.getIntPref("status");
+ },
+ updateWindow: function(win)
+ {
+ win.caligon.status4evar.statusService.clearStatusField();
+ win.caligon.status4evar.statusService.updateStatusField(true);
+ }
+ },
+
+ "status.default":
+ {
+ update: function()
+ {
+ this.statusDefault = this.prefs.getBoolPref("status.default");
+ },
+ updateWindow: function(win)
+ {
+ win.caligon.status4evar.statusService.buildTextOrder();
+ win.caligon.status4evar.statusService.updateStatusField(true);
+ }
+ },
+
+ "status.linkOver":
+ {
+ update: function()
+ {
+ this.statusLinkOver = this.prefs.getIntPref("status.linkOver");
+ }
+ },
+
+ "status.linkOver.delay.show":
+ {
+ update: function()
+ {
+ this.statusLinkOverDelayShow = this.prefs.getIntPref("status.linkOver.delay.show");
+ }
+ },
+
+ "status.linkOver.delay.hide":
+ {
+ update: function()
+ {
+ this.statusLinkOverDelayHide = this.prefs.getIntPref("status.linkOver.delay.hide");
+ }
+ },
+
+ "status.network":
+ {
+ update: function()
+ {
+ this.statusNetwork = this.prefs.getBoolPref("status.network");
+ },
+ updateWindow: function(win)
+ {
+ win.caligon.status4evar.statusService.buildTextOrder();
+ }
+ },
+
+ "status.network.xhr":
+ {
+ update: function()
+ {
+ this.statusNetworkXHR = this.prefs.getBoolPref("status.network.xhr");
+ },
+ updateWindow: function(win)
+ {
+ win.caligon.status4evar.statusService.buildTextOrder();
+ }
+ },
+
+ "status.timeout":
+ {
+ update: function()
+ {
+ this.statusTimeout = (this.prefs.getIntPref("status.timeout") * 1000);
+ },
+ updateWindow: function(win)
+ {
+ win.caligon.status4evar.statusService.updateStatusField(true);
+ }
+ },
+
+ "status.toolbar.maxLength":
+ {
+ update: function()
+ {
+ this.statusToolbarMaxLength = this.prefs.getIntPref("status.toolbar.maxLength");
+ },
+ updateWindow: function(win)
+ {
+ let status_widget = win.caligon.status4evar.getters.statusWidget;
+ if(status_widget)
+ {
+ status_widget.maxWidth = (this.statusToolbarMaxLength || "");
+ }
+ }
+ },
+
+ "status.popup.invertMirror":
+ {
+ update: function()
+ {
+ this.statusToolbarInvertMirror = this.prefs.getBoolPref("status.popup.invertMirror");
+ },
+ updateWindow: function(win)
+ {
+ let statusOverlay = win.caligon.status4evar.getters.statusOverlay;
+ if(statusOverlay)
+ {
+ statusOverlay.invertMirror = this.statusToolbarInvertMirror;
+ }
+ }
+ },
+
+ "status.popup.mouseMirror":
+ {
+ update: function()
+ {
+ this.statusToolbarMouseMirror = this.prefs.getBoolPref("status.popup.mouseMirror");
+ },
+ updateWindow: function(win)
+ {
+ let statusOverlay = win.caligon.status4evar.getters.statusOverlay;
+ if(statusOverlay)
+ {
+ statusOverlay.mouseMirror = this.statusToolbarMouseMirror;
+ }
+ }
+ }
+
+ },
+
+ // nsIObserver
+ observe: function(subject, topic, data)
+ {
+ try
+ {
+ switch(topic)
+ {
+ case "profile-after-change":
+ this.startup();
+ break;
+ case "quit-application":
+ this.shutdown();
+ break;
+ case "nsPref:changed":
+ this.updatePref(data, true);
+ break;
+ }
+ }
+ catch(e)
+ {
+ CU.reportError(e);
+ }
+ },
+
+ startup: function()
+ {
+ this.prefs = Services.prefs.getBranch("status4evar.").QueryInterface(CI.nsIPrefBranch2);
+
+ this.firstRun = this.prefs.getBoolPref("firstRun");
+ if(this.firstRun)
+ {
+ this.prefs.setBoolPref("firstRun", false);
+ }
+
+ this.migrate();
+
+ for(let pref in this.pref_registry)
+ {
+ let pro = this.pref_registry[pref];
+
+ pro.update = pro.update.bind(this);
+ if(pro.updateWindow)
+ {
+ pro.updateWindow = pro.updateWindow.bind(this);
+ }
+ if(pro.updateDynamicStyle)
+ {
+ pro.updateDynamicStyle = pro.updateDynamicStyle.bind(this);
+ }
+
+ this.prefs.addObserver(pref, this, true);
+
+ this.updatePref(pref, false);
+ }
+
+ Services.obs.addObserver(this, "quit-application", true);
+ },
+
+ shutdown: function()
+ {
+ Services.obs.removeObserver(this, "quit-application");
+
+ for(let pref in this.pref_registry)
+ {
+ this.prefs.removeObserver(pref, this);
+ }
+
+ this.prefs = null;
+ },
+
+ migrate: function()
+ {
+ if(!this.firstRun)
+ {
+ let migration = 0;
+ try
+ {
+ migration = this.prefs.getIntPref("migration");
+ }
+ catch(e) {}
+
+ switch(migration)
+ {
+ case 5:
+ this.migrateBoolPref("status.detectFullScreen", "advanced.status.detectFullScreen");
+ case 6:
+ let oldDownloadAction = this.prefs.getIntPref("download.button.action");
+ let newDownloadAction = 1;
+ switch(oldDownloadAction)
+ {
+ case 2:
+ newDownloadAction = 1;
+ break;
+ case 3:
+ newDownloadAction = 2;
+ break;
+ case 4:
+ newDownloadAction = 1;
+ break;
+ }
+ this.prefs.setIntPref("download.button.action", newDownloadAction);
+ case 7:
+ let progressLocation = this.prefs.getIntPref("status");
+ if (progressLocation == 2)
+ this.prefs.setIntPref("status", 1);
+ let linkOverLocation = this.prefs.getIntPref("status.linkOver");
+ if (linkOverLocation == 2)
+ this.prefs.setIntPref("status.linkOver", 1);
+ break;
+ case CURRENT_MIGRATION:
+ break;
+ }
+ }
+
+ this.prefs.setIntPref("migration", CURRENT_MIGRATION);
+ },
+
+ migrateBoolPref: function(oldPref, newPref)
+ {
+ if(this.prefs.prefHasUserValue(oldPref))
+ {
+ this.prefs.setBoolPref(newPref, this.prefs.getBoolPref(oldPref));
+ this.prefs.clearUserPref(oldPref);
+ }
+ },
+
+ migrateIntPref: function(oldPref, newPref)
+ {
+ if(this.prefs.prefHasUserValue(oldPref))
+ {
+ this.prefs.setIntPref(newPref, this.prefs.getIntPref(oldPref));
+ this.prefs.clearUserPref(oldPref);
+ }
+ },
+
+ migrateCharPref: function(oldPref, newPref)
+ {
+ if(this.prefs.prefHasUserValue(oldPref))
+ {
+ this.prefs.setCharPref(newPref, this.prefs.getCharPref(oldPref));
+ this.prefs.clearUserPref(oldPref);
+ }
+ },
+
+ updatePref: function(pref, updateWindows)
+ {
+ if(!(pref in this.pref_registry))
+ {
+ return;
+ }
+ let pro = this.pref_registry[pref];
+
+ pro.update();
+
+ if(updateWindows)
+ {
+ let windowsEnum = Services.wm.getEnumerator("navigator:browser");
+ while(windowsEnum.hasMoreElements())
+ {
+ this.updateWindow(windowsEnum.getNext(), pro);
+ }
+ }
+
+ if(pro.alsoUpdate)
+ {
+ pro.alsoUpdate.forEach(function (alsoPref)
+ {
+ this.updatePref(alsoPref);
+ }, this);
+ }
+ },
+
+ // Updtate a browser window
+ updateWindow: function(win, pro)
+ {
+ if(!(win instanceof CI.nsIDOMWindow)
+ || !(win.document.documentElement.getAttribute("windowtype") == "navigator:browser"))
+ {
+ return;
+ }
+
+ if(pro)
+ {
+ this.handlePro(win, pro);
+ }
+ else
+ {
+ for(let pref in this.pref_registry)
+ {
+ this.handlePro(win, this.pref_registry[pref]);
+ }
+ }
+ },
+
+ handlePro: function(win, pro)
+ {
+ if(pro.updateWindow)
+ {
+ pro.updateWindow(win);
+ }
+
+ if(pro.updateDynamicStyle)
+ {
+ let styleSheets = win.document.styleSheets;
+ for(let i = 0; i < styleSheets.length; i++)
+ {
+ let styleSheet = styleSheets[i];
+ if(styleSheet.href == "chrome://browser/skin/statusbar/dynamic.css")
+ {
+ pro.updateDynamicStyle(styleSheet);
+ break;
+ }
+ }
+ }
+ },
+
+ setBoolElementAttribute: function(elem, attr, val)
+ {
+ if(val)
+ {
+ elem.setAttribute(attr, "true");
+ }
+ else
+ {
+ elem.removeAttribute(attr);
+ }
+ },
+
+ setStringElementAttribute: function(elem, attr, val)
+ {
+ if(val)
+ {
+ elem.setAttribute(attr, val);
+ }
+ else
+ {
+ elem.removeAttribute(attr);
+ }
+ },
+
+ resetPrefs: function()
+ {
+ let childPrefs = this.prefs.getChildList("");
+ childPrefs.forEach(function(pref)
+ {
+ if(this.prefs.prefHasUserValue(pref))
+ {
+ this.prefs.clearUserPref(pref);
+ }
+ }, this);
+ }
};
const NSGetFactory = XPCOMUtils.generateNSGetFactory([Status_4_Evar]);
diff --git a/application/palemoon/config/version.txt b/application/palemoon/config/version.txt
index 1d43844fa2..b117d70fa4 100644
--- a/application/palemoon/config/version.txt
+++ b/application/palemoon/config/version.txt
@@ -1 +1 @@
-27.9.0a1 \ No newline at end of file
+28.0.0a1 \ No newline at end of file
diff --git a/application/palemoon/configure.in b/application/palemoon/configure.in
index 379c4e5157..0dbb0d8bc1 100644
--- a/application/palemoon/configure.in
+++ b/application/palemoon/configure.in
@@ -5,7 +5,12 @@ dnl License, v. 2.0. If a copy of the MPL was not distributed with this
dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
dnl Things we need to carry from confvars.sh
-
+AC_DEFINE(MOZ_PHOENIX)
+AC_SUBST(MOZ_PHOENIX)
+AC_DEFINE(MC_PALEMOON)
+AC_SUBST(MC_PALEMOON)
+AC_DEFINE(MOZ_PHOENIX_EXTENSIONS)
+AC_SUBST(MOZ_PHOENIX_EXTENSIONS)
dnl Optional parts of the build.
diff --git a/application/palemoon/confvars.sh b/application/palemoon/confvars.sh
index 7466d0c3cd..8a1d00c683 100644
--- a/application/palemoon/confvars.sh
+++ b/application/palemoon/confvars.sh
@@ -3,58 +3,103 @@
# 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/.
-MOZ_APP_BASENAME=Palemoon
+# Application Basename and Vendor
+# MOZ_APP_BASENAME and MOZ_APP_VENDOR must not have spaces.
+# These values where appropriate are hardcoded in application.ini
+# to "Pale Moon" and "Moonchild Productions" respectively for
+# Pale Moon
+MOZ_APP_BASENAME=Palemoon
MOZ_APP_VENDOR=Moonchild
-MOZ_UPDATER=1
+
+# Application Version
+# MOZ_APP_VERSION is read from ./config/version.txt
+# MOZ_APP_VERSION_DISPLAY is not used in Pale Moon so set it
+# to MOZ_APP_VERSION
+MOZ_APP_VERSION=`cat ${_topsrcdir}/$MOZ_BUILD_APP/config/version.txt`
+MOZ_APP_VERSION_DISPLAY=$MOZ_APP_VERSION
+
+# Application ID
+# This is a unique identifier used for the application
+# Most frequently the AppID is used for targetApplication
+# in extensions and for chrome manifests
+MOZ_APP_ID={8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4}
+
+# Use static Application INI File
+MOZ_APP_STATIC_INI=1
+
+# Application Branding
+# The default is MOZ_BRANDING_DIRECTORY and should never point to
+# official branding by default.
+# Changing MOZ_*BRANDING_DIRECTORY requires a clobber because branding
+# dependencies are broken.
+# MOZ_APP_DISPLAYNAME will be set by [branding]/configure.sh
+MOZ_BRANDING_DIRECTORY=$MOZ_BUILD_APP/branding/unofficial
+MOZ_OFFICIAL_BRANDING_DIRECTORY=$MOZ_BUILD_APP/branding/official
+
+# Enables conditional code in the platform for Pale Moon only
+MC_PALEMOON=1
+
+# Enables conditional code in the platform for historically
+# Firefox-like browsers
MOZ_PHOENIX=1
-if test "$OS_TARGET" = "WINNT"; then
- MOZ_BUNDLED_FONTS=1
-fi
+# Browser Feature: Status bar Component
+MOZ_BROWSER_STATUSBAR=1
-MOZ_CHROME_FILE_FORMAT=omni
+# Browser Feature: Profile Migration Component
+MOZ_PROFILE_MIGRATOR=1
+
+# Platform Feature: Application Update Service
+# MAR_CHANNEL_ID must not contained the follow 3 characters: ",\t"
+# ACCEPTED_MAR_CHANNEL_IDS should usually be the same as MAR_CHANNEL_ID
+# If more than one ID is needed, then you should use a comma seperated list.
+MOZ_UPDATER=1
+MAR_CHANNEL_ID=palemoon-release
+ACCEPTED_MAR_CHANNEL_IDS=palemoon-release
+
+# Platform Feature: Developer Tools
+# XXX: Devtools are disabled until they can be made to work with Pale Moon
+MOZ_DEVTOOLS=1
+
+# Platform Feature: "Phoenix" Extensions Support aka Dual-guid system.
+# Allows installation of Firefox GUID targeted extensions despite having
+# a different Application ID
+# On UXP this is a possible feature only for the Tycho Add-ons Manager
+MOZ_PHOENIX_EXTENSIONS=1
+
+# Platform Feature: Sync Service
MOZ_SERVICES_COMMON=1
-MOZ_MEDIA_NAVIGATOR=1
-MOZ_SERVICES_CRYPTO=1
MOZ_SERVICES_SYNC=1
-MOZ_APP_VERSION=`cat ${_topsrcdir}/$MOZ_BUILD_APP/config/version.txt`
-MOZ_EXTENSIONS_DEFAULT=" gio"
-MOZ_SERVICES_FXACCOUNTS=1
-MOZ_DISABLE_EXPORT_JS=1
-MOZ_WEBGL_CONFORMANT=1
-MOZ_ACTIVITIES=1
+# Platform Feature: JS based Downloads Manager
MOZ_JSDOWNLOADS=1
-MOZ_WEBM_ENCODER=1
-MOZ_PHOENIX_EXTENSIONS=1
-MOZ_BROWSER_STATUSBAR=1
+# Platform Feature: Conformant WebGL
+# Exposes the "webgl" context name, which is reserved for
+# conformant implementations.
+MOZ_WEBGL_CONFORMANT=1
-#disabled by default on desktop.
-MOZ_DEVTOOLS=
-
-# MOZ_APP_DISPLAYNAME will be set by branding/configure.sh
-# Changing MOZ_*BRANDING_DIRECTORY requires a clobber to ensure correct results,
-# because branding dependencies are broken.
-# MOZ_BRANDING_DIRECTORY is the default branding directory used when none is
-# specified. It should never point to the "official" branding directory.
-# For mozilla-beta, mozilla-release, or mozilla-central repositories, use
-# "nightly" branding (until bug 659568 is fixed).
-# For the mozilla-aurora repository, use "aurora".
-MOZ_BRANDING_DIRECTORY=browser/branding/unofficial
-MOZ_OFFICIAL_BRANDING_DIRECTORY=browser/branding/official
-# New Pale Moon App GUID
-# Firefox MOZ_APP_ID={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
-MOZ_APP_ID={8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4}
-# This should usually be the same as the value MAR_CHANNEL_ID.
-# If more than one ID is needed, then you should use a comma separated list
-# of values.
-ACCEPTED_MAR_CHANNEL_IDS=palemoon-release
-# The MAR_CHANNEL_ID must not contain the following 3 characters: ",\t "
-MAR_CHANNEL_ID=palemoon-release
-MOZ_PROFILE_MIGRATOR=1
-MOZ_EXTENSION_MANAGER=1
-MOZ_APP_STATIC_INI=1
+# Platform Feature: Windows Maintaince Service
+# XXX: This is never used
+if test "$OS_ARCH" = "WINNT"; then
+ MOZ_MAINTENANCE_SERVICE=
+fi
+
+# Set the chrome packing format
+# Possible values are omni, jar, and flat
+# Currently, only omni and flat are supported
+MOZ_CHROME_FILE_FORMAT=omni
+
+# Set the default top-level extensions
+MOZ_EXTENSIONS_DEFAULT=" gio"
+
+# Fold Libs
if test "$OS_TARGET" = "WINNT" -o "$OS_TARGET" = "Darwin"; then
MOZ_FOLD_LIBS=1
fi
+
+# Include bundled fonts
+if test "$OS_ARCH" = "WINNT" -o \
+ "$OS_ARCH" = "Linux"; then
+ MOZ_BUNDLED_FONTS=1
+fi
diff --git a/application/palemoon/fonts/EmojiOneMozilla.ttf b/application/palemoon/fonts/EmojiOneMozilla.ttf
deleted file mode 100644
index 50356509db..0000000000
--- a/application/palemoon/fonts/EmojiOneMozilla.ttf
+++ /dev/null
Binary files differ
diff --git a/application/palemoon/fonts/README.txt b/application/palemoon/fonts/README.txt
index 188ea3fff2..bf5cb7e6ed 100644
--- a/application/palemoon/fonts/README.txt
+++ b/application/palemoon/fonts/README.txt
@@ -1,9 +1,9 @@
-EmojiOne Mozilla
+Twemoji Mozilla
================
-The upstream repository of EmojiOne Mozilla can be found at
+The upstream repository of Twemoji Mozilla can be found at
- https://github.com/mozilla/emojione-colr
+ https://github.com/mozilla/twemoji-colr
Please refer commit history for the current version of the font.
-This file purposely omit the version, so there is no need to update it here.
+This file purposely omits the version, so there is no need to update it here.
diff --git a/application/palemoon/fonts/TwemojiMozilla.ttf b/application/palemoon/fonts/TwemojiMozilla.ttf
new file mode 100644
index 0000000000..8139089f14
--- /dev/null
+++ b/application/palemoon/fonts/TwemojiMozilla.ttf
Binary files differ
diff --git a/application/palemoon/fonts/moz.build b/application/palemoon/fonts/moz.build
index 93d07120b2..02c027c462 100644
--- a/application/palemoon/fonts/moz.build
+++ b/application/palemoon/fonts/moz.build
@@ -4,8 +4,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-if CONFIG['OS_ARCH'] in ('WINNT'):
+if CONFIG['OS_ARCH'] in ('WINNT', 'Linux'):
DIST_SUBDIR = ''
FINAL_TARGET_FILES.fonts += [
- 'EmojiOneMozilla.ttf'
+ 'TwemojiMozilla.ttf'
]
diff --git a/application/palemoon/installer/Makefile.in b/application/palemoon/installer/Makefile.in
index 7ba8ae9e8f..368b16efcc 100644
--- a/application/palemoon/installer/Makefile.in
+++ b/application/palemoon/installer/Makefile.in
@@ -34,9 +34,9 @@ ifdef MOZ_ENABLE_GNOME_COMPONENT
DEFINES += -DMOZ_ENABLE_GNOME_COMPONENT=1
endif
-ifdef MOZ_WIDGET_GTK
+ifneq (,$(filter gtk%,$(MOZ_WIDGET_TOOLKIT)))
DEFINES += -DMOZ_GTK=1
-ifdef MOZ_ENABLE_GTK3
+ifeq ($(MOZ_WIDGET_TOOLKIT),gtk3)
DEFINES += -DMOZ_GTK3=1
endif
endif
@@ -65,18 +65,14 @@ endif
DEFINES += -DMOZ_CHILD_PROCESS_NAME=$(MOZ_CHILD_PROCESS_NAME)
# Set MSVC dlls version to package, if any.
-ifdef WIN32_REDIST_DIR
ifdef MOZ_NO_DEBUG_RTL
+ifdef WIN32_REDIST_DIR
DEFINES += -DMOZ_PACKAGE_MSVC_DLLS=1
DEFINES += -DMSVC_C_RUNTIME_DLL=$(MSVC_C_RUNTIME_DLL)
DEFINES += -DMSVC_CXX_RUNTIME_DLL=$(MSVC_CXX_RUNTIME_DLL)
-DEFINES += -DMSVC_OPENMP_DLL=$(MSVC_OPENMP_DLL)
-ifdef MSVC_APPCRT_DLL
-DEFINES += -DMSVC_APPCRT_DLL=$(MSVC_APPCRT_DLL)
-endif
-ifdef MSVC_DESKTOPCRT_DLL
-DEFINES += -DMSVC_DESKTOPCRT_DLL=$(MSVC_DESKTOPCRT_DLL)
endif
+ifdef WIN_UCRT_REDIST_DIR
+DEFINES += -DMOZ_PACKAGE_WIN_UCRT_DLLS=1
endif
endif
@@ -135,16 +131,17 @@ AB = $(firstword $(subst -, ,$(AB_CD)))
DEFINES += -DAB=$(AB)
DEFINES += -DMOZ_ICU_VERSION=$(MOZ_ICU_VERSION)
-ifdef MOZ_NATIVE_ICU
-DEFINES += -DMOZ_NATIVE_ICU
+ifdef MOZ_SYSTEM_ICU
+DEFINES += -DMOZ_SYSTEM_ICU
endif
-ifdef MOZ_SHARED_ICU
-DEFINES += -DMOZ_SHARED_ICU
+ifdef MOZ_ICU_DATA_ARCHIVE
+DEFINES += -DMOZ_ICU_DATA_ARCHIVE
endif
ifdef MOZ_JEMALLOC3
DEFINES += -DMOZ_JEMALLOC3
endif
DEFINES += -DMOZ_ICU_DBG_SUFFIX=$(MOZ_ICU_DBG_SUFFIX)
+DEFINES += -DICU_DATA_FILE=$(ICU_DATA_FILE)
ifdef CLANG_CXX
DEFINES += -DCLANG_CXX
endif
@@ -161,7 +158,7 @@ endif
libs::
- $(MAKE) -C $(DEPTH)/browser/locales langpack
+ $(MAKE) -C $(DEPTH)/application/palemoon/locales langpack
ifeq (WINNT,$(OS_ARCH))
PKGCOMP_FIND_OPTS =
diff --git a/application/palemoon/installer/package-manifest.in b/application/palemoon/installer/package-manifest.in
index a581ff4693..f7b12838b5 100644
--- a/application/palemoon/installer/package-manifest.in
+++ b/application/palemoon/installer/package-manifest.in
@@ -35,10 +35,11 @@
#ifdef XP_MACOSX
; Mac bundle stuff
@APPNAME@/Contents/Info.plist
+@APPNAME@/Contents/Library/LaunchServices
@APPNAME@/Contents/PkgInfo
@RESPATH@/firefox.icns
@RESPATH@/document.icns
-@RESPATH@/@AB@.lproj/*
+@RESPATH@/@LPROJ_ROOT@.lproj/*
#endif
[@AB_CD@]
@@ -51,14 +52,14 @@
@RESPATH@/browser/defaults/profile/localstore.rdf
@RESPATH@/browser/defaults/profile/mimeTypes.rdf
@RESPATH@/dictionaries/*
-#if defined(XP_WIN)
+#if defined(XP_WIN) || defined(XP_LINUX)
@RESPATH@/fonts/*
#endif
@RESPATH@/hyphenation/*
@RESPATH@/browser/@PREF_DIR@/palemoon-l10n.js
@RESPATH@/browser/searchplugins/*
-#ifdef XP_WIN32
-@RESPATH@/uninstall/helper.exe
+#ifdef HAVE_MAKENSISU
+@BINPATH@/uninstall/helper.exe
#endif
#ifdef MOZ_UPDATER
@RESPATH@/update.locale
@@ -67,10 +68,6 @@
[xpcom]
@RESPATH@/dependentlibs.list
-#ifdef GKMEDIAS_SHARED_LIBRARY
-@BINPATH@/@DLL_PREFIX@gkmedias@DLL_SUFFIX@
-#endif
-@BINPATH@/@DLL_PREFIX@mozalloc@DLL_SUFFIX@
#ifdef MOZ_SHARED_MOZGLUE
@BINPATH@/@DLL_PREFIX@mozglue@DLL_SUFFIX@
#endif
@@ -80,7 +77,7 @@
#ifdef MOZ_DMD
@BINPATH@/@DLL_PREFIX@dmd@DLL_SUFFIX@
#endif
-#ifndef MOZ_NATIVE_NSPR
+#ifndef MOZ_SYSTEM_NSPR
#ifndef MOZ_FOLD_LIBS
@BINPATH@/@DLL_PREFIX@nspr4@DLL_SUFFIX@
@BINPATH@/@DLL_PREFIX@plc4@DLL_SUFFIX@
@@ -100,60 +97,32 @@
#endif
#ifdef XP_WIN32
@BINPATH@/plugin-hang-ui@BIN_SUFFIX@
-#ifdef MOZ_PACKAGE_MSVC_DLLS
+#if MOZ_PACKAGE_MSVC_DLLS
@BINPATH@/@MSVC_C_RUNTIME_DLL@
@BINPATH@/@MSVC_CXX_RUNTIME_DLL@
-@BINPATH@/@MSVC_OPENMP_DLL@
-#ifdef MSVC_APPCRT_DLL
-@BINPATH@/@MSVC_APPCRT_DLL@
-#endif
-#ifdef MSVC_DESKTOPCRT_DLL
-@BINPATH@/@MSVC_DESKTOPCRT_DLL@
-#endif
-#endif
-#endif
-#ifndef MOZ_NATIVE_ICU
-#ifdef MOZ_SHARED_ICU
-#ifdef XP_WIN
-#ifdef MOZ_DEBUG
-@BINPATH@/icudt@MOZ_ICU_DBG_SUFFIX@@MOZ_ICU_VERSION@.dll
-@BINPATH@/icuin@MOZ_ICU_DBG_SUFFIX@@MOZ_ICU_VERSION@.dll
-@BINPATH@/icuuc@MOZ_ICU_DBG_SUFFIX@@MOZ_ICU_VERSION@.dll
-#else
-@BINPATH@/icudt@MOZ_ICU_VERSION@.dll
-@BINPATH@/icuin@MOZ_ICU_VERSION@.dll
-@BINPATH@/icuuc@MOZ_ICU_VERSION@.dll
#endif
-#elif defined(XP_MACOSX)
-@BINPATH@/libicudata.@MOZ_ICU_VERSION@.dylib
-@BINPATH@/libicui18n.@MOZ_ICU_VERSION@.dylib
-@BINPATH@/libicuuc.@MOZ_ICU_VERSION@.dylib
-#elif defined(XP_UNIX)
-@BINPATH@/libicudata.so.@MOZ_ICU_VERSION@
-@BINPATH@/libicui18n.so.@MOZ_ICU_VERSION@
-@BINPATH@/libicuuc.so.@MOZ_ICU_VERSION@
+#if MOZ_PACKAGE_WIN_UCRT_DLLS
+@BINPATH@/api-ms-win-*.dll
+@BINPATH@/ucrtbase.dll
#endif
#endif
-#endif
-#ifdef MOZ_REPLACE_MALLOC
-#ifndef MOZ_JEMALLOC3
-@BINPATH@/@DLL_PREFIX@replace_jemalloc@DLL_SUFFIX@
-#endif
+#ifdef MOZ_ICU_DATA_ARCHIVE
+@RESPATH@/@ICU_DATA_FILE@
#endif
#ifdef MOZ_GTK3
@BINPATH@/@DLL_PREFIX@mozgtk@DLL_SUFFIX@
-@BINPATH@/@DLL_PREFIX@mozgtk2@DLL_SUFFIX@
+@BINPATH@/gtk2/@DLL_PREFIX@mozgtk@DLL_SUFFIX@
#endif
[browser]
; [Base Browser Files]
#ifndef XP_UNIX
@BINPATH@/@MOZ_APP_NAME@.exe
-@BINPATH@/palemoon.VisualElementsManifest.xml
+@BINPATH@/@MOZ_APP_NAME@.VisualElementsManifest.xml
@BINPATH@/browser/VisualElements/VisualElements_150.png
@BINPATH@/browser/VisualElements/VisualElements_70.png
#else
-@RESPATH@/@MOZ_APP_NAME@-bin
+@BINPATH@/@MOZ_APP_NAME@-bin
@BINPATH@/@MOZ_APP_NAME@
#endif
@RESPATH@/application.ini
@@ -161,490 +130,67 @@
@RESPATH@/update-settings.ini
#endif
@RESPATH@/platform.ini
-#ifndef MOZ_NATIVE_SQLITE
+#ifndef MOZ_SYSTEM_SQLITE
#ifndef MOZ_FOLD_LIBS
@BINPATH@/@DLL_PREFIX@mozsqlite3@DLL_SUFFIX@
#endif
#endif
+@BINPATH@/@DLL_PREFIX@lgpllibs@DLL_SUFFIX@
+#ifdef MOZ_FFVPX
+@BINPATH@/@DLL_PREFIX@mozavutil@DLL_SUFFIX@
+@BINPATH@/@DLL_PREFIX@mozavcodec@DLL_SUFFIX@
+#endif
@RESPATH@/browser/blocklist.xml
#ifdef XP_UNIX
#ifndef XP_MACOSX
@RESPATH@/run-mozilla.sh
#endif
#endif
+#ifdef XP_WIN
+#ifdef _AMD64_
+@BINPATH@/@DLL_PREFIX@qipcap64@DLL_SUFFIX@
+#else
+@BINPATH@/@DLL_PREFIX@qipcap@DLL_SUFFIX@
+#endif
+#endif
; [Components]
-@RESPATH@/browser/components/components.manifest
-@RESPATH@/components/alerts.xpt
+@RESPATH@/components/*
+@RESPATH@/browser/components/*
+#ifdef MOZ_ARTIFACT_BUILDS
+#endif
#ifdef ACCESSIBILITY
#ifdef XP_WIN32
+@BINPATH@/Accessible.tlb
@BINPATH@/AccessibleMarshal.dll
+@BINPATH@/IA2Marshal.dll
+#endif
#endif
-@RESPATH@/components/accessibility.xpt
-#endif
-@RESPATH@/components/appshell.xpt
-@RESPATH@/components/appstartup.xpt
-@RESPATH@/components/autocomplete.xpt
-@RESPATH@/components/autoconfig.xpt
-@RESPATH@/components/browser-element.xpt
-@RESPATH@/browser/components/browsercompsbase.xpt
-@RESPATH@/browser/components/browser-feeds.xpt
-@RESPATH@/components/caps.xpt
-@RESPATH@/components/chrome.xpt
-@RESPATH@/components/commandhandler.xpt
-@RESPATH@/components/commandlines.xpt
-@RESPATH@/components/compartments.xpt
-@RESPATH@/components/composer.xpt
-@RESPATH@/components/content_events.xpt
-@RESPATH@/components/content_html.xpt
-@RESPATH@/components/content_goannamediaplugins.xpt
#ifdef MOZ_WEBRTC
-@RESPATH@/components/content_webrtc.xpt
-#endif
-@RESPATH@/components/content_xslt.xpt
-@RESPATH@/components/cookie.xpt
-@RESPATH@/components/devtools_security.xpt
-@RESPATH@/components/directory.xpt
-@RESPATH@/components/docshell.xpt
-@RESPATH@/components/dom.xpt
-#ifdef MOZ_ACTIVITIES
-@RESPATH@/components/dom_activities.xpt
-@RESPATH@/components/dom_messages.xpt
-#endif
-@RESPATH@/components/dom_apps.xpt
-@RESPATH@/components/dom_base.xpt
-@RESPATH@/components/dom_system.xpt
-#ifdef MOZ_B2G_BT
-@RESPATH@/components/dom_bluetooth.xpt
-#endif
-@RESPATH@/components/dom_canvas.xpt
-@RESPATH@/components/dom_alarm.xpt
-@RESPATH@/components/dom_core.xpt
-@RESPATH@/components/dom_css.xpt
-@RESPATH@/components/dom_devicestorage.xpt
-@RESPATH@/components/dom_events.xpt
-@RESPATH@/components/dom_geolocation.xpt
-@RESPATH@/components/dom_media.xpt
-@RESPATH@/components/dom_network.xpt
-@RESPATH@/components/dom_notification.xpt
-@RESPATH@/components/dom_html.xpt
-@RESPATH@/components/dom_offline.xpt
-@RESPATH@/components/dom_json.xpt
-@RESPATH@/components/dom_power.xpt
-@RESPATH@/components/dom_quota.xpt
-@RESPATH@/components/dom_range.xpt
-@RESPATH@/components/dom_security.xpt
-@RESPATH@/components/dom_settings.xpt
-@RESPATH@/components/dom_permissionsettings.xpt
-@RESPATH@/components/dom_sidebar.xpt
-@RESPATH@/components/dom_cellbroadcast.xpt
-@RESPATH@/components/dom_mobilemessage.xpt
-@RESPATH@/components/dom_storage.xpt
-@RESPATH@/components/dom_stylesheets.xpt
-@RESPATH@/components/dom_telephony.xpt
-@RESPATH@/components/dom_traversal.xpt
-@RESPATH@/components/dom_tv.xpt
-@RESPATH@/components/dom_voicemail.xpt
+#endif
#ifdef MOZ_WEBSPEECH
-@RESPATH@/components/dom_webspeechrecognition.xpt
-#endif
-@RESPATH@/components/dom_workers.xpt
-@RESPATH@/components/dom_xbl.xpt
-@RESPATH@/components/dom_xpath.xpt
-@RESPATH@/components/dom_xul.xpt
-#ifdef MOZ_GAMEPAD
-@RESPATH@/components/dom_gamepad.xpt
-#endif
-#ifdef MOZ_PAY
-@RESPATH@/components/dom_payment.xpt
-#endif
-@RESPATH@/components/dom_presentation.xpt
-@RESPATH@/components/downloads.xpt
-@RESPATH@/components/editor.xpt
-@RESPATH@/components/embed_base.xpt
-@RESPATH@/components/extensions.xpt
-@RESPATH@/components/exthandler.xpt
-@RESPATH@/components/exthelper.xpt
-@RESPATH@/components/fastfind.xpt
-@RESPATH@/components/feeds.xpt
-#ifdef MOZ_GTK
-@RESPATH@/components/filepicker.xpt
-#endif
-@RESPATH@/components/find.xpt
-@RESPATH@/browser/components/fuel.xpt
-@RESPATH@/components/gfx.xpt
-@RESPATH@/components/html5.xpt
-@RESPATH@/components/htmlparser.xpt
-@RESPATH@/components/identity.xpt
-@RESPATH@/components/imglib2.xpt
-@RESPATH@/components/inspector.xpt
-@RESPATH@/components/intl.xpt
-@RESPATH@/components/jar.xpt
-@RESPATH@/components/jsdebugger.xpt
-@RESPATH@/components/jsdownloads.xpt
-@RESPATH@/components/jsinspector.xpt
-@RESPATH@/components/layout_base.xpt
-
-#ifdef NS_PRINTING
-@RESPATH@/components/layout_printing.xpt
-#endif
-@RESPATH@/components/layout_xul_tree.xpt
-@RESPATH@/components/layout_xul.xpt
-@RESPATH@/components/locale.xpt
-@RESPATH@/components/lwbrk.xpt
-@RESPATH@/browser/components/migration.xpt
-@RESPATH@/components/mimetype.xpt
-@RESPATH@/components/mozfind.xpt
-@RESPATH@/components/necko_about.xpt
-@RESPATH@/components/necko_cache.xpt
-@RESPATH@/components/necko_cache2.xpt
-@RESPATH@/components/necko_cookie.xpt
-@RESPATH@/components/necko_dns.xpt
-@RESPATH@/components/necko_file.xpt
-@RESPATH@/components/necko_ftp.xpt
-@RESPATH@/components/necko_http.xpt
-@RESPATH@/components/necko_res.xpt
-@RESPATH@/components/necko_socket.xpt
-@RESPATH@/components/necko_strconv.xpt
-@RESPATH@/components/necko_viewsource.xpt
-@RESPATH@/components/necko_websocket.xpt
-#ifdef NECKO_WIFI
-@RESPATH@/components/necko_wifi.xpt
#endif
-@RESPATH@/components/necko_wyciwyg.xpt
-@RESPATH@/components/necko.xpt
-@RESPATH@/components/loginmgr.xpt
-@RESPATH@/components/parentalcontrols.xpt
-#ifdef MOZ_WEBRTC
-@RESPATH@/components/peerconnection.xpt
-#endif
-@RESPATH@/components/places.xpt
-@RESPATH@/components/plugin.xpt
-@RESPATH@/components/pref.xpt
-@RESPATH@/components/prefetch.xpt
-@RESPATH@/components/profile.xpt
-@RESPATH@/components/rdf.xpt
-@RESPATH@/components/satchel.xpt
-@RESPATH@/components/saxparser.xpt
-@RESPATH@/browser/components/sessionstore.xpt
-@RESPATH@/components/services-crypto-component.xpt
-#ifdef MOZ_CAPTIVEDETECT
-@RESPATH@/components/captivedetect.xpt
-#endif
-@RESPATH@/browser/components/shellservice.xpt
-#ifdef MOZ_BROWSER_STATUSBAR
-@RESPATH@/browser/components/status4evar.xpt
-#endif
-@RESPATH@/components/shistory.xpt
-@RESPATH@/components/spellchecker.xpt
-@RESPATH@/components/storage.xpt
-@RESPATH@/components/toolkit_asyncshutdown.xpt
-@RESPATH@/components/toolkit_filewatcher.xpt
-@RESPATH@/components/toolkit_finalizationwitness.xpt
-@RESPATH@/components/toolkit_formautofill.xpt
-@RESPATH@/components/toolkit_osfile.xpt
-@RESPATH@/components/toolkit_xulstore.xpt
-@RESPATH@/components/toolkitprofile.xpt
-#ifdef MOZ_ENABLE_XREMOTE
-@RESPATH@/components/toolkitremote.xpt
-#endif
-@RESPATH@/components/txtsvc.xpt
-@RESPATH@/components/txmgr.xpt
-@RESPATH@/components/uconv.xpt
-@RESPATH@/components/unicharutil.xpt
-@RESPATH@/components/update.xpt
-@RESPATH@/components/uriloader.xpt
-@RESPATH@/components/urlformatter.xpt
-@RESPATH@/components/webBrowser_core.xpt
-@RESPATH@/components/webbrowserpersist.xpt
-@RESPATH@/components/widget.xpt
-#ifdef XP_MACOSX
-@RESPATH@/components/widget_cocoa.xpt
-#endif
-@RESPATH@/components/windowds.xpt
-@RESPATH@/components/windowwatcher.xpt
-@RESPATH@/components/xpcom_base.xpt
-@RESPATH@/components/xpcom_system.xpt
-@RESPATH@/components/xpcom_components.xpt
-@RESPATH@/components/xpcom_ds.xpt
-@RESPATH@/components/xpcom_io.xpt
-@RESPATH@/components/xpcom_threads.xpt
-@RESPATH@/components/xpcom_xpti.xpt
-@RESPATH@/components/xpconnect.xpt
-@RESPATH@/components/xulapp.xpt
-@RESPATH@/components/xul.xpt
-@RESPATH@/components/xultmpl.xpt
-@RESPATH@/components/zipwriter.xpt
-@RESPATH@/components/telemetry.xpt
-
-; JavaScript components
-@RESPATH@/components/ChromeNotifications.js
-@RESPATH@/components/ChromeNotifications.manifest
-@RESPATH@/components/ConsoleAPI.manifest
-@RESPATH@/components/ConsoleAPIStorage.js
-@RESPATH@/components/BrowserElementParent.manifest
-@RESPATH@/components/BrowserElementParent.js
-@RESPATH@/components/FeedProcessor.manifest
-@RESPATH@/components/FeedProcessor.js
-@RESPATH@/browser/components/BrowserFeeds.manifest
-@RESPATH@/browser/components/FeedConverter.js
-@RESPATH@/browser/components/FeedWriter.js
-@RESPATH@/browser/components/fuelApplication.manifest
-@RESPATH@/browser/components/fuelApplication.js
-@RESPATH@/browser/components/WebContentConverter.js
-@RESPATH@/browser/components/BrowserComponents.manifest
-@RESPATH@/browser/components/nsBrowserContentHandler.js
-@RESPATH@/browser/components/nsBrowserGlue.js
-@RESPATH@/browser/components/nsSetDefaultBrowser.manifest
-@RESPATH@/browser/components/nsSetDefaultBrowser.js
-@RESPATH@/browser/components/BrowserDownloads.manifest
-@RESPATH@/browser/components/DownloadsStartup.js
-@RESPATH@/browser/components/DownloadsUI.js
-@RESPATH@/browser/components/BrowserPlaces.manifest
-@RESPATH@/components/Downloads.manifest
-@RESPATH@/components/DownloadLegacy.js
-@RESPATH@/components/BrowserPageThumbs.manifest
-@RESPATH@/components/crashmonitor.manifest
-@RESPATH@/components/nsCrashMonitor.js
-@RESPATH@/components/SiteSpecificUserAgent.js
-@RESPATH@/components/SiteSpecificUserAgent.manifest
-@RESPATH@/components/toolkitsearch.manifest
-@RESPATH@/components/nsSearchService.js
-@RESPATH@/components/nsSearchSuggestions.js
-@RESPATH@/components/nsSidebar.js
-@RESPATH@/components/passwordmgr.manifest
-@RESPATH@/components/nsLoginInfo.js
-@RESPATH@/components/nsLoginManager.js
-@RESPATH@/components/nsLoginManagerPrompter.js
-@RESPATH@/components/storage-json.js
-@RESPATH@/components/crypto-SDR.js
-@RESPATH@/components/jsconsole-clhandler.manifest
-@RESPATH@/components/jsconsole-clhandler.js
-#ifdef MOZ_DEVTOOLS
-@RESPATH@/components/devtools-clhandler.manifest
-@RESPATH@/components/devtools-clhandler.js
-#endif
-@RESPATH@/components/webvtt.xpt
-@RESPATH@/components/WebVTT.manifest
-@RESPATH@/components/WebVTTParserWrapper.js
#ifdef MOZ_GTK
-@RESPATH@/components/nsFilePicker.manifest
-@RESPATH@/components/nsFilePicker.js
-#endif
-@RESPATH@/components/nsHelperAppDlg.manifest
-@RESPATH@/components/nsHelperAppDlg.js
-@RESPATH@/components/NetworkGeolocationProvider.manifest
-@RESPATH@/components/NetworkGeolocationProvider.js
-@RESPATH@/components/extensions.manifest
-@RESPATH@/components/addonManager.js
-@RESPATH@/components/amContentHandler.js
-@RESPATH@/components/amInstallTrigger.js
-@RESPATH@/components/amWebInstallListener.js
-@RESPATH@/components/nsBlocklistService.js
-#ifdef MOZ_UPDATER
-@RESPATH@/components/nsUpdateService.manifest
-@RESPATH@/components/nsUpdateService.js
-@RESPATH@/components/nsUpdateServiceStub.js
-#endif
-@RESPATH@/components/nsUpdateTimerManager.manifest
-@RESPATH@/components/nsUpdateTimerManager.js
-@RESPATH@/components/addoncompat.manifest
-@RESPATH@/components/multiprocessShims.js
-@RESPATH@/components/remoteTagService.js
-@RESPATH@/components/pluginGlue.manifest
-@RESPATH@/components/ProcessSingleton.manifest
-@RESPATH@/components/MainProcessSingleton.js
-@RESPATH@/components/ContentProcessSingleton.js
-@RESPATH@/browser/components/nsSessionStore.manifest
-@RESPATH@/browser/components/nsSessionStartup.js
-@RESPATH@/browser/components/nsSessionStore.js
-@RESPATH@/components/nsURLFormatter.manifest
-@RESPATH@/components/nsURLFormatter.js
-@RESPATH@/browser/components/@DLL_PREFIX@browsercomps@DLL_SUFFIX@
-@RESPATH@/components/txEXSLTRegExFunctions.manifest
-@RESPATH@/components/txEXSLTRegExFunctions.js
-@RESPATH@/components/toolkitplaces.manifest
-@RESPATH@/components/nsLivemarkService.js
-@RESPATH@/components/nsTaggingService.js
-@RESPATH@/components/nsPlacesAutoComplete.manifest
-@RESPATH@/components/nsPlacesAutoComplete.js
-@RESPATH@/components/UnifiedComplete.manifest
-@RESPATH@/components/UnifiedComplete.js
-@RESPATH@/components/nsPlacesExpiration.js
-@RESPATH@/browser/components/PlacesProtocolHandler.js
-@RESPATH@/components/PlacesCategoriesStarter.js
-@RESPATH@/components/ColorAnalyzer.js
-@RESPATH@/components/PageThumbsProtocol.js
-@RESPATH@/components/nsDefaultCLH.manifest
-@RESPATH@/components/nsDefaultCLH.js
-@RESPATH@/components/nsContentPrefService.manifest
-@RESPATH@/components/nsContentPrefService.js
-@RESPATH@/components/nsContentDispatchChooser.manifest
-@RESPATH@/components/nsContentDispatchChooser.js
-@RESPATH@/components/nsHandlerService.manifest
-@RESPATH@/components/nsHandlerService.js
-@RESPATH@/components/nsWebHandlerApp.manifest
-@RESPATH@/components/nsWebHandlerApp.js
-@RESPATH@/components/satchel.manifest
-@RESPATH@/components/nsFormAutoComplete.js
-@RESPATH@/components/nsFormHistory.js
-@RESPATH@/components/FormHistoryStartup.js
-@RESPATH@/components/nsInputListAutoComplete.js
-@RESPATH@/components/formautofill.manifest
-@RESPATH@/components/FormAutofillContentService.js
-@RESPATH@/components/FormAutofillStartup.js
-@RESPATH@/components/contentAreaDropListener.manifest
-@RESPATH@/components/contentAreaDropListener.js
-@RESPATH@/browser/components/BrowserProfileMigrators.manifest
-@RESPATH@/browser/components/ProfileMigrator.js
-@RESPATH@/browser/components/ChromeProfileMigrator.js
-@RESPATH@/browser/components/FirefoxProfileMigrator.js
-#ifdef MOZ_BROWSER_STATUSBAR
-@RESPATH@/browser/components/status4evar.js
-@RESPATH@/browser/components/status4evar.manifest
#endif
-#ifdef XP_WIN
-@RESPATH@/browser/components/IEProfileMigrator.js
-@RESPATH@/browser/components/SafariProfileMigrator.js
+#ifdef NS_PRINTING
#endif
-#ifdef XP_MACOSX
-@RESPATH@/browser/components/SafariProfileMigrator.js
-#endif
-#ifdef MOZ_ENABLE_DBUS
-@RESPATH@/components/@DLL_PREFIX@dbusservice@DLL_SUFFIX@
-#endif
-#ifdef MOZ_ENABLE_GNOME_COMPONENT
-@RESPATH@/components/@DLL_PREFIX@mozgnome@DLL_SUFFIX@
-#endif
-#ifdef MOZ_ENABLE_GNOMEVFS
-@RESPATH@/components/@DLL_PREFIX@nkgnomevfs@DLL_SUFFIX@
-#endif
-#if defined(MOZ_ENABLE_DBUS) || defined(MOZ_ENABLE_GNOME_COMPONENT) || defined(MOZ_ENABLE_GNOMEVFS)
-@RESPATH@/components/components.manifest
-#endif
-@RESPATH@/components/nsINIProcessor.manifest
-@RESPATH@/components/nsINIProcessor.js
-@RESPATH@/components/nsPrompter.manifest
-@RESPATH@/components/nsPrompter.js
-#ifdef MOZ_DATA_REPORTING
-@RESPATH@/components/DataReporting.manifest
-@RESPATH@/components/DataReportingService.js
-#endif
-#ifdef MOZ_SERVICES_HEALTHREPORT
-@RESPATH@/components/HealthReportComponents.manifest
-@RESPATH@/browser/components/SelfSupportService.manifest
-@RESPATH@/browser/components/SelfSupportService.js
-#endif
-#ifdef MOZ_SERVICES_SYNC
-@RESPATH@/components/SyncComponents.manifest
-@RESPATH@/components/Weave.js
-#endif
-#ifdef MOZ_CAPTIVEDETECT
-@RESPATH@/components/CaptivePortalDetectComponents.manifest
-@RESPATH@/components/captivedetect.js
-#endif
-@RESPATH@/components/servicesComponents.manifest
-@RESPATH@/components/cryptoComponents.manifest
-@RESPATH@/components/TelemetryStartup.js
-@RESPATH@/components/TelemetryStartup.manifest
-@RESPATH@/components/XULStore.js
-@RESPATH@/components/XULStore.manifest
-@RESPATH@/components/messageWakeupService.js
-@RESPATH@/components/messageWakeupService.manifest
-@RESPATH@/components/SettingsManager.js
-@RESPATH@/components/SettingsManager.manifest
-@RESPATH@/components/Webapps.js
-@RESPATH@/components/Webapps.manifest
-@RESPATH@/components/AppsService.js
-@RESPATH@/components/AppsService.manifest
-@RESPATH@/components/nsDOMIdentity.js
-@RESPATH@/components/nsIDService.js
-@RESPATH@/components/Identity.manifest
-@RESPATH@/components/recording-cmdline.js
-@RESPATH@/components/recording-cmdline.manifest
-@RESPATH@/components/htmlMenuBuilder.js
-@RESPATH@/components/htmlMenuBuilder.manifest
-
-@RESPATH@/components/RequestSync.manifest
-@RESPATH@/components/RequestSyncManager.js
-@RESPATH@/components/RequestSyncScheduler.js
-
-@RESPATH@/components/PermissionSettings.js
-@RESPATH@/components/PermissionSettings.manifest
-@RESPATH@/components/ContactManager.js
-@RESPATH@/components/ContactManager.manifest
-@RESPATH@/components/PhoneNumberService.js
-@RESPATH@/components/PhoneNumberService.manifest
-@RESPATH@/components/NotificationStorage.js
-@RESPATH@/components/NotificationStorage.manifest
-@RESPATH@/components/AlarmsManager.js
-@RESPATH@/components/AlarmsManager.manifest
-@RESPATH@/components/Push.js
-@RESPATH@/components/Push.manifest
-@RESPATH@/components/PushServiceLauncher.js
-
-@RESPATH@/components/SlowScriptDebug.manifest
-@RESPATH@/components/SlowScriptDebug.js
-
-#ifndef RELEASE_BUILD
-@RESPATH@/components/InterAppComm.manifest
-@RESPATH@/components/InterAppCommService.js
-@RESPATH@/components/InterAppConnection.js
-@RESPATH@/components/InterAppMessagePort.js
+#ifdef MOZ_ENABLE_PROFILER_SPS
#endif
-
-@RESPATH@/components/TCPSocket.js
-@RESPATH@/components/TCPServerSocket.js
-@RESPATH@/components/TCPSocketParentIntermediary.js
-@RESPATH@/components/TCPSocket.manifest
-
-#ifdef MOZ_ACTIVITIES
-@RESPATH@/components/SystemMessageCache.js
-@RESPATH@/components/SystemMessageInternal.js
-@RESPATH@/components/SystemMessageManager.js
-@RESPATH@/components/SystemMessageManager.manifest
-
-@RESPATH@/components/Activities.manifest
-@RESPATH@/components/ActivityProxy.js
-@RESPATH@/components/ActivityRequestHandler.js
-@RESPATH@/components/ActivityWrapper.js
-@RESPATH@/components/ActivityMessageConfigurator.js
+#ifdef ENABLE_INTL_API
#endif
-
-#ifdef MOZ_PAY
-@RESPATH@/components/Payment.js
-@RESPATH@/components/PaymentFlowInfo.js
-@RESPATH@/components/Payment.manifest
+#ifdef NECKO_WIFI
#endif
-
#ifdef MOZ_WEBRTC
-@RESPATH@/components/PeerConnection.js
-@RESPATH@/components/PeerConnection.manifest
+#endif
+#ifdef MOZ_ENABLE_PROFILER_SPS
+#endif
+#ifdef MOZ_ENABLE_XREMOTE
+#endif
+#ifdef XP_MACOSX
#endif
@RESPATH@/chrome/marionette@JAREXT@
@RESPATH@/chrome/marionette.manifest
-@RESPATH@/components/MarionetteComponents.manifest
-@RESPATH@/components/marionettecomponent.js
-
-#ifdef MOZ_WEBSPEECH
-@RESPATH@/components/dom_webspeechsynth.xpt
-#endif
-
-@RESPATH@/components/nsAsyncShutdown.manifest
-@RESPATH@/components/nsAsyncShutdown.js
-
-@RESPATH@/components/PresentationDeviceInfoManager.manifest
-@RESPATH@/components/PresentationDeviceInfoManager.js
-
-; InputMethod API
-@RESPATH@/components/MozKeyboard.js
-@RESPATH@/components/InputMethod.manifest
-
-#if defined(ENABLE_TESTS) && defined(MOZ_DEBUG)
-@RESPATH@/components/TestInterfaceJS.js
-@RESPATH@/components/TestInterfaceJS.manifest
-#endif
; Modules
@RESPATH@/browser/modules/*
@@ -658,15 +204,17 @@
#ifdef MOZ_D3DCOMPILER_VISTA_DLL
@BINPATH@/@MOZ_D3DCOMPILER_VISTA_DLL@
#endif
-
#endif # MOZ_ANGLE_RENDERER
; [Browser Chrome Files]
@RESPATH@/browser/chrome.manifest
@RESPATH@/browser/chrome/browser@JAREXT@
@RESPATH@/browser/chrome/browser.manifest
-@RESPATH@/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf
+#ifdef XP_WIN
+@RESPATH@/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/chrome.manifest
+#endif
@RESPATH@/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/icon.png
+@RESPATH@/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}/install.rdf
@RESPATH@/chrome/toolkit@JAREXT@
@RESPATH@/chrome/toolkit.manifest
@RESPATH@/chrome/recording.manifest
@@ -677,6 +225,16 @@
@RESPATH@/browser/chrome/icons/default/default48.png
#endif
+; [Webide Files]
+@RESPATH@/browser/chrome/webide@JAREXT@
+@RESPATH@/browser/chrome/webide.manifest
+@RESPATH@/browser/@PREF_DIR@/webide-prefs.js
+
+; DevTools
+@RESPATH@/browser/chrome/devtools@JAREXT@
+@RESPATH@/browser/chrome/devtools.manifest
+@RESPATH@/browser/@PREF_DIR@/devtools.js
+
; shell icons
#ifdef XP_UNIX
#ifndef XP_MACOSX
@@ -693,28 +251,16 @@
; All the pref files must be part of base to prevent migration bugs
@RESPATH@/browser/@PREF_DIR@/palemoon.js
@RESPATH@/browser/@PREF_DIR@/palemoon-branding.js
-@RESPATH@/goanna.js
-@RESPATH@/defaults/autoconfig/platform.js
+@RESPATH@/greprefs.js
@RESPATH@/defaults/autoconfig/prefcalls.js
-@RESPATH@/browser/defaults/profile/prefs.js
-#ifndef LIBXUL_SDK
; Warning: changing the path to channel-prefs.js can cause bugs (Bug 756325)
; Technically this is an app pref file, but we are keeping it in the original
; gre location for now.
@RESPATH@/defaults/pref/channel-prefs.js
-#else
-; For Fx-on-xr, channel-prefs lives with the app preferences. (Bug 762588)
-@RESPATH@/@PREF_DIR@/channel-prefs.js
-#endif
; Services (gre) prefs
-#ifdef MOZ_SERVICES_NOTIFICATIONS
-@RESPATH@/defaults/pref/services-notifications.js
-#endif
-#ifdef MOZ_SERVICES_SYNC
@RESPATH@/defaults/pref/services-sync.js
-#endif
; [Layout Engine Resources]
; Style Sheets, Graphics and other Resources used by the layout engine.
@@ -749,7 +295,7 @@
@RESPATH@/res/fonts/*
@RESPATH@/res/dtd/*
@RESPATH@/res/html/*
-#if defined(XP_MACOSX) || defined(XP_WIN)
+#if defined(XP_MACOSX)
; For SafariProfileMigrator.js.
@RESPATH@/res/langGroups.properties
#endif
@@ -761,15 +307,13 @@
; svg
@RESPATH@/res/svg.css
-@RESPATH@/components/dom_svg.xpt
-@RESPATH@/components/dom_smil.xpt
; [Personal Security Manager]
;
; NSS libraries are signed in the staging directory,
; meaning their .chk files are created there directly.
;
-#ifndef MOZ_NATIVE_NSS
+#ifndef MOZ_SYSTEM_NSS
#if defined(XP_LINUX) && !defined(ANDROID)
@BINPATH@/@DLL_PREFIX@freeblpriv3@DLL_SUFFIX@
#else
@@ -789,20 +333,22 @@
#endif
@RESPATH@/chrome/pippki@JAREXT@
@RESPATH@/chrome/pippki.manifest
-@RESPATH@/components/pipboot.xpt
-@RESPATH@/components/pipnss.xpt
-@RESPATH@/components/pippki.xpt
; For process sandboxing
#if defined(MOZ_SANDBOX)
#if defined(XP_WIN)
-@BINPATH@/@DLL_PREFIX@sandboxbroker@DLL_SUFFIX@
#if defined(WOW_HELPER)
@BINPATH@/wow_helper.exe
#endif
#endif
#endif
+#if defined(MOZ_SANDBOX)
+#if defined(XP_LINUX)
+@BINPATH@/@DLL_PREFIX@mozsandbox@DLL_SUFFIX@
+#endif
+#endif
+
; for Solaris SPARC
#ifdef SOLARIS
bin/libfreebl_32fpu_3.so
@@ -820,13 +366,7 @@ bin/libfreebl_32int64_3.so
#endif
#endif
-@RESPATH@/components/DataStore.manifest
-@RESPATH@/components/DataStoreImpl.js
-@RESPATH@/components/dom_datastore.xpt
-
; Shutdown Terminator
-@RESPATH@/components/nsTerminatorTelemetry.js
-@RESPATH@/components/terminator.manifest
#if defined(CLANG_CXX)
#if defined(MOZ_ASAN) || defined(MOZ_TSAN)
@@ -835,5 +375,5 @@ bin/libfreebl_32int64_3.so
#endif
#if defined(MOZ_ASAN) && defined(CLANG_CL)
-@BINPATH@/clang_rt.asan_dynamic-i386.dll
+@BINPATH@/clang_rt.asan_dynamic-*.dll
#endif
diff --git a/application/palemoon/installer/removed-files.in b/application/palemoon/installer/removed-files.in
index 8bfd72e4e9..8801d1cb01 100644
--- a/application/palemoon/installer/removed-files.in
+++ b/application/palemoon/installer/removed-files.in
@@ -65,29 +65,27 @@
# platforms.
# Common File Removals
+# This is located under the "distribution/" directory and it was added before
+# Firefox 27
+@DIR_MACOS@distribution/extensions/testpilot@labs.mozilla.com.xpi
-# Some users are ending up with unpacked chrome instead of omni.ja. This
-# causes updates to break badly, see bug 1063052. Removing the toplevel
-# chrome.manifest causes us to use the updated omni.ja.
-#ifndef MOZ_GTK
- @DIR_MACOS@chrome.manifest
- #ifdef XP_MACOSX
- @DIR_RESOURCES@chrome.manifest
- #endif
+# Mac OS X v2 signing removals
+#ifdef XP_MACOSX
+ @DIR_MACOS@active-update.xml
+ @DIR_MACOS@update-settings.ini
+ @DIR_MACOS@updates.xml
+ @DIR_MACOS@defaults/*
+ @DIR_MACOS@updates/*
#endif
# Common Directory removals
+@DIR_MACOS@chrome/
#ifdef XP_UNIX
#ifndef XP_MACOSX
chrome/icons/
chrome/icons/default/
#endif
#endif
-
-# Remove previously-bundled ruby/s4e extensions
-@DIR_MACOS@distribution/bundles/statusbar@palemoon.org/*
-@DIR_MACOS@distribution/bundles/{3ff46564-d77c-491c-bfc5-fc555c87dbc4}/*
-
@DIR_MACOS@chrome/overlayinfo/
@DIR_MACOS@components/
@DIR_MACOS@defaults/autoconfig/
@@ -114,4 +112,5 @@
@DIR_MACOS@plugins/MRJPlugin.plugin/*
Contents/Plug-Ins/PrintPDE.plugin/*
#endif
+@DIR_MACOS@searchplugins/*
@DIR_MACOS@webapprt/components/
diff --git a/application/palemoon/installer/windows/Makefile.in b/application/palemoon/installer/windows/Makefile.in
index 127456765e..8c434c54f8 100644
--- a/application/palemoon/installer/windows/Makefile.in
+++ b/application/palemoon/installer/windows/Makefile.in
@@ -5,9 +5,7 @@
include $(topsrcdir)/toolkit/mozapps/installer/package-name.mk
CONFIG_DIR = instgen
-SFX_MODULE = $(topsrcdir)/other-licenses/7zstub/firefox/7zSD.sfx
-APP_VERSION := $(shell cat $(srcdir)/../../config/version.txt)
-DEFINES += -DAPP_VERSION=$(APP_VERSION)
+SFX_MODULE = $(topsrcdir)/other-licenses/7zstub/palemoon/7zSD.sfx
INSTALLER_FILES = \
app.tag \
@@ -16,6 +14,12 @@ INSTALLER_FILES = \
nsis/shared.nsh \
$(NULL)
+ifdef MOZ_MAINTENANCE_SERVICE
+INSTALLER_FILES += \
+ nsis/maintenanceservice_installer.nsi \
+ $(NULL)
+endif
+
BRANDING_FILES = \
branding.nsi \
appname.bmp \
@@ -24,13 +28,6 @@ BRANDING_FILES = \
wizWatermark.bmp \
$(NULL)
-DEFINES += \
- -DAB_CD=$(AB_CD) \
- -DMOZ_APP_NAME=$(MOZ_APP_NAME) \
- -DMOZ_APP_DISPLAYNAME="${MOZ_APP_DISPLAYNAME}" \
- -DMOZILLA_VERSION=${MOZILLA_VERSION} \
- $(NULL)
-
include $(topsrcdir)/config/config.mk
ifdef LOCALE_MERGEDIR
@@ -61,6 +58,17 @@ uninstaller::
--preprocess-locale $(topsrcdir) \
$(PPL_LOCALE_ARGS) $(AB_CD) $(CONFIG_DIR)
+# For building the maintenanceservice installer
+ifdef MOZ_MAINTENANCE_SERVICE
+maintenanceservice_installer::
+ $(INSTALL) $(addprefix $(srcdir)/,$(INSTALLER_FILES)) $(CONFIG_DIR)
+ $(call py_action,preprocessor,-Fsubstitution $(DEFINES) $(ACDEFINES) \
+ $(srcdir)/nsis/defines.nsi.in -o $(CONFIG_DIR)/defines.nsi)
+ $(PYTHON) $(topsrcdir)/toolkit/mozapps/installer/windows/nsis/preprocess-locale.py \
+ --preprocess-locale $(topsrcdir) \
+ $(PPL_LOCALE_ARGS) $(AB_CD) $(CONFIG_DIR)
+endif
+
$(CONFIG_DIR)/setup.exe::
$(RM) -r $(CONFIG_DIR)
$(MKDIR) $(CONFIG_DIR)
diff --git a/application/palemoon/installer/windows/moz.build b/application/palemoon/installer/windows/moz.build
index 895d11993c..12e7831ed2 100644
--- a/application/palemoon/installer/windows/moz.build
+++ b/application/palemoon/installer/windows/moz.build
@@ -1,6 +1,11 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+DEFINES['APP_VERSION'] = CONFIG['MOZ_APP_VERSION']
+
+DEFINES['MOZ_APP_NAME'] = CONFIG['MOZ_APP_NAME']
+DEFINES['MOZ_APP_DISPLAYNAME'] = CONFIG['MOZ_APP_DISPLAYNAME']
+DEFINES['MOZILLA_VERSION'] = CONFIG['MOZILLA_VERSION']
diff --git a/application/palemoon/installer/windows/nsis/defines.nsi.in b/application/palemoon/installer/windows/nsis/defines.nsi.in
index ad171a5d6e..97422c4f66 100644
--- a/application/palemoon/installer/windows/nsis/defines.nsi.in
+++ b/application/palemoon/installer/windows/nsis/defines.nsi.in
@@ -3,6 +3,23 @@
# 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/.
+# Defining FunnelcakeVersion will append the value of StubURLVersionAppend to
+# StubURLVersion, append the value of URLManualDownloadAppend to
+# URLManualDownload, and append the value of URLStubDownloadAppend to
+# URLStubDownload. The value of FunnelcakeVersion should not be defined when it
+# is not used and when it is defined its value should never be empty.
+# !define FunnelcakeVersion "999"
+
+!ifdef FunnelcakeVersion
+!define URLManualDownloadAppend "&f=${FunnelcakeVersion}"
+!define URLStubDownloadAppend "-f${FunnelcakeVersion}"
+!define StubURLVersionAppend "-${FunnelcakeVersion}"
+!else
+!define URLManualDownloadAppend ""
+!define URLStubDownloadAppend ""
+!define StubURLVersionAppend ""
+!endif
+
# These defines should match application.ini settings
!define AppName "Pale Moon"
!define AppVersion "@APP_VERSION@"
@@ -14,13 +31,17 @@
!define DDEApplication "Pale Moon"
!define AppRegName "Pale Moon"
+!ifndef DEV_EDITION
!define BrandShortName "@MOZ_APP_DISPLAYNAME@"
+!endif
!define BrandFullName "${BrandFullNameInternal}"
-!define NO_UNINSTALL_SURVEY
-
-# !define CERTIFICATE_NAME "Mozilla Corporation"
-# !define CERTIFICATE_ISSUER "Thawte Code Signing CA - G2"
+!define CERTIFICATE_NAME "Mozilla Corporation"
+!define CERTIFICATE_ISSUER "DigiCert SHA2 Assured ID Code Signing CA"
+; Changing the name or issuer requires us to have both the old and the new
+; in the registry at the same time, temporarily.
+!define CERTIFICATE_NAME_PREVIOUS "Mozilla Corporation"
+!define CERTIFICATE_ISSUER_PREVIOUS "DigiCert Assured ID Code Signing CA-1"
# LSP_CATEGORIES is the permitted LSP categories for the application. Each LSP
# category value is ANDed together to set multiple permitted categories.
@@ -39,20 +60,26 @@
#ifdef HAVE_64BIT_BUILD
!define HAVE_64BIT_BUILD
!define ARCH "x64"
-!define MinSupportedVer "Microsoft Windows Vista x64"
+!define MinSupportedVer "Microsoft Windows 7 x64"
#else
!define ARCH "x86"
-!define MinSupportedVer "Microsoft Windows Vista"
+!define MinSupportedVer "Microsoft Windows 7"
+#endif
+
+!define MinSupportedCPU "SSE2"
+
+#ifdef MOZ_MAINTENANCE_SERVICE
+!define MOZ_MAINTENANCE_SERVICE
#endif
# File details shared by both the installer and uninstaller
VIProductVersion "1.0.0.0"
-VIAddVersionKey "ProductName" "Pale Moon"
-VIAddVersionKey "CompanyName" "Moonchild Productions"
+VIAddVersionKey "ProductName" "${BrandShortName}"
+VIAddVersionKey "CompanyName" "${CompanyName}"
#ifdef MOZ_OFFICIAL_BRANDING
-VIAddVersionKey "LegalTrademarks" "Pale Moon is the intellectual property of Moonchild Productions."
+VIAddVersionKey "LegalTrademarks" "${BrandShortName} is a Trademark of Moonchild Productions."
#endif
-VIAddVersionKey "LegalCopyright" "Moonchild Productions"
+VIAddVersionKey "LegalCopyright" "${CompanyName}"
VIAddVersionKey "FileVersion" "${AppVersion}"
VIAddVersionKey "ProductVersion" "${AppVersion}"
# Comments is not used but left below commented out for future reference
diff --git a/application/palemoon/installer/windows/nsis/installer.nsi b/application/palemoon/installer/windows/nsis/installer.nsi
index 147a56c9b8..276b94f742 100644
--- a/application/palemoon/installer/windows/nsis/installer.nsi
+++ b/application/palemoon/installer/windows/nsis/installer.nsi
@@ -5,7 +5,7 @@
# Required Plugins:
# AppAssocReg http://nsis.sourceforge.net/Application_Association_Registration_plug-in
# ApplicationID http://nsis.sourceforge.net/ApplicationID_plug-in
-# CityHash http://mxr.mozilla.org/mozilla-central/source/other-licenses/nsis/Contrib/CityHash
+# CityHash http://dxr.mozilla.org/mozilla-central/source/other-licenses/nsis/Contrib/CityHash
# ShellLink http://nsis.sourceforge.net/ShellLink_plug-in
# UAC http://nsis.sourceforge.net/UAC_plug-in
# ServicesHelper Mozilla specific plugin that is located in /other-licenses/nsis
@@ -21,15 +21,25 @@ CRCCheck on
RequestExecutionLevel user
+; The commands inside this ifdef require NSIS 3.0a2 or greater so the ifdef can
+; be removed after we require NSIS 3.0a2 or greater.
+!ifdef NSIS_PACKEDVERSION
+ Unicode true
+ ManifestSupportedOS all
+ ManifestDPIAware true
+!endif
+
!addplugindir ./
Var TmpVal
Var InstallType
Var AddStartMenuSC
+Var AddTaskbarSC
Var AddQuickLaunchSC
Var AddDesktopSC
Var InstallMaintenanceService
Var PageName
+Var PreventRebootRequired
; By defining NO_STARTMENU_DIR an installer that doesn't provide an option for
; an application's Start Menu PROGRAMS directory and doesn't define the
@@ -82,6 +92,7 @@ VIAddVersionKey "OriginalFilename" "setup.exe"
!insertmacro InitHashAppModelId
!insertmacro IsHandlerForInstallDir
!insertmacro IsPinnedToTaskBar
+!insertmacro IsUserAdmin
!insertmacro LogDesktopShortcut
!insertmacro LogQuickLaunchShortcut
!insertmacro LogStartMenuShortcut
@@ -90,6 +101,7 @@ VIAddVersionKey "OriginalFilename" "setup.exe"
!insertmacro RegCleanAppHandler
!insertmacro RegCleanMain
!insertmacro RegCleanUninstall
+!insertmacro RemovePrecompleteEntries
!insertmacro SetAppLSPCategories
!insertmacro SetBrandNameVars
!insertmacro UpdateShortcutAppModelIDs
@@ -153,6 +165,11 @@ Page custom preOptions leaveOptions
!define MUI_DIRECTORYPAGE_VERIFYONLEAVE
!insertmacro MUI_PAGE_DIRECTORY
+; Custom Components Page
+!ifdef MOZ_MAINTENANCE_SERVICE
+Page custom preComponents leaveComponents
+!endif
+
; Custom Shortcuts Page
Page custom preShortcuts leaveShortcuts
@@ -185,7 +202,42 @@ Section "-InstallStartCleanup"
SetOutPath "$INSTDIR"
${StartInstallLog} "${BrandFullName}" "${AB_CD}" "${AppVersion}" "${GREVersion}"
- ; Delete the app exe to prevent launching the app while we are installing.
+ StrCpy $R9 "true"
+ StrCpy $PreventRebootRequired "false"
+ ${GetParameters} $R8
+ ${GetOptions} "$R8" "/INI=" $R7
+ ${Unless} ${Errors}
+ ; The configuration file must also exist
+ ${If} ${FileExists} "$R7"
+ ReadINIStr $R9 $R7 "Install" "RemoveDistributionDir"
+ ReadINIStr $R8 $R7 "Install" "PreventRebootRequired"
+ ${If} $R8 == "true"
+ StrCpy $PreventRebootRequired "true"
+ ${EndIf}
+ ${EndIf}
+ ${EndUnless}
+
+ ; Remove directories and files we always control before parsing the uninstall
+ ; log so empty directories can be removed.
+ ${If} ${FileExists} "$INSTDIR\updates"
+ RmDir /r "$INSTDIR\updates"
+ ${EndIf}
+ ${If} ${FileExists} "$INSTDIR\updated"
+ RmDir /r "$INSTDIR\updated"
+ ${EndIf}
+ ${If} ${FileExists} "$INSTDIR\defaults\shortcuts"
+ RmDir /r "$INSTDIR\defaults\shortcuts"
+ ${EndIf}
+ ; Only remove the distribution directory if it exists and if the installer
+ ; isn't launched with an ini file that has RemoveDistributionDir=false in the
+ ; install section.
+ ${If} ${FileExists} "$INSTDIR\distribution"
+ ${AndIf} $R9 != "false"
+ RmDir /r "$INSTDIR\distribution"
+ ${EndIf}
+
+ ; Delete the app exe if present to prevent launching the app while we are
+ ; installing.
ClearErrors
${DeleteFile} "$INSTDIR\${FileMainEXE}"
${If} ${Errors}
@@ -201,9 +253,31 @@ Section "-InstallStartCleanup"
${InitHashAppModelId} "$INSTDIR" "Software\Mozilla\${AppName}\TaskBarIDs"
; Remove the updates directory for Vista and above
- ${CleanUpdateDirectories} "Mozilla\Firefox" "Mozilla\updates"
+ ${CleanUpdateDirectories} "Mozilla\Pale Moon" "Mozilla\updates"
${RemoveDeprecatedFiles}
+ ${RemovePrecompleteEntries} "false"
+
+ ${If} ${FileExists} "$INSTDIR\defaults\pref\channel-prefs.js"
+ Delete "$INSTDIR\defaults\pref\channel-prefs.js"
+ ${EndIf}
+ ${If} ${FileExists} "$INSTDIR\defaults\pref"
+ RmDir "$INSTDIR\defaults\pref"
+ ${EndIf}
+ ${If} ${FileExists} "$INSTDIR\defaults"
+ RmDir "$INSTDIR\defaults"
+ ${EndIf}
+ ${If} ${FileExists} "$INSTDIR\uninstall"
+ ; Remove the uninstall directory that we control
+ RmDir /r "$INSTDIR\uninstall"
+ ${EndIf}
+ ${If} ${FileExists} "$INSTDIR\update-settings.ini"
+ Delete "$INSTDIR\update-settings.ini"
+ ${EndIf}
+
+ ; Explictly remove empty webapprt dir in case it exists (bug 757978).
+ RmDir "$INSTDIR\webapprt\components"
+ RmDir "$INSTDIR\webapprt"
${InstallStartCleanupCommon}
SectionEnd
@@ -215,8 +289,6 @@ Section "-Application" APP_IDX
DetailPrint $(STATUS_INSTALL_APP)
SetDetailsPrint none
- RmDir /r /REBOOTOK "$INSTDIR\${TO_BE_DELETED}"
-
${LogHeader} "Installing Main Files"
${CopyFilesFromDir} "$EXEDIR\core" "$INSTDIR" \
"$(ERROR_CREATE_DIRECTORY_PREFIX)" \
@@ -237,18 +309,6 @@ Section "-Application" APP_IDX
${LogMsg} "Registered: $INSTDIR\AccessibleMarshal.dll"
${EndIf}
- ; Write extra files created by the application to the uninstall log so they
- ; will be removed when the application is uninstalled. To remove an empty
- ; directory write a bogus filename to the deepest directory and all empty
- ; parent directories will be removed.
- ${LogUninstall} "File: \components\compreg.dat"
- ${LogUninstall} "File: \components\xpti.dat"
- ${LogUninstall} "File: \active-update.xml"
- ${LogUninstall} "File: \install.log"
- ${LogUninstall} "File: \install_status.log"
- ${LogUninstall} "File: \install_wizard.log"
- ${LogUninstall} "File: \updates.xml"
-
ClearErrors
; Default for creating Start Menu shortcut
@@ -336,10 +396,12 @@ Section "-Application" APP_IDX
; If we are writing to HKLM and create either the desktop or start menu
; shortcuts set IconsVisible to 1 otherwise to 0.
+ ; Taskbar shortcuts imply having a start menu shortcut.
${StrFilter} "${FileMainEXE}" "+" "" "" $R9
StrCpy $0 "Software\Clients\StartMenuInternet\$R9\InstallInfo"
${If} $AddDesktopSC == 1
${OrIf} $AddStartMenuSC == 1
+ ${OrIf} $AddTaskbarSC == 1
WriteRegDWORD HKLM "$0" "IconsVisible" 1
${Else}
WriteRegDWORD HKLM "$0" "IconsVisible" 0
@@ -353,16 +415,53 @@ Section "-Application" APP_IDX
; If we create either the desktop or start menu shortcuts, then
; set IconsVisible to 1 otherwise to 0.
+ ; Taskbar shortcuts imply having a start menu shortcut.
${StrFilter} "${FileMainEXE}" "+" "" "" $R9
StrCpy $0 "Software\Clients\StartMenuInternet\$R9\InstallInfo"
${If} $AddDesktopSC == 1
${OrIf} $AddStartMenuSC == 1
+ ${OrIf} $AddTaskbarSC == 1
WriteRegDWORD HKCU "$0" "IconsVisible" 1
${Else}
WriteRegDWORD HKCU "$0" "IconsVisible" 0
${EndIf}
${EndIf}
+!ifdef MOZ_MAINTENANCE_SERVICE
+ ; If the maintenance service page was displayed then a value was already
+ ; explicitly selected for installing the maintenance service and
+ ; and so InstallMaintenanceService will already be 0 or 1.
+ ; If the maintenance service page was not displayed then
+ ; InstallMaintenanceService will be equal to "".
+ ${If} $InstallMaintenanceService == ""
+ Call IsUserAdmin
+ Pop $R0
+ ${If} $R0 == "true"
+ ; Only proceed if we have HKLM write access
+ ${AndIf} $TmpVal == "HKLM"
+ ; On Windows < XP SP3 we do not install the maintenance service.
+ ${If} ${IsWinXP}
+ ${AndIf} ${AtMostServicePack} 2
+ StrCpy $InstallMaintenanceService "0"
+ ${Else}
+ ; The user is an admin, so we should default to installing the service.
+ StrCpy $InstallMaintenanceService "1"
+ ${EndIf}
+ ${Else}
+ ; The user is not admin, so we can't install the service.
+ StrCpy $InstallMaintenanceService "0"
+ ${EndIf}
+ ${EndIf}
+
+ ${If} $InstallMaintenanceService == "1"
+ ; The user wants to install the maintenance service, so execute
+ ; the pre-packaged maintenance service installer.
+ ; This option can only be turned on if the user is an admin so there
+ ; is no need to use ExecShell w/ verb runas to enforce elevated.
+ nsExec::Exec "$\"$INSTDIR\maintenanceservice_installer.exe$\""
+ ${EndIf}
+!endif
+
; These need special handling on uninstall since they may be overwritten by
; an install into a different location.
StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\App Paths\${FileMainEXE}"
@@ -437,6 +536,13 @@ Section "-Application" APP_IDX
${EndIf}
${EndIf}
+ ; Update lastwritetime of the Start Menu shortcut to clear the tile cache.
+ ${If} ${AtLeastWin8}
+ ${AndIf} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk"
+ FileOpen $0 "$SMPROGRAMS\${BrandFullName}.lnk" a
+ FileClose $0
+ ${EndIf}
+
${If} $AddDesktopSC == 1
CreateShortCut "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}"
${If} ${FileExists} "$DESKTOP\${BrandFullName}.lnk"
@@ -472,6 +578,13 @@ Section "-Application" APP_IDX
${EndIf}
${EndUnless}
${EndIf}
+
+!ifdef MOZ_MAINTENANCE_SERVICE
+ ${If} $TmpVal == "HKLM"
+ ; Add the registry keys for allowed certificates.
+ ${AddMaintCertKeys}
+ ${EndIf}
+!endif
SectionEnd
; Cleanup operations to perform at the end of the installation.
@@ -481,8 +594,35 @@ Section "-InstallEndCleanup"
SetDetailsPrint none
${Unless} ${Silent}
+ ClearErrors
${MUI_INSTALLOPTIONS_READ} $0 "summary.ini" "Field 4" "State"
${If} "$0" == "1"
+ ; NB: this code is duplicated in stub.nsi. Please keep in sync.
+ ; For data migration in the app, we want to know what the default browser
+ ; value was before we changed it. To do so, we read it here and store it
+ ; in our own registry key.
+ StrCpy $0 ""
+ ${If} ${AtLeastWinVista}
+ AppAssocReg::QueryCurrentDefault "http" "protocol" "effective"
+ Pop $1
+ ; If the method hasn't failed, $1 will contain the progid. Check:
+ ${If} "$1" != "method failed"
+ ${AndIf} "$1" != "method not available"
+ ; Read the actual command from the progid
+ ReadRegStr $0 HKCR "$1\shell\open\command" ""
+ ${EndIf}
+ ${EndIf}
+ ; If using the App Association Registry didn't happen or failed, fall back
+ ; to the effective http default:
+ ${If} "$0" == ""
+ ReadRegStr $0 HKCR "http\shell\open\command" ""
+ ${EndIf}
+ ; If we have something other than empty string now, write the value.
+ ${If} "$0" != ""
+ ClearErrors
+ WriteRegStr HKCU "Software\Mozilla\Pale Moon" "OldDefaultBrowserCommand" "$0"
+ ${EndIf}
+
${LogHeader} "Setting as the default browser"
ClearErrors
${GetParameters} $0
@@ -493,46 +633,64 @@ Section "-InstallEndCleanup"
GetFunctionAddress $0 SetAsDefaultAppUserHKCU
UAC::ExecCodeSegment $0
${EndIf}
+ ${ElseIfNot} ${Errors}
+ ${LogHeader} "Writing default-browser opt-out"
+ ClearErrors
+ WriteRegStr HKCU "Software\Mozilla\Pale Moon" "DefaultBrowserOptOut" "True"
+ ${If} ${Errors}
+ ${LogMsg} "Error writing default-browser opt-out"
+ ${EndIf}
${EndIf}
- ; Adds a pinned Task Bar shortcut (see MigrateTaskBarShortcut for details).
- ${MigrateTaskBarShortcut}
${EndUnless}
- ${GetShortcutsLogPath} $0
- WriteIniStr "$0" "TASKBAR" "Migrated" "true"
+ ; Adds a pinned Task Bar shortcut (see MigrateTaskBarShortcut for details).
+ ${MigrateTaskBarShortcut}
+
+ ; Add the Firewall entries during install
+ Call AddFirewallEntries
; Refresh desktop icons
System::Call "shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i ${SHCNF_DWORDFLUSH}, i 0, i 0)"
${InstallEndCleanupCommon}
+ ${If} $PreventRebootRequired == "true"
+ SetRebootFlag false
+ ${EndIf}
+
${If} ${RebootFlag}
- ; When a reboot is required give SHChangeNotify time to finish the
- ; refreshing the icons so the OS doesn't display the icons from helper.exe
- Sleep 10000
- ${LogHeader} "Reboot Required To Finish Installation"
- ; ${FileMainEXE}.moz-upgrade should never exist but just in case...
- ${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}.moz-upgrade"
- Rename "$INSTDIR\${FileMainEXE}" "$INSTDIR\${FileMainEXE}.moz-upgrade"
- ${EndUnless}
+ ; Admin is required to delete files on reboot so only add the moz-delete if
+ ; the user is an admin. After calling UAC::IsAdmin $0 will equal 1 if the
+ ; user is an admin.
+ UAC::IsAdmin
+ ${If} "$0" == "1"
+ ; When a reboot is required give SHChangeNotify time to finish the
+ ; refreshing the icons so the OS doesn't display the icons from helper.exe
+ Sleep 10000
+ ${LogHeader} "Reboot Required To Finish Installation"
+ ; ${FileMainEXE}.moz-upgrade should never exist but just in case...
+ ${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}.moz-upgrade"
+ Rename "$INSTDIR\${FileMainEXE}" "$INSTDIR\${FileMainEXE}.moz-upgrade"
+ ${EndUnless}
- ${If} ${FileExists} "$INSTDIR\${FileMainEXE}"
- ClearErrors
- Rename "$INSTDIR\${FileMainEXE}" "$INSTDIR\${FileMainEXE}.moz-delete"
- ${Unless} ${Errors}
- Delete /REBOOTOK "$INSTDIR\${FileMainEXE}.moz-delete"
+ ${If} ${FileExists} "$INSTDIR\${FileMainEXE}"
+ ClearErrors
+ Rename "$INSTDIR\${FileMainEXE}" "$INSTDIR\${FileMainEXE}.moz-delete"
+ ${Unless} ${Errors}
+ Delete /REBOOTOK "$INSTDIR\${FileMainEXE}.moz-delete"
+ ${EndUnless}
+ ${EndIf}
+
+ ${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}"
+ CopyFiles /SILENT "$INSTDIR\uninstall\helper.exe" "$INSTDIR"
+ FileOpen $0 "$INSTDIR\${FileMainEXE}" w
+ FileWrite $0 "Will be deleted on restart"
+ Rename /REBOOTOK "$INSTDIR\${FileMainEXE}.moz-upgrade" "$INSTDIR\${FileMainEXE}"
+ FileClose $0
+ Delete "$INSTDIR\${FileMainEXE}"
+ Rename "$INSTDIR\helper.exe" "$INSTDIR\${FileMainEXE}"
${EndUnless}
${EndIf}
-
- ${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}"
- CopyFiles /SILENT "$INSTDIR\uninstall\helper.exe" "$INSTDIR"
- FileOpen $0 "$INSTDIR\${FileMainEXE}" w
- FileWrite $0 "Will be deleted on restart"
- Rename /REBOOTOK "$INSTDIR\${FileMainEXE}.moz-upgrade" "$INSTDIR\${FileMainEXE}"
- FileClose $0
- Delete "$INSTDIR\${FileMainEXE}"
- Rename "$INSTDIR\helper.exe" "$INSTDIR\${FileMainEXE}"
- ${EndUnless}
${EndIf}
SectionEnd
@@ -669,7 +827,9 @@ Function CheckExistingInstall
FunctionEnd
Function LaunchApp
+!ifndef DEV_EDITION
${ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_LAUNCH)"
+!endif
ClearErrors
${GetParameters} $0
@@ -776,9 +936,7 @@ Function leaveShortcuts
Abort
${EndIf}
${MUI_INSTALLOPTIONS_READ} $AddDesktopSC "shortcuts.ini" "Field 2" "State"
-
- ; If we have a Metro browser and are Win8, then we don't have a Field 3
- ${MUI_INSTALLOPTIONS_READ} $AddStartMenuSC "shortcuts.ini" "Field 3" "State"
+ ${MUI_INSTALLOPTIONS_READ} $AddStartMenuSC "shortcuts.ini" "Field 3" "State"
; Don't install the quick launch shortcut on Windows 7
${Unless} ${AtLeastWin7}
@@ -790,6 +948,59 @@ Function leaveShortcuts
${EndIf}
FunctionEnd
+!ifdef MOZ_MAINTENANCE_SERVICE
+Function preComponents
+ ; If the service already exists, don't show this page
+ ServicesHelper::IsInstalled "MozillaMaintenance"
+ Pop $R9
+ ${If} $R9 == 1
+ ; The service already exists so don't show this page.
+ Abort
+ ${EndIf}
+
+ ; On Windows < XP SP3 we do not install the maintenance service.
+ ${If} ${IsWinXP}
+ ${AndIf} ${AtMostServicePack} 2
+ Abort
+ ${EndIf}
+
+ ; Don't show the custom components page if the
+ ; user is not an admin
+ Call IsUserAdmin
+ Pop $R9
+ ${If} $R9 != "true"
+ Abort
+ ${EndIf}
+
+ ; Only show the maintenance service page if we have write access to HKLM
+ ClearErrors
+ WriteRegStr HKLM "Software\Mozilla" \
+ "${BrandShortName}InstallerTest" "Write Test"
+ ${If} ${Errors}
+ ClearErrors
+ Abort
+ ${Else}
+ DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest"
+ ${EndIf}
+
+ StrCpy $PageName "Components"
+ ${CheckCustomCommon}
+ !insertmacro MUI_HEADER_TEXT "$(COMPONENTS_PAGE_TITLE)" "$(COMPONENTS_PAGE_SUBTITLE)"
+ !insertmacro MUI_INSTALLOPTIONS_DISPLAY "components.ini"
+FunctionEnd
+
+Function leaveComponents
+ ${MUI_INSTALLOPTIONS_READ} $0 "components.ini" "Settings" "State"
+ ${If} $0 != 0
+ Abort
+ ${EndIf}
+ ${MUI_INSTALLOPTIONS_READ} $InstallMaintenanceService "components.ini" "Field 2" "State"
+ ${If} $InstallType == ${INSTALLTYPE_CUSTOM}
+ Call CheckExistingInstall
+ ${EndIf}
+FunctionEnd
+!endif
+
Function preSummary
StrCpy $PageName "Summary"
; Setup the summary.ini file for the Custom Summary Page
@@ -838,14 +1049,14 @@ Function preSummary
WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test"
${Unless} ${Errors}
DeleteRegValue HKLM "Software\Mozilla" "${BrandShortName}InstallerTest"
- ; Check if Firefox is the http handler for this user.
+ ; Check if Pale Moon is the http handler for this user.
SetShellVarContext current ; Set SHCTX to the current user
${IsHandlerForInstallDir} "http" $R9
${If} $TmpVal == "HKLM"
SetShellVarContext all ; Set SHCTX to all users
${EndIf}
- ; If Firefox isn't the http handler for this user show the option to set
- ; Firefox as the default browser.
+ ; If Pale Moon isn't the http handler for this user show the option to set
+ ; Pale Moon as the default browser.
${If} "$R9" != "true"
${AndIf} ${AtMostWin2008R2}
WriteINIStr "$PLUGINSDIR\summary.ini" "Settings" NumFields "4"
@@ -926,7 +1137,46 @@ Function .onInit
StrCpy $LANGUAGE 0
${SetBrandNameVars} "$EXEDIR\core\distribution\setup.ini"
- ${InstallOnInitCommon} "$(WARN_MIN_SUPPORTED_OS_MSG)"
+ ; Don't install on systems that don't support SSE2. The parameter value of
+ ; 10 is for PF_XMMI64_INSTRUCTIONS_AVAILABLE which will check whether the
+ ; SSE2 instruction set is available. Result returned in $R7.
+ System::Call "kernel32::IsProcessorFeaturePresent(i 10)i .R7"
+
+ ; Windows NT 6.0 and lower are not supported on any architecture.
+ ${Unless} ${AtLeastWin7}
+ ${If} "$R7" == "0"
+ strCpy $R7 "$(WARN_MIN_SUPPORTED_OSVER_CPU_MSG)"
+ ${Else}
+ strCpy $R7 "$(WARN_MIN_SUPPORTED_OSVER_MSG)"
+ ${EndIf}
+ MessageBox MB_OKCANCEL|MB_ICONSTOP "$R7" IDCANCEL +2
+ ExecShell "open" "${URLSystemRequirements}"
+ Quit
+ ${EndUnless}
+
+ ; SSE2 support
+ ${If} "$R7" == "0"
+ MessageBox MB_OKCANCEL|MB_ICONSTOP "$(WARN_MIN_SUPPORTED_CPU_MSG)" IDCANCEL +2
+ ExecShell "open" "${URLSystemRequirements}"
+ Quit
+ ${EndIf}
+
+!ifdef HAVE_64BIT_BUILD
+ ${Unless} ${RunningX64}
+ MessageBox MB_OKCANCEL|MB_ICONSTOP "$(WARN_MIN_SUPPORTED_OSVER_MSG)" IDCANCEL +2
+ ExecShell "open" "${URLSystemRequirements}"
+ Quit
+ ${EndUnless}
+ SetRegView 64
+!endif
+
+ ${InstallOnInitCommon} "$(WARN_MIN_SUPPORTED_OSVER_CPU_MSG)"
+
+; The commands inside this ifndef are needed prior to NSIS 3.0a2 and can be
+; removed after we require NSIS 3.0a2 or greater.
+!ifndef NSIS_PACKEDVERSION
+ System::Call 'user32::SetProcessDPIAware()'
+!endif
!insertmacro InitInstallOptionsFile "options.ini"
!insertmacro InitInstallOptionsFile "shortcuts.ini"
@@ -1016,6 +1266,25 @@ Function .onInit
WriteINIStr "$PLUGINSDIR\shortcuts.ini" "Field 4" State "1"
${EndUnless}
+ ; Setup the components.ini file for the Components Page
+ WriteINIStr "$PLUGINSDIR\components.ini" "Settings" NumFields "2"
+
+ WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Type "label"
+ WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Text "$(OPTIONAL_COMPONENTS_DESC)"
+ WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Left "0"
+ WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Right "-1"
+ WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Top "5"
+ WriteINIStr "$PLUGINSDIR\components.ini" "Field 1" Bottom "25"
+
+ WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Type "checkbox"
+ WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Text "$(MAINTENANCE_SERVICE_CHECKBOX_DESC)"
+ WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Left "0"
+ WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Right "-1"
+ WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Top "27"
+ WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Bottom "37"
+ WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" State "1"
+ WriteINIStr "$PLUGINSDIR\components.ini" "Field 2" Flags "GROUP"
+
; There must always be a core directory.
${GetSize} "$EXEDIR\core\" "/S=0K" $R5 $R7 $R8
SectionSetSize ${APP_IDX} $R5
diff --git a/application/palemoon/installer/windows/nsis/maintenanceservice_installer.nsi b/application/palemoon/installer/windows/nsis/maintenanceservice_installer.nsi
new file mode 100644
index 0000000000..1f73bac6a0
--- /dev/null
+++ b/application/palemoon/installer/windows/nsis/maintenanceservice_installer.nsi
@@ -0,0 +1,332 @@
+# 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/.
+
+; Set verbosity to 3 (e.g. no script) to lessen the noise in the build logs
+!verbose 3
+
+; 7-Zip provides better compression than the lzma from NSIS so we add the files
+; uncompressed and use 7-Zip to create a SFX archive of it
+SetDatablockOptimize on
+SetCompress off
+CRCCheck on
+
+RequestExecutionLevel admin
+
+; The commands inside this ifdef require NSIS 3.0a2 or greater so the ifdef can
+; be removed after we require NSIS 3.0a2 or greater.
+!ifdef NSIS_PACKEDVERSION
+ Unicode true
+ ManifestSupportedOS all
+ ManifestDPIAware true
+!endif
+
+!addplugindir ./
+
+; Variables
+Var TempMaintServiceName
+Var BrandFullNameDA
+Var BrandFullName
+
+; Other included files may depend upon these includes!
+; The following includes are provided by NSIS.
+!include FileFunc.nsh
+!include LogicLib.nsh
+!include MUI.nsh
+!include WinMessages.nsh
+!include WinVer.nsh
+!include WordFunc.nsh
+
+!insertmacro GetOptions
+!insertmacro GetParameters
+!insertmacro GetSize
+
+; The test slaves use this fallback key to run tests.
+; And anyone that wants to run tests themselves should already have
+; this installed.
+!define FallbackKey \
+ "SOFTWARE\Mozilla\MaintenanceService\3932ecacee736d366d6436db0f55bce4"
+
+!define CompanyName "Mozilla Corporation"
+!define BrandFullNameInternal ""
+
+; The following includes are custom.
+!include defines.nsi
+; We keep defines.nsi defined so that we get other things like
+; the version number, but we redefine BrandFullName
+!define MaintFullName "Mozilla Maintenance Service"
+!undef BrandFullName
+!define BrandFullName "${MaintFullName}"
+
+!include common.nsh
+!include locales.nsi
+
+VIAddVersionKey "FileDescription" "${MaintFullName} Installer"
+VIAddVersionKey "OriginalFilename" "maintenanceservice_installer.exe"
+
+Name "${MaintFullName}"
+OutFile "maintenanceservice_installer.exe"
+
+; Get installation folder from registry if available
+InstallDirRegKey HKLM "Software\Mozilla\MaintenanceService" ""
+
+SetOverwrite on
+
+; serviceinstall.cpp also uses this key, in case the path is changed, update
+; there too.
+!define MaintUninstallKey \
+ "Software\Microsoft\Windows\CurrentVersion\Uninstall\MozillaMaintenanceService"
+
+; Always install into the 32-bit location even if we have a 64-bit build.
+; This is because we use only 1 service for all Basilisk channels.
+; Allow either x86 and x64 builds to exist at this location, depending on
+; what is the latest build.
+InstallDir "$PROGRAMFILES32\${MaintFullName}\"
+ShowUnInstDetails nevershow
+
+################################################################################
+# Modern User Interface - MUI
+
+!define MUI_ICON setup.ico
+!define MUI_UNICON setup.ico
+!define MUI_WELCOMEPAGE_TITLE_3LINES
+!define MUI_UNWELCOMEFINISHPAGE_BITMAP wizWatermark.bmp
+
+;Interface Settings
+!define MUI_ABORTWARNING
+
+; Uninstaller Pages
+!insertmacro MUI_UNPAGE_CONFIRM
+!insertmacro MUI_UNPAGE_INSTFILES
+
+################################################################################
+# Language
+
+!insertmacro MOZ_MUI_LANGUAGE 'baseLocale'
+!verbose push
+!verbose 3
+!include "overrideLocale.nsh"
+!include "customLocale.nsh"
+!verbose pop
+
+; Set this after the locale files to override it if it is in the locale
+; using " " for BrandingText will hide the "Nullsoft Install System..." branding
+BrandingText " "
+
+Function .onInit
+ ; Remove the current exe directory from the search order.
+ ; This only effects LoadLibrary calls and not implicitly loaded DLLs.
+ System::Call 'kernel32::SetDllDirectoryW(w "")'
+
+ SetSilent silent
+
+ ${Unless} ${AtLeastWin7}
+ Abort
+ ${EndUnless}
+FunctionEnd
+
+Function un.onInit
+ ; Remove the current exe directory from the search order.
+ ; This only effects LoadLibrary calls and not implicitly loaded DLLs.
+ System::Call 'kernel32::SetDllDirectoryW(w "")'
+
+; The commands inside this ifndef are needed prior to NSIS 3.0a2 and can be
+; removed after we require NSIS 3.0a2 or greater.
+!ifndef NSIS_PACKEDVERSION
+ ${If} ${AtLeastWinVista}
+ System::Call 'user32::SetProcessDPIAware()'
+ ${EndIf}
+!endif
+
+ StrCpy $BrandFullNameDA "${MaintFullName}"
+ StrCpy $BrandFullName "${MaintFullName}"
+FunctionEnd
+
+Section "MaintenanceService"
+ AllowSkipFiles off
+
+ CreateDirectory $INSTDIR
+ SetOutPath $INSTDIR
+
+ ; If the service already exists, then it will be stopped when upgrading it
+ ; via the maintenanceservice_tmp.exe command executed below.
+ ; The maintenanceservice_tmp.exe command will rename the file to
+ ; maintenanceservice.exe if maintenanceservice_tmp.exe is newer.
+ ; If the service does not exist yet, we install it and drop the file on
+ ; disk as maintenanceservice.exe directly.
+ StrCpy $TempMaintServiceName "maintenanceservice.exe"
+ IfFileExists "$INSTDIR\maintenanceservice.exe" 0 skipAlreadyExists
+ StrCpy $TempMaintServiceName "maintenanceservice_tmp.exe"
+ skipAlreadyExists:
+
+ ; We always write out a copy and then decide whether to install it or
+ ; not via calling its 'install' cmdline which works by version comparison.
+ CopyFiles "$EXEDIR\maintenanceservice.exe" "$INSTDIR\$TempMaintServiceName"
+
+ ; The updater.ini file is only used when performing an install or upgrade,
+ ; and only if that install or upgrade is successful. If an old updater.ini
+ ; happened to be copied into the maintenance service installation directory
+ ; but the service was not newer, the updater.ini file would be unused.
+ ; It is used to fill the description of the service on success.
+ CopyFiles "$EXEDIR\updater.ini" "$INSTDIR\updater.ini"
+
+ ; Install the application maintenance service.
+ ; If a service already exists, the command line parameter will stop the
+ ; service and only install itself if it is newer than the already installed
+ ; service. If successful it will remove the old maintenanceservice.exe
+ ; and replace it with maintenanceservice_tmp.exe.
+ ClearErrors
+ ${GetParameters} $0
+ ${GetOptions} "$0" "/Upgrade" $0
+ ${If} ${Errors}
+ ExecWait '"$INSTDIR\$TempMaintServiceName" install'
+ ${Else}
+ ; The upgrade cmdline is the same as install except
+ ; It will fail if the service isn't already installed.
+ ExecWait '"$INSTDIR\$TempMaintServiceName" upgrade'
+ ${EndIf}
+
+ WriteUninstaller "$INSTDIR\Uninstall.exe"
+ WriteRegStr HKLM "${MaintUninstallKey}" "DisplayName" "${MaintFullName}"
+ WriteRegStr HKLM "${MaintUninstallKey}" "UninstallString" \
+ '"$INSTDIR\uninstall.exe"'
+ WriteRegStr HKLM "${MaintUninstallKey}" "DisplayIcon" \
+ "$INSTDIR\Uninstall.exe,0"
+ WriteRegStr HKLM "${MaintUninstallKey}" "DisplayVersion" "${AppVersion}"
+ WriteRegStr HKLM "${MaintUninstallKey}" "Publisher" "Mozilla"
+ WriteRegStr HKLM "${MaintUninstallKey}" "Comments" "${BrandFullName}"
+ WriteRegDWORD HKLM "${MaintUninstallKey}" "NoModify" 1
+ ${GetSize} "$INSTDIR" "/S=0K" $R2 $R3 $R4
+ WriteRegDWORD HKLM "${MaintUninstallKey}" "EstimatedSize" $R2
+
+ ; Write out that a maintenance service was attempted.
+ ; We do this because on upgrades we will check this value and we only
+ ; want to install once on the first upgrade to maintenance service.
+ ; Also write out that we are currently installed, preferences will check
+ ; this value to determine if we should show the service update pref.
+ ; Since the Maintenance service can be installed either x86 or x64,
+ ; always use the 64-bit registry for checking if an attempt was made.
+ ${If} ${RunningX64}
+ SetRegView 64
+ ${EndIf}
+ WriteRegDWORD HKLM "Software\Mozilla\MaintenanceService" "Attempted" 1
+ WriteRegDWORD HKLM "Software\Mozilla\MaintenanceService" "Installed" 1
+ DeleteRegValue HKLM "Software\Mozilla\MaintenanceService" "FFPrefetchDisabled"
+
+ ; Included here for debug purposes only.
+ ; These keys are used to bypass the installation dir is a valid installation
+ ; check from the service so that tests can be run.
+ ; WriteRegStr HKLM "${FallbackKey}\0" "name" "Mozilla Corporation"
+ ; WriteRegStr HKLM "${FallbackKey}\0" "issuer" "DigiCert SHA2 Assured ID Code Signing CA"
+ ${If} ${RunningX64}
+ SetRegView lastused
+ ${EndIf}
+SectionEnd
+
+; By renaming before deleting we improve things slightly in case
+; there is a file in use error. In this case a new install can happen.
+Function un.RenameDelete
+ Pop $9
+ ; If the .moz-delete file already exists previously, delete it
+ ; If it doesn't exist, the call is ignored.
+ ; We don't need to pass /REBOOTOK here since it was already marked that way
+ ; if it exists.
+ Delete "$9.moz-delete"
+ Rename "$9" "$9.moz-delete"
+ ${If} ${Errors}
+ Delete /REBOOTOK "$9"
+ ${Else}
+ Delete /REBOOTOK "$9.moz-delete"
+ ${EndIf}
+ ClearErrors
+FunctionEnd
+
+Section "Uninstall"
+ ; Delete the service so that no updates will be attempted
+ ExecWait '"$INSTDIR\maintenanceservice.exe" uninstall'
+
+ Push "$INSTDIR\updater.ini"
+ Call un.RenameDelete
+ Push "$INSTDIR\maintenanceservice.exe"
+ Call un.RenameDelete
+ Push "$INSTDIR\maintenanceservice_tmp.exe"
+ Call un.RenameDelete
+ Push "$INSTDIR\maintenanceservice.old"
+ Call un.RenameDelete
+ Push "$INSTDIR\Uninstall.exe"
+ Call un.RenameDelete
+ Push "$INSTDIR\update\updater.ini"
+ Call un.RenameDelete
+ Push "$INSTDIR\update\updater.exe"
+ Call un.RenameDelete
+ Push "$INSTDIR\logs\maintenanceservice.log"
+ Call un.RenameDelete
+ Push "$INSTDIR\logs\maintenanceservice-1.log"
+ Call un.RenameDelete
+ Push "$INSTDIR\logs\maintenanceservice-2.log"
+ Call un.RenameDelete
+ Push "$INSTDIR\logs\maintenanceservice-3.log"
+ Call un.RenameDelete
+ Push "$INSTDIR\logs\maintenanceservice-4.log"
+ Call un.RenameDelete
+ Push "$INSTDIR\logs\maintenanceservice-5.log"
+ Call un.RenameDelete
+ Push "$INSTDIR\logs\maintenanceservice-6.log"
+ Call un.RenameDelete
+ Push "$INSTDIR\logs\maintenanceservice-7.log"
+ Call un.RenameDelete
+ Push "$INSTDIR\logs\maintenanceservice-8.log"
+ Call un.RenameDelete
+ Push "$INSTDIR\logs\maintenanceservice-9.log"
+ Call un.RenameDelete
+ Push "$INSTDIR\logs\maintenanceservice-10.log"
+ Call un.RenameDelete
+ Push "$INSTDIR\logs\maintenanceservice-install.log"
+ Call un.RenameDelete
+ Push "$INSTDIR\logs\maintenanceservice-uninstall.log"
+ Call un.RenameDelete
+ SetShellVarContext all
+ Push "$APPDATA\Mozilla\logs\maintenanceservice.log"
+ Call un.RenameDelete
+ Push "$APPDATA\Mozilla\logs\maintenanceservice-1.log"
+ Call un.RenameDelete
+ Push "$APPDATA\Mozilla\logs\maintenanceservice-2.log"
+ Call un.RenameDelete
+ Push "$APPDATA\Mozilla\logs\maintenanceservice-3.log"
+ Call un.RenameDelete
+ Push "$APPDATA\Mozilla\logs\maintenanceservice-4.log"
+ Call un.RenameDelete
+ Push "$APPDATA\Mozilla\logs\maintenanceservice-5.log"
+ Call un.RenameDelete
+ Push "$APPDATA\Mozilla\logs\maintenanceservice-6.log"
+ Call un.RenameDelete
+ Push "$APPDATA\Mozilla\logs\maintenanceservice-7.log"
+ Call un.RenameDelete
+ Push "$APPDATA\Mozilla\logs\maintenanceservice-8.log"
+ Call un.RenameDelete
+ Push "$APPDATA\Mozilla\logs\maintenanceservice-9.log"
+ Call un.RenameDelete
+ Push "$APPDATA\Mozilla\logs\maintenanceservice-10.log"
+ Call un.RenameDelete
+ Push "$APPDATA\Mozilla\logs\maintenanceservice-install.log"
+ Call un.RenameDelete
+ Push "$APPDATA\Mozilla\logs\maintenanceservice-uninstall.log"
+ Call un.RenameDelete
+ RMDir /REBOOTOK "$APPDATA\Mozilla\logs"
+ RMDir /REBOOTOK "$APPDATA\Mozilla"
+ RMDir /REBOOTOK "$INSTDIR\logs"
+ RMDir /REBOOTOK "$INSTDIR\update"
+ RMDir /REBOOTOK "$INSTDIR"
+
+ DeleteRegKey HKLM "${MaintUninstallKey}"
+
+ ${If} ${RunningX64}
+ SetRegView 64
+ ${EndIf}
+ DeleteRegValue HKLM "Software\Mozilla\MaintenanceService" "Installed"
+ DeleteRegValue HKLM "Software\Mozilla\MaintenanceService" "FFPrefetchDisabled"
+ DeleteRegKey HKLM "${FallbackKey}\"
+ ${If} ${RunningX64}
+ SetRegView lastused
+ ${EndIf}
+SectionEnd
diff --git a/application/palemoon/installer/windows/nsis/shared.nsh b/application/palemoon/installer/windows/nsis/shared.nsh
index 9770d4733f..294e3e6fca 100644
--- a/application/palemoon/installer/windows/nsis/shared.nsh
+++ b/application/palemoon/installer/windows/nsis/shared.nsh
@@ -2,12 +2,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-; The registration ID of the COM server which is used for choosing wether
-; to launch the Win8 metro browser or desktop browser.
-!define DELEGATE_EXECUTE_HANDLER_ID {5100FEC1-212B-4BF5-9BF8-3E650FD794A3}
-
!macro PostUpdate
-
; PostUpdate is called from both session 0 and from the user session
; for service updates, make sure that we only register with the user session
; Otherwise ApplicationID::Set can fail intermittently with a file in use error.
@@ -15,7 +10,7 @@
System::Call "kernel32::ProcessIdToSessionId(i $0, *i ${NSIS_MAX_STRLEN} r9)"
; Determine if we're the protected UserChoice default or not. If so fix the
- ; start menu tile. In case there are 2 Pale Moon installations, we only do
+ ; start menu tile. In case there are 2 PaleMoon installations, we only do
; this if the application being updated is the default.
ReadRegStr $0 HKCU "Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice" "ProgId"
${If} $0 == "PaleMoonURL"
@@ -61,6 +56,9 @@
; Win7 taskbar and start menu link maintenance
Call FixShortcutAppModelIDs
+ ; Add the Firewall entries after an update
+ Call AddFirewallEntries
+
; Only update the Clients\StartMenuInternet registry key values in HKLM if
; they don't exist or this installation is the same as the one set in those
; keys.
@@ -100,6 +98,13 @@
; root of the Start Menu Programs directory.
${MigrateStartMenuShortcut}
+ ; Update lastwritetime of the Start Menu shortcut to clear the tile cache.
+ ${If} ${AtLeastWin8}
+ ${AndIf} ${FileExists} "$SMPROGRAMS\${BrandFullName}.lnk"
+ FileOpen $0 "$SMPROGRAMS\${BrandFullName}.lnk" a
+ FileClose $0
+ ${EndIf}
+
; Adds a pinned Task Bar shortcut (see MigrateTaskBarShortcut for details).
${MigrateTaskBarShortcut}
@@ -120,6 +125,50 @@
RmDir /r /REBOOTOK "$INSTDIR\${TO_BE_DELETED}"
+!ifdef MOZ_MAINTENANCE_SERVICE
+ Call IsUserAdmin
+ Pop $R0
+ ${If} $R0 == "true"
+ ; Only proceed if we have HKLM write access
+ ${AndIf} $TmpVal == "HKLM"
+ ; On Windows 2000 we do not install the maintenance service.
+ ${AndIf} ${AtLeastWinXP}
+ ; We check to see if the maintenance service install was already attempted.
+ ; Since the Maintenance service can be installed either x86 or x64,
+ ; always use the 64-bit registry for checking if an attempt was made.
+ ${If} ${RunningX64}
+ SetRegView 64
+ ${EndIf}
+ ReadRegDWORD $5 HKLM "Software\Mozilla\MaintenanceService" "Attempted"
+ ClearErrors
+ ${If} ${RunningX64}
+ SetRegView lastused
+ ${EndIf}
+
+ ; Add the registry keys for allowed certificates.
+ ${AddMaintCertKeys}
+
+ ; If the maintenance service is already installed, do nothing.
+ ; The maintenance service will launch:
+ ; maintenanceservice_installer.exe /Upgrade to upgrade the maintenance
+ ; service if necessary. If the update was done from updater.exe without
+ ; the service (i.e. service is failing), updater.exe will do the update of
+ ; the service. The reasons we do not do it here is because we don't want
+ ; to have to prompt for limited user accounts when the service isn't used
+ ; and we currently call the PostUpdate twice, once for the user and once
+ ; for the SYSTEM account. Also, this would stop the maintenance service
+ ; and we need a return result back to the service when run that way.
+ ${If} $5 == ""
+ ; An install of maintenance service was never attempted.
+ ; We know we are an Admin and that we have write access into HKLM
+ ; based on the above checks, so attempt to just run the EXE.
+ ; In the worst case, in case there is some edge case with the
+ ; IsAdmin check and the permissions check, the maintenance service
+ ; will just fail to be attempted to be installed.
+ nsExec::Exec "$\"$INSTDIR\maintenanceservice_installer.exe$\""
+ ${EndIf}
+ ${EndIf}
+!endif
!macroend
!define PostUpdate "!insertmacro PostUpdate"
@@ -280,11 +329,11 @@
${If} ${Errors}
WriteRegStr SHCTX "SOFTWARE\Classes\${FILE_TYPE}" "" "PaleMoonHTML"
${EndIf}
+ WriteRegStr SHCTX "SOFTWARE\Classes\${FILE_TYPE}\OpenWithProgids" "PaleMoonHTML" ""
!macroend
!define AddAssociationIfNoneExist "!insertmacro AddAssociationIfNoneExist"
-
-; Adds the protocol and file handler registry entries for making Pale Moon the
+; Adds the protocol and file handler registry entries for making PaleMoon the
; default handler (uses SHCTX).
!macro SetHandlers
${GetLongPath} "$INSTDIR\${FileMainEXE}" $8
@@ -318,10 +367,11 @@
WriteRegStr SHCTX "$0\.xhtml" "" "PaleMoonHTML"
${EndIf}
- ;Register file associations, but only if they don't exist yet.
+ ${AddAssociationIfNoneExist} ".pdf"
${AddAssociationIfNoneExist} ".oga"
${AddAssociationIfNoneExist} ".ogg"
${AddAssociationIfNoneExist} ".ogv"
+ ${AddAssociationIfNoneExist} ".pdf"
${AddAssociationIfNoneExist} ".webm"
; An empty string is used for the 5th param because PaleMoonHTML is not a
@@ -331,7 +381,6 @@
${AddDisabledDDEHandlerValues} "PaleMoonURL" "$2" "$8,1" "${AppRegName} URL" \
"true"
-
; An empty string is used for the 4th & 5th params because the following
; protocol handlers already have a display name and the additional keys
; required for a protocol handler.
@@ -341,7 +390,7 @@
!macroend
!define SetHandlers "!insertmacro SetHandlers"
-; Adds the HKLM\Software\Clients\StartMenuInternet\{EXE} registry
+; Adds the HKLM\Software\Clients\StartMenuInternet\PALEMOON.EXE registry
; entries (does not use SHCTX).
;
; The values for StartMenuInternet are only valid under HKLM and there can only
@@ -420,7 +469,7 @@
; The IconHandler reference for PaleMoonHTML can end up in an inconsistent state
; due to changes not being detected by the IconHandler for side by side
; installs (see bug 268512). The symptoms can be either an incorrect icon or no
-; icon being displayed for files associated with Pale Moon (does not use SHCTX).
+; icon being displayed for files associated with PaleMoon (does not use SHCTX).
!macro FixShellIconHandler RegKey
ClearErrors
ReadRegStr $1 ${RegKey} "Software\Classes\PaleMoonHTML\ShellEx\IconHandler" ""
@@ -436,37 +485,67 @@
; Add Software\Mozilla\ registry entries (uses SHCTX).
!macro SetAppKeys
+ ; Check if this is an ESR release and if so add registry values so it is
+ ; possible to determine that this is an ESR install (bug 726781).
+ ClearErrors
+ ${WordFind} "${UpdateChannel}" "esr" "E#" $3
+ ${If} ${Errors}
+ StrCpy $3 ""
+ ${Else}
+ StrCpy $3 " ESR"
+ ${EndIf}
+
${GetLongPath} "$INSTDIR" $8
- StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion} (${AB_CD})\Main"
+ StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion}$3 (${ARCH} ${AB_CD})\Main"
${WriteRegStr2} $TmpVal "$0" "Install Directory" "$8" 0
${WriteRegStr2} $TmpVal "$0" "PathToExe" "$8\${FileMainEXE}" 0
- StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion} (${AB_CD})\Uninstall"
- ${WriteRegStr2} $TmpVal "$0" "Description" "${BrandFullNameInternal} (${ARCH} ${AB_CD})" 0
+ StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion}$3 (${ARCH} ${AB_CD})\Uninstall"
+ ${WriteRegStr2} $TmpVal "$0" "Description" "${BrandFullNameInternal} ${AppVersion}$3 (${ARCH} ${AB_CD})" 0
- StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion} (${AB_CD})"
- ${WriteRegStr2} $TmpVal "$0" "" "${AppVersion} (${AB_CD})" 0
+ StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}\${AppVersion}$3 (${ARCH} ${AB_CD})"
+ ${WriteRegStr2} $TmpVal "$0" "" "${AppVersion}$3 (${ARCH} ${AB_CD})" 0
+ ${If} "$3" == ""
+ DeleteRegValue SHCTX "$0" "ESR"
+ ${Else}
+ ${WriteRegDWORD2} $TmpVal "$0" "ESR" 1 0
+ ${EndIf}
- StrCpy $0 "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}\bin"
+ StrCpy $0 "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}$3\bin"
${WriteRegStr2} $TmpVal "$0" "PathToExe" "$8\${FileMainEXE}" 0
- StrCpy $0 "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}\extensions"
+ StrCpy $0 "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}$3\extensions"
${WriteRegStr2} $TmpVal "$0" "Components" "$8\components" 0
${WriteRegStr2} $TmpVal "$0" "Plugins" "$8\plugins" 0
- StrCpy $0 "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}"
- ${WriteRegStr2} $TmpVal "$0" "GoannaVer" "${GREVersion}" 0
+ StrCpy $0 "Software\Mozilla\${BrandFullNameInternal} ${AppVersion}$3"
+ ${WriteRegStr2} $TmpVal "$0" "GeckoVer" "${GREVersion}" 0
+ ${If} "$3" == ""
+ DeleteRegValue SHCTX "$0" "ESR"
+ ${Else}
+ ${WriteRegDWORD2} $TmpVal "$0" "ESR" 1 0
+ ${EndIf}
- StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}"
+ StrCpy $0 "Software\Mozilla\${BrandFullNameInternal}$3"
${WriteRegStr2} $TmpVal "$0" "" "${GREVersion}" 0
- ${WriteRegStr2} $TmpVal "$0" "CurrentVersion" "${AppVersion} (${AB_CD})" 0
+ ${WriteRegStr2} $TmpVal "$0" "CurrentVersion" "${AppVersion}$3 (${ARCH} ${AB_CD})" 0
!macroend
!define SetAppKeys "!insertmacro SetAppKeys"
; Add uninstall registry entries. This macro tests for write access to determine
; if the uninstall keys should be added to HKLM or HKCU.
!macro SetUninstallKeys
- StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\Uninstall\${BrandFullNameInternal} (${ARCH} ${AB_CD})"
+ ; Check if this is an ESR release and if so add registry values so it is
+ ; possible to determine that this is an ESR install (bug 726781).
+ ClearErrors
+ ${WordFind} "${UpdateChannel}" "esr" "E#" $3
+ ${If} ${Errors}
+ StrCpy $3 ""
+ ${Else}
+ StrCpy $3 " ESR"
+ ${EndIf}
+
+ StrCpy $0 "Software\Microsoft\Windows\CurrentVersion\Uninstall\${BrandFullNameInternal} ${AppVersion}$3 (${ARCH} ${AB_CD})"
StrCpy $2 ""
ClearErrors
@@ -493,15 +572,24 @@
${GetLongPath} "$INSTDIR" $8
; Write the uninstall registry keys
- ${WriteRegStr2} $1 "$0" "Comments" "${BrandFullNameInternal} (${ARCH} ${AB_CD})" 0
+ ${WriteRegStr2} $1 "$0" "Comments" "${BrandFullNameInternal} ${AppVersion}$3 (${ARCH} ${AB_CD})" 0
${WriteRegStr2} $1 "$0" "DisplayIcon" "$8\${FileMainEXE},0" 0
- ${WriteRegStr2} $1 "$0" "DisplayName" "${BrandFullNameInternal} (${ARCH} ${AB_CD})" 0
+ ${WriteRegStr2} $1 "$0" "DisplayName" "${BrandFullNameInternal} ${AppVersion}$3 (${ARCH} ${AB_CD})" 0
${WriteRegStr2} $1 "$0" "DisplayVersion" "${AppVersion}" 0
+ ${WriteRegStr2} $1 "$0" "HelpLink" "${HelpLink}" 0
${WriteRegStr2} $1 "$0" "InstallLocation" "$8" 0
${WriteRegStr2} $1 "$0" "Publisher" "Moonchild Productions" 0
${WriteRegStr2} $1 "$0" "UninstallString" "$\"$8\uninstall\helper.exe$\"" 0
- ${WriteRegStr2} $1 "$0" "URLInfoAbout" "${URLInfoAbout}" 0
+ DeleteRegValue SHCTX "$0" "URLInfoAbout"
+; Don't add URLUpdateInfo which is the release notes url except for the release
+; and esr channels since nightly, aurora, and beta do not have release notes.
+; Note: URLUpdateInfo is only defined in the official branding.nsi.
+!ifdef URLUpdateInfo
+!ifndef BETA_UPDATE_CHANNEL
${WriteRegStr2} $1 "$0" "URLUpdateInfo" "${URLUpdateInfo}" 0
+!endif
+!endif
+ ${WriteRegStr2} $1 "$0" "URLInfoAbout" "${URLInfoAbout}" 0
${WriteRegDWORD2} $1 "$0" "NoModify" 1 0
${WriteRegDWORD2} $1 "$0" "NoRepair" 1 0
@@ -518,7 +606,7 @@
!define SetUninstallKeys "!insertmacro SetUninstallKeys"
; Due to a bug when associating some file handlers, only SHCTX was checked for
-; some file types such as ".webm". SHCTX is set to HKCU or HKLM depending on
+; some file types such as ".pdf". SHCTX is set to HKCU or HKLM depending on
; whether the installer has write access to HKLM. The bug would happen when
; HCKU was checked and didn't exist since programs aren't required to set the
; HKCU Software\Classes keys when associating handlers. The fix uses the merged
@@ -534,7 +622,7 @@
ReadRegStr $2 HKCR "${FILE_TYPE}\PersistentHandler" ""
${If} "$2" != ""
; Since there is a persistent handler remove PaleMoonHTML as the default
- ; value from both HKCU and HKLM if it is set to PaleMoonHTML.
+ ; value from both HKCU and HKLM if it set to PaleMoonHTML.
${If} "$0" == "PaleMoonHTML"
DeleteRegValue HKCU "Software\Classes\${FILE_TYPE}" ""
${EndIf}
@@ -542,7 +630,7 @@
DeleteRegValue HKLM "Software\Classes\${FILE_TYPE}" ""
${EndIf}
${ElseIf} "$0" == "PaleMoonHTML"
- ; Since KHCU is set to PaleMoonHTML, remove it as the default value
+ ; Since KHCU is set to PaleMoonHTML remove PaleMoonHTML as the default value
; from HKCU if HKLM is set to a value other than an empty string.
${If} "$1" != ""
DeleteRegValue HKCU "Software\Classes\${FILE_TYPE}" ""
@@ -630,6 +718,54 @@
!macroend
!define UpdateProtocolHandlers "!insertmacro UpdateProtocolHandlers"
+!ifdef MOZ_MAINTENANCE_SERVICE
+; Adds maintenance service certificate keys for the install dir.
+; For the cert to work, it must also be signed by a trusted cert for the user.
+!macro AddMaintCertKeys
+ Push $R0
+ ; Allow main Mozilla cert information for updates
+ ; This call will push the needed key on the stack
+ ServicesHelper::PathToUniqueRegistryPath "$INSTDIR"
+ Pop $R0
+ ${If} $R0 != ""
+ ; More than one certificate can be specified in a different subfolder
+ ; for example: $R0\1, but each individual binary can be signed
+ ; with at most one certificate. A fallback certificate can only be used
+ ; if the binary is replaced with a different certificate.
+ ; We always use the 64bit registry for certs.
+ ${If} ${RunningX64}
+ SetRegView 64
+ ${EndIf}
+
+ ; PrefetchProcessName was originally used to experiment with deleting
+ ; Windows prefetch as a speed optimization. It is no longer used though.
+ DeleteRegValue HKLM "$R0" "prefetchProcessName"
+
+ ; Setting the Attempted value will ensure that a new Maintenance Service
+ ; install will never be attempted again after this from updates. The value
+ ; is used only to see if updates should attempt new service installs.
+ WriteRegDWORD HKLM "Software\Mozilla\MaintenanceService" "Attempted" 1
+
+ ; These values associate the allowed certificates for the current
+ ; installation.
+ WriteRegStr HKLM "$R0\0" "name" "${CERTIFICATE_NAME}"
+ WriteRegStr HKLM "$R0\0" "issuer" "${CERTIFICATE_ISSUER}"
+ ; These values associate the allowed certificates for the previous
+ ; installation, so that we can update from it cleanly using the
+ ; old updater.exe (which will still have this signature).
+ WriteRegStr HKLM "$R0\1" "name" "${CERTIFICATE_NAME_PREVIOUS}"
+ WriteRegStr HKLM "$R0\1" "issuer" "${CERTIFICATE_ISSUER_PREVIOUS}"
+ ${If} ${RunningX64}
+ SetRegView lastused
+ ${EndIf}
+ ClearErrors
+ ${EndIf}
+ ; Restore the previously used value back
+ Pop $R0
+!macroend
+!define AddMaintCertKeys "!insertmacro AddMaintCertKeys"
+!endif
+
; Removes various registry entries for reasons noted below (does not use SHCTX).
!macro RemoveDeprecatedKeys
StrCpy $0 "SOFTWARE\Classes"
@@ -641,10 +777,9 @@
; update if the DefaultIcon is from palemoon.exe (Bug 301073).
${RegCleanAppHandler} "chrome"
- ; Remove the app compatibility registry key
- StrCpy $0 "Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers"
- DeleteRegValue HKLM "$0" "$INSTDIR\${FileMainEXE}"
- DeleteRegValue HKCU "$0" "$INSTDIR\${FileMainEXE}"
+ ; Remove protocol handler registry keys added by the MS shim
+ DeleteRegKey HKLM "Software\Classes\PaleMoon.URL"
+ DeleteRegKey HKCU "Software\Classes\PaleMoon.URL"
; Delete gopher from Capabilities\URLAssociations if it is present.
${StrFilter} "${FileMainEXE}" "+" "" "" $R9
@@ -671,147 +806,21 @@
RmDir /r /REBOOTOK "$INSTDIR\extensions\talkback@mozilla.org"
${EndIf}
- ; Remove the Java Console extension (bug 597235)
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0012-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0012-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0013-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0013-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0014-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0014-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0015-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0015-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0016-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0016-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0017-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0017-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0018-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0018-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0019-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0019-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0020-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0020-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0021-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0021-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0022-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0015-0000-0022-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0000-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0000-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0001-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0001-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0002-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0002-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0003-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0003-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0004-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0004-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0005-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0005-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0006-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0006-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0007-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0007-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0010-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0010-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0011-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0011-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0012-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0012-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0013-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0013-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0014-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0014-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0015-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0015-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0016-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0016-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0017-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0017-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0018-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0018-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0019-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0019-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0020-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0020-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0021-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0021-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0022-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0022-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0023-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0023-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0024-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0024-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0025-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0025-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0026-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0026-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0027-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0027-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0028-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0028-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0029-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0029-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0030-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0030-ABCDEFFEDCBA}"
- ${EndIf}
+ ; Remove the Java Console extension (bug 1165156)
${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0031-ABCDEFFEDCBA}"
RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0031-ABCDEFFEDCBA}"
${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0032-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0032-ABCDEFFEDCBA}"
+ ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0034-ABCDEFFEDCBA}"
+ RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0034-ABCDEFFEDCBA}"
${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0000-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0000-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0001-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0001-ABCDEFFEDCBA}"
- ${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0002-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0002-ABCDEFFEDCBA}"
+ ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0039-ABCDEFFEDCBA}"
+ RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0039-ABCDEFFEDCBA}"
${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0003-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0003-ABCDEFFEDCBA}"
+ ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0045-ABCDEFFEDCBA}"
+ RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0016-0000-0045-ABCDEFFEDCBA}"
${EndIf}
- ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0004-ABCDEFFEDCBA}"
- RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0004-ABCDEFFEDCBA}"
+ ${If} ${FileExists} "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0000-ABCDEFFEDCBA}"
+ RmDir /r /REBOOTOK "$INSTDIR\extensions\{CAFEEFAC-0017-0000-0000-ABCDEFFEDCBA}"
${EndIf}
!macroend
!define RemoveDeprecatedFiles "!insertmacro RemoveDeprecatedFiles"
@@ -876,15 +885,15 @@
${If} $5 == ""
${Break}
${EndIf}
- ${If} $5 == 233 ; ansi ??
+ ${If} $5 == 233 ; ansi é
StrCpy $0 "1"
FileWriteByte $4 195
FileWriteByte $4 169
- ${ElseIf} $5 == 241 ; ansi ??
+ ${ElseIf} $5 == 241 ; ansi ñ
StrCpy $0 "1"
FileWriteByte $4 195
FileWriteByte $4 177
- ${ElseIf} $5 == 252 ; ansi ??
+ ${ElseIf} $5 == 252 ; ansi ü
StrCpy $0 "1"
FileWriteByte $4 195
FileWriteByte $4 188
@@ -926,17 +935,24 @@
ClearErrors
WriteIniStr "$0" "TASKBAR" "Migrated" "true"
${If} ${AtLeastWin7}
- ; No need to check the default on Win8 and later
- ${If} ${AtMostWin2008R2}
- ; Check if Pale Moon is the http handler for this user
- SetShellVarContext current ; Set SHCTX to the current user
- ${IsHandlerForInstallDir} "http" $R9
- ${If} $TmpVal == "HKLM"
- SetShellVarContext all ; Set SHCTX to all users
+ ; If we didn't run the stub installer, AddTaskbarSC will be empty.
+ ; We determine whether to pin based on whether we're the default
+ ; browser, or if we're on win8 or later, we always pin.
+ ${If} $AddTaskbarSC == ""
+ ; No need to check the default on Win8 and later
+ ${If} ${AtMostWin2008R2}
+ ; Check if the PaleMoon is the http handler for this user
+ SetShellVarContext current ; Set SHCTX to the current user
+ ${IsHandlerForInstallDir} "http" $R9
+ ${If} $TmpVal == "HKLM"
+ SetShellVarContext all ; Set SHCTX to all users
+ ${EndIf}
${EndIf}
- ${EndIf}
- ${If} "$R9" == "true"
- ${OrIf} ${AtLeastWin8}
+ ${If} "$R9" == "true"
+ ${OrIf} ${AtLeastWin8}
+ ${PinToTaskBar}
+ ${EndIf}
+ ${ElseIf} $AddTaskbarSC == "1"
${PinToTaskBar}
${EndIf}
${EndIf}
@@ -1152,17 +1168,86 @@
; returns after the first check.
Push "end"
Push "AccessibleMarshal.dll"
+ Push "IA2Marshal.dll"
Push "freebl3.dll"
Push "nssckbi.dll"
Push "nspr4.dll"
Push "nssdbm3.dll"
Push "mozsqlite3.dll"
Push "xpcom.dll"
+ Push "crashreporter.exe"
+ Push "minidump-analyzer.exe"
Push "updater.exe"
Push "${FileMainEXE}"
!macroend
!define PushFilesToCheck "!insertmacro PushFilesToCheck"
+
+; Pushes the string "true" to the top of the stack if the Firewall service is
+; running and pushes the string "false" to the top of the stack if it isn't.
+!define SC_MANAGER_ALL_ACCESS 0x3F
+!define SERVICE_QUERY_CONFIG 0x0001
+!define SERVICE_QUERY_STATUS 0x0004
+!define SERVICE_RUNNING 0x4
+
+!macro IsFirewallSvcRunning
+ Push $R9
+ Push $R8
+ Push $R7
+ Push $R6
+ Push "false"
+
+ System::Call 'advapi32::OpenSCManagerW(n, n, i ${SC_MANAGER_ALL_ACCESS}) i.R6'
+ ${If} $R6 != 0
+ ; MpsSvc is the Firewall service on Windows Vista and above.
+ ; When opening the service with SERVICE_QUERY_CONFIG the return value will
+ ; be 0 if the service is not installed.
+ System::Call 'advapi32::OpenServiceW(i R6, t "MpsSvc", i ${SERVICE_QUERY_CONFIG}) i.R7'
+ ${If} $R7 != 0
+ System::Call 'advapi32::CloseServiceHandle(i R7) n'
+ ; Open the service with SERVICE_QUERY_CONFIG so its status can be queried.
+ System::Call 'advapi32::OpenServiceW(i R6, t "MpsSvc", i ${SERVICE_QUERY_STATUS}) i.R7'
+ ${Else}
+ ; SharedAccess is the Firewall service on Windows XP.
+ ; When opening the service with SERVICE_QUERY_CONFIG the return value will
+ ; be 0 if the service is not installed.
+ System::Call 'advapi32::OpenServiceW(i R6, t "SharedAccess", i ${SERVICE_QUERY_CONFIG}) i.R7'
+ ${If} $R7 != 0
+ System::Call 'advapi32::CloseServiceHandle(i R7) n'
+ ; Open the service with SERVICE_QUERY_CONFIG so its status can be
+ ; queried.
+ System::Call 'advapi32::OpenServiceW(i R6, t "SharedAccess", i ${SERVICE_QUERY_STATUS}) i.R7'
+ ${EndIf}
+ ${EndIf}
+ ; Did the calls to OpenServiceW succeed?
+ ${If} $R7 != 0
+ System::Call '*(i,i,i,i,i,i,i) i.R9'
+ ; Query the current status of the service.
+ System::Call 'advapi32::QueryServiceStatus(i R7, i $R9) i'
+ System::Call '*$R9(i, i.R8)'
+ System::Free $R9
+ System::Call 'advapi32::CloseServiceHandle(i R7) n'
+ IntFmt $R8 "0x%X" $R8
+ ${If} $R8 == ${SERVICE_RUNNING}
+ Pop $R9
+ Push "true"
+ ${EndIf}
+ ${EndIf}
+ System::Call 'advapi32::CloseServiceHandle(i R6) n'
+ ${EndIf}
+
+ Exch 1
+ Pop $R6
+ Exch 1
+ Pop $R7
+ Exch 1
+ Pop $R8
+ Exch 1
+ Pop $R9
+!macroend
+!define IsFirewallSvcRunning "!insertmacro IsFirewallSvcRunning"
+!define un.IsFirewallSvcRunning "!insertmacro IsFirewallSvcRunning"
+
; Sets this installation as the default browser by setting the registry keys
; under HKEY_CURRENT_USER via registry calls and using the AppAssocReg NSIS
; plugin for Vista and above. This is a function instead of a macro so it is
@@ -1214,7 +1299,7 @@ Function SetAsDefaultAppUserHKCU
${EndUnless}
${EndIf}
${RemoveDeprecatedKeys}
- ${PinToTaskBar}
+ ${MigrateTaskBarShortcut}
FunctionEnd
; Helper for updating the shortcut application model IDs.
@@ -1225,6 +1310,15 @@ Function FixShortcutAppModelIDs
${EndIf}
FunctionEnd
+; Helper for adding Firewall exceptions during install and after app update.
+Function AddFirewallEntries
+ ${IsFirewallSvcRunning}
+ Pop $0
+ ${If} "$0" == "true"
+ liteFirewallW::AddRule "$INSTDIR\${FileMainEXE}" "${BrandShortName} ($INSTDIR)"
+ ${EndIf}
+FunctionEnd
+
; The !ifdef NO_LOG prevents warnings when compiling the installer.nsi due to
; this function only being used by the uninstaller.nsi.
!ifdef NO_LOG
@@ -1311,4 +1405,4 @@ Function SetAsDefaultAppUser
FunctionEnd
!define SetAsDefaultAppUser "Call SetAsDefaultAppUser"
-!endif
+!endif ; NO_LOG
diff --git a/application/palemoon/installer/windows/nsis/uninstaller.nsi b/application/palemoon/installer/windows/nsis/uninstaller.nsi
index 2ed5d9dfc0..333fd33d65 100644
--- a/application/palemoon/installer/windows/nsis/uninstaller.nsi
+++ b/application/palemoon/installer/windows/nsis/uninstaller.nsi
@@ -4,7 +4,7 @@
# Required Plugins:
# AppAssocReg http://nsis.sourceforge.net/Application_Association_Registration_plug-in
-# CityHash http://mxr.mozilla.org/mozilla-central/source/other-licenses/nsis/Contrib/CityHash
+# CityHash http://dxr.mozilla.org/mozilla-central/source/other-licenses/nsis/Contrib/CityHash
# ShellLink http://nsis.sourceforge.net/ShellLink_plug-in
# UAC http://nsis.sourceforge.net/UAC_plug-in
@@ -19,6 +19,14 @@ CRCCheck on
RequestExecutionLevel user
+; The commands inside this ifdef require NSIS 3.0a2 or greater so the ifdef can
+; be removed after we require NSIS 3.0a2 or greater.
+!ifdef NSIS_PACKEDVERSION
+ Unicode true
+ ManifestSupportedOS all
+ ManifestDPIAware true
+!endif
+
!addplugindir ./
; On Vista and above attempt to elevate Standard Users in addition to users that
@@ -32,6 +40,7 @@ RequestExecutionLevel user
"Software\Microsoft\Windows\CurrentVersion\Uninstall\MozillaMaintenanceService"
Var TmpVal
+Var MaintCertKey
; Other included files may depend upon these includes!
; The following includes are provided by NSIS.
@@ -67,6 +76,7 @@ VIAddVersionKey "OriginalFilename" "helper.exe"
!insertmacro InitHashAppModelId
!insertmacro IsHandlerForInstallDir
!insertmacro IsPinnedToTaskBar
+!insertmacro IsUserAdmin
!insertmacro LogDesktopShortcut
!insertmacro LogQuickLaunchShortcut
!insertmacro LogStartMenuShortcut
@@ -85,19 +95,18 @@ VIAddVersionKey "OriginalFilename" "helper.exe"
!insertmacro un.CheckForFilesInUse
!insertmacro un.CleanUpdateDirectories
!insertmacro un.CleanVirtualStore
-!insertmacro un.DeleteRelativeProfiles
!insertmacro un.DeleteShortcuts
!insertmacro un.GetLongPath
!insertmacro un.GetSecondInstallPath
!insertmacro un.InitHashAppModelId
!insertmacro un.ManualCloseAppPrompt
-!insertmacro un.ParseUninstallLog
!insertmacro un.RegCleanAppHandler
!insertmacro un.RegCleanFileHandler
!insertmacro un.RegCleanMain
!insertmacro un.RegCleanUninstall
!insertmacro un.RegCleanProtocolHandler
!insertmacro un.RemoveQuotesFromPath
+!insertmacro un.RemovePrecompleteEntries
!insertmacro un.SetAppLSPCategories
!insertmacro un.SetBrandNameVars
@@ -146,29 +155,69 @@ ShowUnInstDetails nevershow
!insertmacro MUI_UNPAGE_WELCOME
; Custom Uninstall Confirm Page
-UninstPage custom un.preConfirm un.leaveConfirm
+UninstPage custom un.preConfirm
; Remove Files Page
!insertmacro MUI_UNPAGE_INSTFILES
; Finish Page
-; Don't setup the survey controls, functions, etc. when the application has
-; defined NO_UNINSTALL_SURVEY
-!ifndef NO_UNINSTALL_SURVEY
-!define MUI_PAGE_CUSTOMFUNCTION_PRE un.preFinish
-!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
-!define MUI_FINISHPAGE_SHOWREADME ""
-!define MUI_FINISHPAGE_SHOWREADME_TEXT $(SURVEY_TEXT)
-!define MUI_FINISHPAGE_SHOWREADME_FUNCTION un.Survey
-!endif
-
!insertmacro MUI_UNPAGE_FINISH
; Use the default dialog for IDD_VERIFY for a simple Banner
ChangeUI IDD_VERIFY "${NSISDIR}\Contrib\UIs\default.exe"
################################################################################
+# Helper Functions
+
+; This function is used to uninstall the maintenance service if the
+; application currently being uninstalled is the last application to use the
+; maintenance service.
+Function un.UninstallServiceIfNotUsed
+ ; $0 will store if a subkey exists
+ ; $1 will store the first subkey if it exists or an empty string if it doesn't
+ ; Backup the old values
+ Push $0
+ Push $1
+
+ ; The maintenance service always uses the 64-bit registry on x64 systems
+ ${If} ${RunningX64}
+ SetRegView 64
+ ${EndIf}
+
+ ; Figure out the number of subkeys
+ StrCpy $0 0
+ ${Do}
+ EnumRegKey $1 HKLM "Software\Mozilla\MaintenanceService" $0
+ ${If} "$1" == ""
+ ${ExitDo}
+ ${EndIf}
+ IntOp $0 $0 + 1
+ ${Loop}
+
+ ; Restore back the registry view
+ ${If} ${RunningX64}
+ SetRegView lastUsed
+ ${EndIf}
+ ${If} $0 == 0
+ ; Get the path of the maintenance service uninstaller
+ ReadRegStr $1 HKLM ${MaintUninstallKey} "UninstallString"
+
+ ; If the uninstall string does not exist, skip executing it
+ StrCmp $1 "" doneUninstall
+
+ ; $1 is already a quoted string pointing to the install path
+ ; so we're already protected against paths with spaces
+ nsExec::Exec "$1 /S"
+doneUninstall:
+ ${EndIf}
+
+ ; Restore the old value of $1 and $0
+ Pop $1
+ Pop $0
+FunctionEnd
+
+################################################################################
# Install Sections
; Empty section required for the installer to compile as an uninstaller
Section ""
@@ -194,15 +243,6 @@ Section "Uninstall"
ClearErrors
${EndIf}
- ${MUI_INSTALLOPTIONS_READ} $0 "unconfirm.ini" "Field 3" "State"
- ${If} "$0" == "1"
- ${un.DeleteRelativeProfiles} "Moonchild Productions\Pale Moon"
- ${un.DeleteRelativeProfiles} "Moonchild Productions\MetroPM"
- RmDir "$APPDATA\Mozilla\Extensions\{8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4}"
- RmDir "$APPDATA\Mozilla\Extensions"
- RmDir "$APPDATA\Mozilla"
- ${EndIf}
-
; setup the application model id registration value
${un.InitHashAppModelId} "$INSTDIR" "Software\Mozilla\${AppName}\TaskBarIDs"
@@ -218,7 +258,7 @@ Section "Uninstall"
${EndIf}
; Remove the updates directory for Vista and above
- ${un.CleanUpdateDirectories} "Moonchild Productions\Pale Moon" "Moonchild Productions\updates"
+ ${un.CleanUpdateDirectories} "Mozilla\PaleMoon" "Mozilla\updates"
; Remove any app model id's stored in the registry for this install path
DeleteRegValue HKCU "Software\Mozilla\${AppName}\TaskBarIDs" "$INSTDIR"
@@ -254,6 +294,10 @@ Section "Uninstall"
${un.RegCleanFileHandler} ".shtml" "PaleMoonHTML"
${un.RegCleanFileHandler} ".xht" "PaleMoonHTML"
${un.RegCleanFileHandler} ".xhtml" "PaleMoonHTML"
+ ${un.RegCleanFileHandler} ".oga" "PaleMoonHTML"
+ ${un.RegCleanFileHandler} ".ogg" "PaleMoonHTML"
+ ${un.RegCleanFileHandler} ".ogv" "PaleMoonHTML"
+ ${un.RegCleanFileHandler} ".pdf" "PaleMoonHTML"
${un.RegCleanFileHandler} ".webm" "PaleMoonHTML"
${EndIf}
@@ -273,7 +317,7 @@ Section "Uninstall"
; The StartMenuInternet registry key is independent of the default browser
; settings. The XPInstall base un-installer always removes this key if it is
; uninstalling the default browser and it will always replace the keys when
- ; installing even if there is another install of Firefox that is set as the
+ ; installing even if there is another install of PaleMoon that is set as the
; default browser. Now the key is always updated on install but it is only
; removed if it refers to this install location.
${If} "$INSTDIR" == "$R1"
@@ -289,7 +333,7 @@ Section "Uninstall"
; The StartMenuInternet registry key is independent of the default browser
; settings. The XPInstall base un-installer always removes this key if it is
; uninstalling the default browser and it will always replace the keys when
- ; installing even if there is another install of Firefox that is set as the
+ ; installing even if there is another install of PaleMoon that is set as the
; default browser. Now the key is always updated on install but it is only
; removed if it refers to this install location.
${If} "$INSTDIR" == "$R1"
@@ -307,7 +351,7 @@ Section "Uninstall"
StrCpy $0 "Software\Microsoft\MediaPlayer\ShimInclusionList\plugin-container.exe"
DeleteRegKey HKLM "$0"
DeleteRegKey HKCU "$0"
- StrCpy $0 "Software\Classes\MIME\Database\Content Type\application/x-xpinstall;app=firefox"
+ StrCpy $0 "Software\Classes\MIME\Database\Content Type\application/x-xpinstall;app=PaleMoon"
DeleteRegKey HKLM "$0"
DeleteRegKey HKCU "$0"
${Else}
@@ -335,42 +379,63 @@ Section "Uninstall"
${If} ${FileExists} "$INSTDIR\distribution"
RmDir /r /REBOOTOK "$INSTDIR\distribution"
${EndIf}
- ${If} ${FileExists} "$INSTDIR\removed-files"
- Delete /REBOOTOK "$INSTDIR\removed-files"
- ${EndIf}
; Remove files that may be left behind by the application in the
; VirtualStore directory.
${un.CleanVirtualStore}
- ; Parse the uninstall log to unregister dll's and remove all installed
- ; files / directories this install is responsible for.
- ${un.ParseUninstallLog}
+ ; Only unregister the dll if the registration points to this installation
+ ReadRegStr $R1 HKCR "CLSID\{0D68D6D0-D93D-4D08-A30D-F00DD1F45B24}\InProcServer32" ""
+ ${If} "$INSTDIR\AccessibleMarshal.dll" == "$R1"
+ ${UnregisterDLL} "$INSTDIR\AccessibleMarshal.dll"
+ ${EndIf}
+
+ ${un.RemovePrecompleteEntries} "false"
- ; Remove the uninstall directory that we control
- RmDir /r /REBOOTOK "$INSTDIR\uninstall"
+ ${If} ${FileExists} "$INSTDIR\defaults\pref\channel-prefs.js"
+ Delete /REBOOTOK "$INSTDIR\defaults\pref\channel-prefs.js"
+ ${EndIf}
+ ${If} ${FileExists} "$INSTDIR\defaults\pref"
+ RmDir /REBOOTOK "$INSTDIR\defaults\pref"
+ ${EndIf}
+ ${If} ${FileExists} "$INSTDIR\defaults"
+ RmDir /REBOOTOK "$INSTDIR\defaults"
+ ${EndIf}
+ ${If} ${FileExists} "$INSTDIR\uninstall"
+ ; Remove the uninstall directory that we control
+ RmDir /r /REBOOTOK "$INSTDIR\uninstall"
+ ${EndIf}
+ ${If} ${FileExists} "$INSTDIR\install.log"
+ Delete /REBOOTOK "$INSTDIR\install.log"
+ ${EndIf}
+ ${If} ${FileExists} "$INSTDIR\update-settings.ini"
+ Delete /REBOOTOK "$INSTDIR\update-settings.ini"
+ ${EndIf}
- ; Explictly remove empty webapprt dir in case it exists
- ; See bug 757978
+ ; Explicitly remove empty webapprt dir in case it exists (bug 757978).
RmDir "$INSTDIR\webapprt\components"
RmDir "$INSTDIR\webapprt"
- RmDir /r /REBOOTOK "$INSTDIR\${TO_BE_DELETED}"
-
; Remove the installation directory if it is empty
- ${RemoveDir} "$INSTDIR"
+ RmDir "$INSTDIR"
- ; If firefox.exe was successfully deleted yet we still need to restart to
- ; remove other files create a dummy firefox.exe.moz-delete to prevent the
+ ; If PaleMoon.exe was successfully deleted yet we still need to restart to
+ ; remove other files create a dummy PaleMoon.exe.moz-delete to prevent the
; installer from allowing an install without restart when it is required
; to complete an uninstall.
${If} ${RebootFlag}
- ${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}.moz-delete"
- FileOpen $0 "$INSTDIR\${FileMainEXE}.moz-delete" w
- FileWrite $0 "Will be deleted on restart"
- Delete /REBOOTOK "$INSTDIR\${FileMainEXE}.moz-delete"
- FileClose $0
- ${EndUnless}
+ ; Admin is required to delete files on reboot so only add the moz-delete if
+ ; the user is an admin. After calling UAC::IsAdmin $0 will equal 1 if the
+ ; user is an admin.
+ UAC::IsAdmin
+ ${If} "$0" == "1"
+ ${Unless} ${FileExists} "$INSTDIR\${FileMainEXE}.moz-delete"
+ FileOpen $0 "$INSTDIR\${FileMainEXE}.moz-delete" w
+ FileWrite $0 "Will be deleted on restart"
+ Delete /REBOOTOK "$INSTDIR\${FileMainEXE}.moz-delete"
+ FileClose $0
+ ${EndUnless}
+ ${EndIf}
${EndIf}
; Refresh desktop icons otherwise the start menu internet item won't be
@@ -378,19 +443,38 @@ Section "Uninstall"
; clients registry key by the OS under some conditions.
System::Call "shell32::SHChangeNotify(i ${SHCNE_ASSOCCHANGED}, i 0, i 0, i 0)"
-SectionEnd
-
-################################################################################
-# Helper Functions
-
-; Don't setup the survey controls, functions, etc. when the application has
-; defined NO_UNINSTALL_SURVEY
-!ifndef NO_UNINSTALL_SURVEY
-Function un.Survey
- Exec "$\"$TmpVal$\" $\"${SurveyURL}$\""
-FunctionEnd
+ ; Users who uninstall then reinstall expecting PaleMoon to use a clean profile
+ ; may be surprised during first-run. This key is checked during startup of PaleMoon and
+ ; subsequently deleted after checking. If the value is found during startup
+ ; the browser will offer to Reset PaleMoon. We use the UpdateChannel to match
+ ; uninstalls of PaleMoon-release with reinstalls of PaleMoon-release, for example.
+ WriteRegStr HKCU "Software\Mozilla\PaleMoon" "Uninstalled-${UpdateChannel}" "True"
+
+!ifdef MOZ_MAINTENANCE_SERVICE
+ ; Get the path the allowed cert is at and remove it
+ ; Keep this block of code last since it modfies the reg view
+ ServicesHelper::PathToUniqueRegistryPath "$INSTDIR"
+ Pop $MaintCertKey
+ ${If} $MaintCertKey != ""
+ ; Always use the 64bit registry for certs on 64bit systems.
+ ${If} ${RunningX64}
+ SetRegView 64
+ ${EndIf}
+ DeleteRegKey HKLM "$MaintCertKey"
+ ${If} ${RunningX64}
+ SetRegView lastused
+ ${EndIf}
+ ${EndIf}
+ Call un.UninstallServiceIfNotUsed
!endif
+ ${un.IsFirewallSvcRunning}
+ Pop $0
+ ${If} "$0" == "true"
+ liteFirewallW::RemoveRule "$INSTDIR\${FileMainEXE}" "${BrandShortName} ($INSTDIR)"
+ ${EndIf}
+SectionEnd
+
################################################################################
# Language
@@ -453,7 +537,7 @@ Function un.preConfirm
${EndIf}
; Setup the unconfirm.ini file for the Custom Uninstall Confirm Page
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Settings" NumFields "5"
+ WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Settings" NumFields "3"
WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Type "label"
WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 1" Text "$(UN_CONFIRM_UNINSTALLED_FROM)"
@@ -473,44 +557,22 @@ Function un.preConfirm
WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" Bottom "30"
WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 2" flags "READONLY"
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Type "checkbox"
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Text "$(UN_REMOVE_PROFILES)"
+ WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Type "label"
+ WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Text "$(UN_CONFIRM_CLICK)"
WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Left "0"
WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Right "-1"
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Top "40"
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Bottom "50"
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" State "0"
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" flags "NOTIFY"
-
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Type "text"
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" State "$(UN_REMOVE_PROFILES_DESC)"
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Left "0"
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Right "-1"
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Top "52"
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Bottom "120"
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" flags "MULTILINE|READONLY"
-
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 5" Type "label"
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 5" Text "$(UN_CONFIRM_CLICK)"
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 5" Left "0"
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 5" Right "-1"
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 5" Top "130"
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 5" Bottom "150"
+ WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Top "130"
+ WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Bottom "150"
${If} "$TmpVal" == "true"
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 6" Type "label"
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 6" Text "$(SUMMARY_REBOOT_REQUIRED_UNINSTALL)"
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 6" Left "0"
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 6" Right "-1"
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 6" Top "35"
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 6" Bottom "45"
-
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Settings" NumFields "6"
-
- ; To insert this control reset Top / Bottom for controls below this one
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Top "55"
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 3" Bottom "65"
- WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Top "67"
+ WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Type "label"
+ WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Text "$(SUMMARY_REBOOT_REQUIRED_UNINSTALL)"
+ WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Left "0"
+ WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Right "-1"
+ WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Top "35"
+ WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Field 4" Bottom "45"
+
+ WriteINIStr "$PLUGINSDIR\unconfirm.ini" "Settings" NumFields "4"
${EndIf}
!insertmacro MUI_HEADER_TEXT "$(UN_CONFIRM_PAGE_TITLE)" "$(UN_CONFIRM_PAGE_SUBTITLE)"
@@ -518,72 +580,12 @@ Function un.preConfirm
; focus. This sets the focus to the Install button instead.
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "unconfirm.ini"
GetDlgItem $0 $HWNDPARENT 1
- ${MUI_INSTALLOPTIONS_READ} $1 "unconfirm.ini" "Field 4" "HWND"
- SetCtlColors $1 0x000000 0xFFFFEE
- ShowWindow $1 ${SW_HIDE}
System::Call "user32::SetFocus(i r0, i 0x0007, i,i)i"
${MUI_INSTALLOPTIONS_READ} $1 "unconfirm.ini" "Field 2" "HWND"
SendMessage $1 ${WM_SETTEXT} 0 "STR:$INSTDIR"
!insertmacro MUI_INSTALLOPTIONS_SHOW
FunctionEnd
-Function un.leaveConfirm
- ${MUI_INSTALLOPTIONS_READ} $0 "unconfirm.ini" "Settings" "State"
- StrCmp $0 "3" +1 continue
- ${MUI_INSTALLOPTIONS_READ} $0 "unconfirm.ini" "Field 3" "State"
- ${MUI_INSTALLOPTIONS_READ} $1 "unconfirm.ini" "Field 4" "HWND"
- StrCmp $0 1 +1 +3
- ShowWindow $1 ${SW_SHOW}
- Abort
-
- ShowWindow $1 ${SW_HIDE}
- Abort
-
- continue:
-
- ; Try to delete the app executable and if we can't delete it try to find the
- ; app's message window and prompt the user to close the app. This allows
- ; running an instance that is located in another directory. If for whatever
- ; reason there is no message window we will just rename the app's files and
- ; then remove them on restart if they are in use.
- ClearErrors
- ${DeleteFile} "$INSTDIR\${FileMainEXE}"
- ${If} ${Errors}
- ${un.ManualCloseAppPrompt} "${WindowClass}" "$(WARN_MANUALLY_CLOSE_APP_UNINSTALL)"
- ${EndIf}
-FunctionEnd
-
-!ifndef NO_UNINSTALL_SURVEY
-Function un.preFinish
- ; Do not modify the finish page if there is a reboot pending
- ${Unless} ${RebootFlag}
- ; Setup the survey controls, functions, etc.
- StrCpy $TmpVal "SOFTWARE\Microsoft\IE Setup\Setup"
- ClearErrors
- ReadRegStr $0 HKLM $TmpVal "Path"
- ${If} ${Errors}
- !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "NumFields" "3"
- ${Else}
- ExpandEnvStrings $0 "$0" ; this value will usually contain %programfiles%
- ${If} $0 != "\"
- StrCpy $0 "$0\"
- ${EndIf}
- StrCpy $0 "$0\iexplore.exe"
- ClearErrors
- GetFullPathName $TmpVal $0
- ${If} ${Errors}
- !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "NumFields" "3"
- ${Else}
- ; When we add an optional action to the finish page the cancel button
- ; is enabled. This disables it and leaves the finish button as the
- ; only choice.
- !insertmacro MUI_INSTALLOPTIONS_WRITE "ioSpecial.ini" "settings" "cancelenabled" "0"
- ${EndIf}
- ${EndIf}
- ${EndUnless}
-FunctionEnd
-!endif
-
################################################################################
# Initialization Functions
@@ -605,6 +607,14 @@ Function un.onInit
${un.UninstallUnOnInitCommon}
+; The commands inside this ifndef are needed prior to NSIS 3.0a2 and can be
+; removed after we require NSIS 3.0a2 or greater.
+!ifndef NSIS_PACKEDVERSION
+ ${If} ${AtLeastWinVista}
+ System::Call 'user32::SetProcessDPIAware()'
+ ${EndIf}
+!endif
+
!insertmacro InitInstallOptionsFile "unconfirm.ini"
FunctionEnd
diff --git a/application/palemoon/installer/windows/stub.tag b/application/palemoon/installer/windows/stub.tag
deleted file mode 100644
index 4eae031d6a..0000000000
--- a/application/palemoon/installer/windows/stub.tag
+++ /dev/null
@@ -1,4 +0,0 @@
-;!@Install@!UTF-8!
-Title="Pale Moon"
-RunProgram="setup-stub.exe"
-;!@InstallEnd@! \ No newline at end of file
diff --git a/application/palemoon/locales/Makefile.in b/application/palemoon/locales/Makefile.in
index f00d7a0401..5720a76df2 100644
--- a/application/palemoon/locales/Makefile.in
+++ b/application/palemoon/locales/Makefile.in
@@ -96,11 +96,7 @@ NO_JA_JP_MAC_AB_CD := $(if $(filter ja-JP-mac, $(AB_CD)),ja,$(AB_CD))
%/defaults/profile/bookmarks.html: bookmarks.inc generic/profile/bookmarks.html.in
$(SYSINSTALL) -D $(dir $@)
- $(call py_action,preprocessor, \
- -I $< \
- -DAB_CD=$(NO_JA_JP_MAC_AB_CD) \
- $(srcdir)/generic/profile/bookmarks.html.in \
- -o $@)
+ $(call py_action,preprocessor,$< -DAB_CD=$(NO_JA_JP_MAC_AB_CD) $(srcdir)/generic/profile/bookmarks.html.in -o $@)
libs:: $(FINAL_TARGET)/defaults/profile/bookmarks.html ;
@@ -124,10 +120,10 @@ searchplugins: $(addprefix $(FINAL_TARGET)/searchplugins/,$(SEARCHPLUGINS))
libs-%:
$(NSINSTALL) -D $(DIST)/install
- @$(MAKE) -C ../../toolkit/locales libs-$*
- @$(MAKE) -C ../../services/sync/locales AB_CD=$* XPI_NAME=locale-$*
- @$(MAKE) -C ../../extensions/spellcheck/locales AB_CD=$* XPI_NAME=locale-$*
- @$(MAKE) -C ../../intl/locales AB_CD=$* XPI_NAME=locale-$*
+ @$(MAKE) -C ../../../toolkit/locales libs-$*
+ @$(MAKE) -C ../../../services/sync/locales AB_CD=$* XPI_NAME=locale-$*
+ @$(MAKE) -C ../../../extensions/spellcheck/locales AB_CD=$* XPI_NAME=locale-$*
+ @$(MAKE) -C ../../../intl/locales AB_CD=$* XPI_NAME=locale-$*
@$(MAKE) libs AB_CD=$* XPI_NAME=locale-$* PREF_DIR=$(PREF_DIR)
@$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY)/locales AB_CD=$* XPI_NAME=locale-$*
diff --git a/application/palemoon/locales/en-US/chrome/browser/browser.dtd b/application/palemoon/locales/en-US/chrome/browser/browser.dtd
index fe5f64854c..65cc34fa06 100644
--- a/application/palemoon/locales/en-US/chrome/browser/browser.dtd
+++ b/application/palemoon/locales/en-US/chrome/browser/browser.dtd
@@ -337,7 +337,6 @@ These should match what Safari and other Apple applications use on OS X Lion. --
<!ENTITY appMenuSafeMode.label "Restart in Safe Mode…">
<!ENTITY openCmd.commandkey "l">
-<!ENTITY urlbar.placeholder2 "Search or enter address">
<!ENTITY urlbar.accesskey "d">
<!ENTITY urlbar.switchToTab.label "Switch to tab:">
@@ -643,8 +642,10 @@ just addresses the organization to follow, e.g. "This site is run by " -->
<!ENTITY getUserMedia.selectMicrophone.label "Microphone to share:">
<!ENTITY getUserMedia.selectMicrophone.accesskey "M">
+#ifdef MOZ_WEBRTC
<!ENTITY webrtcIndicatorButton.label "Camera / Microphone Access">
<!ENTITY webrtcIndicatorButton.tooltip "Display sites you are currently sharing your camera or microphone with">
+#endif
<!ENTITY mixedContentBlocked.moreinfo "Most websites will still work properly even when this content is blocked.">
diff --git a/application/palemoon/locales/en-US/chrome/browser/browser.properties b/application/palemoon/locales/en-US/chrome/browser/browser.properties
index 5f75502edd..7f1c88a885 100644
--- a/application/palemoon/locales/en-US/chrome/browser/browser.properties
+++ b/application/palemoon/locales/en-US/chrome/browser/browser.properties
@@ -7,6 +7,7 @@ openFile=Open File
droponhometitle=Set Home Page
droponhomemsg=Do you want this document to be your new home page?
+droponhomemsgMultiple=Do you want these documents to be your new home pages?
# context menu strings
@@ -220,6 +221,8 @@ tabHistory.goBack=Go back to this page
tabHistory.goForward=Go forward to this page
# URL Bar
+urlbar.placeholder=Search or enter address
+urlbar.placeholderURLOnly=Enter address
pasteAndGo.label=Paste & Go
# Block autorefresh
@@ -302,6 +305,10 @@ webNotifications.alwaysShow.accesskey=A
webNotifications.neverShow=Always Block Notifications
webNotifications.neverShow.accesskey=N
webNotifications.showFromSite=Would you like to show notifications from %S?
+# LOCALIZATION NOTE (webNotifications.upgradeTitle): When using native notifications on OS X, the title may be truncated around 32 characters.
+webNotifications.upgradeTitle=Upgraded notifications
+# LOCALIZATION NOTE (webNotifications.upgradeBody): When using native notifications on OS X, the body may be truncated around 100 characters in some views.
+webNotifications.upgradeBody=You can now receive notifications from sites that are not currently loaded. Click to learn more.
# Pointer lock UI
@@ -361,26 +368,6 @@ restartButton=Restart
# menu, set this to "true". Otherwise, you can leave it as "false".
browser.menu.showCharacterEncoding=false
-# LOCALIZATION NOTE (syncPromoNotification.bookmarks.label): This appears in
-# the add bookmark star panel. %S will be replaced by syncBrandShortName.
-# The final space separates this text from the Learn More link.
-syncPromoNotification.bookmarks.description=You can access your bookmarks on all your devices with %S.\u0020
-# LOCALIZATION NOTE (syncPromoNotification.passwords.label): This appears in
-# the remember password panel. %S will be replaced by syncBrandShortName.
-# The final space separates this text from the Learn More link.
-syncPromoNotification.passwords.description=You can access your passwords on all your devices with %S.\u0020
-syncPromoNotification.learnMoreLinkText=Learn More
-# LOCALIZATION NOTE (syncPromoNotification.addons.label): This appears in
-# the add-on install complete panel when Sync isn't set.
-# %S will be replaced by syncBrandShortName.
-# The final space separates this text from the Learn More link.
-syncPromoNotification.addons.description=You can access your add-ons on all your devices with %S.\u0020
-# LOCALIZATION NOTE (syncPromoNotification.addons-sync-disabled.label):
-# This appears in the add-on install complete panel when Sync is set
-# but addons sync is not. %S will be replaced by syncBrandShortName.
-# The final space separates this text from the Learn More link.
-syncPromoNotification.addons-sync-disabled.description=You can use your %S account to synchronize add-ons across multiple devices.\u0020
-
# Mozilla data reporting notification (Telemetry, Firefox Health Report, etc)
dataReportingNotification.message = %1$S automatically sends some data to %2$S so that we can improve your experience.
dataReportingNotification.button.label = Choose What I Share
diff --git a/application/palemoon/locales/en-US/chrome/browser/migration/migration.dtd b/application/palemoon/locales/en-US/chrome/browser/migration/migration.dtd
deleted file mode 100644
index 2848c4e679..0000000000
--- a/application/palemoon/locales/en-US/chrome/browser/migration/migration.dtd
+++ /dev/null
@@ -1,36 +0,0 @@
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
- - License, v. 2.0. If a copy of the MPL was not distributed with this
- - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-
-<!ENTITY migrationWizard.title "Import Wizard">
-
-<!ENTITY importFrom.label "Import Preferences, Bookmarks, History, Passwords and other data from:">
-<!ENTITY importFromBookmarks.label "Import Bookmarks from:">
-
-<!ENTITY importFromIE.label "Microsoft Internet Explorer">
-<!ENTITY importFromIE.accesskey "M">
-<!ENTITY importFromNothing.label "Don't import anything">
-<!ENTITY importFromNothing.accesskey "D">
-<!ENTITY importFromSafari.label "Safari">
-<!ENTITY importFromSafari.accesskey "S">
-<!ENTITY importFromChrome.label "Chrome">
-<!ENTITY importFromChrome.accesskey "C">
-<!ENTITY importFromFirefox.label "Firefox">
-<!ENTITY importFromFirefox.accesskey "X">
-
-<!ENTITY noMigrationSources.label "No programs that contain bookmarks, history or password data could be found.">
-
-<!ENTITY importSource.title "Import Settings and Data">
-<!ENTITY importItems.title "Items to Import">
-<!ENTITY importItems.label "Select which items to import:">
-
-<!ENTITY migrating.title "Importing…">
-<!ENTITY migrating.label "The following items are currently being imported…">
-
-<!ENTITY selectProfile.title "Select Profile">
-<!ENTITY selectProfile.label "The following profiles are available to import from:">
-
-<!ENTITY done.title "Import Complete">
-<!ENTITY done.label "The following items were successfully imported:">
-
diff --git a/application/palemoon/locales/en-US/chrome/browser/migration/migration.properties b/application/palemoon/locales/en-US/chrome/browser/migration/migration.properties
deleted file mode 100644
index b1cb03d0ac..0000000000
--- a/application/palemoon/locales/en-US/chrome/browser/migration/migration.properties
+++ /dev/null
@@ -1,51 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-profileName_format=%S %S
-
-# Browser Specific
-sourceNameIE=Internet Explorer
-sourceNameSafari=Safari
-sourceNameChrome=Google Chrome
-sourceNameFirefox=Mozilla Firefox
-
-importedBookmarksFolder=From %S
-
-importedSafariReadingList=Reading List (From Safari)
-
-# Import Sources
-# Note: When adding an import source for profile reset, add the string name to
-# resetProfile.js if it should be listed in the reset dialog.
-1_ie=Internet Options
-1_safari=Preferences
-1_chrome=Preferences
-
-2_ie=Cookies
-2_safari=Cookies
-2_chrome=Cookies
-2_firefox=Cookies
-
-4_ie=Browsing History
-4_safari=Browsing History
-4_chrome=Browsing History
-4_firefox_history_and_bookmarks=Browsing History and Bookmarks
-
-8_ie=Saved Form History
-8_safari=Saved Form History
-8_chrome=Saved Form History
-8_firefox=Saved Form History
-
-16_ie=Saved Passwords
-16_safari=Saved Passwords
-16_chrome=Saved Passwords
-16_firefox=Saved Passwords
-
-32_ie=Favorites
-32_safari=Bookmarks
-32_chrome=Bookmarks
-
-64_ie=Other Data
-64_safari=Other Data
-64_chrome=Other Data
-64_firefox_other=Other Data
diff --git a/application/palemoon/locales/en-US/chrome/browser/places/places.dtd b/application/palemoon/locales/en-US/chrome/browser/places/places.dtd
index 949593e7df..9578754d24 100644
--- a/application/palemoon/locales/en-US/chrome/browser/places/places.dtd
+++ b/application/palemoon/locales/en-US/chrome/browser/places/places.dtd
@@ -31,8 +31,6 @@
<!ENTITY importBookmarksFromHTML.accesskey "I">
<!ENTITY exportBookmarksToHTML.label "Export Bookmarks to HTML…">
<!ENTITY exportBookmarksToHTML.accesskey "E">
-<!ENTITY importOtherBrowser.label "Import Data from Another Browser…">
-<!ENTITY importOtherBrowser.accesskey "A">
<!ENTITY cmd.backup.label "Backup…">
<!ENTITY cmd.backup.accesskey "B">
diff --git a/application/palemoon/locales/en-US/chrome/browser/preferences/aboutPermissions.dtd b/application/palemoon/locales/en-US/chrome/browser/preferences/aboutPermissions.dtd
index ff1da3dd0d..9e36520c8f 100644
--- a/application/palemoon/locales/en-US/chrome/browser/preferences/aboutPermissions.dtd
+++ b/application/palemoon/locales/en-US/chrome/browser/preferences/aboutPermissions.dtd
@@ -54,3 +54,5 @@
<!ENTITY fullscreen.label "Fullscreen">
<!ENTITY pointerLock.label "Hide the Mouse Pointer">
+
+<!ENTITY focusSearch.key "f">
diff --git a/application/palemoon/locales/en-US/chrome/browser/preferences/cookies.dtd b/application/palemoon/locales/en-US/chrome/browser/preferences/cookies.dtd
index 06f57c435b..c83331328e 100644
--- a/application/palemoon/locales/en-US/chrome/browser/preferences/cookies.dtd
+++ b/application/palemoon/locales/en-US/chrome/browser/preferences/cookies.dtd
@@ -7,11 +7,6 @@
<!ENTITY cookiesonsystem.label "The following cookies are stored on your computer:">
<!ENTITY cookiename.label "Cookie Name">
<!ENTITY cookiedomain.label "Site">
-<!ENTITY button.removecookies.label "Remove Cookies">
-<!ENTITY button.removecookie.label "Remove Cookie">
-<!ENTITY button.removecookie.accesskey "R">
-<!ENTITY button.removeallcookies.label "Remove All Cookies">
-<!ENTITY button.removeallcookies.accesskey "A">
<!ENTITY props.name.label "Name:">
<!ENTITY props.value.label "Content:">
diff --git a/application/palemoon/locales/en-US/chrome/browser/preferences/permissions.dtd b/application/palemoon/locales/en-US/chrome/browser/preferences/permissions.dtd
index f6a9c466c9..e61228b76d 100644
--- a/application/palemoon/locales/en-US/chrome/browser/preferences/permissions.dtd
+++ b/application/palemoon/locales/en-US/chrome/browser/preferences/permissions.dtd
@@ -3,7 +3,7 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<!ENTITY window.title "Exceptions">
-<!ENTITY window.width "36em">
+<!ENTITY window.width "45em">
<!ENTITY treehead.sitename.label "Site">
<!ENTITY treehead.status.label "Status">
@@ -21,6 +21,8 @@
<!ENTITY allow.accesskey "A">
<!ENTITY windowClose.key "w">
-<!ENTITY button.close.label "Close">
-<!ENTITY button.close.accesskey "C">
+<!ENTITY button.cancel.label "Cancel">
+<!ENTITY button.cancel.accesskey "C">
+<!ENTITY button.ok.label "Save Changes">
+<!ENTITY button.ok.accesskey "S">
diff --git a/application/palemoon/locales/en-US/chrome/browser/preferences/preferences.properties b/application/palemoon/locales/en-US/chrome/browser/preferences/preferences.properties
index 826f1463dc..3eebbcbecc 100644
--- a/application/palemoon/locales/en-US/chrome/browser/preferences/preferences.properties
+++ b/application/palemoon/locales/en-US/chrome/browser/preferences/preferences.properties
@@ -15,7 +15,7 @@ labelDefaultFont=Default (%S)
#### Permissions Manager
-cookiepermissionstext=You can specify which websites are always or never allowed to use cookies. Type the exact address of the site you want to manage and then click Block, Allow for Session, or Allow.
+cookiepermissionstext=You can specify which websites are always or never allowed to use cookies. Type the exact address of the site you want to manage and then click Block, Allow for Session, or Allow.
cookiepermissionstitle=Exceptions - Cookies
addonspermissionstext=You can specify which websites are allowed to install add-ons. Type the exact address of the site you want to allow and then click Allow.
addons_permissions_title=Allowed Sites - Add-ons Installation
@@ -23,6 +23,8 @@ popuppermissionstext=You can specify which websites are allowed to open pop-up w
popuppermissionstitle=Allowed Sites - Pop-ups
invalidURI=Please enter a valid hostname
invalidURITitle=Invalid Hostname Entered
+savedLoginsExceptions_title=Exceptions - Saved Logins
+savedLoginsExceptions_desc=Logins for the following sites will not be saved:
#### Master Password
@@ -93,9 +95,30 @@ noCookieSelected=<no cookie selected>
cookiesAll=The following cookies are stored on your computer:
cookiesFiltered=The following cookies match your search:
+# LOCALIZATION NOTE (removeAllCookies, removeAllShownCookies):
+# removeAllCookies and removeAllShownCookies are both used on the same one button,
+# never displayed together and can share the same accesskey.
+# When only partial cookies are shown as a result of keyword search,
+# removeAllShownCookies is displayed as button label.
+# removeAllCookies is displayed when no keyword search and all cookies are shown.
+removeAllCookies.label=Remove All
+removeAllCookies.accesskey=A
+removeAllShownCookies.label=Remove All Shown
+removeAllShownCookies.accesskey=A
+
+# LOCALIZATION NOTE (removeSelectedCookies):
+# Semicolon-separated list of plural forms. See:
+# http://developer.mozilla.org/en/docs/Localization_and_Plurals
+# If you need to display the number of selected elements in your language,
+# you can use #1 in your localization as a placeholder for the number.
+# For example this is the English string with numbers:
+# removeSelectedCookied=Remove #1 Selected;Remove #1 Selected
+removeSelectedCookies.label=Remove Selected;Remove Selected
+removeSelectedCookies.accesskey=R
+
#### Offline apps
offlineAppRemoveTitle=Remove offline website data
-offlineAppRemovePrompt=After removing this data, %S will not be available offline. Are you sure you want to remove this offline website?
+offlineAppRemovePrompt=After removing this data, %S will not be available offline. Are you sure you want to remove this offline website?
offlineAppRemoveConfirm=Remove offline data
# LOCALIZATION NOTE: The next string is for the disk usage of the
diff --git a/application/palemoon/locales/en-US/chrome/overrides/netError.dtd b/application/palemoon/locales/en-US/chrome/overrides/netError.dtd
index 3ed288d900..c97bd1b59d 100644
--- a/application/palemoon/locales/en-US/chrome/overrides/netError.dtd
+++ b/application/palemoon/locales/en-US/chrome/overrides/netError.dtd
@@ -7,6 +7,8 @@
<!ENTITY loadError.label "Problem loading page">
<!ENTITY retry.label "Try Again">
+<!ENTITY returnToPreviousPage.label "Go Back">
+<!ENTITY advanced.label "Advanced">
<!-- Specific error messages -->
@@ -14,7 +16,7 @@
<!ENTITY connectionFailure.longDesc "&sharedLongDesc;">
<!ENTITY deniedPortAccess.title "This address is restricted">
-<!ENTITY deniedPortAccess.longDesc "<p>The requested address specified a port (e.g. <q>palemoon.org:25</q> for port 25 on palemoon.org) normally used for purposes <em>other</em> than Web browsing. The browser has canceled the request for your protection and security.</p>">
+<!ENTITY deniedPortAccess.longDesc "">
<!ENTITY dnsNotFound.title "Server not found">
<!ENTITY dnsNotFound.longDesc "
@@ -22,7 +24,7 @@
<li>Check the address for typing errors such as
<strong>ww</strong>.example.com instead of
<strong>www</strong>.example.com</li>
- <li>If you are unable to load any pages, check your computer's network
+ <li>If you are unable to load any pages, check your computer’s network
connection.</li>
<li>If your computer or network is protected by a firewall or proxy, make sure
that &brandShortName; is permitted to access the Web.</li>
@@ -37,18 +39,31 @@
</ul>
">
+<!ENTITY fileAccessDenied.title "Access to the file was denied">
+<!ENTITY fileAccessDenied.longDesc "
+<ul>
+ <li>It may have been removed, moved, or file permissions may be preventing access.</li>
+</ul>
+">
<!ENTITY generic.title "Oops.">
<!ENTITY generic.longDesc "
-<p>&brandShortName; can't load this page for some reason.</p>
+<p>&brandShortName; can’t load this page for some reason.</p>
">
+<!ENTITY captivePortal.title "Login to network">
+<!ENTITY captivePortal.longDesc "
+<p>This network may require you to login to access the internet.</p>
+">
+
+<!ENTITY openPortalLoginPage.label "Open Login Page">
+
<!ENTITY malformedURI.title "The address isn't valid">
<!ENTITY malformedURI.longDesc "
<ul>
<li>Web addresses are usually written like
<strong>http://www.example.com/</strong></li>
- <li>Make sure that you're using forward slashes (i.e.
+ <li>Make sure that you’re using forward slashes (i.e.
<strong>/</strong>).</li>
</ul>
">
@@ -57,7 +72,7 @@
<!ENTITY netInterrupt.longDesc "&sharedLongDesc;">
<!ENTITY notCached.title "Document Expired">
-<!ENTITY notCached.longDesc "<p>The requested document is not available in &brandShortName;'s cache.</p><ul><li>As a security precaution, &brandShortName; does not automatically re-request sensitive documents.</li><li>Click Try Again to re-request the document from the website.</li></ul>">
+<!ENTITY notCached.longDesc "<p>The requested document is not available in &brandShortName;’s cache.</p><ul><li>As a security precaution, &brandShortName; does not automatically re-request sensitive documents.</li><li>Click Try Again to re-request the document from the website.</li></ul>">
<!ENTITY netOffline.title "Offline mode">
<!ENTITY netOffline.longDesc2 "
@@ -86,7 +101,7 @@
<!ENTITY netTimeout.title "The connection has timed out">
<!ENTITY netTimeout.longDesc "&sharedLongDesc;">
-<!ENTITY unknownProtocolFound.title "The address wasn't understood">
+<!ENTITY unknownProtocolFound.title "The address wasn’t understood">
<!ENTITY unknownProtocolFound.longDesc "
<ul>
<li>You might need to install other software to open this address.</li>
@@ -112,7 +127,7 @@
</ul>
">
-<!ENTITY redirectLoop.title "The page isn't redirecting properly">
+<!ENTITY redirectLoop.title "The page isn’t redirecting properly">
<!ENTITY redirectLoop.longDesc "
<ul>
<li>This problem can sometimes be caused by disabling or refusing to accept
@@ -146,12 +161,17 @@ someone trying to impersonate the server.</li>
be temporary, and you can try again later.</li>
</ul>
">
+<!ENTITY certerror.longpagetitle1 "Your connection is not secure">
+<!-- Localization note (certerror.introPara) - The text content of the span tag
+will be replaced at runtime with the name of the server to which the user
+was trying to connect. -->
+<!ENTITY certerror.introPara "The owner of <span class='hostname'/> has configured their website improperly. To protect your information from being stolen, &brandShortName; has not connected to this website.">
<!ENTITY sharedLongDesc "
<ul>
<li>The site could be temporarily unavailable or too busy. Try again in a few
moments.</li>
- <li>If you are unable to load any pages, check your computer's network
+ <li>If you are unable to load any pages, check your computer’s network
connection.</li>
<li>If your computer or network is protected by a firewall or proxy, make sure
that &brandShortName; is permitted to access the Web.</li>
@@ -186,6 +206,8 @@ be temporary, and you can try again later.</li>
<!ENTITY corruptedContentError.title "Corrupted Content Error">
<!ENTITY corruptedContentError.longDesc "<p>The page you are trying to view cannot be shown because an error in the data transmission was detected.</p><ul><li>Please contact the website owners to inform them of this problem.</li></ul>">
+<!ENTITY corruptedContentErrorv2.title "Corrupted Content Error">
+<!ENTITY corruptedContentErrorv2.longDesc "<p>The page you are trying to view cannot be shown because an error in the data transmission was detected.</p><ul><li>Please contact the website owners to inform them of this problem.</li></ul>">
<!ENTITY securityOverride.linkText "Or you can add an exception…">
@@ -207,6 +229,7 @@ functionality specific to firefox. -->
<!ENTITY errorReporting.title "Report this error">
<!ENTITY errorReporting.longDesc "Reporting the address and certificate information for <span id='hostname'></span> will help us identify and block malicious sites. Thanks for helping create a safer web!">
<!ENTITY errorReporting.automatic "Automatically report errors in the future">
+<!ENTITY errorReporting.automatic2 "Report errors like this to help Mozilla identify and block malicious sites">
<!ENTITY errorReporting.learnMore "Learn more…">
<!ENTITY errorReporting.sending "Sending report">
<!ENTITY errorReporting.sent "Report sent">
@@ -221,3 +244,33 @@ functionality specific to firefox. -->
"ssl_error_unsupported_version". -->
<!ENTITY sslv3Used.longDesc "Advanced info: ssl_error_unsupported_version">
<!ENTITY sslv3Used.learnMore "Learn More…">
+<!-- LOCALIZATION NOTE (sslv3Used.longDesc2) - Do not translate
+ "SSL_ERROR_UNSUPPORTED_VERSION". -->
+<!ENTITY sslv3Used.longDesc2 "Advanced info: SSL_ERROR_UNSUPPORTED_VERSION">
+
+<!ENTITY weakCryptoUsed.title "Your connection is not secure">
+<!-- LOCALIZATION NOTE (weakCryptoUsed.longDesc2) - Do not translate
+ "SSL_ERROR_NO_CYPHER_OVERLAP". -->
+<!ENTITY weakCryptoUsed.longDesc2 "Advanced info: SSL_ERROR_NO_CYPHER_OVERLAP">
+<!ENTITY weakCryptoAdvanced.title "Advanced">
+<!ENTITY weakCryptoAdvanced.longDesc "<span class='hostname'></span> uses security technology that is outdated and vulnerable to attack. An attacker could easily reveal information which you thought to be safe.">
+<!ENTITY weakCryptoAdvanced.override "(Not secure) Try loading <span class='hostname'></span> using outdated security">
+
+<!-- LOCALIZATION NOTE (certerror.wrongSystemTime) - The <span id='..' /> tags will be injected with actual values,
+ please leave them unchanged. -->
+<!ENTITY certerror.wrongSystemTime "<p>A secure connection to <span id='wrongSystemTime_URL'/> isn’t possible because your clock appears to show the wrong time.</p> <p>Your computer thinks it is <span id='wrongSystemTime_systemDate'/>. To fix this problem, change your date and time settings to match the correct time.</p>">
+
+<!ENTITY certerror.pagetitle1 "Insecure Connection">
+<!ENTITY certerror.whatShouldIDo.badStsCertExplanation "This site uses HTTP
+Strict Transport Security (HSTS) to specify that &brandShortName; may only connect
+to it securely. As a result, it is not possible to add an exception for this
+certificate.">
+<!ENTITY certerror.copyToClipboard.label "Copy text to clipboard">
+
+<!ENTITY inadequateSecurityError.title "Your connection is not secure">
+<!-- LOCALIZATION NOTE (inadequateSecurityError.longDesc) - Do not translate
+ "NS_ERROR_NET_INADEQUATE_SECURITY". -->
+<!ENTITY inadequateSecurityError.longDesc "<p><span class='hostname'></span> uses security technology that is outdated and vulnerable to attack. An attacker could easily reveal information which you thought to be safe. The website administrator will need to fix the server first before you can visit the site.</p><p>Error code: NS_ERROR_NET_INADEQUATE_SECURITY</p>">
+
+<!ENTITY prefReset.longDesc "It looks like your network security settings might be causing this. Do you want the default settings to be restored?">
+<!ENTITY prefReset.label "Restore default settings">
diff --git a/application/palemoon/locales/generic/install.rdf b/application/palemoon/locales/generic/install.rdf
deleted file mode 100644
index d04c67a61a..0000000000
--- a/application/palemoon/locales/generic/install.rdf
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0"?>
-<!--
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-#filter substitution
--->
-
-<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:em="http://www.mozilla.org/2004/em-rdf#">
- <Description about="urn:mozilla:install-manifest"
- em:id="@MOZ_LANGPACK_EID@"
- em:name="@MOZ_LANG_TITLE@ Language Pack"
- em:version="@MOZ_APP_VERSION@"
- em:type="8"
- em:creator="@MOZ_LANGPACK_CREATOR@">
-#ifdef MOZ_LANGPACK_CONTRIBUTORS
- @MOZ_LANGPACK_CONTRIBUTORS@
-#endif
-
- <em:targetApplication>
- <Description>
- <em:id>{8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4}</em:id>
- <em:minVersion>@MOZ_APP_VERSION@</em:minVersion>
- <em:maxVersion>@MOZ_APP_MAXVERSION@</em:maxVersion>
- </Description>
- </em:targetApplication>
- </Description>
-</RDF>
diff --git a/application/palemoon/locales/jar.mn b/application/palemoon/locales/jar.mn
index 451a86ab7b..f2b9ddeb21 100644
--- a/application/palemoon/locales/jar.mn
+++ b/application/palemoon/locales/jar.mn
@@ -16,7 +16,7 @@
locale/browser/syncProgress.dtd (%chrome/browser/syncProgress.dtd)
locale/browser/aboutSyncTabs.dtd (%chrome/browser/aboutSyncTabs.dtd)
#endif
- locale/browser/browser.dtd (%chrome/browser/browser.dtd)
+* locale/browser/browser.dtd (%chrome/browser/browser.dtd)
locale/browser/baseMenuOverlay.dtd (%chrome/browser/baseMenuOverlay.dtd)
locale/browser/charsetOverlay.dtd (%chrome/browser/charsetOverlay.dtd)
locale/browser/browser.properties (%chrome/browser/browser.properties)
@@ -55,8 +55,6 @@
locale/browser/places/moveBookmarks.dtd (%chrome/browser/places/moveBookmarks.dtd)
locale/browser/feeds/subscribe.dtd (%chrome/browser/feeds/subscribe.dtd)
locale/browser/feeds/subscribe.properties (%chrome/browser/feeds/subscribe.properties)
- locale/browser/migration/migration.dtd (%chrome/browser/migration/migration.dtd)
- locale/browser/migration/migration.properties (%chrome/browser/migration/migration.properties)
locale/browser/preferences/aboutPermissions.dtd (%chrome/browser/preferences/aboutPermissions.dtd)
locale/browser/preferences/aboutPermissions.properties (%chrome/browser/preferences/aboutPermissions.properties)
locale/browser/preferences/advanced.dtd (%chrome/browser/preferences/advanced.dtd)
diff --git a/application/palemoon/locales/l10n.ini b/application/palemoon/locales/l10n.ini
index df5eb7ac03..9a466b65ed 100644
--- a/application/palemoon/locales/l10n.ini
+++ b/application/palemoon/locales/l10n.ini
@@ -3,14 +3,14 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
[general]
-depth = ../..
-all = browser/locales/all-locales
+depth = ../../..
+all = application/palemoon/locales/all-locales
[compare]
-dirs = browser
+dirs = application/palemoon
extensions/reporter
other-licenses/branding/firefox
- browser/branding/official
+ application/palemoon/branding/official
[includes]
# non-central apps might want to use %(topsrcdir)s here, or other vars
diff --git a/application/palemoon/modules/AboutHomeUtils.jsm b/application/palemoon/modules/AboutHomeUtils.jsm
index 1d4070eafa..72712e1f36 100644
--- a/application/palemoon/modules/AboutHomeUtils.jsm
+++ b/application/palemoon/modules/AboutHomeUtils.jsm
@@ -44,7 +44,7 @@ this.AboutHomeUtils = {
return !Services.prefs.getBoolPref("browser.EULA.override");
} catch (e) { }
-#ifndef MOZILLA_OFFICIAL
+#ifndef MC_OFFICIAL
// Non-official builds shouldn't show the notification.
return false;
#endif
diff --git a/application/palemoon/modules/AutoCompletePopup.jsm b/application/palemoon/modules/AutoCompletePopup.jsm
new file mode 100644
index 0000000000..c3698f9051
--- /dev/null
+++ b/application/palemoon/modules/AutoCompletePopup.jsm
@@ -0,0 +1,293 @@
+/* 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";
+
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+const Cu = Components.utils;
+
+this.EXPORTED_SYMBOLS = [ "AutoCompletePopup" ];
+
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+Cu.import("resource://gre/modules/Services.jsm");
+
+// nsITreeView implementation that feeds the autocomplete popup
+// with the search data.
+var AutoCompleteTreeView = {
+ // nsISupports
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsITreeView,
+ Ci.nsIAutoCompleteController]),
+
+ // Private variables
+ treeBox: null,
+ results: [],
+
+ // nsITreeView
+ selection: null,
+
+ get rowCount() { return this.results.length; },
+ setTree: function(treeBox) { this.treeBox = treeBox; },
+ getCellText: function(idx, column) { return this.results[idx].value },
+ isContainer: function(idx) { return false; },
+ getCellValue: function(idx, column) { return false },
+ isContainerOpen: function(idx) { return false; },
+ isContainerEmpty: function(idx) { return false; },
+ isSeparator: function(idx) { return false; },
+ isSorted: function() { return false; },
+ isEditable: function(idx, column) { return false; },
+ canDrop: function(idx, orientation, dt) { return false; },
+ getLevel: function(idx) { return 0; },
+ getParentIndex: function(idx) { return -1; },
+ hasNextSibling: function(idx, after) { return idx < this.results.length - 1 },
+ toggleOpenState: function(idx) { },
+ getCellProperties: function(idx, column) { return this.results[idx].style || ""; },
+ getRowProperties: function(idx) { return ""; },
+ getImageSrc: function(idx, column) { return null; },
+ getProgressMode : function(idx, column) { },
+ cycleHeader: function(column) { },
+ cycleCell: function(idx, column) { },
+ selectionChanged: function() { },
+ performAction: function(action) { },
+ performActionOnCell: function(action, index, column) { },
+ getColumnProperties: function(column) { return ""; },
+
+ // nsIAutoCompleteController
+ get matchCount() {
+ return this.rowCount;
+ },
+
+ handleEnter: function(aIsPopupSelection) {
+ AutoCompletePopup.handleEnter(aIsPopupSelection);
+ },
+
+ stopSearch: function() {},
+
+ // Internal JS-only API
+ clearResults: function() {
+ this.results = [];
+ },
+
+ setResults: function(results) {
+ this.results = results;
+ },
+};
+
+this.AutoCompletePopup = {
+ MESSAGES: [
+ "FormAutoComplete:SelectBy",
+ "FormAutoComplete:GetSelectedIndex",
+ "FormAutoComplete:SetSelectedIndex",
+ "FormAutoComplete:MaybeOpenPopup",
+ "FormAutoComplete:ClosePopup",
+ "FormAutoComplete:Disconnect",
+ "FormAutoComplete:RemoveEntry",
+ "FormAutoComplete:Invalidate",
+ ],
+
+ init: function() {
+ for (let msg of this.MESSAGES) {
+ Services.mm.addMessageListener(msg, this);
+ }
+ },
+
+ uninit: function() {
+ for (let msg of this.MESSAGES) {
+ Services.mm.removeMessageListener(msg, this);
+ }
+ },
+
+ handleEvent: function(evt) {
+ switch (evt.type) {
+ case "popupshowing": {
+ this.sendMessageToBrowser("FormAutoComplete:PopupOpened");
+ break;
+ }
+
+ case "popuphidden": {
+ this.sendMessageToBrowser("FormAutoComplete:PopupClosed");
+ this.openedPopup = null;
+ this.weakBrowser = null;
+ evt.target.removeEventListener("popuphidden", this);
+ evt.target.removeEventListener("popupshowing", this);
+ break;
+ }
+ }
+ },
+
+ // Along with being called internally by the receiveMessage handler,
+ // this function is also called directly by the login manager, which
+ // uses a single message to fill in the autocomplete results. See
+ // "RemoteLogins:autoCompleteLogins".
+ showPopupWithResults: function({ browser, rect, dir, results }) {
+ if (!results.length || this.openedPopup) {
+ // We shouldn't ever be showing an empty popup, and if we
+ // already have a popup open, the old one needs to close before
+ // we consider opening a new one.
+ return;
+ }
+
+ let window = browser.ownerDocument.defaultView;
+ let tabbrowser = window.gBrowser;
+ if (Services.focus.activeWindow != window ||
+ tabbrowser.selectedBrowser != browser) {
+ // We were sent a message from a window or tab that went into the
+ // background, so we'll ignore it for now.
+ return;
+ }
+
+ this.weakBrowser = Cu.getWeakReference(browser);
+ this.openedPopup = browser.autoCompletePopup;
+ this.openedPopup.hidden = false;
+ // don't allow the popup to become overly narrow
+ this.openedPopup.setAttribute("width", Math.max(100, rect.width));
+ this.openedPopup.style.direction = dir;
+
+ AutoCompleteTreeView.setResults(results);
+ this.openedPopup.view = AutoCompleteTreeView;
+ this.openedPopup.selectedIndex = -1;
+ this.openedPopup.invalidate();
+
+ if (results.length) {
+ // Reset fields that were set from the last time the search popup was open
+ this.openedPopup.mInput = null;
+ this.openedPopup.showCommentColumn = false;
+ this.openedPopup.showImageColumn = false;
+ this.openedPopup.addEventListener("popuphidden", this);
+ this.openedPopup.addEventListener("popupshowing", this);
+ this.openedPopup.openPopupAtScreenRect("after_start", rect.left, rect.top,
+ rect.width, rect.height, false,
+ false);
+ } else {
+ this.closePopup();
+ }
+ },
+
+ invalidate(results) {
+ if (!this.openedPopup) {
+ return;
+ }
+
+ if (!results.length) {
+ this.closePopup();
+ } else {
+ AutoCompleteTreeView.setResults(results);
+ // We need to re-set the view in order for the
+ // tree to know the view has changed.
+ this.openedPopup.view = AutoCompleteTreeView;
+ this.openedPopup.invalidate();
+ }
+ },
+
+ closePopup() {
+ if (this.openedPopup) {
+ // Note that hidePopup() closes the popup immediately,
+ // so popuphiding or popuphidden events will be fired
+ // and handled during this call.
+ this.openedPopup.hidePopup();
+ }
+ AutoCompleteTreeView.clearResults();
+ },
+
+ removeLogin(login) {
+ Services.logins.removeLogin(login);
+ },
+
+ receiveMessage: function(message) {
+ if (!message.target.autoCompletePopup) {
+ // Returning false to pacify ESLint, but this return value is
+ // ignored by the messaging infrastructure.
+ return false;
+ }
+
+ switch (message.name) {
+ case "FormAutoComplete:SelectBy": {
+ this.openedPopup.selectBy(message.data.reverse, message.data.page);
+ break;
+ }
+
+ case "FormAutoComplete:GetSelectedIndex": {
+ if (this.openedPopup) {
+ return this.openedPopup.selectedIndex;
+ }
+ // If the popup was closed, then the selection
+ // has not changed.
+ return -1;
+ }
+
+ case "FormAutoComplete:SetSelectedIndex": {
+ let { index } = message.data;
+ if (this.openedPopup) {
+ this.openedPopup.selectedIndex = index;
+ }
+ break;
+ }
+
+ case "FormAutoComplete:MaybeOpenPopup": {
+ let { results, rect, dir } = message.data;
+ this.showPopupWithResults({ browser: message.target, rect, dir,
+ results });
+ break;
+ }
+
+ case "FormAutoComplete:Invalidate": {
+ let { results } = message.data;
+ this.invalidate(results);
+ break;
+ }
+
+ case "FormAutoComplete:ClosePopup": {
+ this.closePopup();
+ break;
+ }
+
+ case "FormAutoComplete:Disconnect": {
+ // The controller stopped controlling the current input, so clear
+ // any cached data. This is necessary cause otherwise we'd clear data
+ // only when starting a new search, but the next input could not support
+ // autocomplete and it would end up inheriting the existing data.
+ AutoCompleteTreeView.clearResults();
+ break;
+ }
+ }
+ // Returning false to pacify ESLint, but this return value is
+ // ignored by the messaging infrastructure.
+ return false;
+ },
+
+ /**
+ * Despite its name, this handleEnter is only called when the user clicks on
+ * one of the items in the popup since the popup is rendered in the parent process.
+ * The real controller's handleEnter is called directly in the content process
+ * for other methods of completing a selection (e.g. using the tab or enter
+ * keys) since the field with focus is in that process.
+ */
+ handleEnter(aIsPopupSelection) {
+ if (this.openedPopup) {
+ this.sendMessageToBrowser("FormAutoComplete:HandleEnter", {
+ selectedIndex: this.openedPopup.selectedIndex,
+ isPopupSelection: aIsPopupSelection,
+ });
+ }
+ },
+
+ /**
+ * If a browser exists that AutoCompletePopup knows about,
+ * sends it a message. Otherwise, this is a no-op.
+ *
+ * @param {string} msgName
+ * The name of the message to send.
+ * @param {object} data
+ * The optional data to send with the message.
+ */
+ sendMessageToBrowser(msgName, data) {
+ let browser = this.weakBrowser ? this.weakBrowser.get()
+ : null;
+ if (browser) {
+ browser.messageManager.sendAsyncMessage(msgName, data);
+ }
+ },
+
+ stopSearch: function() {}
+}
diff --git a/application/palemoon/modules/BrowserNewTabPreloader.jsm b/application/palemoon/modules/BrowserNewTabPreloader.jsm
index 719a9e05e2..778698fbaa 100644
--- a/application/palemoon/modules/BrowserNewTabPreloader.jsm
+++ b/application/palemoon/modules/BrowserNewTabPreloader.jsm
@@ -79,7 +79,7 @@ this.BrowserNewTabPreloader = {
Object.freeze(BrowserNewTabPreloader);
-let Initializer = {
+var Initializer = {
_timer: null,
_observing: false,
@@ -120,7 +120,7 @@ let Initializer = {
}
};
-let Preferences = {
+var Preferences = {
_enabled: null,
_branch: null,
@@ -157,7 +157,7 @@ let Preferences = {
},
};
-let HiddenBrowsers = {
+var HiddenBrowsers = {
_browsers: null,
_updateTimer: null,
@@ -379,7 +379,7 @@ HiddenBrowser.prototype = {
}
};
-let HostFrame = {
+var HostFrame = {
_frame: null,
_deferred: null,
diff --git a/application/palemoon/modules/FormSubmitObserver.jsm b/application/palemoon/modules/FormSubmitObserver.jsm
index 72c5ca601a..e4d3e765ed 100644
--- a/application/palemoon/modules/FormSubmitObserver.jsm
+++ b/application/palemoon/modules/FormSubmitObserver.jsm
@@ -9,14 +9,14 @@
"use strict";
-let Cc = Components.classes;
-let Ci = Components.interfaces;
-let Cu = Components.utils;
-
-let HTMLInputElement = Ci.nsIDOMHTMLInputElement;
-let HTMLTextAreaElement = Ci.nsIDOMHTMLTextAreaElement;
-let HTMLSelectElement = Ci.nsIDOMHTMLSelectElement;
-let HTMLButtonElement = Ci.nsIDOMHTMLButtonElement;
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cu = Components.utils;
+
+var HTMLInputElement = Ci.nsIDOMHTMLInputElement;
+var HTMLTextAreaElement = Ci.nsIDOMHTMLTextAreaElement;
+var HTMLSelectElement = Ci.nsIDOMHTMLSelectElement;
+var HTMLButtonElement = Ci.nsIDOMHTMLButtonElement;
this.EXPORTED_SYMBOLS = [ "FormSubmitObserver" ];
diff --git a/application/palemoon/modules/FormValidationHandler.jsm b/application/palemoon/modules/FormValidationHandler.jsm
index 05be510e18..387c221d74 100644
--- a/application/palemoon/modules/FormValidationHandler.jsm
+++ b/application/palemoon/modules/FormValidationHandler.jsm
@@ -8,15 +8,15 @@
"use strict";
-let Cc = Components.classes;
-let Ci = Components.interfaces;
-let Cu = Components.utils;
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+var Cu = Components.utils;
this.EXPORTED_SYMBOLS = [ "FormValidationHandler" ];
Cu.import("resource://gre/modules/Services.jsm");
-let FormValidationHandler =
+var FormValidationHandler =
{
_panel: null,
_anchor: null,
@@ -122,7 +122,7 @@ let FormValidationHandler =
this._panel.hidden = false;
let tabBrowser = aWindow.gBrowser;
- this._anchor = tabBrowser.formValidationAnchor;
+ this._anchor = tabBrowser.popupAnchor;
this._anchor.left = aPanelData.contentRect.left;
this._anchor.top = aPanelData.contentRect.top;
this._anchor.width = aPanelData.contentRect.width;
diff --git a/application/palemoon/modules/NetworkPrioritizer.jsm b/application/palemoon/modules/NetworkPrioritizer.jsm
index ea4a877904..23d688a305 100644
--- a/application/palemoon/modules/NetworkPrioritizer.jsm
+++ b/application/palemoon/modules/NetworkPrioritizer.jsm
@@ -34,8 +34,8 @@ const PRIORITY_DELTA = -10;
// Variables
-let _lastFocusedWindow = null;
-let _windows = [];
+var _lastFocusedWindow = null;
+var _windows = [];
// Exported symbol
@@ -64,7 +64,7 @@ function _handleEvent(aEvent) {
// Methods that impact a browser. Put into single object for organization.
-let BrowserHelper = {
+var BrowserHelper = {
onOpen: function NP_BH_onOpen(aBrowser) {
// If the tab is in the focused window, leave priority as it is
if (aBrowser.ownerDocument.defaultView != _lastFocusedWindow)
@@ -91,7 +91,7 @@ let BrowserHelper = {
// Methods that impact a window. Put into single object for organization.
-let WindowHelper = {
+var WindowHelper = {
addWindow: function NP_WH_addWindow(aWindow) {
// Build internal data object
_windows.push({ window: aWindow, lastSelectedBrowser: null });
diff --git a/application/palemoon/modules/PopupNotifications.jsm b/application/palemoon/modules/PopupNotifications.jsm
index 9b2e8e5d16..0cb9702301 100644
--- a/application/palemoon/modules/PopupNotifications.jsm
+++ b/application/palemoon/modules/PopupNotifications.jsm
@@ -4,22 +4,23 @@
this.EXPORTED_SYMBOLS = ["PopupNotifications"];
-var Cc = Components.classes, Ci = Components.interfaces;
+var Cc = Components.classes, Ci = Components.interfaces, Cu = Components.utils;
-Components.utils.import("resource://gre/modules/Services.jsm");
+Cu.import("resource://gre/modules/Services.jsm");
const NOTIFICATION_EVENT_DISMISSED = "dismissed";
const NOTIFICATION_EVENT_REMOVED = "removed";
const NOTIFICATION_EVENT_SHOWING = "showing";
const NOTIFICATION_EVENT_SHOWN = "shown";
+const NOTIFICATION_EVENT_SWAPPING = "swapping";
const ICON_SELECTOR = ".notification-anchor-icon";
const ICON_ATTRIBUTE_SHOWING = "showing";
const PREF_SECURITY_DELAY = "security.notification_enable_delay";
-let popupNotificationsMap = new WeakMap();
-let gNotificationParents = new WeakMap;
+var popupNotificationsMap = new WeakMap();
+var gNotificationParents = new WeakMap;
function getAnchorFromBrowser(aBrowser) {
let anchor = aBrowser.getAttribute("popupnotificationanchor") ||
@@ -33,6 +34,18 @@ function getAnchorFromBrowser(aBrowser) {
return null;
}
+function getNotificationFromElement(aElement) {
+ // Need to find the associated notification object, which is a bit tricky
+ // since it isn't associated with the element directly - this is kind of
+ // gross and very dependent on the structure of the popupnotification
+ // binding's content.
+ let notificationEl;
+ let parent = aElement;
+ while (parent && (parent = aElement.ownerDocument.getBindingParent(parent)))
+ notificationEl = parent;
+ return notificationEl;
+}
+
/**
* Notification object describes a single popup notification.
*
@@ -194,7 +207,8 @@ PopupNotifications.prototype = {
* - label (string): the button's label.
* - accessKey (string): the button's accessKey.
* - callback (function): a callback to be invoked when the button is
- * pressed.
+ * pressed, is passed an object that contains the following fields:
+ * - checkboxChecked: (boolean) If the optional checkbox is checked.
* If null, the notification will not have a button, and
* secondaryActions will be ignored.
* @param secondaryActions
@@ -224,9 +238,23 @@ PopupNotifications.prototype = {
* tabs)
* "removed": notification has been removed (due to
* location change or user action)
+ * "showing": notification is about to be shown
+ * (this can be fired multiple times as
+ * notifications are dismissed and re-shown)
* "shown": notification has been shown (this can be fired
* multiple times as notifications are dismissed
* and re-shown)
+ * "swapping": the docshell of the browser that created
+ * the notification is about to be swapped to
+ * another browser. A second parameter contains
+ * the browser that is receiving the docshell,
+ * so that the event callback can transfer stuff
+ * specific to this notification.
+ * If the callback returns true, the notification
+ * will be moved to the new browser.
+ * If the callback isn't implemented, returns false,
+ * or doesn't return any value, the notification
+ * will be removed.
* neverShow: Indicate that no popup should be shown for this
* notification. Useful for just showing the anchor icon.
* removeOnDismissal:
@@ -234,6 +262,26 @@ PopupNotifications.prototype = {
* removed when they would have otherwise been dismissed
* (i.e. any time the popup is closed due to user
* interaction).
+ * checkbox: An object that allows you to add a checkbox and
+ * control its behavior with these fields:
+ * label:
+ * (required) Label to be shown next to the checkbox.
+ * checked:
+ * (optional) Whether the checkbox should be checked
+ * by default. Defaults to false.
+ * checkedState:
+ * (optional) An object that allows you to customize
+ * the notification state when the checkbox is checked.
+ * disableMainAction:
+ * (optional) Whether the mainAction is disabled.
+ * Defaults to false.
+ * warningLabel:
+ * (optional) A (warning) text that is shown below the
+ * checkbox. Pass null to hide.
+ * uncheckedState:
+ * (optional) An object that allows you to customize
+ * the notification state when the checkbox is not checked.
+ * Has the same attributes as checkedState.
* popupIconURL:
* A string. URL of the image to be displayed in the popup.
* Normally specified in CSS using list-style-image and the
@@ -552,6 +600,25 @@ PopupNotifications.prototype = {
}
}
+ let checkbox = n.options.checkbox;
+ if (checkbox && checkbox.label) {
+ let checked = n._checkboxChecked != null ? n._checkboxChecked : !!checkbox.checked;
+
+ popupnotification.setAttribute("checkboxhidden", "false");
+ popupnotification.setAttribute("checkboxchecked", checked);
+ popupnotification.setAttribute("checkboxlabel", checkbox.label);
+
+ popupnotification.setAttribute("checkboxcommand", "PopupNotifications._onCheckboxCommand(event);");
+
+ if (checked) {
+ this._setNotificationUIState(popupnotification, checkbox.checkedState);
+ } else {
+ this._setNotificationUIState(popupnotification, checkbox.uncheckedState);
+ }
+ } else {
+ popupnotification.setAttribute("checkboxhidden", "true");
+ }
+
this.panel.appendChild(popupnotification);
// The popupnotification may be hidden if we got it from the chrome
@@ -560,6 +627,32 @@ PopupNotifications.prototype = {
}, this);
},
+ _setNotificationUIState(notification, state={}) {
+ notification.setAttribute("mainactiondisabled", state.disableMainAction || "false");
+
+ if (state.warningLabel) {
+ notification.setAttribute("warninglabel", state.warningLabel);
+ notification.setAttribute("warninghidden", "false");
+ } else {
+ notification.setAttribute("warninghidden", "true");
+ }
+ },
+
+ _onCheckboxCommand(event) {
+ let notificationEl = getNotificationFromElement(event.originalTarget);
+ let checked = notificationEl.checkbox.checked;
+ let notification = notificationEl.notification;
+
+ // Save checkbox state to be able to persist it when re-opening the doorhanger.
+ notification._checkboxChecked = checked;
+
+ if (checked) {
+ this._setNotificationUIState(notificationEl, notification.options.checkbox.checkedState);
+ } else {
+ this._setNotificationUIState(notificationEl, notification.options.checkbox.uncheckedState);
+ }
+ },
+
_showPanel: function PopupNotifications_showPanel(notificationsToShow, anchorElement) {
this.panel.hidden = false;
@@ -751,9 +844,60 @@ PopupNotifications.prototype = {
this._update(notifications, anchor);
},
- _fireCallback: function PopupNotifications_fireCallback(n, event) {
- if (n.options.eventCallback)
- n.options.eventCallback.call(n, event);
+ _swapBrowserNotifications: function PopupNotifications_swapBrowserNoficications(ourBrowser, otherBrowser) {
+ // When swaping browser docshells (e.g. dragging tab to new window) we need
+ // to update our notification map.
+
+ let ourNotifications = this._getNotificationsForBrowser(ourBrowser);
+ let other = otherBrowser.ownerDocument.defaultView.PopupNotifications;
+ if (!other) {
+ if (ourNotifications.length > 0)
+ Cu.reportError("unable to swap notifications: otherBrowser doesn't support notifications");
+ return;
+ }
+ let otherNotifications = other._getNotificationsForBrowser(otherBrowser);
+ if (ourNotifications.length < 1 && otherNotifications.length < 1) {
+ // No notification to swap.
+ return;
+ }
+
+ otherNotifications = otherNotifications.filter(n => {
+ if (this._fireCallback(n, NOTIFICATION_EVENT_SWAPPING, ourBrowser)) {
+ n.browser = ourBrowser;
+ n.owner = this;
+ return true;
+ }
+ other._fireCallback(n, NOTIFICATION_EVENT_REMOVED);
+ return false;
+ });
+
+ ourNotifications = ourNotifications.filter(n => {
+ if (this._fireCallback(n, NOTIFICATION_EVENT_SWAPPING, otherBrowser)) {
+ n.browser = otherBrowser;
+ n.owner = other;
+ return true;
+ }
+ this._fireCallback(n, NOTIFICATION_EVENT_REMOVED);
+ return false;
+ });
+
+ this._setNotificationsForBrowser(otherBrowser, ourNotifications);
+ other._setNotificationsForBrowser(ourBrowser, otherNotifications);
+
+ if (otherNotifications.length > 0)
+ this._update(otherNotifications, otherNotifications[0].anchorElement);
+ if (ourNotifications.length > 0)
+ other._update(ourNotifications, ourNotifications[0].anchorElement);
+ },
+
+ _fireCallback: function PopupNotifications_fireCallback(n, event, ...args) {
+ try {
+ if (n.options.eventCallback)
+ return n.options.eventCallback.call(n, event, ...args);
+ } catch (error) {
+ Cu.reportError(error);
+ }
+ return undefined;
},
_onPopupHidden: function PopupNotifications_onPopupHidden(event) {
@@ -789,15 +933,7 @@ PopupNotifications.prototype = {
},
_onButtonCommand: function PopupNotifications_onButtonCommand(event) {
- // Need to find the associated notification object, which is a bit tricky
- // since it isn't associated with the button directly - this is kind of
- // gross and very dependent on the structure of the popupnotification
- // binding's content.
- let target = event.originalTarget;
- let notificationEl;
- let parent = target;
- while (parent && (parent = target.ownerDocument.getBindingParent(parent)))
- notificationEl = parent;
+ let notificationEl = getNotificationFromElement(event.originalTarget);
if (!notificationEl)
throw "PopupNotifications_onButtonCommand: couldn't find notification element";
@@ -819,7 +955,14 @@ PopupNotifications.prototype = {
timeSinceShown + "ms");
return;
}
- notification.mainAction.callback.call();
+
+ try {
+ notification.mainAction.callback.call(undefined, {
+ checkboxChecked: notificationEl.checkbox.checked
+ });
+ } catch (error) {
+ Cu.reportError(error);
+ }
this._remove(notification);
this._update();
@@ -830,8 +973,16 @@ PopupNotifications.prototype = {
if (!target.action || !target.notification)
throw "menucommand target has no associated action/notification";
+ let notificationEl = target.parentElement;
event.stopPropagation();
- target.action.callback.call();
+
+ try {
+ target.action.callback.call(undefined, {
+ checkboxChecked: notificationEl.checkbox.checked
+ });
+ } catch (error) {
+ Cu.reportError(error);
+ }
this._remove(target.notification);
this._update();
diff --git a/application/palemoon/modules/QuotaManager.jsm b/application/palemoon/modules/QuotaManager.jsm
index e03161a693..48cfe88b3b 100644
--- a/application/palemoon/modules/QuotaManager.jsm
+++ b/application/palemoon/modules/QuotaManager.jsm
@@ -6,8 +6,9 @@ this.EXPORTED_SYMBOLS = ["QuotaManagerHelper"];
Components.utils.import('resource://gre/modules/Services.jsm');
-const Cc = Components.classes;
const Ci = Components.interfaces;
+const Cc = Components.classes;
+const Cu = Components.utils;
this.QuotaManagerHelper = {
clear: function(isShutDown) {
@@ -34,12 +35,17 @@ this.QuotaManagerHelper = {
}
}
}
- var qm = Cc["@mozilla.org/dom/quota/manager;1"].getService(Ci.nsIQuotaManager);
+ var qm = Cc["@mozilla.org/dom/quota-manager-service;1"]
+ .getService(Ci.nsIQuotaManagerService);
for (var dom in doms) {
var uri = Services.io.newURI(dom, null, null);
- qm.clearStoragesForURI(uri);
+ let principal = Services.scriptSecurityManager
+ .createCodebasePrincipal(uri, {});
+ qm.clearStoragesForPrincipal(principal);
}
}
- } catch(er) {}
+ } catch(er) {
+ Cu.reportError(er);
+ }
}
};
diff --git a/application/palemoon/modules/SharedFrame.jsm b/application/palemoon/modules/SharedFrame.jsm
index 4d248ae5ba..b9d59bfa98 100644
--- a/application/palemoon/modules/SharedFrame.jsm
+++ b/application/palemoon/modules/SharedFrame.jsm
@@ -18,7 +18,7 @@ const Cu = Components.utils;
* when another one of the placeholder is meant to be displayed.
* */
-let Frames = new Map();
+var Frames = new Map();
/**
* The Frames map is the main data structure that holds information
diff --git a/application/palemoon/modules/WindowsPreviewPerTab.jsm b/application/palemoon/modules/WindowsPreviewPerTab.jsm
index 41b38f0cf9..c1ed05c39e 100644
--- a/application/palemoon/modules/WindowsPreviewPerTab.jsm
+++ b/application/palemoon/modules/WindowsPreviewPerTab.jsm
@@ -62,9 +62,6 @@ const WINTASKBAR_CONTRACTID = "@mozilla.org/windows-taskbar;1";
////////////////////////////////////////////////////////////////////////////////
//// Various utility properties
-XPCOMUtils.defineLazyServiceGetter(this, "ioSvc",
- "@mozilla.org/network/io-service;1",
- "nsIIOService");
XPCOMUtils.defineLazyServiceGetter(this, "imgTools",
"@mozilla.org/image/tools;1",
"imgITools");
@@ -73,8 +70,13 @@ XPCOMUtils.defineLazyServiceGetter(this, "faviconSvc",
"nsIFaviconService");
// nsIURI -> imgIContainer
-function _imageFromURI(uri, privateMode, callback) {
- let channel = ioSvc.newChannelFromURI(uri);
+function _imageFromURI(doc, uri, privateMode, callback) {
+ let channel = NetUtil.newChannel({
+ uri: uri,
+ loadUsingSystemPrincipal: true,
+ contentPolicyType: Ci.nsIContentPolicy.TYPE_INTERNAL_IMAGE
+ });
+
try {
channel.QueryInterface(Ci.nsIPrivateBrowsingChannel);
channel.setPrivate(privateMode);
@@ -93,17 +95,17 @@ function _imageFromURI(uri, privateMode, callback) {
// favicon).
let defaultURI = faviconSvc.defaultFavicon;
if (!defaultURI.equals(uri))
- _imageFromURI(defaultURI, callback);
+ _imageFromURI(doc, defaultURI, privateMode, callback);
}
});
}
// string? -> imgIContainer
-function getFaviconAsImage(iconurl, privateMode, callback) {
+function getFaviconAsImage(doc, iconurl, privateMode, callback) {
if (iconurl)
- _imageFromURI(NetUtil.newURI(iconurl), privateMode, callback);
+ _imageFromURI(doc, NetUtil.newURI(iconurl), privateMode, callback);
else
- _imageFromURI(faviconSvc.defaultFavicon, privateMode, callback);
+ _imageFromURI(doc, faviconSvc.defaultFavicon, privateMode, callback);
}
// Snaps the given rectangle to be pixel-aligned at the given scale
@@ -460,12 +462,16 @@ TabWindow.prototype = {
preview.visible = AeroPeek.enabled;
preview.active = this.tabbrowser.selectedTab == controller.tab;
// Grab the default favicon
- getFaviconAsImage(null, PrivateBrowsingUtils.isWindowPrivate(this.win), function (img) {
- // It is possible that we've already gotten the real favicon, so make sure
- // we have not set one before setting this default one.
- if (!preview.icon)
- preview.icon = img;
- });
+ getFaviconAsImage(
+ controller.linkedBrowser.contentWindow.document,
+ null,
+ PrivateBrowsingUtils.isWindowPrivate(this.win),
+ function (img) {
+ // It is possible that we've already gotten the real favicon, so make sure
+ // we have not set one before setting this default one.
+ if (!preview.icon)
+ preview.icon = img;
+ });
return preview;
},
@@ -510,7 +516,14 @@ TabWindow.prototype = {
// Previews are internally stored using a map, so we need to iterate over
// the tabbrowser's array of tabs to retrieve previews in the same order.
- let inorder = [previews.get(t) for (t of tabs) if (previews.has(t))];
+ // Tycho: let inorder = [previews.get(t) for (t of tabs) if (previews.has(t))];
+ let inorder = [];
+
+ for (let t of tabs) {
+ if (previews.has(t)) {
+ inorder.push(previews.get(t));
+ }
+ }
// Since the internal taskbar array has not yet been updated, we must force
// the sorting order of our local array on it. To do so, we must walk
@@ -545,14 +558,17 @@ TabWindow.prototype = {
//// Browser progress listener
onLinkIconAvailable: function (aBrowser, aIconURL) {
let self = this;
- getFaviconAsImage(aIconURL, PrivateBrowsingUtils.isWindowPrivate(this.win), function (img) {
- let index = self.tabbrowser.browsers.indexOf(aBrowser);
- // Only add it if we've found the index. The tab could have closed!
- if (index != -1) {
- let tab = self.tabbrowser.tabs[index];
- self.previews.get(tab).icon = img;
- }
- });
+ getFaviconAsImage(
+ aBrowser.contentWindow.document,
+ aIconURL,PrivateBrowsingUtils.isWindowPrivate(this.win),
+ function (img) {
+ let index = self.tabbrowser.browsers.indexOf(aBrowser);
+ // Only add it if we've found the index. The tab could have closed!
+ if (index != -1) {
+ let tab = self.tabbrowser.tabs[index];
+ self.previews.get(tab).icon = img;
+ }
+ });
}
}
diff --git a/application/palemoon/modules/moz.build b/application/palemoon/modules/moz.build
index b3459bcd5a..67fd22338f 100644
--- a/application/palemoon/modules/moz.build
+++ b/application/palemoon/modules/moz.build
@@ -9,6 +9,7 @@
EXTRA_JS_MODULES += [ 'promise.js' ]
EXTRA_JS_MODULES += [
+ 'AutoCompletePopup.jsm',
'BrowserNewTabPreloader.jsm',
'CharsetMenu.jsm',
'FormSubmitObserver.jsm',
@@ -19,10 +20,12 @@ EXTRA_JS_MODULES += [
'PageMenu.jsm',
'PopupNotifications.jsm',
'QuotaManager.jsm',
- 'SharedFrame.jsm',
- 'webrtcUI.jsm'
+ 'SharedFrame.jsm'
]
+if CONFIG['MOZ_WEBRTC']:
+ EXTRA_JS_MODULES += ['webrtcUI.jsm']
+
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
EXTRA_JS_MODULES += [
'Windows8WindowFrameColor.jsm',
@@ -35,5 +38,8 @@ EXTRA_PP_JS_MODULES += [
'RecentWindow.jsm',
]
+# Pass down 'official build' flags
+if CONFIG['MC_OFFICIAL']:
+ DEFINES['MC_OFFICIAL'] = 1
if CONFIG['MOZILLA_OFFICIAL']:
- DEFINES['MOZILLA_OFFICIAL'] = 1 \ No newline at end of file
+ DEFINES['MOZILLA_OFFICIAL'] = 1
diff --git a/application/palemoon/modules/openLocationLastURL.jsm b/application/palemoon/modules/openLocationLastURL.jsm
index 0d653df28b..3f58db8ceb 100644
--- a/application/palemoon/modules/openLocationLastURL.jsm
+++ b/application/palemoon/modules/openLocationLastURL.jsm
@@ -10,11 +10,11 @@ Components.utils.import("resource://gre/modules/PrivateBrowsingUtils.jsm");
this.EXPORTED_SYMBOLS = [ "OpenLocationLastURL" ];
-let prefSvc = Components.classes["@mozilla.org/preferences-service;1"]
+var prefSvc = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
-let gOpenLocationLastURLData = "";
+var gOpenLocationLastURLData = "";
-let observer = {
+var observer = {
QueryInterface: function (aIID) {
if (aIID.equals(Components.interfaces.nsIObserver) ||
aIID.equals(Components.interfaces.nsISupports) ||
@@ -35,7 +35,7 @@ let observer = {
}
};
-let os = Components.classes["@mozilla.org/observer-service;1"]
+var os = Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
os.addObserver(observer, "last-pb-context-exited", true);
os.addObserver(observer, "browser:purge-session-history", true);
diff --git a/application/palemoon/modules/promise.js b/application/palemoon/modules/promise.js
index 7c96f02cf5..74065c8db5 100644
--- a/application/palemoon/modules/promise.js
+++ b/application/palemoon/modules/promise.js
@@ -24,7 +24,7 @@ module.metadata = {
'stability': 'unstable'
};
-let promised = (function() {
+var promised = (function() {
// Note: Define shortcuts and utility functions here in order to avoid
// slower property accesses and unnecessary closure creations on each
// call of this popular function.
diff --git a/application/palemoon/modules/webrtcUI.jsm b/application/palemoon/modules/webrtcUI.jsm
index c957bfd9ab..819ca181f1 100644
--- a/application/palemoon/modules/webrtcUI.jsm
+++ b/application/palemoon/modules/webrtcUI.jsm
@@ -11,9 +11,11 @@ const Cc = Components.classes;
const Ci = Components.interfaces;
Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/PluralForm.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
+ "resource://gre/modules/PluralForm.jsm");
+
XPCOMUtils.defineLazyServiceGetter(this, "MediaManagerService",
"@mozilla.org/mediaManagerService;1",
"nsIMediaManagerService");
@@ -128,62 +130,14 @@ function prompt(aWindowID, aCallID, aAudioRequested, aVideoRequested, aDevices)
let message = stringBundle.getFormattedString("getUserMedia.share" + requestType + ".message",
[ host ]);
- function listDevices(menupopup, devices) {
- while (menupopup.lastChild)
- menupopup.removeChild(menupopup.lastChild);
-
- let deviceIndex = 0;
- for (let device of devices) {
- addDeviceToList(menupopup, device.name, deviceIndex);
- deviceIndex++;
- }
- }
-
- function addDeviceToList(menupopup, deviceName, deviceIndex) {
- let menuitem = chromeDoc.createElement("menuitem");
- menuitem.setAttribute("value", deviceIndex);
- menuitem.setAttribute("label", deviceName);
- menuitem.setAttribute("tooltiptext", deviceName);
- menupopup.appendChild(menuitem);
- }
-
- chromeDoc.getElementById("webRTC-selectCamera").hidden = !videoDevices.length;
- chromeDoc.getElementById("webRTC-selectMicrophone").hidden = !audioDevices.length;
-
- let camMenupopup = chromeDoc.getElementById("webRTC-selectCamera-menupopup");
- let micMenupopup = chromeDoc.getElementById("webRTC-selectMicrophone-menupopup");
- listDevices(camMenupopup, videoDevices);
- listDevices(micMenupopup, audioDevices);
- if (requestType == "CameraAndMicrophone") {
- addDeviceToList(camMenupopup, stringBundle.getString("getUserMedia.noVideo.label"), "-1");
- addDeviceToList(micMenupopup, stringBundle.getString("getUserMedia.noAudio.label"), "-1");
- }
-
let mainAction = {
label: PluralForm.get(requestType == "CameraAndMicrophone" ? 2 : 1,
stringBundle.getString("getUserMedia.shareSelectedDevices.label")),
accessKey: stringBundle.getString("getUserMedia.shareSelectedDevices.accesskey"),
- callback: function () {
- let allowedDevices = Cc["@mozilla.org/supports-array;1"]
- .createInstance(Ci.nsISupportsArray);
- if (videoDevices.length) {
- let videoDeviceIndex = chromeDoc.getElementById("webRTC-selectCamera-menulist").value;
- if (videoDeviceIndex != "-1")
- allowedDevices.AppendElement(videoDevices[videoDeviceIndex]);
- }
- if (audioDevices.length) {
- let audioDeviceIndex = chromeDoc.getElementById("webRTC-selectMicrophone-menulist").value;
- if (audioDeviceIndex != "-1")
- allowedDevices.AppendElement(audioDevices[audioDeviceIndex]);
- }
-
- if (allowedDevices.Count() == 0) {
- denyRequest(aCallID);
- return;
- }
-
- Services.obs.notifyObservers(allowedDevices, "getUserMedia:response:allow", aCallID);
- }
+ // The real callback will be set during the "showing" event. The
+ // empty function here is so that PopupNotifications.show doesn't
+ // reject the action.
+ callback: function() {}
};
let secondaryActions = [{
@@ -194,7 +148,72 @@ function prompt(aWindowID, aCallID, aAudioRequested, aVideoRequested, aDevices)
}
}];
- let options = null;
+ let options = {
+ eventCallback: function(aTopic, aNewBrowser) {
+ if (aTopic == "swapping")
+ return true;
+
+ if (aTopic != "showing")
+ return false;
+
+ let chromeDoc = this.browser.ownerDocument;
+
+ function listDevices(menupopup, devices) {
+ while (menupopup.lastChild)
+ menupopup.removeChild(menupopup.lastChild);
+
+ let deviceIndex = 0;
+ for (let device of devices) {
+ addDeviceToList(menupopup, device.name, deviceIndex);
+ deviceIndex++;
+ }
+ }
+
+ function addDeviceToList(menupopup, deviceName, deviceIndex) {
+ let menuitem = chromeDoc.createElement("menuitem");
+ menuitem.setAttribute("value", deviceIndex);
+ menuitem.setAttribute("label", deviceName);
+ menuitem.setAttribute("tooltiptext", deviceName);
+ menupopup.appendChild(menuitem);
+ }
+
+ chromeDoc.getElementById("webRTC-selectCamera").hidden = !videoDevices.length;
+ chromeDoc.getElementById("webRTC-selectMicrophone").hidden = !audioDevices.length;
+
+ let camMenupopup = chromeDoc.getElementById("webRTC-selectCamera-menupopup");
+ let micMenupopup = chromeDoc.getElementById("webRTC-selectMicrophone-menupopup");
+ listDevices(camMenupopup, videoDevices);
+ listDevices(micMenupopup, audioDevices);
+ if (requestType == "CameraAndMicrophone") {
+ let stringBundle = chromeDoc.defaultView.gNavigatorBundle;
+ addDeviceToList(camMenupopup, stringBundle.getString("getUserMedia.noVideo.label"), "-1");
+ addDeviceToList(micMenupopup, stringBundle.getString("getUserMedia.noAudio.label"), "-1");
+ }
+
+ this.mainAction.callback = function() {
+ let allowedDevices = Cc["@mozilla.org/supports-array;1"]
+ .createInstance(Ci.nsISupportsArray);
+ if (videoDevices.length) {
+ let videoDeviceIndex = chromeDoc.getElementById("webRTC-selectCamera-menulist").value;
+ if (videoDeviceIndex != "-1")
+ allowedDevices.AppendElement(videoDevices[videoDeviceIndex]);
+ }
+ if (audioDevices.length) {
+ let audioDeviceIndex = chromeDoc.getElementById("webRTC-selectMicrophone-menulist").value;
+ if (audioDeviceIndex != "-1")
+ allowedDevices.AppendElement(audioDevices[audioDeviceIndex]);
+ }
+
+ if (allowedDevices.Count() == 0) {
+ denyRequest(aCallID);
+ return;
+ }
+
+ Services.obs.notifyObservers(allowedDevices, "getUserMedia:response:allow", aCallID);
+ };
+ return true;
+ }
+ };
chromeWin.PopupNotifications.show(browser, "webRTC-shareDevices", message,
"webRTC-shareDevices-notification-icon", mainAction,
@@ -254,7 +273,8 @@ function showBrowserSpecificIndicator(aBrowser) {
}];
let options = {
hideNotNow: true,
- dismissed: true
+ dismissed: true,
+ eventCallback: function(aTopic) aTopic == "swapping"
};
chromeWin.PopupNotifications.show(aBrowser, "webRTC-sharingDevices", message,
"webRTC-sharingDevices-notification-icon", mainAction,
diff --git a/application/palemoon/moz.configure b/application/palemoon/moz.configure
new file mode 100644
index 0000000000..72236254f1
--- /dev/null
+++ b/application/palemoon/moz.configure
@@ -0,0 +1,7 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+include('../../toolkit/moz.configure')
diff --git a/application/palemoon/themes/linux/Push-16.png b/application/palemoon/themes/linux/Push-16.png
new file mode 100644
index 0000000000..082b177811
--- /dev/null
+++ b/application/palemoon/themes/linux/Push-16.png
Binary files differ
diff --git a/application/palemoon/themes/linux/Push-64.png b/application/palemoon/themes/linux/Push-64.png
new file mode 100644
index 0000000000..6e09ab9c32
--- /dev/null
+++ b/application/palemoon/themes/linux/Push-64.png
Binary files differ
diff --git a/application/palemoon/themes/linux/autocomplete.css b/application/palemoon/themes/linux/autocomplete.css
new file mode 100644
index 0000000000..ab926851dc
--- /dev/null
+++ b/application/palemoon/themes/linux/autocomplete.css
@@ -0,0 +1,210 @@
+/* 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/. */
+
+/* ===== autocomplete.css =================================================
+ == Styles used by the autocomplete widget.
+ ======================================================================= */
+
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+@namespace html url("http://www.w3.org/1999/xhtml");
+
+/* ::::: autocomplete ::::: */
+
+/* .padded is used by autocomplete widgets that don't have an icon. Gross. -dwh */
+textbox:not(.padded) {
+ cursor: default;
+ padding: 0;
+}
+
+textbox[enablehistory="true"] {
+ -moz-appearance: none;
+ border: 0;
+ background-color: transparent;
+}
+
+textbox[nomatch="true"][highlightnonmatches="true"] {
+ color: red;
+}
+
+.private-autocomplete-textbox-container {
+ -moz-box-align: center;
+}
+
+textbox[enablehistory="true"] > .autocomplete-textbox-container {
+ -moz-appearance: menulist-textfield;
+}
+
+textbox:not(.padded) .textbox-input-box {
+ margin: 0 3px;
+}
+
+.textbox-input-box {
+ -moz-box-align: center;
+}
+
+/* ::::: autocomplete popups ::::: */
+
+panel[type="private-autocomplete"],
+panel[type="private-autocomplete-richlistbox"],
+.private-autocomplete-history-popup {
+ border-width: 1px;
+ -moz-border-top-colors: ThreeDDarkShadow;
+ -moz-border-right-colors: ThreeDDarkShadow;
+ -moz-border-bottom-colors: ThreeDDarkShadow;
+ -moz-border-left-colors: ThreeDDarkShadow;
+ padding: 0;
+ background-color: -moz-Field;
+}
+
+.private-autocomplete-history-popup {
+ max-height: 180px;
+}
+
+/* ::::: tree ::::: */
+
+.private-autocomplete-tree {
+ -moz-appearance: none !important;
+ border: none !important;
+ background-color: transparent !important;
+ color: MenuText;
+}
+
+.private-autocomplete-treecol {
+ -moz-appearance: none !important;
+ margin: 0 !important;
+ border: none !important;
+ padding: 0 !important;
+}
+
+/* GTK calculates space for a sort arrow */
+.private-autocomplete-treecol > .treecol-sortdirection {
+ -moz-appearance: none !important;
+}
+
+.private-autocomplete-treebody::-moz-tree-cell-text {
+ -moz-padding-start: 8px;
+}
+
+treechildren.private-autocomplete-treebody::-moz-tree-row(selected) {
+ background-color: Highlight;
+}
+
+treechildren.private-autocomplete-treebody::-moz-tree-cell-text(selected) {
+ color: HighlightText !important;
+}
+
+.private-autocomplete-treebody::-moz-tree-image(treecolAutoCompleteValue) {
+ max-width: 16px;
+ height: 16px;
+}
+
+/* ::::: richlistbox autocomplete ::::: */
+
+.private-autocomplete-richlistbox {
+ -moz-appearance: none;
+ margin: 1px;
+ background-color: transparent;
+}
+
+.private-autocomplete-richlistitem[selected="true"] {
+ background-color: Highlight;
+ color: HighlightText;
+}
+
+.private-autocomplete-richlistitem {
+ padding: 6px 2px;
+ color: MenuText;
+}
+
+.ac-url-box {
+ /* When setting a vertical margin here, half of that needs to be added
+ .ac-title-box's translateY for when .ac-url-box is hidden (see below). */
+ margin-top: 1px;
+}
+
+.private-autocomplete-richlistitem[actiontype="keyword"] .ac-url-box,
+.private-autocomplete-richlistitem[actiontype="searchengine"] .ac-url-box,
+.private-autocomplete-richlistitem[actiontype="visiturl"] .ac-url-box,
+.private-autocomplete-richlistitem[type~="autofill"] .ac-url-box {
+ visibility: hidden;
+}
+
+.private-autocomplete-richlistitem[actiontype="keyword"] .ac-title-box,
+.private-autocomplete-richlistitem[actiontype="searchengine"] .ac-title-box,
+.private-autocomplete-richlistitem[actiontype="visiturl"] .ac-title-box,
+.private-autocomplete-richlistitem[type~="autofill"] .ac-title-box {
+ /* Center the title by moving it down by half of .ac-url-box's height,
+ including vertical margins (if any). */
+ transform: translateY(.5em);
+}
+
+.ac-site-icon {
+ width: 16px;
+ height: 16px;
+ margin-bottom: -2px;
+ -moz-margin-start: 3px;
+ -moz-margin-end: 6px;
+}
+
+.ac-type-icon {
+ width: 16px;
+ height: 16px;
+ -moz-margin-start: 6px;
+ -moz-margin-end: 4px;
+}
+
+.ac-extra > .ac-result-type-tag {
+ margin: 0 4px;
+}
+
+.ac-extra > .ac-comment {
+ padding-right: 4px;
+}
+
+.ac-ellipsis-after {
+ margin: 0 !important;
+ padding: 0;
+ min-width: 1em;
+}
+
+.ac-normal-text {
+ margin: 0 !important;
+ padding: 0;
+}
+
+.ac-normal-text > html|span {
+ margin: 0 !important;
+ padding: 0;
+}
+
+html|span.ac-emphasize-text {
+ box-shadow: inset 0 0 1px 1px rgba(0,0,0,0.1);
+ background-color: rgba(0,0,0,0.05);
+ border-radius: 2px;
+ text-shadow: 0 0 currentColor; /*faux bold effect*/
+}
+
+.ac-url-text > html|span.ac-emphasize-text,
+.ac-action-text > html|span.ac-emphasize-text {
+ box-shadow: none;
+}
+
+.ac-normal-text[selected="true"] > html|span.ac-emphasize-text {
+ box-shadow: inset 0 0 1px 1px rgba(255,255,255,0.3);
+ background-color: rgba(255,255,255,0.2);
+}
+
+.ac-title, .ac-url {
+ overflow: hidden;
+}
+
+/* ::::: textboxes inside toolbarpaletteitems ::::: */
+
+toolbarpaletteitem > toolbaritem > textbox > hbox > hbox > html|*.textbox-input {
+ visibility: hidden;
+}
+
+toolbarpaletteitem > toolbaritem > * > textbox > hbox > hbox > html|*.textbox-input {
+ visibility: hidden;
+}
diff --git a/application/palemoon/themes/linux/browser.css b/application/palemoon/themes/linux/browser.css
index 07e9dae9cc..131a63a901 100644
--- a/application/palemoon/themes/linux/browser.css
+++ b/application/palemoon/themes/linux/browser.css
@@ -728,9 +728,11 @@ toolbar[mode="full"] .toolbarbutton-1 > .toolbarbutton-menubutton-button {
opacity: .4;
}
+%ifdef MOZ_WEBRTC
#webrtc-status-button {
-moz-image-region: rect(0px 192px 24px 168px);
}
+%endif
/* 16px primary toolbar buttons */
toolbar[iconsize="small"] .toolbarbutton-1:not([type="menu-button"]) {
@@ -812,7 +814,9 @@ toolbar[iconsize="small"] #downloads-button {
-moz-image-region: rect(0px 16px 16px 0px);
}
+%ifdef MOZ_WEBRTC
toolbar[iconsize="small"] #webrtc-status-button /* temporary placeholder (bug 824825) */,
+%endif
toolbar[iconsize="small"] #history-button,
toolbar[iconsize="small"] #history-menu-button {
-moz-image-region: rect(0px 32px 16px 16px);
@@ -884,9 +888,11 @@ toolbar[iconsize="small"] #feed-button {
-moz-image-region: rect(0px 112px 16px 96px);
}
+%ifdef MOZ_WEBRTC
toolbar[iconsize="small"] #webrtc-status-button {
-moz-image-region: rect(0px 128px 16px 112px);
}
+%endif
/* Fullscreen window controls */
#window-controls {
@@ -1163,6 +1169,10 @@ toolbar[iconsize="small"] #webrtc-status-button {
list-style-image: url(chrome://browser/skin/Geolocation-64.png);
}
+.popup-notification-icon[popupid="push"] {
+ list-style-image: url(chrome://browser/skin/Push-64.png);
+}
+
.popup-notification-icon[popupid="xpinstall-disabled"],
.popup-notification-icon[popupid="addon-progress"],
.popup-notification-icon[popupid="addon-install-cancelled"],
@@ -1226,10 +1236,12 @@ toolbar[iconsize="small"] #webrtc-status-button {
list-style-image: url(chrome://browser/skin/mixed-content-blocked-64.png);
}
+%ifdef MOZ_WEBRTC
.popup-notification-icon[popupid="webRTC-sharingDevices"],
.popup-notification-icon[popupid="webRTC-shareDevices"] {
list-style-image: url(chrome://browser/skin/webRTC-shareDevice-64.png);
}
+%endif
.popup-notification-icon[popupid="pointerLock"] {
list-style-image: url(chrome://browser/skin/pointerLock-64.png);
@@ -1280,6 +1292,10 @@ toolbar[iconsize="small"] #webrtc-status-button {
list-style-image: url(chrome://browser/skin/Geolocation-16.png);
}
+#push-notification-icon {
+ list-style-image: url(chrome://browser/skin/Push-16.png);
+}
+
#addons-notification-icon {
list-style-image: url(chrome://mozapps/skin/extensions/extensionGeneric-16.png);
}
@@ -1352,6 +1368,7 @@ toolbar[iconsize="small"] #webrtc-status-button {
list-style-image: url(chrome://browser/skin/mixed-content-blocked-16.png);
}
+%ifdef MOZ_WEBRTC
.webRTC-shareDevices-notification-icon,
#webRTC-shareDevices-notification-icon {
list-style-image: url(chrome://browser/skin/webRTC-shareDevice-16.png);
@@ -1361,10 +1378,22 @@ toolbar[iconsize="small"] #webrtc-status-button {
#webRTC-sharingDevices-notification-icon {
list-style-image: url(chrome://browser/skin/webRTC-sharingDevice-16.png);
}
+%endif
.web-notifications-notification-icon,
#web-notifications-notification-icon {
- list-style-image: url(chrome://browser/skin/notification-16.png);
+ list-style-image: url(chrome://browser/skin/web-notifications-tray.svg);
+ -moz-image-region: rect(0, 16px, 16px, 0);
+}
+
+.web-notifications-notification-icon:hover,
+#web-notifications-notification-icon:hover {
+ -moz-image-region: rect(0, 32px, 16px, 16px);
+}
+
+.web-notifications-notification-icon:hover:active,
+#web-notifications-notification-icon:hover:active {
+ -moz-image-region: rect(0, 48px, 16px, 32px);
}
#pointerLock-notification-icon {
@@ -1549,29 +1578,6 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
min-width: 27em;
}
-.panel-promo-box {
- margin: 8px -10px -10px -10px;
- padding: 8px 10px;
- border-top: 1px solid ThreeDShadow;
- background-image: linear-gradient(hsla(0,0%,0%,.15), hsla(0,0%,0%,.08) 6px);
-}
-
-.panel-promo-icon {
- list-style-image: url("chrome://browser/skin/sync-notification-24.png");
- -moz-margin-end: 10px;
- vertical-align: middle;
-}
-
-.panel-promo-closebutton {
- margin-top: 0;
- margin-bottom: 0;
-}
-
-.panel-promo-closebutton > .toolbarbutton-text {
- padding: 0;
- margin: 0;
-}
-
/* Content area */
#sidebar {
background-color: Window;
@@ -2083,8 +2089,8 @@ toolbar[mode="text"] toolbarbutton.chevron > .toolbarbutton-icon {
}
%ifdef MOZ_DEVTOOLS
-%include ../../../toolkit/themes/shared/devtools/responsivedesign.inc.css
-%include ../../../toolkit/themes/shared/devtools/commandline.inc.css
+%include ../../../../devtools/client/themes/responsivedesign.inc.css
+%include ../../../../devtools/client/themes/commandline.inc.css
%endif
%include ../shared/plugin-doorhanger.inc.css
@@ -2109,12 +2115,12 @@ toolbar[mode="text"] toolbarbutton.chevron > .toolbarbutton-icon {
}
%endif
-.toolbarbutton-badge-container {
+.toolbarbutton-badge-stack {
margin: 5px 3px;
position: relative;
}
-toolbar[iconsize="small"] .toolbarbutton-badge-container {
+toolbar[iconsize="small"] .toolbarbutton-badge-stack {
margin: 0;
}
diff --git a/application/palemoon/themes/linux/jar.mn b/application/palemoon/themes/linux/jar.mn
index a756edbc32..3c2ac406ee 100644
--- a/application/palemoon/themes/linux/jar.mn
+++ b/application/palemoon/themes/linux/jar.mn
@@ -16,6 +16,7 @@ browser.jar:
#ifdef MOZ_SERVICES_SYNC
skin/classic/browser/aboutSyncTabs.css
#endif
+* skin/classic/browser/autocomplete.css
skin/classic/browser/actionicon-tab.png
* skin/classic/browser/browser.css
skin/classic/browser/click-to-play-warning-stripes.png
@@ -35,8 +36,6 @@ browser.jar:
skin/classic/browser/mixed-content-blocked-64.png
skin/classic/browser/monitor.png
skin/classic/browser/monitor_16-10.png
- skin/classic/browser/notification-16.png
- skin/classic/browser/notification-64.png
* skin/classic/browser/pageInfo.css
skin/classic/browser/pageInfo.png
skin/classic/browser/page-livemarks.png
@@ -53,9 +52,13 @@ browser.jar:
skin/classic/browser/Toolbar.png
skin/classic/browser/Toolbar-small.png
skin/classic/browser/urlbar-arrow.png
+ skin/classic/browser/web-notifications-icon.svg
+ skin/classic/browser/web-notifications-tray.svg
+#ifdef MOZ_WEBRTC
skin/classic/browser/webRTC-shareDevice-16.png
skin/classic/browser/webRTC-shareDevice-64.png
skin/classic/browser/webRTC-sharingDevice-16.png
+#endif
skin/classic/browser/downloads/buttons.png (downloads/buttons.png)
skin/classic/browser/downloads/download-glow.png (downloads/download-glow.png)
skin/classic/browser/downloads/download-glow-small.png (downloads/download-glow-small.png)
@@ -128,7 +131,6 @@ browser.jar:
skin/classic/browser/sync-128.png
skin/classic/browser/sync-desktopIcon.png
skin/classic/browser/sync-mobileIcon.png
- skin/classic/browser/sync-notification-24.png
skin/classic/browser/syncSetup.css
skin/classic/browser/syncCommon.css
skin/classic/browser/syncQuota.css
diff --git a/application/palemoon/themes/linux/notification-16.png b/application/palemoon/themes/linux/notification-16.png
deleted file mode 100644
index 6b2df73413..0000000000
--- a/application/palemoon/themes/linux/notification-16.png
+++ /dev/null
Binary files differ
diff --git a/application/palemoon/themes/linux/notification-64.png b/application/palemoon/themes/linux/notification-64.png
deleted file mode 100644
index a01d0ab776..0000000000
--- a/application/palemoon/themes/linux/notification-64.png
+++ /dev/null
Binary files differ
diff --git a/application/palemoon/themes/linux/preferences/aboutPermissions.css b/application/palemoon/themes/linux/preferences/aboutPermissions.css
index 4065688310..224c880184 100644
--- a/application/palemoon/themes/linux/preferences/aboutPermissions.css
+++ b/application/palemoon/themes/linux/preferences/aboutPermissions.css
@@ -90,7 +90,7 @@
list-style-image: url(chrome://global/skin/icons/question-64.png);
}
.pref-icon[type="desktop-notification"] {
- list-style-image: url(chrome://browser/skin/notification-64.png);
+ list-style-image: url(chrome://browser/skin/web-notifications-icon.svg);
}
.pref-icon[type="install"] {
list-style-image: url(chrome://mozapps/skin/extensions/extensionGeneric.png);
diff --git a/application/palemoon/themes/linux/sync-notification-24.png b/application/palemoon/themes/linux/sync-notification-24.png
deleted file mode 100644
index d67eb47ac4..0000000000
--- a/application/palemoon/themes/linux/sync-notification-24.png
+++ /dev/null
Binary files differ
diff --git a/application/palemoon/themes/linux/web-notifications-icon.svg b/application/palemoon/themes/linux/web-notifications-icon.svg
new file mode 100644
index 0000000000..f7186c7275
--- /dev/null
+++ b/application/palemoon/themes/linux/web-notifications-icon.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid" width="64" height="64" viewBox="0 0 64 64">
+ <defs>
+ <style>
+ .icon {
+ fill: #a6a6a6;
+ fill-rule: evenodd;
+ }
+ </style>
+ </defs>
+ <path d="M57,48 L46,48 L46,60.016 L32.482,48 L7,48 C5.343,48 4,46.657 4,45 L4,11.031 C4,9.374 5.343,8.031 7,8.031 L57,8.031 C58.657,8.031 60,9.374 60,11.031 L60,45 C60,46.657 58.657,48 57,48 ZM36,16.031 C36,14.927 35.105,14.031 34,14.031 L30,14.031 C28.895,14.031 28,14.927 28,16.031 L28,30.031 C28,31.136 28.895,32.031 30,32.031 L34,32.031 C35.105,32.031 36,31.136 36,30.031 L36,16.031 ZM36,37.5 C36,36.672 35.328,36 34.5,36 L29.5,36 C28.672,36 28,36.672 28,37.5 L28,40.5 C28,41.328 28.672,42 29.5,42 L34.5,42 C35.328,42 36,41.328 36,40.5 L36,37.5 Z" class="icon"/>
+</svg>
diff --git a/application/palemoon/themes/linux/web-notifications-tray.svg b/application/palemoon/themes/linux/web-notifications-tray.svg
new file mode 100644
index 0000000000..314026a106
--- /dev/null
+++ b/application/palemoon/themes/linux/web-notifications-tray.svg
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="16" viewBox="0 0 96 32">
+ <defs>
+ <style>
+ .style-icon-notification {
+ fill: #666666;
+ }
+ .style-icon-notification.hover {
+ fill: #808080;
+ }
+ .style-icon-notification.active {
+ fill: #4d4d4d;
+ }
+ </style>
+ <path id="shape-notifcations-push" d="M27,23.969 L24,23.969 L24,29.977 L17.241,23.969 L5,23.969 C3.343,23.969 2,22.626 2,20.969 L2,6.969 C2,5.312 3.343,3.969 5,3.969 L27,3.969 C28.657,3.969 30,5.312 30,6.969 L30,20.969 C30,22.626 28.657,23.969 27,23.969 ZM18,8.969 C18,7.864 17.105,6.969 16,6.969 C14.895,6.969 14,7.864 14,8.969 L14,13.969 C14,15.073 14.895,15.969 16,15.969 C17.105,15.969 18,15.073 18,13.969 L18,8.969 ZM16.5,17.969 L15.5,17.969 C14.672,17.969 14,18.640 14,19.469 C14,20.297 14.672,20.969 15.5,20.969 L16.5,20.969 C17.328,20.969 18,20.297 18,19.469 C18,18.640 17.328,17.969 16.5,17.969 Z"/>
+ </defs>
+ <use xlink:href="#shape-notifcations-push" class="style-icon-notification"/>
+ <use xlink:href="#shape-notifcations-push" transform="translate(32)" class="style-icon-notification hover"/>
+ <use xlink:href="#shape-notifcations-push" transform="translate(64)" class="style-icon-notification active"/>
+</svg>
diff --git a/application/palemoon/themes/osx/Push-16.png b/application/palemoon/themes/osx/Push-16.png
new file mode 100644
index 0000000000..54ef8f8eae
--- /dev/null
+++ b/application/palemoon/themes/osx/Push-16.png
Binary files differ
diff --git a/application/palemoon/themes/osx/Push-64.png b/application/palemoon/themes/osx/Push-64.png
new file mode 100644
index 0000000000..099b9c76f3
--- /dev/null
+++ b/application/palemoon/themes/osx/Push-64.png
Binary files differ
diff --git a/application/palemoon/themes/osx/autocomplete.css b/application/palemoon/themes/osx/autocomplete.css
new file mode 100644
index 0000000000..a50dbd8239
--- /dev/null
+++ b/application/palemoon/themes/osx/autocomplete.css
@@ -0,0 +1,198 @@
+/* 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/. */
+
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+@namespace html url("http://www.w3.org/1999/xhtml");
+
+/* .padded is used by autocomplete widgets that don't have an icon. Gross. -dwh */
+textbox:not(.padded) {
+ cursor: default;
+ padding: 0;
+}
+
+textbox[nomatch="true"][highlightnonmatches="true"] {
+ color: red;
+}
+
+textbox:not(.padded) .textbox-input-box {
+ margin: 0 3px;
+}
+
+.textbox-input-box {
+ -moz-box-align: center;
+}
+
+/* ::::: history button ::::: */
+
+.private-autocomplete-history-dropmarker {
+ -moz-appearance: none !important;
+ border: none !important;
+ background-color: transparent !important;
+ padding: 0px;
+ list-style-image: url("chrome://global/skin/icons/autocomplete-dropmarker.png");
+ margin: 0px;
+}
+
+/* ::::: autocomplete popups ::::: */
+
+panel[type="private-autocomplete"],
+panel[type="private-autocomplete-richlistbox"],
+.private-autocomplete-history-popup {
+ padding: 0px !important;
+ color: -moz-FieldText;
+ background-color: -moz-Field;
+ font: icon;
+ -moz-appearance: none;
+}
+
+.private-autocomplete-history-popup {
+ max-height: 180px;
+}
+
+/* ::::: tree ::::: */
+
+.private-autocomplete-tree {
+ -moz-appearance: none !important;
+ border: none !important;
+ background-color: transparent !important;
+}
+
+.private-autocomplete-treecol {
+ -moz-appearance: none !important;
+ margin: 0 !important;
+ border: none !important;
+ padding: 0 !important;
+}
+
+.private-autocomplete-treebody::-moz-tree-cell-text {
+ padding-left: 2px;
+}
+
+.private-autocomplete-treebody::-moz-tree-row {
+ border-top: none;
+}
+
+treechildren.private-autocomplete-treebody::-moz-tree-row(selected) {
+ background-color: Highlight;
+}
+
+treechildren.private-autocomplete-treebody::-moz-tree-cell-text(selected) {
+ color: HighlightText !important;
+}
+
+.private-autocomplete-treebody::-moz-tree-image(treecolAutoCompleteValue) {
+ max-width: 16px;
+ height: 16px;
+}
+
+/* ::::: richlistbox autocomplete ::::: */
+
+.private-autocomplete-richlistbox {
+ -moz-appearance: none;
+ margin: 0;
+}
+
+.private-autocomplete-richlistitem[selected="true"] {
+ background-color: Highlight;
+ color: HighlightText;
+ background-image: linear-gradient(rgba(255,255,255,0.3), transparent);
+}
+
+.private-autocomplete-richlistitem {
+ padding: 5px 2px;
+}
+
+.ac-url-box {
+ /* When setting a vertical margin here, half of that needs to be added
+ .ac-title-box's translateY for when .ac-url-box is hidden (see below). */
+ margin-top: 1px;
+}
+
+.private-autocomplete-richlistitem[actiontype="keyword"] .ac-url-box,
+.private-autocomplete-richlistitem[actiontype="searchengine"] .ac-url-box,
+.private-autocomplete-richlistitem[actiontype="visiturl"] .ac-url-box,
+.private-autocomplete-richlistitem[type~="autofill"] .ac-url-box {
+ visibility: hidden;
+}
+
+.private-autocomplete-richlistitem[actiontype="keyword"] .ac-title-box,
+.private-autocomplete-richlistitem[actiontype="searchengine"] .ac-title-box,
+.private-autocomplete-richlistitem[actiontype="visiturl"] .ac-title-box,
+.private-autocomplete-richlistitem[type~="autofill"] .ac-title-box {
+ /* Center the title by moving it down by half of .ac-url-box's height,
+ including vertical margins (if any). */
+ transform: translateY(.5em);
+}
+
+.ac-site-icon {
+ width: 16px;
+ height: 16px;
+ margin-bottom: -1px;
+ -moz-margin-start: 7px;
+ -moz-margin-end: 5px;
+}
+
+.ac-type-icon {
+ width: 16px;
+ height: 16px;
+ -moz-margin-start: 6px;
+ -moz-margin-end: 4px;
+}
+
+.ac-url-box > .ac-site-icon,
+.ac-url-box > .ac-type-icon {
+ /* Otherwise the spacer is big enough to stretch its container */
+ height: auto;
+}
+
+.ac-extra > .ac-result-type-tag {
+ margin: 0 4px;
+}
+
+.ac-extra > .ac-comment {
+ padding-right: 4px;
+}
+
+.ac-ellipsis-after {
+ margin: 0 !important;
+ padding: 0;
+ min-width: 1.1em;
+}
+
+.ac-normal-text {
+ margin: 0 !important;
+ padding: 0;
+}
+
+.ac-normal-text > html|span {
+ margin: 0 !important;
+ padding: 0;
+}
+
+html|span.ac-emphasize-text {
+ box-shadow: inset 0 0 1px 1px rgba(208,208,208,0.4);
+ background-color: rgba(208,208,208,0.2);
+ border-radius: 2px;
+ text-shadow: 0 0 currentColor;
+}
+
+.ac-url-text > html|span.ac-emphasize-text,
+.ac-action-text > html|span.ac-emphasize-text {
+ box-shadow: inset 0 0 1px 1px rgba(183,210,226,0.4);
+ background-color: rgba(183,210,226,0.3);
+}
+
+.ac-title, .ac-url {
+ overflow: hidden;
+}
+
+/* ::::: textboxes inside toolbarpaletteitems ::::: */
+
+toolbarpaletteitem > toolbaritem > textbox > hbox > hbox > html|*.textbox-input {
+ visibility: hidden;
+}
+
+toolbarpaletteitem > toolbaritem > * > textbox > hbox > hbox > html|*.textbox-input {
+ visibility: hidden;
+}
diff --git a/application/palemoon/themes/osx/browser.css b/application/palemoon/themes/osx/browser.css
index 58348a4082..58443fa768 100644
--- a/application/palemoon/themes/osx/browser.css
+++ b/application/palemoon/themes/osx/browser.css
@@ -452,7 +452,7 @@ toolbar[mode=full] .toolbarbutton-1 > .toolbarbutton-menubutton-button {
}
@navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-icon,
-@navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-badge-container,
+@navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-badge-stack,
@navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-menubutton-button > .toolbarbutton-icon,
@navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon {
padding: 2px 6px;
@@ -470,7 +470,7 @@ toolbar[mode=full] .toolbarbutton-1 > .toolbarbutton-menubutton-button {
}
@navbarLargeIcons@ .toolbarbutton-1:not(:-moz-any(@primaryToolbarButtons@)) > .toolbarbutton-icon,
-@navbarLargeIcons@ .toolbarbutton-1:not(:-moz-any(@primaryToolbarButtons@)) > .toolbarbutton-badge-container,
+@navbarLargeIcons@ .toolbarbutton-1:not(:-moz-any(@primaryToolbarButtons@)) > .toolbarbutton-badge-stack,
@navbarLargeIcons@ .toolbarbutton-1:not(:-moz-any(@primaryToolbarButtons@)) > .toolbarbutton-menubutton-button > .toolbarbutton-icon {
padding: 3px 7px;
}
@@ -521,7 +521,7 @@ toolbar[mode=full] .toolbarbutton-1 > .toolbarbutton-menubutton-button {
@navbarLargeIcons@ .toolbarbutton-1:not([disabled]):-moz-any(:hover,[open]) > .toolbarbutton-menubutton-button > .toolbarbutton-icon,
@navbarLargeIcons@ .toolbarbutton-1:not([disabled]):hover > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon,
@navbarLargeIcons@ .toolbarbutton-1:not([disabled]):not([checked]):not([open]):not(:active):hover > .toolbarbutton-icon,
-@navbarLargeIcons@ .toolbarbutton-1:not([disabled]):not([checked]):not([open]):not(:active):hover > .toolbarbutton-badge-container,
+@navbarLargeIcons@ .toolbarbutton-1:not([disabled]):not([checked]):not([open]):not(:active):hover > .toolbarbutton-badge-stack,
@conditionalForwardWithUrlbar@ > .toolbarbutton-1:-moz-any([disabled],:not([open]):not([disabled]):not(:active)) > .toolbarbutton-icon {
background-image: linear-gradient(hsla(0,0%,100%,.8), hsla(0,0%,100%,.5));
border-color: hsla(210,54%,20%,.25) hsla(210,54%,20%,.3) hsla(210,54%,20%,.35);
@@ -544,7 +544,7 @@ toolbar[mode=full] .toolbarbutton-1 > .toolbarbutton-menubutton-button {
@navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-menubutton-button:not([disabled]):hover:active > .toolbarbutton-icon,
@navbarLargeIcons@ .toolbarbutton-1[open] > .toolbarbutton-menubutton-dropmarker:not([disabled]) > .dropmarker-icon,
@navbarLargeIcons@ .toolbarbutton-1:not([disabled]):-moz-any([open],[checked],:hover:active) > .toolbarbutton-icon,
-@navbarLargeIcons@ .toolbarbutton-1:not([disabled]):-moz-any([open],[checked],:hover:active) > .toolbarbutton-badge-container {
+@navbarLargeIcons@ .toolbarbutton-1:not([disabled]):-moz-any([open],[checked],:hover:active) > .toolbarbutton-badge-stack {
background-image: linear-gradient(hsla(0,0%,100%,.6), hsla(0,0%,100%,.1));
background-color: hsla(210,54%,20%,.15);
border-color: hsla(210,54%,20%,.3) hsla(210,54%,20%,.35) hsla(210,54%,20%,.4);
@@ -801,10 +801,11 @@ toolbar[brighttext] #bookmarks-menu-button.bookmark-item {
-moz-image-region: rect(0, 342px, 18px, 324px);
}
+%ifdef MOZ_WEBRTC
#webrtc-status-button {
-moz-image-region: rect(0, 360px, 18px, 342px);
}
-
+%endif
/* ::::: fullscreen window controls ::::: */
@@ -1337,41 +1338,6 @@ richlistitem[type~="action"][actiontype="switchtab"][selected="true"] > .ac-url-
min-width: 27em;
}
-.panel-promo-box {
- margin: 10px -10px -10px;
- padding: 8px 10px;
- border-top: 1px solid ThreeDShadow;
- background-image: linear-gradient(hsla(0,0%,0%,.15), hsla(0,0%,0%,.08) 6px);
- border-bottom-left-radius: 3px;
- border-bottom-right-radius: 3px;
-}
-
-@media (-moz-mac-lion-theme) {
- .panel-promo-box {
- border-top-style: none;
- background: #f1f5fb;
- color: GrayText;
- box-shadow: 0px 1px 2px rgb(204,214,234) inset;
- }
-}
-
-.panel-promo-icon {
- list-style-image: url("chrome://browser/skin/sync-notification-24.png");
- -moz-margin-end: 10px;
- vertical-align: middle;
-}
-
-.panel-promo-closebutton {
- border: none;
- -moz-margin-end: -14px;
- margin-top: -8px;
-}
-
-.panel-promo-closebutton > .toolbarbutton-text {
- padding: 0;
- margin: 0;
-}
-
/* ::::: content area ::::: */
#sidebar {
@@ -1955,11 +1921,13 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
list-style-image: url(chrome://browser/skin/mixed-content-blocked-64.png);
}
+%ifdef MOZ_WEBRTC
.popup-notification-icon[popupid="webRTC-sharingDevices"],
.popup-notification-icon[popupid="webRTC-shareDevices"] {
list-style-image: url(chrome://browser/skin/webRTC-shareDevice-64.png);
}
+%endif
.popup-notification-icon[popupid="pointerLock"] {
list-style-image: url(chrome://browser/skin/pointerLock-64.png);
}
@@ -2007,6 +1975,10 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
list-style-image: url(chrome://browser/skin/Geolocation-16.png);
}
+#push-notification-icon {
+ list-style-image: url(chrome://browser/skin/Push-16.png);
+}
+
#addons-notification-icon {
list-style-image: url(chrome://mozapps/skin/extensions/extensionGeneric-16.png);
}
@@ -2079,6 +2051,7 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
list-style-image: url(chrome://browser/skin/mixed-content-blocked-16.png);
}
+%ifdef MOZ_WEBRTC
.webRTC-shareDevices-notification-icon,
#webRTC-shareDevices-notification-icon {
list-style-image: url(chrome://browser/skin/webRTC-shareDevice-16.png);
@@ -2088,10 +2061,22 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
#webRTC-sharingDevices-notification-icon {
list-style-image: url(chrome://browser/skin/webRTC-sharingDevice-16.png);
}
+%endif
.web-notifications-notification-icon,
#web-notifications-notification-icon {
- list-style-image: url(chrome://browser/skin/notification-16.png);
+ list-style-image: url(chrome://browser/skin/web-notifications-tray.svg);
+ -moz-image-region: rect(0, 16px, 16px, 0);
+}
+
+.web-notifications-notification-icon:hover,
+#web-notifications-notification-icon:hover {
+ -moz-image-region: rect(0, 32px, 16px, 16px);
+}
+
+.web-notifications-notification-icon:hover:active,
+#web-notifications-notification-icon:hover:active {
+ -moz-image-region: rect(0, 48px, 16px, 32px);
}
#pointerLock-notification-icon {
@@ -2383,8 +2368,8 @@ toolbar[brighttext] #addonbar-closebutton {
}
%ifdef MOZ_DEVTOOLS
-%include ../../../toolkit/themes/shared/devtools/responsivedesign.inc.css
-%include ../../../toolkit/themes/shared/devtools/commandline.inc.css
+%include ../../../../devtools/client/themes/responsivedesign.inc.css
+%include ../../../../devtools/client/themes/commandline.inc.css
%endif
%include ../shared/plugin-doorhanger.inc.css
@@ -2401,23 +2386,23 @@ toolbar[brighttext] #addonbar-closebutton {
}
%endif
-.toolbarbutton-badge-container {
+.toolbarbutton-badge-stack {
margin: 0;
padding: 0;
position: relative;
}
-@navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-badge-container {
+@navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-badge-stack {
padding: 2px 5px;
}
-.toolbarbutton-1 > .toolbarbutton-badge-container > .toolbar-icon {
+.toolbarbutton-1 > .toolbarbutton-badge-stack > .toolbar-icon {
position: absolute;
top: 2px;
right: 2px;
}
-.toolbarbutton-badge-container > .toolbarbutton-icon[label]:not([label=""]) {
+.toolbarbutton-badge-stack > .toolbarbutton-icon[label]:not([label=""]) {
-moz-margin-end: 0;
}
diff --git a/application/palemoon/themes/osx/jar.mn b/application/palemoon/themes/osx/jar.mn
index 00575bac85..a085c5f818 100644
--- a/application/palemoon/themes/osx/jar.mn
+++ b/application/palemoon/themes/osx/jar.mn
@@ -15,6 +15,7 @@ browser.jar:
#ifdef MOZ_SERVICES_SYNC
skin/classic/browser/aboutSyncTabs.css
#endif
+* skin/classic/browser/autocomplete.css
skin/classic/browser/actionicon-tab.png
skin/classic/browser/appmenu-icons.png
skin/classic/browser/appmenu-dropmarker.png
@@ -40,8 +41,6 @@ browser.jar:
skin/classic/browser/mixed-content-blocked-64.png
skin/classic/browser/monitor.png
skin/classic/browser/monitor_16-10.png
- skin/classic/browser/notification-16.png
- skin/classic/browser/notification-64.png
skin/classic/browser/pageInfo.css
skin/classic/browser/pageInfo.png
skin/classic/browser/page-livemarks.png
@@ -69,12 +68,16 @@ browser.jar:
skin/classic/browser/urlbar-history-dropmarker.png
skin/classic/browser/webapps-16.png
skin/classic/browser/webapps-64.png
+ skin/classic/browser/web-notifications-icon.svg
+ skin/classic/browser/web-notifications-tray.svg
skin/classic/browser/notification-pluginNormal.png (../shared/plugins/notification-pluginNormal.png)
skin/classic/browser/notification-pluginAlert.png (../shared/plugins/notification-pluginAlert.png)
skin/classic/browser/notification-pluginBlocked.png (../shared/plugins/notification-pluginBlocked.png)
+#ifdef MOZ_WEBRTC
skin/classic/browser/webRTC-shareDevice-16.png
skin/classic/browser/webRTC-shareDevice-64.png
skin/classic/browser/webRTC-sharingDevice-16.png
+#endif
skin/classic/browser/downloads/buttons.png (downloads/buttons.png)
skin/classic/browser/downloads/download-glow.png (downloads/download-glow.png)
skin/classic/browser/downloads/download-notification-finish.png (downloads/download-notification-finish.png)
@@ -161,7 +164,6 @@ browser.jar:
skin/classic/browser/sync-bg.png
skin/classic/browser/sync-desktopIcon.png
skin/classic/browser/sync-mobileIcon.png
- skin/classic/browser/sync-notification-24.png
skin/classic/browser/syncSetup.css
skin/classic/browser/syncCommon.css
skin/classic/browser/syncQuota.css
diff --git a/application/palemoon/themes/osx/notification-16.png b/application/palemoon/themes/osx/notification-16.png
deleted file mode 100644
index 6b2df73413..0000000000
--- a/application/palemoon/themes/osx/notification-16.png
+++ /dev/null
Binary files differ
diff --git a/application/palemoon/themes/osx/notification-64.png b/application/palemoon/themes/osx/notification-64.png
deleted file mode 100644
index a01d0ab776..0000000000
--- a/application/palemoon/themes/osx/notification-64.png
+++ /dev/null
Binary files differ
diff --git a/application/palemoon/themes/osx/preferences/aboutPermissions.css b/application/palemoon/themes/osx/preferences/aboutPermissions.css
index cfb941bbb7..a97e71e041 100644
--- a/application/palemoon/themes/osx/preferences/aboutPermissions.css
+++ b/application/palemoon/themes/osx/preferences/aboutPermissions.css
@@ -93,7 +93,7 @@
list-style-image: url(chrome://global/skin/icons/question-64.png);
}
.pref-icon[type="desktop-notification"] {
- list-style-image: url(chrome://browser/skin/notification-64.png);
+ list-style-image: url(chrome://browser/skin/web-notifications-icon.svg);
}
.pref-icon[type="install"] {
list-style-image: url(chrome://mozapps/skin/extensions/extensionGeneric.png);
diff --git a/application/palemoon/themes/osx/shared.inc b/application/palemoon/themes/osx/shared.inc
index 2e8a8f269f..ef27746a3e 100644
--- a/application/palemoon/themes/osx/shared.inc
+++ b/application/palemoon/themes/osx/shared.inc
@@ -1,4 +1,4 @@
-%include ../../../toolkit/themes/osx/global/shared.inc
+%include ../../../../toolkit/themes/osx/global/shared.inc
%include ../shared/browser.inc
%define hudButton -moz-appearance: none; color: #434343; border-radius: 4px; border: 1px solid #b5b5b5; background: linear-gradient(#fff, #f2f2f2); box-shadow: inset 0 1px rgba(255,255,255,.8), inset 0 0 1px rgba(255,255, 255,.25), 0 1px rgba(255,255,255,.3); background-clip: padding-box; background-origin: padding-box; padding: 2px 6px;
diff --git a/application/palemoon/themes/osx/sync-notification-24.png b/application/palemoon/themes/osx/sync-notification-24.png
deleted file mode 100644
index fc9a4e63d2..0000000000
--- a/application/palemoon/themes/osx/sync-notification-24.png
+++ /dev/null
Binary files differ
diff --git a/application/palemoon/themes/osx/web-notifications-icon.svg b/application/palemoon/themes/osx/web-notifications-icon.svg
new file mode 100644
index 0000000000..f7186c7275
--- /dev/null
+++ b/application/palemoon/themes/osx/web-notifications-icon.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid" width="64" height="64" viewBox="0 0 64 64">
+ <defs>
+ <style>
+ .icon {
+ fill: #a6a6a6;
+ fill-rule: evenodd;
+ }
+ </style>
+ </defs>
+ <path d="M57,48 L46,48 L46,60.016 L32.482,48 L7,48 C5.343,48 4,46.657 4,45 L4,11.031 C4,9.374 5.343,8.031 7,8.031 L57,8.031 C58.657,8.031 60,9.374 60,11.031 L60,45 C60,46.657 58.657,48 57,48 ZM36,16.031 C36,14.927 35.105,14.031 34,14.031 L30,14.031 C28.895,14.031 28,14.927 28,16.031 L28,30.031 C28,31.136 28.895,32.031 30,32.031 L34,32.031 C35.105,32.031 36,31.136 36,30.031 L36,16.031 ZM36,37.5 C36,36.672 35.328,36 34.5,36 L29.5,36 C28.672,36 28,36.672 28,37.5 L28,40.5 C28,41.328 28.672,42 29.5,42 L34.5,42 C35.328,42 36,41.328 36,40.5 L36,37.5 Z" class="icon"/>
+</svg>
diff --git a/application/palemoon/themes/osx/web-notifications-tray.svg b/application/palemoon/themes/osx/web-notifications-tray.svg
new file mode 100644
index 0000000000..314026a106
--- /dev/null
+++ b/application/palemoon/themes/osx/web-notifications-tray.svg
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="16" viewBox="0 0 96 32">
+ <defs>
+ <style>
+ .style-icon-notification {
+ fill: #666666;
+ }
+ .style-icon-notification.hover {
+ fill: #808080;
+ }
+ .style-icon-notification.active {
+ fill: #4d4d4d;
+ }
+ </style>
+ <path id="shape-notifcations-push" d="M27,23.969 L24,23.969 L24,29.977 L17.241,23.969 L5,23.969 C3.343,23.969 2,22.626 2,20.969 L2,6.969 C2,5.312 3.343,3.969 5,3.969 L27,3.969 C28.657,3.969 30,5.312 30,6.969 L30,20.969 C30,22.626 28.657,23.969 27,23.969 ZM18,8.969 C18,7.864 17.105,6.969 16,6.969 C14.895,6.969 14,7.864 14,8.969 L14,13.969 C14,15.073 14.895,15.969 16,15.969 C17.105,15.969 18,15.073 18,13.969 L18,8.969 ZM16.5,17.969 L15.5,17.969 C14.672,17.969 14,18.640 14,19.469 C14,20.297 14.672,20.969 15.5,20.969 L16.5,20.969 C17.328,20.969 18,20.297 18,19.469 C18,18.640 17.328,17.969 16.5,17.969 Z"/>
+ </defs>
+ <use xlink:href="#shape-notifcations-push" class="style-icon-notification"/>
+ <use xlink:href="#shape-notifcations-push" transform="translate(32)" class="style-icon-notification hover"/>
+ <use xlink:href="#shape-notifcations-push" transform="translate(64)" class="style-icon-notification active"/>
+</svg>
diff --git a/application/palemoon/themes/shared/browser.inc b/application/palemoon/themes/shared/browser.inc
index cd17903ce5..18e69ad43b 100644
--- a/application/palemoon/themes/shared/browser.inc
+++ b/application/palemoon/themes/shared/browser.inc
@@ -1,3 +1,8 @@
%filter substitution
+%ifndef MOZ_WEBRTC
+%define primaryToolbarButtons #back-button, #forward-button, #reload-button, #stop-button, #home-button, #print-button, #downloads-button, #downloads-indicator, #history-button, #history-menu-button, #bookmarks-button, #bookmarks-menu-button, #new-tab-button, #new-window-button, #cut-button, #copy-button, #paste-button, #fullscreen-button, #zoom-out-button, #zoom-in-button, #sync-button, #feed-button, #alltabs-button
+%else
%define primaryToolbarButtons #back-button, #forward-button, #reload-button, #stop-button, #home-button, #print-button, #downloads-button, #downloads-indicator, #history-button, #history-menu-button, #bookmarks-button, #bookmarks-menu-button, #new-tab-button, #new-window-button, #cut-button, #copy-button, #paste-button, #fullscreen-button, #zoom-out-button, #zoom-in-button, #sync-button, #feed-button, #alltabs-button, #webrtc-status-button
+%endif
+
diff --git a/application/palemoon/themes/windows/Push-16.png b/application/palemoon/themes/windows/Push-16.png
new file mode 100644
index 0000000000..d710e7336d
--- /dev/null
+++ b/application/palemoon/themes/windows/Push-16.png
Binary files differ
diff --git a/application/palemoon/themes/windows/Push-64.png b/application/palemoon/themes/windows/Push-64.png
new file mode 100644
index 0000000000..27fecb8588
--- /dev/null
+++ b/application/palemoon/themes/windows/Push-64.png
Binary files differ
diff --git a/application/palemoon/themes/windows/autocomplete.css b/application/palemoon/themes/windows/autocomplete.css
new file mode 100644
index 0000000000..b3cab44c8e
--- /dev/null
+++ b/application/palemoon/themes/windows/autocomplete.css
@@ -0,0 +1,238 @@
+/* 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/. */
+
+/* ===== autocomplete.css =================================================
+ == Styles used by the autocomplete widget.
+ ======================================================================= */
+
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+@namespace html url("http://www.w3.org/1999/xhtml");
+
+/* ::::: autocomplete ::::: */
+
+/* .padded is used by autocomplete widgets that don't have an icon. Gross. -dwh */
+textbox:not(.padded) {
+ cursor: default;
+ padding: 0;
+}
+
+textbox[nomatch="true"][highlightnonmatches="true"] {
+ color: red;
+}
+
+.private-autocomplete-textbox-container {
+ -moz-box-align: center;
+}
+
+textbox:not(.padded) .textbox-input-box {
+ margin: 0 3px;
+}
+
+.textbox-input-box {
+ -moz-box-align: center;
+}
+
+/* ::::: autocomplete popups ::::: */
+
+panel[type="private-autocomplete"],
+panel[type="private-autocomplete-richlistbox"],
+.private-autocomplete-history-popup {
+ -moz-appearance: none;
+ border-width: 1px;
+ -moz-border-top-colors: ThreeDShadow;
+ -moz-border-right-colors: ThreeDShadow;
+ -moz-border-bottom-colors: ThreeDShadow;
+ -moz-border-left-colors: ThreeDShadow;
+ padding: 0;
+ color: -moz-FieldText;
+ background-color: -moz-Field;
+}
+
+.private-autocomplete-history-popup {
+ max-height: 180px;
+}
+
+/* ::::: tree ::::: */
+
+.private-autocomplete-tree {
+ -moz-appearance: none !important;
+ border: none !important;
+ background-color: transparent !important;
+}
+
+.private-autocomplete-treecol {
+ -moz-appearance: none !important;
+ margin: 0 !important;
+ border: none !important;
+ padding: 0 !important;
+}
+
+/* GTK calculates space for a sort arrow */
+.private-autocomplete-treecol > .treecol-sortdirection {
+ -moz-appearance: none !important;
+}
+
+.private-autocomplete-treebody::-moz-tree-cell-text {
+ -moz-padding-start: 8px;
+}
+
+treechildren.private-autocomplete-treebody::-moz-tree-row(selected) {
+ background-color: Highlight;
+}
+
+treechildren.private-autocomplete-treebody::-moz-tree-cell-text(selected) {
+ color: HighlightText !important;
+}
+
+.private-autocomplete-treebody::-moz-tree-image(treecolAutoCompleteValue) {
+ max-width: 16px;
+ height: 16px;
+}
+
+/* ::::: richlistbox autocomplete ::::: */
+
+.private-autocomplete-richlistbox {
+ -moz-appearance: none;
+ margin: 0;
+}
+
+.private-autocomplete-richlistitem {
+ padding: 1px;
+}
+
+.private-autocomplete-richlistitem[selected="true"] {
+ background-color: Highlight;
+ color: HighlightText;
+}
+
+%ifdef XP_WIN
+@media (-moz-os-version: windows-vista) and (-moz-windows-default-theme),
+ (-moz-os-version: windows-win7) and (-moz-windows-default-theme) {
+ .private-autocomplete-richlistitem[selected="true"] {
+ color: inherit;
+ background-color: transparent;
+ /* four gradients for the bevel highlights on each edge, one for blue background */
+ background-image:
+ linear-gradient(to bottom, rgba(255,255,255,0.9) 3px, transparent 3px),
+ linear-gradient(to right, rgba(255,255,255,0.5) 3px, transparent 3px),
+ linear-gradient(to left, rgba(255,255,255,0.5) 3px, transparent 3px),
+ linear-gradient(to top, rgba(255,255,255,0.4) 3px, transparent 3px),
+ linear-gradient(to bottom, rgba(163,196,247,0.3), rgba(122,180,246,0.3));
+ background-clip: content-box;
+ border-radius: 6px;
+ outline: 1px solid rgb(124,163,206);
+ -moz-outline-radius: 3px;
+ outline-offset: -2px;
+ }
+}
+%endif
+
+.ac-title-box {
+ margin-top: 4px;
+}
+
+.ac-url-box {
+ /* When setting a vertical margin here, half of that needs to be added
+ .ac-title-box's translateY for when .ac-url-box is hidden (see below). */
+ margin: 1px 0 4px;
+}
+
+.private-autocomplete-richlistitem[actiontype="keyword"] .ac-url-box,
+.private-autocomplete-richlistitem[actiontype="searchengine"] .ac-url-box,
+.private-autocomplete-richlistitem[actiontype="visiturl"] .ac-url-box,
+.private-autocomplete-richlistitem[type~="autofill"] .ac-url-box {
+ visibility: hidden;
+}
+
+.private-autocomplete-richlistitem[actiontype="keyword"] .ac-title-box,
+.private-autocomplete-richlistitem[actiontype="searchengine"] .ac-title-box,
+.private-autocomplete-richlistitem[actiontype="visiturl"] .ac-title-box,
+.private-autocomplete-richlistitem[type~="autofill"] .ac-title-box {
+ /* Center the title by moving it down by half of .ac-url-box's height,
+ including vertical margins (if any). */
+ transform: translateY(calc(.5em + 2px));
+}
+
+.ac-site-icon {
+ width: 16px;
+ height: 16px;
+ margin: 0 5px -2px;
+}
+
+.ac-type-icon {
+ width: 16px;
+ height: 16px;
+ -moz-margin-start: 6px;
+ -moz-margin-end: 4px;
+ margin-bottom: -1px;
+}
+
+.ac-url-box > .ac-site-icon,
+.ac-url-box > .ac-type-icon {
+ /* Otherwise the spacer is big enough to stretch its container */
+ height: auto;
+}
+
+.ac-extra > .ac-result-type-tag {
+ margin: 0 4px;
+}
+
+.ac-extra > .ac-comment {
+ padding-right: 4px;
+}
+
+.ac-ellipsis-after {
+ margin: 0 !important;
+ padding: 0;
+ min-width: 1em;
+}
+
+.ac-normal-text {
+ margin: 0 !important;
+ padding: 0;
+}
+
+.ac-normal-text > html|span {
+ margin: 0 !important;
+ padding: 0;
+}
+
+html|span.ac-emphasize-text {
+ box-shadow: inset 0 0 1px 1px rgba(208,208,208,0.5);
+ background-color: rgba(208,208,208,0.3);
+ border-radius: 2px;
+ text-shadow: 0 0 currentColor;
+}
+
+@media (-moz-windows-default-theme) {
+ @media not all and (-moz-os-version: windows-xp) {
+ html|span.ac-emphasize-text {
+ box-shadow: inset 0 0 1px 1px rgba(0,0,0,0.1);
+ background-color: rgba(0,0,0,0.05);
+ }
+ }
+
+ @media (-moz-os-version: windows-xp) {
+ .ac-url-text > html|span.ac-emphasize-text,
+ .ac-action-text > html|span.ac-emphasize-text {
+ box-shadow: inset 0 0 1px 1px rgba(202,214,201,0.3);
+ background-color: rgba(202,214,201,0.2);
+ }
+ }
+}
+
+.ac-title, .ac-url {
+ overflow: hidden;
+}
+
+/* ::::: textboxes inside toolbarpaletteitems ::::: */
+
+toolbarpaletteitem > toolbaritem > textbox > hbox > hbox > html|*.textbox-input {
+ visibility: hidden;
+}
+
+toolbarpaletteitem > toolbaritem > * > textbox > hbox > hbox > html|*.textbox-input {
+ visibility: hidden;
+}
+
diff --git a/application/palemoon/themes/windows/browser.css b/application/palemoon/themes/windows/browser.css
index 7c837764d4..3d519ba856 100644
--- a/application/palemoon/themes/windows/browser.css
+++ b/application/palemoon/themes/windows/browser.css
@@ -825,7 +825,7 @@ toolbar[mode=full] .toolbarbutton-1 > .toolbarbutton-menubutton-button {
}
@navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-icon,
-@navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-badge-container,
+@navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-badge-stack,
@navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-menubutton-button > .toolbarbutton-icon,
@navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon {
padding: 2px 6px;
@@ -848,7 +848,7 @@ toolbar[mode=full] .toolbarbutton-1 > .toolbarbutton-menubutton-button {
}
@navbarLargeIcons@ .toolbarbutton-1:not(:-moz-any(@primaryToolbarButtons@)) > .toolbarbutton-icon,
-@navbarLargeIcons@ .toolbarbutton-1:not(:-moz-any(@primaryToolbarButtons@)) > .toolbarbutton-badge-container,
+@navbarLargeIcons@ .toolbarbutton-1:not(:-moz-any(@primaryToolbarButtons@)) > .toolbarbutton-badge-stack,
@navbarLargeIcons@ .toolbarbutton-1:not(:-moz-any(@primaryToolbarButtons@)) > .toolbarbutton-menubutton-button > .toolbarbutton-icon {
padding: 3px 7px;
}
@@ -897,7 +897,7 @@ toolbar[mode=full] .toolbarbutton-1 > .toolbarbutton-menubutton-button {
}
@navbarLargeIcons@ .toolbarbutton-1:not([disabled]):not([checked]):not([open]):not(:active):hover > .toolbarbutton-icon,
-@navbarLargeIcons@ .toolbarbutton-1:not([disabled]):not([checked]):not([open]):not(:active):hover > .toolbarbutton-badge-container,
+@navbarLargeIcons@ .toolbarbutton-1:not([disabled]):not([checked]):not([open]):not(:active):hover > .toolbarbutton-badge-stack,
@navbarLargeIcons@ .toolbarbutton-1:not([disabled]):-moz-any(:hover,[open]) > .toolbarbutton-menubutton-button > .toolbarbutton-icon,
@navbarLargeIcons@ .toolbarbutton-1:not([disabled]):hover > .toolbarbutton-menubutton-dropmarker > .dropmarker-icon {
background-image: linear-gradient(hsla(0,0%,100%,.8), hsla(0,0%,100%,.5));
@@ -916,7 +916,7 @@ toolbar[mode=full] .toolbarbutton-1 > .toolbarbutton-menubutton-button {
}
@navbarLargeIcons@ .toolbarbutton-1:not([disabled]):-moz-any([open],[checked],:hover:active) > .toolbarbutton-icon,
-@navbarLargeIcons@ .toolbarbutton-1:not([disabled]):-moz-any([open],[checked],:hover:active) > .toolbarbutton-badge-container,
+@navbarLargeIcons@ .toolbarbutton-1:not([disabled]):-moz-any([open],[checked],:hover:active) > .toolbarbutton-badge-stack,
@navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-menubutton-button:not([disabled]):hover:active > .toolbarbutton-icon,
@navbarLargeIcons@ .toolbarbutton-1[open] > .toolbarbutton-menubutton-dropmarker:not([disabled]) > .dropmarker-icon {
background-image: linear-gradient(hsla(0,0%,100%,.6), hsla(0,0%,100%,.1));
@@ -1192,10 +1192,11 @@ toolbar[brighttext] #bookmarks-menu-button.bookmark-item {
-moz-image-region: rect(0, 342px, 18px, 324px);
}
+%ifdef MOZ_WEBRTC
#webrtc-status-button {
-moz-image-region: rect(0, 360px, 18px, 342px);
}
-
+%endif
/* ::::: fullscreen window controls ::::: */
@@ -1777,42 +1778,6 @@ richlistitem[type~="action"][actiontype="switchtab"] > .ac-url-box > .ac-action-
min-width: 27em;
}
-.panel-promo-box {
- margin: 10px -10px -10px;
- padding: 8px 10px;
- border-top: 1px solid ThreeDShadow;
- background-image: linear-gradient(hsla(0,0%,0%,.15), hsla(0,0%,0%,.08) 6px);
- border-bottom-left-radius: 3px;
- border-bottom-right-radius: 3px;
-}
-
-@media (-moz-windows-default-theme) {
- .panel-promo-box {
- border-top-style: none;
- background: #f1f5fb;
- color: GrayText;
- box-shadow: 0px 1px 2px rgb(204,214,234) inset;
- }
-}
-
-.panel-promo-icon {
- list-style-image: url("chrome://browser/skin/sync-notification-24.png");
- -moz-margin-end: 10px;
- vertical-align: middle;
-}
-
-.panel-promo-closebutton {
- -moz-appearance: none;
- border: none;
- -moz-margin-end: -10px;
- margin-top: -5px;
-}
-
-.panel-promo-closebutton > .toolbarbutton-text {
- padding: 0;
- margin: 0;
-}
-
/* ::::: content area ::::: */
#sidebar {
@@ -2443,10 +2408,12 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
list-style-image: url(chrome://browser/skin/mixed-content-blocked-64.png);
}
+%ifdef MOZ_WEBRTC
.popup-notification-icon[popupid="webRTC-sharingDevices"],
.popup-notification-icon[popupid="webRTC-shareDevices"] {
list-style-image: url(chrome://browser/skin/webRTC-shareDevice-64.png);
}
+%endif
.popup-notification-icon[popupid="pointerLock"] {
list-style-image: url(chrome://browser/skin/pointerLock-64.png);
@@ -2567,6 +2534,7 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
list-style-image: url(chrome://browser/skin/mixed-content-blocked-16.png);
}
+%ifdef MOZ_WEBRTC
.webRTC-shareDevices-notification-icon,
#webRTC-shareDevices-notification-icon {
list-style-image: url(chrome://browser/skin/webRTC-shareDevice-16.png);
@@ -2576,10 +2544,22 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
#webRTC-sharingDevices-notification-icon {
list-style-image: url(chrome://browser/skin/webRTC-sharingDevice-16.png);
}
+%endif
.web-notifications-notification-icon,
#web-notifications-notification-icon {
- list-style-image: url(chrome://browser/skin/notification-16.png);
+ list-style-image: url(chrome://browser/skin/web-notifications-tray.svg);
+ -moz-image-region: rect(0, 16px, 16px, 0);
+}
+
+.web-notifications-notification-icon:hover,
+#web-notifications-notification-icon:hover {
+ -moz-image-region: rect(0, 32px, 16px, 16px);
+}
+
+.web-notifications-notification-icon:hover:active,
+#web-notifications-notification-icon:hover:active {
+ -moz-image-region: rect(0, 48px, 16px, 32px);
}
#pointerLock-notification-icon {
@@ -2858,8 +2838,8 @@ toolbar[brighttext] #addonbar-closebutton {
}
%ifdef MOZ_DEVTOOLS
-%include ../../../toolkit/themes/shared/devtools/responsivedesign.inc.css
-%include ../../../toolkit/themes/shared/devtools/commandline.inc.css
+%include ../../../../devtools/client/themes/responsivedesign.inc.css
+%include ../../../../devtools/client/themes/commandline.inc.css
%endif
%include ../shared/plugin-doorhanger.inc.css
@@ -2876,23 +2856,23 @@ toolbar[brighttext] #addonbar-closebutton {
}
%endif
-.toolbarbutton-badge-container {
+.toolbarbutton-badge-stack {
margin: 0;
padding: 0;
position: relative;
}
-@navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-badge-container {
+@navbarLargeIcons@ .toolbarbutton-1 > .toolbarbutton-badge-stack {
padding: 2px 5px;
}
-.toolbarbutton-1 > .toolbarbutton-badge-container > .toolbar-icon {
+.toolbarbutton-1 > .toolbarbutton-badge-stack > .toolbar-icon {
position: absolute;
top: 2px;
right: 2px;
}
-.toolbarbutton-badge-container > .toolbarbutton-icon[label]:not([label=""]) {
+.toolbarbutton-badge-stack > .toolbarbutton-icon[label]:not([label=""]) {
-moz-margin-end: 0;
}
diff --git a/application/palemoon/themes/windows/jar.mn b/application/palemoon/themes/windows/jar.mn
index 1c1f139de9..8c0d9a5ccb 100644
--- a/application/palemoon/themes/windows/jar.mn
+++ b/application/palemoon/themes/windows/jar.mn
@@ -15,6 +15,7 @@ browser.jar:
#ifdef MOZ_SERVICES_SYNC
skin/classic/browser/aboutSyncTabs.css
#endif
+* skin/classic/browser/autocomplete.css
skin/classic/browser/actionicon-tab.png
skin/classic/browser/appmenu-icons.png
skin/classic/browser/appmenu-dropmarker.png
@@ -41,8 +42,6 @@ browser.jar:
skin/classic/browser/mixed-content-blocked-64.png
skin/classic/browser/monitor.png
skin/classic/browser/monitor_16-10.png
- skin/classic/browser/notification-16.png
- skin/classic/browser/notification-64.png
skin/classic/browser/pageInfo.css
skin/classic/browser/pageInfo.png
skin/classic/browser/page-livemarks.png (feeds/feedIcon16.png)
@@ -71,12 +70,16 @@ browser.jar:
skin/classic/browser/urlbar-history-dropmarker.png
skin/classic/browser/webapps-16.png
skin/classic/browser/webapps-64.png
+ skin/classic/browser/web-notifications-icon.svg
+ skin/classic/browser/web-notifications-tray.svg
skin/classic/browser/notification-pluginNormal.png (../shared/plugins/notification-pluginNormal.png)
skin/classic/browser/notification-pluginAlert.png (../shared/plugins/notification-pluginAlert.png)
skin/classic/browser/notification-pluginBlocked.png (../shared/plugins/notification-pluginBlocked.png)
+#ifdef MOZ_WEBRTC
skin/classic/browser/webRTC-shareDevice-16.png
skin/classic/browser/webRTC-shareDevice-64.png
skin/classic/browser/webRTC-sharingDevice-16.png
+#endif
skin/classic/browser/downloads/buttons.png (downloads/buttons.png)
skin/classic/browser/downloads/download-glow.png (downloads/download-glow.png)
skin/classic/browser/downloads/download-notification-finish.png (downloads/download-notification-finish.png)
@@ -98,7 +101,7 @@ browser.jar:
skin/classic/browser/newtab/controls.png (newtab/controls.png)
skin/classic/browser/newtab/noise.png (newtab/noise.png)
skin/classic/browser/places/places.css (places/places.css)
- skin/classic/browser/places/organizer.css (places/organizer.css)
+* skin/classic/browser/places/organizer.css (places/organizer.css)
skin/classic/browser/places/editBookmark.png (places/editBookmark.png)
skin/classic/browser/places/bookmark.png (places/bookmark.png)
skin/classic/browser/places/query.png (places/query.png)
@@ -157,7 +160,6 @@ browser.jar:
skin/classic/browser/sync-bg.png
skin/classic/browser/sync-desktopIcon.png
skin/classic/browser/sync-mobileIcon.png
- skin/classic/browser/sync-notification-24.png
skin/classic/browser/syncSetup.css
skin/classic/browser/syncCommon.css
skin/classic/browser/syncQuota.css
diff --git a/application/palemoon/themes/windows/notification-16.png b/application/palemoon/themes/windows/notification-16.png
deleted file mode 100644
index 6b2df73413..0000000000
--- a/application/palemoon/themes/windows/notification-16.png
+++ /dev/null
Binary files differ
diff --git a/application/palemoon/themes/windows/notification-64.png b/application/palemoon/themes/windows/notification-64.png
deleted file mode 100644
index a01d0ab776..0000000000
--- a/application/palemoon/themes/windows/notification-64.png
+++ /dev/null
Binary files differ
diff --git a/application/palemoon/themes/windows/preferences/aboutPermissions.css b/application/palemoon/themes/windows/preferences/aboutPermissions.css
index d9db6ccbf4..73b8d6e14c 100644
--- a/application/palemoon/themes/windows/preferences/aboutPermissions.css
+++ b/application/palemoon/themes/windows/preferences/aboutPermissions.css
@@ -93,7 +93,7 @@
list-style-image: url(chrome://global/skin/icons/question-48.png);
}
.pref-icon[type="desktop-notification"] {
- list-style-image: url(chrome://browser/skin/notification-64.png);
+ list-style-image: url(chrome://browser/skin/web-notifications-icon.svg);
}
.pref-icon[type="install"] {
list-style-image: url(chrome://mozapps/skin/extensions/extensionGeneric-48.png);
diff --git a/application/palemoon/themes/windows/sync-notification-24.png b/application/palemoon/themes/windows/sync-notification-24.png
deleted file mode 100644
index fc9a4e63d2..0000000000
--- a/application/palemoon/themes/windows/sync-notification-24.png
+++ /dev/null
Binary files differ
diff --git a/application/palemoon/themes/windows/web-notifications-icon.svg b/application/palemoon/themes/windows/web-notifications-icon.svg
new file mode 100644
index 0000000000..f7186c7275
--- /dev/null
+++ b/application/palemoon/themes/windows/web-notifications-icon.svg
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid" width="64" height="64" viewBox="0 0 64 64">
+ <defs>
+ <style>
+ .icon {
+ fill: #a6a6a6;
+ fill-rule: evenodd;
+ }
+ </style>
+ </defs>
+ <path d="M57,48 L46,48 L46,60.016 L32.482,48 L7,48 C5.343,48 4,46.657 4,45 L4,11.031 C4,9.374 5.343,8.031 7,8.031 L57,8.031 C58.657,8.031 60,9.374 60,11.031 L60,45 C60,46.657 58.657,48 57,48 ZM36,16.031 C36,14.927 35.105,14.031 34,14.031 L30,14.031 C28.895,14.031 28,14.927 28,16.031 L28,30.031 C28,31.136 28.895,32.031 30,32.031 L34,32.031 C35.105,32.031 36,31.136 36,30.031 L36,16.031 ZM36,37.5 C36,36.672 35.328,36 34.5,36 L29.5,36 C28.672,36 28,36.672 28,37.5 L28,40.5 C28,41.328 28.672,42 29.5,42 L34.5,42 C35.328,42 36,41.328 36,40.5 L36,37.5 Z" class="icon"/>
+</svg>
diff --git a/application/palemoon/themes/windows/web-notifications-tray.svg b/application/palemoon/themes/windows/web-notifications-tray.svg
new file mode 100644
index 0000000000..314026a106
--- /dev/null
+++ b/application/palemoon/themes/windows/web-notifications-tray.svg
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="48" height="16" viewBox="0 0 96 32">
+ <defs>
+ <style>
+ .style-icon-notification {
+ fill: #666666;
+ }
+ .style-icon-notification.hover {
+ fill: #808080;
+ }
+ .style-icon-notification.active {
+ fill: #4d4d4d;
+ }
+ </style>
+ <path id="shape-notifcations-push" d="M27,23.969 L24,23.969 L24,29.977 L17.241,23.969 L5,23.969 C3.343,23.969 2,22.626 2,20.969 L2,6.969 C2,5.312 3.343,3.969 5,3.969 L27,3.969 C28.657,3.969 30,5.312 30,6.969 L30,20.969 C30,22.626 28.657,23.969 27,23.969 ZM18,8.969 C18,7.864 17.105,6.969 16,6.969 C14.895,6.969 14,7.864 14,8.969 L14,13.969 C14,15.073 14.895,15.969 16,15.969 C17.105,15.969 18,15.073 18,13.969 L18,8.969 ZM16.5,17.969 L15.5,17.969 C14.672,17.969 14,18.640 14,19.469 C14,20.297 14.672,20.969 15.5,20.969 L16.5,20.969 C17.328,20.969 18,20.297 18,19.469 C18,18.640 17.328,17.969 16.5,17.969 Z"/>
+ </defs>
+ <use xlink:href="#shape-notifcations-push" class="style-icon-notification"/>
+ <use xlink:href="#shape-notifcations-push" transform="translate(32)" class="style-icon-notification hover"/>
+ <use xlink:href="#shape-notifcations-push" transform="translate(64)" class="style-icon-notification active"/>
+</svg>
diff --git a/application/xulrunner/README.xulrunner b/application/xulrunner/README.xulrunner
new file mode 100644
index 0000000000..424b7a6150
--- /dev/null
+++ b/application/xulrunner/README.xulrunner
@@ -0,0 +1,13 @@
+XULRunner is a package which can be used to run applications written in HTML
+or XUL. It can also be used to embed the gecko rendering engine into
+binary applications.
+
+XULRunner is not a product; it is a tool which can be used to create products.
+It is a byproduct of Firefox development and the Mozilla community does not
+have a strong commitment to support XULRunner development apart from Firefox
+development.
+
+For more information about using XULRunner or how to use this binary package,
+see the Mozilla Developer Center article:
+
+https://developer.mozilla.org/en/XULRunner
diff --git a/application/xulrunner/app.mozbuild b/application/xulrunner/app.mozbuild
new file mode 100644
index 0000000000..7b83160161
--- /dev/null
+++ b/application/xulrunner/app.mozbuild
@@ -0,0 +1,13 @@
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+include('/toolkit/toolkit.mozbuild')
+
+if CONFIG['MOZ_EXTENSIONS']:
+ DIRS += ['/extensions']
+
+DIRS += [
+ '/application/xulrunner',
+]
diff --git a/application/xulrunner/app/Makefile.in b/application/xulrunner/app/Makefile.in
new file mode 100644
index 0000000000..98e377d69c
--- /dev/null
+++ b/application/xulrunner/app/Makefile.in
@@ -0,0 +1,75 @@
+# vim:set ts=8 sw=8 sts=8 et:
+# 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/.
+
+GARBAGE += $(addprefix $(DIST)/bin/defaults/pref/,xulrunner.js)
+
+ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
+TK_LIBS := -framework Cocoa $(TK_LIBS)
+endif
+
+ifndef MOZ_WINCONSOLE
+ifdef MOZ_DEBUG
+MOZ_WINCONSOLE = 1
+else
+MOZ_WINCONSOLE = 0
+endif
+endif
+
+# This switches $(INSTALL) to copy mode, like $(SYSINSTALL), so things that
+# shouldn't get 755 perms need $(IFLAGS1) for either way of calling nsinstall.
+NSDISTMODE = copy
+
+include $(topsrcdir)/config/config.mk
+
+include $(topsrcdir)/config/rules.mk
+
+DEFINES += -DXULRUNNER_ICO='"$(DIST)/branding/xulrunner.ico"' -DDOCUMENT_ICO='"$(DIST)/branding/document.ico"'
+
+ifdef MOZ_WIDGET_GTK
+libs::
+ $(INSTALL) $(IFLAGS1) $(DIST)/branding/default16.png $(DIST)/bin/chrome/icons/default
+ $(INSTALL) $(IFLAGS1) $(DIST)/branding/default32.png $(DIST)/bin/chrome/icons/default
+ $(INSTALL) $(IFLAGS1) $(DIST)/branding/default48.png $(DIST)/bin/chrome/icons/default
+endif
+
+# XXX applications would need to supply this file
+#export:: brand.dtd.in
+# $(call py_action,preprocessor,$(DEFINES) $(ACDEFINES) $^ -o brand.dtd)
+
+ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
+
+FRAMEWORK_NAME = XUL
+FRAMEWORK_VERSION = $(MOZILLA_VERSION)
+
+FRAMEWORK_DIR = \
+ $(DIST)/$(FRAMEWORK_NAME).framework/Versions/$(FRAMEWORK_VERSION)
+
+$(FRAMEWORK_DIR)/Resources:
+ $(NSINSTALL) -D $@
+
+tools:: $(PROGRAM) $(FRAMEWORK_DIR)/Resources
+ $(NSINSTALL) $(srcdir)/macbuild/InfoPlist.strings $(FRAMEWORK_DIR)/Resources
+ sed -e 's/APP_VERSION/$(APP_VERSION)/' $(srcdir)/macbuild/Info.plist.in > $(FRAMEWORK_DIR)/Info.plist
+ rsync -av $(DIST)/bin/ $(FRAMEWORK_DIR) --exclude mangle --exclude shlibsign
+ rm -f $(DIST)/$(FRAMEWORK_NAME).framework/Versions/Current \
+ $(DIST)/$(FRAMEWORK_NAME).framework/libxpcom.dylib \
+ $(DIST)/$(FRAMEWORK_NAME).framework/XUL \
+ $(DIST)/$(FRAMEWORK_NAME).framework/xulrunner
+ ln -s $(FRAMEWORK_VERSION) $(DIST)/$(FRAMEWORK_NAME).framework/Versions/Current
+ ln -s Versions/Current/libxpcom.dylib $(DIST)/$(FRAMEWORK_NAME).framework/libxpcom.dylib
+ ln -s Versions/Current/XUL $(DIST)/$(FRAMEWORK_NAME).framework/XUL
+ ln -s Versions/Current/xulrunner $(DIST)/$(FRAMEWORK_NAME).framework/xulrunner
+
+clean clobber::
+ rm -rf $(DIST)/$(FRAMEWORK_NAME).framework
+endif
+
+README_FILE = $(srcdir)/../README.xulrunner
+
+libs::
+ $(INSTALL) $(IFLAGS1) $(README_FILE) $(DIST)/bin
+ $(INSTALL) $(IFLAGS1) $(topsrcdir)/LICENSE $(DIST)/bin
+ $(INSTALL) $(IFLAGS1) $(srcdir)/install_app.py $(DIST)/bin
+
diff --git a/application/xulrunner/app/default16.png b/application/xulrunner/app/default16.png
new file mode 100644
index 0000000000..e74f5cf2e4
--- /dev/null
+++ b/application/xulrunner/app/default16.png
Binary files differ
diff --git a/application/xulrunner/app/default32.png b/application/xulrunner/app/default32.png
new file mode 100644
index 0000000000..9145090543
--- /dev/null
+++ b/application/xulrunner/app/default32.png
Binary files differ
diff --git a/application/xulrunner/app/default48.png b/application/xulrunner/app/default48.png
new file mode 100644
index 0000000000..5fd71e110c
--- /dev/null
+++ b/application/xulrunner/app/default48.png
Binary files differ
diff --git a/application/xulrunner/app/document.ico b/application/xulrunner/app/document.ico
new file mode 100644
index 0000000000..3111163247
--- /dev/null
+++ b/application/xulrunner/app/document.ico
Binary files differ
diff --git a/application/xulrunner/app/install_app.py b/application/xulrunner/app/install_app.py
new file mode 100644
index 0000000000..6be8c5ecb5
--- /dev/null
+++ b/application/xulrunner/app/install_app.py
@@ -0,0 +1,221 @@
+#!/usr/bin/env python
+
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this file,
+# You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# Min version of python is 2.7
+import sys
+if ((sys.version_info.major != 2) or (sys.version_info.minor < 7)):
+ raise Exception("You need to use Python version 2.7 or higher")
+
+import os, shutil, re, zipfile
+from ConfigParser import SafeConfigParser
+
+# Platform-specific support
+# see https://developer.mozilla.org/en/XULRunner/Deploying_XULRunner_1.8
+if sys.platform.startswith('linux') or sys.platform == "win32":
+ def installApp(appLocation, installDir, appName, greDir):
+ zipApp, iniParser, appName = validateArguments(appLocation, installDir, appName, greDir)
+ if (zipApp):
+ zipApp.extractAll(installDir)
+ else:
+ shutil.copytree(appLocation, installDir)
+ shutil.copy2(os.path.join(greDir, xulrunnerStubName),
+ os.path.join(installDir, appName))
+ copyGRE(greDir, os.path.join(installDir, "xulrunner"))
+
+if sys.platform.startswith('linux'):
+ xulrunnerStubName = "xulrunner-stub"
+
+ def makeAppName(leafName):
+ return leafName.lower()
+
+elif sys.platform == "win32":
+ xulrunnerStubName = "xulrunner-stub.exe"
+
+ def makeAppName(leafName):
+ return leafName + ".exe"
+
+elif sys.platform == "darwin":
+ xulrunnerStubName = "xulrunner-stub"
+
+ def installApp(appLocation, installDir, appName, greDir):
+ zipApp, iniparser, appName = validateArguments(appLocation, installDir, appName, greDir)
+ installDir += "/" + appName + ".app"
+ resourcesDir = os.path.join(installDir, "Contents/Resources")
+ if (zipApp):
+ zipApp.extractAll(resourcesDir)
+ else:
+ shutil.copytree(appLocation, resourcesDir)
+ MacOSDir = os.path.join(installDir, "Contents/MacOS")
+ os.makedirs(MacOSDir)
+ shutil.copy2(os.path.join(greDir, xulrunnerStubName), MacOSDir)
+ copyGRE(greDir,
+ os.path.join(installDir, "Contents/Frameworks/XUL.framework"))
+
+ # Contents/Info.plist
+ contents = """<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+<key>CFBundleInfoDictionaryVersion</key>
+<string>6.0</string>
+<key>CFBundlePackageType</key>
+<string>APPL</string>
+<key>CFBundleSignature</key>
+<string>????</string>
+<key>CFBundleExecutable</key>
+<string>xulrunner</string>
+<key>NSAppleScriptEnabled</key>
+<true/>
+<key>CFBundleGetInfoString</key>
+<string>$infoString</string>
+<key>CFBundleName</key>
+<string>$appName</string>
+<key>CFBundleShortVersionString</key>
+<string>$version</string>
+<key>CFBundleVersion</key>
+<string>$version.$buildID</string>
+<key>CFBundleIdentifier</key>
+<string>$reverseVendor</string>
+</dict>
+</plist>
+"""
+ version = iniparser.get("App", "Version")
+ buildID = iniparser.get("App", "BuildID")
+ infoString = appName + " " + version
+ reverseVendor = "com.vendor.unknown"
+ appID = iniparser.get("App", "ID")
+ colonIndex = appID.find("@") + 1
+ if (colonIndex != 0):
+ vendor = appID[colonIndex:]
+ reverseVendor = ".".join(vendor.split(".")[::-1])
+ contents = contents.replace("$infoString", infoString)
+ contents = contents.replace("$appName", appName)
+ contents = contents.replace("$version", version)
+ contents = contents.replace("$buildID", buildID)
+ contents = contents.replace("$reverseVendor", reverseVendor)
+ infoPList = open(os.path.join(installDir, "Contents/Info.plist"), "w+b")
+ infoPList.write(contents)
+ infoPList.close()
+
+ def makeAppName(leafName):
+ return leafName
+
+else:
+ # Implement xulrunnerStubName, installApp and makeAppName as above.
+ raise Exception("This operating system isn't supported for install_app.py yet!")
+# End platform-specific support
+
+def resolvePath(path):
+ return os.path.realpath(path)
+
+def requireINIOption(iniparser, section, option):
+ if not (iniparser.has_option(section, option)):
+ raise Exception("application.ini must have a " + option + " option under the " + section + " section")
+
+def checkAppINI(appLocation):
+ if (os.path.isdir(appLocation)):
+ zipApp = None
+ appINIPath = os.path.join(appLocation, "application.ini")
+ if not (os.path.isfile(appINIPath)):
+ raise Exception(appINIPath + " does not exist")
+ appINI = open(appINIPath)
+ elif (zipfile.is_zipfile(appLocation)):
+ zipApp = zipfile.ZipFile(appLocation)
+ if not ("application.ini" in zipApp.namelist()):
+ raise Exception("jar:" + appLocation + "!/application.ini does not exist")
+ appINI = zipApp.open("application.ini")
+ else:
+ raise Exception("appLocation must be a directory containing application.ini or a zip file with application.ini at its root")
+
+ # application.ini verification
+ iniparser = SafeConfigParser()
+ iniparser.readfp(appINI)
+ if not (iniparser.has_section("App")):
+ raise Exception("application.ini must have an App section")
+ if not (iniparser.has_section("Gecko")):
+ raise Exception("application.ini must have a Gecko section")
+ requireINIOption(iniparser, "App", "Name")
+ requireINIOption(iniparser, "App", "Version")
+ requireINIOption(iniparser, "App", "BuildID")
+ requireINIOption(iniparser, "App", "ID")
+ requireINIOption(iniparser, "Gecko", "MinVersion")
+
+ return zipApp, iniparser
+ pass
+
+def copyGRE(greDir, targetDir):
+ shutil.copytree(greDir, targetDir, symlinks=True)
+
+def validateArguments(appLocation, installDir, appName, greDir):
+ # application directory / zip verification
+ appLocation = resolvePath(appLocation)
+
+ # target directory
+ installDir = resolvePath(installDir)
+
+ if (os.path.exists(installDir)):
+ raise Exception("installDir must not exist: " + cmds.installDir)
+
+ greDir = resolvePath(greDir)
+ xulrunnerStubPath = os.path.isfile(os.path.join(greDir, xulrunnerStubName))
+ if not xulrunnerStubPath:
+ raise Exception("XULRunner stub executable not found: " + os.path.join(greDir, xulrunnerStubName))
+
+ # appName
+ zipApp, iniparser = checkAppINI(appLocation)
+ if not appName:
+ appName = iniparser.get("App", "Name")
+ appName = makeAppName(appName)
+ pattern = re.compile("[\\\/\:*?\"<>|\x00]")
+ if pattern.search(appName):
+ raise Exception("App name has illegal characters for at least one operating system")
+ return zipApp, iniparser, appName
+
+def handleCommandLine():
+ import argparse
+
+ # Argument parsing.
+ parser = argparse.ArgumentParser(
+ description="XULRunner application installer",
+ usage="""install_app.py appLocation installDir greDir [--appName APPNAME]
+ install_app.py -h
+ install_app.py --version
+ """
+ )
+ parser.add_argument(
+ "appLocation",
+ action="store",
+ help="The directory or ZIP file containing application.ini as a top-level child file"
+ )
+ parser.add_argument(
+ "installDir",
+ action="store",
+ help="The directory to install the application to"
+ )
+ parser.add_argument(
+ "--greDir",
+ action="store",
+ help="The directory containing the Gecko SDK (usually where this Python script lives)",
+ default=os.path.dirname(sys.argv[0])
+ )
+ parser.add_argument(
+ "--appName",
+ action="store",
+ help="The name of the application to install"
+ )
+ parser.add_argument("--version", action="version", version="%(prog)s 1.0")
+
+ # The command code.
+ cmds = parser.parse_args()
+ try:
+ installApp(cmds.appLocation, cmds.installDir, cmds.appName, cmds.greDir)
+ except exn:
+ shutil.rmtree(cmds.installDir)
+ raise exn
+ print cmds.appName + " application installed to " + cmds.installDir
+
+if __name__ == '__main__':
+ handleCommandLine()
diff --git a/application/xulrunner/app/macbuild/Info.plist.in b/application/xulrunner/app/macbuild/Info.plist.in
new file mode 100644
index 0000000000..69676b80c5
--- /dev/null
+++ b/application/xulrunner/app/macbuild/Info.plist.in
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>xulrunner-bin</string>
+ <key>CFBundleIdentifier</key>
+ <string>org.mozilla.xulrunner</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>XULRunner</string>
+ <key>CFBundlePackageType</key>
+ <string>FMWK</string>
+ <key>CFBundleSignature</key>
+ <string>MOZB</string>
+ <key>CFBundleVersion</key>
+ <string>APP_VERSION</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>10.5</string>
+ <key>LSMinimumSystemVersionByArchitecture</key>
+ <dict>
+ <key>i386</key>
+ <string>10.5.0</string>
+ <key>x86_64</key>
+ <string>10.6.0</string>
+ </dict>
+</dict>
+</plist>
diff --git a/application/xulrunner/app/macbuild/InfoPlist.strings b/application/xulrunner/app/macbuild/InfoPlist.strings
new file mode 100644
index 0000000000..5d9eefd515
--- /dev/null
+++ b/application/xulrunner/app/macbuild/InfoPlist.strings
Binary files differ
diff --git a/application/xulrunner/app/moz.build b/application/xulrunner/app/moz.build
new file mode 100644
index 0000000000..1c9cb117cf
--- /dev/null
+++ b/application/xulrunner/app/moz.build
@@ -0,0 +1,70 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+GeckoProgram('xulrunner')
+
+SOURCES += [
+ 'nsXULRunnerApp.cpp',
+]
+
+DEFINES['XULRUNNER_PROGNAME'] = '"xulrunner"'
+if CONFIG['MOZ_DEBUG']:
+ DEFINES['DEBUG'] = True
+
+LOCAL_INCLUDES += [
+ '/toolkit/profile',
+ '/toolkit/xre',
+ '/xpcom/base',
+ '/xpcom/build',
+]
+
+if CONFIG['_MSC_VER']:
+ # Always enter a Windows program through wmain, whether or not we're
+ # a console application.
+ WIN32_EXE_LDFLAGS += ['-ENTRY:wmainCRTStartup']
+
+# Control the default heap size.
+# This is the heap returned by GetProcessHeap().
+# As we use the CRT heap, the default size is too large and wastes VM.
+#
+# The default heap size is 1MB on Win32.
+# The heap will grow if need be.
+#
+# Set it to 256k. See bug 127069.
+if CONFIG['OS_ARCH'] == 'WINNT' and not CONFIG['GNU_CC']:
+ LDFLAGS += ['/HEAP:0x40000']
+
+if CONFIG['OS_ARCH'] == 'WINNT':
+ RCINCLUDE = 'splash.rc'
+ OS_LIBS += [
+ 'comctl32',
+ 'comdlg32',
+ 'uuid',
+ 'shell32',
+ 'ole32',
+ 'oleaut32',
+ 'version',
+ 'winspool',
+ ]
+
+DISABLE_STL_WRAPPING = True
+
+JS_PREFERENCE_PP_FILES += [
+ 'xulrunner.js',
+]
+
+if CONFIG['OS_ARCH'] == 'WINNT':
+ BRANDING_FILES += [
+ 'document.ico',
+ 'xulrunner.ico',
+ ]
+
+if CONFIG['MOZ_WIDGET_GTK']:
+ BRANDING_FILES += [
+ 'default16.png',
+ 'default32.png',
+ 'default48.png',
+ ]
diff --git a/application/xulrunner/app/nsXULRunnerApp.cpp b/application/xulrunner/app/nsXULRunnerApp.cpp
new file mode 100644
index 0000000000..d86317a856
--- /dev/null
+++ b/application/xulrunner/app/nsXULRunnerApp.cpp
@@ -0,0 +1,294 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsXULAppAPI.h"
+#include "nsXPCOMGlue.h"
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef XP_WIN
+#include <windows.h>
+#if defined(_MSC_VER) && _MSC_VER < 1900
+#define snprintf _snprintf
+#endif
+#define strcasecmp _stricmp
+#endif
+
+#include "nsAppRunner.h"
+#include "nsIFile.h"
+#include "nsCOMPtr.h"
+#include "nsMemory.h"
+#include "nsCRTGlue.h"
+#include "nsStringAPI.h"
+#include "nsServiceManagerUtils.h"
+#include "plstr.h"
+#include "prprf.h"
+#include "prenv.h"
+#include "nsINIParser.h"
+
+#ifdef XP_WIN
+#define XRE_DONT_SUPPORT_XPSP2 // See https://bugzil.la/1023941#c32
+#include "nsWindowsWMain.cpp"
+#endif
+
+#include "BinaryPath.h"
+
+#include "nsXPCOMPrivate.h" // for MAXPATHLEN and XPCOM_DLL
+
+using namespace mozilla;
+
+/**
+ * Output a string to the user. This method is really only meant to be used to
+ * output last-ditch error messages designed for developers NOT END USERS.
+ *
+ * @param isError
+ * Pass true to indicate severe errors.
+ * @param fmt
+ * printf-style format string followed by arguments.
+ */
+static void Output(bool isError, const char *fmt, ... )
+{
+ va_list ap;
+ va_start(ap, fmt);
+
+#if (defined(XP_WIN) && !MOZ_WINCONSOLE)
+ wchar_t msg[2048];
+ _vsnwprintf(msg, sizeof(msg)/sizeof(msg[0]), NS_ConvertUTF8toUTF16(fmt).get(), ap);
+
+ UINT flags = MB_OK;
+ if (isError)
+ flags |= MB_ICONERROR;
+ else
+ flags |= MB_ICONINFORMATION;
+
+ MessageBoxW(nullptr, msg, L"XULRunner", flags);
+#else
+ vfprintf(stderr, fmt, ap);
+#endif
+
+ va_end(ap);
+}
+
+/**
+ * Return true if |arg| matches the given argument name.
+ */
+static bool IsArg(const char* arg, const char* s)
+{
+ if (*arg == '-')
+ {
+ if (*++arg == '-')
+ ++arg;
+ return !strcasecmp(arg, s);
+ }
+
+#if defined(XP_WIN)
+ if (*arg == '/')
+ return !strcasecmp(++arg, s);
+#endif
+
+ return false;
+}
+
+static nsresult
+GetGREVersion(const char *argv0,
+ nsACString *aMilestone,
+ nsACString *aVersion)
+{
+ if (aMilestone)
+ aMilestone->AssignLiteral("<Error>");
+ if (aVersion)
+ aVersion->AssignLiteral("<Error>");
+
+ nsCOMPtr<nsIFile> iniFile;
+ nsresult rv = BinaryPath::GetFile(argv0, getter_AddRefs(iniFile));
+ if (NS_FAILED(rv))
+ return rv;
+
+ iniFile->SetNativeLeafName(NS_LITERAL_CSTRING("platform.ini"));
+
+ nsINIParser parser;
+ rv = parser.Init(iniFile);
+ if (NS_FAILED(rv))
+ return rv;
+
+ if (aMilestone) {
+ rv = parser.GetString("Build", "Milestone", *aMilestone);
+ if (NS_FAILED(rv))
+ return rv;
+ }
+ if (aVersion) {
+ rv = parser.GetString("Build", "BuildID", *aVersion);
+ if (NS_FAILED(rv))
+ return rv;
+ }
+ return NS_OK;
+}
+
+static void Usage(const char *argv0)
+{
+ nsAutoCString milestone;
+ GetGREVersion(argv0, &milestone, nullptr);
+
+ // display additional information (XXX make localizable?)
+ Output(false,
+ "Mozilla XULRunner %s\n\n"
+ "Usage: " XULRUNNER_PROGNAME " [OPTIONS]\n"
+ " " XULRUNNER_PROGNAME " APP-FILE [APP-OPTIONS...]\n"
+ "\n"
+ "OPTIONS\n"
+ " --app specify APP-FILE (optional)\n"
+ " -h, --help show this message\n"
+ " -v, --version show version\n"
+ " --gre-version print the GRE version string on stdout\n"
+ "\n"
+ "APP-FILE\n"
+ " Application initialization file.\n"
+ "\n"
+ "APP-OPTIONS\n"
+ " Application specific options.\n",
+ milestone.get());
+}
+
+XRE_GetFileFromPathType XRE_GetFileFromPath;
+XRE_CreateAppDataType XRE_CreateAppData;
+XRE_FreeAppDataType XRE_FreeAppData;
+XRE_mainType XRE_main;
+
+static const nsDynamicFunctionLoad kXULFuncs[] = {
+ { "XRE_GetFileFromPath", (NSFuncPtr*) &XRE_GetFileFromPath },
+ { "XRE_CreateAppData", (NSFuncPtr*) &XRE_CreateAppData },
+ { "XRE_FreeAppData", (NSFuncPtr*) &XRE_FreeAppData },
+ { "XRE_main", (NSFuncPtr*) &XRE_main },
+ { nullptr, nullptr }
+};
+
+class AutoAppData
+{
+public:
+ AutoAppData(nsIFile* aINIFile) : mAppData(nullptr) {
+ nsresult rv = XRE_CreateAppData(aINIFile, &mAppData);
+ if (NS_FAILED(rv))
+ mAppData = nullptr;
+ }
+ ~AutoAppData() {
+ if (mAppData)
+ XRE_FreeAppData(mAppData);
+ }
+
+ operator nsXREAppData*() const { return mAppData; }
+ nsXREAppData* operator -> () const { return mAppData; }
+
+private:
+ nsXREAppData* mAppData;
+};
+
+int main(int argc, char* argv[])
+{
+ char exePath[MAXPATHLEN];
+ nsresult rv = mozilla::BinaryPath::Get(argv[0], exePath);
+ if (NS_FAILED(rv)) {
+ Output(true, "Couldn't calculate the application directory.\n");
+ return 255;
+ }
+
+ char *lastSlash = strrchr(exePath, XPCOM_FILE_PATH_SEPARATOR[0]);
+ if (!lastSlash || (size_t(lastSlash - exePath) > MAXPATHLEN - sizeof(XPCOM_DLL) - 1))
+ return 255;
+
+ strcpy(++lastSlash, XPCOM_DLL);
+
+ rv = XPCOMGlueStartup(exePath);
+ if (NS_FAILED(rv)) {
+ Output(true, "Couldn't load XPCOM.\n");
+ return 255;
+ }
+
+ if (argc > 1 && (IsArg(argv[1], "h") ||
+ IsArg(argv[1], "help") ||
+ IsArg(argv[1], "?")))
+ {
+ Usage(argv[0]);
+ return 0;
+ }
+
+ if (argc == 2 && (IsArg(argv[1], "v") || IsArg(argv[1], "version")))
+ {
+ nsAutoCString milestone;
+ nsAutoCString version;
+ GetGREVersion(argv[0], &milestone, &version);
+ Output(false, "Mozilla XULRunner %s - %s\n",
+ milestone.get(), version.get());
+ return 0;
+ }
+
+ rv = XPCOMGlueLoadXULFunctions(kXULFuncs);
+ if (NS_FAILED(rv)) {
+ Output(true, "Couldn't load XRE functions.\n");
+ return 255;
+ }
+
+ if (argc > 1) {
+ nsAutoCString milestone;
+ rv = GetGREVersion(argv[0], &milestone, nullptr);
+ if (NS_FAILED(rv))
+ return 2;
+
+ if (IsArg(argv[1], "gre-version")) {
+ if (argc != 2) {
+ Usage(argv[0]);
+ return 1;
+ }
+
+ printf("%s\n", milestone.get());
+ return 0;
+ }
+
+ if (IsArg(argv[1], "install-app")) {
+ Output(true, "--install-app support has been removed. Use 'python install-app.py' instead.\n");
+ return 1;
+ }
+ }
+
+ const char *appDataFile = getenv("XUL_APP_FILE");
+
+ if (!(appDataFile && *appDataFile)) {
+ if (argc < 2) {
+ Usage(argv[0]);
+ return 1;
+ }
+
+ if (IsArg(argv[1], "app")) {
+ if (argc == 2) {
+ Usage(argv[0]);
+ return 1;
+ }
+ argv[1] = argv[0];
+ ++argv;
+ --argc;
+ }
+
+ appDataFile = argv[1];
+ argv[1] = argv[0];
+ ++argv;
+ --argc;
+
+ static char kAppEnv[MAXPATHLEN];
+ snprintf(kAppEnv, MAXPATHLEN, "XUL_APP_FILE=%s", appDataFile);
+ putenv(kAppEnv);
+ }
+
+ nsCOMPtr<nsIFile> appDataLF;
+ rv = XRE_GetFileFromPath(appDataFile, getter_AddRefs(appDataLF));
+ if (NS_FAILED(rv)) {
+ Output(true, "Error: unrecognized application.ini path.\n");
+ return 2;
+ }
+
+ AutoAppData appData(appDataLF);
+ if (!appData) {
+ Output(true, "Error: couldn't parse application.ini.\n");
+ return 2;
+ }
+
+ return XRE_main(argc, argv, appData, 0);
+}
diff --git a/application/xulrunner/app/splash.rc b/application/xulrunner/app/splash.rc
new file mode 100644
index 0000000000..4374383ba5
--- /dev/null
+++ b/application/xulrunner/app/splash.rc
@@ -0,0 +1,22 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include <windows.h>
+#include "nsNativeAppSupportWin.h"
+
+1 24 "xulrunner.exe.manifest"
+
+IDI_APPICON ICON XULRUNNER_ICO
+IDI_DOCUMENT ICON DOCUMENT_ICO
+IDI_APPLICATION ICON XULRUNNER_ICO
+
+STRINGTABLE DISCARDABLE
+BEGIN
+#ifdef DEBUG
+ IDS_STARTMENU_APPNAME, "Firefox Debug"
+#else
+ IDS_STARTMENU_APPNAME, "Firefox"
+#endif
+END
diff --git a/application/xulrunner/app/xulrunner.exe.manifest b/application/xulrunner/app/xulrunner.exe.manifest
new file mode 100644
index 0000000000..b08eea0745
--- /dev/null
+++ b/application/xulrunner/app/xulrunner.exe.manifest
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<assemblyIdentity
+ version="1.0.0.0"
+ processorArchitecture="*"
+ name="Mozilla.XULRunner"
+ type="win32"
+/>
+<description>Mozilla XULRunner</description>
+<dependency>
+ <dependentAssembly>
+ <assemblyIdentity
+ type="win32"
+ name="Microsoft.Windows.Common-Controls"
+ version="6.0.0.0"
+ processorArchitecture="*"
+ publicKeyToken="6595b64144ccf1df"
+ language="*"
+ />
+ </dependentAssembly>
+</dependency>
+<ms_asmv3:trustInfo xmlns:ms_asmv3="urn:schemas-microsoft-com:asm.v3">
+ <ms_asmv3:security>
+ <ms_asmv3:requestedPrivileges>
+ <ms_asmv3:requestedExecutionLevel level="asInvoker" uiAccess="false" />
+ </ms_asmv3:requestedPrivileges>
+ </ms_asmv3:security>
+</ms_asmv3:trustInfo>
+ <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+ <application>
+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
+ </application>
+ </compatibility>
+</assembly>
diff --git a/application/xulrunner/app/xulrunner.ico b/application/xulrunner/app/xulrunner.ico
new file mode 100644
index 0000000000..0518438a04
--- /dev/null
+++ b/application/xulrunner/app/xulrunner.ico
Binary files differ
diff --git a/application/xulrunner/app/xulrunner.js b/application/xulrunner/app/xulrunner.js
new file mode 100644
index 0000000000..509bb48a50
--- /dev/null
+++ b/application/xulrunner/app/xulrunner.js
@@ -0,0 +1,26 @@
+/* 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/. */
+
+#filter substitution
+
+// We need to override the default values of these preferences since all.js
+// assumes these are in the navigator package, which for us is nonexistent.
+// XXX(darin): perhaps all.js should not be seamonkey specific
+pref("general.useragent.locale", "@AB_CD@");
+pref("xpinstall.dialog.confirm", "chrome://mozapps/content/xpinstall/xpinstallConfirm.xul");
+pref("xpinstall.dialog.progress.chrome", "chrome://mozapps/content/extensions/extensions.xul");
+pref("xpinstall.dialog.progress.skin", "chrome://mozapps/content/extensions/extensions.xul");
+pref("xpinstall.dialog.progress.type.chrome", "Extension:Manager");
+pref("xpinstall.dialog.progress.type.skin", "Extension:Manager");
+pref("xpinstall.enabled", true);
+#ifdef XP_WIN
+pref("browser.preferences.instantApply", false);
+#else
+pref("browser.preferences.instantApply", true);
+#endif
+#ifdef XP_MACOSX
+pref("browser.preferences.animateFadeIn", true);
+#else
+pref("browser.preferences.animateFadeIn", false);
+#endif
diff --git a/application/xulrunner/config/mozconfig b/application/xulrunner/config/mozconfig
new file mode 100644
index 0000000000..9fa972cac7
--- /dev/null
+++ b/application/xulrunner/config/mozconfig
@@ -0,0 +1,9 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# This file specifies the build flags for XULRunner. You can use it by adding:
+# . $topsrcdir/xulrunner/config/mozconfig
+# to the top of your mozconfig file.
+
+ac_add_options --enable-application=xulrunner
diff --git a/application/xulrunner/config/mozconfigs/common b/application/xulrunner/config/mozconfigs/common
new file mode 100644
index 0000000000..a6811c575c
--- /dev/null
+++ b/application/xulrunner/config/mozconfigs/common
@@ -0,0 +1,7 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# This file is included at the top of all xulrunner mozconfigs
+
+. "$topsrcdir/build/mozconfig.common"
diff --git a/application/xulrunner/config/mozconfigs/common.override b/application/xulrunner/config/mozconfigs/common.override
new file mode 100644
index 0000000000..8d719a5b5e
--- /dev/null
+++ b/application/xulrunner/config/mozconfigs/common.override
@@ -0,0 +1,8 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# This file is included at the bottom of all xulrunner mozconfigs
+
+. "$topsrcdir/build/mozconfig.common.override"
+. "$topsrcdir/build/mozconfig.cache"
diff --git a/application/xulrunner/config/mozconfigs/linux32/xulrunner b/application/xulrunner/config/mozconfigs/linux32/xulrunner
new file mode 100644
index 0000000000..171674f8c8
--- /dev/null
+++ b/application/xulrunner/config/mozconfigs/linux32/xulrunner
@@ -0,0 +1,9 @@
+export MOZILLA_OFFICIAL=1
+export JAVA_HOME=/tools/jdk
+
+ac_add_options --enable-application=xulrunner
+ac_add_options --disable-tests
+
+. $topsrcdir/build/unix/mozconfig.linux32
+
+. "$topsrcdir/xulrunner/config/mozconfigs/common.override"
diff --git a/application/xulrunner/config/mozconfigs/linux32/xulrunner-qt b/application/xulrunner/config/mozconfigs/linux32/xulrunner-qt
new file mode 100644
index 0000000000..54e4ecb8f5
--- /dev/null
+++ b/application/xulrunner/config/mozconfigs/linux32/xulrunner-qt
@@ -0,0 +1,15 @@
+export MOZILLA_OFFICIAL=1
+export JAVA_HOME=/tools/jdk
+
+ac_add_options --enable-application=xulrunner
+ac_add_options --disable-tests
+
+. $topsrcdir/build/unix/mozconfig.linux32
+
+# QT Options
+export PKG_CONFIG_PATH=/tools/qt-4.6.3/qt/lib/pkgconfig
+ac_add_options --with-qtdir=/tools/qt-4.6.3/qt
+ac_add_options --enable-default-toolkit=cairo-qt
+ac_add_options --disable-crashreporter
+
+. "$topsrcdir/xulrunner/config/mozconfigs/common.override"
diff --git a/application/xulrunner/config/mozconfigs/linux64/xulrunner b/application/xulrunner/config/mozconfigs/linux64/xulrunner
new file mode 100644
index 0000000000..c18a12f679
--- /dev/null
+++ b/application/xulrunner/config/mozconfigs/linux64/xulrunner
@@ -0,0 +1,9 @@
+export MOZILLA_OFFICIAL=1
+export JAVA_HOME=/tools/jdk
+
+ac_add_options --enable-application=xulrunner
+ac_add_options --disable-tests
+
+. $topsrcdir/build/unix/mozconfig.linux
+
+. "$topsrcdir/xulrunner/config/mozconfigs/common.override"
diff --git a/application/xulrunner/config/mozconfigs/macosx-universal/xulrunner b/application/xulrunner/config/mozconfigs/macosx-universal/xulrunner
new file mode 100644
index 0000000000..ac7e24fe23
--- /dev/null
+++ b/application/xulrunner/config/mozconfigs/macosx-universal/xulrunner
@@ -0,0 +1,9 @@
+. $topsrcdir/build/macosx/universal/mozconfig
+
+export MOZILLA_OFFICIAL=1
+
+ac_add_options --enable-application=xulrunner
+ac_add_options --disable-tests
+ac_add_options --with-xulrunner-stub-name=xulrunner-stub
+
+. "$topsrcdir/xulrunner/config/mozconfigs/common.override"
diff --git a/application/xulrunner/config/mozconfigs/win32/xulrunner b/application/xulrunner/config/mozconfigs/win32/xulrunner
new file mode 100644
index 0000000000..4c8b596a56
--- /dev/null
+++ b/application/xulrunner/config/mozconfigs/win32/xulrunner
@@ -0,0 +1,16 @@
+. "$topsrcdir/xulrunner/config/mozconfigs/common"
+
+export MOZILLA_OFFICIAL=1
+export JAVA_HOME=/d/jdk1.6.0_14
+
+ac_add_options --enable-application=xulrunner
+ac_add_options --enable-jemalloc
+ac_add_options --disable-tests
+
+if test "$PROCESSOR_ARCHITECTURE" = "AMD64" -o "$PROCESSOR_ARCHITEW6432" = "AMD64"; then
+ . $topsrcdir/build/win32/mozconfig.vs2013-win64
+else
+ . $topsrcdir/build/win32/mozconfig.vs2010
+fi
+
+. "$topsrcdir/xulrunner/config/mozconfigs/common.override"
diff --git a/application/xulrunner/config/mozconfigs/win64/xulrunner b/application/xulrunner/config/mozconfigs/win64/xulrunner
new file mode 100644
index 0000000000..7dbade2bb0
--- /dev/null
+++ b/application/xulrunner/config/mozconfigs/win64/xulrunner
@@ -0,0 +1,15 @@
+. "$topsrcdir/xulrunner/config/mozconfigs/common"
+
+ac_add_options --target=x86_64-pc-mingw32
+ac_add_options --host=x86_64-pc-mingw32
+
+export MOZILLA_OFFICIAL=1
+export JAVA_HOME=/d/jdk1.6.0_14
+
+ac_add_options --enable-application=xulrunner
+ac_add_options --enable-jemalloc
+ac_add_options --disable-tests
+
+. $topsrcdir/build/win64/mozconfig.vs2013
+
+. "$topsrcdir/xulrunner/config/mozconfigs/common.override"
diff --git a/application/xulrunner/configure.in b/application/xulrunner/configure.in
new file mode 100644
index 0000000000..825faaddd1
--- /dev/null
+++ b/application/xulrunner/configure.in
@@ -0,0 +1,11 @@
+dnl -*- Mode: Autoconf; tab-width: 2; indent-tabs-mode: nil; -*-
+dnl vi: set tabstop=2 shiftwidth=2 expandtab:
+dnl This Source Code Form is subject to the terms of the Mozilla Public
+dnl License, v. 2.0. If a copy of the MPL was not distributed with this
+dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+dnl Things we need to carry from confvars.sh
+AC_SUBST(MOZ_XULRUNNER)
+AC_DEFINE(MOZ_XULRUNNER)
+
+dnl Optional parts of the build.
diff --git a/application/xulrunner/confvars.sh b/application/xulrunner/confvars.sh
new file mode 100644
index 0000000000..a317df2a66
--- /dev/null
+++ b/application/xulrunner/confvars.sh
@@ -0,0 +1,28 @@
+#! /bin/sh
+# 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/.
+
+MOZ_XULRUNNER=1
+MC_OFFICIAL=1
+
+MOZ_APP_NAME=xulrunner
+MOZ_APP_DISPLAYNAME=XULRunner
+MOZ_APP_VERSION=$MOZILLA_VERSION
+MOZ_CHROME_FILE_FORMAT=omni
+
+MOZ_UPDATER=1
+
+if test "$OS_ARCH" = "WINNT"; then
+ MOZ_MAINTENANCE_SERVICE=
+fi
+
+MOZ_PLACES=1
+MOZ_WEBRTC=1
+MOZ_WEBGL_CONFORMANT=1
+
+MOZ_EXTENSIONS_DEFAULT=" gio"
+
+MOZ_SERVICES_COMMON=1
+MOZ_SERVICES_SYNC=1
+MOZ_SERVICES_HEALTHREPORT=
diff --git a/application/xulrunner/examples/moz.build b/application/xulrunner/examples/moz.build
new file mode 100644
index 0000000000..a1782b42fe
--- /dev/null
+++ b/application/xulrunner/examples/moz.build
@@ -0,0 +1,7 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DIRS += ['simple']
diff --git a/application/xulrunner/examples/simple/application.ini b/application/xulrunner/examples/simple/application.ini
new file mode 100644
index 0000000000..39c051422a
--- /dev/null
+++ b/application/xulrunner/examples/simple/application.ini
@@ -0,0 +1,43 @@
+#filter substitution
+[App]
+;
+; This field specifies your organization's name. This field is recommended,
+; but optional.
+Vendor=MozillaTest
+;
+; This field specifies your application's name. This field is required.
+Name=Simple
+;
+; This field specifies your application's version. This field is required.
+Version=0.1
+;
+; This field specifies your application's build ID (timestamp). This field is
+; required.
+BuildID=20070625
+;
+; This field specifies a compact copyright notice for your application. This
+; field is optional.
+Copyright=Copyright (c) 2004 Mozilla.org
+;
+; This ID is just an example. Every XUL app ought to have it's own unique ID.
+; You can use the microsoft "guidgen" or "uuidgen" tools, or go on
+; irc.mozilla.org and /msg botbot uuid. This field is optional.
+ID={3aea3f07-ffe3-4060-bb03-bff3a5365e90}
+
+[Gecko]
+;
+; This field is required. It specifies the minimum Gecko version that this
+; application requires.
+MinVersion=@MOZILLA_VERSION_U@
+;
+; This field is optional. It specifies the maximum Gecko version that this
+; application requires. It should be specified if your application uses
+; unfrozen interfaces.
+MaxVersion=@MOZILLA_VERSION_U@
+
+[Shell]
+;
+; This field specifies the location of your application's main icon with file
+; extension excluded. NOTE: Unix style file separators are required. This
+; field is optional.
+Icon=chrome/icons/default/simple
diff --git a/application/xulrunner/examples/simple/components/moz.build b/application/xulrunner/examples/simple/components/moz.build
new file mode 100644
index 0000000000..8ff4685344
--- /dev/null
+++ b/application/xulrunner/examples/simple/components/moz.build
@@ -0,0 +1,7 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DIRS += ['public', 'src']
diff --git a/application/xulrunner/examples/simple/components/public/moz.build b/application/xulrunner/examples/simple/components/public/moz.build
new file mode 100644
index 0000000000..3a611f85ac
--- /dev/null
+++ b/application/xulrunner/examples/simple/components/public/moz.build
@@ -0,0 +1,13 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+XPIDL_SOURCES += [
+ 'nsISimpleTest.idl',
+]
+
+XPIDL_MODULE = 'simple'
+
+XPI_NAME = 'simple'
diff --git a/application/xulrunner/examples/simple/components/public/nsISimpleTest.idl b/application/xulrunner/examples/simple/components/public/nsISimpleTest.idl
new file mode 100644
index 0000000000..99b9b86af2
--- /dev/null
+++ b/application/xulrunner/examples/simple/components/public/nsISimpleTest.idl
@@ -0,0 +1,15 @@
+/* vim:set ts=2 sw=2 sts=2 et cin: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+[scriptable, uuid(f2f71d91-0451-47ec-aaa0-166663a7711a)]
+interface nsISimpleTest : nsISupports
+{
+ /**
+ * This interface adds two numbers together and returns the result.
+ */
+ long add(in long a, in long b);
+};
diff --git a/application/xulrunner/examples/simple/components/src/SimpleTest.cpp b/application/xulrunner/examples/simple/components/src/SimpleTest.cpp
new file mode 100644
index 0000000000..06249abddb
--- /dev/null
+++ b/application/xulrunner/examples/simple/components/src/SimpleTest.cpp
@@ -0,0 +1,54 @@
+/* vim:set ts=2 sw=2 sts=2 et cin: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include <stdio.h>
+#include "nsISimpleTest.h"
+#include "mozilla/ModuleUtils.h"
+
+class SimpleTest : public nsISimpleTest
+{
+ ~SimpleTest() {}
+public:
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSISIMPLETEST
+};
+
+NS_IMPL_ISUPPORTS(SimpleTest, nsISimpleTest)
+
+NS_IMETHODIMP
+SimpleTest::Add(int32_t a, int32_t b, int32_t *r)
+{
+ printf("add(%d,%d) from C++\n", a, b);
+
+ *r = a + b;
+ return NS_OK;
+}
+
+NS_GENERIC_FACTORY_CONSTRUCTOR(SimpleTest)
+
+// 5e14b432-37b6-4377-923b-c987418d8429
+#define SIMPLETEST_CID \
+ { 0x5e14b432, 0x37b6, 0x4377, \
+ { 0x92, 0x3b, 0xc9, 0x87, 0x41, 0x8d, 0x84, 0x29 } }
+
+NS_DEFINE_NAMED_CID(SIMPLETEST_CID);
+
+static const mozilla::Module::CIDEntry kSimpleCIDs[] = {
+ { &kSIMPLETEST_CID, false, nullptr, SimpleTestConstructor },
+ { nullptr }
+};
+
+static const mozilla::Module::ContractIDEntry kSimpleContracts[] = {
+ { "@test.mozilla.org/simple-test;1?impl=c++", &kSIMPLETEST_CID },
+ { nullptr }
+};
+
+static const mozilla::Module kSimpleModule = {
+ mozilla::Module::kVersion,
+ kSimpleCIDs,
+ kSimpleContracts
+};
+
+NSMODULE_DEFN(SimpleTestModule) = &kSimpleModule;
diff --git a/application/xulrunner/examples/simple/components/src/SimpleTest.js b/application/xulrunner/examples/simple/components/src/SimpleTest.js
new file mode 100644
index 0000000000..e6cf90660c
--- /dev/null
+++ b/application/xulrunner/examples/simple/components/src/SimpleTest.js
@@ -0,0 +1,27 @@
+/* vim:set ts=2 sw=2 sts=2 et cin: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+
+function SimpleTest() {
+}
+
+SimpleTest.prototype = {
+ classID: Components.ID("{4177e257-a0dc-49b9-a774-522a000a49fa}"),
+
+ QueryInterface: function(iid) {
+ if (iid.equals(Components.interfaces.nsISimpleTest) ||
+ iid.equals(Components.interfaces.nsISupports))
+ return this;
+ throw Components.results.NS_ERROR_NO_INTERFACE;
+ },
+
+ add: function(a, b) {
+ dump("add(" + a + "," + b + ") from JS\n");
+ return a + b;
+ }
+};
+
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory([SimpleTest]);
diff --git a/application/xulrunner/examples/simple/components/src/SimpleTest.manifest b/application/xulrunner/examples/simple/components/src/SimpleTest.manifest
new file mode 100644
index 0000000000..c7388b9d72
--- /dev/null
+++ b/application/xulrunner/examples/simple/components/src/SimpleTest.manifest
@@ -0,0 +1,2 @@
+component {4177e257-a0dc-49b9-a774-522a000a49fa} SimpleTest.js
+contract @test.mozilla.org/simple-test;1?impl=js {4177e257-a0dc-49b9-a774-522a000a49fa}
diff --git a/application/xulrunner/examples/simple/components/src/moz.build b/application/xulrunner/examples/simple/components/src/moz.build
new file mode 100644
index 0000000000..153bfdd0cf
--- /dev/null
+++ b/application/xulrunner/examples/simple/components/src/moz.build
@@ -0,0 +1,21 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+SOURCES += [
+ 'SimpleTest.cpp',
+]
+
+XPCOMBinaryComponent('simpletest')
+
+EXTRA_COMPONENTS += [
+ 'SimpleTest.js',
+ 'SimpleTest.manifest',
+]
+
+XPI_NAME = 'simple'
+
+if CONFIG['GNU_CXX']:
+ CXXFLAGS += ['-Wshadow']
diff --git a/memory/jemalloc/src/config.stamp.in b/application/xulrunner/examples/simple/content/contents.rdf
index e69de29bb2..e69de29bb2 100644
--- a/memory/jemalloc/src/config.stamp.in
+++ b/application/xulrunner/examples/simple/content/contents.rdf
diff --git a/application/xulrunner/examples/simple/content/simple.js b/application/xulrunner/examples/simple/content/simple.js
new file mode 100644
index 0000000000..acf6f1029d
--- /dev/null
+++ b/application/xulrunner/examples/simple/content/simple.js
@@ -0,0 +1,17 @@
+/* vim:set ts=2 sw=2 sts=2 et cin: */
+/* 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/. */
+
+function onButtonClick() {
+ var textbox = document.getElementById("textbox");
+
+ var contractid = (textbox.value % 2 == 0) ?
+ "@test.mozilla.org/simple-test;1?impl=js" :
+ "@test.mozilla.org/simple-test;1?impl=c++";
+
+ var test = Components.classes[contractid].
+ createInstance(Components.interfaces.nsISimpleTest);
+
+ textbox.value = test.add(textbox.value, 1);
+}
diff --git a/application/xulrunner/examples/simple/content/simple.xul b/application/xulrunner/examples/simple/content/simple.xul
new file mode 100644
index 0000000000..6ff915d0ce
--- /dev/null
+++ b/application/xulrunner/examples/simple/content/simple.xul
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+# vim:set ts=8 sw=8 sts=8 noet:
+# 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/.
+
+<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+
+<!DOCTYPE window SYSTEM "chrome://simple/locale/simple.dtd">
+
+<window
+ id = "simple"
+ title = "&simple.title;"
+ xmlns = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script src="chrome://simple/content/simple.js"/>
+ <vbox>
+ <textbox id="textbox" value="&simple.textValue;" flex="1"/>
+ <button id="button" label="&simple.buttonLabel;" oncommand="onButtonClick();"/>
+ </vbox>
+</window>
diff --git a/application/xulrunner/examples/simple/icons/simple.ico b/application/xulrunner/examples/simple/icons/simple.ico
new file mode 100644
index 0000000000..16bd7e9d1c
--- /dev/null
+++ b/application/xulrunner/examples/simple/icons/simple.ico
Binary files differ
diff --git a/application/xulrunner/examples/simple/jar.mn b/application/xulrunner/examples/simple/jar.mn
new file mode 100644
index 0000000000..7d141ad1d6
--- /dev/null
+++ b/application/xulrunner/examples/simple/jar.mn
@@ -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/.
+
+simple.jar:
+% content simple %content/
+ content/simple.xul (content/simple.xul)
+ content/simple.js (content/simple.js)
+
+en-US.jar:
+% locale simple en-US %locale/en-US/
+ locale/en-US/simple.dtd (locale/simple.dtd)
diff --git a/application/xulrunner/examples/simple/locale/simple.dtd b/application/xulrunner/examples/simple/locale/simple.dtd
new file mode 100644
index 0000000000..2fd1c9285c
--- /dev/null
+++ b/application/xulrunner/examples/simple/locale/simple.dtd
@@ -0,0 +1,7 @@
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+<!ENTITY simple.title "Simple App">
+<!ENTITY simple.textValue "0">
+<!ENTITY simple.buttonLabel "Increment">
diff --git a/application/xulrunner/examples/simple/moz.build b/application/xulrunner/examples/simple/moz.build
new file mode 100644
index 0000000000..c88c57a4b8
--- /dev/null
+++ b/application/xulrunner/examples/simple/moz.build
@@ -0,0 +1,22 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DIRS += ['components']
+
+XPI_NAME = 'simple'
+
+JAR_MANIFESTS += ['jar.mn']
+
+JS_PREFERENCE_FILES += [
+ 'simple-prefs.js',
+]
+
+FINAL_TARGET_PP_FILES += [
+ 'application.ini',
+]
+
+if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
+ FINAL_TARGET_FILES.chrome.icons.default += ['icons/simple.ico']
diff --git a/application/xulrunner/examples/simple/simple-prefs.js b/application/xulrunner/examples/simple/simple-prefs.js
new file mode 100644
index 0000000000..fc92e0df5f
--- /dev/null
+++ b/application/xulrunner/examples/simple/simple-prefs.js
@@ -0,0 +1,6 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+pref("toolkit.defaultChromeURI", "chrome://simple/content/simple.xul");
+pref("general.useragent.extra.simple", "SimpleApp/0.1");
diff --git a/application/xulrunner/installer/Makefile.in b/application/xulrunner/installer/Makefile.in
new file mode 100644
index 0000000000..04803dddbe
--- /dev/null
+++ b/application/xulrunner/installer/Makefile.in
@@ -0,0 +1,148 @@
+# 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/.
+
+STANDALONE_MAKEFILE := 1
+
+NO_PKG_FILES = \
+ xulrunner-config \
+ regchrome* \
+ regxpcom* \
+ $(NULL)
+
+# We want xpcshell, run-mozilla and install_app.py in the SDK but not in the binary package.
+ifndef STAGE_SDK
+NO_PKG_FILES += \
+ xpcshell* \
+ run-mozilla* \
+ install_app.py \
+ $(NULL)
+endif
+
+# If we're on mac, we don't want an end-user-facing DMG, we want a .tar.bz2
+# which developers then use to package their application.
+
+ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
+MOZ_PKG_FORMAT = BZ2
+_APPNAME = XUL.framework
+_BINPATH = /$(_APPNAME)/Versions/Current
+_RESPATH := $(_BINPATH)
+endif
+
+include $(topsrcdir)/config/rules.mk
+
+INSTALL_SDK = 1
+
+include $(topsrcdir)/toolkit/mozapps/installer/signing.mk
+include $(topsrcdir)/toolkit/mozapps/installer/packager.mk
+
+# Add pkg-config files to the install:: target
+
+pkg_config_files = \
+ libxul.pc \
+ libxul-embedding.pc \
+ mozilla-js.pc \
+ mozilla-plugin.pc \
+ $(NULL)
+
+ifdef MOZ_NATIVE_NSPR
+NSPR_NAME=nspr
+NSPR_VERSION=$(shell $(NSPR_CONFIG) --version)
+else
+pkg_config_files += mozilla-nspr.pc
+NSPR_NAME=mozilla-nspr
+FULL_NSPR_CFLAGS=-I\$${includedir}
+FULL_NSPR_LIBS=$(subst $(prefix),\$${sdkdir},$(shell $(DEPTH)/nsprpub/config/nspr-config --libs))
+NSPR_VERSION=$(shell $(DEPTH)/nsprpub/config/nspr-config --version)
+endif
+
+MOZ_XUL_LINK = -lxpcomglue_s -lxul
+ifdef JS_SHARED_LIBRARY
+MOZ_JS_LINK = -lmozjs
+else
+MOZ_JS_LINK = $(MOZ_XUL_LINK)
+endif
+
+$(warning FULL_NSPR_CFLAGS=$(FULL_NSPR_CFLAGS))
+
+ifndef MOZ_NATIVE_NSS
+pkg_config_files += mozilla-nss.pc
+endif
+
+%.pc: $(srcdir)/%.pc.in $(GLOBAL_DEPS)
+ cat $< | sed \
+ -e "s|%prefix%|$(prefix)|" \
+ -e "s|%includedir%|$(includedir)|" \
+ -e "s|%idldir%|$(idldir)|" \
+ -e "s|%sdkdir%|$(sdkdir)|" \
+ -e "s|%MOZ_APP_NAME%|$(MOZ_APP_NAME)|" \
+ -e "s|%MOZILLA_VERSION%|$(MOZ_APP_VERSION)|" \
+ -e "s|%WCHAR_CFLAGS%|$(WCHAR_CFLAGS)|" \
+ -e "s|%FULL_NSPR_LIBS%|$(FULL_NSPR_LIBS)|" \
+ -e "s|%FULL_NSPR_CFLAGS%|$(FULL_NSPR_CFLAGS)|" \
+ -e "s|%NSPR_NAME%|$(NSPR_NAME)|" \
+ -e "s|%NSPR_VERSION%|$(NSPR_VERSION)|" \
+ -e "s|%MOZ_XUL_LINK%|$(MOZ_XUL_LINK)|" \
+ -e "s|%MOZ_JS_LINK%|$(MOZ_JS_LINK)|" > $@
+ chmod 644 $@
+
+install:: $(pkg_config_files)
+ @echo pkg_config_file: $(pkg_config_files)
+ $(SYSINSTALL) $(IFLAGS1) $^ $(DESTDIR)$(libdir)/pkgconfig
+
+GARBAGE += $(pkg_config_files)
+
+GARBAGE += debian/changelog
+
+DEBDESTDIR=debian/$(MOZ_BUILD_APP)
+
+GRE_BUILDID = $(shell $(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(DIST)/bin/platform.ini Build BuildID)
+MOZ_DEB_TIMESTAMP = "$(shell date +"%a, %d %b %Y %T %z" )"
+
+DEFINES += \
+ -DGRE_MILESTONE=$(GRE_MILESTONE) \
+ -DGRE_BUILDID=$(GRE_BUILDID) \
+ -DMOZ_DEB_TIMESTAMP=$(MOZ_DEB_TIMESTAMP) \
+ -DMOZ_APP_NAME=$(MOZ_APP_NAME) \
+ -Dinstalldir=$(installdir) \
+ $(NULL)
+
+ifeq ($(OS_TARGET),Linux)
+debian/changelog: $(srcdir)/debian/changelog.in $(DIST)/bin/platform.ini
+ $(call py_action,preprocessor, \
+ $(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $^ -o $@)
+
+debian/xulrunner.links: $(srcdir)/debian/xulrunner.links.in
+ $(call py_action,preprocessor, \
+ $(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $^ -o $@)
+
+debian/xulrunner.service: $(srcdir)/debian/xulrunner.service.in
+ $(call py_action,preprocessor, \
+ $(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $^ -o $@)
+
+debian/prerm: $(srcdir)/debian/prerm.in
+ $(call py_action,preprocessor, \
+ $(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $^ -o $@)
+
+debian/postinst: $(srcdir)/debian/postinst.in
+ $(call py_action,preprocessor, \
+ $(AUTOMATION_PPARGS) $(DEFINES) $(ACDEFINES) $^ -o $@)
+
+package:
+ $(MAKE) package -C $(DEPTH)
+
+deb: package debian/changelog debian/xulrunner.service debian/xulrunner.links
+ $(NSINSTALL) $(topsrcdir)/$(MOZ_BUILD_APP)/installer/debian .
+ rm -fr $(DEBDESTDIR)
+ $(NSINSTALL) -D $(DEBDESTDIR)/$(installdir)
+ cp -pRL $(DEPTH)/dist/$(MOZ_BUILD_APP)/* $(DEBDESTDIR)/$(installdir)
+ $(NSINSTALL) -D $(DEBDESTDIR)/usr/share/dbus-1/services/
+ cp debian/$(MOZ_BUILD_APP).service $(DEBDESTDIR)/usr/share/dbus-1/services/org.mozilla.$(MOZ_BUILD_APP).service
+ dh_link; fakeroot dh_fixperms; fakeroot dh_installdeb; fakeroot dh_shlibdeps; fakeroot dh_gencontrol; fakeroot dh_md5sums; fakeroot dh_builddeb;
+endif
+
+DEB_BUILD_ARCH = $(shell dpkg-architecture -qDEB_BUILD_ARCH)
+# package name comes from xulrunner/installer/debian/changelog.in
+DEB_PKG_NAME = $(MOZ_PKG_APPNAME)_$(GRE_MILESTONE)-$(GRE_BUILDID)_$(DEB_BUILD_ARCH).deb
+# relative to $(DIST)
+UPLOAD_EXTRA_FILES += ../xulrunner/$(DEB_PKG_NAME)
diff --git a/application/xulrunner/installer/debian/changelog.in b/application/xulrunner/installer/debian/changelog.in
new file mode 100644
index 0000000000..1efd55a1db
--- /dev/null
+++ b/application/xulrunner/installer/debian/changelog.in
@@ -0,0 +1,7 @@
+# if the naming changes please modify DEB_PKG_NAME in xulrunner/installer/Makefile.in as well
+#filter substitution
+xulrunner (@GRE_MILESTONE@-@GRE_BUILDID@) unstable; urgency=low
+
+ * Mozilla Nightly (Closes: #nnnn) <nnnn is the bug number of your ITP>
+
+ -- Mozilla Runtime <mobile-feedback@mozilla.com> @MOZ_DEB_TIMESTAMP@
diff --git a/application/xulrunner/installer/debian/compat b/application/xulrunner/installer/debian/compat
new file mode 100644
index 0000000000..b8626c4cff
--- /dev/null
+++ b/application/xulrunner/installer/debian/compat
@@ -0,0 +1 @@
+4
diff --git a/application/xulrunner/installer/debian/control b/application/xulrunner/installer/debian/control
new file mode 100644
index 0000000000..da99aa8d40
--- /dev/null
+++ b/application/xulrunner/installer/debian/control
@@ -0,0 +1,48 @@
+Source: xulrunner
+Section: user/network
+Priority: extra
+Maintainer: Mobile Feedback <mobile-feedback@mozilla.com>
+Build-Depends: debhelper (>= 5)
+Standards-Version: 3.7.2
+
+Package: xulrunner
+Architecture: any
+Depends: ${shlibs:Depends}
+Description: Web and JavaScript engine used by the Firefox Web browser
+ The Mozilla runtime is the modern browser engine, also known as "Gecko," that powers Firefox and can be embedded by other applications
+XB-Maemo-Display-Name: Mozilla Runtime
+XB-Maemo-Icon-26:
+ MB5!.1PT*&@H````-24A$4@```!H````:"`8```"I2DS.````"7!(67,```L3
+ M```+$P$`FIP8```%;$E$051(B:667XQ4U1W'/_>>>V?NG=F9V3^S_W%9<'#!
+ M/Q1;NQ:EQH@:T2"EH>&A34R;]$U?Q%9-VH:41BUJFV"-B<8'^Z!-VP=E?37&
+ M5=18L"SACVMVH<M.9W>8V9G9N7-G[O_3AP6$LD"$;W*3<T_R^W[.]Y=S3@Z<
+ ME90H_)\DE\Y=J]3SHW_\1)6O#FV2NVD'D*\,W<T;JWK.0W>3OA[012N68]LW
+ MD1W^!8?W_XGANQ^C5?V$(V/_8L.VGU.:.JG\\M@[UPK2SD/V#=U,K=QDW;TF
+ M#S_[&HZC4,^O9_T6'84VWO[PI]>32/MFV.URZ^;G273UT7^7`3&)#%*!TM"U
+ MS]ZHTC?\B/SUD7\J>\E?,TC^'4%LA4?DS\O^V]<H<L!I.6`:,5S[:#B^T)?1
+ M\MJZ>]YF8:GLB3@/WIQ!,U1F9AH<V]VX&DB1N]'HS6WFN]L>8>"V`6(=O;)S
+ M8]O<?"!E%/+ZFZ_R_'-[U;4CZTX6NA_8;VZX_X>IWO3W4\,]W;II4CE3MZJS
+ M9R9JIPICSOBQ,4Z_4+U<HH@H?H"W7CY`@,&NEUY1>M;?GFBC^=2NWR-434HU
+ M;OY@\]:'8OTW;3]N&@RM74ER1195Z!0S1E^QS5B3CZL[BHJ<L$_L^1T'?[O_
+ MDD07_LCQQW]$;M-3M&JEL8EJ[M$?/QN"2*OI[-"JW(AX[&<[J:174NK(D<T-
+ M(F*"N>EYBJ<7*)VI4%EHL'!ZWG7R\[_AT)Z7+O06YR%_&>PBU;V#RLE]%/]S
+ M5/A6YK7WIP+1WCLJA"Z:C44*E1H=]SZ*TMF-D=31@?J9&E:Q@EVW<2IUM$Q"
+ M\U8/W1>MW9)GXMW#Y_R_.;!6(^+SO[VH;/[K%XN'QJ>/C7VR+]CVAY1^XRVJ
+ M%A?(9`IO=`MS'8-XAH[M!5B-%JUZ`]_U20UT0;-%Z_@I8J&OJ<.]S['QF=RR
+ MK;M(]^S=R<8-[PA148S\89*WW$GVUN^1T049324I)-;D?VG,E:F7+%+?N9'%
+ M:I7J=!&W+TLSE<;Y^."?>>^))R].=+%4#+&3,%1"LX?6Z`[\U`W87\]0*Y2H
+ MN1YU)\0UX]A^2*0+HJ2!.;*2MM4K$%T91,M%B2>VPM;LN5VWC+9T0>P.K!;,
+ M%8AL"RN10$G$"7K:(1G#C1N8G2F2=XP02/!5B=-R\<(63!>1PH!(K"*W)L<4
+ MY>5!;4X/]<5V)AM0KX(J"!(F]722T/.(!KHQLYTT58FN0A!&1&Z(W_+P\B6\
+ M`U_BZW%D6U805FX`/E\>%/D&MB/(SX,:@6&"ZQ`T&MC51?SV#*X21Q,0DZ`&
+ M+J$?X9>K^">F""HE@DH-?!>D;5R^=:%E4;-<'#N!],#WH!D#31`,KB!038)\
+ M$5W5<%4)00"A@CST;[P3D_BVA73J$'J`6[\\R)THXVS,T[ZJ`]\#Q8;:/&@Z
+ M%(`C<;QL%X$O(!T#1<!"!8X>)5I<`,^&R`.$!<Q<83-0I5[X"*7S-M(IJ!6@
+ M50-A@&-#N0"#JXFZ^J&B@YF&\@($$AP+\``)A!,P>Q(NN!DN;9_2Q._8CB\,
+ M(@]:<Q#Y$#H0^-!8A,(T%&?`5T#)0*B"-7T6I$CP_PBS!ZX,HEP@3/3C)D:)
+ MXA"5(*Q!%"Y]01-D"%*'P`17!3L`KP'2!J(/8'8/>,VK@(A@]CBH:PGM'+)\
+ M=EH#G*55JQF(C8"O@]T`IP&1!()).+4+ZE^=,[L2"&`1YKZ$L!=J-X&B0AIH
+ M`C;(&O@.!&6(3H.<!N8_A9E?06W\*M[+:A!23T/J('2UH$TNG2!#0DI".H#,
+ M)&1>!-8M9_!MWFTQB*V&Q"AX(V`,@-3`*X*<`O\@^">6HEX?Z$*90/QLO<]2
+ :+Z,K%?P/&D=O=_6]@+\`````245.1*Y"8((`
+ `
diff --git a/application/xulrunner/installer/debian/icon_base64 b/application/xulrunner/installer/debian/icon_base64
new file mode 100644
index 0000000000..124fb4cccb
--- /dev/null
+++ b/application/xulrunner/installer/debian/icon_base64
@@ -0,0 +1,36 @@
+begin 644 -m
+MB5!.1PT*&@H````-24A$4@```!H````:"`8```"I2DS.````"7!(67,```L3
+M```+$P$`FIP8```%;$E$051(B:667XQ4U1W'/_>>>V?NG=F9V3^S_W%9<'#!
+M/Q1;NQ:EQH@:T2"EH>&A34R;]$U?Q%9-VH:41BUJFV"-B<8'^Z!-VP=E?37&
+M5=18L"SACVMVH<M.9W>8V9G9N7-G[O_3AP6$LD"$;W*3<T_R^W[.]Y=S3@Z<
+ME90H_)\DE\Y=J]3SHW_\1)6O#FV2NVD'D*\,W<T;JWK.0W>3OA[012N68]LW
+MD1W^!8?W_XGANQ^C5?V$(V/_8L.VGU.:.JG\\M@[UPK2SD/V#=U,K=QDW;TF
+M#S_[&HZC4,^O9_T6'84VWO[PI]>32/MFV.URZ^;G273UT7^7`3&)#%*!TM"U
+MS]ZHTC?\B/SUD7\J>\E?,TC^'4%LA4?DS\O^V]<H<L!I.6`:,5S[:#B^T)?1
+M\MJZ>]YF8:GLB3@/WIQ!,U1F9AH<V]VX&DB1N]'HS6WFN]L>8>"V`6(=O;)S
+M8]O<?"!E%/+ZFZ_R_'-[U;4CZTX6NA_8;VZX_X>IWO3W4\,]W;II4CE3MZJS
+M9R9JIPICSOBQ,4Z_4+U<HH@H?H"W7CY`@,&NEUY1>M;?GFBC^=2NWR-434HU
+M;OY@\]:'8OTW;3]N&@RM74ER1195Z!0S1E^QS5B3CZL[BHJ<L$_L^1T'?[O_
+MDD07_LCQQW]$;M-3M&JEL8EJ[M$?/QN"2*OI[-"JW(AX[&<[J:174NK(D<T-
+M(F*"N>EYBJ<7*)VI4%EHL'!ZWG7R\[_AT)Z7+O06YR%_&>PBU;V#RLE]%/]S
+M5/A6YK7WIP+1WCLJA"Z:C44*E1H=]SZ*TMF-D=31@?J9&E:Q@EVW<2IUM$Q"
+M\U8/W1>MW9)GXMW#Y_R_.;!6(^+SO[VH;/[K%XN'QJ>/C7VR+]CVAY1^XRVJ
+M%A?(9`IO=`MS'8-XAH[M!5B-%JUZ`]_U20UT0;-%Z_@I8J&OJ<.]S['QF=RR
+MK;M(]^S=R<8-[PA148S\89*WW$GVUN^1T049324I)-;D?VG,E:F7+%+?N9'%
+M:I7J=!&W+TLSE<;Y^."?>>^))R].=+%4#+&3,%1"LX?6Z`[\U`W87\]0*Y2H
+MN1YU)\0UX]A^2*0+HJ2!.;*2MM4K$%T91,M%B2>VPM;LN5VWC+9T0>P.K!;,
+M%8AL"RN10$G$"7K:(1G#C1N8G2F2=XP02/!5B=-R\<(63!>1PH!(K"*W)L<4
+MY>5!;4X/]<5V)AM0KX(J"!(F]722T/.(!KHQLYTT58FN0A!&1&Z(W_+P\B6\
+M`U_BZW%D6U805FX`/E\>%/D&MB/(SX,:@6&"ZQ`T&MC51?SV#*X21Q,0DZ`&
+M+J$?X9>K^">F""HE@DH-?!>D;5R^=:%E4;-<'#N!],#WH!D#31`,KB!038)\
+M$5W5<%4)00"A@CST;[P3D_BVA73J$'J`6[\\R)THXVS,T[ZJ`]\#Q8;:/&@Z
+M%(`C<;QL%X$O(!T#1<!"!8X>)5I<`,^&R`.$!<Q<83-0I5[X"*7S-M(IJ!6@
+M50-A@&-#N0"#JXFZ^J&B@YF&\@($$AP+\``)A!,P>Q(NN!DN;9_2Q._8CB\,
+M(@]:<Q#Y$#H0^-!8A,(T%&?`5T#)0*B"-7T6I$CP_PBS!ZX,HEP@3/3C)D:)
+MXA"5(*Q!%"Y]01-D"%*'P`17!3L`KP'2!J(/8'8/>,VK@(A@]CBH:PGM'+)\
+M=EH#G*55JQF(C8"O@]T`IP&1!()).+4+ZE^=,[L2"&`1YKZ$L!=J-X&B0AIH
+M`C;(&O@.!&6(3H.<!N8_A9E?06W\*M[+:A!23T/J('2UH$TNG2!#0DI".H#,
+M)&1>!-8M9_!MWFTQB*V&Q"AX(V`,@-3`*X*<`O\@^">6HEX?Z$*90/QLO<]2
+:+Z,K%?P/&D=O=_6]@+\`````245.1*Y"8((`
+`
+end
diff --git a/application/xulrunner/installer/debian/menu b/application/xulrunner/installer/debian/menu
new file mode 100644
index 0000000000..e1ce52201c
--- /dev/null
+++ b/application/xulrunner/installer/debian/menu
@@ -0,0 +1,2 @@
+?package(xulrunner):needs="X11|text|vc|wm" section="Apps/Internet"\
+ title="xulrunner" command="/usr/bin/xulrunner"
diff --git a/application/xulrunner/installer/debian/postinst.in b/application/xulrunner/installer/debian/postinst.in
new file mode 100644
index 0000000000..0f06640e29
--- /dev/null
+++ b/application/xulrunner/installer/debian/postinst.in
@@ -0,0 +1,42 @@
+#literal #! /bin/sh
+#filter substitution
+# postinst script for moz
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+# * <postinst> `configure' <most-recently-configured-version>
+# * <old-postinst> `abort-upgrade' <new version>
+# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+# <new-version>
+# * <postinst> `abort-remove'
+# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+# <failed-install-package> <version> `removing'
+# <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+ configure)
+ ;;
+
+ abort-upgrade|abort-remove|abort-deconfigure)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+#ifdef MOZ_WIDGET_GTK
+gtk-update-icon-cache /usr/share/icons/hicolor
+#endif
+
+
+exit 0
+
+
diff --git a/application/xulrunner/installer/debian/prerm.in b/application/xulrunner/installer/debian/prerm.in
new file mode 100644
index 0000000000..1d46d382c3
--- /dev/null
+++ b/application/xulrunner/installer/debian/prerm.in
@@ -0,0 +1,29 @@
+#literal #! /bin/sh
+#filter substitution
+# prerm script for moz
+#
+# see: dh_installdeb(1)
+
+set -e
+
+case "$1" in
+ remove|upgrade|deconfigure)
+ ;;
+
+ failed-upgrade)
+ ;;
+
+ *)
+ echo "postinst called with unknown argument \`$1'" >&2
+ exit 1
+ ;;
+esac
+
+#ifdef MOZ_WIDGET_GTK
+gtk-update-icon-cache /usr/share/icons/hicolor
+#endif
+
+
+exit 0
+
+
diff --git a/application/xulrunner/installer/debian/xulrunner.links.in b/application/xulrunner/installer/debian/xulrunner.links.in
new file mode 100644
index 0000000000..eabac6f51d
--- /dev/null
+++ b/application/xulrunner/installer/debian/xulrunner.links.in
@@ -0,0 +1,2 @@
+#filter substitution
+@installdir@/xulrunner /usr/bin/xulrunner
diff --git a/application/xulrunner/installer/debian/xulrunner.service.in b/application/xulrunner/installer/debian/xulrunner.service.in
new file mode 100644
index 0000000000..48d87a1b92
--- /dev/null
+++ b/application/xulrunner/installer/debian/xulrunner.service.in
@@ -0,0 +1,4 @@
+#filter substitution
+[D-BUS Service]
+Name=org.mozilla.@MOZ_APP_NAME@
+Exec=@installdir@/xulrunner
diff --git a/application/xulrunner/installer/libxul-embedding.pc.in b/application/xulrunner/installer/libxul-embedding.pc.in
new file mode 100644
index 0000000000..100e0a763d
--- /dev/null
+++ b/application/xulrunner/installer/libxul-embedding.pc.in
@@ -0,0 +1,10 @@
+prefix=%prefix%
+sdkdir=%sdkdir%
+includedir=%includedir%
+idldir=%idldir%
+
+Name: libxul-embedding
+Description: Static library for version-independent embedding of the Mozilla runtime
+Version: %MOZILLA_VERSION%
+Libs: -L${sdkdir}/lib -lxpcomglue -ldl
+Cflags: -DXPCOM_GLUE -I${includedir} %WCHAR_CFLAGS%
diff --git a/application/xulrunner/installer/libxul.pc.in b/application/xulrunner/installer/libxul.pc.in
new file mode 100644
index 0000000000..ccce9aa592
--- /dev/null
+++ b/application/xulrunner/installer/libxul.pc.in
@@ -0,0 +1,11 @@
+prefix=%prefix%
+sdkdir=%sdkdir%
+includedir=%includedir%
+idldir=%idldir%
+
+Name: libxul
+Description: The Mozilla Runtime and Embedding Engine
+Version: %MOZILLA_VERSION%
+Requires: %NSPR_NAME% >= %NSPR_VERSION%
+Libs: -L${sdkdir}/lib %MOZ_XUL_LINK%
+Cflags: -I${includedir} %WCHAR_CFLAGS%
diff --git a/application/xulrunner/installer/moz.build b/application/xulrunner/installer/moz.build
new file mode 100644
index 0000000000..895d11993c
--- /dev/null
+++ b/application/xulrunner/installer/moz.build
@@ -0,0 +1,6 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
diff --git a/application/xulrunner/installer/mozilla-js.pc.in b/application/xulrunner/installer/mozilla-js.pc.in
new file mode 100644
index 0000000000..55e84ca003
--- /dev/null
+++ b/application/xulrunner/installer/mozilla-js.pc.in
@@ -0,0 +1,10 @@
+prefix=%prefix%
+sdkdir=%sdkdir%
+includedir=%includedir%
+
+Name: JavaScript
+Description: The Mozilla JavaScript Library
+Version: %MOZILLA_VERSION%
+Requires: %NSPR_NAME% >= %NSPR_VERSION%
+Libs: -L${sdkdir}/lib %MOZ_JS_LINK%
+Cflags: -I${includedir} -DXP_UNIX
diff --git a/application/xulrunner/installer/mozilla-nspr.pc.in b/application/xulrunner/installer/mozilla-nspr.pc.in
new file mode 100644
index 0000000000..7ebd3421c9
--- /dev/null
+++ b/application/xulrunner/installer/mozilla-nspr.pc.in
@@ -0,0 +1,11 @@
+prefix=%prefix%
+sdkdir=%sdkdir%
+includedir=%includedir%/nspr
+
+Name: NSPR
+Description: The Netscape Portable Runtime
+Version: %NSPR_VERSION%
+Libs: %FULL_NSPR_LIBS%
+Cflags: %FULL_NSPR_CFLAGS%
+
+
diff --git a/application/xulrunner/installer/mozilla-nss.pc.in b/application/xulrunner/installer/mozilla-nss.pc.in
new file mode 100644
index 0000000000..90f14c3ae5
--- /dev/null
+++ b/application/xulrunner/installer/mozilla-nss.pc.in
@@ -0,0 +1,10 @@
+prefix=%prefix%
+sdkdir=%sdkdir%
+includedir=%includedir%/nss
+
+Name: NSS
+Description: Mozilla Network Security Services
+Version: %MOZILLA_VERSION%
+Requires: %NSPR_NAME% >= %NSPR_VERSION%
+Libs: -L${sdkdir}/lib -lsmime3 -lssl3 -lnss3 -lnssutil3
+Cflags: -I${includedir}
diff --git a/application/xulrunner/installer/mozilla-plugin.pc.in b/application/xulrunner/installer/mozilla-plugin.pc.in
new file mode 100644
index 0000000000..7080161b3f
--- /dev/null
+++ b/application/xulrunner/installer/mozilla-plugin.pc.in
@@ -0,0 +1,8 @@
+prefix=%prefix%
+sdkdir=%sdkdir%
+includedir=%includedir%
+
+Name: Mozilla Plug-In API
+Description: Mozilla Plug-In API
+Version: %MOZILLA_VERSION%
+Cflags: -I${includedir} -DXP_UNIX
diff --git a/application/xulrunner/locales/all-locales b/application/xulrunner/locales/all-locales
new file mode 100644
index 0000000000..85ef789a67
--- /dev/null
+++ b/application/xulrunner/locales/all-locales
@@ -0,0 +1,39 @@
+ar
+bg
+ca
+cs
+da
+de
+el
+en-GB
+es-AR
+es-ES
+eu
+fi
+fr
+ga-IE
+gu-IN
+he
+hu
+hy-AM
+it
+ja
+ja-JP-mac
+ko
+nb-NO
+nl
+nn-NO
+mk
+mn
+pa-IN
+pl
+pt-BR
+ro
+ru
+sk
+sl
+sq
+sv-SE
+tr
+zh-CN
+zh-TW
diff --git a/application/xulrunner/moz.build b/application/xulrunner/moz.build
new file mode 100644
index 0000000000..371f69f5e1
--- /dev/null
+++ b/application/xulrunner/moz.build
@@ -0,0 +1,11 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+CONFIGURE_SUBST_FILES += ['installer/Makefile']
+
+DIRS += [
+ 'app',
+]
diff --git a/application/xulrunner/moz.configure b/application/xulrunner/moz.configure
new file mode 100644
index 0000000000..72236254f1
--- /dev/null
+++ b/application/xulrunner/moz.configure
@@ -0,0 +1,7 @@
+# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+include('../../toolkit/moz.configure')
diff --git a/application/xulrunner/stub/Makefile.in b/application/xulrunner/stub/Makefile.in
new file mode 100644
index 0000000000..0fa0cccf61
--- /dev/null
+++ b/application/xulrunner/stub/Makefile.in
@@ -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/.
+
+ifndef MOZ_WINCONSOLE
+ifdef MOZ_DEBUG
+MOZ_WINCONSOLE = 1
+else
+MOZ_WINCONSOLE = 0
+endif
+endif
diff --git a/application/xulrunner/stub/moz.build b/application/xulrunner/stub/moz.build
new file mode 100644
index 0000000000..4fd172f72f
--- /dev/null
+++ b/application/xulrunner/stub/moz.build
@@ -0,0 +1,51 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# The value of XULRUNNER_STUB_NAME is generated by configure to allow XULRunner
+# apps to override it using the --with-xulrunner-stub-name=<appname> argument.
+# If this configure argument is not present then the default name is
+# 'xulrunner-stub'.
+
+# We don't want to create a dependency on mozglue.
+# Statically link against the RTL on windows
+GeckoProgram(CONFIG['XULRUNNER_STUB_NAME'], mozglue=None, msvcrt='static')
+
+SOURCES += [
+ 'nsXULStub.cpp',
+]
+
+if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
+ FINAL_TARGET = 'dist/XUL.framework/Versions/%(MOZILLA_VERSION)s' % CONFIG
+
+DEFINES['XPCOM_GLUE'] = True
+
+LOCAL_INCLUDES += [
+ '/xpcom/base',
+ '/xpcom/build',
+]
+
+if CONFIG['OS_ARCH'] == 'WINNT':
+ LOCAL_INCLUDES += ['/toolkit/xre']
+ # this is an awful workaround - glandium
+ USE_LIBS += ['mfbt_staticruntime']
+
+if CONFIG['_MSC_VER']:
+ WIN32_EXE_LDFLAGS += ['-ENTRY:wmainCRTStartup']
+
+if CONFIG['OS_ARCH'] == 'WINNT':
+ DEFINES['MOZ_XULRUNNER'] = True
+ RCINCLUDE = 'xulrunner-stub.rc'
+
+if CONFIG['OS_ARCH'] == 'WINNT':
+ OS_LIBS += [
+ 'shell32',
+ ]
+
+DISABLE_STL_WRAPPING = True
+
+# Need to link with CoreFoundation on Mac
+if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa':
+ OS_LIBS += CONFIG['TK_LIBS']
diff --git a/application/xulrunner/stub/nsXULStub.cpp b/application/xulrunner/stub/nsXULStub.cpp
new file mode 100644
index 0000000000..8638ae43e1
--- /dev/null
+++ b/application/xulrunner/stub/nsXULStub.cpp
@@ -0,0 +1,445 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsXPCOMGlue.h"
+#include "nsINIParser.h"
+#include "nsXPCOMPrivate.h" // for XP MAXPATHLEN
+#include "nsXULAppAPI.h"
+#include "nsIFile.h"
+
+#include <stdarg.h>
+
+#ifdef XP_WIN
+#include <windows.h>
+#include <io.h>
+#if defined(_MSC_VER) && _MSC_VER < 1900
+#define snprintf _snprintf
+#define vsnprintf _vsnprintf
+#endif
+#define strcasecmp _stricmp
+#define PATH_SEPARATOR_CHAR '\\'
+#define R_OK 04
+#elif defined(XP_MACOSX)
+#include <unistd.h>
+#include <sys/stat.h>
+#include <CoreFoundation/CoreFoundation.h>
+#define PATH_SEPARATOR_CHAR '/'
+#else
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#define PATH_SEPARATOR_CHAR '/'
+#endif
+
+#ifdef XP_WIN
+#define XRE_DONT_PROTECT_DLL_LOAD
+#include "nsWindowsWMain.cpp"
+#endif
+
+#define VERSION_MAXLEN 128
+
+static void Output(bool isError, const char *fmt, ... )
+{
+ va_list ap;
+ va_start(ap, fmt);
+
+#if (defined(XP_WIN) && !MOZ_WINCONSOLE)
+ char msg[2048];
+
+ vsnprintf(msg, sizeof(msg), fmt, ap);
+
+ UINT flags = MB_OK;
+ if (isError)
+ flags |= MB_ICONERROR;
+ else
+ flags |= MB_ICONINFORMATION;
+
+ wchar_t wide_msg[1024];
+ MultiByteToWideChar(CP_ACP,
+ 0,
+ msg,
+ -1,
+ wide_msg,
+ sizeof(wide_msg) / sizeof(wchar_t));
+
+ MessageBoxW(nullptr, wide_msg, L"XULRunner", flags);
+#else
+ vfprintf(stderr, fmt, ap);
+#endif
+
+ va_end(ap);
+}
+
+/**
+ * Return true if |arg| matches the given argument name.
+ */
+static bool IsArg(const char* arg, const char* s)
+{
+ if (*arg == '-')
+ {
+ if (*++arg == '-')
+ ++arg;
+ return !strcasecmp(arg, s);
+ }
+
+#if defined(XP_WIN)
+ if (*arg == '/')
+ return !strcasecmp(++arg, s);
+#endif
+
+ return false;
+}
+
+/**
+ * Return true if |aDir| is a valid file/directory.
+ */
+static bool FolderExists(const char* aDir)
+{
+#ifdef XP_WIN
+ wchar_t wideDir[MAX_PATH];
+ MultiByteToWideChar(CP_UTF8, 0, aDir, -1, wideDir, MAX_PATH);
+ DWORD fileAttrs = GetFileAttributesW(wideDir);
+ return fileAttrs != INVALID_FILE_ATTRIBUTES;
+#else
+ return access(aDir, R_OK) == 0;
+#endif
+}
+
+static nsresult GetRealPath(const char* appDataFile, char* *aResult)
+{
+#ifdef XP_WIN
+ wchar_t wAppDataFile[MAX_PATH];
+ wchar_t wIniPath[MAX_PATH];
+ MultiByteToWideChar(CP_UTF8, 0, appDataFile, -1, wAppDataFile, MAX_PATH);
+ _wfullpath(wIniPath, wAppDataFile, MAX_PATH);
+ WideCharToMultiByte(CP_UTF8, 0, wIniPath, -1, *aResult, MAX_PATH, 0, 0);
+#else
+ struct stat fileStat;
+ if (!realpath(appDataFile, *aResult) || stat(*aResult, &fileStat))
+ return NS_ERROR_FAILURE;
+#endif
+ if (!*aResult || !**aResult)
+ return NS_ERROR_FAILURE;
+
+ return NS_OK;
+}
+
+class AutoAppData
+{
+public:
+ AutoAppData(nsIFile* aINIFile) : mAppData(nullptr) {
+ nsresult rv = XRE_CreateAppData(aINIFile, &mAppData);
+ if (NS_FAILED(rv))
+ mAppData = nullptr;
+ }
+ ~AutoAppData() {
+ if (mAppData)
+ XRE_FreeAppData(mAppData);
+ }
+
+ operator nsXREAppData*() const { return mAppData; }
+ nsXREAppData* operator -> () const { return mAppData; }
+
+private:
+ nsXREAppData* mAppData;
+};
+
+XRE_CreateAppDataType XRE_CreateAppData;
+XRE_FreeAppDataType XRE_FreeAppData;
+XRE_mainType XRE_main;
+
+int
+main(int argc, char **argv)
+{
+ nsresult rv;
+ char *lastSlash;
+
+ char iniPath[MAXPATHLEN];
+ char tmpPath[MAXPATHLEN];
+ char greDir[MAXPATHLEN];
+ bool greFound = false;
+
+#if defined(XP_MACOSX)
+ CFBundleRef appBundle = CFBundleGetMainBundle();
+ if (!appBundle)
+ return 1;
+
+ CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(appBundle);
+ if (!resourcesURL)
+ return 1;
+
+ CFURLRef absResourcesURL = CFURLCopyAbsoluteURL(resourcesURL);
+ CFRelease(resourcesURL);
+ if (!absResourcesURL)
+ return 1;
+
+ CFURLRef iniFileURL =
+ CFURLCreateCopyAppendingPathComponent(kCFAllocatorDefault,
+ absResourcesURL,
+ CFSTR("application.ini"),
+ false);
+ CFRelease(absResourcesURL);
+ if (!iniFileURL)
+ return 1;
+
+ CFStringRef iniPathStr =
+ CFURLCopyFileSystemPath(iniFileURL, kCFURLPOSIXPathStyle);
+ CFRelease(iniFileURL);
+ if (!iniPathStr)
+ return 1;
+
+ CFStringGetCString(iniPathStr, iniPath, sizeof(iniPath),
+ kCFStringEncodingUTF8);
+ CFRelease(iniPathStr);
+
+#else
+
+#ifdef XP_WIN
+ wchar_t wide_path[MAX_PATH];
+ if (!::GetModuleFileNameW(nullptr, wide_path, MAX_PATH))
+ return 1;
+
+ WideCharToMultiByte(CP_UTF8, 0, wide_path,-1,
+ iniPath, MAX_PATH, nullptr, nullptr);
+
+#else
+ // on unix, there is no official way to get the path of the current binary.
+ // instead of using the MOZILLA_FIVE_HOME hack, which doesn't scale to
+ // multiple applications, we will try a series of techniques:
+ //
+ // 1) use realpath() on argv[0], which works unless we're loaded from the
+ // PATH
+ // 2) manually walk through the PATH and look for ourself
+ // 3) give up
+
+ struct stat fileStat;
+ strncpy(tmpPath, argv[0], sizeof(tmpPath));
+ lastSlash = strrchr(tmpPath, '/');
+ if (lastSlash) {
+ *lastSlash = 0;
+ realpath(tmpPath, iniPath);
+ } else {
+ const char *path = getenv("PATH");
+ if (!path)
+ return 1;
+
+ char *pathdup = strdup(path);
+ if (!pathdup)
+ return 1;
+
+ bool found = false;
+ char *token = strtok(pathdup, ":");
+ while (token) {
+ sprintf(tmpPath, "%s/%s", token, argv[0]);
+ if (stat(tmpPath, &fileStat) == 0) {
+ found = true;
+ lastSlash = strrchr(tmpPath, '/');
+ *lastSlash = 0;
+ realpath(tmpPath, iniPath);
+ break;
+ }
+ token = strtok(nullptr, ":");
+ }
+ free (pathdup);
+ if (!found)
+ return 1;
+ }
+ lastSlash = iniPath + strlen(iniPath);
+ *lastSlash = '/';
+#endif
+
+#ifndef XP_UNIX
+ lastSlash = strrchr(iniPath, PATH_SEPARATOR_CHAR);
+ if (!lastSlash)
+ return 1;
+#endif
+
+ *(++lastSlash) = '\0';
+
+ // On Linux/Win, look for XULRunner in appdir/xulrunner
+
+ snprintf(greDir, sizeof(greDir),
+ "%sxulrunner" XPCOM_FILE_PATH_SEPARATOR XPCOM_DLL,
+ iniPath);
+
+ greFound = FolderExists(greDir);
+
+#ifdef XP_UNIX
+ if (greFound) {
+ char resolved_greDir[MAXPATHLEN] = "";
+ if (realpath(greDir, resolved_greDir) && *resolved_greDir) {
+ strncpy(greDir, resolved_greDir, MAXPATHLEN);
+ }
+ }
+#endif
+
+ strncpy(lastSlash, "application.ini", sizeof(iniPath) - (lastSlash - iniPath));
+
+#endif
+
+ // If -app parameter was passed in, it is now time to take it under
+ // consideration.
+ const char *appDataFile;
+ appDataFile = getenv("XUL_APP_FILE");
+ if (!appDataFile || !*appDataFile)
+ if (argc > 1 && IsArg(argv[1], "app")) {
+ if (argc == 2) {
+ Output(false, "specify APP-FILE (optional)\n");
+ return 1;
+ }
+ argv[1] = argv[0];
+ ++argv;
+ --argc;
+
+ appDataFile = argv[1];
+ argv[1] = argv[0];
+ ++argv;
+ --argc;
+
+ char kAppEnv[MAXPATHLEN];
+ snprintf(kAppEnv, MAXPATHLEN, "XUL_APP_FILE=%s", appDataFile);
+ if (putenv(kAppEnv))
+ Output(false, "Couldn't set %s.\n", kAppEnv);
+
+ char *result = (char*) calloc(sizeof(char), MAXPATHLEN);
+ if (NS_FAILED(GetRealPath(appDataFile, &result))) {
+ Output(true, "Invalid application.ini path.\n");
+ return 1;
+ }
+
+ // We have a valid application.ini path passed in to the -app parameter
+ // but not yet a valid greDir, so lets look for it also on the same folder
+ // as the stub.
+ if (!greFound) {
+ lastSlash = strrchr(iniPath, PATH_SEPARATOR_CHAR);
+ if (!lastSlash)
+ return 1;
+
+ *(++lastSlash) = '\0';
+
+ snprintf(greDir, sizeof(greDir), "%s" XPCOM_DLL, iniPath);
+ greFound = FolderExists(greDir);
+ }
+
+ // copy it back.
+ strcpy(iniPath, result);
+ }
+
+ nsINIParser parser;
+ rv = parser.Init(iniPath);
+ if (NS_FAILED(rv)) {
+ fprintf(stderr, "Could not read application.ini\n");
+ return 1;
+ }
+
+ if (!greFound) {
+#ifdef XP_MACOSX
+ // The bundle can be found next to the executable, in the MacOS dir.
+ CFURLRef exurl = CFBundleCopyExecutableURL(appBundle);
+ CFURLRef absexurl = nullptr;
+ if (exurl) {
+ absexurl = CFURLCopyAbsoluteURL(exurl);
+ CFRelease(exurl);
+ }
+
+ if (absexurl) {
+ char tbuffer[MAXPATHLEN];
+
+ if (CFURLGetFileSystemRepresentation(absexurl, true,
+ (UInt8*) tbuffer,
+ sizeof(tbuffer)) &&
+ access(tbuffer, R_OK | X_OK) == 0) {
+ if (realpath(tbuffer, greDir)) {
+ greFound = true;
+ }
+ else {
+ greDir[0] = '\0';
+ }
+ }
+
+ CFRelease(absexurl);
+ }
+#endif
+ if (!greFound) {
+ Output(false, "Could not find the Mozilla runtime.\n");
+ return 1;
+ }
+ }
+
+ rv = XPCOMGlueStartup(greDir);
+ if (NS_FAILED(rv)) {
+ if (rv == NS_ERROR_OUT_OF_MEMORY) {
+ char applicationName[2000] = "this application";
+ parser.GetString("App", "Name", applicationName, sizeof(applicationName));
+ Output(true, "Not enough memory available to start %s.\n",
+ applicationName);
+ } else {
+ Output(true, "Couldn't load XPCOM.\n");
+ }
+ return 1;
+ }
+
+ static const nsDynamicFunctionLoad kXULFuncs[] = {
+ { "XRE_CreateAppData", (NSFuncPtr*) &XRE_CreateAppData },
+ { "XRE_FreeAppData", (NSFuncPtr*) &XRE_FreeAppData },
+ { "XRE_main", (NSFuncPtr*) &XRE_main },
+ { nullptr, nullptr }
+ };
+
+ rv = XPCOMGlueLoadXULFunctions(kXULFuncs);
+ if (NS_FAILED(rv)) {
+ Output(true, "Couldn't load XRE functions.\n");
+ return 1;
+ }
+
+ NS_LogInit();
+
+ int retval;
+
+ { // Scope COMPtr and AutoAppData
+ nsCOMPtr<nsIFile> iniFile;
+#ifdef XP_WIN
+ // On Windows iniPath is UTF-8 encoded so we need to convert it.
+ rv = NS_NewLocalFile(NS_ConvertUTF8toUTF16(iniPath), false,
+ getter_AddRefs(iniFile));
+#else
+ rv = NS_NewNativeLocalFile(nsDependentCString(iniPath), false,
+ getter_AddRefs(iniFile));
+#endif
+ if (NS_FAILED(rv)) {
+ Output(true, "Couldn't find application.ini file.\n");
+ return 1;
+ }
+
+ AutoAppData appData(iniFile);
+ if (!appData) {
+ Output(true, "Error: couldn't parse application.ini.\n");
+ return 1;
+ }
+
+ NS_ASSERTION(appData->directory, "Failed to get app directory.");
+
+ if (!appData->xreDirectory) {
+ // chop "libxul.so" off the GRE path
+ lastSlash = strrchr(greDir, PATH_SEPARATOR_CHAR);
+ if (lastSlash) {
+ *lastSlash = '\0';
+ }
+#ifdef XP_WIN
+ // same as iniPath.
+ NS_NewLocalFile(NS_ConvertUTF8toUTF16(greDir), false,
+ &appData->xreDirectory);
+#else
+ NS_NewNativeLocalFile(nsDependentCString(greDir), false,
+ &appData->xreDirectory);
+#endif
+ }
+
+ retval = XRE_main(argc, argv, appData, 0);
+ }
+
+ NS_LogTerm();
+
+ return retval;
+}
diff --git a/application/xulrunner/stub/xulrunner-stub.exe.manifest b/application/xulrunner/stub/xulrunner-stub.exe.manifest
new file mode 100644
index 0000000000..57c2a70708
--- /dev/null
+++ b/application/xulrunner/stub/xulrunner-stub.exe.manifest
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+<assemblyIdentity
+ version="1.0.0.0"
+ processorArchitecture="*"
+ name="Mozilla.XULRunner.Stub"
+ type="win32"
+/>
+<description>Mozilla XULRunner Stub</description>
+<dependency>
+ <dependentAssembly>
+ <assemblyIdentity
+ type="win32"
+ name="Microsoft.Windows.Common-Controls"
+ version="6.0.0.0"
+ processorArchitecture="*"
+ publicKeyToken="6595b64144ccf1df"
+ language="*"
+ />
+ </dependentAssembly>
+</dependency>
+<ms_asmv3:trustInfo xmlns:ms_asmv3="urn:schemas-microsoft-com:asm.v3">
+ <ms_asmv3:security>
+ <ms_asmv3:requestedPrivileges>
+ <ms_asmv3:requestedExecutionLevel level="asInvoker" uiAccess="false" />
+ </ms_asmv3:requestedPrivileges>
+ </ms_asmv3:security>
+</ms_asmv3:trustInfo>
+ <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
+ <application>
+ <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
+ <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
+ <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
+ <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
+ <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
+ </application>
+ </compatibility>
+</assembly>
diff --git a/application/xulrunner/stub/xulrunner-stub.rc b/application/xulrunner/stub/xulrunner-stub.rc
new file mode 100644
index 0000000000..84c3e47ed0
--- /dev/null
+++ b/application/xulrunner/stub/xulrunner-stub.rc
@@ -0,0 +1,6 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+1 24 "xulrunner-stub.exe.manifest"
diff --git a/application/xulrunner/tools/redit/Makefile.in b/application/xulrunner/tools/redit/Makefile.in
new file mode 100644
index 0000000000..31c253be80
--- /dev/null
+++ b/application/xulrunner/tools/redit/Makefile.in
@@ -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/. */
+
+ifeq ($(OS_ARCH),WINNT)
+
+SDK_BINARY = \
+ $(PROGRAM) \
+ $(NULL)
+
+endif
diff --git a/application/xulrunner/tools/redit/moz.build b/application/xulrunner/tools/redit/moz.build
new file mode 100644
index 0000000000..812a56578e
--- /dev/null
+++ b/application/xulrunner/tools/redit/moz.build
@@ -0,0 +1,15 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+if CONFIG['OS_ARCH'] == 'WINNT':
+ GeckoProgram('redit')
+ SOURCES += [
+ 'redit.cpp',
+ ]
+ for var in ('WIN32_LEAN_AND_MEAN', 'UNICODE', '_UNICODE'):
+ DEFINES[var] = True
+ if CONFIG['GNU_CC']:
+ WIN32_EXE_LDFLAGS += ['-municode']
diff --git a/application/xulrunner/tools/redit/redit.cpp b/application/xulrunner/tools/redit/redit.cpp
new file mode 100644
index 0000000000..8a96358b22
--- /dev/null
+++ b/application/xulrunner/tools/redit/redit.cpp
@@ -0,0 +1,187 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+// System headers (alphabetical)
+#include <fcntl.h>
+#include <io.h>
+#include <share.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/stat.h>
+#include <windows.h>
+
+// Mozilla headers (alphabetical)
+#include "mozilla/FileUtils.h" // ScopedClose
+#include "mozilla/UniquePtrExtensions.h"
+
+/*
+Icon files are made up of:
+
+IconHeader
+IconDirEntry1
+IconDirEntry2
+...
+IconDirEntryN
+IconData1
+IconData2
+...
+IconDataN
+
+Each IconData must be added as a new RT_ICON resource to the exe. Then
+an RT_GROUP_ICON resource must be added that contains an equivalent
+header:
+
+IconHeader
+IconResEntry1
+IconResEntry2
+...
+IconResEntryN
+*/
+
+#pragma pack(push, 2)
+typedef struct
+{
+ WORD Reserved;
+ WORD ResourceType;
+ WORD ImageCount;
+} IconHeader;
+
+typedef struct
+{
+ BYTE Width;
+ BYTE Height;
+ BYTE Colors;
+ BYTE Reserved;
+ WORD Planes;
+ WORD BitsPerPixel;
+ DWORD ImageSize;
+ DWORD ImageOffset;
+} IconDirEntry;
+
+typedef struct
+{
+ BYTE Width;
+ BYTE Height;
+ BYTE Colors;
+ BYTE Reserved;
+ WORD Planes;
+ WORD BitsPerPixel;
+ DWORD ImageSize;
+ WORD ResourceID; // This field is the one difference to above
+} IconResEntry;
+#pragma pack(pop)
+
+namespace {
+ /**
+ * ScopedResourceUpdate is a RAII wrapper for Windows resource updating
+ *
+ * Instances |EndUpdateResourceW()| their handles when they go out of scope.
+ * They pass |TRUE| as the second argument to |EndUpdateResourceW()|, which
+ * causes the resource update to be aborted (changes are discarded).
+ */
+ struct ScopedResourceUpdateTraits
+ {
+ typedef HANDLE type;
+ static type empty() { return nullptr; }
+ static void release(type handle) {
+ if(nullptr != handle) {
+ EndUpdateResourceW(handle, TRUE); // Discard changes
+ }
+ }
+ };
+
+ typedef mozilla::Scoped<ScopedResourceUpdateTraits> ScopedResourceUpdate;
+};
+
+#ifdef __MINGW32__
+extern "C"
+#endif
+int
+wmain(int argc, wchar_t** argv)
+{
+ if (argc != 3) {
+ printf("Usage: redit <exe file> <icon file>\n");
+ return 1;
+ }
+
+ mozilla::ScopedClose file;
+ if (0 != _wsopen_s(&file.rwget(),
+ argv[2],
+ _O_BINARY | _O_RDONLY,
+ _SH_DENYWR,
+ _S_IREAD)
+ || (-1 == file)) {
+ fprintf(stderr, "Unable to open icon file.\n");
+ return 1;
+ }
+
+ // Load all the data from the icon file
+ long filesize = _filelength(file);
+ auto data = MakeUniqueFallible<BYTE[]>(filesize);
+ if(!data) {
+ fprintf(stderr, "Failed to allocate memory for icon file.\n");
+ return 1;
+ }
+ _read(file, data.get(), filesize);
+
+ IconHeader* header = reinterpret_cast<IconHeader*>(data.get());
+
+ // Open the target library for updating
+ ScopedResourceUpdate updateRes(BeginUpdateResourceW(argv[1], FALSE));
+ if (nullptr == updateRes) {
+ fprintf(stderr, "Unable to open library for modification.\n");
+ return 1;
+ }
+
+ // Allocate the group resource entry
+ long groupSize = sizeof(IconHeader)
+ + header->ImageCount * sizeof(IconResEntry);
+ auto group = MakeUniqueFallible<BYTE[]>(groupSize);
+ if(!group) {
+ fprintf(stderr, "Failed to allocate memory for new images.\n");
+ return 1;
+ }
+ memcpy(group.get(), data.get(), sizeof(IconHeader));
+
+ IconDirEntry* sourceIcon =
+ reinterpret_cast<IconDirEntry*>(data.get()
+ + sizeof(IconHeader));
+ IconResEntry* targetIcon =
+ reinterpret_cast<IconResEntry*>(group.get()
+ + sizeof(IconHeader));
+
+ for (int id = 1; id <= header->ImageCount; id++) {
+ // Add the individual icon
+ if (!UpdateResourceW(updateRes, RT_ICON, MAKEINTRESOURCE(id),
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
+ data + sourceIcon->ImageOffset,
+ sourceIcon->ImageSize)) {
+ fprintf(stderr, "Unable to update resource (RT_ICON).\n");
+ return 1;
+ }
+ // Copy the data for this icon
+ // (note that the structs have different sizes)
+ memcpy(targetIcon, sourceIcon, sizeof(IconResEntry));
+ targetIcon->ResourceID = id;
+ sourceIcon++;
+ targetIcon++;
+ }
+
+ if (!UpdateResourceW(updateRes, RT_GROUP_ICON, L"MAINICON",
+ MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
+ group, groupSize)) {
+ fprintf(stderr, "Unable to update resource (RT_GROUP_ICON).\n");
+ return 1;
+ }
+
+ // Save the modifications
+ if(!EndUpdateResourceW(updateRes.forget(), FALSE)) {
+ fprintf(stderr, "Unable to write changes to library.\n");
+ return 1;
+ }
+
+ return 0;
+}
diff --git a/browser/LICENSE b/browser/LICENSE
index 99d9d6bcd2..f1b2067a77 100644
--- a/browser/LICENSE
+++ b/browser/LICENSE
@@ -2,6 +2,10 @@ Please see the file ../toolkit/content/license.html for the copyright
licensing conditions attached to this codebase, including copies of the
licenses concerned.
-You are not granted rights or licenses to the trademarks of the
-Mozilla Foundation or any party, including without limitation the
-Firefox name or logo.
+You are not granted rights or licenses to the trademarks of Moonchild
+Productions or any other party, including without limitation the
+Basilisk name or logo.
+
+The Serpent logo in branding/unofficial is derived from "Sea Serpent"
+by Lorc, licensed under the Creative Commons license CC-BY 3.0
+
diff --git a/browser/app/blocklist.xml b/browser/app/blocklist.xml
index 1c71bcd61a..239fe43a4b 100644
--- a/browser/app/blocklist.xml
+++ b/browser/app/blocklist.xml
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='UTF-8'?>
-<blocklist lastupdate="1511452800000" xmlns="http://www.mozilla.org/2006/addons-blocklist">
+<blocklist lastupdate="1521130300000" xmlns="http://www.mozilla.org/2006/addons-blocklist">
<emItems>
<emItem blockID="i988" id="{b12785f5-d8d0-4530-a3ea-5c4263b85bef}">
<prefs/>
@@ -2087,6 +2087,10 @@
<prefs/>
<versionRange minVersion="0" maxVersion="15.0.5" severity="1"/>
</emItem>
+ <emItem blockID="2447476f-043b-4d0b-9d3c-8e859c97d950" id="{44e4b2cf-77ba-4f76-aca7-f3fcbc2dda2f}">
+ <prefs/>
+ <versionRange minVersion="0" maxVersion="*" severity="3"/>
+ </emItem>
</emItems>
<pluginItems>
<pluginItem blockID="p416">
diff --git a/browser/app/macbuild/Contents/Info.plist.in b/browser/app/macbuild/Contents/Info.plist.in
index 6212e886db..d6902fffde 100644
--- a/browser/app/macbuild/Contents/Info.plist.in
+++ b/browser/app/macbuild/Contents/Info.plist.in
@@ -205,6 +205,11 @@
<true/>
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
+ <key>LSEnvironment</key>
+ <dict>
+ <key>MallocNanoZone</key>
+ <string>0</string>
+ </dict>
<key>LSFileQuarantineEnabled</key>
<true/>
<key>LSMinimumSystemVersion</key>
diff --git a/browser/app/nsBrowserApp.cpp b/browser/app/nsBrowserApp.cpp
index ac2e85ea3c..184b1fc2e3 100644
--- a/browser/app/nsBrowserApp.cpp
+++ b/browser/app/nsBrowserApp.cpp
@@ -24,11 +24,6 @@
#include "nsStringGlue.h"
#ifdef XP_WIN
-#ifdef MOZ_ASAN
-// ASAN requires basilisk.exe to be built with -MD, and it's OK if we don't
-// support Windows XP SP2 in ASAN builds.
-#define XRE_DONT_SUPPORT_XPSP2
-#endif
#define XRE_WANT_ENVIRON
#define strcasecmp _stricmp
#ifdef MOZ_SANDBOX
diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js
index d6de538d7a..5637d17978 100644
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -156,8 +156,8 @@ pref("app.update.service.enabled", true);
// .. etc ..
//
pref("extensions.update.enabled", true);
-pref("extensions.update.url", "https://versioncheck.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
-pref("extensions.update.background.url", "https://versioncheck-bg.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
+pref("extensions.update.url", "https://versioncheck.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=52.9&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
+pref("extensions.update.background.url", "https://versioncheck-bg.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=52.9&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
pref("extensions.update.interval", 86400); // Check for updates to Extensions and
// Themes every day
// Non-symmetric (not shared by extensions) extension-specific [update] preferences
@@ -229,11 +229,6 @@ pref("browser.slowStartup.notificationDisabled", false);
pref("browser.slowStartup.timeThreshold", 40000);
pref("browser.slowStartup.maxSamples", 5);
-// This url, if changed, MUST continue to point to an https url. Pulling arbitrary content to inject into
-// this page over http opens us up to a man-in-the-middle attack that we'd rather not face. If you are a downstream
-// repackager of this code using an alternate snippet url, please keep your users safe
-pref("browser.aboutHomeSnippets.updateUrl", "https://snippets.cdn.mozilla.net/%STARTPAGE_VERSION%/%NAME%/%VERSION%/%APPBUILDID%/%BUILD_TARGET%/%LOCALE%/%CHANNEL%/%OS_VERSION%/%DISTRIBUTION%/%DISTRIBUTION_VERSION%/");
-
pref("browser.enable_automatic_image_resizing", true);
pref("browser.casting.enabled", false);
pref("browser.chrome.site_icons", true);
@@ -1397,13 +1392,6 @@ pref("browser.translation.engine", "bing");
// Determines if Telemetry pings can be archived locally.
pref("toolkit.telemetry.archive.enabled", true);
-// Telemetry experiments settings.
-pref("experiments.enabled", true);
-pref("experiments.manifest.fetchIntervalSeconds", 86400);
-pref("experiments.manifest.uri", "https://telemetry-experiment.cdn.mozilla.net/manifest/v1/firefox/%VERSION%/%CHANNEL%");
-// Whether experiments are supported by the current application profile.
-pref("experiments.supported", true);
-
// Enable GMP support in the addon manager.
pref("media.gmp-provider.enabled", true);
diff --git a/browser/base/content/abouthome/aboutHome.css b/browser/base/content/abouthome/aboutHome.css
index c0b02e2574..bc3f9882ce 100644
--- a/browser/base/content/abouthome/aboutHome.css
+++ b/browser/base/content/abouthome/aboutHome.css
@@ -49,8 +49,7 @@ a {
background-repeat: no-repeat;
}
-#searchIconAndTextContainer,
-#snippets {
+#searchIconAndTextContainer {
width: 470px;
}
@@ -168,48 +167,6 @@ a {
transition-duration: 0ms;
}
-#defaultSnippet1,
-#defaultSnippet2,
-#rightsSnippet {
- display: block;
- min-height: 38px;
- background: 0 center no-repeat;
- padding: 6px 0;
- padding-inline-start: 49px;
-}
-
-#rightsSnippet[hidden] {
- display: none;
-}
-
-#defaultSnippet1:dir(rtl),
-#defaultSnippet2:dir(rtl),
-#rightsSnippet:dir(rtl) {
- background-position: right 0 center;
-}
-
-#defaultSnippet1 {
- background-image: url("chrome://browser/content/abouthome/snippet1.png");
-}
-
-#defaultSnippet2 {
- background-image: url("chrome://browser/content/abouthome/snippet2.png");
-}
-
-#snippets {
- display: inline-block;
- text-align: start;
- margin: 12px 0;
- color: #3c3c3c;
- font-size: 75%;
- /* 12px is the computed font size, 15px the computed line height of the snippets
- with Segoe UI on a default Windows 7 setup. The 15/12 multiplier approximately
- converts em from units of font-size to units of line-height. The goal is to
- preset the height of a three-line snippet to avoid visual moving/flickering as
- the snippets load. */
- min-height: calc(15/12 * 3em);
-}
-
#launcher {
display: -moz-box;
-moz-box-align: center;
@@ -385,20 +342,6 @@ body[narrow] #restorePreviousSession::before {
background-image: url("chrome://branding/content/about-logo@2x.png");
}
- #defaultSnippet1,
- #defaultSnippet2,
- #rightsSnippet {
- background-size: 40px;
- }
-
- #defaultSnippet1 {
- background-image: url("chrome://browser/content/abouthome/snippet1@2x.png");
- }
-
- #defaultSnippet2 {
- background-image: url("chrome://browser/content/abouthome/snippet2@2x.png");
- }
-
.launchButton::before,
#aboutMozilla::before {
transform: scale(.5);
diff --git a/browser/base/content/abouthome/aboutHome.js b/browser/base/content/abouthome/aboutHome.js
index 50f3e01cd0..0cbcc835a4 100644
--- a/browser/base/content/abouthome/aboutHome.js
+++ b/browser/base/content/abouthome/aboutHome.js
@@ -6,23 +6,10 @@
/* import-globals-from ../contentSearchUI.js */
-// The process of adding a new default snippet involves:
-// * add a new entity to aboutHome.dtd
-// * add a <span/> for it in aboutHome.xhtml
-// * add an entry here in the proper ordering (based on spans)
-// The <a/> part of the snippet will be linked to the corresponding url.
-const DEFAULT_SNIPPETS_URLS = [
- "https://www.mozilla.org/firefox/features/?utm_source=snippet&utm_medium=snippet&utm_campaign=default+feature+snippet"
-, "https://addons.mozilla.org/firefox/?utm_source=snippet&utm_medium=snippet&utm_campaign=addons"
-];
-
-const SNIPPETS_UPDATE_INTERVAL_MS = 14400000; // 4 hours.
-
// IndexedDB storage constants.
const DATABASE_NAME = "abouthome";
const DATABASE_VERSION = 1;
const DATABASE_STORAGE = "persistent";
-const SNIPPETS_OBJECTSTORE_NAME = "snippets";
var searchText;
// This global tracks if the page has been set up before, to prevent double inits
@@ -33,13 +20,6 @@ var gObserver = new MutationObserver(function (mutations) {
if (mutation.attributeName == "session") {
fitToWidth();
}
- if (mutation.attributeName == "snippetsVersion") {
- if (!gInitialized) {
- ensureSnippetsMapThen(loadSnippets);
- gInitialized = true;
- }
- return;
- }
}
});
@@ -90,126 +70,6 @@ window.addEventListener("keypress", ev => {
searchText.value += ev.key;
});
-// This object has the same interface as Map and is used to store and retrieve
-// the snippets data. It is lazily initialized by ensureSnippetsMapThen(), so
-// be sure its callback returned before trying to use it.
-var gSnippetsMap;
-var gSnippetsMapCallbacks = [];
-
-/**
- * Ensure the snippets map is properly initialized.
- *
- * @param aCallback
- * Invoked once the map has been initialized, gets the map as argument.
- * @note Snippets should never directly manage the underlying storage, since
- * it may change inadvertently.
- */
-function ensureSnippetsMapThen(aCallback)
-{
- if (gSnippetsMap) {
- aCallback(gSnippetsMap);
- return;
- }
-
- // Handle multiple requests during the async initialization.
- gSnippetsMapCallbacks.push(aCallback);
- if (gSnippetsMapCallbacks.length > 1) {
- // We are already updating, the callbacks will be invoked when done.
- return;
- }
-
- let invokeCallbacks = function () {
- if (!gSnippetsMap) {
- gSnippetsMap = Object.freeze(new Map());
- }
-
- for (let callback of gSnippetsMapCallbacks) {
- callback(gSnippetsMap);
- }
- gSnippetsMapCallbacks.length = 0;
- }
-
- let openRequest = indexedDB.open(DATABASE_NAME, {version: DATABASE_VERSION,
- storage: DATABASE_STORAGE});
-
- openRequest.onerror = function (event) {
- // Try to delete the old database so that we can start this process over
- // next time.
- indexedDB.deleteDatabase(DATABASE_NAME);
- invokeCallbacks();
- };
-
- openRequest.onupgradeneeded = function (event) {
- let db = event.target.result;
- if (!db.objectStoreNames.contains(SNIPPETS_OBJECTSTORE_NAME)) {
- db.createObjectStore(SNIPPETS_OBJECTSTORE_NAME);
- }
- }
-
- openRequest.onsuccess = function (event) {
- let db = event.target.result;
-
- db.onerror = function (event) {
- invokeCallbacks();
- }
-
- db.onversionchange = function (event) {
- event.target.close();
- invokeCallbacks();
- }
-
- let cache = new Map();
- let cursorRequest;
- try {
- cursorRequest = db.transaction(SNIPPETS_OBJECTSTORE_NAME)
- .objectStore(SNIPPETS_OBJECTSTORE_NAME).openCursor();
- } catch (ex) {
- console.error(ex);
- invokeCallbacks();
- return;
- }
-
- cursorRequest.onerror = function (event) {
- invokeCallbacks();
- }
-
- cursorRequest.onsuccess = function(event) {
- let cursor = event.target.result;
-
- // Populate the cache from the persistent storage.
- if (cursor) {
- cache.set(cursor.key, cursor.value);
- cursor.continue();
- return;
- }
-
- // The cache has been filled up, create the snippets map.
- gSnippetsMap = Object.freeze({
- get: (aKey) => cache.get(aKey),
- set: function (aKey, aValue) {
- db.transaction(SNIPPETS_OBJECTSTORE_NAME, "readwrite")
- .objectStore(SNIPPETS_OBJECTSTORE_NAME).put(aValue, aKey);
- return cache.set(aKey, aValue);
- },
- has: (aKey) => cache.has(aKey),
- delete: function (aKey) {
- db.transaction(SNIPPETS_OBJECTSTORE_NAME, "readwrite")
- .objectStore(SNIPPETS_OBJECTSTORE_NAME).delete(aKey);
- return cache.delete(aKey);
- },
- clear: function () {
- db.transaction(SNIPPETS_OBJECTSTORE_NAME, "readwrite")
- .objectStore(SNIPPETS_OBJECTSTORE_NAME).clear();
- return cache.clear();
- },
- get size() { return cache.size; },
- });
-
- setTimeout(invokeCallbacks, 0);
- }
- }
-}
-
function onSearchSubmit(aEvent)
{
gContentSearchController.search(aEvent);
@@ -246,146 +106,6 @@ function setupSearch()
*/
function loadCompleted()
{
- var event = new CustomEvent("AboutHomeLoadSnippetsCompleted", {bubbles:true});
- document.dispatchEvent(event);
-}
-
-/**
- * Update the local snippets from the remote storage, then show them through
- * showSnippets.
- */
-function loadSnippets()
-{
- if (!gSnippetsMap)
- throw new Error("Snippets map has not properly been initialized");
-
- // Allow tests to modify the snippets map before using it.
- var event = new CustomEvent("AboutHomeLoadSnippets", {bubbles:true});
- document.dispatchEvent(event);
-
- // Check cached snippets version.
- let cachedVersion = gSnippetsMap.get("snippets-cached-version") || 0;
- let currentVersion = document.documentElement.getAttribute("snippetsVersion");
- if (cachedVersion < currentVersion) {
- // The cached snippets are old and unsupported, restart from scratch.
- gSnippetsMap.clear();
- }
-
- // Check last snippets update.
- let lastUpdate = gSnippetsMap.get("snippets-last-update");
- let updateURL = document.documentElement.getAttribute("snippetsURL");
- let shouldUpdate = !lastUpdate ||
- Date.now() - lastUpdate > SNIPPETS_UPDATE_INTERVAL_MS;
- if (updateURL && shouldUpdate) {
- // Try to update from network.
- let xhr = new XMLHttpRequest();
- xhr.timeout = 5000;
- // Even if fetching should fail we don't want to spam the server, thus
- // set the last update time regardless its results. Will retry tomorrow.
- gSnippetsMap.set("snippets-last-update", Date.now());
- xhr.onloadend = function (event) {
- if (xhr.status == 200) {
- gSnippetsMap.set("snippets", xhr.responseText);
- gSnippetsMap.set("snippets-cached-version", currentVersion);
- }
- showSnippets();
- loadCompleted();
- };
- try {
- xhr.open("GET", updateURL, true);
- xhr.send(null);
- } catch (ex) {
- showSnippets();
- loadCompleted();
- return;
- }
- } else {
- showSnippets();
- loadCompleted();
- }
-}
-
-/**
- * Shows locally cached remote snippets, or default ones when not available.
- *
- * @note: snippets should never invoke showSnippets(), or they may cause
- * a "too much recursion" exception.
- */
-var _snippetsShown = false;
-function showSnippets()
-{
- let snippetsElt = document.getElementById("snippets");
-
- // Show about:rights notification, if needed.
- let showRights = document.documentElement.getAttribute("showKnowYourRights");
- if (showRights) {
- let rightsElt = document.getElementById("rightsSnippet");
- let anchor = rightsElt.getElementsByTagName("a")[0];
- anchor.href = "about:rights";
- snippetsElt.appendChild(rightsElt);
- rightsElt.removeAttribute("hidden");
- return;
- }
-
- if (!gSnippetsMap)
- throw new Error("Snippets map has not properly been initialized");
- if (_snippetsShown) {
- // There's something wrong with the remote snippets, just in case fall back
- // to the default snippets.
- showDefaultSnippets();
- throw new Error("showSnippets should never be invoked multiple times");
- }
- _snippetsShown = true;
-
- let snippets = gSnippetsMap.get("snippets");
- // If there are remotely fetched snippets, try to to show them.
- if (snippets) {
- // Injecting snippets can throw if they're invalid XML.
- try {
- snippetsElt.innerHTML = snippets;
- // Scripts injected by innerHTML are inactive, so we have to relocate them
- // through DOM manipulation to activate their contents.
- Array.forEach(snippetsElt.getElementsByTagName("script"), function(elt) {
- let relocatedScript = document.createElement("script");
- relocatedScript.type = "text/javascript;version=1.8";
- relocatedScript.text = elt.text;
- elt.parentNode.replaceChild(relocatedScript, elt);
- });
- return;
- } catch (ex) {
- // Bad content, continue to show default snippets.
- }
- }
-
- showDefaultSnippets();
-}
-
-/**
- * Clear snippets element contents and show default snippets.
- */
-function showDefaultSnippets()
-{
- // Clear eventual contents...
- let snippetsElt = document.getElementById("snippets");
- snippetsElt.innerHTML = "";
-
- // ...then show default snippets.
- let defaultSnippetsElt = document.getElementById("defaultSnippets");
- let entries = defaultSnippetsElt.querySelectorAll("span");
- // Choose a random snippet. Assume there is always at least one.
- let randIndex = Math.floor(Math.random() * entries.length);
- let entry = entries[randIndex];
- // Inject url in the eventual link.
- if (DEFAULT_SNIPPETS_URLS[randIndex]) {
- let links = entry.getElementsByTagName("a");
- // Default snippets can have only one link, otherwise something is messed
- // up in the translation.
- if (links.length == 1) {
- links[0].href = DEFAULT_SNIPPETS_URLS[randIndex];
- }
- }
- // Move the default snippet to the snippets element.
- snippetsElt.appendChild(entry);
}
function fitToWidth() {
diff --git a/browser/base/content/abouthome/aboutHome.xhtml b/browser/base/content/abouthome/aboutHome.xhtml
index c288e732e7..22bf2e7e81 100644
--- a/browser/base/content/abouthome/aboutHome.xhtml
+++ b/browser/base/content/abouthome/aboutHome.xhtml
@@ -46,15 +46,6 @@
<input id="searchSubmit" type="button" onclick="onSearchSubmit(event)"
title="&contentSearchSubmit.tooltip;"/>
</div>
-
- <div id="snippetContainer">
- <div id="defaultSnippets" hidden="true">
- <span id="defaultSnippet1">&abouthome.defaultSnippet1.v1;</span>
- <span id="defaultSnippet2">&abouthome.defaultSnippet2.v1;</span>
- </div>
- <span id="rightsSnippet" hidden="true">&abouthome.rightsSnippet;</span>
- <div id="snippets"/>
- </div>
</div>
<div class="spacer"/>
@@ -73,7 +64,5 @@
<button class="launchButton" id="restorePreviousSession">&historyRestoreLastSession.label;</button>
</div>
- <a id="aboutMozilla" href="https://www.mozilla.org/about/?utm_source=about-home&amp;utm_medium=Referral"
- aria-label="&abouthome.aboutMozilla.label;"/>
</body>
</html>
diff --git a/browser/base/content/browser-context.inc b/browser/base/content/browser-context.inc
index 51b14d1523..3061cccdd1 100644
--- a/browser/base/content/browser-context.inc
+++ b/browser/base/content/browser-context.inc
@@ -456,12 +456,14 @@
oncommand="gContextMenu.openPasswordManager();"/>
</menupopup>
</menu>
+#ifdef MOZ_DEVTOOLS
<menuseparator id="inspect-separator" hidden="true"/>
<menuitem id="context-inspect"
hidden="true"
label="&inspectContextMenu.label;"
accesskey="&inspectContextMenu.accesskey;"
oncommand="gContextMenu.inspectNode();"/>
+#endif
<menuseparator id="context-media-eme-separator" hidden="true"/>
<menuitem id="context-media-eme-learnmore"
class="menuitem-iconic"
diff --git a/browser/base/content/browser-media.js b/browser/base/content/browser-media.js
index f721be74d7..bd5c5b227f 100644
--- a/browser/base/content/browser-media.js
+++ b/browser/base/content/browser-media.js
@@ -45,11 +45,23 @@ var gEMEHandler = {
}
return true;
},
- getLearnMoreLink: function(msgId) {
- let text = gNavigatorBundle.getString("emeNotifications." + msgId + ".learnMoreLabel");
+ getEMEDisabledFragment: function(msgId) {
+ let mainMessage = gNavigatorBundle.getString("emeNotifications.drmContentDisabled.message");
+ let [prefix, suffix] = mainMessage.split(/%(?:\$\d)?S/).map(s => document.createTextNode(s));
+ let text = gNavigatorBundle.getString("emeNotifications.drmContentDisabled.learnMoreLabel");
let baseURL = Services.urlFormatter.formatURLPref("app.support.baseURL");
- return "<label class='text-link' href='" + baseURL + "drm-content'>" +
- text + "</label>";
+ let link = document.createElement("label");
+ link.className = "text-link";
+ link.setAttribute("href", baseURL + "drm-content");
+ link.textContent = text;
+
+ let fragment = document.createDocumentFragment();
+ [prefix, link, suffix].forEach(n => fragment.appendChild(n));
+ return fragment;
+ },
+ getMessageWithBrandName: function(notificationId) {
+ let msgId = "emeNotifications." + notificationId + ".message";
+ return gNavigatorBundle.getFormattedString(msgId, [this._brandShortName]);
},
receiveMessage: function({target: browser, data: data}) {
let parsedData;
@@ -67,7 +79,8 @@ var gEMEHandler = {
let notificationId;
let buttonCallback;
- let params = [];
+ // Notification message can be either a string or a DOM fragment.
+ let notificationMessage;
switch (status) {
case "available":
case "cdm-created":
@@ -82,17 +95,17 @@ var gEMEHandler = {
case "cdm-disabled":
notificationId = "drmContentDisabled";
buttonCallback = gEMEHandler.ensureEMEEnabled.bind(gEMEHandler, browser, keySystem)
- params = [this.getLearnMoreLink(notificationId)];
+ notificationMessage = this.getEMEDisabledFragment();
break;
case "cdm-insufficient-version":
notificationId = "drmContentCDMInsufficientVersion";
- params = [this._brandShortName];
+ notificationMessage = this.getMessageWithBrandName(notificationId);
break;
case "cdm-not-installed":
notificationId = "drmContentCDMInstalling";
- params = [this._brandShortName];
+ notificationMessage = this.getMessageWithBrandName(notificationId);
break;
case "cdm-not-supported":
@@ -104,44 +117,29 @@ var gEMEHandler = {
return;
}
- this.showNotificationBar(browser, notificationId, keySystem, params, buttonCallback);
- },
- showNotificationBar: function(browser, notificationId, keySystem, labelParams, callback) {
+ // Now actually create the notification
+
let box = gBrowser.getNotificationBox(browser);
if (box.getNotificationWithValue(notificationId)) {
return;
}
- let msgPrefix = "emeNotifications." + notificationId + ".";
- let msgId = msgPrefix + "message";
-
- let message = labelParams.length ?
- gNavigatorBundle.getFormattedString(msgId, labelParams) :
- gNavigatorBundle.getString(msgId);
-
let buttons = [];
- if (callback) {
+ if (buttonCallback) {
+ let msgPrefix = "emeNotifications." + notificationId + ".";
let btnLabelId = msgPrefix + "button.label";
let btnAccessKeyId = msgPrefix + "button.accesskey";
buttons.push({
label: gNavigatorBundle.getString(btnLabelId),
accessKey: gNavigatorBundle.getString(btnAccessKeyId),
- callback: callback
+ callback: buttonCallback
});
}
let iconURL = "chrome://browser/skin/drm-icon.svg#chains-black";
- // Do a little dance to get rich content into the notification:
- let fragment = document.createDocumentFragment();
- let descriptionContainer = document.createElement("description");
- descriptionContainer.innerHTML = message;
- while (descriptionContainer.childNodes.length) {
- fragment.appendChild(descriptionContainer.childNodes[0]);
- }
-
- box.appendNotification(fragment, notificationId, iconURL, box.PRIORITY_WARNING_MEDIUM,
- buttons);
+ box.appendNotification(notificationMessage, notificationId, iconURL,
+ box.PRIORITY_WARNING_MEDIUM, buttons);
},
showPopupNotificationForSuccess: function(browser, keySystem) {
// We're playing EME content! Remove any "we can't play because..." messages.
diff --git a/browser/base/content/browser-places.js b/browser/base/content/browser-places.js
index a447880be3..83c7379775 100644
--- a/browser/base/content/browser-places.js
+++ b/browser/base/content/browser-places.js
@@ -299,24 +299,23 @@ var StarUI = {
parent.setAttribute("open", "true");
}
}
- let panel = this.panel;
- let target = panel;
- if (target.parentNode) {
- // By targeting the panel's parent and using a capturing listener, we
- // can have our listener called before others waiting for the panel to
- // be shown (which probably expect the panel to be fully initialized)
- target = target.parentNode;
- }
- target.addEventListener("popupshown", function shownListener(event) {
- if (event.target == panel) {
- target.removeEventListener("popupshown", shownListener, true);
-
- gEditItemOverlay.initPanel({ node: aNode
- , hiddenRows: ["description", "location",
- "loadInSidebar", "keyword"]
- , focusedElement: "preferred"});
+ let onPanelReady = fn => {
+ let target = this.panel;
+ if (target.parentNode) {
+ // By targeting the panel's parent and using a capturing listener, we
+ // can have our listener called before others waiting for the panel to
+ // be shown (which probably expect the panel to be fully initialized)
+ target = target.parentNode;
}
- }, true);
+ target.addEventListener("popupshown", function(event) {
+ fn();
+ }, {"capture": true, "once": true});
+ };
+ gEditItemOverlay.initPanel({ node: aNode
+ , onPanelReady
+ , hiddenRows: ["description", "location",
+ "loadInSidebar", "keyword"]
+ , focusedElement: "preferred"});
this.panel.openPopup(aAnchorElement, aPosition);
}),
diff --git a/browser/base/content/browser-plugins.js b/browser/base/content/browser-plugins.js
index ad070df12c..c1bc658601 100644
--- a/browser/base/content/browser-plugins.js
+++ b/browser/base/content/browser-plugins.js
@@ -63,9 +63,7 @@ var gPluginHandler = {
msg.data.pluginID);
break;
case "PluginContent:SubmitReport":
- if (AppConstants.MOZ_CRASHREPORTER) {
- this.submitReport(msg.data.runID, msg.data.keyVals, msg.data.submitURLOptIn);
- }
+ // Nothing to do here
break;
case "PluginContent:LinkClickCallback":
switch (msg.data.name) {
@@ -98,11 +96,8 @@ var gPluginHandler = {
},
submitReport: function submitReport(runID, keyVals, submitURLOptIn) {
- if (!AppConstants.MOZ_CRASHREPORTER) {
- return;
- }
- Services.prefs.setBoolPref("dom.ipc.plugins.reportCrashURL", submitURLOptIn);
- PluginCrashReporter.submitCrashReport(runID, keyVals);
+ /*** STUB ***/
+ return;
},
// Callback for user clicking a "reload page" link
@@ -461,18 +456,7 @@ var gPluginHandler = {
// If we don't have a minidumpID, we can't (or didn't) submit anything.
// This can happen if the plugin is killed from the task manager.
- let state;
- if (!AppConstants.MOZ_CRASHREPORTER || !gCrashReporter.enabled) {
- // This state tells the user that crash reporting is disabled, so we
- // cannot send a report.
- state = "noSubmit";
- } else if (!pluginDumpID) {
- // This state tells the user that there is no crash report available.
- state = "noReport";
- } else {
- // This state asks the user to submit a crash report.
- state = "please";
- }
+ let state = "noSubmit";
let mm = window.getGroupMessageManager("browsers");
mm.broadcastAsyncMessage("BrowserPlugins:NPAPIPluginProcessCrashed",
@@ -513,22 +497,6 @@ var gPluginHandler = {
callback: function() { browser.reload(); },
}];
- if (AppConstants.MOZ_CRASHREPORTER &&
- PluginCrashReporter.hasCrashReport(pluginID)) {
- let submitLabel = gNavigatorBundle.getString("crashedpluginsMessage.submitButton.label");
- let submitKey = gNavigatorBundle.getString("crashedpluginsMessage.submitButton.accesskey");
- let submitButton = {
- label: submitLabel,
- accessKey: submitKey,
- popup: null,
- callback: () => {
- PluginCrashReporter.submitCrashReport(pluginID);
- },
- };
-
- buttons.push(submitButton);
- }
-
notification = notificationBox.appendNotification(messageString, "plugin-crashed",
iconURL, priority, buttons);
diff --git a/browser/base/content/browser-syncui.js b/browser/base/content/browser-syncui.js
index c5c2995c81..51bcb15d5f 100644
--- a/browser/base/content/browser-syncui.js
+++ b/browser/base/content/browser-syncui.js
@@ -4,10 +4,10 @@
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-if (AppConstants.MOZ_SERVICES_CLOUDSYNC) {
- XPCOMUtils.defineLazyModuleGetter(this, "CloudSync",
- "resource://gre/modules/CloudSync.jsm");
-}
+#ifdef MOZ_SERVICES_CLOUDSYNC
+XPCOMUtils.defineLazyModuleGetter(this, "CloudSync",
+ "resource://gre/modules/CloudSync.jsm");
+#endif
XPCOMUtils.defineLazyModuleGetter(this, "fxAccounts",
"resource://gre/modules/FxAccounts.jsm");
@@ -170,9 +170,13 @@ var gSyncUI = {
document.getElementById("sync-setup-state").hidden = true;
document.getElementById("sync-syncnow-state").hidden = true;
+#ifdef MOZ_SERVICES_CLOUDSYNC
if (CloudSync && CloudSync.ready && CloudSync().adapters.count) {
document.getElementById("sync-syncnow-state").hidden = false;
} else if (loginFailed) {
+#else
+ if (loginFailed) {
+#endif
// unhiding this element makes the menubar show the login failure state.
document.getElementById("sync-reauth-state").hidden = false;
} else if (needsSetup) {
diff --git a/browser/base/content/browser.css b/browser/base/content/browser.css
index a05b031b2c..f03f21c3f7 100644
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -557,7 +557,7 @@ toolbar:not(#TabsToolbar) > #personal-bookmarks {
transition: none;
}
-#DateTimePickerPanel {
+#DateTimePickerPanel[active="true"] {
-moz-binding: url("chrome://global/content/bindings/datetimepopup.xml#datetime-popup");
}
@@ -815,7 +815,6 @@ html|*#fullscreen-exit-button {
.popup-anchor {
/* should occupy space but not be visible */
opacity: 0;
- visibility: hidden;
pointer-events: none;
-moz-stack-sizing: ignore;
}
diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
index d41e94ae65..696a2871a8 100755
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -53,19 +53,16 @@ Cu.import("resource://gre/modules/NotificationDB.jsm");
["UpdateUtils", "resource://gre/modules/UpdateUtils.jsm"],
["Weave", "resource://services-sync/main.js"],
["fxAccounts", "resource://gre/modules/FxAccounts.jsm"],
+#ifdef MOZ_DEVTOOLS
+ // Note: Do not delete! It is used for: base/content/nsContextMenu.js
["gDevTools", "resource://devtools/client/framework/gDevTools.jsm"],
- ["gDevToolsBrowser", "resource://devtools/client/framework/gDevTools.jsm"],
+#endif
["webrtcUI", "resource:///modules/webrtcUI.jsm", ]
].forEach(([name, resource]) => XPCOMUtils.defineLazyModuleGetter(this, name, resource));
XPCOMUtils.defineLazyModuleGetter(this, "SafeBrowsing",
"resource://gre/modules/SafeBrowsing.jsm");
-if (AppConstants.MOZ_CRASHREPORTER) {
- XPCOMUtils.defineLazyModuleGetter(this, "PluginCrashReporter",
- "resource:///modules/ContentCrashHandlers.jsm");
-}
-
// lazy service getters
[
["Favicons", "@mozilla.org/browser/favicon-service;1", "mozIAsyncFavicons"],
@@ -74,13 +71,6 @@ if (AppConstants.MOZ_CRASHREPORTER) {
["gDNSService", "@mozilla.org/network/dns-service;1", "nsIDNSService"],
].forEach(([name, cc, ci]) => XPCOMUtils.defineLazyServiceGetter(this, name, cc, ci));
-if (AppConstants.MOZ_CRASHREPORTER) {
- XPCOMUtils.defineLazyServiceGetter(this, "gCrashReporter",
- "@mozilla.org/xre/app-info;1",
- "nsICrashReporter");
-}
-
-
XPCOMUtils.defineLazyGetter(this, "BrowserToolboxProcess", function() {
let tmp = {};
Cu.import("resource://devtools/client/framework/ToolboxProcess.jsm", tmp);
@@ -214,7 +204,8 @@ var gInitialPages = [
"about:home",
"about:privatebrowsing",
"about:welcomeback",
- "about:sessionrestore"
+ "about:sessionrestore",
+ "about:logopage"
];
function* browserWindows() {
@@ -4582,23 +4573,6 @@ var XULBrowserWindow = {
setTimeout(function () { XULBrowserWindow.asyncUpdateUI(); }, 0);
else
this.asyncUpdateUI();
-
- if (AppConstants.MOZ_CRASHREPORTER && aLocationURI) {
- let uri = aLocationURI.clone();
- try {
- // If the current URI contains a username/password, remove it.
- uri.userPass = "";
- } catch (ex) { /* Ignore failures on about: URIs. */ }
-
- try {
- gCrashReporter.annotateCrashReport("URL", uri.spec);
- } catch (ex) {
- // Don't make noise when the crash reporter is built but not enabled.
- if (ex.result != Components.results.NS_ERROR_NOT_INITIALIZED) {
- throw ex;
- }
- }
- }
},
asyncUpdateUI: function () {
@@ -7893,15 +7867,6 @@ var TabContextMenu = {
}
};
-Object.defineProperty(this, "HUDService", {
- get: function HUDService_getter() {
- let devtools = Cu.import("resource://devtools/shared/Loader.jsm", {}).devtools;
- return devtools.require("devtools/client/webconsole/hudservice").HUDService;
- },
- configurable: true,
- enumerable: true
-});
-
// Prompt user to restart the browser in safe mode
function safeModeRestart() {
if (Services.appinfo.inSafeMode) {
@@ -7959,30 +7924,6 @@ function duplicateTabIn(aTab, where, delta) {
}
}
-var Scratchpad = {
- openScratchpad: function SP_openScratchpad() {
- return this.ScratchpadManager.openScratchpad();
- }
-};
-
-XPCOMUtils.defineLazyGetter(Scratchpad, "ScratchpadManager", function() {
- let tmp = {};
- Cu.import("resource://devtools/client/scratchpad/scratchpad-manager.jsm", tmp);
- return tmp.ScratchpadManager;
-});
-
-var ResponsiveUI = {
- toggle: function RUI_toggle() {
- this.ResponsiveUIManager.toggle(window, gBrowser.selectedTab);
- }
-};
-
-XPCOMUtils.defineLazyGetter(ResponsiveUI, "ResponsiveUIManager", function() {
- let tmp = {};
- Cu.import("resource://devtools/client/responsivedesign/responsivedesign.jsm", tmp);
- return tmp.ResponsiveUIManager;
-});
-
var MousePosTracker = {
_listeners: new Set(),
_x: 0,
diff --git a/browser/base/content/browser.xul b/browser/base/content/browser.xul
index ae531e1677..485471ee37 100644
--- a/browser/base/content/browser.xul
+++ b/browser/base/content/browser.xul
@@ -9,7 +9,9 @@
<?xml-stylesheet href="chrome://browser/content/browser.css" type="text/css"?>
<?xml-stylesheet href="chrome://browser/content/places/places.css" type="text/css"?>
<?xml-stylesheet href="chrome://browser/content/usercontext/usercontext.css" type="text/css"?>
+#ifdef MOZ_DEVTOOLS
<?xml-stylesheet href="chrome://devtools/skin/devtools-browser.css" type="text/css"?>
+#endif
<?xml-stylesheet href="chrome://browser/skin/controlcenter/panel.css" type="text/css"?>
<?xml-stylesheet href="chrome://browser/skin/customizableui/panelUI.css" type="text/css"?>
<?xml-stylesheet href="chrome://browser/skin/" type="text/css"?>
@@ -155,13 +157,17 @@
level="parent"
overflowpadding="30" />
+ <!-- for date/time picker. consumeoutsideclicks is set to never, so that
+ clicks on the anchored input box are never consumed. -->
<panel id="DateTimePickerPanel"
type="arrow"
hidden="true"
orient="vertical"
noautofocus="true"
- consumeoutsideclicks="false"
- level="parent">
+ norolluponanchor="true"
+ consumeoutsideclicks="never"
+ level="parent"
+ tabspecific="true">
<iframe id="dateTimePopupFrame"/>
</panel>
diff --git a/browser/base/content/nsContextMenu.js b/browser/base/content/nsContextMenu.js
index 8eb9b034f6..ddf6952026 100644
--- a/browser/base/content/nsContextMenu.js
+++ b/browser/base/content/nsContextMenu.js
@@ -1158,7 +1158,8 @@ nsContextMenu.prototype = {
this.browser.contentPrincipal,
Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT);
openUILink(this.mediaURL, e, { disallowInheritPrincipal: true,
- referrerURI: referrerURI });
+ referrerURI: referrerURI,
+ forceAllowDataURI: true });
}
},
diff --git a/browser/base/content/sync/aboutSyncTabs.js b/browser/base/content/sync/aboutSyncTabs.js
index 0c5dbb2d81..f4bb607ea2 100644
--- a/browser/base/content/sync/aboutSyncTabs.js
+++ b/browser/base/content/sync/aboutSyncTabs.js
@@ -7,7 +7,6 @@ var Cu = Components.utils;
Cu.import("resource://services-common/utils.js");
Cu.import("resource://services-sync/main.js");
Cu.import("resource:///modules/PlacesUIUtils.jsm");
-Cu.import("resource://gre/modules/AppConstants.jsm");
Cu.import("resource://gre/modules/PlacesUtils.jsm", this);
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
@@ -15,10 +14,10 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
"resource://gre/modules/Promise.jsm");
-if (AppConstants.MOZ_SERVICES_CLOUDSYNC) {
- XPCOMUtils.defineLazyModuleGetter(this, "CloudSync",
- "resource://gre/modules/CloudSync.jsm");
-}
+#ifdef MOZ_SERVICES_CLOUDSYNC
+XPCOMUtils.defineLazyModuleGetter(this, "CloudSync",
+ "resource://gre/modules/CloudSync.jsm");
+#endif
var RemoteTabViewer = {
_tabsList: null,
@@ -184,12 +183,16 @@ var RemoteTabViewer = {
}
}
+#ifdef MOZ_SERVICES_CLOUDSYNC
if (CloudSync && CloudSync.ready && CloudSync().tabsReady && CloudSync().tabs.hasRemoteTabs()) {
this._generateCloudSyncTabList()
.then(complete, complete);
} else {
complete();
}
+#else
+ complete();
+#endif
},
_clearTabList: function () {
diff --git a/browser/base/content/tab-content.js b/browser/base/content/tab-content.js
index 05f8e00ab0..7e803796ab 100644
--- a/browser/base/content/tab-content.js
+++ b/browser/base/content/tab-content.js
@@ -147,13 +147,10 @@ var AboutHomeListener = {
if (aData.showRestoreLastSession && !PrivateBrowsingUtils.isContentWindowPrivate(content))
doc.getElementById("launcher").setAttribute("session", "true");
- // Inject search engine and snippets URL.
+ // Inject search engine URL.
let docElt = doc.documentElement;
- // Set snippetsVersion last, which triggers to show the snippets when it's set.
- docElt.setAttribute("snippetsURL", aData.snippetsURL);
if (aData.showKnowYourRights)
docElt.setAttribute("showKnowYourRights", "true");
- docElt.setAttribute("snippetsVersion", aData.snippetsVersion);
},
onPageLoad: function() {
diff --git a/browser/base/content/utilityOverlay.js b/browser/base/content/utilityOverlay.js
index 833369f4d0..6ceaf773ea 100644
--- a/browser/base/content/utilityOverlay.js
+++ b/browser/base/content/utilityOverlay.js
@@ -35,7 +35,7 @@ var gBidiUI = false;
* Determines whether the given url is considered a special URL for new tabs.
*/
function isBlankPageURL(aURL) {
- return aURL == "about:blank" || aURL == BROWSER_NEW_TAB_URL;
+ return aURL == "about:blank" || aURL == "about:newtab" || aURL == "about:logopage";
}
function getBrowserURL()
@@ -197,6 +197,7 @@ function openUILinkIn(url, where, aAllowThirdPartyFixup, aPostData, aReferrerURI
openLinkIn(url, where, params);
}
+/* eslint-disable complexity */
function openLinkIn(url, where, params) {
if (!where || !url)
return;
@@ -212,6 +213,7 @@ function openLinkIn(url, where, params) {
params.referrerPolicy : Ci.nsIHttpChannel.REFERRER_POLICY_DEFAULT);
var aRelatedToCurrent = params.relatedToCurrent;
var aAllowMixedContent = params.allowMixedContent;
+ var aForceAllowDataURI = params.forceAllowDataURI;
var aInBackground = params.inBackground;
var aDisallowInheritPrincipal = params.disallowInheritPrincipal;
var aInitiatingDoc = params.initiatingDoc;
@@ -378,6 +380,9 @@ function openLinkIn(url, where, params) {
if (aIndicateErrorPageLoad) {
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_ERROR_LOAD_CHANGES_RV;
}
+ if (aForceAllowDataURI) {
+ flags |= Ci.nsIWebNavigation.LOAD_FLAGS_FORCE_ALLOW_DATA_URI;
+ }
let {URI_INHERITS_SECURITY_CONTEXT} = Ci.nsIProtocolHandler;
if (aForceAboutBlankViewerInCurrent &&
diff --git a/browser/base/jar.mn b/browser/base/jar.mn
index a65c773385..c582653513 100644
--- a/browser/base/jar.mn
+++ b/browser/base/jar.mn
@@ -67,7 +67,7 @@ browser.jar:
content/browser/aboutTabCrashed.js (content/aboutTabCrashed.js)
content/browser/aboutTabCrashed.xhtml (content/aboutTabCrashed.xhtml)
* content/browser/browser.css (content/browser.css)
- content/browser/browser.js (content/browser.js)
+* content/browser/browser.js (content/browser.js)
* content/browser/browser.xul (content/browser.xul)
content/browser/browser-addons.js (content/browser-addons.js)
content/browser/browser-captivePortal.js (content/browser-captivePortal.js)
@@ -87,7 +87,7 @@ browser.jar:
content/browser/browser-safebrowsing.js (content/browser-safebrowsing.js)
content/browser/browser-sidebar.js (content/browser-sidebar.js)
content/browser/browser-social.js (content/browser-social.js)
- content/browser/browser-syncui.js (content/browser-syncui.js)
+* content/browser/browser-syncui.js (content/browser-syncui.js)
* content/browser/browser-tabPreviews.xml (content/browser-tabPreviews.xml)
#ifdef CAN_DRAW_IN_TITLEBAR
content/browser/browser-tabsintitlebar.js (content/browser-tabsintitlebar.js)
@@ -138,7 +138,7 @@ browser.jar:
content/browser/pageinfo/permissions.js (content/pageinfo/permissions.js)
content/browser/pageinfo/security.js (content/pageinfo/security.js)
content/browser/sync/aboutSyncTabs.xul (content/sync/aboutSyncTabs.xul)
- content/browser/sync/aboutSyncTabs.js (content/sync/aboutSyncTabs.js)
+* content/browser/sync/aboutSyncTabs.js (content/sync/aboutSyncTabs.js)
content/browser/sync/aboutSyncTabs.css (content/sync/aboutSyncTabs.css)
content/browser/sync/aboutSyncTabs-bindings.xml (content/sync/aboutSyncTabs-bindings.xml)
content/browser/sync/setup.xul (content/sync/setup.xul)
diff --git a/browser/branding/official/locales/en-US/brand.dtd b/browser/branding/official/locales/en-US/brand.dtd
index 7bfa07f718..1d2ac791e3 100644
--- a/browser/branding/official/locales/en-US/brand.dtd
+++ b/browser/branding/official/locales/en-US/brand.dtd
@@ -6,4 +6,5 @@
<!ENTITY brandShortName "Basilisk">
<!ENTITY brandFullName "Basilisk">
<!ENTITY vendorShortName "Moonchild">
+<!ENTITY vendorFullName "Moonchild Productions">
<!ENTITY trademarkInfo.part1 "Basilisk, Basilisk Browser and the Basilisk logos are trademarks of Moonchild Productions.">
diff --git a/browser/branding/shared/preferences.inc b/browser/branding/shared/preferences.inc
index 08f6c950b6..90fd3da066 100644
--- a/browser/branding/shared/preferences.inc
+++ b/browser/branding/shared/preferences.inc
@@ -31,3 +31,5 @@ pref("browser.safebrowsing.downloads.remote.enabled", false);
// Disable the UI controls for it as well for Basilisk-official.
pref("browser.safebrowsing.UI.enabled", false);
+//
+pref("general.useragent.appVersionIsBuildID", true);
diff --git a/browser/branding/shared/uaoverrides.inc b/browser/branding/shared/uaoverrides.inc
index 13a89ed7fd..59e4137285 100644
--- a/browser/branding/shared/uaoverrides.inc
+++ b/browser/branding/shared/uaoverrides.inc
@@ -5,7 +5,7 @@
#define GRE_DATE_SLICE Goanna/20170101
#define APP_SLICE Basilisk/@MOZ_APP_VERSION@
-#define GK_VERSION 52.0
+#define GK_VERSION 52.9
#define GK_SLICE Gecko/20100101
#define FX_SLICE Firefox/@GK_VERSION@
@@ -27,6 +27,8 @@ pref("@GUAO_PREF@.accounts.firefox.com", "Mozilla/5.0 (@OS_SLICE@ rv:@GK_VERSION
// The never-ending Facebook debacle...
// UA-Sniffing domains below are pending responses from their operators - temp workaround
+// Daily motion only likes strict Firefox UAs
+pref("@GUAO_PREF@.dailymotion.com","Mozilla/5.0 (@OS_SLICE@ rv:52.0) @GK_SLICE@ Firefox/52.0");
// The following requires native mode. Or it blocks.. "too old firefox", breakage, etc.
@@ -35,4 +37,5 @@ pref("@GUAO_PREF@.accounts.firefox.com", "Mozilla/5.0 (@OS_SLICE@ rv:@GK_VERSION
// UA-sniffing domains that are "app/vendor-specific" and do not like Pale Moon
// The following domains do not like the Goanna slice
-
+pref("@GUAO_PREF@.hitbox.tv","Mozilla/5.0 (@OS_SLICE@ rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@");
+pref("@GUAO_PREF@.yuku.com","Mozilla/5.0 (@OS_SLICE@ rv:@GK_VERSION@) @GK_SLICE@ @FX_SLICE@ @APP_SLICE@");
diff --git a/browser/branding/unofficial/VisualElements_150.png b/browser/branding/unofficial/VisualElements_150.png
index 461961e8d4..eb74e4adc5 100644
--- a/browser/branding/unofficial/VisualElements_150.png
+++ b/browser/branding/unofficial/VisualElements_150.png
Binary files differ
diff --git a/browser/branding/unofficial/VisualElements_70.png b/browser/branding/unofficial/VisualElements_70.png
index aad81f40d0..571532a9ba 100644
--- a/browser/branding/unofficial/VisualElements_70.png
+++ b/browser/branding/unofficial/VisualElements_70.png
Binary files differ
diff --git a/browser/branding/unofficial/basilisk.VisualElementsManifest.xml b/browser/branding/unofficial/basilisk.VisualElementsManifest.xml
deleted file mode 100644
index 7654e0ab75..0000000000
--- a/browser/branding/unofficial/basilisk.VisualElementsManifest.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-<Application xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
- <VisualElements
- ShowNameOnSquare150x150Logo='on'
- Square150x150Logo='browser\VisualElements\VisualElements_150.png'
- Square70x70Logo='browser\VisualElements\VisualElements_70.png'
- ForegroundText='light'
- BackgroundColor='#14171a'/>
-</Application>
diff --git a/browser/branding/unofficial/branding.nsi b/browser/branding/unofficial/branding.nsi
index 34214453f9..77f08a4cb6 100644
--- a/browser/branding/unofficial/branding.nsi
+++ b/browser/branding/unofficial/branding.nsi
@@ -8,19 +8,19 @@
# BrandFullNameInternal is used for some registry and file system values
# instead of BrandFullName and typically should not be modified.
-!define BrandFullNameInternal "Mozilla Developer Preview"
-!define CompanyName "mozilla.org"
-!define URLInfoAbout "https://www.mozilla.org"
-!define HelpLink "https://support.mozilla.org"
+!define BrandFullNameInternal "Serpent"
+!define CompanyName "Moonchild Productions"
+!define URLInfoAbout "http://www.basilisk-browser.org"
+!define HelpLink "https://forum.palemoon.org"
-!define URLStubDownload "http://download.mozilla.org/?os=win&lang=${AB_CD}&product=firefox-latest"
-!define URLManualDownload "https://www.mozilla.org/${AB_CD}/firefox/installer-help/?channel=release&installer_lang=${AB_CD}"
-!define URLSystemRequirements "https://www.mozilla.org/firefox/system-requirements/"
+!define URLStubDownload ""
+!define URLManualDownload ""
+!define URLSystemRequirements ""
!define Channel "unofficial"
# The installer's certificate name and issuer expected by the stub installer
-!define CertNameDownload "Mozilla Corporation"
-!define CertIssuerDownload "DigiCert SHA2 Assured ID Code Signing CA"
+!define CertNameDownload ""
+!define CertIssuerDownload ""
# Dialog units are used so the UI displays correctly with the system's DPI
# settings.
diff --git a/browser/branding/unofficial/configure.sh b/browser/branding/unofficial/configure.sh
index edd3bd3e86..ea4e37e452 100644
--- a/browser/branding/unofficial/configure.sh
+++ b/browser/branding/unofficial/configure.sh
@@ -2,4 +2,4 @@
# 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/.
-MOZ_APP_DISPLAYNAME=Nightly
+MOZ_APP_DISPLAYNAME=Serpent
diff --git a/browser/branding/unofficial/content/about-background.png b/browser/branding/unofficial/content/about-background.png
index 70eb8dafdc..e36211b088 100644
--- a/browser/branding/unofficial/content/about-background.png
+++ b/browser/branding/unofficial/content/about-background.png
Binary files differ
diff --git a/browser/branding/unofficial/content/about-logo.png b/browser/branding/unofficial/content/about-logo.png
index 4c7214ba39..c5a838178a 100644
--- a/browser/branding/unofficial/content/about-logo.png
+++ b/browser/branding/unofficial/content/about-logo.png
Binary files differ
diff --git a/browser/branding/unofficial/content/about-logo@2x.png b/browser/branding/unofficial/content/about-logo@2x.png
index 3526eda54d..48c31564c4 100644
--- a/browser/branding/unofficial/content/about-logo@2x.png
+++ b/browser/branding/unofficial/content/about-logo@2x.png
Binary files differ
diff --git a/browser/branding/unofficial/content/about-wordmark.svg b/browser/branding/unofficial/content/about-wordmark.svg
index 60b278d034..ce7a5c07ba 100644
--- a/browser/branding/unofficial/content/about-wordmark.svg
+++ b/browser/branding/unofficial/content/about-wordmark.svg
@@ -1,22 +1,87 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- 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/. -->
-<svg xmlns="http://www.w3.org/2000/svg" width="132px" height="48px" viewBox="0 0 132 48">
- <path fill="#fff" d="M60.6,14.3l-2.4-2.4C57,12.7,56,13,54.7,13c-3,0-3.8-1.4-7.6-1.4c-5.4,0-9.2,3.4-9.2,8.4
- c0,3.3,2.2,6.1,5.6,7.2c-3.4,1-4.5,2.2-4.5,4.3c0,2.2,1.8,3.6,4.7,3.6h3.8c2.5,0,3.9,0.2,4.9,0.9c0.9,0.6,1.4,1.6,1.4,3
- c0,3.1-2.2,4.4-6,4.4c-2,0-3.8-0.5-5.1-1.2c-0.9-0.6-1.5-1.6-1.5-2.9c0-0.8,0.3-1.7,0.7-2.2l-4.1,0.4c-0.3,1-0.5,1.7-0.5,2.6
- c0,3.5,3,6.4,10.8,6.4c6.1,0,9.9-2.5,9.9-7.9c0-2.1-0.8-3.9-2.7-5.3c-1.5-1.1-3.1-1.4-6-1.4h-4c-1.3,0-2-0.5-2-1.2
- c0-0.8,1.1-1.7,4.5-2.9c1.8,0,3.4-0.3,4.7-1.1c2.3-1.4,3.7-4.1,3.7-6.8c0-1.6-0.5-3-1.5-4.3c0.4,0.2,1.1,0.3,1.7,0.3
- C57.9,15.8,59,15.4,60.6,14.3z M47.1,24.8c-3.1,0-4.8-1.7-4.8-4.8c0-3.5,1.6-5.1,4.7-5.1c3.3,0,4.6,1.5,4.6,4.9
- C51.6,23.1,50.1,24.8,47.1,24.8z M30.7,1.3c-1.7,0-3,1.4-3,3.1s1.4,3,3,3c1.7,0,3.1-1.3,3.1-3C33.7,2.7,32.4,1.3,30.7,1.3z
- M107.7,34.5c-1.1,0-1.4-0.6-1.4-2.5V6.5c0-3.8-0.6-5.9-0.6-5.9l-3.9,0.8c0,0,0.6,1.9,0.6,5.1v26.4c0,1.8,0.4,2.8,1.2,3.5
- c0.7,0.7,1.7,1,2.9,1c1,0,1.5-0.1,2.5-0.5l-0.8-2.5C108.2,34.4,107.8,34.5,107.7,34.5z M74.7,11.6c-3.2,0-6.1,1.8-8.3,3.9
- c0,0,0.2-1.8,0.2-3.4V6.3c0-3.8-0.7-5.9-0.7-5.9l-3.9,0.7c0,0,0.7,1.9,0.7,5.1V37h3.9V19.3c2.1-2.7,4.9-4.2,7.2-4.2
- c1.3,0,2.3,0.4,2.9,1c0.7,0.7,0.9,1.8,0.9,3.7V37h3.8V19.1c0-1.8-0.1-2.6-0.4-3.6C80.4,13.2,77.7,11.6,74.7,11.6z M127.4,12.1
- l-4.9,16.4c-0.6,2-1.6,5.2-1.6,5.2s-0.7-3.9-1.5-6.2l-5.1-16.2l-3.9,1.3l5.4,15.6c0.8,2.5,2.2,7.4,2.5,9l1.6-0.3
- c-1.3,5.1-2.5,6.7-5.7,7.6l1.2,2.7c4.4-1,6.4-4.3,8-9.3l8.6-25.8H127.4z M96.9,15l1.2-2.9h-6.2c0-3.3,0.5-7.2,0.5-7.2l-4.1,0.9
- c0,0-0.4,3.9-0.4,6.3h-3.2V15h3.2v17.1c0,2.5,0.7,4.1,2.4,5c0.9,0.4,1.9,0.7,3.3,0.7c1.8,0,3.1-0.4,4.4-1l-0.6-2.5
- c-0.7,0.3-1.3,0.5-2.4,0.5c-2.4,0-3.2-0.9-3.2-3.7V15H96.9z M28.6,37h4.1V11.5l-4.1,0.6V37z M18.9,21.3c0,5,0.4,10.5,0.4,10.5
- s-1.4-3.8-3.2-7.2L4.8,2.7H0V37h4.2L4,17.1c0-4.5-0.4-9.3-0.4-9.3s1.7,4.1,3.9,8.2l11,21h4.3V2.7h-4L18.9,21.3z"/>
+
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="132px"
+ height="48px"
+ viewBox="0 0 132 48"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.91 r13725"
+ sodipodi:docname="about-wordmark.svg">
+ <metadata
+ id="metadata10">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <defs
+ id="defs8" />
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1215"
+ inkscape:window-height="778"
+ id="namedview6"
+ showgrid="false"
+ inkscape:zoom="2.4090909"
+ inkscape:cx="91.154186"
+ inkscape:cy="24"
+ inkscape:window-x="0"
+ inkscape:window-y="0"
+ inkscape:window-maximized="0"
+ inkscape:current-layer="svg2" />
+ <g
+ transform="scale(0.83939803,1.1913299)"
+ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:42.56122971px;line-height:125%;font-family:'Levenim MT';-inkscape-font-specification:'Levenim MT';letter-spacing:0px;word-spacing:0px;fill:#a8e6db;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ id="text4138">
+ <path
+ d="m 18.521413,24.115665 q 0,3.470569 -2.618513,5.881264 -2.535386,2.348349 -6.0475185,2.348349 -5.6942271,0 -9.22714164,-6.463156 L 3.2259712,24.323483 q 2.7432042,5.04999 6.3384644,5.04999 3.4082234,0 4.9460804,-2.639295 0.706583,-1.205347 0.706583,-2.556167 0,-1.537857 -1.039093,-3.013369 Q 12.827186,19.23193 9.1487985,16.488726 5.3872836,13.703958 4.1819363,12.082974 2.560952,9.9008792 2.560952,7.4070572 q 0,-4.2394975 3.6576056,-6.2345551 1.7248936,-0.93518331 3.761515,-0.93518331 4.3641884,0 8.0217944,5.00842591 L 15.508045,7.1368931 Q 14.115661,5.3080903 13.138914,4.5391618 11.684184,3.3961601 9.917727,3.3961601 q -1.7664573,0 -2.9510228,1.0598743 -1.246911,1.0806563 -1.246911,2.8263317 0,2.0574032 1.9327121,3.9693339 0.56111,0.540328 3.9485517,3.054932 3.117277,2.306785 4.655134,4.15637 2.265222,2.763986 2.265222,5.652663 z"
+ style=""
+ id="path4143" />
+ <path
+ d="m 46.743165,20.499623 -20.324649,0 q 0.08313,3.803079 2.369131,6.338464 2.410694,2.660077 6.151427,2.660077 3.616042,0 6.130646,-2.202876 1.143002,-0.997529 2.47304,-3.221187 l 2.452259,1.288475 q -2.286004,4.468098 -6.338465,6.026737 -1.974275,0.768928 -4.468097,0.768928 -5.091554,0 -8.437432,-3.36666 -3.325096,-3.366659 -3.325096,-8.458213 0,-4.301843 2.639295,-7.668503 3.345878,-4.2810608 8.956978,-4.2810608 5.777354,0 9.227141,4.3849708 2.452259,3.117277 2.493822,7.730848 z M 43.54276,17.985019 q -1.080656,-4.301843 -4.634352,-5.964391 -1.828803,-0.852056 -3.844643,-0.852056 -3.325096,0 -5.715008,2.140531 -1.745676,1.558639 -2.639295,4.675916 l 16.833298,0 z"
+ style=""
+ id="path4145" />
+ <path
+ d="m 62.516592,9.1527326 -1.517075,2.4522584 q -0.914401,-0.394855 -1.537857,-0.394855 -3.491351,0 -4.862953,4.904517 -0.540328,1.932712 -0.540328,7.813975 l 0,7.647721 -2.971805,0 0,-22.610653 2.971805,0 0,3.304314 q 2.639295,-3.8862058 5.881264,-3.8862058 1.205347,0 2.576949,0.7689284 z"
+ style=""
+ id="path4147" />
+ <path
+ d="m 88.577029,20.208677 q 0,4.94608 -3.325096,8.416649 -3.366659,3.532915 -8.271176,3.532915 -5.382499,0 -9.060887,-4.468098 l 0,12.157383 -2.888677,0 0,-30.88183 2.888677,0 0,4.15637 q 3.449787,-4.7382618 8.977759,-4.7382618 4.883735,0 8.271177,3.4705688 3.408223,3.470569 3.408223,8.354304 z m -2.930241,0.103909 q 0,-2.410694 -1.205347,-4.572007 -1.205347,-2.161312 -3.283532,-3.345878 -2.057403,-1.205347 -4.48888,-1.205347 -3.865424,0 -6.421592,2.660077 -2.535385,2.660077 -2.535385,6.546283 0,5.403281 4.468097,7.897103 2.140531,1.205347 4.530444,1.205347 2.410694,0 4.488879,-1.246911 2.01584,-1.226129 3.221187,-3.387441 1.226129,-2.161313 1.226129,-4.551226 z"
+ style=""
+ id="path4149" />
+ <path
+ d="m 116.23767,20.499623 -20.324647,0 q 0.08313,3.803079 2.36913,6.338464 2.410697,2.660077 6.151427,2.660077 3.61604,0 6.13065,-2.202876 1.143,-0.997529 2.47304,-3.221187 l 2.45226,1.288475 q -2.28601,4.468098 -6.33847,6.026737 -1.97427,0.768928 -4.4681,0.768928 -5.09155,0 -8.437428,-3.36666 -3.325096,-3.366659 -3.325096,-8.458213 0,-4.301843 2.639295,-7.668503 3.345878,-4.2810608 8.956979,-4.2810608 5.77735,0 9.22714,4.3849708 2.45226,3.117277 2.49382,7.730848 z m -3.2004,-2.514604 q -1.08066,-4.301843 -4.63436,-5.964391 -1.8288,-0.852056 -3.84464,-0.852056 -3.32509,0 -5.715007,2.140531 -1.745675,1.558639 -2.639295,4.675916 l 16.833302,0 z"
+ style=""
+ id="path4151" />
+ <path
+ d="m 141.4045,31.576349 -2.88868,0 0,-10.78578 q 0,-3.823861 -0.33251,-5.216245 -1.08066,-4.509661 -5.69423,-4.509661 -2.63929,0 -4.73826,1.745675 -2.07819,1.724894 -2.7432,4.322625 -0.41564,1.641766 -0.41564,6.151428 l 0,8.291958 -2.90946,0 0,-22.610653 2.90946,0 0,4.052461 q 3.47057,-4.6343528 8.47899,-4.6343528 2.47304,0 4.44732,1.2676928 1.99506,1.246911 2.93024,3.470569 0.95597,2.202876 0.95597,6.816447 l 0,11.637836 z"
+ style=""
+ id="path4153" />
+ <path
+ d="m 157.69747,11.459518 -4.61357,0 0,20.116831 -2.93024,0 0,-20.116831 -3.96934,0 0,-2.493822 3.96934,0 0,-8.3958676 2.93024,0 0,8.3958676 4.61357,0 0,2.493822 z"
+ style=""
+ id="path4155" />
+ </g>
</svg>
diff --git a/browser/branding/unofficial/content/about.png b/browser/branding/unofficial/content/about.png
index 231449344a..e323c8df5c 100644
--- a/browser/branding/unofficial/content/about.png
+++ b/browser/branding/unofficial/content/about.png
Binary files differ
diff --git a/browser/branding/unofficial/content/icon48.png b/browser/branding/unofficial/content/icon48.png
index 5fc7861e53..16e022a647 100644
--- a/browser/branding/unofficial/content/icon48.png
+++ b/browser/branding/unofficial/content/icon48.png
Binary files differ
diff --git a/browser/branding/unofficial/content/icon64.png b/browser/branding/unofficial/content/icon64.png
index 83f7016bcb..9860917e3e 100644
--- a/browser/branding/unofficial/content/icon64.png
+++ b/browser/branding/unofficial/content/icon64.png
Binary files differ
diff --git a/browser/branding/unofficial/default16.png b/browser/branding/unofficial/default16.png
index d285a90b45..67ef39df85 100644
--- a/browser/branding/unofficial/default16.png
+++ b/browser/branding/unofficial/default16.png
Binary files differ
diff --git a/browser/branding/unofficial/default32.png b/browser/branding/unofficial/default32.png
index 95adf24973..2f709e6b2c 100644
--- a/browser/branding/unofficial/default32.png
+++ b/browser/branding/unofficial/default32.png
Binary files differ
diff --git a/browser/branding/unofficial/default48.png b/browser/branding/unofficial/default48.png
index d38185f542..02a1e14c16 100644
--- a/browser/branding/unofficial/default48.png
+++ b/browser/branding/unofficial/default48.png
Binary files differ
diff --git a/browser/branding/unofficial/firefox.icns b/browser/branding/unofficial/firefox.icns
index 0c6941acfd..2c613634b6 100644
--- a/browser/branding/unofficial/firefox.icns
+++ b/browser/branding/unofficial/firefox.icns
Binary files differ
diff --git a/browser/branding/unofficial/firefox.ico b/browser/branding/unofficial/firefox.ico
index 5217a6c0b4..0c7acb61b3 100644
--- a/browser/branding/unofficial/firefox.ico
+++ b/browser/branding/unofficial/firefox.ico
Binary files differ
diff --git a/browser/branding/unofficial/locales/en-US/brand.dtd b/browser/branding/unofficial/locales/en-US/brand.dtd
index cf4596ae03..17c2436067 100644
--- a/browser/branding/unofficial/locales/en-US/brand.dtd
+++ b/browser/branding/unofficial/locales/en-US/brand.dtd
@@ -2,8 +2,9 @@
- 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/. -->
-<!ENTITY brandShorterName "Nightly">
-<!ENTITY brandShortName "Nightly">
-<!ENTITY brandFullName "Nightly">
-<!ENTITY vendorShortName "Mozilla">
+<!ENTITY brandShorterName "Serpent">
+<!ENTITY brandShortName "Serpent">
+<!ENTITY brandFullName "Serpent">
+<!ENTITY vendorShortName "Moonchild">
+<!ENTITY vendorFullName "Moonchild Productions">
<!ENTITY trademarkInfo.part1 " ">
diff --git a/browser/branding/unofficial/locales/en-US/brand.properties b/browser/branding/unofficial/locales/en-US/brand.properties
index 8cd2c2ec98..80349f0e31 100644
--- a/browser/branding/unofficial/locales/en-US/brand.properties
+++ b/browser/branding/unofficial/locales/en-US/brand.properties
@@ -2,9 +2,10 @@
# 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/.
-brandShorterName=Nightly
-brandShortName=Nightly
-brandFullName=Nightly
-vendorShortName=Mozilla
+brandShorterName=Serpent
+brandShortName=Serpent
+brandFullName=Serpent
+vendorShortName=Moonchild
+vendorFullName=Moonchild Productions
syncBrandShortName=Sync
diff --git a/browser/branding/unofficial/mozicon128.png b/browser/branding/unofficial/mozicon128.png
index 471cf46457..739b61084b 100644
--- a/browser/branding/unofficial/mozicon128.png
+++ b/browser/branding/unofficial/mozicon128.png
Binary files differ
diff --git a/browser/branding/unofficial/serpent.VisualElementsManifest.xml b/browser/branding/unofficial/serpent.VisualElementsManifest.xml
new file mode 100644
index 0000000000..5046ee7dae
--- /dev/null
+++ b/browser/branding/unofficial/serpent.VisualElementsManifest.xml
@@ -0,0 +1,8 @@
+<Application xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
+ <VisualElements
+ ShowNameOnSquare150x150Logo='on'
+ Square150x150Logo='browser\VisualElements\VisualElements_150.png'
+ Square70x70Logo='browser\VisualElements\VisualElements_70.png'
+ ForegroundText='light'
+ BackgroundColor='#304D7E'/>
+</Application>
diff --git a/browser/components/about/AboutRedirector.cpp b/browser/components/about/AboutRedirector.cpp
index a09932d950..717ae9c48a 100644
--- a/browser/components/about/AboutRedirector.cpp
+++ b/browser/components/about/AboutRedirector.cpp
@@ -35,75 +35,117 @@ struct RedirEntry {
URI_SAFE_FOR_UNTRUSTED_CONTENT.
*/
static RedirEntry kRedirMap[] = {
- { "blocked", "chrome://browser/content/blockedSite.xhtml",
+ {
+ "basilisk", "chrome://global/content/memoriam.xhtml",
+ nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
+ nsIAboutModule::HIDE_FROM_ABOUTABOUT
+ },
+ {
+ "blocked", "chrome://browser/content/blockedSite.xhtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::URI_CAN_LOAD_IN_CHILD |
nsIAboutModule::ALLOW_SCRIPT |
- nsIAboutModule::HIDE_FROM_ABOUTABOUT },
- { "certerror", "chrome://browser/content/aboutNetError.xhtml",
+ nsIAboutModule::HIDE_FROM_ABOUTABOUT
+ },
+ {
+ "certerror", "chrome://browser/content/aboutNetError.xhtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::URI_CAN_LOAD_IN_CHILD |
nsIAboutModule::ALLOW_SCRIPT |
- nsIAboutModule::HIDE_FROM_ABOUTABOUT },
- { "socialerror", "chrome://browser/content/aboutSocialError.xhtml",
+ nsIAboutModule::HIDE_FROM_ABOUTABOUT
+ },
+ {
+ "socialerror", "chrome://browser/content/aboutSocialError.xhtml",
nsIAboutModule::ALLOW_SCRIPT |
- nsIAboutModule::HIDE_FROM_ABOUTABOUT },
- { "providerdirectory", "chrome://browser/content/aboutProviderDirectory.xhtml",
+ nsIAboutModule::HIDE_FROM_ABOUTABOUT
+ },
+ {
+ "providerdirectory", "chrome://browser/content/aboutProviderDirectory.xhtml",
nsIAboutModule::ALLOW_SCRIPT |
- nsIAboutModule::HIDE_FROM_ABOUTABOUT },
- { "tabcrashed", "chrome://browser/content/aboutTabCrashed.xhtml",
+ nsIAboutModule::HIDE_FROM_ABOUTABOUT
+ },
+ {
+ "tabcrashed", "chrome://browser/content/aboutTabCrashed.xhtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::ALLOW_SCRIPT |
- nsIAboutModule::HIDE_FROM_ABOUTABOUT },
- { "feeds", "chrome://browser/content/feeds/subscribe.xhtml",
+ nsIAboutModule::HIDE_FROM_ABOUTABOUT
+ },
+ {
+ "feeds", "chrome://browser/content/feeds/subscribe.xhtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::ALLOW_SCRIPT |
- nsIAboutModule::HIDE_FROM_ABOUTABOUT },
- { "privatebrowsing", "chrome://browser/content/aboutPrivateBrowsing.xhtml",
+ nsIAboutModule::HIDE_FROM_ABOUTABOUT
+ },
+ {
+ "privatebrowsing", "chrome://browser/content/aboutPrivateBrowsing.xhtml",
nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
- nsIAboutModule::ALLOW_SCRIPT },
- { "rights",
- "chrome://global/content/aboutRights.xhtml",
+ nsIAboutModule::ALLOW_SCRIPT
+ },
+ {
+ "rights", "chrome://global/content/aboutRights.xhtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::MAKE_LINKABLE |
- nsIAboutModule::ALLOW_SCRIPT },
- { "robots", "chrome://browser/content/aboutRobots.xhtml",
+ nsIAboutModule::ALLOW_SCRIPT
+ },
+ {
+ "robots", "chrome://browser/content/aboutRobots.xhtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
- nsIAboutModule::ALLOW_SCRIPT },
- { "searchreset", "chrome://browser/content/search/searchReset.xhtml",
+ nsIAboutModule::ALLOW_SCRIPT
+ },
+ {
+ "searchreset", "chrome://browser/content/search/searchReset.xhtml",
nsIAboutModule::ALLOW_SCRIPT |
- nsIAboutModule::HIDE_FROM_ABOUTABOUT },
- { "sessionrestore", "chrome://browser/content/aboutSessionRestore.xhtml",
- nsIAboutModule::ALLOW_SCRIPT },
- { "welcomeback", "chrome://browser/content/aboutWelcomeBack.xhtml",
- nsIAboutModule::ALLOW_SCRIPT },
- { "sync-tabs", "chrome://browser/content/sync/aboutSyncTabs.xul",
- nsIAboutModule::ALLOW_SCRIPT },
- // Linkable because of indexeddb use (bug 1228118)
+ nsIAboutModule::HIDE_FROM_ABOUTABOUT
+ },
+ {
+ "sessionrestore", "chrome://browser/content/aboutSessionRestore.xhtml",
+ nsIAboutModule::ALLOW_SCRIPT
+ },
+ {
+ "welcomeback", "chrome://browser/content/aboutWelcomeBack.xhtml",
+ nsIAboutModule::ALLOW_SCRIPT
+ },
+ {
+ "sync-tabs", "chrome://browser/content/sync/aboutSyncTabs.xul",
+ nsIAboutModule::ALLOW_SCRIPT
+ },
{ "home", "chrome://browser/content/abouthome/aboutHome.xhtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
nsIAboutModule::ALLOW_SCRIPT |
+ // Linkable because of indexeddb use (bug 1228118)
nsIAboutModule::MAKE_LINKABLE |
nsIAboutModule::ENABLE_INDEXED_DB },
- // the newtab's actual URL will be determined when the channel is created
- { "newtab", "about:blank",
- nsIAboutModule::ALLOW_SCRIPT },
- { "preferences", "chrome://browser/content/preferences/in-content/preferences.xul",
- nsIAboutModule::ALLOW_SCRIPT },
- { "downloads", "chrome://browser/content/downloads/contentAreaDownloadsView.xul",
- nsIAboutModule::ALLOW_SCRIPT },
+ {
+ // the newtab's actual URL will be determined when the channel is created
+ "newtab", "about:blank",
+ nsIAboutModule::ALLOW_SCRIPT
+ },
+ {
+ "preferences", "chrome://browser/content/preferences/in-content/preferences.xul",
+ nsIAboutModule::ALLOW_SCRIPT
+ },
+ {
+ "downloads", "chrome://browser/content/downloads/contentAreaDownloadsView.xul",
+ nsIAboutModule::ALLOW_SCRIPT
+ },
#ifdef MOZ_SERVICES_HEALTHREPORT
- { "healthreport", "chrome://browser/content/abouthealthreport/abouthealth.xhtml",
- nsIAboutModule::ALLOW_SCRIPT },
+ {
+ "healthreport", "chrome://browser/content/abouthealthreport/abouthealth.xhtml",
+ nsIAboutModule::ALLOW_SCRIPT
+ },
#endif
- { "accounts", "chrome://browser/content/aboutaccounts/aboutaccounts.xhtml",
- nsIAboutModule::ALLOW_SCRIPT },
- { "reader", "chrome://global/content/reader/aboutReader.html",
+ {
+ "accounts", "chrome://browser/content/aboutaccounts/aboutaccounts.xhtml",
+ nsIAboutModule::ALLOW_SCRIPT
+ },
+ {
+ "reader", "chrome://global/content/reader/aboutReader.html",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
nsIAboutModule::ALLOW_SCRIPT |
nsIAboutModule::URI_MUST_LOAD_IN_CHILD |
- nsIAboutModule::HIDE_FROM_ABOUTABOUT },
+ nsIAboutModule::HIDE_FROM_ABOUTABOUT
+ },
};
static const int kRedirTotal = ArrayLength(kRedirMap);
diff --git a/browser/components/build/nsModule.cpp b/browser/components/build/nsModule.cpp
index f85d8812c0..1fad0ce68d 100644
--- a/browser/components/build/nsModule.cpp
+++ b/browser/components/build/nsModule.cpp
@@ -85,6 +85,7 @@ static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
{ NS_SHELLSERVICE_CONTRACTID, &kNS_SHELLSERVICE_CID },
#endif
{ NS_FEEDSNIFFER_CONTRACTID, &kNS_FEEDSNIFFER_CID },
+ { NS_ABOUT_MODULE_CONTRACTID_PREFIX "basilisk", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "blocked", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "certerror", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "socialerror", &kNS_BROWSER_ABOUT_REDIRECTOR_CID },
diff --git a/browser/components/migration/FirefoxProfileMigrator.js b/browser/components/migration/FirefoxProfileMigrator.js
index 60ffcf627c..2714cdbcd5 100644
--- a/browser/components/migration/FirefoxProfileMigrator.js
+++ b/browser/components/migration/FirefoxProfileMigrator.js
@@ -7,7 +7,7 @@
"use strict";
/*
- * Migrates from a Firefox profile in a lossy manner in order to clean up a
+ * Migrates from a Basilisk profile in a lossy manner in order to clean up a
* user's profile. Data is only migrated where the benefits outweigh the
* potential problems caused by importing undesired/invalid configurations
* from the source profile.
diff --git a/browser/components/migration/MigrationUtils.jsm b/browser/components/migration/MigrationUtils.jsm
index 104efe005b..e133ec5203 100644
--- a/browser/components/migration/MigrationUtils.jsm
+++ b/browser/components/migration/MigrationUtils.jsm
@@ -726,6 +726,7 @@ this.MigrationUtils = Object.freeze({
"Internet Explorer": "ie",
"Microsoft Edge": "edge",
"Safari": "safari",
+ "Basilisk": "firefox",
"Firefox": "firefox",
"Nightly": "firefox",
"Google Chrome": "chrome", // Windows, Linux
diff --git a/browser/components/moz.build b/browser/components/moz.build
index 0393b6e926..a495802009 100644
--- a/browser/components/moz.build
+++ b/browser/components/moz.build
@@ -37,11 +37,8 @@ XPIDL_SOURCES += [
XPIDL_MODULE = 'browsercompsbase'
-EXTRA_PP_COMPONENTS += [
- 'BrowserComponents.manifest',
-]
-
EXTRA_COMPONENTS += [
+ 'BrowserComponents.manifest',
'nsBrowserContentHandler.js',
'nsBrowserGlue.js',
]
diff --git a/browser/components/nsBrowserContentHandler.js b/browser/components/nsBrowserContentHandler.js
index b366c3f81a..74144fc1b3 100644
--- a/browser/components/nsBrowserContentHandler.js
+++ b/browser/components/nsBrowserContentHandler.js
@@ -558,7 +558,7 @@ nsBrowserContentHandler.prototype = {
if (overridePage && startPage && !willRestoreSession && !skipStartPage)
return overridePage + "|" + startPage;
- return overridePage || startPage || "about:blank";
+ return overridePage || startPage || "about:blank" || "about:logopage";
},
get startPage() {
diff --git a/browser/components/nsBrowserGlue.js b/browser/components/nsBrowserGlue.js
index f97c173a00..448bb910dc 100644
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -70,15 +70,6 @@ XPCOMUtils.defineLazyServiceGetter(this, "AlertsService", "@mozilla.org/alerts-s
["webrtcUI", "resource:///modules/webrtcUI.jsm"],
].forEach(([name, resource]) => XPCOMUtils.defineLazyModuleGetter(this, name, resource));
-if (AppConstants.MOZ_CRASHREPORTER) {
- XPCOMUtils.defineLazyModuleGetter(this, "PluginCrashReporter",
- "resource:///modules/ContentCrashHandlers.jsm");
- XPCOMUtils.defineLazyModuleGetter(this, "UnsubmittedCrashHandler",
- "resource:///modules/ContentCrashHandlers.jsm");
- XPCOMUtils.defineLazyModuleGetter(this, "CrashSubmit",
- "resource://gre/modules/CrashSubmit.jsm");
-}
-
XPCOMUtils.defineLazyGetter(this, "gBrandBundle", function() {
return Services.strings.createBundle('chrome://branding/locale/brand.properties');
});
@@ -710,10 +701,6 @@ BrowserGlue.prototype = {
}
TabCrashHandler.init();
- if (AppConstants.MOZ_CRASHREPORTER) {
- PluginCrashReporter.init();
- UnsubmittedCrashHandler.init();
- }
Services.obs.notifyObservers(null, "browser-ui-startup-complete", "");
},
diff --git a/browser/components/places/content/controller.js b/browser/components/places/content/controller.js
index 0d66fbcaf1..ebdab60f4c 100644
--- a/browser/components/places/content/controller.js
+++ b/browser/components/places/content/controller.js
@@ -253,7 +253,8 @@ PlacesController.prototype = {
}
else
host = NetUtil.newURI(this._view.selectedNode.uri).host;
- ForgetAboutSite.removeDataFromDomain(host);
+ ForgetAboutSite.removeDataFromDomain(host)
+ .catch(Components.utils.reportError);
break;
case "cmd_selectAll":
this.selectAll();
diff --git a/browser/components/places/content/editBookmarkOverlay.js b/browser/components/places/content/editBookmarkOverlay.js
index e26cfb1387..d59f5c7643 100644
--- a/browser/components/places/content/editBookmarkOverlay.js
+++ b/browser/components/places/content/editBookmarkOverlay.js
@@ -57,12 +57,14 @@ var gEditItemOverlay = {
}
}
let focusedElement = aInitInfo.focusedElement;
+ let onPanelReady = aInitInfo.onPanelReady;
return this._paneInfo = { itemId, itemGuid, isItem,
isURI, uri, title,
isBookmark, isFolderShortcut, isParentReadOnly,
bulkTagging, uris,
- visibleRows, postData, isTag, focusedElement };
+ visibleRows, postData, isTag, focusedElement,
+ onPanelReady };
},
get initialized() {
@@ -214,7 +216,8 @@ var gEditItemOverlay = {
let { itemId, isItem, isURI,
isBookmark, bulkTagging, uris,
- visibleRows, focusedElement } = this._setPaneInfo(aInfo);
+ visibleRows, focusedElement,
+ onPanelReady } = this._setPaneInfo(aInfo);
let showOrCollapse =
(rowId, isAppropriateForInput, nameInHiddenRows = null) => {
@@ -286,22 +289,34 @@ var gEditItemOverlay = {
this._observersAdded = true;
}
- // The focusedElement possible values are:
- // * preferred: focus the field that the user touched first the last
- // time the pane was shown (either namePicker or tagsField)
- // * first: focus the first non collapsed textbox
- // Note: since all controls are collapsed by default, we don't get the
- // default XUL dialog behavior, that selects the first control, so we set
- // the focus explicitly.
- let elt;
- if (focusedElement === "preferred") {
- elt = this._element(gPrefService.getCharPref("browser.bookmarks.editDialog.firstEditField"));
- } else if (focusedElement === "first") {
- elt = document.querySelector("textbox:not([collapsed=true])");
- }
- if (elt) {
- elt.focus();
- elt.select();
+ let focusElement = () => {
+ // The focusedElement possible values are:
+ // * preferred: focus the field that the user touched first the last
+ // time the pane was shown (either namePicker or tagsField)
+ // * first: focus the first non collapsed textbox
+ // Note: since all controls are collapsed by default, we don't get the
+ // default XUL dialog behavior, that selects the first control, so we set
+ // the focus explicitly.
+ // Note: If focusedElement === "preferred", this file expects gPrefService
+ // to be defined in the global scope.
+ let elt;
+ if (focusedElement === "preferred") {
+ /* eslint-disable no-undef */
+ elt = this._element(gPrefService.getCharPref("browser.bookmarks.editDialog.firstEditField"));
+ /* eslint-enable no-undef */
+ } else if (focusedElement === "first") {
+ elt = document.querySelector("textbox:not([collapsed=true])");
+ }
+ if (elt) {
+ elt.focus();
+ elt.select();
+ }
+ };
+
+ if (onPanelReady) {
+ onPanelReady(focusElement);
+ } else {
+ focusElement();
}
},
@@ -335,10 +350,23 @@ var gEditItemOverlay = {
if (aElement.value != aValue) {
aElement.value = aValue;
- // Clear the undo stack
- let editor = aElement.editor;
- if (editor)
- editor.transactionManager.clear();
+ // Clear the editor's undo stack
+ let transactionManager;
+ try {
+ transactionManager = aElement.editor.transactionManager;
+ } catch (e) {
+ // When retrieving the transaction manager, editor may be null resulting
+ // in a TypeError. Additionally, the transaction manager may not
+ // exist yet, which causes access to it to throw NS_ERROR_FAILURE.
+ // In either event, the transaction manager doesn't exist it, so we
+ // don't need to worry about clearing it.
+ if (!(e instanceof TypeError) && e.result != Cr.NS_ERROR_FAILURE) {
+ throw e;
+ }
+ }
+ if (transactionManager) {
+ transactionManager.clear();
+ }
}
},
diff --git a/browser/components/preferences/cookies.js b/browser/components/preferences/cookies.js
index 1042642da9..921eee4c06 100644
--- a/browser/components/preferences/cookies.js
+++ b/browser/components/preferences/cookies.js
@@ -30,6 +30,11 @@ var gCookiesWindow = {
this._bundle = document.getElementById("bundlePreferences");
this._tree = document.getElementById("cookiesList");
+ let removeAllCookies = document.getElementById("removeAllCookies");
+ removeAllCookies.setAttribute("accesskey", this._bundle.getString("removeAllCookies.accesskey"));
+ let removeSelectedCookies = document.getElementById("removeSelectedCookies");
+ removeSelectedCookies.setAttribute("accesskey", this._bundle.getString("removeSelectedCookies.accesskey"));
+
this._populateList(true);
document.getElementById("filter").focus();
@@ -582,7 +587,7 @@ var gCookiesWindow = {
}
}
- let buttonLabel = this._bundle.getString("removeSelectedCookies");
+ let buttonLabel = this._bundle.getString("removeSelectedCookies.label");
let removeSelectedCookies = document.getElementById("removeSelectedCookies");
removeSelectedCookies.label = PluralForm.get(selectedCookieCount, buttonLabel)
.replace("#1", selectedCookieCount);
@@ -894,7 +899,17 @@ var gCookiesWindow = {
},
_updateRemoveAllButton: function gCookiesWindow__updateRemoveAllButton() {
- document.getElementById("removeAllCookies").disabled = this._view._rowCount == 0;
+ let removeAllCookies = document.getElementById("removeAllCookies");
+ removeAllCookies.disabled = this._view._rowCount == 0;
+
+ let labelStringID = "removeAllCookies.label";
+ let accessKeyStringID = "removeAllCookies.accesskey";
+ if (this._view._filtered) {
+ labelStringID = "removeAllShownCookies.label";
+ accessKeyStringID = "removeAllShownCookies.accesskey";
+ }
+ removeAllCookies.setAttribute("label", this._bundle.getString(labelStringID));
+ removeAllCookies.setAttribute("accesskey", this._bundle.getString(accessKeyStringID));
},
filter: function () {
diff --git a/browser/components/preferences/cookies.xul b/browser/components/preferences/cookies.xul
index cda6ea2206..bd60d9346a 100644
--- a/browser/components/preferences/cookies.xul
+++ b/browser/components/preferences/cookies.xul
@@ -96,10 +96,8 @@
<hbox align="end">
<hbox class="actionButtons" flex="1">
<button id="removeSelectedCookies" disabled="true" icon="clear"
- accesskey="&button.removeSelectedCookies.accesskey;"
oncommand="gCookiesWindow.deleteCookie();"/>
<button id="removeAllCookies" disabled="true" icon="clear"
- label="&button.removeAllCookies.label;" accesskey="&button.removeAllCookies.accesskey;"
oncommand="gCookiesWindow.deleteAllCookies();"/>
<spacer flex="1"/>
#ifndef XP_MACOSX
diff --git a/browser/components/preferences/in-content/advanced.js b/browser/components/preferences/in-content/advanced.js
index 448a21dae9..5f9458eeea 100644
--- a/browser/components/preferences/in-content/advanced.js
+++ b/browser/components/preferences/in-content/advanced.js
@@ -40,9 +40,6 @@ var gAdvancedPane = {
this.updateReadPrefs();
}
this.updateOfflineApps();
- if (AppConstants.MOZ_CRASHREPORTER) {
- this.initSubmitCrashes();
- }
this.initTelemetry();
if (AppConstants.MOZ_TELEMETRY_REPORTING) {
this.initSubmitHealthReport();
diff --git a/browser/components/preferences/in-content/advanced.xul b/browser/components/preferences/in-content/advanced.xul
index facaaeaa95..4973f8e091 100644
--- a/browser/components/preferences/in-content/advanced.xul
+++ b/browser/components/preferences/in-content/advanced.xul
@@ -54,13 +54,6 @@
type="bool"/>
#endif
- <!-- Data Choices tab -->
-#ifdef MOZ_CRASHREPORTER
- <preference id="browser.crashReports.unsubmittedCheck.autoSubmit2"
- name="browser.crashReports.unsubmittedCheck.autoSubmit2"
- type="bool"/>
-#endif
-
<!-- Network tab -->
<preference id="browser.cache.disk.capacity"
name="browser.cache.disk.capacity"
@@ -233,22 +226,6 @@
</vbox>
</groupbox>
#endif
-#ifdef MOZ_CRASHREPORTER
- <groupbox>
- <caption>
- <checkbox id="automaticallySubmitCrashesBox"
- preference="browser.crashReports.unsubmittedCheck.autoSubmit2"
- label="&alwaysSubmitCrashReports.label;"
- accesskey="&alwaysSubmitCrashReports.accesskey;"/>
- </caption>
- <hbox class="indent">
- <label flex="1">&crashReporterDesc2.label;</label>
- <spacer flex="10"/>
- <label id="crashReporterLearnMore"
- class="text-link">&crashReporterLearnMore.label;</label>
- </hbox>
- </groupbox>
-#endif
</tabpanel>
#endif
diff --git a/browser/components/preferences/in-content/security.js b/browser/components/preferences/in-content/security.js
index a8ad28c7ea..0d7af39a3d 100644
--- a/browser/components/preferences/in-content/security.js
+++ b/browser/components/preferences/in-content/security.js
@@ -168,12 +168,24 @@ var gSecurityPane = {
let safeBrowsingPhishingPref = document.getElementById("browser.safebrowsing.phishing.enabled");
let safeBrowsingMalwarePref = document.getElementById("browser.safebrowsing.malware.enabled");
+ let safeBrowsingUIPref = document.getElementById("browser.safebrowsing.UI.enabled");
+ let safeBrowsingUISep = document.getElementById("safeBrowsingUISep");
+ let safeBrowsingUIGroup = document.getElementById("safeBrowsingUIGroup");
+
let blockDownloadsPref = document.getElementById("browser.safebrowsing.downloads.enabled");
let malwareTable = document.getElementById("urlclassifier.malwareTable");
let blockUnwantedPref = document.getElementById("browser.safebrowsing.downloads.remote.block_potentially_unwanted");
let blockUncommonPref = document.getElementById("browser.safebrowsing.downloads.remote.block_uncommon");
+ if (safeBrowsingUIPref.value == false) {
+ safeBrowsingUISep.setAttribute("hidden", "true");
+ safeBrowsingUIGroup.setAttribute("hidden", "true");
+ } else {
+ safeBrowsingUISep.removeAttribute("hidden");
+ safeBrowsingUIGroup.removeAttribute("hidden");
+ }
+
enableSafeBrowsing.addEventListener("command", function() {
safeBrowsingPhishingPref.value = enableSafeBrowsing.checked;
safeBrowsingMalwarePref.value = enableSafeBrowsing.checked;
diff --git a/browser/components/preferences/in-content/security.xul b/browser/components/preferences/in-content/security.xul
index b7bdb93613..5dc8ad5e92 100644
--- a/browser/components/preferences/in-content/security.xul
+++ b/browser/components/preferences/in-content/security.xul
@@ -28,6 +28,10 @@
name="browser.safebrowsing.phishing.enabled"
type="bool"/>
+ <preference id="browser.safebrowsing.UI.enabled"
+ name="browser.safebrowsing.UI.enabled"
+ type="bool"/>
+
<preference id="browser.safebrowsing.downloads.enabled"
name="browser.safebrowsing.downloads.enabled"
type="bool"/>
@@ -73,8 +77,8 @@
accesskey="&addonExceptions.accesskey;"/>
</hbox>
- <separator class="thin"/>
- <vbox align="start">
+ <separator id="safeBrowsingUISep" class="thin"/>
+ <vbox id="safeBrowsingUIGroup" align="start">
<checkbox id="enableSafeBrowsing"
label="&enableSafeBrowsing.label;"
accesskey="&enableSafeBrowsing.accesskey;" />
diff --git a/browser/components/sessionstore/content/aboutSessionRestore.js b/browser/components/sessionstore/content/aboutSessionRestore.js
index cc8d2da0b9..8a9410aa8f 100644
--- a/browser/components/sessionstore/content/aboutSessionRestore.js
+++ b/browser/components/sessionstore/content/aboutSessionRestore.js
@@ -41,7 +41,11 @@ window.onload = function() {
return;
}
- gStateObject = JSON.parse(sessionData.value);
+ try {
+ gStateObject = JSON.parse(sessionData.value);
+ } catch (e) {
+ Cu.reportError(e);
+ }
// make sure the data is tracked to be restored in case of a subsequent crash
var event = document.createEvent("UIEvents");
@@ -68,30 +72,32 @@ function initTreeView() {
var winLabel = tabList.getAttribute("_window_label");
gTreeData = [];
- gStateObject.windows.forEach(function(aWinData, aIx) {
- var winState = {
- label: winLabel.replace("%S", (aIx + 1)),
- open: true,
- checked: true,
- ix: aIx
- };
- winState.tabs = aWinData.tabs.map(function(aTabData) {
- var entry = aTabData.entries[aTabData.index - 1] || { url: "about:blank" };
- var iconURL = aTabData.image || null;
- // don't initiate a connection just to fetch a favicon (see bug 462863)
- if (/^https?:/.test(iconURL))
- iconURL = "moz-anno:favicon:" + iconURL;
- return {
- label: entry.title || entry.url,
+ if (gStateObject) {
+ gStateObject.windows.forEach(function(aWinData, aIx) {
+ var winState = {
+ label: winLabel.replace("%S", (aIx + 1)),
+ open: true,
checked: true,
- src: iconURL,
- parent: winState
+ ix: aIx
};
- });
- gTreeData.push(winState);
- for (let tab of winState.tabs)
- gTreeData.push(tab);
- }, this);
+ winState.tabs = aWinData.tabs.map(function(aTabData) {
+ var entry = aTabData.entries[aTabData.index - 1] || { url: "about:blank" };
+ var iconURL = aTabData.image || null;
+ // don't initiate a connection just to fetch a favicon (see bug 462863)
+ if (/^https?:/.test(iconURL))
+ iconURL = "moz-anno:favicon:" + iconURL;
+ return {
+ label: entry.title || entry.url,
+ checked: true,
+ src: iconURL,
+ parent: winState
+ };
+ });
+ gTreeData.push(winState);
+ for (let tab of winState.tabs)
+ gTreeData.push(tab);
+ }, this);
+ }
tabList.view = treeView;
tabList.view.selection.select(0);
diff --git a/browser/components/webextensions/ext-commands.js b/browser/components/webextensions/ext-commands.js
index 416544e860..b6e7ab3d1b 100644
--- a/browser/components/webextensions/ext-commands.js
+++ b/browser/components/webextensions/ext-commands.js
@@ -74,15 +74,14 @@ CommandList.prototype = {
// For Windows, chrome.runtime expects 'win' while chrome.commands
// expects 'windows'. We can special case this for now.
let os = PlatformInfo.os == "win" ? "windows" : PlatformInfo.os;
- for (let name of Object.keys(manifest.commands)) {
- let command = manifest.commands[name];
- let shortcut = command.suggested_key[os] || command.suggested_key.default;
- if (shortcut) {
- commands.set(name, {
- description: command.description,
- shortcut: shortcut.replace(/\s+/g, ""),
- });
- }
+ for (let [name, command] of Object.entries(manifest.commands)) {
+ let suggested_key = command.suggested_key || {};
+ let shortcut = suggested_key[os] || suggested_key.default;
+ shortcut = shortcut ? shortcut.replace(/\s+/g, "") : null;
+ commands.set(name, {
+ description: command.description,
+ shortcut,
+ });
}
return commands;
},
@@ -96,8 +95,10 @@ CommandList.prototype = {
let keyset = doc.createElementNS(XUL_NS, "keyset");
keyset.id = `ext-keyset-id-${this.id}`;
this.commands.forEach((command, name) => {
- let keyElement = this.buildKey(doc, name, command.shortcut);
- keyset.appendChild(keyElement);
+ if (command.shortcut) {
+ let keyElement = this.buildKey(doc, name, command.shortcut);
+ keyset.appendChild(keyElement);
+ }
});
doc.documentElement.appendChild(keyset);
this.keysetsMap.set(window, keyset);
@@ -162,11 +163,12 @@ CommandList.prototype = {
// The modifiers are the remaining elements.
keyElement.setAttribute("modifiers", this.getModifiersAttribute(parts));
- if (/^[A-Z0-9]$/.test(chromeKey)) {
+ if (/^[A-Z]$/.test(chromeKey)) {
// We use the key attribute for all single digits and characters.
keyElement.setAttribute("key", chromeKey);
} else {
keyElement.setAttribute("keycode", this.getKeycodeAttribute(chromeKey));
+ keyElement.setAttribute("event", "keydown");
}
return keyElement;
@@ -186,6 +188,9 @@ CommandList.prototype = {
* @returns {string} The constructed value for the Key's 'keycode' attribute.
*/
getKeycodeAttribute(chromeKey) {
+ if (/[0-9]/.test(chromeKey)) {
+ return `VK_${chromeKey}`;
+ }
return `VK${chromeKey.replace(/([A-Z])/g, "_$&").toUpperCase()}`;
},
diff --git a/browser/confvars.sh b/browser/confvars.sh
index 8cdd6e1f38..41c0be3d74 100755
--- a/browser/confvars.sh
+++ b/browser/confvars.sh
@@ -56,6 +56,9 @@ MOZ_JSDOWNLOADS=1
MOZ_WEBRTC=1
MOZ_WEBEXTENSIONS=1
MOZ_DEVTOOLS=1
+MOZ_SERVICES_COMMON=1
+MOZ_SERVICES_SYNC=1
+MOZ_SERVICES_HEALTHREPORT=
# Disable checking that add-ons are signed by the trusted root
MOZ_ADDON_SIGNING=0
diff --git a/browser/experiments/.eslintrc.js b/browser/experiments/.eslintrc.js
deleted file mode 100644
index 1f6b11d672..0000000000
--- a/browser/experiments/.eslintrc.js
+++ /dev/null
@@ -1,11 +0,0 @@
-"use strict";
-
-module.exports = {
- "rules": {
- "no-unused-vars": ["error", {
- "vars": "all",
- "varsIgnorePattern": "^(Cc|Ci|Cr|Cu|EXPORTED_SYMBOLS)$",
- "args": "none"
- }]
- }
-};
diff --git a/browser/experiments/Experiments.jsm b/browser/experiments/Experiments.jsm
deleted file mode 100644
index e9a63f19f4..0000000000
--- a/browser/experiments/Experiments.jsm
+++ /dev/null
@@ -1,2354 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-this.EXPORTED_SYMBOLS = [
- "Experiments",
-];
-
-const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/Task.jsm");
-Cu.import("resource://gre/modules/Promise.jsm");
-Cu.import("resource://gre/modules/osfile.jsm");
-Cu.import("resource://gre/modules/Log.jsm");
-Cu.import("resource://gre/modules/Preferences.jsm");
-Cu.import("resource://gre/modules/AsyncShutdown.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "UpdateUtils",
- "resource://gre/modules/UpdateUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "AddonManager",
- "resource://gre/modules/AddonManager.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "AddonManagerPrivate",
- "resource://gre/modules/AddonManager.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "TelemetryEnvironment",
- "resource://gre/modules/TelemetryEnvironment.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "TelemetryLog",
- "resource://gre/modules/TelemetryLog.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "TelemetryUtils",
- "resource://gre/modules/TelemetryUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "CommonUtils",
- "resource://services-common/utils.js");
-
-XPCOMUtils.defineLazyServiceGetter(this, "gCrashReporter",
- "@mozilla.org/xre/app-info;1",
- "nsICrashReporter");
-
-const FILE_CACHE = "experiments.json";
-const EXPERIMENTS_CHANGED_TOPIC = "experiments-changed";
-const MANIFEST_VERSION = 1;
-const CACHE_VERSION = 1;
-
-const KEEP_HISTORY_N_DAYS = 180;
-
-const PREF_BRANCH = "experiments.";
-const PREF_ENABLED = "enabled"; // experiments.enabled
-const PREF_ACTIVE_EXPERIMENT = "activeExperiment"; // whether we have an active experiment
-const PREF_LOGGING = "logging";
-const PREF_LOGGING_LEVEL = PREF_LOGGING + ".level"; // experiments.logging.level
-const PREF_LOGGING_DUMP = PREF_LOGGING + ".dump"; // experiments.logging.dump
-const PREF_MANIFEST_URI = "manifest.uri"; // experiments.logging.manifest.uri
-const PREF_FORCE_SAMPLE = "force-sample-value"; // experiments.force-sample-value
-
-const PREF_BRANCH_TELEMETRY = "toolkit.telemetry.";
-const PREF_TELEMETRY_ENABLED = "enabled";
-
-const URI_EXTENSION_STRINGS = "chrome://mozapps/locale/extensions/extensions.properties";
-const STRING_TYPE_NAME = "type.%ID%.name";
-
-const CACHE_WRITE_RETRY_DELAY_SEC = 60 * 3;
-const MANIFEST_FETCH_TIMEOUT_MSEC = 60 * 3 * 1000; // 3 minutes
-
-const TELEMETRY_LOG = {
- // log(key, [kind, experimentId, details])
- ACTIVATION_KEY: "EXPERIMENT_ACTIVATION",
- ACTIVATION: {
- // Successfully activated.
- ACTIVATED: "ACTIVATED",
- // Failed to install the add-on.
- INSTALL_FAILURE: "INSTALL_FAILURE",
- // Experiment does not meet activation requirements. Details will
- // be provided.
- REJECTED: "REJECTED",
- },
-
- // log(key, [kind, experimentId, optionalDetails...])
- TERMINATION_KEY: "EXPERIMENT_TERMINATION",
- TERMINATION: {
- // The Experiments service was disabled.
- SERVICE_DISABLED: "SERVICE_DISABLED",
- // Add-on uninstalled.
- ADDON_UNINSTALLED: "ADDON_UNINSTALLED",
- // The experiment disabled itself.
- FROM_API: "FROM_API",
- // The experiment expired (e.g. by exceeding the end date).
- EXPIRED: "EXPIRED",
- // Disabled after re-evaluating conditions. If this is specified,
- // details will be provided.
- RECHECK: "RECHECK",
- },
-};
-XPCOMUtils.defineConstant(this, "TELEMETRY_LOG", TELEMETRY_LOG);
-
-const gPrefs = new Preferences(PREF_BRANCH);
-const gPrefsTelemetry = new Preferences(PREF_BRANCH_TELEMETRY);
-var gExperimentsEnabled = false;
-var gAddonProvider = null;
-var gExperiments = null;
-var gLogAppenderDump = null;
-var gPolicyCounter = 0;
-var gExperimentsCounter = 0;
-var gExperimentEntryCounter = 0;
-var gPreviousProviderCounter = 0;
-
-// Tracks active AddonInstall we know about so we can deny external
-// installs.
-var gActiveInstallURLs = new Set();
-
-// Tracks add-on IDs that are being uninstalled by us. This allows us
-// to differentiate between expected uninstalled and user-driven uninstalls.
-var gActiveUninstallAddonIDs = new Set();
-
-var gLogger;
-var gLogDumping = false;
-
-function configureLogging() {
- if (!gLogger) {
- gLogger = Log.repository.getLogger("Browser.Experiments");
- gLogger.addAppender(new Log.ConsoleAppender(new Log.BasicFormatter()));
- }
- gLogger.level = gPrefs.get(PREF_LOGGING_LEVEL, Log.Level.Warn);
-
- let logDumping = gPrefs.get(PREF_LOGGING_DUMP, false);
- if (logDumping != gLogDumping) {
- if (logDumping) {
- gLogAppenderDump = new Log.DumpAppender(new Log.BasicFormatter());
- gLogger.addAppender(gLogAppenderDump);
- } else {
- gLogger.removeAppender(gLogAppenderDump);
- gLogAppenderDump = null;
- }
- gLogDumping = logDumping;
- }
-}
-
-// Loads a JSON file using OS.file. file is a string representing the path
-// of the file to be read, options contains additional options to pass to
-// OS.File.read.
-// Returns a Promise resolved with the json payload or rejected with
-// OS.File.Error or JSON.parse() errors.
-function loadJSONAsync(file, options) {
- return Task.spawn(function*() {
- let rawData = yield OS.File.read(file, options);
- // Read json file into a string
- let data;
- try {
- // Obtain a converter to read from a UTF-8 encoded input stream.
- let converter = new TextDecoder();
- data = JSON.parse(converter.decode(rawData));
- } catch (ex) {
- gLogger.error("Experiments: Could not parse JSON: " + file + " " + ex);
- throw ex;
- }
- return data;
- });
-}
-
-// Returns a promise that is resolved with the AddonInstall for that URL.
-function addonInstallForURL(url, hash) {
- let deferred = Promise.defer();
- AddonManager.getInstallForURL(url, install => deferred.resolve(install),
- "application/x-xpinstall", hash);
- return deferred.promise;
-}
-
-// Returns a promise that is resolved with an Array<Addon> of the installed
-// experiment addons.
-function installedExperimentAddons() {
- let deferred = Promise.defer();
- AddonManager.getAddonsByTypes(["experiment"], (addons) => {
- deferred.resolve(addons.filter(a => !a.appDisabled));
- });
- return deferred.promise;
-}
-
-// Takes an Array<Addon> and returns a promise that is resolved when the
-// addons are uninstalled.
-function uninstallAddons(addons) {
- let ids = new Set(addons.map(addon => addon.id));
- let deferred = Promise.defer();
-
- let listener = {};
- listener.onUninstalled = addon => {
- if (!ids.has(addon.id)) {
- return;
- }
-
- ids.delete(addon.id);
- if (ids.size == 0) {
- AddonManager.removeAddonListener(listener);
- deferred.resolve();
- }
- };
-
- AddonManager.addAddonListener(listener);
-
- for (let addon of addons) {
- // Disabling the add-on before uninstalling is necessary to cause tests to
- // pass. This might be indicative of a bug in XPIProvider.
- // TODO follow up in bug 992396.
- addon.userDisabled = true;
- addon.uninstall();
- }
-
- return deferred.promise;
-}
-
-/**
- * The experiments module.
- */
-
-var Experiments = {
- /**
- * Provides access to the global `Experiments.Experiments` instance.
- */
- instance: function () {
- if (!gExperiments) {
- gExperiments = new Experiments.Experiments();
- }
-
- return gExperiments;
- },
-};
-
-/*
- * The policy object allows us to inject fake enviroment data from the
- * outside by monkey-patching.
- */
-
-Experiments.Policy = function () {
- this._log = Log.repository.getLoggerWithMessagePrefix(
- "Browser.Experiments.Policy",
- "Policy #" + gPolicyCounter++ + "::");
-
- // Set to true to ignore hash verification on downloaded XPIs. This should
- // not be used outside of testing.
- this.ignoreHashes = false;
-};
-
-Experiments.Policy.prototype = {
- now: function () {
- return new Date();
- },
-
- random: function () {
- let pref = gPrefs.get(PREF_FORCE_SAMPLE);
- if (pref !== undefined) {
- let val = Number.parseFloat(pref);
- this._log.debug("random sample forced: " + val);
- if (isNaN(val) || val < 0) {
- return 0;
- }
- if (val > 1) {
- return 1;
- }
- return val;
- }
- return Math.random();
- },
-
- futureDate: function (offset) {
- return new Date(this.now().getTime() + offset);
- },
-
- oneshotTimer: function (callback, timeout, thisObj, name) {
- return CommonUtils.namedTimer(callback, timeout, thisObj, name);
- },
-
- updatechannel: function () {
- return UpdateUtils.UpdateChannel;
- },
-
- locale: function () {
- let chrome = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIXULChromeRegistry);
- return chrome.getSelectedLocale("global");
- },
-
- /**
- * For testing a race condition, one of the tests delays the callback of
- * writing the cache by replacing this policy function.
- */
- delayCacheWrite: function(promise) {
- return promise;
- },
-};
-
-function AlreadyShutdownError(message="already shut down") {
- Error.call(this, message);
- let error = new Error();
- this.name = "AlreadyShutdownError";
- this.message = message;
- this.stack = error.stack;
-}
-AlreadyShutdownError.prototype = Object.create(Error.prototype);
-AlreadyShutdownError.prototype.constructor = AlreadyShutdownError;
-
-function CacheWriteError(message="Error writing cache file") {
- Error.call(this, message);
- let error = new Error();
- this.name = "CacheWriteError";
- this.message = message;
- this.stack = error.stack;
-}
-CacheWriteError.prototype = Object.create(Error.prototype);
-CacheWriteError.prototype.constructor = CacheWriteError;
-
-/**
- * Manages the experiments and provides an interface to control them.
- */
-
-Experiments.Experiments = function (policy=new Experiments.Policy()) {
- let log = Log.repository.getLoggerWithMessagePrefix(
- "Browser.Experiments.Experiments",
- "Experiments #" + gExperimentsCounter++ + "::");
-
- // At the time of this writing, Experiments.jsm has severe
- // crashes. For forensics purposes, keep the last few log
- // messages in memory and upload them in case of crash.
- this._forensicsLogs = [];
- this._forensicsLogs.length = 30;
- this._log = Object.create(log);
- this._log.log = (level, string, params) => {
- this._addToForensicsLog("Experiments", string);
- log.log(level, string, params);
- };
-
- this._log.trace("constructor");
-
- // Capture the latest error, for forensics purposes.
- this._latestError = null;
-
-
- this._policy = policy;
-
- // This is a Map of (string -> ExperimentEntry), keyed with the experiment id.
- // It holds both the current experiments and history.
- // Map() preserves insertion order, which means we preserve the manifest order.
- // This is null until we've successfully completed loading the cache from
- // disk the first time.
- this._experiments = null;
- this._refresh = false;
- this._terminateReason = null; // or TELEMETRY_LOG.TERMINATION....
- this._dirty = false;
-
- // Loading the cache happens once asynchronously on startup
- this._loadTask = null;
-
- // The _main task handles all other actions:
- // * refreshing the manifest off the network (if _refresh)
- // * disabling/enabling experiments
- // * saving the cache (if _dirty)
- this._mainTask = null;
-
- // Timer for re-evaluating experiment status.
- this._timer = null;
-
- this._shutdown = false;
- this._networkRequest = null;
-
- // We need to tell when we first evaluated the experiments to fire an
- // experiments-changed notification when we only loaded completed experiments.
- this._firstEvaluate = true;
-
- this.init();
-};
-
-Experiments.Experiments.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback, Ci.nsIObserver]),
-
- /**
- * `true` if the experiments manager is currently setup (has been fully initialized
- * and not uninitialized yet).
- */
- get isReady() {
- return !this._shutdown;
- },
-
- init: function () {
- this._shutdown = false;
- configureLogging();
-
- gExperimentsEnabled = gPrefs.get(PREF_ENABLED, false) && TelemetryUtils.isTelemetryEnabled;
- this._log.trace("enabled=" + gExperimentsEnabled + ", " + this.enabled);
-
- gPrefs.observe(PREF_LOGGING, configureLogging);
- gPrefs.observe(PREF_MANIFEST_URI, this.updateManifest, this);
- gPrefs.observe(PREF_ENABLED, this._toggleExperimentsEnabled, this);
-
- gPrefsTelemetry.observe(PREF_TELEMETRY_ENABLED, this._telemetryStatusChanged, this);
-
- AddonManager.shutdown.addBlocker("Experiments.jsm shutdown",
- this.uninit.bind(this),
- this._getState.bind(this)
- );
-
- this._registerWithAddonManager();
-
- this._loadTask = this._loadFromCache();
-
- return this._loadTask.then(
- () => {
- this._log.trace("_loadTask finished ok");
- this._loadTask = null;
- return this._run();
- },
- (e) => {
- this._log.error("_loadFromCache caught error: " + e);
- this._latestError = e;
- throw e;
- }
- );
- },
-
- /**
- * Uninitialize this instance.
- *
- * This function is susceptible to race conditions. If it is called multiple
- * times before the previous uninit() has completed or if it is called while
- * an init() operation is being performed, the object may get in bad state
- * and/or deadlock could occur.
- *
- * @return Promise<>
- * The promise is fulfilled when all pending tasks are finished.
- */
- uninit: Task.async(function* () {
- this._log.trace("uninit: started");
- yield this._loadTask;
- this._log.trace("uninit: finished with _loadTask");
-
- if (!this._shutdown) {
- this._log.trace("uninit: no previous shutdown");
- this._unregisterWithAddonManager();
-
- gPrefs.ignore(PREF_LOGGING, configureLogging);
- gPrefs.ignore(PREF_MANIFEST_URI, this.updateManifest, this);
- gPrefs.ignore(PREF_ENABLED, this._toggleExperimentsEnabled, this);
-
- gPrefsTelemetry.ignore(PREF_TELEMETRY_ENABLED, this._telemetryStatusChanged, this);
-
- if (this._timer) {
- this._timer.clear();
- }
- }
-
- this._shutdown = true;
- if (this._mainTask) {
- if (this._networkRequest) {
- try {
- this._log.trace("Aborting pending network request: " + this._networkRequest);
- this._networkRequest.abort();
- } catch (e) {
- // pass
- }
- }
- try {
- this._log.trace("uninit: waiting on _mainTask");
- yield this._mainTask;
- } catch (e) {
- // We error out of tasks after shutdown via this exception.
- this._log.trace(`uninit: caught error - ${e}`);
- if (!(e instanceof AlreadyShutdownError)) {
- this._latestError = e;
- throw e;
- }
- }
- }
-
- this._log.info("Completed uninitialization.");
- }),
-
- // Return state information, for debugging purposes.
- _getState: function() {
- let activeExperiment = this._getActiveExperiment();
- let state = {
- isShutdown: this._shutdown,
- isEnabled: gExperimentsEnabled,
- isRefresh: this._refresh,
- isDirty: this._dirty,
- isFirstEvaluate: this._firstEvaluate,
- hasLoadTask: !!this._loadTask,
- hasMainTask: !!this._mainTask,
- hasTimer: !!this._hasTimer,
- hasAddonProvider: !!gAddonProvider,
- latestLogs: this._forensicsLogs,
- experiments: this._experiments ? [...this._experiments.keys()] : null,
- terminateReason: this._terminateReason,
- activeExperiment: activeExperiment ? activeExperiment.id : null,
- };
- if (this._latestError) {
- if (typeof this._latestError == "object") {
- state.latestError = {
- message: this._latestError.message,
- stack: this._latestError.stack
- };
- } else {
- state.latestError = "" + this._latestError;
- }
- }
- return state;
- },
-
- _addToForensicsLog: function (what, string) {
- this._forensicsLogs.shift();
- let timeInSec = Math.floor(Services.telemetry.msSinceProcessStart() / 1000);
- this._forensicsLogs.push(`${timeInSec}: ${what} - ${string}`);
- },
-
- _registerWithAddonManager: function (previousExperimentsProvider) {
- this._log.trace("Registering instance with Addon Manager.");
-
- AddonManager.addAddonListener(this);
- AddonManager.addInstallListener(this);
-
- if (!gAddonProvider) {
- // The properties of this AddonType should be kept in sync with the
- // experiment AddonType registered in XPIProvider.
- this._log.trace("Registering previous experiment add-on provider.");
- gAddonProvider = previousExperimentsProvider || new Experiments.PreviousExperimentProvider(this);
- AddonManagerPrivate.registerProvider(gAddonProvider, [
- new AddonManagerPrivate.AddonType("experiment",
- URI_EXTENSION_STRINGS,
- STRING_TYPE_NAME,
- AddonManager.VIEW_TYPE_LIST,
- 11000,
- AddonManager.TYPE_UI_HIDE_EMPTY),
- ]);
- }
-
- },
-
- _unregisterWithAddonManager: function () {
- this._log.trace("Unregistering instance with Addon Manager.");
-
- this._log.trace("Removing install listener from add-on manager.");
- AddonManager.removeInstallListener(this);
- this._log.trace("Removing addon listener from add-on manager.");
- AddonManager.removeAddonListener(this);
- this._log.trace("Finished unregistering with addon manager.");
-
- if (gAddonProvider) {
- this._log.trace("Unregistering previous experiment add-on provider.");
- AddonManagerPrivate.unregisterProvider(gAddonProvider);
- gAddonProvider = null;
- }
- },
-
- /*
- * Change the PreviousExperimentsProvider that this instance uses.
- * For testing only.
- */
- _setPreviousExperimentsProvider: function (provider) {
- this._unregisterWithAddonManager();
- this._registerWithAddonManager(provider);
- },
-
- /**
- * Throws an exception if we've already shut down.
- */
- _checkForShutdown: function() {
- if (this._shutdown) {
- throw new AlreadyShutdownError("uninit() already called");
- }
- },
-
- /**
- * Whether the experiments feature is enabled.
- */
- get enabled() {
- return gExperimentsEnabled;
- },
-
- /**
- * Toggle whether the experiments feature is enabled or not.
- */
- set enabled(enabled) {
- this._log.trace("set enabled(" + enabled + ")");
- gPrefs.set(PREF_ENABLED, enabled);
- },
-
- _toggleExperimentsEnabled: Task.async(function* (enabled) {
- this._log.trace("_toggleExperimentsEnabled(" + enabled + ")");
- let wasEnabled = gExperimentsEnabled;
- gExperimentsEnabled = enabled && TelemetryUtils.isTelemetryEnabled;
-
- if (wasEnabled == gExperimentsEnabled) {
- return;
- }
-
- if (gExperimentsEnabled) {
- yield this.updateManifest();
- } else {
- yield this.disableExperiment(TELEMETRY_LOG.TERMINATION.SERVICE_DISABLED);
- if (this._timer) {
- this._timer.clear();
- }
- }
- }),
-
- _telemetryStatusChanged: function () {
- this._toggleExperimentsEnabled(gExperimentsEnabled);
- },
-
- /**
- * Returns a promise that is resolved with an array of `ExperimentInfo` objects,
- * which provide info on the currently and recently active experiments.
- * The array is in chronological order.
- *
- * The experiment info is of the form:
- * {
- * id: <string>,
- * name: <string>,
- * description: <string>,
- * active: <boolean>,
- * endDate: <integer>, // epoch ms
- * detailURL: <string>,
- * ... // possibly extended later
- * }
- *
- * @return Promise<Array<ExperimentInfo>> Array of experiment info objects.
- */
- getExperiments: function () {
- return Task.spawn(function*() {
- yield this._loadTask;
- let list = [];
-
- for (let [id, experiment] of this._experiments) {
- if (!experiment.startDate) {
- // We only collect experiments that are or were active.
- continue;
- }
-
- list.push({
- id: id,
- name: experiment._name,
- description: experiment._description,
- active: experiment.enabled,
- endDate: experiment.endDate.getTime(),
- detailURL: experiment._homepageURL,
- branch: experiment.branch,
- });
- }
-
- // Sort chronologically, descending.
- list.sort((a, b) => b.endDate - a.endDate);
- return list;
- }.bind(this));
- },
-
- /**
- * Returns the ExperimentInfo for the active experiment, or null
- * if there is none.
- */
- getActiveExperiment: function () {
- let experiment = this._getActiveExperiment();
- if (!experiment) {
- return null;
- }
-
- let info = {
- id: experiment.id,
- name: experiment._name,
- description: experiment._description,
- active: experiment.enabled,
- endDate: experiment.endDate.getTime(),
- detailURL: experiment._homepageURL,
- };
-
- return info;
- },
-
- /**
- * Experiment "branch" support. If an experiment has multiple branches, it
- * can record the branch with the experiment system and it will
- * automatically be included in data reporting (FHR/telemetry payloads).
- */
-
- /**
- * Set the experiment branch for the specified experiment ID.
- * @returns Promise<>
- */
- setExperimentBranch: Task.async(function*(id, branchstr) {
- yield this._loadTask;
- let e = this._experiments.get(id);
- if (!e) {
- throw new Error("Experiment not found");
- }
- e.branch = String(branchstr);
- this._log.trace("setExperimentBranch(" + id + ", " + e.branch + ") _dirty=" + this._dirty);
- this._dirty = true;
- Services.obs.notifyObservers(null, EXPERIMENTS_CHANGED_TOPIC, null);
- yield this._run();
- }),
- /**
- * Get the branch of the specified experiment. If the experiment is unknown,
- * throws an error.
- *
- * @param id The ID of the experiment. Pass null for the currently running
- * experiment.
- * @returns Promise<string|null>
- * @throws Error if the specified experiment ID is unknown, or if there is no
- * current experiment.
- */
- getExperimentBranch: Task.async(function*(id=null) {
- yield this._loadTask;
- let e;
- if (id) {
- e = this._experiments.get(id);
- if (!e) {
- throw new Error("Experiment not found");
- }
- } else {
- e = this._getActiveExperiment();
- if (e === null) {
- throw new Error("No active experiment");
- }
- }
- return e.branch;
- }),
-
- /**
- * Determine whether another date has the same UTC day as now().
- */
- _dateIsTodayUTC: function (d) {
- let now = this._policy.now();
-
- return stripDateToMidnight(now).getTime() == stripDateToMidnight(d).getTime();
- },
-
- /**
- * Obtain the entry of the most recent active experiment that was active
- * today.
- *
- * If no experiment was active today, this resolves to nothing.
- *
- * Assumption: Only a single experiment can be active at a time.
- *
- * @return Promise<object>
- */
- lastActiveToday: function () {
- return Task.spawn(function* getMostRecentActiveExperimentTask() {
- let experiments = yield this.getExperiments();
-
- // Assumption: Ordered chronologically, descending, with active always
- // first.
- for (let experiment of experiments) {
- if (experiment.active) {
- return experiment;
- }
-
- if (experiment.endDate && this._dateIsTodayUTC(experiment.endDate)) {
- return experiment;
- }
- }
- return null;
- }.bind(this));
- },
-
- _run: function() {
- this._log.trace("_run");
- this._checkForShutdown();
- if (!this._mainTask) {
- this._mainTask = Task.spawn(function*() {
- try {
- yield this._main();
- } catch (e) {
- // In the CacheWriteError case we want to reschedule
- if (!(e instanceof CacheWriteError)) {
- this._log.error("_main caught error: " + e);
- return;
- }
- } finally {
- this._mainTask = null;
- }
- this._log.trace("_main finished, scheduling next run");
- try {
- yield this._scheduleNextRun();
- } catch (ex) {
- // We error out of tasks after shutdown via this exception.
- if (!(ex instanceof AlreadyShutdownError)) {
- throw ex;
- }
- }
- }.bind(this));
- }
- return this._mainTask;
- },
-
- _main: function*() {
- do {
- this._log.trace("_main iteration");
- yield this._loadTask;
- if (!gExperimentsEnabled) {
- this._refresh = false;
- }
-
- if (this._refresh) {
- yield this._loadManifest();
- }
- yield this._evaluateExperiments();
- if (this._dirty) {
- yield this._saveToCache();
- }
- // If somebody called .updateManifest() or disableExperiment()
- // while we were running, go again right now.
- }
- while (this._refresh || this._terminateReason || this._dirty);
- },
-
- _loadManifest: function*() {
- this._log.trace("_loadManifest");
- let uri = Services.urlFormatter.formatURLPref(PREF_BRANCH + PREF_MANIFEST_URI);
-
- this._checkForShutdown();
-
- this._refresh = false;
- try {
- let responseText = yield this._httpGetRequest(uri);
- this._log.trace("_loadManifest() - responseText=\"" + responseText + "\"");
-
- if (this._shutdown) {
- return;
- }
-
- let data = JSON.parse(responseText);
- this._updateExperiments(data);
- } catch (e) {
- this._log.error("_loadManifest - failure to fetch/parse manifest (continuing anyway): " + e);
- }
- },
-
- /**
- * Fetch an updated list of experiments and trigger experiment updates.
- * Do only use when experiments are enabled.
- *
- * @return Promise<>
- * The promise is resolved when the manifest and experiment list is updated.
- */
- updateManifest: function () {
- this._log.trace("updateManifest()");
-
- if (!gExperimentsEnabled) {
- return Promise.reject(new Error("experiments are disabled"));
- }
-
- if (this._shutdown) {
- return Promise.reject(Error("uninit() alrady called"));
- }
-
- this._refresh = true;
- return this._run();
- },
-
- notify: function (timer) {
- this._log.trace("notify()");
- this._checkForShutdown();
- return this._run();
- },
-
- // START OF ADD-ON LISTENERS
-
- onUninstalled: function (addon) {
- this._log.trace("onUninstalled() - addon id: " + addon.id);
- if (gActiveUninstallAddonIDs.has(addon.id)) {
- this._log.trace("matches pending uninstall");
- return;
- }
- let activeExperiment = this._getActiveExperiment();
- if (!activeExperiment || activeExperiment._addonId != addon.id) {
- return;
- }
-
- this.disableExperiment(TELEMETRY_LOG.TERMINATION.ADDON_UNINSTALLED);
- },
-
- /**
- * @returns {Boolean} returns false when we cancel the install.
- */
- onInstallStarted: function (install) {
- if (install.addon.type != "experiment") {
- return true;
- }
-
- this._log.trace("onInstallStarted() - " + install.addon.id);
- if (install.addon.appDisabled) {
- // This is a PreviousExperiment
- return true;
- }
-
- // We want to be in control of all experiment add-ons: reject installs
- // for add-ons that we don't know about.
-
- // We have a race condition of sorts to worry about here. We have 2
- // onInstallStarted listeners. This one (the global one) and the one
- // created as part of ExperimentEntry._installAddon. Because of the order
- // they are registered in, this one likely executes first. Unfortunately,
- // this means that the add-on ID is not yet set on the ExperimentEntry.
- // So, we can't just look at this._trackedAddonIds because the new experiment
- // will have its add-on ID set to null. We work around this by storing a
- // identifying field - the source URL of the install - in a module-level
- // variable (so multiple Experiments instances doesn't cancel each other
- // out).
-
- if (this._trackedAddonIds.has(install.addon.id)) {
- this._log.info("onInstallStarted allowing install because add-on ID " +
- "tracked by us.");
- return true;
- }
-
- if (gActiveInstallURLs.has(install.sourceURI.spec)) {
- this._log.info("onInstallStarted allowing install because install " +
- "tracked by us.");
- return true;
- }
-
- this._log.warn("onInstallStarted cancelling install of unknown " +
- "experiment add-on: " + install.addon.id);
- return false;
- },
-
- // END OF ADD-ON LISTENERS.
-
- _getExperimentByAddonId: function (addonId) {
- for (let [, entry] of this._experiments) {
- if (entry._addonId === addonId) {
- return entry;
- }
- }
-
- return null;
- },
-
- /*
- * Helper function to make HTTP GET requests. Returns a promise that is resolved with
- * the responseText when the request is complete.
- */
- _httpGetRequest: function (url) {
- this._log.trace("httpGetRequest(" + url + ")");
- let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIXMLHttpRequest);
-
- this._networkRequest = xhr;
- let deferred = Promise.defer();
-
- let log = this._log;
- let errorhandler = (evt) => {
- log.error("httpGetRequest::onError() - Error making request to " + url + ": " + evt.type);
- deferred.reject(new Error("Experiments - XHR error for " + url + " - " + evt.type));
- this._networkRequest = null;
- };
- xhr.onerror = errorhandler;
- xhr.ontimeout = errorhandler;
- xhr.onabort = errorhandler;
-
- xhr.onload = (event) => {
- if (xhr.status !== 200 && xhr.state !== 0) {
- log.error("httpGetRequest::onLoad() - Request to " + url + " returned status " + xhr.status);
- deferred.reject(new Error("Experiments - XHR status for " + url + " is " + xhr.status));
- this._networkRequest = null;
- return;
- }
-
- deferred.resolve(xhr.responseText);
- this._networkRequest = null;
- };
-
- try {
- xhr.open("GET", url);
-
- if (xhr.channel instanceof Ci.nsISupportsPriority) {
- xhr.channel.priority = Ci.nsISupportsPriority.PRIORITY_LOWEST;
- }
-
- xhr.timeout = MANIFEST_FETCH_TIMEOUT_MSEC;
- xhr.send(null);
- } catch (e) {
- this._log.error("httpGetRequest() - Error opening request to " + url + ": " + e);
- return Promise.reject(new Error("Experiments - Error opening XHR for " + url));
- }
- return deferred.promise;
- },
-
- /*
- * Path of the cache file we use in the profile.
- */
- get _cacheFilePath() {
- return OS.Path.join(OS.Constants.Path.profileDir, FILE_CACHE);
- },
-
- /*
- * Part of the main task to save the cache to disk, called from _main.
- */
- _saveToCache: function* () {
- this._log.trace("_saveToCache");
- let path = this._cacheFilePath;
- this._dirty = false;
- try {
- let textData = JSON.stringify({
- version: CACHE_VERSION,
- data: [...this._experiments.values()].map(e => e.toJSON()),
- });
-
- let encoder = new TextEncoder();
- let data = encoder.encode(textData);
- let options = { tmpPath: path + ".tmp", compression: "lz4" };
- yield this._policy.delayCacheWrite(OS.File.writeAtomic(path, data, options));
- } catch (e) {
- // We failed to write the cache, it's still dirty.
- this._dirty = true;
- this._log.error("_saveToCache failed and caught error: " + e);
- throw new CacheWriteError();
- }
-
- this._log.debug("_saveToCache saved to " + path);
- },
-
- /*
- * Task function, load the cached experiments manifest file from disk.
- */
- _loadFromCache: Task.async(function* () {
- this._log.trace("_loadFromCache");
- let path = this._cacheFilePath;
- try {
- let result = yield loadJSONAsync(path, { compression: "lz4" });
- this._populateFromCache(result);
- } catch (e) {
- if (e instanceof OS.File.Error && e.becauseNoSuchFile) {
- // No cached manifest yet.
- this._experiments = new Map();
- } else {
- throw e;
- }
- }
- }),
-
- _populateFromCache: function (data) {
- this._log.trace("populateFromCache() - data: " + JSON.stringify(data));
-
- // If the user has a newer cache version than we can understand, we fail
- // hard; no experiments should be active in this older client.
- if (CACHE_VERSION !== data.version) {
- throw new Error("Experiments::_populateFromCache() - invalid cache version");
- }
-
- let experiments = new Map();
- for (let item of data.data) {
- let entry = new Experiments.ExperimentEntry(this._policy);
- if (!entry.initFromCacheData(item)) {
- continue;
- }
-
- // Discard old experiments if they ended more than 180 days ago.
- if (entry.shouldDiscard()) {
- // We discarded an experiment, the cache needs to be updated.
- this._dirty = true;
- continue;
- }
-
- experiments.set(entry.id, entry);
- }
-
- this._experiments = experiments;
- },
-
- /*
- * Update the experiment entries from the experiments
- * array in the manifest
- */
- _updateExperiments: function (manifestObject) {
- this._log.trace("_updateExperiments() - experiments: " + JSON.stringify(manifestObject));
-
- if (manifestObject.version !== MANIFEST_VERSION) {
- this._log.warning("updateExperiments() - unsupported version " + manifestObject.version);
- }
-
- let experiments = new Map(); // The new experiments map
-
- // Collect new and updated experiments.
- for (let data of manifestObject.experiments) {
- let entry = this._experiments.get(data.id);
-
- if (entry) {
- if (!entry.updateFromManifestData(data)) {
- this._log.error("updateExperiments() - Invalid manifest data for " + data.id);
- continue;
- }
- } else {
- entry = new Experiments.ExperimentEntry(this._policy);
- if (!entry.initFromManifestData(data)) {
- continue;
- }
- }
-
- if (entry.shouldDiscard()) {
- continue;
- }
-
- experiments.set(entry.id, entry);
- }
-
- // Make sure we keep experiments that are or were running.
- // We remove them after KEEP_HISTORY_N_DAYS.
- for (let [id, entry] of this._experiments) {
- if (experiments.has(id)) {
- continue;
- }
-
- if (!entry.startDate || entry.shouldDiscard()) {
- this._log.trace("updateExperiments() - discarding entry for " + id);
- continue;
- }
-
- experiments.set(id, entry);
- }
-
- this._experiments = experiments;
- this._dirty = true;
- },
-
- getActiveExperimentID: function() {
- if (!this._experiments) {
- return null;
- }
- let e = this._getActiveExperiment();
- if (!e) {
- return null;
- }
- return e.id;
- },
-
- getActiveExperimentBranch: function() {
- if (!this._experiments) {
- return null;
- }
- let e = this._getActiveExperiment();
- if (!e) {
- return null;
- }
- return e.branch;
- },
-
- _getActiveExperiment: function () {
- let enabled = [...this._experiments.values()].filter(experiment => experiment._enabled);
-
- if (enabled.length == 1) {
- return enabled[0];
- }
-
- if (enabled.length > 1) {
- this._log.error("getActiveExperimentId() - should not have more than 1 active experiment");
- throw new Error("have more than 1 active experiment");
- }
-
- return null;
- },
-
- /**
- * Disables all active experiments.
- *
- * @return Promise<> Promise that will get resolved once the task is done or failed.
- */
- disableExperiment: function (reason) {
- if (!reason) {
- throw new Error("Must specify a termination reason.");
- }
-
- this._log.trace("disableExperiment()");
- this._terminateReason = reason;
- return this._run();
- },
-
- /**
- * The Set of add-on IDs that we know about from manifests.
- */
- get _trackedAddonIds() {
- if (!this._experiments) {
- return new Set();
- }
-
- return new Set([...this._experiments.values()].map(e => e._addonId));
- },
-
- /*
- * Task function to check applicability of experiments, disable the active
- * experiment if needed and activate the first applicable candidate.
- */
- _evaluateExperiments: function*() {
- this._log.trace("_evaluateExperiments");
-
- this._checkForShutdown();
-
- // The first thing we do is reconcile our state against what's in the
- // Addon Manager. It's possible that the Addon Manager knows of experiment
- // add-ons that we don't. This could happen if an experiment gets installed
- // when we're not listening or if there is a bug in our synchronization
- // code.
- //
- // We have a few options of what to do with unknown experiment add-ons
- // coming from the Addon Manager. Ideally, we'd convert these to
- // ExperimentEntry instances and stuff them inside this._experiments.
- // However, since ExperimentEntry contain lots of metadata from the
- // manifest and trying to make up data could be error prone, it's safer
- // to not try. Furthermore, if an experiment really did come from us, we
- // should have some record of it. In the end, we decide to discard all
- // knowledge for these unknown experiment add-ons.
- let installedExperiments = yield installedExperimentAddons();
- let expectedAddonIds = this._trackedAddonIds;
- let unknownAddons = installedExperiments.filter(a => !expectedAddonIds.has(a.id));
- if (unknownAddons.length) {
- this._log.warn("_evaluateExperiments() - unknown add-ons in AddonManager: " +
- unknownAddons.map(a => a.id).join(", "));
-
- yield uninstallAddons(unknownAddons);
- }
-
- let activeExperiment = this._getActiveExperiment();
- let activeChanged = false;
-
- if (!activeExperiment) {
- // Avoid this pref staying out of sync if there were e.g. crashes.
- gPrefs.set(PREF_ACTIVE_EXPERIMENT, false);
- }
-
- // Ensure the active experiment is in the proper state. This may install,
- // uninstall, upgrade, or enable the experiment add-on. What exactly is
- // abstracted away from us by design.
- if (activeExperiment) {
- let changes;
- let shouldStopResult = yield activeExperiment.shouldStop();
- if (shouldStopResult.shouldStop) {
- let expireReasons = ["endTime", "maxActiveSeconds"];
- let kind, reason;
-
- if (expireReasons.indexOf(shouldStopResult.reason[0]) != -1) {
- kind = TELEMETRY_LOG.TERMINATION.EXPIRED;
- reason = null;
- } else {
- kind = TELEMETRY_LOG.TERMINATION.RECHECK;
- reason = shouldStopResult.reason;
- }
- changes = yield activeExperiment.stop(kind, reason);
- }
- else if (this._terminateReason) {
- changes = yield activeExperiment.stop(this._terminateReason);
- }
- else {
- changes = yield activeExperiment.reconcileAddonState();
- }
-
- if (changes) {
- this._dirty = true;
- activeChanged = true;
- }
-
- if (!activeExperiment._enabled) {
- activeExperiment = null;
- activeChanged = true;
- }
- }
-
- this._terminateReason = null;
-
- if (!activeExperiment && gExperimentsEnabled) {
- for (let [id, experiment] of this._experiments) {
- let applicable;
- let reason = null;
- try {
- applicable = yield experiment.isApplicable();
- }
- catch (e) {
- applicable = false;
- reason = e;
- }
-
- if (!applicable && reason && reason[0] != "was-active") {
- // Report this from here to avoid over-reporting.
- let data = [TELEMETRY_LOG.ACTIVATION.REJECTED, id];
- data = data.concat(reason);
- const key = TELEMETRY_LOG.ACTIVATION_KEY;
- TelemetryLog.log(key, data);
- this._log.trace("evaluateExperiments() - added " + key + " to TelemetryLog: " + JSON.stringify(data));
- }
-
- if (!applicable) {
- continue;
- }
-
- this._log.debug("evaluateExperiments() - activating experiment " + id);
- try {
- yield experiment.start();
- activeChanged = true;
- activeExperiment = experiment;
- this._dirty = true;
- break;
- } catch (e) {
- // On failure, clean up the best we can and try the next experiment.
- this._log.error("evaluateExperiments() - Unable to start experiment: " + e.message);
- experiment._enabled = false;
- yield experiment.reconcileAddonState();
- }
- }
- }
-
- gPrefs.set(PREF_ACTIVE_EXPERIMENT, activeExperiment != null);
-
- if (activeChanged || this._firstEvaluate) {
- Services.obs.notifyObservers(null, EXPERIMENTS_CHANGED_TOPIC, null);
- this._firstEvaluate = false;
- }
-
- if ("@mozilla.org/toolkit/crash-reporter;1" in Cc && activeExperiment) {
- try {
- gCrashReporter.annotateCrashReport("ActiveExperiment", activeExperiment.id);
- gCrashReporter.annotateCrashReport("ActiveExperimentBranch", activeExperiment.branch);
- } catch (e) {
- // It's ok if crash reporting is disabled.
- }
- }
- },
-
- /*
- * Schedule the soonest re-check of experiment applicability that is needed.
- */
- _scheduleNextRun: function () {
- this._checkForShutdown();
-
- if (this._timer) {
- this._timer.clear();
- }
-
- if (!gExperimentsEnabled || this._experiments.length == 0) {
- return;
- }
-
- let time = null;
- let now = this._policy.now().getTime();
- if (this._dirty) {
- // If we failed to write the cache, we should try again periodically
- time = now + 1000 * CACHE_WRITE_RETRY_DELAY_SEC;
- }
-
- for (let [, experiment] of this._experiments) {
- let scheduleTime = experiment.getScheduleTime();
- if (scheduleTime > now) {
- if (time !== null) {
- time = Math.min(time, scheduleTime);
- } else {
- time = scheduleTime;
- }
- }
- }
-
- if (time === null) {
- // No schedule time found.
- return;
- }
-
- this._log.trace("scheduleExperimentEvaluation() - scheduling for "+time+", now: "+now);
- this._policy.oneshotTimer(this.notify, time - now, this, "_timer");
- },
-};
-
-
-/*
- * Represents a single experiment.
- */
-
-Experiments.ExperimentEntry = function (policy) {
- this._policy = policy || new Experiments.Policy();
- let log = Log.repository.getLoggerWithMessagePrefix(
- "Browser.Experiments.Experiments",
- "ExperimentEntry #" + gExperimentEntryCounter++ + "::");
- this._log = Object.create(log);
- this._log.log = (level, string, params) => {
- if (gExperiments) {
- gExperiments._addToForensicsLog("ExperimentEntry", string);
- }
- log.log(level, string, params);
- };
-
- // Is the experiment supposed to be running.
- this._enabled = false;
- // When this experiment was started, if ever.
- this._startDate = null;
- // When this experiment was ended, if ever.
- this._endDate = null;
- // The condition data from the manifest.
- this._manifestData = null;
- // For an active experiment, signifies whether we need to update the xpi.
- this._needsUpdate = false;
- // A random sample value for comparison against the manifest conditions.
- this._randomValue = null;
- // When this entry was last changed for respecting history retention duration.
- this._lastChangedDate = null;
- // Has this experiment failed to activate before?
- this._failedStart = false;
- // The experiment branch
- this._branch = null;
-
- // We grab these from the addon after download.
- this._name = null;
- this._description = null;
- this._homepageURL = null;
- this._addonId = null;
-};
-
-Experiments.ExperimentEntry.prototype = {
- MANIFEST_REQUIRED_FIELDS: new Set([
- "id",
- "xpiURL",
- "xpiHash",
- "startTime",
- "endTime",
- "maxActiveSeconds",
- "appName",
- "channel",
- ]),
-
- MANIFEST_OPTIONAL_FIELDS: new Set([
- "maxStartTime",
- "minVersion",
- "maxVersion",
- "version",
- "minBuildID",
- "maxBuildID",
- "buildIDs",
- "os",
- "locale",
- "sample",
- "disabled",
- "frozen",
- "jsfilter",
- ]),
-
- SERIALIZE_KEYS: new Set([
- "_enabled",
- "_manifestData",
- "_needsUpdate",
- "_randomValue",
- "_failedStart",
- "_name",
- "_description",
- "_homepageURL",
- "_addonId",
- "_startDate",
- "_endDate",
- "_branch",
- ]),
-
- DATE_KEYS: new Set([
- "_startDate",
- "_endDate",
- ]),
-
- UPGRADE_KEYS: new Map([
- ["_branch", null],
- ]),
-
- ADDON_CHANGE_NONE: 0,
- ADDON_CHANGE_INSTALL: 1,
- ADDON_CHANGE_UNINSTALL: 2,
- ADDON_CHANGE_ENABLE: 4,
-
- /*
- * Initialize entry from the manifest.
- * @param data The experiment data from the manifest.
- * @return boolean Whether initialization succeeded.
- */
- initFromManifestData: function (data) {
- if (!this._isManifestDataValid(data)) {
- return false;
- }
-
- this._manifestData = data;
-
- this._randomValue = this._policy.random();
- this._lastChangedDate = this._policy.now();
-
- return true;
- },
-
- get enabled() {
- return this._enabled;
- },
-
- get id() {
- return this._manifestData.id;
- },
-
- get branch() {
- return this._branch;
- },
-
- set branch(v) {
- this._branch = v;
- },
-
- get startDate() {
- return this._startDate;
- },
-
- get endDate() {
- if (!this._startDate) {
- return null;
- }
-
- let endTime = 0;
-
- if (!this._enabled) {
- return this._endDate;
- }
-
- let maxActiveMs = 1000 * this._manifestData.maxActiveSeconds;
- endTime = Math.min(1000 * this._manifestData.endTime,
- this._startDate.getTime() + maxActiveMs);
-
- return new Date(endTime);
- },
-
- get needsUpdate() {
- return this._needsUpdate;
- },
-
- /*
- * Initialize entry from the cache.
- * @param data The entry data from the cache.
- * @return boolean Whether initialization succeeded.
- */
- initFromCacheData: function (data) {
- for (let [key, dval] of this.UPGRADE_KEYS) {
- if (!(key in data)) {
- data[key] = dval;
- }
- }
-
- for (let key of this.SERIALIZE_KEYS) {
- if (!(key in data) && !this.DATE_KEYS.has(key)) {
- this._log.error("initFromCacheData() - missing required key " + key);
- return false;
- }
- }
-
- if (!this._isManifestDataValid(data._manifestData)) {
- return false;
- }
-
- // Dates are restored separately from epoch ms, everything else is just
- // copied in.
-
- this.SERIALIZE_KEYS.forEach(key => {
- if (!this.DATE_KEYS.has(key)) {
- this[key] = data[key];
- }
- });
-
- this.DATE_KEYS.forEach(key => {
- if (key in data) {
- let date = new Date();
- date.setTime(data[key]);
- this[key] = date;
- }
- });
-
- // In order for the experiment's data expiration mechanism to work, use the experiment's
- // |_endData| as the |_lastChangedDate| (if available).
- this._lastChangedDate = this._endDate ? this._endDate : this._policy.now();
-
- return true;
- },
-
- /*
- * Returns a JSON representation of this object.
- */
- toJSON: function () {
- let obj = {};
-
- // Dates are serialized separately as epoch ms.
-
- this.SERIALIZE_KEYS.forEach(key => {
- if (!this.DATE_KEYS.has(key)) {
- obj[key] = this[key];
- }
- });
-
- this.DATE_KEYS.forEach(key => {
- if (this[key]) {
- obj[key] = this[key].getTime();
- }
- });
-
- return obj;
- },
-
- /*
- * Update from the experiment data from the manifest.
- * @param data The experiment data from the manifest.
- * @return boolean Whether updating succeeded.
- */
- updateFromManifestData: function (data) {
- let old = this._manifestData;
-
- if (!this._isManifestDataValid(data)) {
- return false;
- }
-
- if (this._enabled) {
- if (old.xpiHash !== data.xpiHash) {
- // A changed hash means we need to update active experiments.
- this._needsUpdate = true;
- }
- } else if (this._failedStart &&
- (old.xpiHash !== data.xpiHash) ||
- (old.xpiURL !== data.xpiURL)) {
- // Retry installation of previously invalid experiments
- // if hash or url changed.
- this._failedStart = false;
- }
-
- this._manifestData = data;
- this._lastChangedDate = this._policy.now();
-
- return true;
- },
-
- /*
- * Is this experiment applicable?
- * @return Promise<> Resolved if the experiment is applicable.
- * If it is not applicable it is rejected with
- * a Promise<string> which contains the reason.
- */
- isApplicable: function () {
- let versionCmp = Cc["@mozilla.org/xpcom/version-comparator;1"]
- .getService(Ci.nsIVersionComparator);
- let app = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo);
- let runtime = Cc["@mozilla.org/xre/app-info;1"]
- .getService(Ci.nsIXULRuntime);
-
- let locale = this._policy.locale();
- let channel = this._policy.updatechannel();
- let data = this._manifestData;
-
- let now = this._policy.now() / 1000; // The manifest times are in seconds.
- let maxActive = data.maxActiveSeconds || 0;
- let startSec = (this.startDate || 0) / 1000;
-
- this._log.trace("isApplicable() - now=" + now
- + ", randomValue=" + this._randomValue);
-
- // Not applicable if it already ran.
-
- if (!this.enabled && this._endDate) {
- return Promise.reject(["was-active"]);
- }
-
- // Define and run the condition checks.
-
- let simpleChecks = [
- { name: "failedStart",
- condition: () => !this._failedStart },
- { name: "disabled",
- condition: () => !data.disabled },
- { name: "frozen",
- condition: () => !data.frozen || this._enabled },
- { name: "startTime",
- condition: () => now >= data.startTime },
- { name: "endTime",
- condition: () => now < data.endTime },
- { name: "maxStartTime",
- condition: () => this._startDate || !data.maxStartTime || now <= data.maxStartTime },
- { name: "maxActiveSeconds",
- condition: () => !this._startDate || now <= (startSec + maxActive) },
- { name: "appName",
- condition: () => !data.appName || data.appName.indexOf(app.name) != -1 },
- { name: "minBuildID",
- condition: () => !data.minBuildID || app.platformBuildID >= data.minBuildID },
- { name: "maxBuildID",
- condition: () => !data.maxBuildID || app.platformBuildID <= data.maxBuildID },
- { name: "buildIDs",
- condition: () => !data.buildIDs || data.buildIDs.indexOf(app.platformBuildID) != -1 },
- { name: "os",
- condition: () => !data.os || data.os.indexOf(runtime.OS) != -1 },
- { name: "channel",
- condition: () => !data.channel || data.channel.indexOf(channel) != -1 },
- { name: "locale",
- condition: () => !data.locale || data.locale.indexOf(locale) != -1 },
- { name: "sample",
- condition: () => data.sample === undefined || this._randomValue <= data.sample },
- { name: "version",
- condition: () => !data.version || data.version.indexOf(app.version) != -1 },
- { name: "minVersion",
- condition: () => !data.minVersion || versionCmp.compare(app.version, data.minVersion) >= 0 },
- { name: "maxVersion",
- condition: () => !data.maxVersion || versionCmp.compare(app.version, data.maxVersion) <= 0 },
- ];
-
- for (let check of simpleChecks) {
- let result = check.condition();
- if (!result) {
- this._log.debug("isApplicable() - id="
- + data.id + " - test '" + check.name + "' failed");
- return Promise.reject([check.name]);
- }
- }
-
- if (data.jsfilter) {
- return this._runFilterFunction(data.jsfilter);
- }
-
- return Promise.resolve(true);
- },
-
- /*
- * Run the jsfilter function from the manifest in a sandbox and return the
- * result (forced to boolean).
- */
- _runFilterFunction: Task.async(function* (jsfilter) {
- this._log.trace("runFilterFunction() - filter: " + jsfilter);
-
- let ssm = Services.scriptSecurityManager;
- const nullPrincipal = ssm.createNullPrincipal({});
- let options = {
- sandboxName: "telemetry experiments jsfilter sandbox",
- wantComponents: false,
- };
-
- let sandbox = Cu.Sandbox(nullPrincipal, options);
- try {
- Cu.evalInSandbox(jsfilter, sandbox);
- } catch (e) {
- this._log.error("runFilterFunction() - failed to eval jsfilter: " + e.message);
- throw ["jsfilter-evalfailed"];
- }
-
- let currentEnvironment = yield TelemetryEnvironment.onInitialized();
-
- Object.defineProperty(sandbox, "_e",
- { get: () => Cu.cloneInto(currentEnvironment, sandbox) });
-
- let result = false;
- try {
- result = !!Cu.evalInSandbox("filter({get telemetryEnvironment() { return _e; } })", sandbox);
- }
- catch (e) {
- this._log.debug("runFilterFunction() - filter function failed: "
- + e.message + ", " + e.stack);
- throw ["jsfilter-threw", e.message];
- }
- finally {
- Cu.nukeSandbox(sandbox);
- }
-
- if (!result) {
- throw ["jsfilter-false"];
- }
-
- return true;
- }),
-
- /*
- * Start running the experiment.
- *
- * @return Promise<> Resolved when the operation is complete.
- */
- start: Task.async(function* () {
- this._log.trace("start() for " + this.id);
-
- this._enabled = true;
- return yield this.reconcileAddonState();
- }),
-
- // Async install of the addon for this experiment, part of the start task above.
- _installAddon: Task.async(function* () {
- let deferred = Promise.defer();
-
- let hash = this._policy.ignoreHashes ? null : this._manifestData.xpiHash;
-
- let install = yield addonInstallForURL(this._manifestData.xpiURL, hash);
- gActiveInstallURLs.add(install.sourceURI.spec);
-
- let failureHandler = (install, handler) => {
- let message = "AddonInstall " + handler + " for " + this.id + ", state=" +
- (install.state || "?") + ", error=" + install.error;
- this._log.error("_installAddon() - " + message);
- this._failedStart = true;
- gActiveInstallURLs.delete(install.sourceURI.spec);
-
- TelemetryLog.log(TELEMETRY_LOG.ACTIVATION_KEY,
- [TELEMETRY_LOG.ACTIVATION.INSTALL_FAILURE, this.id]);
-
- deferred.reject(new Error(message));
- };
-
- let listener = {
- _expectedID: null,
-
- onDownloadEnded: install => {
- this._log.trace("_installAddon() - onDownloadEnded for " + this.id);
-
- if (install.existingAddon) {
- this._log.warn("_installAddon() - onDownloadEnded, addon already installed");
- }
-
- if (install.addon.type !== "experiment") {
- this._log.error("_installAddon() - onDownloadEnded, wrong addon type");
- install.cancel();
- }
- },
-
- onInstallStarted: install => {
- this._log.trace("_installAddon() - onInstallStarted for " + this.id);
-
- if (install.existingAddon) {
- this._log.warn("_installAddon() - onInstallStarted, addon already installed");
- }
-
- if (install.addon.type !== "experiment") {
- this._log.error("_installAddon() - onInstallStarted, wrong addon type");
- return false;
- }
- return undefined;
- },
-
- onInstallEnded: install => {
- this._log.trace("_installAddon() - install ended for " + this.id);
- gActiveInstallURLs.delete(install.sourceURI.spec);
-
- this._lastChangedDate = this._policy.now();
- this._startDate = this._policy.now();
- this._enabled = true;
-
- TelemetryLog.log(TELEMETRY_LOG.ACTIVATION_KEY,
- [TELEMETRY_LOG.ACTIVATION.ACTIVATED, this.id]);
-
- let addon = install.addon;
- this._name = addon.name;
- this._addonId = addon.id;
- this._description = addon.description || "";
- this._homepageURL = addon.homepageURL || "";
-
- // Experiment add-ons default to userDisabled=true. Enable if needed.
- if (addon.userDisabled) {
- this._log.trace("Add-on is disabled. Enabling.");
- listener._expectedID = addon.id;
- AddonManager.addAddonListener(listener);
- addon.userDisabled = false;
- } else {
- this._log.trace("Add-on is enabled. start() completed.");
- deferred.resolve();
- }
- },
-
- onEnabled: addon => {
- this._log.info("onEnabled() for " + addon.id);
-
- if (addon.id != listener._expectedID) {
- return;
- }
-
- AddonManager.removeAddonListener(listener);
- deferred.resolve();
- },
- };
-
- ["onDownloadCancelled", "onDownloadFailed", "onInstallCancelled", "onInstallFailed"]
- .forEach(what => {
- listener[what] = install => failureHandler(install, what)
- });
-
- install.addListener(listener);
- install.install();
-
- return yield deferred.promise;
- }),
-
- /**
- * Stop running the experiment if it is active.
- *
- * @param terminationKind (optional)
- * The termination kind, e.g. ADDON_UNINSTALLED or EXPIRED.
- * @param terminationReason (optional)
- * The termination reason details for termination kind RECHECK.
- * @return Promise<> Resolved when the operation is complete.
- */
- stop: Task.async(function* (terminationKind, terminationReason) {
- this._log.trace("stop() - id=" + this.id + ", terminationKind=" + terminationKind);
- if (!this._enabled) {
- throw new Error("Must not call stop() on an inactive experiment.");
- }
-
- this._enabled = false;
- let now = this._policy.now();
- this._lastChangedDate = now;
- this._endDate = now;
-
- let changes = yield this.reconcileAddonState();
- this._logTermination(terminationKind, terminationReason);
-
- if (terminationKind == TELEMETRY_LOG.TERMINATION.ADDON_UNINSTALLED) {
- changes |= this.ADDON_CHANGE_UNINSTALL;
- }
-
- return changes;
- }),
-
- /**
- * Reconcile the state of the add-on against what it's supposed to be.
- *
- * If we are active, ensure the add-on is enabled and up to date.
- *
- * If we are inactive, ensure the add-on is not installed.
- */
- reconcileAddonState: Task.async(function* () {
- this._log.trace("reconcileAddonState()");
-
- if (!this._enabled) {
- if (!this._addonId) {
- this._log.trace("reconcileAddonState() - Experiment is not enabled and " +
- "has no add-on. Doing nothing.");
- return this.ADDON_CHANGE_NONE;
- }
-
- let addon = yield this._getAddon();
- if (!addon) {
- this._log.trace("reconcileAddonState() - Inactive experiment has no " +
- "add-on. Doing nothing.");
- return this.ADDON_CHANGE_NONE;
- }
-
- this._log.info("reconcileAddonState() - Uninstalling add-on for inactive " +
- "experiment: " + addon.id);
- gActiveUninstallAddonIDs.add(addon.id);
- yield uninstallAddons([addon]);
- gActiveUninstallAddonIDs.delete(addon.id);
- return this.ADDON_CHANGE_UNINSTALL;
- }
-
- // If we get here, we're supposed to be active.
-
- let changes = 0;
-
- // That requires an add-on.
- let currentAddon = yield this._getAddon();
-
- // If we have an add-on but it isn't up to date, uninstall it
- // (to prepare for reinstall).
- if (currentAddon && this._needsUpdate) {
- this._log.info("reconcileAddonState() - Uninstalling add-on because update " +
- "needed: " + currentAddon.id);
- gActiveUninstallAddonIDs.add(currentAddon.id);
- yield uninstallAddons([currentAddon]);
- gActiveUninstallAddonIDs.delete(currentAddon.id);
- changes |= this.ADDON_CHANGE_UNINSTALL;
- }
-
- if (!currentAddon || this._needsUpdate) {
- this._log.info("reconcileAddonState() - Installing add-on.");
- yield this._installAddon();
- changes |= this.ADDON_CHANGE_INSTALL;
- }
-
- let addon = yield this._getAddon();
- if (!addon) {
- throw new Error("Could not obtain add-on for experiment that should be " +
- "enabled.");
- }
-
- // If we have the add-on and it is enabled, we are done.
- if (!addon.userDisabled) {
- return changes;
- }
-
- // Check permissions to see if we can enable the addon.
- if (!(addon.permissions & AddonManager.PERM_CAN_ENABLE)) {
- throw new Error("Don't have permission to enable addon " + addon.id + ", perm=" + addon.permission);
- }
-
- // Experiment addons should not require a restart.
- if (addon.operationsRequiringRestart & AddonManager.OP_NEEDS_RESTART_ENABLE) {
- throw new Error("Experiment addon requires a restart: " + addon.id);
- }
-
- let deferred = Promise.defer();
-
- // Else we need to enable it.
- let listener = {
- onEnabled: enabledAddon => {
- if (enabledAddon.id != addon.id) {
- return;
- }
-
- AddonManager.removeAddonListener(listener);
- deferred.resolve();
- },
- };
-
- for (let handler of ["onDisabled", "onOperationCancelled", "onUninstalled"]) {
- listener[handler] = (evtAddon) => {
- if (evtAddon.id != addon.id) {
- return;
- }
-
- AddonManager.removeAddonListener(listener);
- deferred.reject("Failed to enable addon " + addon.id + " due to: " + handler);
- };
- }
-
- this._log.info("reconcileAddonState() - Activating add-on: " + addon.id);
- AddonManager.addAddonListener(listener);
- addon.userDisabled = false;
- yield deferred.promise;
- changes |= this.ADDON_CHANGE_ENABLE;
-
- this._log.info("reconcileAddonState() - Add-on has been enabled: " + addon.id);
- return changes;
- }),
-
- /**
- * Obtain the underlying Addon from the Addon Manager.
- *
- * @return Promise<Addon|null>
- */
- _getAddon: function () {
- if (!this._addonId) {
- return Promise.resolve(null);
- }
-
- let deferred = Promise.defer();
-
- AddonManager.getAddonByID(this._addonId, (addon) => {
- if (addon && addon.appDisabled) {
- // Don't return PreviousExperiments.
- addon = null;
- }
-
- deferred.resolve(addon);
- });
-
- return deferred.promise;
- },
-
- _logTermination: function (terminationKind, terminationReason) {
- if (terminationKind === undefined) {
- return;
- }
-
- if (!(terminationKind in TELEMETRY_LOG.TERMINATION)) {
- this._log.warn("stop() - unknown terminationKind " + terminationKind);
- return;
- }
-
- let data = [terminationKind, this.id];
- if (terminationReason) {
- data = data.concat(terminationReason);
- }
-
- TelemetryLog.log(TELEMETRY_LOG.TERMINATION_KEY, data);
- },
-
- /**
- * Determine whether an active experiment should be stopped.
- */
- shouldStop: function () {
- if (!this._enabled) {
- throw new Error("shouldStop must not be called on disabled experiments.");
- }
-
- let deferred = Promise.defer();
- this.isApplicable().then(
- () => deferred.resolve({shouldStop: false}),
- reason => deferred.resolve({shouldStop: true, reason: reason})
- );
-
- return deferred.promise;
- },
-
- /*
- * Should this be discarded from the cache due to age?
- */
- shouldDiscard: function () {
- let limit = this._policy.now();
- limit.setDate(limit.getDate() - KEEP_HISTORY_N_DAYS);
- return (this._lastChangedDate < limit);
- },
-
- /*
- * Get next date (in epoch-ms) to schedule a re-evaluation for this.
- * Returns 0 if it doesn't need one.
- */
- getScheduleTime: function () {
- if (this._enabled) {
- let startTime = this._startDate.getTime();
- let maxActiveTime = startTime + 1000 * this._manifestData.maxActiveSeconds;
- return Math.min(1000 * this._manifestData.endTime, maxActiveTime);
- }
-
- if (this._endDate) {
- return this._endDate.getTime();
- }
-
- return 1000 * this._manifestData.startTime;
- },
-
- /*
- * Perform sanity checks on the experiment data.
- */
- _isManifestDataValid: function (data) {
- this._log.trace("isManifestDataValid() - data: " + JSON.stringify(data));
-
- for (let key of this.MANIFEST_REQUIRED_FIELDS) {
- if (!(key in data)) {
- this._log.error("isManifestDataValid() - missing required key: " + key);
- return false;
- }
- }
-
- for (let key in data) {
- if (!this.MANIFEST_OPTIONAL_FIELDS.has(key) &&
- !this.MANIFEST_REQUIRED_FIELDS.has(key)) {
- this._log.error("isManifestDataValid() - unknown key: " + key);
- return false;
- }
- }
-
- return true;
- },
-};
-
-/**
- * Strip a Date down to its UTC midnight.
- *
- * This will return a cloned Date object. The original is unchanged.
- */
-var stripDateToMidnight = function (d) {
- let m = new Date(d);
- m.setUTCHours(0, 0, 0, 0);
-
- return m;
-};
-
-/**
- * An Add-ons Manager provider that knows about old experiments.
- *
- * This provider exposes read-only add-ons corresponding to previously-active
- * experiments. The existence of this provider (and the add-ons it knows about)
- * facilitates the display of old experiments in the Add-ons Manager UI with
- * very little custom code in that component.
- */
-this.Experiments.PreviousExperimentProvider = function (experiments) {
- this._experiments = experiments;
- this._experimentList = [];
- this._log = Log.repository.getLoggerWithMessagePrefix(
- "Browser.Experiments.Experiments",
- "PreviousExperimentProvider #" + gPreviousProviderCounter++ + "::");
-}
-
-this.Experiments.PreviousExperimentProvider.prototype = Object.freeze({
- name: "PreviousExperimentProvider",
-
- startup: function () {
- this._log.trace("startup()");
- Services.obs.addObserver(this, EXPERIMENTS_CHANGED_TOPIC, false);
- },
-
- shutdown: function () {
- this._log.trace("shutdown()");
- try {
- Services.obs.removeObserver(this, EXPERIMENTS_CHANGED_TOPIC);
- } catch (e) {
- // Prevent crash in mochitest-browser3 on Mulet
- }
- },
-
- observe: function (subject, topic, data) {
- switch (topic) {
- case EXPERIMENTS_CHANGED_TOPIC:
- this._updateExperimentList();
- break;
- }
- },
-
- getAddonByID: function (id, cb) {
- for (let experiment of this._experimentList) {
- if (experiment.id == id) {
- cb(new PreviousExperimentAddon(experiment));
- return;
- }
- }
-
- cb(null);
- },
-
- getAddonsByTypes: function (types, cb) {
- if (types && types.length > 0 && types.indexOf("experiment") == -1) {
- cb([]);
- return;
- }
-
- cb(this._experimentList.map(e => new PreviousExperimentAddon(e)));
- },
-
- _updateExperimentList: function () {
- return this._experiments.getExperiments().then((experiments) => {
- let list = experiments.filter(e => !e.active);
-
- let newMap = new Map(list.map(e => [e.id, e]));
- let oldMap = new Map(this._experimentList.map(e => [e.id, e]));
-
- let added = [...newMap.keys()].filter(id => !oldMap.has(id));
- let removed = [...oldMap.keys()].filter(id => !newMap.has(id));
-
- for (let id of added) {
- this._log.trace("updateExperimentList() - adding " + id);
- let wrapper = new PreviousExperimentAddon(newMap.get(id));
- AddonManagerPrivate.callInstallListeners("onExternalInstall", null, wrapper, null, false);
- AddonManagerPrivate.callAddonListeners("onInstalling", wrapper, false);
- }
-
- for (let id of removed) {
- this._log.trace("updateExperimentList() - removing " + id);
- let wrapper = new PreviousExperimentAddon(oldMap.get(id));
- AddonManagerPrivate.callAddonListeners("onUninstalling", wrapper, false);
- }
-
- this._experimentList = list;
-
- for (let id of added) {
- let wrapper = new PreviousExperimentAddon(newMap.get(id));
- AddonManagerPrivate.callAddonListeners("onInstalled", wrapper);
- }
-
- for (let id of removed) {
- let wrapper = new PreviousExperimentAddon(oldMap.get(id));
- AddonManagerPrivate.callAddonListeners("onUninstalled", wrapper);
- }
-
- return this._experimentList;
- });
- },
-});
-
-/**
- * An add-on that represents a previously-installed experiment.
- */
-function PreviousExperimentAddon(experiment) {
- this._id = experiment.id;
- this._name = experiment.name;
- this._endDate = experiment.endDate;
- this._description = experiment.description;
-}
-
-PreviousExperimentAddon.prototype = Object.freeze({
- // BEGIN REQUIRED ADDON PROPERTIES
-
- get appDisabled() {
- return true;
- },
-
- get blocklistState() {
- Ci.nsIBlocklistService.STATE_NOT_BLOCKED
- },
-
- get creator() {
- return new AddonManagerPrivate.AddonAuthor("");
- },
-
- get foreignInstall() {
- return false;
- },
-
- get id() {
- return this._id;
- },
-
- get isActive() {
- return false;
- },
-
- get isCompatible() {
- return true;
- },
-
- get isPlatformCompatible() {
- return true;
- },
-
- get name() {
- return this._name;
- },
-
- get pendingOperations() {
- return AddonManager.PENDING_NONE;
- },
-
- get permissions() {
- return 0;
- },
-
- get providesUpdatesSecurely() {
- return true;
- },
-
- get scope() {
- return AddonManager.SCOPE_PROFILE;
- },
-
- get type() {
- return "experiment";
- },
-
- get userDisabled() {
- return true;
- },
-
- get version() {
- return null;
- },
-
- // END REQUIRED PROPERTIES
-
- // BEGIN OPTIONAL PROPERTIES
-
- get description() {
- return this._description;
- },
-
- get updateDate() {
- return new Date(this._endDate);
- },
-
- // END OPTIONAL PROPERTIES
-
- // BEGIN REQUIRED METHODS
-
- isCompatibleWith: function (appVersion, platformVersion) {
- return true;
- },
-
- findUpdates: function (listener, reason, appVersion, platformVersion) {
- AddonManagerPrivate.callNoUpdateListeners(this, listener, reason,
- appVersion, platformVersion);
- },
-
- // END REQUIRED METHODS
-
- /**
- * The end-date of the experiment, required for the Addon Manager UI.
- */
-
- get endDate() {
- return this._endDate;
- },
-
-});
diff --git a/browser/experiments/Experiments.manifest b/browser/experiments/Experiments.manifest
deleted file mode 100644
index 4a6a05a604..0000000000
--- a/browser/experiments/Experiments.manifest
+++ /dev/null
@@ -1,6 +0,0 @@
-component {f7800463-3b97-47f9-9341-b7617e6d8d49} ExperimentsService.js
-contract @mozilla.org/browser/experiments-service;1 {f7800463-3b97-47f9-9341-b7617e6d8d49}
-category update-timer ExperimentsService @mozilla.org/browser/experiments-service;1,getService,experiments-update-timer,experiments.manifest.fetchIntervalSeconds,86400
-category profile-after-change ExperimentsService @mozilla.org/browser/experiments-service;1
-
-
diff --git a/browser/experiments/ExperimentsService.js b/browser/experiments/ExperimentsService.js
deleted file mode 100644
index 53e8112516..0000000000
--- a/browser/experiments/ExperimentsService.js
+++ /dev/null
@@ -1,118 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-const {interfaces: Ci, utils: Cu} = Components;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/Preferences.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "Experiments",
- "resource:///modules/experiments/Experiments.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "OS",
- "resource://gre/modules/osfile.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "CommonUtils",
- "resource://services-common/utils.js");
-
-const PREF_EXPERIMENTS_ENABLED = "experiments.enabled";
-const PREF_ACTIVE_EXPERIMENT = "experiments.activeExperiment"; // whether we have an active experiment
-const PREF_TELEMETRY_ENABLED = "toolkit.telemetry.enabled";
-const PREF_TELEMETRY_UNIFIED = "toolkit.telemetry.unified";
-const DELAY_INIT_MS = 30 * 1000;
-
-// Whether the FHR/Telemetry unification features are enabled.
-// Changing this pref requires a restart.
-const IS_UNIFIED_TELEMETRY = Preferences.get(PREF_TELEMETRY_UNIFIED, false);
-
-XPCOMUtils.defineLazyGetter(
- this, "gPrefs", () => {
- return new Preferences();
- });
-
-XPCOMUtils.defineLazyGetter(
- this, "gExperimentsEnabled", () => {
- // We can enable experiments if either unified Telemetry or FHR is on, and the user
- // has opted into Telemetry.
- return gPrefs.get(PREF_EXPERIMENTS_ENABLED, false) &&
- IS_UNIFIED_TELEMETRY && gPrefs.get(PREF_TELEMETRY_ENABLED, false);
- });
-
-XPCOMUtils.defineLazyGetter(
- this, "gActiveExperiment", () => {
- return gPrefs.get(PREF_ACTIVE_EXPERIMENT);
- });
-
-function ExperimentsService() {
- this._initialized = false;
- this._delayedInitTimer = null;
-}
-
-ExperimentsService.prototype = {
- classID: Components.ID("{f7800463-3b97-47f9-9341-b7617e6d8d49}"),
- QueryInterface: XPCOMUtils.generateQI([Ci.nsITimerCallback, Ci.nsIObserver]),
-
- notify: function (timer) {
- if (!gExperimentsEnabled) {
- return;
- }
- if (OS.Constants.Path.profileDir === undefined) {
- throw Error("Update timer fired before profile was initialized?");
- }
- let instance = Experiments.instance();
- if (instance.isReady) {
- instance.updateManifest();
- }
- },
-
- _delayedInit: function () {
- if (!this._initialized) {
- this._initialized = true;
- Experiments.instance(); // for side effects
- }
- },
-
- observe: function (subject, topic, data) {
- switch (topic) {
- case "profile-after-change":
- if (gExperimentsEnabled) {
- Services.obs.addObserver(this, "quit-application", false);
- Services.obs.addObserver(this, "sessionstore-state-finalized", false);
- Services.obs.addObserver(this, "EM-loaded", false);
-
- if (gActiveExperiment) {
- this._initialized = true;
- Experiments.instance(); // for side effects
- }
- }
- break;
- case "sessionstore-state-finalized":
- if (!this._initialized) {
- CommonUtils.namedTimer(this._delayedInit, DELAY_INIT_MS, this, "_delayedInitTimer");
- }
- break;
- case "EM-loaded":
- if (!this._initialized) {
- Experiments.instance(); // for side effects
- this._initialized = true;
-
- if (this._delayedInitTimer) {
- this._delayedInitTimer.clear();
- }
- }
- break;
- case "quit-application":
- Services.obs.removeObserver(this, "quit-application");
- Services.obs.removeObserver(this, "sessionstore-state-finalized");
- Services.obs.removeObserver(this, "EM-loaded");
- if (this._delayedInitTimer) {
- this._delayedInitTimer.clear();
- }
- break;
- }
- },
-};
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ExperimentsService]);
diff --git a/browser/experiments/Makefile.in b/browser/experiments/Makefile.in
deleted file mode 100644
index 5558582a68..0000000000
--- a/browser/experiments/Makefile.in
+++ /dev/null
@@ -1,16 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-include $(topsrcdir)/config/rules.mk
-
-# This is so hacky. Waiting on bug 988938.
-addondir = $(srcdir)/test/addons
-testdir = $(topobjdir)/_tests/xpcshell/browser/experiments/test/xpcshell
-
-misc:: $(call mkdir_deps,$(testdir))
- $(EXIT_ON_ERROR) \
- for dir in $(addondir)/*; do \
- base=`basename $$dir`; \
- (cd $$dir && zip -qr $(testdir)/$$base.xpi *); \
- done
diff --git a/browser/experiments/docs/index.rst b/browser/experiments/docs/index.rst
deleted file mode 100644
index 11e5d4faad..0000000000
--- a/browser/experiments/docs/index.rst
+++ /dev/null
@@ -1,13 +0,0 @@
-=====================
-Telemetry Experiments
-=====================
-
-Telemetry Experiments is a feature of Firefox that allows the installation
-of add-ons called experiments to a subset of the Firefox population for
-the purposes of experimenting with changes and collecting data on specific
-aspects of application usage.
-
-.. toctree::
- :maxdepth: 1
-
- manifest
diff --git a/browser/experiments/docs/manifest.rst b/browser/experiments/docs/manifest.rst
deleted file mode 100644
index d4fad52432..0000000000
--- a/browser/experiments/docs/manifest.rst
+++ /dev/null
@@ -1,429 +0,0 @@
-.. _experiments_manifests:
-
-=====================
-Experiments Manifests
-=====================
-
-*Experiments Manifests* are documents that describe the set of active
-experiments a client may run.
-
-*Experiments Manifests* are fetched periodically by clients. When
-fetched, clients look at the experiments within the manifest and
-determine which experiments are applicable. If an experiment is
-applicable, the client may download and start the experiment.
-
-Manifest Format
-===============
-
-Manifests are JSON documents where the main element is an object.
-
-The *schema* of the object is versioned and defined by the presence
-of a top-level ``version`` property, whose integer value is the
-schema version used by that manifest. Each version is documented
-in the sections below.
-
-Version 1
----------
-
-Version 1 is the original manifest format.
-
-The following properties may exist in the root object:
-
-experiments
- An array of objects describing candidate experiments. The format of
- these objects is documented below.
-
- An array is used to create an explicit priority of experiments.
- Experiments listed at the beginning of the array take priority over
- experiments that follow.
-
-Experiments Objects
-^^^^^^^^^^^^^^^^^^^
-
-Each object in the ``experiments`` array may contain the following
-properties:
-
-id
- (required) String identifier of this experiment. The identifier should
- be treated as opaque by clients. It is used to uniquely identify an
- experiment for all of time.
-
-xpiURL
- (required) String URL of the XPI that implements this experiment.
-
- If the experiment is activated, the client will download and install this
- XPI.
-
-xpiHash
- (required) String hash of the XPI that implements this experiment.
-
- The value is composed of a hash identifier followed by a colon
- followed by the hash value. e.g.
- `sha1:f677428b9172e22e9911039aef03f3736e7f78a7`. `sha1` and `sha256`
- are the two supported hashing mechanisms. The hash value is the hex
- encoding of the binary hash.
-
- When the client downloads the XPI for the experiment, it should compare
- the hash of that XPI against this value. If the hashes don't match,
- the client should not install the XPI.
-
- Clients may also use this hash as a means of determining when an
- experiment's XPI has changed and should be refreshed.
-
-startTime
- Integer seconds since UNIX epoch that this experiment should
- start. Clients should not start an experiment if *now()* is less than
- this value.
-
-maxStartTime
- (optional) Integer seconds since UNIX epoch after which this experiment
- should no longer start.
-
- Some experiments may wish to impose hard deadlines after which no new
- clients should activate the experiment. This property may be used to
- facilitate that.
-
-endTime
- Integer seconds since UNIX epoch after which this experiment
- should no longer run. Clients should cease an experiment when the current
- time is beyond this value.
-
-maxActiveSeconds
- Integer seconds defining the max wall time this experiment should be
- active for.
-
- The client should deactivate the experiment this many seconds after
- initial activation.
-
- This value only involves wall time, not browser activity or session time.
-
-appName
- Array of application names this experiment should run on.
-
- An application name comes from ``nsIXULAppInfo.name``. It is a value
- like ``Firefox``, ``Fennec``, or `B2G`.
-
- The client should compare its application name against the members of
- this array. If a match is found, the experiment is applicable.
-
-minVersion
- (optional) String version number of the minimum application version this
- experiment should run on.
-
- A version number is something like ``27.0.0`` or ``28``.
-
- The client should compare its version number to this value. If the client's
- version is greater or equal to this version (using a version-aware comparison
- function), the experiment is applicable.
-
- If this is not specified, there is no lower bound to versions this
- experiment should run on.
-
-maxVersion
- (optional) String version number of the maximum application version this
- experiment should run on.
-
- This is similar to ``minVersion`` except it sets the upper bound for
- application versions.
-
- If the client's version is less than or equal to this version, the
- experiment is applicable.
-
- If this is not specified, there is no upper bound to versions this
- experiment should run on.
-
-version
- (optional) Array of application versions this experiment should run on.
-
- This is similar to ``minVersion`` and ``maxVersion`` except only a
- whitelisted set of specific versions are allowed.
-
- The client should compare its version to members of this array. If a match
- is found, the experiment is applicable.
-
-minBuildID
- (optional) String minimum Build ID this experiment should run on.
-
- Build IDs are values like ``201402261424``.
-
- The client should perform a string comparison of its Build ID against this
- value. If its value is greater than or equal to this value, the experiment
- is applicable.
-
-maxBuildID
- (optional) String maximum Build ID this experiment should run on.
-
- This is similar to ``minBuildID`` except it sets the upper bound
- for Build IDs.
-
- The client should perform a string comparison of its Build ID against
- this value. If its value is less than or equal to this value, the
- experiment is applicable.
-
-buildIDs
- (optional) Array of Build IDs this experiment should run on.
-
- This is similar to ``minBuildID`` and ``maxBuildID`` except only a
- whitelisted set of Build IDs are considered.
-
- The client should compare its Build ID to members of this array. If a
- match is found, the experiment is applicable.
-
-os
- (optional) Array of operating system identifiers this experiment should
- run on.
-
- Values for this array come from ``nsIXULRuntime.OS``.
-
- The client will compare its operating system identifier to members
- of this array. If a match is found, the experiment is applicable to the
- client.
-
-channel
- (optional) Array of release channel identifiers this experiment should run
- on.
-
- The client will compare its channel to members of this array. If a match
- is found, the experiment is applicable.
-
- If this property is not defined, the client should assume the experiment
- is to run on all channels.
-
-locale
- (optional) Array of locale identifiers this experiment should run on.
-
- A locale identifier is a string like ``en-US`` or ``zh-CN`` and is
- obtained by looking at
- ``nsIXULChromeRegistry.getSelectedLocale("global")``.
-
- The client should compare its locale identifier to members of this array.
- If a match is found, the experiment is applicable.
-
- If this property is not defined, the client should assume the experiment
- is to run on all locales.
-
-sample
- (optional) Decimal number indicating the sampling rate for this experiment.
-
- This will contain a value between ``0.0`` and ``1.0``. The client should
- generate a random decimal between ``0.0`` and ``1.0``. If the randomly
- generated number is less than or equal to the value of this field, the
- experiment is applicable.
-
-disabled
- (optional) Boolean value indicating whether an experiment is disabled.
-
- Normally, experiments are deactivated after a certain time has passed or
- after the experiment itself determines it no longer needs to run (perhaps
- it collected sufficient data already).
-
- This property serves as a backup mechanism to remotely disable an
- experiment before it was scheduled to be disabled. It can be used to
- kill experiments that are found to be doing wrong or bad things or that
- aren't useful.
-
- If this property is not defined or is false, the client should assume
- the experiment is active and a candidate for activation.
-
-frozen
- (optional) Boolean value indicating this experiment is frozen and no
- longer accepting new enrollments.
-
- If a client sees a true value in this field, it should not attempt to
- activate an experiment.
-
-jsfilter
- (optional) JavaScript code that will be evaluated to determine experiment
- applicability.
-
- This property contains the string representation of JavaScript code that
- will be evaluated in a sandboxed environment using JavaScript's
- ``eval()``.
-
- The string is expected to contain the definition of a JavaScript function
- ``filter(context)``. This function receives as its argument an object
- holding application state. See the section below for the definition of
- this object.
-
- The purpose of this property is to allow experiments to define complex
- rules and logic for evaluating experiment applicability in a manner
- that is privacy conscious and doesn't require the transmission of
- excessive data.
-
- The return value of this filter indicates whether the experiment is
- applicable. Functions should return true if the experiment is
- applicable.
-
- If an experiment is not applicable, they should throw an Error whose
- message contains the reason the experiment is not applicable. This
- message may be logged and sent to remote servers, so it should not
- contain private or otherwise sensitive data that wouldn't normally
- be submitted.
-
- If a falsey (or undefined) value is returned, the client should
- assume the experiment is not applicable.
-
- If this property is not defined, the client does not consider a custom
- JavaScript filter function when determining whether an experiment is
- applicable.
-
-JavaScript Filter Context Objects
-^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-
-The object passed to a ``jsfilter`` ``filter()`` function contains the
-following properties:
-
-healthReportSubmissionEnabled
- This property contains a boolean indicating whether Firefox Health
- Report has its data submission flag enabled (whether Firefox Health
- Report is sending data to remote servers).
-
-healthReportPayload
- This property contains the current Firefox Health Report payload.
-
- The payload format is documented at :ref:`healthreport_dataformat`.
-
-telemetryPayload
- This property contains the current Telemetry payload.
-
-The evaluation sandbox for the JavaScript filters may be destroyed
-immediately after ``filter()`` returns. This function should not assume
-async code will finish.
-
-Experiment Applicability and Client Behavior
-============================================
-
-The point of an experiment manifest is to define which experiments are
-available and where and how to run them. This section explains those
-rules in more detail.
-
-Many of the properties in *Experiment Objects* are related to determining
-whether an experiment should run on a given client. This evaluation is
-performed client side.
-
-1. Multiple conditions in an experiment
----------------------------------------
-
-If multiple conditions are defined for an experiment, the client should
-combine each condition with a logical *AND*: all conditions must be
-satisfied for an experiment to run. If one condition fails, the experiment
-is not applicable.
-
-2. Active experiment disappears from manifest
----------------------------------------------
-
-If a specific experiment disappears from the manifest, the client should
-continue conducting an already-active experiment. Furthermore, the
-client should remember what the expiration events were for an experiment
-and honor them.
-
-The rationale here is that we want to prevent an accidental deletion
-or temporary failure on the server to inadvertantly deactivate
-supposed-to-be-active experiments. We also don't want premature deletion
-of an experiment from the manifest to result in indefinite activation
-periods.
-
-3. Inactive experiment disappears from manifest
------------------------------------------------
-
-If an inactive but scheduled-to-be-active experiment disappears from the
-manifest, the client should not activate the experiment.
-
-If that experiment reappears in the manifest, the client should not
-treat that experiment any differently than any other new experiment. Put
-another way, the fact an inactive experiment disappears and then
-reappears should not be significant.
-
-The rationale here is that server operators should have complete
-control of an inactive experiment up to it's go-live date.
-
-4. Re-evaluating applicability on manifest refresh
---------------------------------------------------
-
-When an experiment manifest is refreshed or updated, the client should
-re-evaluate the applicability of each experiment therein.
-
-The rationale here is that the server may change the parameters of an
-experiment and want clients to pick those up.
-
-5. Activating a previously non-applicable experiment
-----------------------------------------------------
-
-If the conditions of an experiment change or the state of the client
-changes to allow an experiment to transition from previously
-non-applicable to applicable, the experiment should be activated.
-
-For example, if a client is running version 28 and the experiment
-initially requires version 29 or above, the client will not mark the
-experiment as applicable. But if the client upgrades to version 29 or if
-the manifest is updated to require 28 or above, the experiment will
-become applicable.
-
-6. Deactivating a previously active experiment
-----------------------------------------------
-
-If the conditions of an experiment change or the state of the client
-changes and an active experiment is no longer applicable, that
-experiment should be deactivated.
-
-7. Calculation of sampling-based applicability
-----------------------------------------------
-
-For calculating sampling-based applicability, the client will associate
-a random value between ``0.0`` and ``1.0`` for each observed experiment
-ID. This random value will be generated the first time sampling
-applicability is evaluated. This random value will be persisted and used
-in future applicability evaluations for this experiment.
-
-By saving and re-using the value, the client is able to reliably and
-consistently evaluate applicability, even if the sampling threshold
-in the manifest changes.
-
-Clients should retain the randomly-generated sampling value for
-experiments that no longer appear in a manifest for a period of at least
-30 days. The rationale is that if an experiment disappears and reappears
-from a manifest, the client will not have multiple opportunities to
-generate a random value that satisfies the sampling criteria.
-
-8. Incompatible version numbers
--------------------------------
-
-If a client receives a manifest with a version number that it doesn't
-recognize, it should ignore the manifest.
-
-9. Usage of old manifests
--------------------------
-
-If a client experiences an error fetching a manifest (server not
-available) or if the manifest is corrupt, not readable, or compatible,
-the client may use a previously-fetched (cached) manifest.
-
-10. Updating XPIs
------------------
-
-If the URL or hash of an active experiment's XPI changes, the client
-should fetch the new XPI, uninstall the old XPI, and install the new
-XPI.
-
-Examples
-========
-
-Here is an example manifest::
-
- {
- "version": 1,
- "experiments": [
- {
- "id": "da9d7f4f-f3f9-4f81-bacd-6f0626ffa360",
- "xpiURL": "https://experiments.mozilla.org/foo.xpi",
- "xpiHash": "sha1:cb1eb32b89d86d78b7326f416cf404548c5e0099",
- "startTime": 1393000000,
- "endTime": 1394000000,
- "appName": ["Firefox", "Fennec"],
- "minVersion": "28",
- "maxVersion": "30",
- "os": ["windows", "linux", "osx"],
- "jsfilter": "function filter(context) { return context.healthReportEnabled; }"
- }
- ]
- }
diff --git a/browser/experiments/moz.build b/browser/experiments/moz.build
deleted file mode 100644
index a11e4b7258..0000000000
--- a/browser/experiments/moz.build
+++ /dev/null
@@ -1,18 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-HAS_MISC_RULE = True
-
-EXTRA_COMPONENTS += [
- 'Experiments.manifest',
- 'ExperimentsService.js',
-]
-
-EXTRA_JS_MODULES.experiments += [
- 'Experiments.jsm',
-]
-
-XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell/xpcshell.ini']
-
-SPHINX_TREES['experiments'] = 'docs'
diff --git a/browser/experiments/test/addons/experiment-1/install.rdf b/browser/experiments/test/addons/experiment-1/install.rdf
deleted file mode 100644
index f9d70054a8..0000000000
--- a/browser/experiments/test/addons/experiment-1/install.rdf
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0"?>
-
-<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-
- <Description about="urn:mozilla:install-manifest">
- <em:id>test-experiment-1@tests.mozilla.org</em:id>
- <em:version>1</em:version>
- <em:type>128</em:type>
-
- <!-- Front End MetaData -->
- <em:name>Test experiment 1</em:name>
- <em:description>Yet another experiment that experiments experimentally.</em:description>
-
- </Description>
-</RDF>
diff --git a/browser/experiments/test/addons/experiment-1a/install.rdf b/browser/experiments/test/addons/experiment-1a/install.rdf
deleted file mode 100644
index 7806b11b1f..0000000000
--- a/browser/experiments/test/addons/experiment-1a/install.rdf
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0"?>
-
-<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-
- <Description about="urn:mozilla:install-manifest">
- <em:id>test-experiment-1@tests.mozilla.org</em:id>
- <em:version>1.1</em:version>
- <em:type>128</em:type>
-
- <!-- Front End MetaData -->
- <em:name>Test experiment 1.1</em:name>
- <em:description>And yet another experiment that experiments experimentally.</em:description>
-
- </Description>
-</RDF>
diff --git a/browser/experiments/test/addons/experiment-2/install.rdf b/browser/experiments/test/addons/experiment-2/install.rdf
deleted file mode 100644
index 69122c0ef9..0000000000
--- a/browser/experiments/test/addons/experiment-2/install.rdf
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0"?>
-
-<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-
- <Description about="urn:mozilla:install-manifest">
- <em:id>test-experiment-2@tests.mozilla.org</em:id>
- <em:version>1</em:version>
- <em:type>128</em:type>
-
- <!-- Front End MetaData -->
- <em:name>Test experiment 2</em:name>
- <em:description>And yet another experiment that experiments experimentally.</em:description>
-
- </Description>
-</RDF>
diff --git a/browser/experiments/test/addons/experiment-racybranch/bootstrap.js b/browser/experiments/test/addons/experiment-racybranch/bootstrap.js
deleted file mode 100644
index e8278f50f5..0000000000
--- a/browser/experiments/test/addons/experiment-racybranch/bootstrap.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/* exported startup, shutdown, install, uninstall */
-
-var {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-
-Cu.import("resource:///modules/experiments/Experiments.jsm");
-
-var gStarted = false;
-
-function startup(data, reasonCode) {
- if (gStarted) {
- return;
- }
- gStarted = true;
-
- // delay realstartup to trigger the race condition
- Cc['@mozilla.org/thread-manager;1'].getService(Ci.nsIThreadManager)
- .mainThread.dispatch(realstartup, 0);
-}
-
-function realstartup() {
- let experiments = Experiments.instance();
- let experiment = experiments._getActiveExperiment();
- if (experiment.branch) {
- Cu.reportError("Found pre-existing branch: " + experiment.branch);
- return;
- }
-
- let branch = "racy-set";
- experiments.setExperimentBranch(experiment.id, branch)
- .then(null, Cu.reportError);
-}
-
-function shutdown() { }
-function install() { }
-function uninstall() { }
diff --git a/browser/experiments/test/addons/experiment-racybranch/install.rdf b/browser/experiments/test/addons/experiment-racybranch/install.rdf
deleted file mode 100644
index cebaede565..0000000000
--- a/browser/experiments/test/addons/experiment-racybranch/install.rdf
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0"?>
-
-<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-
- <Description about="urn:mozilla:install-manifest">
- <em:id>test-experiment-racybranch@tests.mozilla.org</em:id>
- <em:version>1</em:version>
- <em:type>128</em:type>
-
- <!-- Front End MetaData -->
- <em:name>Test experiment racybranch</em:name>
- <em:description>An experiment that sets the experiment branch in a potentially racy way.</em:description>
-
- </Description>
-</RDF>
diff --git a/browser/experiments/test/xpcshell/.eslintrc.js b/browser/experiments/test/xpcshell/.eslintrc.js
deleted file mode 100644
index 1f540a05bd..0000000000
--- a/browser/experiments/test/xpcshell/.eslintrc.js
+++ /dev/null
@@ -1,15 +0,0 @@
-"use strict";
-
-module.exports = {
- "extends": [
- "../../../../testing/xpcshell/xpcshell.eslintrc.js"
- ],
-
- "rules": {
- "no-unused-vars": ["error", {
- "vars": "all",
- "varsIgnorePattern": "^(Cc|Ci|Cr|Cu|EXPORTED_SYMBOLS)$",
- "args": "none"
- }]
- }
-};
diff --git a/browser/experiments/test/xpcshell/experiments_1.manifest b/browser/experiments/test/xpcshell/experiments_1.manifest
deleted file mode 100644
index 0401ea3281..0000000000
--- a/browser/experiments/test/xpcshell/experiments_1.manifest
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "version": 1,
- "experiments": [
- {
- "id": "test-experiment-1@tests.mozilla.org",
- "xpiURL": "https://experiments.mozilla.org/foo.xpi",
- "xpiHash": "sha1:cb1eb32b89d86d78b7326f416cf404548c5e0099",
- "startTime": 1393000000,
- "endTime": 1394000000,
- "appName": ["Firefox", "Fennec"],
- "minVersion": "28",
- "maxVersion": "30",
- "maxActiveSeconds": 60,
- "os": ["windows", "linux", "osx"],
- "channel": ["daily", "weekly", "nightly"],
- "jsfilter": "function filter(context) { return true; }"
- }
- ]
-}
diff --git a/browser/experiments/test/xpcshell/head.js b/browser/experiments/test/xpcshell/head.js
deleted file mode 100644
index ae356ea2d5..0000000000
--- a/browser/experiments/test/xpcshell/head.js
+++ /dev/null
@@ -1,199 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-/* exported PREF_EXPERIMENTS_ENABLED, PREF_LOGGING_LEVEL, PREF_LOGGING_DUMP
- PREF_MANIFEST_URI, PREF_FETCHINTERVAL, EXPERIMENT1_ID,
- EXPERIMENT1_NAME, EXPERIMENT1_XPI_SHA1, EXPERIMENT1A_NAME,
- EXPERIMENT1A_XPI_SHA1, EXPERIMENT2_ID, EXPERIMENT2_XPI_SHA1,
- EXPERIMENT3_ID, EXPERIMENT4_ID, FAKE_EXPERIMENTS_1,
- FAKE_EXPERIMENTS_2, gAppInfo, removeCacheFile, defineNow,
- futureDate, dateToSeconds, loadAddonManager, promiseRestartManager,
- startAddonManagerOnly, getExperimentAddons, replaceExperiments */
-
-var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Promise.jsm");
-Cu.import("resource://gre/modules/Task.jsm");
-Cu.import("resource://gre/modules/osfile.jsm");
-Cu.import("resource://testing-common/AddonManagerTesting.jsm");
-Cu.import("resource://testing-common/AddonTestUtils.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "AddonManager",
- "resource://gre/modules/AddonManager.jsm");
-
-const PREF_EXPERIMENTS_ENABLED = "experiments.enabled";
-const PREF_LOGGING_LEVEL = "experiments.logging.level";
-const PREF_LOGGING_DUMP = "experiments.logging.dump";
-const PREF_MANIFEST_URI = "experiments.manifest.uri";
-const PREF_FETCHINTERVAL = "experiments.manifest.fetchIntervalSeconds";
-const PREF_TELEMETRY_ENABLED = "toolkit.telemetry.enabled";
-
-function getExperimentPath(base) {
- let p = do_get_cwd();
- p.append(base);
- return p.path;
-}
-
-function sha1File(path) {
- let f = Cc["@mozilla.org/file/local;1"]
- .createInstance(Ci.nsILocalFile);
- f.initWithPath(path);
- let hasher = Cc["@mozilla.org/security/hash;1"]
- .createInstance(Ci.nsICryptoHash);
- hasher.init(hasher.SHA1);
-
- let is = Cc["@mozilla.org/network/file-input-stream;1"]
- .createInstance(Ci.nsIFileInputStream);
- is.init(f, -1, 0, 0);
- hasher.updateFromStream(is, Math.pow(2, 32) - 1);
- is.close();
- let bytes = hasher.finish(false);
-
- let rv = "";
- for (let i = 0; i < bytes.length; i++) {
- rv += ("0" + bytes.charCodeAt(i).toString(16)).substr(-2);
- }
- return rv;
-}
-
-const EXPERIMENT1_ID = "test-experiment-1@tests.mozilla.org";
-const EXPERIMENT1_XPI_NAME = "experiment-1.xpi";
-const EXPERIMENT1_NAME = "Test experiment 1";
-const EXPERIMENT1_PATH = getExperimentPath(EXPERIMENT1_XPI_NAME);
-const EXPERIMENT1_XPI_SHA1 = "sha1:" + sha1File(EXPERIMENT1_PATH);
-
-
-const EXPERIMENT1A_XPI_NAME = "experiment-1a.xpi";
-const EXPERIMENT1A_NAME = "Test experiment 1.1";
-const EXPERIMENT1A_PATH = getExperimentPath(EXPERIMENT1A_XPI_NAME);
-const EXPERIMENT1A_XPI_SHA1 = "sha1:" + sha1File(EXPERIMENT1A_PATH);
-
-const EXPERIMENT2_ID = "test-experiment-2@tests.mozilla.org"
-const EXPERIMENT2_XPI_NAME = "experiment-2.xpi";
-const EXPERIMENT2_PATH = getExperimentPath(EXPERIMENT2_XPI_NAME);
-const EXPERIMENT2_XPI_SHA1 = "sha1:" + sha1File(EXPERIMENT2_PATH);
-
-const EXPERIMENT3_ID = "test-experiment-3@tests.mozilla.org";
-const EXPERIMENT4_ID = "test-experiment-4@tests.mozilla.org";
-
-const FAKE_EXPERIMENTS_1 = [
- {
- id: "id1",
- name: "experiment1",
- description: "experiment 1",
- active: true,
- detailUrl: "https://dummy/experiment1",
- branch: "foo",
- },
-];
-
-const FAKE_EXPERIMENTS_2 = [
- {
- id: "id2",
- name: "experiment2",
- description: "experiment 2",
- active: false,
- endDate: new Date(2014, 2, 11, 2, 4, 35, 42).getTime(),
- detailUrl: "https://dummy/experiment2",
- branch: null,
- },
- {
- id: "id1",
- name: "experiment1",
- description: "experiment 1",
- active: false,
- endDate: new Date(2014, 2, 10, 0, 0, 0, 0).getTime(),
- detailURL: "https://dummy/experiment1",
- branch: null,
- },
-];
-
-var gAppInfo = null;
-
-function removeCacheFile() {
- let path = OS.Path.join(OS.Constants.Path.profileDir, "experiments.json");
- return OS.File.remove(path);
-}
-
-function patchPolicy(policy, data) {
- for (let key of Object.keys(data)) {
- Object.defineProperty(policy, key, {
- value: data[key],
- writable: true,
- });
- }
-}
-
-function defineNow(policy, time) {
- patchPolicy(policy, { now: () => new Date(time) });
-}
-
-function futureDate(date, offset) {
- return new Date(date.getTime() + offset);
-}
-
-function dateToSeconds(date) {
- return date.getTime() / 1000;
-}
-
-var gGlobalScope = this;
-function loadAddonManager() {
- AddonTestUtils.init(gGlobalScope);
- AddonTestUtils.overrideCertDB();
- createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
- return AddonTestUtils.promiseStartupManager();
-}
-
-const {
- promiseRestartManager,
-} = AddonTestUtils;
-
-// Starts the addon manager without creating app info. We can't directly use
-// |loadAddonManager| defined above in test_conditions.js as it would make the test fail.
-function startAddonManagerOnly() {
- let addonManager = Cc["@mozilla.org/addons/integration;1"]
- .getService(Ci.nsIObserver)
- .QueryInterface(Ci.nsITimerCallback);
- addonManager.observe(null, "addons-startup", null);
-}
-
-function getExperimentAddons(previous=false) {
- let deferred = Promise.defer();
-
- AddonManager.getAddonsByTypes(["experiment"], (addons) => {
- if (previous) {
- deferred.resolve(addons);
- } else {
- deferred.resolve(addons.filter(a => !a.appDisabled));
- }
- });
-
- return deferred.promise;
-}
-
-function createAppInfo(ID="xpcshell@tests.mozilla.org", name="XPCShell",
- version="1.0", platformVersion="1.0") {
- AddonTestUtils.createAppInfo(ID, name, version, platformVersion);
- gAppInfo = AddonTestUtils.appInfo;
-}
-
-/**
- * Replace the experiments on an Experiments with a new list.
- *
- * This monkeypatches getExperiments(). It doesn't monkeypatch the internal
- * experiments list. So its utility is not as great as it could be.
- */
-function replaceExperiments(experiment, list) {
- Object.defineProperty(experiment, "getExperiments", {
- writable: true,
- value: () => {
- return Promise.resolve(list);
- },
- });
-}
-
-// Experiments require Telemetry to be enabled, and that's not true for debug
-// builds. Let's just enable it here instead of going through each test.
-Services.prefs.setBoolPref(PREF_TELEMETRY_ENABLED, true);
diff --git a/browser/experiments/test/xpcshell/test_activate.js b/browser/experiments/test/xpcshell/test_activate.js
deleted file mode 100644
index 60deafbfb3..0000000000
--- a/browser/experiments/test/xpcshell/test_activate.js
+++ /dev/null
@@ -1,151 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-Cu.import("resource://testing-common/httpd.js");
-Cu.import("resource:///modules/experiments/Experiments.jsm");
-
-const SEC_IN_ONE_DAY = 24 * 60 * 60;
-const MS_IN_ONE_DAY = SEC_IN_ONE_DAY * 1000;
-
-var gHttpServer = null;
-var gHttpRoot = null;
-var gPolicy = null;
-
-function ManifestEntry(data) {
- this.id = data.id || EXPERIMENT1_ID;
- this.xpiURL = data.xpiURL || gHttpRoot + EXPERIMENT1_XPI_NAME;
- this.xpiHash = data.xpiHash || EXPERIMENT1_XPI_SHA1;
- this.appName = data.appName || ["XPCShell"];
- this.channel = data.appName || ["nightly"];
- this.startTime = data.startTime || new Date(2010, 0, 1, 12).getTime() / 1000;
- this.endTime = data.endTime || new Date(9001, 0, 1, 12).getTime() / 1000;
- this.maxActiveSeconds = data.maxActiveSeconds || 5 * SEC_IN_ONE_DAY;
-}
-
-function run_test() {
- run_next_test();
-}
-
-add_task(function* test_setup() {
- loadAddonManager();
- gPolicy = new Experiments.Policy();
-
- gHttpServer = new HttpServer();
- gHttpServer.start(-1);
- let port = gHttpServer.identity.primaryPort;
- gHttpRoot = "http://localhost:" + port + "/";
- gHttpServer.registerDirectory("/", do_get_cwd());
- do_register_cleanup(() => gHttpServer.stop(() => {}));
-
- patchPolicy(gPolicy, {
- updatechannel: () => "nightly",
- });
-
- Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
- Services.prefs.setIntPref(PREF_LOGGING_LEVEL, 0);
- Services.prefs.setBoolPref(PREF_LOGGING_DUMP, true);
-});
-
-function isApplicable(experiment) {
- let deferred = Promise.defer();
- experiment.isApplicable().then(
- result => deferred.resolve({ applicable: true, reason: null }),
- reason => deferred.resolve({ applicable: false, reason: reason })
- );
-
- return deferred.promise;
-}
-
-add_task(function* test_startStop() {
- let baseDate = new Date(2014, 5, 1, 12);
- let startDate = futureDate(baseDate, 30 * MS_IN_ONE_DAY);
- let endDate = futureDate(baseDate, 60 * MS_IN_ONE_DAY);
- let manifestData = new ManifestEntry({
- startTime: dateToSeconds(startDate),
- endTime: dateToSeconds(endDate),
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- });
- let experiment = new Experiments.ExperimentEntry(gPolicy);
- experiment.initFromManifestData(manifestData);
-
- // We need to associate it with the singleton so the onInstallStarted
- // Addon Manager listener will know about it.
- Experiments.instance()._experiments = new Map();
- Experiments.instance()._experiments.set(experiment.id, experiment);
-
- let result;
-
- defineNow(gPolicy, baseDate);
- result = yield isApplicable(experiment);
- Assert.equal(result.applicable, false, "Experiment should not be applicable.");
- Assert.equal(experiment.enabled, false, "Experiment should not be enabled.");
-
- let addons = yield getExperimentAddons();
- Assert.equal(addons.length, 0, "No experiment add-ons are installed.");
-
- defineNow(gPolicy, futureDate(startDate, 5 * MS_IN_ONE_DAY));
- result = yield isApplicable(experiment);
- Assert.equal(result.applicable, true, "Experiment should now be applicable.");
- Assert.equal(experiment.enabled, false, "Experiment should not be enabled.");
-
- let changes = yield experiment.start();
- Assert.equal(changes, experiment.ADDON_CHANGE_INSTALL, "Add-on was installed.");
- addons = yield getExperimentAddons();
- Assert.equal(experiment.enabled, true, "Experiment should now be enabled.");
- Assert.equal(addons.length, 1, "1 experiment add-on is installed.");
- Assert.equal(addons[0].id, experiment._addonId, "The add-on is the one we expect.");
- Assert.equal(addons[0].userDisabled, false, "The add-on is not userDisabled.");
- Assert.ok(addons[0].isActive, "The add-on is active.");
-
- changes = yield experiment.stop();
- Assert.equal(changes, experiment.ADDON_CHANGE_UNINSTALL, "Add-on was uninstalled.");
- addons = yield getExperimentAddons();
- Assert.equal(experiment.enabled, false, "Experiment should not be enabled.");
- Assert.equal(addons.length, 0, "Experiment should be uninstalled from the Addon Manager.");
-
- changes = yield experiment.start();
- Assert.equal(changes, experiment.ADDON_CHANGE_INSTALL, "Add-on was installed.");
- addons = yield getExperimentAddons();
- Assert.equal(experiment.enabled, true, "Experiment should now be enabled.");
- Assert.equal(addons.length, 1, "1 experiment add-on is installed.");
- Assert.equal(addons[0].id, experiment._addonId, "The add-on is the one we expect.");
- Assert.equal(addons[0].userDisabled, false, "The add-on is not userDisabled.");
- Assert.ok(addons[0].isActive, "The add-on is active.");
-
- result = yield experiment.shouldStop();
- Assert.equal(result.shouldStop, false, "shouldStop should be false.");
- Assert.equal(experiment.enabled, true, "Experiment should be enabled.");
- addons = yield getExperimentAddons();
- Assert.equal(addons.length, 1, "Experiment still in add-ons manager.");
- Assert.ok(addons[0].isActive, "The add-on is still active.");
-
- defineNow(gPolicy, futureDate(endDate, MS_IN_ONE_DAY));
- result = yield experiment.shouldStop();
- Assert.equal(result.shouldStop, true, "shouldStop should now be true.");
- changes = yield experiment.stop();
- Assert.equal(changes, experiment.ADDON_CHANGE_UNINSTALL, "Add-on should be uninstalled.");
- Assert.equal(experiment.enabled, false, "Experiment should be disabled.");
- addons = yield getExperimentAddons();
- Assert.equal(addons.length, 0, "Experiment add-on is uninstalled.");
-
- // Ensure hash validation works.
- // We set an incorrect hash and expect the install to fail.
- experiment._manifestData.xpiHash = "sha1:41014dcc66b4dcedcd973491a1530a32f0517d8a";
- let errored = false;
- try {
- yield experiment.start();
- } catch (ex) {
- errored = true;
- }
- Assert.ok(experiment._failedStart, "Experiment failed to start.");
- Assert.ok(errored, "start() threw an exception.");
-
- // Make sure "ignore hashes" mode works.
- gPolicy.ignoreHashes = true;
- changes = yield experiment.start();
- Assert.equal(changes, experiment.ADDON_CHANGE_INSTALL);
- yield experiment.stop();
- gPolicy.ignoreHashes = false;
-});
diff --git a/browser/experiments/test/xpcshell/test_api.js b/browser/experiments/test/xpcshell/test_api.js
deleted file mode 100644
index 9f0112570d..0000000000
--- a/browser/experiments/test/xpcshell/test_api.js
+++ /dev/null
@@ -1,1647 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-Cu.import("resource://testing-common/httpd.js");
-Cu.import("resource://testing-common/AddonManagerTesting.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "Experiments",
- "resource:///modules/experiments/Experiments.jsm");
-
-const MANIFEST_HANDLER = "manifests/handler";
-
-const SEC_IN_ONE_DAY = 24 * 60 * 60;
-const MS_IN_ONE_DAY = SEC_IN_ONE_DAY * 1000;
-
-var gHttpServer = null;
-var gHttpRoot = null;
-var gDataRoot = null;
-var gPolicy = null;
-var gManifestObject = null;
-var gManifestHandlerURI = null;
-var gTimerScheduleOffset = -1;
-
-function uninstallExperimentAddons() {
- return Task.spawn(function* () {
- let addons = yield getExperimentAddons();
- for (let a of addons) {
- yield AddonManagerTesting.uninstallAddonByID(a.id);
- }
- });
-}
-
-function testCleanup(experimentsInstance) {
- return Task.spawn(function* () {
- yield promiseRestartManager();
- yield uninstallExperimentAddons();
- yield removeCacheFile();
- });
-}
-
-function run_test() {
- run_next_test();
-}
-
-add_task(function* test_setup() {
- loadAddonManager();
-
- gHttpServer = new HttpServer();
- gHttpServer.start(-1);
- let port = gHttpServer.identity.primaryPort;
- gHttpRoot = "http://localhost:" + port + "/";
- gDataRoot = gHttpRoot + "data/";
- gManifestHandlerURI = gHttpRoot + MANIFEST_HANDLER;
- gHttpServer.registerDirectory("/data/", do_get_cwd());
- gHttpServer.registerPathHandler("/" + MANIFEST_HANDLER, (request, response) => {
- response.setStatusLine(null, 200, "OK");
- response.write(JSON.stringify(gManifestObject));
- response.processAsync();
- response.finish();
- });
- do_register_cleanup(() => gHttpServer.stop(() => {}));
-
- Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
- Services.prefs.setIntPref(PREF_LOGGING_LEVEL, 0);
- Services.prefs.setBoolPref(PREF_LOGGING_DUMP, true);
- Services.prefs.setCharPref(PREF_MANIFEST_URI, gManifestHandlerURI);
- Services.prefs.setIntPref(PREF_FETCHINTERVAL, 0);
-
- gPolicy = new Experiments.Policy();
- patchPolicy(gPolicy, {
- updatechannel: () => "nightly",
- oneshotTimer: (callback, timeout, thisObj, name) => gTimerScheduleOffset = timeout,
- });
-});
-
-add_task(function* test_contract() {
- Cc["@mozilla.org/browser/experiments-service;1"].getService();
-});
-
-// Test basic starting and stopping of experiments.
-
-add_task(function* test_getExperiments() {
- const OBSERVER_TOPIC = "experiments-changed";
- let observerFireCount = 0;
- let expectedObserverFireCount = 0;
- let observer = () => ++observerFireCount;
- Services.obs.addObserver(observer, OBSERVER_TOPIC, false);
-
- // Dates the following tests are based on.
-
- let baseDate = new Date(2014, 5, 1, 12);
- let startDate1 = futureDate(baseDate, 50 * MS_IN_ONE_DAY);
- let endDate1 = futureDate(baseDate, 100 * MS_IN_ONE_DAY);
- let startDate2 = futureDate(baseDate, 150 * MS_IN_ONE_DAY);
- let endDate2 = futureDate(baseDate, 200 * MS_IN_ONE_DAY);
-
- // The manifest data we test with.
-
- gManifestObject = {
- "version": 1,
- experiments: [
- {
- id: EXPERIMENT2_ID,
- xpiURL: gDataRoot + EXPERIMENT2_XPI_NAME,
- xpiHash: EXPERIMENT2_XPI_SHA1,
- startTime: dateToSeconds(startDate2),
- endTime: dateToSeconds(endDate2),
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- {
- id: EXPERIMENT1_ID,
- xpiURL: gDataRoot + EXPERIMENT1_XPI_NAME,
- xpiHash: EXPERIMENT1_XPI_SHA1,
- startTime: dateToSeconds(startDate1),
- endTime: dateToSeconds(endDate1),
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- ],
- };
-
- // Data to compare the result of Experiments.getExperiments() against.
-
- let experimentListData = [
- {
- id: EXPERIMENT2_ID,
- name: "Test experiment 2",
- description: "And yet another experiment that experiments experimentally.",
- },
- {
- id: EXPERIMENT1_ID,
- name: EXPERIMENT1_NAME,
- description: "Yet another experiment that experiments experimentally.",
- },
- ];
-
- let experiments = new Experiments.Experiments(gPolicy);
-
- // Trigger update, clock set to before any activation.
- // Use updateManifest() to provide for coverage of that path.
-
- let now = baseDate;
- gTimerScheduleOffset = -1;
- defineNow(gPolicy, now);
-
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
- Assert.equal(experiments.getActiveExperimentID(), null,
- "getActiveExperimentID should return null");
-
- let list = yield experiments.getExperiments();
- Assert.equal(list.length, 0, "Experiment list should be empty.");
- let addons = yield getExperimentAddons();
- Assert.equal(addons.length, 0, "Precondition: No experiment add-ons are installed.");
-
- try {
- yield experiments.getExperimentBranch();
- Assert.ok(false, "getExperimentBranch should fail with no experiment");
- }
- catch (e) {
- Assert.ok(true, "getExperimentBranch correctly threw");
- }
-
- // Trigger update, clock set for experiment 1 to start.
-
- now = futureDate(startDate1, 5 * MS_IN_ONE_DAY);
- gTimerScheduleOffset = -1;
- defineNow(gPolicy, now);
-
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
-
- Assert.equal(experiments.getActiveExperimentID(), EXPERIMENT1_ID,
- "getActiveExperimentID should return the active experiment1");
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry now.");
- addons = yield getExperimentAddons();
- Assert.equal(addons.length, 1, "An experiment add-on was installed.");
-
- experimentListData[1].active = true;
- experimentListData[1].endDate = now.getTime() + 10 * MS_IN_ONE_DAY;
- for (let k of Object.keys(experimentListData[1])) {
- Assert.equal(experimentListData[1][k], list[0][k],
- "Property " + k + " should match reference data.");
- }
-
- let b = yield experiments.getExperimentBranch();
- Assert.strictEqual(b, null, "getExperimentBranch should return null by default");
-
- b = yield experiments.getExperimentBranch(EXPERIMENT1_ID);
- Assert.strictEqual(b, null, "getExperimentsBranch should return null (with id)");
-
- yield experiments.setExperimentBranch(EXPERIMENT1_ID, "foo");
- b = yield experiments.getExperimentBranch();
- Assert.strictEqual(b, "foo", "getExperimentsBranch should return the set value");
-
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
-
- Assert.equal(gTimerScheduleOffset, 10 * MS_IN_ONE_DAY,
- "Experiment re-evaluation should have been scheduled correctly.");
-
- // Trigger update, clock set for experiment 1 to stop.
-
- now = futureDate(endDate1, 1000);
- gTimerScheduleOffset = -1;
- defineNow(gPolicy, now);
-
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
-
- Assert.equal(experiments.getActiveExperimentID(), null,
- "getActiveExperimentID should return null again");
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry.");
- addons = yield getExperimentAddons();
- Assert.equal(addons.length, 0, "The experiment add-on should be uninstalled.");
-
- experimentListData[1].active = false;
- experimentListData[1].endDate = now.getTime();
- for (let k of Object.keys(experimentListData[1])) {
- Assert.equal(experimentListData[1][k], list[0][k],
- "Property " + k + " should match reference data.");
- }
-
- Assert.equal(gTimerScheduleOffset, startDate2 - now,
- "Experiment re-evaluation should have been scheduled correctly.");
-
- // Trigger update, clock set for experiment 2 to start.
- // Use notify() to provide for coverage of that path.
-
- now = startDate2;
- gTimerScheduleOffset = -1;
- defineNow(gPolicy, now);
-
- yield experiments.notify();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
-
- Assert.equal(experiments.getActiveExperimentID(), EXPERIMENT2_ID,
- "getActiveExperimentID should return the active experiment2");
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 2, "Experiment list should have 2 entries now.");
- addons = yield getExperimentAddons();
- Assert.equal(addons.length, 1, "An experiment add-on is installed.");
-
- experimentListData[0].active = true;
- experimentListData[0].endDate = now.getTime() + 10 * MS_IN_ONE_DAY;
- for (let i=0; i<experimentListData.length; ++i) {
- let entry = experimentListData[i];
- for (let k of Object.keys(entry)) {
- Assert.equal(entry[k], list[i][k],
- "Entry " + i + " - Property '" + k + "' should match reference data.");
- }
- }
-
- Assert.equal(gTimerScheduleOffset, 10 * MS_IN_ONE_DAY,
- "Experiment re-evaluation should have been scheduled correctly.");
-
- // Trigger update, clock set for experiment 2 to stop.
-
- now = futureDate(startDate2, 10 * MS_IN_ONE_DAY + 1000);
- gTimerScheduleOffset = -1;
- defineNow(gPolicy, now);
- yield experiments.notify();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
-
- Assert.equal(experiments.getActiveExperimentID(), null,
- "getActiveExperimentID should return null again2");
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 2, "Experiment list should have 2 entries now.");
- addons = yield getExperimentAddons();
- Assert.equal(addons.length, 0, "No experiments add-ons are installed.");
-
- experimentListData[0].active = false;
- experimentListData[0].endDate = now.getTime();
- for (let i=0; i<experimentListData.length; ++i) {
- let entry = experimentListData[i];
- for (let k of Object.keys(entry)) {
- Assert.equal(entry[k], list[i][k],
- "Entry " + i + " - Property '" + k + "' should match reference data.");
- }
- }
-
- // Cleanup.
-
- Services.obs.removeObserver(observer, OBSERVER_TOPIC);
- yield testCleanup(experiments);
-});
-
-add_task(function* test_getActiveExperimentID() {
- // Check that getActiveExperimentID returns the correct result even
- // after .uninit()
-
- // Dates the following tests are based on.
-
- let baseDate = new Date(2014, 5, 1, 12);
- let startDate1 = futureDate(baseDate, 50 * MS_IN_ONE_DAY);
- let endDate1 = futureDate(baseDate, 100 * MS_IN_ONE_DAY);
-
- gManifestObject = {
- "version": 1,
- experiments: [
- {
- id: EXPERIMENT1_ID,
- xpiURL: gDataRoot + EXPERIMENT1_XPI_NAME,
- xpiHash: EXPERIMENT1_XPI_SHA1,
- startTime: dateToSeconds(startDate1),
- endTime: dateToSeconds(endDate1),
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- ],
- };
-
- let now = futureDate(startDate1, 5 * MS_IN_ONE_DAY);
- gTimerScheduleOffset = -1;
- defineNow(gPolicy, now);
-
- let experiments = new Experiments.Experiments(gPolicy);
- yield experiments.updateManifest();
-
- Assert.equal(experiments.getActiveExperimentID(), EXPERIMENT1_ID,
- "getActiveExperimentID should return the active experiment1");
-
- yield promiseRestartManager();
- Assert.equal(experiments.getActiveExperimentID(), EXPERIMENT1_ID,
- "getActiveExperimentID should return the active experiment1 after uninit()");
-
- yield testCleanup(experiments);
-});
-
-// Test that we handle the experiments addon already being
-// installed properly.
-// We should just pave over them.
-
-add_task(function* test_addonAlreadyInstalled() {
- const OBSERVER_TOPIC = "experiments-changed";
- let observerFireCount = 0;
- let expectedObserverFireCount = 0;
- let observer = () => ++observerFireCount;
- Services.obs.addObserver(observer, OBSERVER_TOPIC, false);
-
- // Dates the following tests are based on.
-
- let baseDate = new Date(2014, 5, 1, 12);
- let startDate = futureDate(baseDate, 100 * MS_IN_ONE_DAY);
- let endDate = futureDate(baseDate, 10000 * MS_IN_ONE_DAY);
-
- // The manifest data we test with.
-
- gManifestObject = {
- "version": 1,
- experiments: [
- {
- id: EXPERIMENT1_ID,
- xpiURL: gDataRoot + EXPERIMENT1_XPI_NAME,
- xpiHash: EXPERIMENT1_XPI_SHA1,
- startTime: dateToSeconds(startDate),
- endTime: dateToSeconds(endDate),
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- ],
- };
-
- let experiments = new Experiments.Experiments(gPolicy);
-
- // Trigger update, clock set to before any activation.
-
- let now = baseDate;
- defineNow(gPolicy, now);
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
- let list = yield experiments.getExperiments();
- Assert.equal(list.length, 0, "Experiment list should be empty.");
-
- // Trigger update, clock set for the experiment to start.
-
- now = futureDate(startDate, 10 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
-
- list = yield experiments.getExperiments();
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry now.");
- Assert.equal(list[0].id, EXPERIMENT1_ID, "Experiment 1 should be the sole entry.");
- Assert.equal(list[0].active, true, "Experiment 1 should be active.");
-
- let addons = yield getExperimentAddons();
- Assert.equal(addons.length, 1, "1 add-on is installed.");
-
- // Install conflicting addon.
-
- yield AddonManagerTesting.installXPIFromURL(gDataRoot + EXPERIMENT1_XPI_NAME, EXPERIMENT1_XPI_SHA1);
- addons = yield getExperimentAddons();
- Assert.equal(addons.length, 1, "1 add-on is installed.");
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should still have 1 entry.");
- Assert.equal(list[0].id, EXPERIMENT1_ID, "Experiment 1 should be the sole entry.");
- Assert.equal(list[0].active, true, "Experiment 1 should be active.");
-
- // Cleanup.
-
- Services.obs.removeObserver(observer, OBSERVER_TOPIC);
- yield testCleanup(experiments);
-});
-
-add_task(function* test_lastActiveToday() {
- let experiments = new Experiments.Experiments(gPolicy);
-
- replaceExperiments(experiments, FAKE_EXPERIMENTS_1);
-
- let e = yield experiments.getExperiments();
- Assert.equal(e.length, 1, "Monkeypatch successful.");
- Assert.equal(e[0].id, "id1", "ID looks sane");
- Assert.ok(e[0].active, "Experiment is active.");
-
- let lastActive = yield experiments.lastActiveToday();
- Assert.equal(e[0], lastActive, "Last active object is expected.");
-
- replaceExperiments(experiments, FAKE_EXPERIMENTS_2);
- e = yield experiments.getExperiments();
- Assert.equal(e.length, 2, "Monkeypatch successful.");
-
- defineNow(gPolicy, e[0].endDate);
-
- lastActive = yield experiments.lastActiveToday();
- Assert.ok(lastActive, "Have a last active experiment");
- Assert.equal(lastActive, e[0], "Last active object is expected.");
-
- yield testCleanup(experiments);
-});
-
-// Test explicitly disabling experiments.
-
-add_task(function* test_disableExperiment() {
- // Dates this test is based on.
-
- let startDate = new Date(2004, 10, 9, 12);
- let endDate = futureDate(startDate, 100 * MS_IN_ONE_DAY);
-
- // The manifest data we test with.
-
- gManifestObject = {
- "version": 1,
- experiments: [
- {
- id: EXPERIMENT1_ID,
- xpiURL: gDataRoot + EXPERIMENT1_XPI_NAME,
- xpiHash: EXPERIMENT1_XPI_SHA1,
- startTime: dateToSeconds(startDate),
- endTime: dateToSeconds(endDate),
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- ],
- };
-
- // Data to compare the result of Experiments.getExperiments() against.
-
- let experimentInfo = {
- id: EXPERIMENT1_ID,
- name: EXPERIMENT1_NAME,
- description: "Yet another experiment that experiments experimentally.",
- };
-
- let experiments = new Experiments.Experiments(gPolicy);
-
- // Trigger update, clock set for the experiment to start.
-
- let now = futureDate(startDate, 5 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- yield experiments.updateManifest();
-
- let list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry now.");
-
- experimentInfo.active = true;
- experimentInfo.endDate = now.getTime() + 10 * MS_IN_ONE_DAY;
- for (let k of Object.keys(experimentInfo)) {
- Assert.equal(experimentInfo[k], list[0][k],
- "Property " + k + " should match reference data.");
- }
-
- // Test disabling the experiment.
-
- now = futureDate(now, 1 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- yield experiments.disableExperiment("foo");
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry.");
-
- experimentInfo.active = false;
- experimentInfo.endDate = now.getTime();
- for (let k of Object.keys(experimentInfo)) {
- Assert.equal(experimentInfo[k], list[0][k],
- "Property " + k + " should match reference data.");
- }
-
- // Test that updating the list doesn't re-enable it.
-
- now = futureDate(now, 1 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- yield experiments.updateManifest();
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry.");
-
- for (let k of Object.keys(experimentInfo)) {
- Assert.equal(experimentInfo[k], list[0][k],
- "Property " + k + " should match reference data.");
- }
-
- yield testCleanup(experiments);
-});
-
-add_task(function* test_disableExperimentsFeature() {
- // Dates this test is based on.
-
- let startDate = new Date(2004, 10, 9, 12);
- let endDate = futureDate(startDate, 100 * MS_IN_ONE_DAY);
-
- // The manifest data we test with.
-
- gManifestObject = {
- "version": 1,
- experiments: [
- {
- id: EXPERIMENT1_ID,
- xpiURL: gDataRoot + EXPERIMENT1_XPI_NAME,
- xpiHash: EXPERIMENT1_XPI_SHA1,
- startTime: dateToSeconds(startDate),
- endTime: dateToSeconds(endDate),
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- ],
- };
-
- // Data to compare the result of Experiments.getExperiments() against.
-
- let experimentInfo = {
- id: EXPERIMENT1_ID,
- name: EXPERIMENT1_NAME,
- description: "Yet another experiment that experiments experimentally.",
- };
-
- let experiments = new Experiments.Experiments(gPolicy);
- Assert.equal(experiments.enabled, true, "Experiments feature should be enabled.");
-
- // Trigger update, clock set for the experiment to start.
-
- let now = futureDate(startDate, 5 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- yield experiments.updateManifest();
-
- let list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry now.");
-
- experimentInfo.active = true;
- experimentInfo.endDate = now.getTime() + 10 * MS_IN_ONE_DAY;
- for (let k of Object.keys(experimentInfo)) {
- Assert.equal(experimentInfo[k], list[0][k],
- "Property " + k + " should match reference data.");
- }
-
- // Test disabling experiments.
-
- experiments._toggleExperimentsEnabled(false);
- yield experiments.notify();
- Assert.equal(experiments.enabled, false, "Experiments feature should be disabled now.");
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry.");
-
- experimentInfo.active = false;
- experimentInfo.endDate = now.getTime();
- for (let k of Object.keys(experimentInfo)) {
- Assert.equal(experimentInfo[k], list[0][k],
- "Property " + k + " should match reference data.");
- }
-
- // Test that updating the list doesn't re-enable it.
-
- now = futureDate(now, 1 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- try {
- yield experiments.updateManifest();
- } catch (e) {
- // Exception expected, the feature is disabled.
- }
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry.");
-
- for (let k of Object.keys(experimentInfo)) {
- Assert.equal(experimentInfo[k], list[0][k],
- "Property " + k + " should match reference data.");
- }
-
- yield testCleanup(experiments);
-});
-
-// Test that after a failed experiment install:
-// * the next applicable experiment gets installed
-// * changing the experiments data later triggers re-evaluation
-
-add_task(function* test_installFailure() {
- const OBSERVER_TOPIC = "experiments-changed";
- let observerFireCount = 0;
- let expectedObserverFireCount = 0;
- let observer = () => ++observerFireCount;
- Services.obs.addObserver(observer, OBSERVER_TOPIC, false);
-
- // Dates the following tests are based on.
-
- let baseDate = new Date(2014, 5, 1, 12);
- let startDate = futureDate(baseDate, 100 * MS_IN_ONE_DAY);
- let endDate = futureDate(baseDate, 10000 * MS_IN_ONE_DAY);
-
- // The manifest data we test with.
-
- gManifestObject = {
- "version": 1,
- experiments: [
- {
- id: EXPERIMENT1_ID,
- xpiURL: gDataRoot + EXPERIMENT1_XPI_NAME,
- xpiHash: EXPERIMENT1_XPI_SHA1,
- startTime: dateToSeconds(startDate),
- endTime: dateToSeconds(endDate),
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- {
- id: EXPERIMENT2_ID,
- xpiURL: gDataRoot + EXPERIMENT2_XPI_NAME,
- xpiHash: EXPERIMENT2_XPI_SHA1,
- startTime: dateToSeconds(startDate),
- endTime: dateToSeconds(endDate),
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- ],
- };
-
- // Data to compare the result of Experiments.getExperiments() against.
-
- let experimentListData = [
- {
- id: EXPERIMENT1_ID,
- name: EXPERIMENT1_NAME,
- description: "Yet another experiment that experiments experimentally.",
- },
- {
- id: EXPERIMENT2_ID,
- name: "Test experiment 2",
- description: "And yet another experiment that experiments experimentally.",
- },
- ];
-
- let experiments = new Experiments.Experiments(gPolicy);
-
- // Trigger update, clock set to before any activation.
-
- let now = baseDate;
- defineNow(gPolicy, now);
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
- let list = yield experiments.getExperiments();
- Assert.equal(list.length, 0, "Experiment list should be empty.");
-
- // Trigger update, clock set for experiment 1 & 2 to start,
- // invalid hash for experiment 1.
- // Order in the manifest matters, so we should start experiment 1,
- // fail to install it & start experiment 2 instead.
-
- now = futureDate(startDate, 10 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- gManifestObject.experiments[0].xpiHash = "sha1:0000000000000000000000000000000000000000";
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry now.");
- Assert.equal(list[0].id, EXPERIMENT2_ID, "Experiment 2 should be the sole entry.");
- Assert.equal(list[0].active, true, "Experiment 2 should be active.");
-
- // Trigger update, clock set for experiment 2 to stop.
-
- now = futureDate(now, 20 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
-
- experimentListData[0].active = false;
- experimentListData[0].endDate = now;
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry now.");
- Assert.equal(list[0].id, EXPERIMENT2_ID, "Experiment 2 should be the sole entry.");
- Assert.equal(list[0].active, false, "Experiment should not be active.");
-
- // Trigger update with a fixed entry for experiment 1,
- // which should get re-evaluated & started now.
-
- now = futureDate(now, 20 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- gManifestObject.experiments[0].xpiHash = EXPERIMENT1_XPI_SHA1;
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
-
- experimentListData[0].active = true;
- experimentListData[0].endDate = now.getTime() + 10 * MS_IN_ONE_DAY;
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 2, "Experiment list should have 2 entries now.");
-
- for (let i=0; i<experimentListData.length; ++i) {
- let entry = experimentListData[i];
- for (let k of Object.keys(entry)) {
- Assert.equal(entry[k], list[i][k],
- "Entry " + i + " - Property '" + k + "' should match reference data.");
- }
- }
-
- yield testCleanup(experiments);
-});
-
-// Test that after an experiment was disabled by user action,
-// the experiment is not activated again if manifest data changes.
-
-add_task(function* test_userDisabledAndUpdated() {
- const OBSERVER_TOPIC = "experiments-changed";
- let observerFireCount = 0;
- let expectedObserverFireCount = 0;
- let observer = () => ++observerFireCount;
- Services.obs.addObserver(observer, OBSERVER_TOPIC, false);
-
- // Dates the following tests are based on.
-
- let baseDate = new Date(2014, 5, 1, 12);
- let startDate = futureDate(baseDate, 100 * MS_IN_ONE_DAY);
- let endDate = futureDate(baseDate, 10000 * MS_IN_ONE_DAY);
-
- // The manifest data we test with.
-
- gManifestObject = {
- "version": 1,
- experiments: [
- {
- id: EXPERIMENT1_ID,
- xpiURL: gDataRoot + EXPERIMENT1_XPI_NAME,
- xpiHash: EXPERIMENT1_XPI_SHA1,
- startTime: dateToSeconds(startDate),
- endTime: dateToSeconds(endDate),
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- ],
- };
-
- let experiments = new Experiments.Experiments(gPolicy);
-
- // Trigger update, clock set to before any activation.
-
- let now = baseDate;
- defineNow(gPolicy, now);
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
- let list = yield experiments.getExperiments();
- Assert.equal(list.length, 0, "Experiment list should be empty.");
-
- // Trigger update, clock set for experiment 1 to start.
-
- now = futureDate(startDate, 10 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry now.");
- Assert.equal(list[0].id, EXPERIMENT1_ID, "Experiment 1 should be the sole entry.");
- Assert.equal(list[0].active, true, "Experiment 1 should be active.");
- let todayActive = yield experiments.lastActiveToday();
- Assert.ok(todayActive, "Last active for today reports a value.");
- Assert.equal(todayActive.id, list[0].id, "The entry is what we expect.");
-
- // Explicitly disable an experiment.
-
- now = futureDate(now, 20 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- yield experiments.disableExperiment("foo");
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry now.");
- Assert.equal(list[0].id, EXPERIMENT1_ID, "Experiment 1 should be the sole entry.");
- Assert.equal(list[0].active, false, "Experiment should not be active anymore.");
- todayActive = yield experiments.lastActiveToday();
- Assert.ok(todayActive, "Last active for today still returns a value.");
- Assert.equal(todayActive.id, list[0].id, "The ID is still the same.");
-
- // Trigger an update with a faked change for experiment 1.
-
- now = futureDate(now, 20 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- experiments._experiments.get(EXPERIMENT1_ID)._manifestData.xpiHash =
- "sha1:0000000000000000000000000000000000000000";
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, expectedObserverFireCount,
- "Experiments observer should not have been called.");
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry now.");
- Assert.equal(list[0].id, EXPERIMENT1_ID, "Experiment 1 should be the sole entry.");
- Assert.equal(list[0].active, false, "Experiment should still be inactive.");
-
- // Cleanup.
-
- Services.obs.removeObserver(observer, OBSERVER_TOPIC);
- yield testCleanup(experiments);
-});
-
-// Test that changing the hash for an active experiments triggers an
-// update for it.
-
-add_task(function* test_updateActiveExperiment() {
- const OBSERVER_TOPIC = "experiments-changed";
- let observerFireCount = 0;
- let expectedObserverFireCount = 0;
- let observer = () => ++observerFireCount;
- Services.obs.addObserver(observer, OBSERVER_TOPIC, false);
-
- // Dates the following tests are based on.
-
- let baseDate = new Date(2014, 5, 1, 12);
- let startDate = futureDate(baseDate, 100 * MS_IN_ONE_DAY);
- let endDate = futureDate(baseDate, 10000 * MS_IN_ONE_DAY);
-
- // The manifest data we test with.
-
- gManifestObject = {
- "version": 1,
- experiments: [
- {
- id: EXPERIMENT1_ID,
- xpiURL: gDataRoot + EXPERIMENT1_XPI_NAME,
- xpiHash: EXPERIMENT1_XPI_SHA1,
- startTime: dateToSeconds(startDate),
- endTime: dateToSeconds(endDate),
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- ],
- };
-
- let experiments = new Experiments.Experiments(gPolicy);
-
- // Trigger update, clock set to before any activation.
-
- let now = baseDate;
- defineNow(gPolicy, now);
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
- let list = yield experiments.getExperiments();
- Assert.equal(list.length, 0, "Experiment list should be empty.");
-
- let todayActive = yield experiments.lastActiveToday();
- Assert.equal(todayActive, null, "No experiment active today.");
-
- // Trigger update, clock set for the experiment to start.
-
- now = futureDate(startDate, 10 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry now.");
- Assert.equal(list[0].id, EXPERIMENT1_ID, "Experiment 1 should be the sole entry.");
- Assert.equal(list[0].active, true, "Experiment 1 should be active.");
- Assert.equal(list[0].name, EXPERIMENT1_NAME, "Experiments name should match.");
- todayActive = yield experiments.lastActiveToday();
- Assert.ok(todayActive, "todayActive() returns a value.");
- Assert.equal(todayActive.id, list[0].id, "It returns the active experiment.");
-
- // Trigger an update for the active experiment by changing it's hash (and xpi)
- // in the manifest.
-
- now = futureDate(now, 1 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- gManifestObject.experiments[0].xpiHash = EXPERIMENT1A_XPI_SHA1;
- gManifestObject.experiments[0].xpiURL = gDataRoot + EXPERIMENT1A_XPI_NAME;
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry now.");
- Assert.equal(list[0].id, EXPERIMENT1_ID, "Experiment 1 should be the sole entry.");
- Assert.equal(list[0].active, true, "Experiment 1 should still be active.");
- Assert.equal(list[0].name, EXPERIMENT1A_NAME, "Experiments name should have been updated.");
- todayActive = yield experiments.lastActiveToday();
- Assert.equal(todayActive.id, list[0].id, "last active today is still sane.");
-
- // Cleanup.
-
- Services.obs.removeObserver(observer, OBSERVER_TOPIC);
- yield testCleanup(experiments);
-});
-
-// Tests that setting the disable flag for an active experiment
-// stops it.
-
-add_task(function* test_disableActiveExperiment() {
- const OBSERVER_TOPIC = "experiments-changed";
- let observerFireCount = 0;
- let expectedObserverFireCount = 0;
- let observer = () => ++observerFireCount;
- Services.obs.addObserver(observer, OBSERVER_TOPIC, false);
-
- // Dates the following tests are based on.
-
- let baseDate = new Date(2014, 5, 1, 12);
- let startDate = futureDate(baseDate, 100 * MS_IN_ONE_DAY);
- let endDate = futureDate(baseDate, 10000 * MS_IN_ONE_DAY);
-
- // The manifest data we test with.
-
- gManifestObject = {
- "version": 1,
- experiments: [
- {
- id: EXPERIMENT1_ID,
- xpiURL: gDataRoot + EXPERIMENT1_XPI_NAME,
- xpiHash: EXPERIMENT1_XPI_SHA1,
- startTime: dateToSeconds(startDate),
- endTime: dateToSeconds(endDate),
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- ],
- };
-
- let experiments = new Experiments.Experiments(gPolicy);
-
- // Trigger update, clock set to before any activation.
-
- let now = baseDate;
- defineNow(gPolicy, now);
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
- let list = yield experiments.getExperiments();
- Assert.equal(list.length, 0, "Experiment list should be empty.");
-
- // Trigger update, clock set for the experiment to start.
-
- now = futureDate(startDate, 10 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry now.");
- Assert.equal(list[0].id, EXPERIMENT1_ID, "Experiment 1 should be the sole entry.");
- Assert.equal(list[0].active, true, "Experiment 1 should be active.");
-
- // Trigger an update with the experiment being disabled.
-
- now = futureDate(now, 1 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- gManifestObject.experiments[0].disabled = true;
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry now.");
- Assert.equal(list[0].id, EXPERIMENT1_ID, "Experiment 1 should be the sole entry.");
- Assert.equal(list[0].active, false, "Experiment 1 should be disabled.");
-
- // Check that the experiment stays disabled.
-
- now = futureDate(now, 1 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- delete gManifestObject.experiments[0].disabled;
- yield experiments.updateManifest();
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry now.");
- Assert.equal(list[0].id, EXPERIMENT1_ID, "Experiment 1 should be the sole entry.");
- Assert.equal(list[0].active, false, "Experiment 1 should still be disabled.");
-
- // Cleanup.
-
- Services.obs.removeObserver(observer, OBSERVER_TOPIC);
- yield testCleanup(experiments);
-});
-
-// Test that:
-// * setting the frozen flag for a not-yet-started experiment keeps
-// it from starting
-// * after a removing the frozen flag, the experiment can still start
-
-add_task(function* test_freezePendingExperiment() {
- const OBSERVER_TOPIC = "experiments-changed";
- let observerFireCount = 0;
- let expectedObserverFireCount = 0;
- let observer = () => ++observerFireCount;
- Services.obs.addObserver(observer, OBSERVER_TOPIC, false);
-
- // Dates the following tests are based on.
-
- let baseDate = new Date(2014, 5, 1, 12);
- let startDate = futureDate(baseDate, 100 * MS_IN_ONE_DAY);
- let endDate = futureDate(baseDate, 10000 * MS_IN_ONE_DAY);
-
- // The manifest data we test with.
-
- gManifestObject = {
- "version": 1,
- experiments: [
- {
- id: EXPERIMENT1_ID,
- xpiURL: gDataRoot + EXPERIMENT1_XPI_NAME,
- xpiHash: EXPERIMENT1_XPI_SHA1,
- startTime: dateToSeconds(startDate),
- endTime: dateToSeconds(endDate),
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- ],
- };
-
- let experiments = new Experiments.Experiments(gPolicy);
-
- // Trigger update, clock set to before any activation.
-
- let now = baseDate;
- defineNow(gPolicy, now);
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
- let list = yield experiments.getExperiments();
- Assert.equal(list.length, 0, "Experiment list should be empty.");
-
- // Trigger update, clock set for the experiment to start but frozen.
-
- now = futureDate(startDate, 10 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- gManifestObject.experiments[0].frozen = true;
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, expectedObserverFireCount,
- "Experiments observer should have not been called.");
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 0, "Experiment list should have no entries yet.");
-
- // Trigger an update with the experiment not being frozen anymore.
-
- now = futureDate(now, 1 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- delete gManifestObject.experiments[0].frozen;
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry now.");
- Assert.equal(list[0].id, EXPERIMENT1_ID, "Experiment 1 should be the sole entry.");
- Assert.equal(list[0].active, true, "Experiment 1 should be active now.");
-
- // Cleanup.
-
- Services.obs.removeObserver(observer, OBSERVER_TOPIC);
- yield testCleanup(experiments);
-});
-
-// Test that setting the frozen flag for an active experiment doesn't
-// stop it.
-
-add_task(function* test_freezeActiveExperiment() {
- const OBSERVER_TOPIC = "experiments-changed";
- let observerFireCount = 0;
- let expectedObserverFireCount = 0;
- let observer = () => ++observerFireCount;
- Services.obs.addObserver(observer, OBSERVER_TOPIC, false);
-
- // Dates the following tests are based on.
-
- let baseDate = new Date(2014, 5, 1, 12);
- let startDate = futureDate(baseDate, 100 * MS_IN_ONE_DAY);
- let endDate = futureDate(baseDate, 10000 * MS_IN_ONE_DAY);
-
- // The manifest data we test with.
-
- gManifestObject = {
- "version": 1,
- experiments: [
- {
- id: EXPERIMENT1_ID,
- xpiURL: gDataRoot + EXPERIMENT1_XPI_NAME,
- xpiHash: EXPERIMENT1_XPI_SHA1,
- startTime: dateToSeconds(startDate),
- endTime: dateToSeconds(endDate),
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- ],
- };
-
- let experiments = new Experiments.Experiments(gPolicy);
-
- // Trigger update, clock set to before any activation.
-
- let now = baseDate;
- defineNow(gPolicy, now);
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
- let list = yield experiments.getExperiments();
- Assert.equal(list.length, 0, "Experiment list should be empty.");
-
- // Trigger update, clock set for the experiment to start.
-
- now = futureDate(startDate, 10 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry now.");
- Assert.equal(list[0].id, EXPERIMENT1_ID, "Experiment 1 should be the sole entry.");
- Assert.equal(list[0].active, true, "Experiment 1 should be active.");
- Assert.equal(list[0].name, EXPERIMENT1_NAME, "Experiments name should match.");
-
- // Trigger an update with the experiment being disabled.
-
- now = futureDate(now, 1 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- gManifestObject.experiments[0].frozen = true;
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, expectedObserverFireCount,
- "Experiments observer should have been called.");
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry now.");
- Assert.equal(list[0].id, EXPERIMENT1_ID, "Experiment 1 should be the sole entry.");
- Assert.equal(list[0].active, true, "Experiment 1 should still be active.");
-
- // Cleanup.
-
- Services.obs.removeObserver(observer, OBSERVER_TOPIC);
- yield testCleanup(experiments);
-});
-
-// Test that removing an active experiment from the manifest doesn't
-// stop it.
-
-add_task(function* test_removeActiveExperiment() {
- const OBSERVER_TOPIC = "experiments-changed";
- let observerFireCount = 0;
- let expectedObserverFireCount = 0;
- let observer = () => ++observerFireCount;
- Services.obs.addObserver(observer, OBSERVER_TOPIC, false);
-
- // Dates the following tests are based on.
-
- let baseDate = new Date(2014, 5, 1, 12);
- let startDate = futureDate(baseDate, 100 * MS_IN_ONE_DAY);
- let endDate = futureDate(baseDate, 10000 * MS_IN_ONE_DAY);
- let startDate2 = futureDate(baseDate, 20000 * MS_IN_ONE_DAY);
- let endDate2 = futureDate(baseDate, 30000 * MS_IN_ONE_DAY);
-
- // The manifest data we test with.
-
- gManifestObject = {
- "version": 1,
- experiments: [
- {
- id: EXPERIMENT1_ID,
- xpiURL: gDataRoot + EXPERIMENT1_XPI_NAME,
- xpiHash: EXPERIMENT1_XPI_SHA1,
- startTime: dateToSeconds(startDate),
- endTime: dateToSeconds(endDate),
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- {
- id: EXPERIMENT2_ID,
- xpiURL: gDataRoot + EXPERIMENT1_XPI_NAME,
- xpiHash: EXPERIMENT2_XPI_SHA1,
- startTime: dateToSeconds(startDate2),
- endTime: dateToSeconds(endDate2),
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- ],
- };
-
- let experiments = new Experiments.Experiments(gPolicy);
-
- // Trigger update, clock set to before any activation.
-
- let now = baseDate;
- defineNow(gPolicy, now);
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
- let list = yield experiments.getExperiments();
- Assert.equal(list.length, 0, "Experiment list should be empty.");
-
- // Trigger update, clock set for the experiment to start.
-
- now = futureDate(startDate, 10 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry now.");
- Assert.equal(list[0].id, EXPERIMENT1_ID, "Experiment 1 should be the sole entry.");
- Assert.equal(list[0].active, true, "Experiment 1 should be active.");
- Assert.equal(list[0].name, EXPERIMENT1_NAME, "Experiments name should match.");
-
- // Trigger an update with experiment 1 missing from the manifest
-
- now = futureDate(now, 1 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- gManifestObject.experiments[0].frozen = true;
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, expectedObserverFireCount,
- "Experiments observer should have been called.");
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry now.");
- Assert.equal(list[0].id, EXPERIMENT1_ID, "Experiment 1 should be the sole entry.");
- Assert.equal(list[0].active, true, "Experiment 1 should still be active.");
-
- // Cleanup.
-
- Services.obs.removeObserver(observer, OBSERVER_TOPIC);
- yield testCleanup(experiments);
-});
-
-// Test that we correctly handle experiment start & install failures.
-
-add_task(function* test_invalidUrl() {
- const OBSERVER_TOPIC = "experiments-changed";
- let observerFireCount = 0;
- let expectedObserverFireCount = 0;
- let observer = () => ++observerFireCount;
- Services.obs.addObserver(observer, OBSERVER_TOPIC, false);
-
- // Dates the following tests are based on.
-
- let baseDate = new Date(2014, 5, 1, 12);
- let startDate = futureDate(baseDate, 100 * MS_IN_ONE_DAY);
- let endDate = futureDate(baseDate, 10000 * MS_IN_ONE_DAY);
-
- // The manifest data we test with.
-
- gManifestObject = {
- "version": 1,
- experiments: [
- {
- id: EXPERIMENT1_ID,
- xpiURL: gDataRoot + EXPERIMENT1_XPI_NAME + ".invalid",
- xpiHash: EXPERIMENT1_XPI_SHA1,
- startTime: 0,
- endTime: dateToSeconds(endDate),
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- ],
- };
-
- let experiments = new Experiments.Experiments(gPolicy);
-
- // Trigger update, clock set for the experiment to start.
-
- let now = futureDate(startDate, 10 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- gTimerScheduleOffset = null;
-
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
- Assert.equal(gTimerScheduleOffset, null, "No new timer should have been scheduled.");
-
- let list = yield experiments.getExperiments();
- Assert.equal(list.length, 0, "Experiment list should be empty.");
-
- // Cleanup.
-
- Services.obs.removeObserver(observer, OBSERVER_TOPIC);
- yield testCleanup(experiments);
-});
-
-// Test that we handle it properly when active experiment addons are being
-// uninstalled.
-
-add_task(function* test_unexpectedUninstall() {
- const OBSERVER_TOPIC = "experiments-changed";
- let observerFireCount = 0;
- let expectedObserverFireCount = 0;
- let observer = () => ++observerFireCount;
- Services.obs.addObserver(observer, OBSERVER_TOPIC, false);
-
- // Dates the following tests are based on.
-
- let baseDate = new Date(2014, 5, 1, 12);
- let startDate = futureDate(baseDate, 100 * MS_IN_ONE_DAY);
- let endDate = futureDate(baseDate, 10000 * MS_IN_ONE_DAY);
-
- // The manifest data we test with.
-
- gManifestObject = {
- "version": 1,
- experiments: [
- {
- id: EXPERIMENT1_ID,
- xpiURL: gDataRoot + EXPERIMENT1_XPI_NAME,
- xpiHash: EXPERIMENT1_XPI_SHA1,
- startTime: dateToSeconds(startDate),
- endTime: dateToSeconds(endDate),
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- ],
- };
-
- let experiments = new Experiments.Experiments(gPolicy);
-
- // Trigger update, clock set to before any activation.
-
- let now = baseDate;
- defineNow(gPolicy, now);
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
- let list = yield experiments.getExperiments();
- Assert.equal(list.length, 0, "Experiment list should be empty.");
-
- // Trigger update, clock set for the experiment to start.
-
- now = futureDate(startDate, 10 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry now.");
- Assert.equal(list[0].id, EXPERIMENT1_ID, "Experiment 1 should be the sole entry.");
- Assert.equal(list[0].active, true, "Experiment 1 should be active.");
-
- // Uninstall the addon through the addon manager instead of stopping it through
- // the experiments API.
-
- yield AddonManagerTesting.uninstallAddonByID(EXPERIMENT1_ID);
- yield experiments._mainTask;
-
- yield experiments.notify();
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry now.");
- Assert.equal(list[0].id, EXPERIMENT1_ID, "Experiment 1 should be the sole entry.");
- Assert.equal(list[0].active, false, "Experiment 1 should not be active anymore.");
-
- // Cleanup.
-
- Services.obs.removeObserver(observer, OBSERVER_TOPIC);
- yield testCleanup(experiments);
-});
-
-// If the Addon Manager knows of an experiment that we don't, it should get
-// uninstalled.
-add_task(function* testUnknownExperimentsUninstalled() {
- let experiments = new Experiments.Experiments(gPolicy);
-
- let addons = yield getExperimentAddons();
- Assert.equal(addons.length, 0, "Precondition: No experiment add-ons are present.");
-
- // Simulate us not listening.
- experiments._unregisterWithAddonManager();
- yield AddonManagerTesting.installXPIFromURL(gDataRoot + EXPERIMENT1_XPI_NAME, EXPERIMENT1_XPI_SHA1);
- experiments._registerWithAddonManager();
-
- addons = yield getExperimentAddons();
- Assert.equal(addons.length, 1, "Experiment 1 installed via AddonManager");
-
- // Simulate no known experiments.
- gManifestObject = {
- "version": 1,
- experiments: [],
- };
-
- yield experiments.updateManifest();
- let fromManifest = yield experiments.getExperiments();
- Assert.equal(fromManifest.length, 0, "No experiments known in manifest.");
-
- // And the unknown add-on should be gone.
- addons = yield getExperimentAddons();
- Assert.equal(addons.length, 0, "Experiment 1 was uninstalled.");
-
- yield testCleanup(experiments);
-});
-
-// If someone else installs an experiment add-on, we detect and stop that.
-add_task(function* testForeignExperimentInstall() {
- let experiments = new Experiments.Experiments(gPolicy);
-
- gManifestObject = {
- "version": 1,
- experiments: [],
- };
-
- yield experiments.init();
-
- let addons = yield getExperimentAddons();
- Assert.equal(addons.length, 0, "Precondition: No experiment add-ons present.");
-
- let failed = false;
- try {
- yield AddonManagerTesting.installXPIFromURL(gDataRoot + EXPERIMENT1_XPI_NAME, EXPERIMENT1_XPI_SHA1);
- } catch (ex) {
- failed = true;
- }
- Assert.ok(failed, "Add-on install should not have completed successfully");
- addons = yield getExperimentAddons();
- Assert.equal(addons.length, 0, "Add-on install should have been cancelled.");
-
- yield testCleanup(experiments);
-});
-
-// Experiment add-ons will be disabled after Addon Manager restarts. Ensure
-// we enable them automatically.
-add_task(function* testEnabledAfterRestart() {
- let experiments = new Experiments.Experiments(gPolicy);
-
- gManifestObject = {
- "version": 1,
- experiments: [
- {
- id: EXPERIMENT1_ID,
- xpiURL: gDataRoot + EXPERIMENT1_XPI_NAME,
- xpiHash: EXPERIMENT1_XPI_SHA1,
- startTime: gPolicy.now().getTime() / 1000 - 60,
- endTime: gPolicy.now().getTime() / 1000 + 60,
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- ],
- };
-
- let addons = yield getExperimentAddons();
- Assert.equal(addons.length, 0, "Precondition: No experiment add-ons installed.");
-
- yield experiments.updateManifest();
- let fromManifest = yield experiments.getExperiments();
- Assert.equal(fromManifest.length, 1, "A single experiment is known.");
-
- addons = yield getExperimentAddons();
- Assert.equal(addons.length, 1, "A single experiment add-on is installed.");
- Assert.ok(addons[0].isActive, "That experiment is active.");
-
- dump("Restarting Addon Manager\n");
- yield promiseRestartManager();
- experiments = new Experiments.Experiments(gPolicy);
-
- addons = yield getExperimentAddons();
- Assert.equal(addons.length, 1, "The experiment is still there after restart.");
- Assert.ok(addons[0].userDisabled, "But it is disabled.");
- Assert.equal(addons[0].isActive, false, "And not active.");
-
- yield experiments.updateManifest();
- Assert.ok(addons[0].isActive, "It activates when the manifest is evaluated.");
-
- yield testCleanup(experiments);
-});
-
-// If experiment add-ons were ever started, maxStartTime shouldn't be evaluated
-// anymore. Ensure that if maxStartTime is passed but experiment has started
-// already, maxStartTime does not cause deactivation.
-
-add_task(function* testMaxStartTimeEvaluation() {
-
- // Dates the following tests are based on.
-
- let startDate = new Date(2014, 5, 1, 12);
- let now = futureDate(startDate, 10 * MS_IN_ONE_DAY);
- let maxStartDate = futureDate(startDate, 100 * MS_IN_ONE_DAY);
- let endDate = futureDate(startDate, 1000 * MS_IN_ONE_DAY);
-
- defineNow(gPolicy, now);
-
- // The manifest data we test with.
- // We set a value for maxStartTime.
-
- gManifestObject = {
- "version": 1,
- experiments: [
- {
- id: EXPERIMENT1_ID,
- xpiURL: gDataRoot + EXPERIMENT1_XPI_NAME,
- xpiHash: EXPERIMENT1_XPI_SHA1,
- startTime: dateToSeconds(startDate),
- endTime: dateToSeconds(endDate),
- maxActiveSeconds: 1000 * SEC_IN_ONE_DAY,
- maxStartTime: dateToSeconds(maxStartDate),
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- ],
- };
-
- let experiments = new Experiments.Experiments(gPolicy);
-
- let addons = yield getExperimentAddons();
- Assert.equal(addons.length, 0, "Precondition: No experiment add-ons installed.");
-
- yield experiments.updateManifest();
- let fromManifest = yield experiments.getExperiments();
- Assert.equal(fromManifest.length, 1, "A single experiment is known.");
-
- addons = yield getExperimentAddons();
- Assert.equal(addons.length, 1, "A single experiment add-on is installed.");
- Assert.ok(addons[0].isActive, "That experiment is active.");
-
- dump("Setting current time to maxStartTime + 100 days and reloading manifest\n");
- now = futureDate(maxStartDate, 100 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- yield experiments.updateManifest();
-
- addons = yield getExperimentAddons();
- Assert.equal(addons.length, 1, "The experiment is still there.");
- Assert.ok(addons[0].isActive, "It is still active.");
-
- yield testCleanup(experiments);
-});
-
-// Test coverage for an add-on uninstall disabling the experiment and that it stays
-// disabled over restarts.
-add_task(function* test_foreignUninstallAndRestart() {
- let experiments = new Experiments.Experiments(gPolicy);
-
- gManifestObject = {
- "version": 1,
- experiments: [
- {
- id: EXPERIMENT1_ID,
- xpiURL: gDataRoot + EXPERIMENT1_XPI_NAME,
- xpiHash: EXPERIMENT1_XPI_SHA1,
- startTime: gPolicy.now().getTime() / 1000 - 60,
- endTime: gPolicy.now().getTime() / 1000 + 60,
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- ],
- };
-
- let addons = yield getExperimentAddons();
- Assert.equal(addons.length, 0, "Precondition: No experiment add-ons installed.");
-
- yield experiments.updateManifest();
- let experimentList = yield experiments.getExperiments();
- Assert.equal(experimentList.length, 1, "A single experiment is known.");
-
- addons = yield getExperimentAddons();
- Assert.equal(addons.length, 1, "A single experiment add-on is installed.");
- Assert.ok(addons[0].isActive, "That experiment is active.");
-
- yield AddonManagerTesting.uninstallAddonByID(EXPERIMENT1_ID);
- yield experiments._mainTask;
-
- addons = yield getExperimentAddons();
- Assert.equal(addons.length, 0, "Experiment add-on should have been removed.");
-
- experimentList = yield experiments.getExperiments();
- Assert.equal(experimentList.length, 1, "A single experiment is known.");
- Assert.equal(experimentList[0].id, EXPERIMENT1_ID, "Experiment 1 should be the sole entry.");
- Assert.ok(!experimentList[0].active, "Experiment 1 should not be active anymore.");
-
- // Fake restart behaviour.
- yield promiseRestartManager();
- experiments = new Experiments.Experiments(gPolicy);
- yield experiments.updateManifest();
-
- addons = yield getExperimentAddons();
- Assert.equal(addons.length, 0, "No experiment add-ons installed.");
-
- experimentList = yield experiments.getExperiments();
- Assert.equal(experimentList.length, 1, "A single experiment is known.");
- Assert.equal(experimentList[0].id, EXPERIMENT1_ID, "Experiment 1 should be the sole entry.");
- Assert.ok(!experimentList[0].active, "Experiment 1 should not be active.");
-
- yield testCleanup(experiments);
-});
diff --git a/browser/experiments/test/xpcshell/test_cache.js b/browser/experiments/test/xpcshell/test_cache.js
deleted file mode 100644
index 4f2bce881f..0000000000
--- a/browser/experiments/test/xpcshell/test_cache.js
+++ /dev/null
@@ -1,399 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-Cu.import("resource://testing-common/httpd.js");
-XPCOMUtils.defineLazyModuleGetter(this, "Experiments",
- "resource:///modules/experiments/Experiments.jsm");
-
-const MANIFEST_HANDLER = "manifests/handler";
-
-const SEC_IN_ONE_DAY = 24 * 60 * 60;
-const MS_IN_ONE_DAY = SEC_IN_ONE_DAY * 1000;
-
-var gHttpServer = null;
-var gHttpRoot = null;
-var gDataRoot = null;
-var gPolicy = null;
-var gManifestObject = null;
-var gManifestHandlerURI = null;
-
-function run_test() {
- run_next_test();
-}
-
-add_task(function* test_setup() {
- loadAddonManager();
- yield removeCacheFile();
-
- gHttpServer = new HttpServer();
- gHttpServer.start(-1);
- let port = gHttpServer.identity.primaryPort;
- gHttpRoot = "http://localhost:" + port + "/";
- gDataRoot = gHttpRoot + "data/";
- gManifestHandlerURI = gHttpRoot + MANIFEST_HANDLER;
- gHttpServer.registerDirectory("/data/", do_get_cwd());
- gHttpServer.registerPathHandler("/" + MANIFEST_HANDLER, (request, response) => {
- response.setStatusLine(null, 200, "OK");
- response.write(JSON.stringify(gManifestObject));
- response.processAsync();
- response.finish();
- });
- do_register_cleanup(() => gHttpServer.stop(() => {}));
-
- Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
- Services.prefs.setIntPref(PREF_LOGGING_LEVEL, 0);
- Services.prefs.setBoolPref(PREF_LOGGING_DUMP, true);
- Services.prefs.setCharPref(PREF_MANIFEST_URI, gManifestHandlerURI);
- Services.prefs.setIntPref(PREF_FETCHINTERVAL, 0);
-
- gPolicy = new Experiments.Policy();
- patchPolicy(gPolicy, {
- updatechannel: () => "nightly",
- oneshotTimer: (callback, timeout, thisObj, name) => {},
- });
-});
-
-function checkExperimentListsEqual(list, list2) {
- Assert.equal(list.length, list2.length, "Lists should have the same length.")
-
- for (let i=0; i<list.length; ++i) {
- for (let k of Object.keys(list[i])) {
- Assert.equal(list[i][k], list2[i][k],
- "Field '" + k + "' should match for list entry " + i + ".");
- }
- }
-}
-
-function checkExperimentSerializations(experimentEntryIterator) {
- for (let experiment of experimentEntryIterator) {
- let experiment2 = new Experiments.ExperimentEntry(gPolicy);
- let jsonStr = JSON.stringify(experiment.toJSON());
- Assert.ok(experiment2.initFromCacheData(JSON.parse(jsonStr)),
- "Should have initialized successfully from JSON serialization.");
- Assert.equal(JSON.stringify(experiment), JSON.stringify(experiment2),
- "Object stringifications should match.");
- }
-}
-
-function validateCache(cachedExperiments, experimentIds) {
- let cachedExperimentIds = new Set(cachedExperiments);
- Assert.equal(cachedExperimentIds.size, experimentIds.length,
- "The number of cached experiments does not match with the provided list");
- for (let id of experimentIds) {
- Assert.ok(cachedExperimentIds.has(id), "The cache must contain the experiment with id " + id);
- }
-}
-
-// Set up an experiments instance and check if it is properly restored from cache.
-
-add_task(function* test_cache() {
- // The manifest data we test with.
-
- gManifestObject = {
- "version": 1,
- experiments: [
- {
- id: EXPERIMENT1_ID,
- xpiURL: gDataRoot + EXPERIMENT1_XPI_NAME,
- xpiHash: EXPERIMENT1_XPI_SHA1,
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- {
- id: EXPERIMENT2_ID,
- xpiURL: gDataRoot + EXPERIMENT2_XPI_NAME,
- xpiHash: EXPERIMENT2_XPI_SHA1,
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- {
- id: EXPERIMENT3_ID,
- xpiURL: "https://inval.id/foo.xpi",
- xpiHash: "sha1:0000000000000000000000000000000000000000",
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- ],
- };
-
- // Setup dates for the experiments.
-
- let baseDate = new Date(2014, 5, 1, 12);
- let startDates = [];
- let endDates = [];
-
- for (let i=0; i<gManifestObject.experiments.length; ++i) {
- let experiment = gManifestObject.experiments[i];
- startDates.push(futureDate(baseDate, (50 + (150 * i)) * MS_IN_ONE_DAY));
- endDates .push(futureDate(startDates[i], 50 * MS_IN_ONE_DAY));
- experiment.startTime = dateToSeconds(startDates[i]);
- experiment.endTime = dateToSeconds(endDates[i]);
- }
-
- // Data to compare the result of Experiments.getExperiments() against.
-
- let experimentListData = [
- {
- id: EXPERIMENT2_ID,
- name: "Test experiment 2",
- description: "And yet another experiment that experiments experimentally.",
- },
- {
- id: EXPERIMENT1_ID,
- name: EXPERIMENT1_NAME,
- description: "Yet another experiment that experiments experimentally.",
- },
- ];
-
- // Trigger update & re-init, clock set to before any activation.
-
- let now = baseDate;
- defineNow(gPolicy, now);
-
- let experiments = new Experiments.Experiments(gPolicy);
- yield experiments.updateManifest();
- let list = yield experiments.getExperiments();
- Assert.equal(list.length, 0, "Experiment list should be empty.");
- checkExperimentSerializations(experiments._experiments.values());
-
- yield promiseRestartManager();
- experiments = new Experiments.Experiments(gPolicy);
-
- yield experiments._run();
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 0, "Experiment list should be empty.");
- checkExperimentSerializations(experiments._experiments.values());
-
- // Re-init, clock set for experiment 1 to start.
-
- now = futureDate(startDates[0], 5 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
-
- yield promiseRestartManager();
- experiments = new Experiments.Experiments(gPolicy);
- yield experiments._run();
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry now.");
-
- experimentListData[1].active = true;
- experimentListData[1].endDate = now.getTime() + 10 * MS_IN_ONE_DAY;
- checkExperimentListsEqual(experimentListData.slice(1), list);
- checkExperimentSerializations(experiments._experiments.values());
-
- let branch = yield experiments.getExperimentBranch(EXPERIMENT1_ID);
- Assert.strictEqual(branch, null);
-
- yield experiments.setExperimentBranch(EXPERIMENT1_ID, "testbranch");
- branch = yield experiments.getExperimentBranch(EXPERIMENT1_ID);
- Assert.strictEqual(branch, "testbranch");
-
- // Re-init, clock set for experiment 1 to stop.
-
- now = futureDate(now, 20 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
-
- yield promiseRestartManager();
- experiments = new Experiments.Experiments(gPolicy);
- yield experiments._run();
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry.");
-
- experimentListData[1].active = false;
- experimentListData[1].endDate = now.getTime();
- checkExperimentListsEqual(experimentListData.slice(1), list);
- checkExperimentSerializations(experiments._experiments.values());
-
- branch = yield experiments.getExperimentBranch(EXPERIMENT1_ID);
- Assert.strictEqual(branch, "testbranch");
-
- // Re-init, clock set for experiment 2 to start.
-
- now = futureDate(startDates[1], 20 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
-
- yield promiseRestartManager();
- experiments = new Experiments.Experiments(gPolicy);
- yield experiments._run();
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 2, "Experiment list should have 2 entries.");
-
- experimentListData[0].active = true;
- experimentListData[0].endDate = now.getTime() + 10 * MS_IN_ONE_DAY;
- checkExperimentListsEqual(experimentListData, list);
- checkExperimentSerializations(experiments._experiments.values());
-
- // Re-init, clock set for experiment 2 to stop.
-
- now = futureDate(now, 20 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
-
- yield promiseRestartManager();
- experiments = new Experiments.Experiments(gPolicy);
- yield experiments._run();
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 2, "Experiment list should have 2 entries.");
-
- experimentListData[0].active = false;
- experimentListData[0].endDate = now.getTime();
- checkExperimentListsEqual(experimentListData, list);
- checkExperimentSerializations(experiments._experiments.values());
-
- // Cleanup.
-
- yield experiments._toggleExperimentsEnabled(false);
- yield promiseRestartManager();
- yield removeCacheFile();
-});
-
-add_task(function* test_expiration() {
- // The manifest data we test with.
- gManifestObject = {
- "version": 1,
- experiments: [
- {
- id: EXPERIMENT1_ID,
- xpiURL: gDataRoot + EXPERIMENT1_XPI_NAME,
- xpiHash: EXPERIMENT1_XPI_SHA1,
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- {
- id: EXPERIMENT2_ID,
- xpiURL: gDataRoot + EXPERIMENT2_XPI_NAME,
- xpiHash: EXPERIMENT2_XPI_SHA1,
- maxActiveSeconds: 50 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- // The 3rd experiment will never run, so it's ok to use experiment's 2 data.
- {
- id: EXPERIMENT3_ID,
- xpiURL: gDataRoot + EXPERIMENT2_XPI_NAME,
- xpiHash: EXPERIMENT2_XPI_SHA1,
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- }
- ],
- };
-
- // Data to compare the result of Experiments.getExperiments() against.
- let experimentListData = [
- {
- id: EXPERIMENT2_ID,
- name: "Test experiment 2",
- description: "And yet another experiment that experiments experimentally.",
- },
- {
- id: EXPERIMENT1_ID,
- name: EXPERIMENT1_NAME,
- description: "Yet another experiment that experiments experimentally.",
- },
- ];
-
- // Setup dates for the experiments.
- let baseDate = new Date(2014, 5, 1, 12);
- let startDates = [];
- let endDates = [];
-
- for (let i=0; i<gManifestObject.experiments.length; ++i) {
- let experiment = gManifestObject.experiments[i];
- // Spread out experiments in time so that one experiment can end and expire while
- // the next is still running.
- startDates.push(futureDate(baseDate, (50 + (200 * i)) * MS_IN_ONE_DAY));
- endDates .push(futureDate(startDates[i], 50 * MS_IN_ONE_DAY));
- experiment.startTime = dateToSeconds(startDates[i]);
- experiment.endTime = dateToSeconds(endDates[i]);
- }
-
- let now = null;
- let experiments = null;
-
- let setDateAndRestartExperiments = new Task.async(function* (newDate) {
- now = newDate;
- defineNow(gPolicy, now);
-
- yield promiseRestartManager();
- experiments = new Experiments.Experiments(gPolicy);
- yield experiments._run();
- });
-
- // Trigger update & re-init, clock set to before any activation.
- now = baseDate;
- defineNow(gPolicy, now);
-
- experiments = new Experiments.Experiments(gPolicy);
- yield experiments.updateManifest();
- let list = yield experiments.getExperiments();
- Assert.equal(list.length, 0, "Experiment list should be empty.");
-
- // Re-init, clock set for experiment 1 to start...
- yield setDateAndRestartExperiments(startDates[0]);
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "The first experiment should have started.");
-
- // ... init again, and set the clock so that the first experiment ends.
- yield setDateAndRestartExperiments(endDates[0]);
-
- // The experiment just ended, it should still be in the cache, but marked
- // as finished.
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry.");
-
- experimentListData[1].active = false;
- experimentListData[1].endDate = now.getTime();
- checkExperimentListsEqual(experimentListData.slice(1), list);
- validateCache([...experiments._experiments.keys()], [EXPERIMENT1_ID, EXPERIMENT2_ID, EXPERIMENT3_ID]);
-
- // Start the second experiment.
- yield setDateAndRestartExperiments(startDates[1]);
-
- // The experiments cache should contain the finished experiment and the
- // one that's still running.
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 2, "Experiment list should have 2 entries.");
-
- experimentListData[0].active = true;
- experimentListData[0].endDate = now.getTime() + 50 * MS_IN_ONE_DAY;
- checkExperimentListsEqual(experimentListData, list);
-
- // Move the clock in the future, just 31 days after the start date of the second experiment,
- // so that the cache for the first experiment expires and the second experiment is still running.
- yield setDateAndRestartExperiments(futureDate(startDates[1], 31 * MS_IN_ONE_DAY));
- validateCache([...experiments._experiments.keys()], [EXPERIMENT2_ID, EXPERIMENT3_ID]);
-
- // Make sure that the expired experiment is not reported anymore.
- let history = yield experiments.getExperiments();
- Assert.equal(history.length, 1, "Experiments older than 180 days must be removed from the cache.");
-
- // Test that we don't write expired experiments in the cache.
- yield setDateAndRestartExperiments(now);
- validateCache([...experiments._experiments.keys()], [EXPERIMENT2_ID, EXPERIMENT3_ID]);
-
- // The first experiment should be expired and not in the cache, it ended more than
- // 180 days ago. We should see the one still running in the cache.
- history = yield experiments.getExperiments();
- Assert.equal(history.length, 1, "Expired experiments must not be saved to cache.");
- checkExperimentListsEqual(experimentListData.slice(0, 1), history);
-
- // Test that experiments that are cached locally but never ran are removed from cache
- // when they are removed from the manifest (this is cached data, not really history).
- gManifestObject["experiments"] = gManifestObject["experiments"].slice(1, 1);
- yield experiments.updateManifest();
- validateCache([...experiments._experiments.keys()], [EXPERIMENT2_ID]);
-
- // Cleanup.
- yield experiments._toggleExperimentsEnabled(false);
- yield promiseRestartManager();
- yield removeCacheFile();
-});
diff --git a/browser/experiments/test/xpcshell/test_cacherace.js b/browser/experiments/test/xpcshell/test_cacherace.js
deleted file mode 100644
index ff77cfdc4b..0000000000
--- a/browser/experiments/test/xpcshell/test_cacherace.js
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-Cu.import("resource://testing-common/httpd.js");
-Cu.import("resource://gre/modules/Timer.jsm");
-
-const MANIFEST_HANDLER = "manifests/handler";
-
-const SEC_IN_ONE_DAY = 24 * 60 * 60;
-const MS_IN_ONE_DAY = SEC_IN_ONE_DAY * 1000;
-
-var gHttpServer = null;
-var gHttpRoot = null;
-var gDataRoot = null;
-var gPolicy = null;
-var gManifestObject = null;
-var gManifestHandlerURI = null;
-
-function run_test() {
- run_next_test();
-}
-
-add_task(function* test_setup() {
- loadAddonManager();
- yield removeCacheFile();
-
- gHttpServer = new HttpServer();
- gHttpServer.start(-1);
- let port = gHttpServer.identity.primaryPort;
- gHttpRoot = "http://localhost:" + port + "/";
- gDataRoot = gHttpRoot + "data/";
- gManifestHandlerURI = gHttpRoot + MANIFEST_HANDLER;
- gHttpServer.registerDirectory("/data/", do_get_cwd());
- gHttpServer.registerPathHandler("/" + MANIFEST_HANDLER, (request, response) => {
- response.setStatusLine(null, 200, "OK");
- response.write(JSON.stringify(gManifestObject));
- response.processAsync();
- response.finish();
- });
- do_register_cleanup(() => gHttpServer.stop(() => {}));
-
- Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
- Services.prefs.setIntPref(PREF_LOGGING_LEVEL, 0);
- Services.prefs.setBoolPref(PREF_LOGGING_DUMP, true);
- Services.prefs.setCharPref(PREF_MANIFEST_URI, gManifestHandlerURI);
- Services.prefs.setIntPref(PREF_FETCHINTERVAL, 0);
-
- let ExperimentsScope = Cu.import("resource:///modules/experiments/Experiments.jsm");
- let Experiments = ExperimentsScope.Experiments;
-
- gPolicy = new Experiments.Policy();
- patchPolicy(gPolicy, {
- updatechannel: () => "nightly",
- delayCacheWrite: (promise) => {
- return new Promise((resolve, reject) => {
- promise.then(
- (result) => { setTimeout(() => resolve(result), 500); },
- (err) => { reject(err); }
- );
- });
- },
- });
-
- let now = new Date(2014, 5, 1, 12);
- defineNow(gPolicy, now);
-
- let experimentName = "experiment-racybranch.xpi";
- let experimentPath = getExperimentPath(experimentName);
- let experimentHash = "sha1:" + sha1File(experimentPath);
-
- gManifestObject = {
- version: 1,
- experiments: [
- {
- id: "test-experiment-racybranch@tests.mozilla.org",
- xpiURL: gDataRoot + "experiment-racybranch.xpi",
- xpiHash: experimentHash,
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- startTime: dateToSeconds(futureDate(now, -MS_IN_ONE_DAY)),
- endTime: dateToSeconds(futureDate(now, MS_IN_ONE_DAY)),
- },
- ],
- };
-
- do_print("gManifestObject: " + JSON.stringify(gManifestObject));
-
- // In order for the addon manager to work properly, we hack
- // Experiments.instance which is used by the XPIProvider
- let experiments = new Experiments.Experiments(gPolicy);
- Assert.strictEqual(ExperimentsScope.gExperiments, null);
- ExperimentsScope.gExperiments = experiments;
-
- yield experiments.updateManifest();
- let active = experiments._getActiveExperiment();
- Assert.ok(active);
- Assert.equal(active.branch, "racy-set");
- Assert.ok(!experiments._dirty);
-});
diff --git a/browser/experiments/test/xpcshell/test_conditions.js b/browser/experiments/test/xpcshell/test_conditions.js
deleted file mode 100644
index 23c147fdbd..0000000000
--- a/browser/experiments/test/xpcshell/test_conditions.js
+++ /dev/null
@@ -1,325 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-
-Cu.import("resource:///modules/experiments/Experiments.jsm");
-Cu.import("resource://gre/modules/TelemetryController.jsm", this);
-
-const SEC_IN_ONE_DAY = 24 * 60 * 60;
-
-var gPolicy = null;
-
-function ManifestEntry(data) {
- this.id = EXPERIMENT1_ID;
- this.xpiURL = "http://localhost:1/dummy.xpi";
- this.xpiHash = EXPERIMENT1_XPI_SHA1;
- this.startTime = new Date(2010, 0, 1, 12).getTime() / 1000;
- this.endTime = new Date(9001, 0, 1, 12).getTime() / 1000;
- this.maxActiveSeconds = SEC_IN_ONE_DAY;
- this.appName = ["XPCShell"];
- this.channel = ["nightly"];
-
- data = data || {};
- for (let k of Object.keys(data)) {
- this[k] = data[k];
- }
-
- if (!this.endTime) {
- this.endTime = this.startTime + 5 * SEC_IN_ONE_DAY;
- }
-}
-
-function applicableFromManifestData(data, policy) {
- let manifestData = new ManifestEntry(data);
- let entry = new Experiments.ExperimentEntry(policy);
- entry.initFromManifestData(manifestData);
- return entry.isApplicable();
-}
-
-function run_test() {
- run_next_test();
-}
-
-add_task(function* test_setup() {
- createAppInfo();
- do_get_profile();
- startAddonManagerOnly();
- yield TelemetryController.testSetup();
- gPolicy = new Experiments.Policy();
-
- patchPolicy(gPolicy, {
- updatechannel: () => "nightly",
- locale: () => "en-US",
- random: () => 0.5,
- });
-
- Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
- Services.prefs.setIntPref(PREF_LOGGING_LEVEL, 0);
- Services.prefs.setBoolPref(PREF_LOGGING_DUMP, true);
-});
-
-function arraysEqual(a, b) {
- if (a.length !== b.length) {
- return false;
- }
-
- for (let i=0; i<a.length; ++i) {
- if (a[i] !== b[i]) {
- return false;
- }
- }
-
- return true;
-}
-
-// This function exists solely to be .toSource()d
-const sanityFilter = function filter(c) {
- if (c.telemetryEnvironment === undefined) {
- throw Error("No .telemetryEnvironment");
- }
- if (c.telemetryEnvironment.build == undefined) {
- throw Error("No .telemetryEnvironment.build");
- }
- return true;
-}
-
-// Utility function to generate build ID for previous/next date.
-function addDate(buildId, diff) {
- let m = /^([0-9]{4})([0-9]{2})([0-9]{2})(.*)$/.exec(buildId);
- if (!m) {
- throw Error("Unsupported build ID: " + buildId);
- }
- let year = Number.parseInt(m[1], 10);
- let month = Number.parseInt(m[2], 10);
- let date = Number.parseInt(m[3], 10);
- let remainingParts = m[4];
-
- let d = new Date();
- d.setUTCFullYear(year, month - 1, date);
- d.setTime(d.getTime() + diff * 24 * 60 * 60 * 1000);
-
- let yearStr = String(d.getUTCFullYear());
- let monthStr = ("0" + String(d.getUTCMonth() + 1)).slice(-2);
- let dateStr = ("0" + String(d.getUTCDate())).slice(-2);
- return yearStr + monthStr + dateStr + remainingParts;
-}
-function prevDate(buildId) {
- return addDate(buildId, -1);
-}
-function nextDate(buildId) {
- return addDate(buildId, 1);
-}
-
-add_task(function* test_simpleFields() {
- let testData = [
- // "expected applicable?", failure reason or null, manifest data
-
- // misc. environment
-
- [false, ["appName"], {appName: []}],
- [false, ["appName"], {appName: ["foo", gAppInfo.name + "-invalid"]}],
- [true, null, {appName: ["not-an-app-name", gAppInfo.name]}],
-
- [false, ["os"], {os: []}],
- [false, ["os"], {os: ["42", "abcdef"]}],
- [true, null, {os: [gAppInfo.OS, "plan9"]}],
-
- [false, ["channel"], {channel: []}],
- [false, ["channel"], {channel: ["foo", gPolicy.updatechannel() + "-invalid"]}],
- [true, null, {channel: ["not-a-channel", gPolicy.updatechannel()]}],
-
- [false, ["locale"], {locale: []}],
- [false, ["locale"], {locale: ["foo", gPolicy.locale + "-invalid"]}],
- [true, null, {locale: ["not-a-locale", gPolicy.locale()]}],
-
- // version
-
- [false, ["version"], {version: []}],
- [false, ["version"], {version: ["-1", gAppInfo.version + "-invalid", "asdf", "0,4", "99.99", "0.1.1.1"]}],
- [true, null, {version: ["99999999.999", "-1", gAppInfo.version]}],
-
- [false, ["minVersion"], {minVersion: "1.0.1"}],
- [true, null, {minVersion: "1.0b1"}],
- [true, null, {minVersion: "1.0"}],
- [true, null, {minVersion: "0.9"}],
-
- [false, ["maxVersion"], {maxVersion: "0.1"}],
- [false, ["maxVersion"], {maxVersion: "0.9.9"}],
- [false, ["maxVersion"], {maxVersion: "1.0b1"}],
- [true, ["maxVersion"], {maxVersion: "1.0"}],
- [true, ["maxVersion"], {maxVersion: "1.7pre"}],
-
- // build id
-
- [false, ["buildIDs"], {buildIDs: []}],
- [false, ["buildIDs"], {buildIDs: ["not-a-build-id", gAppInfo.platformBuildID + "-invalid"]}],
- [true, null, {buildIDs: ["not-a-build-id", gAppInfo.platformBuildID]}],
-
- [true, null, {minBuildID: prevDate(gAppInfo.platformBuildID)}],
- [true, null, {minBuildID: gAppInfo.platformBuildID}],
- [false, ["minBuildID"], {minBuildID: nextDate(gAppInfo.platformBuildID)}],
-
- [false, ["maxBuildID"], {maxBuildID: prevDate(gAppInfo.platformBuildID)}],
- [true, null, {maxBuildID: gAppInfo.platformBuildID}],
- [true, null, {maxBuildID: nextDate(gAppInfo.platformBuildID)}],
-
- // sample
-
- [false, ["sample"], {sample: -1 }],
- [false, ["sample"], {sample: 0.0}],
- [false, ["sample"], {sample: 0.1}],
- [true, null, {sample: 0.5}],
- [true, null, {sample: 0.6}],
- [true, null, {sample: 1.0}],
- [true, null, {sample: 0.5}],
-
- // experiment control
-
- [false, ["disabled"], {disabled: true}],
- [true, null, {disabled: false}],
-
- [false, ["frozen"], {frozen: true}],
- [true, null, {frozen: false}],
-
- [false, null, {frozen: true, disabled: true}],
- [false, null, {frozen: true, disabled: false}],
- [false, null, {frozen: false, disabled: true}],
- [true, null, {frozen: false, disabled: false}],
-
- // jsfilter
-
- [true, null, {jsfilter: "function filter(c) { return true; }"}],
- [false, ["jsfilter-false"], {jsfilter: "function filter(c) { return false; }"}],
- [true, null, {jsfilter: "function filter(c) { return 123; }"}], // truthy
- [false, ["jsfilter-false"], {jsfilter: "function filter(c) { return ''; }"}], // falsy
- [false, ["jsfilter-false"], {jsfilter: "function filter(c) { var a = []; }"}], // undefined
- [false, ["jsfilter-threw", "some error"], {jsfilter: "function filter(c) { throw new Error('some error'); }"}],
- [false, ["jsfilter-evalfailed"], {jsfilter: "123, this won't work"}],
- [true, null, {jsfilter: "var filter = " + sanityFilter.toSource()}],
- ];
-
- for (let i=0; i<testData.length; ++i) {
- let entry = testData[i];
- let applicable;
- let reason = null;
-
- yield applicableFromManifestData(entry[2], gPolicy).then(
- value => applicable = value,
- value => {
- applicable = false;
- reason = value;
- }
- );
-
- Assert.equal(applicable, entry[0],
- "Experiment entry applicability should match for test "
- + i + ": " + JSON.stringify(entry[2]));
-
- let expectedReason = entry[1];
- if (!applicable && expectedReason) {
- Assert.ok(arraysEqual(reason, expectedReason),
- "Experiment rejection reasons should match for test " + i + ". "
- + "Got " + JSON.stringify(reason) + ", expected "
- + JSON.stringify(expectedReason));
- }
- }
-});
-
-add_task(function* test_times() {
- let now = new Date(2014, 5, 6, 12);
- let nowSec = now.getTime() / 1000;
- let testData = [
- // "expected applicable?", rejection reason or null, fake now date, manifest data
-
- // start time
-
- [true, null, now,
- {startTime: nowSec - 5 * SEC_IN_ONE_DAY,
- endTime: nowSec + 10 * SEC_IN_ONE_DAY}],
- [true, null, now,
- {startTime: nowSec,
- endTime: nowSec + 10 * SEC_IN_ONE_DAY}],
- [false, "startTime", now,
- {startTime: nowSec + 5 * SEC_IN_ONE_DAY,
- endTime: nowSec + 10 * SEC_IN_ONE_DAY}],
-
- // end time
-
- [false, "endTime", now,
- {startTime: nowSec - 5 * SEC_IN_ONE_DAY,
- endTime: nowSec - 10 * SEC_IN_ONE_DAY}],
- [false, "endTime", now,
- {startTime: nowSec - 5 * SEC_IN_ONE_DAY,
- endTime: nowSec - 5 * SEC_IN_ONE_DAY}],
-
- // max start time
-
- [false, "maxStartTime", now,
- {maxStartTime: nowSec - 15 * SEC_IN_ONE_DAY,
- startTime: nowSec - 10 * SEC_IN_ONE_DAY,
- endTime: nowSec + 10 * SEC_IN_ONE_DAY}],
- [false, "maxStartTime", now,
- {maxStartTime: nowSec - 1 * SEC_IN_ONE_DAY,
- startTime: nowSec - 10 * SEC_IN_ONE_DAY,
- endTime: nowSec + 10 * SEC_IN_ONE_DAY}],
- [false, "maxStartTime", now,
- {maxStartTime: nowSec - 10 * SEC_IN_ONE_DAY,
- startTime: nowSec - 10 * SEC_IN_ONE_DAY,
- endTime: nowSec + 10 * SEC_IN_ONE_DAY}],
- [true, null, now,
- {maxStartTime: nowSec,
- startTime: nowSec - 10 * SEC_IN_ONE_DAY,
- endTime: nowSec + 10 * SEC_IN_ONE_DAY}],
- [true, null, now,
- {maxStartTime: nowSec + 1 * SEC_IN_ONE_DAY,
- startTime: nowSec - 10 * SEC_IN_ONE_DAY,
- endTime: nowSec + 10 * SEC_IN_ONE_DAY}],
-
- // max active seconds
-
- [true, null, now,
- {maxActiveSeconds: 5 * SEC_IN_ONE_DAY,
- startTime: nowSec - 10 * SEC_IN_ONE_DAY,
- endTime: nowSec + 10 * SEC_IN_ONE_DAY}],
- [true, null, now,
- {maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- startTime: nowSec - 10 * SEC_IN_ONE_DAY,
- endTime: nowSec + 10 * SEC_IN_ONE_DAY}],
- [true, null, now,
- {maxActiveSeconds: 15 * SEC_IN_ONE_DAY,
- startTime: nowSec - 10 * SEC_IN_ONE_DAY,
- endTime: nowSec + 10 * SEC_IN_ONE_DAY}],
- [true, null, now,
- {maxActiveSeconds: 20 * SEC_IN_ONE_DAY,
- startTime: nowSec - 10 * SEC_IN_ONE_DAY,
- endTime: nowSec + 10 * SEC_IN_ONE_DAY}],
- ];
-
- for (let i=0; i<testData.length; ++i) {
- let entry = testData[i];
- let applicable;
- let reason = null;
- defineNow(gPolicy, entry[2]);
-
- yield applicableFromManifestData(entry[3], gPolicy).then(
- value => applicable = value,
- value => {
- applicable = false;
- reason = value;
- }
- );
-
- Assert.equal(applicable, entry[0],
- "Experiment entry applicability should match for test "
- + i + ": " + JSON.stringify([entry[2], entry[3]]));
- if (!applicable && entry[1]) {
- Assert.equal(reason, entry[1], "Experiment rejection reason should match for test " + i);
- }
- }
-});
-
-add_task(function* test_shutdown() {
- yield TelemetryController.testShutdown();
-});
diff --git a/browser/experiments/test/xpcshell/test_disableExperiments.js b/browser/experiments/test/xpcshell/test_disableExperiments.js
deleted file mode 100644
index 8441b922d6..0000000000
--- a/browser/experiments/test/xpcshell/test_disableExperiments.js
+++ /dev/null
@@ -1,180 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-Cu.import("resource://testing-common/httpd.js");
-Cu.import("resource://testing-common/AddonManagerTesting.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "Experiments",
- "resource:///modules/experiments/Experiments.jsm");
-
-const MANIFEST_HANDLER = "manifests/handler";
-
-const SEC_IN_ONE_DAY = 24 * 60 * 60;
-const MS_IN_ONE_DAY = SEC_IN_ONE_DAY * 1000;
-
-var gHttpServer = null;
-var gHttpRoot = null;
-var gDataRoot = null;
-var gPolicy = null;
-var gManifestObject = null;
-var gManifestHandlerURI = null;
-
-function run_test() {
- run_next_test();
-}
-
-add_task(function* test_setup() {
- loadAddonManager();
-
- gHttpServer = new HttpServer();
- gHttpServer.start(-1);
- let port = gHttpServer.identity.primaryPort;
- gHttpRoot = "http://localhost:" + port + "/";
- gDataRoot = gHttpRoot + "data/";
- gManifestHandlerURI = gHttpRoot + MANIFEST_HANDLER;
- gHttpServer.registerDirectory("/data/", do_get_cwd());
- gHttpServer.registerPathHandler("/" + MANIFEST_HANDLER, (request, response) => {
- response.setStatusLine(null, 200, "OK");
- response.write(JSON.stringify(gManifestObject));
- response.processAsync();
- response.finish();
- });
- do_register_cleanup(() => gHttpServer.stop(() => {}));
-
- Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
- Services.prefs.setIntPref(PREF_LOGGING_LEVEL, 0);
- Services.prefs.setBoolPref(PREF_LOGGING_DUMP, true);
- Services.prefs.setCharPref(PREF_MANIFEST_URI, gManifestHandlerURI);
- Services.prefs.setIntPref(PREF_FETCHINTERVAL, 0);
-
- gPolicy = new Experiments.Policy();
- patchPolicy(gPolicy, {
- updatechannel: () => "nightly",
- oneshotTimer: (callback, timeout, thisObj, name) => {},
- });
-});
-
-// Test disabling the feature stops current and future experiments.
-
-add_task(function* test_disableExperiments() {
- const OBSERVER_TOPIC = "experiments-changed";
- let observerFireCount = 0;
- let expectedObserverFireCount = 0;
- let observer = () => ++observerFireCount;
- Services.obs.addObserver(observer, OBSERVER_TOPIC, false);
-
- // Dates the following tests are based on.
-
- let baseDate = new Date(2014, 5, 1, 12);
- let startDate1 = futureDate(baseDate, 50 * MS_IN_ONE_DAY);
- let endDate1 = futureDate(baseDate, 100 * MS_IN_ONE_DAY);
- let startDate2 = futureDate(baseDate, 150 * MS_IN_ONE_DAY);
- let endDate2 = futureDate(baseDate, 200 * MS_IN_ONE_DAY);
-
- // The manifest data we test with.
-
- gManifestObject = {
- "version": 1,
- experiments: [
- {
- id: EXPERIMENT2_ID,
- xpiURL: gDataRoot + EXPERIMENT2_XPI_NAME,
- xpiHash: EXPERIMENT2_XPI_SHA1,
- startTime: dateToSeconds(startDate2),
- endTime: dateToSeconds(endDate2),
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- {
- id: EXPERIMENT1_ID,
- xpiURL: gDataRoot + EXPERIMENT1_XPI_NAME,
- xpiHash: EXPERIMENT1_XPI_SHA1,
- startTime: dateToSeconds(startDate1),
- endTime: dateToSeconds(endDate1),
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- ],
- };
-
- let experiments = new Experiments.Experiments(gPolicy);
-
- // Trigger update, clock set to before any activation.
- // Use updateManifest() to provide for coverage of that path.
-
- let now = baseDate;
- defineNow(gPolicy, now);
-
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
- let list = yield experiments.getExperiments();
- Assert.equal(list.length, 0, "Experiment list should be empty.");
- let addons = yield getExperimentAddons();
- Assert.equal(addons.length, 0, "Precondition: No experiment add-ons are installed.");
-
- // Trigger update, clock set for experiment 1 to start.
-
- now = futureDate(startDate1, 5 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
-
- yield experiments.updateManifest();
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry now.");
- Assert.equal(list[0].active, true, "Experiment should be active.");
- addons = yield getExperimentAddons();
- Assert.equal(addons.length, 1, "An experiment add-on was installed.");
-
- // Disable the experiments feature. Check that we stop the running experiment.
-
- Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, false);
- yield experiments._mainTask;
-
- Assert.equal(observerFireCount, ++expectedObserverFireCount,
- "Experiments observer should have been called.");
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry.");
- Assert.equal(list[0].active, false, "Experiment entry should not be active.");
- addons = yield getExperimentAddons();
- Assert.equal(addons.length, 0, "The experiment add-on should be uninstalled.");
-
- // Trigger update, clock set for experiment 2 to start. Verify we don't start it.
-
- now = startDate2;
- defineNow(gPolicy, now);
-
- try {
- yield experiments.updateManifest();
- } catch (e) {
- // This exception is expected, we rethrow everything else
- if (e.message != "experiments are disabled") {
- throw e;
- }
- }
-
- experiments.notify();
- yield experiments._mainTask;
-
- Assert.equal(observerFireCount, expectedObserverFireCount,
- "Experiments observer should not have been called.");
-
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should still have 1 entry.");
- Assert.equal(list[0].active, false, "Experiment entry should not be active.");
- addons = yield getExperimentAddons();
- Assert.equal(addons.length, 0, "There should still be no experiment add-on installed.");
-
- // Cleanup.
-
- Services.obs.removeObserver(observer, OBSERVER_TOPIC);
- yield promiseRestartManager();
- yield removeCacheFile();
-});
diff --git a/browser/experiments/test/xpcshell/test_fetch.js b/browser/experiments/test/xpcshell/test_fetch.js
deleted file mode 100644
index e8d76fa352..0000000000
--- a/browser/experiments/test/xpcshell/test_fetch.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-Cu.import("resource://testing-common/httpd.js");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/osfile.jsm");
-Cu.import("resource:///modules/experiments/Experiments.jsm");
-
-var gHttpServer = null;
-var gHttpRoot = null;
-var gPolicy = new Experiments.Policy();
-
-function run_test() {
- loadAddonManager();
-
- gHttpServer = new HttpServer();
- gHttpServer.start(-1);
- let port = gHttpServer.identity.primaryPort;
- gHttpRoot = "http://localhost:" + port + "/";
- gHttpServer.registerDirectory("/", do_get_cwd());
- do_register_cleanup(() => gHttpServer.stop(() => {}));
-
- Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
- Services.prefs.setIntPref(PREF_LOGGING_LEVEL, 0);
- Services.prefs.setBoolPref(PREF_LOGGING_DUMP, true);
-
- patchPolicy(gPolicy, {
- updatechannel: () => "nightly",
- });
-
- run_next_test();
-}
-
-add_task(function* test_fetchAndCache() {
- Services.prefs.setCharPref(PREF_MANIFEST_URI, gHttpRoot + "experiments_1.manifest");
- let ex = new Experiments.Experiments(gPolicy);
-
- Assert.equal(ex._experiments, null, "There should be no cached experiments yet.");
- yield ex.updateManifest();
- Assert.notEqual(ex._experiments.size, 0, "There should be cached experiments now.");
-
- yield promiseRestartManager();
-});
-
-add_task(function* test_checkCache() {
- let ex = new Experiments.Experiments(gPolicy);
- yield ex.notify();
- Assert.notEqual(ex._experiments.size, 0, "There should be cached experiments now.");
-
- yield promiseRestartManager();
-});
-
-add_task(function* test_fetchInvalid() {
- yield removeCacheFile();
-
- Services.prefs.setCharPref(PREF_MANIFEST_URI, gHttpRoot + "experiments_1.manifest");
- let ex = new Experiments.Experiments(gPolicy);
- yield ex.updateManifest();
- Assert.notEqual(ex._experiments.size, 0, "There should be experiments");
-
- Services.prefs.setCharPref(PREF_MANIFEST_URI, gHttpRoot + "invalid.manifest");
- yield ex.updateManifest()
- Assert.notEqual(ex._experiments.size, 0, "There should still be experiments: fetch failure shouldn't remove them.");
-
- yield promiseRestartManager();
-});
diff --git a/browser/experiments/test/xpcshell/test_nethang_bug1012924.js b/browser/experiments/test/xpcshell/test_nethang_bug1012924.js
deleted file mode 100644
index 7ef6049016..0000000000
--- a/browser/experiments/test/xpcshell/test_nethang_bug1012924.js
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-Cu.import("resource://testing-common/httpd.js");
-Cu.import("resource:///modules/experiments/Experiments.jsm");
-
-const MANIFEST_HANDLER = "manifests/handler";
-
-function run_test() {
- run_next_test();
-}
-
-add_task(function* test_setup() {
- loadAddonManager();
- do_get_profile();
-
- let httpServer = new HttpServer();
- httpServer.start(-1);
- let port = httpServer.identity.primaryPort;
- let httpRoot = "http://localhost:" + port + "/";
- let handlerURI = httpRoot + MANIFEST_HANDLER;
- httpServer.registerPathHandler("/" + MANIFEST_HANDLER,
- (request, response) => {
- response.processAsync();
- response.setStatus(null, 200, "OK");
- response.write("["); // never finish!
- });
-
- do_register_cleanup(() => httpServer.stop(() => {}));
- Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
- Services.prefs.setIntPref(PREF_LOGGING_LEVEL, 0);
- Services.prefs.setBoolPref(PREF_LOGGING_DUMP, true);
- Services.prefs.setCharPref(PREF_MANIFEST_URI, handlerURI);
- Services.prefs.setIntPref(PREF_FETCHINTERVAL, 0);
-
- let experiments = Experiments.instance();
- experiments.updateManifest().then(
- () => {
- Assert.ok(true, "updateManifest finished successfully");
- },
- (e) => {
- do_throw("updateManifest should not have failed: got error " + e);
- });
- yield experiments.uninit();
-});
diff --git a/browser/experiments/test/xpcshell/test_previous_provider.js b/browser/experiments/test/xpcshell/test_previous_provider.js
deleted file mode 100644
index f7186e159a..0000000000
--- a/browser/experiments/test/xpcshell/test_previous_provider.js
+++ /dev/null
@@ -1,179 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-Cu.import("resource://gre/modules/Promise.jsm");
-Cu.import("resource:///modules/experiments/Experiments.jsm");
-Cu.import("resource://testing-common/httpd.js");
-
-var gDataRoot;
-var gHttpServer;
-var gManifestObject;
-
-function run_test() {
- run_next_test();
-}
-
-add_task(function test_setup() {
- loadAddonManager();
- do_get_profile();
-
- gHttpServer = new HttpServer();
- gHttpServer.start(-1);
- let httpRoot = "http://localhost:" + gHttpServer.identity.primaryPort + "/";
- gDataRoot = httpRoot + "data/";
- gHttpServer.registerDirectory("/data/", do_get_cwd());
- gHttpServer.registerPathHandler("/manifests/handler", (req, res) => {
- res.setStatusLine(null, 200, "OK");
- res.write(JSON.stringify(gManifestObject));
- res.processAsync();
- res.finish();
- });
- do_register_cleanup(() => gHttpServer.stop(() => {}));
-
- Services.prefs.setBoolPref("experiments.enabled", true);
- Services.prefs.setCharPref("experiments.manifest.uri",
- httpRoot + "manifests/handler");
- Services.prefs.setBoolPref("experiments.logging.dump", true);
- Services.prefs.setCharPref("experiments.logging.level", "Trace");
-});
-
-add_task(function* test_provider_basic() {
- let e = Experiments.instance();
-
- let provider = new Experiments.PreviousExperimentProvider(e);
- e._setPreviousExperimentsProvider(provider);
-
- let deferred = Promise.defer();
- provider.getAddonsByTypes(["experiment"], (addons) => {
- deferred.resolve(addons);
- });
- let experimentAddons = yield deferred.promise;
- Assert.ok(Array.isArray(experimentAddons), "getAddonsByTypes returns an Array.");
- Assert.equal(experimentAddons.length, 0, "No previous add-ons returned.");
-
- gManifestObject = {
- version: 1,
- experiments: [
- {
- id: EXPERIMENT1_ID,
- xpiURL: gDataRoot + EXPERIMENT1_XPI_NAME,
- xpiHash: EXPERIMENT1_XPI_SHA1,
- startTime: Date.now() / 1000 - 60,
- endTime: Date.now() / 1000 + 60,
- maxActiveSeconds: 60,
- appName: ["XPCShell"],
- channel: [e._policy.updatechannel()],
- },
- ],
- };
-
- yield e.updateManifest();
-
- deferred = Promise.defer();
- provider.getAddonsByTypes(["experiment"], (addons) => {
- deferred.resolve(addons);
- });
- experimentAddons = yield deferred.promise;
- Assert.equal(experimentAddons.length, 0, "Still no previous experiment.");
-
- let experiments = yield e.getExperiments();
- Assert.equal(experiments.length, 1, "1 experiment present.");
- Assert.ok(experiments[0].active, "It is active.");
-
- // Deactivate it.
- defineNow(e._policy, new Date(gManifestObject.experiments[0].endTime * 1000 + 1000));
- yield e.updateManifest();
-
- experiments = yield e.getExperiments();
- Assert.equal(experiments.length, 1, "1 experiment present.");
- Assert.equal(experiments[0].active, false, "It isn't active.");
-
- deferred = Promise.defer();
- provider.getAddonsByTypes(["experiment"], (addons) => {
- deferred.resolve(addons);
- });
- experimentAddons = yield deferred.promise;
- Assert.equal(experimentAddons.length, 1, "1 previous add-on known.");
- Assert.equal(experimentAddons[0].id, EXPERIMENT1_ID, "ID matches expected.");
-
- deferred = Promise.defer();
- provider.getAddonByID(EXPERIMENT1_ID, (addon) => {
- deferred.resolve(addon);
- });
- let addon = yield deferred.promise;
- Assert.ok(addon, "We got an add-on from its ID.");
- Assert.equal(addon.id, EXPERIMENT1_ID, "ID matches expected.");
- Assert.ok(addon.appDisabled, "Add-on is a previous experiment.");
- Assert.ok(addon.userDisabled, "Add-on is disabled.");
- Assert.equal(addon.type, "experiment", "Add-on is an experiment.");
- Assert.equal(addon.isActive, false, "Add-on is not active.");
- Assert.equal(addon.permissions, 0, "Add-on has no permissions.");
-
- deferred = Promise.defer();
- AddonManager.getAddonsByTypes(["experiment"], (addons) => {
- deferred.resolve(addons);
- });
- experimentAddons = yield deferred.promise;
- Assert.equal(experimentAddons.length, 1, "Got 1 experiment from add-on manager.");
- Assert.equal(experimentAddons[0].id, EXPERIMENT1_ID, "ID matches expected.");
- Assert.ok(experimentAddons[0].appDisabled, "It is a previous experiment add-on.");
-});
-
-add_task(function* test_active_and_previous() {
- // Building on the previous test, activate experiment 2.
- let e = Experiments.instance();
- let provider = new Experiments.PreviousExperimentProvider(e);
- e._setPreviousExperimentsProvider(provider);
-
- gManifestObject = {
- version: 1,
- experiments: [
- {
- id: EXPERIMENT2_ID,
- xpiURL: gDataRoot + EXPERIMENT2_XPI_NAME,
- xpiHash: EXPERIMENT2_XPI_SHA1,
- startTime: Date.now() / 1000 - 60,
- endTime: Date.now() / 1000 + 60,
- maxActiveSeconds: 60,
- appName: ["XPCShell"],
- channel: [e._policy.updatechannel()],
- },
- ],
- };
-
- defineNow(e._policy, new Date());
- yield e.updateManifest();
-
- let experiments = yield e.getExperiments();
- Assert.equal(experiments.length, 2, "2 experiments known.");
-
- let deferred = Promise.defer();
- provider.getAddonsByTypes(["experiment"], (addons) => {
- deferred.resolve(addons);
- });
- let experimentAddons = yield deferred.promise;
- Assert.equal(experimentAddons.length, 1, "1 previous experiment.");
-
- deferred = Promise.defer();
- AddonManager.getAddonsByTypes(["experiment"], (addons) => {
- deferred.resolve(addons);
- });
- experimentAddons = yield deferred.promise;
- Assert.equal(experimentAddons.length, 2, "2 experiment add-ons known.");
-
- for (let addon of experimentAddons) {
- if (addon.id == EXPERIMENT1_ID) {
- Assert.equal(addon.isActive, false, "Add-on is not active.");
- Assert.ok(addon.appDisabled, "Should be a previous experiment.");
- }
- else if (addon.id == EXPERIMENT2_ID) {
- Assert.ok(addon.isActive, "Add-on is active.");
- Assert.ok(!addon.appDisabled, "Should not be a previous experiment.");
- }
- else {
- throw new Error("Unexpected add-on ID: " + addon.id);
- }
- }
-});
diff --git a/browser/experiments/test/xpcshell/test_telemetry.js b/browser/experiments/test/xpcshell/test_telemetry.js
deleted file mode 100644
index 02bd15d2b8..0000000000
--- a/browser/experiments/test/xpcshell/test_telemetry.js
+++ /dev/null
@@ -1,294 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-Cu.import("resource://testing-common/httpd.js");
-Cu.import("resource://gre/modules/TelemetryLog.jsm");
-var bsp = Cu.import("resource:///modules/experiments/Experiments.jsm");
-
-
-const MANIFEST_HANDLER = "manifests/handler";
-
-const SEC_IN_ONE_DAY = 24 * 60 * 60;
-const MS_IN_ONE_DAY = SEC_IN_ONE_DAY * 1000;
-
-
-var gHttpServer = null;
-var gHttpRoot = null;
-var gDataRoot = null;
-var gPolicy = null;
-var gManifestObject = null;
-var gManifestHandlerURI = null;
-
-const TLOG = bsp.TELEMETRY_LOG;
-
-function checkEvent(event, id, data)
-{
- do_print("Checking message " + id);
- Assert.equal(event[0], id, "id should match");
- Assert.ok(event[1] > 0, "timestamp should be greater than 0");
-
- if (data === undefined) {
- Assert.equal(event.length, 2, "event array should have 2 entries");
- } else {
- Assert.equal(event.length, data.length + 2, "event entry count should match expected count");
- for (var i = 0; i < data.length; ++i) {
- Assert.equal(typeof(event[i + 2]), "string", "event entry should be a string");
- Assert.equal(event[i + 2], data[i], "event entry should match expected entry");
- }
- }
-}
-
-function run_test() {
- run_next_test();
-}
-
-add_task(function* test_setup() {
- loadAddonManager();
-
- gHttpServer = new HttpServer();
- gHttpServer.start(-1);
- let port = gHttpServer.identity.primaryPort;
- gHttpRoot = "http://localhost:" + port + "/";
- gDataRoot = gHttpRoot + "data/";
- gManifestHandlerURI = gHttpRoot + MANIFEST_HANDLER;
- gHttpServer.registerDirectory("/data/", do_get_cwd());
- gHttpServer.registerPathHandler("/" + MANIFEST_HANDLER, (request, response) => {
- response.setStatusLine(null, 200, "OK");
- response.write(JSON.stringify(gManifestObject));
- response.processAsync();
- response.finish();
- });
- do_register_cleanup(() => gHttpServer.stop(() => {}));
-
- Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
- Services.prefs.setIntPref(PREF_LOGGING_LEVEL, 0);
- Services.prefs.setBoolPref(PREF_LOGGING_DUMP, true);
- Services.prefs.setCharPref(PREF_MANIFEST_URI, gManifestHandlerURI);
- Services.prefs.setIntPref(PREF_FETCHINTERVAL, 0);
-
- gPolicy = new Experiments.Policy();
- let dummyTimer = { cancel: () => {}, clear: () => {} };
- patchPolicy(gPolicy, {
- updatechannel: () => "nightly",
- oneshotTimer: (callback, timeout, thisObj, name) => dummyTimer,
- });
-
- yield removeCacheFile();
-});
-
-// Test basic starting and stopping of experiments.
-
-add_task(function* test_telemetryBasics() {
- // Check TelemetryLog instead of TelemetrySession.getPayload().log because
- // TelemetrySession gets Experiments.instance() and side-effects log entries.
-
- let expectedLogLength = 0;
-
- // Dates the following tests are based on.
-
- let baseDate = new Date(2014, 5, 1, 12);
- let startDate1 = futureDate(baseDate, 50 * MS_IN_ONE_DAY);
- let endDate1 = futureDate(baseDate, 100 * MS_IN_ONE_DAY);
- let startDate2 = futureDate(baseDate, 150 * MS_IN_ONE_DAY);
- let endDate2 = futureDate(baseDate, 200 * MS_IN_ONE_DAY);
-
- // The manifest data we test with.
-
- gManifestObject = {
- "version": 1,
- experiments: [
- {
- id: EXPERIMENT1_ID,
- xpiURL: gDataRoot + EXPERIMENT1_XPI_NAME,
- xpiHash: EXPERIMENT1_XPI_SHA1,
- startTime: dateToSeconds(startDate1),
- endTime: dateToSeconds(endDate1),
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- {
- id: EXPERIMENT2_ID,
- xpiURL: gDataRoot + EXPERIMENT2_XPI_NAME,
- xpiHash: EXPERIMENT2_XPI_SHA1,
- startTime: dateToSeconds(startDate2),
- endTime: dateToSeconds(endDate2),
- maxActiveSeconds: 10 * SEC_IN_ONE_DAY,
- appName: ["XPCShell"],
- channel: ["nightly"],
- },
- ],
- };
-
- let experiments = new Experiments.Experiments(gPolicy);
-
- // Trigger update, clock set to before any activation.
- // Use updateManifest() to provide for coverage of that path.
-
- let now = baseDate;
- defineNow(gPolicy, now);
-
- yield experiments.updateManifest();
- let list = yield experiments.getExperiments();
- Assert.equal(list.length, 0, "Experiment list should be empty.");
-
- expectedLogLength += 2;
- let log = TelemetryLog.entries();
- do_print("Telemetry log: " + JSON.stringify(log));
- Assert.equal(log.length, expectedLogLength, "Telemetry log should have " + expectedLogLength + " entries.");
- checkEvent(log[log.length-2], TLOG.ACTIVATION_KEY,
- [TLOG.ACTIVATION.REJECTED, EXPERIMENT1_ID, "startTime"]);
- checkEvent(log[log.length-1], TLOG.ACTIVATION_KEY,
- [TLOG.ACTIVATION.REJECTED, EXPERIMENT2_ID, "startTime"]);
-
- // Trigger update, clock set for experiment 1 to start.
-
- now = futureDate(startDate1, 5 * MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
-
- yield experiments.updateManifest();
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry now.");
-
- expectedLogLength += 1;
- log = TelemetryLog.entries();
- Assert.equal(log.length, expectedLogLength, "Telemetry log should have " + expectedLogLength + " entries. Got " + log.toSource());
- checkEvent(log[log.length-1], TLOG.ACTIVATION_KEY,
- [TLOG.ACTIVATION.ACTIVATED, EXPERIMENT1_ID]);
-
- // Trigger update, clock set for experiment 1 to stop.
-
- now = futureDate(endDate1, 1000);
- defineNow(gPolicy, now);
-
- yield experiments.updateManifest();
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entry.");
-
- expectedLogLength += 2;
- log = TelemetryLog.entries();
- Assert.equal(log.length, expectedLogLength, "Telemetry log should have " + expectedLogLength + " entries.");
- checkEvent(log[log.length-2], TLOG.TERMINATION_KEY,
- [TLOG.TERMINATION.EXPIRED, EXPERIMENT1_ID]);
- checkEvent(log[log.length-1], TLOG.ACTIVATION_KEY,
- [TLOG.ACTIVATION.REJECTED, EXPERIMENT2_ID, "startTime"]);
-
- // Trigger update, clock set for experiment 2 to start with invalid hash.
-
- now = startDate2;
- defineNow(gPolicy, now);
- gManifestObject.experiments[1].xpiHash = "sha1:0000000000000000000000000000000000000000";
-
- yield experiments.updateManifest();
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 1, "Experiment list should have 1 entries.");
-
- expectedLogLength += 1;
- log = TelemetryLog.entries();
- Assert.equal(log.length, expectedLogLength, "Telemetry log should have " + expectedLogLength + " entries.");
- checkEvent(log[log.length-1], TLOG.ACTIVATION_KEY,
- [TLOG.ACTIVATION.INSTALL_FAILURE, EXPERIMENT2_ID]);
-
- // Trigger update, clock set for experiment 2 to properly start now.
-
- now = futureDate(now, MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- gManifestObject.experiments[1].xpiHash = EXPERIMENT2_XPI_SHA1;
-
- yield experiments.updateManifest();
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 2, "Experiment list should have 2 entries.");
-
- expectedLogLength += 1;
- log = TelemetryLog.entries();
- Assert.equal(log.length, expectedLogLength, "Telemetry log should have " + expectedLogLength + " entries.");
- checkEvent(log[log.length-1], TLOG.ACTIVATION_KEY,
- [TLOG.ACTIVATION.ACTIVATED, EXPERIMENT2_ID]);
-
- // Fake user uninstall of experiment via add-on manager.
-
- now = futureDate(now, MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
-
- yield experiments.disableExperiment(TLOG.TERMINATION.ADDON_UNINSTALLED);
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 2, "Experiment list should have 2 entries.");
-
- expectedLogLength += 1;
- log = TelemetryLog.entries();
- Assert.equal(log.length, expectedLogLength, "Telemetry log should have " + expectedLogLength + " entries.");
- checkEvent(log[log.length-1], TLOG.TERMINATION_KEY,
- [TLOG.TERMINATION.ADDON_UNINSTALLED, EXPERIMENT2_ID]);
-
- // Trigger update with experiment 1a ready to start.
-
- now = futureDate(now, MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- gManifestObject.experiments[0].id = EXPERIMENT3_ID;
- gManifestObject.experiments[0].endTime = dateToSeconds(futureDate(now, 50 * MS_IN_ONE_DAY));
-
- yield experiments.updateManifest();
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 3, "Experiment list should have 3 entries.");
-
- expectedLogLength += 1;
- log = TelemetryLog.entries();
- Assert.equal(log.length, expectedLogLength, "Telemetry log should have " + expectedLogLength + " entries.");
- checkEvent(log[log.length-1], TLOG.ACTIVATION_KEY,
- [TLOG.ACTIVATION.ACTIVATED, EXPERIMENT3_ID]);
-
- // Trigger disable of an experiment via the API.
-
- now = futureDate(now, MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
-
- yield experiments.disableExperiment(TLOG.TERMINATION.FROM_API);
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 3, "Experiment list should have 3 entries.");
-
- expectedLogLength += 1;
- log = TelemetryLog.entries();
- Assert.equal(log.length, expectedLogLength, "Telemetry log should have " + expectedLogLength + " entries.");
- checkEvent(log[log.length-1], TLOG.TERMINATION_KEY,
- [TLOG.TERMINATION.FROM_API, EXPERIMENT3_ID]);
-
- // Trigger update with experiment 1a ready to start.
-
- now = futureDate(now, MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- gManifestObject.experiments[0].id = EXPERIMENT4_ID;
- gManifestObject.experiments[0].endTime = dateToSeconds(futureDate(now, 50 * MS_IN_ONE_DAY));
-
- yield experiments.updateManifest();
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 4, "Experiment list should have 4 entries.");
-
- expectedLogLength += 1;
- log = TelemetryLog.entries();
- Assert.equal(log.length, expectedLogLength, "Telemetry log should have " + expectedLogLength + " entries.");
- checkEvent(log[log.length-1], TLOG.ACTIVATION_KEY,
- [TLOG.ACTIVATION.ACTIVATED, EXPERIMENT4_ID]);
-
- // Trigger experiment termination by something other than expiry via the manifest.
-
- now = futureDate(now, MS_IN_ONE_DAY);
- defineNow(gPolicy, now);
- gManifestObject.experiments[0].os = "Plan9";
-
- yield experiments.updateManifest();
- list = yield experiments.getExperiments();
- Assert.equal(list.length, 4, "Experiment list should have 4 entries.");
-
- expectedLogLength += 1;
- log = TelemetryLog.entries();
- Assert.equal(log.length, expectedLogLength, "Telemetry log should have " + expectedLogLength + " entries.");
- checkEvent(log[log.length-1], TLOG.TERMINATION_KEY,
- [TLOG.TERMINATION.RECHECK, EXPERIMENT4_ID, "os"]);
-
- // Cleanup.
-
- yield promiseRestartManager();
- yield removeCacheFile();
-});
diff --git a/browser/experiments/test/xpcshell/test_telemetry_disabled.js b/browser/experiments/test/xpcshell/test_telemetry_disabled.js
deleted file mode 100644
index 74f85ccfc7..0000000000
--- a/browser/experiments/test/xpcshell/test_telemetry_disabled.js
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-Cu.import("resource:///modules/experiments/Experiments.jsm");
-
-add_test(function test_experiments_activation() {
- do_get_profile();
- loadAddonManager();
-
- Services.prefs.setBoolPref(PREF_EXPERIMENTS_ENABLED, true);
- Services.prefs.setBoolPref(PREF_TELEMETRY_ENABLED, false);
-
- let experiments = Experiments.instance();
- Assert.ok(!experiments.enabled, "Experiments must be disabled if Telemetry is disabled.");
-
- // TODO: Test that Experiments are turned back on when bug 1232648 lands.
-
- run_next_test();
-});
diff --git a/browser/experiments/test/xpcshell/test_upgrade.js b/browser/experiments/test/xpcshell/test_upgrade.js
deleted file mode 100644
index f094a406d3..0000000000
--- a/browser/experiments/test/xpcshell/test_upgrade.js
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-Cu.import("resource:///modules/experiments/Experiments.jsm");
-
-var cacheData = {
- _enabled: true,
- _manifestData: {
- id: "foobartestid",
- xpiURL: "http://example.com/foo.xpi",
- xpiHash: "sha256:abcde",
- startTime: 0,
- endTime: 2000000000,
- maxActiveSeconds: 40000000,
- appName: "TestApp",
- channel: "test-foo",
- },
- _needsUpdate: false,
- _randomValue: 0.5,
- _failedStart: false,
- _name: "Foo",
- _description: "Foobar",
- _homepageURL: "",
- _addonId: "foo@test",
- _startDate: 0,
- _endDate: 2000000000,
- _branch: null
-};
-
-add_task(function* test_valid() {
- let e = new Experiments.ExperimentEntry();
- Assert.ok(e.initFromCacheData(cacheData));
- Assert.ok(e.enabled);
-});
-
-add_task(function* test_upgrade() {
- let e = new Experiments.ExperimentEntry();
- delete cacheData._branch;
- Assert.ok(e.initFromCacheData(cacheData));
- Assert.ok(e.enabled);
-});
-
-add_task(function* test_missing() {
- let e = new Experiments.ExperimentEntry();
- delete cacheData._name;
- Assert.ok(!e.initFromCacheData(cacheData));
-});
-
-function run_test() {
- run_next_test();
-}
diff --git a/browser/experiments/test/xpcshell/xpcshell.ini b/browser/experiments/test/xpcshell/xpcshell.ini
deleted file mode 100644
index 5921c9c478..0000000000
--- a/browser/experiments/test/xpcshell/xpcshell.ini
+++ /dev/null
@@ -1,31 +0,0 @@
-[DEFAULT]
-head = head.js
-tail =
-tags = addons
-firefox-appdir = browser
-skip-if = toolkit == 'android'
-support-files =
- experiments_1.manifest
- experiment-1.xpi
- experiment-1a.xpi
- experiment-2.xpi
- experiment-racybranch.xpi
- !/toolkit/mozapps/webextensions/test/xpcshell/head_addons.js
-generated-files =
- experiment-1.xpi
- experiment-1a.xpi
- experiment-2.xpi
- experiment-racybranch.xpi
-
-[test_activate.js]
-[test_api.js]
-[test_cache.js]
-[test_cacherace.js]
-[test_conditions.js]
-[test_disableExperiments.js]
-[test_fetch.js]
-[test_telemetry.js]
-[test_telemetry_disabled.js]
-[test_previous_provider.js]
-[test_upgrade.js]
-[test_nethang_bug1012924.js]
diff --git a/browser/extensions/aushelper/bootstrap.js b/browser/extensions/aushelper/bootstrap.js
deleted file mode 100644
index f57f621e1a..0000000000
--- a/browser/extensions/aushelper/bootstrap.js
+++ /dev/null
@@ -1,189 +0,0 @@
-/* -*- 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/. */
-
-const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-
-const APP_UPDATE_URL_PREF = "app.update.url";
-const REPLACE_KEY = "%OS_VERSION%";
-
-const AUSHELPER_CPU_RESULT_CODE_HISTOGRAM_ID = "AUSHELPER_CPU_RESULT_CODE";
-// The system is not vulnerable to Bug 1296630.
-const CPU_NO_BUG1296630 = 1;
-// The system is vulnerable to Bug 1296630.
-const CPU_YES_BUG1296630 = 2;
-// An error occured when checking if the system is vulnerable to Bug 1296630.
-const CPU_ERR_BUG1296630 = 3;
-// It is unknown whether the system is vulnerable to Bug 1296630 (should never happen).
-const CPU_UNKNOWN_BUG1296630 = 4;
-
-const AUSHELPER_CPU_ERROR_CODE_HISTOGRAM_ID = "AUSHELPER_CPU_ERROR_CODE";
-const CPU_SUCCESS = 0;
-const CPU_REG_OPEN_ERROR = 1;
-const CPU_VENDOR_ID_ERROR = 2;
-const CPU_ID_ERROR = 4;
-const CPU_REV_ERROR = 8;
-
-const AUSHELPER_WEBSENSE_REG_VERSION_SCALAR_NAME = "aushelper.websense_reg_version";
-const AUSHELPER_WEBSENSE_REG_EXISTS_HISTOGRAM_ID = "AUSHELPER_WEBSENSE_REG_EXISTS";
-
-const AUSHELPER_WEBSENSE_ERROR_CODE_HISTOGRAM_ID = "AUSHELPER_WEBSENSE_ERROR_CODE";
-const WEBSENSE_SUCCESS = 0;
-const WEBSENSE_REG_OPEN_ERROR = 1;
-const WEBSENSE_REG_READ_ERROR = 2;
-const WEBSENSE_ALREADY_MODIFIED = 4;
-
-Cu.import("resource://gre/modules/Services.jsm");
-
-function startup() {
- if (Services.appinfo.OS != "WINNT") {
- return;
- }
-
- const regCPUPath = "HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0";
- let wrk;
- let cpuErrorCode = CPU_SUCCESS;
- try {
- wrk = Cc["@mozilla.org/windows-registry-key;1"].createInstance(Ci.nsIWindowsRegKey);
- wrk.open(wrk.ROOT_KEY_LOCAL_MACHINE, regCPUPath, wrk.ACCESS_READ);
- } catch (e) {
- Cu.reportError("AUSHelper - unable to open registry. Exception: " + e);
- cpuErrorCode |= CPU_REG_OPEN_ERROR;
- }
-
- // If any of the following values are successfully retrieved and they don't
- // match the condition for that value then it is safe to update. Hence why the
- // following checks are somewhat convoluted. The possible values for the
- // variable set by each check is as follows:
- //
- // | Match | No Match | Error |
- // variable | true | false | null |
-
- let cpuVendorIDMatch = false;
- try {
- let cpuVendorID = wrk.readStringValue("VendorIdentifier");
- if (cpuVendorID.toLowerCase() == "genuineintel") {
- cpuVendorIDMatch = true;
- }
- } catch (e) {
- Cu.reportError("AUSHelper - error getting CPU vendor indentifier. Exception: " + e);
- cpuVendorIDMatch = null;
- cpuErrorCode |= CPU_VENDOR_ID_ERROR;
- }
-
- let cpuIDMatch = false;
- try {
- let cpuID = wrk.readStringValue("Identifier");
- if (cpuID.toLowerCase().indexOf("family 6 model 61 stepping 4") != -1) {
- cpuIDMatch = true;
- }
- } catch (e) {
- Cu.reportError("AUSHelper - error getting CPU indentifier. Exception: " + e);
- cpuIDMatch = null;
- cpuErrorCode |= CPU_ID_ERROR;
- }
-
- let microCodeVersions = [0xe, 0x11, 0x12, 0x13, 0x16, 0x18, 0x19];
- let cpuRevMatch = null;
- try {
- let keyNames = ["Update Revision", "Update Signature"];
- for (let i = 0; i < keyNames.length; ++i) {
- try {
- let regVal = wrk.readBinaryValue(keyNames[i]);
- if (regVal.length == 8) {
- let hexVal = [];
- // We are only inyterested in the upper 4 bytes and the little endian
- // value for it.
- for (let j = 4; j < 8; j++) {
- let c = regVal.charCodeAt(j).toString(16);
- if (c.length == 1) {
- c = "0" + c;
- }
- hexVal.unshift(c);
- }
- cpuRevMatch = false;
- if (microCodeVersions.indexOf(parseInt(hexVal.join(''))) != -1) {
- cpuRevMatch = true;
- }
- break;
- }
- } catch (e) {
- if (i == keyNames.length - 1) {
- // The registry key name's value was not successfully queried.
- cpuRevMatch = null;
- cpuErrorCode |= CPU_REV_ERROR;
- }
- }
- }
- wrk.close();
- } catch (ex) {
- Cu.reportError("AUSHelper - error getting CPU revision. Exception: " + ex);
- cpuRevMatch = null;
- cpuErrorCode |= CPU_REV_ERROR;
- }
-
- let cpuResult = CPU_UNKNOWN_BUG1296630;
- let cpuValue = "(unkBug1296630v1)";
- // The following uses strict equality checks since the values can be true,
- // false, or null.
- if (cpuVendorIDMatch === false || cpuIDMatch === false || cpuRevMatch === false) {
- // Since one of the values is false then the system won't be affected by
- // bug 1296630 according to the conditions set out in bug 1311515.
- cpuValue = "(noBug1296630v1)";
- cpuResult = CPU_NO_BUG1296630;
- } else if (cpuVendorIDMatch === null || cpuIDMatch === null || cpuRevMatch === null) {
- // Since one of the values is null we can't say for sure if the system will
- // be affected by bug 1296630.
- cpuValue = "(errBug1296630v1)";
- cpuResult = CPU_ERR_BUG1296630;
- } else if (cpuVendorIDMatch === true && cpuIDMatch === true && cpuRevMatch === true) {
- // Since all of the values are true we can say that the system will be
- // affected by bug 1296630.
- cpuValue = "(yesBug1296630v1)";
- cpuResult = CPU_YES_BUG1296630;
- }
-
- Services.telemetry.getHistogramById(AUSHELPER_CPU_RESULT_CODE_HISTOGRAM_ID).add(cpuResult);
- Services.telemetry.getHistogramById(AUSHELPER_CPU_ERROR_CODE_HISTOGRAM_ID).add(cpuErrorCode);
-
- const regWebsensePath = "Websense\\Agent";
- let websenseErrorCode = WEBSENSE_SUCCESS;
- let websenseVersion = "";
- try {
- let regModes = [wrk.ACCESS_READ, wrk.ACCESS_READ | wrk.WOW64_64];
- for (let i = 0; i < regModes.length; ++i) {
- wrk.open(wrk.ROOT_KEY_LOCAL_MACHINE, "SOFTWARE", regModes[i]);
- try {
- if (wrk.hasChild(regWebsensePath)) {
- let childKey = wrk.openChild(regWebsensePath, wrk.ACCESS_READ);
- websenseVersion = childKey.readStringValue("InstallVersion");
- Services.telemetry.scalarSet(AUSHELPER_WEBSENSE_REG_VERSION_SCALAR_NAME, websenseVersion);
- }
- wrk.close();
- } catch (e) {
- Cu.reportError("AUSHelper - unable to read registry. Exception: " + e);
- websenseErrorCode |= WEBSENSE_REG_READ_ERROR;
- }
- }
- } catch (ex) {
- Cu.reportError("AUSHelper - unable to open registry. Exception: " + ex);
- websenseErrorCode |= WEBSENSE_REG_OPEN_ERROR;
- }
-
- Services.telemetry.getHistogramById(AUSHELPER_WEBSENSE_REG_EXISTS_HISTOGRAM_ID).add(!!websenseVersion);
- let websenseValue = "(" + (websenseVersion ? "websense-" + websenseVersion : "nowebsense") + ")";
-
- let branch = Services.prefs.getDefaultBranch("");
- let curValue = branch.getCharPref(APP_UPDATE_URL_PREF);
- if (curValue.indexOf(REPLACE_KEY + "/") > -1) {
- let newValue = curValue.replace(REPLACE_KEY + "/", REPLACE_KEY + cpuValue + websenseValue + "/");
- branch.setCharPref(APP_UPDATE_URL_PREF, newValue);
- } else {
- websenseErrorCode |= WEBSENSE_ALREADY_MODIFIED;
- }
- Services.telemetry.getHistogramById(AUSHELPER_WEBSENSE_ERROR_CODE_HISTOGRAM_ID).add(websenseErrorCode);
-}
-function shutdown() {}
-function install() {}
-function uninstall() {}
diff --git a/browser/extensions/aushelper/install.rdf.in b/browser/extensions/aushelper/install.rdf.in
deleted file mode 100644
index 78e841d884..0000000000
--- a/browser/extensions/aushelper/install.rdf.in
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
- - License, v. 2.0. If a copy of the MPL was not distributed with this
- - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-#filter substitution
-
-<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-
- <Description about="urn:mozilla:install-manifest">
- <em:id>aushelper@mozilla.org</em:id>
- <em:version>2.0</em:version>
- <em:type>2</em:type>
- <em:bootstrap>true</em:bootstrap>
- <em:multiprocessCompatible>true</em:multiprocessCompatible>
-
- <!-- Target Application this extension can install into,
- with minimum and maximum supported versions. -->
- <em:targetApplication>
- <Description>
- <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
- <em:minVersion>@MOZ_APP_VERSION@</em:minVersion>
- <em:maxVersion>@MOZ_APP_MAXVERSION@</em:maxVersion>
- </Description>
- </em:targetApplication>
-
- <!-- Front End MetaData -->
- <em:name>Application Update Service Helper</em:name>
- <em:description>Sets value(s) in the update url based on custom checks.</em:description>
- </Description>
-</RDF>
diff --git a/browser/extensions/aushelper/moz.build b/browser/extensions/aushelper/moz.build
deleted file mode 100644
index a4ff060556..0000000000
--- a/browser/extensions/aushelper/moz.build
+++ /dev/null
@@ -1,16 +0,0 @@
-# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION']
-DEFINES['MOZ_APP_MAXVERSION'] = CONFIG['MOZ_APP_MAXVERSION']
-
-FINAL_TARGET_FILES.features['aushelper@mozilla.org'] += [
- 'bootstrap.js'
-]
-
-FINAL_TARGET_PP_FILES.features['aushelper@mozilla.org'] += [
- 'install.rdf.in'
-]
diff --git a/browser/extensions/e10srollout/bootstrap.js b/browser/extensions/e10srollout/bootstrap.js
deleted file mode 100644
index 0da7ac225a..0000000000
--- a/browser/extensions/e10srollout/bootstrap.js
+++ /dev/null
@@ -1,197 +0,0 @@
-/* -*- 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/. */
-"use strict";
-
-const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-
-Cu.import("resource://gre/modules/Preferences.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/UpdateUtils.jsm");
-Cu.import("resource://gre/modules/AppConstants.jsm");
-
- // The amount of people to be part of e10s
-const TEST_THRESHOLD = {
- "beta" : 0.5, // 50%
- "release" : 1.0, // 100%
- "esr" : 1.0, // 100%
-};
-
-const ADDON_ROLLOUT_POLICY = {
- "beta" : "51alladdons", // Any WebExtension or addon except with mpc = false
- "release" : "51set1",
- "esr" : "esrA", // WebExtensions and Addons with mpc=true
-};
-
-if (AppConstants.RELEASE_OR_BETA) {
- // Bug 1348576 - e10s is never enabled for non-official release builds
- // This is hacky, but the problem it solves is the following:
- // the e10s rollout is controlled by the channel name, which
- // is the only way to distinguish between Beta and Release.
- // However, non-official release builds (like the ones done by distros
- // to ship Firefox on their package managers) do not set a value
- // for the release channel, which gets them to the default value
- // of.. (drumroll) "default".
- // But we can't just always configure the same settings for the
- // "default" channel because that's also the name that a locally
- // built Firefox gets, and e10s is managed in a different way
- // there (directly by prefs, on Nightly and Aurora).
- TEST_THRESHOLD.default = TEST_THRESHOLD.release;
- ADDON_ROLLOUT_POLICY.default = ADDON_ROLLOUT_POLICY.release;
-}
-
-
-const PREF_COHORT_SAMPLE = "e10s.rollout.cohortSample";
-const PREF_COHORT_NAME = "e10s.rollout.cohort";
-const PREF_E10S_OPTED_IN = "browser.tabs.remote.autostart";
-const PREF_E10S_FORCE_ENABLED = "browser.tabs.remote.force-enable";
-const PREF_E10S_FORCE_DISABLED = "browser.tabs.remote.force-disable";
-const PREF_TOGGLE_E10S = "browser.tabs.remote.autostart.2";
-const PREF_E10S_ADDON_POLICY = "extensions.e10s.rollout.policy";
-const PREF_E10S_ADDON_BLOCKLIST = "extensions.e10s.rollout.blocklist";
-const PREF_E10S_HAS_NONEXEMPT_ADDON = "extensions.e10s.rollout.hasAddon";
-
-function startup() {
- // In theory we only need to run this once (on install()), but
- // it's better to also run it on every startup. If the user has
- // made manual changes to the prefs, this will keep the data
- // reported more accurate.
- // It's also fine (and preferred) to just do it here on startup
- // (instead of observing prefs), because e10s takes a restart
- // to take effect, so we keep the data based on how it was when
- // the session started.
- defineCohort();
-}
-
-function install() {
- defineCohort();
-}
-
-let cohortDefinedOnThisSession = false;
-
-function defineCohort() {
- // Avoid running twice when it was called by install() first
- if (cohortDefinedOnThisSession) {
- return;
- }
- cohortDefinedOnThisSession = true;
-
- let updateChannel = UpdateUtils.getUpdateChannel(false);
- if (!(updateChannel in TEST_THRESHOLD)) {
- setCohort("unsupportedChannel");
- return;
- }
-
- let addonPolicy = "unknown";
- if (updateChannel in ADDON_ROLLOUT_POLICY) {
- addonPolicy = ADDON_ROLLOUT_POLICY[updateChannel];
- Preferences.set(PREF_E10S_ADDON_POLICY, addonPolicy);
- // This is also the proper place to set the blocklist pref
- // in case it is necessary.
-
- Preferences.set(PREF_E10S_ADDON_BLOCKLIST,
- // bug 1185672 - Tab Mix Plus
- "{dc572301-7619-498c-a57d-39143191b318};" +
- // bug 1332692 - LastPass
- "support@lastpass.com;");
- } else {
- Preferences.reset(PREF_E10S_ADDON_POLICY);
- }
-
- let userOptedOut = optedOut();
- let userOptedIn = optedIn();
- let disqualified = (Services.appinfo.multiprocessBlockPolicy != 0);
- let testGroup = (getUserSample() < TEST_THRESHOLD[updateChannel]);
- let hasNonExemptAddon = Preferences.get(PREF_E10S_HAS_NONEXEMPT_ADDON, false);
- let temporaryDisqualification = getTemporaryDisqualification();
-
- let cohortPrefix = "";
- if (disqualified) {
- cohortPrefix = "disqualified-";
- } else if (hasNonExemptAddon) {
- cohortPrefix = `addons-set${addonPolicy}-`;
- }
-
- if (userOptedOut) {
- setCohort("optedOut");
- } else if (userOptedIn) {
- setCohort("optedIn");
- } else if (temporaryDisqualification != "") {
- // Users who are disqualified by the backend (from multiprocessBlockPolicy)
- // can be put into either the test or control groups, because e10s will
- // still be denied by the backend, which is useful so that the E10S_STATUS
- // telemetry probe can be correctly set.
-
- // For these volatile disqualification reasons, however, we must not try
- // to activate e10s because the backend doesn't know about it. E10S_STATUS
- // here will be accumulated as "2 - Disabled", which is fine too.
- setCohort(`temp-disqualified-${temporaryDisqualification}`);
- Preferences.reset(PREF_TOGGLE_E10S);
- } else if (testGroup) {
- setCohort(`${cohortPrefix}test`);
- Preferences.set(PREF_TOGGLE_E10S, true);
- } else {
- setCohort(`${cohortPrefix}control`);
- Preferences.reset(PREF_TOGGLE_E10S);
- }
-}
-
-function shutdown(data, reason) {
-}
-
-function uninstall() {
-}
-
-function getUserSample() {
- let prefValue = Preferences.get(PREF_COHORT_SAMPLE, undefined);
- let value = 0.0;
-
- if (typeof(prefValue) == "string") {
- value = parseFloat(prefValue, 10);
- return value;
- }
-
- if (typeof(prefValue) == "number") {
- // convert old integer value
- value = prefValue / 100;
- } else {
- value = Math.random();
- }
-
- Preferences.set(PREF_COHORT_SAMPLE, value.toString().substr(0, 8));
- return value;
-}
-
-function setCohort(cohortName) {
- Preferences.set(PREF_COHORT_NAME, cohortName);
- try {
- if (Ci.nsICrashReporter) {
- Services.appinfo.QueryInterface(Ci.nsICrashReporter).annotateCrashReport("E10SCohort", cohortName);
- }
- } catch (e) {}
-}
-
-function optedIn() {
- return Preferences.get(PREF_E10S_OPTED_IN, false) ||
- Preferences.get(PREF_E10S_FORCE_ENABLED, false);
-}
-
-function optedOut() {
- // Users can also opt-out by toggling back the pref to false.
- // If they reset the pref instead they might be re-enabled if
- // they are still part of the threshold.
- return Preferences.get(PREF_E10S_FORCE_DISABLED, false) ||
- (Preferences.isSet(PREF_TOGGLE_E10S) &&
- Preferences.get(PREF_TOGGLE_E10S) == false);
-}
-
-/* If this function returns a non-empty string, it
- * means that this particular user should be temporarily
- * disqualified due to some particular reason.
- * If a user shouldn't be disqualified, then an empty
- * string must be returned.
- */
-function getTemporaryDisqualification() {
- return "";
-}
diff --git a/browser/extensions/e10srollout/install.rdf.in b/browser/extensions/e10srollout/install.rdf.in
deleted file mode 100644
index 19ff584710..0000000000
--- a/browser/extensions/e10srollout/install.rdf.in
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
- - License, v. 2.0. If a copy of the MPL was not distributed with this
- - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-#filter substitution
-
-<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-
- <Description about="urn:mozilla:install-manifest">
- <em:id>e10srollout@mozilla.org</em:id>
- <em:version>1.10</em:version>
- <em:type>2</em:type>
- <em:bootstrap>true</em:bootstrap>
- <em:multiprocessCompatible>true</em:multiprocessCompatible>
-
- <!-- Target Application this theme can install into,
- with minimum and maximum supported versions. -->
- <em:targetApplication>
- <Description>
- <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
- <em:minVersion>@MOZ_APP_VERSION@</em:minVersion>
- <em:maxVersion>@MOZ_APP_MAXVERSION@</em:maxVersion>
- </Description>
- </em:targetApplication>
-
- <!-- Front End MetaData -->
- <em:name>Multi-process staged rollout</em:name>
- <em:description>Staged rollout of Firefox multi-process feature.</em:description>
- </Description>
-</RDF>
diff --git a/browser/extensions/e10srollout/moz.build b/browser/extensions/e10srollout/moz.build
deleted file mode 100644
index 9b5a16d5a5..0000000000
--- a/browser/extensions/e10srollout/moz.build
+++ /dev/null
@@ -1,16 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION']
-DEFINES['MOZ_APP_MAXVERSION'] = CONFIG['MOZ_APP_MAXVERSION']
-
-FINAL_TARGET_FILES.features['e10srollout@mozilla.org'] += [
- 'bootstrap.js'
-]
-
-FINAL_TARGET_PP_FILES.features['e10srollout@mozilla.org'] += [
- 'install.rdf.in'
-]
diff --git a/browser/extensions/flyweb/bootstrap.js b/browser/extensions/flyweb/bootstrap.js
deleted file mode 100644
index 0892265191..0000000000
--- a/browser/extensions/flyweb/bootstrap.js
+++ /dev/null
@@ -1,297 +0,0 @@
-/* -*- 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/. */
-
-const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
- "resource:///modules/CustomizableUI.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "Console",
- "resource://gre/modules/Console.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "Services",
- "resource://gre/modules/Services.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "Integration",
- "resource://gre/modules/Integration.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "PermissionUI",
- "resource:///modules/PermissionUI.jsm");
-
-XPCOMUtils.defineLazyGetter(this, "gFlyWebBundle", function() {
- const tns = {
- "flyweb-button.label": "FlyWeb",
- "flyweb-button.tooltiptext": "Discover nearby FlyWeb services",
- "flyweb-items-empty": "There are no FlyWeb services currently nearby"
- };
- return {
- GetStringFromName(name) {
- return tns[name];
- }
- };
-});
-
-const FLYWEB_ENABLED_PREF = "dom.flyweb.enabled";
-
-function install(aData, aReason) {}
-
-function uninstall(aData, aReason) {}
-
-function startup(aData, aReason) {
- // Observe pref changes and enable/disable as necessary.
- Services.prefs.addObserver(FLYWEB_ENABLED_PREF, prefObserver, false);
-
- // Only initialize if pref is enabled.
- let enabled = Services.prefs.getBoolPref(FLYWEB_ENABLED_PREF);
- if (enabled) {
- FlyWebView.init();
- }
-}
-
-function shutdown(aData, aReason) {
- Services.prefs.removeObserver(FLYWEB_ENABLED_PREF, prefObserver);
-
- let enabled = Services.prefs.getBoolPref(FLYWEB_ENABLED_PREF);
- if (enabled) {
- FlyWebView.uninit();
- }
-}
-
-// use enabled pref as a way for tests (e.g. test_contextmenu.html) to disable
-// the addon when running.
-function prefObserver(aSubject, aTopic, aData) {
- let enabled = Services.prefs.getBoolPref(FLYWEB_ENABLED_PREF);
- if (enabled) {
- FlyWebView.init();
- } else {
- FlyWebView.uninit();
- }
-}
-
-let gDiscoveryManagerInstance;
-
-class DiscoveryManager {
- constructor(aWindow) {
- this._discoveryManager = new aWindow.FlyWebDiscoveryManager();
- }
-
- destroy() {
- if (this._id) {
- this.stop();
- }
-
- this._discoveryManager = null;
- }
-
- start(callback) {
- if (!this._id) {
- this._id = this._discoveryManager.startDiscovery(this);
- }
-
- this._callback = callback;
- }
-
- stop() {
- this._discoveryManager.stopDiscovery(this._id);
-
- this._id = null;
- }
-
- pairWith(serviceId, callback) {
- this._discoveryManager.pairWithService(serviceId, {
- pairingSucceeded(service) {
- callback(service);
- },
-
- pairingFailed(error) {
- console.error("FlyWeb failed to pair with service " + serviceId, error);
- }
- });
- }
-
- onDiscoveredServicesChanged(services) {
- if (!this._id || !this._callback) {
- return;
- }
-
- this._callback(services);
- }
-}
-
-const FlyWebPermissionPromptIntegration = (base) => ({
- __proto__: base,
- createPermissionPrompt(type, request) {
- if (type != "flyweb-publish-server") {
- return super.createPermissionPrompt(...arguments);
- }
-
- return {
- __proto__: PermissionUI.PermissionPromptForRequestPrototype,
- get request() {
- return request;
- },
- get permissionKey() {
- return "flyweb-publish-server";
- },
- get popupOptions() {
- return {
- learnMoreURL: "https://flyweb.github.io",
- popupIconURL: "chrome://flyweb/skin/icon-64.png",
- };
- },
- get notificationID() {
- return "flyweb-publish-server";
- },
- get anchorID() {
- const kAnchorID = "flyweb-publish-server-notification-icon";
- let chromeDoc = this.browser.ownerDocument;
- let anchor = chromeDoc.getElementById(kAnchorID);
- if (!anchor) {
- let notificationPopupBox =
- chromeDoc.getElementById("notification-popup-box");
- let notificationIcon = chromeDoc.createElement("image");
- notificationIcon.id = kAnchorID;
- notificationIcon.setAttribute("src",
- "chrome://flyweb/skin/icon-64.png");
- notificationIcon.classList.add("notification-anchor-icon");
- notificationIcon.setAttribute("role", "button");
- notificationIcon.setAttribute("aria-label",
- "View the publish-server request");
- notificationIcon.style.filter =
- "url('chrome://browser/skin/filters.svg#fill')";
- notificationIcon.style.fill = "currentcolor";
- notificationIcon.style.opacity = "0.4";
- notificationPopupBox.appendChild(notificationIcon);
- }
-
- return kAnchorID;
- },
- get message() {
- return "Would you like to let this site start a server accessible " +
- "to nearby devices and people?";
- },
- get promptActions() {
- return [{
- label: "Allow Server",
- accessKey: "A",
- action: Ci.nsIPermissionManager.ALLOW_ACTION,
- expireType: Ci.nsIPermissionManager.EXPIRE_SESSION,
- }, {
- label: "Block Server",
- accessKey: "B",
- action: Ci.nsIPermissionManager.DENY_ACTION,
- expireType: Ci.nsIPermissionManager.EXPIRE_SESSION,
- }];
- },
- };
- },
-});
-
-let FlyWebView = {
- init() {
- // Create widget and add it to the menu panel.
- CustomizableUI.createWidget({
- id: "flyweb-button",
- type: "view",
- viewId: "flyweb-panel",
- label: gFlyWebBundle.GetStringFromName("flyweb-button.label"),
- tooltiptext: gFlyWebBundle.GetStringFromName("flyweb-button.tooltiptext"),
-
- onBeforeCreated(aDocument) {
- let panel = aDocument.createElement("panelview");
- panel.id = "flyweb-panel";
- panel.setAttribute("class", "PanelUI-subView");
- panel.setAttribute("flex", "1");
-
- let label = aDocument.createElement("label");
- label.setAttribute("class", "panel-subview-header");
- label.setAttribute("value", gFlyWebBundle.GetStringFromName("flyweb-button.label"));
-
- let empty = aDocument.createElement("description");
- empty.id = "flyweb-items-empty";
- empty.setAttribute("mousethrough", "always");
- empty.textContent = gFlyWebBundle.GetStringFromName("flyweb-items-empty");
-
- let items = aDocument.createElement("vbox");
- items.id = "flyweb-items";
- items.setAttribute("class", "panel-subview-body");
-
- panel.appendChild(label);
- panel.appendChild(empty);
- panel.appendChild(items);
-
- panel.addEventListener("command", this);
-
- aDocument.getElementById("PanelUI-multiView").appendChild(panel);
-
- this._sheetURI = Services.io.newURI("chrome://flyweb/skin/flyweb.css", null, null);
- aDocument.defaultView.QueryInterface(Ci.nsIInterfaceRequestor).
- getInterface(Ci.nsIDOMWindowUtils).loadSheet(this._sheetURI, 1);
- },
-
- onDestroyed(aDocument) {
- aDocument.defaultView.QueryInterface(Ci.nsIInterfaceRequestor).
- getInterface(Ci.nsIDOMWindowUtils).removeSheet(this._sheetURI, 1);
- },
-
- onViewShowing(aEvent) {
- let doc = aEvent.target.ownerDocument;
-
- let items = doc.getElementById("flyweb-items");
- let empty = doc.getElementById("flyweb-items-empty");
-
- if (!gDiscoveryManagerInstance) {
- gDiscoveryManagerInstance = new DiscoveryManager(doc.defaultView);
- }
-
- gDiscoveryManagerInstance.start((services) => {
- while (items.firstChild) {
- items.firstChild.remove();
- }
-
- let fragment = doc.createDocumentFragment();
-
- for (let service of services) {
- let button = doc.createElement("toolbarbutton");
- button.setAttribute("class", "subviewbutton cui-withicon");
- button.setAttribute("label", service.displayName);
- button.setAttribute("data-service-id", service.serviceId);
- fragment.appendChild(button);
- }
-
- items.appendChild(fragment);
-
- empty.hidden = services.length > 0;
- });
- },
-
- onViewHiding(aEvent) {
- gDiscoveryManagerInstance.stop();
- },
-
- handleEvent(aEvent) {
- if (aEvent.type === "command") {
- let serviceId = aEvent.target.getAttribute("data-service-id");
- gDiscoveryManagerInstance.pairWith(serviceId, (service) => {
- aEvent.view.openUILinkIn(service.uiUrl, "tab");
- });
- }
- }
- });
-
- Integration.contentPermission
- .register(FlyWebPermissionPromptIntegration);
- },
-
- uninit() {
- CustomizableUI.destroyWidget("flyweb-button");
-
- if (gDiscoveryManagerInstance) {
- gDiscoveryManagerInstance.destroy();
- gDiscoveryManagerInstance = null;
- }
-
- Integration.contentPermission
- .unregister(FlyWebPermissionPromptIntegration);
- }
-};
diff --git a/browser/extensions/flyweb/install.rdf.in b/browser/extensions/flyweb/install.rdf.in
deleted file mode 100644
index 17f746f9b2..0000000000
--- a/browser/extensions/flyweb/install.rdf.in
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
- - License, v. 2.0. If a copy of the MPL was not distributed with this
- - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-#filter substitution
-
-<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-
- <Description about="urn:mozilla:install-manifest">
- <em:id>flyweb@mozilla.org</em:id>
- <em:version>1.0.0</em:version>
- <em:type>2</em:type>
- <em:bootstrap>true</em:bootstrap>
- <em:multiprocessCompatible>true</em:multiprocessCompatible>
-
- <!-- Target Application this theme can install into,
- with minimum and maximum supported versions. -->
- <em:targetApplication>
- <Description>
- <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
- <em:minVersion>@MOZ_APP_VERSION@</em:minVersion>
- <em:maxVersion>@MOZ_APP_MAXVERSION@</em:maxVersion>
- </Description>
- </em:targetApplication>
-
- <!-- Front End MetaData -->
- <em:name>FlyWeb</em:name>
- <em:description>Discover nearby services in the browser</em:description>
- </Description>
-</RDF>
diff --git a/browser/extensions/flyweb/jar.mn b/browser/extensions/flyweb/jar.mn
deleted file mode 100644
index 8eed2135b3..0000000000
--- a/browser/extensions/flyweb/jar.mn
+++ /dev/null
@@ -1,10 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-[features/flyweb@mozilla.org] chrome.jar:
-% skin flyweb classic/1.0 %skin/linux/
-% skin flyweb classic/1.0 %skin/osx/ os=Darwin
-% skin flyweb classic/1.0 %skin/windows/ os=WINNT
-% skin flyweb-shared classic/1.0 %skin/shared/
- skin/ (skin/*)
diff --git a/browser/extensions/flyweb/moz.build b/browser/extensions/flyweb/moz.build
deleted file mode 100644
index 7f71bfb55c..0000000000
--- a/browser/extensions/flyweb/moz.build
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION']
-DEFINES['MOZ_APP_MAXVERSION'] = CONFIG['MOZ_APP_MAXVERSION']
-
-FINAL_TARGET_FILES.features['flyweb@mozilla.org'] += [
- 'bootstrap.js'
-]
-
-FINAL_TARGET_PP_FILES.features['flyweb@mozilla.org'] += [
- 'install.rdf.in'
-]
-
-JAR_MANIFESTS += ['jar.mn']
diff --git a/browser/extensions/flyweb/skin/flyweb-icon.svg b/browser/extensions/flyweb/skin/flyweb-icon.svg
deleted file mode 100644
index 1b247e6458..0000000000
--- a/browser/extensions/flyweb/skin/flyweb-icon.svg
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
- width="64px" height="64px" viewBox="0 0 64 64" enable-background="new 0 0 64 64" xml:space="preserve">
-<circle fill="#797C80" cx="32" cy="52" r="6"/>
-<g>
- <path fill="#797C80" d="M6.894,15.255c-2.254,1.547-4.386,3.304-6.361,5.279L0.18,20.887l3.536,3.536l0.354-0.354
- c1.621-1.62,3.363-3.072,5.196-4.369C8.126,18.464,7.296,16.943,6.894,15.255z"/>
- <path fill="#797C80" d="M63.465,20.532C55.061,12.128,43.887,7.5,32,7.5c-2.265,0-4.504,0.17-6.703,0.501
- c0.822,1.44,1.3,3.1,1.312,4.87C28.382,12.631,30.181,12.5,32,12.5c10.55,0,20.468,4.108,27.928,11.567l0.354,0.354l3.537-3.535
- L63.465,20.532z"/>
-</g>
-<g>
- <path fill="#797C80" d="M16.613,10.94c1.103,0,2,0.897,2,2s-0.897,2-2,2s-2-0.897-2-2S15.51,10.94,16.613,10.94 M16.613,6.94
- c-3.313,0-6,2.687-6,6s2.687,6,6,6s6-2.687,6-6S19.926,6.94,16.613,6.94L16.613,6.94z"/>
-</g>
-<g>
- <path fill="#797C80" d="M46.492,37.502c-1.853-1.852-4.002-3.292-6.334-4.305c0.031,0.324,0.05,0.652,0.05,0.984
- c0,1.477-0.33,2.874-0.906,4.137c1.329,0.712,2.561,1.623,3.657,2.719l0.354,0.354l3.533-3.535L46.492,37.502z"/>
- <path fill="#797C80" d="M20.262,35.207c-0.972,0.683-1.9,1.439-2.758,2.297l-0.354,0.354l3.536,3.537l0.354-0.354
- c0.35-0.35,0.715-0.679,1.091-0.99C21.118,38.66,20.446,37.007,20.262,35.207z"/>
-</g>
-<g>
- <path fill="#797C80" d="M30.209,32.182c1.102,0,1.999,0.897,1.999,2s-0.896,2-1.999,2c-1.103,0-2-0.897-2-2
- S29.106,32.182,30.209,32.182 M30.209,28.182c-3.313,0-6,2.686-6,6c0,3.312,2.687,6,6,6c3.313,0,5.999-2.688,5.999-6
- C36.208,30.867,33.522,28.182,30.209,28.182L30.209,28.182z"/>
-</g>
-<g>
- <path fill="#797C80" d="M32.207,23.716c0-1.497,0.34-2.912,0.932-4.188C32.76,19.515,32.381,19.5,32,19.5
- c-8.681,0-16.843,3.381-22.981,9.52l-0.354,0.354l3.535,3.535l0.354-0.354C17.748,27.36,24.654,24.5,32,24.5
- c0.083,0,0.165,0.005,0.247,0.006C32.227,24.245,32.207,23.982,32.207,23.716z"/>
- <path fill="#797C80" d="M54.98,29.018c-0.987-0.987-2.033-1.896-3.119-2.738c-0.447,1.68-1.313,3.188-2.491,4.399
- c0.717,0.586,1.409,1.21,2.073,1.874l0.354,0.354l3.537-3.535L54.98,29.018z"/>
-</g>
-<g>
- <path fill="#797C80" d="M42.207,21.716c1.103,0,2,0.897,2,2s-0.897,2-2,2s-2-0.897-2-2S41.104,21.716,42.207,21.716 M42.207,17.716
- c-3.313,0-6,2.687-6,6s2.687,6,6,6s6-2.687,6-6S45.521,17.716,42.207,17.716L42.207,17.716z"/>
-</g>
-</svg>
diff --git a/browser/extensions/flyweb/skin/linux/flyweb.css b/browser/extensions/flyweb/skin/linux/flyweb.css
deleted file mode 100644
index c549248da2..0000000000
--- a/browser/extensions/flyweb/skin/linux/flyweb.css
+++ /dev/null
@@ -1,5 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-@import url("chrome://flyweb-shared/skin/flyweb.css");
diff --git a/browser/extensions/flyweb/skin/linux/icon-16.png b/browser/extensions/flyweb/skin/linux/icon-16.png
deleted file mode 100644
index 3a6c2e43a8..0000000000
--- a/browser/extensions/flyweb/skin/linux/icon-16.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/flyweb/skin/linux/icon-32-anchored.png b/browser/extensions/flyweb/skin/linux/icon-32-anchored.png
deleted file mode 100644
index b05590ddac..0000000000
--- a/browser/extensions/flyweb/skin/linux/icon-32-anchored.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/flyweb/skin/linux/icon-32.png b/browser/extensions/flyweb/skin/linux/icon-32.png
deleted file mode 100644
index a04ec20b99..0000000000
--- a/browser/extensions/flyweb/skin/linux/icon-32.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/flyweb/skin/linux/icon-64-anchored.png b/browser/extensions/flyweb/skin/linux/icon-64-anchored.png
deleted file mode 100644
index b617b92086..0000000000
--- a/browser/extensions/flyweb/skin/linux/icon-64-anchored.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/flyweb/skin/linux/icon-64.png b/browser/extensions/flyweb/skin/linux/icon-64.png
deleted file mode 100644
index be8ece467b..0000000000
--- a/browser/extensions/flyweb/skin/linux/icon-64.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/flyweb/skin/osx/flyweb.css b/browser/extensions/flyweb/skin/osx/flyweb.css
deleted file mode 100644
index c549248da2..0000000000
--- a/browser/extensions/flyweb/skin/osx/flyweb.css
+++ /dev/null
@@ -1,5 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-@import url("chrome://flyweb-shared/skin/flyweb.css");
diff --git a/browser/extensions/flyweb/skin/osx/icon-16.png b/browser/extensions/flyweb/skin/osx/icon-16.png
deleted file mode 100644
index 7c87435a48..0000000000
--- a/browser/extensions/flyweb/skin/osx/icon-16.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/flyweb/skin/osx/icon-32-anchored.png b/browser/extensions/flyweb/skin/osx/icon-32-anchored.png
deleted file mode 100644
index b05590ddac..0000000000
--- a/browser/extensions/flyweb/skin/osx/icon-32-anchored.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/flyweb/skin/osx/icon-32.png b/browser/extensions/flyweb/skin/osx/icon-32.png
deleted file mode 100644
index 5b0140ffad..0000000000
--- a/browser/extensions/flyweb/skin/osx/icon-32.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/flyweb/skin/osx/icon-64-anchored.png b/browser/extensions/flyweb/skin/osx/icon-64-anchored.png
deleted file mode 100644
index b617b92086..0000000000
--- a/browser/extensions/flyweb/skin/osx/icon-64-anchored.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/flyweb/skin/osx/icon-64.png b/browser/extensions/flyweb/skin/osx/icon-64.png
deleted file mode 100644
index eb67c29ec1..0000000000
--- a/browser/extensions/flyweb/skin/osx/icon-64.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/flyweb/skin/shared/flyweb.css b/browser/extensions/flyweb/skin/shared/flyweb.css
deleted file mode 100644
index acc8a743d3..0000000000
--- a/browser/extensions/flyweb/skin/shared/flyweb.css
+++ /dev/null
@@ -1,54 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#flyweb-panel {
- width: 20em;
-}
-
-#flyweb-items-empty {
- box-sizing: border-box;
- color: GrayText;
- padding: 10px 20px;
- text-align: center;
-}
-
-#flyweb-button {
- list-style-image: url("chrome://flyweb/skin/icon-16.png");
-}
-
-#flyweb-button[cui-areatype="menu-panel"],
-toolbarpaletteitem[place="palette"] > #flyweb-button {
- list-style-image: url("chrome://flyweb/skin/icon-32.png");
-}
-
-#flyweb-button[cui-areatype="menu-panel"][panel-multiview-anchor="true"] {
- list-style-image: url("chrome://flyweb/skin/icon-32-anchored.png");
-}
-
-#flyweb-items > toolbarbutton {
- list-style-image: url("chrome://flyweb/skin/icon-16.png");
-}
-
-@media (min-resolution: 2dppx) {
- #flyweb-button {
- list-style-image: url("chrome://flyweb/skin/icon-32.png");
- }
-
- #flyweb-button[cui-areatype="menu-panel"],
- toolbarpaletteitem[place="palette"] > #flyweb-button {
- list-style-image: url("chrome://flyweb/skin/icon-64.png");
- }
-
- #flyweb-button[cui-areatype="menu-panel"][panel-multiview-anchor="true"] {
- list-style-image: url("chrome://flyweb/skin/icon-64-anchored.png");
- }
-
- #flyweb-items > toolbarbutton {
- list-style-image: url("chrome://flyweb/skin/icon-32.png");
- }
-
- #flyweb-items > toolbarbutton > .toolbarbutton-icon {
- width: 16px;
- }
-}
diff --git a/browser/extensions/flyweb/skin/windows/flyweb.css b/browser/extensions/flyweb/skin/windows/flyweb.css
deleted file mode 100644
index c549248da2..0000000000
--- a/browser/extensions/flyweb/skin/windows/flyweb.css
+++ /dev/null
@@ -1,5 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-@import url("chrome://flyweb-shared/skin/flyweb.css");
diff --git a/browser/extensions/flyweb/skin/windows/icon-16.png b/browser/extensions/flyweb/skin/windows/icon-16.png
deleted file mode 100644
index 3a6c2e43a8..0000000000
--- a/browser/extensions/flyweb/skin/windows/icon-16.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/flyweb/skin/windows/icon-32-anchored.png b/browser/extensions/flyweb/skin/windows/icon-32-anchored.png
deleted file mode 100644
index b05590ddac..0000000000
--- a/browser/extensions/flyweb/skin/windows/icon-32-anchored.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/flyweb/skin/windows/icon-32.png b/browser/extensions/flyweb/skin/windows/icon-32.png
deleted file mode 100644
index a04ec20b99..0000000000
--- a/browser/extensions/flyweb/skin/windows/icon-32.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/flyweb/skin/windows/icon-64-anchored.png b/browser/extensions/flyweb/skin/windows/icon-64-anchored.png
deleted file mode 100644
index b617b92086..0000000000
--- a/browser/extensions/flyweb/skin/windows/icon-64-anchored.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/flyweb/skin/windows/icon-64.png b/browser/extensions/flyweb/skin/windows/icon-64.png
deleted file mode 100644
index be8ece467b..0000000000
--- a/browser/extensions/flyweb/skin/windows/icon-64.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/formautofill/.eslintrc.js b/browser/extensions/formautofill/.eslintrc.js
deleted file mode 100644
index ec89029e55..0000000000
--- a/browser/extensions/formautofill/.eslintrc.js
+++ /dev/null
@@ -1,474 +0,0 @@
-"use strict";
-
-module.exports = { // eslint-disable-line no-undef
- "extends": "../../.eslintrc.js",
-
- "globals": {
- "Components": true,
- "dump": true,
- "TextDecoder": false,
- "TextEncoder": false,
- },
-
- "rules": {
- // Rules from the mozilla plugin
- "mozilla/balanced-listeners": "error",
- "mozilla/no-aArgs": "warn",
- "mozilla/no-cpows-in-tests": "warn",
- "mozilla/var-only-at-top-level": "warn",
-
- "valid-jsdoc": ["error", {
- "prefer": {
- "return": "returns",
- },
- "preferType": {
- "Boolean": "boolean",
- "Number": "number",
- "String": "string",
- "bool": "boolean",
- },
- "requireParamDescription": false,
- "requireReturn": false,
- "requireReturnDescription": false,
- }],
-
- // Braces only needed for multi-line arrow function blocks
- // "arrow-body-style": ["error", "as-needed"],
-
- // Require spacing around =>
- "arrow-spacing": "error",
-
- // Always require spacing around a single line block
- "block-spacing": "warn",
-
- // Forbid spaces inside the square brackets of array literals.
- "array-bracket-spacing": ["error", "never"],
-
- // Forbid spaces inside the curly brackets of object literals.
- "object-curly-spacing": ["error", "never"],
-
- // No space padding in parentheses
- "space-in-parens": ["error", "never"],
-
- // Enforce one true brace style (opening brace on the same line) and avoid
- // start and end braces on the same line.
- "brace-style": ["error", "1tbs", {"allowSingleLine": true}],
-
- // No space before always a space after a comma
- "comma-spacing": ["error", {"before": false, "after": true}],
-
- // Commas at the end of the line not the start
- "comma-style": "error",
-
- // Don't require spaces around computed properties
- "computed-property-spacing": ["warn", "never"],
-
- // Functions are not required to consistently return something or nothing
- "consistent-return": "off",
-
- // Require braces around blocks that start a new line
- "curly": ["error", "all"],
-
- // Always require a trailing EOL
- "eol-last": "error",
-
- // Require function* name()
- "generator-star-spacing": ["error", {"before": false, "after": true}],
-
- // Two space indent
- "indent": ["error", 2, {"SwitchCase": 1}],
-
- // Space after colon not before in property declarations
- "key-spacing": ["error", {"beforeColon": false, "afterColon": true, "mode": "minimum"}],
-
- // Require spaces before and after finally, catch, etc.
- "keyword-spacing": "error",
-
- // Unix linebreaks
- "linebreak-style": ["error", "unix"],
-
- // Always require parenthesis for new calls
- "new-parens": "error",
-
- // Use [] instead of Array()
- "no-array-constructor": "error",
-
- // No duplicate arguments in function declarations
- "no-dupe-args": "error",
-
- // No duplicate keys in object declarations
- "no-dupe-keys": "error",
-
- // No duplicate cases in switch statements
- "no-duplicate-case": "error",
-
- // If an if block ends with a return no need for an else block
- // "no-else-return": "error",
-
- // Disallow empty statements. This will report an error for:
- // try { something(); } catch (e) {}
- // but will not report it for:
- // try { something(); } catch (e) { /* Silencing the error because ...*/ }
- // which is a valid use case.
- "no-empty": "error",
-
- // No empty character classes in regex
- "no-empty-character-class": "error",
-
- // Disallow empty destructuring
- "no-empty-pattern": "error",
-
- // No assiging to exception variable
- "no-ex-assign": "error",
-
- // No using !! where casting to boolean is already happening
- "no-extra-boolean-cast": "warn",
-
- // No double semicolon
- "no-extra-semi": "error",
-
- // No overwriting defined functions
- "no-func-assign": "error",
-
- // No invalid regular expresions
- "no-invalid-regexp": "error",
-
- // No odd whitespace characters
- "no-irregular-whitespace": "error",
-
- // No single if block inside an else block
- "no-lonely-if": "warn",
-
- // No mixing spaces and tabs in indent
- "no-mixed-spaces-and-tabs": ["error", "smart-tabs"],
-
- // Disallow use of multiple spaces (sometimes used to align const values,
- // array or object items, etc.). It's hard to maintain and doesn't add that
- // much benefit.
- "no-multi-spaces": "warn",
-
- // No reassigning native JS objects
- "no-native-reassign": "error",
-
- // No (!foo in bar)
- "no-negated-in-lhs": "error",
-
- // Nested ternary statements are confusing
- "no-nested-ternary": "error",
-
- // Use {} instead of new Object()
- "no-new-object": "error",
-
- // No Math() or JSON()
- "no-obj-calls": "error",
-
- // No octal literals
- "no-octal": "error",
-
- // No redeclaring variables
- "no-redeclare": "error",
-
- // No unnecessary comparisons
- "no-self-compare": "error",
-
- // No spaces between function name and parentheses
- "no-spaced-func": "warn",
-
- // No trailing whitespace
- "no-trailing-spaces": "error",
-
- // Error on newline where a semicolon is needed
- "no-unexpected-multiline": "error",
-
- // No unreachable statements
- "no-unreachable": "error",
-
- // No expressions where a statement is expected
- "no-unused-expressions": "error",
-
- // No declaring variables that are never used
- "no-unused-vars": ["error", {"args": "none", "varsIgnorePattern": "^(Cc|Ci|Cr|Cu|EXPORTED_SYMBOLS)$"}],
-
- // No using variables before defined
- "no-use-before-define": "error",
-
- // No using with
- "no-with": "error",
-
- // Always require semicolon at end of statement
- "semi": ["error", "always"],
-
- // Require space before blocks
- "space-before-blocks": "error",
-
- // Never use spaces before function parentheses
- "space-before-function-paren": ["error", {"anonymous": "never", "named": "never"}],
-
- // Require spaces around operators, except for a|"off".
- "space-infix-ops": ["error", {"int32Hint": true}],
-
- // ++ and -- should not need spacing
- "space-unary-ops": ["warn", {"nonwords": false}],
-
- // No comparisons to NaN
- "use-isnan": "error",
-
- // Only check typeof against valid results
- "valid-typeof": "error",
-
- // Disallow using variables outside the blocks they are defined (especially
- // since only let and const are used, see "no-var").
- "block-scoped-var": "error",
-
- // Allow trailing commas for easy list extension. Having them does not
- // impair readability, but also not required either.
- "comma-dangle": ["error", "always-multiline"],
-
- // Warn about cyclomatic complexity in functions.
- "complexity": "warn",
-
- // Don't warn for inconsistent naming when capturing this (not so important
- // with auto-binding fat arrow functions).
- // "consistent-this": ["error", "self"],
-
- // Don't require a default case in switch statements. Avoid being forced to
- // add a bogus default when you know all possible cases are handled.
- "default-case": "off",
-
- // Enforce dots on the next line with property name.
- "dot-location": ["error", "property"],
-
- // Encourage the use of dot notation whenever possible.
- "dot-notation": "error",
-
- // Allow using == instead of ===, in the interest of landing something since
- // the devtools codebase is split on convention here.
- "eqeqeq": "off",
-
- // Don't require function expressions to have a name.
- // This makes the code more verbose and hard to read. Our engine already
- // does a fantastic job assigning a name to the function, which includes
- // the enclosing function name, and worst case you have a line number that
- // you can just look up.
- "func-names": "off",
-
- // Allow use of function declarations and expressions.
- "func-style": "off",
-
- // Don't enforce the maximum depth that blocks can be nested. The complexity
- // rule is a better rule to check this.
- "max-depth": "off",
-
- // Maximum length of a line.
- // Disabled because we exceed this in too many places.
- "max-len": ["off", 80],
-
- // Maximum depth callbacks can be nested.
- "max-nested-callbacks": ["error", 4],
-
- // Don't limit the number of parameters that can be used in a function.
- "max-params": "off",
-
- // Don't limit the maximum number of statement allowed in a function. We
- // already have the complexity rule that's a better measurement.
- "max-statements": "off",
-
- // Don't require a capital letter for constructors, only check if all new
- // operators are followed by a capital letter. Don't warn when capitalized
- // functions are used without the new operator.
- "new-cap": ["off", {"capIsNew": false}],
-
- // Allow use of bitwise operators.
- "no-bitwise": "off",
-
- // Disallow use of arguments.caller or arguments.callee.
- "no-caller": "error",
-
- // Disallow the catch clause parameter name being the same as a variable in
- // the outer scope, to avoid confusion.
- "no-catch-shadow": "off",
-
- // Disallow assignment in conditional expressions.
- "no-cond-assign": "error",
-
- // Disallow using the console API.
- "no-console": "error",
-
- // Allow using constant expressions in conditions like while (true)
- "no-constant-condition": "off",
-
- // Allow use of the continue statement.
- "no-continue": "off",
-
- // Disallow control characters in regular expressions.
- "no-control-regex": "error",
-
- // Disallow use of debugger.
- "no-debugger": "error",
-
- // Disallow deletion of variables (deleting properties is fine).
- "no-delete-var": "error",
-
- // Allow division operators explicitly at beginning of regular expression.
- "no-div-regex": "off",
-
- // Disallow use of eval(). We have other APIs to evaluate code in content.
- "no-eval": "error",
-
- // Disallow adding to native types
- "no-extend-native": "error",
-
- // Disallow unnecessary function binding.
- "no-extra-bind": "error",
-
- // Allow unnecessary parentheses, as they may make the code more readable.
- "no-extra-parens": "off",
-
- // Disallow fallthrough of case statements, except if there is a comment.
- "no-fallthrough": "error",
-
- // Allow the use of leading or trailing decimal points in numeric literals.
- "no-floating-decimal": "off",
-
- // Allow comments inline after code.
- "no-inline-comments": "off",
-
- // Disallow use of labels for anything other then loops and switches.
- "no-labels": ["error", {"allowLoop": true}],
-
- // Disallow use of multiline strings (use template strings instead).
- "no-multi-str": "warn",
-
- // Disallow multiple empty lines.
- "no-multiple-empty-lines": ["warn", {"max": 2}],
-
- // Allow reassignment of function parameters.
- "no-param-reassign": "off",
-
- // Allow string concatenation with __dirname and __filename (not a node env).
- "no-path-concat": "off",
-
- // Allow use of unary operators, ++ and --.
- "no-plusplus": "off",
-
- // Allow using process.env (not a node environment).
- "no-process-env": "off",
-
- // Allow using process.exit (not a node environment).
- "no-process-exit": "off",
-
- // Disallow usage of __proto__ property.
- "no-proto": "error",
-
- // Disallow multiple spaces in a regular expression literal.
- "no-regex-spaces": "error",
-
- // Allow reserved words being used as object literal keys.
- "no-reserved-keys": "off",
-
- // Don't restrict usage of specified node modules (not a node environment).
- "no-restricted-modules": "off",
-
- // Disallow use of assignment in return statement. It is preferable for a
- // single line of code to have only one easily predictable effect.
- "no-return-assign": "error",
-
- // Don't warn about declaration of variables already declared in the outer scope.
- "no-shadow": "off",
-
- // Disallow shadowing of names such as arguments.
- "no-shadow-restricted-names": "error",
-
- // Allow use of synchronous methods (not a node environment).
- "no-sync": "off",
-
- // Allow the use of ternary operators.
- "no-ternary": "off",
-
- // Disallow throwing literals (eg. throw "error" instead of
- // throw new Error("error")).
- "no-throw-literal": "error",
-
- // Disallow use of undeclared variables unless mentioned in a /* global */
- // block. Note that globals from head.js are automatically imported in tests
- // by the import-headjs-globals rule form the mozilla eslint plugin.
- "no-undef": "error",
-
- // Allow dangling underscores in identifiers (for privates).
- "no-underscore-dangle": "off",
-
- // Allow use of undefined variable.
- "no-undefined": "off",
-
- // Disallow the use of Boolean literals in conditional expressions.
- "no-unneeded-ternary": "error",
-
- // We use var-only-at-top-level instead of no-var as we allow top level
- // vars.
- "no-var": "off",
-
- // Allow using TODO/FIXME comments.
- "no-warning-comments": "off",
-
- // Don't require method and property shorthand syntax for object literals.
- // We use this in the code a lot, but not consistently, and this seems more
- // like something to check at code review time.
- "object-shorthand": "off",
-
- // Allow more than one variable declaration per function.
- "one-var": "off",
-
- // Disallow padding within blocks.
- "padded-blocks": ["warn", "never"],
-
- // Don't require quotes around object literal property names.
- "quote-props": "off",
-
- // Double quotes should be used.
- "quotes": ["warn", "double", {"avoidEscape": true, "allowTemplateLiterals": true}],
-
- // Require use of the second argument for parseInt().
- "radix": "error",
-
- // Enforce spacing after semicolons.
- "semi-spacing": ["error", {"before": false, "after": true}],
-
- // Don't require to sort variables within the same declaration block.
- // Anyway, one-var is disabled.
- "sort-vars": "off",
-
- // Require a space immediately following the // in a line comment.
- "spaced-comment": ["error", "always"],
-
- // Require "use strict" to be defined globally in the script.
- "strict": ["error", "global"],
-
- // Allow vars to be declared anywhere in the scope.
- "vars-on-top": "off",
-
- // Don't require immediate function invocation to be wrapped in parentheses.
- "wrap-iife": "off",
-
- // Don't require regex literals to be wrapped in parentheses (which
- // supposedly prevent them from being mistaken for division operators).
- "wrap-regex": "off",
-
- // Disallow Yoda conditions (where literal value comes first).
- "yoda": "error",
-
- // disallow use of eval()-like methods
- "no-implied-eval": "error",
-
- // Disallow function or variable declarations in nested blocks
- "no-inner-declarations": "error",
-
- // Disallow usage of __iterator__ property
- "no-iterator": "error",
-
- // Disallow labels that share a name with a variable
- "no-label-var": "error",
-
- // Disallow creating new instances of String, Number, and Boolean
- "no-new-wrappers": "error",
- },
-};
diff --git a/browser/extensions/formautofill/bootstrap.js b/browser/extensions/formautofill/bootstrap.js
deleted file mode 100644
index 0b3f355bd4..0000000000
--- a/browser/extensions/formautofill/bootstrap.js
+++ /dev/null
@@ -1,12 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-
-/* exported startup, shutdown, install, uninstall */
-
-function startup() {}
-function shutdown() {}
-function install() {}
-function uninstall() {}
diff --git a/browser/extensions/formautofill/content/FormAutofillContent.jsm b/browser/extensions/formautofill/content/FormAutofillContent.jsm
deleted file mode 100644
index bde3975808..0000000000
--- a/browser/extensions/formautofill/content/FormAutofillContent.jsm
+++ /dev/null
@@ -1,134 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/*
- * Implements a service used by DOM content to request Form Autofill.
- */
-
-"use strict";
-
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-/**
- * Handles profile autofill for a DOM Form element.
- * @param {HTMLFormElement} form Form that need to be auto filled
- */
-function FormAutofillHandler(form) {
- this.form = form;
- this.fieldDetails = [];
-}
-
-FormAutofillHandler.prototype = {
- /**
- * DOM Form element to which this object is attached.
- */
- form: null,
-
- /**
- * Array of collected data about relevant form fields. Each item is an object
- * storing the identifying details of the field and a reference to the
- * originally associated element from the form.
- *
- * The "section", "addressType", "contactType", and "fieldName" values are
- * used to identify the exact field when the serializable data is received
- * from the backend. There cannot be multiple fields which have
- * the same exact combination of these values.
- *
- * A direct reference to the associated element cannot be sent to the user
- * interface because processing may be done in the parent process.
- */
- fieldDetails: null,
-
- /**
- * Returns information from the form about fields that can be autofilled, and
- * populates the fieldDetails array on this object accordingly.
- *
- * @returns {Array<Object>} Serializable data structure that can be sent to the user
- * interface, or null if the operation failed because the constraints
- * on the allowed fields were not honored.
- */
- collectFormFields() {
- let autofillData = [];
-
- for (let element of this.form.elements) {
- // Query the interface and exclude elements that cannot be autocompleted.
- if (!(element instanceof Ci.nsIDOMHTMLInputElement)) {
- continue;
- }
-
- // Exclude elements to which no autocomplete field has been assigned.
- let info = element.getAutocompleteInfo();
- if (!info.fieldName || ["on", "off"].includes(info.fieldName)) {
- continue;
- }
-
- // Store the association between the field metadata and the element.
- if (this.fieldDetails.some(f => f.section == info.section &&
- f.addressType == info.addressType &&
- f.contactType == info.contactType &&
- f.fieldName == info.fieldName)) {
- // A field with the same identifier already exists.
- return null;
- }
-
- let inputFormat = {
- section: info.section,
- addressType: info.addressType,
- contactType: info.contactType,
- fieldName: info.fieldName,
- };
- // Clone the inputFormat for caching the fields and elements together
- let formatWithElement = Object.assign({}, inputFormat);
-
- inputFormat.index = autofillData.length;
- autofillData.push(inputFormat);
-
- formatWithElement.element = element;
- this.fieldDetails.push(formatWithElement);
- }
-
- return autofillData;
- },
-
- /**
- * Processes form fields that can be autofilled, and populates them with the
- * data provided by backend.
- *
- * @param {Array<Object>} autofillResult
- * Data returned by the user interface.
- * [{
- * section: Value originally provided to the user interface.
- * addressType: Value originally provided to the user interface.
- * contactType: Value originally provided to the user interface.
- * fieldName: Value originally provided to the user interface.
- * value: String with which the field should be updated.
- * index: Index to match the input in fieldDetails
- * }],
- * }
- */
- autofillFormFields(autofillResult) {
- for (let field of autofillResult) {
- // Get the field details, if it was processed by the user interface.
- let fieldDetail = this.fieldDetails[field.index];
-
- // Avoid the invalid value set
- if (!fieldDetail || !field.value) {
- continue;
- }
-
- let info = fieldDetail.element.getAutocompleteInfo();
- if (field.section != info.section ||
- field.addressType != info.addressType ||
- field.contactType != info.contactType ||
- field.fieldName != info.fieldName) {
- Cu.reportError("Autocomplete tokens mismatched");
- continue;
- }
-
- fieldDetail.element.setUserInput(field.value);
- }
- },
-};
-
-this.EXPORTED_SYMBOLS = ["FormAutofillHandler"];
diff --git a/browser/extensions/formautofill/content/FormAutofillParent.jsm b/browser/extensions/formautofill/content/FormAutofillParent.jsm
deleted file mode 100644
index bdfe0f478b..0000000000
--- a/browser/extensions/formautofill/content/FormAutofillParent.jsm
+++ /dev/null
@@ -1,173 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/*
- * Implements a service used to access storage and communicate with content.
- *
- * A "fields" array is used to communicate with FormAutofillContent. Each item
- * represents a single input field in the content page as well as its
- * @autocomplete properties. The schema is as below. Please refer to
- * FormAutofillContent.jsm for more details.
- *
- * [
- * {
- * section,
- * addressType,
- * contactType,
- * fieldName,
- * value,
- * index
- * },
- * {
- * // ...
- * }
- * ]
- */
-
-/* exported FormAutofillParent */
-
-"use strict";
-
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "OS",
- "resource://gre/modules/osfile.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "ProfileStorage",
- "resource://formautofill/ProfileStorage.jsm");
-
-const PROFILE_JSON_FILE_NAME = "autofill-profiles.json";
-
-let FormAutofillParent = {
- _profileStore: null,
-
- /**
- * Initializes ProfileStorage and registers the message handler.
- */
- init: function() {
- let storePath =
- OS.Path.join(OS.Constants.Path.profileDir, PROFILE_JSON_FILE_NAME);
-
- this._profileStore = new ProfileStorage(storePath);
- this._profileStore.initialize();
-
- let mm = Cc["@mozilla.org/globalmessagemanager;1"]
- .getService(Ci.nsIMessageListenerManager);
- mm.addMessageListener("FormAutofill:PopulateFieldValues", this);
- },
-
- /**
- * Handles the message coming from FormAutofillContent.
- *
- * @param {string} message.name The name of the message.
- * @param {object} message.data The data of the message.
- * @param {nsIFrameMessageManager} message.target Caller's message manager.
- */
- receiveMessage: function({name, data, target}) {
- switch (name) {
- case "FormAutofill:PopulateFieldValues":
- this._populateFieldValues(data, target);
- break;
- }
- },
-
- /**
- * Returns the instance of ProfileStorage. To avoid syncing issues, anyone
- * who needs to access the profile should request the instance by this instead
- * of creating a new one.
- *
- * @returns {ProfileStorage}
- */
- getProfileStore: function() {
- return this._profileStore;
- },
-
- /**
- * Uninitializes FormAutofillParent. This is for testing only.
- *
- * @private
- */
- _uninit: function() {
- if (this._profileStore) {
- this._profileStore._saveImmediately();
- this._profileStore = null;
- }
-
- let mm = Cc["@mozilla.org/globalmessagemanager;1"]
- .getService(Ci.nsIMessageListenerManager);
- mm.removeMessageListener("FormAutofill:PopulateFieldValues", this);
- },
-
- /**
- * Populates the field values and notifies content to fill in. Exception will
- * be thrown if there's no matching profile.
- *
- * @private
- * @param {string} data.guid
- * Indicates which profile to populate
- * @param {Fields} data.fields
- * The "fields" array collected from content.
- * @param {nsIFrameMessageManager} target
- * Content's message manager.
- */
- _populateFieldValues({guid, fields}, target) {
- this._profileStore.notifyUsed(guid);
- this._fillInFields(this._profileStore.get(guid), fields);
- target.sendAsyncMessage("FormAutofill:fillForm", {fields});
- },
-
- /**
- * Transforms a word with hyphen into camel case.
- * (e.g. transforms "address-type" into "addressType".)
- *
- * @private
- * @param {string} str The original string with hyphen.
- * @returns {string} The camel-cased output string.
- */
- _camelCase(str) {
- return str.toLowerCase().replace(/-([a-z])/g, s => s[1].toUpperCase());
- },
-
- /**
- * Get the corresponding value from the specified profile according to a valid
- * @autocomplete field name.
- *
- * Note that the field name doesn't need to match the property name defined in
- * Profile object. This method can transform the raw data to fulfill it. (e.g.
- * inputting "country-name" as "fieldName" will get a full name transformed
- * from the country code that is recorded in "country" field.)
- *
- * @private
- * @param {Profile} profile The specified profile.
- * @param {string} fieldName A valid @autocomplete field name.
- * @returns {string} The corresponding value. Returns "undefined" if there's
- * no matching field.
- */
- _getDataByFieldName(profile, fieldName) {
- let key = this._camelCase(fieldName);
-
- // TODO: Transform the raw profile data to fulfill "fieldName" here.
-
- return profile[key];
- },
-
- /**
- * Fills in the "fields" array by the specified profile.
- *
- * @private
- * @param {Profile} profile The specified profile to fill in.
- * @param {Fields} fields The "fields" array collected from content.
- */
- _fillInFields(profile, fields) {
- for (let field of fields) {
- let value = this._getDataByFieldName(profile, field.fieldName);
- if (value !== undefined) {
- field.value = value;
- }
- }
- },
-};
-
-this.EXPORTED_SYMBOLS = ["FormAutofillParent"];
diff --git a/browser/extensions/formautofill/content/ProfileStorage.jsm b/browser/extensions/formautofill/content/ProfileStorage.jsm
deleted file mode 100644
index 843177d4eb..0000000000
--- a/browser/extensions/formautofill/content/ProfileStorage.jsm
+++ /dev/null
@@ -1,251 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/*
- * Implements an interface of the storage of Form Autofill.
- *
- * The data is stored in JSON format, without indentation, using UTF-8 encoding.
- * With indentation applied, the file would look like this:
- *
- * {
- * version: 1,
- * profiles: [
- * {
- * guid, // 12 character...
- *
- * // profile
- * organization, // Company
- * streetAddress, // (Multiline)
- * addressLevel2, // City/Town
- * addressLevel1, // Province (Standardized code if possible)
- * postalCode,
- * country, // ISO 3166
- * tel,
- * email,
- *
- * // metadata
- * timeCreated, // in ms
- * timeLastUsed, // in ms
- * timeLastModified, // in ms
- * timesUsed
- * },
- * {
- * // ...
- * }
- * ]
- * }
- */
-
-"use strict";
-
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/Task.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "JSONFile",
- "resource://gre/modules/JSONFile.jsm");
-
-XPCOMUtils.defineLazyServiceGetter(this, "gUUIDGenerator",
- "@mozilla.org/uuid-generator;1",
- "nsIUUIDGenerator");
-
-const SCHEMA_VERSION = 1;
-
-// Name-related fields will be handled in follow-up bugs due to the complexity.
-const VALID_FIELDS = [
- "organization",
- "streetAddress",
- "addressLevel2",
- "addressLevel1",
- "postalCode",
- "country",
- "tel",
- "email",
-];
-
-function ProfileStorage(path) {
- this._path = path;
-}
-
-ProfileStorage.prototype = {
- /**
- * Loads the profile data from file to memory.
- *
- * @returns {Promise}
- * @resolves When the operation finished successfully.
- * @rejects JavaScript exception.
- */
- initialize() {
- this._store = new JSONFile({
- path: this._path,
- dataPostProcessor: this._dataPostProcessor.bind(this),
- });
- return this._store.load();
- },
-
- /**
- * Adds a new profile.
- *
- * @param {Profile} profile
- * The new profile for saving.
- */
- add(profile) {
- this._store.ensureDataReady();
-
- let profileToSave = this._normalizeProfile(profile);
-
- profileToSave.guid = gUUIDGenerator.generateUUID().toString()
- .replace(/[{}-]/g, "").substring(0, 12);
-
- // Metadata
- let now = Date.now();
- profileToSave.timeCreated = now;
- profileToSave.timeLastModified = now;
- profileToSave.timeLastUsed = 0;
- profileToSave.timesUsed = 0;
-
- this._store.data.profiles.push(profileToSave);
-
- this._store.saveSoon();
- },
-
- /**
- * Update the specified profile.
- *
- * @param {string} guid
- * Indicates which profile to update.
- * @param {Profile} profile
- * The new profile used to overwrite the old one.
- */
- update(guid, profile) {
- this._store.ensureDataReady();
-
- let profileFound = this._findByGUID(guid);
- if (!profileFound) {
- throw new Error("No matching profile.");
- }
-
- let profileToUpdate = this._normalizeProfile(profile);
- for (let field of VALID_FIELDS) {
- if (profileToUpdate[field] !== undefined) {
- profileFound[field] = profileToUpdate[field];
- } else {
- delete profileFound[field];
- }
- }
-
- profileFound.timeLastModified = Date.now();
-
- this._store.saveSoon();
- },
-
- /**
- * Notifies the stroage of the use of the specified profile, so we can update
- * the metadata accordingly.
- *
- * @param {string} guid
- * Indicates which profile to be notified.
- */
- notifyUsed(guid) {
- this._store.ensureDataReady();
-
- let profileFound = this._findByGUID(guid);
- if (!profileFound) {
- throw new Error("No matching profile.");
- }
-
- profileFound.timesUsed++;
- profileFound.timeLastUsed = Date.now();
-
- this._store.saveSoon();
- },
-
- /**
- * Removes the specified profile. No error occurs if the profile isn't found.
- *
- * @param {string} guid
- * Indicates which profile to remove.
- */
- remove(guid) {
- this._store.ensureDataReady();
-
- this._store.data.profiles =
- this._store.data.profiles.filter(profile => profile.guid != guid);
- this._store.saveSoon();
- },
-
- /**
- * Returns the profile with the specified GUID.
- *
- * @param {string} guid
- * Indicates which profile to retrieve.
- * @returns {Profile}
- * A clone of the profile.
- */
- get(guid) {
- this._store.ensureDataReady();
-
- let profileFound = this._findByGUID(guid);
- if (!profileFound) {
- throw new Error("No matching profile.");
- }
-
- // Profile is cloned to avoid accidental modifications from outside.
- return this._clone(profileFound);
- },
-
- /**
- * Returns all profiles.
- *
- * @returns {Array.<Profile>}
- * An array containing clones of all profiles.
- */
- getAll() {
- this._store.ensureDataReady();
-
- // Profiles are cloned to avoid accidental modifications from outside.
- return this._store.data.profiles.map(this._clone);
- },
-
- _clone(profile) {
- return Object.assign({}, profile);
- },
-
- _findByGUID(guid) {
- return this._store.data.profiles.find(profile => profile.guid == guid);
- },
-
- _normalizeProfile(profile) {
- let result = {};
- for (let key in profile) {
- if (!VALID_FIELDS.includes(key)) {
- throw new Error(`"${key}" is not a valid field.`);
- }
- if (typeof profile[key] !== "string" &&
- typeof profile[key] !== "number") {
- throw new Error(`"${key}" contains invalid data type.`);
- }
-
- result[key] = profile[key];
- }
- return result;
- },
-
- _dataPostProcessor(data) {
- data.version = SCHEMA_VERSION;
- if (!data.profiles) {
- data.profiles = [];
- }
- return data;
- },
-
- // For test only.
- _saveImmediately() {
- return this._store._save();
- },
-};
-
-this.EXPORTED_SYMBOLS = ["ProfileStorage"];
diff --git a/browser/extensions/formautofill/install.rdf.in b/browser/extensions/formautofill/install.rdf.in
deleted file mode 100644
index 5e34051ba0..0000000000
--- a/browser/extensions/formautofill/install.rdf.in
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
- - License, v. 2.0. If a copy of the MPL was not distributed with this
- - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-#filter substitution
-
-<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-
- <Description about="urn:mozilla:install-manifest">
- <em:id>formautofill@mozilla.org</em:id>
- <em:version>1.0</em:version>
- <em:type>2</em:type>
- <em:bootstrap>true</em:bootstrap>
- <em:multiprocessCompatible>true</em:multiprocessCompatible>
-
- <!-- Target Application this extension can install into,
- with minimum and maximum supported versions. -->
- <em:targetApplication>
- <Description>
- <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
- <em:minVersion>@MOZ_APP_VERSION@</em:minVersion>
- <em:maxVersion>@MOZ_APP_MAXVERSION@</em:maxVersion>
- </Description>
- </em:targetApplication>
-
- <!-- Front End MetaData -->
- <em:name>Form Autofill</em:name>
- <em:description>Autofill forms with saved profiles</em:description>
- </Description>
-</RDF>
diff --git a/browser/extensions/formautofill/jar.mn b/browser/extensions/formautofill/jar.mn
deleted file mode 100644
index 0cba721ef3..0000000000
--- a/browser/extensions/formautofill/jar.mn
+++ /dev/null
@@ -1,7 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-[features/formautofill@mozilla.org] chrome.jar:
-% resource formautofill %content/
- content/ (content/*)
diff --git a/browser/extensions/formautofill/moz.build b/browser/extensions/formautofill/moz.build
deleted file mode 100644
index abcc659eed..0000000000
--- a/browser/extensions/formautofill/moz.build
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION']
-DEFINES['MOZ_APP_MAXVERSION'] = CONFIG['MOZ_APP_MAXVERSION']
-
-FINAL_TARGET_FILES.features['formautofill@mozilla.org'] += [
- 'bootstrap.js'
-]
-
-FINAL_TARGET_PP_FILES.features['formautofill@mozilla.org'] += [
- 'install.rdf.in'
-]
-
-JAR_MANIFESTS += ['jar.mn']
diff --git a/browser/extensions/moz.build b/browser/extensions/moz.build
index 4f95704e68..69d6af6d66 100644
--- a/browser/extensions/moz.build
+++ b/browser/extensions/moz.build
@@ -5,16 +5,6 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DIRS += [
-# 'aushelper',
-# 'e10srollout',
'pdfjs',
-# 'pocket',
-# 'webcompat',
]
-# Only include the following system add-ons if building Aurora or Nightly
-if 'a' in CONFIG['GRE_MILESTONE']:
- DIRS += [
- 'flyweb',
- 'formautofill',
- ]
diff --git a/browser/extensions/pdfjs/content/PdfStreamConverter.jsm b/browser/extensions/pdfjs/content/PdfStreamConverter.jsm
index 3b9f9de267..5e337bbc5a 100644
--- a/browser/extensions/pdfjs/content/PdfStreamConverter.jsm
+++ b/browser/extensions/pdfjs/content/PdfStreamConverter.jsm
@@ -29,7 +29,8 @@ const MOZ_CENTRAL = JSON.parse('true');
const PDFJS_EVENT_ID = 'pdf.js.message';
const PDF_CONTENT_TYPE = 'application/pdf';
const PREF_PREFIX = 'pdfjs';
-const PDF_VIEWER_WEB_PAGE = 'resource://pdf.js/web/viewer.html';
+const PDF_VIEWER_ORIGIN = "resource://pdf.js";
+const PDF_VIEWER_WEB_PAGE = "resource://pdf.js/web/viewer.html";
const MAX_NUMBER_OF_PREFS = 50;
const MAX_STRING_PREF_LENGTH = 128;
@@ -110,11 +111,15 @@ function log(aMsg) {
dump(msg + '\n');
}
-function getDOMWindow(aChannel) {
+function getDOMWindow(aChannel, aPrincipal) {
var requestor = aChannel.notificationCallbacks ?
aChannel.notificationCallbacks :
aChannel.loadGroup.notificationCallbacks;
var win = requestor.getInterface(Components.interfaces.nsIDOMWindow);
+ // Ensure the window wasn't navigated to something that is not PDF.js.
+ if (!win.document.nodePrincipal.equals(aPrincipal)) {
+ return null;
+ }
return win;
}
@@ -632,7 +637,7 @@ var RangedChromeActions = (function RangedChromeActionsClosure() {
loaded: loaded,
total: total,
chunk: self.dataListener.readData()
- }, '*');
+ }, PDF_VIEWER_ORIGIN);
};
this.dataListener.oncomplete = function () {
self.dataListener = null;
@@ -646,7 +651,7 @@ var RangedChromeActions = (function RangedChromeActionsClosure() {
pdfUrl: this.pdfUrl,
length: this.contentLength,
data: data
- }, '*');
+ }, PDF_VIEWER_ORIGIN);
return true;
};
@@ -668,13 +673,13 @@ var RangedChromeActions = (function RangedChromeActionsClosure() {
pdfjsLoadAction: 'range',
begin: args.begin,
chunk: args.chunk
- }, '*');
+ }, PDF_VIEWER_ORIGIN);
},
onProgress: function RangedChromeActions_onProgress(evt) {
domWindow.postMessage({
pdfjsLoadAction: 'rangeProgress',
loaded: evt.loaded,
- }, '*');
+ }, PDF_VIEWER_ORIGIN);
}
});
};
@@ -723,7 +728,7 @@ var StandardChromeActions = (function StandardChromeActionsClosure() {
pdfjsLoadAction: 'progress',
loaded: loaded,
total: total
- }, '*');
+ }, PDF_VIEWER_ORIGIN);
};
this.dataListener.oncomplete =
@@ -732,7 +737,7 @@ var StandardChromeActions = (function StandardChromeActionsClosure() {
pdfjsLoadAction: 'complete',
data: data,
errorCode: errorCode
- }, '*');
+ }, PDF_VIEWER_ORIGIN);
self.dataListener = null;
self.originalRequest = null;
@@ -977,10 +982,14 @@ PdfStreamConverter.prototype = {
listener.onDataAvailable(aRequest, aContext, inputStream,
offset, count);
},
- onStopRequest: function(request, context, statusCode) {
- // We get the DOM window here instead of before the request since it
- // may have changed during a redirect.
- var domWindow = getDOMWindow(channel);
+ onStopRequest(request, context, statusCode) {
+ var domWindow = getDOMWindow(channel, resourcePrincipal);
+ if (!Components.isSuccessCode(statusCode) || !domWindow) {
+ // The request may have been aborted and the document may have been
+ // replaced with something that is not PDF.js, abort attaching.
+ listener.onStopRequest(aRequest, context, statusCode);
+ return;
+ }
var actions;
if (rangeRequest || streamRequest) {
actions = new RangedChromeActions(
@@ -991,7 +1000,7 @@ PdfStreamConverter.prototype = {
domWindow, contentDispositionFilename, aRequest, dataListener);
}
var requestListener = new RequestListener(actions);
- domWindow.addEventListener(PDFJS_EVENT_ID, function(event) {
+ domWindow.document.addEventListener(PDFJS_EVENT_ID, function(event) {
requestListener.receive(event);
}, false, true);
if (actions.supportsIntegratedFind()) {
diff --git a/browser/extensions/pdfjs/content/build/pdf.worker.js b/browser/extensions/pdfjs/content/build/pdf.worker.js
index 4c35bd401c..6ce519940b 100644
--- a/browser/extensions/pdfjs/content/build/pdf.worker.js
+++ b/browser/extensions/pdfjs/content/build/pdf.worker.js
@@ -41653,6 +41653,22 @@
var isStream = corePrimitives.isStream;
var PostScriptLexer = corePsParser.PostScriptLexer;
var PostScriptParser = corePsParser.PostScriptParser;
+ function toNumberArray(arr) {
+ if (!Array.isArray(arr)) {
+ return null;
+ }
+ var length = arr.length;
+ for (var i = 0; i < length; i++) {
+ if (typeof arr[i] !== 'number') {
+ var result = new Array(length);
+ for (var j = 0; j < length; j++) {
+ result[j] = +arr[j];
+ }
+ return result;
+ }
+ }
+ return arr;
+ }
var PDFFunction = function PDFFunctionClosure() {
var CONSTRUCT_SAMPLED = 0;
var CONSTRUCT_INTERPOLATED = 2;
@@ -41752,8 +41768,8 @@
}
return out;
}
- var domain = dict.getArray('Domain');
- var range = dict.getArray('Range');
+ var domain = toNumberArray(dict.getArray('Domain'));
+ var range = toNumberArray(dict.getArray('Range'));
if (!domain || !range) {
error('No domain or range');
}
@@ -41761,7 +41777,7 @@
var outputSize = range.length / 2;
domain = toMultiArray(domain);
range = toMultiArray(range);
- var size = dict.get('Size');
+ var size = toNumberArray(dict.get('Size'));
var bps = dict.get('BitsPerSample');
var order = dict.get('Order') || 1;
if (order !== 1) {
@@ -41769,16 +41785,16 @@
// As in poppler, ignoring order, linear interpolation may work as good
info('No support for cubic spline interpolation: ' + order);
}
- var encode = dict.getArray('Encode');
+ var encode = toNumberArray(dict.getArray('Encode'));
if (!encode) {
encode = [];
for (var i = 0; i < inputSize; ++i) {
- encode.push(0);
- encode.push(size[i] - 1);
+ encode.push([0, size[i] - 1]);
}
+ } else {
+ encode = toMultiArray(encode);
}
- encode = toMultiArray(encode);
- var decode = dict.getArray('Decode');
+ var decode = toNumberArray(dict.getArray('Decode'));
if (!decode) {
decode = range;
} else {
@@ -41873,12 +41889,9 @@
};
},
constructInterpolated: function PDFFunction_constructInterpolated(str, dict) {
- var c0 = dict.getArray('C0') || [0];
- var c1 = dict.getArray('C1') || [1];
+ var c0 = toNumberArray(dict.getArray('C0')) || [0];
+ var c1 = toNumberArray(dict.getArray('C1')) || [1];
var n = dict.get('N');
- if (!isArray(c0) || !isArray(c1)) {
- error('Illegal dictionary for interpolated function');
- }
var length = c0.length;
var diff = [];
for (var i = 0; i < length; ++i) {
@@ -41904,7 +41917,7 @@
};
},
constructStiched: function PDFFunction_constructStiched(fn, dict, xref) {
- var domain = dict.getArray('Domain');
+ var domain = toNumberArray(dict.getArray('Domain'));
if (!domain) {
error('No domain');
}
@@ -41915,10 +41928,10 @@
var fnRefs = dict.get('Functions');
var fns = [];
for (var i = 0, ii = fnRefs.length; i < ii; ++i) {
- fns.push(PDFFunction.getIR(xref, xref.fetchIfRef(fnRefs[i])));
+ fns.push(PDFFunction.parse(xref, xref.fetchIfRef(fnRefs[i])));
}
- var bounds = dict.getArray('Bounds');
- var encode = dict.getArray('Encode');
+ var bounds = toNumberArray(dict.getArray('Bounds'));
+ var encode = toNumberArray(dict.getArray('Encode'));
return [
CONSTRUCT_STICHED,
domain,
@@ -41931,12 +41944,8 @@
var domain = IR[1];
var bounds = IR[2];
var encode = IR[3];
- var fnsIR = IR[4];
- var fns = [];
+ var fns = IR[4];
var tmpBuf = new Float32Array(1);
- for (var i = 0, ii = fnsIR.length; i < ii; i++) {
- fns.push(PDFFunction.fromIR(fnsIR[i]));
- }
return function constructStichedFromIRResult(src, srcOffset, dest, destOffset) {
var clip = function constructStichedFromIRClip(v, min, max) {
if (v > max) {
@@ -41973,8 +41982,8 @@
};
},
constructPostScript: function PDFFunction_constructPostScript(fn, dict, xref) {
- var domain = dict.getArray('Domain');
- var range = dict.getArray('Range');
+ var domain = toNumberArray(dict.getArray('Domain'));
+ var range = toNumberArray(dict.getArray('Range'));
if (!domain) {
error('No domain.');
}
@@ -42933,8 +42942,8 @@
case 'AlternateCS':
var numComps = IR[1];
var alt = IR[2];
- var tintFnIR = IR[3];
- return new AlternateCS(numComps, ColorSpace.fromIR(alt), PDFFunction.fromIR(tintFnIR));
+ var tintFn = IR[3];
+ return new AlternateCS(numComps, ColorSpace.fromIR(alt), tintFn);
case 'LabCS':
whitePoint = IR[1];
blackPoint = IR[2];
@@ -43072,12 +43081,12 @@
numComps = name.length;
}
alt = ColorSpace.parseToIR(cs[2], xref, res);
- var tintFnIR = PDFFunction.getIR(xref, xref.fetchIfRef(cs[3]));
+ var tintFn = PDFFunction.parse(xref, xref.fetchIfRef(cs[3]));
return [
'AlternateCS',
numComps,
alt,
- tintFnIR
+ tintFn
];
case 'Lab':
params = xref.fetchIfRef(cs[1]);
@@ -52488,4 +52497,4 @@
}));
}.call(pdfjsLibs));
exports.WorkerMessageHandler = pdfjsLibs.pdfjsCoreWorker.WorkerMessageHandler;
-})); \ No newline at end of file
+}));
diff --git a/browser/extensions/pocket/bootstrap.js b/browser/extensions/pocket/bootstrap.js
deleted file mode 100644
index c470eb8d32..0000000000
--- a/browser/extensions/pocket/bootstrap.js
+++ /dev/null
@@ -1,511 +0,0 @@
-/* -*- 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/. */
-
-const {classes: Cc, interfaces: Ci, utils: Cu, manager: Cm} = Components;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://services-common/utils.js");
-Cu.import("resource://gre/modules/Preferences.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "Services",
- "resource://gre/modules/Services.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "RecentWindow",
- "resource:///modules/RecentWindow.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
- "resource:///modules/CustomizableUI.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "AddonManager",
- "resource://gre/modules/AddonManager.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "ReaderMode",
- "resource://gre/modules/ReaderMode.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "Pocket",
- "chrome://pocket/content/Pocket.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "AboutPocket",
- "chrome://pocket/content/AboutPocket.jsm");
-XPCOMUtils.defineLazyGetter(this, "gPocketBundle", function() {
- return Services.strings.createBundle("chrome://pocket/locale/pocket.properties");
-});
-XPCOMUtils.defineLazyGetter(this, "gPocketStyleURI", function() {
- return Services.io.newURI("chrome://pocket/skin/pocket.css", null, null);
-});
-
-// Due to bug 1051238 frame scripts are cached forever, so we can't update them
-// as a restartless add-on. The Math.random() is the work around for this.
-const PROCESS_SCRIPT = "chrome://pocket/content/pocket-content-process.js?" + Math.random();
-
-const PREF_BRANCH = "extensions.pocket.";
-const PREFS = {
- enabled: true, // bug 1229937, figure out ui tour support
- api: "api.getpocket.com",
- site: "getpocket.com",
- oAuthConsumerKey: "40249-e88c401e1b1f2242d9e441c4"
-};
-
-function setDefaultPrefs() {
- let branch = Services.prefs.getDefaultBranch(PREF_BRANCH);
- for (let [key, val] of Object.entries(PREFS)) {
- // If someone beat us to setting a default, don't overwrite it. This can
- // happen if distribution.ini sets the default first.
- if (branch.getPrefType(key) != branch.PREF_INVALID)
- continue;
- switch (typeof val) {
- case "boolean":
- branch.setBoolPref(key, val);
- break;
- case "number":
- branch.setIntPref(key, val);
- break;
- case "string":
- branch.setCharPref(key, val);
- break;
- }
- }
-}
-
-function createElementWithAttrs(document, type, attrs) {
- let element = document.createElement(type);
- Object.keys(attrs).forEach(function (attr) {
- element.setAttribute(attr, attrs[attr]);
- })
- return element;
-}
-
-function CreatePocketWidget(reason) {
- let id = "pocket-button"
- let widget = CustomizableUI.getWidget(id);
- // The widget is only null if we've created then destroyed the widget.
- // Once we've actually called createWidget the provider will be set to
- // PROVIDER_API.
- if (widget && widget.provider == CustomizableUI.PROVIDER_API)
- return;
- // if upgrading from builtin version and the button was placed in ui,
- // seenWidget will not be null
- let seenWidget = CustomizableUI.getPlacementOfWidget("pocket-button", false, true);
- let pocketButton = {
- id: "pocket-button",
- defaultArea: CustomizableUI.AREA_NAVBAR,
- introducedInVersion: "pref",
- type: "view",
- tabSpecific: true,
- viewId: "PanelUI-pocketView",
- label: gPocketBundle.GetStringFromName("pocket-button.label"),
- tooltiptext: gPocketBundle.GetStringFromName("pocket-button.tooltiptext"),
- // Use forwarding functions here to avoid loading Pocket.jsm on startup:
- onViewShowing: function() {
- return Pocket.onPanelViewShowing.apply(this, arguments);
- },
- onViewHiding: function() {
- return Pocket.onPanelViewHiding.apply(this, arguments);
- },
- onBeforeCreated: function(doc) {
- // Bug 1223127,CUI should make this easier to do.
- if (doc.getElementById("PanelUI-pocketView"))
- return;
- let view = doc.createElement("panelview");
- view.id = "PanelUI-pocketView";
- let panel = doc.createElement("vbox");
- panel.setAttribute("class", "panel-subview-body");
- view.appendChild(panel);
- doc.getElementById("PanelUI-multiView").appendChild(view);
- }
- };
-
- CustomizableUI.createWidget(pocketButton);
- CustomizableUI.addListener(pocketButton);
- // placed is null if location is palette
- let placed = CustomizableUI.getPlacementOfWidget("pocket-button");
-
- // a first time install will always have placed the button somewhere, and will
- // not have a placement prior to creating the widget. Thus, !seenWidget &&
- // placed.
- if (reason == ADDON_ENABLE && !seenWidget && placed) {
- // initially place the button after the bookmarks button if it is in the UI
- let widgets = CustomizableUI.getWidgetIdsInArea(CustomizableUI.AREA_NAVBAR);
- let bmbtn = widgets.indexOf("bookmarks-menu-button");
- if (bmbtn > -1) {
- CustomizableUI.moveWidgetWithinArea("pocket-button", bmbtn + 1);
- }
- }
-
- // Uninstall the Pocket social provider if it exists, but only if we haven't
- // already uninstalled it in this manner. That way the user can reinstall
- // it if they prefer it without its being uninstalled every time they start
- // the browser.
- let SocialService;
- try {
- // For Firefox 51+
- SocialService = Cu.import("resource:///modules/SocialService.jsm", {}).SocialService;
- } catch (e) {
- SocialService = Cu.import("resource://gre/modules/SocialService.jsm", {}).SocialService;
- }
-
- let origin = "https://getpocket.com";
- SocialService.getProvider(origin, provider => {
- if (provider) {
- let pref = "social.backup.getpocket-com";
- if (!Services.prefs.prefHasUserValue(pref)) {
- let str = Cc["@mozilla.org/supports-string;1"].
- createInstance(Ci.nsISupportsString);
- str.data = JSON.stringify(provider.manifest);
- Services.prefs.setComplexValue(pref, Ci.nsISupportsString, str);
- SocialService.uninstallProvider(origin, () => {});
- }
- }
- });
-
-}
-
-// PocketContextMenu
-// When the context menu is opened check if we need to build and enable pocket UI.
-var PocketContextMenu = {
- init: function() {
- Services.obs.addObserver(this, "on-build-contextmenu", false);
- },
- shutdown: function() {
- Services.obs.removeObserver(this, "on-build-contextmenu");
- // loop through windows and remove context menus
- // iterate through all windows and add pocket to them
- for (let win of CustomizableUI.windows) {
- let document = win.document;
- for (let id of ["context-pocket", "context-savelinktopocket"]) {
- let element = document.getElementById(id);
- if (element)
- element.remove();
- }
- }
- },
- observe: function(aSubject, aTopic, aData) {
- let subject = aSubject.wrappedJSObject;
- let document = subject.menu.ownerDocument;
- let pocketEnabled = CustomizableUI.getPlacementOfWidget("pocket-button");
-
- let showSaveCurrentPageToPocket = !(subject.onTextInput || subject.onLink ||
- subject.isContentSelected || subject.onImage ||
- subject.onCanvas || subject.onVideo || subject.onAudio);
- let targetUrl = subject.onLink ? subject.linkUrl : subject.pageUrl;
- let targetURI = Services.io.newURI(targetUrl, null, null);
- let canPocket = pocketEnabled && (targetURI.schemeIs("http") || targetURI.schemeIs("https") ||
- (targetURI.schemeIs("about") && ReaderMode.getOriginalUrl(targetUrl)));
-
- let showSaveLinkToPocket = canPocket && !showSaveCurrentPageToPocket && subject.onLink;
-
- // create menu entries if necessary
- let menu = document.getElementById("context-pocket");
- if (!menu) {
- menu = createElementWithAttrs(document, "menuitem", {
- "id": "context-pocket",
- "label": gPocketBundle.GetStringFromName("saveToPocketCmd.label"),
- "accesskey": gPocketBundle.GetStringFromName("saveToPocketCmd.accesskey"),
- "oncommand": "Pocket.savePage(gContextMenu.browser, gContextMenu.browser.currentURI.spec, gContextMenu.browser.contentTitle);"
- });
- let sibling = document.getElementById("context-savepage");
- if (sibling.nextSibling) {
- sibling.parentNode.insertBefore(menu, sibling.nextSibling);
- } else {
- sibling.parentNode.appendChild(menu);
- }
- }
- menu.hidden = !(canPocket && showSaveCurrentPageToPocket);
-
- menu = document.getElementById("context-savelinktopocket");
- if (!menu) {
- menu = createElementWithAttrs(document, "menuitem", {
- "id": "context-savelinktopocket",
- "label": gPocketBundle.GetStringFromName("saveLinkToPocketCmd.label"),
- "accesskey": gPocketBundle.GetStringFromName("saveLinkToPocketCmd.accesskey"),
- "oncommand": "Pocket.savePage(gContextMenu.browser, gContextMenu.linkURL);"
- });
- let sibling = document.getElementById("context-savelink");
- if (sibling.nextSibling) {
- sibling.parentNode.insertBefore(menu, sibling.nextSibling);
- } else {
- sibling.parentNode.appendChild(menu);
- }
- }
- menu.hidden = !showSaveLinkToPocket;
- }
-}
-
-// PocketReader
-// Listen for reader mode setup and add our button to the reader toolbar
-var PocketReader = {
- _hidden: true,
- get hidden() {
- return this._hidden;
- },
- set hidden(hide) {
- hide = !!hide;
- if (hide === this._hidden)
- return;
- this._hidden = hide;
- this.update();
- },
- startup: function() {
- // Setup the listeners, update will be called when the widget is added,
- // no need to do that now.
- let mm = Services.mm;
- mm.addMessageListener("Reader:OnSetup", this);
- mm.addMessageListener("Reader:Clicked-pocket-button", this);
- },
- shutdown: function() {
- let mm = Services.mm;
- mm.removeMessageListener("Reader:OnSetup", this);
- mm.removeMessageListener("Reader:Clicked-pocket-button", this);
- this.hidden = true;
- },
- update: function() {
- if (this.hidden) {
- Services.mm.broadcastAsyncMessage("Reader:RemoveButton", { id: "pocket-button" });
- } else {
- Services.mm.broadcastAsyncMessage("Reader:AddButton",
- { id: "pocket-button",
- title: gPocketBundle.GetStringFromName("pocket-button.tooltiptext"),
- image: "chrome://pocket/content/panels/img/pocket.svg#pocket-mark" });
- }
- },
- receiveMessage: function(message) {
- switch (message.name) {
- case "Reader:OnSetup": {
- // Tell the reader about our button.
- if (this.hidden)
- break;
- message.target.messageManager.
- sendAsyncMessage("Reader:AddButton", { id: "pocket-button",
- title: gPocketBundle.GetStringFromName("pocket-button.tooltiptext"),
- image: "chrome://pocket/content/panels/img/pocket.svg#pocket-mark"});
- break;
- }
- case "Reader:Clicked-pocket-button": {
- let doc = message.target.ownerDocument;
- let pocketWidget = doc.getElementById("pocket-button");
- let placement = CustomizableUI.getPlacementOfWidget("pocket-button");
- if (placement) {
- if (placement.area == CustomizableUI.AREA_PANEL) {
- doc.defaultView.PanelUI.show().then(function() {
- // The DOM node might not exist yet if the panel wasn't opened before.
- pocketWidget = doc.getElementById("pocket-button");
- pocketWidget.doCommand();
- });
- } else {
- pocketWidget.doCommand();
- }
- }
- break;
- }
- }
- }
-}
-
-
-function pktUIGetter(prop, window) {
- return {
- get: function() {
- // delete any getters for properties loaded from main.js so we only load main.js once
- delete window.pktUI;
- delete window.pktApi;
- delete window.pktUIMessaging;
- Services.scriptloader.loadSubScript("chrome://pocket/content/main.js", window);
- return window[prop];
- },
- configurable: true,
- enumerable: true
- };
-}
-
-var PocketOverlay = {
- startup: function(reason) {
- let styleSheetService = Cc["@mozilla.org/content/style-sheet-service;1"]
- .getService(Ci.nsIStyleSheetService);
- this._sheetType = styleSheetService.AUTHOR_SHEET;
- this._cachedSheet = styleSheetService.preloadSheet(gPocketStyleURI,
- this._sheetType);
- Services.ppmm.loadProcessScript(PROCESS_SCRIPT, true);
- PocketReader.startup();
- CustomizableUI.addListener(this);
- CreatePocketWidget(reason);
- PocketContextMenu.init();
-
- for (let win of CustomizableUI.windows) {
- this.onWindowOpened(win);
- }
- },
- shutdown: function(reason) {
- let ppmm = Cc["@mozilla.org/parentprocessmessagemanager;1"]
- .getService(Ci.nsIMessageBroadcaster);
- ppmm.broadcastAsyncMessage("PocketShuttingDown");
- // Although the ppmm loads the scripts into the chrome process as well,
- // we need to manually unregister here anyway to ensure these aren't part
- // of the chrome process and avoid errors.
- AboutPocket.aboutSaved.unregister();
- AboutPocket.aboutSignup.unregister();
-
- CustomizableUI.removeListener(this);
- for (let window of CustomizableUI.windows) {
- for (let id of ["panelMenu_pocket", "menu_pocket", "BMB_pocket",
- "panelMenu_pocketSeparator", "menu_pocketSeparator",
- "BMB_pocketSeparator"]) {
- let element = window.document.getElementById(id);
- if (element)
- element.remove();
- }
- this.removeStyles(window);
- // remove script getters/objects
- delete window.Pocket;
- delete window.pktApi;
- delete window.pktUI;
- delete window.pktUIMessaging;
- }
- CustomizableUI.destroyWidget("pocket-button");
- PocketContextMenu.shutdown();
- PocketReader.shutdown();
- },
- onWindowOpened: function(window) {
- if (window.hasOwnProperty("pktUI"))
- return;
- this.setWindowScripts(window);
- this.addStyles(window);
- this.updateWindow(window);
- },
- setWindowScripts: function(window) {
- XPCOMUtils.defineLazyModuleGetter(window, "Pocket",
- "chrome://pocket/content/Pocket.jsm");
- // Can't use XPCOMUtils for these because the scripts try to define the variables
- // on window, and so the defineProperty inside defineLazyGetter fails.
- Object.defineProperty(window, "pktApi", pktUIGetter("pktApi", window));
- Object.defineProperty(window, "pktUI", pktUIGetter("pktUI", window));
- Object.defineProperty(window, "pktUIMessaging", pktUIGetter("pktUIMessaging", window));
- },
- // called for each window as it is opened
- updateWindow: function(window) {
- // insert our three menu items
- let document = window.document;
- let hidden = !CustomizableUI.getPlacementOfWidget("pocket-button");
-
- // add to bookmarksMenu
- let sib = document.getElementById("menu_bookmarkThisPage");
- if (sib && !document.getElementById("menu_pocket")) {
- let menu = createElementWithAttrs(document, "menuitem", {
- "id": "menu_pocket",
- "label": gPocketBundle.GetStringFromName("pocketMenuitem.label"),
- "class": "menuitem-iconic", // OSX only
- "oncommand": "openUILink(Pocket.listURL, event);",
- "hidden": hidden
- });
- let sep = createElementWithAttrs(document, "menuseparator", {
- "id": "menu_pocketSeparator",
- "hidden": hidden
- });
- sib.parentNode.insertBefore(menu, sib);
- sib.parentNode.insertBefore(sep, sib);
- }
-
- // add to bookmarks-menu-button
- sib = document.getElementById("BMB_bookmarksToolbar");
- if (sib && !document.getElementById("BMB_pocket")) {
- let menu = createElementWithAttrs(document, "menuitem", {
- "id": "BMB_pocket",
- "label": gPocketBundle.GetStringFromName("pocketMenuitem.label"),
- "class": "menuitem-iconic bookmark-item subviewbutton",
- "oncommand": "openUILink(Pocket.listURL, event);",
- "hidden": hidden
- });
- let sep = createElementWithAttrs(document, "menuseparator", {
- "id": "BMB_pocketSeparator",
- "hidden": hidden
- });
- sib.parentNode.insertBefore(menu, sib);
- sib.parentNode.insertBefore(sep, sib);
- }
-
- // add to PanelUI-bookmarks
- sib = document.getElementById("panelMenuBookmarkThisPage");
- if (sib && !document.getElementById("panelMenu_pocket")) {
- let menu = createElementWithAttrs(document, "toolbarbutton", {
- "id": "panelMenu_pocket",
- "label": gPocketBundle.GetStringFromName("pocketMenuitem.label"),
- "class": "subviewbutton cui-withicon",
- "oncommand": "openUILink(Pocket.listURL, event);",
- "hidden": hidden
- });
- let sep = createElementWithAttrs(document, "toolbarseparator", {
- "id": "panelMenu_pocketSeparator",
- "hidden": hidden
- });
- // nextSibling is no-id toolbarseparator
- // insert separator first then button
- sib = sib.nextSibling;
- sib.parentNode.insertBefore(sep, sib);
- sib.parentNode.insertBefore(menu, sib);
- }
- },
- onWidgetAfterDOMChange: function(aWidgetNode) {
- if (aWidgetNode.id != "pocket-button") {
- return;
- }
- let doc = aWidgetNode.ownerDocument;
- let hidden = !CustomizableUI.getPlacementOfWidget("pocket-button");
- for (let prefix of ["panelMenu_", "menu_", "BMB_"]) {
- let element = doc.getElementById(prefix + "pocket");
- if (element) {
- element.hidden = hidden;
- doc.getElementById(prefix + "pocketSeparator").hidden = hidden;
- }
- }
- // enable or disable reader button
- PocketReader.hidden = hidden;
- },
-
- addStyles: function(win) {
- let utils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
- utils.addSheet(this._cachedSheet, this._sheetType);
- },
-
- removeStyles: function(win) {
- let utils = win.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils);
- utils.removeSheet(gPocketStyleURI, this._sheetType);
- }
-
-}
-
-// use enabled pref as a way for tests (e.g. test_contextmenu.html) to disable
-// the addon when running.
-function prefObserver(aSubject, aTopic, aData) {
- let enabled = Services.prefs.getBoolPref("extensions.pocket.enabled");
- if (enabled)
- PocketOverlay.startup(ADDON_ENABLE);
- else
- PocketOverlay.shutdown(ADDON_DISABLE);
-}
-
-function startup(data, reason) {
- AddonManager.getAddonByID("isreaditlater@ideashower.com", addon => {
- if (addon && addon.isActive)
- return;
- setDefaultPrefs();
- // migrate enabled pref
- if (Services.prefs.prefHasUserValue("browser.pocket.enabled")) {
- Services.prefs.setBoolPref("extensions.pocket.enabled", Services.prefs.getBoolPref("browser.pocket.enabled"));
- Services.prefs.clearUserPref("browser.pocket.enabled");
- }
- // watch pref change and enable/disable if necessary
- Services.prefs.addObserver("extensions.pocket.enabled", prefObserver, false);
- if (!Services.prefs.getBoolPref("extensions.pocket.enabled"))
- return;
- PocketOverlay.startup(reason);
- });
-}
-
-function shutdown(data, reason) {
- // For speed sake, we should only do a shutdown if we're being disabled.
- // On an app shutdown, just let it fade away...
- if (reason != APP_SHUTDOWN) {
- Services.prefs.removeObserver("extensions.pocket.enabled", prefObserver);
- PocketOverlay.shutdown(reason);
- }
-}
-
-function install() {
-}
-
-function uninstall() {
-}
diff --git a/browser/extensions/pocket/content/AboutPocket.jsm b/browser/extensions/pocket/content/AboutPocket.jsm
deleted file mode 100644
index c7f57aa873..0000000000
--- a/browser/extensions/pocket/content/AboutPocket.jsm
+++ /dev/null
@@ -1,93 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-"use strict";
-
-const { interfaces: Ci, results: Cr, manager: Cm, utils: Cu } = Components;
-
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-
-// See LOG_LEVELS in Console.jsm. Common examples: "All", "Info", "Warn", & "Error".
-const PREF_LOG_LEVEL = "loop.debug.loglevel";
-
-XPCOMUtils.defineLazyGetter(this, "log", () => {
- let ConsoleAPI = Cu.import("resource://gre/modules/Console.jsm", {}).ConsoleAPI;
- let consoleOptions = {
- maxLogLevelPref: PREF_LOG_LEVEL,
- prefix: "Loop"
- };
- return new ConsoleAPI(consoleOptions);
-});
-
-
-function AboutPage(chromeURL, aboutHost, classID, description, uriFlags) {
- this.chromeURL = chromeURL;
- this.aboutHost = aboutHost;
- this.classID = Components.ID(classID);
- this.description = description;
- this.uriFlags = uriFlags;
-}
-
-AboutPage.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),
- getURIFlags: function(aURI) { // eslint-disable-line no-unused-vars
- return this.uriFlags;
- },
-
- newChannel: function(aURI, aLoadInfo) {
- let newURI = Services.io.newURI(this.chromeURL, null, null);
- let channel = Services.io.newChannelFromURIWithLoadInfo(newURI,
- aLoadInfo);
- channel.originalURI = aURI;
-
- if (this.uriFlags & Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT) {
- let principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(aURI);
- channel.owner = principal;
- }
- return channel;
- },
-
- createInstance: function(outer, iid) {
- if (outer !== null) {
- throw Cr.NS_ERROR_NO_AGGREGATION;
- }
- return this.QueryInterface(iid);
- },
-
- register: function() {
- Cm.QueryInterface(Ci.nsIComponentRegistrar).registerFactory(
- this.classID, this.description,
- "@mozilla.org/network/protocol/about;1?what=" + this.aboutHost, this);
- },
-
- unregister: function() {
- Cm.QueryInterface(Ci.nsIComponentRegistrar).unregisterFactory(
- this.classID, this);
- }
-};
-
-/* exported AboutPocket */
-var AboutPocket = {};
-
-XPCOMUtils.defineLazyGetter(AboutPocket, "aboutSaved", () =>
- new AboutPage("chrome://pocket/content/panels/saved.html",
- "pocket-saved",
- "{3e759f54-37af-7843-9824-f71b5993ceed}",
- "About Pocket Saved",
- Ci.nsIAboutModule.ALLOW_SCRIPT |
- Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT |
- Ci.nsIAboutModule.HIDE_FROM_ABOUTABOUT)
-);
-
-XPCOMUtils.defineLazyGetter(AboutPocket, "aboutSignup", () =>
- new AboutPage("chrome://pocket/content/panels/signup.html",
- "pocket-signup",
- "{8548329d-00c4-234e-8f17-75026db3b56e}",
- "About Pocket Signup",
- Ci.nsIAboutModule.ALLOW_SCRIPT |
- Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT |
- Ci.nsIAboutModule.HIDE_FROM_ABOUTABOUT)
-);
-
-this.EXPORTED_SYMBOLS = ["AboutPocket"];
diff --git a/browser/extensions/pocket/content/Pocket.jsm b/browser/extensions/pocket/content/Pocket.jsm
deleted file mode 100644
index 54f9cdf11b..0000000000
--- a/browser/extensions/pocket/content/Pocket.jsm
+++ /dev/null
@@ -1,93 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-
-this.EXPORTED_SYMBOLS = ["Pocket"];
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
- "resource:///modules/CustomizableUI.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "ReaderMode",
- "resource://gre/modules/ReaderMode.jsm");
-
-var Pocket = {
- get site() { return Services.prefs.getCharPref("extensions.pocket.site"); },
- get listURL() { return "https://" + Pocket.site + "/?src=ff_ext"; },
-
- /**
- * Functions related to the Pocket panel UI.
- */
- onPanelViewShowing(event) {
- let document = event.target.ownerDocument;
- let window = document.defaultView;
- let iframe = window.pktUI.getPanelFrame();
-
- let urlToSave = Pocket._urlToSave;
- let titleToSave = Pocket._titleToSave;
- Pocket._urlToSave = null;
- Pocket._titleToSave = null;
- // ViewShowing fires immediately before it creates the contents,
- // in lieu of an AfterViewShowing event, just spin the event loop.
- window.setTimeout(function() {
- if (urlToSave) {
- window.pktUI.tryToSaveUrl(urlToSave, titleToSave);
- } else {
- window.pktUI.tryToSaveCurrentPage();
- }
-
- // pocketPanelDidHide in main.js set iframe to about:blank when it was
- // hidden, make sure we're loading the save panel.
- if (iframe.contentDocument &&
- iframe.contentDocument.readyState == "complete" &&
- iframe.contentDocument.documentURI != "about:blank") {
- window.pktUI.pocketPanelDidShow();
- } else {
- // iframe didn't load yet. This seems to always be the case when in
- // the toolbar panel, but never the case for a subview.
- // XXX this only being fired when it's a _capturing_ listener!
- iframe.addEventListener("load", Pocket.onFrameLoaded, true);
- }
- }, 0);
- },
-
- onFrameLoaded(event) {
- let document = event.currentTarget.ownerDocument;
- let window = document.defaultView;
- let iframe = window.pktUI.getPanelFrame();
-
- iframe.removeEventListener("load", Pocket.onFrameLoaded, true);
- window.pktUI.pocketPanelDidShow();
- },
-
- onPanelViewHiding(event) {
- let window = event.target.ownerGlobal;
- window.pktUI.pocketPanelDidHide(event);
- },
-
- _urlToSave: null,
- _titleToSave: null,
- savePage(browser, url, title) {
- let document = browser.ownerDocument;
- let pocketWidget = document.getElementById("pocket-button");
- let placement = CustomizableUI.getPlacementOfWidget("pocket-button");
- if (!placement)
- return;
-
- this._urlToSave = url;
- this._titleToSave = title;
- if (placement.area == CustomizableUI.AREA_PANEL) {
- let win = document.defaultView;
- win.PanelUI.show().then(function() {
- pocketWidget = document.getElementById("pocket-button");
- pocketWidget.doCommand();
- });
- } else {
- pocketWidget.doCommand();
- }
- },
-};
diff --git a/browser/extensions/pocket/content/main.js b/browser/extensions/pocket/content/main.js
deleted file mode 100644
index 3c1c5785ea..0000000000
--- a/browser/extensions/pocket/content/main.js
+++ /dev/null
@@ -1,737 +0,0 @@
-/*
- * LICENSE
- *
- * POCKET MARKS
- *
- * Notwithstanding the permitted uses of the Software (as defined below) pursuant to the license set forth below, "Pocket," "Read It Later" and the Pocket icon and logos (collectively, the “Pocket Marks”) are registered and common law trademarks of Read It Later, Inc. This means that, while you have considerable freedom to redistribute and modify the Software, there are tight restrictions on your ability to use the Pocket Marks. This license does not grant you any rights to use the Pocket Marks except as they are embodied in the Software.
- *
- * ---
- *
- * SOFTWARE
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/*
- * Pocket UI module
- *
- * Handles interactions with Pocket buttons, panels and menus.
- *
- */
-
-// TODO : Get the toolbar icons from Firefox's build (Nikki needs to give us a red saved icon)
-// TODO : [needs clarificaiton from Fx] Firefox's plan was to hide Pocket from context menus until the user logs in. Now that it's an extension I'm wondering if we still need to do this.
-// TODO : [needs clarificaiton from Fx] Reader mode (might be a something they need to do since it's in html, need to investigate their code)
-// TODO : [needs clarificaiton from Fx] Move prefs within pktApi.s to sqlite or a local file so it's not editable (and is safer)
-// TODO : [nice to have] - Immediately save, buffer the actions in a local queue and send (so it works offline, works like our native extensions)
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
- "resource://gre/modules/PrivateBrowsingUtils.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "ReaderMode",
- "resource://gre/modules/ReaderMode.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "pktApi",
- "chrome://pocket/content/pktApi.jsm");
-
-var pktUI = (function() {
-
- // -- Initialization (on startup and new windows) -- //
- var _currentPanelDidShow;
- var _currentPanelDidHide;
-
- // Init panel id at 0. The first actual panel id will have the number 1 so
- // in case at some point any panel has the id 0 we know there is something
- // wrong
- var _panelId = 0;
-
- var overflowMenuWidth = 230;
- var overflowMenuHeight = 475;
- var savePanelWidth = 350;
- var savePanelHeights = {collapsed: 153, expanded: 272};
-
- // -- Event Handling -- //
-
- /**
- * Event handler when Pocket toolbar button is pressed
- */
-
- function pocketPanelDidShow(event) {
- if (_currentPanelDidShow) {
- _currentPanelDidShow(event);
- }
-
- }
-
- function pocketPanelDidHide(event) {
- if (_currentPanelDidHide) {
- _currentPanelDidHide(event);
- }
-
- // clear the panel
- getPanelFrame().setAttribute('src', 'about:blank');
- }
-
-
- // -- Communication to API -- //
-
- /**
- * Either save or attempt to log the user in
- */
- function tryToSaveCurrentPage() {
- tryToSaveUrl(getCurrentUrl(), getCurrentTitle());
- }
-
- function tryToSaveUrl(url, title) {
-
- // If the user is logged in, go ahead and save the current page
- if (pktApi.isUserLoggedIn()) {
- saveAndShowConfirmation(url, title);
- return;
- }
-
- // If the user is not logged in, show the logged-out state to prompt them to authenticate
- showSignUp();
- }
-
-
- // -- Panel UI -- //
-
- /**
- * Show the sign-up panel
- */
- function showSignUp() {
- // AB test: Direct logged-out users to tab vs panel
- if (pktApi.getSignupPanelTabTestVariant() == 'v2')
- {
- let site = Services.prefs.getCharPref("extensions.pocket.site");
- openTabWithUrl('https://' + site + '/firefox_learnmore?s=ffi&t=autoredirect&tv=page_learnmore&src=ff_ext', true);
-
- // force the panel closed before it opens
- getPanel().hidePopup();
-
- return;
- }
-
- // Control: Show panel as normal
- getFirefoxAccountSignedInUser(function(userdata)
- {
- var fxasignedin = (typeof userdata == 'object' && userdata !== null) ? '1' : '0';
- var startheight = 490;
- var inOverflowMenu = isInOverflowMenu();
- var controlvariant = pktApi.getSignupPanelTabTestVariant() == 'control';
-
- if (inOverflowMenu)
- {
- startheight = overflowMenuHeight;
- }
- else
- {
- startheight = 460;
- if (fxasignedin == '1')
- {
- startheight = 406;
- }
- }
- if (!controlvariant) {
- startheight = 427;
- }
- var variant;
- if (inOverflowMenu)
- {
- variant = 'overflow';
- }
- else
- {
- variant = 'storyboard_lm';
- }
-
- showPanel("about:pocket-signup?pockethost="
- + Services.prefs.getCharPref("extensions.pocket.site")
- + "&fxasignedin="
- + fxasignedin
- + "&variant="
- + variant
- + '&controlvariant='
- + controlvariant
- + '&inoverflowmenu='
- + inOverflowMenu
- + "&locale="
- + getUILocale(), {
- onShow: function() {
- },
- onHide: panelDidHide,
- width: inOverflowMenu ? overflowMenuWidth : 300,
- height: startheight
- });
- });
- }
-
- /**
- * Show the logged-out state / sign-up panel
- */
- function saveAndShowConfirmation(url, title) {
-
- // Validate input parameter
- if (typeof url !== 'undefined' && url.startsWith("about:reader?url=")) {
- url = ReaderMode.getOriginalUrl(url);
- }
-
- var isValidURL = (typeof url !== 'undefined' && (url.startsWith("http") || url.startsWith('https')));
-
- var inOverflowMenu = isInOverflowMenu();
- var startheight = pktApi.isPremiumUser() && isValidURL ? savePanelHeights.expanded : savePanelHeights.collapsed;
- if (inOverflowMenu) {
- startheight = overflowMenuHeight;
- }
-
- var panelId = showPanel("about:pocket-saved?pockethost=" + Services.prefs.getCharPref("extensions.pocket.site") + "&premiumStatus=" + (pktApi.isPremiumUser() ? '1' : '0') + '&inoverflowmenu='+inOverflowMenu + "&locale=" + getUILocale(), {
- onShow: function() {
- var saveLinkMessageId = 'saveLink';
-
- // Send error message for invalid url
- if (!isValidURL) {
- // TODO: Pass key for localized error in error object
- let error = {
- message: 'Only links can be saved',
- localizedKey: "onlylinkssaved"
- };
- pktUIMessaging.sendErrorMessageToPanel(panelId, saveLinkMessageId, error);
- return;
- }
-
- // Check online state
- if (!navigator.onLine) {
- // TODO: Pass key for localized error in error object
- let error = {
- message: 'You must be connected to the Internet in order to save to Pocket. Please connect to the Internet and try again.'
- };
- pktUIMessaging.sendErrorMessageToPanel(panelId, saveLinkMessageId, error);
- return;
- }
-
- // Add url
- var options = {
- success: function(data, request) {
- var item = data.item;
- var successResponse = {
- status: "success",
- item: item
- };
- pktUIMessaging.sendMessageToPanel(panelId, saveLinkMessageId, successResponse);
- },
- error: function(error, request) {
- // If user is not authorized show singup page
- if (request.status === 401) {
- showSignUp();
- return;
- }
-
- // If there is no error message in the error use a
- // complete catch-all
- var errorMessage = error.message || "There was an error when trying to save to Pocket.";
- var panelError = { message: errorMessage}
-
- // Send error message to panel
- pktUIMessaging.sendErrorMessageToPanel(panelId, saveLinkMessageId, panelError);
- }
- }
-
- // Add title if given
- if (typeof title !== "undefined") {
- options.title = title;
- }
-
- // Send the link
- pktApi.addLink(url, options);
- },
- onHide: panelDidHide,
- width: inOverflowMenu ? overflowMenuWidth : savePanelWidth,
- height: startheight
- });
- }
-
- /**
- * Open a generic panel
- */
- function showPanel(url, options) {
-
- // Add new panel id
- _panelId += 1;
- url += ("&panelId=" + _panelId);
-
- // We don't have to hide and show the panel again if it's already shown
- // as if the user tries to click again on the toolbar button the overlay
- // will close instead of the button will be clicked
- var iframe = getPanelFrame();
-
- // Register event handlers
- registerEventMessages();
-
- // Load the iframe
- iframe.setAttribute('src', url);
-
- // Uncomment to leave panel open -- for debugging
- // panel.setAttribute('noautohide', true);
- // panel.setAttribute('consumeoutsideclicks', false);
- //
-
- // For some reason setting onpopupshown and onpopuphidden on the panel directly didn't work, so
- // do it this hacky way for now
- _currentPanelDidShow = options.onShow;
- _currentPanelDidHide = options.onHide;
-
- resizePanel({
- width: options.width,
- height: options.height
- });
- return _panelId;
- }
-
- /**
- * Resize the panel
- * options = {
- * width: ,
- * height: ,
- * animate [default false]
- * }
- */
- function resizePanel(options) {
- var iframe = getPanelFrame();
- var subview = getSubview();
-
- if (subview) {
- // Use the subview's size
- iframe.style.width = "100%";
- iframe.style.height = subview.parentNode.clientHeight + "px";
- } else {
- // Set an explicit size, panel will adapt.
- iframe.style.width = options.width + "px";
- iframe.style.height = options.height + "px";
- }
- }
-
- /**
- * Called when the signup and saved panel was hidden
- */
- function panelDidHide() {
- // clear the onShow and onHide values
- _currentPanelDidShow = null;
- _currentPanelDidHide = null;
- }
-
- /**
- * Register all of the messages needed for the panels
- */
- function registerEventMessages() {
- var iframe = getPanelFrame();
-
- // Only register the messages once
- var didInitAttributeKey = 'did_init';
- var didInitMessageListener = iframe.getAttribute(didInitAttributeKey);
- if (typeof didInitMessageListener !== "undefined" && didInitMessageListener == 1) {
- return;
- }
- iframe.setAttribute(didInitAttributeKey, 1);
-
- // When the panel is displayed it generated an event called
- // "show": we will listen for that event and when it happens,
- // send our own "show" event to the panel's script, so the
- // script can prepare the panel for display.
- var _showMessageId = "show";
- pktUIMessaging.addMessageListener(iframe, _showMessageId, function(panelId, data) {
- // Let panel know that it is ready
- pktUIMessaging.sendMessageToPanel(panelId, _showMessageId);
- });
-
- // Open a new tab with a given url and activate if
- var _openTabWithUrlMessageId = "openTabWithUrl";
- pktUIMessaging.addMessageListener(iframe, _openTabWithUrlMessageId, function(panelId, data, contentPrincipal) {
- try {
- urlSecurityCheck(data.url, contentPrincipal, Services.scriptSecurityManager.DISALLOW_INHERIT_PRINCIPAL);
- } catch (ex) {
- return;
- }
-
- // Check if the tab should become active after opening
- var activate = true;
- if (typeof data.activate !== "undefined") {
- activate = data.activate;
- }
-
- var url = data.url;
- openTabWithUrl(url, activate);
- pktUIMessaging.sendResponseMessageToPanel(panelId, _openTabWithUrlMessageId, url);
- });
-
- // Close the panel
- var _closeMessageId = "close";
- pktUIMessaging.addMessageListener(iframe, _closeMessageId, function(panelId, data) {
- getPanel().hidePopup();
- });
-
- // Send the current url to the panel
- var _getCurrentURLMessageId = "getCurrentURL";
- pktUIMessaging.addMessageListener(iframe, _getCurrentURLMessageId, function(panelId, data) {
- pktUIMessaging.sendResponseMessageToPanel(panelId, _getCurrentURLMessageId, getCurrentUrl());
- });
-
- var _resizePanelMessageId = "resizePanel";
- pktUIMessaging.addMessageListener(iframe, _resizePanelMessageId, function(panelId, data) {
- resizePanel(data);
- });
-
- // Callback post initialization to tell background script that panel is "ready" for communication.
- pktUIMessaging.addMessageListener(iframe, "listenerReady", function(panelId, data) {
-
- });
-
- pktUIMessaging.addMessageListener(iframe, "collapseSavePanel", function(panelId, data) {
- if (!pktApi.isPremiumUser() && !isInOverflowMenu())
- resizePanel({width:savePanelWidth, height:savePanelHeights.collapsed});
- });
-
- pktUIMessaging.addMessageListener(iframe, "expandSavePanel", function(panelId, data) {
- if (!isInOverflowMenu())
- resizePanel({width:savePanelWidth, height:savePanelHeights.expanded});
- });
-
- // Ask for recently accessed/used tags for auto complete
- var _getTagsMessageId = "getTags";
- pktUIMessaging.addMessageListener(iframe, _getTagsMessageId, function(panelId, data) {
- pktApi.getTags(function(tags, usedTags) {
- pktUIMessaging.sendResponseMessageToPanel(panelId, _getTagsMessageId, {
- tags: tags,
- usedTags: usedTags
- });
- });
- });
-
- // Ask for suggested tags based on passed url
- var _getSuggestedTagsMessageId = "getSuggestedTags";
- pktUIMessaging.addMessageListener(iframe, _getSuggestedTagsMessageId, function(panelId, data) {
- pktApi.getSuggestedTagsForURL(data.url, {
- success: function(data, response) {
- var suggestedTags = data.suggested_tags;
- var successResponse = {
- status: "success",
- value: {
- suggestedTags: suggestedTags
- }
- }
- pktUIMessaging.sendResponseMessageToPanel(panelId, _getSuggestedTagsMessageId, successResponse);
- },
- error: function(error, response) {
- pktUIMessaging.sendErrorResponseMessageToPanel(panelId, _getSuggestedTagsMessageId, error);
- }
- })
- });
-
- // Pass url and array list of tags, add to existing save item accordingly
- var _addTagsMessageId = "addTags";
- pktUIMessaging.addMessageListener(iframe, _addTagsMessageId, function(panelId, data) {
- pktApi.addTagsToURL(data.url, data.tags, {
- success: function(data, response) {
- var successResponse = {status: "success"};
- pktUIMessaging.sendResponseMessageToPanel(panelId, _addTagsMessageId, successResponse);
- },
- error: function(error, response) {
- pktUIMessaging.sendErrorResponseMessageToPanel(panelId, _addTagsMessageId, error);
- }
- });
- });
-
- // Based on clicking "remove page" CTA, and passed unique item id, remove the item
- var _deleteItemMessageId = "deleteItem";
- pktUIMessaging.addMessageListener(iframe, _deleteItemMessageId, function(panelId, data) {
- pktApi.deleteItem(data.itemId, {
- success: function(data, response) {
- var successResponse = {status: "success"};
- pktUIMessaging.sendResponseMessageToPanel(panelId, _deleteItemMessageId, successResponse);
- },
- error: function(error, response) {
- pktUIMessaging.sendErrorResponseMessageToPanel(panelId, _deleteItemMessageId, error);
- }
- })
- });
-
- var _initL10NMessageId = "initL10N";
- pktUIMessaging.addMessageListener(iframe, _initL10NMessageId, function(panelId, data) {
- var strings = {};
- var bundle = Services.strings.createBundle("chrome://pocket/locale/pocket.properties");
- var e = bundle.getSimpleEnumeration();
- while (e.hasMoreElements()) {
- var str = e.getNext().QueryInterface(Components.interfaces.nsIPropertyElement);
- if (str.key in data) {
- strings[str.key] = bundle.formatStringFromName(str.key, data[str.key], data[str.key].length);
- } else {
- strings[str.key] = str.value;
- }
- }
- pktUIMessaging.sendResponseMessageToPanel(panelId, _initL10NMessageId, { strings: strings });
- });
-
- }
-
- // -- Browser Navigation -- //
-
- /**
- * Open a new tab with a given url and notify the iframe panel that it was opened
- */
-
- function openTabWithUrl(url) {
- let recentWindow = Services.wm.getMostRecentWindow("navigator:browser");
- if (!recentWindow) {
- Cu.reportError("Pocket: No open browser windows to openTabWithUrl");
- return;
- }
-
- // If the user is in permanent private browsing than this is not an issue,
- // since the current window will always share the same cookie jar as the other
- // windows.
- if (!PrivateBrowsingUtils.isWindowPrivate(recentWindow) ||
- PrivateBrowsingUtils.permanentPrivateBrowsing) {
- recentWindow.openUILinkIn(url, "tab");
- return;
- }
-
- let windows = Services.wm.getEnumerator("navigator:browser");
- while (windows.hasMoreElements()) {
- let win = windows.getNext();
- if (!PrivateBrowsingUtils.isWindowPrivate(win)) {
- win.openUILinkIn(url, "tab");
- return;
- }
- }
-
- // If there were no non-private windows opened already.
- recentWindow.openUILinkIn(url, "window");
- }
-
-
- // -- Helper Functions -- //
-
- function getCurrentUrl() {
- return getBrowser().currentURI.spec;
- }
-
- function getCurrentTitle() {
- return getBrowser().contentTitle;
- }
-
- function getPanel() {
- var frame = getPanelFrame();
- var panel = frame;
- while (panel && panel.localName != "panel") {
- panel = panel.parentNode;
- }
- return panel;
- }
-
- function getPanelFrame() {
- var frame = document.getElementById('pocket-panel-iframe');
- if (!frame) {
- var frameParent = document.getElementById("PanelUI-pocketView").firstChild;
- frame = document.createElement("iframe");
- frame.id = 'pocket-panel-iframe';
- frame.setAttribute("type", "content");
- frameParent.appendChild(frame);
- }
- return frame;
- }
-
- function getSubview() {
- var view = document.getElementById("PanelUI-pocketView");
- if (view && view.getAttribute("current") == "true")
- return view;
- return null;
- }
-
- function isInOverflowMenu() {
- var subview = getSubview();
- return !!subview;
- }
-
- function getFirefoxAccountSignedInUser(callback) {
- fxAccounts.getSignedInUser().then(userData => {
- callback(userData);
- }).then(null, error => {
- callback();
- });
- }
-
- function getUILocale() {
- var locale = Cc["@mozilla.org/chrome/chrome-registry;1"].
- getService(Ci.nsIXULChromeRegistry).
- getSelectedLocale("browser");
- return locale;
- }
-
- /**
- * Public functions
- */
- return {
- getPanelFrame: getPanelFrame,
-
- openTabWithUrl: openTabWithUrl,
-
- pocketPanelDidShow: pocketPanelDidShow,
- pocketPanelDidHide: pocketPanelDidHide,
-
- tryToSaveUrl: tryToSaveUrl,
- tryToSaveCurrentPage: tryToSaveCurrentPage
- };
-}());
-
-// -- Communication to Background -- //
-// https://developer.mozilla.org/en-US/Add-ons/Code_snippets/Interaction_between_privileged_and_non-privileged_pages
-var pktUIMessaging = (function() {
-
- /**
- * Prefix message id for message listening
- */
- function prefixedMessageId(messageId) {
- return 'PKT_' + messageId;
- }
-
- /**
- * Register a listener and callback for a specific messageId
- */
- function addMessageListener(iframe, messageId, callback) {
- iframe.addEventListener(prefixedMessageId(messageId), function(e) {
- var nodePrincipal = e.target.nodePrincipal;
- // ignore to ensure we do not pick up other events in the browser
- if (!nodePrincipal || !nodePrincipal.URI || !nodePrincipal.URI.spec.startsWith("about:pocket")) {
- return;
- }
-
- // Pass in information to callback
- var payload = JSON.parse(e.target.getAttribute("payload"))[0];
- var panelId = payload.panelId;
- var data = payload.data;
- callback(panelId, data, nodePrincipal);
-
- // Cleanup the element
- e.target.parentNode.removeChild(e.target);
-
- }, false, true);
- }
-
- /**
- * Send a message to the panel's iframe
- */
- function sendMessageToPanel(panelId, messageId, payload) {
-
- if (!isPanelIdValid(panelId)) { return; }
-
- var panelFrame = pktUI.getPanelFrame();
- if (!isPocketPanelFrameValid(panelFrame)) { return; }
-
- var doc = panelFrame.contentWindow.document;
- var documentElement = doc.documentElement;
-
- // Send message to panel
- var panelMessageId = prefixedMessageId(panelId + '_' + messageId);
-
- var AnswerEvt = doc.createElement("PKTMessage");
- AnswerEvt.setAttribute("payload", JSON.stringify([payload]));
- documentElement.appendChild(AnswerEvt);
-
- var event = doc.createEvent("HTMLEvents");
- event.initEvent(panelMessageId, true, false);
- AnswerEvt.dispatchEvent(event);
- }
-
- function sendResponseMessageToPanel(panelId, messageId, payload) {
- var responseMessageId = messageId + "Response";
- sendMessageToPanel(panelId, responseMessageId, payload);
- }
-
- /**
- * Helper function to package an error object and send it to the panel
- * iframe as a message response
- */
- function sendErrorMessageToPanel(panelId, messageId, error) {
- var errorResponse = {status: "error", error: error};
- sendMessageToPanel(panelId, messageId, errorResponse);
- }
-
- function sendErrorResponseMessageToPanel(panelId, messageId, error) {
- var errorResponse = {status: "error", error: error};
- sendResponseMessageToPanel(panelId, messageId, errorResponse);
- }
-
- /**
- * Validation
- */
-
- function isPanelIdValid(panelId) {
- // First check if panelId has a valid value > 0. We set the panelId to
- // 0 to start. But if for some reason the message is attempted to be
- // sent before the panel has a panelId, then it's going to send out
- // a message with panelId 0, which is never going to be heard. If this
- // happens, it means some race condition occurred where the panel was
- // trying to communicate before it should.
- if (panelId === 0) {
- console.warn("Tried to send message to panel with id 0.")
- return false;
- }
-
- return true
- }
-
- function isPocketPanelFrameValid(panelFrame) {
- // Check if panel is available if not throw a warning and bailout.
- // We likely try to send to a panel that is not visible anymore
- if (typeof panelFrame === "undefined") {
- console.warn("Pocket panel frame is undefined");
- return false;
- }
-
- var contentWindow = panelFrame.contentWindow;
- if (typeof contentWindow == "undefined") {
- console.warn("Pocket panel frame content window is undefined");
- return false;
- }
-
- var doc = contentWindow.document;
- if (typeof doc === "undefined") {
- console.warn("Pocket panel frame content window document is undefined");
- return false;
- }
-
- var documentElement = doc.documentElement;
- if (typeof documentElement === "undefined") {
- console.warn("Pocket panel frame content window document document element is undefined");
- return false;
- }
-
- return true;
- }
-
- /**
- * Public
- */
- return {
- addMessageListener: addMessageListener,
- sendMessageToPanel: sendMessageToPanel,
- sendResponseMessageToPanel: sendResponseMessageToPanel,
- sendErrorMessageToPanel: sendErrorMessageToPanel,
- sendErrorResponseMessageToPanel: sendErrorResponseMessageToPanel
- }
-}());
diff --git a/browser/extensions/pocket/content/panels/css/firasans.css b/browser/extensions/pocket/content/panels/css/firasans.css
deleted file mode 100644
index 5915345d64..0000000000
--- a/browser/extensions/pocket/content/panels/css/firasans.css
+++ /dev/null
@@ -1,6 +0,0 @@
-@font-face {
- font-family: 'FiraSans';
- src: url('../fonts/FiraSans-Regular.woff') format('woff');
- font-weight: normal;
- font-style: normal;
-} \ No newline at end of file
diff --git a/browser/extensions/pocket/content/panels/css/normalize.css b/browser/extensions/pocket/content/panels/css/normalize.css
deleted file mode 100644
index b7b4b746ec..0000000000
--- a/browser/extensions/pocket/content/panels/css/normalize.css
+++ /dev/null
@@ -1,424 +0,0 @@
-/*! normalize.css v3.0.2 | MIT License | git.io/normalize */
-
-/**
- * 1. Set default font family to sans-serif.
- * 2. Prevent iOS text size adjust after orientation change, without disabling
- * user zoom.
- */
-
-html {
- font-family: sans-serif; /* 1 */
-}
-
-/**
- * Remove default margin.
- */
-
-body {
- margin: 0;
-}
-
-/* HTML5 display definitions
- ========================================================================== */
-
-/**
- * Correct `block` display not defined for any HTML5 element in IE 8/9.
- * Correct `block` display not defined for `details` or `summary` in IE 10/11
- * and Firefox.
- * Correct `block` display not defined for `main` in IE 11.
- */
-
-article,
-aside,
-details,
-figcaption,
-figure,
-footer,
-header,
-hgroup,
-main,
-menu,
-nav,
-section,
-summary {
- display: block;
-}
-
-/**
- * 1. Correct `inline-block` display not defined in IE 8/9.
- * 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.
- */
-
-audio,
-canvas,
-progress,
-video {
- display: inline-block; /* 1 */
- vertical-align: baseline; /* 2 */
-}
-
-/**
- * Prevent modern browsers from displaying `audio` without controls.
- * Remove excess height in iOS 5 devices.
- */
-
-audio:not([controls]) {
- display: none;
- height: 0;
-}
-
-/**
- * Address `[hidden]` styling not present in IE 8/9/10.
- * Hide the `template` element in IE 8/9/11, Safari, and Firefox < 22.
- */
-
-[hidden],
-template {
- display: none;
-}
-
-/* Links
- ========================================================================== */
-
-/**
- * Remove the gray background color from active links in IE 10.
- */
-
-a {
- background-color: transparent;
-}
-
-/**
- * Improve readability when focused and also mouse hovered in all browsers.
- */
-
-a:active,
-a:hover {
- outline: 0;
-}
-
-/* Text-level semantics
- ========================================================================== */
-
-/**
- * Address styling not present in IE 8/9/10/11, Safari, and Chrome.
- */
-
-abbr[title] {
- border-bottom: 1px dotted;
-}
-
-/**
- * Address style set to `bolder` in Firefox 4+, Safari, and Chrome.
- */
-
-b,
-strong {
- font-weight: bold;
-}
-
-/**
- * Address styling not present in Safari and Chrome.
- */
-
-dfn {
- font-style: italic;
-}
-
-/**
- * Address variable `h1` font-size and margin within `section` and `article`
- * contexts in Firefox 4+, Safari, and Chrome.
- */
-
-h1 {
- font-size: 2em;
- margin: 0.67em 0;
-}
-
-/**
- * Address styling not present in IE 8/9.
- */
-
-mark {
- background: #ff0;
- color: #000;
-}
-
-/**
- * Address inconsistent and variable font size in all browsers.
- */
-
-small {
- font-size: 80%;
-}
-
-/**
- * Prevent `sub` and `sup` affecting `line-height` in all browsers.
- */
-
-sub,
-sup {
- font-size: 75%;
- line-height: 0;
- position: relative;
- vertical-align: baseline;
-}
-
-sup {
- top: -0.5em;
-}
-
-sub {
- bottom: -0.25em;
-}
-
-/* Embedded content
- ========================================================================== */
-
-/**
- * Remove border when inside `a` element in IE 8/9/10.
- */
-
-img {
- border: 0;
-}
-
-/**
- * Correct overflow not hidden in IE 9/10/11.
- */
-
-svg:not(:root) {
- overflow: hidden;
-}
-
-/* Grouping content
- ========================================================================== */
-
-/**
- * Address margin not present in IE 8/9 and Safari.
- */
-
-figure {
- margin: 1em 40px;
-}
-
-/**
- * Address differences between Firefox and other browsers.
- */
-
-hr {
- -moz-box-sizing: content-box;
- box-sizing: content-box;
- height: 0;
-}
-
-/**
- * Contain overflow in all browsers.
- */
-
-pre {
- overflow: auto;
-}
-
-/**
- * Address odd `em`-unit font size rendering in all browsers.
- */
-
-code,
-kbd,
-pre,
-samp {
- font-family: monospace, monospace;
- font-size: 1em;
-}
-
-/* Forms
- ========================================================================== */
-
-/**
- * Known limitation: by default, Chrome and Safari on OS X allow very limited
- * styling of `select`, unless a `border` property is set.
- */
-
-/**
- * 1. Correct color not being inherited.
- * Known issue: affects color of disabled elements.
- * 2. Correct font properties not being inherited.
- * 3. Address margins set differently in Firefox 4+, Safari, and Chrome.
- */
-
-button,
-input,
-optgroup,
-select,
-textarea {
- color: inherit; /* 1 */
- font: inherit; /* 2 */
- margin: 0; /* 3 */
-}
-
-/**
- * Address `overflow` set to `hidden` in IE 8/9/10/11.
- */
-
-button {
- overflow: visible;
-}
-
-/**
- * Address inconsistent `text-transform` inheritance for `button` and `select`.
- * All other form control elements do not inherit `text-transform` values.
- * Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.
- * Correct `select` style inheritance in Firefox.
- */
-
-button,
-select {
- text-transform: none;
-}
-
-/**
- * 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
- * and `video` controls.
- * 2. Correct inability to style clickable `input` types in iOS.
- * 3. Improve usability and consistency of cursor style between image-type
- * `input` and others.
- */
-
-button,
-html input[type="button"], /* 1 */
-input[type="reset"],
-input[type="submit"] {
- cursor: pointer; /* 3 */
-}
-
-/**
- * Re-set default cursor for disabled elements.
- */
-
-button[disabled],
-html input[disabled] {
- cursor: default;
-}
-
-/**
- * Remove inner padding and border in Firefox 4+.
- */
-
-button::-moz-focus-inner,
-input::-moz-focus-inner {
- border: 0;
- padding: 0;
-}
-
-/**
- * Address Firefox 4+ setting `line-height` on `input` using `!important` in
- * the UA stylesheet.
- */
-
-input {
- line-height: normal;
-}
-
-/**
- * It's recommended that you don't attempt to style these elements.
- * Firefox's implementation doesn't respect box-sizing, padding, or width.
- *
- * 1. Address box sizing set to `content-box` in IE 8/9/10.
- * 2. Remove excess padding in IE 8/9/10.
- */
-
-input[type="checkbox"],
-input[type="radio"] {
- box-sizing: border-box; /* 1 */
- padding: 0; /* 2 */
-}
-
-/**
- * 1. Address `appearance` set to `searchfield` in Safari and Chrome.
- * 2. Address `box-sizing` set to `border-box` in Safari and Chrome
- * (include `-moz` to future-proof).
- */
-
-input[type="search"] {
- box-sizing: content-box;
-}
-
-/**
- * Define consistent border, margin, and padding.
- */
-
-fieldset {
- border: 1px solid #c0c0c0;
- margin: 0 2px;
- padding: 0.35em 0.625em 0.75em;
-}
-
-/**
- * 1. Correct `color` not being inherited in IE 8/9/10/11.
- * 2. Remove padding so people aren't caught out if they zero out fieldsets.
- */
-
-legend {
- border: 0; /* 1 */
- padding: 0; /* 2 */
-}
-
-/**
- * Remove default vertical scrollbar in IE 8/9/10/11.
- */
-
-textarea {
- overflow: auto;
-}
-
-/**
- * Don't inherit the `font-weight` (applied by a rule above).
- * NOTE: the default cannot safely be changed in Chrome and Safari on OS X.
- */
-
-optgroup {
- font-weight: bold;
-}
-
-/* Tables
- ========================================================================== */
-
-/**
- * Remove most spacing between table cells.
- */
-
-table {
- border-collapse: collapse;
- border-spacing: 0;
-}
-
-td,
-th {
- padding: 0;
-}
-
-/* Normalization for FF panel defauts
- ========================================================================== */
-html {
- outline: none;
- padding: 0;
-}
-
-a {
- color: #0095dd;
- margin: 0;
- outline: none;
- padding: 0;
- text-decoration: none;
-}
-
-a:hover,
-a:active {
- color: #008acb;
- text-decoration: underline;
-}
-
-a:active {
- color: #006b9d;
-}
diff --git a/browser/extensions/pocket/content/panels/css/saved.css b/browser/extensions/pocket/content/panels/css/saved.css
deleted file mode 100644
index d3f88d04c9..0000000000
--- a/browser/extensions/pocket/content/panels/css/saved.css
+++ /dev/null
@@ -1,825 +0,0 @@
-/* saved.css
- *
- * Description:
- * With base elements out of the way, this sets all custom styling for the page saved dialog.
- *
- * Contents:
- * Global
- * Loading spinner
- * Core detail
- * Tag entry
- * Recent/suggested tags
- * Premium upsell
- * Token input/autocomplete
- * Overflow mode
- * Language overrides
- */
-
-/*=Global
---------------------------------------------------------------------------------------- */
-.pkt_ext_containersaved {
- background-color: #fbfbfb;
- border-radius: 4px;
- display: block;
- font-size: 16px;
- font-family: "FiraSans", "Helvetica Neue", Helvetica, Arial, sans-serif;
- padding: 0;
- position: relative;
- text-align: center;
-}
-.pkt_ext_cf:after {
- content: " ";
- display:table;
- clear:both;
-}
-.pkt_ext_containersaved .pkt_ext_tag_detail,
-.pkt_ext_containersaved .pkt_ext_recenttag_detail,
-.pkt_ext_containersaved .pkt_ext_suggestedtag_detail {
- margin: 0 auto;
- padding: 0.25em 1em;
- position: relative;
- width: auto;
-}
-
-/*=Loading spinner
---------------------------------------------------------------------------------------- */
-@keyframes pkt_ext_spin {
- to {
- transform: rotate(1turn);
- }
-}
-.pkt_ext_containersaved {
- font-size: 16px;
-}
-.pkt_ext_containersaved .pkt_ext_loadingspinner {
- position: relative;
- display: inline-block;
- height: 2.5em;
- left: 50%;
- margin: 2em 0 0 -1.25em;
- font-size: 10px;
- text-indent: 999em;
- position: absolute;
- top: 4em;
- overflow: hidden;
- width: 2.5em;
- animation: pkt_ext_spin 0.7s infinite steps(8);
-}
-.pkt_ext_containersaved .pkt_ext_loadingspinner:before,
-.pkt_ext_containersaved .pkt_ext_loadingspinner:after,
-.pkt_ext_containersaved .pkt_ext_loadingspinner > div:before,
-.pkt_ext_containersaved .pkt_ext_loadingspinner > div:after {
- content: '';
- position: absolute;
- top: 0;
- left: 1.125em;
- width: 0.25em;
- height: 0.75em;
- border-radius: .2em;
- background: #eee;
- box-shadow: 0 1.75em #eee;
- transform-origin: 50% 1.25em;
-}
-.pkt_ext_containersaved .pkt_ext_loadingspinner:before {
- background: #555;
-}
-.pkt_ext_containersaved .pkt_ext_loadingspinner:after {
- transform: rotate(-45deg);
- background: #777;
-}
-.pkt_ext_containersaved .pkt_ext_loadingspinner > div:before {
- transform: rotate(-90deg);
- background: #999;
-}
-.pkt_ext_containersaved .pkt_ext_loadingspinner > div:after {
- transform: rotate(-135deg);
- background: #bbb;
-}
-
-/*=Core detail
---------------------------------------------------------------------------------------- */
-.pkt_ext_containersaved .pkt_ext_initload {
- left: 0;
- position: absolute;
- top: 0;
- width: 100%;
-}
-.pkt_ext_containersaved .pkt_ext_detail {
- max-height: 0;
- opacity: 0;
- position: relative;
- z-index: 10;
-}
-.pkt_ext_container_detailactive .pkt_ext_initload {
- opacity: 0;
-}
-.pkt_ext_container_detailactive .pkt_ext_initload .pkt_ext_loadingspinner,
-.pkt_ext_container_finalstate .pkt_ext_initload .pkt_ext_loadingspinner {
- animation: none;
-}
-.pkt_ext_container_detailactive .pkt_ext_detail {
- max-height: 20em;
- opacity: 1;
-}
-.pkt_ext_container_finalstate .pkt_ext_edit_msg,
-.pkt_ext_container_finalstate .pkt_ext_tag_detail,
-.pkt_ext_container_finalstate .pkt_ext_suggestedtag_detail,
-.pkt_ext_container_finalstate .pkt_ext_item_actions {
- opacity: 0;
- transition: opacity 0.2s ease-out;
-}
-.pkt_ext_container_finalerrorstate .pkt_ext_edit_msg,
-.pkt_ext_container_finalerrorstate .pkt_ext_tag_detail,
-.pkt_ext_container_finalerrorstate .pkt_ext_suggestedtag_detail,
-.pkt_ext_container_finalerrorstate .pkt_ext_item_actions {
- display: none;
- transition: none;
-}
-.pkt_ext_containersaved h2 {
- background: transparent;
- border: none;
- color: #333;
- display: block;
- float: none;
- font-size: 18px;
- font-weight: normal;
- letter-spacing: normal;
- line-height: 1;
- margin: 19px 0 4px;
- padding: 0;
- position: relative;
- text-align: left;
- text-transform: none;
-}
-@keyframes fade_in_out {
- 0% {
- opacity: 1;
- }
- 50% {
- opacity: 0;
- }
- 100% {
- opacity: 1;
- }
-}
-.pkt_ext_container_finalstate h2 {
- animation: fade_in_out 0.4s ease-out;
-}
-.pkt_ext_container_finalerrorstate h2 {
- animation: none;
- color: #d74345;
-}
-.pkt_ext_containersaved .pkt_ext_errordetail {
- display: none;
- font-size: 12px;
- font-weight: normal;
- left: 6.4em;
- max-width: 21em;
- opacity: 0;
- position: absolute;
- top: 2.7em;
- text-align: left;
- visibility: hidden;
-}
-.pkt_ext_container_finalerrorstate .pkt_ext_errordetail {
- display: block;
- opacity: 1;
- visibility: visible;
-}
-.pkt_ext_containersaved .pkt_ext_logo {
- background: url(../img/pocketlogosolo@1x.png) center center no-repeat;
- display: block;
- float: left;
- height: 40px;
- padding: 1.25em 1em;
- position: relative;
- width: 44px;
-}
-@media (min-resolution: 1.1dppx) {
- .pkt_ext_containersaved .pkt_ext_logo {
- background-image: url(../img/pocketlogosolo@2x.png);
- background-size: 44px 40px;
- }
-}
-.pkt_ext_container_finalerrorstate .pkt_ext_logo {
- background-image: url(../img/pocketerror@1x.png);
- height: 44px;
- width: 44px;
-}
-@media (min-resolution: 1.1dppx) {
- .pkt_ext_container_finalerrorstate .pkt_ext_logo {
- background-image: url(../img/pocketerror@2x.png);
- background-size: 44px 44px;
- }
-}
-.pkt_ext_containersaved .pkt_ext_topdetail {
- float: left;
-}
-.pkt_ext_containersaved .pkt_ext_edit_msg {
- box-sizing: border-box;
- display: none;
- font-size: 0.75em;
- left: auto;
- padding: 0 1.4em;
- position: absolute;
- text-align: left;
- top: 8.7em;
- width: 100%;
-}
-.pkt_ext_containersaved .pkt_ext_edit_msg_error {
- color: #d74345;
-}
-.pkt_ext_containersaved .pkt_ext_edit_msg_active {
- display: block;
-}
-.pkt_ext_containersaved .pkt_ext_item_actions {
- background: transparent;
- float: none;
- height: auto;
- margin-bottom: 1em;
- margin-top: 0;
- width: auto;
-}
-.pkt_ext_containersaved .pkt_ext_item_actions_disabled {
- opacity: 0.5;
-}
-.pkt_ext_container_finalstate .pkt_ext_item_actions_disabled {
- opacity: 0;
-}
-.pkt_ext_containersaved .pkt_ext_item_actions ul {
- background: none;
- display: block;
- float: none;
- font-size: 16px;
- height: auto;
- margin: 0;
- padding: 0;
- width: 100%;
-}
-.pkt_ext_containersaved .pkt_ext_item_actions li {
- box-sizing: border-box;
- background: none;
- border: 0;
- float: left;
- list-style: none;
- line-height: 0.8;
- height: auto;
- padding-right: 0.4em;
- width: auto;
-}
-.pkt_ext_containersaved .pkt_ext_item_actions li:before {
- content: none;
-}
-.pkt_ext_containersaved .pkt_ext_item_actions .pkt_ext_actions_separator {
- border-left: 2px solid #777;
- height: 0.75em;
- margin-top: 0.3em;
- padding: 0;
- width: 10px;
-}
-.pkt_ext_containersaved .pkt_ext_item_actions a {
- background: transparent;
- color: #0095dd;
- display: block;
- font-feature-settings: normal;
- font-size: 12px;
- font-weight: normal;
- letter-spacing: normal;
- line-height: inherit;
- height: auto;
- margin: 0;
- padding: 0.5em;
- float: left;
- text-align: left;
- text-decoration: none;
- text-transform: none;
-}
-.pkt_ext_containersaved .pkt_ext_item_actions a:hover {
- color: #008acb;
- text-decoration: underline;
-}
-.pkt_ext_containersaved .pkt_ext_item_actions a:before,
-.pkt_ext_containersaved .pkt_ext_item_actions a:after {
- background: transparent;
- display: none;
-}
-.pkt_ext_containersaved .pkt_ext_item_actions_disabled a {
- cursor: default;
-}
-.pkt_ext_containersaved .pkt_ext_item_actions .pkt_ext_openpocket {
- float: right;
- padding-right: 0.7em;
- text-align: right;
-}
-.pkt_ext_containersaved .pkt_ext_item_actions .pkt_ext_removeitem {
- padding-left: 0;
-}
-.pkt_ext_containersaved .pkt_ext_close {
- background: url(../img/tag_close@1x.png) center center no-repeat;
- color: #333;
- display: block;
- font-size: 0.8em;
- height: 10px;
- right: 0.5em;
- overflow: hidden;
- position: absolute;
- text-align: center;
- text-indent: -9999px;
- top: -1em;
- width: 10px;
-}
-@media (min-resolution: 1.1dppx) {
- .pkt_ext_containersaved .pkt_ext_close {
- background-image: url(../img/tag_close@2x.png);
- background-size: 8px 8px;
- }
-}
-.pkt_ext_containersaved .pkt_ext_close:hover {
- color: #000;
- text-decoration: none;
-}
-
-/*=Tag entry
---------------------------------------------------------------------------------------- */
-.pkt_ext_containersaved .pkt_ext_tag_detail {
- border: 1px solid #c1c1c1;
- border-radius: 2px;
- font-size: 16px;
- clear: both;
- margin: 1.25em 1em;
- padding: 0;
- display: flex;
-}
-.pkt_ext_containersaved .pkt_ext_tag_error {
- border: none;
-}
-.pkt_ext_containersaved .pkt_ext_tag_input_wrapper {
- box-sizing: border-box;
- flex: 1;
- background-color: #fff;
- border-right: 1px solid #c3c3c3;
- color: #333;
- display: block;
- float: none;
- font-size: 0.875em;
- list-style: none;
- margin: 0;
- overflow: hidden;
- padding: 0.25em 0.5em;
- width: 14em;
- padding-left: 0.5em;
- padding-right: 0.5em;
-}
-.pkt_ext_containersaved .pkt_ext_tag_error .pkt_ext_tag_input_wrapper {
- border: 1px solid #d74345;
-}
-.pkt_ext_containersaved .pkt_ext_tag_input_wrapper .token-input-list {
- display: block;
- left: 0;
- height: 1.7em;
- overflow: hidden;
- position: relative;
- width: 60em;
-}
-.pkt_ext_containersaved .pkt_ext_tag_input_wrapper .token-input-list,
-.pkt_ext_containersaved .pkt_ext_tag_input_wrapper li {
- font-size: 14px;
-}
-.pkt_ext_containersaved .pkt_ext_tag_input_wrapper li {
- height: auto;
- width: auto;
-}
-.pkt_ext_containersaved .pkt_ext_tag_input_wrapper li:before {
- content: none;
-}
-.pkt_ext_containersaved .pkt_ext_tag_input_wrapper input {
- border: 0;
- box-shadow: none;
- background-color: #fff;
- color: #333;
- font-size: 14px;
- float: left;
- line-height: normal;
- height: auto;
- min-height: 0;
- min-width: 5em;
- padding: 3px 2px 1px;
- text-transform: none;
-}
-.pkt_ext_containersaved .pkt_ext_tag_input_wrapper input::placeholder {
- color: #a9a9a9;
- letter-spacing: normal;
- text-transform: none;
-}
-.pkt_ext_containersaved .input_disabled {
- cursor: default;
- opacity: 0.5;
-}
-.pkt_ext_containersaved .pkt_ext_btn {
- box-sizing: border-box;
- color: #333;
- float: none;
- font-size: 0.875em;
- font-size: 14px;
- letter-spacing: normal;
- height: 2.2em;
- min-width: 4em;
- padding: 0.5em 0;
- text-decoration: none;
- text-transform: none;
- width: auto;
-}
-.pkt_ext_containersaved .pkt_ext_btn:hover {
- background-color: #ebebeb;
-}
-.pkt_ext_containersaved .pkt_ext_btn:active {
- background-color: #dadada;
-}
-.pkt_ext_containersaved .pkt_ext_btn_disabled,
-.pkt_ext_containersaved .pkt_ext_btn_disabled:hover,
-.pkt_ext_containersaved .pkt_ext_btn_disabled:active {
- background-color: transparent;
- cursor: default;
- opacity: 0.4;
-}
-.pkt_ext_containersaved .pkt_ext_tag_error .pkt_ext_btn {
- border: 1px solid #c3c3c3;
- border-width: 1px 1px 1px 0;
- height: 2.35em;
-}
-.pkt_ext_containersaved .autocomplete-suggestions {
- margin-top: 2.2em;
-}
-
-/*=Recent/suggested tags
---------------------------------------------------------------------------------------- */
-.pkt_ext_containersaved .pkt_ext_suggestedtag_detail,
-.pkt_ext_containersaved .pkt_ext_suggestedtag_detailshown {
- border-top: 1px solid #c1c1c1;
- bottom: 0;
- box-sizing: border-box;
- background: #ebebeb;
- clear: both;
- left: 0;
- opacity: 0;
- min-height: 110px;
- position: fixed;
- visibility: hidden;
- width: 100%;
-}
-.pkt_ext_container_detailactive .pkt_ext_suggestedtag_detail,
-.pkt_ext_containersaved .pkt_ext_suggestedtag_detailshown {
- opacity: 1;
- visibility: visible;
-}
-.pkt_ext_containersaved .pkt_ext_suggestedtag_detailshown {
- padding: 4px 0;
-}
-.pkt_ext_container_finalstate .pkt_ext_suggestedtag_detail {
- opacity: 0;
- visibility: hidden;
-}
-.pkt_ext_containersaved
-.pkt_ext_containersaved .pkt_ext_recenttag_detail h4,
-.pkt_ext_containersaved .pkt_ext_suggestedtag_detail h4 {
- color: #333;
- font-size: 0.8125em;
- font-size: 13px;
- font-weight: normal;
- font-style: normal;
- letter-spacing: normal;
- margin: 0.5em 0;
- text-align: left;
- text-transform: none;
-}
-.pkt_ext_containersaved .pkt_ext_recenttag_detail .pkt_ext_loadingspinner,
-.pkt_ext_containersaved .pkt_ext_suggestedtag_detail .pkt_ext_loadingspinner {
- display: none;
- position: absolute;
-}
-.pkt_ext_containersaved .pkt_ext_recenttag_detail_loading .pkt_ext_loadingspinner,
-.pkt_ext_containersaved .pkt_ext_suggestedtag_detail_loading .pkt_ext_loadingspinner {
- display: block;
- font-size: 6px;
- left: 48%;
-}
-.pkt_ext_containersaved .pkt_ext_recenttag_detail ul,
-.pkt_ext_containersaved .pkt_ext_suggestedtag_detail ul {
- display: block;
- margin: 0;
- height: 2em;
- overflow: hidden;
- padding: 2px 0 0 0;
-}
-.pkt_ext_containersaved .pkt_ext_suggestedtag_detail ul {
- height: auto;
- margin: 0;
- max-height: 4em;
- padding-top: 6px;
-}
-.pkt_ext_containersaved .pkt_ext_recenttag_detail li,
-.pkt_ext_containersaved .pkt_ext_suggestedtag_detail li {
- background: none;
- float: left;
- height: inherit;
- line-height: 1.5;
- list-style: none;
- margin-bottom: 0.5em;
- width: inherit;
-}
-.pkt_ext_containersaved .pkt_ext_recenttag_detail li:before,
-.pkt_ext_containersaved .pkt_ext_suggestedtag_detail li:before {
- content: none;
-}
-.pkt_ext_containersaved .pkt_ext_recenttag_detail .recenttag_msg,
-.pkt_ext_containersaved .pkt_ext_suggestedtag_detail .suggestedtag_msg {
- color: #333;
- font-size: 0.8125em;
- line-height: 1.2;
- left: auto;
- position: absolute;
- text-align: left;
- top: 2em;
-}
-.pkt_ext_containersaved .pkt_ext_suggestedtag_detail .suggestedtag_msg {
- margin-right: 1.3em;
-}
-.pkt_ext_containersaved .token_tag {
- border-radius: 4px;
- background: #f7f7f7;
- border: 1px solid #c3c3c3;
- color: #333;
- font-size: 0.875em;
- font-size: 14px;
- font-weight: normal;
- letter-spacing: normal;
- margin-right: 0.5em;
- padding: 0.125em 0.625em;
- text-decoration: none;
- text-transform: none;
-}
-.pkt_ext_containersaved .token_tag:hover {
- background-color: #008acb;
- border-color: #008acb;
- color: #fff;
- text-decoration: none;
-}
-.pkt_ext_containersaved .token_tag:before,
-.pkt_ext_containersaved .token_tag:after {
- content: none;
-}
-.pkt_ext_containersaved .token_tag:hover span {
- background-image: url(../img/tag_closeactive@1x.png);
-}
-@media (min-resolution: 1.1dppx) {
- .pkt_ext_containersaved .token_tag:hover span {
- background-image: url(../img/tag_closeactive@2x.png);
- background-size: 8px 8px;
- }
-}
-.pkt_ext_containersaved .pkt_ext_recenttag_detail_disabled .token_tag,
-.pkt_ext_containersaved .pkt_ext_recenttag_detail_disabled .token_tag:hover,
-.pkt_ext_containersaved .pkt_ext_suggestedtag_detail_disabled .token_tag,
-.pkt_ext_containersaved .pkt_ext_suggestedtag_detail_disabled .token_tag:hover {
- background-color: #f7f7f7;
- cursor: default;
- opacity: 0.5;
-}
-.pkt_ext_containersaved .token_tag_inactive {
- display: none;
-}
-
-/*=Premium upsell
---------------------------------------------------------------------------------------- */
-.pkt_ext_detail .pkt_ext_premupsell {
- background-color: #50bbb6;
- display: block;
- padding: 1.5em 0;
- text-align: center;
-}
-.pkt_ext_premupsell h4 {
- color: #fff;
- font-size: 1em;
- margin-bottom: 1em;
-}
-.pkt_ext_premupsell a {
- color: #28605d;
- border-bottom: 1px solid #47a7a3;
- font-weight: normal;
-}
-.pkt_ext_premupsell a:hover {
- color: #14302f;
-}
-
-/*=Token input/autocomplete
---------------------------------------------------------------------------------------- */
-.token-input-dropdown-tag {
- border-radius: 4px;
- box-sizing: border-box;
- background: #fff;
- border: 1px solid #cdcdcd;
- margin-top: 0.5em;
- left: 0 !important;
- overflow-y: auto;
- top: 1.9em !important;
- z-index: 9000;
-}
-.token-input-dropdown-tag ul {
- height: inherit;
- max-height: 115px;
- margin: 0;
- overflow: auto;
- padding: 0.5em 0;
-}
-.token-input-dropdown-tag ul li {
- background: none;
- color: #333;
- font-weight: normal;
- font-size: 1em;
- float: none;
- height: inherit;
- letter-spacing: normal;
- list-style: none;
- padding: 0.75em;
- text-align: left;
- text-transform: none;
- width: inherit;
-}
-.token-input-dropdown-tag ul li:before {
- content: none;
-}
-.token-input-dropdown ul li.token-input-selected-dropdown-item {
- background-color: #008acb;
- color: #fff;
-}
-.token-input-list {
- list-style: none;
- margin: 0;
- padding: 0;
-}
-.token-input-list li {
- text-align: left;
- list-style: none;
-}
-.token-input-list li input {
- border: 0;
- background-color: white;
-}
-.pkt_ext_containersaved .token-input-token {
- background: none;
- border-radius: 4px;
- border: 1px solid #c3c3c3;
- overflow: hidden;
- margin: 0;
- padding: 0 8px;
- background-color: #f7f7f7;
- color: #000;
- font-weight: normal;
- cursor: default;
- line-height: 1.5;
- display: block;
- width: auto;
- margin: 0 0.2em;
- float: left;
-}
-.pkt_ext_containersaved .pkt_ext_tag_input_wrapper_disabled {
- position: relative;
-}
-.pkt_ext_containersaved .pkt_ext_tag_input_wrapper_disabled input {
- opacity: 0.5;
-}
-.pkt_ext_containersaved .pkt_ext_tag_input_wrapper_disabled .token-input-list {
- opacity: 0.5;
-}
-.pkt_ext_containersaved .pkt_ext_tag_input_wrapper_disabled .pkt_ext_tag_input_blocker {
- height: 100%;
- left: 0;
- position: absolute;
- top: 0;
- width: 100%;
- z-index: 5;
-}
-.pkt_ext_containersaved .token-input-token p {
- display: inline-block;
- font-size: 14px;
- font-weight: normal;
- line-height: inherit;
- letter-spacing: normal;
- padding: 0;
- margin: 0;
- text-transform: none;
- vertical-align: top;
- width: auto;
-}
-.pkt_ext_containersaved .token-input-token p:before {
- content: none;
- width: 0;
-}
-.pkt_ext_containersaved .token-input-token span {
- background: url(../img/tag_close@1x.png) center center no-repeat;
- cursor: pointer;
- display: inline-block;
- height: 8px;
- margin: 0 0 0 8px;
- overflow: hidden;
- width: 8px;
- text-indent: -99px;
-}
-@media (min-resolution: 1.1dppx) {
- .pkt_ext_containersaved .token-input-token span {
- background-image: url(../img/tag_close@2x.png);
- background-size: 8px 8px;
- }
-}
-.pkt_ext_containersaved .token-input-selected-token {
- background-color: #008acb;
- border-color: #008acb;
- color: #fff;
-}
-.pkt_ext_containersaved .token-input-selected-token span {
- background-image: url(../img/tag_closeactive@1x.png);
-}
-@media (min-resolution: 1.1dppx) {
- .pkt_ext_containersaved .token-input-selected-token span {
- background-image: url(../img/tag_closeactive@2x.png);
- background-size: 8px 8px;
- }
-}
-.pkt_ext_containersaved .pkt_ext_tag_input_wrapper_disabled .token-input-selected-token {
- background-color: #f7f7f7;
-}
-.pkt_ext_containersaved .pkt_ext_tag_input_wrapper_disabled .token-input-selected-token span {
- color: #bbb;
-}
-
-/*=Overflow mode
---------------------------------------------------------------------------------------- */
-.pkt_ext_saved_overflow .pkt_ext_logo {
- float: none;
- margin: 0.5em auto 0;
-}
-.pkt_ext_saved_overflow .pkt_ext_initload {
- top: -8px;
-}
-.pkt_ext_saved_overflow .pkt_ext_loadingspinner {
- top: 10em;
-}
-.pkt_ext_saved_overflow .pkt_ext_topdetail {
- float: none;
- margin: 0 auto;
- padding: 0 1em;
-}
-.pkt_ext_saved_overflow h2 {
- margin-bottom: 0.5em;
- margin-top: 0;
- text-align: center;
-}
-.pkt_ext_saved_overflow .pkt_ext_item_actions ul {
- display: inline-block;
- width: auto;
-}
-.pkt_ext_saved_overflow .pkt_ext_item_actions li {
- float: none;
- padding-left: 1em;
- padding-right: 1em;
- text-align: center;
-}
-.pkt_ext_saved_overflow .pkt_ext_item_actions .pkt_ext_removeitem,
-.pkt_ext_saved_overflow .pkt_ext_item_actions .pkt_ext_openpocket {
- float: none;
- text-align: center;
- padding-left: 0;
- padding-right: 0;
-}
-.pkt_ext_saved_overflow .pkt_ext_item_actions .pkt_ext_actions_separator {
- display: none;
-}
-.pkt_ext_saved_overflow .pkt_ext_tag_detail {
- margin-top: 0;
-}
-.pkt_ext_saved_overflow .pkt_ext_suggestedtag_detail,
-.pkt_ext_saved_overflow .pkt_ext_suggestedtag_detailshown {
- top: 14.75em;
-}
-.pkt_ext_saved_overflow .pkt_ext_edit_msg {
- top: 16em;
-}
-.pkt_ext_container_finalerrorstate.pkt_ext_saved_overflow .pkt_ext_errordetail {
- box-sizing: border-box;
- left: 0;
- padding-left: 1em;
- padding-right: 1em;
- text-align: center;
- top: 8.3em;
- width: 100%;
-}
-
-/*=Language overrides
---------------------------------------------------------------------------------------- */
-.pkt_ext_saved_es .pkt_ext_btn {
- min-width: 5em;
-}
-.pkt_ext_saved_de .pkt_ext_btn,
-.pkt_ext_saved_ru .pkt_ext_btn {
- min-width: 6em;
-}
diff --git a/browser/extensions/pocket/content/panels/css/signup.css b/browser/extensions/pocket/content/panels/css/signup.css
deleted file mode 100644
index 5c428a29b5..0000000000
--- a/browser/extensions/pocket/content/panels/css/signup.css
+++ /dev/null
@@ -1,424 +0,0 @@
-/* signup.css
- *
- * Description:
- * With base elements out of the way, this sets all custom styling for the extension.
- *
- * Contents:
- * Global
- * Core detail
- * Core detail - storyboard
- * Buttons
- * Overflow mode
- * Language overrides
- */
-
-/*=Global
---------------------------------------------------------------------------------------- */
-.pkt_ext_containersignup {
- background-color: #ebebeb;
- color: #333;
- display: block;
- font-size: 16px;
- font-family: "FiraSans", "Helvetica Neue", Helvetica, Arial, sans-serif;
- margin: 0;
- padding: 0;
- position: relative;
- text-align: center;
-}
-.pkt_ext_containersignup_inactive {
- animation: pkt_ext_hide 0.3s ease-out;
- opacity: 0;
- visibility: hidden;
-}
-.pkt_ext_cf:after {
- content: " ";
- display: table;
- clear: both;
-}
-@keyframes pkt_ext_hide {
- 0% {
- opacity: 1;
- visibility: visible;
- }
- 99% {
- opacity: 0;
- visibility: visible;
- }
- 100% {
- opacity: 0;
- visibility: hidden;
- }
-}
-
-/*=Core detail
---------------------------------------------------------------------------------------- */
-.pkt_ext_containersignup p {
- font-size: 14px;
- color: #333;
- font-family: "FiraSans", "Helvetica Neue", Helvetica, Arial, sans-serif;
- line-height: 1.3;
- margin: 0 auto 1.5em;
- max-width: 260px;
-}
-.pkt_ext_containersignup a {
- color: #4c8fd0;
-}
-.pkt_ext_containersignup a:hover {
- color: #3076b9;
-}
-.pkt_ext_containersignup .pkt_ext_introdetail {
- background-color: #fbfbfb;
- border: 1px solid #c1c1c1;
- border-width: 0 0 1px;
-}
-.pkt_ext_containersignup .pkt_ext_logo {
- background: url(../img/pocketlogo@1x.png) center bottom no-repeat;
- display: block;
- height: 32px;
- margin: 0 auto 15px;
- padding-top: 25px;
- position: relative;
- text-indent: -9999px;
- width: 123px;
-}
-@media (min-resolution: 1.1dppx) {
- .pkt_ext_containersignup .pkt_ext_logo {
- background-image: url(../img/pocketlogo@2x.png);
- background-size: 123px 32px;
- }
-}
-.pkt_ext_containersignup .pkt_ext_introimg {
- background: url(../img/pocketsignup_hero@1x.png) center center no-repeat;
- display: block;
- height: 125px;
- margin: 0 auto;
- position: relative;
- text-indent: -9999px;
- width: 255px;
-}
-@media (min-resolution: 1.1dppx) {
- .pkt_ext_containersignup .pkt_ext_introimg {
- background-image: url(../img/pocketsignup_hero@2x.png);
- background-size: 255px 125px;
- }
-}
-.pkt_ext_containersignup .pkt_ext_tagline {
- margin-bottom: 0.5em;
-}
-.pkt_ext_containersignup .pkt_ext_learnmore {
- font-size: 12px;
-}
-.pkt_ext_containersignup .pkt_ext_learnmoreinactive {
- visibility: hidden;
-}
-.pkt_ext_signupdetail h4 {
- font-size: 12px;
- font-weight: normal;
-}
-.pkt_ext_signupdetail .btn-container {
- position: relative;
- margin-bottom: 0.8em;
-}
-.pkt_ext_containersignup .ff_signuphelp {
- background: url(../img/signup_help@1x.png) center center no-repeat;
- display: block;
- height: 18px;
- margin-top: -9px;
- right: -15px;
- position: absolute;
- text-indent: -9999px;
- width: 18px;
- top: 50%;
-}
-@media (min-resolution: 1.1dppx) {
- .pkt_ext_containersignup .ff_signuphelp {
- background-image: url(../img/signup_help@2x.png);
- background-size: 18px 18px;
- }
-}
-.pkt_ext_containersignup .alreadyhave {
- font-size: 12px;
- max-width: 320px;
- margin-top: 15px;
-}
-.pkt_ext_containersignup .tryitnowspace {
- margin-top: 22px;
-}
-.pkt_ext_signupdetail p.pkt_ext_tos {
- color: #777;
- font-size: 10px;
- line-height: 1.5;
- margin-top: 17px;
- padding-top: 0;
- max-width: 190px;
-}
-
-/*=Core detail - storyboard
---------------------------------------------------------------------------------------- */
-.pkt_ext_introstory {
- align-items: center;
- display: flex;
- padding: 20px;
-}
-.pkt_ext_introstory:after {
- clear: both;
- content: "";
- display: table;
-}
-.pkt_ext_introstory p {
- margin-bottom: 0;
- text-align: left;
-}
-.pkt_ext_introstoryone {
- padding: 20px 18px 15px 20px;
-}
-.pkt_ext_introstorytwo {
- padding: 3px 0 0 20px;
-}
-.pkt_ext_introstorytwo .pkt_ext_tagline {
- margin-bottom: 1.5em;
-}
-.pkt_ext_introstory_text {
- flex: 1;
-}
-.pkt_ext_introstoryone_img,
-.pkt_ext_introstorytwo_img {
- display: block;
- overflow: hidden;
- position: relative;
- text-indent: -999px;
-}
-.pkt_ext_introstoryone_img {
- background: url(../img/pocketsignup_button@1x.png) center right no-repeat;
- height: 82px;
- padding: 0 0 0 0.7em;
- width: 82px;
-}
-@media (min-resolution: 1.1dppx) {
- .pkt_ext_introstoryone_img {
- background-image: url(../img/pocketsignup_button@2x.png);
- background-size: 82px 82px;
- }
-}
-.pkt_ext_introstorytwo_img {
- background: url(../img/pocketsignup_devices@1x.png) bottom right no-repeat;
- height: 110px;
- padding: 1em 0 0 0.7em;
- width: 124px;
-}
-@media (min-resolution: 1.1dppx) {
- .pkt_ext_introstorytwo_img {
- background-image: url(../img/pocketsignup_devices@2x.png);
- background-size: 124px 110px;
- }
-}
-.pkt_ext_introstorydivider {
- border-top: 1px solid #c1c1c1;
- height: 1px;
- margin: 0 auto;
- width: 125px;
-}
-
-/*=Buttons
---------------------------------------------------------------------------------------- */
-.pkt_ext_containersignup .btn {
- background-color: #0096dd;
- border: 1px solid #0095dd;
- border-radius: 2px;
- color: #fff;
- display: inline-block;
- font-family: "FiraSans", "Helvetica Neue", Helvetica, Arial, sans-serif;
- font-size: 16px;
- font-weight: normal;
- line-height: 1;
- margin: 0;
- padding: 11px 45px;
- text-align: center;
- text-decoration: none;
- text-shadow: 0 -1px 0 rgba(142,4,17,0.5);
- transition: background-color 0.1s linear;
- width: auto;
-}
-.pkt_ext_containersignup .btn-secondary {
- background-color: #fbfbfb;
- border-color: #c1c1c1;
- color: #444;
- text-shadow: 0 1px 0 rgba(255,255,255,0.5);
-}
-.pkt_ext_containersignup .btn-small {
- padding: 6px 20px;
-}
-.pkt_ext_containersignup .btn-mini {
- font-size: 14px;
- padding: 5px 15px 4px;
-}
-.pkt_ext_containersignup .btn:hover {
- background-color: #008acb;
- color: #fff;
- text-decoration: none;
-}
-.pkt_ext_containersignup .btn-secondary:hover,
-.pkt_ext_containersignup .btn-important:hover {
- background-color: #f6f6f6;
- color: #222;
-}
-.pkt_ext_containersignup .btn-disabled {
- background-image: none;
- color: #ccc;
- color: rgba(255,255,255,0.6);
- cursor: default;
- opacity: 0.9;
-}
-.pkt_ext_containersignup .signup-btn-firefox,
-.pkt_ext_containersignup .signup-btn-tryitnow,
-.pkt_ext_containersignup .signup-btn-email,
-.pkt_ext_containersignup .signupinterim-btn-login,
-.pkt_ext_containersignup .signupinterim-btn-signup,
-.pkt_ext_containersignup .forgot-btn-submit,
-.pkt_ext_containersignup .forgotreset-btn-change {
- min-width: 12.125em;
- padding: 0.8em 1.1875em;
- box-sizing: content-box;
-}
-.pkt_ext_containersignup .signup-btn-email {
- position: relative;
- z-index: 10;
-}
-.pkt_ext_containersignup .signup-btn-tryitnow,
-.pkt_ext_containersignup .signup-btn-firefox {
- min-width: 14.5em;
- position: relative;
- padding: 0;
-}
-.pkt_ext_containersignup .signup-btn-tryitnow{
- margin-top: 25px;
-}
-.pkt_ext_containersignup .signup-btn-firefox .logo {
- background: url(../img/signup_firefoxlogo@1x.png) center center no-repeat;
- height: 2.6em;
- left: 10px;
- margin: 0;
- padding: 0;
- width: 22px;
- position: absolute;
-}
-@media (min-resolution: 1.1dppx) {
- .pkt_ext_containersignup .signup-btn-firefox .logo {
- background-image: url(../img/signup_firefoxlogo@2x.png);
- background-size: 22px 22px;
- }
-}
-.pkt_ext_containersignup .forgotreset-btn-change {
- margin-bottom: 2em;
-}
-.pkt_ext_containersignup .signup-btn-tryitnow .text,
-.pkt_ext_containersignup .signup-btn-firefox .text {
- display: inline-block;
- padding: 0.8em 1.625em;
- position: relative;
- text-shadow: none;
- white-space: nowrap;
-}
-.pkt_ext_containersignup .signup-btn-tryitnow .text,
-.pkt_ext_containersignup .signup-btn-firefox .text {
- color: #fff;
-}
-.pkt_ext_containersignup .btn-disabled .text {
- color: #ccc;
- color: rgba(255,255,255,0.6);
-}
-
-/*=Overflow mode
---------------------------------------------------------------------------------------- */
-.pkt_ext_signup_overflow .pkt_ext_tagline {
- margin-bottom: 1em;
- padding: 0 1em;
-}
-.pkt_ext_signup_overflow .pkt_ext_introimg {
- background-size: 200px 98px;
- height: 98px;
- width: 200px;
-}
-.pkt_ext_signup_overflow .signup-btn-firefox,
-.pkt_ext_containersignup .signup-btn-tryitnow,
-.pkt_ext_signup_overflow .signup-btn-email {
- font-size: 14px;
- min-width: 12.6em;
- padding-left: 0.75em;
- padding-right: 0.75em;
-}
-.pkt_ext_signup_overflow .signup-btn-tryitnow .text,
-.pkt_ext_signup_overflow .signup-btn-firefox .text {
- padding-left: 0;
- padding-right: 0;
-}
-
-/*=Language overrides
---------------------------------------------------------------------------------------- */
-.pkt_ext_signup_de .pkt_ext_introstoryone_img {
- margin-right: -5px;
- padding-left: 0;
-}
-.pkt_ext_signup_de .pkt_ext_introstorytwo .pkt_ext_tagline,
-.pkt_ext_signup_es .pkt_ext_introstorytwo .pkt_ext_tagline,
-.pkt_ext_signup_ja .pkt_ext_introstorytwo .pkt_ext_tagline,
-.pkt_ext_signup_ru .pkt_ext_introstorytwo .pkt_ext_tagline {
- margin-bottom: 0.5em;
-}
-.pkt_ext_signup_de .signup-btn-firefox .text,
-.pkt_ext_signup_de .signup-btn-tryitnow .text,
-.pkt_ext_signup_de .signup-btn-email,
-.pkt_ext_signup_es .pkt_ext_signupdetail_hero .signup-btn-firefox .text,
-.pkt_ext_signup_es .pkt_ext_signupdetail_hero .signup-btn-email,
-.pkt_ext_signup_ja .signup-btn-firefox .text,
-.pkt_ext_signup_ja .signup-btn-tryitnow .text,
-.pkt_ext_signup_ja .signup-btn-email,
-.pkt_ext_signup_ru .signup-btn-firefox .text,
-.pkt_ext_signup_ru .signup-btn-tryitnow .text,
-.pkt_ext_signup_ru .signup-btn-email {
- font-size: 15px;
-}
-.pkt_ext_signup_ja .signup-btn-firefox .text,
-.pkt_ext_signup_ja .signup-btn-tryitnow .text,
-.pkt_ext_signup_ru .signup-btn-firefox .text,
-.pkt_ext_signup_ru .signup-btn-tryitnow .text {
- left: 15px;
-}
-.pkt_ext_signup_de .signup-btn-firefox .logo,
-.pkt_ext_signup_es .pkt_ext_signupdetail_hero .signup-btn-firefox .logo,
-.pkt_ext_signup_ja .signup-btn-firefox .logo,
-.pkt_ext_signup_ru .signup-btn-firefox .logo {
- height: 2.4em;
-}
-@media (min-resolution: 1.1dppx) {
- .pkt_ext_signup_de .signup-btn-firefox .logo,
- .pkt_ext_signup_es .pkt_ext_signupdetail_hero .signup-btn-firefox .logo,
- .pkt_ext_signup_ja .signup-btn-firefox .logo,
- .pkt_ext_signup_ru .signup-btn-firefox .logo {
- height: 2.5em;
- }
-}
-.pkt_ext_signup_de .signup-btn-email,
-.pkt_ext_signup_es .pkt_ext_signupdetail_hero .signup-btn-email,
-.pkt_ext_signup_ja .signup-btn-email,
-.pkt_ext_signup_ru .signup-btn-email {
- min-width: 13em;
- padding: 0.8533em 1.2667em;
-}
-.pkt_ext_signup_de .pkt_ext_logo,
-.pkt_ext_signup_es .pkt_ext_logo,
-.pkt_ext_signup_ru .pkt_ext_logo {
- padding-top: 15px;
-}
-.pkt_ext_signup_de .pkt_ext_introdetailhero .pkt_ext_tagline,
-.pkt_ext_signup_es .pkt_ext_introdetailhero .pkt_ext_tagline,
-.pkt_ext_signup_ja .pkt_ext_introdetailhero .pkt_ext_tagline,
-.pkt_ext_signup_ru .pkt_ext_introdetailhero .pkt_ext_tagline {
- font-size: 13px;
-}
-.pkt_ext_signup_overflow.pkt_ext_signup_de .signup-btn-firefox .logo,
-.pkt_ext_signup_overflow.pkt_ext_signup_es .signup-btn-firefox .logo,
-.pkt_ext_signup_overflow.pkt_ext_signup_ja .signup-btn-firefox .logo,
-.pkt_ext_signup_overflow.pkt_ext_signup_ru .signup-btn-firefox .logo {
- display: none;
-}
diff --git a/browser/extensions/pocket/content/panels/fonts/FiraSans-Regular.woff b/browser/extensions/pocket/content/panels/fonts/FiraSans-Regular.woff
deleted file mode 100644
index f466cdda9b..0000000000
--- a/browser/extensions/pocket/content/panels/fonts/FiraSans-Regular.woff
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/content/panels/img/pocket.svg b/browser/extensions/pocket/content/panels/img/pocket.svg
deleted file mode 100644
index d93fd6a150..0000000000
--- a/browser/extensions/pocket/content/panels/img/pocket.svg
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
- - License, v. 2.0. If a copy of the MPL was not distributed with this
- - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24">
- <style>
- use:not(:target) {
- display: none;
- }
- use {
- fill: #808080;
- }
- use[id$="-added"] {
- fill: #ee4056;
- }
- </style>
- <defs>
- <path id="pocket-mark-shape" d="M21.901,4.204C21.642,3.484,20.956,3,20.196,3h-0.01h-1.721H3.814C3.067,3,2.385,3.474,2.119,4.179 C2.04,4.388,2,4.606,2,4.828v6.082l0.069,1.21c0.29,2.751,1.707,5.155,3.899,6.832c0.039,0.03,0.079,0.06,0.119,0.089l0.025,0.018 c1.175,0.866,2.491,1.452,3.91,1.741C10.677,20.932,11.347,21,12.013,21c0.615,0,1.232-0.057,1.839-0.171 c0.073-0.014,0.145-0.028,0.219-0.044c0.02-0.004,0.042-0.012,0.064-0.023c1.359-0.299,2.621-0.87,3.753-1.704l0.025-0.018 c0.04-0.029,0.08-0.059,0.119-0.089c2.192-1.677,3.609-4.08,3.898-6.832L22,10.91V4.828C22,4.618,21.975,4.409,21.901,4.204z M17.667,10.539l-4.704,4.547c-0.266,0.256-0.608,0.385-0.949,0.385c-0.342,0-0.684-0.129-0.949-0.385l-4.705-4.547 c-0.547-0.528-0.565-1.403-0.04-1.954c0.524-0.551,1.392-0.569,1.939-0.041l3.756,3.63l3.755-3.63 c0.547-0.528,1.415-0.51,1.939,0.04C18.231,9.136,18.213,10.011,17.667,10.539z"/>
- </defs>
- <use id="pocket-mark" xlink:href="#pocket-mark-shape"/>
- <use id="pocket-mark-added" xlink:href="#pocket-mark-shape"/>
-</svg>
diff --git a/browser/extensions/pocket/content/panels/img/pocketerror@1x.png b/browser/extensions/pocket/content/panels/img/pocketerror@1x.png
deleted file mode 100644
index e2b4d04ded..0000000000
--- a/browser/extensions/pocket/content/panels/img/pocketerror@1x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/content/panels/img/pocketerror@2x.png b/browser/extensions/pocket/content/panels/img/pocketerror@2x.png
deleted file mode 100644
index d501503b0e..0000000000
--- a/browser/extensions/pocket/content/panels/img/pocketerror@2x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/content/panels/img/pocketlogo@1x.png b/browser/extensions/pocket/content/panels/img/pocketlogo@1x.png
deleted file mode 100644
index 62b3db310a..0000000000
--- a/browser/extensions/pocket/content/panels/img/pocketlogo@1x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/content/panels/img/pocketlogo@2x.png b/browser/extensions/pocket/content/panels/img/pocketlogo@2x.png
deleted file mode 100644
index b0e80bff3f..0000000000
--- a/browser/extensions/pocket/content/panels/img/pocketlogo@2x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/content/panels/img/pocketlogosolo@1x.png b/browser/extensions/pocket/content/panels/img/pocketlogosolo@1x.png
deleted file mode 100644
index 77dc16f8c9..0000000000
--- a/browser/extensions/pocket/content/panels/img/pocketlogosolo@1x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/content/panels/img/pocketlogosolo@2x.png b/browser/extensions/pocket/content/panels/img/pocketlogosolo@2x.png
deleted file mode 100644
index c467c5a296..0000000000
--- a/browser/extensions/pocket/content/panels/img/pocketlogosolo@2x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/content/panels/img/pocketmenuitem16.png b/browser/extensions/pocket/content/panels/img/pocketmenuitem16.png
deleted file mode 100644
index b52db6abf6..0000000000
--- a/browser/extensions/pocket/content/panels/img/pocketmenuitem16.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/content/panels/img/pocketmenuitem16@2x.png b/browser/extensions/pocket/content/panels/img/pocketmenuitem16@2x.png
deleted file mode 100644
index 69aa55b03f..0000000000
--- a/browser/extensions/pocket/content/panels/img/pocketmenuitem16@2x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/content/panels/img/pocketsignup_button@1x.png b/browser/extensions/pocket/content/panels/img/pocketsignup_button@1x.png
deleted file mode 100644
index 12326fae38..0000000000
--- a/browser/extensions/pocket/content/panels/img/pocketsignup_button@1x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/content/panels/img/pocketsignup_button@2x.png b/browser/extensions/pocket/content/panels/img/pocketsignup_button@2x.png
deleted file mode 100644
index 5bdebc5e9f..0000000000
--- a/browser/extensions/pocket/content/panels/img/pocketsignup_button@2x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/content/panels/img/pocketsignup_devices@1x.png b/browser/extensions/pocket/content/panels/img/pocketsignup_devices@1x.png
deleted file mode 100644
index c4a7ad6779..0000000000
--- a/browser/extensions/pocket/content/panels/img/pocketsignup_devices@1x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/content/panels/img/pocketsignup_devices@2x.png b/browser/extensions/pocket/content/panels/img/pocketsignup_devices@2x.png
deleted file mode 100644
index 157304c3e3..0000000000
--- a/browser/extensions/pocket/content/panels/img/pocketsignup_devices@2x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/content/panels/img/pocketsignup_hero@1x.png b/browser/extensions/pocket/content/panels/img/pocketsignup_hero@1x.png
deleted file mode 100644
index 80c5bd4864..0000000000
--- a/browser/extensions/pocket/content/panels/img/pocketsignup_hero@1x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/content/panels/img/pocketsignup_hero@2x.png b/browser/extensions/pocket/content/panels/img/pocketsignup_hero@2x.png
deleted file mode 100644
index 36d0add61d..0000000000
--- a/browser/extensions/pocket/content/panels/img/pocketsignup_hero@2x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/content/panels/img/signup_firefoxlogo@1x.png b/browser/extensions/pocket/content/panels/img/signup_firefoxlogo@1x.png
deleted file mode 100644
index 52cbe052c0..0000000000
--- a/browser/extensions/pocket/content/panels/img/signup_firefoxlogo@1x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/content/panels/img/signup_firefoxlogo@2x.png b/browser/extensions/pocket/content/panels/img/signup_firefoxlogo@2x.png
deleted file mode 100644
index cd218805e8..0000000000
--- a/browser/extensions/pocket/content/panels/img/signup_firefoxlogo@2x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/content/panels/img/signup_help@1x.png b/browser/extensions/pocket/content/panels/img/signup_help@1x.png
deleted file mode 100644
index 5019025c0b..0000000000
--- a/browser/extensions/pocket/content/panels/img/signup_help@1x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/content/panels/img/signup_help@2x.png b/browser/extensions/pocket/content/panels/img/signup_help@2x.png
deleted file mode 100644
index 6714bb3bcf..0000000000
--- a/browser/extensions/pocket/content/panels/img/signup_help@2x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/content/panels/img/signup_or@1x.png b/browser/extensions/pocket/content/panels/img/signup_or@1x.png
deleted file mode 100644
index 318cea0f6f..0000000000
--- a/browser/extensions/pocket/content/panels/img/signup_or@1x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/content/panels/img/signup_or@2x.png b/browser/extensions/pocket/content/panels/img/signup_or@2x.png
deleted file mode 100644
index 837f1814a3..0000000000
--- a/browser/extensions/pocket/content/panels/img/signup_or@2x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/content/panels/img/tag_close@1x.png b/browser/extensions/pocket/content/panels/img/tag_close@1x.png
deleted file mode 100644
index 2dd02ba020..0000000000
--- a/browser/extensions/pocket/content/panels/img/tag_close@1x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/content/panels/img/tag_close@2x.png b/browser/extensions/pocket/content/panels/img/tag_close@2x.png
deleted file mode 100644
index 8bd0eec571..0000000000
--- a/browser/extensions/pocket/content/panels/img/tag_close@2x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/content/panels/img/tag_closeactive@1x.png b/browser/extensions/pocket/content/panels/img/tag_closeactive@1x.png
deleted file mode 100644
index ad42392323..0000000000
--- a/browser/extensions/pocket/content/panels/img/tag_closeactive@1x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/content/panels/img/tag_closeactive@2x.png b/browser/extensions/pocket/content/panels/img/tag_closeactive@2x.png
deleted file mode 100644
index 80c35e3aae..0000000000
--- a/browser/extensions/pocket/content/panels/img/tag_closeactive@2x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/content/panels/js/messages.js b/browser/extensions/pocket/content/panels/js/messages.js
deleted file mode 100644
index ae08c3e73a..0000000000
--- a/browser/extensions/pocket/content/panels/js/messages.js
+++ /dev/null
@@ -1,78 +0,0 @@
-// Documentation of methods used here are at:
-// https://developer.mozilla.org/en-US/Add-ons/Code_snippets/Interaction_between_privileged_and_non-privileged_pages
-
-var pktPanelMessaging = (function() {
-
- function panelIdFromURL(url) {
- var panelId = url.match(/panelId=([\w|\d|\.]*)&?/);
- if (panelId && panelId.length > 1) {
- return panelId[1];
- }
-
- return 0;
- }
-
- function prefixedMessageId(messageId) {
- return 'PKT_' + messageId;
- }
-
- function panelPrefixedMessageId(panelId, messageId) {
- return prefixedMessageId(panelId + '_' + messageId);
- }
-
- function addMessageListener(panelId, messageId, callback) {
- document.addEventListener(panelPrefixedMessageId(panelId, messageId), function(e) {
-
- callback(JSON.parse(e.target.getAttribute("payload"))[0]);
-
- // TODO: Figure out why e.target.parentNode is null
- // e.target.parentNode.removeChild(e.target);
-
- }, false);
-
- }
-
- function removeMessageListener(panelId, messageId, callback) {
- document.removeEventListener(panelPrefixedMessageId(panelId, messageId), callback);
- }
-
- function sendMessage(panelId, messageId, payload, callback) {
- // Payload needs to be an object in format:
- // { panelId: panelId, data: {} }
- var messagePayload = {
- panelId: panelId,
- data: (payload || {})
- };
-
- // Create a callback to listen for a response
- if (callback) {
- var messageResponseId = messageId + "Response";
- var responseListener = function(responsePayload) {
- callback(responsePayload);
- removeMessageListener(panelId, messageResponseId, responseListener);
- }
-
- addMessageListener(panelId, messageResponseId, responseListener);
- }
-
- // Send message
- var element = document.createElement("PKTMessageFromPanelElement");
- element.setAttribute("payload", JSON.stringify([messagePayload]));
- document.documentElement.appendChild(element);
-
- var evt = document.createEvent("Events");
- evt.initEvent(prefixedMessageId(messageId), true, false);
- element.dispatchEvent(evt);
- }
-
-
- /**
- * Public functions
- */
- return {
- panelIdFromURL: panelIdFromURL,
- addMessageListener : addMessageListener,
- removeMessageListener : removeMessageListener,
- sendMessage: sendMessage
- };
-}());
diff --git a/browser/extensions/pocket/content/panels/js/saved.js b/browser/extensions/pocket/content/panels/js/saved.js
deleted file mode 100644
index 3abc8889ab..0000000000
--- a/browser/extensions/pocket/content/panels/js/saved.js
+++ /dev/null
@@ -1,608 +0,0 @@
-/*
-PKT_SAVED_OVERLAY is the view itself and contains all of the methods to manipute the overlay and messaging.
-It does not contain any logic for saving or communication with the extension or server.
-*/
-var PKT_SAVED_OVERLAY = function (options)
-{
- var myself = this;
- this.inited = false;
- this.active = false;
- this.wrapper = null;
- this.pockethost = "getpocket.com";
- this.savedItemId = 0;
- this.savedUrl = '';
- this.premiumStatus = false;
- this.preventCloseTimerCancel = false;
- this.closeValid = true;
- this.mouseInside = false;
- this.autocloseTimer = null;
- this.inoverflowmenu = false;
- this.dictJSON = {};
- this.autocloseTiming = 3500;
- this.autocloseTimingFinalState = 2000;
- this.mouseInside = false;
- this.userTags = [];
- this.cxt_suggested_available = 0;
- this.cxt_entered = 0;
- this.cxt_suggested = 0;
- this.cxt_removed = 0;
- this.justaddedsuggested = false;
- this.fillTagContainer = function(tags, container, tagclass) {
- container.children().remove();
- for (var i = 0; i < tags.length; i++) {
- var newtag = $('<li><a href="#" class="token_tag"></a></li>');
- newtag.find('a').text(tags[i]);
- newtag.addClass(tagclass);
- container.append(newtag);
- this.cxt_suggested_available++;
- }
- };
- this.fillUserTags = function() {
- thePKT_SAVED.sendMessage("getTags", {}, function(resp)
- {
- if (typeof resp == 'object' && typeof resp.tags == 'object')
- {
- myself.userTags = resp.tags;
- }
- });
- };
- this.fillSuggestedTags = function()
- {
- if (!$('.pkt_ext_suggestedtag_detail').length)
- {
- myself.suggestedTagsLoaded = true;
- myself.startCloseTimer();
- return;
- }
-
- thePKT_SAVED.sendMessage("getSuggestedTags",
- {
- url: myself.savedUrl
- }, function(resp)
- {
- $('.pkt_ext_suggestedtag_detail').removeClass('pkt_ext_suggestedtag_detail_loading');
- if (resp.status == 'success')
- {
- var newtags = [];
- for (var i = 0; i < resp.value.suggestedTags.length; i++)
- {
- newtags.push(resp.value.suggestedTags[i].tag);
- }
- myself.suggestedTagsLoaded = true;
- if (!myself.mouseInside) {
- myself.startCloseTimer();
- }
- myself.fillTagContainer(newtags, $('.pkt_ext_suggestedtag_detail ul'), 'token_suggestedtag');
- }
- else if (resp.status == 'error') {
- var msg = $('<p class="suggestedtag_msg">');
- msg.text(resp.error.message);
- $('.pkt_ext_suggestedtag_detail').append(msg);
- this.suggestedTagsLoaded = true;
- if (!myself.mouseInside) {
- myself.startCloseTimer();
- }
- }
- });
- }
- this.initAutoCloseEvents = function() {
- this.wrapper.on('mouseenter', function() {
- myself.mouseInside = true;
- myself.stopCloseTimer();
- });
- this.wrapper.on('mouseleave', function() {
- myself.mouseInside = false;
- myself.startCloseTimer();
- });
- this.wrapper.on('click', function(e) {
- myself.closeValid = false;
- });
- };
- this.startCloseTimer = function(manualtime)
- {
- var settime = manualtime ? manualtime : myself.autocloseTiming;
- if (typeof myself.autocloseTimer == 'number')
- {
- clearTimeout(myself.autocloseTimer);
- }
- myself.autocloseTimer = setTimeout(function()
- {
- if (myself.closeValid || myself.preventCloseTimerCancel)
- {
- myself.preventCloseTimerCancel = false;
- myself.closePopup();
- }
- }, settime);
- };
- this.stopCloseTimer = function()
- {
- if (myself.preventCloseTimerCancel)
- {
- return;
- }
- clearTimeout(myself.autocloseTimer);
- };
- this.closePopup = function() {
- myself.stopCloseTimer();
- thePKT_SAVED.sendMessage("close");
- };
- this.checkValidTagSubmit = function() {
- var inputlength = $.trim($('.pkt_ext_tag_input_wrapper').find('.token-input-input-token').children('input').val()).length;
- if ($('.pkt_ext_containersaved').find('.token-input-token').length || (inputlength > 0 && inputlength < 26))
- {
- $('.pkt_ext_containersaved').find('.pkt_ext_btn').removeClass('pkt_ext_btn_disabled');
- }
- else
- {
- $('.pkt_ext_containersaved').find('.pkt_ext_btn').addClass('pkt_ext_btn_disabled');
- }
- myself.updateSlidingTagList();
- };
- this.updateSlidingTagList = function() {
- var inputleft = $('.token-input-input-token input').position().left;
- var listleft = $('.token-input-list').position().left;
- var listleftmanual = parseInt($('.token-input-list').css('left'));
- var listleftnatural = listleft - listleftmanual;
- var leftwidth = $('.pkt_ext_tag_input_wrapper').outerWidth();
-
- if ((inputleft + listleft + 20) > leftwidth)
- {
- $('.token-input-list').css('left', Math.min(((inputleft + listleftnatural - leftwidth + 20)*-1), 0) + 'px');
- }
- else
- {
- $('.token-input-list').css('left', '0');
- }
- };
- this.checkPlaceholderStatus = function() {
- if (this.wrapper.find('.pkt_ext_tag_input_wrapper').find('.token-input-token').length)
- {
- this.wrapper.find('.token-input-input-token input').attr('placeholder', '');
- }
- else
- {
- this.wrapper.find('.token-input-input-token input').attr('placeholder', $('.pkt_ext_tag_input').attr('placeholder')).css('width', '200px');
- }
- };
- this.initTagInput = function() {
- var inputwrapper = $('.pkt_ext_tag_input_wrapper');
- inputwrapper.find('.pkt_ext_tag_input').tokenInput([], {
- searchDelay: 200,
- minChars: 1,
- animateDropdown: false,
- noResultsHideDropdown: true,
- scrollKeyboard: true,
- emptyInputLength: 200,
- search_function: function(term, cb) {
- var returnlist = [];
- if (term.length) {
- var limit = 15;
- var r = new RegExp('^' + term);
- for (var i = 0; i < myself.userTags.length; i++) {
- if (r.test(myself.userTags[i]) && limit > 0) {
- returnlist.push({name:myself.userTags[i]});
- limit--;
- }
- }
- }
- if (!$('.token-input-dropdown-tag').data('init')) {
- $('.token-input-dropdown-tag').css('width', inputwrapper.outerWidth()).data('init');
- inputwrapper.append($('.token-input-dropdown-tag'));
- }
- cb(returnlist);
- },
- textToData: function(text) {
- if ($.trim(text).length > 25 || !$.trim(text).length) {
- if (text.length > 25) {
- myself.showTagsError(myself.dictJSON.maxtaglength);
- changestamp = Date.now();
- setTimeout(function() {
- $('.token-input-input-token input').val(text).focus();
- }, 10);
- }
- return null;
- }
- myself.hideTagsError();
- return {name:myself.sanitizeText(text.toLowerCase())};
- },
- onReady: function() {
- $('.token-input-dropdown').addClass('token-input-dropdown-tag');
- inputwrapper.find('.token-input-input-token input').attr('placeholder', $('.tag-input').attr('placeholder')).css('width', '200px');
- if ($('.pkt_ext_suggestedtag_detail').length) {
- myself.wrapper.find('.pkt_ext_suggestedtag_detail').on('click', '.token_tag', function(e) {
- e.preventDefault();
- var tag = $(e.target);
- if ($(this).parents('.pkt_ext_suggestedtag_detail_disabled').length) {
- return;
- }
- myself.justaddedsuggested = true;
- inputwrapper.find('.pkt_ext_tag_input').tokenInput('add', {id:inputwrapper.find('.token-input-token').length, name:tag.text()});
- tag.addClass('token-suggestedtag-inactive');
- $('.token-input-input-token input').focus();
- });
- }
- $('.token-input-list').on('keydown', 'input', function(e) {
- if (e.which == 37) {
- myself.updateSlidingTagList();
- }
- }).on('keypress', 'input', function(e) {
- if (e.which == 13) {
- if (typeof changestamp == 'undefined' || (Date.now() - changestamp > 250)) {
- e.preventDefault();
- myself.wrapper.find('.pkt_ext_btn').trigger('click');
- }
- }
- }).on('keyup', 'input', function(e) {
- myself.checkValidTagSubmit();
- });
- myself.checkPlaceholderStatus();
- },
- onAdd: function() {
- myself.checkValidTagSubmit();
- changestamp = Date.now();
- myself.hideInactiveTags();
- myself.checkPlaceholderStatus();
- },
- onDelete: function() {
- myself.checkValidTagSubmit();
- changestamp = Date.now();
- myself.showActiveTags();
- myself.checkPlaceholderStatus();
- },
- onShowDropdown: function() {
- thePKT_SAVED.sendMessage("expandSavePanel");
- },
- onHideDropdown: function() {
- thePKT_SAVED.sendMessage("collapseSavePanel");
- }
- });
- $('body').on('keydown', function(e) {
- var key = e.keyCode || e.which;
- if (key == 8) {
- var selected = $('.token-input-selected-token');
- if (selected.length) {
- e.preventDefault();
- e.stopImmediatePropagation();
- inputwrapper.find('.pkt_ext_tag_input').tokenInput('remove', {name:selected.find('p').text()});
- }
- }
- else if ($(e.target).parent().hasClass('token-input-input-token')) {
- e.stopImmediatePropagation();
- }
- });
- };
- this.disableInput = function() {
- this.wrapper.find('.pkt_ext_item_actions').addClass('pkt_ext_item_actions_disabled');
- this.wrapper.find('.pkt_ext_btn').addClass('pkt_ext_btn_disabled');
- this.wrapper.find('.pkt_ext_tag_input_wrapper').addClass('pkt_ext_tag_input_wrapper_disabled');
- if (this.wrapper.find('.pkt_ext_suggestedtag_detail').length) {
- this.wrapper.find('.pkt_ext_suggestedtag_detail').addClass('pkt_ext_suggestedtag_detail_disabled');
- }
- };
- this.enableInput = function() {
- this.wrapper.find('.pkt_ext_item_actions').removeClass('pkt_ext_item_actions_disabled');
- this.checkValidTagSubmit();
- this.wrapper.find('.pkt_ext_tag_input_wrapper').removeClass('pkt_ext_tag_input_wrapper_disabled');
- if (this.wrapper.find('.pkt_ext_suggestedtag_detail').length) {
- this.wrapper.find('.pkt_ext_suggestedtag_detail').removeClass('pkt_ext_suggestedtag_detail_disabled');
- }
- };
- this.initAddTagInput = function() {
- $('.pkt_ext_btn').click(function(e) {
- e.preventDefault();
- if ($(this).hasClass('pkt_ext_btn_disabled') || $('.pkt_ext_edit_msg_active').filter('.pkt_ext_edit_msg_error').length)
- {
- return;
- }
- myself.disableInput();
- $('.pkt_ext_containersaved').find('.pkt_ext_detail h2').text(myself.dictJSON.processingtags);
- var originaltags = [];
- $('.token-input-token').each(function()
- {
- var text = $.trim($(this).find('p').text());
- if (text.length)
- {
- originaltags.push(text);
- }
- });
-
- thePKT_SAVED.sendMessage("addTags",
- {
- url: myself.savedUrl,
- tags: originaltags
- }, function(resp)
- {
- if (resp.status == 'success')
- {
- myself.showStateFinalMsg(myself.dictJSON.tagssaved);
- }
- else if (resp.status == 'error')
- {
- $('.pkt_ext_edit_msg').addClass('pkt_ext_edit_msg_error pkt_ext_edit_msg_active').text(resp.error.message);
- }
- });
- });
- };
- this.initRemovePageInput = function() {
- $('.pkt_ext_removeitem').click(function(e) {
- if ($(this).parents('.pkt_ext_item_actions_disabled').length) {
- e.preventDefault();
- return;
- }
- if ($(this).hasClass('pkt_ext_removeitem')) {
- e.preventDefault();
- myself.disableInput();
- $('.pkt_ext_containersaved').find('.pkt_ext_detail h2').text(myself.dictJSON.processingremove);
-
- thePKT_SAVED.sendMessage("deleteItem",
- {
- itemId: myself.savedItemId
- }, function(resp) {
- if (resp.status == 'success') {
- myself.showStateFinalMsg(myself.dictJSON.pageremoved);
- }
- else if (resp.status == 'error') {
- $('.pkt_ext_edit_msg').addClass('pkt_ext_edit_msg_error pkt_ext_edit_msg_active').text(resp.error.message);
- }
- });
- }
- });
- };
- this.initOpenListInput = function() {
- $('.pkt_ext_openpocket').click(function(e)
- {
- e.preventDefault();
- thePKT_SAVED.sendMessage("openTabWithUrl",
- {
- url: $(this).attr('href'),
- activate: true
- });
- myself.closePopup();
- });
- };
- this.showTagsError = function(msg) {
- $('.pkt_ext_edit_msg').addClass('pkt_ext_edit_msg_error pkt_ext_edit_msg_active').text(msg);
- $('.pkt_ext_tag_detail').addClass('pkt_ext_tag_error');
- };
- this.hideTagsError = function(msg) {
- $('.pkt_ext_edit_msg').removeClass('pkt_ext_edit_msg_error pkt_ext_edit_msg_active').text('');
- $('.pkt_ext_tag_detail').removeClass('pkt_ext_tag_error');
- };
- this.showActiveTags = function() {
- if (!$('.pkt_ext_suggestedtag_detail').length) {
- return;
- }
- var activetokenstext = '|';
- $('.token-input-token').each(function(index, element) {
- activetokenstext += $(element).find('p').text() + '|';
- });
-
- var inactivetags = $('.pkt_ext_suggestedtag_detail').find('.token_tag_inactive');
- inactivetags.each(function(index, element) {
- if (activetokenstext.indexOf('|' + $(element).text() + '|') == -1) {
- $(element).removeClass('token_tag_inactive');
- }
- });
- };
- this.hideInactiveTags = function() {
- if (!$('.pkt_ext_suggestedtag_detail').length) {
- return;
- }
- var activetokenstext = '|';
- $('.token-input-token').each(function(index, element) {
- activetokenstext += $(element).find('p').text() + '|';
- });
- var activesuggestedtags = $('.token_tag').not('.token_tag_inactive');
- activesuggestedtags.each(function(index, element) {
- if (activetokenstext.indexOf('|' + $(element).text() + '|') > -1) {
- $(element).addClass('token_tag_inactive');
- }
- });
- };
- this.showStateSaved = function(initobj) {
- this.wrapper.find('.pkt_ext_detail h2').text(this.dictJSON.pagesaved);
- this.wrapper.find('.pkt_ext_btn').addClass('pkt_ext_btn_disabled');
- if (typeof initobj.item == 'object')
- {
- this.savedItemId = initobj.item.item_id;
- this.savedUrl = initobj.item.given_url;
- }
- $('.pkt_ext_containersaved').addClass('pkt_ext_container_detailactive').removeClass('pkt_ext_container_finalstate');
-
- myself.fillUserTags();
- if (myself.suggestedTagsLoaded) {
- myself.startCloseTimer();
- }
- else {
- myself.fillSuggestedTags();
- }
- };
- this.sanitizeText = function(s) {
- var sanitizeMap = {
- "&": "&amp;",
- "<": "&lt;",
- ">": "&gt;",
- '"': '&quot;',
- "'": '&#39;'
- };
- if (typeof s !== 'string')
- {
- return '';
- }
- return String(s).replace(/[&<>"']/g, function (str) {
- return sanitizeMap[str];
- });
- };
- this.showStateFinalMsg = function(msg) {
- this.wrapper.find('.pkt_ext_tag_detail').one('webkitTransitionEnd transitionend msTransitionEnd oTransitionEnd', function(e)
- {
- $(this).off('webkitTransitionEnd transitionend msTransitionEnd oTransitionEnd');
- myself.preventCloseTimerCancel = true;
- myself.startCloseTimer(myself.autocloseTimingFinalState);
- myself.wrapper.find('.pkt_ext_detail h2').text(msg);
- });
- this.wrapper.addClass('pkt_ext_container_finalstate');
- };
- this.showStateError = function(headline, detail) {
- this.wrapper.find('.pkt_ext_detail h2').text(headline);
- this.wrapper.find('.pkt_ext_detail h3').text(detail);
- this.wrapper.addClass('pkt_ext_container_detailactive pkt_ext_container_finalstate pkt_ext_container_finalerrorstate');
- this.preventCloseTimerCancel = true;
- this.startCloseTimer(myself.autocloseTimingFinalState);
- }
- this.getTranslations = function()
- {
- this.dictJSON = window.pocketStrings;
- };
-};
-
-PKT_SAVED_OVERLAY.prototype = {
- create : function()
- {
- if (this.active)
- {
- return;
- }
- this.active = true;
-
- // set translations
- this.getTranslations();
-
- // set host
- this.dictJSON.pockethost = this.pockethost;
-
- // extra modifier class for collapsed state
- if (this.inoverflowmenu)
- {
- $('body').addClass('pkt_ext_saved_overflow');
- }
-
- // extra modifier class for language
- if (this.locale)
- {
- $('body').addClass('pkt_ext_saved_' + this.locale);
- }
-
- // Create actual content
- $('body').append(Handlebars.templates.saved_shell(this.dictJSON));
-
- // Add in premium content (if applicable based on premium status)
- this.createPremiumFunctionality();
-
- // Initialize functionality for overlay
- this.wrapper = $('.pkt_ext_containersaved');
- this.initTagInput();
- this.initAddTagInput();
- this.initRemovePageInput();
- this.initOpenListInput();
- this.initAutoCloseEvents();
- },
- createPremiumFunctionality: function()
- {
- if (this.premiumStatus && !$('.pkt_ext_suggestedtag_detail').length)
- {
- $('body').append(Handlebars.templates.saved_premiumshell(this.dictJSON));
- $('.pkt_ext_initload').append(Handlebars.templates.saved_premiumextras(this.dictJSON));
- }
- }
-};
-
-
-// Layer between Bookmarklet and Extensions
-var PKT_SAVED = function () {};
-
-PKT_SAVED.prototype = {
- init: function () {
- if (this.inited) {
- return;
- }
- this.panelId = pktPanelMessaging.panelIdFromURL(window.location.href);
- this.overlay = new PKT_SAVED_OVERLAY();
-
- this.inited = true;
- },
-
- addMessageListener: function(messageId, callback) {
- pktPanelMessaging.addMessageListener(this.panelId, messageId, callback);
- },
-
- sendMessage: function(messageId, payload, callback) {
- pktPanelMessaging.sendMessage(this.panelId, messageId, payload, callback);
- },
-
- create: function() {
- var myself = this;
- var url = window.location.href.match(/premiumStatus=([\w|\d|\.]*)&?/);
- if (url && url.length > 1)
- {
- myself.overlay.premiumStatus = (url[1] == '1');
- }
- var host = window.location.href.match(/pockethost=([\w|\.]*)&?/);
- if (host && host.length > 1)
- {
- myself.overlay.pockethost = host[1];
- }
- var inoverflowmenu = window.location.href.match(/inoverflowmenu=([\w|\.]*)&?/);
- if (inoverflowmenu && inoverflowmenu.length > 1)
- {
- myself.overlay.inoverflowmenu = (inoverflowmenu[1] == 'true');
- }
- var locale = window.location.href.match(/locale=([\w|\.]*)&?/);
- if (locale && locale.length > 1)
- {
- myself.overlay.locale = locale[1].toLowerCase();
- }
-
- myself.overlay.create();
-
- // tell back end we're ready
- thePKT_SAVED.sendMessage("show");
-
- // wait confirmation of save before flipping to final saved state
- thePKT_SAVED.addMessageListener("saveLink", function(resp)
- {
- if (resp.status == 'error') {
- if (typeof resp.error == 'object')
- {
- if (resp.error.localizedKey)
- {
- myself.overlay.showStateError(myself.overlay.dictJSON.pagenotsaved, myself.overlay.dictJSON[resp.error.localizedKey]);
- }
- else
- {
- myself.overlay.showStateError(myself.overlay.dictJSON.pagenotsaved, resp.error.message);
- }
- }
- else
- {
- myself.overlay.showStateError(myself.overlay.dictJSON.pagenotsaved, myself.overlay.dictJSON.errorgeneric);
- }
- return;
- }
-
- myself.overlay.showStateSaved(resp);
- });
-
- }
-}
-
-$(function()
-{
- if (!window.thePKT_SAVED) {
- var thePKT_SAVED = new PKT_SAVED();
- window.thePKT_SAVED = thePKT_SAVED;
- thePKT_SAVED.init();
- }
-
- var pocketHost = thePKT_SAVED.overlay.pockethost;
- // send an async message to get string data
- thePKT_SAVED.sendMessage("initL10N", {
- tos: [
- 'https://'+ pocketHost +'/tos?s=ffi&t=tos&tv=panel_tryit',
- 'https://'+ pocketHost +'/privacy?s=ffi&t=privacypolicy&tv=panel_tryit'
- ]
- }, function(resp) {
- window.pocketStrings = resp.strings;
- window.thePKT_SAVED.create();
- });
-});
diff --git a/browser/extensions/pocket/content/panels/js/signup.js b/browser/extensions/pocket/content/panels/js/signup.js
deleted file mode 100644
index af55cc2a74..0000000000
--- a/browser/extensions/pocket/content/panels/js/signup.js
+++ /dev/null
@@ -1,193 +0,0 @@
-/*
-PKT_SIGNUP_OVERLAY is the view itself and contains all of the methods to manipute the overlay and messaging.
-It does not contain any logic for saving or communication with the extension or server.
-*/
-var PKT_SIGNUP_OVERLAY = function (options)
-{
- var myself = this;
- this.inited = false;
- this.active = false;
- this.delayedStateSaved = false;
- this.wrapper = null;
- this.variant = window.___PKT__SIGNUP_VARIANT;
- this.tagline = window.___PKT__SIGNUP_TAGLINE || '';
- this.preventCloseTimerCancel = false;
- this.translations = {};
- this.closeValid = true;
- this.mouseInside = false;
- this.autocloseTimer = null;
- this.variant = "";
- this.inoverflowmenu = false;
- this.controlvariant;
- this.pockethost = "getpocket.com";
- this.fxasignedin = false;
- this.dictJSON = {};
- this.initCloseTabEvents = function() {
- $('.btn,.pkt_ext_learnmore,.alreadyhave > a').click(function(e)
- {
- e.preventDefault();
- thePKT_SIGNUP.sendMessage("openTabWithUrl",
- {
- url: $(this).attr('href'),
- activate: true
- });
- myself.closePopup();
- });
- };
- this.closePopup = function() {
- thePKT_SIGNUP.sendMessage("close");
- };
- this.sanitizeText = function(s) {
- var sanitizeMap = {
- "&": "&amp;",
- "<": "&lt;",
- ">": "&gt;",
- '"': '&quot;',
- "'": '&#39;'
- };
- if (typeof s !== 'string')
- {
- return '';
- }
- return String(s).replace(/[&<>"']/g, function (str) {
- return sanitizeMap[str];
- });
- };
- this.getTranslations = function()
- {
- this.dictJSON = window.pocketStrings;
- };
-
-};
-
-PKT_SIGNUP_OVERLAY.prototype = {
- create : function()
- {
- var controlvariant = window.location.href.match(/controlvariant=([\w|\.]*)&?/);
- if (controlvariant && controlvariant.length > 1)
- {
- this.controlvariant = controlvariant[1];
- }
- var variant = window.location.href.match(/variant=([\w|\.]*)&?/);
- if (variant && variant.length > 1)
- {
- this.variant = variant[1];
- }
- var fxasignedin = window.location.href.match(/fxasignedin=([\w|\d|\.]*)&?/);
- if (fxasignedin && fxasignedin.length > 1)
- {
- this.fxasignedin = (fxasignedin[1] == '1');
- }
- var host = window.location.href.match(/pockethost=([\w|\.]*)&?/);
- if (host && host.length > 1)
- {
- this.pockethost = host[1];
- }
- var inoverflowmenu = window.location.href.match(/inoverflowmenu=([\w|\.]*)&?/);
- if (inoverflowmenu && inoverflowmenu.length > 1)
- {
- this.inoverflowmenu = (inoverflowmenu[1] == 'true');
- }
- var locale = window.location.href.match(/locale=([\w|\.]*)&?/);
- if (locale && locale.length > 1)
- {
- this.locale = locale[1].toLowerCase();
- }
-
- if (this.active)
- {
- return;
- }
- this.active = true;
-
- // set translations
- this.getTranslations();
- this.dictJSON.fxasignedin = this.fxasignedin ? 1 : 0;
- this.dictJSON.controlvariant = this.controlvariant == 'true' ? 1 : 0;
- this.dictJSON.variant = (this.variant ? this.variant : 'undefined');
- this.dictJSON.variant += this.fxasignedin ? '_fxa' : '_nonfxa';
- this.dictJSON.pockethost = this.pockethost;
- this.dictJSON.showlearnmore = true;
-
- // extra modifier class for collapsed state
- if (this.inoverflowmenu)
- {
- $('body').addClass('pkt_ext_signup_overflow');
- }
-
- // extra modifier class for language
- if (this.locale)
- {
- $('body').addClass('pkt_ext_signup_' + this.locale);
- }
-
- // Create actual content
- if (this.variant == 'overflow')
- {
- $('body').append(Handlebars.templates.signup_shell(this.dictJSON));
- }
- else
- {
- $('body').append(Handlebars.templates.signupstoryboard_shell(this.dictJSON));
- }
-
-
- // tell background we're ready
- thePKT_SIGNUP.sendMessage("show");
-
- // close events
- this.initCloseTabEvents();
- }
-};
-
-
-// Layer between Bookmarklet and Extensions
-var PKT_SIGNUP = function () {};
-
-PKT_SIGNUP.prototype = {
- init: function () {
- if (this.inited) {
- return;
- }
- this.panelId = pktPanelMessaging.panelIdFromURL(window.location.href);
- this.overlay = new PKT_SIGNUP_OVERLAY();
-
- this.inited = true;
- },
-
- addMessageListener: function(messageId, callback) {
- pktPanelMessaging.addMessageListener(this.panelId, messageId, callback);
- },
-
- sendMessage: function(messageId, payload, callback) {
- pktPanelMessaging.sendMessage(this.panelId, messageId, payload, callback);
- },
-
- create: function() {
- this.overlay.create();
-
- // tell back end we're ready
- thePKT_SIGNUP.sendMessage("show");
- }
-}
-
-$(function()
-{
- if (!window.thePKT_SIGNUP) {
- var thePKT_SIGNUP = new PKT_SIGNUP();
- window.thePKT_SIGNUP = thePKT_SIGNUP;
- thePKT_SIGNUP.init();
- }
-
- var pocketHost = thePKT_SIGNUP.overlay.pockethost;
- // send an async message to get string data
- thePKT_SIGNUP.sendMessage("initL10N", {
- tos: [
- 'https://'+ pocketHost +'/tos?s=ffi&t=tos&tv=panel_tryit',
- 'https://'+ pocketHost +'/privacy?s=ffi&t=privacypolicy&tv=panel_tryit'
- ]
- }, function(resp) {
- window.pocketStrings = resp.strings;
- window.thePKT_SIGNUP.create();
- });
-});
diff --git a/browser/extensions/pocket/content/panels/js/tmpl.js b/browser/extensions/pocket/content/panels/js/tmpl.js
deleted file mode 100644
index a03ffda700..0000000000
--- a/browser/extensions/pocket/content/panels/js/tmpl.js
+++ /dev/null
@@ -1,242 +0,0 @@
-(function() {
- var template = Handlebars.template, templates = Handlebars.templates = Handlebars.templates || {};
-templates['saved_premiumextras'] = template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
- return "<div class=\"pkt_ext_suggestedtag_detailshown\">\r\n</div> ";
- },"useData":true});
-templates['saved_premiumshell'] = template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
- var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
- return "<div class=\"pkt_ext_suggestedtag_detail pkt_ext_suggestedtag_detail_loading\">\n <h4>"
- + escapeExpression(((helper = (helper = helpers.suggestedtags || (depth0 != null ? depth0.suggestedtags : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"suggestedtags","hash":{},"data":data}) : helper)))
- + "</h4>\n <div class=\"pkt_ext_loadingspinner\"><div></div></div>\n <ul class=\"pkt_ext_cf\">\n </ul>\n</div>";
-},"useData":true});
-templates['saved_shell'] = template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
- var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
- return "<div class=\"pkt_ext_initload\">\n <div class=\"pkt_ext_logo\"></div> \n <div class=\"pkt_ext_topdetail\">\n <h2>"
- + escapeExpression(((helper = (helper = helpers.saving || (depth0 != null ? depth0.saving : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"saving","hash":{},"data":data}) : helper)))
- + "</h2>\n </div> \n <div class=\"pkt_ext_loadingspinner\"><div></div></div>\n</div> \n<div class=\"pkt_ext_detail\"> \n <div class=\"pkt_ext_logo\"></div>\n <div class=\"pkt_ext_topdetail\">\n <h2>"
- + escapeExpression(((helper = (helper = helpers.pagesaved || (depth0 != null ? depth0.pagesaved : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"pagesaved","hash":{},"data":data}) : helper)))
- + "</h2>\n <h3 class=\"pkt_ext_errordetail\"></h3>\n <nav class=\"pkt_ext_item_actions pkt_ext_cf\">\n <ul>\n <li><a class=\"pkt_ext_removeitem\" href=\"#\">"
- + escapeExpression(((helper = (helper = helpers.removepage || (depth0 != null ? depth0.removepage : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"removepage","hash":{},"data":data}) : helper)))
- + "</a></li>\n <li class=\"pkt_ext_actions_separator\"></li> \n <li><a class=\"pkt_ext_openpocket\" href=\"https://"
- + escapeExpression(((helper = (helper = helpers.pockethost || (depth0 != null ? depth0.pockethost : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"pockethost","hash":{},"data":data}) : helper)))
- + "/a?src=ff_ext_saved\" target=\"_blank\">"
- + escapeExpression(((helper = (helper = helpers.viewlist || (depth0 != null ? depth0.viewlist : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"viewlist","hash":{},"data":data}) : helper)))
- + "</a></li>\n </ul>\n </nav> \n </div>\n <div class=\"pkt_ext_tag_detail pkt_ext_cf\">\n <div class=\"pkt_ext_tag_input_wrapper\">\n <div class=\"pkt_ext_tag_input_blocker\"></div>\n <input class=\"pkt_ext_tag_input\" type=\"text\" placeholder=\""
- + escapeExpression(((helper = (helper = helpers.addtags || (depth0 != null ? depth0.addtags : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"addtags","hash":{},"data":data}) : helper)))
- + "\">\n </div>\n <a href=\"#\" class=\"pkt_ext_btn pkt_ext_btn_disabled\">"
- + escapeExpression(((helper = (helper = helpers.save || (depth0 != null ? depth0.save : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"save","hash":{},"data":data}) : helper)))
- + "</a>\n </div>\n <p class=\"pkt_ext_edit_msg\"></p>\n</div>";
-},"useData":true});
-templates['signup_shell'] = template({"1":function(depth0,helpers,partials,data) {
- var stack1, buffer = "";
- stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.controlvariant : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data});
- if (stack1 != null) { buffer += stack1; }
- return buffer;
-},"2":function(depth0,helpers,partials,data) {
- var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
- return " <p class=\"pkt_ext_learnmorecontainer\"><a class=\"pkt_ext_learnmore\" href=\"https://"
- + escapeExpression(((helper = (helper = helpers.pockethost || (depth0 != null ? depth0.pockethost : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"pockethost","hash":{},"data":data}) : helper)))
- + "/firefox_learnmore?s=ffi&t=learnmore&tv=panel_control&v="
- + escapeExpression(((helper = (helper = helpers.variant || (depth0 != null ? depth0.variant : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"variant","hash":{},"data":data}) : helper)))
- + "\" target=\"_blank\">"
- + escapeExpression(((helper = (helper = helpers.learnmore || (depth0 != null ? depth0.learnmore : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"learnmore","hash":{},"data":data}) : helper)))
- + "</a></p>\n";
-},"4":function(depth0,helpers,partials,data) {
- var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
- return " <p class=\"pkt_ext_learnmorecontainer\"><a class=\"pkt_ext_learnmore\" href=\"https://"
- + escapeExpression(((helper = (helper = helpers.pockethost || (depth0 != null ? depth0.pockethost : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"pockethost","hash":{},"data":data}) : helper)))
- + "/firefox_learnmore?s=ffi&t=learnmore&tv=panel_tryit&v="
- + escapeExpression(((helper = (helper = helpers.variant || (depth0 != null ? depth0.variant : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"variant","hash":{},"data":data}) : helper)))
- + "\" target=\"_blank\">"
- + escapeExpression(((helper = (helper = helpers.learnmore || (depth0 != null ? depth0.learnmore : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"learnmore","hash":{},"data":data}) : helper)))
- + "</a></p>\n";
-},"6":function(depth0,helpers,partials,data) {
- var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
- return " <p class=\"pkt_ext_learnmorecontainer\"><a class=\"pkt_ext_learnmore pkt_ext_learnmoreinactive\" href=\"#\">"
- + escapeExpression(((helper = (helper = helpers.learnmore || (depth0 != null ? depth0.learnmore : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"learnmore","hash":{},"data":data}) : helper)))
- + "</a></p>\n";
-},"8":function(depth0,helpers,partials,data) {
- var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
- return " <h4>"
- + escapeExpression(((helper = (helper = helpers.signuptosave || (depth0 != null ? depth0.signuptosave : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signuptosave","hash":{},"data":data}) : helper)))
- + "</h4>\n <p class=\"btn-container\"><a href=\"https://"
- + escapeExpression(((helper = (helper = helpers.pockethost || (depth0 != null ? depth0.pockethost : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"pockethost","hash":{},"data":data}) : helper)))
- + "/ff_signup?s=ffi&t=signupff&v="
- + escapeExpression(((helper = (helper = helpers.variant || (depth0 != null ? depth0.variant : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"variant","hash":{},"data":data}) : helper)))
- + "\" target=\"_blank\" class=\"btn signup-btn-firefox\"><span class=\"logo\"></span><span class=\"text\">"
- + escapeExpression(((helper = (helper = helpers.signinfirefox || (depth0 != null ? depth0.signinfirefox : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signinfirefox","hash":{},"data":data}) : helper)))
- + "</span></a></p>\n <p class=\"alreadyhave\">"
- + escapeExpression(((helper = (helper = helpers.alreadyhaveacct || (depth0 != null ? depth0.alreadyhaveacct : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"alreadyhaveacct","hash":{},"data":data}) : helper)))
- + " <a href=\"https://"
- + escapeExpression(((helper = (helper = helpers.pockethost || (depth0 != null ? depth0.pockethost : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"pockethost","hash":{},"data":data}) : helper)))
- + "/login?ep=3&src=extension&s=ffi&t=login&v="
- + escapeExpression(((helper = (helper = helpers.variant || (depth0 != null ? depth0.variant : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"variant","hash":{},"data":data}) : helper)))
- + "\" target=\"_blank\">"
- + escapeExpression(((helper = (helper = helpers.loginnow || (depth0 != null ? depth0.loginnow : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"loginnow","hash":{},"data":data}) : helper)))
- + "</a>.</p>\n";
-},"10":function(depth0,helpers,partials,data) {
- var stack1, buffer = "";
- stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.controlvariant : depth0), {"name":"if","hash":{},"fn":this.program(11, data),"inverse":this.program(13, data),"data":data});
- if (stack1 != null) { buffer += stack1; }
- return buffer;
-},"11":function(depth0,helpers,partials,data) {
- var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
- return " <h4>"
- + escapeExpression(((helper = (helper = helpers.signuptosave || (depth0 != null ? depth0.signuptosave : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signuptosave","hash":{},"data":data}) : helper)))
- + "</h4>\n <p class=\"btn-container\"><a href=\"https://"
- + escapeExpression(((helper = (helper = helpers.pockethost || (depth0 != null ? depth0.pockethost : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"pockethost","hash":{},"data":data}) : helper)))
- + "/ff_signup?s=ffi&tv=panel_control&t=signupff&v="
- + escapeExpression(((helper = (helper = helpers.variant || (depth0 != null ? depth0.variant : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"variant","hash":{},"data":data}) : helper)))
- + "\" target=\"_blank\" class=\"btn signup-btn-firefox\"><span class=\"logo\"></span><span class=\"text\">"
- + escapeExpression(((helper = (helper = helpers.signupfirefox || (depth0 != null ? depth0.signupfirefox : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signupfirefox","hash":{},"data":data}) : helper)))
- + "</span></a></p>\n <p class=\"btn-container\"><a href=\"https://"
- + escapeExpression(((helper = (helper = helpers.pockethost || (depth0 != null ? depth0.pockethost : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"pockethost","hash":{},"data":data}) : helper)))
- + "/signup?force=email&tv=panel_control&src=extension&s=ffi&t=signupemail&v="
- + escapeExpression(((helper = (helper = helpers.variant || (depth0 != null ? depth0.variant : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"variant","hash":{},"data":data}) : helper)))
- + "\" target=\"_blank\" class=\"btn btn-secondary signup-btn-email signup-btn-initstate\">"
- + escapeExpression(((helper = (helper = helpers.signupemail || (depth0 != null ? depth0.signupemail : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signupemail","hash":{},"data":data}) : helper)))
- + "</a></p>\n <p class=\"alreadyhave\">"
- + escapeExpression(((helper = (helper = helpers.alreadyhaveacct || (depth0 != null ? depth0.alreadyhaveacct : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"alreadyhaveacct","hash":{},"data":data}) : helper)))
- + " <a href=\"https://"
- + escapeExpression(((helper = (helper = helpers.pockethost || (depth0 != null ? depth0.pockethost : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"pockethost","hash":{},"data":data}) : helper)))
- + "/login?ep=3&tv=panel_control&src=extension&s=ffi&t=login&v="
- + escapeExpression(((helper = (helper = helpers.variant || (depth0 != null ? depth0.variant : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"variant","hash":{},"data":data}) : helper)))
- + "\" target=\"_blank\">"
- + escapeExpression(((helper = (helper = helpers.loginnow || (depth0 != null ? depth0.loginnow : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"loginnow","hash":{},"data":data}) : helper)))
- + "</a>.</p>\n";
-},"13":function(depth0,helpers,partials,data) {
- var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = " <p class=\"btn-container\"><a href=\"https://"
- + escapeExpression(((helper = (helper = helpers.pockethost || (depth0 != null ? depth0.pockethost : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"pockethost","hash":{},"data":data}) : helper)))
- + "/firefox_tryitnow?s=ffi&tv=panel_tryit&t=tryitnow\" target=\"_blank\" class=\"btn signup-btn-tryitnow\"><span class=\"text\">"
- + escapeExpression(((helper = (helper = helpers.tryitnow || (depth0 != null ? depth0.tryitnow : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"tryitnow","hash":{},"data":data}) : helper)))
- + "</span></a></p>\n <p class=\"alreadyhave tryitnowspace\">"
- + escapeExpression(((helper = (helper = helpers.alreadyhaveacct || (depth0 != null ? depth0.alreadyhaveacct : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"alreadyhaveacct","hash":{},"data":data}) : helper)))
- + " <a href=\"https://"
- + escapeExpression(((helper = (helper = helpers.pockethost || (depth0 != null ? depth0.pockethost : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"pockethost","hash":{},"data":data}) : helper)))
- + "/login?ep=3&s=ffi&tv=panel_tryit&src=extension&t=login&v="
- + escapeExpression(((helper = (helper = helpers.variant || (depth0 != null ? depth0.variant : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"variant","hash":{},"data":data}) : helper)))
- + "\" target=\"_blank\">"
- + escapeExpression(((helper = (helper = helpers.loginnow || (depth0 != null ? depth0.loginnow : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"loginnow","hash":{},"data":data}) : helper)))
- + "</a>.</p>\n <p class=\"pkt_ext_tos\">";
- stack1 = ((helper = (helper = helpers.tos || (depth0 != null ? depth0.tos : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"tos","hash":{},"data":data}) : helper));
- if (stack1 != null) { buffer += stack1; }
- return buffer + "</p>\n";
-},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
- var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<div class=\"pkt_ext_introdetail pkt_ext_introdetailhero\">\n <h2 class=\"pkt_ext_logo\">Pocket</h2>\n <p class=\"pkt_ext_tagline\">"
- + escapeExpression(((helper = (helper = helpers.tagline || (depth0 != null ? depth0.tagline : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"tagline","hash":{},"data":data}) : helper)))
- + "</p>\n";
- stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.showlearnmore : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(6, data),"data":data});
- if (stack1 != null) { buffer += stack1; }
- buffer += " <div class=\"pkt_ext_introimg\"></div>\n</div>\n<div class=\"pkt_ext_signupdetail pkt_ext_signupdetail_hero\">\n";
- stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.fxasignedin : depth0), {"name":"if","hash":{},"fn":this.program(8, data),"inverse":this.program(10, data),"data":data});
- if (stack1 != null) { buffer += stack1; }
- return buffer + "</div>\n";
-},"useData":true});
-templates['signupstoryboard_shell'] = template({"1":function(depth0,helpers,partials,data) {
- var stack1, buffer = "";
- stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.controlvariant : depth0), {"name":"if","hash":{},"fn":this.program(2, data),"inverse":this.program(4, data),"data":data});
- if (stack1 != null) { buffer += stack1; }
- return buffer;
-},"2":function(depth0,helpers,partials,data) {
- var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
- return " <p><a class=\"pkt_ext_learnmore\" href=\"https://"
- + escapeExpression(((helper = (helper = helpers.pockethost || (depth0 != null ? depth0.pockethost : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"pockethost","hash":{},"data":data}) : helper)))
- + "/firefox_learnmore?s=ffi&t=learnmore&tv=panel_control&v="
- + escapeExpression(((helper = (helper = helpers.variant || (depth0 != null ? depth0.variant : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"variant","hash":{},"data":data}) : helper)))
- + "\" target=\"_blank\">"
- + escapeExpression(((helper = (helper = helpers.learnmore || (depth0 != null ? depth0.learnmore : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"learnmore","hash":{},"data":data}) : helper)))
- + "</a></p>\n";
-},"4":function(depth0,helpers,partials,data) {
- var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
- return " <p><a class=\"pkt_ext_learnmore\" href=\"https://"
- + escapeExpression(((helper = (helper = helpers.pockethost || (depth0 != null ? depth0.pockethost : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"pockethost","hash":{},"data":data}) : helper)))
- + "/firefox_learnmore?s=ffi&t=learnmore&tv=panel_tryit&v="
- + escapeExpression(((helper = (helper = helpers.variant || (depth0 != null ? depth0.variant : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"variant","hash":{},"data":data}) : helper)))
- + "\" target=\"_blank\">"
- + escapeExpression(((helper = (helper = helpers.learnmore || (depth0 != null ? depth0.learnmore : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"learnmore","hash":{},"data":data}) : helper)))
- + "</a></p>\n";
-},"6":function(depth0,helpers,partials,data) {
- var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
- return " <p><a class=\"pkt_ext_learnmore pkt_ext_learnmoreinactive\" href=\"#\">"
- + escapeExpression(((helper = (helper = helpers.learnmore || (depth0 != null ? depth0.learnmore : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"learnmore","hash":{},"data":data}) : helper)))
- + "</a></p>\n";
-},"8":function(depth0,helpers,partials,data) {
- var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
- return " <h4>"
- + escapeExpression(((helper = (helper = helpers.signuptosave || (depth0 != null ? depth0.signuptosave : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signuptosave","hash":{},"data":data}) : helper)))
- + "</h4>\n <p class=\"btn-container\"><a href=\"https://"
- + escapeExpression(((helper = (helper = helpers.pockethost || (depth0 != null ? depth0.pockethost : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"pockethost","hash":{},"data":data}) : helper)))
- + "/ff_signup?s=ffi&t=signupff&v="
- + escapeExpression(((helper = (helper = helpers.variant || (depth0 != null ? depth0.variant : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"variant","hash":{},"data":data}) : helper)))
- + "\" target=\"_blank\" class=\"btn signup-btn-firefox\"><span class=\"logo\"></span><span class=\"text\">"
- + escapeExpression(((helper = (helper = helpers.signinfirefox || (depth0 != null ? depth0.signinfirefox : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signinfirefox","hash":{},"data":data}) : helper)))
- + "</span></a></p>\n <p class=\"alreadyhave\">"
- + escapeExpression(((helper = (helper = helpers.alreadyhaveacct || (depth0 != null ? depth0.alreadyhaveacct : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"alreadyhaveacct","hash":{},"data":data}) : helper)))
- + " <a href=\"https://"
- + escapeExpression(((helper = (helper = helpers.pockethost || (depth0 != null ? depth0.pockethost : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"pockethost","hash":{},"data":data}) : helper)))
- + "/login?ep=3&src=extension&s=ffi&t=login&v="
- + escapeExpression(((helper = (helper = helpers.variant || (depth0 != null ? depth0.variant : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"variant","hash":{},"data":data}) : helper)))
- + "\" target=\"_blank\">"
- + escapeExpression(((helper = (helper = helpers.loginnow || (depth0 != null ? depth0.loginnow : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"loginnow","hash":{},"data":data}) : helper)))
- + "</a>.</p>\n";
-},"10":function(depth0,helpers,partials,data) {
- var stack1, buffer = "";
- stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.controlvariant : depth0), {"name":"if","hash":{},"fn":this.program(11, data),"inverse":this.program(13, data),"data":data});
- if (stack1 != null) { buffer += stack1; }
- return buffer;
-},"11":function(depth0,helpers,partials,data) {
- var helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression;
- return " <h4>"
- + escapeExpression(((helper = (helper = helpers.signuptosave || (depth0 != null ? depth0.signuptosave : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signuptosave","hash":{},"data":data}) : helper)))
- + "</h4>\n <p class=\"btn-container\"><a href=\"https://"
- + escapeExpression(((helper = (helper = helpers.pockethost || (depth0 != null ? depth0.pockethost : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"pockethost","hash":{},"data":data}) : helper)))
- + "/ff_signup?s=ffi&tv=panel_control&t=signupff&v="
- + escapeExpression(((helper = (helper = helpers.variant || (depth0 != null ? depth0.variant : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"variant","hash":{},"data":data}) : helper)))
- + "\" target=\"_blank\" class=\"btn signup-btn-firefox\"><span class=\"logo\"></span><span class=\"text\">"
- + escapeExpression(((helper = (helper = helpers.signupfirefox || (depth0 != null ? depth0.signupfirefox : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signupfirefox","hash":{},"data":data}) : helper)))
- + "</span></a></p>\n <p class=\"btn-container\"><a href=\"https://"
- + escapeExpression(((helper = (helper = helpers.pockethost || (depth0 != null ? depth0.pockethost : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"pockethost","hash":{},"data":data}) : helper)))
- + "/signup?force=email&tv=panel_control&src=extension&s=ffi&t=signupemail&v="
- + escapeExpression(((helper = (helper = helpers.variant || (depth0 != null ? depth0.variant : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"variant","hash":{},"data":data}) : helper)))
- + "\" target=\"_blank\" class=\"btn btn-secondary signup-btn-email signup-btn-initstate\">"
- + escapeExpression(((helper = (helper = helpers.signupemail || (depth0 != null ? depth0.signupemail : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"signupemail","hash":{},"data":data}) : helper)))
- + "</a></p>\n <p class=\"alreadyhave\">"
- + escapeExpression(((helper = (helper = helpers.alreadyhaveacct || (depth0 != null ? depth0.alreadyhaveacct : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"alreadyhaveacct","hash":{},"data":data}) : helper)))
- + " <a href=\"https://"
- + escapeExpression(((helper = (helper = helpers.pockethost || (depth0 != null ? depth0.pockethost : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"pockethost","hash":{},"data":data}) : helper)))
- + "/login?ep=3&tv=panel_control&src=extension&s=ffi&t=login&v="
- + escapeExpression(((helper = (helper = helpers.variant || (depth0 != null ? depth0.variant : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"variant","hash":{},"data":data}) : helper)))
- + "\" target=\"_blank\">"
- + escapeExpression(((helper = (helper = helpers.loginnow || (depth0 != null ? depth0.loginnow : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"loginnow","hash":{},"data":data}) : helper)))
- + "</a>.</p>\n";
-},"13":function(depth0,helpers,partials,data) {
- var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = " <p class=\"btn-container\"><a href=\"https://"
- + escapeExpression(((helper = (helper = helpers.pockethost || (depth0 != null ? depth0.pockethost : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"pockethost","hash":{},"data":data}) : helper)))
- + "/firefox_tryitnow?s=ffi&tv=panel_tryit&t=tryitnow\" target=\"_blank\" class=\"btn signup-btn-tryitnow\"><span class=\"text\">"
- + escapeExpression(((helper = (helper = helpers.tryitnow || (depth0 != null ? depth0.tryitnow : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"tryitnow","hash":{},"data":data}) : helper)))
- + "</span></a></p>\n <p class=\"alreadyhave tryitnowspace\">"
- + escapeExpression(((helper = (helper = helpers.alreadyhaveacct || (depth0 != null ? depth0.alreadyhaveacct : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"alreadyhaveacct","hash":{},"data":data}) : helper)))
- + " <a href=\"https://"
- + escapeExpression(((helper = (helper = helpers.pockethost || (depth0 != null ? depth0.pockethost : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"pockethost","hash":{},"data":data}) : helper)))
- + "/login?ep=3&s=ffi&tv=panel_tryit&src=extension&t=login&v="
- + escapeExpression(((helper = (helper = helpers.variant || (depth0 != null ? depth0.variant : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"variant","hash":{},"data":data}) : helper)))
- + "\" target=\"_blank\">"
- + escapeExpression(((helper = (helper = helpers.loginnow || (depth0 != null ? depth0.loginnow : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"loginnow","hash":{},"data":data}) : helper)))
- + "</a>.</p>\n <p class=\"pkt_ext_tos\">";
- stack1 = ((helper = (helper = helpers.tos || (depth0 != null ? depth0.tos : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"tos","hash":{},"data":data}) : helper));
- if (stack1 != null) { buffer += stack1; }
- return buffer + "</p>\n";
-},"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
- var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, escapeExpression=this.escapeExpression, buffer = "<div class=\"pkt_ext_introdetail pkt_ext_introdetailstoryboard\">\n <div class=\"pkt_ext_introstory pkt_ext_introstoryone\">\n <div class=\"pkt_ext_introstory_text\">\n <p class=\"pkt_ext_tagline\">"
- + escapeExpression(((helper = (helper = helpers.taglinestory_one || (depth0 != null ? depth0.taglinestory_one : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"taglinestory_one","hash":{},"data":data}) : helper)))
- + "</p>\n </div>\n <div class=\"pkt_ext_introstoryone_img\"></div>\n </div>\n <div class=\"pkt_ext_introstorydivider\"></div>\n <div class=\"pkt_ext_introstory pkt_ext_introstorytwo\">\n <div class=\"pkt_ext_introstory_text\">\n <p class=\"pkt_ext_tagline\">"
- + escapeExpression(((helper = (helper = helpers.taglinestory_two || (depth0 != null ? depth0.taglinestory_two : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"taglinestory_two","hash":{},"data":data}) : helper)))
- + "</p>\n";
- stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.showlearnmore : depth0), {"name":"if","hash":{},"fn":this.program(1, data),"inverse":this.program(6, data),"data":data});
- if (stack1 != null) { buffer += stack1; }
- buffer += " </div>\n <div class=\"pkt_ext_introstorytwo_img\"></div>\n </div>\n</div>\n<div class=\"pkt_ext_signupdetail\">\n";
- stack1 = helpers['if'].call(depth0, (depth0 != null ? depth0.fxasignedin : depth0), {"name":"if","hash":{},"fn":this.program(8, data),"inverse":this.program(10, data),"data":data});
- if (stack1 != null) { buffer += stack1; }
- return buffer + "\n</div>\n";
-},"useData":true});
-})();
diff --git a/browser/extensions/pocket/content/panels/js/vendor/handlebars.runtime.js b/browser/extensions/pocket/content/panels/js/vendor/handlebars.runtime.js
deleted file mode 100644
index c8bb1c4523..0000000000
--- a/browser/extensions/pocket/content/panels/js/vendor/handlebars.runtime.js
+++ /dev/null
@@ -1,660 +0,0 @@
-/*
-
- handlebars v2.0.0
-
-Copyright (C) 2011-2014 by Yehuda Katz
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-@license
-*/
-/* exported Handlebars */
-(function (root, factory) {
- if (typeof define === 'function' && define.amd) {
- define([], factory);
- } else if (typeof exports === 'object') {
- module.exports = factory();
- } else {
- root.Handlebars = root.Handlebars || factory();
- }
-}(this, function () {
-// handlebars/safe-string.js
-var __module3__ = (function() {
- "use strict";
- var __exports__;
- // Build out our basic SafeString type
- function SafeString(string) {
- this.string = string;
- }
-
- SafeString.prototype.toString = function() {
- return "" + this.string;
- };
-
- __exports__ = SafeString;
- return __exports__;
-})();
-
-// handlebars/utils.js
-var __module2__ = (function(__dependency1__) {
- "use strict";
- var __exports__ = {};
- /*jshint -W004 */
- var SafeString = __dependency1__;
-
- var escape = {
- "&": "&amp;",
- "<": "&lt;",
- ">": "&gt;",
- '"': "&quot;",
- "'": "&#x27;",
- "`": "&#x60;"
- };
-
- var badChars = /[&<>"'`]/g;
- var possible = /[&<>"'`]/;
-
- function escapeChar(chr) {
- return escape[chr];
- }
-
- function extend(obj /* , ...source */) {
- for (var i = 1; i < arguments.length; i++) {
- for (var key in arguments[i]) {
- if (Object.prototype.hasOwnProperty.call(arguments[i], key)) {
- obj[key] = arguments[i][key];
- }
- }
- }
-
- return obj;
- }
-
- __exports__.extend = extend;var toString = Object.prototype.toString;
- __exports__.toString = toString;
- // Sourced from lodash
- // https://github.com/bestiejs/lodash/blob/master/LICENSE.txt
- var isFunction = function(value) {
- return typeof value === 'function';
- };
- // fallback for older versions of Chrome and Safari
- /* istanbul ignore next */
- if (isFunction(/x/)) {
- isFunction = function(value) {
- return typeof value === 'function' && toString.call(value) === '[object Function]';
- };
- }
- var isFunction;
- __exports__.isFunction = isFunction;
- /* istanbul ignore next */
- var isArray = Array.isArray || function(value) {
- return (value && typeof value === 'object') ? toString.call(value) === '[object Array]' : false;
- };
- __exports__.isArray = isArray;
-
- function escapeExpression(string) {
- // don't escape SafeStrings, since they're already safe
- if (string instanceof SafeString) {
- return string.toString();
- } else if (string == null) {
- return "";
- } else if (!string) {
- return string + '';
- }
-
- // Force a string conversion as this will be done by the append regardless and
- // the regex test will do this transparently behind the scenes, causing issues if
- // an object's to string has escaped characters in it.
- string = "" + string;
-
- if(!possible.test(string)) { return string; }
- return string.replace(badChars, escapeChar);
- }
-
- __exports__.escapeExpression = escapeExpression;function isEmpty(value) {
- if (!value && value !== 0) {
- return true;
- } else if (isArray(value) && value.length === 0) {
- return true;
- } else {
- return false;
- }
- }
-
- __exports__.isEmpty = isEmpty;function appendContextPath(contextPath, id) {
- return (contextPath ? contextPath + '.' : '') + id;
- }
-
- __exports__.appendContextPath = appendContextPath;
- return __exports__;
-})(__module3__);
-
-// handlebars/exception.js
-var __module4__ = (function() {
- "use strict";
- var __exports__;
-
- var errorProps = ['description', 'fileName', 'lineNumber', 'message', 'name', 'number', 'stack'];
-
- function Exception(message, node) {
- var line;
- if (node && node.firstLine) {
- line = node.firstLine;
-
- message += ' - ' + line + ':' + node.firstColumn;
- }
-
- var tmp = Error.prototype.constructor.call(this, message);
-
- // Unfortunately errors are not enumerable in Chrome (at least), so `for prop in tmp` doesn't work.
- for (var idx = 0; idx < errorProps.length; idx++) {
- this[errorProps[idx]] = tmp[errorProps[idx]];
- }
-
- if (line) {
- this.lineNumber = line;
- this.column = node.firstColumn;
- }
- }
-
- Exception.prototype = new Error();
-
- __exports__ = Exception;
- return __exports__;
-})();
-
-// handlebars/base.js
-var __module1__ = (function(__dependency1__, __dependency2__) {
- "use strict";
- var __exports__ = {};
- var Utils = __dependency1__;
- var Exception = __dependency2__;
-
- var VERSION = "2.0.0";
- __exports__.VERSION = VERSION;var COMPILER_REVISION = 6;
- __exports__.COMPILER_REVISION = COMPILER_REVISION;
- var REVISION_CHANGES = {
- 1: '<= 1.0.rc.2', // 1.0.rc.2 is actually rev2 but doesn't report it
- 2: '== 1.0.0-rc.3',
- 3: '== 1.0.0-rc.4',
- 4: '== 1.x.x',
- 5: '== 2.0.0-alpha.x',
- 6: '>= 2.0.0-beta.1'
- };
- __exports__.REVISION_CHANGES = REVISION_CHANGES;
- var isArray = Utils.isArray,
- isFunction = Utils.isFunction,
- toString = Utils.toString,
- objectType = '[object Object]';
-
- function HandlebarsEnvironment(helpers, partials) {
- this.helpers = helpers || {};
- this.partials = partials || {};
-
- registerDefaultHelpers(this);
- }
-
- __exports__.HandlebarsEnvironment = HandlebarsEnvironment;HandlebarsEnvironment.prototype = {
- constructor: HandlebarsEnvironment,
-
- logger: logger,
- log: log,
-
- registerHelper: function(name, fn) {
- if (toString.call(name) === objectType) {
- if (fn) { throw new Exception('Arg not supported with multiple helpers'); }
- Utils.extend(this.helpers, name);
- } else {
- this.helpers[name] = fn;
- }
- },
- unregisterHelper: function(name) {
- delete this.helpers[name];
- },
-
- registerPartial: function(name, partial) {
- if (toString.call(name) === objectType) {
- Utils.extend(this.partials, name);
- } else {
- this.partials[name] = partial;
- }
- },
- unregisterPartial: function(name) {
- delete this.partials[name];
- }
- };
-
- function registerDefaultHelpers(instance) {
- instance.registerHelper('helperMissing', function(/* [args, ]options */) {
- if(arguments.length === 1) {
- // A missing field in a {{foo}} constuct.
- return undefined;
- } else {
- // Someone is actually trying to call something, blow up.
- throw new Exception("Missing helper: '" + arguments[arguments.length-1].name + "'");
- }
- });
-
- instance.registerHelper('blockHelperMissing', function(context, options) {
- var inverse = options.inverse,
- fn = options.fn;
-
- if(context === true) {
- return fn(this);
- } else if(context === false || context == null) {
- return inverse(this);
- } else if (isArray(context)) {
- if(context.length > 0) {
- if (options.ids) {
- options.ids = [options.name];
- }
-
- return instance.helpers.each(context, options);
- } else {
- return inverse(this);
- }
- } else {
- if (options.data && options.ids) {
- var data = createFrame(options.data);
- data.contextPath = Utils.appendContextPath(options.data.contextPath, options.name);
- options = {data: data};
- }
-
- return fn(context, options);
- }
- });
-
- instance.registerHelper('each', function(context, options) {
- if (!options) {
- throw new Exception('Must pass iterator to #each');
- }
-
- var fn = options.fn, inverse = options.inverse;
- var i = 0, ret = "", data;
-
- var contextPath;
- if (options.data && options.ids) {
- contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]) + '.';
- }
-
- if (isFunction(context)) { context = context.call(this); }
-
- if (options.data) {
- data = createFrame(options.data);
- }
-
- if(context && typeof context === 'object') {
- if (isArray(context)) {
- for(var j = context.length; i<j; i++) {
- if (data) {
- data.index = i;
- data.first = (i === 0);
- data.last = (i === (context.length-1));
-
- if (contextPath) {
- data.contextPath = contextPath + i;
- }
- }
- ret = ret + fn(context[i], { data: data });
- }
- } else {
- for(var key in context) {
- if(context.hasOwnProperty(key)) {
- if(data) {
- data.key = key;
- data.index = i;
- data.first = (i === 0);
-
- if (contextPath) {
- data.contextPath = contextPath + key;
- }
- }
- ret = ret + fn(context[key], {data: data});
- i++;
- }
- }
- }
- }
-
- if(i === 0){
- ret = inverse(this);
- }
-
- return ret;
- });
-
- instance.registerHelper('if', function(conditional, options) {
- if (isFunction(conditional)) { conditional = conditional.call(this); }
-
- // Default behavior is to render the positive path if the value is truthy and not empty.
- // The `includeZero` option may be set to treat the condtional as purely not empty based on the
- // behavior of isEmpty. Effectively this determines if 0 is handled by the positive path or negative.
- if ((!options.hash.includeZero && !conditional) || Utils.isEmpty(conditional)) {
- return options.inverse(this);
- } else {
- return options.fn(this);
- }
- });
-
- instance.registerHelper('unless', function(conditional, options) {
- return instance.helpers['if'].call(this, conditional, {fn: options.inverse, inverse: options.fn, hash: options.hash});
- });
-
- instance.registerHelper('with', function(context, options) {
- if (isFunction(context)) { context = context.call(this); }
-
- var fn = options.fn;
-
- if (!Utils.isEmpty(context)) {
- if (options.data && options.ids) {
- var data = createFrame(options.data);
- data.contextPath = Utils.appendContextPath(options.data.contextPath, options.ids[0]);
- options = {data:data};
- }
-
- return fn(context, options);
- } else {
- return options.inverse(this);
- }
- });
-
- instance.registerHelper('log', function(message, options) {
- var level = options.data && options.data.level != null ? parseInt(options.data.level, 10) : 1;
- instance.log(level, message);
- });
-
- instance.registerHelper('lookup', function(obj, field) {
- return obj && obj[field];
- });
- }
-
- var logger = {
- methodMap: { 0: 'debug', 1: 'info', 2: 'warn', 3: 'error' },
-
- // State enum
- DEBUG: 0,
- INFO: 1,
- WARN: 2,
- ERROR: 3,
- level: 3,
-
- // can be overridden in the host environment
- log: function(level, message) {
- if (logger.level <= level) {
- var method = logger.methodMap[level];
- if (typeof console !== 'undefined' && console[method]) {
- console[method].call(console, message);
- }
- }
- }
- };
- __exports__.logger = logger;
- var log = logger.log;
- __exports__.log = log;
- var createFrame = function(object) {
- var frame = Utils.extend({}, object);
- frame._parent = object;
- return frame;
- };
- __exports__.createFrame = createFrame;
- return __exports__;
-})(__module2__, __module4__);
-
-// handlebars/runtime.js
-var __module5__ = (function(__dependency1__, __dependency2__, __dependency3__) {
- "use strict";
- var __exports__ = {};
- var Utils = __dependency1__;
- var Exception = __dependency2__;
- var COMPILER_REVISION = __dependency3__.COMPILER_REVISION;
- var REVISION_CHANGES = __dependency3__.REVISION_CHANGES;
- var createFrame = __dependency3__.createFrame;
-
- function checkRevision(compilerInfo) {
- var compilerRevision = compilerInfo && compilerInfo[0] || 1,
- currentRevision = COMPILER_REVISION;
-
- if (compilerRevision !== currentRevision) {
- if (compilerRevision < currentRevision) {
- var runtimeVersions = REVISION_CHANGES[currentRevision],
- compilerVersions = REVISION_CHANGES[compilerRevision];
- throw new Exception("Template was precompiled with an older version of Handlebars than the current runtime. "+
- "Please update your precompiler to a newer version ("+runtimeVersions+") or downgrade your runtime to an older version ("+compilerVersions+").");
- } else {
- // Use the embedded version info since the runtime doesn't know about this revision yet
- throw new Exception("Template was precompiled with a newer version of Handlebars than the current runtime. "+
- "Please update your runtime to a newer version ("+compilerInfo[1]+").");
- }
- }
- }
-
- __exports__.checkRevision = checkRevision;// TODO: Remove this line and break up compilePartial
-
- function template(templateSpec, env) {
- /* istanbul ignore next */
- if (!env) {
- throw new Exception("No environment passed to template");
- }
- if (!templateSpec || !templateSpec.main) {
- throw new Exception('Unknown template object: ' + typeof templateSpec);
- }
-
- // Note: Using env.VM references rather than local var references throughout this section to allow
- // for external users to override these as psuedo-supported APIs.
- env.VM.checkRevision(templateSpec.compiler);
-
- var invokePartialWrapper = function(partial, indent, name, context, hash, helpers, partials, data, depths) {
- if (hash) {
- context = Utils.extend({}, context, hash);
- }
-
- var result = env.VM.invokePartial.call(this, partial, name, context, helpers, partials, data, depths);
-
- if (result == null && env.compile) {
- var options = { helpers: helpers, partials: partials, data: data, depths: depths };
- partials[name] = env.compile(partial, { data: data !== undefined, compat: templateSpec.compat }, env);
- result = partials[name](context, options);
- }
- if (result != null) {
- if (indent) {
- var lines = result.split('\n');
- for (var i = 0, l = lines.length; i < l; i++) {
- if (!lines[i] && i + 1 === l) {
- break;
- }
-
- lines[i] = indent + lines[i];
- }
- result = lines.join('\n');
- }
- return result;
- } else {
- throw new Exception("The partial " + name + " could not be compiled when running in runtime-only mode");
- }
- };
-
- // Just add water
- var container = {
- lookup: function(depths, name) {
- var len = depths.length;
- for (var i = 0; i < len; i++) {
- if (depths[i] && depths[i][name] != null) {
- return depths[i][name];
- }
- }
- },
- lambda: function(current, context) {
- return typeof current === 'function' ? current.call(context) : current;
- },
-
- escapeExpression: Utils.escapeExpression,
- invokePartial: invokePartialWrapper,
-
- fn: function(i) {
- return templateSpec[i];
- },
-
- programs: [],
- program: function(i, data, depths) {
- var programWrapper = this.programs[i],
- fn = this.fn(i);
- if (data || depths) {
- programWrapper = program(this, i, fn, data, depths);
- } else if (!programWrapper) {
- programWrapper = this.programs[i] = program(this, i, fn);
- }
- return programWrapper;
- },
-
- data: function(data, depth) {
- while (data && depth--) {
- data = data._parent;
- }
- return data;
- },
- merge: function(param, common) {
- var ret = param || common;
-
- if (param && common && (param !== common)) {
- ret = Utils.extend({}, common, param);
- }
-
- return ret;
- },
-
- noop: env.VM.noop,
- compilerInfo: templateSpec.compiler
- };
-
- var ret = function(context, options) {
- options = options || {};
- var data = options.data;
-
- ret._setup(options);
- if (!options.partial && templateSpec.useData) {
- data = initData(context, data);
- }
- var depths;
- if (templateSpec.useDepths) {
- depths = options.depths ? [context].concat(options.depths) : [context];
- }
-
- return templateSpec.main.call(container, context, container.helpers, container.partials, data, depths);
- };
- ret.isTop = true;
-
- ret._setup = function(options) {
- if (!options.partial) {
- container.helpers = container.merge(options.helpers, env.helpers);
-
- if (templateSpec.usePartial) {
- container.partials = container.merge(options.partials, env.partials);
- }
- } else {
- container.helpers = options.helpers;
- container.partials = options.partials;
- }
- };
-
- ret._child = function(i, data, depths) {
- if (templateSpec.useDepths && !depths) {
- throw new Exception('must pass parent depths');
- }
-
- return program(container, i, templateSpec[i], data, depths);
- };
- return ret;
- }
-
- __exports__.template = template;function program(container, i, fn, data, depths) {
- var prog = function(context, options) {
- options = options || {};
-
- return fn.call(container, context, container.helpers, container.partials, options.data || data, depths && [context].concat(depths));
- };
- prog.program = i;
- prog.depth = depths ? depths.length : 0;
- return prog;
- }
-
- __exports__.program = program;function invokePartial(partial, name, context, helpers, partials, data, depths) {
- var options = { partial: true, helpers: helpers, partials: partials, data: data, depths: depths };
-
- if(partial === undefined) {
- throw new Exception("The partial " + name + " could not be found");
- } else if(partial instanceof Function) {
- return partial(context, options);
- }
- }
-
- __exports__.invokePartial = invokePartial;function noop() { return ""; }
-
- __exports__.noop = noop;function initData(context, data) {
- if (!data || !('root' in data)) {
- data = data ? createFrame(data) : {};
- data.root = context;
- }
- return data;
- }
- return __exports__;
-})(__module2__, __module4__, __module1__);
-
-// handlebars.runtime.js
-var __module0__ = (function(__dependency1__, __dependency2__, __dependency3__, __dependency4__, __dependency5__) {
- "use strict";
- var __exports__;
- /*globals Handlebars: true */
- var base = __dependency1__;
-
- // Each of these augment the Handlebars object. No need to setup here.
- // (This is done to easily share code between commonjs and browse envs)
- var SafeString = __dependency2__;
- var Exception = __dependency3__;
- var Utils = __dependency4__;
- var runtime = __dependency5__;
-
- // For compatibility and usage outside of module systems, make the Handlebars object a namespace
- var create = function() {
- var hb = new base.HandlebarsEnvironment();
-
- Utils.extend(hb, base);
- hb.SafeString = SafeString;
- hb.Exception = Exception;
- hb.Utils = Utils;
- hb.escapeExpression = Utils.escapeExpression;
-
- hb.VM = runtime;
- hb.template = function(spec) {
- return runtime.template(spec, hb);
- };
-
- return hb;
- };
-
- var Handlebars = create();
- Handlebars.create = create;
-
- Handlebars['default'] = Handlebars;
-
- __exports__ = Handlebars;
- return __exports__;
-})(__module1__, __module3__, __module4__, __module2__, __module5__);
-
- return __module0__;
-}));
diff --git a/browser/extensions/pocket/content/panels/js/vendor/jquery-2.1.1.min.js b/browser/extensions/pocket/content/panels/js/vendor/jquery-2.1.1.min.js
deleted file mode 100644
index 9ed2acc66d..0000000000
--- a/browser/extensions/pocket/content/panels/js/vendor/jquery-2.1.1.min.js
+++ /dev/null
@@ -1,4 +0,0 @@
-/*! jQuery v2.1.1 | (c) 2005, 2014 jQuery Foundation, Inc. | jquery.org/license */
-!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.1",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);return b.prevObject=this,b.context=this.context,b},each:function(a,b){return n.each(this,a,b)},map:function(a){return this.pushStack(n.map(this,function(b,c){return a.call(b,c,b)}))},slice:function(){return this.pushStack(d.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(a){var b=this.length,c=+a+(0>a?b:0);return this.pushStack(c>=0&&b>c?[this[c]]:[])},end:function(){return this.prevObject||this.constructor(null)},push:f,sort:c.sort,splice:c.splice},n.extend=n.fn.extend=function(){var a,b,c,d,e,f,g=arguments[0]||{},h=1,i=arguments.length,j=!1;for("boolean"==typeof g&&(j=g,g=arguments[h]||{},h++),"object"==typeof g||n.isFunction(g)||(g={}),h===i&&(g=this,h--);i>h;h++)if(null!=(a=arguments[h]))for(b in a)c=g[b],d=a[b],g!==d&&(j&&d&&(n.isPlainObject(d)||(e=n.isArray(d)))?(e?(e=!1,f=c&&n.isArray(c)?c:[]):f=c&&n.isPlainObject(c)?c:{},g[b]=n.extend(j,f,d)):void 0!==d&&(g[b]=d));return g},n.extend({expando:"jQuery"+(m+Math.random()).replace(/\D/g,""),isReady:!0,error:function(a){throw new Error(a)},noop:function(){},isFunction:function(a){return"function"===n.type(a)},isArray:Array.isArray,isWindow:function(a){return null!=a&&a===a.window},isNumeric:function(a){return!n.isArray(a)&&a-parseFloat(a)>=0},isPlainObject:function(a){return"object"!==n.type(a)||a.nodeType||n.isWindow(a)?!1:a.constructor&&!j.call(a.constructor.prototype,"isPrototypeOf")?!1:!0},isEmptyObject:function(a){var b;for(b in a)return!1;return!0},type:function(a){return null==a?a+"":"object"==typeof a||"function"==typeof a?h[i.call(a)]||"object":typeof a},globalEval:function(a){var b,c=eval;a=n.trim(a),a&&(1===a.indexOf("use strict")?(b=l.createElement("script"),b.text=a,l.head.appendChild(b).parentNode.removeChild(b)):c(a))},camelCase:function(a){return a.replace(p,"ms-").replace(q,r)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toLowerCase()===b.toLowerCase()},each:function(a,b,c){var d,e=0,f=a.length,g=s(a);if(c){if(g){for(;f>e;e++)if(d=b.apply(a[e],c),d===!1)break}else for(e in a)if(d=b.apply(a[e],c),d===!1)break}else if(g){for(;f>e;e++)if(d=b.call(a[e],e,a[e]),d===!1)break}else for(e in a)if(d=b.call(a[e],e,a[e]),d===!1)break;return a},trim:function(a){return null==a?"":(a+"").replace(o,"")},makeArray:function(a,b){var c=b||[];return null!=a&&(s(Object(a))?n.merge(c,"string"==typeof a?[a]:a):f.call(c,a)),c},inArray:function(a,b,c){return null==b?-1:g.call(b,a,c)},merge:function(a,b){for(var c=+b.length,d=0,e=a.length;c>d;d++)a[e++]=b[d];return a.length=e,a},grep:function(a,b,c){for(var d,e=[],f=0,g=a.length,h=!c;g>f;f++)d=!b(a[f],f),d!==h&&e.push(a[f]);return e},map:function(a,b,c){var d,f=0,g=a.length,h=s(a),i=[];if(h)for(;g>f;f++)d=b(a[f],f,c),null!=d&&i.push(d);else for(f in a)d=b(a[f],f,c),null!=d&&i.push(d);return e.apply([],i)},guid:1,proxy:function(a,b){var c,e,f;return"string"==typeof b&&(c=a[b],b=a,a=c),n.isFunction(a)?(e=d.call(arguments,2),f=function(){return a.apply(b||this,e.concat(d.call(arguments)))},f.guid=a.guid=a.guid||n.guid++,f):void 0},now:Date.now,support:k}),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(a,b){h["[object "+b+"]"]=b.toLowerCase()});function s(a){var b=a.length,c=n.type(a);return"function"===c||n.isWindow(a)?!1:1===a.nodeType&&b?!0:"array"===c||0===b||"number"==typeof b&&b>0&&b-1 in a}var t=function(a){var b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u="sizzle"+-new Date,v=a.document,w=0,x=0,y=gb(),z=gb(),A=gb(),B=function(a,b){return a===b&&(l=!0),0},C="undefined",D=1<<31,E={}.hasOwnProperty,F=[],G=F.pop,H=F.push,I=F.push,J=F.slice,K=F.indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(this[b]===a)return b;return-1},L="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",N="(?:\\\\.|[\\w-]|[^\\x00-\\xa0])+",O=N.replace("w","w#"),P="\\["+M+"*("+N+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+O+"))|)"+M+"*\\]",Q=":("+N+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+P+")*)|.*)\\)|)",R=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),S=new RegExp("^"+M+"*,"+M+"*"),T=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),V=new RegExp(Q),W=new RegExp("^"+O+"$"),X={ID:new RegExp("^#("+N+")"),CLASS:new RegExp("^\\.("+N+")"),TAG:new RegExp("^("+N.replace("w","w*")+")"),ATTR:new RegExp("^"+P),PSEUDO:new RegExp("^"+Q),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+L+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/^(?:input|select|textarea|button)$/i,Z=/^h\d$/i,$=/^[^{]+\{\s*\[native \w/,_=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ab=/[+~]/,bb=/'|\\/g,cb=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),db=function(a,b,c){var d="0x"+b-65536;return d!==d||c?b:0>d?String.fromCharCode(d+65536):String.fromCharCode(d>>10|55296,1023&d|56320)};try{I.apply(F=J.call(v.childNodes),v.childNodes),F[v.childNodes.length].nodeType}catch(eb){I={apply:F.length?function(a,b){H.apply(a,J.call(b))}:function(a,b){var c=a.length,d=0;while(a[c++]=b[d++]);a.length=c-1}}}function fb(a,b,d,e){var f,h,j,k,l,o,r,s,w,x;if((b?b.ownerDocument||b:v)!==n&&m(b),b=b||n,d=d||[],!a||"string"!=typeof a)return d;if(1!==(k=b.nodeType)&&9!==k)return[];if(p&&!e){if(f=_.exec(a))if(j=f[1]){if(9===k){if(h=b.getElementById(j),!h||!h.parentNode)return d;if(h.id===j)return d.push(h),d}else if(b.ownerDocument&&(h=b.ownerDocument.getElementById(j))&&t(b,h)&&h.id===j)return d.push(h),d}else{if(f[2])return I.apply(d,b.getElementsByTagName(a)),d;if((j=f[3])&&c.getElementsByClassName&&b.getElementsByClassName)return I.apply(d,b.getElementsByClassName(j)),d}if(c.qsa&&(!q||!q.test(a))){if(s=r=u,w=b,x=9===k&&a,1===k&&"object"!==b.nodeName.toLowerCase()){o=g(a),(r=b.getAttribute("id"))?s=r.replace(bb,"\\$&"):b.setAttribute("id",s),s="[id='"+s+"'] ",l=o.length;while(l--)o[l]=s+qb(o[l]);w=ab.test(a)&&ob(b.parentNode)||b,x=o.join(",")}if(x)try{return I.apply(d,w.querySelectorAll(x)),d}catch(y){}finally{r||b.removeAttribute("id")}}}return i(a.replace(R,"$1"),b,d,e)}function gb(){var a=[];function b(c,e){return a.push(c+" ")>d.cacheLength&&delete b[a.shift()],b[c+" "]=e}return b}function hb(a){return a[u]=!0,a}function ib(a){var b=n.createElement("div");try{return!!a(b)}catch(c){return!1}finally{b.parentNode&&b.parentNode.removeChild(b),b=null}}function jb(a,b){var c=a.split("|"),e=a.length;while(e--)d.attrHandle[c[e]]=b}function kb(a,b){var c=b&&a,d=c&&1===a.nodeType&&1===b.nodeType&&(~b.sourceIndex||D)-(~a.sourceIndex||D);if(d)return d;if(c)while(c=c.nextSibling)if(c===b)return-1;return a?1:-1}function lb(a){return function(b){var c=b.nodeName.toLowerCase();return"input"===c&&b.type===a}}function mb(a){return function(b){var c=b.nodeName.toLowerCase();return("input"===c||"button"===c)&&b.type===a}}function nb(a){return hb(function(b){return b=+b,hb(function(c,d){var e,f=a([],c.length,b),g=f.length;while(g--)c[e=f[g]]&&(c[e]=!(d[e]=c[e]))})})}function ob(a){return a&&typeof a.getElementsByTagName!==C&&a}c=fb.support={},f=fb.isXML=function(a){var b=a&&(a.ownerDocument||a).documentElement;return b?"HTML"!==b.nodeName:!1},m=fb.setDocument=function(a){var b,e=a?a.ownerDocument||a:v,g=e.defaultView;return e!==n&&9===e.nodeType&&e.documentElement?(n=e,o=e.documentElement,p=!f(e),g&&g!==g.top&&(g.addEventListener?g.addEventListener("unload",function(){m()},!1):g.attachEvent&&g.attachEvent("onunload",function(){m()})),c.attributes=ib(function(a){return a.className="i",!a.getAttribute("className")}),c.getElementsByTagName=ib(function(a){return a.appendChild(e.createComment("")),!a.getElementsByTagName("*").length}),c.getElementsByClassName=$.test(e.getElementsByClassName)&&ib(function(a){return a.innerHTML="<div class='a'></div><div class='a i'></div>",a.firstChild.className="i",2===a.getElementsByClassName("i").length}),c.getById=ib(function(a){return o.appendChild(a).id=u,!e.getElementsByName||!e.getElementsByName(u).length}),c.getById?(d.find.ID=function(a,b){if(typeof b.getElementById!==C&&p){var c=b.getElementById(a);return c&&c.parentNode?[c]:[]}},d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){return a.getAttribute("id")===b}}):(delete d.find.ID,d.filter.ID=function(a){var b=a.replace(cb,db);return function(a){var c=typeof a.getAttributeNode!==C&&a.getAttributeNode("id");return c&&c.value===b}}),d.find.TAG=c.getElementsByTagName?function(a,b){return typeof b.getElementsByTagName!==C?b.getElementsByTagName(a):void 0}:function(a,b){var c,d=[],e=0,f=b.getElementsByTagName(a);if("*"===a){while(c=f[e++])1===c.nodeType&&d.push(c);return d}return f},d.find.CLASS=c.getElementsByClassName&&function(a,b){return typeof b.getElementsByClassName!==C&&p?b.getElementsByClassName(a):void 0},r=[],q=[],(c.qsa=$.test(e.querySelectorAll))&&(ib(function(a){a.innerHTML="<select msallowclip=''><option selected=''></option></select>",a.querySelectorAll("[msallowclip^='']").length&&q.push("[*^$]="+M+"*(?:''|\"\")"),a.querySelectorAll("[selected]").length||q.push("\\["+M+"*(?:value|"+L+")"),a.querySelectorAll(":checked").length||q.push(":checked")}),ib(function(a){var b=e.createElement("input");b.setAttribute("type","hidden"),a.appendChild(b).setAttribute("name","D"),a.querySelectorAll("[name=d]").length&&q.push("name"+M+"*[*^$|!~]?="),a.querySelectorAll(":enabled").length||q.push(":enabled",":disabled"),a.querySelectorAll("*,:x"),q.push(",.*:")})),(c.matchesSelector=$.test(s=o.matches||o.webkitMatchesSelector||o.mozMatchesSelector||o.oMatchesSelector||o.msMatchesSelector))&&ib(function(a){c.disconnectedMatch=s.call(a,"div"),s.call(a,"[s!='']:x"),r.push("!=",Q)}),q=q.length&&new RegExp(q.join("|")),r=r.length&&new RegExp(r.join("|")),b=$.test(o.compareDocumentPosition),t=b||$.test(o.contains)?function(a,b){var c=9===a.nodeType?a.documentElement:a,d=b&&b.parentNode;return a===d||!(!d||1!==d.nodeType||!(c.contains?c.contains(d):a.compareDocumentPosition&&16&a.compareDocumentPosition(d)))}:function(a,b){if(b)while(b=b.parentNode)if(b===a)return!0;return!1},B=b?function(a,b){if(a===b)return l=!0,0;var d=!a.compareDocumentPosition-!b.compareDocumentPosition;return d?d:(d=(a.ownerDocument||a)===(b.ownerDocument||b)?a.compareDocumentPosition(b):1,1&d||!c.sortDetached&&b.compareDocumentPosition(a)===d?a===e||a.ownerDocument===v&&t(v,a)?-1:b===e||b.ownerDocument===v&&t(v,b)?1:k?K.call(k,a)-K.call(k,b):0:4&d?-1:1)}:function(a,b){if(a===b)return l=!0,0;var c,d=0,f=a.parentNode,g=b.parentNode,h=[a],i=[b];if(!f||!g)return a===e?-1:b===e?1:f?-1:g?1:k?K.call(k,a)-K.call(k,b):0;if(f===g)return kb(a,b);c=a;while(c=c.parentNode)h.unshift(c);c=b;while(c=c.parentNode)i.unshift(c);while(h[d]===i[d])d++;return d?kb(h[d],i[d]):h[d]===v?-1:i[d]===v?1:0},e):n},fb.matches=function(a,b){return fb(a,null,null,b)},fb.matchesSelector=function(a,b){if((a.ownerDocument||a)!==n&&m(a),b=b.replace(U,"='$1']"),!(!c.matchesSelector||!p||r&&r.test(b)||q&&q.test(b)))try{var d=s.call(a,b);if(d||c.disconnectedMatch||a.document&&11!==a.document.nodeType)return d}catch(e){}return fb(b,n,null,[a]).length>0},fb.contains=function(a,b){return(a.ownerDocument||a)!==n&&m(a),t(a,b)},fb.attr=function(a,b){(a.ownerDocument||a)!==n&&m(a);var e=d.attrHandle[b.toLowerCase()],f=e&&E.call(d.attrHandle,b.toLowerCase())?e(a,b,!p):void 0;return void 0!==f?f:c.attributes||!p?a.getAttribute(b):(f=a.getAttributeNode(b))&&f.specified?f.value:null},fb.error=function(a){throw new Error("Syntax error, unrecognized expression: "+a)},fb.uniqueSort=function(a){var b,d=[],e=0,f=0;if(l=!c.detectDuplicates,k=!c.sortStable&&a.slice(0),a.sort(B),l){while(b=a[f++])b===a[f]&&(e=d.push(f));while(e--)a.splice(d[e],1)}return k=null,a},e=fb.getText=function(a){var b,c="",d=0,f=a.nodeType;if(f){if(1===f||9===f||11===f){if("string"==typeof a.textContent)return a.textContent;for(a=a.firstChild;a;a=a.nextSibling)c+=e(a)}else if(3===f||4===f)return a.nodeValue}else while(b=a[d++])c+=e(b);return c},d=fb.selectors={cacheLength:50,createPseudo:hb,match:X,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(a){return a[1]=a[1].replace(cb,db),a[3]=(a[3]||a[4]||a[5]||"").replace(cb,db),"~="===a[2]&&(a[3]=" "+a[3]+" "),a.slice(0,4)},CHILD:function(a){return a[1]=a[1].toLowerCase(),"nth"===a[1].slice(0,3)?(a[3]||fb.error(a[0]),a[4]=+(a[4]?a[5]+(a[6]||1):2*("even"===a[3]||"odd"===a[3])),a[5]=+(a[7]+a[8]||"odd"===a[3])):a[3]&&fb.error(a[0]),a},PSEUDO:function(a){var b,c=!a[6]&&a[2];return X.CHILD.test(a[0])?null:(a[3]?a[2]=a[4]||a[5]||"":c&&V.test(c)&&(b=g(c,!0))&&(b=c.indexOf(")",c.length-b)-c.length)&&(a[0]=a[0].slice(0,b),a[2]=c.slice(0,b)),a.slice(0,3))}},filter:{TAG:function(a){var b=a.replace(cb,db).toLowerCase();return"*"===a?function(){return!0}:function(a){return a.nodeName&&a.nodeName.toLowerCase()===b}},CLASS:function(a){var b=y[a+" "];return b||(b=new RegExp("(^|"+M+")"+a+"("+M+"|$)"))&&y(a,function(a){return b.test("string"==typeof a.className&&a.className||typeof a.getAttribute!==C&&a.getAttribute("class")||"")})},ATTR:function(a,b,c){return function(d){var e=fb.attr(d,a);return null==e?"!="===b:b?(e+="","="===b?e===c:"!="===b?e!==c:"^="===b?c&&0===e.indexOf(c):"*="===b?c&&e.indexOf(c)>-1:"$="===b?c&&e.slice(-c.length)===c:"~="===b?(" "+e+" ").indexOf(c)>-1:"|="===b?e===c||e.slice(0,c.length+1)===c+"-":!1):!0}},CHILD:function(a,b,c,d,e){var f="nth"!==a.slice(0,3),g="last"!==a.slice(-4),h="of-type"===b;return 1===d&&0===e?function(a){return!!a.parentNode}:function(b,c,i){var j,k,l,m,n,o,p=f!==g?"nextSibling":"previousSibling",q=b.parentNode,r=h&&b.nodeName.toLowerCase(),s=!i&&!h;if(q){if(f){while(p){l=b;while(l=l[p])if(h?l.nodeName.toLowerCase()===r:1===l.nodeType)return!1;o=p="only"===a&&!o&&"nextSibling"}return!0}if(o=[g?q.firstChild:q.lastChild],g&&s){k=q[u]||(q[u]={}),j=k[a]||[],n=j[0]===w&&j[1],m=j[0]===w&&j[2],l=n&&q.childNodes[n];while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if(1===l.nodeType&&++m&&l===b){k[a]=[w,n,m];break}}else if(s&&(j=(b[u]||(b[u]={}))[a])&&j[0]===w)m=j[1];else while(l=++n&&l&&l[p]||(m=n=0)||o.pop())if((h?l.nodeName.toLowerCase()===r:1===l.nodeType)&&++m&&(s&&((l[u]||(l[u]={}))[a]=[w,m]),l===b))break;return m-=e,m===d||m%d===0&&m/d>=0}}},PSEUDO:function(a,b){var c,e=d.pseudos[a]||d.setFilters[a.toLowerCase()]||fb.error("unsupported pseudo: "+a);return e[u]?e(b):e.length>1?(c=[a,a,"",b],d.setFilters.hasOwnProperty(a.toLowerCase())?hb(function(a,c){var d,f=e(a,b),g=f.length;while(g--)d=K.call(a,f[g]),a[d]=!(c[d]=f[g])}):function(a){return e(a,0,c)}):e}},pseudos:{not:hb(function(a){var b=[],c=[],d=h(a.replace(R,"$1"));return d[u]?hb(function(a,b,c,e){var f,g=d(a,null,e,[]),h=a.length;while(h--)(f=g[h])&&(a[h]=!(b[h]=f))}):function(a,e,f){return b[0]=a,d(b,null,f,c),!c.pop()}}),has:hb(function(a){return function(b){return fb(a,b).length>0}}),contains:hb(function(a){return function(b){return(b.textContent||b.innerText||e(b)).indexOf(a)>-1}}),lang:hb(function(a){return W.test(a||"")||fb.error("unsupported lang: "+a),a=a.replace(cb,db).toLowerCase(),function(b){var c;do if(c=p?b.lang:b.getAttribute("xml:lang")||b.getAttribute("lang"))return c=c.toLowerCase(),c===a||0===c.indexOf(a+"-");while((b=b.parentNode)&&1===b.nodeType);return!1}}),target:function(b){var c=a.location&&a.location.hash;return c&&c.slice(1)===b.id},root:function(a){return a===o},focus:function(a){return a===n.activeElement&&(!n.hasFocus||n.hasFocus())&&!!(a.type||a.href||~a.tabIndex)},enabled:function(a){return a.disabled===!1},disabled:function(a){return a.disabled===!0},checked:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&!!a.checked||"option"===b&&!!a.selected},selected:function(a){return a.parentNode&&a.parentNode.selectedIndex,a.selected===!0},empty:function(a){for(a=a.firstChild;a;a=a.nextSibling)if(a.nodeType<6)return!1;return!0},parent:function(a){return!d.pseudos.empty(a)},header:function(a){return Z.test(a.nodeName)},input:function(a){return Y.test(a.nodeName)},button:function(a){var b=a.nodeName.toLowerCase();return"input"===b&&"button"===a.type||"button"===b},text:function(a){var b;return"input"===a.nodeName.toLowerCase()&&"text"===a.type&&(null==(b=a.getAttribute("type"))||"text"===b.toLowerCase())},first:nb(function(){return[0]}),last:nb(function(a,b){return[b-1]}),eq:nb(function(a,b,c){return[0>c?c+b:c]}),even:nb(function(a,b){for(var c=0;b>c;c+=2)a.push(c);return a}),odd:nb(function(a,b){for(var c=1;b>c;c+=2)a.push(c);return a}),lt:nb(function(a,b,c){for(var d=0>c?c+b:c;--d>=0;)a.push(d);return a}),gt:nb(function(a,b,c){for(var d=0>c?c+b:c;++d<b;)a.push(d);return a})}},d.pseudos.nth=d.pseudos.eq;for(b in{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})d.pseudos[b]=lb(b);for(b in{submit:!0,reset:!0})d.pseudos[b]=mb(b);function pb(){}pb.prototype=d.filters=d.pseudos,d.setFilters=new pb,g=fb.tokenize=function(a,b){var c,e,f,g,h,i,j,k=z[a+" "];if(k)return b?0:k.slice(0);h=a,i=[],j=d.preFilter;while(h){(!c||(e=S.exec(h)))&&(e&&(h=h.slice(e[0].length)||h),i.push(f=[])),c=!1,(e=T.exec(h))&&(c=e.shift(),f.push({value:c,type:e[0].replace(R," ")}),h=h.slice(c.length));for(g in d.filter)!(e=X[g].exec(h))||j[g]&&!(e=j[g](e))||(c=e.shift(),f.push({value:c,type:g,matches:e}),h=h.slice(c.length));if(!c)break}return b?h.length:h?fb.error(a):z(a,i).slice(0)};function qb(a){for(var b=0,c=a.length,d="";c>b;b++)d+=a[b].value;return d}function rb(a,b,c){var d=b.dir,e=c&&"parentNode"===d,f=x++;return b.first?function(b,c,f){while(b=b[d])if(1===b.nodeType||e)return a(b,c,f)}:function(b,c,g){var h,i,j=[w,f];if(g){while(b=b[d])if((1===b.nodeType||e)&&a(b,c,g))return!0}else while(b=b[d])if(1===b.nodeType||e){if(i=b[u]||(b[u]={}),(h=i[d])&&h[0]===w&&h[1]===f)return j[2]=h[2];if(i[d]=j,j[2]=a(b,c,g))return!0}}}function sb(a){return a.length>1?function(b,c,d){var e=a.length;while(e--)if(!a[e](b,c,d))return!1;return!0}:a[0]}function tb(a,b,c){for(var d=0,e=b.length;e>d;d++)fb(a,b[d],c);return c}function ub(a,b,c,d,e){for(var f,g=[],h=0,i=a.length,j=null!=b;i>h;h++)(f=a[h])&&(!c||c(f,d,e))&&(g.push(f),j&&b.push(h));return g}function vb(a,b,c,d,e,f){return d&&!d[u]&&(d=vb(d)),e&&!e[u]&&(e=vb(e,f)),hb(function(f,g,h,i){var j,k,l,m=[],n=[],o=g.length,p=f||tb(b||"*",h.nodeType?[h]:h,[]),q=!a||!f&&b?p:ub(p,m,a,h,i),r=c?e||(f?a:o||d)?[]:g:q;if(c&&c(q,r,h,i),d){j=ub(r,n),d(j,[],h,i),k=j.length;while(k--)(l=j[k])&&(r[n[k]]=!(q[n[k]]=l))}if(f){if(e||a){if(e){j=[],k=r.length;while(k--)(l=r[k])&&j.push(q[k]=l);e(null,r=[],j,i)}k=r.length;while(k--)(l=r[k])&&(j=e?K.call(f,l):m[k])>-1&&(f[j]=!(g[j]=l))}}else r=ub(r===g?r.splice(o,r.length):r),e?e(null,g,r,i):I.apply(g,r)})}function wb(a){for(var b,c,e,f=a.length,g=d.relative[a[0].type],h=g||d.relative[" "],i=g?1:0,k=rb(function(a){return a===b},h,!0),l=rb(function(a){return K.call(b,a)>-1},h,!0),m=[function(a,c,d){return!g&&(d||c!==j)||((b=c).nodeType?k(a,c,d):l(a,c,d))}];f>i;i++)if(c=d.relative[a[i].type])m=[rb(sb(m),c)];else{if(c=d.filter[a[i].type].apply(null,a[i].matches),c[u]){for(e=++i;f>e;e++)if(d.relative[a[e].type])break;return vb(i>1&&sb(m),i>1&&qb(a.slice(0,i-1).concat({value:" "===a[i-2].type?"*":""})).replace(R,"$1"),c,e>i&&wb(a.slice(i,e)),f>e&&wb(a=a.slice(e)),f>e&&qb(a))}m.push(c)}return sb(m)}function xb(a,b){var c=b.length>0,e=a.length>0,f=function(f,g,h,i,k){var l,m,o,p=0,q="0",r=f&&[],s=[],t=j,u=f||e&&d.find.TAG("*",k),v=w+=null==t?1:Math.random()||.1,x=u.length;for(k&&(j=g!==n&&g);q!==x&&null!=(l=u[q]);q++){if(e&&l){m=0;while(o=a[m++])if(o(l,g,h)){i.push(l);break}k&&(w=v)}c&&((l=!o&&l)&&p--,f&&r.push(l))}if(p+=q,c&&q!==p){m=0;while(o=b[m++])o(r,s,g,h);if(f){if(p>0)while(q--)r[q]||s[q]||(s[q]=G.call(i));s=ub(s)}I.apply(i,s),k&&!f&&s.length>0&&p+b.length>1&&fb.uniqueSort(i)}return k&&(w=v,j=t),r};return c?hb(f):f}return h=fb.compile=function(a,b){var c,d=[],e=[],f=A[a+" "];if(!f){b||(b=g(a)),c=b.length;while(c--)f=wb(b[c]),f[u]?d.push(f):e.push(f);f=A(a,xb(e,d)),f.selector=a}return f},i=fb.select=function(a,b,e,f){var i,j,k,l,m,n="function"==typeof a&&a,o=!f&&g(a=n.selector||a);if(e=e||[],1===o.length){if(j=o[0]=o[0].slice(0),j.length>2&&"ID"===(k=j[0]).type&&c.getById&&9===b.nodeType&&p&&d.relative[j[1].type]){if(b=(d.find.ID(k.matches[0].replace(cb,db),b)||[])[0],!b)return e;n&&(b=b.parentNode),a=a.slice(j.shift().value.length)}i=X.needsContext.test(a)?0:j.length;while(i--){if(k=j[i],d.relative[l=k.type])break;if((m=d.find[l])&&(f=m(k.matches[0].replace(cb,db),ab.test(j[0].type)&&ob(b.parentNode)||b))){if(j.splice(i,1),a=f.length&&qb(j),!a)return I.apply(e,f),e;break}}}return(n||h(a,o))(f,b,!p,e,ab.test(a)&&ob(b.parentNode)||b),e},c.sortStable=u.split("").sort(B).join("")===u,c.detectDuplicates=!!l,m(),c.sortDetached=ib(function(a){return 1&a.compareDocumentPosition(n.createElement("div"))}),ib(function(a){return a.innerHTML="<a href='#'></a>","#"===a.firstChild.getAttribute("href")})||jb("type|href|height|width",function(a,b,c){return c?void 0:a.getAttribute(b,"type"===b.toLowerCase()?1:2)}),c.attributes&&ib(function(a){return a.innerHTML="<input/>",a.firstChild.setAttribute("value",""),""===a.firstChild.getAttribute("value")})||jb("value",function(a,b,c){return c||"input"!==a.nodeName.toLowerCase()?void 0:a.defaultValue}),ib(function(a){return null==a.getAttribute("disabled")})||jb(L,function(a,b,c){var d;return c?void 0:a[b]===!0?b.toLowerCase():(d=a.getAttributeNode(b))&&d.specified?d.value:null}),fb}(a);n.find=t,n.expr=t.selectors,n.expr[":"]=n.expr.pseudos,n.unique=t.uniqueSort,n.text=t.getText,n.isXMLDoc=t.isXML,n.contains=t.contains;var u=n.expr.match.needsContext,v=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,w=/^.[^:#\[\.,]*$/;function x(a,b,c){if(n.isFunction(b))return n.grep(a,function(a,d){return!!b.call(a,d,a)!==c});if(b.nodeType)return n.grep(a,function(a){return a===b!==c});if("string"==typeof b){if(w.test(b))return n.filter(b,a,c);b=n.filter(b,a)}return n.grep(a,function(a){return g.call(b,a)>=0!==c})}n.filter=function(a,b,c){var d=b[0];return c&&(a=":not("+a+")"),1===b.length&&1===d.nodeType?n.find.matchesSelector(d,a)?[d]:[]:n.find.matches(a,n.grep(b,function(a){return 1===a.nodeType}))},n.fn.extend({find:function(a){var b,c=this.length,d=[],e=this;if("string"!=typeof a)return this.pushStack(n(a).filter(function(){for(b=0;c>b;b++)if(n.contains(e[b],this))return!0}));for(b=0;c>b;b++)n.find(a,e[b],d);return d=this.pushStack(c>1?n.unique(d):d),d.selector=this.selector?this.selector+" "+a:a,d},filter:function(a){return this.pushStack(x(this,a||[],!1))},not:function(a){return this.pushStack(x(this,a||[],!0))},is:function(a){return!!x(this,"string"==typeof a&&u.test(a)?n(a):a||[],!1).length}});var y,z=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]*))$/,A=n.fn.init=function(a,b){var c,d;if(!a)return this;if("string"==typeof a){if(c="<"===a[0]&&">"===a[a.length-1]&&a.length>=3?[null,a,null]:z.exec(a),!c||!c[1]&&b)return!b||b.jquery?(b||y).find(a):this.constructor(b).find(a);if(c[1]){if(b=b instanceof n?b[0]:b,n.merge(this,n.parseHTML(c[1],b&&b.nodeType?b.ownerDocument||b:l,!0)),v.test(c[1])&&n.isPlainObject(b))for(c in b)n.isFunction(this[c])?this[c](b[c]):this.attr(c,b[c]);return this}return d=l.getElementById(c[2]),d&&d.parentNode&&(this.length=1,this[0]=d),this.context=l,this.selector=a,this}return a.nodeType?(this.context=this[0]=a,this.length=1,this):n.isFunction(a)?"undefined"!=typeof y.ready?y.ready(a):a(n):(void 0!==a.selector&&(this.selector=a.selector,this.context=a.context),n.makeArray(a,this))};A.prototype=n.fn,y=n(l);var B=/^(?:parents|prev(?:Until|All))/,C={children:!0,contents:!0,next:!0,prev:!0};n.extend({dir:function(a,b,c){var d=[],e=void 0!==c;while((a=a[b])&&9!==a.nodeType)if(1===a.nodeType){if(e&&n(a).is(c))break;d.push(a)}return d},sibling:function(a,b){for(var c=[];a;a=a.nextSibling)1===a.nodeType&&a!==b&&c.push(a);return c}}),n.fn.extend({has:function(a){var b=n(a,this),c=b.length;return this.filter(function(){for(var a=0;c>a;a++)if(n.contains(this,b[a]))return!0})},closest:function(a,b){for(var c,d=0,e=this.length,f=[],g=u.test(a)||"string"!=typeof a?n(a,b||this.context):0;e>d;d++)for(c=this[d];c&&c!==b;c=c.parentNode)if(c.nodeType<11&&(g?g.index(c)>-1:1===c.nodeType&&n.find.matchesSelector(c,a))){f.push(c);break}return this.pushStack(f.length>1?n.unique(f):f)},index:function(a){return a?"string"==typeof a?g.call(n(a),this[0]):g.call(this,a.jquery?a[0]:a):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(a,b){return this.pushStack(n.unique(n.merge(this.get(),n(a,b))))},addBack:function(a){return this.add(null==a?this.prevObject:this.prevObject.filter(a))}});function D(a,b){while((a=a[b])&&1!==a.nodeType);return a}n.each({parent:function(a){var b=a.parentNode;return b&&11!==b.nodeType?b:null},parents:function(a){return n.dir(a,"parentNode")},parentsUntil:function(a,b,c){return n.dir(a,"parentNode",c)},next:function(a){return D(a,"nextSibling")},prev:function(a){return D(a,"previousSibling")},nextAll:function(a){return n.dir(a,"nextSibling")},prevAll:function(a){return n.dir(a,"previousSibling")},nextUntil:function(a,b,c){return n.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return n.dir(a,"previousSibling",c)},siblings:function(a){return n.sibling((a.parentNode||{}).firstChild,a)},children:function(a){return n.sibling(a.firstChild)},contents:function(a){return a.contentDocument||n.merge([],a.childNodes)}},function(a,b){n.fn[a]=function(c,d){var e=n.map(this,b,c);return"Until"!==a.slice(-5)&&(d=c),d&&"string"==typeof d&&(e=n.filter(d,e)),this.length>1&&(C[a]||n.unique(e),B.test(a)&&e.reverse()),this.pushStack(e)}});var E=/\S+/g,F={};function G(a){var b=F[a]={};return n.each(a.match(E)||[],function(a,c){b[c]=!0}),b}n.Callbacks=function(a){a="string"==typeof a?F[a]||G(a):n.extend({},a);var b,c,d,e,f,g,h=[],i=!a.once&&[],j=function(l){for(b=a.memory&&l,c=!0,g=e||0,e=0,f=h.length,d=!0;h&&f>g;g++)if(h[g].apply(l[0],l[1])===!1&&a.stopOnFalse){b=!1;break}d=!1,h&&(i?i.length&&j(i.shift()):b?h=[]:k.disable())},k={add:function(){if(h){var c=h.length;!function g(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&g(c)})}(arguments),d?f=h.length:b&&(e=c,j(b))}return this},remove:function(){return h&&n.each(arguments,function(a,b){var c;while((c=n.inArray(b,h,c))>-1)h.splice(c,1),d&&(f>=c&&f--,g>=c&&g--)}),this},has:function(a){return a?n.inArray(a,h)>-1:!(!h||!h.length)},empty:function(){return h=[],f=0,this},disable:function(){return h=i=b=void 0,this},disabled:function(){return!h},lock:function(){return i=void 0,b||k.disable(),this},locked:function(){return!i},fireWith:function(a,b){return!h||c&&!i||(b=b||[],b=[a,b.slice?b.slice():b],d?i.push(b):j(b)),this},fire:function(){return k.fireWith(this,arguments),this},fired:function(){return!!c}};return k},n.extend({Deferred:function(a){var b=[["resolve","done",n.Callbacks("once memory"),"resolved"],["reject","fail",n.Callbacks("once memory"),"rejected"],["notify","progress",n.Callbacks("memory")]],c="pending",d={state:function(){return c},always:function(){return e.done(arguments).fail(arguments),this},then:function(){var a=arguments;return n.Deferred(function(c){n.each(b,function(b,f){var g=n.isFunction(a[b])&&a[b];e[f[1]](function(){var a=g&&g.apply(this,arguments);a&&n.isFunction(a.promise)?a.promise().done(c.resolve).fail(c.reject).progress(c.notify):c[f[0]+"With"](this===d?c.promise():this,g?[a]:arguments)})}),a=null}).promise()},promise:function(a){return null!=a?n.extend(a,d):d}},e={};return d.pipe=d.then,n.each(b,function(a,f){var g=f[2],h=f[3];d[f[1]]=g.add,h&&g.add(function(){c=h},b[1^a][2].disable,b[2][2].lock),e[f[0]]=function(){return e[f[0]+"With"](this===e?d:this,arguments),this},e[f[0]+"With"]=g.fireWith}),d.promise(e),a&&a.call(e,e),e},when:function(a){var b=0,c=d.call(arguments),e=c.length,f=1!==e||a&&n.isFunction(a.promise)?e:0,g=1===f?a:n.Deferred(),h=function(a,b,c){return function(e){b[a]=this,c[a]=arguments.length>1?d.call(arguments):e,c===i?g.notifyWith(b,c):--f||g.resolveWith(b,c)}},i,j,k;if(e>1)for(i=new Array(e),j=new Array(e),k=new Array(e);e>b;b++)c[b]&&n.isFunction(c[b].promise)?c[b].promise().done(h(b,k,c)).fail(g.reject).progress(h(b,j,i)):--f;return f||g.resolveWith(k,c),g.promise()}});var H;n.fn.ready=function(a){return n.ready.promise().done(a),this},n.extend({isReady:!1,readyWait:1,holdReady:function(a){a?n.readyWait++:n.ready(!0)},ready:function(a){(a===!0?--n.readyWait:n.isReady)||(n.isReady=!0,a!==!0&&--n.readyWait>0||(H.resolveWith(l,[n]),n.fn.triggerHandler&&(n(l).triggerHandler("ready"),n(l).off("ready"))))}});function I(){l.removeEventListener("DOMContentLoaded",I,!1),a.removeEventListener("load",I,!1),n.ready()}n.ready.promise=function(b){return H||(H=n.Deferred(),"complete"===l.readyState?setTimeout(n.ready):(l.addEventListener("DOMContentLoaded",I,!1),a.addEventListener("load",I,!1))),H.promise(b)},n.ready.promise();var J=n.access=function(a,b,c,d,e,f,g){var h=0,i=a.length,j=null==c;if("object"===n.type(c)){e=!0;for(h in c)n.access(a,b,h,c[h],!0,f,g)}else if(void 0!==d&&(e=!0,n.isFunction(d)||(g=!0),j&&(g?(b.call(a,d),b=null):(j=b,b=function(a,b,c){return j.call(n(a),c)})),b))for(;i>h;h++)b(a[h],c,g?d:d.call(a[h],h,b(a[h],c)));return e?a:j?b.call(a):i?b(a[0],c):f};n.acceptData=function(a){return 1===a.nodeType||9===a.nodeType||!+a.nodeType};function K(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=n.expando+Math.random()}K.uid=1,K.accepts=n.acceptData,K.prototype={key:function(a){if(!K.accepts(a))return 0;var b={},c=a[this.expando];if(!c){c=K.uid++;try{b[this.expando]={value:c},Object.defineProperties(a,b)}catch(d){b[this.expando]=c,n.extend(a,b)}}return this.cache[c]||(this.cache[c]={}),c},set:function(a,b,c){var d,e=this.key(a),f=this.cache[e];if("string"==typeof b)f[b]=c;else if(n.isEmptyObject(f))n.extend(this.cache[e],b);else for(d in b)f[d]=b[d];return f},get:function(a,b){var c=this.cache[this.key(a)];return void 0===b?c:c[b]},access:function(a,b,c){var d;return void 0===b||b&&"string"==typeof b&&void 0===c?(d=this.get(a,b),void 0!==d?d:this.get(a,n.camelCase(b))):(this.set(a,b,c),void 0!==c?c:b)},remove:function(a,b){var c,d,e,f=this.key(a),g=this.cache[f];if(void 0===b)this.cache[f]={};else{n.isArray(b)?d=b.concat(b.map(n.camelCase)):(e=n.camelCase(b),b in g?d=[b,e]:(d=e,d=d in g?[d]:d.match(E)||[])),c=d.length;while(c--)delete g[d[c]]}},hasData:function(a){return!n.isEmptyObject(this.cache[a[this.expando]]||{})},discard:function(a){a[this.expando]&&delete this.cache[a[this.expando]]}};var L=new K,M=new K,N=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,O=/([A-Z])/g;function P(a,b,c){var d;if(void 0===c&&1===a.nodeType)if(d="data-"+b.replace(O,"-$1").toLowerCase(),c=a.getAttribute(d),"string"==typeof c){try{c="true"===c?!0:"false"===c?!1:"null"===c?null:+c+""===c?+c:N.test(c)?n.parseJSON(c):c}catch(e){}M.set(a,b,c)}else c=void 0;return c}n.extend({hasData:function(a){return M.hasData(a)||L.hasData(a)},data:function(a,b,c){return M.access(a,b,c)},removeData:function(a,b){M.remove(a,b)
-},_data:function(a,b,c){return L.access(a,b,c)},_removeData:function(a,b){L.remove(a,b)}}),n.fn.extend({data:function(a,b){var c,d,e,f=this[0],g=f&&f.attributes;if(void 0===a){if(this.length&&(e=M.get(f),1===f.nodeType&&!L.get(f,"hasDataAttrs"))){c=g.length;while(c--)g[c]&&(d=g[c].name,0===d.indexOf("data-")&&(d=n.camelCase(d.slice(5)),P(f,d,e[d])));L.set(f,"hasDataAttrs",!0)}return e}return"object"==typeof a?this.each(function(){M.set(this,a)}):J(this,function(b){var c,d=n.camelCase(a);if(f&&void 0===b){if(c=M.get(f,a),void 0!==c)return c;if(c=M.get(f,d),void 0!==c)return c;if(c=P(f,d,void 0),void 0!==c)return c}else this.each(function(){var c=M.get(this,d);M.set(this,d,b),-1!==a.indexOf("-")&&void 0!==c&&M.set(this,a,b)})},null,b,arguments.length>1,null,!0)},removeData:function(a){return this.each(function(){M.remove(this,a)})}}),n.extend({queue:function(a,b,c){var d;return a?(b=(b||"fx")+"queue",d=L.get(a,b),c&&(!d||n.isArray(c)?d=L.access(a,b,n.makeArray(c)):d.push(c)),d||[]):void 0},dequeue:function(a,b){b=b||"fx";var c=n.queue(a,b),d=c.length,e=c.shift(),f=n._queueHooks(a,b),g=function(){n.dequeue(a,b)};"inprogress"===e&&(e=c.shift(),d--),e&&("fx"===b&&c.unshift("inprogress"),delete f.stop,e.call(a,g,f)),!d&&f&&f.empty.fire()},_queueHooks:function(a,b){var c=b+"queueHooks";return L.get(a,c)||L.access(a,c,{empty:n.Callbacks("once memory").add(function(){L.remove(a,[b+"queue",c])})})}}),n.fn.extend({queue:function(a,b){var c=2;return"string"!=typeof a&&(b=a,a="fx",c--),arguments.length<c?n.queue(this[0],a):void 0===b?this:this.each(function(){var c=n.queue(this,a,b);n._queueHooks(this,a),"fx"===a&&"inprogress"!==c[0]&&n.dequeue(this,a)})},dequeue:function(a){return this.each(function(){n.dequeue(this,a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,b){var c,d=1,e=n.Deferred(),f=this,g=this.length,h=function(){--d||e.resolveWith(f,[f])};"string"!=typeof a&&(b=a,a=void 0),a=a||"fx";while(g--)c=L.get(f[g],a+"queueHooks"),c&&c.empty&&(d++,c.empty.add(h));return h(),e.promise(b)}});var Q=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,R=["Top","Right","Bottom","Left"],S=function(a,b){return a=b||a,"none"===n.css(a,"display")||!n.contains(a.ownerDocument,a)},T=/^(?:checkbox|radio)$/i;!function(){var a=l.createDocumentFragment(),b=a.appendChild(l.createElement("div")),c=l.createElement("input");c.setAttribute("type","radio"),c.setAttribute("checked","checked"),c.setAttribute("name","t"),b.appendChild(c),k.checkClone=b.cloneNode(!0).cloneNode(!0).lastChild.checked,b.innerHTML="<textarea>x</textarea>",k.noCloneChecked=!!b.cloneNode(!0).lastChild.defaultValue}();var U="undefined";k.focusinBubbles="onfocusin"in a;var V=/^key/,W=/^(?:mouse|pointer|contextmenu)|click/,X=/^(?:focusinfocus|focusoutblur)$/,Y=/^([^.]*)(?:\.(.+)|)$/;function Z(){return!0}function $(){return!1}function _(){try{return l.activeElement}catch(a){}}n.event={global:{},add:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.get(a);if(r){c.handler&&(f=c,c=f.handler,e=f.selector),c.guid||(c.guid=n.guid++),(i=r.events)||(i=r.events={}),(g=r.handle)||(g=r.handle=function(b){return typeof n!==U&&n.event.triggered!==b.type?n.event.dispatch.apply(a,arguments):void 0}),b=(b||"").match(E)||[""],j=b.length;while(j--)h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o&&(l=n.event.special[o]||{},o=(e?l.delegateType:l.bindType)||o,l=n.event.special[o]||{},k=n.extend({type:o,origType:q,data:d,handler:c,guid:c.guid,selector:e,needsContext:e&&n.expr.match.needsContext.test(e),namespace:p.join(".")},f),(m=i[o])||(m=i[o]=[],m.delegateCount=0,l.setup&&l.setup.call(a,d,p,g)!==!1||a.addEventListener&&a.addEventListener(o,g,!1)),l.add&&(l.add.call(a,k),k.handler.guid||(k.handler.guid=c.guid)),e?m.splice(m.delegateCount++,0,k):m.push(k),n.event.global[o]=!0)}},remove:function(a,b,c,d,e){var f,g,h,i,j,k,l,m,o,p,q,r=L.hasData(a)&&L.get(a);if(r&&(i=r.events)){b=(b||"").match(E)||[""],j=b.length;while(j--)if(h=Y.exec(b[j])||[],o=q=h[1],p=(h[2]||"").split(".").sort(),o){l=n.event.special[o]||{},o=(d?l.delegateType:l.bindType)||o,m=i[o]||[],h=h[2]&&new RegExp("(^|\\.)"+p.join("\\.(?:.*\\.|)")+"(\\.|$)"),g=f=m.length;while(f--)k=m[f],!e&&q!==k.origType||c&&c.guid!==k.guid||h&&!h.test(k.namespace)||d&&d!==k.selector&&("**"!==d||!k.selector)||(m.splice(f,1),k.selector&&m.delegateCount--,l.remove&&l.remove.call(a,k));g&&!m.length&&(l.teardown&&l.teardown.call(a,p,r.handle)!==!1||n.removeEvent(a,o,r.handle),delete i[o])}else for(o in i)n.event.remove(a,o+b[j],c,d,!0);n.isEmptyObject(i)&&(delete r.handle,L.remove(a,"events"))}},trigger:function(b,c,d,e){var f,g,h,i,k,m,o,p=[d||l],q=j.call(b,"type")?b.type:b,r=j.call(b,"namespace")?b.namespace.split("."):[];if(g=h=d=d||l,3!==d.nodeType&&8!==d.nodeType&&!X.test(q+n.event.triggered)&&(q.indexOf(".")>=0&&(r=q.split("."),q=r.shift(),r.sort()),k=q.indexOf(":")<0&&"on"+q,b=b[n.expando]?b:new n.Event(q,"object"==typeof b&&b),b.isTrigger=e?2:3,b.namespace=r.join("."),b.namespace_re=b.namespace?new RegExp("(^|\\.)"+r.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,b.result=void 0,b.target||(b.target=d),c=null==c?[b]:n.makeArray(c,[b]),o=n.event.special[q]||{},e||!o.trigger||o.trigger.apply(d,c)!==!1)){if(!e&&!o.noBubble&&!n.isWindow(d)){for(i=o.delegateType||q,X.test(i+q)||(g=g.parentNode);g;g=g.parentNode)p.push(g),h=g;h===(d.ownerDocument||l)&&p.push(h.defaultView||h.parentWindow||a)}f=0;while((g=p[f++])&&!b.isPropagationStopped())b.type=f>1?i:o.bindType||q,m=(L.get(g,"events")||{})[b.type]&&L.get(g,"handle"),m&&m.apply(g,c),m=k&&g[k],m&&m.apply&&n.acceptData(g)&&(b.result=m.apply(g,c),b.result===!1&&b.preventDefault());return b.type=q,e||b.isDefaultPrevented()||o._default&&o._default.apply(p.pop(),c)!==!1||!n.acceptData(d)||k&&n.isFunction(d[q])&&!n.isWindow(d)&&(h=d[k],h&&(d[k]=null),n.event.triggered=q,d[q](),n.event.triggered=void 0,h&&(d[k]=h)),b.result}},dispatch:function(a){a=n.event.fix(a);var b,c,e,f,g,h=[],i=d.call(arguments),j=(L.get(this,"events")||{})[a.type]||[],k=n.event.special[a.type]||{};if(i[0]=a,a.delegateTarget=this,!k.preDispatch||k.preDispatch.call(this,a)!==!1){h=n.event.handlers.call(this,a,j),b=0;while((f=h[b++])&&!a.isPropagationStopped()){a.currentTarget=f.elem,c=0;while((g=f.handlers[c++])&&!a.isImmediatePropagationStopped())(!a.namespace_re||a.namespace_re.test(g.namespace))&&(a.handleObj=g,a.data=g.data,e=((n.event.special[g.origType]||{}).handle||g.handler).apply(f.elem,i),void 0!==e&&(a.result=e)===!1&&(a.preventDefault(),a.stopPropagation()))}return k.postDispatch&&k.postDispatch.call(this,a),a.result}},handlers:function(a,b){var c,d,e,f,g=[],h=b.delegateCount,i=a.target;if(h&&i.nodeType&&(!a.button||"click"!==a.type))for(;i!==this;i=i.parentNode||this)if(i.disabled!==!0||"click"!==a.type){for(d=[],c=0;h>c;c++)f=b[c],e=f.selector+" ",void 0===d[e]&&(d[e]=f.needsContext?n(e,this).index(i)>=0:n.find(e,this,null,[i]).length),d[e]&&d.push(f);d.length&&g.push({elem:i,handlers:d})}return h<b.length&&g.push({elem:this,handlers:b.slice(h)}),g},props:"altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "),fixHooks:{},keyHooks:{props:"char charCode key keyCode".split(" "),filter:function(a,b){return null==a.which&&(a.which=null!=b.charCode?b.charCode:b.keyCode),a}},mouseHooks:{props:"button buttons clientX clientY offsetX offsetY pageX pageY screenX screenY toElement".split(" "),filter:function(a,b){var c,d,e,f=b.button;return null==a.pageX&&null!=b.clientX&&(c=a.target.ownerDocument||l,d=c.documentElement,e=c.body,a.pageX=b.clientX+(d&&d.scrollLeft||e&&e.scrollLeft||0)-(d&&d.clientLeft||e&&e.clientLeft||0),a.pageY=b.clientY+(d&&d.scrollTop||e&&e.scrollTop||0)-(d&&d.clientTop||e&&e.clientTop||0)),a.which||void 0===f||(a.which=1&f?1:2&f?3:4&f?2:0),a}},fix:function(a){if(a[n.expando])return a;var b,c,d,e=a.type,f=a,g=this.fixHooks[e];g||(this.fixHooks[e]=g=W.test(e)?this.mouseHooks:V.test(e)?this.keyHooks:{}),d=g.props?this.props.concat(g.props):this.props,a=new n.Event(f),b=d.length;while(b--)c=d[b],a[c]=f[c];return a.target||(a.target=l),3===a.target.nodeType&&(a.target=a.target.parentNode),g.filter?g.filter(a,f):a},special:{load:{noBubble:!0},focus:{trigger:function(){return this!==_()&&this.focus?(this.focus(),!1):void 0},delegateType:"focusin"},blur:{trigger:function(){return this===_()&&this.blur?(this.blur(),!1):void 0},delegateType:"focusout"},click:{trigger:function(){return"checkbox"===this.type&&this.click&&n.nodeName(this,"input")?(this.click(),!1):void 0},_default:function(a){return n.nodeName(a.target,"a")}},beforeunload:{postDispatch:function(a){void 0!==a.result&&a.originalEvent&&(a.originalEvent.returnValue=a.result)}}},simulate:function(a,b,c,d){var e=n.extend(new n.Event,c,{type:a,isSimulated:!0,originalEvent:{}});d?n.event.trigger(e,null,b):n.event.dispatch.call(b,e),e.isDefaultPrevented()&&c.preventDefault()}},n.removeEvent=function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)},n.Event=function(a,b){return this instanceof n.Event?(a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||void 0===a.defaultPrevented&&a.returnValue===!1?Z:$):this.type=a,b&&n.extend(this,b),this.timeStamp=a&&a.timeStamp||n.now(),void(this[n.expando]=!0)):new n.Event(a,b)},n.Event.prototype={isDefaultPrevented:$,isPropagationStopped:$,isImmediatePropagationStopped:$,preventDefault:function(){var a=this.originalEvent;this.isDefaultPrevented=Z,a&&a.preventDefault&&a.preventDefault()},stopPropagation:function(){var a=this.originalEvent;this.isPropagationStopped=Z,a&&a.stopPropagation&&a.stopPropagation()},stopImmediatePropagation:function(){var a=this.originalEvent;this.isImmediatePropagationStopped=Z,a&&a.stopImmediatePropagation&&a.stopImmediatePropagation(),this.stopPropagation()}},n.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(a,b){n.event.special[a]={delegateType:b,bindType:b,handle:function(a){var c,d=this,e=a.relatedTarget,f=a.handleObj;return(!e||e!==d&&!n.contains(d,e))&&(a.type=f.origType,c=f.handler.apply(this,arguments),a.type=b),c}}}),k.focusinBubbles||n.each({focus:"focusin",blur:"focusout"},function(a,b){var c=function(a){n.event.simulate(b,a.target,n.event.fix(a),!0)};n.event.special[b]={setup:function(){var d=this.ownerDocument||this,e=L.access(d,b);e||d.addEventListener(a,c,!0),L.access(d,b,(e||0)+1)},teardown:function(){var d=this.ownerDocument||this,e=L.access(d,b)-1;e?L.access(d,b,e):(d.removeEventListener(a,c,!0),L.remove(d,b))}}}),n.fn.extend({on:function(a,b,c,d,e){var f,g;if("object"==typeof a){"string"!=typeof b&&(c=c||b,b=void 0);for(g in a)this.on(g,b,c,a[g],e);return this}if(null==c&&null==d?(d=b,c=b=void 0):null==d&&("string"==typeof b?(d=c,c=void 0):(d=c,c=b,b=void 0)),d===!1)d=$;else if(!d)return this;return 1===e&&(f=d,d=function(a){return n().off(a),f.apply(this,arguments)},d.guid=f.guid||(f.guid=n.guid++)),this.each(function(){n.event.add(this,a,d,c,b)})},one:function(a,b,c,d){return this.on(a,b,c,d,1)},off:function(a,b,c){var d,e;if(a&&a.preventDefault&&a.handleObj)return d=a.handleObj,n(a.delegateTarget).off(d.namespace?d.origType+"."+d.namespace:d.origType,d.selector,d.handler),this;if("object"==typeof a){for(e in a)this.off(e,b,a[e]);return this}return(b===!1||"function"==typeof b)&&(c=b,b=void 0),c===!1&&(c=$),this.each(function(){n.event.remove(this,a,c,b)})},trigger:function(a,b){return this.each(function(){n.event.trigger(a,b,this)})},triggerHandler:function(a,b){var c=this[0];return c?n.event.trigger(a,b,c,!0):void 0}});var ab=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,bb=/<([\w:]+)/,cb=/<|&#?\w+;/,db=/<(?:script|style|link)/i,eb=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/^$|\/(?:java|ecma)script/i,gb=/^true\/(.*)/,hb=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g,ib={option:[1,"<select multiple='multiple'>","</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ib.optgroup=ib.option,ib.tbody=ib.tfoot=ib.colgroup=ib.caption=ib.thead,ib.th=ib.td;function jb(a,b){return n.nodeName(a,"table")&&n.nodeName(11!==b.nodeType?b:b.firstChild,"tr")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function kb(a){return a.type=(null!==a.getAttribute("type"))+"/"+a.type,a}function lb(a){var b=gb.exec(a.type);return b?a.type=b[1]:a.removeAttribute("type"),a}function mb(a,b){for(var c=0,d=a.length;d>c;c++)L.set(a[c],"globalEval",!b||L.get(b[c],"globalEval"))}function nb(a,b){var c,d,e,f,g,h,i,j;if(1===b.nodeType){if(L.hasData(a)&&(f=L.access(a),g=L.set(b,f),j=f.events)){delete g.handle,g.events={};for(e in j)for(c=0,d=j[e].length;d>c;c++)n.event.add(b,e,j[e][c])}M.hasData(a)&&(h=M.access(a),i=n.extend({},h),M.set(b,i))}}function ob(a,b){var c=a.getElementsByTagName?a.getElementsByTagName(b||"*"):a.querySelectorAll?a.querySelectorAll(b||"*"):[];return void 0===b||b&&n.nodeName(a,b)?n.merge([a],c):c}function pb(a,b){var c=b.nodeName.toLowerCase();"input"===c&&T.test(a.type)?b.checked=a.checked:("input"===c||"textarea"===c)&&(b.defaultValue=a.defaultValue)}n.extend({clone:function(a,b,c){var d,e,f,g,h=a.cloneNode(!0),i=n.contains(a.ownerDocument,a);if(!(k.noCloneChecked||1!==a.nodeType&&11!==a.nodeType||n.isXMLDoc(a)))for(g=ob(h),f=ob(a),d=0,e=f.length;e>d;d++)pb(f[d],g[d]);if(b)if(c)for(f=f||ob(a),g=g||ob(h),d=0,e=f.length;e>d;d++)nb(f[d],g[d]);else nb(a,h);return g=ob(h,"script"),g.length>0&&mb(g,!i&&ob(a,"script")),h},buildFragment:function(a,b,c,d){for(var e,f,g,h,i,j,k=b.createDocumentFragment(),l=[],m=0,o=a.length;o>m;m++)if(e=a[m],e||0===e)if("object"===n.type(e))n.merge(l,e.nodeType?[e]:e);else if(cb.test(e)){f=f||k.appendChild(b.createElement("div")),g=(bb.exec(e)||["",""])[1].toLowerCase(),h=ib[g]||ib._default,f.innerHTML=h[1]+e.replace(ab,"<$1></$2>")+h[2],j=h[0];while(j--)f=f.lastChild;n.merge(l,f.childNodes),f=k.firstChild,f.textContent=""}else l.push(b.createTextNode(e));k.textContent="",m=0;while(e=l[m++])if((!d||-1===n.inArray(e,d))&&(i=n.contains(e.ownerDocument,e),f=ob(k.appendChild(e),"script"),i&&mb(f),c)){j=0;while(e=f[j++])fb.test(e.type||"")&&c.push(e)}return k},cleanData:function(a){for(var b,c,d,e,f=n.event.special,g=0;void 0!==(c=a[g]);g++){if(n.acceptData(c)&&(e=c[L.expando],e&&(b=L.cache[e]))){if(b.events)for(d in b.events)f[d]?n.event.remove(c,d):n.removeEvent(c,d,b.handle);L.cache[e]&&delete L.cache[e]}delete M.cache[c[M.expando]]}}}),n.fn.extend({text:function(a){return J(this,function(a){return void 0===a?n.text(this):this.empty().each(function(){(1===this.nodeType||11===this.nodeType||9===this.nodeType)&&(this.textContent=a)})},null,a,arguments.length)},append:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.appendChild(a)}})},prepend:function(){return this.domManip(arguments,function(a){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var b=jb(this,a);b.insertBefore(a,b.firstChild)}})},before:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this)})},after:function(){return this.domManip(arguments,function(a){this.parentNode&&this.parentNode.insertBefore(a,this.nextSibling)})},remove:function(a,b){for(var c,d=a?n.filter(a,this):this,e=0;null!=(c=d[e]);e++)b||1!==c.nodeType||n.cleanData(ob(c)),c.parentNode&&(b&&n.contains(c.ownerDocument,c)&&mb(ob(c,"script")),c.parentNode.removeChild(c));return this},empty:function(){for(var a,b=0;null!=(a=this[b]);b++)1===a.nodeType&&(n.cleanData(ob(a,!1)),a.textContent="");return this},clone:function(a,b){return a=null==a?!1:a,b=null==b?a:b,this.map(function(){return n.clone(this,a,b)})},html:function(a){return J(this,function(a){var b=this[0]||{},c=0,d=this.length;if(void 0===a&&1===b.nodeType)return b.innerHTML;if("string"==typeof a&&!db.test(a)&&!ib[(bb.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(ab,"<$1></$2>");try{for(;d>c;c++)b=this[c]||{},1===b.nodeType&&(n.cleanData(ob(b,!1)),b.innerHTML=a);b=0}catch(e){}}b&&this.empty().append(a)},null,a,arguments.length)},replaceWith:function(){var a=arguments[0];return this.domManip(arguments,function(b){a=this.parentNode,n.cleanData(ob(this)),a&&a.replaceChild(b,this)}),a&&(a.length||a.nodeType)?this:this.remove()},detach:function(a){return this.remove(a,!0)},domManip:function(a,b){a=e.apply([],a);var c,d,f,g,h,i,j=0,l=this.length,m=this,o=l-1,p=a[0],q=n.isFunction(p);if(q||l>1&&"string"==typeof p&&!k.checkClone&&eb.test(p))return this.each(function(c){var d=m.eq(c);q&&(a[0]=p.call(this,c,d.html())),d.domManip(a,b)});if(l&&(c=n.buildFragment(a,this[0].ownerDocument,!1,this),d=c.firstChild,1===c.childNodes.length&&(c=d),d)){for(f=n.map(ob(c,"script"),kb),g=f.length;l>j;j++)h=c,j!==o&&(h=n.clone(h,!0,!0),g&&n.merge(f,ob(h,"script"))),b.call(this[j],h,j);if(g)for(i=f[f.length-1].ownerDocument,n.map(f,lb),j=0;g>j;j++)h=f[j],fb.test(h.type||"")&&!L.access(h,"globalEval")&&n.contains(i,h)&&(h.src?n._evalUrl&&n._evalUrl(h.src):n.globalEval(h.textContent.replace(hb,"")))}return this}}),n.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){n.fn[a]=function(a){for(var c,d=[],e=n(a),g=e.length-1,h=0;g>=h;h++)c=h===g?this:this.clone(!0),n(e[h])[b](c),f.apply(d,c.get());return this.pushStack(d)}});var qb,rb={};function sb(b,c){var d,e=n(c.createElement(b)).appendTo(c.body),f=a.getDefaultComputedStyle&&(d=a.getDefaultComputedStyle(e[0]))?d.display:n.css(e[0],"display");return e.detach(),f}function tb(a){var b=l,c=rb[a];return c||(c=sb(a,b),"none"!==c&&c||(qb=(qb||n("<iframe frameborder='0' width='0' height='0'/>")).appendTo(b.documentElement),b=qb[0].contentDocument,b.write(),b.close(),c=sb(a,b),qb.detach()),rb[a]=c),c}var ub=/^margin/,vb=new RegExp("^("+Q+")(?!px)[a-z%]+$","i"),wb=function(a){return a.ownerDocument.defaultView.getComputedStyle(a,null)};function xb(a,b,c){var d,e,f,g,h=a.style;return c=c||wb(a),c&&(g=c.getPropertyValue(b)||c[b]),c&&(""!==g||n.contains(a.ownerDocument,a)||(g=n.style(a,b)),vb.test(g)&&ub.test(b)&&(d=h.width,e=h.minWidth,f=h.maxWidth,h.minWidth=h.maxWidth=h.width=g,g=c.width,h.width=d,h.minWidth=e,h.maxWidth=f)),void 0!==g?g+"":g}function yb(a,b){return{get:function(){return a()?void delete this.get:(this.get=b).apply(this,arguments)}}}!function(){var b,c,d=l.documentElement,e=l.createElement("div"),f=l.createElement("div");if(f.style){f.style.backgroundClip="content-box",f.cloneNode(!0).style.backgroundClip="",k.clearCloneStyle="content-box"===f.style.backgroundClip,e.style.cssText="border:0;width:0;height:0;top:0;left:-9999px;margin-top:1px;position:absolute",e.appendChild(f);function g(){f.style.cssText="-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;display:block;margin-top:1%;top:1%;border:1px;padding:1px;width:4px;position:absolute",f.innerHTML="",d.appendChild(e);var g=a.getComputedStyle(f,null);b="1%"!==g.top,c="4px"===g.width,d.removeChild(e)}a.getComputedStyle&&n.extend(k,{pixelPosition:function(){return g(),b},boxSizingReliable:function(){return null==c&&g(),c},reliableMarginRight:function(){var b,c=f.appendChild(l.createElement("div"));return c.style.cssText=f.style.cssText="-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;display:block;margin:0;border:0;padding:0",c.style.marginRight=c.style.width="0",f.style.width="1px",d.appendChild(e),b=!parseFloat(a.getComputedStyle(c,null).marginRight),d.removeChild(e),b}})}}(),n.swap=function(a,b,c,d){var e,f,g={};for(f in b)g[f]=a.style[f],a.style[f]=b[f];e=c.apply(a,d||[]);for(f in b)a.style[f]=g[f];return e};var zb=/^(none|table(?!-c[ea]).+)/,Ab=new RegExp("^("+Q+")(.*)$","i"),Bb=new RegExp("^([+-])=("+Q+")","i"),Cb={position:"absolute",visibility:"hidden",display:"block"},Db={letterSpacing:"0",fontWeight:"400"},Eb=["Webkit","O","Moz","ms"];function Fb(a,b){if(b in a)return b;var c=b[0].toUpperCase()+b.slice(1),d=b,e=Eb.length;while(e--)if(b=Eb[e]+c,b in a)return b;return d}function Gb(a,b,c){var d=Ab.exec(b);return d?Math.max(0,d[1]-(c||0))+(d[2]||"px"):b}function Hb(a,b,c,d,e){for(var f=c===(d?"border":"content")?4:"width"===b?1:0,g=0;4>f;f+=2)"margin"===c&&(g+=n.css(a,c+R[f],!0,e)),d?("content"===c&&(g-=n.css(a,"padding"+R[f],!0,e)),"margin"!==c&&(g-=n.css(a,"border"+R[f]+"Width",!0,e))):(g+=n.css(a,"padding"+R[f],!0,e),"padding"!==c&&(g+=n.css(a,"border"+R[f]+"Width",!0,e)));return g}function Ib(a,b,c){var d=!0,e="width"===b?a.offsetWidth:a.offsetHeight,f=wb(a),g="border-box"===n.css(a,"boxSizing",!1,f);if(0>=e||null==e){if(e=xb(a,b,f),(0>e||null==e)&&(e=a.style[b]),vb.test(e))return e;d=g&&(k.boxSizingReliable()||e===a.style[b]),e=parseFloat(e)||0}return e+Hb(a,b,c||(g?"border":"content"),d,f)+"px"}function Jb(a,b){for(var c,d,e,f=[],g=0,h=a.length;h>g;g++)d=a[g],d.style&&(f[g]=L.get(d,"olddisplay"),c=d.style.display,b?(f[g]||"none"!==c||(d.style.display=""),""===d.style.display&&S(d)&&(f[g]=L.access(d,"olddisplay",tb(d.nodeName)))):(e=S(d),"none"===c&&e||L.set(d,"olddisplay",e?c:n.css(d,"display"))));for(g=0;h>g;g++)d=a[g],d.style&&(b&&"none"!==d.style.display&&""!==d.style.display||(d.style.display=b?f[g]||"":"none"));return a}n.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=xb(a,"opacity");return""===c?"1":c}}}},cssNumber:{columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":"cssFloat"},style:function(a,b,c,d){if(a&&3!==a.nodeType&&8!==a.nodeType&&a.style){var e,f,g,h=n.camelCase(b),i=a.style;return b=n.cssProps[h]||(n.cssProps[h]=Fb(i,h)),g=n.cssHooks[b]||n.cssHooks[h],void 0===c?g&&"get"in g&&void 0!==(e=g.get(a,!1,d))?e:i[b]:(f=typeof c,"string"===f&&(e=Bb.exec(c))&&(c=(e[1]+1)*e[2]+parseFloat(n.css(a,b)),f="number"),null!=c&&c===c&&("number"!==f||n.cssNumber[h]||(c+="px"),k.clearCloneStyle||""!==c||0!==b.indexOf("background")||(i[b]="inherit"),g&&"set"in g&&void 0===(c=g.set(a,c,d))||(i[b]=c)),void 0)}},css:function(a,b,c,d){var e,f,g,h=n.camelCase(b);return b=n.cssProps[h]||(n.cssProps[h]=Fb(a.style,h)),g=n.cssHooks[b]||n.cssHooks[h],g&&"get"in g&&(e=g.get(a,!0,c)),void 0===e&&(e=xb(a,b,d)),"normal"===e&&b in Db&&(e=Db[b]),""===c||c?(f=parseFloat(e),c===!0||n.isNumeric(f)?f||0:e):e}}),n.each(["height","width"],function(a,b){n.cssHooks[b]={get:function(a,c,d){return c?zb.test(n.css(a,"display"))&&0===a.offsetWidth?n.swap(a,Cb,function(){return Ib(a,b,d)}):Ib(a,b,d):void 0},set:function(a,c,d){var e=d&&wb(a);return Gb(a,c,d?Hb(a,b,d,"border-box"===n.css(a,"boxSizing",!1,e),e):0)}}}),n.cssHooks.marginRight=yb(k.reliableMarginRight,function(a,b){return b?n.swap(a,{display:"inline-block"},xb,[a,"marginRight"]):void 0}),n.each({margin:"",padding:"",border:"Width"},function(a,b){n.cssHooks[a+b]={expand:function(c){for(var d=0,e={},f="string"==typeof c?c.split(" "):[c];4>d;d++)e[a+R[d]+b]=f[d]||f[d-2]||f[0];return e}},ub.test(a)||(n.cssHooks[a+b].set=Gb)}),n.fn.extend({css:function(a,b){return J(this,function(a,b,c){var d,e,f={},g=0;if(n.isArray(b)){for(d=wb(a),e=b.length;e>g;g++)f[b[g]]=n.css(a,b[g],!1,d);return f}return void 0!==c?n.style(a,b,c):n.css(a,b)},a,b,arguments.length>1)},show:function(){return Jb(this,!0)},hide:function(){return Jb(this)},toggle:function(a){return"boolean"==typeof a?a?this.show():this.hide():this.each(function(){S(this)?n(this).show():n(this).hide()})}});function Kb(a,b,c,d,e){return new Kb.prototype.init(a,b,c,d,e)}n.Tween=Kb,Kb.prototype={constructor:Kb,init:function(a,b,c,d,e,f){this.elem=a,this.prop=c,this.easing=e||"swing",this.options=b,this.start=this.now=this.cur(),this.end=d,this.unit=f||(n.cssNumber[c]?"":"px")},cur:function(){var a=Kb.propHooks[this.prop];return a&&a.get?a.get(this):Kb.propHooks._default.get(this)},run:function(a){var b,c=Kb.propHooks[this.prop];return this.pos=b=this.options.duration?n.easing[this.easing](a,this.options.duration*a,0,1,this.options.duration):a,this.now=(this.end-this.start)*b+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),c&&c.set?c.set(this):Kb.propHooks._default.set(this),this}},Kb.prototype.init.prototype=Kb.prototype,Kb.propHooks={_default:{get:function(a){var b;return null==a.elem[a.prop]||a.elem.style&&null!=a.elem.style[a.prop]?(b=n.css(a.elem,a.prop,""),b&&"auto"!==b?b:0):a.elem[a.prop]},set:function(a){n.fx.step[a.prop]?n.fx.step[a.prop](a):a.elem.style&&(null!=a.elem.style[n.cssProps[a.prop]]||n.cssHooks[a.prop])?n.style(a.elem,a.prop,a.now+a.unit):a.elem[a.prop]=a.now}}},Kb.propHooks.scrollTop=Kb.propHooks.scrollLeft={set:function(a){a.elem.nodeType&&a.elem.parentNode&&(a.elem[a.prop]=a.now)}},n.easing={linear:function(a){return a},swing:function(a){return.5-Math.cos(a*Math.PI)/2}},n.fx=Kb.prototype.init,n.fx.step={};var Lb,Mb,Nb=/^(?:toggle|show|hide)$/,Ob=new RegExp("^(?:([+-])=|)("+Q+")([a-z%]*)$","i"),Pb=/queueHooks$/,Qb=[Vb],Rb={"*":[function(a,b){var c=this.createTween(a,b),d=c.cur(),e=Ob.exec(b),f=e&&e[3]||(n.cssNumber[a]?"":"px"),g=(n.cssNumber[a]||"px"!==f&&+d)&&Ob.exec(n.css(c.elem,a)),h=1,i=20;if(g&&g[3]!==f){f=f||g[3],e=e||[],g=+d||1;do h=h||".5",g/=h,n.style(c.elem,a,g+f);while(h!==(h=c.cur()/d)&&1!==h&&--i)}return e&&(g=c.start=+g||+d||0,c.unit=f,c.end=e[1]?g+(e[1]+1)*e[2]:+e[2]),c}]};function Sb(){return setTimeout(function(){Lb=void 0}),Lb=n.now()}function Tb(a,b){var c,d=0,e={height:a};for(b=b?1:0;4>d;d+=2-b)c=R[d],e["margin"+c]=e["padding"+c]=a;return b&&(e.opacity=e.width=a),e}function Ub(a,b,c){for(var d,e=(Rb[b]||[]).concat(Rb["*"]),f=0,g=e.length;g>f;f++)if(d=e[f].call(c,b,a))return d}function Vb(a,b,c){var d,e,f,g,h,i,j,k,l=this,m={},o=a.style,p=a.nodeType&&S(a),q=L.get(a,"fxshow");c.queue||(h=n._queueHooks(a,"fx"),null==h.unqueued&&(h.unqueued=0,i=h.empty.fire,h.empty.fire=function(){h.unqueued||i()}),h.unqueued++,l.always(function(){l.always(function(){h.unqueued--,n.queue(a,"fx").length||h.empty.fire()})})),1===a.nodeType&&("height"in b||"width"in b)&&(c.overflow=[o.overflow,o.overflowX,o.overflowY],j=n.css(a,"display"),k="none"===j?L.get(a,"olddisplay")||tb(a.nodeName):j,"inline"===k&&"none"===n.css(a,"float")&&(o.display="inline-block")),c.overflow&&(o.overflow="hidden",l.always(function(){o.overflow=c.overflow[0],o.overflowX=c.overflow[1],o.overflowY=c.overflow[2]}));for(d in b)if(e=b[d],Nb.exec(e)){if(delete b[d],f=f||"toggle"===e,e===(p?"hide":"show")){if("show"!==e||!q||void 0===q[d])continue;p=!0}m[d]=q&&q[d]||n.style(a,d)}else j=void 0;if(n.isEmptyObject(m))"inline"===("none"===j?tb(a.nodeName):j)&&(o.display=j);else{q?"hidden"in q&&(p=q.hidden):q=L.access(a,"fxshow",{}),f&&(q.hidden=!p),p?n(a).show():l.done(function(){n(a).hide()}),l.done(function(){var b;L.remove(a,"fxshow");for(b in m)n.style(a,b,m[b])});for(d in m)g=Ub(p?q[d]:0,d,l),d in q||(q[d]=g.start,p&&(g.end=g.start,g.start="width"===d||"height"===d?1:0))}}function Wb(a,b){var c,d,e,f,g;for(c in a)if(d=n.camelCase(c),e=b[d],f=a[c],n.isArray(f)&&(e=f[1],f=a[c]=f[0]),c!==d&&(a[d]=f,delete a[c]),g=n.cssHooks[d],g&&"expand"in g){f=g.expand(f),delete a[d];for(c in f)c in a||(a[c]=f[c],b[c]=e)}else b[d]=e}function Xb(a,b,c){var d,e,f=0,g=Qb.length,h=n.Deferred().always(function(){delete i.elem}),i=function(){if(e)return!1;for(var b=Lb||Sb(),c=Math.max(0,j.startTime+j.duration-b),d=c/j.duration||0,f=1-d,g=0,i=j.tweens.length;i>g;g++)j.tweens[g].run(f);return h.notifyWith(a,[j,f,c]),1>f&&i?c:(h.resolveWith(a,[j]),!1)},j=h.promise({elem:a,props:n.extend({},b),opts:n.extend(!0,{specialEasing:{}},c),originalProperties:b,originalOptions:c,startTime:Lb||Sb(),duration:c.duration,tweens:[],createTween:function(b,c){var d=n.Tween(a,j.opts,b,c,j.opts.specialEasing[b]||j.opts.easing);return j.tweens.push(d),d},stop:function(b){var c=0,d=b?j.tweens.length:0;if(e)return this;for(e=!0;d>c;c++)j.tweens[c].run(1);return b?h.resolveWith(a,[j,b]):h.rejectWith(a,[j,b]),this}}),k=j.props;for(Wb(k,j.opts.specialEasing);g>f;f++)if(d=Qb[f].call(j,a,k,j.opts))return d;return n.map(k,Ub,j),n.isFunction(j.opts.start)&&j.opts.start.call(a,j),n.fx.timer(n.extend(i,{elem:a,anim:j,queue:j.opts.queue})),j.progress(j.opts.progress).done(j.opts.done,j.opts.complete).fail(j.opts.fail).always(j.opts.always)}n.Animation=n.extend(Xb,{tweener:function(a,b){n.isFunction(a)?(b=a,a=["*"]):a=a.split(" ");for(var c,d=0,e=a.length;e>d;d++)c=a[d],Rb[c]=Rb[c]||[],Rb[c].unshift(b)},prefilter:function(a,b){b?Qb.unshift(a):Qb.push(a)}}),n.speed=function(a,b,c){var d=a&&"object"==typeof a?n.extend({},a):{complete:c||!c&&b||n.isFunction(a)&&a,duration:a,easing:c&&b||b&&!n.isFunction(b)&&b};return d.duration=n.fx.off?0:"number"==typeof d.duration?d.duration:d.duration in n.fx.speeds?n.fx.speeds[d.duration]:n.fx.speeds._default,(null==d.queue||d.queue===!0)&&(d.queue="fx"),d.old=d.complete,d.complete=function(){n.isFunction(d.old)&&d.old.call(this),d.queue&&n.dequeue(this,d.queue)},d},n.fn.extend({fadeTo:function(a,b,c,d){return this.filter(S).css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=n.isEmptyObject(a),f=n.speed(b,c,d),g=function(){var b=Xb(this,n.extend({},a),f);(e||L.get(this,"finish"))&&b.stop(!0)};return g.finish=g,e||f.queue===!1?this.each(g):this.queue(f.queue,g)},stop:function(a,b,c){var d=function(a){var b=a.stop;delete a.stop,b(c)};return"string"!=typeof a&&(c=b,b=a,a=void 0),b&&a!==!1&&this.queue(a||"fx",[]),this.each(function(){var b=!0,e=null!=a&&a+"queueHooks",f=n.timers,g=L.get(this);if(e)g[e]&&g[e].stop&&d(g[e]);else for(e in g)g[e]&&g[e].stop&&Pb.test(e)&&d(g[e]);for(e=f.length;e--;)f[e].elem!==this||null!=a&&f[e].queue!==a||(f[e].anim.stop(c),b=!1,f.splice(e,1));(b||!c)&&n.dequeue(this,a)})},finish:function(a){return a!==!1&&(a=a||"fx"),this.each(function(){var b,c=L.get(this),d=c[a+"queue"],e=c[a+"queueHooks"],f=n.timers,g=d?d.length:0;for(c.finish=!0,n.queue(this,a,[]),e&&e.stop&&e.stop.call(this,!0),b=f.length;b--;)f[b].elem===this&&f[b].queue===a&&(f[b].anim.stop(!0),f.splice(b,1));for(b=0;g>b;b++)d[b]&&d[b].finish&&d[b].finish.call(this);delete c.finish})}}),n.each(["toggle","show","hide"],function(a,b){var c=n.fn[b];n.fn[b]=function(a,d,e){return null==a||"boolean"==typeof a?c.apply(this,arguments):this.animate(Tb(b,!0),a,d,e)}}),n.each({slideDown:Tb("show"),slideUp:Tb("hide"),slideToggle:Tb("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){n.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),n.timers=[],n.fx.tick=function(){var a,b=0,c=n.timers;for(Lb=n.now();b<c.length;b++)a=c[b],a()||c[b]!==a||c.splice(b--,1);c.length||n.fx.stop(),Lb=void 0},n.fx.timer=function(a){n.timers.push(a),a()?n.fx.start():n.timers.pop()},n.fx.interval=13,n.fx.start=function(){Mb||(Mb=setInterval(n.fx.tick,n.fx.interval))},n.fx.stop=function(){clearInterval(Mb),Mb=null},n.fx.speeds={slow:600,fast:200,_default:400},n.fn.delay=function(a,b){return a=n.fx?n.fx.speeds[a]||a:a,b=b||"fx",this.queue(b,function(b,c){var d=setTimeout(b,a);c.stop=function(){clearTimeout(d)}})},function(){var a=l.createElement("input"),b=l.createElement("select"),c=b.appendChild(l.createElement("option"));a.type="checkbox",k.checkOn=""!==a.value,k.optSelected=c.selected,b.disabled=!0,k.optDisabled=!c.disabled,a=l.createElement("input"),a.value="t",a.type="radio",k.radioValue="t"===a.value}();var Yb,Zb,$b=n.expr.attrHandle;n.fn.extend({attr:function(a,b){return J(this,n.attr,a,b,arguments.length>1)},removeAttr:function(a){return this.each(function(){n.removeAttr(this,a)})}}),n.extend({attr:function(a,b,c){var d,e,f=a.nodeType;if(a&&3!==f&&8!==f&&2!==f)return typeof a.getAttribute===U?n.prop(a,b,c):(1===f&&n.isXMLDoc(a)||(b=b.toLowerCase(),d=n.attrHooks[b]||(n.expr.match.bool.test(b)?Zb:Yb)),void 0===c?d&&"get"in d&&null!==(e=d.get(a,b))?e:(e=n.find.attr(a,b),null==e?void 0:e):null!==c?d&&"set"in d&&void 0!==(e=d.set(a,c,b))?e:(a.setAttribute(b,c+""),c):void n.removeAttr(a,b))
-},removeAttr:function(a,b){var c,d,e=0,f=b&&b.match(E);if(f&&1===a.nodeType)while(c=f[e++])d=n.propFix[c]||c,n.expr.match.bool.test(c)&&(a[d]=!1),a.removeAttribute(c)},attrHooks:{type:{set:function(a,b){if(!k.radioValue&&"radio"===b&&n.nodeName(a,"input")){var c=a.value;return a.setAttribute("type",b),c&&(a.value=c),b}}}}}),Zb={set:function(a,b,c){return b===!1?n.removeAttr(a,c):a.setAttribute(c,c),c}},n.each(n.expr.match.bool.source.match(/\w+/g),function(a,b){var c=$b[b]||n.find.attr;$b[b]=function(a,b,d){var e,f;return d||(f=$b[b],$b[b]=e,e=null!=c(a,b,d)?b.toLowerCase():null,$b[b]=f),e}});var _b=/^(?:input|select|textarea|button)$/i;n.fn.extend({prop:function(a,b){return J(this,n.prop,a,b,arguments.length>1)},removeProp:function(a){return this.each(function(){delete this[n.propFix[a]||a]})}}),n.extend({propFix:{"for":"htmlFor","class":"className"},prop:function(a,b,c){var d,e,f,g=a.nodeType;if(a&&3!==g&&8!==g&&2!==g)return f=1!==g||!n.isXMLDoc(a),f&&(b=n.propFix[b]||b,e=n.propHooks[b]),void 0!==c?e&&"set"in e&&void 0!==(d=e.set(a,c,b))?d:a[b]=c:e&&"get"in e&&null!==(d=e.get(a,b))?d:a[b]},propHooks:{tabIndex:{get:function(a){return a.hasAttribute("tabindex")||_b.test(a.nodeName)||a.href?a.tabIndex:-1}}}}),k.optSelected||(n.propHooks.selected={get:function(a){var b=a.parentNode;return b&&b.parentNode&&b.parentNode.selectedIndex,null}}),n.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){n.propFix[this.toLowerCase()]=this});var ac=/[\t\r\n\f]/g;n.fn.extend({addClass:function(a){var b,c,d,e,f,g,h="string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).addClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ac," "):" ")){f=0;while(e=b[f++])d.indexOf(" "+e+" ")<0&&(d+=e+" ");g=n.trim(d),c.className!==g&&(c.className=g)}return this},removeClass:function(a){var b,c,d,e,f,g,h=0===arguments.length||"string"==typeof a&&a,i=0,j=this.length;if(n.isFunction(a))return this.each(function(b){n(this).removeClass(a.call(this,b,this.className))});if(h)for(b=(a||"").match(E)||[];j>i;i++)if(c=this[i],d=1===c.nodeType&&(c.className?(" "+c.className+" ").replace(ac," "):"")){f=0;while(e=b[f++])while(d.indexOf(" "+e+" ")>=0)d=d.replace(" "+e+" "," ");g=a?n.trim(d):"",c.className!==g&&(c.className=g)}return this},toggleClass:function(a,b){var c=typeof a;return"boolean"==typeof b&&"string"===c?b?this.addClass(a):this.removeClass(a):this.each(n.isFunction(a)?function(c){n(this).toggleClass(a.call(this,c,this.className,b),b)}:function(){if("string"===c){var b,d=0,e=n(this),f=a.match(E)||[];while(b=f[d++])e.hasClass(b)?e.removeClass(b):e.addClass(b)}else(c===U||"boolean"===c)&&(this.className&&L.set(this,"__className__",this.className),this.className=this.className||a===!1?"":L.get(this,"__className__")||"")})},hasClass:function(a){for(var b=" "+a+" ",c=0,d=this.length;d>c;c++)if(1===this[c].nodeType&&(" "+this[c].className+" ").replace(ac," ").indexOf(b)>=0)return!0;return!1}});var bc=/\r/g;n.fn.extend({val:function(a){var b,c,d,e=this[0];{if(arguments.length)return d=n.isFunction(a),this.each(function(c){var e;1===this.nodeType&&(e=d?a.call(this,c,n(this).val()):a,null==e?e="":"number"==typeof e?e+="":n.isArray(e)&&(e=n.map(e,function(a){return null==a?"":a+""})),b=n.valHooks[this.type]||n.valHooks[this.nodeName.toLowerCase()],b&&"set"in b&&void 0!==b.set(this,e,"value")||(this.value=e))});if(e)return b=n.valHooks[e.type]||n.valHooks[e.nodeName.toLowerCase()],b&&"get"in b&&void 0!==(c=b.get(e,"value"))?c:(c=e.value,"string"==typeof c?c.replace(bc,""):null==c?"":c)}}}),n.extend({valHooks:{option:{get:function(a){var b=n.find.attr(a,"value");return null!=b?b:n.trim(n.text(a))}},select:{get:function(a){for(var b,c,d=a.options,e=a.selectedIndex,f="select-one"===a.type||0>e,g=f?null:[],h=f?e+1:d.length,i=0>e?h:f?e:0;h>i;i++)if(c=d[i],!(!c.selected&&i!==e||(k.optDisabled?c.disabled:null!==c.getAttribute("disabled"))||c.parentNode.disabled&&n.nodeName(c.parentNode,"optgroup"))){if(b=n(c).val(),f)return b;g.push(b)}return g},set:function(a,b){var c,d,e=a.options,f=n.makeArray(b),g=e.length;while(g--)d=e[g],(d.selected=n.inArray(d.value,f)>=0)&&(c=!0);return c||(a.selectedIndex=-1),f}}}}),n.each(["radio","checkbox"],function(){n.valHooks[this]={set:function(a,b){return n.isArray(b)?a.checked=n.inArray(n(a).val(),b)>=0:void 0}},k.checkOn||(n.valHooks[this].get=function(a){return null===a.getAttribute("value")?"on":a.value})}),n.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error contextmenu".split(" "),function(a,b){n.fn[b]=function(a,c){return arguments.length>0?this.on(b,null,a,c):this.trigger(b)}}),n.fn.extend({hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)},bind:function(a,b,c){return this.on(a,null,b,c)},unbind:function(a,b){return this.off(a,null,b)},delegate:function(a,b,c,d){return this.on(b,a,c,d)},undelegate:function(a,b,c){return 1===arguments.length?this.off(a,"**"):this.off(b,a||"**",c)}});var cc=n.now(),dc=/\?/;n.parseJSON=function(a){return JSON.parse(a+"")},n.parseXML=function(a){var b,c;if(!a||"string"!=typeof a)return null;try{c=new DOMParser,b=c.parseFromString(a,"text/xml")}catch(d){b=void 0}return(!b||b.getElementsByTagName("parsererror").length)&&n.error("Invalid XML: "+a),b};var ec,fc,gc=/#.*$/,hc=/([?&])_=[^&]*/,ic=/^(.*?):[ \t]*([^\r\n]*)$/gm,jc=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,kc=/^(?:GET|HEAD)$/,lc=/^\/\//,mc=/^([\w.+-]+:)(?:\/\/(?:[^\/?#]*@|)([^\/?#:]*)(?::(\d+)|)|)/,nc={},oc={},pc="*/".concat("*");try{fc=location.href}catch(qc){fc=l.createElement("a"),fc.href="",fc=fc.href}ec=mc.exec(fc.toLowerCase())||[];function rc(a){return function(b,c){"string"!=typeof b&&(c=b,b="*");var d,e=0,f=b.toLowerCase().match(E)||[];if(n.isFunction(c))while(d=f[e++])"+"===d[0]?(d=d.slice(1)||"*",(a[d]=a[d]||[]).unshift(c)):(a[d]=a[d]||[]).push(c)}}function sc(a,b,c,d){var e={},f=a===oc;function g(h){var i;return e[h]=!0,n.each(a[h]||[],function(a,h){var j=h(b,c,d);return"string"!=typeof j||f||e[j]?f?!(i=j):void 0:(b.dataTypes.unshift(j),g(j),!1)}),i}return g(b.dataTypes[0])||!e["*"]&&g("*")}function tc(a,b){var c,d,e=n.ajaxSettings.flatOptions||{};for(c in b)void 0!==b[c]&&((e[c]?a:d||(d={}))[c]=b[c]);return d&&n.extend(!0,a,d),a}function uc(a,b,c){var d,e,f,g,h=a.contents,i=a.dataTypes;while("*"===i[0])i.shift(),void 0===d&&(d=a.mimeType||b.getResponseHeader("Content-Type"));if(d)for(e in h)if(h[e]&&h[e].test(d)){i.unshift(e);break}if(i[0]in c)f=i[0];else{for(e in c){if(!i[0]||a.converters[e+" "+i[0]]){f=e;break}g||(g=e)}f=f||g}return f?(f!==i[0]&&i.unshift(f),c[f]):void 0}function vc(a,b,c,d){var e,f,g,h,i,j={},k=a.dataTypes.slice();if(k[1])for(g in a.converters)j[g.toLowerCase()]=a.converters[g];f=k.shift();while(f)if(a.responseFields[f]&&(c[a.responseFields[f]]=b),!i&&d&&a.dataFilter&&(b=a.dataFilter(b,a.dataType)),i=f,f=k.shift())if("*"===f)f=i;else if("*"!==i&&i!==f){if(g=j[i+" "+f]||j["* "+f],!g)for(e in j)if(h=e.split(" "),h[1]===f&&(g=j[i+" "+h[0]]||j["* "+h[0]])){g===!0?g=j[e]:j[e]!==!0&&(f=h[0],k.unshift(h[1]));break}if(g!==!0)if(g&&a["throws"])b=g(b);else try{b=g(b)}catch(l){return{state:"parsererror",error:g?l:"No conversion from "+i+" to "+f}}}return{state:"success",data:b}}n.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:fc,type:"GET",isLocal:jc.test(ec[1]),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":pc,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":n.parseJSON,"text xml":n.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(a,b){return b?tc(tc(a,n.ajaxSettings),b):tc(n.ajaxSettings,a)},ajaxPrefilter:rc(nc),ajaxTransport:rc(oc),ajax:function(a,b){"object"==typeof a&&(b=a,a=void 0),b=b||{};var c,d,e,f,g,h,i,j,k=n.ajaxSetup({},b),l=k.context||k,m=k.context&&(l.nodeType||l.jquery)?n(l):n.event,o=n.Deferred(),p=n.Callbacks("once memory"),q=k.statusCode||{},r={},s={},t=0,u="canceled",v={readyState:0,getResponseHeader:function(a){var b;if(2===t){if(!f){f={};while(b=ic.exec(e))f[b[1].toLowerCase()]=b[2]}b=f[a.toLowerCase()]}return null==b?null:b},getAllResponseHeaders:function(){return 2===t?e:null},setRequestHeader:function(a,b){var c=a.toLowerCase();return t||(a=s[c]=s[c]||a,r[a]=b),this},overrideMimeType:function(a){return t||(k.mimeType=a),this},statusCode:function(a){var b;if(a)if(2>t)for(b in a)q[b]=[q[b],a[b]];else v.always(a[v.status]);return this},abort:function(a){var b=a||u;return c&&c.abort(b),x(0,b),this}};if(o.promise(v).complete=p.add,v.success=v.done,v.error=v.fail,k.url=((a||k.url||fc)+"").replace(gc,"").replace(lc,ec[1]+"//"),k.type=b.method||b.type||k.method||k.type,k.dataTypes=n.trim(k.dataType||"*").toLowerCase().match(E)||[""],null==k.crossDomain&&(h=mc.exec(k.url.toLowerCase()),k.crossDomain=!(!h||h[1]===ec[1]&&h[2]===ec[2]&&(h[3]||("http:"===h[1]?"80":"443"))===(ec[3]||("http:"===ec[1]?"80":"443")))),k.data&&k.processData&&"string"!=typeof k.data&&(k.data=n.param(k.data,k.traditional)),sc(nc,k,b,v),2===t)return v;i=k.global,i&&0===n.active++&&n.event.trigger("ajaxStart"),k.type=k.type.toUpperCase(),k.hasContent=!kc.test(k.type),d=k.url,k.hasContent||(k.data&&(d=k.url+=(dc.test(d)?"&":"?")+k.data,delete k.data),k.cache===!1&&(k.url=hc.test(d)?d.replace(hc,"$1_="+cc++):d+(dc.test(d)?"&":"?")+"_="+cc++)),k.ifModified&&(n.lastModified[d]&&v.setRequestHeader("If-Modified-Since",n.lastModified[d]),n.etag[d]&&v.setRequestHeader("If-None-Match",n.etag[d])),(k.data&&k.hasContent&&k.contentType!==!1||b.contentType)&&v.setRequestHeader("Content-Type",k.contentType),v.setRequestHeader("Accept",k.dataTypes[0]&&k.accepts[k.dataTypes[0]]?k.accepts[k.dataTypes[0]]+("*"!==k.dataTypes[0]?", "+pc+"; q=0.01":""):k.accepts["*"]);for(j in k.headers)v.setRequestHeader(j,k.headers[j]);if(k.beforeSend&&(k.beforeSend.call(l,v,k)===!1||2===t))return v.abort();u="abort";for(j in{success:1,error:1,complete:1})v[j](k[j]);if(c=sc(oc,k,b,v)){v.readyState=1,i&&m.trigger("ajaxSend",[v,k]),k.async&&k.timeout>0&&(g=setTimeout(function(){v.abort("timeout")},k.timeout));try{t=1,c.send(r,x)}catch(w){if(!(2>t))throw w;x(-1,w)}}else x(-1,"No Transport");function x(a,b,f,h){var j,r,s,u,w,x=b;2!==t&&(t=2,g&&clearTimeout(g),c=void 0,e=h||"",v.readyState=a>0?4:0,j=a>=200&&300>a||304===a,f&&(u=uc(k,v,f)),u=vc(k,u,v,j),j?(k.ifModified&&(w=v.getResponseHeader("Last-Modified"),w&&(n.lastModified[d]=w),w=v.getResponseHeader("etag"),w&&(n.etag[d]=w)),204===a||"HEAD"===k.type?x="nocontent":304===a?x="notmodified":(x=u.state,r=u.data,s=u.error,j=!s)):(s=x,(a||!x)&&(x="error",0>a&&(a=0))),v.status=a,v.statusText=(b||x)+"",j?o.resolveWith(l,[r,x,v]):o.rejectWith(l,[v,x,s]),v.statusCode(q),q=void 0,i&&m.trigger(j?"ajaxSuccess":"ajaxError",[v,k,j?r:s]),p.fireWith(l,[v,x]),i&&(m.trigger("ajaxComplete",[v,k]),--n.active||n.event.trigger("ajaxStop")))}return v},getJSON:function(a,b,c){return n.get(a,b,c,"json")},getScript:function(a,b){return n.get(a,void 0,b,"script")}}),n.each(["get","post"],function(a,b){n[b]=function(a,c,d,e){return n.isFunction(c)&&(e=e||d,d=c,c=void 0),n.ajax({url:a,type:b,dataType:e,data:c,success:d})}}),n.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(a,b){n.fn[b]=function(a){return this.on(b,a)}}),n._evalUrl=function(a){return n.ajax({url:a,type:"GET",dataType:"script",async:!1,global:!1,"throws":!0})},n.fn.extend({wrapAll:function(a){var b;return n.isFunction(a)?this.each(function(b){n(this).wrapAll(a.call(this,b))}):(this[0]&&(b=n(a,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstElementChild)a=a.firstElementChild;return a}).append(this)),this)},wrapInner:function(a){return this.each(n.isFunction(a)?function(b){n(this).wrapInner(a.call(this,b))}:function(){var b=n(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=n.isFunction(a);return this.each(function(c){n(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){n.nodeName(this,"body")||n(this).replaceWith(this.childNodes)}).end()}}),n.expr.filters.hidden=function(a){return a.offsetWidth<=0&&a.offsetHeight<=0},n.expr.filters.visible=function(a){return!n.expr.filters.hidden(a)};var wc=/%20/g,xc=/\[\]$/,yc=/\r?\n/g,zc=/^(?:submit|button|image|reset|file)$/i,Ac=/^(?:input|select|textarea|keygen)/i;function Bc(a,b,c,d){var e;if(n.isArray(b))n.each(b,function(b,e){c||xc.test(a)?d(a,e):Bc(a+"["+("object"==typeof e?b:"")+"]",e,c,d)});else if(c||"object"!==n.type(b))d(a,b);else for(e in b)Bc(a+"["+e+"]",b[e],c,d)}n.param=function(a,b){var c,d=[],e=function(a,b){b=n.isFunction(b)?b():null==b?"":b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};if(void 0===b&&(b=n.ajaxSettings&&n.ajaxSettings.traditional),n.isArray(a)||a.jquery&&!n.isPlainObject(a))n.each(a,function(){e(this.name,this.value)});else for(c in a)Bc(c,a[c],b,e);return d.join("&").replace(wc,"+")},n.fn.extend({serialize:function(){return n.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var a=n.prop(this,"elements");return a?n.makeArray(a):this}).filter(function(){var a=this.type;return this.name&&!n(this).is(":disabled")&&Ac.test(this.nodeName)&&!zc.test(a)&&(this.checked||!T.test(a))}).map(function(a,b){var c=n(this).val();return null==c?null:n.isArray(c)?n.map(c,function(a){return{name:b.name,value:a.replace(yc,"\r\n")}}):{name:b.name,value:c.replace(yc,"\r\n")}}).get()}}),n.ajaxSettings.xhr=function(){try{return new XMLHttpRequest}catch(a){}};var Cc=0,Dc={},Ec={0:200,1223:204},Fc=n.ajaxSettings.xhr();a.ActiveXObject&&n(a).on("unload",function(){for(var a in Dc)Dc[a]()}),k.cors=!!Fc&&"withCredentials"in Fc,k.ajax=Fc=!!Fc,n.ajaxTransport(function(a){var b;return k.cors||Fc&&!a.crossDomain?{send:function(c,d){var e,f=a.xhr(),g=++Cc;if(f.open(a.type,a.url,a.async,a.username,a.password),a.xhrFields)for(e in a.xhrFields)f[e]=a.xhrFields[e];a.mimeType&&f.overrideMimeType&&f.overrideMimeType(a.mimeType),a.crossDomain||c["X-Requested-With"]||(c["X-Requested-With"]="XMLHttpRequest");for(e in c)f.setRequestHeader(e,c[e]);b=function(a){return function(){b&&(delete Dc[g],b=f.onload=f.onerror=null,"abort"===a?f.abort():"error"===a?d(f.status,f.statusText):d(Ec[f.status]||f.status,f.statusText,"string"==typeof f.responseText?{text:f.responseText}:void 0,f.getAllResponseHeaders()))}},f.onload=b(),f.onerror=b("error"),b=Dc[g]=b("abort");try{f.send(a.hasContent&&a.data||null)}catch(h){if(b)throw h}},abort:function(){b&&b()}}:void 0}),n.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/(?:java|ecma)script/},converters:{"text script":function(a){return n.globalEval(a),a}}}),n.ajaxPrefilter("script",function(a){void 0===a.cache&&(a.cache=!1),a.crossDomain&&(a.type="GET")}),n.ajaxTransport("script",function(a){if(a.crossDomain){var b,c;return{send:function(d,e){b=n("<script>").prop({async:!0,charset:a.scriptCharset,src:a.url}).on("load error",c=function(a){b.remove(),c=null,a&&e("error"===a.type?404:200,a.type)}),l.head.appendChild(b[0])},abort:function(){c&&c()}}}});var Gc=[],Hc=/(=)\?(?=&|$)|\?\?/;n.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var a=Gc.pop()||n.expando+"_"+cc++;return this[a]=!0,a}}),n.ajaxPrefilter("json jsonp",function(b,c,d){var e,f,g,h=b.jsonp!==!1&&(Hc.test(b.url)?"url":"string"==typeof b.data&&!(b.contentType||"").indexOf("application/x-www-form-urlencoded")&&Hc.test(b.data)&&"data");return h||"jsonp"===b.dataTypes[0]?(e=b.jsonpCallback=n.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,h?b[h]=b[h].replace(Hc,"$1"+e):b.jsonp!==!1&&(b.url+=(dc.test(b.url)?"&":"?")+b.jsonp+"="+e),b.converters["script json"]=function(){return g||n.error(e+" was not called"),g[0]},b.dataTypes[0]="json",f=a[e],a[e]=function(){g=arguments},d.always(function(){a[e]=f,b[e]&&(b.jsonpCallback=c.jsonpCallback,Gc.push(e)),g&&n.isFunction(f)&&f(g[0]),g=f=void 0}),"script"):void 0}),n.parseHTML=function(a,b,c){if(!a||"string"!=typeof a)return null;"boolean"==typeof b&&(c=b,b=!1),b=b||l;var d=v.exec(a),e=!c&&[];return d?[b.createElement(d[1])]:(d=n.buildFragment([a],b,e),e&&e.length&&n(e).remove(),n.merge([],d.childNodes))};var Ic=n.fn.load;n.fn.load=function(a,b,c){if("string"!=typeof a&&Ic)return Ic.apply(this,arguments);var d,e,f,g=this,h=a.indexOf(" ");return h>=0&&(d=n.trim(a.slice(h)),a=a.slice(0,h)),n.isFunction(b)?(c=b,b=void 0):b&&"object"==typeof b&&(e="POST"),g.length>0&&n.ajax({url:a,type:e,dataType:"html",data:b}).done(function(a){f=arguments,g.html(d?n("<div>").append(n.parseHTML(a)).find(d):a)}).complete(c&&function(a,b){g.each(c,f||[a.responseText,b,a])}),this},n.expr.filters.animated=function(a){return n.grep(n.timers,function(b){return a===b.elem}).length};var Jc=a.document.documentElement;function Kc(a){return n.isWindow(a)?a:9===a.nodeType&&a.defaultView}n.offset={setOffset:function(a,b,c){var d,e,f,g,h,i,j,k=n.css(a,"position"),l=n(a),m={};"static"===k&&(a.style.position="relative"),h=l.offset(),f=n.css(a,"top"),i=n.css(a,"left"),j=("absolute"===k||"fixed"===k)&&(f+i).indexOf("auto")>-1,j?(d=l.position(),g=d.top,e=d.left):(g=parseFloat(f)||0,e=parseFloat(i)||0),n.isFunction(b)&&(b=b.call(a,c,h)),null!=b.top&&(m.top=b.top-h.top+g),null!=b.left&&(m.left=b.left-h.left+e),"using"in b?b.using.call(a,m):l.css(m)}},n.fn.extend({offset:function(a){if(arguments.length)return void 0===a?this:this.each(function(b){n.offset.setOffset(this,a,b)});var b,c,d=this[0],e={top:0,left:0},f=d&&d.ownerDocument;if(f)return b=f.documentElement,n.contains(b,d)?(typeof d.getBoundingClientRect!==U&&(e=d.getBoundingClientRect()),c=Kc(f),{top:e.top+c.pageYOffset-b.clientTop,left:e.left+c.pageXOffset-b.clientLeft}):e},position:function(){if(this[0]){var a,b,c=this[0],d={top:0,left:0};return"fixed"===n.css(c,"position")?b=c.getBoundingClientRect():(a=this.offsetParent(),b=this.offset(),n.nodeName(a[0],"html")||(d=a.offset()),d.top+=n.css(a[0],"borderTopWidth",!0),d.left+=n.css(a[0],"borderLeftWidth",!0)),{top:b.top-d.top-n.css(c,"marginTop",!0),left:b.left-d.left-n.css(c,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||Jc;while(a&&!n.nodeName(a,"html")&&"static"===n.css(a,"position"))a=a.offsetParent;return a||Jc})}}),n.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(b,c){var d="pageYOffset"===c;n.fn[b]=function(e){return J(this,function(b,e,f){var g=Kc(b);return void 0===f?g?g[c]:b[e]:void(g?g.scrollTo(d?a.pageXOffset:f,d?f:a.pageYOffset):b[e]=f)},b,e,arguments.length,null)}}),n.each(["top","left"],function(a,b){n.cssHooks[b]=yb(k.pixelPosition,function(a,c){return c?(c=xb(a,b),vb.test(c)?n(a).position()[b]+"px":c):void 0})}),n.each({Height:"height",Width:"width"},function(a,b){n.each({padding:"inner"+a,content:b,"":"outer"+a},function(c,d){n.fn[d]=function(d,e){var f=arguments.length&&(c||"boolean"!=typeof d),g=c||(d===!0||e===!0?"margin":"border");return J(this,function(b,c,d){var e;return n.isWindow(b)?b.document.documentElement["client"+a]:9===b.nodeType?(e=b.documentElement,Math.max(b.body["scroll"+a],e["scroll"+a],b.body["offset"+a],e["offset"+a],e["client"+a])):void 0===d?n.css(b,c,g):n.style(b,c,d,g)},b,f?d:void 0,f,null)}})}),n.fn.size=function(){return this.length},n.fn.andSelf=n.fn.addBack,"function"==typeof define&&define.amd&&define("jquery",[],function(){return n});var Lc=a.jQuery,Mc=a.$;return n.noConflict=function(b){return a.$===n&&(a.$=Mc),b&&a.jQuery===n&&(a.jQuery=Lc),n},typeof b===U&&(a.jQuery=a.$=n),n}); \ No newline at end of file
diff --git a/browser/extensions/pocket/content/panels/js/vendor/jquery.tokeninput.min.js b/browser/extensions/pocket/content/panels/js/vendor/jquery.tokeninput.min.js
deleted file mode 100644
index 40d323df0d..0000000000
--- a/browser/extensions/pocket/content/panels/js/vendor/jquery.tokeninput.min.js
+++ /dev/null
@@ -1,954 +0,0 @@
-/*
- * jQuery Plugin: Tokenizing Autocomplete Text Entry
- * Version 1.6.0
- *
- * Copyright (c) 2009 James Smith (http://loopj.com)
- * Licensed jointly under the GPL and MIT licenses,
- * choose which one suits your project best!
- *
- * Licensed under MIT
- * With modifications
- *
- */
-
-(function ($) {
-// Default settings
-var DEFAULT_SETTINGS = {
- // Search settings
- method: "GET",
- contentType: "json",
- queryParam: "q",
- searchDelay: 300,
- minChars: 1,
- propertyToSearch: "name",
- jsonContainer: null,
- scrollKeyboard: false,
-
- // Display settings
- hintText: null,
- noResultsText: null,
- noResultsHideDropdown: false,
- searchingText: null,
- deleteText: "&times;",
- animateDropdown: true,
- emptyInputLength: null,
-
- // Tokenization settings
- tokenLimit: null,
- tokenDelimiter: ",",
- preventDuplicates: false,
-
- // Output settings
- tokenValue: "id",
-
- // Prepopulation settings
- prePopulate: null,
- processPrePopulate: false,
-
- // Manipulation settings
- idPrefix: "token-input-",
-
- // Formatters
- resultsFormatter: function(item) {
- let listItem = document.createElement("li");
- listItem.textContent = item[this.propertyToSearch];
- return listItem.outerHTML;
- },
- tokenFormatter: function(item) {
- let listItem = document.createElement("li");
- let p = document.createElement("p");
- p.textContent = item[this.propertyToSearch];
- listItem.appendChild(p);
- return listItem.outerHTML;
- },
-
- // Validations
- validateItem: null,
-
- // Force selections only on mouse click
- noHoverSelect: false,
-
- // Callbacks
- onResult: null,
- onAdd: null,
- onDelete: null,
- onReady: null
-};
-
-// Default classes to use when theming
-var DEFAULT_CLASSES = {
- tokenList: "token-input-list",
- token: "token-input-token",
- tokenDelete: "token-input-delete-token",
- selectedToken: "token-input-selected-token",
- highlightedToken: "token-input-highlighted-token",
- dropdown: "token-input-dropdown",
- dropdownItem: "token-input-dropdown-item",
- dropdownItem2: "token-input-dropdown-item2",
- selectedDropdownItem: "token-input-selected-dropdown-item",
- inputToken: "token-input-input-token"
-};
-
-// Input box position "enum"
-var POSITION = {
- BEFORE: 0,
- AFTER: 1,
- END: 2
-};
-
-// Keys "enum"
-var KEY = {
- BACKSPACE: 8,
- TAB: 9,
- ENTER: 13,
- ESCAPE: 27,
- SPACE: 32,
- PAGE_UP: 33,
- PAGE_DOWN: 34,
- END: 35,
- HOME: 36,
- LEFT: 37,
- UP: 38,
- RIGHT: 39,
- DOWN: 40,
- NUMPAD_ENTER: 108,
- COMMA: 188
-};
-
-// Additional public (exposed) methods
-var methods = {
- init: function(url_or_data_or_function, options) {
- var settings = $.extend({}, DEFAULT_SETTINGS, options || {});
-
- return this.each(function () {
- $(this).data("tokenInputObject", new $.TokenList(this, url_or_data_or_function, settings));
- });
- },
- clear: function() {
- this.data("tokenInputObject").clear();
- return this;
- },
- add: function(item) {
- this.data("tokenInputObject").add(item);
- return this;
- },
- remove: function(item) {
- this.data("tokenInputObject").remove(item);
- return this;
- },
- get: function() {
- return this.data("tokenInputObject").getTokens();
- }
-}
-
-// Expose the .tokenInput function to jQuery as a plugin
-$.fn.tokenInput = function (method) {
- // Method calling and initialization logic
- if(methods[method]) {
- return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
- } else {
- return methods.init.apply(this, arguments);
- }
-};
-
-// TokenList class for each input
-$.TokenList = function (input, url_or_data, settings) {
- //
- // Initialization
- //
-
- // Configure the data source
- if($.type(url_or_data) === "string" || $.type(url_or_data) === "function") {
- // Set the url to query against
- settings.url = url_or_data;
-
- // If the URL is a function, evaluate it here to do our initalization work
- var url = computeURL();
-
- // Make a smart guess about cross-domain if it wasn't explicitly specified
- if(settings.crossDomain === undefined) {
- if(url.indexOf("://") === -1) {
- settings.crossDomain = false;
- } else {
- settings.crossDomain = (location.href.split(/\/+/g)[1] !== url.split(/\/+/g)[1]);
- }
- }
- } else if(typeof(url_or_data) === "object") {
- // Set the local data to search through
- settings.local_data = url_or_data;
- }
-
- // Build class names
- if(settings.classes) {
- // Use custom class names
- settings.classes = $.extend({}, DEFAULT_CLASSES, settings.classes);
- } else if(settings.theme) {
- // Use theme-suffixed default class names
- settings.classes = {};
- $.each(DEFAULT_CLASSES, function(key, value) {
- settings.classes[key] = value + "-" + settings.theme;
- });
- } else {
- settings.classes = DEFAULT_CLASSES;
- }
-
-
- // Save the tokens
- var saved_tokens = [];
-
- // Keep track of the number of tokens in the list
- var token_count = 0;
-
- // Basic cache to save on db hits
- var cache = new $.TokenList.Cache();
-
- // Keep track of the timeout, old vals
- var timeout;
- var input_val;
-
- function tokenize(){
- var item = $(selected_dropdown_item).data("tokeninput");
- if(!item && settings.textToData){
- item = settings.textToData(input_box.val());
- }
-
- if(item) {
- add_token(item);
- hidden_input.change();
- return false;
- }
- }
-
- // Create a new text input an attach keyup events
- var input_box = $("<input type=\"text\" autocomplete=\"off\">")
- .css({
- outline: "none"
- })
- .attr("id", settings.idPrefix + input.id)
- .focus(function () {
- if (settings.minChars == 0) {
- setTimeout(function(){do_search();}, 5);
- }
- if (settings.tokenLimit === null || settings.tokenLimit !== token_count) {
- show_dropdown_hint();
- }
- })
- .blur(function () {
- tokenize();
- hide_dropdown();
- $(this).val("");
- })
- .bind("keyup keydown blur update", resize_input)
- .keydown(function (event) {
- var previous_token;
- var next_token;
-
- switch(event.keyCode) {
- case KEY.LEFT:
- case KEY.RIGHT:
- case KEY.UP:
- case KEY.DOWN:
- if(!$(this).val()) {
- previous_token = input_token.prev();
- next_token = input_token.next();
-
- if((previous_token.length && previous_token.get(0) === selected_token) || (next_token.length && next_token.get(0) === selected_token)) {
- // Check if there is a previous/next token and it is selected
- if(event.keyCode === KEY.LEFT || event.keyCode === KEY.UP) {
- deselect_token($(selected_token), POSITION.BEFORE);
- } else {
- deselect_token($(selected_token), POSITION.AFTER);
- }
- } else if((event.keyCode === KEY.LEFT || event.keyCode === KEY.UP) && previous_token.length) {
- // We are moving left, select the previous token if it exists
- select_token($(previous_token.get(0)));
- } else if((event.keyCode === KEY.RIGHT || event.keyCode === KEY.DOWN) && next_token.length) {
- // We are moving right, select the next token if it exists
- select_token($(next_token.get(0)));
- }
- } else {
- if (event.keyCode === KEY.UP || event.keyCode === KEY.DOWN) {
- var dropdown_item = null;
- if(!selected_dropdown_item && (event.keyCode === KEY.DOWN)) {
- dropdown_item = $('.token-input-dropdown li').first();
- }
- else if(event.keyCode === KEY.DOWN) {
- dropdown_item = $(selected_dropdown_item).next();
- } else {
- dropdown_item = $(selected_dropdown_item).prev();
- }
-
- if(dropdown_item.length) {
- select_dropdown_item(dropdown_item,true);
- }
- else if (!(event.keyCode === KEY.DOWN) && $(selected_dropdown_item).length) {
- deselect_dropdown_item($(selected_dropdown_item));
- }
- return false;
- }
- }
- break;
-
- case KEY.BACKSPACE:
- previous_token = input_token.prev();
-
- if(!$(this).val().length) {
- if(selected_token) {
- delete_token($(selected_token));
- hidden_input.change();
- } else if(previous_token.length) {
- select_token($(previous_token.get(0)));
- }
-
- return false;
- } else if($(this).val().length === 1) {
- hide_dropdown();
- } else {
- // set a timeout just long enough to let this function finish.
- setTimeout(function(){do_search();}, 5);
- }
- break;
-
- case KEY.TAB:
- case KEY.ENTER:
- case KEY.NUMPAD_ENTER:
- case KEY.COMMA:
- if (event.keyCode != KEY.ENTER && event.keyCode != KEY.NUMPAD_ENTER)
- {
- event.preventDefault();
- }
- tokenize();
- break;
-
- case KEY.ESCAPE:
- hide_dropdown();
- return true;
-
- default:
- if(String.fromCharCode(event.which)) {
- // set a timeout just long enough to let this function finish.
- setTimeout(function(){do_search();}, 5);
- }
- break;
- }
- });
-
- // Keep a reference to the original input box
- var hidden_input = $(input)
- .hide()
- .val("")
- .focus(function () {
- input_box.focus();
- })
- .blur(function () {
- input_box.blur();
- });
-
- // Keep a reference to the selected token and dropdown item
- var selected_token = null;
- var selected_token_index = 0;
- var selected_dropdown_item = null;
-
- // The list to store the token items in
- var token_list = $("<ul />")
- .addClass(settings.classes.tokenList)
- .click(function (event) {
- var li = $(event.target).closest("li");
- if(li && li.get(0) && $.data(li.get(0), "tokeninput")) {
- toggle_select_token(li);
- } else {
- // Deselect selected token
- if(selected_token) {
- deselect_token($(selected_token), POSITION.END);
- }
-
- // Focus input box
- input_box.focus();
- }
- })
- .mouseover(function (event) {
- var li = $(event.target).closest("li");
- if(li && selected_token !== this) {
- li.addClass(settings.classes.highlightedToken);
- }
- })
- .mouseout(function (event) {
- var li = $(event.target).closest("li");
- if(li && selected_token !== this) {
- li.removeClass(settings.classes.highlightedToken);
- }
- })
- .insertBefore(hidden_input);
-
- // The token holding the input box
- var input_token = $("<li />")
- .addClass(settings.classes.inputToken)
- .appendTo(token_list)
- .append(input_box);
-
- // The list to store the dropdown items in
- var dropdown = $("<div>")
- .addClass(settings.classes.dropdown)
- .appendTo("body")
- .hide();
-
- // Magic element to help us resize the text input
- var input_resizer = $("<tester/>")
- .insertAfter(input_box)
- .css({
- position: "absolute",
- top: -9999,
- left: -9999,
- width: "auto",
- fontSize: input_box.css("fontSize"),
- fontFamily: input_box.css("fontFamily"),
- fontWeight: input_box.css("fontWeight"),
- letterSpacing: input_box.css("letterSpacing"),
- whiteSpace: "nowrap"
- });
-
- // Pre-populate list if items exist
- hidden_input.val("");
- var li_data = settings.prePopulate || hidden_input.data("pre");
- if(settings.processPrePopulate && $.isFunction(settings.onResult)) {
- li_data = settings.onResult.call(hidden_input, li_data);
- }
- if(li_data && li_data.length) {
- $.each(li_data, function (index, value) {
- insert_token(value);
- checkTokenLimit();
- });
- }
-
- // Initialization is done
- if($.isFunction(settings.onReady)) {
- settings.onReady.call();
- if (settings.minChars == 0)
- {
- setTimeout(function(){do_search();}, 5);
- }
- }
-
- //
- // Public functions
- //
-
- this.clear = function() {
- token_list.children("li").each(function() {
- if ($(this).children("input").length === 0) {
- delete_token($(this));
- }
- });
- }
-
- this.add = function(item) {
- add_token(item);
- }
-
- this.remove = function(item) {
- token_list.children("li").each(function() {
- if ($(this).children("input").length === 0) {
- var currToken = $(this).data("tokeninput");
- var match = true;
- for (var prop in item) {
- if (item[prop] !== currToken[prop]) {
- match = false;
- break;
- }
- }
- if (match) {
- delete_token($(this));
- }
- }
- });
- }
-
- this.getTokens = function() {
- return saved_tokens;
- }
-
- //
- // Private functions
- //
-
- function checkTokenLimit() {
- if(settings.tokenLimit !== null && token_count >= settings.tokenLimit) {
- input_box.hide();
- hide_dropdown();
- return;
- }
- }
-
- function resize_input() {
- if(input_val === (input_val = input_box.val())) {return;}
-
- // Enter new content into resizer and resize input accordingly
- var escaped = input_val.replace(/&/g, '&amp;').replace(/\s/g,' ').replace(/</g, '&lt;').replace(/>/g, '&gt;');
- input_resizer.html(escaped);
- var minwidth = 30;
- if (settings.emptyInputLength && token_list.children().length < 2) {
- minwidth = settings.emptyInputLength;
- }
- input_box.width(input_resizer.width() + minwidth);
- }
-
- function is_printable_character(keycode) {
- return ((keycode >= 48 && keycode <= 90) || // 0-1a-z
- (keycode >= 96 && keycode <= 111) || // numpad 0-9 + - / * .
- (keycode >= 186 && keycode <= 192) || // ; = , - . / ^
- (keycode >= 219 && keycode <= 222)); // ( \ ) '
- }
-
- // Inner function to a token to the list
- function insert_token(item) {
- var this_token = settings.tokenFormatter(item);
- this_token = $(this_token)
- .addClass(settings.classes.token)
- .insertBefore(input_token);
-
- // The 'delete token' button
- $("<span>" + settings.deleteText + "</span>")
- .addClass(settings.classes.tokenDelete)
- .appendTo(this_token)
- .click(function () {
- delete_token($(this).parent());
- hidden_input.change();
- return false;
- });
-
- // Store data on the token
- var token_data = {"id": item.id};
- token_data[settings.propertyToSearch] = item[settings.propertyToSearch];
- token_data.item = item;
- $.data(this_token.get(0), "tokeninput", item);
-
- // Save this token for duplicate checking
- saved_tokens = saved_tokens.slice(0,selected_token_index).concat([token_data]).concat(saved_tokens.slice(selected_token_index));
- selected_token_index++;
-
- // Update the hidden input
- update_hidden_input(saved_tokens, hidden_input);
-
- token_count += 1;
-
- // Check the token limit
- if(settings.tokenLimit !== null && token_count >= settings.tokenLimit) {
- input_box.hide();
- hide_dropdown();
- }
-
- return this_token;
- }
-
- // Add a token to the token list based on user input
- function add_token (item) {
- if(!item) return;
-
- // Check for item validation
- if ($.isFunction(settings.validateItem) && !settings.validateItem(item)) {
- return false;
- }
-
- var callback = settings.onAdd;
-
- // See if the token already exists and select it if we don't want duplicates
- if(token_count > 0 && settings.preventDuplicates) {
- var found_existing_token = null;
- token_list.children().each(function () {
- var existing_token = $(this);
- var existing_data = $.data(existing_token.get(0), "tokeninput");
- if(existing_data && existing_data.id === item.id) {
- found_existing_token = existing_token;
- return false;
- }
- });
-
- if(found_existing_token) {
- select_token(found_existing_token);
- input_token.insertAfter(found_existing_token);
- input_box.focus();
- return;
- }
- }
-
- // Insert the new tokens
- if(settings.tokenLimit == null || token_count < settings.tokenLimit) {
- insert_token(item);
- checkTokenLimit();
- }
-
- // Clear input box
- input_box.val("");
-
- // Don't show the help dropdown, they've got the idea
- hide_dropdown();
-
- // Execute the onAdd callback if defined
- if($.isFunction(callback)) {
- callback.call(hidden_input,item);
- }
- }
-
- // Select a token in the token list
- function select_token (token) {
- token.addClass(settings.classes.selectedToken);
- selected_token = token.get(0);
-
- // Hide input box
- input_box.val("");
-
- // Hide dropdown if it is visible (eg if we clicked to select token)
- hide_dropdown();
- }
-
- // Deselect a token in the token list
- function deselect_token (token, position) {
- token.removeClass(settings.classes.selectedToken);
- selected_token = null;
-
- if(position === POSITION.BEFORE) {
- input_token.insertBefore(token);
- selected_token_index--;
- } else if(position === POSITION.AFTER) {
- input_token.insertAfter(token);
- selected_token_index++;
- } else {
- input_token.appendTo(token_list);
- selected_token_index = token_count;
- }
-
- // Show the input box and give it focus again
- input_box.focus();
- }
-
- // Toggle selection of a token in the token list
- function toggle_select_token(token) {
- var previous_selected_token = selected_token;
-
- if(selected_token) {
- deselect_token($(selected_token), POSITION.END);
- }
-
- if(previous_selected_token === token.get(0)) {
- deselect_token(token, POSITION.END);
- } else {
- select_token(token);
- }
- }
-
- // Delete a token from the token list
- function delete_token (token) {
- // Remove the id from the saved list
- var token_data = $.data(token.get(0), "tokeninput");
- var callback = settings.onDelete;
-
- var index = token.prevAll().length;
- if(index > selected_token_index) index--;
-
- // Delete the token
- token.remove();
- selected_token = null;
-
- // Show the input box and give it focus again
- input_box.focus();
-
- // Remove this token from the saved list
- saved_tokens = saved_tokens.slice(0,index).concat(saved_tokens.slice(index+1));
- if(index < selected_token_index) selected_token_index--;
-
- // Update the hidden input
- update_hidden_input(saved_tokens, hidden_input);
-
- token_count -= 1;
-
- if(settings.tokenLimit !== null) {
- input_box
- .show()
- .val("")
- .focus();
- }
-
- // Execute the onDelete callback if defined
- if($.isFunction(callback)) {
- callback.call(hidden_input,token_data);
- }
- }
-
- // Update the hidden input box value
- function update_hidden_input(saved_tokens, hidden_input) {
- var token_values = $.map(saved_tokens, function (el) {
- return el[settings.tokenValue];
- });
- hidden_input.val(token_values.join(settings.tokenDelimiter));
-
- }
-
- // Hide and clear the results dropdown
- function hide_dropdown () {
- dropdown.hide().empty();
- selected_dropdown_item = null;
- if (settings.onHideDropdown)
- settings.onHideDropdown();
- }
-
- function show_dropdown() {
- dropdown
- .css({
- position: "absolute",
- top: $(token_list).offset().top + $(token_list).outerHeight(),
- left: $(token_list).offset().left,
- zindex: 999
- })
- .show();
- if (settings.onShowDropdown)
- settings.onShowDropdown();
- }
-
- function show_dropdown_searching () {
- if(settings.searchingText) {
- dropdown.html("<p>"+settings.searchingText+"</p>");
- show_dropdown();
- }
- }
-
- function show_dropdown_hint () {
- if(settings.hintText) {
- dropdown.html("<p>"+settings.hintText+"</p>");
- show_dropdown();
- }
- }
-
- // Highlight the query part of the search term
- function highlight_term(value, term) {
- return value.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + term + ")(?![^<>]*>)(?![^&;]+;)", "gi"), "<b>$1</b>");
- }
-
- function find_value_and_highlight_term(template, value, term) {
- return template.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)(" + value + ")(?![^<>]*>)(?![^&;]+;)", "g"), highlight_term(value, term));
- }
-
- // Populate the results dropdown with some results
- function populate_dropdown (query, results) {
- if(results && results.length) {
- dropdown.empty();
- var dropdown_ul = $("<ul>")
- .appendTo(dropdown)
- .mouseover(function (event) {
- select_dropdown_item($(event.target).closest("li"));
- })
- .mousedown(function (event) {
- add_token($(event.target).closest("li").data("tokeninput"));
- hidden_input.change();
- return false;
- })
- .hide();
- if (settings.noHoverSelect) {
- dropdown_ul.off('mouseover');
- dropdown_ul.on('mouseover',function (event) {
- $(this).find("li").removeClass(settings.classes.selectedDropdownItem);
- $(event.target).closest("li").addClass(settings.classes.selectedDropdownItem);
- });
- }
-
- $.each(results, function(index, value) {
- var this_li = settings.resultsFormatter(value);
-
- // this_li = find_value_and_highlight_term(this_li ,value[settings.propertyToSearch], query);
-
- this_li = $(this_li).appendTo(dropdown_ul);
-
- if(index % 2) {
- this_li.addClass(settings.classes.dropdownItem);
- } else {
- this_li.addClass(settings.classes.dropdownItem2);
- }
-
- // if(index === 0) {
- // select_dropdown_item(this_li);
- // }
-
- $.data(this_li.get(0), "tokeninput", value);
- });
-
- show_dropdown();
-
- if(settings.animateDropdown) {
- dropdown_ul.slideDown("fast");
- } else {
- dropdown_ul.show();
- }
- } else {
- if(settings.noResultsText) {
- dropdown.html("<p>"+settings.noResultsText+"</p>");
- show_dropdown();
- }
- if (settings.noResultsHideDropdown) {
- hide_dropdown();
- }
- }
- }
-
- // Highlight an item in the results dropdown
- function select_dropdown_item (item,withkeyboard) {
- if(item) {
- if(selected_dropdown_item) {
- deselect_dropdown_item($(selected_dropdown_item));
- }
- if (settings.scrollKeyboard && withkeyboard) {
- var list = $('.token-input-dropdown-tag ul');
- var listheight = list.height();
- var itemheight = item.outerHeight();
- var itemtop = item.position().top;
- if (itemtop > listheight) {
- var listscroll = list.scrollTop();
- list.scrollTop(listscroll + itemheight);
- }
- else if (itemtop < 0) {
- var listscroll = list.scrollTop();
- list.scrollTop(listscroll - itemheight);
- }
-
- }
- item.addClass(settings.classes.selectedDropdownItem);
- selected_dropdown_item = item.get(0);
- }
- }
-
- // Remove highlighting from an item in the results dropdown
- function deselect_dropdown_item (item) {
- item.removeClass(settings.classes.selectedDropdownItem);
- selected_dropdown_item = null;
- }
-
- // Do a search and show the "searching" dropdown if the input is longer
- // than settings.minChars
- function do_search() {
- var query = input_box.val().toLowerCase();
- if(query && query.length || settings.minChars == 0) {
- if(selected_token) {
- deselect_token($(selected_token), POSITION.AFTER);
- }
-
- if(query.length >= settings.minChars) {
- show_dropdown_searching();
- clearTimeout(timeout);
-
- timeout = setTimeout(function(){
- run_search(query);
- }, settings.searchDelay);
- } else {
- hide_dropdown();
- }
- }
- }
-
- // Do the actual search
- function run_search(query) {
- var cache_key = query + computeURL();
- var cached_results = cache.get(cache_key);
- if(cached_results) {
- populate_dropdown(query, cached_results);
- } else {
- // Are we doing an ajax search or local data search?
- if(settings.url) {
- var url = computeURL();
- // Extract exisiting get params
- var ajax_params = {};
- ajax_params.data = {};
- if(url.indexOf("?") > -1) {
- var parts = url.split("?");
- ajax_params.url = parts[0];
-
- var param_array = parts[1].split("&");
- $.each(param_array, function (index, value) {
- var kv = value.split("=");
- ajax_params.data[kv[0]] = kv[1];
- });
- } else {
- ajax_params.url = url;
- }
-
- // Prepare the request
- ajax_params.data[settings.queryParam] = query;
- ajax_params.type = settings.method;
- ajax_params.dataType = settings.contentType;
- if(settings.crossDomain) {
- ajax_params.dataType = "jsonp";
- }
-
- // Attach the success callback
- ajax_params.success = function(results) {
- if($.isFunction(settings.onResult)) {
- results = settings.onResult.call(hidden_input, results);
- }
- cache.add(cache_key, settings.jsonContainer ? results[settings.jsonContainer] : results);
-
- // only populate the dropdown if the results are associated with the active search query
- if(input_box.val().toLowerCase() === query) {
- populate_dropdown(query, settings.jsonContainer ? results[settings.jsonContainer] : results);
- }
- };
-
- // Make the request
- $.ajax(ajax_params);
- } else if(settings.search_function){
- settings.search_function(query, function(results){
- cache.add(cache_key, results);
- populate_dropdown(query, results);
- });
- } else if(settings.local_data) {
- // Do the search through local data
- var results = $.grep(settings.local_data, function (row) {
- return row[settings.propertyToSearch].toLowerCase().indexOf(query.toLowerCase()) > -1;
- });
-
- if($.isFunction(settings.onResult)) {
- results = settings.onResult.call(hidden_input, results);
- }
- cache.add(cache_key, results);
- populate_dropdown(query, results);
- }
- }
- }
-
- // compute the dynamic URL
- function computeURL() {
- var url = settings.url;
- if(typeof settings.url == 'function') {
- url = settings.url.call();
- }
- return url;
- }
-};
-
-// Really basic cache for the results
-$.TokenList.Cache = function (options) {
- var settings = $.extend({
- max_size: 500
- }, options);
-
- var data = {};
- var size = 0;
-
- var flush = function () {
- data = {};
- size = 0;
- };
-
- this.add = function (query, results) {
- if(size > settings.max_size) {
- flush();
- }
-
- if(!data[query]) {
- size += 1;
- }
-
- data[query] = results;
- };
-
- this.get = function (query) {
- return data[query];
- };
-};
-}(jQuery));
diff --git a/browser/extensions/pocket/content/panels/license.txt b/browser/extensions/pocket/content/panels/license.txt
deleted file mode 100644
index 7f3f806bab..0000000000
--- a/browser/extensions/pocket/content/panels/license.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-
-Unless where otherwise noted, the following license applies to the files
-within this directory and descendents of this directory.
-
-POCKET MARKS
-
-Notwithstanding the permitted uses of the Software (as defined below) pursuant
-to the license set forth below, "Pocket," "Read It Later" and the Pocket icon
-and logos (collectively, the “Pocket Marks”) are registered and common law
-trademarks of Read It Later, Inc. This means that, while you have considerable
-freedom to redistribute and modify the Software, there are tight restrictions
-on your ability to use the Pocket Marks. This license does not grant you any
-rights to use the Pocket Marks except as they are embodied in the Software.
-
----
-
-SOFTWARE
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/browser/extensions/pocket/content/panels/saved.html b/browser/extensions/pocket/content/panels/saved.html
deleted file mode 100644
index 93477d8ee2..0000000000
--- a/browser/extensions/pocket/content/panels/saved.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <meta charset="utf-8">
- <base href="chrome://pocket/content/panels/">
- <title>Pocket: Page Saved</title>
- <link rel="stylesheet" href="css/normalize.css">
- <link rel="stylesheet" href="css/firasans.css">
- <link rel="stylesheet" href="css/saved.css">
- </head>
- <body class="pkt_ext_containersaved" aria-live="polite">
- <script type="text/javascript" src="js/vendor/jquery-2.1.1.min.js"></script>
- <script type="text/javascript" src="js/vendor/handlebars.runtime.js"></script>
- <script type="text/javascript" src="js/vendor/jquery.tokeninput.min.js"></script>
- <script type="text/javascript" src="js/tmpl.js"></script>
- <script type="text/javascript" src="js/messages.js"></script>
- <script type="text/javascript" src="js/saved.js"></script>
- </body>
-</html>
diff --git a/browser/extensions/pocket/content/panels/signup.html b/browser/extensions/pocket/content/panels/signup.html
deleted file mode 100644
index bcdf66ed4c..0000000000
--- a/browser/extensions/pocket/content/panels/signup.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <meta charset="utf-8">
- <base href="chrome://pocket/content/panels/">
- <title>Pocket: Sign Up</title>
- <link rel="stylesheet" href="css/normalize.css">
- <link rel="stylesheet" href="css/firasans.css">
- <link rel="stylesheet" href="css/signup.css">
- </head>
- <body class="pkt_ext_containersignup" aria-live="polite">
- <script type="text/javascript" src="js/vendor/jquery-2.1.1.min.js"></script>
- <script type="text/javascript" src="js/vendor/handlebars.runtime.js"></script>
- <script type="text/javascript" src="js/tmpl.js"></script>
- <script type="text/javascript" src="js/messages.js"></script>
- <script type="text/javascript" src="js/signup.js"></script>
- </body>
-</html>
diff --git a/browser/extensions/pocket/content/panels/tmpl/saved_premiumextras.handlebars b/browser/extensions/pocket/content/panels/tmpl/saved_premiumextras.handlebars
deleted file mode 100644
index b224450ec1..0000000000
--- a/browser/extensions/pocket/content/panels/tmpl/saved_premiumextras.handlebars
+++ /dev/null
@@ -1,2 +0,0 @@
-<div class="pkt_ext_suggestedtag_detailshown">
-</div> \ No newline at end of file
diff --git a/browser/extensions/pocket/content/panels/tmpl/saved_premiumshell.handlebars b/browser/extensions/pocket/content/panels/tmpl/saved_premiumshell.handlebars
deleted file mode 100644
index 5ef0426365..0000000000
--- a/browser/extensions/pocket/content/panels/tmpl/saved_premiumshell.handlebars
+++ /dev/null
@@ -1,6 +0,0 @@
-<div class="pkt_ext_suggestedtag_detail pkt_ext_suggestedtag_detail_loading">
- <h4>{{suggestedtags}}</h4>
- <div class="pkt_ext_loadingspinner"><div></div></div>
- <ul class="pkt_ext_cf">
- </ul>
-</div> \ No newline at end of file
diff --git a/browser/extensions/pocket/content/panels/tmpl/saved_shell.handlebars b/browser/extensions/pocket/content/panels/tmpl/saved_shell.handlebars
deleted file mode 100644
index 89b7500cdd..0000000000
--- a/browser/extensions/pocket/content/panels/tmpl/saved_shell.handlebars
+++ /dev/null
@@ -1,29 +0,0 @@
-<div class="pkt_ext_initload">
- <div class="pkt_ext_logo"></div>
- <div class="pkt_ext_topdetail">
- <h2>{{saving}}</h2>
- </div>
- <div class="pkt_ext_loadingspinner"><div></div></div>
-</div>
-<div class="pkt_ext_detail">
- <div class="pkt_ext_logo"></div>
- <div class="pkt_ext_topdetail">
- <h2>{{pagesaved}}</h2>
- <h3 class="pkt_ext_errordetail"></h3>
- <nav class="pkt_ext_item_actions pkt_ext_cf">
- <ul>
- <li><a class="pkt_ext_removeitem" href="#">{{removepage}}</a></li>
- <li class="pkt_ext_actions_separator"></li>
- <li><a class="pkt_ext_openpocket" href="https://{{pockethost}}/a?src=ff_ext_saved" target="_blank">{{viewlist}}</a></li>
- </ul>
- </nav>
- </div>
- <div class="pkt_ext_tag_detail pkt_ext_cf">
- <div class="pkt_ext_tag_input_wrapper">
- <div class="pkt_ext_tag_input_blocker"></div>
- <input class="pkt_ext_tag_input" type="text" placeholder="{{addtags}}">
- </div>
- <a href="#" class="pkt_ext_btn pkt_ext_btn_disabled">{{save}}</a>
- </div>
- <p class="pkt_ext_edit_msg"></p>
-</div> \ No newline at end of file
diff --git a/browser/extensions/pocket/content/panels/tmpl/signup_shell.handlebars b/browser/extensions/pocket/content/panels/tmpl/signup_shell.handlebars
deleted file mode 100644
index 8dddaef60e..0000000000
--- a/browser/extensions/pocket/content/panels/tmpl/signup_shell.handlebars
+++ /dev/null
@@ -1,32 +0,0 @@
-<div class="pkt_ext_introdetail pkt_ext_introdetailhero">
- <h2 class="pkt_ext_logo">Pocket</h2>
- <p class="pkt_ext_tagline">{{tagline}}</p>
- {{#if showlearnmore}}
- {{#if controlvariant}}
- <p class="pkt_ext_learnmorecontainer"><a class="pkt_ext_learnmore" href="https://{{pockethost}}/firefox_learnmore?s=ffi&t=learnmore&tv=panel_control&v={{variant}}" target="_blank">{{learnmore}}</a></p>
- {{else}}
- <p class="pkt_ext_learnmorecontainer"><a class="pkt_ext_learnmore" href="https://{{pockethost}}/firefox_learnmore?s=ffi&t=learnmore&tv=panel_tryit&v={{variant}}" target="_blank">{{learnmore}}</a></p>
- {{/if}}
- {{else}}
- <p class="pkt_ext_learnmorecontainer"><a class="pkt_ext_learnmore pkt_ext_learnmoreinactive" href="#">{{learnmore}}</a></p>
- {{/if}}
- <div class="pkt_ext_introimg"></div>
-</div>
-<div class="pkt_ext_signupdetail pkt_ext_signupdetail_hero">
- {{#if fxasignedin}}
- <h4>{{signuptosave}}</h4>
- <p class="btn-container"><a href="https://{{pockethost}}/ff_signup?s=ffi&t=signupff&v={{variant}}" target="_blank" class="btn signup-btn-firefox"><span class="logo"></span><span class="text">{{signinfirefox}}</span></a></p>
- <p class="alreadyhave">{{alreadyhaveacct}} <a href="https://{{pockethost}}/login?ep=3&src=extension&s=ffi&t=login&v={{variant}}" target="_blank">{{loginnow}}</a>.</p>
- {{else}}
- {{#if controlvariant}}
- <h4>{{signuptosave}}</h4>
- <p class="btn-container"><a href="https://{{pockethost}}/ff_signup?s=ffi&tv=panel_control&t=signupff&v={{variant}}" target="_blank" class="btn signup-btn-firefox"><span class="logo"></span><span class="text">{{signupfirefox}}</span></a></p>
- <p class="btn-container"><a href="https://{{pockethost}}/signup?force=email&tv=panel_control&src=extension&s=ffi&t=signupemail&v={{variant}}" target="_blank" class="btn btn-secondary signup-btn-email signup-btn-initstate">{{signupemail}}</a></p>
- <p class="alreadyhave">{{alreadyhaveacct}} <a href="https://{{pockethost}}/login?ep=3&tv=panel_control&src=extension&s=ffi&t=login&v={{variant}}" target="_blank">{{loginnow}}</a>.</p>
- {{else}}
- <p class="btn-container"><a href="https://{{pockethost}}/firefox_tryitnow?s=ffi&tv=panel_tryit&t=tryitnow" target="_blank" class="btn signup-btn-tryitnow"><span class="text">{{tryitnow}}</span></a></p>
- <p class="alreadyhave tryitnowspace">{{alreadyhaveacct}} <a href="https://{{pockethost}}/login?ep=3&s=ffi&tv=panel_tryit&src=extension&t=login&v={{variant}}" target="_blank">{{loginnow}}</a>.</p>
- <p class="pkt_ext_tos">{{{tos}}}</p>
- {{/if}}
- {{/if}}
-</div>
diff --git a/browser/extensions/pocket/content/panels/tmpl/signupstoryboard_shell.handlebars b/browser/extensions/pocket/content/panels/tmpl/signupstoryboard_shell.handlebars
deleted file mode 100644
index 8a181e23d1..0000000000
--- a/browser/extensions/pocket/content/panels/tmpl/signupstoryboard_shell.handlebars
+++ /dev/null
@@ -1,43 +0,0 @@
-<div class="pkt_ext_introdetail pkt_ext_introdetailstoryboard">
- <div class="pkt_ext_introstory pkt_ext_introstoryone">
- <div class="pkt_ext_introstory_text">
- <p class="pkt_ext_tagline">{{taglinestory_one}}</p>
- </div>
- <div class="pkt_ext_introstoryone_img"></div>
- </div>
- <div class="pkt_ext_introstorydivider"></div>
- <div class="pkt_ext_introstory pkt_ext_introstorytwo">
- <div class="pkt_ext_introstory_text">
- <p class="pkt_ext_tagline">{{taglinestory_two}}</p>
- {{#if showlearnmore}}
- {{#if controlvariant}}
- <p><a class="pkt_ext_learnmore" href="https://{{pockethost}}/firefox_learnmore?s=ffi&t=learnmore&tv=panel_control&v={{variant}}" target="_blank">{{learnmore}}</a></p>
- {{else}}
- <p><a class="pkt_ext_learnmore" href="https://{{pockethost}}/firefox_learnmore?s=ffi&t=learnmore&tv=panel_tryit&v={{variant}}" target="_blank">{{learnmore}}</a></p>
- {{/if}}
- {{else}}
- <p><a class="pkt_ext_learnmore pkt_ext_learnmoreinactive" href="#">{{learnmore}}</a></p>
- {{/if}}
- </div>
- <div class="pkt_ext_introstorytwo_img"></div>
- </div>
-</div>
-<div class="pkt_ext_signupdetail">
- {{#if fxasignedin}}
- <h4>{{signuptosave}}</h4>
- <p class="btn-container"><a href="https://{{pockethost}}/ff_signup?s=ffi&t=signupff&v={{variant}}" target="_blank" class="btn signup-btn-firefox"><span class="logo"></span><span class="text">{{signinfirefox}}</span></a></p>
- <p class="alreadyhave">{{alreadyhaveacct}} <a href="https://{{pockethost}}/login?ep=3&src=extension&s=ffi&t=login&v={{variant}}" target="_blank">{{loginnow}}</a>.</p>
- {{else}}
- {{#if controlvariant}}
- <h4>{{signuptosave}}</h4>
- <p class="btn-container"><a href="https://{{pockethost}}/ff_signup?s=ffi&tv=panel_control&t=signupff&v={{variant}}" target="_blank" class="btn signup-btn-firefox"><span class="logo"></span><span class="text">{{signupfirefox}}</span></a></p>
- <p class="btn-container"><a href="https://{{pockethost}}/signup?force=email&tv=panel_control&src=extension&s=ffi&t=signupemail&v={{variant}}" target="_blank" class="btn btn-secondary signup-btn-email signup-btn-initstate">{{signupemail}}</a></p>
- <p class="alreadyhave">{{alreadyhaveacct}} <a href="https://{{pockethost}}/login?ep=3&tv=panel_control&src=extension&s=ffi&t=login&v={{variant}}" target="_blank">{{loginnow}}</a>.</p>
- {{else}}
- <p class="btn-container"><a href="https://{{pockethost}}/firefox_tryitnow?s=ffi&tv=panel_tryit&t=tryitnow" target="_blank" class="btn signup-btn-tryitnow"><span class="text">{{tryitnow}}</span></a></p>
- <p class="alreadyhave tryitnowspace">{{alreadyhaveacct}} <a href="https://{{pockethost}}/login?ep=3&s=ffi&tv=panel_tryit&src=extension&t=login&v={{variant}}" target="_blank">{{loginnow}}</a>.</p>
- <p class="pkt_ext_tos">{{{tos}}}</p>
- {{/if}}
- {{/if}}
-
-</div>
diff --git a/browser/extensions/pocket/content/pktApi.jsm b/browser/extensions/pocket/content/pktApi.jsm
deleted file mode 100644
index 63b6d415c9..0000000000
--- a/browser/extensions/pocket/content/pktApi.jsm
+++ /dev/null
@@ -1,657 +0,0 @@
-/*
- * LICENSE
- *
- * POCKET MARKS
- *
- * Notwithstanding the permitted uses of the Software (as defined below) pursuant to the license set forth below, "Pocket," "Read It Later" and the Pocket icon and logos (collectively, the “Pocket Marks”) are registered and common law trademarks of Read It Later, Inc. This means that, while you have considerable freedom to redistribute and modify the Software, there are tight restrictions on your ability to use the Pocket Marks. This license does not grant you any rights to use the Pocket Marks except as they are embodied in the Software.
- *
- * ---
- *
- * SOFTWARE
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-/*
- * Pocket API module
- *
- * Public API Documentation: http://getpocket.com/developer/
- *
- *
- * Definition of keys stored in preferences to preserve user state:
- * premium_status: Current premium status for logged in user if available
- * Can be 0 for no premium and 1 for premium
- * latestSince: Last timestamp a save happened
- * tags: All tags for logged in user
- * usedTags: All used tags from within the extension sorted by recency
- */
-
-const {classes: Cc, interfaces: Ci, utils: Cu, manager: Cm} = Components;
-this.EXPORTED_SYMBOLS = ["pktApi"];
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-
-
-var pktApi = (function() {
-
- /**
- * Configuration
- */
-
- // Base url for all api calls
- var pocketAPIhost = Services.prefs.getCharPref("extensions.pocket.api"); // api.getpocket.com
- var pocketSiteHost = Services.prefs.getCharPref("extensions.pocket.site"); // getpocket.com
- var baseAPIUrl = "https://" + pocketAPIhost + "/v3";
-
-
- /**
- * Auth keys for the API requests
- */
- var oAuthConsumerKey = Services.prefs.getCharPref("extensions.pocket.oAuthConsumerKey");
-
- /**
- *
- */
- var prefBranch = Services.prefs.getBranch("extensions.pocket.settings.");
-
- /**
- * Helper
- */
-
- var extend = function(out) {
- out = out || {};
-
- for (var i = 1; i < arguments.length; i++) {
- if (!arguments[i])
- continue;
-
- for (var key in arguments[i]) {
- if (arguments[i].hasOwnProperty(key))
- out[key] = arguments[i][key];
- }
- }
- return out;
- }
-
- var parseJSON = function(jsonString) {
- try {
- var o = JSON.parse(jsonString);
-
- // Handle non-exception-throwing cases:
- // Neither JSON.parse(false) or JSON.parse(1234) throw errors, hence the type-checking,
- // but... JSON.parse(null) returns 'null', and typeof null === "object",
- // so we must check for that, too.
- if (o && typeof o === "object" && o !== null) {
- return o;
- }
- }
- catch (e) { }
-
- return undefined;
- };
-
- /**
- * Settings
- */
-
- /**
- * Wrapper for different plattforms to get settings for a given key
- * @param {string} key A string containing the name of the key you want to
- * retrieve the value of
- * @return {string} String containing the value of the key. If the key
- * does not exist, null is returned
- */
- function getSetting(key) {
- // TODO : Move this to sqlite or a local file so it's not editable (and is safer)
- // https://developer.mozilla.org/en-US/Add-ons/Overlay_Extensions/XUL_School/Local_Storage
-
- if (!prefBranch.prefHasUserValue(key))
- return undefined;
-
- return prefBranch.getComplexValue(key, Components.interfaces.nsISupportsString).data;
- }
-
- /**
- * Wrapper for different plattforms to set a value for a given key in settings
- * @param {string} key A string containing the name of the key you want
- * to create/update.
- * @param {string} value String containing the value you want to give
- * the key you are creating/updating.
- */
- function setSetting(key, value) {
- // TODO : Move this to sqlite or a local file so it's not editable (and is safer)
- // https://developer.mozilla.org/en-US/Add-ons/Overlay_Extensions/XUL_School/Local_Storage
-
- if (!value)
- prefBranch.clearUserPref(key);
- else
- {
- // We use complexValue as tags can have utf-8 characters in them
- var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);
- str.data = value;
- prefBranch.setComplexValue(key, Components.interfaces.nsISupportsString, str);
- }
- }
-
- /**
- * Auth
- */
-
- /*
- * All cookies from the Pocket domain
- * The return format: { cookieName:cookieValue, cookieName:cookieValue, ... }
- */
- function getCookiesFromPocket() {
-
- var cookieManager = Cc["@mozilla.org/cookiemanager;1"].getService(Ci.nsICookieManager2);
- var pocketCookies = cookieManager.getCookiesFromHost(pocketSiteHost, {});
- var cookies = {};
- while (pocketCookies.hasMoreElements()) {
- var cookie = pocketCookies.getNext().QueryInterface(Ci.nsICookie2);
- cookies[cookie.name] = cookie.value;
- }
- return cookies;
- }
-
- /**
- * Returns access token or undefined if no logged in user was found
- * @return {string | undefined} Access token for logged in user user
- */
- function getAccessToken() {
- var pocketCookies = getCookiesFromPocket();
-
- // If no cookie was found just return undefined
- if (typeof pocketCookies['ftv1'] === "undefined") {
- return undefined;
- }
-
- // Check if a new user logged in in the meantime and clearUserData if so
- var sessionId = pocketCookies['fsv1'];
- var lastSessionId = getSetting('fsv1');
- if (sessionId !== lastSessionId) {
- clearUserData();
- setSetting("fsv1", sessionId);
- }
-
- // Return access token
- return pocketCookies['ftv1'];
- }
-
- /**
- * Get the current premium status of the user
- * @return {number | undefined} Premium status of user
- */
- function getPremiumStatus() {
- var premiumStatus = getSetting("premium_status");
- if (typeof premiumStatus === "undefined") {
- // Premium status is not in settings try get it from cookie
- var pocketCookies = getCookiesFromPocket();
- premiumStatus = pocketCookies['ps'];
- }
- return premiumStatus;
- }
-
- /**
- * Helper method to check if a user is premium or not
- * @return {Boolean} Boolean if user is premium or not
- */
- function isPremiumUser() {
- return getPremiumStatus() == 1;
- }
-
-
- /**
- * Returns users logged in status
- * @return {Boolean} Users logged in status
- */
- function isUserLoggedIn() {
- return (typeof getAccessToken() !== "undefined");
- }
-
- /**
- * API
- */
-
- /**
- * Helper function for executing api requests. It mainly configures the
- * ajax call with default values like type, headers or dataType for an api call.
- * This function is for internal usage only.
- * @param {Object} options
- * Possible keys:
- * - {string} path: This should be the Pocket API
- * endpoint to call. For example providing the path
- * "/get" would result in a call to getpocket.com/v3/get
- * - {Object|undefined} data: Gets passed on to the jQuery ajax
- * call as data parameter
- * - {function(Object data, XMLHttpRequest xhr) | undefined} success:
- * A function to be called if the request succeeds.
- * - {function(Error errorThrown, XMLHttpRequest xhr) | undefined} error:
- * A function to be called if the request fails.
- * @return {Boolean} Returns Boolean whether the api call started sucessfully
- *
- */
- function apiRequest(options) {
- if ((typeof options === "undefined") || (typeof options.path === "undefined")) {
- return false;
- }
-
- var url = baseAPIUrl + options.path;
- var data = options.data || {};
- data.locale_lang = Cc["@mozilla.org/chrome/chrome-registry;1"].
- getService(Ci.nsIXULChromeRegistry).
- getSelectedLocale("browser");
- data.consumer_key = oAuthConsumerKey;
-
- var request = Components.classes["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Components.interfaces.nsIXMLHttpRequest);
- request.open("POST", url, true);
- request.onreadystatechange = function(e) {
- if (request.readyState == 4) {
- if (request.status === 200) {
- // There could still be an error if the response is no valid json
- // or does not have status = 1
- var response = parseJSON(request.response);
- if (options.success && response && response.status == 1) {
- options.success(response, request);
- return;
- }
- }
-
- // Handle error case
- if (options.error) {
- // In case the user did revoke the access token or it's not
- // valid anymore clear the user data
- if (request.status === 401) {
- clearUserData();
- }
-
- // Handle error message
- var errorMessage;
- if (request.status !== 200) {
- errorMessage = request.getResponseHeader("X-Error") || request.statusText;
- errorMessage = JSON.parse('"' + errorMessage + '"');
- }
- var error = {message: errorMessage};
- options.error(error, request);
- }
- }
- };
-
- // Set headers
- request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8');
- request.setRequestHeader('X-Accept', ' application/json');
-
- // Serialize and Fire off the request
- var str = [];
- for (var p in data) {
- if (data.hasOwnProperty(p)) {
- str.push(encodeURIComponent(p) + "=" + encodeURIComponent(data[p]));
- }
- }
-
- request.send(str.join("&"));
-
- return true;
- }
-
- /**
- * Cleans all settings for the previously logged in user
- */
- function clearUserData() {
- // Clear stored information
- setSetting("premium_status", undefined);
- setSetting("latestSince", undefined);
- setSetting("tags", undefined);
- setSetting("usedTags", undefined);
-
- setSetting("fsv1", undefined);
- }
-
- /**
- * Add a new link to Pocket
- * @param {string} url URL of the link
- * @param {Object | undefined} options Can provide a string-based title, a
- * `success` callback and an `error` callback.
- * @return {Boolean} Returns Boolean whether the api call started sucessfully
- */
- function addLink(url, options) {
-
- var since = getSetting('latestSince');
- var accessToken = getAccessToken();
-
- var sendData = {
- access_token: accessToken,
- url: url,
- since: since ? since : 0
- };
-
- if (options.title) {
- sendData.title = options.title;
- }
-
- return apiRequest({
- path: "/firefox/save",
- data: sendData,
- success: function(data) {
-
- // Update premium status, tags and since
- var tags = data.tags;
- if ((typeof tags !== "undefined") && Array.isArray(tags)) {
- // If a tagslist is in the response replace the tags
- setSetting('tags', JSON.stringify(data.tags));
- }
-
- // Update premium status
- var premiumStatus = data.premium_status;
- if (typeof premiumStatus !== "undefined") {
- // If a premium_status is in the response replace the premium_status
- setSetting("premium_status", premiumStatus);
- }
-
- // Save since value for further requests
- setSetting('latestSince', data.since);
-
- if (options.success) {
- options.success.apply(options, Array.apply(null, arguments));
- }
- },
- error: options.error
- });
- }
-
- /**
- * Delete an item identified by item id from the users list
- * @param {string} itemId The id from the item we want to remove
- * @param {Object | undefined} options Can provide an actionInfo object with
- * further data to send to the API. Can
- * have success and error callbacks
- * @return {Boolean} Returns Boolean whether the api call started sucessfully
- */
- function deleteItem(itemId, options) {
- var action = {
- action: "delete",
- item_id: itemId
- };
- return sendAction(action, options);
- }
-
- /**
- * General function to send all kinds of actions like adding of links or
- * removing of items via the API
- * @param {Object} action Action object
- * @param {Object | undefined} options Can provide an actionInfo object
- * with further data to send to the
- * API. Can have success and error
- * callbacks
- * @return {Boolean} Returns Boolean whether the api call started sucessfully
- */
- function sendAction(action, options) {
- // Options can have an 'actionInfo' object. This actionInfo object gets
- // passed through to the action object that will be send to the API endpoint
- if (typeof options.actionInfo !== 'undefined') {
- action = extend(action, options.actionInfo);
- }
- return sendActions([action], options);
- }
-
- /**
- * General function to send all kinds of actions like adding of links or
- * removing of items via the API
- * @param {Array} actions Array of action objects
- * @param {Object | undefined} options Can have success and error callbacks
- * @return {Boolean} Returns Boolean whether the api call started sucessfully
- */
- function sendActions(actions, options) {
- return apiRequest({
- path: "/send",
- data: {
- access_token: getAccessToken(),
- actions: JSON.stringify(actions)
- },
- success: options.success,
- error: options.error
- });
- }
-
- /**
- * Handling Tags
- */
-
- /**
- * Add tags to the item identified by the url. Also updates the used tags
- * list
- * @param {string} itemId The item identifier by item id
- * @param {Array} tags Tags adding to the item
- * @param {Object | undefined} options Can provide an actionInfo object with
- * further data to send to the API. Can
- * have success and error callbacks
- * @return {Boolean} Returns Boolean whether the api call started sucessfully
- */
- function addTagsToItem(itemId, tags, options) {
- return addTags({item_id: itemId}, tags, options);
- }
-
- /**
- * Add tags to the item identified by the url. Also updates the used tags
- * list
- * @param {string} url The item identifier by url
- * @param {Array} tags Tags adding to the item
- * @param {Object} options Can provide an actionInfo object with further
- * data to send to the API. Can have success and error
- * callbacks
- * @return {Boolean} Returns Boolean whether the api call started sucessfully
- */
- function addTagsToURL(url, tags, options) {
- return addTags({url: url}, tags, options);
- }
-
- /**
- * Helper function to execute the add tags api call. Will be used from addTagsToURL
- * and addTagsToItem but not exposed outside
- * @param {string} actionPart Specific action part to add to action
- * @param {Array} tags Tags adding to the item
- * @param {Object | undefined} options Can provide an actionInfo object with
- * further data to send to the API. Can
- * have success and error callbacks
- * @return {Boolean} Returns Boolean whether the api call started sucessfully
- */
- function addTags(actionPart, tags, options) {
- // Tags add action
- var action = {
- action: "tags_add",
- tags: tags
- };
- action = extend(action, actionPart);
-
- // Backup the success callback as we need it later
- var finalSuccessCallback = options.success;
-
- // Switch the success callback
- options.success = function(data) {
-
- // Update used tags
- var usedTagsJSON = getSetting("usedTags");
- var usedTags = usedTagsJSON ? JSON.parse(usedTagsJSON) : {};
-
- // Check for each tag if it's already in the used tags
- for (var i = 0; i < tags.length; i++) {
- var tagToSave = tags[i].trim();
- var newUsedTagObject = {
- "tag": tagToSave,
- "timestamp": new Date().getTime()
- };
- usedTags[tagToSave] = newUsedTagObject;
- }
- setSetting("usedTags", JSON.stringify(usedTags));
-
- // Let the callback know that we are finished
- if (finalSuccessCallback) {
- finalSuccessCallback(data);
- }
- };
-
- // Execute the action
- return sendAction(action, options);
- }
-
- /**
- * Get all cached tags and used tags within the callback
- * @param {function(Array, Array, Boolean)} callback
- * Function with tags and used tags as parameter.
- */
- function getTags(callback) {
-
- var tagsFromSettings = function() {
- var tagsJSON = getSetting("tags");
- if (typeof tagsJSON !== "undefined") {
- return JSON.parse(tagsJSON)
- }
- return [];
- }
-
- var sortedUsedTagsFromSettings = function() {
- // Get and Sort used tags
- var usedTags = [];
-
- var usedTagsJSON = getSetting("usedTags");
- if (typeof usedTagsJSON !== "undefined") {
- var usedTagsObject = JSON.parse(usedTagsJSON);
- var usedTagsObjectArray = [];
- for (var tagKey in usedTagsObject) {
- usedTagsObjectArray.push(usedTagsObject[tagKey]);
- }
-
- // Sort usedTagsObjectArray based on timestamp
- usedTagsObjectArray.sort(function(usedTagA, usedTagB) {
- var a = usedTagA.timestamp;
- var b = usedTagB.timestamp;
- return a - b;
- });
-
- // Get all keys tags
- for (var j = 0; j < usedTagsObjectArray.length; j++) {
- usedTags.push(usedTagsObjectArray[j].tag);
- }
-
- // Reverse to set the last recent used tags to the front
- usedTags.reverse();
- }
-
- return usedTags;
- }
-
- if (callback) {
- var tags = tagsFromSettings();
- var usedTags = sortedUsedTagsFromSettings();
- callback(tags, usedTags);
- }
- }
-
- /**
- * Fetch suggested tags for a given item id
- * @param {string} itemId Item id of
- * @param {Object | undefined} options Can provide an actionInfo object
- * with further data to send to the API.
- * Can have success and error callbacks
- * @return {Boolean} Returns Boolean whether the api call started sucessfully
- */
- function getSuggestedTagsForItem(itemId, options) {
- return getSuggestedTags({item_id: itemId}, options);
- }
-
- /**
- * Fetch suggested tags for a given URL
- * @param {string} url (required) The item identifier by url
- * @param {Object} options Can provide an actionInfo object with further
- * data to send to the API. Can have success and error
- * callbacks
- * @return {Boolean} Returns Boolean whether the api call started sucessfully
- */
- function getSuggestedTagsForURL(url, options) {
- return getSuggestedTags({url: url}, options);
- }
-
- /**
- * Helper function to get suggested tags
- * @return {Boolean} Returns Boolean whether the api call started sucessfully
- */
- function getSuggestedTags(data, options) {
-
- data = data || {};
- options = options || {};
-
- data.access_token = getAccessToken();
-
- return apiRequest({
- path: "/getSuggestedTags",
- data: data,
- success: options.success,
- error: options.error
- });
- }
-
- /**
- * Helper function to get current signup AB group the user is in
- */
- function getSignupPanelTabTestVariant() {
- return getMultipleTestOption('panelSignUp', {control: 1, v1: 8, v2: 1 })
- }
-
- function getMultipleTestOption(testName, testOptions) {
- // Get the test from preferences if we've already assigned the user to a test
- var settingName = 'test.' + testName;
- var assignedValue = getSetting(settingName);
- var valArray = [];
-
- // If not assigned yet, pick and store a value
- if (!assignedValue)
- {
- // Get a weighted array of test variants from the testOptions object
- Object.keys(testOptions).forEach(function(key) {
- for (var i = 0; i < testOptions[key]; i++) {
- valArray.push(key);
- }
- });
-
- // Get a random test variant and set the user to it
- assignedValue = valArray[Math.floor(Math.random() * valArray.length)];
- setSetting(settingName, assignedValue);
- }
-
- return assignedValue;
-
- }
-
- /**
- * Public functions
- */
- return {
- isUserLoggedIn : isUserLoggedIn,
- clearUserData: clearUserData,
- addLink: addLink,
- deleteItem: deleteItem,
- addTagsToItem: addTagsToItem,
- addTagsToURL: addTagsToURL,
- getTags: getTags,
- isPremiumUser: isPremiumUser,
- getSuggestedTagsForItem: getSuggestedTagsForItem,
- getSuggestedTagsForURL: getSuggestedTagsForURL,
- getSignupPanelTabTestVariant: getSignupPanelTabTestVariant,
- };
-}());
diff --git a/browser/extensions/pocket/content/pocket-content-process.js b/browser/extensions/pocket/content/pocket-content-process.js
deleted file mode 100644
index 9b158a0ed2..0000000000
--- a/browser/extensions/pocket/content/pocket-content-process.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-"use strict";
-
-// This file is loaded as a process script, it will be loaded in the parent
-// process as well as all content processes.
-
-const { utils: Cu } = Components;
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("chrome://pocket/content/AboutPocket.jsm");
-
-function AboutPocketChildListener() {
-}
-AboutPocketChildListener.prototype = {
- onStartup: function onStartup() {
-
- // Only do this in content processes since, as the broadcaster of this
- // message, the parent process doesn't also receive it. We handlers
- // the shutting down separately.
- if (Services.appinfo.processType ==
- Services.appinfo.PROCESS_TYPE_CONTENT) {
-
- Services.cpmm.addMessageListener("PocketShuttingDown", this, true);
- }
-
- AboutPocket.aboutSaved.register();
- AboutPocket.aboutSignup.register();
- },
-
- onShutdown: function onShutdown() {
- AboutPocket.aboutSignup.unregister();
- AboutPocket.aboutSaved.unregister();
-
- Services.cpmm.removeMessageListener("PocketShuttingDown", this);
- Cu.unload("chrome://pocket/content/AboutPocket.jsm");
- },
-
- receiveMessage: function receiveMessage(message) {
- switch (message.name) {
- case "PocketShuttingDown":
- this.onShutdown();
- break;
- default:
- break;
- }
-
- return;
- }
-};
-
-const listener = new AboutPocketChildListener();
-listener.onStartup();
diff --git a/browser/extensions/pocket/install.rdf.in b/browser/extensions/pocket/install.rdf.in
deleted file mode 100644
index babccfa5a8..0000000000
--- a/browser/extensions/pocket/install.rdf.in
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
- - License, v. 2.0. If a copy of the MPL was not distributed with this
- - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-#filter substitution
-
-<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-
- <Description about="urn:mozilla:install-manifest">
- <em:id>firefox@getpocket.com</em:id>
- <em:version>1.0.5</em:version>
- <em:type>2</em:type>
- <em:bootstrap>true</em:bootstrap>
- <em:multiprocessCompatible>true</em:multiprocessCompatible>
-
- <!-- Target Application this theme can install into,
- with minimum and maximum supported versions. -->
- <em:targetApplication>
- <Description>
- <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
- <em:minVersion>@MOZ_APP_VERSION@</em:minVersion>
- <em:maxVersion>@MOZ_APP_MAXVERSION@</em:maxVersion>
- </Description>
- </em:targetApplication>
-
- <!-- Front End MetaData -->
- <em:name>Pocket</em:name>
- <em:description>When you find something you want to view later, put it in Pocket.</em:description>
- </Description>
-</RDF>
diff --git a/browser/extensions/pocket/jar.mn b/browser/extensions/pocket/jar.mn
deleted file mode 100644
index 5fab627fe0..0000000000
--- a/browser/extensions/pocket/jar.mn
+++ /dev/null
@@ -1,32 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-[features/firefox@getpocket.com] chrome.jar:
-% content pocket %content/ contentaccessible=yes
-% skin pocket classic/1.0 %skin/linux/
-% skin pocket classic/1.0 %skin/osx/ os=Darwin
-% skin pocket classic/1.0 %skin/windows/ os=WINNT
-% skin pocket-shared classic/1.0 %skin/shared/
- content/ (content/*)
- skin/ (skin/*)
-# windows overrides
-% override chrome://pocket/skin/menuPanel.png chrome://pocket/skin/menuPanel-aero.png os=WINNT osversion=6
-% override chrome://pocket/skin/menuPanel.png chrome://pocket/skin/menuPanel-aero.png os=WINNT osversion=6.1
-% override chrome://pocket/skin/menuPanel@2x.png chrome://pocket/skin/menuPanel-aero@2x.png os=WINNT osversion=6
-% override chrome://pocket/skin/menuPanel@2x.png chrome://pocket/skin/menuPanel-aero@2x.png os=WINNT osversion=6.1
-% override chrome://pocket/skin/Toolbar@2x.png chrome://pocket/skin/Toolbar-aero@2x.png os=WINNT osversion=6
-% override chrome://pocket/skin/Toolbar@2x.png chrome://pocket/skin/Toolbar-aero@2x.png os=WINNT osversion=6.1
-% override chrome://pocket/skin/Toolbar@2x.png chrome://pocket/skin/Toolbar-win8@2x.png os=WINNT osversion=6.2
-% override chrome://pocket/skin/Toolbar@2x.png chrome://pocket/skin/Toolbar-win8@2x.png os=WINNT osversion=6.3
-% override chrome://pocket/skin/Toolbar.png chrome://pocket/skin/Toolbar-XP.png os=WINNT osversion<6
-% override chrome://pocket/skin/Toolbar.png chrome://pocket/skin/Toolbar-aero.png os=WINNT osversion=6
-% override chrome://pocket/skin/Toolbar.png chrome://pocket/skin/Toolbar-aero.png os=WINNT osversion=6.1
-% override chrome://pocket/skin/Toolbar.png chrome://pocket/skin/Toolbar-win8.png os=WINNT osversion=6.2
-% override chrome://pocket/skin/Toolbar.png chrome://pocket/skin/Toolbar-win8.png os=WINNT osversion=6.3
-# osx overrides
-% override chrome://pocket/skin/Toolbar.png chrome://pocket/skin/Toolbar-yosemite.png os=Darwin osversion>=10.10
-% override chrome://pocket/skin/Toolbar@2x.png chrome://pocket/skin/Toolbar-yosemite@2x.png os=Darwin osversion>=10.10
-% override chrome://pocket/skin/menuPanel.png chrome://pocket/skin/menuPanel-yosemite.png os=Darwin osversion>=10.10
-% override chrome://pocket/skin/menuPanel@2x.png chrome://pocket/skin/menuPanel-yosemite@2x.png os=Darwin osversion>=10.10
-
diff --git a/browser/extensions/pocket/locale/ast/pocket.properties b/browser/extensions/pocket/locale/ast/pocket.properties
deleted file mode 100644
index c32e53b54f..0000000000
--- a/browser/extensions/pocket/locale/ast/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Amestar etiquetes
-alreadyhaveacct = ¿Yá yes un usuariu de Pocket?
-continueff = Siguir con Firefox
-errorgeneric = Hebo un fallu tentando de guardar en Pocket.
-learnmore = Depriendi más
-loginnow = Aniciar sesión
-maxtaglength = Les etiquetes lléndense a 25 caráuteres
-mustbeconnected = Has tar coneutáu a internet pa guardar en Pocket. Comprueba la to conexón y volvi tentalo, por favor.
-onlylinkssaved = Namái puen guardase enllaces
-pagenotsaved = Páxina non guardada
-pageremoved = Páxina desaniciada
-pagesaved = Guardóse en Pocket
-processingremove = Desaniciando páxina…
-processingtags = Amestando etiquetes…
-removepage = Desanicia páxina
-save = Guardar
-saving = Guardando…
-signupemail = Rexistrase con corréu
-signuptosave = Rexístrate en Pocket. Ye de baldre.
-suggestedtags = Etiquetes suxeríes
-tagline = Guardar artículos y vídeos dende Firefox pa ver en Pocket o en cualquier preséu, en cualquier momentu.
-taglinestory_one = Fai clic nel botón de Pocket pa guardar cualquier artículu, videu o páxina dende Firefox.
-taglinestory_two = Ver en Pocker o en cualquier preséu, en cualquier momentu.
-tagssaved = Etiquetes amestaes
-tos = Sigiuiendo, tas acordies colos <a href="%1$S" target="_blank">Términos de Serviciu</a> y la <a href="%2$S" target="_blank">Política de privacidá</a> de Pocket
-tryitnow = Pruébalu agora
-signinfirefox = Anicia sesión con Firefox
-signupfirefox = Rexístrate con Firefox
-viewlist = Ver llista
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Guardar en Pocket
-saveToPocketCmd.label = Guardar páxina en Pocket
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = Guardar enllaz en Pocket
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = Ver la llista de Pocket
diff --git a/browser/extensions/pocket/locale/az/pocket.properties b/browser/extensions/pocket/locale/az/pocket.properties
deleted file mode 100644
index a228ca026d..0000000000
--- a/browser/extensions/pocket/locale/az/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Etiket əlavə et
-alreadyhaveacct = Artıq Pocket istifadəçisisiniz?
-continueff = Firefox ilə davam et
-errorgeneric = Pocket-ə saxlarkən xəta baş verdi.
-learnmore = Ətraflı Öyrən
-loginnow = Daxil ol
-maxtaglength = Etiketlər 25 simvol ilə limitlidir
-mustbeconnected = Pocket-ə saxlamaq üçün internetə qoşulu olmalısınız. Lütfən internetə qoşulu olduğunuza əmin olub təkrar yoxlayın.
-onlylinkssaved = Ancaq keçidlər saxlana bilər
-pagenotsaved = Səhifə saxlanmadı
-pageremoved = Səhifə silindi
-pagesaved = Pocket-ə saxlandı
-processingremove = Səhifə silinir…
-processingtags = Etiketlər əlavə edilir…
-removepage = Səhifəni sil
-save = Saxla
-saving = Saxlanır…
-signupemail = E-poçt ilə qeyd ol
-signuptosave = Pocket üçün qeyd ol. Bu pulsuzdur.
-suggestedtags = Məsləhərli etiketlər
-tagline = Firefoxdan məqalə və videoları Pocket-ə saxlayın, istədiyiniz vaxt, istədiyiniz yerdə baxın.
-taglinestory_one = Firefoxda hər hansı bir məqalə, video və ya səhifəni saxlamaq üçün Pocket Düyməsinə klikləyin.
-taglinestory_two = İstənilən cihazda, istənilən vaxt Pocket-də görün.
-tagssaved = Etiketlər əlavə edildi
-tos = Davam etməklə, Pocket-in <a href="%1$S" target="_blank">İstifadə Şərtləri</a> və <a href="%2$S" target="_blank">Məxfilik Siyasəti</a> ilə razılaşmış olursunuz
-tryitnow = İndi Yoxlayın
-signinfirefox = Firefox ilə daxil ol
-signupfirefox = Firefox ilə qeyd ol
-viewlist = Siyahını gör
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Pocket-ə Saxla
-saveToPocketCmd.label = Səhifəni Pocket-ə Saxla
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = Keçidi Pocket-ə Saxla
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = Pocket Siyahısını Gör
diff --git a/browser/extensions/pocket/locale/bg/pocket.properties b/browser/extensions/pocket/locale/bg/pocket.properties
deleted file mode 100644
index ba86dd7f6d..0000000000
--- a/browser/extensions/pocket/locale/bg/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Добавяне на етикети
-alreadyhaveacct = Вече сте потребител на Pocket?
-continueff = Продължаване с Firefox
-errorgeneric = Получи се грешка при опит за запис в Pocket.
-learnmore = Научете повече
-loginnow = Вписване
-maxtaglength = Етикетите могат да са до 25 знака
-mustbeconnected = Трябва да сте свързан към Интернет, за да запазвате в Pocket. Моля, проверете свързаността си с Интернет и пробвайте отново.
-onlylinkssaved = Могат да бъдат запазвани само връзки
-pagenotsaved = Страницата не е запазена
-pageremoved = Страницата е премахната
-pagesaved = Запазена в Pocket
-processingremove = Премахване на страница…
-processingtags = Добавяне на етикети…
-removepage = Премахване на страница
-save = Запазване
-saving = Запазване…
-signupemail = Регистриране с мейл
-signuptosave = Регистрирайте се в Pocket. Безплатно е.
-suggestedtags = Предложени етикети
-tagline = Запазвайте статии и видеота от Firefox и можете да ги преглеждате в Pocket на всяко устройство по всяко време.
-taglinestory_one = Щракнете на бутона на Pocket за запазване на статия, видео или страница от Firefox.
-taglinestory_two = Преглеждайте в Pocket на всяко устройство и по всяко време.
-tagssaved = Етикетите са добавени
-tos = Продължавайки, вие се съгласявате с <a href="%1$S" target="_blank">Условията за ползване</a> и <a href="%2$S" target="_blank">Политиката за поверителност</a> на Pocket
-tryitnow = Опитайте сега
-signinfirefox = Вписване с Firefox
-signupfirefox = Регистриране с Firefox
-viewlist = Преглед на списъка
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Запазване в Pocket
-saveToPocketCmd.label = Запазване на страницата в Pocket
-saveToPocketCmd.accesskey = с
-saveLinkToPocketCmd.label = Запазване на връзката в Pocket
-saveLinkToPocketCmd.accesskey = в
-pocketMenuitem.label = Преглед списъка на Pocket
diff --git a/browser/extensions/pocket/locale/bn-BD/pocket.properties b/browser/extensions/pocket/locale/bn-BD/pocket.properties
deleted file mode 100644
index 7a43edad17..0000000000
--- a/browser/extensions/pocket/locale/bn-BD/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = ট্যাগ যোগ করুন
-alreadyhaveacct = আপনি Pocket ব্যবহার করছেন?
-continueff = Firefox ব্যবহার চালিয়ে যান
-errorgeneric = Pocket এ সংরক্ষণ করতে ত্রুটি ঘটেছে।
-learnmore = আরও জানুন
-loginnow = লগ ইন
-maxtaglength = ট্যাগ ২৫ অক্ষরের মধ্যে সীমাবদ্ধ
-mustbeconnected = Pocket এ কোন কিছু সংরক্ষণ করে রাখতে চাইলে, ইন্টারনেটে সংযুক্ত থাকতে হবে। ইন্টারনেট সংযোগ পরীক্ষা করুন এবং আবার চেষ্টা করুন।
-onlylinkssaved = শুধু লিঙ্ক সংরক্ষণ করা যাবে
-pagenotsaved = পাতা সংরক্ষণ করা হয়নি
-pageremoved = পাতা অপসারণ করা হয়েছে
-pagesaved = Pocket এ সংরক্ষিত হয়েছে
-processingremove = পাতা অপসারিত হচ্ছে…
-processingtags = ট্যাগ যুক্ত করা হচ্ছে…
-removepage = পেজ মুছে ফেলুন
-save = সংরক্ষণ
-saving = সংরক্ষণ করা হচ্ছে...
-signupemail = ইমেইল দিয়ে সাইন আপ করুন
-signuptosave = Pocket সাইন আপ করুন। এটি মুফত।
-suggestedtags = প্রস্তাবিত ট্যাগ
-tagline = Pocket এর মাধ্যমে যেকোন সময়, যেকোন ডিভাইসে নিবন্ধ এবং ভিডিও দেখতে Firefox থেকে সেগুলো সংরক্ষণ করুন।
-taglinestory_one = Firefox থেকে আর্টিকেল, ভিডিও বা পৃষ্ঠা সংরক্ষণ করার জন্য Pocket বাটন ক্লিক করুন।
-taglinestory_two = যেকোন সময়ে, যেকোন স্থানে Pocket এ দেখুন।
-tagssaved = ট্যাগ যোগ করা হয়েছে
-tos = এটি অব্যহত রেখে, আপনি Pocket এর <a href="%1$S" target="_blank">সেবার শর্তাবলী</a> এবং <a href="%2$S" target="_blank">গোপনীয়তা নীতিমালায়</a> সম্মত হবেন।
-tryitnow = এখনই ব্যবহার করুন
-signinfirefox = ফায়ারফক্স দিয়ে সাইন ইন করুন
-signupfirefox = ফায়ারফক্স দিয়ে সাইন আপ করুন
-viewlist = তালিকা দেখুন
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Pocket এ সংরক্ষণ করুন
-saveToPocketCmd.label = Pocket এ পাতাটি সংরক্ষণ করুন k
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = Pocket এ লিঙ্কটি সংরক্ষণ করুন o
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = Pocket তালিকা দেখুন
diff --git a/browser/extensions/pocket/locale/cs/pocket.properties b/browser/extensions/pocket/locale/cs/pocket.properties
deleted file mode 100644
index 619b0a01a0..0000000000
--- a/browser/extensions/pocket/locale/cs/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Přidat štítky
-alreadyhaveacct = Jste již uživatel služby Pocket?
-continueff = Pokračovat pomocí Firefoxu
-errorgeneric = Při pokusu o uložení do služby Pocket došlo k chybě.
-learnmore = Zjistit více
-loginnow = Přihlásit se
-maxtaglength = Štítky jsou omezeny na 25 znaků
-mustbeconnected = Abyste mohli ukládat do služby Pocket, musíte být připojeni k internetu. Zkontrolujte prosím své připojení a zkuste to znovu.
-onlylinkssaved = Pouze odkazy mohou být uloženy
-pagenotsaved = Stránka nebyla uložena
-pageremoved = Stránka byla odstraněna
-pagesaved = Uloženo do služby Pocket
-processingremove = Odstraňování stránky…
-processingtags = Přidávání štítků…
-removepage = Odstranit stránku
-save = Uložit
-saving = Ukládání…
-signupemail = Registrace e-mailem
-signuptosave = Registrujte se do služby Pocket. Je to zdarma.
-suggestedtags = Doporučené štítky
-tagline = Ukládejte si články a videa z Firefoxu pro zobrazení ve službě Pocket kdykoliv a na jakémkoli zařízení.
-taglinestory_one = Klepněte na tlačítko služby Pocket pro uložení jakéhokoliv článku, videa nebo stránky přímo z Firefoxu.
-taglinestory_two = Zobrazení ve službě Pocket kdykoliv a na jakémkoliv zařízení.
-tagssaved = Štítky přidány
-tos = Pokračování souhlasíte s <a href="%1$S" target="_blank">Podmínkami služby</a> Pocket a <a href="%2$S" target="_blank">Zásadami ochrany osobních údajů</a>
-tryitnow = Vyzkoušejte nyní
-signinfirefox = Přihlášení ve Firefoxu
-signupfirefox = Registrace ve Firefoxu
-viewlist = Zobrazit seznam
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Uloží do služby Pocket
-saveToPocketCmd.label = Uložit stránku do služby Pocket
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = Uložit odkaz do služby Pocket
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = Zobrazit seznam služby Pocket
diff --git a/browser/extensions/pocket/locale/da/pocket.properties b/browser/extensions/pocket/locale/da/pocket.properties
deleted file mode 100644
index 5e54383596..0000000000
--- a/browser/extensions/pocket/locale/da/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Tilføj tags
-alreadyhaveacct = Er du allerede Pocket-bruger?
-continueff = Fortsæt med Firefox
-errorgeneric = Der opstod en fejl ved forsøg på at gemme til Pocket.
-learnmore = Læs mere
-loginnow = Log ind
-maxtaglength = Tags er begrænset til 25 tegn
-mustbeconnected = Du skal have forbindelse til internettet for at kunne gemme til Pocket. Kontroller din internetforbindelse og prøv igen.
-onlylinkssaved = Kun links kan gemmes
-pagenotsaved = Siden blev ikke gemt
-pageremoved = Siden er fjernet
-pagesaved = Gemt til Pocket
-processingremove = Fjerner side…
-processingtags = Tilføjer tags…
-removepage = Fjern side
-save = Gem
-saving = Gemmer…
-signupemail = Log ind med mailadresse
-signuptosave = Meld dig til Pocket. Det er gratis.
-suggestedtags = Foreslåede tags
-tagline = Gemmer artikler og videoer fra Firefox i Pocket, så du senere kan se dem hvor og hvornår, du har lyst.
-taglinestory_one = Klik på knappen Pocket for at gemme en artikel, video eller webside fra Firefox.
-taglinestory_two = Se i Pocket hvor og hvornår, du har lyst.
-tagssaved = Tags tilføjet
-tos = Fortsætter du, accepterer du Pockets <a href="%1$S" target="_blank">tjenestevilkår</a> og <a href="%2$S" target="_blank">privatlivspolitik</a>
-tryitnow = Prøv det nu
-signinfirefox = Log ind med Firefox
-signupfirefox = Meld dig til med Firefox
-viewlist = Vis liste
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Gem til Pocket
-saveToPocketCmd.label = Gem siden til Pocket
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = Gem link til Pocket
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = Vis Pocket-liste
diff --git a/browser/extensions/pocket/locale/de/pocket.properties b/browser/extensions/pocket/locale/de/pocket.properties
deleted file mode 100644
index f02f5da050..0000000000
--- a/browser/extensions/pocket/locale/de/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Tags hinzufügen
-alreadyhaveacct = Sind Sie bereits Pocket-Nutzer?
-continueff = Mit Firefox fortfahren
-errorgeneric = Beim Speichern des Links bei Pocket ist ein Fehler aufgetreten.
-learnmore = Mehr erfahren
-loginnow = Anmelden
-maxtaglength = Tags dürfen höchsten 25 Zeichen lang sein.
-mustbeconnected = Bitte überprüfen Sie, ob Sie mit dem Internet verbunden sind.
-onlylinkssaved = Es können nur Links gespeichert werden
-pagenotsaved = Seite nicht gespeichert
-pageremoved = Seite entfernt
-pagesaved = Bei Pocket gespeichert
-processingremove = Seite wird entfernt…
-processingtags = Tags werden hinzugefügt…
-removepage = Seite entfernen
-save = Speichern
-saving = Speichern…
-signupemail = Mit E-Mail registrieren
-signuptosave = Registrieren Sie sich bei Pocket. Das ist kostenlos.
-suggestedtags = Vorgeschlagene Tags
-tagline = Speichern Sie Artikel und Videos aus Firefox bei Pocket, um sie jederzeit und auf jedem Gerät ansehen zu können.
-taglinestory_one = Klicken Sie auf die Pocket-Schaltfläche, um beliebige Artikel, Videos und Seiten aus Firefox zu speichern.
-taglinestory_two = Lesen Sie diese mit Pocket, jederzeit und auf jedem Gerät.
-tagssaved = Tags hinzugefügt
-tos = Indem Sie fortfahren, akzeptieren Sie die <a href="%1$S" target="_blank">Nutzungsbedingungen</a> und die <a href="%2$S" target="_blank">Datenschutzerklärung</a> von Pocket.
-tryitnow = Jetzt ausprobieren
-signinfirefox = Mit Firefox anmelden
-signupfirefox = Mit Firefox registrieren
-viewlist = Liste anzeigen
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Bei Pocket speichern
-saveToPocketCmd.label = Seite bei Pocket speichern
-saveToPocketCmd.accesskey = b
-saveLinkToPocketCmd.label = Link bei Pocket speichern
-saveLinkToPocketCmd.accesskey = c
-pocketMenuitem.label = Pocket-Liste anzeigen
diff --git a/browser/extensions/pocket/locale/dsb/pocket.properties b/browser/extensions/pocket/locale/dsb/pocket.properties
deleted file mode 100644
index a878de3296..0000000000
--- a/browser/extensions/pocket/locale/dsb/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Wobznamjenja pśidaś
-alreadyhaveacct = Sćo južo wužywaŕ Pocket?
-continueff = Z Firefox pókšacowaś
-errorgeneric = Pśi składowanju do Pocket jo zmólka nastała.
-learnmore = Dalšne informacije
-loginnow = Pśizjawiś
-maxtaglength = Wobznamjenja su na 25 znamuškow wobgranicowane
-mustbeconnected = Musyśo z internetom zwězany byś, aby do Pocket składował. Pšosym pśeglědajśo swój zwisk a wopytajśo hyšći raz.
-onlylinkssaved = Jano wótkaze daju se składowaś
-pagenotsaved = Bok njejo se składł
-pageremoved = Bok jo se wótwónoźeł
-pagesaved = Do Pocket skłaźony
-processingremove = Bok se wótwónoźujo…
-processingtags = Wobznamjenja se pśidawaju…
-removepage = Bok wótwónoźeś
-save = Składowaś
-saving = Składujo se…
-signupemail = Registrěrujśo se z mejlku
-signuptosave = Registrěrujśo se za Pocket. Jo dermo.
-suggestedtags = Naraźone wobznamjenja
-tagline = Składujśo nastawki a wideo z Firefox, aby se je kuždy cas w Pocket na kuždem rěźe woglědał.
-taglinestory_one = Klikniśo na tłocašk Pocket, aby nastawk, wideo abo bok z Firefox składował.
-taglinestory_two = Se w Pocket na kuždem rěźee kuždy cas woglědaś.
-tagssaved = Wobznamjenja su se pśidali
-tos = Gaž pókšacujośo, zwólijośo do <a href="%1$S" target="_blank">wužywarskich wuměnjenjow</a> a <a href="%2$S" target="_blank">pšawidłow priwatnosći</a> Pocket
-tryitnow = Wopytajśo to něnto
-signinfirefox = Z Firefox pśizjawiś
-signupfirefox = Z Firefox registrěrowaś
-viewlist = Lisćinu pokazaś
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Do Pocket składowaś
-saveToPocketCmd.label = Bok do Pocket składowaś
-saveToPocketCmd.accesskey = b
-saveLinkToPocketCmd.label = Wótkaz do Pocket składowaś
-saveLinkToPocketCmd.accesskey = w
-pocketMenuitem.label = Lisćinu Pocket pokazaś
diff --git a/browser/extensions/pocket/locale/en-GB/pocket.properties b/browser/extensions/pocket/locale/en-GB/pocket.properties
deleted file mode 100644
index bddd825c5e..0000000000
--- a/browser/extensions/pocket/locale/en-GB/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Add Tags
-alreadyhaveacct = Already a Pocket user?
-continueff = Continue with Firefox
-errorgeneric = There was an error when trying to save to Pocket.
-learnmore = Learn More
-loginnow = Log in
-maxtaglength = Tags are limited to 25 characters
-mustbeconnected = You must be connected to the Internet in order to save to Pocket. Please check your connection and try again.
-onlylinkssaved = Only links can be saved
-pagenotsaved = Page Not Saved
-pageremoved = Page Removed
-pagesaved = Saved to Pocket
-processingremove = Removing Page…
-processingtags = Adding tags…
-removepage = Remove Page
-save = Save
-saving = Saving…
-signupemail = Sign up with email
-signuptosave = Sign up for Pocket. It’s free.
-suggestedtags = Suggested Tags
-tagline = Save articles and videos from Firefox to view in Pocket on any device, any time.
-taglinestory_one = Click the Pocket Button to save any article, video or page from Firefox.
-taglinestory_two = View in Pocket on any device, any time.
-tagssaved = Tags Added
-tos = By continuing, you agree to Pocket’s <a href="%1$S" target="_blank">Terms of Service</a> and <a href="%2$S" target="_blank">Privacy Policy</a>
-tryitnow = Try It Now
-signinfirefox = Sign in with Firefox
-signupfirefox = Sign up with Firefox
-viewlist = View List
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Save to Pocket
-saveToPocketCmd.label = Save Page to Pocket
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = Save Link to Pocket
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = View Pocket List
diff --git a/browser/extensions/pocket/locale/en-US/pocket.properties b/browser/extensions/pocket/locale/en-US/pocket.properties
deleted file mode 100644
index dee2681dc6..0000000000
--- a/browser/extensions/pocket/locale/en-US/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Add Tags
-alreadyhaveacct = Already a Pocket user?
-continueff = Continue with Firefox
-errorgeneric = There was an error when trying to save to Pocket.
-learnmore = Learn More
-loginnow = Log in
-maxtaglength = Tags are limited to 25 characters
-mustbeconnected = You must be connected to the Internet in order to save to Pocket. Please check your connection and try again.
-onlylinkssaved = Only links can be saved
-pagenotsaved = Page Not Saved
-pageremoved = Page Removed
-pagesaved = Saved to Pocket
-processingremove = Removing Page…
-processingtags = Adding tags…
-removepage = Remove Page
-save = Save
-saving = Saving…
-signupemail = Sign up with email
-signuptosave = Sign up for Pocket. It’s free.
-suggestedtags = Suggested Tags
-tagline = Save articles and videos from Firefox to view in Pocket on any device, any time.
-taglinestory_one = Click the Pocket Button to save any article, video or page from Firefox.
-taglinestory_two = View in Pocket on any device, any time.
-tagssaved = Tags Added
-tos = By continuing, you agree to Pocket's <a href="%1$S" target="_blank">Terms of Service</a> and <a href="%2$S" target="_blank">Privacy Policy</a>
-tryitnow = Try It Now
-signinfirefox = Sign in with Firefox
-signupfirefox = Sign up with Firefox
-viewlist = View List
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Save to Pocket
-saveToPocketCmd.label = Save Page to Pocket
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = Save Link to Pocket
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = View Pocket List
diff --git a/browser/extensions/pocket/locale/es-AR/pocket.properties b/browser/extensions/pocket/locale/es-AR/pocket.properties
deleted file mode 100644
index 2782d3ccf2..0000000000
--- a/browser/extensions/pocket/locale/es-AR/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Agregar etiquetas
-alreadyhaveacct = ¿Ya es un usuario de Pocket?
-continueff = Continuar con Firefox
-errorgeneric = Hubo un error al tratar de guardar en Pocket.
-learnmore = Conocer más
-loginnow = Ingresar
-maxtaglength = Las etiquetas están limitadas a 25 caracteres
-mustbeconnected = Debe estar conectado a Internet para poder guardar en Pocket. Verifique la conexión e intente nuevamente.
-onlylinkssaved = Solamente pueden guardarle enlaces
-pagenotsaved = Página no guardada
-pageremoved = Página eliminada
-pagesaved = Guardado en Pocket
-processingremove = Eliminando página…
-processingtags = Agregando etiquetas…
-removepage = Eliminar página
-save = Guardar
-saving = Guardando…
-signupemail = Ingresar con correo electrónico
-signuptosave = Registrarse en Pocket. En grátis.
-suggestedtags = Etiquetas sugeridas
-tagline = Guardar artículos y videos desde Firefox para ver en Pocket en cualquier dispositivo en cualquier momento.
-taglinestory_one = Clic en el botón Pocket para guardar cualquier artículo, video o página desde Firefox.
-taglinestory_two = Ver en Pocket en cualquier dispositivo en cualquier momento.
-tagssaved = Etiquetas agregadas
-tos = Al continuar acepta los <a href="%1$S" target="_blank">términos de servicio</a> y la <a href="%2$S" target="_blank">política de privacidad</a> de Pocket
-tryitnow = Probalo ahora
-signinfirefox = Ingresar con Firefox
-signupfirefox = Registrarse con Firefox
-viewlist = Ver lista
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Guardar en Pocket
-saveToPocketCmd.label = Guardar página en Pocket
-saveToPocketCmd.accesskey = G
-saveLinkToPocketCmd.label = Guardar enlace en Pocket
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = Ver lista de Pocket
diff --git a/browser/extensions/pocket/locale/es-CL/pocket.properties b/browser/extensions/pocket/locale/es-CL/pocket.properties
deleted file mode 100644
index 7a4e6872b3..0000000000
--- a/browser/extensions/pocket/locale/es-CL/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Añadir etiquetas
-alreadyhaveacct = ¿Ya eres usuario de Pocket?
-continueff = Continuar con Firefox
-errorgeneric = Hubo un error al intentar guardarla en Pocket.
-learnmore = Aprender más
-loginnow = Conectarse
-maxtaglength = Las etiquetas están limitadas a 25 caracteres
-mustbeconnected = Debes estar conectado a Internet para guardar en Pocket. Por favor, revisa tu conexión y vuelve a intentarlo.
-onlylinkssaved = Solo se pueden guardar enlaces
-pagenotsaved = Página no guardada
-pageremoved = Página eliminada
-pagesaved = Guardada en Pocket
-processingremove = Eliminando página…
-processingtags = Añadiendo etiquetas…
-removepage = Eliminar página
-save = Guardar
-saving = Guardando…
-signupemail = Registrarse usando un email
-signuptosave = Registrarse en Pocket. Es gratis.
-suggestedtags = Etiquetas sugeridas
-tagline = Guarda artículos y videos desde Firefox para verlos en Pocket en cualquier dispositivo y momento.
-taglinestory_one = Aprieta el botón Pocket para guardar cualquier artículo, video o página de Firefox.
-taglinestory_two = Mírala en Pocket en cualquier dispositivo y momento
-tagssaved = Etiquetas añadidas
-tos = Al continuar, aceptas los <a href="%1$S" target="_blank">Términos del servicio</a> y la <a href="%2$S" target="_blank">Política de privacidad</a> de Pocket.
-tryitnow = Probarlo ahora
-signinfirefox = Conectarse con Firefox
-signupfirefox = Registrarse con Firefox
-viewlist = Ver lista
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Guardar en Pocket
-saveToPocketCmd.label = Guardar página en Pocket
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = Guardar enlace en Pocket
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = Ver lista de Pocket
diff --git a/browser/extensions/pocket/locale/es-ES/pocket.properties b/browser/extensions/pocket/locale/es-ES/pocket.properties
deleted file mode 100644
index f10a205259..0000000000
--- a/browser/extensions/pocket/locale/es-ES/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Añadir etiquetas
-alreadyhaveacct = ¿Ya es usuario de Pocket?
-continueff = Continuar con Firefox
-errorgeneric = Ha sucedido un error al intentar guardar en Pocket.
-learnmore = Más información
-loginnow = Iniciar sesión
-maxtaglength = Las etiquetas están limitadas a 25 caracteres
-mustbeconnected = Debe estar conectado a Internet para poder guardar en Pocket. Compruebe su conexión y vuelva a intentarlo.
-onlylinkssaved = Solo se pueden guardar enlaces
-pagenotsaved = Página no guardada
-pageremoved = Página eliminada
-pagesaved = Guardado en Pocket
-processingremove = Eliminando página…
-processingtags = Añadiendo etiquetas…
-removepage = Eliminar página
-save = Guardar
-saving = Guardando…
-signupemail = Regístrese con su dirección de correo
-signuptosave = Regístrese en Pocket. Es gratis.
-suggestedtags = Etiquetas sugeridas
-tagline = Guarde artículos y vídeos desde Firefox para verlos en Pocket en cualquier dispositivo, en cualquier momento.
-taglinestory_one = Pulse el botón Pocket para guardar cualquier artículo, vídeo o página desde Firefox.
-taglinestory_two = Véalo en Pocket en cualquier dispositivo, en cualquier momento.
-tagssaved = Etiquetas añadidas
-tos = Al continuar, aceptas los <a href="%1$S" target="_blank">Términos del servicio</a> y la <a href="%2$S" target="_blank">Política de privacidad</a> de Pocket
-tryitnow = Pruébalo ahora
-signinfirefox = Iniciar sesión con Firefox
-signupfirefox = Registrarse con Firefox
-viewlist = Ver lista
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Guardar en Pocket
-saveToPocketCmd.label = Guardar página en Pocket
-saveToPocketCmd.accesskey = G
-saveLinkToPocketCmd.label = Guardar enlace en Pocket
-saveLinkToPocketCmd.accesskey = P
-pocketMenuitem.label = Ver la lista de Pocket
diff --git a/browser/extensions/pocket/locale/es-MX/pocket.properties b/browser/extensions/pocket/locale/es-MX/pocket.properties
deleted file mode 100644
index 4d2bb9c4f7..0000000000
--- a/browser/extensions/pocket/locale/es-MX/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Agregar Etiquetas
-alreadyhaveacct = ¿Ya eres usuario de Pocket?
-continueff = Continúa con Firefox
-errorgeneric = Hubo un error cuando se intentaba guardar en Pocket.
-learnmore = Aprende más
-loginnow = Ingresar
-maxtaglength = Las etiquetas están limitadas a 25 caracteres
-mustbeconnected = Debes estar conectado a Internet para guardar en Pocket. Por favor, revisa tu conexión e intenta de nuevo.
-onlylinkssaved = Sólo los enlaces pueden guardarse
-pagenotsaved = Página no guardada
-pageremoved = Página eliminada
-pagesaved = Guardado en Pocket
-processingremove = Eliminando página…
-processingtags = Agregando etiquetas…
-removepage = Eliminar página
-save = Guardar
-saving = Guardando…
-signupemail = Regístrate con un correo electrónico
-signuptosave = Regístrate en Pocket. Es gratis.
-suggestedtags = Etiquetas sugeridas
-tagline = Guardar artículos y videos desde Firefox para ver en Pocket o en cualquier dispositivo, en cualquier momento.
-taglinestory_one = Haz clic en el botón de Pocket para guardar cualquier artículo, video o página desde Firefox.
-taglinestory_two = Ver en Pocker o en cualquier dispositivo, en cualquier momento.
-tagssaved = Etiquetas agregadas
-tos = Al continuar, aceptas los <a href="%1$S" target="_blank">Términos del servicio</a> y la <a href="%2$S" target="_blank">Política de privacidad</a> de Pocket
-tryitnow = Pruébalo ahora
-signinfirefox = Ingresa con Firefox
-signupfirefox = Regístrate con Firefox
-viewlist = Ver lista
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Guardar en Pocket
-saveToPocketCmd.label = Guardar página en Pocket
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = Guardar enlace en Pocket
-saveLinkToPocketCmd.accesskey = n
-pocketMenuitem.label = Ver la lista de Pocket
diff --git a/browser/extensions/pocket/locale/et/pocket.properties b/browser/extensions/pocket/locale/et/pocket.properties
deleted file mode 100644
index 5f2d68f9c5..0000000000
--- a/browser/extensions/pocket/locale/et/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Lisa silte
-alreadyhaveacct = Kas oled juba Pocketi kasutaja?
-continueff = Jätka Firefoxiga
-errorgeneric = Pocketisse salvestamisel esines viga.
-learnmore = Rohkem teavet
-loginnow = Logi sisse
-maxtaglength = Siltide pikkus võib olla kuni 25 tähemärki
-mustbeconnected = Pocketisse salvestamiseks on vajalik töötav internetiühendus. Palun kontrolli oma ühendust ja proovi uuesti.
-onlylinkssaved = Salvestada saab ainult linke
-pagenotsaved = Lehte ei salvestatud
-pageremoved = Leht eemaldati
-pagesaved = Pocketisse salvestatud
-processingremove = Lehe eemaldamine…
-processingtags = Siltide lisamine…
-removepage = Eemalda leht
-save = Salvesta
-saving = Salvestamine…
-signupemail = Registreeru e-posti teel
-signuptosave = Liitu Pocketiga. See on tasuta.
-suggestedtags = Soovitatud sildid
-tagline = Salvesta Firefoxist artikleid ja videoid, et vaadata neid Pocketist kõigil seadmeil just siis, kui ise soovid.
-taglinestory_one = Artikli, video või lehe salvestamiseks klõpsa Pocketi nupul.
-taglinestory_two = Vaata Pocketist kõigil seadmeil just siis, kui ise soovid.
-tagssaved = Sildid on lisatud
-tos = Jätkates nõustud Pocket'i <a href="%1$S" target="_blank">kasutustingimuste</a> ja <a href="%2$S" target="_blank">privaatsuspoliitikaga</a>.
-tryitnow = Proovi kohe
-signinfirefox = Logi sisse Firefoxiga
-signupfirefox = Registreeru Firefoxiga
-viewlist = Vaata nimekirja
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Salvesta Pocketisse
-saveToPocketCmd.label = Salvesta leht Pocketisse
-saveToPocketCmd.accesskey = l
-saveLinkToPocketCmd.label = Salvesta link Pocketisse
-saveLinkToPocketCmd.accesskey = i
-pocketMenuitem.label = Vaata Pocketi nimekirja
diff --git a/browser/extensions/pocket/locale/fi/pocket.properties b/browser/extensions/pocket/locale/fi/pocket.properties
deleted file mode 100644
index 3cd47e891a..0000000000
--- a/browser/extensions/pocket/locale/fi/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Lisää tunnisteita
-alreadyhaveacct = Oletko jo Pocket-palvelun käyttäjä?
-continueff = Jatka Firefoxin parissa
-errorgeneric = Tapahtui virhe tallennettaessa Pocket-palveluun.
-learnmore = Lue lisää
-loginnow = Kirjaudu sisään
-maxtaglength = Tunnisteet voivat olla enintään 25 merkkiä pitkiä
-mustbeconnected = Tarvitset aktiivisen Internet-yhteyden talllentaaksesi sivuja Pocket-palveluun. Tarkista Internet-yhteytesi ja yritä uudestaan.
-onlylinkssaved = Vain linkkejä voidaan tallentaa
-pagenotsaved = Sivua ei ole tallennettu
-pageremoved = Sivu poistettiin
-pagesaved = Tallennettiin Pocket-palveluun
-processingremove = Poistetaan sivu…
-processingtags = Lisätään tunnisteet…
-removepage = Poista sivu
-save = Tallenna
-saving = Tallennetaan…
-signupemail = Rekisteröidy sähköpostiosoitteella
-signuptosave = Rekisteröidy Pocket-palveluun. Se on ilmaista.
-suggestedtags = Ehdotetut tunnisteet
-tagline = Tallenna artikkelit ja videot Firefoxista Pocket-palveluun katseltaviksi millä tahansa laitteella, koska tahansa.
-taglinestory_one = Napsauta Pocket-painiketta tallentaaksesi artikkelin, videon tai sivun Firefoxissa.
-taglinestory_two = Katsele Pocket-palvelussa millä tahansa laitteella, koska tahansa.
-tagssaved = Tunnisteet lisättiin
-tos = Jatkamalla hyväksyt Pocketin <a href="%1$S" target="_blank">käyttöehdot</a> ja <a href="%2$S" target="_blank">tietosuojakäytännön</a>
-tryitnow = Kokeile nyt
-signinfirefox = Kirjaudu sisään Firefox-tilillä
-signupfirefox = Rekisteröidy Firefox-tilillä
-viewlist = Näytä lista
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Tallenna Pocket-palveluun
-saveToPocketCmd.label = Tallenna sivu Pocket-palveluun
-saveToPocketCmd.accesskey = c
-saveLinkToPocketCmd.label = Tallenna linkki Pocket-palveluun
-saveLinkToPocketCmd.accesskey = k
-pocketMenuitem.label = Näytä Pocket-palvelun lista
diff --git a/browser/extensions/pocket/locale/fr/pocket.properties b/browser/extensions/pocket/locale/fr/pocket.properties
deleted file mode 100644
index cb9b0ca8f0..0000000000
--- a/browser/extensions/pocket/locale/fr/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Ajouter des étiquettes
-alreadyhaveacct = Vous utilisez déjà Pocket ?
-continueff = Continuer avec Firefox
-errorgeneric = Une erreur s’est produite lors de l’enregistrement dans Pocket.
-learnmore = En savoir plus
-loginnow = Connectez-vous
-maxtaglength = Les étiquettes sont limitées à 25 caractères
-mustbeconnected = Vous devez être connecté à Internet pour enregistrer des liens dans Pocket. Veuillez vérifier votre connexion puis réessayer.
-onlylinkssaved = Seuls les liens peuvent être enregistrés
-pagenotsaved = Page non enregistrée
-pageremoved = Page supprimée
-pagesaved = Page enregistrée dans Pocket
-processingremove = Suppression de la page…
-processingtags = Ajout des étiquettes…
-removepage = Supprimer la page
-save = Enregistrer
-saving = Enregistrement…
-signupemail = S’inscrire avec une adresse électronique
-signuptosave = Inscrivez-vous à Pocket, c’est gratuit.
-suggestedtags = Étiquettes suggérées
-tagline = Enregistrez des articles et des vidéos depuis Firefox pour les visualiser dans Pocket sur n’importe quel appareil, à tout moment.
-taglinestory_one = Cliquez sur le bouton Pocket pour enregistrer depuis Firefox n’importe quel article, vidéo ou page.
-taglinestory_two = Affichez vos pages dans Pocket sur n’importe quel appareil, à tout moment.
-tagssaved = Étiquettes ajoutées
-tos = En continuant, vous acceptez les <a href="%1$S" target="_blank">conditions d’utilisation</a> et la <a href="%2$S" target="_blank">politique de confidentialité</a> de Pocket
-tryitnow = Essayer
-signinfirefox = Connexion via Firefox
-signupfirefox = S’inscrire avec Firefox
-viewlist = Afficher la liste
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Enregistrer dans Pocket
-saveToPocketCmd.label = Enregistrer la page dans Pocket
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = Enregistrer le lien dans Pocket
-saveLinkToPocketCmd.accesskey = k
-pocketMenuitem.label = Afficher la liste Pocket
diff --git a/browser/extensions/pocket/locale/fy-NL/pocket.properties b/browser/extensions/pocket/locale/fy-NL/pocket.properties
deleted file mode 100644
index 5b41c652f7..0000000000
--- a/browser/extensions/pocket/locale/fy-NL/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Labels tafoegje
-alreadyhaveacct = Al in Pocket-brûker?
-continueff = Trochgean mei Firefox
-errorgeneric = Der is in flater bard by it bewarjen nei Pocket.
-learnmore = Mear ynfo
-loginnow = Meld jo oan
-maxtaglength = Labels binne beheint ta 25 tekens
-mustbeconnected = Jo moatte mei it ynternet ferbûn wêze om nei Pocket bewarje te kinnen. Kontrolearje jo ferbining en probearje it opnij.
-onlylinkssaved = Allinnich keppelingen kinne bewarre wurde
-pagenotsaved = Side net bewarre
-pageremoved = Side fuortsmiten
-pagesaved = Bewarre nei Pocket
-processingremove = Side fuortsmite…
-processingtags = Labels tafoegje…
-removepage = Side fuortsmite
-save = Bewarje
-saving = Bewarje…
-signupemail = Registrearje mei e-mailadres
-signuptosave = Registrearje foar Pocket. It is fergees.
-suggestedtags = Foarstelde labels
-tagline = Bewarje artikelen en fideo’s fan Firefox út foar werjaan yn Pocket op ferskate apparaten, wannear dan ek.
-taglinestory_one = Klik op de Pocket-knop om artikelen, fideo’s of siden fan Firefox út te bewarjen.
-taglinestory_two = Besjoch se op ferskate apparaten, wannear dan ek.
-tagssaved = Labels tafoege
-tos = Troch fierder te gean, geane jo akkoard mei de <a href="%1$S" target="_blank">Tsjinstbetingsten</a> en it <a href="%2$S" target="_blank">Privacybelied</a> fan Pocket
-tryitnow = No probearje
-signinfirefox = Oanmelde mei Firefox
-signupfirefox = Registrearje mei Firefox
-viewlist = List werjaan
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Bewarje nei Pocket
-saveToPocketCmd.label = Side bewarje nei Pocket
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = Keppeling bewarje nei Pocket
-saveLinkToPocketCmd.accesskey = e
-pocketMenuitem.label = Pocket-list werjaan
diff --git a/browser/extensions/pocket/locale/gu-IN/pocket.properties b/browser/extensions/pocket/locale/gu-IN/pocket.properties
deleted file mode 100644
index 2261ff5b4d..0000000000
--- a/browser/extensions/pocket/locale/gu-IN/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = ટૅગ્સ ઉમેરો
-alreadyhaveacct = પહેલેથી જ એક પોકેટ વપરાશકર્તા છો?
-continueff = ફાયરફોક્સ સાથે ચાલુ રાખો
-errorgeneric = પોકેટ સાચવી રાખવા માટે પ્રયાસ હતો ત્યારે એક ભૂલ હતી.
-learnmore = વધુ શીખો
-loginnow = પ્રવેશ કરો
-maxtaglength = ટૅગ્સ 25 અક્ષરો સુધી મર્યાદિત છે
-mustbeconnected = તમે પોકેટ પર સેવ કરવા માટે ઇન્ટરનેટ સાથે જોડાયેલ હોવા જ જોઈએ. કૃપા કરીને તમારા જોડાણ તપાસ કરો અને ફરીથી પ્રયત્ન કરો.
-onlylinkssaved = માત્ર લિંક્સ સાચવી શકાય છે
-pagenotsaved = પૃષ્ઠ સાચવેલા નથી
-pageremoved = પૃષ્ઠ દૂર
-pagesaved = પોકેટ પર સાચવ્યું
-processingremove = પૃષ્ઠ દૂર કરી રહ્યા છીએ…
-processingtags = ટૅગ્સ ઉમેરી રહ્યું છે…
-removepage = પૃષ્ઠ દૂર
-save = સાચવો
-saving = સાચવી રહ્યું છે…
-signupemail = ઇમેઇલ સાથે સાઇનઅપ
-signuptosave = પોકેટ માટે સાઇન અપ કરો. તે મફત છે.
-suggestedtags = સૂચવેલ ટૅગ્સ
-tagline = કોઈપણ ઉપકરણ, કોઈ પણ સમય પર પોકેટ માં જોવા માટે ફાયરફોક્સ ના લેખો અને વીડિયો સાચવો.
-taglinestory_one = ફાયરફોક્સ એક લેખ, વિડિઓ અથવા પાનું સેવ કરવા પોકેટ બટન પર ક્લિક કરો.
-taglinestory_two = કોઈપણ ઉપકરણ, કોઈ પણ સમય પર પોકેટ માં જુઓ.
-tagssaved = ટૅગ્સ ઉમેર્યું
-tos = ચાલુ કરવાથી, તમે પોકેટ માટેની <a href="%1$S" target="_blank">સેવાની શરતો</a> અને <a href="%2$S" target="_blank">ગોપનીયતા નીતિ</a>સંમત થશો
-tryitnow = અત્યારે પ્રયાસ કરો
-signinfirefox = ફાયરફોક્સ સાથે ચાલુ રાખો
-signupfirefox = ફાયરફોક્સ સાથે સાઇન અપ કરો
-viewlist = યાદી જુઓ
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = પોકેટ
-pocket-button.tooltiptext = પોકેટ પર સાચવો
-saveToPocketCmd.label = પોકેટ પર પૃષ્ઠ સાચવો
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = પોકેટ પર લિંક સાચવો
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = જુઓ પોકેટની યાદી
diff --git a/browser/extensions/pocket/locale/hr/pocket.properties b/browser/extensions/pocket/locale/hr/pocket.properties
deleted file mode 100644
index 3b723499fe..0000000000
--- a/browser/extensions/pocket/locale/hr/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Dodaj oznake
-alreadyhaveacct = Postojeći ste Pocket korisnik?
-continueff = Nastavite s Firefoxom
-errorgeneric = Došlo je do greške pri snimanju u Pocket.
-learnmore = Saznajte više
-loginnow = Prijava
-maxtaglength = Oznake su ograničene na 25 znakova
-mustbeconnected = Morate biti povezani na Internet da bi ste mogli snimiti u Pocket. Molimo vas da provjerite vašu vezu i pokušate ponovno.
-onlylinkssaved = Mogu se spremiti samo poveznice
-pagenotsaved = Stranica nije spremljena
-pageremoved = Stranica uklonjena
-pagesaved = Spremljeno u Pocket
-processingremove = Uklanjanje stranice…
-processingtags = Dodavanje oznaka…
-removepage = Ukloni stranicu
-save = Spremi
-saving = Spremanje…
-signupemail = Registracija s e-poštom
-signuptosave = Registrirajte se na Pocket. Besplatno je.
-suggestedtags = Predložene oznake
-tagline = Spremite članke, video snimke iz Firefoxa za prikaz u Pocketu, na bilo kojem uređaju, bilo kada.
-taglinestory_one = Kliknite na Pocket tipku da biste snimili bilo koji članak, video ili stranicu iz Firefoxa.
-taglinestory_two = Pregledajte u Pocketu na bilo kojem uređaju, bilo kada.
-tagssaved = Oznake dodane
-tos = Nastavljajući, prihvaćate Pocket <a href="%1$S" target="_blank">Uvjete pružanja usluge</a> i <a href="%2$S" target="_blank">Izjavu o privatnosti</a>
-tryitnow = Isprobajte odmah
-signinfirefox = Prijava s Firefoxom
-signupfirefox = Registracija s Firefoxom
-viewlist = Prikaži popis
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Spremi u Pocket
-saveToPocketCmd.label = Spremi stranicu u Pocket
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = Spremi poveznicu u Pocket
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = Prikaži Pocket popis
diff --git a/browser/extensions/pocket/locale/hsb/pocket.properties b/browser/extensions/pocket/locale/hsb/pocket.properties
deleted file mode 100644
index a5f5583e79..0000000000
--- a/browser/extensions/pocket/locale/hsb/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Znački přidać
-alreadyhaveacct = Sće hižo wužiwar Pocket?
-continueff = Z Firefox pokročować
-errorgeneric = Při składowanju do Pocket je zmylk wustupił.
-learnmore = Dalše informacije
-loginnow = Přizjewić
-maxtaglength = Znački su na 25 znamješkow wobmjezowane
-mustbeconnected = Dyrbiće z internetom zwjazany być, zo byšće do Pocket składował. Prošu přepruwujće swój zwisk a spytajće hišće raz.
-onlylinkssaved = Jenož wotkazy dadźa so składować
-pagenotsaved = Strona njeje so składowała
-pageremoved = Strona je so wotstroniła
-pagesaved = Do Pocket składowany
-processingremove = Strona so wotstronja…
-processingtags = Znački so přidawaja…
-removepage = Stronu wotstronić
-save = Składować
-saving = Składuje so…
-signupemail = Registrujće so z e-mejlku
-signuptosave = Registrujće so za Pocket. Je darmo.
-suggestedtags = Namjetowane znački
-tagline = Składujće nastawki a wideja z Firefox, zo byšće sej je kóždy čas w Pocket na kóždym graće wobhladał.
-taglinestory_one = Klikńće na tłóčatko Pocket, zo byšće nastawk, widejo abo stronu z Firefox składował.
-taglinestory_two = Sej w Pocket na kóždym graće kóždy čas wobhladać.
-tagssaved = Znački su so přidali
-tos = Hdyž pokročujeće, zwoliće do <a href="%1$S" target="_blank">wužiwarskich wuměnjenjow</a> a <a href="%2$S" target="_blank">prawidłow priwatnosće</a> Pocket
-tryitnow = Spytajće to nětko
-signinfirefox = Z Firefox přizjewić
-signupfirefox = Z Firefox registrować
-viewlist = Lisćinu pokazać
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Do Pocket składować
-saveToPocketCmd.label = Stronu do Pocket składować
-saveToPocketCmd.accesskey = d
-saveLinkToPocketCmd.label = Wotkaz do Pocket składować
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = Lisćinu Pocket pokazać
diff --git a/browser/extensions/pocket/locale/hu/pocket.properties b/browser/extensions/pocket/locale/hu/pocket.properties
deleted file mode 100644
index 767638e82f..0000000000
--- a/browser/extensions/pocket/locale/hu/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Címkék hozzáadása
-alreadyhaveacct = Már Pocket felhasználó?
-continueff = Folytatás a Firefoxszal
-errorgeneric = Hiba történt a Pocketre mentés közben.
-learnmore = Tudjon meg többet
-loginnow = Bejelentkezés
-maxtaglength = A címkék legfeljebb 25 karakter hosszúak lehetnek
-mustbeconnected = Csatlakoznia kell az internethez a Pocketre mentéshez. Ellenőrizze a kapcsolatot, és próbálja újra.
-onlylinkssaved = Csak hivatkozások menthetők
-pagenotsaved = Az oldal nem lett mentve
-pageremoved = Oldal eltávolítva
-pagesaved = Mentve a Pocketbe
-processingremove = Oldal eltávolítása…
-processingtags = Címkék hozzáadása…
-removepage = Oldal eltávolítása
-save = Mentés
-saving = Mentés…
-signupemail = Regisztráció e-maillel
-signuptosave = Regisztráljon ingyenesen a Pocketre.
-suggestedtags = Javasolt címkék
-tagline = Mentsen cikkeket és videókat a Firefoxból a Pocketen való megtekintéshez bármely eszközön, bármikor.
-taglinestory_one = Kattintson a Pocket gombra bármely cikk, videó vagy oldal mentéséhez a Firefoxból.
-taglinestory_two = Nézze meg a Pocketen bármely eszközön, bármikor.
-tagssaved = Címkék hozzáadva
-tos = A folytatással elfogadja a Pocket <a href="%1$S" target="_blank">Szolgáltatási feltételeit</a> és az <a href="%2$S" target="_blank">Adatvédelmi nyilatkozatot</a>
-tryitnow = Próbálja ki most
-signinfirefox = Bejelentkezés a Firefoxszal
-signupfirefox = Regisztráció a Firefoxszal
-viewlist = Lista megjelenítése
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Mentés a Pocketbe
-saveToPocketCmd.label = Oldal mentése a Pocketbe
-saveToPocketCmd.accesskey = c
-saveLinkToPocketCmd.label = Hivatkozás mentése a Pocketbe
-saveLinkToPocketCmd.accesskey = H
-pocketMenuitem.label = Pocket lista megjelenítése
diff --git a/browser/extensions/pocket/locale/it/pocket.properties b/browser/extensions/pocket/locale/it/pocket.properties
deleted file mode 100644
index 2105011eb3..0000000000
--- a/browser/extensions/pocket/locale/it/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Aggiungi etichette
-alreadyhaveacct = Hai già un account registrato su Pocket?
-continueff = Prosegui con Firefox
-errorgeneric = Si è verificato un errore durante il salvataggio in Pocket.
-learnmore = Ulteriori informazioni
-loginnow = Accedi
-maxtaglength = La lunghezza massima per le etichette è di 25 caratteri
-mustbeconnected = È necessario essere connessi a Internet per salvare in Pocket. Verificare la connessione e riprovare.
-onlylinkssaved = È possibile salvare solo link
-pagenotsaved = Pagina non salvata
-pageremoved = Pagina rimossa
-pagesaved = Salvata in Pocket
-processingremove = Rimozione pagina…
-processingtags = Salvataggio etichette…
-removepage = Rimuovi pagina
-save = Salva
-saving = Salvataggio…
-signupemail = Accedi con email
-signuptosave = Registrati su Pocket. È gratis.
-suggestedtags = Etichette suggerite
-tagline = Salva articoli e video da Firefox per visualizzarli in Pocket da qualunque dispositivo e in qualunque momento.
-taglinestory_one = Fai clic sul pulsante Pocket per salvare qualunque articolo, video o pagina da Firefox.
-taglinestory_two = Visualizza in Pocket da qualunque dispositivo e in qualunque momento.
-tagssaved = Aggiunte etichette
-tos = Proseguendo si accettano i <a href="%1$S" target="_blank">termini di servizio</a> e l’<a href="%2$S" target="_blank">informativa sulla privacy</a>
-tryitnow = Provalo subito
-signinfirefox = Accedi con Firefox
-signupfirefox = Registrati con Firefox
-viewlist = Visualizza elenco
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Salva in Pocket
-saveToPocketCmd.label = Salva pagina in Pocket
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = Salva link in Pocket
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = Visualizza elenco Pocket
diff --git a/browser/extensions/pocket/locale/ja/pocket.properties b/browser/extensions/pocket/locale/ja/pocket.properties
deleted file mode 100644
index 1aef6bba16..0000000000
--- a/browser/extensions/pocket/locale/ja/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = タグを追加
-alreadyhaveacct = Pocket に登録済みですか?
-continueff = Firefox で続行
-errorgeneric = Pocket への保存中にエラーがありました。
-learnmore = 詳細
-loginnow = ログイン
-maxtaglength = タグは 25 文字までです
-mustbeconnected = Pocket に保存するには、インターネット接続が必要です。接続状況を確認してから、試してみたください。
-onlylinkssaved = リンクのみ保存しました
-pagenotsaved = ページを保存しませんでした
-pageremoved = ページを削除しました
-pagesaved = Pocket に保存しました
-processingremove = ページを削除しています...
-processingtags = タグを追加しています...
-removepage = ページを削除
-save = 保存
-saving = 保存しています...
-signupemail = メールアドレスで新規登録
-signuptosave = Pocket に新規登録します。無料です。
-suggestedtags = 提案タグ
-tagline = Firefox で記事や動画を保存すると、いつでもどこでも Pocket で閲覧できます。
-taglinestory_one = Firefox で Pocket ボタンをクリックすると、様々な記事や動画やページを保存できます。
-taglinestory_two = Pocket でいつでもどこでも閲覧できます。
-tagssaved = タグを追加しました
-tos = 続けることで、Pocket の <a href="%1$S" target="_blank">利用規約</a> と <a href="%2$S" target="_blank">プライバシーポリシー</a> に同意したことになります
-tryitnow = 今すぐ試す
-signinfirefox = Firefox でログイン
-signupfirefox = Firefox で新規登録
-viewlist = リストを表示
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Pocket に保存
-saveToPocketCmd.label = ページを Pocket に保存
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = リンクを Pocket に保存
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = Pocket のリストを表示
diff --git a/browser/extensions/pocket/locale/jar.mn b/browser/extensions/pocket/locale/jar.mn
deleted file mode 100644
index f29ca73674..0000000000
--- a/browser/extensions/pocket/locale/jar.mn
+++ /dev/null
@@ -1,33 +0,0 @@
-#filter substitution
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-# These are used for the big if statement, as the preprocessor can't handle
-# dashes.
-#define bn_BD bn-BD
-#define en_GB en-GB
-#define en_US en-US
-#define es_AR es-AR
-#define es_CL es-CL
-#define es_ES es-ES
-#define es_MX es-MX
-#define fy_NL fy-NL
-#define gu_IN gu-IN
-#define nn_NO nn-NO
-#define pt_BR pt-BR
-#define pt_PT pt-PT
-#define sv_SE sv-SE
-#define zh_CN zh-CN
-#define zh_TW zh-TW
-
-[features/firefox@getpocket.com] @AB_CD@.jar:
-% locale pocket @AB_CD@ %locale/@AB_CD@/
- # For locales we support, include the file from the locale's directory in the
- # source tree.
- # For other locales (and en-US) fallback to the en-US directory.
-#if AB_CD == ast || AB_CD == az || AB_CD == bg || AB_CD == bn_BD || AB_CD == cs || AB_CD == da || AB_CD == de || AB_CD == dsb || AB_CD == en_GB || AB_CD == en_US || AB_CD == es_AR || AB_CD == es_CL || AB_CD == es_ES || AB_CD == es_MX || AB_CD == et || AB_CD == fi || AB_CD == fr || AB_CD == fy_NL || AB_CD == gu_IN || AB_CD == hr || AB_CD == hsb || AB_CD == hu || AB_CD == it || AB_CD == ja || AB_CD == ka || AB_CD == kab || AB_CD == lt || AB_CD == lv || AB_CD == mr || AB_CD == ms || AB_CD == nl || AB_CD == nn_NO || AB_CD == or || AB_CD == pl || AB_CD == pt_BR || AB_CD == pt_PT || AB_CD == rm || AB_CD == ro || AB_CD == ru || AB_CD == sk || AB_CD == sl || AB_CD == sq || AB_CD == sr || AB_CD == sv_SE || AB_CD == te || AB_CD == th || AB_CD == tr || AB_CD == uk || AB_CD == zh_CN || AB_CD == zh_TW
- locale/@AB_CD@/ (@AB_CD@/*)
-#else
- locale/@AB_CD@/ (en-US/*)
-#endif
diff --git a/browser/extensions/pocket/locale/ka/pocket.properties b/browser/extensions/pocket/locale/ka/pocket.properties
deleted file mode 100644
index 266ded0449..0000000000
--- a/browser/extensions/pocket/locale/ka/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = იარლიყების დამატება
-alreadyhaveacct = უკვე იყენებთ Pocket-ს?
-continueff = Firefox-ით გაგრძელება
-errorgeneric = Pocket-ში შენახვისას დაფიქსირდა შეცდომა.
-learnmore = დაწვრილებით
-loginnow = შესვლა
-maxtaglength = იარლიყები შეზღუდულია 25 ასომდე
-mustbeconnected = Pocket-ში შესანახად საჭიროა ინტერნეთთან კავშირი. გთხოვთ შეამოწმეთ თქვენი კავშირი და ხელახლა ცადეთ.
-onlylinkssaved = შესაძლებელია მხოლოდ ბმულების შენახვა
-pagenotsaved = გვერდი არ შეინახა
-pageremoved = გვერდი წაიშალა
-pagesaved = შეინახა Pocket-ში
-processingremove = იშლება გვერდი…
-processingtags = ემატება იარლიყები…
-removepage = გვერდის წაშლა
-save = შენახვა
-saving = ინახება…
-signupemail = რეგისტრაცია ელ-ფოსტით
-signuptosave = დარეგისტრირდით Pocket-ზე. ეს უფასოა.
-suggestedtags = შემოთავაზებული იარლიყები
-tagline = შეინახეთ სტატიები და ვიდეობეი Firefox-იდან მათ Pocket-ში სანახავად ნებისმიერ მოწყობილობაზე, ნებისმიერ დროს.
-taglinestory_one = Firefox-იდან ნებისმიერი სტატიის, ვიდეოს ან გვერდის შესანახად დააწკაპეთ Pocket-ის ღილაკს.
-taglinestory_two = დაათვალიერეთ Pocket-ში ნებისმიერ მოწყობილობაზე, ნებისმიერ დროს.
-tagssaved = იარლიყები დაემატა
-tos = გაგრძელების შემთხვევაში თქვენ ეთანხმებით Pocket-ის <a href="%1$S" target="_blank">მომსახურების პირობებს</a> და <a href="%2$S" target="_blank">პრივატულობის პოლიტიკას</a>
-tryitnow = სცადეთ ახლავე
-signinfirefox = შესვლა Firefox-ით
-signupfirefox = რეგისრაცია Firefox-ით
-viewlist = სიის ნახვა
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Pocket-ში შენახვა
-saveToPocketCmd.label = გვერდის შენახვა Pocket-ში
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = ბმულის შენახვა Pocket-ში
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = Pocket სიის ნახვა
diff --git a/browser/extensions/pocket/locale/kab/pocket.properties b/browser/extensions/pocket/locale/kab/pocket.properties
deleted file mode 100644
index 3f4cc642ae..0000000000
--- a/browser/extensions/pocket/locale/kab/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Rnu tibzimin
-alreadyhaveacct = Aseqdac yakan n Pocket?
-continueff = Kemmel s Firefox
-errorgeneric = Teḍra-d tuccḍa deg aɛraḍ n usekles ɣer Pocket.
-learnmore = Issin ugar
-loginnow = Kcem
-maxtaglength = Tibzimin ɣur-sent talast n 25 n isekkilen
-mustbeconnected = Yessefk ad tiliḍ teqqneḍ ɣer Internet akken ad tizmireḍ ad teskelseḍ ɣer Pocket. Ma ulac aɣilif, senqed tuqqna yinek sakin ɛreḍ tikelt nniḍen.
-onlylinkssaved = Al iseɣwan i yezmren ad ttwakelsen
-pagenotsaved = Asebter ur yettwakles ara
-pageremoved = Asebter yettwakkes
-pagesaved = Yettwakles ɣer Pocket
-processingremove = Tukksa n isebtar…
-processingtags = Timerna n tebzimin…
-removepage = Kkes asebter
-save = Sekles
-saving = Asekles…
-signupemail = Jerred s yimayl
-signuptosave = Jerred ɣer Pocket. Baṭel.
-suggestedtags = Tibzimin yettwasumren
-tagline = Sekles imagraden akked tvidyutin si Firefox akken ad twaliḍ di Pocket ɣef yal ibenk, melmi tebɣiḍ.
-taglinestory_one = Sit ɣef tqeffalt Pocket akken ad teskelseḍ yal amagrad, tavidyut neɣ asebter si Firefox.
-taglinestory_two = Sken di Pocket ɣef yal ibenk yellan, melmi tebɣiḍ.
-tagssaved = Tibzimin yettwarnan
-tos = Ma tkemleḍ, ad tqebleḍ <a href="%1$S" target="_blank">tiwtilin n useqdec</a> akked <a href="%2$S" target="_blank">tsertit tabaḍnit</a> n Pocket
-tryitnow = Ɛreḍ-it tura
-signinfirefox = Kcem s Firefox
-signupfirefox = Jerred s Firefox
-viewlist = Sken tabdart
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Sekles ɣer Pocket
-saveToPocketCmd.label = Sekles asebter ɣer Pocket
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = Sekles aseɣwen ɣer Pocket
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = Sken tabdart n Pocket
diff --git a/browser/extensions/pocket/locale/lt/pocket.properties b/browser/extensions/pocket/locale/lt/pocket.properties
deleted file mode 100644
index f3e8df077c..0000000000
--- a/browser/extensions/pocket/locale/lt/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Pridėkite gairių
-alreadyhaveacct = Jau naudojatės „Pocket“?
-continueff = Tęsti su „Firefox“
-errorgeneric = Bandant išsaugoti į „Pocket“ įvyko klaida.
-learnmore = Sužinokite daugiau
-loginnow = Prisijungti
-maxtaglength = Gaires gali sudaryti iki 25 simbolių
-mustbeconnected = Norėdami saugoti į „Pocket“, turite būti prisijungę prie interneto. Prašome patikrinti savo ryšį ir bandyti vėl.
-onlylinkssaved = Išsaugoti galima tik nuorodas
-pagenotsaved = Tinklalapis neišsaugotas
-pageremoved = Tinklalapis pašalintas
-pagesaved = Išsaugota į „Pocket“
-processingremove = Šalinamas tinklalapis…
-processingtags = Pridedamos gairės…
-removepage = Pašalinti tinklalapį
-save = Išsaugoti
-saving = Išsaugoma…
-signupemail = Prisijungti su el. paštu
-signuptosave = Pradėkite naudotis „Pocket“. Tai nemokama.
-suggestedtags = Siūlomos gairės
-tagline = Išsaugokite straipsnius bei vaizdo įrašus iš „Firefox“ norėdami juos peržiūrėti bet kokiame įrenginyje su „Pocket“, bet kuriuo metu.
-taglinestory_one = Spustelėkite „Pocket“ mygtuką norėdami išsaugoti bet kokį straipsnį, vaizdo įrašą ar tinklalapį iš „Firefox“.
-taglinestory_two = Peržiūrėkite bet kokiame įrenginyje su „Pocket“, bet kuriuo metu.
-tagssaved = Gairės pridėtos
-tos = Tęsdami sutinkate su „Pocket“ <a href="%1$S" target="_blank">paslaugos teikimo sąlygomis</a> bei <a href="%2$S" target="_blank">privatumo nuostatais</a>
-tryitnow = Išbandykite dabar
-signinfirefox = Prisijungti su „Firefox“
-signupfirefox = Prisijungti su „Firefox“
-viewlist = Peržiūrėti sąrašą
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Išsaugoti į „Pocket“
-saveToPocketCmd.label = Išsaugoti tinklalapį į „Pocket“
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = Išsaugoti saitą į „Pocket“
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = Peržiūrėti „Pocket“ sąrašą
diff --git a/browser/extensions/pocket/locale/lv/pocket.properties b/browser/extensions/pocket/locale/lv/pocket.properties
deleted file mode 100644
index 40e3bb3670..0000000000
--- a/browser/extensions/pocket/locale/lv/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Pievienot birkas
-alreadyhaveacct = Jau lietojat Pocket?
-continueff = Turpināt ar Firefox
-errorgeneric = Kļūda saglabājot Pocket.
-learnmore = Uzzināt vairāk
-loginnow = Pieslēgties
-maxtaglength = Birkas nevar būt garākas par 25 simboliem
-mustbeconnected = Lai saglabātu Pocket, jābūt savienojumam ar internetu. Lūdzu pārbaudiet savienojumu un mēģiniet vēlreiz.
-onlylinkssaved = Saglabāt var tikai saites
-pagenotsaved = Lapa nav saglabāta
-pageremoved = Lapa ir aizvākta
-pagesaved = Saglabāt Pocket
-processingremove = Aizvāc lapu…
-processingtags = Pievieno birkas…
-removepage = Izņemt lapu
-save = Saglabāt
-saving = Saglabā…
-signupemail = Pierakstīties ar epastu
-signuptosave = Pierakstīties Pocket. Tas ir bez maksas.
-suggestedtags = Ieteiktās birkas
-tagline = Saglabājiet Firefox rakstu vai video, lai skatītos to ar Pocket jebkurā ierīcē un jebkurā laikā.
-taglinestory_one = Klikšķiniet uz Pocket pogas, lai saglabātu Firefox rakstus, video vai lapas.
-taglinestory_two = Skatiet ar Pocket jebkurā ierīcē un jebkurā laikā.
-tagssaved = Birkas pievienotas
-tos = Turpinot, tu piekrīti Pocket <a href="%1$S" target="_blank">Noteikumiem</a> un <a href="%2$S" target="_blank">Privātuma politikai</a>
-tryitnow = Izmēģini tagad
-signinfirefox = Pieslēgties ar Firefox
-signupfirefox = Pierakstīties ar Firefox
-viewlist = Skatījumu saraksts
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Saglabāt Pocket
-saveToPocketCmd.label = Saglabāt lapu Pocket
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = Saglabāt saiti Pocket
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = Aplūkot Pocket sarakstu
diff --git a/browser/extensions/pocket/locale/moz.build b/browser/extensions/pocket/locale/moz.build
deleted file mode 100644
index aac3a838c4..0000000000
--- a/browser/extensions/pocket/locale/moz.build
+++ /dev/null
@@ -1,7 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-JAR_MANIFESTS += ['jar.mn']
diff --git a/browser/extensions/pocket/locale/mr/pocket.properties b/browser/extensions/pocket/locale/mr/pocket.properties
deleted file mode 100644
index af330ec1eb..0000000000
--- a/browser/extensions/pocket/locale/mr/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = टॅग जोडा
-alreadyhaveacct = आधीपासून Pocket वापरताय?
-continueff = Firefox सोबत पुढे चला
-errorgeneric = Pocket मध्ये जतन करताना त्रुटी आली.
-learnmore = अधिक जाणून घ्या
-loginnow = लॉग इन
-maxtaglength = टॅग्ज साठी 25 वर्णांची मर्यादा आहे
-mustbeconnected = Pocket मध्ये साठविण्यासाठी आपले इंटरनेट चालू असणे आवश्यक आहे. कृपया आपली जोडणी तपासा आणि पुन्हा प्रयत्न करा.
-onlylinkssaved = फक्त दुवे जतन केले जाऊ शकतात
-pagenotsaved = पृष्ठ जतन झाले नाही
-pageremoved = पृष्ठ काढले गेले
-pagesaved = Pocket मध्ये जतन झाले
-processingremove = पृष्ठ काढून टाकत आहे...
-processingtags = टॅग्ज जोडत आहे…
-removepage = पृष्ठ काढून टाका
-save = जतन करा
-saving = जतन करत आहे...
-signupemail = ईमेलसह साईन अप करा
-signuptosave = Pocket साठी साईन अप करा. हे मोफत आहे.
-suggestedtags = सूचविलेले टॅग्स
-tagline = Firefox मधील नोंदी आणि व्हिडीओ कुठल्याही साधनावर केंव्हाही Pocket मध्ये पाहण्यासाठी साठवा.
-taglinestory_one = Firefox वरील कोणताही लेख, व्हिडिओ किंवा पृष्ठ जतन करण्यासाठी Pocket बटणावर क्लिक करा.
-taglinestory_two = कधीही कुठल्याही साधनावर Pocket मध्ये पाहा.
-tagssaved = टॅग्स जोडले
-tos = सुरु ठेवुन, आपण Pocketच्या <a href="%1$S" target="_blank">सेवेच्या अटी</a> आणि <a href="%2$S" target="_blank">गोपनीयता धोरणांशी</a> सहमत आहात
-tryitnow = आत्ताच वापरुन पाहा
-signinfirefox = Firefox सह साइन इन करा
-signupfirefox = Firefox सह साईन अप करा
-viewlist = यादी पहा
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Pocket मध्ये जतन करा
-saveToPocketCmd.label = पृष्ठ Pocket मध्ये जतन करा
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = दुवा Pocket मध्ये संकलित करा
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = पॉकेट सूची पहा
diff --git a/browser/extensions/pocket/locale/ms/pocket.properties b/browser/extensions/pocket/locale/ms/pocket.properties
deleted file mode 100644
index 67a935be85..0000000000
--- a/browser/extensions/pocket/locale/ms/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Tambah Tag
-alreadyhaveacct = Sudah menjadi pengguna Poket?
-continueff = Teruskan dengan Firefox
-errorgeneric = Ada ralat semasa cuba menyimpan ke Pocket.
-learnmore = Ketahui Selanjutnya
-loginnow = Log masuk
-maxtaglength = Tag dihadkan hanya 25 aksara
-mustbeconnected = Anda mesti ada sambungan Internet untuk menyimpan ke Pocket. Sila periksa sambungan anda dan cuba lagi.
-onlylinkssaved = Hanya pautan boleh disimpan
-pagenotsaved = Halaman Tidak Disimpan
-pageremoved = Halaman Dialih keluar
-pagesaved = Disimpan ke Pocket
-processingremove = Sedang mengalih keluar Halaman…
-processingtags = Sedang menambah tag…
-removepage = Alih keluar Halaman
-save = Simpan
-saving = Sedang menyimpan…
-signupemail = Daftar dengan e-mel
-signuptosave = Daftar masuk ke Pocket. Percuma.
-suggestedtags = Tag Disyorkan
-tagline = Simpan artikel dan video dari Firefox untuk dilihat dalam Pocket pada apa jua peranti pada bila-bila masa.
-taglinestory_one = Klik butang Pocket untuk menyimpan apa jua artikel, video atau halaman daripada Firefox.
-taglinestory_two = Papar dalam Pocket dalam mana-mana peranti, bila-bila masa saja.
-tagssaved = Tag Ditambah
-tos = Dengan meneruskan, anda setuju dengan <a href="%1$S" target="_blank">Terma Perkhidmatan</a> Pocket dan <a href="%2$S" target="_blank">Polisi Privasi</a>
-tryitnow = Cubanya Sekarang
-signinfirefox = Daftar masuk Firefox
-signupfirefox = Daftar dengan Firefox
-viewlist = Senarai Paparan
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Simpan ke Pocket
-saveToPocketCmd.label = Simpan Halaman ke Pocket
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = Simpan Pautan ke Pocket
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = Papar Senarai Pocket
diff --git a/browser/extensions/pocket/locale/nl/pocket.properties b/browser/extensions/pocket/locale/nl/pocket.properties
deleted file mode 100644
index 3abe14491c..0000000000
--- a/browser/extensions/pocket/locale/nl/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Labels toevoegen
-alreadyhaveacct = Al een Pocket-gebruiker?
-continueff = Doorgaan met Firefox
-errorgeneric = Er is een fout opgetreden bij het opslaan naar Pocket.
-learnmore = Meer info
-loginnow = Meld u aan
-maxtaglength = Labels zijn beperkt tot 25 tekens
-mustbeconnected = U moet met het internet zijn verbonden om naar Pocket te kunnen opslaan. Controleer uw verbinding en probeer het opnieuw.
-onlylinkssaved = Alleen koppelingen kunnen worden opgeslagen
-pagenotsaved = Pagina niet opgeslagen
-pageremoved = Pagina verwijderd
-pagesaved = Opgeslagen naar Pocket
-processingremove = Pagina verwijderen…
-processingtags = Labels toevoegen…
-removepage = Pagina verwijderen
-save = Opslaan
-saving = Opslaan…
-signupemail = Registreren met e-mailadres
-signuptosave = Registreer voor Pocket. Het is gratis.
-suggestedtags = Voorgestelde labels
-tagline = Sla artikelen en video’s vanuit Firefox op voor weergeven in Pocket op diverse apparaten, wanneer dan ook.
-taglinestory_one = Klik op de Pocket-knop om artikelen, video’s of pagina’s vanuit Firefox op te slaan.
-taglinestory_two = Bekijk ze op diverse apparaten, wanneer dan ook.
-tagssaved = Labels toegevoegd
-tos = Door verder te gaan, gaat u akkoord met de <a href="%1$S" target="_blank">Servicevoorwaarden</a> en het <a href="%2$S" target="_blank">Privacybeleid</a> van Pocket
-tryitnow = Nu proberen
-signinfirefox = Aanmelden met Firefox
-signupfirefox = Registreren met Firefox
-viewlist = Lijst weergeven
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Opslaan naar Pocket
-saveToPocketCmd.label = Pagina opslaan naar Pocket
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = Koppeling opslaan naar Pocket
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = Pocket-lijst weergeven
diff --git a/browser/extensions/pocket/locale/nn-NO/pocket.properties b/browser/extensions/pocket/locale/nn-NO/pocket.properties
deleted file mode 100644
index 3f3dc971e6..0000000000
--- a/browser/extensions/pocket/locale/nn-NO/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Legg til merkelapp-stikkord
-alreadyhaveacct = Allereie ein Pocket-brukar?
-continueff = Hald fram med Firefox
-errorgeneric = Eit problem oppstod ved lagring til Pocket.
-learnmore = Les meir
-loginnow = Logg inn
-maxtaglength = Merkelapp-stikkord er avgrensa til 25 teikn
-mustbeconnected = Du må vera kopla til nettet for å lagra til Pocket. Kontroller tilkoplinga og prøv igjen.
-onlylinkssaved = Berre lenker kan lagrast
-pagenotsaved = Sida ikkje lagra
-pageremoved = Sida fjerna
-pagesaved = Lagrar til Pocket
-processingremove = Fjernar sida …
-processingtags = Legg til merkelapp-stikkord…
-removepage = Fjern sida
-save = Lagra
-saving = Lagrar …
-signupemail = Logg inn med e-postadresse
-signuptosave = Registrer deg på Pocket. Det er gratis.
-suggestedtags = Føreslåtte merkelapp-stikkord
-tagline = Lagra artiklar og videoar frå Firefox for å visa dei i Pocket på kva som helst eining, når som helst.
-taglinestory_one = Trykk på Pocket-knappen for å lagra kva som helst artikkel, video eller side frå Firefox.
-taglinestory_two = Vis i Pocket, på kva som helst eining, når som helst.
-tagssaved = Merkelapp-stikkord lagt til
-tos = Ved å fortsetta godtek du Pocket sine <a href="%1$S" target="_blank">tenestevilkår</a> og <a href="%2$S" target="_blank">personvernpraksis</a>
-tryitnow = Prøv no
-signinfirefox = Logg inn med Firefox
-signupfirefox = Registrer deg med Firefox
-viewlist = Vis liste
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Lagra til Pocket
-saveToPocketCmd.label = Lagra sida i Pocket
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = Lagra lenke til Pocket
-saveLinkToPocketCmd.accesskey = l
-pocketMenuitem.label = Vis Pocket-liste
diff --git a/browser/extensions/pocket/locale/or/pocket.properties b/browser/extensions/pocket/locale/or/pocket.properties
deleted file mode 100644
index d2616e484a..0000000000
--- a/browser/extensions/pocket/locale/or/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = ଟ୍ୟାଗ ଯୋଡ଼ନ୍ତୁ
-alreadyhaveacct = ଆଗରୁ Pocket ବ୍ୟବହାର କରୁଛନ୍ତି?
-continueff = Firefox ଦେଇ ଆଗକୁ ଯିବେ
-errorgeneric = Pocketରେ ସାଇତିବା ବେଳେ ଅସୁବିଧାଟିଏ ହେଲା ।
-learnmore = ଅଧିକ ଶିଖନ୍ତୁ
-loginnow = ଲଗ ଇନ
-maxtaglength = ଟ୍ୟାଗ 25 ଟି ଅକ୍ଷରରେ ସୀମିତ
-mustbeconnected = Pocketରେ ସାଇତିବା ପାଇଁ ଆପଣ ଇଣ୍ଟରନେଟ ସହ ସଂଯୁକ୍ତ ହୋଇଥିବା ଲୋଡ଼ା । ଦୟାକରି ନିଜ ସଂଯୋଗ ପରଖି ଆଉଥରେ ଚେଷ୍ଟାକରନ୍ତୁ ।
-onlylinkssaved = କେବଳ ଲିଙ୍କ ସାଇତାଯାଇପାରିବ
-pagenotsaved = ପୃଷ୍ଠା ସାଇତା ଯାଇନାହିଁ
-pageremoved = ପୃଷ୍ଠାଟି ହଟାଗଲା
-pagesaved = Pocketରେ ସାଇତାଗଲା
-processingremove = ପୃଷ୍ଠା ହଟାଯାଉଛି…
-processingtags = ଟ୍ୟାଗ ଯୋଡ଼ାଯାଉଛି…
-removepage = ପୃଷ୍ଠା ହଟାନ୍ତୁ
-save = ସାଇତିବେ
-saving = ସାଇତୁଛି…
-signupemail = ଇମେଲରେ ସାଇନ ଅପ
-signuptosave = Pocket ପାଇଁ ସାଇନ ଅପ । ଏହା ମାଗଣା ।
-suggestedtags = ପ୍ରସ୍ତାବିତ ଟ୍ୟାଗ
-tagline = ଯେତେବେଳେ ଲୋଡ଼ା କୌଣସି ଏକ ଡିଭାଇସରୁ Pocketରେ ଦେଖିବା ପାଇଁ Firefoxରୁ ପ୍ରସଙ୍ଗ ଓ ଭିଡ଼ିଓ ସାଇତିପାରିବେ ।
-taglinestory_one = କୌଣସି ପ୍ରସଙ୍ଗ, ଭିଡ଼ିଓ ବା ପୃଷ୍ଠା ସାଇତିବା ପାଇଁ Pocket Button ଟିପନ୍ତୁ ।
-taglinestory_two = ଯେତେବେଳେ ଲୋଡ଼ା ସବୁ ଡିଭାଇସରୁ Pocketରେ ଦେଖନ୍ତୁ ।
-tagssaved = ଟ୍ୟାଗ ଯୋଡ଼ାଗଲା
-tos = ଆଗକୁ ବଢ଼ିବା ଯୋଗୁ ଆପଣ Pocketର <a href="%1$S" target="_blank">ନୀତି ନିୟମ</a> ଓ <a href="%2$S" target="_blank">ଗୋପନୀୟତା ନୀତିବଳୀ</a> ମାନୁଛନ୍ତି ବୋଲି ଜାଣିରଖିବେ
-tryitnow = ଏବେ ଏହା ଚେଷ୍ଟାକରନ୍ତୁ
-signinfirefox = Firefoxରେ ସାଇନ ଇନ କରନ୍ତୁ
-signupfirefox = Firefoxରେ ସାଇନ ଅପ କରନ୍ତୁ
-viewlist = ତାଲିକା ଦେଖନ୍ତୁ
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Pocketରେ ସାଇତନ୍ତୁ
-saveToPocketCmd.label = Pocketରେ ପୃଷ୍ଠା ସାଇତନ୍ତୁ
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = Pocketରେ ଲିଙ୍କ ସାଇତନ୍ତୁ
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = Pocket ତାଲିକା ଦେଖନ୍ତୁ
diff --git a/browser/extensions/pocket/locale/pl/pocket.properties b/browser/extensions/pocket/locale/pl/pocket.properties
deleted file mode 100644
index 07b5866f15..0000000000
--- a/browser/extensions/pocket/locale/pl/pocket.properties
+++ /dev/null
@@ -1,48 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-taglinestory_one=Kliknij przycisk Pocket, aby wysłać dowolny artykuł, film lub stronę z Firefoksa.
-taglinestory_two=Czytaj z Pocket o dowolnej porze na dowolnym urządzeniu.
-learnmore=Więcej informacji
-
-signuptosave=Utwórz konto w Pocket. Jest darmowe.
-signupfirefox=Utwórz konto z Firefoksem
-signupemail=Utwórz konto z adresem e-mail
-alreadyhaveacct=Masz już konto Pocket?
-loginnow=Zaloguj się
-
-tos=Kontynuując, wyrażasz zgodę na <a href="%1$S" target="_blank">warunki korzystania z usługi</a> i <a href="%2$S" target="_blank">politykę prywatności</a>
-tryitnow=Wypróbuj teraz
-
-continueff=Kontynuuj z kontem Firefoksa
-signinfirefox=Zaloguj się z Firefoksem
-viewlist=Otwórz w Pocket
-
-removepage=Usuń stronę
-processingremove=Usuwanie strony…
-pageremoved=Usunięto stronę
-
-save=Wyślij
-saving=Wysyłanie…
-pagesaved=Wysłano do Pocket
-
-addtags=Etykiety
-processingtags=Wysyłanie etykiet…
-tagssaved=Wysłano etykiety
-maxtaglength=Etykiety są ograniczone do 25 znaków
-suggestedtags=Sugerowane etykiety
-tagline=Wysyłaj artykuły i filmy z Firefoksa do Pocket, aby wyświetlić je o dowolnej porze na dowolnym urządzeniu.
-
-errorgeneric=Wystąpił błąd podczas wysyłania do Pocket.
-mustbeconnected=Połączenie z Internetem jest konieczne do przesyłania do Pocket. Proszę sprawdzić połączenie i spróbować ponownie.
-onlylinkssaved=Tylko odnośniki mogą być przesyłane
-pagenotsaved=Nie przesłano strony
-
-pocket-button.label=Pocket
-pocket-button.tooltiptext=Wyślij do Pocket
-saveToPocketCmd.label=Wyślij stronę do Pocket
-saveToPocketCmd.accesskey=s
-saveLinkToPocketCmd.label=Wyślij odnośnik do Pocket
-saveLinkToPocketCmd.accesskey=o
-pocketMenuitem.label=Wysłane do Pocket
diff --git a/browser/extensions/pocket/locale/pt-BR/pocket.properties b/browser/extensions/pocket/locale/pt-BR/pocket.properties
deleted file mode 100644
index a637aea29b..0000000000
--- a/browser/extensions/pocket/locale/pt-BR/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Adicionar etiquetas
-alreadyhaveacct = Já é um usuário do Pocket?
-continueff = Continuar com o Firefox
-errorgeneric = Houve um erro ao tentar salvar no Pocket.
-learnmore = Saber mais
-loginnow = Entrar
-maxtaglength = As etiquetas estão limitadas a 25 caracteres
-mustbeconnected = Você deve estar conectado à Internet para salvar no Pocket. Verifique a sua conexão e tente novamente.
-onlylinkssaved = Somente links podem ser salvos
-pagenotsaved = Página não salva
-pageremoved = Página removida
-pagesaved = Salva no Pocket
-processingremove = Removendo página…
-processingtags = Adicionando etiquetas…
-removepage = Remover página
-save = Salvar
-saving = Salvando…
-signupemail = Registrar com e-mail
-signuptosave = Registre-se no Pocket. É gratuito.
-suggestedtags = Etiquetas sugeridas
-tagline = Salve os artigos e vídeos do Firefox no Pocket para vê-los mais tarde e em qualquer local.
-taglinestory_one = Clique no botão Pocket para salvar um artigo, vídeo ou página do Firefox.
-taglinestory_two = Ver no Pocket em qualquer dispositivo, a qualquer hora.
-tagssaved = Etiquetas adicionadas
-tos = Continuando, você concorda com os <a href="%1$S" target="_blank">Termos de serviço</a> e <a href="%2$S" target="_blank">Política de privacidade</a> do Pocket
-tryitnow = Experimente-o agora
-signinfirefox = Entrar com o Firefox
-signupfirefox = Cadastre-se com o Firefox
-viewlist = Ver lista
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Salvar no Pocket
-saveToPocketCmd.label = Salvar página no Pocket
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = Salvar link no Pocket
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = Ver lista do Pocket
diff --git a/browser/extensions/pocket/locale/pt-PT/pocket.properties b/browser/extensions/pocket/locale/pt-PT/pocket.properties
deleted file mode 100644
index 90eafe77fc..0000000000
--- a/browser/extensions/pocket/locale/pt-PT/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Adicionar etiquetas
-alreadyhaveacct = Já é um utilizador do Pocket?
-continueff = Continuar com o Firefox
-errorgeneric = Ocorreu um erro ao tentar guardar no Pocket.
-learnmore = Saber mais
-loginnow = Iniciar sessão
-maxtaglength = As etiquetas estão limitadas a 25 caracteres
-mustbeconnected = É necessária uma ligação à Internet para poder guardar no Pocket. Por favor, verifique a sua ligação à Internet e tente novamente.
-onlylinkssaved = Só podem ser guardadas ligações
-pagenotsaved = Página não guardada
-pageremoved = Página removida
-pagesaved = Guardado no Pocket
-processingremove = A remover página…
-processingtags = A adicionar etiquetas…
-removepage = Remover página
-save = Guardar
-saving = A guardar…
-signupemail = Registar com email
-signuptosave = Registe-se no Pocket. É gratuito.
-suggestedtags = Etiquetas sugeridas
-tagline = Guardar artigos e vídeos do Firefox para os ver no Pocket em qualquer dispositivo, em qualquer altura.
-taglinestory_one = Clique no botão Pocket para guardar qualquer artigo, vídeo ou página a partir Firefox.
-taglinestory_two = Ver no Pocket em qualquer dispositivo, a qualquer altura.
-tagssaved = Etiquetas adicionadas
-tos = Ao continuar, concorda com os <a href="%1$S" target="_blank">termos do serviço</a> e <a href="%2$S" target="_blank">política de privacidade</a> do Pocket
-tryitnow = Experimente-o agora
-signinfirefox = Iniciar sessão com Firefox
-signupfirefox = Registar com Firefox
-viewlist = Ver lista
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Guardar no Pocket
-saveToPocketCmd.label = Guardar página no Pocket
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = Guardar ligação no Pocket
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = Ver lista do Pocket
diff --git a/browser/extensions/pocket/locale/rm/pocket.properties b/browser/extensions/pocket/locale/rm/pocket.properties
deleted file mode 100644
index 803277b214..0000000000
--- a/browser/extensions/pocket/locale/rm/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Agiuntar tags
-alreadyhaveacct = Es ti gia in utilisader da Pocket?
-continueff = Cuntinuar cun Firefox
-errorgeneric = Ina errur è succedida durant empruvar da memorisar en Pocket.
-learnmore = Ulteriuras infurmaziuns
-loginnow = S'annunziar
-maxtaglength = Tags èn limitads a 25 caracters
-mustbeconnected = Ti stos esser connectà cun l'internet per pudair memorisar en Pocket. Controllescha p.pl. tia connexiun ed emprova anc ina giada.
-onlylinkssaved = Mo colliaziuns pon vegnir memorisadas
-pagenotsaved = Betg memorisà la pagina
-pageremoved = Allontanà la pagina
-pagesaved = Memorisà en Pocket
-processingremove = Allontanar la pagina…
-processingtags = Agiuntar tags…
-removepage = Allontanar la pagina
-save = Memorisar
-saving = Memorisar…
-signupemail = Sa registrar cun l'adressa dad e-mail
-signuptosave = Ta registrescha tar Pocket. Gratuit.
-suggestedtags = Tags proponids
-tagline = Memorisescha artitgels e videos ord Firefox per als vesair en Pocket, sin mintga apparat, da tut temp.
-taglinestory_one = Clicca sin il buttun da Pocket per memorisar directamain ord Firefox tge artitgel, video u pagina ch'i saja.
-taglinestory_two = Vesair en Pocket sin mintga apparat, da tut temp.
-tagssaved = Tags agiuntads
-tos = Cun cuntinuar accepteschas ti il <a href="%1$S" target="_blank">Contract da licenza</a> e las <a href="%2$S" target="_blank">Directivas per la protecziun da datas</a> da Pocket
-tryitnow = Emprova ussa
-signinfirefox = S'annunziar cun Firefox
-signupfirefox = Sa registrar cun Firefox
-viewlist = Mussar la glista
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Memorisar en Pocket
-saveToPocketCmd.label = Memorisar la pagina en Pocket
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = Memorisar la colliaziun en Pocket
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = Mussar la glista da Pocket
diff --git a/browser/extensions/pocket/locale/ro/pocket.properties b/browser/extensions/pocket/locale/ro/pocket.properties
deleted file mode 100644
index eedb756f91..0000000000
--- a/browser/extensions/pocket/locale/ro/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Adaugă etichete
-alreadyhaveacct = Ești deja un utilizator Pocket?
-continueff = Continuă cu Firefox
-errorgeneric = A apărut o eroare la încercarea de salvare în Pocket.
-learnmore = Află mai multe
-loginnow = Autentificare
-maxtaglength = Etichetele sunt limitate la 25 de caractere
-mustbeconnected = Trebuie să fii conectat la internet pentru a salva în Pocket. Te rugăm să verifici conexiunea și să încerci din nou.
-onlylinkssaved = Doar linkurile pot fi salvate
-pagenotsaved = Pagină nesalvată
-pageremoved = Pagină eliminată
-pagesaved = Salvat în Pocket
-processingremove = Se elimină pagina…
-processingtags = Se adaugă etichete…
-removepage = Elimină pagina
-save = Salvează
-saving = Se salvează...
-signupemail = Înregistrare cu e-mail
-signuptosave = Înregistrează-te pentru Pocket. Este gratuit.
-suggestedtags = Etichete sugerate
-tagline = Salvează articole și videoclipuri din Firefox pentru a le vedea în Pocket de pe orice dispozitiv, oricând.
-taglinestory_one = Clic pe butonul Pocket pentru a salva orice articol, videoclip sau pagină din Firefox.
-taglinestory_two = Vezi în Pocket de pe orice dispozitiv, oricând.
-tagssaved = Etichete adăugate
-tos = Continuând, ești de acord cu <a href="%1$S" target="_blank">termenii de utilizare a serviciului</a> și <a href="%2$S" target="_blank">politica de confidențialitate</a> a Pocket
-tryitnow = Încearcă acum
-signinfirefox = Autentificare în Firefox
-signupfirefox = Înregistrare în Firefox
-viewlist = Vezi lista
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Salvează în Pocket
-saveToPocketCmd.label = Salvează pagina în Pocket
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = Salvează linkul în Pocket
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = Vezi lista Pocket
diff --git a/browser/extensions/pocket/locale/ru/pocket.properties b/browser/extensions/pocket/locale/ru/pocket.properties
deleted file mode 100644
index 0da716e8a6..0000000000
--- a/browser/extensions/pocket/locale/ru/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Добавить теги
-alreadyhaveacct = Уже используете Pocket?
-continueff = Продолжить через Firefox
-errorgeneric = При попытке сохранить в Pocket произошла ошибка.
-learnmore = Узнайте больше
-loginnow = Войдите
-maxtaglength = Длина тега не должна превышать 25 символов
-mustbeconnected = Чтобы сохранять в Pocket, вы должны быть подключены к Интернету. Пожалуйста, проверьте ваше соединение и попробуйте снова.
-onlylinkssaved = Можно сохранять только ссылки
-pagenotsaved = Страница не сохранена
-pageremoved = Страница удалена
-pagesaved = Сохранено в Pocket
-processingremove = Удаление страницы…
-processingtags = Добавление тегов…
-removepage = Удалить страницу
-save = Сохранить
-saving = Сохранение…
-signupemail = Регистрация по эл. почте
-signuptosave = Зарегистрируйтесь в Pocket. Это бесплатно.
-suggestedtags = Рекомендуемые теги
-tagline = Сохраняйте статьи и видео из Firefox для просмотра в Pocket на любом устройстве, в любой момент.
-taglinestory_one = Щёлкните по кнопке Pocket, чтобы сохранить любую статью, видео или страницу из Firefox.
-taglinestory_two = Просматривайте их в Pocket на любом устройстве, в любой момент.
-tagssaved = Теги добавлены
-tos = Продолжая, вы принимаете <a href="%1$S" target="_blank">Условия службы</a> и <a href="%2$S" target="_blank">Политику приватности</a> Pocket
-tryitnow = Попробовать сейчас
-signinfirefox = Войти через Firefox
-signupfirefox = Регистрация через Firefox
-viewlist = Просмотреть список
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Сохранить в Pocket
-saveToPocketCmd.label = Сохранить страницу в Pocket
-saveToPocketCmd.accesskey = х
-saveLinkToPocketCmd.label = Сохранить ссылку в Pocket
-saveLinkToPocketCmd.accesskey = о
-pocketMenuitem.label = Показать список Pocket
diff --git a/browser/extensions/pocket/locale/sk/pocket.properties b/browser/extensions/pocket/locale/sk/pocket.properties
deleted file mode 100644
index 57327365c6..0000000000
--- a/browser/extensions/pocket/locale/sk/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Pridať značky
-alreadyhaveacct = Už ste používateľom služby Pocket?
-continueff = Pokračovať s Firefoxom
-errorgeneric = Počas ukladania údajov do služby Pocket sa vyskytla chyba.
-learnmore = Ďalšie informácie
-loginnow = Prihlásiť sa
-maxtaglength = Značky môžu obsahovať najviac 25 znakov
-mustbeconnected = Ak chcete ukladať údaje do služby Pocket, musíte byť pripojený k sieti Internet. Skontrolujte svoje pripojenie a skúste to znova.
-onlylinkssaved = Uložené môžu byť len odkazy
-pagenotsaved = Stránka nebola uložená
-pageremoved = Stránka bola odstránená
-pagesaved = Uložená do služby Pocket
-processingremove = Stránka sa odstraňuje…
-processingtags = Pridávajú sa značky…
-removepage = Odstrániť stránku
-save = Uložiť
-saving = Ukladá sa…
-signupemail = Zaregistrovať sa pomocou e-mailu
-signuptosave = Zaregistrujte sa v službe Pocket. Je zadarmo.
-suggestedtags = Navrhované značky
-tagline = Ukladajte si články a videá z Firefoxu a majte ich dostupné kdekoľvek a na akomkoľvek zariadení pomocou služby Pocket.
-taglinestory_one = Kliknutím na tlačidlo Pocket vo Firefoxe uložíte akýkoľvek článok, video alebo stránku.
-taglinestory_two = Tieto sú potom so službou Pocket dostupné kdekoľvek a na akomkoľvek zariadení.
-tagssaved = Značky boli pridané
-tos = Pokračovaním vyjadrujete súhlas s <a href="%1$S" target="_blank">podmienkami používania</a> služby Pocket a so <a href="%2$S" target="_blank">zásadami ochrany osobných údajov</a>
-tryitnow = Vyskúšajte to hneď teraz
-signinfirefox = Prihlásiť sa pomocou Firefoxu
-signupfirefox = Zaregistrovať sa pomocou Firefoxu
-viewlist = Zobraziť zoznam
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Služba Pocket
-pocket-button.tooltiptext = Uložiť do služby Pocket
-saveToPocketCmd.label = Uložiť stránku do služby Pocket
-saveToPocketCmd.accesskey = P
-saveLinkToPocketCmd.label = Uložiť odkaz do služby Pocket
-saveLinkToPocketCmd.accesskey = d
-pocketMenuitem.label = Zobraziť zoznam služby Pocket
diff --git a/browser/extensions/pocket/locale/sl/pocket.properties b/browser/extensions/pocket/locale/sl/pocket.properties
deleted file mode 100644
index e0451d72b8..0000000000
--- a/browser/extensions/pocket/locale/sl/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Dodaj oznake
-alreadyhaveacct = Že uporabljate Pocket?
-continueff = Nadaljuj s Firefoxom
-errorgeneric = Med shranjevanjem na Pocket je prišlo do napake.
-learnmore = Več o tem
-loginnow = Prijava
-maxtaglength = Oznake so omejene na 25 znakov
-mustbeconnected = Za shranjevanje na Pocket morate biti povezani na internet. Preverite povezavo in poskusite znova.
-onlylinkssaved = Shranite lahko samo povezave
-pagenotsaved = Stran ni bila shranjena
-pageremoved = Stran odstranjena
-pagesaved = Shranjeno na Pocket
-processingremove = Odstranjevanje strani …
-processingtags = Dodajanje oznak …
-removepage = Odstrani stran
-save = Shrani
-saving = Shranjevanje …
-signupemail = Registrirajte se z e-pošto
-signuptosave = Brezplačno se registrirajte na Pocketu.
-suggestedtags = Predlagane oznake
-tagline = Shranite članke in videe v Firefoxu in si jih oglejte na Pocketu iz katere koli naprave.
-taglinestory_one = Kliknite gumb Pocket v Firefoxu in shranite članek, video ali stran.
-taglinestory_two = Oglejte si v Pocketu na kateri koli napravi.
-tagssaved = Oznake dodane
-tos = Če nadaljujete, sprejemate <a href="%1$S" target="_blank">Pogoje uporabe</a> in <a href="%2$S" target="_blank">Politiko zasebnosti</a> storitve Pocket
-tryitnow = Preizkusite ga zdaj
-signinfirefox = Prijavite se s Firefoxom
-signupfirefox = Registrirajte se s Firefoxom
-viewlist = Ogled seznama
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Shrani v Pocket
-saveToPocketCmd.label = Shrani stran v Pocket
-saveToPocketCmd.accesskey = r
-saveLinkToPocketCmd.label = Shrani povezavo v Pocket
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = Pokaži seznam Pocket
diff --git a/browser/extensions/pocket/locale/sq/pocket.properties b/browser/extensions/pocket/locale/sq/pocket.properties
deleted file mode 100644
index b8b17ad226..0000000000
--- a/browser/extensions/pocket/locale/sq/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Shtoni Etiketa
-alreadyhaveacct = Jeni tashmë përdorues Pocket-i?
-continueff = Vazhdoni me Firefox-in
-errorgeneric = Pati një gabim teksa përpiqej të ruante te Pocket.
-learnmore = Mësoni më tepër
-loginnow = Hyni
-maxtaglength = Etiketat kufizohen deri në 25 shenja
-mustbeconnected = Që të ruani në Pocket, duhet të jeni i lidhur në Internet. Ju lutemi, kontrolloni lidhjen tuaj dhe riprovoni.
-onlylinkssaved = Mund të ruhen vetëm lidhje
-pagenotsaved = Faqja S’u Ruajt
-pageremoved = Faqja u Hoq
-pagesaved = U ruajt te Pocket
-processingremove = Po hiqet Faqja…
-processingtags = Po shtohen etiketa…
-removepage = Hiqe Faqen
-save = Ruaje
-saving = Po ruhet…
-signupemail = Regjistrohuni me email
-signuptosave = Regjistrohuni në Pocket. Është falas.
-suggestedtags = Etiketa të Këshilluara
-tagline = Ruani që nga Firefoxc-i artikuj dhe video për t’i parë në Pocket në çfarëdo pajisje, kurdo.
-taglinestory_one = Klikoni butonin Pocket që të ruani që nga Firefox-i çfarëdo artikulli, video ose faqe.
-taglinestory_two = Shihini në Pocket, në çfarëdo pajisje, kurdo.
-tagssaved = Etiketat u Shtuan
-tos = Duke vazhduar, pajtoheni me <a href="%1$S" target="_blank">Kushtet e Shërbimit</a> dhe <a href="%2$S" target="_blank">Rregullat e Privatësisë</a> për Pocket-in
-tryitnow = Provojeni Që Tani
-signinfirefox = Hyni me Firefox
-signupfirefox = Regjistrohuni me Firefox
-viewlist = Shihni Listën
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Ruajeni te Pocket
-saveToPocketCmd.label = Ruajeni Faqen te Pocket
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = Ruajeni lidhjen te Pocket
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = Shihni Listën te Pocket
diff --git a/browser/extensions/pocket/locale/sr/pocket.properties b/browser/extensions/pocket/locale/sr/pocket.properties
deleted file mode 100644
index c3dbf2ecee..0000000000
--- a/browser/extensions/pocket/locale/sr/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Додај ознаку
-alreadyhaveacct = Већ сте Pocket корисник?
-continueff = Настави са Firefox-ом
-errorgeneric = Десила се грешка при покушају снимања у Pocket.
-learnmore = Сазнајте више
-loginnow = Пријава
-maxtaglength = Ознаке су ограничене на 25 карактера
-mustbeconnected = Морате бити повезани на интернет да бисте снимили у Pocket. Проверити везу и покушајте поново.
-onlylinkssaved = Само се везе могу снимити
-pagenotsaved = Страница није снимљена
-pageremoved = Страница уклоњена
-pagesaved = Снимљено у Pocket
-processingremove = Уклањам страницу…
-processingtags = Додајем ознаку…
-removepage = Уклони страницу
-save = Сними
-saving = Снимам…
-signupemail = Региструј се са е-поштом
-signuptosave = Региструјте се да користите Pocket. Бесплатно је.
-suggestedtags = Предложене ознаке
-tagline = Снимите чланке и видео снимке из Firefox-а да бисте их погледали у Pocket-у на било ком уређају било када.
-taglinestory_one = Кликните на Pocket дугме да бисте снимили чланак, видео или страницу из Firefox-а.
-taglinestory_two = Погледајте садржај у Pocket-у на било ком уређају било када.
-tagssaved = Ознаке додате
-tos = Настављањем прихватате <a href="%1$S" target="_blank">услове коришћења</a> и <a href="%2$S" target="_blank">полису приватности</a> Pocket-а
-tryitnow = Покушајте сада
-signinfirefox = Пријави се
-signupfirefox = Региструј се
-viewlist = Прикажи листу
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Сними у Pocket
-saveToPocketCmd.label = Сними страницу у Pocket
-saveToPocketCmd.accesskey = С
-saveLinkToPocketCmd.label = Сними везу у Pocket
-saveLinkToPocketCmd.accesskey = в
-pocketMenuitem.label = Прикажи Pocket листу
diff --git a/browser/extensions/pocket/locale/sv-SE/pocket.properties b/browser/extensions/pocket/locale/sv-SE/pocket.properties
deleted file mode 100644
index e01ac7373c..0000000000
--- a/browser/extensions/pocket/locale/sv-SE/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Lägg till etiketter
-alreadyhaveacct = Redan en Pocket användare?
-continueff = Fortsätt med Firefox\u0020
-errorgeneric = Ett fel upptäcktes då du försökte spara till Pocket.
-learnmore = Läs mer
-loginnow = Logga in
-maxtaglength = Etiketter kan max vara 25 tecken
-mustbeconnected = Du måste vara ansluten till internet för att kunna spara till Pocket. Kontrollera din anslutning och försök igen.
-onlylinkssaved = Bara länkar kan sparas\u0020
-pagenotsaved = Sidan sparades inte\u0020
-pageremoved = Sidan borttagen
-pagesaved = Spara till Pocket\u0020
-processingremove = Tar bort sida…
-processingtags = Lägger till etiketter…
-removepage = Ta bort sida
-save = Spara
-saving = Sparar…
-signupemail = Registrera dig med din E-postadress
-signuptosave = Registrera dig för Pocket. Det är gratis.
-suggestedtags = Föreslagna etiketter
-tagline = Spara artiklar och videor från Firefox för att visa i Pocket på vilken enhet som helst, när som helst.
-taglinestory_one = Klicka på Pocket knappen för att spara vilken artikel, video eller sida som helst från Firefox.\u0020
-taglinestory_two = Visa i Pocket på vilken enhet som helst, när som helst.\u0020
-tagssaved = Etiketter Tillagda
-tos = Genom att fortsätta godkänner du Pocket's <a href="%1$S" target="_blank">användarvillkor</a> och <a href="%2$S" target="_blank">sekretesspolicy</a>
-tryitnow = Prova nu
-signinfirefox = Logga in med Firefox\u0020
-signupfirefox = Registrera dig med Firefox\u0020
-viewlist = Visa lista
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Spara till Pocket
-saveToPocketCmd.label = Spara sida till Pocket
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = Spara Länk till Pocket
-saveLinkToPocketCmd.accesskey = l
-pocketMenuitem.label = Visa Pocket Lista\u0020
diff --git a/browser/extensions/pocket/locale/te/pocket.properties b/browser/extensions/pocket/locale/te/pocket.properties
deleted file mode 100644
index 2e95527933..0000000000
--- a/browser/extensions/pocket/locale/te/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = టాగ్‌లను జోడించు
-alreadyhaveacct = ఇప్పటికే ఒక పాకెట్ యూజర్?
-continueff = ఫైర్ఫాక్స్ తో కొనసాగించుము
-errorgeneric = పాకెట్ కు సేవ్ చేయడానికి ప్రయత్నిస్తున్నప్పుడు లోపం ఉంది.
-learnmore = మరింత తెలుసుకోండి
-loginnow = లాగ్ ఇన్
-maxtaglength = టాగ్లు 25 అక్షరాలకు పరిమితం చేయబడ్డాయి
-mustbeconnected = మీరు పాకెట్ కు సేవ్ చేయడానికి ఇంటర్నెట్ కనెక్ట్ చేయక తప్పదు. మీ కనెక్షన్ను తనిఖీ చేసి, మళ్ళీ ప్రయత్నించండి.
-onlylinkssaved = కేవలం లింకులు సేవ్ చేయవచ్చు
-pagenotsaved = పేజీ సేవ్ చేయబడలేదు
-pageremoved = పేజీ తీసివేయబడెను
-pagesaved = పాకెట్ కు సేవ్ చేయబడింది
-processingremove = పేజీని తొలగించు…
-processingtags = టాగ్లు జోడిస్తోంది...
-removepage = పేజీని తొలగించు
-save = సేవ్ చేయి
-saving = సేవ్ చేస్తోంది...
-signupemail = ఇమెయిల్ తో సైన్అప్ అవ్వండ్
-signuptosave = పాకెట్ కోసం సైన్ అప్ చేయండి. ఇది ఉచితం.
-suggestedtags = సూచించిన టాగ్లు
-tagline = ఏ పరికరం, ఏ సమయం లో పాకెట్ వీక్షించడానికి Firefox నుండి వ్యాసాలు మరియు వీడియోలను సేవ్ చేయవచ్చు.
-taglinestory_one = ఫైర్ఫాక్సు నుండి ఒక వ్యాసం, వీడియో లేదా పేజీ సేవ్ పాకెట్ బటన్ క్లిక్ చేయండి.
-taglinestory_two = ఏ పరికరంలో అయినా, ఏ సమయంలో అయినా పాకెట్ లో చూడండి.
-tagssaved = టాగ్లు చేర్చబడింది
-tos = కొనసాగించడం ద్వారా, మీరు పాకెట్ యొక్క <a href="%1$S" target="_blank"> సేవా నిబంధనలు</a> మరియు <a href="%2$S" target="_blank"> గోప్యతా విధానము</a> ను అంగీకరిచబడుతారు
-tryitnow = దీన్ని ఇప్పుడు ప్రయత్నించండి
-signinfirefox = ఫైర్ఫాక్సుకు ప్రవేశించండి
-signupfirefox = ఫైర్ఫాక్సుకు ప్రవేశించండి
-viewlist = జాబితాను చూడండి
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = పాకెట్
-pocket-button.tooltiptext = పాకెట్ కు సేవ్ చేయండి
-saveToPocketCmd.label = పాకెట్ కు సేవ్ చేయండి
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = పాకెట్ కు లింక్ ను సేవ్ చేయండి
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = పాకెట్ జాబితా చూడండి
diff --git a/browser/extensions/pocket/locale/th/pocket.properties b/browser/extensions/pocket/locale/th/pocket.properties
deleted file mode 100644
index 6cdf1c9ecc..0000000000
--- a/browser/extensions/pocket/locale/th/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = เพิ่มป้ายกำกับ
-alreadyhaveacct = เป็นผู้ใช้ Pocket อยู่แล้ว?
-continueff = ดำเนินการต่อด้วย Firefox
-errorgeneric = เกิดข้อผิดพลาดระหว่างการบันทึกไปยัง Pocket
-learnmore = เรียนรู้เพิ่มเติม
-loginnow = เข้าสู่ระบบ
-maxtaglength = ป้ายกำกับถูกจำกัดไว้ที่ 25 ตัวอักษร
-mustbeconnected = คุณต้องเชื่อมต่อกับอินเทอร์เน็ตก่อนที่จะบันทึก Pocket โปรดตรวจสอบการเชื่อมต่อของคุณและลองอีกครั้ง
-onlylinkssaved = ลิงก์เท่านั้นที่สามารถถูกบันทึกได้
-pagenotsaved = หน้าไม่ถูกบันทึก
-pageremoved = ลบหน้าแล้ว
-pagesaved = บันทึกไปยัง Pocket
-processingremove = กำลังลบหน้า…
-processingtags = กำลังเพิ่มป้ายกำกับ…
-removepage = ลบหน้า
-save = บันทึก
-saving = กำลังบันทึก…
-signupemail = ลงทะเบียนด้วยอีเมล
-signuptosave = ไม่มีค่าใช้จ่ายในการลงทะเบียน Pocket
-suggestedtags = ป้ายกำกับที่ถูกแนะนำ
-tagline = บันทึกบทความและวิดีโอจาก Firefox เพื่อดูใน Pocket บนอุปกรณ์ต่าง ๆ เวลาไหนก็ได้
-taglinestory_one = คลิกปุ่ม Pocket เพื่อบันทึกบทความ วิดีโอ หรือหน้าจาก Firefox
-taglinestory_two = ดูใน Pocket บนอุปกรณ์ต่าง ๆ เวลาไหนก็ได้
-tagssaved = ป้ายกำกับถูกเพิ่มแล้ว
-tos = หากตกลง หมายความว่า คุณยอมรับ<a href="%1$S" target="_blank">เงื่อนไขการให้บริการ</a> และ<a href="%2$S" target="_blank">นโยบายความเป็นส่วนตัว</a>ของ Pocket
-tryitnow = ลองเลย
-signinfirefox = ลงชื่อเข้าด้วย Firefox
-signupfirefox = ลงทะเบียนกับ Firefox
-viewlist = ดูรายการ
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = บันทึกไปยัง Pocket
-saveToPocketCmd.label = บันทึกหน้าไปยัง Pocket
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = บันทึกลิงก์ไปยัง Pocket
-saveLinkToPocketCmd.accesskey = ป
-pocketMenuitem.label = ดูรายการ Pocket
diff --git a/browser/extensions/pocket/locale/tr/pocket.properties b/browser/extensions/pocket/locale/tr/pocket.properties
deleted file mode 100644
index ea1970a7d4..0000000000
--- a/browser/extensions/pocket/locale/tr/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Etiket ekle
-alreadyhaveacct = Zaten Pocket kullanıcısı mısınız?
-continueff = Firefox ile devam et
-errorgeneric = Pocket’a kaydetmeye çalışırken bir hata oluştu.
-learnmore = Daha fazla bilgi al
-loginnow = Giriş yapın
-maxtaglength = Etiketler en fazla 25 karakter olabilir
-mustbeconnected = Pocket’a kaydetmek için internete bağlı olmalısınız. Lütfen bağlantınızı kontrol edip yeniden deneyin.
-onlylinkssaved = Yalnızca bağlantılar kaydedilebilir
-pagenotsaved = Sayfa kaydedilmedi
-pageremoved = Sayfa silindi
-pagesaved = Pocket’a kaydedildi
-processingremove = Sayfa siliniyor…
-processingtags = Etiketler ekleniyor…
-removepage = Sayfayı sil
-save = Kaydet
-saving = Kaydediliyor…
-signupemail = E-postayla kaydol
-signuptosave = Pocket’a kaydolun. Ücretsiz!
-suggestedtags = Önerilen etiketler
-tagline = İstediğiniz cihazda, istediğiniz zaman görmek istediğiniz yazı ve videoları Firefox’tan Pocket’a kaydedin.
-taglinestory_one = Firefox’ta istediğiniz yazıyı, videoyu veya sayfayı kaydetmek için Pocket düğmesine tıklayın.
-taglinestory_two = İstediğiniz cihazda, istediğiniz zaman Pocket’tan bakın.
-tagssaved = Etiketler eklendi
-tos = Devam ederseniz Pocket'ın <a href="%1$S" target="_blank">Kullanım Koşullarını</a> ve <a href="%2$S" target="_blank">Gizlilik İlkelerini</a> kabul etmiş sayılırsınız
-tryitnow = Hemen deneyin
-signinfirefox = Firefox ile giriş yap
-signupfirefox = Firefox ile kaydol
-viewlist = Listeyi göster
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Pocket’a kaydet
-saveToPocketCmd.label = Sayfayı Pocket’a kaydet
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = Bağlantıyı Pocket’a kaydet
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = Pocket listesini göster
diff --git a/browser/extensions/pocket/locale/uk/pocket.properties b/browser/extensions/pocket/locale/uk/pocket.properties
deleted file mode 100644
index d15049b2ca..0000000000
--- a/browser/extensions/pocket/locale/uk/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = Додати мітки
-alreadyhaveacct = Вже використовуєте Pocket?
-continueff = Продовжити з Firefox
-errorgeneric = При спробі збереження в Pocket сталася помилка.
-learnmore = Докладніше
-loginnow = Увійти
-maxtaglength = Мітки мають обмеження до 25 символів
-mustbeconnected = Для можливості збереження в Pocket ви повинні бути підключені до Інтернету. Перевірте своє з'єднання і спробуйте знову.
-onlylinkssaved = Можна зберігати лише посилання
-pagenotsaved = Сторінку не збережено
-pageremoved = Сторінку вилучено
-pagesaved = Збережено в Pocket
-processingremove = Вилучення сторінки…
-processingtags = Додавання міток…
-removepage = Вилучити сторінку
-save = Зберегти
-saving = Збереження…
-signupemail = Реєстрація за адресою електронної пошти
-signuptosave = Зареєструйтеся в Pocket. Це безплатно.
-suggestedtags = Пропоновані мітки
-tagline = Зберігайте статті та відео з Firefox, щоб переглядати їх в Pocket на будь-якому пристрої та в будь-який час.
-taglinestory_one = Натисніть кнопку Pocket для збереження будь-якої статті, відео чи сторінки з Firefox.
-taglinestory_two = Переглядайте в Pocket на будь-якому пристрої та в будь-який час.
-tagssaved = Мітки додано
-tos = Продовжуючи, ви погоджуєтесь з <a href="%1$S" target="_blank">Умовами використання</a> і <a href="%2$S" target="_blank">Політикою приватності</a>
-tryitnow = Спробувати зараз
-signinfirefox = Увійти через Firefox
-signupfirefox = Реєстрація через Firefox
-viewlist = Перегляд списку
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = Зберегти в Pocket
-saveToPocketCmd.label = Зберегти сторінку в Pocket
-saveToPocketCmd.accesskey = З
-saveLinkToPocketCmd.label = Зберегти посилання в Pocket
-saveLinkToPocketCmd.accesskey = п
-pocketMenuitem.label = Перегляд списку Pocket
diff --git a/browser/extensions/pocket/locale/zh-CN/pocket.properties b/browser/extensions/pocket/locale/zh-CN/pocket.properties
deleted file mode 100644
index e913887b8d..0000000000
--- a/browser/extensions/pocket/locale/zh-CN/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = 添加标签
-alreadyhaveacct = 已有 Pocket 账号?
-continueff = 使用 Firefox 继续
-errorgeneric = 尝试保存到 Pocket 时出错。
-learnmore = 详细了解
-loginnow = 登录
-maxtaglength = 标签不能超过 25 个字符
-mustbeconnected = 您必须已连接互联网才能保存到 Pocket。请检查您的连接,然后再试。
-onlylinkssaved = 只有链接能被保存
-pagenotsaved = 页面未保存
-pageremoved = 页面已移除
-pagesaved = 已保存到 Pocket
-processingremove = 正在移除页面…
-processingtags = 正在添加标签…
-removepage = 移除页面
-save = 保存
-saving = 正在保存…
-signupemail = 通过电子邮件注册
-signuptosave = 免费注册 Pocket。
-suggestedtags = 推荐标签
-tagline = 在 Firefox 上保存文章和视频,以供在任何时间、任何设备上用 Pocket 访问。
-taglinestory_one = 点击 Pocket 按钮保存 Firefox 上的任何文章、视频或页面。
-taglinestory_two = 在任何时间、任何设备上的 Pocket 中查看。
-tagssaved = 标签已添加
-tos = 继续则表示您同意 Pocket 的<a href="%1$S" target="_blank">服务条款</a>和<a href="%2$S" target="_blank">隐私政策</a>
-tryitnow = 立即尝试
-signinfirefox = 使用 Firefox 登录
-signupfirefox = 使用 Firefox 注册
-viewlist = 查看列表
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = 保存到 Pocket
-saveToPocketCmd.label = 保存页面到 Pocket
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = 保存链接到 Pocket
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = 查看 Pocket 列表
diff --git a/browser/extensions/pocket/locale/zh-TW/pocket.properties b/browser/extensions/pocket/locale/zh-TW/pocket.properties
deleted file mode 100644
index 02cf5223ba..0000000000
--- a/browser/extensions/pocket/locale/zh-TW/pocket.properties
+++ /dev/null
@@ -1,43 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-addtags = 新增標籤
-alreadyhaveacct = 已經是 Pocket 使用者了嗎?
-continueff = 使用 Firefox 繼續
-errorgeneric = 嘗試儲存至 Pocket 時發生錯誤。
-learnmore = 更多資訊
-loginnow = 登入
-maxtaglength = 標籤僅能有 25 字元
-mustbeconnected = 您必須連線至網際網路才能儲存至 Pocket。請檢查您的連線狀態後再試一次。
-onlylinkssaved = 僅能儲存鏈結
-pagenotsaved = 未儲存頁面
-pageremoved = 已移除頁面
-pagesaved = 已儲存至 Pocket
-processingremove = 正在移除頁面…
-processingtags = 正在新增標籤…
-removepage = 移除頁面
-save = 儲存
-saving = 儲存中…
-signupemail = 使用電子郵件地址註冊
-signuptosave = 免費註冊 Pocket 帳號。
-suggestedtags = 建議的標籤
-tagline = 隨時隨地在任何裝置上的 Firefox 來儲存文章與影片,稍後再用 Pocket 開啟。
-taglinestory_one = 在 Firefox 中點擊 Pocket 按鈕來儲存任何文章、影片或網頁。
-taglinestory_two = 隨時隨地在任何裝置上用 Pocket 檢視。
-tagssaved = 已新增標籤
-tos = 繼續使用就代表您同意 Pocket 的 <a href="%1$S" target="_blank">服務條款</a> 及 <a href="%2$S" target="_blank">隱私權保護政策</a>
-tryitnow = 立刻試試
-signinfirefox = 使用 Firefox 登入
-signupfirefox = 使用 Firefox 註冊
-viewlist = 檢視清單
-
-# LOCALIZATION NOTE(pocket-button.label, pocket-button.tooltiptext, saveToPocketCmd.label, saveLinkToPocketCmd.label, pocketMenuitem.label):
-# "Pocket" is a brand name.
-pocket-button.label = Pocket
-pocket-button.tooltiptext = 儲存至 Pocket
-saveToPocketCmd.label = 將頁面儲存至 Pocket
-saveToPocketCmd.accesskey = k
-saveLinkToPocketCmd.label = 將鏈結儲存至 Pocket
-saveLinkToPocketCmd.accesskey = o
-pocketMenuitem.label = 檢視 Pocket 清單
diff --git a/browser/extensions/pocket/moz.build b/browser/extensions/pocket/moz.build
deleted file mode 100644
index 52227bb8b9..0000000000
--- a/browser/extensions/pocket/moz.build
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION']
-DEFINES['MOZ_APP_MAXVERSION'] = CONFIG['MOZ_APP_MAXVERSION']
-
-DIRS += ['locale']
-
-FINAL_TARGET_FILES.features['firefox@getpocket.com'] += [
- 'bootstrap.js'
-]
-
-FINAL_TARGET_PP_FILES.features['firefox@getpocket.com'] += [
- 'install.rdf.in'
-]
-
-JAR_MANIFESTS += ['jar.mn']
diff --git a/browser/extensions/pocket/skin/linux/Toolbar-inverted.png b/browser/extensions/pocket/skin/linux/Toolbar-inverted.png
deleted file mode 100644
index 68f5125eac..0000000000
--- a/browser/extensions/pocket/skin/linux/Toolbar-inverted.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/linux/Toolbar-inverted@2x.png b/browser/extensions/pocket/skin/linux/Toolbar-inverted@2x.png
deleted file mode 100644
index 89056295c8..0000000000
--- a/browser/extensions/pocket/skin/linux/Toolbar-inverted@2x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/linux/Toolbar.png b/browser/extensions/pocket/skin/linux/Toolbar.png
deleted file mode 100644
index be9b0e6d23..0000000000
--- a/browser/extensions/pocket/skin/linux/Toolbar.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/linux/Toolbar@2x.png b/browser/extensions/pocket/skin/linux/Toolbar@2x.png
deleted file mode 100644
index 5dc4e754a9..0000000000
--- a/browser/extensions/pocket/skin/linux/Toolbar@2x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/linux/menuPanel.png b/browser/extensions/pocket/skin/linux/menuPanel.png
deleted file mode 100644
index 55bc46cc96..0000000000
--- a/browser/extensions/pocket/skin/linux/menuPanel.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/linux/menuPanel@2x.png b/browser/extensions/pocket/skin/linux/menuPanel@2x.png
deleted file mode 100644
index ad13ca4ce7..0000000000
--- a/browser/extensions/pocket/skin/linux/menuPanel@2x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/linux/pocket.css b/browser/extensions/pocket/skin/linux/pocket.css
deleted file mode 100644
index 156964923f..0000000000
--- a/browser/extensions/pocket/skin/linux/pocket.css
+++ /dev/null
@@ -1,10 +0,0 @@
-@import url("chrome://pocket-shared/skin/pocket.css");
-
-#nav-bar #pocket-button > .toolbarbutton-icon {
- padding: 2px 6px;
-}
-
-:-moz-any(#TabsToolbar, .widget-overflow-list) #pocket-button > .toolbarbutton-icon {
- max-width: 18px;
- padding: 0;
-} \ No newline at end of file
diff --git a/browser/extensions/pocket/skin/osx/Toolbar-inverted.png b/browser/extensions/pocket/skin/osx/Toolbar-inverted.png
deleted file mode 100644
index 0f4d57b4e5..0000000000
--- a/browser/extensions/pocket/skin/osx/Toolbar-inverted.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/osx/Toolbar-inverted@2x.png b/browser/extensions/pocket/skin/osx/Toolbar-inverted@2x.png
deleted file mode 100644
index 03c3b42d5d..0000000000
--- a/browser/extensions/pocket/skin/osx/Toolbar-inverted@2x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/osx/Toolbar-yosemite.png b/browser/extensions/pocket/skin/osx/Toolbar-yosemite.png
deleted file mode 100644
index 28602b1866..0000000000
--- a/browser/extensions/pocket/skin/osx/Toolbar-yosemite.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/osx/Toolbar-yosemite@2x.png b/browser/extensions/pocket/skin/osx/Toolbar-yosemite@2x.png
deleted file mode 100644
index 53040cb464..0000000000
--- a/browser/extensions/pocket/skin/osx/Toolbar-yosemite@2x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/osx/Toolbar.png b/browser/extensions/pocket/skin/osx/Toolbar.png
deleted file mode 100644
index 1a8d7a51c5..0000000000
--- a/browser/extensions/pocket/skin/osx/Toolbar.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/osx/Toolbar@2x.png b/browser/extensions/pocket/skin/osx/Toolbar@2x.png
deleted file mode 100644
index 91bf3ef6f2..0000000000
--- a/browser/extensions/pocket/skin/osx/Toolbar@2x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/osx/menuPanel-yosemite.png b/browser/extensions/pocket/skin/osx/menuPanel-yosemite.png
deleted file mode 100644
index 30b475cc09..0000000000
--- a/browser/extensions/pocket/skin/osx/menuPanel-yosemite.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/osx/menuPanel-yosemite@2x.png b/browser/extensions/pocket/skin/osx/menuPanel-yosemite@2x.png
deleted file mode 100644
index 389d96ec76..0000000000
--- a/browser/extensions/pocket/skin/osx/menuPanel-yosemite@2x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/osx/menuPanel.png b/browser/extensions/pocket/skin/osx/menuPanel.png
deleted file mode 100644
index d2bf618882..0000000000
--- a/browser/extensions/pocket/skin/osx/menuPanel.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/osx/menuPanel@2x.png b/browser/extensions/pocket/skin/osx/menuPanel@2x.png
deleted file mode 100644
index f58afbc4da..0000000000
--- a/browser/extensions/pocket/skin/osx/menuPanel@2x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/osx/pocket.css b/browser/extensions/pocket/skin/osx/pocket.css
deleted file mode 100644
index 534a881a58..0000000000
--- a/browser/extensions/pocket/skin/osx/pocket.css
+++ /dev/null
@@ -1,42 +0,0 @@
-@import url("chrome://pocket-shared/skin/pocket.css");
-
-#pocket-button[cui-areatype="toolbar"] > .toolbarbutton-icon {
- max-width: 18px;
- margin: 0;
-}
-
-#pocket-button[cui-areatype="toolbar"][open] {
- -moz-image-region: rect(36px, 18px, 54px, 0);
-}
-
-@media (min-resolution: 2dppx) {
- #panelMenu_pocket,
- #menu_pocket,
- #BMB_pocket {
- list-style-image: url("chrome://pocket/content/panels/img/pocketmenuitem16@2x.png");
- }
-
- #panelMenu_pocket > .toolbarbutton-icon {
- width: 16px;
- }
-}
-
-@media not all and (min-resolution: 1.1dppx) {
- #pocket-button:hover:active:not([disabled="true"]):not([cui-areatype="menu-panel"]) {
- -moz-image-region: rect(18px, 18px, 36px, 0);
- }
-}
-
-@media (min-resolution: 1.1dppx) {
- #pocket-button[cui-areatype="toolbar"][open] {
- -moz-image-region: rect(72px, 36px, 108px, 0);
- }
-
- #pocket-button:hover:active:not([disabled="true"]):not([cui-areatype="menu-panel"]) {
- -moz-image-region: rect(36px, 36px, 72px, 0);
- }
-}
-
-#PanelUI-pocketView[mainview=true] > .panel-subview-body > #pocket-panel-iframe {
- border-radius: var(--arrowpanel-border-radius);
-}
diff --git a/browser/extensions/pocket/skin/shared/pocket.css b/browser/extensions/pocket/skin/shared/pocket.css
deleted file mode 100644
index ec46e18905..0000000000
--- a/browser/extensions/pocket/skin/shared/pocket.css
+++ /dev/null
@@ -1,79 +0,0 @@
-/* Bug 1164419 - increase Pocket panel size to accomidate wider Russian text. */
-panelmultiview[mainViewId=PanelUI-pocketView] > .panel-viewcontainer > .panel-viewstack > .panel-mainview:not([panelid="PanelUI-popup"]) {
- max-width: 33em; /* standaloneSubviewWidth + 3 */
-}
-
-.cui-widget-panel[viewId="PanelUI-pocketView"] > .panel-arrowcontainer > .panel-arrowcontent {
- padding-top: 0;
- padding-bottom: 0;
-}
-
-#PanelUI-pocketView > .panel-subview-body,
-#PanelUI-pocketView {
- overflow: visible;
-}
-
-#pocket-button {
- list-style-image: url("chrome://pocket/skin/Toolbar.png");
- -moz-image-region: rect(0, 18px, 18px, 0);
-}
-
-toolbar[brighttext] #pocket-button {
- list-style-image: url(chrome://pocket/skin/Toolbar-inverted.png);
-}
-
-@media not all and (min-resolution: 1.1dppx) {
- #pocket-button[cui-areatype="menu-panel"],
- toolbarpaletteitem[place="palette"] > #pocket-button {
- list-style-image: url(chrome://pocket/skin/menuPanel.png);
- -moz-image-region: rect(0, 32px, 32px, 0);
- }
-
- #pocket-button[cui-areatype="menu-panel"][panel-multiview-anchor=true] {
- -moz-image-region: rect(32px, 32px, 64px, 0);
- }
-}
-
-@media (min-resolution: 1.1dppx) {
- #pocket-button[cui-areatype="menu-panel"],
- toolbarpaletteitem[place="palette"] > #pocket-button {
- list-style-image: url(chrome://pocket/skin/menuPanel@2x.png);
- -moz-image-region: rect(0px, 64px, 64px, 0);
- }
-
- #pocket-button[cui-areatype="menu-panel"][panel-multiview-anchor=true] {
- -moz-image-region: rect(64px, 64px, 128px, 0);
- }
-}
-
-#pocket-button[cui-areatype="toolbar"] {
- -moz-image-region: rect(0, 18px, 18px, 0);
-}
-
-#pocket-button[cui-areatype="toolbar"][open] {
- -moz-image-region: rect(18px, 18px, 36px, 0);
-}
-
-@media (min-resolution: 1.1dppx) {
- #pocket-button {
- list-style-image: url("chrome://pocket/skin/Toolbar@2x.png");
- }
-
- toolbar[brighttext] #pocket-button {
- list-style-image: url("chrome://pocket/skin/Toolbar-inverted@2x.png");
- }
-
- #pocket-button[cui-areatype="toolbar"] {
- -moz-image-region: rect(0, 36px, 36px, 0px);
- }
-
- #pocket-button[cui-areatype="toolbar"][open] {
- -moz-image-region: rect(36px, 36px, 72px, 0px);
- }
-}
-
-#panelMenu_pocket,
-#menu_pocket,
-#BMB_pocket {
- list-style-image: url("chrome://pocket/content/panels/img/pocketmenuitem16.png");
-}
diff --git a/browser/extensions/pocket/skin/windows/Toolbar-XP.png b/browser/extensions/pocket/skin/windows/Toolbar-XP.png
deleted file mode 100644
index 9220a207fa..0000000000
--- a/browser/extensions/pocket/skin/windows/Toolbar-XP.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/windows/Toolbar-aero.png b/browser/extensions/pocket/skin/windows/Toolbar-aero.png
deleted file mode 100644
index 7b373acb97..0000000000
--- a/browser/extensions/pocket/skin/windows/Toolbar-aero.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/windows/Toolbar-aero@2x.png b/browser/extensions/pocket/skin/windows/Toolbar-aero@2x.png
deleted file mode 100644
index 6e83dcc60a..0000000000
--- a/browser/extensions/pocket/skin/windows/Toolbar-aero@2x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/windows/Toolbar-inverted.png b/browser/extensions/pocket/skin/windows/Toolbar-inverted.png
deleted file mode 100644
index 70e95f464b..0000000000
--- a/browser/extensions/pocket/skin/windows/Toolbar-inverted.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/windows/Toolbar-inverted@2x.png b/browser/extensions/pocket/skin/windows/Toolbar-inverted@2x.png
deleted file mode 100644
index ba0b7e2af7..0000000000
--- a/browser/extensions/pocket/skin/windows/Toolbar-inverted@2x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/windows/Toolbar-lunaSilver.png b/browser/extensions/pocket/skin/windows/Toolbar-lunaSilver.png
deleted file mode 100644
index 5afe7ca44a..0000000000
--- a/browser/extensions/pocket/skin/windows/Toolbar-lunaSilver.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/windows/Toolbar-win8.png b/browser/extensions/pocket/skin/windows/Toolbar-win8.png
deleted file mode 100644
index 208dc03ae8..0000000000
--- a/browser/extensions/pocket/skin/windows/Toolbar-win8.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/windows/Toolbar-win8@2x.png b/browser/extensions/pocket/skin/windows/Toolbar-win8@2x.png
deleted file mode 100644
index 3704f08851..0000000000
--- a/browser/extensions/pocket/skin/windows/Toolbar-win8@2x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/windows/Toolbar.png b/browser/extensions/pocket/skin/windows/Toolbar.png
deleted file mode 100644
index 4801961f8d..0000000000
--- a/browser/extensions/pocket/skin/windows/Toolbar.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/windows/Toolbar@2x.png b/browser/extensions/pocket/skin/windows/Toolbar@2x.png
deleted file mode 100644
index f3a1cc738b..0000000000
--- a/browser/extensions/pocket/skin/windows/Toolbar@2x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/windows/menuPanel-aero.png b/browser/extensions/pocket/skin/windows/menuPanel-aero.png
deleted file mode 100644
index 459e826349..0000000000
--- a/browser/extensions/pocket/skin/windows/menuPanel-aero.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/windows/menuPanel-aero@2x.png b/browser/extensions/pocket/skin/windows/menuPanel-aero@2x.png
deleted file mode 100644
index eef525741f..0000000000
--- a/browser/extensions/pocket/skin/windows/menuPanel-aero@2x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/windows/menuPanel.png b/browser/extensions/pocket/skin/windows/menuPanel.png
deleted file mode 100644
index 55bc46cc96..0000000000
--- a/browser/extensions/pocket/skin/windows/menuPanel.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/windows/menuPanel@2x.png b/browser/extensions/pocket/skin/windows/menuPanel@2x.png
deleted file mode 100644
index ad13ca4ce7..0000000000
--- a/browser/extensions/pocket/skin/windows/menuPanel@2x.png
+++ /dev/null
Binary files differ
diff --git a/browser/extensions/pocket/skin/windows/pocket.css b/browser/extensions/pocket/skin/windows/pocket.css
deleted file mode 100644
index 011b821a91..0000000000
--- a/browser/extensions/pocket/skin/windows/pocket.css
+++ /dev/null
@@ -1,16 +0,0 @@
-@import url("chrome://pocket-shared/skin/pocket.css");
-
-#nav-bar #pocket-button > .toolbarbutton-icon {
- padding: calc(var(--toolbarbutton-vertical-inner-padding)) 6px;
-}
-
-:-moz-any(#TabsToolbar, .widget-overflow-list) #pocket-button > .toolbarbutton-icon {
- max-width: 18px;
- padding: 0;
-}
-
-@media (-moz-windows-theme: luna-silver) and (max-resolution: 1dppx) {
- #pocket-button {
- list-style-image: url(Toolbar-lunaSilver.png);
- }
-}
diff --git a/browser/extensions/webcompat/bootstrap.js b/browser/extensions/webcompat/bootstrap.js
deleted file mode 100644
index 19141a0f5c..0000000000
--- a/browser/extensions/webcompat/bootstrap.js
+++ /dev/null
@@ -1,9 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-"use strict";
-function startup() {}
-function shutdown() {}
-function install() {}
-function uninstall() {}
diff --git a/browser/extensions/webcompat/install.rdf.in b/browser/extensions/webcompat/install.rdf.in
deleted file mode 100644
index 2c4406f257..0000000000
--- a/browser/extensions/webcompat/install.rdf.in
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-<!-- This Source Code Form is subject to the terms of the Mozilla Public
- - License, v. 2.0. If a copy of the MPL was not distributed with this
- - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-
-#filter substitution
-
-<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:em="http://www.mozilla.org/2004/em-rdf#">
-
- <Description about="urn:mozilla:install-manifest">
- <em:id>webcompat@mozilla.org</em:id>
- <em:version>1.0</em:version>
- <em:type>2</em:type>
- <em:bootstrap>true</em:bootstrap>
- <em:multiprocessCompatible>true</em:multiprocessCompatible>
-
- <!-- Target Application this extension can install into,
- with minimum and maximum supported versions. -->
- <em:targetApplication>
- <Description>
- <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
- <em:minVersion>@MOZ_APP_VERSION@</em:minVersion>
- <em:maxVersion>@MOZ_APP_MAXVERSION@</em:maxVersion>
- </Description>
- </em:targetApplication>
-
- <!-- Front End MetaData -->
- <em:name>Web Compat</em:name>
- <em:description>Urgent post-release fixes for web compatibility.</em:description>
- </Description>
-</RDF>
diff --git a/browser/extensions/webcompat/moz.build b/browser/extensions/webcompat/moz.build
deleted file mode 100644
index 7d592013bd..0000000000
--- a/browser/extensions/webcompat/moz.build
+++ /dev/null
@@ -1,16 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-DEFINES['MOZ_APP_VERSION'] = CONFIG['MOZ_APP_VERSION']
-DEFINES['MOZ_APP_MAXVERSION'] = CONFIG['MOZ_APP_MAXVERSION']
-
-FINAL_TARGET_FILES.features['webcompat@mozilla.org'] += [
- 'bootstrap.js'
-]
-
-FINAL_TARGET_PP_FILES.features['webcompat@mozilla.org'] += [
- 'install.rdf.in'
-]
diff --git a/browser/fonts/EmojiOneMozilla.ttf b/browser/fonts/EmojiOneMozilla.ttf
deleted file mode 100644
index 50356509db..0000000000
--- a/browser/fonts/EmojiOneMozilla.ttf
+++ /dev/null
Binary files differ
diff --git a/browser/fonts/README.txt b/browser/fonts/README.txt
index 188ea3fff2..ac1f6d9de2 100644
--- a/browser/fonts/README.txt
+++ b/browser/fonts/README.txt
@@ -1,9 +1,9 @@
-EmojiOne Mozilla
+Twemoji Mozilla
================
-The upstream repository of EmojiOne Mozilla can be found at
+The upstream repository of Twemoji Mozilla can be found at
- https://github.com/mozilla/emojione-colr
+ https://github.com/mozilla/twemoji-colr
Please refer commit history for the current version of the font.
This file purposely omit the version, so there is no need to update it here.
diff --git a/browser/fonts/TwemojiMozilla.ttf b/browser/fonts/TwemojiMozilla.ttf
new file mode 100644
index 0000000000..1933891d99
--- /dev/null
+++ b/browser/fonts/TwemojiMozilla.ttf
Binary files differ
diff --git a/browser/fonts/moz.build b/browser/fonts/moz.build
index b1a43e528e..5cb98333b2 100644
--- a/browser/fonts/moz.build
+++ b/browser/fonts/moz.build
@@ -7,5 +7,5 @@
if CONFIG['OS_ARCH'] in ('WINNT', 'Linux'):
DIST_SUBDIR = ''
FINAL_TARGET_FILES.fonts += [
- 'EmojiOneMozilla.ttf'
+ 'TwemojiMozilla.ttf'
]
diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in
index 015daa8c7d..5540feed9e 100644
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -374,8 +374,6 @@
@RESPATH@/browser/components/devtools-startup.js
@RESPATH@/browser/components/webideCli.js
@RESPATH@/browser/components/webideComponents.manifest
-@RESPATH@/browser/components/Experiments.manifest
-@RESPATH@/browser/components/ExperimentsService.js
@RESPATH@/browser/components/browser-newtab.xpt
@RESPATH@/browser/components/aboutNewTabService.js
@RESPATH@/browser/components/NewTabComponents.manifest
@@ -781,28 +779,6 @@ bin/libfreebl_32int64_3.so
@BINPATH@/maintenanceservice_installer.exe
#endif
-; [Crash Reporter]
-;
-#ifdef MOZ_CRASHREPORTER
-@RESPATH@/components/CrashService.manifest
-@RESPATH@/components/CrashService.js
-@RESPATH@/components/toolkit_crashservice.xpt
-#ifdef XP_MACOSX
-@BINPATH@/crashreporter.app/
-#else
-@BINPATH@/crashreporter@BIN_SUFFIX@
-@BINPATH@/minidump-analyzer@BIN_SUFFIX@
-@RESPATH@/crashreporter.ini
-#ifdef XP_UNIX
-@RESPATH@/Throbber-small.gif
-#endif
-#endif
-@RESPATH@/browser/crashreporter-override.ini
-#ifdef MOZ_CRASHREPORTER_INJECTOR
-@BINPATH@/breakpadinjector.dll
-#endif
-#endif
-
@RESPATH@/components/dom_audiochannel.xpt
; Shutdown Terminator
diff --git a/browser/locales/Makefile.in b/browser/locales/Makefile.in
index b3ecfd3594..b8aee0f146 100644
--- a/browser/locales/Makefile.in
+++ b/browser/locales/Makefile.in
@@ -61,10 +61,10 @@ STUB_HOOK = $(NSINSTALL) -D '$(ABS_DIST)/$(PKG_INST_PATH)'; \
$(NULL)
endif
-SEARCHPLUGINS_FILENAMES := $(shell $(call py_action,output_searchplugins_list,$(srcdir)/search/list.json $(AB_CD)))
+SEARCHPLUGINS_FILENAMES := $(or $(shell $(call py_action,output_searchplugins_list,$(srcdir)/search/list.json $(AB_CD))), $(error Missing search plugins))
SEARCHPLUGINS_PATH := .deps/generated_$(AB_CD)
SEARCHPLUGINS_TARGET := libs searchplugins
-SEARCHPLUGINS := $(foreach plugin,$(addsuffix .xml,$(SEARCHPLUGINS_FILENAMES)),$(or $(wildcard $(srcdir)/searchplugins/$(plugin)),$(warning Missing searchplugin: $(plugin))))
+SEARCHPLUGINS := $(foreach plugin,$(addsuffix .xml,$(SEARCHPLUGINS_FILENAMES)),$(or $(wildcard $(srcdir)/searchplugins/$(plugin)),$(error Missing searchplugin: $(plugin))))
# Some locale-specific search plugins may have preprocessor directives, but the
# default en-US ones do not.
SEARCHPLUGINS_FLAGS := --silence-missing-directive-warnings
@@ -165,11 +165,6 @@ else
endif
endif
-ifdef MOZ_CRASHREPORTER
-libs:: crashreporter-override.ini
- $(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)
-endif
-
ident:
@printf 'fx_revision '
@$(PYTHON) $(topsrcdir)/config/printconfigsetting.py \
diff --git a/browser/locales/en-US/chrome/browser/preferences/cookies.dtd b/browser/locales/en-US/chrome/browser/preferences/cookies.dtd
index 9dfafffa53..5e7df9609a 100644
--- a/browser/locales/en-US/chrome/browser/preferences/cookies.dtd
+++ b/browser/locales/en-US/chrome/browser/preferences/cookies.dtd
@@ -7,13 +7,6 @@
<!ENTITY cookiesonsystem.label "The following cookies are stored on your computer:">
<!ENTITY cookiename.label "Cookie Name">
<!ENTITY cookiedomain.label "Site">
-<!-- LOCALIZATION NOTE (button.removeSelectedCookies.accesskey):
- The label associated with this accesskey can be found in
- preferences.properties as removeSelectedCookies.
--->
-<!ENTITY button.removeSelectedCookies.accesskey "R">
-<!ENTITY button.removeAllCookies.label "Remove All">
-<!ENTITY button.removeAllCookies.accesskey "A">
<!ENTITY props.name.label "Name:">
<!ENTITY props.value.label "Content:">
diff --git a/browser/locales/en-US/chrome/browser/preferences/preferences.properties b/browser/locales/en-US/chrome/browser/preferences/preferences.properties
index bf9ac602bc..da40f40a9b 100644
--- a/browser/locales/en-US/chrome/browser/preferences/preferences.properties
+++ b/browser/locales/en-US/chrome/browser/preferences/preferences.properties
@@ -21,7 +21,7 @@ acceptVeryLargeMinimumFont=Keep my changes anyway
trackingprotectionpermissionstext=You have disabled Tracking Protection on these sites.
trackingprotectionpermissionstitle=Exceptions - Tracking Protection
-cookiepermissionstext=You can specify which websites are always or never allowed to use cookies. Type the exact address of the site you want to manage and then click Block, Allow for Session, or Allow.
+cookiepermissionstext=You can specify which websites are always or never allowed to use cookies. Type the exact address of the site you want to manage and then click Block, Allow for Session, or Allow.
cookiepermissionstitle=Exceptions - Cookies
addonspermissionstext=You can specify which websites are allowed to install add-ons. Type the exact address of the site you want to allow and then click Allow.
addons_permissions_title=Allowed Sites - Add-ons Installation
@@ -123,6 +123,18 @@ cannot=Block
noCookieSelected=<no cookie selected>
cookiesAll=The following cookies are stored on your computer:
cookiesFiltered=The following cookies match your search:
+
+# LOCALIZATION NOTE (removeAllCookies, removeAllShownCookies):
+# removeAllCookies and removeAllShownCookies are both used on the same one button,
+# never displayed together and can share the same accesskey.
+# When only partial cookies are shown as a result of keyword search,
+# removeAllShownCookies is displayed as button label.
+# removeAllCookies is displayed when no keyword search and all cookies are shown.
+removeAllCookies.label=Remove All
+removeAllCookies.accesskey=A
+removeAllShownCookies.label=Remove All Shown
+removeAllShownCookies.accesskey=A
+
# LOCALIZATION NOTE (removeSelectedCookies):
# Semicolon-separated list of plural forms. See:
# http://developer.mozilla.org/en/docs/Localization_and_Plurals
@@ -130,13 +142,15 @@ cookiesFiltered=The following cookies match your search:
# you can use #1 in your localization as a placeholder for the number.
# For example this is the English string with numbers:
# removeSelectedCookied=Remove #1 Selected;Remove #1 Selected
-removeSelectedCookies=Remove Selected;Remove Selected
+removeSelectedCookies.label=Remove Selected;Remove Selected
+removeSelectedCookies.accesskey=R
+
defaultUserContextLabel=None
#### Offline apps
offlineAppsList.height=7em
offlineAppRemoveTitle=Remove offline website data
-offlineAppRemovePrompt=After removing this data, %S will not be available offline. Are you sure you want to remove this offline website?
+offlineAppRemovePrompt=After removing this data, %S will not be available offline. Are you sure you want to remove this offline website?
offlineAppRemoveConfirm=Remove offline data
# LOCALIZATION NOTE: The next string is for the disk usage of the
diff --git a/browser/locales/en-US/firefox-l10n.js b/browser/locales/en-US/firefox-l10n.js
index c1e5510f30..642ad6534a 100644
--- a/browser/locales/en-US/firefox-l10n.js
+++ b/browser/locales/en-US/firefox-l10n.js
@@ -4,8 +4,4 @@
#filter substitution
-# LOCALIZATION NOTE: this preference is set to true for en-US specifically,
-# locales without this line have the setting set to false by default.
-pref("browser.search.geoSpecificDefaults", true);
-
pref("general.useragent.locale", "@AB_CD@");
diff --git a/browser/locales/search/list.json b/browser/locales/search/list.json
index 9f7d82b4e1..722f3186f1 100644
--- a/browser/locales/search/list.json
+++ b/browser/locales/search/list.json
@@ -5,36 +5,6 @@
]
},
"regionOverrides": {
- "US": {
- "google": "google-nocodes"
- },
- "CA": {
- "google": "google-nocodes"
- },
- "KZ": {
- "google": "google-nocodes"
- },
- "BY": {
- "google": "google-nocodes"
- },
- "RU": {
- "google": "google-nocodes"
- },
- "TR": {
- "google": "google-nocodes"
- },
- "UA": {
- "google": "google-nocodes"
- },
- "CN": {
- "google": "google-nocodes"
- },
- "TW": {
- "google": "google-nocodes"
- },
- "HK": {
- "google": "google-nocodes"
- }
},
"locales": {
"en-US": {
diff --git a/browser/modules/AboutHome.jsm b/browser/modules/AboutHome.jsm
index 01cbafba99..639194c20c 100644
--- a/browser/modules/AboutHome.jsm
+++ b/browser/modules/AboutHome.jsm
@@ -24,17 +24,10 @@ XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
XPCOMUtils.defineLazyModuleGetter(this, "Promise",
"resource://gre/modules/Promise.jsm");
-// Url to fetch snippets, in the urlFormatter service format.
-const SNIPPETS_URL_PREF = "browser.aboutHomeSnippets.updateUrl";
-
-// Should be bumped up if the snippets content format changes.
-const STARTPAGE_VERSION = 4;
+// Should be bumped up if any data content format changes.
+const STARTPAGE_VERSION = 5;
this.AboutHomeUtils = {
- get snippetsVersion() {
- return STARTPAGE_VERSION;
- },
-
/*
* showKnowYourRights - Determines if the user should be shown the
* about:rights notification. The notification should *not* be shown if
@@ -54,7 +47,7 @@ this.AboutHomeUtils = {
return !Services.prefs.getBoolPref("browser.EULA.override");
} catch (e) { }
- if (!AppConstants.MOZILLA_OFFICIAL) {
+ if (!AppConstants.MC_OFFICIAL) {
// Non-official builds shouldn't show the notification.
return false;
}
@@ -77,16 +70,6 @@ this.AboutHomeUtils = {
};
/**
- * Returns the URL to fetch snippets from, in the urlFormatter service format.
- */
-XPCOMUtils.defineLazyGetter(AboutHomeUtils, "snippetsURL", function() {
- let updateURL = Services.prefs
- .getCharPref(SNIPPETS_URL_PREF)
- .replace("%STARTPAGE_VERSION%", STARTPAGE_VERSION);
- return Services.urlFormatter.formatURL(updateURL);
-});
-
-/**
* This code provides services to the about:home page. Whenever
* about:home needs to do something chrome-privileged, it sends a
* message that's handled here.
@@ -169,9 +152,7 @@ var AboutHome = {
ss.promiseInitialized.then(function() {
let data = {
showRestoreLastSession: ss.canRestoreLastSession,
- snippetsURL: AboutHomeUtils.snippetsURL,
- showKnowYourRights: AboutHomeUtils.showKnowYourRights,
- snippetsVersion: AboutHomeUtils.snippetsVersion,
+ showKnowYourRights: AboutHomeUtils.showKnowYourRights
};
if (AboutHomeUtils.showKnowYourRights) {
diff --git a/browser/modules/ContentCrashHandlers.jsm b/browser/modules/ContentCrashHandlers.jsm
index 2f755d142d..488cc4f265 100644
--- a/browser/modules/ContentCrashHandlers.jsm
+++ b/browser/modules/ContentCrashHandlers.jsm
@@ -90,8 +90,6 @@ this.TabCrashHandler = {
Services.telemetry
.getHistogramById("FX_CONTENT_CRASH_DUMP_UNAVAILABLE")
.add(1);
- } else if (AppConstants.MOZ_CRASHREPORTER) {
- this.childMap.set(childID, dumpID);
}
if (!this.flushCrashedBrowserQueue(childID)) {
@@ -115,15 +113,6 @@ this.TabCrashHandler = {
}
}
- // check for environment affecting crash reporting
- let env = Cc["@mozilla.org/process/environment;1"]
- .getService(Ci.nsIEnvironment);
- let shutdown = env.exists("MOZ_CRASHREPORTER_SHUTDOWN");
-
- if (shutdown) {
- Services.startup.quit(Ci.nsIAppStartup.eForceQuit);
- }
-
break;
}
case "oop-frameloader-crashed": {
@@ -306,105 +295,10 @@ this.TabCrashHandler = {
/**
* Submits a crash report from about:tabcrashed, if the crash
* reporter is enabled and a crash report can be found.
- *
- * @param aBrowser
- * The <xul:browser> that the report was sent from.
- * @param aFormData
- * An Object with the following properties:
- *
- * includeURL (bool):
- * Whether to include the URL that the user was on
- * in the crashed tab before the crash occurred.
- * URL (String)
- * The URL that the user was on in the crashed tab
- * before the crash occurred.
- * emailMe (bool):
- * Whether or not to include the user's email address
- * in the crash report.
- * email (String):
- * The email address of the user.
- * comments (String):
- * Any additional comments from the user.
- *
- * Note that it is expected that all properties are set,
- * even if they are empty.
*/
maybeSendCrashReport(message) {
- if (!AppConstants.MOZ_CRASHREPORTER) {
- return;
- }
-
- if (!message.data.hasReport) {
- // There was no report, so nothing to do.
- return;
- }
-
- let browser = message.target.browser;
-
- if (message.data.autoSubmit) {
- // The user has opted in to autosubmitted backlogged
- // crash reports in the future.
- UnsubmittedCrashHandler.autoSubmit = true;
- }
-
- let childID = this.browserMap.get(browser.permanentKey);
- let dumpID = this.childMap.get(childID);
- if (!dumpID) {
- return;
- }
-
- if (!message.data.sendReport) {
- Services.telemetry.getHistogramById("FX_CONTENT_CRASH_NOT_SUBMITTED").add(1);
- this.prefs.setBoolPref("sendReport", false);
- return;
- }
-
- let {
- includeURL,
- comments,
- email,
- emailMe,
- URL,
- } = message.data;
-
- let extraExtraKeyVals = {
- "Comments": comments,
- "Email": email,
- "URL": URL,
- };
-
- // For the entries in extraExtraKeyVals, we only want to submit the
- // extra data values where they are not the empty string.
- for (let key in extraExtraKeyVals) {
- let val = extraExtraKeyVals[key].trim();
- if (!val) {
- delete extraExtraKeyVals[key];
- }
- }
-
- // URL is special, since it's already been written to extra data by
- // default. In order to make sure we don't send it, we overwrite it
- // with the empty string.
- if (!includeURL) {
- extraExtraKeyVals["URL"] = "";
- }
-
- CrashSubmit.submit(dumpID, {
- recordSubmission: true,
- extraExtraKeyVals,
- }).then(null, Cu.reportError);
-
- this.prefs.setBoolPref("sendReport", true);
- this.prefs.setBoolPref("includeURL", includeURL);
- this.prefs.setBoolPref("emailMe", emailMe);
- if (emailMe) {
- this.prefs.setCharPref("email", email);
- } else {
- this.prefs.setCharPref("email", "");
- }
-
- this.childMap.set(childID, null); // Avoid resubmission.
- this.removeSubmitCheckboxesForSameCrash(childID);
+ /*** STUB ***/
+ return;
},
removeSubmitCheckboxesForSameCrash: function(childID) {
@@ -518,17 +412,10 @@ this.TabCrashHandler = {
/**
* For some <xul:browser>, return a crash report dump ID for that browser
* if we have been informed of one. Otherwise, return null.
- *
- * @param browser (<xul:browser)
- * The browser to try to get the dump ID for
- * @returns dumpID (String)
*/
getDumpID(browser) {
- if (!AppConstants.MOZ_CRASHREPORTER) {
- return null;
- }
-
- return this.childMap.get(this.browserMap.get(browser.permanentKey));
+ /*** STUB ***/
+ return null;
},
}
diff --git a/browser/modules/ContentWebRTC.jsm b/browser/modules/ContentWebRTC.jsm
index bfb98a868a..fd50176a03 100644
--- a/browser/modules/ContentWebRTC.jsm
+++ b/browser/modules/ContentWebRTC.jsm
@@ -208,6 +208,7 @@ function prompt(aContentWindow, aWindowID, aCallID, aConstraints, aDevices, aSec
let request = {
callID: aCallID,
windowID: aWindowID,
+ origin: aContentWindow.origin,
documentURI: aContentWindow.document.documentURI,
secure: aSecure,
requestTypes: requestTypes,
diff --git a/browser/modules/PluginContent.jsm b/browser/modules/PluginContent.jsm
index 1bbfa9a505..622d608bcb 100644
--- a/browser/modules/PluginContent.jsm
+++ b/browser/modules/PluginContent.jsm
@@ -660,30 +660,8 @@ PluginContent.prototype = {
},
submitReport: function submitReport(plugin) {
- if (!AppConstants.MOZ_CRASHREPORTER) {
- return;
- }
- if (!plugin) {
- Cu.reportError("Attempted to submit crash report without an associated plugin.");
- return;
- }
- if (!(plugin instanceof Ci.nsIObjectLoadingContent)) {
- Cu.reportError("Attempted to submit crash report on plugin that does not" +
- "implement nsIObjectLoadingContent.");
- return;
- }
-
- let runID = plugin.runID;
- let submitURLOptIn = this.getPluginUI(plugin, "submitURLOptIn").checked;
- let keyVals = {};
- let userComment = this.getPluginUI(plugin, "submitComment").value.trim();
- if (userComment)
- keyVals.PluginUserComment = userComment;
- if (submitURLOptIn)
- keyVals.PluginContentURL = plugin.ownerDocument.URL;
-
- this.global.sendAsyncMessage("PluginContent:SubmitReport",
- { runID, keyVals, submitURLOptIn });
+ /*** STUB ***/
+ return;
},
reloadPage: function () {
diff --git a/browser/modules/webrtcUI.jsm b/browser/modules/webrtcUI.jsm
index b24135bfc9..08de46bb34 100644
--- a/browser/modules/webrtcUI.jsm
+++ b/browser/modules/webrtcUI.jsm
@@ -290,7 +290,13 @@ function prompt(aBrowser, aRequest) {
let {audioDevices: audioDevices, videoDevices: videoDevices,
sharingScreen: sharingScreen, sharingAudio: sharingAudio,
requestTypes: requestTypes} = aRequest;
- let uri = Services.io.newURI(aRequest.documentURI, null, null);
+ let uri;
+ try {
+ // This fails for principals that serialize to "null", e.g. file URIs.
+ uri = Services.io.newURI(aRequest.origin, null, null);
+ } catch (e) {
+ uri = Services.io.newURI(aRequest.documentURI, null, null);
+ }
let host = getHost(uri);
let chromeDoc = aBrowser.ownerDocument;
let chromeWin = chromeDoc.defaultView;
diff --git a/browser/moz.build b/browser/moz.build
index a691aeef27..0985148c0a 100644
--- a/browser/moz.build
+++ b/browser/moz.build
@@ -11,7 +11,6 @@ SPHINX_TREES['browser'] = 'docs'
DIRS += [
'base',
'components',
- 'experiments',
'fonts',
'locales',
'modules',
diff --git a/browser/moz.configure b/browser/moz.configure
index fba4603be0..d5e7dba11a 100644
--- a/browser/moz.configure
+++ b/browser/moz.configure
@@ -4,9 +4,4 @@
# 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/.
-imply_option('MOZ_PLACES', True)
-imply_option('MOZ_SERVICES_HEALTHREPORT', True)
-imply_option('MOZ_SERVICES_SYNC', True)
-imply_option('MOZ_SERVICES_CLOUDSYNC', True)
-
include('../toolkit/moz.configure')
diff --git a/browser/themes/shared/tabs.inc.css b/browser/themes/shared/tabs.inc.css
index 632a6e6069..c505416e46 100644
--- a/browser/themes/shared/tabs.inc.css
+++ b/browser/themes/shared/tabs.inc.css
@@ -55,8 +55,9 @@
.tab-background-middle {
-moz-box-flex: 1;
background-clip: padding-box;
- border-left: @tabCurveHalfWidth@ solid transparent;
- border-right: @tabCurveHalfWidth@ solid transparent;
+ /* Deliberately create a 1px overlap left/right to cover rounding gaps */
+ border-left: calc(@tabCurveHalfWidth@ - 1px) solid transparent;
+ border-right: calc(@tabCurveHalfWidth@ - 1px) solid transparent;
margin: 0 -@tabCurveHalfWidth@;
}
diff --git a/build/application.ini b/build/application.ini
index 6b2e43a344..8f65421ed0 100644
--- a/build/application.ini
+++ b/build/application.ini
@@ -19,11 +19,17 @@
#include @TOPOBJDIR@/source-repo.h
[App]
#ifdef MC_OFFICIAL
+#if defined(MC_PALEMOON) || defined(MC_BASILISK)
Vendor=Moonchild Productions
+#elif defined(BINOC_BOREALIS)
+Vendor=Binary Outcast
#else
Vendor=@MOZ_APP_VENDOR@
#endif
-#if defined(MOZ_PHOENIX) && defined(MC_PALEMOON)
+#else
+Vendor=@MOZ_APP_VENDOR@
+#endif
+#ifdef MC_PALEMOON
Name=Pale Moon
#else
Name=@MOZ_APP_BASENAME@
@@ -54,8 +60,3 @@ MaxVersion=@GRE_MILESTONE@
EnableProfileMigrator=1
#endif
-#if MOZ_CRASHREPORTER
-[Crash Reporter]
-Enabled=1
-ServerURL=https://crash-reports.mozilla.com/submit?id=@MOZ_APP_ID@&version=@MOZ_APP_VERSION@&buildid=@MOZ_BUILDID@
-#endif
diff --git a/build/autoconf/compiler-opts.m4 b/build/autoconf/compiler-opts.m4
index 5e495e1074..c47d792f41 100644
--- a/build/autoconf/compiler-opts.m4
+++ b/build/autoconf/compiler-opts.m4
@@ -7,7 +7,7 @@ dnl Add compiler specific options
AC_DEFUN([MOZ_DEFAULT_COMPILER],
[
dnl set DEVELOPER_OPTIONS early; MOZ_DEFAULT_COMPILER is usually the first non-setup directive
- if test -z "$MOZILLA_OFFICIAL"; then
+ if test -z "$MC_OFFICIAL"; then
DEVELOPER_OPTIONS=1
fi
MOZ_ARG_ENABLE_BOOL(release,
@@ -181,18 +181,15 @@ if test "$GNU_CC"; then
if test -z "$CLANG_CC"; then
case "$CC_VERSION" in
- 4.*)
+ 4.* | 5.*)
;;
*)
# Lifetime Dead Store Elimination level 2 (default in GCC6+) breaks Gecko.
- # Ideally, we'd use -flifetime-dse=1, but that means we'd forcefully
- # enable it on optimization levels where it would otherwise not be enabled.
- # So we disable it entirely. But since that would mean inconsistency with
- # GCC5, which has level 1 depending on optimization level, disable it on
- # GCC5 as well, because better safe than sorry.
+ # Instead of completely disabling this optimization on newer GCC's,
+ # we'll force them to use level 1 optimization with -flifetime-dse=1.
# Add it first so that a mozconfig can override by setting CFLAGS/CXXFLAGS.
- CFLAGS="-fno-lifetime-dse $CFLAGS"
- CXXFLAGS="-fno-lifetime-dse $CXXFLAGS"
+ CFLAGS="-flifetime-dse=1 $CFLAGS"
+ CXXFLAGS="-flifetime-dse=1 $CXXFLAGS"
;;
esac
fi
diff --git a/build/autoconf/jemalloc.m4 b/build/autoconf/jemalloc.m4
deleted file mode 100644
index 3b9c603f75..0000000000
--- a/build/autoconf/jemalloc.m4
+++ /dev/null
@@ -1,114 +0,0 @@
-dnl This Source Code Form is subject to the terms of the Mozilla Public
-dnl License, v. 2.0. If a copy of the MPL was not distributed with this
-dnl file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-AC_DEFUN([MOZ_SUBCONFIGURE_JEMALLOC], [
-
-if test "$MOZ_BUILD_APP" != js -o -n "$JS_STANDALONE"; then
-
- # Run jemalloc configure script
-
- if test -z "$MOZ_SYSTEM_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC4" -o -n "$MOZ_REPLACE_MALLOC"; then
- ac_configure_args="--build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_ --disable-valgrind"
- # We're using memalign for _aligned_malloc in memory/build/mozmemory_wrap.c
- # on Windows, so just export memalign on all platforms.
- ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes"
- if test -n "$MOZ_REPLACE_MALLOC"; then
- # When using replace_malloc, we always want valloc exported from jemalloc.
- ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes"
- if test "${OS_ARCH}" = Darwin; then
- # We also need to enable pointer validation on Mac because jemalloc's
- # zone allocator is not used.
- ac_configure_args="$ac_configure_args --enable-ivsalloc"
- fi
- fi
- if test -n "$MOZ_JEMALLOC4"; then
- case "${OS_ARCH}" in
- WINNT|Darwin)
- # We want jemalloc functions to be kept hidden on both Mac and Windows
- # See memory/build/mozmemory_wrap.h for details.
- ac_configure_args="$ac_configure_args --without-export"
- ;;
- esac
- if test "${OS_ARCH}" = WINNT; then
- # Lazy lock initialization doesn't play well with lazy linking of
- # mozglue.dll on Windows XP (leads to startup crash), so disable it.
- ac_configure_args="$ac_configure_args --disable-lazy-lock"
-
- # 64-bit Windows builds require a minimum 16-byte alignment.
- if test -n "$HAVE_64BIT_BUILD"; then
- ac_configure_args="$ac_configure_args --with-lg-tiny-min=4"
- fi
- fi
- elif test "${OS_ARCH}" = Darwin; then
- # When building as a replace-malloc lib, disabling the zone allocator
- # forces to use pthread_atfork.
- ac_configure_args="$ac_configure_args --disable-zone-allocator"
- fi
- _MANGLE="malloc posix_memalign aligned_alloc calloc realloc free memalign valloc malloc_usable_size"
- JEMALLOC_WRAPPER=
- if test -z "$MOZ_REPLACE_MALLOC"; then
- case "$OS_ARCH" in
- Linux|DragonFly|FreeBSD|NetBSD|OpenBSD)
- MANGLE=$_MANGLE
- ;;
- esac
- elif test -z "$MOZ_JEMALLOC4"; then
- MANGLE=$_MANGLE
- JEMALLOC_WRAPPER=replace_
- fi
- if test -n "$MANGLE"; then
- MANGLED=
- for mangle in ${MANGLE}; do
- if test -n "$MANGLED"; then
- MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle,$MANGLED"
- else
- MANGLED="$mangle:$JEMALLOC_WRAPPER$mangle"
- fi
- done
- ac_configure_args="$ac_configure_args --with-mangling=$MANGLED"
- fi
- unset CONFIG_FILES
- if test -z "$MOZ_TLS"; then
- ac_configure_args="$ac_configure_args --disable-tls"
- fi
- EXTRA_CFLAGS="$CFLAGS"
- for var in AS CC CXX CPP LD AR RANLIB STRIP CPPFLAGS EXTRA_CFLAGS LDFLAGS; do
- ac_configure_args="$ac_configure_args $var='`eval echo \\${${var}}`'"
- done
-
- # jemalloc's configure assumes that if you have CFLAGS set at all, you set
- # all the flags necessary to configure jemalloc, which is not likely to be
- # the case on Windows if someone is building Firefox with flags set in
- # their mozconfig.
- if test "$_MSC_VER"; then
- ac_configure_args="$ac_configure_args CFLAGS="
- fi
-
- # Force disable DSS support in jemalloc.
- ac_configure_args="$ac_configure_args ac_cv_func_sbrk=false"
-
- # Make Linux builds munmap freed chunks instead of recycling them.
- ac_configure_args="$ac_configure_args --enable-munmap"
-
- # Disable cache oblivious behavior that appears to have a performance
- # impact on Firefox.
- ac_configure_args="$ac_configure_args --disable-cache-oblivious"
-
- if ! test -e memory/jemalloc; then
- mkdir -p memory/jemalloc
- fi
-
- # jemalloc's configure runs git to determine the version. But when building
- # from a gecko git clone, the git commands it uses is going to pick gecko's
- # information, not jemalloc's, which is useless. So pretend we don't have git
- # at all. That will make jemalloc's configure pick the in-tree VERSION file.
- (PATH="$srcdir/memory/jemalloc/helper:$PATH";
- AC_OUTPUT_SUBDIRS(memory/jemalloc/src)
- ) || exit 1
- ac_configure_args="$_SUBDIR_CONFIG_ARGS"
- fi
-
-fi
-
-])
diff --git a/build/automation-build.mk b/build/automation-build.mk
index e25f90c5d3..6599cb0324 100644
--- a/build/automation-build.mk
+++ b/build/automation-build.mk
@@ -48,11 +48,7 @@ else
AUTOMATION_PPARGS += -DIS_DEBUG_BUILD=0
endif
-ifdef MOZ_CRASHREPORTER
-AUTOMATION_PPARGS += -DCRASHREPORTER=1
-else
AUTOMATION_PPARGS += -DCRASHREPORTER=0
-endif
ifdef MOZ_ASAN
AUTOMATION_PPARGS += -DIS_ASAN=1
diff --git a/build/automation.py.in b/build/automation.py.in
index 1c63977e83..09c9d0071b 100644
--- a/build/automation.py.in
+++ b/build/automation.py.in
@@ -228,11 +228,7 @@ class Automation(object):
if dmdPath and dmdLibrary and preloadEnvVar:
env[preloadEnvVar] = os.path.join(dmdPath, dmdLibrary)
- if crashreporter and not debugger:
- env['MOZ_CRASHREPORTER_NO_REPORT'] = '1'
- env['MOZ_CRASHREPORTER'] = '1'
- else:
- env['MOZ_CRASHREPORTER_DISABLE'] = '1'
+ env['MOZ_CRASHREPORTER_DISABLE'] = '1'
# Crash on non-local network connections by default.
# MOZ_DISABLE_NONLOCAL_CONNECTIONS can be set to "0" to temporarily
diff --git a/build/directive4.py b/build/directive4.py
index 8f05eeed57..dd8c111cfe 100644
--- a/build/directive4.py
+++ b/build/directive4.py
@@ -49,6 +49,7 @@ if ('MOZ_OFFICIAL_BRANDING' in listConfig) or (strBrandingDirectory.endswith("br
# Applies to Pale Moon Only
if 'MC_PALEMOON' in listConfig:
listViolations += [
+ 'MOZ_EME',
'MOZ_WEBRTC'
]
diff --git a/build/mobile/b2gautomation.py b/build/mobile/b2gautomation.py
index d73edd4198..a218090682 100644
--- a/build/mobile/b2gautomation.py
+++ b/build/mobile/b2gautomation.py
@@ -156,10 +156,6 @@ class B2GRemoteAutomation(Automation):
if env is None:
env = {}
- if crashreporter:
- env['MOZ_CRASHREPORTER'] = '1'
- env['MOZ_CRASHREPORTER_NO_REPORT'] = '1'
-
# We always hide the results table in B2G; it's much slower if we don't.
env['MOZ_HIDE_RESULTS_TABLE'] = '1'
return env
diff --git a/build/mobile/remoteautomation.py b/build/mobile/remoteautomation.py
index 1358e0dfe3..f098d5bbaf 100644
--- a/build/mobile/remoteautomation.py
+++ b/build/mobile/remoteautomation.py
@@ -74,11 +74,7 @@ class RemoteAutomation(Automation):
if 'MOZ_HIDE_RESULTS_TABLE' in os.environ:
env['MOZ_HIDE_RESULTS_TABLE'] = os.environ['MOZ_HIDE_RESULTS_TABLE']
- if crashreporter and not debugger:
- env['MOZ_CRASHREPORTER_NO_REPORT'] = '1'
- env['MOZ_CRASHREPORTER'] = '1'
- else:
- env['MOZ_CRASHREPORTER_DISABLE'] = '1'
+ env['MOZ_CRASHREPORTER_DISABLE'] = '1'
# Crash on non-local network connections by default.
# MOZ_DISABLE_NONLOCAL_CONNECTIONS can be set to "0" to temporarily
@@ -215,36 +211,9 @@ class RemoteAutomation(Automation):
if javaException:
return True
- # If crash reporting is disabled (MOZ_CRASHREPORTER!=1), we can't say
- # anything.
- if not self.CRASHREPORTER:
- return False
-
- try:
- dumpDir = tempfile.mkdtemp()
- remoteCrashDir = posixpath.join(self._remoteProfile, 'minidumps')
- if not self._devicemanager.dirExists(remoteCrashDir):
- # If crash reporting is enabled (MOZ_CRASHREPORTER=1), the
- # minidumps directory is automatically created when Fennec
- # (first) starts, so its lack of presence is a hint that
- # something went wrong.
- print "Automation Error: No crash directory (%s) found on remote device" % remoteCrashDir
- # Whilst no crash was found, the run should still display as a failure
- return True
- self._devicemanager.getDirectory(remoteCrashDir, dumpDir)
+ # No crash reporting means we can't say anything.
+ return False
- logger = get_default_logger()
- if logger is not None:
- crashed = mozcrash.log_crashes(logger, dumpDir, symbolsPath, test=self.lastTestSeen)
- else:
- crashed = Automation.checkForCrashes(self, dumpDir, symbolsPath)
-
- finally:
- try:
- shutil.rmtree(dumpDir)
- except:
- print "WARNING: unable to remove directory: %s" % dumpDir
- return crashed
def buildCommandLine(self, app, debuggerInfo, profileDir, testURL, extraArgs):
# If remote profile is specified, use that instead
diff --git a/build/moz.build b/build/moz.build
index 8d86b52bf9..d96724cadd 100644
--- a/build/moz.build
+++ b/build/moz.build
@@ -30,8 +30,8 @@ if CONFIG['MOZ_PHOENIX']:
DEFINES['MOZ_PHOENIX'] = CONFIG['MOZ_PHOENIX']
DEFINES['MOZ_BUILD_APP_IS_BROWSER'] = True
-if CONFIG['MC_OFFICAL']:
- DEFINES['MC_OFFICAL'] = CONFIG['MC_OFFICAL']
+if CONFIG['MC_OFFICIAL']:
+ DEFINES['MC_OFFICIAL'] = CONFIG['MC_OFFICIAL']
if CONFIG['MC_BASILISK']:
DEFINES['MC_BASILISK'] = CONFIG['MC_BASILISK']
@@ -39,10 +39,13 @@ if CONFIG['MC_BASILISK']:
if CONFIG['MC_PALEMOON']:
DEFINES['MC_PALEMOON'] = CONFIG['MC_PALEMOON']
+if CONFIG['BINOC_BOREALIS']:
+ DEFINES['BINOC_BOREALIS'] = CONFIG['BINOC_BOREALIS']
+
if CONFIG['MOZ_APP_PROFILE']:
DEFINES['MOZ_APP_PROFILE'] = CONFIG['MOZ_APP_PROFILE']
-for var in ('MOZ_CRASHREPORTER', 'MOZ_PROFILE_MIGRATOR',
+for var in ('MOZ_PROFILE_MIGRATOR',
'MOZ_APP_STATIC_INI'):
if CONFIG[var]:
DEFINES[var] = True
diff --git a/build/moz.configure/memory.configure b/build/moz.configure/memory.configure
index 3beed2fb29..398413b625 100644
--- a/build/moz.configure/memory.configure
+++ b/build/moz.configure/memory.configure
@@ -5,12 +5,13 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-option(env='MOZ_JEMALLOC4', help='Enable jemalloc 4')
-imply_option('--enable-jemalloc', depends_if('MOZ_JEMALLOC4')(lambda x: '4'))
+@deprecated_option(env='MOZ_JEMALLOC4')
+def moz_jemalloc4(value):
+ die('MOZ_JEMALLOC4 is no longer supported')
-option('--enable-jemalloc', nargs='?', choices=('4', 'moz'), env='MOZ_MEMORY',
- help='Replace memory allocator with jemalloc')
+option('--enable-jemalloc', env='MOZ_MEMORY',
+ help='Replace system memory allocator with jemalloc')
@depends('--enable-jemalloc', target, build_project, c_compiler)
def jemalloc(value, target, build_project, c_compiler):
@@ -30,36 +31,25 @@ def jemalloc(value, target, build_project, c_compiler):
if target.kernel == 'Linux':
return True
-@depends('--enable-jemalloc')
-def jemalloc4(jemalloc):
- if len(jemalloc) and jemalloc[0] == '4':
- return True
-
set_config('MOZ_MEMORY', jemalloc)
set_define('MOZ_MEMORY', jemalloc)
add_old_configure_assignment('MOZ_MEMORY', jemalloc)
-set_config('MOZ_JEMALLOC4', jemalloc4)
-set_define('MOZ_JEMALLOC4', jemalloc4)
-add_old_configure_assignment('MOZ_JEMALLOC4', jemalloc4)
-
# Because --enable-jemalloc doesn't use a default because of the dependency
# on the target, we can't use a js_option for it to propagate to js/src
# through the old-configure.
-@depends(jemalloc, jemalloc4)
-def jemalloc_for_old_configure(jemalloc, jemalloc4):
- if jemalloc:
- return '--enable-jemalloc=4' if jemalloc4 else '--enable-jemalloc'
- return '--disable-jemalloc'
+@depends(jemalloc)
+def jemalloc_for_old_configure(jemalloc):
+ return '--%s-jemalloc' % ('enable' if jemalloc else 'disable')
add_old_configure_arg(jemalloc_for_old_configure)
-@depends(jemalloc, jemalloc4, target)
-def jemalloc_os_define(jemalloc, jemalloc4, target):
- if jemalloc and not jemalloc4:
+@depends(jemalloc, target)
+def jemalloc_os_define(jemalloc, target):
+ if jemalloc:
if target.kernel == 'WINNT':
return 'MOZ_MEMORY_WINDOWS'
if target.kernel == 'Linux':
@@ -72,9 +62,9 @@ def jemalloc_os_define(jemalloc, jemalloc4, target):
set_define(jemalloc_os_define, '1')
-@depends(jemalloc, jemalloc4, target)
-def jemalloc_os_define_android(jemalloc, jemalloc4, target):
- if jemalloc and not jemalloc4 and target.os == 'Android':
+@depends(jemalloc, target)
+def jemalloc_os_define_android(jemalloc, target):
+ if jemalloc and target.os == 'Android':
return 'MOZ_MEMORY_ANDROID'
set_define(jemalloc_os_define_android, '1')
diff --git a/build/moz.configure/old.configure b/build/moz.configure/old.configure
index ffdea81b09..9f29e68c94 100644
--- a/build/moz.configure/old.configure
+++ b/build/moz.configure/old.configure
@@ -235,6 +235,7 @@ def old_configure_options(*options):
'--enable-system-pixman',
'--enable-system-sqlite',
'--enable-tasktracer',
+ '--enable-tests',
'--enable-thread-sanitizer',
'--enable-trace-logging',
'--enable-ui-locale',
diff --git a/build/pgo/profileserver.py b/build/pgo/profileserver.py
index 3e5a870c33..adc93d9b13 100644
--- a/build/pgo/profileserver.py
+++ b/build/pgo/profileserver.py
@@ -53,7 +53,6 @@ if __name__ == '__main__':
locations=locations)
env = os.environ.copy()
- env["MOZ_CRASHREPORTER_NO_REPORT"] = "1"
env["XPCOM_DEBUG_BREAK"] = "warn"
# For VC12+, make sure we can find the right bitness of pgort1x0.dll
diff --git a/build/valgrind/mach_commands.py b/build/valgrind/mach_commands.py
index ba2575247d..8109f0784a 100644
--- a/build/valgrind/mach_commands.py
+++ b/build/valgrind/mach_commands.py
@@ -90,7 +90,6 @@ class MachCommands(MachCommandBase):
env = os.environ.copy()
env['G_SLICE'] = 'always-malloc'
env['MOZ_CC_RUN_DURING_SHUTDOWN'] = '1'
- env['MOZ_CRASHREPORTER_NO_REPORT'] = '1'
env['XPCOM_DEBUG_BREAK'] = 'warn'
env.update(self.extra_environment_variables)
diff --git a/build/valgrind/x86_64-redhat-linux-gnu.sup b/build/valgrind/x86_64-redhat-linux-gnu.sup
index d253a3a4e6..28656e4180 100644
--- a/build/valgrind/x86_64-redhat-linux-gnu.sup
+++ b/build/valgrind/x86_64-redhat-linux-gnu.sup
@@ -105,7 +105,6 @@
fun:g_object_newv
fun:g_object_new_valist
fun:g_object_new
- fun:_ZN13nsLookAndFeel4InitEv
...
}
# set_color() in gtkstyle.c of GTK version 3.4.4 only can leak GdkRGBA
diff --git a/caps/BasePrincipal.cpp b/caps/BasePrincipal.cpp
index b768d5c1fd..93ffcf1296 100644
--- a/caps/BasePrincipal.cpp
+++ b/caps/BasePrincipal.cpp
@@ -7,9 +7,6 @@
#include "mozilla/BasePrincipal.h"
#include "nsDocShell.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
#include "nsIAddonPolicyService.h"
#include "nsIContentSecurityPolicy.h"
#include "nsIEffectiveTLDService.h"
@@ -149,10 +146,6 @@ OriginAttributes::CreateSuffix(nsACString& aStr) const
if (!mAddonId.IsEmpty()) {
if (mAddonId.FindCharInSet(dom::quota::QuotaManager::kReplaceChars) != kNotFound) {
-#ifdef MOZ_CRASHREPORTER
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Crash_AddonId"),
- NS_ConvertUTF16toUTF8(mAddonId));
-#endif
MOZ_CRASH();
}
params->Set(NS_LITERAL_STRING("addonId"), mAddonId);
diff --git a/caps/nsNullPrincipalURI.cpp b/caps/nsNullPrincipalURI.cpp
index 891a29bd80..f8b8671606 100644
--- a/caps/nsNullPrincipalURI.cpp
+++ b/caps/nsNullPrincipalURI.cpp
@@ -168,6 +168,32 @@ nsNullPrincipalURI::SetPath(const nsACString &aPath)
}
NS_IMETHODIMP
+nsNullPrincipalURI::GetFilePath(nsACString &aFilePath)
+{
+ aFilePath.Truncate();
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+nsNullPrincipalURI::SetFilePath(const nsACString &aFilePath)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+nsNullPrincipalURI::GetQuery(nsACString &aQuery)
+{
+ aQuery.Truncate();
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+nsNullPrincipalURI::SetQuery(const nsACString &aQuery)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
nsNullPrincipalURI::GetRef(nsACString &_ref)
{
_ref.Truncate();
diff --git a/chrome/nsChromeRegistry.cpp b/chrome/nsChromeRegistry.cpp
index 0aa7f3f149..0302b9997d 100644
--- a/chrome/nsChromeRegistry.cpp
+++ b/chrome/nsChromeRegistry.cpp
@@ -234,15 +234,18 @@ nsChromeRegistry::Canonify(nsIURL* aChromeURL)
aChromeURL->SetPath(path);
}
else {
- // prevent directory traversals ("..")
// path is already unescaped once, but uris can get unescaped twice
const char* pos = path.BeginReading();
const char* end = path.EndReading();
+ if (*pos == '/' || *pos == ' ') {
+ return NS_ERROR_DOM_BAD_URI;
+ }
while (pos < end) {
switch (*pos) {
case ':':
return NS_ERROR_DOM_BAD_URI;
case '.':
+ // prevent directory traversals ("..")
if (pos[1] == '.')
return NS_ERROR_DOM_BAD_URI;
break;
diff --git a/config/external/icu/data/icudt58l.dat b/config/external/icu/data/icudt58l.dat
index 7ade5b8fa1..946a2c8684 100644
--- a/config/external/icu/data/icudt58l.dat
+++ b/config/external/icu/data/icudt58l.dat
Binary files differ
diff --git a/config/external/nss/Makefile.in b/config/external/nss/Makefile.in
index 4b95a32bdc..861b7d07d1 100644
--- a/config/external/nss/Makefile.in
+++ b/config/external/nss/Makefile.in
@@ -43,17 +43,6 @@ endif
# Default
HAVE_FREEBL_LIBS = 1
-# 32-bit HP-UX PA-RISC
-ifeq ($(OS_ARCH), HP-UX)
-ifneq ($(OS_TEST), ia64)
-ifndef HAVE_64BIT_BUILD
-HAVE_FREEBL_LIBS =
-HAVE_FREEBL_LIBS_32INT32 = 1
-HAVE_FREEBL_LIBS_32FPU = 1
-endif
-endif
-endif
-
# SunOS SPARC
ifeq ($(OS_ARCH), SunOS)
ifneq (86,$(findstring 86,$(OS_TEST)))
diff --git a/config/external/nss/nss.symbols b/config/external/nss/nss.symbols
index ba5492c37a..41f8ee7a9e 100644
--- a/config/external/nss/nss.symbols
+++ b/config/external/nss/nss.symbols
@@ -271,7 +271,6 @@ NSS_IsInitialized
NSS_OptionSet
NSS_NoDB_Init
NSS_SecureMemcmp
-NSS_SecureMemcmpZero
NSS_SetAlgorithmPolicy
NSS_SetDomesticPolicy
NSS_Shutdown
@@ -279,9 +278,6 @@ NSSSMIME_GetVersion
NSS_SMIMESignerInfo_SaveSMIMEProfile
NSS_SMIMEUtil_FindBulkAlgForRecipients
NSSSSL_GetVersion
-#ifdef XP_WIN
-_NSSUTIL_Access
-#endif
NSSUTIL_ArgDecodeNumber
NSSUTIL_ArgFetchValue
NSSUTIL_ArgGetLabel
@@ -303,9 +299,6 @@ NSSUTIL_MkModuleSpec
NSSUTIL_MkNSSString
NSSUTIL_MkSlotString
NSSUTIL_Quote
-#ifdef XP_WIN
-_NSSUTIL_UTF8ToWide
-#endif
PK11_AlgtagToMechanism
PK11_Authenticate
PK11_ChangePW
@@ -490,7 +483,6 @@ PORT_UCS2_ASCIIConversion_Util
PORT_UCS2_UTF8Conversion
PORT_UCS2_UTF8Conversion_Util
PORT_ZAlloc
-PORT_ZAllocAlignedOffset_Util
PORT_ZAlloc_Util
PORT_ZFree_Util
SEC_AnyTemplate_Util @DATA@
diff --git a/config/milestone.txt b/config/milestone.txt
index 27f2d007f6..b617f64b75 100644
--- a/config/milestone.txt
+++ b/config/milestone.txt
@@ -10,4 +10,4 @@
# hardcoded milestones in the tree from these two files.
#--------------------------------------------------------
-4.1.1
+4.1.2
diff --git a/config/rules.mk b/config/rules.mk
index 122bd8a776..9a8f61c2da 100644
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -386,26 +386,6 @@ endif
endif
endif
-#
-# HP-UXBeOS specific section: for COMPONENTS only, add -Bsymbolic flag
-# which uses internal symbols first
-#
-ifeq ($(OS_ARCH),HP-UX)
-ifdef IS_COMPONENT
-ifeq ($(GNU_CC)$(GNU_CXX),)
-EXTRA_DSO_LDOPTS += -Wl,-Bsymbolic
-ifneq ($(HAS_EXTRAEXPORTS),1)
-MKSHLIB += -Wl,+eNSGetModule -Wl,+eerrno
-MKCSHLIB += +eNSGetModule +eerrno
-ifneq ($(OS_TEST),ia64)
-MKSHLIB += -Wl,+e_shlInit
-MKCSHLIB += +e_shlInit
-endif # !ia64
-endif # !HAS_EXTRAEXPORTS
-endif # non-gnu compilers
-endif # IS_COMPONENT
-endif # HP-UX
-
ifeq ($(OS_ARCH),AIX)
ifdef IS_COMPONENT
ifneq ($(HAS_EXTRAEXPORTS),1)
@@ -1129,6 +1109,12 @@ ifneq (,$(JAR_MANIFEST))
ifndef NO_DIST_INSTALL
ifdef XPI_NAME
+# XXX: Figure out why Pale Moon's defs.mk is not being propigated
+ifndef XPI_ROOT_APPID
+ifdef MC_PALEMOON
+XPI_ROOT_APPID=$(MOZ_APP_ID)
+endif
+endif
ifdef XPI_ROOT_APPID
# For add-on packaging we may specify that an application
# sub-dir should be added to the root chrome manifest with
diff --git a/config/version.mk b/config/version.mk
index 1b9f68afa9..ef8eca9d04 100644
--- a/config/version.mk
+++ b/config/version.mk
@@ -16,7 +16,7 @@ ifndef RESFILE
RCFILE=./module.rc
RESFILE=./module.res
_RC_STRING = -QUIET 1 -DEPTH $(DEPTH) -TOPSRCDIR $(MOZILLA_DIR) -OBJDIR . -SRCDIR $(srcdir) -DISPNAME $(MOZ_APP_DISPLAYNAME) -APPVERSION $(MOZ_APP_VERSION)
-ifdef MOZILLA_OFFICIAL
+ifdef MC_OFFICIAL
_RC_STRING += -OFFICIAL 1
endif
ifdef MOZ_DEBUG
diff --git a/db/sqlite3/src/sqlite3.c b/db/sqlite3/src/sqlite3.c
index 9c8fd6204d..320d6355e3 100644
--- a/db/sqlite3/src/sqlite3.c
+++ b/db/sqlite3/src/sqlite3.c
@@ -1,6 +1,6 @@
/******************************************************************************
** This file is an amalgamation of many separate C source files from SQLite
-** version 3.19.3. By combining all the individual C code files into this
+** version 3.21.0. By combining all the individual C code files into this
** single large file, the entire code can be compiled as a single translation
** unit. This allows many compilers to do optimizations that would not be
** possible if the files were compiled separately. Performance improvements
@@ -22,6 +22,761 @@
#ifndef SQLITE_PRIVATE
# define SQLITE_PRIVATE static
#endif
+/************** Begin file ctime.c *******************************************/
+/*
+** 2010 February 23
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+**
+** This file implements routines used to report what compile-time options
+** SQLite was built with.
+*/
+
+#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
+
+/*
+** Include the configuration header output by 'configure' if we're using the
+** autoconf-based build
+*/
+#if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H)
+#include "config.h"
+#define SQLITECONFIG_H 1
+#endif
+
+/* These macros are provided to "stringify" the value of the define
+** for those options in which the value is meaningful. */
+#define CTIMEOPT_VAL_(opt) #opt
+#define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt)
+
+/*
+** An array of names of all compile-time options. This array should
+** be sorted A-Z.
+**
+** This array looks large, but in a typical installation actually uses
+** only a handful of compile-time options, so most times this array is usually
+** rather short and uses little memory space.
+*/
+static const char * const sqlite3azCompileOpt[] = {
+
+/*
+** BEGIN CODE GENERATED BY tool/mkctime.tcl
+*/
+#if SQLITE_32BIT_ROWID
+ "32BIT_ROWID",
+#endif
+#if SQLITE_4_BYTE_ALIGNED_MALLOC
+ "4_BYTE_ALIGNED_MALLOC",
+#endif
+#if SQLITE_64BIT_STATS
+ "64BIT_STATS",
+#endif
+#if SQLITE_ALLOW_COVERING_INDEX_SCAN
+ "ALLOW_COVERING_INDEX_SCAN",
+#endif
+#if SQLITE_ALLOW_URI_AUTHORITY
+ "ALLOW_URI_AUTHORITY",
+#endif
+#ifdef SQLITE_BITMASK_TYPE
+ "BITMASK_TYPE=" CTIMEOPT_VAL(SQLITE_BITMASK_TYPE),
+#endif
+#if SQLITE_BUG_COMPATIBLE_20160819
+ "BUG_COMPATIBLE_20160819",
+#endif
+#if SQLITE_CASE_SENSITIVE_LIKE
+ "CASE_SENSITIVE_LIKE",
+#endif
+#if SQLITE_CHECK_PAGES
+ "CHECK_PAGES",
+#endif
+#if defined(__clang__) && defined(__clang_major__)
+ "COMPILER=clang-" CTIMEOPT_VAL(__clang_major__) "."
+ CTIMEOPT_VAL(__clang_minor__) "."
+ CTIMEOPT_VAL(__clang_patchlevel__),
+#elif defined(_MSC_VER)
+ "COMPILER=msvc-" CTIMEOPT_VAL(_MSC_VER),
+#elif defined(__GNUC__) && defined(__VERSION__)
+ "COMPILER=gcc-" __VERSION__,
+#endif
+#if SQLITE_COVERAGE_TEST
+ "COVERAGE_TEST",
+#endif
+#if SQLITE_DEBUG
+ "DEBUG",
+#endif
+#if SQLITE_DEFAULT_AUTOMATIC_INDEX
+ "DEFAULT_AUTOMATIC_INDEX",
+#endif
+#if SQLITE_DEFAULT_AUTOVACUUM
+ "DEFAULT_AUTOVACUUM",
+#endif
+#ifdef SQLITE_DEFAULT_CACHE_SIZE
+ "DEFAULT_CACHE_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_CACHE_SIZE),
+#endif
+#if SQLITE_DEFAULT_CKPTFULLFSYNC
+ "DEFAULT_CKPTFULLFSYNC",
+#endif
+#ifdef SQLITE_DEFAULT_FILE_FORMAT
+ "DEFAULT_FILE_FORMAT=" CTIMEOPT_VAL(SQLITE_DEFAULT_FILE_FORMAT),
+#endif
+#ifdef SQLITE_DEFAULT_FILE_PERMISSIONS
+ "DEFAULT_FILE_PERMISSIONS=" CTIMEOPT_VAL(SQLITE_DEFAULT_FILE_PERMISSIONS),
+#endif
+#if SQLITE_DEFAULT_FOREIGN_KEYS
+ "DEFAULT_FOREIGN_KEYS",
+#endif
+#ifdef SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT
+ "DEFAULT_JOURNAL_SIZE_LIMIT=" CTIMEOPT_VAL(SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT),
+#endif
+#ifdef SQLITE_DEFAULT_LOCKING_MODE
+ "DEFAULT_LOCKING_MODE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE),
+#endif
+#ifdef SQLITE_DEFAULT_LOOKASIDE
+ "DEFAULT_LOOKASIDE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOOKASIDE),
+#endif
+#if SQLITE_DEFAULT_MEMSTATUS
+ "DEFAULT_MEMSTATUS",
+#endif
+#ifdef SQLITE_DEFAULT_MMAP_SIZE
+ "DEFAULT_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_MMAP_SIZE),
+#endif
+#ifdef SQLITE_DEFAULT_PAGE_SIZE
+ "DEFAULT_PAGE_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_PAGE_SIZE),
+#endif
+#ifdef SQLITE_DEFAULT_PCACHE_INITSZ
+ "DEFAULT_PCACHE_INITSZ=" CTIMEOPT_VAL(SQLITE_DEFAULT_PCACHE_INITSZ),
+#endif
+#ifdef SQLITE_DEFAULT_PROXYDIR_PERMISSIONS
+ "DEFAULT_PROXYDIR_PERMISSIONS=" CTIMEOPT_VAL(SQLITE_DEFAULT_PROXYDIR_PERMISSIONS),
+#endif
+#if SQLITE_DEFAULT_RECURSIVE_TRIGGERS
+ "DEFAULT_RECURSIVE_TRIGGERS",
+#endif
+#ifdef SQLITE_DEFAULT_ROWEST
+ "DEFAULT_ROWEST=" CTIMEOPT_VAL(SQLITE_DEFAULT_ROWEST),
+#endif
+#ifdef SQLITE_DEFAULT_SECTOR_SIZE
+ "DEFAULT_SECTOR_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_SECTOR_SIZE),
+#endif
+#ifdef SQLITE_DEFAULT_SYNCHRONOUS
+ "DEFAULT_SYNCHRONOUS=" CTIMEOPT_VAL(SQLITE_DEFAULT_SYNCHRONOUS),
+#endif
+#ifdef SQLITE_DEFAULT_WAL_AUTOCHECKPOINT
+ "DEFAULT_WAL_AUTOCHECKPOINT=" CTIMEOPT_VAL(SQLITE_DEFAULT_WAL_AUTOCHECKPOINT),
+#endif
+#ifdef SQLITE_DEFAULT_WAL_SYNCHRONOUS
+ "DEFAULT_WAL_SYNCHRONOUS=" CTIMEOPT_VAL(SQLITE_DEFAULT_WAL_SYNCHRONOUS),
+#endif
+#ifdef SQLITE_DEFAULT_WORKER_THREADS
+ "DEFAULT_WORKER_THREADS=" CTIMEOPT_VAL(SQLITE_DEFAULT_WORKER_THREADS),
+#endif
+#if SQLITE_DIRECT_OVERFLOW_READ
+ "DIRECT_OVERFLOW_READ",
+#endif
+#if SQLITE_DISABLE_DIRSYNC
+ "DISABLE_DIRSYNC",
+#endif
+#if SQLITE_DISABLE_FTS3_UNICODE
+ "DISABLE_FTS3_UNICODE",
+#endif
+#if SQLITE_DISABLE_FTS4_DEFERRED
+ "DISABLE_FTS4_DEFERRED",
+#endif
+#if SQLITE_DISABLE_INTRINSIC
+ "DISABLE_INTRINSIC",
+#endif
+#if SQLITE_DISABLE_LFS
+ "DISABLE_LFS",
+#endif
+#if SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS
+ "DISABLE_PAGECACHE_OVERFLOW_STATS",
+#endif
+#if SQLITE_DISABLE_SKIPAHEAD_DISTINCT
+ "DISABLE_SKIPAHEAD_DISTINCT",
+#endif
+#ifdef SQLITE_ENABLE_8_3_NAMES
+ "ENABLE_8_3_NAMES=" CTIMEOPT_VAL(SQLITE_ENABLE_8_3_NAMES),
+#endif
+#if SQLITE_ENABLE_API_ARMOR
+ "ENABLE_API_ARMOR",
+#endif
+#if SQLITE_ENABLE_ATOMIC_WRITE
+ "ENABLE_ATOMIC_WRITE",
+#endif
+#if SQLITE_ENABLE_BATCH_ATOMIC_WRITE
+ "ENABLE_BATCH_ATOMIC_WRITE",
+#endif
+#if SQLITE_ENABLE_CEROD
+ "ENABLE_CEROD",
+#endif
+#if SQLITE_ENABLE_COLUMN_METADATA
+ "ENABLE_COLUMN_METADATA",
+#endif
+#if SQLITE_ENABLE_COLUMN_USED_MASK
+ "ENABLE_COLUMN_USED_MASK",
+#endif
+#if SQLITE_ENABLE_COSTMULT
+ "ENABLE_COSTMULT",
+#endif
+#if SQLITE_ENABLE_CURSOR_HINTS
+ "ENABLE_CURSOR_HINTS",
+#endif
+#if SQLITE_ENABLE_DBSTAT_VTAB
+ "ENABLE_DBSTAT_VTAB",
+#endif
+#if SQLITE_ENABLE_EXPENSIVE_ASSERT
+ "ENABLE_EXPENSIVE_ASSERT",
+#endif
+#if SQLITE_ENABLE_FTS1
+ "ENABLE_FTS1",
+#endif
+#if SQLITE_ENABLE_FTS2
+ "ENABLE_FTS2",
+#endif
+#if SQLITE_ENABLE_FTS3
+ "ENABLE_FTS3",
+#endif
+#if SQLITE_ENABLE_FTS3_PARENTHESIS
+ "ENABLE_FTS3_PARENTHESIS",
+#endif
+#if SQLITE_ENABLE_FTS3_TOKENIZER
+ "ENABLE_FTS3_TOKENIZER",
+#endif
+#if SQLITE_ENABLE_FTS4
+ "ENABLE_FTS4",
+#endif
+#if SQLITE_ENABLE_FTS5
+ "ENABLE_FTS5",
+#endif
+#if SQLITE_ENABLE_HIDDEN_COLUMNS
+ "ENABLE_HIDDEN_COLUMNS",
+#endif
+#if SQLITE_ENABLE_ICU
+ "ENABLE_ICU",
+#endif
+#if SQLITE_ENABLE_IOTRACE
+ "ENABLE_IOTRACE",
+#endif
+#if SQLITE_ENABLE_JSON1
+ "ENABLE_JSON1",
+#endif
+#if SQLITE_ENABLE_LOAD_EXTENSION
+ "ENABLE_LOAD_EXTENSION",
+#endif
+#ifdef SQLITE_ENABLE_LOCKING_STYLE
+ "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE),
+#endif
+#if SQLITE_ENABLE_MEMORY_MANAGEMENT
+ "ENABLE_MEMORY_MANAGEMENT",
+#endif
+#if SQLITE_ENABLE_MEMSYS3
+ "ENABLE_MEMSYS3",
+#endif
+#if SQLITE_ENABLE_MEMSYS5
+ "ENABLE_MEMSYS5",
+#endif
+#if SQLITE_ENABLE_MULTIPLEX
+ "ENABLE_MULTIPLEX",
+#endif
+#if SQLITE_ENABLE_NULL_TRIM
+ "ENABLE_NULL_TRIM",
+#endif
+#if SQLITE_ENABLE_OVERSIZE_CELL_CHECK
+ "ENABLE_OVERSIZE_CELL_CHECK",
+#endif
+#if SQLITE_ENABLE_PREUPDATE_HOOK
+ "ENABLE_PREUPDATE_HOOK",
+#endif
+#if SQLITE_ENABLE_QPSG
+ "ENABLE_QPSG",
+#endif
+#if SQLITE_ENABLE_RBU
+ "ENABLE_RBU",
+#endif
+#if SQLITE_ENABLE_RTREE
+ "ENABLE_RTREE",
+#endif
+#if SQLITE_ENABLE_SELECTTRACE
+ "ENABLE_SELECTTRACE",
+#endif
+#if SQLITE_ENABLE_SESSION
+ "ENABLE_SESSION",
+#endif
+#if SQLITE_ENABLE_SNAPSHOT
+ "ENABLE_SNAPSHOT",
+#endif
+#if SQLITE_ENABLE_SQLLOG
+ "ENABLE_SQLLOG",
+#endif
+#if defined(SQLITE_ENABLE_STAT4)
+ "ENABLE_STAT4",
+#elif defined(SQLITE_ENABLE_STAT3)
+ "ENABLE_STAT3",
+#endif
+#if SQLITE_ENABLE_STMTVTAB
+ "ENABLE_STMTVTAB",
+#endif
+#if SQLITE_ENABLE_STMT_SCANSTATUS
+ "ENABLE_STMT_SCANSTATUS",
+#endif
+#if SQLITE_ENABLE_UNKNOWN_SQL_FUNCTION
+ "ENABLE_UNKNOWN_SQL_FUNCTION",
+#endif
+#if SQLITE_ENABLE_UNLOCK_NOTIFY
+ "ENABLE_UNLOCK_NOTIFY",
+#endif
+#if SQLITE_ENABLE_UPDATE_DELETE_LIMIT
+ "ENABLE_UPDATE_DELETE_LIMIT",
+#endif
+#if SQLITE_ENABLE_URI_00_ERROR
+ "ENABLE_URI_00_ERROR",
+#endif
+#if SQLITE_ENABLE_VFSTRACE
+ "ENABLE_VFSTRACE",
+#endif
+#if SQLITE_ENABLE_WHERETRACE
+ "ENABLE_WHERETRACE",
+#endif
+#if SQLITE_ENABLE_ZIPVFS
+ "ENABLE_ZIPVFS",
+#endif
+#if SQLITE_EXPLAIN_ESTIMATED_ROWS
+ "EXPLAIN_ESTIMATED_ROWS",
+#endif
+#if SQLITE_EXTRA_IFNULLROW
+ "EXTRA_IFNULLROW",
+#endif
+#ifdef SQLITE_EXTRA_INIT
+ "EXTRA_INIT=" CTIMEOPT_VAL(SQLITE_EXTRA_INIT),
+#endif
+#ifdef SQLITE_EXTRA_SHUTDOWN
+ "EXTRA_SHUTDOWN=" CTIMEOPT_VAL(SQLITE_EXTRA_SHUTDOWN),
+#endif
+#ifdef SQLITE_FTS3_MAX_EXPR_DEPTH
+ "FTS3_MAX_EXPR_DEPTH=" CTIMEOPT_VAL(SQLITE_FTS3_MAX_EXPR_DEPTH),
+#endif
+#if SQLITE_FTS5_ENABLE_TEST_MI
+ "FTS5_ENABLE_TEST_MI",
+#endif
+#if SQLITE_FTS5_NO_WITHOUT_ROWID
+ "FTS5_NO_WITHOUT_ROWID",
+#endif
+#if SQLITE_HAS_CODEC
+ "HAS_CODEC",
+#endif
+#if HAVE_ISNAN || SQLITE_HAVE_ISNAN
+ "HAVE_ISNAN",
+#endif
+#if SQLITE_HOMEGROWN_RECURSIVE_MUTEX
+ "HOMEGROWN_RECURSIVE_MUTEX",
+#endif
+#if SQLITE_IGNORE_AFP_LOCK_ERRORS
+ "IGNORE_AFP_LOCK_ERRORS",
+#endif
+#if SQLITE_IGNORE_FLOCK_LOCK_ERRORS
+ "IGNORE_FLOCK_LOCK_ERRORS",
+#endif
+#if SQLITE_INLINE_MEMCPY
+ "INLINE_MEMCPY",
+#endif
+#if SQLITE_INT64_TYPE
+ "INT64_TYPE",
+#endif
+#ifdef SQLITE_INTEGRITY_CHECK_ERROR_MAX
+ "INTEGRITY_CHECK_ERROR_MAX=" CTIMEOPT_VAL(SQLITE_INTEGRITY_CHECK_ERROR_MAX),
+#endif
+#if SQLITE_LIKE_DOESNT_MATCH_BLOBS
+ "LIKE_DOESNT_MATCH_BLOBS",
+#endif
+#if SQLITE_LOCK_TRACE
+ "LOCK_TRACE",
+#endif
+#if SQLITE_LOG_CACHE_SPILL
+ "LOG_CACHE_SPILL",
+#endif
+#ifdef SQLITE_MALLOC_SOFT_LIMIT
+ "MALLOC_SOFT_LIMIT=" CTIMEOPT_VAL(SQLITE_MALLOC_SOFT_LIMIT),
+#endif
+#ifdef SQLITE_MAX_ATTACHED
+ "MAX_ATTACHED=" CTIMEOPT_VAL(SQLITE_MAX_ATTACHED),
+#endif
+#ifdef SQLITE_MAX_COLUMN
+ "MAX_COLUMN=" CTIMEOPT_VAL(SQLITE_MAX_COLUMN),
+#endif
+#ifdef SQLITE_MAX_COMPOUND_SELECT
+ "MAX_COMPOUND_SELECT=" CTIMEOPT_VAL(SQLITE_MAX_COMPOUND_SELECT),
+#endif
+#ifdef SQLITE_MAX_DEFAULT_PAGE_SIZE
+ "MAX_DEFAULT_PAGE_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_DEFAULT_PAGE_SIZE),
+#endif
+#ifdef SQLITE_MAX_EXPR_DEPTH
+ "MAX_EXPR_DEPTH=" CTIMEOPT_VAL(SQLITE_MAX_EXPR_DEPTH),
+#endif
+#ifdef SQLITE_MAX_FUNCTION_ARG
+ "MAX_FUNCTION_ARG=" CTIMEOPT_VAL(SQLITE_MAX_FUNCTION_ARG),
+#endif
+#ifdef SQLITE_MAX_LENGTH
+ "MAX_LENGTH=" CTIMEOPT_VAL(SQLITE_MAX_LENGTH),
+#endif
+#ifdef SQLITE_MAX_LIKE_PATTERN_LENGTH
+ "MAX_LIKE_PATTERN_LENGTH=" CTIMEOPT_VAL(SQLITE_MAX_LIKE_PATTERN_LENGTH),
+#endif
+#ifdef SQLITE_MAX_MEMORY
+ "MAX_MEMORY=" CTIMEOPT_VAL(SQLITE_MAX_MEMORY),
+#endif
+#ifdef SQLITE_MAX_MMAP_SIZE
+ "MAX_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_MMAP_SIZE),
+#endif
+#ifdef SQLITE_MAX_MMAP_SIZE_
+ "MAX_MMAP_SIZE_=" CTIMEOPT_VAL(SQLITE_MAX_MMAP_SIZE_),
+#endif
+#ifdef SQLITE_MAX_PAGE_COUNT
+ "MAX_PAGE_COUNT=" CTIMEOPT_VAL(SQLITE_MAX_PAGE_COUNT),
+#endif
+#ifdef SQLITE_MAX_PAGE_SIZE
+ "MAX_PAGE_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_PAGE_SIZE),
+#endif
+#ifdef SQLITE_MAX_SCHEMA_RETRY
+ "MAX_SCHEMA_RETRY=" CTIMEOPT_VAL(SQLITE_MAX_SCHEMA_RETRY),
+#endif
+#ifdef SQLITE_MAX_SQL_LENGTH
+ "MAX_SQL_LENGTH=" CTIMEOPT_VAL(SQLITE_MAX_SQL_LENGTH),
+#endif
+#ifdef SQLITE_MAX_TRIGGER_DEPTH
+ "MAX_TRIGGER_DEPTH=" CTIMEOPT_VAL(SQLITE_MAX_TRIGGER_DEPTH),
+#endif
+#ifdef SQLITE_MAX_VARIABLE_NUMBER
+ "MAX_VARIABLE_NUMBER=" CTIMEOPT_VAL(SQLITE_MAX_VARIABLE_NUMBER),
+#endif
+#ifdef SQLITE_MAX_VDBE_OP
+ "MAX_VDBE_OP=" CTIMEOPT_VAL(SQLITE_MAX_VDBE_OP),
+#endif
+#ifdef SQLITE_MAX_WORKER_THREADS
+ "MAX_WORKER_THREADS=" CTIMEOPT_VAL(SQLITE_MAX_WORKER_THREADS),
+#endif
+#if SQLITE_MEMDEBUG
+ "MEMDEBUG",
+#endif
+#if SQLITE_MIXED_ENDIAN_64BIT_FLOAT
+ "MIXED_ENDIAN_64BIT_FLOAT",
+#endif
+#if SQLITE_MMAP_READWRITE
+ "MMAP_READWRITE",
+#endif
+#if SQLITE_MUTEX_NOOP
+ "MUTEX_NOOP",
+#endif
+#if SQLITE_MUTEX_NREF
+ "MUTEX_NREF",
+#endif
+#if SQLITE_MUTEX_OMIT
+ "MUTEX_OMIT",
+#endif
+#if SQLITE_MUTEX_PTHREADS
+ "MUTEX_PTHREADS",
+#endif
+#if SQLITE_MUTEX_W32
+ "MUTEX_W32",
+#endif
+#if SQLITE_NEED_ERR_NAME
+ "NEED_ERR_NAME",
+#endif
+#if SQLITE_NOINLINE
+ "NOINLINE",
+#endif
+#if SQLITE_NO_SYNC
+ "NO_SYNC",
+#endif
+#if SQLITE_OMIT_ALTERTABLE
+ "OMIT_ALTERTABLE",
+#endif
+#if SQLITE_OMIT_ANALYZE
+ "OMIT_ANALYZE",
+#endif
+#if SQLITE_OMIT_ATTACH
+ "OMIT_ATTACH",
+#endif
+#if SQLITE_OMIT_AUTHORIZATION
+ "OMIT_AUTHORIZATION",
+#endif
+#if SQLITE_OMIT_AUTOINCREMENT
+ "OMIT_AUTOINCREMENT",
+#endif
+#if SQLITE_OMIT_AUTOINIT
+ "OMIT_AUTOINIT",
+#endif
+#if SQLITE_OMIT_AUTOMATIC_INDEX
+ "OMIT_AUTOMATIC_INDEX",
+#endif
+#if SQLITE_OMIT_AUTORESET
+ "OMIT_AUTORESET",
+#endif
+#if SQLITE_OMIT_AUTOVACUUM
+ "OMIT_AUTOVACUUM",
+#endif
+#if SQLITE_OMIT_BETWEEN_OPTIMIZATION
+ "OMIT_BETWEEN_OPTIMIZATION",
+#endif
+#if SQLITE_OMIT_BLOB_LITERAL
+ "OMIT_BLOB_LITERAL",
+#endif
+#if SQLITE_OMIT_BTREECOUNT
+ "OMIT_BTREECOUNT",
+#endif
+#if SQLITE_OMIT_CAST
+ "OMIT_CAST",
+#endif
+#if SQLITE_OMIT_CHECK
+ "OMIT_CHECK",
+#endif
+#if SQLITE_OMIT_COMPLETE
+ "OMIT_COMPLETE",
+#endif
+#if SQLITE_OMIT_COMPOUND_SELECT
+ "OMIT_COMPOUND_SELECT",
+#endif
+#if SQLITE_OMIT_CONFLICT_CLAUSE
+ "OMIT_CONFLICT_CLAUSE",
+#endif
+#if SQLITE_OMIT_CTE
+ "OMIT_CTE",
+#endif
+#if SQLITE_OMIT_DATETIME_FUNCS
+ "OMIT_DATETIME_FUNCS",
+#endif
+#if SQLITE_OMIT_DECLTYPE
+ "OMIT_DECLTYPE",
+#endif
+#if SQLITE_OMIT_DEPRECATED
+ "OMIT_DEPRECATED",
+#endif
+#if SQLITE_OMIT_DISKIO
+ "OMIT_DISKIO",
+#endif
+#if SQLITE_OMIT_EXPLAIN
+ "OMIT_EXPLAIN",
+#endif
+#if SQLITE_OMIT_FLAG_PRAGMAS
+ "OMIT_FLAG_PRAGMAS",
+#endif
+#if SQLITE_OMIT_FLOATING_POINT
+ "OMIT_FLOATING_POINT",
+#endif
+#if SQLITE_OMIT_FOREIGN_KEY
+ "OMIT_FOREIGN_KEY",
+#endif
+#if SQLITE_OMIT_GET_TABLE
+ "OMIT_GET_TABLE",
+#endif
+#if SQLITE_OMIT_HEX_INTEGER
+ "OMIT_HEX_INTEGER",
+#endif
+#if SQLITE_OMIT_INCRBLOB
+ "OMIT_INCRBLOB",
+#endif
+#if SQLITE_OMIT_INTEGRITY_CHECK
+ "OMIT_INTEGRITY_CHECK",
+#endif
+#if SQLITE_OMIT_LIKE_OPTIMIZATION
+ "OMIT_LIKE_OPTIMIZATION",
+#endif
+#if SQLITE_OMIT_LOAD_EXTENSION
+ "OMIT_LOAD_EXTENSION",
+#endif
+#if SQLITE_OMIT_LOCALTIME
+ "OMIT_LOCALTIME",
+#endif
+#if SQLITE_OMIT_LOOKASIDE
+ "OMIT_LOOKASIDE",
+#endif
+#if SQLITE_OMIT_MEMORYDB
+ "OMIT_MEMORYDB",
+#endif
+#if SQLITE_OMIT_OR_OPTIMIZATION
+ "OMIT_OR_OPTIMIZATION",
+#endif
+#if SQLITE_OMIT_PAGER_PRAGMAS
+ "OMIT_PAGER_PRAGMAS",
+#endif
+#if SQLITE_OMIT_PARSER_TRACE
+ "OMIT_PARSER_TRACE",
+#endif
+#if SQLITE_OMIT_POPEN
+ "OMIT_POPEN",
+#endif
+#if SQLITE_OMIT_PRAGMA
+ "OMIT_PRAGMA",
+#endif
+#if SQLITE_OMIT_PROGRESS_CALLBACK
+ "OMIT_PROGRESS_CALLBACK",
+#endif
+#if SQLITE_OMIT_QUICKBALANCE
+ "OMIT_QUICKBALANCE",
+#endif
+#if SQLITE_OMIT_REINDEX
+ "OMIT_REINDEX",
+#endif
+#if SQLITE_OMIT_SCHEMA_PRAGMAS
+ "OMIT_SCHEMA_PRAGMAS",
+#endif
+#if SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
+ "OMIT_SCHEMA_VERSION_PRAGMAS",
+#endif
+#if SQLITE_OMIT_SHARED_CACHE
+ "OMIT_SHARED_CACHE",
+#endif
+#if SQLITE_OMIT_SHUTDOWN_DIRECTORIES
+ "OMIT_SHUTDOWN_DIRECTORIES",
+#endif
+#if SQLITE_OMIT_SUBQUERY
+ "OMIT_SUBQUERY",
+#endif
+#if SQLITE_OMIT_TCL_VARIABLE
+ "OMIT_TCL_VARIABLE",
+#endif
+#if SQLITE_OMIT_TEMPDB
+ "OMIT_TEMPDB",
+#endif
+#if SQLITE_OMIT_TEST_CONTROL
+ "OMIT_TEST_CONTROL",
+#endif
+#if SQLITE_OMIT_TRACE
+ "OMIT_TRACE",
+#endif
+#if SQLITE_OMIT_TRIGGER
+ "OMIT_TRIGGER",
+#endif
+#if SQLITE_OMIT_TRUNCATE_OPTIMIZATION
+ "OMIT_TRUNCATE_OPTIMIZATION",
+#endif
+#if SQLITE_OMIT_UTF16
+ "OMIT_UTF16",
+#endif
+#if SQLITE_OMIT_VACUUM
+ "OMIT_VACUUM",
+#endif
+#if SQLITE_OMIT_VIEW
+ "OMIT_VIEW",
+#endif
+#if SQLITE_OMIT_VIRTUALTABLE
+ "OMIT_VIRTUALTABLE",
+#endif
+#if SQLITE_OMIT_WAL
+ "OMIT_WAL",
+#endif
+#if SQLITE_OMIT_WSD
+ "OMIT_WSD",
+#endif
+#if SQLITE_OMIT_XFER_OPT
+ "OMIT_XFER_OPT",
+#endif
+#if SQLITE_PCACHE_SEPARATE_HEADER
+ "PCACHE_SEPARATE_HEADER",
+#endif
+#if SQLITE_PERFORMANCE_TRACE
+ "PERFORMANCE_TRACE",
+#endif
+#if SQLITE_POWERSAFE_OVERWRITE
+ "POWERSAFE_OVERWRITE",
+#endif
+#if SQLITE_PREFER_PROXY_LOCKING
+ "PREFER_PROXY_LOCKING",
+#endif
+#if SQLITE_PROXY_DEBUG
+ "PROXY_DEBUG",
+#endif
+#if SQLITE_REVERSE_UNORDERED_SELECTS
+ "REVERSE_UNORDERED_SELECTS",
+#endif
+#if SQLITE_RTREE_INT_ONLY
+ "RTREE_INT_ONLY",
+#endif
+#if SQLITE_SECURE_DELETE
+ "SECURE_DELETE",
+#endif
+#if SQLITE_SMALL_STACK
+ "SMALL_STACK",
+#endif
+#ifdef SQLITE_SORTER_PMASZ
+ "SORTER_PMASZ=" CTIMEOPT_VAL(SQLITE_SORTER_PMASZ),
+#endif
+#if SQLITE_SOUNDEX
+ "SOUNDEX",
+#endif
+#ifdef SQLITE_STAT4_SAMPLES
+ "STAT4_SAMPLES=" CTIMEOPT_VAL(SQLITE_STAT4_SAMPLES),
+#endif
+#ifdef SQLITE_STMTJRNL_SPILL
+ "STMTJRNL_SPILL=" CTIMEOPT_VAL(SQLITE_STMTJRNL_SPILL),
+#endif
+#if SQLITE_SUBSTR_COMPATIBILITY
+ "SUBSTR_COMPATIBILITY",
+#endif
+#if SQLITE_SYSTEM_MALLOC
+ "SYSTEM_MALLOC",
+#endif
+#if SQLITE_TCL
+ "TCL",
+#endif
+#ifdef SQLITE_TEMP_STORE
+ "TEMP_STORE=" CTIMEOPT_VAL(SQLITE_TEMP_STORE),
+#endif
+#if SQLITE_TEST
+ "TEST",
+#endif
+#if defined(SQLITE_THREADSAFE)
+ "THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE),
+#elif defined(THREADSAFE)
+ "THREADSAFE=" CTIMEOPT_VAL(THREADSAFE),
+#else
+ "THREADSAFE=1",
+#endif
+#if SQLITE_UNLINK_AFTER_CLOSE
+ "UNLINK_AFTER_CLOSE",
+#endif
+#if SQLITE_UNTESTABLE
+ "UNTESTABLE",
+#endif
+#if SQLITE_USER_AUTHENTICATION
+ "USER_AUTHENTICATION",
+#endif
+#if SQLITE_USE_ALLOCA
+ "USE_ALLOCA",
+#endif
+#if SQLITE_USE_FCNTL_TRACE
+ "USE_FCNTL_TRACE",
+#endif
+#if SQLITE_USE_URI
+ "USE_URI",
+#endif
+#if SQLITE_VDBE_COVERAGE
+ "VDBE_COVERAGE",
+#endif
+#if SQLITE_WIN32_MALLOC
+ "WIN32_MALLOC",
+#endif
+#if SQLITE_ZERO_MALLOC
+ "ZERO_MALLOC",
+#endif
+/*
+** END CODE GENERATED BY tool/mkctime.tcl
+*/
+};
+
+SQLITE_PRIVATE const char **sqlite3CompileOptions(int *pnOpt){
+ *pnOpt = sizeof(sqlite3azCompileOpt) / sizeof(sqlite3azCompileOpt[0]);
+ return (const char**)sqlite3azCompileOpt;
+}
+
+#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
+
+/************** End of ctime.c ***********************************************/
/************** Begin file sqliteInt.h ***************************************/
/*
** 2001 September 15
@@ -76,14 +831,6 @@
#endif
/*
-** Make sure that rand_s() is available on Windows systems with MSVC 2005
-** or higher.
-*/
-#if defined(_MSC_VER) && _MSC_VER>=1400
-# define _CRT_RAND_S
-#endif
-
-/*
** Include the header file used to customize the compiler options for MSVC.
** This should be done first so that it can successfully prevent spurious
** compiler warnings due to subsequent content in this file and other files
@@ -276,7 +1023,7 @@
/************** Include sqlite3.h in the middle of sqliteInt.h ***************/
/************** Begin file sqlite3.h *****************************************/
/*
-** 2001 September 15
+** 2001-09-15
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
@@ -392,15 +1139,17 @@ extern "C" {
** a string which identifies a particular check-in of SQLite
** within its configuration management system. ^The SQLITE_SOURCE_ID
** string contains the date and time of the check-in (UTC) and a SHA1
-** or SHA3-256 hash of the entire source tree.
+** or SHA3-256 hash of the entire source tree. If the source code has
+** been edited in any way since it was last checked in, then the last
+** four hexadecimal digits of the hash may be modified.
**
** See also: [sqlite3_libversion()],
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
-#define SQLITE_VERSION "3.19.3"
-#define SQLITE_VERSION_NUMBER 3019003
-#define SQLITE_SOURCE_ID "2017-06-08 14:26:16 0ee482a1e0eae22e08edc8978c9733a96603d4509645f348ebf55b579e89636b"
+#define SQLITE_VERSION "3.21.0"
+#define SQLITE_VERSION_NUMBER 3021000
+#define SQLITE_SOURCE_ID "2017-10-24 18:55:49 1a584e499906b5c87ec7d43d4abce641fdf017c42125b083109bc77c4de48827"
/*
** CAPI3REF: Run-Time Library Version Numbers
@@ -416,7 +1165,7 @@ extern "C" {
**
** <blockquote><pre>
** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER );
-** assert( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)==0 );
+** assert( strncmp(sqlite3_sourceid(),SQLITE_SOURCE_ID,80)==0 );
** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );
** </pre></blockquote>)^
**
@@ -426,9 +1175,11 @@ extern "C" {
** function is provided for use in DLLs since DLL users usually do not have
** direct access to string constants within the DLL. ^The
** sqlite3_libversion_number() function returns an integer equal to
-** [SQLITE_VERSION_NUMBER]. ^The sqlite3_sourceid() function returns
+** [SQLITE_VERSION_NUMBER]. ^(The sqlite3_sourceid() function returns
** a pointer to a string constant whose value is the same as the
-** [SQLITE_SOURCE_ID] C preprocessor macro.
+** [SQLITE_SOURCE_ID] C preprocessor macro. Except if SQLite is built
+** using an edited copy of [the amalgamation], then the last four characters
+** of the hash might be different from [SQLITE_SOURCE_ID].)^
**
** See also: [sqlite_version()] and [sqlite_source_id()].
*/
@@ -694,7 +1445,7 @@ SQLITE_API int sqlite3_exec(
*/
#define SQLITE_OK 0 /* Successful result */
/* beginning-of-error-codes */
-#define SQLITE_ERROR 1 /* SQL error or missing database */
+#define SQLITE_ERROR 1 /* Generic error */
#define SQLITE_INTERNAL 2 /* Internal logic error in SQLite */
#define SQLITE_PERM 3 /* Access permission denied */
#define SQLITE_ABORT 4 /* Callback routine requested an abort */
@@ -709,7 +1460,7 @@ SQLITE_API int sqlite3_exec(
#define SQLITE_FULL 13 /* Insertion failed because database is full */
#define SQLITE_CANTOPEN 14 /* Unable to open the database file */
#define SQLITE_PROTOCOL 15 /* Database lock protocol error */
-#define SQLITE_EMPTY 16 /* Database is empty */
+#define SQLITE_EMPTY 16 /* Internal use only */
#define SQLITE_SCHEMA 17 /* The database schema changed */
#define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */
#define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */
@@ -717,7 +1468,7 @@ SQLITE_API int sqlite3_exec(
#define SQLITE_MISUSE 21 /* Library used incorrectly */
#define SQLITE_NOLFS 22 /* Uses OS features not supported on host */
#define SQLITE_AUTH 23 /* Authorization denied */
-#define SQLITE_FORMAT 24 /* Auxiliary database format error */
+#define SQLITE_FORMAT 24 /* Not used */
#define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */
#define SQLITE_NOTADB 26 /* File opened that is not a database file */
#define SQLITE_NOTICE 27 /* Notifications from sqlite3_log() */
@@ -771,6 +1522,9 @@ SQLITE_API int sqlite3_exec(
#define SQLITE_IOERR_CONVPATH (SQLITE_IOERR | (26<<8))
#define SQLITE_IOERR_VNODE (SQLITE_IOERR | (27<<8))
#define SQLITE_IOERR_AUTH (SQLITE_IOERR | (28<<8))
+#define SQLITE_IOERR_BEGIN_ATOMIC (SQLITE_IOERR | (29<<8))
+#define SQLITE_IOERR_COMMIT_ATOMIC (SQLITE_IOERR | (30<<8))
+#define SQLITE_IOERR_ROLLBACK_ATOMIC (SQLITE_IOERR | (31<<8))
#define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8))
#define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8))
#define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8))
@@ -857,6 +1611,11 @@ SQLITE_API int sqlite3_exec(
** SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on
** read-only media and cannot be changed even by processes with
** elevated privileges.
+**
+** The SQLITE_IOCAP_BATCH_ATOMIC property means that the underlying
+** filesystem supports doing multiple write operations atomically when those
+** write operations are bracketed by [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] and
+** [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE].
*/
#define SQLITE_IOCAP_ATOMIC 0x00000001
#define SQLITE_IOCAP_ATOMIC512 0x00000002
@@ -872,6 +1631,7 @@ SQLITE_API int sqlite3_exec(
#define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800
#define SQLITE_IOCAP_POWERSAFE_OVERWRITE 0x00001000
#define SQLITE_IOCAP_IMMUTABLE 0x00002000
+#define SQLITE_IOCAP_BATCH_ATOMIC 0x00004000
/*
** CAPI3REF: File Locking Levels
@@ -1006,6 +1766,7 @@ struct sqlite3_file {
** <li> [SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN]
** <li> [SQLITE_IOCAP_POWERSAFE_OVERWRITE]
** <li> [SQLITE_IOCAP_IMMUTABLE]
+** <li> [SQLITE_IOCAP_BATCH_ATOMIC]
** </ul>
**
** The SQLITE_IOCAP_ATOMIC property means that all writes of
@@ -1289,6 +2050,40 @@ struct sqlite3_io_methods {
** The [SQLITE_FCNTL_RBU] opcode is implemented by the special VFS used by
** the RBU extension only. All other VFS should return SQLITE_NOTFOUND for
** this opcode.
+**
+** <li>[[SQLITE_FCNTL_BEGIN_ATOMIC_WRITE]]
+** If the [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] opcode returns SQLITE_OK, then
+** the file descriptor is placed in "batch write mode", which
+** means all subsequent write operations will be deferred and done
+** atomically at the next [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]. Systems
+** that do not support batch atomic writes will return SQLITE_NOTFOUND.
+** ^Following a successful SQLITE_FCNTL_BEGIN_ATOMIC_WRITE and prior to
+** the closing [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] or
+** [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE], SQLite will make
+** no VFS interface calls on the same [sqlite3_file] file descriptor
+** except for calls to the xWrite method and the xFileControl method
+** with [SQLITE_FCNTL_SIZE_HINT].
+**
+** <li>[[SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]]
+** The [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] opcode causes all write
+** operations since the previous successful call to
+** [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be performed atomically.
+** This file control returns [SQLITE_OK] if and only if the writes were
+** all performed successfully and have been committed to persistent storage.
+** ^Regardless of whether or not it is successful, this file control takes
+** the file descriptor out of batch write mode so that all subsequent
+** write operations are independent.
+** ^SQLite will never invoke SQLITE_FCNTL_COMMIT_ATOMIC_WRITE without
+** a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE].
+**
+** <li>[[SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE]]
+** The [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE] opcode causes all write
+** operations since the previous successful call to
+** [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be rolled back.
+** ^This file control takes the file descriptor out of batch write mode
+** so that all subsequent write operations are independent.
+** ^SQLite will never invoke SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE without
+** a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE].
** </ul>
*/
#define SQLITE_FCNTL_LOCKSTATE 1
@@ -1320,6 +2115,9 @@ struct sqlite3_io_methods {
#define SQLITE_FCNTL_JOURNAL_POINTER 28
#define SQLITE_FCNTL_WIN32_GET_HANDLE 29
#define SQLITE_FCNTL_PDB 30
+#define SQLITE_FCNTL_BEGIN_ATOMIC_WRITE 31
+#define SQLITE_FCNTL_COMMIT_ATOMIC_WRITE 32
+#define SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33
/* deprecated names */
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
@@ -1890,6 +2688,16 @@ struct sqlite3_mem_methods {
** routines with a wrapper that simulations memory allocation failure or
** tracks memory usage, for example. </dd>
**
+** [[SQLITE_CONFIG_SMALL_MALLOC]] <dt>SQLITE_CONFIG_SMALL_MALLOC</dt>
+** <dd> ^The SQLITE_CONFIG_SMALL_MALLOC option takes single argument of
+** type int, interpreted as a boolean, which if true provides a hint to
+** SQLite that it should avoid large memory allocations if possible.
+** SQLite will run faster if it is free to make large memory allocations,
+** but some application might prefer to run slower in exchange for
+** guarantees about memory fragmentation that are possible if large
+** allocations are avoided. This hint is normally off.
+** </dd>
+**
** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt>
** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int,
** interpreted as a boolean, which enables or disables the collection of
@@ -1907,25 +2715,7 @@ struct sqlite3_mem_methods {
** </dd>
**
** [[SQLITE_CONFIG_SCRATCH]] <dt>SQLITE_CONFIG_SCRATCH</dt>
-** <dd> ^The SQLITE_CONFIG_SCRATCH option specifies a static memory buffer
-** that SQLite can use for scratch memory. ^(There are three arguments
-** to SQLITE_CONFIG_SCRATCH: A pointer an 8-byte
-** aligned memory buffer from which the scratch allocations will be
-** drawn, the size of each scratch allocation (sz),
-** and the maximum number of scratch allocations (N).)^
-** The first argument must be a pointer to an 8-byte aligned buffer
-** of at least sz*N bytes of memory.
-** ^SQLite will not use more than one scratch buffers per thread.
-** ^SQLite will never request a scratch buffer that is more than 6
-** times the database page size.
-** ^If SQLite needs needs additional
-** scratch memory beyond what is provided by this configuration option, then
-** [sqlite3_malloc()] will be used to obtain the memory needed.<p>
-** ^When the application provides any amount of scratch memory using
-** SQLITE_CONFIG_SCRATCH, SQLite avoids unnecessary large
-** [sqlite3_malloc|heap allocations].
-** This can help [Robson proof|prevent memory allocation failures] due to heap
-** fragmentation in low-memory embedded systems.
+** <dd> The SQLITE_CONFIG_SCRATCH option is no longer used.
** </dd>
**
** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt>
@@ -1961,8 +2751,7 @@ struct sqlite3_mem_methods {
** [[SQLITE_CONFIG_HEAP]] <dt>SQLITE_CONFIG_HEAP</dt>
** <dd> ^The SQLITE_CONFIG_HEAP option specifies a static memory buffer
** that SQLite will use for all of its dynamic memory allocation needs
-** beyond those provided for by [SQLITE_CONFIG_SCRATCH] and
-** [SQLITE_CONFIG_PAGECACHE].
+** beyond those provided for by [SQLITE_CONFIG_PAGECACHE].
** ^The SQLITE_CONFIG_HEAP option is only available if SQLite is compiled
** with either [SQLITE_ENABLE_MEMSYS3] or [SQLITE_ENABLE_MEMSYS5] and returns
** [SQLITE_ERROR] if invoked otherwise.
@@ -2155,7 +2944,7 @@ struct sqlite3_mem_methods {
#define SQLITE_CONFIG_SERIALIZED 3 /* nil */
#define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
#define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */
-#define SQLITE_CONFIG_SCRATCH 6 /* void*, int sz, int N */
+#define SQLITE_CONFIG_SCRATCH 6 /* No longer used */
#define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */
#define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */
#define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */
@@ -2176,6 +2965,7 @@ struct sqlite3_mem_methods {
#define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
#define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
#define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */
+#define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
/*
** CAPI3REF: Database Connection Configuration Options
@@ -2284,6 +3074,17 @@ struct sqlite3_mem_methods {
** have been disabled - 0 if they are not disabled, 1 if they are.
** </dd>
**
+** <dt>SQLITE_DBCONFIG_ENABLE_QPSG</dt>
+** <dd>^(The SQLITE_DBCONFIG_ENABLE_QPSG option activates or deactivates
+** the [query planner stability guarantee] (QPSG). When the QPSG is active,
+** a single SQL query statement will always use the same algorithm regardless
+** of values of [bound parameters].)^ The QPSG disables some query optimizations
+** that look at the values of bound parameters, which can make some queries
+** slower. But the QPSG has the advantage of more predictable behavior. With
+** the QPSG active, SQLite will always use the same query plan in the field as
+** was used during testing in the lab.
+** </dd>
+**
** </dl>
*/
#define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
@@ -2293,6 +3094,7 @@ struct sqlite3_mem_methods {
#define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */
#define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */
#define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006 /* int int* */
+#define SQLITE_DBCONFIG_ENABLE_QPSG 1007 /* int int* */
/*
@@ -2956,7 +3758,8 @@ SQLITE_API void sqlite3_randomness(int N, void *P);
** [database connection], supplied in the first argument.
** ^The authorizer callback is invoked as SQL statements are being compiled
** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()],
-** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()]. ^At various
+** [sqlite3_prepare_v3()], [sqlite3_prepare16()], [sqlite3_prepare16_v2()],
+** and [sqlite3_prepare16_v3()]. ^At various
** points during the compilation process, as logic is being created
** to perform various actions, the authorizer callback is invoked to
** see if those actions are allowed. ^The authorizer callback should
@@ -3363,10 +4166,10 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
** ^If [URI filename] interpretation is enabled, and the filename argument
** begins with "file:", then the filename is interpreted as a URI. ^URI
** filename interpretation is enabled if the [SQLITE_OPEN_URI] flag is
-** set in the fourth argument to sqlite3_open_v2(), or if it has
+** set in the third argument to sqlite3_open_v2(), or if it has
** been enabled globally using the [SQLITE_CONFIG_URI] option with the
** [sqlite3_config()] method or by the [SQLITE_USE_URI] compile-time option.
-** As of SQLite version 3.7.7, URI filename interpretation is turned off
+** URI filename interpretation is turned off
** by default, but future releases of SQLite might enable URI filename
** interpretation by default. See "[URI filenames]" for additional
** information.
@@ -3745,6 +4548,29 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
#define SQLITE_LIMIT_TRIGGER_DEPTH 10
#define SQLITE_LIMIT_WORKER_THREADS 11
+/*
+** CAPI3REF: Prepare Flags
+**
+** These constants define various flags that can be passed into
+** "prepFlags" parameter of the [sqlite3_prepare_v3()] and
+** [sqlite3_prepare16_v3()] interfaces.
+**
+** New flags may be added in future releases of SQLite.
+**
+** <dl>
+** [[SQLITE_PREPARE_PERSISTENT]] ^(<dt>SQLITE_PREPARE_PERSISTENT</dt>
+** <dd>The SQLITE_PREPARE_PERSISTENT flag is a hint to the query planner
+** that the prepared statement will be retained for a long time and
+** probably reused many times.)^ ^Without this flag, [sqlite3_prepare_v3()]
+** and [sqlite3_prepare16_v3()] assume that the prepared statement will
+** be used just once or at most a few times and then destroyed using
+** [sqlite3_finalize()] relatively soon. The current implementation acts
+** on this hint by avoiding the use of [lookaside memory] so as not to
+** deplete the limited store of lookaside memory. Future versions of
+** SQLite may act on this hint differently.
+** </dl>
+*/
+#define SQLITE_PREPARE_PERSISTENT 0x01
/*
** CAPI3REF: Compiling An SQL Statement
@@ -3752,17 +4578,29 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
** METHOD: sqlite3
** CONSTRUCTOR: sqlite3_stmt
**
-** To execute an SQL query, it must first be compiled into a byte-code
-** program using one of these routines.
+** To execute an SQL statement, it must first be compiled into a byte-code
+** program using one of these routines. Or, in other words, these routines
+** are constructors for the [prepared statement] object.
+**
+** The preferred routine to use is [sqlite3_prepare_v2()]. The
+** [sqlite3_prepare()] interface is legacy and should be avoided.
+** [sqlite3_prepare_v3()] has an extra "prepFlags" option that is used
+** for special purposes.
+**
+** The use of the UTF-8 interfaces is preferred, as SQLite currently
+** does all parsing using UTF-8. The UTF-16 interfaces are provided
+** as a convenience. The UTF-16 interfaces work by converting the
+** input text into UTF-8, then invoking the corresponding UTF-8 interface.
**
** The first argument, "db", is a [database connection] obtained from a
** prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or
** [sqlite3_open16()]. The database connection must not have been closed.
**
** The second argument, "zSql", is the statement to be compiled, encoded
-** as either UTF-8 or UTF-16. The sqlite3_prepare() and sqlite3_prepare_v2()
-** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2()
-** use UTF-16.
+** as either UTF-8 or UTF-16. The sqlite3_prepare(), sqlite3_prepare_v2(),
+** and sqlite3_prepare_v3()
+** interfaces use UTF-8, and sqlite3_prepare16(), sqlite3_prepare16_v2(),
+** and sqlite3_prepare16_v3() use UTF-16.
**
** ^If the nByte argument is negative, then zSql is read up to the
** first zero terminator. ^If nByte is positive, then it is the
@@ -3789,10 +4627,11 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
** ^On success, the sqlite3_prepare() family of routines return [SQLITE_OK];
** otherwise an [error code] is returned.
**
-** The sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces are
-** recommended for all new programs. The two older interfaces are retained
-** for backwards compatibility, but their use is discouraged.
-** ^In the "v2" interfaces, the prepared statement
+** The sqlite3_prepare_v2(), sqlite3_prepare_v3(), sqlite3_prepare16_v2(),
+** and sqlite3_prepare16_v3() interfaces are recommended for all new programs.
+** The older interfaces (sqlite3_prepare() and sqlite3_prepare16())
+** are retained for backwards compatibility, but their use is discouraged.
+** ^In the "vX" interfaces, the prepared statement
** that is returned (the [sqlite3_stmt] object) contains a copy of the
** original SQL text. This causes the [sqlite3_step()] interface to
** behave differently in three ways:
@@ -3825,6 +4664,12 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
** or [GLOB] operator or if the parameter is compared to an indexed column
** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled.
** </li>
+**
+** <p>^sqlite3_prepare_v3() differs from sqlite3_prepare_v2() only in having
+** the extra prepFlags parameter, which is a bit array consisting of zero or
+** more of the [SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_*] flags. ^The
+** sqlite3_prepare_v2() interface works exactly the same as
+** sqlite3_prepare_v3() with a zero prepFlags parameter.
** </ol>
*/
SQLITE_API int sqlite3_prepare(
@@ -3841,6 +4686,14 @@ SQLITE_API int sqlite3_prepare_v2(
sqlite3_stmt **ppStmt, /* OUT: Statement handle */
const char **pzTail /* OUT: Pointer to unused portion of zSql */
);
+SQLITE_API int sqlite3_prepare_v3(
+ sqlite3 *db, /* Database handle */
+ const char *zSql, /* SQL statement, UTF-8 encoded */
+ int nByte, /* Maximum length of zSql in bytes. */
+ unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_ flags */
+ sqlite3_stmt **ppStmt, /* OUT: Statement handle */
+ const char **pzTail /* OUT: Pointer to unused portion of zSql */
+);
SQLITE_API int sqlite3_prepare16(
sqlite3 *db, /* Database handle */
const void *zSql, /* SQL statement, UTF-16 encoded */
@@ -3855,6 +4708,14 @@ SQLITE_API int sqlite3_prepare16_v2(
sqlite3_stmt **ppStmt, /* OUT: Statement handle */
const void **pzTail /* OUT: Pointer to unused portion of zSql */
);
+SQLITE_API int sqlite3_prepare16_v3(
+ sqlite3 *db, /* Database handle */
+ const void *zSql, /* SQL statement, UTF-16 encoded */
+ int nByte, /* Maximum length of zSql in bytes. */
+ unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_ flags */
+ sqlite3_stmt **ppStmt, /* OUT: Statement handle */
+ const void **pzTail /* OUT: Pointer to unused portion of zSql */
+);
/*
** CAPI3REF: Retrieving Statement SQL
@@ -3862,7 +4723,8 @@ SQLITE_API int sqlite3_prepare16_v2(
**
** ^The sqlite3_sql(P) interface returns a pointer to a copy of the UTF-8
** SQL text used to create [prepared statement] P if P was
-** created by either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()].
+** created by [sqlite3_prepare_v2()], [sqlite3_prepare_v3()],
+** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()].
** ^The sqlite3_expanded_sql(P) interface returns a pointer to a UTF-8
** string containing the SQL text of prepared statement P with
** [bound parameters] expanded.
@@ -3981,8 +4843,9 @@ SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*);
** implementation of [application-defined SQL functions] are protected.
** ^The sqlite3_value object returned by
** [sqlite3_column_value()] is unprotected.
-** Unprotected sqlite3_value objects may only be used with
-** [sqlite3_result_value()] and [sqlite3_bind_value()].
+** Unprotected sqlite3_value objects may only be used as arguments
+** to [sqlite3_result_value()], [sqlite3_bind_value()], and
+** [sqlite3_value_dup()].
** The [sqlite3_value_blob | sqlite3_value_type()] family of
** interfaces require protected sqlite3_value objects.
*/
@@ -4088,6 +4951,15 @@ typedef struct sqlite3_context sqlite3_context;
** [sqlite3_blob_open | incremental BLOB I/O] routines.
** ^A negative value for the zeroblob results in a zero-length BLOB.
**
+** ^The sqlite3_bind_pointer(S,I,P,T,D) routine causes the I-th parameter in
+** [prepared statement] S to have an SQL value of NULL, but to also be
+** associated with the pointer P of type T. ^D is either a NULL pointer or
+** a pointer to a destructor function for P. ^SQLite will invoke the
+** destructor D with a single argument of P when it is finished using
+** P. The T parameter should be a static string, preferably a string
+** literal. The sqlite3_bind_pointer() routine is part of the
+** [pointer passing interface] added for SQLite 3.20.0.
+**
** ^If any of the sqlite3_bind_*() routines are called with a NULL pointer
** for the [prepared statement] or with a prepared statement for which
** [sqlite3_step()] has been called more recently than [sqlite3_reset()],
@@ -4121,6 +4993,7 @@ SQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)
SQLITE_API int sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint64,
void(*)(void*), unsigned char encoding);
SQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
+SQLITE_API int sqlite3_bind_pointer(sqlite3_stmt*, int, void*, const char*,void(*)(void*));
SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
SQLITE_API int sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite3_uint64);
@@ -4164,8 +5037,8 @@ SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*);
** ^If the value N is out of range or if the N-th parameter is
** nameless, then NULL is returned. ^The returned string is
** always in UTF-8 encoding even if the named parameter was
-** originally specified as UTF-16 in [sqlite3_prepare16()] or
-** [sqlite3_prepare16_v2()].
+** originally specified as UTF-16 in [sqlite3_prepare16()],
+** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()].
**
** See also: [sqlite3_bind_blob|sqlite3_bind()],
** [sqlite3_bind_parameter_count()], and
@@ -4182,7 +5055,8 @@ SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int);
** parameter to [sqlite3_bind_blob|sqlite3_bind()]. ^A zero
** is returned if no matching parameter is found. ^The parameter
** name must be given in UTF-8 even if the original statement
-** was prepared from UTF-16 text using [sqlite3_prepare16_v2()].
+** was prepared from UTF-16 text using [sqlite3_prepare16_v2()] or
+** [sqlite3_prepare16_v3()].
**
** See also: [sqlite3_bind_blob|sqlite3_bind()],
** [sqlite3_bind_parameter_count()], and
@@ -4336,16 +5210,18 @@ SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
** CAPI3REF: Evaluate An SQL Statement
** METHOD: sqlite3_stmt
**
-** After a [prepared statement] has been prepared using either
-** [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] or one of the legacy
+** After a [prepared statement] has been prepared using any of
+** [sqlite3_prepare_v2()], [sqlite3_prepare_v3()], [sqlite3_prepare16_v2()],
+** or [sqlite3_prepare16_v3()] or one of the legacy
** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function
** must be called one or more times to evaluate the statement.
**
** The details of the behavior of the sqlite3_step() interface depend
-** on whether the statement was prepared using the newer "v2" interface
-** [sqlite3_prepare_v2()] and [sqlite3_prepare16_v2()] or the older legacy
-** interface [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the
-** new "v2" interface is recommended for new applications but the legacy
+** on whether the statement was prepared using the newer "vX" interfaces
+** [sqlite3_prepare_v3()], [sqlite3_prepare_v2()], [sqlite3_prepare16_v3()],
+** [sqlite3_prepare16_v2()] or the older legacy
+** interfaces [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the
+** new "vX" interface is recommended for new applications but the legacy
** interface will continue to be supported.
**
** ^In the legacy interface, the return value will be either [SQLITE_BUSY],
@@ -4406,10 +5282,11 @@ SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
** specific [error codes] that better describes the error.
** We admit that this is a goofy design. The problem has been fixed
** with the "v2" interface. If you prepare all of your SQL statements
-** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead
+** using [sqlite3_prepare_v3()] or [sqlite3_prepare_v2()]
+** or [sqlite3_prepare16_v2()] or [sqlite3_prepare16_v3()] instead
** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces,
** then the more specific [error codes] are returned directly
-** by sqlite3_step(). The use of the "v2" interface is recommended.
+** by sqlite3_step(). The use of the "vX" interfaces is recommended.
*/
SQLITE_API int sqlite3_step(sqlite3_stmt*);
@@ -4471,6 +5348,28 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
** KEYWORDS: {column access functions}
** METHOD: sqlite3_stmt
**
+** <b>Summary:</b>
+** <blockquote><table border=0 cellpadding=0 cellspacing=0>
+** <tr><td><b>sqlite3_column_blob</b><td>&rarr;<td>BLOB result
+** <tr><td><b>sqlite3_column_double</b><td>&rarr;<td>REAL result
+** <tr><td><b>sqlite3_column_int</b><td>&rarr;<td>32-bit INTEGER result
+** <tr><td><b>sqlite3_column_int64</b><td>&rarr;<td>64-bit INTEGER result
+** <tr><td><b>sqlite3_column_text</b><td>&rarr;<td>UTF-8 TEXT result
+** <tr><td><b>sqlite3_column_text16</b><td>&rarr;<td>UTF-16 TEXT result
+** <tr><td><b>sqlite3_column_value</b><td>&rarr;<td>The result as an
+** [sqlite3_value|unprotected sqlite3_value] object.
+** <tr><td>&nbsp;<td>&nbsp;<td>&nbsp;
+** <tr><td><b>sqlite3_column_bytes</b><td>&rarr;<td>Size of a BLOB
+** or a UTF-8 TEXT result in bytes
+** <tr><td><b>sqlite3_column_bytes16&nbsp;&nbsp;</b>
+** <td>&rarr;&nbsp;&nbsp;<td>Size of UTF-16
+** TEXT in bytes
+** <tr><td><b>sqlite3_column_type</b><td>&rarr;<td>Default
+** datatype of the result
+** </table></blockquote>
+**
+** <b>Details:</b>
+**
** ^These routines return information about a single column of the current
** result row of a query. ^In every case the first argument is a pointer
** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*]
@@ -4492,16 +5391,29 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
** are called from a different thread while any of these routines
** are pending, then the results are undefined.
**
+** The first six interfaces (_blob, _double, _int, _int64, _text, and _text16)
+** each return the value of a result column in a specific data format. If
+** the result column is not initially in the requested format (for example,
+** if the query returns an integer but the sqlite3_column_text() interface
+** is used to extract the value) then an automatic type conversion is performed.
+**
** ^The sqlite3_column_type() routine returns the
** [SQLITE_INTEGER | datatype code] for the initial data type
** of the result column. ^The returned value is one of [SQLITE_INTEGER],
-** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL]. The value
-** returned by sqlite3_column_type() is only meaningful if no type
-** conversions have occurred as described below. After a type conversion,
-** the value returned by sqlite3_column_type() is undefined. Future
+** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].
+** The return value of sqlite3_column_type() can be used to decide which
+** of the first six interface should be used to extract the column value.
+** The value returned by sqlite3_column_type() is only meaningful if no
+** automatic type conversions have occurred for the value in question.
+** After a type conversion, the result of calling sqlite3_column_type()
+** is undefined, though harmless. Future
** versions of SQLite may change the behavior of sqlite3_column_type()
** following a type conversion.
**
+** If the result is a BLOB or a TEXT string, then the sqlite3_column_bytes()
+** or sqlite3_column_bytes16() interfaces can be used to determine the size
+** of that BLOB or string.
+**
** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes()
** routine returns the number of bytes in that BLOB or string.
** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts
@@ -4538,9 +5450,13 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
** [sqlite3_column_value()] is used in any other way, including calls
** to routines like [sqlite3_value_int()], [sqlite3_value_text()],
** or [sqlite3_value_bytes()], the behavior is not threadsafe.
+** Hence, the sqlite3_column_value() interface
+** is normally only useful within the implementation of
+** [application-defined SQL functions] or [virtual tables], not within
+** top-level application code.
**
-** These routines attempt to convert the value where appropriate. ^For
-** example, if the internal representation is FLOAT and a text result
+** The these routines may attempt to convert the datatype of the result.
+** ^For example, if the internal representation is FLOAT and a text result
** is requested, [sqlite3_snprintf()] is used internally to perform the
** conversion automatically. ^(The following table details the conversions
** that are applied:
@@ -4612,7 +5528,7 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
** ^The pointers returned are valid until a type conversion occurs as
** described above, or until [sqlite3_step()] or [sqlite3_reset()] or
** [sqlite3_finalize()] is called. ^The memory space used to hold strings
-** and BLOBs is freed automatically. Do <em>not</em> pass the pointers returned
+** and BLOBs is freed automatically. Do not pass the pointers returned
** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into
** [sqlite3_free()].
**
@@ -4623,15 +5539,15 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
** [SQLITE_NOMEM].)^
*/
SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
-SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
-SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol);
SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol);
SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);
SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);
SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);
-SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);
+SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
+SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
+SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
/*
** CAPI3REF: Destroy A Prepared Statement Object
@@ -4865,21 +5781,40 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
** CAPI3REF: Obtaining SQL Values
** METHOD: sqlite3_value
**
-** The C-language implementation of SQL functions and aggregates uses
-** this set of interface routines to access the parameter values on
-** the function or aggregate.
-**
-** The xFunc (for scalar functions) or xStep (for aggregates) parameters
-** to [sqlite3_create_function()] and [sqlite3_create_function16()]
-** define callbacks that implement the SQL functions and aggregates.
-** The 3rd parameter to these callbacks is an array of pointers to
-** [protected sqlite3_value] objects. There is one [sqlite3_value] object for
-** each parameter to the SQL function. These routines are used to
-** extract values from the [sqlite3_value] objects.
+** <b>Summary:</b>
+** <blockquote><table border=0 cellpadding=0 cellspacing=0>
+** <tr><td><b>sqlite3_value_blob</b><td>&rarr;<td>BLOB value
+** <tr><td><b>sqlite3_value_double</b><td>&rarr;<td>REAL value
+** <tr><td><b>sqlite3_value_int</b><td>&rarr;<td>32-bit INTEGER value
+** <tr><td><b>sqlite3_value_int64</b><td>&rarr;<td>64-bit INTEGER value
+** <tr><td><b>sqlite3_value_pointer</b><td>&rarr;<td>Pointer value
+** <tr><td><b>sqlite3_value_text</b><td>&rarr;<td>UTF-8 TEXT value
+** <tr><td><b>sqlite3_value_text16</b><td>&rarr;<td>UTF-16 TEXT value in
+** the native byteorder
+** <tr><td><b>sqlite3_value_text16be</b><td>&rarr;<td>UTF-16be TEXT value
+** <tr><td><b>sqlite3_value_text16le</b><td>&rarr;<td>UTF-16le TEXT value
+** <tr><td>&nbsp;<td>&nbsp;<td>&nbsp;
+** <tr><td><b>sqlite3_value_bytes</b><td>&rarr;<td>Size of a BLOB
+** or a UTF-8 TEXT in bytes
+** <tr><td><b>sqlite3_value_bytes16&nbsp;&nbsp;</b>
+** <td>&rarr;&nbsp;&nbsp;<td>Size of UTF-16
+** TEXT in bytes
+** <tr><td><b>sqlite3_value_type</b><td>&rarr;<td>Default
+** datatype of the value
+** <tr><td><b>sqlite3_value_numeric_type&nbsp;&nbsp;</b>
+** <td>&rarr;&nbsp;&nbsp;<td>Best numeric datatype of the value
+** </table></blockquote>
+**
+** <b>Details:</b>
+**
+** These routines extract type, size, and content information from
+** [protected sqlite3_value] objects. Protected sqlite3_value objects
+** are used to pass parameter information into implementation of
+** [application-defined SQL functions] and [virtual tables].
**
** These routines work only with [protected sqlite3_value] objects.
** Any attempt to use these routines on an [unprotected sqlite3_value]
-** object results in undefined behavior.
+** is not threadsafe.
**
** ^These routines work just like the corresponding [column access functions]
** except that these routines take a single [protected sqlite3_value] object
@@ -4890,6 +5825,24 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces
** extract UTF-16 strings as big-endian and little-endian respectively.
**
+** ^If [sqlite3_value] object V was initialized
+** using [sqlite3_bind_pointer(S,I,P,X,D)] or [sqlite3_result_pointer(C,P,X,D)]
+** and if X and Y are strings that compare equal according to strcmp(X,Y),
+** then sqlite3_value_pointer(V,Y) will return the pointer P. ^Otherwise,
+** sqlite3_value_pointer(V,Y) returns a NULL. The sqlite3_bind_pointer()
+** routine is part of the [pointer passing interface] added for SQLite 3.20.0.
+**
+** ^(The sqlite3_value_type(V) interface returns the
+** [SQLITE_INTEGER | datatype code] for the initial datatype of the
+** [sqlite3_value] object V. The returned value is one of [SQLITE_INTEGER],
+** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].)^
+** Other interfaces might change the datatype for an sqlite3_value object.
+** For example, if the datatype is initially SQLITE_INTEGER and
+** sqlite3_value_text(V) is called to extract a text value for that
+** integer, then subsequent calls to sqlite3_value_type(V) might return
+** SQLITE_TEXT. Whether or not a persistent internal datatype conversion
+** occurs is undefined and may change from one release of SQLite to the next.
+**
** ^(The sqlite3_value_numeric_type() interface attempts to apply
** numeric affinity to the value. This means that an attempt is
** made to convert the value to an integer or floating point. If
@@ -4908,15 +5861,16 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
** the SQL function that supplied the [sqlite3_value*] parameters.
*/
SQLITE_API const void *sqlite3_value_blob(sqlite3_value*);
-SQLITE_API int sqlite3_value_bytes(sqlite3_value*);
-SQLITE_API int sqlite3_value_bytes16(sqlite3_value*);
SQLITE_API double sqlite3_value_double(sqlite3_value*);
SQLITE_API int sqlite3_value_int(sqlite3_value*);
SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*);
+SQLITE_API void *sqlite3_value_pointer(sqlite3_value*, const char*);
SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*);
SQLITE_API const void *sqlite3_value_text16(sqlite3_value*);
SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*);
SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*);
+SQLITE_API int sqlite3_value_bytes(sqlite3_value*);
+SQLITE_API int sqlite3_value_bytes16(sqlite3_value*);
SQLITE_API int sqlite3_value_type(sqlite3_value*);
SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
@@ -4929,10 +5883,6 @@ SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
** information can be used to pass a limited amount of context from
** one SQL function to another. Use the [sqlite3_result_subtype()]
** routine to set the subtype for the return value of an SQL function.
-**
-** SQLite makes no use of subtype itself. It merely passes the subtype
-** from the result of one [application-defined SQL function] into the
-** input of another.
*/
SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*);
@@ -5202,7 +6152,7 @@ typedef void (*sqlite3_destructor_type)(void*);
** when it has finished using that result.
** ^If the 4th parameter to the sqlite3_result_text* interfaces
** or sqlite3_result_blob is the special constant SQLITE_TRANSIENT
-** then SQLite makes a copy of the result into space obtained from
+** then SQLite makes a copy of the result into space obtained
** from [sqlite3_malloc()] before it returns.
**
** ^The sqlite3_result_value() interface sets the result of
@@ -5215,6 +6165,17 @@ typedef void (*sqlite3_destructor_type)(void*);
** [unprotected sqlite3_value] object is required, so either
** kind of [sqlite3_value] object can be used with this interface.
**
+** ^The sqlite3_result_pointer(C,P,T,D) interface sets the result to an
+** SQL NULL value, just like [sqlite3_result_null(C)], except that it
+** also associates the host-language pointer P or type T with that
+** NULL value such that the pointer can be retrieved within an
+** [application-defined SQL function] using [sqlite3_value_pointer()].
+** ^If the D parameter is not NULL, then it is a pointer to a destructor
+** for the P parameter. ^SQLite invokes D with P as its only argument
+** when SQLite is finished with P. The T parameter should be a static
+** string and preferably a string literal. The sqlite3_result_pointer()
+** routine is part of the [pointer passing interface] added for SQLite 3.20.0.
+**
** If these routines are called from within the different thread
** than the one containing the application-defined function that received
** the [sqlite3_context] pointer, the results are undefined.
@@ -5238,6 +6199,7 @@ SQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*
SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
SQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
SQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*);
+SQLITE_API void sqlite3_result_pointer(sqlite3_context*, void*,const char*,void(*)(void*));
SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n);
SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);
@@ -5897,7 +6859,9 @@ SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N);
** ^If the column-name parameter to sqlite3_table_column_metadata() is a
** NULL pointer, then this routine simply checks for the existence of the
** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it
-** does not.
+** does not. If the table name parameter T in a call to
+** sqlite3_table_column_metadata(X,D,T,C,...) is NULL then the result is
+** undefined behavior.
**
** ^The column is identified by the second, third and fourth parameters to
** this function. ^(The second parameter is either the name of the database
@@ -6307,15 +7271,20 @@ struct sqlite3_index_info {
** an operator that is part of a constraint term in the wHERE clause of
** a query that uses a [virtual table].
*/
-#define SQLITE_INDEX_CONSTRAINT_EQ 2
-#define SQLITE_INDEX_CONSTRAINT_GT 4
-#define SQLITE_INDEX_CONSTRAINT_LE 8
-#define SQLITE_INDEX_CONSTRAINT_LT 16
-#define SQLITE_INDEX_CONSTRAINT_GE 32
-#define SQLITE_INDEX_CONSTRAINT_MATCH 64
-#define SQLITE_INDEX_CONSTRAINT_LIKE 65
-#define SQLITE_INDEX_CONSTRAINT_GLOB 66
-#define SQLITE_INDEX_CONSTRAINT_REGEXP 67
+#define SQLITE_INDEX_CONSTRAINT_EQ 2
+#define SQLITE_INDEX_CONSTRAINT_GT 4
+#define SQLITE_INDEX_CONSTRAINT_LE 8
+#define SQLITE_INDEX_CONSTRAINT_LT 16
+#define SQLITE_INDEX_CONSTRAINT_GE 32
+#define SQLITE_INDEX_CONSTRAINT_MATCH 64
+#define SQLITE_INDEX_CONSTRAINT_LIKE 65
+#define SQLITE_INDEX_CONSTRAINT_GLOB 66
+#define SQLITE_INDEX_CONSTRAINT_REGEXP 67
+#define SQLITE_INDEX_CONSTRAINT_NE 68
+#define SQLITE_INDEX_CONSTRAINT_ISNOT 69
+#define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70
+#define SQLITE_INDEX_CONSTRAINT_ISNULL 71
+#define SQLITE_INDEX_CONSTRAINT_IS 72
/*
** CAPI3REF: Register A Virtual Table Implementation
@@ -7067,7 +8036,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
#define SQLITE_TESTCTRL_RESERVE 14
#define SQLITE_TESTCTRL_OPTIMIZATIONS 15
#define SQLITE_TESTCTRL_ISKEYWORD 16
-#define SQLITE_TESTCTRL_SCRATCHMALLOC 17
+#define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */
#define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
#define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */
#define SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD 19
@@ -7126,8 +8095,7 @@ SQLITE_API int sqlite3_status64(
** <dd>This parameter is the current amount of memory checked out
** using [sqlite3_malloc()], either directly or indirectly. The
** figure includes calls made to [sqlite3_malloc()] by the application
-** and internal memory usage by the SQLite library. Scratch memory
-** controlled by [SQLITE_CONFIG_SCRATCH] and auxiliary page-cache
+** and internal memory usage by the SQLite library. Auxiliary page-cache
** memory controlled by [SQLITE_CONFIG_PAGECACHE] is not included in
** this parameter. The amount returned is the sum of the allocation
** sizes as reported by the xSize method in [sqlite3_mem_methods].</dd>)^
@@ -7165,29 +8133,14 @@ SQLITE_API int sqlite3_status64(
** *pHighwater parameter to [sqlite3_status()] is of interest.
** The value written into the *pCurrent parameter is undefined.</dd>)^
**
-** [[SQLITE_STATUS_SCRATCH_USED]] ^(<dt>SQLITE_STATUS_SCRATCH_USED</dt>
-** <dd>This parameter returns the number of allocations used out of the
-** [scratch memory allocator] configured using
-** [SQLITE_CONFIG_SCRATCH]. The value returned is in allocations, not
-** in bytes. Since a single thread may only have one scratch allocation
-** outstanding at time, this parameter also reports the number of threads
-** using scratch memory at the same time.</dd>)^
+** [[SQLITE_STATUS_SCRATCH_USED]] <dt>SQLITE_STATUS_SCRATCH_USED</dt>
+** <dd>No longer used.</dd>
**
** [[SQLITE_STATUS_SCRATCH_OVERFLOW]] ^(<dt>SQLITE_STATUS_SCRATCH_OVERFLOW</dt>
-** <dd>This parameter returns the number of bytes of scratch memory
-** allocation which could not be satisfied by the [SQLITE_CONFIG_SCRATCH]
-** buffer and where forced to overflow to [sqlite3_malloc()]. The values
-** returned include overflows because the requested allocation was too
-** larger (that is, because the requested allocation was larger than the
-** "sz" parameter to [SQLITE_CONFIG_SCRATCH]) and because no scratch buffer
-** slots were available.
-** </dd>)^
-**
-** [[SQLITE_STATUS_SCRATCH_SIZE]] ^(<dt>SQLITE_STATUS_SCRATCH_SIZE</dt>
-** <dd>This parameter records the largest memory allocation request
-** handed to [scratch memory allocator]. Only the value returned in the
-** *pHighwater parameter to [sqlite3_status()] is of interest.
-** The value written into the *pCurrent parameter is undefined.</dd>)^
+** <dd>No longer used.</dd>
+**
+** [[SQLITE_STATUS_SCRATCH_SIZE]] <dt>SQLITE_STATUS_SCRATCH_SIZE</dt>
+** <dd>No longer used.</dd>
**
** [[SQLITE_STATUS_PARSER_STACK]] ^(<dt>SQLITE_STATUS_PARSER_STACK</dt>
** <dd>The *pHighwater parameter records the deepest parser stack.
@@ -7200,12 +8153,12 @@ SQLITE_API int sqlite3_status64(
#define SQLITE_STATUS_MEMORY_USED 0
#define SQLITE_STATUS_PAGECACHE_USED 1
#define SQLITE_STATUS_PAGECACHE_OVERFLOW 2
-#define SQLITE_STATUS_SCRATCH_USED 3
-#define SQLITE_STATUS_SCRATCH_OVERFLOW 4
+#define SQLITE_STATUS_SCRATCH_USED 3 /* NOT USED */
+#define SQLITE_STATUS_SCRATCH_OVERFLOW 4 /* NOT USED */
#define SQLITE_STATUS_MALLOC_SIZE 5
#define SQLITE_STATUS_PARSER_STACK 6
#define SQLITE_STATUS_PAGECACHE_SIZE 7
-#define SQLITE_STATUS_SCRATCH_SIZE 8
+#define SQLITE_STATUS_SCRATCH_SIZE 8 /* NOT USED */
#define SQLITE_STATUS_MALLOC_COUNT 9
/*
@@ -7410,6 +8363,24 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
** used as a proxy for the total work done by the prepared statement.
** If the number of virtual machine operations exceeds 2147483647
** then the value returned by this statement status code is undefined.
+**
+** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt>
+** <dd>^This is the number of times that the prepare statement has been
+** automatically regenerated due to schema changes or change to
+** [bound parameters] that might affect the query plan.
+**
+** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt>
+** <dd>^This is the number of times that the prepared statement has
+** been run. A single "run" for the purposes of this counter is one
+** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
+** The counter is incremented on the first [sqlite3_step()] call of each
+** cycle.
+**
+** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
+** <dd>^This is the approximate number of bytes of heap memory
+** used to store the prepared statement. ^This value is not actually
+** a counter, and so the resetFlg parameter to sqlite3_stmt_status()
+** is ignored when the opcode is SQLITE_STMTSTATUS_MEMUSED.
** </dd>
** </dl>
*/
@@ -7417,6 +8388,9 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
#define SQLITE_STMTSTATUS_SORT 2
#define SQLITE_STMTSTATUS_AUTOINDEX 3
#define SQLITE_STMTSTATUS_VM_STEP 4
+#define SQLITE_STMTSTATUS_REPREPARE 5
+#define SQLITE_STMTSTATUS_RUN 6
+#define SQLITE_STMTSTATUS_MEMUSED 99
/*
** CAPI3REF: Custom Page Cache Object
@@ -9281,8 +10255,8 @@ SQLITE_API int sqlite3session_diff(
*/
SQLITE_API int sqlite3session_patchset(
sqlite3_session *pSession, /* Session object */
- int *pnPatchset, /* OUT: Size of buffer at *ppChangeset */
- void **ppPatchset /* OUT: Buffer containing changeset */
+ int *pnPatchset, /* OUT: Size of buffer at *ppPatchset */
+ void **ppPatchset /* OUT: Buffer containing patchset */
);
/*
@@ -10049,12 +11023,12 @@ SQLITE_API int sqlite3changeset_apply(
**
** <table border=1 style="margin-left:8ex;margin-right:8ex">
** <tr><th>Streaming function<th>Non-streaming equivalent</th>
-** <tr><td>sqlite3changeset_apply_str<td>[sqlite3changeset_apply]
-** <tr><td>sqlite3changeset_concat_str<td>[sqlite3changeset_concat]
-** <tr><td>sqlite3changeset_invert_str<td>[sqlite3changeset_invert]
-** <tr><td>sqlite3changeset_start_str<td>[sqlite3changeset_start]
-** <tr><td>sqlite3session_changeset_str<td>[sqlite3session_changeset]
-** <tr><td>sqlite3session_patchset_str<td>[sqlite3session_patchset]
+** <tr><td>sqlite3changeset_apply_strm<td>[sqlite3changeset_apply]
+** <tr><td>sqlite3changeset_concat_strm<td>[sqlite3changeset_concat]
+** <tr><td>sqlite3changeset_invert_strm<td>[sqlite3changeset_invert]
+** <tr><td>sqlite3changeset_start_strm<td>[sqlite3changeset_start]
+** <tr><td>sqlite3session_changeset_strm<td>[sqlite3session_changeset]
+** <tr><td>sqlite3session_patchset_strm<td>[sqlite3session_patchset]
** </table>
**
** Non-streaming functions that accept changesets (or patchsets) as input
@@ -10783,8 +11757,9 @@ struct fts5_api {
** Include the configuration header output by 'configure' if we're using the
** autoconf-based build
*/
-#ifdef _HAVE_SQLITE_CONFIG_H
-#include "config.h"
+#if defined(_HAVE_SQLITE_CONFIG_H) && !defined(SQLITECONFIG_H)
+/* #include "config.h" */
+#define SQLITECONFIG_H 1
#endif
/************** Include sqliteLimit.h in the middle of sqliteInt.h ***********/
@@ -11094,6 +12069,11 @@ struct fts5_api {
**
** Older versions of SQLite used an optional THREADSAFE macro.
** We support that for legacy.
+**
+** To ensure that the correct value of "THREADSAFE" is reported when querying
+** for compile-time options at runtime (e.g. "PRAGMA compile_options"), this
+** logic is partially replicated in ctime.c. If it is updated here, it should
+** also be updated there.
*/
#if !defined(SQLITE_THREADSAFE)
# if defined(THREADSAFE)
@@ -11269,6 +12249,21 @@ SQLITE_PRIVATE void sqlite3Coverage(int);
#endif
/*
+** Some conditionals are optimizations only. In other words, if the
+** conditionals are replaced with a constant 1 (true) or 0 (false) then
+** the correct answer is still obtained, though perhaps not as quickly.
+**
+** The following macros mark these optimizations conditionals.
+*/
+#if defined(SQLITE_MUTATION_TEST)
+# define OK_IF_ALWAYS_TRUE(X) (1)
+# define OK_IF_ALWAYS_FALSE(X) (0)
+#else
+# define OK_IF_ALWAYS_TRUE(X) (X)
+# define OK_IF_ALWAYS_FALSE(X) (X)
+#endif
+
+/*
** Some malloc failures are only possible if SQLITE_TEST_REALLOC_STRESS is
** defined. We need to defend against those failures when testing with
** SQLITE_TEST_REALLOC_STRESS, but we don't want the unreachable branches
@@ -11462,63 +12457,63 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*);
#define TK_AS 24
#define TK_WITHOUT 25
#define TK_COMMA 26
-#define TK_ID 27
-#define TK_ABORT 28
-#define TK_ACTION 29
-#define TK_AFTER 30
-#define TK_ANALYZE 31
-#define TK_ASC 32
-#define TK_ATTACH 33
-#define TK_BEFORE 34
-#define TK_BY 35
-#define TK_CASCADE 36
-#define TK_CAST 37
-#define TK_COLUMNKW 38
-#define TK_CONFLICT 39
-#define TK_DATABASE 40
-#define TK_DESC 41
-#define TK_DETACH 42
-#define TK_EACH 43
-#define TK_FAIL 44
-#define TK_FOR 45
-#define TK_IGNORE 46
-#define TK_INITIALLY 47
-#define TK_INSTEAD 48
-#define TK_LIKE_KW 49
-#define TK_MATCH 50
-#define TK_NO 51
-#define TK_KEY 52
-#define TK_OF 53
-#define TK_OFFSET 54
-#define TK_PRAGMA 55
-#define TK_RAISE 56
-#define TK_RECURSIVE 57
-#define TK_REPLACE 58
-#define TK_RESTRICT 59
-#define TK_ROW 60
-#define TK_TRIGGER 61
-#define TK_VACUUM 62
-#define TK_VIEW 63
-#define TK_VIRTUAL 64
-#define TK_WITH 65
-#define TK_REINDEX 66
-#define TK_RENAME 67
-#define TK_CTIME_KW 68
-#define TK_ANY 69
-#define TK_OR 70
-#define TK_AND 71
-#define TK_IS 72
-#define TK_BETWEEN 73
-#define TK_IN 74
-#define TK_ISNULL 75
-#define TK_NOTNULL 76
-#define TK_NE 77
-#define TK_EQ 78
-#define TK_GT 79
-#define TK_LE 80
-#define TK_LT 81
-#define TK_GE 82
-#define TK_ESCAPE 83
+#define TK_ABORT 27
+#define TK_ACTION 28
+#define TK_AFTER 29
+#define TK_ANALYZE 30
+#define TK_ASC 31
+#define TK_ATTACH 32
+#define TK_BEFORE 33
+#define TK_BY 34
+#define TK_CASCADE 35
+#define TK_CAST 36
+#define TK_CONFLICT 37
+#define TK_DATABASE 38
+#define TK_DESC 39
+#define TK_DETACH 40
+#define TK_EACH 41
+#define TK_FAIL 42
+#define TK_OR 43
+#define TK_AND 44
+#define TK_IS 45
+#define TK_MATCH 46
+#define TK_LIKE_KW 47
+#define TK_BETWEEN 48
+#define TK_IN 49
+#define TK_ISNULL 50
+#define TK_NOTNULL 51
+#define TK_NE 52
+#define TK_EQ 53
+#define TK_GT 54
+#define TK_LE 55
+#define TK_LT 56
+#define TK_GE 57
+#define TK_ESCAPE 58
+#define TK_ID 59
+#define TK_COLUMNKW 60
+#define TK_FOR 61
+#define TK_IGNORE 62
+#define TK_INITIALLY 63
+#define TK_INSTEAD 64
+#define TK_NO 65
+#define TK_KEY 66
+#define TK_OF 67
+#define TK_OFFSET 68
+#define TK_PRAGMA 69
+#define TK_RAISE 70
+#define TK_RECURSIVE 71
+#define TK_REPLACE 72
+#define TK_RESTRICT 73
+#define TK_ROW 74
+#define TK_TRIGGER 75
+#define TK_VACUUM 76
+#define TK_VIEW 77
+#define TK_VIRTUAL 78
+#define TK_WITH 79
+#define TK_REINDEX 80
+#define TK_RENAME 81
+#define TK_CTIME_KW 82
+#define TK_ANY 83
#define TK_BITAND 84
#define TK_BITOR 85
#define TK_LSHIFT 86
@@ -11578,28 +12573,23 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*);
#define TK_INDEX 140
#define TK_ALTER 141
#define TK_ADD 142
-#define TK_TO_TEXT 143
-#define TK_TO_BLOB 144
-#define TK_TO_NUMERIC 145
-#define TK_TO_INT 146
-#define TK_TO_REAL 147
-#define TK_ISNOT 148
-#define TK_END_OF_FILE 149
-#define TK_UNCLOSED_STRING 150
-#define TK_FUNCTION 151
-#define TK_COLUMN 152
-#define TK_AGG_FUNCTION 153
-#define TK_AGG_COLUMN 154
-#define TK_UMINUS 155
-#define TK_UPLUS 156
-#define TK_REGISTER 157
-#define TK_VECTOR 158
-#define TK_SELECT_COLUMN 159
-#define TK_IF_NULL_ROW 160
-#define TK_ASTERISK 161
-#define TK_SPAN 162
-#define TK_SPACE 163
-#define TK_ILLEGAL 164
+#define TK_ISNOT 143
+#define TK_FUNCTION 144
+#define TK_COLUMN 145
+#define TK_AGG_FUNCTION 146
+#define TK_AGG_COLUMN 147
+#define TK_UMINUS 148
+#define TK_UPLUS 149
+#define TK_REGISTER 150
+#define TK_VECTOR 151
+#define TK_SELECT_COLUMN 152
+#define TK_IF_NULL_ROW 153
+#define TK_ASTERISK 154
+#define TK_SPAN 155
+#define TK_END_OF_FILE 156
+#define TK_UNCLOSED_STRING 157
+#define TK_SPACE 158
+#define TK_ILLEGAL 159
/* The token codes above must all fit in 8 bits */
#define TKFLG_MASK 0xff
@@ -11684,7 +12674,6 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*);
*/
#ifndef SQLITE_TEMP_STORE
# define SQLITE_TEMP_STORE 1
-# define SQLITE_TEMP_STORE_xc 1 /* Exclude from ctime.c */
#endif
/*
@@ -11721,6 +12710,15 @@ SQLITE_PRIVATE void sqlite3HashClear(Hash*);
#endif
/*
+** The compile-time options SQLITE_MMAP_READWRITE and
+** SQLITE_ENABLE_BATCH_ATOMIC_WRITE are not compatible with one another.
+** You must choose one or the other (or neither) but not both.
+*/
+#if defined(SQLITE_MMAP_READWRITE) && defined(SQLITE_ENABLE_BATCH_ATOMIC_WRITE)
+#error Cannot use both SQLITE_MMAP_READWRITE and SQLITE_ENABLE_BATCH_ATOMIC_WRITE
+#endif
+
+/*
** GCC does not define the offsetof() macro so we'll have to do it
** ourselves.
*/
@@ -11985,7 +12983,6 @@ typedef INT16_TYPE LogEst;
# else
# define SQLITE_MAX_MMAP_SIZE 0
# endif
-# define SQLITE_MAX_MMAP_SIZE_xc 1 /* exclude from ctime.c */
#endif
/*
@@ -11995,7 +12992,6 @@ typedef INT16_TYPE LogEst;
*/
#ifndef SQLITE_DEFAULT_MMAP_SIZE
# define SQLITE_DEFAULT_MMAP_SIZE 0
-# define SQLITE_DEFAULT_MMAP_SIZE_xc 1 /* Exclude from ctime.c */
#endif
#if SQLITE_DEFAULT_MMAP_SIZE>SQLITE_MAX_MMAP_SIZE
# undef SQLITE_DEFAULT_MMAP_SIZE
@@ -12020,7 +13016,7 @@ typedef INT16_TYPE LogEst;
** SELECTTRACE_ENABLED will be either 1 or 0 depending on whether or not
** the Select query generator tracing logic is turned on.
*/
-#if defined(SQLITE_DEBUG) || defined(SQLITE_ENABLE_SELECTTRACE)
+#if defined(SQLITE_ENABLE_SELECTTRACE)
# define SELECTTRACE_ENABLED 1
#else
# define SELECTTRACE_ENABLED 0
@@ -12424,6 +13420,7 @@ SQLITE_PRIVATE int sqlite3BtreeCursor(
struct KeyInfo*, /* First argument to compare function */
BtCursor *pCursor /* Space to write cursor structure */
);
+SQLITE_PRIVATE BtCursor *sqlite3BtreeFakeValidCursor(void);
SQLITE_PRIVATE int sqlite3BtreeCursorSize(void);
SQLITE_PRIVATE void sqlite3BtreeCursorZero(BtCursor*);
SQLITE_PRIVATE void sqlite3BtreeCursorHintFlags(BtCursor*, unsigned);
@@ -12480,9 +13477,9 @@ SQLITE_PRIVATE int sqlite3BtreeInsert(BtCursor*, const BtreePayload *pPayload,
int flags, int seekResult);
SQLITE_PRIVATE int sqlite3BtreeFirst(BtCursor*, int *pRes);
SQLITE_PRIVATE int sqlite3BtreeLast(BtCursor*, int *pRes);
-SQLITE_PRIVATE int sqlite3BtreeNext(BtCursor*, int *pRes);
+SQLITE_PRIVATE int sqlite3BtreeNext(BtCursor*, int flags);
SQLITE_PRIVATE int sqlite3BtreeEof(BtCursor*);
-SQLITE_PRIVATE int sqlite3BtreePrevious(BtCursor*, int *pRes);
+SQLITE_PRIVATE int sqlite3BtreePrevious(BtCursor*, int flags);
SQLITE_PRIVATE i64 sqlite3BtreeIntegerKey(BtCursor*);
SQLITE_PRIVATE int sqlite3BtreePayload(BtCursor*, u32 offset, u32 amt, void*);
SQLITE_PRIVATE const void *sqlite3BtreePayloadFetch(BtCursor*, u32 *pAmt);
@@ -12633,7 +13630,7 @@ struct VdbeOp {
#ifdef SQLITE_ENABLE_CURSOR_HINTS
Expr *pExpr; /* Used when p4type is P4_EXPR */
#endif
- int (*xAdvance)(BtCursor *, int *);
+ int (*xAdvance)(BtCursor *, int);
} p4;
#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
char *zComment; /* Comment to improve readability */
@@ -12677,24 +13674,26 @@ typedef struct VdbeOpList VdbeOpList;
/*
** Allowed values of VdbeOp.p4type
*/
-#define P4_NOTUSED 0 /* The P4 parameter is not used */
-#define P4_DYNAMIC (-1) /* Pointer to a string obtained from sqliteMalloc() */
-#define P4_STATIC (-2) /* Pointer to a static string */
-#define P4_COLLSEQ (-3) /* P4 is a pointer to a CollSeq structure */
-#define P4_FUNCDEF (-4) /* P4 is a pointer to a FuncDef structure */
-#define P4_KEYINFO (-5) /* P4 is a pointer to a KeyInfo structure */
-#define P4_EXPR (-6) /* P4 is a pointer to an Expr tree */
-#define P4_MEM (-7) /* P4 is a pointer to a Mem* structure */
-#define P4_TRANSIENT 0 /* P4 is a pointer to a transient string */
-#define P4_VTAB (-8) /* P4 is a pointer to an sqlite3_vtab structure */
-#define P4_REAL (-9) /* P4 is a 64-bit floating point value */
-#define P4_INT64 (-10) /* P4 is a 64-bit signed integer */
-#define P4_INT32 (-11) /* P4 is a 32-bit signed integer */
-#define P4_INTARRAY (-12) /* P4 is a vector of 32-bit integers */
-#define P4_SUBPROGRAM (-13) /* P4 is a pointer to a SubProgram structure */
-#define P4_ADVANCE (-14) /* P4 is a pointer to BtreeNext() or BtreePrev() */
-#define P4_TABLE (-15) /* P4 is a pointer to a Table structure */
-#define P4_FUNCCTX (-16) /* P4 is a pointer to an sqlite3_context object */
+#define P4_NOTUSED 0 /* The P4 parameter is not used */
+#define P4_TRANSIENT 0 /* P4 is a pointer to a transient string */
+#define P4_STATIC (-1) /* Pointer to a static string */
+#define P4_COLLSEQ (-2) /* P4 is a pointer to a CollSeq structure */
+#define P4_INT32 (-3) /* P4 is a 32-bit signed integer */
+#define P4_SUBPROGRAM (-4) /* P4 is a pointer to a SubProgram structure */
+#define P4_ADVANCE (-5) /* P4 is a pointer to BtreeNext() or BtreePrev() */
+#define P4_TABLE (-6) /* P4 is a pointer to a Table structure */
+/* Above do not own any resources. Must free those below */
+#define P4_FREE_IF_LE (-7)
+#define P4_DYNAMIC (-7) /* Pointer to memory from sqliteMalloc() */
+#define P4_FUNCDEF (-8) /* P4 is a pointer to a FuncDef structure */
+#define P4_KEYINFO (-9) /* P4 is a pointer to a KeyInfo structure */
+#define P4_EXPR (-10) /* P4 is a pointer to an Expr tree */
+#define P4_MEM (-11) /* P4 is a pointer to a Mem* structure */
+#define P4_VTAB (-12) /* P4 is a pointer to an sqlite3_vtab structure */
+#define P4_REAL (-13) /* P4 is a 64-bit floating point value */
+#define P4_INT64 (-14) /* P4 is a 64-bit signed integer */
+#define P4_INTARRAY (-15) /* P4 is a vector of 32-bit integers */
+#define P4_FUNCCTX (-16) /* P4 is a pointer to an sqlite3_context object */
/* Error message codes for OP_Halt */
#define P5_ConstraintNotNull 1
@@ -12740,87 +13739,87 @@ typedef struct VdbeOpList VdbeOpList;
#define OP_Savepoint 0
#define OP_AutoCommit 1
#define OP_Transaction 2
-#define OP_SorterNext 3
-#define OP_PrevIfOpen 4
-#define OP_NextIfOpen 5
-#define OP_Prev 6
-#define OP_Next 7
+#define OP_SorterNext 3 /* jump */
+#define OP_PrevIfOpen 4 /* jump */
+#define OP_NextIfOpen 5 /* jump */
+#define OP_Prev 6 /* jump */
+#define OP_Next 7 /* jump */
#define OP_Checkpoint 8
#define OP_JournalMode 9
#define OP_Vacuum 10
-#define OP_VFilter 11 /* synopsis: iplan=r[P3] zplan='P4' */
+#define OP_VFilter 11 /* jump, synopsis: iplan=r[P3] zplan='P4' */
#define OP_VUpdate 12 /* synopsis: data=r[P3@P2] */
-#define OP_Goto 13
-#define OP_Gosub 14
-#define OP_InitCoroutine 15
-#define OP_Yield 16
-#define OP_MustBeInt 17
-#define OP_Jump 18
+#define OP_Goto 13 /* jump */
+#define OP_Gosub 14 /* jump */
+#define OP_InitCoroutine 15 /* jump */
+#define OP_Yield 16 /* jump */
+#define OP_MustBeInt 17 /* jump */
+#define OP_Jump 18 /* jump */
#define OP_Not 19 /* same as TK_NOT, synopsis: r[P2]= !r[P1] */
-#define OP_Once 20
-#define OP_If 21
-#define OP_IfNot 22
-#define OP_IfNullRow 23 /* synopsis: if P1.nullRow then r[P3]=NULL, goto P2 */
-#define OP_SeekLT 24 /* synopsis: key=r[P3@P4] */
-#define OP_SeekLE 25 /* synopsis: key=r[P3@P4] */
-#define OP_SeekGE 26 /* synopsis: key=r[P3@P4] */
-#define OP_SeekGT 27 /* synopsis: key=r[P3@P4] */
-#define OP_NoConflict 28 /* synopsis: key=r[P3@P4] */
-#define OP_NotFound 29 /* synopsis: key=r[P3@P4] */
-#define OP_Found 30 /* synopsis: key=r[P3@P4] */
-#define OP_SeekRowid 31 /* synopsis: intkey=r[P3] */
-#define OP_NotExists 32 /* synopsis: intkey=r[P3] */
-#define OP_Last 33
-#define OP_IfSmaller 34
-#define OP_SorterSort 35
-#define OP_Sort 36
-#define OP_Rewind 37
-#define OP_IdxLE 38 /* synopsis: key=r[P3@P4] */
-#define OP_IdxGT 39 /* synopsis: key=r[P3@P4] */
-#define OP_IdxLT 40 /* synopsis: key=r[P3@P4] */
-#define OP_IdxGE 41 /* synopsis: key=r[P3@P4] */
-#define OP_RowSetRead 42 /* synopsis: r[P3]=rowset(P1) */
-#define OP_RowSetTest 43 /* synopsis: if r[P3] in rowset(P1) goto P2 */
-#define OP_Program 44
-#define OP_FkIfZero 45 /* synopsis: if fkctr[P1]==0 goto P2 */
-#define OP_IfPos 46 /* synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */
-#define OP_IfNotZero 47 /* synopsis: if r[P1]!=0 then r[P1]--, goto P2 */
-#define OP_DecrJumpZero 48 /* synopsis: if (--r[P1])==0 goto P2 */
-#define OP_IncrVacuum 49
-#define OP_VNext 50
-#define OP_Init 51 /* synopsis: Start at P2 */
-#define OP_Return 52
-#define OP_EndCoroutine 53
-#define OP_HaltIfNull 54 /* synopsis: if r[P3]=null halt */
-#define OP_Halt 55
-#define OP_Integer 56 /* synopsis: r[P2]=P1 */
-#define OP_Int64 57 /* synopsis: r[P2]=P4 */
-#define OP_String 58 /* synopsis: r[P2]='P4' (len=P1) */
-#define OP_Null 59 /* synopsis: r[P2..P3]=NULL */
-#define OP_SoftNull 60 /* synopsis: r[P1]=NULL */
-#define OP_Blob 61 /* synopsis: r[P2]=P4 (len=P1) */
-#define OP_Variable 62 /* synopsis: r[P2]=parameter(P1,P4) */
-#define OP_Move 63 /* synopsis: r[P2@P3]=r[P1@P3] */
-#define OP_Copy 64 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
-#define OP_SCopy 65 /* synopsis: r[P2]=r[P1] */
-#define OP_IntCopy 66 /* synopsis: r[P2]=r[P1] */
-#define OP_ResultRow 67 /* synopsis: output=r[P1@P2] */
-#define OP_CollSeq 68
-#define OP_Function0 69 /* synopsis: r[P3]=func(r[P2@P5]) */
-#define OP_Or 70 /* same as TK_OR, synopsis: r[P3]=(r[P1] || r[P2]) */
-#define OP_And 71 /* same as TK_AND, synopsis: r[P3]=(r[P1] && r[P2]) */
-#define OP_Function 72 /* synopsis: r[P3]=func(r[P2@P5]) */
-#define OP_AddImm 73 /* synopsis: r[P1]=r[P1]+P2 */
-#define OP_RealAffinity 74
-#define OP_IsNull 75 /* same as TK_ISNULL, synopsis: if r[P1]==NULL goto P2 */
-#define OP_NotNull 76 /* same as TK_NOTNULL, synopsis: if r[P1]!=NULL goto P2 */
-#define OP_Ne 77 /* same as TK_NE, synopsis: IF r[P3]!=r[P1] */
-#define OP_Eq 78 /* same as TK_EQ, synopsis: IF r[P3]==r[P1] */
-#define OP_Gt 79 /* same as TK_GT, synopsis: IF r[P3]>r[P1] */
-#define OP_Le 80 /* same as TK_LE, synopsis: IF r[P3]<=r[P1] */
-#define OP_Lt 81 /* same as TK_LT, synopsis: IF r[P3]<r[P1] */
-#define OP_Ge 82 /* same as TK_GE, synopsis: IF r[P3]>=r[P1] */
-#define OP_ElseNotEq 83 /* same as TK_ESCAPE */
+#define OP_Once 20 /* jump */
+#define OP_If 21 /* jump */
+#define OP_IfNot 22 /* jump */
+#define OP_IfNullRow 23 /* jump, synopsis: if P1.nullRow then r[P3]=NULL, goto P2 */
+#define OP_SeekLT 24 /* jump, synopsis: key=r[P3@P4] */
+#define OP_SeekLE 25 /* jump, synopsis: key=r[P3@P4] */
+#define OP_SeekGE 26 /* jump, synopsis: key=r[P3@P4] */
+#define OP_SeekGT 27 /* jump, synopsis: key=r[P3@P4] */
+#define OP_NoConflict 28 /* jump, synopsis: key=r[P3@P4] */
+#define OP_NotFound 29 /* jump, synopsis: key=r[P3@P4] */
+#define OP_Found 30 /* jump, synopsis: key=r[P3@P4] */
+#define OP_SeekRowid 31 /* jump, synopsis: intkey=r[P3] */
+#define OP_NotExists 32 /* jump, synopsis: intkey=r[P3] */
+#define OP_Last 33 /* jump */
+#define OP_IfSmaller 34 /* jump */
+#define OP_SorterSort 35 /* jump */
+#define OP_Sort 36 /* jump */
+#define OP_Rewind 37 /* jump */
+#define OP_IdxLE 38 /* jump, synopsis: key=r[P3@P4] */
+#define OP_IdxGT 39 /* jump, synopsis: key=r[P3@P4] */
+#define OP_IdxLT 40 /* jump, synopsis: key=r[P3@P4] */
+#define OP_IdxGE 41 /* jump, synopsis: key=r[P3@P4] */
+#define OP_RowSetRead 42 /* jump, synopsis: r[P3]=rowset(P1) */
+#define OP_Or 43 /* same as TK_OR, synopsis: r[P3]=(r[P1] || r[P2]) */
+#define OP_And 44 /* same as TK_AND, synopsis: r[P3]=(r[P1] && r[P2]) */
+#define OP_RowSetTest 45 /* jump, synopsis: if r[P3] in rowset(P1) goto P2 */
+#define OP_Program 46 /* jump */
+#define OP_FkIfZero 47 /* jump, synopsis: if fkctr[P1]==0 goto P2 */
+#define OP_IfPos 48 /* jump, synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */
+#define OP_IfNotZero 49 /* jump, synopsis: if r[P1]!=0 then r[P1]--, goto P2 */
+#define OP_IsNull 50 /* jump, same as TK_ISNULL, synopsis: if r[P1]==NULL goto P2 */
+#define OP_NotNull 51 /* jump, same as TK_NOTNULL, synopsis: if r[P1]!=NULL goto P2 */
+#define OP_Ne 52 /* jump, same as TK_NE, synopsis: IF r[P3]!=r[P1] */
+#define OP_Eq 53 /* jump, same as TK_EQ, synopsis: IF r[P3]==r[P1] */
+#define OP_Gt 54 /* jump, same as TK_GT, synopsis: IF r[P3]>r[P1] */
+#define OP_Le 55 /* jump, same as TK_LE, synopsis: IF r[P3]<=r[P1] */
+#define OP_Lt 56 /* jump, same as TK_LT, synopsis: IF r[P3]<r[P1] */
+#define OP_Ge 57 /* jump, same as TK_GE, synopsis: IF r[P3]>=r[P1] */
+#define OP_ElseNotEq 58 /* jump, same as TK_ESCAPE */
+#define OP_DecrJumpZero 59 /* jump, synopsis: if (--r[P1])==0 goto P2 */
+#define OP_IncrVacuum 60 /* jump */
+#define OP_VNext 61 /* jump */
+#define OP_Init 62 /* jump, synopsis: Start at P2 */
+#define OP_Return 63
+#define OP_EndCoroutine 64
+#define OP_HaltIfNull 65 /* synopsis: if r[P3]=null halt */
+#define OP_Halt 66
+#define OP_Integer 67 /* synopsis: r[P2]=P1 */
+#define OP_Int64 68 /* synopsis: r[P2]=P4 */
+#define OP_String 69 /* synopsis: r[P2]='P4' (len=P1) */
+#define OP_Null 70 /* synopsis: r[P2..P3]=NULL */
+#define OP_SoftNull 71 /* synopsis: r[P1]=NULL */
+#define OP_Blob 72 /* synopsis: r[P2]=P4 (len=P1) */
+#define OP_Variable 73 /* synopsis: r[P2]=parameter(P1,P4) */
+#define OP_Move 74 /* synopsis: r[P2@P3]=r[P1@P3] */
+#define OP_Copy 75 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */
+#define OP_SCopy 76 /* synopsis: r[P2]=r[P1] */
+#define OP_IntCopy 77 /* synopsis: r[P2]=r[P1] */
+#define OP_ResultRow 78 /* synopsis: output=r[P1@P2] */
+#define OP_CollSeq 79
+#define OP_AddImm 80 /* synopsis: r[P1]=r[P1]+P2 */
+#define OP_RealAffinity 81
+#define OP_Cast 82 /* synopsis: affinity(r[P1]) */
+#define OP_Permutation 83
#define OP_BitAnd 84 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */
#define OP_BitOr 85 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */
#define OP_ShiftLeft 86 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<<r[P1] */
@@ -12831,78 +13830,80 @@ typedef struct VdbeOpList VdbeOpList;
#define OP_Divide 91 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
#define OP_Remainder 92 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
#define OP_Concat 93 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
-#define OP_Cast 94 /* synopsis: affinity(r[P1]) */
+#define OP_Compare 94 /* synopsis: r[P1@P3] <-> r[P2@P3] */
#define OP_BitNot 95 /* same as TK_BITNOT, synopsis: r[P1]= ~r[P1] */
-#define OP_Permutation 96
+#define OP_Column 96 /* synopsis: r[P3]=PX */
#define OP_String8 97 /* same as TK_STRING, synopsis: r[P2]='P4' */
-#define OP_Compare 98 /* synopsis: r[P1@P3] <-> r[P2@P3] */
-#define OP_Column 99 /* synopsis: r[P3]=PX */
-#define OP_Affinity 100 /* synopsis: affinity(r[P1@P2]) */
-#define OP_MakeRecord 101 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
-#define OP_Count 102 /* synopsis: r[P2]=count() */
-#define OP_ReadCookie 103
-#define OP_SetCookie 104
-#define OP_ReopenIdx 105 /* synopsis: root=P2 iDb=P3 */
-#define OP_OpenRead 106 /* synopsis: root=P2 iDb=P3 */
-#define OP_OpenWrite 107 /* synopsis: root=P2 iDb=P3 */
-#define OP_OpenDup 108
-#define OP_OpenAutoindex 109 /* synopsis: nColumn=P2 */
-#define OP_OpenEphemeral 110 /* synopsis: nColumn=P2 */
-#define OP_SorterOpen 111
-#define OP_SequenceTest 112 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
-#define OP_OpenPseudo 113 /* synopsis: P3 columns in r[P2] */
-#define OP_Close 114
-#define OP_ColumnsUsed 115
-#define OP_Sequence 116 /* synopsis: r[P2]=cursor[P1].ctr++ */
-#define OP_NewRowid 117 /* synopsis: r[P2]=rowid */
-#define OP_Insert 118 /* synopsis: intkey=r[P3] data=r[P2] */
-#define OP_InsertInt 119 /* synopsis: intkey=P3 data=r[P2] */
-#define OP_Delete 120
-#define OP_ResetCount 121
-#define OP_SorterCompare 122 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
-#define OP_SorterData 123 /* synopsis: r[P2]=data */
-#define OP_RowData 124 /* synopsis: r[P2]=data */
-#define OP_Rowid 125 /* synopsis: r[P2]=rowid */
-#define OP_NullRow 126
-#define OP_SorterInsert 127 /* synopsis: key=r[P2] */
-#define OP_IdxInsert 128 /* synopsis: key=r[P2] */
-#define OP_IdxDelete 129 /* synopsis: key=r[P2@P3] */
-#define OP_Seek 130 /* synopsis: Move P3 to P1.rowid */
-#define OP_IdxRowid 131 /* synopsis: r[P2]=rowid */
+#define OP_Affinity 98 /* synopsis: affinity(r[P1@P2]) */
+#define OP_MakeRecord 99 /* synopsis: r[P3]=mkrec(r[P1@P2]) */
+#define OP_Count 100 /* synopsis: r[P2]=count() */
+#define OP_ReadCookie 101
+#define OP_SetCookie 102
+#define OP_ReopenIdx 103 /* synopsis: root=P2 iDb=P3 */
+#define OP_OpenRead 104 /* synopsis: root=P2 iDb=P3 */
+#define OP_OpenWrite 105 /* synopsis: root=P2 iDb=P3 */
+#define OP_OpenDup 106
+#define OP_OpenAutoindex 107 /* synopsis: nColumn=P2 */
+#define OP_OpenEphemeral 108 /* synopsis: nColumn=P2 */
+#define OP_SorterOpen 109
+#define OP_SequenceTest 110 /* synopsis: if( cursor[P1].ctr++ ) pc = P2 */
+#define OP_OpenPseudo 111 /* synopsis: P3 columns in r[P2] */
+#define OP_Close 112
+#define OP_ColumnsUsed 113
+#define OP_Sequence 114 /* synopsis: r[P2]=cursor[P1].ctr++ */
+#define OP_NewRowid 115 /* synopsis: r[P2]=rowid */
+#define OP_Insert 116 /* synopsis: intkey=r[P3] data=r[P2] */
+#define OP_InsertInt 117 /* synopsis: intkey=P3 data=r[P2] */
+#define OP_Delete 118
+#define OP_ResetCount 119
+#define OP_SorterCompare 120 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
+#define OP_SorterData 121 /* synopsis: r[P2]=data */
+#define OP_RowData 122 /* synopsis: r[P2]=data */
+#define OP_Rowid 123 /* synopsis: r[P2]=rowid */
+#define OP_NullRow 124
+#define OP_SeekEnd 125
+#define OP_SorterInsert 126 /* synopsis: key=r[P2] */
+#define OP_IdxInsert 127 /* synopsis: key=r[P2] */
+#define OP_IdxDelete 128 /* synopsis: key=r[P2@P3] */
+#define OP_DeferredSeek 129 /* synopsis: Move P3 to P1.rowid if needed */
+#define OP_IdxRowid 130 /* synopsis: r[P2]=rowid */
+#define OP_Destroy 131
#define OP_Real 132 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
-#define OP_Destroy 133
-#define OP_Clear 134
-#define OP_ResetSorter 135
-#define OP_CreateIndex 136 /* synopsis: r[P2]=root iDb=P1 */
-#define OP_CreateTable 137 /* synopsis: r[P2]=root iDb=P1 */
-#define OP_SqlExec 138
-#define OP_ParseSchema 139
-#define OP_LoadAnalysis 140
-#define OP_DropTable 141
-#define OP_DropIndex 142
-#define OP_DropTrigger 143
-#define OP_IntegrityCk 144
-#define OP_RowSetAdd 145 /* synopsis: rowset(P1)=r[P2] */
-#define OP_Param 146
-#define OP_FkCounter 147 /* synopsis: fkctr[P1]+=P2 */
-#define OP_MemMax 148 /* synopsis: r[P1]=max(r[P1],r[P2]) */
-#define OP_OffsetLimit 149 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
-#define OP_AggStep0 150 /* synopsis: accum=r[P3] step(r[P2@P5]) */
-#define OP_AggStep 151 /* synopsis: accum=r[P3] step(r[P2@P5]) */
-#define OP_AggFinal 152 /* synopsis: accum=r[P1] N=P2 */
-#define OP_Expire 153
-#define OP_TableLock 154 /* synopsis: iDb=P1 root=P2 write=P3 */
-#define OP_VBegin 155
-#define OP_VCreate 156
-#define OP_VDestroy 157
-#define OP_VOpen 158
-#define OP_VColumn 159 /* synopsis: r[P3]=vcolumn(P2) */
-#define OP_VRename 160
-#define OP_Pagecount 161
-#define OP_MaxPgcnt 162
-#define OP_CursorHint 163
-#define OP_Noop 164
-#define OP_Explain 165
+#define OP_Clear 133
+#define OP_ResetSorter 134
+#define OP_CreateBtree 135 /* synopsis: r[P2]=root iDb=P1 flags=P3 */
+#define OP_SqlExec 136
+#define OP_ParseSchema 137
+#define OP_LoadAnalysis 138
+#define OP_DropTable 139
+#define OP_DropIndex 140
+#define OP_DropTrigger 141
+#define OP_IntegrityCk 142
+#define OP_RowSetAdd 143 /* synopsis: rowset(P1)=r[P2] */
+#define OP_Param 144
+#define OP_FkCounter 145 /* synopsis: fkctr[P1]+=P2 */
+#define OP_MemMax 146 /* synopsis: r[P1]=max(r[P1],r[P2]) */
+#define OP_OffsetLimit 147 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
+#define OP_AggStep0 148 /* synopsis: accum=r[P3] step(r[P2@P5]) */
+#define OP_AggStep 149 /* synopsis: accum=r[P3] step(r[P2@P5]) */
+#define OP_AggFinal 150 /* synopsis: accum=r[P1] N=P2 */
+#define OP_Expire 151
+#define OP_TableLock 152 /* synopsis: iDb=P1 root=P2 write=P3 */
+#define OP_VBegin 153
+#define OP_VCreate 154
+#define OP_VDestroy 155
+#define OP_VOpen 156
+#define OP_VColumn 157 /* synopsis: r[P3]=vcolumn(P2) */
+#define OP_VRename 158
+#define OP_Pagecount 159
+#define OP_MaxPgcnt 160
+#define OP_PureFunc0 161
+#define OP_Function0 162 /* synopsis: r[P3]=func(r[P2@P5]) */
+#define OP_PureFunc 163
+#define OP_Function 164 /* synopsis: r[P3]=func(r[P2@P5]) */
+#define OP_CursorHint 165
+#define OP_Noop 166
+#define OP_Explain 167
/* Properties such as "out2" or "jump" that are specified in
** comments following the "case" for each opcode in the vdbe.c
@@ -12920,22 +13921,23 @@ typedef struct VdbeOpList VdbeOpList;
/* 16 */ 0x03, 0x03, 0x01, 0x12, 0x01, 0x03, 0x03, 0x01,\
/* 24 */ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09,\
/* 32 */ 0x09, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\
-/* 40 */ 0x01, 0x01, 0x23, 0x0b, 0x01, 0x01, 0x03, 0x03,\
-/* 48 */ 0x03, 0x01, 0x01, 0x01, 0x02, 0x02, 0x08, 0x00,\
-/* 56 */ 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x00,\
-/* 64 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x26, 0x26,\
-/* 72 */ 0x00, 0x02, 0x02, 0x03, 0x03, 0x0b, 0x0b, 0x0b,\
-/* 80 */ 0x0b, 0x0b, 0x0b, 0x01, 0x26, 0x26, 0x26, 0x26,\
-/* 88 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x02, 0x12,\
-/* 96 */ 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10,\
+/* 40 */ 0x01, 0x01, 0x23, 0x26, 0x26, 0x0b, 0x01, 0x01,\
+/* 48 */ 0x03, 0x03, 0x03, 0x03, 0x0b, 0x0b, 0x0b, 0x0b,\
+/* 56 */ 0x0b, 0x0b, 0x01, 0x03, 0x01, 0x01, 0x01, 0x02,\
+/* 64 */ 0x02, 0x08, 0x00, 0x10, 0x10, 0x10, 0x10, 0x00,\
+/* 72 */ 0x10, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
+/* 80 */ 0x02, 0x02, 0x02, 0x00, 0x26, 0x26, 0x26, 0x26,\
+/* 88 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x00, 0x12,\
+/* 96 */ 0x00, 0x10, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
/* 104 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
-/* 112 */ 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00,\
-/* 120 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x04,\
-/* 128 */ 0x04, 0x00, 0x00, 0x10, 0x10, 0x10, 0x00, 0x00,\
-/* 136 */ 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
-/* 144 */ 0x00, 0x06, 0x10, 0x00, 0x04, 0x1a, 0x00, 0x00,\
-/* 152 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
-/* 160 */ 0x00, 0x10, 0x10, 0x00, 0x00, 0x00,}
+/* 112 */ 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00,\
+/* 120 */ 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x04, 0x04,\
+/* 128 */ 0x00, 0x00, 0x10, 0x10, 0x10, 0x00, 0x00, 0x10,\
+/* 136 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06,\
+/* 144 */ 0x10, 0x00, 0x04, 0x1a, 0x00, 0x00, 0x00, 0x00,\
+/* 152 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,\
+/* 160 */ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
+}
/* The sqlite3P2Values() routine is able to run faster if it knows
** the value of the largest JUMP opcode. The smaller the maximum
@@ -12943,12 +13945,18 @@ typedef struct VdbeOpList VdbeOpList;
** generated this include file strives to group all JUMP opcodes
** together near the beginning of the list.
*/
-#define SQLITE_MX_JUMP_OPCODE 83 /* Maximum JUMP opcode */
+#define SQLITE_MX_JUMP_OPCODE 62 /* Maximum JUMP opcode */
/************** End of opcodes.h *********************************************/
/************** Continuing where we left off in vdbe.h ***********************/
/*
+** Additional non-public SQLITE_PREPARE_* flags
+*/
+#define SQLITE_PREPARE_SAVESQL 0x80 /* Preserve SQL text */
+#define SQLITE_PREPARE_MASK 0x0f /* Mask of public flags */
+
+/*
** Prototypes for the VDBE interface. See comments on the implementation
** for a description of what each of these routines does.
*/
@@ -13005,7 +14013,8 @@ SQLITE_PRIVATE void sqlite3VdbeSetNumCols(Vdbe*,int);
SQLITE_PRIVATE int sqlite3VdbeSetColName(Vdbe*, int, int, const char *, void(*)(void*));
SQLITE_PRIVATE void sqlite3VdbeCountChanges(Vdbe*);
SQLITE_PRIVATE sqlite3 *sqlite3VdbeDb(Vdbe*);
-SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe*, const char *z, int n, int);
+SQLITE_PRIVATE u8 sqlite3VdbePrepareFlags(Vdbe*);
+SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe*, const char *z, int n, u8);
SQLITE_PRIVATE void sqlite3VdbeSwap(Vdbe*,Vdbe*);
SQLITE_PRIVATE VdbeOp *sqlite3VdbeTakeOpArray(Vdbe*, int*, int*);
SQLITE_PRIVATE sqlite3_value *sqlite3VdbeGetBoundValue(Vdbe*, int, u8);
@@ -13027,6 +14036,8 @@ SQLITE_PRIVATE RecordCompare sqlite3VdbeFindCompare(UnpackedRecord*);
SQLITE_PRIVATE void sqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *);
#endif
+SQLITE_PRIVATE int sqlite3NotPureFunc(sqlite3_context*);
+
/* Use SQLITE_ENABLE_COMMENTS to enable generation of extra comments on
** each VDBE opcode.
**
@@ -13252,6 +14263,7 @@ SQLITE_PRIVATE DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno);
SQLITE_PRIVATE void sqlite3PagerRef(DbPage*);
SQLITE_PRIVATE void sqlite3PagerUnref(DbPage*);
SQLITE_PRIVATE void sqlite3PagerUnrefNotNull(DbPage*);
+SQLITE_PRIVATE void sqlite3PagerUnrefPageOne(DbPage*);
/* Operations on page references. */
SQLITE_PRIVATE int sqlite3PagerWrite(DbPage*);
@@ -13371,6 +14383,7 @@ struct PgHdr {
sqlite3_pcache_page *pPage; /* Pcache object page handle */
void *pData; /* Page data */
void *pExtra; /* Extra content */
+ PCache *pCache; /* PRIVATE: Cache that owns this page */
PgHdr *pDirty; /* Transient list of dirty sorted by pgno */
Pager *pPager; /* The pager this page is part of */
Pgno pgno; /* Page number for this page */
@@ -13380,14 +14393,15 @@ struct PgHdr {
u16 flags; /* PGHDR flags defined below */
/**********************************************************************
- ** Elements above are public. All that follows is private to pcache.c
- ** and should not be accessed by other modules.
+ ** Elements above, except pCache, are public. All that follow are
+ ** private to pcache.c and should not be accessed by other modules.
+ ** pCache is grouped with the public elements for efficiency.
*/
i16 nRef; /* Number of users of this page */
- PCache *pCache; /* Cache that owns this page */
-
PgHdr *pDirtyNext; /* Next element in list of dirty pages */
PgHdr *pDirtyPrev; /* Previous element in list of dirty pages */
+ /* NB: pDirtyNext and pDirtyPrev are undefined if the
+ ** PgHdr object is not dirty */
};
/* Bit values for PgHdr.flags */
@@ -13769,10 +14783,12 @@ SQLITE_PRIVATE void sqlite3OsFileControlHint(sqlite3_file*,int,void*);
#define SQLITE_FCNTL_DB_UNCHANGED 0xca093fa0
SQLITE_PRIVATE int sqlite3OsSectorSize(sqlite3_file *id);
SQLITE_PRIVATE int sqlite3OsDeviceCharacteristics(sqlite3_file *id);
+#ifndef SQLITE_OMIT_WAL
SQLITE_PRIVATE int sqlite3OsShmMap(sqlite3_file *,int,int,int,void volatile **);
SQLITE_PRIVATE int sqlite3OsShmLock(sqlite3_file *id, int, int, int);
SQLITE_PRIVATE void sqlite3OsShmBarrier(sqlite3_file *id);
SQLITE_PRIVATE int sqlite3OsShmUnmap(sqlite3_file *id, int);
+#endif /* SQLITE_OMIT_WAL */
SQLITE_PRIVATE int sqlite3OsFetch(sqlite3_file *id, i64, int, void **);
SQLITE_PRIVATE int sqlite3OsUnfetch(sqlite3_file *, i64, void *);
@@ -13981,6 +14997,7 @@ struct Schema {
#define DB_SchemaLoaded 0x0001 /* The schema has been loaded */
#define DB_UnresetViews 0x0002 /* Some views have defined column names */
#define DB_Empty 0x0004 /* The file is empty (length 0 bytes) */
+#define DB_ResetWanted 0x0008 /* Reset the schema when nSchemaLock==0 */
/*
** The number of different kinds of things that can be limited
@@ -14012,9 +15029,9 @@ struct Lookaside {
u32 bDisable; /* Only operate the lookaside when zero */
u16 sz; /* Size of each buffer in bytes */
u8 bMalloced; /* True if pStart obtained from sqlite3_malloc() */
- int nOut; /* Number of buffers currently checked out */
- int mxOut; /* Highwater mark for nOut */
- int anStat[3]; /* 0: hits. 1: size misses. 2: full misses */
+ u32 nSlot; /* Number of lookaside slots allocated */
+ u32 anStat[3]; /* 0: hits. 1: size misses. 2: full misses */
+ LookasideSlot *pInit; /* List of buffers not previously used */
LookasideSlot *pFree; /* List of available buffers */
void *pStart; /* First byte of available memory space */
void *pEnd; /* First byte past end of available space */
@@ -14093,9 +15110,11 @@ struct sqlite3 {
sqlite3_mutex *mutex; /* Connection mutex */
Db *aDb; /* All backends */
int nDb; /* Number of backends currently in use */
- int flags; /* Miscellaneous flags. See below */
+ u32 mDbFlags; /* flags recording internal state */
+ u32 flags; /* flags settable by pragmas. See below */
i64 lastRowid; /* ROWID of most recent insert (see above) */
i64 szMmap; /* Default mmap_size setting */
+ u32 nSchemaLock; /* Do not reset the schema when non-zero */
unsigned int openFlags; /* Flags passed to sqlite3_vfs.xOpen() */
int errCode; /* Most recent error code (SQLITE_*) */
int errMask; /* & result codes with this before returning */
@@ -14227,8 +15246,8 @@ struct sqlite3 {
** SQLITE_CkptFullFSync == PAGER_CKPT_FULLFSYNC
** SQLITE_CacheSpill == PAGER_CACHE_SPILL
*/
-#define SQLITE_VdbeTrace 0x00000001 /* True to trace VDBE execution */
-#define SQLITE_InternChanges 0x00000002 /* Uncommitted Hash table changes */
+#define SQLITE_WriteSchema 0x00000001 /* OK to update SQLITE_MASTER */
+#define SQLITE_LegacyFileFmt 0x00000002 /* Create new databases in format 1 */
#define SQLITE_FullColNames 0x00000004 /* Show full column names on SELECT */
#define SQLITE_FullFSync 0x00000008 /* Use full fsync on the backend */
#define SQLITE_CkptFullFSync 0x00000010 /* Use full fsync for checkpoint */
@@ -14239,30 +15258,36 @@ struct sqlite3 {
/* the count using a callback. */
#define SQLITE_NullCallback 0x00000100 /* Invoke the callback once if the */
/* result set is empty */
-#define SQLITE_SqlTrace 0x00000200 /* Debug print SQL as it executes */
-#define SQLITE_VdbeListing 0x00000400 /* Debug listings of VDBE programs */
-#define SQLITE_WriteSchema 0x00000800 /* OK to update SQLITE_MASTER */
-#define SQLITE_VdbeAddopTrace 0x00001000 /* Trace sqlite3VdbeAddOp() calls */
-#define SQLITE_IgnoreChecks 0x00002000 /* Do not enforce check constraints */
-#define SQLITE_ReadUncommitted 0x0004000 /* For shared-cache mode */
-#define SQLITE_LegacyFileFmt 0x00008000 /* Create new databases in format 1 */
-#define SQLITE_RecoveryMode 0x00010000 /* Ignore schema errors */
-#define SQLITE_ReverseOrder 0x00020000 /* Reverse unordered SELECTs */
-#define SQLITE_RecTriggers 0x00040000 /* Enable recursive triggers */
-#define SQLITE_ForeignKeys 0x00080000 /* Enforce foreign key constraints */
-#define SQLITE_AutoIndex 0x00100000 /* Enable automatic indexes */
-#define SQLITE_PreferBuiltin 0x00200000 /* Preference to built-in funcs */
-#define SQLITE_LoadExtension 0x00400000 /* Enable load_extension */
-#define SQLITE_LoadExtFunc 0x00800000 /* Enable load_extension() SQL func */
-#define SQLITE_EnableTrigger 0x01000000 /* True to enable triggers */
-#define SQLITE_DeferFKs 0x02000000 /* Defer all FK constraints */
-#define SQLITE_QueryOnly 0x04000000 /* Disable database changes */
-#define SQLITE_VdbeEQP 0x08000000 /* Debug EXPLAIN QUERY PLAN */
-#define SQLITE_Vacuum 0x10000000 /* Currently in a VACUUM */
-#define SQLITE_CellSizeCk 0x20000000 /* Check btree cell sizes on load */
-#define SQLITE_Fts3Tokenizer 0x40000000 /* Enable fts3_tokenizer(2) */
-#define SQLITE_NoCkptOnClose 0x80000000 /* No checkpoint on close()/DETACH */
+#define SQLITE_IgnoreChecks 0x00000200 /* Do not enforce check constraints */
+#define SQLITE_ReadUncommit 0x00000400 /* READ UNCOMMITTED in shared-cache */
+#define SQLITE_NoCkptOnClose 0x00000800 /* No checkpoint on close()/DETACH */
+#define SQLITE_ReverseOrder 0x00001000 /* Reverse unordered SELECTs */
+#define SQLITE_RecTriggers 0x00002000 /* Enable recursive triggers */
+#define SQLITE_ForeignKeys 0x00004000 /* Enforce foreign key constraints */
+#define SQLITE_AutoIndex 0x00008000 /* Enable automatic indexes */
+#define SQLITE_LoadExtension 0x00010000 /* Enable load_extension */
+#define SQLITE_LoadExtFunc 0x00020000 /* Enable load_extension() SQL func */
+#define SQLITE_EnableTrigger 0x00040000 /* True to enable triggers */
+#define SQLITE_DeferFKs 0x00080000 /* Defer all FK constraints */
+#define SQLITE_QueryOnly 0x00100000 /* Disable database changes */
+#define SQLITE_CellSizeCk 0x00200000 /* Check btree cell sizes on load */
+#define SQLITE_Fts3Tokenizer 0x00400000 /* Enable fts3_tokenizer(2) */
+#define SQLITE_EnableQPSG 0x00800000 /* Query Planner Stability Guarantee */
+/* Flags used only if debugging */
+#ifdef SQLITE_DEBUG
+#define SQLITE_SqlTrace 0x08000000 /* Debug print SQL as it executes */
+#define SQLITE_VdbeListing 0x10000000 /* Debug listings of VDBE programs */
+#define SQLITE_VdbeTrace 0x20000000 /* True to trace VDBE execution */
+#define SQLITE_VdbeAddopTrace 0x40000000 /* Trace sqlite3VdbeAddOp() calls */
+#define SQLITE_VdbeEQP 0x80000000 /* Debug EXPLAIN QUERY PLAN */
+#endif
+/*
+** Allowed values for sqlite3.mDbFlags
+*/
+#define DBFLAG_SchemaChange 0x0001 /* Uncommitted Hash table changes */
+#define DBFLAG_PreferBuiltin 0x0002 /* Preference to built-in funcs */
+#define DBFLAG_Vacuum 0x0004 /* Currently in a VACUUM */
/*
** Bits of the sqlite3.dbOptFlags field that are used by the
@@ -14273,15 +15298,15 @@ struct sqlite3 {
#define SQLITE_ColumnCache 0x0002 /* Column cache */
#define SQLITE_GroupByOrder 0x0004 /* GROUPBY cover of ORDERBY */
#define SQLITE_FactorOutConst 0x0008 /* Constant factoring */
-/* not used 0x0010 // Was: SQLITE_IdxRealAsInt */
-#define SQLITE_DistinctOpt 0x0020 /* DISTINCT using indexes */
-#define SQLITE_CoverIdxScan 0x0040 /* Covering index scans */
-#define SQLITE_OrderByIdxJoin 0x0080 /* ORDER BY of joins via index */
-#define SQLITE_SubqCoroutine 0x0100 /* Evaluate subqueries as coroutines */
-#define SQLITE_Transitive 0x0200 /* Transitive constraints */
-#define SQLITE_OmitNoopJoin 0x0400 /* Omit unused tables in joins */
+#define SQLITE_DistinctOpt 0x0010 /* DISTINCT using indexes */
+#define SQLITE_CoverIdxScan 0x0020 /* Covering index scans */
+#define SQLITE_OrderByIdxJoin 0x0040 /* ORDER BY of joins via index */
+#define SQLITE_Transitive 0x0080 /* Transitive constraints */
+#define SQLITE_OmitNoopJoin 0x0100 /* Omit unused tables in joins */
+#define SQLITE_CountOfView 0x0200 /* The count-of-view optimization */
+#define SQLITE_CursorHints 0x0400 /* Add OP_CursorHint opcodes */
#define SQLITE_Stat34 0x0800 /* Use STAT3 or STAT4 data */
-#define SQLITE_CursorHints 0x2000 /* Add OP_CursorHint opcodes */
+ /* TH3 expects the Stat34 ^^^^^^ value to be 0x0800. Don't change it */
#define SQLITE_AllOpts 0xffff /* All optimizations */
/*
@@ -14399,7 +15424,14 @@ struct FuncDestructor {
** Like FUNCTION except it omits the SQLITE_FUNC_CONSTANT flag and
** adds the SQLITE_FUNC_SLOCHNG flag. Used for date & time functions
** and functions like sqlite_version() that can change, but not during
-** a single query.
+** a single query. The iArg is ignored. The user-data is always set
+** to a NULL pointer. The bNC parameter is not used.
+**
+** PURE_DATE(zName, nArg, iArg, bNC, xFunc)
+** Used for "pure" date/time functions, this macro is like DFUNCTION
+** except that it does set the SQLITE_FUNC_CONSTANT flags. iArg is
+** ignored and the user-data for these functions is set to an
+** arbitrary non-NULL pointer. The bNC parameter is not used.
**
** AGGREGATE(zName, nArg, iArg, bNC, xStep, xFinal)
** Used to create an aggregate function definition implemented by
@@ -14422,8 +15454,11 @@ struct FuncDestructor {
{nArg, SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \
SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, #zName, {0} }
#define DFUNCTION(zName, nArg, iArg, bNC, xFunc) \
- {nArg, SQLITE_FUNC_SLOCHNG|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \
- SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, #zName, {0} }
+ {nArg, SQLITE_FUNC_SLOCHNG|SQLITE_UTF8, \
+ 0, 0, xFunc, 0, #zName, {0} }
+#define PURE_DATE(zName, nArg, iArg, bNC, xFunc) \
+ {nArg, SQLITE_FUNC_SLOCHNG|SQLITE_UTF8|SQLITE_FUNC_CONSTANT, \
+ (void*)&sqlite3Config, 0, xFunc, 0, #zName, {0} }
#define FUNCTION2(zName, nArg, iArg, bNC, xFunc, extraFlags) \
{nArg,SQLITE_FUNC_CONSTANT|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL)|extraFlags,\
SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, #zName, {0} }
@@ -14802,8 +15837,8 @@ struct FKey {
struct KeyInfo {
u32 nRef; /* Number of references to this KeyInfo object */
u8 enc; /* Text encoding - one of the SQLITE_UTF* values */
- u16 nField; /* Number of key columns in the index */
- u16 nXField; /* Number of columns beyond the key columns */
+ u16 nKeyField; /* Number of key columns in the index */
+ u16 nAllField; /* Total columns, including key plus others */
sqlite3 *db; /* The database connection */
u8 *aSortOrder; /* Sort order for each column. */
CollSeq *aColl[1]; /* Collating sequence for each term of the key */
@@ -14850,8 +15885,8 @@ struct UnpackedRecord {
u16 nField; /* Number of entries in apMem[] */
i8 default_rc; /* Comparison result if keys are equal */
u8 errCode; /* Error detected by xRecordCompare (CORRUPT or NOMEM) */
- i8 r1; /* Value to return if (lhs > rhs) */
- i8 r2; /* Value to return if (rhs < lhs) */
+ i8 r1; /* Value to return if (lhs < rhs) */
+ i8 r2; /* Value to return if (lhs > rhs) */
u8 eqSeen; /* True if an equality comparison has been seen */
};
@@ -15135,7 +16170,8 @@ struct Expr {
** TK_COLUMN: the value of p5 for OP_Column
** TK_AGG_FUNCTION: nesting depth */
AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */
- Table *pTab; /* Table for TK_COLUMN expressions. */
+ Table *pTab; /* Table for TK_COLUMN expressions. Can be NULL
+ ** for a column of an index on an expression */
};
/*
@@ -15143,8 +16179,8 @@ struct Expr {
*/
#define EP_FromJoin 0x000001 /* Originates in ON/USING clause of outer join */
#define EP_Agg 0x000002 /* Contains one or more aggregate functions */
-#define EP_Resolved 0x000004 /* IDs have been resolved to COLUMNs */
-#define EP_Error 0x000008 /* Expression contains one or more errors */
+ /* 0x000004 // available for use */
+ /* 0x000008 // available for use */
#define EP_Distinct 0x000010 /* Aggregate function with DISTINCT keyword */
#define EP_VarSelect 0x000020 /* pSelect is correlated, not constant */
#define EP_DblQuoted 0x000040 /* token.z was originally in "..." */
@@ -15223,7 +16259,6 @@ struct Expr {
*/
struct ExprList {
int nExpr; /* Number of expressions on the list */
- int nAlloc; /* Number of a[] slots allocated */
struct ExprList_item { /* For each expression in the list */
Expr *pExpr; /* The parse tree for this expression */
char *zName; /* Token associated with this expression */
@@ -15611,10 +16646,10 @@ struct Select {
*/
struct SelectDest {
u8 eDest; /* How to dispose of the results. On of SRT_* above. */
- char *zAffSdst; /* Affinity used when eDest==SRT_Set */
int iSDParm; /* A parameter used by the eDest disposal method */
int iSdst; /* Base register where results are written */
int nSdst; /* Number of registers allocated */
+ char *zAffSdst; /* Affinity used when eDest==SRT_Set */
ExprList *pOrderBy; /* Key columns for SRT_Queue and SRT_DistQueue */
};
@@ -15724,8 +16759,8 @@ struct Parse {
int nMem; /* Number of memory cells used so far */
int nOpAlloc; /* Number of slots allocated for Vdbe.aOp[] */
int szOpAlloc; /* Bytes of memory space allocated for Vdbe.aOp[] */
- int ckBase; /* Base register of data during check constraints */
- int iSelfTab; /* Table of an index whose exprs are being coded */
+ int iSelfTab; /* Table for associated with an index on expr, or negative
+ ** of the base register during check-constraint eval */
int iCacheLevel; /* ColCache valid when aColCache[].iLevel<=iCacheLevel */
int iCacheCnt; /* Counter used to generate aColCache[].lru values */
int nLabel; /* Number of labels used */
@@ -15748,7 +16783,7 @@ struct Parse {
AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */
Parse *pToplevel; /* Parse structure for main program (or NULL) */
Table *pTriggerTab; /* Table triggers are being coded for */
- int addrCrTab; /* Address of OP_CreateTable opcode on CREATE TABLE */
+ int addrCrTab; /* Address of OP_CreateBtree opcode on CREATE TABLE */
u32 nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */
u32 oldmask; /* Mask of old.* columns referenced */
u32 newmask; /* Mask of new.* columns referenced */
@@ -15977,11 +17012,10 @@ struct DbFixer {
*/
struct StrAccum {
sqlite3 *db; /* Optional database for lookaside. Can be NULL */
- char *zBase; /* A base allocation. Not from malloc. */
char *zText; /* The string collected so far */
- u32 nChar; /* Length of the string so far */
u32 nAlloc; /* Amount of space allocated in zText */
u32 mxAlloc; /* Maximum allowed allocation. 0 for no malloc usage */
+ u32 nChar; /* Length of the string so far */
u8 accError; /* STRACCUM_NOMEM or STRACCUM_TOOBIG */
u8 printfFlags; /* SQLITE_PRINTF flags below */
};
@@ -16016,6 +17050,7 @@ struct Sqlite3Config {
int bFullMutex; /* True to enable full mutexing */
int bOpenUri; /* True to interpret filenames as URIs */
int bUseCis; /* Use covering indices for full-scans */
+ int bSmallMalloc; /* Avoid large memory allocations if true */
int mxStrlen; /* Maximum string length */
int neverCorrupt; /* Database is always well-formed */
int szLookaside; /* Default lookaside buffer size */
@@ -16029,9 +17064,6 @@ struct Sqlite3Config {
int mnReq, mxReq; /* Min and max heap requests sizes */
sqlite3_int64 szMmap; /* mmap() space per open file */
sqlite3_int64 mxMmap; /* Maximum value for szMmap */
- void *pScratch; /* Scratch memory */
- int szScratch; /* Size of each scratch buffer */
- int nScratch; /* Number of scratch buffers */
void *pPage; /* Page cache memory */
int szPage; /* Size of each page in pPage[] */
int nPage; /* Number of pages in pPage[] */
@@ -16117,6 +17149,11 @@ SQLITE_PRIVATE int sqlite3WalkSelect(Walker*, Select*);
SQLITE_PRIVATE int sqlite3WalkSelectExpr(Walker*, Select*);
SQLITE_PRIVATE int sqlite3WalkSelectFrom(Walker*, Select*);
SQLITE_PRIVATE int sqlite3ExprWalkNoop(Walker*, Expr*);
+SQLITE_PRIVATE int sqlite3SelectWalkNoop(Walker*, Select*);
+SQLITE_PRIVATE int sqlite3SelectWalkFail(Walker*, Select*);
+#ifdef SQLITE_DEBUG
+SQLITE_PRIVATE void sqlite3SelectWalkAssert2(Walker*, Select*);
+#endif
/*
** Return code from the parse-tree walking primitives and their
@@ -16178,11 +17215,14 @@ SQLITE_PRIVATE int sqlite3CantopenError(int);
#ifdef SQLITE_DEBUG
SQLITE_PRIVATE int sqlite3NomemError(int);
SQLITE_PRIVATE int sqlite3IoerrnomemError(int);
+SQLITE_PRIVATE int sqlite3CorruptPgnoError(int,Pgno);
# define SQLITE_NOMEM_BKPT sqlite3NomemError(__LINE__)
# define SQLITE_IOERR_NOMEM_BKPT sqlite3IoerrnomemError(__LINE__)
+# define SQLITE_CORRUPT_PGNO(P) sqlite3CorruptPgnoError(__LINE__,(P))
#else
# define SQLITE_NOMEM_BKPT SQLITE_NOMEM
# define SQLITE_IOERR_NOMEM_BKPT SQLITE_IOERR_NOMEM
+# define SQLITE_CORRUPT_PGNO(P) sqlite3CorruptError(__LINE__)
#endif
/*
@@ -16263,8 +17303,6 @@ SQLITE_PRIVATE void sqlite3DbFree(sqlite3*, void*);
SQLITE_PRIVATE void sqlite3DbFreeNN(sqlite3*, void*);
SQLITE_PRIVATE int sqlite3MallocSize(void*);
SQLITE_PRIVATE int sqlite3DbMallocSize(sqlite3*, void*);
-SQLITE_PRIVATE void *sqlite3ScratchMalloc(int);
-SQLITE_PRIVATE void sqlite3ScratchFree(void*);
SQLITE_PRIVATE void *sqlite3PageMalloc(int);
SQLITE_PRIVATE void sqlite3PageFree(void*);
SQLITE_PRIVATE void sqlite3MemSetDefault(void);
@@ -16320,6 +17358,7 @@ SQLITE_PRIVATE sqlite3_int64 sqlite3StatusValue(int);
SQLITE_PRIVATE void sqlite3StatusUp(int, int);
SQLITE_PRIVATE void sqlite3StatusDown(int, int);
SQLITE_PRIVATE void sqlite3StatusHighwater(int, int);
+SQLITE_PRIVATE int sqlite3LookasideUsed(sqlite3*,int*);
/* Access to mutexes used by sqlite3_status() */
SQLITE_PRIVATE sqlite3_mutex *sqlite3Pcache1Mutex(void);
@@ -16551,10 +17590,10 @@ SQLITE_PRIVATE void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*);
SQLITE_PRIVATE void sqlite3Vacuum(Parse*,Token*);
SQLITE_PRIVATE int sqlite3RunVacuum(char**, sqlite3*, int);
SQLITE_PRIVATE char *sqlite3NameFromToken(sqlite3*, Token*);
-SQLITE_PRIVATE int sqlite3ExprCompare(Expr*, Expr*, int);
+SQLITE_PRIVATE int sqlite3ExprCompare(Parse*,Expr*, Expr*, int);
SQLITE_PRIVATE int sqlite3ExprCompareSkip(Expr*, Expr*, int);
SQLITE_PRIVATE int sqlite3ExprListCompare(ExprList*, ExprList*, int);
-SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Expr*, Expr*, int);
+SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Parse*,Expr*, Expr*, int);
SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext*, Expr*);
SQLITE_PRIVATE void sqlite3ExprAnalyzeAggList(NameContext*,ExprList*);
SQLITE_PRIVATE int sqlite3ExprCoveredByIndex(Expr*, int iCur, Index *pIdx);
@@ -16568,8 +17607,7 @@ SQLITE_PRIVATE void sqlite3RollbackAll(sqlite3*,int);
SQLITE_PRIVATE void sqlite3CodeVerifySchema(Parse*, int);
SQLITE_PRIVATE void sqlite3CodeVerifyNamedSchema(Parse*, const char *zDb);
SQLITE_PRIVATE void sqlite3BeginTransaction(Parse*, int);
-SQLITE_PRIVATE void sqlite3CommitTransaction(Parse*);
-SQLITE_PRIVATE void sqlite3RollbackTransaction(Parse*);
+SQLITE_PRIVATE void sqlite3EndTransaction(Parse*,int);
SQLITE_PRIVATE void sqlite3Savepoint(Parse*, int, Token*);
SQLITE_PRIVATE void sqlite3CloseSavepoints(sqlite3 *);
SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3*);
@@ -16690,7 +17728,9 @@ SQLITE_PRIVATE int sqlite3FixTriggerStep(DbFixer*, TriggerStep*);
SQLITE_PRIVATE int sqlite3AtoF(const char *z, double*, int, u8);
SQLITE_PRIVATE int sqlite3GetInt32(const char *, int*);
SQLITE_PRIVATE int sqlite3Atoi(const char*);
+#ifndef SQLITE_OMIT_UTF16
SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *pData, int nChar);
+#endif
SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *pData, int nByte);
SQLITE_PRIVATE u32 sqlite3Utf8Read(const u8**);
SQLITE_PRIVATE LogEst sqlite3LogEst(u64);
@@ -16755,6 +17795,8 @@ SQLITE_PRIVATE int sqlite3ReadSchema(Parse *pParse);
SQLITE_PRIVATE CollSeq *sqlite3FindCollSeq(sqlite3*,u8 enc, const char*,int);
SQLITE_PRIVATE CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char*zName);
SQLITE_PRIVATE CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr);
+SQLITE_PRIVATE CollSeq *sqlite3ExprNNCollSeq(Parse *pParse, Expr *pExpr);
+SQLITE_PRIVATE int sqlite3ExprCollSeqMatch(Parse*,Expr*,Expr*);
SQLITE_PRIVATE Expr *sqlite3ExprAddCollateToken(Parse *pParse, Expr*, const Token*, int);
SQLITE_PRIVATE Expr *sqlite3ExprAddCollateString(Parse*,Expr*,const char*);
SQLITE_PRIVATE Expr *sqlite3ExprSkipCollate(Expr*);
@@ -16779,7 +17821,9 @@ SQLITE_PRIVATE void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8,
SQLITE_PRIVATE void sqlite3ValueSetNull(sqlite3_value*);
SQLITE_PRIVATE void sqlite3ValueFree(sqlite3_value*);
SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *);
+#ifndef SQLITE_OMIT_UTF16
SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *, const void*, int, u8);
+#endif
SQLITE_PRIVATE int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **);
SQLITE_PRIVATE void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8);
#ifndef SQLITE_AMALGAMATION
@@ -17036,7 +18080,8 @@ SQLITE_PRIVATE int sqlite3FindInIndex(Parse *, Expr *, u32, int*, int*);
SQLITE_PRIVATE int sqlite3JournalOpen(sqlite3_vfs *, const char *, sqlite3_file *, int, int);
SQLITE_PRIVATE int sqlite3JournalSize(sqlite3_vfs *);
-#ifdef SQLITE_ENABLE_ATOMIC_WRITE
+#if defined(SQLITE_ENABLE_ATOMIC_WRITE) \
+ || defined(SQLITE_ENABLE_BATCH_ATOMIC_WRITE)
SQLITE_PRIVATE int sqlite3JournalCreate(sqlite3_file *);
#endif
@@ -17122,8 +18167,7 @@ SQLITE_PRIVATE int sqlite3MemdebugNoType(void*,u8);
#endif
#define MEMTYPE_HEAP 0x01 /* General heap allocations */
#define MEMTYPE_LOOKASIDE 0x02 /* Heap that might have been lookaside */
-#define MEMTYPE_SCRATCH 0x04 /* Scratch allocations */
-#define MEMTYPE_PCACHE 0x08 /* Page cache allocations */
+#define MEMTYPE_PCACHE 0x04 /* Page cache allocations */
/*
** Threading interface
@@ -17133,6 +18177,9 @@ SQLITE_PRIVATE int sqlite3ThreadCreate(SQLiteThread**,void*(*)(void*),void*);
SQLITE_PRIVATE int sqlite3ThreadJoin(SQLiteThread*, void**);
#endif
+#if defined(SQLITE_ENABLE_DBPAGE_VTAB) || defined(SQLITE_TEST)
+SQLITE_PRIVATE int sqlite3DbpageRegister(sqlite3*);
+#endif
#if defined(SQLITE_ENABLE_DBSTAT_VTAB) || defined(SQLITE_TEST)
SQLITE_PRIVATE int sqlite3DbstatRegister(sqlite3*);
#endif
@@ -17143,6 +18190,10 @@ SQLITE_PRIVATE Expr *sqlite3VectorFieldSubexpr(Expr*, int);
SQLITE_PRIVATE Expr *sqlite3ExprForVectorField(Parse*,Expr*,int);
SQLITE_PRIVATE void sqlite3VectorErrorMsg(Parse*, Expr*);
+#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
+SQLITE_PRIVATE const char **sqlite3CompileOptions(int *pnOpt);
+#endif
+
#endif /* SQLITEINT_H */
/************** End of sqliteInt.h *******************************************/
@@ -17348,6 +18399,7 @@ SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config = {
SQLITE_THREADSAFE==1, /* bFullMutex */
SQLITE_USE_URI, /* bOpenUri */
SQLITE_ALLOW_COVERING_INDEX_SCAN, /* bUseCis */
+ 0, /* bSmallMalloc */
0x7ffffffe, /* mxStrlen */
0, /* neverCorrupt */
SQLITE_DEFAULT_LOOKASIDE, /* szLookaside, nLookaside */
@@ -17360,9 +18412,6 @@ SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config = {
0, 0, /* mnHeap, mxHeap */
SQLITE_DEFAULT_MMAP_SIZE, /* szMmap */
SQLITE_MAX_MMAP_SIZE, /* mxMmap */
- (void*)0, /* pScratch */
- 0, /* szScratch */
- 0, /* nScratch */
(void*)0, /* pPage */
0, /* szPage */
SQLITE_DEFAULT_PCACHE_INITSZ, /* nPage */
@@ -17447,472 +18496,6 @@ SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[] = OPFLG_INITIALIZER;
SQLITE_PRIVATE const char sqlite3StrBINARY[] = "BINARY";
/************** End of global.c **********************************************/
-/************** Begin file ctime.c *******************************************/
-/*
-** 2010 February 23
-**
-** The author disclaims copyright to this source code. In place of
-** a legal notice, here is a blessing:
-**
-** May you do good and not evil.
-** May you find forgiveness for yourself and forgive others.
-** May you share freely, never taking more than you give.
-**
-*************************************************************************
-**
-** This file implements routines used to report what compile-time options
-** SQLite was built with.
-*/
-
-#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
-
-/* #include "sqliteInt.h" */
-
-/*
-** An array of names of all compile-time options. This array should
-** be sorted A-Z.
-**
-** This array looks large, but in a typical installation actually uses
-** only a handful of compile-time options, so most times this array is usually
-** rather short and uses little memory space.
-*/
-static const char * const azCompileOpt[] = {
-
-/* These macros are provided to "stringify" the value of the define
-** for those options in which the value is meaningful. */
-#define CTIMEOPT_VAL_(opt) #opt
-#define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt)
-
-#if SQLITE_32BIT_ROWID
- "32BIT_ROWID",
-#endif
-#if SQLITE_4_BYTE_ALIGNED_MALLOC
- "4_BYTE_ALIGNED_MALLOC",
-#endif
-#if SQLITE_CASE_SENSITIVE_LIKE
- "CASE_SENSITIVE_LIKE",
-#endif
-#if SQLITE_CHECK_PAGES
- "CHECK_PAGES",
-#endif
-#if defined(__clang__) && defined(__clang_major__)
- "COMPILER=clang-" CTIMEOPT_VAL(__clang_major__) "."
- CTIMEOPT_VAL(__clang_minor__) "."
- CTIMEOPT_VAL(__clang_patchlevel__),
-#elif defined(_MSC_VER)
- "COMPILER=msvc-" CTIMEOPT_VAL(_MSC_VER),
-#elif defined(__GNUC__) && defined(__VERSION__)
- "COMPILER=gcc-" __VERSION__,
-#endif
-#if SQLITE_COVERAGE_TEST
- "COVERAGE_TEST",
-#endif
-#ifdef SQLITE_DEBUG
- "DEBUG",
-#endif
-#if SQLITE_DEFAULT_LOCKING_MODE
- "DEFAULT_LOCKING_MODE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE),
-#endif
-#if defined(SQLITE_DEFAULT_MMAP_SIZE) && !defined(SQLITE_DEFAULT_MMAP_SIZE_xc)
- "DEFAULT_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_MMAP_SIZE),
-#endif
-#if SQLITE_DEFAULT_SYNCHRONOUS
- "DEFAULT_SYNCHRONOUS=" CTIMEOPT_VAL(SQLITE_DEFAULT_SYNCHRONOUS),
-#endif
-#if SQLITE_DEFAULT_WAL_SYNCHRONOUS
- "DEFAULT_WAL_SYNCHRONOUS=" CTIMEOPT_VAL(SQLITE_DEFAULT_WAL_SYNCHRONOUS),
-#endif
-#if SQLITE_DIRECT_OVERFLOW_READ
- "DIRECT_OVERFLOW_READ",
-#endif
-#if SQLITE_DISABLE_DIRSYNC
- "DISABLE_DIRSYNC",
-#endif
-#if SQLITE_DISABLE_LFS
- "DISABLE_LFS",
-#endif
-#if SQLITE_ENABLE_8_3_NAMES
- "ENABLE_8_3_NAMES=" CTIMEOPT_VAL(SQLITE_ENABLE_8_3_NAMES),
-#endif
-#if SQLITE_ENABLE_API_ARMOR
- "ENABLE_API_ARMOR",
-#endif
-#if SQLITE_ENABLE_ATOMIC_WRITE
- "ENABLE_ATOMIC_WRITE",
-#endif
-#if SQLITE_ENABLE_CEROD
- "ENABLE_CEROD",
-#endif
-#if SQLITE_ENABLE_COLUMN_METADATA
- "ENABLE_COLUMN_METADATA",
-#endif
-#if SQLITE_ENABLE_DBSTAT_VTAB
- "ENABLE_DBSTAT_VTAB",
-#endif
-#if SQLITE_ENABLE_EXPENSIVE_ASSERT
- "ENABLE_EXPENSIVE_ASSERT",
-#endif
-#if SQLITE_ENABLE_FTS1
- "ENABLE_FTS1",
-#endif
-#if SQLITE_ENABLE_FTS2
- "ENABLE_FTS2",
-#endif
-#if SQLITE_ENABLE_FTS3
- "ENABLE_FTS3",
-#endif
-#if SQLITE_ENABLE_FTS3_PARENTHESIS
- "ENABLE_FTS3_PARENTHESIS",
-#endif
-#if SQLITE_ENABLE_FTS4
- "ENABLE_FTS4",
-#endif
-#if SQLITE_ENABLE_FTS5
- "ENABLE_FTS5",
-#endif
-#if SQLITE_ENABLE_ICU
- "ENABLE_ICU",
-#endif
-#if SQLITE_ENABLE_IOTRACE
- "ENABLE_IOTRACE",
-#endif
-#if SQLITE_ENABLE_JSON1
- "ENABLE_JSON1",
-#endif
-#if SQLITE_ENABLE_LOAD_EXTENSION
- "ENABLE_LOAD_EXTENSION",
-#endif
-#if SQLITE_ENABLE_LOCKING_STYLE
- "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE),
-#endif
-#if SQLITE_ENABLE_MEMORY_MANAGEMENT
- "ENABLE_MEMORY_MANAGEMENT",
-#endif
-#if SQLITE_ENABLE_MEMSYS3
- "ENABLE_MEMSYS3",
-#endif
-#if SQLITE_ENABLE_MEMSYS5
- "ENABLE_MEMSYS5",
-#endif
-#if SQLITE_ENABLE_OVERSIZE_CELL_CHECK
- "ENABLE_OVERSIZE_CELL_CHECK",
-#endif
-#if SQLITE_ENABLE_RTREE
- "ENABLE_RTREE",
-#endif
-#if defined(SQLITE_ENABLE_STAT4)
- "ENABLE_STAT4",
-#elif defined(SQLITE_ENABLE_STAT3)
- "ENABLE_STAT3",
-#endif
-#if SQLITE_ENABLE_UNLOCK_NOTIFY
- "ENABLE_UNLOCK_NOTIFY",
-#endif
-#if SQLITE_ENABLE_UPDATE_DELETE_LIMIT
- "ENABLE_UPDATE_DELETE_LIMIT",
-#endif
-#if defined(SQLITE_ENABLE_URI_00_ERROR)
- "ENABLE_URI_00_ERROR",
-#endif
-#if SQLITE_HAS_CODEC
- "HAS_CODEC",
-#endif
-#if HAVE_ISNAN || SQLITE_HAVE_ISNAN
- "HAVE_ISNAN",
-#endif
-#if SQLITE_HOMEGROWN_RECURSIVE_MUTEX
- "HOMEGROWN_RECURSIVE_MUTEX",
-#endif
-#if SQLITE_IGNORE_AFP_LOCK_ERRORS
- "IGNORE_AFP_LOCK_ERRORS",
-#endif
-#if SQLITE_IGNORE_FLOCK_LOCK_ERRORS
- "IGNORE_FLOCK_LOCK_ERRORS",
-#endif
-#ifdef SQLITE_INT64_TYPE
- "INT64_TYPE",
-#endif
-#ifdef SQLITE_LIKE_DOESNT_MATCH_BLOBS
- "LIKE_DOESNT_MATCH_BLOBS",
-#endif
-#if SQLITE_LOCK_TRACE
- "LOCK_TRACE",
-#endif
-#if defined(SQLITE_MAX_MMAP_SIZE) && !defined(SQLITE_MAX_MMAP_SIZE_xc)
- "MAX_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_MMAP_SIZE),
-#endif
-#ifdef SQLITE_MAX_SCHEMA_RETRY
- "MAX_SCHEMA_RETRY=" CTIMEOPT_VAL(SQLITE_MAX_SCHEMA_RETRY),
-#endif
-#if SQLITE_MEMDEBUG
- "MEMDEBUG",
-#endif
-#if SQLITE_MIXED_ENDIAN_64BIT_FLOAT
- "MIXED_ENDIAN_64BIT_FLOAT",
-#endif
-#if SQLITE_NO_SYNC
- "NO_SYNC",
-#endif
-#if SQLITE_OMIT_ALTERTABLE
- "OMIT_ALTERTABLE",
-#endif
-#if SQLITE_OMIT_ANALYZE
- "OMIT_ANALYZE",
-#endif
-#if SQLITE_OMIT_ATTACH
- "OMIT_ATTACH",
-#endif
-#if SQLITE_OMIT_AUTHORIZATION
- "OMIT_AUTHORIZATION",
-#endif
-#if SQLITE_OMIT_AUTOINCREMENT
- "OMIT_AUTOINCREMENT",
-#endif
-#if SQLITE_OMIT_AUTOINIT
- "OMIT_AUTOINIT",
-#endif
-#if SQLITE_OMIT_AUTOMATIC_INDEX
- "OMIT_AUTOMATIC_INDEX",
-#endif
-#if SQLITE_OMIT_AUTORESET
- "OMIT_AUTORESET",
-#endif
-#if SQLITE_OMIT_AUTOVACUUM
- "OMIT_AUTOVACUUM",
-#endif
-#if SQLITE_OMIT_BETWEEN_OPTIMIZATION
- "OMIT_BETWEEN_OPTIMIZATION",
-#endif
-#if SQLITE_OMIT_BLOB_LITERAL
- "OMIT_BLOB_LITERAL",
-#endif
-#if SQLITE_OMIT_BTREECOUNT
- "OMIT_BTREECOUNT",
-#endif
-#if SQLITE_OMIT_CAST
- "OMIT_CAST",
-#endif
-#if SQLITE_OMIT_CHECK
- "OMIT_CHECK",
-#endif
-#if SQLITE_OMIT_COMPLETE
- "OMIT_COMPLETE",
-#endif
-#if SQLITE_OMIT_COMPOUND_SELECT
- "OMIT_COMPOUND_SELECT",
-#endif
-#if SQLITE_OMIT_CTE
- "OMIT_CTE",
-#endif
-#if SQLITE_OMIT_DATETIME_FUNCS
- "OMIT_DATETIME_FUNCS",
-#endif
-#if SQLITE_OMIT_DECLTYPE
- "OMIT_DECLTYPE",
-#endif
-#if SQLITE_OMIT_DEPRECATED
- "OMIT_DEPRECATED",
-#endif
-#if SQLITE_OMIT_DISKIO
- "OMIT_DISKIO",
-#endif
-#if SQLITE_OMIT_EXPLAIN
- "OMIT_EXPLAIN",
-#endif
-#if SQLITE_OMIT_FLAG_PRAGMAS
- "OMIT_FLAG_PRAGMAS",
-#endif
-#if SQLITE_OMIT_FLOATING_POINT
- "OMIT_FLOATING_POINT",
-#endif
-#if SQLITE_OMIT_FOREIGN_KEY
- "OMIT_FOREIGN_KEY",
-#endif
-#if SQLITE_OMIT_GET_TABLE
- "OMIT_GET_TABLE",
-#endif
-#if SQLITE_OMIT_INCRBLOB
- "OMIT_INCRBLOB",
-#endif
-#if SQLITE_OMIT_INTEGRITY_CHECK
- "OMIT_INTEGRITY_CHECK",
-#endif
-#if SQLITE_OMIT_LIKE_OPTIMIZATION
- "OMIT_LIKE_OPTIMIZATION",
-#endif
-#if SQLITE_OMIT_LOAD_EXTENSION
- "OMIT_LOAD_EXTENSION",
-#endif
-#if SQLITE_OMIT_LOCALTIME
- "OMIT_LOCALTIME",
-#endif
-#if SQLITE_OMIT_LOOKASIDE
- "OMIT_LOOKASIDE",
-#endif
-#if SQLITE_OMIT_MEMORYDB
- "OMIT_MEMORYDB",
-#endif
-#if SQLITE_OMIT_OR_OPTIMIZATION
- "OMIT_OR_OPTIMIZATION",
-#endif
-#if SQLITE_OMIT_PAGER_PRAGMAS
- "OMIT_PAGER_PRAGMAS",
-#endif
-#if SQLITE_OMIT_PRAGMA
- "OMIT_PRAGMA",
-#endif
-#if SQLITE_OMIT_PROGRESS_CALLBACK
- "OMIT_PROGRESS_CALLBACK",
-#endif
-#if SQLITE_OMIT_QUICKBALANCE
- "OMIT_QUICKBALANCE",
-#endif
-#if SQLITE_OMIT_REINDEX
- "OMIT_REINDEX",
-#endif
-#if SQLITE_OMIT_SCHEMA_PRAGMAS
- "OMIT_SCHEMA_PRAGMAS",
-#endif
-#if SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS
- "OMIT_SCHEMA_VERSION_PRAGMAS",
-#endif
-#if SQLITE_OMIT_SHARED_CACHE
- "OMIT_SHARED_CACHE",
-#endif
-#if SQLITE_OMIT_SUBQUERY
- "OMIT_SUBQUERY",
-#endif
-#if SQLITE_OMIT_TCL_VARIABLE
- "OMIT_TCL_VARIABLE",
-#endif
-#if SQLITE_OMIT_TEMPDB
- "OMIT_TEMPDB",
-#endif
-#if SQLITE_OMIT_TRACE
- "OMIT_TRACE",
-#endif
-#if SQLITE_OMIT_TRIGGER
- "OMIT_TRIGGER",
-#endif
-#if SQLITE_OMIT_TRUNCATE_OPTIMIZATION
- "OMIT_TRUNCATE_OPTIMIZATION",
-#endif
-#if SQLITE_OMIT_UTF16
- "OMIT_UTF16",
-#endif
-#if SQLITE_OMIT_VACUUM
- "OMIT_VACUUM",
-#endif
-#if SQLITE_OMIT_VIEW
- "OMIT_VIEW",
-#endif
-#if SQLITE_OMIT_VIRTUALTABLE
- "OMIT_VIRTUALTABLE",
-#endif
-#if SQLITE_OMIT_WAL
- "OMIT_WAL",
-#endif
-#if SQLITE_OMIT_WSD
- "OMIT_WSD",
-#endif
-#if SQLITE_OMIT_XFER_OPT
- "OMIT_XFER_OPT",
-#endif
-#if SQLITE_PERFORMANCE_TRACE
- "PERFORMANCE_TRACE",
-#endif
-#if SQLITE_PROXY_DEBUG
- "PROXY_DEBUG",
-#endif
-#if SQLITE_RTREE_INT_ONLY
- "RTREE_INT_ONLY",
-#endif
-#if SQLITE_SECURE_DELETE
- "SECURE_DELETE",
-#endif
-#if SQLITE_SMALL_STACK
- "SMALL_STACK",
-#endif
-#if SQLITE_SOUNDEX
- "SOUNDEX",
-#endif
-#if SQLITE_SYSTEM_MALLOC
- "SYSTEM_MALLOC",
-#endif
-#if SQLITE_TCL
- "TCL",
-#endif
-#if defined(SQLITE_TEMP_STORE) && !defined(SQLITE_TEMP_STORE_xc)
- "TEMP_STORE=" CTIMEOPT_VAL(SQLITE_TEMP_STORE),
-#endif
-#if SQLITE_TEST
- "TEST",
-#endif
-#if defined(SQLITE_THREADSAFE)
- "THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE),
-#endif
-#if SQLITE_UNTESTABLE
- "UNTESTABLE"
-#endif
-#if SQLITE_USE_ALLOCA
- "USE_ALLOCA",
-#endif
-#if SQLITE_USER_AUTHENTICATION
- "USER_AUTHENTICATION",
-#endif
-#if SQLITE_WIN32_MALLOC
- "WIN32_MALLOC",
-#endif
-#if SQLITE_ZERO_MALLOC
- "ZERO_MALLOC"
-#endif
-};
-
-/*
-** Given the name of a compile-time option, return true if that option
-** was used and false if not.
-**
-** The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix
-** is not required for a match.
-*/
-SQLITE_API int sqlite3_compileoption_used(const char *zOptName){
- int i, n;
-
-#if SQLITE_ENABLE_API_ARMOR
- if( zOptName==0 ){
- (void)SQLITE_MISUSE_BKPT;
- return 0;
- }
-#endif
- if( sqlite3StrNICmp(zOptName, "SQLITE_", 7)==0 ) zOptName += 7;
- n = sqlite3Strlen30(zOptName);
-
- /* Since ArraySize(azCompileOpt) is normally in single digits, a
- ** linear search is adequate. No need for a binary search. */
- for(i=0; i<ArraySize(azCompileOpt); i++){
- if( sqlite3StrNICmp(zOptName, azCompileOpt[i], n)==0
- && sqlite3IsIdChar((unsigned char)azCompileOpt[i][n])==0
- ){
- return 1;
- }
- }
- return 0;
-}
-
-/*
-** Return the N-th compile-time option string. If N is out of range,
-** return a NULL pointer.
-*/
-SQLITE_API const char *sqlite3_compileoption_get(int N){
- if( N>=0 && N<ArraySize(azCompileOpt) ){
- return azCompileOpt[N];
- }
- return 0;
-}
-
-#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
-
-/************** End of ctime.c ***********************************************/
/************** Begin file status.c ******************************************/
/*
** 2008 June 18
@@ -18030,18 +18613,18 @@ struct VdbeCursor {
u32 cacheStatus; /* Cache is valid if this matches Vdbe.cacheCtr */
int seekResult; /* Result of previous sqlite3BtreeMoveto() or 0
** if there have been no prior seeks on the cursor. */
- /* NB: seekResult does not distinguish between "no seeks have ever occurred
- ** on this cursor" and "the most recent seek was an exact match". */
+ /* seekResult does not distinguish between "no seeks have ever occurred
+ ** on this cursor" and "the most recent seek was an exact match".
+ ** For CURTYPE_PSEUDO, seekResult is the register holding the record */
/* When a new VdbeCursor is allocated, only the fields above are zeroed.
** The fields that follow are uninitialized, and must be individually
** initialized prior to first use. */
VdbeCursor *pAltCursor; /* Associated index cursor from which to read */
union {
- BtCursor *pCursor; /* CURTYPE_BTREE. Btree cursor */
- sqlite3_vtab_cursor *pVCur; /* CURTYPE_VTAB. Vtab cursor */
- int pseudoTableReg; /* CURTYPE_PSEUDO. Reg holding content. */
- VdbeSorter *pSorter; /* CURTYPE_SORTER. Sorter object */
+ BtCursor *pCursor; /* CURTYPE_BTREE or _PSEUDO. Btree cursor */
+ sqlite3_vtab_cursor *pVCur; /* CURTYPE_VTAB. Vtab cursor */
+ VdbeSorter *pSorter; /* CURTYPE_SORTER. Sorter object */
} uc;
KeyInfo *pKeyInfo; /* Info about index keys needed by index cursors */
u32 iHdrOffset; /* Offset to next unparsed byte of the header */
@@ -18123,7 +18706,8 @@ struct sqlite3_value {
union MemValue {
double r; /* Real value used when MEM_Real is set in flags */
i64 i; /* Integer value used when MEM_Int is set in flags */
- int nZero; /* Used when bit MEM_Zero is set in flags */
+ int nZero; /* Extra zero bytes when MEM_Zero and MEM_Blob set */
+ const char *zPType; /* Pointer type when MEM_Term|MEM_Subtype|MEM_Null */
FuncDef *pDef; /* Used only when flags==MEM_Agg */
RowSet *pRowSet; /* Used only when flags==MEM_RowSet */
VdbeFrame *pFrame; /* Used when flags==MEM_Frame */
@@ -18155,7 +18739,8 @@ struct sqlite3_value {
** representations of the value stored in the Mem struct.
**
** If the MEM_Null flag is set, then the value is an SQL NULL value.
-** No other flags may be set in this case.
+** For a pointer type created using sqlite3_bind_pointer() or
+** sqlite3_result_pointer() the MEM_Term and MEM_Subtype flags are also set.
**
** If the MEM_Str flag is set then Mem.z points at a string representation.
** Usually this is encoded in the same unicode encoding as the main
@@ -18163,7 +18748,7 @@ struct sqlite3_value {
** set, then the string is nul terminated. The MEM_Int and MEM_Real
** flags may coexist with the MEM_Str flag.
*/
-#define MEM_Null 0x0001 /* Value is NULL */
+#define MEM_Null 0x0001 /* Value is NULL (or a pointer) */
#define MEM_Str 0x0002 /* Value is a string */
#define MEM_Int 0x0004 /* Value is an integer */
#define MEM_Real 0x0008 /* Value is a real number */
@@ -18173,7 +18758,7 @@ struct sqlite3_value {
#define MEM_Frame 0x0040 /* Value is a VdbeFrame object */
#define MEM_Undefined 0x0080 /* Value is undefined */
#define MEM_Cleared 0x0100 /* NULL set by OP_Null, not from data */
-#define MEM_TypeMask 0x81ff /* Mask of type bits */
+#define MEM_TypeMask 0xc1ff /* Mask of type bits */
/* Whenever Mem contains a valid string or blob representation, one of
@@ -18181,7 +18766,7 @@ struct sqlite3_value {
** policy for Mem.z. The MEM_Term flag tells us whether or not the
** string is \000 or \u0000 terminated
*/
-#define MEM_Term 0x0200 /* String rep is nul terminated */
+#define MEM_Term 0x0200 /* String in Mem.z is zero terminated */
#define MEM_Dyn 0x0400 /* Need to call Mem.xDel() on Mem.z */
#define MEM_Static 0x0800 /* Mem.z points to a static string */
#define MEM_Ephem 0x1000 /* Mem.z points to an ephemeral string */
@@ -18316,6 +18901,7 @@ struct Vdbe {
u16 nResColumn; /* Number of columns in one row of the result set */
u8 errorAction; /* Recovery action to do in case of an error */
u8 minWriteFileFormat; /* Minimum file format for writable database files */
+ u8 prepFlags; /* SQLITE_PREPARE_* flags */
bft expired:1; /* True if the VM needs to be recompiled */
bft doingRerun:1; /* True if rerunning after an auto-reprepare */
bft explain:2; /* True if EXPLAIN present on SQL command */
@@ -18324,10 +18910,9 @@ struct Vdbe {
bft usesStmtJournal:1; /* True if uses a statement journal */
bft readOnly:1; /* True for statements that do not write */
bft bIsReader:1; /* True for statements that read */
- bft isPrepareV2:1; /* True if prepared with prepare_v2() */
yDbMask btreeMask; /* Bitmask of db->aDb[] entries referenced */
yDbMask lockMask; /* Subset of btreeMask that requires a lock */
- u32 aCounter[5]; /* Counters used by sqlite3_stmt_status() */
+ u32 aCounter[7]; /* Counters used by sqlite3_stmt_status() */
char *zSql; /* Text of the SQL statement that generated this */
void *pFree; /* Free this when deleting the vdbe */
VdbeFrame *pFrame; /* Parent frame */
@@ -18409,6 +18994,7 @@ SQLITE_PRIVATE void sqlite3VdbeMemSetInt64(Mem*, i64);
#else
SQLITE_PRIVATE void sqlite3VdbeMemSetDouble(Mem*, double);
#endif
+SQLITE_PRIVATE void sqlite3VdbeMemSetPointer(Mem*, void*, const char*, void(*)(void*));
SQLITE_PRIVATE void sqlite3VdbeMemInit(Mem*,sqlite3*,u16);
SQLITE_PRIVATE void sqlite3VdbeMemSetNull(Mem*);
SQLITE_PRIVATE void sqlite3VdbeMemSetZeroBlob(Mem*,int);
@@ -18440,7 +19026,7 @@ SQLITE_PRIVATE int sqlite3VdbeSorterInit(sqlite3 *, int, VdbeCursor *);
SQLITE_PRIVATE void sqlite3VdbeSorterReset(sqlite3 *, VdbeSorter *);
SQLITE_PRIVATE void sqlite3VdbeSorterClose(sqlite3 *, VdbeCursor *);
SQLITE_PRIVATE int sqlite3VdbeSorterRowkey(const VdbeCursor *, Mem *);
-SQLITE_PRIVATE int sqlite3VdbeSorterNext(sqlite3 *, const VdbeCursor *, int *);
+SQLITE_PRIVATE int sqlite3VdbeSorterNext(sqlite3 *, const VdbeCursor *);
SQLITE_PRIVATE int sqlite3VdbeSorterRewind(const VdbeCursor *, int *);
SQLITE_PRIVATE int sqlite3VdbeSorterWrite(const VdbeCursor *, Mem *);
SQLITE_PRIVATE int sqlite3VdbeSorterCompare(const VdbeCursor *, Mem *, int, int *);
@@ -18468,12 +19054,14 @@ SQLITE_PRIVATE int sqlite3VdbeCheckFk(Vdbe *, int);
# define sqlite3VdbeCheckFk(p,i) 0
#endif
-SQLITE_PRIVATE int sqlite3VdbeMemTranslate(Mem*, u8);
#ifdef SQLITE_DEBUG
SQLITE_PRIVATE void sqlite3VdbePrintSql(Vdbe*);
SQLITE_PRIVATE void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf);
#endif
-SQLITE_PRIVATE int sqlite3VdbeMemHandleBom(Mem *pMem);
+#ifndef SQLITE_OMIT_UTF16
+SQLITE_PRIVATE int sqlite3VdbeMemTranslate(Mem*, u8);
+SQLITE_PRIVATE int sqlite3VdbeMemHandleBom(Mem *pMem);
+#endif
#ifndef SQLITE_OMIT_INCRBLOB
SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *);
@@ -18594,7 +19182,6 @@ SQLITE_PRIVATE void sqlite3StatusHighwater(int op, int X){
: sqlite3MallocMutex()) );
assert( op==SQLITE_STATUS_MALLOC_SIZE
|| op==SQLITE_STATUS_PAGECACHE_SIZE
- || op==SQLITE_STATUS_SCRATCH_SIZE
|| op==SQLITE_STATUS_PARSER_STACK );
if( newValue>wsdStat.mxValue[op] ){
wsdStat.mxValue[op] = newValue;
@@ -18644,6 +19231,28 @@ SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetF
}
/*
+** Return the number of LookasideSlot elements on the linked list
+*/
+static u32 countLookasideSlots(LookasideSlot *p){
+ u32 cnt = 0;
+ while( p ){
+ p = p->pNext;
+ cnt++;
+ }
+ return cnt;
+}
+
+/*
+** Count the number of slots of lookaside memory that are outstanding
+*/
+SQLITE_PRIVATE int sqlite3LookasideUsed(sqlite3 *db, int *pHighwater){
+ u32 nInit = countLookasideSlots(db->lookaside.pInit);
+ u32 nFree = countLookasideSlots(db->lookaside.pFree);
+ if( pHighwater ) *pHighwater = db->lookaside.nSlot - nInit;
+ return db->lookaside.nSlot - (nInit+nFree);
+}
+
+/*
** Query status information for a single database connection
*/
SQLITE_API int sqlite3_db_status(
@@ -18662,10 +19271,15 @@ SQLITE_API int sqlite3_db_status(
sqlite3_mutex_enter(db->mutex);
switch( op ){
case SQLITE_DBSTATUS_LOOKASIDE_USED: {
- *pCurrent = db->lookaside.nOut;
- *pHighwater = db->lookaside.mxOut;
+ *pCurrent = sqlite3LookasideUsed(db, pHighwater);
if( resetFlag ){
- db->lookaside.mxOut = db->lookaside.nOut;
+ LookasideSlot *p = db->lookaside.pFree;
+ if( p ){
+ while( p->pNext ) p = p->pNext;
+ p->pNext = db->lookaside.pInit;
+ db->lookaside.pInit = db->lookaside.pFree;
+ db->lookaside.pFree = 0;
+ }
}
break;
}
@@ -19212,7 +19826,7 @@ static int parseDateOrTime(
return 0;
}else if( parseHhMmSs(zDate, p)==0 ){
return 0;
- }else if( sqlite3StrICmp(zDate,"now")==0){
+ }else if( sqlite3StrICmp(zDate,"now")==0 && sqlite3NotPureFunc(context) ){
return setDateTimeToCurrent(context, p);
}else if( sqlite3AtoF(zDate, &r, sqlite3Strlen30(zDate), SQLITE_UTF8) ){
setRawDateNumber(p, r);
@@ -19495,7 +20109,7 @@ static int parseModifier(
** Assuming the current time value is UTC (a.k.a. GMT), shift it to
** show local time.
*/
- if( sqlite3_stricmp(z, "localtime")==0 ){
+ if( sqlite3_stricmp(z, "localtime")==0 && sqlite3NotPureFunc(pCtx) ){
computeJD(p);
p->iJD += localtimeOffset(p, pCtx, &rc);
clearYMD_HMS_TZ(p);
@@ -19521,7 +20135,7 @@ static int parseModifier(
}
}
#ifndef SQLITE_OMIT_LOCALTIME
- else if( sqlite3_stricmp(z, "utc")==0 ){
+ else if( sqlite3_stricmp(z, "utc")==0 && sqlite3NotPureFunc(pCtx) ){
if( p->tzSet==0 ){
sqlite3_int64 c1;
computeJD(p);
@@ -20057,11 +20671,11 @@ static void currentTimeFunc(
SQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void){
static FuncDef aDateTimeFuncs[] = {
#ifndef SQLITE_OMIT_DATETIME_FUNCS
- DFUNCTION(julianday, -1, 0, 0, juliandayFunc ),
- DFUNCTION(date, -1, 0, 0, dateFunc ),
- DFUNCTION(time, -1, 0, 0, timeFunc ),
- DFUNCTION(datetime, -1, 0, 0, datetimeFunc ),
- DFUNCTION(strftime, -1, 0, 0, strftimeFunc ),
+ PURE_DATE(julianday, -1, 0, 0, juliandayFunc ),
+ PURE_DATE(date, -1, 0, 0, dateFunc ),
+ PURE_DATE(time, -1, 0, 0, timeFunc ),
+ PURE_DATE(datetime, -1, 0, 0, datetimeFunc ),
+ PURE_DATE(strftime, -1, 0, 0, strftimeFunc ),
DFUNCTION(current_time, 0, 0, 0, ctimeFunc ),
DFUNCTION(current_timestamp, 0, 0, 0, ctimestampFunc),
DFUNCTION(current_date, 0, 0, 0, cdateFunc ),
@@ -20176,7 +20790,7 @@ SQLITE_PRIVATE int sqlite3OsTruncate(sqlite3_file *id, i64 size){
}
SQLITE_PRIVATE int sqlite3OsSync(sqlite3_file *id, int flags){
DO_OS_MALLOC_TEST(id);
- return id->pMethods->xSync(id, flags);
+ return flags ? id->pMethods->xSync(id, flags) : SQLITE_OK;
}
SQLITE_PRIVATE int sqlite3OsFileSize(sqlite3_file *id, i64 *pSize){
DO_OS_MALLOC_TEST(id);
@@ -20231,6 +20845,7 @@ SQLITE_PRIVATE int sqlite3OsSectorSize(sqlite3_file *id){
SQLITE_PRIVATE int sqlite3OsDeviceCharacteristics(sqlite3_file *id){
return id->pMethods->xDeviceCharacteristics(id);
}
+#ifndef SQLITE_OMIT_WAL
SQLITE_PRIVATE int sqlite3OsShmLock(sqlite3_file *id, int offset, int n, int flags){
return id->pMethods->xShmLock(id, offset, n, flags);
}
@@ -20250,6 +20865,7 @@ SQLITE_PRIVATE int sqlite3OsShmMap(
DO_OS_MALLOC_TEST(id);
return id->pMethods->xShmMap(id, iPage, pgsz, bExtend, pp);
}
+#endif /* SQLITE_OMIT_WAL */
#if SQLITE_MAX_MMAP_SIZE>0
/* The real implementation of xFetch and xUnfetch */
@@ -24247,14 +24863,6 @@ SQLITE_API int sqlite3_release_memory(int n){
}
/*
-** An instance of the following object records the location of
-** each unused scratch buffer.
-*/
-typedef struct ScratchFreeslot {
- struct ScratchFreeslot *pNext; /* Next unused scratch buffer */
-} ScratchFreeslot;
-
-/*
** State information local to the memory allocation subsystem.
*/
static SQLITE_WSD struct Mem0Global {
@@ -24262,21 +24870,11 @@ static SQLITE_WSD struct Mem0Global {
sqlite3_int64 alarmThreshold; /* The soft heap limit */
/*
- ** Pointers to the end of sqlite3GlobalConfig.pScratch memory
- ** (so that a range test can be used to determine if an allocation
- ** being freed came from pScratch) and a pointer to the list of
- ** unused scratch allocations.
- */
- void *pScratchEnd;
- ScratchFreeslot *pScratchFree;
- u32 nScratchFree;
-
- /*
** True if heap is nearly "full" where "full" is defined by the
** sqlite3_soft_heap_limit() setting.
*/
int nearlyFull;
-} mem0 = { 0, 0, 0, 0, 0, 0 };
+} mem0 = { 0, 0, 0 };
#define mem0 GLOBAL(struct Mem0Global, mem0)
@@ -24346,28 +24944,6 @@ SQLITE_PRIVATE int sqlite3MallocInit(void){
}
memset(&mem0, 0, sizeof(mem0));
mem0.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM);
- if( sqlite3GlobalConfig.pScratch && sqlite3GlobalConfig.szScratch>=100
- && sqlite3GlobalConfig.nScratch>0 ){
- int i, n, sz;
- ScratchFreeslot *pSlot;
- sz = ROUNDDOWN8(sqlite3GlobalConfig.szScratch);
- sqlite3GlobalConfig.szScratch = sz;
- pSlot = (ScratchFreeslot*)sqlite3GlobalConfig.pScratch;
- n = sqlite3GlobalConfig.nScratch;
- mem0.pScratchFree = pSlot;
- mem0.nScratchFree = n;
- for(i=0; i<n-1; i++){
- pSlot->pNext = (ScratchFreeslot*)(sz+(char*)pSlot);
- pSlot = pSlot->pNext;
- }
- pSlot->pNext = 0;
- mem0.pScratchEnd = (void*)&pSlot[1];
- }else{
- mem0.pScratchEnd = 0;
- sqlite3GlobalConfig.pScratch = 0;
- sqlite3GlobalConfig.szScratch = 0;
- sqlite3GlobalConfig.nScratch = 0;
- }
if( sqlite3GlobalConfig.pPage==0 || sqlite3GlobalConfig.szPage<512
|| sqlite3GlobalConfig.nPage<=0 ){
sqlite3GlobalConfig.pPage = 0;
@@ -24519,105 +25095,6 @@ SQLITE_API void *sqlite3_malloc64(sqlite3_uint64 n){
}
/*
-** Each thread may only have a single outstanding allocation from
-** xScratchMalloc(). We verify this constraint in the single-threaded
-** case by setting scratchAllocOut to 1 when an allocation
-** is outstanding clearing it when the allocation is freed.
-*/
-#if SQLITE_THREADSAFE==0 && !defined(NDEBUG)
-static int scratchAllocOut = 0;
-#endif
-
-
-/*
-** Allocate memory that is to be used and released right away.
-** This routine is similar to alloca() in that it is not intended
-** for situations where the memory might be held long-term. This
-** routine is intended to get memory to old large transient data
-** structures that would not normally fit on the stack of an
-** embedded processor.
-*/
-SQLITE_PRIVATE void *sqlite3ScratchMalloc(int n){
- void *p;
- assert( n>0 );
-
- sqlite3_mutex_enter(mem0.mutex);
- sqlite3StatusHighwater(SQLITE_STATUS_SCRATCH_SIZE, n);
- if( mem0.nScratchFree && sqlite3GlobalConfig.szScratch>=n ){
- p = mem0.pScratchFree;
- mem0.pScratchFree = mem0.pScratchFree->pNext;
- mem0.nScratchFree--;
- sqlite3StatusUp(SQLITE_STATUS_SCRATCH_USED, 1);
- sqlite3_mutex_leave(mem0.mutex);
- }else{
- sqlite3_mutex_leave(mem0.mutex);
- p = sqlite3Malloc(n);
- if( sqlite3GlobalConfig.bMemstat && p ){
- sqlite3_mutex_enter(mem0.mutex);
- sqlite3StatusUp(SQLITE_STATUS_SCRATCH_OVERFLOW, sqlite3MallocSize(p));
- sqlite3_mutex_leave(mem0.mutex);
- }
- sqlite3MemdebugSetType(p, MEMTYPE_SCRATCH);
- }
- assert( sqlite3_mutex_notheld(mem0.mutex) );
-
-
-#if SQLITE_THREADSAFE==0 && !defined(NDEBUG)
- /* EVIDENCE-OF: R-12970-05880 SQLite will not use more than one scratch
- ** buffers per thread.
- **
- ** This can only be checked in single-threaded mode.
- */
- assert( scratchAllocOut==0 );
- if( p ) scratchAllocOut++;
-#endif
-
- return p;
-}
-SQLITE_PRIVATE void sqlite3ScratchFree(void *p){
- if( p ){
-
-#if SQLITE_THREADSAFE==0 && !defined(NDEBUG)
- /* Verify that no more than two scratch allocation per thread
- ** is outstanding at one time. (This is only checked in the
- ** single-threaded case since checking in the multi-threaded case
- ** would be much more complicated.) */
- assert( scratchAllocOut>=1 && scratchAllocOut<=2 );
- scratchAllocOut--;
-#endif
-
- if( SQLITE_WITHIN(p, sqlite3GlobalConfig.pScratch, mem0.pScratchEnd) ){
- /* Release memory from the SQLITE_CONFIG_SCRATCH allocation */
- ScratchFreeslot *pSlot;
- pSlot = (ScratchFreeslot*)p;
- sqlite3_mutex_enter(mem0.mutex);
- pSlot->pNext = mem0.pScratchFree;
- mem0.pScratchFree = pSlot;
- mem0.nScratchFree++;
- assert( mem0.nScratchFree <= (u32)sqlite3GlobalConfig.nScratch );
- sqlite3StatusDown(SQLITE_STATUS_SCRATCH_USED, 1);
- sqlite3_mutex_leave(mem0.mutex);
- }else{
- /* Release memory back to the heap */
- assert( sqlite3MemdebugHasType(p, MEMTYPE_SCRATCH) );
- assert( sqlite3MemdebugNoType(p, (u8)~MEMTYPE_SCRATCH) );
- sqlite3MemdebugSetType(p, MEMTYPE_HEAP);
- if( sqlite3GlobalConfig.bMemstat ){
- int iSize = sqlite3MallocSize(p);
- sqlite3_mutex_enter(mem0.mutex);
- sqlite3StatusDown(SQLITE_STATUS_SCRATCH_OVERFLOW, iSize);
- sqlite3StatusDown(SQLITE_STATUS_MEMORY_USED, iSize);
- sqlite3StatusDown(SQLITE_STATUS_MALLOC_COUNT, 1);
- sqlite3GlobalConfig.m.xFree(p);
- sqlite3_mutex_leave(mem0.mutex);
- }else{
- sqlite3GlobalConfig.m.xFree(p);
- }
- }
- }
-}
-
-/*
** TRUE if p is a lookaside memory allocation from db
*/
#ifndef SQLITE_OMIT_LOOKASIDE
@@ -24707,7 +25184,6 @@ SQLITE_PRIVATE void sqlite3DbFreeNN(sqlite3 *db, void *p){
#endif
pBuf->pNext = db->lookaside.pFree;
db->lookaside.pFree = pBuf;
- db->lookaside.nOut--;
return;
}
}
@@ -24868,16 +25344,16 @@ SQLITE_PRIVATE void *sqlite3DbMallocRawNN(sqlite3 *db, u64 n){
assert( db->mallocFailed==0 );
if( n>db->lookaside.sz ){
db->lookaside.anStat[1]++;
- }else if( (pBuf = db->lookaside.pFree)==0 ){
- db->lookaside.anStat[2]++;
- }else{
+ }else if( (pBuf = db->lookaside.pFree)!=0 ){
db->lookaside.pFree = pBuf->pNext;
- db->lookaside.nOut++;
db->lookaside.anStat[0]++;
- if( db->lookaside.nOut>db->lookaside.mxOut ){
- db->lookaside.mxOut = db->lookaside.nOut;
- }
return (void*)pBuf;
+ }else if( (pBuf = db->lookaside.pInit)!=0 ){
+ db->lookaside.pInit = pBuf->pNext;
+ db->lookaside.anStat[0]++;
+ return (void*)pBuf;
+ }else{
+ db->lookaside.anStat[2]++;
}
}else if( db->mallocFailed ){
return 0;
@@ -25715,7 +26191,7 @@ SQLITE_PRIVATE void sqlite3VXPrintf(
if( precision>=0 ){
for(length=0; length<precision && bufpt[length]; length++){}
}else{
- length = sqlite3Strlen30(bufpt);
+ length = 0x7fffffff & (int)strlen(bufpt);
}
break;
case etSQLESCAPE: /* Escape ' characters */
@@ -25841,7 +26317,6 @@ static int sqlite3StrAccumEnlarge(StrAccum *p, int N){
}else{
char *zOld = isMalloced(p) ? p->zText : 0;
i64 szNew = p->nChar;
- assert( (p->zText==0 || p->zText==p->zBase)==!isMalloced(p) );
szNew += N + 1;
if( szNew+p->nChar<=p->mxAlloc ){
/* Force exponential buffer size growth as long as it does not overflow,
@@ -25883,7 +26358,6 @@ SQLITE_PRIVATE void sqlite3AppendChar(StrAccum *p, int N, char c){
if( p->nChar+(i64)N >= p->nAlloc && (N = sqlite3StrAccumEnlarge(p, N))<=0 ){
return;
}
- assert( (p->zText==p->zBase)==!isMalloced(p) );
while( (N--)>0 ) p->zText[p->nChar++] = c;
}
@@ -25901,7 +26375,6 @@ static void SQLITE_NOINLINE enlargeAndAppend(StrAccum *p, const char *z, int N){
memcpy(&p->zText[p->nChar], z, N);
p->nChar += N;
}
- assert( (p->zText==0 || p->zText==p->zBase)==!isMalloced(p) );
}
/*
@@ -25936,19 +26409,20 @@ SQLITE_PRIVATE void sqlite3StrAccumAppendAll(StrAccum *p, const char *z){
** pointer if any kind of error was encountered.
*/
static SQLITE_NOINLINE char *strAccumFinishRealloc(StrAccum *p){
+ char *zText;
assert( p->mxAlloc>0 && !isMalloced(p) );
- p->zText = sqlite3DbMallocRaw(p->db, p->nChar+1 );
- if( p->zText ){
- memcpy(p->zText, p->zBase, p->nChar+1);
+ zText = sqlite3DbMallocRaw(p->db, p->nChar+1 );
+ if( zText ){
+ memcpy(zText, p->zText, p->nChar+1);
p->printfFlags |= SQLITE_PRINTF_MALLOCED;
}else{
setStrAccumError(p, STRACCUM_NOMEM);
}
- return p->zText;
+ p->zText = zText;
+ return zText;
}
SQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum *p){
if( p->zText ){
- assert( (p->zText==p->zBase)==!isMalloced(p) );
p->zText[p->nChar] = 0;
if( p->mxAlloc>0 && !isMalloced(p) ){
return strAccumFinishRealloc(p);
@@ -25961,7 +26435,6 @@ SQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum *p){
** Reset an StrAccum string. Reclaim all malloced memory.
*/
SQLITE_PRIVATE void sqlite3StrAccumReset(StrAccum *p){
- assert( (p->zText==0 || p->zText==p->zBase)==!isMalloced(p) );
if( isMalloced(p) ){
sqlite3DbFree(p->db, p->zText);
p->printfFlags &= ~SQLITE_PRINTF_MALLOCED;
@@ -25984,11 +26457,11 @@ SQLITE_PRIVATE void sqlite3StrAccumReset(StrAccum *p){
** allocations will ever occur.
*/
SQLITE_PRIVATE void sqlite3StrAccumInit(StrAccum *p, sqlite3 *db, char *zBase, int n, int mx){
- p->zText = p->zBase = zBase;
+ p->zText = zBase;
p->db = db;
- p->nChar = 0;
p->nAlloc = n;
p->mxAlloc = mx;
+ p->nChar = 0;
p->accError = 0;
p->printfFlags = 0;
}
@@ -26557,17 +27030,17 @@ SQLITE_PRIVATE void sqlite3TreeViewExpr(TreeView *pView, const Expr *pExpr, u8 m
}
#ifndef SQLITE_OMIT_SUBQUERY
case TK_EXISTS: {
- sqlite3TreeViewLine(pView, "EXISTS-expr");
+ sqlite3TreeViewLine(pView, "EXISTS-expr flags=0x%x", pExpr->flags);
sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);
break;
}
case TK_SELECT: {
- sqlite3TreeViewLine(pView, "SELECT-expr");
+ sqlite3TreeViewLine(pView, "SELECT-expr flags=0x%x", pExpr->flags);
sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);
break;
}
case TK_IN: {
- sqlite3TreeViewLine(pView, "IN");
+ sqlite3TreeViewLine(pView, "IN flags=0x%x", pExpr->flags);
sqlite3TreeViewExpr(pView, pExpr->pLeft, 1);
if( ExprHasProperty(pExpr, EP_xIsSelect) ){
sqlite3TreeViewSelect(pView, pExpr->x.pSelect, 0);
@@ -27455,7 +27928,9 @@ translate_out:
#endif
return SQLITE_OK;
}
+#endif /* SQLITE_OMIT_UTF16 */
+#ifndef SQLITE_OMIT_UTF16
/*
** This routine checks for a byte-order mark at the beginning of the
** UTF-16 string stored in *pMem. If one is present, it is removed and
@@ -28147,7 +28622,11 @@ do_atof_calc:
if( esign<0 ){
result = 0.0*s;
}else{
+#ifdef INFINITY
+ result = INFINITY*s;
+#else
result = 1e308*1e308*s; /* Infinity */
+#endif
}
}
}else{
@@ -28209,16 +28688,12 @@ static int compare2pow63(const char *zNum, int incr){
** Convert zNum to a 64-bit signed integer. zNum must be decimal. This
** routine does *not* accept hexadecimal notation.
**
-** If the zNum value is representable as a 64-bit twos-complement
-** integer, then write that value into *pNum and return 0.
-**
-** If zNum is exactly 9223372036854775808, return 2. This special
-** case is broken out because while 9223372036854775808 cannot be a
-** signed 64-bit integer, its negative -9223372036854775808 can be.
+** Returns:
**
-** If zNum is too big for a 64-bit integer and is not
-** 9223372036854775808 or if zNum contains any non-numeric text,
-** then return 1.
+** 0 Successful transformation. Fits in a 64-bit signed integer.
+** 1 Excess text after the integer value
+** 2 Integer too large for a 64-bit signed integer or is malformed
+** 3 Special case of 9223372036854775808
**
** length is the number of bytes in the string (bytes, not characters).
** The string is not necessarily zero-terminated. The encoding is
@@ -28231,6 +28706,7 @@ SQLITE_PRIVATE int sqlite3Atoi64(const char *zNum, i64 *pNum, int length, u8 enc
int i;
int c = 0;
int nonNum = 0; /* True if input contains UTF16 with high byte non-zero */
+ int rc; /* Baseline return code */
const char *zStart;
const char *zEnd = zNum + length;
assert( enc==SQLITE_UTF8 || enc==SQLITE_UTF16LE || enc==SQLITE_UTF16BE );
@@ -28270,31 +28746,35 @@ SQLITE_PRIVATE int sqlite3Atoi64(const char *zNum, i64 *pNum, int length, u8 enc
testcase( i==20 );
if( &zNum[i]<zEnd /* Extra bytes at the end */
|| (i==0 && zStart==zNum) /* No digits */
- || i>19*incr /* Too many digits */
|| nonNum /* UTF16 with high-order bytes non-zero */
){
+ rc = 1;
+ }else{
+ rc = 0;
+ }
+ if( i>19*incr ){ /* Too many digits */
/* zNum is empty or contains non-numeric text or is longer
** than 19 digits (thus guaranteeing that it is too large) */
- return 1;
+ return 2;
}else if( i<19*incr ){
/* Less than 19 digits, so we know that it fits in 64 bits */
assert( u<=LARGEST_INT64 );
- return 0;
+ return rc;
}else{
/* zNum is a 19-digit numbers. Compare it against 9223372036854775808. */
c = compare2pow63(zNum, incr);
if( c<0 ){
/* zNum is less than 9223372036854775808 so it fits */
assert( u<=LARGEST_INT64 );
- return 0;
+ return rc;
}else if( c>0 ){
/* zNum is greater than 9223372036854775808 so it overflows */
- return 1;
+ return 2;
}else{
/* zNum is exactly 9223372036854775808. Fits if negative. The
** special case 2 overflow if positive */
assert( u-1==LARGEST_INT64 );
- return neg ? 0 : 2;
+ return neg ? rc : 3;
}
}
}
@@ -28307,8 +28787,9 @@ SQLITE_PRIVATE int sqlite3Atoi64(const char *zNum, i64 *pNum, int length, u8 enc
** Returns:
**
** 0 Successful transformation. Fits in a 64-bit signed integer.
-** 1 Integer too large for a 64-bit signed integer or is malformed
-** 2 Special case of 9223372036854775808
+** 1 Excess text after the integer value
+** 2 Integer too large for a 64-bit signed integer or is malformed
+** 3 Special case of 9223372036854775808
*/
SQLITE_PRIVATE int sqlite3DecOrHexToI64(const char *z, i64 *pOut){
#ifndef SQLITE_OMIT_HEX_INTEGER
@@ -28322,7 +28803,7 @@ SQLITE_PRIVATE int sqlite3DecOrHexToI64(const char *z, i64 *pOut){
u = u*16 + sqlite3HexToInt(z[k]);
}
memcpy(pOut, &u, 8);
- return (z[k]==0 && k-i<=16) ? 0 : 1;
+ return (z[k]==0 && k-i<=16) ? 0 : 2;
}else
#endif /* SQLITE_OMIT_HEX_INTEGER */
{
@@ -28932,7 +29413,7 @@ SQLITE_PRIVATE int sqlite3SafetyCheckSickOrOk(sqlite3 *db){
** overflow, leave *pA unchanged and return 1.
*/
SQLITE_PRIVATE int sqlite3AddInt64(i64 *pA, i64 iB){
-#if GCC_VERSION>=5004000
+#if GCC_VERSION>=5004000 && !defined(__INTEL_COMPILER)
return __builtin_add_overflow(*pA, iB, pA);
#else
i64 iA = *pA;
@@ -28952,7 +29433,7 @@ SQLITE_PRIVATE int sqlite3AddInt64(i64 *pA, i64 iB){
#endif
}
SQLITE_PRIVATE int sqlite3SubInt64(i64 *pA, i64 iB){
-#if GCC_VERSION>=5004000
+#if GCC_VERSION>=5004000 && !defined(__INTEL_COMPILER)
return __builtin_sub_overflow(*pA, iB, pA);
#else
testcase( iB==SMALLEST_INT64+1 );
@@ -28967,7 +29448,7 @@ SQLITE_PRIVATE int sqlite3SubInt64(i64 *pA, i64 iB){
#endif
}
SQLITE_PRIVATE int sqlite3MulInt64(i64 *pA, i64 iB){
-#if GCC_VERSION>=5004000
+#if GCC_VERSION>=5004000 && !defined(__INTEL_COMPILER)
return __builtin_mul_overflow(*pA, iB, pA);
#else
i64 iA = *pA;
@@ -29069,8 +29550,14 @@ SQLITE_PRIVATE LogEst sqlite3LogEst(u64 x){
if( x<2 ) return 0;
while( x<8 ){ y -= 10; x <<= 1; }
}else{
+#if GCC_VERSION>=5004000
+ int i = 60 - __builtin_clzll(x);
+ y += i*10;
+ x >>= i;
+#else
while( x>255 ){ y += 40; x >>= 4; } /*OPTIMIZATION-IF-TRUE*/
while( x>15 ){ y += 10; x >>= 1; }
+#endif
}
return a[x&7] + y - 10;
}
@@ -29366,8 +29853,9 @@ static int rehash(Hash *pH, unsigned int new_size){
}
/* This function (for internal use only) locates an element in an
-** hash table that matches the given key. The hash for this key is
-** also computed and returned in the *pH parameter.
+** hash table that matches the given key. If no element is found,
+** a pointer to a static null element with HashElem.data==0 is returned.
+** If pH is not NULL, then the hash for this key is written to *pH.
*/
static HashElem *findElementWithHash(
const Hash *pH, /* The pH to be searched */
@@ -29377,6 +29865,7 @@ static HashElem *findElementWithHash(
HashElem *elem; /* Used to loop thru the element list */
int count; /* Number of elements left to test */
unsigned int h; /* The computed hash */
+ static HashElem nullElement = { 0, 0, 0, 0 };
if( pH->ht ){ /*OPTIMIZATION-IF-TRUE*/
struct _ht *pEntry;
@@ -29389,7 +29878,7 @@ static HashElem *findElementWithHash(
elem = pH->first;
count = pH->count;
}
- *pHash = h;
+ if( pHash ) *pHash = h;
while( count-- ){
assert( elem!=0 );
if( sqlite3StrICmp(elem->pKey,pKey)==0 ){
@@ -29397,7 +29886,7 @@ static HashElem *findElementWithHash(
}
elem = elem->next;
}
- return 0;
+ return &nullElement;
}
/* Remove a single entry from the hash table given a pointer to that
@@ -29439,13 +29928,9 @@ static void removeElementGivenHash(
** found, or NULL if there is no match.
*/
SQLITE_PRIVATE void *sqlite3HashFind(const Hash *pH, const char *pKey){
- HashElem *elem; /* The element that matches key */
- unsigned int h; /* A hash on key */
-
assert( pH!=0 );
assert( pKey!=0 );
- elem = findElementWithHash(pH, pKey, &h);
- return elem ? elem->data : 0;
+ return findElementWithHash(pH, pKey, 0)->data;
}
/* Insert an element into the hash table pH. The key is pKey
@@ -29470,7 +29955,7 @@ SQLITE_PRIVATE void *sqlite3HashInsert(Hash *pH, const char *pKey, void *data){
assert( pH!=0 );
assert( pKey!=0 );
elem = findElementWithHash(pH,pKey,&h);
- if( elem ){
+ if( elem->data ){
void *old_data = elem->data;
if( data==0 ){
removeElementGivenHash(pH,elem,h);
@@ -29553,47 +30038,47 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){
/* 40 */ "IdxLT" OpHelp("key=r[P3@P4]"),
/* 41 */ "IdxGE" OpHelp("key=r[P3@P4]"),
/* 42 */ "RowSetRead" OpHelp("r[P3]=rowset(P1)"),
- /* 43 */ "RowSetTest" OpHelp("if r[P3] in rowset(P1) goto P2"),
- /* 44 */ "Program" OpHelp(""),
- /* 45 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"),
- /* 46 */ "IfPos" OpHelp("if r[P1]>0 then r[P1]-=P3, goto P2"),
- /* 47 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]--, goto P2"),
- /* 48 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"),
- /* 49 */ "IncrVacuum" OpHelp(""),
- /* 50 */ "VNext" OpHelp(""),
- /* 51 */ "Init" OpHelp("Start at P2"),
- /* 52 */ "Return" OpHelp(""),
- /* 53 */ "EndCoroutine" OpHelp(""),
- /* 54 */ "HaltIfNull" OpHelp("if r[P3]=null halt"),
- /* 55 */ "Halt" OpHelp(""),
- /* 56 */ "Integer" OpHelp("r[P2]=P1"),
- /* 57 */ "Int64" OpHelp("r[P2]=P4"),
- /* 58 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
- /* 59 */ "Null" OpHelp("r[P2..P3]=NULL"),
- /* 60 */ "SoftNull" OpHelp("r[P1]=NULL"),
- /* 61 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"),
- /* 62 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"),
- /* 63 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"),
- /* 64 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"),
- /* 65 */ "SCopy" OpHelp("r[P2]=r[P1]"),
- /* 66 */ "IntCopy" OpHelp("r[P2]=r[P1]"),
- /* 67 */ "ResultRow" OpHelp("output=r[P1@P2]"),
- /* 68 */ "CollSeq" OpHelp(""),
- /* 69 */ "Function0" OpHelp("r[P3]=func(r[P2@P5])"),
- /* 70 */ "Or" OpHelp("r[P3]=(r[P1] || r[P2])"),
- /* 71 */ "And" OpHelp("r[P3]=(r[P1] && r[P2])"),
- /* 72 */ "Function" OpHelp("r[P3]=func(r[P2@P5])"),
- /* 73 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
- /* 74 */ "RealAffinity" OpHelp(""),
- /* 75 */ "IsNull" OpHelp("if r[P1]==NULL goto P2"),
- /* 76 */ "NotNull" OpHelp("if r[P1]!=NULL goto P2"),
- /* 77 */ "Ne" OpHelp("IF r[P3]!=r[P1]"),
- /* 78 */ "Eq" OpHelp("IF r[P3]==r[P1]"),
- /* 79 */ "Gt" OpHelp("IF r[P3]>r[P1]"),
- /* 80 */ "Le" OpHelp("IF r[P3]<=r[P1]"),
- /* 81 */ "Lt" OpHelp("IF r[P3]<r[P1]"),
- /* 82 */ "Ge" OpHelp("IF r[P3]>=r[P1]"),
- /* 83 */ "ElseNotEq" OpHelp(""),
+ /* 43 */ "Or" OpHelp("r[P3]=(r[P1] || r[P2])"),
+ /* 44 */ "And" OpHelp("r[P3]=(r[P1] && r[P2])"),
+ /* 45 */ "RowSetTest" OpHelp("if r[P3] in rowset(P1) goto P2"),
+ /* 46 */ "Program" OpHelp(""),
+ /* 47 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"),
+ /* 48 */ "IfPos" OpHelp("if r[P1]>0 then r[P1]-=P3, goto P2"),
+ /* 49 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]--, goto P2"),
+ /* 50 */ "IsNull" OpHelp("if r[P1]==NULL goto P2"),
+ /* 51 */ "NotNull" OpHelp("if r[P1]!=NULL goto P2"),
+ /* 52 */ "Ne" OpHelp("IF r[P3]!=r[P1]"),
+ /* 53 */ "Eq" OpHelp("IF r[P3]==r[P1]"),
+ /* 54 */ "Gt" OpHelp("IF r[P3]>r[P1]"),
+ /* 55 */ "Le" OpHelp("IF r[P3]<=r[P1]"),
+ /* 56 */ "Lt" OpHelp("IF r[P3]<r[P1]"),
+ /* 57 */ "Ge" OpHelp("IF r[P3]>=r[P1]"),
+ /* 58 */ "ElseNotEq" OpHelp(""),
+ /* 59 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"),
+ /* 60 */ "IncrVacuum" OpHelp(""),
+ /* 61 */ "VNext" OpHelp(""),
+ /* 62 */ "Init" OpHelp("Start at P2"),
+ /* 63 */ "Return" OpHelp(""),
+ /* 64 */ "EndCoroutine" OpHelp(""),
+ /* 65 */ "HaltIfNull" OpHelp("if r[P3]=null halt"),
+ /* 66 */ "Halt" OpHelp(""),
+ /* 67 */ "Integer" OpHelp("r[P2]=P1"),
+ /* 68 */ "Int64" OpHelp("r[P2]=P4"),
+ /* 69 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
+ /* 70 */ "Null" OpHelp("r[P2..P3]=NULL"),
+ /* 71 */ "SoftNull" OpHelp("r[P1]=NULL"),
+ /* 72 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"),
+ /* 73 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"),
+ /* 74 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"),
+ /* 75 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"),
+ /* 76 */ "SCopy" OpHelp("r[P2]=r[P1]"),
+ /* 77 */ "IntCopy" OpHelp("r[P2]=r[P1]"),
+ /* 78 */ "ResultRow" OpHelp("output=r[P1@P2]"),
+ /* 79 */ "CollSeq" OpHelp(""),
+ /* 80 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
+ /* 81 */ "RealAffinity" OpHelp(""),
+ /* 82 */ "Cast" OpHelp("affinity(r[P1])"),
+ /* 83 */ "Permutation" OpHelp(""),
/* 84 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"),
/* 85 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"),
/* 86 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<<r[P1]"),
@@ -29604,78 +30089,80 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){
/* 91 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
/* 92 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
/* 93 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
- /* 94 */ "Cast" OpHelp("affinity(r[P1])"),
+ /* 94 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"),
/* 95 */ "BitNot" OpHelp("r[P1]= ~r[P1]"),
- /* 96 */ "Permutation" OpHelp(""),
+ /* 96 */ "Column" OpHelp("r[P3]=PX"),
/* 97 */ "String8" OpHelp("r[P2]='P4'"),
- /* 98 */ "Compare" OpHelp("r[P1@P3] <-> r[P2@P3]"),
- /* 99 */ "Column" OpHelp("r[P3]=PX"),
- /* 100 */ "Affinity" OpHelp("affinity(r[P1@P2])"),
- /* 101 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"),
- /* 102 */ "Count" OpHelp("r[P2]=count()"),
- /* 103 */ "ReadCookie" OpHelp(""),
- /* 104 */ "SetCookie" OpHelp(""),
- /* 105 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"),
- /* 106 */ "OpenRead" OpHelp("root=P2 iDb=P3"),
- /* 107 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
- /* 108 */ "OpenDup" OpHelp(""),
- /* 109 */ "OpenAutoindex" OpHelp("nColumn=P2"),
- /* 110 */ "OpenEphemeral" OpHelp("nColumn=P2"),
- /* 111 */ "SorterOpen" OpHelp(""),
- /* 112 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
- /* 113 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
- /* 114 */ "Close" OpHelp(""),
- /* 115 */ "ColumnsUsed" OpHelp(""),
- /* 116 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
- /* 117 */ "NewRowid" OpHelp("r[P2]=rowid"),
- /* 118 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
- /* 119 */ "InsertInt" OpHelp("intkey=P3 data=r[P2]"),
- /* 120 */ "Delete" OpHelp(""),
- /* 121 */ "ResetCount" OpHelp(""),
- /* 122 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
- /* 123 */ "SorterData" OpHelp("r[P2]=data"),
- /* 124 */ "RowData" OpHelp("r[P2]=data"),
- /* 125 */ "Rowid" OpHelp("r[P2]=rowid"),
- /* 126 */ "NullRow" OpHelp(""),
- /* 127 */ "SorterInsert" OpHelp("key=r[P2]"),
- /* 128 */ "IdxInsert" OpHelp("key=r[P2]"),
- /* 129 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
- /* 130 */ "Seek" OpHelp("Move P3 to P1.rowid"),
- /* 131 */ "IdxRowid" OpHelp("r[P2]=rowid"),
+ /* 98 */ "Affinity" OpHelp("affinity(r[P1@P2])"),
+ /* 99 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"),
+ /* 100 */ "Count" OpHelp("r[P2]=count()"),
+ /* 101 */ "ReadCookie" OpHelp(""),
+ /* 102 */ "SetCookie" OpHelp(""),
+ /* 103 */ "ReopenIdx" OpHelp("root=P2 iDb=P3"),
+ /* 104 */ "OpenRead" OpHelp("root=P2 iDb=P3"),
+ /* 105 */ "OpenWrite" OpHelp("root=P2 iDb=P3"),
+ /* 106 */ "OpenDup" OpHelp(""),
+ /* 107 */ "OpenAutoindex" OpHelp("nColumn=P2"),
+ /* 108 */ "OpenEphemeral" OpHelp("nColumn=P2"),
+ /* 109 */ "SorterOpen" OpHelp(""),
+ /* 110 */ "SequenceTest" OpHelp("if( cursor[P1].ctr++ ) pc = P2"),
+ /* 111 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
+ /* 112 */ "Close" OpHelp(""),
+ /* 113 */ "ColumnsUsed" OpHelp(""),
+ /* 114 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
+ /* 115 */ "NewRowid" OpHelp("r[P2]=rowid"),
+ /* 116 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"),
+ /* 117 */ "InsertInt" OpHelp("intkey=P3 data=r[P2]"),
+ /* 118 */ "Delete" OpHelp(""),
+ /* 119 */ "ResetCount" OpHelp(""),
+ /* 120 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
+ /* 121 */ "SorterData" OpHelp("r[P2]=data"),
+ /* 122 */ "RowData" OpHelp("r[P2]=data"),
+ /* 123 */ "Rowid" OpHelp("r[P2]=rowid"),
+ /* 124 */ "NullRow" OpHelp(""),
+ /* 125 */ "SeekEnd" OpHelp(""),
+ /* 126 */ "SorterInsert" OpHelp("key=r[P2]"),
+ /* 127 */ "IdxInsert" OpHelp("key=r[P2]"),
+ /* 128 */ "IdxDelete" OpHelp("key=r[P2@P3]"),
+ /* 129 */ "DeferredSeek" OpHelp("Move P3 to P1.rowid if needed"),
+ /* 130 */ "IdxRowid" OpHelp("r[P2]=rowid"),
+ /* 131 */ "Destroy" OpHelp(""),
/* 132 */ "Real" OpHelp("r[P2]=P4"),
- /* 133 */ "Destroy" OpHelp(""),
- /* 134 */ "Clear" OpHelp(""),
- /* 135 */ "ResetSorter" OpHelp(""),
- /* 136 */ "CreateIndex" OpHelp("r[P2]=root iDb=P1"),
- /* 137 */ "CreateTable" OpHelp("r[P2]=root iDb=P1"),
- /* 138 */ "SqlExec" OpHelp(""),
- /* 139 */ "ParseSchema" OpHelp(""),
- /* 140 */ "LoadAnalysis" OpHelp(""),
- /* 141 */ "DropTable" OpHelp(""),
- /* 142 */ "DropIndex" OpHelp(""),
- /* 143 */ "DropTrigger" OpHelp(""),
- /* 144 */ "IntegrityCk" OpHelp(""),
- /* 145 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
- /* 146 */ "Param" OpHelp(""),
- /* 147 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
- /* 148 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
- /* 149 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
- /* 150 */ "AggStep0" OpHelp("accum=r[P3] step(r[P2@P5])"),
- /* 151 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
- /* 152 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
- /* 153 */ "Expire" OpHelp(""),
- /* 154 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
- /* 155 */ "VBegin" OpHelp(""),
- /* 156 */ "VCreate" OpHelp(""),
- /* 157 */ "VDestroy" OpHelp(""),
- /* 158 */ "VOpen" OpHelp(""),
- /* 159 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
- /* 160 */ "VRename" OpHelp(""),
- /* 161 */ "Pagecount" OpHelp(""),
- /* 162 */ "MaxPgcnt" OpHelp(""),
- /* 163 */ "CursorHint" OpHelp(""),
- /* 164 */ "Noop" OpHelp(""),
- /* 165 */ "Explain" OpHelp(""),
+ /* 133 */ "Clear" OpHelp(""),
+ /* 134 */ "ResetSorter" OpHelp(""),
+ /* 135 */ "CreateBtree" OpHelp("r[P2]=root iDb=P1 flags=P3"),
+ /* 136 */ "SqlExec" OpHelp(""),
+ /* 137 */ "ParseSchema" OpHelp(""),
+ /* 138 */ "LoadAnalysis" OpHelp(""),
+ /* 139 */ "DropTable" OpHelp(""),
+ /* 140 */ "DropIndex" OpHelp(""),
+ /* 141 */ "DropTrigger" OpHelp(""),
+ /* 142 */ "IntegrityCk" OpHelp(""),
+ /* 143 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"),
+ /* 144 */ "Param" OpHelp(""),
+ /* 145 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
+ /* 146 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"),
+ /* 147 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
+ /* 148 */ "AggStep0" OpHelp("accum=r[P3] step(r[P2@P5])"),
+ /* 149 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"),
+ /* 150 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
+ /* 151 */ "Expire" OpHelp(""),
+ /* 152 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"),
+ /* 153 */ "VBegin" OpHelp(""),
+ /* 154 */ "VCreate" OpHelp(""),
+ /* 155 */ "VDestroy" OpHelp(""),
+ /* 156 */ "VOpen" OpHelp(""),
+ /* 157 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"),
+ /* 158 */ "VRename" OpHelp(""),
+ /* 159 */ "Pagecount" OpHelp(""),
+ /* 160 */ "MaxPgcnt" OpHelp(""),
+ /* 161 */ "PureFunc0" OpHelp(""),
+ /* 162 */ "Function0" OpHelp("r[P3]=func(r[P2@P5])"),
+ /* 163 */ "PureFunc" OpHelp(""),
+ /* 164 */ "Function" OpHelp("r[P3]=func(r[P2@P5])"),
+ /* 165 */ "CursorHint" OpHelp(""),
+ /* 166 */ "Noop" OpHelp(""),
+ /* 167 */ "Explain" OpHelp(""),
};
return azName[i];
}
@@ -29775,6 +30262,7 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
+#include <sys/ioctl.h>
#include <unistd.h>
/* #include <time.h> */
#include <sys/time.h>
@@ -29784,7 +30272,7 @@ SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){
#endif
#if SQLITE_ENABLE_LOCKING_STYLE
-# include <sys/ioctl.h>
+/* # include <sys/ioctl.h> */
# include <sys/file.h>
# include <sys/param.h>
#endif /* SQLITE_ENABLE_LOCKING_STYLE */
@@ -29894,7 +30382,7 @@ struct unixFile {
unsigned short int ctrlFlags; /* Behavioral bits. UNIXFILE_* flags */
int lastErrno; /* The unix errno from last I/O error */
void *lockingContext; /* Locking style specific state */
- UnixUnusedFd *pUnused; /* Pre-allocated UnixUnusedFd */
+ UnixUnusedFd *pPreallocatedUnused; /* Pre-allocated UnixUnusedFd */
const char *zPath; /* Name of the file */
unixShm *pShm; /* Shared memory segment information */
int szChunk; /* Configured by FCNTL_CHUNK_SIZE */
@@ -29905,10 +30393,8 @@ struct unixFile {
sqlite3_int64 mmapSizeMax; /* Configured FCNTL_MMAP_SIZE value */
void *pMapRegion; /* Memory mapped region */
#endif
-#ifdef __QNXNTO__
int sectorSize; /* Device sector size */
int deviceCharacteristics; /* Precomputed device characteristics */
-#endif
#if SQLITE_ENABLE_LOCKING_STYLE
int openFlags; /* The flags specified at open() */
#endif
@@ -30211,6 +30697,20 @@ SQLITE_API extern int sqlite3_open_file_count;
# define lseek lseek64
#endif
+#ifdef __linux__
+/*
+** Linux-specific IOCTL magic numbers used for controlling F2FS
+*/
+#define F2FS_IOCTL_MAGIC 0xf5
+#define F2FS_IOC_START_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 1)
+#define F2FS_IOC_COMMIT_ATOMIC_WRITE _IO(F2FS_IOCTL_MAGIC, 2)
+#define F2FS_IOC_START_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 3)
+#define F2FS_IOC_ABORT_VOLATILE_WRITE _IO(F2FS_IOCTL_MAGIC, 5)
+#define F2FS_IOC_GET_FEATURES _IOR(F2FS_IOCTL_MAGIC, 12, u32)
+#define F2FS_FEATURE_ATOMIC_WRITE 0x0004
+#endif /* __linux__ */
+
+
/*
** Different Unix systems declare open() in different ways. Same use
** open(const char*,int,mode_t). Others use open(const char*,int,...).
@@ -30383,6 +30883,9 @@ static struct unix_syscall {
#endif
#define osLstat ((int(*)(const char*,struct stat*))aSyscall[27].pCurrent)
+ { "ioctl", (sqlite3_syscall_ptr)ioctl, 0 },
+#define osIoctl ((int(*)(int,int,...))aSyscall[28].pCurrent)
+
}; /* End of the overrideable system calls */
@@ -30987,7 +31490,8 @@ struct unixInodeInfo {
/*
** A lists of all unixInodeInfo objects.
*/
-static unixInodeInfo *inodeList = 0;
+static unixInodeInfo *inodeList = 0; /* All unixInodeInfo objects */
+static unsigned int nUnusedFd = 0; /* Total unused file descriptors */
/*
**
@@ -31097,6 +31601,7 @@ static void closePendingFds(unixFile *pFile){
pNext = p->pNext;
robust_close(pFile, p->fd, __LINE__);
sqlite3_free(p);
+ nUnusedFd--;
}
pInode->pUnused = 0;
}
@@ -31129,6 +31634,7 @@ static void releaseInodeInfo(unixFile *pFile){
sqlite3_free(pInode);
}
}
+ assert( inodeList!=0 || nUnusedFd==0 );
}
/*
@@ -31198,6 +31704,7 @@ static int findInodeInfo(
#else
fileId.ino = (u64)statbuf.st_ino;
#endif
+ assert( inodeList!=0 || nUnusedFd==0 );
pInode = inodeList;
while( pInode && memcmp(&fileId, &pInode->fileId, sizeof(fileId)) ){
pInode = pInode->pNext;
@@ -31617,11 +32124,12 @@ end_lock:
*/
static void setPendingFd(unixFile *pFile){
unixInodeInfo *pInode = pFile->pInode;
- UnixUnusedFd *p = pFile->pUnused;
+ UnixUnusedFd *p = pFile->pPreallocatedUnused;
p->pNext = pInode->pUnused;
pInode->pUnused = p;
pFile->h = -1;
- pFile->pUnused = 0;
+ pFile->pPreallocatedUnused = 0;
+ nUnusedFd++;
}
/*
@@ -31846,7 +32354,7 @@ static int closeUnixFile(sqlite3_file *id){
#endif
OSTRACE(("CLOSE %-3d\n", pFile->h));
OpenCounter(-1);
- sqlite3_free(pFile->pUnused);
+ sqlite3_free(pFile->pPreallocatedUnused);
memset(pFile, 0, sizeof(unixFile));
return SQLITE_OK;
}
@@ -32183,7 +32691,7 @@ static int flockCheckReservedLock(sqlite3_file *id, int *pResOut){
OSTRACE(("TEST WR-LOCK %d %d %d (flock)\n", pFile->h, rc, reserved));
#ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS
- if( (rc & SQLITE_IOERR) == SQLITE_IOERR ){
+ if( (rc & 0xff) == SQLITE_IOERR ){
rc = SQLITE_OK;
reserved=1;
}
@@ -32250,7 +32758,7 @@ static int flockLock(sqlite3_file *id, int eFileLock) {
OSTRACE(("LOCK %d %s %s (flock)\n", pFile->h, azFileLock(eFileLock),
rc==SQLITE_OK ? "ok" : "failed"));
#ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS
- if( (rc & SQLITE_IOERR) == SQLITE_IOERR ){
+ if( (rc & 0xff) == SQLITE_IOERR ){
rc = SQLITE_BUSY;
}
#endif /* SQLITE_IGNORE_FLOCK_LOCK_ERRORS */
@@ -32787,7 +33295,7 @@ static int afpLock(sqlite3_file *id, int eFileLock){
/* Can't reestablish the shared lock. Sqlite can't deal, this is
** a critical I/O error
*/
- rc = ((failed & SQLITE_IOERR) == SQLITE_IOERR) ? failed2 :
+ rc = ((failed & 0xff) == SQLITE_IOERR) ? failed2 :
SQLITE_IOERR_LOCK;
goto afp_end_lock;
}
@@ -33067,7 +33575,7 @@ static int unixRead(
/* If this is a database file (not a journal, master-journal or temp
** file), the bytes in the locking range should never be read or written. */
#if 0
- assert( pFile->pUnused==0
+ assert( pFile->pPreallocatedUnused==0
|| offset>=PENDING_BYTE+512
|| offset+amt<=PENDING_BYTE
);
@@ -33180,7 +33688,7 @@ static int unixWrite(
/* If this is a database file (not a journal, master-journal or temp
** file), the bytes in the locking range should never be read or written. */
#if 0
- assert( pFile->pUnused==0
+ assert( pFile->pPreallocatedUnused==0
|| offset>=PENDING_BYTE+512
|| offset+amt<=PENDING_BYTE
);
@@ -33660,6 +34168,21 @@ static int unixGetTempname(int nBuf, char *zBuf);
static int unixFileControl(sqlite3_file *id, int op, void *pArg){
unixFile *pFile = (unixFile*)id;
switch( op ){
+#if defined(__linux__) && defined(SQLITE_ENABLE_BATCH_ATOMIC_WRITE)
+ case SQLITE_FCNTL_BEGIN_ATOMIC_WRITE: {
+ int rc = osIoctl(pFile->h, F2FS_IOC_START_ATOMIC_WRITE);
+ return rc ? SQLITE_IOERR_BEGIN_ATOMIC : SQLITE_OK;
+ }
+ case SQLITE_FCNTL_COMMIT_ATOMIC_WRITE: {
+ int rc = osIoctl(pFile->h, F2FS_IOC_COMMIT_ATOMIC_WRITE);
+ return rc ? SQLITE_IOERR_COMMIT_ATOMIC : SQLITE_OK;
+ }
+ case SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE: {
+ int rc = osIoctl(pFile->h, F2FS_IOC_ABORT_VOLATILE_WRITE);
+ return rc ? SQLITE_IOERR_ROLLBACK_ATOMIC : SQLITE_OK;
+ }
+#endif /* __linux__ && SQLITE_ENABLE_BATCH_ATOMIC_WRITE */
+
case SQLITE_FCNTL_LOCKSTATE: {
*(int*)pArg = pFile->eFileLock;
return SQLITE_OK;
@@ -33710,6 +34233,14 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){
if( newLimit>sqlite3GlobalConfig.mxMmap ){
newLimit = sqlite3GlobalConfig.mxMmap;
}
+
+ /* The value of newLimit may be eventually cast to (size_t) and passed
+ ** to mmap(). Restrict its value to 2GB if (size_t) is not at least a
+ ** 64-bit type. */
+ if( newLimit>0 && sizeof(size_t)<8 ){
+ newLimit = (newLimit & 0x7FFFFFFF);
+ }
+
*(i64*)pArg = pFile->mmapSizeMax;
if( newLimit>=0 && newLimit!=pFile->mmapSizeMax && pFile->nFetchOut==0 ){
pFile->mmapSizeMax = newLimit;
@@ -33743,30 +34274,41 @@ static int unixFileControl(sqlite3_file *id, int op, void *pArg){
}
/*
-** Return the sector size in bytes of the underlying block device for
-** the specified file. This is almost always 512 bytes, but may be
-** larger for some devices.
+** If pFd->sectorSize is non-zero when this function is called, it is a
+** no-op. Otherwise, the values of pFd->sectorSize and
+** pFd->deviceCharacteristics are set according to the file-system
+** characteristics.
**
-** SQLite code assumes this function cannot fail. It also assumes that
-** if two files are created in the same file-system directory (i.e.
-** a database and its journal file) that the sector size will be the
-** same for both.
+** There are two versions of this function. One for QNX and one for all
+** other systems.
*/
-#ifndef __QNXNTO__
-static int unixSectorSize(sqlite3_file *NotUsed){
- UNUSED_PARAMETER(NotUsed);
- return SQLITE_DEFAULT_SECTOR_SIZE;
-}
-#endif
+#ifndef __QNXNTO__
+static void setDeviceCharacteristics(unixFile *pFd){
+ assert( pFd->deviceCharacteristics==0 || pFd->sectorSize!=0 );
+ if( pFd->sectorSize==0 ){
+#if defined(__linux__) && defined(SQLITE_ENABLE_BATCH_ATOMIC_WRITE)
+ int res;
+ u32 f = 0;
-/*
-** The following version of unixSectorSize() is optimized for QNX.
-*/
-#ifdef __QNXNTO__
+ /* Check for support for F2FS atomic batch writes. */
+ res = osIoctl(pFd->h, F2FS_IOC_GET_FEATURES, &f);
+ if( res==0 && (f & F2FS_FEATURE_ATOMIC_WRITE) ){
+ pFd->deviceCharacteristics = SQLITE_IOCAP_BATCH_ATOMIC;
+ }
+#endif /* __linux__ && SQLITE_ENABLE_BATCH_ATOMIC_WRITE */
+
+ /* Set the POWERSAFE_OVERWRITE flag if requested. */
+ if( pFd->ctrlFlags & UNIXFILE_PSOW ){
+ pFd->deviceCharacteristics |= SQLITE_IOCAP_POWERSAFE_OVERWRITE;
+ }
+
+ pFd->sectorSize = SQLITE_DEFAULT_SECTOR_SIZE;
+ }
+}
+#else
#include <sys/dcmd_blk.h>
#include <sys/statvfs.h>
-static int unixSectorSize(sqlite3_file *id){
- unixFile *pFile = (unixFile*)id;
+static void setDeviceCharacteristics(unixFile *pFile){
if( pFile->sectorSize == 0 ){
struct statvfs fsInfo;
@@ -33835,9 +34377,24 @@ static int unixSectorSize(sqlite3_file *id){
pFile->deviceCharacteristics = 0;
pFile->sectorSize = SQLITE_DEFAULT_SECTOR_SIZE;
}
- return pFile->sectorSize;
}
-#endif /* __QNXNTO__ */
+#endif
+
+/*
+** Return the sector size in bytes of the underlying block device for
+** the specified file. This is almost always 512 bytes, but may be
+** larger for some devices.
+**
+** SQLite code assumes this function cannot fail. It also assumes that
+** if two files are created in the same file-system directory (i.e.
+** a database and its journal file) that the sector size will be the
+** same for both.
+*/
+static int unixSectorSize(sqlite3_file *id){
+ unixFile *pFd = (unixFile*)id;
+ setDeviceCharacteristics(pFd);
+ return pFd->sectorSize;
+}
/*
** Return the device characteristics for the file.
@@ -33853,16 +34410,9 @@ static int unixSectorSize(sqlite3_file *id){
** available to turn it off and URI query parameter available to turn it off.
*/
static int unixDeviceCharacteristics(sqlite3_file *id){
- unixFile *p = (unixFile*)id;
- int rc = 0;
-#ifdef __QNXNTO__
- if( p->sectorSize==0 ) unixSectorSize(id);
- rc = p->deviceCharacteristics;
-#endif
- if( p->ctrlFlags & UNIXFILE_PSOW ){
- rc |= SQLITE_IOCAP_POWERSAFE_OVERWRITE;
- }
- return rc;
+ unixFile *pFd = (unixFile*)id;
+ setDeviceCharacteristics(pFd);
+ return pFd->deviceCharacteristics;
}
#if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0
@@ -35120,17 +35670,6 @@ static int fillInUnixFile(
assert( pNew->pInode==NULL );
- /* Usually the path zFilename should not be a relative pathname. The
- ** exception is when opening the proxy "conch" file in builds that
- ** include the special Apple locking styles.
- */
-#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE
- assert( zFilename==0 || zFilename[0]=='/'
- || pVfs->pAppData==(void*)&autolockIoFinder );
-#else
- assert( zFilename==0 || zFilename[0]=='/' );
-#endif
-
/* No locking occurs in temporary files */
assert( zFilename!=0 || (ctrlFlags & UNIXFILE_NOLOCK)!=0 );
@@ -35389,6 +35928,8 @@ static UnixUnusedFd *findReusableFd(const char *zPath, int flags){
#if !OS_VXWORKS
struct stat sStat; /* Results of stat() call */
+ unixEnterMutex();
+
/* A stat() call may fail for various reasons. If this happens, it is
** almost certain that an open() call on the same path will also fail.
** For this reason, if an error occurs in the stat() call here, it is
@@ -35397,10 +35938,9 @@ static UnixUnusedFd *findReusableFd(const char *zPath, int flags){
**
** Even if a subsequent open() call does succeed, the consequences of
** not searching for a reusable file descriptor are not dire. */
- if( 0==osStat(zPath, &sStat) ){
+ if( nUnusedFd>0 && 0==osStat(zPath, &sStat) ){
unixInodeInfo *pInode;
- unixEnterMutex();
pInode = inodeList;
while( pInode && (pInode->fileId.dev!=sStat.st_dev
|| pInode->fileId.ino!=(u64)sStat.st_ino) ){
@@ -35411,11 +35951,12 @@ static UnixUnusedFd *findReusableFd(const char *zPath, int flags){
for(pp=&pInode->pUnused; *pp && (*pp)->flags!=flags; pp=&((*pp)->pNext));
pUnused = *pp;
if( pUnused ){
+ nUnusedFd--;
*pp = pUnused->pNext;
}
}
- unixLeaveMutex();
}
+ unixLeaveMutex();
#endif /* if !OS_VXWORKS */
return pUnused;
}
@@ -35491,16 +36032,11 @@ static int findCreateFileMode(
*/
nDb = sqlite3Strlen30(zPath) - 1;
while( zPath[nDb]!='-' ){
-#ifndef SQLITE_ENABLE_8_3_NAMES
- /* In the normal case (8+3 filenames disabled) the journal filename
- ** is guaranteed to contain a '-' character. */
- assert( nDb>0 );
- assert( sqlite3Isalnum(zPath[nDb]) );
-#else
- /* If 8+3 names are possible, then the journal file might not contain
- ** a '-' character. So check for that case and return early. */
+ /* In normal operation, the journal file name will always contain
+ ** a '-' character. However in 8+3 filename mode, or if a corrupt
+ ** rollback journal specifies a master journal with a goofy name, then
+ ** the '-' might be missing. */
if( nDb==0 || zPath[nDb]=='.' ) return SQLITE_OK;
-#endif
nDb--;
}
memcpy(zDb, zPath, nDb);
@@ -35636,7 +36172,7 @@ static int unixOpen(
return SQLITE_NOMEM_BKPT;
}
}
- p->pUnused = pUnused;
+ p->pPreallocatedUnused = pUnused;
/* Database filenames are double-zero terminated if they are not
** URIs with parameters. Hence, they can always be passed into
@@ -35673,7 +36209,7 @@ static int unixOpen(
gid_t gid; /* Groupid for the file */
rc = findCreateFileMode(zName, flags, &openMode, &uid, &gid);
if( rc!=SQLITE_OK ){
- assert( !p->pUnused );
+ assert( !p->pPreallocatedUnused );
assert( eType==SQLITE_OPEN_WAL || eType==SQLITE_OPEN_MAIN_JOURNAL );
return rc;
}
@@ -35707,9 +36243,9 @@ static int unixOpen(
*pOutFlags = flags;
}
- if( p->pUnused ){
- p->pUnused->fd = fd;
- p->pUnused->flags = flags;
+ if( p->pPreallocatedUnused ){
+ p->pPreallocatedUnused->fd = fd;
+ p->pPreallocatedUnused->flags = flags;
}
if( isDelete ){
@@ -35786,11 +36322,14 @@ static int unixOpen(
}
#endif
+ assert( zPath==0 || zPath[0]=='/'
+ || eType==SQLITE_OPEN_MASTER_JOURNAL || eType==SQLITE_OPEN_MAIN_JOURNAL
+ );
rc = fillInUnixFile(pVfs, fd, pFile, zPath, ctrlFlags);
open_finished:
if( rc!=SQLITE_OK ){
- sqlite3_free(p->pUnused);
+ sqlite3_free(p->pPreallocatedUnused);
}
return rc;
}
@@ -36531,7 +37070,7 @@ static int proxyCreateUnixFile(
dummyVfs.zName = "dummy";
pUnused->fd = fd;
pUnused->flags = openFlags;
- pNew->pUnused = pUnused;
+ pNew->pPreallocatedUnused = pUnused;
rc = fillInUnixFile(&dummyVfs, fd, (sqlite3_file*)pNew, path, 0);
if( rc==SQLITE_OK ){
@@ -37481,7 +38020,7 @@ SQLITE_API int sqlite3_os_init(void){
/* Double-check that the aSyscall[] array has been constructed
** correctly. See ticket [bb3a86e890c8e96ab] */
- assert( ArraySize(aSyscall)==28 );
+ assert( ArraySize(aSyscall)==29 );
/* Register all VFSes defined in the aVfs[] array */
for(i=0; i<(sizeof(aVfs)/sizeof(sqlite3_vfs)); i++){
@@ -41264,6 +41803,14 @@ static int winFileControl(sqlite3_file *id, int op, void *pArg){
if( newLimit>sqlite3GlobalConfig.mxMmap ){
newLimit = sqlite3GlobalConfig.mxMmap;
}
+
+ /* The value of newLimit may be eventually cast to (SIZE_T) and passed
+ ** to MapViewOfFile(). Restrict its value to 2GB if (SIZE_T) is not at
+ ** least a 64-bit type. */
+ if( newLimit>0 && sizeof(SIZE_T)<8 ){
+ newLimit = (newLimit & 0x7FFFFFFF);
+ }
+
*(i64*)pArg = pFile->mmapSizeMax;
if( newLimit>=0 && newLimit!=pFile->mmapSizeMax && pFile->nFetchOut==0 ){
pFile->mmapSizeMax = newLimit;
@@ -42576,6 +43123,14 @@ static int winIsDir(const void *zConverted){
return (attr!=INVALID_FILE_ATTRIBUTES) && (attr&FILE_ATTRIBUTE_DIRECTORY);
}
+/* forward reference */
+static int winAccess(
+ sqlite3_vfs *pVfs, /* Not used on win32 */
+ const char *zFilename, /* Name of file to check */
+ int flags, /* Type of test to make on this file */
+ int *pResOut /* OUT: Result */
+);
+
/*
** Open a file.
*/
@@ -42752,37 +43307,52 @@ static int winOpen(
extendedParameters.dwSecurityQosFlags = SECURITY_ANONYMOUS;
extendedParameters.lpSecurityAttributes = NULL;
extendedParameters.hTemplateFile = NULL;
- while( (h = osCreateFile2((LPCWSTR)zConverted,
- dwDesiredAccess,
- dwShareMode,
- dwCreationDisposition,
- &extendedParameters))==INVALID_HANDLE_VALUE &&
- winRetryIoerr(&cnt, &lastErrno) ){
- /* Noop */
- }
+ do{
+ h = osCreateFile2((LPCWSTR)zConverted,
+ dwDesiredAccess,
+ dwShareMode,
+ dwCreationDisposition,
+ &extendedParameters);
+ if( h!=INVALID_HANDLE_VALUE ) break;
+ if( isReadWrite ){
+ int isRO = 0;
+ int rc2 = winAccess(pVfs, zName, SQLITE_ACCESS_READ, &isRO);
+ if( rc2==SQLITE_OK && isRO ) break;
+ }
+ }while( winRetryIoerr(&cnt, &lastErrno) );
#else
- while( (h = osCreateFileW((LPCWSTR)zConverted,
- dwDesiredAccess,
- dwShareMode, NULL,
- dwCreationDisposition,
- dwFlagsAndAttributes,
- NULL))==INVALID_HANDLE_VALUE &&
- winRetryIoerr(&cnt, &lastErrno) ){
- /* Noop */
- }
+ do{
+ h = osCreateFileW((LPCWSTR)zConverted,
+ dwDesiredAccess,
+ dwShareMode, NULL,
+ dwCreationDisposition,
+ dwFlagsAndAttributes,
+ NULL);
+ if( h!=INVALID_HANDLE_VALUE ) break;
+ if( isReadWrite ){
+ int isRO = 0;
+ int rc2 = winAccess(pVfs, zName, SQLITE_ACCESS_READ, &isRO);
+ if( rc2==SQLITE_OK && isRO ) break;
+ }
+ }while( winRetryIoerr(&cnt, &lastErrno) );
#endif
}
#ifdef SQLITE_WIN32_HAS_ANSI
else{
- while( (h = osCreateFileA((LPCSTR)zConverted,
- dwDesiredAccess,
- dwShareMode, NULL,
- dwCreationDisposition,
- dwFlagsAndAttributes,
- NULL))==INVALID_HANDLE_VALUE &&
- winRetryIoerr(&cnt, &lastErrno) ){
- /* Noop */
- }
+ do{
+ h = osCreateFileA((LPCSTR)zConverted,
+ dwDesiredAccess,
+ dwShareMode, NULL,
+ dwCreationDisposition,
+ dwFlagsAndAttributes,
+ NULL);
+ if( h!=INVALID_HANDLE_VALUE ) break;
+ if( isReadWrite ){
+ int isRO = 0;
+ int rc2 = winAccess(pVfs, zName, SQLITE_ACCESS_READ, &isRO);
+ if( rc2==SQLITE_OK && isRO ) break;
+ }
+ }while( winRetryIoerr(&cnt, &lastErrno) );
}
#endif
winLogIoerr(cnt, __LINE__);
@@ -42791,8 +43361,6 @@ static int winOpen(
dwDesiredAccess, (h==INVALID_HANDLE_VALUE) ? "failed" : "ok"));
if( h==INVALID_HANDLE_VALUE ){
- pFile->lastErrno = lastErrno;
- winLogError(SQLITE_CANTOPEN, pFile->lastErrno, "winOpen", zUtf8Name);
sqlite3_free(zConverted);
sqlite3_free(zTmpname);
if( isReadWrite && !isExclusive ){
@@ -42801,6 +43369,8 @@ static int winOpen(
~(SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE)),
pOutFlags);
}else{
+ pFile->lastErrno = lastErrno;
+ winLogError(SQLITE_CANTOPEN, pFile->lastErrno, "winOpen", zUtf8Name);
return SQLITE_CANTOPEN_BKPT;
}
}
@@ -43393,9 +43963,6 @@ static int winRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){
EntropyGatherer e;
UNUSED_PARAMETER(pVfs);
memset(zBuf, 0, nBuf);
-#if defined(_MSC_VER) && _MSC_VER>=1400 && !SQLITE_OS_WINCE
- rand_s((unsigned int*)zBuf); /* rand_s() is not available with MinGW */
-#endif /* defined(_MSC_VER) && _MSC_VER>=1400 */
e.a = (unsigned char*)zBuf;
e.na = nBuf;
e.nXor = 0;
@@ -44314,12 +44881,9 @@ static void pcacheManageDirtyList(PgHdr *pPage, u8 addRemove){
p->eCreate = 2;
}
}
- pPage->pDirtyNext = 0;
- pPage->pDirtyPrev = 0;
}
if( addRemove & PCACHE_DIRTYLIST_ADD ){
- assert( pPage->pDirtyNext==0 && pPage->pDirtyPrev==0 && p->pDirty!=pPage );
-
+ pPage->pDirtyPrev = 0;
pPage->pDirtyNext = p->pDirty;
if( pPage->pDirtyNext ){
assert( pPage->pDirtyNext->pDirtyPrev==0 );
@@ -44636,11 +45200,7 @@ SQLITE_PRIVATE void SQLITE_NOINLINE sqlite3PcacheRelease(PgHdr *p){
if( (--p->nRef)==0 ){
if( p->flags&PGHDR_CLEAN ){
pcacheUnpin(p);
- }else if( p->pDirtyPrev!=0 ){ /*OPTIMIZATION-IF-FALSE*/
- /* Move the page to the head of the dirty list. If p->pDirtyPrev==0,
- ** then page p is already at the head of the dirty list and the
- ** following call would be a no-op. Hence the OPTIMIZATION-IF-FALSE
- ** tag above. */
+ }else{
pcacheManageDirtyList(p, PCACHE_DIRTYLIST_FRONT);
}
}
@@ -45101,7 +45661,6 @@ typedef struct PGroup PGroup;
struct PgHdr1 {
sqlite3_pcache_page page; /* Base class. Must be first. pBuf & pExtra */
unsigned int iKey; /* Key value (page number) */
- u8 isPinned; /* Page in use, not on the LRU list */
u8 isBulkLocal; /* This page from bulk local storage */
u8 isAnchor; /* This is the PGroup.lru element */
PgHdr1 *pNext; /* Next in hash table chain */
@@ -45110,6 +45669,12 @@ struct PgHdr1 {
PgHdr1 *pLruPrev; /* Previous in LRU list of unpinned pages */
};
+/*
+** A page is pinned if it is no on the LRU list
+*/
+#define PAGE_IS_PINNED(p) ((p)->pLruNext==0)
+#define PAGE_IS_UNPINNED(p) ((p)->pLruNext!=0)
+
/* Each page cache (or PCache) belongs to a PGroup. A PGroup is a set
** of one or more PCaches that are able to recycle each other's unpinned
** pages when they are under memory pressure. A PGroup is an instance of
@@ -45137,7 +45702,7 @@ struct PGroup {
unsigned int nMaxPage; /* Sum of nMax for purgeable caches */
unsigned int nMinPage; /* Sum of nMin for purgeable caches */
unsigned int mxPinned; /* nMaxpage + 10 - nMinPage */
- unsigned int nCurrentPage; /* Number of purgeable pages allocated */
+ unsigned int nPurgeable; /* Number of purgeable pages allocated */
PgHdr1 lru; /* The beginning and end of the LRU list */
};
@@ -45151,11 +45716,13 @@ struct PGroup {
*/
struct PCache1 {
/* Cache configuration parameters. Page size (szPage) and the purgeable
- ** flag (bPurgeable) are set when the cache is created. nMax may be
+ ** flag (bPurgeable) and the pnPurgeable pointer are all set when the
+ ** cache is created and are never changed thereafter. nMax may be
** modified at any time by a call to the pcache1Cachesize() method.
** The PGroup mutex must be held when accessing nMax.
*/
PGroup *pGroup; /* PGroup this cache belongs to */
+ unsigned int *pnPurgeable; /* Pointer to pGroup->nPurgeable */
int szPage; /* Size of database content section */
int szExtra; /* sizeof(MemPage)+sizeof(PgHdr) */
int szAlloc; /* Total size of one pcache line */
@@ -45250,6 +45817,7 @@ SQLITE_PRIVATE void sqlite3PCacheBufferSetup(void *pBuf, int sz, int n){
if( pcache1.isInit ){
PgFreeslot *p;
if( pBuf==0 ) sz = n = 0;
+ if( n==0 ) sz = 0;
sz = ROUNDDOWN8(sz);
pcache1.szSlot = sz;
pcache1.nSlot = pcache1.nFreeSlot = n;
@@ -45442,9 +46010,7 @@ static PgHdr1 *pcache1AllocPage(PCache1 *pCache, int benignMalloc){
p->isBulkLocal = 0;
p->isAnchor = 0;
}
- if( pCache->bPurgeable ){
- pCache->pGroup->nCurrentPage++;
- }
+ (*pCache->pnPurgeable)++;
return p;
}
@@ -45465,9 +46031,7 @@ static void pcache1FreePage(PgHdr1 *p){
sqlite3_free(p);
#endif
}
- if( pCache->bPurgeable ){
- pCache->pGroup->nCurrentPage--;
- }
+ (*pCache->pnPurgeable)--;
}
/*
@@ -45562,22 +46126,18 @@ static void pcache1ResizeHash(PCache1 *p){
** The PGroup mutex must be held when this function is called.
*/
static PgHdr1 *pcache1PinPage(PgHdr1 *pPage){
- PCache1 *pCache;
-
assert( pPage!=0 );
- assert( pPage->isPinned==0 );
- pCache = pPage->pCache;
+ assert( PAGE_IS_UNPINNED(pPage) );
assert( pPage->pLruNext );
assert( pPage->pLruPrev );
- assert( sqlite3_mutex_held(pCache->pGroup->mutex) );
+ assert( sqlite3_mutex_held(pPage->pCache->pGroup->mutex) );
pPage->pLruPrev->pLruNext = pPage->pLruNext;
pPage->pLruNext->pLruPrev = pPage->pLruPrev;
pPage->pLruNext = 0;
pPage->pLruPrev = 0;
- pPage->isPinned = 1;
assert( pPage->isAnchor==0 );
- assert( pCache->pGroup->lru.isAnchor==1 );
- pCache->nRecyclable--;
+ assert( pPage->pCache->pGroup->lru.isAnchor==1 );
+ pPage->pCache->nRecyclable--;
return pPage;
}
@@ -45611,11 +46171,11 @@ static void pcache1EnforceMaxPage(PCache1 *pCache){
PGroup *pGroup = pCache->pGroup;
PgHdr1 *p;
assert( sqlite3_mutex_held(pGroup->mutex) );
- while( pGroup->nCurrentPage>pGroup->nMaxPage
+ while( pGroup->nPurgeable>pGroup->nMaxPage
&& (p=pGroup->lru.pLruPrev)->isAnchor==0
){
assert( p->pCache->pGroup==pGroup );
- assert( p->isPinned==0 );
+ assert( PAGE_IS_UNPINNED(p) );
pcache1PinPage(p);
pcache1RemoveFromHash(p, 1);
}
@@ -45664,7 +46224,7 @@ static void pcache1TruncateUnsafe(
if( pPage->iKey>=iLimit ){
pCache->nPage--;
*pp = pPage->pNext;
- if( !pPage->isPinned ) pcache1PinPage(pPage);
+ if( PAGE_IS_UNPINNED(pPage) ) pcache1PinPage(pPage);
pcache1FreePage(pPage);
}else{
pp = &pPage->pNext;
@@ -45782,6 +46342,10 @@ static sqlite3_pcache *pcache1Create(int szPage, int szExtra, int bPurgeable){
pCache->nMin = 10;
pGroup->nMinPage += pCache->nMin;
pGroup->mxPinned = pGroup->nMaxPage + 10 - pGroup->nMinPage;
+ pCache->pnPurgeable = &pGroup->nPurgeable;
+ }else{
+ static unsigned int dummyCurrentPage;
+ pCache->pnPurgeable = &dummyCurrentPage;
}
pcache1LeaveMutex(pGroup);
if( pCache->nHash==0 ){
@@ -45883,7 +46447,7 @@ static SQLITE_NOINLINE PgHdr1 *pcache1FetchStage2(
){
PCache1 *pOther;
pPage = pGroup->lru.pLruPrev;
- assert( pPage->isPinned==0 );
+ assert( PAGE_IS_UNPINNED(pPage) );
pcache1RemoveFromHash(pPage, 0);
pcache1PinPage(pPage);
pOther = pPage->pCache;
@@ -45891,7 +46455,7 @@ static SQLITE_NOINLINE PgHdr1 *pcache1FetchStage2(
pcache1FreePage(pPage);
pPage = 0;
}else{
- pGroup->nCurrentPage -= (pOther->bPurgeable - pCache->bPurgeable);
+ pGroup->nPurgeable -= (pOther->bPurgeable - pCache->bPurgeable);
}
}
@@ -45910,7 +46474,6 @@ static SQLITE_NOINLINE PgHdr1 *pcache1FetchStage2(
pPage->pCache = pCache;
pPage->pLruPrev = 0;
pPage->pLruNext = 0;
- pPage->isPinned = 1;
*(void **)pPage->page.pExtra = 0;
pCache->apHash[h] = pPage;
if( iKey>pCache->iMaxKey ){
@@ -45996,7 +46559,7 @@ static PgHdr1 *pcache1FetchNoMutex(
** Otherwise (page not in hash and createFlag!=0) continue with
** subsequent steps to try to create the page. */
if( pPage ){
- if( !pPage->isPinned ){
+ if( PAGE_IS_UNPINNED(pPage) ){
return pcache1PinPage(pPage);
}else{
return pPage;
@@ -46071,9 +46634,9 @@ static void pcache1Unpin(
** part of the PGroup LRU list.
*/
assert( pPage->pLruPrev==0 && pPage->pLruNext==0 );
- assert( pPage->isPinned==1 );
+ assert( PAGE_IS_PINNED(pPage) );
- if( reuseUnlikely || pGroup->nCurrentPage>pGroup->nMaxPage ){
+ if( reuseUnlikely || pGroup->nPurgeable>pGroup->nMaxPage ){
pcache1RemoveFromHash(pPage, 1);
}else{
/* Add the page to the PGroup LRU list. */
@@ -46082,7 +46645,6 @@ static void pcache1Unpin(
(pPage->pLruNext = *ppFirst)->pLruPrev = pPage;
*ppFirst = pPage;
pCache->nRecyclable++;
- pPage->isPinned = 0;
}
pcache1LeaveMutex(pCache->pGroup);
@@ -46226,7 +46788,7 @@ SQLITE_PRIVATE int sqlite3PcacheReleaseMemory(int nReq){
#ifdef SQLITE_PCACHE_SEPARATE_HEADER
nFree += sqlite3MemSize(p);
#endif
- assert( p->isPinned==0 );
+ assert( PAGE_IS_UNPINNED(p) );
pcache1PinPage(p);
pcache1RemoveFromHash(p, 1);
}
@@ -46250,10 +46812,10 @@ SQLITE_PRIVATE void sqlite3PcacheStats(
PgHdr1 *p;
int nRecyclable = 0;
for(p=pcache1.grp.lru.pLruNext; p && !p->isAnchor; p=p->pLruNext){
- assert( p->isPinned==0 );
+ assert( PAGE_IS_UNPINNED(p) );
nRecyclable++;
}
- *pnCurrent = pcache1.grp.nCurrentPage;
+ *pnCurrent = pcache1.grp.nPurgeable;
*pnMax = (int)pcache1.grp.nMaxPage;
*pnMin = (int)pcache1.grp.nMinPage;
*pnRecyclable = nRecyclable;
@@ -46808,11 +47370,11 @@ SQLITE_PRIVATE int sqlite3RowSetTest(RowSet *pRowSet, int iBatch, sqlite3_int64
/* #include "sqliteInt.h" */
-/* Additional values that can be added to the sync_flags argument of
-** sqlite3WalFrames():
+/* Macros for extracting appropriate sync flags for either transaction
+** commits (WAL_SYNC_FLAGS(X)) or for checkpoint ops (CKPT_SYNC_FLAGS(X)):
*/
-#define WAL_SYNC_TRANSACTIONS 0x20 /* Sync at the end of each transaction */
-#define SQLITE_SYNC_MASK 0x13 /* Mask off the SQLITE_SYNC_* values */
+#define WAL_SYNC_FLAGS(X) ((X)&0x03)
+#define CKPT_SYNC_FLAGS(X) (((X)>>2)&0x03)
#ifdef SQLITE_OMIT_WAL
# define sqlite3WalOpen(x,y,z) 0
@@ -47045,8 +47607,8 @@ int sqlite3PagerTrace=1; /* True to enable tracing */
** associated file-descriptor is returned. FILEHANDLEID() takes an sqlite3_file
** struct as its argument.
*/
-#define PAGERID(p) ((int)(p->fd))
-#define FILEHANDLEID(fd) ((int)fd)
+#define PAGERID(p) (SQLITE_PTR_TO_INT(p->fd))
+#define FILEHANDLEID(fd) (SQLITE_PTR_TO_INT(fd))
/*
** The Pager.eState variable stores the current 'state' of a pager. A
@@ -47533,6 +48095,18 @@ struct PagerSavepoint {
** is set to zero in all other states. In PAGER_ERROR state, Pager.errCode
** is always set to SQLITE_FULL, SQLITE_IOERR or one of the SQLITE_IOERR_XXX
** sub-codes.
+**
+** syncFlags, walSyncFlags
+**
+** syncFlags is either SQLITE_SYNC_NORMAL (0x02) or SQLITE_SYNC_FULL (0x03).
+** syncFlags is used for rollback mode. walSyncFlags is used for WAL mode
+** and contains the flags used to sync the checkpoint operations in the
+** lower two bits, and sync flags used for transaction commits in the WAL
+** file in bits 0x04 and 0x08. In other words, to get the correct sync flags
+** for checkpoint operations, use (walSyncFlags&0x03) and to get the correct
+** sync flags for transaction commit, use ((walSyncFlags>>2)&0x03). Note
+** that with synchronous=NORMAL in WAL mode, transaction commit is not synced
+** meaning that the 0x04 and 0x08 bits are both zero.
*/
struct Pager {
sqlite3_vfs *pVfs; /* OS functions to use for IO */
@@ -47542,9 +48116,8 @@ struct Pager {
u8 noSync; /* Do not sync the journal if true */
u8 fullSync; /* Do extra syncs of the journal for robustness */
u8 extraSync; /* sync directory after journal delete */
- u8 ckptSyncFlags; /* SYNC_NORMAL or SYNC_FULL for checkpoint */
- u8 walSyncFlags; /* SYNC_NORMAL or SYNC_FULL for wal writes */
u8 syncFlags; /* SYNC_NORMAL or SYNC_FULL otherwise */
+ u8 walSyncFlags; /* See description above */
u8 tempFile; /* zFilename is a temporary or immutable file */
u8 noLock; /* Do not lock (except in WAL mode) */
u8 readOnly; /* True for a read-only database */
@@ -47864,6 +48437,7 @@ static int assert_pager_state(Pager *p){
assert( isOpen(p->jfd)
|| p->journalMode==PAGER_JOURNALMODE_OFF
|| p->journalMode==PAGER_JOURNALMODE_WAL
+ || (sqlite3OsDeviceCharacteristics(p->fd)&SQLITE_IOCAP_BATCH_ATOMIC)
);
assert( pPager->dbOrigSize<=pPager->dbHintSize );
break;
@@ -47875,6 +48449,7 @@ static int assert_pager_state(Pager *p){
assert( isOpen(p->jfd)
|| p->journalMode==PAGER_JOURNALMODE_OFF
|| p->journalMode==PAGER_JOURNALMODE_WAL
+ || (sqlite3OsDeviceCharacteristics(p->fd)&SQLITE_IOCAP_BATCH_ATOMIC)
);
break;
@@ -48085,34 +48660,47 @@ static int pagerLockDb(Pager *pPager, int eLock){
}
/*
-** This function determines whether or not the atomic-write optimization
-** can be used with this pager. The optimization can be used if:
+** This function determines whether or not the atomic-write or
+** atomic-batch-write optimizations can be used with this pager. The
+** atomic-write optimization can be used if:
**
** (a) the value returned by OsDeviceCharacteristics() indicates that
** a database page may be written atomically, and
** (b) the value returned by OsSectorSize() is less than or equal
** to the page size.
**
-** The optimization is also always enabled for temporary files. It is
-** an error to call this function if pPager is opened on an in-memory
-** database.
+** If it can be used, then the value returned is the size of the journal
+** file when it contains rollback data for exactly one page.
**
-** If the optimization cannot be used, 0 is returned. If it can be used,
-** then the value returned is the size of the journal file when it
-** contains rollback data for exactly one page.
+** The atomic-batch-write optimization can be used if OsDeviceCharacteristics()
+** returns a value with the SQLITE_IOCAP_BATCH_ATOMIC bit set. -1 is
+** returned in this case.
+**
+** If neither optimization can be used, 0 is returned.
*/
-#ifdef SQLITE_ENABLE_ATOMIC_WRITE
static int jrnlBufferSize(Pager *pPager){
assert( !MEMDB );
- if( !pPager->tempFile ){
- int dc; /* Device characteristics */
- int nSector; /* Sector size */
- int szPage; /* Page size */
- assert( isOpen(pPager->fd) );
- dc = sqlite3OsDeviceCharacteristics(pPager->fd);
- nSector = pPager->sectorSize;
- szPage = pPager->pageSize;
+#if defined(SQLITE_ENABLE_ATOMIC_WRITE) \
+ || defined(SQLITE_ENABLE_BATCH_ATOMIC_WRITE)
+ int dc; /* Device characteristics */
+
+ assert( isOpen(pPager->fd) );
+ dc = sqlite3OsDeviceCharacteristics(pPager->fd);
+#else
+ UNUSED_PARAMETER(pPager);
+#endif
+
+#ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE
+ if( dc&SQLITE_IOCAP_BATCH_ATOMIC ){
+ return -1;
+ }
+#endif
+
+#ifdef SQLITE_ENABLE_ATOMIC_WRITE
+ {
+ int nSector = pPager->sectorSize;
+ int szPage = pPager->pageSize;
assert(SQLITE_IOCAP_ATOMIC512==(512>>8));
assert(SQLITE_IOCAP_ATOMIC64K==(65536>>8));
@@ -48122,11 +48710,11 @@ static int jrnlBufferSize(Pager *pPager){
}
return JOURNAL_HDR_SZ(pPager) + JOURNAL_PG_SZ(pPager);
-}
-#else
-# define jrnlBufferSize(x) 0
#endif
+ return 0;
+}
+
/*
** If SQLITE_CHECK_PAGES is defined then we do some sanity checking
** on the cache using a hash function. This is used for testing
@@ -48208,6 +48796,7 @@ static int readMasterJournal(sqlite3_file *pJrnl, char *zMaster, u32 nMaster){
|| szJ<16
|| SQLITE_OK!=(rc = read32bits(pJrnl, szJ-16, &len))
|| len>=nMaster
+ || len>szJ-16
|| len==0
|| SQLITE_OK!=(rc = read32bits(pJrnl, szJ-12, &cksum))
|| SQLITE_OK!=(rc = sqlite3OsRead(pJrnl, aMagic, 8, szJ-8))
@@ -48929,7 +49518,9 @@ static int pager_end_transaction(Pager *pPager, int hasMaster, int bCommit){
}
releaseAllSavepoints(pPager);
- assert( isOpen(pPager->jfd) || pPager->pInJournal==0 );
+ assert( isOpen(pPager->jfd) || pPager->pInJournal==0
+ || (sqlite3OsDeviceCharacteristics(pPager->fd)&SQLITE_IOCAP_BATCH_ATOMIC)
+ );
if( isOpen(pPager->jfd) ){
assert( !pagerUseWal(pPager) );
@@ -49697,6 +50288,7 @@ static int pager_playback(Pager *pPager, int isHot){
char *zMaster = 0; /* Name of master journal file if any */
int needPagerReset; /* True to reset page prior to first page rollback */
int nPlayback = 0; /* Total number of pages restored from journal */
+ u32 savedPageSize = pPager->pageSize;
/* Figure out how many records are in the journal. Abort early if
** the journal is empty.
@@ -49826,6 +50418,9 @@ static int pager_playback(Pager *pPager, int isHot){
assert( 0 );
end_playback:
+ if( rc==SQLITE_OK ){
+ rc = sqlite3PagerSetPagesize(pPager, &savedPageSize, -1);
+ }
/* Following a rollback, the database file should be back in its original
** state prior to the start of the transaction, so invoke the
** SQLITE_FCNTL_DB_UNCHANGED file-control method to disable the
@@ -49884,7 +50479,8 @@ end_playback:
/*
-** Read the content for page pPg out of the database file and into
+** Read the content for page pPg out of the database file (or out of
+** the WAL if that is where the most recent copy if found) into
** pPg->pData. A shared lock or greater must be held on the database
** file before this function is called.
**
@@ -49894,30 +50490,33 @@ end_playback:
** If an IO error occurs, then the IO error is returned to the caller.
** Otherwise, SQLITE_OK is returned.
*/
-static int readDbPage(PgHdr *pPg, u32 iFrame){
+static int readDbPage(PgHdr *pPg){
Pager *pPager = pPg->pPager; /* Pager object associated with page pPg */
- Pgno pgno = pPg->pgno; /* Page number to read */
int rc = SQLITE_OK; /* Return code */
- int pgsz = pPager->pageSize; /* Number of bytes to read */
+
+#ifndef SQLITE_OMIT_WAL
+ u32 iFrame = 0; /* Frame of WAL containing pgno */
assert( pPager->eState>=PAGER_READER && !MEMDB );
assert( isOpen(pPager->fd) );
-#ifndef SQLITE_OMIT_WAL
+ if( pagerUseWal(pPager) ){
+ rc = sqlite3WalFindFrame(pPager->pWal, pPg->pgno, &iFrame);
+ if( rc ) return rc;
+ }
if( iFrame ){
- /* Try to pull the page from the write-ahead log. */
- rc = sqlite3WalReadFrame(pPager->pWal, iFrame, pgsz, pPg->pData);
+ rc = sqlite3WalReadFrame(pPager->pWal, iFrame,pPager->pageSize,pPg->pData);
}else
#endif
{
- i64 iOffset = (pgno-1)*(i64)pPager->pageSize;
- rc = sqlite3OsRead(pPager->fd, pPg->pData, pgsz, iOffset);
+ i64 iOffset = (pPg->pgno-1)*(i64)pPager->pageSize;
+ rc = sqlite3OsRead(pPager->fd, pPg->pData, pPager->pageSize, iOffset);
if( rc==SQLITE_IOERR_SHORT_READ ){
rc = SQLITE_OK;
}
}
- if( pgno==1 ){
+ if( pPg->pgno==1 ){
if( rc ){
/* If the read is unsuccessful, set the dbFileVers[] to something
** that will never be a valid file version. dbFileVers[] is a copy
@@ -49937,13 +50536,13 @@ static int readDbPage(PgHdr *pPg, u32 iFrame){
memcpy(&pPager->dbFileVers, dbFileVers, sizeof(pPager->dbFileVers));
}
}
- CODEC1(pPager, pPg->pData, pgno, 3, rc = SQLITE_NOMEM_BKPT);
+ CODEC1(pPager, pPg->pData, pPg->pgno, 3, rc = SQLITE_NOMEM_BKPT);
PAGER_INCR(sqlite3_pager_readdb_count);
PAGER_INCR(pPager->nRead);
- IOTRACE(("PGIN %p %d\n", pPager, pgno));
+ IOTRACE(("PGIN %p %d\n", pPager, pPg->pgno));
PAGERTRACE(("FETCH %d page %d hash(%08x)\n",
- PAGERID(pPager), pgno, pager_pagehash(pPg)));
+ PAGERID(pPager), pPg->pgno, pager_pagehash(pPg)));
return rc;
}
@@ -49994,11 +50593,7 @@ static int pagerUndoCallback(void *pCtx, Pgno iPg){
if( sqlite3PcachePageRefcount(pPg)==1 ){
sqlite3PcacheDrop(pPg);
}else{
- u32 iFrame = 0;
- rc = sqlite3WalFindFrame(pPager->pWal, pPg->pgno, &iFrame);
- if( rc==SQLITE_OK ){
- rc = readDbPage(pPg, iFrame);
- }
+ rc = readDbPage(pPg);
if( rc==SQLITE_OK ){
pPager->xReiniter(pPg);
}
@@ -50170,7 +50765,7 @@ static int pagerPagecount(Pager *pPager, Pgno *pnPage){
nPage = sqlite3WalDbsize(pPager->pWal);
/* If the number of pages in the database is not available from the
- ** WAL sub-system, determine the page counte based on the size of
+ ** WAL sub-system, determine the page count based on the size of
** the database file. If the size of the database file is not an
** integer multiple of the page-size, round up the result.
*/
@@ -50221,23 +50816,21 @@ static int pagerOpenWalIfPresent(Pager *pPager){
if( !pPager->tempFile ){
int isWal; /* True if WAL file exists */
- Pgno nPage; /* Size of the database file */
-
- rc = pagerPagecount(pPager, &nPage);
- if( rc ) return rc;
- if( nPage==0 ){
- rc = sqlite3OsDelete(pPager->pVfs, pPager->zWal, 0);
- if( rc==SQLITE_IOERR_DELETE_NOENT ) rc = SQLITE_OK;
- isWal = 0;
- }else{
- rc = sqlite3OsAccess(
- pPager->pVfs, pPager->zWal, SQLITE_ACCESS_EXISTS, &isWal
- );
- }
+ rc = sqlite3OsAccess(
+ pPager->pVfs, pPager->zWal, SQLITE_ACCESS_EXISTS, &isWal
+ );
if( rc==SQLITE_OK ){
if( isWal ){
- testcase( sqlite3PcachePagecount(pPager->pPCache)==0 );
- rc = sqlite3PagerOpenWal(pPager, 0);
+ Pgno nPage; /* Size of the database file */
+
+ rc = pagerPagecount(pPager, &nPage);
+ if( rc ) return rc;
+ if( nPage==0 ){
+ rc = sqlite3OsDelete(pPager->pVfs, pPager->zWal, 0);
+ }else{
+ testcase( sqlite3PcachePagecount(pPager->pPCache)==0 );
+ rc = sqlite3PagerOpenWal(pPager, 0);
+ }
}else if( pPager->journalMode==PAGER_JOURNALMODE_WAL ){
pPager->journalMode = PAGER_JOURNALMODE_DELETE;
}
@@ -50506,20 +51099,17 @@ SQLITE_PRIVATE void sqlite3PagerSetFlags(
}
if( pPager->noSync ){
pPager->syncFlags = 0;
- pPager->ckptSyncFlags = 0;
}else if( pgFlags & PAGER_FULLFSYNC ){
pPager->syncFlags = SQLITE_SYNC_FULL;
- pPager->ckptSyncFlags = SQLITE_SYNC_FULL;
- }else if( pgFlags & PAGER_CKPT_FULLFSYNC ){
- pPager->syncFlags = SQLITE_SYNC_NORMAL;
- pPager->ckptSyncFlags = SQLITE_SYNC_FULL;
}else{
pPager->syncFlags = SQLITE_SYNC_NORMAL;
- pPager->ckptSyncFlags = SQLITE_SYNC_NORMAL;
}
- pPager->walSyncFlags = pPager->syncFlags;
+ pPager->walSyncFlags = (pPager->syncFlags<<2);
if( pPager->fullSync ){
- pPager->walSyncFlags |= WAL_SYNC_TRANSACTIONS;
+ pPager->walSyncFlags |= pPager->syncFlags;
+ }
+ if( (pgFlags & PAGER_CKPT_FULLFSYNC) && !pPager->noSync ){
+ pPager->walSyncFlags |= (SQLITE_SYNC_FULL<<2);
}
if( pgFlags & PAGER_CACHESPILL ){
pPager->doNotSpill &= ~SPILLFLAG_OFF;
@@ -51018,7 +51608,7 @@ SQLITE_PRIVATE int sqlite3PagerClose(Pager *pPager, sqlite3 *db){
pPager->exclusiveMode = 0;
#ifndef SQLITE_OMIT_WAL
assert( db || pPager->pWal==0 );
- sqlite3WalClose(pPager->pWal, db, pPager->ckptSyncFlags, pPager->pageSize,
+ sqlite3WalClose(pPager->pWal, db, pPager->walSyncFlags, pPager->pageSize,
(db && (db->flags & SQLITE_NoCkptOnClose) ? 0 : pTmp)
);
pPager->pWal = 0;
@@ -51486,6 +52076,13 @@ static int pagerStress(void *p, PgHdr *pPg){
rc = pagerWalFrames(pPager, pPg, 0, 0);
}
}else{
+
+#ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE
+ if( pPager->tempFile==0 ){
+ rc = sqlite3JournalCreate(pPager->jfd);
+ if( rc!=SQLITE_OK ) return pager_error(pPager, rc);
+ }
+#endif
/* Sync the journal file if required. */
if( pPg->flags&PGHDR_NEED_SYNC
@@ -51819,13 +52416,11 @@ act_like_temp_file:
assert( pPager->extraSync==0 );
assert( pPager->syncFlags==0 );
assert( pPager->walSyncFlags==0 );
- assert( pPager->ckptSyncFlags==0 );
}else{
pPager->fullSync = 1;
pPager->extraSync = 0;
pPager->syncFlags = SQLITE_SYNC_NORMAL;
- pPager->walSyncFlags = SQLITE_SYNC_NORMAL | WAL_SYNC_TRANSACTIONS;
- pPager->ckptSyncFlags = SQLITE_SYNC_NORMAL;
+ pPager->walSyncFlags = SQLITE_SYNC_NORMAL | (SQLITE_SYNC_NORMAL<<2);
}
/* pPager->pFirst = 0; */
/* pPager->pFirstSynced = 0; */
@@ -52180,19 +52775,14 @@ SQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager){
** detected. The chance of an undetected change is so small that
** it can be neglected.
*/
- Pgno nPage = 0;
char dbFileVers[sizeof(pPager->dbFileVers)];
- rc = pagerPagecount(pPager, &nPage);
- if( rc ) goto failed;
-
- if( nPage>0 ){
- IOTRACE(("CKVERS %p %d\n", pPager, sizeof(dbFileVers)));
- rc = sqlite3OsRead(pPager->fd, &dbFileVers, sizeof(dbFileVers), 24);
- if( rc!=SQLITE_OK && rc!=SQLITE_IOERR_SHORT_READ ){
+ IOTRACE(("CKVERS %p %d\n", pPager, sizeof(dbFileVers)));
+ rc = sqlite3OsRead(pPager->fd, &dbFileVers, sizeof(dbFileVers), 24);
+ if( rc!=SQLITE_OK ){
+ if( rc!=SQLITE_IOERR_SHORT_READ ){
goto failed;
}
- }else{
memset(dbFileVers, 0, sizeof(dbFileVers));
}
@@ -52250,7 +52840,8 @@ SQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager){
** nothing to rollback, so this routine is a no-op.
*/
static void pagerUnlockIfUnused(Pager *pPager){
- if( pPager->nMmapOut==0 && (sqlite3PcacheRefCount(pPager->pPCache)==0) ){
+ if( sqlite3PcacheRefCount(pPager->pPCache)==0 ){
+ assert( pPager->nMmapOut==0 ); /* because page1 is never memory mapped */
pagerUnlockAndRollback(pPager);
}
}
@@ -52391,14 +52982,9 @@ static int getPageNormal(
memset(pPg->pData, 0, pPager->pageSize);
IOTRACE(("ZERO %p %d\n", pPager, pgno));
}else{
- u32 iFrame = 0; /* Frame to read from WAL file */
- if( pagerUseWal(pPager) ){
- rc = sqlite3WalFindFrame(pPager->pWal, pgno, &iFrame);
- if( rc!=SQLITE_OK ) goto pager_acquire_err;
- }
assert( pPg->pPager==pPager );
pPager->aStat[PAGER_STAT_MISS]++;
- rc = readDbPage(pPg, iFrame);
+ rc = readDbPage(pPg);
if( rc!=SQLITE_OK ){
goto pager_acquire_err;
}
@@ -52541,25 +53127,39 @@ SQLITE_PRIVATE DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno){
/*
** Release a page reference.
**
-** If the number of references to the page drop to zero, then the
-** page is added to the LRU list. When all references to all pages
-** are released, a rollback occurs and the lock on the database is
-** removed.
+** The sqlite3PagerUnref() and sqlite3PagerUnrefNotNull() may only be
+** used if we know that the page being released is not the last page.
+** The btree layer always holds page1 open until the end, so these first
+** to routines can be used to release any page other than BtShared.pPage1.
+**
+** Use sqlite3PagerUnrefPageOne() to release page1. This latter routine
+** checks the total number of outstanding pages and if the number of
+** pages reaches zero it drops the database lock.
*/
SQLITE_PRIVATE void sqlite3PagerUnrefNotNull(DbPage *pPg){
- Pager *pPager;
+ TESTONLY( Pager *pPager = pPg->pPager; )
assert( pPg!=0 );
- pPager = pPg->pPager;
if( pPg->flags & PGHDR_MMAP ){
+ assert( pPg->pgno!=1 ); /* Page1 is never memory mapped */
pagerReleaseMapPage(pPg);
}else{
sqlite3PcacheRelease(pPg);
}
- pagerUnlockIfUnused(pPager);
+ /* Do not use this routine to release the last reference to page1 */
+ assert( sqlite3PcacheRefCount(pPager->pPCache)>0 );
}
SQLITE_PRIVATE void sqlite3PagerUnref(DbPage *pPg){
if( pPg ) sqlite3PagerUnrefNotNull(pPg);
}
+SQLITE_PRIVATE void sqlite3PagerUnrefPageOne(DbPage *pPg){
+ Pager *pPager;
+ assert( pPg!=0 );
+ assert( pPg->pgno==1 );
+ assert( (pPg->flags & PGHDR_MMAP)==0 ); /* Page1 is never memory mapped */
+ pPager = pPg->pPager;
+ sqlite3PcacheRelease(pPg);
+ pagerUnlockIfUnused(pPager);
+}
/*
** This function is called at the start of every write transaction.
@@ -53271,6 +53871,21 @@ SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne(
sqlite3PcacheCleanAll(pPager->pPCache);
}
}else{
+ /* The bBatch boolean is true if the batch-atomic-write commit method
+ ** should be used. No rollback journal is created if batch-atomic-write
+ ** is enabled.
+ */
+ sqlite3_file *fd = pPager->fd;
+#ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE
+ const int bBatch = zMaster==0 /* An SQLITE_IOCAP_BATCH_ATOMIC commit */
+ && (sqlite3OsDeviceCharacteristics(fd) & SQLITE_IOCAP_BATCH_ATOMIC)
+ && !pPager->noSync
+ && sqlite3JournalIsInMemory(pPager->jfd);
+#else
+# define bBatch 0
+#endif
+
+#ifdef SQLITE_ENABLE_ATOMIC_WRITE
/* The following block updates the change-counter. Exactly how it
** does this depends on whether or not the atomic-update optimization
** was enabled at compile time, and if this transaction meets the
@@ -53294,33 +53909,40 @@ SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne(
** in 'direct' mode. In this case the journal file will never be
** created for this transaction.
*/
- #ifdef SQLITE_ENABLE_ATOMIC_WRITE
- PgHdr *pPg;
- assert( isOpen(pPager->jfd)
- || pPager->journalMode==PAGER_JOURNALMODE_OFF
- || pPager->journalMode==PAGER_JOURNALMODE_WAL
- );
- if( !zMaster && isOpen(pPager->jfd)
- && pPager->journalOff==jrnlBufferSize(pPager)
- && pPager->dbSize>=pPager->dbOrigSize
- && (0==(pPg = sqlite3PcacheDirtyList(pPager->pPCache)) || 0==pPg->pDirty)
- ){
- /* Update the db file change counter via the direct-write method. The
- ** following call will modify the in-memory representation of page 1
- ** to include the updated change counter and then write page 1
- ** directly to the database file. Because of the atomic-write
- ** property of the host file-system, this is safe.
- */
- rc = pager_incr_changecounter(pPager, 1);
- }else{
- rc = sqlite3JournalCreate(pPager->jfd);
- if( rc==SQLITE_OK ){
- rc = pager_incr_changecounter(pPager, 0);
+ if( bBatch==0 ){
+ PgHdr *pPg;
+ assert( isOpen(pPager->jfd)
+ || pPager->journalMode==PAGER_JOURNALMODE_OFF
+ || pPager->journalMode==PAGER_JOURNALMODE_WAL
+ );
+ if( !zMaster && isOpen(pPager->jfd)
+ && pPager->journalOff==jrnlBufferSize(pPager)
+ && pPager->dbSize>=pPager->dbOrigSize
+ && (!(pPg = sqlite3PcacheDirtyList(pPager->pPCache)) || 0==pPg->pDirty)
+ ){
+ /* Update the db file change counter via the direct-write method. The
+ ** following call will modify the in-memory representation of page 1
+ ** to include the updated change counter and then write page 1
+ ** directly to the database file. Because of the atomic-write
+ ** property of the host file-system, this is safe.
+ */
+ rc = pager_incr_changecounter(pPager, 1);
+ }else{
+ rc = sqlite3JournalCreate(pPager->jfd);
+ if( rc==SQLITE_OK ){
+ rc = pager_incr_changecounter(pPager, 0);
+ }
}
}
- #else
+#else
+#ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE
+ if( zMaster ){
+ rc = sqlite3JournalCreate(pPager->jfd);
+ if( rc!=SQLITE_OK ) goto commit_phase_one_exit;
+ }
+#endif
rc = pager_incr_changecounter(pPager, 0);
- #endif
+#endif
if( rc!=SQLITE_OK ) goto commit_phase_one_exit;
/* Write the master journal name into the journal file. If a master
@@ -53343,8 +53965,24 @@ SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne(
*/
rc = syncJournal(pPager, 0);
if( rc!=SQLITE_OK ) goto commit_phase_one_exit;
-
+
+ if( bBatch ){
+ /* The pager is now in DBMOD state. But regardless of what happens
+ ** next, attempting to play the journal back into the database would
+ ** be unsafe. Close it now to make sure that does not happen. */
+ sqlite3OsClose(pPager->jfd);
+ rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_BEGIN_ATOMIC_WRITE, 0);
+ if( rc!=SQLITE_OK ) goto commit_phase_one_exit;
+ }
rc = pager_write_pagelist(pPager,sqlite3PcacheDirtyList(pPager->pPCache));
+ if( bBatch ){
+ if( rc==SQLITE_OK ){
+ rc = sqlite3OsFileControl(fd, SQLITE_FCNTL_COMMIT_ATOMIC_WRITE, 0);
+ }else{
+ sqlite3OsFileControl(fd, SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE, 0);
+ }
+ }
+
if( rc!=SQLITE_OK ){
assert( rc!=SQLITE_IOERR_BLOCKED );
goto commit_phase_one_exit;
@@ -54245,7 +54883,7 @@ SQLITE_PRIVATE int sqlite3PagerCheckpoint(
rc = sqlite3WalCheckpoint(pPager->pWal, db, eMode,
(eMode==SQLITE_CHECKPOINT_PASSIVE ? 0 : pPager->xBusyHandler),
pPager->pBusyHandlerArg,
- pPager->ckptSyncFlags, pPager->pageSize, (u8 *)pPager->pTmpSpace,
+ pPager->walSyncFlags, pPager->pageSize, (u8 *)pPager->pTmpSpace,
pnLog, pnCkpt
);
}
@@ -54402,7 +55040,7 @@ SQLITE_PRIVATE int sqlite3PagerCloseWal(Pager *pPager, sqlite3 *db){
if( rc==SQLITE_OK && pPager->pWal ){
rc = pagerExclusiveLock(pPager);
if( rc==SQLITE_OK ){
- rc = sqlite3WalClose(pPager->pWal, db, pPager->ckptSyncFlags,
+ rc = sqlite3WalClose(pPager->pWal, db, pPager->walSyncFlags,
pPager->pageSize, (u8*)pPager->pTmpSpace);
pPager->pWal = 0;
pagerFixMaplimit(pPager);
@@ -56274,9 +56912,7 @@ static int walCheckpoint(
pInfo->nBackfillAttempted = mxSafeFrame;
/* Sync the WAL to disk */
- if( sync_flags ){
- rc = sqlite3OsSync(pWal->pWalFd, sync_flags);
- }
+ rc = sqlite3OsSync(pWal->pWalFd, CKPT_SYNC_FLAGS(sync_flags));
/* If the database may grow as a result of this checkpoint, hint
** about the eventual size of the db file to the VFS layer.
@@ -56317,8 +56953,8 @@ static int walCheckpoint(
i64 szDb = pWal->hdr.nPage*(i64)szPage;
testcase( IS_BIG_INT(szDb) );
rc = sqlite3OsTruncate(pWal->pDbFd, szDb);
- if( rc==SQLITE_OK && sync_flags ){
- rc = sqlite3OsSync(pWal->pDbFd, sync_flags);
+ if( rc==SQLITE_OK ){
+ rc = sqlite3OsSync(pWal->pDbFd, CKPT_SYNC_FLAGS(sync_flags));
}
}
if( rc==SQLITE_OK ){
@@ -57424,8 +58060,8 @@ static int walWriteToLog(
iOffset += iFirstAmt;
iAmt -= iFirstAmt;
pContent = (void*)(iFirstAmt + (char*)pContent);
- assert( p->syncFlags & (SQLITE_SYNC_NORMAL|SQLITE_SYNC_FULL) );
- rc = sqlite3OsSync(p->pFd, p->syncFlags & SQLITE_SYNC_MASK);
+ assert( WAL_SYNC_FLAGS(p->syncFlags)!=0 );
+ rc = sqlite3OsSync(p->pFd, WAL_SYNC_FLAGS(p->syncFlags));
if( iAmt==0 || rc ) return rc;
}
rc = sqlite3OsWrite(p->pFd, pContent, iAmt, iOffset);
@@ -57595,10 +58231,10 @@ SQLITE_PRIVATE int sqlite3WalFrames(
** an out-of-order write following a WAL restart could result in
** database corruption. See the ticket:
**
- ** http://localhost:591/sqlite/info/ff5be73dee
+ ** https://sqlite.org/src/info/ff5be73dee
*/
- if( pWal->syncHeader && sync_flags ){
- rc = sqlite3OsSync(pWal->pWalFd, sync_flags & SQLITE_SYNC_MASK);
+ if( pWal->syncHeader ){
+ rc = sqlite3OsSync(pWal->pWalFd, CKPT_SYNC_FLAGS(sync_flags));
if( rc ) return rc;
}
}
@@ -57673,7 +58309,7 @@ SQLITE_PRIVATE int sqlite3WalFrames(
** sector boundary is synced; the part of the last frame that extends
** past the sector boundary is written after the sync.
*/
- if( isCommit && (sync_flags & WAL_SYNC_TRANSACTIONS)!=0 ){
+ if( isCommit && WAL_SYNC_FLAGS(sync_flags)!=0 ){
int bSync = 1;
if( pWal->padToSectorBoundary ){
int sectorSize = sqlite3SectorSize(pWal->pWalFd);
@@ -57689,7 +58325,7 @@ SQLITE_PRIVATE int sqlite3WalFrames(
}
if( bSync ){
assert( rc==SQLITE_OK );
- rc = sqlite3OsSync(w.pFd, sync_flags & SQLITE_SYNC_MASK);
+ rc = sqlite3OsSync(w.pFd, WAL_SYNC_FLAGS(sync_flags));
}
}
@@ -58485,10 +59121,12 @@ struct BtShared {
#define BTS_READ_ONLY 0x0001 /* Underlying file is readonly */
#define BTS_PAGESIZE_FIXED 0x0002 /* Page size can no longer be changed */
#define BTS_SECURE_DELETE 0x0004 /* PRAGMA secure_delete is enabled */
-#define BTS_INITIALLY_EMPTY 0x0008 /* Database was empty at trans start */
-#define BTS_NO_WAL 0x0010 /* Do not open write-ahead-log files */
-#define BTS_EXCLUSIVE 0x0020 /* pWriter has an exclusive lock */
-#define BTS_PENDING 0x0040 /* Waiting for read-locks to clear */
+#define BTS_OVERWRITE 0x0008 /* Overwrite deleted content with zeros */
+#define BTS_FAST_SECURE 0x000c /* Combination of the previous two */
+#define BTS_INITIALLY_EMPTY 0x0010 /* Database was empty at trans start */
+#define BTS_NO_WAL 0x0020 /* Do not open write-ahead-log files */
+#define BTS_EXCLUSIVE 0x0040 /* pWriter has an exclusive lock */
+#define BTS_PENDING 0x0080 /* Waiting for read-locks to clear */
/*
** An instance of the following structure is used to hold information
@@ -58534,6 +59172,11 @@ struct CellInfo {
** eState==FAULT: Cursor fault with skipNext as error code.
*/
struct BtCursor {
+ u8 eState; /* One of the CURSOR_XXX constants (see below) */
+ u8 curFlags; /* zero or more BTCF_* flags defined below */
+ u8 curPagerFlags; /* Flags to send to sqlite3PagerGet() */
+ u8 hints; /* As configured by CursorSetHints() */
+ int nOvflAlloc; /* Allocated size of aOverflow[] array */
Btree *pBtree; /* The Btree to which this cursor belongs */
BtShared *pBt; /* The BtShared this cursor points to */
BtCursor *pNext; /* Forms a linked list of all cursors */
@@ -58542,13 +59185,8 @@ struct BtCursor {
i64 nKey; /* Size of pKey, or last integer key */
void *pKey; /* Saved key that was cursor last known position */
Pgno pgnoRoot; /* The root page of this tree */
- int nOvflAlloc; /* Allocated size of aOverflow[] array */
int skipNext; /* Prev() is noop if negative. Next() is noop if positive.
** Error code if eState==CURSOR_FAULT */
- u8 curFlags; /* zero or more BTCF_* flags defined below */
- u8 curPagerFlags; /* Flags to send to sqlite3PagerGet() */
- u8 eState; /* One of the CURSOR_XXX constants (see below) */
- u8 hints; /* As configured by CursorSetHints() */
/* All fields above are zeroed when the cursor is allocated. See
** sqlite3BtreeCursorZero(). Fields that follow must be manually
** initialized. */
@@ -58557,7 +59195,8 @@ struct BtCursor {
u16 ix; /* Current index for apPage[iPage] */
u16 aiIdx[BTCURSOR_MAX_DEPTH-1]; /* Current index in apPage[i] */
struct KeyInfo *pKeyInfo; /* Arg passed to comparison function */
- MemPage *apPage[BTCURSOR_MAX_DEPTH]; /* Pages from root to current page */
+ MemPage *pPage; /* Current page */
+ MemPage *apPage[BTCURSOR_MAX_DEPTH-1]; /* Stack of parents of current page */
};
/*
@@ -59186,7 +59825,7 @@ static int hasSharedCacheTableLock(
** Return true immediately.
*/
if( (pBtree->sharable==0)
- || (eLockType==READ_LOCK && (pBtree->db->flags & SQLITE_ReadUncommitted))
+ || (eLockType==READ_LOCK && (pBtree->db->flags & SQLITE_ReadUncommit))
){
return 1;
}
@@ -59263,7 +59902,7 @@ static int hasReadConflicts(Btree *pBtree, Pgno iRoot){
for(p=pBtree->pBt->pCursor; p; p=p->pNext){
if( p->pgnoRoot==iRoot
&& p->pBtree!=pBtree
- && 0==(p->pBtree->db->flags & SQLITE_ReadUncommitted)
+ && 0==(p->pBtree->db->flags & SQLITE_ReadUncommit)
){
return 1;
}
@@ -59285,7 +59924,7 @@ static int querySharedCacheTableLock(Btree *p, Pgno iTab, u8 eLock){
assert( sqlite3BtreeHoldsMutex(p) );
assert( eLock==READ_LOCK || eLock==WRITE_LOCK );
assert( p->db!=0 );
- assert( !(p->db->flags&SQLITE_ReadUncommitted)||eLock==WRITE_LOCK||iTab==1 );
+ assert( !(p->db->flags&SQLITE_ReadUncommit)||eLock==WRITE_LOCK||iTab==1 );
/* If requesting a write-lock, then the Btree must have an open write
** transaction on this file. And, obviously, for this to be so there
@@ -59363,7 +60002,7 @@ static int setSharedCacheTableLock(Btree *p, Pgno iTable, u8 eLock){
** obtain a read-lock using this function. The only read-lock obtained
** by a connection in read-uncommitted mode is on the sqlite_master
** table, and that lock is obtained in BtreeBeginTrans(). */
- assert( 0==(p->db->flags&SQLITE_ReadUncommitted) || eLock==WRITE_LOCK );
+ assert( 0==(p->db->flags&SQLITE_ReadUncommit) || eLock==WRITE_LOCK );
/* This function should only be called on a sharable b-tree after it
** has been determined that no other b-tree holds a conflicting lock. */
@@ -59473,7 +60112,9 @@ static void downgradeAllSharedCacheTableLocks(Btree *p){
#endif /* SQLITE_OMIT_SHARED_CACHE */
-static void releasePage(MemPage *pPage); /* Forward reference */
+static void releasePage(MemPage *pPage); /* Forward reference */
+static void releasePageOne(MemPage *pPage); /* Forward reference */
+static void releasePageNotNull(MemPage *pPage); /* Forward reference */
/*
***** This routine is used inside of assert() only ****
@@ -59632,11 +60273,13 @@ static void btreeClearHasContent(BtShared *pBt){
*/
static void btreeReleaseAllCursorPages(BtCursor *pCur){
int i;
- for(i=0; i<=pCur->iPage; i++){
- releasePage(pCur->apPage[i]);
- pCur->apPage[i] = 0;
+ if( pCur->iPage>=0 ){
+ for(i=0; i<pCur->iPage; i++){
+ releasePageNotNull(pCur->apPage[i]);
+ }
+ releasePageNotNull(pCur->pPage);
+ pCur->iPage = -1;
}
- pCur->iPage = -1;
}
/*
@@ -59765,7 +60408,7 @@ static int SQLITE_NOINLINE saveCursorsOnList(
return rc;
}
}else{
- testcase( p->iPage>0 );
+ testcase( p->iPage>=0 );
btreeReleaseAllCursorPages(p);
}
}
@@ -59870,6 +60513,17 @@ SQLITE_PRIVATE int sqlite3BtreeCursorHasMoved(BtCursor *pCur){
}
/*
+** Return a pointer to a fake BtCursor object that will always answer
+** false to the sqlite3BtreeCursorHasMoved() routine above. The fake
+** cursor returned must not be used with any other Btree interface.
+*/
+SQLITE_PRIVATE BtCursor *sqlite3BtreeFakeValidCursor(void){
+ static u8 fakeCursor = CURSOR_VALID;
+ assert( offsetof(BtCursor, eState)==0 );
+ return (BtCursor*)&fakeCursor;
+}
+
+/*
** This routine restores a cursor back to its original position after it
** has been moved by some outside activity (such as a btree rebalance or
** a row having been deleted out from under the cursor).
@@ -60034,7 +60688,7 @@ static int ptrmapGet(BtShared *pBt, Pgno key, u8 *pEType, Pgno *pPgno){
if( pPgno ) *pPgno = get4byte(&pPtrmap[offset+1]);
sqlite3PagerUnref(pDbPage);
- if( *pEType<1 || *pEType>5 ) return SQLITE_CORRUPT_BKPT;
+ if( *pEType<1 || *pEType>5 ) return SQLITE_CORRUPT_PGNO(iPtrmap);
return SQLITE_OK;
}
@@ -60418,8 +61072,11 @@ static int defragmentPage(MemPage *pPage, int nMaxFrag){
int sz2 = 0;
int sz = get2byte(&data[iFree+2]);
int top = get2byte(&data[hdr+5]);
+ if( top>=iFree ){
+ return SQLITE_CORRUPT_PGNO(pPage->pgno);
+ }
if( iFree2 ){
- if( iFree+sz>iFree2 ) return SQLITE_CORRUPT_BKPT;
+ assert( iFree+sz<=iFree2 ); /* Verified by pageFindSlot() */
sz2 = get2byte(&data[iFree2+2]);
assert( iFree+sz+sz2+iFree2-(iFree+sz) <= usableSize );
memmove(&data[iFree+sz+sz2], &data[iFree+sz], iFree2-(iFree+sz));
@@ -60450,13 +61107,13 @@ static int defragmentPage(MemPage *pPage, int nMaxFrag){
** if PRAGMA cell_size_check=ON.
*/
if( pc<iCellFirst || pc>iCellLast ){
- return SQLITE_CORRUPT_BKPT;
+ return SQLITE_CORRUPT_PGNO(pPage->pgno);
}
assert( pc>=iCellFirst && pc<=iCellLast );
size = pPage->xCellSize(pPage, &src[pc]);
cbrk -= size;
if( cbrk<iCellFirst || pc+size>usableSize ){
- return SQLITE_CORRUPT_BKPT;
+ return SQLITE_CORRUPT_PGNO(pPage->pgno);
}
assert( cbrk+size<=usableSize && cbrk>=iCellFirst );
testcase( cbrk+size==usableSize );
@@ -60476,7 +61133,7 @@ static int defragmentPage(MemPage *pPage, int nMaxFrag){
defragment_out:
if( data[hdr+7]+cbrk-iCellFirst!=pPage->nFree ){
- return SQLITE_CORRUPT_BKPT;
+ return SQLITE_CORRUPT_PGNO(pPage->pgno);
}
assert( cbrk>=iCellFirst );
put2byte(&data[hdr+5], cbrk);
@@ -60508,16 +61165,10 @@ static u8 *pageFindSlot(MemPage *pPg, int nByte, int *pRc){
int pc = get2byte(&aData[iAddr]);
int x;
int usableSize = pPg->pBt->usableSize;
+ int size; /* Size of the free slot */
assert( pc>0 );
- do{
- int size; /* Size of the free slot */
- /* EVIDENCE-OF: R-06866-39125 Freeblocks are always connected in order of
- ** increasing offset. */
- if( pc>usableSize-4 || pc<iAddr+4 ){
- *pRc = SQLITE_CORRUPT_BKPT;
- return 0;
- }
+ while( pc<=usableSize-4 ){
/* EVIDENCE-OF: R-22710-53328 The third and fourth bytes of each
** freeblock form a big-endian integer which is the size of the freeblock
** in bytes, including the 4-byte header. */
@@ -60525,8 +61176,8 @@ static u8 *pageFindSlot(MemPage *pPg, int nByte, int *pRc){
if( (x = size - nByte)>=0 ){
testcase( x==4 );
testcase( x==3 );
- if( pc < pPg->cellOffset+2*pPg->nCell || size+pc > usableSize ){
- *pRc = SQLITE_CORRUPT_BKPT;
+ if( size+pc > usableSize ){
+ *pRc = SQLITE_CORRUPT_PGNO(pPg->pgno);
return 0;
}else if( x<4 ){
/* EVIDENCE-OF: R-11498-58022 In a well-formed b-tree page, the total
@@ -60546,7 +61197,11 @@ static u8 *pageFindSlot(MemPage *pPg, int nByte, int *pRc){
}
iAddr = pc;
pc = get2byte(&aData[pc]);
- }while( pc );
+ if( pc<iAddr+size ) break;
+ }
+ if( pc ){
+ *pRc = SQLITE_CORRUPT_PGNO(pPg->pgno);
+ }
return 0;
}
@@ -60593,7 +61248,7 @@ static int allocateSpace(MemPage *pPage, int nByte, int *pIdx){
if( top==0 && pPage->pBt->usableSize==65536 ){
top = 65536;
}else{
- return SQLITE_CORRUPT_BKPT;
+ return SQLITE_CORRUPT_PGNO(pPage->pgno);
}
}
@@ -60660,7 +61315,7 @@ static int freeSpace(MemPage *pPage, u16 iStart, u16 iSize){
u8 hdr; /* Page header size. 0 or 100 */
u8 nFrag = 0; /* Reduction in fragmentation */
u16 iOrigSize = iSize; /* Original value of iSize */
- u32 iLast = pPage->pBt->usableSize-4; /* Largest possible freeblock offset */
+ u16 x; /* Offset to cell content area */
u32 iEnd = iStart + iSize; /* First byte past the iStart buffer */
unsigned char *data = pPage->aData; /* Page content */
@@ -60670,13 +61325,7 @@ static int freeSpace(MemPage *pPage, u16 iStart, u16 iSize){
assert( CORRUPT_DB || iEnd <= pPage->pBt->usableSize );
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
assert( iSize>=4 ); /* Minimum cell size is 4 */
- assert( iStart<=iLast );
-
- /* Overwrite deleted information with zeros when the secure_delete
- ** option is enabled */
- if( pPage->pBt->btsFlags & BTS_SECURE_DELETE ){
- memset(&data[iStart], 0, iSize);
- }
+ assert( iStart<=pPage->pBt->usableSize-4 );
/* The list of freeblocks must be in ascending order. Find the
** spot on the list where iStart should be inserted.
@@ -60689,11 +61338,13 @@ static int freeSpace(MemPage *pPage, u16 iStart, u16 iSize){
while( (iFreeBlk = get2byte(&data[iPtr]))<iStart ){
if( iFreeBlk<iPtr+4 ){
if( iFreeBlk==0 ) break;
- return SQLITE_CORRUPT_BKPT;
+ return SQLITE_CORRUPT_PGNO(pPage->pgno);
}
iPtr = iFreeBlk;
}
- if( iFreeBlk>iLast ) return SQLITE_CORRUPT_BKPT;
+ if( iFreeBlk>pPage->pBt->usableSize-4 ){
+ return SQLITE_CORRUPT_PGNO(pPage->pgno);
+ }
assert( iFreeBlk>iPtr || iFreeBlk==0 );
/* At this point:
@@ -60704,9 +61355,11 @@ static int freeSpace(MemPage *pPage, u16 iStart, u16 iSize){
*/
if( iFreeBlk && iEnd+3>=iFreeBlk ){
nFrag = iFreeBlk - iEnd;
- if( iEnd>iFreeBlk ) return SQLITE_CORRUPT_BKPT;
+ if( iEnd>iFreeBlk ) return SQLITE_CORRUPT_PGNO(pPage->pgno);
iEnd = iFreeBlk + get2byte(&data[iFreeBlk+2]);
- if( iEnd > pPage->pBt->usableSize ) return SQLITE_CORRUPT_BKPT;
+ if( iEnd > pPage->pBt->usableSize ){
+ return SQLITE_CORRUPT_PGNO(pPage->pgno);
+ }
iSize = iEnd - iStart;
iFreeBlk = get2byte(&data[iFreeBlk]);
}
@@ -60718,28 +61371,34 @@ static int freeSpace(MemPage *pPage, u16 iStart, u16 iSize){
if( iPtr>hdr+1 ){
int iPtrEnd = iPtr + get2byte(&data[iPtr+2]);
if( iPtrEnd+3>=iStart ){
- if( iPtrEnd>iStart ) return SQLITE_CORRUPT_BKPT;
+ if( iPtrEnd>iStart ) return SQLITE_CORRUPT_PGNO(pPage->pgno);
nFrag += iStart - iPtrEnd;
iSize = iEnd - iPtr;
iStart = iPtr;
}
}
- if( nFrag>data[hdr+7] ) return SQLITE_CORRUPT_BKPT;
+ if( nFrag>data[hdr+7] ) return SQLITE_CORRUPT_PGNO(pPage->pgno);
data[hdr+7] -= nFrag;
}
- if( iStart==get2byte(&data[hdr+5]) ){
+ x = get2byte(&data[hdr+5]);
+ if( iStart<=x ){
/* The new freeblock is at the beginning of the cell content area,
** so just extend the cell content area rather than create another
** freelist entry */
- if( iPtr!=hdr+1 ) return SQLITE_CORRUPT_BKPT;
+ if( iStart<x || iPtr!=hdr+1 ) return SQLITE_CORRUPT_PGNO(pPage->pgno);
put2byte(&data[hdr+1], iFreeBlk);
put2byte(&data[hdr+5], iEnd);
}else{
/* Insert the new freeblock into the freelist */
put2byte(&data[iPtr], iStart);
- put2byte(&data[iStart], iFreeBlk);
- put2byte(&data[iStart+2], iSize);
}
+ if( pPage->pBt->btsFlags & BTS_FAST_SECURE ){
+ /* Overwrite deleted information with zeros when the secure_delete
+ ** option is enabled */
+ memset(&data[iStart], 0, iSize);
+ }
+ put2byte(&data[iStart], iFreeBlk);
+ put2byte(&data[iStart+2], iSize);
pPage->nFree += iOrigSize;
return SQLITE_OK;
}
@@ -60799,7 +61458,7 @@ static int decodeFlags(MemPage *pPage, int flagByte){
}else{
/* EVIDENCE-OF: R-47608-56469 Any other value for the b-tree page type is
** an error. */
- return SQLITE_CORRUPT_BKPT;
+ return SQLITE_CORRUPT_PGNO(pPage->pgno);
}
pPage->max1bytePayload = pBt->max1bytePayload;
return SQLITE_OK;
@@ -60815,6 +61474,16 @@ static int decodeFlags(MemPage *pPage, int flagByte){
** we failed to detect any corruption.
*/
static int btreeInitPage(MemPage *pPage){
+ int pc; /* Address of a freeblock within pPage->aData[] */
+ u8 hdr; /* Offset to beginning of page header */
+ u8 *data; /* Equal to pPage->aData */
+ BtShared *pBt; /* The main btree structure */
+ int usableSize; /* Amount of usable space on each page */
+ u16 cellOffset; /* Offset from start of page to first cell pointer */
+ int nFree; /* Number of unused bytes on the page */
+ int top; /* First byte of the cell content area */
+ int iCellFirst; /* First allowable cell or freeblock offset */
+ int iCellLast; /* Last possible cell or freeblock offset */
assert( pPage->pBt!=0 );
assert( pPage->pBt->db!=0 );
@@ -60822,127 +61491,119 @@ static int btreeInitPage(MemPage *pPage){
assert( pPage->pgno==sqlite3PagerPagenumber(pPage->pDbPage) );
assert( pPage == sqlite3PagerGetExtra(pPage->pDbPage) );
assert( pPage->aData == sqlite3PagerGetData(pPage->pDbPage) );
+ assert( pPage->isInit==0 );
- if( !pPage->isInit ){
- int pc; /* Address of a freeblock within pPage->aData[] */
- u8 hdr; /* Offset to beginning of page header */
- u8 *data; /* Equal to pPage->aData */
- BtShared *pBt; /* The main btree structure */
- int usableSize; /* Amount of usable space on each page */
- u16 cellOffset; /* Offset from start of page to first cell pointer */
- int nFree; /* Number of unused bytes on the page */
- int top; /* First byte of the cell content area */
- int iCellFirst; /* First allowable cell or freeblock offset */
- int iCellLast; /* Last possible cell or freeblock offset */
-
- pBt = pPage->pBt;
-
- hdr = pPage->hdrOffset;
- data = pPage->aData;
- /* EVIDENCE-OF: R-28594-02890 The one-byte flag at offset 0 indicating
- ** the b-tree page type. */
- if( decodeFlags(pPage, data[hdr]) ) return SQLITE_CORRUPT_BKPT;
- assert( pBt->pageSize>=512 && pBt->pageSize<=65536 );
- pPage->maskPage = (u16)(pBt->pageSize - 1);
- pPage->nOverflow = 0;
- usableSize = pBt->usableSize;
- pPage->cellOffset = cellOffset = hdr + 8 + pPage->childPtrSize;
- pPage->aDataEnd = &data[usableSize];
- pPage->aCellIdx = &data[cellOffset];
- pPage->aDataOfst = &data[pPage->childPtrSize];
- /* EVIDENCE-OF: R-58015-48175 The two-byte integer at offset 5 designates
- ** the start of the cell content area. A zero value for this integer is
- ** interpreted as 65536. */
- top = get2byteNotZero(&data[hdr+5]);
- /* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the
- ** number of cells on the page. */
- pPage->nCell = get2byte(&data[hdr+3]);
- if( pPage->nCell>MX_CELL(pBt) ){
- /* To many cells for a single page. The page must be corrupt */
- return SQLITE_CORRUPT_BKPT;
- }
- testcase( pPage->nCell==MX_CELL(pBt) );
- /* EVIDENCE-OF: R-24089-57979 If a page contains no cells (which is only
- ** possible for a root page of a table that contains no rows) then the
- ** offset to the cell content area will equal the page size minus the
- ** bytes of reserved space. */
- assert( pPage->nCell>0 || top==usableSize || CORRUPT_DB );
-
- /* A malformed database page might cause us to read past the end
- ** of page when parsing a cell.
- **
- ** The following block of code checks early to see if a cell extends
- ** past the end of a page boundary and causes SQLITE_CORRUPT to be
- ** returned if it does.
- */
- iCellFirst = cellOffset + 2*pPage->nCell;
- iCellLast = usableSize - 4;
- if( pBt->db->flags & SQLITE_CellSizeCk ){
- int i; /* Index into the cell pointer array */
- int sz; /* Size of a cell */
-
- if( !pPage->leaf ) iCellLast--;
- for(i=0; i<pPage->nCell; i++){
- pc = get2byteAligned(&data[cellOffset+i*2]);
- testcase( pc==iCellFirst );
- testcase( pc==iCellLast );
- if( pc<iCellFirst || pc>iCellLast ){
- return SQLITE_CORRUPT_BKPT;
- }
- sz = pPage->xCellSize(pPage, &data[pc]);
- testcase( pc+sz==usableSize );
- if( pc+sz>usableSize ){
- return SQLITE_CORRUPT_BKPT;
- }
- }
- if( !pPage->leaf ) iCellLast++;
- }
+ pBt = pPage->pBt;
+ hdr = pPage->hdrOffset;
+ data = pPage->aData;
+ /* EVIDENCE-OF: R-28594-02890 The one-byte flag at offset 0 indicating
+ ** the b-tree page type. */
+ if( decodeFlags(pPage, data[hdr]) ){
+ return SQLITE_CORRUPT_PGNO(pPage->pgno);
+ }
+ assert( pBt->pageSize>=512 && pBt->pageSize<=65536 );
+ pPage->maskPage = (u16)(pBt->pageSize - 1);
+ pPage->nOverflow = 0;
+ usableSize = pBt->usableSize;
+ pPage->cellOffset = cellOffset = hdr + 8 + pPage->childPtrSize;
+ pPage->aDataEnd = &data[usableSize];
+ pPage->aCellIdx = &data[cellOffset];
+ pPage->aDataOfst = &data[pPage->childPtrSize];
+ /* EVIDENCE-OF: R-58015-48175 The two-byte integer at offset 5 designates
+ ** the start of the cell content area. A zero value for this integer is
+ ** interpreted as 65536. */
+ top = get2byteNotZero(&data[hdr+5]);
+ /* EVIDENCE-OF: R-37002-32774 The two-byte integer at offset 3 gives the
+ ** number of cells on the page. */
+ pPage->nCell = get2byte(&data[hdr+3]);
+ if( pPage->nCell>MX_CELL(pBt) ){
+ /* To many cells for a single page. The page must be corrupt */
+ return SQLITE_CORRUPT_PGNO(pPage->pgno);
+ }
+ testcase( pPage->nCell==MX_CELL(pBt) );
+ /* EVIDENCE-OF: R-24089-57979 If a page contains no cells (which is only
+ ** possible for a root page of a table that contains no rows) then the
+ ** offset to the cell content area will equal the page size minus the
+ ** bytes of reserved space. */
+ assert( pPage->nCell>0 || top==usableSize || CORRUPT_DB );
+
+ /* A malformed database page might cause us to read past the end
+ ** of page when parsing a cell.
+ **
+ ** The following block of code checks early to see if a cell extends
+ ** past the end of a page boundary and causes SQLITE_CORRUPT to be
+ ** returned if it does.
+ */
+ iCellFirst = cellOffset + 2*pPage->nCell;
+ iCellLast = usableSize - 4;
+ if( pBt->db->flags & SQLITE_CellSizeCk ){
+ int i; /* Index into the cell pointer array */
+ int sz; /* Size of a cell */
- /* Compute the total free space on the page
- ** EVIDENCE-OF: R-23588-34450 The two-byte integer at offset 1 gives the
- ** start of the first freeblock on the page, or is zero if there are no
- ** freeblocks. */
- pc = get2byte(&data[hdr+1]);
- nFree = data[hdr+7] + top; /* Init nFree to non-freeblock free space */
- if( pc>0 ){
- u32 next, size;
- if( pc<iCellFirst ){
- /* EVIDENCE-OF: R-55530-52930 In a well-formed b-tree page, there will
- ** always be at least one cell before the first freeblock.
- */
- return SQLITE_CORRUPT_BKPT;
+ if( !pPage->leaf ) iCellLast--;
+ for(i=0; i<pPage->nCell; i++){
+ pc = get2byteAligned(&data[cellOffset+i*2]);
+ testcase( pc==iCellFirst );
+ testcase( pc==iCellLast );
+ if( pc<iCellFirst || pc>iCellLast ){
+ return SQLITE_CORRUPT_PGNO(pPage->pgno);
}
- while( 1 ){
- if( pc>iCellLast ){
- return SQLITE_CORRUPT_BKPT; /* Freeblock off the end of the page */
- }
- next = get2byte(&data[pc]);
- size = get2byte(&data[pc+2]);
- nFree = nFree + size;
- if( next<=pc+size+3 ) break;
- pc = next;
- }
- if( next>0 ){
- return SQLITE_CORRUPT_BKPT; /* Freeblock not in ascending order */
- }
- if( pc+size>(unsigned int)usableSize ){
- return SQLITE_CORRUPT_BKPT; /* Last freeblock extends past page end */
+ sz = pPage->xCellSize(pPage, &data[pc]);
+ testcase( pc+sz==usableSize );
+ if( pc+sz>usableSize ){
+ return SQLITE_CORRUPT_PGNO(pPage->pgno);
}
}
+ if( !pPage->leaf ) iCellLast++;
+ }
- /* At this point, nFree contains the sum of the offset to the start
- ** of the cell-content area plus the number of free bytes within
- ** the cell-content area. If this is greater than the usable-size
- ** of the page, then the page must be corrupted. This check also
- ** serves to verify that the offset to the start of the cell-content
- ** area, according to the page header, lies within the page.
- */
- if( nFree>usableSize ){
- return SQLITE_CORRUPT_BKPT;
+ /* Compute the total free space on the page
+ ** EVIDENCE-OF: R-23588-34450 The two-byte integer at offset 1 gives the
+ ** start of the first freeblock on the page, or is zero if there are no
+ ** freeblocks. */
+ pc = get2byte(&data[hdr+1]);
+ nFree = data[hdr+7] + top; /* Init nFree to non-freeblock free space */
+ if( pc>0 ){
+ u32 next, size;
+ if( pc<iCellFirst ){
+ /* EVIDENCE-OF: R-55530-52930 In a well-formed b-tree page, there will
+ ** always be at least one cell before the first freeblock.
+ */
+ return SQLITE_CORRUPT_PGNO(pPage->pgno);
+ }
+ while( 1 ){
+ if( pc>iCellLast ){
+ /* Freeblock off the end of the page */
+ return SQLITE_CORRUPT_PGNO(pPage->pgno);
+ }
+ next = get2byte(&data[pc]);
+ size = get2byte(&data[pc+2]);
+ nFree = nFree + size;
+ if( next<=pc+size+3 ) break;
+ pc = next;
+ }
+ if( next>0 ){
+ /* Freeblock not in ascending order */
+ return SQLITE_CORRUPT_PGNO(pPage->pgno);
+ }
+ if( pc+size>(unsigned int)usableSize ){
+ /* Last freeblock extends past page end */
+ return SQLITE_CORRUPT_PGNO(pPage->pgno);
}
- pPage->nFree = (u16)(nFree - iCellFirst);
- pPage->isInit = 1;
}
+
+ /* At this point, nFree contains the sum of the offset to the start
+ ** of the cell-content area plus the number of free bytes within
+ ** the cell-content area. If this is greater than the usable-size
+ ** of the page, then the page must be corrupted. This check also
+ ** serves to verify that the offset to the start of the cell-content
+ ** area, according to the page header, lies within the page.
+ */
+ if( nFree>usableSize ){
+ return SQLITE_CORRUPT_PGNO(pPage->pgno);
+ }
+ pPage->nFree = (u16)(nFree - iCellFirst);
+ pPage->isInit = 1;
return SQLITE_OK;
}
@@ -60961,7 +61622,7 @@ static void zeroPage(MemPage *pPage, int flags){
assert( sqlite3PagerGetData(pPage->pDbPage) == data );
assert( sqlite3PagerIswriteable(pPage->pDbPage) );
assert( sqlite3_mutex_held(pBt->mutex) );
- if( pBt->btsFlags & BTS_SECURE_DELETE ){
+ if( pBt->btsFlags & BTS_FAST_SECURE ){
memset(&data[hdr], 0, pBt->usableSize - hdr);
}
data[hdr] = (char)flags;
@@ -61052,7 +61713,7 @@ static Pgno btreePagecount(BtShared *pBt){
}
SQLITE_PRIVATE u32 sqlite3BtreeLastPage(Btree *p){
assert( sqlite3BtreeHoldsMutex(p) );
- assert( ((p->pBt->nPage)&0x8000000)==0 );
+ assert( ((p->pBt->nPage)&0x80000000)==0 );
return btreePagecount(p->pBt);
}
@@ -61079,7 +61740,7 @@ static int getAndInitPage(
int rc;
DbPage *pDbPage;
assert( sqlite3_mutex_held(pBt->mutex) );
- assert( pCur==0 || ppPage==&pCur->apPage[pCur->iPage] );
+ assert( pCur==0 || ppPage==&pCur->pPage );
assert( pCur==0 || bReadOnly==pCur->curPagerFlags );
assert( pCur==0 || pCur->iPage>0 );
@@ -61106,14 +61767,17 @@ static int getAndInitPage(
/* If obtaining a child page for a cursor, we must verify that the page is
** compatible with the root page. */
if( pCur && ((*ppPage)->nCell<1 || (*ppPage)->intKey!=pCur->curIntKey) ){
- rc = SQLITE_CORRUPT_BKPT;
+ rc = SQLITE_CORRUPT_PGNO(pgno);
releasePage(*ppPage);
goto getAndInitPage_error;
}
return SQLITE_OK;
getAndInitPage_error:
- if( pCur ) pCur->iPage--;
+ if( pCur ){
+ pCur->iPage--;
+ pCur->pPage = pCur->apPage[pCur->iPage];
+ }
testcase( pgno==0 );
assert( pgno!=0 || rc==SQLITE_CORRUPT );
return rc;
@@ -61122,6 +61786,8 @@ getAndInitPage_error:
/*
** Release a MemPage. This should be called once for each prior
** call to btreeGetPage.
+**
+** Page1 is a special case and must be released using releasePageOne().
*/
static void releasePageNotNull(MemPage *pPage){
assert( pPage->aData );
@@ -61135,6 +61801,16 @@ static void releasePageNotNull(MemPage *pPage){
static void releasePage(MemPage *pPage){
if( pPage ) releasePageNotNull(pPage);
}
+static void releasePageOne(MemPage *pPage){
+ assert( pPage!=0 );
+ assert( pPage->aData );
+ assert( pPage->pBt );
+ assert( pPage->pDbPage!=0 );
+ assert( sqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage );
+ assert( sqlite3PagerGetData(pPage->pDbPage)==pPage->aData );
+ assert( sqlite3_mutex_held(pPage->pBt->mutex) );
+ sqlite3PagerUnrefPageOne(pPage->pDbPage);
+}
/*
** Get an unused page.
@@ -61384,8 +62060,10 @@ SQLITE_PRIVATE int sqlite3BtreeOpen(
pBt->pCursor = 0;
pBt->pPage1 = 0;
if( sqlite3PagerIsreadonly(pBt->pPager) ) pBt->btsFlags |= BTS_READ_ONLY;
-#ifdef SQLITE_SECURE_DELETE
+#if defined(SQLITE_SECURE_DELETE)
pBt->btsFlags |= BTS_SECURE_DELETE;
+#elif defined(SQLITE_FAST_SECURE_DELETE)
+ pBt->btsFlags |= BTS_OVERWRITE;
#endif
/* EVIDENCE-OF: R-51873-39618 The page size for a database file is
** determined by the 2-byte integer located at an offset of 16 bytes from
@@ -61833,19 +62511,34 @@ SQLITE_PRIVATE int sqlite3BtreeMaxPageCount(Btree *p, int mxPage){
}
/*
-** Set the BTS_SECURE_DELETE flag if newFlag is 0 or 1. If newFlag is -1,
-** then make no changes. Always return the value of the BTS_SECURE_DELETE
-** setting after the change.
+** Change the values for the BTS_SECURE_DELETE and BTS_OVERWRITE flags:
+**
+** newFlag==0 Both BTS_SECURE_DELETE and BTS_OVERWRITE are cleared
+** newFlag==1 BTS_SECURE_DELETE set and BTS_OVERWRITE is cleared
+** newFlag==2 BTS_SECURE_DELETE cleared and BTS_OVERWRITE is set
+** newFlag==(-1) No changes
+**
+** This routine acts as a query if newFlag is less than zero
+**
+** With BTS_OVERWRITE set, deleted content is overwritten by zeros, but
+** freelist leaf pages are not written back to the database. Thus in-page
+** deleted content is cleared, but freelist deleted content is not.
+**
+** With BTS_SECURE_DELETE, operation is like BTS_OVERWRITE with the addition
+** that freelist leaf pages are written back into the database, increasing
+** the amount of disk I/O.
*/
SQLITE_PRIVATE int sqlite3BtreeSecureDelete(Btree *p, int newFlag){
int b;
if( p==0 ) return 0;
sqlite3BtreeEnter(p);
+ assert( BTS_OVERWRITE==BTS_SECURE_DELETE*2 );
+ assert( BTS_FAST_SECURE==(BTS_OVERWRITE|BTS_SECURE_DELETE) );
if( newFlag>=0 ){
- p->pBt->btsFlags &= ~BTS_SECURE_DELETE;
- if( newFlag ) p->pBt->btsFlags |= BTS_SECURE_DELETE;
- }
- b = (p->pBt->btsFlags & BTS_SECURE_DELETE)!=0;
+ p->pBt->btsFlags &= ~BTS_FAST_SECURE;
+ p->pBt->btsFlags |= BTS_SECURE_DELETE*newFlag;
+ }
+ b = (p->pBt->btsFlags & BTS_FAST_SECURE)/BTS_SECURE_DELETE;
sqlite3BtreeLeave(p);
return b;
}
@@ -61902,7 +62595,8 @@ SQLITE_PRIVATE int sqlite3BtreeGetAutoVacuum(Btree *p){
** set to the value passed to this function as the second parameter,
** set it so.
*/
-#if SQLITE_DEFAULT_SYNCHRONOUS!=SQLITE_DEFAULT_WAL_SYNCHRONOUS
+#if SQLITE_DEFAULT_SYNCHRONOUS!=SQLITE_DEFAULT_WAL_SYNCHRONOUS \
+ && !defined(SQLITE_OMIT_WAL)
static void setDefaultSyncFlag(BtShared *pBt, u8 safety_level){
sqlite3 *db;
Db *pDb;
@@ -61996,7 +62690,7 @@ static int lockBtree(BtShared *pBt){
}else{
setDefaultSyncFlag(pBt, SQLITE_DEFAULT_WAL_SYNCHRONOUS+1);
if( isOpen==0 ){
- releasePage(pPage1);
+ releasePageOne(pPage1);
return SQLITE_OK;
}
}
@@ -62043,7 +62737,7 @@ static int lockBtree(BtShared *pBt){
** zero and return SQLITE_OK. The caller will call this function
** again with the correct page-size.
*/
- releasePage(pPage1);
+ releasePageOne(pPage1);
pBt->usableSize = usableSize;
pBt->pageSize = pageSize;
freeTempSpace(pBt);
@@ -62051,7 +62745,7 @@ static int lockBtree(BtShared *pBt){
pageSize-usableSize);
return rc;
}
- if( (pBt->db->flags & SQLITE_RecoveryMode)==0 && nPage>nPageFile ){
+ if( (pBt->db->flags & SQLITE_WriteSchema)==0 && nPage>nPageFile ){
rc = SQLITE_CORRUPT_BKPT;
goto page1_init_failed;
}
@@ -62097,7 +62791,7 @@ static int lockBtree(BtShared *pBt){
return SQLITE_OK;
page1_init_failed:
- releasePage(pPage1);
+ releasePageOne(pPage1);
pBt->pPage1 = 0;
return rc;
}
@@ -62142,7 +62836,7 @@ static void unlockBtreeIfUnused(BtShared *pBt){
assert( pPage1->aData );
assert( sqlite3PagerRefcount(pBt->pPager)==1 );
pBt->pPage1 = 0;
- releasePageNotNull(pPage1);
+ releasePageOne(pPage1);
}
}
@@ -62394,7 +63088,7 @@ static int setChildPtrmaps(MemPage *pPage){
Pgno pgno = pPage->pgno;
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
- rc = btreeInitPage(pPage);
+ rc = pPage->isInit ? SQLITE_OK : btreeInitPage(pPage);
if( rc!=SQLITE_OK ) return rc;
nCell = pPage->nCell;
@@ -62437,7 +63131,7 @@ static int modifyPagePointer(MemPage *pPage, Pgno iFrom, Pgno iTo, u8 eType){
if( eType==PTRMAP_OVERFLOW2 ){
/* The pointer is always the first 4 bytes of the page in this case. */
if( get4byte(pPage->aData)!=iFrom ){
- return SQLITE_CORRUPT_BKPT;
+ return SQLITE_CORRUPT_PGNO(pPage->pgno);
}
put4byte(pPage->aData, iTo);
}else{
@@ -62445,7 +63139,7 @@ static int modifyPagePointer(MemPage *pPage, Pgno iFrom, Pgno iTo, u8 eType){
int nCell;
int rc;
- rc = btreeInitPage(pPage);
+ rc = pPage->isInit ? SQLITE_OK : btreeInitPage(pPage);
if( rc ) return rc;
nCell = pPage->nCell;
@@ -62456,7 +63150,7 @@ static int modifyPagePointer(MemPage *pPage, Pgno iFrom, Pgno iTo, u8 eType){
pPage->xParseCell(pPage, pCell, &info);
if( info.nLocal<info.nPayload ){
if( pCell+info.nSize > pPage->aData+pPage->pBt->usableSize ){
- return SQLITE_CORRUPT_BKPT;
+ return SQLITE_CORRUPT_PGNO(pPage->pgno);
}
if( iFrom==get4byte(pCell+info.nSize-4) ){
put4byte(pCell+info.nSize-4, iTo);
@@ -62474,7 +63168,7 @@ static int modifyPagePointer(MemPage *pPage, Pgno iFrom, Pgno iTo, u8 eType){
if( i==nCell ){
if( eType!=PTRMAP_BTREE ||
get4byte(&pPage->aData[pPage->hdrOffset+8])!=iFrom ){
- return SQLITE_CORRUPT_BKPT;
+ return SQLITE_CORRUPT_PGNO(pPage->pgno);
}
put4byte(&pPage->aData[pPage->hdrOffset+8], iTo);
}
@@ -62994,7 +63688,6 @@ SQLITE_PRIVATE int sqlite3BtreeTripAllCursors(Btree *pBtree, int errCode, int wr
if( pBtree ){
sqlite3BtreeEnter(pBtree);
for(p=pBtree->pBt->pCursor; p; p=p->pNext){
- int i;
if( writeOnly && (p->curFlags & BTCF_WriteFlag)==0 ){
if( p->eState==CURSOR_VALID || p->eState==CURSOR_SKIPNEXT ){
rc = saveCursorPosition(p);
@@ -63008,10 +63701,7 @@ SQLITE_PRIVATE int sqlite3BtreeTripAllCursors(Btree *pBtree, int errCode, int wr
p->eState = CURSOR_FAULT;
p->skipNext = errCode;
}
- for(i=0; i<=p->iPage; i++){
- releasePage(p->apPage[i]);
- p->apPage[i] = 0;
- }
+ btreeReleaseAllCursorPages(p);
}
sqlite3BtreeLeave(pBtree);
}
@@ -63068,7 +63758,7 @@ SQLITE_PRIVATE int sqlite3BtreeRollback(Btree *p, int tripCode, int writeOnly){
if( nPage==0 ) sqlite3PagerPagecount(pBt->pPager, &nPage);
testcase( pBt->nPage!=nPage );
pBt->nPage = nPage;
- releasePage(pPage1);
+ releasePageOne(pPage1);
}
assert( countValidCursors(pBt, 1)==0 );
pBt->inTransaction = TRANS_READ;
@@ -63310,10 +64000,8 @@ SQLITE_PRIVATE void sqlite3BtreeCursorZero(BtCursor *p){
SQLITE_PRIVATE int sqlite3BtreeCloseCursor(BtCursor *pCur){
Btree *pBtree = pCur->pBtree;
if( pBtree ){
- int i;
BtShared *pBt = pCur->pBt;
sqlite3BtreeEnter(pBtree);
- sqlite3BtreeClearCursor(pCur);
assert( pBt->pCursor!=0 );
if( pBt->pCursor==pCur ){
pBt->pCursor = pCur->pNext;
@@ -63327,12 +64015,10 @@ SQLITE_PRIVATE int sqlite3BtreeCloseCursor(BtCursor *pCur){
pPrev = pPrev->pNext;
}while( ALWAYS(pPrev) );
}
- for(i=0; i<=pCur->iPage; i++){
- releasePage(pCur->apPage[i]);
- }
+ btreeReleaseAllCursorPages(pCur);
unlockBtreeIfUnused(pBt);
sqlite3_free(pCur->aOverflow);
- /* sqlite3_free(pCur); */
+ sqlite3_free(pCur->pKey);
sqlite3BtreeLeave(pBtree);
}
return SQLITE_OK;
@@ -63349,9 +64035,8 @@ SQLITE_PRIVATE int sqlite3BtreeCloseCursor(BtCursor *pCur){
#ifndef NDEBUG
static void assertCellInfo(BtCursor *pCur){
CellInfo info;
- int iPage = pCur->iPage;
memset(&info, 0, sizeof(info));
- btreeParseCell(pCur->apPage[iPage], pCur->ix, &info);
+ btreeParseCell(pCur->pPage, pCur->ix, &info);
assert( CORRUPT_DB || memcmp(&info, &pCur->info, sizeof(info))==0 );
}
#else
@@ -63359,9 +64044,8 @@ SQLITE_PRIVATE int sqlite3BtreeCloseCursor(BtCursor *pCur){
#endif
static SQLITE_NOINLINE void getCellInfo(BtCursor *pCur){
if( pCur->info.nSize==0 ){
- int iPage = pCur->iPage;
pCur->curFlags |= BTCF_ValidNKey;
- btreeParseCell(pCur->apPage[iPage],pCur->ix,&pCur->info);
+ btreeParseCell(pCur->pPage,pCur->ix,&pCur->info);
}else{
assertCellInfo(pCur);
}
@@ -63559,7 +64243,7 @@ static int accessPayload(
unsigned char *aPayload;
int rc = SQLITE_OK;
int iIdx = 0;
- MemPage *pPage = pCur->apPage[pCur->iPage]; /* Btree page of current entry */
+ MemPage *pPage = pCur->pPage; /* Btree page of current entry */
BtShared *pBt = pCur->pBt; /* Btree this cursor belongs to */
#ifdef SQLITE_DIRECT_OVERFLOW_READ
unsigned char * const pBufStart = pBuf; /* Start of original out buffer */
@@ -63582,7 +64266,7 @@ static int accessPayload(
** &aPayload[pCur->info.nLocal] > &pPage->aData[pBt->usableSize]
** but is recast into its current form to avoid integer overflow problems
*/
- return SQLITE_CORRUPT_BKPT;
+ return SQLITE_CORRUPT_PGNO(pPage->pgno);
}
/* Check if data must be read/written to/from the btree page itself. */
@@ -63729,7 +64413,8 @@ static int accessPayload(
}
if( rc==SQLITE_OK && amt>0 ){
- return SQLITE_CORRUPT_BKPT; /* Overflow chain ends prematurely */
+ /* Overflow chain ends prematurely */
+ return SQLITE_CORRUPT_PGNO(pPage->pgno);
}
return rc;
}
@@ -63754,8 +64439,8 @@ static int accessPayload(
SQLITE_PRIVATE int sqlite3BtreePayload(BtCursor *pCur, u32 offset, u32 amt, void *pBuf){
assert( cursorHoldsMutex(pCur) );
assert( pCur->eState==CURSOR_VALID );
- assert( pCur->iPage>=0 && pCur->apPage[pCur->iPage] );
- assert( pCur->ix<pCur->apPage[pCur->iPage]->nCell );
+ assert( pCur->iPage>=0 && pCur->pPage );
+ assert( pCur->ix<pCur->pPage->nCell );
return accessPayload(pCur, offset, amt, (unsigned char*)pBuf, 0);
}
@@ -63812,18 +64497,23 @@ static const void *fetchPayload(
BtCursor *pCur, /* Cursor pointing to entry to read from */
u32 *pAmt /* Write the number of available bytes here */
){
- u32 amt;
- assert( pCur!=0 && pCur->iPage>=0 && pCur->apPage[pCur->iPage]);
+ int amt;
+ assert( pCur!=0 && pCur->iPage>=0 && pCur->pPage);
assert( pCur->eState==CURSOR_VALID );
assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
assert( cursorOwnsBtShared(pCur) );
- assert( pCur->ix<pCur->apPage[pCur->iPage]->nCell );
+ assert( pCur->ix<pCur->pPage->nCell );
assert( pCur->info.nSize>0 );
- assert( pCur->info.pPayload>pCur->apPage[pCur->iPage]->aData || CORRUPT_DB );
- assert( pCur->info.pPayload<pCur->apPage[pCur->iPage]->aDataEnd ||CORRUPT_DB);
- amt = (int)(pCur->apPage[pCur->iPage]->aDataEnd - pCur->info.pPayload);
- if( pCur->info.nLocal<amt ) amt = pCur->info.nLocal;
- *pAmt = amt;
+ assert( pCur->info.pPayload>pCur->pPage->aData || CORRUPT_DB );
+ assert( pCur->info.pPayload<pCur->pPage->aDataEnd ||CORRUPT_DB);
+ amt = pCur->info.nLocal;
+ if( amt>(int)(pCur->pPage->aDataEnd - pCur->info.pPayload) ){
+ /* There is too little space on the page for the expected amount
+ ** of local content. Database must be corrupt. */
+ assert( CORRUPT_DB );
+ amt = MAX(0, (int)(pCur->pPage->aDataEnd - pCur->info.pPayload));
+ }
+ *pAmt = (u32)amt;
return (void*)pCur->info.pPayload;
}
@@ -63868,10 +64558,11 @@ static int moveToChild(BtCursor *pCur, u32 newPgno){
}
pCur->info.nSize = 0;
pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl);
- pCur->aiIdx[pCur->iPage++] = pCur->ix;
+ pCur->aiIdx[pCur->iPage] = pCur->ix;
+ pCur->apPage[pCur->iPage] = pCur->pPage;
pCur->ix = 0;
- return getAndInitPage(pBt, newPgno, &pCur->apPage[pCur->iPage],
- pCur, pCur->curPagerFlags);
+ pCur->iPage++;
+ return getAndInitPage(pBt, newPgno, &pCur->pPage, pCur, pCur->curPagerFlags);
}
#ifdef SQLITE_DEBUG
@@ -63905,20 +64596,23 @@ static void assertParentIndex(MemPage *pParent, int iIdx, Pgno iChild){
** the largest cell index.
*/
static void moveToParent(BtCursor *pCur){
+ MemPage *pLeaf;
assert( cursorOwnsBtShared(pCur) );
assert( pCur->eState==CURSOR_VALID );
assert( pCur->iPage>0 );
- assert( pCur->apPage[pCur->iPage] );
+ assert( pCur->pPage );
assertParentIndex(
pCur->apPage[pCur->iPage-1],
pCur->aiIdx[pCur->iPage-1],
- pCur->apPage[pCur->iPage]->pgno
+ pCur->pPage->pgno
);
testcase( pCur->aiIdx[pCur->iPage-1] > pCur->apPage[pCur->iPage-1]->nCell );
pCur->info.nSize = 0;
pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl);
pCur->ix = pCur->aiIdx[pCur->iPage-1];
- releasePageNotNull(pCur->apPage[pCur->iPage--]);
+ pLeaf = pCur->pPage;
+ pCur->pPage = pCur->apPage[--pCur->iPage];
+ releasePageNotNull(pLeaf);
}
/*
@@ -63930,9 +64624,9 @@ static void moveToParent(BtCursor *pCur){
** single child page. This can only happen with the table rooted at page 1.
**
** If the b-tree structure is empty, the cursor state is set to
-** CURSOR_INVALID. Otherwise, the cursor is set to point to the first
-** cell located on the root (or virtual root) page and the cursor state
-** is set to CURSOR_VALID.
+** CURSOR_INVALID and this routine returns SQLITE_EMPTY. Otherwise,
+** the cursor is set to point to the first cell located on the root
+** (or virtual root) page and the cursor state is set to CURSOR_VALID.
**
** If this function returns successfully, it may be assumed that the
** page-header flags indicate that the [virtual] root-page is the expected
@@ -63950,37 +64644,40 @@ static int moveToRoot(BtCursor *pCur){
assert( CURSOR_INVALID < CURSOR_REQUIRESEEK );
assert( CURSOR_VALID < CURSOR_REQUIRESEEK );
assert( CURSOR_FAULT > CURSOR_REQUIRESEEK );
- if( pCur->eState>=CURSOR_REQUIRESEEK ){
- if( pCur->eState==CURSOR_FAULT ){
- assert( pCur->skipNext!=SQLITE_OK );
- return pCur->skipNext;
- }
- sqlite3BtreeClearCursor(pCur);
- }
+ assert( pCur->eState < CURSOR_REQUIRESEEK || pCur->iPage<0 );
+ assert( pCur->pgnoRoot>0 || pCur->iPage<0 );
if( pCur->iPage>=0 ){
if( pCur->iPage ){
- do{
- assert( pCur->apPage[pCur->iPage]!=0 );
- releasePageNotNull(pCur->apPage[pCur->iPage--]);
- }while( pCur->iPage);
+ releasePageNotNull(pCur->pPage);
+ while( --pCur->iPage ){
+ releasePageNotNull(pCur->apPage[pCur->iPage]);
+ }
+ pCur->pPage = pCur->apPage[0];
goto skip_init;
}
}else if( pCur->pgnoRoot==0 ){
pCur->eState = CURSOR_INVALID;
- return SQLITE_OK;
+ return SQLITE_EMPTY;
}else{
assert( pCur->iPage==(-1) );
- rc = getAndInitPage(pCur->pBtree->pBt, pCur->pgnoRoot, &pCur->apPage[0],
+ if( pCur->eState>=CURSOR_REQUIRESEEK ){
+ if( pCur->eState==CURSOR_FAULT ){
+ assert( pCur->skipNext!=SQLITE_OK );
+ return pCur->skipNext;
+ }
+ sqlite3BtreeClearCursor(pCur);
+ }
+ rc = getAndInitPage(pCur->pBtree->pBt, pCur->pgnoRoot, &pCur->pPage,
0, pCur->curPagerFlags);
if( rc!=SQLITE_OK ){
pCur->eState = CURSOR_INVALID;
- return rc;
+ return rc;
}
pCur->iPage = 0;
- pCur->curIntKey = pCur->apPage[0]->intKey;
+ pCur->curIntKey = pCur->pPage->intKey;
}
- pRoot = pCur->apPage[0];
+ pRoot = pCur->pPage;
assert( pRoot->pgno==pCur->pgnoRoot );
/* If pCur->pKeyInfo is not NULL, then the caller that opened this cursor
@@ -63995,7 +64692,7 @@ static int moveToRoot(BtCursor *pCur){
** (or the freelist). */
assert( pRoot->intKey==1 || pRoot->intKey==0 );
if( pRoot->isInit==0 || (pCur->pKeyInfo==0)!=pRoot->intKey ){
- return SQLITE_CORRUPT_BKPT;
+ return SQLITE_CORRUPT_PGNO(pCur->pPage->pgno);
}
skip_init:
@@ -64003,7 +64700,7 @@ skip_init:
pCur->info.nSize = 0;
pCur->curFlags &= ~(BTCF_AtLast|BTCF_ValidNKey|BTCF_ValidOvfl);
- pRoot = pCur->apPage[0];
+ pRoot = pCur->pPage;
if( pRoot->nCell>0 ){
pCur->eState = CURSOR_VALID;
}else if( !pRoot->leaf ){
@@ -64014,6 +64711,7 @@ skip_init:
rc = moveToChild(pCur, subpage);
}else{
pCur->eState = CURSOR_INVALID;
+ rc = SQLITE_EMPTY;
}
return rc;
}
@@ -64032,7 +64730,7 @@ static int moveToLeftmost(BtCursor *pCur){
assert( cursorOwnsBtShared(pCur) );
assert( pCur->eState==CURSOR_VALID );
- while( rc==SQLITE_OK && !(pPage = pCur->apPage[pCur->iPage])->leaf ){
+ while( rc==SQLITE_OK && !(pPage = pCur->pPage)->leaf ){
assert( pCur->ix<pPage->nCell );
pgno = get4byte(findCell(pPage, pCur->ix));
rc = moveToChild(pCur, pgno);
@@ -64057,7 +64755,7 @@ static int moveToRightmost(BtCursor *pCur){
assert( cursorOwnsBtShared(pCur) );
assert( pCur->eState==CURSOR_VALID );
- while( !(pPage = pCur->apPage[pCur->iPage])->leaf ){
+ while( !(pPage = pCur->pPage)->leaf ){
pgno = get4byte(&pPage->aData[pPage->hdrOffset+8]);
pCur->ix = pPage->nCell;
rc = moveToChild(pCur, pgno);
@@ -64080,14 +64778,13 @@ SQLITE_PRIVATE int sqlite3BtreeFirst(BtCursor *pCur, int *pRes){
assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) );
rc = moveToRoot(pCur);
if( rc==SQLITE_OK ){
- if( pCur->eState==CURSOR_INVALID ){
- assert( pCur->pgnoRoot==0 || pCur->apPage[pCur->iPage]->nCell==0 );
- *pRes = 1;
- }else{
- assert( pCur->apPage[pCur->iPage]->nCell>0 );
- *pRes = 0;
- rc = moveToLeftmost(pCur);
- }
+ assert( pCur->pPage->nCell>0 );
+ *pRes = 0;
+ rc = moveToLeftmost(pCur);
+ }else if( rc==SQLITE_EMPTY ){
+ assert( pCur->pgnoRoot==0 || pCur->pPage->nCell==0 );
+ *pRes = 1;
+ rc = SQLITE_OK;
}
return rc;
}
@@ -64111,28 +64808,26 @@ SQLITE_PRIVATE int sqlite3BtreeLast(BtCursor *pCur, int *pRes){
for(ii=0; ii<pCur->iPage; ii++){
assert( pCur->aiIdx[ii]==pCur->apPage[ii]->nCell );
}
- assert( pCur->ix==pCur->apPage[pCur->iPage]->nCell-1 );
- assert( pCur->apPage[pCur->iPage]->leaf );
+ assert( pCur->ix==pCur->pPage->nCell-1 );
+ assert( pCur->pPage->leaf );
#endif
return SQLITE_OK;
}
rc = moveToRoot(pCur);
if( rc==SQLITE_OK ){
- if( CURSOR_INVALID==pCur->eState ){
- assert( pCur->pgnoRoot==0 || pCur->apPage[pCur->iPage]->nCell==0 );
- *pRes = 1;
+ assert( pCur->eState==CURSOR_VALID );
+ *pRes = 0;
+ rc = moveToRightmost(pCur);
+ if( rc==SQLITE_OK ){
+ pCur->curFlags |= BTCF_AtLast;
}else{
- assert( pCur->eState==CURSOR_VALID );
- *pRes = 0;
- rc = moveToRightmost(pCur);
- if( rc==SQLITE_OK ){
- pCur->curFlags |= BTCF_AtLast;
- }else{
- pCur->curFlags &= ~BTCF_AtLast;
- }
-
+ pCur->curFlags &= ~BTCF_AtLast;
}
+ }else if( rc==SQLITE_EMPTY ){
+ assert( pCur->pgnoRoot==0 || pCur->pPage->nCell==0 );
+ *pRes = 1;
+ rc = SQLITE_OK;
}
return rc;
}
@@ -64200,16 +64895,19 @@ SQLITE_PRIVATE int sqlite3BtreeMovetoUnpacked(
/* If the requested key is one more than the previous key, then
** try to get there using sqlite3BtreeNext() rather than a full
** binary search. This is an optimization only. The correct answer
- ** is still obtained without this ase, only a little more slowely */
+ ** is still obtained without this case, only a little more slowely */
if( pCur->info.nKey+1==intKey && !pCur->skipNext ){
*pRes = 0;
- rc = sqlite3BtreeNext(pCur, pRes);
- if( rc ) return rc;
- if( *pRes==0 ){
+ rc = sqlite3BtreeNext(pCur, 0);
+ if( rc==SQLITE_OK ){
getCellInfo(pCur);
if( pCur->info.nKey==intKey ){
return SQLITE_OK;
}
+ }else if( rc==SQLITE_DONE ){
+ rc = SQLITE_OK;
+ }else{
+ return rc;
}
}
}
@@ -64228,22 +64926,23 @@ SQLITE_PRIVATE int sqlite3BtreeMovetoUnpacked(
rc = moveToRoot(pCur);
if( rc ){
+ if( rc==SQLITE_EMPTY ){
+ assert( pCur->pgnoRoot==0 || pCur->pPage->nCell==0 );
+ *pRes = -1;
+ return SQLITE_OK;
+ }
return rc;
}
- assert( pCur->pgnoRoot==0 || pCur->apPage[pCur->iPage] );
- assert( pCur->pgnoRoot==0 || pCur->apPage[pCur->iPage]->isInit );
- assert( pCur->eState==CURSOR_INVALID || pCur->apPage[pCur->iPage]->nCell>0 );
- if( pCur->eState==CURSOR_INVALID ){
- *pRes = -1;
- assert( pCur->pgnoRoot==0 || pCur->apPage[pCur->iPage]->nCell==0 );
- return SQLITE_OK;
- }
- assert( pCur->apPage[0]->intKey==pCur->curIntKey );
+ assert( pCur->pPage );
+ assert( pCur->pPage->isInit );
+ assert( pCur->eState==CURSOR_VALID );
+ assert( pCur->pPage->nCell > 0 );
+ assert( pCur->iPage==0 || pCur->apPage[0]->intKey==pCur->curIntKey );
assert( pCur->curIntKey || pIdxKey );
for(;;){
int lwr, upr, idx, c;
Pgno chldPg;
- MemPage *pPage = pCur->apPage[pCur->iPage];
+ MemPage *pPage = pCur->pPage;
u8 *pCell; /* Pointer to current cell in pPage */
/* pPage->nCell must be greater than zero. If this is the root-page
@@ -64265,7 +64964,9 @@ SQLITE_PRIVATE int sqlite3BtreeMovetoUnpacked(
pCell = findCellPastPtr(pPage, idx);
if( pPage->intKeyLeaf ){
while( 0x80 <= *(pCell++) ){
- if( pCell>=pPage->aDataEnd ) return SQLITE_CORRUPT_BKPT;
+ if( pCell>=pPage->aDataEnd ){
+ return SQLITE_CORRUPT_PGNO(pPage->pgno);
+ }
}
}
getVarint(pCell, (u64*)&nCellKey);
@@ -64338,7 +65039,7 @@ SQLITE_PRIVATE int sqlite3BtreeMovetoUnpacked(
testcase( nCell==1 ); /* Invalid key size: 0x80 0x80 0x01 */
testcase( nCell==2 ); /* Minimum legal index key size */
if( nCell<2 ){
- rc = SQLITE_CORRUPT_BKPT;
+ rc = SQLITE_CORRUPT_PGNO(pPage->pgno);
goto moveto_finish;
}
pCellKey = sqlite3Malloc( nCell+18 );
@@ -64369,7 +65070,7 @@ SQLITE_PRIVATE int sqlite3BtreeMovetoUnpacked(
*pRes = 0;
rc = SQLITE_OK;
pCur->ix = (u16)idx;
- if( pIdxKey->errCode ) rc = SQLITE_CORRUPT;
+ if( pIdxKey->errCode ) rc = SQLITE_CORRUPT_BKPT;
goto moveto_finish;
}
if( lwr>upr ) break;
@@ -64380,7 +65081,7 @@ SQLITE_PRIVATE int sqlite3BtreeMovetoUnpacked(
assert( lwr==upr+1 || (pPage->intKey && !pPage->leaf) );
assert( pPage->isInit );
if( pPage->leaf ){
- assert( pCur->ix<pCur->apPage[pCur->iPage]->nCell );
+ assert( pCur->ix<pCur->pPage->nCell );
pCur->ix = (u16)idx;
*pRes = c;
rc = SQLITE_OK;
@@ -64434,19 +65135,22 @@ SQLITE_PRIVATE i64 sqlite3BtreeRowCountEst(BtCursor *pCur){
** opcode, and it that case the cursor will always be valid and
** will always point to a leaf node. */
if( NEVER(pCur->eState!=CURSOR_VALID) ) return -1;
- if( NEVER(pCur->apPage[pCur->iPage]->leaf==0) ) return -1;
+ if( NEVER(pCur->pPage->leaf==0) ) return -1;
- for(n=1, i=0; i<=pCur->iPage; i++){
+ n = pCur->pPage->nCell;
+ for(i=0; i<pCur->iPage; i++){
n *= pCur->apPage[i]->nCell;
}
return n;
}
/*
-** Advance the cursor to the next entry in the database. If
-** successful then set *pRes=0. If the cursor
-** was already pointing to the last entry in the database before
-** this routine was called, then set *pRes=1.
+** Advance the cursor to the next entry in the database.
+** Return value:
+**
+** SQLITE_OK success
+** SQLITE_DONE cursor is already pointing at the last element
+** otherwise some kind of error occurred
**
** The main entry point is sqlite3BtreeNext(). That routine is optimized
** for the common case of merely incrementing the cell counter BtCursor.aiIdx
@@ -64454,23 +65158,19 @@ SQLITE_PRIVATE i64 sqlite3BtreeRowCountEst(BtCursor *pCur){
** routine is called when it is necessary to move to a different page or
** to restore the cursor.
**
-** The calling function will set *pRes to 0 or 1. The initial *pRes value
-** will be 1 if the cursor being stepped corresponds to an SQL index and
-** if this routine could have been skipped if that SQL index had been
-** a unique index. Otherwise the caller will have set *pRes to zero.
-** Zero is the common case. The btree implementation is free to use the
-** initial *pRes value as a hint to improve performance, but the current
-** SQLite btree implementation does not. (Note that the comdb2 btree
-** implementation does use this hint, however.)
+** If bit 0x01 of the F argument in sqlite3BtreeNext(C,F) is 1, then the
+** cursor corresponds to an SQL index and this routine could have been
+** skipped if the SQL index had been a unique index. The F argument
+** is a hint to the implement. SQLite btree implementation does not use
+** this hint, but COMDB2 does.
*/
-static SQLITE_NOINLINE int btreeNext(BtCursor *pCur, int *pRes){
+static SQLITE_NOINLINE int btreeNext(BtCursor *pCur){
int rc;
int idx;
MemPage *pPage;
assert( cursorOwnsBtShared(pCur) );
assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );
- assert( *pRes==0 );
if( pCur->eState!=CURSOR_VALID ){
assert( (pCur->curFlags & BTCF_ValidOvfl)==0 );
rc = restoreCursorPosition(pCur);
@@ -64478,8 +65178,7 @@ static SQLITE_NOINLINE int btreeNext(BtCursor *pCur, int *pRes){
return rc;
}
if( CURSOR_INVALID==pCur->eState ){
- *pRes = 1;
- return SQLITE_OK;
+ return SQLITE_DONE;
}
if( pCur->skipNext ){
assert( pCur->eState==CURSOR_VALID || pCur->eState==CURSOR_SKIPNEXT );
@@ -64492,7 +65191,7 @@ static SQLITE_NOINLINE int btreeNext(BtCursor *pCur, int *pRes){
}
}
- pPage = pCur->apPage[pCur->iPage];
+ pPage = pCur->pPage;
idx = ++pCur->ix;
assert( pPage->isInit );
@@ -64511,15 +65210,14 @@ static SQLITE_NOINLINE int btreeNext(BtCursor *pCur, int *pRes){
}
do{
if( pCur->iPage==0 ){
- *pRes = 1;
pCur->eState = CURSOR_INVALID;
- return SQLITE_OK;
+ return SQLITE_DONE;
}
moveToParent(pCur);
- pPage = pCur->apPage[pCur->iPage];
+ pPage = pCur->pPage;
}while( pCur->ix>=pPage->nCell );
if( pPage->intKey ){
- return sqlite3BtreeNext(pCur, pRes);
+ return sqlite3BtreeNext(pCur, 0);
}else{
return SQLITE_OK;
}
@@ -64530,20 +65228,19 @@ static SQLITE_NOINLINE int btreeNext(BtCursor *pCur, int *pRes){
return moveToLeftmost(pCur);
}
}
-SQLITE_PRIVATE int sqlite3BtreeNext(BtCursor *pCur, int *pRes){
+SQLITE_PRIVATE int sqlite3BtreeNext(BtCursor *pCur, int flags){
MemPage *pPage;
+ UNUSED_PARAMETER( flags ); /* Used in COMDB2 but not native SQLite */
assert( cursorOwnsBtShared(pCur) );
- assert( pRes!=0 );
- assert( *pRes==0 || *pRes==1 );
+ assert( flags==0 || flags==1 );
assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );
pCur->info.nSize = 0;
pCur->curFlags &= ~(BTCF_ValidNKey|BTCF_ValidOvfl);
- *pRes = 0;
- if( pCur->eState!=CURSOR_VALID ) return btreeNext(pCur, pRes);
- pPage = pCur->apPage[pCur->iPage];
+ if( pCur->eState!=CURSOR_VALID ) return btreeNext(pCur);
+ pPage = pCur->pPage;
if( (++pCur->ix)>=pPage->nCell ){
pCur->ix--;
- return btreeNext(pCur, pRes);
+ return btreeNext(pCur);
}
if( pPage->leaf ){
return SQLITE_OK;
@@ -64553,10 +65250,12 @@ SQLITE_PRIVATE int sqlite3BtreeNext(BtCursor *pCur, int *pRes){
}
/*
-** Step the cursor to the back to the previous entry in the database. If
-** successful then set *pRes=0. If the cursor
-** was already pointing to the first entry in the database before
-** this routine was called, then set *pRes=1.
+** Step the cursor to the back to the previous entry in the database.
+** Return values:
+**
+** SQLITE_OK success
+** SQLITE_DONE the cursor is already on the first element of the table
+** otherwise some kind of error occurred
**
** The main entry point is sqlite3BtreePrevious(). That routine is optimized
** for the common case of merely decrementing the cell counter BtCursor.aiIdx
@@ -64564,22 +65263,17 @@ SQLITE_PRIVATE int sqlite3BtreeNext(BtCursor *pCur, int *pRes){
** helper routine is called when it is necessary to move to a different page
** or to restore the cursor.
**
-** The calling function will set *pRes to 0 or 1. The initial *pRes value
-** will be 1 if the cursor being stepped corresponds to an SQL index and
-** if this routine could have been skipped if that SQL index had been
-** a unique index. Otherwise the caller will have set *pRes to zero.
-** Zero is the common case. The btree implementation is free to use the
-** initial *pRes value as a hint to improve performance, but the current
-** SQLite btree implementation does not. (Note that the comdb2 btree
-** implementation does use this hint, however.)
+** If bit 0x01 of the F argument to sqlite3BtreePrevious(C,F) is 1, then
+** the cursor corresponds to an SQL index and this routine could have been
+** skipped if the SQL index had been a unique index. The F argument is a
+** hint to the implement. The native SQLite btree implementation does not
+** use this hint, but COMDB2 does.
*/
-static SQLITE_NOINLINE int btreePrevious(BtCursor *pCur, int *pRes){
+static SQLITE_NOINLINE int btreePrevious(BtCursor *pCur){
int rc;
MemPage *pPage;
assert( cursorOwnsBtShared(pCur) );
- assert( pRes!=0 );
- assert( *pRes==0 );
assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );
assert( (pCur->curFlags & (BTCF_AtLast|BTCF_ValidOvfl|BTCF_ValidNKey))==0 );
assert( pCur->info.nSize==0 );
@@ -64589,8 +65283,7 @@ static SQLITE_NOINLINE int btreePrevious(BtCursor *pCur, int *pRes){
return rc;
}
if( CURSOR_INVALID==pCur->eState ){
- *pRes = 1;
- return SQLITE_OK;
+ return SQLITE_DONE;
}
if( pCur->skipNext ){
assert( pCur->eState==CURSOR_VALID || pCur->eState==CURSOR_SKIPNEXT );
@@ -64603,7 +65296,7 @@ static SQLITE_NOINLINE int btreePrevious(BtCursor *pCur, int *pRes){
}
}
- pPage = pCur->apPage[pCur->iPage];
+ pPage = pCur->pPage;
assert( pPage->isInit );
if( !pPage->leaf ){
int idx = pCur->ix;
@@ -64614,8 +65307,7 @@ static SQLITE_NOINLINE int btreePrevious(BtCursor *pCur, int *pRes){
while( pCur->ix==0 ){
if( pCur->iPage==0 ){
pCur->eState = CURSOR_INVALID;
- *pRes = 1;
- return SQLITE_OK;
+ return SQLITE_DONE;
}
moveToParent(pCur);
}
@@ -64623,28 +65315,27 @@ static SQLITE_NOINLINE int btreePrevious(BtCursor *pCur, int *pRes){
assert( (pCur->curFlags & (BTCF_ValidOvfl))==0 );
pCur->ix--;
- pPage = pCur->apPage[pCur->iPage];
+ pPage = pCur->pPage;
if( pPage->intKey && !pPage->leaf ){
- rc = sqlite3BtreePrevious(pCur, pRes);
+ rc = sqlite3BtreePrevious(pCur, 0);
}else{
rc = SQLITE_OK;
}
}
return rc;
}
-SQLITE_PRIVATE int sqlite3BtreePrevious(BtCursor *pCur, int *pRes){
+SQLITE_PRIVATE int sqlite3BtreePrevious(BtCursor *pCur, int flags){
assert( cursorOwnsBtShared(pCur) );
- assert( pRes!=0 );
- assert( *pRes==0 || *pRes==1 );
+ assert( flags==0 || flags==1 );
assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID );
- *pRes = 0;
+ UNUSED_PARAMETER( flags ); /* Used in COMDB2 but not native SQLite */
pCur->curFlags &= ~(BTCF_AtLast|BTCF_ValidOvfl|BTCF_ValidNKey);
pCur->info.nSize = 0;
if( pCur->eState!=CURSOR_VALID
|| pCur->ix==0
- || pCur->apPage[pCur->iPage]->leaf==0
+ || pCur->pPage->leaf==0
){
- return btreePrevious(pCur, pRes);
+ return btreePrevious(pCur);
}
pCur->ix--;
return SQLITE_OK;
@@ -64752,7 +65443,7 @@ static int allocateBtreePage(
}
testcase( iTrunk==mxPage );
if( iTrunk>mxPage || nSearch++ > n ){
- rc = SQLITE_CORRUPT_BKPT;
+ rc = SQLITE_CORRUPT_PGNO(pPrevTrunk ? pPrevTrunk->pgno : 1);
}else{
rc = btreeGetUnusedPage(pBt, iTrunk, &pTrunk, 0);
}
@@ -64781,7 +65472,7 @@ static int allocateBtreePage(
TRACE(("ALLOCATE: %d trunk - %d free pages left\n", *pPgno, n-1));
}else if( k>(u32)(pBt->usableSize/4 - 2) ){
/* Value of k is out of range. Database corruption */
- rc = SQLITE_CORRUPT_BKPT;
+ rc = SQLITE_CORRUPT_PGNO(iTrunk);
goto end_allocate_page;
#ifndef SQLITE_OMIT_AUTOVACUUM
}else if( searchList
@@ -64815,7 +65506,7 @@ static int allocateBtreePage(
MemPage *pNewTrunk;
Pgno iNewTrunk = get4byte(&pTrunk->aData[8]);
if( iNewTrunk>mxPage ){
- rc = SQLITE_CORRUPT_BKPT;
+ rc = SQLITE_CORRUPT_PGNO(iTrunk);
goto end_allocate_page;
}
testcase( iNewTrunk==mxPage );
@@ -64880,7 +65571,7 @@ static int allocateBtreePage(
iPage = get4byte(&aData[8+closest*4]);
testcase( iPage==mxPage );
if( iPage>mxPage ){
- rc = SQLITE_CORRUPT_BKPT;
+ rc = SQLITE_CORRUPT_PGNO(iTrunk);
goto end_allocate_page;
}
testcase( iPage==mxPage );
@@ -65138,7 +65829,7 @@ static int clearCell(
unsigned char *pCell, /* First byte of the Cell */
CellInfo *pInfo /* Size information about the cell */
){
- BtShared *pBt = pPage->pBt;
+ BtShared *pBt;
Pgno ovflPgno;
int rc;
int nOvfl;
@@ -65150,9 +65841,11 @@ static int clearCell(
return SQLITE_OK; /* No overflow pages. Return without doing anything */
}
if( pCell+pInfo->nSize-1 > pPage->aData+pPage->maskPage ){
- return SQLITE_CORRUPT_BKPT; /* Cell extends past end of page */
+ /* Cell extends past end of page */
+ return SQLITE_CORRUPT_PGNO(pPage->pgno);
}
ovflPgno = get4byte(pCell + pInfo->nSize - 4);
+ pBt = pPage->pBt;
assert( pBt->usableSize > 4 );
ovflPageSize = pBt->usableSize - 4;
nOvfl = (pInfo->nPayload - pInfo->nLocal + ovflPageSize - 1)/ovflPageSize;
@@ -65220,21 +65913,20 @@ static int fillInCell(
){
int nPayload;
const u8 *pSrc;
- int nSrc, n, rc;
+ int nSrc, n, rc, mn;
int spaceLeft;
- MemPage *pOvfl = 0;
- MemPage *pToRelease = 0;
+ MemPage *pToRelease;
unsigned char *pPrior;
unsigned char *pPayload;
- BtShared *pBt = pPage->pBt;
- Pgno pgnoOvfl = 0;
+ BtShared *pBt;
+ Pgno pgnoOvfl;
int nHeader;
assert( sqlite3_mutex_held(pPage->pBt->mutex) );
/* pPage is not necessarily writeable since pCell might be auxiliary
** buffer space that is separate from the pPage buffer area */
- assert( pCell<pPage->aData || pCell>=&pPage->aData[pBt->pageSize]
+ assert( pCell<pPage->aData || pCell>=&pPage->aData[pPage->pBt->pageSize]
|| sqlite3PagerIswriteable(pPage->pDbPage) );
/* Fill in the header. */
@@ -65254,25 +65946,36 @@ static int fillInCell(
}
/* Fill in the payload */
+ pPayload = &pCell[nHeader];
if( nPayload<=pPage->maxLocal ){
+ /* This is the common case where everything fits on the btree page
+ ** and no overflow pages are required. */
n = nHeader + nPayload;
testcase( n==3 );
testcase( n==4 );
if( n<4 ) n = 4;
*pnSize = n;
- spaceLeft = nPayload;
- pPrior = pCell;
- }else{
- int mn = pPage->minLocal;
- n = mn + (nPayload - mn) % (pPage->pBt->usableSize - 4);
- testcase( n==pPage->maxLocal );
- testcase( n==pPage->maxLocal+1 );
- if( n > pPage->maxLocal ) n = mn;
- spaceLeft = n;
- *pnSize = n + nHeader + 4;
- pPrior = &pCell[nHeader+n];
+ assert( nSrc<=nPayload );
+ testcase( nSrc<nPayload );
+ memcpy(pPayload, pSrc, nSrc);
+ memset(pPayload+nSrc, 0, nPayload-nSrc);
+ return SQLITE_OK;
}
- pPayload = &pCell[nHeader];
+
+ /* If we reach this point, it means that some of the content will need
+ ** to spill onto overflow pages.
+ */
+ mn = pPage->minLocal;
+ n = mn + (nPayload - mn) % (pPage->pBt->usableSize - 4);
+ testcase( n==pPage->maxLocal );
+ testcase( n==pPage->maxLocal+1 );
+ if( n > pPage->maxLocal ) n = mn;
+ spaceLeft = n;
+ *pnSize = n + nHeader + 4;
+ pPrior = &pCell[nHeader+n];
+ pToRelease = 0;
+ pgnoOvfl = 0;
+ pBt = pPage->pBt;
/* At this point variables should be set as follows:
**
@@ -65298,8 +66001,35 @@ static int fillInCell(
#endif
/* Write the payload into the local Cell and any extra into overflow pages */
- while( nPayload>0 ){
+ while( 1 ){
+ n = nPayload;
+ if( n>spaceLeft ) n = spaceLeft;
+
+ /* If pToRelease is not zero than pPayload points into the data area
+ ** of pToRelease. Make sure pToRelease is still writeable. */
+ assert( pToRelease==0 || sqlite3PagerIswriteable(pToRelease->pDbPage) );
+
+ /* If pPayload is part of the data area of pPage, then make sure pPage
+ ** is still writeable */
+ assert( pPayload<pPage->aData || pPayload>=&pPage->aData[pBt->pageSize]
+ || sqlite3PagerIswriteable(pPage->pDbPage) );
+
+ if( nSrc>=n ){
+ memcpy(pPayload, pSrc, n);
+ }else if( nSrc>0 ){
+ n = nSrc;
+ memcpy(pPayload, pSrc, n);
+ }else{
+ memset(pPayload, 0, n);
+ }
+ nPayload -= n;
+ if( nPayload<=0 ) break;
+ pPayload += n;
+ pSrc += n;
+ nSrc -= n;
+ spaceLeft -= n;
if( spaceLeft==0 ){
+ MemPage *pOvfl = 0;
#ifndef SQLITE_OMIT_AUTOVACUUM
Pgno pgnoPtrmap = pgnoOvfl; /* Overflow page pointer-map entry page */
if( pBt->autoVacuum ){
@@ -65352,30 +66082,6 @@ static int fillInCell(
pPayload = &pOvfl->aData[4];
spaceLeft = pBt->usableSize - 4;
}
- n = nPayload;
- if( n>spaceLeft ) n = spaceLeft;
-
- /* If pToRelease is not zero than pPayload points into the data area
- ** of pToRelease. Make sure pToRelease is still writeable. */
- assert( pToRelease==0 || sqlite3PagerIswriteable(pToRelease->pDbPage) );
-
- /* If pPayload is part of the data area of pPage, then make sure pPage
- ** is still writeable */
- assert( pPayload<pPage->aData || pPayload>=&pPage->aData[pBt->pageSize]
- || sqlite3PagerIswriteable(pPage->pDbPage) );
-
- if( nSrc>0 ){
- if( n>nSrc ) n = nSrc;
- assert( pSrc );
- memcpy(pPayload, pSrc, n);
- }else{
- memset(pPayload, 0, n);
- }
- nPayload -= n;
- pPayload += n;
- pSrc += n;
- nSrc -= n;
- spaceLeft -= n;
}
releasePage(pToRelease);
return SQLITE_OK;
@@ -65407,7 +66113,7 @@ static void dropCell(MemPage *pPage, int idx, int sz, int *pRC){
hdr = pPage->hdrOffset;
testcase( pc==get2byte(&data[hdr+5]) );
testcase( pc+sz==pPage->pBt->usableSize );
- if( pc < (u32)get2byte(&data[hdr+5]) || pc+sz > pPage->pBt->usableSize ){
+ if( pc+sz > pPage->pBt->usableSize ){
*pRC = SQLITE_CORRUPT_BKPT;
return;
}
@@ -66245,7 +66951,7 @@ static int balance_nonroot(
** In this case, temporarily copy the cell into the aOvflSpace[]
** buffer. It will be copied out again as soon as the aSpace[] buffer
** is allocated. */
- if( pBt->btsFlags & BTS_SECURE_DELETE ){
+ if( pBt->btsFlags & BTS_FAST_SECURE ){
int iOff;
iOff = SQLITE_PTR_TO_INT(apDiv[i]) - SQLITE_PTR_TO_INT(pParent->aData);
@@ -66274,10 +66980,8 @@ static int balance_nonroot(
+ nMaxCells*sizeof(u16) /* b.szCell */
+ pBt->pageSize; /* aSpace1 */
- /* EVIDENCE-OF: R-28375-38319 SQLite will never request a scratch buffer
- ** that is more than 6 times the database page size. */
assert( szScratch<=6*(int)pBt->pageSize );
- b.apCell = sqlite3ScratchMalloc( szScratch );
+ b.apCell = sqlite3StackAllocRaw(0, szScratch );
if( b.apCell==0 ){
rc = SQLITE_NOMEM_BKPT;
goto balance_cleanup;
@@ -66855,7 +67559,7 @@ static int balance_nonroot(
** Cleanup before returning.
*/
balance_cleanup:
- sqlite3ScratchFree(b.apCell);
+ sqlite3StackFree(0, b.apCell);
for(i=0; i<nOld; i++){
releasePage(apOld[i]);
}
@@ -66954,7 +67658,7 @@ static int balance(BtCursor *pCur){
do {
int iPage = pCur->iPage;
- MemPage *pPage = pCur->apPage[iPage];
+ MemPage *pPage = pCur->pPage;
if( iPage==0 ){
if( pPage->nOverflow ){
@@ -66970,7 +67674,9 @@ static int balance(BtCursor *pCur){
pCur->iPage = 1;
pCur->ix = 0;
pCur->aiIdx[0] = 0;
- assert( pCur->apPage[1]->nOverflow );
+ pCur->apPage[0] = pPage;
+ pCur->pPage = pCur->apPage[1];
+ assert( pCur->pPage->nOverflow );
}
}else{
break;
@@ -67050,6 +67756,7 @@ static int balance(BtCursor *pCur){
releasePage(pPage);
pCur->iPage--;
assert( pCur->iPage>=0 );
+ pCur->pPage = pCur->apPage[pCur->iPage];
}
}while( rc==SQLITE_OK );
@@ -67181,7 +67888,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert(
}
assert( pCur->eState==CURSOR_VALID || (pCur->eState==CURSOR_INVALID && loc) );
- pPage = pCur->apPage[pCur->iPage];
+ pPage = pCur->pPage;
assert( pPage->intKey || pX->nKey>=0 );
assert( pPage->leaf || !pPage->intKey );
@@ -67268,10 +67975,10 @@ SQLITE_PRIVATE int sqlite3BtreeInsert(
** fails. Internal data structure corruption will result otherwise.
** Also, set the cursor state to invalid. This stops saveCursorPosition()
** from trying to save the current position of the cursor. */
- pCur->apPage[pCur->iPage]->nOverflow = 0;
+ pCur->pPage->nOverflow = 0;
pCur->eState = CURSOR_INVALID;
if( (flags & BTREE_SAVEPOSITION) && rc==SQLITE_OK ){
- rc = moveToRoot(pCur);
+ btreeReleaseAllCursorPages(pCur);
if( pCur->pKeyInfo ){
assert( pCur->pKey==0 );
pCur->pKey = sqlite3Malloc( pX->nKey );
@@ -67285,7 +67992,7 @@ SQLITE_PRIVATE int sqlite3BtreeInsert(
pCur->nKey = pX->nKey;
}
}
- assert( pCur->apPage[pCur->iPage]->nOverflow==0 );
+ assert( pCur->iPage<0 || pCur->pPage->nOverflow==0 );
end_insert:
return rc;
@@ -67326,13 +68033,13 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){
assert( pCur->curFlags & BTCF_WriteFlag );
assert( hasSharedCacheTableLock(p, pCur->pgnoRoot, pCur->pKeyInfo!=0, 2) );
assert( !hasReadConflicts(p, pCur->pgnoRoot) );
- assert( pCur->ix<pCur->apPage[pCur->iPage]->nCell );
+ assert( pCur->ix<pCur->pPage->nCell );
assert( pCur->eState==CURSOR_VALID );
assert( (flags & ~(BTREE_SAVEPOSITION | BTREE_AUXDELETE))==0 );
iCellDepth = pCur->iPage;
iCellIdx = pCur->ix;
- pPage = pCur->apPage[iCellDepth];
+ pPage = pCur->pPage;
pCell = findCell(pPage, iCellIdx);
/* If the bPreserve flag is set to true, then the cursor position must
@@ -67365,8 +68072,8 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){
** sub-tree headed by the child page of the cell being deleted. This makes
** balancing the tree following the delete operation easier. */
if( !pPage->leaf ){
- int notUsed = 0;
- rc = sqlite3BtreePrevious(pCur, &notUsed);
+ rc = sqlite3BtreePrevious(pCur, 0);
+ assert( rc!=SQLITE_DONE );
if( rc ) return rc;
}
@@ -67398,11 +68105,16 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){
** node. The cell from the leaf node needs to be moved to the internal
** node to replace the deleted cell. */
if( !pPage->leaf ){
- MemPage *pLeaf = pCur->apPage[pCur->iPage];
+ MemPage *pLeaf = pCur->pPage;
int nCell;
- Pgno n = pCur->apPage[iCellDepth+1]->pgno;
+ Pgno n;
unsigned char *pTmp;
+ if( iCellDepth<pCur->iPage-1 ){
+ n = pCur->apPage[iCellDepth+1]->pgno;
+ }else{
+ n = pCur->pPage->pgno;
+ }
pCell = findCell(pLeaf, pLeaf->nCell-1);
if( pCell<&pLeaf->aData[4] ) return SQLITE_CORRUPT_BKPT;
nCell = pLeaf->xCellSize(pLeaf, pCell);
@@ -67434,16 +68146,19 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){
** well. */
rc = balance(pCur);
if( rc==SQLITE_OK && pCur->iPage>iCellDepth ){
+ releasePageNotNull(pCur->pPage);
+ pCur->iPage--;
while( pCur->iPage>iCellDepth ){
releasePage(pCur->apPage[pCur->iPage--]);
}
+ pCur->pPage = pCur->apPage[pCur->iPage];
rc = balance(pCur);
}
if( rc==SQLITE_OK ){
if( bSkipnext ){
assert( bPreserve && (pCur->iPage==iCellDepth || CORRUPT_DB) );
- assert( pPage==pCur->apPage[pCur->iPage] || CORRUPT_DB );
+ assert( pPage==pCur->pPage || CORRUPT_DB );
assert( (pPage->nCell>0 || CORRUPT_DB) && iCellIdx<=pPage->nCell );
pCur->eState = CURSOR_SKIPNEXT;
if( iCellIdx>=pPage->nCell ){
@@ -67455,8 +68170,10 @@ SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur, u8 flags){
}else{
rc = moveToRoot(pCur);
if( bPreserve ){
+ btreeReleaseAllCursorPages(pCur);
pCur->eState = CURSOR_REQUIRESEEK;
}
+ if( rc==SQLITE_EMPTY ) rc = SQLITE_OK;
}
}
return rc;
@@ -67921,11 +68638,11 @@ SQLITE_PRIVATE int sqlite3BtreeCount(BtCursor *pCur, i64 *pnEntry){
i64 nEntry = 0; /* Value to return in *pnEntry */
int rc; /* Return code */
- if( pCur->pgnoRoot==0 ){
+ rc = moveToRoot(pCur);
+ if( rc==SQLITE_EMPTY ){
*pnEntry = 0;
return SQLITE_OK;
}
- rc = moveToRoot(pCur);
/* Unless an error occurs, the following loop runs one iteration for each
** page in the B-Tree structure (not including overflow pages).
@@ -67938,7 +68655,7 @@ SQLITE_PRIVATE int sqlite3BtreeCount(BtCursor *pCur, i64 *pnEntry){
** this page contains countable entries. Increment the entry counter
** accordingly.
*/
- pPage = pCur->apPage[pCur->iPage];
+ pPage = pCur->pPage;
if( pPage->leaf || !pPage->intKey ){
nEntry += pPage->nCell;
}
@@ -67961,10 +68678,10 @@ SQLITE_PRIVATE int sqlite3BtreeCount(BtCursor *pCur, i64 *pnEntry){
return moveToRoot(pCur);
}
moveToParent(pCur);
- }while ( pCur->ix>=pCur->apPage[pCur->iPage]->nCell );
+ }while ( pCur->ix>=pCur->pPage->nCell );
pCur->ix++;
- pPage = pCur->apPage[pCur->iPage];
+ pPage = pCur->pPage;
}
/* Descend to the child node of the cell that the cursor currently
@@ -68805,7 +69522,7 @@ SQLITE_PRIVATE int sqlite3BtreePutData(BtCursor *pCsr, u32 offset, u32 amt, void
&& pCsr->pBt->inTransaction==TRANS_WRITE );
assert( hasSharedCacheTableLock(pCsr->pBtree, pCsr->pgnoRoot, 0, 2) );
assert( !hasReadConflicts(pCsr->pBtree, pCsr->pgnoRoot) );
- assert( pCsr->apPage[pCsr->iPage]->intKey );
+ assert( pCsr->pPage->intKey );
return accessPayload(pCsr, offset, amt, (unsigned char *)z, 1);
}
@@ -69728,7 +70445,7 @@ copy_finished:
*/
SQLITE_PRIVATE int sqlite3VdbeCheckMemInvariants(Mem *p){
/* If MEM_Dyn is set then Mem.xDel!=0.
- ** Mem.xDel is might not be initialized if MEM_Dyn is clear.
+ ** Mem.xDel might not be initialized if MEM_Dyn is clear.
*/
assert( (p->flags & MEM_Dyn)==0 || p->xDel!=0 );
@@ -69741,9 +70458,34 @@ SQLITE_PRIVATE int sqlite3VdbeCheckMemInvariants(Mem *p){
/* Cannot be both MEM_Int and MEM_Real at the same time */
assert( (p->flags & (MEM_Int|MEM_Real))!=(MEM_Int|MEM_Real) );
- /* Cannot be both MEM_Null and some other type */
- assert( (p->flags & MEM_Null)==0 ||
- (p->flags & (MEM_Int|MEM_Real|MEM_Str|MEM_Blob))==0 );
+ if( p->flags & MEM_Null ){
+ /* Cannot be both MEM_Null and some other type */
+ assert( (p->flags & (MEM_Int|MEM_Real|MEM_Str|MEM_Blob
+ |MEM_RowSet|MEM_Frame|MEM_Agg|MEM_Zero))==0 );
+
+ /* If MEM_Null is set, then either the value is a pure NULL (the usual
+ ** case) or it is a pointer set using sqlite3_bind_pointer() or
+ ** sqlite3_result_pointer(). If a pointer, then MEM_Term must also be
+ ** set.
+ */
+ if( (p->flags & (MEM_Term|MEM_Subtype))==(MEM_Term|MEM_Subtype) ){
+ /* This is a pointer type. There may be a flag to indicate what to
+ ** do with the pointer. */
+ assert( ((p->flags&MEM_Dyn)!=0 ? 1 : 0) +
+ ((p->flags&MEM_Ephem)!=0 ? 1 : 0) +
+ ((p->flags&MEM_Static)!=0 ? 1 : 0) <= 1 );
+
+ /* No other bits set */
+ assert( (p->flags & ~(MEM_Null|MEM_Term|MEM_Subtype
+ |MEM_Dyn|MEM_Ephem|MEM_Static))==0 );
+ }else{
+ /* A pure NULL might have other flags, such as MEM_Static, MEM_Dyn,
+ ** MEM_Ephem, MEM_Cleared, or MEM_Subtype */
+ }
+ }else{
+ /* The MEM_Cleared bit is only allowed on NULLs */
+ assert( (p->flags & MEM_Cleared)==0 );
+ }
/* The szMalloc field holds the correct memory allocation size */
assert( p->szMalloc==0
@@ -69831,7 +70573,7 @@ SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3VdbeMemGrow(Mem *pMem, int n, int bPre
assert( pMem->szMalloc==0
|| pMem->szMalloc==sqlite3DbMallocSize(pMem->db, pMem->zMalloc) );
if( n<32 ) n = 32;
- if( bPreserve && pMem->szMalloc>0 && pMem->z==pMem->zMalloc ){
+ if( pMem->szMalloc>0 && bPreserve && pMem->z==pMem->zMalloc ){
pMem->z = pMem->zMalloc = sqlite3DbReallocOrFree(pMem->db, pMem->z, n);
bPreserve = 0;
}else{
@@ -69847,7 +70589,8 @@ SQLITE_PRIVATE SQLITE_NOINLINE int sqlite3VdbeMemGrow(Mem *pMem, int n, int bPre
pMem->szMalloc = sqlite3DbMallocSize(pMem->db, pMem->zMalloc);
}
- if( bPreserve && pMem->z && ALWAYS(pMem->z!=pMem->zMalloc) ){
+ if( bPreserve && pMem->z ){
+ assert( pMem->z!=pMem->zMalloc );
memcpy(pMem->zMalloc, pMem->z, pMem->n);
}
if( (pMem->flags&MEM_Dyn)!=0 ){
@@ -69886,6 +70629,20 @@ SQLITE_PRIVATE int sqlite3VdbeMemClearAndResize(Mem *pMem, int szNew){
}
/*
+** It is already known that pMem contains an unterminated string.
+** Add the zero terminator.
+*/
+static SQLITE_NOINLINE int vdbeMemAddTerminator(Mem *pMem){
+ if( sqlite3VdbeMemGrow(pMem, pMem->n+2, 1) ){
+ return SQLITE_NOMEM_BKPT;
+ }
+ pMem->z[pMem->n] = 0;
+ pMem->z[pMem->n+1] = 0;
+ pMem->flags |= MEM_Term;
+ return SQLITE_OK;
+}
+
+/*
** Change pMem so that its MEM_Str or MEM_Blob value is stored in
** MEM.zMalloc, where it can be safely written.
**
@@ -69897,12 +70654,8 @@ SQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem *pMem){
if( (pMem->flags & (MEM_Str|MEM_Blob))!=0 ){
if( ExpandBlob(pMem) ) return SQLITE_NOMEM;
if( pMem->szMalloc==0 || pMem->z!=pMem->zMalloc ){
- if( sqlite3VdbeMemGrow(pMem, pMem->n + 2, 1) ){
- return SQLITE_NOMEM_BKPT;
- }
- pMem->z[pMem->n] = 0;
- pMem->z[pMem->n+1] = 0;
- pMem->flags |= MEM_Term;
+ int rc = vdbeMemAddTerminator(pMem);
+ if( rc ) return rc;
}
}
pMem->flags &= ~MEM_Ephem;
@@ -69942,20 +70695,6 @@ SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *pMem){
#endif
/*
-** It is already known that pMem contains an unterminated string.
-** Add the zero terminator.
-*/
-static SQLITE_NOINLINE int vdbeMemAddTerminator(Mem *pMem){
- if( sqlite3VdbeMemGrow(pMem, pMem->n+2, 1) ){
- return SQLITE_NOMEM_BKPT;
- }
- pMem->z[pMem->n] = 0;
- pMem->z[pMem->n+1] = 0;
- pMem->flags |= MEM_Term;
- return SQLITE_OK;
-}
-
-/*
** Make sure the given Mem is \u0000 terminated.
*/
SQLITE_PRIVATE int sqlite3VdbeMemNulTerminate(Mem *pMem){
@@ -70273,14 +71012,21 @@ SQLITE_PRIVATE int sqlite3VdbeMemRealify(Mem *pMem){
*/
SQLITE_PRIVATE int sqlite3VdbeMemNumerify(Mem *pMem){
if( (pMem->flags & (MEM_Int|MEM_Real|MEM_Null))==0 ){
+ int rc;
assert( (pMem->flags & (MEM_Blob|MEM_Str))!=0 );
assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) );
- if( 0==sqlite3Atoi64(pMem->z, &pMem->u.i, pMem->n, pMem->enc) ){
+ rc = sqlite3Atoi64(pMem->z, &pMem->u.i, pMem->n, pMem->enc);
+ if( rc==0 ){
MemSetTypeFlag(pMem, MEM_Int);
}else{
- pMem->u.r = sqlite3VdbeRealValue(pMem);
- MemSetTypeFlag(pMem, MEM_Real);
- sqlite3VdbeIntegerAffinity(pMem);
+ i64 i = pMem->u.i;
+ sqlite3AtoF(pMem->z, &pMem->u.r, pMem->n, pMem->enc);
+ if( rc==1 && pMem->u.r==(double)i ){
+ pMem->u.i = i;
+ MemSetTypeFlag(pMem, MEM_Int);
+ }else{
+ MemSetTypeFlag(pMem, MEM_Real);
+ }
}
}
assert( (pMem->flags & (MEM_Int|MEM_Real|MEM_Null))!=0 );
@@ -70406,6 +71152,27 @@ SQLITE_PRIVATE void sqlite3VdbeMemSetInt64(Mem *pMem, i64 val){
}
}
+/* A no-op destructor */
+static void sqlite3NoopDestructor(void *p){ UNUSED_PARAMETER(p); }
+
+/*
+** Set the value stored in *pMem should already be a NULL.
+** Also store a pointer to go with it.
+*/
+SQLITE_PRIVATE void sqlite3VdbeMemSetPointer(
+ Mem *pMem,
+ void *pPtr,
+ const char *zPType,
+ void (*xDestructor)(void*)
+){
+ assert( pMem->flags==MEM_Null );
+ pMem->u.zPType = zPType ? zPType : "";
+ pMem->z = pPtr;
+ pMem->flags = MEM_Null|MEM_Dyn|MEM_Subtype|MEM_Term;
+ pMem->eSubtype = 'p';
+ pMem->xDel = xDestructor ? xDestructor : sqlite3NoopDestructor;
+}
+
#ifndef SQLITE_OMIT_FLOATING_POINT
/*
** Delete any previous value and set the value stored in *pMem to val,
@@ -70586,7 +71353,7 @@ SQLITE_PRIVATE int sqlite3VdbeMemSetStr(
if( nByte<0 ){
assert( enc!=0 );
if( enc==SQLITE_UTF8 ){
- nByte = sqlite3Strlen30(z);
+ nByte = 0x7fffffff & (int)strlen(z);
if( nByte>iLimit ) nByte = iLimit+1;
}else{
for(nByte=0; nByte<=iLimit && (z[nByte] | z[nByte+1]); nByte+=2){}
@@ -70664,12 +71431,11 @@ static SQLITE_NOINLINE int vdbeMemFromBtreeResize(
){
int rc;
pMem->flags = MEM_Null;
- if( SQLITE_OK==(rc = sqlite3VdbeMemClearAndResize(pMem, amt+2)) ){
+ if( SQLITE_OK==(rc = sqlite3VdbeMemClearAndResize(pMem, amt+1)) ){
rc = sqlite3BtreePayload(pCur, offset, amt, pMem->z);
if( rc==SQLITE_OK ){
- pMem->z[amt] = 0;
- pMem->z[amt+1] = 0;
- pMem->flags = MEM_Blob|MEM_Term;
+ pMem->z[amt] = 0; /* Overrun area used when reading malformed records */
+ pMem->flags = MEM_Blob;
pMem->n = (int)amt;
}else{
sqlite3VdbeMemRelease(pMem);
@@ -70818,7 +71584,7 @@ static sqlite3_value *valueNew(sqlite3 *db, struct ValueNewStat4Ctx *p){
if( pRec ){
pRec->pKeyInfo = sqlite3KeyInfoOfIndex(p->pParse, pIdx);
if( pRec->pKeyInfo ){
- assert( pRec->pKeyInfo->nField+pRec->pKeyInfo->nXField==nCol );
+ assert( pRec->pKeyInfo->nAllField==nCol );
assert( pRec->pKeyInfo->enc==ENC(db) );
pRec->aMem = (Mem *)((u8*)pRec + ROUND8(sizeof(UnpackedRecord)));
for(i=0; i<nCol; i++){
@@ -71026,7 +71792,7 @@ static int valueFromExpr(
}
}else if( op==TK_UMINUS ) {
/* This branch happens for multiple negative signs. Ex: -(-5) */
- if( SQLITE_OK==sqlite3ValueFromExpr(db,pExpr->pLeft,enc,affinity,&pVal)
+ if( SQLITE_OK==valueFromExpr(db,pExpr->pLeft,enc,affinity,&pVal,pCtx)
&& pVal!=0
){
sqlite3VdbeMemNumerify(pVal);
@@ -71183,14 +71949,13 @@ static int stat4ValueFromExpr(
/* Skip over any TK_COLLATE nodes */
pExpr = sqlite3ExprSkipCollate(pExpr);
+ assert( pExpr==0 || pExpr->op!=TK_REGISTER || pExpr->op2!=TK_VARIABLE );
if( !pExpr ){
pVal = valueNew(db, pAlloc);
if( pVal ){
sqlite3VdbeMemSetNull((Mem*)pVal);
}
- }else if( pExpr->op==TK_VARIABLE
- || NEVER(pExpr->op==TK_REGISTER && pExpr->op2==TK_VARIABLE)
- ){
+ }else if( pExpr->op==TK_VARIABLE && (db->flags & SQLITE_EnableQPSG)==0 ){
Vdbe *v;
int iBindVar = pExpr->iColumn;
sqlite3VdbeSetVarmask(pParse->pVdbe, iBindVar);
@@ -71198,9 +71963,7 @@ static int stat4ValueFromExpr(
pVal = valueNew(db, pAlloc);
if( pVal ){
rc = sqlite3VdbeMemCopy((Mem*)pVal, &v->aVar[iBindVar-1]);
- if( rc==SQLITE_OK ){
- sqlite3ValueApplyAffinity(pVal, affinity, ENC(db));
- }
+ sqlite3ValueApplyAffinity(pVal, affinity, ENC(db));
pVal->db = pParse->db;
}
}
@@ -71357,7 +72120,7 @@ SQLITE_PRIVATE int sqlite3Stat4Column(
SQLITE_PRIVATE void sqlite3Stat4ProbeFree(UnpackedRecord *pRec){
if( pRec ){
int i;
- int nCol = pRec->pKeyInfo->nField+pRec->pKeyInfo->nXField;
+ int nCol = pRec->pKeyInfo->nAllField;
Mem *aMem = pRec->aMem;
sqlite3 *db = aMem[0].db;
for(i=0; i<nCol; i++){
@@ -71453,10 +72216,12 @@ SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(Parse *pParse){
db->pVdbe = p;
p->magic = VDBE_MAGIC_INIT;
p->pParse = pParse;
+ pParse->pVdbe = p;
assert( pParse->aLabel==0 );
assert( pParse->nLabel==0 );
assert( pParse->nOpAlloc==0 );
assert( pParse->szOpAlloc==0 );
+ sqlite3VdbeAddOp2(p, OP_Init, 0, 1);
return p;
}
@@ -71474,16 +72239,14 @@ SQLITE_PRIVATE void sqlite3VdbeError(Vdbe *p, const char *zFormat, ...){
/*
** Remember the SQL string for a prepared statement.
*/
-SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe *p, const char *z, int n, int isPrepareV2){
- assert( isPrepareV2==1 || isPrepareV2==0 );
+SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe *p, const char *z, int n, u8 prepFlags){
if( p==0 ) return;
- if( !isPrepareV2 ) p->expmask = 0;
-#if defined(SQLITE_OMIT_TRACE) && !defined(SQLITE_ENABLE_SQLLOG)
- if( !isPrepareV2 ) return;
-#endif
+ p->prepFlags = prepFlags;
+ if( (prepFlags & SQLITE_PREPARE_SAVESQL)==0 ){
+ p->expmask = 0;
+ }
assert( p->zSql==0 );
p->zSql = sqlite3DbStrNDup(p->db, z, n);
- p->isPrepareV2 = (u8)isPrepareV2;
}
/*
@@ -71505,8 +72268,10 @@ SQLITE_PRIVATE void sqlite3VdbeSwap(Vdbe *pA, Vdbe *pB){
zTmp = pA->zSql;
pA->zSql = pB->zSql;
pB->zSql = zTmp;
- pB->isPrepareV2 = pA->isPrepareV2;
pB->expmask = pA->expmask;
+ pB->prepFlags = pA->prepFlags;
+ memcpy(pB->aCounter, pA->aCounter, sizeof(pB->aCounter));
+ pB->aCounter[SQLITE_STMTSTATUS_REPREPARE]++;
}
/*
@@ -71662,6 +72427,9 @@ SQLITE_PRIVATE int sqlite3VdbeLoadString(Vdbe *p, int iDest, const char *zStr){
** "s" character in zTypes[], the register is a string if the argument is
** not NULL, or OP_Null if the value is a null pointer. For each "i" character
** in zTypes[], the register is initialized to an integer.
+**
+** If the input string does not end with "X" then an OP_ResultRow instruction
+** is generated for the values inserted.
*/
SQLITE_PRIVATE void sqlite3VdbeMultiLoad(Vdbe *p, int iDest, const char *zTypes, ...){
va_list ap;
@@ -71671,12 +72439,15 @@ SQLITE_PRIVATE void sqlite3VdbeMultiLoad(Vdbe *p, int iDest, const char *zTypes,
for(i=0; (c = zTypes[i])!=0; i++){
if( c=='s' ){
const char *z = va_arg(ap, const char*);
- sqlite3VdbeAddOp4(p, z==0 ? OP_Null : OP_String8, 0, iDest++, 0, z, 0);
+ sqlite3VdbeAddOp4(p, z==0 ? OP_Null : OP_String8, 0, iDest+i, 0, z, 0);
+ }else if( c=='i' ){
+ sqlite3VdbeAddOp2(p, OP_Integer, va_arg(ap, int), iDest+i);
}else{
- assert( c=='i' );
- sqlite3VdbeAddOp2(p, OP_Integer, va_arg(ap, int), iDest++);
+ goto skip_op_resultrow;
}
}
+ sqlite3VdbeAddOp2(p, OP_ResultRow, iDest, i);
+skip_op_resultrow:
va_end(ap);
}
@@ -71904,7 +72675,8 @@ static Op *opIterNext(VdbeOpIter *p){
** * OP_VUpdate
** * OP_VRename
** * OP_FkCounter with P2==0 (immediate foreign key constraint)
-** * OP_CreateTable and OP_InitCoroutine (for CREATE TABLE AS SELECT ...)
+** * OP_CreateBtree/BTREE_INTKEY and OP_InitCoroutine
+** (for CREATE TABLE AS SELECT ...)
**
** Then check that the value of Parse.mayAbort is true if an
** ABORT may be thrown, or false otherwise. Return true if it does
@@ -71932,7 +72704,7 @@ SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){
hasAbort = 1;
break;
}
- if( opcode==OP_CreateTable ) hasCreateTable = 1;
+ if( opcode==OP_CreateBtree && pOp->p3==BTREE_INTKEY ) hasCreateTable = 1;
if( opcode==OP_InitCoroutine ) hasInitCoroutine = 1;
#ifndef SQLITE_OMIT_FOREIGN_KEY
if( opcode==OP_FkCounter && pOp->p1==0 && pOp->p2==1 ){
@@ -72011,6 +72783,27 @@ static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){
p->bIsReader = 1;
break;
}
+ case OP_Next:
+ case OP_NextIfOpen:
+ case OP_SorterNext: {
+ pOp->p4.xAdvance = sqlite3BtreeNext;
+ pOp->p4type = P4_ADVANCE;
+ /* The code generator never codes any of these opcodes as a jump
+ ** to a label. They are always coded as a jump backwards to a
+ ** known address */
+ assert( pOp->p2>=0 );
+ break;
+ }
+ case OP_Prev:
+ case OP_PrevIfOpen: {
+ pOp->p4.xAdvance = sqlite3BtreePrevious;
+ pOp->p4type = P4_ADVANCE;
+ /* The code generator never codes any of these opcodes as a jump
+ ** to a label. They are always coded as a jump backwards to a
+ ** known address */
+ assert( pOp->p2>=0 );
+ break;
+ }
#ifndef SQLITE_OMIT_VIRTUALTABLE
case OP_VUpdate: {
if( pOp->p2>nMaxArgs ) nMaxArgs = pOp->p2;
@@ -72022,27 +72815,25 @@ static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){
assert( pOp[-1].opcode==OP_Integer );
n = pOp[-1].p1;
if( n>nMaxArgs ) nMaxArgs = n;
- break;
+ /* Fall through into the default case */
}
#endif
- case OP_Next:
- case OP_NextIfOpen:
- case OP_SorterNext: {
- pOp->p4.xAdvance = sqlite3BtreeNext;
- pOp->p4type = P4_ADVANCE;
- break;
- }
- case OP_Prev:
- case OP_PrevIfOpen: {
- pOp->p4.xAdvance = sqlite3BtreePrevious;
- pOp->p4type = P4_ADVANCE;
+ default: {
+ if( pOp->p2<0 ){
+ /* The mkopcodeh.tcl script has so arranged things that the only
+ ** non-jump opcodes less than SQLITE_MX_JUMP_CODE are guaranteed to
+ ** have non-negative values for P2. */
+ assert( (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_JUMP)!=0 );
+ assert( ADDR(pOp->p2)<pParse->nLabel );
+ pOp->p2 = aLabel[ADDR(pOp->p2)];
+ }
break;
}
}
- if( (sqlite3OpcodeProperty[pOp->opcode] & OPFLG_JUMP)!=0 && pOp->p2<0 ){
- assert( ADDR(pOp->p2)<pParse->nLabel );
- pOp->p2 = aLabel[ADDR(pOp->p2)];
- }
+ /* The mkopcodeh.tcl script has so arranged things that the only
+ ** non-jump opcodes less than SQLITE_MX_JUMP_CODE are guaranteed to
+ ** have non-negative values for P2. */
+ assert( (sqlite3OpcodeProperty[pOp->opcode]&OPFLG_JUMP)==0 || pOp->p2>=0);
}
if( pOp==p->aOp ) break;
pOp--;
@@ -72300,7 +73091,7 @@ static void vdbeFreeOpArray(sqlite3 *db, Op *aOp, int nOp){
if( aOp ){
Op *pOp;
for(pOp=&aOp[nOp-1]; pOp>=aOp; pOp--){
- if( pOp->p4type ) freeP4(db, pOp->p4type, pOp->p4.p);
+ if( pOp->p4type <= P4_FREE_IF_LE ) freeP4(db, pOp->p4type, pOp->p4.p);
#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
sqlite3DbFree(db, pOp->zComment);
#endif
@@ -72715,8 +73506,8 @@ static char *displayP4(Op *pOp, char *zTemp, int nTemp){
int j;
KeyInfo *pKeyInfo = pOp->p4.pKeyInfo;
assert( pKeyInfo->aSortOrder!=0 );
- sqlite3XPrintf(&x, "k(%d", pKeyInfo->nField);
- for(j=0; j<pKeyInfo->nField; j++){
+ sqlite3XPrintf(&x, "k(%d", pKeyInfo->nKeyField);
+ for(j=0; j<pKeyInfo->nKeyField; j++){
CollSeq *pColl = pKeyInfo->aColl[j];
const char *zColl = pColl ? pColl->zName : "";
if( strcmp(zColl, "BINARY")==0 ) zColl = "B";
@@ -72788,7 +73579,7 @@ static char *displayP4(Op *pOp, char *zTemp, int nTemp){
int *ai = pOp->p4.ai;
int n = ai[0]; /* The first element of an INTARRAY is always the
** count of the number of elements to follow */
- for(i=1; i<n; i++){
+ for(i=1; i<=n; i++){
sqlite3XPrintf(&x, ",%d", ai[i]);
}
zTemp[0] = '[';
@@ -73553,44 +74344,24 @@ static void closeAllCursors(Vdbe *p){
}
/*
-** Clean up the VM after a single run.
-*/
-static void Cleanup(Vdbe *p){
- sqlite3 *db = p->db;
-
-#ifdef SQLITE_DEBUG
- /* Execute assert() statements to ensure that the Vdbe.apCsr[] and
- ** Vdbe.aMem[] arrays have already been cleaned up. */
- int i;
- if( p->apCsr ) for(i=0; i<p->nCursor; i++) assert( p->apCsr[i]==0 );
- if( p->aMem ){
- for(i=0; i<p->nMem; i++) assert( p->aMem[i].flags==MEM_Undefined );
- }
-#endif
-
- sqlite3DbFree(db, p->zErrMsg);
- p->zErrMsg = 0;
- p->pResultSet = 0;
-}
-
-/*
** Set the number of result columns that will be returned by this SQL
** statement. This is now set at compile time, rather than during
** execution of the vdbe program so that sqlite3_column_count() can
** be called on an SQL statement before sqlite3_step().
*/
SQLITE_PRIVATE void sqlite3VdbeSetNumCols(Vdbe *p, int nResColumn){
- Mem *pColName;
int n;
sqlite3 *db = p->db;
- releaseMemArray(p->aColName, p->nResColumn*COLNAME_N);
- sqlite3DbFree(db, p->aColName);
+ if( p->nResColumn ){
+ releaseMemArray(p->aColName, p->nResColumn*COLNAME_N);
+ sqlite3DbFree(db, p->aColName);
+ }
n = nResColumn*COLNAME_N;
p->nResColumn = (u16)nResColumn;
- p->aColName = pColName = (Mem*)sqlite3DbMallocRawNN(db, sizeof(Mem)*n );
+ p->aColName = (Mem*)sqlite3DbMallocRawNN(db, sizeof(Mem)*n );
if( p->aColName==0 ) return;
- initMemArray(p->aColName, n, p->db, MEM_Null);
+ initMemArray(p->aColName, n, db, MEM_Null);
}
/*
@@ -74240,10 +75011,10 @@ SQLITE_PRIVATE int sqlite3VdbeTransferError(Vdbe *p){
sqlite3ValueSetStr(db->pErr, -1, p->zErrMsg, SQLITE_UTF8, SQLITE_TRANSIENT);
sqlite3EndBenignMalloc();
db->bBenignMalloc--;
- db->errCode = rc;
- }else{
- sqlite3Error(db, rc);
+ }else if( db->pErr ){
+ sqlite3ValueSetNull(db->pErr);
}
+ db->errCode = rc;
return rc;
}
@@ -74280,6 +75051,10 @@ static void vdbeInvokeSqllog(Vdbe *v){
** VDBE_MAGIC_INIT.
*/
SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe *p){
+#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE)
+ int i;
+#endif
+
sqlite3 *db;
db = p->db;
@@ -74297,8 +75072,6 @@ SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe *p){
if( p->pc>=0 ){
vdbeInvokeSqllog(p);
sqlite3VdbeTransferError(p);
- sqlite3DbFree(db, p->zErrMsg);
- p->zErrMsg = 0;
if( p->runOnlyOnce ) p->expired = 1;
}else if( p->rc && p->expired ){
/* The expired flag was set on the VDBE before the first call
@@ -74306,13 +75079,21 @@ SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe *p){
** called), set the database error in this case as well.
*/
sqlite3ErrorWithMsg(db, p->rc, p->zErrMsg ? "%s" : 0, p->zErrMsg);
- sqlite3DbFree(db, p->zErrMsg);
- p->zErrMsg = 0;
}
- /* Reclaim all memory used by the VDBE
+ /* Reset register contents and reclaim error message memory.
*/
- Cleanup(p);
+#ifdef SQLITE_DEBUG
+ /* Execute assert() statements to ensure that the Vdbe.apCsr[] and
+ ** Vdbe.aMem[] arrays have already been cleaned up. */
+ if( p->apCsr ) for(i=0; i<p->nCursor; i++) assert( p->apCsr[i]==0 );
+ if( p->aMem ){
+ for(i=0; i<p->nMem; i++) assert( p->aMem[i].flags==MEM_Undefined );
+ }
+#endif
+ sqlite3DbFree(db, p->zErrMsg);
+ p->zErrMsg = 0;
+ p->pResultSet = 0;
/* Save profiling information from this VDBE run.
*/
@@ -74320,7 +75101,6 @@ SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe *p){
{
FILE *out = fopen("vdbe_profile.out", "a");
if( out ){
- int i;
fprintf(out, "---- ");
for(i=0; i<p->nOp; i++){
fprintf(out, "%02x", p->aOp[i].opcode);
@@ -74533,19 +75313,18 @@ SQLITE_PRIVATE int sqlite3VdbeCursorRestore(VdbeCursor *p){
*/
SQLITE_PRIVATE int sqlite3VdbeCursorMoveto(VdbeCursor **pp, int *piCol){
VdbeCursor *p = *pp;
- if( p->eCurType==CURTYPE_BTREE ){
- if( p->deferredMoveto ){
- int iMap;
- if( p->aAltMap && (iMap = p->aAltMap[1+*piCol])>0 ){
- *pp = p->pAltCursor;
- *piCol = iMap - 1;
- return SQLITE_OK;
- }
- return handleDeferredMoveto(p);
- }
- if( sqlite3BtreeCursorHasMoved(p->uc.pCursor) ){
- return handleMovedCursor(p);
+ assert( p->eCurType==CURTYPE_BTREE || p->eCurType==CURTYPE_PSEUDO );
+ if( p->deferredMoveto ){
+ int iMap;
+ if( p->aAltMap && (iMap = p->aAltMap[1+*piCol])>0 ){
+ *pp = p->pAltCursor;
+ *piCol = iMap - 1;
+ return SQLITE_OK;
}
+ return handleDeferredMoveto(p);
+ }
+ if( sqlite3BtreeCursorHasMoved(p->uc.pCursor) ){
+ return handleMovedCursor(p);
}
return SQLITE_OK;
}
@@ -74941,13 +75720,13 @@ SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeAllocUnpackedRecord(
){
UnpackedRecord *p; /* Unpacked record to return */
int nByte; /* Number of bytes required for *p */
- nByte = ROUND8(sizeof(UnpackedRecord)) + sizeof(Mem)*(pKeyInfo->nField+1);
+ nByte = ROUND8(sizeof(UnpackedRecord)) + sizeof(Mem)*(pKeyInfo->nKeyField+1);
p = (UnpackedRecord *)sqlite3DbMallocRaw(pKeyInfo->db, nByte);
if( !p ) return 0;
p->aMem = (Mem*)&((char*)p)[ROUND8(sizeof(UnpackedRecord))];
assert( pKeyInfo->aSortOrder!=0 );
p->pKeyInfo = pKeyInfo;
- p->nField = pKeyInfo->nField + 1;
+ p->nField = pKeyInfo->nKeyField + 1;
return p;
}
@@ -74987,7 +75766,7 @@ SQLITE_PRIVATE void sqlite3VdbeRecordUnpack(
pMem++;
if( (++u)>=p->nField ) break;
}
- assert( u<=pKeyInfo->nField + 1 );
+ assert( u<=pKeyInfo->nKeyField + 1 );
p->nField = u;
}
@@ -75036,9 +75815,9 @@ static int vdbeRecordCompareDebug(
idx1 = getVarint32(aKey1, szHdr1);
if( szHdr1>98307 ) return SQLITE_CORRUPT;
d1 = szHdr1;
- assert( pKeyInfo->nField+pKeyInfo->nXField>=pPKey2->nField || CORRUPT_DB );
+ assert( pKeyInfo->nAllField>=pPKey2->nField || CORRUPT_DB );
assert( pKeyInfo->aSortOrder!=0 );
- assert( pKeyInfo->nField>0 );
+ assert( pKeyInfo->nKeyField>0 );
assert( idx1<=szHdr1 || CORRUPT_DB );
do{
u32 serial_type1;
@@ -75100,12 +75879,12 @@ debugCompareEnd:
/*
** Count the number of fields (a.k.a. columns) in the record given by
** pKey,nKey. The verify that this count is less than or equal to the
-** limit given by pKeyInfo->nField + pKeyInfo->nXField.
+** limit given by pKeyInfo->nAllField.
**
** If this constraint is not satisfied, it means that the high-speed
** vdbeRecordCompareInt() and vdbeRecordCompareString() routines will
** not work correctly. If this assert() ever fires, it probably means
-** that the KeyInfo.nField or KeyInfo.nXField values were computed
+** that the KeyInfo.nKeyField or KeyInfo.nAllField values were computed
** incorrectly.
*/
static void vdbeAssertFieldCountWithinLimits(
@@ -75126,7 +75905,7 @@ static void vdbeAssertFieldCountWithinLimits(
idx += getVarint32(aKey+idx, notUsed);
nField++;
}
- assert( nField <= pKeyInfo->nField+pKeyInfo->nXField );
+ assert( nField <= pKeyInfo->nAllField );
}
#else
# define vdbeAssertFieldCountWithinLimits(A,B,C)
@@ -75151,7 +75930,6 @@ static int vdbeCompareMemString(
}else{
int rc;
const void *v1, *v2;
- int n1, n2;
Mem c1;
Mem c2;
sqlite3VdbeMemInit(&c1, pMem1->db, MEM_Null);
@@ -75159,11 +75937,13 @@ static int vdbeCompareMemString(
sqlite3VdbeMemShallowCopy(&c1, pMem1, MEM_Ephem);
sqlite3VdbeMemShallowCopy(&c2, pMem2, MEM_Ephem);
v1 = sqlite3ValueText((sqlite3_value*)&c1, pColl->enc);
- n1 = v1==0 ? 0 : c1.n;
v2 = sqlite3ValueText((sqlite3_value*)&c2, pColl->enc);
- n2 = v2==0 ? 0 : c2.n;
- rc = pColl->xCmp(pColl->pUser, n1, v1, n2, v2);
- if( (v1==0 || v2==0) && prcErr ) *prcErr = SQLITE_NOMEM_BKPT;
+ if( (v1==0 || v2==0) ){
+ if( prcErr ) *prcErr = SQLITE_NOMEM_BKPT;
+ rc = 0;
+ }else{
+ rc = pColl->xCmp(pColl->pUser, c1.n, v1, c2.n, v2);
+ }
sqlite3VdbeMemRelease(&c1);
sqlite3VdbeMemRelease(&c2);
return rc;
@@ -75430,10 +76210,10 @@ SQLITE_PRIVATE int sqlite3VdbeRecordCompareWithSkip(
}
VVA_ONLY( mem1.szMalloc = 0; ) /* Only needed by assert() statements */
- assert( pPKey2->pKeyInfo->nField+pPKey2->pKeyInfo->nXField>=pPKey2->nField
+ assert( pPKey2->pKeyInfo->nAllField>=pPKey2->nField
|| CORRUPT_DB );
assert( pPKey2->pKeyInfo->aSortOrder!=0 );
- assert( pPKey2->pKeyInfo->nField>0 );
+ assert( pPKey2->pKeyInfo->nKeyField>0 );
assert( idx1<=szHdr1 || CORRUPT_DB );
do{
u32 serial_type;
@@ -75766,7 +76546,7 @@ SQLITE_PRIVATE RecordCompare sqlite3VdbeFindCompare(UnpackedRecord *p){
** The easiest way to enforce this limit is to consider only records with
** 13 fields or less. If the first field is an integer, the maximum legal
** header size is (12*5 + 1 + 1) bytes. */
- if( (p->pKeyInfo->nField + p->pKeyInfo->nXField)<=13 ){
+ if( p->pKeyInfo->nAllField<=13 ){
int flags = p->aMem[0].flags;
if( p->pKeyInfo->aSortOrder[0] ){
p->r1 = 1;
@@ -75949,6 +76729,13 @@ SQLITE_PRIVATE sqlite3 *sqlite3VdbeDb(Vdbe *v){
}
/*
+** Return the SQLITE_PREPARE flags for a Vdbe.
+*/
+SQLITE_PRIVATE u8 sqlite3VdbePrepareFlags(Vdbe *v){
+ return v->prepFlags;
+}
+
+/*
** Return a pointer to an sqlite3_value structure containing the value bound
** parameter iVar of VM v. Except, if the value is an SQL NULL, return
** 0 instead. Unless it is NULL, apply affinity aff (one of the SQLITE_AFF_*
@@ -75960,6 +76747,7 @@ SQLITE_PRIVATE sqlite3_value *sqlite3VdbeGetBoundValue(Vdbe *v, int iVar, u8 aff
assert( iVar>0 );
if( v ){
Mem *pMem = &v->aVar[iVar-1];
+ assert( (v->db->flags & SQLITE_EnableQPSG)==0 );
if( 0==(pMem->flags & MEM_Null) ){
sqlite3_value *pRet = sqlite3ValueNew(v->db);
if( pRet ){
@@ -75979,6 +76767,7 @@ SQLITE_PRIVATE sqlite3_value *sqlite3VdbeGetBoundValue(Vdbe *v, int iVar, u8 aff
*/
SQLITE_PRIVATE void sqlite3VdbeSetVarmask(Vdbe *v, int iVar){
assert( iVar>0 );
+ assert( (v->db->flags & SQLITE_EnableQPSG)==0 );
if( iVar>=32 ){
v->expmask |= 0x80000000;
}else{
@@ -75986,6 +76775,28 @@ SQLITE_PRIVATE void sqlite3VdbeSetVarmask(Vdbe *v, int iVar){
}
}
+/*
+** Cause a function to throw an error if it was call from OP_PureFunc
+** rather than OP_Function.
+**
+** OP_PureFunc means that the function must be deterministic, and should
+** throw an error if it is given inputs that would make it non-deterministic.
+** This routine is invoked by date/time functions that use non-deterministic
+** features such as 'now'.
+*/
+SQLITE_PRIVATE int sqlite3NotPureFunc(sqlite3_context *pCtx){
+#ifdef SQLITE_ENABLE_STAT3_OR_STAT4
+ if( pCtx->pVdbe==0 ) return 1;
+#endif
+ if( pCtx->pVdbe->aOp[pCtx->iOp].opcode==OP_PureFunc ){
+ sqlite3_result_error(pCtx,
+ "non-deterministic function in index expression or CHECK constraint",
+ -1);
+ return 0;
+ }
+ return 1;
+}
+
#ifndef SQLITE_OMIT_VIRTUALTABLE
/*
** Transfer error message text from an sqlite3_vtab.zErrMsg (text stored
@@ -76070,7 +76881,7 @@ SQLITE_PRIVATE void sqlite3VdbePreUpdateHook(
preupdate.iNewReg = iReg;
preupdate.keyinfo.db = db;
preupdate.keyinfo.enc = ENC(db);
- preupdate.keyinfo.nField = pTab->nCol;
+ preupdate.keyinfo.nKeyField = pTab->nCol;
preupdate.keyinfo.aSortOrder = (u8*)&fakeSortOrder;
preupdate.iKey1 = iKey1;
preupdate.iKey2 = iKey2;
@@ -76080,8 +76891,8 @@ SQLITE_PRIVATE void sqlite3VdbePreUpdateHook(
db->xPreUpdateCallback(db->pPreUpdateArg, db, op, zDb, zTbl, iKey1, iKey2);
db->pPreUpdate = 0;
sqlite3DbFree(db, preupdate.aRecord);
- vdbeFreeUnpacked(db, preupdate.keyinfo.nField+1, preupdate.pUnpacked);
- vdbeFreeUnpacked(db, preupdate.keyinfo.nField+1, preupdate.pNewUnpacked);
+ vdbeFreeUnpacked(db, preupdate.keyinfo.nKeyField+1, preupdate.pUnpacked);
+ vdbeFreeUnpacked(db, preupdate.keyinfo.nKeyField+1, preupdate.pNewUnpacked);
if( preupdate.aNew ){
int i;
for(i=0; i<pCsr->nField; i++){
@@ -76250,7 +77061,7 @@ SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt *pStmt){
sqlite3VdbeMemRelease(&p->aVar[i]);
p->aVar[i].flags = MEM_Null;
}
- assert( p->isPrepareV2 || p->expmask==0 );
+ assert( (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 || p->expmask==0 );
if( p->expmask ){
p->expired = 1;
}
@@ -76295,6 +77106,19 @@ SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value *pVal){
Mem *pMem = (Mem*)pVal;
return ((pMem->flags & MEM_Subtype) ? pMem->eSubtype : 0);
}
+SQLITE_API void *sqlite3_value_pointer(sqlite3_value *pVal, const char *zPType){
+ Mem *p = (Mem*)pVal;
+ if( (p->flags&(MEM_TypeMask|MEM_Term|MEM_Subtype)) ==
+ (MEM_Null|MEM_Term|MEM_Subtype)
+ && zPType!=0
+ && p->eSubtype=='p'
+ && strcmp(p->u.zPType, zPType)==0
+ ){
+ return (void*)p->z;
+ }else{
+ return 0;
+ }
+}
SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value *pVal){
return (const unsigned char *)sqlite3ValueText(pVal, SQLITE_UTF8);
}
@@ -76473,6 +77297,18 @@ SQLITE_API void sqlite3_result_null(sqlite3_context *pCtx){
assert( sqlite3_mutex_held(pCtx->pOut->db->mutex) );
sqlite3VdbeMemSetNull(pCtx->pOut);
}
+SQLITE_API void sqlite3_result_pointer(
+ sqlite3_context *pCtx,
+ void *pPtr,
+ const char *zPType,
+ void (*xDestructor)(void*)
+){
+ Mem *pOut = pCtx->pOut;
+ assert( sqlite3_mutex_held(pOut->db->mutex) );
+ sqlite3VdbeMemRelease(pOut);
+ pOut->flags = MEM_Null;
+ sqlite3VdbeMemSetPointer(pOut, pPtr, zPType, xDestructor);
+}
SQLITE_API void sqlite3_result_subtype(sqlite3_context *pCtx, unsigned int eSubtype){
Mem *pOut = pCtx->pOut;
assert( sqlite3_mutex_held(pOut->db->mutex) );
@@ -76595,7 +77431,7 @@ static int doWalCallbacks(sqlite3 *db){
sqlite3BtreeEnter(pBt);
nEntry = sqlite3PagerWalCallback(sqlite3BtreePager(pBt));
sqlite3BtreeLeave(pBt);
- if( db->xWalCallback && nEntry>0 && rc==SQLITE_OK ){
+ if( nEntry>0 && db->xWalCallback && rc==SQLITE_OK ){
rc = db->xWalCallback(db->pWalArg, db, db->aDb[i].zDbSName, nEntry);
}
}
@@ -76705,7 +77541,7 @@ static int sqlite3Step(Vdbe *p){
if( rc!=SQLITE_ROW ) checkProfileCallback(db, p);
#endif
- if( rc==SQLITE_DONE ){
+ if( rc==SQLITE_DONE && db->autoCommit ){
assert( p->rc==SQLITE_OK );
p->rc = doWalCallbacks(db);
if( p->rc!=SQLITE_OK ){
@@ -76729,8 +77565,11 @@ end_of_step:
|| (rc&0xff)==SQLITE_BUSY || rc==SQLITE_MISUSE
);
assert( (p->rc!=SQLITE_ROW && p->rc!=SQLITE_DONE) || p->rc==p->rcApp );
- if( p->isPrepareV2 && rc!=SQLITE_ROW && rc!=SQLITE_DONE ){
- /* If this statement was prepared using sqlite3_prepare_v2(), and an
+ if( (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0
+ && rc!=SQLITE_ROW
+ && rc!=SQLITE_DONE
+ ){
+ /* If this statement was prepared using saved SQL and an
** error has occurred, then return the error code in p->rc to the
** caller. Set the error code in the database handle to the same value.
*/
@@ -76746,7 +77585,6 @@ end_of_step:
*/
SQLITE_API int sqlite3_step(sqlite3_stmt *pStmt){
int rc = SQLITE_OK; /* Result from sqlite3Step() */
- int rc2 = SQLITE_OK; /* Result from sqlite3Reprepare() */
Vdbe *v = (Vdbe*)pStmt; /* the prepared statement */
int cnt = 0; /* Counter to prevent infinite loop of reprepares */
sqlite3 *db; /* The database connection */
@@ -76760,32 +77598,31 @@ SQLITE_API int sqlite3_step(sqlite3_stmt *pStmt){
while( (rc = sqlite3Step(v))==SQLITE_SCHEMA
&& cnt++ < SQLITE_MAX_SCHEMA_RETRY ){
int savedPc = v->pc;
- rc2 = rc = sqlite3Reprepare(v);
- if( rc!=SQLITE_OK) break;
+ rc = sqlite3Reprepare(v);
+ if( rc!=SQLITE_OK ){
+ /* This case occurs after failing to recompile an sql statement.
+ ** The error message from the SQL compiler has already been loaded
+ ** into the database handle. This block copies the error message
+ ** from the database handle into the statement and sets the statement
+ ** program counter to 0 to ensure that when the statement is
+ ** finalized or reset the parser error message is available via
+ ** sqlite3_errmsg() and sqlite3_errcode().
+ */
+ const char *zErr = (const char *)sqlite3_value_text(db->pErr);
+ sqlite3DbFree(db, v->zErrMsg);
+ if( !db->mallocFailed ){
+ v->zErrMsg = sqlite3DbStrDup(db, zErr);
+ v->rc = rc = sqlite3ApiExit(db, rc);
+ } else {
+ v->zErrMsg = 0;
+ v->rc = rc = SQLITE_NOMEM_BKPT;
+ }
+ break;
+ }
sqlite3_reset(pStmt);
if( savedPc>=0 ) v->doingRerun = 1;
assert( v->expired==0 );
}
- if( rc2!=SQLITE_OK ){
- /* This case occurs after failing to recompile an sql statement.
- ** The error message from the SQL compiler has already been loaded
- ** into the database handle. This block copies the error message
- ** from the database handle into the statement and sets the statement
- ** program counter to 0 to ensure that when the statement is
- ** finalized or reset the parser error message is available via
- ** sqlite3_errmsg() and sqlite3_errcode().
- */
- const char *zErr = (const char *)sqlite3_value_text(db->pErr);
- sqlite3DbFree(db, v->zErrMsg);
- if( !db->mallocFailed ){
- v->zErrMsg = sqlite3DbStrDup(db, zErr);
- v->rc = rc2;
- } else {
- v->zErrMsg = 0;
- v->rc = rc = SQLITE_NOMEM_BKPT;
- }
- }
- rc = sqlite3ApiExit(db, rc);
sqlite3_mutex_leave(db->mutex);
return rc;
}
@@ -77369,7 +78206,7 @@ static int vdbeUnbind(Vdbe *p, int i){
** as if there had been a schema change, on the first sqlite3_step() call
** following any change to the bindings of that parameter.
*/
- assert( p->isPrepareV2 || p->expmask==0 );
+ assert( (p->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 || p->expmask==0 );
if( p->expmask!=0 && (p->expmask & (i>=31 ? 0x80000000 : (u32)1<<i))!=0 ){
p->expired = 1;
}
@@ -77399,8 +78236,10 @@ static int bindText(
if( rc==SQLITE_OK && encoding!=0 ){
rc = sqlite3VdbeChangeEncoding(pVar, ENC(p->db));
}
- sqlite3Error(p->db, rc);
- rc = sqlite3ApiExit(p->db, rc);
+ if( rc ){
+ sqlite3Error(p->db, rc);
+ rc = sqlite3ApiExit(p->db, rc);
+ }
}
sqlite3_mutex_leave(p->db->mutex);
}else if( xDel!=SQLITE_STATIC && xDel!=SQLITE_TRANSIENT ){
@@ -77471,6 +78310,24 @@ SQLITE_API int sqlite3_bind_null(sqlite3_stmt *pStmt, int i){
}
return rc;
}
+SQLITE_API int sqlite3_bind_pointer(
+ sqlite3_stmt *pStmt,
+ int i,
+ void *pPtr,
+ const char *zPTtype,
+ void (*xDestructor)(void*)
+){
+ int rc;
+ Vdbe *p = (Vdbe*)pStmt;
+ rc = vdbeUnbind(p, i);
+ if( rc==SQLITE_OK ){
+ sqlite3VdbeMemSetPointer(&p->aVar[i-1], pPtr, zPTtype, xDestructor);
+ sqlite3_mutex_leave(p->db->mutex);
+ }else if( xDestructor ){
+ xDestructor(pPtr);
+ }
+ return rc;
+}
SQLITE_API int sqlite3_bind_text(
sqlite3_stmt *pStmt,
int i,
@@ -77633,11 +78490,11 @@ SQLITE_API int sqlite3_transfer_bindings(sqlite3_stmt *pFromStmt, sqlite3_stmt *
if( pFrom->nVar!=pTo->nVar ){
return SQLITE_ERROR;
}
- assert( pTo->isPrepareV2 || pTo->expmask==0 );
+ assert( (pTo->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 || pTo->expmask==0 );
if( pTo->expmask ){
pTo->expired = 1;
}
- assert( pFrom->isPrepareV2 || pFrom->expmask==0 );
+ assert( (pFrom->prepFlags & SQLITE_PREPARE_SAVESQL)!=0 || pFrom->expmask==0 );
if( pFrom->expmask ){
pFrom->expired = 1;
}
@@ -77707,8 +78564,19 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt *pStmt, int op, int resetFlag){
return 0;
}
#endif
- v = pVdbe->aCounter[op];
- if( resetFlag ) pVdbe->aCounter[op] = 0;
+ if( op==SQLITE_STMTSTATUS_MEMUSED ){
+ sqlite3 *db = pVdbe->db;
+ sqlite3_mutex_enter(db->mutex);
+ v = 0;
+ db->pnBytesFreed = (int*)&v;
+ sqlite3VdbeClearObject(db, pVdbe);
+ sqlite3DbFree(db, pVdbe);
+ db->pnBytesFreed = 0;
+ sqlite3_mutex_leave(db->mutex);
+ }else{
+ v = pVdbe->aCounter[op];
+ if( resetFlag ) pVdbe->aCounter[op] = 0;
+ }
return (int)v;
}
@@ -77760,7 +78628,7 @@ static UnpackedRecord *vdbeUnpackRecord(
pRet = sqlite3VdbeAllocUnpackedRecord(pKeyInfo);
if( pRet ){
- memset(pRet->aMem, 0, sizeof(Mem)*(pKeyInfo->nField+1));
+ memset(pRet->aMem, 0, sizeof(Mem)*(pKeyInfo->nKeyField+1));
sqlite3VdbeRecordUnpack(pKeyInfo, nKey, pKey, pRet);
}
return pRet;
@@ -77833,7 +78701,7 @@ SQLITE_API int sqlite3_preupdate_old(sqlite3 *db, int iIdx, sqlite3_value **ppVa
*/
SQLITE_API int sqlite3_preupdate_count(sqlite3 *db){
PreUpdate *p = db->pPreUpdate;
- return (p ? p->keyinfo.nField : 0);
+ return (p ? p->keyinfo.nKeyField : 0);
}
#endif /* SQLITE_ENABLE_PREUPDATE_HOOK */
@@ -78086,7 +78954,7 @@ SQLITE_PRIVATE char *sqlite3VdbeExpandSql(
Mem *pVar; /* Value of a host parameter */
StrAccum out; /* Accumulate the output here */
#ifndef SQLITE_OMIT_UTF16
- Mem utf8; /* Used to convert UTF16 parameters into UTF8 for display */
+ Mem utf8; /* Used to convert UTF16 into UTF8 for display */
#endif
char zBase[100]; /* Initial working space */
@@ -78555,7 +79423,7 @@ static u16 SQLITE_NOINLINE computeNumericType(Mem *pMem){
if( sqlite3AtoF(pMem->z, &pMem->u.r, pMem->n, pMem->enc)==0 ){
return 0;
}
- if( sqlite3Atoi64(pMem->z, &pMem->u.i, pMem->n, pMem->enc)==SQLITE_OK ){
+ if( sqlite3Atoi64(pMem->z, &pMem->u.i, pMem->n, pMem->enc)==0 ){
return MEM_Int;
}
return MEM_Real;
@@ -78863,7 +79731,7 @@ SQLITE_PRIVATE int sqlite3VdbeExec(
int iCompare = 0; /* Result of last comparison */
unsigned nVmStep = 0; /* Number of virtual machine steps */
#ifndef SQLITE_OMIT_PROGRESS_CALLBACK
- unsigned nProgressLimit = 0;/* Invoke xProgress() when nVmStep reaches this */
+ unsigned nProgressLimit; /* Invoke xProgress() when nVmStep reaches this */
#endif
Mem *aMem = p->aMem; /* Copy of p->aMem */
Mem *pIn1 = 0; /* 1st input operand */
@@ -78895,6 +79763,8 @@ SQLITE_PRIVATE int sqlite3VdbeExec(
u32 iPrior = p->aCounter[SQLITE_STMTSTATUS_VM_STEP];
assert( 0 < db->nProgressOps );
nProgressLimit = db->nProgressOps - (iPrior % db->nProgressOps);
+ }else{
+ nProgressLimit = 0xffffffff;
}
#endif
#ifdef SQLITE_DEBUG
@@ -79072,7 +79942,7 @@ check_for_interrupt:
** If the progress callback returns non-zero, exit the virtual machine with
** a return code SQLITE_ABORT.
*/
- if( db->xProgress!=0 && nVmStep>=nProgressLimit ){
+ if( nVmStep>=nProgressLimit && db->xProgress!=0 ){
assert( db->nProgressOps!=0 );
nProgressLimit = nVmStep + db->nProgressOps - (nVmStep%db->nProgressOps);
if( db->xProgress(db->pProgressArg) ){
@@ -79614,7 +80484,7 @@ case OP_ResultRow: {
/* Run the progress counter just before returning.
*/
if( db->xProgress!=0
- && nVmStep>=nProgressLimit
+ && nVmStep>=nProgressLimit
&& db->xProgress(db->pProgressArg)!=0
){
rc = SQLITE_INTERRUPT;
@@ -79878,117 +80748,6 @@ case OP_CollSeq: {
break;
}
-/* Opcode: Function0 P1 P2 P3 P4 P5
-** Synopsis: r[P3]=func(r[P2@P5])
-**
-** Invoke a user function (P4 is a pointer to a FuncDef object that
-** defines the function) with P5 arguments taken from register P2 and
-** successors. The result of the function is stored in register P3.
-** Register P3 must not be one of the function inputs.
-**
-** P1 is a 32-bit bitmask indicating whether or not each argument to the
-** function was determined to be constant at compile time. If the first
-** argument was constant then bit 0 of P1 is set. This is used to determine
-** whether meta data associated with a user function argument using the
-** sqlite3_set_auxdata() API may be safely retained until the next
-** invocation of this opcode.
-**
-** See also: Function, AggStep, AggFinal
-*/
-/* Opcode: Function P1 P2 P3 P4 P5
-** Synopsis: r[P3]=func(r[P2@P5])
-**
-** Invoke a user function (P4 is a pointer to an sqlite3_context object that
-** contains a pointer to the function to be run) with P5 arguments taken
-** from register P2 and successors. The result of the function is stored
-** in register P3. Register P3 must not be one of the function inputs.
-**
-** P1 is a 32-bit bitmask indicating whether or not each argument to the
-** function was determined to be constant at compile time. If the first
-** argument was constant then bit 0 of P1 is set. This is used to determine
-** whether meta data associated with a user function argument using the
-** sqlite3_set_auxdata() API may be safely retained until the next
-** invocation of this opcode.
-**
-** SQL functions are initially coded as OP_Function0 with P4 pointing
-** to a FuncDef object. But on first evaluation, the P4 operand is
-** automatically converted into an sqlite3_context object and the operation
-** changed to this OP_Function opcode. In this way, the initialization of
-** the sqlite3_context object occurs only once, rather than once for each
-** evaluation of the function.
-**
-** See also: Function0, AggStep, AggFinal
-*/
-case OP_Function0: {
- int n;
- sqlite3_context *pCtx;
-
- assert( pOp->p4type==P4_FUNCDEF );
- n = pOp->p5;
- assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) );
- assert( n==0 || (pOp->p2>0 && pOp->p2+n<=(p->nMem+1 - p->nCursor)+1) );
- assert( pOp->p3<pOp->p2 || pOp->p3>=pOp->p2+n );
- pCtx = sqlite3DbMallocRawNN(db, sizeof(*pCtx) + (n-1)*sizeof(sqlite3_value*));
- if( pCtx==0 ) goto no_mem;
- pCtx->pOut = 0;
- pCtx->pFunc = pOp->p4.pFunc;
- pCtx->iOp = (int)(pOp - aOp);
- pCtx->pVdbe = p;
- pCtx->argc = n;
- pOp->p4type = P4_FUNCCTX;
- pOp->p4.pCtx = pCtx;
- pOp->opcode = OP_Function;
- /* Fall through into OP_Function */
-}
-case OP_Function: {
- int i;
- sqlite3_context *pCtx;
-
- assert( pOp->p4type==P4_FUNCCTX );
- pCtx = pOp->p4.pCtx;
-
- /* If this function is inside of a trigger, the register array in aMem[]
- ** might change from one evaluation to the next. The next block of code
- ** checks to see if the register array has changed, and if so it
- ** reinitializes the relavant parts of the sqlite3_context object */
- pOut = &aMem[pOp->p3];
- if( pCtx->pOut != pOut ){
- pCtx->pOut = pOut;
- for(i=pCtx->argc-1; i>=0; i--) pCtx->argv[i] = &aMem[pOp->p2+i];
- }
-
- memAboutToChange(p, pOut);
-#ifdef SQLITE_DEBUG
- for(i=0; i<pCtx->argc; i++){
- assert( memIsValid(pCtx->argv[i]) );
- REGISTER_TRACE(pOp->p2+i, pCtx->argv[i]);
- }
-#endif
- MemSetTypeFlag(pOut, MEM_Null);
- pCtx->fErrorOrAux = 0;
- (*pCtx->pFunc->xSFunc)(pCtx, pCtx->argc, pCtx->argv);/* IMP: R-24505-23230 */
-
- /* If the function returned an error, throw an exception */
- if( pCtx->fErrorOrAux ){
- if( pCtx->isError ){
- sqlite3VdbeError(p, "%s", sqlite3_value_text(pOut));
- rc = pCtx->isError;
- }
- sqlite3VdbeDeleteAuxData(db, &p->pAuxData, pCtx->iOp, pOp->p1);
- if( rc ) goto abort_due_to_error;
- }
-
- /* Copy the result of the function into register P3 */
- if( pOut->flags & (MEM_Str|MEM_Blob) ){
- sqlite3VdbeChangeEncoding(pOut, encoding);
- if( sqlite3VdbeMemTooBig(pOut) ) goto too_big;
- }
-
- REGISTER_TRACE(pOp->p3, pOut);
- UPDATE_MAX_BLOBSIZE(pOut);
- break;
-}
-
/* Opcode: BitAnd P1 P2 P3 * *
** Synopsis: r[P3]=r[P1]&r[P2]
**
@@ -80354,13 +81113,23 @@ case OP_Ge: { /* same as TK_GE, jump, in1, in3 */
res = sqlite3MemCompare(pIn3, pIn1, pOp->p4.pColl);
}
compare_op:
- switch( pOp->opcode ){
- case OP_Eq: res2 = res==0; break;
- case OP_Ne: res2 = res; break;
- case OP_Lt: res2 = res<0; break;
- case OP_Le: res2 = res<=0; break;
- case OP_Gt: res2 = res>0; break;
- default: res2 = res>=0; break;
+ /* At this point, res is negative, zero, or positive if reg[P1] is
+ ** less than, equal to, or greater than reg[P3], respectively. Compute
+ ** the answer to this operator in res2, depending on what the comparison
+ ** operator actually is. The next block of code depends on the fact
+ ** that the 6 comparison operators are consecutive integers in this
+ ** order: NE, EQ, GT, LE, LT, GE */
+ assert( OP_Eq==OP_Ne+1 ); assert( OP_Gt==OP_Ne+2 ); assert( OP_Le==OP_Ne+3 );
+ assert( OP_Lt==OP_Ne+4 ); assert( OP_Ge==OP_Ne+5 );
+ if( res<0 ){ /* ne, eq, gt, le, lt, ge */
+ static const unsigned char aLTb[] = { 1, 0, 0, 1, 1, 0 };
+ res2 = aLTb[pOp->opcode - OP_Ne];
+ }else if( res==0 ){
+ static const unsigned char aEQb[] = { 0, 1, 0, 1, 0, 1 };
+ res2 = aEQb[pOp->opcode - OP_Ne];
+ }else{
+ static const unsigned char aGTb[] = { 1, 0, 1, 0, 0, 1 };
+ res2 = aGTb[pOp->opcode - OP_Ne];
}
/* Undo any changes made by applyAffinity() to the input registers. */
@@ -80372,7 +81141,6 @@ compare_op:
if( pOp->p5 & SQLITE_STOREP2 ){
pOut = &aMem[pOp->p2];
iCompare = res;
- res2 = res2!=0; /* For this path res2 must be exactly 0 or 1 */
if( (pOp->p5 & SQLITE_KEEPNULL)!=0 ){
/* The KEEPNULL flag prevents OP_Eq from overwriting a NULL with 1
** and prevents OP_Ne from overwriting NULL with 0. This flag
@@ -80503,7 +81271,7 @@ case OP_Compare: {
assert( memIsValid(&aMem[p2+idx]) );
REGISTER_TRACE(p1+idx, &aMem[p1+idx]);
REGISTER_TRACE(p2+idx, &aMem[p2+idx]);
- assert( i<pKeyInfo->nField );
+ assert( i<pKeyInfo->nKeyField );
pColl = pKeyInfo->aColl[i];
bRev = pKeyInfo->aSortOrder[i];
iCompare = sqlite3MemCompare(&aMem[p1+idx], &aMem[p2+idx], pColl);
@@ -80776,16 +81544,16 @@ case OP_Column: {
const u8 *zData; /* Part of the record being decoded */
const u8 *zHdr; /* Next unparsed byte of the header */
const u8 *zEndHdr; /* Pointer to first byte after the header */
- u32 offset; /* Offset into the data */
u64 offset64; /* 64-bit offset */
- u32 avail; /* Number of bytes of available data */
u32 t; /* A type code from the record header */
Mem *pReg; /* PseudoTable input register */
pC = p->apCsr[pOp->p1];
p2 = pOp->p2;
- /* If the cursor cache is stale, bring it up-to-date */
+ /* If the cursor cache is stale (meaning it is not currently point at
+ ** the correct row) then bring it up-to-date by doing the necessary
+ ** B-Tree seek. */
rc = sqlite3VdbeCursorMoveto(&pC, &p2);
if( rc ) goto abort_due_to_error;
@@ -80803,11 +81571,13 @@ case OP_Column: {
if( pC->cacheStatus!=p->cacheCtr ){ /*OPTIMIZATION-IF-FALSE*/
if( pC->nullRow ){
if( pC->eCurType==CURTYPE_PSEUDO ){
- assert( pC->uc.pseudoTableReg>0 );
- pReg = &aMem[pC->uc.pseudoTableReg];
+ /* For the special case of as pseudo-cursor, the seekResult field
+ ** identifies the register that holds the record */
+ assert( pC->seekResult>0 );
+ pReg = &aMem[pC->seekResult];
assert( pReg->flags & MEM_Blob );
assert( memIsValid(pReg) );
- pC->payloadSize = pC->szRow = avail = pReg->n;
+ pC->payloadSize = pC->szRow = pReg->n;
pC->aRow = (u8*)pReg->z;
}else{
sqlite3VdbeMemSetNull(pDest);
@@ -80819,23 +81589,19 @@ case OP_Column: {
assert( pCrsr );
assert( sqlite3BtreeCursorIsValid(pCrsr) );
pC->payloadSize = sqlite3BtreePayloadSize(pCrsr);
- pC->aRow = sqlite3BtreePayloadFetch(pCrsr, &avail);
- assert( avail<=65536 ); /* Maximum page size is 64KiB */
- if( pC->payloadSize <= (u32)avail ){
- pC->szRow = pC->payloadSize;
- }else if( pC->payloadSize > (u32)db->aLimit[SQLITE_LIMIT_LENGTH] ){
+ pC->aRow = sqlite3BtreePayloadFetch(pCrsr, &pC->szRow);
+ assert( pC->szRow<=pC->payloadSize );
+ assert( pC->szRow<=65536 ); /* Maximum page size is 64KiB */
+ if( pC->payloadSize > (u32)db->aLimit[SQLITE_LIMIT_LENGTH] ){
goto too_big;
- }else{
- pC->szRow = avail;
}
}
pC->cacheStatus = p->cacheCtr;
- pC->iHdrOffset = getVarint32(pC->aRow, offset);
+ pC->iHdrOffset = getVarint32(pC->aRow, aOffset[0]);
pC->nHdrParsed = 0;
- aOffset[0] = offset;
- if( avail<offset ){ /*OPTIMIZATION-IF-FALSE*/
+ if( pC->szRow<aOffset[0] ){ /*OPTIMIZATION-IF-FALSE*/
/* pC->aRow does not have to hold the entire row, but it does at least
** need to cover the header of the record. If pC->aRow does not contain
** the complete header, then set it to zero, forcing the header to be
@@ -80852,17 +81618,26 @@ case OP_Column: {
** 3-byte type for each of the maximum of 32768 columns plus three
** extra bytes for the header length itself. 32768*3 + 3 = 98307.
*/
- if( offset > 98307 || offset > pC->payloadSize ){
- rc = SQLITE_CORRUPT_BKPT;
- goto abort_due_to_error;
+ if( aOffset[0] > 98307 || aOffset[0] > pC->payloadSize ){
+ goto op_column_corrupt;
}
- }else if( offset>0 ){ /*OPTIMIZATION-IF-TRUE*/
- /* The following goto is an optimization. It can be omitted and
- ** everything will still work. But OP_Column is measurably faster
- ** by skipping the subsequent conditional, which is always true.
+ }else{
+ /* This is an optimization. By skipping over the first few tests
+ ** (ex: pC->nHdrParsed<=p2) in the next section, we achieve a
+ ** measurable performance gain.
+ **
+ ** This branch is taken even if aOffset[0]==0. Such a record is never
+ ** generated by SQLite, and could be considered corruption, but we
+ ** accept it for historical reasons. When aOffset[0]==0, the code this
+ ** branch jumps to reads past the end of the record, but never more
+ ** than a few bytes. Even if the record occurs at the end of the page
+ ** content area, the "page header" comes after the page content and so
+ ** this overread is harmless. Similar overreads can occur for a corrupt
+ ** database file.
*/
zData = pC->aRow;
assert( pC->nHdrParsed<=p2 ); /* Conditional skipped */
+ testcase( aOffset[0]==0 );
goto op_column_read_header;
}
}
@@ -80891,6 +81666,7 @@ case OP_Column: {
offset64 = aOffset[i];
zHdr = zData + pC->iHdrOffset;
zEndHdr = zData + aOffset[0];
+ testcase( zHdr>=zEndHdr );
do{
if( (t = zHdr[0])<0x80 ){
zHdr++;
@@ -80911,9 +81687,13 @@ case OP_Column: {
if( (zHdr>=zEndHdr && (zHdr>zEndHdr || offset64!=pC->payloadSize))
|| (offset64 > pC->payloadSize)
){
- if( pC->aRow==0 ) sqlite3VdbeMemRelease(&sMem);
- rc = SQLITE_CORRUPT_BKPT;
- goto abort_due_to_error;
+ if( aOffset[0]==0 ){
+ i = 0;
+ zHdr = zEndHdr;
+ }else{
+ if( pC->aRow==0 ) sqlite3VdbeMemRelease(&sMem);
+ goto op_column_corrupt;
+ }
}
pC->nHdrParsed = i;
@@ -81007,6 +81787,15 @@ op_column_out:
UPDATE_MAX_BLOBSIZE(pDest);
REGISTER_TRACE(pOp->p3, pDest);
break;
+
+op_column_corrupt:
+ if( aOp[0].p3>0 ){
+ pOp = &aOp[aOp[0].p3-1];
+ break;
+ }else{
+ rc = SQLITE_CORRUPT_BKPT;
+ goto abort_due_to_error;
+ }
}
/* Opcode: Affinity P1 P2 * P4 *
@@ -81347,7 +82136,7 @@ case OP_Savepoint: {
int isSchemaChange;
iSavepoint = db->nSavepoint - iSavepoint - 1;
if( p1==SAVEPOINT_ROLLBACK ){
- isSchemaChange = (db->flags & SQLITE_InternChanges)!=0;
+ isSchemaChange = (db->mDbFlags & DBFLAG_SchemaChange)!=0;
for(ii=0; ii<db->nDb; ii++){
rc = sqlite3BtreeTripAllCursors(db->aDb[ii].pBt,
SQLITE_ABORT_ROLLBACK,
@@ -81366,7 +82155,7 @@ case OP_Savepoint: {
if( isSchemaChange ){
sqlite3ExpirePreparedStatements(db);
sqlite3ResetAllSchemasOfConnection(db);
- db->flags = (db->flags | SQLITE_InternChanges);
+ db->mDbFlags |= DBFLAG_SchemaChange;
}
}
@@ -81646,7 +82435,7 @@ case OP_SetCookie: {
if( pOp->p2==BTREE_SCHEMA_VERSION ){
/* When the schema cookie changes, record the new cookie internally */
pDb->pSchema->schema_cookie = pOp->p3;
- db->flags |= SQLITE_InternChanges;
+ db->mDbFlags |= DBFLAG_SchemaChange;
}else if( pOp->p2==BTREE_FILE_FORMAT ){
/* Record changes in the file format */
pDb->pSchema->file_format = pOp->p3;
@@ -81785,7 +82574,7 @@ case OP_OpenWrite:
assert( (pIn2->flags & MEM_Int)!=0 );
sqlite3VdbeMemIntegerify(pIn2);
p2 = (int)pIn2->u.i;
- /* The p2 value always comes from a prior OP_CreateTable opcode and
+ /* The p2 value always comes from a prior OP_CreateBtree opcode and
** that opcode will always set the p2 value to 2 or more or else fail.
** If there were a failure, the prepared statement would have halted
** before reaching this instruction. */
@@ -81795,7 +82584,7 @@ case OP_OpenWrite:
pKeyInfo = pOp->p4.pKeyInfo;
assert( pKeyInfo->enc==ENC(db) );
assert( pKeyInfo->db==db );
- nField = pKeyInfo->nField+pKeyInfo->nXField;
+ nField = pKeyInfo->nAllField;
}else if( pOp->p4type==P4_INT32 ){
nField = pOp->p4.i;
}
@@ -82006,8 +82795,13 @@ case OP_OpenPseudo: {
pCx = allocateCursor(p, pOp->p1, pOp->p3, -1, CURTYPE_PSEUDO);
if( pCx==0 ) goto no_mem;
pCx->nullRow = 1;
- pCx->uc.pseudoTableReg = pOp->p2;
+ pCx->seekResult = pOp->p2;
pCx->isTable = 1;
+ /* Give this pseudo-cursor a fake BtCursor pointer so that pCx
+ ** can be safely passed to sqlite3VdbeCursorMoveto(). This avoids a test
+ ** for pCx->eCurType==CURTYPE_BTREE inside of sqlite3VdbeCursorMoveto()
+ ** which is a performance optimization */
+ pCx->uc.pCursor = sqlite3BtreeFakeValidCursor();
assert( pOp->p5==0 );
break;
}
@@ -82267,8 +83061,15 @@ case OP_SeekGT: { /* jump, in3 */
if( oc>=OP_SeekGE ){ assert( oc==OP_SeekGE || oc==OP_SeekGT );
if( res<0 || (res==0 && oc==OP_SeekGT) ){
res = 0;
- rc = sqlite3BtreeNext(pC->uc.pCursor, &res);
- if( rc!=SQLITE_OK ) goto abort_due_to_error;
+ rc = sqlite3BtreeNext(pC->uc.pCursor, 0);
+ if( rc!=SQLITE_OK ){
+ if( rc==SQLITE_DONE ){
+ rc = SQLITE_OK;
+ res = 1;
+ }else{
+ goto abort_due_to_error;
+ }
+ }
}else{
res = 0;
}
@@ -82276,8 +83077,15 @@ case OP_SeekGT: { /* jump, in3 */
assert( oc==OP_SeekLT || oc==OP_SeekLE );
if( res>0 || (res==0 && oc==OP_SeekLT) ){
res = 0;
- rc = sqlite3BtreePrevious(pC->uc.pCursor, &res);
- if( rc!=SQLITE_OK ) goto abort_due_to_error;
+ rc = sqlite3BtreePrevious(pC->uc.pCursor, 0);
+ if( rc!=SQLITE_OK ){
+ if( rc==SQLITE_DONE ){
+ rc = SQLITE_OK;
+ res = 1;
+ }else{
+ goto abort_due_to_error;
+ }
+ }
}else{
/* res might be negative because the table is empty. Check to
** see if this is the case.
@@ -82785,14 +83593,9 @@ case OP_InsertInt: {
if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++;
if( pOp->p5 & OPFLAG_LASTROWID ) db->lastRowid = x.nKey;
- if( pData->flags & MEM_Null ){
- x.pData = 0;
- x.nData = 0;
- }else{
- assert( pData->flags & (MEM_Blob|MEM_Str) );
- x.pData = pData->z;
- x.nData = pData->n;
- }
+ assert( pData->flags & (MEM_Blob|MEM_Str) );
+ x.pData = pData->z;
+ x.nData = pData->n;
seekResult = ((pOp->p5 & OPFLAG_USESEEKRESULT) ? pC->seekResult : 0);
if( pData->flags & MEM_Zero ){
x.nZero = pData->u.nZero;
@@ -83159,7 +83962,17 @@ case OP_NullRow: {
break;
}
-/* Opcode: Last P1 P2 P3 * *
+/* Opcode: SeekEnd P1 * * * *
+**
+** Position cursor P1 at the end of the btree for the purpose of
+** appending a new entry onto the btree.
+**
+** It is assumed that the cursor is used only for appending and so
+** if the cursor is valid, then the cursor must already be pointing
+** at the end of the btree and so no changes are made to
+** the cursor.
+*/
+/* Opcode: Last P1 P2 * * *
**
** The next use of the Rowid or Column or Prev instruction for P1
** will refer to the last entry in the database table or index.
@@ -83170,14 +83983,8 @@ case OP_NullRow: {
** This opcode leaves the cursor configured to move in reverse order,
** from the end toward the beginning. In other words, the cursor is
** configured to use Prev, not Next.
-**
-** If P3 is -1, then the cursor is positioned at the end of the btree
-** for the purpose of appending a new entry onto the btree. In that
-** case P2 must be 0. It is assumed that the cursor is used only for
-** appending and so if the cursor is valid, then the cursor must already
-** be pointing at the end of the btree and so no changes are made to
-** the cursor.
*/
+case OP_SeekEnd:
case OP_Last: { /* jump */
VdbeCursor *pC;
BtCursor *pCrsr;
@@ -83190,22 +83997,24 @@ case OP_Last: { /* jump */
pCrsr = pC->uc.pCursor;
res = 0;
assert( pCrsr!=0 );
- pC->seekResult = pOp->p3;
#ifdef SQLITE_DEBUG
- pC->seekOp = OP_Last;
+ pC->seekOp = pOp->opcode;
#endif
- if( pOp->p3==0 || !sqlite3BtreeCursorIsValidNN(pCrsr) ){
- rc = sqlite3BtreeLast(pCrsr, &res);
- pC->nullRow = (u8)res;
- pC->deferredMoveto = 0;
- pC->cacheStatus = CACHE_STALE;
- if( rc ) goto abort_due_to_error;
- if( pOp->p2>0 ){
- VdbeBranchTaken(res!=0,2);
- if( res ) goto jump_to_p2;
- }
- }else{
+ if( pOp->opcode==OP_SeekEnd ){
assert( pOp->p2==0 );
+ pC->seekResult = -1;
+ if( sqlite3BtreeCursorIsValidNN(pCrsr) ){
+ break;
+ }
+ }
+ rc = sqlite3BtreeLast(pCrsr, &res);
+ pC->nullRow = (u8)res;
+ pC->deferredMoveto = 0;
+ pC->cacheStatus = CACHE_STALE;
+ if( rc ) goto abort_due_to_error;
+ if( pOp->p2>0 ){
+ VdbeBranchTaken(res!=0,2);
+ if( res ) goto jump_to_p2;
}
break;
}
@@ -83383,12 +84192,10 @@ case OP_Rewind: { /* jump */
*/
case OP_SorterNext: { /* jump */
VdbeCursor *pC;
- int res;
pC = p->apCsr[pOp->p1];
assert( isSorter(pC) );
- res = 0;
- rc = sqlite3VdbeSorterNext(db, pC, &res);
+ rc = sqlite3VdbeSorterNext(db, pC);
goto next_tail;
case OP_PrevIfOpen: /* jump */
case OP_NextIfOpen: /* jump */
@@ -83399,12 +84206,9 @@ case OP_Next: /* jump */
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
assert( pOp->p5<ArraySize(p->aCounter) );
pC = p->apCsr[pOp->p1];
- res = pOp->p3;
assert( pC!=0 );
assert( pC->deferredMoveto==0 );
assert( pC->eCurType==CURTYPE_BTREE );
- assert( res==0 || (res==1 && pC->isTable==0) );
- testcase( res==1 );
assert( pOp->opcode!=OP_Next || pOp->p4.xAdvance==sqlite3BtreeNext );
assert( pOp->opcode!=OP_Prev || pOp->p4.xAdvance==sqlite3BtreePrevious );
assert( pOp->opcode!=OP_NextIfOpen || pOp->p4.xAdvance==sqlite3BtreeNext );
@@ -83419,21 +84223,21 @@ case OP_Next: /* jump */
|| pC->seekOp==OP_SeekLT || pC->seekOp==OP_SeekLE
|| pC->seekOp==OP_Last );
- rc = pOp->p4.xAdvance(pC->uc.pCursor, &res);
+ rc = pOp->p4.xAdvance(pC->uc.pCursor, pOp->p3);
next_tail:
pC->cacheStatus = CACHE_STALE;
- VdbeBranchTaken(res==0,2);
- if( rc ) goto abort_due_to_error;
- if( res==0 ){
+ VdbeBranchTaken(rc==SQLITE_OK,2);
+ if( rc==SQLITE_OK ){
pC->nullRow = 0;
p->aCounter[pOp->p5]++;
#ifdef SQLITE_TEST
sqlite3_search_count++;
#endif
goto jump_to_p2_and_check_for_interrupt;
- }else{
- pC->nullRow = 1;
}
+ if( rc!=SQLITE_DONE ) goto abort_due_to_error;
+ rc = SQLITE_OK;
+ pC->nullRow = 1;
goto check_for_interrupt;
}
@@ -83544,8 +84348,8 @@ case OP_IdxDelete: {
break;
}
-/* Opcode: Seek P1 * P3 P4 *
-** Synopsis: Move P3 to P1.rowid
+/* Opcode: DeferredSeek P1 * P3 P4 *
+** Synopsis: Move P3 to P1.rowid if needed
**
** P1 is an open index cursor and P3 is a cursor on the corresponding
** table. This opcode does a deferred seek of the P3 table cursor
@@ -83572,11 +84376,11 @@ case OP_IdxDelete: {
**
** See also: Rowid, MakeRecord.
*/
-case OP_Seek:
-case OP_IdxRowid: { /* out2 */
- VdbeCursor *pC; /* The P1 index cursor */
- VdbeCursor *pTabCur; /* The P2 table cursor (OP_Seek only) */
- i64 rowid; /* Rowid that P1 current points to */
+case OP_DeferredSeek:
+case OP_IdxRowid: { /* out2 */
+ VdbeCursor *pC; /* The P1 index cursor */
+ VdbeCursor *pTabCur; /* The P2 table cursor (OP_DeferredSeek only) */
+ i64 rowid; /* Rowid that P1 current points to */
assert( pOp->p1>=0 && pOp->p1<p->nCursor );
pC = p->apCsr[pOp->p1];
@@ -83602,7 +84406,7 @@ case OP_IdxRowid: { /* out2 */
if( rc!=SQLITE_OK ){
goto abort_due_to_error;
}
- if( pOp->opcode==OP_Seek ){
+ if( pOp->opcode==OP_DeferredSeek ){
assert( pOp->p3>=0 && pOp->p3<p->nCursor );
pTabCur = p->apCsr[pOp->p3];
assert( pTabCur!=0 );
@@ -83839,50 +84643,28 @@ case OP_ResetSorter: {
break;
}
-/* Opcode: CreateTable P1 P2 * * *
-** Synopsis: r[P2]=root iDb=P1
-**
-** Allocate a new table in the main database file if P1==0 or in the
-** auxiliary database file if P1==1 or in an attached database if
-** P1>1. Write the root page number of the new table into
-** register P2
-**
-** The difference between a table and an index is this: A table must
-** have a 4-byte integer key and can have arbitrary data. An index
-** has an arbitrary key but no data.
-**
-** See also: CreateIndex
-*/
-/* Opcode: CreateIndex P1 P2 * * *
-** Synopsis: r[P2]=root iDb=P1
-**
-** Allocate a new index in the main database file if P1==0 or in the
-** auxiliary database file if P1==1 or in an attached database if
-** P1>1. Write the root page number of the new table into
-** register P2.
+/* Opcode: CreateBtree P1 P2 P3 * *
+** Synopsis: r[P2]=root iDb=P1 flags=P3
**
-** See documentation on OP_CreateTable for additional information.
+** Allocate a new b-tree in the main database file if P1==0 or in the
+** TEMP database file if P1==1 or in an attached database if
+** P1>1. The P3 argument must be 1 (BTREE_INTKEY) for a rowid table
+** it must be 2 (BTREE_BLOBKEY) for a index or WITHOUT ROWID table.
+** The root page number of the new b-tree is stored in register P2.
*/
-case OP_CreateIndex: /* out2 */
-case OP_CreateTable: { /* out2 */
+case OP_CreateBtree: { /* out2 */
int pgno;
- int flags;
Db *pDb;
pOut = out2Prerelease(p, pOp);
pgno = 0;
+ assert( pOp->p3==BTREE_INTKEY || pOp->p3==BTREE_BLOBKEY );
assert( pOp->p1>=0 && pOp->p1<db->nDb );
assert( DbMaskTest(p->btreeMask, pOp->p1) );
assert( p->readOnly==0 );
pDb = &db->aDb[pOp->p1];
assert( pDb->pBt!=0 );
- if( pOp->opcode==OP_CreateTable ){
- /* flags = BTREE_INTKEY; */
- flags = BTREE_INTKEY;
- }else{
- flags = BTREE_BLOBKEY;
- }
- rc = sqlite3BtreeCreateTable(pDb->pBt, &pgno, flags);
+ rc = sqlite3BtreeCreateTable(pDb->pBt, &pgno, pOp->p3);
if( rc ) goto abort_due_to_error;
pOut->u.i = pgno;
break;
@@ -84044,7 +84826,7 @@ case OP_IntegrityCk: {
nRoot = pOp->p2;
aRoot = pOp->p4.ai;
assert( nRoot>0 );
- assert( aRoot[nRoot]==0 );
+ assert( aRoot[0]==nRoot );
assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) );
pnErr = &aMem[pOp->p3];
assert( (pnErr->flags & MEM_Int)!=0 );
@@ -84052,7 +84834,7 @@ case OP_IntegrityCk: {
pIn1 = &aMem[pOp->p1];
assert( pOp->p5<db->nDb );
assert( DbMaskTest(p->btreeMask, pOp->p5) );
- z = sqlite3BtreeIntegrityCheck(db->aDb[pOp->p5].pBt, aRoot, nRoot,
+ z = sqlite3BtreeIntegrityCheck(db->aDb[pOp->p5].pBt, &aRoot[1], nRoot,
(int)pnErr->u.i+1, &nErr);
sqlite3VdbeMemSetNull(pIn1);
if( nErr==0 ){
@@ -84848,7 +85630,7 @@ case OP_Expire: {
*/
case OP_TableLock: {
u8 isWriteLock = (u8)pOp->p3;
- if( isWriteLock || 0==(db->flags&SQLITE_ReadUncommitted) ){
+ if( isWriteLock || 0==(db->flags&SQLITE_ReadUncommit) ){
int p1 = pOp->p1;
assert( p1>=0 && p1<db->nDb );
assert( DbMaskTest(p->btreeMask, p1) );
@@ -85277,8 +86059,123 @@ case OP_MaxPgcnt: { /* out2 */
}
#endif
+/* Opcode: Function0 P1 P2 P3 P4 P5
+** Synopsis: r[P3]=func(r[P2@P5])
+**
+** Invoke a user function (P4 is a pointer to a FuncDef object that
+** defines the function) with P5 arguments taken from register P2 and
+** successors. The result of the function is stored in register P3.
+** Register P3 must not be one of the function inputs.
+**
+** P1 is a 32-bit bitmask indicating whether or not each argument to the
+** function was determined to be constant at compile time. If the first
+** argument was constant then bit 0 of P1 is set. This is used to determine
+** whether meta data associated with a user function argument using the
+** sqlite3_set_auxdata() API may be safely retained until the next
+** invocation of this opcode.
+**
+** See also: Function, AggStep, AggFinal
+*/
+/* Opcode: Function P1 P2 P3 P4 P5
+** Synopsis: r[P3]=func(r[P2@P5])
+**
+** Invoke a user function (P4 is a pointer to an sqlite3_context object that
+** contains a pointer to the function to be run) with P5 arguments taken
+** from register P2 and successors. The result of the function is stored
+** in register P3. Register P3 must not be one of the function inputs.
+**
+** P1 is a 32-bit bitmask indicating whether or not each argument to the
+** function was determined to be constant at compile time. If the first
+** argument was constant then bit 0 of P1 is set. This is used to determine
+** whether meta data associated with a user function argument using the
+** sqlite3_set_auxdata() API may be safely retained until the next
+** invocation of this opcode.
+**
+** SQL functions are initially coded as OP_Function0 with P4 pointing
+** to a FuncDef object. But on first evaluation, the P4 operand is
+** automatically converted into an sqlite3_context object and the operation
+** changed to this OP_Function opcode. In this way, the initialization of
+** the sqlite3_context object occurs only once, rather than once for each
+** evaluation of the function.
+**
+** See also: Function0, AggStep, AggFinal
+*/
+case OP_PureFunc0:
+case OP_Function0: {
+ int n;
+ sqlite3_context *pCtx;
+
+ assert( pOp->p4type==P4_FUNCDEF );
+ n = pOp->p5;
+ assert( pOp->p3>0 && pOp->p3<=(p->nMem+1 - p->nCursor) );
+ assert( n==0 || (pOp->p2>0 && pOp->p2+n<=(p->nMem+1 - p->nCursor)+1) );
+ assert( pOp->p3<pOp->p2 || pOp->p3>=pOp->p2+n );
+ pCtx = sqlite3DbMallocRawNN(db, sizeof(*pCtx) + (n-1)*sizeof(sqlite3_value*));
+ if( pCtx==0 ) goto no_mem;
+ pCtx->pOut = 0;
+ pCtx->pFunc = pOp->p4.pFunc;
+ pCtx->iOp = (int)(pOp - aOp);
+ pCtx->pVdbe = p;
+ pCtx->argc = n;
+ pOp->p4type = P4_FUNCCTX;
+ pOp->p4.pCtx = pCtx;
+ assert( OP_PureFunc == OP_PureFunc0+2 );
+ assert( OP_Function == OP_Function0+2 );
+ pOp->opcode += 2;
+ /* Fall through into OP_Function */
+}
+case OP_PureFunc:
+case OP_Function: {
+ int i;
+ sqlite3_context *pCtx;
+
+ assert( pOp->p4type==P4_FUNCCTX );
+ pCtx = pOp->p4.pCtx;
+
+ /* If this function is inside of a trigger, the register array in aMem[]
+ ** might change from one evaluation to the next. The next block of code
+ ** checks to see if the register array has changed, and if so it
+ ** reinitializes the relavant parts of the sqlite3_context object */
+ pOut = &aMem[pOp->p3];
+ if( pCtx->pOut != pOut ){
+ pCtx->pOut = pOut;
+ for(i=pCtx->argc-1; i>=0; i--) pCtx->argv[i] = &aMem[pOp->p2+i];
+ }
+
+ memAboutToChange(p, pOut);
+#ifdef SQLITE_DEBUG
+ for(i=0; i<pCtx->argc; i++){
+ assert( memIsValid(pCtx->argv[i]) );
+ REGISTER_TRACE(pOp->p2+i, pCtx->argv[i]);
+ }
+#endif
+ MemSetTypeFlag(pOut, MEM_Null);
+ pCtx->fErrorOrAux = 0;
+ (*pCtx->pFunc->xSFunc)(pCtx, pCtx->argc, pCtx->argv);/* IMP: R-24505-23230 */
+
+ /* If the function returned an error, throw an exception */
+ if( pCtx->fErrorOrAux ){
+ if( pCtx->isError ){
+ sqlite3VdbeError(p, "%s", sqlite3_value_text(pOut));
+ rc = pCtx->isError;
+ }
+ sqlite3VdbeDeleteAuxData(db, &p->pAuxData, pCtx->iOp, pOp->p1);
+ if( rc ) goto abort_due_to_error;
+ }
-/* Opcode: Init P1 P2 * P4 *
+ /* Copy the result of the function into register P3 */
+ if( pOut->flags & (MEM_Str|MEM_Blob) ){
+ sqlite3VdbeChangeEncoding(pOut, encoding);
+ if( sqlite3VdbeMemTooBig(pOut) ) goto too_big;
+ }
+
+ REGISTER_TRACE(pOp->p3, pOut);
+ UPDATE_MAX_BLOBSIZE(pOut);
+ break;
+}
+
+
+/* Opcode: Init P1 P2 P3 P4 *
** Synopsis: Start at P2
**
** Programs contain a single instance of this opcode as the very first
@@ -85292,6 +86189,9 @@ case OP_MaxPgcnt: { /* out2 */
**
** Increment the value of P1 so that OP_Once opcodes will jump the
** first time they are evaluated for this run.
+**
+** If P3 is not zero, then it is an address to jump to if an SQLITE_CORRUPT
+** error is encountered.
*/
case OP_Init: { /* jump */
char *zTrace;
@@ -85356,6 +86256,7 @@ case OP_Init: { /* jump */
pOp->p1 = 0;
}
pOp->p1++;
+ p->aCounter[SQLITE_STMTSTATUS_RUN]++;
goto jump_to_p2;
}
@@ -85565,11 +86466,12 @@ static int blobSeekToRow(Incrblob *p, sqlite3_int64 iRow, char **pzErr){
v->aMem[1].u.i = iRow;
/* If the statement has been run before (and is paused at the OP_ResultRow)
- ** then back it up to the point where it does the OP_SeekRowid. This could
+ ** then back it up to the point where it does the OP_NotExists. This could
** have been down with an extra OP_Goto, but simply setting the program
** counter is faster. */
- if( v->pc>3 ){
- v->pc = 3;
+ if( v->pc>4 ){
+ v->pc = 4;
+ assert( v->aOp[v->pc].opcode==OP_NotExists );
rc = sqlite3VdbeExec(v);
}else{
rc = sqlite3_step(p->pStmt);
@@ -85631,8 +86533,8 @@ SQLITE_API int sqlite3_blob_open(
int rc = SQLITE_OK;
char *zErr = 0;
Table *pTab;
- Parse *pParse = 0;
Incrblob *pBlob = 0;
+ Parse sParse;
#ifdef SQLITE_ENABLE_API_ARMOR
if( ppBlob==0 ){
@@ -85650,37 +86552,34 @@ SQLITE_API int sqlite3_blob_open(
sqlite3_mutex_enter(db->mutex);
pBlob = (Incrblob *)sqlite3DbMallocZero(db, sizeof(Incrblob));
- if( !pBlob ) goto blob_open_out;
- pParse = sqlite3StackAllocRaw(db, sizeof(*pParse));
- if( !pParse ) goto blob_open_out;
-
do {
- memset(pParse, 0, sizeof(Parse));
- pParse->db = db;
+ memset(&sParse, 0, sizeof(Parse));
+ if( !pBlob ) goto blob_open_out;
+ sParse.db = db;
sqlite3DbFree(db, zErr);
zErr = 0;
sqlite3BtreeEnterAll(db);
- pTab = sqlite3LocateTable(pParse, 0, zTable, zDb);
+ pTab = sqlite3LocateTable(&sParse, 0, zTable, zDb);
if( pTab && IsVirtual(pTab) ){
pTab = 0;
- sqlite3ErrorMsg(pParse, "cannot open virtual table: %s", zTable);
+ sqlite3ErrorMsg(&sParse, "cannot open virtual table: %s", zTable);
}
if( pTab && !HasRowid(pTab) ){
pTab = 0;
- sqlite3ErrorMsg(pParse, "cannot open table without rowid: %s", zTable);
+ sqlite3ErrorMsg(&sParse, "cannot open table without rowid: %s", zTable);
}
#ifndef SQLITE_OMIT_VIEW
if( pTab && pTab->pSelect ){
pTab = 0;
- sqlite3ErrorMsg(pParse, "cannot open view: %s", zTable);
+ sqlite3ErrorMsg(&sParse, "cannot open view: %s", zTable);
}
#endif
if( !pTab ){
- if( pParse->zErrMsg ){
+ if( sParse.zErrMsg ){
sqlite3DbFree(db, zErr);
- zErr = pParse->zErrMsg;
- pParse->zErrMsg = 0;
+ zErr = sParse.zErrMsg;
+ sParse.zErrMsg = 0;
}
rc = SQLITE_ERROR;
sqlite3BtreeLeaveAll(db);
@@ -85744,7 +86643,7 @@ SQLITE_API int sqlite3_blob_open(
}
}
- pBlob->pStmt = (sqlite3_stmt *)sqlite3VdbeCreate(pParse);
+ pBlob->pStmt = (sqlite3_stmt *)sqlite3VdbeCreate(&sParse);
assert( pBlob->pStmt || db->mallocFailed );
if( pBlob->pStmt ){
@@ -85780,7 +86679,8 @@ SQLITE_API int sqlite3_blob_open(
sqlite3VdbeAddOp4Int(v, OP_Transaction, iDb, wrFlag,
pTab->pSchema->schema_cookie,
pTab->pSchema->iGeneration);
- sqlite3VdbeChangeP5(v, 1);
+ sqlite3VdbeChangeP5(v, 1);
+ assert( sqlite3VdbeCurrentAddr(v)==2 || db->mallocFailed );
aOp = sqlite3VdbeAddOpList(v, ArraySize(openBlob), openBlob, iLn);
/* Make sure a mutex is held on the table to be accessed */
@@ -85795,7 +86695,7 @@ SQLITE_API int sqlite3_blob_open(
aOp[0].p1 = iDb;
aOp[0].p2 = pTab->tnum;
aOp[0].p3 = wrFlag;
- sqlite3VdbeChangeP4(v, 1, pTab->zName, P4_TRANSIENT);
+ sqlite3VdbeChangeP4(v, 2, pTab->zName, P4_TRANSIENT);
}
if( db->mallocFailed==0 ){
#endif
@@ -85817,10 +86717,10 @@ SQLITE_API int sqlite3_blob_open(
aOp[1].p4.i = pTab->nCol+1;
aOp[3].p2 = pTab->nCol;
- pParse->nVar = 0;
- pParse->nMem = 1;
- pParse->nTab = 1;
- sqlite3VdbeMakeReady(v, pParse);
+ sParse.nVar = 0;
+ sParse.nMem = 1;
+ sParse.nTab = 1;
+ sqlite3VdbeMakeReady(v, &sParse);
}
}
@@ -85842,8 +86742,7 @@ blob_open_out:
}
sqlite3ErrorWithMsg(db, rc, (zErr ? "%s" : 0), zErr);
sqlite3DbFree(db, zErr);
- sqlite3ParserReset(pParse);
- sqlite3StackFree(db, pParse);
+ sqlite3ParserReset(&sParse);
rc = sqlite3ApiExit(db, rc);
sqlite3_mutex_leave(db->mutex);
return rc;
@@ -86829,15 +87728,15 @@ static int vdbeSorterCompareText(
int n2;
int res;
- getVarint32(&p1[1], n1); n1 = (n1 - 13) / 2;
- getVarint32(&p2[1], n2); n2 = (n2 - 13) / 2;
- res = memcmp(v1, v2, MIN(n1, n2));
+ getVarint32(&p1[1], n1);
+ getVarint32(&p2[1], n2);
+ res = memcmp(v1, v2, (MIN(n1, n2) - 13)/2);
if( res==0 ){
res = n1 - n2;
}
if( res==0 ){
- if( pTask->pSorter->pKeyInfo->nField>1 ){
+ if( pTask->pSorter->pKeyInfo->nKeyField>1 ){
res = vdbeSorterCompareTail(
pTask, pbKey2Cached, pKey1, nKey1, pKey2, nKey2
);
@@ -86906,7 +87805,7 @@ static int vdbeSorterCompareInt(
}
if( res==0 ){
- if( pTask->pSorter->pKeyInfo->nField>1 ){
+ if( pTask->pSorter->pKeyInfo->nKeyField>1 ){
res = vdbeSorterCompareTail(
pTask, pbKey2Cached, pKey1, nKey1, pKey2, nKey2
);
@@ -86921,7 +87820,7 @@ static int vdbeSorterCompareInt(
/*
** Initialize the temporary index cursor just opened as a sorter cursor.
**
-** Usually, the sorter module uses the value of (pCsr->pKeyInfo->nField)
+** Usually, the sorter module uses the value of (pCsr->pKeyInfo->nKeyField)
** to determine the number of fields that should be compared from the
** records being sorted. However, if the value passed as argument nField
** is non-zero and the sorter is able to guarantee a stable sort, nField
@@ -86974,7 +87873,7 @@ SQLITE_PRIVATE int sqlite3VdbeSorterInit(
assert( pCsr->pKeyInfo && pCsr->pBtx==0 );
assert( pCsr->eCurType==CURTYPE_SORTER );
- szKeyInfo = sizeof(KeyInfo) + (pCsr->pKeyInfo->nField-1)*sizeof(CollSeq*);
+ szKeyInfo = sizeof(KeyInfo) + (pCsr->pKeyInfo->nKeyField-1)*sizeof(CollSeq*);
sz = sizeof(VdbeSorter) + nWorker * sizeof(SortSubtask);
pSorter = (VdbeSorter*)sqlite3DbMallocZero(db, sz + szKeyInfo);
@@ -86986,8 +87885,7 @@ SQLITE_PRIVATE int sqlite3VdbeSorterInit(
memcpy(pKeyInfo, pCsr->pKeyInfo, szKeyInfo);
pKeyInfo->db = 0;
if( nField && nWorker==0 ){
- pKeyInfo->nXField += (pKeyInfo->nField - nField);
- pKeyInfo->nField = nField;
+ pKeyInfo->nKeyField = nField;
}
pSorter->pgsz = pgsz = sqlite3BtreeGetPageSize(db->aDb[0].pBt);
pSorter->nTask = nWorker + 1;
@@ -87015,11 +87913,9 @@ SQLITE_PRIVATE int sqlite3VdbeSorterInit(
mxCache = MIN(mxCache, SQLITE_MAX_PMASZ);
pSorter->mxPmaSize = MAX(pSorter->mnPmaSize, (int)mxCache);
- /* EVIDENCE-OF: R-26747-61719 When the application provides any amount of
- ** scratch memory using SQLITE_CONFIG_SCRATCH, SQLite avoids unnecessary
- ** large heap allocations.
- */
- if( sqlite3GlobalConfig.pScratch==0 ){
+ /* Avoid large memory allocations if the application has requested
+ ** SQLITE_CONFIG_SMALL_MALLOC. */
+ if( sqlite3GlobalConfig.bSmallMalloc==0 ){
assert( pSorter->iMemory==0 );
pSorter->nMemory = pgsz;
pSorter->list.aMemory = (u8*)sqlite3Malloc(pgsz);
@@ -87027,7 +87923,7 @@ SQLITE_PRIVATE int sqlite3VdbeSorterInit(
}
}
- if( (pKeyInfo->nField+pKeyInfo->nXField)<13
+ if( pKeyInfo->nAllField<13
&& (pKeyInfo->aColl[0]==0 || pKeyInfo->aColl[0]==db->pDfltColl)
){
pSorter->typeMask = SORTER_TYPE_INTEGER | SORTER_TYPE_TEXT;
@@ -87342,7 +88238,7 @@ static int vdbeSortAllocUnpacked(SortSubtask *pTask){
if( pTask->pUnpacked==0 ){
pTask->pUnpacked = sqlite3VdbeAllocUnpackedRecord(pTask->pSorter->pKeyInfo);
if( pTask->pUnpacked==0 ) return SQLITE_NOMEM_BKPT;
- pTask->pUnpacked->nField = pTask->pSorter->pKeyInfo->nField;
+ pTask->pUnpacked->nField = pTask->pSorter->pKeyInfo->nKeyField;
pTask->pUnpacked->errCode = 0;
}
return SQLITE_OK;
@@ -88626,9 +89522,13 @@ SQLITE_PRIVATE int sqlite3VdbeSorterRewind(const VdbeCursor *pCsr, int *pbEof){
}
/*
-** Advance to the next element in the sorter.
+** Advance to the next element in the sorter. Return value:
+**
+** SQLITE_OK success
+** SQLITE_DONE end of data
+** otherwise some kind of error.
*/
-SQLITE_PRIVATE int sqlite3VdbeSorterNext(sqlite3 *db, const VdbeCursor *pCsr, int *pbEof){
+SQLITE_PRIVATE int sqlite3VdbeSorterNext(sqlite3 *db, const VdbeCursor *pCsr){
VdbeSorter *pSorter;
int rc; /* Return code */
@@ -88642,21 +89542,22 @@ SQLITE_PRIVATE int sqlite3VdbeSorterNext(sqlite3 *db, const VdbeCursor *pCsr, in
#if SQLITE_MAX_WORKER_THREADS>0
if( pSorter->bUseThreads ){
rc = vdbePmaReaderNext(pSorter->pReader);
- *pbEof = (pSorter->pReader->pFd==0);
+ if( rc==SQLITE_OK && pSorter->pReader->pFd==0 ) rc = SQLITE_DONE;
}else
#endif
/*if( !pSorter->bUseThreads )*/ {
+ int res = 0;
assert( pSorter->pMerger!=0 );
assert( pSorter->pMerger->pTask==(&pSorter->aTask[0]) );
- rc = vdbeMergeEngineStep(pSorter->pMerger, pbEof);
+ rc = vdbeMergeEngineStep(pSorter->pMerger, &res);
+ if( rc==SQLITE_OK && res ) rc = SQLITE_DONE;
}
}else{
SorterRecord *pFree = pSorter->list.pList;
pSorter->list.pList = pFree->u.pNext;
pFree->u.pNext = 0;
if( pSorter->list.aMemory==0 ) vdbeSorterRecordFree(db, pFree);
- *pbEof = !pSorter->list.pList;
- rc = SQLITE_OK;
+ rc = pSorter->list.pList ? SQLITE_OK : SQLITE_DONE;
}
return rc;
}
@@ -88861,7 +89762,8 @@ static int memjrnlRead(
int iChunkOffset;
FileChunk *pChunk;
-#ifdef SQLITE_ENABLE_ATOMIC_WRITE
+#if defined(SQLITE_ENABLE_ATOMIC_WRITE) \
+ || defined(SQLITE_ENABLE_BATCH_ATOMIC_WRITE)
if( (iAmt+iOfst)>p->endpoint.iOffset ){
return SQLITE_IOERR_SHORT_READ;
}
@@ -88980,7 +89882,8 @@ static int memjrnlWrite(
** atomic-write optimization. In this case the first 28 bytes of the
** journal file may be written as part of committing the transaction. */
assert( iOfst==p->endpoint.iOffset || iOfst==0 );
-#ifdef SQLITE_ENABLE_ATOMIC_WRITE
+#if defined(SQLITE_ENABLE_ATOMIC_WRITE) \
+ || defined(SQLITE_ENABLE_BATCH_ATOMIC_WRITE)
if( iOfst==0 && p->pFirst ){
assert( p->nChunkSize>iAmt );
memcpy((u8*)p->pFirst->zChunk, zBuf, iAmt);
@@ -89149,17 +90052,31 @@ SQLITE_PRIVATE void sqlite3MemJournalOpen(sqlite3_file *pJfd){
sqlite3JournalOpen(0, 0, pJfd, 0, -1);
}
-#ifdef SQLITE_ENABLE_ATOMIC_WRITE
+#if defined(SQLITE_ENABLE_ATOMIC_WRITE) \
+ || defined(SQLITE_ENABLE_BATCH_ATOMIC_WRITE)
/*
** If the argument p points to a MemJournal structure that is not an
** in-memory-only journal file (i.e. is one that was opened with a +ve
-** nSpill parameter), and the underlying file has not yet been created,
-** create it now.
+** nSpill parameter or as SQLITE_OPEN_MAIN_JOURNAL), and the underlying
+** file has not yet been created, create it now.
*/
-SQLITE_PRIVATE int sqlite3JournalCreate(sqlite3_file *p){
+SQLITE_PRIVATE int sqlite3JournalCreate(sqlite3_file *pJfd){
int rc = SQLITE_OK;
- if( p->pMethods==&MemJournalMethods && ((MemJournal*)p)->nSpill>0 ){
- rc = memjrnlCreateFile((MemJournal*)p);
+ MemJournal *p = (MemJournal*)pJfd;
+ if( p->pMethod==&MemJournalMethods && (
+#ifdef SQLITE_ENABLE_ATOMIC_WRITE
+ p->nSpill>0
+#else
+ /* While this appears to not be possible without ATOMIC_WRITE, the
+ ** paths are complex, so it seems prudent to leave the test in as
+ ** a NEVER(), in case our analysis is subtly flawed. */
+ NEVER(p->nSpill>0)
+#endif
+#ifdef SQLITE_ENABLE_BATCH_ATOMIC_WRITE
+ || (p->flags & SQLITE_OPEN_MAIN_JOURNAL)
+#endif
+ )){
+ rc = memjrnlCreateFile(p);
}
return rc;
}
@@ -89226,16 +90143,22 @@ static SQLITE_NOINLINE int walkExpr(Walker *pWalker, Expr *pExpr){
int rc;
testcase( ExprHasProperty(pExpr, EP_TokenOnly) );
testcase( ExprHasProperty(pExpr, EP_Reduced) );
- rc = pWalker->xExprCallback(pWalker, pExpr);
- if( rc || ExprHasProperty(pExpr,(EP_TokenOnly|EP_Leaf)) ){
- return rc & WRC_Abort;
- }
- if( pExpr->pLeft && walkExpr(pWalker, pExpr->pLeft) ) return WRC_Abort;
- if( pExpr->pRight && walkExpr(pWalker, pExpr->pRight) ) return WRC_Abort;
- if( ExprHasProperty(pExpr, EP_xIsSelect) ){
- if( sqlite3WalkSelect(pWalker, pExpr->x.pSelect) ) return WRC_Abort;
- }else if( pExpr->x.pList ){
- if( sqlite3WalkExprList(pWalker, pExpr->x.pList) ) return WRC_Abort;
+ while(1){
+ rc = pWalker->xExprCallback(pWalker, pExpr);
+ if( rc ) return rc & WRC_Abort;
+ if( !ExprHasProperty(pExpr,(EP_TokenOnly|EP_Leaf)) ){
+ if( pExpr->pLeft && walkExpr(pWalker, pExpr->pLeft) ) return WRC_Abort;
+ assert( pExpr->x.pList==0 || pExpr->pRight==0 );
+ if( pExpr->pRight ){
+ pExpr = pExpr->pRight;
+ continue;
+ }else if( ExprHasProperty(pExpr, EP_xIsSelect) ){
+ if( sqlite3WalkSelect(pWalker, pExpr->x.pSelect) ) return WRC_Abort;
+ }else if( pExpr->x.pList ){
+ if( sqlite3WalkExprList(pWalker, pExpr->x.pList) ) return WRC_Abort;
+ }
+ }
+ break;
}
return WRC_Continue;
}
@@ -89290,7 +90213,7 @@ SQLITE_PRIVATE int sqlite3WalkSelectFrom(Walker *pWalker, Select *p){
pSrc = p->pSrc;
if( ALWAYS(pSrc) ){
for(i=pSrc->nSrc, pItem=pSrc->a; i>0; i--, pItem++){
- if( sqlite3WalkSelect(pWalker, pItem->pSelect) ){
+ if( pItem->pSelect && sqlite3WalkSelect(pWalker, pItem->pSelect) ){
return WRC_Abort;
}
if( pItem->fg.isTabFunc
@@ -89310,8 +90233,9 @@ SQLITE_PRIVATE int sqlite3WalkSelectFrom(Walker *pWalker, Select *p){
**
** If it is not NULL, the xSelectCallback() callback is invoked before
** the walk of the expressions and FROM clause. The xSelectCallback2()
-** method, if it is not NULL, is invoked following the walk of the
-** expressions and FROM clause.
+** method is invoked following the walk of the expressions and FROM clause,
+** but only if both xSelectCallback and xSelectCallback2 are both non-NULL
+** and if the expressions and FROM clause both return WRC_Continue;
**
** Return WRC_Continue under normal conditions. Return WRC_Abort if
** there is an abort request.
@@ -89321,29 +90245,22 @@ SQLITE_PRIVATE int sqlite3WalkSelectFrom(Walker *pWalker, Select *p){
*/
SQLITE_PRIVATE int sqlite3WalkSelect(Walker *pWalker, Select *p){
int rc;
- if( p==0 || (pWalker->xSelectCallback==0 && pWalker->xSelectCallback2==0) ){
- return WRC_Continue;
- }
- rc = WRC_Continue;
- pWalker->walkerDepth++;
- while( p ){
- if( pWalker->xSelectCallback ){
- rc = pWalker->xSelectCallback(pWalker, p);
- if( rc ) break;
- }
+ if( p==0 ) return WRC_Continue;
+ if( pWalker->xSelectCallback==0 ) return WRC_Continue;
+ do{
+ rc = pWalker->xSelectCallback(pWalker, p);
+ if( rc ) return rc & WRC_Abort;
if( sqlite3WalkSelectExpr(pWalker, p)
|| sqlite3WalkSelectFrom(pWalker, p)
){
- pWalker->walkerDepth--;
return WRC_Abort;
}
if( pWalker->xSelectCallback2 ){
pWalker->xSelectCallback2(pWalker, p);
}
p = p->pPrior;
- }
- pWalker->walkerDepth--;
- return rc & WRC_Abort;
+ }while( p!=0 );
+ return WRC_Continue;
}
/************** End of walker.c **********************************************/
@@ -89828,6 +90745,7 @@ static int lookupName(
sqlite3ExprDelete(db, pExpr->pRight);
pExpr->pRight = 0;
pExpr->op = (isTrigger ? TK_TRIGGER : TK_COLUMN);
+ ExprSetProperty(pExpr, EP_Leaf);
lookupname_end:
if( cnt==1 ){
assert( pNC!=0 );
@@ -89866,7 +90784,6 @@ SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *db, SrcList *pSrc, int iSr
testcase( iCol==BMS-1 );
pItem->colUsed |= ((Bitmask)1)<<(iCol>=BMS ? BMS-1 : iCol);
}
- ExprSetProperty(p, EP_Resolved);
}
return p;
}
@@ -89926,8 +90843,6 @@ static int resolveExprStep(Walker *pWalker, Expr *pExpr){
pParse = pNC->pParse;
assert( pParse==pWalker->pParse );
- if( ExprHasProperty(pExpr, EP_Resolved) ) return WRC_Prune;
- ExprSetProperty(pExpr, EP_Resolved);
#ifndef NDEBUG
if( pNC->pSrcList && pNC->pSrcList->nAlloc>0 ){
SrcList *pSrcList = pNC->pSrcList;
@@ -90260,7 +91175,7 @@ static int resolveOrderByTermToExprList(
** result-set entry.
*/
for(i=0; i<pEList->nExpr; i++){
- if( sqlite3ExprCompare(pEList->a[i].pExpr, pE, -1)<2 ){
+ if( sqlite3ExprCompare(0, pEList->a[i].pExpr, pE, -1)<2 ){
return i+1;
}
}
@@ -90311,12 +91226,10 @@ static int resolveCompoundOrderBy(
pOrderBy = pSelect->pOrderBy;
if( pOrderBy==0 ) return 0;
db = pParse->db;
-#if SQLITE_MAX_COLUMN
if( pOrderBy->nExpr>db->aLimit[SQLITE_LIMIT_COLUMN] ){
sqlite3ErrorMsg(pParse, "too many terms in ORDER BY clause");
return 1;
}
-#endif
for(i=0; i<pOrderBy->nExpr; i++){
pOrderBy->a[i].done = 0;
}
@@ -90408,12 +91321,10 @@ SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(
struct ExprList_item *pItem;
if( pOrderBy==0 || pParse->db->mallocFailed ) return 0;
-#if SQLITE_MAX_COLUMN
if( pOrderBy->nExpr>db->aLimit[SQLITE_LIMIT_COLUMN] ){
sqlite3ErrorMsg(pParse, "too many terms in %s BY clause", zType);
return 1;
}
-#endif
pEList = pSelect->pEList;
assert( pEList!=0 ); /* sqlite3SelectNew() guarantees this */
for(i=0, pItem=pOrderBy->a; i<pOrderBy->nExpr; i++, pItem++){
@@ -90494,7 +91405,7 @@ static int resolveOrderGroupBy(
return 1;
}
for(j=0; j<pSelect->pEList->nExpr; j++){
- if( sqlite3ExprCompare(pE, pSelect->pEList->a[j].pExpr, -1)==0 ){
+ if( sqlite3ExprCompare(0, pE, pSelect->pEList->a[j].pExpr, -1)==0 ){
pItem->u.x.iOrderByCol = j+1;
}
}
@@ -90780,37 +91691,29 @@ SQLITE_PRIVATE int sqlite3ResolveExprNames(
u16 savedHasAgg;
Walker w;
- if( pExpr==0 ) return 0;
-#if SQLITE_MAX_EXPR_DEPTH>0
- {
- Parse *pParse = pNC->pParse;
- if( sqlite3ExprCheckHeight(pParse, pExpr->nHeight+pNC->pParse->nHeight) ){
- return 1;
- }
- pParse->nHeight += pExpr->nHeight;
- }
-#endif
+ if( pExpr==0 ) return SQLITE_OK;
savedHasAgg = pNC->ncFlags & (NC_HasAgg|NC_MinMaxAgg);
pNC->ncFlags &= ~(NC_HasAgg|NC_MinMaxAgg);
w.pParse = pNC->pParse;
w.xExprCallback = resolveExprStep;
w.xSelectCallback = resolveSelectStep;
w.xSelectCallback2 = 0;
- w.walkerDepth = 0;
- w.eCode = 0;
w.u.pNC = pNC;
+#if SQLITE_MAX_EXPR_DEPTH>0
+ w.pParse->nHeight += pExpr->nHeight;
+ if( sqlite3ExprCheckHeight(w.pParse, w.pParse->nHeight) ){
+ return SQLITE_ERROR;
+ }
+#endif
sqlite3WalkExpr(&w, pExpr);
#if SQLITE_MAX_EXPR_DEPTH>0
- pNC->pParse->nHeight -= pExpr->nHeight;
+ w.pParse->nHeight -= pExpr->nHeight;
#endif
- if( pNC->nErr>0 || w.pParse->nErr>0 ){
- ExprSetProperty(pExpr, EP_Error);
- }
if( pNC->ncFlags & NC_HasAgg ){
ExprSetProperty(pExpr, EP_Agg);
}
pNC->ncFlags |= savedHasAgg;
- return ExprHasProperty(pExpr, EP_Error);
+ return pNC->nErr>0 || w.pParse->nErr>0;
}
/*
@@ -90851,9 +91754,9 @@ SQLITE_PRIVATE void sqlite3ResolveSelectNames(
Walker w;
assert( p!=0 );
- memset(&w, 0, sizeof(w));
w.xExprCallback = resolveExprStep;
w.xSelectCallback = resolveSelectStep;
+ w.xSelectCallback2 = 0;
w.pParse = pParse;
w.u.pNC = pOuterNC;
sqlite3WalkSelect(&w, p);
@@ -91022,6 +91925,11 @@ SQLITE_PRIVATE Expr *sqlite3ExprSkipCollate(Expr *pExpr){
** Return the collation sequence for the expression pExpr. If
** there is no defined collating sequence, return NULL.
**
+** See also: sqlite3ExprNNCollSeq()
+**
+** The sqlite3ExprNNCollSeq() works the same exact that it returns the
+** default collation if pExpr has no defined collation.
+**
** The collating sequence might be determined by a COLLATE operator
** or by the presence of a column with a defined collating sequence.
** COLLATE operators take first precedence. Left operands take
@@ -91087,6 +91995,32 @@ SQLITE_PRIVATE CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr){
}
/*
+** Return the collation sequence for the expression pExpr. If
+** there is no defined collating sequence, return a pointer to the
+** defautl collation sequence.
+**
+** See also: sqlite3ExprCollSeq()
+**
+** The sqlite3ExprCollSeq() routine works the same except that it
+** returns NULL if there is no defined collation.
+*/
+SQLITE_PRIVATE CollSeq *sqlite3ExprNNCollSeq(Parse *pParse, Expr *pExpr){
+ CollSeq *p = sqlite3ExprCollSeq(pParse, pExpr);
+ if( p==0 ) p = pParse->db->pDfltColl;
+ assert( p!=0 );
+ return p;
+}
+
+/*
+** Return TRUE if the two expressions have equivalent collating sequences.
+*/
+SQLITE_PRIVATE int sqlite3ExprCollSeqMatch(Parse *pParse, Expr *pE1, Expr *pE2){
+ CollSeq *pColl1 = sqlite3ExprNNCollSeq(pParse, pE1);
+ CollSeq *pColl2 = sqlite3ExprNNCollSeq(pParse, pE2);
+ return sqlite3StrICmp(pColl1->zName, pColl2->zName)==0;
+}
+
+/*
** pExpr is an operand of a comparison operator. aff2 is the
** type affinity of the other operand. This routine returns the
** type affinity that should be used for the comparison operator.
@@ -91642,7 +92576,7 @@ SQLITE_PRIVATE Expr *sqlite3ExprAlloc(
pNew->iAgg = -1;
if( pToken ){
if( nExtra==0 ){
- pNew->flags |= EP_IntValue;
+ pNew->flags |= EP_IntValue|EP_Leaf;
pNew->u.iValue = iValue;
}else{
pNew->u.zToken = (char*)&pNew[1];
@@ -91673,7 +92607,7 @@ SQLITE_PRIVATE Expr *sqlite3Expr(
){
Token x;
x.z = zToken;
- x.n = zToken ? sqlite3Strlen30(zToken) : 0;
+ x.n = sqlite3Strlen30(zToken);
return sqlite3ExprAlloc(db, op, &x, 0);
}
@@ -91923,8 +92857,9 @@ static SQLITE_NOINLINE void sqlite3ExprDeleteNN(sqlite3 *db, Expr *p){
/* The Expr.x union is never used at the same time as Expr.pRight */
assert( p->x.pList==0 || p->pRight==0 );
if( p->pLeft && p->op!=TK_SELECT_COLUMN ) sqlite3ExprDeleteNN(db, p->pLeft);
- sqlite3ExprDelete(db, p->pRight);
- if( ExprHasProperty(p, EP_xIsSelect) ){
+ if( p->pRight ){
+ sqlite3ExprDeleteNN(db, p->pRight);
+ }else if( ExprHasProperty(p, EP_xIsSelect) ){
sqlite3SelectDelete(db, p->x.pSelect);
}else{
sqlite3ExprListDelete(db, p->x.pList);
@@ -92199,10 +93134,9 @@ SQLITE_PRIVATE ExprList *sqlite3ExprListDup(sqlite3 *db, ExprList *p, int flags)
Expr *pPriorSelectCol = 0;
assert( db!=0 );
if( p==0 ) return 0;
- pNew = sqlite3DbMallocRawNN(db,
- sizeof(*pNew)+sizeof(pNew->a[0])*(p->nExpr-1) );
+ pNew = sqlite3DbMallocRawNN(db, sqlite3DbMallocSize(db, p));
if( pNew==0 ) return 0;
- pNew->nAlloc = pNew->nExpr = p->nExpr;
+ pNew->nExpr = p->nExpr;
pItem = pNew->a;
pOldItem = p->a;
for(i=0; i<p->nExpr; i++, pItem++, pOldItem++){
@@ -92356,6 +93290,13 @@ SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3 *db, Select *p, int flags){
** Add a new element to the end of an expression list. If pList is
** initially NULL, then create a new expression list.
**
+** The pList argument must be either NULL or a pointer to an ExprList
+** obtained from a prior call to sqlite3ExprListAppend(). This routine
+** may not be used with an ExprList obtained from sqlite3ExprListDup().
+** Reason: This routine assumes that the number of slots in pList->a[]
+** is a power of two. That is true for sqlite3ExprListAppend() returns
+** but is not necessarily true from the return value of sqlite3ExprListDup().
+**
** If a memory allocation error occurs, the entire list is freed and
** NULL is returned. If non-NULL is returned, then it is guaranteed
** that the new entry was successfully appended.
@@ -92374,19 +93315,19 @@ SQLITE_PRIVATE ExprList *sqlite3ExprListAppend(
goto no_mem;
}
pList->nExpr = 0;
- pList->nAlloc = 1;
- }else if( pList->nExpr==pList->nAlloc ){
+ }else if( (pList->nExpr & (pList->nExpr-1))==0 ){
ExprList *pNew;
pNew = sqlite3DbRealloc(db, pList,
- sizeof(*pList)+(2*pList->nAlloc - 1)*sizeof(pList->a[0]));
+ sizeof(*pList)+(2*pList->nExpr - 1)*sizeof(pList->a[0]));
if( pNew==0 ){
goto no_mem;
}
pList = pNew;
- pList->nAlloc *= 2;
}
pItem = &pList->a[pList->nExpr++];
- memset(pItem, 0, sizeof(*pItem));
+ assert( offsetof(struct ExprList_item,zName)==sizeof(pItem->pExpr) );
+ assert( offsetof(struct ExprList_item,pExpr)==0 );
+ memset(&pItem->zName,0,sizeof(*pItem)-offsetof(struct ExprList_item,zName));
pItem->pExpr = pExpr;
return pList;
@@ -92572,17 +93513,29 @@ SQLITE_PRIVATE void sqlite3ExprListDelete(sqlite3 *db, ExprList *pList){
SQLITE_PRIVATE u32 sqlite3ExprListFlags(const ExprList *pList){
int i;
u32 m = 0;
- if( pList ){
- for(i=0; i<pList->nExpr; i++){
- Expr *pExpr = pList->a[i].pExpr;
- assert( pExpr!=0 );
- m |= pExpr->flags;
- }
+ assert( pList!=0 );
+ for(i=0; i<pList->nExpr; i++){
+ Expr *pExpr = pList->a[i].pExpr;
+ assert( pExpr!=0 );
+ m |= pExpr->flags;
}
return m;
}
/*
+** This is a SELECT-node callback for the expression walker that
+** always "fails". By "fail" in this case, we mean set
+** pWalker->eCode to zero and abort.
+**
+** This callback is used by multiple expression walkers.
+*/
+SQLITE_PRIVATE int sqlite3SelectWalkFail(Walker *pWalker, Select *NotUsed){
+ UNUSED_PARAMETER(NotUsed);
+ pWalker->eCode = 0;
+ return WRC_Abort;
+}
+
+/*
** These routines are Walker callbacks used to check expressions to
** see if they are "constant" for some definition of constant. The
** Walker.eCode value determines the type of "constant" we are looking
@@ -92658,22 +93611,19 @@ static int exprNodeIsConstant(Walker *pWalker, Expr *pExpr){
}
/* Fall through */
default:
- testcase( pExpr->op==TK_SELECT ); /* selectNodeIsConstant will disallow */
- testcase( pExpr->op==TK_EXISTS ); /* selectNodeIsConstant will disallow */
+ testcase( pExpr->op==TK_SELECT ); /* sqlite3SelectWalkFail will disallow */
+ testcase( pExpr->op==TK_EXISTS ); /* sqlite3SelectWalkFail will disallow */
return WRC_Continue;
}
}
-static int selectNodeIsConstant(Walker *pWalker, Select *NotUsed){
- UNUSED_PARAMETER(NotUsed);
- pWalker->eCode = 0;
- return WRC_Abort;
-}
static int exprIsConst(Expr *p, int initFlag, int iCur){
Walker w;
- memset(&w, 0, sizeof(w));
w.eCode = initFlag;
w.xExprCallback = exprNodeIsConstant;
- w.xSelectCallback = selectNodeIsConstant;
+ w.xSelectCallback = sqlite3SelectWalkFail;
+#ifdef SQLITE_DEBUG
+ w.xSelectCallback2 = sqlite3SelectWalkAssert2;
+#endif
w.u.iCur = iCur;
sqlite3WalkExpr(&w, p);
return w.eCode;
@@ -92723,9 +93673,9 @@ static int exprNodeIsConstantOrGroupBy(Walker *pWalker, Expr *pExpr){
** it constant. */
for(i=0; i<pGroupBy->nExpr; i++){
Expr *p = pGroupBy->a[i].pExpr;
- if( sqlite3ExprCompare(pExpr, p, -1)<2 ){
- CollSeq *pColl = sqlite3ExprCollSeq(pWalker->pParse, p);
- if( pColl==0 || sqlite3_stricmp("BINARY", pColl->zName)==0 ){
+ if( sqlite3ExprCompare(0, pExpr, p, -1)<2 ){
+ CollSeq *pColl = sqlite3ExprNNCollSeq(pWalker->pParse, p);
+ if( sqlite3_stricmp("BINARY", pColl->zName)==0 ){
return WRC_Prune;
}
}
@@ -92761,9 +93711,9 @@ static int exprNodeIsConstantOrGroupBy(Walker *pWalker, Expr *pExpr){
*/
SQLITE_PRIVATE int sqlite3ExprIsConstantOrGroupBy(Parse *pParse, Expr *p, ExprList *pGroupBy){
Walker w;
- memset(&w, 0, sizeof(w));
w.eCode = 1;
w.xExprCallback = exprNodeIsConstantOrGroupBy;
+ w.xSelectCallback = 0;
w.u.pGroupBy = pGroupBy;
w.pParse = pParse;
sqlite3WalkExpr(&w, p);
@@ -92791,10 +93741,12 @@ SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr *p, u8 isInit){
*/
SQLITE_PRIVATE int sqlite3ExprContainsSubquery(Expr *p){
Walker w;
- memset(&w, 0, sizeof(w));
w.eCode = 1;
w.xExprCallback = sqlite3ExprWalkNoop;
- w.xSelectCallback = selectNodeIsConstant;
+ w.xSelectCallback = sqlite3SelectWalkFail;
+#ifdef SQLITE_DEBUG
+ w.xSelectCallback2 = sqlite3SelectWalkAssert2;
+#endif
sqlite3WalkExpr(&w, p);
return w.eCode==0;
}
@@ -92864,8 +93816,8 @@ SQLITE_PRIVATE int sqlite3ExprCanBeNull(const Expr *p){
case TK_BLOB:
return 0;
case TK_COLUMN:
- assert( p->pTab!=0 );
return ExprHasProperty(p, EP_CanBeNull) ||
+ p->pTab==0 || /* Reference to column of index on expression */
(p->iColumn>=0 && p->pTab->aCol[p->iColumn].notNull==0);
default:
return 1;
@@ -93527,7 +94479,7 @@ SQLITE_PRIVATE int sqlite3CodeSubselect(
/* Loop through each expression in <exprlist>. */
r1 = sqlite3GetTempReg(pParse);
r2 = sqlite3GetTempReg(pParse);
- if( isRowid ) sqlite3VdbeAddOp2(v, OP_Null, 0, r2);
+ if( isRowid ) sqlite3VdbeAddOp4(v, OP_Blob, 0, r2, 0, "", P4_STATIC);
for(i=pList->nExpr, pItem=pList->a; i>0; i--, pItem++){
Expr *pE2 = pItem->pExpr;
int iValToIns;
@@ -93955,7 +94907,7 @@ static void codeInteger(Parse *pParse, Expr *pExpr, int negFlag, int iMem){
const char *z = pExpr->u.zToken;
assert( z!=0 );
c = sqlite3DecOrHexToI64(z, &value);
- if( c==1 || (c==2 && !negFlag) || (negFlag && value==SMALLEST_INT64)){
+ if( (c==3 && !negFlag) || (c==2) || (negFlag && value==SMALLEST_INT64)){
#ifdef SQLITE_OMIT_FLOATING_POINT
sqlite3ErrorMsg(pParse, "oversized integer: %s%s", negFlag ? "-" : "", z);
#else
@@ -93969,7 +94921,7 @@ static void codeInteger(Parse *pParse, Expr *pExpr, int negFlag, int iMem){
}
#endif
}else{
- if( negFlag ){ value = c==2 ? SMALLEST_INT64 : -value; }
+ if( negFlag ){ value = c==3 ? SMALLEST_INT64 : -value; }
sqlite3VdbeAddOp4Dup8(v, OP_Int64, 0, iMem, 0, (u8*)&value, P4_INT64);
}
}
@@ -94129,8 +95081,9 @@ SQLITE_PRIVATE void sqlite3ExprCodeLoadIndexColumn(
if( iTabCol==XN_EXPR ){
assert( pIdx->aColExpr );
assert( pIdx->aColExpr->nExpr>iIdxCol );
- pParse->iSelfTab = iTabCur;
+ pParse->iSelfTab = iTabCur + 1;
sqlite3ExprCodeCopy(pParse, pIdx->aColExpr->a[iIdxCol].pExpr, regOut);
+ pParse->iSelfTab = 0;
}else{
sqlite3ExprCodeGetColumnOfTable(pParse->pVdbe, pIdx->pTable, iTabCur,
iTabCol, regOut);
@@ -94374,13 +95327,13 @@ SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target)
case TK_COLUMN: {
int iTab = pExpr->iTable;
if( iTab<0 ){
- if( pParse->ckBase>0 ){
+ if( pParse->iSelfTab<0 ){
/* Generating CHECK constraints or inserting into partial index */
- return pExpr->iColumn + pParse->ckBase;
+ return pExpr->iColumn - pParse->iSelfTab;
}else{
/* Coding an expression that is part of an index where column names
** in the index refer to the table to which the index belongs */
- iTab = pParse->iSelfTab;
+ iTab = pParse->iSelfTab - 1;
}
}
return sqlite3ExprCodeGetColumn(pParse, pExpr->pTab,
@@ -94717,8 +95670,8 @@ SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target)
if( !pColl ) pColl = db->pDfltColl;
sqlite3VdbeAddOp4(v, OP_CollSeq, 0, 0, 0, (char *)pColl, P4_COLLSEQ);
}
- sqlite3VdbeAddOp4(v, OP_Function0, constMask, r1, target,
- (char*)pDef, P4_FUNCDEF);
+ sqlite3VdbeAddOp4(v, pParse->iSelfTab ? OP_PureFunc0 : OP_Function0,
+ constMask, r1, target, (char*)pDef, P4_FUNCDEF);
sqlite3VdbeChangeP5(v, (u8)nFarg);
if( nFarg && constMask==0 ){
sqlite3ReleaseTempRange(pParse, r1, nFarg);
@@ -94997,7 +95950,7 @@ SQLITE_PRIVATE int sqlite3ExprCodeAtInit(
struct ExprList_item *pItem;
int i;
for(pItem=p->a, i=p->nExpr; i>0; pItem++, i--){
- if( pItem->reusable && sqlite3ExprCompare(pItem->pExpr,pExpr,-1)==0 ){
+ if( pItem->reusable && sqlite3ExprCompare(0,pItem->pExpr,pExpr,-1)==0 ){
return pItem->u.iConstExprReg;
}
}
@@ -95123,7 +96076,9 @@ SQLITE_PRIVATE void sqlite3ExprCodeAndCache(Parse *pParse, Expr *pExpr, int targ
** Generate code that pushes the value of every element of the given
** expression list into a sequence of registers beginning at target.
**
-** Return the number of elements evaluated.
+** Return the number of elements evaluated. The number returned will
+** usually be pList->nExpr but might be reduced if SQLITE_ECEL_OMITREF
+** is defined.
**
** The SQLITE_ECEL_DUP flag prevents the arguments from being
** filled using OP_SCopy. OP_Copy must be used instead.
@@ -95134,6 +96089,8 @@ SQLITE_PRIVATE void sqlite3ExprCodeAndCache(Parse *pParse, Expr *pExpr, int targ
** The SQLITE_ECEL_REF flag means that expressions in the list with
** ExprList.a[].u.x.iOrderByCol>0 have already been evaluated and stored
** in registers at srcReg, and so the value can be copied from there.
+** If SQLITE_ECEL_OMITREF is also set, then the values with u.x.iOrderByCol>0
+** are simply omitted rather than being copied from srcReg.
*/
SQLITE_PRIVATE int sqlite3ExprCodeExprList(
Parse *pParse, /* Parsing context */
@@ -95552,6 +96509,41 @@ SQLITE_PRIVATE void sqlite3ExprIfFalseDup(Parse *pParse, Expr *pExpr, int dest,i
sqlite3ExprDelete(db, pCopy);
}
+/*
+** Expression pVar is guaranteed to be an SQL variable. pExpr may be any
+** type of expression.
+**
+** If pExpr is a simple SQL value - an integer, real, string, blob
+** or NULL value - then the VDBE currently being prepared is configured
+** to re-prepare each time a new value is bound to variable pVar.
+**
+** Additionally, if pExpr is a simple SQL value and the value is the
+** same as that currently bound to variable pVar, non-zero is returned.
+** Otherwise, if the values are not the same or if pExpr is not a simple
+** SQL value, zero is returned.
+*/
+static int exprCompareVariable(Parse *pParse, Expr *pVar, Expr *pExpr){
+ int res = 0;
+ int iVar;
+ sqlite3_value *pL, *pR = 0;
+
+ sqlite3ValueFromExpr(pParse->db, pExpr, SQLITE_UTF8, SQLITE_AFF_BLOB, &pR);
+ if( pR ){
+ iVar = pVar->iColumn;
+ sqlite3VdbeSetVarmask(pParse->pVdbe, iVar);
+ pL = sqlite3VdbeGetBoundValue(pParse->pReprepare, iVar, SQLITE_AFF_BLOB);
+ if( pL ){
+ if( sqlite3_value_type(pL)==SQLITE_TEXT ){
+ sqlite3_value_text(pL); /* Make sure the encoding is UTF-8 */
+ }
+ res = 0==sqlite3MemCompare(pL, pR, 0);
+ }
+ sqlite3ValueFree(pR);
+ sqlite3ValueFree(pL);
+ }
+
+ return res;
+}
/*
** Do a deep comparison of two expression trees. Return 0 if the two
@@ -95574,12 +96566,22 @@ SQLITE_PRIVATE void sqlite3ExprIfFalseDup(Parse *pParse, Expr *pExpr, int dest,i
** this routine is used, it does not hurt to get an extra 2 - that
** just might result in some slightly slower code. But returning
** an incorrect 0 or 1 could lead to a malfunction.
+**
+** If pParse is not NULL then TK_VARIABLE terms in pA with bindings in
+** pParse->pReprepare can be matched against literals in pB. The
+** pParse->pVdbe->expmask bitmask is updated for each variable referenced.
+** If pParse is NULL (the normal case) then any TK_VARIABLE term in
+** Argument pParse should normally be NULL. If it is not NULL and pA or
+** pB causes a return value of 2.
*/
-SQLITE_PRIVATE int sqlite3ExprCompare(Expr *pA, Expr *pB, int iTab){
+SQLITE_PRIVATE int sqlite3ExprCompare(Parse *pParse, Expr *pA, Expr *pB, int iTab){
u32 combinedFlags;
if( pA==0 || pB==0 ){
return pB==pA ? 0 : 2;
}
+ if( pParse && pA->op==TK_VARIABLE && exprCompareVariable(pParse, pA, pB) ){
+ return 0;
+ }
combinedFlags = pA->flags | pB->flags;
if( combinedFlags & EP_IntValue ){
if( (pA->flags&pB->flags&EP_IntValue)!=0 && pA->u.iValue==pB->u.iValue ){
@@ -95588,10 +96590,10 @@ SQLITE_PRIVATE int sqlite3ExprCompare(Expr *pA, Expr *pB, int iTab){
return 2;
}
if( pA->op!=pB->op ){
- if( pA->op==TK_COLLATE && sqlite3ExprCompare(pA->pLeft, pB, iTab)<2 ){
+ if( pA->op==TK_COLLATE && sqlite3ExprCompare(pParse, pA->pLeft,pB,iTab)<2 ){
return 1;
}
- if( pB->op==TK_COLLATE && sqlite3ExprCompare(pA, pB->pLeft, iTab)<2 ){
+ if( pB->op==TK_COLLATE && sqlite3ExprCompare(pParse, pA,pB->pLeft,iTab)<2 ){
return 1;
}
return 2;
@@ -95606,8 +96608,8 @@ SQLITE_PRIVATE int sqlite3ExprCompare(Expr *pA, Expr *pB, int iTab){
if( (pA->flags & EP_Distinct)!=(pB->flags & EP_Distinct) ) return 2;
if( ALWAYS((combinedFlags & EP_TokenOnly)==0) ){
if( combinedFlags & EP_xIsSelect ) return 2;
- if( sqlite3ExprCompare(pA->pLeft, pB->pLeft, iTab) ) return 2;
- if( sqlite3ExprCompare(pA->pRight, pB->pRight, iTab) ) return 2;
+ if( sqlite3ExprCompare(pParse, pA->pLeft, pB->pLeft, iTab) ) return 2;
+ if( sqlite3ExprCompare(pParse, pA->pRight, pB->pRight, iTab) ) return 2;
if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList, iTab) ) return 2;
if( ALWAYS((combinedFlags & EP_Reduced)==0) && pA->op!=TK_STRING ){
if( pA->iColumn!=pB->iColumn ) return 2;
@@ -95642,7 +96644,7 @@ SQLITE_PRIVATE int sqlite3ExprListCompare(ExprList *pA, ExprList *pB, int iTab){
Expr *pExprA = pA->a[i].pExpr;
Expr *pExprB = pB->a[i].pExpr;
if( pA->a[i].sortOrder!=pB->a[i].sortOrder ) return 1;
- if( sqlite3ExprCompare(pExprA, pExprB, iTab) ) return 1;
+ if( sqlite3ExprCompare(0, pExprA, pExprB, iTab) ) return 1;
}
return 0;
}
@@ -95652,7 +96654,7 @@ SQLITE_PRIVATE int sqlite3ExprListCompare(ExprList *pA, ExprList *pB, int iTab){
** are ignored.
*/
SQLITE_PRIVATE int sqlite3ExprCompareSkip(Expr *pA, Expr *pB, int iTab){
- return sqlite3ExprCompare(
+ return sqlite3ExprCompare(0,
sqlite3ExprSkipCollate(pA),
sqlite3ExprSkipCollate(pB),
iTab);
@@ -95674,24 +96676,29 @@ SQLITE_PRIVATE int sqlite3ExprCompareSkip(Expr *pA, Expr *pB, int iTab){
** When comparing TK_COLUMN nodes between pE1 and pE2, if pE2 has
** Expr.iTable<0 then assume a table number given by iTab.
**
+** If pParse is not NULL, then the values of bound variables in pE1 are
+** compared against literal values in pE2 and pParse->pVdbe->expmask is
+** modified to record which bound variables are referenced. If pParse
+** is NULL, then false will be returned if pE1 contains any bound variables.
+**
** When in doubt, return false. Returning true might give a performance
** improvement. Returning false might cause a performance reduction, but
** it will always give the correct answer and is hence always safe.
*/
-SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Expr *pE1, Expr *pE2, int iTab){
- if( sqlite3ExprCompare(pE1, pE2, iTab)==0 ){
+SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Parse *pParse, Expr *pE1, Expr *pE2, int iTab){
+ if( sqlite3ExprCompare(pParse, pE1, pE2, iTab)==0 ){
return 1;
}
if( pE2->op==TK_OR
- && (sqlite3ExprImpliesExpr(pE1, pE2->pLeft, iTab)
- || sqlite3ExprImpliesExpr(pE1, pE2->pRight, iTab) )
+ && (sqlite3ExprImpliesExpr(pParse, pE1, pE2->pLeft, iTab)
+ || sqlite3ExprImpliesExpr(pParse, pE1, pE2->pRight, iTab) )
){
return 1;
}
if( pE2->op==TK_NOTNULL && pE1->op!=TK_ISNULL && pE1->op!=TK_IS ){
Expr *pX = sqlite3ExprSkipCollate(pE1->pLeft);
testcase( pX!=pE1->pLeft );
- if( sqlite3ExprCompare(pX, pE2->pLeft, iTab)==0 ) return 1;
+ if( sqlite3ExprCompare(pParse, pX, pE2->pLeft, iTab)==0 ) return 1;
}
return 0;
}
@@ -95799,8 +96806,8 @@ SQLITE_PRIVATE int sqlite3FunctionUsesThisSrc(Expr *pExpr, SrcList *pSrcList){
Walker w;
struct SrcCount cnt;
assert( pExpr->op==TK_AGG_FUNCTION );
- memset(&w, 0, sizeof(w));
w.xExprCallback = exprSrcCount;
+ w.xSelectCallback = 0;
w.u.pSrcCount = &cnt;
cnt.pSrc = pSrcList;
cnt.nThis = 0;
@@ -95932,7 +96939,7 @@ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){
*/
struct AggInfo_func *pItem = pAggInfo->aFunc;
for(i=0; i<pAggInfo->nFunc; i++, pItem++){
- if( sqlite3ExprCompare(pItem->pExpr, pExpr, -1)==0 ){
+ if( sqlite3ExprCompare(0, pItem->pExpr, pExpr, -1)==0 ){
break;
}
}
@@ -95972,10 +96979,14 @@ static int analyzeAggregate(Walker *pWalker, Expr *pExpr){
return WRC_Continue;
}
static int analyzeAggregatesInSelect(Walker *pWalker, Select *pSelect){
- UNUSED_PARAMETER(pWalker);
UNUSED_PARAMETER(pSelect);
+ pWalker->walkerDepth++;
return WRC_Continue;
}
+static void analyzeAggregatesInSelectEnd(Walker *pWalker, Select *pSelect){
+ UNUSED_PARAMETER(pSelect);
+ pWalker->walkerDepth--;
+}
/*
** Analyze the pExpr expression looking for aggregate functions and
@@ -95988,9 +96999,10 @@ static int analyzeAggregatesInSelect(Walker *pWalker, Select *pSelect){
*/
SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext *pNC, Expr *pExpr){
Walker w;
- memset(&w, 0, sizeof(w));
w.xExprCallback = analyzeAggregate;
w.xSelectCallback = analyzeAggregatesInSelect;
+ w.xSelectCallback2 = analyzeAggregatesInSelectEnd;
+ w.walkerDepth = 0;
w.u.pNC = pNC;
assert( pNC->pSrcList!=0 );
sqlite3WalkExpr(&w, pExpr);
@@ -96091,8 +97103,8 @@ SQLITE_PRIVATE void sqlite3ClearTempRegCache(Parse *pParse){
SQLITE_PRIVATE int sqlite3NoTempsInRange(Parse *pParse, int iFirst, int iLast){
int i;
if( pParse->nRangeReg>0
- && pParse->iRangeReg+pParse->nRangeReg<iLast
- && pParse->iRangeReg>=iFirst
+ && pParse->iRangeReg+pParse->nRangeReg > iFirst
+ && pParse->iRangeReg <= iLast
){
return 0;
}
@@ -96484,7 +97496,7 @@ static void reloadTableSchema(Parse *pParse, Table *pTab, const char *zName){
** Or, if zName is not a system table, zero is returned.
*/
static int isSystemTable(Parse *pParse, const char *zName){
- if( sqlite3Strlen30(zName)>6 && 0==sqlite3StrNICmp(zName, "sqlite_", 7) ){
+ if( 0==sqlite3StrNICmp(zName, "sqlite_", 7) ){
sqlite3ErrorMsg(pParse, "table %s may not be altered", zName);
return 1;
}
@@ -96512,9 +97524,9 @@ SQLITE_PRIVATE void sqlite3AlterRenameTable(
char *zWhere = 0; /* Where clause to locate temp triggers */
#endif
VTable *pVTab = 0; /* Non-zero if this is a v-tab with an xRename() */
- int savedDbFlags; /* Saved value of db->flags */
+ u32 savedDbFlags; /* Saved value of db->mDbFlags */
- savedDbFlags = db->flags;
+ savedDbFlags = db->mDbFlags;
if( NEVER(db->mallocFailed) ) goto exit_rename_table;
assert( pSrc->nSrc==1 );
assert( sqlite3BtreeHoldsAllMutexes(pParse->db) );
@@ -96523,7 +97535,7 @@ SQLITE_PRIVATE void sqlite3AlterRenameTable(
if( !pTab ) goto exit_rename_table;
iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
zDb = db->aDb[iDb].zDbSName;
- db->flags |= SQLITE_PreferBuiltin;
+ db->mDbFlags |= DBFLAG_PreferBuiltin;
/* Get a NULL terminated version of the new table name. */
zName = sqlite3NameFromToken(db, pName);
@@ -96688,7 +97700,7 @@ SQLITE_PRIVATE void sqlite3AlterRenameTable(
exit_rename_table:
sqlite3SrcListDelete(db, pSrc);
sqlite3DbFree(db, zName);
- db->flags = savedDbFlags;
+ db->mDbFlags = savedDbFlags;
}
/*
@@ -96789,11 +97801,11 @@ SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){
zCol = sqlite3DbStrNDup(db, (char*)pColDef->z, pColDef->n);
if( zCol ){
char *zEnd = &zCol[pColDef->n-1];
- int savedDbFlags = db->flags;
+ u32 savedDbFlags = db->mDbFlags;
while( zEnd>zCol && (*zEnd==';' || sqlite3Isspace(*zEnd)) ){
*zEnd-- = '\0';
}
- db->flags |= SQLITE_PreferBuiltin;
+ db->mDbFlags |= DBFLAG_PreferBuiltin;
sqlite3NestedParse(pParse,
"UPDATE \"%w\".%s SET "
"sql = substr(sql,1,%d) || ', ' || %Q || substr(sql,%d) "
@@ -96802,7 +97814,7 @@ SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){
zTab
);
sqlite3DbFree(db, zCol);
- db->flags = savedDbFlags;
+ db->mDbFlags = savedDbFlags;
}
/* Make sure the schema version is at least 3. But do not upgrade
@@ -98903,7 +99915,8 @@ static void attachFunc(
char *zPath = 0;
char *zErr = 0;
unsigned int flags;
- Db *aNew;
+ Db *aNew; /* New array of Db pointers */
+ Db *pNew; /* Db object for the newly attached database */
char *zErrDyn = 0;
sqlite3_vfs *pVfs;
@@ -98926,10 +99939,6 @@ static void attachFunc(
);
goto attach_error;
}
- if( !db->autoCommit ){
- zErrDyn = sqlite3MPrintf(db, "cannot ATTACH database within transaction");
- goto attach_error;
- }
for(i=0; i<db->nDb; i++){
char *z = db->aDb[i].zDbSName;
assert( z && zName );
@@ -98951,8 +99960,8 @@ static void attachFunc(
if( aNew==0 ) return;
}
db->aDb = aNew;
- aNew = &db->aDb[db->nDb];
- memset(aNew, 0, sizeof(*aNew));
+ pNew = &db->aDb[db->nDb];
+ memset(pNew, 0, sizeof(*pNew));
/* Open the database file. If the btree is successfully opened, use
** it to obtain the database schema. At this point the schema may
@@ -98968,7 +99977,7 @@ static void attachFunc(
}
assert( pVfs );
flags |= SQLITE_OPEN_MAIN_DB;
- rc = sqlite3BtreeOpen(pVfs, zPath, db, &aNew->pBt, 0, flags);
+ rc = sqlite3BtreeOpen(pVfs, zPath, db, &pNew->pBt, 0, flags);
sqlite3_free( zPath );
db->nDb++;
db->skipBtreeMutex = 0;
@@ -98977,28 +99986,28 @@ static void attachFunc(
zErrDyn = sqlite3MPrintf(db, "database is already attached");
}else if( rc==SQLITE_OK ){
Pager *pPager;
- aNew->pSchema = sqlite3SchemaGet(db, aNew->pBt);
- if( !aNew->pSchema ){
+ pNew->pSchema = sqlite3SchemaGet(db, pNew->pBt);
+ if( !pNew->pSchema ){
rc = SQLITE_NOMEM_BKPT;
- }else if( aNew->pSchema->file_format && aNew->pSchema->enc!=ENC(db) ){
+ }else if( pNew->pSchema->file_format && pNew->pSchema->enc!=ENC(db) ){
zErrDyn = sqlite3MPrintf(db,
"attached databases must use the same text encoding as main database");
rc = SQLITE_ERROR;
}
- sqlite3BtreeEnter(aNew->pBt);
- pPager = sqlite3BtreePager(aNew->pBt);
+ sqlite3BtreeEnter(pNew->pBt);
+ pPager = sqlite3BtreePager(pNew->pBt);
sqlite3PagerLockingMode(pPager, db->dfltLockMode);
- sqlite3BtreeSecureDelete(aNew->pBt,
+ sqlite3BtreeSecureDelete(pNew->pBt,
sqlite3BtreeSecureDelete(db->aDb[0].pBt,-1) );
#ifndef SQLITE_OMIT_PAGER_PRAGMAS
- sqlite3BtreeSetPagerFlags(aNew->pBt,
+ sqlite3BtreeSetPagerFlags(pNew->pBt,
PAGER_SYNCHRONOUS_FULL | (db->flags & PAGER_FLAGS_MASK));
#endif
- sqlite3BtreeLeave(aNew->pBt);
+ sqlite3BtreeLeave(pNew->pBt);
}
- aNew->safety_level = SQLITE_DEFAULT_SYNCHRONOUS+1;
- aNew->zDbSName = sqlite3DbStrDup(db, zName);
- if( rc==SQLITE_OK && aNew->zDbSName==0 ){
+ pNew->safety_level = SQLITE_DEFAULT_SYNCHRONOUS+1;
+ pNew->zDbSName = sqlite3DbStrDup(db, zName);
+ if( rc==SQLITE_OK && pNew->zDbSName==0 ){
rc = SQLITE_NOMEM_BKPT;
}
@@ -99121,11 +100130,6 @@ static void detachFunc(
sqlite3_snprintf(sizeof(zErr),zErr, "cannot detach database %s", zName);
goto detach_error;
}
- if( !db->autoCommit ){
- sqlite3_snprintf(sizeof(zErr), zErr,
- "cannot DETACH database within transaction");
- goto detach_error;
- }
if( sqlite3BtreeIsInReadTrans(pDb->pBt) || sqlite3BtreeIsInBackup(pDb->pBt) ){
sqlite3_snprintf(sizeof(zErr),zErr, "database %s is locked", zName);
goto detach_error;
@@ -99538,11 +100542,9 @@ SQLITE_PRIVATE int sqlite3AuthReadCol(
#endif
);
if( rc==SQLITE_DENY ){
- if( db->nDb>2 || iDb!=0 ){
- sqlite3ErrorMsg(pParse, "access to %s.%s.%s is prohibited",zDb,zTab,zCol);
- }else{
- sqlite3ErrorMsg(pParse, "access to %s.%s is prohibited", zTab, zCol);
- }
+ char *z = sqlite3_mprintf("%s.%s", zTab, zCol);
+ if( db->nDb>2 || iDb!=0 ) z = sqlite3_mprintf("%s.%z", zDb, z);
+ sqlite3ErrorMsg(pParse, "access to %z is prohibited", z);
pParse->rc = SQLITE_AUTH;
}else if( rc!=SQLITE_IGNORE && rc!=SQLITE_OK ){
sqliteAuthBadReturnCode(pParse);
@@ -100175,7 +101177,7 @@ SQLITE_PRIVATE void sqlite3UnlinkAndDeleteIndex(sqlite3 *db, int iDb, const char
}
freeIndex(db, pIndex);
}
- db->flags |= SQLITE_InternChanges;
+ db->mDbFlags |= DBFLAG_SchemaChange;
}
/*
@@ -100210,28 +101212,26 @@ SQLITE_PRIVATE void sqlite3CollapseDatabaseArray(sqlite3 *db){
/*
** Reset the schema for the database at index iDb. Also reset the
-** TEMP schema.
+** TEMP schema. The reset is deferred if db->nSchemaLock is not zero.
+** Deferred resets may be run by calling with iDb<0.
*/
SQLITE_PRIVATE void sqlite3ResetOneSchema(sqlite3 *db, int iDb){
- Db *pDb;
+ int i;
assert( iDb<db->nDb );
- /* Case 1: Reset the single schema identified by iDb */
- pDb = &db->aDb[iDb];
- assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
- assert( pDb->pSchema!=0 );
- sqlite3SchemaClear(pDb->pSchema);
+ if( iDb>=0 ){
+ assert( sqlite3SchemaMutexHeld(db, iDb, 0) );
+ DbSetProperty(db, iDb, DB_ResetWanted);
+ DbSetProperty(db, 1, DB_ResetWanted);
+ }
- /* If any database other than TEMP is reset, then also reset TEMP
- ** since TEMP might be holding triggers that reference tables in the
- ** other database.
- */
- if( iDb!=1 ){
- pDb = &db->aDb[1];
- assert( pDb->pSchema!=0 );
- sqlite3SchemaClear(pDb->pSchema);
+ if( db->nSchemaLock==0 ){
+ for(i=0; i<db->nDb; i++){
+ if( DbHasProperty(db, i, DB_ResetWanted) ){
+ sqlite3SchemaClear(db->aDb[i].pSchema);
+ }
+ }
}
- return;
}
/*
@@ -100241,13 +101241,14 @@ SQLITE_PRIVATE void sqlite3ResetOneSchema(sqlite3 *db, int iDb){
SQLITE_PRIVATE void sqlite3ResetAllSchemasOfConnection(sqlite3 *db){
int i;
sqlite3BtreeEnterAll(db);
+ assert( db->nSchemaLock==0 );
for(i=0; i<db->nDb; i++){
Db *pDb = &db->aDb[i];
if( pDb->pSchema ){
sqlite3SchemaClear(pDb->pSchema);
}
}
- db->flags &= ~SQLITE_InternChanges;
+ db->mDbFlags &= ~DBFLAG_SchemaChange;
sqlite3VtabUnlockList(db);
sqlite3BtreeLeaveAll(db);
sqlite3CollapseDatabaseArray(db);
@@ -100257,7 +101258,7 @@ SQLITE_PRIVATE void sqlite3ResetAllSchemasOfConnection(sqlite3 *db){
** This routine is called when a commit occurs.
*/
SQLITE_PRIVATE void sqlite3CommitInternalChanges(sqlite3 *db){
- db->flags &= ~SQLITE_InternChanges;
+ db->mDbFlags &= ~DBFLAG_SchemaChange;
}
/*
@@ -100295,13 +101296,16 @@ SQLITE_PRIVATE void sqlite3DeleteColumnNames(sqlite3 *db, Table *pTable){
*/
static void SQLITE_NOINLINE deleteTable(sqlite3 *db, Table *pTable){
Index *pIndex, *pNext;
- TESTONLY( int nLookaside; ) /* Used to verify lookaside not used for schema */
+#ifdef SQLITE_DEBUG
/* Record the number of outstanding lookaside allocations in schema Tables
** prior to doing any free() operations. Since schema Tables do not use
** lookaside, this number should not change. */
- TESTONLY( nLookaside = (db && (pTable->tabFlags & TF_Ephemeral)==0) ?
- db->lookaside.nOut : 0 );
+ int nLookaside = 0;
+ if( db && (pTable->tabFlags & TF_Ephemeral)==0 ){
+ nLookaside = sqlite3LookasideUsed(db, 0);
+ }
+#endif
/* Delete all indices associated with this table. */
for(pIndex = pTable->pIndex; pIndex; pIndex=pNext){
@@ -100335,7 +101339,7 @@ static void SQLITE_NOINLINE deleteTable(sqlite3 *db, Table *pTable){
sqlite3DbFree(db, pTable);
/* Verify that no lookaside memory was used by schema tables */
- assert( nLookaside==0 || nLookaside==db->lookaside.nOut );
+ assert( nLookaside==0 || nLookaside==sqlite3LookasideUsed(db,0) );
}
SQLITE_PRIVATE void sqlite3DeleteTable(sqlite3 *db, Table *pTable){
/* Do not delete the table until the reference count reaches zero. */
@@ -100361,7 +101365,7 @@ SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTable(sqlite3 *db, int iDb, const char
pDb = &db->aDb[iDb];
p = sqlite3HashInsert(&pDb->pSchema->tblHash, zTabName, 0);
sqlite3DeleteTable(db, p);
- db->flags |= SQLITE_InternChanges;
+ db->mDbFlags |= DBFLAG_SchemaChange;
}
/*
@@ -100474,7 +101478,8 @@ SQLITE_PRIVATE int sqlite3TwoPartName(
return -1;
}
}else{
- assert( db->init.iDb==0 || db->init.busy || (db->flags & SQLITE_Vacuum)!=0);
+ assert( db->init.iDb==0 || db->init.busy
+ || (db->mDbFlags & DBFLAG_Vacuum)!=0);
iDb = db->init.iDb;
*pUnqual = pName1;
}
@@ -100635,7 +101640,11 @@ SQLITE_PRIVATE void sqlite3StartTable(
pTable->iPKey = -1;
pTable->pSchema = db->aDb[iDb].pSchema;
pTable->nTabRef = 1;
+#ifdef SQLITE_DEFAULT_ROWEST
+ pTable->nRowLogEst = sqlite3LogEst(SQLITE_DEFAULT_ROWEST);
+#else
pTable->nRowLogEst = 200; assert( 200==sqlite3LogEst(1048576) );
+#endif
assert( pParse->pNewTable==0 );
pParse->pNewTable = pTable;
@@ -100702,7 +101711,8 @@ SQLITE_PRIVATE void sqlite3StartTable(
}else
#endif
{
- pParse->addrCrTab = sqlite3VdbeAddOp2(v, OP_CreateTable, iDb, reg2);
+ pParse->addrCrTab =
+ sqlite3VdbeAddOp3(v, OP_CreateBtree, iDb, reg2, BTREE_INTKEY);
}
sqlite3OpenMasterTable(pParse, iDb);
sqlite3VdbeAddOp2(v, OP_NewRowid, 0, reg1);
@@ -100751,12 +101761,10 @@ SQLITE_PRIVATE void sqlite3AddColumn(Parse *pParse, Token *pName, Token *pType){
Column *pCol;
sqlite3 *db = pParse->db;
if( (p = pParse->pNewTable)==0 ) return;
-#if SQLITE_MAX_COLUMN
if( p->nCol+1>db->aLimit[SQLITE_LIMIT_COLUMN] ){
sqlite3ErrorMsg(pParse, "too many columns on %s", p->zName);
return;
}
-#endif
z = sqlite3DbMallocRaw(db, pName->n + pType->n + 2);
if( z==0 ) return;
memcpy(z, pName->z, pName->n);
@@ -101362,9 +102370,8 @@ static int hasColumn(const i16 *aiCol, int nCol, int x){
** Changes include:
**
** (1) Set all columns of the PRIMARY KEY schema object to be NOT NULL.
-** (2) Convert the OP_CreateTable into an OP_CreateIndex. There is
-** no rowid btree for a WITHOUT ROWID. Instead, the canonical
-** data storage is a covering index btree.
+** (2) Convert P3 parameter of the OP_CreateBtree from BTREE_INTKEY
+** into BTREE_BLOBKEY.
** (3) Bypass the creation of the sqlite_master table entry
** for the PRIMARY KEY as the primary key index is now
** identified by the sqlite_master table entry of the table itself.
@@ -101372,7 +102379,7 @@ static int hasColumn(const i16 *aiCol, int nCol, int x){
** schema to the rootpage from the main table.
** (5) Add all table columns to the PRIMARY KEY Index object
** so that the PRIMARY KEY is a covering index. The surplus
-** columns are part of KeyInfo.nXField and are not used for
+** columns are part of KeyInfo.nAllField and are not used for
** sorting or lookup or uniqueness checks.
** (6) Replace the rowid tail on all automatically generated UNIQUE
** indices with the PRIMARY KEY columns.
@@ -101401,13 +102408,12 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){
** virtual tables */
if( IN_DECLARE_VTAB ) return;
- /* Convert the OP_CreateTable opcode that would normally create the
- ** root-page for the table into an OP_CreateIndex opcode. The index
- ** created will become the PRIMARY KEY index.
+ /* Convert the P3 operand of the OP_CreateBtree opcode from BTREE_INTKEY
+ ** into BTREE_BLOBKEY.
*/
if( pParse->addrCrTab ){
assert( v );
- sqlite3VdbeChangeOpcode(v, pParse->addrCrTab, OP_CreateIndex);
+ sqlite3VdbeChangeP3(v, pParse->addrCrTab, BTREE_BLOBKEY);
}
/* Locate the PRIMARY KEY index. Or, if this table was originally
@@ -101430,15 +102436,6 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){
}else{
pPk = sqlite3PrimaryKeyIndex(pTab);
- /* Bypass the creation of the PRIMARY KEY btree and the sqlite_master
- ** table entry. This is only required if currently generating VDBE
- ** code for a CREATE TABLE (not when parsing one as part of reading
- ** a database schema). */
- if( v ){
- assert( db->init.busy==0 );
- sqlite3VdbeChangeOpcode(v, pPk->tnum, OP_Goto);
- }
-
/*
** Remove all redundant columns from the PRIMARY KEY. For example, change
** "PRIMARY KEY(a,b,a,b,c,b,c,d)" into just "PRIMARY KEY(a,b,c,d)". Later
@@ -101458,6 +102455,15 @@ static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){
if( !db->init.imposterTable ) pPk->uniqNotNull = 1;
nPk = pPk->nKeyCol;
+ /* Bypass the creation of the PRIMARY KEY btree and the sqlite_master
+ ** table entry. This is only required if currently generating VDBE
+ ** code for a CREATE TABLE (not when parsing one as part of reading
+ ** a database schema). */
+ if( v && pPk->tnum>0 ){
+ assert( db->init.busy==0 );
+ sqlite3VdbeChangeOpcode(v, pPk->tnum, OP_Goto);
+ }
+
/* The root page of the PRIMARY KEY is the table root page */
pPk->tnum = pTab->tnum;
@@ -101747,7 +102753,7 @@ SQLITE_PRIVATE void sqlite3EndTable(
return;
}
pParse->pNewTable = 0;
- db->flags |= SQLITE_InternChanges;
+ db->mDbFlags |= DBFLAG_SchemaChange;
#ifndef SQLITE_OMIT_ALTERTABLE
if( !p->pSelect ){
@@ -101846,6 +102852,9 @@ SQLITE_PRIVATE int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){
int nErr = 0; /* Number of errors encountered */
int n; /* Temporarily holds the number of cursors assigned */
sqlite3 *db = pParse->db; /* Database connection for malloc errors */
+#ifndef SQLITE_OMIT_VIRTUALTABLE
+ int rc;
+#endif
#ifndef SQLITE_OMIT_AUTHORIZATION
sqlite3_xauth xAuth; /* Saved xAuth pointer */
#endif
@@ -101853,8 +102862,11 @@ SQLITE_PRIVATE int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){
assert( pTable );
#ifndef SQLITE_OMIT_VIRTUALTABLE
- if( sqlite3VtabCallConnect(pParse, pTable) ){
- return SQLITE_ERROR;
+ db->nSchemaLock++;
+ rc = sqlite3VtabCallConnect(pParse, pTable);
+ db->nSchemaLock--;
+ if( rc ){
+ return 1;
}
if( IsVirtual(pTable) ) return 0;
#endif
@@ -102050,14 +103062,6 @@ static void destroyRootPage(Parse *pParse, int iTable, int iDb){
** is also added (this can happen with an auto-vacuum database).
*/
static void destroyTable(Parse *pParse, Table *pTab){
-#ifdef SQLITE_OMIT_AUTOVACUUM
- Index *pIdx;
- int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema);
- destroyRootPage(pParse, pTab->tnum, iDb);
- for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
- destroyRootPage(pParse, pIdx->tnum, iDb);
- }
-#else
/* If the database may be auto-vacuum capable (if SQLITE_OMIT_AUTOVACUUM
** is not defined), then it is important to call OP_Destroy on the
** table and index root-pages in order, starting with the numerically
@@ -102100,7 +103104,6 @@ static void destroyTable(Parse *pParse, Table *pTab){
iDestroyed = iLargest;
}
}
-#endif
}
/*
@@ -102527,7 +103530,7 @@ static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){
addr2 = sqlite3VdbeCurrentAddr(v);
}
sqlite3VdbeAddOp3(v, OP_SorterData, iSorter, regRecord, iIdx);
- sqlite3VdbeAddOp3(v, OP_Last, iIdx, 0, -1);
+ sqlite3VdbeAddOp1(v, OP_SeekEnd, iIdx);
sqlite3VdbeAddOp2(v, OP_IdxInsert, iIdx, regRecord);
sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
sqlite3ReleaseTempReg(pParse, regRecord);
@@ -103016,7 +104019,7 @@ SQLITE_PRIVATE void sqlite3CreateIndex(
sqlite3OomFault(db);
goto exit_create_index;
}
- db->flags |= SQLITE_InternChanges;
+ db->mDbFlags |= DBFLAG_SchemaChange;
if( pTblName!=0 ){
pIndex->tnum = db->init.newTnum;
}
@@ -103052,7 +104055,7 @@ SQLITE_PRIVATE void sqlite3CreateIndex(
** that case the convertToWithoutRowidTable() routine will replace
** the Noop with a Goto to jump over the VDBE code generated below. */
pIndex->tnum = sqlite3VdbeAddOp0(v, OP_Noop);
- sqlite3VdbeAddOp2(v, OP_CreateIndex, iDb, iMem);
+ sqlite3VdbeAddOp3(v, OP_CreateBtree, iDb, iMem, BTREE_BLOBKEY);
/* Gather the complete text of the CREATE INDEX statement into
** the zStmt variable
@@ -103464,12 +104467,12 @@ SQLITE_PRIVATE SrcList *sqlite3SrcListAppend(
pDatabase = 0;
}
if( pDatabase ){
- Token *pTemp = pDatabase;
- pDatabase = pTable;
- pTable = pTemp;
+ pItem->zName = sqlite3NameFromToken(db, pDatabase);
+ pItem->zDatabase = sqlite3NameFromToken(db, pTable);
+ }else{
+ pItem->zName = sqlite3NameFromToken(db, pTable);
+ pItem->zDatabase = 0;
}
- pItem->zName = sqlite3NameFromToken(db, pTable);
- pItem->zDatabase = sqlite3NameFromToken(db, pDatabase);
return pList;
}
@@ -103574,8 +104577,10 @@ SQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm(
*/
SQLITE_PRIVATE void sqlite3SrcListIndexedBy(Parse *pParse, SrcList *p, Token *pIndexedBy){
assert( pIndexedBy!=0 );
- if( p && ALWAYS(p->nSrc>0) ){
- struct SrcList_item *pItem = &p->a[p->nSrc-1];
+ if( p && pIndexedBy->n>0 ){
+ struct SrcList_item *pItem;
+ assert( p->nSrc>0 );
+ pItem = &p->a[p->nSrc-1];
assert( pItem->fg.notIndexed==0 );
assert( pItem->fg.isIndexedBy==0 );
assert( pItem->fg.isTabFunc==0 );
@@ -103585,7 +104590,7 @@ SQLITE_PRIVATE void sqlite3SrcListIndexedBy(Parse *pParse, SrcList *p, Token *pI
pItem->fg.notIndexed = 1;
}else{
pItem->u1.zIndexedBy = sqlite3NameFromToken(pParse->db, pIndexedBy);
- pItem->fg.isIndexedBy = (pItem->u1.zIndexedBy!=0);
+ pItem->fg.isIndexedBy = 1;
}
}
}
@@ -103658,36 +104663,25 @@ SQLITE_PRIVATE void sqlite3BeginTransaction(Parse *pParse, int type){
}
/*
-** Generate VDBE code for a COMMIT statement.
+** Generate VDBE code for a COMMIT or ROLLBACK statement.
+** Code for ROLLBACK is generated if eType==TK_ROLLBACK. Otherwise
+** code is generated for a COMMIT.
*/
-SQLITE_PRIVATE void sqlite3CommitTransaction(Parse *pParse){
+SQLITE_PRIVATE void sqlite3EndTransaction(Parse *pParse, int eType){
Vdbe *v;
+ int isRollback;
assert( pParse!=0 );
assert( pParse->db!=0 );
- if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, "COMMIT", 0, 0) ){
+ assert( eType==TK_COMMIT || eType==TK_END || eType==TK_ROLLBACK );
+ isRollback = eType==TK_ROLLBACK;
+ if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION,
+ isRollback ? "ROLLBACK" : "COMMIT", 0, 0) ){
return;
}
v = sqlite3GetVdbe(pParse);
if( v ){
- sqlite3VdbeAddOp1(v, OP_AutoCommit, 1);
- }
-}
-
-/*
-** Generate VDBE code for a ROLLBACK statement.
-*/
-SQLITE_PRIVATE void sqlite3RollbackTransaction(Parse *pParse){
- Vdbe *v;
-
- assert( pParse!=0 );
- assert( pParse->db!=0 );
- if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, "ROLLBACK", 0, 0) ){
- return;
- }
- v = sqlite3GetVdbe(pParse);
- if( v ){
- sqlite3VdbeAddOp2(v, OP_AutoCommit, 1, 1);
+ sqlite3VdbeAddOp2(v, OP_AutoCommit, 1, isRollback);
}
}
@@ -103877,7 +104871,9 @@ SQLITE_PRIVATE void sqlite3UniqueConstraint(
assert( pIdx->aiColumn[j]>=0 );
zCol = pTab->aCol[pIdx->aiColumn[j]].zName;
if( j ) sqlite3StrAccumAppend(&errMsg, ", ", 2);
- sqlite3XPrintf(&errMsg, "%s.%s", pTab->zName, zCol);
+ sqlite3StrAccumAppendAll(&errMsg, pTab->zName);
+ sqlite3StrAccumAppend(&errMsg, ".", 1);
+ sqlite3StrAccumAppendAll(&errMsg, zCol);
}
}
zErr = sqlite3StrAccumFinish(&errMsg);
@@ -104266,7 +105262,7 @@ SQLITE_PRIVATE CollSeq *sqlite3GetCollSeq(
** from the main database is substituted, if one is available.
*/
SQLITE_PRIVATE int sqlite3CheckCollSeq(Parse *pParse, CollSeq *pColl){
- if( pColl ){
+ if( pColl && pColl->xCmp==0 ){
const char *zName = pColl->zName;
sqlite3 *db = pParse->db;
CollSeq *p = sqlite3GetCollSeq(pParse, ENC(db), pColl, zName);
@@ -104302,8 +105298,8 @@ static CollSeq *findCollSeqEntry(
pColl = sqlite3HashFind(&db->aCollSeq, zName);
if( 0==pColl && create ){
- int nName = sqlite3Strlen30(zName);
- pColl = sqlite3DbMallocZero(db, 3*sizeof(*pColl) + nName + 1);
+ int nName = sqlite3Strlen30(zName) + 1;
+ pColl = sqlite3DbMallocZero(db, 3*sizeof(*pColl) + nName);
if( pColl ){
CollSeq *pDel = 0;
pColl[0].zName = (char*)&pColl[3];
@@ -104313,7 +105309,6 @@ static CollSeq *findCollSeqEntry(
pColl[2].zName = (char*)&pColl[3];
pColl[2].enc = SQLITE_UTF16BE;
memcpy(pColl[0].zName, zName, nName);
- pColl[0].zName[nName] = 0;
pDel = sqlite3HashInsert(&db->aCollSeq, pColl[0].zName, pColl);
/* If a malloc() failure occurred in sqlite3HashInsert(), it will
@@ -104453,7 +105448,8 @@ SQLITE_PRIVATE void sqlite3InsertBuiltinFuncs(
FuncDef *pOther;
const char *zName = aDef[i].zName;
int nName = sqlite3Strlen30(zName);
- int h = (sqlite3UpperToLower[(u8)zName[0]] + nName) % SQLITE_FUNC_HASH_SZ;
+ int h = (zName[0] + nName) % SQLITE_FUNC_HASH_SZ;
+ assert( zName[0]>='a' && zName[0]<='z' );
pOther = functionSearch(h, zName);
if( pOther ){
assert( pOther!=&aDef[i] && pOther->pNext!=&aDef[i] );
@@ -104519,7 +105515,7 @@ SQLITE_PRIVATE FuncDef *sqlite3FindFunction(
/* If no match is found, search the built-in functions.
**
- ** If the SQLITE_PreferBuiltin flag is set, then search the built-in
+ ** If the DBFLAG_PreferBuiltin flag is set, then search the built-in
** functions even if a prior app-defined function was found. And give
** priority to built-in functions.
**
@@ -104529,7 +105525,7 @@ SQLITE_PRIVATE FuncDef *sqlite3FindFunction(
** new function. But the FuncDefs for built-in functions are read-only.
** So we must not search for built-ins when creating a new function.
*/
- if( !createFlag && (pBest==0 || (db->flags & SQLITE_PreferBuiltin)!=0) ){
+ if( !createFlag && (pBest==0 || (db->mDbFlags & DBFLAG_PreferBuiltin)!=0) ){
bestScore = 0;
h = (sqlite3UpperToLower[(u8)zName[0]] + nName) % SQLITE_FUNC_HASH_SZ;
p = functionSearch(h, zName);
@@ -104602,8 +105598,8 @@ SQLITE_PRIVATE void sqlite3SchemaClear(void *p){
pSchema->pSeqTab = 0;
if( pSchema->schemaFlags & DB_SchemaLoaded ){
pSchema->iGeneration++;
- pSchema->schemaFlags &= ~DB_SchemaLoaded;
}
+ pSchema->schemaFlags &= ~(DB_SchemaLoaded|DB_ResetWanted);
}
/*
@@ -104986,7 +105982,7 @@ SQLITE_PRIVATE void sqlite3DeleteFrom(
** API function sqlite3_count_changes) to be set incorrectly.
**
** The "rcauth==SQLITE_OK" terms is the
- ** IMPLEMENATION-OF: R-17228-37124 If the action code is SQLITE_DELETE and
+ ** IMPLEMENTATION-OF: R-17228-37124 If the action code is SQLITE_DELETE and
** the callback returns SQLITE_IGNORE then the DELETE operation proceeds but
** the truncate optimization is disabled and all rows are deleted
** individually.
@@ -105092,7 +106088,7 @@ SQLITE_PRIVATE void sqlite3DeleteFrom(
sqlite3VdbeAddOp4Int(v, OP_IdxInsert, iEphCur, iKey, iPk, nPk);
}else{
/* Add the rowid of the row to be deleted to the RowSet */
- nKey = 1; /* OP_Seek always uses a single rowid */
+ nKey = 1; /* OP_DeferredSeek always uses a single rowid */
sqlite3VdbeAddOp2(v, OP_RowSetAdd, iRowSet, iKey);
}
}
@@ -105135,7 +106131,11 @@ SQLITE_PRIVATE void sqlite3DeleteFrom(
}
}else if( pPk ){
addrLoop = sqlite3VdbeAddOp1(v, OP_Rewind, iEphCur); VdbeCoverage(v);
- sqlite3VdbeAddOp2(v, OP_RowData, iEphCur, iKey);
+ if( IsVirtual(pTab) ){
+ sqlite3VdbeAddOp3(v, OP_Column, iEphCur, 0, iKey);
+ }else{
+ sqlite3VdbeAddOp2(v, OP_RowData, iEphCur, iKey);
+ }
assert( nKey==0 ); /* OP_Found will use a composite key */
}else{
addrLoop = sqlite3VdbeAddOp3(v, OP_RowSetRead, iRowSet, 0, iKey);
@@ -105485,10 +106485,11 @@ SQLITE_PRIVATE int sqlite3GenerateIndexKey(
if( piPartIdxLabel ){
if( pIdx->pPartIdxWhere ){
*piPartIdxLabel = sqlite3VdbeMakeLabel(v);
- pParse->iSelfTab = iDataCur;
+ pParse->iSelfTab = iDataCur + 1;
sqlite3ExprCachePush(pParse);
sqlite3ExprIfFalseDup(pParse, pIdx->pPartIdxWhere, *piPartIdxLabel,
SQLITE_JUMPIFNULL);
+ pParse->iSelfTab = 0;
}else{
*piPartIdxLabel = 0;
}
@@ -105616,16 +106617,20 @@ static void typeofFunc(
int NotUsed,
sqlite3_value **argv
){
- const char *z = 0;
+ static const char *azType[] = { "integer", "real", "text", "blob", "null" };
+ int i = sqlite3_value_type(argv[0]) - 1;
UNUSED_PARAMETER(NotUsed);
- switch( sqlite3_value_type(argv[0]) ){
- case SQLITE_INTEGER: z = "integer"; break;
- case SQLITE_TEXT: z = "text"; break;
- case SQLITE_FLOAT: z = "real"; break;
- case SQLITE_BLOB: z = "blob"; break;
- default: z = "null"; break;
- }
- sqlite3_result_text(context, z, -1, SQLITE_STATIC);
+ assert( i>=0 && i<ArraySize(azType) );
+ assert( SQLITE_INTEGER==1 );
+ assert( SQLITE_FLOAT==2 );
+ assert( SQLITE_TEXT==3 );
+ assert( SQLITE_BLOB==4 );
+ assert( SQLITE_NULL==5 );
+ /* EVIDENCE-OF: R-01470-60482 The sqlite3_value_type(V) interface returns
+ ** the datatype code for the initial datatype of the sqlite3_value object
+ ** V. The returned value is one of SQLITE_INTEGER, SQLITE_FLOAT,
+ ** SQLITE_TEXT, SQLITE_BLOB, or SQLITE_NULL. */
+ sqlite3_result_text(context, azType[i], -1, SQLITE_STATIC);
}
@@ -106401,7 +107406,8 @@ static void likeFunc(
#ifdef SQLITE_TEST
sqlite3_like_count++;
#endif
- sqlite3_result_int(context, patternCompare(zB, zA, pInfo, escape)==SQLITE_MATCH);
+ sqlite3_result_int(context,
+ patternCompare(zB, zA, pInfo, escape)==SQLITE_MATCH);
}
}
@@ -107242,9 +108248,14 @@ SQLITE_PRIVATE void sqlite3RegisterLikeFunctions(sqlite3 *db, int caseSensitive)
/*
** pExpr points to an expression which implements a function. If
** it is appropriate to apply the LIKE optimization to that function
-** then set aWc[0] through aWc[2] to the wildcard characters and
-** return TRUE. If the function is not a LIKE-style function then
-** return FALSE.
+** then set aWc[0] through aWc[2] to the wildcard characters and the
+** escape character and then return TRUE. If the function is not a
+** LIKE-style function then return FALSE.
+**
+** The expression "a LIKE b ESCAPE c" is only considered a valid LIKE
+** operator if c is a string literal that is exactly one byte in length.
+** That one byte is stored in aWc[3]. aWc[3] is set to zero if there is
+** no ESCAPE clause.
**
** *pIsNocase is set to true if uppercase and lowercase are equivalent for
** the function (default for LIKE). If the function makes the distinction
@@ -107253,17 +108264,26 @@ SQLITE_PRIVATE void sqlite3RegisterLikeFunctions(sqlite3 *db, int caseSensitive)
*/
SQLITE_PRIVATE int sqlite3IsLikeFunction(sqlite3 *db, Expr *pExpr, int *pIsNocase, char *aWc){
FuncDef *pDef;
- if( pExpr->op!=TK_FUNCTION
- || !pExpr->x.pList
- || pExpr->x.pList->nExpr!=2
- ){
+ int nExpr;
+ if( pExpr->op!=TK_FUNCTION || !pExpr->x.pList ){
return 0;
}
assert( !ExprHasProperty(pExpr, EP_xIsSelect) );
- pDef = sqlite3FindFunction(db, pExpr->u.zToken, 2, SQLITE_UTF8, 0);
+ nExpr = pExpr->x.pList->nExpr;
+ pDef = sqlite3FindFunction(db, pExpr->u.zToken, nExpr, SQLITE_UTF8, 0);
if( NEVER(pDef==0) || (pDef->funcFlags & SQLITE_FUNC_LIKE)==0 ){
return 0;
}
+ if( nExpr<3 ){
+ aWc[3] = 0;
+ }else{
+ Expr *pEscape = pExpr->x.pList->a[2].pExpr;
+ char *zEscape;
+ if( pEscape->op!=TK_STRING ) return 0;
+ zEscape = pEscape->u.zToken;
+ if( zEscape[0]==0 || zEscape[1]!=0 ) return 0;
+ aWc[3] = zEscape[0];
+ }
/* The memcpy() statement assumes that the wildcard characters are
** the first three statements in the compareInfo structure. The
@@ -108046,10 +109066,12 @@ static void fkScanChildren(
/* Create VDBE to loop through the entries in pSrc that match the WHERE
** clause. For each row found, increment either the deferred or immediate
** foreign key constraint counter. */
- pWInfo = sqlite3WhereBegin(pParse, pSrc, pWhere, 0, 0, 0, 0);
- sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, nIncr);
- if( pWInfo ){
- sqlite3WhereEnd(pWInfo);
+ if( pParse->nErr==0 ){
+ pWInfo = sqlite3WhereBegin(pParse, pSrc, pWhere, 0, 0, 0, 0);
+ sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, nIncr);
+ if( pWInfo ){
+ sqlite3WhereEnd(pWInfo);
+ }
}
/* Clean up the WHERE clause constructed above. */
@@ -109061,7 +110083,7 @@ static int autoIncBegin(
){
int memId = 0; /* Register holding maximum rowid */
if( (pTab->tabFlags & TF_Autoincrement)!=0
- && (pParse->db->flags & SQLITE_Vacuum)==0
+ && (pParse->db->mDbFlags & DBFLAG_Vacuum)==0
){
Parse *pToplevel = sqlite3ParseToplevel(pParse);
AutoincInfo *pInfo;
@@ -109319,7 +110341,6 @@ SQLITE_PRIVATE void sqlite3Insert(
){
sqlite3 *db; /* The main database structure */
Table *pTab; /* The table to insert into. aka TABLE */
- char *zTab; /* Name of the table into which we are inserting */
int i, j; /* Loop counters */
Vdbe *v; /* Generate code into this virtual machine */
Index *pIdx; /* For looping over indices of the table */
@@ -109356,10 +110377,10 @@ SQLITE_PRIVATE void sqlite3Insert(
#endif
db = pParse->db;
- memset(&dest, 0, sizeof(dest));
if( pParse->nErr || db->mallocFailed ){
goto insert_cleanup;
}
+ dest.iSDParm = 0; /* Suppress a harmless compiler warning */
/* If the Select object is really just a simple VALUES() list with a
** single row (the common case) then keep that one row of values
@@ -109375,8 +110396,6 @@ SQLITE_PRIVATE void sqlite3Insert(
/* Locate the table into which we will be inserting new information.
*/
assert( pTabList->nSrc==1 );
- zTab = pTabList->a[0].zName;
- if( NEVER(zTab==0) ) goto insert_cleanup;
pTab = sqlite3SrcListLookup(pParse, pTabList);
if( pTab==0 ){
goto insert_cleanup;
@@ -110168,7 +111187,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks(
#ifndef SQLITE_OMIT_CHECK
if( pTab->pCheck && (db->flags & SQLITE_IgnoreChecks)==0 ){
ExprList *pCheck = pTab->pCheck;
- pParse->ckBase = regNewData+1;
+ pParse->iSelfTab = -(regNewData+1);
onError = overrideError!=OE_Default ? overrideError : OE_Abort;
for(i=0; i<pCheck->nExpr; i++){
int allOk;
@@ -110188,6 +111207,7 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks(
}
sqlite3VdbeResolveLabel(v, allOk);
}
+ pParse->iSelfTab = 0;
}
#endif /* !defined(SQLITE_OMIT_CHECK) */
@@ -110332,10 +111352,10 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks(
/* Skip partial indices for which the WHERE clause is not true */
if( pIdx->pPartIdxWhere ){
sqlite3VdbeAddOp2(v, OP_Null, 0, aRegIdx[ix]);
- pParse->ckBase = regNewData+1;
+ pParse->iSelfTab = -(regNewData+1);
sqlite3ExprIfFalseDup(pParse, pIdx->pPartIdxWhere, addrUniqueOk,
SQLITE_JUMPIFNULL);
- pParse->ckBase = 0;
+ pParse->iSelfTab = 0;
}
/* Create a record for this index entry as it should appear after
@@ -110346,9 +111366,9 @@ SQLITE_PRIVATE void sqlite3GenerateConstraintChecks(
int iField = pIdx->aiColumn[i];
int x;
if( iField==XN_EXPR ){
- pParse->ckBase = regNewData+1;
+ pParse->iSelfTab = -(regNewData+1);
sqlite3ExprCodeCopy(pParse, pIdx->aColExpr->a[i].pExpr, regIdx+i);
- pParse->ckBase = 0;
+ pParse->iSelfTab = 0;
VdbeComment((v, "%s column %d", pIdx->zName, i));
}else{
if( iField==XN_ROWID || iField==pTab->iPKey ){
@@ -110733,7 +111753,7 @@ static int xferCompatibleIndex(Index *pDest, Index *pSrc){
}
if( pSrc->aiColumn[i]==XN_EXPR ){
assert( pSrc->aColExpr!=0 && pDest->aColExpr!=0 );
- if( sqlite3ExprCompare(pSrc->aColExpr->a[i].pExpr,
+ if( sqlite3ExprCompare(0, pSrc->aColExpr->a[i].pExpr,
pDest->aColExpr->a[i].pExpr, -1)!=0 ){
return 0; /* Different expressions in the index */
}
@@ -110745,7 +111765,7 @@ static int xferCompatibleIndex(Index *pDest, Index *pSrc){
return 0; /* Different collating sequences */
}
}
- if( sqlite3ExprCompare(pSrc->pPartIdxWhere, pDest->pPartIdxWhere, -1) ){
+ if( sqlite3ExprCompare(0, pSrc->pPartIdxWhere, pDest->pPartIdxWhere, -1) ){
return 0; /* Different WHERE clauses */
}
@@ -110893,7 +111913,7 @@ static int xferOptimization(
Column *pDestCol = &pDest->aCol[i];
Column *pSrcCol = &pSrc->aCol[i];
#ifdef SQLITE_ENABLE_HIDDEN_COLUMNS
- if( (db->flags & SQLITE_Vacuum)==0
+ if( (db->mDbFlags & DBFLAG_Vacuum)==0
&& (pDestCol->colFlags | pSrcCol->colFlags) & COLFLAG_HIDDEN
){
return 0; /* Neither table may have __hidden__ columns */
@@ -110969,15 +111989,15 @@ static int xferOptimization(
regRowid = sqlite3GetTempReg(pParse);
sqlite3OpenTable(pParse, iDest, iDbDest, pDest, OP_OpenWrite);
assert( HasRowid(pDest) || destHasUniqueIdx );
- if( (db->flags & SQLITE_Vacuum)==0 && (
+ if( (db->mDbFlags & DBFLAG_Vacuum)==0 && (
(pDest->iPKey<0 && pDest->pIndex!=0) /* (1) */
|| destHasUniqueIdx /* (2) */
|| (onError!=OE_Abort && onError!=OE_Rollback) /* (3) */
)){
/* In some circumstances, we are able to run the xfer optimization
** only if the destination table is initially empty. Unless the
- ** SQLITE_Vacuum flag is set, this block generates code to make
- ** that determination. If SQLITE_Vacuum is set, then the destination
+ ** DBFLAG_Vacuum flag is set, this block generates code to make
+ ** that determination. If DBFLAG_Vacuum is set, then the destination
** table is always empty.
**
** Conditions under which the destination must be empty:
@@ -111013,8 +112033,8 @@ static int xferOptimization(
assert( (pDest->tabFlags & TF_Autoincrement)==0 );
}
sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1);
- if( db->flags & SQLITE_Vacuum ){
- sqlite3VdbeAddOp3(v, OP_Last, iDest, 0, -1);
+ if( db->mDbFlags & DBFLAG_Vacuum ){
+ sqlite3VdbeAddOp1(v, OP_SeekEnd, iDest);
insFlags = OPFLAG_NCHANGE|OPFLAG_LASTROWID|
OPFLAG_APPEND|OPFLAG_USESEEKRESULT;
}else{
@@ -111045,13 +112065,13 @@ static int xferOptimization(
VdbeComment((v, "%s", pDestIdx->zName));
addr1 = sqlite3VdbeAddOp2(v, OP_Rewind, iSrc, 0); VdbeCoverage(v);
sqlite3VdbeAddOp3(v, OP_RowData, iSrc, regData, 1);
- if( db->flags & SQLITE_Vacuum ){
+ if( db->mDbFlags & DBFLAG_Vacuum ){
/* This INSERT command is part of a VACUUM operation, which guarantees
** that the destination table is empty. If all indexed columns use
** collation sequence BINARY, then it can also be assumed that the
** index will be populated by inserting keys in strictly sorted
** order. In this case, instead of seeking within the b-tree as part
- ** of every OP_IdxInsert opcode, an OP_Last is added before the
+ ** of every OP_IdxInsert opcode, an OP_SeekEnd is added before the
** OP_IdxInsert to seek to the point within the b-tree where each key
** should be inserted. This is faster.
**
@@ -111066,7 +112086,7 @@ static int xferOptimization(
}
if( i==pSrcIdx->nColumn ){
idxInsFlags = OPFLAG_USESEEKRESULT;
- sqlite3VdbeAddOp3(v, OP_Last, iDest, 0, -1);
+ sqlite3VdbeAddOp1(v, OP_SeekEnd, iDest);
}
}
if( !HasRowid(pSrc) && pDestIdx->idxType==2 ){
@@ -111225,11 +112245,8 @@ exec_out:
rc = sqlite3ApiExit(db, rc);
if( rc!=SQLITE_OK && pzErrMsg ){
- int nErrMsg = 1 + sqlite3Strlen30(sqlite3_errmsg(db));
- *pzErrMsg = sqlite3Malloc(nErrMsg);
- if( *pzErrMsg ){
- memcpy(*pzErrMsg, sqlite3_errmsg(db), nErrMsg);
- }else{
+ *pzErrMsg = sqlite3DbStrDup(0, sqlite3_errmsg(db));
+ if( *pzErrMsg==0 ){
rc = SQLITE_NOMEM_BKPT;
sqlite3Error(db, SQLITE_NOMEM);
}
@@ -111400,7 +112417,7 @@ struct sqlite3_api_routines {
int (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*,
const char*,const char*),void*);
void (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*));
- char * (*snprintf)(int,char*,const char*,...);
+ char * (*xsnprintf)(int,char*,const char*,...);
int (*step)(sqlite3_stmt*);
int (*table_column_metadata)(sqlite3*,const char*,const char*,const char*,
char const**,char const**,int*,int*,int*);
@@ -111512,7 +112529,7 @@ struct sqlite3_api_routines {
int (*uri_boolean)(const char*,const char*,int);
sqlite3_int64 (*uri_int64)(const char*,const char*,sqlite3_int64);
const char *(*uri_parameter)(const char*,const char*);
- char *(*vsnprintf)(int,char*,const char*,va_list);
+ char *(*xvsnprintf)(int,char*,const char*,va_list);
int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*);
/* Version 3.8.7 and later */
int (*auto_extension)(void(*)(void));
@@ -111550,6 +112567,14 @@ struct sqlite3_api_routines {
char *(*expanded_sql)(sqlite3_stmt*);
/* Version 3.18.0 and later */
void (*set_last_insert_rowid)(sqlite3*,sqlite3_int64);
+ /* Version 3.20.0 and later */
+ int (*prepare_v3)(sqlite3*,const char*,int,unsigned int,
+ sqlite3_stmt**,const char**);
+ int (*prepare16_v3)(sqlite3*,const void*,int,unsigned int,
+ sqlite3_stmt**,const void**);
+ int (*bind_pointer)(sqlite3_stmt*,int,void*,const char*,void(*)(void*));
+ void (*result_pointer)(sqlite3_context*,void*,const char*,void(*)(void*));
+ void *(*value_pointer)(sqlite3_value*,const char*);
};
/*
@@ -111676,7 +112701,7 @@ typedef int (*sqlite3_loadext_entry)(
#define sqlite3_rollback_hook sqlite3_api->rollback_hook
#define sqlite3_set_authorizer sqlite3_api->set_authorizer
#define sqlite3_set_auxdata sqlite3_api->set_auxdata
-#define sqlite3_snprintf sqlite3_api->snprintf
+#define sqlite3_snprintf sqlite3_api->xsnprintf
#define sqlite3_step sqlite3_api->step
#define sqlite3_table_column_metadata sqlite3_api->table_column_metadata
#define sqlite3_thread_cleanup sqlite3_api->thread_cleanup
@@ -111700,7 +112725,7 @@ typedef int (*sqlite3_loadext_entry)(
#define sqlite3_value_text16le sqlite3_api->value_text16le
#define sqlite3_value_type sqlite3_api->value_type
#define sqlite3_vmprintf sqlite3_api->vmprintf
-#define sqlite3_vsnprintf sqlite3_api->vsnprintf
+#define sqlite3_vsnprintf sqlite3_api->xvsnprintf
#define sqlite3_overload_function sqlite3_api->overload_function
#define sqlite3_prepare_v2 sqlite3_api->prepare_v2
#define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2
@@ -111776,7 +112801,7 @@ typedef int (*sqlite3_loadext_entry)(
#define sqlite3_uri_boolean sqlite3_api->uri_boolean
#define sqlite3_uri_int64 sqlite3_api->uri_int64
#define sqlite3_uri_parameter sqlite3_api->uri_parameter
-#define sqlite3_uri_vsnprintf sqlite3_api->vsnprintf
+#define sqlite3_uri_vsnprintf sqlite3_api->xvsnprintf
#define sqlite3_wal_checkpoint_v2 sqlite3_api->wal_checkpoint_v2
/* Version 3.8.7 and later */
#define sqlite3_auto_extension sqlite3_api->auto_extension
@@ -111810,6 +112835,12 @@ typedef int (*sqlite3_loadext_entry)(
#define sqlite3_expanded_sql sqlite3_api->expanded_sql
/* Version 3.18.0 and later */
#define sqlite3_set_last_insert_rowid sqlite3_api->set_last_insert_rowid
+/* Version 3.20.0 and later */
+#define sqlite3_prepare_v3 sqlite3_api->prepare_v3
+#define sqlite3_prepare16_v3 sqlite3_api->prepare16_v3
+#define sqlite3_bind_pointer sqlite3_api->bind_pointer
+#define sqlite3_result_pointer sqlite3_api->result_pointer
+#define sqlite3_value_pointer sqlite3_api->value_pointer
#endif /* !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION) */
#if !defined(SQLITE_CORE) && !defined(SQLITE_OMIT_LOAD_EXTENSION)
@@ -111865,6 +112896,7 @@ typedef int (*sqlite3_loadext_entry)(
# define sqlite3_open16 0
# define sqlite3_prepare16 0
# define sqlite3_prepare16_v2 0
+# define sqlite3_prepare16_v3 0
# define sqlite3_result_error16 0
# define sqlite3_result_text16 0
# define sqlite3_result_text16be 0
@@ -112237,7 +113269,13 @@ static const sqlite3_api_routines sqlite3Apis = {
sqlite3_trace_v2,
sqlite3_expanded_sql,
/* Version 3.18.0 and later */
- sqlite3_set_last_insert_rowid
+ sqlite3_set_last_insert_rowid,
+ /* Version 3.20.0 and later */
+ sqlite3_prepare_v3,
+ sqlite3_prepare16_v3,
+ sqlite3_bind_pointer,
+ sqlite3_result_pointer,
+ sqlite3_value_pointer
};
/*
@@ -112659,35 +113697,38 @@ SQLITE_PRIVATE void sqlite3AutoLoadExtensions(sqlite3 *db){
#define PragTyp_ENCODING 12
#define PragTyp_FOREIGN_KEY_CHECK 13
#define PragTyp_FOREIGN_KEY_LIST 14
-#define PragTyp_INCREMENTAL_VACUUM 15
-#define PragTyp_INDEX_INFO 16
-#define PragTyp_INDEX_LIST 17
-#define PragTyp_INTEGRITY_CHECK 18
-#define PragTyp_JOURNAL_MODE 19
-#define PragTyp_JOURNAL_SIZE_LIMIT 20
-#define PragTyp_LOCK_PROXY_FILE 21
-#define PragTyp_LOCKING_MODE 22
-#define PragTyp_PAGE_COUNT 23
-#define PragTyp_MMAP_SIZE 24
-#define PragTyp_OPTIMIZE 25
-#define PragTyp_PAGE_SIZE 26
-#define PragTyp_SECURE_DELETE 27
-#define PragTyp_SHRINK_MEMORY 28
-#define PragTyp_SOFT_HEAP_LIMIT 29
-#define PragTyp_SYNCHRONOUS 30
-#define PragTyp_TABLE_INFO 31
-#define PragTyp_TEMP_STORE 32
-#define PragTyp_TEMP_STORE_DIRECTORY 33
-#define PragTyp_THREADS 34
-#define PragTyp_WAL_AUTOCHECKPOINT 35
-#define PragTyp_WAL_CHECKPOINT 36
-#define PragTyp_ACTIVATE_EXTENSIONS 37
-#define PragTyp_HEXKEY 38
-#define PragTyp_KEY 39
-#define PragTyp_REKEY 40
-#define PragTyp_LOCK_STATUS 41
-#define PragTyp_PARSER_TRACE 42
-#define PragTyp_STATS 43
+#define PragTyp_FUNCTION_LIST 15
+#define PragTyp_INCREMENTAL_VACUUM 16
+#define PragTyp_INDEX_INFO 17
+#define PragTyp_INDEX_LIST 18
+#define PragTyp_INTEGRITY_CHECK 19
+#define PragTyp_JOURNAL_MODE 20
+#define PragTyp_JOURNAL_SIZE_LIMIT 21
+#define PragTyp_LOCK_PROXY_FILE 22
+#define PragTyp_LOCKING_MODE 23
+#define PragTyp_PAGE_COUNT 24
+#define PragTyp_MMAP_SIZE 25
+#define PragTyp_MODULE_LIST 26
+#define PragTyp_OPTIMIZE 27
+#define PragTyp_PAGE_SIZE 28
+#define PragTyp_PRAGMA_LIST 29
+#define PragTyp_SECURE_DELETE 30
+#define PragTyp_SHRINK_MEMORY 31
+#define PragTyp_SOFT_HEAP_LIMIT 32
+#define PragTyp_SYNCHRONOUS 33
+#define PragTyp_TABLE_INFO 34
+#define PragTyp_TEMP_STORE 35
+#define PragTyp_TEMP_STORE_DIRECTORY 36
+#define PragTyp_THREADS 37
+#define PragTyp_WAL_AUTOCHECKPOINT 38
+#define PragTyp_WAL_CHECKPOINT 39
+#define PragTyp_ACTIVATE_EXTENSIONS 40
+#define PragTyp_HEXKEY 41
+#define PragTyp_KEY 42
+#define PragTyp_REKEY 43
+#define PragTyp_LOCK_STATUS 44
+#define PragTyp_PARSER_TRACE 45
+#define PragTyp_STATS 46
/* Property flags associated with various pragma. */
#define PragFlg_NeedSchema 0x01 /* Force schema load before running */
@@ -112733,26 +113774,29 @@ static const char *const pragCName[] = {
/* 26 */ "seq", /* Used by: database_list */
/* 27 */ "name",
/* 28 */ "file",
- /* 29 */ "seq", /* Used by: collation_list */
- /* 30 */ "name",
- /* 31 */ "id", /* Used by: foreign_key_list */
- /* 32 */ "seq",
- /* 33 */ "table",
- /* 34 */ "from",
- /* 35 */ "to",
- /* 36 */ "on_update",
- /* 37 */ "on_delete",
- /* 38 */ "match",
- /* 39 */ "table", /* Used by: foreign_key_check */
- /* 40 */ "rowid",
- /* 41 */ "parent",
- /* 42 */ "fkid",
- /* 43 */ "busy", /* Used by: wal_checkpoint */
- /* 44 */ "log",
- /* 45 */ "checkpointed",
- /* 46 */ "timeout", /* Used by: busy_timeout */
- /* 47 */ "database", /* Used by: lock_status */
- /* 48 */ "status",
+ /* 29 */ "name", /* Used by: function_list */
+ /* 30 */ "builtin",
+ /* 31 */ "name", /* Used by: module_list pragma_list */
+ /* 32 */ "seq", /* Used by: collation_list */
+ /* 33 */ "name",
+ /* 34 */ "id", /* Used by: foreign_key_list */
+ /* 35 */ "seq",
+ /* 36 */ "table",
+ /* 37 */ "from",
+ /* 38 */ "to",
+ /* 39 */ "on_update",
+ /* 40 */ "on_delete",
+ /* 41 */ "match",
+ /* 42 */ "table", /* Used by: foreign_key_check */
+ /* 43 */ "rowid",
+ /* 44 */ "parent",
+ /* 45 */ "fkid",
+ /* 46 */ "busy", /* Used by: wal_checkpoint */
+ /* 47 */ "log",
+ /* 48 */ "checkpointed",
+ /* 49 */ "timeout", /* Used by: busy_timeout */
+ /* 50 */ "database", /* Used by: lock_status */
+ /* 51 */ "status",
};
/* Definitions of all built-in pragmas */
@@ -112798,7 +113842,7 @@ static const PragmaName aPragmaName[] = {
{/* zName: */ "busy_timeout",
/* ePragTyp: */ PragTyp_BUSY_TIMEOUT,
/* ePragFlg: */ PragFlg_Result0,
- /* ColNames: */ 46, 1,
+ /* ColNames: */ 49, 1,
/* iArg: */ 0 },
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
{/* zName: */ "cache_size",
@@ -112835,7 +113879,7 @@ static const PragmaName aPragmaName[] = {
{/* zName: */ "collation_list",
/* ePragTyp: */ PragTyp_COLLATION_LIST,
/* ePragFlg: */ PragFlg_Result0,
- /* ColNames: */ 29, 2,
+ /* ColNames: */ 32, 2,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_COMPILEOPTION_DIAGS)
@@ -112906,15 +113950,15 @@ static const PragmaName aPragmaName[] = {
#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER)
{/* zName: */ "foreign_key_check",
/* ePragTyp: */ PragTyp_FOREIGN_KEY_CHECK,
- /* ePragFlg: */ PragFlg_NeedSchema,
- /* ColNames: */ 39, 4,
+ /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0,
+ /* ColNames: */ 42, 4,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_FOREIGN_KEY)
{/* zName: */ "foreign_key_list",
/* ePragTyp: */ PragTyp_FOREIGN_KEY_LIST,
/* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result1|PragFlg_SchemaOpt,
- /* ColNames: */ 31, 8,
+ /* ColNames: */ 34, 8,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
@@ -112945,6 +113989,15 @@ static const PragmaName aPragmaName[] = {
/* ColNames: */ 0, 0,
/* iArg: */ SQLITE_FullFSync },
#endif
+#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
+#if defined(SQLITE_INTROSPECTION_PRAGMAS)
+ {/* zName: */ "function_list",
+ /* ePragTyp: */ PragTyp_FUNCTION_LIST,
+ /* ePragFlg: */ PragFlg_Result0,
+ /* ColNames: */ 29, 2,
+ /* iArg: */ 0 },
+#endif
+#endif
#if defined(SQLITE_HAS_CODEC)
{/* zName: */ "hexkey",
/* ePragTyp: */ PragTyp_HEXKEY,
@@ -112993,7 +114046,7 @@ static const PragmaName aPragmaName[] = {
#if !defined(SQLITE_OMIT_INTEGRITY_CHECK)
{/* zName: */ "integrity_check",
/* ePragTyp: */ PragTyp_INTEGRITY_CHECK,
- /* ePragFlg: */ PragFlg_NeedSchema,
+ /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_Result1,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
#endif
@@ -113034,7 +114087,7 @@ static const PragmaName aPragmaName[] = {
{/* zName: */ "lock_status",
/* ePragTyp: */ PragTyp_LOCK_STATUS,
/* ePragFlg: */ PragFlg_Result0,
- /* ColNames: */ 47, 2,
+ /* ColNames: */ 50, 2,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_PAGER_PRAGMAS)
@@ -113054,6 +114107,17 @@ static const PragmaName aPragmaName[] = {
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
#endif
+#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS)
+#if !defined(SQLITE_OMIT_VIRTUALTABLE)
+#if defined(SQLITE_INTROSPECTION_PRAGMAS)
+ {/* zName: */ "module_list",
+ /* ePragTyp: */ PragTyp_MODULE_LIST,
+ /* ePragFlg: */ PragFlg_Result0,
+ /* ColNames: */ 31, 1,
+ /* iArg: */ 0 },
+#endif
+#endif
+#endif
{/* zName: */ "optimize",
/* ePragTyp: */ PragTyp_OPTIMIZE,
/* ePragFlg: */ PragFlg_Result1|PragFlg_NeedSchema,
@@ -113078,6 +114142,13 @@ static const PragmaName aPragmaName[] = {
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
#endif
+#if defined(SQLITE_INTROSPECTION_PRAGMAS)
+ {/* zName: */ "pragma_list",
+ /* ePragTyp: */ PragTyp_PRAGMA_LIST,
+ /* ePragFlg: */ PragFlg_Result0,
+ /* ColNames: */ 31, 1,
+ /* iArg: */ 0 },
+#endif
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
{/* zName: */ "query_only",
/* ePragTyp: */ PragTyp_FLAG,
@@ -113088,7 +114159,7 @@ static const PragmaName aPragmaName[] = {
#if !defined(SQLITE_OMIT_INTEGRITY_CHECK)
{/* zName: */ "quick_check",
/* ePragTyp: */ PragTyp_INTEGRITY_CHECK,
- /* ePragFlg: */ PragFlg_NeedSchema,
+ /* ePragFlg: */ PragFlg_NeedSchema|PragFlg_Result0|PragFlg_Result1,
/* ColNames: */ 0, 0,
/* iArg: */ 0 },
#endif
@@ -113097,7 +114168,7 @@ static const PragmaName aPragmaName[] = {
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
/* ColNames: */ 0, 0,
- /* iArg: */ SQLITE_ReadUncommitted },
+ /* iArg: */ SQLITE_ReadUncommit },
{/* zName: */ "recursive_triggers",
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
@@ -113241,7 +114312,7 @@ static const PragmaName aPragmaName[] = {
{/* zName: */ "wal_checkpoint",
/* ePragTyp: */ PragTyp_WAL_CHECKPOINT,
/* ePragFlg: */ PragFlg_NeedSchema,
- /* ColNames: */ 43, 3,
+ /* ColNames: */ 46, 3,
/* iArg: */ 0 },
#endif
#if !defined(SQLITE_OMIT_FLAG_PRAGMAS)
@@ -113249,10 +114320,10 @@ static const PragmaName aPragmaName[] = {
/* ePragTyp: */ PragTyp_FLAG,
/* ePragFlg: */ PragFlg_Result0|PragFlg_NoColumns1,
/* ColNames: */ 0, 0,
- /* iArg: */ SQLITE_WriteSchema|SQLITE_RecoveryMode },
+ /* iArg: */ SQLITE_WriteSchema },
#endif
};
-/* Number of pragmas: 60 on by default, 74 total. */
+/* Number of pragmas: 60 on by default, 77 total. */
/************** End of pragma.h **********************************************/
/************** Continuing where we left off in pragma.c *********************/
@@ -113525,16 +114596,16 @@ static const PragmaName *pragmaLocate(const char *zName){
/*
** Helper subroutine for PRAGMA integrity_check:
**
-** Generate code to output a single-column result row with the result
-** held in register regResult. Decrement the result count and halt if
-** the maximum number of result rows have been issued.
+** Generate code to output a single-column result row with a value of the
+** string held in register 3. Decrement the result count in register 1
+** and halt if the maximum number of result rows have been issued.
*/
-static int integrityCheckResultRow(Vdbe *v, int regResult){
+static int integrityCheckResultRow(Vdbe *v){
int addr;
- sqlite3VdbeAddOp2(v, OP_ResultRow, regResult, 1);
+ sqlite3VdbeAddOp2(v, OP_ResultRow, 3, 1);
addr = sqlite3VdbeAddOp3(v, OP_IfPos, 1, sqlite3VdbeCurrentAddr(v)+2, 1);
VdbeCoverage(v);
- sqlite3VdbeAddOp2(v, OP_Halt, 0, 0);
+ sqlite3VdbeAddOp0(v, OP_Halt);
return addr;
}
@@ -113742,18 +114813,22 @@ SQLITE_PRIVATE void sqlite3Pragma(
/*
** PRAGMA [schema.]secure_delete
- ** PRAGMA [schema.]secure_delete=ON/OFF
+ ** PRAGMA [schema.]secure_delete=ON/OFF/FAST
**
** The first form reports the current setting for the
** secure_delete flag. The second form changes the secure_delete
- ** flag setting and reports thenew value.
+ ** flag setting and reports the new value.
*/
case PragTyp_SECURE_DELETE: {
Btree *pBt = pDb->pBt;
int b = -1;
assert( pBt!=0 );
if( zRight ){
- b = sqlite3GetBoolean(zRight, 0);
+ if( sqlite3_stricmp(zRight, "fast")==0 ){
+ b = 2;
+ }else{
+ b = sqlite3GetBoolean(zRight, 0);
+ }
}
if( pId2->n==0 && b>=0 ){
int ii;
@@ -114335,7 +115410,6 @@ SQLITE_PRIVATE void sqlite3Pragma(
pCol->notNull ? 1 : 0,
pCol->pDflt ? pCol->pDflt->u.zToken : 0,
k);
- sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 6);
}
}
}
@@ -114355,9 +115429,8 @@ SQLITE_PRIVATE void sqlite3Pragma(
pTab->szTabRow,
pTab->nRowLogEst,
pTab->tabFlags);
- sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 5);
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
- sqlite3VdbeMultiLoad(v, 2, "siii",
+ sqlite3VdbeMultiLoad(v, 2, "siiiX",
pIdx->zName,
pIdx->szIdxRow,
pIdx->aiRowLogEst[0],
@@ -114390,10 +115463,10 @@ SQLITE_PRIVATE void sqlite3Pragma(
assert( pParse->nMem<=pPragma->nPragCName );
for(i=0; i<mx; i++){
i16 cnum = pIdx->aiColumn[i];
- sqlite3VdbeMultiLoad(v, 1, "iis", i, cnum,
+ sqlite3VdbeMultiLoad(v, 1, "iisX", i, cnum,
cnum<0 ? 0 : pTab->aCol[cnum].zName);
if( pPragma->iArg ){
- sqlite3VdbeMultiLoad(v, 4, "isi",
+ sqlite3VdbeMultiLoad(v, 4, "isiX",
pIdx->aSortOrder[i],
pIdx->azColl[i],
i<pIdx->nKeyCol);
@@ -114420,7 +115493,6 @@ SQLITE_PRIVATE void sqlite3Pragma(
IsUniqueIndex(pIdx),
azOrigin[pIdx->idxType],
pIdx->pPartIdxWhere!=0);
- sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 5);
}
}
}
@@ -114436,7 +115508,6 @@ SQLITE_PRIVATE void sqlite3Pragma(
i,
db->aDb[i].zDbSName,
sqlite3BtreeGetFilename(db->aDb[i].pBt));
- sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 3);
}
}
break;
@@ -114448,10 +115519,49 @@ SQLITE_PRIVATE void sqlite3Pragma(
for(p=sqliteHashFirst(&db->aCollSeq); p; p=sqliteHashNext(p)){
CollSeq *pColl = (CollSeq *)sqliteHashData(p);
sqlite3VdbeMultiLoad(v, 1, "is", i++, pColl->zName);
- sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 2);
}
}
break;
+
+#ifdef SQLITE_INTROSPECTION_PRAGMAS
+ case PragTyp_FUNCTION_LIST: {
+ int i;
+ HashElem *j;
+ FuncDef *p;
+ pParse->nMem = 2;
+ for(i=0; i<SQLITE_FUNC_HASH_SZ; i++){
+ for(p=sqlite3BuiltinFunctions.a[i]; p; p=p->u.pHash ){
+ sqlite3VdbeMultiLoad(v, 1, "si", p->zName, 1);
+ }
+ }
+ for(j=sqliteHashFirst(&db->aFunc); j; j=sqliteHashNext(j)){
+ p = (FuncDef*)sqliteHashData(j);
+ sqlite3VdbeMultiLoad(v, 1, "si", p->zName, 0);
+ }
+ }
+ break;
+
+#ifndef SQLITE_OMIT_VIRTUALTABLE
+ case PragTyp_MODULE_LIST: {
+ HashElem *j;
+ pParse->nMem = 1;
+ for(j=sqliteHashFirst(&db->aModule); j; j=sqliteHashNext(j)){
+ Module *pMod = (Module*)sqliteHashData(j);
+ sqlite3VdbeMultiLoad(v, 1, "s", pMod->zName);
+ }
+ }
+ break;
+#endif /* SQLITE_OMIT_VIRTUALTABLE */
+
+ case PragTyp_PRAGMA_LIST: {
+ int i;
+ for(i=0; i<ArraySize(aPragmaName); i++){
+ sqlite3VdbeMultiLoad(v, 1, "s", aPragmaName[i].zName);
+ }
+ }
+ break;
+#endif /* SQLITE_INTROSPECTION_PRAGMAS */
+
#endif /* SQLITE_OMIT_SCHEMA_PRAGMAS */
#ifndef SQLITE_OMIT_FOREIGN_KEY
@@ -114477,7 +115587,6 @@ SQLITE_PRIVATE void sqlite3Pragma(
actionName(pFK->aAction[1]), /* ON UPDATE */
actionName(pFK->aAction[0]), /* ON DELETE */
"NONE");
- sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 8);
}
++i;
pFK = pFK->pNextFrom;
@@ -114587,7 +115696,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
}else{
sqlite3VdbeAddOp2(v, OP_Null, 0, regResult+1);
}
- sqlite3VdbeMultiLoad(v, regResult+2, "si", pFK->zTo, i-1);
+ sqlite3VdbeMultiLoad(v, regResult+2, "siX", pFK->zTo, i-1);
sqlite3VdbeAddOp2(v, OP_ResultRow, regResult, 4);
sqlite3VdbeResolveLabel(v, addrOk);
sqlite3DbFree(db, aiCols);
@@ -114673,12 +115782,11 @@ SQLITE_PRIVATE void sqlite3Pragma(
/* Do an integrity check on each database file */
for(i=0; i<db->nDb; i++){
- HashElem *x;
- Hash *pTbls;
- int *aRoot;
- int cnt = 0;
- int mxIdx = 0;
- int nIdx;
+ HashElem *x; /* For looping over tables in the schema */
+ Hash *pTbls; /* Set of all tables in the schema */
+ int *aRoot; /* Array of root page numbers of all btrees */
+ int cnt = 0; /* Number of entries in aRoot[] */
+ int mxIdx = 0; /* Maximum number of indexes for any table */
if( OMIT_TEMPDB && i==1 ) continue;
if( iDb>=0 && i!=iDb ) continue;
@@ -114693,8 +115801,9 @@ SQLITE_PRIVATE void sqlite3Pragma(
assert( sqlite3SchemaMutexHeld(db, i, 0) );
pTbls = &db->aDb[i].pSchema->tblHash;
for(cnt=0, x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){
- Table *pTab = sqliteHashData(x);
- Index *pIdx;
+ Table *pTab = sqliteHashData(x); /* Current table */
+ Index *pIdx; /* An index on pTab */
+ int nIdx; /* Number of indexes on pTab */
if( HasRowid(pTab) ) cnt++;
for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){ cnt++; }
if( nIdx>mxIdx ) mxIdx = nIdx;
@@ -114704,15 +115813,16 @@ SQLITE_PRIVATE void sqlite3Pragma(
for(cnt=0, x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){
Table *pTab = sqliteHashData(x);
Index *pIdx;
- if( HasRowid(pTab) ) aRoot[cnt++] = pTab->tnum;
+ if( HasRowid(pTab) ) aRoot[++cnt] = pTab->tnum;
for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){
- aRoot[cnt++] = pIdx->tnum;
+ aRoot[++cnt] = pIdx->tnum;
}
}
- aRoot[cnt] = 0;
+ aRoot[0] = cnt;
/* Make sure sufficient number of registers have been allocated */
pParse->nMem = MAX( pParse->nMem, 8+mxIdx );
+ sqlite3ClearTempRegCache(pParse);
/* Do the b-tree integrity checks */
sqlite3VdbeAddOp4(v, OP_IntegrityCk, 2, cnt, 1, (char*)aRoot,P4_INTARRAY);
@@ -114721,9 +115831,8 @@ SQLITE_PRIVATE void sqlite3Pragma(
sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0,
sqlite3MPrintf(db, "*** in database %s ***\n", db->aDb[i].zDbSName),
P4_DYNAMIC);
- sqlite3VdbeAddOp3(v, OP_Move, 2, 4, 1);
- sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 2);
- integrityCheckResultRow(v, 2);
+ sqlite3VdbeAddOp3(v, OP_Concat, 2, 3, 3);
+ integrityCheckResultRow(v);
sqlite3VdbeJumpHere(v, addr);
/* Make sure all the indices are constructed correctly.
@@ -114737,16 +115846,13 @@ SQLITE_PRIVATE void sqlite3Pragma(
int r1 = -1;
if( pTab->tnum<1 ) continue; /* Skip VIEWs or VIRTUAL TABLEs */
- if( pTab->pCheck==0
- && (pTab->tabFlags & TF_HasNotNull)==0
- && (pTab->pIndex==0 || isQuick)
- ){
- continue; /* No additional checks needed for this table */
- }
pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab);
sqlite3ExprCacheClear(pParse);
sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenRead, 0,
1, 0, &iDataCur, &iIdxCur);
+ /* reg[7] counts the number of entries in the table.
+ ** reg[8+i] counts the number of entries in the i-th index
+ */
sqlite3VdbeAddOp2(v, OP_Integer, 0, 7);
for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
sqlite3VdbeAddOp2(v, OP_Integer, 0, 8+j); /* index entries counter */
@@ -114767,7 +115873,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
zErr = sqlite3MPrintf(db, "NULL value in %s.%s", pTab->zName,
pTab->aCol[j].zName);
sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC);
- integrityCheckResultRow(v, 3);
+ integrityCheckResultRow(v);
sqlite3VdbeJumpHere(v, jmp2);
}
/* Verify CHECK constraints */
@@ -114778,7 +115884,7 @@ SQLITE_PRIVATE void sqlite3Pragma(
int addrCkOk = sqlite3VdbeMakeLabel(v);
char *zErr;
int k;
- pParse->iSelfTab = iDataCur;
+ pParse->iSelfTab = iDataCur + 1;
sqlite3ExprCachePush(pParse);
for(k=pCheck->nExpr-1; k>0; k--){
sqlite3ExprIfFalse(pParse, pCheck->a[k].pExpr, addrCkFault, 0);
@@ -114786,60 +115892,66 @@ SQLITE_PRIVATE void sqlite3Pragma(
sqlite3ExprIfTrue(pParse, pCheck->a[0].pExpr, addrCkOk,
SQLITE_JUMPIFNULL);
sqlite3VdbeResolveLabel(v, addrCkFault);
+ pParse->iSelfTab = 0;
zErr = sqlite3MPrintf(db, "CHECK constraint failed in %s",
pTab->zName);
sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, zErr, P4_DYNAMIC);
- integrityCheckResultRow(v, 3);
+ integrityCheckResultRow(v);
sqlite3VdbeResolveLabel(v, addrCkOk);
sqlite3ExprCachePop(pParse);
}
sqlite3ExprListDelete(db, pCheck);
}
- /* Validate index entries for the current row */
- for(j=0, pIdx=pTab->pIndex; pIdx && !isQuick; pIdx=pIdx->pNext, j++){
- int jmp2, jmp3, jmp4, jmp5;
- int ckUniq = sqlite3VdbeMakeLabel(v);
- if( pPk==pIdx ) continue;
- r1 = sqlite3GenerateIndexKey(pParse, pIdx, iDataCur, 0, 0, &jmp3,
- pPrior, r1);
- pPrior = pIdx;
- sqlite3VdbeAddOp2(v, OP_AddImm, 8+j, 1); /* increment entry count */
- /* Verify that an index entry exists for the current table row */
- jmp2 = sqlite3VdbeAddOp4Int(v, OP_Found, iIdxCur+j, ckUniq, r1,
- pIdx->nColumn); VdbeCoverage(v);
- sqlite3VdbeLoadString(v, 3, "row ");
- sqlite3VdbeAddOp3(v, OP_Concat, 7, 3, 3);
- sqlite3VdbeLoadString(v, 4, " missing from index ");
- sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3);
- jmp5 = sqlite3VdbeLoadString(v, 4, pIdx->zName);
- sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3);
- jmp4 = integrityCheckResultRow(v, 3);
- sqlite3VdbeJumpHere(v, jmp2);
- /* For UNIQUE indexes, verify that only one entry exists with the
- ** current key. The entry is unique if (1) any column is NULL
- ** or (2) the next entry has a different key */
- if( IsUniqueIndex(pIdx) ){
- int uniqOk = sqlite3VdbeMakeLabel(v);
- int jmp6;
- int kk;
- for(kk=0; kk<pIdx->nKeyCol; kk++){
- int iCol = pIdx->aiColumn[kk];
- assert( iCol!=XN_ROWID && iCol<pTab->nCol );
- if( iCol>=0 && pTab->aCol[iCol].notNull ) continue;
- sqlite3VdbeAddOp2(v, OP_IsNull, r1+kk, uniqOk);
- VdbeCoverage(v);
+ if( !isQuick ){ /* Omit the remaining tests for quick_check */
+ /* Sanity check on record header decoding */
+ sqlite3VdbeAddOp3(v, OP_Column, iDataCur, pTab->nCol-1, 3);
+ sqlite3VdbeChangeP5(v, OPFLAG_TYPEOFARG);
+ /* Validate index entries for the current row */
+ for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){
+ int jmp2, jmp3, jmp4, jmp5;
+ int ckUniq = sqlite3VdbeMakeLabel(v);
+ if( pPk==pIdx ) continue;
+ r1 = sqlite3GenerateIndexKey(pParse, pIdx, iDataCur, 0, 0, &jmp3,
+ pPrior, r1);
+ pPrior = pIdx;
+ sqlite3VdbeAddOp2(v, OP_AddImm, 8+j, 1);/* increment entry count */
+ /* Verify that an index entry exists for the current table row */
+ jmp2 = sqlite3VdbeAddOp4Int(v, OP_Found, iIdxCur+j, ckUniq, r1,
+ pIdx->nColumn); VdbeCoverage(v);
+ sqlite3VdbeLoadString(v, 3, "row ");
+ sqlite3VdbeAddOp3(v, OP_Concat, 7, 3, 3);
+ sqlite3VdbeLoadString(v, 4, " missing from index ");
+ sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3);
+ jmp5 = sqlite3VdbeLoadString(v, 4, pIdx->zName);
+ sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3);
+ jmp4 = integrityCheckResultRow(v);
+ sqlite3VdbeJumpHere(v, jmp2);
+ /* For UNIQUE indexes, verify that only one entry exists with the
+ ** current key. The entry is unique if (1) any column is NULL
+ ** or (2) the next entry has a different key */
+ if( IsUniqueIndex(pIdx) ){
+ int uniqOk = sqlite3VdbeMakeLabel(v);
+ int jmp6;
+ int kk;
+ for(kk=0; kk<pIdx->nKeyCol; kk++){
+ int iCol = pIdx->aiColumn[kk];
+ assert( iCol!=XN_ROWID && iCol<pTab->nCol );
+ if( iCol>=0 && pTab->aCol[iCol].notNull ) continue;
+ sqlite3VdbeAddOp2(v, OP_IsNull, r1+kk, uniqOk);
+ VdbeCoverage(v);
+ }
+ jmp6 = sqlite3VdbeAddOp1(v, OP_Next, iIdxCur+j); VdbeCoverage(v);
+ sqlite3VdbeGoto(v, uniqOk);
+ sqlite3VdbeJumpHere(v, jmp6);
+ sqlite3VdbeAddOp4Int(v, OP_IdxGT, iIdxCur+j, uniqOk, r1,
+ pIdx->nKeyCol); VdbeCoverage(v);
+ sqlite3VdbeLoadString(v, 3, "non-unique entry in index ");
+ sqlite3VdbeGoto(v, jmp5);
+ sqlite3VdbeResolveLabel(v, uniqOk);
}
- jmp6 = sqlite3VdbeAddOp1(v, OP_Next, iIdxCur+j); VdbeCoverage(v);
- sqlite3VdbeGoto(v, uniqOk);
- sqlite3VdbeJumpHere(v, jmp6);
- sqlite3VdbeAddOp4Int(v, OP_IdxGT, iIdxCur+j, uniqOk, r1,
- pIdx->nKeyCol); VdbeCoverage(v);
- sqlite3VdbeLoadString(v, 3, "non-unique entry in index ");
- sqlite3VdbeGoto(v, jmp5);
- sqlite3VdbeResolveLabel(v, uniqOk);
+ sqlite3VdbeJumpHere(v, jmp4);
+ sqlite3ResolvePartIdxLabel(pParse, jmp3);
}
- sqlite3VdbeJumpHere(v, jmp4);
- sqlite3ResolvePartIdxLabel(pParse, jmp3);
}
sqlite3VdbeAddOp2(v, OP_Next, iDataCur, loopTop); VdbeCoverage(v);
sqlite3VdbeJumpHere(v, loopTop-1);
@@ -114851,9 +115963,9 @@ SQLITE_PRIVATE void sqlite3Pragma(
sqlite3VdbeAddOp2(v, OP_Count, iIdxCur+j, 3);
addr = sqlite3VdbeAddOp3(v, OP_Eq, 8+j, 0, 3); VdbeCoverage(v);
sqlite3VdbeChangeP5(v, SQLITE_NOTNULL);
- sqlite3VdbeLoadString(v, 3, pIdx->zName);
- sqlite3VdbeAddOp3(v, OP_Concat, 3, 2, 7);
- integrityCheckResultRow(v, 7);
+ sqlite3VdbeLoadString(v, 4, pIdx->zName);
+ sqlite3VdbeAddOp3(v, OP_Concat, 4, 2, 3);
+ integrityCheckResultRow(v);
sqlite3VdbeJumpHere(v, addr);
}
}
@@ -114867,6 +115979,9 @@ SQLITE_PRIVATE void sqlite3Pragma(
{ OP_IfNotZero, 1, 4, 0}, /* 1 */
{ OP_String8, 0, 3, 0}, /* 2 */
{ OP_ResultRow, 3, 1, 0}, /* 3 */
+ { OP_Halt, 0, 0, 0}, /* 4 */
+ { OP_String8, 0, 3, 0}, /* 5 */
+ { OP_Goto, 0, 3, 0}, /* 6 */
};
VdbeOp *aOp;
@@ -114875,7 +115990,10 @@ SQLITE_PRIVATE void sqlite3Pragma(
aOp[0].p2 = 1-mxErr;
aOp[2].p4type = P4_STATIC;
aOp[2].p4.z = "ok";
+ aOp[5].p4type = P4_STATIC;
+ aOp[5].p4.z = (char*)sqlite3ErrStr(SQLITE_CORRUPT);
}
+ sqlite3VdbeChangeP3(v, 0, sqlite3VdbeCurrentAddr(v)-2);
}
}
break;
@@ -115127,7 +116245,8 @@ SQLITE_PRIVATE void sqlite3Pragma(
** 0x0008 (Not yet implemented) Create indexes that might have
** been helpful to recent queries
**
- ** The default MASK is and always shall be 0xfffe. 0xfffe means perform all ** of the optimizations listed above except Debug Mode, including new
+ ** The default MASK is and always shall be 0xfffe. 0xfffe means perform all
+ ** of the optimizations listed above except Debug Mode, including new
** optimizations that have not yet been invented. If new optimizations are
** ever added that should be off by default, those off-by-default
** optimizations will have bitmasks of 0x10000 or larger.
@@ -115289,7 +116408,6 @@ SQLITE_PRIVATE void sqlite3Pragma(
zState = azLockName[j];
}
sqlite3VdbeMultiLoad(v, 1, "ss", db->aDb[i].zDbSName, zState);
- sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 2);
}
break;
}
@@ -115555,10 +116673,14 @@ static int pragmaVtabFilter(
pragmaVtabCursorClear(pCsr);
j = (pTab->pName->mPragFlg & PragFlg_Result1)!=0 ? 0 : 1;
for(i=0; i<argc; i++, j++){
+ const char *zText = (const char*)sqlite3_value_text(argv[i]);
assert( j<ArraySize(pCsr->azArg) );
- pCsr->azArg[j] = sqlite3_mprintf("%s", sqlite3_value_text(argv[i]));
- if( pCsr->azArg[j]==0 ){
- return SQLITE_NOMEM;
+ assert( pCsr->azArg[j]==0 );
+ if( zText ){
+ pCsr->azArg[j] = sqlite3_mprintf("%s", zText);
+ if( pCsr->azArg[j]==0 ){
+ return SQLITE_NOMEM;
+ }
}
}
sqlite3StrAccumInit(&acc, 0, 0, 0, pTab->db->aLimit[SQLITE_LIMIT_SQL_LENGTH]);
@@ -115691,7 +116813,7 @@ static void corruptSchema(
const char *zExtra /* Error information */
){
sqlite3 *db = pData->db;
- if( !db->mallocFailed && (db->flags & SQLITE_RecoveryMode)==0 ){
+ if( !db->mallocFailed && (db->flags & SQLITE_WriteSchema)==0 ){
char *z;
if( zObj==0 ) zObj = "?";
z = sqlite3MPrintf(db, "malformed database schema (%s)", zObj);
@@ -115751,7 +116873,7 @@ SQLITE_PRIVATE int sqlite3InitCallback(void *pInit, int argc, char **argv, char
rc = db->errCode;
assert( (rc&0xFF)==(rcp&0xFF) );
db->init.iDb = saved_iDb;
- assert( saved_iDb==0 || (db->flags & SQLITE_Vacuum)!=0 );
+ assert( saved_iDb==0 || (db->mDbFlags & DBFLAG_Vacuum)!=0 );
if( SQLITE_OK!=rc ){
if( db->init.orphanTrigger ){
assert( iDb==1 );
@@ -115816,6 +116938,8 @@ static int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg){
assert( sqlite3_mutex_held(db->mutex) );
assert( iDb==1 || sqlite3BtreeHoldsMutex(db->aDb[iDb].pBt) );
+ db->init.busy = 1;
+
/* Construct the in-memory representation schema tables (sqlite_master or
** sqlite_temp_master) by invoking the parser directly. The appropriate
** table name will be inserted automatically by the parser so we can just
@@ -115824,7 +116948,7 @@ static int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg){
azArg[0] = zMasterName = SCHEMA_TABLE(iDb);
azArg[1] = "1";
azArg[2] = "CREATE TABLE x(type text,name text,tbl_name text,"
- "rootpage integer,sql text)";
+ "rootpage int,sql text)";
azArg[3] = 0;
initData.db = db;
initData.iDb = iDb;
@@ -115840,10 +116964,10 @@ static int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg){
*/
pDb = &db->aDb[iDb];
if( pDb->pBt==0 ){
- if( !OMIT_TEMPDB && ALWAYS(iDb==1) ){
- DbSetProperty(db, 1, DB_SchemaLoaded);
- }
- return SQLITE_OK;
+ assert( iDb==1 );
+ DbSetProperty(db, 1, DB_SchemaLoaded);
+ rc = SQLITE_OK;
+ goto error_out;
}
/* If there is not already a read-only (or read-write) transaction opened
@@ -115978,8 +117102,8 @@ static int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg){
rc = SQLITE_NOMEM_BKPT;
sqlite3ResetAllSchemasOfConnection(db);
}
- if( rc==SQLITE_OK || (db->flags&SQLITE_RecoveryMode)){
- /* Black magic: If the SQLITE_RecoveryMode flag is set, then consider
+ if( rc==SQLITE_OK || (db->flags&SQLITE_WriteSchema)){
+ /* Black magic: If the SQLITE_WriteSchema flag is set, then consider
** the schema loaded, even if errors occurred. In this situation the
** current sqlite3_prepare() operation will fail, but the following one
** will attempt to compile the supplied statement against whatever subset
@@ -116002,9 +117126,13 @@ initone_error_out:
sqlite3BtreeLeave(pDb->pBt);
error_out:
- if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){
- sqlite3OomFault(db);
+ if( rc ){
+ if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){
+ sqlite3OomFault(db);
+ }
+ sqlite3ResetOneSchema(db, iDb);
}
+ db->init.busy = 0;
return rc;
}
@@ -116020,42 +117148,29 @@ error_out:
*/
SQLITE_PRIVATE int sqlite3Init(sqlite3 *db, char **pzErrMsg){
int i, rc;
- int commit_internal = !(db->flags&SQLITE_InternChanges);
+ int commit_internal = !(db->mDbFlags&DBFLAG_SchemaChange);
assert( sqlite3_mutex_held(db->mutex) );
assert( sqlite3BtreeHoldsMutex(db->aDb[0].pBt) );
assert( db->init.busy==0 );
- rc = SQLITE_OK;
- db->init.busy = 1;
ENC(db) = SCHEMA_ENC(db);
- for(i=0; rc==SQLITE_OK && i<db->nDb; i++){
- if( DbHasProperty(db, i, DB_SchemaLoaded) || i==1 ) continue;
- rc = sqlite3InitOne(db, i, pzErrMsg);
- if( rc ){
- sqlite3ResetOneSchema(db, i);
- }
+ assert( db->nDb>0 );
+ /* Do the main schema first */
+ if( !DbHasProperty(db, 0, DB_SchemaLoaded) ){
+ rc = sqlite3InitOne(db, 0, pzErrMsg);
+ if( rc ) return rc;
}
-
- /* Once all the other databases have been initialized, load the schema
- ** for the TEMP database. This is loaded last, as the TEMP database
- ** schema may contain references to objects in other databases.
- */
-#ifndef SQLITE_OMIT_TEMPDB
- assert( db->nDb>1 );
- if( rc==SQLITE_OK && !DbHasProperty(db, 1, DB_SchemaLoaded) ){
- rc = sqlite3InitOne(db, 1, pzErrMsg);
- if( rc ){
- sqlite3ResetOneSchema(db, 1);
+ /* All other schemas after the main schema. The "temp" schema must be last */
+ for(i=db->nDb-1; i>0; i--){
+ if( !DbHasProperty(db, i, DB_SchemaLoaded) ){
+ rc = sqlite3InitOne(db, i, pzErrMsg);
+ if( rc ) return rc;
}
}
-#endif
-
- db->init.busy = 0;
- if( rc==SQLITE_OK && commit_internal ){
+ if( commit_internal ){
sqlite3CommitInternalChanges(db);
}
-
- return rc;
+ return SQLITE_OK;
}
/*
@@ -116160,16 +117275,14 @@ SQLITE_PRIVATE int sqlite3SchemaToIndex(sqlite3 *db, Schema *pSchema){
** Free all memory allocations in the pParse object
*/
SQLITE_PRIVATE void sqlite3ParserReset(Parse *pParse){
- if( pParse ){
- sqlite3 *db = pParse->db;
- sqlite3DbFree(db, pParse->aLabel);
- sqlite3ExprListDelete(db, pParse->pConstExpr);
- if( db ){
- assert( db->lookaside.bDisable >= pParse->disableLookaside );
- db->lookaside.bDisable -= pParse->disableLookaside;
- }
- pParse->disableLookaside = 0;
+ sqlite3 *db = pParse->db;
+ sqlite3DbFree(db, pParse->aLabel);
+ sqlite3ExprListDelete(db, pParse->pConstExpr);
+ if( db ){
+ assert( db->lookaside.bDisable >= pParse->disableLookaside );
+ db->lookaside.bDisable -= pParse->disableLookaside;
}
+ pParse->disableLookaside = 0;
}
/*
@@ -116179,7 +117292,7 @@ static int sqlite3Prepare(
sqlite3 *db, /* Database handle. */
const char *zSql, /* UTF-8 encoded SQL statement. */
int nBytes, /* Length of zSql in bytes. */
- int saveSqlFlag, /* True to copy SQL text into the sqlite3_stmt */
+ u32 prepFlags, /* Zero or more SQLITE_PREPARE_* flags */
Vdbe *pReprepare, /* VM being reprepared */
sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
const char **pzTail /* OUT: End of parsed string */
@@ -116196,6 +117309,14 @@ static int sqlite3Prepare(
/* assert( !db->mallocFailed ); // not true with SQLITE_USE_ALLOCA */
assert( sqlite3_mutex_held(db->mutex) );
+ /* For a long-term use prepared statement avoid the use of
+ ** lookaside memory.
+ */
+ if( prepFlags & SQLITE_PREPARE_PERSISTENT ){
+ sParse.disableLookaside++;
+ db->lookaside.bDisable++;
+ }
+
/* Check to verify that it is possible to get a read lock on all
** database schemas. The inability to get a read lock indicates that
** some other database connection is holding a write-lock, which in
@@ -116227,7 +117348,7 @@ static int sqlite3Prepare(
if( rc ){
const char *zDb = db->aDb[i].zDbSName;
sqlite3ErrorWithMsg(db, rc, "database schema is locked: %s", zDb);
- testcase( db->flags & SQLITE_ReadUncommitted );
+ testcase( db->flags & SQLITE_ReadUncommit );
goto end_prepare;
}
}
@@ -116295,8 +117416,7 @@ static int sqlite3Prepare(
#endif
if( db->init.busy==0 ){
- Vdbe *pVdbe = sParse.pVdbe;
- sqlite3VdbeSetSql(pVdbe, zSql, (int)(sParse.zTail-zSql), saveSqlFlag);
+ sqlite3VdbeSetSql(sParse.pVdbe, zSql, (int)(sParse.zTail-zSql), prepFlags);
}
if( sParse.pVdbe && (rc!=SQLITE_OK || db->mallocFailed) ){
sqlite3VdbeFinalize(sParse.pVdbe);
@@ -116330,7 +117450,7 @@ static int sqlite3LockAndPrepare(
sqlite3 *db, /* Database handle. */
const char *zSql, /* UTF-8 encoded SQL statement. */
int nBytes, /* Length of zSql in bytes. */
- int saveSqlFlag, /* True to copy SQL text into the sqlite3_stmt */
+ u32 prepFlags, /* Zero or more SQLITE_PREPARE_* flags */
Vdbe *pOld, /* VM being reprepared */
sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
const char **pzTail /* OUT: End of parsed string */
@@ -116346,10 +117466,11 @@ static int sqlite3LockAndPrepare(
}
sqlite3_mutex_enter(db->mutex);
sqlite3BtreeEnterAll(db);
- rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, pOld, ppStmt, pzTail);
+ rc = sqlite3Prepare(db, zSql, nBytes, prepFlags, pOld, ppStmt, pzTail);
if( rc==SQLITE_SCHEMA ){
+ sqlite3ResetOneSchema(db, -1);
sqlite3_finalize(*ppStmt);
- rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, pOld, ppStmt, pzTail);
+ rc = sqlite3Prepare(db, zSql, nBytes, prepFlags, pOld, ppStmt, pzTail);
}
sqlite3BtreeLeaveAll(db);
sqlite3_mutex_leave(db->mutex);
@@ -116370,13 +117491,15 @@ SQLITE_PRIVATE int sqlite3Reprepare(Vdbe *p){
sqlite3_stmt *pNew;
const char *zSql;
sqlite3 *db;
+ u8 prepFlags;
assert( sqlite3_mutex_held(sqlite3VdbeDb(p)->mutex) );
zSql = sqlite3_sql((sqlite3_stmt *)p);
assert( zSql!=0 ); /* Reprepare only called for prepare_v2() statements */
db = sqlite3VdbeDb(p);
assert( sqlite3_mutex_held(db->mutex) );
- rc = sqlite3LockAndPrepare(db, zSql, -1, 0, p, &pNew, 0);
+ prepFlags = sqlite3VdbePrepareFlags(p);
+ rc = sqlite3LockAndPrepare(db, zSql, -1, prepFlags, p, &pNew, 0);
if( rc ){
if( rc==SQLITE_NOMEM ){
sqlite3OomFault(db);
@@ -116422,8 +117545,36 @@ SQLITE_API int sqlite3_prepare_v2(
const char **pzTail /* OUT: End of parsed string */
){
int rc;
- rc = sqlite3LockAndPrepare(db,zSql,nBytes,1,0,ppStmt,pzTail);
- assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */
+ /* EVIDENCE-OF: R-37923-12173 The sqlite3_prepare_v2() interface works
+ ** exactly the same as sqlite3_prepare_v3() with a zero prepFlags
+ ** parameter.
+ **
+ ** Proof in that the 5th parameter to sqlite3LockAndPrepare is 0 */
+ rc = sqlite3LockAndPrepare(db,zSql,nBytes,SQLITE_PREPARE_SAVESQL,0,
+ ppStmt,pzTail);
+ assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 );
+ return rc;
+}
+SQLITE_API int sqlite3_prepare_v3(
+ sqlite3 *db, /* Database handle. */
+ const char *zSql, /* UTF-8 encoded SQL statement. */
+ int nBytes, /* Length of zSql in bytes. */
+ unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_* flags */
+ sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
+ const char **pzTail /* OUT: End of parsed string */
+){
+ int rc;
+ /* EVIDENCE-OF: R-56861-42673 sqlite3_prepare_v3() differs from
+ ** sqlite3_prepare_v2() only in having the extra prepFlags parameter,
+ ** which is a bit array consisting of zero or more of the
+ ** SQLITE_PREPARE_* flags.
+ **
+ ** Proof by comparison to the implementation of sqlite3_prepare_v2()
+ ** directly above. */
+ rc = sqlite3LockAndPrepare(db,zSql,nBytes,
+ SQLITE_PREPARE_SAVESQL|(prepFlags&SQLITE_PREPARE_MASK),
+ 0,ppStmt,pzTail);
+ assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 );
return rc;
}
@@ -116436,7 +117587,7 @@ static int sqlite3Prepare16(
sqlite3 *db, /* Database handle. */
const void *zSql, /* UTF-16 encoded SQL statement. */
int nBytes, /* Length of zSql in bytes. */
- int saveSqlFlag, /* True to save SQL text into the sqlite3_stmt */
+ u32 prepFlags, /* Zero or more SQLITE_PREPARE_* flags */
sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
const void **pzTail /* OUT: End of parsed string */
){
@@ -116464,7 +117615,7 @@ static int sqlite3Prepare16(
sqlite3_mutex_enter(db->mutex);
zSql8 = sqlite3Utf16to8(db, zSql, nBytes, SQLITE_UTF16NATIVE);
if( zSql8 ){
- rc = sqlite3LockAndPrepare(db, zSql8, -1, saveSqlFlag, 0, ppStmt, &zTail8);
+ rc = sqlite3LockAndPrepare(db, zSql8, -1, prepFlags, 0, ppStmt, &zTail8);
}
if( zTail8 && pzTail ){
@@ -116510,7 +117661,22 @@ SQLITE_API int sqlite3_prepare16_v2(
const void **pzTail /* OUT: End of parsed string */
){
int rc;
- rc = sqlite3Prepare16(db,zSql,nBytes,1,ppStmt,pzTail);
+ rc = sqlite3Prepare16(db,zSql,nBytes,SQLITE_PREPARE_SAVESQL,ppStmt,pzTail);
+ assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */
+ return rc;
+}
+SQLITE_API int sqlite3_prepare16_v3(
+ sqlite3 *db, /* Database handle. */
+ const void *zSql, /* UTF-16 encoded SQL statement. */
+ int nBytes, /* Length of zSql in bytes. */
+ unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_* flags */
+ sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */
+ const void **pzTail /* OUT: End of parsed string */
+){
+ int rc;
+ rc = sqlite3Prepare16(db,zSql,nBytes,
+ SQLITE_PREPARE_SAVESQL|(prepFlags&SQLITE_PREPARE_MASK),
+ ppStmt,pzTail);
assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */
return rc;
}
@@ -116596,7 +117762,7 @@ static void clearSelect(sqlite3 *db, Select *p, int bFree){
sqlite3ExprListDelete(db, p->pOrderBy);
sqlite3ExprDelete(db, p->pLimit);
sqlite3ExprDelete(db, p->pOffset);
- if( p->pWith ) sqlite3WithDelete(db, p->pWith);
+ if( OK_IF_ALWAYS_TRUE(p->pWith) ) sqlite3WithDelete(db, p->pWith);
if( bFree ) sqlite3DbFreeNN(db, p);
p = pPrior;
bFree = 1;
@@ -116639,7 +117805,8 @@ SQLITE_PRIVATE Select *sqlite3SelectNew(
pNew = &standin;
}
if( pEList==0 ){
- pEList = sqlite3ExprListAppend(pParse, 0, sqlite3Expr(pParse->db,TK_ASTERISK,0));
+ pEList = sqlite3ExprListAppend(pParse, 0,
+ sqlite3Expr(pParse->db,TK_ASTERISK,0));
}
pNew->pEList = pEList;
pNew->op = TK_SELECT;
@@ -116663,7 +117830,8 @@ SQLITE_PRIVATE Select *sqlite3SelectNew(
pNew->pLimit = pLimit;
pNew->pOffset = pOffset;
pNew->pWith = 0;
- assert( pOffset==0 || pLimit!=0 || pParse->nErr>0 || pParse->db->mallocFailed!=0 );
+ assert( pOffset==0 || pLimit!=0 || pParse->nErr>0
+ || pParse->db->mallocFailed!=0 );
if( pParse->db->mallocFailed ) {
clearSelect(pParse->db, pNew, pNew!=&standin);
pNew = 0;
@@ -116690,7 +117858,7 @@ SQLITE_PRIVATE void sqlite3SelectSetName(Select *p, const char *zName){
** Delete the given Select structure and all of its substructures.
*/
SQLITE_PRIVATE void sqlite3SelectDelete(sqlite3 *db, Select *p){
- if( p ) clearSelect(db, p, 1);
+ if( OK_IF_ALWAYS_TRUE(p) ) clearSelect(db, p, 1);
}
/*
@@ -116931,11 +118099,10 @@ static int sqliteProcessJoin(Parse *pParse, Select *p){
pLeft = &pSrc->a[0];
pRight = &pLeft[1];
for(i=0; i<pSrc->nSrc-1; i++, pRight++, pLeft++){
- Table *pLeftTab = pLeft->pTab;
Table *pRightTab = pRight->pTab;
int isOuter;
- if( NEVER(pLeftTab==0 || pRightTab==0) ) continue;
+ if( NEVER(pLeft->pTab==0 || pRightTab==0) ) continue;
isOuter = (pRight->fg.jointype & JT_OUTER)!=0;
/* When the NATURAL keyword is present, add WHERE clause terms for
@@ -117083,11 +118250,11 @@ static void pushOntoSorter(
if( pParse->db->mallocFailed ) return;
pOp->p2 = nKey + nData;
pKI = pOp->p4.pKeyInfo;
- memset(pKI->aSortOrder, 0, pKI->nField); /* Makes OP_Jump below testable */
+ memset(pKI->aSortOrder, 0, pKI->nKeyField); /* Makes OP_Jump testable */
sqlite3VdbeChangeP4(v, -1, (char*)pKI, P4_KEYINFO);
- testcase( pKI->nXField>2 );
+ testcase( pKI->nAllField > pKI->nKeyField+2 );
pOp->p4.pKeyInfo = keyInfoFromExprList(pParse, pSort->pOrderBy, nOBSat,
- pKI->nXField-1);
+ pKI->nAllField-pKI->nKeyField-1);
addrJmp = sqlite3VdbeCurrentAddr(v);
sqlite3VdbeAddOp3(v, OP_Jump, addrJmp+1, 0, addrJmp+1); VdbeCoverage(v);
pSort->labelBkOut = sqlite3VdbeMakeLabel(v);
@@ -117185,16 +118352,15 @@ static void codeDistinct(
** This routine generates the code for the inside of the inner loop
** of a SELECT.
**
-** If srcTab is negative, then the pEList expressions
+** If srcTab is negative, then the p->pEList expressions
** are evaluated in order to get the data for this row. If srcTab is
-** zero or more, then data is pulled from srcTab and pEList is used only
+** zero or more, then data is pulled from srcTab and p->pEList is used only
** to get the number of columns and the collation sequence for each column.
*/
static void selectInnerLoop(
Parse *pParse, /* The parser context */
Select *p, /* The complete select statement being coded */
- ExprList *pEList, /* List of values being extracted */
- int srcTab, /* Pull data from this table */
+ int srcTab, /* Pull data from this table if non-negative */
SortCtx *pSort, /* If not NULL, info on how to process ORDER BY */
DistinctCtx *pDistinct, /* If not NULL, info on how to process DISTINCT */
SelectDest *pDest, /* How to dispose of the results */
@@ -117218,7 +118384,7 @@ static void selectInnerLoop(
int regOrig; /* Start of memory holding full result (or 0) */
assert( v );
- assert( pEList!=0 );
+ assert( p->pEList!=0 );
hasDistinct = pDistinct ? pDistinct->eTnctType : WHERE_DISTINCT_NOOP;
if( pSort && pSort->pOrderBy==0 ) pSort = 0;
if( pSort==0 && !hasDistinct ){
@@ -117228,7 +118394,7 @@ static void selectInnerLoop(
/* Pull the requested columns.
*/
- nResultCol = pEList->nExpr;
+ nResultCol = p->pEList->nExpr;
if( pDest->iSdst==0 ){
if( pSort ){
@@ -117251,7 +118417,7 @@ static void selectInnerLoop(
if( srcTab>=0 ){
for(i=0; i<nResultCol; i++){
sqlite3VdbeAddOp3(v, OP_Column, srcTab, i, regResult+i);
- VdbeComment((v, "%s", pEList->a[i].zName));
+ VdbeComment((v, "%s", p->pEList->a[i].zName));
}
}else if( eDest!=SRT_Exists ){
/* If the destination is an EXISTS(...) expression, the actual
@@ -117264,24 +118430,25 @@ static void selectInnerLoop(
ecelFlags = 0;
}
if( pSort && hasDistinct==0 && eDest!=SRT_EphemTab && eDest!=SRT_Table ){
- /* For each expression in pEList that is a copy of an expression in
+ /* For each expression in p->pEList that is a copy of an expression in
** the ORDER BY clause (pSort->pOrderBy), set the associated
** iOrderByCol value to one more than the index of the ORDER BY
** expression within the sort-key that pushOntoSorter() will generate.
- ** This allows the pEList field to be omitted from the sorted record,
+ ** This allows the p->pEList field to be omitted from the sorted record,
** saving space and CPU cycles. */
ecelFlags |= (SQLITE_ECEL_OMITREF|SQLITE_ECEL_REF);
for(i=pSort->nOBSat; i<pSort->pOrderBy->nExpr; i++){
int j;
if( (j = pSort->pOrderBy->a[i].u.x.iOrderByCol)>0 ){
- pEList->a[j-1].u.x.iOrderByCol = i+1-pSort->nOBSat;
+ p->pEList->a[j-1].u.x.iOrderByCol = i+1-pSort->nOBSat;
}
}
regOrig = 0;
assert( eDest==SRT_Set || eDest==SRT_Mem
|| eDest==SRT_Coroutine || eDest==SRT_Output );
}
- nResultCol = sqlite3ExprCodeExprList(pParse,pEList,regResult,0,ecelFlags);
+ nResultCol = sqlite3ExprCodeExprList(pParse,p->pEList,regResult,
+ 0,ecelFlags);
}
/* If the DISTINCT keyword was present on the SELECT statement
@@ -117313,7 +118480,7 @@ static void selectInnerLoop(
iJump = sqlite3VdbeCurrentAddr(v) + nResultCol;
for(i=0; i<nResultCol; i++){
- CollSeq *pColl = sqlite3ExprCollSeq(pParse, pEList->a[i].pExpr);
+ CollSeq *pColl = sqlite3ExprCollSeq(pParse, p->pEList->a[i].pExpr);
if( i<nResultCol-1 ){
sqlite3VdbeAddOp3(v, OP_Ne, regResult+i, iJump, regPrev+i);
VdbeCoverage(v);
@@ -117552,12 +118719,12 @@ static void selectInnerLoop(
** X extra columns.
*/
SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoAlloc(sqlite3 *db, int N, int X){
- int nExtra = (N+X)*(sizeof(CollSeq*)+1);
+ int nExtra = (N+X)*(sizeof(CollSeq*)+1) - sizeof(CollSeq*);
KeyInfo *p = sqlite3DbMallocRawNN(db, sizeof(KeyInfo) + nExtra);
if( p ){
p->aSortOrder = (u8*)&p->aColl[N+X];
- p->nField = (u16)N;
- p->nXField = (u16)X;
+ p->nKeyField = (u16)N;
+ p->nAllField = (u16)(N+X);
p->enc = ENC(db);
p->db = db;
p->nRef = 1;
@@ -117631,10 +118798,7 @@ static KeyInfo *keyInfoFromExprList(
if( pInfo ){
assert( sqlite3KeyInfoIsWriteable(pInfo) );
for(i=iStart, pItem=pList->a+iStart; i<nExpr; i++, pItem++){
- CollSeq *pColl;
- pColl = sqlite3ExprCollSeq(pParse, pItem->pExpr);
- if( !pColl ) pColl = db->pDfltColl;
- pInfo->aColl[i-iStart] = pColl;
+ pInfo->aColl[i-iStart] = sqlite3ExprNNCollSeq(pParse, pItem->pExpr);
pInfo->aSortOrder[i-iStart] = pItem->sortOrder;
}
}
@@ -117884,23 +119048,23 @@ static void generateSortTail(
** the SQLITE_ENABLE_COLUMN_METADATA compile-time option is used.
*/
#ifdef SQLITE_ENABLE_COLUMN_METADATA
-# define columnType(A,B,C,D,E,F) columnTypeImpl(A,B,C,D,E,F)
+# define columnType(A,B,C,D,E) columnTypeImpl(A,B,C,D,E)
#else /* if !defined(SQLITE_ENABLE_COLUMN_METADATA) */
-# define columnType(A,B,C,D,E,F) columnTypeImpl(A,B,F)
+# define columnType(A,B,C,D,E) columnTypeImpl(A,B)
#endif
static const char *columnTypeImpl(
NameContext *pNC,
+#ifndef SQLITE_ENABLE_COLUMN_METADATA
+ Expr *pExpr
+#else
Expr *pExpr,
-#ifdef SQLITE_ENABLE_COLUMN_METADATA
const char **pzOrigDb,
const char **pzOrigTab,
- const char **pzOrigCol,
+ const char **pzOrigCol
#endif
- u8 *pEstWidth
){
char const *zType = 0;
int j;
- u8 estWidth = 1;
#ifdef SQLITE_ENABLE_COLUMN_METADATA
char const *zOrigDb = 0;
char const *zOrigTab = 0;
@@ -117959,46 +119123,42 @@ static const char *columnTypeImpl(
** of the SELECT statement. Return the declaration type and origin
** data for the result-set column of the sub-select.
*/
- if( iCol>=0 && ALWAYS(iCol<pS->pEList->nExpr) ){
+ if( iCol>=0 && iCol<pS->pEList->nExpr ){
/* If iCol is less than zero, then the expression requests the
** rowid of the sub-select or view. This expression is legal (see
** test case misc2.2.2) - it always evaluates to NULL.
- **
- ** The ALWAYS() is because iCol>=pS->pEList->nExpr will have been
- ** caught already by name resolution.
*/
NameContext sNC;
Expr *p = pS->pEList->a[iCol].pExpr;
sNC.pSrcList = pS->pSrc;
sNC.pNext = pNC;
sNC.pParse = pNC->pParse;
- zType = columnType(&sNC, p,&zOrigDb,&zOrigTab,&zOrigCol, &estWidth);
+ zType = columnType(&sNC, p,&zOrigDb,&zOrigTab,&zOrigCol);
}
- }else if( pTab->pSchema ){
- /* A real table */
+ }else{
+ /* A real table or a CTE table */
assert( !pS );
- if( iCol<0 ) iCol = pTab->iPKey;
- assert( iCol==-1 || (iCol>=0 && iCol<pTab->nCol) );
#ifdef SQLITE_ENABLE_COLUMN_METADATA
+ if( iCol<0 ) iCol = pTab->iPKey;
+ assert( iCol==XN_ROWID || (iCol>=0 && iCol<pTab->nCol) );
if( iCol<0 ){
zType = "INTEGER";
zOrigCol = "rowid";
}else{
zOrigCol = pTab->aCol[iCol].zName;
zType = sqlite3ColumnType(&pTab->aCol[iCol],0);
- estWidth = pTab->aCol[iCol].szEst;
}
zOrigTab = pTab->zName;
- if( pNC->pParse ){
+ if( pNC->pParse && pTab->pSchema ){
int iDb = sqlite3SchemaToIndex(pNC->pParse->db, pTab->pSchema);
zOrigDb = pNC->pParse->db->aDb[iDb].zDbSName;
}
#else
+ assert( iCol==XN_ROWID || (iCol>=0 && iCol<pTab->nCol) );
if( iCol<0 ){
zType = "INTEGER";
}else{
zType = sqlite3ColumnType(&pTab->aCol[iCol],0);
- estWidth = pTab->aCol[iCol].szEst;
}
#endif
}
@@ -118017,7 +119177,7 @@ static const char *columnTypeImpl(
sNC.pSrcList = pS->pSrc;
sNC.pNext = pNC;
sNC.pParse = pNC->pParse;
- zType = columnType(&sNC, p, &zOrigDb, &zOrigTab, &zOrigCol, &estWidth);
+ zType = columnType(&sNC, p, &zOrigDb, &zOrigTab, &zOrigCol);
break;
}
#endif
@@ -118031,7 +119191,6 @@ static const char *columnTypeImpl(
*pzOrigCol = zOrigCol;
}
#endif
- if( pEstWidth ) *pEstWidth = estWidth;
return zType;
}
@@ -118058,7 +119217,7 @@ static void generateColumnTypes(
const char *zOrigDb = 0;
const char *zOrigTab = 0;
const char *zOrigCol = 0;
- zType = columnType(&sNC, p, &zOrigDb, &zOrigTab, &zOrigCol, 0);
+ zType = columnType(&sNC, p, &zOrigDb, &zOrigTab, &zOrigCol);
/* The vdbe must make its own copy of the column-type and other
** column specific strings, in case the schema is reset before this
@@ -118068,41 +119227,56 @@ static void generateColumnTypes(
sqlite3VdbeSetColName(v, i, COLNAME_TABLE, zOrigTab, SQLITE_TRANSIENT);
sqlite3VdbeSetColName(v, i, COLNAME_COLUMN, zOrigCol, SQLITE_TRANSIENT);
#else
- zType = columnType(&sNC, p, 0, 0, 0, 0);
+ zType = columnType(&sNC, p, 0, 0, 0);
#endif
sqlite3VdbeSetColName(v, i, COLNAME_DECLTYPE, zType, SQLITE_TRANSIENT);
}
#endif /* !defined(SQLITE_OMIT_DECLTYPE) */
}
-/*
-** Return the Table objecct in the SrcList that has cursor iCursor.
-** Or return NULL if no such Table object exists in the SrcList.
-*/
-static Table *tableWithCursor(SrcList *pList, int iCursor){
- int j;
- for(j=0; j<pList->nSrc; j++){
- if( pList->a[j].iCursor==iCursor ) return pList->a[j].pTab;
- }
- return 0;
-}
-
/*
-** Generate code that will tell the VDBE the names of columns
-** in the result set. This information is used to provide the
-** azCol[] values in the callback.
+** Compute the column names for a SELECT statement.
+**
+** The only guarantee that SQLite makes about column names is that if the
+** column has an AS clause assigning it a name, that will be the name used.
+** That is the only documented guarantee. However, countless applications
+** developed over the years have made baseless assumptions about column names
+** and will break if those assumptions changes. Hence, use extreme caution
+** when modifying this routine to avoid breaking legacy.
+**
+** See Also: sqlite3ColumnsFromExprList()
+**
+** The PRAGMA short_column_names and PRAGMA full_column_names settings are
+** deprecated. The default setting is short=ON, full=OFF. 99.9% of all
+** applications should operate this way. Nevertheless, we need to support the
+** other modes for legacy:
+**
+** short=OFF, full=OFF: Column name is the text of the expression has it
+** originally appears in the SELECT statement. In
+** other words, the zSpan of the result expression.
+**
+** short=ON, full=OFF: (This is the default setting). If the result
+** refers directly to a table column, then the
+** result column name is just the table column
+** name: COLUMN. Otherwise use zSpan.
+**
+** full=ON, short=ANY: If the result refers directly to a table column,
+** then the result column name with the table name
+** prefix, ex: TABLE.COLUMN. Otherwise use zSpan.
*/
static void generateColumnNames(
Parse *pParse, /* Parser context */
- SrcList *pTabList, /* List of tables */
- ExprList *pEList /* Expressions defining the result set */
+ Select *pSelect /* Generate column names for this SELECT statement */
){
Vdbe *v = pParse->pVdbe;
int i;
Table *pTab;
+ SrcList *pTabList;
+ ExprList *pEList;
sqlite3 *db = pParse->db;
- int fullNames, shortNames;
+ int fullName; /* TABLE.COLUMN if no AS clause and is a direct table ref */
+ int srcName; /* COLUMN or TABLE.COLUMN if no AS clause and is direct */
#ifndef SQLITE_OMIT_EXPLAIN
/* If this is an EXPLAIN, skip this step */
@@ -118112,24 +119286,31 @@ static void generateColumnNames(
#endif
if( pParse->colNamesSet || db->mallocFailed ) return;
+ /* Column names are determined by the left-most term of a compound select */
+ while( pSelect->pPrior ) pSelect = pSelect->pPrior;
+ pTabList = pSelect->pSrc;
+ pEList = pSelect->pEList;
assert( v!=0 );
assert( pTabList!=0 );
pParse->colNamesSet = 1;
- fullNames = (db->flags & SQLITE_FullColNames)!=0;
- shortNames = (db->flags & SQLITE_ShortColNames)!=0;
+ fullName = (db->flags & SQLITE_FullColNames)!=0;
+ srcName = (db->flags & SQLITE_ShortColNames)!=0 || fullName;
sqlite3VdbeSetNumCols(v, pEList->nExpr);
for(i=0; i<pEList->nExpr; i++){
- Expr *p;
- p = pEList->a[i].pExpr;
- if( NEVER(p==0) ) continue;
+ Expr *p = pEList->a[i].pExpr;
+
+ assert( p!=0 );
+ assert( p->op!=TK_AGG_COLUMN ); /* Agg processing has not run yet */
+ assert( p->op!=TK_COLUMN || p->pTab!=0 ); /* Covering idx not yet coded */
if( pEList->a[i].zName ){
+ /* An AS clause always takes first priority */
char *zName = pEList->a[i].zName;
sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_TRANSIENT);
- }else if( (p->op==TK_COLUMN || p->op==TK_AGG_COLUMN)
- && (pTab = tableWithCursor(pTabList, p->iTable))!=0
- ){
+ }else if( srcName && p->op==TK_COLUMN ){
char *zCol;
int iCol = p->iColumn;
+ pTab = p->pTab;
+ assert( pTab!=0 );
if( iCol<0 ) iCol = pTab->iPKey;
assert( iCol==-1 || (iCol>=0 && iCol<pTab->nCol) );
if( iCol<0 ){
@@ -118137,10 +119318,7 @@ static void generateColumnNames(
}else{
zCol = pTab->aCol[iCol].zName;
}
- if( !shortNames && !fullNames ){
- sqlite3VdbeSetColName(v, i, COLNAME_NAME,
- sqlite3DbStrDup(db, pEList->a[i].zSpan), SQLITE_DYNAMIC);
- }else if( fullNames ){
+ if( fullName ){
char *zName = 0;
zName = sqlite3MPrintf(db, "%s.%s", pTab->zName, zCol);
sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_DYNAMIC);
@@ -118168,6 +119346,15 @@ static void generateColumnNames(
**
** Return SQLITE_OK on success. If a memory allocation error occurs,
** store NULL in *paCol and 0 in *pnCol and return SQLITE_NOMEM.
+**
+** The only guarantee that SQLite makes about column names is that if the
+** column has an AS clause assigning it a name, that will be the name used.
+** That is the only documented guarantee. However, countless applications
+** developed over the years have made baseless assumptions about column names
+** and will break if those assumptions changes. Hence, use extreme caution
+** when modifying this routine to avoid breaking legacy.
+**
+** See Also: generateColumnNames()
*/
SQLITE_PRIVATE int sqlite3ColumnsFromExprList(
Parse *pParse, /* Parsing context */
@@ -118180,7 +119367,6 @@ SQLITE_PRIVATE int sqlite3ColumnsFromExprList(
u32 cnt; /* Index added to make the name unique */
Column *aCol, *pCol; /* For looping over result columns */
int nCol; /* Number of columns in the result set */
- Expr *p; /* Expression for a single result column */
char *zName; /* Column name */
int nName; /* Size of name in zName[] */
Hash ht; /* Hash table of column names */
@@ -118190,6 +119376,7 @@ SQLITE_PRIVATE int sqlite3ColumnsFromExprList(
nCol = pEList->nExpr;
aCol = sqlite3DbMallocZero(db, sizeof(aCol[0])*nCol);
testcase( aCol==0 );
+ if( nCol>32767 ) nCol = 32767;
}else{
nCol = 0;
aCol = 0;
@@ -118201,20 +119388,20 @@ SQLITE_PRIVATE int sqlite3ColumnsFromExprList(
for(i=0, pCol=aCol; i<nCol && !db->mallocFailed; i++, pCol++){
/* Get an appropriate name for the column
*/
- p = sqlite3ExprSkipCollate(pEList->a[i].pExpr);
if( (zName = pEList->a[i].zName)!=0 ){
/* If the column contains an "AS <name>" phrase, use <name> as the name */
}else{
- Expr *pColExpr = p; /* The expression that is the result column name */
- Table *pTab; /* Table associated with this expression */
+ Expr *pColExpr = sqlite3ExprSkipCollate(pEList->a[i].pExpr);
while( pColExpr->op==TK_DOT ){
pColExpr = pColExpr->pRight;
assert( pColExpr!=0 );
}
- if( pColExpr->op==TK_COLUMN && pColExpr->pTab!=0 ){
+ if( (pColExpr->op==TK_COLUMN || pColExpr->op==TK_AGG_COLUMN)
+ && pColExpr->pTab!=0
+ ){
/* For columns use the column name name */
int iCol = pColExpr->iColumn;
- pTab = pColExpr->pTab;
+ Table *pTab = pColExpr->pTab;
if( iCol<0 ) iCol = pTab->iPKey;
zName = iCol>=0 ? pTab->aCol[iCol].zName : "rowid";
}else if( pColExpr->op==TK_ID ){
@@ -118225,7 +119412,11 @@ SQLITE_PRIVATE int sqlite3ColumnsFromExprList(
zName = pEList->a[i].zSpan;
}
}
- zName = sqlite3MPrintf(db, "%s", zName);
+ if( zName ){
+ zName = sqlite3DbStrDup(db, zName);
+ }else{
+ zName = sqlite3MPrintf(db,"column%d",i+1);
+ }
/* Make sure the column name is unique. If the name is not unique,
** append an integer to the name so that it becomes unique.
@@ -118282,7 +119473,6 @@ SQLITE_PRIVATE void sqlite3SelectAddColumnTypeAndCollation(
int i;
Expr *p;
struct ExprList_item *a;
- u64 szAll = 0;
assert( pSelect!=0 );
assert( (pSelect->selFlags & SF_Resolved)!=0 );
@@ -118295,10 +119485,11 @@ SQLITE_PRIVATE void sqlite3SelectAddColumnTypeAndCollation(
const char *zType;
int n, m;
p = a[i].pExpr;
- zType = columnType(&sNC, p, 0, 0, 0, &pCol->szEst);
- szAll += pCol->szEst;
+ zType = columnType(&sNC, p, 0, 0, 0);
+ /* pCol->szEst = ... // Column size est for SELECT tables never used */
pCol->affinity = sqlite3ExprAffinity(p);
- if( zType && (m = sqlite3Strlen30(zType))>0 ){
+ if( zType ){
+ m = sqlite3Strlen30(zType);
n = sqlite3Strlen30(pCol->zName);
pCol->zName = sqlite3DbReallocOrFree(db, pCol->zName, n+m+2);
if( pCol->zName ){
@@ -118312,7 +119503,7 @@ SQLITE_PRIVATE void sqlite3SelectAddColumnTypeAndCollation(
pCol->zColl = sqlite3DbStrDup(db, pColl->zName);
}
}
- pTab->szTabRow = sqlite3LogEst(szAll*4);
+ pTab->szTabRow = 1; /* Any non-zero value works */
}
/*
@@ -118355,19 +119546,16 @@ SQLITE_PRIVATE Table *sqlite3ResultSetOfSelect(Parse *pParse, Select *pSelect){
** Get a VDBE for the given parser context. Create a new one if necessary.
** If an error occurs, return NULL and leave a message in pParse.
*/
-static SQLITE_NOINLINE Vdbe *allocVdbe(Parse *pParse){
- Vdbe *v = pParse->pVdbe = sqlite3VdbeCreate(pParse);
- if( v ) sqlite3VdbeAddOp2(v, OP_Init, 0, 1);
+SQLITE_PRIVATE Vdbe *sqlite3GetVdbe(Parse *pParse){
+ if( pParse->pVdbe ){
+ return pParse->pVdbe;
+ }
if( pParse->pToplevel==0
&& OptimizationEnabled(pParse->db,SQLITE_FactorOutConst)
){
pParse->okConstFactor = 1;
}
- return v;
-}
-SQLITE_PRIVATE Vdbe *sqlite3GetVdbe(Parse *pParse){
- Vdbe *v = pParse->pVdbe;
- return v ? v : allocVdbe(pParse);
+ return sqlite3VdbeCreate(pParse);
}
@@ -118640,7 +119828,7 @@ static void generateWithRecursiveQuery(
/* Output the single row in Current */
addrCont = sqlite3VdbeMakeLabel(v);
codeOffset(v, regOffset, addrCont);
- selectInnerLoop(pParse, p, p->pEList, iCurrent,
+ selectInnerLoop(pParse, p, iCurrent,
0, 0, pDest, addrCont, addrBreak);
if( regLimit ){
sqlite3VdbeAddOp2(v, OP_DecrJumpZero, regLimit, addrBreak);
@@ -118778,15 +119966,9 @@ static int multiSelect(
db = pParse->db;
pPrior = p->pPrior;
dest = *pDest;
- if( pPrior->pOrderBy ){
- sqlite3ErrorMsg(pParse,"ORDER BY clause should come after %s not before",
- selectOpName(p->op));
- rc = 1;
- goto multi_select_end;
- }
- if( pPrior->pLimit ){
- sqlite3ErrorMsg(pParse,"LIMIT clause should come after %s not before",
- selectOpName(p->op));
+ if( pPrior->pOrderBy || pPrior->pLimit ){
+ sqlite3ErrorMsg(pParse,"%s clause should come after %s not before",
+ pPrior->pOrderBy!=0 ? "ORDER BY" : "LIMIT", selectOpName(p->op));
rc = 1;
goto multi_select_end;
}
@@ -118954,17 +120136,12 @@ static int multiSelect(
if( dest.eDest!=priorOp ){
int iCont, iBreak, iStart;
assert( p->pEList );
- if( dest.eDest==SRT_Output ){
- Select *pFirst = p;
- while( pFirst->pPrior ) pFirst = pFirst->pPrior;
- generateColumnNames(pParse, pFirst->pSrc, pFirst->pEList);
- }
iBreak = sqlite3VdbeMakeLabel(v);
iCont = sqlite3VdbeMakeLabel(v);
computeLimitRegisters(pParse, p, iBreak);
sqlite3VdbeAddOp2(v, OP_Rewind, unionTab, iBreak); VdbeCoverage(v);
iStart = sqlite3VdbeCurrentAddr(v);
- selectInnerLoop(pParse, p, p->pEList, unionTab,
+ selectInnerLoop(pParse, p, unionTab,
0, 0, &dest, iCont, iBreak);
sqlite3VdbeResolveLabel(v, iCont);
sqlite3VdbeAddOp2(v, OP_Next, unionTab, iStart); VdbeCoverage(v);
@@ -119029,11 +120206,6 @@ static int multiSelect(
** tables.
*/
assert( p->pEList );
- if( dest.eDest==SRT_Output ){
- Select *pFirst = p;
- while( pFirst->pPrior ) pFirst = pFirst->pPrior;
- generateColumnNames(pParse, pFirst->pSrc, pFirst->pEList);
- }
iBreak = sqlite3VdbeMakeLabel(v);
iCont = sqlite3VdbeMakeLabel(v);
computeLimitRegisters(pParse, p, iBreak);
@@ -119042,7 +120214,7 @@ static int multiSelect(
iStart = sqlite3VdbeAddOp2(v, OP_RowData, tab1, r1);
sqlite3VdbeAddOp4Int(v, OP_NotFound, tab2, iCont, r1, 0); VdbeCoverage(v);
sqlite3ReleaseTempReg(pParse, r1);
- selectInnerLoop(pParse, p, p->pEList, tab1,
+ selectInnerLoop(pParse, p, tab1,
0, 0, &dest, iCont, iBreak);
sqlite3VdbeResolveLabel(v, iCont);
sqlite3VdbeAddOp2(v, OP_Next, tab1, iStart); VdbeCoverage(v);
@@ -119641,14 +120813,6 @@ static int multiSelectOrderBy(
*/
sqlite3VdbeResolveLabel(v, labelEnd);
- /* Set the number of output columns
- */
- if( pDest->eDest==SRT_Output ){
- Select *pFirst = pPrior;
- while( pFirst->pPrior ) pFirst = pFirst->pPrior;
- generateColumnNames(pParse, pFirst->pSrc, pFirst->pEList);
- }
-
/* Reassembly the compound query so that it will be freed correctly
** by the calling function */
if( p->pPrior ){
@@ -119702,7 +120866,9 @@ static Expr *substExpr(
Expr *pExpr /* Expr in which substitution occurs */
){
if( pExpr==0 ) return 0;
- if( ExprHasProperty(pExpr, EP_FromJoin) && pExpr->iRightJoinTable==pSubst->iTable ){
+ if( ExprHasProperty(pExpr, EP_FromJoin)
+ && pExpr->iRightJoinTable==pSubst->iTable
+ ){
pExpr->iRightJoinTable = pSubst->iNewTable;
}
if( pExpr->op==TK_COLUMN && pExpr->iTable==pSubst->iTable ){
@@ -119726,9 +120892,12 @@ static Expr *substExpr(
pCopy = &ifNullRow;
}
pNew = sqlite3ExprDup(db, pCopy, 0);
- if( pNew && (pExpr->flags & EP_FromJoin) ){
+ if( pNew && pSubst->isLeftJoin ){
+ ExprSetProperty(pNew, EP_CanBeNull);
+ }
+ if( pNew && ExprHasProperty(pExpr,EP_FromJoin) ){
pNew->iRightJoinTable = pExpr->iRightJoinTable;
- pNew->flags |= EP_FromJoin;
+ ExprSetProperty(pNew, EP_FromJoin);
}
sqlite3ExprDelete(db, pExpr);
pExpr = pNew;
@@ -119812,67 +120981,74 @@ static void substSelect(
** exist on the table t1, a complete scan of the data might be
** avoided.
**
-** Flattening is only attempted if all of the following are true:
+** Flattening is subject to the following constraints:
**
-** (1) The subquery and the outer query do not both use aggregates.
+** (**) We no longer attempt to flatten aggregate subqueries. Was:
+** The subquery and the outer query cannot both be aggregates.
**
-** (2) The subquery is not an aggregate or (2a) the outer query is not a join
-** and (2b) the outer query does not use subqueries other than the one
-** FROM-clause subquery that is a candidate for flattening. (2b is
-** due to ticket [2f7170d73bf9abf80] from 2015-02-09.)
+** (**) We no longer attempt to flatten aggregate subqueries. Was:
+** (2) If the subquery is an aggregate then
+** (2a) the outer query must not be a join and
+** (2b) the outer query must not use subqueries
+** other than the one FROM-clause subquery that is a candidate
+** for flattening. (This is due to ticket [2f7170d73bf9abf80]
+** from 2015-02-09.)
**
-** (3) The subquery is not the right operand of a LEFT JOIN
-** or the subquery is not itself a join and the outer query is not
-** an aggregate.
+** (3) If the subquery is the right operand of a LEFT JOIN then
+** (3a) the subquery may not be a join and
+** (3b) the FROM clause of the subquery may not contain a virtual
+** table and
+** (3c) the outer query may not be an aggregate.
**
-** (4) The subquery is not DISTINCT.
+** (4) The subquery can not be DISTINCT.
**
** (**) At one point restrictions (4) and (5) defined a subset of DISTINCT
** sub-queries that were excluded from this optimization. Restriction
** (4) has since been expanded to exclude all DISTINCT subqueries.
**
-** (6) The subquery does not use aggregates or the outer query is not
-** DISTINCT.
+** (**) We no longer attempt to flatten aggregate subqueries. Was:
+** If the subquery is aggregate, the outer query may not be DISTINCT.
**
-** (7) The subquery has a FROM clause. TODO: For subqueries without
+** (7) The subquery must have a FROM clause. TODO: For subqueries without
** A FROM clause, consider adding a FROM clause with the special
** table sqlite_once that consists of a single row containing a
** single NULL.
**
-** (8) The subquery does not use LIMIT or the outer query is not a join.
+** (8) If the subquery uses LIMIT then the outer query may not be a join.
**
-** (9) The subquery does not use LIMIT or the outer query does not use
-** aggregates.
+** (9) If the subquery uses LIMIT then the outer query may not be aggregate.
**
** (**) Restriction (10) was removed from the code on 2005-02-05 but we
** accidently carried the comment forward until 2014-09-15. Original
-** text: "The subquery does not use aggregates or the outer query
-** does not use LIMIT."
+** constraint: "If the subquery is aggregate then the outer query
+** may not use LIMIT."
**
-** (11) The subquery and the outer query do not both have ORDER BY clauses.
+** (11) The subquery and the outer query may not both have ORDER BY clauses.
**
** (**) Not implemented. Subsumed into restriction (3). Was previously
** a separate restriction deriving from ticket #350.
**
-** (13) The subquery and outer query do not both use LIMIT.
+** (13) The subquery and outer query may not both use LIMIT.
**
-** (14) The subquery does not use OFFSET.
+** (14) The subquery may not use OFFSET.
**
-** (15) The outer query is not part of a compound select or the
-** subquery does not have a LIMIT clause.
+** (15) If the outer query is part of a compound select, then the
+** subquery may not use LIMIT.
** (See ticket #2339 and ticket [02a8e81d44]).
**
-** (16) The outer query is not an aggregate or the subquery does
-** not contain ORDER BY. (Ticket #2942) This used to not matter
+** (16) If the outer query is aggregate, then the subquery may not
+** use ORDER BY. (Ticket #2942) This used to not matter
** until we introduced the group_concat() function.
**
-** (17) The sub-query is not a compound select, or it is a UNION ALL
-** compound clause made up entirely of non-aggregate queries, and
-** the parent query:
-**
-** * is not itself part of a compound select,
-** * is not an aggregate or DISTINCT query, and
-** * is not a join
+** (17) If the subquery is a compound select, then
+** (17a) all compound operators must be a UNION ALL, and
+** (17b) no terms within the subquery compound may be aggregate
+** or DISTINCT, and
+** (17c) every term within the subquery compound must have a FROM clause
+** (17d) the outer query may not be
+** (17d1) aggregate, or
+** (17d2) DISTINCT, or
+** (17d3) a join.
**
** The parent and sub-query may contain WHERE clauses. Subject to
** rules (11), (13) and (14), they may also contain ORDER BY,
@@ -119888,29 +121064,32 @@ static void substSelect(
** syntax error and return a detailed message.
**
** (18) If the sub-query is a compound select, then all terms of the
-** ORDER by clause of the parent must be simple references to
+** ORDER BY clause of the parent must be simple references to
** columns of the sub-query.
**
-** (19) The subquery does not use LIMIT or the outer query does not
+** (19) If the subquery uses LIMIT then the outer query may not
** have a WHERE clause.
**
-** (20) If the sub-query is a compound select, then it must not use
-** an ORDER BY clause. Ticket #3773. We could relax this constraint
-** somewhat by saying that the terms of the ORDER BY clause must
-** appear as unmodified result columns in the outer query. But we
-** have other optimizations in mind to deal with that case.
+** (**) Subsumed into (17d3). Was: If the sub-query is a compound select,
+** then it must not use an ORDER BY clause - Ticket #3773. Because
+** of (17d3), then only way to have a compound subquery is if it is
+** the only term in the FROM clause of the outer query. But if the
+** only term in the FROM clause has an ORDER BY, then it will be
+** implemented as a co-routine and the flattener will never be called.
**
-** (21) The subquery does not use LIMIT or the outer query is not
+** (21) If the subquery uses LIMIT then the outer query may not be
** DISTINCT. (See ticket [752e1646fc]).
**
-** (22) The subquery is not a recursive CTE.
+** (22) The subquery may not be a recursive CTE.
**
-** (23) The parent is not a recursive CTE, or the sub-query is not a
-** compound query. This restriction is because transforming the
+** (**) Subsumed into restriction (17d3). Was: If the outer query is
+** a recursive CTE, then the sub-query may not be a compound query.
+** This restriction is because transforming the
** parent to a compound query confuses the code that handles
** recursive queries in multiSelect().
**
-** (24) The subquery is not an aggregate that uses the built-in min() or
+** (**) We no longer attempt to flatten aggregate subqueries. Was:
+** The subquery may not be an aggregate that uses the built-in min() or
** or max() functions. (Without this restriction, a query like:
** "SELECT x FROM (SELECT max(y), x FROM t1)" would not necessarily
** return the value X for which Y was maximal.)
@@ -119918,7 +121097,7 @@ static void substSelect(
**
** In this routine, the "p" parameter is a pointer to the outer query.
** The subquery is p->pSrc->a[iFrom]. isAgg is true if the outer query
-** uses aggregates and subqueryIsAgg is true if the subquery uses aggregates.
+** uses aggregates.
**
** If flattening is not attempted, this routine is a no-op and returns 0.
** If flattening is attempted this routine returns 1.
@@ -119930,8 +121109,7 @@ static int flattenSubquery(
Parse *pParse, /* Parsing context */
Select *p, /* The parent or outer SELECT statement */
int iFrom, /* Index in p->pSrc->a[] of the inner subquery */
- int isAgg, /* True if outer SELECT uses aggregate functions */
- int subqueryIsAgg /* True if the subquery uses aggregate functions */
+ int isAgg /* True if outer SELECT uses aggregate functions */
){
const char *zSavedAuthContext = pParse->zAuthContext;
Select *pParent; /* Current UNION ALL term of the other query */
@@ -119939,7 +121117,6 @@ static int flattenSubquery(
Select *pSub1; /* Pointer to the rightmost select in sub-query */
SrcList *pSrc; /* The FROM clause of the outer query */
SrcList *pSubSrc; /* The FROM clause of the subquery */
- ExprList *pList; /* The result set of the outer query */
int iParent; /* VDBE cursor number of the pSub result set temp table */
int iNewParent = -1;/* Replacement table for iParent */
int isLeftJoin = 0; /* True if pSub is the right side of a LEFT JOIN */
@@ -119951,7 +121128,7 @@ static int flattenSubquery(
/* Check to see if flattening is permitted. Return 0 if not.
*/
assert( p!=0 );
- assert( p->pPrior==0 ); /* Unable to flatten compound queries */
+ assert( p->pPrior==0 );
if( OptimizationDisabled(db, SQLITE_QueryFlattener) ) return 0;
pSrc = p->pSrc;
assert( pSrc && iFrom>=0 && iFrom<pSrc->nSrc );
@@ -119959,16 +121136,6 @@ static int flattenSubquery(
iParent = pSubitem->iCursor;
pSub = pSubitem->pSelect;
assert( pSub!=0 );
- if( subqueryIsAgg ){
- if( isAgg ) return 0; /* Restriction (1) */
- if( pSrc->nSrc>1 ) return 0; /* Restriction (2a) */
- if( (p->pWhere && ExprHasProperty(p->pWhere,EP_Subquery))
- || (sqlite3ExprListFlags(p->pEList) & EP_Subquery)!=0
- || (sqlite3ExprListFlags(p->pOrderBy) & EP_Subquery)!=0
- ){
- return 0; /* Restriction (2b) */
- }
- }
pSubSrc = pSub->pSrc;
assert( pSubSrc );
@@ -119983,13 +121150,10 @@ static int flattenSubquery(
return 0; /* Restriction (15) */
}
if( pSubSrc->nSrc==0 ) return 0; /* Restriction (7) */
- if( pSub->selFlags & SF_Distinct ) return 0; /* Restriction (5) */
+ if( pSub->selFlags & SF_Distinct ) return 0; /* Restriction (4) */
if( pSub->pLimit && (pSrc->nSrc>1 || isAgg) ){
return 0; /* Restrictions (8)(9) */
}
- if( (p->selFlags & SF_Distinct)!=0 && subqueryIsAgg ){
- return 0; /* Restriction (6) */
- }
if( p->pOrderBy && pSub->pOrderBy ){
return 0; /* Restriction (11) */
}
@@ -119998,18 +121162,14 @@ static int flattenSubquery(
if( pSub->pLimit && (p->selFlags & SF_Distinct)!=0 ){
return 0; /* Restriction (21) */
}
- testcase( pSub->selFlags & SF_Recursive );
- testcase( pSub->selFlags & SF_MinMaxAgg );
- if( pSub->selFlags & (SF_Recursive|SF_MinMaxAgg) ){
- return 0; /* Restrictions (22) and (24) */
- }
- if( (p->selFlags & SF_Recursive) && pSub->pPrior ){
- return 0; /* Restriction (23) */
+ if( pSub->selFlags & (SF_Recursive) ){
+ return 0; /* Restrictions (22) */
}
/*
** If the subquery is the right operand of a LEFT JOIN, then the
- ** subquery may not be a join itself. Example of why this is not allowed:
+ ** subquery may not be a join itself (3a). Example of why this is not
+ ** allowed:
**
** t1 LEFT OUTER JOIN (t2 JOIN t3)
**
@@ -120020,54 +121180,53 @@ static int flattenSubquery(
** which is not at all the same thing.
**
** If the subquery is the right operand of a LEFT JOIN, then the outer
- ** query cannot be an aggregate. This is an artifact of the way aggregates
- ** are processed - there is not mechanism to determine if the LEFT JOIN
- ** table should be all-NULL.
+ ** query cannot be an aggregate. (3c) This is an artifact of the way
+ ** aggregates are processed - there is no mechanism to determine if
+ ** the LEFT JOIN table should be all-NULL.
**
** See also tickets #306, #350, and #3300.
*/
if( (pSubitem->fg.jointype & JT_OUTER)!=0 ){
isLeftJoin = 1;
- if( pSubSrc->nSrc>1 || isAgg ){
- return 0; /* Restriction (3) */
+ if( pSubSrc->nSrc>1 || isAgg || IsVirtual(pSubSrc->a[0].pTab) ){
+ /* (3a) (3c) (3b) */
+ return 0;
}
}
#ifdef SQLITE_EXTRA_IFNULLROW
else if( iFrom>0 && !isAgg ){
/* Setting isLeftJoin to -1 causes OP_IfNullRow opcodes to be generated for
- ** every reference to any result column from subquery in a join, even though
- ** they are not necessary. This will stress-test the OP_IfNullRow opcode. */
+ ** every reference to any result column from subquery in a join, even
+ ** though they are not necessary. This will stress-test the OP_IfNullRow
+ ** opcode. */
isLeftJoin = -1;
}
#endif
- /* Restriction 17: If the sub-query is a compound SELECT, then it must
+ /* Restriction (17): If the sub-query is a compound SELECT, then it must
** use only the UNION ALL operator. And none of the simple select queries
** that make up the compound SELECT are allowed to be aggregate or distinct
** queries.
*/
if( pSub->pPrior ){
- if( pSub->pOrderBy ){
- return 0; /* Restriction 20 */
- }
if( isAgg || (p->selFlags & SF_Distinct)!=0 || pSrc->nSrc!=1 ){
- return 0;
+ return 0; /* (17d1), (17d2), or (17d3) */
}
for(pSub1=pSub; pSub1; pSub1=pSub1->pPrior){
testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct );
testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Aggregate );
assert( pSub->pSrc!=0 );
assert( pSub->pEList->nExpr==pSub1->pEList->nExpr );
- if( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))!=0
- || (pSub1->pPrior && pSub1->op!=TK_ALL)
- || pSub1->pSrc->nSrc<1
+ if( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))!=0 /* (17b) */
+ || (pSub1->pPrior && pSub1->op!=TK_ALL) /* (17a) */
+ || pSub1->pSrc->nSrc<1 /* (17c) */
){
return 0;
}
testcase( pSub1->pSrc->nSrc>1 );
}
- /* Restriction 18. */
+ /* Restriction (18). */
if( p->pOrderBy ){
int ii;
for(ii=0; ii<p->pOrderBy->nExpr; ii++){
@@ -120076,6 +121235,23 @@ static int flattenSubquery(
}
}
+ /* Ex-restriction (23):
+ ** The only way that the recursive part of a CTE can contain a compound
+ ** subquery is for the subquery to be one term of a join. But if the
+ ** subquery is a join, then the flattening has already been stopped by
+ ** restriction (17d3)
+ */
+ assert( (p->selFlags & SF_Recursive)==0 || pSub->pPrior==0 );
+
+ /* Ex-restriction (20):
+ ** A compound subquery must be the only term in the FROM clause of the
+ ** outer query by restriction (17d3). But if that term also has an
+ ** ORDER BY clause, then the subquery will be implemented by co-routine
+ ** and so the flattener will never be invoked. Hence, it is not possible
+ ** for the subquery to be a compound and have an ORDER BY clause.
+ */
+ assert( pSub->pPrior==0 || pSub->pOrderBy==0 );
+
/***** If we reach this point, flattening is permitted. *****/
SELECTTRACE(1,pParse,p,("flatten %s.%p from term %d\n",
pSub->zSelName, pSub, iFrom));
@@ -120264,14 +121440,6 @@ static int flattenSubquery(
** We look at every expression in the outer query and every place we see
** "a" we substitute "x*3" and every place we see "b" we substitute "y+10".
*/
- pList = pParent->pEList;
- for(i=0; i<pList->nExpr; i++){
- if( pList->a[i].zName==0 ){
- char *zName = sqlite3DbStrDup(db, pList->a[i].zSpan);
- sqlite3Dequote(zName);
- pList->a[i].zName = zName;
- }
- }
if( pSub->pOrderBy ){
/* At this point, any non-zero iOrderByCol values indicate that the
** ORDER BY column expression is identical to the iOrderByCol'th
@@ -120296,18 +121464,7 @@ static int flattenSubquery(
if( isLeftJoin>0 ){
setJoinExpr(pWhere, iNewParent);
}
- if( subqueryIsAgg ){
- assert( pParent->pHaving==0 );
- pParent->pHaving = pParent->pWhere;
- pParent->pWhere = pWhere;
- pParent->pHaving = sqlite3ExprAnd(db,
- sqlite3ExprDup(db, pSub->pHaving, 0), pParent->pHaving
- );
- assert( pParent->pGroupBy==0 );
- pParent->pGroupBy = sqlite3ExprListDup(db, pSub->pGroupBy, 0);
- }else{
- pParent->pWhere = sqlite3ExprAnd(db, pWhere, pParent->pWhere);
- }
+ pParent->pWhere = sqlite3ExprAnd(db, pWhere, pParent->pWhere);
if( db->mallocFailed==0 ){
SubstContext x;
x.pParse = pParse;
@@ -120370,9 +121527,13 @@ static int flattenSubquery(
**
** Do not attempt this optimization if:
**
-** (1) The inner query is an aggregate. (In that case, we'd really want
-** to copy the outer WHERE-clause terms onto the HAVING clause of the
-** inner query. But they probably won't help there so do not bother.)
+** (1) (** This restriction was removed on 2017-09-29. We used to
+** disallow this optimization for aggregate subqueries, but now
+** it is allowed by putting the extra terms on the HAVING clause.
+** The added HAVING clause is pointless if the subquery lacks
+** a GROUP BY clause. But such a HAVING clause is also harmless
+** so there does not appear to be any reason to add extra logic
+** to suppress it. **)
**
** (2) The inner query is the recursive part of a common table expression.
**
@@ -120397,16 +121558,22 @@ static int pushDownWhereTerms(
){
Expr *pNew;
int nChng = 0;
- Select *pX; /* For looping over compound SELECTs in pSubq */
if( pWhere==0 ) return 0;
- for(pX=pSubq; pX; pX=pX->pPrior){
- if( (pX->selFlags & (SF_Aggregate|SF_Recursive))!=0 ){
- testcase( pX->selFlags & SF_Aggregate );
- testcase( pX->selFlags & SF_Recursive );
- testcase( pX!=pSubq );
- return 0; /* restrictions (1) and (2) */
+ if( pSubq->selFlags & SF_Recursive ) return 0; /* restriction (2) */
+
+#ifdef SQLITE_DEBUG
+ /* Only the first term of a compound can have a WITH clause. But make
+ ** sure no other terms are marked SF_Recursive in case something changes
+ ** in the future.
+ */
+ {
+ Select *pX;
+ for(pX=pSubq; pX; pX=pX->pPrior){
+ assert( (pX->selFlags & (SF_Recursive))==0 );
}
}
+#endif
+
if( pSubq->pLimit!=0 ){
return 0; /* restriction (3) */
}
@@ -120414,7 +121581,7 @@ static int pushDownWhereTerms(
nChng += pushDownWhereTerms(pParse, pSubq, pWhere->pRight, iCursor);
pWhere = pWhere->pLeft;
}
- if( ExprHasProperty(pWhere,EP_FromJoin) ) return 0; /* restriction 5 */
+ if( ExprHasProperty(pWhere,EP_FromJoin) ) return 0; /* restriction (5) */
if( sqlite3ExprIsTableConstant(pWhere, iCursor) ){
nChng++;
while( pSubq ){
@@ -120426,7 +121593,11 @@ static int pushDownWhereTerms(
x.isLeftJoin = 0;
x.pEList = pSubq->pEList;
pNew = substExpr(&x, pNew);
- pSubq->pWhere = sqlite3ExprAnd(pParse->db, pSubq->pWhere, pNew);
+ if( pSubq->selFlags & SF_Aggregate ){
+ pSubq->pHaving = sqlite3ExprAnd(pParse->db, pSubq->pHaving, pNew);
+ }else{
+ pSubq->pWhere = sqlite3ExprAnd(pParse->db, pSubq->pWhere, pNew);
+ }
pSubq = pSubq->pPrior;
}
}
@@ -120754,7 +121925,8 @@ static int withExpand(
);
return SQLITE_ERROR;
}
- assert( pTab->nTabRef==1 || ((pSel->selFlags&SF_Recursive) && pTab->nTabRef==2 ));
+ assert( pTab->nTabRef==1 ||
+ ((pSel->selFlags&SF_Recursive) && pTab->nTabRef==2 ));
pCte->zCteErr = "circular reference: %s";
pSavedWith = pParse->pWith;
@@ -120811,7 +121983,7 @@ static int withExpand(
*/
static void selectPopWith(Walker *pWalker, Select *p){
Parse *pParse = pWalker->pParse;
- if( pParse->pWith && p->pPrior==0 ){
+ if( OK_IF_ALWAYS_TRUE(pParse->pWith) && p->pPrior==0 ){
With *pWith = findRightmost(p)->pWith;
if( pWith!=0 ){
assert( pParse->pWith==pWith );
@@ -120866,7 +122038,7 @@ static int selectExpander(Walker *pWalker, Select *p){
}
pTabList = p->pSrc;
pEList = p->pEList;
- if( p->pWith ){
+ if( OK_IF_ALWAYS_TRUE(p->pWith) ){
sqlite3WithPush(pParse, p->pWith, 0);
}
@@ -120898,7 +122070,11 @@ static int selectExpander(Walker *pWalker, Select *p){
pFrom->pTab = pTab = sqlite3DbMallocZero(db, sizeof(Table));
if( pTab==0 ) return WRC_Abort;
pTab->nTabRef = 1;
- pTab->zName = sqlite3MPrintf(db, "sqlite_sq_%p", (void*)pTab);
+ if( pFrom->zAlias ){
+ pTab->zName = sqlite3DbStrDup(db, pFrom->zAlias);
+ }else{
+ pTab->zName = sqlite3MPrintf(db, "subquery_%p", (void*)pTab);
+ }
while( pSel->pPrior ){ pSel = pSel->pPrior; }
sqlite3ColumnsFromExprList(pParse, pSel->pEList,&pTab->nCol,&pTab->aCol);
pTab->iPKey = -1;
@@ -121108,12 +122284,10 @@ static int selectExpander(Walker *pWalker, Select *p){
sqlite3ExprListDelete(db, pEList);
p->pEList = pNew;
}
-#if SQLITE_MAX_COLUMN
if( p->pEList && p->pEList->nExpr>db->aLimit[SQLITE_LIMIT_COLUMN] ){
sqlite3ErrorMsg(pParse, "too many columns in result set");
return WRC_Abort;
}
-#endif
return WRC_Continue;
}
@@ -121132,6 +122306,25 @@ SQLITE_PRIVATE int sqlite3ExprWalkNoop(Walker *NotUsed, Expr *NotUsed2){
}
/*
+** No-op routine for the parse-tree walker for SELECT statements.
+** subquery in the parser tree.
+*/
+SQLITE_PRIVATE int sqlite3SelectWalkNoop(Walker *NotUsed, Select *NotUsed2){
+ UNUSED_PARAMETER2(NotUsed, NotUsed2);
+ return WRC_Continue;
+}
+
+#if SQLITE_DEBUG
+/*
+** Always assert. This xSelectCallback2 implementation proves that the
+** xSelectCallback2 is never invoked.
+*/
+SQLITE_PRIVATE void sqlite3SelectWalkAssert2(Walker *NotUsed, Select *NotUsed2){
+ UNUSED_PARAMETER2(NotUsed, NotUsed2);
+ assert( 0 );
+}
+#endif
+/*
** This routine "expands" a SELECT statement and all of its subqueries.
** For additional information on what it means to "expand" a SELECT
** statement, see the comment on the selectExpand worker callback above.
@@ -121146,11 +122339,11 @@ SQLITE_PRIVATE int sqlite3ExprWalkNoop(Walker *NotUsed, Expr *NotUsed2){
*/
static void sqlite3SelectExpand(Parse *pParse, Select *pSelect){
Walker w;
- memset(&w, 0, sizeof(w));
w.xExprCallback = sqlite3ExprWalkNoop;
w.pParse = pParse;
- if( pParse->hasCompound ){
+ if( OK_IF_ALWAYS_TRUE(pParse->hasCompound) ){
w.xSelectCallback = convertCompoundSelectToSubquery;
+ w.xSelectCallback2 = 0;
sqlite3WalkSelect(&w, pSelect);
}
w.xSelectCallback = selectExpander;
@@ -121210,7 +122403,7 @@ static void selectAddSubqueryTypeInfo(Walker *pWalker, Select *p){
static void sqlite3SelectAddTypeInfo(Parse *pParse, Select *pSelect){
#ifndef SQLITE_OMIT_SUBQUERY
Walker w;
- memset(&w, 0, sizeof(w));
+ w.xSelectCallback = sqlite3SelectWalkNoop;
w.xSelectCallback2 = selectAddSubqueryTypeInfo;
w.xExprCallback = sqlite3ExprWalkNoop;
w.pParse = pParse;
@@ -121236,15 +122429,13 @@ SQLITE_PRIVATE void sqlite3SelectPrep(
Select *p, /* The SELECT statement being coded. */
NameContext *pOuterNC /* Name context for container */
){
- sqlite3 *db;
- if( NEVER(p==0) ) return;
- db = pParse->db;
- if( db->mallocFailed ) return;
+ assert( p!=0 || pParse->db->mallocFailed );
+ if( pParse->db->mallocFailed ) return;
if( p->selFlags & SF_HasTypeInfo ) return;
sqlite3SelectExpand(pParse, p);
- if( pParse->nErr || db->mallocFailed ) return;
+ if( pParse->nErr || pParse->db->mallocFailed ) return;
sqlite3ResolveSelectNames(pParse, p, pOuterNC);
- if( pParse->nErr || db->mallocFailed ) return;
+ if( pParse->nErr || pParse->db->mallocFailed ) return;
sqlite3SelectAddTypeInfo(pParse, p);
}
@@ -121504,7 +122695,9 @@ static struct SrcList_item *isSelfJoinView(
if( pItem->zName==0 ) continue;
if( sqlite3_stricmp(pItem->zDatabase, pThis->zDatabase)!=0 ) continue;
if( sqlite3_stricmp(pItem->zName, pThis->zName)!=0 ) continue;
- if( sqlite3ExprCompare(pThis->pSelect->pWhere, pItem->pSelect->pWhere, -1) ){
+ if( sqlite3ExprCompare(0,
+ pThis->pSelect->pWhere, pItem->pSelect->pWhere, -1)
+ ){
/* The view was modified by some other optimization such as
** pushDownWhereTerms() */
continue;
@@ -121514,6 +122707,88 @@ static struct SrcList_item *isSelfJoinView(
return 0;
}
+#ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
+/*
+** Attempt to transform a query of the form
+**
+** SELECT count(*) FROM (SELECT x FROM t1 UNION ALL SELECT y FROM t2)
+**
+** Into this:
+**
+** SELECT (SELECT count(*) FROM t1)+(SELECT count(*) FROM t2)
+**
+** The transformation only works if all of the following are true:
+**
+** * The subquery is a UNION ALL of two or more terms
+** * There is no WHERE or GROUP BY or HAVING clauses on the subqueries
+** * The outer query is a simple count(*)
+**
+** Return TRUE if the optimization is undertaken.
+*/
+static int countOfViewOptimization(Parse *pParse, Select *p){
+ Select *pSub, *pPrior;
+ Expr *pExpr;
+ Expr *pCount;
+ sqlite3 *db;
+ if( (p->selFlags & SF_Aggregate)==0 ) return 0; /* This is an aggregate */
+ if( p->pEList->nExpr!=1 ) return 0; /* Single result column */
+ pExpr = p->pEList->a[0].pExpr;
+ if( pExpr->op!=TK_AGG_FUNCTION ) return 0; /* Result is an aggregate */
+ if( sqlite3_stricmp(pExpr->u.zToken,"count") ) return 0; /* Is count() */
+ if( pExpr->x.pList!=0 ) return 0; /* Must be count(*) */
+ if( p->pSrc->nSrc!=1 ) return 0; /* One table in FROM */
+ pSub = p->pSrc->a[0].pSelect;
+ if( pSub==0 ) return 0; /* The FROM is a subquery */
+ if( pSub->pPrior==0 ) return 0; /* Must be a compound ry */
+ do{
+ if( pSub->op!=TK_ALL && pSub->pPrior ) return 0; /* Must be UNION ALL */
+ if( pSub->pWhere ) return 0; /* No WHERE clause */
+ if( pSub->selFlags & SF_Aggregate ) return 0; /* Not an aggregate */
+ pSub = pSub->pPrior; /* Repeat over compound */
+ }while( pSub );
+
+ /* If we reach this point then it is OK to perform the transformation */
+
+ db = pParse->db;
+ pCount = pExpr;
+ pExpr = 0;
+ pSub = p->pSrc->a[0].pSelect;
+ p->pSrc->a[0].pSelect = 0;
+ sqlite3SrcListDelete(db, p->pSrc);
+ p->pSrc = sqlite3DbMallocZero(pParse->db, sizeof(*p->pSrc));
+ while( pSub ){
+ Expr *pTerm;
+ pPrior = pSub->pPrior;
+ pSub->pPrior = 0;
+ pSub->pNext = 0;
+ pSub->selFlags |= SF_Aggregate;
+ pSub->selFlags &= ~SF_Compound;
+ pSub->nSelectRow = 0;
+ sqlite3ExprListDelete(db, pSub->pEList);
+ pTerm = pPrior ? sqlite3ExprDup(db, pCount, 0) : pCount;
+ pSub->pEList = sqlite3ExprListAppend(pParse, 0, pTerm);
+ pTerm = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
+ sqlite3PExprAddSelect(pParse, pTerm, pSub);
+ if( pExpr==0 ){
+ pExpr = pTerm;
+ }else{
+ pExpr = sqlite3PExpr(pParse, TK_PLUS, pTerm, pExpr);
+ }
+ pSub = pPrior;
+ }
+ p->pEList->a[0].pExpr = pExpr;
+ p->selFlags &= ~SF_Aggregate;
+
+#if SELECTTRACE_ENABLED
+ if( sqlite3SelectTrace & 0x400 ){
+ SELECTTRACE(0x400,pParse,p,("After count-of-view optimization:\n"));
+ sqlite3TreeViewSelect(0, p, 0);
+ }
+#endif
+ return 1;
+}
+#endif /* SQLITE_COUNTOFVIEW_OPTIMIZATION */
+
/*
** Generate code for the SELECT statement given in the p argument.
**
@@ -121598,13 +122873,20 @@ SQLITE_PRIVATE int sqlite3Select(
}
#endif
+ /* Get a pointer the VDBE under construction, allocating a new VDBE if one
+ ** does not already exist */
+ v = sqlite3GetVdbe(pParse);
+ if( v==0 ) goto select_end;
+ if( pDest->eDest==SRT_Output ){
+ generateColumnNames(pParse, p);
+ }
+
/* Try to flatten subqueries in the FROM clause up into the main query
*/
#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
for(i=0; !p->pPrior && i<pTabList->nSrc; i++){
struct SrcList_item *pItem = &pTabList->a[i];
Select *pSub = pItem->pSelect;
- int isAggSub;
Table *pTab = pItem->pTab;
if( pSub==0 ) continue;
@@ -121616,13 +122898,36 @@ SQLITE_PRIVATE int sqlite3Select(
goto select_end;
}
- isAggSub = (pSub->selFlags & SF_Aggregate)!=0;
- if( flattenSubquery(pParse, p, i, isAgg, isAggSub) ){
+ /* Do not try to flatten an aggregate subquery.
+ **
+ ** Flattening an aggregate subquery is only possible if the outer query
+ ** is not a join. But if the outer query is not a join, then the subquery
+ ** will be implemented as a co-routine and there is no advantage to
+ ** flattening in that case.
+ */
+ if( (pSub->selFlags & SF_Aggregate)!=0 ) continue;
+ assert( pSub->pGroupBy==0 );
+
+ /* If the subquery contains an ORDER BY clause and if
+ ** it will be implemented as a co-routine, then do not flatten. This
+ ** restriction allows SQL constructs like this:
+ **
+ ** SELECT expensive_function(x)
+ ** FROM (SELECT x FROM tab ORDER BY y LIMIT 10);
+ **
+ ** The expensive_function() is only computed on the 10 rows that
+ ** are output, rather than every row of the table.
+ */
+ if( pSub->pOrderBy!=0
+ && i==0
+ && (pTabList->nSrc==1
+ || (pTabList->a[1].fg.jointype&(JT_LEFT|JT_CROSS))!=0)
+ ){
+ continue;
+ }
+
+ if( flattenSubquery(pParse, p, i, isAgg) ){
/* This subquery can be absorbed into its parent. */
- if( isAggSub ){
- isAgg = 1;
- p->selFlags |= SF_Aggregate;
- }
i = -1;
}
pTabList = p->pSrc;
@@ -121633,11 +122938,6 @@ SQLITE_PRIVATE int sqlite3Select(
}
#endif
- /* Get a pointer the VDBE under construction, allocating a new VDBE if one
- ** does not already exist */
- v = sqlite3GetVdbe(pParse);
- if( v==0 ) goto select_end;
-
#ifndef SQLITE_OMIT_COMPOUND_SELECT
/* Handle compound SELECT statements using the separate multiSelect()
** procedure.
@@ -121661,10 +122961,14 @@ SQLITE_PRIVATE int sqlite3Select(
struct SrcList_item *pItem = &pTabList->a[i];
SelectDest dest;
Select *pSub;
+#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW)
+ const char *zSavedAuthContext;
+#endif
- /* Issue SQLITE_READ authorizations with a fake column name for any tables that
- ** are referenced but from which no values are extracted. Examples of where these
- ** kinds of null SQLITE_READ authorizations would occur:
+ /* Issue SQLITE_READ authorizations with a fake column name for any
+ ** tables that are referenced but from which no values are extracted.
+ ** Examples of where these kinds of null SQLITE_READ authorizations
+ ** would occur:
**
** SELECT count(*) FROM t1; -- SQLITE_READ t1.""
** SELECT t1.* FROM t1, t2; -- SQLITE_READ t2.""
@@ -121672,10 +122976,10 @@ SQLITE_PRIVATE int sqlite3Select(
** The fake column name is an empty string. It is possible for a table to
** have a column named by the empty string, in which case there is no way to
** distinguish between an unreferenced table and an actual reference to the
- ** "" column. The original design was for the fake column name to be a NULL,
+ ** "" column. The original design was for the fake column name to be a NULL,
** which would be unambiguous. But legacy authorization callbacks might
- ** assume the column name is non-NULL and segfault. The use of an empty string
- ** for the fake column name seems safer.
+ ** assume the column name is non-NULL and segfault. The use of an empty
+ ** string for the fake column name seems safer.
*/
if( pItem->colUsed==0 ){
sqlite3AuthCheck(pParse, SQLITE_READ, pItem->zName, "", pItem->zDatabase);
@@ -121727,16 +123031,14 @@ SQLITE_PRIVATE int sqlite3Select(
#endif
}
+ zSavedAuthContext = pParse->zAuthContext;
+ pParse->zAuthContext = pItem->zName;
+
/* Generate code to implement the subquery
**
- ** The subquery is implemented as a co-routine if all of these are true:
- ** (1) The subquery is guaranteed to be the outer loop (so that it
- ** does not need to be computed more than once)
- ** (2) The ALL keyword after SELECT is omitted. (Applications are
- ** allowed to say "SELECT ALL" instead of just "SELECT" to disable
- ** the use of co-routines.)
- ** (3) Co-routines are not disabled using sqlite3_test_control()
- ** with SQLITE_TESTCTRL_OPTIMIZATIONS.
+ ** The subquery is implemented as a co-routine if the subquery is
+ ** guaranteed to be the outer loop (so that it does not need to be
+ ** computed more than once)
**
** TODO: Are there other reasons beside (1) to use a co-routine
** implementation?
@@ -121744,13 +123046,12 @@ SQLITE_PRIVATE int sqlite3Select(
if( i==0
&& (pTabList->nSrc==1
|| (pTabList->a[1].fg.jointype&(JT_LEFT|JT_CROSS))!=0) /* (1) */
- && (p->selFlags & SF_All)==0 /* (2) */
- && OptimizationEnabled(db, SQLITE_SubqCoroutine) /* (3) */
){
/* Implement a co-routine that will return a single row of the result
** set on each invocation.
*/
int addrTop = sqlite3VdbeCurrentAddr(v)+1;
+
pItem->regReturn = ++pParse->nMem;
sqlite3VdbeAddOp3(v, OP_InitCoroutine, pItem->regReturn, 0, addrTop);
VdbeComment((v, "%s", pItem->pTab->zName));
@@ -121791,6 +123092,9 @@ SQLITE_PRIVATE int sqlite3Select(
pPrior = isSelfJoinView(pTabList, pItem);
if( pPrior ){
sqlite3VdbeAddOp2(v, OP_OpenDup, pItem->iCursor, pPrior->iCursor);
+ explainSetInteger(pItem->iSelectId, pPrior->iSelectId);
+ assert( pPrior->pSelect!=0 );
+ pSub->nSelectRow = pPrior->pSelect->nSelectRow;
}else{
sqlite3SelectDestInit(&dest, SRT_EphemTab, pItem->iCursor);
explainSetInteger(pItem->iSelectId, (u8)pParse->iNextSelectId);
@@ -121805,6 +123109,7 @@ SQLITE_PRIVATE int sqlite3Select(
}
if( db->mallocFailed ) goto select_end;
pParse->nHeight -= sqlite3SelectExprHeight(p);
+ pParse->zAuthContext = zSavedAuthContext;
#endif
}
@@ -121823,6 +123128,16 @@ SQLITE_PRIVATE int sqlite3Select(
}
#endif
+#ifdef SQLITE_COUNTOFVIEW_OPTIMIZATION
+ if( OptimizationEnabled(db, SQLITE_QueryFlattener|SQLITE_CountOfView)
+ && countOfViewOptimization(pParse, p)
+ ){
+ if( db->mallocFailed ) goto select_end;
+ pEList = p->pEList;
+ pTabList = p->pSrc;
+ }
+#endif
+
/* If the query is DISTINCT with an ORDER BY but is not an aggregate, and
** if the select-list is the same as the ORDER BY list, then this query
** can be rewritten as a GROUP BY. In other words, this:
@@ -121942,7 +123257,8 @@ SQLITE_PRIVATE int sqlite3Select(
}
/* Use the standard inner loop. */
- selectInnerLoop(pParse, p, pEList, -1, &sSort, &sDistinct, pDest,
+ assert( p->pEList==pEList );
+ selectInnerLoop(pParse, p, -1, &sSort, &sDistinct, pDest,
sqlite3WhereContinueLabel(pWInfo),
sqlite3WhereBreakLabel(pWInfo));
@@ -122245,7 +123561,7 @@ SQLITE_PRIVATE int sqlite3Select(
sqlite3VdbeAddOp1(v, OP_Return, regOutputRow);
finalizeAggFunctions(pParse, &sAggInfo);
sqlite3ExprIfFalse(pParse, pHaving, addrOutputRow+1, SQLITE_JUMPIFNULL);
- selectInnerLoop(pParse, p, p->pEList, -1, &sSort,
+ selectInnerLoop(pParse, p, -1, &sSort,
&sDistinct, pDest,
addrOutputRow+1, addrSetAbort);
sqlite3VdbeAddOp1(v, OP_Return, regOutputRow);
@@ -122389,7 +123705,7 @@ SQLITE_PRIVATE int sqlite3Select(
sSort.pOrderBy = 0;
sqlite3ExprIfFalse(pParse, pHaving, addrEnd, SQLITE_JUMPIFNULL);
- selectInnerLoop(pParse, p, p->pEList, -1, 0, 0,
+ selectInnerLoop(pParse, p, -1, 0, 0,
pDest, addrEnd, addrEnd);
sqlite3ExprListDelete(db, pDel);
}
@@ -122424,12 +123740,6 @@ SQLITE_PRIVATE int sqlite3Select(
select_end:
explainSetInteger(pParse->iSelectId, iRestoreSelectId);
- /* Identify column names if results of the SELECT are to be output.
- */
- if( rc==SQLITE_OK && pDest->eDest==SRT_Output ){
- generateColumnNames(pParse, pTabList, pEList);
- }
-
sqlite3DbFree(db, sAggInfo.aCol);
sqlite3DbFree(db, sAggInfo.aFunc);
#if SELECTTRACE_ENABLED
@@ -122950,6 +124260,7 @@ SQLITE_PRIVATE void sqlite3FinishTrigger(
if( v==0 ) goto triggerfinish_cleanup;
sqlite3BeginWriteOperation(pParse, 0, iDb);
z = sqlite3DbStrNDup(db, (char*)pAll->z, pAll->n);
+ testcase( z==0 );
sqlite3NestedParse(pParse,
"INSERT INTO %Q.%s VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')",
db->aDb[iDb].zDbSName, MASTER_NAME, zName,
@@ -123228,7 +124539,7 @@ SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTrigger(sqlite3 *db, int iDb, const ch
*pp = (*pp)->pNext;
}
sqlite3DeleteTrigger(db, pTrigger);
- db->flags |= SQLITE_InternChanges;
+ db->mDbFlags |= DBFLAG_SchemaChange;
}
}
@@ -124549,12 +125860,6 @@ static void updateVirtualTable(
if( pWInfo==0 ) return;
/* Populate the argument registers. */
- sqlite3VdbeAddOp2(v, OP_Rowid, iCsr, regArg);
- if( pRowid ){
- sqlite3ExprCode(pParse, pRowid, regArg+1);
- }else{
- sqlite3VdbeAddOp2(v, OP_Rowid, iCsr, regArg+1);
- }
for(i=0; i<pTab->nCol; i++){
if( aXRef[i]>=0 ){
sqlite3ExprCode(pParse, pChanges->a[aXRef[i]].pExpr, regArg+2+i);
@@ -124562,6 +125867,23 @@ static void updateVirtualTable(
sqlite3VdbeAddOp3(v, OP_VColumn, iCsr, i, regArg+2+i);
}
}
+ if( HasRowid(pTab) ){
+ sqlite3VdbeAddOp2(v, OP_Rowid, iCsr, regArg);
+ if( pRowid ){
+ sqlite3ExprCode(pParse, pRowid, regArg+1);
+ }else{
+ sqlite3VdbeAddOp2(v, OP_Rowid, iCsr, regArg+1);
+ }
+ }else{
+ Index *pPk; /* PRIMARY KEY index */
+ i16 iPk; /* PRIMARY KEY column */
+ pPk = sqlite3PrimaryKeyIndex(pTab);
+ assert( pPk!=0 );
+ assert( pPk->nKeyCol==1 );
+ iPk = pPk->aiColumn[0];
+ sqlite3VdbeAddOp3(v, OP_VColumn, iCsr, iPk, regArg);
+ sqlite3VdbeAddOp2(v, OP_SCopy, regArg+2+iPk, regArg+1);
+ }
bOnePass = sqlite3WhereOkOnePass(pWInfo, aDummy);
@@ -124746,7 +126068,8 @@ SQLITE_PRIVATE int sqlite3RunVacuum(char **pzErrMsg, sqlite3 *db, int iDb){
int rc = SQLITE_OK; /* Return code from service routines */
Btree *pMain; /* The database being vacuumed */
Btree *pTemp; /* The temporary database we vacuum into */
- int saved_flags; /* Saved value of the db->flags */
+ u16 saved_mDbFlags; /* Saved value of db->mDbFlags */
+ u32 saved_flags; /* Saved value of db->flags */
int saved_nChange; /* Saved value of db->nChange */
int saved_nTotalChange; /* Saved value of db->nTotalChange */
u8 saved_mTrace; /* Saved trace settings */
@@ -124769,11 +126092,12 @@ SQLITE_PRIVATE int sqlite3RunVacuum(char **pzErrMsg, sqlite3 *db, int iDb){
** restored before returning. Then set the writable-schema flag, and
** disable CHECK and foreign key constraints. */
saved_flags = db->flags;
+ saved_mDbFlags = db->mDbFlags;
saved_nChange = db->nChange;
saved_nTotalChange = db->nTotalChange;
saved_mTrace = db->mTrace;
- db->flags |= (SQLITE_WriteSchema | SQLITE_IgnoreChecks
- | SQLITE_PreferBuiltin | SQLITE_Vacuum);
+ db->flags |= SQLITE_WriteSchema | SQLITE_IgnoreChecks;
+ db->mDbFlags |= DBFLAG_PreferBuiltin | DBFLAG_Vacuum;
db->flags &= ~(SQLITE_ForeignKeys | SQLITE_ReverseOrder | SQLITE_CountRows);
db->mTrace = 0;
@@ -124817,7 +126141,7 @@ SQLITE_PRIVATE int sqlite3RunVacuum(char **pzErrMsg, sqlite3 *db, int iDb){
extern void sqlite3CodecGetKey(sqlite3*, int, void**, int*);
int nKey;
char *zKey;
- sqlite3CodecGetKey(db, 0, (void**)&zKey, &nKey);
+ sqlite3CodecGetKey(db, iDb, (void**)&zKey, &nKey);
if( nKey ) db->nextPagesize = 0;
}
#endif
@@ -124884,8 +126208,8 @@ SQLITE_PRIVATE int sqlite3RunVacuum(char **pzErrMsg, sqlite3 *db, int iDb){
"WHERE type='table'AND coalesce(rootpage,1)>0",
zDbMain
);
- assert( (db->flags & SQLITE_Vacuum)!=0 );
- db->flags &= ~SQLITE_Vacuum;
+ assert( (db->mDbFlags & DBFLAG_Vacuum)!=0 );
+ db->mDbFlags &= ~DBFLAG_Vacuum;
if( rc!=SQLITE_OK ) goto end_of_vacuum;
/* Copy the triggers, views, and virtual tables from the main database
@@ -124953,6 +126277,7 @@ SQLITE_PRIVATE int sqlite3RunVacuum(char **pzErrMsg, sqlite3 *db, int iDb){
end_of_vacuum:
/* Restore the original value of db->flags */
db->init.iDb = 0;
+ db->mDbFlags = saved_mDbFlags;
db->flags = saved_flags;
db->nChange = saved_nChange;
db->nTotalChange = saved_nTotalChange;
@@ -125029,8 +126354,10 @@ SQLITE_PRIVATE Module *sqlite3VtabCreateModule(
){
Module *pMod;
int nName = sqlite3Strlen30(zName);
- pMod = (Module *)sqlite3DbMallocRawNN(db, sizeof(Module) + nName + 1);
- if( pMod ){
+ pMod = (Module *)sqlite3Malloc(sizeof(Module) + nName + 1);
+ if( pMod==0 ){
+ sqlite3OomFault(db);
+ }else{
Module *pDel;
char *zCopy = (char *)(&pMod[1]);
memcpy(zCopy, zName, nName+1);
@@ -125505,13 +126832,14 @@ static int vtabCallConstructor(
}
}
- zModuleName = sqlite3MPrintf(db, "%s", pTab->zName);
+ zModuleName = sqlite3DbStrDup(db, pTab->zName);
if( !zModuleName ){
return SQLITE_NOMEM_BKPT;
}
- pVTable = sqlite3DbMallocZero(db, sizeof(VTable));
+ pVTable = sqlite3MallocZero(sizeof(VTable));
if( !pVTable ){
+ sqlite3OomFault(db);
sqlite3DbFree(db, zModuleName);
return SQLITE_NOMEM_BKPT;
}
@@ -125631,6 +126959,7 @@ SQLITE_PRIVATE int sqlite3VtabCallConnect(Parse *pParse, Table *pTab){
rc = vtabCallConstructor(db, pTab, pMod, pMod->pModule->xConnect, &zErr);
if( rc!=SQLITE_OK ){
sqlite3ErrorMsg(pParse, "%s", zErr);
+ pParse->rc = rc;
}
sqlite3DbFree(db, zErr);
}
@@ -125720,10 +127049,10 @@ SQLITE_PRIVATE int sqlite3VtabCallCreate(sqlite3 *db, int iDb, const char *zTab,
*/
SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){
VtabCtx *pCtx;
- Parse *pParse;
int rc = SQLITE_OK;
Table *pTab;
char *zErr = 0;
+ Parse sParse;
#ifdef SQLITE_ENABLE_API_ARMOR
if( !sqlite3SafetyCheckOk(db) || zCreateTable==0 ){
@@ -125740,55 +127069,55 @@ SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){
pTab = pCtx->pTab;
assert( IsVirtual(pTab) );
- pParse = sqlite3StackAllocZero(db, sizeof(*pParse));
- if( pParse==0 ){
- rc = SQLITE_NOMEM_BKPT;
- }else{
- pParse->declareVtab = 1;
- pParse->db = db;
- pParse->nQueryLoop = 1;
-
- if( SQLITE_OK==sqlite3RunParser(pParse, zCreateTable, &zErr)
- && pParse->pNewTable
- && !db->mallocFailed
- && !pParse->pNewTable->pSelect
- && !IsVirtual(pParse->pNewTable)
- ){
- if( !pTab->aCol ){
- Table *pNew = pParse->pNewTable;
- Index *pIdx;
- pTab->aCol = pNew->aCol;
- pTab->nCol = pNew->nCol;
- pTab->tabFlags |= pNew->tabFlags & (TF_WithoutRowid|TF_NoVisibleRowid);
- pNew->nCol = 0;
- pNew->aCol = 0;
- assert( pTab->pIndex==0 );
- if( !HasRowid(pNew) && pCtx->pVTable->pMod->pModule->xUpdate!=0 ){
- rc = SQLITE_ERROR;
- }
- pIdx = pNew->pIndex;
- if( pIdx ){
- assert( pIdx->pNext==0 );
- pTab->pIndex = pIdx;
- pNew->pIndex = 0;
- pIdx->pTable = pTab;
- }
+ memset(&sParse, 0, sizeof(sParse));
+ sParse.declareVtab = 1;
+ sParse.db = db;
+ sParse.nQueryLoop = 1;
+ if( SQLITE_OK==sqlite3RunParser(&sParse, zCreateTable, &zErr)
+ && sParse.pNewTable
+ && !db->mallocFailed
+ && !sParse.pNewTable->pSelect
+ && !IsVirtual(sParse.pNewTable)
+ ){
+ if( !pTab->aCol ){
+ Table *pNew = sParse.pNewTable;
+ Index *pIdx;
+ pTab->aCol = pNew->aCol;
+ pTab->nCol = pNew->nCol;
+ pTab->tabFlags |= pNew->tabFlags & (TF_WithoutRowid|TF_NoVisibleRowid);
+ pNew->nCol = 0;
+ pNew->aCol = 0;
+ assert( pTab->pIndex==0 );
+ assert( HasRowid(pNew) || sqlite3PrimaryKeyIndex(pNew)!=0 );
+ if( !HasRowid(pNew)
+ && pCtx->pVTable->pMod->pModule->xUpdate!=0
+ && sqlite3PrimaryKeyIndex(pNew)->nKeyCol!=1
+ ){
+ /* WITHOUT ROWID virtual tables must either be read-only (xUpdate==0)
+ ** or else must have a single-column PRIMARY KEY */
+ rc = SQLITE_ERROR;
+ }
+ pIdx = pNew->pIndex;
+ if( pIdx ){
+ assert( pIdx->pNext==0 );
+ pTab->pIndex = pIdx;
+ pNew->pIndex = 0;
+ pIdx->pTable = pTab;
}
- pCtx->bDeclared = 1;
- }else{
- sqlite3ErrorWithMsg(db, SQLITE_ERROR, (zErr ? "%s" : 0), zErr);
- sqlite3DbFree(db, zErr);
- rc = SQLITE_ERROR;
- }
- pParse->declareVtab = 0;
-
- if( pParse->pVdbe ){
- sqlite3VdbeFinalize(pParse->pVdbe);
}
- sqlite3DeleteTable(db, pParse->pNewTable);
- sqlite3ParserReset(pParse);
- sqlite3StackFree(db, pParse);
+ pCtx->bDeclared = 1;
+ }else{
+ sqlite3ErrorWithMsg(db, SQLITE_ERROR, (zErr ? "%s" : 0), zErr);
+ sqlite3DbFree(db, zErr);
+ rc = SQLITE_ERROR;
}
+ sParse.declareVtab = 0;
+
+ if( sParse.pVdbe ){
+ sqlite3VdbeFinalize(sParse.pVdbe);
+ }
+ sqlite3DeleteTable(db, sParse.pNewTable);
+ sqlite3ParserReset(&sParse);
assert( (rc&0xff)==rc );
rc = sqlite3ApiExit(db, rc);
@@ -126535,6 +127864,7 @@ struct WhereTerm {
#define TERM_LIKECOND 0x200 /* Conditionally this LIKE operator term */
#define TERM_LIKE 0x400 /* The original LIKE operator */
#define TERM_IS 0x800 /* Term.pExpr is an IS operator */
+#define TERM_VARSELECT 0x1000 /* Term.pExpr contains a correlated sub-query */
/*
** An instance of the WhereScan object is used as an iterator for locating
@@ -126624,6 +127954,7 @@ struct WhereAndInfo {
** no gaps.
*/
struct WhereMaskSet {
+ int bVarSelect; /* Used by sqlite3WhereExprUsage() */
int n; /* Number of assigned cursor values */
int ix[BMS]; /* Cursor assigned to each bit */
};
@@ -126764,7 +128095,6 @@ SQLITE_PRIVATE void sqlite3WhereTabFuncArgs(Parse*, struct SrcList_item*, WhereC
** WO_LE == SQLITE_INDEX_CONSTRAINT_LE
** WO_GT == SQLITE_INDEX_CONSTRAINT_GT
** WO_GE == SQLITE_INDEX_CONSTRAINT_GE
-** WO_MATCH == SQLITE_INDEX_CONSTRAINT_MATCH
*/
#define WO_IN 0x0001
#define WO_EQ 0x0002
@@ -126772,7 +128102,7 @@ SQLITE_PRIVATE void sqlite3WhereTabFuncArgs(Parse*, struct SrcList_item*, WhereC
#define WO_LE (WO_EQ<<(TK_LE-TK_EQ))
#define WO_GT (WO_EQ<<(TK_GT-TK_EQ))
#define WO_GE (WO_EQ<<(TK_GE-TK_EQ))
-#define WO_MATCH 0x0040
+#define WO_AUX 0x0040 /* Op useful to virtual tables only */
#define WO_IS 0x0080
#define WO_ISNULL 0x0100
#define WO_OR 0x0200 /* Two or more OR-connected terms */
@@ -127585,7 +128915,7 @@ static int codeCursorHintIsOrFunction(Walker *pWalker, Expr *pExpr){
pWalker->eCode = 1;
}else if( pExpr->op==TK_FUNCTION ){
int d1;
- char d2[3];
+ char d2[4];
if( 0==sqlite3IsLikeFunction(pWalker->pParse->db, pExpr, &d1, d2) ){
pWalker->eCode = 1;
}
@@ -127757,10 +129087,10 @@ static void codeCursorHint(
**
** Normally, this is just:
**
-** OP_Seek $iCur $iRowid
+** OP_DeferredSeek $iCur $iRowid
**
** However, if the scan currently being coded is a branch of an OR-loop and
-** the statement currently being coded is a SELECT, then P3 of the OP_Seek
+** the statement currently being coded is a SELECT, then P3 of OP_DeferredSeek
** is set to iIdxCur and P4 is set to point to an array of integers
** containing one entry for each column of the table cursor iCur is open
** on. For each table column, if the column is the i'th column of the
@@ -127779,7 +129109,7 @@ static void codeDeferredSeek(
assert( iIdxCur>0 );
assert( pIdx->aiColumn[pIdx->nColumn-1]==-1 );
- sqlite3VdbeAddOp3(v, OP_Seek, iIdxCur, 0, iCur);
+ sqlite3VdbeAddOp3(v, OP_DeferredSeek, iIdxCur, 0, iCur);
if( (pWInfo->wctrlFlags & WHERE_OR_SUBCLAUSE)
&& DbMaskAllZero(sqlite3ParseToplevel(pParse)->writeMask)
){
@@ -127808,7 +129138,7 @@ static void codeDeferredSeek(
*/
static void codeExprOrVector(Parse *pParse, Expr *p, int iReg, int nReg){
assert( nReg>0 );
- if( sqlite3ExprIsVector(p) ){
+ if( p && sqlite3ExprIsVector(p) ){
#ifndef SQLITE_OMIT_SUBQUERY
if( (p->flags & EP_xIsSelect) ){
Vdbe *v = pParse->pVdbe;
@@ -127849,7 +129179,7 @@ typedef struct IdxExprTrans {
*/
static int whereIndexExprTransNode(Walker *p, Expr *pExpr){
IdxExprTrans *pX = p->u.pIdxTrans;
- if( sqlite3ExprCompare(pExpr, pX->pIdxExpr, pX->iTabCur)==0 ){
+ if( sqlite3ExprCompare(0, pExpr, pX->pIdxExpr, pX->iTabCur)==0 ){
pExpr->op = TK_COLUMN;
pExpr->iTable = pX->iIdxCur;
pExpr->iColumn = pX->iIdxCol;
@@ -127861,9 +129191,9 @@ static int whereIndexExprTransNode(Walker *p, Expr *pExpr){
}
/*
-** For an indexes on expression X, locate every instance of expression X in pExpr
-** and change that subexpression into a reference to the appropriate column of
-** the index.
+** For an indexes on expression X, locate every instance of expression X
+** in pExpr and change that subexpression into a reference to the appropriate
+** column of the index.
*/
static void whereIndexExprTrans(
Index *pIdx, /* The Index */
@@ -127921,7 +129251,7 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
int iRowidReg = 0; /* Rowid is stored in this register, if not zero */
int iReleaseReg = 0; /* Temp register to free before returning */
Index *pIdx = 0; /* Index used by loop (if any) */
- int loopAgain; /* True if constraint generator loop should repeat */
+ int iLoop; /* Iteration of constraint generator loop */
pParse = pWInfo->pParse;
v = pParse->pVdbe;
@@ -128816,13 +130146,20 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
/* Insert code to test every subexpression that can be completely
** computed using the current set of tables.
**
- ** This loop may run either once (pIdx==0) or twice (pIdx!=0). If
- ** it is run twice, then the first iteration codes those sub-expressions
- ** that can be computed using columns from pIdx only (without seeking
- ** the main table cursor).
+ ** This loop may run between one and three times, depending on the
+ ** constraints to be generated. The value of stack variable iLoop
+ ** determines the constraints coded by each iteration, as follows:
+ **
+ ** iLoop==1: Code only expressions that are entirely covered by pIdx.
+ ** iLoop==2: Code remaining expressions that do not contain correlated
+ ** sub-queries.
+ ** iLoop==3: Code all remaining expressions.
+ **
+ ** An effort is made to skip unnecessary iterations of the loop.
*/
+ iLoop = (pIdx ? 1 : 2);
do{
- loopAgain = 0;
+ int iNext = 0; /* Next value for iLoop */
for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){
Expr *pE;
int skipLikeAddr = 0;
@@ -128840,10 +130177,16 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
if( pLevel->iLeftJoin && !ExprHasProperty(pE, EP_FromJoin) ){
continue;
}
- if( pIdx && !sqlite3ExprCoveredByIndex(pE, pLevel->iTabCur, pIdx) ){
- loopAgain = 1;
+
+ if( iLoop==1 && !sqlite3ExprCoveredByIndex(pE, pLevel->iTabCur, pIdx) ){
+ iNext = 2;
continue;
}
+ if( iLoop<3 && (pTerm->wtFlags & TERM_VARSELECT) ){
+ if( iNext==0 ) iNext = 3;
+ continue;
+ }
+
if( pTerm->wtFlags & TERM_LIKECOND ){
/* If the TERM_LIKECOND flag is set, that means that the range search
** is sufficient to guarantee that the LIKE operator is true, so we
@@ -128859,12 +130202,18 @@ SQLITE_PRIVATE Bitmask sqlite3WhereCodeOneLoopStart(
VdbeCoverage(v);
#endif
}
+#ifdef WHERETRACE_ENABLED /* 0xffff */
+ if( sqlite3WhereTrace ){
+ VdbeNoopComment((v, "WhereTerm[%d] (%p) priority=%d",
+ pWC->nTerm-j, pTerm, iLoop));
+ }
+#endif
sqlite3ExprIfFalse(pParse, pE, addrCont, SQLITE_JUMPIFNULL);
if( skipLikeAddr ) sqlite3VdbeJumpHere(v, skipLikeAddr);
pTerm->wtFlags |= TERM_CODED;
}
- pIdx = 0;
- }while( loopAgain );
+ iLoop = iNext;
+ }while( iLoop>0 );
/* Insert code to test for implied constraints based on transitivity
** of the "==" operator.
@@ -129121,12 +130470,12 @@ static int isLikeOrGlob(
int *pisComplete, /* True if the only wildcard is % in the last character */
int *pnoCase /* True if uppercase is equivalent to lowercase */
){
- const char *z = 0; /* String on RHS of LIKE operator */
+ const u8 *z = 0; /* String on RHS of LIKE operator */
Expr *pRight, *pLeft; /* Right and left size of LIKE operator */
ExprList *pList; /* List of operands to the LIKE operator */
int c; /* One character in z[] */
int cnt; /* Number of non-wildcard prefix characters */
- char wc[3]; /* Wildcard characters */
+ char wc[4]; /* Wildcard characters */
sqlite3 *db = pParse->db; /* Database connection */
sqlite3_value *pVal = 0;
int op; /* Opcode of pRight */
@@ -129143,17 +130492,17 @@ static int isLikeOrGlob(
pRight = sqlite3ExprSkipCollate(pList->a[0].pExpr);
op = pRight->op;
- if( op==TK_VARIABLE ){
+ if( op==TK_VARIABLE && (db->flags & SQLITE_EnableQPSG)==0 ){
Vdbe *pReprepare = pParse->pReprepare;
int iCol = pRight->iColumn;
pVal = sqlite3VdbeGetBoundValue(pReprepare, iCol, SQLITE_AFF_BLOB);
if( pVal && sqlite3_value_type(pVal)==SQLITE_TEXT ){
- z = (char *)sqlite3_value_text(pVal);
+ z = sqlite3_value_text(pVal);
}
sqlite3VdbeSetVarmask(pParse->pVdbe, iCol);
assert( pRight->op==TK_VARIABLE || pRight->op==TK_REGISTER );
}else if( op==TK_STRING ){
- z = pRight->u.zToken;
+ z = (u8*)pRight->u.zToken;
}
if( z ){
@@ -129173,16 +130522,42 @@ static int isLikeOrGlob(
return 0;
}
}
+
+ /* Count the number of prefix characters prior to the first wildcard */
cnt = 0;
while( (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){
cnt++;
+ if( c==wc[3] && z[cnt]!=0 ) cnt++;
}
+
+ /* The optimization is possible only if (1) the pattern does not begin
+ ** with a wildcard and if (2) the non-wildcard prefix does not end with
+ ** an (illegal 0xff) character. The second condition is necessary so
+ ** that we can increment the prefix key to find an upper bound for the
+ ** range search.
+ */
if( cnt!=0 && 255!=(u8)z[cnt-1] ){
Expr *pPrefix;
+
+ /* A "complete" match if the pattern ends with "*" or "%" */
*pisComplete = c==wc[0] && z[cnt+1]==0;
- pPrefix = sqlite3Expr(db, TK_STRING, z);
- if( pPrefix ) pPrefix->u.zToken[cnt] = 0;
+
+ /* Get the pattern prefix. Remove all escapes from the prefix. */
+ pPrefix = sqlite3Expr(db, TK_STRING, (char*)z);
+ if( pPrefix ){
+ int iFrom, iTo;
+ char *zNew = pPrefix->u.zToken;
+ zNew[cnt] = 0;
+ for(iFrom=iTo=0; iFrom<cnt; iFrom++){
+ if( zNew[iFrom]==wc[3] ) iFrom++;
+ zNew[iTo++] = zNew[iFrom];
+ }
+ zNew[iTo] = 0;
+ }
*ppPrefix = pPrefix;
+
+ /* If the RHS pattern is a bound parameter, make arrangements to
+ ** reprepare the statement when that parameter is rebound */
if( op==TK_VARIABLE ){
Vdbe *v = pParse->pVdbe;
sqlite3VdbeSetVarmask(v, pRight->iColumn);
@@ -129213,48 +130588,84 @@ static int isLikeOrGlob(
#ifndef SQLITE_OMIT_VIRTUALTABLE
/*
-** Check to see if the given expression is of the form
-**
-** column OP expr
-**
-** where OP is one of MATCH, GLOB, LIKE or REGEXP and "column" is a
-** column of a virtual table.
-**
-** If it is then return TRUE. If not, return FALSE.
-*/
-static int isMatchOfColumn(
+** Check to see if the pExpr expression is a form that needs to be passed
+** to the xBestIndex method of virtual tables. Forms of interest include:
+**
+** Expression Virtual Table Operator
+** ----------------------- ---------------------------------
+** 1. column MATCH expr SQLITE_INDEX_CONSTRAINT_MATCH
+** 2. column GLOB expr SQLITE_INDEX_CONSTRAINT_GLOB
+** 3. column LIKE expr SQLITE_INDEX_CONSTRAINT_LIKE
+** 4. column REGEXP expr SQLITE_INDEX_CONSTRAINT_REGEXP
+** 5. column != expr SQLITE_INDEX_CONSTRAINT_NE
+** 6. expr != column SQLITE_INDEX_CONSTRAINT_NE
+** 7. column IS NOT expr SQLITE_INDEX_CONSTRAINT_ISNOT
+** 8. expr IS NOT column SQLITE_INDEX_CONSTRAINT_ISNOT
+** 9. column IS NOT NULL SQLITE_INDEX_CONSTRAINT_ISNOTNULL
+**
+** In every case, "column" must be a column of a virtual table. If there
+** is a match, set *ppLeft to the "column" expression, set *ppRight to the
+** "expr" expression (even though in forms (6) and (8) the column is on the
+** right and the expression is on the left). Also set *peOp2 to the
+** appropriate virtual table operator. The return value is 1 or 2 if there
+** is a match. The usual return is 1, but if the RHS is also a column
+** of virtual table in forms (5) or (7) then return 2.
+**
+** If the expression matches none of the patterns above, return 0.
+*/
+static int isAuxiliaryVtabOperator(
Expr *pExpr, /* Test this expression */
- unsigned char *peOp2 /* OUT: 0 for MATCH, or else an op2 value */
-){
- static const struct Op2 {
- const char *zOp;
- unsigned char eOp2;
- } aOp[] = {
- { "match", SQLITE_INDEX_CONSTRAINT_MATCH },
- { "glob", SQLITE_INDEX_CONSTRAINT_GLOB },
- { "like", SQLITE_INDEX_CONSTRAINT_LIKE },
- { "regexp", SQLITE_INDEX_CONSTRAINT_REGEXP }
- };
- ExprList *pList;
- Expr *pCol; /* Column reference */
- int i;
+ unsigned char *peOp2, /* OUT: 0 for MATCH, or else an op2 value */
+ Expr **ppLeft, /* Column expression to left of MATCH/op2 */
+ Expr **ppRight /* Expression to left of MATCH/op2 */
+){
+ if( pExpr->op==TK_FUNCTION ){
+ static const struct Op2 {
+ const char *zOp;
+ unsigned char eOp2;
+ } aOp[] = {
+ { "match", SQLITE_INDEX_CONSTRAINT_MATCH },
+ { "glob", SQLITE_INDEX_CONSTRAINT_GLOB },
+ { "like", SQLITE_INDEX_CONSTRAINT_LIKE },
+ { "regexp", SQLITE_INDEX_CONSTRAINT_REGEXP }
+ };
+ ExprList *pList;
+ Expr *pCol; /* Column reference */
+ int i;
- if( pExpr->op!=TK_FUNCTION ){
- return 0;
- }
- pList = pExpr->x.pList;
- if( pList==0 || pList->nExpr!=2 ){
- return 0;
- }
- pCol = pList->a[1].pExpr;
- if( pCol->op!=TK_COLUMN || !IsVirtual(pCol->pTab) ){
- return 0;
- }
- for(i=0; i<ArraySize(aOp); i++){
- if( sqlite3StrICmp(pExpr->u.zToken, aOp[i].zOp)==0 ){
- *peOp2 = aOp[i].eOp2;
- return 1;
+ pList = pExpr->x.pList;
+ if( pList==0 || pList->nExpr!=2 ){
+ return 0;
+ }
+ pCol = pList->a[1].pExpr;
+ if( pCol->op!=TK_COLUMN || !IsVirtual(pCol->pTab) ){
+ return 0;
+ }
+ for(i=0; i<ArraySize(aOp); i++){
+ if( sqlite3StrICmp(pExpr->u.zToken, aOp[i].zOp)==0 ){
+ *peOp2 = aOp[i].eOp2;
+ *ppRight = pList->a[0].pExpr;
+ *ppLeft = pCol;
+ return 1;
+ }
+ }
+ }else if( pExpr->op==TK_NE || pExpr->op==TK_ISNOT || pExpr->op==TK_NOTNULL ){
+ int res = 0;
+ Expr *pLeft = pExpr->pLeft;
+ Expr *pRight = pExpr->pRight;
+ if( pLeft->op==TK_COLUMN && IsVirtual(pLeft->pTab) ){
+ res++;
}
+ if( pRight && pRight->op==TK_COLUMN && IsVirtual(pRight->pTab) ){
+ res++;
+ SWAP(Expr*, pLeft, pRight);
+ }
+ *ppLeft = pLeft;
+ *ppRight = pRight;
+ if( pExpr->op==TK_NE ) *peOp2 = SQLITE_INDEX_CONSTRAINT_NE;
+ if( pExpr->op==TK_ISNOT ) *peOp2 = SQLITE_INDEX_CONSTRAINT_ISNOT;
+ if( pExpr->op==TK_NOTNULL ) *peOp2 = SQLITE_INDEX_CONSTRAINT_ISNOTNULL;
+ return res;
}
return 0;
}
@@ -129333,8 +130744,8 @@ static void whereCombineDisjuncts(
&& (eOp & (WO_EQ|WO_GT|WO_GE))!=eOp ) return;
assert( pOne->pExpr->pLeft!=0 && pOne->pExpr->pRight!=0 );
assert( pTwo->pExpr->pLeft!=0 && pTwo->pExpr->pRight!=0 );
- if( sqlite3ExprCompare(pOne->pExpr->pLeft, pTwo->pExpr->pLeft, -1) ) return;
- if( sqlite3ExprCompare(pOne->pExpr->pRight, pTwo->pExpr->pRight, -1) )return;
+ if( sqlite3ExprCompare(0,pOne->pExpr->pLeft, pTwo->pExpr->pLeft, -1) ) return;
+ if( sqlite3ExprCompare(0,pOne->pExpr->pRight, pTwo->pExpr->pRight,-1) )return;
/* If we reach this point, it means the two subterms can be combined */
if( (eOp & (eOp-1))!=0 ){
if( eOp & (WO_LT|WO_LE) ){
@@ -129505,7 +130916,7 @@ static void exprAnalyzeOrTerm(
for(j=0, pAndTerm=pAndWC->a; j<pAndWC->nTerm; j++, pAndTerm++){
assert( pAndTerm->pExpr );
if( allowedOp(pAndTerm->pExpr->op)
- || pAndTerm->eOperator==WO_MATCH
+ || pAndTerm->eOperator==WO_AUX
){
b |= sqlite3WhereGetMask(&pWInfo->sMaskSet, pAndTerm->leftCursor);
}
@@ -129707,7 +131118,6 @@ static void exprAnalyzeOrTerm(
static int termIsEquivalence(Parse *pParse, Expr *pExpr){
char aff1, aff2;
CollSeq *pColl;
- const char *zColl1, *zColl2;
if( !OptimizationEnabled(pParse->db, SQLITE_Transitive) ) return 0;
if( pExpr->op!=TK_EQ && pExpr->op!=TK_IS ) return 0;
if( ExprHasProperty(pExpr, EP_FromJoin) ) return 0;
@@ -129720,11 +131130,7 @@ static int termIsEquivalence(Parse *pParse, Expr *pExpr){
}
pColl = sqlite3BinaryCompareCollSeq(pParse, pExpr->pLeft, pExpr->pRight);
if( pColl==0 || sqlite3StrICmp(pColl->zName, "BINARY")==0 ) return 1;
- pColl = sqlite3ExprCollSeq(pParse, pExpr->pLeft);
- zColl1 = pColl ? pColl->zName : 0;
- pColl = sqlite3ExprCollSeq(pParse, pExpr->pRight);
- zColl2 = pColl ? pColl->zName : 0;
- return sqlite3_stricmp(zColl1, zColl2)==0;
+ return sqlite3ExprCollSeqMatch(pParse, pExpr->pLeft, pExpr->pRight);
}
/*
@@ -129878,7 +131284,9 @@ static void exprAnalyze(
}else{
pTerm->prereqRight = sqlite3WhereExprUsage(pMaskSet, pExpr->pRight);
}
+ pMaskSet->bVarSelect = 0;
prereqAll = sqlite3WhereExprUsage(pMaskSet, pExpr);
+ if( pMaskSet->bVarSelect ) pTerm->wtFlags |= TERM_VARSELECT;
if( ExprHasProperty(pExpr, EP_FromJoin) ){
Bitmask x = sqlite3WhereGetMask(pMaskSet, pExpr->iRightJoinTable);
prereqAll |= x;
@@ -130085,38 +131493,46 @@ static void exprAnalyze(
#endif /* SQLITE_OMIT_LIKE_OPTIMIZATION */
#ifndef SQLITE_OMIT_VIRTUALTABLE
- /* Add a WO_MATCH auxiliary term to the constraint set if the
- ** current expression is of the form: column MATCH expr.
+ /* Add a WO_AUX auxiliary term to the constraint set if the
+ ** current expression is of the form "column OP expr" where OP
+ ** is an operator that gets passed into virtual tables but which is
+ ** not normally optimized for ordinary tables. In other words, OP
+ ** is one of MATCH, LIKE, GLOB, REGEXP, !=, IS, IS NOT, or NOT NULL.
** This information is used by the xBestIndex methods of
** virtual tables. The native query optimizer does not attempt
** to do anything with MATCH functions.
*/
- if( pWC->op==TK_AND && isMatchOfColumn(pExpr, &eOp2) ){
- int idxNew;
+ if( pWC->op==TK_AND ){
Expr *pRight, *pLeft;
- WhereTerm *pNewTerm;
- Bitmask prereqColumn, prereqExpr;
-
- pRight = pExpr->x.pList->a[0].pExpr;
- pLeft = pExpr->x.pList->a[1].pExpr;
- prereqExpr = sqlite3WhereExprUsage(pMaskSet, pRight);
- prereqColumn = sqlite3WhereExprUsage(pMaskSet, pLeft);
- if( (prereqExpr & prereqColumn)==0 ){
- Expr *pNewExpr;
- pNewExpr = sqlite3PExpr(pParse, TK_MATCH,
- 0, sqlite3ExprDup(db, pRight, 0));
- idxNew = whereClauseInsert(pWC, pNewExpr, TERM_VIRTUAL|TERM_DYNAMIC);
- testcase( idxNew==0 );
- pNewTerm = &pWC->a[idxNew];
- pNewTerm->prereqRight = prereqExpr;
- pNewTerm->leftCursor = pLeft->iTable;
- pNewTerm->u.leftColumn = pLeft->iColumn;
- pNewTerm->eOperator = WO_MATCH;
- pNewTerm->eMatchOp = eOp2;
- markTermAsChild(pWC, idxNew, idxTerm);
- pTerm = &pWC->a[idxTerm];
- pTerm->wtFlags |= TERM_COPIED;
- pNewTerm->prereqAll = pTerm->prereqAll;
+ int res = isAuxiliaryVtabOperator(pExpr, &eOp2, &pLeft, &pRight);
+ while( res-- > 0 ){
+ int idxNew;
+ WhereTerm *pNewTerm;
+ Bitmask prereqColumn, prereqExpr;
+
+ prereqExpr = sqlite3WhereExprUsage(pMaskSet, pRight);
+ prereqColumn = sqlite3WhereExprUsage(pMaskSet, pLeft);
+ if( (prereqExpr & prereqColumn)==0 ){
+ Expr *pNewExpr;
+ pNewExpr = sqlite3PExpr(pParse, TK_MATCH,
+ 0, sqlite3ExprDup(db, pRight, 0));
+ if( ExprHasProperty(pExpr, EP_FromJoin) && pNewExpr ){
+ ExprSetProperty(pNewExpr, EP_FromJoin);
+ }
+ idxNew = whereClauseInsert(pWC, pNewExpr, TERM_VIRTUAL|TERM_DYNAMIC);
+ testcase( idxNew==0 );
+ pNewTerm = &pWC->a[idxNew];
+ pNewTerm->prereqRight = prereqExpr;
+ pNewTerm->leftCursor = pLeft->iTable;
+ pNewTerm->u.leftColumn = pLeft->iColumn;
+ pNewTerm->eOperator = WO_AUX;
+ pNewTerm->eMatchOp = eOp2;
+ markTermAsChild(pWC, idxNew, idxTerm);
+ pTerm = &pWC->a[idxTerm];
+ pTerm->wtFlags |= TERM_COPIED;
+ pNewTerm->prereqAll = pTerm->prereqAll;
+ }
+ SWAP(Expr*, pLeft, pRight);
}
}
#endif /* SQLITE_OMIT_VIRTUALTABLE */
@@ -130306,9 +131722,12 @@ SQLITE_PRIVATE Bitmask sqlite3WhereExprUsage(WhereMaskSet *pMaskSet, Expr *p){
}
mask = (p->op==TK_IF_NULL_ROW) ? sqlite3WhereGetMask(pMaskSet, p->iTable) : 0;
assert( !ExprHasProperty(p, EP_TokenOnly) );
- if( p->pRight ) mask |= sqlite3WhereExprUsage(pMaskSet, p->pRight);
if( p->pLeft ) mask |= sqlite3WhereExprUsage(pMaskSet, p->pLeft);
- if( ExprHasProperty(p, EP_xIsSelect) ){
+ if( p->pRight ){
+ mask |= sqlite3WhereExprUsage(pMaskSet, p->pRight);
+ assert( p->x.pList==0 );
+ }else if( ExprHasProperty(p, EP_xIsSelect) ){
+ if( ExprHasProperty(p, EP_VarSelect) ) pMaskSet->bVarSelect = 1;
mask |= exprSelectUsage(pMaskSet, p->x.pSelect);
}else if( p->x.pList ){
mask |= sqlite3WhereExprListUsage(pMaskSet, p->x.pList);
@@ -130792,8 +132211,8 @@ static int findIndexCol(
&& p->iColumn==pIdx->aiColumn[iCol]
&& p->iTable==iBase
){
- CollSeq *pColl = sqlite3ExprCollSeq(pParse, pList->a[i].pExpr);
- if( pColl && 0==sqlite3StrICmp(pColl->zName, zColl) ){
+ CollSeq *pColl = sqlite3ExprNNCollSeq(pParse, pList->a[i].pExpr);
+ if( 0==sqlite3StrICmp(pColl->zName, zColl) ){
return i;
}
}
@@ -130997,6 +132416,15 @@ static int termCanDriveIndex(
char aff;
if( pTerm->leftCursor!=pSrc->iCursor ) return 0;
if( (pTerm->eOperator & (WO_EQ|WO_IS))==0 ) return 0;
+ if( (pSrc->fg.jointype & JT_LEFT)
+ && !ExprHasProperty(pTerm->pExpr, EP_FromJoin)
+ && (pTerm->eOperator & WO_IS)
+ ){
+ /* Cannot use an IS term from the WHERE clause as an index driver for
+ ** the RHS of a LEFT JOIN. Such a term can only be used if it is from
+ ** the ON clause. */
+ return 0;
+ }
if( (pTerm->prereqRight & notReady)!=0 ) return 0;
if( pTerm->u.leftColumn<0 ) return 0;
aff = pSrc->pTab->aCol[pTerm->u.leftColumn].affinity;
@@ -131248,7 +132676,7 @@ static sqlite3_index_info *allocateIndexInfo(
testcase( pTerm->eOperator & WO_ISNULL );
testcase( pTerm->eOperator & WO_IS );
testcase( pTerm->eOperator & WO_ALL );
- if( (pTerm->eOperator & ~(WO_ISNULL|WO_EQUIV|WO_IS))==0 ) continue;
+ if( (pTerm->eOperator & ~(WO_EQUIV))==0 ) continue;
if( pTerm->wtFlags & TERM_VNULL ) continue;
assert( pTerm->u.leftColumn>=(-1) );
nTerm++;
@@ -131296,7 +132724,7 @@ static sqlite3_index_info *allocateIndexInfo(
pUsage;
for(i=j=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){
- u8 op;
+ u16 op;
if( pTerm->leftCursor != pSrc->iCursor ) continue;
if( pTerm->prereqRight & mUnusable ) continue;
assert( IsPowerOfTwo(pTerm->eOperator & ~WO_EQUIV) );
@@ -131304,34 +132732,40 @@ static sqlite3_index_info *allocateIndexInfo(
testcase( pTerm->eOperator & WO_IS );
testcase( pTerm->eOperator & WO_ISNULL );
testcase( pTerm->eOperator & WO_ALL );
- if( (pTerm->eOperator & ~(WO_ISNULL|WO_EQUIV|WO_IS))==0 ) continue;
+ if( (pTerm->eOperator & ~(WO_EQUIV))==0 ) continue;
if( pTerm->wtFlags & TERM_VNULL ) continue;
assert( pTerm->u.leftColumn>=(-1) );
pIdxCons[j].iColumn = pTerm->u.leftColumn;
pIdxCons[j].iTermOffset = i;
- op = (u8)pTerm->eOperator & WO_ALL;
+ op = pTerm->eOperator & WO_ALL;
if( op==WO_IN ) op = WO_EQ;
- if( op==WO_MATCH ){
- op = pTerm->eMatchOp;
- }
- pIdxCons[j].op = op;
- /* The direct assignment in the previous line is possible only because
- ** the WO_ and SQLITE_INDEX_CONSTRAINT_ codes are identical. The
- ** following asserts verify this fact. */
- assert( WO_EQ==SQLITE_INDEX_CONSTRAINT_EQ );
- assert( WO_LT==SQLITE_INDEX_CONSTRAINT_LT );
- assert( WO_LE==SQLITE_INDEX_CONSTRAINT_LE );
- assert( WO_GT==SQLITE_INDEX_CONSTRAINT_GT );
- assert( WO_GE==SQLITE_INDEX_CONSTRAINT_GE );
- assert( WO_MATCH==SQLITE_INDEX_CONSTRAINT_MATCH );
- assert( pTerm->eOperator & (WO_IN|WO_EQ|WO_LT|WO_LE|WO_GT|WO_GE|WO_MATCH) );
-
- if( op & (WO_LT|WO_LE|WO_GT|WO_GE)
- && sqlite3ExprIsVector(pTerm->pExpr->pRight)
- ){
- if( i<16 ) mNoOmit |= (1 << i);
- if( op==WO_LT ) pIdxCons[j].op = WO_LE;
- if( op==WO_GT ) pIdxCons[j].op = WO_GE;
+ if( op==WO_AUX ){
+ pIdxCons[j].op = pTerm->eMatchOp;
+ }else if( op & (WO_ISNULL|WO_IS) ){
+ if( op==WO_ISNULL ){
+ pIdxCons[j].op = SQLITE_INDEX_CONSTRAINT_ISNULL;
+ }else{
+ pIdxCons[j].op = SQLITE_INDEX_CONSTRAINT_IS;
+ }
+ }else{
+ pIdxCons[j].op = (u8)op;
+ /* The direct assignment in the previous line is possible only because
+ ** the WO_ and SQLITE_INDEX_CONSTRAINT_ codes are identical. The
+ ** following asserts verify this fact. */
+ assert( WO_EQ==SQLITE_INDEX_CONSTRAINT_EQ );
+ assert( WO_LT==SQLITE_INDEX_CONSTRAINT_LT );
+ assert( WO_LE==SQLITE_INDEX_CONSTRAINT_LE );
+ assert( WO_GT==SQLITE_INDEX_CONSTRAINT_GT );
+ assert( WO_GE==SQLITE_INDEX_CONSTRAINT_GE );
+ assert( pTerm->eOperator&(WO_IN|WO_EQ|WO_LT|WO_LE|WO_GT|WO_GE|WO_AUX) );
+
+ if( op & (WO_LT|WO_LE|WO_GT|WO_GE)
+ && sqlite3ExprIsVector(pTerm->pExpr->pRight)
+ ){
+ if( i<16 ) mNoOmit |= (1 << i);
+ if( op==WO_LT ) pIdxCons[j].op = WO_LE;
+ if( op==WO_GT ) pIdxCons[j].op = WO_GE;
+ }
}
j++;
@@ -131581,7 +133015,7 @@ static int whereKeyStats(
iGap = iGap/3;
}
aStat[0] = iLower + iGap;
- aStat[1] = pIdx->aAvgEq[iCol];
+ aStat[1] = pIdx->aAvgEq[nField-1];
}
/* Restore the pRec->nField value before returning. */
@@ -132259,18 +133693,19 @@ static void whereInfoFree(sqlite3 *db, WhereInfo *pWInfo){
** Return TRUE if all of the following are true:
**
** (1) X has the same or lower cost that Y
-** (2) X is a proper subset of Y
-** (3) X skips at least as many columns as Y
-**
-** By "proper subset" we mean that X uses fewer WHERE clause terms
-** than Y and that every WHERE clause term used by X is also used
-** by Y.
+** (2) X uses fewer WHERE clause terms than Y
+** (3) Every WHERE clause term used by X is also used by Y
+** (4) X skips at least as many columns as Y
+** (5) If X is a covering index, than Y is too
**
+** Conditions (2) and (3) mean that X is a "proper subset" of Y.
** If X is a proper subset of Y then Y is a better choice and ought
** to have a lower cost. This routine returns TRUE when that cost
-** relationship is inverted and needs to be adjusted. The third rule
+** relationship is inverted and needs to be adjusted. Constraint (4)
** was added because if X uses skip-scan less than Y it still might
-** deserve a lower cost even if it is a proper subset of Y.
+** deserve a lower cost even if it is a proper subset of Y. Constraint (5)
+** was added because a covering index probably deserves to have a lower cost
+** than a non-covering index even if it is a proper subset.
*/
static int whereLoopCheaperProperSubset(
const WhereLoop *pX, /* First WhereLoop to compare */
@@ -132292,6 +133727,10 @@ static int whereLoopCheaperProperSubset(
}
if( j<0 ) return 0; /* X not a subset of Y since term X[i] not used by Y */
}
+ if( (pX->wsFlags&WHERE_IDX_ONLY)!=0
+ && (pY->wsFlags&WHERE_IDX_ONLY)==0 ){
+ return 0; /* Constraint (5) */
+ }
return 1; /* All conditions meet */
}
@@ -132334,16 +133773,17 @@ static void whereLoopAdjustCost(const WhereLoop *p, WhereLoop *pTemplate){
/*
** Search the list of WhereLoops in *ppPrev looking for one that can be
-** supplanted by pTemplate.
+** replaced by pTemplate.
**
-** Return NULL if the WhereLoop list contains an entry that can supplant
-** pTemplate, in other words if pTemplate does not belong on the list.
+** Return NULL if pTemplate does not belong on the WhereLoop list.
+** In other words if pTemplate ought to be dropped from further consideration.
**
-** If pX is a WhereLoop that pTemplate can supplant, then return the
+** If pX is a WhereLoop that pTemplate can replace, then return the
** link that points to pX.
**
-** If pTemplate cannot supplant any existing element of the list but needs
-** to be added to the list, then return a pointer to the tail of the list.
+** If pTemplate cannot replace any existing element of the list but needs
+** to be added to the list as a new entry, then return a pointer to the
+** tail of the list.
*/
static WhereLoop **whereLoopFindLesser(
WhereLoop **ppPrev,
@@ -132488,8 +133928,10 @@ static int whereLoopInsert(WhereLoopBuilder *pBuilder, WhereLoop *pTemplate){
if( p!=0 ){
sqlite3DebugPrintf("replace: ");
whereLoopPrint(p, pBuilder->pWC);
+ sqlite3DebugPrintf(" with: ");
+ }else{
+ sqlite3DebugPrintf(" add: ");
}
- sqlite3DebugPrintf(" add: ");
whereLoopPrint(pTemplate, pBuilder->pWC);
}
#endif
@@ -133040,7 +134482,7 @@ static int indexMightHelpWithOrderBy(
}else if( (aColExpr = pIndex->aColExpr)!=0 ){
for(jj=0; jj<pIndex->nKeyCol; jj++){
if( pIndex->aiColumn[jj]!=XN_EXPR ) continue;
- if( sqlite3ExprCompare(pExpr,aColExpr->a[jj].pExpr,iCursor)==0 ){
+ if( sqlite3ExprCompareSkip(pExpr,aColExpr->a[jj].pExpr,iCursor)==0 ){
return 1;
}
}
@@ -133073,14 +134515,16 @@ static Bitmask columnsInIndex(Index *pIdx){
static int whereUsablePartialIndex(int iTab, WhereClause *pWC, Expr *pWhere){
int i;
WhereTerm *pTerm;
+ Parse *pParse = pWC->pWInfo->pParse;
while( pWhere->op==TK_AND ){
if( !whereUsablePartialIndex(iTab,pWC,pWhere->pLeft) ) return 0;
pWhere = pWhere->pRight;
}
+ if( pParse->db->flags & SQLITE_EnableQPSG ) pParse = 0;
for(i=0, pTerm=pWC->a; i<pWC->nTerm; i++, pTerm++){
Expr *pExpr = pTerm->pExpr;
- if( sqlite3ExprImpliesExpr(pExpr, pWhere, iTab)
- && (!ExprHasProperty(pExpr, EP_FromJoin) || pExpr->iRightJoinTable==iTab)
+ if( (!ExprHasProperty(pExpr, EP_FromJoin) || pExpr->iRightJoinTable==iTab)
+ && sqlite3ExprImpliesExpr(pParse, pExpr, pWhere, iTab)
){
return 1;
}
@@ -133948,14 +135392,10 @@ static i8 wherePathSatisfiesOrderBy(
if( j>=pLoop->nLTerm ) continue;
}
if( (pTerm->eOperator&(WO_EQ|WO_IS))!=0 && pOBExpr->iColumn>=0 ){
- const char *z1, *z2;
- pColl = sqlite3ExprCollSeq(pWInfo->pParse, pOrderBy->a[i].pExpr);
- if( !pColl ) pColl = db->pDfltColl;
- z1 = pColl->zName;
- pColl = sqlite3ExprCollSeq(pWInfo->pParse, pTerm->pExpr);
- if( !pColl ) pColl = db->pDfltColl;
- z2 = pColl->zName;
- if( sqlite3StrICmp(z1, z2)!=0 ) continue;
+ if( sqlite3ExprCollSeqMatch(pWInfo->pParse,
+ pOrderBy->a[i].pExpr, pTerm->pExpr)==0 ){
+ continue;
+ }
testcase( pTerm->pExpr->op==TK_IS );
}
obSat |= MASKBIT(i);
@@ -134027,7 +135467,7 @@ static i8 wherePathSatisfiesOrderBy(
if( pIndex ){
iColumn = pIndex->aiColumn[j];
revIdx = pIndex->aSortOrder[j];
- if( iColumn==pIndex->pTable->iPKey ) iColumn = -1;
+ if( iColumn==pIndex->pTable->iPKey ) iColumn = XN_ROWID;
}else{
iColumn = XN_ROWID;
revIdx = 0;
@@ -134054,18 +135494,18 @@ static i8 wherePathSatisfiesOrderBy(
testcase( wctrlFlags & WHERE_GROUPBY );
testcase( wctrlFlags & WHERE_DISTINCTBY );
if( (wctrlFlags & (WHERE_GROUPBY|WHERE_DISTINCTBY))==0 ) bOnce = 0;
- if( iColumn>=(-1) ){
+ if( iColumn>=XN_ROWID ){
if( pOBExpr->op!=TK_COLUMN ) continue;
if( pOBExpr->iTable!=iCur ) continue;
if( pOBExpr->iColumn!=iColumn ) continue;
}else{
- if( sqlite3ExprCompare(pOBExpr,pIndex->aColExpr->a[j].pExpr,iCur) ){
+ Expr *pIdxExpr = pIndex->aColExpr->a[j].pExpr;
+ if( sqlite3ExprCompareSkip(pOBExpr, pIdxExpr, iCur) ){
continue;
}
}
- if( iColumn>=0 ){
- pColl = sqlite3ExprCollSeq(pWInfo->pParse, pOrderBy->a[i].pExpr);
- if( !pColl ) pColl = db->pDfltColl;
+ if( iColumn!=XN_ROWID ){
+ pColl = sqlite3ExprNNCollSeq(pWInfo->pParse, pOrderBy->a[i].pExpr);
if( sqlite3StrICmp(pColl->zName, pIndex->azColl[j])!=0 ) continue;
}
pLoop->u.btree.nIdxCol = j+1;
@@ -134358,6 +135798,7 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
rUnsorted, rCost));
}else{
rCost = rUnsorted;
+ rUnsorted -= 2; /* TUNING: Slight bias in favor of no-sort plans */
}
/* Check to see if pWLoop should be added to the set of
@@ -134389,8 +135830,8 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
** this candidate as not viable. */
#ifdef WHERETRACE_ENABLED /* 0x4 */
if( sqlite3WhereTrace&0x4 ){
- sqlite3DebugPrintf("Skip %s cost=%-3d,%3d order=%c\n",
- wherePathName(pFrom, iLoop, pWLoop), rCost, nOut,
+ sqlite3DebugPrintf("Skip %s cost=%-3d,%3d,%3d order=%c\n",
+ wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted,
isOrdered>=0 ? isOrdered+'0' : '?');
}
#endif
@@ -134408,26 +135849,36 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
pTo = &aTo[jj];
#ifdef WHERETRACE_ENABLED /* 0x4 */
if( sqlite3WhereTrace&0x4 ){
- sqlite3DebugPrintf("New %s cost=%-3d,%3d order=%c\n",
- wherePathName(pFrom, iLoop, pWLoop), rCost, nOut,
+ sqlite3DebugPrintf("New %s cost=%-3d,%3d,%3d order=%c\n",
+ wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted,
isOrdered>=0 ? isOrdered+'0' : '?');
}
#endif
}else{
/* Control reaches here if best-so-far path pTo=aTo[jj] covers the
- ** same set of loops and has the sam isOrdered setting as the
+ ** same set of loops and has the same isOrdered setting as the
** candidate path. Check to see if the candidate should replace
- ** pTo or if the candidate should be skipped */
- if( pTo->rCost<rCost || (pTo->rCost==rCost && pTo->nRow<=nOut) ){
+ ** pTo or if the candidate should be skipped.
+ **
+ ** The conditional is an expanded vector comparison equivalent to:
+ ** (pTo->rCost,pTo->nRow,pTo->rUnsorted) <= (rCost,nOut,rUnsorted)
+ */
+ if( pTo->rCost<rCost
+ || (pTo->rCost==rCost
+ && (pTo->nRow<nOut
+ || (pTo->nRow==nOut && pTo->rUnsorted<=rUnsorted)
+ )
+ )
+ ){
#ifdef WHERETRACE_ENABLED /* 0x4 */
if( sqlite3WhereTrace&0x4 ){
sqlite3DebugPrintf(
- "Skip %s cost=%-3d,%3d order=%c",
- wherePathName(pFrom, iLoop, pWLoop), rCost, nOut,
+ "Skip %s cost=%-3d,%3d,%3d order=%c",
+ wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted,
isOrdered>=0 ? isOrdered+'0' : '?');
- sqlite3DebugPrintf(" vs %s cost=%-3d,%d order=%c\n",
+ sqlite3DebugPrintf(" vs %s cost=%-3d,%3d,%3d order=%c\n",
wherePathName(pTo, iLoop+1, 0), pTo->rCost, pTo->nRow,
- pTo->isOrdered>=0 ? pTo->isOrdered+'0' : '?');
+ pTo->rUnsorted, pTo->isOrdered>=0 ? pTo->isOrdered+'0' : '?');
}
#endif
/* Discard the candidate path from further consideration */
@@ -134440,12 +135891,12 @@ static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){
#ifdef WHERETRACE_ENABLED /* 0x4 */
if( sqlite3WhereTrace&0x4 ){
sqlite3DebugPrintf(
- "Update %s cost=%-3d,%3d order=%c",
- wherePathName(pFrom, iLoop, pWLoop), rCost, nOut,
+ "Update %s cost=%-3d,%3d,%3d order=%c",
+ wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, rUnsorted,
isOrdered>=0 ? isOrdered+'0' : '?');
- sqlite3DebugPrintf(" was %s cost=%-3d,%3d order=%c\n",
+ sqlite3DebugPrintf(" was %s cost=%-3d,%3d,%3d order=%c\n",
wherePathName(pTo, iLoop+1, 0), pTo->rCost, pTo->nRow,
- pTo->isOrdered>=0 ? pTo->isOrdered+'0' : '?');
+ pTo->rUnsorted, pTo->isOrdered>=0 ? pTo->isOrdered+'0' : '?');
}
#endif
}
@@ -134671,6 +136122,32 @@ static int whereShortCut(WhereLoopBuilder *pBuilder){
}
/*
+** Helper function for exprIsDeterministic().
+*/
+static int exprNodeIsDeterministic(Walker *pWalker, Expr *pExpr){
+ if( pExpr->op==TK_FUNCTION && ExprHasProperty(pExpr, EP_ConstFunc)==0 ){
+ pWalker->eCode = 0;
+ return WRC_Abort;
+ }
+ return WRC_Continue;
+}
+
+/*
+** Return true if the expression contains no non-deterministic SQL
+** functions. Do not consider non-deterministic SQL functions that are
+** part of sub-select statements.
+*/
+static int exprIsDeterministic(Expr *p){
+ Walker w;
+ memset(&w, 0, sizeof(w));
+ w.eCode = 1;
+ w.xExprCallback = exprNodeIsDeterministic;
+ w.xSelectCallback = sqlite3SelectWalkFail;
+ sqlite3WalkExpr(&w, p);
+ return w.eCode;
+}
+
+/*
** Generate the beginning of the loop used for WHERE clause processing.
** The return value is a pointer to an opaque structure that contains
** information needed to terminate the loop. Later, the calling routine
@@ -134868,17 +136345,6 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
sqlite3WhereClauseInit(&pWInfo->sWC, pWInfo);
sqlite3WhereSplit(&pWInfo->sWC, pWhere, TK_AND);
- /* Special case: a WHERE clause that is constant. Evaluate the
- ** expression and either jump over all of the code or fall thru.
- */
- for(ii=0; ii<sWLB.pWC->nTerm; ii++){
- if( nTabList==0 || sqlite3ExprIsConstantNotJoin(sWLB.pWC->a[ii].pExpr) ){
- sqlite3ExprIfFalse(pParse, sWLB.pWC->a[ii].pExpr, pWInfo->iBreak,
- SQLITE_JUMPIFNULL);
- sWLB.pWC->a[ii].wtFlags |= TERM_CODED;
- }
- }
-
/* Special case: No FROM clause
*/
if( nTabList==0 ){
@@ -134886,36 +136352,60 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
if( wctrlFlags & WHERE_WANT_DISTINCT ){
pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE;
}
+ }else{
+ /* Assign a bit from the bitmask to every term in the FROM clause.
+ **
+ ** The N-th term of the FROM clause is assigned a bitmask of 1<<N.
+ **
+ ** The rule of the previous sentence ensures thta if X is the bitmask for
+ ** a table T, then X-1 is the bitmask for all other tables to the left of T.
+ ** Knowing the bitmask for all tables to the left of a left join is
+ ** important. Ticket #3015.
+ **
+ ** Note that bitmasks are created for all pTabList->nSrc tables in
+ ** pTabList, not just the first nTabList tables. nTabList is normally
+ ** equal to pTabList->nSrc but might be shortened to 1 if the
+ ** WHERE_OR_SUBCLAUSE flag is set.
+ */
+ ii = 0;
+ do{
+ createMask(pMaskSet, pTabList->a[ii].iCursor);
+ sqlite3WhereTabFuncArgs(pParse, &pTabList->a[ii], &pWInfo->sWC);
+ }while( (++ii)<pTabList->nSrc );
+ #ifdef SQLITE_DEBUG
+ {
+ Bitmask mx = 0;
+ for(ii=0; ii<pTabList->nSrc; ii++){
+ Bitmask m = sqlite3WhereGetMask(pMaskSet, pTabList->a[ii].iCursor);
+ assert( m>=mx );
+ mx = m;
+ }
+ }
+ #endif
}
+
+ /* Analyze all of the subexpressions. */
+ sqlite3WhereExprAnalyze(pTabList, &pWInfo->sWC);
+ if( db->mallocFailed ) goto whereBeginError;
- /* Assign a bit from the bitmask to every term in the FROM clause.
+ /* Special case: WHERE terms that do not refer to any tables in the join
+ ** (constant expressions). Evaluate each such term, and jump over all the
+ ** generated code if the result is not true.
**
- ** The N-th term of the FROM clause is assigned a bitmask of 1<<N.
+ ** Do not do this if the expression contains non-deterministic functions
+ ** that are not within a sub-select. This is not strictly required, but
+ ** preserves SQLite's legacy behaviour in the following two cases:
**
- ** The rule of the previous sentence ensures thta if X is the bitmask for
- ** a table T, then X-1 is the bitmask for all other tables to the left of T.
- ** Knowing the bitmask for all tables to the left of a left join is
- ** important. Ticket #3015.
- **
- ** Note that bitmasks are created for all pTabList->nSrc tables in
- ** pTabList, not just the first nTabList tables. nTabList is normally
- ** equal to pTabList->nSrc but might be shortened to 1 if the
- ** WHERE_OR_SUBCLAUSE flag is set.
+ ** FROM ... WHERE random()>0; -- eval random() once per row
+ ** FROM ... WHERE (SELECT random())>0; -- eval random() once overall
*/
- for(ii=0; ii<pTabList->nSrc; ii++){
- createMask(pMaskSet, pTabList->a[ii].iCursor);
- sqlite3WhereTabFuncArgs(pParse, &pTabList->a[ii], &pWInfo->sWC);
- }
-#ifdef SQLITE_DEBUG
- for(ii=0; ii<pTabList->nSrc; ii++){
- Bitmask m = sqlite3WhereGetMask(pMaskSet, pTabList->a[ii].iCursor);
- assert( m==MASKBIT(ii) );
+ for(ii=0; ii<sWLB.pWC->nTerm; ii++){
+ WhereTerm *pT = &sWLB.pWC->a[ii];
+ if( pT->prereqAll==0 && (nTabList==0 || exprIsDeterministic(pT->pExpr)) ){
+ sqlite3ExprIfFalse(pParse, pT->pExpr, pWInfo->iBreak, SQLITE_JUMPIFNULL);
+ pT->wtFlags |= TERM_CODED;
+ }
}
-#endif
-
- /* Analyze all of the subexpressions. */
- sqlite3WhereExprAnalyze(pTabList, &pWInfo->sWC);
- if( db->mallocFailed ) goto whereBeginError;
if( wctrlFlags & WHERE_WANT_DISTINCT ){
if( isDistinctRedundant(pParse, pTabList, &pWInfo->sWC, pResultSet) ){
@@ -134953,7 +136443,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
static const char zLabel[] = "0123456789abcdefghijklmnopqrstuvwyxz"
"ABCDEFGHIJKLMNOPQRSTUVWYXZ";
for(p=pWInfo->pLoops, i=0; p; p=p->pNextLoop, i++){
- p->cId = zLabel[i%sizeof(zLabel)];
+ p->cId = zLabel[i%(sizeof(zLabel)-1)];
whereLoopPrint(p, sWLB.pWC);
}
}
@@ -135116,7 +136606,7 @@ SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(
Index *pIx = pLoop->u.btree.pIndex;
int iIndexCur;
int op = OP_OpenRead;
- /* iAuxArg is always set if to a positive value if ONEPASS is possible */
+ /* iAuxArg is always set to a positive value if ONEPASS is possible */
assert( iAuxArg!=0 || (pWInfo->wctrlFlags & WHERE_ONEPASS_DESIRED)==0 );
if( !HasRowid(pTab) && IsPrimaryKeyIndex(pIx)
&& (wctrlFlags & WHERE_OR_SUBCLAUSE)!=0
@@ -135697,7 +137187,8 @@ static void disableLookaside(Parse *pParse){
** YY_MAX_SHIFT Maximum value for shift actions
** YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions
** YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions
-** YY_MIN_REDUCE Maximum value for reduce actions
+** YY_MIN_REDUCE Minimum value for reduce actions
+** YY_MAX_REDUCE Maximum value for reduce actions
** YY_ERROR_ACTION The yy_action[] code for syntax error
** YY_ACCEPT_ACTION The yy_action[] code for accept
** YY_NO_ACTION The yy_action[] code for no-op
@@ -135709,7 +137200,7 @@ static void disableLookaside(Parse *pParse){
#define YYCODETYPE unsigned char
#define YYNOCODE 252
#define YYACTIONTYPE unsigned short int
-#define YYWILDCARD 69
+#define YYWILDCARD 83
#define sqlite3ParserTOKENTYPE Token
typedef union {
int yyinit;
@@ -135735,16 +137226,16 @@ typedef union {
#define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse
#define sqlite3ParserARG_STORE yypParser->pParse = pParse
#define YYFALLBACK 1
-#define YYNSTATE 456
-#define YYNRULE 332
-#define YY_MAX_SHIFT 455
-#define YY_MIN_SHIFTREDUCE 668
-#define YY_MAX_SHIFTREDUCE 999
-#define YY_MIN_REDUCE 1000
-#define YY_MAX_REDUCE 1331
-#define YY_ERROR_ACTION 1332
-#define YY_ACCEPT_ACTION 1333
-#define YY_NO_ACTION 1334
+#define YYNSTATE 455
+#define YYNRULE 329
+#define YY_MAX_SHIFT 454
+#define YY_MIN_SHIFTREDUCE 664
+#define YY_MAX_SHIFTREDUCE 992
+#define YY_MIN_REDUCE 993
+#define YY_MAX_REDUCE 1321
+#define YY_ERROR_ACTION 1322
+#define YY_ACCEPT_ACTION 1323
+#define YY_NO_ACTION 1324
/************* End control #defines *******************************************/
/* Define the yytestcase() macro to be a no-op if is not already defined
@@ -135818,461 +137309,461 @@ typedef union {
*********** Begin parsing tables **********************************************/
#define YY_ACTTAB_COUNT (1566)
static const YYACTIONTYPE yy_action[] = {
- /* 0 */ 325, 411, 343, 752, 752, 203, 946, 354, 976, 98,
- /* 10 */ 98, 98, 98, 91, 96, 96, 96, 96, 95, 95,
- /* 20 */ 94, 94, 94, 93, 351, 1333, 155, 155, 2, 813,
- /* 30 */ 978, 978, 98, 98, 98, 98, 20, 96, 96, 96,
- /* 40 */ 96, 95, 95, 94, 94, 94, 93, 351, 92, 89,
- /* 50 */ 178, 99, 100, 90, 853, 856, 845, 845, 97, 97,
- /* 60 */ 98, 98, 98, 98, 351, 96, 96, 96, 96, 95,
- /* 70 */ 95, 94, 94, 94, 93, 351, 325, 340, 976, 262,
- /* 80 */ 365, 251, 212, 169, 287, 405, 282, 404, 199, 791,
- /* 90 */ 242, 412, 21, 957, 379, 280, 93, 351, 792, 95,
- /* 100 */ 95, 94, 94, 94, 93, 351, 978, 978, 96, 96,
- /* 110 */ 96, 96, 95, 95, 94, 94, 94, 93, 351, 813,
- /* 120 */ 329, 242, 412, 913, 832, 913, 132, 99, 100, 90,
- /* 130 */ 853, 856, 845, 845, 97, 97, 98, 98, 98, 98,
- /* 140 */ 450, 96, 96, 96, 96, 95, 95, 94, 94, 94,
- /* 150 */ 93, 351, 325, 825, 349, 348, 120, 819, 120, 75,
- /* 160 */ 52, 52, 957, 958, 959, 760, 984, 146, 361, 262,
- /* 170 */ 370, 261, 957, 982, 961, 983, 92, 89, 178, 371,
- /* 180 */ 230, 371, 978, 978, 817, 361, 360, 101, 824, 824,
- /* 190 */ 826, 384, 24, 964, 381, 428, 413, 369, 985, 380,
- /* 200 */ 985, 708, 325, 99, 100, 90, 853, 856, 845, 845,
- /* 210 */ 97, 97, 98, 98, 98, 98, 373, 96, 96, 96,
- /* 220 */ 96, 95, 95, 94, 94, 94, 93, 351, 957, 132,
- /* 230 */ 897, 450, 978, 978, 896, 60, 94, 94, 94, 93,
- /* 240 */ 351, 957, 958, 959, 961, 103, 361, 957, 385, 334,
- /* 250 */ 702, 52, 52, 99, 100, 90, 853, 856, 845, 845,
- /* 260 */ 97, 97, 98, 98, 98, 98, 698, 96, 96, 96,
- /* 270 */ 96, 95, 95, 94, 94, 94, 93, 351, 325, 455,
- /* 280 */ 670, 450, 227, 61, 157, 243, 344, 114, 701, 888,
- /* 290 */ 147, 832, 957, 373, 747, 957, 320, 957, 958, 959,
- /* 300 */ 194, 10, 10, 402, 399, 398, 888, 890, 978, 978,
- /* 310 */ 762, 171, 170, 157, 397, 337, 957, 958, 959, 702,
- /* 320 */ 825, 310, 153, 957, 819, 321, 82, 23, 80, 99,
- /* 330 */ 100, 90, 853, 856, 845, 845, 97, 97, 98, 98,
- /* 340 */ 98, 98, 894, 96, 96, 96, 96, 95, 95, 94,
- /* 350 */ 94, 94, 93, 351, 325, 824, 824, 826, 277, 231,
- /* 360 */ 300, 957, 958, 959, 957, 958, 959, 888, 194, 25,
- /* 370 */ 450, 402, 399, 398, 957, 355, 300, 450, 957, 74,
- /* 380 */ 450, 1, 397, 132, 978, 978, 957, 224, 224, 813,
- /* 390 */ 10, 10, 957, 958, 959, 968, 132, 52, 52, 415,
- /* 400 */ 52, 52, 739, 739, 339, 99, 100, 90, 853, 856,
- /* 410 */ 845, 845, 97, 97, 98, 98, 98, 98, 790, 96,
- /* 420 */ 96, 96, 96, 95, 95, 94, 94, 94, 93, 351,
- /* 430 */ 325, 789, 428, 418, 706, 428, 427, 1270, 1270, 262,
- /* 440 */ 370, 261, 957, 957, 958, 959, 757, 957, 958, 959,
- /* 450 */ 450, 756, 450, 734, 713, 957, 958, 959, 443, 711,
- /* 460 */ 978, 978, 734, 394, 92, 89, 178, 447, 447, 447,
- /* 470 */ 51, 51, 52, 52, 439, 778, 700, 92, 89, 178,
- /* 480 */ 172, 99, 100, 90, 853, 856, 845, 845, 97, 97,
- /* 490 */ 98, 98, 98, 98, 198, 96, 96, 96, 96, 95,
- /* 500 */ 95, 94, 94, 94, 93, 351, 325, 428, 408, 916,
- /* 510 */ 699, 957, 958, 959, 92, 89, 178, 224, 224, 157,
- /* 520 */ 241, 221, 419, 299, 776, 917, 416, 375, 450, 415,
- /* 530 */ 58, 324, 737, 737, 920, 379, 978, 978, 379, 777,
- /* 540 */ 449, 918, 363, 740, 296, 686, 9, 9, 52, 52,
- /* 550 */ 234, 330, 234, 256, 417, 741, 280, 99, 100, 90,
- /* 560 */ 853, 856, 845, 845, 97, 97, 98, 98, 98, 98,
- /* 570 */ 450, 96, 96, 96, 96, 95, 95, 94, 94, 94,
- /* 580 */ 93, 351, 325, 423, 72, 450, 833, 120, 368, 450,
- /* 590 */ 10, 10, 5, 301, 203, 450, 177, 976, 253, 420,
- /* 600 */ 255, 776, 200, 175, 233, 10, 10, 842, 842, 36,
- /* 610 */ 36, 1299, 978, 978, 729, 37, 37, 349, 348, 425,
- /* 620 */ 203, 260, 776, 976, 232, 937, 1326, 876, 338, 1326,
- /* 630 */ 422, 854, 857, 99, 100, 90, 853, 856, 845, 845,
- /* 640 */ 97, 97, 98, 98, 98, 98, 268, 96, 96, 96,
- /* 650 */ 96, 95, 95, 94, 94, 94, 93, 351, 325, 846,
- /* 660 */ 450, 985, 818, 985, 1209, 450, 916, 976, 720, 350,
- /* 670 */ 350, 350, 935, 177, 450, 937, 1327, 254, 198, 1327,
- /* 680 */ 12, 12, 917, 403, 450, 27, 27, 250, 978, 978,
- /* 690 */ 118, 721, 162, 976, 38, 38, 268, 176, 918, 776,
- /* 700 */ 433, 1275, 946, 354, 39, 39, 317, 998, 325, 99,
- /* 710 */ 100, 90, 853, 856, 845, 845, 97, 97, 98, 98,
- /* 720 */ 98, 98, 935, 96, 96, 96, 96, 95, 95, 94,
- /* 730 */ 94, 94, 93, 351, 450, 330, 450, 358, 978, 978,
- /* 740 */ 717, 317, 936, 341, 900, 900, 387, 673, 674, 675,
- /* 750 */ 275, 996, 318, 999, 40, 40, 41, 41, 268, 99,
- /* 760 */ 100, 90, 853, 856, 845, 845, 97, 97, 98, 98,
- /* 770 */ 98, 98, 450, 96, 96, 96, 96, 95, 95, 94,
- /* 780 */ 94, 94, 93, 351, 325, 450, 356, 450, 999, 450,
- /* 790 */ 692, 331, 42, 42, 791, 270, 450, 273, 450, 228,
- /* 800 */ 450, 298, 450, 792, 450, 28, 28, 29, 29, 31,
- /* 810 */ 31, 450, 817, 450, 978, 978, 43, 43, 44, 44,
- /* 820 */ 45, 45, 11, 11, 46, 46, 893, 78, 893, 268,
- /* 830 */ 268, 105, 105, 47, 47, 99, 100, 90, 853, 856,
- /* 840 */ 845, 845, 97, 97, 98, 98, 98, 98, 450, 96,
- /* 850 */ 96, 96, 96, 95, 95, 94, 94, 94, 93, 351,
- /* 860 */ 325, 450, 117, 450, 749, 158, 450, 696, 48, 48,
- /* 870 */ 229, 919, 450, 928, 450, 415, 450, 335, 450, 245,
- /* 880 */ 450, 33, 33, 49, 49, 450, 50, 50, 246, 817,
- /* 890 */ 978, 978, 34, 34, 122, 122, 123, 123, 124, 124,
- /* 900 */ 56, 56, 268, 81, 249, 35, 35, 197, 196, 195,
- /* 910 */ 325, 99, 100, 90, 853, 856, 845, 845, 97, 97,
- /* 920 */ 98, 98, 98, 98, 450, 96, 96, 96, 96, 95,
- /* 930 */ 95, 94, 94, 94, 93, 351, 450, 696, 450, 817,
- /* 940 */ 978, 978, 975, 884, 106, 106, 268, 886, 268, 944,
- /* 950 */ 2, 892, 268, 892, 336, 716, 53, 53, 107, 107,
- /* 960 */ 325, 99, 100, 90, 853, 856, 845, 845, 97, 97,
- /* 970 */ 98, 98, 98, 98, 450, 96, 96, 96, 96, 95,
- /* 980 */ 95, 94, 94, 94, 93, 351, 450, 746, 450, 742,
- /* 990 */ 978, 978, 715, 267, 108, 108, 446, 331, 332, 133,
- /* 1000 */ 223, 175, 301, 225, 386, 933, 104, 104, 121, 121,
- /* 1010 */ 325, 99, 88, 90, 853, 856, 845, 845, 97, 97,
- /* 1020 */ 98, 98, 98, 98, 817, 96, 96, 96, 96, 95,
- /* 1030 */ 95, 94, 94, 94, 93, 351, 450, 347, 450, 167,
- /* 1040 */ 978, 978, 932, 815, 372, 319, 202, 202, 374, 263,
- /* 1050 */ 395, 202, 74, 208, 726, 727, 119, 119, 112, 112,
- /* 1060 */ 325, 407, 100, 90, 853, 856, 845, 845, 97, 97,
- /* 1070 */ 98, 98, 98, 98, 450, 96, 96, 96, 96, 95,
- /* 1080 */ 95, 94, 94, 94, 93, 351, 450, 757, 450, 345,
- /* 1090 */ 978, 978, 756, 278, 111, 111, 74, 719, 718, 709,
- /* 1100 */ 286, 883, 754, 1289, 257, 77, 109, 109, 110, 110,
- /* 1110 */ 908, 285, 810, 90, 853, 856, 845, 845, 97, 97,
- /* 1120 */ 98, 98, 98, 98, 911, 96, 96, 96, 96, 95,
- /* 1130 */ 95, 94, 94, 94, 93, 351, 86, 445, 450, 3,
- /* 1140 */ 1202, 450, 745, 132, 352, 120, 689, 86, 445, 785,
- /* 1150 */ 3, 767, 202, 377, 448, 352, 907, 120, 55, 55,
- /* 1160 */ 450, 57, 57, 828, 879, 448, 450, 208, 450, 709,
- /* 1170 */ 450, 883, 237, 434, 436, 120, 440, 429, 362, 120,
- /* 1180 */ 54, 54, 132, 450, 434, 832, 52, 52, 26, 26,
- /* 1190 */ 30, 30, 382, 132, 409, 444, 832, 694, 264, 390,
- /* 1200 */ 116, 269, 272, 32, 32, 83, 84, 120, 274, 120,
- /* 1210 */ 120, 276, 85, 352, 452, 451, 83, 84, 819, 730,
- /* 1220 */ 714, 428, 430, 85, 352, 452, 451, 120, 120, 819,
- /* 1230 */ 378, 218, 281, 828, 783, 816, 86, 445, 410, 3,
- /* 1240 */ 763, 774, 431, 432, 352, 302, 303, 823, 697, 824,
- /* 1250 */ 824, 826, 827, 19, 448, 691, 680, 679, 681, 951,
- /* 1260 */ 824, 824, 826, 827, 19, 289, 159, 291, 293, 7,
- /* 1270 */ 316, 173, 259, 434, 805, 364, 252, 910, 376, 713,
- /* 1280 */ 295, 435, 168, 993, 400, 832, 284, 881, 880, 205,
- /* 1290 */ 954, 308, 927, 86, 445, 990, 3, 925, 333, 144,
- /* 1300 */ 130, 352, 72, 135, 59, 83, 84, 761, 137, 366,
- /* 1310 */ 802, 448, 85, 352, 452, 451, 139, 226, 819, 140,
- /* 1320 */ 156, 62, 315, 314, 313, 215, 311, 367, 393, 683,
- /* 1330 */ 434, 185, 141, 912, 142, 160, 148, 812, 875, 383,
- /* 1340 */ 189, 67, 832, 180, 389, 248, 895, 775, 219, 824,
- /* 1350 */ 824, 826, 827, 19, 247, 190, 266, 154, 391, 271,
- /* 1360 */ 191, 192, 83, 84, 682, 406, 733, 182, 322, 85,
- /* 1370 */ 352, 452, 451, 732, 183, 819, 342, 132, 181, 711,
- /* 1380 */ 731, 421, 76, 445, 705, 3, 323, 704, 283, 724,
- /* 1390 */ 352, 771, 703, 966, 723, 71, 204, 6, 288, 290,
- /* 1400 */ 448, 772, 770, 769, 79, 292, 824, 824, 826, 827,
- /* 1410 */ 19, 294, 297, 438, 346, 442, 102, 861, 753, 434,
- /* 1420 */ 238, 426, 73, 305, 239, 304, 326, 240, 424, 306,
- /* 1430 */ 307, 832, 213, 688, 22, 952, 453, 214, 216, 217,
- /* 1440 */ 454, 677, 115, 676, 671, 125, 126, 235, 127, 669,
- /* 1450 */ 327, 83, 84, 359, 353, 244, 166, 328, 85, 352,
- /* 1460 */ 452, 451, 134, 179, 819, 357, 113, 891, 811, 889,
- /* 1470 */ 136, 128, 138, 743, 258, 184, 906, 143, 145, 63,
- /* 1480 */ 64, 65, 66, 129, 909, 905, 187, 186, 8, 13,
- /* 1490 */ 188, 265, 898, 149, 202, 824, 824, 826, 827, 19,
- /* 1500 */ 388, 987, 150, 161, 285, 685, 392, 396, 151, 722,
- /* 1510 */ 193, 68, 14, 401, 279, 15, 69, 236, 831, 830,
- /* 1520 */ 131, 859, 751, 70, 16, 414, 755, 4, 784, 220,
- /* 1530 */ 222, 174, 152, 437, 779, 201, 17, 77, 74, 18,
- /* 1540 */ 874, 860, 858, 915, 863, 914, 207, 206, 941, 163,
- /* 1550 */ 210, 942, 209, 164, 441, 862, 165, 211, 829, 695,
- /* 1560 */ 87, 312, 309, 947, 1291, 1290,
+ /* 0 */ 324, 1323, 155, 155, 2, 203, 94, 94, 94, 93,
+ /* 10 */ 350, 98, 98, 98, 98, 91, 95, 95, 94, 94,
+ /* 20 */ 94, 93, 350, 268, 99, 100, 90, 971, 971, 847,
+ /* 30 */ 850, 839, 839, 97, 97, 98, 98, 98, 98, 350,
+ /* 40 */ 969, 96, 96, 96, 96, 95, 95, 94, 94, 94,
+ /* 50 */ 93, 350, 950, 96, 96, 96, 96, 95, 95, 94,
+ /* 60 */ 94, 94, 93, 350, 250, 96, 96, 96, 96, 95,
+ /* 70 */ 95, 94, 94, 94, 93, 350, 224, 224, 969, 132,
+ /* 80 */ 888, 348, 347, 415, 172, 324, 1286, 449, 414, 950,
+ /* 90 */ 951, 952, 808, 977, 1032, 950, 300, 786, 428, 132,
+ /* 100 */ 975, 362, 976, 9, 9, 787, 132, 52, 52, 99,
+ /* 110 */ 100, 90, 971, 971, 847, 850, 839, 839, 97, 97,
+ /* 120 */ 98, 98, 98, 98, 372, 978, 241, 978, 262, 369,
+ /* 130 */ 261, 120, 950, 951, 952, 194, 58, 324, 401, 398,
+ /* 140 */ 397, 808, 427, 429, 75, 808, 1260, 1260, 132, 396,
+ /* 150 */ 96, 96, 96, 96, 95, 95, 94, 94, 94, 93,
+ /* 160 */ 350, 99, 100, 90, 971, 971, 847, 850, 839, 839,
+ /* 170 */ 97, 97, 98, 98, 98, 98, 786, 262, 369, 261,
+ /* 180 */ 826, 262, 364, 251, 787, 1084, 101, 1114, 72, 324,
+ /* 190 */ 227, 1113, 242, 411, 442, 819, 92, 89, 178, 818,
+ /* 200 */ 1022, 268, 96, 96, 96, 96, 95, 95, 94, 94,
+ /* 210 */ 94, 93, 350, 99, 100, 90, 971, 971, 847, 850,
+ /* 220 */ 839, 839, 97, 97, 98, 98, 98, 98, 449, 372,
+ /* 230 */ 818, 818, 820, 92, 89, 178, 60, 92, 89, 178,
+ /* 240 */ 1025, 324, 357, 930, 1316, 300, 61, 1316, 52, 52,
+ /* 250 */ 836, 836, 848, 851, 96, 96, 96, 96, 95, 95,
+ /* 260 */ 94, 94, 94, 93, 350, 99, 100, 90, 971, 971,
+ /* 270 */ 847, 850, 839, 839, 97, 97, 98, 98, 98, 98,
+ /* 280 */ 92, 89, 178, 427, 412, 198, 930, 1317, 454, 995,
+ /* 290 */ 1317, 355, 1024, 324, 243, 231, 114, 277, 348, 347,
+ /* 300 */ 1242, 950, 416, 1071, 928, 840, 96, 96, 96, 96,
+ /* 310 */ 95, 95, 94, 94, 94, 93, 350, 99, 100, 90,
+ /* 320 */ 971, 971, 847, 850, 839, 839, 97, 97, 98, 98,
+ /* 330 */ 98, 98, 449, 328, 449, 120, 23, 256, 950, 951,
+ /* 340 */ 952, 968, 978, 438, 978, 324, 329, 928, 954, 701,
+ /* 350 */ 200, 175, 52, 52, 52, 52, 939, 353, 96, 96,
+ /* 360 */ 96, 96, 95, 95, 94, 94, 94, 93, 350, 99,
+ /* 370 */ 100, 90, 971, 971, 847, 850, 839, 839, 97, 97,
+ /* 380 */ 98, 98, 98, 98, 354, 449, 954, 427, 417, 427,
+ /* 390 */ 426, 1290, 92, 89, 178, 268, 253, 324, 255, 1058,
+ /* 400 */ 1037, 694, 93, 350, 383, 52, 52, 380, 1058, 374,
+ /* 410 */ 96, 96, 96, 96, 95, 95, 94, 94, 94, 93,
+ /* 420 */ 350, 99, 100, 90, 971, 971, 847, 850, 839, 839,
+ /* 430 */ 97, 97, 98, 98, 98, 98, 228, 449, 167, 449,
+ /* 440 */ 427, 407, 157, 446, 446, 446, 349, 349, 349, 324,
+ /* 450 */ 310, 316, 991, 827, 320, 242, 411, 51, 51, 36,
+ /* 460 */ 36, 254, 96, 96, 96, 96, 95, 95, 94, 94,
+ /* 470 */ 94, 93, 350, 99, 100, 90, 971, 971, 847, 850,
+ /* 480 */ 839, 839, 97, 97, 98, 98, 98, 98, 194, 316,
+ /* 490 */ 929, 401, 398, 397, 224, 224, 1265, 939, 353, 1318,
+ /* 500 */ 317, 324, 396, 1063, 1063, 813, 414, 1061, 1061, 950,
+ /* 510 */ 299, 448, 992, 268, 96, 96, 96, 96, 95, 95,
+ /* 520 */ 94, 94, 94, 93, 350, 99, 100, 90, 971, 971,
+ /* 530 */ 847, 850, 839, 839, 97, 97, 98, 98, 98, 98,
+ /* 540 */ 757, 1041, 449, 893, 893, 386, 950, 951, 952, 410,
+ /* 550 */ 992, 747, 747, 324, 229, 268, 221, 296, 268, 771,
+ /* 560 */ 890, 378, 52, 52, 890, 421, 96, 96, 96, 96,
+ /* 570 */ 95, 95, 94, 94, 94, 93, 350, 99, 100, 90,
+ /* 580 */ 971, 971, 847, 850, 839, 839, 97, 97, 98, 98,
+ /* 590 */ 98, 98, 103, 449, 275, 384, 1241, 343, 157, 1207,
+ /* 600 */ 909, 669, 670, 671, 176, 197, 196, 195, 324, 298,
+ /* 610 */ 319, 1266, 2, 37, 37, 910, 1134, 1040, 96, 96,
+ /* 620 */ 96, 96, 95, 95, 94, 94, 94, 93, 350, 697,
+ /* 630 */ 911, 177, 99, 100, 90, 971, 971, 847, 850, 839,
+ /* 640 */ 839, 97, 97, 98, 98, 98, 98, 230, 146, 120,
+ /* 650 */ 735, 1235, 826, 270, 1141, 273, 1141, 771, 171, 170,
+ /* 660 */ 736, 1141, 82, 324, 80, 268, 697, 819, 158, 268,
+ /* 670 */ 378, 818, 78, 96, 96, 96, 96, 95, 95, 94,
+ /* 680 */ 94, 94, 93, 350, 120, 950, 393, 99, 100, 90,
+ /* 690 */ 971, 971, 847, 850, 839, 839, 97, 97, 98, 98,
+ /* 700 */ 98, 98, 818, 818, 820, 1141, 1070, 370, 331, 133,
+ /* 710 */ 1066, 1141, 1250, 198, 268, 324, 1016, 330, 245, 333,
+ /* 720 */ 24, 334, 950, 951, 952, 368, 335, 81, 96, 96,
+ /* 730 */ 96, 96, 95, 95, 94, 94, 94, 93, 350, 99,
+ /* 740 */ 100, 90, 971, 971, 847, 850, 839, 839, 97, 97,
+ /* 750 */ 98, 98, 98, 98, 132, 267, 260, 445, 330, 223,
+ /* 760 */ 175, 1289, 925, 752, 724, 318, 1073, 324, 751, 246,
+ /* 770 */ 385, 301, 301, 378, 329, 361, 344, 414, 1233, 280,
+ /* 780 */ 96, 96, 96, 96, 95, 95, 94, 94, 94, 93,
+ /* 790 */ 350, 99, 88, 90, 971, 971, 847, 850, 839, 839,
+ /* 800 */ 97, 97, 98, 98, 98, 98, 337, 346, 721, 722,
+ /* 810 */ 449, 120, 118, 887, 162, 887, 810, 371, 324, 202,
+ /* 820 */ 202, 373, 249, 263, 202, 394, 74, 704, 208, 1069,
+ /* 830 */ 12, 12, 96, 96, 96, 96, 95, 95, 94, 94,
+ /* 840 */ 94, 93, 350, 100, 90, 971, 971, 847, 850, 839,
+ /* 850 */ 839, 97, 97, 98, 98, 98, 98, 449, 771, 232,
+ /* 860 */ 449, 278, 120, 286, 74, 704, 714, 713, 324, 342,
+ /* 870 */ 749, 877, 1209, 77, 285, 1255, 780, 52, 52, 202,
+ /* 880 */ 27, 27, 418, 96, 96, 96, 96, 95, 95, 94,
+ /* 890 */ 94, 94, 93, 350, 90, 971, 971, 847, 850, 839,
+ /* 900 */ 839, 97, 97, 98, 98, 98, 98, 86, 444, 877,
+ /* 910 */ 3, 1193, 422, 1013, 873, 435, 886, 208, 886, 689,
+ /* 920 */ 1091, 257, 116, 822, 447, 1230, 117, 1229, 86, 444,
+ /* 930 */ 177, 3, 381, 96, 96, 96, 96, 95, 95, 94,
+ /* 940 */ 94, 94, 93, 350, 339, 447, 120, 351, 120, 212,
+ /* 950 */ 169, 287, 404, 282, 403, 199, 771, 950, 433, 419,
+ /* 960 */ 439, 822, 280, 691, 1039, 264, 269, 132, 351, 153,
+ /* 970 */ 826, 376, 74, 272, 274, 276, 83, 84, 1054, 433,
+ /* 980 */ 147, 1038, 443, 85, 351, 451, 450, 281, 132, 818,
+ /* 990 */ 25, 826, 449, 120, 950, 951, 952, 83, 84, 86,
+ /* 1000 */ 444, 691, 3, 408, 85, 351, 451, 450, 449, 5,
+ /* 1010 */ 818, 203, 32, 32, 1107, 120, 447, 950, 225, 1140,
+ /* 1020 */ 818, 818, 820, 821, 19, 203, 226, 950, 38, 38,
+ /* 1030 */ 1087, 314, 314, 313, 215, 311, 120, 449, 678, 351,
+ /* 1040 */ 237, 818, 818, 820, 821, 19, 969, 409, 377, 1,
+ /* 1050 */ 433, 180, 706, 248, 950, 951, 952, 10, 10, 449,
+ /* 1060 */ 969, 247, 826, 1098, 950, 951, 952, 430, 83, 84,
+ /* 1070 */ 756, 336, 950, 20, 431, 85, 351, 451, 450, 10,
+ /* 1080 */ 10, 818, 86, 444, 969, 3, 950, 449, 302, 303,
+ /* 1090 */ 182, 950, 1146, 338, 1021, 1015, 1004, 183, 969, 447,
+ /* 1100 */ 132, 181, 76, 444, 21, 3, 449, 10, 10, 950,
+ /* 1110 */ 951, 952, 818, 818, 820, 821, 19, 715, 1279, 447,
+ /* 1120 */ 389, 233, 351, 950, 951, 952, 10, 10, 950, 951,
+ /* 1130 */ 952, 1003, 218, 433, 1005, 325, 1273, 773, 289, 291,
+ /* 1140 */ 424, 293, 351, 7, 159, 826, 363, 402, 315, 360,
+ /* 1150 */ 1129, 83, 84, 433, 1232, 716, 772, 259, 85, 351,
+ /* 1160 */ 451, 450, 358, 375, 818, 826, 360, 359, 399, 1211,
+ /* 1170 */ 157, 83, 84, 681, 98, 98, 98, 98, 85, 351,
+ /* 1180 */ 451, 450, 323, 252, 818, 295, 1211, 1213, 1235, 173,
+ /* 1190 */ 1037, 284, 434, 340, 1204, 818, 818, 820, 821, 19,
+ /* 1200 */ 308, 234, 449, 234, 96, 96, 96, 96, 95, 95,
+ /* 1210 */ 94, 94, 94, 93, 350, 818, 818, 820, 821, 19,
+ /* 1220 */ 909, 120, 39, 39, 1203, 449, 168, 360, 449, 1276,
+ /* 1230 */ 367, 449, 135, 449, 986, 910, 449, 1249, 449, 1247,
+ /* 1240 */ 449, 205, 983, 449, 370, 40, 40, 1211, 41, 41,
+ /* 1250 */ 911, 42, 42, 28, 28, 870, 29, 29, 31, 31,
+ /* 1260 */ 43, 43, 379, 44, 44, 449, 59, 449, 332, 449,
+ /* 1270 */ 432, 62, 144, 156, 449, 130, 449, 72, 449, 137,
+ /* 1280 */ 449, 365, 449, 392, 139, 45, 45, 11, 11, 46,
+ /* 1290 */ 46, 140, 1200, 449, 105, 105, 47, 47, 48, 48,
+ /* 1300 */ 33, 33, 49, 49, 1126, 449, 141, 366, 449, 185,
+ /* 1310 */ 142, 449, 1234, 50, 50, 449, 160, 449, 148, 449,
+ /* 1320 */ 1136, 382, 449, 67, 449, 34, 34, 449, 122, 122,
+ /* 1330 */ 449, 123, 123, 449, 1198, 124, 124, 56, 56, 35,
+ /* 1340 */ 35, 449, 106, 106, 53, 53, 449, 107, 107, 449,
+ /* 1350 */ 108, 108, 449, 104, 104, 449, 406, 449, 388, 449,
+ /* 1360 */ 189, 121, 121, 449, 190, 449, 119, 119, 449, 112,
+ /* 1370 */ 112, 449, 111, 111, 1218, 109, 109, 110, 110, 55,
+ /* 1380 */ 55, 266, 752, 57, 57, 54, 54, 751, 26, 26,
+ /* 1390 */ 1099, 30, 30, 219, 154, 390, 271, 191, 321, 1006,
+ /* 1400 */ 192, 405, 1057, 1056, 1055, 341, 1048, 706, 1047, 1029,
+ /* 1410 */ 322, 420, 1028, 71, 1095, 283, 288, 1027, 1288, 204,
+ /* 1420 */ 6, 297, 79, 1184, 437, 1096, 1094, 290, 345, 292,
+ /* 1430 */ 441, 1093, 294, 102, 425, 73, 423, 213, 1012, 22,
+ /* 1440 */ 452, 945, 214, 1077, 216, 217, 238, 453, 306, 304,
+ /* 1450 */ 307, 239, 240, 1001, 305, 125, 996, 126, 115, 235,
+ /* 1460 */ 127, 665, 352, 166, 244, 179, 356, 113, 885, 883,
+ /* 1470 */ 806, 136, 128, 738, 326, 138, 327, 258, 184, 899,
+ /* 1480 */ 143, 129, 145, 63, 64, 65, 66, 902, 186, 187,
+ /* 1490 */ 898, 8, 13, 188, 134, 265, 891, 202, 980, 387,
+ /* 1500 */ 150, 149, 680, 161, 391, 193, 285, 279, 395, 151,
+ /* 1510 */ 68, 717, 14, 15, 400, 69, 16, 131, 236, 825,
+ /* 1520 */ 824, 853, 746, 750, 4, 70, 174, 413, 220, 222,
+ /* 1530 */ 152, 779, 774, 77, 868, 74, 854, 201, 17, 852,
+ /* 1540 */ 908, 206, 907, 207, 18, 857, 934, 163, 436, 210,
+ /* 1550 */ 935, 164, 209, 165, 440, 856, 823, 312, 690, 87,
+ /* 1560 */ 211, 309, 1281, 940, 995, 1280,
};
static const YYCODETYPE yy_lookahead[] = {
- /* 0 */ 19, 115, 19, 117, 118, 24, 1, 2, 27, 79,
- /* 10 */ 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
- /* 20 */ 90, 91, 92, 93, 94, 144, 145, 146, 147, 58,
- /* 30 */ 49, 50, 79, 80, 81, 82, 22, 84, 85, 86,
- /* 40 */ 87, 88, 89, 90, 91, 92, 93, 94, 221, 222,
- /* 50 */ 223, 70, 71, 72, 73, 74, 75, 76, 77, 78,
- /* 60 */ 79, 80, 81, 82, 94, 84, 85, 86, 87, 88,
- /* 70 */ 89, 90, 91, 92, 93, 94, 19, 94, 97, 108,
- /* 80 */ 109, 110, 99, 100, 101, 102, 103, 104, 105, 32,
- /* 90 */ 119, 120, 78, 27, 152, 112, 93, 94, 41, 88,
- /* 100 */ 89, 90, 91, 92, 93, 94, 49, 50, 84, 85,
- /* 110 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 58,
- /* 120 */ 157, 119, 120, 163, 68, 163, 65, 70, 71, 72,
- /* 130 */ 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
- /* 140 */ 152, 84, 85, 86, 87, 88, 89, 90, 91, 92,
- /* 150 */ 93, 94, 19, 97, 88, 89, 196, 101, 196, 26,
- /* 160 */ 172, 173, 96, 97, 98, 210, 100, 22, 152, 108,
- /* 170 */ 109, 110, 27, 107, 27, 109, 221, 222, 223, 219,
- /* 180 */ 238, 219, 49, 50, 152, 169, 170, 54, 132, 133,
- /* 190 */ 134, 228, 232, 171, 231, 207, 208, 237, 132, 237,
- /* 200 */ 134, 179, 19, 70, 71, 72, 73, 74, 75, 76,
- /* 210 */ 77, 78, 79, 80, 81, 82, 152, 84, 85, 86,
- /* 220 */ 87, 88, 89, 90, 91, 92, 93, 94, 27, 65,
- /* 230 */ 30, 152, 49, 50, 34, 52, 90, 91, 92, 93,
- /* 240 */ 94, 96, 97, 98, 97, 22, 230, 27, 48, 217,
- /* 250 */ 27, 172, 173, 70, 71, 72, 73, 74, 75, 76,
- /* 260 */ 77, 78, 79, 80, 81, 82, 172, 84, 85, 86,
- /* 270 */ 87, 88, 89, 90, 91, 92, 93, 94, 19, 148,
- /* 280 */ 149, 152, 218, 24, 152, 154, 207, 156, 172, 152,
- /* 290 */ 22, 68, 27, 152, 163, 27, 164, 96, 97, 98,
- /* 300 */ 99, 172, 173, 102, 103, 104, 169, 170, 49, 50,
- /* 310 */ 90, 88, 89, 152, 113, 186, 96, 97, 98, 96,
- /* 320 */ 97, 160, 57, 27, 101, 164, 137, 196, 139, 70,
- /* 330 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
- /* 340 */ 81, 82, 11, 84, 85, 86, 87, 88, 89, 90,
- /* 350 */ 91, 92, 93, 94, 19, 132, 133, 134, 23, 218,
- /* 360 */ 152, 96, 97, 98, 96, 97, 98, 230, 99, 22,
- /* 370 */ 152, 102, 103, 104, 27, 244, 152, 152, 27, 26,
- /* 380 */ 152, 22, 113, 65, 49, 50, 27, 194, 195, 58,
- /* 390 */ 172, 173, 96, 97, 98, 185, 65, 172, 173, 206,
- /* 400 */ 172, 173, 190, 191, 186, 70, 71, 72, 73, 74,
- /* 410 */ 75, 76, 77, 78, 79, 80, 81, 82, 175, 84,
- /* 420 */ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
- /* 430 */ 19, 175, 207, 208, 23, 207, 208, 119, 120, 108,
- /* 440 */ 109, 110, 27, 96, 97, 98, 116, 96, 97, 98,
- /* 450 */ 152, 121, 152, 179, 180, 96, 97, 98, 250, 106,
- /* 460 */ 49, 50, 188, 19, 221, 222, 223, 168, 169, 170,
- /* 470 */ 172, 173, 172, 173, 250, 124, 172, 221, 222, 223,
- /* 480 */ 26, 70, 71, 72, 73, 74, 75, 76, 77, 78,
- /* 490 */ 79, 80, 81, 82, 50, 84, 85, 86, 87, 88,
- /* 500 */ 89, 90, 91, 92, 93, 94, 19, 207, 208, 12,
- /* 510 */ 23, 96, 97, 98, 221, 222, 223, 194, 195, 152,
- /* 520 */ 199, 23, 19, 225, 26, 28, 152, 152, 152, 206,
- /* 530 */ 209, 164, 190, 191, 241, 152, 49, 50, 152, 124,
- /* 540 */ 152, 44, 219, 46, 152, 21, 172, 173, 172, 173,
- /* 550 */ 183, 107, 185, 16, 163, 58, 112, 70, 71, 72,
- /* 560 */ 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
- /* 570 */ 152, 84, 85, 86, 87, 88, 89, 90, 91, 92,
- /* 580 */ 93, 94, 19, 207, 130, 152, 23, 196, 64, 152,
- /* 590 */ 172, 173, 22, 152, 24, 152, 98, 27, 61, 96,
- /* 600 */ 63, 26, 211, 212, 186, 172, 173, 49, 50, 172,
- /* 610 */ 173, 23, 49, 50, 26, 172, 173, 88, 89, 186,
- /* 620 */ 24, 238, 124, 27, 238, 22, 23, 103, 187, 26,
- /* 630 */ 152, 73, 74, 70, 71, 72, 73, 74, 75, 76,
- /* 640 */ 77, 78, 79, 80, 81, 82, 152, 84, 85, 86,
- /* 650 */ 87, 88, 89, 90, 91, 92, 93, 94, 19, 101,
- /* 660 */ 152, 132, 23, 134, 140, 152, 12, 97, 36, 168,
- /* 670 */ 169, 170, 69, 98, 152, 22, 23, 140, 50, 26,
- /* 680 */ 172, 173, 28, 51, 152, 172, 173, 193, 49, 50,
- /* 690 */ 22, 59, 24, 97, 172, 173, 152, 152, 44, 124,
- /* 700 */ 46, 0, 1, 2, 172, 173, 22, 23, 19, 70,
- /* 710 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
- /* 720 */ 81, 82, 69, 84, 85, 86, 87, 88, 89, 90,
- /* 730 */ 91, 92, 93, 94, 152, 107, 152, 193, 49, 50,
- /* 740 */ 181, 22, 23, 111, 108, 109, 110, 7, 8, 9,
- /* 750 */ 16, 247, 248, 69, 172, 173, 172, 173, 152, 70,
- /* 760 */ 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
- /* 770 */ 81, 82, 152, 84, 85, 86, 87, 88, 89, 90,
- /* 780 */ 91, 92, 93, 94, 19, 152, 242, 152, 69, 152,
- /* 790 */ 166, 167, 172, 173, 32, 61, 152, 63, 152, 193,
- /* 800 */ 152, 152, 152, 41, 152, 172, 173, 172, 173, 172,
- /* 810 */ 173, 152, 152, 152, 49, 50, 172, 173, 172, 173,
- /* 820 */ 172, 173, 172, 173, 172, 173, 132, 138, 134, 152,
- /* 830 */ 152, 172, 173, 172, 173, 70, 71, 72, 73, 74,
- /* 840 */ 75, 76, 77, 78, 79, 80, 81, 82, 152, 84,
- /* 850 */ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
- /* 860 */ 19, 152, 22, 152, 195, 24, 152, 27, 172, 173,
- /* 870 */ 193, 193, 152, 152, 152, 206, 152, 217, 152, 152,
- /* 880 */ 152, 172, 173, 172, 173, 152, 172, 173, 152, 152,
- /* 890 */ 49, 50, 172, 173, 172, 173, 172, 173, 172, 173,
- /* 900 */ 172, 173, 152, 138, 152, 172, 173, 108, 109, 110,
- /* 910 */ 19, 70, 71, 72, 73, 74, 75, 76, 77, 78,
- /* 920 */ 79, 80, 81, 82, 152, 84, 85, 86, 87, 88,
- /* 930 */ 89, 90, 91, 92, 93, 94, 152, 97, 152, 152,
- /* 940 */ 49, 50, 26, 193, 172, 173, 152, 152, 152, 146,
- /* 950 */ 147, 132, 152, 134, 217, 181, 172, 173, 172, 173,
- /* 960 */ 19, 70, 71, 72, 73, 74, 75, 76, 77, 78,
- /* 970 */ 79, 80, 81, 82, 152, 84, 85, 86, 87, 88,
- /* 980 */ 89, 90, 91, 92, 93, 94, 152, 193, 152, 193,
- /* 990 */ 49, 50, 181, 193, 172, 173, 166, 167, 245, 246,
- /* 1000 */ 211, 212, 152, 22, 217, 152, 172, 173, 172, 173,
- /* 1010 */ 19, 70, 71, 72, 73, 74, 75, 76, 77, 78,
- /* 1020 */ 79, 80, 81, 82, 152, 84, 85, 86, 87, 88,
- /* 1030 */ 89, 90, 91, 92, 93, 94, 152, 187, 152, 123,
- /* 1040 */ 49, 50, 23, 23, 23, 26, 26, 26, 23, 23,
- /* 1050 */ 23, 26, 26, 26, 7, 8, 172, 173, 172, 173,
- /* 1060 */ 19, 90, 71, 72, 73, 74, 75, 76, 77, 78,
- /* 1070 */ 79, 80, 81, 82, 152, 84, 85, 86, 87, 88,
- /* 1080 */ 89, 90, 91, 92, 93, 94, 152, 116, 152, 217,
- /* 1090 */ 49, 50, 121, 23, 172, 173, 26, 100, 101, 27,
- /* 1100 */ 101, 27, 23, 122, 152, 26, 172, 173, 172, 173,
- /* 1110 */ 152, 112, 163, 72, 73, 74, 75, 76, 77, 78,
- /* 1120 */ 79, 80, 81, 82, 163, 84, 85, 86, 87, 88,
- /* 1130 */ 89, 90, 91, 92, 93, 94, 19, 20, 152, 22,
- /* 1140 */ 23, 152, 163, 65, 27, 196, 163, 19, 20, 23,
- /* 1150 */ 22, 213, 26, 19, 37, 27, 152, 196, 172, 173,
- /* 1160 */ 152, 172, 173, 27, 23, 37, 152, 26, 152, 97,
- /* 1170 */ 152, 97, 210, 56, 163, 196, 163, 163, 100, 196,
- /* 1180 */ 172, 173, 65, 152, 56, 68, 172, 173, 172, 173,
- /* 1190 */ 172, 173, 152, 65, 163, 163, 68, 23, 152, 234,
- /* 1200 */ 26, 152, 152, 172, 173, 88, 89, 196, 152, 196,
- /* 1210 */ 196, 152, 95, 96, 97, 98, 88, 89, 101, 152,
- /* 1220 */ 152, 207, 208, 95, 96, 97, 98, 196, 196, 101,
- /* 1230 */ 96, 233, 152, 97, 152, 152, 19, 20, 207, 22,
- /* 1240 */ 152, 152, 152, 191, 27, 152, 152, 152, 152, 132,
- /* 1250 */ 133, 134, 135, 136, 37, 152, 152, 152, 152, 152,
- /* 1260 */ 132, 133, 134, 135, 136, 210, 197, 210, 210, 198,
- /* 1270 */ 150, 184, 239, 56, 201, 214, 214, 201, 239, 180,
- /* 1280 */ 214, 227, 198, 38, 176, 68, 175, 175, 175, 122,
- /* 1290 */ 155, 200, 159, 19, 20, 40, 22, 159, 159, 22,
- /* 1300 */ 70, 27, 130, 243, 240, 88, 89, 90, 189, 18,
- /* 1310 */ 201, 37, 95, 96, 97, 98, 192, 5, 101, 192,
- /* 1320 */ 220, 240, 10, 11, 12, 13, 14, 159, 18, 17,
- /* 1330 */ 56, 158, 192, 201, 192, 220, 189, 189, 201, 159,
- /* 1340 */ 158, 137, 68, 31, 45, 33, 236, 159, 159, 132,
- /* 1350 */ 133, 134, 135, 136, 42, 158, 235, 22, 177, 159,
- /* 1360 */ 158, 158, 88, 89, 159, 107, 174, 55, 177, 95,
- /* 1370 */ 96, 97, 98, 174, 62, 101, 47, 65, 66, 106,
- /* 1380 */ 174, 125, 19, 20, 174, 22, 177, 176, 174, 182,
- /* 1390 */ 27, 216, 174, 174, 182, 107, 159, 22, 215, 215,
- /* 1400 */ 37, 216, 216, 216, 137, 215, 132, 133, 134, 135,
- /* 1410 */ 136, 215, 159, 177, 94, 177, 129, 224, 205, 56,
- /* 1420 */ 226, 126, 128, 203, 229, 204, 114, 229, 127, 202,
- /* 1430 */ 201, 68, 25, 162, 26, 13, 161, 153, 153, 6,
- /* 1440 */ 151, 151, 178, 151, 151, 165, 165, 178, 165, 4,
- /* 1450 */ 249, 88, 89, 141, 3, 142, 22, 249, 95, 96,
- /* 1460 */ 97, 98, 246, 15, 101, 67, 16, 23, 120, 23,
- /* 1470 */ 131, 111, 123, 20, 16, 125, 1, 123, 131, 78,
- /* 1480 */ 78, 78, 78, 111, 96, 1, 122, 35, 5, 22,
- /* 1490 */ 107, 140, 53, 53, 26, 132, 133, 134, 135, 136,
- /* 1500 */ 43, 60, 107, 24, 112, 20, 19, 52, 22, 29,
- /* 1510 */ 105, 22, 22, 52, 23, 22, 22, 52, 23, 23,
- /* 1520 */ 39, 23, 116, 26, 22, 26, 23, 22, 96, 23,
- /* 1530 */ 23, 122, 22, 24, 124, 35, 35, 26, 26, 35,
- /* 1540 */ 23, 23, 23, 23, 11, 23, 22, 26, 23, 22,
- /* 1550 */ 122, 23, 26, 22, 24, 23, 22, 122, 23, 23,
- /* 1560 */ 22, 15, 23, 1, 122, 122,
+ /* 0 */ 19, 144, 145, 146, 147, 24, 90, 91, 92, 93,
+ /* 10 */ 94, 54, 55, 56, 57, 58, 88, 89, 90, 91,
+ /* 20 */ 92, 93, 94, 152, 43, 44, 45, 46, 47, 48,
+ /* 30 */ 49, 50, 51, 52, 53, 54, 55, 56, 57, 94,
+ /* 40 */ 59, 84, 85, 86, 87, 88, 89, 90, 91, 92,
+ /* 50 */ 93, 94, 59, 84, 85, 86, 87, 88, 89, 90,
+ /* 60 */ 91, 92, 93, 94, 193, 84, 85, 86, 87, 88,
+ /* 70 */ 89, 90, 91, 92, 93, 94, 194, 195, 97, 79,
+ /* 80 */ 11, 88, 89, 152, 26, 19, 171, 152, 206, 96,
+ /* 90 */ 97, 98, 72, 100, 179, 59, 152, 31, 163, 79,
+ /* 100 */ 107, 219, 109, 172, 173, 39, 79, 172, 173, 43,
+ /* 110 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
+ /* 120 */ 54, 55, 56, 57, 152, 132, 199, 134, 108, 109,
+ /* 130 */ 110, 196, 96, 97, 98, 99, 209, 19, 102, 103,
+ /* 140 */ 104, 72, 207, 208, 26, 72, 119, 120, 79, 113,
+ /* 150 */ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
+ /* 160 */ 94, 43, 44, 45, 46, 47, 48, 49, 50, 51,
+ /* 170 */ 52, 53, 54, 55, 56, 57, 31, 108, 109, 110,
+ /* 180 */ 82, 108, 109, 110, 39, 210, 68, 175, 130, 19,
+ /* 190 */ 218, 175, 119, 120, 250, 97, 221, 222, 223, 101,
+ /* 200 */ 172, 152, 84, 85, 86, 87, 88, 89, 90, 91,
+ /* 210 */ 92, 93, 94, 43, 44, 45, 46, 47, 48, 49,
+ /* 220 */ 50, 51, 52, 53, 54, 55, 56, 57, 152, 152,
+ /* 230 */ 132, 133, 134, 221, 222, 223, 66, 221, 222, 223,
+ /* 240 */ 172, 19, 193, 22, 23, 152, 24, 26, 172, 173,
+ /* 250 */ 46, 47, 48, 49, 84, 85, 86, 87, 88, 89,
+ /* 260 */ 90, 91, 92, 93, 94, 43, 44, 45, 46, 47,
+ /* 270 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
+ /* 280 */ 221, 222, 223, 207, 208, 46, 22, 23, 148, 149,
+ /* 290 */ 26, 242, 172, 19, 154, 218, 156, 23, 88, 89,
+ /* 300 */ 241, 59, 163, 163, 83, 101, 84, 85, 86, 87,
+ /* 310 */ 88, 89, 90, 91, 92, 93, 94, 43, 44, 45,
+ /* 320 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
+ /* 330 */ 56, 57, 152, 157, 152, 196, 196, 16, 96, 97,
+ /* 340 */ 98, 26, 132, 250, 134, 19, 107, 83, 59, 23,
+ /* 350 */ 211, 212, 172, 173, 172, 173, 1, 2, 84, 85,
+ /* 360 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 43,
+ /* 370 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
+ /* 380 */ 54, 55, 56, 57, 244, 152, 97, 207, 208, 207,
+ /* 390 */ 208, 185, 221, 222, 223, 152, 75, 19, 77, 179,
+ /* 400 */ 180, 23, 93, 94, 228, 172, 173, 231, 188, 152,
+ /* 410 */ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
+ /* 420 */ 94, 43, 44, 45, 46, 47, 48, 49, 50, 51,
+ /* 430 */ 52, 53, 54, 55, 56, 57, 193, 152, 123, 152,
+ /* 440 */ 207, 208, 152, 168, 169, 170, 168, 169, 170, 19,
+ /* 450 */ 160, 22, 23, 23, 164, 119, 120, 172, 173, 172,
+ /* 460 */ 173, 140, 84, 85, 86, 87, 88, 89, 90, 91,
+ /* 470 */ 92, 93, 94, 43, 44, 45, 46, 47, 48, 49,
+ /* 480 */ 50, 51, 52, 53, 54, 55, 56, 57, 99, 22,
+ /* 490 */ 23, 102, 103, 104, 194, 195, 0, 1, 2, 247,
+ /* 500 */ 248, 19, 113, 190, 191, 23, 206, 190, 191, 59,
+ /* 510 */ 225, 152, 83, 152, 84, 85, 86, 87, 88, 89,
+ /* 520 */ 90, 91, 92, 93, 94, 43, 44, 45, 46, 47,
+ /* 530 */ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
+ /* 540 */ 90, 181, 152, 108, 109, 110, 96, 97, 98, 115,
+ /* 550 */ 83, 117, 118, 19, 193, 152, 23, 152, 152, 26,
+ /* 560 */ 29, 152, 172, 173, 33, 152, 84, 85, 86, 87,
+ /* 570 */ 88, 89, 90, 91, 92, 93, 94, 43, 44, 45,
+ /* 580 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
+ /* 590 */ 56, 57, 22, 152, 16, 64, 193, 207, 152, 193,
+ /* 600 */ 12, 7, 8, 9, 152, 108, 109, 110, 19, 152,
+ /* 610 */ 164, 146, 147, 172, 173, 27, 163, 181, 84, 85,
+ /* 620 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 59,
+ /* 630 */ 42, 98, 43, 44, 45, 46, 47, 48, 49, 50,
+ /* 640 */ 51, 52, 53, 54, 55, 56, 57, 238, 22, 196,
+ /* 650 */ 62, 163, 82, 75, 152, 77, 152, 124, 88, 89,
+ /* 660 */ 72, 152, 137, 19, 139, 152, 96, 97, 24, 152,
+ /* 670 */ 152, 101, 138, 84, 85, 86, 87, 88, 89, 90,
+ /* 680 */ 91, 92, 93, 94, 196, 59, 19, 43, 44, 45,
+ /* 690 */ 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
+ /* 700 */ 56, 57, 132, 133, 134, 152, 193, 219, 245, 246,
+ /* 710 */ 193, 152, 152, 46, 152, 19, 166, 167, 152, 217,
+ /* 720 */ 232, 217, 96, 97, 98, 237, 217, 138, 84, 85,
+ /* 730 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 43,
+ /* 740 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
+ /* 750 */ 54, 55, 56, 57, 79, 193, 238, 166, 167, 211,
+ /* 760 */ 212, 23, 23, 116, 26, 26, 195, 19, 121, 152,
+ /* 770 */ 217, 152, 152, 152, 107, 100, 217, 206, 163, 112,
+ /* 780 */ 84, 85, 86, 87, 88, 89, 90, 91, 92, 93,
+ /* 790 */ 94, 43, 44, 45, 46, 47, 48, 49, 50, 51,
+ /* 800 */ 52, 53, 54, 55, 56, 57, 187, 187, 7, 8,
+ /* 810 */ 152, 196, 22, 132, 24, 134, 23, 23, 19, 26,
+ /* 820 */ 26, 23, 152, 23, 26, 23, 26, 59, 26, 163,
+ /* 830 */ 172, 173, 84, 85, 86, 87, 88, 89, 90, 91,
+ /* 840 */ 92, 93, 94, 44, 45, 46, 47, 48, 49, 50,
+ /* 850 */ 51, 52, 53, 54, 55, 56, 57, 152, 26, 238,
+ /* 860 */ 152, 23, 196, 101, 26, 97, 100, 101, 19, 19,
+ /* 870 */ 23, 59, 152, 26, 112, 152, 23, 172, 173, 26,
+ /* 880 */ 172, 173, 19, 84, 85, 86, 87, 88, 89, 90,
+ /* 890 */ 91, 92, 93, 94, 45, 46, 47, 48, 49, 50,
+ /* 900 */ 51, 52, 53, 54, 55, 56, 57, 19, 20, 97,
+ /* 910 */ 22, 23, 207, 163, 23, 163, 132, 26, 134, 23,
+ /* 920 */ 213, 152, 26, 59, 36, 152, 22, 152, 19, 20,
+ /* 930 */ 98, 22, 152, 84, 85, 86, 87, 88, 89, 90,
+ /* 940 */ 91, 92, 93, 94, 94, 36, 196, 59, 196, 99,
+ /* 950 */ 100, 101, 102, 103, 104, 105, 124, 59, 70, 96,
+ /* 960 */ 163, 97, 112, 59, 181, 152, 152, 79, 59, 71,
+ /* 970 */ 82, 19, 26, 152, 152, 152, 88, 89, 152, 70,
+ /* 980 */ 22, 152, 163, 95, 96, 97, 98, 152, 79, 101,
+ /* 990 */ 22, 82, 152, 196, 96, 97, 98, 88, 89, 19,
+ /* 1000 */ 20, 97, 22, 163, 95, 96, 97, 98, 152, 22,
+ /* 1010 */ 101, 24, 172, 173, 152, 196, 36, 59, 22, 152,
+ /* 1020 */ 132, 133, 134, 135, 136, 24, 5, 59, 172, 173,
+ /* 1030 */ 152, 10, 11, 12, 13, 14, 196, 152, 17, 59,
+ /* 1040 */ 210, 132, 133, 134, 135, 136, 59, 207, 96, 22,
+ /* 1050 */ 70, 30, 106, 32, 96, 97, 98, 172, 173, 152,
+ /* 1060 */ 59, 40, 82, 152, 96, 97, 98, 152, 88, 89,
+ /* 1070 */ 90, 186, 59, 22, 191, 95, 96, 97, 98, 172,
+ /* 1080 */ 173, 101, 19, 20, 97, 22, 59, 152, 152, 152,
+ /* 1090 */ 69, 59, 152, 186, 152, 152, 152, 76, 97, 36,
+ /* 1100 */ 79, 80, 19, 20, 53, 22, 152, 172, 173, 96,
+ /* 1110 */ 97, 98, 132, 133, 134, 135, 136, 35, 122, 36,
+ /* 1120 */ 234, 186, 59, 96, 97, 98, 172, 173, 96, 97,
+ /* 1130 */ 98, 152, 233, 70, 152, 114, 152, 124, 210, 210,
+ /* 1140 */ 186, 210, 59, 198, 197, 82, 214, 65, 150, 152,
+ /* 1150 */ 201, 88, 89, 70, 201, 73, 124, 239, 95, 96,
+ /* 1160 */ 97, 98, 141, 239, 101, 82, 169, 170, 176, 152,
+ /* 1170 */ 152, 88, 89, 21, 54, 55, 56, 57, 95, 96,
+ /* 1180 */ 97, 98, 164, 214, 101, 214, 169, 170, 163, 184,
+ /* 1190 */ 180, 175, 227, 111, 175, 132, 133, 134, 135, 136,
+ /* 1200 */ 200, 183, 152, 185, 84, 85, 86, 87, 88, 89,
+ /* 1210 */ 90, 91, 92, 93, 94, 132, 133, 134, 135, 136,
+ /* 1220 */ 12, 196, 172, 173, 175, 152, 198, 230, 152, 155,
+ /* 1230 */ 78, 152, 243, 152, 60, 27, 152, 159, 152, 159,
+ /* 1240 */ 152, 122, 38, 152, 219, 172, 173, 230, 172, 173,
+ /* 1250 */ 42, 172, 173, 172, 173, 103, 172, 173, 172, 173,
+ /* 1260 */ 172, 173, 237, 172, 173, 152, 240, 152, 159, 152,
+ /* 1270 */ 62, 240, 22, 220, 152, 43, 152, 130, 152, 189,
+ /* 1280 */ 152, 18, 152, 18, 192, 172, 173, 172, 173, 172,
+ /* 1290 */ 173, 192, 140, 152, 172, 173, 172, 173, 172, 173,
+ /* 1300 */ 172, 173, 172, 173, 201, 152, 192, 159, 152, 158,
+ /* 1310 */ 192, 152, 201, 172, 173, 152, 220, 152, 189, 152,
+ /* 1320 */ 189, 159, 152, 137, 152, 172, 173, 152, 172, 173,
+ /* 1330 */ 152, 172, 173, 152, 201, 172, 173, 172, 173, 172,
+ /* 1340 */ 173, 152, 172, 173, 172, 173, 152, 172, 173, 152,
+ /* 1350 */ 172, 173, 152, 172, 173, 152, 90, 152, 61, 152,
+ /* 1360 */ 158, 172, 173, 152, 158, 152, 172, 173, 152, 172,
+ /* 1370 */ 173, 152, 172, 173, 236, 172, 173, 172, 173, 172,
+ /* 1380 */ 173, 235, 116, 172, 173, 172, 173, 121, 172, 173,
+ /* 1390 */ 159, 172, 173, 159, 22, 177, 159, 158, 177, 159,
+ /* 1400 */ 158, 107, 174, 174, 174, 63, 182, 106, 182, 174,
+ /* 1410 */ 177, 125, 176, 107, 216, 174, 215, 174, 174, 159,
+ /* 1420 */ 22, 159, 137, 224, 177, 216, 216, 215, 94, 215,
+ /* 1430 */ 177, 216, 215, 129, 126, 128, 127, 25, 162, 26,
+ /* 1440 */ 161, 13, 153, 205, 153, 6, 226, 151, 202, 204,
+ /* 1450 */ 201, 229, 229, 151, 203, 165, 151, 165, 178, 178,
+ /* 1460 */ 165, 4, 3, 22, 142, 15, 81, 16, 23, 23,
+ /* 1470 */ 120, 131, 111, 20, 249, 123, 249, 16, 125, 1,
+ /* 1480 */ 123, 111, 131, 53, 53, 53, 53, 96, 34, 122,
+ /* 1490 */ 1, 5, 22, 107, 246, 140, 67, 26, 74, 41,
+ /* 1500 */ 107, 67, 20, 24, 19, 105, 112, 23, 66, 22,
+ /* 1510 */ 22, 28, 22, 22, 66, 22, 22, 37, 66, 23,
+ /* 1520 */ 23, 23, 116, 23, 22, 26, 122, 26, 23, 23,
+ /* 1530 */ 22, 96, 124, 26, 23, 26, 23, 34, 34, 23,
+ /* 1540 */ 23, 26, 23, 22, 34, 11, 23, 22, 24, 122,
+ /* 1550 */ 23, 22, 26, 22, 24, 23, 23, 15, 23, 22,
+ /* 1560 */ 122, 23, 122, 1, 251, 122,
};
#define YY_SHIFT_USE_DFLT (1566)
-#define YY_SHIFT_COUNT (455)
-#define YY_SHIFT_MIN (-114)
+#define YY_SHIFT_COUNT (454)
+#define YY_SHIFT_MIN (-84)
#define YY_SHIFT_MAX (1562)
static const short yy_shift_ofst[] = {
- /* 0 */ 5, 1117, 1312, 1128, 1274, 1274, 1274, 1274, 61, -19,
- /* 10 */ 57, 57, 183, 1274, 1274, 1274, 1274, 1274, 1274, 1274,
- /* 20 */ 66, 66, 201, -29, 331, 318, 133, 259, 335, 411,
- /* 30 */ 487, 563, 639, 689, 765, 841, 891, 891, 891, 891,
- /* 40 */ 891, 891, 891, 891, 891, 891, 891, 891, 891, 891,
- /* 50 */ 891, 891, 891, 941, 891, 991, 1041, 1041, 1217, 1274,
- /* 60 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274,
- /* 70 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274,
- /* 80 */ 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274,
- /* 90 */ 1363, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274, 1274,
- /* 100 */ 1274, 1274, 1274, 1274, -70, -47, -47, -47, -47, -47,
- /* 110 */ 24, 11, 146, 296, 524, 444, 529, 529, 296, 3,
- /* 120 */ 2, -30, 1566, 1566, 1566, -17, -17, -17, 145, 145,
- /* 130 */ 497, 497, 265, 603, 653, 296, 296, 296, 296, 296,
- /* 140 */ 296, 296, 296, 296, 296, 296, 296, 296, 296, 296,
- /* 150 */ 296, 296, 296, 296, 296, 701, 1078, 147, 147, 2,
- /* 160 */ 164, 164, 164, 164, 164, 164, 1566, 1566, 1566, 223,
- /* 170 */ 56, 56, 268, 269, 220, 347, 351, 415, 359, 296,
- /* 180 */ 296, 296, 296, 296, 296, 296, 296, 296, 296, 296,
- /* 190 */ 296, 296, 296, 296, 296, 632, 632, 632, 296, 296,
- /* 200 */ 498, 296, 296, 296, 570, 296, 296, 654, 296, 296,
- /* 210 */ 296, 296, 296, 296, 296, 296, 296, 296, 636, 200,
- /* 220 */ 596, 596, 596, 575, -114, 971, 740, 454, 503, 503,
- /* 230 */ 1134, 454, 1134, 353, 588, 628, 762, 503, 189, 762,
- /* 240 */ 762, 916, 330, 668, 1245, 1167, 1167, 1255, 1255, 1167,
- /* 250 */ 1277, 1230, 1172, 1291, 1291, 1291, 1291, 1167, 1310, 1172,
- /* 260 */ 1277, 1230, 1230, 1172, 1167, 1310, 1204, 1299, 1167, 1167,
- /* 270 */ 1310, 1335, 1167, 1310, 1167, 1310, 1335, 1258, 1258, 1258,
- /* 280 */ 1329, 1335, 1258, 1273, 1258, 1329, 1258, 1258, 1256, 1288,
- /* 290 */ 1256, 1288, 1256, 1288, 1256, 1288, 1167, 1375, 1167, 1267,
- /* 300 */ 1335, 1320, 1320, 1335, 1287, 1295, 1294, 1301, 1172, 1407,
- /* 310 */ 1408, 1422, 1422, 1433, 1433, 1433, 1433, 1566, 1566, 1566,
- /* 320 */ 1566, 1566, 1566, 1566, 1566, 558, 537, 684, 719, 734,
- /* 330 */ 799, 840, 1019, 14, 1020, 1021, 1025, 1026, 1027, 1070,
- /* 340 */ 1072, 997, 1047, 999, 1079, 1126, 1074, 1141, 694, 819,
- /* 350 */ 1174, 1136, 981, 1445, 1451, 1434, 1313, 1448, 1398, 1450,
- /* 360 */ 1444, 1446, 1348, 1339, 1360, 1349, 1453, 1350, 1458, 1475,
- /* 370 */ 1354, 1347, 1401, 1402, 1403, 1404, 1372, 1388, 1452, 1364,
- /* 380 */ 1484, 1483, 1467, 1383, 1351, 1439, 1468, 1440, 1441, 1457,
- /* 390 */ 1395, 1479, 1485, 1487, 1392, 1405, 1486, 1455, 1489, 1490,
- /* 400 */ 1491, 1493, 1461, 1480, 1494, 1465, 1481, 1495, 1496, 1498,
- /* 410 */ 1497, 1406, 1502, 1503, 1505, 1499, 1409, 1506, 1507, 1432,
- /* 420 */ 1500, 1510, 1410, 1511, 1501, 1512, 1504, 1517, 1511, 1518,
- /* 430 */ 1519, 1520, 1521, 1522, 1524, 1533, 1525, 1527, 1509, 1526,
- /* 440 */ 1528, 1531, 1530, 1526, 1532, 1534, 1535, 1536, 1538, 1428,
- /* 450 */ 1435, 1442, 1443, 1539, 1546, 1562,
+ /* 0 */ 355, 888, 1021, 909, 1063, 1063, 1063, 1063, 20, -19,
+ /* 10 */ 66, 66, 170, 1063, 1063, 1063, 1063, 1063, 1063, 1063,
+ /* 20 */ -7, -7, 36, 73, 69, 27, 118, 222, 274, 326,
+ /* 30 */ 378, 430, 482, 534, 589, 644, 696, 696, 696, 696,
+ /* 40 */ 696, 696, 696, 696, 696, 696, 696, 696, 696, 696,
+ /* 50 */ 696, 696, 696, 748, 696, 799, 849, 849, 980, 1063,
+ /* 60 */ 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063,
+ /* 70 */ 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063,
+ /* 80 */ 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063,
+ /* 90 */ 1083, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063, 1063,
+ /* 100 */ 1063, 1063, 1063, 1063, -43, 1120, 1120, 1120, 1120, 1120,
+ /* 110 */ -31, -72, -84, 242, 1152, 667, 210, 210, 242, 309,
+ /* 120 */ 336, -55, 1566, 1566, 1566, 850, 850, 850, 626, 626,
+ /* 130 */ 588, 588, 898, 221, 264, 242, 242, 242, 242, 242,
+ /* 140 */ 242, 242, 242, 242, 242, 242, 242, 242, 242, 242,
+ /* 150 */ 242, 242, 242, 242, 242, 496, 675, 289, 289, 336,
+ /* 160 */ 0, 0, 0, 0, 0, 0, 1566, 1566, 1566, 570,
+ /* 170 */ 98, 98, 958, 389, 450, 968, 1013, 1032, 1027, 242,
+ /* 180 */ 242, 242, 242, 242, 242, 242, 242, 242, 242, 242,
+ /* 190 */ 242, 242, 242, 242, 242, 1082, 1082, 1082, 242, 242,
+ /* 200 */ 533, 242, 242, 242, 987, 242, 242, 1208, 242, 242,
+ /* 210 */ 242, 242, 242, 242, 242, 242, 242, 242, 435, 531,
+ /* 220 */ 1001, 1001, 1001, 832, 434, 1266, 594, 58, 863, 863,
+ /* 230 */ 952, 58, 952, 946, 738, 239, 145, 863, 525, 145,
+ /* 240 */ 145, 315, 647, 790, 1174, 1119, 1119, 1204, 1204, 1119,
+ /* 250 */ 1250, 1232, 1147, 1263, 1263, 1263, 1263, 1119, 1265, 1147,
+ /* 260 */ 1250, 1232, 1232, 1147, 1119, 1265, 1186, 1297, 1119, 1119,
+ /* 270 */ 1265, 1372, 1119, 1265, 1119, 1265, 1372, 1294, 1294, 1294,
+ /* 280 */ 1342, 1372, 1294, 1301, 1294, 1342, 1294, 1294, 1286, 1306,
+ /* 290 */ 1286, 1306, 1286, 1306, 1286, 1306, 1119, 1398, 1119, 1285,
+ /* 300 */ 1372, 1334, 1334, 1372, 1304, 1308, 1307, 1309, 1147, 1412,
+ /* 310 */ 1413, 1428, 1428, 1439, 1439, 1439, 1566, 1566, 1566, 1566,
+ /* 320 */ 1566, 1566, 1566, 1566, 204, 321, 429, 467, 578, 497,
+ /* 330 */ 904, 739, 1051, 793, 794, 798, 800, 802, 838, 768,
+ /* 340 */ 766, 801, 762, 847, 853, 812, 891, 681, 784, 896,
+ /* 350 */ 864, 996, 1457, 1459, 1441, 1322, 1450, 1385, 1451, 1445,
+ /* 360 */ 1446, 1350, 1340, 1361, 1352, 1453, 1353, 1461, 1478, 1357,
+ /* 370 */ 1351, 1430, 1431, 1432, 1433, 1370, 1391, 1454, 1367, 1489,
+ /* 380 */ 1486, 1470, 1386, 1355, 1429, 1471, 1434, 1424, 1458, 1393,
+ /* 390 */ 1479, 1482, 1485, 1394, 1400, 1487, 1442, 1488, 1490, 1484,
+ /* 400 */ 1491, 1448, 1483, 1493, 1452, 1480, 1496, 1497, 1498, 1499,
+ /* 410 */ 1406, 1494, 1500, 1502, 1501, 1404, 1505, 1506, 1435, 1503,
+ /* 420 */ 1508, 1408, 1507, 1504, 1509, 1510, 1511, 1507, 1513, 1516,
+ /* 430 */ 1517, 1515, 1519, 1521, 1534, 1523, 1525, 1524, 1526, 1527,
+ /* 440 */ 1529, 1530, 1526, 1532, 1531, 1533, 1535, 1537, 1427, 1438,
+ /* 450 */ 1440, 1443, 1538, 1542, 1562,
};
-#define YY_REDUCE_USE_DFLT (-174)
-#define YY_REDUCE_COUNT (324)
-#define YY_REDUCE_MIN (-173)
-#define YY_REDUCE_MAX (1293)
+#define YY_REDUCE_USE_DFLT (-144)
+#define YY_REDUCE_COUNT (323)
+#define YY_REDUCE_MIN (-143)
+#define YY_REDUCE_MAX (1305)
static const short yy_reduce_ofst[] = {
- /* 0 */ -119, 1014, 131, 1031, -12, 225, 228, 300, -40, -45,
- /* 10 */ 243, 256, 293, 129, 218, 418, 79, 376, 433, 298,
- /* 20 */ 16, 137, 367, 323, -38, 391, -173, -173, -173, -173,
- /* 30 */ -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,
- /* 40 */ -173, -173, -173, -173, -173, -173, -173, -173, -173, -173,
- /* 50 */ -173, -173, -173, -173, -173, -173, -173, -173, 374, 437,
- /* 60 */ 443, 508, 513, 522, 532, 582, 584, 620, 633, 635,
- /* 70 */ 637, 644, 646, 648, 650, 652, 659, 661, 696, 709,
- /* 80 */ 711, 714, 720, 722, 724, 726, 728, 733, 772, 784,
- /* 90 */ 786, 822, 834, 836, 884, 886, 922, 934, 936, 986,
- /* 100 */ 989, 1008, 1016, 1018, -173, -173, -173, -173, -173, -173,
- /* 110 */ -173, -173, -173, 544, -37, 274, 299, 501, 161, -173,
- /* 120 */ 193, -173, -173, -173, -173, 22, 22, 22, 64, 141,
- /* 130 */ 212, 342, 208, 504, 504, 132, 494, 606, 677, 678,
- /* 140 */ 750, 794, 796, -58, 32, 383, 660, 737, 386, 787,
- /* 150 */ 800, 441, 872, 224, 850, 803, 949, 624, 830, 669,
- /* 160 */ 961, 979, 983, 1011, 1013, 1032, 753, 789, 321, 94,
- /* 170 */ 116, 304, 375, 210, 388, 392, 478, 545, 649, 721,
- /* 180 */ 727, 736, 752, 795, 853, 952, 958, 1004, 1040, 1046,
- /* 190 */ 1049, 1050, 1056, 1059, 1067, 559, 774, 811, 1068, 1080,
- /* 200 */ 938, 1082, 1083, 1088, 962, 1089, 1090, 1052, 1093, 1094,
- /* 210 */ 1095, 388, 1096, 1103, 1104, 1105, 1106, 1107, 965, 998,
- /* 220 */ 1055, 1057, 1058, 938, 1069, 1071, 1120, 1073, 1061, 1062,
- /* 230 */ 1033, 1076, 1039, 1108, 1087, 1099, 1111, 1066, 1054, 1112,
- /* 240 */ 1113, 1091, 1084, 1135, 1060, 1133, 1138, 1064, 1081, 1139,
- /* 250 */ 1100, 1119, 1109, 1124, 1127, 1140, 1142, 1168, 1173, 1132,
- /* 260 */ 1115, 1147, 1148, 1137, 1180, 1182, 1110, 1121, 1188, 1189,
- /* 270 */ 1197, 1181, 1200, 1202, 1205, 1203, 1191, 1192, 1199, 1206,
- /* 280 */ 1207, 1209, 1210, 1211, 1214, 1212, 1218, 1219, 1175, 1183,
- /* 290 */ 1185, 1184, 1186, 1190, 1187, 1196, 1237, 1193, 1253, 1194,
- /* 300 */ 1236, 1195, 1198, 1238, 1213, 1221, 1220, 1227, 1229, 1271,
- /* 310 */ 1275, 1284, 1285, 1289, 1290, 1292, 1293, 1201, 1208, 1216,
- /* 320 */ 1280, 1281, 1264, 1269, 1283,
+ /* 0 */ -143, -65, 140, 840, 76, 180, 182, 233, 488, -25,
+ /* 10 */ 12, 16, 59, 885, 907, 935, 390, 705, 954, 285,
+ /* 20 */ 997, 1017, 1018, -118, 1025, 139, 171, 171, 171, 171,
+ /* 30 */ 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
+ /* 40 */ 171, 171, 171, 171, 171, 171, 171, 171, 171, 171,
+ /* 50 */ 171, 171, 171, 171, 171, 171, 171, 171, -69, 287,
+ /* 60 */ 441, 658, 708, 856, 1050, 1073, 1076, 1079, 1081, 1084,
+ /* 70 */ 1086, 1088, 1091, 1113, 1115, 1117, 1122, 1124, 1126, 1128,
+ /* 80 */ 1130, 1141, 1153, 1156, 1159, 1163, 1165, 1167, 1170, 1172,
+ /* 90 */ 1175, 1178, 1181, 1189, 1194, 1197, 1200, 1203, 1205, 1207,
+ /* 100 */ 1211, 1213, 1216, 1219, 171, 171, 171, 171, 171, 171,
+ /* 110 */ 171, 171, 171, 49, 176, 220, 275, 278, 290, 171,
+ /* 120 */ 300, 171, 171, 171, 171, -85, -85, -85, -28, 77,
+ /* 130 */ 313, 317, -56, 252, 252, 446, -129, 243, 361, 403,
+ /* 140 */ 406, 513, 517, 409, 502, 518, 504, 509, 621, 553,
+ /* 150 */ 562, 619, 559, 93, 620, 465, 453, 550, 591, 571,
+ /* 160 */ 615, 666, 750, 752, 797, 819, 463, 548, -73, 28,
+ /* 170 */ 68, 120, 257, 206, 359, 405, 413, 452, 457, 560,
+ /* 180 */ 566, 617, 670, 720, 723, 769, 773, 775, 780, 813,
+ /* 190 */ 814, 821, 822, 823, 826, 360, 436, 783, 829, 835,
+ /* 200 */ 707, 862, 867, 878, 830, 911, 915, 883, 936, 937,
+ /* 210 */ 940, 359, 942, 943, 944, 979, 982, 984, 886, 899,
+ /* 220 */ 928, 929, 931, 707, 947, 945, 998, 949, 932, 969,
+ /* 230 */ 918, 953, 924, 992, 1005, 1010, 1016, 971, 965, 1019,
+ /* 240 */ 1049, 1000, 1028, 1074, 989, 1078, 1080, 1026, 1031, 1109,
+ /* 250 */ 1053, 1090, 1103, 1092, 1099, 1114, 1118, 1148, 1151, 1111,
+ /* 260 */ 1096, 1129, 1131, 1133, 1162, 1202, 1138, 1146, 1231, 1234,
+ /* 270 */ 1206, 1218, 1237, 1239, 1240, 1242, 1221, 1228, 1229, 1230,
+ /* 280 */ 1224, 1233, 1235, 1236, 1241, 1226, 1243, 1244, 1198, 1201,
+ /* 290 */ 1209, 1212, 1210, 1214, 1215, 1217, 1260, 1199, 1262, 1220,
+ /* 300 */ 1247, 1222, 1223, 1253, 1238, 1245, 1251, 1246, 1249, 1276,
+ /* 310 */ 1279, 1289, 1291, 1296, 1302, 1305, 1225, 1227, 1248, 1290,
+ /* 320 */ 1292, 1280, 1281, 1295,
};
static const YYACTIONTYPE yy_default[] = {
- /* 0 */ 1280, 1270, 1270, 1270, 1202, 1202, 1202, 1202, 1270, 1096,
- /* 10 */ 1125, 1125, 1254, 1332, 1332, 1332, 1332, 1332, 1332, 1201,
- /* 20 */ 1332, 1332, 1332, 1332, 1270, 1100, 1131, 1332, 1332, 1332,
- /* 30 */ 1332, 1203, 1204, 1332, 1332, 1332, 1253, 1255, 1141, 1140,
- /* 40 */ 1139, 1138, 1236, 1112, 1136, 1129, 1133, 1203, 1197, 1198,
- /* 50 */ 1196, 1200, 1204, 1332, 1132, 1167, 1181, 1166, 1332, 1332,
- /* 60 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
- /* 70 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
- /* 80 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
- /* 90 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
- /* 100 */ 1332, 1332, 1332, 1332, 1175, 1180, 1187, 1179, 1176, 1169,
- /* 110 */ 1168, 1170, 1171, 1332, 1019, 1067, 1332, 1332, 1332, 1172,
- /* 120 */ 1332, 1173, 1184, 1183, 1182, 1261, 1288, 1287, 1332, 1332,
- /* 130 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
- /* 140 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
- /* 150 */ 1332, 1332, 1332, 1332, 1332, 1280, 1270, 1025, 1025, 1332,
- /* 160 */ 1270, 1270, 1270, 1270, 1270, 1270, 1266, 1100, 1091, 1332,
- /* 170 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
- /* 180 */ 1258, 1256, 1332, 1217, 1332, 1332, 1332, 1332, 1332, 1332,
- /* 190 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
- /* 200 */ 1332, 1332, 1332, 1332, 1096, 1332, 1332, 1332, 1332, 1332,
- /* 210 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1282, 1332, 1231,
- /* 220 */ 1096, 1096, 1096, 1098, 1080, 1090, 1004, 1135, 1114, 1114,
- /* 230 */ 1321, 1135, 1321, 1042, 1302, 1039, 1125, 1114, 1199, 1125,
- /* 240 */ 1125, 1097, 1090, 1332, 1324, 1105, 1105, 1323, 1323, 1105,
- /* 250 */ 1146, 1070, 1135, 1076, 1076, 1076, 1076, 1105, 1016, 1135,
- /* 260 */ 1146, 1070, 1070, 1135, 1105, 1016, 1235, 1318, 1105, 1105,
- /* 270 */ 1016, 1210, 1105, 1016, 1105, 1016, 1210, 1068, 1068, 1068,
- /* 280 */ 1057, 1210, 1068, 1042, 1068, 1057, 1068, 1068, 1118, 1113,
- /* 290 */ 1118, 1113, 1118, 1113, 1118, 1113, 1105, 1205, 1105, 1332,
- /* 300 */ 1210, 1214, 1214, 1210, 1130, 1119, 1128, 1126, 1135, 1022,
- /* 310 */ 1060, 1285, 1285, 1281, 1281, 1281, 1281, 1329, 1329, 1266,
- /* 320 */ 1297, 1297, 1044, 1044, 1297, 1332, 1332, 1332, 1332, 1332,
- /* 330 */ 1332, 1292, 1332, 1219, 1332, 1332, 1332, 1332, 1332, 1332,
- /* 340 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
- /* 350 */ 1332, 1332, 1152, 1332, 1000, 1263, 1332, 1332, 1262, 1332,
- /* 360 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
- /* 370 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1320,
- /* 380 */ 1332, 1332, 1332, 1332, 1332, 1332, 1234, 1233, 1332, 1332,
- /* 390 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
- /* 400 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332,
- /* 410 */ 1332, 1082, 1332, 1332, 1332, 1306, 1332, 1332, 1332, 1332,
- /* 420 */ 1332, 1332, 1332, 1127, 1332, 1120, 1332, 1332, 1311, 1332,
- /* 430 */ 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1332, 1272,
- /* 440 */ 1332, 1332, 1332, 1271, 1332, 1332, 1332, 1332, 1332, 1154,
- /* 450 */ 1332, 1153, 1157, 1332, 1010, 1332,
+ /* 0 */ 1270, 1260, 1260, 1260, 1193, 1193, 1193, 1193, 1260, 1088,
+ /* 10 */ 1117, 1117, 1244, 1322, 1322, 1322, 1322, 1322, 1322, 1192,
+ /* 20 */ 1322, 1322, 1322, 1322, 1260, 1092, 1123, 1322, 1322, 1322,
+ /* 30 */ 1322, 1194, 1195, 1322, 1322, 1322, 1243, 1245, 1133, 1132,
+ /* 40 */ 1131, 1130, 1226, 1104, 1128, 1121, 1125, 1194, 1188, 1189,
+ /* 50 */ 1187, 1191, 1195, 1322, 1124, 1158, 1172, 1157, 1322, 1322,
+ /* 60 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
+ /* 70 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
+ /* 80 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
+ /* 90 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
+ /* 100 */ 1322, 1322, 1322, 1322, 1166, 1171, 1178, 1170, 1167, 1160,
+ /* 110 */ 1159, 1161, 1162, 1322, 1011, 1059, 1322, 1322, 1322, 1163,
+ /* 120 */ 1322, 1164, 1175, 1174, 1173, 1251, 1278, 1277, 1322, 1322,
+ /* 130 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
+ /* 140 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
+ /* 150 */ 1322, 1322, 1322, 1322, 1322, 1270, 1260, 1017, 1017, 1322,
+ /* 160 */ 1260, 1260, 1260, 1260, 1260, 1260, 1256, 1092, 1083, 1322,
+ /* 170 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
+ /* 180 */ 1248, 1246, 1322, 1208, 1322, 1322, 1322, 1322, 1322, 1322,
+ /* 190 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
+ /* 200 */ 1322, 1322, 1322, 1322, 1088, 1322, 1322, 1322, 1322, 1322,
+ /* 210 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1272, 1322, 1221,
+ /* 220 */ 1088, 1088, 1088, 1090, 1072, 1082, 997, 1127, 1106, 1106,
+ /* 230 */ 1311, 1127, 1311, 1034, 1292, 1031, 1117, 1106, 1190, 1117,
+ /* 240 */ 1117, 1089, 1082, 1322, 1314, 1097, 1097, 1313, 1313, 1097,
+ /* 250 */ 1138, 1062, 1127, 1068, 1068, 1068, 1068, 1097, 1008, 1127,
+ /* 260 */ 1138, 1062, 1062, 1127, 1097, 1008, 1225, 1308, 1097, 1097,
+ /* 270 */ 1008, 1201, 1097, 1008, 1097, 1008, 1201, 1060, 1060, 1060,
+ /* 280 */ 1049, 1201, 1060, 1034, 1060, 1049, 1060, 1060, 1110, 1105,
+ /* 290 */ 1110, 1105, 1110, 1105, 1110, 1105, 1097, 1196, 1097, 1322,
+ /* 300 */ 1201, 1205, 1205, 1201, 1122, 1111, 1120, 1118, 1127, 1014,
+ /* 310 */ 1052, 1275, 1275, 1271, 1271, 1271, 1319, 1319, 1256, 1287,
+ /* 320 */ 1287, 1036, 1036, 1287, 1322, 1322, 1322, 1322, 1322, 1322,
+ /* 330 */ 1282, 1322, 1210, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
+ /* 340 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
+ /* 350 */ 1322, 1143, 1322, 993, 1253, 1322, 1322, 1252, 1322, 1322,
+ /* 360 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
+ /* 370 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1310, 1322,
+ /* 380 */ 1322, 1322, 1322, 1322, 1322, 1224, 1223, 1322, 1322, 1322,
+ /* 390 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
+ /* 400 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322,
+ /* 410 */ 1074, 1322, 1322, 1322, 1296, 1322, 1322, 1322, 1322, 1322,
+ /* 420 */ 1322, 1322, 1119, 1322, 1112, 1322, 1322, 1301, 1322, 1322,
+ /* 430 */ 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1322, 1262, 1322,
+ /* 440 */ 1322, 1322, 1261, 1322, 1322, 1322, 1322, 1322, 1145, 1322,
+ /* 450 */ 1144, 1148, 1322, 1002, 1322,
};
/********** End of lemon-generated parsing tables *****************************/
@@ -136294,73 +137785,87 @@ static const YYACTIONTYPE yy_default[] = {
static const YYCODETYPE yyFallback[] = {
0, /* $ => nothing */
0, /* SEMI => nothing */
- 27, /* EXPLAIN => ID */
- 27, /* QUERY => ID */
- 27, /* PLAN => ID */
- 27, /* BEGIN => ID */
+ 59, /* EXPLAIN => ID */
+ 59, /* QUERY => ID */
+ 59, /* PLAN => ID */
+ 59, /* BEGIN => ID */
0, /* TRANSACTION => nothing */
- 27, /* DEFERRED => ID */
- 27, /* IMMEDIATE => ID */
- 27, /* EXCLUSIVE => ID */
+ 59, /* DEFERRED => ID */
+ 59, /* IMMEDIATE => ID */
+ 59, /* EXCLUSIVE => ID */
0, /* COMMIT => nothing */
- 27, /* END => ID */
- 27, /* ROLLBACK => ID */
- 27, /* SAVEPOINT => ID */
- 27, /* RELEASE => ID */
+ 59, /* END => ID */
+ 59, /* ROLLBACK => ID */
+ 59, /* SAVEPOINT => ID */
+ 59, /* RELEASE => ID */
0, /* TO => nothing */
0, /* TABLE => nothing */
0, /* CREATE => nothing */
- 27, /* IF => ID */
+ 59, /* IF => ID */
0, /* NOT => nothing */
0, /* EXISTS => nothing */
- 27, /* TEMP => ID */
+ 59, /* TEMP => ID */
0, /* LP => nothing */
0, /* RP => nothing */
0, /* AS => nothing */
- 27, /* WITHOUT => ID */
+ 59, /* WITHOUT => ID */
0, /* COMMA => nothing */
+ 59, /* ABORT => ID */
+ 59, /* ACTION => ID */
+ 59, /* AFTER => ID */
+ 59, /* ANALYZE => ID */
+ 59, /* ASC => ID */
+ 59, /* ATTACH => ID */
+ 59, /* BEFORE => ID */
+ 59, /* BY => ID */
+ 59, /* CASCADE => ID */
+ 59, /* CAST => ID */
+ 59, /* CONFLICT => ID */
+ 59, /* DATABASE => ID */
+ 59, /* DESC => ID */
+ 59, /* DETACH => ID */
+ 59, /* EACH => ID */
+ 59, /* FAIL => ID */
+ 0, /* OR => nothing */
+ 0, /* AND => nothing */
+ 0, /* IS => nothing */
+ 59, /* MATCH => ID */
+ 59, /* LIKE_KW => ID */
+ 0, /* BETWEEN => nothing */
+ 0, /* IN => nothing */
+ 0, /* ISNULL => nothing */
+ 0, /* NOTNULL => nothing */
+ 0, /* NE => nothing */
+ 0, /* EQ => nothing */
+ 0, /* GT => nothing */
+ 0, /* LE => nothing */
+ 0, /* LT => nothing */
+ 0, /* GE => nothing */
+ 0, /* ESCAPE => nothing */
0, /* ID => nothing */
- 27, /* ABORT => ID */
- 27, /* ACTION => ID */
- 27, /* AFTER => ID */
- 27, /* ANALYZE => ID */
- 27, /* ASC => ID */
- 27, /* ATTACH => ID */
- 27, /* BEFORE => ID */
- 27, /* BY => ID */
- 27, /* CASCADE => ID */
- 27, /* CAST => ID */
- 27, /* COLUMNKW => ID */
- 27, /* CONFLICT => ID */
- 27, /* DATABASE => ID */
- 27, /* DESC => ID */
- 27, /* DETACH => ID */
- 27, /* EACH => ID */
- 27, /* FAIL => ID */
- 27, /* FOR => ID */
- 27, /* IGNORE => ID */
- 27, /* INITIALLY => ID */
- 27, /* INSTEAD => ID */
- 27, /* LIKE_KW => ID */
- 27, /* MATCH => ID */
- 27, /* NO => ID */
- 27, /* KEY => ID */
- 27, /* OF => ID */
- 27, /* OFFSET => ID */
- 27, /* PRAGMA => ID */
- 27, /* RAISE => ID */
- 27, /* RECURSIVE => ID */
- 27, /* REPLACE => ID */
- 27, /* RESTRICT => ID */
- 27, /* ROW => ID */
- 27, /* TRIGGER => ID */
- 27, /* VACUUM => ID */
- 27, /* VIEW => ID */
- 27, /* VIRTUAL => ID */
- 27, /* WITH => ID */
- 27, /* REINDEX => ID */
- 27, /* RENAME => ID */
- 27, /* CTIME_KW => ID */
+ 59, /* COLUMNKW => ID */
+ 59, /* FOR => ID */
+ 59, /* IGNORE => ID */
+ 59, /* INITIALLY => ID */
+ 59, /* INSTEAD => ID */
+ 59, /* NO => ID */
+ 59, /* KEY => ID */
+ 59, /* OF => ID */
+ 59, /* OFFSET => ID */
+ 59, /* PRAGMA => ID */
+ 59, /* RAISE => ID */
+ 59, /* RECURSIVE => ID */
+ 59, /* REPLACE => ID */
+ 59, /* RESTRICT => ID */
+ 59, /* ROW => ID */
+ 59, /* TRIGGER => ID */
+ 59, /* VACUUM => ID */
+ 59, /* VIEW => ID */
+ 59, /* VIRTUAL => ID */
+ 59, /* WITH => ID */
+ 59, /* REINDEX => ID */
+ 59, /* RENAME => ID */
+ 59, /* CTIME_KW => ID */
};
#endif /* YYFALLBACK */
@@ -136406,6 +137911,7 @@ struct yyParser {
yyStackEntry yystk0; /* First stack entry */
#else
yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */
+ yyStackEntry *yystackEnd; /* Last entry in the stack */
#endif
};
typedef struct yyParser yyParser;
@@ -136452,21 +137958,21 @@ static const char *const yyTokenName[] = {
"ROLLBACK", "SAVEPOINT", "RELEASE", "TO",
"TABLE", "CREATE", "IF", "NOT",
"EXISTS", "TEMP", "LP", "RP",
- "AS", "WITHOUT", "COMMA", "ID",
- "ABORT", "ACTION", "AFTER", "ANALYZE",
- "ASC", "ATTACH", "BEFORE", "BY",
- "CASCADE", "CAST", "COLUMNKW", "CONFLICT",
- "DATABASE", "DESC", "DETACH", "EACH",
- "FAIL", "FOR", "IGNORE", "INITIALLY",
- "INSTEAD", "LIKE_KW", "MATCH", "NO",
- "KEY", "OF", "OFFSET", "PRAGMA",
- "RAISE", "RECURSIVE", "REPLACE", "RESTRICT",
- "ROW", "TRIGGER", "VACUUM", "VIEW",
- "VIRTUAL", "WITH", "REINDEX", "RENAME",
- "CTIME_KW", "ANY", "OR", "AND",
- "IS", "BETWEEN", "IN", "ISNULL",
- "NOTNULL", "NE", "EQ", "GT",
- "LE", "LT", "GE", "ESCAPE",
+ "AS", "WITHOUT", "COMMA", "ABORT",
+ "ACTION", "AFTER", "ANALYZE", "ASC",
+ "ATTACH", "BEFORE", "BY", "CASCADE",
+ "CAST", "CONFLICT", "DATABASE", "DESC",
+ "DETACH", "EACH", "FAIL", "OR",
+ "AND", "IS", "MATCH", "LIKE_KW",
+ "BETWEEN", "IN", "ISNULL", "NOTNULL",
+ "NE", "EQ", "GT", "LE",
+ "LT", "GE", "ESCAPE", "ID",
+ "COLUMNKW", "FOR", "IGNORE", "INITIALLY",
+ "INSTEAD", "NO", "KEY", "OF",
+ "OFFSET", "PRAGMA", "RAISE", "RECURSIVE",
+ "REPLACE", "RESTRICT", "ROW", "TRIGGER",
+ "VACUUM", "VIEW", "VIRTUAL", "WITH",
+ "REINDEX", "RENAME", "CTIME_KW", "ANY",
"BITAND", "BITOR", "LSHIFT", "RSHIFT",
"PLUS", "MINUS", "STAR", "SLASH",
"REM", "CONCAT", "COLLATE", "BITNOT",
@@ -136524,330 +138030,327 @@ static const char *const yyRuleName[] = {
/* 5 */ "transtype ::= DEFERRED",
/* 6 */ "transtype ::= IMMEDIATE",
/* 7 */ "transtype ::= EXCLUSIVE",
- /* 8 */ "cmd ::= COMMIT trans_opt",
- /* 9 */ "cmd ::= END trans_opt",
- /* 10 */ "cmd ::= ROLLBACK trans_opt",
- /* 11 */ "cmd ::= SAVEPOINT nm",
- /* 12 */ "cmd ::= RELEASE savepoint_opt nm",
- /* 13 */ "cmd ::= ROLLBACK trans_opt TO savepoint_opt nm",
- /* 14 */ "create_table ::= createkw temp TABLE ifnotexists nm dbnm",
- /* 15 */ "createkw ::= CREATE",
- /* 16 */ "ifnotexists ::=",
- /* 17 */ "ifnotexists ::= IF NOT EXISTS",
- /* 18 */ "temp ::= TEMP",
- /* 19 */ "temp ::=",
- /* 20 */ "create_table_args ::= LP columnlist conslist_opt RP table_options",
- /* 21 */ "create_table_args ::= AS select",
- /* 22 */ "table_options ::=",
- /* 23 */ "table_options ::= WITHOUT nm",
- /* 24 */ "columnname ::= nm typetoken",
- /* 25 */ "typetoken ::=",
- /* 26 */ "typetoken ::= typename LP signed RP",
- /* 27 */ "typetoken ::= typename LP signed COMMA signed RP",
- /* 28 */ "typename ::= typename ID|STRING",
- /* 29 */ "ccons ::= CONSTRAINT nm",
- /* 30 */ "ccons ::= DEFAULT term",
- /* 31 */ "ccons ::= DEFAULT LP expr RP",
- /* 32 */ "ccons ::= DEFAULT PLUS term",
- /* 33 */ "ccons ::= DEFAULT MINUS term",
- /* 34 */ "ccons ::= DEFAULT ID|INDEXED",
- /* 35 */ "ccons ::= NOT NULL onconf",
- /* 36 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc",
- /* 37 */ "ccons ::= UNIQUE onconf",
- /* 38 */ "ccons ::= CHECK LP expr RP",
- /* 39 */ "ccons ::= REFERENCES nm eidlist_opt refargs",
- /* 40 */ "ccons ::= defer_subclause",
- /* 41 */ "ccons ::= COLLATE ID|STRING",
- /* 42 */ "autoinc ::=",
- /* 43 */ "autoinc ::= AUTOINCR",
- /* 44 */ "refargs ::=",
- /* 45 */ "refargs ::= refargs refarg",
- /* 46 */ "refarg ::= MATCH nm",
- /* 47 */ "refarg ::= ON INSERT refact",
- /* 48 */ "refarg ::= ON DELETE refact",
- /* 49 */ "refarg ::= ON UPDATE refact",
- /* 50 */ "refact ::= SET NULL",
- /* 51 */ "refact ::= SET DEFAULT",
- /* 52 */ "refact ::= CASCADE",
- /* 53 */ "refact ::= RESTRICT",
- /* 54 */ "refact ::= NO ACTION",
- /* 55 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt",
- /* 56 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt",
- /* 57 */ "init_deferred_pred_opt ::=",
- /* 58 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED",
- /* 59 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE",
- /* 60 */ "conslist_opt ::=",
- /* 61 */ "tconscomma ::= COMMA",
- /* 62 */ "tcons ::= CONSTRAINT nm",
- /* 63 */ "tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf",
- /* 64 */ "tcons ::= UNIQUE LP sortlist RP onconf",
- /* 65 */ "tcons ::= CHECK LP expr RP onconf",
- /* 66 */ "tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt",
- /* 67 */ "defer_subclause_opt ::=",
- /* 68 */ "onconf ::=",
- /* 69 */ "onconf ::= ON CONFLICT resolvetype",
- /* 70 */ "orconf ::=",
- /* 71 */ "orconf ::= OR resolvetype",
- /* 72 */ "resolvetype ::= IGNORE",
- /* 73 */ "resolvetype ::= REPLACE",
- /* 74 */ "cmd ::= DROP TABLE ifexists fullname",
- /* 75 */ "ifexists ::= IF EXISTS",
- /* 76 */ "ifexists ::=",
- /* 77 */ "cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select",
- /* 78 */ "cmd ::= DROP VIEW ifexists fullname",
- /* 79 */ "cmd ::= select",
- /* 80 */ "select ::= with selectnowith",
- /* 81 */ "selectnowith ::= selectnowith multiselect_op oneselect",
- /* 82 */ "multiselect_op ::= UNION",
- /* 83 */ "multiselect_op ::= UNION ALL",
- /* 84 */ "multiselect_op ::= EXCEPT|INTERSECT",
- /* 85 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt",
- /* 86 */ "values ::= VALUES LP nexprlist RP",
- /* 87 */ "values ::= values COMMA LP exprlist RP",
- /* 88 */ "distinct ::= DISTINCT",
- /* 89 */ "distinct ::= ALL",
- /* 90 */ "distinct ::=",
- /* 91 */ "sclp ::=",
- /* 92 */ "selcollist ::= sclp expr as",
- /* 93 */ "selcollist ::= sclp STAR",
- /* 94 */ "selcollist ::= sclp nm DOT STAR",
- /* 95 */ "as ::= AS nm",
- /* 96 */ "as ::=",
- /* 97 */ "from ::=",
- /* 98 */ "from ::= FROM seltablist",
- /* 99 */ "stl_prefix ::= seltablist joinop",
- /* 100 */ "stl_prefix ::=",
- /* 101 */ "seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt",
- /* 102 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt",
- /* 103 */ "seltablist ::= stl_prefix LP select RP as on_opt using_opt",
- /* 104 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt",
- /* 105 */ "dbnm ::=",
- /* 106 */ "dbnm ::= DOT nm",
- /* 107 */ "fullname ::= nm dbnm",
- /* 108 */ "joinop ::= COMMA|JOIN",
- /* 109 */ "joinop ::= JOIN_KW JOIN",
- /* 110 */ "joinop ::= JOIN_KW nm JOIN",
- /* 111 */ "joinop ::= JOIN_KW nm nm JOIN",
- /* 112 */ "on_opt ::= ON expr",
- /* 113 */ "on_opt ::=",
- /* 114 */ "indexed_opt ::=",
- /* 115 */ "indexed_opt ::= INDEXED BY nm",
- /* 116 */ "indexed_opt ::= NOT INDEXED",
- /* 117 */ "using_opt ::= USING LP idlist RP",
- /* 118 */ "using_opt ::=",
- /* 119 */ "orderby_opt ::=",
- /* 120 */ "orderby_opt ::= ORDER BY sortlist",
- /* 121 */ "sortlist ::= sortlist COMMA expr sortorder",
- /* 122 */ "sortlist ::= expr sortorder",
- /* 123 */ "sortorder ::= ASC",
- /* 124 */ "sortorder ::= DESC",
- /* 125 */ "sortorder ::=",
- /* 126 */ "groupby_opt ::=",
- /* 127 */ "groupby_opt ::= GROUP BY nexprlist",
- /* 128 */ "having_opt ::=",
- /* 129 */ "having_opt ::= HAVING expr",
- /* 130 */ "limit_opt ::=",
- /* 131 */ "limit_opt ::= LIMIT expr",
- /* 132 */ "limit_opt ::= LIMIT expr OFFSET expr",
- /* 133 */ "limit_opt ::= LIMIT expr COMMA expr",
- /* 134 */ "cmd ::= with DELETE FROM fullname indexed_opt where_opt",
- /* 135 */ "where_opt ::=",
- /* 136 */ "where_opt ::= WHERE expr",
- /* 137 */ "cmd ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt",
- /* 138 */ "setlist ::= setlist COMMA nm EQ expr",
- /* 139 */ "setlist ::= setlist COMMA LP idlist RP EQ expr",
- /* 140 */ "setlist ::= nm EQ expr",
- /* 141 */ "setlist ::= LP idlist RP EQ expr",
- /* 142 */ "cmd ::= with insert_cmd INTO fullname idlist_opt select",
- /* 143 */ "cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES",
- /* 144 */ "insert_cmd ::= INSERT orconf",
- /* 145 */ "insert_cmd ::= REPLACE",
- /* 146 */ "idlist_opt ::=",
- /* 147 */ "idlist_opt ::= LP idlist RP",
- /* 148 */ "idlist ::= idlist COMMA nm",
- /* 149 */ "idlist ::= nm",
- /* 150 */ "expr ::= LP expr RP",
- /* 151 */ "term ::= NULL",
- /* 152 */ "expr ::= ID|INDEXED",
- /* 153 */ "expr ::= JOIN_KW",
- /* 154 */ "expr ::= nm DOT nm",
- /* 155 */ "expr ::= nm DOT nm DOT nm",
- /* 156 */ "term ::= FLOAT|BLOB",
- /* 157 */ "term ::= STRING",
- /* 158 */ "term ::= INTEGER",
- /* 159 */ "expr ::= VARIABLE",
- /* 160 */ "expr ::= expr COLLATE ID|STRING",
- /* 161 */ "expr ::= CAST LP expr AS typetoken RP",
- /* 162 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
- /* 163 */ "expr ::= ID|INDEXED LP STAR RP",
- /* 164 */ "term ::= CTIME_KW",
- /* 165 */ "expr ::= LP nexprlist COMMA expr RP",
- /* 166 */ "expr ::= expr AND expr",
- /* 167 */ "expr ::= expr OR expr",
- /* 168 */ "expr ::= expr LT|GT|GE|LE expr",
- /* 169 */ "expr ::= expr EQ|NE expr",
- /* 170 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
- /* 171 */ "expr ::= expr PLUS|MINUS expr",
- /* 172 */ "expr ::= expr STAR|SLASH|REM expr",
- /* 173 */ "expr ::= expr CONCAT expr",
- /* 174 */ "likeop ::= NOT LIKE_KW|MATCH",
- /* 175 */ "expr ::= expr likeop expr",
- /* 176 */ "expr ::= expr likeop expr ESCAPE expr",
- /* 177 */ "expr ::= expr ISNULL|NOTNULL",
- /* 178 */ "expr ::= expr NOT NULL",
- /* 179 */ "expr ::= expr IS expr",
- /* 180 */ "expr ::= expr IS NOT expr",
- /* 181 */ "expr ::= NOT expr",
- /* 182 */ "expr ::= BITNOT expr",
- /* 183 */ "expr ::= MINUS expr",
- /* 184 */ "expr ::= PLUS expr",
- /* 185 */ "between_op ::= BETWEEN",
- /* 186 */ "between_op ::= NOT BETWEEN",
- /* 187 */ "expr ::= expr between_op expr AND expr",
- /* 188 */ "in_op ::= IN",
- /* 189 */ "in_op ::= NOT IN",
- /* 190 */ "expr ::= expr in_op LP exprlist RP",
- /* 191 */ "expr ::= LP select RP",
- /* 192 */ "expr ::= expr in_op LP select RP",
- /* 193 */ "expr ::= expr in_op nm dbnm paren_exprlist",
- /* 194 */ "expr ::= EXISTS LP select RP",
- /* 195 */ "expr ::= CASE case_operand case_exprlist case_else END",
- /* 196 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
- /* 197 */ "case_exprlist ::= WHEN expr THEN expr",
- /* 198 */ "case_else ::= ELSE expr",
- /* 199 */ "case_else ::=",
- /* 200 */ "case_operand ::= expr",
- /* 201 */ "case_operand ::=",
- /* 202 */ "exprlist ::=",
- /* 203 */ "nexprlist ::= nexprlist COMMA expr",
- /* 204 */ "nexprlist ::= expr",
- /* 205 */ "paren_exprlist ::=",
- /* 206 */ "paren_exprlist ::= LP exprlist RP",
- /* 207 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
- /* 208 */ "uniqueflag ::= UNIQUE",
- /* 209 */ "uniqueflag ::=",
- /* 210 */ "eidlist_opt ::=",
- /* 211 */ "eidlist_opt ::= LP eidlist RP",
- /* 212 */ "eidlist ::= eidlist COMMA nm collate sortorder",
- /* 213 */ "eidlist ::= nm collate sortorder",
- /* 214 */ "collate ::=",
- /* 215 */ "collate ::= COLLATE ID|STRING",
- /* 216 */ "cmd ::= DROP INDEX ifexists fullname",
- /* 217 */ "cmd ::= VACUUM",
- /* 218 */ "cmd ::= VACUUM nm",
- /* 219 */ "cmd ::= PRAGMA nm dbnm",
- /* 220 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
- /* 221 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
- /* 222 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
- /* 223 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
- /* 224 */ "plus_num ::= PLUS INTEGER|FLOAT",
- /* 225 */ "minus_num ::= MINUS INTEGER|FLOAT",
- /* 226 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
- /* 227 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
- /* 228 */ "trigger_time ::= BEFORE",
- /* 229 */ "trigger_time ::= AFTER",
- /* 230 */ "trigger_time ::= INSTEAD OF",
- /* 231 */ "trigger_time ::=",
- /* 232 */ "trigger_event ::= DELETE|INSERT",
- /* 233 */ "trigger_event ::= UPDATE",
- /* 234 */ "trigger_event ::= UPDATE OF idlist",
- /* 235 */ "when_clause ::=",
- /* 236 */ "when_clause ::= WHEN expr",
- /* 237 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
- /* 238 */ "trigger_cmd_list ::= trigger_cmd SEMI",
- /* 239 */ "trnm ::= nm DOT nm",
- /* 240 */ "tridxby ::= INDEXED BY nm",
- /* 241 */ "tridxby ::= NOT INDEXED",
- /* 242 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt",
- /* 243 */ "trigger_cmd ::= insert_cmd INTO trnm idlist_opt select",
- /* 244 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt",
- /* 245 */ "trigger_cmd ::= select",
- /* 246 */ "expr ::= RAISE LP IGNORE RP",
- /* 247 */ "expr ::= RAISE LP raisetype COMMA nm RP",
- /* 248 */ "raisetype ::= ROLLBACK",
- /* 249 */ "raisetype ::= ABORT",
- /* 250 */ "raisetype ::= FAIL",
- /* 251 */ "cmd ::= DROP TRIGGER ifexists fullname",
- /* 252 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
- /* 253 */ "cmd ::= DETACH database_kw_opt expr",
- /* 254 */ "key_opt ::=",
- /* 255 */ "key_opt ::= KEY expr",
- /* 256 */ "cmd ::= REINDEX",
- /* 257 */ "cmd ::= REINDEX nm dbnm",
- /* 258 */ "cmd ::= ANALYZE",
- /* 259 */ "cmd ::= ANALYZE nm dbnm",
- /* 260 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
- /* 261 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
- /* 262 */ "add_column_fullname ::= fullname",
- /* 263 */ "cmd ::= create_vtab",
- /* 264 */ "cmd ::= create_vtab LP vtabarglist RP",
- /* 265 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
- /* 266 */ "vtabarg ::=",
- /* 267 */ "vtabargtoken ::= ANY",
- /* 268 */ "vtabargtoken ::= lp anylist RP",
- /* 269 */ "lp ::= LP",
- /* 270 */ "with ::=",
- /* 271 */ "with ::= WITH wqlist",
- /* 272 */ "with ::= WITH RECURSIVE wqlist",
- /* 273 */ "wqlist ::= nm eidlist_opt AS LP select RP",
- /* 274 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
- /* 275 */ "input ::= cmdlist",
- /* 276 */ "cmdlist ::= cmdlist ecmd",
- /* 277 */ "cmdlist ::= ecmd",
- /* 278 */ "ecmd ::= SEMI",
- /* 279 */ "ecmd ::= explain cmdx SEMI",
- /* 280 */ "explain ::=",
- /* 281 */ "trans_opt ::=",
- /* 282 */ "trans_opt ::= TRANSACTION",
- /* 283 */ "trans_opt ::= TRANSACTION nm",
- /* 284 */ "savepoint_opt ::= SAVEPOINT",
- /* 285 */ "savepoint_opt ::=",
- /* 286 */ "cmd ::= create_table create_table_args",
- /* 287 */ "columnlist ::= columnlist COMMA columnname carglist",
- /* 288 */ "columnlist ::= columnname carglist",
- /* 289 */ "nm ::= ID|INDEXED",
- /* 290 */ "nm ::= STRING",
- /* 291 */ "nm ::= JOIN_KW",
- /* 292 */ "typetoken ::= typename",
- /* 293 */ "typename ::= ID|STRING",
- /* 294 */ "signed ::= plus_num",
- /* 295 */ "signed ::= minus_num",
- /* 296 */ "carglist ::= carglist ccons",
- /* 297 */ "carglist ::=",
- /* 298 */ "ccons ::= NULL onconf",
- /* 299 */ "conslist_opt ::= COMMA conslist",
- /* 300 */ "conslist ::= conslist tconscomma tcons",
- /* 301 */ "conslist ::= tcons",
- /* 302 */ "tconscomma ::=",
- /* 303 */ "defer_subclause_opt ::= defer_subclause",
- /* 304 */ "resolvetype ::= raisetype",
- /* 305 */ "selectnowith ::= oneselect",
- /* 306 */ "oneselect ::= values",
- /* 307 */ "sclp ::= selcollist COMMA",
- /* 308 */ "as ::= ID|STRING",
- /* 309 */ "expr ::= term",
- /* 310 */ "likeop ::= LIKE_KW|MATCH",
- /* 311 */ "exprlist ::= nexprlist",
- /* 312 */ "nmnum ::= plus_num",
- /* 313 */ "nmnum ::= nm",
- /* 314 */ "nmnum ::= ON",
- /* 315 */ "nmnum ::= DELETE",
- /* 316 */ "nmnum ::= DEFAULT",
- /* 317 */ "plus_num ::= INTEGER|FLOAT",
- /* 318 */ "foreach_clause ::=",
- /* 319 */ "foreach_clause ::= FOR EACH ROW",
- /* 320 */ "trnm ::= nm",
- /* 321 */ "tridxby ::=",
- /* 322 */ "database_kw_opt ::= DATABASE",
- /* 323 */ "database_kw_opt ::=",
- /* 324 */ "kwcolumn_opt ::=",
- /* 325 */ "kwcolumn_opt ::= COLUMNKW",
- /* 326 */ "vtabarglist ::= vtabarg",
- /* 327 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
- /* 328 */ "vtabarg ::= vtabarg vtabargtoken",
- /* 329 */ "anylist ::=",
- /* 330 */ "anylist ::= anylist LP anylist RP",
- /* 331 */ "anylist ::= anylist ANY",
+ /* 8 */ "cmd ::= COMMIT|END trans_opt",
+ /* 9 */ "cmd ::= ROLLBACK trans_opt",
+ /* 10 */ "cmd ::= SAVEPOINT nm",
+ /* 11 */ "cmd ::= RELEASE savepoint_opt nm",
+ /* 12 */ "cmd ::= ROLLBACK trans_opt TO savepoint_opt nm",
+ /* 13 */ "create_table ::= createkw temp TABLE ifnotexists nm dbnm",
+ /* 14 */ "createkw ::= CREATE",
+ /* 15 */ "ifnotexists ::=",
+ /* 16 */ "ifnotexists ::= IF NOT EXISTS",
+ /* 17 */ "temp ::= TEMP",
+ /* 18 */ "temp ::=",
+ /* 19 */ "create_table_args ::= LP columnlist conslist_opt RP table_options",
+ /* 20 */ "create_table_args ::= AS select",
+ /* 21 */ "table_options ::=",
+ /* 22 */ "table_options ::= WITHOUT nm",
+ /* 23 */ "columnname ::= nm typetoken",
+ /* 24 */ "typetoken ::=",
+ /* 25 */ "typetoken ::= typename LP signed RP",
+ /* 26 */ "typetoken ::= typename LP signed COMMA signed RP",
+ /* 27 */ "typename ::= typename ID|STRING",
+ /* 28 */ "ccons ::= CONSTRAINT nm",
+ /* 29 */ "ccons ::= DEFAULT term",
+ /* 30 */ "ccons ::= DEFAULT LP expr RP",
+ /* 31 */ "ccons ::= DEFAULT PLUS term",
+ /* 32 */ "ccons ::= DEFAULT MINUS term",
+ /* 33 */ "ccons ::= DEFAULT ID|INDEXED",
+ /* 34 */ "ccons ::= NOT NULL onconf",
+ /* 35 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc",
+ /* 36 */ "ccons ::= UNIQUE onconf",
+ /* 37 */ "ccons ::= CHECK LP expr RP",
+ /* 38 */ "ccons ::= REFERENCES nm eidlist_opt refargs",
+ /* 39 */ "ccons ::= defer_subclause",
+ /* 40 */ "ccons ::= COLLATE ID|STRING",
+ /* 41 */ "autoinc ::=",
+ /* 42 */ "autoinc ::= AUTOINCR",
+ /* 43 */ "refargs ::=",
+ /* 44 */ "refargs ::= refargs refarg",
+ /* 45 */ "refarg ::= MATCH nm",
+ /* 46 */ "refarg ::= ON INSERT refact",
+ /* 47 */ "refarg ::= ON DELETE refact",
+ /* 48 */ "refarg ::= ON UPDATE refact",
+ /* 49 */ "refact ::= SET NULL",
+ /* 50 */ "refact ::= SET DEFAULT",
+ /* 51 */ "refact ::= CASCADE",
+ /* 52 */ "refact ::= RESTRICT",
+ /* 53 */ "refact ::= NO ACTION",
+ /* 54 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt",
+ /* 55 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt",
+ /* 56 */ "init_deferred_pred_opt ::=",
+ /* 57 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED",
+ /* 58 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE",
+ /* 59 */ "conslist_opt ::=",
+ /* 60 */ "tconscomma ::= COMMA",
+ /* 61 */ "tcons ::= CONSTRAINT nm",
+ /* 62 */ "tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf",
+ /* 63 */ "tcons ::= UNIQUE LP sortlist RP onconf",
+ /* 64 */ "tcons ::= CHECK LP expr RP onconf",
+ /* 65 */ "tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt",
+ /* 66 */ "defer_subclause_opt ::=",
+ /* 67 */ "onconf ::=",
+ /* 68 */ "onconf ::= ON CONFLICT resolvetype",
+ /* 69 */ "orconf ::=",
+ /* 70 */ "orconf ::= OR resolvetype",
+ /* 71 */ "resolvetype ::= IGNORE",
+ /* 72 */ "resolvetype ::= REPLACE",
+ /* 73 */ "cmd ::= DROP TABLE ifexists fullname",
+ /* 74 */ "ifexists ::= IF EXISTS",
+ /* 75 */ "ifexists ::=",
+ /* 76 */ "cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select",
+ /* 77 */ "cmd ::= DROP VIEW ifexists fullname",
+ /* 78 */ "cmd ::= select",
+ /* 79 */ "select ::= with selectnowith",
+ /* 80 */ "selectnowith ::= selectnowith multiselect_op oneselect",
+ /* 81 */ "multiselect_op ::= UNION",
+ /* 82 */ "multiselect_op ::= UNION ALL",
+ /* 83 */ "multiselect_op ::= EXCEPT|INTERSECT",
+ /* 84 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt",
+ /* 85 */ "values ::= VALUES LP nexprlist RP",
+ /* 86 */ "values ::= values COMMA LP exprlist RP",
+ /* 87 */ "distinct ::= DISTINCT",
+ /* 88 */ "distinct ::= ALL",
+ /* 89 */ "distinct ::=",
+ /* 90 */ "sclp ::=",
+ /* 91 */ "selcollist ::= sclp expr as",
+ /* 92 */ "selcollist ::= sclp STAR",
+ /* 93 */ "selcollist ::= sclp nm DOT STAR",
+ /* 94 */ "as ::= AS nm",
+ /* 95 */ "as ::=",
+ /* 96 */ "from ::=",
+ /* 97 */ "from ::= FROM seltablist",
+ /* 98 */ "stl_prefix ::= seltablist joinop",
+ /* 99 */ "stl_prefix ::=",
+ /* 100 */ "seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt",
+ /* 101 */ "seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt",
+ /* 102 */ "seltablist ::= stl_prefix LP select RP as on_opt using_opt",
+ /* 103 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt",
+ /* 104 */ "dbnm ::=",
+ /* 105 */ "dbnm ::= DOT nm",
+ /* 106 */ "fullname ::= nm dbnm",
+ /* 107 */ "joinop ::= COMMA|JOIN",
+ /* 108 */ "joinop ::= JOIN_KW JOIN",
+ /* 109 */ "joinop ::= JOIN_KW nm JOIN",
+ /* 110 */ "joinop ::= JOIN_KW nm nm JOIN",
+ /* 111 */ "on_opt ::= ON expr",
+ /* 112 */ "on_opt ::=",
+ /* 113 */ "indexed_opt ::=",
+ /* 114 */ "indexed_opt ::= INDEXED BY nm",
+ /* 115 */ "indexed_opt ::= NOT INDEXED",
+ /* 116 */ "using_opt ::= USING LP idlist RP",
+ /* 117 */ "using_opt ::=",
+ /* 118 */ "orderby_opt ::=",
+ /* 119 */ "orderby_opt ::= ORDER BY sortlist",
+ /* 120 */ "sortlist ::= sortlist COMMA expr sortorder",
+ /* 121 */ "sortlist ::= expr sortorder",
+ /* 122 */ "sortorder ::= ASC",
+ /* 123 */ "sortorder ::= DESC",
+ /* 124 */ "sortorder ::=",
+ /* 125 */ "groupby_opt ::=",
+ /* 126 */ "groupby_opt ::= GROUP BY nexprlist",
+ /* 127 */ "having_opt ::=",
+ /* 128 */ "having_opt ::= HAVING expr",
+ /* 129 */ "limit_opt ::=",
+ /* 130 */ "limit_opt ::= LIMIT expr",
+ /* 131 */ "limit_opt ::= LIMIT expr OFFSET expr",
+ /* 132 */ "limit_opt ::= LIMIT expr COMMA expr",
+ /* 133 */ "cmd ::= with DELETE FROM fullname indexed_opt where_opt",
+ /* 134 */ "where_opt ::=",
+ /* 135 */ "where_opt ::= WHERE expr",
+ /* 136 */ "cmd ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt",
+ /* 137 */ "setlist ::= setlist COMMA nm EQ expr",
+ /* 138 */ "setlist ::= setlist COMMA LP idlist RP EQ expr",
+ /* 139 */ "setlist ::= nm EQ expr",
+ /* 140 */ "setlist ::= LP idlist RP EQ expr",
+ /* 141 */ "cmd ::= with insert_cmd INTO fullname idlist_opt select",
+ /* 142 */ "cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES",
+ /* 143 */ "insert_cmd ::= INSERT orconf",
+ /* 144 */ "insert_cmd ::= REPLACE",
+ /* 145 */ "idlist_opt ::=",
+ /* 146 */ "idlist_opt ::= LP idlist RP",
+ /* 147 */ "idlist ::= idlist COMMA nm",
+ /* 148 */ "idlist ::= nm",
+ /* 149 */ "expr ::= LP expr RP",
+ /* 150 */ "expr ::= ID|INDEXED",
+ /* 151 */ "expr ::= JOIN_KW",
+ /* 152 */ "expr ::= nm DOT nm",
+ /* 153 */ "expr ::= nm DOT nm DOT nm",
+ /* 154 */ "term ::= NULL|FLOAT|BLOB",
+ /* 155 */ "term ::= STRING",
+ /* 156 */ "term ::= INTEGER",
+ /* 157 */ "expr ::= VARIABLE",
+ /* 158 */ "expr ::= expr COLLATE ID|STRING",
+ /* 159 */ "expr ::= CAST LP expr AS typetoken RP",
+ /* 160 */ "expr ::= ID|INDEXED LP distinct exprlist RP",
+ /* 161 */ "expr ::= ID|INDEXED LP STAR RP",
+ /* 162 */ "term ::= CTIME_KW",
+ /* 163 */ "expr ::= LP nexprlist COMMA expr RP",
+ /* 164 */ "expr ::= expr AND expr",
+ /* 165 */ "expr ::= expr OR expr",
+ /* 166 */ "expr ::= expr LT|GT|GE|LE expr",
+ /* 167 */ "expr ::= expr EQ|NE expr",
+ /* 168 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr",
+ /* 169 */ "expr ::= expr PLUS|MINUS expr",
+ /* 170 */ "expr ::= expr STAR|SLASH|REM expr",
+ /* 171 */ "expr ::= expr CONCAT expr",
+ /* 172 */ "likeop ::= NOT LIKE_KW|MATCH",
+ /* 173 */ "expr ::= expr likeop expr",
+ /* 174 */ "expr ::= expr likeop expr ESCAPE expr",
+ /* 175 */ "expr ::= expr ISNULL|NOTNULL",
+ /* 176 */ "expr ::= expr NOT NULL",
+ /* 177 */ "expr ::= expr IS expr",
+ /* 178 */ "expr ::= expr IS NOT expr",
+ /* 179 */ "expr ::= NOT expr",
+ /* 180 */ "expr ::= BITNOT expr",
+ /* 181 */ "expr ::= MINUS expr",
+ /* 182 */ "expr ::= PLUS expr",
+ /* 183 */ "between_op ::= BETWEEN",
+ /* 184 */ "between_op ::= NOT BETWEEN",
+ /* 185 */ "expr ::= expr between_op expr AND expr",
+ /* 186 */ "in_op ::= IN",
+ /* 187 */ "in_op ::= NOT IN",
+ /* 188 */ "expr ::= expr in_op LP exprlist RP",
+ /* 189 */ "expr ::= LP select RP",
+ /* 190 */ "expr ::= expr in_op LP select RP",
+ /* 191 */ "expr ::= expr in_op nm dbnm paren_exprlist",
+ /* 192 */ "expr ::= EXISTS LP select RP",
+ /* 193 */ "expr ::= CASE case_operand case_exprlist case_else END",
+ /* 194 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr",
+ /* 195 */ "case_exprlist ::= WHEN expr THEN expr",
+ /* 196 */ "case_else ::= ELSE expr",
+ /* 197 */ "case_else ::=",
+ /* 198 */ "case_operand ::= expr",
+ /* 199 */ "case_operand ::=",
+ /* 200 */ "exprlist ::=",
+ /* 201 */ "nexprlist ::= nexprlist COMMA expr",
+ /* 202 */ "nexprlist ::= expr",
+ /* 203 */ "paren_exprlist ::=",
+ /* 204 */ "paren_exprlist ::= LP exprlist RP",
+ /* 205 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt",
+ /* 206 */ "uniqueflag ::= UNIQUE",
+ /* 207 */ "uniqueflag ::=",
+ /* 208 */ "eidlist_opt ::=",
+ /* 209 */ "eidlist_opt ::= LP eidlist RP",
+ /* 210 */ "eidlist ::= eidlist COMMA nm collate sortorder",
+ /* 211 */ "eidlist ::= nm collate sortorder",
+ /* 212 */ "collate ::=",
+ /* 213 */ "collate ::= COLLATE ID|STRING",
+ /* 214 */ "cmd ::= DROP INDEX ifexists fullname",
+ /* 215 */ "cmd ::= VACUUM",
+ /* 216 */ "cmd ::= VACUUM nm",
+ /* 217 */ "cmd ::= PRAGMA nm dbnm",
+ /* 218 */ "cmd ::= PRAGMA nm dbnm EQ nmnum",
+ /* 219 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP",
+ /* 220 */ "cmd ::= PRAGMA nm dbnm EQ minus_num",
+ /* 221 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP",
+ /* 222 */ "plus_num ::= PLUS INTEGER|FLOAT",
+ /* 223 */ "minus_num ::= MINUS INTEGER|FLOAT",
+ /* 224 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END",
+ /* 225 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause",
+ /* 226 */ "trigger_time ::= BEFORE|AFTER",
+ /* 227 */ "trigger_time ::= INSTEAD OF",
+ /* 228 */ "trigger_time ::=",
+ /* 229 */ "trigger_event ::= DELETE|INSERT",
+ /* 230 */ "trigger_event ::= UPDATE",
+ /* 231 */ "trigger_event ::= UPDATE OF idlist",
+ /* 232 */ "when_clause ::=",
+ /* 233 */ "when_clause ::= WHEN expr",
+ /* 234 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI",
+ /* 235 */ "trigger_cmd_list ::= trigger_cmd SEMI",
+ /* 236 */ "trnm ::= nm DOT nm",
+ /* 237 */ "tridxby ::= INDEXED BY nm",
+ /* 238 */ "tridxby ::= NOT INDEXED",
+ /* 239 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt",
+ /* 240 */ "trigger_cmd ::= insert_cmd INTO trnm idlist_opt select",
+ /* 241 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt",
+ /* 242 */ "trigger_cmd ::= select",
+ /* 243 */ "expr ::= RAISE LP IGNORE RP",
+ /* 244 */ "expr ::= RAISE LP raisetype COMMA nm RP",
+ /* 245 */ "raisetype ::= ROLLBACK",
+ /* 246 */ "raisetype ::= ABORT",
+ /* 247 */ "raisetype ::= FAIL",
+ /* 248 */ "cmd ::= DROP TRIGGER ifexists fullname",
+ /* 249 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt",
+ /* 250 */ "cmd ::= DETACH database_kw_opt expr",
+ /* 251 */ "key_opt ::=",
+ /* 252 */ "key_opt ::= KEY expr",
+ /* 253 */ "cmd ::= REINDEX",
+ /* 254 */ "cmd ::= REINDEX nm dbnm",
+ /* 255 */ "cmd ::= ANALYZE",
+ /* 256 */ "cmd ::= ANALYZE nm dbnm",
+ /* 257 */ "cmd ::= ALTER TABLE fullname RENAME TO nm",
+ /* 258 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist",
+ /* 259 */ "add_column_fullname ::= fullname",
+ /* 260 */ "cmd ::= create_vtab",
+ /* 261 */ "cmd ::= create_vtab LP vtabarglist RP",
+ /* 262 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm",
+ /* 263 */ "vtabarg ::=",
+ /* 264 */ "vtabargtoken ::= ANY",
+ /* 265 */ "vtabargtoken ::= lp anylist RP",
+ /* 266 */ "lp ::= LP",
+ /* 267 */ "with ::=",
+ /* 268 */ "with ::= WITH wqlist",
+ /* 269 */ "with ::= WITH RECURSIVE wqlist",
+ /* 270 */ "wqlist ::= nm eidlist_opt AS LP select RP",
+ /* 271 */ "wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP",
+ /* 272 */ "input ::= cmdlist",
+ /* 273 */ "cmdlist ::= cmdlist ecmd",
+ /* 274 */ "cmdlist ::= ecmd",
+ /* 275 */ "ecmd ::= SEMI",
+ /* 276 */ "ecmd ::= explain cmdx SEMI",
+ /* 277 */ "explain ::=",
+ /* 278 */ "trans_opt ::=",
+ /* 279 */ "trans_opt ::= TRANSACTION",
+ /* 280 */ "trans_opt ::= TRANSACTION nm",
+ /* 281 */ "savepoint_opt ::= SAVEPOINT",
+ /* 282 */ "savepoint_opt ::=",
+ /* 283 */ "cmd ::= create_table create_table_args",
+ /* 284 */ "columnlist ::= columnlist COMMA columnname carglist",
+ /* 285 */ "columnlist ::= columnname carglist",
+ /* 286 */ "nm ::= ID|INDEXED",
+ /* 287 */ "nm ::= STRING",
+ /* 288 */ "nm ::= JOIN_KW",
+ /* 289 */ "typetoken ::= typename",
+ /* 290 */ "typename ::= ID|STRING",
+ /* 291 */ "signed ::= plus_num",
+ /* 292 */ "signed ::= minus_num",
+ /* 293 */ "carglist ::= carglist ccons",
+ /* 294 */ "carglist ::=",
+ /* 295 */ "ccons ::= NULL onconf",
+ /* 296 */ "conslist_opt ::= COMMA conslist",
+ /* 297 */ "conslist ::= conslist tconscomma tcons",
+ /* 298 */ "conslist ::= tcons",
+ /* 299 */ "tconscomma ::=",
+ /* 300 */ "defer_subclause_opt ::= defer_subclause",
+ /* 301 */ "resolvetype ::= raisetype",
+ /* 302 */ "selectnowith ::= oneselect",
+ /* 303 */ "oneselect ::= values",
+ /* 304 */ "sclp ::= selcollist COMMA",
+ /* 305 */ "as ::= ID|STRING",
+ /* 306 */ "expr ::= term",
+ /* 307 */ "likeop ::= LIKE_KW|MATCH",
+ /* 308 */ "exprlist ::= nexprlist",
+ /* 309 */ "nmnum ::= plus_num",
+ /* 310 */ "nmnum ::= nm",
+ /* 311 */ "nmnum ::= ON",
+ /* 312 */ "nmnum ::= DELETE",
+ /* 313 */ "nmnum ::= DEFAULT",
+ /* 314 */ "plus_num ::= INTEGER|FLOAT",
+ /* 315 */ "foreach_clause ::=",
+ /* 316 */ "foreach_clause ::= FOR EACH ROW",
+ /* 317 */ "trnm ::= nm",
+ /* 318 */ "tridxby ::=",
+ /* 319 */ "database_kw_opt ::= DATABASE",
+ /* 320 */ "database_kw_opt ::=",
+ /* 321 */ "kwcolumn_opt ::=",
+ /* 322 */ "kwcolumn_opt ::= COLUMNKW",
+ /* 323 */ "vtabarglist ::= vtabarg",
+ /* 324 */ "vtabarglist ::= vtabarglist COMMA vtabarg",
+ /* 325 */ "vtabarg ::= vtabarg vtabargtoken",
+ /* 326 */ "anylist ::=",
+ /* 327 */ "anylist ::= anylist LP anylist RP",
+ /* 328 */ "anylist ::= anylist ANY",
};
#endif /* NDEBUG */
@@ -136916,6 +138419,9 @@ SQLITE_PRIVATE void sqlite3ParserInit(void *yypParser){
pParser->yytos = pParser->yystack;
pParser->yystack[0].stateno = 0;
pParser->yystack[0].major = 0;
+#if YYSTACKDEPTH>0
+ pParser->yystackEnd = &pParser->yystack[YYSTACKDEPTH-1];
+#endif
}
#ifndef sqlite3Parser_ENGINEALWAYSONSTACK
@@ -137258,7 +138764,7 @@ static void yy_shift(
}
#endif
#if YYSTACKDEPTH>0
- if( yypParser->yytos>=&yypParser->yystack[YYSTACKDEPTH] ){
+ if( yypParser->yytos>yypParser->yystackEnd ){
yypParser->yytos--;
yyStackOverflow(yypParser);
return;
@@ -137286,341 +138792,338 @@ static void yy_shift(
** is used during the reduce.
*/
static const struct {
- YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
- unsigned char nrhs; /* Number of right-hand side symbols in the rule */
+ YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
+ signed char nrhs; /* Negative of the number of RHS symbols in the rule */
} yyRuleInfo[] = {
- { 147, 1 },
- { 147, 3 },
- { 148, 1 },
- { 149, 3 },
+ { 147, -1 },
+ { 147, -3 },
+ { 148, -1 },
+ { 149, -3 },
{ 150, 0 },
- { 150, 1 },
- { 150, 1 },
- { 150, 1 },
- { 149, 2 },
- { 149, 2 },
- { 149, 2 },
- { 149, 2 },
- { 149, 3 },
- { 149, 5 },
- { 154, 6 },
- { 156, 1 },
+ { 150, -1 },
+ { 150, -1 },
+ { 150, -1 },
+ { 149, -2 },
+ { 149, -2 },
+ { 149, -2 },
+ { 149, -3 },
+ { 149, -5 },
+ { 154, -6 },
+ { 156, -1 },
{ 158, 0 },
- { 158, 3 },
- { 157, 1 },
+ { 158, -3 },
+ { 157, -1 },
{ 157, 0 },
- { 155, 5 },
- { 155, 2 },
+ { 155, -5 },
+ { 155, -2 },
{ 162, 0 },
- { 162, 2 },
- { 164, 2 },
+ { 162, -2 },
+ { 164, -2 },
{ 166, 0 },
- { 166, 4 },
- { 166, 6 },
- { 167, 2 },
- { 171, 2 },
- { 171, 2 },
- { 171, 4 },
- { 171, 3 },
- { 171, 3 },
- { 171, 2 },
- { 171, 3 },
- { 171, 5 },
- { 171, 2 },
- { 171, 4 },
- { 171, 4 },
- { 171, 1 },
- { 171, 2 },
+ { 166, -4 },
+ { 166, -6 },
+ { 167, -2 },
+ { 171, -2 },
+ { 171, -2 },
+ { 171, -4 },
+ { 171, -3 },
+ { 171, -3 },
+ { 171, -2 },
+ { 171, -3 },
+ { 171, -5 },
+ { 171, -2 },
+ { 171, -4 },
+ { 171, -4 },
+ { 171, -1 },
+ { 171, -2 },
{ 176, 0 },
- { 176, 1 },
+ { 176, -1 },
{ 178, 0 },
- { 178, 2 },
- { 180, 2 },
- { 180, 3 },
- { 180, 3 },
- { 180, 3 },
- { 181, 2 },
- { 181, 2 },
- { 181, 1 },
- { 181, 1 },
- { 181, 2 },
- { 179, 3 },
- { 179, 2 },
+ { 178, -2 },
+ { 180, -2 },
+ { 180, -3 },
+ { 180, -3 },
+ { 180, -3 },
+ { 181, -2 },
+ { 181, -2 },
+ { 181, -1 },
+ { 181, -1 },
+ { 181, -2 },
+ { 179, -3 },
+ { 179, -2 },
{ 182, 0 },
- { 182, 2 },
- { 182, 2 },
+ { 182, -2 },
+ { 182, -2 },
{ 161, 0 },
- { 184, 1 },
- { 185, 2 },
- { 185, 7 },
- { 185, 5 },
- { 185, 5 },
- { 185, 10 },
+ { 184, -1 },
+ { 185, -2 },
+ { 185, -7 },
+ { 185, -5 },
+ { 185, -5 },
+ { 185, -10 },
{ 188, 0 },
{ 174, 0 },
- { 174, 3 },
+ { 174, -3 },
{ 189, 0 },
- { 189, 2 },
- { 190, 1 },
- { 190, 1 },
- { 149, 4 },
- { 192, 2 },
+ { 189, -2 },
+ { 190, -1 },
+ { 190, -1 },
+ { 149, -4 },
+ { 192, -2 },
{ 192, 0 },
- { 149, 9 },
- { 149, 4 },
- { 149, 1 },
- { 163, 2 },
- { 194, 3 },
- { 197, 1 },
- { 197, 2 },
- { 197, 1 },
- { 195, 9 },
- { 206, 4 },
- { 206, 5 },
- { 198, 1 },
- { 198, 1 },
+ { 149, -9 },
+ { 149, -4 },
+ { 149, -1 },
+ { 163, -2 },
+ { 194, -3 },
+ { 197, -1 },
+ { 197, -2 },
+ { 197, -1 },
+ { 195, -9 },
+ { 206, -4 },
+ { 206, -5 },
+ { 198, -1 },
+ { 198, -1 },
{ 198, 0 },
{ 209, 0 },
- { 199, 3 },
- { 199, 2 },
- { 199, 4 },
- { 210, 2 },
+ { 199, -3 },
+ { 199, -2 },
+ { 199, -4 },
+ { 210, -2 },
{ 210, 0 },
{ 200, 0 },
- { 200, 2 },
- { 212, 2 },
+ { 200, -2 },
+ { 212, -2 },
{ 212, 0 },
- { 211, 7 },
- { 211, 9 },
- { 211, 7 },
- { 211, 7 },
+ { 211, -7 },
+ { 211, -9 },
+ { 211, -7 },
+ { 211, -7 },
{ 159, 0 },
- { 159, 2 },
- { 193, 2 },
- { 213, 1 },
- { 213, 2 },
- { 213, 3 },
- { 213, 4 },
- { 215, 2 },
+ { 159, -2 },
+ { 193, -2 },
+ { 213, -1 },
+ { 213, -2 },
+ { 213, -3 },
+ { 213, -4 },
+ { 215, -2 },
{ 215, 0 },
{ 214, 0 },
- { 214, 3 },
- { 214, 2 },
- { 216, 4 },
+ { 214, -3 },
+ { 214, -2 },
+ { 216, -4 },
{ 216, 0 },
{ 204, 0 },
- { 204, 3 },
- { 186, 4 },
- { 186, 2 },
- { 175, 1 },
- { 175, 1 },
+ { 204, -3 },
+ { 186, -4 },
+ { 186, -2 },
+ { 175, -1 },
+ { 175, -1 },
{ 175, 0 },
{ 202, 0 },
- { 202, 3 },
+ { 202, -3 },
{ 203, 0 },
- { 203, 2 },
+ { 203, -2 },
{ 205, 0 },
- { 205, 2 },
- { 205, 4 },
- { 205, 4 },
- { 149, 6 },
+ { 205, -2 },
+ { 205, -4 },
+ { 205, -4 },
+ { 149, -6 },
{ 201, 0 },
- { 201, 2 },
- { 149, 8 },
- { 218, 5 },
- { 218, 7 },
- { 218, 3 },
- { 218, 5 },
- { 149, 6 },
- { 149, 7 },
- { 219, 2 },
- { 219, 1 },
+ { 201, -2 },
+ { 149, -8 },
+ { 218, -5 },
+ { 218, -7 },
+ { 218, -3 },
+ { 218, -5 },
+ { 149, -6 },
+ { 149, -7 },
+ { 219, -2 },
+ { 219, -1 },
{ 220, 0 },
- { 220, 3 },
- { 217, 3 },
- { 217, 1 },
- { 173, 3 },
- { 172, 1 },
- { 173, 1 },
- { 173, 1 },
- { 173, 3 },
- { 173, 5 },
- { 172, 1 },
- { 172, 1 },
- { 172, 1 },
- { 173, 1 },
- { 173, 3 },
- { 173, 6 },
- { 173, 5 },
- { 173, 4 },
- { 172, 1 },
- { 173, 5 },
- { 173, 3 },
- { 173, 3 },
- { 173, 3 },
- { 173, 3 },
- { 173, 3 },
- { 173, 3 },
- { 173, 3 },
- { 173, 3 },
- { 221, 2 },
- { 173, 3 },
- { 173, 5 },
- { 173, 2 },
- { 173, 3 },
- { 173, 3 },
- { 173, 4 },
- { 173, 2 },
- { 173, 2 },
- { 173, 2 },
- { 173, 2 },
- { 222, 1 },
- { 222, 2 },
- { 173, 5 },
- { 223, 1 },
- { 223, 2 },
- { 173, 5 },
- { 173, 3 },
- { 173, 5 },
- { 173, 5 },
- { 173, 4 },
- { 173, 5 },
- { 226, 5 },
- { 226, 4 },
- { 227, 2 },
+ { 220, -3 },
+ { 217, -3 },
+ { 217, -1 },
+ { 173, -3 },
+ { 173, -1 },
+ { 173, -1 },
+ { 173, -3 },
+ { 173, -5 },
+ { 172, -1 },
+ { 172, -1 },
+ { 172, -1 },
+ { 173, -1 },
+ { 173, -3 },
+ { 173, -6 },
+ { 173, -5 },
+ { 173, -4 },
+ { 172, -1 },
+ { 173, -5 },
+ { 173, -3 },
+ { 173, -3 },
+ { 173, -3 },
+ { 173, -3 },
+ { 173, -3 },
+ { 173, -3 },
+ { 173, -3 },
+ { 173, -3 },
+ { 221, -2 },
+ { 173, -3 },
+ { 173, -5 },
+ { 173, -2 },
+ { 173, -3 },
+ { 173, -3 },
+ { 173, -4 },
+ { 173, -2 },
+ { 173, -2 },
+ { 173, -2 },
+ { 173, -2 },
+ { 222, -1 },
+ { 222, -2 },
+ { 173, -5 },
+ { 223, -1 },
+ { 223, -2 },
+ { 173, -5 },
+ { 173, -3 },
+ { 173, -5 },
+ { 173, -5 },
+ { 173, -4 },
+ { 173, -5 },
+ { 226, -5 },
+ { 226, -4 },
+ { 227, -2 },
{ 227, 0 },
- { 225, 1 },
+ { 225, -1 },
{ 225, 0 },
{ 208, 0 },
- { 207, 3 },
- { 207, 1 },
+ { 207, -3 },
+ { 207, -1 },
{ 224, 0 },
- { 224, 3 },
- { 149, 12 },
- { 228, 1 },
+ { 224, -3 },
+ { 149, -12 },
+ { 228, -1 },
{ 228, 0 },
{ 177, 0 },
- { 177, 3 },
- { 187, 5 },
- { 187, 3 },
+ { 177, -3 },
+ { 187, -5 },
+ { 187, -3 },
{ 229, 0 },
- { 229, 2 },
- { 149, 4 },
- { 149, 1 },
- { 149, 2 },
- { 149, 3 },
- { 149, 5 },
- { 149, 6 },
- { 149, 5 },
- { 149, 6 },
- { 169, 2 },
- { 170, 2 },
- { 149, 5 },
- { 231, 11 },
- { 233, 1 },
- { 233, 1 },
- { 233, 2 },
+ { 229, -2 },
+ { 149, -4 },
+ { 149, -1 },
+ { 149, -2 },
+ { 149, -3 },
+ { 149, -5 },
+ { 149, -6 },
+ { 149, -5 },
+ { 149, -6 },
+ { 169, -2 },
+ { 170, -2 },
+ { 149, -5 },
+ { 231, -11 },
+ { 233, -1 },
+ { 233, -2 },
{ 233, 0 },
- { 234, 1 },
- { 234, 1 },
- { 234, 3 },
+ { 234, -1 },
+ { 234, -1 },
+ { 234, -3 },
{ 236, 0 },
- { 236, 2 },
- { 232, 3 },
- { 232, 2 },
- { 238, 3 },
- { 239, 3 },
- { 239, 2 },
- { 237, 7 },
- { 237, 5 },
- { 237, 5 },
- { 237, 1 },
- { 173, 4 },
- { 173, 6 },
- { 191, 1 },
- { 191, 1 },
- { 191, 1 },
- { 149, 4 },
- { 149, 6 },
- { 149, 3 },
+ { 236, -2 },
+ { 232, -3 },
+ { 232, -2 },
+ { 238, -3 },
+ { 239, -3 },
+ { 239, -2 },
+ { 237, -7 },
+ { 237, -5 },
+ { 237, -5 },
+ { 237, -1 },
+ { 173, -4 },
+ { 173, -6 },
+ { 191, -1 },
+ { 191, -1 },
+ { 191, -1 },
+ { 149, -4 },
+ { 149, -6 },
+ { 149, -3 },
{ 241, 0 },
- { 241, 2 },
- { 149, 1 },
- { 149, 3 },
- { 149, 1 },
- { 149, 3 },
- { 149, 6 },
- { 149, 7 },
- { 242, 1 },
- { 149, 1 },
- { 149, 4 },
- { 244, 8 },
+ { 241, -2 },
+ { 149, -1 },
+ { 149, -3 },
+ { 149, -1 },
+ { 149, -3 },
+ { 149, -6 },
+ { 149, -7 },
+ { 242, -1 },
+ { 149, -1 },
+ { 149, -4 },
+ { 244, -8 },
{ 246, 0 },
- { 247, 1 },
- { 247, 3 },
- { 248, 1 },
+ { 247, -1 },
+ { 247, -3 },
+ { 248, -1 },
{ 196, 0 },
- { 196, 2 },
- { 196, 3 },
- { 250, 6 },
- { 250, 8 },
- { 144, 1 },
- { 145, 2 },
- { 145, 1 },
- { 146, 1 },
- { 146, 3 },
+ { 196, -2 },
+ { 196, -3 },
+ { 250, -6 },
+ { 250, -8 },
+ { 144, -1 },
+ { 145, -2 },
+ { 145, -1 },
+ { 146, -1 },
+ { 146, -3 },
{ 147, 0 },
{ 151, 0 },
- { 151, 1 },
- { 151, 2 },
- { 153, 1 },
+ { 151, -1 },
+ { 151, -2 },
+ { 153, -1 },
{ 153, 0 },
- { 149, 2 },
- { 160, 4 },
- { 160, 2 },
- { 152, 1 },
- { 152, 1 },
- { 152, 1 },
- { 166, 1 },
- { 167, 1 },
- { 168, 1 },
- { 168, 1 },
- { 165, 2 },
+ { 149, -2 },
+ { 160, -4 },
+ { 160, -2 },
+ { 152, -1 },
+ { 152, -1 },
+ { 152, -1 },
+ { 166, -1 },
+ { 167, -1 },
+ { 168, -1 },
+ { 168, -1 },
+ { 165, -2 },
{ 165, 0 },
- { 171, 2 },
- { 161, 2 },
- { 183, 3 },
- { 183, 1 },
+ { 171, -2 },
+ { 161, -2 },
+ { 183, -3 },
+ { 183, -1 },
{ 184, 0 },
- { 188, 1 },
- { 190, 1 },
- { 194, 1 },
- { 195, 1 },
- { 209, 2 },
- { 210, 1 },
- { 173, 1 },
- { 221, 1 },
- { 208, 1 },
- { 230, 1 },
- { 230, 1 },
- { 230, 1 },
- { 230, 1 },
- { 230, 1 },
- { 169, 1 },
+ { 188, -1 },
+ { 190, -1 },
+ { 194, -1 },
+ { 195, -1 },
+ { 209, -2 },
+ { 210, -1 },
+ { 173, -1 },
+ { 221, -1 },
+ { 208, -1 },
+ { 230, -1 },
+ { 230, -1 },
+ { 230, -1 },
+ { 230, -1 },
+ { 230, -1 },
+ { 169, -1 },
{ 235, 0 },
- { 235, 3 },
- { 238, 1 },
+ { 235, -3 },
+ { 238, -1 },
{ 239, 0 },
- { 240, 1 },
+ { 240, -1 },
{ 240, 0 },
{ 243, 0 },
- { 243, 1 },
- { 245, 1 },
- { 245, 3 },
- { 246, 2 },
+ { 243, -1 },
+ { 245, -1 },
+ { 245, -3 },
+ { 246, -2 },
{ 249, 0 },
- { 249, 4 },
- { 249, 2 },
+ { 249, -4 },
+ { 249, -2 },
};
static void yy_accept(yyParser*); /* Forward Declaration */
@@ -137643,7 +139146,7 @@ static void yy_reduce(
if( yyTraceFILE && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){
yysize = yyRuleInfo[yyruleno].nrhs;
fprintf(yyTraceFILE, "%sReduce [%s], go to state %d.\n", yyTracePrompt,
- yyRuleName[yyruleno], yymsp[-yysize].stateno);
+ yyRuleName[yyruleno], yymsp[yysize].stateno);
}
#endif /* NDEBUG */
@@ -137658,7 +139161,7 @@ static void yy_reduce(
}
#endif
#if YYSTACKDEPTH>0
- if( yypParser->yytos>=&yypParser->yystack[YYSTACKDEPTH-1] ){
+ if( yypParser->yytos>=yypParser->yystackEnd ){
yyStackOverflow(yypParser);
return;
}
@@ -137704,66 +139207,63 @@ static void yy_reduce(
case 7: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==7);
{yymsp[0].minor.yy194 = yymsp[0].major; /*A-overwrites-X*/}
break;
- case 8: /* cmd ::= COMMIT trans_opt */
- case 9: /* cmd ::= END trans_opt */ yytestcase(yyruleno==9);
-{sqlite3CommitTransaction(pParse);}
- break;
- case 10: /* cmd ::= ROLLBACK trans_opt */
-{sqlite3RollbackTransaction(pParse);}
+ case 8: /* cmd ::= COMMIT|END trans_opt */
+ case 9: /* cmd ::= ROLLBACK trans_opt */ yytestcase(yyruleno==9);
+{sqlite3EndTransaction(pParse,yymsp[-1].major);}
break;
- case 11: /* cmd ::= SAVEPOINT nm */
+ case 10: /* cmd ::= SAVEPOINT nm */
{
sqlite3Savepoint(pParse, SAVEPOINT_BEGIN, &yymsp[0].minor.yy0);
}
break;
- case 12: /* cmd ::= RELEASE savepoint_opt nm */
+ case 11: /* cmd ::= RELEASE savepoint_opt nm */
{
sqlite3Savepoint(pParse, SAVEPOINT_RELEASE, &yymsp[0].minor.yy0);
}
break;
- case 13: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
+ case 12: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */
{
sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0);
}
break;
- case 14: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
+ case 13: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */
{
sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy194,0,0,yymsp[-2].minor.yy194);
}
break;
- case 15: /* createkw ::= CREATE */
+ case 14: /* createkw ::= CREATE */
{disableLookaside(pParse);}
break;
- case 16: /* ifnotexists ::= */
- case 19: /* temp ::= */ yytestcase(yyruleno==19);
- case 22: /* table_options ::= */ yytestcase(yyruleno==22);
- case 42: /* autoinc ::= */ yytestcase(yyruleno==42);
- case 57: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==57);
- case 67: /* defer_subclause_opt ::= */ yytestcase(yyruleno==67);
- case 76: /* ifexists ::= */ yytestcase(yyruleno==76);
- case 90: /* distinct ::= */ yytestcase(yyruleno==90);
- case 214: /* collate ::= */ yytestcase(yyruleno==214);
+ case 15: /* ifnotexists ::= */
+ case 18: /* temp ::= */ yytestcase(yyruleno==18);
+ case 21: /* table_options ::= */ yytestcase(yyruleno==21);
+ case 41: /* autoinc ::= */ yytestcase(yyruleno==41);
+ case 56: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==56);
+ case 66: /* defer_subclause_opt ::= */ yytestcase(yyruleno==66);
+ case 75: /* ifexists ::= */ yytestcase(yyruleno==75);
+ case 89: /* distinct ::= */ yytestcase(yyruleno==89);
+ case 212: /* collate ::= */ yytestcase(yyruleno==212);
{yymsp[1].minor.yy194 = 0;}
break;
- case 17: /* ifnotexists ::= IF NOT EXISTS */
+ case 16: /* ifnotexists ::= IF NOT EXISTS */
{yymsp[-2].minor.yy194 = 1;}
break;
- case 18: /* temp ::= TEMP */
- case 43: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==43);
+ case 17: /* temp ::= TEMP */
+ case 42: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==42);
{yymsp[0].minor.yy194 = 1;}
break;
- case 20: /* create_table_args ::= LP columnlist conslist_opt RP table_options */
+ case 19: /* create_table_args ::= LP columnlist conslist_opt RP table_options */
{
sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy194,0);
}
break;
- case 21: /* create_table_args ::= AS select */
+ case 20: /* create_table_args ::= AS select */
{
sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy243);
sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy243);
}
break;
- case 23: /* table_options ::= WITHOUT nm */
+ case 22: /* table_options ::= WITHOUT nm */
{
if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){
yymsp[-1].minor.yy194 = TF_WithoutRowid | TF_NoVisibleRowid;
@@ -137773,39 +139273,39 @@ static void yy_reduce(
}
}
break;
- case 24: /* columnname ::= nm typetoken */
+ case 23: /* columnname ::= nm typetoken */
{sqlite3AddColumn(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);}
break;
- case 25: /* typetoken ::= */
- case 60: /* conslist_opt ::= */ yytestcase(yyruleno==60);
- case 96: /* as ::= */ yytestcase(yyruleno==96);
+ case 24: /* typetoken ::= */
+ case 59: /* conslist_opt ::= */ yytestcase(yyruleno==59);
+ case 95: /* as ::= */ yytestcase(yyruleno==95);
{yymsp[1].minor.yy0.n = 0; yymsp[1].minor.yy0.z = 0;}
break;
- case 26: /* typetoken ::= typename LP signed RP */
+ case 25: /* typetoken ::= typename LP signed RP */
{
yymsp[-3].minor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy0.z);
}
break;
- case 27: /* typetoken ::= typename LP signed COMMA signed RP */
+ case 26: /* typetoken ::= typename LP signed COMMA signed RP */
{
yymsp[-5].minor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-5].minor.yy0.z);
}
break;
- case 28: /* typename ::= typename ID|STRING */
+ case 27: /* typename ::= typename ID|STRING */
{yymsp[-1].minor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);}
break;
- case 29: /* ccons ::= CONSTRAINT nm */
- case 62: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==62);
+ case 28: /* ccons ::= CONSTRAINT nm */
+ case 61: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==61);
{pParse->constraintName = yymsp[0].minor.yy0;}
break;
- case 30: /* ccons ::= DEFAULT term */
- case 32: /* ccons ::= DEFAULT PLUS term */ yytestcase(yyruleno==32);
+ case 29: /* ccons ::= DEFAULT term */
+ case 31: /* ccons ::= DEFAULT PLUS term */ yytestcase(yyruleno==31);
{sqlite3AddDefaultValue(pParse,&yymsp[0].minor.yy190);}
break;
- case 31: /* ccons ::= DEFAULT LP expr RP */
+ case 30: /* ccons ::= DEFAULT LP expr RP */
{sqlite3AddDefaultValue(pParse,&yymsp[-1].minor.yy190);}
break;
- case 33: /* ccons ::= DEFAULT MINUS term */
+ case 32: /* ccons ::= DEFAULT MINUS term */
{
ExprSpan v;
v.pExpr = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy190.pExpr, 0);
@@ -137814,142 +139314,142 @@ static void yy_reduce(
sqlite3AddDefaultValue(pParse,&v);
}
break;
- case 34: /* ccons ::= DEFAULT ID|INDEXED */
+ case 33: /* ccons ::= DEFAULT ID|INDEXED */
{
ExprSpan v;
spanExpr(&v, pParse, TK_STRING, yymsp[0].minor.yy0);
sqlite3AddDefaultValue(pParse,&v);
}
break;
- case 35: /* ccons ::= NOT NULL onconf */
+ case 34: /* ccons ::= NOT NULL onconf */
{sqlite3AddNotNull(pParse, yymsp[0].minor.yy194);}
break;
- case 36: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
+ case 35: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */
{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy194,yymsp[0].minor.yy194,yymsp[-2].minor.yy194);}
break;
- case 37: /* ccons ::= UNIQUE onconf */
+ case 36: /* ccons ::= UNIQUE onconf */
{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy194,0,0,0,0,
SQLITE_IDXTYPE_UNIQUE);}
break;
- case 38: /* ccons ::= CHECK LP expr RP */
+ case 37: /* ccons ::= CHECK LP expr RP */
{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy190.pExpr);}
break;
- case 39: /* ccons ::= REFERENCES nm eidlist_opt refargs */
+ case 38: /* ccons ::= REFERENCES nm eidlist_opt refargs */
{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy148,yymsp[0].minor.yy194);}
break;
- case 40: /* ccons ::= defer_subclause */
+ case 39: /* ccons ::= defer_subclause */
{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy194);}
break;
- case 41: /* ccons ::= COLLATE ID|STRING */
+ case 40: /* ccons ::= COLLATE ID|STRING */
{sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);}
break;
- case 44: /* refargs ::= */
+ case 43: /* refargs ::= */
{ yymsp[1].minor.yy194 = OE_None*0x0101; /* EV: R-19803-45884 */}
break;
- case 45: /* refargs ::= refargs refarg */
+ case 44: /* refargs ::= refargs refarg */
{ yymsp[-1].minor.yy194 = (yymsp[-1].minor.yy194 & ~yymsp[0].minor.yy497.mask) | yymsp[0].minor.yy497.value; }
break;
- case 46: /* refarg ::= MATCH nm */
+ case 45: /* refarg ::= MATCH nm */
{ yymsp[-1].minor.yy497.value = 0; yymsp[-1].minor.yy497.mask = 0x000000; }
break;
- case 47: /* refarg ::= ON INSERT refact */
+ case 46: /* refarg ::= ON INSERT refact */
{ yymsp[-2].minor.yy497.value = 0; yymsp[-2].minor.yy497.mask = 0x000000; }
break;
- case 48: /* refarg ::= ON DELETE refact */
+ case 47: /* refarg ::= ON DELETE refact */
{ yymsp[-2].minor.yy497.value = yymsp[0].minor.yy194; yymsp[-2].minor.yy497.mask = 0x0000ff; }
break;
- case 49: /* refarg ::= ON UPDATE refact */
+ case 48: /* refarg ::= ON UPDATE refact */
{ yymsp[-2].minor.yy497.value = yymsp[0].minor.yy194<<8; yymsp[-2].minor.yy497.mask = 0x00ff00; }
break;
- case 50: /* refact ::= SET NULL */
+ case 49: /* refact ::= SET NULL */
{ yymsp[-1].minor.yy194 = OE_SetNull; /* EV: R-33326-45252 */}
break;
- case 51: /* refact ::= SET DEFAULT */
+ case 50: /* refact ::= SET DEFAULT */
{ yymsp[-1].minor.yy194 = OE_SetDflt; /* EV: R-33326-45252 */}
break;
- case 52: /* refact ::= CASCADE */
+ case 51: /* refact ::= CASCADE */
{ yymsp[0].minor.yy194 = OE_Cascade; /* EV: R-33326-45252 */}
break;
- case 53: /* refact ::= RESTRICT */
+ case 52: /* refact ::= RESTRICT */
{ yymsp[0].minor.yy194 = OE_Restrict; /* EV: R-33326-45252 */}
break;
- case 54: /* refact ::= NO ACTION */
+ case 53: /* refact ::= NO ACTION */
{ yymsp[-1].minor.yy194 = OE_None; /* EV: R-33326-45252 */}
break;
- case 55: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
+ case 54: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */
{yymsp[-2].minor.yy194 = 0;}
break;
- case 56: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
- case 71: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==71);
- case 144: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==144);
+ case 55: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */
+ case 70: /* orconf ::= OR resolvetype */ yytestcase(yyruleno==70);
+ case 143: /* insert_cmd ::= INSERT orconf */ yytestcase(yyruleno==143);
{yymsp[-1].minor.yy194 = yymsp[0].minor.yy194;}
break;
- case 58: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
- case 75: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==75);
- case 186: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==186);
- case 189: /* in_op ::= NOT IN */ yytestcase(yyruleno==189);
- case 215: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==215);
+ case 57: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */
+ case 74: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==74);
+ case 184: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==184);
+ case 187: /* in_op ::= NOT IN */ yytestcase(yyruleno==187);
+ case 213: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==213);
{yymsp[-1].minor.yy194 = 1;}
break;
- case 59: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
+ case 58: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */
{yymsp[-1].minor.yy194 = 0;}
break;
- case 61: /* tconscomma ::= COMMA */
+ case 60: /* tconscomma ::= COMMA */
{pParse->constraintName.n = 0;}
break;
- case 63: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
+ case 62: /* tcons ::= PRIMARY KEY LP sortlist autoinc RP onconf */
{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy148,yymsp[0].minor.yy194,yymsp[-2].minor.yy194,0);}
break;
- case 64: /* tcons ::= UNIQUE LP sortlist RP onconf */
+ case 63: /* tcons ::= UNIQUE LP sortlist RP onconf */
{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy148,yymsp[0].minor.yy194,0,0,0,0,
SQLITE_IDXTYPE_UNIQUE);}
break;
- case 65: /* tcons ::= CHECK LP expr RP onconf */
+ case 64: /* tcons ::= CHECK LP expr RP onconf */
{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy190.pExpr);}
break;
- case 66: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
+ case 65: /* tcons ::= FOREIGN KEY LP eidlist RP REFERENCES nm eidlist_opt refargs defer_subclause_opt */
{
sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy148, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy148, yymsp[-1].minor.yy194);
sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy194);
}
break;
- case 68: /* onconf ::= */
- case 70: /* orconf ::= */ yytestcase(yyruleno==70);
+ case 67: /* onconf ::= */
+ case 69: /* orconf ::= */ yytestcase(yyruleno==69);
{yymsp[1].minor.yy194 = OE_Default;}
break;
- case 69: /* onconf ::= ON CONFLICT resolvetype */
+ case 68: /* onconf ::= ON CONFLICT resolvetype */
{yymsp[-2].minor.yy194 = yymsp[0].minor.yy194;}
break;
- case 72: /* resolvetype ::= IGNORE */
+ case 71: /* resolvetype ::= IGNORE */
{yymsp[0].minor.yy194 = OE_Ignore;}
break;
- case 73: /* resolvetype ::= REPLACE */
- case 145: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==145);
+ case 72: /* resolvetype ::= REPLACE */
+ case 144: /* insert_cmd ::= REPLACE */ yytestcase(yyruleno==144);
{yymsp[0].minor.yy194 = OE_Replace;}
break;
- case 74: /* cmd ::= DROP TABLE ifexists fullname */
+ case 73: /* cmd ::= DROP TABLE ifexists fullname */
{
sqlite3DropTable(pParse, yymsp[0].minor.yy185, 0, yymsp[-1].minor.yy194);
}
break;
- case 77: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
+ case 76: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm eidlist_opt AS select */
{
sqlite3CreateView(pParse, &yymsp[-8].minor.yy0, &yymsp[-4].minor.yy0, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy148, yymsp[0].minor.yy243, yymsp[-7].minor.yy194, yymsp[-5].minor.yy194);
}
break;
- case 78: /* cmd ::= DROP VIEW ifexists fullname */
+ case 77: /* cmd ::= DROP VIEW ifexists fullname */
{
sqlite3DropTable(pParse, yymsp[0].minor.yy185, 1, yymsp[-1].minor.yy194);
}
break;
- case 79: /* cmd ::= select */
+ case 78: /* cmd ::= select */
{
SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0};
sqlite3Select(pParse, yymsp[0].minor.yy243, &dest);
sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy243);
}
break;
- case 80: /* select ::= with selectnowith */
+ case 79: /* select ::= with selectnowith */
{
Select *p = yymsp[0].minor.yy243;
if( p ){
@@ -137961,7 +139461,7 @@ static void yy_reduce(
yymsp[-1].minor.yy243 = p; /*A-overwrites-W*/
}
break;
- case 81: /* selectnowith ::= selectnowith multiselect_op oneselect */
+ case 80: /* selectnowith ::= selectnowith multiselect_op oneselect */
{
Select *pRhs = yymsp[0].minor.yy243;
Select *pLhs = yymsp[-2].minor.yy243;
@@ -137985,14 +139485,14 @@ static void yy_reduce(
yymsp[-2].minor.yy243 = pRhs;
}
break;
- case 82: /* multiselect_op ::= UNION */
- case 84: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==84);
+ case 81: /* multiselect_op ::= UNION */
+ case 83: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==83);
{yymsp[0].minor.yy194 = yymsp[0].major; /*A-overwrites-OP*/}
break;
- case 83: /* multiselect_op ::= UNION ALL */
+ case 82: /* multiselect_op ::= UNION ALL */
{yymsp[-1].minor.yy194 = TK_ALL;}
break;
- case 85: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
+ case 84: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */
{
#if SELECTTRACE_ENABLED
Token s = yymsp[-8].minor.yy0; /*A-overwrites-S*/
@@ -138024,12 +139524,12 @@ static void yy_reduce(
#endif /* SELECTRACE_ENABLED */
}
break;
- case 86: /* values ::= VALUES LP nexprlist RP */
+ case 85: /* values ::= VALUES LP nexprlist RP */
{
yymsp[-3].minor.yy243 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy148,0,0,0,0,0,SF_Values,0,0);
}
break;
- case 87: /* values ::= values COMMA LP exprlist RP */
+ case 86: /* values ::= values COMMA LP exprlist RP */
{
Select *pRight, *pLeft = yymsp[-4].minor.yy243;
pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy148,0,0,0,0,0,SF_Values|SF_MultiValue,0,0);
@@ -138043,34 +139543,34 @@ static void yy_reduce(
}
}
break;
- case 88: /* distinct ::= DISTINCT */
+ case 87: /* distinct ::= DISTINCT */
{yymsp[0].minor.yy194 = SF_Distinct;}
break;
- case 89: /* distinct ::= ALL */
+ case 88: /* distinct ::= ALL */
{yymsp[0].minor.yy194 = SF_All;}
break;
- case 91: /* sclp ::= */
- case 119: /* orderby_opt ::= */ yytestcase(yyruleno==119);
- case 126: /* groupby_opt ::= */ yytestcase(yyruleno==126);
- case 202: /* exprlist ::= */ yytestcase(yyruleno==202);
- case 205: /* paren_exprlist ::= */ yytestcase(yyruleno==205);
- case 210: /* eidlist_opt ::= */ yytestcase(yyruleno==210);
+ case 90: /* sclp ::= */
+ case 118: /* orderby_opt ::= */ yytestcase(yyruleno==118);
+ case 125: /* groupby_opt ::= */ yytestcase(yyruleno==125);
+ case 200: /* exprlist ::= */ yytestcase(yyruleno==200);
+ case 203: /* paren_exprlist ::= */ yytestcase(yyruleno==203);
+ case 208: /* eidlist_opt ::= */ yytestcase(yyruleno==208);
{yymsp[1].minor.yy148 = 0;}
break;
- case 92: /* selcollist ::= sclp expr as */
+ case 91: /* selcollist ::= sclp expr as */
{
yymsp[-2].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy148, yymsp[-1].minor.yy190.pExpr);
if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yymsp[-2].minor.yy148, &yymsp[0].minor.yy0, 1);
sqlite3ExprListSetSpan(pParse,yymsp[-2].minor.yy148,&yymsp[-1].minor.yy190);
}
break;
- case 93: /* selcollist ::= sclp STAR */
+ case 92: /* selcollist ::= sclp STAR */
{
Expr *p = sqlite3Expr(pParse->db, TK_ASTERISK, 0);
yymsp[-1].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy148, p);
}
break;
- case 94: /* selcollist ::= sclp nm DOT STAR */
+ case 93: /* selcollist ::= sclp nm DOT STAR */
{
Expr *pRight = sqlite3PExpr(pParse, TK_ASTERISK, 0, 0);
Expr *pLeft = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
@@ -138078,47 +139578,47 @@ static void yy_reduce(
yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148, pDot);
}
break;
- case 95: /* as ::= AS nm */
- case 106: /* dbnm ::= DOT nm */ yytestcase(yyruleno==106);
- case 224: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==224);
- case 225: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==225);
+ case 94: /* as ::= AS nm */
+ case 105: /* dbnm ::= DOT nm */ yytestcase(yyruleno==105);
+ case 222: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==222);
+ case 223: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==223);
{yymsp[-1].minor.yy0 = yymsp[0].minor.yy0;}
break;
- case 97: /* from ::= */
+ case 96: /* from ::= */
{yymsp[1].minor.yy185 = sqlite3DbMallocZero(pParse->db, sizeof(*yymsp[1].minor.yy185));}
break;
- case 98: /* from ::= FROM seltablist */
+ case 97: /* from ::= FROM seltablist */
{
yymsp[-1].minor.yy185 = yymsp[0].minor.yy185;
sqlite3SrcListShiftJoinType(yymsp[-1].minor.yy185);
}
break;
- case 99: /* stl_prefix ::= seltablist joinop */
+ case 98: /* stl_prefix ::= seltablist joinop */
{
if( ALWAYS(yymsp[-1].minor.yy185 && yymsp[-1].minor.yy185->nSrc>0) ) yymsp[-1].minor.yy185->a[yymsp[-1].minor.yy185->nSrc-1].fg.jointype = (u8)yymsp[0].minor.yy194;
}
break;
- case 100: /* stl_prefix ::= */
+ case 99: /* stl_prefix ::= */
{yymsp[1].minor.yy185 = 0;}
break;
- case 101: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
+ case 100: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */
{
yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy72,yymsp[0].minor.yy254);
sqlite3SrcListIndexedBy(pParse, yymsp[-6].minor.yy185, &yymsp[-2].minor.yy0);
}
break;
- case 102: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
+ case 101: /* seltablist ::= stl_prefix nm dbnm LP exprlist RP as on_opt using_opt */
{
yymsp[-8].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-8].minor.yy185,&yymsp[-7].minor.yy0,&yymsp[-6].minor.yy0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy72,yymsp[0].minor.yy254);
sqlite3SrcListFuncArgs(pParse, yymsp[-8].minor.yy185, yymsp[-4].minor.yy148);
}
break;
- case 103: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
+ case 102: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */
{
yymsp[-6].minor.yy185 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy185,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy243,yymsp[-1].minor.yy72,yymsp[0].minor.yy254);
}
break;
- case 104: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
+ case 103: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */
{
if( yymsp[-6].minor.yy185==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy72==0 && yymsp[0].minor.yy254==0 ){
yymsp[-6].minor.yy185 = yymsp[-4].minor.yy185;
@@ -138142,96 +139642,96 @@ static void yy_reduce(
}
}
break;
- case 105: /* dbnm ::= */
- case 114: /* indexed_opt ::= */ yytestcase(yyruleno==114);
+ case 104: /* dbnm ::= */
+ case 113: /* indexed_opt ::= */ yytestcase(yyruleno==113);
{yymsp[1].minor.yy0.z=0; yymsp[1].minor.yy0.n=0;}
break;
- case 107: /* fullname ::= nm dbnm */
+ case 106: /* fullname ::= nm dbnm */
{yymsp[-1].minor.yy185 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/}
break;
- case 108: /* joinop ::= COMMA|JOIN */
+ case 107: /* joinop ::= COMMA|JOIN */
{ yymsp[0].minor.yy194 = JT_INNER; }
break;
- case 109: /* joinop ::= JOIN_KW JOIN */
+ case 108: /* joinop ::= JOIN_KW JOIN */
{yymsp[-1].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); /*X-overwrites-A*/}
break;
- case 110: /* joinop ::= JOIN_KW nm JOIN */
+ case 109: /* joinop ::= JOIN_KW nm JOIN */
{yymsp[-2].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); /*X-overwrites-A*/}
break;
- case 111: /* joinop ::= JOIN_KW nm nm JOIN */
+ case 110: /* joinop ::= JOIN_KW nm nm JOIN */
{yymsp[-3].minor.yy194 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);/*X-overwrites-A*/}
break;
- case 112: /* on_opt ::= ON expr */
- case 129: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==129);
- case 136: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==136);
- case 198: /* case_else ::= ELSE expr */ yytestcase(yyruleno==198);
+ case 111: /* on_opt ::= ON expr */
+ case 128: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==128);
+ case 135: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==135);
+ case 196: /* case_else ::= ELSE expr */ yytestcase(yyruleno==196);
{yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr;}
break;
- case 113: /* on_opt ::= */
- case 128: /* having_opt ::= */ yytestcase(yyruleno==128);
- case 135: /* where_opt ::= */ yytestcase(yyruleno==135);
- case 199: /* case_else ::= */ yytestcase(yyruleno==199);
- case 201: /* case_operand ::= */ yytestcase(yyruleno==201);
+ case 112: /* on_opt ::= */
+ case 127: /* having_opt ::= */ yytestcase(yyruleno==127);
+ case 134: /* where_opt ::= */ yytestcase(yyruleno==134);
+ case 197: /* case_else ::= */ yytestcase(yyruleno==197);
+ case 199: /* case_operand ::= */ yytestcase(yyruleno==199);
{yymsp[1].minor.yy72 = 0;}
break;
- case 115: /* indexed_opt ::= INDEXED BY nm */
+ case 114: /* indexed_opt ::= INDEXED BY nm */
{yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;}
break;
- case 116: /* indexed_opt ::= NOT INDEXED */
+ case 115: /* indexed_opt ::= NOT INDEXED */
{yymsp[-1].minor.yy0.z=0; yymsp[-1].minor.yy0.n=1;}
break;
- case 117: /* using_opt ::= USING LP idlist RP */
+ case 116: /* using_opt ::= USING LP idlist RP */
{yymsp[-3].minor.yy254 = yymsp[-1].minor.yy254;}
break;
- case 118: /* using_opt ::= */
- case 146: /* idlist_opt ::= */ yytestcase(yyruleno==146);
+ case 117: /* using_opt ::= */
+ case 145: /* idlist_opt ::= */ yytestcase(yyruleno==145);
{yymsp[1].minor.yy254 = 0;}
break;
- case 120: /* orderby_opt ::= ORDER BY sortlist */
- case 127: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==127);
+ case 119: /* orderby_opt ::= ORDER BY sortlist */
+ case 126: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==126);
{yymsp[-2].minor.yy148 = yymsp[0].minor.yy148;}
break;
- case 121: /* sortlist ::= sortlist COMMA expr sortorder */
+ case 120: /* sortlist ::= sortlist COMMA expr sortorder */
{
yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148,yymsp[-1].minor.yy190.pExpr);
sqlite3ExprListSetSortOrder(yymsp[-3].minor.yy148,yymsp[0].minor.yy194);
}
break;
- case 122: /* sortlist ::= expr sortorder */
+ case 121: /* sortlist ::= expr sortorder */
{
yymsp[-1].minor.yy148 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy190.pExpr); /*A-overwrites-Y*/
sqlite3ExprListSetSortOrder(yymsp[-1].minor.yy148,yymsp[0].minor.yy194);
}
break;
- case 123: /* sortorder ::= ASC */
+ case 122: /* sortorder ::= ASC */
{yymsp[0].minor.yy194 = SQLITE_SO_ASC;}
break;
- case 124: /* sortorder ::= DESC */
+ case 123: /* sortorder ::= DESC */
{yymsp[0].minor.yy194 = SQLITE_SO_DESC;}
break;
- case 125: /* sortorder ::= */
+ case 124: /* sortorder ::= */
{yymsp[1].minor.yy194 = SQLITE_SO_UNDEFINED;}
break;
- case 130: /* limit_opt ::= */
+ case 129: /* limit_opt ::= */
{yymsp[1].minor.yy354.pLimit = 0; yymsp[1].minor.yy354.pOffset = 0;}
break;
- case 131: /* limit_opt ::= LIMIT expr */
+ case 130: /* limit_opt ::= LIMIT expr */
{yymsp[-1].minor.yy354.pLimit = yymsp[0].minor.yy190.pExpr; yymsp[-1].minor.yy354.pOffset = 0;}
break;
- case 132: /* limit_opt ::= LIMIT expr OFFSET expr */
+ case 131: /* limit_opt ::= LIMIT expr OFFSET expr */
{yymsp[-3].minor.yy354.pLimit = yymsp[-2].minor.yy190.pExpr; yymsp[-3].minor.yy354.pOffset = yymsp[0].minor.yy190.pExpr;}
break;
- case 133: /* limit_opt ::= LIMIT expr COMMA expr */
+ case 132: /* limit_opt ::= LIMIT expr COMMA expr */
{yymsp[-3].minor.yy354.pOffset = yymsp[-2].minor.yy190.pExpr; yymsp[-3].minor.yy354.pLimit = yymsp[0].minor.yy190.pExpr;}
break;
- case 134: /* cmd ::= with DELETE FROM fullname indexed_opt where_opt */
+ case 133: /* cmd ::= with DELETE FROM fullname indexed_opt where_opt */
{
sqlite3WithPush(pParse, yymsp[-5].minor.yy285, 1);
sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy185, &yymsp[-1].minor.yy0);
sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy185,yymsp[0].minor.yy72);
}
break;
- case 137: /* cmd ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt */
+ case 136: /* cmd ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt */
{
sqlite3WithPush(pParse, yymsp[-7].minor.yy285, 1);
sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy185, &yymsp[-3].minor.yy0);
@@ -138239,63 +139739,58 @@ static void yy_reduce(
sqlite3Update(pParse,yymsp[-4].minor.yy185,yymsp[-1].minor.yy148,yymsp[0].minor.yy72,yymsp[-5].minor.yy194);
}
break;
- case 138: /* setlist ::= setlist COMMA nm EQ expr */
+ case 137: /* setlist ::= setlist COMMA nm EQ expr */
{
yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy148, yymsp[0].minor.yy190.pExpr);
sqlite3ExprListSetName(pParse, yymsp[-4].minor.yy148, &yymsp[-2].minor.yy0, 1);
}
break;
- case 139: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
+ case 138: /* setlist ::= setlist COMMA LP idlist RP EQ expr */
{
yymsp[-6].minor.yy148 = sqlite3ExprListAppendVector(pParse, yymsp[-6].minor.yy148, yymsp[-3].minor.yy254, yymsp[0].minor.yy190.pExpr);
}
break;
- case 140: /* setlist ::= nm EQ expr */
+ case 139: /* setlist ::= nm EQ expr */
{
yylhsminor.yy148 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy190.pExpr);
sqlite3ExprListSetName(pParse, yylhsminor.yy148, &yymsp[-2].minor.yy0, 1);
}
yymsp[-2].minor.yy148 = yylhsminor.yy148;
break;
- case 141: /* setlist ::= LP idlist RP EQ expr */
+ case 140: /* setlist ::= LP idlist RP EQ expr */
{
yymsp[-4].minor.yy148 = sqlite3ExprListAppendVector(pParse, 0, yymsp[-3].minor.yy254, yymsp[0].minor.yy190.pExpr);
}
break;
- case 142: /* cmd ::= with insert_cmd INTO fullname idlist_opt select */
+ case 141: /* cmd ::= with insert_cmd INTO fullname idlist_opt select */
{
sqlite3WithPush(pParse, yymsp[-5].minor.yy285, 1);
sqlite3Insert(pParse, yymsp[-2].minor.yy185, yymsp[0].minor.yy243, yymsp[-1].minor.yy254, yymsp[-4].minor.yy194);
}
break;
- case 143: /* cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES */
+ case 142: /* cmd ::= with insert_cmd INTO fullname idlist_opt DEFAULT VALUES */
{
sqlite3WithPush(pParse, yymsp[-6].minor.yy285, 1);
sqlite3Insert(pParse, yymsp[-3].minor.yy185, 0, yymsp[-2].minor.yy254, yymsp[-5].minor.yy194);
}
break;
- case 147: /* idlist_opt ::= LP idlist RP */
+ case 146: /* idlist_opt ::= LP idlist RP */
{yymsp[-2].minor.yy254 = yymsp[-1].minor.yy254;}
break;
- case 148: /* idlist ::= idlist COMMA nm */
+ case 147: /* idlist ::= idlist COMMA nm */
{yymsp[-2].minor.yy254 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy254,&yymsp[0].minor.yy0);}
break;
- case 149: /* idlist ::= nm */
+ case 148: /* idlist ::= nm */
{yymsp[0].minor.yy254 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0); /*A-overwrites-Y*/}
break;
- case 150: /* expr ::= LP expr RP */
+ case 149: /* expr ::= LP expr RP */
{spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/ yymsp[-2].minor.yy190.pExpr = yymsp[-1].minor.yy190.pExpr;}
break;
- case 151: /* term ::= NULL */
- case 156: /* term ::= FLOAT|BLOB */ yytestcase(yyruleno==156);
- case 157: /* term ::= STRING */ yytestcase(yyruleno==157);
-{spanExpr(&yymsp[0].minor.yy190,pParse,yymsp[0].major,yymsp[0].minor.yy0);/*A-overwrites-X*/}
- break;
- case 152: /* expr ::= ID|INDEXED */
- case 153: /* expr ::= JOIN_KW */ yytestcase(yyruleno==153);
+ case 150: /* expr ::= ID|INDEXED */
+ case 151: /* expr ::= JOIN_KW */ yytestcase(yyruleno==151);
{spanExpr(&yymsp[0].minor.yy190,pParse,TK_ID,yymsp[0].minor.yy0); /*A-overwrites-X*/}
break;
- case 154: /* expr ::= nm DOT nm */
+ case 152: /* expr ::= nm DOT nm */
{
Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[0].minor.yy0, 1);
@@ -138303,7 +139798,7 @@ static void yy_reduce(
yymsp[-2].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp2);
}
break;
- case 155: /* expr ::= nm DOT nm DOT nm */
+ case 153: /* expr ::= nm DOT nm DOT nm */
{
Expr *temp1 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-4].minor.yy0, 1);
Expr *temp2 = sqlite3ExprAlloc(pParse->db, TK_ID, &yymsp[-2].minor.yy0, 1);
@@ -138313,16 +139808,19 @@ static void yy_reduce(
yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp4);
}
break;
- case 158: /* term ::= INTEGER */
+ case 154: /* term ::= NULL|FLOAT|BLOB */
+ case 155: /* term ::= STRING */ yytestcase(yyruleno==155);
+{spanExpr(&yymsp[0].minor.yy190,pParse,yymsp[0].major,yymsp[0].minor.yy0); /*A-overwrites-X*/}
+ break;
+ case 156: /* term ::= INTEGER */
{
yylhsminor.yy190.pExpr = sqlite3ExprAlloc(pParse->db, TK_INTEGER, &yymsp[0].minor.yy0, 1);
yylhsminor.yy190.zStart = yymsp[0].minor.yy0.z;
yylhsminor.yy190.zEnd = yymsp[0].minor.yy0.z + yymsp[0].minor.yy0.n;
- if( yylhsminor.yy190.pExpr ) yylhsminor.yy190.pExpr->flags |= EP_Leaf|EP_Resolved;
}
yymsp[0].minor.yy190 = yylhsminor.yy190;
break;
- case 159: /* expr ::= VARIABLE */
+ case 157: /* expr ::= VARIABLE */
{
if( !(yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1])) ){
u32 n = yymsp[0].minor.yy0.n;
@@ -138345,20 +139843,20 @@ static void yy_reduce(
}
}
break;
- case 160: /* expr ::= expr COLLATE ID|STRING */
+ case 158: /* expr ::= expr COLLATE ID|STRING */
{
yymsp[-2].minor.yy190.pExpr = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy190.pExpr, &yymsp[0].minor.yy0, 1);
yymsp[-2].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
}
break;
- case 161: /* expr ::= CAST LP expr AS typetoken RP */
+ case 159: /* expr ::= CAST LP expr AS typetoken RP */
{
spanSet(&yymsp[-5].minor.yy190,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
yymsp[-5].minor.yy190.pExpr = sqlite3ExprAlloc(pParse->db, TK_CAST, &yymsp[-1].minor.yy0, 1);
sqlite3ExprAttachSubtrees(pParse->db, yymsp[-5].minor.yy190.pExpr, yymsp[-3].minor.yy190.pExpr, 0);
}
break;
- case 162: /* expr ::= ID|INDEXED LP distinct exprlist RP */
+ case 160: /* expr ::= ID|INDEXED LP distinct exprlist RP */
{
if( yymsp[-1].minor.yy148 && yymsp[-1].minor.yy148->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){
sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].minor.yy0);
@@ -138371,21 +139869,21 @@ static void yy_reduce(
}
yymsp[-4].minor.yy190 = yylhsminor.yy190;
break;
- case 163: /* expr ::= ID|INDEXED LP STAR RP */
+ case 161: /* expr ::= ID|INDEXED LP STAR RP */
{
yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0);
spanSet(&yylhsminor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0);
}
yymsp[-3].minor.yy190 = yylhsminor.yy190;
break;
- case 164: /* term ::= CTIME_KW */
+ case 162: /* term ::= CTIME_KW */
{
yylhsminor.yy190.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0);
spanSet(&yylhsminor.yy190, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0);
}
yymsp[0].minor.yy190 = yylhsminor.yy190;
break;
- case 165: /* expr ::= LP nexprlist COMMA expr RP */
+ case 163: /* expr ::= LP nexprlist COMMA expr RP */
{
ExprList *pList = sqlite3ExprListAppend(pParse, yymsp[-3].minor.yy148, yymsp[-1].minor.yy190.pExpr);
yylhsminor.yy190.pExpr = sqlite3PExpr(pParse, TK_VECTOR, 0, 0);
@@ -138398,20 +139896,20 @@ static void yy_reduce(
}
yymsp[-4].minor.yy190 = yylhsminor.yy190;
break;
- case 166: /* expr ::= expr AND expr */
- case 167: /* expr ::= expr OR expr */ yytestcase(yyruleno==167);
- case 168: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==168);
- case 169: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==169);
- case 170: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==170);
- case 171: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==171);
- case 172: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==172);
- case 173: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==173);
+ case 164: /* expr ::= expr AND expr */
+ case 165: /* expr ::= expr OR expr */ yytestcase(yyruleno==165);
+ case 166: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==166);
+ case 167: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==167);
+ case 168: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==168);
+ case 169: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==169);
+ case 170: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==170);
+ case 171: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==171);
{spanBinaryExpr(pParse,yymsp[-1].major,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy190);}
break;
- case 174: /* likeop ::= NOT LIKE_KW|MATCH */
+ case 172: /* likeop ::= NOT LIKE_KW|MATCH */
{yymsp[-1].minor.yy0=yymsp[0].minor.yy0; yymsp[-1].minor.yy0.n|=0x80000000; /*yymsp[-1].minor.yy0-overwrite-yymsp[0].minor.yy0*/}
break;
- case 175: /* expr ::= expr likeop expr */
+ case 173: /* expr ::= expr likeop expr */
{
ExprList *pList;
int bNot = yymsp[-1].minor.yy0.n & 0x80000000;
@@ -138424,7 +139922,7 @@ static void yy_reduce(
if( yymsp[-2].minor.yy190.pExpr ) yymsp[-2].minor.yy190.pExpr->flags |= EP_InfixFunc;
}
break;
- case 176: /* expr ::= expr likeop expr ESCAPE expr */
+ case 174: /* expr ::= expr likeop expr ESCAPE expr */
{
ExprList *pList;
int bNot = yymsp[-3].minor.yy0.n & 0x80000000;
@@ -138438,39 +139936,39 @@ static void yy_reduce(
if( yymsp[-4].minor.yy190.pExpr ) yymsp[-4].minor.yy190.pExpr->flags |= EP_InfixFunc;
}
break;
- case 177: /* expr ::= expr ISNULL|NOTNULL */
+ case 175: /* expr ::= expr ISNULL|NOTNULL */
{spanUnaryPostfix(pParse,yymsp[0].major,&yymsp[-1].minor.yy190,&yymsp[0].minor.yy0);}
break;
- case 178: /* expr ::= expr NOT NULL */
+ case 176: /* expr ::= expr NOT NULL */
{spanUnaryPostfix(pParse,TK_NOTNULL,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy0);}
break;
- case 179: /* expr ::= expr IS expr */
+ case 177: /* expr ::= expr IS expr */
{
spanBinaryExpr(pParse,TK_IS,&yymsp[-2].minor.yy190,&yymsp[0].minor.yy190);
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy190.pExpr, yymsp[-2].minor.yy190.pExpr, TK_ISNULL);
}
break;
- case 180: /* expr ::= expr IS NOT expr */
+ case 178: /* expr ::= expr IS NOT expr */
{
spanBinaryExpr(pParse,TK_ISNOT,&yymsp[-3].minor.yy190,&yymsp[0].minor.yy190);
binaryToUnaryIfNull(pParse, yymsp[0].minor.yy190.pExpr, yymsp[-3].minor.yy190.pExpr, TK_NOTNULL);
}
break;
- case 181: /* expr ::= NOT expr */
- case 182: /* expr ::= BITNOT expr */ yytestcase(yyruleno==182);
+ case 179: /* expr ::= NOT expr */
+ case 180: /* expr ::= BITNOT expr */ yytestcase(yyruleno==180);
{spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,yymsp[-1].major,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}
break;
- case 183: /* expr ::= MINUS expr */
+ case 181: /* expr ::= MINUS expr */
{spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,TK_UMINUS,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}
break;
- case 184: /* expr ::= PLUS expr */
+ case 182: /* expr ::= PLUS expr */
{spanUnaryPrefix(&yymsp[-1].minor.yy190,pParse,TK_UPLUS,&yymsp[0].minor.yy190,&yymsp[-1].minor.yy0);/*A-overwrites-B*/}
break;
- case 185: /* between_op ::= BETWEEN */
- case 188: /* in_op ::= IN */ yytestcase(yyruleno==188);
+ case 183: /* between_op ::= BETWEEN */
+ case 186: /* in_op ::= IN */ yytestcase(yyruleno==186);
{yymsp[0].minor.yy194 = 0;}
break;
- case 187: /* expr ::= expr between_op expr AND expr */
+ case 185: /* expr ::= expr between_op expr AND expr */
{
ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr);
pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy190.pExpr);
@@ -138484,7 +139982,7 @@ static void yy_reduce(
yymsp[-4].minor.yy190.zEnd = yymsp[0].minor.yy190.zEnd;
}
break;
- case 190: /* expr ::= expr in_op LP exprlist RP */
+ case 188: /* expr ::= expr in_op LP exprlist RP */
{
if( yymsp[-1].minor.yy148==0 ){
/* Expressions of the form
@@ -138537,14 +140035,14 @@ static void yy_reduce(
yymsp[-4].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
}
break;
- case 191: /* expr ::= LP select RP */
+ case 189: /* expr ::= LP select RP */
{
spanSet(&yymsp[-2].minor.yy190,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/
yymsp[-2].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0);
sqlite3PExprAddSelect(pParse, yymsp[-2].minor.yy190.pExpr, yymsp[-1].minor.yy243);
}
break;
- case 192: /* expr ::= expr in_op LP select RP */
+ case 190: /* expr ::= expr in_op LP select RP */
{
yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy190.pExpr, 0);
sqlite3PExprAddSelect(pParse, yymsp[-4].minor.yy190.pExpr, yymsp[-1].minor.yy243);
@@ -138552,7 +140050,7 @@ static void yy_reduce(
yymsp[-4].minor.yy190.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n];
}
break;
- case 193: /* expr ::= expr in_op nm dbnm paren_exprlist */
+ case 191: /* expr ::= expr in_op nm dbnm paren_exprlist */
{
SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0);
Select *pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0);
@@ -138563,7 +140061,7 @@ static void yy_reduce(
yymsp[-4].minor.yy190.zEnd = yymsp[-1].minor.yy0.z ? &yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n] : &yymsp[-2].minor.yy0.z[yymsp[-2].minor.yy0.n];
}
break;
- case 194: /* expr ::= EXISTS LP select RP */
+ case 192: /* expr ::= EXISTS LP select RP */
{
Expr *p;
spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-B*/
@@ -138571,7 +140069,7 @@ static void yy_reduce(
sqlite3PExprAddSelect(pParse, p, yymsp[-1].minor.yy243);
}
break;
- case 195: /* expr ::= CASE case_operand case_exprlist case_else END */
+ case 193: /* expr ::= CASE case_operand case_exprlist case_else END */
{
spanSet(&yymsp[-4].minor.yy190,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-C*/
yymsp[-4].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy72, 0);
@@ -138584,80 +140082,80 @@ static void yy_reduce(
}
}
break;
- case 196: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
+ case 194: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */
{
yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy148, yymsp[-2].minor.yy190.pExpr);
yymsp[-4].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy148, yymsp[0].minor.yy190.pExpr);
}
break;
- case 197: /* case_exprlist ::= WHEN expr THEN expr */
+ case 195: /* case_exprlist ::= WHEN expr THEN expr */
{
yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy190.pExpr);
yymsp[-3].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy148, yymsp[0].minor.yy190.pExpr);
}
break;
- case 200: /* case_operand ::= expr */
+ case 198: /* case_operand ::= expr */
{yymsp[0].minor.yy72 = yymsp[0].minor.yy190.pExpr; /*A-overwrites-X*/}
break;
- case 203: /* nexprlist ::= nexprlist COMMA expr */
+ case 201: /* nexprlist ::= nexprlist COMMA expr */
{yymsp[-2].minor.yy148 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy148,yymsp[0].minor.yy190.pExpr);}
break;
- case 204: /* nexprlist ::= expr */
+ case 202: /* nexprlist ::= expr */
{yymsp[0].minor.yy148 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy190.pExpr); /*A-overwrites-Y*/}
break;
- case 206: /* paren_exprlist ::= LP exprlist RP */
- case 211: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==211);
+ case 204: /* paren_exprlist ::= LP exprlist RP */
+ case 209: /* eidlist_opt ::= LP eidlist RP */ yytestcase(yyruleno==209);
{yymsp[-2].minor.yy148 = yymsp[-1].minor.yy148;}
break;
- case 207: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
+ case 205: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP sortlist RP where_opt */
{
sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0,
sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy148, yymsp[-10].minor.yy194,
&yymsp[-11].minor.yy0, yymsp[0].minor.yy72, SQLITE_SO_ASC, yymsp[-8].minor.yy194, SQLITE_IDXTYPE_APPDEF);
}
break;
- case 208: /* uniqueflag ::= UNIQUE */
- case 249: /* raisetype ::= ABORT */ yytestcase(yyruleno==249);
+ case 206: /* uniqueflag ::= UNIQUE */
+ case 246: /* raisetype ::= ABORT */ yytestcase(yyruleno==246);
{yymsp[0].minor.yy194 = OE_Abort;}
break;
- case 209: /* uniqueflag ::= */
+ case 207: /* uniqueflag ::= */
{yymsp[1].minor.yy194 = OE_None;}
break;
- case 212: /* eidlist ::= eidlist COMMA nm collate sortorder */
+ case 210: /* eidlist ::= eidlist COMMA nm collate sortorder */
{
yymsp[-4].minor.yy148 = parserAddExprIdListTerm(pParse, yymsp[-4].minor.yy148, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy194, yymsp[0].minor.yy194);
}
break;
- case 213: /* eidlist ::= nm collate sortorder */
+ case 211: /* eidlist ::= nm collate sortorder */
{
yymsp[-2].minor.yy148 = parserAddExprIdListTerm(pParse, 0, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy194, yymsp[0].minor.yy194); /*A-overwrites-Y*/
}
break;
- case 216: /* cmd ::= DROP INDEX ifexists fullname */
+ case 214: /* cmd ::= DROP INDEX ifexists fullname */
{sqlite3DropIndex(pParse, yymsp[0].minor.yy185, yymsp[-1].minor.yy194);}
break;
- case 217: /* cmd ::= VACUUM */
+ case 215: /* cmd ::= VACUUM */
{sqlite3Vacuum(pParse,0);}
break;
- case 218: /* cmd ::= VACUUM nm */
+ case 216: /* cmd ::= VACUUM nm */
{sqlite3Vacuum(pParse,&yymsp[0].minor.yy0);}
break;
- case 219: /* cmd ::= PRAGMA nm dbnm */
+ case 217: /* cmd ::= PRAGMA nm dbnm */
{sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);}
break;
- case 220: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
+ case 218: /* cmd ::= PRAGMA nm dbnm EQ nmnum */
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);}
break;
- case 221: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
+ case 219: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);}
break;
- case 222: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
+ case 220: /* cmd ::= PRAGMA nm dbnm EQ minus_num */
{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);}
break;
- case 223: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
+ case 221: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */
{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);}
break;
- case 226: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
+ case 224: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */
{
Token all;
all.z = yymsp[-3].minor.yy0.z;
@@ -138665,53 +140163,50 @@ static void yy_reduce(
sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy145, &all);
}
break;
- case 227: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
+ case 225: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */
{
sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy194, yymsp[-4].minor.yy332.a, yymsp[-4].minor.yy332.b, yymsp[-2].minor.yy185, yymsp[0].minor.yy72, yymsp[-10].minor.yy194, yymsp[-8].minor.yy194);
yymsp[-10].minor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); /*A-overwrites-T*/
}
break;
- case 228: /* trigger_time ::= BEFORE */
-{ yymsp[0].minor.yy194 = TK_BEFORE; }
- break;
- case 229: /* trigger_time ::= AFTER */
-{ yymsp[0].minor.yy194 = TK_AFTER; }
+ case 226: /* trigger_time ::= BEFORE|AFTER */
+{ yymsp[0].minor.yy194 = yymsp[0].major; /*A-overwrites-X*/ }
break;
- case 230: /* trigger_time ::= INSTEAD OF */
+ case 227: /* trigger_time ::= INSTEAD OF */
{ yymsp[-1].minor.yy194 = TK_INSTEAD;}
break;
- case 231: /* trigger_time ::= */
+ case 228: /* trigger_time ::= */
{ yymsp[1].minor.yy194 = TK_BEFORE; }
break;
- case 232: /* trigger_event ::= DELETE|INSERT */
- case 233: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==233);
+ case 229: /* trigger_event ::= DELETE|INSERT */
+ case 230: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==230);
{yymsp[0].minor.yy332.a = yymsp[0].major; /*A-overwrites-X*/ yymsp[0].minor.yy332.b = 0;}
break;
- case 234: /* trigger_event ::= UPDATE OF idlist */
+ case 231: /* trigger_event ::= UPDATE OF idlist */
{yymsp[-2].minor.yy332.a = TK_UPDATE; yymsp[-2].minor.yy332.b = yymsp[0].minor.yy254;}
break;
- case 235: /* when_clause ::= */
- case 254: /* key_opt ::= */ yytestcase(yyruleno==254);
+ case 232: /* when_clause ::= */
+ case 251: /* key_opt ::= */ yytestcase(yyruleno==251);
{ yymsp[1].minor.yy72 = 0; }
break;
- case 236: /* when_clause ::= WHEN expr */
- case 255: /* key_opt ::= KEY expr */ yytestcase(yyruleno==255);
+ case 233: /* when_clause ::= WHEN expr */
+ case 252: /* key_opt ::= KEY expr */ yytestcase(yyruleno==252);
{ yymsp[-1].minor.yy72 = yymsp[0].minor.yy190.pExpr; }
break;
- case 237: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
+ case 234: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */
{
assert( yymsp[-2].minor.yy145!=0 );
yymsp[-2].minor.yy145->pLast->pNext = yymsp[-1].minor.yy145;
yymsp[-2].minor.yy145->pLast = yymsp[-1].minor.yy145;
}
break;
- case 238: /* trigger_cmd_list ::= trigger_cmd SEMI */
+ case 235: /* trigger_cmd_list ::= trigger_cmd SEMI */
{
assert( yymsp[-1].minor.yy145!=0 );
yymsp[-1].minor.yy145->pLast = yymsp[-1].minor.yy145;
}
break;
- case 239: /* trnm ::= nm DOT nm */
+ case 236: /* trnm ::= nm DOT nm */
{
yymsp[-2].minor.yy0 = yymsp[0].minor.yy0;
sqlite3ErrorMsg(pParse,
@@ -138719,33 +140214,33 @@ static void yy_reduce(
"statements within triggers");
}
break;
- case 240: /* tridxby ::= INDEXED BY nm */
+ case 237: /* tridxby ::= INDEXED BY nm */
{
sqlite3ErrorMsg(pParse,
"the INDEXED BY clause is not allowed on UPDATE or DELETE statements "
"within triggers");
}
break;
- case 241: /* tridxby ::= NOT INDEXED */
+ case 238: /* tridxby ::= NOT INDEXED */
{
sqlite3ErrorMsg(pParse,
"the NOT INDEXED clause is not allowed on UPDATE or DELETE statements "
"within triggers");
}
break;
- case 242: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */
+ case 239: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */
{yymsp[-6].minor.yy145 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy148, yymsp[0].minor.yy72, yymsp[-5].minor.yy194);}
break;
- case 243: /* trigger_cmd ::= insert_cmd INTO trnm idlist_opt select */
+ case 240: /* trigger_cmd ::= insert_cmd INTO trnm idlist_opt select */
{yymsp[-4].minor.yy145 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy254, yymsp[0].minor.yy243, yymsp[-4].minor.yy194);/*A-overwrites-R*/}
break;
- case 244: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */
+ case 241: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */
{yymsp[-4].minor.yy145 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy72);}
break;
- case 245: /* trigger_cmd ::= select */
+ case 242: /* trigger_cmd ::= select */
{yymsp[0].minor.yy145 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy243); /*A-overwrites-X*/}
break;
- case 246: /* expr ::= RAISE LP IGNORE RP */
+ case 243: /* expr ::= RAISE LP IGNORE RP */
{
spanSet(&yymsp[-3].minor.yy190,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
yymsp[-3].minor.yy190.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0);
@@ -138754,7 +140249,7 @@ static void yy_reduce(
}
}
break;
- case 247: /* expr ::= RAISE LP raisetype COMMA nm RP */
+ case 244: /* expr ::= RAISE LP raisetype COMMA nm RP */
{
spanSet(&yymsp[-5].minor.yy190,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); /*A-overwrites-X*/
yymsp[-5].minor.yy190.pExpr = sqlite3ExprAlloc(pParse->db, TK_RAISE, &yymsp[-1].minor.yy0, 1);
@@ -138763,172 +140258,176 @@ static void yy_reduce(
}
}
break;
- case 248: /* raisetype ::= ROLLBACK */
+ case 245: /* raisetype ::= ROLLBACK */
{yymsp[0].minor.yy194 = OE_Rollback;}
break;
- case 250: /* raisetype ::= FAIL */
+ case 247: /* raisetype ::= FAIL */
{yymsp[0].minor.yy194 = OE_Fail;}
break;
- case 251: /* cmd ::= DROP TRIGGER ifexists fullname */
+ case 248: /* cmd ::= DROP TRIGGER ifexists fullname */
{
sqlite3DropTrigger(pParse,yymsp[0].minor.yy185,yymsp[-1].minor.yy194);
}
break;
- case 252: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
+ case 249: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */
{
sqlite3Attach(pParse, yymsp[-3].minor.yy190.pExpr, yymsp[-1].minor.yy190.pExpr, yymsp[0].minor.yy72);
}
break;
- case 253: /* cmd ::= DETACH database_kw_opt expr */
+ case 250: /* cmd ::= DETACH database_kw_opt expr */
{
sqlite3Detach(pParse, yymsp[0].minor.yy190.pExpr);
}
break;
- case 256: /* cmd ::= REINDEX */
+ case 253: /* cmd ::= REINDEX */
{sqlite3Reindex(pParse, 0, 0);}
break;
- case 257: /* cmd ::= REINDEX nm dbnm */
+ case 254: /* cmd ::= REINDEX nm dbnm */
{sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
break;
- case 258: /* cmd ::= ANALYZE */
+ case 255: /* cmd ::= ANALYZE */
{sqlite3Analyze(pParse, 0, 0);}
break;
- case 259: /* cmd ::= ANALYZE nm dbnm */
+ case 256: /* cmd ::= ANALYZE nm dbnm */
{sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);}
break;
- case 260: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
+ case 257: /* cmd ::= ALTER TABLE fullname RENAME TO nm */
{
sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy185,&yymsp[0].minor.yy0);
}
break;
- case 261: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
+ case 258: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt columnname carglist */
{
yymsp[-1].minor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-1].minor.yy0.z) + pParse->sLastToken.n;
sqlite3AlterFinishAddColumn(pParse, &yymsp[-1].minor.yy0);
}
break;
- case 262: /* add_column_fullname ::= fullname */
+ case 259: /* add_column_fullname ::= fullname */
{
disableLookaside(pParse);
sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy185);
}
break;
- case 263: /* cmd ::= create_vtab */
+ case 260: /* cmd ::= create_vtab */
{sqlite3VtabFinishParse(pParse,0);}
break;
- case 264: /* cmd ::= create_vtab LP vtabarglist RP */
+ case 261: /* cmd ::= create_vtab LP vtabarglist RP */
{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);}
break;
- case 265: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
+ case 262: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */
{
sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy194);
}
break;
- case 266: /* vtabarg ::= */
+ case 263: /* vtabarg ::= */
{sqlite3VtabArgInit(pParse);}
break;
- case 267: /* vtabargtoken ::= ANY */
- case 268: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==268);
- case 269: /* lp ::= LP */ yytestcase(yyruleno==269);
+ case 264: /* vtabargtoken ::= ANY */
+ case 265: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==265);
+ case 266: /* lp ::= LP */ yytestcase(yyruleno==266);
{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);}
break;
- case 270: /* with ::= */
+ case 267: /* with ::= */
{yymsp[1].minor.yy285 = 0;}
break;
- case 271: /* with ::= WITH wqlist */
+ case 268: /* with ::= WITH wqlist */
{ yymsp[-1].minor.yy285 = yymsp[0].minor.yy285; }
break;
- case 272: /* with ::= WITH RECURSIVE wqlist */
+ case 269: /* with ::= WITH RECURSIVE wqlist */
{ yymsp[-2].minor.yy285 = yymsp[0].minor.yy285; }
break;
- case 273: /* wqlist ::= nm eidlist_opt AS LP select RP */
+ case 270: /* wqlist ::= nm eidlist_opt AS LP select RP */
{
yymsp[-5].minor.yy285 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243); /*A-overwrites-X*/
}
break;
- case 274: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
+ case 271: /* wqlist ::= wqlist COMMA nm eidlist_opt AS LP select RP */
{
yymsp[-7].minor.yy285 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy285, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy148, yymsp[-1].minor.yy243);
}
break;
default:
- /* (275) input ::= cmdlist */ yytestcase(yyruleno==275);
- /* (276) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==276);
- /* (277) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=277);
- /* (278) ecmd ::= SEMI */ yytestcase(yyruleno==278);
- /* (279) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==279);
- /* (280) explain ::= */ yytestcase(yyruleno==280);
- /* (281) trans_opt ::= */ yytestcase(yyruleno==281);
- /* (282) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==282);
- /* (283) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==283);
- /* (284) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==284);
- /* (285) savepoint_opt ::= */ yytestcase(yyruleno==285);
- /* (286) cmd ::= create_table create_table_args */ yytestcase(yyruleno==286);
- /* (287) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==287);
- /* (288) columnlist ::= columnname carglist */ yytestcase(yyruleno==288);
- /* (289) nm ::= ID|INDEXED */ yytestcase(yyruleno==289);
- /* (290) nm ::= STRING */ yytestcase(yyruleno==290);
- /* (291) nm ::= JOIN_KW */ yytestcase(yyruleno==291);
- /* (292) typetoken ::= typename */ yytestcase(yyruleno==292);
- /* (293) typename ::= ID|STRING */ yytestcase(yyruleno==293);
- /* (294) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=294);
- /* (295) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=295);
- /* (296) carglist ::= carglist ccons */ yytestcase(yyruleno==296);
- /* (297) carglist ::= */ yytestcase(yyruleno==297);
- /* (298) ccons ::= NULL onconf */ yytestcase(yyruleno==298);
- /* (299) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==299);
- /* (300) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==300);
- /* (301) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=301);
- /* (302) tconscomma ::= */ yytestcase(yyruleno==302);
- /* (303) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=303);
- /* (304) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=304);
- /* (305) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=305);
- /* (306) oneselect ::= values */ yytestcase(yyruleno==306);
- /* (307) sclp ::= selcollist COMMA */ yytestcase(yyruleno==307);
- /* (308) as ::= ID|STRING */ yytestcase(yyruleno==308);
- /* (309) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=309);
- /* (310) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==310);
- /* (311) exprlist ::= nexprlist */ yytestcase(yyruleno==311);
- /* (312) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=312);
- /* (313) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=313);
- /* (314) nmnum ::= ON */ yytestcase(yyruleno==314);
- /* (315) nmnum ::= DELETE */ yytestcase(yyruleno==315);
- /* (316) nmnum ::= DEFAULT */ yytestcase(yyruleno==316);
- /* (317) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==317);
- /* (318) foreach_clause ::= */ yytestcase(yyruleno==318);
- /* (319) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==319);
- /* (320) trnm ::= nm */ yytestcase(yyruleno==320);
- /* (321) tridxby ::= */ yytestcase(yyruleno==321);
- /* (322) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==322);
- /* (323) database_kw_opt ::= */ yytestcase(yyruleno==323);
- /* (324) kwcolumn_opt ::= */ yytestcase(yyruleno==324);
- /* (325) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==325);
- /* (326) vtabarglist ::= vtabarg */ yytestcase(yyruleno==326);
- /* (327) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==327);
- /* (328) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==328);
- /* (329) anylist ::= */ yytestcase(yyruleno==329);
- /* (330) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==330);
- /* (331) anylist ::= anylist ANY */ yytestcase(yyruleno==331);
+ /* (272) input ::= cmdlist */ yytestcase(yyruleno==272);
+ /* (273) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==273);
+ /* (274) cmdlist ::= ecmd (OPTIMIZED OUT) */ assert(yyruleno!=274);
+ /* (275) ecmd ::= SEMI */ yytestcase(yyruleno==275);
+ /* (276) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==276);
+ /* (277) explain ::= */ yytestcase(yyruleno==277);
+ /* (278) trans_opt ::= */ yytestcase(yyruleno==278);
+ /* (279) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==279);
+ /* (280) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==280);
+ /* (281) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==281);
+ /* (282) savepoint_opt ::= */ yytestcase(yyruleno==282);
+ /* (283) cmd ::= create_table create_table_args */ yytestcase(yyruleno==283);
+ /* (284) columnlist ::= columnlist COMMA columnname carglist */ yytestcase(yyruleno==284);
+ /* (285) columnlist ::= columnname carglist */ yytestcase(yyruleno==285);
+ /* (286) nm ::= ID|INDEXED */ yytestcase(yyruleno==286);
+ /* (287) nm ::= STRING */ yytestcase(yyruleno==287);
+ /* (288) nm ::= JOIN_KW */ yytestcase(yyruleno==288);
+ /* (289) typetoken ::= typename */ yytestcase(yyruleno==289);
+ /* (290) typename ::= ID|STRING */ yytestcase(yyruleno==290);
+ /* (291) signed ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=291);
+ /* (292) signed ::= minus_num (OPTIMIZED OUT) */ assert(yyruleno!=292);
+ /* (293) carglist ::= carglist ccons */ yytestcase(yyruleno==293);
+ /* (294) carglist ::= */ yytestcase(yyruleno==294);
+ /* (295) ccons ::= NULL onconf */ yytestcase(yyruleno==295);
+ /* (296) conslist_opt ::= COMMA conslist */ yytestcase(yyruleno==296);
+ /* (297) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==297);
+ /* (298) conslist ::= tcons (OPTIMIZED OUT) */ assert(yyruleno!=298);
+ /* (299) tconscomma ::= */ yytestcase(yyruleno==299);
+ /* (300) defer_subclause_opt ::= defer_subclause (OPTIMIZED OUT) */ assert(yyruleno!=300);
+ /* (301) resolvetype ::= raisetype (OPTIMIZED OUT) */ assert(yyruleno!=301);
+ /* (302) selectnowith ::= oneselect (OPTIMIZED OUT) */ assert(yyruleno!=302);
+ /* (303) oneselect ::= values */ yytestcase(yyruleno==303);
+ /* (304) sclp ::= selcollist COMMA */ yytestcase(yyruleno==304);
+ /* (305) as ::= ID|STRING */ yytestcase(yyruleno==305);
+ /* (306) expr ::= term (OPTIMIZED OUT) */ assert(yyruleno!=306);
+ /* (307) likeop ::= LIKE_KW|MATCH */ yytestcase(yyruleno==307);
+ /* (308) exprlist ::= nexprlist */ yytestcase(yyruleno==308);
+ /* (309) nmnum ::= plus_num (OPTIMIZED OUT) */ assert(yyruleno!=309);
+ /* (310) nmnum ::= nm (OPTIMIZED OUT) */ assert(yyruleno!=310);
+ /* (311) nmnum ::= ON */ yytestcase(yyruleno==311);
+ /* (312) nmnum ::= DELETE */ yytestcase(yyruleno==312);
+ /* (313) nmnum ::= DEFAULT */ yytestcase(yyruleno==313);
+ /* (314) plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==314);
+ /* (315) foreach_clause ::= */ yytestcase(yyruleno==315);
+ /* (316) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==316);
+ /* (317) trnm ::= nm */ yytestcase(yyruleno==317);
+ /* (318) tridxby ::= */ yytestcase(yyruleno==318);
+ /* (319) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==319);
+ /* (320) database_kw_opt ::= */ yytestcase(yyruleno==320);
+ /* (321) kwcolumn_opt ::= */ yytestcase(yyruleno==321);
+ /* (322) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==322);
+ /* (323) vtabarglist ::= vtabarg */ yytestcase(yyruleno==323);
+ /* (324) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==324);
+ /* (325) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==325);
+ /* (326) anylist ::= */ yytestcase(yyruleno==326);
+ /* (327) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==327);
+ /* (328) anylist ::= anylist ANY */ yytestcase(yyruleno==328);
break;
/********** End reduce actions ************************************************/
};
assert( yyruleno<sizeof(yyRuleInfo)/sizeof(yyRuleInfo[0]) );
yygoto = yyRuleInfo[yyruleno].lhs;
yysize = yyRuleInfo[yyruleno].nrhs;
- yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto);
- if( yyact <= YY_MAX_SHIFTREDUCE ){
- if( yyact>YY_MAX_SHIFT ){
- yyact += YY_MIN_REDUCE - YY_MIN_SHIFTREDUCE;
- }
- yymsp -= yysize-1;
+ yyact = yy_find_reduce_action(yymsp[yysize].stateno,(YYCODETYPE)yygoto);
+
+ /* There are no SHIFTREDUCE actions on nonterminals because the table
+ ** generator has simplified them to pure REDUCE actions. */
+ assert( !(yyact>YY_MAX_SHIFT && yyact<=YY_MAX_SHIFTREDUCE) );
+
+ /* It is not possible for a REDUCE to be followed by an error */
+ assert( yyact!=YY_ERROR_ACTION );
+
+ if( yyact==YY_ACCEPT_ACTION ){
+ yypParser->yytos += yysize;
+ yy_accept(yypParser);
+ }else{
+ yymsp += yysize+1;
yypParser->yytos = yymsp;
yymsp->stateno = (YYACTIONTYPE)yyact;
yymsp->major = (YYCODETYPE)yygoto;
yyTraceShift(yypParser, yyact);
- }else{
- assert( yyact == YY_ACCEPT_ACTION );
- yypParser->yytos -= yysize;
- yy_accept(yypParser);
}
}
@@ -139334,134 +140833,145 @@ const unsigned char ebcdicToAscii[] = {
** on platforms with limited memory.
*/
/* Hash score: 182 */
+/* zKWText[] encodes 834 bytes of keyword text in 554 bytes */
+/* REINDEXEDESCAPEACHECKEYBEFOREIGNOREGEXPLAINSTEADDATABASELECT */
+/* ABLEFTHENDEFERRABLELSEXCEPTRANSACTIONATURALTERAISEXCLUSIVE */
+/* XISTSAVEPOINTERSECTRIGGEREFERENCESCONSTRAINTOFFSETEMPORARY */
+/* UNIQUERYWITHOUTERELEASEATTACHAVINGROUPDATEBEGINNERECURSIVE */
+/* BETWEENOTNULLIKECASCADELETECASECOLLATECREATECURRENT_DATEDETACH */
+/* IMMEDIATEJOINSERTMATCHPLANALYZEPRAGMABORTVALUESVIRTUALIMITWHEN */
+/* WHERENAMEAFTEREPLACEANDEFAULTAUTOINCREMENTCASTCOLUMNCOMMIT */
+/* CONFLICTCROSSCURRENT_TIMESTAMPRIMARYDEFERREDISTINCTDROPFAIL */
+/* FROMFULLGLOBYIFISNULLORDERESTRICTRIGHTROLLBACKROWUNIONUSING */
+/* VACUUMVIEWINITIALLY */
+static const char zKWText[553] = {
+ 'R','E','I','N','D','E','X','E','D','E','S','C','A','P','E','A','C','H',
+ 'E','C','K','E','Y','B','E','F','O','R','E','I','G','N','O','R','E','G',
+ 'E','X','P','L','A','I','N','S','T','E','A','D','D','A','T','A','B','A',
+ 'S','E','L','E','C','T','A','B','L','E','F','T','H','E','N','D','E','F',
+ 'E','R','R','A','B','L','E','L','S','E','X','C','E','P','T','R','A','N',
+ 'S','A','C','T','I','O','N','A','T','U','R','A','L','T','E','R','A','I',
+ 'S','E','X','C','L','U','S','I','V','E','X','I','S','T','S','A','V','E',
+ 'P','O','I','N','T','E','R','S','E','C','T','R','I','G','G','E','R','E',
+ 'F','E','R','E','N','C','E','S','C','O','N','S','T','R','A','I','N','T',
+ 'O','F','F','S','E','T','E','M','P','O','R','A','R','Y','U','N','I','Q',
+ 'U','E','R','Y','W','I','T','H','O','U','T','E','R','E','L','E','A','S',
+ 'E','A','T','T','A','C','H','A','V','I','N','G','R','O','U','P','D','A',
+ 'T','E','B','E','G','I','N','N','E','R','E','C','U','R','S','I','V','E',
+ 'B','E','T','W','E','E','N','O','T','N','U','L','L','I','K','E','C','A',
+ 'S','C','A','D','E','L','E','T','E','C','A','S','E','C','O','L','L','A',
+ 'T','E','C','R','E','A','T','E','C','U','R','R','E','N','T','_','D','A',
+ 'T','E','D','E','T','A','C','H','I','M','M','E','D','I','A','T','E','J',
+ 'O','I','N','S','E','R','T','M','A','T','C','H','P','L','A','N','A','L',
+ 'Y','Z','E','P','R','A','G','M','A','B','O','R','T','V','A','L','U','E',
+ 'S','V','I','R','T','U','A','L','I','M','I','T','W','H','E','N','W','H',
+ 'E','R','E','N','A','M','E','A','F','T','E','R','E','P','L','A','C','E',
+ 'A','N','D','E','F','A','U','L','T','A','U','T','O','I','N','C','R','E',
+ 'M','E','N','T','C','A','S','T','C','O','L','U','M','N','C','O','M','M',
+ 'I','T','C','O','N','F','L','I','C','T','C','R','O','S','S','C','U','R',
+ 'R','E','N','T','_','T','I','M','E','S','T','A','M','P','R','I','M','A',
+ 'R','Y','D','E','F','E','R','R','E','D','I','S','T','I','N','C','T','D',
+ 'R','O','P','F','A','I','L','F','R','O','M','F','U','L','L','G','L','O',
+ 'B','Y','I','F','I','S','N','U','L','L','O','R','D','E','R','E','S','T',
+ 'R','I','C','T','R','I','G','H','T','R','O','L','L','B','A','C','K','R',
+ 'O','W','U','N','I','O','N','U','S','I','N','G','V','A','C','U','U','M',
+ 'V','I','E','W','I','N','I','T','I','A','L','L','Y',
+};
+/* aKWHash[i] is the hash value for the i-th keyword */
+static const unsigned char aKWHash[127] = {
+ 76, 105, 117, 74, 0, 45, 0, 0, 82, 0, 77, 0, 0,
+ 42, 12, 78, 15, 0, 116, 85, 54, 112, 0, 19, 0, 0,
+ 121, 0, 119, 115, 0, 22, 93, 0, 9, 0, 0, 70, 71,
+ 0, 69, 6, 0, 48, 90, 102, 0, 118, 101, 0, 0, 44,
+ 0, 103, 24, 0, 17, 0, 122, 53, 23, 0, 5, 110, 25,
+ 96, 0, 0, 124, 106, 60, 123, 57, 28, 55, 0, 91, 0,
+ 100, 26, 0, 99, 0, 0, 0, 95, 92, 97, 88, 109, 14,
+ 39, 108, 0, 81, 0, 18, 89, 111, 32, 0, 120, 80, 113,
+ 62, 46, 84, 0, 0, 94, 40, 59, 114, 0, 36, 0, 0,
+ 29, 0, 86, 63, 64, 0, 20, 61, 0, 56,
+};
+/* aKWNext[] forms the hash collision chain. If aKWHash[i]==0
+** then the i-th keyword has no more hash collisions. Otherwise,
+** the next keyword with the same hash is aKWHash[i]-1. */
+static const unsigned char aKWNext[124] = {
+ 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 2, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0,
+ 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 33, 0, 21, 0, 0, 0, 0, 0, 50,
+ 0, 43, 3, 47, 0, 0, 0, 0, 30, 0, 58, 0, 38,
+ 0, 0, 0, 1, 66, 0, 0, 67, 0, 41, 0, 0, 0,
+ 0, 0, 0, 49, 65, 0, 0, 0, 0, 31, 52, 16, 34,
+ 10, 0, 0, 0, 0, 0, 0, 0, 11, 72, 79, 0, 8,
+ 0, 104, 98, 0, 107, 0, 87, 0, 75, 51, 0, 27, 37,
+ 73, 83, 0, 35, 68, 0, 0,
+};
+/* aKWLen[i] is the length (in bytes) of the i-th keyword */
+static const unsigned char aKWLen[124] = {
+ 7, 7, 5, 4, 6, 4, 5, 3, 6, 7, 3, 6, 6,
+ 7, 7, 3, 8, 2, 6, 5, 4, 4, 3, 10, 4, 6,
+ 11, 6, 2, 7, 5, 5, 9, 6, 9, 9, 7, 10, 10,
+ 4, 6, 2, 3, 9, 4, 2, 6, 5, 7, 4, 5, 7,
+ 6, 6, 5, 6, 5, 5, 9, 7, 7, 3, 2, 4, 4,
+ 7, 3, 6, 4, 7, 6, 12, 6, 9, 4, 6, 5, 4,
+ 7, 6, 5, 6, 7, 5, 4, 5, 6, 5, 7, 3, 7,
+ 13, 2, 2, 4, 6, 6, 8, 5, 17, 12, 7, 8, 8,
+ 2, 4, 4, 4, 4, 4, 2, 2, 6, 5, 8, 5, 8,
+ 3, 5, 5, 6, 4, 9, 3,
+};
+/* aKWOffset[i] is the index into zKWText[] of the start of
+** the text for the i-th keyword. */
+static const unsigned short int aKWOffset[124] = {
+ 0, 2, 2, 8, 9, 14, 16, 20, 23, 25, 25, 29, 33,
+ 36, 41, 46, 48, 53, 54, 59, 62, 65, 67, 69, 78, 81,
+ 86, 91, 95, 96, 101, 105, 109, 117, 122, 128, 136, 142, 152,
+ 159, 162, 162, 165, 167, 167, 171, 176, 179, 184, 184, 188, 192,
+ 199, 204, 209, 212, 218, 221, 225, 234, 240, 240, 240, 243, 246,
+ 250, 251, 255, 261, 265, 272, 278, 290, 296, 305, 307, 313, 318,
+ 320, 327, 332, 337, 343, 349, 354, 358, 361, 367, 371, 378, 380,
+ 387, 389, 391, 400, 404, 410, 416, 424, 429, 429, 445, 452, 459,
+ 460, 467, 471, 475, 479, 483, 486, 488, 490, 496, 500, 508, 513,
+ 521, 524, 529, 534, 540, 544, 549,
+};
+/* aKWCode[i] is the parser symbol code for the i-th keyword */
+static const unsigned char aKWCode[124] = {
+ TK_REINDEX, TK_INDEXED, TK_INDEX, TK_DESC, TK_ESCAPE,
+ TK_EACH, TK_CHECK, TK_KEY, TK_BEFORE, TK_FOREIGN,
+ TK_FOR, TK_IGNORE, TK_LIKE_KW, TK_EXPLAIN, TK_INSTEAD,
+ TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_TABLE,
+ TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE,
+ TK_EXCEPT, TK_TRANSACTION,TK_ACTION, TK_ON, TK_JOIN_KW,
+ TK_ALTER, TK_RAISE, TK_EXCLUSIVE, TK_EXISTS, TK_SAVEPOINT,
+ TK_INTERSECT, TK_TRIGGER, TK_REFERENCES, TK_CONSTRAINT, TK_INTO,
+ TK_OFFSET, TK_OF, TK_SET, TK_TEMP, TK_TEMP,
+ TK_OR, TK_UNIQUE, TK_QUERY, TK_WITHOUT, TK_WITH,
+ TK_JOIN_KW, TK_RELEASE, TK_ATTACH, TK_HAVING, TK_GROUP,
+ TK_UPDATE, TK_BEGIN, TK_JOIN_KW, TK_RECURSIVE, TK_BETWEEN,
+ TK_NOTNULL, TK_NOT, TK_NO, TK_NULL, TK_LIKE_KW,
+ TK_CASCADE, TK_ASC, TK_DELETE, TK_CASE, TK_COLLATE,
+ TK_CREATE, TK_CTIME_KW, TK_DETACH, TK_IMMEDIATE, TK_JOIN,
+ TK_INSERT, TK_MATCH, TK_PLAN, TK_ANALYZE, TK_PRAGMA,
+ TK_ABORT, TK_VALUES, TK_VIRTUAL, TK_LIMIT, TK_WHEN,
+ TK_WHERE, TK_RENAME, TK_AFTER, TK_REPLACE, TK_AND,
+ TK_DEFAULT, TK_AUTOINCR, TK_TO, TK_IN, TK_CAST,
+ TK_COLUMNKW, TK_COMMIT, TK_CONFLICT, TK_JOIN_KW, TK_CTIME_KW,
+ TK_CTIME_KW, TK_PRIMARY, TK_DEFERRED, TK_DISTINCT, TK_IS,
+ TK_DROP, TK_FAIL, TK_FROM, TK_JOIN_KW, TK_LIKE_KW,
+ TK_BY, TK_IF, TK_ISNULL, TK_ORDER, TK_RESTRICT,
+ TK_JOIN_KW, TK_ROLLBACK, TK_ROW, TK_UNION, TK_USING,
+ TK_VACUUM, TK_VIEW, TK_INITIALLY, TK_ALL,
+};
+/* Check to see if z[0..n-1] is a keyword. If it is, write the
+** parser symbol code for that keyword into *pType. Always
+** return the integer n (the length of the token). */
static int keywordCode(const char *z, int n, int *pType){
- /* zText[] encodes 834 bytes of keywords in 554 bytes */
- /* REINDEXEDESCAPEACHECKEYBEFOREIGNOREGEXPLAINSTEADDATABASELECT */
- /* ABLEFTHENDEFERRABLELSEXCEPTRANSACTIONATURALTERAISEXCLUSIVE */
- /* XISTSAVEPOINTERSECTRIGGEREFERENCESCONSTRAINTOFFSETEMPORARY */
- /* UNIQUERYWITHOUTERELEASEATTACHAVINGROUPDATEBEGINNERECURSIVE */
- /* BETWEENOTNULLIKECASCADELETECASECOLLATECREATECURRENT_DATEDETACH */
- /* IMMEDIATEJOINSERTMATCHPLANALYZEPRAGMABORTVALUESVIRTUALIMITWHEN */
- /* WHERENAMEAFTEREPLACEANDEFAULTAUTOINCREMENTCASTCOLUMNCOMMIT */
- /* CONFLICTCROSSCURRENT_TIMESTAMPRIMARYDEFERREDISTINCTDROPFAIL */
- /* FROMFULLGLOBYIFISNULLORDERESTRICTRIGHTROLLBACKROWUNIONUSING */
- /* VACUUMVIEWINITIALLY */
- static const char zText[553] = {
- 'R','E','I','N','D','E','X','E','D','E','S','C','A','P','E','A','C','H',
- 'E','C','K','E','Y','B','E','F','O','R','E','I','G','N','O','R','E','G',
- 'E','X','P','L','A','I','N','S','T','E','A','D','D','A','T','A','B','A',
- 'S','E','L','E','C','T','A','B','L','E','F','T','H','E','N','D','E','F',
- 'E','R','R','A','B','L','E','L','S','E','X','C','E','P','T','R','A','N',
- 'S','A','C','T','I','O','N','A','T','U','R','A','L','T','E','R','A','I',
- 'S','E','X','C','L','U','S','I','V','E','X','I','S','T','S','A','V','E',
- 'P','O','I','N','T','E','R','S','E','C','T','R','I','G','G','E','R','E',
- 'F','E','R','E','N','C','E','S','C','O','N','S','T','R','A','I','N','T',
- 'O','F','F','S','E','T','E','M','P','O','R','A','R','Y','U','N','I','Q',
- 'U','E','R','Y','W','I','T','H','O','U','T','E','R','E','L','E','A','S',
- 'E','A','T','T','A','C','H','A','V','I','N','G','R','O','U','P','D','A',
- 'T','E','B','E','G','I','N','N','E','R','E','C','U','R','S','I','V','E',
- 'B','E','T','W','E','E','N','O','T','N','U','L','L','I','K','E','C','A',
- 'S','C','A','D','E','L','E','T','E','C','A','S','E','C','O','L','L','A',
- 'T','E','C','R','E','A','T','E','C','U','R','R','E','N','T','_','D','A',
- 'T','E','D','E','T','A','C','H','I','M','M','E','D','I','A','T','E','J',
- 'O','I','N','S','E','R','T','M','A','T','C','H','P','L','A','N','A','L',
- 'Y','Z','E','P','R','A','G','M','A','B','O','R','T','V','A','L','U','E',
- 'S','V','I','R','T','U','A','L','I','M','I','T','W','H','E','N','W','H',
- 'E','R','E','N','A','M','E','A','F','T','E','R','E','P','L','A','C','E',
- 'A','N','D','E','F','A','U','L','T','A','U','T','O','I','N','C','R','E',
- 'M','E','N','T','C','A','S','T','C','O','L','U','M','N','C','O','M','M',
- 'I','T','C','O','N','F','L','I','C','T','C','R','O','S','S','C','U','R',
- 'R','E','N','T','_','T','I','M','E','S','T','A','M','P','R','I','M','A',
- 'R','Y','D','E','F','E','R','R','E','D','I','S','T','I','N','C','T','D',
- 'R','O','P','F','A','I','L','F','R','O','M','F','U','L','L','G','L','O',
- 'B','Y','I','F','I','S','N','U','L','L','O','R','D','E','R','E','S','T',
- 'R','I','C','T','R','I','G','H','T','R','O','L','L','B','A','C','K','R',
- 'O','W','U','N','I','O','N','U','S','I','N','G','V','A','C','U','U','M',
- 'V','I','E','W','I','N','I','T','I','A','L','L','Y',
- };
- static const unsigned char aHash[127] = {
- 76, 105, 117, 74, 0, 45, 0, 0, 82, 0, 77, 0, 0,
- 42, 12, 78, 15, 0, 116, 85, 54, 112, 0, 19, 0, 0,
- 121, 0, 119, 115, 0, 22, 93, 0, 9, 0, 0, 70, 71,
- 0, 69, 6, 0, 48, 90, 102, 0, 118, 101, 0, 0, 44,
- 0, 103, 24, 0, 17, 0, 122, 53, 23, 0, 5, 110, 25,
- 96, 0, 0, 124, 106, 60, 123, 57, 28, 55, 0, 91, 0,
- 100, 26, 0, 99, 0, 0, 0, 95, 92, 97, 88, 109, 14,
- 39, 108, 0, 81, 0, 18, 89, 111, 32, 0, 120, 80, 113,
- 62, 46, 84, 0, 0, 94, 40, 59, 114, 0, 36, 0, 0,
- 29, 0, 86, 63, 64, 0, 20, 61, 0, 56,
- };
- static const unsigned char aNext[124] = {
- 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 2, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0,
- 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 33, 0, 21, 0, 0, 0, 0, 0, 50,
- 0, 43, 3, 47, 0, 0, 0, 0, 30, 0, 58, 0, 38,
- 0, 0, 0, 1, 66, 0, 0, 67, 0, 41, 0, 0, 0,
- 0, 0, 0, 49, 65, 0, 0, 0, 0, 31, 52, 16, 34,
- 10, 0, 0, 0, 0, 0, 0, 0, 11, 72, 79, 0, 8,
- 0, 104, 98, 0, 107, 0, 87, 0, 75, 51, 0, 27, 37,
- 73, 83, 0, 35, 68, 0, 0,
- };
- static const unsigned char aLen[124] = {
- 7, 7, 5, 4, 6, 4, 5, 3, 6, 7, 3, 6, 6,
- 7, 7, 3, 8, 2, 6, 5, 4, 4, 3, 10, 4, 6,
- 11, 6, 2, 7, 5, 5, 9, 6, 9, 9, 7, 10, 10,
- 4, 6, 2, 3, 9, 4, 2, 6, 5, 7, 4, 5, 7,
- 6, 6, 5, 6, 5, 5, 9, 7, 7, 3, 2, 4, 4,
- 7, 3, 6, 4, 7, 6, 12, 6, 9, 4, 6, 5, 4,
- 7, 6, 5, 6, 7, 5, 4, 5, 6, 5, 7, 3, 7,
- 13, 2, 2, 4, 6, 6, 8, 5, 17, 12, 7, 8, 8,
- 2, 4, 4, 4, 4, 4, 2, 2, 6, 5, 8, 5, 8,
- 3, 5, 5, 6, 4, 9, 3,
- };
- static const unsigned short int aOffset[124] = {
- 0, 2, 2, 8, 9, 14, 16, 20, 23, 25, 25, 29, 33,
- 36, 41, 46, 48, 53, 54, 59, 62, 65, 67, 69, 78, 81,
- 86, 91, 95, 96, 101, 105, 109, 117, 122, 128, 136, 142, 152,
- 159, 162, 162, 165, 167, 167, 171, 176, 179, 184, 184, 188, 192,
- 199, 204, 209, 212, 218, 221, 225, 234, 240, 240, 240, 243, 246,
- 250, 251, 255, 261, 265, 272, 278, 290, 296, 305, 307, 313, 318,
- 320, 327, 332, 337, 343, 349, 354, 358, 361, 367, 371, 378, 380,
- 387, 389, 391, 400, 404, 410, 416, 424, 429, 429, 445, 452, 459,
- 460, 467, 471, 475, 479, 483, 486, 488, 490, 496, 500, 508, 513,
- 521, 524, 529, 534, 540, 544, 549,
- };
- static const unsigned char aCode[124] = {
- TK_REINDEX, TK_INDEXED, TK_INDEX, TK_DESC, TK_ESCAPE,
- TK_EACH, TK_CHECK, TK_KEY, TK_BEFORE, TK_FOREIGN,
- TK_FOR, TK_IGNORE, TK_LIKE_KW, TK_EXPLAIN, TK_INSTEAD,
- TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_TABLE,
- TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE,
- TK_EXCEPT, TK_TRANSACTION,TK_ACTION, TK_ON, TK_JOIN_KW,
- TK_ALTER, TK_RAISE, TK_EXCLUSIVE, TK_EXISTS, TK_SAVEPOINT,
- TK_INTERSECT, TK_TRIGGER, TK_REFERENCES, TK_CONSTRAINT, TK_INTO,
- TK_OFFSET, TK_OF, TK_SET, TK_TEMP, TK_TEMP,
- TK_OR, TK_UNIQUE, TK_QUERY, TK_WITHOUT, TK_WITH,
- TK_JOIN_KW, TK_RELEASE, TK_ATTACH, TK_HAVING, TK_GROUP,
- TK_UPDATE, TK_BEGIN, TK_JOIN_KW, TK_RECURSIVE, TK_BETWEEN,
- TK_NOTNULL, TK_NOT, TK_NO, TK_NULL, TK_LIKE_KW,
- TK_CASCADE, TK_ASC, TK_DELETE, TK_CASE, TK_COLLATE,
- TK_CREATE, TK_CTIME_KW, TK_DETACH, TK_IMMEDIATE, TK_JOIN,
- TK_INSERT, TK_MATCH, TK_PLAN, TK_ANALYZE, TK_PRAGMA,
- TK_ABORT, TK_VALUES, TK_VIRTUAL, TK_LIMIT, TK_WHEN,
- TK_WHERE, TK_RENAME, TK_AFTER, TK_REPLACE, TK_AND,
- TK_DEFAULT, TK_AUTOINCR, TK_TO, TK_IN, TK_CAST,
- TK_COLUMNKW, TK_COMMIT, TK_CONFLICT, TK_JOIN_KW, TK_CTIME_KW,
- TK_CTIME_KW, TK_PRIMARY, TK_DEFERRED, TK_DISTINCT, TK_IS,
- TK_DROP, TK_FAIL, TK_FROM, TK_JOIN_KW, TK_LIKE_KW,
- TK_BY, TK_IF, TK_ISNULL, TK_ORDER, TK_RESTRICT,
- TK_JOIN_KW, TK_ROLLBACK, TK_ROW, TK_UNION, TK_USING,
- TK_VACUUM, TK_VIEW, TK_INITIALLY, TK_ALL,
- };
int i, j;
const char *zKW;
if( n>=2 ){
i = ((charMap(z[0])*4) ^ (charMap(z[n-1])*3) ^ n) % 127;
- for(i=((int)aHash[i])-1; i>=0; i=((int)aNext[i])-1){
- if( aLen[i]!=n ) continue;
+ for(i=((int)aKWHash[i])-1; i>=0; i=((int)aKWNext[i])-1){
+ if( aKWLen[i]!=n ) continue;
j = 0;
- zKW = &zText[aOffset[i]];
+ zKW = &zKWText[aKWOffset[i]];
#ifdef SQLITE_ASCII
while( j<n && (z[j]&~0x20)==zKW[j] ){ j++; }
#endif
@@ -139593,7 +141103,7 @@ static int keywordCode(const char *z, int n, int *pType){
testcase( i==121 ); /* VIEW */
testcase( i==122 ); /* INITIALLY */
testcase( i==123 ); /* ALL */
- *pType = aCode[i];
+ *pType = aKWCode[i];
break;
}
}
@@ -140496,6 +142006,9 @@ SQLITE_PRIVATE int sqlite3IcuInit(sqlite3 *db);
#ifdef SQLITE_ENABLE_JSON1
SQLITE_PRIVATE int sqlite3Json1Init(sqlite3*);
#endif
+#ifdef SQLITE_ENABLE_STMTVTAB
+SQLITE_PRIVATE int sqlite3StmtVtabInit(sqlite3*);
+#endif
#ifdef SQLITE_ENABLE_FTS5
SQLITE_PRIVATE int sqlite3Fts5Init(sqlite3*);
#endif
@@ -140512,11 +142025,13 @@ SQLITE_API const char sqlite3_version[] = SQLITE_VERSION;
*/
SQLITE_API const char *sqlite3_libversion(void){ return sqlite3_version; }
-/* IMPLEMENTATION-OF: R-63124-39300 The sqlite3_sourceid() function returns a
+/* IMPLEMENTATION-OF: R-25063-23286 The sqlite3_sourceid() function returns a
** pointer to a string constant whose value is the same as the
-** SQLITE_SOURCE_ID C preprocessor macro.
+** SQLITE_SOURCE_ID C preprocessor macro. Except if SQLite is built using
+** an edited copy of the amalgamation, then the last four characters of
+** the hash might be different from SQLITE_SOURCE_ID.
*/
-SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
+/* SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } */
/* IMPLEMENTATION-OF: R-35210-63508 The sqlite3_libversion_number() function
** returns an integer equal to SQLITE_VERSION_NUMBER.
@@ -140901,14 +142416,8 @@ SQLITE_API int sqlite3_config(int op, ...){
sqlite3GlobalConfig.bMemstat = va_arg(ap, int);
break;
}
- case SQLITE_CONFIG_SCRATCH: {
- /* EVIDENCE-OF: R-08404-60887 There are three arguments to
- ** SQLITE_CONFIG_SCRATCH: A pointer an 8-byte aligned memory buffer from
- ** which the scratch allocations will be drawn, the size of each scratch
- ** allocation (sz), and the maximum number of scratch allocations (N). */
- sqlite3GlobalConfig.pScratch = va_arg(ap, void*);
- sqlite3GlobalConfig.szScratch = va_arg(ap, int);
- sqlite3GlobalConfig.nScratch = va_arg(ap, int);
+ case SQLITE_CONFIG_SMALL_MALLOC: {
+ sqlite3GlobalConfig.bSmallMalloc = va_arg(ap, int);
break;
}
case SQLITE_CONFIG_PAGECACHE: {
@@ -141129,7 +142638,8 @@ SQLITE_API int sqlite3_config(int op, ...){
static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){
#ifndef SQLITE_OMIT_LOOKASIDE
void *pStart;
- if( db->lookaside.nOut ){
+
+ if( sqlite3LookasideUsed(db,0)>0 ){
return SQLITE_BUSY;
}
/* Free any existing lookaside buffer for this handle before
@@ -141157,16 +142667,18 @@ static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){
pStart = pBuf;
}
db->lookaside.pStart = pStart;
+ db->lookaside.pInit = 0;
db->lookaside.pFree = 0;
db->lookaside.sz = (u16)sz;
if( pStart ){
int i;
LookasideSlot *p;
assert( sz > (int)sizeof(LookasideSlot*) );
+ db->lookaside.nSlot = cnt;
p = (LookasideSlot*)pStart;
for(i=cnt-1; i>=0; i--){
- p->pNext = db->lookaside.pFree;
- db->lookaside.pFree = p;
+ p->pNext = db->lookaside.pInit;
+ db->lookaside.pInit = p;
p = (LookasideSlot*)&((u8*)p)[sz];
}
db->lookaside.pEnd = p;
@@ -141177,6 +142689,7 @@ static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){
db->lookaside.pEnd = db;
db->lookaside.bDisable = 1;
db->lookaside.bMalloced = 0;
+ db->lookaside.nSlot = 0;
}
#endif /* SQLITE_OMIT_LOOKASIDE */
return SQLITE_OK;
@@ -141258,6 +142771,8 @@ SQLITE_API int sqlite3_db_config(sqlite3 *db, int op, ...){
va_start(ap, op);
switch( op ){
case SQLITE_DBCONFIG_MAINDBNAME: {
+ /* IMP: R-06824-28531 */
+ /* IMP: R-36257-52125 */
db->aDb[0].zDbSName = va_arg(ap,char*);
rc = SQLITE_OK;
break;
@@ -141279,6 +142794,7 @@ SQLITE_API int sqlite3_db_config(sqlite3 *db, int op, ...){
{ SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER, SQLITE_Fts3Tokenizer },
{ SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION, SQLITE_LoadExtension },
{ SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE, SQLITE_NoCkptOnClose },
+ { SQLITE_DBCONFIG_ENABLE_QPSG, SQLITE_EnableQPSG },
};
unsigned int i;
rc = SQLITE_ERROR; /* IMP: R-42790-23372 */
@@ -141286,7 +142802,7 @@ SQLITE_API int sqlite3_db_config(sqlite3 *db, int op, ...){
if( aFlagOp[i].op==op ){
int onoff = va_arg(ap, int);
int *pRes = va_arg(ap, int*);
- int oldFlags = db->flags;
+ u32 oldFlags = db->flags;
if( onoff>0 ){
db->flags |= aFlagOp[i].mask;
}else if( onoff==0 ){
@@ -141335,6 +142851,7 @@ static int binCollFunc(
/* EVIDENCE-OF: R-65033-28449 The built-in BINARY collation compares
** strings byte by byte using the memcmp() function from the standard C
** library. */
+ assert( pKey1 && pKey2 );
rc = memcmp(pKey1, pKey2, n);
if( rc==0 ){
if( padFlag
@@ -141692,7 +143209,7 @@ SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3 *db){
sqlite3_mutex_leave(db->mutex);
db->magic = SQLITE_MAGIC_CLOSED;
sqlite3_mutex_free(db->mutex);
- assert( db->lookaside.nOut==0 ); /* Fails on a lookaside memory leak */
+ assert( sqlite3LookasideUsed(db,0)==0 );
if( db->lookaside.bMalloced ){
sqlite3_free(db->lookaside.pStart);
}
@@ -141720,7 +143237,7 @@ SQLITE_PRIVATE void sqlite3RollbackAll(sqlite3 *db, int tripCode){
** the database rollback and schema reset, which can cause false
** corruption reports in some cases. */
sqlite3BtreeEnterAll(db);
- schemaChange = (db->flags & SQLITE_InternChanges)!=0 && db->init.busy==0;
+ schemaChange = (db->mDbFlags & DBFLAG_SchemaChange)!=0 && db->init.busy==0;
for(i=0; i<db->nDb; i++){
Btree *p = db->aDb[i].pBt;
@@ -141734,7 +143251,7 @@ SQLITE_PRIVATE void sqlite3RollbackAll(sqlite3 *db, int tripCode){
sqlite3VtabRollback(db);
sqlite3EndBenignMalloc();
- if( (db->flags&SQLITE_InternChanges)!=0 && db->init.busy==0 ){
+ if( (db->mDbFlags&DBFLAG_SchemaChange)!=0 && db->init.busy==0 ){
sqlite3ExpirePreparedStatements(db);
sqlite3ResetAllSchemasOfConnection(db);
}
@@ -141867,10 +143384,10 @@ SQLITE_PRIVATE const char *sqlite3ErrName(int rc){
SQLITE_PRIVATE const char *sqlite3ErrStr(int rc){
static const char* const aMsg[] = {
/* SQLITE_OK */ "not an error",
- /* SQLITE_ERROR */ "SQL logic error or missing database",
+ /* SQLITE_ERROR */ "SQL logic error",
/* SQLITE_INTERNAL */ 0,
/* SQLITE_PERM */ "access permission denied",
- /* SQLITE_ABORT */ "callback requested query abort",
+ /* SQLITE_ABORT */ "query aborted",
/* SQLITE_BUSY */ "database is locked",
/* SQLITE_LOCKED */ "database table is locked",
/* SQLITE_NOMEM */ "out of memory",
@@ -141882,17 +143399,21 @@ SQLITE_PRIVATE const char *sqlite3ErrStr(int rc){
/* SQLITE_FULL */ "database or disk is full",
/* SQLITE_CANTOPEN */ "unable to open database file",
/* SQLITE_PROTOCOL */ "locking protocol",
- /* SQLITE_EMPTY */ "table contains no data",
+ /* SQLITE_EMPTY */ 0,
/* SQLITE_SCHEMA */ "database schema has changed",
/* SQLITE_TOOBIG */ "string or blob too big",
/* SQLITE_CONSTRAINT */ "constraint failed",
/* SQLITE_MISMATCH */ "datatype mismatch",
- /* SQLITE_MISUSE */ "library routine called out of sequence",
+ /* SQLITE_MISUSE */ "bad parameter or other API misuse",
+#ifdef SQLITE_DISABLE_LFS
/* SQLITE_NOLFS */ "large file support is disabled",
+#else
+ /* SQLITE_NOLFS */ 0,
+#endif
/* SQLITE_AUTH */ "authorization denied",
- /* SQLITE_FORMAT */ "auxiliary database format error",
- /* SQLITE_RANGE */ "bind or column index out of range",
- /* SQLITE_NOTADB */ "file is encrypted or is not a database",
+ /* SQLITE_FORMAT */ 0,
+ /* SQLITE_RANGE */ "column index out of range",
+ /* SQLITE_NOTADB */ "file is not a database",
};
const char *zErr = "unknown error";
switch( rc ){
@@ -142632,7 +144153,8 @@ SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb){
** checkpointed. If an error is encountered it is returned immediately -
** no attempt is made to checkpoint any remaining databases.
**
-** Parameter eMode is one of SQLITE_CHECKPOINT_PASSIVE, FULL or RESTART.
+** Parameter eMode is one of SQLITE_CHECKPOINT_PASSIVE, FULL, RESTART
+** or TRUNCATE.
*/
SQLITE_PRIVATE int sqlite3Checkpoint(sqlite3 *db, int iDb, int eMode, int *pnLog, int *pnCkpt){
int rc = SQLITE_OK; /* Return code */
@@ -142732,12 +144254,9 @@ SQLITE_API const void *sqlite3_errmsg16(sqlite3 *db){
'o', 'u', 't', ' ', 'o', 'f', ' ', 'm', 'e', 'm', 'o', 'r', 'y', 0
};
static const u16 misuse[] = {
- 'l', 'i', 'b', 'r', 'a', 'r', 'y', ' ',
- 'r', 'o', 'u', 't', 'i', 'n', 'e', ' ',
- 'c', 'a', 'l', 'l', 'e', 'd', ' ',
- 'o', 'u', 't', ' ',
- 'o', 'f', ' ',
- 's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', 0
+ 'b', 'a', 'd', ' ', 'p', 'a', 'r', 'a', 'm', 'e', 't', 'e', 'r', ' ',
+ 'o', 'r', ' ', 'o', 't', 'h', 'e', 'r', ' ', 'A', 'P', 'I', ' ',
+ 'm', 'i', 's', 'u', 's', 'e', 0
};
const void *z;
@@ -143272,26 +144791,6 @@ static int openDatabase(
if( rc ) return rc;
#endif
- /* Only allow sensible combinations of bits in the flags argument.
- ** Throw an error if any non-sense combination is used. If we
- ** do not block illegal combinations here, it could trigger
- ** assert() statements in deeper layers. Sensible combinations
- ** are:
- **
- ** 1: SQLITE_OPEN_READONLY
- ** 2: SQLITE_OPEN_READWRITE
- ** 6: SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE
- */
- assert( SQLITE_OPEN_READONLY == 0x01 );
- assert( SQLITE_OPEN_READWRITE == 0x02 );
- assert( SQLITE_OPEN_CREATE == 0x04 );
- testcase( (1<<(flags&7))==0x02 ); /* READONLY */
- testcase( (1<<(flags&7))==0x04 ); /* READWRITE */
- testcase( (1<<(flags&7))==0x40 ); /* READWRITE | CREATE */
- if( ((1<<(flags&7)) & 0x46)==0 ){
- return SQLITE_MISUSE_BKPT; /* IMP: R-65497-44594 */
- }
-
if( sqlite3GlobalConfig.bCoreMutex==0 ){
isThreadsafe = 0;
}else if( flags & SQLITE_OPEN_NOMUTEX ){
@@ -143383,6 +144882,9 @@ static int openDatabase(
#if defined(SQLITE_ENABLE_FTS3_TOKENIZER)
| SQLITE_Fts3Tokenizer
#endif
+#if defined(SQLITE_ENABLE_QPSG)
+ | SQLITE_EnableQPSG
+#endif
;
sqlite3HashInit(&db->aCollSeq);
#ifndef SQLITE_OMIT_VIRTUALTABLE
@@ -143410,9 +144912,30 @@ static int openDatabase(
db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, sqlite3StrBINARY, 0);
assert( db->pDfltColl!=0 );
- /* Parse the filename/URI argument. */
+ /* Parse the filename/URI argument
+ **
+ ** Only allow sensible combinations of bits in the flags argument.
+ ** Throw an error if any non-sense combination is used. If we
+ ** do not block illegal combinations here, it could trigger
+ ** assert() statements in deeper layers. Sensible combinations
+ ** are:
+ **
+ ** 1: SQLITE_OPEN_READONLY
+ ** 2: SQLITE_OPEN_READWRITE
+ ** 6: SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE
+ */
db->openFlags = flags;
- rc = sqlite3ParseUri(zVfs, zFilename, &flags, &db->pVfs, &zOpen, &zErrMsg);
+ assert( SQLITE_OPEN_READONLY == 0x01 );
+ assert( SQLITE_OPEN_READWRITE == 0x02 );
+ assert( SQLITE_OPEN_CREATE == 0x04 );
+ testcase( (1<<(flags&7))==0x02 ); /* READONLY */
+ testcase( (1<<(flags&7))==0x04 ); /* READWRITE */
+ testcase( (1<<(flags&7))==0x40 ); /* READWRITE | CREATE */
+ if( ((1<<(flags&7)) & 0x46)==0 ){
+ rc = SQLITE_MISUSE_BKPT; /* IMP: R-65497-44594 */
+ }else{
+ rc = sqlite3ParseUri(zVfs, zFilename, &flags, &db->pVfs, &zOpen, &zErrMsg);
+ }
if( rc!=SQLITE_OK ){
if( rc==SQLITE_NOMEM ) sqlite3OomFault(db);
sqlite3ErrorWithMsg(db, rc, zErrMsg ? "%s" : 0, zErrMsg);
@@ -143509,6 +145032,12 @@ static int openDatabase(
}
#endif
+#ifdef SQLITE_ENABLE_DBPAGE_VTAB
+ if( !db->mallocFailed && rc==SQLITE_OK){
+ rc = sqlite3DbpageRegister(db);
+ }
+#endif
+
#ifdef SQLITE_ENABLE_DBSTAT_VTAB
if( !db->mallocFailed && rc==SQLITE_OK){
rc = sqlite3DbstatRegister(db);
@@ -143521,6 +145050,12 @@ static int openDatabase(
}
#endif
+#ifdef SQLITE_ENABLE_STMTVTAB
+ if( !db->mallocFailed && rc==SQLITE_OK){
+ rc = sqlite3StmtVtabInit(db);
+ }
+#endif
+
/* -DSQLITE_DEFAULT_LOCKING_MODE=1 makes EXCLUSIVE the default locking
** mode. -DSQLITE_DEFAULT_LOCKING_MODE=0 make NORMAL the default locking
** mode. Doing nothing at all also makes NORMAL the default.
@@ -143805,6 +145340,12 @@ SQLITE_PRIVATE int sqlite3CantopenError(int lineno){
return reportError(SQLITE_CANTOPEN, lineno, "cannot open file");
}
#ifdef SQLITE_DEBUG
+SQLITE_PRIVATE int sqlite3CorruptPgnoError(int lineno, Pgno pgno){
+ char zMsg[100];
+ sqlite3_snprintf(sizeof(zMsg), zMsg, "database corruption page %d", pgno);
+ testcase( sqlite3GlobalConfig.xLog!=0 );
+ return reportError(SQLITE_CORRUPT, lineno, zMsg);
+}
SQLITE_PRIVATE int sqlite3NomemError(int lineno){
testcase( sqlite3GlobalConfig.xLog!=0 );
return reportError(SQLITE_NOMEM, lineno, "OOM");
@@ -144156,7 +145697,7 @@ SQLITE_API int sqlite3_test_control(int op, ...){
** This action provides a run-time test to see how the ALWAYS and
** NEVER macros were defined at compile-time.
**
- ** The return value is ALWAYS(X).
+ ** The return value is ALWAYS(X) if X is true, or 0 if X is false.
**
** The recommended test is X==2. If the return value is 2, that means
** ALWAYS() and NEVER() are both no-op pass-through macros, which is the
@@ -144179,7 +145720,7 @@ SQLITE_API int sqlite3_test_control(int op, ...){
*/
case SQLITE_TESTCTRL_ALWAYS: {
int x = va_arg(ap,int);
- rc = ALWAYS(x);
+ rc = x ? ALWAYS(x) : 0;
break;
}
@@ -144246,22 +145787,6 @@ SQLITE_API int sqlite3_test_control(int op, ...){
}
#endif
- /* sqlite3_test_control(SQLITE_TESTCTRL_SCRATCHMALLOC, sz, &pNew, pFree);
- **
- ** Pass pFree into sqlite3ScratchFree().
- ** If sz>0 then allocate a scratch buffer into pNew.
- */
- case SQLITE_TESTCTRL_SCRATCHMALLOC: {
- void *pFree, **ppNew;
- int sz;
- sz = va_arg(ap, int);
- ppNew = va_arg(ap, void**);
- pFree = va_arg(ap, void*);
- if( sz ) *ppNew = sqlite3ScratchMalloc(sz);
- sqlite3ScratchFree(pFree);
- break;
- }
-
/* sqlite3_test_control(SQLITE_TESTCTRL_LOCALTIME_FAULT, int onoff);
**
** If parameter onoff is non-zero, configure the wrappers so that all
@@ -144403,7 +145928,7 @@ SQLITE_API sqlite3_int64 sqlite3_uri_int64(
){
const char *z = sqlite3_uri_parameter(zFilename, zParam);
sqlite3_int64 v;
- if( z && sqlite3DecOrHexToI64(z, &v)==SQLITE_OK ){
+ if( z && sqlite3DecOrHexToI64(z, &v)==0 ){
bDflt = v;
}
return bDflt;
@@ -144564,6 +146089,58 @@ SQLITE_API void sqlite3_snapshot_free(sqlite3_snapshot *pSnapshot){
}
#endif /* SQLITE_ENABLE_SNAPSHOT */
+#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS
+/*
+** Given the name of a compile-time option, return true if that option
+** was used and false if not.
+**
+** The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix
+** is not required for a match.
+*/
+SQLITE_API int sqlite3_compileoption_used(const char *zOptName){
+ int i, n;
+ int nOpt;
+ const char **azCompileOpt;
+
+#if SQLITE_ENABLE_API_ARMOR
+ if( zOptName==0 ){
+ (void)SQLITE_MISUSE_BKPT;
+ return 0;
+ }
+#endif
+
+ azCompileOpt = sqlite3CompileOptions(&nOpt);
+
+ if( sqlite3StrNICmp(zOptName, "SQLITE_", 7)==0 ) zOptName += 7;
+ n = sqlite3Strlen30(zOptName);
+
+ /* Since nOpt is normally in single digits, a linear search is
+ ** adequate. No need for a binary search. */
+ for(i=0; i<nOpt; i++){
+ if( sqlite3StrNICmp(zOptName, azCompileOpt[i], n)==0
+ && sqlite3IsIdChar((unsigned char)azCompileOpt[i][n])==0
+ ){
+ return 1;
+ }
+ }
+ return 0;
+}
+
+/*
+** Return the N-th compile-time option string. If N is out of range,
+** return a NULL pointer.
+*/
+SQLITE_API const char *sqlite3_compileoption_get(int N){
+ int nOpt;
+ const char **azCompileOpt;
+ azCompileOpt = sqlite3CompileOptions(&nOpt);
+ if( N>=0 && N<nOpt ){
+ return azCompileOpt[N];
+ }
+ return 0;
+}
+#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */
+
/************** End of main.c ************************************************/
/************** Begin file notify.c ******************************************/
/*
@@ -147515,17 +149092,26 @@ static void fts3CursorFinalizeStmt(Fts3Cursor *pCsr){
}
/*
+** Free all resources currently held by the cursor passed as the only
+** argument.
+*/
+static void fts3ClearCursor(Fts3Cursor *pCsr){
+ fts3CursorFinalizeStmt(pCsr);
+ sqlite3Fts3FreeDeferredTokens(pCsr);
+ sqlite3_free(pCsr->aDoclist);
+ sqlite3Fts3MIBufferFree(pCsr->pMIBuffer);
+ sqlite3Fts3ExprFree(pCsr->pExpr);
+ memset(&(&pCsr->base)[1], 0, sizeof(Fts3Cursor)-sizeof(sqlite3_vtab_cursor));
+}
+
+/*
** Close the cursor. For additional information see the documentation
** on the xClose method of the virtual table interface.
*/
static int fts3CloseMethod(sqlite3_vtab_cursor *pCursor){
Fts3Cursor *pCsr = (Fts3Cursor *)pCursor;
assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 );
- fts3CursorFinalizeStmt(pCsr);
- sqlite3Fts3ExprFree(pCsr->pExpr);
- sqlite3Fts3FreeDeferredTokens(pCsr);
- sqlite3_free(pCsr->aDoclist);
- sqlite3Fts3MIBufferFree(pCsr->pMIBuffer);
+ fts3ClearCursor(pCsr);
assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 );
sqlite3_free(pCsr);
return SQLITE_OK;
@@ -147551,7 +149137,7 @@ static int fts3CursorSeekStmt(Fts3Cursor *pCsr){
}else{
zSql = sqlite3_mprintf("SELECT %s WHERE rowid = ?", p->zReadExprlist);
if( !zSql ) return SQLITE_NOMEM;
- rc = sqlite3_prepare_v2(p->db, zSql, -1, &pCsr->pStmt, 0);
+ rc = sqlite3_prepare_v3(p->db, zSql,-1,SQLITE_PREPARE_PERSISTENT,&pCsr->pStmt,0);
sqlite3_free(zSql);
}
if( rc==SQLITE_OK ) pCsr->bSeekStmt = 1;
@@ -149026,11 +150612,7 @@ static int fts3FilterMethod(
assert( iIdx==nVal );
/* In case the cursor has been used before, clear it now. */
- fts3CursorFinalizeStmt(pCsr);
- sqlite3_free(pCsr->aDoclist);
- sqlite3Fts3MIBufferFree(pCsr->pMIBuffer);
- sqlite3Fts3ExprFree(pCsr->pExpr);
- memset(&pCursor[1], 0, sizeof(Fts3Cursor)-sizeof(sqlite3_vtab_cursor));
+ fts3ClearCursor(pCsr);
/* Set the lower and upper bounds on docids to return */
pCsr->iMinDocid = fts3DocidRange(pDocidGe, SMALLEST_INT64);
@@ -149088,7 +150670,7 @@ static int fts3FilterMethod(
);
}
if( zSql ){
- rc = sqlite3_prepare_v2(p->db, zSql, -1, &pCsr->pStmt, 0);
+ rc = sqlite3_prepare_v3(p->db,zSql,-1,SQLITE_PREPARE_PERSISTENT,&pCsr->pStmt,0);
sqlite3_free(zSql);
}else{
rc = SQLITE_NOMEM;
@@ -149109,7 +150691,12 @@ static int fts3FilterMethod(
** routine to find out if it has reached the end of a result set.
*/
static int fts3EofMethod(sqlite3_vtab_cursor *pCursor){
- return ((Fts3Cursor *)pCursor)->isEof;
+ Fts3Cursor *pCsr = (Fts3Cursor*)pCursor;
+ if( pCsr->isEof ){
+ fts3ClearCursor(pCsr);
+ pCsr->isEof = 1;
+ }
+ return pCsr->isEof;
}
/*
@@ -149150,8 +150737,7 @@ static int fts3ColumnMethod(
switch( iCol-p->nColumn ){
case 0:
/* The special 'table-name' column */
- sqlite3_result_blob(pCtx, &pCsr, sizeof(Fts3Cursor*), SQLITE_TRANSIENT);
- sqlite3_result_subtype(pCtx, SQLITE_BLOB);
+ sqlite3_result_pointer(pCtx, pCsr, "fts3cursor", 0);
break;
case 1:
@@ -149369,9 +150955,10 @@ static int fts3FunctionArg(
sqlite3_value *pVal, /* argv[0] passed to function */
Fts3Cursor **ppCsr /* OUT: Store cursor handle here */
){
- int rc = SQLITE_OK;
- if( sqlite3_value_subtype(pVal)==SQLITE_BLOB ){
- *ppCsr = *(Fts3Cursor**)sqlite3_value_blob(pVal);
+ int rc;
+ *ppCsr = (Fts3Cursor*)sqlite3_value_pointer(pVal, "fts3cursor");
+ if( (*ppCsr)!=0 ){
+ rc = SQLITE_OK;
}else{
char *zErr = sqlite3_mprintf("illegal first argument to %s", zFunc);
sqlite3_result_error(pContext, zErr, -1);
@@ -156295,7 +157882,8 @@ static int fts3SqlStmt(
if( !zSql ){
rc = SQLITE_NOMEM;
}else{
- rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, NULL);
+ rc = sqlite3_prepare_v3(p->db, zSql, -1, SQLITE_PREPARE_PERSISTENT,
+ &pStmt, NULL);
sqlite3_free(zSql);
assert( rc==SQLITE_OK || pStmt==0 );
p->aStmt[eStmt] = pStmt;
@@ -164383,14 +165971,6 @@ struct RtreeGeomCallback {
void *pContext;
};
-
-/*
-** Value for the first field of every RtreeMatchArg object. The MATCH
-** operator tests that the first field of a blob operand matches this
-** value to avoid operating on invalid blobs (which could cause a segfault).
-*/
-#define RTREE_GEOMETRY_MAGIC 0x891245AB
-
/*
** An instance of this structure (in the form of a BLOB) is returned by
** the SQL functions that sqlite3_rtree_geometry_callback() and
@@ -164398,7 +165978,7 @@ struct RtreeGeomCallback {
** operand to the MATCH operator of an R-Tree.
*/
struct RtreeMatchArg {
- u32 magic; /* Always RTREE_GEOMETRY_MAGIC */
+ u32 iSize; /* Size of this object */
RtreeGeomCallback cb; /* Info about the callback functions */
int nParam; /* Number of parameters to the SQL function */
sqlite3_value **apSqlParam; /* Original SQL parameter values */
@@ -165693,33 +167273,17 @@ static int findLeafNode(
** operator.
*/
static int deserializeGeometry(sqlite3_value *pValue, RtreeConstraint *pCons){
- RtreeMatchArg *pBlob; /* BLOB returned by geometry function */
+ RtreeMatchArg *pBlob, *pSrc; /* BLOB returned by geometry function */
sqlite3_rtree_query_info *pInfo; /* Callback information */
- int nBlob; /* Size of the geometry function blob */
- int nExpected; /* Expected size of the BLOB */
- /* Check that value is actually a blob. */
- if( sqlite3_value_type(pValue)!=SQLITE_BLOB ) return SQLITE_ERROR;
-
- /* Check that the blob is roughly the right size. */
- nBlob = sqlite3_value_bytes(pValue);
- if( nBlob<(int)sizeof(RtreeMatchArg) ){
- return SQLITE_ERROR;
- }
-
- pInfo = (sqlite3_rtree_query_info*)sqlite3_malloc( sizeof(*pInfo)+nBlob );
+ pSrc = sqlite3_value_pointer(pValue, "RtreeMatchArg");
+ if( pSrc==0 ) return SQLITE_ERROR;
+ pInfo = (sqlite3_rtree_query_info*)
+ sqlite3_malloc64( sizeof(*pInfo)+pSrc->iSize );
if( !pInfo ) return SQLITE_NOMEM;
memset(pInfo, 0, sizeof(*pInfo));
pBlob = (RtreeMatchArg*)&pInfo[1];
-
- memcpy(pBlob, sqlite3_value_blob(pValue), nBlob);
- nExpected = (int)(sizeof(RtreeMatchArg) +
- pBlob->nParam*sizeof(sqlite3_value*) +
- (pBlob->nParam-1)*sizeof(RtreeDValue));
- if( pBlob->magic!=RTREE_GEOMETRY_MAGIC || nBlob!=nExpected ){
- sqlite3_free(pInfo);
- return SQLITE_ERROR;
- }
+ memcpy(pBlob, pSrc, pSrc->iSize);
pInfo->pContext = pBlob->cb.pContext;
pInfo->nParam = pBlob->nParam;
pInfo->aParam = pBlob->aParam;
@@ -166921,7 +168485,7 @@ static int rtreeDeleteRowid(Rtree *pRtree, sqlite3_int64 iDelete){
int rc; /* Return code */
RtreeNode *pLeaf = 0; /* Leaf node containing record iDelete */
int iCell; /* Index of iDelete cell in pLeaf */
- RtreeNode *pRoot; /* Root node of rtree structure */
+ RtreeNode *pRoot = 0; /* Root node of rtree structure */
/* Obtain a reference to the root node to initialize Rtree.iDepth */
@@ -167405,7 +168969,8 @@ static int rtreeSqlInit(
for(i=0; i<N_STATEMENT && rc==SQLITE_OK; i++){
char *zSql = sqlite3_mprintf(azSql[i], zDb, zPrefix);
if( zSql ){
- rc = sqlite3_prepare_v2(db, zSql, -1, appStmt[i], 0);
+ rc = sqlite3_prepare_v3(db, zSql, -1, SQLITE_PREPARE_PERSISTENT,
+ appStmt[i], 0);
}else{
rc = SQLITE_NOMEM;
}
@@ -167480,6 +169045,10 @@ static int getNodeSize(
rc = getIntFromStmt(db, zSql, &pRtree->iNodeSize);
if( rc!=SQLITE_OK ){
*pzErr = sqlite3_mprintf("%s", sqlite3_errmsg(db));
+ }else if( pRtree->iNodeSize<(512-64) ){
+ rc = SQLITE_CORRUPT_VTAB;
+ *pzErr = sqlite3_mprintf("undersize RTree blobs in \"%q_node\"",
+ pRtree->zName);
}
}
@@ -167752,7 +169321,7 @@ static void geomCallback(sqlite3_context *ctx, int nArg, sqlite3_value **aArg){
sqlite3_result_error_nomem(ctx);
}else{
int i;
- pBlob->magic = RTREE_GEOMETRY_MAGIC;
+ pBlob->iSize = nBlob;
pBlob->cb = pGeomCtx[0];
pBlob->apSqlParam = (sqlite3_value**)&pBlob->aParam[nArg];
pBlob->nParam = nArg;
@@ -167769,7 +169338,7 @@ static void geomCallback(sqlite3_context *ctx, int nArg, sqlite3_value **aArg){
sqlite3_result_error_nomem(ctx);
rtreeMatchArgFree(pBlob);
}else{
- sqlite3_result_blob(ctx, pBlob, nBlob, rtreeMatchArgFree);
+ sqlite3_result_pointer(ctx, pBlob, "RtreeMatchArg", rtreeMatchArgFree);
}
}
}
@@ -167944,15 +169513,15 @@ static int icuLikeCompare(
const uint8_t *zString, /* The UTF-8 string to compare against */
const UChar32 uEsc /* The escape character */
){
- static const int MATCH_ONE = (UChar32)'_';
- static const int MATCH_ALL = (UChar32)'%';
+ static const uint32_t MATCH_ONE = (uint32_t)'_';
+ static const uint32_t MATCH_ALL = (uint32_t)'%';
int prevEscape = 0; /* True if the previous character was uEsc */
while( 1 ){
/* Read (and consume) the next character from the input pattern. */
- UChar32 uPattern;
+ uint32_t uPattern;
SQLITE_ICU_READ_UTF8(zPattern, uPattern);
if( uPattern==0 ) break;
@@ -167994,16 +169563,16 @@ static int icuLikeCompare(
if( *zString==0 ) return 0;
SQLITE_ICU_SKIP_UTF8(zString);
- }else if( !prevEscape && uPattern==uEsc){
+ }else if( !prevEscape && uPattern==(uint32_t)uEsc){
/* Case 3. */
prevEscape = 1;
}else{
/* Case 4. */
- UChar32 uString;
+ uint32_t uString;
SQLITE_ICU_READ_UTF8(zString, uString);
- uString = u_foldCase(uString, U_FOLD_CASE_DEFAULT);
- uPattern = u_foldCase(uPattern, U_FOLD_CASE_DEFAULT);
+ uString = (uint32_t)u_foldCase((UChar32)uString, U_FOLD_CASE_DEFAULT);
+ uPattern = (uint32_t)u_foldCase((UChar32)uPattern, U_FOLD_CASE_DEFAULT);
if( uString!=uPattern ){
return 0;
}
@@ -169100,6 +170669,28 @@ SQLITE_API sqlite3rbu *sqlite3rbu_vacuum(
);
/*
+** Configure a limit for the amount of temp space that may be used by
+** the RBU handle passed as the first argument. The new limit is specified
+** in bytes by the second parameter. If it is positive, the limit is updated.
+** If the second parameter to this function is passed zero, then the limit
+** is removed entirely. If the second parameter is negative, the limit is
+** not modified (this is useful for querying the current limit).
+**
+** In all cases the returned value is the current limit in bytes (zero
+** indicates unlimited).
+**
+** If the temp space limit is exceeded during operation, an SQLITE_FULL
+** error is returned.
+*/
+SQLITE_API sqlite3_int64 sqlite3rbu_temp_size_limit(sqlite3rbu*, sqlite3_int64);
+
+/*
+** Return the current amount of temp file space, in bytes, currently used by
+** the RBU handle passed as the only argument.
+*/
+SQLITE_API sqlite3_int64 sqlite3rbu_temp_size(sqlite3rbu*);
+
+/*
** Internally, each RBU connection uses a separate SQLite database
** connection to access the target and rbu update databases. This
** API allows the application direct access to these database handles.
@@ -169167,10 +170758,10 @@ SQLITE_API int sqlite3rbu_savestate(sqlite3rbu *pRbu);
**
** If an error has already occurred as part of an sqlite3rbu_step()
** or sqlite3rbu_open() call, or if one occurs within this function, an
-** SQLite error code is returned. Additionally, *pzErrmsg may be set to
-** point to a buffer containing a utf-8 formatted English language error
-** message. It is the responsibility of the caller to eventually free any
-** such buffer using sqlite3_free().
+** SQLite error code is returned. Additionally, if pzErrmsg is not NULL,
+** *pzErrmsg may be set to point to a buffer containing a utf-8 formatted
+** English language error message. It is the responsibility of the caller to
+** eventually free any such buffer using sqlite3_free().
**
** Otherwise, if no error occurs, this function returns SQLITE_OK if the
** update has been partially applied, or SQLITE_DONE if it has been
@@ -169225,7 +170816,7 @@ SQLITE_API sqlite3_int64 sqlite3rbu_progress(sqlite3rbu *pRbu);
** table exists but is not correctly populated, the value of the *pnOne
** output variable during stage 1 is undefined.
*/
-SQLITE_API void sqlite3rbu_bp_progress(sqlite3rbu *pRbu, int *pnOne, int *pnTwo);
+SQLITE_API void sqlite3rbu_bp_progress(sqlite3rbu *pRbu, int *pnOne, int*pnTwo);
/*
** Obtain an indication as to the current stage of an RBU update or vacuum.
@@ -169335,6 +170926,13 @@ SQLITE_API void sqlite3rbu_destroy_vfs(const char *zName);
/* Maximum number of prepared UPDATE statements held by this module */
#define SQLITE_RBU_UPDATE_CACHESIZE 16
+/* Delta checksums disabled by default. Compile with -DRBU_ENABLE_DELTA_CKSUM
+** to enable checksum verification.
+*/
+#ifndef RBU_ENABLE_DELTA_CKSUM
+# define RBU_ENABLE_DELTA_CKSUM 0
+#endif
+
/*
** Swap two objects of type TYPE.
*/
@@ -169610,6 +171208,8 @@ struct sqlite3rbu {
int pgsz;
u8 *aBuf;
i64 iWalCksum;
+ i64 szTemp; /* Current size of all temp files in use */
+ i64 szTempLimit; /* Total size limit for temp files */
/* Used in RBU vacuum mode only */
int nRbu; /* Number of RBU VFS in the stack */
@@ -169618,23 +171218,33 @@ struct sqlite3rbu {
/*
** An rbu VFS is implemented using an instance of this structure.
+**
+** Variable pRbu is only non-NULL for automatically created RBU VFS objects.
+** It is NULL for RBU VFS objects created explicitly using
+** sqlite3rbu_create_vfs(). It is used to track the total amount of temp
+** space used by the RBU handle.
*/
struct rbu_vfs {
sqlite3_vfs base; /* rbu VFS shim methods */
sqlite3_vfs *pRealVfs; /* Underlying VFS */
sqlite3_mutex *mutex; /* Mutex to protect pMain */
+ sqlite3rbu *pRbu; /* Owner RBU object */
rbu_file *pMain; /* Linked list of main db files */
};
/*
** Each file opened by an rbu VFS is represented by an instance of
** the following structure.
+**
+** If this is a temporary file (pRbu!=0 && flags&DELETE_ON_CLOSE), variable
+** "sz" is set to the current size of the database file.
*/
struct rbu_file {
sqlite3_file base; /* sqlite3_file methods */
sqlite3_file *pReal; /* Underlying file handle */
rbu_vfs *pRbuVfs; /* Pointer to the rbu_vfs object */
sqlite3rbu *pRbu; /* Pointer to rbu object (rbu target only) */
+ i64 sz; /* Size of file in bytes (temp only) */
int openFlags; /* Flags this file was opened with */
u32 iCookie; /* Cookie value for main db files */
@@ -169697,6 +171307,7 @@ static unsigned int rbuDeltaGetInt(const char **pz, int *pLen){
return v;
}
+#if RBU_ENABLE_DELTA_CKSUM
/*
** Compute a 32-bit checksum on the N-byte buffer. Return the result.
*/
@@ -169731,6 +171342,7 @@ static unsigned int rbuDeltaChecksum(const char *zIn, size_t N){
}
return sum3;
}
+#endif
/*
** Apply a delta.
@@ -169761,7 +171373,7 @@ static int rbuDeltaApply(
){
unsigned int limit;
unsigned int total = 0;
-#ifndef FOSSIL_OMIT_DELTA_CKSUM_TEST
+#if RBU_ENABLE_DELTA_CKSUM
char *zOrigOut = zOut;
#endif
@@ -169816,7 +171428,7 @@ static int rbuDeltaApply(
case ';': {
zDelta++; lenDelta--;
zOut[0] = 0;
-#ifndef FOSSIL_OMIT_DELTA_CKSUM_TEST
+#if RBU_ENABLE_DELTA_CKSUM
if( cnt!=rbuDeltaChecksum(zOrigOut, total) ){
/* ERROR: bad checksum */
return -1;
@@ -172648,6 +174260,7 @@ static void rbuCreateVfs(sqlite3rbu *p){
sqlite3_vfs *pVfs = sqlite3_vfs_find(zRnd);
assert( pVfs );
p->zVfsName = pVfs->zName;
+ ((rbu_vfs*)pVfs)->pRbu = p;
}
}
@@ -173020,13 +174633,18 @@ SQLITE_API int sqlite3rbu_close(sqlite3rbu *p, char **pzErrmsg){
/* Close the open database handle and VFS object. */
sqlite3_close(p->dbRbu);
sqlite3_close(p->dbMain);
+ assert( p->szTemp==0 );
rbuDeleteVfs(p);
sqlite3_free(p->aBuf);
sqlite3_free(p->aFrame);
rbuEditErrmsg(p);
rc = p->rc;
- *pzErrmsg = p->zErrmsg;
+ if( pzErrmsg ){
+ *pzErrmsg = p->zErrmsg;
+ }else{
+ sqlite3_free(p->zErrmsg);
+ }
sqlite3_free(p->zState);
sqlite3_free(p);
}else{
@@ -173203,6 +174821,7 @@ SQLITE_API int sqlite3rbu_savestate(sqlite3rbu *p){
*/
static void rbuUnlockShm(rbu_file *p){
+ assert( p->openFlags & SQLITE_OPEN_MAIN_DB );
if( p->pRbu ){
int (*xShmLock)(sqlite3_file*,int,int,int) = p->pReal->pMethods->xShmLock;
int i;
@@ -173216,6 +174835,18 @@ static void rbuUnlockShm(rbu_file *p){
}
/*
+*/
+static int rbuUpdateTempSize(rbu_file *pFd, sqlite3_int64 nNew){
+ sqlite3rbu *pRbu = pFd->pRbu;
+ i64 nDiff = nNew - pFd->sz;
+ pRbu->szTemp += nDiff;
+ pFd->sz = nNew;
+ assert( pRbu->szTemp>=0 );
+ if( pRbu->szTempLimit && pRbu->szTemp>pRbu->szTempLimit ) return SQLITE_FULL;
+ return SQLITE_OK;
+}
+
+/*
** Close an rbu file.
*/
static int rbuVfsClose(sqlite3_file *pFile){
@@ -173240,6 +174871,9 @@ static int rbuVfsClose(sqlite3_file *pFile){
rbuUnlockShm(p);
p->pReal->pMethods->xShmUnmap(p->pReal, 0);
}
+ else if( (p->openFlags & SQLITE_OPEN_DELETEONCLOSE) && p->pRbu ){
+ rbuUpdateTempSize(p, 0);
+ }
/* Close the underlying file handle */
rc = p->pReal->pMethods->xClose(p->pReal);
@@ -173357,11 +174991,19 @@ static int rbuVfsWrite(
assert( p->openFlags & SQLITE_OPEN_MAIN_DB );
rc = rbuCaptureDbWrite(p->pRbu, iOfst);
}else{
- if( pRbu && pRbu->eStage==RBU_STAGE_OAL
- && (p->openFlags & SQLITE_OPEN_WAL)
- && iOfst>=pRbu->iOalSz
- ){
- pRbu->iOalSz = iAmt + iOfst;
+ if( pRbu ){
+ if( pRbu->eStage==RBU_STAGE_OAL
+ && (p->openFlags & SQLITE_OPEN_WAL)
+ && iOfst>=pRbu->iOalSz
+ ){
+ pRbu->iOalSz = iAmt + iOfst;
+ }else if( p->openFlags & SQLITE_OPEN_DELETEONCLOSE ){
+ i64 szNew = iAmt+iOfst;
+ if( szNew>p->sz ){
+ rc = rbuUpdateTempSize(p, szNew);
+ if( rc!=SQLITE_OK ) return rc;
+ }
+ }
}
rc = p->pReal->pMethods->xWrite(p->pReal, zBuf, iAmt, iOfst);
if( rc==SQLITE_OK && iOfst==0 && (p->openFlags & SQLITE_OPEN_MAIN_DB) ){
@@ -173380,6 +175022,10 @@ static int rbuVfsWrite(
*/
static int rbuVfsTruncate(sqlite3_file *pFile, sqlite_int64 size){
rbu_file *p = (rbu_file*)pFile;
+ if( (p->openFlags & SQLITE_OPEN_DELETEONCLOSE) && p->pRbu ){
+ int rc = rbuUpdateTempSize(p, size);
+ if( rc!=SQLITE_OK ) return rc;
+ }
return p->pReal->pMethods->xTruncate(p->pReal, size);
}
@@ -173769,6 +175415,8 @@ static int rbuVfsOpen(
pDb->pWalFd = pFd;
}
}
+ }else{
+ pFd->pRbu = pRbuVfs->pRbu;
}
if( oflags & SQLITE_OPEN_MAIN_DB
@@ -173845,7 +175493,9 @@ static int rbuVfsAccess(
if( *pResOut ){
rc = SQLITE_CANTOPEN;
}else{
- *pResOut = 1;
+ sqlite3_int64 sz = 0;
+ rc = rbuVfsFileSize(&pDb->base, &sz);
+ *pResOut = (sz>0);
}
}
}
@@ -174034,6 +175684,20 @@ SQLITE_API int sqlite3rbu_create_vfs(const char *zName, const char *zParent){
return rc;
}
+/*
+** Configure the aggregate temp file size limit for this RBU handle.
+*/
+SQLITE_API sqlite3_int64 sqlite3rbu_temp_size_limit(sqlite3rbu *pRbu, sqlite3_int64 n){
+ if( n>=0 ){
+ pRbu->szTempLimit = n;
+ }
+ return pRbu->szTempLimit;
+}
+
+SQLITE_API sqlite3_int64 sqlite3rbu_temp_size(sqlite3rbu *pRbu){
+ return pRbu->szTemp;
+}
+
/**************************************************************************/
@@ -174737,6 +176401,9 @@ SQLITE_PRIVATE int sqlite3DbstatRegister(sqlite3 *db){
0, /* xRollback */
0, /* xFindMethod */
0, /* xRename */
+ 0, /* xSavepoint */
+ 0, /* xRelease */
+ 0, /* xRollbackTo */
};
return sqlite3_create_module(db, "dbstat", &dbstat_module, 0);
}
@@ -174745,6 +176412,338 @@ SQLITE_PRIVATE int sqlite3DbstatRegister(sqlite3 *db){ return SQLITE_OK; }
#endif /* SQLITE_ENABLE_DBSTAT_VTAB */
/************** End of dbstat.c **********************************************/
+/************** Begin file dbpage.c ******************************************/
+/*
+** 2017-10-11
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+******************************************************************************
+**
+** This file contains an implementation of the "sqlite_dbpage" virtual table.
+**
+** The sqlite_dbpage virtual table is used to read or write whole raw
+** pages of the database file. The pager interface is used so that
+** uncommitted changes and changes recorded in the WAL file are correctly
+** retrieved.
+**
+** Usage example:
+**
+** SELECT data FROM sqlite_dbpage('aux1') WHERE pgno=123;
+**
+** This is an eponymous virtual table so it does not need to be created before
+** use. The optional argument to the sqlite_dbpage() table name is the
+** schema for the database file that is to be read. The default schema is
+** "main".
+**
+** The data field of sqlite_dbpage table can be updated. The new
+** value must be a BLOB which is the correct page size, otherwise the
+** update fails. Rows may not be deleted or inserted.
+*/
+
+/* #include "sqliteInt.h" ** Requires access to internal data structures ** */
+#if (defined(SQLITE_ENABLE_DBPAGE_VTAB) || defined(SQLITE_TEST)) \
+ && !defined(SQLITE_OMIT_VIRTUALTABLE)
+
+typedef struct DbpageTable DbpageTable;
+typedef struct DbpageCursor DbpageCursor;
+
+struct DbpageCursor {
+ sqlite3_vtab_cursor base; /* Base class. Must be first */
+ int pgno; /* Current page number */
+ int mxPgno; /* Last page to visit on this scan */
+};
+
+struct DbpageTable {
+ sqlite3_vtab base; /* Base class. Must be first */
+ sqlite3 *db; /* The database */
+ Pager *pPager; /* Pager being read/written */
+ int iDb; /* Index of database to analyze */
+ int szPage; /* Size of each page in bytes */
+ int nPage; /* Number of pages in the file */
+};
+
+/*
+** Connect to or create a dbpagevfs virtual table.
+*/
+static int dbpageConnect(
+ sqlite3 *db,
+ void *pAux,
+ int argc, const char *const*argv,
+ sqlite3_vtab **ppVtab,
+ char **pzErr
+){
+ DbpageTable *pTab = 0;
+ int rc = SQLITE_OK;
+ int iDb;
+
+ if( argc>=4 ){
+ Token nm;
+ sqlite3TokenInit(&nm, (char*)argv[3]);
+ iDb = sqlite3FindDb(db, &nm);
+ if( iDb<0 ){
+ *pzErr = sqlite3_mprintf("no such schema: %s", argv[3]);
+ return SQLITE_ERROR;
+ }
+ }else{
+ iDb = 0;
+ }
+ rc = sqlite3_declare_vtab(db,
+ "CREATE TABLE x(pgno INTEGER PRIMARY KEY, data BLOB, schema HIDDEN)");
+ if( rc==SQLITE_OK ){
+ pTab = (DbpageTable *)sqlite3_malloc64(sizeof(DbpageTable));
+ if( pTab==0 ) rc = SQLITE_NOMEM_BKPT;
+ }
+
+ assert( rc==SQLITE_OK || pTab==0 );
+ if( rc==SQLITE_OK ){
+ Btree *pBt = db->aDb[iDb].pBt;
+ memset(pTab, 0, sizeof(DbpageTable));
+ pTab->db = db;
+ pTab->iDb = iDb;
+ pTab->pPager = pBt ? sqlite3BtreePager(pBt) : 0;
+ }
+
+ *ppVtab = (sqlite3_vtab*)pTab;
+ return rc;
+}
+
+/*
+** Disconnect from or destroy a dbpagevfs virtual table.
+*/
+static int dbpageDisconnect(sqlite3_vtab *pVtab){
+ sqlite3_free(pVtab);
+ return SQLITE_OK;
+}
+
+/*
+** idxNum:
+**
+** 0 full table scan
+** 1 pgno=?1
+*/
+static int dbpageBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){
+ int i;
+ pIdxInfo->estimatedCost = 1.0e6; /* Initial cost estimate */
+ for(i=0; i<pIdxInfo->nConstraint; i++){
+ struct sqlite3_index_constraint *p = &pIdxInfo->aConstraint[i];
+ if( p->usable && p->iColumn<=0 && p->op==SQLITE_INDEX_CONSTRAINT_EQ ){
+ pIdxInfo->estimatedRows = 1;
+ pIdxInfo->idxFlags = SQLITE_INDEX_SCAN_UNIQUE;
+ pIdxInfo->estimatedCost = 1.0;
+ pIdxInfo->idxNum = 1;
+ pIdxInfo->aConstraintUsage[i].argvIndex = 1;
+ pIdxInfo->aConstraintUsage[i].omit = 1;
+ break;
+ }
+ }
+ if( pIdxInfo->nOrderBy>=1
+ && pIdxInfo->aOrderBy[0].iColumn<=0
+ && pIdxInfo->aOrderBy[0].desc==0
+ ){
+ pIdxInfo->orderByConsumed = 1;
+ }
+ return SQLITE_OK;
+}
+
+/*
+** Open a new dbpagevfs cursor.
+*/
+static int dbpageOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){
+ DbpageCursor *pCsr;
+
+ pCsr = (DbpageCursor *)sqlite3_malloc64(sizeof(DbpageCursor));
+ if( pCsr==0 ){
+ return SQLITE_NOMEM_BKPT;
+ }else{
+ memset(pCsr, 0, sizeof(DbpageCursor));
+ pCsr->base.pVtab = pVTab;
+ pCsr->pgno = -1;
+ }
+
+ *ppCursor = (sqlite3_vtab_cursor *)pCsr;
+ return SQLITE_OK;
+}
+
+/*
+** Close a dbpagevfs cursor.
+*/
+static int dbpageClose(sqlite3_vtab_cursor *pCursor){
+ DbpageCursor *pCsr = (DbpageCursor *)pCursor;
+ sqlite3_free(pCsr);
+ return SQLITE_OK;
+}
+
+/*
+** Move a dbpagevfs cursor to the next entry in the file.
+*/
+static int dbpageNext(sqlite3_vtab_cursor *pCursor){
+ int rc = SQLITE_OK;
+ DbpageCursor *pCsr = (DbpageCursor *)pCursor;
+ pCsr->pgno++;
+ return rc;
+}
+
+static int dbpageEof(sqlite3_vtab_cursor *pCursor){
+ DbpageCursor *pCsr = (DbpageCursor *)pCursor;
+ return pCsr->pgno > pCsr->mxPgno;
+}
+
+static int dbpageFilter(
+ sqlite3_vtab_cursor *pCursor,
+ int idxNum, const char *idxStr,
+ int argc, sqlite3_value **argv
+){
+ DbpageCursor *pCsr = (DbpageCursor *)pCursor;
+ DbpageTable *pTab = (DbpageTable *)pCursor->pVtab;
+ int rc = SQLITE_OK;
+ Btree *pBt = pTab->db->aDb[pTab->iDb].pBt;
+
+ pTab->szPage = sqlite3BtreeGetPageSize(pBt);
+ pTab->nPage = sqlite3BtreeLastPage(pBt);
+ if( idxNum==1 ){
+ pCsr->pgno = sqlite3_value_int(argv[0]);
+ if( pCsr->pgno<1 || pCsr->pgno>pTab->nPage ){
+ pCsr->pgno = 1;
+ pCsr->mxPgno = 0;
+ }else{
+ pCsr->mxPgno = pCsr->pgno;
+ }
+ }else{
+ pCsr->pgno = 1;
+ pCsr->mxPgno = pTab->nPage;
+ }
+ return rc;
+}
+
+static int dbpageColumn(
+ sqlite3_vtab_cursor *pCursor,
+ sqlite3_context *ctx,
+ int i
+){
+ DbpageCursor *pCsr = (DbpageCursor *)pCursor;
+ DbpageTable *pTab = (DbpageTable *)pCursor->pVtab;
+ int rc = SQLITE_OK;
+ switch( i ){
+ case 0: { /* pgno */
+ sqlite3_result_int(ctx, pCsr->pgno);
+ break;
+ }
+ case 1: { /* data */
+ DbPage *pDbPage = 0;
+ rc = sqlite3PagerGet(pTab->pPager, pCsr->pgno, (DbPage**)&pDbPage, 0);
+ if( rc==SQLITE_OK ){
+ sqlite3_result_blob(ctx, sqlite3PagerGetData(pDbPage), pTab->szPage,
+ SQLITE_TRANSIENT);
+ }
+ sqlite3PagerUnref(pDbPage);
+ break;
+ }
+ default: { /* schema */
+ sqlite3 *db = sqlite3_context_db_handle(ctx);
+ sqlite3_result_text(ctx, db->aDb[pTab->iDb].zDbSName, -1, SQLITE_STATIC);
+ break;
+ }
+ }
+ return SQLITE_OK;
+}
+
+static int dbpageRowid(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){
+ DbpageCursor *pCsr = (DbpageCursor *)pCursor;
+ *pRowid = pCsr->pgno;
+ return SQLITE_OK;
+}
+
+static int dbpageUpdate(
+ sqlite3_vtab *pVtab,
+ int argc,
+ sqlite3_value **argv,
+ sqlite_int64 *pRowid
+){
+ DbpageTable *pTab = (DbpageTable *)pVtab;
+ int pgno;
+ DbPage *pDbPage = 0;
+ int rc = SQLITE_OK;
+ char *zErr = 0;
+
+ if( argc==1 ){
+ zErr = "cannot delete";
+ goto update_fail;
+ }
+ pgno = sqlite3_value_int(argv[0]);
+ if( pgno<1 || pgno>pTab->nPage ){
+ zErr = "bad page number";
+ goto update_fail;
+ }
+ if( sqlite3_value_int(argv[1])!=pgno ){
+ zErr = "cannot insert";
+ goto update_fail;
+ }
+ if( sqlite3_value_type(argv[3])!=SQLITE_BLOB
+ || sqlite3_value_bytes(argv[3])!=pTab->szPage
+ ){
+ zErr = "bad page value";
+ goto update_fail;
+ }
+ rc = sqlite3PagerGet(pTab->pPager, pgno, (DbPage**)&pDbPage, 0);
+ if( rc==SQLITE_OK ){
+ rc = sqlite3PagerWrite(pDbPage);
+ if( rc==SQLITE_OK ){
+ memcpy(sqlite3PagerGetData(pDbPage),
+ sqlite3_value_blob(argv[3]),
+ pTab->szPage);
+ }
+ }
+ sqlite3PagerUnref(pDbPage);
+ return rc;
+
+update_fail:
+ sqlite3_free(pVtab->zErrMsg);
+ pVtab->zErrMsg = sqlite3_mprintf("%s", zErr);
+ return SQLITE_ERROR;
+}
+
+/*
+** Invoke this routine to register the "dbpage" virtual table module
+*/
+SQLITE_PRIVATE int sqlite3DbpageRegister(sqlite3 *db){
+ static sqlite3_module dbpage_module = {
+ 0, /* iVersion */
+ dbpageConnect, /* xCreate */
+ dbpageConnect, /* xConnect */
+ dbpageBestIndex, /* xBestIndex */
+ dbpageDisconnect, /* xDisconnect */
+ dbpageDisconnect, /* xDestroy */
+ dbpageOpen, /* xOpen - open a cursor */
+ dbpageClose, /* xClose - close a cursor */
+ dbpageFilter, /* xFilter - configure scan constraints */
+ dbpageNext, /* xNext - advance a cursor */
+ dbpageEof, /* xEof - check for end of scan */
+ dbpageColumn, /* xColumn - read data */
+ dbpageRowid, /* xRowid - read data */
+ dbpageUpdate, /* xUpdate */
+ 0, /* xBegin */
+ 0, /* xSync */
+ 0, /* xCommit */
+ 0, /* xRollback */
+ 0, /* xFindMethod */
+ 0, /* xRename */
+ 0, /* xSavepoint */
+ 0, /* xRelease */
+ 0, /* xRollbackTo */
+ };
+ return sqlite3_create_module(db, "sqlite_dbpage", &dbpage_module, 0);
+}
+#elif defined(SQLITE_ENABLE_DBPAGE_VTAB)
+SQLITE_PRIVATE int sqlite3DbpageRegister(sqlite3 *db){ return SQLITE_OK; }
+#endif /* SQLITE_ENABLE_DBSTAT_VTAB */
+
+/************** End of dbpage.c **********************************************/
/************** Begin file sqlite3session.c **********************************/
#if defined(SQLITE_ENABLE_SESSION) && defined(SQLITE_ENABLE_PREUPDATE_HOOK)
@@ -177584,11 +179583,12 @@ static int sessionChangesetNext(
p->in.iCurrent = p->in.iNext;
op = p->in.aData[p->in.iNext++];
- if( op=='T' || op=='P' ){
+ while( op=='T' || op=='P' ){
p->bPatchset = (op=='P');
if( sessionChangesetReadTblhdr(p) ) return p->rc;
if( (p->rc = sessionInputBuffer(&p->in, 2)) ) return p->rc;
p->in.iCurrent = p->in.iNext;
+ if( p->in.iNext>=p->in.nData ) return SQLITE_DONE;
op = p->in.aData[p->in.iNext++];
}
@@ -183334,7 +185334,8 @@ static int sqlite3Fts5UnicodeFold(int c, int bRemoveDiacritic);
** fts5YY_MAX_SHIFT Maximum value for shift actions
** fts5YY_MIN_SHIFTREDUCE Minimum value for shift-reduce actions
** fts5YY_MAX_SHIFTREDUCE Maximum value for shift-reduce actions
-** fts5YY_MIN_REDUCE Maximum value for reduce actions
+** fts5YY_MIN_REDUCE Minimum value for reduce actions
+** fts5YY_MAX_REDUCE Maximum value for reduce actions
** fts5YY_ERROR_ACTION The fts5yy_action[] code for syntax error
** fts5YY_ACCEPT_ACTION The fts5yy_action[] code for accept
** fts5YY_NO_ACTION The fts5yy_action[] code for no-op
@@ -183446,12 +185447,12 @@ typedef union {
*********** Begin parsing tables **********************************************/
#define fts5YY_ACTTAB_COUNT (98)
static const fts5YYACTIONTYPE fts5yy_action[] = {
- /* 0 */ 105, 19, 63, 6, 26, 66, 65, 24, 24, 17,
- /* 10 */ 63, 6, 26, 16, 65, 54, 24, 18, 63, 6,
- /* 20 */ 26, 10, 65, 12, 24, 75, 59, 63, 6, 26,
- /* 30 */ 13, 65, 75, 24, 20, 63, 6, 26, 74, 65,
- /* 40 */ 56, 24, 27, 63, 6, 26, 73, 65, 21, 24,
- /* 50 */ 23, 15, 30, 11, 1, 64, 22, 25, 9, 65,
+ /* 0 */ 105, 19, 90, 6, 26, 93, 92, 24, 24, 17,
+ /* 10 */ 90, 6, 26, 16, 92, 54, 24, 18, 90, 6,
+ /* 20 */ 26, 10, 92, 12, 24, 75, 86, 90, 6, 26,
+ /* 30 */ 13, 92, 75, 24, 20, 90, 6, 26, 101, 92,
+ /* 40 */ 56, 24, 27, 90, 6, 26, 100, 92, 21, 24,
+ /* 50 */ 23, 15, 30, 11, 1, 91, 22, 25, 9, 92,
/* 60 */ 7, 24, 3, 4, 5, 3, 4, 5, 3, 77,
/* 70 */ 4, 5, 3, 61, 23, 15, 60, 11, 80, 12,
/* 80 */ 2, 13, 68, 10, 29, 52, 55, 75, 31, 32,
@@ -183556,6 +185557,7 @@ struct fts5yyParser {
fts5yyStackEntry fts5yystk0; /* First stack entry */
#else
fts5yyStackEntry fts5yystack[fts5YYSTACKDEPTH]; /* The parser's stack */
+ fts5yyStackEntry *fts5yystackEnd; /* Last entry in the stack */
#endif
};
typedef struct fts5yyParser fts5yyParser;
@@ -183705,6 +185707,9 @@ static void sqlite3Fts5ParserInit(void *fts5yypParser){
pParser->fts5yytos = pParser->fts5yystack;
pParser->fts5yystack[0].stateno = 0;
pParser->fts5yystack[0].major = 0;
+#if fts5YYSTACKDEPTH>0
+ pParser->fts5yystackEnd = &pParser->fts5yystack[fts5YYSTACKDEPTH-1];
+#endif
}
#ifndef sqlite3Fts5Parser_ENGINEALWAYSONSTACK
@@ -184003,7 +186008,7 @@ static void fts5yy_shift(
}
#endif
#if fts5YYSTACKDEPTH>0
- if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5YYSTACKDEPTH] ){
+ if( fts5yypParser->fts5yytos>fts5yypParser->fts5yystackEnd ){
fts5yypParser->fts5yytos--;
fts5yyStackOverflow(fts5yypParser);
return;
@@ -184031,35 +186036,35 @@ static void fts5yy_shift(
** is used during the reduce.
*/
static const struct {
- fts5YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
- unsigned char nrhs; /* Number of right-hand side symbols in the rule */
+ fts5YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */
+ signed char nrhs; /* Negative of the number of RHS symbols in the rule */
} fts5yyRuleInfo[] = {
- { 16, 1 },
- { 20, 4 },
- { 20, 3 },
- { 20, 1 },
- { 20, 2 },
- { 21, 2 },
- { 21, 1 },
- { 17, 3 },
- { 17, 3 },
- { 17, 3 },
- { 17, 5 },
- { 17, 3 },
- { 17, 1 },
- { 19, 1 },
- { 19, 2 },
- { 18, 1 },
- { 18, 3 },
- { 22, 1 },
- { 22, 5 },
- { 23, 1 },
- { 23, 2 },
+ { 16, -1 },
+ { 20, -4 },
+ { 20, -3 },
+ { 20, -1 },
+ { 20, -2 },
+ { 21, -2 },
+ { 21, -1 },
+ { 17, -3 },
+ { 17, -3 },
+ { 17, -3 },
+ { 17, -5 },
+ { 17, -3 },
+ { 17, -1 },
+ { 19, -1 },
+ { 19, -2 },
+ { 18, -1 },
+ { 18, -3 },
+ { 22, -1 },
+ { 22, -5 },
+ { 23, -1 },
+ { 23, -2 },
{ 25, 0 },
- { 25, 2 },
- { 24, 4 },
- { 24, 2 },
- { 26, 1 },
+ { 25, -2 },
+ { 24, -4 },
+ { 24, -2 },
+ { 26, -1 },
{ 26, 0 },
};
@@ -184083,7 +186088,7 @@ static void fts5yy_reduce(
if( fts5yyTraceFILE && fts5yyruleno<(int)(sizeof(fts5yyRuleName)/sizeof(fts5yyRuleName[0])) ){
fts5yysize = fts5yyRuleInfo[fts5yyruleno].nrhs;
fprintf(fts5yyTraceFILE, "%sReduce [%s], go to state %d.\n", fts5yyTracePrompt,
- fts5yyRuleName[fts5yyruleno], fts5yymsp[-fts5yysize].stateno);
+ fts5yyRuleName[fts5yyruleno], fts5yymsp[fts5yysize].stateno);
}
#endif /* NDEBUG */
@@ -184098,7 +186103,7 @@ static void fts5yy_reduce(
}
#endif
#if fts5YYSTACKDEPTH>0
- if( fts5yypParser->fts5yytos>=&fts5yypParser->fts5yystack[fts5YYSTACKDEPTH-1] ){
+ if( fts5yypParser->fts5yytos>=fts5yypParser->fts5yystackEnd ){
fts5yyStackOverflow(fts5yypParser);
return;
}
@@ -184265,20 +186270,24 @@ static void fts5yy_reduce(
assert( fts5yyruleno<sizeof(fts5yyRuleInfo)/sizeof(fts5yyRuleInfo[0]) );
fts5yygoto = fts5yyRuleInfo[fts5yyruleno].lhs;
fts5yysize = fts5yyRuleInfo[fts5yyruleno].nrhs;
- fts5yyact = fts5yy_find_reduce_action(fts5yymsp[-fts5yysize].stateno,(fts5YYCODETYPE)fts5yygoto);
- if( fts5yyact <= fts5YY_MAX_SHIFTREDUCE ){
- if( fts5yyact>fts5YY_MAX_SHIFT ){
- fts5yyact += fts5YY_MIN_REDUCE - fts5YY_MIN_SHIFTREDUCE;
- }
- fts5yymsp -= fts5yysize-1;
+ fts5yyact = fts5yy_find_reduce_action(fts5yymsp[fts5yysize].stateno,(fts5YYCODETYPE)fts5yygoto);
+
+ /* There are no SHIFTREDUCE actions on nonterminals because the table
+ ** generator has simplified them to pure REDUCE actions. */
+ assert( !(fts5yyact>fts5YY_MAX_SHIFT && fts5yyact<=fts5YY_MAX_SHIFTREDUCE) );
+
+ /* It is not possible for a REDUCE to be followed by an error */
+ assert( fts5yyact!=fts5YY_ERROR_ACTION );
+
+ if( fts5yyact==fts5YY_ACCEPT_ACTION ){
+ fts5yypParser->fts5yytos += fts5yysize;
+ fts5yy_accept(fts5yypParser);
+ }else{
+ fts5yymsp += fts5yysize+1;
fts5yypParser->fts5yytos = fts5yymsp;
fts5yymsp->stateno = (fts5YYACTIONTYPE)fts5yyact;
fts5yymsp->major = (fts5YYCODETYPE)fts5yygoto;
fts5yyTraceShift(fts5yypParser, fts5yyact);
- }else{
- assert( fts5yyact == fts5YY_ACCEPT_ACTION );
- fts5yypParser->fts5yytos -= fts5yysize;
- fts5yy_accept(fts5yypParser);
}
}
@@ -189575,10 +191584,11 @@ static int fts5HashResize(Fts5Hash *pHash){
for(i=0; i<pHash->nSlot; i++){
while( apOld[i] ){
- int iHash;
+ unsigned int iHash;
Fts5HashEntry *p = apOld[i];
apOld[i] = p->pHashNext;
- iHash = fts5HashKey(nNew, (u8*)fts5EntryKey(p), strlen(fts5EntryKey(p)));
+ iHash = fts5HashKey(nNew, (u8*)fts5EntryKey(p),
+ (int)strlen(fts5EntryKey(p)));
p->pHashNext = apNew[iHash];
apNew[iHash] = p;
}
@@ -189881,7 +191891,7 @@ static int sqlite3Fts5HashQuery(
int *pnDoclist /* OUT: Size of doclist in bytes */
){
unsigned int iHash = fts5HashKey(pHash->nSlot, (const u8*)pTerm, nTerm);
- char *zKey;
+ char *zKey = 0;
Fts5HashEntry *p;
for(p=pHash->aSlot[iHash]; p; p=p->pHashNext){
@@ -190669,7 +192679,8 @@ static int fts5IndexPrepareStmt(
){
if( p->rc==SQLITE_OK ){
if( zSql ){
- p->rc = sqlite3_prepare_v2(p->pConfig->db, zSql, -1, ppStmt, 0);
+ p->rc = sqlite3_prepare_v3(p->pConfig->db, zSql, -1,
+ SQLITE_PREPARE_PERSISTENT, ppStmt, 0);
}else{
p->rc = SQLITE_NOMEM;
}
@@ -190718,7 +192729,8 @@ static void fts5DataDelete(Fts5Index *p, i64 iFirst, i64 iLast){
if( zSql==0 ){
rc = SQLITE_NOMEM;
}else{
- rc = sqlite3_prepare_v2(pConfig->db, zSql, -1, &p->pDeleter, 0);
+ rc = sqlite3_prepare_v3(pConfig->db, zSql, -1,
+ SQLITE_PREPARE_PERSISTENT, &p->pDeleter, 0);
sqlite3_free(zSql);
}
if( rc!=SQLITE_OK ){
@@ -197317,7 +199329,8 @@ static int fts5PrepareStatement(
if( zSql==0 ){
rc = SQLITE_NOMEM;
}else{
- rc = sqlite3_prepare_v2(pConfig->db, zSql, -1, &pRet, 0);
+ rc = sqlite3_prepare_v3(pConfig->db, zSql, -1,
+ SQLITE_PREPARE_PERSISTENT, &pRet, 0);
if( rc!=SQLITE_OK ){
*pConfig->pzErrmsg = sqlite3_mprintf("%s", sqlite3_errmsg(pConfig->db));
}
@@ -197453,7 +199466,8 @@ static int fts5FindRankFunction(Fts5Cursor *pCsr){
char *zSql = sqlite3Fts5Mprintf(&rc, "SELECT %s", zRankArgs);
if( zSql ){
sqlite3_stmt *pStmt = 0;
- rc = sqlite3_prepare_v2(pConfig->db, zSql, -1, &pStmt, 0);
+ rc = sqlite3_prepare_v3(pConfig->db, zSql, -1,
+ SQLITE_PREPARE_PERSISTENT, &pStmt, 0);
sqlite3_free(zSql);
assert( rc==SQLITE_OK || pCsr->pRankArgStmt==0 );
if( rc==SQLITE_OK ){
@@ -199041,15 +201055,14 @@ static void fts5ModuleDestroy(void *pCtx){
static void fts5Fts5Func(
sqlite3_context *pCtx, /* Function call context */
int nArg, /* Number of args */
- sqlite3_value **apUnused /* Function arguments */
+ sqlite3_value **apArg /* Function arguments */
){
Fts5Global *pGlobal = (Fts5Global*)sqlite3_user_data(pCtx);
- char buf[8];
- UNUSED_PARAM2(nArg, apUnused);
- assert( nArg==0 );
- assert( sizeof(buf)>=sizeof(pGlobal) );
- memcpy(buf, (void*)&pGlobal, sizeof(pGlobal));
- sqlite3_result_blob(pCtx, buf, sizeof(pGlobal), SQLITE_TRANSIENT);
+ fts5_api **ppApi;
+ UNUSED_PARAM(nArg);
+ assert( nArg==1 );
+ ppApi = (fts5_api**)sqlite3_value_pointer(apArg[0], "fts5_api_ptr");
+ if( ppApi ) *ppApi = &pGlobal->api;
}
/*
@@ -199062,7 +201075,7 @@ static void fts5SourceIdFunc(
){
assert( nArg==0 );
UNUSED_PARAM2(nArg, apUnused);
- sqlite3_result_text(pCtx, "fts5: 2017-06-08 14:26:16 0ee482a1e0eae22e08edc8978c9733a96603d4509645f348ebf55b579e89636b", -1, SQLITE_TRANSIENT);
+ sqlite3_result_text(pCtx, "fts5: 2017-10-24 18:55:49 1a584e499906b5c87ec7d43d4abce641fdf017c42125b083109bc77c4de48827", -1, SQLITE_TRANSIENT);
}
static int fts5Init(sqlite3 *db){
@@ -199114,7 +201127,7 @@ static int fts5Init(sqlite3 *db){
if( rc==SQLITE_OK ) rc = sqlite3Fts5VocabInit(pGlobal, db);
if( rc==SQLITE_OK ){
rc = sqlite3_create_function(
- db, "fts5", 0, SQLITE_UTF8, p, fts5Fts5Func, 0, 0
+ db, "fts5", 1, SQLITE_UTF8, p, fts5Fts5Func, 0, 0
);
}
if( rc==SQLITE_OK ){
@@ -199316,7 +201329,8 @@ static int fts5StorageGetStmt(
if( zSql==0 ){
rc = SQLITE_NOMEM;
}else{
- rc = sqlite3_prepare_v2(pC->db, zSql, -1, &p->aStmt[eStmt], 0);
+ rc = sqlite3_prepare_v3(pC->db, zSql, -1,
+ SQLITE_PREPARE_PERSISTENT, &p->aStmt[eStmt], 0);
sqlite3_free(zSql);
if( rc!=SQLITE_OK && pzErrMsg ){
*pzErrMsg = sqlite3_mprintf("%s", sqlite3_errmsg(pC->db));
@@ -202289,6 +204303,11 @@ static int sqlite3Fts5GetVarintLen(u32 iVal){
** the number of fts5 rows that contain at least one instance of term
** $term. Field $cnt is set to the total number of instances of term
** $term in the database.
+**
+** instance:
+** CREATE TABLE vocab(term, doc, col, offset, PRIMARY KEY(<all-fields>));
+**
+** One row for each term instance in the database.
*/
@@ -202304,7 +204323,7 @@ struct Fts5VocabTable {
char *zFts5Db; /* Db containing fts5 table */
sqlite3 *db; /* Database handle */
Fts5Global *pGlobal; /* FTS5 global object for this database */
- int eType; /* FTS5_VOCAB_COL or ROW */
+ int eType; /* FTS5_VOCAB_COL, ROW or INSTANCE */
};
struct Fts5VocabCursor {
@@ -202324,16 +204343,22 @@ struct Fts5VocabCursor {
i64 *aCnt;
i64 *aDoc;
- /* Output values used by 'row' and 'col' tables */
+ /* Output values used by all tables. */
i64 rowid; /* This table's current rowid value */
Fts5Buffer term; /* Current value of 'term' column */
+
+ /* Output values Used by 'instance' tables only */
+ i64 iInstPos;
+ int iInstOff;
};
-#define FTS5_VOCAB_COL 0
-#define FTS5_VOCAB_ROW 1
+#define FTS5_VOCAB_COL 0
+#define FTS5_VOCAB_ROW 1
+#define FTS5_VOCAB_INSTANCE 2
#define FTS5_VOCAB_COL_SCHEMA "term, col, doc, cnt"
#define FTS5_VOCAB_ROW_SCHEMA "term, doc, cnt"
+#define FTS5_VOCAB_INST_SCHEMA "term, doc, col, offset"
/*
** Bits for the mask used as the idxNum value by xBestIndex/xFilter.
@@ -202361,6 +204386,9 @@ static int fts5VocabTableType(const char *zType, char **pzErr, int *peType){
if( sqlite3_stricmp(zCopy, "row")==0 ){
*peType = FTS5_VOCAB_ROW;
}else
+ if( sqlite3_stricmp(zCopy, "instance")==0 ){
+ *peType = FTS5_VOCAB_INSTANCE;
+ }else
{
*pzErr = sqlite3_mprintf("fts5vocab: unknown table type: %Q", zCopy);
rc = SQLITE_ERROR;
@@ -202421,7 +204449,8 @@ static int fts5VocabInitVtab(
){
const char *azSchema[] = {
"CREATE TABlE vocab(" FTS5_VOCAB_COL_SCHEMA ")",
- "CREATE TABlE vocab(" FTS5_VOCAB_ROW_SCHEMA ")"
+ "CREATE TABlE vocab(" FTS5_VOCAB_ROW_SCHEMA ")",
+ "CREATE TABlE vocab(" FTS5_VOCAB_INST_SCHEMA ")"
};
Fts5VocabTable *pRet = 0;
@@ -202495,6 +204524,15 @@ static int fts5VocabCreateMethod(
/*
** Implementation of the xBestIndex method.
+**
+** Only constraints of the form:
+**
+** term <= ?
+** term == ?
+** term >= ?
+**
+** are interpreted. Less-than and less-than-or-equal are treated
+** identically, as are greater-than and greater-than-or-equal.
*/
static int fts5VocabBestIndexMethod(
sqlite3_vtab *pUnused,
@@ -202638,6 +204676,54 @@ static int fts5VocabCloseMethod(sqlite3_vtab_cursor *pCursor){
return SQLITE_OK;
}
+static int fts5VocabInstanceNewTerm(Fts5VocabCursor *pCsr){
+ int rc = SQLITE_OK;
+
+ if( sqlite3Fts5IterEof(pCsr->pIter) ){
+ pCsr->bEof = 1;
+ }else{
+ const char *zTerm;
+ int nTerm;
+ zTerm = sqlite3Fts5IterTerm(pCsr->pIter, &nTerm);
+ if( pCsr->nLeTerm>=0 ){
+ int nCmp = MIN(nTerm, pCsr->nLeTerm);
+ int bCmp = memcmp(pCsr->zLeTerm, zTerm, nCmp);
+ if( bCmp<0 || (bCmp==0 && pCsr->nLeTerm<nTerm) ){
+ pCsr->bEof = 1;
+ }
+ }
+
+ sqlite3Fts5BufferSet(&rc, &pCsr->term, nTerm, (const u8*)zTerm);
+ }
+ return rc;
+}
+
+static int fts5VocabInstanceNext(Fts5VocabCursor *pCsr){
+ int eDetail = pCsr->pConfig->eDetail;
+ int rc = SQLITE_OK;
+ Fts5IndexIter *pIter = pCsr->pIter;
+ i64 *pp = &pCsr->iInstPos;
+ int *po = &pCsr->iInstOff;
+
+ while( eDetail==FTS5_DETAIL_NONE
+ || sqlite3Fts5PoslistNext64(pIter->pData, pIter->nData, po, pp)
+ ){
+ pCsr->iInstPos = 0;
+ pCsr->iInstOff = 0;
+
+ rc = sqlite3Fts5IterNextScan(pCsr->pIter);
+ if( rc==SQLITE_OK ){
+ rc = fts5VocabInstanceNewTerm(pCsr);
+ if( eDetail==FTS5_DETAIL_NONE ) break;
+ }
+ if( rc ){
+ pCsr->bEof = 1;
+ break;
+ }
+ }
+
+ return rc;
+}
/*
** Advance the cursor to the next row in the table.
@@ -202650,13 +204736,17 @@ static int fts5VocabNextMethod(sqlite3_vtab_cursor *pCursor){
pCsr->rowid++;
+ if( pTab->eType==FTS5_VOCAB_INSTANCE ){
+ return fts5VocabInstanceNext(pCsr);
+ }
+
if( pTab->eType==FTS5_VOCAB_COL ){
for(pCsr->iCol++; pCsr->iCol<nCol; pCsr->iCol++){
if( pCsr->aDoc[pCsr->iCol] ) break;
}
}
- if( pTab->eType==FTS5_VOCAB_ROW || pCsr->iCol>=nCol ){
+ if( pTab->eType!=FTS5_VOCAB_COL || pCsr->iCol>=nCol ){
if( sqlite3Fts5IterEof(pCsr->pIter) ){
pCsr->bEof = 1;
}else{
@@ -202680,22 +204770,26 @@ static int fts5VocabNextMethod(sqlite3_vtab_cursor *pCursor){
assert( pTab->eType==FTS5_VOCAB_COL || pTab->eType==FTS5_VOCAB_ROW );
while( rc==SQLITE_OK ){
+ int eDetail = pCsr->pConfig->eDetail;
const u8 *pPos; int nPos; /* Position list */
i64 iPos = 0; /* 64-bit position read from poslist */
int iOff = 0; /* Current offset within position list */
pPos = pCsr->pIter->pData;
nPos = pCsr->pIter->nData;
- switch( pCsr->pConfig->eDetail ){
- case FTS5_DETAIL_FULL:
- pPos = pCsr->pIter->pData;
- nPos = pCsr->pIter->nData;
- if( pTab->eType==FTS5_VOCAB_ROW ){
+
+ switch( pTab->eType ){
+ case FTS5_VOCAB_ROW:
+ if( eDetail==FTS5_DETAIL_FULL ){
while( 0==sqlite3Fts5PoslistNext64(pPos, nPos, &iOff, &iPos) ){
pCsr->aCnt[0]++;
}
- pCsr->aDoc[0]++;
- }else{
+ }
+ pCsr->aDoc[0]++;
+ break;
+
+ case FTS5_VOCAB_COL:
+ if( eDetail==FTS5_DETAIL_FULL ){
int iCol = -1;
while( 0==sqlite3Fts5PoslistNext64(pPos, nPos, &iOff, &iPos) ){
int ii = FTS5_POS2COLUMN(iPos);
@@ -202709,13 +204803,7 @@ static int fts5VocabNextMethod(sqlite3_vtab_cursor *pCursor){
iCol = ii;
}
}
- }
- break;
-
- case FTS5_DETAIL_COLUMNS:
- if( pTab->eType==FTS5_VOCAB_ROW ){
- pCsr->aDoc[0]++;
- }else{
+ }else if( eDetail==FTS5_DETAIL_COLUMNS ){
while( 0==sqlite3Fts5PoslistNext64(pPos, nPos, &iOff,&iPos) ){
assert_nc( iPos>=0 && iPos<nCol );
if( iPos>=nCol ){
@@ -202724,18 +204812,21 @@ static int fts5VocabNextMethod(sqlite3_vtab_cursor *pCursor){
}
pCsr->aDoc[iPos]++;
}
+ }else{
+ assert( eDetail==FTS5_DETAIL_NONE );
+ pCsr->aDoc[0]++;
}
break;
- default:
- assert( pCsr->pConfig->eDetail==FTS5_DETAIL_NONE );
- pCsr->aDoc[0]++;
+ default:
+ assert( pTab->eType==FTS5_VOCAB_INSTANCE );
break;
}
if( rc==SQLITE_OK ){
rc = sqlite3Fts5IterNextScan(pCsr->pIter);
}
+ if( pTab->eType==FTS5_VOCAB_INSTANCE ) break;
if( rc==SQLITE_OK ){
zTerm = sqlite3Fts5IterTerm(pCsr->pIter, &nTerm);
@@ -202765,7 +204856,9 @@ static int fts5VocabFilterMethod(
int nUnused, /* Number of elements in apVal */
sqlite3_value **apVal /* Arguments for the indexing scheme */
){
+ Fts5VocabTable *pTab = (Fts5VocabTable*)pCursor->pVtab;
Fts5VocabCursor *pCsr = (Fts5VocabCursor*)pCursor;
+ int eType = pTab->eType;
int rc = SQLITE_OK;
int iVal = 0;
@@ -202805,11 +204898,16 @@ static int fts5VocabFilterMethod(
}
}
-
if( rc==SQLITE_OK ){
rc = sqlite3Fts5IndexQuery(pCsr->pIndex, zTerm, nTerm, f, 0, &pCsr->pIter);
}
- if( rc==SQLITE_OK ){
+ if( rc==SQLITE_OK && eType==FTS5_VOCAB_INSTANCE ){
+ rc = fts5VocabInstanceNewTerm(pCsr);
+ }
+ if( rc==SQLITE_OK
+ && !pCsr->bEof
+ && (eType!=FTS5_VOCAB_INSTANCE || pCsr->pConfig->eDetail!=FTS5_DETAIL_NONE)
+ ){
rc = fts5VocabNextMethod(pCursor);
}
@@ -202851,13 +204949,41 @@ static int fts5VocabColumnMethod(
}else{
iVal = pCsr->aCnt[pCsr->iCol];
}
- }else{
+ }else if( eType==FTS5_VOCAB_ROW ){
assert( iCol==1 || iCol==2 );
if( iCol==1 ){
iVal = pCsr->aDoc[0];
}else{
iVal = pCsr->aCnt[0];
}
+ }else{
+ assert( eType==FTS5_VOCAB_INSTANCE );
+ switch( iCol ){
+ case 1:
+ sqlite3_result_int64(pCtx, pCsr->pIter->iRowid);
+ break;
+ case 2: {
+ int ii = -1;
+ if( eDetail==FTS5_DETAIL_FULL ){
+ ii = FTS5_POS2COLUMN(pCsr->iInstPos);
+ }else if( eDetail==FTS5_DETAIL_COLUMNS ){
+ ii = (int)pCsr->iInstPos;
+ }
+ if( ii>=0 && ii<pCsr->pConfig->nCol ){
+ const char *z = pCsr->pConfig->azCol[ii];
+ sqlite3_result_text(pCtx, z, -1, SQLITE_STATIC);
+ }
+ break;
+ }
+ default: {
+ assert( iCol==3 );
+ if( eDetail==FTS5_DETAIL_FULL ){
+ int ii = FTS5_POS2OFFSET(pCsr->iInstPos);
+ sqlite3_result_int(pCtx, ii);
+ }
+ break;
+ }
+ }
}
if( iVal>0 ) sqlite3_result_int64(pCtx, iVal);
@@ -202916,3 +205042,311 @@ static int sqlite3Fts5VocabInit(Fts5Global *pGlobal, sqlite3 *db){
#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS5) */
/************** End of fts5.c ************************************************/
+/************** Begin file stmt.c ********************************************/
+/*
+** 2017-05-31
+**
+** The author disclaims copyright to this source code. In place of
+** a legal notice, here is a blessing:
+**
+** May you do good and not evil.
+** May you find forgiveness for yourself and forgive others.
+** May you share freely, never taking more than you give.
+**
+*************************************************************************
+**
+** This file demonstrates an eponymous virtual table that returns information
+** about all prepared statements for the database connection.
+**
+** Usage example:
+**
+** .load ./stmt
+** .mode line
+** .header on
+** SELECT * FROM stmt;
+*/
+#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB)
+#if !defined(SQLITEINT_H)
+/* #include "sqlite3ext.h" */
+#endif
+SQLITE_EXTENSION_INIT1
+/* #include <assert.h> */
+/* #include <string.h> */
+
+#ifndef SQLITE_OMIT_VIRTUALTABLE
+
+/* stmt_vtab is a subclass of sqlite3_vtab which will
+** serve as the underlying representation of a stmt virtual table
+*/
+typedef struct stmt_vtab stmt_vtab;
+struct stmt_vtab {
+ sqlite3_vtab base; /* Base class - must be first */
+ sqlite3 *db; /* Database connection for this stmt vtab */
+};
+
+/* stmt_cursor is a subclass of sqlite3_vtab_cursor which will
+** serve as the underlying representation of a cursor that scans
+** over rows of the result
+*/
+typedef struct stmt_cursor stmt_cursor;
+struct stmt_cursor {
+ sqlite3_vtab_cursor base; /* Base class - must be first */
+ sqlite3 *db; /* Database connection for this cursor */
+ sqlite3_stmt *pStmt; /* Statement cursor is currently pointing at */
+ sqlite3_int64 iRowid; /* The rowid */
+};
+
+/*
+** The stmtConnect() method is invoked to create a new
+** stmt_vtab that describes the stmt virtual table.
+**
+** Think of this routine as the constructor for stmt_vtab objects.
+**
+** All this routine needs to do is:
+**
+** (1) Allocate the stmt_vtab object and initialize all fields.
+**
+** (2) Tell SQLite (via the sqlite3_declare_vtab() interface) what the
+** result set of queries against stmt will look like.
+*/
+static int stmtConnect(
+ sqlite3 *db,
+ void *pAux,
+ int argc, const char *const*argv,
+ sqlite3_vtab **ppVtab,
+ char **pzErr
+){
+ stmt_vtab *pNew;
+ int rc;
+
+/* Column numbers */
+#define STMT_COLUMN_SQL 0 /* SQL for the statement */
+#define STMT_COLUMN_NCOL 1 /* Number of result columns */
+#define STMT_COLUMN_RO 2 /* True if read-only */
+#define STMT_COLUMN_BUSY 3 /* True if currently busy */
+#define STMT_COLUMN_NSCAN 4 /* SQLITE_STMTSTATUS_FULLSCAN_STEP */
+#define STMT_COLUMN_NSORT 5 /* SQLITE_STMTSTATUS_SORT */
+#define STMT_COLUMN_NAIDX 6 /* SQLITE_STMTSTATUS_AUTOINDEX */
+#define STMT_COLUMN_NSTEP 7 /* SQLITE_STMTSTATUS_VM_STEP */
+#define STMT_COLUMN_REPREP 8 /* SQLITE_STMTSTATUS_REPREPARE */
+#define STMT_COLUMN_RUN 9 /* SQLITE_STMTSTATUS_RUN */
+#define STMT_COLUMN_MEM 10 /* SQLITE_STMTSTATUS_MEMUSED */
+
+
+ rc = sqlite3_declare_vtab(db,
+ "CREATE TABLE x(sql,ncol,ro,busy,nscan,nsort,naidx,nstep,"
+ "reprep,run,mem)");
+ if( rc==SQLITE_OK ){
+ pNew = sqlite3_malloc( sizeof(*pNew) );
+ *ppVtab = (sqlite3_vtab*)pNew;
+ if( pNew==0 ) return SQLITE_NOMEM;
+ memset(pNew, 0, sizeof(*pNew));
+ pNew->db = db;
+ }
+ return rc;
+}
+
+/*
+** This method is the destructor for stmt_cursor objects.
+*/
+static int stmtDisconnect(sqlite3_vtab *pVtab){
+ sqlite3_free(pVtab);
+ return SQLITE_OK;
+}
+
+/*
+** Constructor for a new stmt_cursor object.
+*/
+static int stmtOpen(sqlite3_vtab *p, sqlite3_vtab_cursor **ppCursor){
+ stmt_cursor *pCur;
+ pCur = sqlite3_malloc( sizeof(*pCur) );
+ if( pCur==0 ) return SQLITE_NOMEM;
+ memset(pCur, 0, sizeof(*pCur));
+ pCur->db = ((stmt_vtab*)p)->db;
+ *ppCursor = &pCur->base;
+ return SQLITE_OK;
+}
+
+/*
+** Destructor for a stmt_cursor.
+*/
+static int stmtClose(sqlite3_vtab_cursor *cur){
+ sqlite3_free(cur);
+ return SQLITE_OK;
+}
+
+
+/*
+** Advance a stmt_cursor to its next row of output.
+*/
+static int stmtNext(sqlite3_vtab_cursor *cur){
+ stmt_cursor *pCur = (stmt_cursor*)cur;
+ pCur->iRowid++;
+ pCur->pStmt = sqlite3_next_stmt(pCur->db, pCur->pStmt);
+ return SQLITE_OK;
+}
+
+/*
+** Return values of columns for the row at which the stmt_cursor
+** is currently pointing.
+*/
+static int stmtColumn(
+ sqlite3_vtab_cursor *cur, /* The cursor */
+ sqlite3_context *ctx, /* First argument to sqlite3_result_...() */
+ int i /* Which column to return */
+){
+ stmt_cursor *pCur = (stmt_cursor*)cur;
+ switch( i ){
+ case STMT_COLUMN_SQL: {
+ sqlite3_result_text(ctx, sqlite3_sql(pCur->pStmt), -1, SQLITE_TRANSIENT);
+ break;
+ }
+ case STMT_COLUMN_NCOL: {
+ sqlite3_result_int(ctx, sqlite3_column_count(pCur->pStmt));
+ break;
+ }
+ case STMT_COLUMN_RO: {
+ sqlite3_result_int(ctx, sqlite3_stmt_readonly(pCur->pStmt));
+ break;
+ }
+ case STMT_COLUMN_BUSY: {
+ sqlite3_result_int(ctx, sqlite3_stmt_busy(pCur->pStmt));
+ break;
+ }
+ case STMT_COLUMN_MEM: {
+ i = SQLITE_STMTSTATUS_MEMUSED +
+ STMT_COLUMN_NSCAN - SQLITE_STMTSTATUS_FULLSCAN_STEP;
+ /* Fall thru */
+ }
+ case STMT_COLUMN_NSCAN:
+ case STMT_COLUMN_NSORT:
+ case STMT_COLUMN_NAIDX:
+ case STMT_COLUMN_NSTEP:
+ case STMT_COLUMN_REPREP:
+ case STMT_COLUMN_RUN: {
+ sqlite3_result_int(ctx, sqlite3_stmt_status(pCur->pStmt,
+ i-STMT_COLUMN_NSCAN+SQLITE_STMTSTATUS_FULLSCAN_STEP, 0));
+ break;
+ }
+ }
+ return SQLITE_OK;
+}
+
+/*
+** Return the rowid for the current row. In this implementation, the
+** rowid is the same as the output value.
+*/
+static int stmtRowid(sqlite3_vtab_cursor *cur, sqlite_int64 *pRowid){
+ stmt_cursor *pCur = (stmt_cursor*)cur;
+ *pRowid = pCur->iRowid;
+ return SQLITE_OK;
+}
+
+/*
+** Return TRUE if the cursor has been moved off of the last
+** row of output.
+*/
+static int stmtEof(sqlite3_vtab_cursor *cur){
+ stmt_cursor *pCur = (stmt_cursor*)cur;
+ return pCur->pStmt==0;
+}
+
+/*
+** This method is called to "rewind" the stmt_cursor object back
+** to the first row of output. This method is always called at least
+** once prior to any call to stmtColumn() or stmtRowid() or
+** stmtEof().
+*/
+static int stmtFilter(
+ sqlite3_vtab_cursor *pVtabCursor,
+ int idxNum, const char *idxStr,
+ int argc, sqlite3_value **argv
+){
+ stmt_cursor *pCur = (stmt_cursor *)pVtabCursor;
+ pCur->pStmt = 0;
+ pCur->iRowid = 0;
+ return stmtNext(pVtabCursor);
+}
+
+/*
+** SQLite will invoke this method one or more times while planning a query
+** that uses the stmt virtual table. This routine needs to create
+** a query plan for each invocation and compute an estimated cost for that
+** plan.
+*/
+static int stmtBestIndex(
+ sqlite3_vtab *tab,
+ sqlite3_index_info *pIdxInfo
+){
+ pIdxInfo->estimatedCost = (double)500;
+ pIdxInfo->estimatedRows = 500;
+ return SQLITE_OK;
+}
+
+/*
+** This following structure defines all the methods for the
+** stmt virtual table.
+*/
+static sqlite3_module stmtModule = {
+ 0, /* iVersion */
+ 0, /* xCreate */
+ stmtConnect, /* xConnect */
+ stmtBestIndex, /* xBestIndex */
+ stmtDisconnect, /* xDisconnect */
+ 0, /* xDestroy */
+ stmtOpen, /* xOpen - open a cursor */
+ stmtClose, /* xClose - close a cursor */
+ stmtFilter, /* xFilter - configure scan constraints */
+ stmtNext, /* xNext - advance a cursor */
+ stmtEof, /* xEof - check for end of scan */
+ stmtColumn, /* xColumn - read data */
+ stmtRowid, /* xRowid - read data */
+ 0, /* xUpdate */
+ 0, /* xBegin */
+ 0, /* xSync */
+ 0, /* xCommit */
+ 0, /* xRollback */
+ 0, /* xFindMethod */
+ 0, /* xRename */
+ 0, /* xSavepoint */
+ 0, /* xRelease */
+ 0, /* xRollbackTo */
+};
+
+#endif /* SQLITE_OMIT_VIRTUALTABLE */
+
+SQLITE_PRIVATE int sqlite3StmtVtabInit(sqlite3 *db){
+ int rc = SQLITE_OK;
+#ifndef SQLITE_OMIT_VIRTUALTABLE
+ rc = sqlite3_create_module(db, "sqlite_stmt", &stmtModule, 0);
+#endif
+ return rc;
+}
+
+#ifndef SQLITE_CORE
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+SQLITE_API int sqlite3_stmt_init(
+ sqlite3 *db,
+ char **pzErrMsg,
+ const sqlite3_api_routines *pApi
+){
+ int rc = SQLITE_OK;
+ SQLITE_EXTENSION_INIT2(pApi);
+#ifndef SQLITE_OMIT_VIRTUALTABLE
+ rc = sqlite3StmtVtabInit(db);
+#endif
+ return rc;
+}
+#endif /* SQLITE_CORE */
+#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_STMTVTAB) */
+
+/************** End of stmt.c ************************************************/
+#if __LINE__!=205346
+#undef SQLITE_SOURCE_ID
+#define SQLITE_SOURCE_ID "2017-10-24 18:55:49 1a584e499906b5c87ec7d43d4abce641fdf017c42125b083109bc77c4de4alt2"
+#endif
+/* Return the source-id for this library */
+SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; }
+/************************** End of sqlite3.c ******************************/
diff --git a/db/sqlite3/src/sqlite3.h b/db/sqlite3/src/sqlite3.h
index 3deb9c79bd..5f28e036b3 100644
--- a/db/sqlite3/src/sqlite3.h
+++ b/db/sqlite3/src/sqlite3.h
@@ -1,5 +1,5 @@
/*
-** 2001 September 15
+** 2001-09-15
**
** The author disclaims copyright to this source code. In place of
** a legal notice, here is a blessing:
@@ -115,15 +115,17 @@ extern "C" {
** a string which identifies a particular check-in of SQLite
** within its configuration management system. ^The SQLITE_SOURCE_ID
** string contains the date and time of the check-in (UTC) and a SHA1
-** or SHA3-256 hash of the entire source tree.
+** or SHA3-256 hash of the entire source tree. If the source code has
+** been edited in any way since it was last checked in, then the last
+** four hexadecimal digits of the hash may be modified.
**
** See also: [sqlite3_libversion()],
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
** [sqlite_version()] and [sqlite_source_id()].
*/
-#define SQLITE_VERSION "3.19.3"
-#define SQLITE_VERSION_NUMBER 3019003
-#define SQLITE_SOURCE_ID "2017-06-08 14:26:16 0ee482a1e0eae22e08edc8978c9733a96603d4509645f348ebf55b579e89636b"
+#define SQLITE_VERSION "3.21.0"
+#define SQLITE_VERSION_NUMBER 3021000
+#define SQLITE_SOURCE_ID "2017-10-24 18:55:49 1a584e499906b5c87ec7d43d4abce641fdf017c42125b083109bc77c4de48827"
/*
** CAPI3REF: Run-Time Library Version Numbers
@@ -139,7 +141,7 @@ extern "C" {
**
** <blockquote><pre>
** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER );
-** assert( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)==0 );
+** assert( strncmp(sqlite3_sourceid(),SQLITE_SOURCE_ID,80)==0 );
** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );
** </pre></blockquote>)^
**
@@ -149,9 +151,11 @@ extern "C" {
** function is provided for use in DLLs since DLL users usually do not have
** direct access to string constants within the DLL. ^The
** sqlite3_libversion_number() function returns an integer equal to
-** [SQLITE_VERSION_NUMBER]. ^The sqlite3_sourceid() function returns
+** [SQLITE_VERSION_NUMBER]. ^(The sqlite3_sourceid() function returns
** a pointer to a string constant whose value is the same as the
-** [SQLITE_SOURCE_ID] C preprocessor macro.
+** [SQLITE_SOURCE_ID] C preprocessor macro. Except if SQLite is built
+** using an edited copy of [the amalgamation], then the last four characters
+** of the hash might be different from [SQLITE_SOURCE_ID].)^
**
** See also: [sqlite_version()] and [sqlite_source_id()].
*/
@@ -417,7 +421,7 @@ SQLITE_API int sqlite3_exec(
*/
#define SQLITE_OK 0 /* Successful result */
/* beginning-of-error-codes */
-#define SQLITE_ERROR 1 /* SQL error or missing database */
+#define SQLITE_ERROR 1 /* Generic error */
#define SQLITE_INTERNAL 2 /* Internal logic error in SQLite */
#define SQLITE_PERM 3 /* Access permission denied */
#define SQLITE_ABORT 4 /* Callback routine requested an abort */
@@ -432,7 +436,7 @@ SQLITE_API int sqlite3_exec(
#define SQLITE_FULL 13 /* Insertion failed because database is full */
#define SQLITE_CANTOPEN 14 /* Unable to open the database file */
#define SQLITE_PROTOCOL 15 /* Database lock protocol error */
-#define SQLITE_EMPTY 16 /* Database is empty */
+#define SQLITE_EMPTY 16 /* Internal use only */
#define SQLITE_SCHEMA 17 /* The database schema changed */
#define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */
#define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */
@@ -440,7 +444,7 @@ SQLITE_API int sqlite3_exec(
#define SQLITE_MISUSE 21 /* Library used incorrectly */
#define SQLITE_NOLFS 22 /* Uses OS features not supported on host */
#define SQLITE_AUTH 23 /* Authorization denied */
-#define SQLITE_FORMAT 24 /* Auxiliary database format error */
+#define SQLITE_FORMAT 24 /* Not used */
#define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */
#define SQLITE_NOTADB 26 /* File opened that is not a database file */
#define SQLITE_NOTICE 27 /* Notifications from sqlite3_log() */
@@ -494,6 +498,9 @@ SQLITE_API int sqlite3_exec(
#define SQLITE_IOERR_CONVPATH (SQLITE_IOERR | (26<<8))
#define SQLITE_IOERR_VNODE (SQLITE_IOERR | (27<<8))
#define SQLITE_IOERR_AUTH (SQLITE_IOERR | (28<<8))
+#define SQLITE_IOERR_BEGIN_ATOMIC (SQLITE_IOERR | (29<<8))
+#define SQLITE_IOERR_COMMIT_ATOMIC (SQLITE_IOERR | (30<<8))
+#define SQLITE_IOERR_ROLLBACK_ATOMIC (SQLITE_IOERR | (31<<8))
#define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8))
#define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8))
#define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8))
@@ -580,6 +587,11 @@ SQLITE_API int sqlite3_exec(
** SQLITE_IOCAP_IMMUTABLE flag indicates that the file is on
** read-only media and cannot be changed even by processes with
** elevated privileges.
+**
+** The SQLITE_IOCAP_BATCH_ATOMIC property means that the underlying
+** filesystem supports doing multiple write operations atomically when those
+** write operations are bracketed by [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] and
+** [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE].
*/
#define SQLITE_IOCAP_ATOMIC 0x00000001
#define SQLITE_IOCAP_ATOMIC512 0x00000002
@@ -595,6 +607,7 @@ SQLITE_API int sqlite3_exec(
#define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800
#define SQLITE_IOCAP_POWERSAFE_OVERWRITE 0x00001000
#define SQLITE_IOCAP_IMMUTABLE 0x00002000
+#define SQLITE_IOCAP_BATCH_ATOMIC 0x00004000
/*
** CAPI3REF: File Locking Levels
@@ -729,6 +742,7 @@ struct sqlite3_file {
** <li> [SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN]
** <li> [SQLITE_IOCAP_POWERSAFE_OVERWRITE]
** <li> [SQLITE_IOCAP_IMMUTABLE]
+** <li> [SQLITE_IOCAP_BATCH_ATOMIC]
** </ul>
**
** The SQLITE_IOCAP_ATOMIC property means that all writes of
@@ -1012,6 +1026,40 @@ struct sqlite3_io_methods {
** The [SQLITE_FCNTL_RBU] opcode is implemented by the special VFS used by
** the RBU extension only. All other VFS should return SQLITE_NOTFOUND for
** this opcode.
+**
+** <li>[[SQLITE_FCNTL_BEGIN_ATOMIC_WRITE]]
+** If the [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] opcode returns SQLITE_OK, then
+** the file descriptor is placed in "batch write mode", which
+** means all subsequent write operations will be deferred and done
+** atomically at the next [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]. Systems
+** that do not support batch atomic writes will return SQLITE_NOTFOUND.
+** ^Following a successful SQLITE_FCNTL_BEGIN_ATOMIC_WRITE and prior to
+** the closing [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] or
+** [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE], SQLite will make
+** no VFS interface calls on the same [sqlite3_file] file descriptor
+** except for calls to the xWrite method and the xFileControl method
+** with [SQLITE_FCNTL_SIZE_HINT].
+**
+** <li>[[SQLITE_FCNTL_COMMIT_ATOMIC_WRITE]]
+** The [SQLITE_FCNTL_COMMIT_ATOMIC_WRITE] opcode causes all write
+** operations since the previous successful call to
+** [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be performed atomically.
+** This file control returns [SQLITE_OK] if and only if the writes were
+** all performed successfully and have been committed to persistent storage.
+** ^Regardless of whether or not it is successful, this file control takes
+** the file descriptor out of batch write mode so that all subsequent
+** write operations are independent.
+** ^SQLite will never invoke SQLITE_FCNTL_COMMIT_ATOMIC_WRITE without
+** a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE].
+**
+** <li>[[SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE]]
+** The [SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE] opcode causes all write
+** operations since the previous successful call to
+** [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE] to be rolled back.
+** ^This file control takes the file descriptor out of batch write mode
+** so that all subsequent write operations are independent.
+** ^SQLite will never invoke SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE without
+** a prior successful call to [SQLITE_FCNTL_BEGIN_ATOMIC_WRITE].
** </ul>
*/
#define SQLITE_FCNTL_LOCKSTATE 1
@@ -1043,6 +1091,9 @@ struct sqlite3_io_methods {
#define SQLITE_FCNTL_JOURNAL_POINTER 28
#define SQLITE_FCNTL_WIN32_GET_HANDLE 29
#define SQLITE_FCNTL_PDB 30
+#define SQLITE_FCNTL_BEGIN_ATOMIC_WRITE 31
+#define SQLITE_FCNTL_COMMIT_ATOMIC_WRITE 32
+#define SQLITE_FCNTL_ROLLBACK_ATOMIC_WRITE 33
/* deprecated names */
#define SQLITE_GET_LOCKPROXYFILE SQLITE_FCNTL_GET_LOCKPROXYFILE
@@ -1613,6 +1664,16 @@ struct sqlite3_mem_methods {
** routines with a wrapper that simulations memory allocation failure or
** tracks memory usage, for example. </dd>
**
+** [[SQLITE_CONFIG_SMALL_MALLOC]] <dt>SQLITE_CONFIG_SMALL_MALLOC</dt>
+** <dd> ^The SQLITE_CONFIG_SMALL_MALLOC option takes single argument of
+** type int, interpreted as a boolean, which if true provides a hint to
+** SQLite that it should avoid large memory allocations if possible.
+** SQLite will run faster if it is free to make large memory allocations,
+** but some application might prefer to run slower in exchange for
+** guarantees about memory fragmentation that are possible if large
+** allocations are avoided. This hint is normally off.
+** </dd>
+**
** [[SQLITE_CONFIG_MEMSTATUS]] <dt>SQLITE_CONFIG_MEMSTATUS</dt>
** <dd> ^The SQLITE_CONFIG_MEMSTATUS option takes single argument of type int,
** interpreted as a boolean, which enables or disables the collection of
@@ -1630,25 +1691,7 @@ struct sqlite3_mem_methods {
** </dd>
**
** [[SQLITE_CONFIG_SCRATCH]] <dt>SQLITE_CONFIG_SCRATCH</dt>
-** <dd> ^The SQLITE_CONFIG_SCRATCH option specifies a static memory buffer
-** that SQLite can use for scratch memory. ^(There are three arguments
-** to SQLITE_CONFIG_SCRATCH: A pointer an 8-byte
-** aligned memory buffer from which the scratch allocations will be
-** drawn, the size of each scratch allocation (sz),
-** and the maximum number of scratch allocations (N).)^
-** The first argument must be a pointer to an 8-byte aligned buffer
-** of at least sz*N bytes of memory.
-** ^SQLite will not use more than one scratch buffers per thread.
-** ^SQLite will never request a scratch buffer that is more than 6
-** times the database page size.
-** ^If SQLite needs needs additional
-** scratch memory beyond what is provided by this configuration option, then
-** [sqlite3_malloc()] will be used to obtain the memory needed.<p>
-** ^When the application provides any amount of scratch memory using
-** SQLITE_CONFIG_SCRATCH, SQLite avoids unnecessary large
-** [sqlite3_malloc|heap allocations].
-** This can help [Robson proof|prevent memory allocation failures] due to heap
-** fragmentation in low-memory embedded systems.
+** <dd> The SQLITE_CONFIG_SCRATCH option is no longer used.
** </dd>
**
** [[SQLITE_CONFIG_PAGECACHE]] <dt>SQLITE_CONFIG_PAGECACHE</dt>
@@ -1684,8 +1727,7 @@ struct sqlite3_mem_methods {
** [[SQLITE_CONFIG_HEAP]] <dt>SQLITE_CONFIG_HEAP</dt>
** <dd> ^The SQLITE_CONFIG_HEAP option specifies a static memory buffer
** that SQLite will use for all of its dynamic memory allocation needs
-** beyond those provided for by [SQLITE_CONFIG_SCRATCH] and
-** [SQLITE_CONFIG_PAGECACHE].
+** beyond those provided for by [SQLITE_CONFIG_PAGECACHE].
** ^The SQLITE_CONFIG_HEAP option is only available if SQLite is compiled
** with either [SQLITE_ENABLE_MEMSYS3] or [SQLITE_ENABLE_MEMSYS5] and returns
** [SQLITE_ERROR] if invoked otherwise.
@@ -1878,7 +1920,7 @@ struct sqlite3_mem_methods {
#define SQLITE_CONFIG_SERIALIZED 3 /* nil */
#define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */
#define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */
-#define SQLITE_CONFIG_SCRATCH 6 /* void*, int sz, int N */
+#define SQLITE_CONFIG_SCRATCH 6 /* No longer used */
#define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */
#define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */
#define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */
@@ -1899,6 +1941,7 @@ struct sqlite3_mem_methods {
#define SQLITE_CONFIG_PCACHE_HDRSZ 24 /* int *psz */
#define SQLITE_CONFIG_PMASZ 25 /* unsigned int szPma */
#define SQLITE_CONFIG_STMTJRNL_SPILL 26 /* int nByte */
+#define SQLITE_CONFIG_SMALL_MALLOC 27 /* boolean */
/*
** CAPI3REF: Database Connection Configuration Options
@@ -2007,6 +2050,17 @@ struct sqlite3_mem_methods {
** have been disabled - 0 if they are not disabled, 1 if they are.
** </dd>
**
+** <dt>SQLITE_DBCONFIG_ENABLE_QPSG</dt>
+** <dd>^(The SQLITE_DBCONFIG_ENABLE_QPSG option activates or deactivates
+** the [query planner stability guarantee] (QPSG). When the QPSG is active,
+** a single SQL query statement will always use the same algorithm regardless
+** of values of [bound parameters].)^ The QPSG disables some query optimizations
+** that look at the values of bound parameters, which can make some queries
+** slower. But the QPSG has the advantage of more predictable behavior. With
+** the QPSG active, SQLite will always use the same query plan in the field as
+** was used during testing in the lab.
+** </dd>
+**
** </dl>
*/
#define SQLITE_DBCONFIG_MAINDBNAME 1000 /* const char* */
@@ -2016,6 +2070,7 @@ struct sqlite3_mem_methods {
#define SQLITE_DBCONFIG_ENABLE_FTS3_TOKENIZER 1004 /* int int* */
#define SQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION 1005 /* int int* */
#define SQLITE_DBCONFIG_NO_CKPT_ON_CLOSE 1006 /* int int* */
+#define SQLITE_DBCONFIG_ENABLE_QPSG 1007 /* int int* */
/*
@@ -2679,7 +2734,8 @@ SQLITE_API void sqlite3_randomness(int N, void *P);
** [database connection], supplied in the first argument.
** ^The authorizer callback is invoked as SQL statements are being compiled
** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()],
-** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()]. ^At various
+** [sqlite3_prepare_v3()], [sqlite3_prepare16()], [sqlite3_prepare16_v2()],
+** and [sqlite3_prepare16_v3()]. ^At various
** points during the compilation process, as logic is being created
** to perform various actions, the authorizer callback is invoked to
** see if those actions are allowed. ^The authorizer callback should
@@ -3086,10 +3142,10 @@ SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*);
** ^If [URI filename] interpretation is enabled, and the filename argument
** begins with "file:", then the filename is interpreted as a URI. ^URI
** filename interpretation is enabled if the [SQLITE_OPEN_URI] flag is
-** set in the fourth argument to sqlite3_open_v2(), or if it has
+** set in the third argument to sqlite3_open_v2(), or if it has
** been enabled globally using the [SQLITE_CONFIG_URI] option with the
** [sqlite3_config()] method or by the [SQLITE_USE_URI] compile-time option.
-** As of SQLite version 3.7.7, URI filename interpretation is turned off
+** URI filename interpretation is turned off
** by default, but future releases of SQLite might enable URI filename
** interpretation by default. See "[URI filenames]" for additional
** information.
@@ -3468,6 +3524,29 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
#define SQLITE_LIMIT_TRIGGER_DEPTH 10
#define SQLITE_LIMIT_WORKER_THREADS 11
+/*
+** CAPI3REF: Prepare Flags
+**
+** These constants define various flags that can be passed into
+** "prepFlags" parameter of the [sqlite3_prepare_v3()] and
+** [sqlite3_prepare16_v3()] interfaces.
+**
+** New flags may be added in future releases of SQLite.
+**
+** <dl>
+** [[SQLITE_PREPARE_PERSISTENT]] ^(<dt>SQLITE_PREPARE_PERSISTENT</dt>
+** <dd>The SQLITE_PREPARE_PERSISTENT flag is a hint to the query planner
+** that the prepared statement will be retained for a long time and
+** probably reused many times.)^ ^Without this flag, [sqlite3_prepare_v3()]
+** and [sqlite3_prepare16_v3()] assume that the prepared statement will
+** be used just once or at most a few times and then destroyed using
+** [sqlite3_finalize()] relatively soon. The current implementation acts
+** on this hint by avoiding the use of [lookaside memory] so as not to
+** deplete the limited store of lookaside memory. Future versions of
+** SQLite may act on this hint differently.
+** </dl>
+*/
+#define SQLITE_PREPARE_PERSISTENT 0x01
/*
** CAPI3REF: Compiling An SQL Statement
@@ -3475,17 +3554,29 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
** METHOD: sqlite3
** CONSTRUCTOR: sqlite3_stmt
**
-** To execute an SQL query, it must first be compiled into a byte-code
-** program using one of these routines.
+** To execute an SQL statement, it must first be compiled into a byte-code
+** program using one of these routines. Or, in other words, these routines
+** are constructors for the [prepared statement] object.
+**
+** The preferred routine to use is [sqlite3_prepare_v2()]. The
+** [sqlite3_prepare()] interface is legacy and should be avoided.
+** [sqlite3_prepare_v3()] has an extra "prepFlags" option that is used
+** for special purposes.
+**
+** The use of the UTF-8 interfaces is preferred, as SQLite currently
+** does all parsing using UTF-8. The UTF-16 interfaces are provided
+** as a convenience. The UTF-16 interfaces work by converting the
+** input text into UTF-8, then invoking the corresponding UTF-8 interface.
**
** The first argument, "db", is a [database connection] obtained from a
** prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or
** [sqlite3_open16()]. The database connection must not have been closed.
**
** The second argument, "zSql", is the statement to be compiled, encoded
-** as either UTF-8 or UTF-16. The sqlite3_prepare() and sqlite3_prepare_v2()
-** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2()
-** use UTF-16.
+** as either UTF-8 or UTF-16. The sqlite3_prepare(), sqlite3_prepare_v2(),
+** and sqlite3_prepare_v3()
+** interfaces use UTF-8, and sqlite3_prepare16(), sqlite3_prepare16_v2(),
+** and sqlite3_prepare16_v3() use UTF-16.
**
** ^If the nByte argument is negative, then zSql is read up to the
** first zero terminator. ^If nByte is positive, then it is the
@@ -3512,10 +3603,11 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
** ^On success, the sqlite3_prepare() family of routines return [SQLITE_OK];
** otherwise an [error code] is returned.
**
-** The sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces are
-** recommended for all new programs. The two older interfaces are retained
-** for backwards compatibility, but their use is discouraged.
-** ^In the "v2" interfaces, the prepared statement
+** The sqlite3_prepare_v2(), sqlite3_prepare_v3(), sqlite3_prepare16_v2(),
+** and sqlite3_prepare16_v3() interfaces are recommended for all new programs.
+** The older interfaces (sqlite3_prepare() and sqlite3_prepare16())
+** are retained for backwards compatibility, but their use is discouraged.
+** ^In the "vX" interfaces, the prepared statement
** that is returned (the [sqlite3_stmt] object) contains a copy of the
** original SQL text. This causes the [sqlite3_step()] interface to
** behave differently in three ways:
@@ -3548,6 +3640,12 @@ SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal);
** or [GLOB] operator or if the parameter is compared to an indexed column
** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled.
** </li>
+**
+** <p>^sqlite3_prepare_v3() differs from sqlite3_prepare_v2() only in having
+** the extra prepFlags parameter, which is a bit array consisting of zero or
+** more of the [SQLITE_PREPARE_PERSISTENT|SQLITE_PREPARE_*] flags. ^The
+** sqlite3_prepare_v2() interface works exactly the same as
+** sqlite3_prepare_v3() with a zero prepFlags parameter.
** </ol>
*/
SQLITE_API int sqlite3_prepare(
@@ -3564,6 +3662,14 @@ SQLITE_API int sqlite3_prepare_v2(
sqlite3_stmt **ppStmt, /* OUT: Statement handle */
const char **pzTail /* OUT: Pointer to unused portion of zSql */
);
+SQLITE_API int sqlite3_prepare_v3(
+ sqlite3 *db, /* Database handle */
+ const char *zSql, /* SQL statement, UTF-8 encoded */
+ int nByte, /* Maximum length of zSql in bytes. */
+ unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_ flags */
+ sqlite3_stmt **ppStmt, /* OUT: Statement handle */
+ const char **pzTail /* OUT: Pointer to unused portion of zSql */
+);
SQLITE_API int sqlite3_prepare16(
sqlite3 *db, /* Database handle */
const void *zSql, /* SQL statement, UTF-16 encoded */
@@ -3578,6 +3684,14 @@ SQLITE_API int sqlite3_prepare16_v2(
sqlite3_stmt **ppStmt, /* OUT: Statement handle */
const void **pzTail /* OUT: Pointer to unused portion of zSql */
);
+SQLITE_API int sqlite3_prepare16_v3(
+ sqlite3 *db, /* Database handle */
+ const void *zSql, /* SQL statement, UTF-16 encoded */
+ int nByte, /* Maximum length of zSql in bytes. */
+ unsigned int prepFlags, /* Zero or more SQLITE_PREPARE_ flags */
+ sqlite3_stmt **ppStmt, /* OUT: Statement handle */
+ const void **pzTail /* OUT: Pointer to unused portion of zSql */
+);
/*
** CAPI3REF: Retrieving Statement SQL
@@ -3585,7 +3699,8 @@ SQLITE_API int sqlite3_prepare16_v2(
**
** ^The sqlite3_sql(P) interface returns a pointer to a copy of the UTF-8
** SQL text used to create [prepared statement] P if P was
-** created by either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()].
+** created by [sqlite3_prepare_v2()], [sqlite3_prepare_v3()],
+** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()].
** ^The sqlite3_expanded_sql(P) interface returns a pointer to a UTF-8
** string containing the SQL text of prepared statement P with
** [bound parameters] expanded.
@@ -3704,8 +3819,9 @@ SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*);
** implementation of [application-defined SQL functions] are protected.
** ^The sqlite3_value object returned by
** [sqlite3_column_value()] is unprotected.
-** Unprotected sqlite3_value objects may only be used with
-** [sqlite3_result_value()] and [sqlite3_bind_value()].
+** Unprotected sqlite3_value objects may only be used as arguments
+** to [sqlite3_result_value()], [sqlite3_bind_value()], and
+** [sqlite3_value_dup()].
** The [sqlite3_value_blob | sqlite3_value_type()] family of
** interfaces require protected sqlite3_value objects.
*/
@@ -3811,6 +3927,15 @@ typedef struct sqlite3_context sqlite3_context;
** [sqlite3_blob_open | incremental BLOB I/O] routines.
** ^A negative value for the zeroblob results in a zero-length BLOB.
**
+** ^The sqlite3_bind_pointer(S,I,P,T,D) routine causes the I-th parameter in
+** [prepared statement] S to have an SQL value of NULL, but to also be
+** associated with the pointer P of type T. ^D is either a NULL pointer or
+** a pointer to a destructor function for P. ^SQLite will invoke the
+** destructor D with a single argument of P when it is finished using
+** P. The T parameter should be a static string, preferably a string
+** literal. The sqlite3_bind_pointer() routine is part of the
+** [pointer passing interface] added for SQLite 3.20.0.
+**
** ^If any of the sqlite3_bind_*() routines are called with a NULL pointer
** for the [prepared statement] or with a prepared statement for which
** [sqlite3_step()] has been called more recently than [sqlite3_reset()],
@@ -3844,6 +3969,7 @@ SQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)
SQLITE_API int sqlite3_bind_text64(sqlite3_stmt*, int, const char*, sqlite3_uint64,
void(*)(void*), unsigned char encoding);
SQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*);
+SQLITE_API int sqlite3_bind_pointer(sqlite3_stmt*, int, void*, const char*,void(*)(void*));
SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n);
SQLITE_API int sqlite3_bind_zeroblob64(sqlite3_stmt*, int, sqlite3_uint64);
@@ -3887,8 +4013,8 @@ SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*);
** ^If the value N is out of range or if the N-th parameter is
** nameless, then NULL is returned. ^The returned string is
** always in UTF-8 encoding even if the named parameter was
-** originally specified as UTF-16 in [sqlite3_prepare16()] or
-** [sqlite3_prepare16_v2()].
+** originally specified as UTF-16 in [sqlite3_prepare16()],
+** [sqlite3_prepare16_v2()], or [sqlite3_prepare16_v3()].
**
** See also: [sqlite3_bind_blob|sqlite3_bind()],
** [sqlite3_bind_parameter_count()], and
@@ -3905,7 +4031,8 @@ SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int);
** parameter to [sqlite3_bind_blob|sqlite3_bind()]. ^A zero
** is returned if no matching parameter is found. ^The parameter
** name must be given in UTF-8 even if the original statement
-** was prepared from UTF-16 text using [sqlite3_prepare16_v2()].
+** was prepared from UTF-16 text using [sqlite3_prepare16_v2()] or
+** [sqlite3_prepare16_v3()].
**
** See also: [sqlite3_bind_blob|sqlite3_bind()],
** [sqlite3_bind_parameter_count()], and
@@ -4059,16 +4186,18 @@ SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
** CAPI3REF: Evaluate An SQL Statement
** METHOD: sqlite3_stmt
**
-** After a [prepared statement] has been prepared using either
-** [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] or one of the legacy
+** After a [prepared statement] has been prepared using any of
+** [sqlite3_prepare_v2()], [sqlite3_prepare_v3()], [sqlite3_prepare16_v2()],
+** or [sqlite3_prepare16_v3()] or one of the legacy
** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function
** must be called one or more times to evaluate the statement.
**
** The details of the behavior of the sqlite3_step() interface depend
-** on whether the statement was prepared using the newer "v2" interface
-** [sqlite3_prepare_v2()] and [sqlite3_prepare16_v2()] or the older legacy
-** interface [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the
-** new "v2" interface is recommended for new applications but the legacy
+** on whether the statement was prepared using the newer "vX" interfaces
+** [sqlite3_prepare_v3()], [sqlite3_prepare_v2()], [sqlite3_prepare16_v3()],
+** [sqlite3_prepare16_v2()] or the older legacy
+** interfaces [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the
+** new "vX" interface is recommended for new applications but the legacy
** interface will continue to be supported.
**
** ^In the legacy interface, the return value will be either [SQLITE_BUSY],
@@ -4129,10 +4258,11 @@ SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int);
** specific [error codes] that better describes the error.
** We admit that this is a goofy design. The problem has been fixed
** with the "v2" interface. If you prepare all of your SQL statements
-** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead
+** using [sqlite3_prepare_v3()] or [sqlite3_prepare_v2()]
+** or [sqlite3_prepare16_v2()] or [sqlite3_prepare16_v3()] instead
** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces,
** then the more specific [error codes] are returned directly
-** by sqlite3_step(). The use of the "v2" interface is recommended.
+** by sqlite3_step(). The use of the "vX" interfaces is recommended.
*/
SQLITE_API int sqlite3_step(sqlite3_stmt*);
@@ -4194,6 +4324,28 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
** KEYWORDS: {column access functions}
** METHOD: sqlite3_stmt
**
+** <b>Summary:</b>
+** <blockquote><table border=0 cellpadding=0 cellspacing=0>
+** <tr><td><b>sqlite3_column_blob</b><td>&rarr;<td>BLOB result
+** <tr><td><b>sqlite3_column_double</b><td>&rarr;<td>REAL result
+** <tr><td><b>sqlite3_column_int</b><td>&rarr;<td>32-bit INTEGER result
+** <tr><td><b>sqlite3_column_int64</b><td>&rarr;<td>64-bit INTEGER result
+** <tr><td><b>sqlite3_column_text</b><td>&rarr;<td>UTF-8 TEXT result
+** <tr><td><b>sqlite3_column_text16</b><td>&rarr;<td>UTF-16 TEXT result
+** <tr><td><b>sqlite3_column_value</b><td>&rarr;<td>The result as an
+** [sqlite3_value|unprotected sqlite3_value] object.
+** <tr><td>&nbsp;<td>&nbsp;<td>&nbsp;
+** <tr><td><b>sqlite3_column_bytes</b><td>&rarr;<td>Size of a BLOB
+** or a UTF-8 TEXT result in bytes
+** <tr><td><b>sqlite3_column_bytes16&nbsp;&nbsp;</b>
+** <td>&rarr;&nbsp;&nbsp;<td>Size of UTF-16
+** TEXT in bytes
+** <tr><td><b>sqlite3_column_type</b><td>&rarr;<td>Default
+** datatype of the result
+** </table></blockquote>
+**
+** <b>Details:</b>
+**
** ^These routines return information about a single column of the current
** result row of a query. ^In every case the first argument is a pointer
** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*]
@@ -4215,16 +4367,29 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
** are called from a different thread while any of these routines
** are pending, then the results are undefined.
**
+** The first six interfaces (_blob, _double, _int, _int64, _text, and _text16)
+** each return the value of a result column in a specific data format. If
+** the result column is not initially in the requested format (for example,
+** if the query returns an integer but the sqlite3_column_text() interface
+** is used to extract the value) then an automatic type conversion is performed.
+**
** ^The sqlite3_column_type() routine returns the
** [SQLITE_INTEGER | datatype code] for the initial data type
** of the result column. ^The returned value is one of [SQLITE_INTEGER],
-** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL]. The value
-** returned by sqlite3_column_type() is only meaningful if no type
-** conversions have occurred as described below. After a type conversion,
-** the value returned by sqlite3_column_type() is undefined. Future
+** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].
+** The return value of sqlite3_column_type() can be used to decide which
+** of the first six interface should be used to extract the column value.
+** The value returned by sqlite3_column_type() is only meaningful if no
+** automatic type conversions have occurred for the value in question.
+** After a type conversion, the result of calling sqlite3_column_type()
+** is undefined, though harmless. Future
** versions of SQLite may change the behavior of sqlite3_column_type()
** following a type conversion.
**
+** If the result is a BLOB or a TEXT string, then the sqlite3_column_bytes()
+** or sqlite3_column_bytes16() interfaces can be used to determine the size
+** of that BLOB or string.
+**
** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes()
** routine returns the number of bytes in that BLOB or string.
** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts
@@ -4261,9 +4426,13 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
** [sqlite3_column_value()] is used in any other way, including calls
** to routines like [sqlite3_value_int()], [sqlite3_value_text()],
** or [sqlite3_value_bytes()], the behavior is not threadsafe.
+** Hence, the sqlite3_column_value() interface
+** is normally only useful within the implementation of
+** [application-defined SQL functions] or [virtual tables], not within
+** top-level application code.
**
-** These routines attempt to convert the value where appropriate. ^For
-** example, if the internal representation is FLOAT and a text result
+** The these routines may attempt to convert the datatype of the result.
+** ^For example, if the internal representation is FLOAT and a text result
** is requested, [sqlite3_snprintf()] is used internally to perform the
** conversion automatically. ^(The following table details the conversions
** that are applied:
@@ -4335,7 +4504,7 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
** ^The pointers returned are valid until a type conversion occurs as
** described above, or until [sqlite3_step()] or [sqlite3_reset()] or
** [sqlite3_finalize()] is called. ^The memory space used to hold strings
-** and BLOBs is freed automatically. Do <em>not</em> pass the pointers returned
+** and BLOBs is freed automatically. Do not pass the pointers returned
** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into
** [sqlite3_free()].
**
@@ -4346,15 +4515,15 @@ SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt);
** [SQLITE_NOMEM].)^
*/
SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol);
-SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
-SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol);
SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol);
SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol);
SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol);
SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol);
-SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol);
+SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol);
+SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol);
+SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol);
/*
** CAPI3REF: Destroy A Prepared Statement Object
@@ -4588,21 +4757,40 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
** CAPI3REF: Obtaining SQL Values
** METHOD: sqlite3_value
**
-** The C-language implementation of SQL functions and aggregates uses
-** this set of interface routines to access the parameter values on
-** the function or aggregate.
-**
-** The xFunc (for scalar functions) or xStep (for aggregates) parameters
-** to [sqlite3_create_function()] and [sqlite3_create_function16()]
-** define callbacks that implement the SQL functions and aggregates.
-** The 3rd parameter to these callbacks is an array of pointers to
-** [protected sqlite3_value] objects. There is one [sqlite3_value] object for
-** each parameter to the SQL function. These routines are used to
-** extract values from the [sqlite3_value] objects.
+** <b>Summary:</b>
+** <blockquote><table border=0 cellpadding=0 cellspacing=0>
+** <tr><td><b>sqlite3_value_blob</b><td>&rarr;<td>BLOB value
+** <tr><td><b>sqlite3_value_double</b><td>&rarr;<td>REAL value
+** <tr><td><b>sqlite3_value_int</b><td>&rarr;<td>32-bit INTEGER value
+** <tr><td><b>sqlite3_value_int64</b><td>&rarr;<td>64-bit INTEGER value
+** <tr><td><b>sqlite3_value_pointer</b><td>&rarr;<td>Pointer value
+** <tr><td><b>sqlite3_value_text</b><td>&rarr;<td>UTF-8 TEXT value
+** <tr><td><b>sqlite3_value_text16</b><td>&rarr;<td>UTF-16 TEXT value in
+** the native byteorder
+** <tr><td><b>sqlite3_value_text16be</b><td>&rarr;<td>UTF-16be TEXT value
+** <tr><td><b>sqlite3_value_text16le</b><td>&rarr;<td>UTF-16le TEXT value
+** <tr><td>&nbsp;<td>&nbsp;<td>&nbsp;
+** <tr><td><b>sqlite3_value_bytes</b><td>&rarr;<td>Size of a BLOB
+** or a UTF-8 TEXT in bytes
+** <tr><td><b>sqlite3_value_bytes16&nbsp;&nbsp;</b>
+** <td>&rarr;&nbsp;&nbsp;<td>Size of UTF-16
+** TEXT in bytes
+** <tr><td><b>sqlite3_value_type</b><td>&rarr;<td>Default
+** datatype of the value
+** <tr><td><b>sqlite3_value_numeric_type&nbsp;&nbsp;</b>
+** <td>&rarr;&nbsp;&nbsp;<td>Best numeric datatype of the value
+** </table></blockquote>
+**
+** <b>Details:</b>
+**
+** These routines extract type, size, and content information from
+** [protected sqlite3_value] objects. Protected sqlite3_value objects
+** are used to pass parameter information into implementation of
+** [application-defined SQL functions] and [virtual tables].
**
** These routines work only with [protected sqlite3_value] objects.
** Any attempt to use these routines on an [unprotected sqlite3_value]
-** object results in undefined behavior.
+** is not threadsafe.
**
** ^These routines work just like the corresponding [column access functions]
** except that these routines take a single [protected sqlite3_value] object
@@ -4613,6 +4801,24 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces
** extract UTF-16 strings as big-endian and little-endian respectively.
**
+** ^If [sqlite3_value] object V was initialized
+** using [sqlite3_bind_pointer(S,I,P,X,D)] or [sqlite3_result_pointer(C,P,X,D)]
+** and if X and Y are strings that compare equal according to strcmp(X,Y),
+** then sqlite3_value_pointer(V,Y) will return the pointer P. ^Otherwise,
+** sqlite3_value_pointer(V,Y) returns a NULL. The sqlite3_bind_pointer()
+** routine is part of the [pointer passing interface] added for SQLite 3.20.0.
+**
+** ^(The sqlite3_value_type(V) interface returns the
+** [SQLITE_INTEGER | datatype code] for the initial datatype of the
+** [sqlite3_value] object V. The returned value is one of [SQLITE_INTEGER],
+** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL].)^
+** Other interfaces might change the datatype for an sqlite3_value object.
+** For example, if the datatype is initially SQLITE_INTEGER and
+** sqlite3_value_text(V) is called to extract a text value for that
+** integer, then subsequent calls to sqlite3_value_type(V) might return
+** SQLITE_TEXT. Whether or not a persistent internal datatype conversion
+** occurs is undefined and may change from one release of SQLite to the next.
+**
** ^(The sqlite3_value_numeric_type() interface attempts to apply
** numeric affinity to the value. This means that an attempt is
** made to convert the value to an integer or floating point. If
@@ -4631,15 +4837,16 @@ SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int6
** the SQL function that supplied the [sqlite3_value*] parameters.
*/
SQLITE_API const void *sqlite3_value_blob(sqlite3_value*);
-SQLITE_API int sqlite3_value_bytes(sqlite3_value*);
-SQLITE_API int sqlite3_value_bytes16(sqlite3_value*);
SQLITE_API double sqlite3_value_double(sqlite3_value*);
SQLITE_API int sqlite3_value_int(sqlite3_value*);
SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*);
+SQLITE_API void *sqlite3_value_pointer(sqlite3_value*, const char*);
SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*);
SQLITE_API const void *sqlite3_value_text16(sqlite3_value*);
SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*);
SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*);
+SQLITE_API int sqlite3_value_bytes(sqlite3_value*);
+SQLITE_API int sqlite3_value_bytes16(sqlite3_value*);
SQLITE_API int sqlite3_value_type(sqlite3_value*);
SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
@@ -4652,10 +4859,6 @@ SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*);
** information can be used to pass a limited amount of context from
** one SQL function to another. Use the [sqlite3_result_subtype()]
** routine to set the subtype for the return value of an SQL function.
-**
-** SQLite makes no use of subtype itself. It merely passes the subtype
-** from the result of one [application-defined SQL function] into the
-** input of another.
*/
SQLITE_API unsigned int sqlite3_value_subtype(sqlite3_value*);
@@ -4925,7 +5128,7 @@ typedef void (*sqlite3_destructor_type)(void*);
** when it has finished using that result.
** ^If the 4th parameter to the sqlite3_result_text* interfaces
** or sqlite3_result_blob is the special constant SQLITE_TRANSIENT
-** then SQLite makes a copy of the result into space obtained from
+** then SQLite makes a copy of the result into space obtained
** from [sqlite3_malloc()] before it returns.
**
** ^The sqlite3_result_value() interface sets the result of
@@ -4938,6 +5141,17 @@ typedef void (*sqlite3_destructor_type)(void*);
** [unprotected sqlite3_value] object is required, so either
** kind of [sqlite3_value] object can be used with this interface.
**
+** ^The sqlite3_result_pointer(C,P,T,D) interface sets the result to an
+** SQL NULL value, just like [sqlite3_result_null(C)], except that it
+** also associates the host-language pointer P or type T with that
+** NULL value such that the pointer can be retrieved within an
+** [application-defined SQL function] using [sqlite3_value_pointer()].
+** ^If the D parameter is not NULL, then it is a pointer to a destructor
+** for the P parameter. ^SQLite invokes D with P as its only argument
+** when SQLite is finished with P. The T parameter should be a static
+** string and preferably a string literal. The sqlite3_result_pointer()
+** routine is part of the [pointer passing interface] added for SQLite 3.20.0.
+**
** If these routines are called from within the different thread
** than the one containing the application-defined function that received
** the [sqlite3_context] pointer, the results are undefined.
@@ -4961,6 +5175,7 @@ SQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*
SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*));
SQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*));
SQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*);
+SQLITE_API void sqlite3_result_pointer(sqlite3_context*, void*,const char*,void(*)(void*));
SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n);
SQLITE_API int sqlite3_result_zeroblob64(sqlite3_context*, sqlite3_uint64 n);
@@ -5620,7 +5835,9 @@ SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N);
** ^If the column-name parameter to sqlite3_table_column_metadata() is a
** NULL pointer, then this routine simply checks for the existence of the
** table and returns SQLITE_OK if the table exists and SQLITE_ERROR if it
-** does not.
+** does not. If the table name parameter T in a call to
+** sqlite3_table_column_metadata(X,D,T,C,...) is NULL then the result is
+** undefined behavior.
**
** ^The column is identified by the second, third and fourth parameters to
** this function. ^(The second parameter is either the name of the database
@@ -6030,15 +6247,20 @@ struct sqlite3_index_info {
** an operator that is part of a constraint term in the wHERE clause of
** a query that uses a [virtual table].
*/
-#define SQLITE_INDEX_CONSTRAINT_EQ 2
-#define SQLITE_INDEX_CONSTRAINT_GT 4
-#define SQLITE_INDEX_CONSTRAINT_LE 8
-#define SQLITE_INDEX_CONSTRAINT_LT 16
-#define SQLITE_INDEX_CONSTRAINT_GE 32
-#define SQLITE_INDEX_CONSTRAINT_MATCH 64
-#define SQLITE_INDEX_CONSTRAINT_LIKE 65
-#define SQLITE_INDEX_CONSTRAINT_GLOB 66
-#define SQLITE_INDEX_CONSTRAINT_REGEXP 67
+#define SQLITE_INDEX_CONSTRAINT_EQ 2
+#define SQLITE_INDEX_CONSTRAINT_GT 4
+#define SQLITE_INDEX_CONSTRAINT_LE 8
+#define SQLITE_INDEX_CONSTRAINT_LT 16
+#define SQLITE_INDEX_CONSTRAINT_GE 32
+#define SQLITE_INDEX_CONSTRAINT_MATCH 64
+#define SQLITE_INDEX_CONSTRAINT_LIKE 65
+#define SQLITE_INDEX_CONSTRAINT_GLOB 66
+#define SQLITE_INDEX_CONSTRAINT_REGEXP 67
+#define SQLITE_INDEX_CONSTRAINT_NE 68
+#define SQLITE_INDEX_CONSTRAINT_ISNOT 69
+#define SQLITE_INDEX_CONSTRAINT_ISNOTNULL 70
+#define SQLITE_INDEX_CONSTRAINT_ISNULL 71
+#define SQLITE_INDEX_CONSTRAINT_IS 72
/*
** CAPI3REF: Register A Virtual Table Implementation
@@ -6790,7 +7012,7 @@ SQLITE_API int sqlite3_test_control(int op, ...);
#define SQLITE_TESTCTRL_RESERVE 14
#define SQLITE_TESTCTRL_OPTIMIZATIONS 15
#define SQLITE_TESTCTRL_ISKEYWORD 16
-#define SQLITE_TESTCTRL_SCRATCHMALLOC 17
+#define SQLITE_TESTCTRL_SCRATCHMALLOC 17 /* NOT USED */
#define SQLITE_TESTCTRL_LOCALTIME_FAULT 18
#define SQLITE_TESTCTRL_EXPLAIN_STMT 19 /* NOT USED */
#define SQLITE_TESTCTRL_ONCE_RESET_THRESHOLD 19
@@ -6849,8 +7071,7 @@ SQLITE_API int sqlite3_status64(
** <dd>This parameter is the current amount of memory checked out
** using [sqlite3_malloc()], either directly or indirectly. The
** figure includes calls made to [sqlite3_malloc()] by the application
-** and internal memory usage by the SQLite library. Scratch memory
-** controlled by [SQLITE_CONFIG_SCRATCH] and auxiliary page-cache
+** and internal memory usage by the SQLite library. Auxiliary page-cache
** memory controlled by [SQLITE_CONFIG_PAGECACHE] is not included in
** this parameter. The amount returned is the sum of the allocation
** sizes as reported by the xSize method in [sqlite3_mem_methods].</dd>)^
@@ -6888,29 +7109,14 @@ SQLITE_API int sqlite3_status64(
** *pHighwater parameter to [sqlite3_status()] is of interest.
** The value written into the *pCurrent parameter is undefined.</dd>)^
**
-** [[SQLITE_STATUS_SCRATCH_USED]] ^(<dt>SQLITE_STATUS_SCRATCH_USED</dt>
-** <dd>This parameter returns the number of allocations used out of the
-** [scratch memory allocator] configured using
-** [SQLITE_CONFIG_SCRATCH]. The value returned is in allocations, not
-** in bytes. Since a single thread may only have one scratch allocation
-** outstanding at time, this parameter also reports the number of threads
-** using scratch memory at the same time.</dd>)^
+** [[SQLITE_STATUS_SCRATCH_USED]] <dt>SQLITE_STATUS_SCRATCH_USED</dt>
+** <dd>No longer used.</dd>
**
** [[SQLITE_STATUS_SCRATCH_OVERFLOW]] ^(<dt>SQLITE_STATUS_SCRATCH_OVERFLOW</dt>
-** <dd>This parameter returns the number of bytes of scratch memory
-** allocation which could not be satisfied by the [SQLITE_CONFIG_SCRATCH]
-** buffer and where forced to overflow to [sqlite3_malloc()]. The values
-** returned include overflows because the requested allocation was too
-** larger (that is, because the requested allocation was larger than the
-** "sz" parameter to [SQLITE_CONFIG_SCRATCH]) and because no scratch buffer
-** slots were available.
-** </dd>)^
-**
-** [[SQLITE_STATUS_SCRATCH_SIZE]] ^(<dt>SQLITE_STATUS_SCRATCH_SIZE</dt>
-** <dd>This parameter records the largest memory allocation request
-** handed to [scratch memory allocator]. Only the value returned in the
-** *pHighwater parameter to [sqlite3_status()] is of interest.
-** The value written into the *pCurrent parameter is undefined.</dd>)^
+** <dd>No longer used.</dd>
+**
+** [[SQLITE_STATUS_SCRATCH_SIZE]] <dt>SQLITE_STATUS_SCRATCH_SIZE</dt>
+** <dd>No longer used.</dd>
**
** [[SQLITE_STATUS_PARSER_STACK]] ^(<dt>SQLITE_STATUS_PARSER_STACK</dt>
** <dd>The *pHighwater parameter records the deepest parser stack.
@@ -6923,12 +7129,12 @@ SQLITE_API int sqlite3_status64(
#define SQLITE_STATUS_MEMORY_USED 0
#define SQLITE_STATUS_PAGECACHE_USED 1
#define SQLITE_STATUS_PAGECACHE_OVERFLOW 2
-#define SQLITE_STATUS_SCRATCH_USED 3
-#define SQLITE_STATUS_SCRATCH_OVERFLOW 4
+#define SQLITE_STATUS_SCRATCH_USED 3 /* NOT USED */
+#define SQLITE_STATUS_SCRATCH_OVERFLOW 4 /* NOT USED */
#define SQLITE_STATUS_MALLOC_SIZE 5
#define SQLITE_STATUS_PARSER_STACK 6
#define SQLITE_STATUS_PAGECACHE_SIZE 7
-#define SQLITE_STATUS_SCRATCH_SIZE 8
+#define SQLITE_STATUS_SCRATCH_SIZE 8 /* NOT USED */
#define SQLITE_STATUS_MALLOC_COUNT 9
/*
@@ -7133,6 +7339,24 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
** used as a proxy for the total work done by the prepared statement.
** If the number of virtual machine operations exceeds 2147483647
** then the value returned by this statement status code is undefined.
+**
+** [[SQLITE_STMTSTATUS_REPREPARE]] <dt>SQLITE_STMTSTATUS_REPREPARE</dt>
+** <dd>^This is the number of times that the prepare statement has been
+** automatically regenerated due to schema changes or change to
+** [bound parameters] that might affect the query plan.
+**
+** [[SQLITE_STMTSTATUS_RUN]] <dt>SQLITE_STMTSTATUS_RUN</dt>
+** <dd>^This is the number of times that the prepared statement has
+** been run. A single "run" for the purposes of this counter is one
+** or more calls to [sqlite3_step()] followed by a call to [sqlite3_reset()].
+** The counter is incremented on the first [sqlite3_step()] call of each
+** cycle.
+**
+** [[SQLITE_STMTSTATUS_MEMUSED]] <dt>SQLITE_STMTSTATUS_MEMUSED</dt>
+** <dd>^This is the approximate number of bytes of heap memory
+** used to store the prepared statement. ^This value is not actually
+** a counter, and so the resetFlg parameter to sqlite3_stmt_status()
+** is ignored when the opcode is SQLITE_STMTSTATUS_MEMUSED.
** </dd>
** </dl>
*/
@@ -7140,6 +7364,9 @@ SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg);
#define SQLITE_STMTSTATUS_SORT 2
#define SQLITE_STMTSTATUS_AUTOINDEX 3
#define SQLITE_STMTSTATUS_VM_STEP 4
+#define SQLITE_STMTSTATUS_REPREPARE 5
+#define SQLITE_STMTSTATUS_RUN 6
+#define SQLITE_STMTSTATUS_MEMUSED 99
/*
** CAPI3REF: Custom Page Cache Object
@@ -9004,8 +9231,8 @@ SQLITE_API int sqlite3session_diff(
*/
SQLITE_API int sqlite3session_patchset(
sqlite3_session *pSession, /* Session object */
- int *pnPatchset, /* OUT: Size of buffer at *ppChangeset */
- void **ppPatchset /* OUT: Buffer containing changeset */
+ int *pnPatchset, /* OUT: Size of buffer at *ppPatchset */
+ void **ppPatchset /* OUT: Buffer containing patchset */
);
/*
@@ -9772,12 +9999,12 @@ SQLITE_API int sqlite3changeset_apply(
**
** <table border=1 style="margin-left:8ex;margin-right:8ex">
** <tr><th>Streaming function<th>Non-streaming equivalent</th>
-** <tr><td>sqlite3changeset_apply_str<td>[sqlite3changeset_apply]
-** <tr><td>sqlite3changeset_concat_str<td>[sqlite3changeset_concat]
-** <tr><td>sqlite3changeset_invert_str<td>[sqlite3changeset_invert]
-** <tr><td>sqlite3changeset_start_str<td>[sqlite3changeset_start]
-** <tr><td>sqlite3session_changeset_str<td>[sqlite3session_changeset]
-** <tr><td>sqlite3session_patchset_str<td>[sqlite3session_patchset]
+** <tr><td>sqlite3changeset_apply_strm<td>[sqlite3changeset_apply]
+** <tr><td>sqlite3changeset_concat_strm<td>[sqlite3changeset_concat]
+** <tr><td>sqlite3changeset_invert_strm<td>[sqlite3changeset_invert]
+** <tr><td>sqlite3changeset_start_strm<td>[sqlite3changeset_start]
+** <tr><td>sqlite3session_changeset_strm<td>[sqlite3session_changeset]
+** <tr><td>sqlite3session_patchset_strm<td>[sqlite3session_patchset]
** </table>
**
** Non-streaming functions that accept changesets (or patchsets) as input
diff --git a/devtools/client/canvasdebugger/test/browser_profiling-canvas.js b/devtools/client/canvasdebugger/test/browser_profiling-canvas.js
index ede8a4dbf1..75f8da4f39 100644..100755
--- a/devtools/client/canvasdebugger/test/browser_profiling-canvas.js
+++ b/devtools/client/canvasdebugger/test/browser_profiling-canvas.js
@@ -37,7 +37,7 @@ function* ifTestingSupported() {
for (let i = 0; i < functionCalls.length - 1; i += 2) {
ok(functionCalls[i].timestamp > 0, "The timestamp of the called function is larger than 0.");
ok(functionCalls[i].timestamp < currentTime, "The timestamp has been minus the frame start time.");
- ok(functionCalls[i + 1].timestamp > functionCalls[i].timestamp, "The timestamp of the called function is correct.");
+ ok(functionCalls[i + 1].timestamp >= functionCalls[i].timestamp, "The timestamp of the called function is correct.");
}
yield removeTab(target.tab);
diff --git a/devtools/client/commandline/test/browser_cmd_csscoverage_startstop.js b/devtools/client/commandline/test/browser_cmd_csscoverage_startstop.js
index 2bdb86d866..c481369891 100644
--- a/devtools/client/commandline/test/browser_cmd_csscoverage_startstop.js
+++ b/devtools/client/commandline/test/browser_cmd_csscoverage_startstop.js
@@ -4,6 +4,7 @@
// Tests that the addon commands works as they should
const csscoverage = require("devtools/shared/fronts/csscoverage");
+const {gDevTools} = require("devtools/client/framework/devtools");
const PAGE_1 = TEST_BASE_HTTPS + "browser_cmd_csscoverage_page1.html";
const PAGE_2 = TEST_BASE_HTTPS + "browser_cmd_csscoverage_page2.html";
diff --git a/devtools/client/debugger/test/mochitest/browser_dbg_closure-inspection.js b/devtools/client/debugger/test/mochitest/browser_dbg_closure-inspection.js
index 739d3b2a71..b2fa66872f 100644
--- a/devtools/client/debugger/test/mochitest/browser_dbg_closure-inspection.js
+++ b/devtools/client/debugger/test/mochitest/browser_dbg_closure-inspection.js
@@ -53,13 +53,13 @@ function test() {
.getAttribute("value"), "getName",
"Should have the right property name for 'getName' in person.");
is(personNode.get("getName").target.querySelector(".value")
- .getAttribute("value"), "_pfactory/<.getName()",
+ .getAttribute("value"), "getName()",
"'getName' in person should have the right value.");
is(personNode.get("getFoo").target.querySelector(".name")
.getAttribute("value"), "getFoo",
"Should have the right property name for 'getFoo' in person.");
is(personNode.get("getFoo").target.querySelector(".value")
- .getAttribute("value"), "_pfactory/<.getFoo()",
+ .getAttribute("value"), "getFoo()",
"'getFoo' in person should have the right value.");
// Expand the function nodes. This causes their properties to be
diff --git a/devtools/client/framework/browser-menus.js b/devtools/client/framework/browser-menus.js
index 3d6c4def6e..e62afddac2 100644
--- a/devtools/client/framework/browser-menus.js
+++ b/devtools/client/framework/browser-menus.js
@@ -133,10 +133,11 @@ function attachKeybindingsToBrowser(doc, keys) {
*/
function createToolMenuElements(toolDefinition, doc) {
let id = toolDefinition.id;
+ let appmenuId = "appmenuitem_" + id;
let menuId = "menuitem_" + id;
// Prevent multiple entries for the same tool.
- if (doc.getElementById(menuId)) {
+ if (doc.getElementById(appmenuId) || doc.getElementById(menuId)) {
return;
}
@@ -156,6 +157,13 @@ function createToolMenuElements(toolDefinition, doc) {
});
}
+ let appmenuitem = createMenuItem({
+ doc,
+ id: "appmenuitem_" + id,
+ label: toolDefinition.menuLabel || toolDefinition.label,
+ accesskey: null
+ });
+
let menuitem = createMenuItem({
doc,
id: "menuitem_" + id,
@@ -166,10 +174,12 @@ function createToolMenuElements(toolDefinition, doc) {
// Refer to the key in order to display the key shortcut at menu ends
menuitem.setAttribute("key", key.id);
}
+ appmenuitem.addEventListener("command", oncommand);
menuitem.addEventListener("command", oncommand);
return {
key,
+ appmenuitem,
menuitem
};
}
@@ -186,22 +196,34 @@ function createToolMenuElements(toolDefinition, doc) {
* The tool definition after which the tool menu item is to be added.
*/
function insertToolMenuElements(doc, toolDefinition, prevDef) {
- let { key, menuitem } = createToolMenuElements(toolDefinition, doc);
+ let { key, appmenuitem, menuitem } = createToolMenuElements(toolDefinition, doc);
if (key) {
attachKeybindingsToBrowser(doc, key);
}
- let ref;
+ let amp;
+ if (prevDef) {
+ let appmenuitem = doc.getElementById("appmenuitem_" + prevDef.id);
+ amp = appmenuitem && appmenuitem.nextSibling ? appmenuitem.nextSibling : null;
+ } else {
+ amp = doc.getElementById("appmenu_devtools_separator");
+ }
+
+ if (amp) {
+ amp.parentNode.insertBefore(appmenuitem, amp);
+ }
+
+ let mp;
if (prevDef) {
let menuitem = doc.getElementById("menuitem_" + prevDef.id);
- ref = menuitem && menuitem.nextSibling ? menuitem.nextSibling : null;
+ mp = menuitem && menuitem.nextSibling ? menuitem.nextSibling : null;
} else {
- ref = doc.getElementById("menu_devtools_separator");
+ mp = doc.getElementById("menu_devtools_separator");
}
- if (ref) {
- ref.parentNode.insertBefore(menuitem, ref);
+ if (mp) {
+ mp.parentNode.insertBefore(menuitem, mp);
}
}
exports.insertToolMenuElements = insertToolMenuElements;
@@ -220,6 +242,11 @@ function removeToolFromMenu(toolId, doc) {
key.remove();
}
+ let appmenuitem = doc.getElementById("appmenuitem_" + toolId);
+ if (appmenuitem) {
+ appmenuitem.remove();
+ }
+
let menuitem = doc.getElementById("menuitem_" + toolId);
if (menuitem) {
menuitem.remove();
@@ -235,6 +262,7 @@ exports.removeToolFromMenu = removeToolFromMenu;
*/
function addAllToolsToMenu(doc) {
let fragKeys = doc.createDocumentFragment();
+ let fragAppMenuItems = doc.createDocumentFragment();
let fragMenuItems = doc.createDocumentFragment();
for (let toolDefinition of gDevTools.getToolDefinitionArray()) {
@@ -251,11 +279,17 @@ function addAllToolsToMenu(doc) {
if (elements.key) {
fragKeys.appendChild(elements.key);
}
+ fragAppMenuItems.appendChild(elements.appmenuitem);
fragMenuItems.appendChild(elements.menuitem);
}
attachKeybindingsToBrowser(doc, fragKeys);
+ let amps = doc.getElementById("appmenu_devtools_separator");
+ if (amps) {
+ amps.parentNode.insertBefore(fragAppMenuItems, amps);
+ }
+
let mps = doc.getElementById("menu_devtools_separator");
if (mps) {
mps.parentNode.insertBefore(fragMenuItems, mps);
@@ -270,18 +304,29 @@ function addAllToolsToMenu(doc) {
*/
function addTopLevelItems(doc) {
let keys = doc.createDocumentFragment();
+ let appmenuItems = doc.createDocumentFragment();
let menuItems = doc.createDocumentFragment();
let { menuitems } = require("../menus");
for (let item of menuitems) {
if (item.separator) {
+ let appseparator = doc.createElement("menuseparator");
+ appseparator.id = "app" + item.id;
let separator = doc.createElement("menuseparator");
separator.id = item.id;
+ appmenuItems.appendChild(appseparator);
menuItems.appendChild(separator);
} else {
let { id, l10nKey } = item;
// Create a <menuitem>
+ let appmenuitem = createMenuItem({
+ doc,
+ id: "app" + id,
+ label: l10n(l10nKey + ".label"),
+ accesskey: null,
+ isCheckbox: item.checkbox
+ });
let menuitem = createMenuItem({
doc,
id,
@@ -289,7 +334,9 @@ function addTopLevelItems(doc) {
accesskey: l10n(l10nKey + ".accesskey"),
isCheckbox: item.checkbox
});
+ appmenuitem.addEventListener("command", item.oncommand);
menuitem.addEventListener("command", item.oncommand);
+ appmenuItems.appendChild(appmenuitem);
menuItems.appendChild(menuitem);
if (item.key && l10nKey) {
@@ -330,6 +377,9 @@ function addTopLevelItems(doc) {
for (let node of keys.children) {
nodes.push(node);
}
+ for (let node of appmenuItems.children) {
+ nodes.push(node);
+ }
for (let node of menuItems.children) {
nodes.push(node);
}
@@ -337,15 +387,33 @@ function addTopLevelItems(doc) {
attachKeybindingsToBrowser(doc, keys);
+ // There are hardcoded menu items in the Web Developer menus plus it is a
+ // location of menu items via overlays from extensions so we want to make
+ // sure the last seperator and the "Get More Tools..." items are last.
+ // This will emulate the behavior when devtools menu items were actually
+ // physically present in browser.xul
+
+ // Tools > Web Developer
let menu = doc.getElementById("menuWebDeveloperPopup");
- menu.appendChild(menuItems);
-
- // There is still "Page Source" menuitem hardcoded into browser.xul. Instead
- // of manually inserting everything around it, move it to the expected
- // position.
- let pageSource = doc.getElementById("menu_pageSource");
- let endSeparator = doc.getElementById("devToolsEndSeparator");
- menu.insertBefore(pageSource, endSeparator);
+ // Insert the Devtools Menu Items before everything else
+ menu.insertBefore(menuItems, menu.firstChild);
+ // Move the devtools last seperator and Get More Tools menu items to the bottom
+ let menu_endSeparator = doc.getElementById("menu_devToolsEndSeparator");
+ let menu_getMoreDevtools = doc.getElementById("menu_getMoreDevtools");
+ menu.insertBefore(menu_getMoreDevtools, null);
+ menu.insertBefore(menu_endSeparator, menu_getMoreDevtools);
+
+ // Application Menu > Web Developer (If existant)
+ let appmenu = doc.getElementById("appmenu_webDeveloper_popup");
+ if (appmenu) {
+ // Insert the Devtools Menu Items after the hardcoded idless seperator
+ appmenu.insertBefore(appmenuItems, appmenu.childNodes[2].nextSibling);
+ // Move the devtools last seperator and Get More Tools menu items to the bottom
+ let appmenu_endSeparator = doc.getElementById("appmenu_devToolsEndSeparator");
+ let appmenu_getMoreDevtools = doc.getElementById("appmenu_getMoreDevtools");
+ appmenu.insertBefore(appmenu_getMoreDevtools, null);
+ appmenu.insertBefore(appmenu_endSeparator, appmenu_getMoreDevtools);
+ }
}
/**
diff --git a/devtools/client/framework/devtools-browser.js b/devtools/client/framework/devtools-browser.js
index b9f4d92ba0..f032f82aa4 100644
--- a/devtools/client/framework/devtools-browser.js
+++ b/devtools/client/framework/devtools-browser.js
@@ -8,7 +8,7 @@
* This is the main module loaded in Firefox desktop that handles browser
* windows and coordinates devtools around each window.
*
- * This module is loaded lazily by devtools-clhandler.js, once the first
+ * This module is loaded lazily by devtools-startup.js, once the first
* browser window is ready (i.e. fired browser-delayed-startup-finished event)
**/
@@ -27,8 +27,10 @@ loader.lazyRequireGetter(this, "DebuggerServer", "devtools/server/main", true);
loader.lazyRequireGetter(this, "DebuggerClient", "devtools/shared/client/main", true);
loader.lazyRequireGetter(this, "BrowserMenus", "devtools/client/framework/browser-menus");
-loader.lazyImporter(this, "CustomizableUI", "resource:///modules/CustomizableUI.jsm");
loader.lazyImporter(this, "AppConstants", "resource://gre/modules/AppConstants.jsm");
+#ifdef MC_BASILISK
+loader.lazyImporter(this, "CustomizableUI", "resource:///modules/CustomizableUI.jsm");
+#endif
const {LocalizationHelper} = require("devtools/shared/l10n");
const L10N = new LocalizationHelper("devtools/client/locales/toolbox.properties");
@@ -85,6 +87,9 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
function toggleMenuItem(id, isEnabled) {
let cmd = doc.getElementById(id);
+ if (!cmd) {
+ return;
+ }
if (isEnabled) {
cmd.removeAttribute("disabled");
cmd.removeAttribute("hidden");
@@ -94,22 +99,39 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
}
}
+ let idEls = [];
+
// Enable developer toolbar?
let devToolbarEnabled = Services.prefs.getBoolPref("devtools.toolbar.enabled");
- toggleMenuItem("menu_devToolbar", devToolbarEnabled);
- let focusEl = doc.getElementById("menu_devToolbar");
- if (devToolbarEnabled) {
- focusEl.removeAttribute("disabled");
- } else {
- focusEl.setAttribute("disabled", "true");
- }
+ idEls = [
+ "appmenu_devToolbar",
+ "menu_devToolbar"
+ ];
+ idEls.forEach(function (idEl) {
+ toggleMenuItem(idEl, devToolbarEnabled);
+ let focusEl = doc.getElementById(idEl);
+ if (!focusEl) {
+ return;
+ }
+ if (devToolbarEnabled) {
+ focusEl.removeAttribute("disabled");
+ } else {
+ focusEl.setAttribute("disabled", "true");
+ }
+ });
if (devToolbarEnabled && Services.prefs.getBoolPref("devtools.toolbar.visible")) {
win.DeveloperToolbar.show(false).catch(console.error);
}
// Enable WebIDE?
let webIDEEnabled = Services.prefs.getBoolPref("devtools.webide.enabled");
- toggleMenuItem("menu_webide", webIDEEnabled);
+ idEls = [
+ "appmenu_webide",
+ "menu_webide"
+ ];
+ idEls.forEach(function (idEl) {
+ toggleMenuItem(idEl, webIDEEnabled);
+ });
let showWebIDEWidget = Services.prefs.getBoolPref("devtools.webide.widget.enabled");
if (webIDEEnabled && showWebIDEWidget) {
@@ -122,11 +144,29 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
let chromeEnabled = Services.prefs.getBoolPref("devtools.chrome.enabled");
let devtoolsRemoteEnabled = Services.prefs.getBoolPref("devtools.debugger.remote-enabled");
let remoteEnabled = chromeEnabled && devtoolsRemoteEnabled;
- toggleMenuItem("menu_browserToolbox", remoteEnabled);
- toggleMenuItem("menu_browserContentToolbox", remoteEnabled && win.gMultiProcessBrowser);
+ idEls = [
+ "appmenu_browserToolbox",
+ "menu_browserToolbox"
+ ];
+ idEls.forEach(function (idEl) {
+ toggleMenuItem(idEl, remoteEnabled);
+ });
+ idEls = [
+ "appmenu_browserContentToolbox",
+ "menu_browserContentToolbox"
+ ];
+ idEls.forEach(function (idEl) {
+ toggleMenuItem(idEl, remoteEnabled && win.gMultiProcessBrowser);
+ });
// Enable DevTools connection screen, if the preference allows this.
- toggleMenuItem("menu_devtools_connect", devtoolsRemoteEnabled);
+ idEls = [
+ "appmenu_devtools_connect",
+ "menu_devtools_connect"
+ ];
+ idEls.forEach(function (idEl) {
+ toggleMenuItem(idEl, devtoolsRemoteEnabled);
+ });
},
observe: function (subject, topic, prefName) {
@@ -295,6 +335,7 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
* Install Developer widget
*/
installDeveloperWidget: function () {
+#ifdef MC_BASILISK
let id = "developer-button";
let widget = CustomizableUI.getWidget(id);
if (widget && widget.provider == CustomizableUI.PROVIDER_API) {
@@ -343,6 +384,9 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
doc.getElementById("PanelUI-multiView").appendChild(view);
}
});
+#else
+ return;
+#endif
},
/**
@@ -350,6 +394,7 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
*/
// Used by itself
installWebIDEWidget: function () {
+#ifdef MC_BASILISK
if (this.isWebIDEWidgetInstalled()) {
return;
}
@@ -371,11 +416,18 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
gDevToolsBrowser.openWebIDE();
}
});
+#else
+ return;
+#endif
},
isWebIDEWidgetInstalled: function () {
+#ifdef MC_BASILISK
let widgetWrapper = CustomizableUI.getWidget("webide-button");
return !!(widgetWrapper && widgetWrapper.provider == CustomizableUI.PROVIDER_API);
+#else
+ return false;
+#endif
},
/**
@@ -387,10 +439,14 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
* Uninstall WebIDE widget
*/
uninstallWebIDEWidget: function () {
+#ifdef MC_BASILISK
if (this.isWebIDEWidgetInstalled()) {
CustomizableUI.removeWidgetFromArea("webide-button");
}
CustomizableUI.destroyWidget("webide-button");
+#else
+ return;
+#endif
},
/**
@@ -398,7 +454,11 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
*/
// Used by webide.js
moveWebIDEWidgetInNavbar: function () {
+#ifdef MC_BASILISK
CustomizableUI.addWidgetToArea("webide-button", CustomizableUI.AREA_NAVBAR);
+#else
+ return;
+#endif
},
/**
@@ -591,12 +651,23 @@ var gDevToolsBrowser = exports.gDevToolsBrowser = {
let hasToolbox = gDevToolsBrowser.hasToolboxOpened(win);
- let menu = win.document.getElementById("menu_devToolbox");
- if (hasToolbox) {
- menu.setAttribute("checked", "true");
- } else {
- menu.removeAttribute("checked");
- }
+ let idEls = [];
+
+ idEls = [
+ "appmenu_devToolbox",
+ "menu_devToolbox"
+ ];
+ idEls.forEach(function (idEl) {
+ let menu = win.document.getElementById(idEl);
+ if (!menu) {
+ return;
+ }
+ if (hasToolbox) {
+ menu.setAttribute("checked", "true");
+ } else {
+ menu.removeAttribute("checked");
+ }
+ });
}
},
diff --git a/devtools/client/framework/moz.build b/devtools/client/framework/moz.build
index 7b28b4b9e7..407e21f8bc 100644
--- a/devtools/client/framework/moz.build
+++ b/devtools/client/framework/moz.build
@@ -13,7 +13,6 @@ DevToolsModules(
'about-devtools-toolbox.js',
'attach-thread.js',
'browser-menus.js',
- 'devtools-browser.js',
'devtools.js',
'gDevTools.jsm',
'location-store.js',
@@ -31,3 +30,7 @@ DevToolsModules(
'toolbox.js',
'ToolboxProcess.jsm',
)
+
+FINAL_TARGET_PP_FILES.chrome.devtools.modules.devtools.client.framework += [
+ 'devtools-browser.js',
+]
diff --git a/devtools/client/framework/test/browser_keybindings_01.js b/devtools/client/framework/test/browser_keybindings_01.js
index 4e4effb070..134fb127c8 100644
--- a/devtools/client/framework/test/browser_keybindings_01.js
+++ b/devtools/client/framework/test/browser_keybindings_01.js
@@ -8,6 +8,9 @@
const TEST_URL = "data:text/html,<html><head><title>Test for the " +
"highlighter keybindings</title></head><body>" +
"<h1>Keybindings!</h1></body></html>"
+
+const {gDevToolsBrowser} = require("devtools/client/framework/devtools-browser");
+
function test()
{
waitForExplicitFinish();
diff --git a/devtools/client/framework/test/browser_toolbox_textbox_context_menu.js b/devtools/client/framework/test/browser_toolbox_textbox_context_menu.js
index 2e5f3210e4..e2e9612553 100644
--- a/devtools/client/framework/test/browser_toolbox_textbox_context_menu.js
+++ b/devtools/client/framework/test/browser_toolbox_textbox_context_menu.js
@@ -36,15 +36,12 @@ add_task(function* () {
is(cmdDelete.getAttribute("disabled"), "true", "cmdDelete is disabled");
is(cmdSelectAll.getAttribute("disabled"), "true", "cmdSelectAll is disabled");
- // Cut/Copy items are enabled in context menu even if there
- // is no selection. See also Bug 1303033
+ // Cut/Copy/Paste items are enabled in context menu even if there
+ // is no selection. See also Bug 1303033, and 1317322
is(cmdCut.getAttribute("disabled"), "", "cmdCut is enabled");
is(cmdCopy.getAttribute("disabled"), "", "cmdCopy is enabled");
- if (isWindows()) {
- // emptyClipboard only works on Windows (666254), assert paste only for this OS.
- is(cmdPaste.getAttribute("disabled"), "true", "cmdPaste is disabled");
- }
+ is(cmdPaste.getAttribute("disabled"), "", "cmdPaste is enabled");
yield cleanup(toolbox);
});
diff --git a/devtools/client/inspector/computed/test/browser_computed_search-filter_context-menu.js b/devtools/client/inspector/computed/test/browser_computed_search-filter_context-menu.js
index b5dbe44754..b04a247f5b 100644
--- a/devtools/client/inspector/computed/test/browser_computed_search-filter_context-menu.js
+++ b/devtools/client/inspector/computed/test/browser_computed_search-filter_context-menu.js
@@ -45,15 +45,12 @@ add_task(function* () {
is(cmdDelete.getAttribute("disabled"), "true", "cmdDelete is disabled");
is(cmdSelectAll.getAttribute("disabled"), "true", "cmdSelectAll is disabled");
- // Cut/Copy items are enabled in context menu even if there
- // is no selection. See also Bug 1303033
+ // Cut/Copy/Paste items are enabled in context menu even if there is no
+ // selection. See also Bug 1303033, and 1317322
is(cmdCut.getAttribute("disabled"), "", "cmdCut is enabled");
is(cmdCopy.getAttribute("disabled"), "", "cmdCopy is enabled");
- if (isWindows()) {
- // emptyClipboard only works on Windows (666254), assert paste only for this OS.
- is(cmdPaste.getAttribute("disabled"), "true", "cmdPaste is disabled");
- }
+ is(cmdPaste.getAttribute("disabled"), "", "cmdPaste is enabled");
info("Closing context menu");
let onContextMenuHidden = once(searchContextMenu, "popuphidden");
diff --git a/devtools/client/inspector/markup/test/browser_markup_events3.js b/devtools/client/inspector/markup/test/browser_markup_events3.js
index a9dc2a4995..a38e9a011a 100644
--- a/devtools/client/inspector/markup/test/browser_markup_events3.js
+++ b/devtools/client/inspector/markup/test/browser_markup_events3.js
@@ -115,7 +115,7 @@ const TEST_DATA = [ // eslint-disable-line
expected: [
{
type: "click",
- filename: TEST_URL + ":1",
+ filename: TEST_URL + ":0",
attributes: [
"Bubbling",
"DOM2"
@@ -129,7 +129,7 @@ const TEST_DATA = [ // eslint-disable-line
expected: [
{
type: "click",
- filename: TEST_URL + ":1",
+ filename: TEST_URL + ":0",
attributes: [
"Bubbling",
"DOM2"
diff --git a/devtools/client/inspector/rules/test/browser_rules_search-filter_context-menu.js b/devtools/client/inspector/rules/test/browser_rules_search-filter_context-menu.js
index 349f1b9b36..d66df91ab1 100644
--- a/devtools/client/inspector/rules/test/browser_rules_search-filter_context-menu.js
+++ b/devtools/client/inspector/rules/test/browser_rules_search-filter_context-menu.js
@@ -44,15 +44,12 @@ add_task(function* () {
is(cmdDelete.getAttribute("disabled"), "true", "cmdDelete is disabled");
is(cmdSelectAll.getAttribute("disabled"), "true", "cmdSelectAll is disabled");
- // Cut/Copy items are enabled in context menu even if there
- // is no selection. See also Bug 1303033
+ // Cut/Copy/Paste items are enabled in context menu even if there is no
+ // selection. See also Bug 1303033, and 1317322
is(cmdCut.getAttribute("disabled"), "", "cmdCut is enabled");
is(cmdCopy.getAttribute("disabled"), "", "cmdCopy is enabled");
- if (isWindows()) {
- // emptyClipboard only works on Windows (666254), assert paste only for this OS.
- is(cmdPaste.getAttribute("disabled"), "true", "cmdPaste is disabled");
- }
+ is(cmdPaste.getAttribute("disabled"), "", "cmdPaste is enabled");
info("Closing context menu");
let onContextMenuHidden = once(searchContextMenu, "popuphidden");
diff --git a/devtools/client/inspector/test/browser_inspector_search-filter_context-menu.js b/devtools/client/inspector/test/browser_inspector_search-filter_context-menu.js
index 137456468c..7bd4b5e6fc 100644
--- a/devtools/client/inspector/test/browser_inspector_search-filter_context-menu.js
+++ b/devtools/client/inspector/test/browser_inspector_search-filter_context-menu.js
@@ -43,14 +43,11 @@ add_task(function* () {
is(cmdSelectAll.getAttribute("disabled"), "true", "cmdSelectAll is disabled");
// Cut/Copy items are enabled in context menu even if there
- // is no selection. See also Bug 1303033
+ // is no selection. See also Bug 1303033, and 1317322
is(cmdCut.getAttribute("disabled"), "", "cmdCut is enabled");
is(cmdCopy.getAttribute("disabled"), "", "cmdCopy is enabled");
- if (isWindows()) {
- // emptyClipboard only works on Windows (666254), assert paste only for this OS.
- is(cmdPaste.getAttribute("disabled"), "true", "cmdPaste is disabled");
- }
+ is(cmdPaste.getAttribute("disabled"), "", "cmdPaste is enabled");
info("Closing context menu");
let onContextMenuHidden = once(searchContextMenu, "popuphidden");
diff --git a/devtools/client/menus.js b/devtools/client/menus.js
index 7e36839da7..1d2168967c 100644
--- a/devtools/client/menus.js
+++ b/devtools/client/menus.js
@@ -183,9 +183,9 @@ exports.menuitems = [
}
},
{ separator: true,
- id: "devToolsEndSeparator"
+ id: "menu_devToolsEndSeparator"
},
- { id: "getMoreDevtools",
+ { id: "menu_getMoreDevtools",
l10nKey: "getMoreDevtoolsCmd",
oncommand(event) {
let window = event.target.ownerDocument.defaultView;
diff --git a/devtools/client/netmonitor/request-list-context-menu.js b/devtools/client/netmonitor/request-list-context-menu.js
index 331a7bde37..bacb7dc333 100644
--- a/devtools/client/netmonitor/request-list-context-menu.js
+++ b/devtools/client/netmonitor/request-list-context-menu.js
@@ -186,7 +186,6 @@ RequestListContextMenu.prototype = {
* Opens selected item in a new tab.
*/
openRequestInTab() {
- let win = Services.wm.getMostRecentWindow(gDevTools.chromeWindowType);
openRequestInTab(this.selectedItem.attachment);
},
diff --git a/devtools/client/scratchpad/test/head.js b/devtools/client/scratchpad/test/head.js
index 15619a1696..955c037d73 100644
--- a/devtools/client/scratchpad/test/head.js
+++ b/devtools/client/scratchpad/test/head.js
@@ -9,6 +9,7 @@ const {FileUtils} = Cu.import("resource://gre/modules/FileUtils.jsm", {});
const {console} = Cu.import("resource://gre/modules/Console.jsm", {});
const {ScratchpadManager} = Cu.import("resource://devtools/client/scratchpad/scratchpad-manager.jsm", {});
const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {});
+const {gDevTools} = require("devtools/client/framework/devtools");
const Services = require("Services");
const DevToolsUtils = require("devtools/shared/DevToolsUtils");
const flags = require("devtools/shared/flags");
diff --git a/devtools/client/shared/developer-toolbar.js b/devtools/client/shared/developer-toolbar.js
index 2528591a68..d844024187 100644
--- a/devtools/client/shared/developer-toolbar.js
+++ b/devtools/client/shared/developer-toolbar.js
@@ -449,7 +449,15 @@ DeveloperToolbar.prototype.show = function (focus) {
[ this.tooltipPanel, this.outputPanel ] = panels;
- this._doc.getElementById("menu_devToolbar").setAttribute("checked", "true");
+ let checkboxValue = "true";
+ let appmenuEl = this._doc.getElementById("appmenu_devToolbar");
+ let menuEl = this._doc.getElementById("menu_devToolbar");
+ if (appmenuEl) {
+ appmenuEl.setAttribute("checked", checkboxValue);
+ }
+ if (menuEl) {
+ menuEl.setAttribute("checked", checkboxValue);
+ }
this.target = TargetFactory.forTab(this._chromeWindow.gBrowser.selectedTab);
const options = {
@@ -569,7 +577,15 @@ DeveloperToolbar.prototype.hide = function () {
Services.prefs.setBoolPref("devtools.toolbar.visible", false);
- this._doc.getElementById("menu_devToolbar").setAttribute("checked", "false");
+ let checkboxValue = "false";
+ let appmenuEl = this._doc.getElementById("appmenu_devToolbar");
+ let menuEl = this._doc.getElementById("menu_devToolbar");
+ if (appmenuEl) {
+ appmenuEl.setAttribute("checked", checkboxValue);
+ }
+ if (menuEl) {
+ menuEl.setAttribute("checked", checkboxValue);
+ }
this.destroy();
this._telemetry.toolClosed("developertoolbar");
diff --git a/devtools/client/shared/widgets/TableWidget.js b/devtools/client/shared/widgets/TableWidget.js
index a0f0dfc110..57d2914d5a 100644
--- a/devtools/client/shared/widgets/TableWidget.js
+++ b/devtools/client/shared/widgets/TableWidget.js
@@ -463,7 +463,14 @@ TableWidget.prototype = {
return;
}
- let selectedCell = this.tbody.querySelector(".theme-selected");
+ // We need to get the first *visible* selected cell. Some columns are hidden
+ // e.g. because they contain a unique compound key for cookies that is never
+ // displayed in the UI. To do this we get all selected cells and filter out
+ // any that are hidden.
+ let selectedCells = [...this.tbody.querySelectorAll(".theme-selected")]
+ .filter(cell => cell.clientWidth > 0);
+ // Select the first visible selected cell.
+ let selectedCell = selectedCells[0];
if (!selectedCell) {
return;
}
diff --git a/devtools/client/storage/ui.js b/devtools/client/storage/ui.js
index 7745c8da96..5bd29d297b 100644
--- a/devtools/client/storage/ui.js
+++ b/devtools/client/storage/ui.js
@@ -482,24 +482,27 @@ StorageUI.prototype = {
* @param {object} See onUpdate docs
*/
handleChangedItems: function (changed) {
- if (this.tree.selectedItem) {
- let [type, host, db, objectStore] = this.tree.selectedItem;
- if (!changed[type] || !changed[type][host] ||
- changed[type][host].length == 0) {
- return;
- }
- try {
- let toUpdate = [];
- for (let name of changed[type][host]) {
- let names = JSON.parse(name);
- if (names[0] == db && names[1] == objectStore && names[2]) {
- toUpdate.push(name);
- }
+ let selectedItem = this.tree.selectedItem;
+ if (!selectedItem) {
+ return;
+ }
+
+ let [type, host, db, objectStore] = selectedItem;
+ if (!changed[type] || !changed[type][host] ||
+ changed[type][host].length == 0) {
+ return;
+ }
+ try {
+ let toUpdate = [];
+ for (let name of changed[type][host]) {
+ let names = JSON.parse(name);
+ if (names[0] == db && names[1] == objectStore && names[2]) {
+ toUpdate.push(name);
}
- this.fetchStorageObjects(type, host, toUpdate, REASON.UPDATE);
- } catch (ex) {
- this.fetchStorageObjects(type, host, changed[type][host], REASON.UPDATE);
}
+ this.fetchStorageObjects(type, host, toUpdate, REASON.UPDATE);
+ } catch (ex) {
+ this.fetchStorageObjects(type, host, changed[type][host], REASON.UPDATE);
}
},
@@ -830,6 +833,7 @@ StorageUI.prototype = {
if (!item) {
return;
}
+
this.table.clear();
this.hideSidebar();
this.searchBox.value = "";
@@ -1136,11 +1140,13 @@ StorageUI.prototype = {
* Handles adding an item from the storage
*/
onAddItem: function () {
- if (!this.tree.selectedItem) {
+ let selectedItem = this.tree.selectedItem;
+ if (!selectedItem) {
return;
}
+
let front = this.getCurrentFront();
- let [, host] = this.tree.selectedItem;
+ let [, host] = selectedItem;
// Prepare to scroll into view.
this.table.scrollIntoViewOnUpdate = true;
diff --git a/devtools/client/webconsole/new-console-output/test/mochitest/head.js b/devtools/client/webconsole/new-console-output/test/mochitest/head.js
index b71eaec4f1..049f3d1ceb 100644
--- a/devtools/client/webconsole/new-console-output/test/mochitest/head.js
+++ b/devtools/client/webconsole/new-console-output/test/mochitest/head.js
@@ -14,6 +14,7 @@ Services.scriptloader.loadSubScript(
var {Utils: WebConsoleUtils} = require("devtools/client/webconsole/utils");
const WEBCONSOLE_STRINGS_URI = "devtools/client/locales/webconsole.properties";
+var {HUDService} = require("devtools/client/webconsole/hudservice");
var WCUL10n = new WebConsoleUtils.L10n(WEBCONSOLE_STRINGS_URI);
Services.prefs.setBoolPref("devtools.webconsole.new-frontend-enabled", true);
diff --git a/devtools/client/webconsole/test/browser_webconsole_closure_inspection.js b/devtools/client/webconsole/test/browser_webconsole_closure_inspection.js
index 6a29d61aab..769fc0fe5e 100644
--- a/devtools/client/webconsole/test/browser_webconsole_closure_inspection.js
+++ b/devtools/client/webconsole/test/browser_webconsole_closure_inspection.js
@@ -58,7 +58,7 @@ function consoleOpened(hud) {
waitForMessages({
webconsole: gWebConsole,
messages: [{
- text: "function _pfactory/<.getName()",
+ text: "getName()",
category: CATEGORY_OUTPUT,
objects: true,
}],
diff --git a/devtools/client/webconsole/test/browser_webconsole_jsterm.js b/devtools/client/webconsole/test/browser_webconsole_jsterm.js
index 221c96fa65..ae5dc71fe7 100644
--- a/devtools/client/webconsole/test/browser_webconsole_jsterm.js
+++ b/devtools/client/webconsole/test/browser_webconsole_jsterm.js
@@ -175,7 +175,6 @@ function* testJSTerm(hud) {
"JSMSG_BAD_RADIX": "(42).toString(0);",
"JSMSG_BAD_ARRAY_LENGTH": "([]).length = -1",
"JSMSG_NEGATIVE_REPETITION_COUNT": "'abc'.repeat(-1);",
- "JSMSG_BAD_FORMAL": "var f = Function('x y', 'return x + y;');",
"JSMSG_PRECISION_RANGE": "77.1234.toExponential(-1);",
};
diff --git a/devtools/client/webconsole/test/browser_webconsole_output_02.js b/devtools/client/webconsole/test/browser_webconsole_output_02.js
index 8018669a9f..4c61cf0416 100644
--- a/devtools/client/webconsole/test/browser_webconsole_output_02.js
+++ b/devtools/client/webconsole/test/browser_webconsole_output_02.js
@@ -36,10 +36,10 @@ var inputTests = [
suppressClick: true
},
- // 3 - anonymous function, but spidermonkey gives us an inferred name.
+ // 3 - anonymous function, but gets name.
{
input: "testobj1.testfn2",
- output: "function testobj1.testfn2()",
+ output: "function testfn2()",
printOutput: "function () { return 42; }",
suppressClick: true
},
diff --git a/devtools/client/webconsole/webconsole.xul b/devtools/client/webconsole/webconsole.xul
index cd3e44d820..1310fb57db 100644
--- a/devtools/client/webconsole/webconsole.xul
+++ b/devtools/client/webconsole/webconsole.xul
@@ -7,6 +7,8 @@
%webConsoleDTD;
]>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
+<?xml-stylesheet href="resource://devtools/client/themes/common.css"
+ type="text/css"?>
<?xml-stylesheet href="chrome://devtools/skin/widgets.css"
type="text/css"?>
<?xml-stylesheet href="chrome://devtools/skin/webconsole.css"
diff --git a/devtools/server/actors/errordocs.js b/devtools/server/actors/errordocs.js
index 27f687dc77..7c4b3acff7 100644
--- a/devtools/server/actors/errordocs.js
+++ b/devtools/server/actors/errordocs.js
@@ -18,7 +18,6 @@ const ErrorDocs = {
JSMSG_RESULTING_STRING_TOO_LARGE: "Resulting_string_too_large",
JSMSG_BAD_RADIX: "Bad_radix",
JSMSG_PRECISION_RANGE: "Precision_range",
- JSMSG_BAD_FORMAL: "Malformed_formal_parameter",
JSMSG_STMT_AFTER_RETURN: "Stmt_after_return",
JSMSG_NOT_A_CODEPOINT: "Not_a_codepoint",
JSMSG_BAD_SORT_ARG: "Array_sort_argument",
diff --git a/devtools/server/actors/object.js b/devtools/server/actors/object.js
index 1f417b9515..06e95a5f0e 100644
--- a/devtools/server/actors/object.js
+++ b/devtools/server/actors/object.js
@@ -1158,11 +1158,6 @@ DebuggerServer.ObjectActorPreviewers = {
}],
RegExp: [function ({obj, hooks}, grip) {
- // Avoid having any special preview for the RegExp.prototype itself.
- if (!obj.proto || obj.proto.class != "RegExp") {
- return false;
- }
-
let str = RegExp.prototype.toString.call(obj.unsafeDereference());
grip.displayString = hooks.createValueGrip(str);
return true;
diff --git a/devtools/server/actors/webconsole.js b/devtools/server/actors/webconsole.js
index 9712ff32d8..a1eba84ed3 100644
--- a/devtools/server/actors/webconsole.js
+++ b/devtools/server/actors/webconsole.js
@@ -778,8 +778,8 @@ WebConsoleActor.prototype =
}
// See `window` definition. It isn't always a DOM Window.
- let requestStartTime = this.window && this.window.performance ?
- this.window.performance.timing.requestStart : 0;
+ let winStartTime = this.window && this.window.performance ?
+ this.window.performance.timing.navigationStart : 0;
let cache = this.consoleAPIListener
.getCachedMessages(!this.parentActor.isRootActor);
@@ -787,7 +787,7 @@ WebConsoleActor.prototype =
// Filter out messages that came from a ServiceWorker but happened
// before the page was requested.
if (aMessage.innerID === "ServiceWorker" &&
- requestStartTime > aMessage.timeStamp) {
+ winStartTime > aMessage.timeStamp) {
return;
}
diff --git a/devtools/server/event-parsers.js b/devtools/server/event-parsers.js
index a813d8e9b7..6245af190f 100644
--- a/devtools/server/event-parsers.js
+++ b/devtools/server/event-parsers.js
@@ -91,44 +91,58 @@ var parsers = [
return jQueryLiveGetListeners(node, false);
},
normalizeHandler: function (handlerDO) {
- let paths = [
- [".event.proxy/", ".event.proxy/", "*"],
- [".proxy/", "*"]
- ];
-
- let name = handlerDO.displayName;
+ function isFunctionInProxy(funcDO) {
+ // If the anonymous function is inside the |proxy| function and the
+ // function only has guessed atom, the guessed atom should starts with
+ // "proxy/".
+ let displayName = funcDO.displayName;
+ if (displayName && displayName.startsWith("proxy/")) {
+ return true;
+ }
- if (!name) {
- return handlerDO;
+ // If the anonymous function is inside the |proxy| function and the
+ // function gets name at compile time by SetFunctionName, its guessed
+ // atom doesn't contain "proxy/". In that case, check if the caller is
+ // "proxy" function, as a fallback.
+ let calleeDO = funcDO.environment.callee;
+ if (!calleeDO) {
+ return false;
+ }
+ let calleeName = calleeDO.displayName;
+ return calleeName == "proxy";
}
- for (let path of paths) {
- if (name.includes(path[0])) {
- path.splice(0, 1);
-
- for (let point of path) {
- let names = handlerDO.environment.names();
+ function getFirstFunctionVariable(funcDO) {
+ // The handler function inside the |proxy| function should point the
+ // unwrapped function via environment variable.
+ let names = funcDO.environment.names();
+ for (let varName of names) {
+ let varDO = handlerDO.environment.getVariable(varName);
+ if (!varDO) {
+ continue;
+ }
+ if (varDO.class == "Function") {
+ return varDO;
+ }
+ }
+ return null;
+ }
- for (let varName of names) {
- let temp = handlerDO.environment.getVariable(varName);
- if (!temp) {
- continue;
- }
+ if (!isFunctionInProxy(handlerDO)) {
+ return handlerDO;
+ }
- let displayName = temp.displayName;
- if (!displayName) {
- continue;
- }
+ const MAX_NESTED_HANDLER_COUNT = 2;
+ for (let i = 0; i < MAX_NESTED_HANDLER_COUNT; i++) {
+ let funcDO = getFirstFunctionVariable(handlerDO);
+ if (!funcDO)
+ return handlerDO;
- if (temp.class === "Function" &&
- (displayName.includes(point) || point === "*")) {
- handlerDO = temp;
- break;
- }
- }
- }
- break;
+ handlerDO = funcDO;
+ if (isFunctionInProxy(handlerDO)) {
+ continue;
}
+ break;
}
return handlerDO;
diff --git a/devtools/server/tests/mochitest/test_memory_allocations_05.html b/devtools/server/tests/mochitest/test_memory_allocations_05.html
index 0eeb7bd165..4b6b4f0eaf 100644..100755
--- a/devtools/server/tests/mochitest/test_memory_allocations_05.html
+++ b/devtools/server/tests/mochitest/test_memory_allocations_05.html
@@ -70,8 +70,9 @@ window.onload = function() {
if (lastTimestamp) {
var delta = timestamp - lastTimestamp;
info("delta since last timestamp", delta);
- ok(delta >= 1 /* ms */,
- "The timestamp should be about 1 ms after the last timestamp.");
+ // If we're unlucky, we might have rounded down to 0ms
+ // ok(delta >= 1 /* ms */,
+ // "The timestamp should be about 1 ms after the last timestamp.");
}
lastTimestamp = timestamp;
diff --git a/devtools/server/tests/unit/test_functiongrips-01.js b/devtools/server/tests/unit/test_functiongrips-01.js
index c41a7cad5b..81b1b77670 100644
--- a/devtools/server/tests/unit/test_functiongrips-01.js
+++ b/devtools/server/tests/unit/test_functiongrips-01.js
@@ -52,7 +52,7 @@ function test_inferred_name_function() {
do_check_eq(args[0].class, "Function");
// No name for an anonymous function, but it should have an inferred name.
do_check_eq(args[0].name, undefined);
- do_check_eq(args[0].displayName, "o.m");
+ do_check_eq(args[0].displayName, "m");
let objClient = gThreadClient.pauseGrip(args[0]);
objClient.getParameterNames(function (aResponse) {
diff --git a/devtools/shared/webconsole/test/test_page_errors.html b/devtools/shared/webconsole/test/test_page_errors.html
index 19e5ba4b47..78138856ec 100644
--- a/devtools/shared/webconsole/test/test_page_errors.html
+++ b/devtools/shared/webconsole/test/test_page_errors.html
@@ -102,16 +102,6 @@ function doPageErrors()
warning: false,
exception: true,
},
- "var f = Function('x y', 'return x + y;');": {
- errorMessage: /malformed formal/,
- errorMessageName: "JSMSG_BAD_FORMAL",
- sourceName: /test_page_errors/,
- category: "chrome javascript",
- timeStamp: /^\d+$/,
- error: false,
- warning: false,
- exception: true,
- },
"function a() { return; 1 + 1; }": {
errorMessage: /unreachable code/,
errorMessageName: "JSMSG_STMT_AFTER_RETURN",
diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md
new file mode 100644
index 0000000000..7acdedb4f0
--- /dev/null
+++ b/docs/CONTRIBUTING.md
@@ -0,0 +1,86 @@
+# Code contribution guidelines
+
+To make sure code changes remain easy to organize, find and troubleshoot, please use the following guidelines when contributing code to the Pale Moon project (and UXP). These guidelines may, for some of you, sound tedious or more work than you'd prefer to put in, but keep in mind that a single paragraph of explanation with a code commit can save hours of work later on, and code comments can save your hide when trying to debug or improve code.
+
+## General guideline for issues
+
+Issues are the main drivers behind getting code changes accepted into our source tree. Issues should be opened, and properly labeled, for any of the following:
+- Code bugs (broken functionality)
+- Regressions (functionality that worked before but has either stopped working, is working in a different way than intended, or e.g. has become poorly performing)
+- Enhancements (new code/features)
+- Improvements (better/improved way of existing functionality)
+- General development direction goals (META issues)
+
+Labels should mostly be assigned to issues, not pull requests (PRs).
+
+Issues opened should, where possible, only address one thing at a time. Never roll multiple bugs or enhancements that aren't directly required to be done at the same time into a single issue.
+
+Issues should include:
+### For bugs
+- Description of the bug
+- Affected versions/features
+- Steps to reproduce the bug
+- Expected result when performing the steps
+- Actual result when performing the steps
+### For regressions
+- Description of the regression
+- Affected versions/features
+- What the previous behavior was
+- What the current (incorrect) behavior is
+### For enhancements and improvements
+- Description of the enhancement
+- Background: why is this needed or desired?
+- Impact of the enhancement/improvement
+### META issues
+- A general description, including **what** and **why** should be tackled
+- Links from the individual components of the META goal (by referencing from the actual individual issues)
+For META issues it is important that discussion about specific implementation parts are in the individual component issues and not in the META issue, so it can keep a quick overview of linked components that need to be tackled.
+
+
+## General guideline for submitting pull requests
+
+Most of our code changes will likely be submitted by collaborators from our community. This will be ported from other projects (e.g. Mozilla-based code) or new implementations, or a mix. The standard way of getting your code into Pale Moon or UXP is by way of creating a pull request against the master branch (trunk).
+
+A good pull request will:
+- **Have an issue associated with it!** Even though GitHub offers very similar tools for PRs as it does for issues, any reasoning behind code commits in a PR have to be explained in an accompanying issue.
+- Describe in detail **what** the code change attempts to achieve, and **how** it achieves this. If you have references to external sources, e.g. if your code is based on specific code from Mozilla, then including them is of course excellent, but it's important to provide a clear description alongside it.
+- Not just be a list of links or references. See the previous point. References are OK but do not provide a reason by themselves for a code change. Especially with porting code across from other projects, it is important to keep PRs and explanations in our tree and not dependent on third-party sources.
+- Verify that the code is exactly catered to our tree and in line with our feature set(s) and direction. Just 'porting something across because it is in other browsers" is not a reason or justification by itself. If needed, discuss the **why** for a code change in the attached issue before putting work into a PR that may otherwise be rejected.
+- Only address one bug, issue or enhancement. It is extremely important to keep individual code commits separate so that in case of back-outs, this can be done in a controlled and isolated manner.
+- If there are dependencies on other code being checked in, it is important that the PR lists exactly which other PRs need to be checked in first before the one in question can be merged. If at all possible, keep PR interdependency to a minimum.
+
+The odd small minor one-liner pull request may not need an issue dedicated to it, but when it comes to modifying and refactoring chunks of many files, then yes it would be not only nice, but required, to have a chance to have discussion about it before it is accepted into the tree.
+
+PRs that encompass major code changes or touch many files or functions should preferably get a review. Reviewing can be volunteered or requested.
+
+## Code Style
+
+Because our software encompasses many components of which a good portion is third-party, code style can vary significantly throughout our code base. It's therefore important to keep code as consistent as possible.
+
+Important when editing/adding code:
+
+1. Stick to the style of surrounding code. If you're editing code in a module that deviates from our generally-used code style, don't mix in generally-used code style with the deviating code style. E.g. if a source file uses tabs everywhere, and you edit this code, also use tabs. If you feel code style should be rewritten to improve legibility, preferably create a separate issue to change it and do not roll it in with functional code changes!
+2. Use the following guideline where there's no clear deviating style in use:
+ - Put opening function/scope braces at the end of the line.
+ - Align closing braces with the indentation of the first character of the function/scope
+ - Use a line cap of 80 characters. Put continuations on the next line if it overflows.
+ - Use spaces for indentation, and indent scopes 2 spaces.
+ Example:
+ ```C++
+ nsSVGFilterFrame*
+ nsSVGFilterFrame::GetReferencedFilterIfNotInUse() {
+ nsSVGFilterFrame* referenced = GetReferencedFilter();
+ if (!referenced)
+ return nullptr;
+
+ if (referenced->mLoopFlag) {
+ // XXXjwatt: we should really send an error to the JavaScript Console here:
+ NS_WARNING("Filter reference loop detected while inheriting attribute!");
+ return nullptr;
+ }
+
+ return referenced;
+ }
+ ```
+3. Comment your code where prudent! Documenting what you're doing, especially in a complex piece of code, is very important to keep it easy to debug.
+4. Try not to write "as compact as possible" source code. Many languages have facilities to write very compact source code by gluing a lot of statements together on single lines, but you should avoid this to keep it readable. Other people than yourself will be looking at and trying to understand your code, and it's important to keep proper paragraphing, whitespace and above all logical names for variables and functions.
diff --git a/docshell/base/nsAboutRedirector.cpp b/docshell/base/nsAboutRedirector.cpp
index e7d3628645..e56447296e 100644
--- a/docshell/base/nsAboutRedirector.cpp
+++ b/docshell/base/nsAboutRedirector.cpp
@@ -42,17 +42,14 @@ static RedirEntry kRedirMap[] = {
{
"buildconfig", "chrome://global/content/buildconfig.html",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
- nsIAboutModule::MAKE_LINKABLE
+ nsIAboutModule::MAKE_LINKABLE
},
{
"checkerboard", "chrome://global/content/aboutCheckerboard.xhtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
- nsIAboutModule::ALLOW_SCRIPT
+ nsIAboutModule::ALLOW_SCRIPT
},
{ "config", "chrome://global/content/config.xul", 0 },
-#ifdef MOZ_CRASHREPORTER
- { "crashes", "chrome://global/content/crashes.xhtml", 0 },
-#endif
{
"credits", "http://www.palemoon.org/Contributors.shtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
@@ -67,7 +64,7 @@ static RedirEntry kRedirMap[] = {
{
"license", "chrome://global/content/license.html",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
- nsIAboutModule::MAKE_LINKABLE
+ nsIAboutModule::MAKE_LINKABLE
},
{
"logo", "chrome://branding/content/about.png",
@@ -75,6 +72,13 @@ static RedirEntry kRedirMap[] = {
// Linkable for testing reasons.
nsIAboutModule::MAKE_LINKABLE
},
+#ifdef MOZ_PHOENIX
+ {
+ "logopage", "chrome://global/content/logopage.xhtml",
+ nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
+ nsIAboutModule::HIDE_FROM_ABOUTABOUT
+ },
+#endif
{
"memory", "chrome://global/content/aboutMemory.xhtml",
nsIAboutModule::ALLOW_SCRIPT
@@ -86,9 +90,9 @@ static RedirEntry kRedirMap[] = {
{
"neterror", "chrome://global/content/netError.xhtml",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
- nsIAboutModule::URI_CAN_LOAD_IN_CHILD |
- nsIAboutModule::ALLOW_SCRIPT |
- nsIAboutModule::HIDE_FROM_ABOUTABOUT
+ nsIAboutModule::URI_CAN_LOAD_IN_CHILD |
+ nsIAboutModule::ALLOW_SCRIPT |
+ nsIAboutModule::HIDE_FROM_ABOUTABOUT
},
{
"networking", "chrome://global/content/aboutNetworking.xhtml",
@@ -97,7 +101,7 @@ static RedirEntry kRedirMap[] = {
{
"newaddon", "chrome://mozapps/content/extensions/newaddon.xul",
nsIAboutModule::ALLOW_SCRIPT |
- nsIAboutModule::HIDE_FROM_ABOUTABOUT
+ nsIAboutModule::HIDE_FROM_ABOUTABOUT
},
{
"performance", "chrome://global/content/aboutPerformance.xhtml",
@@ -124,10 +128,10 @@ static RedirEntry kRedirMap[] = {
{
"srcdoc", "about:blank",
nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
- nsIAboutModule::HIDE_FROM_ABOUTABOUT |
- // Needs to be linkable so content can touch its own srcdoc frames
- nsIAboutModule::MAKE_LINKABLE |
- nsIAboutModule::URI_CAN_LOAD_IN_CHILD
+ nsIAboutModule::HIDE_FROM_ABOUTABOUT |
+ // Needs to be linkable so content can touch its own srcdoc frames
+ nsIAboutModule::MAKE_LINKABLE |
+ nsIAboutModule::URI_CAN_LOAD_IN_CHILD
},
{
"support", "chrome://global/content/aboutSupport.xhtml",
diff --git a/docshell/base/nsDSURIContentListener.cpp b/docshell/base/nsDSURIContentListener.cpp
index 93ce3cb264..ee6a4dd623 100644
--- a/docshell/base/nsDSURIContentListener.cpp
+++ b/docshell/base/nsDSURIContentListener.cpp
@@ -17,6 +17,7 @@
#include "nsIHttpChannel.h"
#include "nsIScriptSecurityManager.h"
#include "nsError.h"
+#include "nsContentSecurityManager.h"
#include "nsCharSeparatedTokenizer.h"
#include "nsIConsoleService.h"
#include "nsIScriptError.h"
@@ -93,6 +94,14 @@ nsDSURIContentListener::DoContent(const nsACString& aContentType,
if (aOpenedChannel) {
aOpenedChannel->GetLoadFlags(&loadFlags);
+
+ // block top-level data URI navigations if triggered by the web
+ if (!nsContentSecurityManager::AllowTopLevelNavigationToDataURI(aOpenedChannel)) {
+ // logging to console happens within AllowTopLevelNavigationToDataURI
+ aRequest->Cancel(NS_ERROR_DOM_BAD_URI);
+ *aAbortProcess = true;
+ return NS_OK;
+ }
}
if (loadFlags & nsIChannel::LOAD_RETARGETED_DOCUMENT_URI) {
diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp
index 2e08e67207..bd2a8a4338 100644
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -42,6 +42,7 @@
#include "nsArray.h"
#include "nsArrayUtils.h"
+#include "nsContentSecurityManager.h"
#include "nsICaptivePortalService.h"
#include "nsIDOMStorage.h"
#include "nsIContentViewer.h"
@@ -138,6 +139,7 @@
#include "nsISiteSecurityService.h"
#include "nsStructuredCloneContainer.h"
#include "nsIStructuredCloneContainer.h"
+#include "nsISupportsPrimitives.h"
#ifdef MOZ_PLACES
#include "nsIFaviconService.h"
#include "mozIPlacesPendingOperation.h"
@@ -1272,6 +1274,7 @@ nsDocShell::LoadURI(nsIURI* aURI,
nsCOMPtr<nsISHEntry> shEntry;
nsXPIDLString target;
nsAutoString srcdoc;
+ bool forceAllowDataURI = false;
nsCOMPtr<nsIDocShell> sourceDocShell;
nsCOMPtr<nsIURI> baseURI;
@@ -1307,6 +1310,7 @@ nsDocShell::LoadURI(nsIURI* aURI,
aLoadInfo->GetSrcdocData(srcdoc);
aLoadInfo->GetSourceDocShell(getter_AddRefs(sourceDocShell));
aLoadInfo->GetBaseURI(getter_AddRefs(baseURI));
+ aLoadInfo->GetForceAllowDataURI(&forceAllowDataURI);
}
#if defined(DEBUG)
@@ -1560,6 +1564,10 @@ nsDocShell::LoadURI(nsIURI* aURI,
flags |= INTERNAL_LOAD_FLAGS_IS_SRCDOC;
}
+ if (forceAllowDataURI) {
+ flags |= INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI;
+ }
+
return InternalLoad(aURI,
originalURI,
loadReplace,
@@ -2289,13 +2297,6 @@ nsDocShell::GetUseRemoteTabs(bool* aUseRemoteTabs)
NS_IMETHODIMP
nsDocShell::SetRemoteTabs(bool aUseRemoteTabs)
{
-#ifdef MOZ_CRASHREPORTER
- if (aUseRemoteTabs) {
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("DOMIPCEnabled"),
- NS_LITERAL_CSTRING("1"));
- }
-#endif
-
mUseRemoteTabs = aUseRemoteTabs;
return NS_OK;
}
@@ -4828,6 +4829,9 @@ nsDocShell::LoadURIWithOptions(const char16_t* aURI,
}
nsAutoPopupStatePusher statePusher(popupState);
+ bool forceAllowDataURI =
+ aLoadFlags & LOAD_FLAGS_FORCE_ALLOW_DATA_URI;
+
// Don't pass certain flags that aren't needed and end up confusing
// ConvertLoadTypeToDocShellLoadInfo. We do need to ensure that they are
// passed to LoadURI though, since it uses them.
@@ -4857,6 +4861,7 @@ nsDocShell::LoadURIWithOptions(const char16_t* aURI,
loadInfo->SetReferrerPolicy(aReferrerPolicy);
loadInfo->SetHeadersStream(aHeaderStream);
loadInfo->SetBaseURI(aBaseURI);
+ loadInfo->SetForceAllowDataURI(forceAllowDataURI);
if (fixupInfo) {
nsAutoString searchProvider, keyword;
@@ -6806,9 +6811,17 @@ nsDocShell::ForceRefreshURI(nsIURI* aURI, int32_t aDelay, bool aMetaRefresh, nsI
*/
loadInfo->SetReferrer(mCurrentURI);
- /* Don't ever "guess" on which principal to use to avoid picking
- * the current principal.
- */
+ // Set the triggering pricipal to aPrincipal if available, or current
+ // document's principal otherwise.
+ nsCOMPtr<nsIPrincipal> principal = aPrincipal;
+ if (!principal) {
+ nsCOMPtr<nsIDocument> doc = GetDocument();
+ if (!doc) {
+ return NS_ERROR_FAILURE;
+ }
+ principal = doc->NodePrincipal();
+ }
+ loadInfo->SetTriggeringPrincipal(principal);
loadInfo->SetPrincipalIsExplicit(true);
/* Check if this META refresh causes a redirection
@@ -6836,13 +6849,6 @@ nsDocShell::ForceRefreshURI(nsIURI* aURI, int32_t aDelay, bool aMetaRefresh, nsI
loadInfo->SetLoadType(nsIDocShellLoadInfo::loadRefresh);
}
- // If the principal is null, the refresh will have a triggeringPrincipal
- // derived from the referrer URI, or will be set to the system principal
- // if there is no refererrer. See LoadURI()
- if (aPrincipal) {
- loadInfo->SetTriggeringPrincipal(aPrincipal);
- }
-
/*
* LoadURI(...) will cancel all refresh timers... This causes the
* Timer and its refreshData instance to be released...
@@ -9890,49 +9896,49 @@ nsDocShell::InternalLoad(nsIURI* aURI,
contentType = nsIContentPolicy::TYPE_DOCUMENT;
}
- // If there's no targetDocShell, that means we are about to create a new window,
- // perform a content policy check before creating the window.
- if (!targetDocShell) {
- nsCOMPtr<Element> requestingElement;
+ // If there's no targetDocShell, that means we are about to create a new
+ // window (or aWindowTarget is empty). Perform a content policy check before
+ // creating the window. Please note for all other docshell loads
+ // content policy checks are performed within the contentSecurityManager
+ // when the channel is about to be openend.
+ if (!targetDocShell && !aWindowTarget.IsEmpty()) {
+ MOZ_ASSERT(contentType == nsIContentPolicy::TYPE_DOCUMENT,
+ "opening a new window requires type to be TYPE_DOCUMENT");
+
nsISupports* requestingContext = nullptr;
- if (contentType == nsIContentPolicy::TYPE_DOCUMENT) {
- if (XRE_IsContentProcess()) {
- // In e10s the child process doesn't have access to the element that
- // contains the browsing context (because that element is in the chrome
- // process). So we just pass mScriptGlobal.
- requestingContext = ToSupports(mScriptGlobal);
- } else {
- // This is for loading non-e10s tabs and toplevel windows of various
- // sorts.
- // For the toplevel window cases, requestingElement will be null.
- requestingElement = mScriptGlobal->AsOuter()->GetFrameElementInternal();
- requestingContext = requestingElement;
- }
+ if (XRE_IsContentProcess()) {
+ // In e10s the child process doesn't have access to the element that
+ // contains the browsing context (because that element is in the chrome
+ // process). So we just pass mScriptGlobal.
+ requestingContext = ToSupports(mScriptGlobal);
} else {
- requestingElement = mScriptGlobal->AsOuter()->GetFrameElementInternal();
+ // This is for loading non-e10s tabs and toplevel windows of various
+ // sorts.
+ // For the toplevel window cases, requestingElement will be null.
+ nsCOMPtr<Element> requestingElement =
+ mScriptGlobal->AsOuter()->GetFrameElementInternal();
requestingContext = requestingElement;
-
-#ifdef DEBUG
- if (requestingElement) {
- // Get the docshell type for requestingElement.
- nsCOMPtr<nsIDocument> requestingDoc = requestingElement->OwnerDoc();
- nsCOMPtr<nsIDocShell> elementDocShell = requestingDoc->GetDocShell();
-
- // requestingElement docshell type = current docshell type.
- MOZ_ASSERT(mItemType == elementDocShell->ItemType(),
- "subframes should have the same docshell type as their parent");
- }
-#endif
}
+ // Since Content Policy checks are performed within docShell as well as
+ // the ContentSecurityManager we need a reliable way to let certain
+ // nsIContentPolicy consumers ignore duplicate calls. Let's use the 'extra'
+ // argument to pass a specific identifier.
+ nsCOMPtr<nsISupportsString> extraStr =
+ do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID, &rv);
+ NS_ENSURE_SUCCESS(rv, rv);
+ NS_NAMED_LITERAL_STRING(msg, "conPolCheckFromDocShell");
+ rv = extraStr->SetData(msg);
+ NS_ENSURE_SUCCESS(rv, rv);
+
int16_t shouldLoad = nsIContentPolicy::ACCEPT;
rv = NS_CheckContentLoadPolicy(contentType,
aURI,
aTriggeringPrincipal,
requestingContext,
EmptyCString(), // mime guess
- nullptr, // extra
+ extraStr, // extra
&shouldLoad);
if (NS_FAILED(rv) || NS_CP_REJECTED(shouldLoad)) {
@@ -10088,6 +10094,7 @@ nsDocShell::InternalLoad(nsIURI* aURI,
// principal to inherit is: it should be aTriggeringPrincipal.
loadInfo->SetPrincipalIsExplicit(true);
loadInfo->SetLoadType(ConvertLoadTypeToDocShellLoadInfo(LOAD_LINK));
+ loadInfo->SetForceAllowDataURI(aFlags & INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI);
rv = win->Open(NS_ConvertUTF8toUTF16(spec),
aWindowTarget, // window name
@@ -10238,8 +10245,11 @@ nsDocShell::InternalLoad(nsIURI* aURI,
}
}
+ bool loadFromExternal = false;
+
// Before going any further vet loads initiated by external programs.
if (aLoadType == LOAD_NORMAL_EXTERNAL) {
+ loadFromExternal = true;
// Disallow external chrome: loads targetted at content windows
bool isChrome = false;
if (NS_SUCCEEDED(aURI->SchemeIs("chrome", &isChrome)) && isChrome) {
@@ -10730,7 +10740,9 @@ nsDocShell::InternalLoad(nsIURI* aURI,
nsINetworkPredictor::PREDICT_LOAD, this, nullptr);
nsCOMPtr<nsIRequest> req;
- rv = DoURILoad(aURI, aOriginalURI, aLoadReplace, aReferrer,
+ rv = DoURILoad(aURI, aOriginalURI, aLoadReplace, loadFromExternal,
+ (aFlags & INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI),
+ aReferrer,
!(aFlags & INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER),
aReferrerPolicy,
aTriggeringPrincipal, principalToInherit, aTypeHint,
@@ -10810,6 +10822,8 @@ nsresult
nsDocShell::DoURILoad(nsIURI* aURI,
nsIURI* aOriginalURI,
bool aLoadReplace,
+ bool aLoadFromExternal,
+ bool aForceAllowDataURI,
nsIURI* aReferrerURI,
bool aSendReferrer,
uint32_t aReferrerPolicy,
@@ -10886,17 +10900,40 @@ nsDocShell::DoURILoad(nsIURI* aURI,
nsCOMPtr<nsINode> loadingNode;
nsCOMPtr<nsPIDOMWindowOuter> loadingWindow;
nsCOMPtr<nsIPrincipal> loadingPrincipal;
+ nsCOMPtr<nsISupports> topLevelLoadingContext;
if (aContentPolicyType == nsIContentPolicy::TYPE_DOCUMENT) {
loadingNode = nullptr;
loadingPrincipal = nullptr;
loadingWindow = mScriptGlobal->AsOuter();
+ if (XRE_IsContentProcess()) {
+ // In e10s the child process doesn't have access to the element that
+ // contains the browsing context (because that element is in the chrome
+ // process).
+ nsCOMPtr<nsITabChild> tabChild = GetTabChild();
+ topLevelLoadingContext = ToSupports(tabChild);
+ } else {
+ // This is for loading non-e10s tabs and toplevel windows of various
+ // sorts.
+ // For the toplevel window cases, requestingElement will be null.
+ nsCOMPtr<Element> requestingElement =
+ loadingWindow->GetFrameElementInternal();
+ topLevelLoadingContext = requestingElement;
+ }
} else {
loadingWindow = nullptr;
loadingNode = mScriptGlobal->AsOuter()->GetFrameElementInternal();
if (loadingNode) {
// If we have a loading node, then use that as our loadingPrincipal.
loadingPrincipal = loadingNode->NodePrincipal();
+#ifdef DEBUG
+ // Get the docshell type for requestingElement.
+ nsCOMPtr<nsIDocument> requestingDoc = loadingNode->OwnerDoc();
+ nsCOMPtr<nsIDocShell> elementDocShell = requestingDoc->GetDocShell();
+ // requestingElement docshell type = current docshell type.
+ MOZ_ASSERT(mItemType == elementDocShell->ItemType(),
+ "subframes should have the same docshell type as their parent");
+#endif
} else {
// If this isn't a top-level load and mScriptGlobal's frame element is
// null, then the element got removed from the DOM while we were trying
@@ -10946,7 +10983,7 @@ nsDocShell::DoURILoad(nsIURI* aURI,
nsCOMPtr<nsILoadInfo> loadInfo =
(aContentPolicyType == nsIContentPolicy::TYPE_DOCUMENT) ?
- new LoadInfo(loadingWindow, aTriggeringPrincipal,
+ new LoadInfo(loadingWindow, aTriggeringPrincipal, topLevelLoadingContext,
securityFlags) :
new LoadInfo(loadingPrincipal, aTriggeringPrincipal, loadingNode,
securityFlags, aContentPolicyType);
@@ -10954,6 +10991,8 @@ nsDocShell::DoURILoad(nsIURI* aURI,
if (aPrincipalToInherit) {
loadInfo->SetPrincipalToInherit(aPrincipalToInherit);
}
+ loadInfo->SetLoadTriggeredFromExternal(aLoadFromExternal);
+ loadInfo->SetForceAllowDataURI(aForceAllowDataURI);
// We have to do this in case our OriginAttributes are different from the
// OriginAttributes of the parent document. Or in case there isn't a
diff --git a/docshell/base/nsDocShell.h b/docshell/base/nsDocShell.h
index 3ca9e0b344..63a4e3358e 100644
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -369,6 +369,8 @@ protected:
nsresult DoURILoad(nsIURI* aURI,
nsIURI* aOriginalURI,
bool aLoadReplace,
+ bool aLoadFromExternal,
+ bool aForceAllowDataURI,
nsIURI* aReferrer,
bool aSendReferrer,
uint32_t aReferrerPolicy,
diff --git a/docshell/base/nsDocShellLoadInfo.cpp b/docshell/base/nsDocShellLoadInfo.cpp
index 7d0034b040..b00e8e3603 100644
--- a/docshell/base/nsDocShellLoadInfo.cpp
+++ b/docshell/base/nsDocShellLoadInfo.cpp
@@ -15,6 +15,7 @@ nsDocShellLoadInfo::nsDocShellLoadInfo()
: mLoadReplace(false)
, mInheritPrincipal(false)
, mPrincipalIsExplicit(false)
+ , mForceAllowDataURI(false)
, mSendReferrer(true)
, mReferrerPolicy(mozilla::net::RP_Default)
, mLoadType(nsIDocShellLoadInfo::loadNormal)
@@ -127,6 +128,20 @@ nsDocShellLoadInfo::SetPrincipalIsExplicit(bool aPrincipalIsExplicit)
}
NS_IMETHODIMP
+nsDocShellLoadInfo::GetForceAllowDataURI(bool* aForceAllowDataURI)
+{
+ *aForceAllowDataURI = mForceAllowDataURI;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+nsDocShellLoadInfo::SetForceAllowDataURI(bool aForceAllowDataURI)
+{
+ mForceAllowDataURI = aForceAllowDataURI;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
nsDocShellLoadInfo::GetLoadType(nsDocShellInfoLoadType* aLoadType)
{
NS_ENSURE_ARG_POINTER(aLoadType);
diff --git a/docshell/base/nsDocShellLoadInfo.h b/docshell/base/nsDocShellLoadInfo.h
index b7eaed832a..f3ddcca1e6 100644
--- a/docshell/base/nsDocShellLoadInfo.h
+++ b/docshell/base/nsDocShellLoadInfo.h
@@ -37,6 +37,7 @@ protected:
bool mLoadReplace;
bool mInheritPrincipal;
bool mPrincipalIsExplicit;
+ bool mForceAllowDataURI;
bool mSendReferrer;
nsDocShellInfoReferrerPolicy mReferrerPolicy;
nsDocShellInfoLoadType mLoadType;
diff --git a/docshell/base/nsIDocShell.idl b/docshell/base/nsIDocShell.idl
index 8261c45dcb..e34e6adfdf 100644
--- a/docshell/base/nsIDocShell.idl
+++ b/docshell/base/nsIDocShell.idl
@@ -116,6 +116,9 @@ interface nsIDocShell : nsIDocShellTreeItem
const long INTERNAL_LOAD_FLAGS_NO_OPENER = 0x100;
+ // Whether a top-level data URI navigation is allowed for that load
+ const long INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI = 0x200;
+
// NB: 0x80 is available.
/**
diff --git a/docshell/base/nsIDocShellLoadInfo.idl b/docshell/base/nsIDocShellLoadInfo.idl
index 113c0a4c17..8804f63a3c 100644
--- a/docshell/base/nsIDocShellLoadInfo.idl
+++ b/docshell/base/nsIDocShellLoadInfo.idl
@@ -55,6 +55,12 @@ interface nsIDocShellLoadInfo : nsISupports
*/
attribute boolean principalIsExplicit;
+ /**
+ * If this attribute is true, then a top-level navigation
+ * to a data URI will be allowed.
+ */
+ attribute boolean forceAllowDataURI;
+
/* these are load type enums... */
const long loadNormal = 0; // Normal Load
const long loadNormalReplace = 1; // Normal Load but replaces current history slot
diff --git a/docshell/base/nsIRefreshURI.idl b/docshell/base/nsIRefreshURI.idl
index 5abd829da8..04f18eee0f 100644
--- a/docshell/base/nsIRefreshURI.idl
+++ b/docshell/base/nsIRefreshURI.idl
@@ -19,9 +19,8 @@ interface nsIRefreshURI : nsISupports {
*
* @param aUri The uri to refresh.
* @param aPrincipal The triggeringPrincipal for the refresh load
- * May be null, in which case a principal will be built based on the
- * referrer URI of the previous docshell load, or will use the system
- * principal when there is no referrer.
+ * May be null, in which case the principal of current document will be
+ * applied.
* @param aMillis The number of milliseconds to wait.
* @param aRepeat Flag to indicate if the uri is to be
* repeatedly refreshed every aMillis milliseconds.
@@ -37,9 +36,8 @@ interface nsIRefreshURI : nsISupports {
*
* @param aURI The URI to refresh.
* @param aPrincipal The triggeringPrincipal for the refresh load
- * May be null, in which case a principal will be built based on the
- * referrer URI of the previous docshell load, or will use the system
- * principal when there is no referrer.
+ * May be null, in which case the principal of current document will be
+ * applied.
* @param aMillis The number of milliseconds by which this refresh would
* be delayed if it were not being forced.
* @param aMetaRefresh Flag to indicate if this is a meta refresh.
@@ -70,9 +68,8 @@ interface nsIRefreshURI : nsISupports {
*
* @param aBaseURI base URI to resolve refresh uri with.
* @param aPrincipal The triggeringPrincipal for the refresh load
- * May be null, in which case a principal will be built based on the
- * referrer URI of the previous docshell load, or will use the system
- * principal when there is no referrer.
+ * May be null, in which case the principal of current document will be
+ * applied.
* @param aHeader The meta refresh header string.
*/
void setupRefreshURIFromHeader(in nsIURI aBaseURI,
diff --git a/docshell/base/nsIWebNavigation.idl b/docshell/base/nsIWebNavigation.idl
index 042b1c5479..241d0731c1 100644
--- a/docshell/base/nsIWebNavigation.idl
+++ b/docshell/base/nsIWebNavigation.idl
@@ -206,6 +206,12 @@ interface nsIWebNavigation : nsISupports
const unsigned long LOAD_FLAGS_FIXUP_SCHEME_TYPOS = 0x200000;
/**
+ * Allows a top-level data: navigation to occur. E.g. view-image
+ * is an explicit user action which should be allowed.
+ */
+ const unsigned long LOAD_FLAGS_FORCE_ALLOW_DATA_URI = 0x400000;
+
+ /**
* Loads a given URI. This will give priority to loading the requested URI
* in the object implementing this interface. If it can't be loaded here
* however, the URI dispatcher will go through its normal process of content
diff --git a/docshell/build/nsDocShellModule.cpp b/docshell/build/nsDocShellModule.cpp
index d43c305f9b..872874012a 100644
--- a/docshell/build/nsDocShellModule.cpp
+++ b/docshell/build/nsDocShellModule.cpp
@@ -165,15 +165,15 @@ const mozilla::Module::ContractIDEntry kDocShellContracts[] = {
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "buildconfig", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "checkerboard", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "config", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
-#ifdef MOZ_CRASHREPORTER
- { NS_ABOUT_MODULE_CONTRACTID_PREFIX "crashes", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
-#endif
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "credits", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
#ifdef MOZ_DEVTOOLS
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "debugging", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
#endif
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "license", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "logo", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
+#ifdef MOZ_PHOENIX
+ { NS_ABOUT_MODULE_CONTRACTID_PREFIX "logopage", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
+#endif
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "memory", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "mozilla", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
{ NS_ABOUT_MODULE_CONTRACTID_PREFIX "neterror", &kNS_ABOUT_REDIRECTOR_MODULE_CID },
diff --git a/docshell/test/chrome/test_bug453650.xul b/docshell/test/chrome/test_bug453650.xul
index 2837e56d84..04acefe6d4 100644..100755
--- a/docshell/test/chrome/test_bug453650.xul
+++ b/docshell/test/chrome/test_bug453650.xul
@@ -61,7 +61,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=453650
}
info("times: " + start + ", " + end);
- ok(start < end, "reflow start time lower than end time");
+ ok(start <= end, "reflow start time lower than end time");
done();
},
@@ -73,7 +73,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=453650
}
info("times: " + start + ", " + end);
- ok(start < end, "reflow start time lower than end time");
+ ok(start <= end, "reflow start time lower than end time");
done();
},
diff --git a/docshell/test/navigation/file_contentpolicy_block_window.html b/docshell/test/navigation/file_contentpolicy_block_window.html
new file mode 100644
index 0000000000..c51e574e5e
--- /dev/null
+++ b/docshell/test/navigation/file_contentpolicy_block_window.html
@@ -0,0 +1,5 @@
+<html>
+<body>
+This window should never be openend!
+</body>
+</html>
diff --git a/docshell/test/navigation/mochitest.ini b/docshell/test/navigation/mochitest.ini
index 0c35cf352c..764e400a8f 100644
--- a/docshell/test/navigation/mochitest.ini
+++ b/docshell/test/navigation/mochitest.ini
@@ -36,6 +36,7 @@ support-files =
file_bug1300461_redirect.html
file_bug1300461_redirect.html^headers^
file_bug1300461_back.html
+ file_contentpolicy_block_window.html
[test_bug13871.html]
[test_bug270414.html]
@@ -62,3 +63,4 @@ skip-if = toolkit == 'android' #RANDOM
[test_triggeringprincipal_window_open.html]
[test_triggeringprincipal_parent_iframe_window_open.html]
[test_triggeringprincipal_iframe_iframe_window_open.html]
+[test_contentpolicy_block_window.html]
diff --git a/docshell/test/navigation/test_contentpolicy_block_window.html b/docshell/test/navigation/test_contentpolicy_block_window.html
new file mode 100644
index 0000000000..651be825cf
--- /dev/null
+++ b/docshell/test/navigation/test_contentpolicy_block_window.html
@@ -0,0 +1,96 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1329288
+-->
+<head>
+ <title>Test for Bug 1329288</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1329288">Mozilla Bug 1329288</a>
+
+
+<!-- have a testlink which we can use for the test to open a new window -->
+<a href="http://test1.example.org/tests/docshell/test/navigation/file_contentpolicy_block_window.html"
+ target="_blank"
+ id="testlink">This is a link</a>
+
+<script class="testbody" type="text/javascript">
+/*
+ * Description of the test:
+ * The test tries to open a new window and makes sure that a registered contentPolicy
+ * gets called with the right (a non null) 'context' for the TYPE_DOCUMENT load.
+ */
+
+const Cc = SpecialPowers.Cc;
+const Ci = SpecialPowers.Ci;
+
+var categoryManager = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager);
+var componentManager = SpecialPowers.wrap(SpecialPowers.Components).manager
+ .QueryInterface(Ci.nsIComponentRegistrar);
+
+// Content policy / factory implementation for the test
+var policyID = SpecialPowers.wrap(SpecialPowers.Components).ID("{b80e19d0-878f-d41b-2654-194714a4115c}");
+var policyName = "@mozilla.org/testpolicy;1";
+var policy = {
+ // nsISupports implementation
+ QueryInterface: function(iid) {
+ iid = SpecialPowers.wrap(iid);
+ if (iid.equals(Ci.nsISupports) ||
+ iid.equals(Ci.nsIFactory) ||
+ iid.equals(Ci.nsIContentPolicy))
+ return this;
+ throw SpecialPowers.Cr.NS_ERROR_NO_INTERFACE;
+ },
+
+ // nsIFactory implementation
+ createInstance: function(outer, iid) {
+ return this.QueryInterface(iid);
+ },
+
+ // nsIContentPolicy implementation
+ shouldLoad: function(contentType, contentLocation, requestOrigin, context, mimeTypeGuess, extra) {
+
+ if (SpecialPowers.wrap(contentLocation).spec !== document.getElementById("testlink").href) {
+ // not the URI we are looking for, allow the load
+ return Ci.nsIContentPolicy.ACCEPT;
+ }
+
+ is(contentType, Ci.nsIContentPolicy.TYPE_DOCUMENT,
+ "needs to be type document load");
+ ok(context, "context is not allowed to be null");
+ ok(context.name.endsWith("test_contentpolicy_block_window.html"),
+ "context should be the current window");
+
+ // remove the policy and finish test.
+ categoryManager.deleteCategoryEntry("content-policy", policyName, false);
+
+ setTimeout(function() {
+ // Component must be unregistered delayed, otherwise other content
+ // policy will not be removed from the category correctly
+ componentManager.unregisterFactory(policyID, policy);
+ }, 0);
+
+ SimpleTest.finish();
+ return Ci.nsIContentPolicy.REJECT_REQUEST;
+ },
+
+ shouldProcess: function(contentType, contentLocation, requestOrigin, context, mimeTypeGuess, extra) {
+ return Ci.nsIContentPolicy.ACCEPT;
+ }
+}
+
+policy = SpecialPowers.wrapCallbackObject(policy);
+componentManager.registerFactory(policyID, "Test content policy", policyName, policy);
+categoryManager.addCategoryEntry("content-policy", policyName, policyName, false, true);
+
+SimpleTest.waitForExplicitFinish();
+
+// now everything is set up, let's start the test
+document.getElementById("testlink").click()
+
+</script>
+</body>
+</html>
diff --git a/docshell/test/unit/test_nsDefaultURIFixup_info.js b/docshell/test/unit/test_nsDefaultURIFixup_info.js
index 9e33ea484f..c606ac32ef 100644
--- a/docshell/test/unit/test_nsDefaultURIFixup_info.js
+++ b/docshell/test/unit/test_nsDefaultURIFixup_info.js
@@ -426,8 +426,6 @@ var testcases = [ {
protocolChange: true,
}, {
input: "?'.com",
- fixedURI: "http:///?%27.com",
- alternateURI: "http://www..com/?%27.com",
keywordLookup: true,
protocolChange: true,
}, {
@@ -436,14 +434,10 @@ var testcases = [ {
protocolChange: true
}, {
input: "?mozilla",
- fixedURI: "http:///?mozilla",
- alternateURI: "http://www..com/?mozilla",
keywordLookup: true,
protocolChange: true,
}, {
input: "??mozilla",
- fixedURI: "http:///??mozilla",
- alternateURI: "http://www..com/??mozilla",
keywordLookup: true,
protocolChange: true,
}, {
diff --git a/docshell/test/unit/test_nsDefaultURIFixup_search.js b/docshell/test/unit/test_nsDefaultURIFixup_search.js
index c00b6a85f5..c84452b5db 100644
--- a/docshell/test/unit/test_nsDefaultURIFixup_search.js
+++ b/docshell/test/unit/test_nsDefaultURIFixup_search.js
@@ -74,7 +74,7 @@ var data = [
},
{
wrong: 'user:@example.com:8080/this/is/a/test.html',
- fixed: 'http://user:@example.com:8080/this/is/a/test.html',
+ fixed: 'http://user@example.com:8080/this/is/a/test.html',
},
{
wrong: '//user:pass@example.com:8080/this/is/a/test.html',
diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp
index 9ced64c0d6..0927555905 100644
--- a/dom/base/Element.cpp
+++ b/dom/base/Element.cpp
@@ -183,6 +183,12 @@ Element::DoGetClasses() const
NS_IMETHODIMP
Element::QueryInterface(REFNSIID aIID, void** aInstancePtr)
{
+ if (aIID.Equals(NS_GET_IID(Element))) {
+ NS_ADDREF_THIS();
+ *aInstancePtr = this;
+ return NS_OK;
+ }
+
NS_ASSERTION(aInstancePtr,
"QueryInterface requires a non-NULL destination!");
nsresult rv = FragmentOrElement::QueryInterface(aIID, aInstancePtr);
@@ -1838,6 +1844,24 @@ Element::UnbindFromTree(bool aDeep, bool aNullParent)
SetParentIsContent(false);
}
+#ifdef DEBUG
+ // If we can get access to the PresContext, then we sanity-check that
+ // we're not leaving behind a pointer to ourselves as the PresContext's
+ // cached provider of the viewport's scrollbar styles.
+ if (document) {
+ nsIPresShell* presShell = document->GetShell();
+ if (presShell) {
+ nsPresContext* presContext = presShell->GetPresContext();
+ if (presContext) {
+ MOZ_ASSERT(this !=
+ presContext->GetViewportScrollbarStylesOverrideNode(),
+ "Leaving behind a raw pointer to this node (as having "
+ "propagated scrollbar styles) - that's dangerous...");
+ }
+ }
+ }
+#endif
+
// Ensure that CSS transitions don't continue on an element at a
// different place in the tree (even if reinserted before next
// animation refresh).
diff --git a/dom/base/File.cpp b/dom/base/File.cpp
index 46b37b976a..8602a30641 100644..100755
--- a/dom/base/File.cpp
+++ b/dom/base/File.cpp
@@ -29,6 +29,7 @@
#include "nsStringStream.h"
#include "nsJSUtils.h"
#include "nsPrintfCString.h"
+#include "mozilla/TimerClamping.h"
#include "mozilla/SHA1.h"
#include "mozilla/CheckedInt.h"
#include "mozilla/Preferences.h"
@@ -727,7 +728,7 @@ BlobImplBase::GetLastModified(ErrorResult& aRv)
mLastModificationDate = PR_Now();
}
- return mLastModificationDate / PR_USEC_PER_MSEC;
+ return TimerClamping::ReduceUsTimeValue(mLastModificationDate) / PR_USEC_PER_MSEC;
}
void
diff --git a/dom/base/FragmentOrElement.cpp b/dom/base/FragmentOrElement.cpp
index 79f6cff51e..b22a0d4ffa 100644
--- a/dom/base/FragmentOrElement.cpp
+++ b/dom/base/FragmentOrElement.cpp
@@ -1937,7 +1937,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_INTERFACE_MAP_BEGIN(FragmentOrElement)
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(FragmentOrElement)
- NS_INTERFACE_MAP_ENTRY(Element)
NS_INTERFACE_MAP_ENTRY(nsIContent)
NS_INTERFACE_MAP_ENTRY(nsINode)
NS_INTERFACE_MAP_ENTRY(nsIDOMEventTarget)
diff --git a/dom/base/IdleRequest.cpp b/dom/base/IdleRequest.cpp
index 26190f98b7..fb3983d377 100644
--- a/dom/base/IdleRequest.cpp
+++ b/dom/base/IdleRequest.cpp
@@ -9,7 +9,6 @@
#include "mozilla/Function.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/dom/IdleDeadline.h"
-#include "mozilla/dom/Performance.h"
#include "mozilla/dom/PerformanceTiming.h"
#include "mozilla/dom/WindowBinding.h"
#include "nsComponentManagerUtils.h"
@@ -20,138 +19,56 @@
namespace mozilla {
namespace dom {
-IdleRequest::IdleRequest(JSContext* aCx, nsPIDOMWindowInner* aWindow,
- IdleRequestCallback& aCallback, uint32_t aHandle)
- : mWindow(aWindow)
- , mCallback(&aCallback)
+IdleRequest::IdleRequest(IdleRequestCallback* aCallback, uint32_t aHandle)
+ : mCallback(aCallback)
, mHandle(aHandle)
, mTimeoutHandle(Nothing())
{
- MOZ_ASSERT(aWindow);
-
- // Get the calling location.
- nsJSUtils::GetCallingLocation(aCx, mFileName, &mLineNo, &mColumn);
+ MOZ_DIAGNOSTIC_ASSERT(mCallback);
}
IdleRequest::~IdleRequest()
{
}
-NS_IMPL_CYCLE_COLLECTION_CLASS(IdleRequest)
+NS_IMPL_CYCLE_COLLECTION(IdleRequest, mCallback)
NS_IMPL_CYCLE_COLLECTING_ADDREF(IdleRequest)
NS_IMPL_CYCLE_COLLECTING_RELEASE(IdleRequest)
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(IdleRequest)
- NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindow)
- NS_IMPL_CYCLE_COLLECTION_UNLINK(mCallback)
-NS_IMPL_CYCLE_COLLECTION_UNLINK_END
-
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(IdleRequest)
- NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow)
- NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCallback)
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
-
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(IdleRequest)
- NS_INTERFACE_MAP_ENTRY(nsIRunnable)
- NS_INTERFACE_MAP_ENTRY(nsICancelableRunnable)
- NS_INTERFACE_MAP_ENTRY(nsIIncrementalRunnable)
- NS_INTERFACE_MAP_ENTRY(nsITimeoutHandler)
- NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsITimeoutHandler)
NS_INTERFACE_MAP_END
-nsresult
-IdleRequest::SetTimeout(uint32_t aTimeout)
-{
- int32_t handle;
- nsresult rv = nsGlobalWindow::Cast(mWindow)->SetTimeoutOrInterval(
- this, aTimeout, false, Timeout::Reason::eIdleCallbackTimeout, &handle);
- mTimeoutHandle = Some(handle);
-
- return rv;
-}
-
-nsresult
-IdleRequest::Run()
-{
- if (mCallback) {
- RunIdleRequestCallback(false);
- }
-
- return NS_OK;
-}
-
-nsresult
-IdleRequest::Cancel()
+void
+IdleRequest::SetTimeoutHandle(int32_t aHandle)
{
- mCallback = nullptr;
- CancelTimeout();
- if (isInList()) {
- remove();
- }
- Release();
-
- return NS_OK;
+ mTimeoutHandle = Some(aHandle);
}
-void
-IdleRequest::SetDeadline(TimeStamp aDeadline)
+uint32_t
+IdleRequest::GetTimeoutHandle() const
{
- mozilla::dom::Performance* perf = mWindow->GetPerformance();
- mDeadline =
- perf ? perf->GetDOMTiming()->TimeStampToDOMHighRes(aDeadline) : 0.0;
+ MOZ_DIAGNOSTIC_ASSERT(mTimeoutHandle.isSome());
+ return mTimeoutHandle.value();
}
nsresult
-IdleRequest::RunIdleRequestCallback(bool aDidTimeout)
+IdleRequest::IdleRun(nsPIDOMWindowInner* aWindow,
+ DOMHighResTimeStamp aDeadline,
+ bool aDidTimeout)
{
MOZ_ASSERT(NS_IsMainThread());
+ MOZ_DIAGNOSTIC_ASSERT(mCallback);
- if (!aDidTimeout) {
- CancelTimeout();
- }
-
- remove();
ErrorResult error;
RefPtr<IdleDeadline> deadline =
- new IdleDeadline(mWindow, aDidTimeout, mDeadline);
+ new IdleDeadline(aWindow, aDidTimeout, aDeadline);
mCallback->Call(*deadline, error, "requestIdleCallback handler");
- mCallback = nullptr;
- Release();
+ mCallback = nullptr;
+ error.SuppressException();
return error.StealNSResult();
}
-void
-IdleRequest::CancelTimeout()
-{
- if (mTimeoutHandle.isSome()) {
- nsGlobalWindow::Cast(mWindow)->ClearTimeoutOrInterval(
- mTimeoutHandle.value(), Timeout::Reason::eIdleCallbackTimeout);
- }
-}
-
-nsresult
-IdleRequest::Call()
-{
- SetDeadline(TimeStamp::Now());
- return RunIdleRequestCallback(true);
-}
-
-void
-IdleRequest::GetLocation(const char** aFileName, uint32_t* aLineNo,
- uint32_t* aColumn)
-{
- *aFileName = mFileName.get();
- *aLineNo = mLineNo;
- *aColumn = mColumn;
-}
-
-void
-IdleRequest::MarkForCC()
-{
- mCallback->MarkForCC();
-}
-
} // namespace dom
} // namespace mozilla
diff --git a/dom/base/IdleRequest.h b/dom/base/IdleRequest.h
index cb234430a2..acf56f8529 100644
--- a/dom/base/IdleRequest.h
+++ b/dom/base/IdleRequest.h
@@ -12,7 +12,6 @@
#include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h"
#include "nsDOMNavigationTiming.h"
-#include "nsITimeoutHandler.h"
class nsPIDOMWindowInner;
@@ -21,28 +20,19 @@ namespace dom {
class IdleRequestCallback;
-class IdleRequest final : public nsITimeoutHandler
- , public nsIRunnable
- , public nsICancelableRunnable
- , public nsIIncrementalRunnable
- , public LinkedListElement<IdleRequest>
+class IdleRequest final : public nsISupports,
+ public LinkedListElement<IdleRequest>
{
public:
- IdleRequest(JSContext* aCx, nsPIDOMWindowInner* aWindow,
- IdleRequestCallback& aCallback, uint32_t aHandle);
+ IdleRequest(IdleRequestCallback* aCallback, uint32_t aHandle);
- virtual nsresult Call() override;
- virtual void GetLocation(const char** aFileName, uint32_t* aLineNo,
- uint32_t* aColumn) override;
- virtual void MarkForCC() override;
+ nsresult IdleRun(nsPIDOMWindowInner* aWindow,
+ DOMHighResTimeStamp aDeadline,
+ bool aDidTimeout);
- nsresult SetTimeout(uint32_t aTimout);
- nsresult RunIdleRequestCallback(bool aDidTimeout);
- void CancelTimeout();
-
- NS_DECL_NSIRUNNABLE;
- virtual nsresult Cancel() override;
- virtual void SetDeadline(mozilla::TimeStamp aDeadline) override;
+ void SetTimeoutHandle(int32_t aHandle);
+ bool HasTimeout() const { return mTimeoutHandle.isSome(); }
+ uint32_t GetTimeoutHandle() const;
uint32_t Handle() const
{
@@ -50,22 +40,14 @@ public:
}
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
- NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(IdleRequest, nsITimeoutHandler)
+ NS_DECL_CYCLE_COLLECTION_CLASS(IdleRequest)
private:
~IdleRequest();
- // filename, line number and JS language version string of the
- // caller of setTimeout()
- nsCString mFileName;
- uint32_t mLineNo;
- uint32_t mColumn;
-
- nsCOMPtr<nsPIDOMWindowInner> mWindow;
RefPtr<IdleRequestCallback> mCallback;
- uint32_t mHandle;
+ const uint32_t mHandle;
mozilla::Maybe<int32_t> mTimeoutHandle;
- DOMHighResTimeStamp mDeadline;
};
} // namespace dom
diff --git a/dom/base/Location.cpp b/dom/base/Location.cpp
index e3b614931a..b6b95aaa6e 100644
--- a/dom/base/Location.cpp
+++ b/dom/base/Location.cpp
@@ -577,19 +577,17 @@ Location::GetPathname(nsAString& aPathname)
aPathname.Truncate();
nsCOMPtr<nsIURI> uri;
- nsresult result = NS_OK;
+ nsresult result = GetURI(getter_AddRefs(uri));
+ if (NS_FAILED(result) || !uri) {
+ return result;
+ }
- result = GetURI(getter_AddRefs(uri));
+ nsAutoCString file;
- nsCOMPtr<nsIURIWithQuery> url(do_QueryInterface(uri));
- if (url) {
- nsAutoCString file;
+ result = uri->GetFilePath(file);
- result = url->GetFilePath(file);
-
- if (NS_SUCCEEDED(result)) {
- AppendUTF8toUTF16(file, aPathname);
- }
+ if (NS_SUCCEEDED(result)) {
+ AppendUTF8toUTF16(file, aPathname);
}
return result;
@@ -604,8 +602,7 @@ Location::SetPathname(const nsAString& aPathname)
return rv;
}
- nsCOMPtr<nsIURIWithQuery> url(do_QueryInterface(uri));
- if (url && NS_SUCCEEDED(url->SetFilePath(NS_ConvertUTF16toUTF8(aPathname)))) {
+ if (NS_SUCCEEDED(uri->SetFilePath(NS_ConvertUTF16toUTF8(aPathname)))) {
return SetURI(uri);
}
diff --git a/dom/base/MultipartBlobImpl.cpp b/dom/base/MultipartBlobImpl.cpp
index ba26d07f93..03bb62addd 100644..100755
--- a/dom/base/MultipartBlobImpl.cpp
+++ b/dom/base/MultipartBlobImpl.cpp
@@ -17,6 +17,7 @@
#include "nsContentUtils.h"
#include "nsIScriptError.h"
#include "nsIXPConnect.h"
+#include "mozilla/TimerClamping.h"
#include <algorithm>
using namespace mozilla;
@@ -270,8 +271,7 @@ MultipartBlobImpl::SetLengthAndModifiedDate(ErrorResult& aRv)
// var x = new Date(); var f = new File(...);
// x.getTime() < f.dateModified.getTime()
// could fail.
- mLastModificationDate =
- lastModifiedSet ? lastModified * PR_USEC_PER_MSEC : JS_Now();
+ mLastModificationDate = TimerClamping::ReduceUsTimeValue(lastModifiedSet ? lastModified * PR_USEC_PER_MSEC : JS_Now());
}
}
diff --git a/dom/base/Timeout.h b/dom/base/Timeout.h
index e929f3dd13..42e2f57f5b 100644
--- a/dom/base/Timeout.h
+++ b/dom/base/Timeout.h
@@ -41,7 +41,11 @@ public:
// default main thread being used.
nsresult InitTimer(nsIEventTarget* aTarget, uint32_t aDelay);
- enum class Reason { eTimeoutOrInterval, eIdleCallbackTimeout };
+ enum class Reason
+ {
+ eTimeoutOrInterval,
+ eIdleCallbackTimeout,
+ };
#ifdef DEBUG
bool HasRefCntOne() const;
@@ -62,6 +66,8 @@ public:
// True if this is a repeating/interval timer
bool mIsInterval;
+ // Used to allow several reasons for setting a timeout, where each
+ // 'Reason' value is using a possibly overlapping set of id:s.
Reason mReason;
// Returned as value of setTimeout()
diff --git a/dom/base/TimeoutHandler.cpp b/dom/base/TimeoutHandler.cpp
new file mode 100644
index 0000000000..78c3f16dd9
--- /dev/null
+++ b/dom/base/TimeoutHandler.cpp
@@ -0,0 +1,43 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "TimeoutHandler.h"
+
+namespace mozilla {
+namespace dom {
+
+TimeoutHandler::TimeoutHandler(JSContext* aCx)
+ : TimeoutHandler()
+{
+ nsJSUtils::GetCallingLocation(aCx, mFileName, &mLineNo, &mColumn);
+}
+
+nsresult
+TimeoutHandler::Call()
+{
+ return NS_OK;
+}
+
+void
+TimeoutHandler::GetLocation(const char** aFileName, uint32_t* aLineNo,
+ uint32_t* aColumn)
+{
+ *aFileName = mFileName.get();
+ *aLineNo = mLineNo;
+ *aColumn = mColumn;
+}
+
+NS_IMPL_CYCLE_COLLECTION_0(TimeoutHandler)
+
+NS_IMPL_CYCLE_COLLECTING_ADDREF(TimeoutHandler)
+NS_IMPL_CYCLE_COLLECTING_RELEASE(TimeoutHandler)
+
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TimeoutHandler)
+ NS_INTERFACE_MAP_ENTRY(nsITimeoutHandler)
+NS_INTERFACE_MAP_END
+
+} // namespace dom
+} // namespace mozilla
diff --git a/dom/base/TimeoutHandler.h b/dom/base/TimeoutHandler.h
new file mode 100644
index 0000000000..cb0a0ce945
--- /dev/null
+++ b/dom/base/TimeoutHandler.h
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_dom_timeout_handler_h
+#define mozilla_dom_timeout_handler_h
+
+#include "nsCOMPtr.h"
+#include "nsISupports.h"
+#include "nsITimeoutHandler.h"
+
+namespace mozilla {
+namespace dom {
+
+/**
+ * Utility class for implementing nsITimeoutHandlers, designed to be subclassed.
+ */
+class TimeoutHandler : public nsITimeoutHandler
+{
+public:
+ // TimeoutHandler doesn't actually contain cycles, but subclasses
+ // probably will.
+ NS_DECL_CYCLE_COLLECTING_ISUPPORTS
+ NS_DECL_CYCLE_COLLECTION_CLASS(TimeoutHandler)
+
+ virtual nsresult Call() override;
+ virtual void GetLocation(const char** aFileName, uint32_t* aLineNo,
+ uint32_t* aColumn) override;
+ virtual void MarkForCC() override {}
+protected:
+ TimeoutHandler() : mFileName(""), mLineNo(0), mColumn(0) {}
+ explicit TimeoutHandler(JSContext *aCx);
+
+ virtual ~TimeoutHandler() {}
+private:
+ TimeoutHandler(const TimeoutHandler&) = delete;
+ TimeoutHandler& operator=(const TimeoutHandler&) = delete;
+ TimeoutHandler& operator=(const TimeoutHandler&&) = delete;
+
+ nsCString mFileName;
+ uint32_t mLineNo;
+ uint32_t mColumn;
+};
+
+} // namespace dom
+} // namespace mozilla
+
+#endif // mozilla_dom_timeout_handler_h
diff --git a/dom/base/TimerClamping.cpp b/dom/base/TimerClamping.cpp
new file mode 100755
index 0000000000..70639686b1
--- /dev/null
+++ b/dom/base/TimerClamping.cpp
@@ -0,0 +1,35 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "TimerClamping.h"
+
+namespace mozilla {
+
+/* static */
+double
+TimerClamping::ReduceSTimeValue(double aTime)
+{
+ static const double maxResolutionS = .002;
+ return floor(aTime / maxResolutionS) * maxResolutionS;
+}
+
+/* static */
+double
+TimerClamping::ReduceMsTimeValue(double aTime)
+{
+ static const double maxResolutionMs = 2;
+ return floor(aTime / maxResolutionMs) * maxResolutionMs;
+}
+
+/* static */
+double
+TimerClamping::ReduceUsTimeValue(double aTime)
+{
+ static const double maxResolutionUs = 2000;
+ return floor(aTime / maxResolutionUs) * maxResolutionUs;
+}
+
+} \ No newline at end of file
diff --git a/dom/base/TimerClamping.h b/dom/base/TimerClamping.h
new file mode 100755
index 0000000000..2ffd6add5f
--- /dev/null
+++ b/dom/base/TimerClamping.h
@@ -0,0 +1,22 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef TimerClamping_h___
+#define TimerClamping_h___
+
+namespace mozilla {
+
+class TimerClamping
+{
+public:
+ static double ReduceSTimeValue(double aTime);
+ static double ReduceMsTimeValue(double aTime);
+ static double ReduceUsTimeValue(double aTime);
+};
+
+}
+
+#endif /* TimerClamping_h___ */ \ No newline at end of file
diff --git a/dom/base/moz.build b/dom/base/moz.build
index 686d76e731..76c765b1cf 100644..100755
--- a/dom/base/moz.build
+++ b/dom/base/moz.build
@@ -143,6 +143,7 @@ EXPORTS.mozilla += [
'CORSMode.h',
'FeedWriterEnabled.h',
'TextInputProcessor.h',
+ 'TimerClamping.h',
'UseCounter.h',
]
@@ -216,6 +217,7 @@ EXPORTS.mozilla.dom += [
'TabGroup.h',
'Text.h',
'Timeout.h',
+ 'TimeoutHandler.h',
'TreeWalker.h',
'WebKitCSSMatrix.h',
'WebSocket.h',
@@ -363,6 +365,8 @@ UNIFIED_SOURCES += [
'TextInputProcessor.cpp',
'ThirdPartyUtil.cpp',
'Timeout.cpp',
+ 'TimeoutHandler.cpp',
+ 'TimerClamping.cpp',
'TreeWalker.cpp',
'WebKitCSSMatrix.cpp',
'WebSocket.cpp',
diff --git a/dom/base/nsContentPolicy.cpp b/dom/base/nsContentPolicy.cpp
index 337debcea8..5511b90864 100644
--- a/dom/base/nsContentPolicy.cpp
+++ b/dom/base/nsContentPolicy.cpp
@@ -20,6 +20,7 @@
#include "nsIDOMElement.h"
#include "nsIDOMNode.h"
#include "nsIDOMWindow.h"
+#include "nsITabChild.h"
#include "nsIContent.h"
#include "nsILoadContext.h"
#include "nsCOMArray.h"
@@ -89,8 +90,9 @@ nsContentPolicy::CheckPolicy(CPMethod policyMethod,
{
nsCOMPtr<nsIDOMNode> node(do_QueryInterface(requestingContext));
nsCOMPtr<nsIDOMWindow> window(do_QueryInterface(requestingContext));
- NS_ASSERTION(!requestingContext || node || window,
- "Context should be a DOM node or a DOM window!");
+ nsCOMPtr<nsITabChild> tabChild(do_QueryInterface(requestingContext));
+ NS_ASSERTION(!requestingContext || node || window || tabChild,
+ "Context should be a DOM node, DOM window or a tabChild!");
}
#endif
diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp
index 02c6bf1deb..bc8cea35ac 100644
--- a/dom/base/nsContentUtils.cpp
+++ b/dom/base/nsContentUtils.cpp
@@ -281,6 +281,7 @@ bool nsContentUtils::sIsCutCopyAllowed = true;
bool nsContentUtils::sIsFrameTimingPrefEnabled = false;
bool nsContentUtils::sIsPerformanceTimingEnabled = false;
bool nsContentUtils::sIsResourceTimingEnabled = false;
+bool nsContentUtils::sIsPerformanceNavigationTimingEnabled = false;
bool nsContentUtils::sIsUserTimingLoggingEnabled = false;
bool nsContentUtils::sIsExperimentalAutocompleteEnabled = false;
bool nsContentUtils::sEncodeDecodeURLHash = false;
@@ -571,6 +572,9 @@ nsContentUtils::Init()
Preferences::AddBoolVarCache(&sIsResourceTimingEnabled,
"dom.enable_resource_timing", true);
+ Preferences::AddBoolVarCache(&sIsPerformanceNavigationTimingEnabled,
+ "dom.enable_performance_navigation_timing", true);
+
Preferences::AddBoolVarCache(&sIsUserTimingLoggingEnabled,
"dom.performance.enable_user_timing_logging", false);
@@ -3717,11 +3721,15 @@ nsContentUtils::IsChildOfSameType(nsIDocument* aDoc)
}
bool
-nsContentUtils::IsScriptType(const nsACString& aContentType)
+nsContentUtils::IsPlainTextType(const nsACString& aContentType)
{
// NOTE: if you add a type here, add it to the CONTENTDLF_CATEGORIES
// define in nsContentDLF.h as well.
- return aContentType.EqualsLiteral(APPLICATION_JAVASCRIPT) ||
+ return aContentType.EqualsLiteral(TEXT_PLAIN) ||
+ aContentType.EqualsLiteral(TEXT_CSS) ||
+ aContentType.EqualsLiteral(TEXT_CACHE_MANIFEST) ||
+ aContentType.EqualsLiteral(TEXT_VTT) ||
+ aContentType.EqualsLiteral(APPLICATION_JAVASCRIPT) ||
aContentType.EqualsLiteral(APPLICATION_XJAVASCRIPT) ||
aContentType.EqualsLiteral(TEXT_ECMASCRIPT) ||
aContentType.EqualsLiteral(APPLICATION_ECMASCRIPT) ||
@@ -3731,18 +3739,6 @@ nsContentUtils::IsScriptType(const nsACString& aContentType)
}
bool
-nsContentUtils::IsPlainTextType(const nsACString& aContentType)
-{
- // NOTE: if you add a type here, add it to the CONTENTDLF_CATEGORIES
- // define in nsContentDLF.h as well.
- return aContentType.EqualsLiteral(TEXT_PLAIN) ||
- aContentType.EqualsLiteral(TEXT_CSS) ||
- aContentType.EqualsLiteral(TEXT_CACHE_MANIFEST) ||
- aContentType.EqualsLiteral(TEXT_VTT) ||
- IsScriptType(aContentType);
-}
-
-bool
nsContentUtils::GetWrapperSafeScriptFilename(nsIDocument* aDocument,
nsIURI* aURI,
nsACString& aScriptURI,
diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h
index 0a293d73ea..9ae6d2155d 100644
--- a/dom/base/nsContentUtils.h
+++ b/dom/base/nsContentUtils.h
@@ -1018,12 +1018,7 @@ public:
static bool IsChildOfSameType(nsIDocument* aDoc);
/**
- '* Returns true if the content-type is any of the supported script types.
- */
- static bool IsScriptType(const nsACString& aContentType);
-
- /**
- '* Returns true if the content-type will be rendered as plain-text.
+ * Returns true if the content-type will be rendered as plain-text.
*/
static bool IsPlainTextType(const nsACString& aContentType);
@@ -2038,6 +2033,14 @@ public:
}
/*
+ * Returns true if the performance timing APIs are enabled.
+ */
+ static bool IsPerformanceNavigationTimingEnabled()
+ {
+ return sIsPerformanceNavigationTimingEnabled;
+ }
+
+ /*
* Returns true if notification should be sent for peformance timing events.
*/
static bool SendPerformanceTimingNotifications()
@@ -2830,6 +2833,7 @@ private:
static uint32_t sHandlingInputTimeout;
static bool sIsPerformanceTimingEnabled;
static bool sIsResourceTimingEnabled;
+ static bool sIsPerformanceNavigationTimingEnabled;
static bool sIsUserTimingLoggingEnabled;
static bool sIsFrameTimingPrefEnabled;
static bool sIsExperimentalAutocompleteEnabled;
diff --git a/dom/base/nsDOMNavigationTiming.cpp b/dom/base/nsDOMNavigationTiming.cpp
index 31b2932fbb..32ce8a8cb0 100644
--- a/dom/base/nsDOMNavigationTiming.cpp
+++ b/dom/base/nsDOMNavigationTiming.cpp
@@ -15,6 +15,9 @@
#include "nsPrintfCString.h"
#include "mozilla/dom/PerformanceNavigation.h"
#include "mozilla/TimeStamp.h"
+#include "mozilla/Telemetry.h"
+
+using namespace mozilla;
nsDOMNavigationTiming::nsDOMNavigationTiming()
{
@@ -30,47 +33,36 @@ nsDOMNavigationTiming::Clear()
{
mNavigationType = TYPE_RESERVED;
mNavigationStartHighRes = 0;
- mBeforeUnloadStart = 0;
- mUnloadStart = 0;
- mUnloadEnd = 0;
- mLoadEventStart = 0;
- mLoadEventEnd = 0;
- mDOMLoading = 0;
- mDOMInteractive = 0;
- mDOMContentLoadedEventStart = 0;
- mDOMContentLoadedEventEnd = 0;
- mDOMComplete = 0;
-
- mLoadEventStartSet = false;
- mLoadEventEndSet = false;
- mDOMLoadingSet = false;
- mDOMInteractiveSet = false;
- mDOMContentLoadedEventStartSet = false;
- mDOMContentLoadedEventEndSet = false;
- mDOMCompleteSet = false;
+ mBeforeUnloadStart = TimeStamp();
+ mUnloadStart = TimeStamp();
+ mUnloadEnd = TimeStamp();
+ mLoadEventStart = TimeStamp();
+ mLoadEventEnd = TimeStamp();
+ mDOMLoading = TimeStamp();
+ mDOMInteractive = TimeStamp();
+ mDOMContentLoadedEventStart = TimeStamp();
+ mDOMContentLoadedEventEnd = TimeStamp();
+ mDOMComplete = TimeStamp();
+
mDocShellHasBeenActiveSinceNavigationStart = false;
}
DOMTimeMilliSec
-nsDOMNavigationTiming::TimeStampToDOM(mozilla::TimeStamp aStamp) const
+nsDOMNavigationTiming::TimeStampToDOM(TimeStamp aStamp) const
{
if (aStamp.IsNull()) {
return 0;
}
- mozilla::TimeDuration duration = aStamp - mNavigationStartTimeStamp;
- return GetNavigationStart() + static_cast<int64_t>(duration.ToMilliseconds());
-}
-DOMTimeMilliSec nsDOMNavigationTiming::DurationFromStart()
-{
- return TimeStampToDOM(mozilla::TimeStamp::Now());
+ TimeDuration duration = aStamp - mNavigationStart;
+ return GetNavigationStart() + static_cast<int64_t>(duration.ToMilliseconds());
}
void
nsDOMNavigationTiming::NotifyNavigationStart(DocShellState aDocShellState)
{
mNavigationStartHighRes = (double)PR_Now() / PR_USEC_PER_MSEC;
- mNavigationStartTimeStamp = mozilla::TimeStamp::Now();
+ mNavigationStart = TimeStamp::Now();
mDocShellHasBeenActiveSinceNavigationStart = (aDocShellState == DocShellState::eActive);
}
@@ -86,7 +78,7 @@ nsDOMNavigationTiming::NotifyFetchStart(nsIURI* aURI, Type aNavigationType)
void
nsDOMNavigationTiming::NotifyBeforeUnload()
{
- mBeforeUnloadStart = DurationFromStart();
+ mBeforeUnloadStart = TimeStamp::Now();
}
void
@@ -99,105 +91,107 @@ nsDOMNavigationTiming::NotifyUnloadAccepted(nsIURI* aOldURI)
void
nsDOMNavigationTiming::NotifyUnloadEventStart()
{
- mUnloadStart = DurationFromStart();
+ mUnloadStart = TimeStamp::Now();
}
void
nsDOMNavigationTiming::NotifyUnloadEventEnd()
{
- mUnloadEnd = DurationFromStart();
+ mUnloadEnd = TimeStamp::Now();
}
void
nsDOMNavigationTiming::NotifyLoadEventStart()
{
- if (!mLoadEventStartSet) {
- mLoadEventStart = DurationFromStart();
- mLoadEventStartSet = true;
+ if (!mLoadEventStart.IsNull()) {
+ return;
}
+ mLoadEventStart = TimeStamp::Now();
}
void
nsDOMNavigationTiming::NotifyLoadEventEnd()
{
- if (!mLoadEventEndSet) {
- mLoadEventEnd = DurationFromStart();
- mLoadEventEndSet = true;
+ if (!mLoadEventEnd.IsNull()) {
+ return;
}
+ mLoadEventEnd = TimeStamp::Now();
}
void
-nsDOMNavigationTiming::SetDOMLoadingTimeStamp(nsIURI* aURI, mozilla::TimeStamp aValue)
+nsDOMNavigationTiming::SetDOMLoadingTimeStamp(nsIURI* aURI, TimeStamp aValue)
{
- if (!mDOMLoadingSet) {
- mLoadedURI = aURI;
- mDOMLoading = TimeStampToDOM(aValue);
- mDOMLoadingSet = true;
+ if (!mDOMLoading.IsNull()) {
+ return;
}
+ mLoadedURI = aURI;
+ mDOMLoading = aValue;
}
void
nsDOMNavigationTiming::NotifyDOMLoading(nsIURI* aURI)
{
- if (!mDOMLoadingSet) {
- mLoadedURI = aURI;
- mDOMLoading = DurationFromStart();
- mDOMLoadingSet = true;
+ if (!mDOMLoading.IsNull()) {
+ return;
}
+ mLoadedURI = aURI;
+ mDOMLoading = TimeStamp::Now();
}
void
nsDOMNavigationTiming::NotifyDOMInteractive(nsIURI* aURI)
{
- if (!mDOMInteractiveSet) {
- mLoadedURI = aURI;
- mDOMInteractive = DurationFromStart();
- mDOMInteractiveSet = true;
+ if (!mDOMInteractive.IsNull()) {
+ return;
}
+ mLoadedURI = aURI;
+ mDOMInteractive = TimeStamp::Now();
}
void
nsDOMNavigationTiming::NotifyDOMComplete(nsIURI* aURI)
{
- if (!mDOMCompleteSet) {
- mLoadedURI = aURI;
- mDOMComplete = DurationFromStart();
- mDOMCompleteSet = true;
+ if (!mDOMComplete.IsNull()) {
+ return;
}
+ mLoadedURI = aURI;
+ mDOMComplete = TimeStamp::Now();
}
void
nsDOMNavigationTiming::NotifyDOMContentLoadedStart(nsIURI* aURI)
{
- if (!mDOMContentLoadedEventStartSet) {
- mLoadedURI = aURI;
- mDOMContentLoadedEventStart = DurationFromStart();
- mDOMContentLoadedEventStartSet = true;
+ if (!mDOMContentLoadedEventStart.IsNull()) {
+ return;
}
+
+ mLoadedURI = aURI;
+ mDOMContentLoadedEventStart = TimeStamp::Now();
}
void
nsDOMNavigationTiming::NotifyDOMContentLoadedEnd(nsIURI* aURI)
{
- if (!mDOMContentLoadedEventEndSet) {
- mLoadedURI = aURI;
- mDOMContentLoadedEventEnd = DurationFromStart();
- mDOMContentLoadedEventEndSet = true;
+ if (!mDOMContentLoadedEventEnd.IsNull()) {
+ return;
}
+
+ mLoadedURI = aURI;
+ mDOMContentLoadedEventEnd = TimeStamp::Now();
}
void
nsDOMNavigationTiming::NotifyNonBlankPaintForRootContentDocument()
{
MOZ_ASSERT(NS_IsMainThread());
- MOZ_ASSERT(!mNavigationStartTimeStamp.IsNull());
+ MOZ_ASSERT(!mNavigationStart.IsNull());
- if (!mNonBlankPaintTimeStamp.IsNull()) {
+ if (!mNonBlankPaint.IsNull()) {
return;
}
- mNonBlankPaintTimeStamp = TimeStamp::Now();
- TimeDuration elapsed = mNonBlankPaintTimeStamp - mNavigationStartTimeStamp;
+ mNonBlankPaint = TimeStamp::Now();
+ TimeDuration elapsed = mNonBlankPaint - mNavigationStart;
if (profiler_is_active()) {
nsAutoCString spec;
@@ -212,8 +206,8 @@ nsDOMNavigationTiming::NotifyNonBlankPaintForRootContentDocument()
if (mDocShellHasBeenActiveSinceNavigationStart) {
Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_NON_BLANK_PAINT_MS,
- mNavigationStartTimeStamp,
- mNonBlankPaintTimeStamp);
+ mNavigationStart,
+ mNonBlankPaint);
}
}
@@ -224,24 +218,24 @@ nsDOMNavigationTiming::NotifyDocShellStateChanged(DocShellState aDocShellState)
(aDocShellState == DocShellState::eActive);
}
-DOMTimeMilliSec
-nsDOMNavigationTiming::GetUnloadEventStart()
+mozilla::TimeStamp
+nsDOMNavigationTiming::GetUnloadEventStartTimeStamp() const
{
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
nsresult rv = ssm->CheckSameOriginURI(mLoadedURI, mUnloadedURI, false);
if (NS_SUCCEEDED(rv)) {
return mUnloadStart;
}
- return 0;
+ return mozilla::TimeStamp();
}
-DOMTimeMilliSec
-nsDOMNavigationTiming::GetUnloadEventEnd()
+mozilla::TimeStamp
+nsDOMNavigationTiming::GetUnloadEventEndTimeStamp() const
{
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
nsresult rv = ssm->CheckSameOriginURI(mLoadedURI, mUnloadedURI, false);
if (NS_SUCCEEDED(rv)) {
return mUnloadEnd;
}
- return 0;
+ return mozilla::TimeStamp();
}
diff --git a/dom/base/nsDOMNavigationTiming.h b/dom/base/nsDOMNavigationTiming.h
index 9babece963..3be2527caf 100644
--- a/dom/base/nsDOMNavigationTiming.h
+++ b/dom/base/nsDOMNavigationTiming.h
@@ -47,38 +47,91 @@ public:
mozilla::TimeStamp GetNavigationStartTimeStamp() const
{
- return mNavigationStartTimeStamp;
+ return mNavigationStart;
+ }
+
+ DOMTimeMilliSec GetUnloadEventStart()
+ {
+ return TimeStampToDOM(GetUnloadEventStartTimeStamp());
+ }
+
+ DOMTimeMilliSec GetUnloadEventEnd()
+ {
+ return TimeStampToDOM(GetUnloadEventEndTimeStamp());
}
- DOMTimeMilliSec GetUnloadEventStart();
- DOMTimeMilliSec GetUnloadEventEnd();
DOMTimeMilliSec GetDomLoading() const
{
- return mDOMLoading;
+ return TimeStampToDOM(mDOMLoading);
}
DOMTimeMilliSec GetDomInteractive() const
{
- return mDOMInteractive;
+ return TimeStampToDOM(mDOMInteractive);
}
DOMTimeMilliSec GetDomContentLoadedEventStart() const
{
- return mDOMContentLoadedEventStart;
+ return TimeStampToDOM(mDOMContentLoadedEventStart);
}
DOMTimeMilliSec GetDomContentLoadedEventEnd() const
{
- return mDOMContentLoadedEventEnd;
+ return TimeStampToDOM(mDOMContentLoadedEventEnd);
}
DOMTimeMilliSec GetDomComplete() const
{
- return mDOMComplete;
+ return TimeStampToDOM(mDOMComplete);
}
DOMTimeMilliSec GetLoadEventStart() const
{
- return mLoadEventStart;
+ return TimeStampToDOM(mLoadEventStart);
}
DOMTimeMilliSec GetLoadEventEnd() const
{
- return mLoadEventEnd;
+ return TimeStampToDOM(mLoadEventEnd);
+ }
+ DOMTimeMilliSec GetTimeToNonBlankPaint() const
+ {
+ return TimeStampToDOM(mNonBlankPaint);
+ }
+
+ DOMHighResTimeStamp GetUnloadEventStartHighRes()
+ {
+ mozilla::TimeStamp stamp = GetUnloadEventStartTimeStamp();
+ if (stamp.IsNull()) {
+ return 0;
+ }
+ return TimeStampToDOMHighRes(stamp);
+ }
+ DOMHighResTimeStamp GetUnloadEventEndHighRes()
+ {
+ mozilla::TimeStamp stamp = GetUnloadEventEndTimeStamp();
+ if (stamp.IsNull()) {
+ return 0;
+ }
+ return TimeStampToDOMHighRes(stamp);
+ }
+ DOMHighResTimeStamp GetDomInteractiveHighRes() const
+ {
+ return TimeStampToDOMHighRes(mDOMInteractive);
+ }
+ DOMHighResTimeStamp GetDomContentLoadedEventStartHighRes() const
+ {
+ return TimeStampToDOMHighRes(mDOMContentLoadedEventStart);
+ }
+ DOMHighResTimeStamp GetDomContentLoadedEventEndHighRes() const
+ {
+ return TimeStampToDOMHighRes(mDOMContentLoadedEventEnd);
+ }
+ DOMHighResTimeStamp GetDomCompleteHighRes() const
+ {
+ return TimeStampToDOMHighRes(mDOMComplete);
+ }
+ DOMHighResTimeStamp GetLoadEventStartHighRes() const
+ {
+ return TimeStampToDOMHighRes(mLoadEventStart);
+ }
+ DOMHighResTimeStamp GetLoadEventEndHighRes() const
+ {
+ return TimeStampToDOMHighRes(mLoadEventEnd);
}
enum class DocShellState : uint8_t {
@@ -108,9 +161,13 @@ public:
DOMTimeMilliSec TimeStampToDOM(mozilla::TimeStamp aStamp) const;
- inline DOMHighResTimeStamp TimeStampToDOMHighRes(mozilla::TimeStamp aStamp)
+ inline DOMHighResTimeStamp TimeStampToDOMHighRes(mozilla::TimeStamp aStamp) const
{
- mozilla::TimeDuration duration = aStamp - mNavigationStartTimeStamp;
+ MOZ_ASSERT(!aStamp.IsNull(), "The timestamp should not be null");
+ if (aStamp.IsNull()) {
+ return 0;
+ }
+ mozilla::TimeDuration duration = aStamp - mNavigationStart;
return duration.ToMilliseconds();
}
@@ -120,37 +177,29 @@ private:
void Clear();
+ mozilla::TimeStamp GetUnloadEventStartTimeStamp() const;
+ mozilla::TimeStamp GetUnloadEventEndTimeStamp() const;
+
nsCOMPtr<nsIURI> mUnloadedURI;
nsCOMPtr<nsIURI> mLoadedURI;
Type mNavigationType;
DOMHighResTimeStamp mNavigationStartHighRes;
- mozilla::TimeStamp mNavigationStartTimeStamp;
- mozilla::TimeStamp mNonBlankPaintTimeStamp;
- DOMTimeMilliSec DurationFromStart();
-
- DOMTimeMilliSec mBeforeUnloadStart;
- DOMTimeMilliSec mUnloadStart;
- DOMTimeMilliSec mUnloadEnd;
- DOMTimeMilliSec mLoadEventStart;
- DOMTimeMilliSec mLoadEventEnd;
-
- DOMTimeMilliSec mDOMLoading;
- DOMTimeMilliSec mDOMInteractive;
- DOMTimeMilliSec mDOMContentLoadedEventStart;
- DOMTimeMilliSec mDOMContentLoadedEventEnd;
- DOMTimeMilliSec mDOMComplete;
-
- // Booleans to keep track of what things we've already been notified
- // about. We don't update those once we've been notified about them
- // once.
- bool mLoadEventStartSet : 1;
- bool mLoadEventEndSet : 1;
- bool mDOMLoadingSet : 1;
- bool mDOMInteractiveSet : 1;
- bool mDOMContentLoadedEventStartSet : 1;
- bool mDOMContentLoadedEventEndSet : 1;
- bool mDOMCompleteSet : 1;
+ mozilla::TimeStamp mNavigationStart;
+ mozilla::TimeStamp mNonBlankPaint;
+
+ mozilla::TimeStamp mBeforeUnloadStart;
+ mozilla::TimeStamp mUnloadStart;
+ mozilla::TimeStamp mUnloadEnd;
+ mozilla::TimeStamp mLoadEventStart;
+ mozilla::TimeStamp mLoadEventEnd;
+
+ mozilla::TimeStamp mDOMLoading;
+ mozilla::TimeStamp mDOMInteractive;
+ mozilla::TimeStamp mDOMContentLoadedEventStart;
+ mozilla::TimeStamp mDOMContentLoadedEventEnd;
+ mozilla::TimeStamp mDOMComplete;
+
bool mDocShellHasBeenActiveSinceNavigationStart : 1;
};
diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp
index eaea49b02b..fd3b529481 100644
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -2054,10 +2054,17 @@ nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup,
mFirstChild = content->GetNextSibling();
}
mChildren.RemoveChildAt(i);
+ if (content == mCachedRootElement) {
+ // Immediately clear mCachedRootElement, now that it's been removed
+ // from mChildren, so that GetRootElement() will stop returning this
+ // now-stale value.
+ mCachedRootElement = nullptr;
+ }
nsNodeUtils::ContentRemoved(this, content, i, previousSibling);
content->UnbindFromTree();
}
- mCachedRootElement = nullptr;
+ MOZ_ASSERT(!mCachedRootElement,
+ "After removing all children, there should be no root elem");
}
mInUnlinkOrDeletion = oldVal;
@@ -3913,8 +3920,18 @@ nsDocument::RemoveChildAt(uint32_t aIndex, bool aNotify)
DestroyElementMaps();
}
- doRemoveChildAt(aIndex, aNotify, oldKid, mChildren);
+ // Preemptively clear mCachedRootElement, since we may be about to remove it
+ // from our child list, and we don't want to return this maybe-obsolete value
+ // from any GetRootElement() calls that happen inside of doRemoveChildAt().
+ // (NOTE: for this to be useful, doRemoveChildAt() must NOT trigger any
+ // GetRootElement() calls until after it's removed the child from mChildren.
+ // Any call before that point would restore this soon-to-be-obsolete cached
+ // answer, and our clearing here would be fruitless.)
mCachedRootElement = nullptr;
+ doRemoveChildAt(aIndex, aNotify, oldKid, mChildren);
+ MOZ_ASSERT(mCachedRootElement != oldKid,
+ "Stale pointer in mCachedRootElement, after we tried to clear it "
+ "(maybe somebody called GetRootElement() too early?)");
}
void
@@ -12846,3 +12863,19 @@ nsDocument::CheckCustomElementName(const ElementCreationOptions& aOptions,
return is;
}
+
+Selection*
+nsIDocument::GetSelection(ErrorResult& aRv)
+{
+ nsCOMPtr<nsPIDOMWindowInner> window = GetInnerWindow();
+ if (!window) {
+ return nullptr;
+ }
+
+ NS_ASSERTION(window->IsInnerWindow(), "Should have inner window here!");
+ if (!window->IsCurrentInnerWindow()) {
+ return nullptr;
+ }
+
+ return nsGlobalWindow::Cast(window)->GetSelection(aRv);
+}
diff --git a/dom/base/nsDocumentEncoder.cpp b/dom/base/nsDocumentEncoder.cpp
index 0a35709629..84b128b159 100644
--- a/dom/base/nsDocumentEncoder.cpp
+++ b/dom/base/nsDocumentEncoder.cpp
@@ -481,7 +481,7 @@ nsDocumentEncoder::SerializeToStringRecursive(nsINode* aNode,
}
if (!aDontSerializeRoot) {
- rv = SerializeNodeEnd(node, aStr);
+ rv = SerializeNodeEnd(maybeFixedNode, aStr);
NS_ENSURE_SUCCESS(rv, rv);
}
diff --git a/dom/base/nsFrameMessageManager.cpp b/dom/base/nsFrameMessageManager.cpp
index a4bba48560..049bc0a1ae 100644
--- a/dom/base/nsFrameMessageManager.cpp
+++ b/dom/base/nsFrameMessageManager.cpp
@@ -51,10 +51,6 @@
#include <algorithm>
#include "chrome/common/ipc_channel.h" // for IPC::Channel::kMaximumMessageSize
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
-
#ifdef ANDROID
#include <android/log.h>
#endif
diff --git a/dom/base/nsGkAtomList.h b/dom/base/nsGkAtomList.h
index 9484870831..50b4449ecf 100644
--- a/dom/base/nsGkAtomList.h
+++ b/dom/base/nsGkAtomList.h
@@ -705,6 +705,7 @@ GK_ATOM(onattributechanged, "onattributechanged")
GK_ATOM(onattributereadreq, "onattributereadreq")
GK_ATOM(onattributewritereq, "onattributewritereq")
GK_ATOM(onaudioprocess, "onaudioprocess")
+GK_ATOM(onauxclick, "onauxclick")
GK_ATOM(onbeforecopy, "onbeforecopy")
GK_ATOM(onbeforecut, "onbeforecut")
GK_ATOM(onbeforepaste, "onbeforepaste")
diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp
index f784031f6a..738703ef1c 100644
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -23,6 +23,7 @@
#include "mozilla/dom/StorageEvent.h"
#include "mozilla/dom/StorageEventBinding.h"
#include "mozilla/dom/Timeout.h"
+#include "mozilla/dom/TimeoutHandler.h"
#include "mozilla/IntegerPrintfMacros.h"
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
#include "mozilla/dom/WindowOrientationObserver.h"
@@ -552,29 +553,284 @@ DialogValueHolder::Get(JSContext* aCx, JS::Handle<JSObject*> aScope,
}
}
+class IdleRequestExecutor final : public nsIRunnable
+ , public nsICancelableRunnable
+ , public nsIIncrementalRunnable
+{
+public:
+ explicit IdleRequestExecutor(nsGlobalWindow* aWindow)
+ : mDispatched(false)
+ , mDeadline(TimeStamp::Now())
+ , mWindow(aWindow)
+ {
+ MOZ_DIAGNOSTIC_ASSERT(mWindow);
+ MOZ_DIAGNOSTIC_ASSERT(mWindow->IsInnerWindow());
+ }
+
+ NS_DECL_CYCLE_COLLECTING_ISUPPORTS
+ NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(IdleRequestExecutor, nsIRunnable)
+
+ NS_DECL_NSIRUNNABLE
+ nsresult Cancel() override;
+ void SetDeadline(TimeStamp aDeadline) override;
+
+ void MaybeDispatch();
+private:
+ ~IdleRequestExecutor() {}
+
+ bool mDispatched;
+ TimeStamp mDeadline;
+ RefPtr<nsGlobalWindow> mWindow;
+};
+
+NS_IMPL_CYCLE_COLLECTION_CLASS(IdleRequestExecutor)
+
+NS_IMPL_CYCLE_COLLECTING_ADDREF(IdleRequestExecutor)
+NS_IMPL_CYCLE_COLLECTING_RELEASE(IdleRequestExecutor)
+
+NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(IdleRequestExecutor)
+ NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindow)
+NS_IMPL_CYCLE_COLLECTION_UNLINK_END
+
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(IdleRequestExecutor)
+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow)
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
+
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(IdleRequestExecutor)
+ NS_INTERFACE_MAP_ENTRY(nsIRunnable)
+ NS_INTERFACE_MAP_ENTRY(nsICancelableRunnable)
+ NS_INTERFACE_MAP_ENTRY(nsIIncrementalRunnable)
+ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIRunnable)
+NS_INTERFACE_MAP_END
+
+NS_IMETHODIMP
+IdleRequestExecutor::Run()
+{
+ MOZ_ASSERT(NS_IsMainThread());
+
+ mDispatched = false;
+ if (mWindow) {
+ return mWindow->ExecuteIdleRequest(mDeadline);
+ }
+
+ return NS_OK;
+}
+
+nsresult
+IdleRequestExecutor::Cancel()
+{
+ MOZ_ASSERT(NS_IsMainThread());
+
+ mWindow = nullptr;
+ return NS_OK;
+}
+
void
-nsGlobalWindow::PostThrottledIdleCallback()
+IdleRequestExecutor::SetDeadline(TimeStamp aDeadline)
{
- AssertIsOnMainThread();
+ MOZ_ASSERT(NS_IsMainThread());
- if (mThrottledIdleRequestCallbacks.isEmpty())
+ if (!mWindow) {
return;
+ }
- RefPtr<IdleRequest> request(mThrottledIdleRequestCallbacks.popFirst());
- // ownership transferred from mThrottledIdleRequestCallbacks to
- // mIdleRequestCallbacks
- mIdleRequestCallbacks.insertBack(request);
+ mDeadline = aDeadline;
+}
+
+void
+IdleRequestExecutor::MaybeDispatch()
+{
+ // If we've already dispatched the executor we don't want to do it
+ // again. Also, if we've called IdleRequestExecutor::Cancel mWindow
+ // will be null, which indicates that we shouldn't dispatch this
+ // executor either.
+ if (mDispatched || !mWindow) {
+ return;
+ }
+
+ mDispatched = true;
+ RefPtr<IdleRequestExecutor> request = this;
NS_IdleDispatchToCurrentThread(request.forget());
}
-/* static */ void
-nsGlobalWindow::InsertIdleCallbackIntoList(IdleRequest* aRequest,
- IdleRequests& aList)
+class IdleRequestExecutorTimeoutHandler final : public TimeoutHandler
{
- aList.insertBack(aRequest);
+public:
+ explicit IdleRequestExecutorTimeoutHandler(IdleRequestExecutor* aExecutor)
+ : mExecutor(aExecutor)
+ {
+ }
+
+ NS_DECL_ISUPPORTS_INHERITED
+ NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(IdleRequestExecutorTimeoutHandler,
+ TimeoutHandler)
+
+ nsresult Call() override
+ {
+ mExecutor->MaybeDispatch();
+ return NS_OK;
+ }
+private:
+ ~IdleRequestExecutorTimeoutHandler() {}
+ RefPtr<IdleRequestExecutor> mExecutor;
+};
+
+NS_IMPL_CYCLE_COLLECTION_INHERITED(IdleRequestExecutorTimeoutHandler, TimeoutHandler, mExecutor)
+
+NS_IMPL_ADDREF_INHERITED(IdleRequestExecutorTimeoutHandler, TimeoutHandler)
+NS_IMPL_RELEASE_INHERITED(IdleRequestExecutorTimeoutHandler, TimeoutHandler)
+
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(IdleRequestExecutorTimeoutHandler)
+ NS_INTERFACE_MAP_ENTRY(nsITimeoutHandler)
+NS_INTERFACE_MAP_END_INHERITING(TimeoutHandler)
+
+void
+nsGlobalWindow::ScheduleIdleRequestDispatch()
+{
+ AssertIsOnMainThread();
+
+ if (mIdleRequestCallbacks.isEmpty()) {
+ if (mIdleRequestExecutor) {
+ mIdleRequestExecutor->Cancel();
+ mIdleRequestExecutor = nullptr;
+ }
+
+ return;
+ }
+
+ if (!mIdleRequestExecutor) {
+ mIdleRequestExecutor = new IdleRequestExecutor(this);
+ }
+
+ nsPIDOMWindowOuter* outer = GetOuterWindow();
+ if (outer && outer->AsOuter()->IsBackground()) {
+ nsCOMPtr<nsITimeoutHandler> handler = new IdleRequestExecutorTimeoutHandler(mIdleRequestExecutor);
+ int32_t dummy;
+ // Set a timeout handler with a timeout of 0 ms to throttle idle
+ // callback requests coming from a backround window using
+ // background timeout throttling.
+ SetTimeoutOrInterval(handler, 0, false,
+ Timeout::Reason::eIdleCallbackTimeout, &dummy);
+ return;
+ }
+
+ mIdleRequestExecutor->MaybeDispatch();
+}
+
+void
+nsGlobalWindow::SuspendIdleRequests()
+{
+ if (mIdleRequestExecutor) {
+ mIdleRequestExecutor->Cancel();
+ mIdleRequestExecutor = nullptr;
+ }
+}
+
+void
+nsGlobalWindow::ResumeIdleRequests()
+{
+ MOZ_ASSERT(!mIdleRequestExecutor);
+
+ ScheduleIdleRequestDispatch();
+}
+
+void
+nsGlobalWindow::InsertIdleCallback(IdleRequest* aRequest)
+{
+ AssertIsOnMainThread();
+ mIdleRequestCallbacks.insertBack(aRequest);
aRequest->AddRef();
}
+void
+nsGlobalWindow::RemoveIdleCallback(mozilla::dom::IdleRequest* aRequest)
+{
+ AssertIsOnMainThread();
+
+ if (aRequest->HasTimeout()) {
+ ClearTimeoutOrInterval(aRequest->GetTimeoutHandle(),
+ Timeout::Reason::eIdleCallbackTimeout);
+ }
+
+ aRequest->removeFrom(mIdleRequestCallbacks);
+ aRequest->Release();
+}
+
+nsresult
+nsGlobalWindow::RunIdleRequest(IdleRequest* aRequest,
+ DOMHighResTimeStamp aDeadline,
+ bool aDidTimeout)
+{
+ AssertIsOnMainThread();
+ RefPtr<IdleRequest> request(aRequest);
+ RemoveIdleCallback(request);
+ return request->IdleRun(AsInner(), aDeadline, aDidTimeout);
+}
+
+nsresult
+nsGlobalWindow::ExecuteIdleRequest(TimeStamp aDeadline)
+{
+ AssertIsOnMainThread();
+ RefPtr<IdleRequest> request = mIdleRequestCallbacks.getFirst();
+
+ if (!request) {
+ // There are no more idle requests, so stop scheduling idle
+ // request callbacks.
+ return NS_OK;
+ }
+
+ DOMHighResTimeStamp deadline = 0.0;
+
+ if (Performance* perf = GetPerformance()) {
+ deadline = perf->GetDOMTiming()->TimeStampToDOMHighRes(aDeadline);
+ }
+
+ nsresult result = RunIdleRequest(request, deadline, false);
+
+ ScheduleIdleRequestDispatch();
+ return result;
+}
+
+class IdleRequestTimeoutHandler final : public TimeoutHandler
+{
+public:
+ IdleRequestTimeoutHandler(JSContext* aCx,
+ IdleRequest* aIdleRequest,
+ nsPIDOMWindowInner* aWindow)
+ : TimeoutHandler(aCx)
+ , mIdleRequest(aIdleRequest)
+ , mWindow(aWindow)
+ {
+ }
+
+ NS_DECL_ISUPPORTS_INHERITED
+ NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(IdleRequestTimeoutHandler,
+ TimeoutHandler)
+
+ nsresult Call() override
+ {
+ return nsGlobalWindow::Cast(mWindow)->RunIdleRequest(mIdleRequest, 0.0, true);
+ }
+
+private:
+ ~IdleRequestTimeoutHandler() {}
+
+ RefPtr<IdleRequest> mIdleRequest;
+ nsCOMPtr<nsPIDOMWindowInner> mWindow;
+};
+
+NS_IMPL_CYCLE_COLLECTION_INHERITED(IdleRequestTimeoutHandler,
+ TimeoutHandler,
+ mIdleRequest,
+ mWindow)
+
+NS_IMPL_ADDREF_INHERITED(IdleRequestTimeoutHandler, TimeoutHandler)
+NS_IMPL_RELEASE_INHERITED(IdleRequestTimeoutHandler, TimeoutHandler)
+
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(IdleRequestTimeoutHandler)
+ NS_INTERFACE_MAP_ENTRY(nsITimeoutHandler)
+NS_INTERFACE_MAP_END_INHERITING(TimeoutHandler)
+
uint32_t
nsGlobalWindow::RequestIdleCallback(JSContext* aCx,
IdleRequestCallback& aCallback,
@@ -584,33 +840,36 @@ nsGlobalWindow::RequestIdleCallback(JSContext* aCx,
MOZ_RELEASE_ASSERT(IsInnerWindow());
AssertIsOnMainThread();
- uint32_t handle = ++mIdleRequestCallbackCounter;
+ uint32_t handle = mIdleRequestCallbackCounter++;
RefPtr<IdleRequest> request =
- new IdleRequest(aCx, AsInner(), aCallback, handle);
+ new IdleRequest(&aCallback, handle);
if (aOptions.mTimeout.WasPassed()) {
- aError = request->SetTimeout(aOptions.mTimeout.Value());
- if (NS_WARN_IF(aError.Failed())) {
+ int32_t timeoutHandle;
+ nsCOMPtr<nsITimeoutHandler> handler(new IdleRequestTimeoutHandler(aCx, request, AsInner()));
+
+ nsresult rv = SetTimeoutOrInterval(
+ handler, aOptions.mTimeout.Value(), false,
+ Timeout::Reason::eIdleCallbackTimeout, &timeoutHandle);
+
+ if (NS_WARN_IF(NS_FAILED(rv))) {
return 0;
}
- }
-
- nsGlobalWindow* outer = GetOuterWindowInternal();
- if (outer && outer->AsOuter()->IsBackground()) {
- // mThrottledIdleRequestCallbacks now owns request
- InsertIdleCallbackIntoList(request, mThrottledIdleRequestCallbacks);
- NS_DelayedDispatchToCurrentThread(
- NewRunnableMethod(this, &nsGlobalWindow::PostThrottledIdleCallback),
- 10000);
- } else {
- MOZ_ASSERT(mThrottledIdleRequestCallbacks.isEmpty());
+ request->SetTimeoutHandle(timeoutHandle);
+ }
- // mIdleRequestCallbacks now owns request
- InsertIdleCallbackIntoList(request, mIdleRequestCallbacks);
+ // If the list of idle callback requests is not empty it means that
+ // we've already dispatched the first idle request. If we're
+ // suspended we should only queue the idle callback and not schedule
+ // it to run, that will be done in ResumeIdleRequest.
+ bool needsScheduling = !IsSuspended() && mIdleRequestCallbacks.isEmpty();
+ // mIdleRequestCallbacks now owns request
+ InsertIdleCallback(request);
- NS_IdleDispatchToCurrentThread(request.forget());
+ if (needsScheduling) {
+ ScheduleIdleRequestDispatch();
}
return handle;
@@ -623,7 +882,7 @@ nsGlobalWindow::CancelIdleCallback(uint32_t aHandle)
for (IdleRequest* r : mIdleRequestCallbacks) {
if (r->Handle() == aHandle) {
- r->Cancel();
+ RemoveIdleCallback(r);
break;
}
}
@@ -632,29 +891,17 @@ nsGlobalWindow::CancelIdleCallback(uint32_t aHandle)
void
nsGlobalWindow::DisableIdleCallbackRequests()
{
- while (!mIdleRequestCallbacks.isEmpty()) {
- RefPtr<IdleRequest> request = mIdleRequestCallbacks.popFirst();
- request->Cancel();
+ if (mIdleRequestExecutor) {
+ mIdleRequestExecutor->Cancel();
+ mIdleRequestExecutor = nullptr;
}
- while (!mThrottledIdleRequestCallbacks.isEmpty()) {
- RefPtr<IdleRequest> request = mThrottledIdleRequestCallbacks.popFirst();
- request->Cancel();
- }
-}
-
-void nsGlobalWindow::UnthrottleIdleCallbackRequests()
-{
- AssertIsOnMainThread();
-
- while (!mThrottledIdleRequestCallbacks.isEmpty()) {
- RefPtr<IdleRequest> request(mThrottledIdleRequestCallbacks.popFirst());
- mIdleRequestCallbacks.insertBack(request);
- NS_IdleDispatchToCurrentThread(request.forget());
+ while (!mIdleRequestCallbacks.isEmpty()) {
+ RefPtr<IdleRequest> request = mIdleRequestCallbacks.getFirst();
+ RemoveIdleCallback(request);
}
}
-
namespace mozilla {
namespace dom {
extern uint64_t
@@ -1306,6 +1553,7 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow)
mSerial(0),
mIdleCallbackTimeoutCounter(1),
mIdleRequestCallbackCounter(1),
+ mIdleRequestExecutor(nullptr),
#ifdef DEBUG
mSetOpenerWindowCalled(false),
#endif
@@ -2033,14 +2281,11 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGlobalWindow)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWakeLock)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPendingStorageEvents)
+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mIdleRequestExecutor)
for (IdleRequest* request : tmp->mIdleRequestCallbacks) {
cb.NoteNativeChild(request, NS_CYCLE_COLLECTION_PARTICIPANT(IdleRequest));
}
- for (IdleRequest* request : tmp->mThrottledIdleRequestCallbacks) {
- cb.NoteNativeChild(request, NS_CYCLE_COLLECTION_PARTICIPANT(IdleRequest));
- }
-
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mIdleObservers)
#ifdef MOZ_GAMEPAD
@@ -2147,6 +2392,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindow)
tmp->UnlinkHostObjectURIs();
+ NS_IMPL_CYCLE_COLLECTION_UNLINK(mIdleRequestExecutor)
tmp->DisableIdleCallbackRequests();
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
@@ -2878,8 +3124,7 @@ nsGlobalWindow::SetNewDocument(nsIDocument* aDocument,
newInnerWindow->mPerformance =
Performance::CreateForMainThread(newInnerWindow->AsInner(),
currentInner->mPerformance->GetDOMTiming(),
- currentInner->mPerformance->GetChannel(),
- currentInner->mPerformance->GetParentPerformance());
+ currentInner->mPerformance->GetChannel());
}
}
@@ -4093,22 +4338,7 @@ nsPIDOMWindowInner::CreatePerformanceObjectIfNeeded()
timedChannel = nullptr;
}
if (timing) {
- // If we are dealing with an iframe, we will need the parent's performance
- // object (so we can add the iframe as a resource of that page).
- Performance* parentPerformance = nullptr;
- nsCOMPtr<nsPIDOMWindowOuter> parentWindow = GetScriptableParentOrNull();
- if (parentWindow) {
- nsPIDOMWindowInner* parentInnerWindow = nullptr;
- if (parentWindow) {
- parentInnerWindow = parentWindow->GetCurrentInnerWindow();
- }
- if (parentInnerWindow) {
- parentPerformance = parentInnerWindow->GetPerformance();
- }
- }
- mPerformance =
- Performance::CreateForMainThread(this, timing, timedChannel,
- parentPerformance);
+ mPerformance = Performance::CreateForMainThread(this, timing, timedChannel);
}
}
@@ -10237,12 +10467,6 @@ void nsGlobalWindow::SetIsBackground(bool aIsBackground)
ResetTimersForThrottleReduction(gMinBackgroundTimeoutValue);
}
- if (!aIsBackground) {
- nsGlobalWindow* inner = GetCurrentInnerWindowInternal();
- if (inner) {
- inner->UnthrottleIdleCallbackRequests();
- }
- }
#ifdef MOZ_GAMEPAD
if (!aIsBackground) {
nsGlobalWindow* inner = GetCurrentInnerWindowInternal();
@@ -12036,6 +12260,8 @@ nsGlobalWindow::Suspend()
mozilla::dom::workers::SuspendWorkersForWindow(AsInner());
+ SuspendIdleRequests();
+
for (Timeout* t = mTimeouts.getFirst(); t; t = t->getNext()) {
// Leave the timers with the current time remaining. This will
// cause the timers to potentially fire when the window is
@@ -12146,6 +12372,8 @@ nsGlobalWindow::Resume()
t->AddRef();
}
+ ResumeIdleRequests();
+
// Resume all of the workers for this window. We must do this
// after timeouts since workers may have queued events that can trigger
// a setTimeout().
diff --git a/dom/base/nsGlobalWindow.h b/dom/base/nsGlobalWindow.h
index dbceeab742..78bee63a19 100644
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -102,6 +102,8 @@ struct nsRect;
class nsWindowSizes;
+class IdleRequestExecutor;
+
namespace mozilla {
class DOMEventTargetHelper;
class ThrottledEventQueue;
@@ -118,6 +120,7 @@ class Gamepad;
enum class ImageBitmapFormat : uint32_t;
class IdleRequest;
class IdleRequestCallback;
+class IncrementalRunnable;
class Location;
class MediaQueryList;
class MozSelfSupport;
@@ -1097,7 +1100,6 @@ public:
mozilla::ErrorResult& aError);
void CancelIdleCallback(uint32_t aHandle);
-
#ifdef MOZ_WEBSPEECH
mozilla::dom::SpeechSynthesis*
GetSpeechSynthesis(mozilla::ErrorResult& aError);
@@ -1762,6 +1764,21 @@ private:
mozilla::dom::TabGroup* TabGroupInner();
mozilla::dom::TabGroup* TabGroupOuter();
+public:
+ void DisableIdleCallbackRequests();
+ uint32_t IdleRequestHandle() const { return mIdleRequestCallbackCounter; }
+ nsresult RunIdleRequest(mozilla::dom::IdleRequest* aRequest,
+ DOMHighResTimeStamp aDeadline, bool aDidTimeout);
+ nsresult ExecuteIdleRequest(TimeStamp aDeadline);
+ void ScheduleIdleRequestDispatch();
+ void SuspendIdleRequests();
+ void ResumeIdleRequests();
+
+ typedef mozilla::LinkedList<mozilla::dom::IdleRequest> IdleRequests;
+ void InsertIdleCallback(mozilla::dom::IdleRequest* aRequest);
+
+ void RemoveIdleCallback(mozilla::dom::IdleRequest* aRequest);
+
protected:
// These members are only used on outer window objects. Make sure
// you never set any of these on an inner object!
@@ -1912,21 +1929,12 @@ protected:
uint32_t mSerial;
- void DisableIdleCallbackRequests();
- void UnthrottleIdleCallbackRequests();
-
- void PostThrottledIdleCallback();
-
- typedef mozilla::LinkedList<mozilla::dom::IdleRequest> IdleRequests;
- static void InsertIdleCallbackIntoList(mozilla::dom::IdleRequest* aRequest,
- IdleRequests& aList);
-
// The current idle request callback timeout handle
uint32_t mIdleCallbackTimeoutCounter;
// The current idle request callback handle
uint32_t mIdleRequestCallbackCounter;
IdleRequests mIdleRequestCallbacks;
- IdleRequests mThrottledIdleRequestCallbacks;
+ RefPtr<IdleRequestExecutor> mIdleRequestExecutor;
#ifdef DEBUG
bool mSetOpenerWindowCalled;
@@ -2002,6 +2010,7 @@ protected:
friend class nsDOMWindowUtils;
friend class mozilla::dom::PostMessageEvent;
friend class DesktopNotification;
+ friend class IdleRequestExecutor;
static WindowByIdTable* sWindowsById;
static bool sWarnedAboutWindowInternal;
diff --git a/dom/base/nsIDocument.h b/dom/base/nsIDocument.h
index 8f35e9ba5f..1e0c9562e2 100644
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -151,6 +151,7 @@ class NodeIterator;
enum class OrientationType : uint32_t;
class ProcessingInstruction;
class Promise;
+class Selection;
class StyleSheetList;
class SVGDocument;
class SVGSVGElement;
@@ -898,6 +899,8 @@ public:
*/
Element* GetRootElement() const;
+ mozilla::dom::Selection* GetSelection(mozilla::ErrorResult& aRv);
+
/**
* Retrieve information about the viewport as a data structure.
* This will return information in the viewport META data section
diff --git a/dom/base/nsINode.cpp b/dom/base/nsINode.cpp
index 3a649a61d0..715ca93eab 100644
--- a/dom/base/nsINode.cpp
+++ b/dom/base/nsINode.cpp
@@ -1907,6 +1907,10 @@ void
nsINode::doRemoveChildAt(uint32_t aIndex, bool aNotify,
nsIContent* aKid, nsAttrAndChildArray& aChildArray)
{
+ // NOTE: This function must not trigger any calls to
+ // nsIDocument::GetRootElement() calls until *after* it has removed aKid from
+ // aChildArray. Any calls before then could potentially restore a stale
+ // value for our cached root element, per note in nsDocument::RemoveChildAt().
NS_PRECONDITION(aKid && aKid->GetParentNode() == this &&
aKid == GetChildAt(aIndex) &&
IndexOf(aKid) == (int32_t)aIndex, "Bogus aKid");
diff --git a/dom/base/nsRange.cpp b/dom/base/nsRange.cpp
index 37ba147afc..4b4ce78857 100644
--- a/dom/base/nsRange.cpp
+++ b/dom/base/nsRange.cpp
@@ -3194,7 +3194,7 @@ nsRange::AutoInvalidateSelection::~AutoInvalidateSelection()
mIsNested = false;
::InvalidateAllFrames(mCommonAncestor);
nsINode* commonAncestor = mRange->GetRegisteredCommonAncestor();
- if (commonAncestor != mCommonAncestor) {
+ if (commonAncestor && commonAncestor != mCommonAncestor) {
::InvalidateAllFrames(commonAncestor);
}
}
diff --git a/dom/base/nsXHTMLContentSerializer.cpp b/dom/base/nsXHTMLContentSerializer.cpp
index 0dc31d7aec..111ed46c71 100644..100755
--- a/dom/base/nsXHTMLContentSerializer.cpp
+++ b/dom/base/nsXHTMLContentSerializer.cpp
@@ -306,7 +306,7 @@ nsXHTMLContentSerializer::SerializeAttributes(nsIContent* aContent,
continue;
}
- BorrowedAttrInfo info = aContent->GetAttrInfoAt(index);
+ mozilla::dom::BorrowedAttrInfo info = aContent->GetAttrInfoAt(index);
const nsAttrName* name = info.mName;
int32_t namespaceID = name->NamespaceID();
diff --git a/dom/base/test/mochitest.ini b/dom/base/test/mochitest.ini
index ea86290d97..ddfd574433 100644
--- a/dom/base/test/mochitest.ini
+++ b/dom/base/test/mochitest.ini
@@ -609,6 +609,7 @@ skip-if = toolkit == 'android'
[test_bug1307730.html]
[test_bug1308069.html]
[test_bug1314032.html]
+[test_bug1375050.html]
[test_caretPositionFromPoint.html]
[test_change_policy.html]
[test_classList.html]
diff --git a/dom/base/test/test_bug403852.html b/dom/base/test/test_bug403852.html
index 30192cb1b4..592711500e 100644
--- a/dom/base/test/test_bug403852.html
+++ b/dom/base/test/test_bug403852.html
@@ -38,7 +38,8 @@ function onOpened(message) {
ok("lastModifiedDate" in domFile, "lastModifiedDate must be present");
var d = new Date(message.mtime);
- is(d.getTime(), domFile.lastModifiedDate.getTime(), "lastModifiedDate should be the same");
+ // Commented out: lastModifiedDate is rounded because it is a DOM API, message is a special-powers Chrome thing
+ // is(d.getTime(), domFile.lastModifiedDate.getTime(), "lastModifiedDate should be the same");
var x = new Date();
@@ -53,8 +54,8 @@ function onOpened(message) {
ok((x.getTime() <= y.getTime()) && (y.getTime() <= z.getTime()), "lastModifiedDate of file which does not have last modified date should be current time");
- var d = new Date(message.fileDate);
- is(d.getTime(), message.fileWithDate.lastModifiedDate.getTime(), "lastModifiedDate should be the same when lastModified is set: " + message.fileWithDate.lastModified);
+ // var d = new Date(message.fileDate);
+ // is(d.getTime(), message.fileWithDate.lastModifiedDate.getTime(), "lastModifiedDate should be the same when lastModified is set: " + message.fileWithDate.lastModified);
script.destroy();
SimpleTest.finish();
diff --git a/dom/base/test/test_file_negative_date.html b/dom/base/test/test_file_negative_date.html
index ebfa9bd0d9..26cf3b82e2 100644
--- a/dom/base/test/test_file_negative_date.html
+++ b/dom/base/test/test_file_negative_date.html
@@ -22,13 +22,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1158437
var blob = new Blob(['hello world']);
var f1 = new File([blob], 'f1.txt', { lastModified: 0 });
-var f2 = new File([blob], 'f2.txt', { lastModified: -1 });
+var f2 = new File([blob], 'f2.txt', { lastModified: -2 });
var f3 = new File([blob], 'f3.txt', { lastModified: -1000 });
is(f1.lastModified, 0, "lastModified == 0 is supported");
ok(f1.lastModifiedDate.toString(), (new Date(0)).toString(), "Correct f1.lastModifiedDate value");
-is(f2.lastModified, -1, "lastModified == -1 is supported");
-ok(f2.lastModifiedDate.toString(), (new Date(-1)).toString(), "Correct f2.lastModifiedDate value");
+is(f2.lastModified, -2, "lastModified == -2 is supported");
+ok(f2.lastModifiedDate.toString(), (new Date(-2)).toString(), "Correct f2.lastModifiedDate value");
is(f3.lastModified, -1000, "lastModified == -1000 is supported");
ok(f3.lastModifiedDate.toString(), (new Date(-1000)).toString(), "Correct f3.lastModifiedDate value");
diff --git a/dom/bindings/BindingUtils.cpp b/dom/bindings/BindingUtils.cpp
index 33f5f7a445..7056658a78 100644
--- a/dom/bindings/BindingUtils.cpp
+++ b/dom/bindings/BindingUtils.cpp
@@ -259,8 +259,8 @@ TErrorResult<CleanupPolicy>::ThrowJSException(JSContext* cx, JS::Handle<JS::Valu
// Make sure mJSException is initialized _before_ we try to root it. But
// don't set it to exn yet, because we don't want to do that until after we
// root.
- mJSException.setUndefined();
- if (!js::AddRawValueRoot(cx, &mJSException, "TErrorResult::mJSException")) {
+ mJSException.asValueRef().setUndefined();
+ if (!js::AddRawValueRoot(cx, &mJSException.asValueRef(), "TErrorResult::mJSException")) {
// Don't use NS_ERROR_DOM_JS_EXCEPTION, because that indicates we have
// in fact rooted mJSException.
mResult = NS_ERROR_OUT_OF_MEMORY;
@@ -289,7 +289,7 @@ TErrorResult<CleanupPolicy>::SetPendingJSException(JSContext* cx)
mJSException = exception;
// If JS_WrapValue failed, not much we can do about it... No matter
// what, go ahead and unroot mJSException.
- js::RemoveRawValueRoot(cx, &mJSException);
+ js::RemoveRawValueRoot(cx, &mJSException.asValueRef());
mResult = NS_OK;
#ifdef DEBUG
@@ -395,8 +395,8 @@ TErrorResult<CleanupPolicy>::ClearUnionData()
if (IsJSException()) {
JSContext* cx = dom::danger::GetJSContext();
MOZ_ASSERT(cx);
- mJSException.setUndefined();
- js::RemoveRawValueRoot(cx, &mJSException);
+ mJSException.asValueRef().setUndefined();
+ js::RemoveRawValueRoot(cx, &mJSException.asValueRef());
#ifdef DEBUG
mUnionState = HasNothing;
#endif // DEBUG
@@ -439,13 +439,13 @@ TErrorResult<CleanupPolicy>::operator=(TErrorResult<CleanupPolicy>&& aRHS)
} else if (aRHS.IsJSException()) {
JSContext* cx = dom::danger::GetJSContext();
MOZ_ASSERT(cx);
- mJSException.setUndefined();
- if (!js::AddRawValueRoot(cx, &mJSException, "TErrorResult::mJSException")) {
+ mJSException.asValueRef().setUndefined();
+ if (!js::AddRawValueRoot(cx, &mJSException.asValueRef(), "TErrorResult::mJSException")) {
MOZ_CRASH("Could not root mJSException, we're about to OOM");
}
mJSException = aRHS.mJSException;
- aRHS.mJSException.setUndefined();
- js::RemoveRawValueRoot(cx, &aRHS.mJSException);
+ aRHS.mJSException.asValueRef().setUndefined();
+ js::RemoveRawValueRoot(cx, &aRHS.mJSException.asValueRef());
} else if (aRHS.IsDOMException()) {
mDOMExceptionInfo = aRHS.mDOMExceptionInfo;
aRHS.mDOMExceptionInfo = nullptr;
@@ -497,7 +497,7 @@ TErrorResult<CleanupPolicy>::CloneTo(TErrorResult& aRv) const
aRv.mUnionState = HasJSException;
#endif
JSContext* cx = dom::danger::GetJSContext();
- JS::Rooted<JS::Value> exception(cx, mJSException);
+ JS::Rooted<JS::Value> exception(cx, mJSException.asValueRef());
aRv.ThrowJSException(cx, exception);
}
}
diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py
index 3174c37ddc..7a66686874 100644
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -1069,6 +1069,20 @@ class CGHeaders(CGWrapper):
if parent:
ancestors.append(parent)
interfaceDeps.extend(ancestors)
+
+ # Include parent interface headers needed for jsonifier code.
+ jsonInterfaceParents = []
+ for desc in descriptors:
+ if not desc.operations['Jsonifier']:
+ continue
+ parent = desc.interface.parent
+ while parent:
+ parentDesc = desc.getDescriptor(parent.identifier.name)
+ if parentDesc.operations['Jsonifier']:
+ jsonInterfaceParents.append(parentDesc.interface)
+ parent = parent.parent
+ interfaceDeps.extend(jsonInterfaceParents)
+
bindingIncludes = set(self.getDeclarationFilename(d) for d in interfaceDeps)
# Grab all the implementation declaration files we need.
diff --git a/dom/bindings/ErrorResult.h b/dom/bindings/ErrorResult.h
index c45e7ea3b3..7c3fc9e2f9 100644
--- a/dom/bindings/ErrorResult.h
+++ b/dom/bindings/ErrorResult.h
@@ -461,7 +461,7 @@ private:
// (and deallocated) by SetPendingDOMException.
union {
Message* mMessage; // valid when IsErrorWithMessage()
- JS::Value mJSException; // valid when IsJSException()
+ JS::UninitializedValue mJSException; // valid when IsJSException()
DOMExceptionInfo* mDOMExceptionInfo; // valid when IsDOMException()
};
diff --git a/dom/bindings/test/test_promise_rejections_from_jsimplemented.html b/dom/bindings/test/test_promise_rejections_from_jsimplemented.html
index 5428030c57..68de079ed6 100644
--- a/dom/bindings/test/test_promise_rejections_from_jsimplemented.html
+++ b/dom/bindings/test/test_promise_rejections_from_jsimplemented.html
@@ -93,7 +93,7 @@ doTest@${ourFile}:56:7
checkExn.bind(null, 90, "ReferenceError",
"thereIsNoSuchContentFunction3 is not defined",
undefined, ourFile, 6,
- `doTest/<.then@${ourFile}:90:32
+ `then@${ourFile}:90:32
` + (asyncStack ? `Async*doTest@${ourFile}:89:7\n` + parentFrame : ""))),
t.testPromiseWithDOMExceptionThrowingPromiseInit().then(
ensurePromiseFail.bind(null, 7),
diff --git a/dom/cache/Cache.cpp b/dom/cache/Cache.cpp
index 0d5815edbf..b183bf387b 100644
--- a/dom/cache/Cache.cpp
+++ b/dom/cache/Cache.cpp
@@ -618,7 +618,7 @@ Cache::AddAll(const GlobalObject& aGlobal,
new FetchHandler(mActor->GetWorkerHolder(), this,
Move(aRequestList), promise);
- RefPtr<Promise> fetchPromise = Promise::All(aGlobal, fetchList, aRv);
+ RefPtr<Promise> fetchPromise = Promise::All(aGlobal.Context(), fetchList, aRv);
if (NS_WARN_IF(aRv.Failed())) {
return nullptr;
}
diff --git a/dom/canvas/CanvasRenderingContext2D.cpp b/dom/canvas/CanvasRenderingContext2D.cpp
index 35ea2cd1a1..a38c382938 100644
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -92,8 +92,6 @@
#include "mozilla/gfx/PathHelpers.h"
#include "mozilla/gfx/DataSurfaceHelpers.h"
#include "mozilla/gfx/PatternHelpers.h"
-#include "mozilla/ipc/DocumentRendererParent.h"
-#include "mozilla/ipc/PDocumentRendererParent.h"
#include "mozilla/layers/PersistentBufferProvider.h"
#include "mozilla/MathAlgorithms.h"
#include "mozilla/Preferences.h"
@@ -107,6 +105,7 @@
#include "mozilla/dom/CanvasPath.h"
#include "mozilla/dom/HTMLImageElement.h"
#include "mozilla/dom/HTMLVideoElement.h"
+#include "mozilla/dom/SVGImageElement.h"
#include "mozilla/dom/SVGMatrix.h"
#include "mozilla/dom/TextMetrics.h"
#include "mozilla/dom/SVGMatrix.h"
@@ -2479,10 +2478,10 @@ CanvasRenderingContext2D::CreatePattern(const CanvasImageSource& aSource,
return nullptr;
}
- Element* htmlElement;
+ Element* element;
if (aSource.IsHTMLCanvasElement()) {
HTMLCanvasElement* canvas = &aSource.GetAsHTMLCanvasElement();
- htmlElement = canvas;
+ element = canvas;
nsIntSize size = canvas->GetSize();
if (size.width == 0 || size.height == 0) {
@@ -2507,7 +2506,7 @@ CanvasRenderingContext2D::CreatePattern(const CanvasImageSource& aSource,
}
RefPtr<CanvasPattern> pat =
- new CanvasPattern(this, srcSurf, repeatMode, htmlElement->NodePrincipal(), canvas->IsWriteOnly(), false);
+ new CanvasPattern(this, srcSurf, repeatMode, element->NodePrincipal(), canvas->IsWriteOnly(), false);
return pat.forget();
}
@@ -2518,11 +2517,19 @@ CanvasRenderingContext2D::CreatePattern(const CanvasImageSource& aSource,
return nullptr;
}
- htmlElement = img;
+ element = img;
+ } else if (aSource.IsSVGImageElement()) {
+ SVGImageElement* img = &aSource.GetAsSVGImageElement();
+ if (img->IntrinsicState().HasState(NS_EVENT_STATE_BROKEN)) {
+ aError.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
+ return nullptr;
+ }
+
+ element = img;
} else if (aSource.IsHTMLVideoElement()) {
auto& video = aSource.GetAsHTMLVideoElement();
video.MarkAsContentSource(mozilla::dom::HTMLVideoElement::CallerAPI::CREATE_PATTERN);
- htmlElement = &video;
+ element = &video;
} else {
// Special case for ImageBitmap
ImageBitmap& imgBitmap = aSource.GetAsImageBitmap();
@@ -2561,7 +2568,7 @@ CanvasRenderingContext2D::CreatePattern(const CanvasImageSource& aSource,
// The canvas spec says that createPattern should use the first frame
// of animated images
nsLayoutUtils::SurfaceFromElementResult res =
- nsLayoutUtils::SurfaceFromElement(htmlElement,
+ nsLayoutUtils::SurfaceFromElement(element,
nsLayoutUtils::SFE_WANT_FIRST_FRAME, mTarget);
if (!res.GetSourceSurface()) {
@@ -4951,6 +4958,9 @@ CanvasRenderingContext2D::DrawImage(const CanvasImageSource& aImage,
if (aImage.IsHTMLImageElement()) {
HTMLImageElement* img = &aImage.GetAsHTMLImageElement();
element = img;
+ } else if (aImage.IsSVGImageElement()) {
+ SVGImageElement* img = &aImage.GetAsSVGImageElement();
+ element = img;
} else {
HTMLVideoElement* video = &aImage.GetAsHTMLVideoElement();
video->MarkAsContentSource(mozilla::dom::HTMLVideoElement::CallerAPI::DRAW_IMAGE);
diff --git a/dom/canvas/CanvasRenderingContext2D.h b/dom/canvas/CanvasRenderingContext2D.h
index c3ee3bdcbc..d5dff8f3b0 100644
--- a/dom/canvas/CanvasRenderingContext2D.h
+++ b/dom/canvas/CanvasRenderingContext2D.h
@@ -38,8 +38,8 @@ class SourceSurface;
} // namespace gl
namespace dom {
-class HTMLImageElementOrHTMLCanvasElementOrHTMLVideoElementOrImageBitmap;
-typedef HTMLImageElementOrHTMLCanvasElementOrHTMLVideoElementOrImageBitmap CanvasImageSource;
+class HTMLImageElementOrSVGImageElementOrHTMLCanvasElementOrHTMLVideoElementOrImageBitmap;
+typedef HTMLImageElementOrSVGImageElementOrHTMLCanvasElementOrHTMLVideoElementOrImageBitmap CanvasImageSource;
class ImageData;
class StringOrCanvasGradientOrCanvasPattern;
class OwningStringOrCanvasGradientOrCanvasPattern;
diff --git a/dom/canvas/DocumentRendererChild.cpp b/dom/canvas/DocumentRendererChild.cpp
deleted file mode 100644
index 15dd5fc521..0000000000
--- a/dom/canvas/DocumentRendererChild.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mozilla/ipc/DocumentRendererChild.h"
-
-#include "base/basictypes.h"
-
-#include "gfx2DGlue.h"
-#include "gfxPattern.h"
-#include "mozilla/gfx/2D.h"
-#include "mozilla/RefPtr.h"
-#include "nsPIDOMWindow.h"
-#include "nsIDOMWindow.h"
-#include "nsIDocShell.h"
-#include "nsIInterfaceRequestorUtils.h"
-#include "nsComponentManagerUtils.h"
-#include "nsCSSParser.h"
-#include "nsPresContext.h"
-#include "nsCOMPtr.h"
-#include "nsColor.h"
-#include "gfxContext.h"
-#include "nsLayoutUtils.h"
-#include "nsContentUtils.h"
-#include "nsCSSValue.h"
-#include "nsRuleNode.h"
-#include "mozilla/gfx/Matrix.h"
-
-using namespace mozilla;
-using namespace mozilla::gfx;
-using namespace mozilla::ipc;
-
-DocumentRendererChild::DocumentRendererChild()
-{}
-
-DocumentRendererChild::~DocumentRendererChild()
-{}
-
-bool
-DocumentRendererChild::RenderDocument(nsPIDOMWindowOuter* window,
- const nsRect& documentRect,
- const mozilla::gfx::Matrix& transform,
- const nsString& aBGColor,
- uint32_t renderFlags,
- bool flushLayout,
- const nsIntSize& renderSize,
- nsCString& data)
-{
- if (flushLayout)
- nsContentUtils::FlushLayoutForTree(window);
-
- RefPtr<nsPresContext> presContext;
- if (window) {
- nsIDocShell* docshell = window->GetDocShell();
- if (docshell) {
- docshell->GetPresContext(getter_AddRefs(presContext));
- }
- }
- if (!presContext)
- return false;
-
- nsCSSParser parser;
- nsCSSValue bgColorValue;
- if (!parser.ParseColorString(aBGColor, nullptr, 0, bgColorValue)) {
- return false;
- }
-
- nscolor bgColor;
- if (!nsRuleNode::ComputeColor(bgColorValue, presContext, nullptr, bgColor)) {
- return false;
- }
-
- // Draw directly into the output array.
- data.SetLength(renderSize.width * renderSize.height * 4);
-
- RefPtr<DrawTarget> dt =
- Factory::CreateDrawTargetForData(BackendType::CAIRO,
- reinterpret_cast<uint8_t*>(data.BeginWriting()),
- IntSize(renderSize.width, renderSize.height),
- 4 * renderSize.width,
- SurfaceFormat::B8G8R8A8);
- if (!dt || !dt->IsValid()) {
- gfxWarning() << "DocumentRendererChild::RenderDocument failed to Factory::CreateDrawTargetForData";
- return false;
- }
- RefPtr<gfxContext> ctx = gfxContext::CreateOrNull(dt);
- MOZ_ASSERT(ctx); // already checked the draw target above
- ctx->SetMatrix(mozilla::gfx::ThebesMatrix(transform));
-
- nsCOMPtr<nsIPresShell> shell = presContext->PresShell();
- shell->RenderDocument(documentRect, renderFlags, bgColor, ctx);
-
- return true;
-}
diff --git a/dom/canvas/DocumentRendererChild.h b/dom/canvas/DocumentRendererChild.h
deleted file mode 100644
index 463ba27076..0000000000
--- a/dom/canvas/DocumentRendererChild.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla_dom_DocumentRendererChild
-#define mozilla_dom_DocumentRendererChild
-
-#include "mozilla/ipc/PDocumentRendererChild.h"
-#include "nsString.h"
-#include "gfxContext.h"
-
-class nsIDOMWindow;
-
-namespace mozilla {
-namespace ipc {
-
-class DocumentRendererChild : public PDocumentRendererChild
-{
-public:
- DocumentRendererChild();
- virtual ~DocumentRendererChild();
-
- bool RenderDocument(nsPIDOMWindowOuter* window,
- const nsRect& documentRect, const gfx::Matrix& transform,
- const nsString& bgcolor,
- uint32_t renderFlags, bool flushLayout,
- const nsIntSize& renderSize, nsCString& data);
-
-private:
-
- DISALLOW_EVIL_CONSTRUCTORS(DocumentRendererChild);
-};
-
-} // namespace ipc
-} // namespace mozilla
-
-#endif
diff --git a/dom/canvas/DocumentRendererParent.cpp b/dom/canvas/DocumentRendererParent.cpp
deleted file mode 100644
index d9578ac4ee..0000000000
--- a/dom/canvas/DocumentRendererParent.cpp
+++ /dev/null
@@ -1,63 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mozilla/ipc/DocumentRendererParent.h"
-
-#include "gfx2DGlue.h"
-#include "mozilla/gfx/2D.h"
-#include "mozilla/gfx/PathHelpers.h"
-#include "mozilla/RefPtr.h"
-#include "nsICanvasRenderingContextInternal.h"
-
-using namespace mozilla;
-using namespace mozilla::gfx;
-using namespace mozilla::ipc;
-
-DocumentRendererParent::DocumentRendererParent()
-{}
-
-DocumentRendererParent::~DocumentRendererParent()
-{}
-
-void DocumentRendererParent::SetCanvasContext(nsICanvasRenderingContextInternal* aCanvas,
- gfxContext* ctx)
-{
- mCanvas = aCanvas;
- mCanvasContext = ctx;
-}
-
-void DocumentRendererParent::DrawToCanvas(const nsIntSize& aSize,
- const nsCString& aData)
-{
- if (!mCanvas || !mCanvasContext)
- return;
-
- DrawTarget* drawTarget = mCanvasContext->GetDrawTarget();
- Rect rect(0, 0, aSize.width, aSize.height);
- MaybeSnapToDevicePixels(rect, *drawTarget, true);
- RefPtr<DataSourceSurface> dataSurface =
- Factory::CreateWrappingDataSourceSurface(reinterpret_cast<uint8_t*>(const_cast<nsCString&>(aData).BeginWriting()),
- aSize.width * 4,
- IntSize(aSize.width, aSize.height),
- SurfaceFormat::B8G8R8A8);
- SurfacePattern pattern(dataSurface, ExtendMode::CLAMP);
- drawTarget->FillRect(rect, pattern);
-
- gfxRect damageRect = mCanvasContext->UserToDevice(ThebesRect(rect));
- mCanvas->Redraw(damageRect);
-}
-
-void
-DocumentRendererParent::ActorDestroy(ActorDestroyReason aWhy)
-{
- // Implement me! Bug 1005139
-}
-
-bool
-DocumentRendererParent::Recv__delete__(const nsIntSize& renderedSize,
- const nsCString& data)
-{
- DrawToCanvas(renderedSize, data);
- return true;
-}
diff --git a/dom/canvas/DocumentRendererParent.h b/dom/canvas/DocumentRendererParent.h
deleted file mode 100644
index 432aa82643..0000000000
--- a/dom/canvas/DocumentRendererParent.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla_dom_DocumentRendererParent
-#define mozilla_dom_DocumentRendererParent
-
-#include "mozilla/ipc/PDocumentRendererParent.h"
-#include "nsCOMPtr.h"
-#include "nsString.h"
-#include "gfxContext.h"
-
-class nsICanvasRenderingContextInternal;
-
-namespace mozilla {
-namespace ipc {
-
-class DocumentRendererParent : public PDocumentRendererParent
-{
-public:
- DocumentRendererParent();
- virtual ~DocumentRendererParent();
-
- void SetCanvasContext(nsICanvasRenderingContextInternal* aCanvas,
- gfxContext* ctx);
- void DrawToCanvas(const nsIntSize& renderedSize,
- const nsCString& aData);
-
- virtual void ActorDestroy(ActorDestroyReason aWhy) override;
-
- virtual bool Recv__delete__(const nsIntSize& renderedSize,
- const nsCString& data) override;
-
-private:
- nsCOMPtr<nsICanvasRenderingContextInternal> mCanvas;
- RefPtr<gfxContext> mCanvasContext;
-
- DISALLOW_EVIL_CONSTRUCTORS(DocumentRendererParent);
-};
-
-} // namespace ipc
-} // namespace mozilla
-
-#endif
diff --git a/dom/canvas/WebGL2ContextState.cpp b/dom/canvas/WebGL2ContextState.cpp
index be0a7a3cbd..e6283b12dd 100644
--- a/dom/canvas/WebGL2ContextState.cpp
+++ b/dom/canvas/WebGL2ContextState.cpp
@@ -7,6 +7,7 @@
#include "WebGL2Context.h"
#include "GLContext.h"
+#include "GLScreenBuffer.h"
#include "WebGLBuffer.h"
#include "WebGLContextUtils.h"
#include "WebGLFramebuffer.h"
diff --git a/dom/canvas/WebGLContextDraw.cpp b/dom/canvas/WebGLContextDraw.cpp
index 66fca76892..867e47cbdc 100644
--- a/dom/canvas/WebGLContextDraw.cpp
+++ b/dom/canvas/WebGLContextDraw.cpp
@@ -16,6 +16,7 @@
#include "WebGLRenderbuffer.h"
#include "WebGLShader.h"
#include "WebGLTexture.h"
+#include "WebGLTransformFeedback.h"
#include "WebGLVertexArray.h"
#include "WebGLVertexAttribData.h"
diff --git a/dom/canvas/WebGLContextExtensions.cpp b/dom/canvas/WebGLContextExtensions.cpp
index 28ba14fa22..4a5a232749 100644
--- a/dom/canvas/WebGLContextExtensions.cpp
+++ b/dom/canvas/WebGLContextExtensions.cpp
@@ -89,6 +89,8 @@ bool WebGLContext::IsExtensionSupported(dom::CallerType callerType,
if (allowPrivilegedExts) {
switch (ext) {
+ case WebGLExtensionID::EXT_disjoint_timer_query:
+ return WebGLExtensionDisjointTimerQuery::IsSupported(this);
case WebGLExtensionID::WEBGL_debug_renderer_info:
return true;
case WebGLExtensionID::WEBGL_debug_shaders:
@@ -112,8 +114,6 @@ WebGLContext::IsExtensionSupported(WebGLExtensionID ext) const
switch (ext) {
// In alphabetical order
// EXT_
- case WebGLExtensionID::EXT_disjoint_timer_query:
- return WebGLExtensionDisjointTimerQuery::IsSupported(this);
case WebGLExtensionID::EXT_texture_filter_anisotropic:
return gl->IsExtensionSupported(gl::GLContext::EXT_texture_filter_anisotropic);
diff --git a/dom/canvas/WebGLFramebuffer.cpp b/dom/canvas/WebGLFramebuffer.cpp
index 35efa4f160..0abaf3dd79 100644
--- a/dom/canvas/WebGLFramebuffer.cpp
+++ b/dom/canvas/WebGLFramebuffer.cpp
@@ -17,7 +17,9 @@
#include "WebGLContextUtils.h"
#include "WebGLExtensions.h"
#include "WebGLRenderbuffer.h"
+#include "WebGLShader.h"
#include "WebGLTexture.h"
+#include "WebGLObjectModel.h"
namespace mozilla {
@@ -1940,6 +1942,7 @@ ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& callback,
}
}
+
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(WebGLFramebuffer,
mDepthAttachment,
mStencilAttachment,
diff --git a/dom/canvas/WebGLObjectModel.h b/dom/canvas/WebGLObjectModel.h
index e19d2fd8e4..b18b790c03 100644
--- a/dom/canvas/WebGLObjectModel.h
+++ b/dom/canvas/WebGLObjectModel.h
@@ -15,6 +15,7 @@ namespace mozilla {
template<typename> class LinkedList;
class WebGLContext;
+
////
// This class is a mixin for objects that are tied to a specific
@@ -355,6 +356,16 @@ ImplCycleCollectionUnlink(mozilla::WebGLRefPtr<T>& field)
template <typename T>
inline void
ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& callback,
+ mozilla::WebGLRefPtr<T>& field,
+ const char* name,
+ uint32_t flags = 0)
+{
+ CycleCollectionNoteChild(callback, field.get(), name, flags);
+}
+
+template <typename T>
+inline void
+ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& callback,
const mozilla::WebGLRefPtr<T>& field,
const char* name,
uint32_t flags = 0)
@@ -362,4 +373,5 @@ ImplCycleCollectionTraverse(nsCycleCollectionTraversalCallback& callback,
CycleCollectionNoteChild(callback, field.get(), name, flags);
}
+
#endif
diff --git a/dom/canvas/WebGLProgram.cpp b/dom/canvas/WebGLProgram.cpp
index fa7997f224..9b204358bb 100644
--- a/dom/canvas/WebGLProgram.cpp
+++ b/dom/canvas/WebGLProgram.cpp
@@ -17,6 +17,7 @@
#include "WebGLTransformFeedback.h"
#include "WebGLUniformLocation.h"
#include "WebGLValidateStrings.h"
+#include "WebGLObjectModel.h"
namespace mozilla {
diff --git a/dom/canvas/WebGLTransformFeedback.cpp b/dom/canvas/WebGLTransformFeedback.cpp
index feec581eaa..78e3665315 100644
--- a/dom/canvas/WebGLTransformFeedback.cpp
+++ b/dom/canvas/WebGLTransformFeedback.cpp
@@ -8,6 +8,7 @@
#include "GLContext.h"
#include "mozilla/dom/WebGL2RenderingContextBinding.h"
#include "WebGL2Context.h"
+#include "WebGLProgram.h"
namespace mozilla {
diff --git a/dom/canvas/moz.build b/dom/canvas/moz.build
index 55153c70b8..f7555b33db 100644
--- a/dom/canvas/moz.build
+++ b/dom/canvas/moz.build
@@ -25,11 +25,6 @@ EXPORTS += [
'nsICanvasRenderingContextInternal.h',
]
-EXPORTS.mozilla.ipc += [
- 'DocumentRendererChild.h',
- 'DocumentRendererParent.h',
-]
-
EXPORTS.mozilla.dom += [
'CanvasGradient.h',
'CanvasPath.h',
@@ -52,8 +47,6 @@ UNIFIED_SOURCES += [
'CanvasRenderingContext2D.cpp',
'CanvasRenderingContextHelper.cpp',
'CanvasUtils.cpp',
- 'DocumentRendererChild.cpp',
- 'DocumentRendererParent.cpp',
'ImageBitmap.cpp',
'ImageBitmapColorUtils.cpp',
'ImageBitmapRenderingContext.cpp',
diff --git a/dom/canvas/test/webgl-mochitest/mochitest.ini b/dom/canvas/test/webgl-mochitest/mochitest.ini
index d5bc8701d0..ddd0dd7626 100644
--- a/dom/canvas/test/webgl-mochitest/mochitest.ini
+++ b/dom/canvas/test/webgl-mochitest/mochitest.ini
@@ -14,7 +14,7 @@ fail-if = (os == 'android')
[ensure-exts/test_EXT_color_buffer_half_float.html]
fail-if = (os == 'android')
[ensure-exts/test_EXT_disjoint_timer_query.html]
-fail-if = (os == 'android') || (os == 'mac') || (os == 'win' && os_version == '5.1')
+fail-if = 1
[ensure-exts/test_EXT_frag_depth.html]
fail-if = (os == 'android')
[ensure-exts/test_EXT_sRGB.html]
diff --git a/dom/console/Console.cpp b/dom/console/Console.cpp
index 9ede265013..ff5a921673 100644..100755
--- a/dom/console/Console.cpp
+++ b/dom/console/Console.cpp
@@ -30,6 +30,7 @@
#include "nsContentUtils.h"
#include "nsDocShell.h"
#include "nsProxyRelease.h"
+#include "mozilla/TimerClamping.h"
#include "mozilla/ConsoleTimelineMarker.h"
#include "mozilla/TimestampTimelineMarker.h"
@@ -1335,10 +1336,7 @@ Console::MethodInternal(JSContext* aCx, MethodName aMethodName,
WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate();
MOZ_ASSERT(workerPrivate);
- TimeDuration duration =
- mozilla::TimeStamp::Now() - workerPrivate->NowBaseTimeStamp();
-
- monotonicTimer = duration.ToMilliseconds();
+ monotonicTimer = workerPrivate->TimeStampToDOMHighRes(TimeStamp::Now());
}
}
diff --git a/dom/console/Console.h b/dom/console/Console.h
index b334d79f95..2f375c8ebc 100644
--- a/dom/console/Console.h
+++ b/dom/console/Console.h
@@ -258,9 +258,8 @@ private:
// the max number of timers is reached.
// * aCx - the JSContext rooting aName.
// * aName - this is (should be) the name of the timer as JS::Value.
- // * aTimestamp - the monotonicTimer for this context (taken from
- // window->performance.now() or from Now() -
- // workerPrivate->NowBaseTimeStamp() in workers.
+ // * aTimestamp - the monotonicTimer for this context taken from
+ // performance.now().
// * aTimerLabel - This label will be populated with the aName converted to a
// string.
// * aTimerValue - the StartTimer value stored into (or taken from)
@@ -290,9 +289,8 @@ private:
// the aName timer doesn't exist in the mTimerRegistry.
// * aCx - the JSContext rooting aName.
// * aName - this is (should be) the name of the timer as JS::Value.
- // * aTimestamp - the monotonicTimer for this context (taken from
- // window->performance.now() or from Now() -
- // workerPrivate->NowBaseTimeStamp() in workers.
+ // * aTimestamp - the monotonicTimer for this context taken from
+ // performance.now().
// * aTimerLabel - This label will be populated with the aName converted to a
// string.
// * aTimerDuration - the difference between aTimestamp and when the timer
diff --git a/dom/events/Event.cpp b/dom/events/Event.cpp
index a85a0d66b2..4b9776c0a5 100644..100755
--- a/dom/events/Event.cpp
+++ b/dom/events/Event.cpp
@@ -32,6 +32,7 @@
#include "nsJSEnvironment.h"
#include "nsLayoutUtils.h"
#include "nsPIWindowRoot.h"
+#include "mozilla/TimerClamping.h"
#include "WorkerPrivate.h"
namespace mozilla {
@@ -411,8 +412,17 @@ Event::Constructor(const GlobalObject& aGlobal,
ErrorResult& aRv)
{
nsCOMPtr<mozilla::dom::EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
- RefPtr<Event> e = new Event(t, nullptr, nullptr);
- bool trusted = e->Init(t);
+ return Constructor(t, aType, aParam);
+}
+
+// static
+already_AddRefed<Event>
+Event::Constructor(EventTarget* aEventTarget,
+ const nsAString& aType,
+ const EventInit& aParam)
+{
+ RefPtr<Event> e = new Event(aEventTarget, nullptr, nullptr);
+ bool trusted = e->Init(aEventTarget);
e->InitEvent(aType, aParam.mBubbles, aParam.mCancelable);
e->SetTrusted(trusted);
e->SetComposed(aParam.mComposed);
@@ -845,6 +855,25 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
}
}
break;
+ case ePointerEventClass:
+ if (aEvent->IsTrusted() &&
+ aEvent->AsPointerEvent()->button == WidgetMouseEvent::eLeftButton) {
+ switch(aEvent->mMessage) {
+ case ePointerUp:
+ if (PopupAllowedForEvent("pointerup")) {
+ abuse = openControlled;
+ }
+ break;
+ case ePointerDown:
+ if (PopupAllowedForEvent("pointerdown")) {
+ abuse = openControlled;
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ break;
case eFormEventClass:
// For these following events only allow popups if they're
// triggered while handling user input. See
@@ -1085,6 +1114,12 @@ Event::DefaultPrevented(JSContext* aCx) const
double
Event::TimeStamp() const
{
+ return TimerClamping::ReduceMsTimeValue(TimeStampImpl());
+}
+
+double
+Event::TimeStampImpl() const
+{
if (!sReturnHighResTimeStamp) {
return static_cast<double>(mEvent->mTime);
}
@@ -1111,16 +1146,11 @@ Event::TimeStamp() const
return perf->GetDOMTiming()->TimeStampToDOMHighRes(mEvent->mTimeStamp);
}
- // For dedicated workers, we should make times relative to the navigation
- // start of the document that created the worker, which is the same as the
- // timebase for performance.now().
workers::WorkerPrivate* workerPrivate =
workers::GetCurrentThreadWorkerPrivate();
MOZ_ASSERT(workerPrivate);
- TimeDuration duration =
- mEvent->mTimeStamp - workerPrivate->NowBaseTimeStamp();
- return duration.ToMilliseconds();
+ return workerPrivate->TimeStampToDOMHighRes(mEvent->mTimeStamp);
}
bool
@@ -1202,7 +1232,7 @@ Event::Deserialize(const IPC::Message* aMsg, PickleIterator* aIter)
}
NS_IMETHODIMP_(void)
-Event::SetOwner(mozilla::dom::EventTarget* aOwner)
+Event::SetOwner(EventTarget* aOwner)
{
mOwner = nullptr;
diff --git a/dom/events/Event.h b/dom/events/Event.h
index 4ac6a68d56..0817aa809e 100644..100755
--- a/dom/events/Event.h
+++ b/dom/events/Event.h
@@ -62,6 +62,7 @@ private:
void ConstructorInit(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetEvent* aEvent);
+ double TimeStampImpl() const;
public:
static Event* FromSupports(nsISupports* aSupports)
@@ -141,6 +142,10 @@ public:
LayoutDeviceIntPoint aPoint,
CSSIntPoint aDefaultPoint);
+ static already_AddRefed<Event> Constructor(EventTarget* aEventTarget,
+ const nsAString& aType,
+ const EventInit& aParam);
+
static already_AddRefed<Event> Constructor(const GlobalObject& aGlobal,
const nsAString& aType,
const EventInit& aParam,
diff --git a/dom/events/EventDispatcher.cpp b/dom/events/EventDispatcher.cpp
index a1d0675ae3..65f01844b9 100644
--- a/dom/events/EventDispatcher.cpp
+++ b/dom/events/EventDispatcher.cpp
@@ -1056,6 +1056,11 @@ EventDispatcher::CreateEvent(EventTarget* aOwner,
LOG_EVENT_CREATION(STORAGEEVENT);
return NS_NewDOMStorageEvent(aOwner);
}
+ if (aEventType.LowerCaseEqualsLiteral("focusevent")) {
+ RefPtr<Event> event = NS_NewDOMFocusEvent(aOwner, aPresContext, nullptr);
+ event->MarkUninitialized();
+ return event.forget();
+ }
#undef LOG_EVENT_CREATION
diff --git a/dom/events/EventListenerManager.cpp b/dom/events/EventListenerManager.cpp
index c8db4f2a16..a8c48ede80 100644
--- a/dom/events/EventListenerManager.cpp
+++ b/dom/events/EventListenerManager.cpp
@@ -996,14 +996,12 @@ EventListenerManager::CompileEventHandlerInternal(Listener* aListener,
}
aListener = nullptr;
- uint32_t lineNo = 0;
nsAutoCString url (NS_LITERAL_CSTRING("-moz-evil:lying-event-listener"));
MOZ_ASSERT(body);
MOZ_ASSERT(aElement);
nsIURI *uri = aElement->OwnerDoc()->GetDocumentURI();
if (uri) {
uri->GetSpec(url);
- lineNo = 1;
}
nsCOMPtr<nsPIDOMWindowInner> win = do_QueryInterface(mTarget);
@@ -1073,8 +1071,9 @@ EventListenerManager::CompileEventHandlerInternal(Listener* aListener,
return NS_ERROR_FAILURE;
}
JS::CompileOptions options(cx);
+ // Use line 0 to make the function body starts from line 1.
options.setIntroductionType("eventHandler")
- .setFileAndLine(url.get(), lineNo)
+ .setFileAndLine(url.get(), 0)
.setVersion(JSVERSION_DEFAULT)
.setElement(&v.toObject())
.setElementAttributeName(jsStr);
diff --git a/dom/events/EventNameList.h b/dom/events/EventNameList.h
index 00478c87b9..509863e6ce 100644
--- a/dom/events/EventNameList.h
+++ b/dom/events/EventNameList.h
@@ -164,6 +164,10 @@ EVENT(change,
eFormChange,
EventNameType_HTMLXUL,
eBasicEventClass)
+EVENT(auxclick,
+ eMouseAuxClick,
+ EventNameType_All,
+ eMouseEventClass)
EVENT(click,
eMouseClick,
EventNameType_All,
diff --git a/dom/events/EventStateManager.cpp b/dom/events/EventStateManager.cpp
index 659629066c..7bbfe21b79 100644
--- a/dom/events/EventStateManager.cpp
+++ b/dom/events/EventStateManager.cpp
@@ -492,6 +492,7 @@ IsMessageMouseUserActivity(EventMessage aMessage)
return aMessage == eMouseMove ||
aMessage == eMouseUp ||
aMessage == eMouseDown ||
+ aMessage == eMouseAuxClick ||
aMessage == eMouseDoubleClick ||
aMessage == eMouseClick ||
aMessage == eMouseActivate ||
@@ -731,6 +732,9 @@ EventStateManager::PreHandleEvent(nsPresContext* aPresContext,
FlushPendingEvents(aPresContext);
break;
}
+ case ePointerGotCapture:
+ GenerateMouseEnterExit(mouseEvent);
+ break;
case eDragStart:
if (Prefs::ClickHoldContextMenu()) {
// an external drag gesture event came in, not generated internally
@@ -3890,10 +3894,7 @@ CreateMouseOrPointerWidgetEvent(WidgetMouseEvent* aMouseEvent,
newPointerEvent->mWidth = sourcePointer->mWidth;
newPointerEvent->mHeight = sourcePointer->mHeight;
newPointerEvent->inputSource = sourcePointer->inputSource;
- newPointerEvent->relatedTarget =
- nsIPresShell::GetPointerCapturingContent(sourcePointer->pointerId)
- ? nullptr
- : aRelatedContent;
+ newPointerEvent->relatedTarget = aRelatedContent;
aNewEvent = newPointerEvent.forget();
} else {
aNewEvent =
@@ -4034,7 +4035,7 @@ public:
}
}
- ~EnterLeaveDispatcher()
+ void Dispatch()
{
if (mEventMessage == eMouseEnter || mEventMessage == ePointerEnter) {
for (int32_t i = mTargets.Count() - 1; i >= 0; --i) {
@@ -4106,19 +4107,14 @@ EventStateManager::NotifyMouseOut(WidgetMouseEvent* aMouseEvent,
SetContentState(nullptr, NS_EVENT_STATE_HOVER);
}
- // In case we go out from capturing element (retargetedByPointerCapture is true)
- // we should dispatch ePointerLeave event and only for capturing element.
- RefPtr<nsIContent> movingInto = aMouseEvent->retargetedByPointerCapture
- ? wrapper->mLastOverElement->GetParent()
- : aMovingInto;
-
EnterLeaveDispatcher leaveDispatcher(this, wrapper->mLastOverElement,
- movingInto, aMouseEvent,
+ aMovingInto, aMouseEvent,
isPointer ? ePointerLeave : eMouseLeave);
// Fire mouseout
DispatchMouseOrPointerEvent(aMouseEvent, isPointer ? ePointerOut : eMouseOut,
wrapper->mLastOverElement, aMovingInto);
+ leaveDispatcher.Dispatch();
wrapper->mLastOverFrame = nullptr;
wrapper->mLastOverElement = nullptr;
@@ -4133,13 +4129,9 @@ EventStateManager::NotifyMouseOver(WidgetMouseEvent* aMouseEvent,
{
NS_ASSERTION(aContent, "Mouse must be over something");
- // If pointer capture is set, we should suppress pointerover/pointerenter events
- // for all elements except element which have pointer capture.
- bool dispatch = !aMouseEvent->retargetedByPointerCapture;
-
OverOutElementsWrapper* wrapper = GetWrapperByEventID(aMouseEvent);
- if (wrapper->mLastOverElement == aContent && dispatch)
+ if (wrapper->mLastOverElement == aContent)
return;
// Before firing mouseover, check for recursion
@@ -4151,9 +4143,10 @@ EventStateManager::NotifyMouseOver(WidgetMouseEvent* aMouseEvent,
// content associated with our subdocument.
EnsureDocument(mPresContext);
if (nsIDocument *parentDoc = mDocument->GetParentDocument()) {
- if (nsIContent *docContent = parentDoc->FindContentForSubDocument(mDocument)) {
+ if (nsCOMPtr<nsIContent> docContent =
+ parentDoc->FindContentForSubDocument(mDocument)) {
if (nsIPresShell *parentShell = parentDoc->GetShell()) {
- EventStateManager* parentESM =
+ RefPtr<EventStateManager> parentESM =
parentShell->GetPresContext()->EventStateManager();
parentESM->NotifyMouseOver(aMouseEvent, docContent);
}
@@ -4161,7 +4154,7 @@ EventStateManager::NotifyMouseOver(WidgetMouseEvent* aMouseEvent,
}
// Firing the DOM event in the parent document could cause all kinds
// of havoc. Reverify and take care.
- if (wrapper->mLastOverElement == aContent && dispatch)
+ if (wrapper->mLastOverElement == aContent)
return;
// Remember mLastOverElement as the related content for the
@@ -4170,11 +4163,9 @@ EventStateManager::NotifyMouseOver(WidgetMouseEvent* aMouseEvent,
bool isPointer = aMouseEvent->mClass == ePointerEventClass;
- Maybe<EnterLeaveDispatcher> enterDispatcher;
- if (dispatch) {
- enterDispatcher.emplace(this, aContent, lastOverElement, aMouseEvent,
- isPointer ? ePointerEnter : eMouseEnter);
- }
+ EnterLeaveDispatcher enterDispatcher(this, aContent, lastOverElement,
+ aMouseEvent,
+ isPointer ? ePointerEnter : eMouseEnter);
NotifyMouseOut(aMouseEvent, aContent);
@@ -4186,17 +4177,13 @@ EventStateManager::NotifyMouseOver(WidgetMouseEvent* aMouseEvent,
SetContentState(aContent, NS_EVENT_STATE_HOVER);
}
- if (dispatch) {
- // Fire mouseover
- wrapper->mLastOverFrame =
- DispatchMouseOrPointerEvent(aMouseEvent,
- isPointer ? ePointerOver : eMouseOver,
- aContent, lastOverElement);
- wrapper->mLastOverElement = aContent;
- } else {
- wrapper->mLastOverFrame = nullptr;
- wrapper->mLastOverElement = nullptr;
- }
+ // Fire mouseover
+ wrapper->mLastOverFrame =
+ DispatchMouseOrPointerEvent(aMouseEvent,
+ isPointer ? ePointerOver : eMouseOver,
+ aContent, lastOverElement);
+ enterDispatcher.Dispatch();
+ wrapper->mLastOverElement = aContent;
// Turn recursion protection back off
wrapper->mFirstOverEventElement = nullptr;
@@ -4289,6 +4276,7 @@ EventStateManager::GenerateMouseEnterExit(WidgetMouseEvent* aMouseEvent)
MOZ_FALLTHROUGH;
case ePointerMove:
case ePointerDown:
+ case ePointerGotCapture:
{
// Get the target content target (mousemove target == mouseover target)
nsCOMPtr<nsIContent> targetElement = GetEventTargetContent(aMouseEvent);
@@ -4646,6 +4634,32 @@ EventStateManager::SetClickCount(WidgetMouseEvent* aEvent,
}
nsresult
+EventStateManager::InitAndDispatchClickEvent(WidgetMouseEvent* aEvent,
+ nsEventStatus* aStatus,
+ EventMessage aMessage,
+ nsIPresShell* aPresShell,
+ nsIContent* aMouseTarget,
+ nsWeakFrame aCurrentTarget,
+ bool aNoContentDispatch)
+{
+ WidgetMouseEvent event(aEvent->IsTrusted(), aMessage,
+ aEvent->mWidget, WidgetMouseEvent::eReal);
+
+ event.mRefPoint = aEvent->mRefPoint;
+ event.mClickCount = aEvent->mClickCount;
+ event.mModifiers = aEvent->mModifiers;
+ event.buttons = aEvent->buttons;
+ event.mTime = aEvent->mTime;
+ event.mTimeStamp = aEvent->mTimeStamp;
+ event.mFlags.mNoContentDispatch = aNoContentDispatch;
+ event.button = aEvent->button;
+ event.inputSource = aEvent->inputSource;
+
+ return aPresShell->HandleEventWithTarget(&event, aCurrentTarget,
+ aMouseTarget, aStatus);
+}
+
+nsresult
EventStateManager::CheckForAndDispatchClick(WidgetMouseEvent* aEvent,
nsEventStatus* aStatus)
{
@@ -4664,17 +4678,7 @@ EventStateManager::CheckForAndDispatchClick(WidgetMouseEvent* aEvent,
(aEvent->button == WidgetMouseEvent::eMiddleButton ||
aEvent->button == WidgetMouseEvent::eRightButton);
- WidgetMouseEvent event(aEvent->IsTrusted(), eMouseClick,
- aEvent->mWidget, WidgetMouseEvent::eReal);
- event.mRefPoint = aEvent->mRefPoint;
- event.mClickCount = aEvent->mClickCount;
- event.mModifiers = aEvent->mModifiers;
- event.buttons = aEvent->buttons;
- event.mTime = aEvent->mTime;
- event.mTimeStamp = aEvent->mTimeStamp;
- event.mFlags.mNoContentDispatch = notDispatchToContents;
- event.button = aEvent->button;
- event.inputSource = aEvent->inputSource;
+ bool fireAuxClick = notDispatchToContents;
nsCOMPtr<nsIPresShell> presShell = mPresContext->GetPresShell();
if (presShell) {
@@ -4693,23 +4697,22 @@ EventStateManager::CheckForAndDispatchClick(WidgetMouseEvent* aEvent,
// HandleEvent clears out mCurrentTarget which we might need again
nsWeakFrame currentTarget = mCurrentTarget;
- ret = presShell->HandleEventWithTarget(&event, currentTarget,
- mouseContent, aStatus);
+ ret = InitAndDispatchClickEvent(aEvent, aStatus, eMouseClick,
+ presShell, mouseContent, currentTarget,
+ notDispatchToContents);
+
if (NS_SUCCEEDED(ret) && aEvent->mClickCount == 2 &&
mouseContent && mouseContent->IsInComposedDoc()) {
//fire double click
- WidgetMouseEvent event2(aEvent->IsTrusted(), eMouseDoubleClick,
- aEvent->mWidget, WidgetMouseEvent::eReal);
- event2.mRefPoint = aEvent->mRefPoint;
- event2.mClickCount = aEvent->mClickCount;
- event2.mModifiers = aEvent->mModifiers;
- event2.buttons = aEvent->buttons;
- event2.mFlags.mNoContentDispatch = notDispatchToContents;
- event2.button = aEvent->button;
- event2.inputSource = aEvent->inputSource;
-
- ret = presShell->HandleEventWithTarget(&event2, currentTarget,
- mouseContent, aStatus);
+ ret = InitAndDispatchClickEvent(aEvent, aStatus, eMouseDoubleClick,
+ presShell, mouseContent, currentTarget,
+ notDispatchToContents);
+ }
+ if (NS_SUCCEEDED(ret) && mouseContent && fireAuxClick &&
+ mouseContent->IsInComposedDoc()) {
+ ret = InitAndDispatchClickEvent(aEvent, aStatus, eMouseAuxClick,
+ presShell, mouseContent, currentTarget,
+ false);
}
}
}
diff --git a/dom/events/EventStateManager.h b/dom/events/EventStateManager.h
index 49ecf05865..d0461e7fae 100644
--- a/dom/events/EventStateManager.h
+++ b/dom/events/EventStateManager.h
@@ -415,6 +415,13 @@ protected:
*/
void UpdateDragDataTransfer(WidgetDragEvent* dragEvent);
+ static nsresult InitAndDispatchClickEvent(WidgetMouseEvent* aEvent,
+ nsEventStatus* aStatus,
+ EventMessage aMessage,
+ nsIPresShell* aPresShell,
+ nsIContent* aMouseTarget,
+ nsWeakFrame aCurrentTarget,
+ bool aNoContentDispatch);
nsresult SetClickCount(WidgetMouseEvent* aEvent, nsEventStatus* aStatus);
nsresult CheckForAndDispatchClick(WidgetMouseEvent* aEvent,
nsEventStatus* aStatus);
@@ -1046,6 +1053,7 @@ private:
#define NS_EVENT_NEEDS_FRAME(event) \
(!(event)->HasPluginActivationEventMessage() && \
(event)->mMessage != eMouseClick && \
- (event)->mMessage != eMouseDoubleClick)
+ (event)->mMessage != eMouseDoubleClick && \
+ (event)->mMessage != eMouseAuxClick)
#endif // mozilla_EventStateManager_h_
diff --git a/dom/events/PointerEvent.cpp b/dom/events/PointerEvent.cpp
index f537398634..fbaa0f737f 100644
--- a/dom/events/PointerEvent.cpp
+++ b/dom/events/PointerEvent.cpp
@@ -93,8 +93,10 @@ PointerEvent::Constructor(EventTarget* aOwner,
widgetEvent->mWidth = aParam.mWidth;
widgetEvent->mHeight = aParam.mHeight;
widgetEvent->pressure = aParam.mPressure;
+ widgetEvent->tangentialPressure = aParam.mTangentialPressure;
widgetEvent->tiltX = aParam.mTiltX;
widgetEvent->tiltY = aParam.mTiltY;
+ widgetEvent->twist = aParam.mTwist;
widgetEvent->inputSource = ConvertStringToPointerType(aParam.mPointerType);
widgetEvent->mIsPrimary = aParam.mIsPrimary;
widgetEvent->buttons = aParam.mButtons;
@@ -145,6 +147,12 @@ PointerEvent::Pressure()
return mEvent->AsPointerEvent()->pressure;
}
+float
+PointerEvent::TangentialPressure()
+{
+ return mEvent->AsPointerEvent()->tangentialPressure;
+}
+
int32_t
PointerEvent::TiltX()
{
@@ -157,6 +165,12 @@ PointerEvent::TiltY()
return mEvent->AsPointerEvent()->tiltY;
}
+int32_t
+PointerEvent::Twist()
+{
+ return mEvent->AsPointerEvent()->twist;
+}
+
bool
PointerEvent::IsPrimary()
{
diff --git a/dom/events/PointerEvent.h b/dom/events/PointerEvent.h
index 62c5a0c365..12d4941dc4 100644
--- a/dom/events/PointerEvent.h
+++ b/dom/events/PointerEvent.h
@@ -44,8 +44,10 @@ public:
int32_t Width();
int32_t Height();
float Pressure();
+ float TangentialPressure();
int32_t TiltX();
int32_t TiltY();
+ int32_t Twist();
bool IsPrimary();
void GetPointerType(nsAString& aPointerType);
};
diff --git a/dom/events/WheelHandlingHelper.cpp b/dom/events/WheelHandlingHelper.cpp
index 7665ee9225..81f2b6bfab 100644
--- a/dom/events/WheelHandlingHelper.cpp
+++ b/dom/events/WheelHandlingHelper.cpp
@@ -257,6 +257,7 @@ WheelTransaction::OnEvent(WidgetEvent* aEvent)
case eMouseUp:
case eMouseDown:
case eMouseDoubleClick:
+ case eMouseAuxClick:
case eMouseClick:
case eContextMenu:
case eDrop:
diff --git a/dom/events/test/mochitest.ini b/dom/events/test/mochitest.ini
index e100e60a18..0397487bb8 100644
--- a/dom/events/test/mochitest.ini
+++ b/dom/events/test/mochitest.ini
@@ -184,3 +184,4 @@ skip-if = toolkit == 'android' #CRASH_DUMP, RANDOM
[test_wheel_default_action.html]
[test_bug687787.html]
[test_bug1298970.html]
+[test_bug1304044.html]
diff --git a/dom/events/test/pointerevents/mochitest.ini b/dom/events/test/pointerevents/mochitest.ini
index 58eae12fed..af762feb2c 100644
--- a/dom/events/test/pointerevents/mochitest.ini
+++ b/dom/events/test/pointerevents/mochitest.ini
@@ -6,6 +6,14 @@ support-files =
pointerevent_styles.css
pointerevent_support.js
+[test_bug1285128.html]
+[test_bug1293174_implicit_pointer_capture_for_touch_1.html]
+ support-files = bug1293174_implicit_pointer_capture_for_touch_1.html
+[test_bug1293174_implicit_pointer_capture_for_touch_2.html]
+ support-files = bug1293174_implicit_pointer_capture_for_touch_2.html
+[test_bug1323158.html]
+[test_empty_file.html]
+ disabled = disabled # Bug 1150091 - Issue with support-files
[test_pointerevent_attributes_mouse-manual.html]
support-files = pointerevent_attributes_mouse-manual.html
[test_pointerevent_capture_mouse-manual.html]
@@ -143,10 +151,5 @@ support-files =
pointerevent_touch-action-span-test_touch-manual.html
pointerevent_touch-action-svg-test_touch-manual.html
pointerevent_touch-action-table-test_touch-manual.html
-[test_bug1285128.html]
-[test_bug1293174_implicit_pointer_capture_for_touch_1.html]
- support-files = bug1293174_implicit_pointer_capture_for_touch_1.html
-[test_bug1293174_implicit_pointer_capture_for_touch_2.html]
- support-files = bug1293174_implicit_pointer_capture_for_touch_2.html
-[test_empty_file.html]
- disabled = disabled # Bug 1150091 - Issue with support-files
+[test_trigger_fullscreen_by_pointer_events.html]
+[test_trigger_popup_by_pointer_events.html]
diff --git a/dom/events/test/pointerevents/pointerevent_releasepointercapture_events_to_original_target-manual.html b/dom/events/test/pointerevents/pointerevent_releasepointercapture_events_to_original_target-manual.html
index f4d5573ede..2614790f35 100644
--- a/dom/events/test/pointerevents/pointerevent_releasepointercapture_events_to_original_target-manual.html
+++ b/dom/events/test/pointerevents/pointerevent_releasepointercapture_events_to_original_target-manual.html
@@ -1,4 +1,4 @@
-<!doctype html>
+<!doctype html>
<html>
<head>
<title>Pointer Event: releasePointerCapture() - subsequent events follow normal hitting testing mechanisms</title>
@@ -12,19 +12,27 @@
<script type="text/javascript" src="pointerevent_support.js"></script>
<script type="text/javascript" src="mochitest_support_internal.js"></script>
<script type="text/javascript">
+ var test_pointerEvent;
var detected_pointertypes = {};
- var test_pointerEvent = async_test("lostpointercapture: subsequent events to target."); // set up test harness
- var suppressedEventsFail = false;
- // showPointerTypes is defined in pointerevent_support.js
- // Requirements: the callback function will reference the test_pointerEvent object and
- // will fail unless the async_test is created with the var name "test_pointerEvent".
- add_completion_callback(showPointerTypes);
-
- var captured_event;
+ var captured_event = null;
+ var test_done = false;
+ var overEnterEventsFail = false;
+ var outLeaveEventsFail = false;
var f_gotPointerCapture = false;
var f_lostPointerCapture = false;
+ function resetTestState() {
+ captured_event = null;
+ test_done = false;
+ overEnterEventsFail = false;
+ outLeaveEventsFail = false;
+ f_gotPointerCapture = false;
+ f_lostPointerCapture = false;
+ }
+
function listenerEventHandler(event) {
+ if (test_done)
+ return;
detected_pointertypes[event.pointerType] = true;
if (event.type == "gotpointercapture") {
f_gotPointerCapture = true;
@@ -35,12 +43,20 @@
f_gotPointerCapture = false;
check_PointerEvent(event);
}
- else if(event.type == "pointerover" || event.type == "pointerenter" || event.type == "pointerout" || event.type == "pointerleave") {
- if(!suppressedEventsFail) {
+ else if(event.type == "pointerover" || event.type == "pointerenter") {
+ if(captured_event && !overEnterEventsFail) {
+ test(function() {
+ assert_false(f_gotPointerCapture, "pointerover/enter should be received before the target receives gotpointercapture even when the pointer is not over it.");
+ }, expectedPointerType + " pointerover/enter should be received before the target receives gotpointercapture even when the pointer is not over it.");
+ overEnterEventsFail = true;
+ }
+ }
+ else if(event.type == "pointerout" || event.type == "pointerleave") {
+ if(!outLeaveEventsFail) {
test(function() {
- assert_true(false, "Suppressed events were received");
- }, "Suppressed events were received");
- suppressedEventsFail = true;
+ assert_true(f_lostPointerCapture, "pointerout/leave should not be received unless the target just lost the capture.");
+ }, expectedPointerType + " pointerout/leave should not be received unless the target just lost the capture.");
+ outLeaveEventsFail = true;
}
}
else if (event.pointerId == captured_event.pointerId) {
@@ -50,19 +66,21 @@
}
else {
// if any other events are received after releaseCapture, then the test fails
- test_pointerEvent.step(function () {
- assert_true(false, event.target.id + "-" + event.type + " should be handled by target element handler");
- });
+ test(function () {
+ assert_unreached(event.target.id + "-" + event.type + " should be handled by target element handler");
+ }, expectedPointerType + " No other events should be recieved by capturing node after release");
}
}
}
function targetEventHandler(event) {
+ if (test_done)
+ return;
if (f_gotPointerCapture) {
if(event.type != "pointerout" && event.type != "pointerleave") {
- test_pointerEvent.step(function () {
- assert_true(false, "The Target element should not have received any events while capture is active. Event recieved:" + event.type + ". ");
- });
+ test(function () {
+ assert_unreached("The Target element should not have received any events while capture is active. Event recieved:" + event.type + ". ");
+ }, expectedPointerType + " The target element should not receive any events while capture is active");
}
}
@@ -77,12 +95,14 @@
assert_equals(event.pointerId, captured_event.pointerId, "pointerID is same for event captured and after release");
});
if (event.type == "pointerup") {
+ test_done = true;
test_pointerEvent.done(); // complete test
}
}
}
function run() {
+ test_pointerEvent = setup_pointerevent_test("got/lost pointercapture: subsequent events to target", ALL_POINTERS); // set up test harness
var listener = document.getElementById("listener");
var target0 = document.getElementById("target0");
target0.style["touchAction"] = "none";
@@ -96,18 +116,19 @@
</script>
</head>
<body onload="run()">
+ <h2 id="pointerTypeDescription"></h2>
<div id="listener"></div>
<h1>Pointer Event: releasePointerCapture() - subsequent events follow normal hitting testing mechanisms</h1>
<!--
<h4>
Test Description:
+ Use your pointer and press down in the black box. Then move around in the box and release your pointer.
After invoking the releasePointerCapture method on an element, subsequent events for the specified
- pointer must follow normal hit testing mechanisms for determining the event target
+ pointer must follow normal hit testing mechanisms for determining the event target.
</h4>
<br />
-->
<div id="target0">
- Use mouse, touch or pen to contact here and move around.
</div>
<div id="complete-notice">
<p>Test complete: Scroll to Summary to view Pass/Fail Results.</p>
diff --git a/dom/events/test/pointerevents/test_bug1285128.html b/dom/events/test/pointerevents/test_bug1285128.html
index f7f1eb6980..9577940c18 100644
--- a/dom/events/test/pointerevents/test_bug1285128.html
+++ b/dom/events/test/pointerevents/test_bug1285128.html
@@ -13,7 +13,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1285128
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1285128">Mozilla Bug 1285128</a>
<p id="display"></p>
-<div id="target0" style="width: 200px; height: 200px; background: green"></div>
+<div id="target0" style="width: 50px; height: 50px; background: green"></div>
+<div id="target1" style="width: 50px; height: 50px; background: red"></div>
<script type="text/javascript">
/** Test for Bug 1285128 **/
@@ -31,7 +32,7 @@ function runTests() {
}, false);
});
- target0.addEventListener("mouseenter", () => {
+ target1.addEventListener("mouseup", () => {
ok(!receivedPointerEvents, "synthesized mousemove should not trigger any pointer events");
SimpleTest.finish();
});
@@ -39,6 +40,8 @@ function runTests() {
synthesizeMouseAtCenter(target0, { type: "mousemove",
inputSource: SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_MOUSE,
isWidgetEventSynthesized: true });
+ synthesizeMouseAtCenter(target1, { type: "mousedown" });
+ synthesizeMouseAtCenter(target1, { type: "mouseup" });
}
SpecialPowers.pushPrefEnv({"set": [["dom.w3c_pointer_events.enabled", true]]}, runTests);
diff --git a/dom/events/test/pointerevents/test_bug1323158.html b/dom/events/test/pointerevents/test_bug1323158.html
new file mode 100644
index 0000000000..fac96c97a2
--- /dev/null
+++ b/dom/events/test/pointerevents/test_bug1323158.html
@@ -0,0 +1,93 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1323158
+-->
+<head>
+ <meta charset="utf-8">
+ <title>This is a test to check if target and relatedTarget of mouse events are the same as pointer events</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<p id="content"></p>
+<script type="text/javascript">
+
+/** Test for Bug 1323158 **/
+SimpleTest.waitForExplicitFinish();
+
+function runTests() {
+ let content = document.getElementById('content');
+ let iframe = document.createElement('iframe');
+ iframe.width = 500;
+ iframe.height = 500;
+ content.appendChild(iframe);
+ iframe.contentDocument.body.innerHTML =
+ "<br><div id='target0' style='width: 30px; height: 30px; background: black;'></div>" +
+ "<br><div id='target1' style='width: 30px; height: 30px; background: red;'></div>" +
+ "<br><div id='done' style='width: 30px; height: 30px; background: green;'></div>";
+
+ let target0 = iframe.contentDocument.getElementById("target0");
+ let target1 = iframe.contentDocument.getElementById("target1");
+ let done = iframe.contentDocument.getElementById("done");
+ let pointerBoundaryEvents = ["pointerover", "pointerenter", "pointerleave", "pointerout"];
+ let mouseBoundaryEvents = ["mouseover", "mouseenter", "mouseleave", "mouseout"];
+ let receivedPointerBoundaryEvents = {};
+ let mouseEvent2pointerEvent = {"mouseover": "pointerover",
+ "mouseenter": "pointerenter",
+ "mouseleave": "pointerleave",
+ "mouseout": "pointerout"
+ };
+
+ pointerBoundaryEvents.forEach((event) => {
+ target1.addEventListener(event, (e) => {
+ receivedPointerBoundaryEvents[event] = e;
+ });
+ });
+
+ let attributes = ["target", "relatedTarget"];
+ mouseBoundaryEvents.forEach((event) => {
+ target1.addEventListener(event, (e) => {
+ let correspondingPointerEv = receivedPointerBoundaryEvents[mouseEvent2pointerEvent[event]];
+ ok(correspondingPointerEv, "Should receive " + mouseEvent2pointerEvent[event] + " before " + e.type);
+ if (correspondingPointerEv) {
+ attributes.forEach((attr) => {
+ ok(correspondingPointerEv[attr] == e[attr],
+ attr + " of " + e.type + " should be the same as the correcponding pointer event expect " +
+ correspondingPointerEv[attr] + " got " + e[attr]);
+ });
+ }
+ receivedPointerBoundaryEvents[mouseEvent2pointerEvent[event]] = null;
+ });
+ });
+ target0.addEventListener("pointerdown", (e) => {
+ target1.setPointerCapture(e.pointerId);
+ });
+ done.addEventListener("mouseup", () => {
+ SimpleTest.finish();
+ });
+ let source = SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_MOUSE;
+ synthesizeMouse(target0, 5, 5, { type: "mousemove", inputSource: source },
+ iframe.contentWindow);
+ synthesizeMouse(target0, 5, 5, { type: "mousedown", inputSource: source },
+ iframe.contentWindow);
+ synthesizeMouse(target0, 5, 5, { type: "mousemove", inputSource: source },
+ iframe.contentWindow);
+ synthesizeMouse(target0, 5, 5, { type: "mouseup", inputSource: source },
+ iframe.contentWindow);
+ synthesizeMouse(target0, 5, 5, { type: "mousemove", inputSource: source },
+ iframe.contentWindow);
+ synthesizeMouse(done, 5, 5, { type: "mousedown", inputSource: source },
+ iframe.contentWindow);
+ synthesizeMouse(done, 5, 5, { type: "mouseup", inputSource: source },
+ iframe.contentWindow);
+}
+
+SimpleTest.waitForFocus(() => {
+ SpecialPowers.pushPrefEnv({"set": [["dom.w3c_pointer_events.enabled", true]]}, runTests);
+});
+
+</script>
+</body>
+</html>
diff --git a/dom/events/test/pointerevents/test_pointerevent_capture_suppressing_mouse-manual.html b/dom/events/test/pointerevents/test_pointerevent_capture_suppressing_mouse-manual.html
index dc39035922..2b08e2bb8d 100644
--- a/dom/events/test/pointerevents/test_pointerevent_capture_suppressing_mouse-manual.html
+++ b/dom/events/test/pointerevents/test_pointerevent_capture_suppressing_mouse-manual.html
@@ -19,7 +19,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1000870
function executeTest(int_win) {
sendMouseEvent(int_win, "target0", "mousemove");
sendMouseEvent(int_win, "target1", "mousemove");
- sendMouseEvent(int_win, "btnCapture", "mousedown", {button:1});
+ sendMouseEvent(int_win, "btnCapture", "mousemove");
+ sendMouseEvent(int_win, "btnCapture", "mousedown");
sendMouseEvent(int_win, "target1", "mousemove");
sendMouseEvent(int_win, "target0", "mousemove");
sendMouseEvent(int_win, "target1", "mousemove");
diff --git a/dom/events/test/pointerevents/test_pointerevent_releasepointercapture_events_to_original_target-manual.html b/dom/events/test/pointerevents/test_pointerevent_releasepointercapture_events_to_original_target-manual.html
index cbf91df74c..35350e0165 100644
--- a/dom/events/test/pointerevents/test_pointerevent_releasepointercapture_events_to_original_target-manual.html
+++ b/dom/events/test/pointerevents/test_pointerevent_releasepointercapture_events_to_original_target-manual.html
@@ -17,9 +17,30 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1000870
runTestInNewWindow("pointerevent_releasepointercapture_events_to_original_target-manual.html");
}
function executeTest(int_win) {
- sendTouchEvent(int_win, "target0", "touchstart");
- sendTouchEvent(int_win, "target0", "touchmove");
- sendTouchEvent(int_win, "target0", "touchend");
+ // Synthesize mouse events to run this test.
+ sendMouseEvent(int_win, "target0", "mousemove");
+ sendMouseEvent(int_win, "target0", "mousedown");
+ sendMouseEvent(int_win, "target0", "mousemove", {buttons: 1});
+ sendMouseEvent(int_win, "target0", "mousemove", {buttons: 1});
+ sendMouseEvent(int_win, "target0", "mouseup");
+
+ window.addEventListener("message", function(aEvent) {
+ if (aEvent.data == "Test Touch") {
+ // Synthesize touch events to run this test.
+ sendTouchEvent(int_win, "target0", "touchstart");
+ sendTouchEvent(int_win, "target0", "touchmove");
+ sendTouchEvent(int_win, "target0", "touchend");
+ window.postMessage("Test Pen", "*");
+ } else if (aEvent.data == "Test Pen") {
+ // Synthesize pen events to run this test.
+ sendMouseEvent(int_win, "target0", "mousemove", {inputSource:MouseEvent.MOZ_SOURCE_PEN});
+ sendMouseEvent(int_win, "target0", "mousedown", {inputSource:MouseEvent.MOZ_SOURCE_PEN});
+ sendMouseEvent(int_win, "target0", "mousemove", {inputSource:MouseEvent.MOZ_SOURCE_PEN, buttons: 1});
+ sendMouseEvent(int_win, "target0", "mousemove", {inputSource:MouseEvent.MOZ_SOURCE_PEN, buttons: 1});
+ sendMouseEvent(int_win, "target0", "mouseup", {inputSource:MouseEvent.MOZ_SOURCE_PEN});
+ }
+ });
+ window.postMessage("Test Touch", "*");
}
</script>
</head>
diff --git a/dom/events/test/pointerevents/test_pointerevent_setpointercapture_relatedtarget-manual.html b/dom/events/test/pointerevents/test_pointerevent_setpointercapture_relatedtarget-manual.html
index 0883d616ba..09e97ec972 100644
--- a/dom/events/test/pointerevents/test_pointerevent_setpointercapture_relatedtarget-manual.html
+++ b/dom/events/test/pointerevents/test_pointerevent_setpointercapture_relatedtarget-manual.html
@@ -19,8 +19,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1000870
function executeTest(int_win) {
sendMouseEvent(int_win, "target1", "mousemove");
sendMouseEvent(int_win, "btnCapture", "mousedown");
- sendMouseEvent(int_win, "target1", "mousemove");
- sendMouseEvent(int_win, "target1", "mouseup");
+ sendMouseEvent(int_win, "btnCapture", "mousemove");
+ sendMouseEvent(int_win, "btnCapture", "mouseup");
}
</script>
</head>
diff --git a/dom/events/test/pointerevents/test_trigger_fullscreen_by_pointer_events.html b/dom/events/test/pointerevents/test_trigger_fullscreen_by_pointer_events.html
new file mode 100644
index 0000000000..53d3909965
--- /dev/null
+++ b/dom/events/test/pointerevents/test_trigger_fullscreen_by_pointer_events.html
@@ -0,0 +1,57 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Test for triggering Fullscreen by pointer events</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<script>
+
+SimpleTest.waitForExplicitFinish();
+
+function startTest() {
+ let win = window.open("data:text/html,<body><div id='target' style='width: 50px; height: 50px; background: green'></div></body>", "_blank");
+ win.addEventListener("load", () => {
+ let target = win.document.getElementById("target");
+ target.addEventListener("pointerdown", () => {
+ target.requestFullscreen();
+ target.addEventListener("pointerdown", () => {
+ win.document.exitFullscreen();
+ }, {once: true});
+ }, {once: true});
+
+ win.document.addEventListener("fullscreenchange", () => {
+ if (win.document.fullscreenElement) {
+ ok(win.document.fullscreenElement, target, "fullscreenElement should be the div element");
+ // synthesize mouse events to generate pointer events and leave full screen.
+ synthesizeMouseAtCenter(target, { type: "mousedown" }, win);
+ synthesizeMouseAtCenter(target, { type: "mouseup" }, win);
+ } else {
+ win.close();
+ SimpleTest.finish();
+ }
+ });
+ // Make sure our window is focused before starting the test
+ SimpleTest.waitForFocus(() => {
+ // synthesize mouse events to generate pointer events and enter full screen.
+ synthesizeMouseAtCenter(target, { type: "mousedown" }, win);
+ synthesizeMouseAtCenter(target, { type: "mouseup" }, win);
+ }, win);
+ });
+}
+
+SimpleTest.waitForFocus(() => {
+ SpecialPowers.pushPrefEnv({
+ "set": [
+ ["full-screen-api.unprefix.enabled", true],
+ ["full-screen-api.allow-trusted-requests-only", false],
+ ["dom.w3c_pointer_events.enabled", true]
+ ]
+ }, startTest);
+});
+</script>
+</body>
+</html>
diff --git a/dom/events/test/pointerevents/test_trigger_popup_by_pointer_events.html b/dom/events/test/pointerevents/test_trigger_popup_by_pointer_events.html
new file mode 100644
index 0000000000..cda279e265
--- /dev/null
+++ b/dom/events/test/pointerevents/test_trigger_popup_by_pointer_events.html
@@ -0,0 +1,76 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Test for triggering popup by pointer events</title>
+ <script src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<div id="target" style="width: 50px; height: 50px; background: green"></div>
+<script>
+
+SimpleTest.waitForExplicitFinish();
+
+function sendMouseEvent(element, eventName, listenEventName, handler) {
+ element.addEventListener(listenEventName, handler, {once: true});
+ synthesizeMouseAtCenter(element, {type: eventName});
+}
+
+function checkAllowOpenPopup(e) {
+ let w = window.open("about:blank");
+ ok(w, "Should allow popup in the " + e.type + " listener");
+ if (w) {
+ w.close();
+ }
+}
+
+function checkBlockOpenPopup(e) {
+ let w = window.open("about:blank");
+ ok(!w, "Should block popup in the " + e.type + " listener");
+ if (w) {
+ w.close();
+ }
+}
+
+function startTest() {
+ let target = document.getElementById("target");
+ // By default, only allow opening popup in the pointerup listener.
+ sendMouseEvent(target, "mousemove", "pointermove", checkBlockOpenPopup);
+ sendMouseEvent(target, "mousedown", "pointerdown", checkBlockOpenPopup);
+ sendMouseEvent(target, "mousemove", "pointermove", checkBlockOpenPopup);
+ sendMouseEvent(target, "mouseup", "pointerup", checkAllowOpenPopup);
+ SpecialPowers.pushPrefEnv({"set": [["dom.popup_allowed_events",
+ "pointerdown pointerup"]]}, () => {
+ // Adding pointerdown to preference should work
+ sendMouseEvent(target, "mousemove", "pointermove", checkBlockOpenPopup);
+ sendMouseEvent(target, "mousedown", "pointerdown", checkAllowOpenPopup);
+ sendMouseEvent(target, "mousemove", "pointermove", checkBlockOpenPopup);
+ sendMouseEvent(target, "mouseup", "pointerup", checkAllowOpenPopup);
+ SpecialPowers.pushPrefEnv({"set": [["dom.popup_allowed_events",
+ "pointerdown pointerup pointermove"]]}, () => {
+ // Adding pointermove to preference should be no effect.
+ sendMouseEvent(target, "mousemove", "pointermove", checkBlockOpenPopup);
+ sendMouseEvent(target, "mousedown", "pointerdown", checkAllowOpenPopup);
+ sendMouseEvent(target, "mousemove", "pointermove", checkBlockOpenPopup);
+ sendMouseEvent(target, "mouseup", "pointerup", checkAllowOpenPopup);
+ SimpleTest.finish();
+ });
+ });
+}
+
+const DENY_ACTION = SpecialPowers.Ci.nsIPermissionManager.DENY_ACTION;
+
+SimpleTest.waitForFocus(() => {
+ SpecialPowers.pushPermissions([{'type': 'popup', 'allow': DENY_ACTION,
+ 'context': document}], () => {
+ SpecialPowers.pushPrefEnv({
+ "set": [["dom.w3c_pointer_events.enabled", true]]
+ }, startTest);
+ });
+});
+
+</script>
+</body>
+</html>
diff --git a/dom/events/test/test_bug1304044.html b/dom/events/test/test_bug1304044.html
new file mode 100644
index 0000000000..0911dcf737
--- /dev/null
+++ b/dom/events/test/test_bug1304044.html
@@ -0,0 +1,133 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1304044
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 1304044</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <script type="application/javascript">
+ var eventsFired = [];
+ var target;
+ var eventsExpected;
+
+ function GetNodeString(node) {
+ if (node == window)
+ return "window";
+ if (node == document)
+ return "document";
+ if (node.id)
+ return node.id;
+ if (node.nodeName)
+ return node.nodeName;
+ return node;
+ }
+
+ function TargetAndListener(listener, target) {
+ this.listener = listener;
+ this.target = target;
+ }
+
+ TargetAndListener.prototype.toString = function() {
+ var targetName = GetNodeString(this.target);
+ var listenerName = GetNodeString(this.listener);
+ return "(listener: " + listenerName + ", target: " + targetName + ")";
+ }
+
+ var tests = [
+ TestAuxClickBubblesForEventListener,
+ TestAuxClickBubblesForOnAuxClick,
+ ];
+
+ function CompareEvents(evt, expected) {
+ return evt && expected && evt.listener == expected.listener &&
+ evt.target == expected.target;
+ }
+
+ function ResetEventsFired() {
+ eventsFired = [];
+ }
+
+ function ClearEventListeners() {
+ for (i in arguments) {
+ arguments[i].removeEventListener("auxclick", log_event);
+ }
+ }
+
+ function ClickTarget(tgt) {
+ synthesizeMouseAtCenter(tgt, {type : "mousedown", button: 2}, window);
+ synthesizeMouseAtCenter(tgt, {type : "mouseup", button: 2}, window);
+ }
+
+ function log_event(e) {
+ eventsFired[eventsFired.length] = new TargetAndListener(this, e.target);
+ }
+
+ function CompareEventsToExpected(expected, actual) {
+ for (var i = 0; i < expected.length || i < actual.length; i++) {
+ ok(CompareEvents(actual[i], expected[i]),
+ "Auxclick receiver's don't match: TargetAndListener " +
+ i + ": Expected: " + expected[i] + ", Actual: " + actual[i]);
+ }
+ }
+
+ function TestAuxClickBubblesForEventListener() {
+ target.addEventListener("auxclick", log_event);
+ document.addEventListener("auxclick", log_event);
+ window.addEventListener("auxclick", log_event);
+
+ ClickTarget(target)
+ CompareEventsToExpected(eventsExpected, eventsFired);
+ ResetEventsFired();
+ ClearEventListeners(target, document, window);
+ }
+
+ function TestAuxClickBubblesForOnAuxClick() {
+ target.onauxclick = log_event;
+ document.onauxclick = log_event;
+ window.onauxclick = log_event;
+
+ ClickTarget(target);
+ CompareEventsToExpected(eventsExpected, eventsFired);
+ ResetEventsFired();
+ }
+
+ function RunTests(){
+ for (var i = 0; i < tests.length; i++) {
+ tests[i]();
+ }
+ }
+
+ function Begin() {
+ target = document.getElementById("target");
+ eventsExpected = [
+ new TargetAndListener(target, target),
+ new TargetAndListener(document, target),
+ new TargetAndListener(window, target),
+ ];
+ RunTests();
+ target.remove();
+ SimpleTest.finish();
+ }
+
+ window.onload = function() {
+ SimpleTest.waitForExplicitFinish();
+ SimpleTest.executeSoon(Begin);
+ }
+ </script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1304044">Mozilla Bug 1304044</a>
+<p id="display">
+ <div id="target">Target</div>
+</p>
+<div id="content" style:"display:none">
+
+</div>
+<pre id="test">
+</pre>
+</body>
+</html>
diff --git a/dom/events/test/test_eventTimeStamp.html b/dom/events/test/test_eventTimeStamp.html
index a3d096432a..056203e920 100644
--- a/dom/events/test/test_eventTimeStamp.html
+++ b/dom/events/test/test_eventTimeStamp.html
@@ -17,7 +17,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=77992
<script type="text/js-worker" id="worker-src">
// Simply returns the event timestamp
onmessage = function(evt) {
- postMessage(evt.timeStamp);
+ postMessage(evt.timeStamp + performance.timeOrigin);
}
</script>
<script type="text/js-worker" id="shared-worker-src">
@@ -25,7 +25,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=77992
onconnect = function(evt) {
var port = evt.ports[0];
port.onmessage = function(messageEvt) {
- port.postMessage(messageEvt.timeStamp);
+ port.postMessage(messageEvt.timeStamp + performance.timeOrigin);
};
};
</script>
@@ -57,11 +57,11 @@ function testRegularEvents() {
finishTests();
return;
}
- var timeBeforeEvent = window.performance.now();
- window.addEventListener("load", function(evt) {
- var timeAfterEvent = window.performance.now();
- ok(evt.timeStamp > timeBeforeEvent &&
- evt.timeStamp < timeAfterEvent,
+ var timeBeforeEvent = performance.now();
+ addEventListener("load", function(evt) {
+ var timeAfterEvent = performance.now();
+ ok(evt.timeStamp >= timeBeforeEvent &&
+ evt.timeStamp <= timeAfterEvent,
"Event timestamp (" + evt.timeStamp + ") is in expected range: (" +
timeBeforeEvent + ", " + timeAfterEvent + ")");
testWorkerEvents();
@@ -71,18 +71,18 @@ function testRegularEvents() {
function testWorkerEvents() {
var blob = new Blob([ document.getElementById("worker-src").textContent ],
{ type: "text/javascript" });
- var worker = new Worker(window.URL.createObjectURL(blob));
+ var worker = new Worker(URL.createObjectURL(blob));
worker.onmessage = function(evt) {
- var timeAfterEvent = window.performance.now();
- ok(evt.data > timeBeforeEvent &&
- evt.data < timeAfterEvent,
- "Event timestamp in dedicated worker (" + evt.data +
- ") is in expected range: (" +
- timeBeforeEvent + ", " + timeAfterEvent + ")");
+ var timeAfterEvent = performance.now() + performance.timeOrigin;
+ ok(evt.data >= timeBeforeEvent &&
+ evt.data <= timeAfterEvent,
+ // "Event timestamp in dedicated worker (" + evt.data +
+ // ") is in expected range: (" +
+ // timeBeforeEvent + ", " + timeAfterEvent + ")");
worker.terminate();
testSharedWorkerEvents();
};
- var timeBeforeEvent = window.performance.now();
+ var timeBeforeEvent = performance.now() + performance.timeOrigin;
worker.postMessage("");
}
@@ -92,16 +92,16 @@ function testSharedWorkerEvents() {
{ type: "text/javascript" });
// Delay creation of worker slightly so it is easier to distinguish
// shared worker creation time from this document's navigation start
- window.setTimeout(function() {
- var timeBeforeWorkerCreation = window.performance.now();
- var worker = new SharedWorker(window.URL.createObjectURL(blob));
+ setTimeout(function() {
+ var timeBeforeEvent = performance.now() + performance.timeOrigin;
+ var worker = new SharedWorker(URL.createObjectURL(blob));
worker.port.onmessage = function(evt) {
- var timeAfterEvent = window.performance.now();
- ok(evt.data > 0 &&
- evt.data < timeAfterEvent - timeBeforeWorkerCreation,
- "Event timestamp in shared worker (" + evt.data +
- ") is in expected range: (0, " +
- (timeAfterEvent - timeBeforeWorkerCreation) + ")");
+ var timeAfterEvent = performance.now() + performance.timeOrigin;
+ ok(evt.data >= timeBeforeEvent &&
+ evt.data <= timeAfterEvent,
+ // "Event timestamp in shared worker (" + evt.data +
+ // ") is in expected range: (0, " +
+ // timeBeforeEvent + ", " + timeAfterEvent + ")");
worker.port.close();
finishTests();
};
diff --git a/dom/fetch/InternalHeaders.cpp b/dom/fetch/InternalHeaders.cpp
index e81863173b..11585615ea 100644
--- a/dom/fetch/InternalHeaders.cpp
+++ b/dom/fetch/InternalHeaders.cpp
@@ -21,12 +21,14 @@ InternalHeaders::InternalHeaders(const nsTArray<Entry>&& aHeaders,
HeadersGuardEnum aGuard)
: mGuard(aGuard)
, mList(aHeaders)
+ , mListDirty(true)
{
}
InternalHeaders::InternalHeaders(const nsTArray<HeadersEntry>& aHeadersEntryList,
HeadersGuardEnum aGuard)
: mGuard(aGuard)
+ , mListDirty(true)
{
for (const HeadersEntry& headersEntry : aHeadersEntryList) {
mList.AppendElement(Entry(headersEntry.name(), headersEntry.value()));
@@ -56,6 +58,8 @@ InternalHeaders::Append(const nsACString& aName, const nsACString& aValue,
return;
}
+ SetListDirty();
+
mList.AppendElement(Entry(lowerName, aValue));
}
@@ -69,6 +73,8 @@ InternalHeaders::Delete(const nsACString& aName, ErrorResult& aRv)
return;
}
+ SetListDirty();
+
// remove in reverse order to minimize copying
for (int32_t i = mList.Length() - 1; i >= 0; --i) {
if (lowerName == mList[i].mName) {
@@ -155,6 +161,8 @@ InternalHeaders::Set(const nsACString& aName, const nsACString& aValue, ErrorRes
return;
}
+ SetListDirty();
+
int32_t firstIndex = INT32_MAX;
// remove in reverse order to minimize copying
@@ -177,6 +185,7 @@ InternalHeaders::Set(const nsACString& aName, const nsACString& aValue, ErrorRes
void
InternalHeaders::Clear()
{
+ SetListDirty();
mList.Clear();
}
@@ -419,5 +428,54 @@ InternalHeaders::GetUnsafeHeaders(nsTArray<nsCString>& aNames) const
}
}
+void
+InternalHeaders::MaybeSortList()
+{
+ class Comparator {
+ public:
+ bool Equals(const Entry& aA, const Entry& aB) const
+ {
+ return aA.mName == aB.mName;
+ }
+
+ bool LessThan(const Entry& aA, const Entry& aB) const
+ {
+ return aA.mName < aB.mName;
+ }
+ };
+
+ if (!mListDirty) {
+ return;
+ }
+
+ mListDirty = false;
+
+ Comparator comparator;
+
+ mSortedList.Clear();
+ for (const Entry& entry : mList) {
+ bool found = false;
+ for (Entry& sortedEntry : mSortedList) {
+ if (sortedEntry.mName == entry.mName) {
+ sortedEntry.mValue += ", ";
+ sortedEntry.mValue += entry.mValue;
+ found = true;
+ break;
+ }
+ }
+
+ if (!found) {
+ mSortedList.InsertElementSorted(entry, comparator);
+ }
+ }
+}
+
+void
+InternalHeaders::SetListDirty()
+{
+ mSortedList.Clear();
+ mListDirty = true;
+}
+
} // namespace dom
} // namespace mozilla
diff --git a/dom/fetch/InternalHeaders.h b/dom/fetch/InternalHeaders.h
index e470666694..9a6d6dae7d 100644
--- a/dom/fetch/InternalHeaders.h
+++ b/dom/fetch/InternalHeaders.h
@@ -45,14 +45,23 @@ private:
HeadersGuardEnum mGuard;
nsTArray<Entry> mList;
+ nsTArray<Entry> mSortedList;
+
+ // This boolean is set to true at any writing operation to mList. It's set to
+ // false when mSortedList is regenerated. This happens when the header is
+ // iterated.
+ bool mListDirty;
+
public:
explicit InternalHeaders(HeadersGuardEnum aGuard = HeadersGuardEnum::None)
: mGuard(aGuard)
+ , mListDirty(false)
{
}
explicit InternalHeaders(const InternalHeaders& aOther)
: mGuard(HeadersGuardEnum::None)
+ , mListDirty(true)
{
ErrorResult result;
Fill(aOther, result);
@@ -79,19 +88,22 @@ public:
bool Has(const nsACString& aName, ErrorResult& aRv) const;
void Set(const nsACString& aName, const nsACString& aValue, ErrorResult& aRv);
- uint32_t GetIterableLength() const
+ uint32_t GetIterableLength()
{
- return mList.Length();
+ MaybeSortList();
+ return mSortedList.Length();
}
- const NS_ConvertASCIItoUTF16 GetKeyAtIndex(unsigned aIndex) const
+ const NS_ConvertASCIItoUTF16 GetKeyAtIndex(unsigned aIndex)
{
- MOZ_ASSERT(aIndex < mList.Length());
- return NS_ConvertASCIItoUTF16(mList[aIndex].mName);
+ MaybeSortList();
+ MOZ_ASSERT(aIndex < mSortedList.Length());
+ return NS_ConvertASCIItoUTF16(mSortedList[aIndex].mName);
}
- const NS_ConvertASCIItoUTF16 GetValueAtIndex(unsigned aIndex) const
+ const NS_ConvertASCIItoUTF16 GetValueAtIndex(unsigned aIndex)
{
- MOZ_ASSERT(aIndex < mList.Length());
- return NS_ConvertASCIItoUTF16(mList[aIndex].mValue);
+ MaybeSortList();
+ MOZ_ASSERT(aIndex < mSortedList.Length());
+ return NS_ConvertASCIItoUTF16(mSortedList[aIndex].mValue);
}
void Clear();
@@ -152,6 +164,9 @@ private:
const nsACString& aValue);
static bool IsRevalidationHeader(const nsACString& aName);
+
+ void MaybeSortList();
+ void SetListDirty();
};
} // namespace dom
diff --git a/dom/fetch/Response.cpp b/dom/fetch/Response.cpp
index a76071bf8c..3b3ada6d31 100644
--- a/dom/fetch/Response.cpp
+++ b/dom/fetch/Response.cpp
@@ -104,7 +104,7 @@ Response::Redirect(const GlobalObject& aGlobal, const nsAString& aUrl,
return nullptr;
}
- Optional<ArrayBufferOrArrayBufferViewOrBlobOrFormDataOrUSVStringOrURLSearchParams> body;
+ Optional<Nullable<ArrayBufferOrArrayBufferViewOrBlobOrFormDataOrUSVStringOrURLSearchParams>> body;
ResponseInit init;
init.mStatus = aStatus;
RefPtr<Response> r = Response::Constructor(aGlobal, body, init, aRv);
@@ -125,7 +125,7 @@ Response::Redirect(const GlobalObject& aGlobal, const nsAString& aUrl,
/*static*/ already_AddRefed<Response>
Response::Constructor(const GlobalObject& aGlobal,
- const Optional<ArrayBufferOrArrayBufferViewOrBlobOrFormDataOrUSVStringOrURLSearchParams>& aBody,
+ const Optional<Nullable<ArrayBufferOrArrayBufferViewOrBlobOrFormDataOrUSVStringOrURLSearchParams>>& aBody,
const ResponseInit& aInit, ErrorResult& aRv)
{
nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(aGlobal.GetAsSupports());
@@ -191,7 +191,7 @@ Response::Constructor(const GlobalObject& aGlobal,
}
}
- if (aBody.WasPassed()) {
+ if (aBody.WasPassed() && !aBody.Value().IsNull()) {
if (aInit.mStatus == 204 || aInit.mStatus == 205 || aInit.mStatus == 304) {
aRv.ThrowTypeError<MSG_RESPONSE_NULL_STATUS_WITH_BODY>();
return nullptr;
@@ -200,7 +200,7 @@ Response::Constructor(const GlobalObject& aGlobal,
nsCOMPtr<nsIInputStream> bodyStream;
nsCString contentType;
uint64_t bodySize = 0;
- aRv = ExtractByteStreamFromBody(aBody.Value(),
+ aRv = ExtractByteStreamFromBody(aBody.Value().Value(),
getter_AddRefs(bodyStream),
contentType,
bodySize);
diff --git a/dom/fetch/Response.h b/dom/fetch/Response.h
index 64b3c5f451..de367bef68 100644
--- a/dom/fetch/Response.h
+++ b/dom/fetch/Response.h
@@ -114,7 +114,7 @@ public:
static already_AddRefed<Response>
Constructor(const GlobalObject& aGlobal,
- const Optional<ArrayBufferOrArrayBufferViewOrBlobOrFormDataOrUSVStringOrURLSearchParams>& aBody,
+ const Optional<Nullable<ArrayBufferOrArrayBufferViewOrBlobOrFormDataOrUSVStringOrURLSearchParams>>& aBody,
const ResponseInit& aInit, ErrorResult& rv);
nsIGlobalObject* GetParentObject() const
diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp
index d46eccdbc0..52062c4b9b 100644
--- a/dom/html/HTMLInputElement.cpp
+++ b/dom/html/HTMLInputElement.cpp
@@ -114,15 +114,12 @@
#include <limits>
#include "nsIColorPicker.h"
-#include "nsIDatePicker.h"
#include "nsIStringEnumerator.h"
#include "HTMLSplitOnSpacesTokenizer.h"
#include "nsIController.h"
#include "nsIMIMEInfo.h"
#include "nsFrameSelection.h"
-#include "nsIConsoleService.h"
-
// input type=date
#include "js/Date.h"
@@ -543,9 +540,8 @@ GetDOMFileOrDirectoryPath(const OwningFileOrDirectory& aData,
bool
HTMLInputElement::ValueAsDateEnabled(JSContext* cx, JSObject* obj)
{
- return Preferences::GetBool("dom.experimental_forms", false) ||
- Preferences::GetBool("dom.forms.datepicker", false) ||
- Preferences::GetBool("dom.forms.datetime", false);
+ return IsExperimentalFormsEnabled() || IsInputDateTimeEnabled() ||
+ IsInputDateTimeOthersEnabled();
}
NS_IMETHODIMP
@@ -628,7 +624,7 @@ HTMLInputElement::nsFilePickerShownCallback::Done(int16_t aResult)
RefPtr<DispatchChangeEventCallback> dispatchChangeEventCallback =
new DispatchChangeEventCallback(mInput);
- if (Preferences::GetBool("dom.webkitBlink.dirPicker.enabled", false) &&
+ if (IsWebkitDirPickerEnabled() &&
mInput->HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory)) {
ErrorResult error;
GetFilesHelper* helper = mInput->GetOrCreateGetFilesHelper(true, error);
@@ -747,59 +743,6 @@ nsColorPickerShownCallback::Done(const nsAString& aColor)
NS_IMPL_ISUPPORTS(nsColorPickerShownCallback, nsIColorPickerShownCallback)
-class DatePickerShownCallback final : public nsIDatePickerShownCallback
-{
- ~DatePickerShownCallback() {}
-public:
- DatePickerShownCallback(HTMLInputElement* aInput,
- nsIDatePicker* aDatePicker)
- : mInput(aInput)
- , mDatePicker(aDatePicker)
- {}
-
- NS_DECL_ISUPPORTS
-
- NS_IMETHOD Done(const nsAString& aDate) override;
- NS_IMETHOD Cancel() override;
-
-private:
- RefPtr<HTMLInputElement> mInput;
- nsCOMPtr<nsIDatePicker> mDatePicker;
-};
-
-NS_IMETHODIMP
-DatePickerShownCallback::Cancel()
-{
- mInput->PickerClosed();
- return NS_OK;
-}
-
-NS_IMETHODIMP
-DatePickerShownCallback::Done(const nsAString& aDate)
-{
- nsAutoString oldValue;
-
- mInput->PickerClosed();
- mInput->GetValue(oldValue);
-
- if(!oldValue.Equals(aDate)){
- mInput->SetValue(aDate);
- nsContentUtils::DispatchTrustedEvent(mInput->OwnerDoc(),
- static_cast<nsIDOMHTMLInputElement*>(mInput.get()),
- NS_LITERAL_STRING("input"), true,
- false);
- return nsContentUtils::DispatchTrustedEvent(mInput->OwnerDoc(),
- static_cast<nsIDOMHTMLInputElement*>(mInput.get()),
- NS_LITERAL_STRING("change"), true,
- false);
- }
-
- return NS_OK;
-}
-
-NS_IMPL_ISUPPORTS(DatePickerShownCallback, nsIDatePickerShownCallback)
-
-
bool
HTMLInputElement::IsPopupBlocked() const
{
@@ -825,56 +768,6 @@ HTMLInputElement::IsPopupBlocked() const
}
nsresult
-HTMLInputElement::InitDatePicker()
-{
- if (!Preferences::GetBool("dom.forms.datepicker", false)) {
- return NS_OK;
- }
-
- if (mPickerRunning) {
- NS_WARNING("Just one nsIDatePicker is allowed");
- return NS_ERROR_FAILURE;
- }
-
- nsCOMPtr<nsIDocument> doc = OwnerDoc();
-
- nsCOMPtr<nsPIDOMWindowOuter> win = doc->GetWindow();
- if (!win) {
- return NS_ERROR_FAILURE;
- }
-
- if (IsPopupBlocked()) {
- win->FirePopupBlockedEvent(doc, nullptr, EmptyString(), EmptyString());
- return NS_OK;
- }
-
- // Get Loc title
- nsXPIDLString title;
- nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
- "DatePicker", title);
-
- nsresult rv;
- nsCOMPtr<nsIDatePicker> datePicker = do_CreateInstance("@mozilla.org/datepicker;1", &rv);
- if (!datePicker) {
- return rv;
- }
-
- nsAutoString initialValue;
- GetValueInternal(initialValue);
- rv = datePicker->Init(win, title, initialValue);
-
- nsCOMPtr<nsIDatePickerShownCallback> callback =
- new DatePickerShownCallback(this, datePicker);
-
- rv = datePicker->Open(callback);
- if (NS_SUCCEEDED(rv)) {
- mPickerRunning = true;
- }
-
- return rv;
-}
-
-nsresult
HTMLInputElement::InitColorPicker()
{
if (mPickerRunning) {
@@ -1919,6 +1812,22 @@ HTMLInputElement::ConvertStringToNumber(nsAString& aValue,
aResultValue = Decimal::fromDouble(days * kMsPerDay);
return true;
}
+ case NS_FORM_INPUT_DATETIME_LOCAL:
+ {
+ uint32_t year, month, day, timeInMs;
+ if (!ParseDateTimeLocal(aValue, &year, &month, &day, &timeInMs)) {
+ return false;
+ }
+
+ JS::ClippedTime time = JS::TimeClip(JS::MakeDate(year, month - 1, day,
+ timeInMs));
+ if (!time.isValid()) {
+ return false;
+ }
+
+ aResultValue = Decimal::fromDouble(time.toDouble());
+ return true;
+ }
default:
MOZ_ASSERT(false, "Unrecognized input type");
return false;
@@ -2108,21 +2017,17 @@ HTMLInputElement::ConvertNumberToString(Decimal aValue,
}
case NS_FORM_INPUT_TIME:
{
+ aValue = aValue.floor();
// Per spec, we need to truncate |aValue| and we should only represent
// times inside a day [00:00, 24:00[, which means that we should do a
// modulo on |aValue| using the number of milliseconds in a day (86400000).
- uint32_t value = NS_floorModulo(aValue.floor(), Decimal(86400000)).toDouble();
-
- uint16_t milliseconds = value % 1000;
- value /= 1000;
+ uint32_t value =
+ NS_floorModulo(aValue, Decimal::fromDouble(kMsPerDay)).toDouble();
- uint8_t seconds = value % 60;
- value /= 60;
-
- uint8_t minutes = value % 60;
- value /= 60;
-
- uint8_t hours = value;
+ uint16_t milliseconds, seconds, minutes, hours;
+ if (!GetTimeFromMs(value, &hours, &minutes, &seconds, &milliseconds)) {
+ return false;
+ }
if (milliseconds != 0) {
aResultString.AppendPrintf("%02d:%02d:%02d.%03d",
@@ -2192,6 +2097,42 @@ HTMLInputElement::ConvertNumberToString(Decimal aValue,
aResultString.AppendPrintf("%04.0f-W%02d", year, week);
return true;
}
+ case NS_FORM_INPUT_DATETIME_LOCAL:
+ {
+ aValue = aValue.floor();
+
+ uint32_t timeValue =
+ NS_floorModulo(aValue, Decimal::fromDouble(kMsPerDay)).toDouble();
+
+ uint16_t milliseconds, seconds, minutes, hours;
+ if (!GetTimeFromMs(timeValue,
+ &hours, &minutes, &seconds, &milliseconds)) {
+ return false;
+ }
+
+ double year = JS::YearFromTime(aValue.toDouble());
+ double month = JS::MonthFromTime(aValue.toDouble());
+ double day = JS::DayFromTime(aValue.toDouble());
+
+ if (IsNaN(year) || IsNaN(month) || IsNaN(day)) {
+ return false;
+ }
+
+ if (milliseconds != 0) {
+ aResultString.AppendPrintf("%04.0f-%02.0f-%02.0fT%02d:%02d:%02d.%03d",
+ year, month + 1, day, hours, minutes,
+ seconds, milliseconds);
+ } else if (seconds != 0) {
+ aResultString.AppendPrintf("%04.0f-%02.0f-%02.0fT%02d:%02d:%02d",
+ year, month + 1, day, hours, minutes,
+ seconds);
+ } else {
+ aResultString.AppendPrintf("%04.0f-%02.0f-%02.0fT%02d:%02d",
+ year, month + 1, day, hours, minutes);
+ }
+
+ return true;
+ }
default:
MOZ_ASSERT(false, "Unrecognized input type");
return false;
@@ -2202,8 +2143,7 @@ HTMLInputElement::ConvertNumberToString(Decimal aValue,
Nullable<Date>
HTMLInputElement::GetValueAsDate(ErrorResult& aRv)
{
- // TODO: this is temporary until bug 888331 is fixed.
- if (!IsDateTimeInputType(mType) || mType == NS_FORM_INPUT_DATETIME_LOCAL) {
+ if (!IsDateTimeInputType(mType)) {
return Nullable<Date>();
}
@@ -2261,6 +2201,19 @@ HTMLInputElement::GetValueAsDate(ErrorResult& aRv)
return Nullable<Date>(Date(time));
}
+ case NS_FORM_INPUT_DATETIME_LOCAL:
+ {
+ uint32_t year, month, day, timeInMs;
+ nsAutoString value;
+ GetValueInternal(value);
+ if (!ParseDateTimeLocal(value, &year, &month, &day, &timeInMs)) {
+ return Nullable<Date>();
+ }
+
+ JS::ClippedTime time = JS::TimeClip(JS::MakeDate(year, month - 1, day,
+ timeInMs));
+ return Nullable<Date>(Date(time));
+ }
}
MOZ_ASSERT(false, "Unrecognized input type");
@@ -2271,8 +2224,7 @@ HTMLInputElement::GetValueAsDate(ErrorResult& aRv)
void
HTMLInputElement::SetValueAsDate(Nullable<Date> aDate, ErrorResult& aRv)
{
- // TODO: this is temporary until bug 888331 is fixed.
- if (!IsDateTimeInputType(mType) || mType == NS_FORM_INPUT_DATETIME_LOCAL) {
+ if (!IsDateTimeInputType(mType)) {
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
return;
}
@@ -2380,11 +2332,8 @@ HTMLInputElement::GetMaximum() const
Decimal
HTMLInputElement::GetStepBase() const
{
- MOZ_ASSERT(mType == NS_FORM_INPUT_NUMBER ||
- mType == NS_FORM_INPUT_DATE ||
- mType == NS_FORM_INPUT_TIME ||
- mType == NS_FORM_INPUT_MONTH ||
- mType == NS_FORM_INPUT_WEEK ||
+ MOZ_ASSERT(IsDateTimeInputType(mType) ||
+ mType == NS_FORM_INPUT_NUMBER ||
mType == NS_FORM_INPUT_RANGE,
"Check that kDefaultStepBase is correct for this new type");
@@ -2515,11 +2464,8 @@ HTMLInputElement::ApplyStep(int32_t aStep)
bool
HTMLInputElement::IsExperimentalMobileType(uint8_t aType)
{
- return (aType == NS_FORM_INPUT_DATE &&
- !Preferences::GetBool("dom.forms.datetime", false) &&
- !Preferences::GetBool("dom.forms.datepicker", false)) ||
- (aType == NS_FORM_INPUT_TIME &&
- !Preferences::GetBool("dom.forms.datetime", false));
+ return (aType == NS_FORM_INPUT_DATE || aType == NS_FORM_INPUT_TIME) &&
+ !IsInputDateTimeEnabled();
}
bool
@@ -2832,7 +2778,8 @@ HTMLInputElement::GetOwnerDateTimeControl()
HTMLInputElement::FromContentOrNull(
GetParent()->GetParent()->GetParent()->GetParent());
if (ownerDateTimeControl &&
- ownerDateTimeControl->mType == NS_FORM_INPUT_TIME) {
+ (ownerDateTimeControl->mType == NS_FORM_INPUT_TIME ||
+ ownerDateTimeControl->mType == NS_FORM_INPUT_DATE)) {
return ownerDateTimeControl;
}
}
@@ -3024,8 +2971,8 @@ HTMLInputElement::GetDisplayFileName(nsAString& aValue) const
nsXPIDLString value;
if (mFilesOrDirectories.IsEmpty()) {
- if ((Preferences::GetBool("dom.input.dirpicker", false) && Allowdirs()) ||
- (Preferences::GetBool("dom.webkitBlink.dirPicker.enabled", false) &&
+ if ((IsDirPickerEnabled() && Allowdirs()) ||
+ (IsWebkitDirPickerEnabled() &&
HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory))) {
nsContentUtils::GetLocalizedString(nsContentUtils::eFORMS_PROPERTIES,
"NoDirSelected", value);
@@ -3054,7 +3001,7 @@ HTMLInputElement::SetFilesOrDirectories(const nsTArray<OwningFileOrDirectory>& a
{
ClearGetFilesHelpers();
- if (Preferences::GetBool("dom.webkitBlink.filesystem.enabled", false)) {
+ if (IsWebkitFileSystemEnabled()) {
HTMLInputElementBinding::ClearCachedWebkitEntriesValue(this);
mEntries.Clear();
}
@@ -3073,7 +3020,7 @@ HTMLInputElement::SetFiles(nsIDOMFileList* aFiles,
mFilesOrDirectories.Clear();
ClearGetFilesHelpers();
- if (Preferences::GetBool("dom.webkitBlink.filesystem.enabled", false)) {
+ if (IsWebkitFileSystemEnabled()) {
HTMLInputElementBinding::ClearCachedWebkitEntriesValue(this);
mEntries.Clear();
}
@@ -3096,14 +3043,14 @@ HTMLInputElement::MozSetDndFilesAndDirectories(const nsTArray<OwningFileOrDirect
{
SetFilesOrDirectories(aFilesOrDirectories, true);
- if (Preferences::GetBool("dom.webkitBlink.filesystem.enabled", false)) {
+ if (IsWebkitFileSystemEnabled()) {
UpdateEntries(aFilesOrDirectories);
}
RefPtr<DispatchChangeEventCallback> dispatchChangeEventCallback =
new DispatchChangeEventCallback(this);
- if (Preferences::GetBool("dom.webkitBlink.dirPicker.enabled", false) &&
+ if (IsWebkitDirPickerEnabled() &&
HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory)) {
ErrorResult rv;
GetFilesHelper* helper = GetOrCreateGetFilesHelper(true /* recursionFlag */,
@@ -3181,8 +3128,8 @@ HTMLInputElement::GetFiles()
return nullptr;
}
- if (Preferences::GetBool("dom.input.dirpicker", false) && Allowdirs() &&
- (!Preferences::GetBool("dom.webkitBlink.dirPicker.enabled", false) ||
+ if (IsDirPickerEnabled() && Allowdirs() &&
+ (!IsWebkitDirPickerEnabled() ||
!HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory))) {
return nullptr;
}
@@ -3282,7 +3229,8 @@ HTMLInputElement::SetValueInternal(const nsAString& aValue, uint32_t aFlags)
if (frame) {
frame->UpdateForValueChange();
}
- } else if (mType == NS_FORM_INPUT_TIME &&
+ } else if ((mType == NS_FORM_INPUT_TIME ||
+ mType == NS_FORM_INPUT_DATE) &&
!IsExperimentalMobileType(mType)) {
nsDateTimeControlFrame* frame = do_QueryFrame(GetPrimaryFrame());
if (frame) {
@@ -3591,7 +3539,8 @@ HTMLInputElement::Blur(ErrorResult& aError)
}
}
- if (mType == NS_FORM_INPUT_TIME && !IsExperimentalMobileType(mType)) {
+ if ((mType == NS_FORM_INPUT_TIME || mType == NS_FORM_INPUT_DATE) &&
+ !IsExperimentalMobileType(mType)) {
nsDateTimeControlFrame* frame = do_QueryFrame(GetPrimaryFrame());
if (frame) {
frame->HandleBlurEvent();
@@ -3618,7 +3567,8 @@ HTMLInputElement::Focus(ErrorResult& aError)
}
}
- if (mType == NS_FORM_INPUT_TIME && !IsExperimentalMobileType(mType)) {
+ if ((mType == NS_FORM_INPUT_TIME || mType == NS_FORM_INPUT_DATE) &&
+ !IsExperimentalMobileType(mType)) {
nsDateTimeControlFrame* frame = do_QueryFrame(GetPrimaryFrame());
if (frame) {
frame->HandleFocusEvent();
@@ -3956,7 +3906,7 @@ HTMLInputElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
}
}
- if (mType == NS_FORM_INPUT_TIME &&
+ if ((mType == NS_FORM_INPUT_TIME || mType == NS_FORM_INPUT_DATE) &&
!IsExperimentalMobileType(mType) &&
aVisitor.mEvent->mMessage == eFocus &&
aVisitor.mEvent->mOriginalTarget == this) {
@@ -4083,7 +4033,8 @@ HTMLInputElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
// Stop the event if the related target's first non-native ancestor is the
// same as the original target's first non-native ancestor (we are moving
// inside of the same element).
- if (mType == NS_FORM_INPUT_TIME && !IsExperimentalMobileType(mType) &&
+ if ((mType == NS_FORM_INPUT_TIME || mType == NS_FORM_INPUT_DATE) &&
+ !IsExperimentalMobileType(mType) &&
(aVisitor.mEvent->mMessage == eFocus ||
aVisitor.mEvent->mMessage == eFocusIn ||
aVisitor.mEvent->mMessage == eFocusOut ||
@@ -4361,8 +4312,8 @@ HTMLInputElement::MaybeInitPickers(EventChainPostVisitor& aVisitor)
do_QueryInterface(aVisitor.mEvent->mOriginalTarget);
if (target &&
target->FindFirstNonChromeOnlyAccessContent() == this &&
- ((Preferences::GetBool("dom.input.dirpicker", false) && Allowdirs()) ||
- (Preferences::GetBool("dom.webkitBlink.dirPicker.enabled", false) &&
+ ((IsDirPickerEnabled() && Allowdirs()) ||
+ (IsWebkitDirPickerEnabled() &&
HasAttr(kNameSpaceID_None, nsGkAtoms::webkitdirectory)))) {
type = FILE_PICKER_DIRECTORY;
}
@@ -4371,9 +4322,6 @@ HTMLInputElement::MaybeInitPickers(EventChainPostVisitor& aVisitor)
if (mType == NS_FORM_INPUT_COLOR) {
return InitColorPicker();
}
- if (mType == NS_FORM_INPUT_DATE) {
- return InitDatePicker();
- }
return NS_OK;
}
@@ -5383,6 +5331,29 @@ HTMLInputElement::MaximumWeekInYear(uint32_t aYear) const
}
bool
+HTMLInputElement::GetTimeFromMs(double aValue, uint16_t* aHours,
+ uint16_t* aMinutes, uint16_t* aSeconds,
+ uint16_t* aMilliseconds) const {
+ MOZ_ASSERT(aValue >= 0 && aValue < kMsPerDay,
+ "aValue must be milliseconds within a day!");
+
+ uint32_t value = floor(aValue);
+
+ *aMilliseconds = value % 1000;
+ value /= 1000;
+
+ *aSeconds = value % 60;
+ value /= 60;
+
+ *aMinutes = value % 60;
+ value /= 60;
+
+ *aHours = value;
+
+ return true;
+}
+
+bool
HTMLInputElement::IsValidWeek(const nsAString& aValue) const
{
uint32_t year, week;
@@ -5730,20 +5701,131 @@ HTMLInputElement::ParseTime(const nsAString& aValue, uint32_t* aResult)
return true;
}
-static bool
-IsDateTimeEnabled(int32_t aNewType)
+/* static */ bool
+HTMLInputElement::IsDateTimeTypeSupported(uint8_t aDateTimeInputType)
+{
+ return ((aDateTimeInputType == NS_FORM_INPUT_DATE ||
+ aDateTimeInputType == NS_FORM_INPUT_TIME) &&
+ (IsInputDateTimeEnabled() || IsExperimentalFormsEnabled())) ||
+ ((aDateTimeInputType == NS_FORM_INPUT_MONTH ||
+ aDateTimeInputType == NS_FORM_INPUT_WEEK ||
+ aDateTimeInputType == NS_FORM_INPUT_DATETIME_LOCAL) &&
+ IsInputDateTimeOthersEnabled());
+}
+
+/* static */ bool
+HTMLInputElement::IsWebkitDirPickerEnabled()
{
- return (aNewType == NS_FORM_INPUT_DATE &&
- (Preferences::GetBool("dom.forms.datetime", false) ||
- Preferences::GetBool("dom.experimental_forms", false) ||
- Preferences::GetBool("dom.forms.datepicker", false))) ||
- (aNewType == NS_FORM_INPUT_TIME &&
- (Preferences::GetBool("dom.forms.datetime", false) ||
- Preferences::GetBool("dom.experimental_forms", false))) ||
- ((aNewType == NS_FORM_INPUT_MONTH ||
- aNewType == NS_FORM_INPUT_WEEK ||
- aNewType == NS_FORM_INPUT_DATETIME_LOCAL) &&
- Preferences::GetBool("dom.forms.datetime", false));
+ static bool sWebkitDirPickerEnabled = false;
+ static bool sWebkitDirPickerPrefCached = false;
+ if (!sWebkitDirPickerPrefCached) {
+ sWebkitDirPickerPrefCached = true;
+ Preferences::AddBoolVarCache(&sWebkitDirPickerEnabled,
+ "dom.webkitBlink.dirPicker.enabled",
+ false);
+ }
+
+ return sWebkitDirPickerEnabled;
+}
+
+/* static */ bool
+HTMLInputElement::IsWebkitFileSystemEnabled()
+{
+ static bool sWebkitFileSystemEnabled = false;
+ static bool sWebkitFileSystemPrefCached = false;
+ if (!sWebkitFileSystemPrefCached) {
+ sWebkitFileSystemPrefCached = true;
+ Preferences::AddBoolVarCache(&sWebkitFileSystemEnabled,
+ "dom.webkitBlink.filesystem.enabled",
+ false);
+ }
+
+ return sWebkitFileSystemEnabled;
+}
+
+/* static */ bool
+HTMLInputElement::IsDirPickerEnabled()
+{
+ static bool sDirPickerEnabled = false;
+ static bool sDirPickerPrefCached = false;
+ if (!sDirPickerPrefCached) {
+ sDirPickerPrefCached = true;
+ Preferences::AddBoolVarCache(&sDirPickerEnabled, "dom.input.dirpicker",
+ false);
+ }
+
+ return sDirPickerEnabled;
+}
+
+/* static */ bool
+HTMLInputElement::IsExperimentalFormsEnabled()
+{
+ static bool sExperimentalFormsEnabled = false;
+ static bool sExperimentalFormsPrefCached = false;
+ if (!sExperimentalFormsPrefCached) {
+ sExperimentalFormsPrefCached = true;
+ Preferences::AddBoolVarCache(&sExperimentalFormsEnabled,
+ "dom.experimental_forms",
+ false);
+ }
+
+ return sExperimentalFormsEnabled;
+}
+
+/* static */ bool
+HTMLInputElement::IsInputDateTimeEnabled()
+{
+ static bool sDateTimeEnabled = false;
+ static bool sDateTimePrefCached = false;
+ if (!sDateTimePrefCached) {
+ sDateTimePrefCached = true;
+ Preferences::AddBoolVarCache(&sDateTimeEnabled, "dom.forms.datetime",
+ false);
+ }
+
+ return sDateTimeEnabled;
+}
+
+/* static */ bool
+HTMLInputElement::IsInputDateTimeOthersEnabled()
+{
+ static bool sDateTimeOthersEnabled = false;
+ static bool sDateTimeOthersPrefCached = false;
+ if (!sDateTimeOthersPrefCached) {
+ sDateTimeOthersPrefCached = true;
+ Preferences::AddBoolVarCache(&sDateTimeOthersEnabled,
+ "dom.forms.datetime.others", false);
+ }
+
+ return sDateTimeOthersEnabled;
+}
+
+/* static */ bool
+HTMLInputElement::IsInputNumberEnabled()
+{
+ static bool sInputNumberEnabled = false;
+ static bool sInputNumberPrefCached = false;
+ if (!sInputNumberPrefCached) {
+ sInputNumberPrefCached = true;
+ Preferences::AddBoolVarCache(&sInputNumberEnabled, "dom.forms.number",
+ false);
+ }
+
+ return sInputNumberEnabled;
+}
+
+/* static */ bool
+HTMLInputElement::IsInputColorEnabled()
+{
+ static bool sInputColorEnabled = false;
+ static bool sInputColorPrefCached = false;
+ if (!sInputColorPrefCached) {
+ sInputColorPrefCached = true;
+ Preferences::AddBoolVarCache(&sInputColorEnabled, "dom.forms.color",
+ false);
+ }
+
+ return sInputColorEnabled;
}
bool
@@ -5760,13 +5842,9 @@ HTMLInputElement::ParseAttribute(int32_t aNamespaceID,
bool success = aResult.ParseEnumValue(aValue, kInputTypeTable, false);
if (success) {
newType = aResult.GetEnumValue();
- if ((IsExperimentalMobileType(newType) &&
- !Preferences::GetBool("dom.experimental_forms", false)) ||
- (newType == NS_FORM_INPUT_NUMBER &&
- !Preferences::GetBool("dom.forms.number", false)) ||
- (newType == NS_FORM_INPUT_COLOR &&
- !Preferences::GetBool("dom.forms.color", false)) ||
- (IsDateTimeInputType(newType) && !IsDateTimeEnabled(newType))) {
+ if ((newType == NS_FORM_INPUT_NUMBER && !IsInputNumberEnabled()) ||
+ (newType == NS_FORM_INPUT_COLOR && !IsInputColorEnabled()) ||
+ (IsDateTimeInputType(newType) && !IsDateTimeTypeSupported(newType))) {
newType = kInputDefaultType->value;
aResult.SetTo(newType, &aValue);
}
@@ -7161,13 +7239,15 @@ HTMLInputElement::IsHTMLFocusable(bool aWithMouse, bool* aIsFocusable, int32_t*
if (mType == NS_FORM_INPUT_FILE ||
mType == NS_FORM_INPUT_NUMBER ||
- mType == NS_FORM_INPUT_TIME) {
+ mType == NS_FORM_INPUT_TIME ||
+ mType == NS_FORM_INPUT_DATE) {
if (aTabIndex) {
// We only want our native anonymous child to be tabable to, not ourself.
*aTabIndex = -1;
}
if (mType == NS_FORM_INPUT_NUMBER ||
- mType == NS_FORM_INPUT_TIME) {
+ mType == NS_FORM_INPUT_TIME ||
+ mType == NS_FORM_INPUT_DATE) {
*aIsFocusable = true;
} else {
*aIsFocusable = defaultFocusable;
@@ -7650,8 +7730,7 @@ HTMLInputElement::HasPatternMismatch() const
bool
HTMLInputElement::IsRangeOverflow() const
{
- // TODO: this is temporary until bug 888331 is fixed.
- if (!DoesMinMaxApply() || mType == NS_FORM_INPUT_DATETIME_LOCAL) {
+ if (!DoesMinMaxApply()) {
return false;
}
@@ -7671,8 +7750,7 @@ HTMLInputElement::IsRangeOverflow() const
bool
HTMLInputElement::IsRangeUnderflow() const
{
- // TODO: this is temporary until bug 888331 is fixed.
- if (!DoesMinMaxApply() || mType == NS_FORM_INPUT_DATETIME_LOCAL) {
+ if (!DoesMinMaxApply()) {
return false;
}
@@ -8622,6 +8700,7 @@ HTMLInputElement::GetStepScaleFactor() const
case NS_FORM_INPUT_RANGE:
return kStepScaleFactorNumberRange;
case NS_FORM_INPUT_TIME:
+ case NS_FORM_INPUT_DATETIME_LOCAL:
return kStepScaleFactorTime;
case NS_FORM_INPUT_MONTH:
return kStepScaleFactorMonth;
@@ -8646,6 +8725,7 @@ HTMLInputElement::GetDefaultStep() const
case NS_FORM_INPUT_RANGE:
return kDefaultStep;
case NS_FORM_INPUT_TIME:
+ case NS_FORM_INPUT_DATETIME_LOCAL:
return kDefaultStepTime;
default:
MOZ_ASSERT(false, "Unrecognized input type");
@@ -8680,8 +8760,7 @@ HTMLInputElement::UpdateHasRange()
mHasRange = false;
- // TODO: this is temporary until bug 888331 is fixed.
- if (!DoesMinMaxApply() || mType == NS_FORM_INPUT_DATETIME_LOCAL) {
+ if (!DoesMinMaxApply()) {
return;
}
diff --git a/dom/html/HTMLInputElement.h b/dom/html/HTMLInputElement.h
index 9ca876aee8..98a5904437 100644
--- a/dom/html/HTMLInputElement.h
+++ b/dom/html/HTMLInputElement.h
@@ -796,6 +796,15 @@ public:
void UpdateDateTimePicker(const DateTimeValue& aValue);
void CloseDateTimePicker();
+ /*
+ * The following are called from datetime input box binding to get the
+ * corresponding computed values.
+ */
+ double GetStepAsDouble() { return GetStep().toDouble(); }
+ double GetStepBaseAsDouble() { return GetStepBase().toDouble(); }
+ double GetMinimumAsDouble() { return GetMinimum().toDouble(); }
+ double GetMaximumAsDouble() { return GetMaximum().toDouble(); }
+
HTMLInputElement* GetOwnerNumberControl();
HTMLInputElement* GetOwnerDateTimeControl();
@@ -1061,11 +1070,7 @@ protected:
/**
* Returns if the step attribute apply for the current type.
*/
- bool DoesStepApply() const
- {
- // TODO: this is temporary until bug 888331 is fixed.
- return DoesMinMaxApply() && mType != NS_FORM_INPUT_DATETIME_LOCAL;
- }
+ bool DoesStepApply() const { return DoesMinMaxApply(); }
/**
* Returns if stepDown and stepUp methods apply for the current type.
@@ -1075,11 +1080,7 @@ protected:
/**
* Returns if valueAsNumber attribute applies for the current type.
*/
- bool DoesValueAsNumberApply() const
- {
- // TODO: this is temporary until bug 888331 is fixed.
- return DoesMinMaxApply() && mType != NS_FORM_INPUT_DATETIME_LOCAL;
- }
+ bool DoesValueAsNumberApply() const { return DoesMinMaxApply(); }
/**
* Returns if autocomplete attribute applies for the current type.
@@ -1287,6 +1288,7 @@ protected:
* https://html.spec.whatwg.org/multipage/infrastructure.html#valid-normalised-local-date-and-time-string
*/
void NormalizeDateTimeLocal(nsAString& aValue) const;
+
/**
* This methods returns the number of days since epoch for a given year and
* week.
@@ -1318,6 +1320,13 @@ protected:
uint32_t MaximumWeekInYear(uint32_t aYear) const;
/**
+ * This method converts aValue (milliseconds within a day) to hours, minutes,
+ * seconds and milliseconds.
+ */
+ bool GetTimeFromMs(double aValue, uint16_t* aHours, uint16_t* aMinutes,
+ uint16_t* aSeconds, uint16_t* aMilliseconds) const;
+
+ /**
* This methods returns true if it's a leap year.
*/
bool IsLeapYear(uint32_t aYear) const;
@@ -1442,7 +1451,6 @@ protected:
};
nsresult InitFilePicker(FilePickerType aType);
nsresult InitColorPicker();
- nsresult InitDatePicker();
/**
* Use this function before trying to open a picker.
@@ -1632,9 +1640,73 @@ private:
return IsSingleLineTextControl(false, aType) ||
aType == NS_FORM_INPUT_RANGE ||
aType == NS_FORM_INPUT_NUMBER ||
- aType == NS_FORM_INPUT_TIME;
+ aType == NS_FORM_INPUT_TIME ||
+ aType == NS_FORM_INPUT_DATE;
}
+ /**
+ * Checks if aDateTimeInputType should be supported based on "dom.forms.datetime",
+ * and "dom.experimental_forms".
+ */
+ static bool
+ IsDateTimeTypeSupported(uint8_t aDateTimeInputType);
+
+ /**
+ * Checks preference "dom.webkitBlink.dirPicker.enabled" to determine if
+ * webkitdirectory should be supported.
+ */
+ static bool
+ IsWebkitDirPickerEnabled();
+
+ /**
+ * Checks preference "dom.webkitBlink.filesystem.enabled" to determine if
+ * webkitEntries should be supported.
+ */
+ static bool
+ IsWebkitFileSystemEnabled();
+
+ /**
+ * Checks preference "dom.input.dirpicker" to determine if file and directory
+ * entries API should be supported.
+ */
+ static bool
+ IsDirPickerEnabled();
+
+ /**
+ * Checks preference "dom.experimental_forms" to determine if experimental
+ * implementation of input element should be enabled.
+ */
+ static bool
+ IsExperimentalFormsEnabled();
+
+ /**
+ * Checks preference "dom.forms.datetime" to determine if input date and time
+ * should be supported.
+ */
+ static bool
+ IsInputDateTimeEnabled();
+
+ /**
+ * Checks preference "dom.forms.datetime.others" to determine if input week,
+ * month and datetime-local should be supported.
+ */
+ static bool
+ IsInputDateTimeOthersEnabled();
+
+ /**
+ * Checks preference "dom.forms.number" to determine if input type=number
+ * should be supported.
+ */
+ static bool
+ IsInputNumberEnabled();
+
+ /**
+ * Checks preference "dom.forms.color" to determine if date/time related
+ * types should be supported.
+ */
+ static bool
+ IsInputColorEnabled();
+
struct nsFilePickerFilter {
nsFilePickerFilter()
: mFilterMask(0) {}
diff --git a/dom/html/crashtests/1350972.html b/dom/html/crashtests/1350972.html
new file mode 100644
index 0000000000..7af7f9e174
--- /dev/null
+++ b/dom/html/crashtests/1350972.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script>
+ try { o1 = document.createElement('tr'); } catch(e) {};
+ try { o2 = document.createElement('div'); } catch(e) {};
+ try { o3 = document.createElement('hr'); } catch(e) {};
+ try { o4 = document.createElement('textarea'); } catch(e) {};
+ try { o5 = document.getSelection(); } catch(e) {};
+ try { o6 = document.createRange(); } catch(e) {};
+ try { document.documentElement.appendChild(o2); } catch(e) {};
+ try { document.documentElement.appendChild(o3); } catch(e) {};
+ try { o2.appendChild(o4); } catch(e) {};
+ try { o3.outerHTML = "<noscript contenteditable='true'>"; } catch(e) {};
+ try { o4.select(); } catch(e) {};
+ try { o5.addRange(o6); } catch(e) {};
+ try { document.documentElement.appendChild(o1); } catch(e) {};
+ try { o5.selectAllChildren(o1); } catch(e) {};
+ try { o6.selectNode(o1); } catch(e) {};
+</script>
+</head>
+</html> \ No newline at end of file
diff --git a/dom/html/crashtests/crashtests.list b/dom/html/crashtests/crashtests.list
index e55a0a3503..a2068ea4ed 100644
--- a/dom/html/crashtests/crashtests.list
+++ b/dom/html/crashtests/crashtests.list
@@ -78,4 +78,5 @@ load 1237633.html
load 1281972-1.html
load 1282894.html
load 1290904.html
+asserts(0-3) load 1350972.html
load 1386905.html
diff --git a/dom/html/nsHTMLDocument.cpp b/dom/html/nsHTMLDocument.cpp
index fea78dc37e..69e7102423 100644
--- a/dom/html/nsHTMLDocument.cpp
+++ b/dom/html/nsHTMLDocument.cpp
@@ -1536,6 +1536,18 @@ nsHTMLDocument::Open(JSContext* cx,
nsCOMPtr<nsIDocument> ret = this;
return ret.forget();
}
+
+ // Now double-check that our invariants still hold.
+ if (!mScriptGlobalObject) {
+ nsCOMPtr<nsIDocument> ret = this;
+ return ret.forget();
+ }
+
+ nsPIDOMWindowOuter* outer = GetWindow();
+ if (!outer || (GetInnerWindow() != outer->GetCurrentInnerWindow())) {
+ nsCOMPtr<nsIDocument> ret = this;
+ return ret.forget();
+ }
}
nsCOMPtr<nsIWebNavigation> webnav(do_QueryInterface(shell));
@@ -2137,26 +2149,10 @@ NS_IMETHODIMP
nsHTMLDocument::GetSelection(nsISelection** aReturn)
{
ErrorResult rv;
- NS_IF_ADDREF(*aReturn = GetSelection(rv));
+ NS_IF_ADDREF(*aReturn = nsDocument::GetSelection(rv));
return rv.StealNSResult();
}
-Selection*
-nsHTMLDocument::GetSelection(ErrorResult& aRv)
-{
- nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(GetScopeObject());
- if (!window) {
- return nullptr;
- }
-
- NS_ASSERTION(window->IsInnerWindow(), "Should have inner window here!");
- if (!window->IsCurrentInnerWindow()) {
- return nullptr;
- }
-
- return nsGlobalWindow::Cast(window)->GetSelection(aRv);
-}
-
NS_IMETHODIMP
nsHTMLDocument::CaptureEvents()
{
diff --git a/dom/html/nsHTMLDocument.h b/dom/html/nsHTMLDocument.h
index 426ebddc59..1fa81f6cdf 100644
--- a/dom/html/nsHTMLDocument.h
+++ b/dom/html/nsHTMLDocument.h
@@ -242,7 +242,6 @@ public:
{
// Deprecated
}
- mozilla::dom::Selection* GetSelection(mozilla::ErrorResult& aRv);
// The XPCOM CaptureEvents works fine for us.
// The XPCOM ReleaseEvents works fine for us.
// We're picking up GetLocation from Document
diff --git a/dom/html/nsIFormControl.h b/dom/html/nsIFormControl.h
index aaa92146ce..e07f7c8293 100644
--- a/dom/html/nsIFormControl.h
+++ b/dom/html/nsIFormControl.h
@@ -270,8 +270,8 @@ nsIFormControl::IsSingleLineTextControl(bool aExcludePassword, uint32_t aType)
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
// On Android/B2G, date/time input appears as a normal text box.
aType == NS_FORM_INPUT_TIME ||
-#endif
aType == NS_FORM_INPUT_DATE ||
+#endif
aType == NS_FORM_INPUT_MONTH ||
aType == NS_FORM_INPUT_WEEK ||
aType == NS_FORM_INPUT_DATETIME_LOCAL ||
diff --git a/dom/html/nsTextEditorState.cpp b/dom/html/nsTextEditorState.cpp
index d701993628..187afb66df 100644
--- a/dom/html/nsTextEditorState.cpp
+++ b/dom/html/nsTextEditorState.cpp
@@ -1418,19 +1418,16 @@ nsTextEditorState::PrepareEditor(const nsAString *aValue)
}
}
- if (shouldInitializeEditor) {
- // Initialize the plaintext editor
- nsCOMPtr<nsIPlaintextEditor> textEditor(do_QueryInterface(newEditor));
- if (textEditor) {
+ // Initialize the plaintext editor
+ nsCOMPtr<nsIPlaintextEditor> textEditor = do_QueryInterface(newEditor);
+ if (textEditor) {
+ if (shouldInitializeEditor) {
// Set up wrapping
textEditor->SetWrapColumn(GetWrapCols());
-
- // Set max text field length
- int32_t maxLength;
- if (GetMaxLength(&maxLength)) {
- textEditor->SetMaxTextLength(maxLength);
- }
}
+
+ // Set max text field length
+ textEditor->SetMaxTextLength(GetMaxLength());
}
nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement);
@@ -1895,22 +1892,22 @@ be called if @placeholder is the empty string when trimmed from line breaks");
return NS_OK;
}
-bool
-nsTextEditorState::GetMaxLength(int32_t* aMaxLength)
+int32_t
+nsTextEditorState::GetMaxLength()
{
nsCOMPtr<nsIContent> content = do_QueryInterface(mTextCtrlElement);
nsGenericHTMLElement* element =
nsGenericHTMLElement::FromContentOrNull(content);
- NS_ENSURE_TRUE(element, false);
+ if (NS_WARN_IF(!element)) {
+ return -1;
+ }
const nsAttrValue* attr = element->GetParsedAttr(nsGkAtoms::maxlength);
if (attr && attr->Type() == nsAttrValue::eInteger) {
- *aMaxLength = attr->GetIntegerValue();
-
- return true;
+ return attr->GetIntegerValue();
}
- return false;
+ return -1;
}
void
diff --git a/dom/html/nsTextEditorState.h b/dom/html/nsTextEditorState.h
index 11494f155a..caf5e8eedd 100644
--- a/dom/html/nsTextEditorState.h
+++ b/dom/html/nsTextEditorState.h
@@ -203,7 +203,7 @@ public:
* @param aMaxLength the value of the max length attr
* @returns false if attr not defined
*/
- bool GetMaxLength(int32_t* aMaxLength);
+ int32_t GetMaxLength();
void ClearValueCache() { mCachedValue.Truncate(); }
diff --git a/dom/html/test/forms/mochitest.ini b/dom/html/test/forms/mochitest.ini
index 35955b189b..199e4baf80 100644
--- a/dom/html/test/forms/mochitest.ini
+++ b/dom/html/test/forms/mochitest.ini
@@ -30,8 +30,14 @@ skip-if = os == "android" # up/down arrow keys not supported on android
skip-if = android_version == '18' # Android, bug 1147974
[test_input_color_picker_update.html]
skip-if = android_version == '18' # Android, bug 1147974
+[test_input_date_key_events.html]
+skip-if = os == "android"
+[test_input_datetime_input_change_events.html]
+skip-if = os == "android"
[test_input_datetime_focus_blur.html]
skip-if = os == "android"
+[test_input_datetime_focus_blur_events.html]
+skip-if = os == "android"
[test_input_datetime_tabindex.html]
skip-if = os == "android"
[test_input_defaultValue.html]
@@ -61,8 +67,6 @@ skip-if = os == "android"
[test_input_textarea_set_value_no_scroll.html]
[test_input_time_key_events.html]
skip-if = os == "android"
-[test_input_time_focus_blur_events.html]
-skip-if = os == "android"
[test_input_types_pref.html]
[test_input_typing_sanitization.html]
[test_input_untrusted_key_events.html]
diff --git a/dom/html/test/forms/test_input_date_key_events.html b/dom/html/test/forms/test_input_date_key_events.html
new file mode 100644
index 0000000000..f502d6a4d6
--- /dev/null
+++ b/dom/html/test/forms/test_input_date_key_events.html
@@ -0,0 +1,228 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1286182
+-->
+<head>
+ <title>Test key events for time control</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+ <meta charset="UTF-8">
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1286182">Mozilla Bug 1286182</a>
+<p id="display"></p>
+<div id="content">
+ <input id="input" type="date">
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+SimpleTest.waitForExplicitFinish();
+// Turn off Spatial Navigation because it hijacks arrow keydown events:
+SimpleTest.waitForFocus(function() {
+ SpecialPowers.pushPrefEnv({"set":[["snav.enabled", false]]}, function() {
+ test();
+ SimpleTest.finish();
+ });
+});
+
+var testData = [
+ /**
+ * keys: keys to send to the input element.
+ * initialVal: initial value set to the input element.
+ * expectedVal: expected value of the input element after sending the keys.
+ */
+ {
+ // Type 11222016, default order is month, day, year.
+ keys: ["11222016"],
+ initialVal: "",
+ expectedVal: "2016-11-22"
+ },
+ {
+ // Type 3 in the month field will automatically advance to the day field,
+ // then type 5 in the day field will automatically advance to the year
+ // field.
+ keys: ["352016"],
+ initialVal: "",
+ expectedVal: "2016-03-05"
+ },
+ {
+ // Type 13 in the month field will set it to the maximum month, which is
+ // 12.
+ keys: ["13012016"],
+ initialVal: "",
+ expectedVal: "2016-12-01"
+ },
+ {
+ // Type 00 in the month field will set it to the minimum month, which is 1.
+ keys: ["00012016"],
+ initialVal: "",
+ expectedVal: "2016-01-01"
+ },
+ {
+ // Type 33 in the day field will set it to the maximum day, which is 31.
+ keys: ["12332016"],
+ initialVal: "",
+ expectedVal: "2016-12-31"
+ },
+ {
+ // Type 00 in the day field will set it to the minimum day, which is 1.
+ keys: ["12002016"],
+ initialVal: "",
+ expectedVal: "2016-12-01"
+ },
+ {
+ // Type 275769 in the year field will set it to the maximum year, which is
+ // 275760.
+ keys: ["0101275769"],
+ initialVal: "",
+ expectedVal: "275760-01-01"
+ },
+ {
+ // Type 000000 in the year field will set it to the minimum year, which is
+ // 0001.
+ keys: ["0101000000"],
+ initialVal: "",
+ expectedVal: "0001-01-01"
+ },
+ {
+ // Advance to year field and decrement.
+ keys: ["VK_TAB", "VK_TAB", "VK_DOWN"],
+ initialVal: "2016-11-25",
+ expectedVal: "2015-11-25"
+ },
+ {
+ // Right key should do the same thing as TAB key.
+ keys: ["VK_RIGHT", "VK_RIGHT", "VK_DOWN"],
+ initialVal: "2016-11-25",
+ expectedVal: "2015-11-25"
+ },
+ {
+ // Advance to day field then back to month field and decrement.
+ keys: ["VK_RIGHT", "VK_LEFT", "VK_DOWN"],
+ initialVal: "2000-05-01",
+ expectedVal: "2000-04-01"
+ },
+ {
+ // Focus starts on the first field, month in this case, and increment.
+ keys: ["VK_UP"],
+ initialVal: "2000-03-01",
+ expectedVal: "2000-04-01"
+ },
+ {
+ // Advance to day field and decrement.
+ keys: ["VK_TAB", "VK_DOWN"],
+ initialVal: "1234-01-01",
+ expectedVal: "1234-01-31"
+ },
+ {
+ // Advance to day field and increment.
+ keys: ["VK_TAB", "VK_UP"],
+ initialVal: "1234-01-01",
+ expectedVal: "1234-01-02"
+ },
+ {
+ // PageUp on month field increments month by 3.
+ keys: ["VK_PAGE_UP"],
+ initialVal: "1999-01-01",
+ expectedVal: "1999-04-01"
+ },
+ {
+ // PageDown on month field decrements month by 3.
+ keys: ["VK_PAGE_DOWN"],
+ initialVal: "1999-01-01",
+ expectedVal: "1999-10-01"
+ },
+ {
+ // PageUp on day field increments day by 7.
+ keys: ["VK_TAB", "VK_PAGE_UP"],
+ initialVal: "1999-01-01",
+ expectedVal: "1999-01-08"
+ },
+ {
+ // PageDown on day field decrements day by 7.
+ keys: ["VK_TAB", "VK_PAGE_DOWN"],
+ initialVal: "1999-01-01",
+ expectedVal: "1999-01-25"
+ },
+ {
+ // PageUp on year field increments year by 10.
+ keys: ["VK_TAB", "VK_TAB", "VK_PAGE_UP"],
+ initialVal: "1999-01-01",
+ expectedVal: "2009-01-01"
+ },
+ {
+ // PageDown on year field decrements year by 10.
+ keys: ["VK_TAB", "VK_TAB", "VK_PAGE_DOWN"],
+ initialVal: "1999-01-01",
+ expectedVal: "1989-01-01"
+ },
+ {
+ // Home key on month field sets it to the minimum month, which is 01.
+ keys: ["VK_HOME"],
+ initialVal: "2016-06-01",
+ expectedVal: "2016-01-01"
+ },
+ {
+ // End key on month field sets it to the maximum month, which is 12.
+ keys: ["VK_END"],
+ initialVal: "2016-06-01",
+ expectedVal: "2016-12-01"
+ },
+ {
+ // Home key on day field sets it to the minimum day, which is 01.
+ keys: ["VK_TAB", "VK_HOME"],
+ initialVal: "2016-01-10",
+ expectedVal: "2016-01-01"
+ },
+ {
+ // End key on day field sets it to the maximum day, which is 31.
+ keys: ["VK_TAB", "VK_END"],
+ initialVal: "2016-01-10",
+ expectedVal: "2016-01-31"
+ },
+ {
+ // Home key should have no effect on year field.
+ keys: ["VK_TAB", "VK_TAB", "VK_HOME"],
+ initialVal: "2016-01-01",
+ expectedVal: "2016-01-01"
+ },
+ {
+ // End key should have no effect on year field.
+ keys: ["VK_TAB", "VK_TAB", "VK_END"],
+ initialVal: "2016-01-01",
+ expectedVal: "2016-01-01"
+ },
+];
+
+function sendKeys(aKeys) {
+ for (let i = 0; i < aKeys.length; i++) {
+ let key = aKeys[i];
+ if (key.startsWith("VK")) {
+ synthesizeKey(key, {});
+ } else {
+ sendString(key);
+ }
+ }
+}
+
+function test() {
+ var elem = document.getElementById("input");
+
+ for (let { keys, initialVal, expectedVal } of testData) {
+ elem.focus();
+ elem.value = initialVal;
+ sendKeys(keys);
+ elem.blur();
+ is(elem.value, expectedVal,
+ "Test with " + keys + ", result should be " + expectedVal);
+ elem.value = "";
+ }
+}
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/html/test/forms/test_input_datetime_focus_blur.html b/dom/html/test/forms/test_input_datetime_focus_blur.html
index 5b8d95b25e..85f7b4bb4f 100644
--- a/dom/html/test/forms/test_input_datetime_focus_blur.html
+++ b/dom/html/test/forms/test_input_datetime_focus_blur.html
@@ -4,7 +4,7 @@
https://bugzilla.mozilla.org/show_bug.cgi?id=1288591
-->
<head>
- <title>Test focus/blur behaviour for &lt;input type='time'&gt;</title>
+ <title>Test focus/blur behaviour for date/time input types</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
@@ -12,7 +12,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1288591
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1288591">Mozilla Bug 1288591</a>
<p id="display"></p>
<div id="content">
- <input id="input" type="time">
+ <input id="input_time" type="time">
+ <input id="input_date" type="date">
</div>
<pre id="test">
<script type="application/javascript">
@@ -30,15 +31,15 @@ SimpleTest.waitForFocus(function() {
SimpleTest.finish();
});
-function test() {
- let time = document.getElementById("input");
- time.focus();
+function testFocusBlur(type) {
+ let input = document.getElementById("input_" + type);
+ input.focus();
- // The active element returns the input type=time.
+ // The active element returns the date/time input element.
let activeElement = document.activeElement;
- is(activeElement, time, "activeElement should be the time element");
+ is(activeElement, input, "activeElement should be the date/time input element");
is(activeElement.localName, "input", "activeElement should be an input element");
- is(activeElement.type, "time", "activeElement should be of type time");
+ is(activeElement.type, type, "activeElement should be of type " + type);
// Use FocusManager to check that the actual focus is on the anonymous
// text control.
@@ -48,10 +49,17 @@ function test() {
is(focusedElement.localName, "input", "focusedElement should be an input element");
is(focusedElement.type, "text", "focusedElement should be of type text");
- time.blur();
- isnot(document.activeElement, time, "activeElement should no longer be the time element");
+ input.blur();
+ isnot(document.activeElement, input, "activeElement should no longer be the datetime input element");
}
+function test() {
+ let inputTypes = ["time", "date"];
+
+ for (let i = 0; i < inputTypes.length; i++) {
+ testFocusBlur(inputTypes[i]);
+ }
+}
</script>
</pre>
</body>
diff --git a/dom/html/test/forms/test_input_datetime_focus_blur_events.html b/dom/html/test/forms/test_input_datetime_focus_blur_events.html
new file mode 100644
index 0000000000..873dda627d
--- /dev/null
+++ b/dom/html/test/forms/test_input_datetime_focus_blur_events.html
@@ -0,0 +1,90 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1301306
+-->
+<head>
+<title>Test for Bug 1301306</title>
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1301306">Mozilla Bug 722599</a>
+<p id="display"></p>
+<div id="content">
+<input type="time" id="input_time" onfocus="++focusEvents[0]"
+ onblur="++blurEvents[0]" onfocusin="++focusInEvents[0]"
+ onfocusout="++focusOutEvents[0]">
+<input type="date" id="input_date" onfocus="++focusEvents[1]"
+ onblur="++blurEvents[1]" onfocusin="++focusInEvents[1]"
+ onfocusout="++focusOutEvents[1]">
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/**
+ * Test for Bug 1301306.
+ * This test checks that when moving inside the time input element, e.g. jumping
+ * through the inner text boxes, does not fire extra focus/blur events.
+ **/
+
+var inputTypes = ["time", "date"];
+var focusEvents = [0, 0];
+var focusInEvents = [0, 0];
+var focusOutEvents = [0, 0];
+var blurEvents = [0, 0];
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.waitForFocus(function() {
+ test();
+ SimpleTest.finish();
+});
+
+function test() {
+ for (var i = 0; i < inputTypes.length; i++) {
+ var input = document.getElementById("input_" + inputTypes[i]);
+
+ input.focus();
+ is(focusEvents[i], 1, inputTypes[i] + " input element should have dispatched focus event.");
+ is(focusInEvents[i], 1, inputTypes[i] + " input element should have dispatched focusin event.");
+ is(focusOutEvents[i], 0, inputTypes[i] + " input element should not have dispatched focusout event.");
+ is(blurEvents[i], 0, inputTypes[i] + " input element should not have dispatched blur event.");
+
+ // Move around inside the input element's input box.
+ synthesizeKey("VK_TAB", {});
+ is(focusEvents[i], 1, inputTypes[i] + " input element should not have dispatched focus event.");
+ is(focusInEvents[i], 1, inputTypes[i] + " input element should not have dispatched focusin event.");
+ is(focusOutEvents[i], 0, inputTypes[i] + " input element should not have dispatched focusout event.");
+ is(blurEvents[i], 0, inputTypes[i] + " time input element should not have dispatched blur event.");
+
+ synthesizeKey("VK_RIGHT", {});
+ is(focusEvents[i], 1, inputTypes[i] + " input element should not have dispatched focus event.");
+ is(focusInEvents[i], 1, inputTypes[i] + " input element should not have dispatched focusin event.");
+ is(focusOutEvents[i], 0, inputTypes[i] + " input element should not have dispatched focusout event.");
+ is(blurEvents[i], 0, inputTypes[i] + " input element should not have dispatched blur event.");
+
+ synthesizeKey("VK_LEFT", {});
+ is(focusEvents[i], 1,inputTypes[i] + " input element should not have dispatched focus event.");
+ is(focusInEvents[i], 1, inputTypes[i] + " input element should not have dispatched focusin event.");
+ is(focusOutEvents[i], 0, inputTypes[i] + " input element should not have dispatched focusout event.");
+ is(blurEvents[i], 0, inputTypes[i] + " input element should not have dispatched blur event.");
+
+ synthesizeKey("VK_RIGHT", {});
+ is(focusEvents[i], 1, inputTypes[i] + " input element should not have dispatched focus event.");
+ is(focusInEvents[i], 1, inputTypes[i] + " input element should not have dispatched focusin event.");
+ is(focusOutEvents[i], 0, inputTypes[i] + " input element should not have dispatched focusout event.");
+ is(blurEvents[i], 0, inputTypes[i] + " input element should not have dispatched blur event.");
+
+ input.blur();
+ is(focusEvents[i], 1, inputTypes[i] + " input element should not have dispatched focus event.");
+ is(focusInEvents[i], 1, inputTypes[i] + " input element should not have dispatched focusin event.");
+ is(focusOutEvents[i], 1, inputTypes[i] + " input element should have dispatched focusout event.");
+ is(blurEvents[i], 1, inputTypes[i] + " input element should have dispatched blur event.");
+ }
+}
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/html/test/forms/test_input_datetime_input_change_events.html b/dom/html/test/forms/test_input_datetime_input_change_events.html
new file mode 100644
index 0000000000..e636995d36
--- /dev/null
+++ b/dom/html/test/forms/test_input_datetime_input_change_events.html
@@ -0,0 +1,88 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1370858
+-->
+<head>
+<title>Test for Bug 1370858</title>
+<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1370858">Mozilla Bug 722599</a>
+<p id="display"></p>
+<div id="content">
+<input type="time" id="input_time" onchange="++changeEvents[0]"
+ oninput="++inputEvents[0]">
+<input type="date" id="input_date" onchange="++changeEvents[1]"
+ oninput="++inputEvents[1]">
+</div>
+<pre id="test">
+<script class="testbody" type="text/javascript">
+
+/**
+ * Test for Bug 1370858.
+ * Test that change and input events are (not) fired for date/time inputs.
+ **/
+
+var inputTypes = ["time", "date"];
+var changeEvents = [0, 0];
+var inputEvents = [0, 0];
+var values = ["10:30", "2017-06-08"];
+var expectedValues = [["09:30", "01:30"], ["2017-05-08", "2017-01-08"]];
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.waitForFocus(function() {
+ test();
+ SimpleTest.finish();
+});
+
+function test() {
+ for (var i = 0; i < inputTypes.length; i++) {
+ var input = document.getElementById("input_" + inputTypes[i]);
+ var inputRect = input.getBoundingClientRect();
+
+ // Points over the input's reset button
+ var resetButton_X = inputRect.width - 15;
+ var resetButton_Y = inputRect.height / 2;
+
+ is(changeEvents[i], 0, "Number of change events should be 0 at start.");
+ is(inputEvents[i], 0, "Number of input events should be 0 at start.");
+
+ // Test that change and input events are not dispatched setting .value by
+ // script.
+ input.value = values[i];
+ is(input.value, values[i], "Check that value was set correctly (0).");
+ is(changeEvents[i], 0, "Change event should not have dispatched (0).");
+ is(inputEvents[i], 0, "Input event should not have dispatched (0).");
+
+ // Test that change and input events are fired when changing the value using
+ // up/down keys.
+ input.focus();
+ synthesizeKey("VK_DOWN", {});
+ is(input.value, expectedValues[i][0], "Check that value was set correctly (1).");
+ is(changeEvents[i], 1, "Change event should be dispatched (1).");
+ is(inputEvents[i], 1, "Input event should ne dispatched (1).");
+
+ // Test that change and input events are fired when changing the value with
+ // the keyboard.
+ synthesizeKey("0", {});
+ synthesizeKey("1", {});
+ is(input.value, expectedValues[i][1], "Check that value was set correctly (2).");
+ is(changeEvents[i], 2, "Change event should be dispatched (2).");
+ is(inputEvents[i], 2, "Input event should be dispatched (2).");
+
+ // Test that change and input events are fired when clearing the value using
+ // the reset button.
+ synthesizeMouse(input, resetButton_X, resetButton_Y, {});
+ is(input.value, "", "Check that value was set correctly (3).");
+ is(changeEvents[i], 3, "Change event should be dispatched (3).");
+ is(inputEvents[i], 3, "Input event should be dispatched (3).");
+ }
+}
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/dom/html/test/forms/test_input_datetime_tabindex.html b/dom/html/test/forms/test_input_datetime_tabindex.html
index fb7c9b2f19..8023ccf9be 100644
--- a/dom/html/test/forms/test_input_datetime_tabindex.html
+++ b/dom/html/test/forms/test_input_datetime_tabindex.html
@@ -4,7 +4,7 @@
https://bugzilla.mozilla.org/show_bug.cgi?id=1288591
-->
<head>
- <title>Test tabindex attribute for &lt;input type='time'&gt;</title>
+ <title>Test tabindex attribute for date/time input types</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
@@ -16,13 +16,16 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1288591
<input id="time1" type="time" tabindex="0">
<input id="time2" type="time" tabindex="-1">
<input id="time3" type="time" tabindex="0">
+ <input id="date1" type="date" tabindex="0">
+ <input id="date2" type="date" tabindex="-1">
+ <input id="date3" type="date" tabindex="0">
</div>
<pre id="test">
<script type="application/javascript">
/**
* Test for Bug 1288591.
- * This test checks whether date/time input types' tabindex attribute works
+ * This test checks whether date/time input types tabindex attribute works
* correctly.
**/
SimpleTest.waitForExplicitFinish();
@@ -31,41 +34,49 @@ SimpleTest.waitForFocus(function() {
SimpleTest.finish();
});
-function test() {
- let time1 = document.getElementById("time1");
- let time2 = document.getElementById("time2");
- let time3 = document.getElementById("time3");
+function testTabindex(type) {
+ let input1 = document.getElementById(type + "1");
+ let input2 = document.getElementById(type + "2");
+ let input3 = document.getElementById(type + "3");
- time1.focus();
- is(document.activeElement, time1,
+ input1.focus();
+ is(document.activeElement, input1,
"input element with tabindex=0 is focusable");
- // Advance to time1 minute field
+ // Advance to next inner field
synthesizeKey("VK_TAB", {});
- is(document.activeElement, time1,
+ is(document.activeElement, input1,
"input element with tabindex=0 is tabbable");
- // Advance to time1 AM/PM field
+ // Advance to next inner field
synthesizeKey("VK_TAB", {});
- is(document.activeElement, time1,
+ is(document.activeElement, input1,
"input element with tabindex=0 is tabbable");
// Advance to next element
synthesizeKey("VK_TAB", {});
- is(document.activeElement, time3,
+ is(document.activeElement, input3,
"input element with tabindex=-1 is not tabbable");
- time2.focus();
- is(document.activeElement, time2,
+ input2.focus();
+ is(document.activeElement, input2,
"input element with tabindex=-1 is still focusable");
// Changing the tabindex attribute dynamically.
- time3.setAttribute("tabindex", "-1");
- synthesizeKey("VK_TAB", {}); // need only one TAB since time2 is not tabbable
- isnot(document.activeElement, time3,
+ input3.setAttribute("tabindex", "-1");
+ synthesizeKey("VK_TAB", {}); // need only one TAB since input2 is not tabbable
+ isnot(document.activeElement, input3,
"element with tabindex changed to -1 should not be tabbable");
}
+function test() {
+ let inputTypes = ["time", "date"];
+
+ for (let i = 0; i < inputTypes.length; i++) {
+ testTabindex(inputTypes[i]);
+ }
+}
+
</script>
</pre>
</body>
diff --git a/dom/html/test/forms/test_input_time_focus_blur_events.html b/dom/html/test/forms/test_input_time_focus_blur_events.html
deleted file mode 100644
index 4837414774..0000000000
--- a/dom/html/test/forms/test_input_time_focus_blur_events.html
+++ /dev/null
@@ -1,82 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=1301306
--->
-<head>
-<title>Test for Bug 1301306</title>
-<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-<script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
-<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1301306">Mozilla Bug 722599</a>
-<p id="display"></p>
-<div id="content">
-<input type="time" id="input_time" onfocus="++focusEvent" onblur="++blurEvent"
- onfocusin="++focusInEvent" onfocusout="++focusOutEvent">
-</div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-/**
- * Test for Bug 1301306.
- * This test checks that when moving inside the time input element, e.g. jumping
- * through the inner text boxes, does not fire extra focus/blur events.
- **/
-
-var focusEvent = 0;
-var focusInEvent = 0;
-var focusOutEvent = 0;
-var blurEvent = 0;
-
-SimpleTest.waitForExplicitFinish();
-SimpleTest.waitForFocus(function() {
- test();
- SimpleTest.finish();
-});
-
-function test() {
- var time = document.getElementById("input_time");
- time.focus();
- is(focusEvent, 1, "time input element should have dispatched focus event.");
- is(focusInEvent, 1, "time input element should have dispatched focusin event.");
- is(focusOutEvent, 0, "time input element should not have dispatched focusout event.");
- is(blurEvent, 0, "time input element should not have dispatched blur event.");
-
- // Move around inside the input element's input box.
- synthesizeKey("VK_TAB", {});
- is(focusEvent, 1, "time input element should not have dispatched focus event.");
- is(focusInEvent, 1, "time input element should have dispatched focusin event.");
- is(focusOutEvent, 0, "time input element should not have dispatched focusout event.");
- is(blurEvent, 0, "time input element should not have dispatched blur event.");
-
- synthesizeKey("VK_RIGHT", {});
- is(focusEvent, 1, "time input element should not have dispatched focus event.");
- is(focusInEvent, 1, "time input element should have dispatched focusin event.");
- is(focusOutEvent, 0, "time input element should not have dispatched focusout event.");
- is(blurEvent, 0, "time input element should not have dispatched blur event.");
-
- synthesizeKey("VK_LEFT", {});
- is(focusEvent, 1, "time input element should not have dispatched focus event.");
- is(focusInEvent, 1, "time input element should have dispatched focusin event.");
- is(focusOutEvent, 0, "time input element should not have dispatched focusout event.");
- is(blurEvent, 0, "time input element should not have dispatched blur event.");
-
- synthesizeKey("VK_RIGHT", {});
- is(focusEvent, 1, "time input element should not have dispatched focus event.");
- is(focusInEvent, 1, "time input element should have dispatched focusin event.");
- is(focusOutEvent, 0, "time input element should not have dispatched focusout event.");
- is(blurEvent, 0, "time input element should not have dispatched blur event.");
-
- time.blur();
- is(focusEvent, 1, "time input element should not have dispatched focus event.");
- is(focusInEvent, 1, "time input element should have dispatched focusin event.");
- is(focusOutEvent, 1, "time input element should not have dispatched focusout event.");
- is(blurEvent, 1, "time input element should have dispatched blur event.");
-}
-
-</script>
-</pre>
-</body>
-</html>
diff --git a/dom/html/test/forms/test_input_types_pref.html b/dom/html/test/forms/test_input_types_pref.html
index 243836f34a..5279d6a2ac 100644
--- a/dom/html/test/forms/test_input_types_pref.html
+++ b/dom/html/test/forms/test_input_types_pref.html
@@ -37,47 +37,63 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=764481
inputType: "color",
expectedType: "color"
}, {
- prefs: [["dom.experimental_forms", false], ["dom.forms.datepicker", false],
- ["dom.forms.datetime", false]],
+ prefs: [["dom.experimental_forms", false], ["dom.forms.datetime", false]],
inputType: "date",
expectedType: "text"
}, {
- prefs: [["dom.experimental_forms", true], ["dom.forms.datepicker", false],
- ["dom.forms.datetime", false]],
+ prefs: [["dom.experimental_forms", true], ["dom.forms.datetime", false]],
inputType: "date",
expectedType: "date"
}, {
- prefs: [["dom.experimental_forms", false], ["dom.forms.datepicker", true],
- ["dom.forms.datetime", false]],
+ prefs: [["dom.experimental_forms", false], ["dom.forms.datetime", true]],
inputType: "date",
expectedType: "date"
}, {
- prefs: [["dom.experimental_forms", false], ["dom.forms.datepicker", false],
- ["dom.forms.datetime", true]],
- inputType: "date",
- expectedType: "date"
+ prefs: [["dom.experimental_forms", false], ["dom.forms.datetime", false]],
+ inputType: "time",
+ expectedType: "text"
+ }, {
+ prefs: [["dom.experimental_forms", true], ["dom.forms.datetime", false]],
+ inputType: "time",
+ expectedType: "time"
+ }, {
+ prefs: [["dom.experimental_forms", false], ["dom.forms.datetime", true]],
+ inputType: "time",
+ expectedType: "time"
+ }, {
+ prefs: [["dom.forms.datetime", false], ["dom.forms.datetime.others", false]],
+ inputType: "month",
+ expectedType: "text"
}, {
- prefs: [["dom.forms.datetime", false]],
+ prefs: [["dom.forms.datetime", true], ["dom.forms.datetime.others", false]],
inputType: "month",
expectedType: "text"
}, {
- prefs: [["dom.forms.datetime", true]],
+ prefs: [["dom.forms.datetime", false], ["dom.forms.datetime.others", true]],
inputType: "month",
expectedType: "month"
}, {
- prefs: [["dom.forms.datetime", false]],
+ prefs: [["dom.forms.datetime", false], ["dom.forms.datetime.others", false]],
+ inputType: "week",
+ expectedType: "text"
+ }, {
+ prefs: [["dom.forms.datetime", true], ["dom.forms.datetime.others", false]],
inputType: "week",
expectedType: "text"
}, {
- prefs: [["dom.forms.datetime", true]],
+ prefs: [["dom.forms.datetime", false], ["dom.forms.datetime.others", true]],
inputType: "week",
expectedType: "week"
}, {
- prefs: [["dom.forms.datetime", false]],
+ prefs: [["dom.forms.datetime", false], ["dom.forms.datetime.others", false]],
+ inputType: "datetime-local",
+ expectedType: "text"
+ }, {
+ prefs: [["dom.forms.datetime", true], ["dom.forms.datetime.others", false]],
inputType: "datetime-local",
expectedType: "text"
}, {
- prefs: [["dom.forms.datetime", true]],
+ prefs: [["dom.forms.datetime", false], ["dom.forms.datetime.others", true]],
inputType: "datetime-local",
expectedType: "datetime-local"
}
diff --git a/dom/html/test/forms/test_input_typing_sanitization.html b/dom/html/test/forms/test_input_typing_sanitization.html
index 0896f19df8..eee300b33f 100644
--- a/dom/html/test/forms/test_input_typing_sanitization.html
+++ b/dom/html/test/forms/test_input_typing_sanitization.html
@@ -26,6 +26,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=765772
* This test checks that when a user types in some input types, it will not be
* in a state where the value will be un-sanitized and usable (by a script).
*/
+const isDesktop = !/Mobile|Tablet/.test(navigator.userAgent);
var input = document.getElementById('i');
var form = document.getElementById('f');
@@ -143,6 +144,7 @@ function runTest()
]
},
{
+ mobileOnly: true,
type: 'date',
validData: [
'0001-01-01',
@@ -161,6 +163,28 @@ function runTest()
]
},
{
+ mobileOnly: true,
+ type: 'time',
+ validData: [
+ '00:00',
+ '09:09:00',
+ '08:23:23.1',
+ '21:43:56.12',
+ '23:12:45.100',
+ ],
+ invalidData: [
+ '00:',
+ '00:00:',
+ '25:00',
+ '-00:00',
+ '00:00:00.',
+ '00:60',
+ '10:58:99',
+ ':19:10',
+ '23:08:09.1012',
+ ]
+ },
+ {
type: 'month',
validData: [
'0001-01',
@@ -218,6 +242,10 @@ function runTest()
for (test of data) {
gCurrentTest = test;
+ if (gCurrentTest.mobileOnly && isDesktop) {
+ continue;
+ }
+
input.type = test.type;
gValidData = test.validData;
gInvalidData = test.invalidData;
diff --git a/dom/html/test/forms/test_max_attribute.html b/dom/html/test/forms/test_max_attribute.html
index 4007cfad6e..091ad321be 100644
--- a/dom/html/test/forms/test_max_attribute.html
+++ b/dom/html/test/forms/test_max_attribute.html
@@ -31,8 +31,7 @@ var data = [
{ type: 'month', apply: true },
{ type: 'week', apply: true },
{ type: 'time', apply: true },
- // TODO: temporary set to false until bug 888331 is fixed.
- { type: 'datetime-local', apply: false },
+ { type: 'datetime-local', apply: true },
{ type: 'number', apply: true },
{ type: 'range', apply: true },
{ type: 'color', apply: false },
@@ -71,7 +70,8 @@ function checkValidity(aElement, aValidity, aApply, aRangeApply)
"element overflow status should be " + !aValidity);
var overflowMsg =
(aElement.type == "date" || aElement.type == "time" ||
- aElement.type == "month" || aElement.type == "week") ?
+ aElement.type == "month" || aElement.type == "week" ||
+ aElement.type == "datetime-local") ?
("Please select a value that is no later than " + aElement.max + ".") :
("Please select a value that is no more than " + aElement.max + ".");
is(aElement.validationMessage,
@@ -148,7 +148,7 @@ for (var test of data) {
input.max = '2016-W39';
break;
case 'datetime-local':
- // TODO: this is temporary until bug 888331 is fixed.
+ input.max = '2016-12-31T23:59:59';
break;
default:
ok(false, 'please, add a case for this new type (' + input.type + ')');
@@ -421,7 +421,44 @@ for (var test of data) {
break;
case 'datetime-local':
- // TODO: this is temporary until bug 888331 is fixed.
+ input.value = '2016-01-01T12:00';
+ checkValidity(input, true, apply, apply);
+
+ input.value = '2016-12-31T23:59:59';
+ checkValidity(input, true, apply, apply);
+
+ input.value = 'foo';
+ checkValidity(input, true, apply, apply);
+
+ input.value = '2016-12-31T23:59:59.123';
+ checkValidity(input, false, apply, apply);
+
+ input.value = '2017-01-01T10:00';
+ checkValidity(input, false, apply, apply);
+
+ input.max = '2017-01-01T10:00';
+ checkValidity(input, true, apply, apply);
+
+ input.value = '2017-01-01T10:00:30';
+ checkValidity(input, false, apply, apply);
+
+ input.value = '1000-01-01T12:00';
+ checkValidity(input, true, apply, apply);
+
+ input.value = '2100-01-01T12:00';
+ checkValidity(input, false, apply, apply);
+
+ input.max = '0050-12-31T23:59:59.999';
+ checkValidity(input, false, apply, apply);
+
+ input.value = '0050-12-31T23:59:59';
+ checkValidity(input, true, apply, apply);
+
+ input.max = '';
+ checkValidity(input, true, apply, false);
+
+ input.max = 'foo';
+ checkValidity(input, true, apply, false);
break;
}
diff --git a/dom/html/test/forms/test_min_attribute.html b/dom/html/test/forms/test_min_attribute.html
index 1258babec0..22f21de39f 100644
--- a/dom/html/test/forms/test_min_attribute.html
+++ b/dom/html/test/forms/test_min_attribute.html
@@ -31,8 +31,7 @@ var data = [
{ type: 'month', apply: true },
{ type: 'week', apply: true },
{ type: 'time', apply: true },
- // TODO: temporary set to false until bug 888331 is fixed.
- { type: 'datetime-local', apply: false },
+ { type: 'datetime-local', apply: true },
{ type: 'number', apply: true },
{ type: 'range', apply: true },
{ type: 'color', apply: false },
@@ -71,7 +70,8 @@ function checkValidity(aElement, aValidity, aApply, aRangeApply)
"element underflow status should be " + !aValidity);
var underflowMsg =
(aElement.type == "date" || aElement.type == "time" ||
- aElement.type == "month" || aElement.type == "week") ?
+ aElement.type == "month" || aElement.type == "week" ||
+ aElement.type == "datetime-local") ?
("Please select a value that is no earlier than " + aElement.min + ".") :
("Please select a value that is no less than " + aElement.min + ".");
is(aElement.validationMessage,
@@ -146,10 +146,10 @@ for (var test of data) {
input.min = '2016-06';
break;
case 'week':
- input.min = "2016-W39";
+ input.min = '2016-W39';
break;
case 'datetime-local':
- // TODO: this is temporary until bug 888331 is fixed.
+ input.min = '2017-01-01T00:00';
break;
default:
ok(false, 'please, add a case for this new type (' + input.type + ')');
@@ -420,7 +420,44 @@ for (var test of data) {
checkValidity(input, true, apply, false);
break;
case 'datetime-local':
- // TODO: this is temporary until bug 888331 is fixed.
+ input.value = '2017-12-31T23:59';
+ checkValidity(input, true, apply, apply);
+
+ input.value = '2017-01-01T00:00';
+ checkValidity(input, true, apply, apply);
+
+ input.value = '2017-01-01T00:00:00.123';
+ checkValidity(input, true, apply, apply);
+
+ input.value = 'foo';
+ checkValidity(input, true, apply, apply);
+
+ input.value = '2016-12-31T23:59';
+ checkValidity(input, false, apply, apply);
+
+ input.min = '2016-01-01T00:00';
+ checkValidity(input, true, apply, apply);
+
+ input.value = '2015-12-31T23:59';
+ checkValidity(input, false, apply, apply);
+
+ input.value = '1000-01-01T00:00';
+ checkValidity(input, false, apply, apply);
+
+ input.value = '10000-01-01T00:00';
+ checkValidity(input, true, apply, apply);
+
+ input.min = '0010-01-01T12:00';
+ checkValidity(input, true, apply, apply);
+
+ input.value = '0010-01-01T10:00';
+ checkValidity(input, false, apply, apply);
+
+ input.min = '';
+ checkValidity(input, true, apply, false);
+
+ input.min = 'foo';
+ checkValidity(input, true, apply, false);
break;
default:
ok(false, 'write tests for ' + input.type);
diff --git a/dom/html/test/forms/test_step_attribute.html b/dom/html/test/forms/test_step_attribute.html
index 31277860c9..a14afa4612 100644
--- a/dom/html/test/forms/test_step_attribute.html
+++ b/dom/html/test/forms/test_step_attribute.html
@@ -31,8 +31,7 @@ var data = [
{ type: 'month', apply: true },
{ type: 'week', apply: true },
{ type: 'time', apply: true },
- // TODO: temporary set to false until bug 888331 is fixed.
- { type: 'datetime-local', apply: false },
+ { type: 'datetime-local', apply: true },
{ type: 'number', apply: true },
{ type: 'range', apply: true },
{ type: 'color', apply: false },
@@ -950,7 +949,104 @@ for (var test of data) {
break;
case 'datetime-local':
- // TODO: this is temporary until bug 888331 is fixed.
+ // When step is invalid, every datetime is valid
+ input.step = 0;
+ input.value = '2017-02-06T12:00';
+ checkValidity(input, true, apply);
+
+ input.step = 'foo';
+ input.value = '1970-01-01T00:00';
+ checkValidity(input, true, apply);
+
+ input.step = '-1';
+ input.value = '1969-12-12 00:10';
+ checkValidity(input, true, apply);
+
+ input.removeAttribute('step');
+ input.value = '1500-01-01T12:00';
+ checkValidity(input, true, apply);
+
+ input.step = 'any';
+ input.value = '1966-12-12T12:00';
+ checkValidity(input, true, apply);
+
+ input.step = 'ANY';
+ input.value = '2017-01-01 12:00';
+ checkValidity(input, true, apply);
+
+ // When min is set to a valid datetime, there is a step base.
+ input.min = '2017-01-01T00:00:00';
+ input.step = '2';
+ input.value = '2017-01-01T00:00:02';
+ checkValidity(input, true, apply);
+
+ input.value = '2017-01-01T00:00:03';
+ checkValidity(input, false, apply,
+ { low: "2017-01-01T00:00:02", high: "2017-01-01T00:00:04" });
+
+ input.min = '2017-01-01T00:00:05';
+ input.value = '2017-01-01T00:00:08';
+ checkValidity(input, false, apply,
+ { low: "2017-01-01T00:00:07", high: "2017-01-01T00:00:09" });
+
+ input.min = '2000-01-01T00:00';
+ input.step = '120';
+ input.value = '2000-01-01T00:02';
+ checkValidity(input, true, apply);
+
+ // Without any step attribute the datetime is valid
+ input.removeAttribute('step');
+ checkValidity(input, true, apply);
+
+ input.min = '1950-01-01T00:00';
+ input.step = '129600'; // 1.5 day
+ input.value = '1950-01-02T00:00';
+ checkValidity(input, false, apply,
+ { low: "1950-01-01T00:00", high: "1950-01-02T12:00" });
+
+ input.step = '259200'; // 3 days
+ input.value = '1950-01-04T12:00';
+ checkValidity(input, false, apply,
+ { low: "1950-01-04T00:00", high: "1950-01-07T00:00" });
+
+ input.value = '1950-01-10T00:00';
+ checkValidity(input, true, apply);
+
+ input.step = '0.5'; // half a second
+ input.value = '1950-01-01T00:00:00.123';
+ checkValidity(input, false, apply,
+ { low: "1950-01-01T00:00", high: "1950-01-01T00:00:00.500" });
+
+ input.value = '2000-01-01T12:30:30.600';
+ checkValidity(input, false, apply,
+ { low: "2000-01-01T12:30:30.500", high: "2000-01-01T12:30:31" });
+
+ input.value = '1950-01-05T00:00:00.500';
+ checkValidity(input, true, apply);
+
+ input.step = '2.1';
+ input.min = '1991-01-01T12:00';
+ input.value = '1991-01-01T12:00';
+ checkValidity(input, true, apply);
+
+ input.value = '1991-01-01T12:00:03';
+ checkValidity(input, false, apply,
+ { low: "1991-01-01T12:00:02.100", high: "1991-01-01T12:00:04.200" });
+
+ input.value = '1991-01-01T12:00:06.3';
+ checkValidity(input, true, apply);
+
+ input.step = '2.1';
+ input.min = '1969-12-20T10:00:05';
+ input.value = '1969-12-20T10:00:05';
+ checkValidity(input, true, apply);
+
+ input.value = '1969-12-20T10:00:08';
+ checkValidity(input, false, apply,
+ { low: "1969-12-20T10:00:07.100", high: "1969-12-20T10:00:09.200" });
+
+ input.value = '1969-12-20T10:00:09.200';
+ checkValidity(input, true, apply);
break;
default:
diff --git a/dom/html/test/forms/test_stepup_stepdown.html b/dom/html/test/forms/test_stepup_stepdown.html
index d968951801..21cde58aa5 100644
--- a/dom/html/test/forms/test_stepup_stepdown.html
+++ b/dom/html/test/forms/test_stepup_stepdown.html
@@ -52,13 +52,8 @@ function checkAvailability()
["time", true],
["month", true],
["week", true],
- ["color", false],
- ];
-
- var todoList =
- [
- ["datetime", true],
["datetime-local", true],
+ ["color", false],
];
var element = document.createElement("input");
@@ -82,27 +77,6 @@ function checkAvailability()
}
is(exceptionCaught, !data[1], "stepUp() availability is not correct");
}
-
- for (data of todoList) {
- var exceptionCaught = false;
- element.type = data[0];
- try {
- element.stepDown();
- } catch (e) {
- exceptionCaught = true;
- }
- todo_is(exceptionCaught, !data[1],
- "stepDown() availability is not correct");
-
- exceptionCaught = false;
- try {
- element.stepUp();
- } catch (e) {
- exceptionCaught = true;
- }
- todo_is(exceptionCaught, !data[1],
- "stepUp() availability is not correct");
- }
}
function checkStepDown()
@@ -509,6 +483,80 @@ function checkStepDown()
[ '2016-W01', 'AnY', null, null, 1, null, true ],
[ '2016-W01', 'aNy', null, null, 1, null, true ],
]},
+ { type: 'datetime-local', data: [
+ // Regular case.
+ [ '2017-02-07T09:30', null, null, null, null, '2017-02-07T09:29', false ],
+ // Argument testing.
+ [ '2017-02-07T09:30', null, null, null, 1, '2017-02-07T09:29', false ],
+ [ '2017-02-07T09:30', null, null, null, 5, '2017-02-07T09:25', false ],
+ [ '2017-02-07T09:30', null, null, null, -1, '2017-02-07T09:31', false ],
+ [ '2017-02-07T09:30', null, null, null, 0, '2017-02-07T09:30', false ],
+ // hour/minutes/seconds wrapping.
+ [ '2000-01-01T05:00', null, null, null, null, '2000-01-01T04:59', false ],
+ [ '2000-01-01T05:00:00', 1, null, null, null, '2000-01-01T04:59:59', false ],
+ [ '2000-01-01T05:00:00', 0.1, null, null, null, '2000-01-01T04:59:59.900', false ],
+ [ '2000-01-01T05:00:00', 0.01, null, null, null, '2000-01-01T04:59:59.990', false ],
+ [ '2000-01-01T05:00:00', 0.001, null, null, null, '2000-01-01T04:59:59.999', false ],
+ // month/year wrapping.
+ [ '2012-08-01T12:00', null, null, null, 1440, '2012-07-31T12:00', false ],
+ [ '1969-01-02T12:00', null, null, null, 5760, '1968-12-29T12:00', false ],
+ [ '1969-12-31T00:00', null, null, null, -1440, '1970-01-01T00:00', false ],
+ [ '2012-02-29T00:00', null, null, null, -1440, '2012-03-01T00:00', false ],
+ // stepDown() on '00:00' gives '23:59'.
+ [ '2017-02-07T00:00', null, null, null, 1, '2017-02-06T23:59', false ],
+ [ '2017-02-07T00:00', null, null, null, 3, '2017-02-06T23:57', false ],
+ // Some random step values..
+ [ '2017-02-07T16:07', '0.5', null, null, null, '2017-02-07T16:06:59.500', false ],
+ [ '2017-02-07T16:07', '2', null, null, null, '2017-02-07T16:06:58', false ],
+ [ '2017-02-07T16:07', '0.25', null, null, 4, '2017-02-07T16:06:59', false ],
+ [ '2017-02-07T16:07', '1.1', '2017-02-07T16:00', null, 1, '2017-02-07T16:06:59.100', false ],
+ [ '2017-02-07T16:07', '1.1', '2017-02-07T16:00', null, 2, '2017-02-07T16:06:58', false ],
+ [ '2017-02-07T16:07', '1.1', '2017-02-07T16:00', null, 10, '2017-02-07T16:06:49.200', false ],
+ [ '2017-02-07T16:07', '129600', '2017-02-01T00:00', null, 2, '2017-02-05T12:00', false ],
+ // step = 0 isn't allowed (-> step = 1).
+ [ '2017-02-07T10:15', '0', null, null, null, '2017-02-07T10:14', false ],
+ // step < 0 isn't allowed (-> step = 1).
+ [ '2017-02-07T10:15', '-1', null, null, null, '2017-02-07T10:14', false ],
+ // step = NaN isn't allowed (-> step = 1).
+ [ '2017-02-07T10:15', 'foo', null, null, null, '2017-02-07T10:14', false ],
+ // Min values testing.
+ [ '2012-02-02T17:02', '60', 'foo', null, 2, '2012-02-02T17:00', false ],
+ [ '2012-02-02T17:10', '60', '2012-02-02T17:09', null, null, '2012-02-02T17:09', false ],
+ [ '2012-02-02T17:10', '60', '2012-02-02T17:10', null, null, '2012-02-02T17:10', false ],
+ [ '2012-02-02T17:10', '60', '2012-02-02T17:30', null, 1, '2012-02-02T17:10', false ],
+ [ '2012-02-02T17:10', '180', '2012-02-02T17:05', null, null, '2012-02-02T17:08', false ],
+ [ '2012-02-03T20:05', '86400', '2012-02-02T17:05', null, null, '2012-02-03T17:05', false ],
+ [ '2012-02-03T18:00', '129600', '2012-02-01T00:00', null, null, '2012-02-02T12:00', false ],
+ // Max values testing.
+ [ '2012-02-02T17:15', '60', null, 'foo', null, '2012-02-02T17:14', false ],
+ [ '2012-02-02T17:15', null, null, '2012-02-02T17:20', null, '2012-02-02T17:14', false ],
+ [ '2012-02-02T17:15', null, null, '2012-02-02T17:15', null, '2012-02-02T17:14', false ],
+ [ '2012-02-02T17:15', null, null, '2012-02-02T17:13', 4, '2012-02-02T17:11', false ],
+ [ '2012-02-02T17:15', '120', null, '2012-02-02T17:13', 3, '2012-02-02T17:09', false ],
+ [ '2012-02-03T20:05', '86400', null, '2012-02-03T20:05', null, '2012-02-02T20:05', false ],
+ [ '2012-02-03T18:00', '129600', null, '2012-02-03T20:00', null, '2012-02-02T06:00', false ],
+ // Step mismatch.
+ [ '2017-02-07T17:19', '120', '2017-02-07T17:10', null, null, '2017-02-07T17:18', false ],
+ [ '2017-02-07T17:19', '120', '2017-02-07T17:10', null, 2, '2017-02-07T17:16', false ],
+ [ '2017-02-07T17:19', '120', '2017-02-07T17:18', '2017-02-07T17:25', null, '2017-02-07T17:18', false ],
+ [ '2017-02-07T17:19', '120', null, null, null, '2017-02-07T17:17', false ],
+ [ '2017-02-07T17:19', '180', null, null, null, '2017-02-07T17:16', false ],
+ [ '2017-02-07T17:19', '172800', '2017-02-02T17:19', '2017-02-10T17:19', null, '2017-02-06T17:19', false ],
+ // Clamping.
+ [ '2017-02-07T17:22', null, null, '2017-02-07T17:11', null, '2017-02-07T17:11', false ],
+ [ '2017-02-07T17:22', '120', '2017-02-07T17:20', '2017-02-07T17:22', null, '2017-02-07T17:20', false ],
+ [ '2017-02-07T17:22', '300', '2017-02-07T17:12', '2017-02-07T17:20', 10, '2017-02-07T17:12', false ],
+ [ '2017-02-07T17:22', '300', '2017-02-07T17:18', '2017-02-07T17:20', 2, '2017-02-07T17:18', false ],
+ [ '2017-02-07T17:22', '600', '2017-02-02T17:00', '2017-02-07T17:00', 15, '2017-02-07T15:00', false ],
+ [ '2017-02-07T17:22', '600', '2017-02-02T17:00', '2017-02-07T17:00', 2, '2017-02-07T17:00', false ],
+ // value = "" (NaN).
+ [ '', null, null, null, null, '1969-12-31T23:59', false ],
+ // With step = 'any'.
+ [ '2017-02-07T15:20', 'any', null, null, 1, null, true ],
+ [ '2017-02-07T15:20', 'ANY', null, null, 1, null, true ],
+ [ '2017-02-07T15:20', 'AnY', null, null, 1, null, true ],
+ [ '2017-02-07T15:20', 'aNy', null, null, 1, null, true ],
+ ]},
];
for (var test of testData) {
@@ -958,6 +1006,78 @@ function checkStepUp()
[ '2016-W01', 'AnY', null, null, 1, null, true ],
[ '2016-W01', 'aNy', null, null, 1, null, true ],
]},
+ { type: 'datetime-local', data: [
+ // Regular case.
+ [ '2017-02-07T17:09', null, null, null, null, '2017-02-07T17:10', false ],
+ // Argument testing.
+ [ '2017-02-07T17:10', null, null, null, 1, '2017-02-07T17:11', false ],
+ [ '2017-02-07T17:10', null, null, null, 5, '2017-02-07T17:15', false ],
+ [ '2017-02-07T17:10', null, null, null, -1, '2017-02-07T17:09', false ],
+ [ '2017-02-07T17:10', null, null, null, 0, '2017-02-07T17:10', false ],
+ // hour/minutes/seconds wrapping.
+ [ '2000-01-01T04:59', null, null, null, null, '2000-01-01T05:00', false ],
+ [ '2000-01-01T04:59:59', 1, null, null, null, '2000-01-01T05:00', false ],
+ [ '2000-01-01T04:59:59.900', 0.1, null, null, null, '2000-01-01T05:00', false ],
+ [ '2000-01-01T04:59:59.990', 0.01, null, null, null, '2000-01-01T05:00', false ],
+ [ '2000-01-01T04:59:59.999', 0.001, null, null, null, '2000-01-01T05:00', false ],
+ // month/year wrapping.
+ [ '2012-07-31T12:00', null, null, null, 1440, '2012-08-01T12:00', false ],
+ [ '1968-12-29T12:00', null, null, null, 5760, '1969-01-02T12:00', false ],
+ [ '1970-01-01T00:00', null, null, null, -1440, '1969-12-31T00:00', false ],
+ [ '2012-03-01T00:00', null, null, null, -1440, '2012-02-29T00:00', false ],
+ // stepUp() on '23:59' gives '00:00'.
+ [ '2017-02-07T23:59', null, null, null, 1, '2017-02-08T00:00', false ],
+ [ '2017-02-07T23:59', null, null, null, 3, '2017-02-08T00:02', false ],
+ // Some random step values..
+ [ '2017-02-07T17:40', '0.5', null, null, null, '2017-02-07T17:40:00.500', false ],
+ [ '2017-02-07T17:40', '2', null, null, null, '2017-02-07T17:40:02', false ],
+ [ '2017-02-07T17:40', '0.25', null, null, 4, '2017-02-07T17:40:01', false ],
+ [ '2017-02-07T17:40', '1.1', '2017-02-07T17:00', null, 1, '2017-02-07T17:40:00.200', false ],
+ [ '2017-02-07T17:40', '1.1', '2017-02-07T17:00', null, 2, '2017-02-07T17:40:01.300', false ],
+ [ '2017-02-07T17:40', '1.1', '2017-02-07T17:00', null, 10, '2017-02-07T17:40:10.100', false ],
+ [ '2017-02-07T17:40', '129600', '2017-02-01T00:00', null, 2, '2017-02-10T00:00', false ],
+ // step = 0 isn't allowed (-> step = 1).
+ [ '2017-02-07T17:39', '0', null, null, null, '2017-02-07T17:40', false ],
+ // step < 0 isn't allowed (-> step = 1).
+ [ '2017-02-07T17:39', '-1', null, null, null, '2017-02-07T17:40', false ],
+ // step = NaN isn't allowed (-> step = 1).
+ [ '2017-02-07T17:39', 'foo', null, null, null, '2017-02-07T17:40', false ],
+ // Min values testing.
+ [ '2012-02-02T17:00', '60', 'foo', null, 2, '2012-02-02T17:02', false ],
+ [ '2012-02-02T17:10', '60', '2012-02-02T17:10', null, null, '2012-02-02T17:11', false ],
+ [ '2012-02-02T17:10', '60', '2012-02-02T17:30', null, 1, '2012-02-02T17:30', false ],
+ [ '2012-02-02T17:10', '180', '2012-02-02T17:05', null, null, '2012-02-02T17:11', false ],
+ [ '2012-02-02T17:10', '86400', '2012-02-02T17:05', null, null, '2012-02-03T17:05', false ],
+ [ '2012-02-02T17:10', '129600', '2012-02-01T00:00', null, null, '2012-02-04T00:00', false ],
+ // Max values testing.
+ [ '2012-02-02T17:15', '60', null, 'foo', null, '2012-02-02T17:16', false ],
+ [ '2012-02-02T17:15', null, null, '2012-02-02T17:20', null, '2012-02-02T17:16', false ],
+ [ '2012-02-02T17:15', null, null, '2012-02-02T17:15', null, '2012-02-02T17:15', false ],
+ [ '2012-02-02T17:15', null, null, '2012-02-02T17:13', 4, '2012-02-02T17:15', false ],
+ [ '2012-02-02T20:05', '86400', null, '2012-02-03T20:05', null, '2012-02-03T20:05', false ],
+ [ '2012-02-02T18:00', '129600', null, '2012-02-04T20:00', null, '2012-02-04T06:00', false ],
+ // Step mismatch.
+ [ '2017-02-07T17:19', '120', '2017-02-07T17:10', null, null, '2017-02-07T17:20', false ],
+ [ '2017-02-07T17:19', '120', '2017-02-07T17:10', null, 2, '2017-02-07T17:22', false ],
+ [ '2017-02-07T17:19', '120', '2017-02-07T17:18', '2017-02-07T17:25', null, '2017-02-07T17:20', false ],
+ [ '2017-02-07T17:19', '120', null, null, null, '2017-02-07T17:21', false ],
+ [ '2017-02-07T17:19', '180', null, null, null, '2017-02-07T17:22', false ],
+ [ '2017-02-03T17:19', '172800', '2017-02-02T17:19', '2017-02-10T17:19', null, '2017-02-04T17:19', false ],
+ // Clamping.
+ [ '2017-02-07T17:22', null, null, '2017-02-07T17:11', null, '2017-02-07T17:22', false ],
+ [ '2017-02-07T17:22', '120', '2017-02-07T17:20', '2017-02-07T17:22', null, '2017-02-07T17:22', false ],
+ [ '2017-02-07T17:22', '300', '2017-02-07T17:12', '2017-02-07T17:20', 10, '2017-02-07T17:22', false ],
+ [ '2017-02-07T17:22', '300', '2017-02-07T17:18', '2017-02-07T17:20', 2, '2017-02-07T17:22', false ],
+ [ '2017-02-06T17:22', '600', '2017-02-02T17:00', '2017-02-07T17:20', 15, '2017-02-06T19:50', false ],
+ [ '2017-02-06T17:22', '600', '2017-02-02T17:10', '2017-02-07T17:20', 2, '2017-02-06T17:40', false ],
+ // value = "" (NaN).
+ [ '', null, null, null, null, '1970-01-01T00:01', false ],
+ // With step = 'any'.
+ [ '2017-02-07T17:30', 'any', null, null, 1, null, true ],
+ [ '2017-02-07T17:30', 'ANY', null, null, 1, null, true ],
+ [ '2017-02-07T17:30', 'AnY', null, null, 1, null, true ],
+ [ '2017-02-07T17:30', 'aNy', null, null, 1, null, true ],
+ ]},
];
for (var test of testData) {
diff --git a/dom/html/test/forms/test_valueAsDate_pref.html b/dom/html/test/forms/test_valueAsDate_pref.html
index 8518c291b0..0369980e4d 100644
--- a/dom/html/test/forms/test_valueAsDate_pref.html
+++ b/dom/html/test/forms/test_valueAsDate_pref.html
@@ -12,8 +12,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=874640
/** Test for Bug 874640 **/
var states = [
- // dom.experimental_forms, dom.forms.datepicker, dom.forms.datetime, expectedValueAsDate
- [ 'true', 'true', 'true', 'true' ],
+ // dom.experimental_forms, dom.forms.datetime, dom.forms.datetime.others, expectedValueAsDate
+ [ 'true', 'true', ,'true', 'true' ],
[ 'true', 'false', 'false', 'true' ],
[ 'false', 'true', 'false', 'true' ],
[ 'false', 'false', 'true', 'true' ],
@@ -33,8 +33,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=874640
SpecialPowers.pushPrefEnv({"set":[
["dom.experimental_forms", state[0] === 'true'],
- ["dom.forms.datepicker", state[1] === 'true'],
- ["dom.forms.datetime", state[2] === 'true']]},
+ ["dom.forms.datetime", state[1] === 'true'],
+ ["dom.forms.datetime.others", state[2] === 'true']]},
function() {
iframe.src = 'data:text/html,<script>' +
'parent.is("valueAsDate" in document.createElement("input"), ' +
diff --git a/dom/html/test/forms/test_valueasdate_attribute.html b/dom/html/test/forms/test_valueasdate_attribute.html
index 8c19fefd9d..65cab3b8ea 100644
--- a/dom/html/test/forms/test_valueasdate_attribute.html
+++ b/dom/html/test/forms/test_valueasdate_attribute.html
@@ -47,8 +47,7 @@ var validTypes =
["color", false],
["month", true],
["week", true],
- // TODO: temporary set to false until bug 888331 is fixed.
- ["datetime-local", false],
+ ["datetime-local", true],
];
function checkAvailability()
@@ -622,6 +621,107 @@ function checkWeekSet()
}
}
+function checkDatetimeLocalGet()
+{
+ var validData =
+ [
+ // Simple cases.
+ [ "2016-12-27T10:30", Date.UTC(2016, 11, 27, 10, 30, 0) ],
+ [ "2016-12-27T10:30:40", Date.UTC(2016, 11, 27, 10, 30, 40) ],
+ [ "2016-12-27T10:30:40.567", Date.UTC(2016, 11, 27, 10, 30, 40, 567) ],
+ [ "1969-12-31T12:00:00", Date.UTC(1969, 11, 31, 12, 0, 0) ],
+ [ "1970-01-01T00:00", 0 ],
+ // Leap years.
+ [ "1804-02-29 12:34", Date.UTC(1804, 1, 29, 12, 34, 0) ],
+ [ "2016-02-29T12:34", Date.UTC(2016, 1, 29, 12, 34, 0) ],
+ [ "2016-12-31T12:34:56", Date.UTC(2016, 11, 31, 12, 34, 56) ],
+ [ "2016-01-01T12:34:56.789", Date.UTC(2016, 0, 1, 12, 34, 56, 789) ],
+ [ "2017-01-01 12:34:56.789", Date.UTC(2017, 0, 1, 12, 34, 56, 789) ],
+ // Maximum valid datetime-local (limited by the ecma date object range).
+ [ "275760-09-13T00:00", 8640000000000000 ],
+ // Minimum valid datetime-local (limited by the input element minimum valid value).
+ [ "0001-01-01T00:00", -62135596800000 ],
+ ];
+
+ var invalidData =
+ [
+ [ "invaliddateime-local" ],
+ [ "0000-01-01T00:00" ],
+ [ "2016-12-25T00:00Z" ],
+ [ "2015-02-29T12:34" ],
+ [ "1-1-1T12:00" ],
+ [ "" ],
+ // This datetime-local is valid for the input element, but is out of the
+ // date object range. In this case, on getting valueAsDate, a Date object
+ // will be created, but it will have a NaN internal value, and will return
+ // the string "Invalid Date".
+ [ "275760-09-13T12:00", true ],
+ ];
+
+ element.type = "datetime-local";
+ for (let data of validData) {
+ element.value = data[0];
+ is(element.valueAsDate.valueOf(), data[1],
+ "valueAsDate should return the " +
+ "valid date object representing this datetime-local");
+ }
+
+ for (let data of invalidData) {
+ element.value = data[0];
+ if (data[1]) {
+ is(String(element.valueAsDate), "Invalid Date",
+ "valueAsDate should return an invalid Date object " +
+ "when the element value is not a valid datetime-local");
+ } else {
+ is(element.valueAsDate, null,
+ "valueAsDate should return null " +
+ "when the element value is not a valid datetime-local");
+ }
+ }
+}
+
+function checkDatetimeLocalSet()
+{
+ var testData =
+ [
+ // Simple cases.
+ [ Date.UTC(2016, 11, 27, 10, 30, 0), "2016-12-27T10:30" ],
+ [ Date.UTC(2016, 11, 27, 10, 30, 30), "2016-12-27T10:30:30" ],
+ [ Date.UTC(1999, 11, 31, 23, 59, 59), "1999-12-31T23:59:59" ],
+ [ Date.UTC(1999, 11, 31, 23, 59, 59, 999), "1999-12-31T23:59:59.999" ],
+ [ Date.UTC(123456, 7, 8, 9, 10), "123456-08-08T09:10" ],
+ [ 0, "1970-01-01T00:00" ],
+ // Maximum valid datetime-local (limited by the ecma date object range).
+ [ 8640000000000000, "275760-09-13T00:00" ],
+ // Minimum valid datetime-local (limited by the input element minimum valid value).
+ [ -62135596800000, "0001-01-01T00:00" ],
+ // Leap years.
+ [ Date.UTC(1804, 1, 29, 12, 34, 0), "1804-02-29T12:34" ],
+ [ Date.UTC(2016, 1, 29, 12, 34, 0), "2016-02-29T12:34" ],
+ [ Date.UTC(2016, 11, 31, 12, 34, 56), "2016-12-31T12:34:56" ],
+ [ Date.UTC(2016, 0, 1, 12, 34, 56, 789), "2016-01-01T12:34:56.789" ],
+ [ Date.UTC(2017, 0, 1, 12, 34, 56, 789), "2017-01-01T12:34:56.789" ],
+ // "Values must be truncated to valid datetime-local"
+ [ 123.123456789123, "1970-01-01T00:00:00.123" ],
+ [ 1e-1, "1970-01-01T00:00" ],
+ [ -1.1, "1969-12-31T23:59:59.999" ],
+ [ -345600000, "1969-12-28T00:00" ],
+ // Negative years, this is out of range for the input element,
+ // the corresponding datetime-local string is the empty string
+ [ -62135596800001, "" ],
+ ];
+
+ element.type = "datetime-local";
+ for (let data of testData) {
+ element.valueAsDate = new Date(data[0]);
+ is(element.value, data[1], "valueAsDate should set the value to " +
+ data[1]);
+ element.valueAsDate = new testFrame.Date(data[0]);
+ is(element.value, data[1], "valueAsDate with other-global date should " +
+ "set the value to " + data[1]);
+ }
+}
+
checkAvailability();
checkGarbageValues();
checkWithBustedPrototype();
@@ -642,6 +742,10 @@ checkMonthSet();
checkWeekGet();
checkWeekSet();
+// Test <input type='datetime-local'>.
+checkDatetimeLocalGet();
+checkDatetimeLocalSet();
+
</script>
</pre>
</body>
diff --git a/dom/html/test/forms/test_valueasnumber_attribute.html b/dom/html/test/forms/test_valueasnumber_attribute.html
index d7471502b0..2660fc7ed9 100644
--- a/dom/html/test/forms/test_valueasnumber_attribute.html
+++ b/dom/html/test/forms/test_valueasnumber_attribute.html
@@ -46,8 +46,7 @@ function checkAvailability()
["color", false],
["month", true],
["week", true],
- // TODO: temporary set to false until bug 888331 is fixed.
- ["datetime-local", false],
+ ["datetime-local", true],
];
var element = document.createElement('input');
@@ -612,7 +611,6 @@ function checkWeekGet()
var element = document.createElement('input');
element.type = "week";
for (let data of validData) {
- dump("Test: " + data[0]);
element.value = data[0];
is(element.valueAsNumber, data[1], "valueAsNumber should return the " +
"integer value representing this week");
@@ -698,7 +696,120 @@ function checkWeekSet()
try {
element.valueAsNumber = data[0];
- is(element.value, data[1], "valueAsNumber should set the value to " + data[1]);
+ is(element.value, data[1], "valueAsNumber should set the value to " +
+ data[1]);
+ } catch(e) {
+ caught = true;
+ }
+
+ if (data[2]) {
+ ok(caught, "valueAsNumber should have thrown");
+ is(element.value, data[1], "the value should not have changed");
+ } else {
+ ok(!caught, "valueAsNumber should not have thrown");
+ }
+ }
+}
+
+function checkDatetimeLocalGet() {
+ var validData =
+ [
+ // Simple cases.
+ [ "2016-12-20T09:58", Date.UTC(2016, 11, 20, 9, 58) ],
+ [ "2016-12-20T09:58:30", Date.UTC(2016, 11, 20, 9, 58, 30) ],
+ [ "2016-12-20T09:58:30.123", Date.UTC(2016, 11, 20, 9, 58, 30, 123) ],
+ [ "2017-01-01T10:00", Date.UTC(2017, 0, 1, 10, 0, 0) ],
+ [ "1969-12-31T12:00:00", Date.UTC(1969, 11, 31, 12, 0, 0) ],
+ [ "1970-01-01T00:00", 0 ],
+ // Leap years.
+ [ "1804-02-29 12:34", Date.UTC(1804, 1, 29, 12, 34, 0) ],
+ [ "2016-02-29T12:34", Date.UTC(2016, 1, 29, 12, 34, 0) ],
+ [ "2016-12-31T12:34:56", Date.UTC(2016, 11, 31, 12, 34, 56) ],
+ [ "2016-01-01T12:34:56.789", Date.UTC(2016, 0, 1, 12, 34, 56, 789) ],
+ [ "2017-01-01 12:34:56.789", Date.UTC(2017, 0, 1, 12, 34, 56, 789) ],
+ // Maximum valid datetime-local (limited by the ecma date object range).
+ [ "275760-09-13T00:00", 8640000000000000 ],
+ // Minimum valid datetime-local (limited by the input element minimum valid value).
+ [ "0001-01-01T00:00", -62135596800000 ],
+ ];
+
+ var invalidData =
+ [
+ "invaliddatetime-local",
+ "0000-01-01T00:00",
+ "2016-12-25T00:00Z",
+ "2015-02-29T12:34",
+ "1-1-1T12:00",
+ // Out of range.
+ "275760-09-13T12:00",
+ ];
+
+ var element = document.createElement('input');
+ element.type = "datetime-local";
+ for (let data of validData) {
+ element.value = data[0];
+ is(element.valueAsNumber, data[1], "valueAsNumber should return the " +
+ "integer value representing this datetime-local");
+ }
+
+ for (let data of invalidData) {
+ element.value = data;
+ ok(isNaN(element.valueAsNumber), "valueAsNumber should return NaN " +
+ "when the element value is not a valid datetime-local");
+ }
+}
+
+function checkDatetimeLocalSet()
+{
+ var testData =
+ [
+ // Simple cases.
+ [ Date.UTC(2016, 11, 20, 9, 58, 0), "2016-12-20T09:58", ],
+ [ Date.UTC(2016, 11, 20, 9, 58, 30), "2016-12-20T09:58:30" ],
+ [ Date.UTC(2016, 11, 20, 9, 58, 30, 123), "2016-12-20T09:58:30.123" ],
+ [ Date.UTC(2017, 0, 1, 10, 0, 0), "2017-01-01T10:00" ],
+ [ Date.UTC(1969, 11, 31, 12, 0, 0), "1969-12-31T12:00" ],
+ [ 0, "1970-01-01T00:00" ],
+ // Maximum valid week (limited by the ecma date object range).
+ [ 8640000000000000, "275760-09-13T00:00" ],
+ // Minimum valid datetime-local (limited by the input element minimum valid value).
+ [ -62135596800000, "0001-01-01T00:00" ],
+ // Leap years.
+ [ Date.UTC(1804, 1, 29, 12, 34, 0), "1804-02-29T12:34" ],
+ [ Date.UTC(2016, 1, 29, 12, 34, 0), "2016-02-29T12:34" ],
+ [ Date.UTC(2016, 11, 31, 12, 34, 56), "2016-12-31T12:34:56" ],
+ [ Date.UTC(2016, 0, 1, 12, 34, 56, 789), "2016-01-01T12:34:56.789" ],
+ [ Date.UTC(2017, 0, 1, 12, 34, 56, 789), "2017-01-01T12:34:56.789" ],
+ // "Values must be truncated to valid datetime-local"
+ [ 0.3, "1970-01-01T00:00" ],
+ [ 1e-1, "1970-01-01T00:00" ],
+ [ -1 , "1969-12-31T23:59:59.999" ],
+ [ -345600000, "1969-12-28T00:00" ],
+ // Invalid numbers.
+ // Those are implicitly converted to numbers
+ [ "", "1970-01-01T00:00" ],
+ [ true, "1970-01-01T00:00:00.001" ],
+ [ false, "1970-01-01T00:00" ],
+ [ null, "1970-01-01T00:00" ],
+ // Those are converted to NaN, the corresponding week string is the empty string
+ [ "invaliddatetime-local", "" ],
+ [ NaN, "" ],
+ [ undefined, "" ],
+ // Infinity will keep the current value and throw (so we need to set a current value).
+ [ Date.UTC(2016, 11, 27, 15, 10, 0), "2016-12-27T15:10" ],
+ [ Infinity, "2016-12-27T15:10", true ],
+ [ -Infinity, "2016-12-27T15:10", true ],
+ ];
+
+ var element = document.createElement('input');
+ element.type = "datetime-local";
+ for (let data of testData) {
+ var caught = false;
+
+ try {
+ element.valueAsNumber = data[0];
+ is(element.value, data[1], "valueAsNumber should set the value to " +
+ data[1]);
} catch(e) {
caught = true;
}
@@ -738,6 +849,10 @@ checkMonthSet();
checkWeekGet();
checkWeekSet();
+// <input type='datetime-local'> test
+checkDatetimeLocalGet();
+checkDatetimeLocalSet();
+
</script>
</pre>
</body>
diff --git a/dom/html/test/test_bug558788-1.html b/dom/html/test/test_bug558788-1.html
index 94b7a5f00e..4db61ed738 100644
--- a/dom/html/test/test_bug558788-1.html
+++ b/dom/html/test/test_bug558788-1.html
@@ -154,13 +154,14 @@ function checkInputURL()
sendString("ttp://mozilla.org");
checkValidApplies(element);
- for (var i=0; i<13; ++i) {
+ for (var i=0; i<10; ++i) {
synthesizeKey("VK_BACK_SPACE", {});
checkValidApplies(element);
}
synthesizeKey("VK_BACK_SPACE", {});
- for (var i=0; i<4; ++i) {
+ // "http://" is now invalid
+ for (var i=0; i<7; ++i) {
checkInvalidApplies(element);
synthesizeKey("VK_BACK_SPACE", {});
}
diff --git a/dom/indexedDB/test/browser_forgetThisSite.js b/dom/indexedDB/test/browser_forgetThisSite.js
index c1177908f4..02674922f3 100644
--- a/dom/indexedDB/test/browser_forgetThisSite.js
+++ b/dom/indexedDB/test/browser_forgetThisSite.js
@@ -67,9 +67,10 @@ function test2()
function test3()
{
// Remove database from domain 2
- ForgetAboutSite.removeDataFromDomain(domains[1]);
- setPermission(testPageURL4, "indexedDB");
- executeSoon(test4);
+ ForgetAboutSite.removeDataFromDomain(domains[1]).then(() => {
+ setPermission(testPageURL4, "indexedDB");
+ executeSoon(test4);
+ });
}
function test4()
diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp
index ca4acf114b..75678ca962 100644
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -585,11 +585,6 @@ ContentChild::Init(MessageLoop* aIOLoop,
SendBackUpXResources(FileDescriptor(xSocketFd));
#endif
-#ifdef MOZ_CRASHREPORTER
- SendPCrashReporterConstructor(CrashReporter::CurrentThreadId(),
- XRE_GetProcessType());
-#endif
-
SendGetProcessAttributes(&mID, &mIsForApp, &mIsForBrowser);
InitProcessAttributes();
@@ -1439,18 +1434,6 @@ ContentChild::RecvSetProcessSandbox(const MaybeFileDesc& aBroker)
sandboxEnabled = StartMacOSContentSandbox();
#endif
-#if defined(MOZ_CRASHREPORTER)
- CrashReporter::AnnotateCrashReport(
- NS_LITERAL_CSTRING("ContentSandboxEnabled"),
- sandboxEnabled? NS_LITERAL_CSTRING("1") : NS_LITERAL_CSTRING("0"));
-#if defined(XP_LINUX) && !defined(OS_ANDROID)
- nsAutoCString flagsString;
- flagsString.AppendInt(SandboxInfo::Get().AsInteger());
-
- CrashReporter::AnnotateCrashReport(
- NS_LITERAL_CSTRING("ContentSandboxCapabilities"), flagsString);
-#endif /* XP_LINUX && !OS_ANDROID */
-#endif /* MOZ_CRASHREPORTER */
#endif /* MOZ_CONTENT_SANDBOX */
return true;
@@ -1740,11 +1723,7 @@ PCrashReporterChild*
ContentChild::AllocPCrashReporterChild(const mozilla::dom::NativeThreadId& id,
const uint32_t& processType)
{
-#ifdef MOZ_CRASHREPORTER
- return new CrashReporterChild();
-#else
return nullptr;
-#endif
}
bool
@@ -2159,16 +2138,6 @@ ContentChild::ProcessingError(Result aCode, const char* aReason)
NS_RUNTIMEABORT("not reached");
}
-#if defined(MOZ_CRASHREPORTER) && !defined(MOZ_B2G)
- if (PCrashReporterChild* c = LoneManagedOrNullAsserts(ManagedPCrashReporterChild())) {
- CrashReporterChild* crashReporter =
- static_cast<CrashReporterChild*>(c);
- nsDependentCString reason(aReason);
- crashReporter->SendAnnotateCrashReport(
- NS_LITERAL_CSTRING("ipc_channel_error"),
- reason);
- }
-#endif
NS_RUNTIMEABORT("Content child abort due to IPC error");
}
@@ -2872,10 +2841,6 @@ ContentChild::RecvShutdown()
// to wait for that event loop to finish. Otherwise we could prematurely
// terminate an "unload" or "pagehide" event handler (which might be doing a
// sync XHR, for example).
-#if defined(MOZ_CRASHREPORTER)
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCShutdownState"),
- NS_LITERAL_CSTRING("RecvShutdown"));
-#endif
nsCOMPtr<nsIThread> thread;
nsresult rv = NS_GetMainThread(getter_AddRefs(thread));
if (NS_SUCCEEDED(rv) && thread) {
@@ -2923,10 +2888,6 @@ ContentChild::RecvShutdown()
// parent closes.
StartForceKillTimer();
-#if defined(MOZ_CRASHREPORTER)
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCShutdownState"),
- NS_LITERAL_CSTRING("SendFinishShutdown"));
-#endif
// Ignore errors here. If this fails, the parent will kill us after a
// timeout.
Unused << SendFinishShutdown();
diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp
index ff40db8d7c..286f1d851e 100644
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -249,10 +249,6 @@ using namespace mozilla::system;
#include "mozilla/widget/AudioSession.h"
#endif
-#ifdef MOZ_CRASHREPORTER
-#include "nsThread.h"
-#endif
-
#ifdef ACCESSIBILITY
#include "nsAccessibilityService.h"
#endif
@@ -273,9 +269,6 @@ using base::KillProcess;
using mozilla::ProfileGatherer;
#endif
-#ifdef MOZ_CRASHREPORTER
-using namespace CrashReporter;
-#endif
using namespace mozilla::dom::power;
using namespace mozilla::media;
using namespace mozilla::embedding;
@@ -1847,36 +1840,6 @@ ContentParent::ActorDestroy(ActorDestroyReason why)
NS_LITERAL_CSTRING("content"), 1);
props->SetPropertyAsBool(NS_LITERAL_STRING("abnormal"), true);
-
-#ifdef MOZ_CRASHREPORTER
- // There's a window in which child processes can crash
- // after IPC is established, but before a crash reporter
- // is created.
- if (PCrashReporterParent* p = LoneManagedOrNullAsserts(ManagedPCrashReporterParent())) {
- CrashReporterParent* crashReporter =
- static_cast<CrashReporterParent*>(p);
-
- // If we're an app process, always stomp the latest URI
- // loaded in the child process with our manifest URL. We
- // would rather associate the crashes with apps than
- // random child windows loaded in them.
- //
- // XXX would be nice if we could get both ...
- if (!mAppManifestURL.IsEmpty()) {
- crashReporter->AnnotateCrashReport(NS_LITERAL_CSTRING("URL"),
- NS_ConvertUTF16toUTF8(mAppManifestURL));
- }
-
- // if mCreatedPairedMinidumps is true, we've already generated
- // parent/child dumps for dekstop crashes.
- if (!mCreatedPairedMinidumps) {
- crashReporter->GenerateCrashReport(this, nullptr);
- }
-
- nsAutoString dumpID(crashReporter->ChildDumpID());
- props->SetPropertyAsAString(NS_LITERAL_STRING("dumpID"), dumpID);
- }
-#endif
}
nsAutoString cpId;
cpId.AppendInt(static_cast<uint64_t>(this->ChildID()));
@@ -3090,33 +3053,6 @@ ContentParent::KillHard(const char* aReason)
mCalledKillHard = true;
mForceKillTimer = nullptr;
-#if defined(MOZ_CRASHREPORTER) && !defined(MOZ_B2G)
- // We're about to kill the child process associated with this content.
- // Something has gone wrong to get us here, so we generate a minidump
- // of the parent and child for submission to the crash server.
- if (PCrashReporterParent* p = LoneManagedOrNullAsserts(ManagedPCrashReporterParent())) {
- CrashReporterParent* crashReporter =
- static_cast<CrashReporterParent*>(p);
- // GeneratePairedMinidump creates two minidumps for us - the main
- // one is for the content process we're about to kill, and the other
- // one is for the main browser process. That second one is the extra
- // minidump tagging along, so we have to tell the crash reporter that
- // it exists and is being appended.
- nsAutoCString additionalDumps("browser");
- crashReporter->AnnotateCrashReport(
- NS_LITERAL_CSTRING("additional_minidumps"),
- additionalDumps);
- nsDependentCString reason(aReason);
- crashReporter->AnnotateCrashReport(
- NS_LITERAL_CSTRING("ipc_channel_error"),
- reason);
-
- // Generate the report and insert into the queue for submittal.
- mCreatedPairedMinidumps = crashReporter->GenerateCompleteMinidump(this);
-
- Telemetry::Accumulate(Telemetry::SUBPROCESS_KILL_HARD, reason, 1);
- }
-#endif
ProcessHandle otherProcessHandle;
if (!base::OpenProcessHandle(OtherPid(), &otherProcessHandle)) {
NS_ERROR("Failed to open child process when attempting kill.");
@@ -3168,11 +3104,7 @@ PCrashReporterParent*
ContentParent::AllocPCrashReporterParent(const NativeThreadId& tid,
const uint32_t& processType)
{
-#ifdef MOZ_CRASHREPORTER
- return new CrashReporterParent();
-#else
return nullptr;
-#endif
}
bool
@@ -3292,11 +3224,15 @@ PPrintingParent*
ContentParent::AllocPPrintingParent()
{
#ifdef NS_PRINTING
- MOZ_ASSERT(!mPrintingParent,
- "Only one PrintingParent should be created per process.");
+ MOZ_RELEASE_ASSERT(!mPrintingParent,
+ "Only one PrintingParent should be created per process.");
// Create the printing singleton for this process.
mPrintingParent = new PrintingParent();
+
+ // Take another reference for IPDL code.
+ mPrintingParent.get()->AddRef();
+
return mPrintingParent.get();
#else
MOZ_ASSERT_UNREACHABLE("Should never be created if no printing.");
@@ -3308,8 +3244,11 @@ bool
ContentParent::DeallocPPrintingParent(PPrintingParent* printing)
{
#ifdef NS_PRINTING
- MOZ_ASSERT(mPrintingParent == printing,
- "Only one PrintingParent should have been created per process.");
+ MOZ_RELEASE_ASSERT(mPrintingParent == printing,
+ "Only one PrintingParent should have been created per process.");
+
+ // Release reference taken for IPDL code.
+ static_cast<PrintingParent*>(printing)->Release();
mPrintingParent = nullptr;
#else
@@ -5001,9 +4940,6 @@ ContentParent::RecvNotifyPushSubscriptionModifiedObservers(const nsCString& aSco
bool
ContentParent::RecvNotifyLowMemory()
{
-#ifdef MOZ_CRASHREPORTER
- nsThread::SaveMemoryReportNearOOM(nsThread::ShouldSaveMemoryReport::kForceReport);
-#endif
return true;
}
diff --git a/dom/ipc/CrashReporterParent.cpp b/dom/ipc/CrashReporterParent.cpp
index fc627387fc..677b296702 100644
--- a/dom/ipc/CrashReporterParent.cpp
+++ b/dom/ipc/CrashReporterParent.cpp
@@ -13,13 +13,6 @@
#include "mozilla/Telemetry.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#include "nsICrashService.h"
-#include "mozilla/SyncRunnable.h"
-#include "nsThreadUtils.h"
-#endif
-
namespace mozilla {
namespace dom {
@@ -29,9 +22,6 @@ void
CrashReporterParent::AnnotateCrashReport(const nsCString& key,
const nsCString& data)
{
-#ifdef MOZ_CRASHREPORTER
- mNotes.Put(key, data);
-#endif
}
void
@@ -49,9 +39,6 @@ CrashReporterParent::RecvAppendAppNotes(const nsCString& data)
CrashReporterParent::CrashReporterParent()
:
-#ifdef MOZ_CRASHREPORTER
- mNotes(4),
-#endif
mStartTime(::time(nullptr))
, mInitialized(false)
{
@@ -72,75 +59,5 @@ CrashReporterParent::SetChildData(const NativeThreadId& tid,
mProcessType = GeckoProcessType(processType);
}
-#ifdef MOZ_CRASHREPORTER
-bool
-CrashReporterParent::GenerateCrashReportForMinidump(nsIFile* minidump,
- const AnnotationTable* processNotes)
-{
- if (!CrashReporter::GetIDFromMinidump(minidump, mChildDumpID)) {
- return false;
- }
-
- bool result = GenerateChildData(processNotes);
- FinalizeChildData();
- return result;
-}
-
-bool
-CrashReporterParent::GenerateChildData(const AnnotationTable* processNotes)
-{
- MOZ_ASSERT(mInitialized);
-
- if (mChildDumpID.IsEmpty()) {
- NS_WARNING("problem with GenerateChildData: no child dump id yet!");
- return false;
- }
-
- nsAutoCString type;
- switch (mProcessType) {
- case GeckoProcessType_Content:
- type = NS_LITERAL_CSTRING("content");
- break;
- case GeckoProcessType_Plugin:
- case GeckoProcessType_GMPlugin:
- type = NS_LITERAL_CSTRING("plugin");
- break;
- default:
- NS_ERROR("unknown process type");
- break;
- }
- mNotes.Put(NS_LITERAL_CSTRING("ProcessType"), type);
-
- char startTime[32];
- SprintfLiteral(startTime, "%lld", static_cast<long long>(mStartTime));
- mNotes.Put(NS_LITERAL_CSTRING("StartupTime"), nsDependentCString(startTime));
-
- if (!mAppNotes.IsEmpty()) {
- mNotes.Put(NS_LITERAL_CSTRING("Notes"), mAppNotes);
- }
-
- // Append these notes to the end of the extra file based on the current
- // dump id we obtained from CreatePairedMinidumps.
- bool ret = CrashReporter::AppendExtraData(mChildDumpID, mNotes);
- if (ret && processNotes) {
- ret = CrashReporter::AppendExtraData(mChildDumpID, *processNotes);
- }
-
- if (!ret) {
- NS_WARNING("problem appending child data to .extra");
- }
- return ret;
-}
-
-void
-CrashReporterParent::FinalizeChildData()
-{
- MOZ_ASSERT(mInitialized);
-
- CrashReporterHost::NotifyCrashService(mProcessType, mChildDumpID, &mNotes);
- mNotes.Clear();
-}
-#endif
-
} // namespace dom
} // namespace mozilla
diff --git a/dom/ipc/CrashReporterParent.h b/dom/ipc/CrashReporterParent.h
index 25824f2793..71896c5c1b 100644
--- a/dom/ipc/CrashReporterParent.h
+++ b/dom/ipc/CrashReporterParent.h
@@ -10,122 +10,16 @@
#include "mozilla/dom/PCrashReporterParent.h"
#include "mozilla/dom/TabMessageUtils.h"
#include "nsIFile.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#include "nsDataHashtable.h"
-#endif
namespace mozilla {
namespace dom {
class CrashReporterParent : public PCrashReporterParent
{
-#ifdef MOZ_CRASHREPORTER
- typedef CrashReporter::AnnotationTable AnnotationTable;
-#endif
public:
CrashReporterParent();
virtual ~CrashReporterParent();
-#ifdef MOZ_CRASHREPORTER
-
- /*
- * Attempt to create a bare-bones crash report, along with extra process-
- * specific annotations present in the given AnnotationTable. Calls
- * GenerateChildData and FinalizeChildData.
- *
- * @returns true if successful, false otherwise.
- */
- template<class Toplevel>
- bool
- GenerateCrashReport(Toplevel* t, const AnnotationTable* processNotes);
-
- /*
- * Attempt to generate a parent/child pair of minidumps from the given
- * toplevel actor. This calls CrashReporter::CreateMinidumpsAndPair to
- * generate the minidumps. Crash reporter annotations set prior to this
- * call will be saved via PairedDumpCallbackExtra into an .extra file
- * under the proper crash id. AnnotateCrashReport annotations are not
- * set in this call and the report is not finalized.
- *
- * @returns true if successful, false otherwise.
- */
- template<class Toplevel>
- bool
- GeneratePairedMinidump(Toplevel* t);
-
- /*
- * Attempts to take a minidump of the current process and pair that with
- * a named minidump handed in by the caller.
- *
- * @param aTopLevel - top level actor this reporter is associated with.
- * @param aMinidump - the minidump to associate with.
- * @param aPairName - the name of the additional minidump.
- * @returns true if successful, false otherwise.
- */
- template<class Toplevel>
- bool
- GenerateMinidumpAndPair(Toplevel* aTopLevel, nsIFile* aMinidump,
- const nsACString& aPairName);
-
- /**
- * Apply child process annotations to an existing paired mindump generated
- * with GeneratePairedMinidump.
- *
- * Be careful about calling generate apis immediately after this call,
- * see FinalizeChildData.
- *
- * @param processNotes (optional) - Additional notes to append. Annotations
- * stored in mNotes will also be applied. processNotes can be null.
- * @returns true if successful, false otherwise.
- */
- bool
- GenerateChildData(const AnnotationTable* processNotes);
-
- /**
- * Handles main thread finalization tasks after a report has been
- * generated. Does the following:
- * - register the finished report with the crash service manager
- * - records telemetry related data about crashes
- *
- * Be careful about calling generate apis immediately after this call,
- * if this api is called on a non-main thread it will fire off a runnable
- * to complete its work async.
- */
- void
- FinalizeChildData();
-
- /*
- * Attempt to generate a full paired dump complete with any child
- * annoations, and finalizes the report. Note this call is only valid
- * on the main thread. Calling on a background thread will fail.
- *
- * @returns true if successful, false otherwise.
- */
- template<class Toplevel>
- bool
- GenerateCompleteMinidump(Toplevel* t);
-
- /**
- * Submits a raw minidump handed in, calls GenerateChildData and
- * FinalizeChildData. Used by content plugins and gmp.
- *
- * @returns true if successful, false otherwise.
- */
- bool
- GenerateCrashReportForMinidump(nsIFile* minidump,
- const AnnotationTable* processNotes);
-
- /*
- * Instantiate a new crash reporter actor from a given parent that manages
- * the protocol.
- *
- * @returns true if successful, false otherwise.
- */
- template<class Toplevel>
- static bool CreateCrashReporter(Toplevel* actor);
-#endif // MOZ_CRASHREPORTER
-
/*
* Initialize this reporter with data from the child process.
*/
@@ -160,14 +54,6 @@ public:
virtual bool RecvAppendAppNotes(const nsCString& aData) override;
-#ifdef MOZ_CRASHREPORTER
- void
- NotifyCrashService();
-#endif
-
-#ifdef MOZ_CRASHREPORTER
- AnnotationTable mNotes;
-#endif
nsCString mAppNotes;
nsString mChildDumpID;
// stores the child main thread id
@@ -178,128 +64,6 @@ public:
bool mInitialized;
};
-#ifdef MOZ_CRASHREPORTER
-template<class Toplevel>
-inline bool
-CrashReporterParent::GeneratePairedMinidump(Toplevel* t)
-{
- mozilla::ipc::ScopedProcessHandle child;
-#ifdef XP_MACOSX
- child = t->Process()->GetChildTask();
-#else
- if (!base::OpenPrivilegedProcessHandle(t->OtherPid(), &child.rwget())) {
- NS_WARNING("Failed to open child process handle.");
- return false;
- }
-#endif
- nsCOMPtr<nsIFile> childDump;
- if (CrashReporter::CreateMinidumpsAndPair(child,
- mMainThread,
- NS_LITERAL_CSTRING("browser"),
- nullptr, // pair with a dump of this process and thread
- getter_AddRefs(childDump)) &&
- CrashReporter::GetIDFromMinidump(childDump, mChildDumpID)) {
- return true;
- }
- return false;
-}
-
-template<class Toplevel>
-inline bool
-CrashReporterParent::GenerateMinidumpAndPair(Toplevel* aTopLevel,
- nsIFile* aMinidumpToPair,
- const nsACString& aPairName)
-{
- mozilla::ipc::ScopedProcessHandle childHandle;
-#ifdef XP_MACOSX
- childHandle = aTopLevel->Process()->GetChildTask();
-#else
- if (!base::OpenPrivilegedProcessHandle(aTopLevel->OtherPid(),
- &childHandle.rwget())) {
- NS_WARNING("Failed to open child process handle.");
- return false;
- }
-#endif
- nsCOMPtr<nsIFile> targetDump;
- if (CrashReporter::CreateMinidumpsAndPair(childHandle,
- mMainThread, // child thread id
- aPairName,
- aMinidumpToPair,
- getter_AddRefs(targetDump)) &&
- CrashReporter::GetIDFromMinidump(targetDump, mChildDumpID)) {
- return true;
- }
- return false;
-}
-
-template<class Toplevel>
-inline bool
-CrashReporterParent::GenerateCrashReport(Toplevel* t,
- const AnnotationTable* processNotes)
-{
- nsCOMPtr<nsIFile> crashDump;
- if (t->TakeMinidump(getter_AddRefs(crashDump), nullptr) &&
- CrashReporter::GetIDFromMinidump(crashDump, mChildDumpID)) {
- bool result = GenerateChildData(processNotes);
- FinalizeChildData();
- return result;
- }
- return false;
-}
-
-template<class Toplevel>
-inline bool
-CrashReporterParent::GenerateCompleteMinidump(Toplevel* t)
-{
- mozilla::ipc::ScopedProcessHandle child;
- if (!NS_IsMainThread()) {
- NS_WARNING("GenerateCompleteMinidump can't be called on non-main thread.");
- return false;
- }
-
-#ifdef XP_MACOSX
- child = t->Process()->GetChildTask();
-#else
- if (!base::OpenPrivilegedProcessHandle(t->OtherPid(), &child.rwget())) {
- NS_WARNING("Failed to open child process handle.");
- return false;
- }
-#endif
- nsCOMPtr<nsIFile> childDump;
- if (CrashReporter::CreateMinidumpsAndPair(child,
- mMainThread,
- NS_LITERAL_CSTRING("browser"),
- nullptr, // pair with a dump of this process and thread
- getter_AddRefs(childDump)) &&
- CrashReporter::GetIDFromMinidump(childDump, mChildDumpID)) {
- bool result = GenerateChildData(nullptr);
- FinalizeChildData();
- return result;
- }
- return false;
-}
-
-template<class Toplevel>
-/* static */ bool
-CrashReporterParent::CreateCrashReporter(Toplevel* actor)
-{
-#ifdef MOZ_CRASHREPORTER
- NativeThreadId id;
- uint32_t processType;
- PCrashReporterParent* p =
- actor->CallPCrashReporterConstructor(&id, &processType);
- if (p) {
- static_cast<CrashReporterParent*>(p)->SetChildData(id, processType);
- } else {
- NS_ERROR("Error creating crash reporter actor");
- }
- return !!p;
-#endif
- return false;
-}
-
-#endif
-
} // namespace dom
} // namespace mozilla
diff --git a/dom/ipc/DatePickerParent.cpp b/dom/ipc/DatePickerParent.cpp
deleted file mode 100644
index 509944ddd9..0000000000
--- a/dom/ipc/DatePickerParent.cpp
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "DatePickerParent.h"
-#include "nsComponentManagerUtils.h"
-#include "nsIDocument.h"
-#include "nsIDOMWindow.h"
-#include "mozilla/Unused.h"
-#include "mozilla/dom/Element.h"
-#include "mozilla/dom/TabParent.h"
-
-using mozilla::Unused;
-using namespace mozilla::dom;
-
-NS_IMPL_ISUPPORTS(DatePickerParent::DatePickerShownCallback,
- nsIDatePickerShownCallback);
-
-NS_IMETHODIMP
-DatePickerParent::DatePickerShownCallback::Cancel()
-{
- if (mDatePickerParent) {
- Unused << mDatePickerParent->SendCancel();
- }
- return NS_OK;
-}
-
-NS_IMETHODIMP
-DatePickerParent::DatePickerShownCallback::Done(const nsAString& aDate)
-{
- if (mDatePickerParent) {
- Unused << mDatePickerParent->Send__delete__(mDatePickerParent,
- nsString(aDate));
- }
- return NS_OK;
-}
-
-void
-DatePickerParent::DatePickerShownCallback::Destroy()
-{
- mDatePickerParent = nullptr;
-}
-
-bool
-DatePickerParent::CreateDatePicker()
-{
- mPicker = do_CreateInstance("@mozilla.org/datepicker;1");
- if (!mPicker) {
- return false;
- }
-
- Element* ownerElement = TabParent::GetFrom(Manager())->GetOwnerElement();
- if (!ownerElement) {
- return false;
- }
-
- nsCOMPtr<mozIDOMWindowProxy> window = do_QueryInterface(ownerElement->OwnerDoc()->GetWindow());
- if (!window) {
- return false;
- }
-
- return NS_SUCCEEDED(mPicker->Init(window, mTitle, mInitialDate));
-}
-
-bool
-DatePickerParent::RecvOpen()
-{
- if (!CreateDatePicker()) {
- Unused << Send__delete__(this, mInitialDate);
- return true;
- }
-
- mCallback = new DatePickerShownCallback(this);
-
- mPicker->Open(mCallback);
- return true;
-};
-
-void
-DatePickerParent::ActorDestroy(ActorDestroyReason aWhy)
-{
- if (mCallback) {
- mCallback->Destroy();
- }
-}
diff --git a/dom/ipc/DatePickerParent.h b/dom/ipc/DatePickerParent.h
deleted file mode 100644
index 73b66f96c6..0000000000
--- a/dom/ipc/DatePickerParent.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef mozilla_dom_DatePickerParent_h
-#define mozilla_dom_DatePickerParent_h
-
-#include "mozilla/dom/PDatePickerParent.h"
-#include "nsIDatePicker.h"
-
-namespace mozilla {
-namespace dom {
-
-class DatePickerParent : public PDatePickerParent
-{
- public:
- DatePickerParent(const nsString& aTitle,
- const nsString& aInitialDate)
- : mTitle(aTitle)
- , mInitialDate(aInitialDate)
- {}
-
- virtual bool RecvOpen() override;
- virtual void ActorDestroy(ActorDestroyReason aWhy) override;
-
- class DatePickerShownCallback final
- : public nsIDatePickerShownCallback
- {
- public:
- explicit DatePickerShownCallback(DatePickerParent* aDatePickerParnet)
- : mDatePickerParent(aDatePickerParnet)
- {}
-
- NS_DECL_ISUPPORTS
- NS_DECL_NSIDATEPICKERSHOWNCALLBACK
-
- void Destroy();
-
- private:
- ~DatePickerShownCallback() {}
- DatePickerParent* mDatePickerParent;
- };
-
- private:
- virtual ~DatePickerParent() {}
-
- bool CreateDatePicker();
-
- RefPtr<DatePickerShownCallback> mCallback;
- nsCOMPtr<nsIDatePicker> mPicker;
-
- nsString mTitle;
- nsString mInitialDate;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_DatePickerParent_h
diff --git a/dom/ipc/PBrowser.ipdl b/dom/ipc/PBrowser.ipdl
index 249657c26a..f09e484ee4 100644
--- a/dom/ipc/PBrowser.ipdl
+++ b/dom/ipc/PBrowser.ipdl
@@ -9,9 +9,7 @@ include protocol PBlob;
include protocol PColorPicker;
include protocol PContent;
include protocol PContentBridge;
-include protocol PDatePicker;
include protocol PDocAccessible;
-include protocol PDocumentRenderer;
include protocol PFilePicker;
include protocol PIndexedDBPermissionRequest;
include protocol PRenderFrame;
@@ -117,9 +115,7 @@ nested(upto inside_cpow) sync protocol PBrowser
manager PContent or PContentBridge;
manages PColorPicker;
- manages PDatePicker;
manages PDocAccessible;
- manages PDocumentRenderer;
manages PFilePicker;
manages PIndexedDBPermissionRequest;
manages PRenderFrame;
@@ -443,12 +439,6 @@ parent:
*/
async PColorPicker(nsString title, nsString initialColor);
- /**
- * Create an asynchronous date picker on the parent side,
- * but don't open it yet.
- */
- async PDatePicker(nsString title, nsString initialDate);
-
async PFilePicker(nsString aTitle, int16_t aMode);
/**
@@ -739,24 +729,6 @@ child:
async LoadRemoteScript(nsString aURL, bool aRunInGlobalScope);
/**
- * Create a asynchronous request to render whatever document is
- * loaded in the child when this message arrives. When the
- * request finishes, PDocumentRenderer:__delete__ is sent back to
- * this side to notify completion.
- *
- * |documentRect| is the area of the remote document to draw,
- * transformed by |transform|. The rendered area will have the
- * default background color |bgcolor|. |renderFlags| are the
- * nsIPresShell::RenderDocument() flags to use on the remote side,
- * and if true, |flushLayout| will do just that before rendering
- * the document. The rendered image will be of size |renderSize|.
- */
- async PDocumentRenderer(nsRect documentRect, Matrix transform,
- nsString bgcolor,
- uint32_t renderFlags, bool flushLayout,
- IntSize renderSize);
-
- /**
* Sent by the chrome process when it no longer wants this remote
* <browser>. The child side cleans up in response, then
* finalizing its death by sending back __delete__() to the
diff --git a/dom/ipc/PDatePicker.ipdl b/dom/ipc/PDatePicker.ipdl
deleted file mode 100644
index 90a2654bb2..0000000000
--- a/dom/ipc/PDatePicker.ipdl
+++ /dev/null
@@ -1,27 +0,0 @@
-/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8 -*- */
-/* vim: set sw=4 ts=8 et tw=80 ft=cpp : */
-
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-include protocol PBrowser;
-
-namespace mozilla {
-namespace dom {
-
-protocol PDatePicker
-{
- manager PBrowser;
-
-parent:
- async Open();
-
-child:
- async Cancel();
-
- async __delete__(nsString color);
-};
-
-} // namespace dom
-} // namespace mozilla
diff --git a/dom/ipc/PDocumentRenderer.ipdl b/dom/ipc/PDocumentRenderer.ipdl
deleted file mode 100644
index bdaed45d74..0000000000
--- a/dom/ipc/PDocumentRenderer.ipdl
+++ /dev/null
@@ -1,25 +0,0 @@
-/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 8 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-include protocol PBrowser;
-
-include "mozilla/GfxMessageUtils.h";
-
-using nsIntSize from "nsSize.h";
-
-namespace mozilla {
-namespace ipc {
-
-protocol PDocumentRenderer
-{
- manager PBrowser;
-
-parent:
- // Returns the width and height, in pixels, of the returned ARGB32 data.
- async __delete__(nsIntSize renderedSize, nsCString data);
-};
-
-} // namespace ipc
-} // namespace mozilla
diff --git a/dom/ipc/ProcessHangMonitor.cpp b/dom/ipc/ProcessHangMonitor.cpp
index b574be61f2..d46a1f5d5e 100644
--- a/dom/ipc/ProcessHangMonitor.cpp
+++ b/dom/ipc/ProcessHangMonitor.cpp
@@ -27,9 +27,6 @@
#include "nsITabParent.h"
#include "nsPluginHost.h"
#include "nsThreadUtils.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
#include "base/task.h"
#include "base/thread.h"
@@ -556,16 +553,6 @@ HangMonitorParent::HangMonitorParent(ProcessHangMonitor* aMonitor)
HangMonitorParent::~HangMonitorParent()
{
-#ifdef MOZ_CRASHREPORTER
- MutexAutoLock lock(mBrowserCrashDumpHashLock);
-
- for (auto iter = mBrowserCrashDumpIds.Iter(); !iter.Done(); iter.Next()) {
- nsString crashId = iter.UserData();
- if (!crashId.IsEmpty()) {
- CrashReporter::DeleteMinidumpFilesForID(crashId);
- }
- }
-#endif
}
void
@@ -698,24 +685,6 @@ bool
HangMonitorParent::TakeBrowserMinidump(const PluginHangData& aPhd,
nsString& aCrashId)
{
-#ifdef MOZ_CRASHREPORTER
- MutexAutoLock lock(mBrowserCrashDumpHashLock);
- if (!mBrowserCrashDumpIds.Get(aPhd.pluginId(), &aCrashId)) {
- nsCOMPtr<nsIFile> browserDump;
- if (CrashReporter::TakeMinidump(getter_AddRefs(browserDump), true)) {
- if (!CrashReporter::GetIDFromMinidump(browserDump, aCrashId)
- || aCrashId.IsEmpty()) {
- browserDump->Remove(false);
- NS_WARNING("Failed to generate timely browser stack, "
- "this is bad for plugin hang analysis!");
- } else {
- mBrowserCrashDumpIds.Put(aPhd.pluginId(), aCrashId);
- return true;
- }
- }
- }
-#endif // MOZ_CRASHREPORTER
-
return false;
}
@@ -840,11 +809,6 @@ HangMonitorParent::CleanupPluginHang(uint32_t aPluginId, bool aRemoveFiles)
return;
}
mBrowserCrashDumpIds.Remove(aPluginId);
-#ifdef MOZ_CRASHREPORTER
- if (aRemoveFiles && !crashId.IsEmpty()) {
- CrashReporter::DeleteMinidumpFilesForID(crashId);
- }
-#endif
}
void
diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp
index eaf4a32edb..705799c549 100644
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -22,7 +22,6 @@
#include "mozilla/dom/indexedDB/PIndexedDBPermissionRequestChild.h"
#include "mozilla/plugins/PluginWidgetChild.h"
#include "mozilla/IMEStateManager.h"
-#include "mozilla/ipc/DocumentRendererChild.h"
#include "mozilla/ipc/URIUtils.h"
#include "mozilla/layers/APZChild.h"
#include "mozilla/layers/APZCCallbackHelper.h"
@@ -53,9 +52,6 @@
#include "nsEmbedCID.h"
#include "nsGlobalWindow.h"
#include <algorithm>
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
#include "nsFilePickerProxy.h"
#include "mozilla/dom/Element.h"
#include "nsGlobalWindow.h"
@@ -100,7 +96,6 @@
#include "LayersLogging.h"
#include "nsDOMClassInfoID.h"
#include "nsColorPickerProxy.h"
-#include "nsDatePickerProxy.h"
#include "nsContentPermissionHelper.h"
#include "nsPresShell.h"
#include "nsIAppsService.h"
@@ -1262,10 +1257,6 @@ TabChild::RecvLoadURL(const nsCString& aURI,
NS_WARNING("WebNavigation()->LoadURI failed. Eating exception, what else can I do?");
}
-#ifdef MOZ_CRASHREPORTER
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("URL"), aURI);
-#endif
-
return true;
}
@@ -2006,57 +1997,6 @@ TabChild::DeallocPDocAccessibleChild(a11y::PDocAccessibleChild* aChild)
return true;
}
-PDocumentRendererChild*
-TabChild::AllocPDocumentRendererChild(const nsRect& documentRect,
- const mozilla::gfx::Matrix& transform,
- const nsString& bgcolor,
- const uint32_t& renderFlags,
- const bool& flushLayout,
- const nsIntSize& renderSize)
-{
- return new DocumentRendererChild();
-}
-
-bool
-TabChild::DeallocPDocumentRendererChild(PDocumentRendererChild* actor)
-{
- delete actor;
- return true;
-}
-
-bool
-TabChild::RecvPDocumentRendererConstructor(PDocumentRendererChild* actor,
- const nsRect& documentRect,
- const mozilla::gfx::Matrix& transform,
- const nsString& bgcolor,
- const uint32_t& renderFlags,
- const bool& flushLayout,
- const nsIntSize& renderSize)
-{
- DocumentRendererChild *render = static_cast<DocumentRendererChild *>(actor);
-
- nsCOMPtr<nsIWebBrowser> browser = do_QueryInterface(WebNavigation());
- if (!browser)
- return true; // silently ignore
- nsCOMPtr<mozIDOMWindowProxy> window;
- if (NS_FAILED(browser->GetContentDOMWindow(getter_AddRefs(window))) ||
- !window)
- {
- return true; // silently ignore
- }
-
- nsCString data;
- bool ret = render->RenderDocument(nsPIDOMWindowOuter::From(window),
- documentRect, transform,
- bgcolor,
- renderFlags, flushLayout,
- renderSize, data);
- if (!ret)
- return true; // silently ignore
-
- return PDocumentRendererChild::Send__delete__(actor, renderSize, data);
-}
-
PColorPickerChild*
TabChild::AllocPColorPickerChild(const nsString&, const nsString&)
{
@@ -2072,21 +2012,6 @@ TabChild::DeallocPColorPickerChild(PColorPickerChild* aColorPicker)
return true;
}
-PDatePickerChild*
-TabChild::AllocPDatePickerChild(const nsString&, const nsString&)
-{
- NS_RUNTIMEABORT("unused");
- return nullptr;
-}
-
-bool
-TabChild::DeallocPDatePickerChild(PDatePickerChild* aDatePicker)
-{
- nsDatePickerProxy* picker = static_cast<nsDatePickerProxy*>(aDatePicker);
- NS_RELEASE(picker);
- return true;
-}
-
PFilePickerChild*
TabChild::AllocPFilePickerChild(const nsString&, const int16_t&)
{
diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h
index b23c7c19e0..d9988a5969 100644
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -445,37 +445,12 @@ public:
virtual bool DeallocPDocAccessibleChild(PDocAccessibleChild*) override;
- virtual PDocumentRendererChild*
- AllocPDocumentRendererChild(const nsRect& aDocumentRect,
- const gfx::Matrix& aTransform,
- const nsString& aBggcolor,
- const uint32_t& aRenderFlags,
- const bool& aFlushLayout,
- const nsIntSize& arenderSize) override;
-
- virtual bool
- DeallocPDocumentRendererChild(PDocumentRendererChild* aCctor) override;
-
- virtual bool
- RecvPDocumentRendererConstructor(PDocumentRendererChild* aActor,
- const nsRect& aDocumentRect,
- const gfx::Matrix& aTransform,
- const nsString& aBgcolor,
- const uint32_t& aRenderFlags,
- const bool& aFlushLayout,
- const nsIntSize& aRenderSize) override;
-
-
virtual PColorPickerChild*
AllocPColorPickerChild(const nsString& aTitle,
const nsString& aInitialColor) override;
virtual bool DeallocPColorPickerChild(PColorPickerChild* aActor) override;
- virtual PDatePickerChild*
- AllocPDatePickerChild(const nsString& title, const nsString& initialDate) override;
- virtual bool DeallocPDatePickerChild(PDatePickerChild* actor) override;
-
virtual PFilePickerChild*
AllocPFilePickerChild(const nsString& aTitle, const int16_t& aMode) override;
diff --git a/dom/ipc/TabMessageUtils.h b/dom/ipc/TabMessageUtils.h
index cdb76099da..2933173d7d 100644
--- a/dom/ipc/TabMessageUtils.h
+++ b/dom/ipc/TabMessageUtils.h
@@ -13,10 +13,6 @@
#include "nsPIDOMWindow.h"
#include "nsCOMPtr.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
-
namespace mozilla {
namespace dom {
struct RemoteDOMEvent
@@ -28,12 +24,8 @@ struct RemoteDOMEvent
bool ReadRemoteEvent(const IPC::Message* aMsg, PickleIterator* aIter,
mozilla::dom::RemoteDOMEvent* aResult);
-#ifdef MOZ_CRASHREPORTER
-typedef CrashReporter::ThreadId NativeThreadId;
-#else
// unused in this case
typedef int32_t NativeThreadId;
-#endif
} // namespace dom
} // namespace mozilla
diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp
index 0df4c12532..0f190708f6 100644
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -28,7 +28,6 @@
#include "mozilla/gfx/GPUProcessManager.h"
#include "mozilla/Hal.h"
#include "mozilla/IMEStateManager.h"
-#include "mozilla/ipc/DocumentRendererParent.h"
#include "mozilla/jsipc/CrossProcessObjectWrappers.h"
#include "mozilla/layers/AsyncDragMetrics.h"
#include "mozilla/layers/InputAPZContext.h"
@@ -81,7 +80,6 @@
#include "PermissionMessageUtils.h"
#include "StructuredCloneData.h"
#include "ColorPickerParent.h"
-#include "DatePickerParent.h"
#include "FilePickerParent.h"
#include "TabChild.h"
#include "LoadContext.h"
@@ -957,24 +955,6 @@ TabParent::GetTopLevelDocAccessible() const
return nullptr;
}
-PDocumentRendererParent*
-TabParent::AllocPDocumentRendererParent(const nsRect& documentRect,
- const gfx::Matrix& transform,
- const nsString& bgcolor,
- const uint32_t& renderFlags,
- const bool& flushLayout,
- const nsIntSize& renderSize)
-{
- return new DocumentRendererParent();
-}
-
-bool
-TabParent::DeallocPDocumentRendererParent(PDocumentRendererParent* actor)
-{
- delete actor;
- return true;
-}
-
PFilePickerParent*
TabParent::AllocPFilePickerParent(const nsString& aTitle, const int16_t& aMode)
{
@@ -2443,20 +2423,6 @@ TabParent::DeallocPColorPickerParent(PColorPickerParent* actor)
return true;
}
-PDatePickerParent*
-TabParent::AllocPDatePickerParent(const nsString& aTitle,
- const nsString& aInitialDate)
-{
- return new DatePickerParent(aTitle, aInitialDate);
-}
-
-bool
-TabParent::DeallocPDatePickerParent(PDatePickerParent* actor)
-{
- delete actor;
- return true;
-}
-
PRenderFrameParent*
TabParent::AllocPRenderFrameParent()
{
diff --git a/dom/ipc/TabParent.h b/dom/ipc/TabParent.h
index 43afb05388..3624ce3207 100644
--- a/dom/ipc/TabParent.h
+++ b/dom/ipc/TabParent.h
@@ -347,10 +347,6 @@ public:
virtual bool
DeallocPColorPickerParent(PColorPickerParent* aColorPicker) override;
- virtual PDatePickerParent*
- AllocPDatePickerParent(const nsString& aTitle, const nsString& aInitialDate) override;
- virtual bool DeallocPDatePickerParent(PDatePickerParent* aDatePicker) override;
-
virtual PDocAccessibleParent*
AllocPDocAccessibleParent(PDocAccessibleParent*, const uint64_t&,
const uint32_t&, const IAccessibleHolder&) override;
@@ -473,17 +469,6 @@ public:
const ScrollableLayerGuid& aGuid,
uint64_t aInputBlockId);
- virtual PDocumentRendererParent*
- AllocPDocumentRendererParent(const nsRect& documentRect,
- const gfx::Matrix& transform,
- const nsString& bgcolor,
- const uint32_t& renderFlags,
- const bool& flushLayout,
- const nsIntSize& renderSize) override;
-
- virtual bool
- DeallocPDocumentRendererParent(PDocumentRendererParent* actor) override;
-
virtual PFilePickerParent*
AllocPFilePickerParent(const nsString& aTitle,
const int16_t& aMode) override;
diff --git a/dom/ipc/moz.build b/dom/ipc/moz.build
index 153bd3aae8..71d193d44a 100644
--- a/dom/ipc/moz.build
+++ b/dom/ipc/moz.build
@@ -55,7 +55,6 @@ UNIFIED_SOURCES += [
'ContentProcess.cpp',
'ContentProcessManager.cpp',
'CrashReporterParent.cpp',
- 'DatePickerParent.cpp',
'FilePickerParent.cpp',
'nsIContentChild.cpp',
'nsIContentParent.cpp',
@@ -95,8 +94,6 @@ IPDL_SOURCES += [
'PContentPermissionRequest.ipdl',
'PCrashReporter.ipdl',
'PCycleCollectWithLogs.ipdl',
- 'PDatePicker.ipdl',
- 'PDocumentRenderer.ipdl',
'PFilePicker.ipdl',
'PMemoryReportRequest.ipdl',
'PPluginWidget.ipdl',
diff --git a/dom/locales/en-US/chrome/layout/HtmlForm.properties b/dom/locales/en-US/chrome/layout/HtmlForm.properties
index 621a0b2b3c..82274b2bcd 100644
--- a/dom/locales/en-US/chrome/layout/HtmlForm.properties
+++ b/dom/locales/en-US/chrome/layout/HtmlForm.properties
@@ -34,7 +34,6 @@ NoDirSelected=No directory selected.
# %S will be a number greater or equal to 2.
XFilesSelected=%S files selected.
ColorPicker=Choose a color
-DatePicker=Choose a date
# LOCALIZATION NOTE (AndNMoreFiles): Semi-colon list of plural forms.
# See: http://developer.mozilla.org/en/docs/Localization_and_Plurals
# This string is shown at the end of the tooltip text for <input type='file'
diff --git a/dom/locales/en-US/chrome/plugins.properties b/dom/locales/en-US/chrome/plugins.properties
index ee8d25c886..fe03be59e9 100644
--- a/dom/locales/en-US/chrome/plugins.properties
+++ b/dom/locales/en-US/chrome/plugins.properties
@@ -21,9 +21,6 @@ description_label=Description
suffixes_label=Suffixes
learn_more_label=Learn More
-deprecation_description=Missing something? Some plugins are no longer supported.
-deprecation_learn_more=Learn More.
-
# GMP Plugins
gmp_license_info=License information
gmp_privacy_info=Privacy Information
diff --git a/dom/locales/en-US/chrome/security/security.properties b/dom/locales/en-US/chrome/security/security.properties
index 8b66cc265e..c0b80996cc 100644
--- a/dom/locales/en-US/chrome/security/security.properties
+++ b/dom/locales/en-US/chrome/security/security.properties
@@ -81,3 +81,6 @@ MimeTypeMismatch=The resource from “%1$S” was blocked due to MIME type misma
XCTOHeaderValueMissing=X-Content-Type-Options header warning: value was “%1$S”; did you mean to send “nosniff”?
BlockScriptWithWrongMimeType=Script from “%1$S” was blocked because of a disallowed MIME type.
+
+# LOCALIZATION NOTE: Do not translate "data: URI".
+BlockTopLevelDataURINavigation=Navigation to toplevel data: URI not allowed (Blocked loading of: “%1$S”)
diff --git a/dom/media/AudioConverter.cpp b/dom/media/AudioConverter.cpp
index 77ad46ec6a..25b981f438 100644
--- a/dom/media/AudioConverter.cpp
+++ b/dom/media/AudioConverter.cpp
@@ -362,15 +362,13 @@ size_t
AudioConverter::ResampleRecipientFrames(size_t aFrames) const
{
if (!aFrames && mIn.Rate() != mOut.Rate()) {
- // The resampler will be drained, account for frames currently buffered
- // in the resampler.
if (!mResampler) {
return 0;
}
- return speex_resampler_get_output_latency(mResampler);
- } else {
- return (uint64_t)aFrames * mOut.Rate() / mIn.Rate() + 1;
+ // We drain by pushing in get_input_latency() samples of 0
+ aFrames = speex_resampler_get_input_latency(mResampler);
}
+ return (uint64_t)aFrames * mOut.Rate() / mIn.Rate() + 1;
}
size_t
diff --git a/dom/media/Benchmark.cpp b/dom/media/Benchmark.cpp
index 1ba6e561cc..fdbedeca5e 100644
--- a/dom/media/Benchmark.cpp
+++ b/dom/media/Benchmark.cpp
@@ -22,7 +22,7 @@ namespace mozilla {
// Update this version number to force re-running the benchmark. Such as when
// an improvement to FFVP9 or LIBVPX is deemed worthwhile.
-const uint32_t VP9Benchmark::sBenchmarkVersionID = 2;
+const uint32_t VP9Benchmark::sBenchmarkVersionID = 3;
const char* VP9Benchmark::sBenchmarkFpsPref = "media.benchmark.vp9.fps";
const char* VP9Benchmark::sBenchmarkFpsVersionCheck = "media.benchmark.vp9.versioncheck";
diff --git a/dom/media/DOMMediaStream.cpp b/dom/media/DOMMediaStream.cpp
index 6794ee32f2..c1d451035e 100644..100755
--- a/dom/media/DOMMediaStream.cpp
+++ b/dom/media/DOMMediaStream.cpp
@@ -9,6 +9,7 @@
#include "nsIScriptError.h"
#include "nsIUUIDGenerator.h"
#include "nsPIDOMWindow.h"
+#include "mozilla/TimerClamping.h"
#include "mozilla/dom/MediaStreamBinding.h"
#include "mozilla/dom/MediaStreamTrackEvent.h"
#include "mozilla/dom/LocalMediaStreamBinding.h"
@@ -544,8 +545,8 @@ DOMMediaStream::CurrentTime()
if (!mPlaybackStream) {
return 0.0;
}
- return mPlaybackStream->
- StreamTimeToSeconds(mPlaybackStream->GetCurrentTime() - mLogicalStreamStartTime);
+ return TimerClamping::ReduceSTimeValue(mPlaybackStream->
+ StreamTimeToSeconds(mPlaybackStream->GetCurrentTime() - mLogicalStreamStartTime));
}
void
diff --git a/dom/media/GraphDriver.cpp b/dom/media/GraphDriver.cpp
index 9b74bd58c9..40e3b72cfd 100644
--- a/dom/media/GraphDriver.cpp
+++ b/dom/media/GraphDriver.cpp
@@ -1055,6 +1055,7 @@ AudioCallbackDriver::StateCallback(cubeb_state aState)
{
STREAM_LOG(LogLevel::Debug, ("AudioCallbackDriver State: %d", aState));
if (aState == CUBEB_STATE_ERROR && mShouldFallbackIfError) {
+ mShouldFallbackIfError = false;
MonitorAutoLock lock(GraphImpl()->GetMonitor());
// Fall back to a driver using a normal thread. If needed,
// the graph will try to re-open an audio stream later.
diff --git a/dom/media/MediaData.cpp b/dom/media/MediaData.cpp
index 0439a7473b..4a52c22ae6 100644
--- a/dom/media/MediaData.cpp
+++ b/dom/media/MediaData.cpp
@@ -90,7 +90,7 @@ ValidatePlane(const VideoData::YCbCrBuffer::Plane& aPlane)
return aPlane.mWidth <= PlanarYCbCrImage::MAX_DIMENSION &&
aPlane.mHeight <= PlanarYCbCrImage::MAX_DIMENSION &&
aPlane.mWidth * aPlane.mHeight < MAX_VIDEO_WIDTH * MAX_VIDEO_HEIGHT &&
- aPlane.mStride > 0;
+ aPlane.mStride > 0 && aPlane.mWidth <= aPlane.mStride;
}
#ifdef MOZ_WIDGET_GONK
diff --git a/dom/media/MediaStreamGraph.cpp b/dom/media/MediaStreamGraph.cpp
index 94cafa0298..e2934cbb26 100644
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -1715,6 +1715,10 @@ MediaStreamGraphImpl::RunInStableState(bool aSourceIsMSG)
RefPtr<GraphDriver> driver = CurrentDriver();
MonitorAutoUnlock unlock(mMonitor);
driver->Start();
+ // It's not safe to Shutdown() a thread from StableState, and
+ // releasing this may shutdown a SystemClockDriver thread.
+ // Proxy the release to outside of StableState.
+ NS_ReleaseOnMainThread(driver.forget(), true); // always proxy
}
}
diff --git a/dom/media/MediaStreamTrack.cpp b/dom/media/MediaStreamTrack.cpp
index 8ccdeb90ce..75cdeb1d16 100644
--- a/dom/media/MediaStreamTrack.cpp
+++ b/dom/media/MediaStreamTrack.cpp
@@ -165,11 +165,15 @@ MediaStreamTrack::Destroy()
mPrincipalHandleListener->Forget();
mPrincipalHandleListener = nullptr;
}
- for (auto l : mTrackListeners) {
- RemoveListener(l);
+ // Remove all listeners -- avoid iterating over the list we're removing from
+ const nsTArray<RefPtr<MediaStreamTrackListener>> trackListeners(mTrackListeners);
+ for (auto listener : trackListeners) {
+ RemoveListener(listener);
}
- for (auto l : mDirectTrackListeners) {
- RemoveDirectListener(l);
+ // Do the same as above for direct listeners
+ const nsTArray<RefPtr<DirectMediaStreamTrackListener>> directTrackListeners(mDirectTrackListeners);
+ for (auto listener : directTrackListeners) {
+ RemoveDirectListener(listener);
}
}
diff --git a/dom/media/gmp/GMPChild.cpp b/dom/media/gmp/GMPChild.cpp
index 953dae3c6f..f8e75e2990 100644
--- a/dom/media/gmp/GMPChild.cpp
+++ b/dom/media/gmp/GMPChild.cpp
@@ -257,10 +257,6 @@ GMPChild::Init(const nsAString& aPluginPath,
return false;
}
-#ifdef MOZ_CRASHREPORTER
- SendPCrashReporterConstructor(CrashReporter::CurrentThreadId());
-#endif
-
mPluginPath = aPluginPath;
mSandboxVoucherPath = aVoucherPath;
diff --git a/dom/media/gmp/GMPParent.cpp b/dom/media/gmp/GMPParent.cpp
index 75468ea9af..00bc977772 100644
--- a/dom/media/gmp/GMPParent.cpp
+++ b/dom/media/gmp/GMPParent.cpp
@@ -29,12 +29,6 @@
using mozilla::dom::CrashReporterParent;
using mozilla::ipc::GeckoChildProcessHost;
-#ifdef MOZ_CRASHREPORTER
-#include "nsPrintfCString.h"
-using CrashReporter::AnnotationTable;
-using CrashReporter::GetIDFromMinidump;
-#endif
-
#include "mozilla/Telemetry.h"
#ifdef XP_WIN
@@ -224,10 +218,6 @@ GMPParent::AbortWaitingForGMPAsyncShutdown(nsITimer* aTimer, void* aClosure)
NS_WARNING("Timed out waiting for GMP async shutdown!");
GMPParent* parent = reinterpret_cast<GMPParent*>(aClosure);
MOZ_ASSERT(parent->mService);
-#if defined(MOZ_CRASHREPORTER)
- parent->mService->SetAsyncShutdownPluginState(parent, 'G',
- NS_LITERAL_CSTRING("Timed out waiting for async shutdown"));
-#endif
parent->mService->AsyncShutdownComplete(parent);
}
@@ -270,22 +260,8 @@ GMPParent::RecvPGMPContentChildDestroyed()
{
--mGMPContentChildCount;
if (!IsUsed()) {
-#if defined(MOZ_CRASHREPORTER)
- if (mService) {
- mService->SetAsyncShutdownPluginState(this, 'E',
- NS_LITERAL_CSTRING("Last content child destroyed"));
- }
-#endif
CloseIfUnused();
}
-#if defined(MOZ_CRASHREPORTER)
- else {
- if (mService) {
- mService->SetAsyncShutdownPluginState(this, 'F',
- nsPrintfCString("Content child destroyed, remaining: %u", mGMPContentChildCount));
- }
- }
-#endif
return true;
}
@@ -307,38 +283,14 @@ GMPParent::CloseIfUnused()
if (mAsyncShutdownRequired) {
if (!mAsyncShutdownInProgress) {
LOGD("%s: sending async shutdown notification", __FUNCTION__);
-#if defined(MOZ_CRASHREPORTER)
- if (mService) {
- mService->SetAsyncShutdownPluginState(this, 'H',
- NS_LITERAL_CSTRING("Sent BeginAsyncShutdown"));
- }
-#endif
mAsyncShutdownInProgress = true;
if (!SendBeginAsyncShutdown()) {
-#if defined(MOZ_CRASHREPORTER)
- if (mService) {
- mService->SetAsyncShutdownPluginState(this, 'I',
- NS_LITERAL_CSTRING("Could not send BeginAsyncShutdown - Aborting async shutdown"));
- }
-#endif
AbortAsyncShutdown();
} else if (NS_FAILED(EnsureAsyncShutdownTimeoutSet())) {
-#if defined(MOZ_CRASHREPORTER)
- if (mService) {
- mService->SetAsyncShutdownPluginState(this, 'J',
- NS_LITERAL_CSTRING("Could not start timer after sending BeginAsyncShutdown - Aborting async shutdown"));
- }
-#endif
AbortAsyncShutdown();
}
}
} else {
-#if defined(MOZ_CRASHREPORTER)
- if (mService) {
- mService->SetAsyncShutdownPluginState(this, 'K',
- NS_LITERAL_CSTRING("No (more) async-shutdown required"));
- }
-#endif
// No async-shutdown, kill async-shutdown timer started in CloseActive().
AbortAsyncShutdown();
// Any async shutdown must be complete. Shutdown GMPStorage.
@@ -385,29 +337,11 @@ GMPParent::CloseActive(bool aDieWhenUnloaded)
mState = GMPStateUnloading;
}
if (mState != GMPStateNotLoaded && IsUsed()) {
-#if defined(MOZ_CRASHREPORTER)
- if (mService) {
- mService->SetAsyncShutdownPluginState(this, 'A',
- nsPrintfCString("Sent CloseActive, content children to close: %u", mGMPContentChildCount));
- }
-#endif
if (!SendCloseActive()) {
-#if defined(MOZ_CRASHREPORTER)
- if (mService) {
- mService->SetAsyncShutdownPluginState(this, 'B',
- NS_LITERAL_CSTRING("Could not send CloseActive - Aborting async shutdown"));
- }
-#endif
AbortAsyncShutdown();
} else if (IsUsed()) {
// We're expecting RecvPGMPContentChildDestroyed's -> Start async-shutdown timer now if needed.
if (mAsyncShutdownRequired && NS_FAILED(EnsureAsyncShutdownTimeoutSet())) {
-#if defined(MOZ_CRASHREPORTER)
- if (mService) {
- mService->SetAsyncShutdownPluginState(this, 'C',
- NS_LITERAL_CSTRING("Could not start timer after sending CloseActive - Aborting async shutdown"));
- }
-#endif
AbortAsyncShutdown();
}
} else {
@@ -418,12 +352,6 @@ GMPParent::CloseActive(bool aDieWhenUnloaded)
// that time, it might not have proceeded with shutdown; And calling it
// again after shutdown is fine because after the first one we'll be in
// GMPStateNotLoaded.
-#if defined(MOZ_CRASHREPORTER)
- if (mService) {
- mService->SetAsyncShutdownPluginState(this, 'D',
- NS_LITERAL_CSTRING("Content children already destroyed"));
- }
-#endif
CloseIfUnused();
}
}
@@ -630,78 +558,10 @@ GMPParent::EnsureProcessLoaded()
return NS_SUCCEEDED(rv);
}
-#ifdef MOZ_CRASHREPORTER
-void
-GMPParent::WriteExtraDataForMinidump(CrashReporter::AnnotationTable& notes)
-{
- notes.Put(NS_LITERAL_CSTRING("GMPPlugin"), NS_LITERAL_CSTRING("1"));
- notes.Put(NS_LITERAL_CSTRING("PluginFilename"),
- NS_ConvertUTF16toUTF8(mName));
- notes.Put(NS_LITERAL_CSTRING("PluginName"), mDisplayName);
- notes.Put(NS_LITERAL_CSTRING("PluginVersion"), mVersion);
-}
-
-void
-GMPParent::GetCrashID(nsString& aResult)
-{
- CrashReporterParent* cr =
- static_cast<CrashReporterParent*>(LoneManagedOrNullAsserts(ManagedPCrashReporterParent()));
- if (NS_WARN_IF(!cr)) {
- return;
- }
-
- AnnotationTable notes(4);
- WriteExtraDataForMinidump(notes);
- nsCOMPtr<nsIFile> dumpFile;
- TakeMinidump(getter_AddRefs(dumpFile), nullptr);
- if (!dumpFile) {
- NS_WARNING("GMP crash without crash report");
- aResult = mName;
- aResult += '-';
- AppendUTF8toUTF16(mVersion, aResult);
- return;
- }
- GetIDFromMinidump(dumpFile, aResult);
- cr->GenerateCrashReportForMinidump(dumpFile, &notes);
-}
-
-static void
-GMPNotifyObservers(const uint32_t aPluginID, const nsACString& aPluginName, const nsAString& aPluginDumpID)
-{
- nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
- nsCOMPtr<nsIWritablePropertyBag2> propbag =
- do_CreateInstance("@mozilla.org/hash-property-bag;1");
- if (obs && propbag) {
- propbag->SetPropertyAsUint32(NS_LITERAL_STRING("pluginID"), aPluginID);
- propbag->SetPropertyAsACString(NS_LITERAL_STRING("pluginName"), aPluginName);
- propbag->SetPropertyAsAString(NS_LITERAL_STRING("pluginDumpID"), aPluginDumpID);
- obs->NotifyObservers(propbag, "gmp-plugin-crash", nullptr);
- }
-
- RefPtr<gmp::GeckoMediaPluginService> service =
- gmp::GeckoMediaPluginService::GetGeckoMediaPluginService();
- if (service) {
- service->RunPluginCrashCallbacks(aPluginID, aPluginName);
- }
-}
-#endif
void
GMPParent::ActorDestroy(ActorDestroyReason aWhy)
{
LOGD("%s: (%d)", __FUNCTION__, (int)aWhy);
-#ifdef MOZ_CRASHREPORTER
- if (AbnormalShutdown == aWhy) {
- Telemetry::Accumulate(Telemetry::SUBPROCESS_ABNORMAL_ABORT,
- NS_LITERAL_CSTRING("gmplugin"), 1);
- nsString dumpID;
- GetCrashID(dumpID);
-
- // NotifyObservers is mainthread-only
- NS_DispatchToMainThread(WrapRunnableNM(&GMPNotifyObservers,
- mPluginId, mDisplayName, dumpID),
- NS_DISPATCH_NORMAL);
- }
-#endif
// warn us off trying to close again
mState = GMPStateClosing;
mAbnormalShutdownInProgress = true;
@@ -711,12 +571,6 @@ GMPParent::ActorDestroy(ActorDestroyReason aWhy)
if (AbnormalShutdown == aWhy) {
RefPtr<GMPParent> self(this);
if (mAsyncShutdownRequired) {
-#if defined(MOZ_CRASHREPORTER)
- if (mService) {
- mService->SetAsyncShutdownPluginState(this, 'M',
- NS_LITERAL_CSTRING("Actor destroyed"));
- }
-#endif
mService->AsyncShutdownComplete(this);
mAsyncShutdownRequired = false;
}
@@ -732,9 +586,7 @@ GMPParent::ActorDestroy(ActorDestroyReason aWhy)
mozilla::dom::PCrashReporterParent*
GMPParent::AllocPCrashReporterParent(const NativeThreadId& aThread)
{
-#ifndef MOZ_CRASHREPORTER
MOZ_ASSERT(false, "Should only be sent if crash reporting is enabled.");
-#endif
CrashReporterParent* cr = new CrashReporterParent();
cr->SetChildData(aThread, GeckoProcessType_GMPlugin);
return cr;
@@ -1043,12 +895,6 @@ GMPParent::RecvAsyncShutdownComplete()
LOGD("%s", __FUNCTION__);
MOZ_ASSERT(mAsyncShutdownRequired);
-#if defined(MOZ_CRASHREPORTER)
- if (mService) {
- mService->SetAsyncShutdownPluginState(this, 'L',
- NS_LITERAL_CSTRING("Received AsyncShutdownComplete"));
- }
-#endif
AbortAsyncShutdown();
return true;
}
diff --git a/dom/media/gmp/GMPParent.h b/dom/media/gmp/GMPParent.h
index 91a6fb429e..4f91ec5ba6 100644
--- a/dom/media/gmp/GMPParent.h
+++ b/dom/media/gmp/GMPParent.h
@@ -25,17 +25,6 @@
class nsIThread;
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-
-namespace mozilla {
-namespace dom {
-class PCrashReporterParent;
-class CrashReporterParent;
-}
-}
-#endif
-
namespace mozilla {
namespace gmp {
@@ -177,10 +166,6 @@ private:
RefPtr<GenericPromise> ReadGMPInfoFile(nsIFile* aFile);
RefPtr<GenericPromise> ParseChromiumManifest(nsString aJSON); // Main thread.
RefPtr<GenericPromise> ReadChromiumManifestFile(nsIFile* aFile); // GMP thread.
-#ifdef MOZ_CRASHREPORTER
- void WriteExtraDataForMinidump(CrashReporter::AnnotationTable& notes);
- void GetCrashID(nsString& aResult);
-#endif
void ActorDestroy(ActorDestroyReason aWhy) override;
PCrashReporterParent* AllocPCrashReporterParent(const NativeThreadId& aThread) override;
diff --git a/dom/media/gmp/GMPServiceParent.cpp b/dom/media/gmp/GMPServiceParent.cpp
index 8741989e3e..f25c36811e 100644
--- a/dom/media/gmp/GMPServiceParent.cpp
+++ b/dom/media/gmp/GMPServiceParent.cpp
@@ -36,10 +36,6 @@
#include "nsHashKeys.h"
#include "nsIFile.h"
#include "nsISimpleEnumerator.h"
-#if defined(MOZ_CRASHREPORTER)
-#include "nsExceptionHandler.h"
-#include "nsPrintfCString.h"
-#endif
#include "nsIXULRuntime.h"
#include "GMPDecoderModule.h"
#include <limits>
@@ -88,9 +84,6 @@ NS_IMPL_ISUPPORTS_INHERITED(GeckoMediaPluginServiceParent,
GeckoMediaPluginServiceParent::GeckoMediaPluginServiceParent()
: mShuttingDown(false)
-#ifdef MOZ_CRASHREPORTER
- , mAsyncShutdownPluginStatesMutex("GeckoMediaPluginService::mAsyncShutdownPluginStatesMutex")
-#endif
, mScannedPluginOnDisk(false)
, mWaitingForPluginsSyncShutdown(false)
, mInitPromiseMonitor("GeckoMediaPluginServiceParent::mInitPromiseMonitor")
@@ -421,28 +414,16 @@ GeckoMediaPluginServiceParent::Observe(nsISupports* aSubject,
if (gmpThread) {
LOGD(("%s::%s Starting to unload plugins, waiting for first sync shutdown..."
, __CLASS__, __FUNCTION__));
-#ifdef MOZ_CRASHREPORTER
- SetAsyncShutdownPluginState(nullptr, '0',
- NS_LITERAL_CSTRING("Dispatching UnloadPlugins"));
-#endif
gmpThread->Dispatch(
NewRunnableMethod(this,
&GeckoMediaPluginServiceParent::UnloadPlugins),
NS_DISPATCH_NORMAL);
-#ifdef MOZ_CRASHREPORTER
- SetAsyncShutdownPluginState(nullptr, '1',
- NS_LITERAL_CSTRING("Waiting for sync shutdown"));
-#endif
// Wait for UnloadPlugins() to do initial sync shutdown...
while (mWaitingForPluginsSyncShutdown) {
NS_ProcessNextEvent(NS_GetCurrentThread(), true);
}
-#ifdef MOZ_CRASHREPORTER
- SetAsyncShutdownPluginState(nullptr, '4',
- NS_LITERAL_CSTRING("Waiting for async shutdown"));
-#endif
// Wait for other plugins (if any) to do async shutdown...
auto syncShutdownPluginsRemaining =
std::numeric_limits<decltype(mAsyncShutdownPlugins.Length())>::max();
@@ -452,10 +433,6 @@ GeckoMediaPluginServiceParent::Observe(nsISupports* aSubject,
if (mAsyncShutdownPlugins.IsEmpty()) {
LOGD(("%s::%s Finished unloading all plugins"
, __CLASS__, __FUNCTION__));
-#if defined(MOZ_CRASHREPORTER)
- CrashReporter::RemoveCrashReportAnnotation(
- NS_LITERAL_CSTRING("AsyncPluginShutdown"));
-#endif
break;
} else if (mAsyncShutdownPlugins.Length() < syncShutdownPluginsRemaining) {
// First time here, or number of pending plugins has decreased.
@@ -463,24 +440,10 @@ GeckoMediaPluginServiceParent::Observe(nsISupports* aSubject,
syncShutdownPluginsRemaining = mAsyncShutdownPlugins.Length();
LOGD(("%s::%s Still waiting for %d plugins to shutdown..."
, __CLASS__, __FUNCTION__, (int)syncShutdownPluginsRemaining));
-#if defined(MOZ_CRASHREPORTER)
- nsAutoCString names;
- for (const auto& plugin : mAsyncShutdownPlugins) {
- if (!names.IsEmpty()) { names.Append(NS_LITERAL_CSTRING(", ")); }
- names.Append(plugin->GetDisplayName());
- }
- CrashReporter::AnnotateCrashReport(
- NS_LITERAL_CSTRING("AsyncPluginShutdown"),
- names);
-#endif
}
}
NS_ProcessNextEvent(NS_GetCurrentThread(), true);
}
-#ifdef MOZ_CRASHREPORTER
- SetAsyncShutdownPluginState(nullptr, '5',
- NS_LITERAL_CSTRING("Async shutdown complete"));
-#endif
} else {
// GMP thread has already shutdown.
MOZ_ASSERT(mPlugins.IsEmpty());
@@ -627,66 +590,6 @@ GeckoMediaPluginServiceParent::AsyncShutdownComplete(GMPParent* aParent)
}
}
-#ifdef MOZ_CRASHREPORTER
-void
-GeckoMediaPluginServiceParent::SetAsyncShutdownPluginState(GMPParent* aGMPParent,
- char aId,
- const nsCString& aState)
-{
- MutexAutoLock lock(mAsyncShutdownPluginStatesMutex);
- if (!aGMPParent) {
- mAsyncShutdownPluginStates.Update(NS_LITERAL_CSTRING("-"),
- NS_LITERAL_CSTRING("-"),
- aId,
- aState);
- return;
- }
- mAsyncShutdownPluginStates.Update(aGMPParent->GetDisplayName(),
- nsPrintfCString("%p", aGMPParent),
- aId,
- aState);
-}
-
-void
-GeckoMediaPluginServiceParent::AsyncShutdownPluginStates::Update(const nsCString& aPlugin,
- const nsCString& aInstance,
- char aId,
- const nsCString& aState)
-{
- nsCString note;
- StatesByInstance* instances = mStates.LookupOrAdd(aPlugin);
- if (!instances) { return; }
- State* state = instances->LookupOrAdd(aInstance);
- if (!state) { return; }
- state->mStateSequence += aId;
- state->mLastStateDescription = aState;
- note += '{';
- bool firstPlugin = true;
- for (auto pluginIt = mStates.ConstIter(); !pluginIt.Done(); pluginIt.Next()) {
- if (!firstPlugin) { note += ','; } else { firstPlugin = false; }
- note += pluginIt.Key();
- note += ":{";
- bool firstInstance = true;
- for (auto instanceIt = pluginIt.UserData()->ConstIter(); !instanceIt.Done(); instanceIt.Next()) {
- if (!firstInstance) { note += ','; } else { firstInstance = false; }
- note += instanceIt.Key();
- note += ":\"";
- note += instanceIt.UserData()->mStateSequence;
- note += '=';
- note += instanceIt.UserData()->mLastStateDescription;
- note += '"';
- }
- note += '}';
- }
- note += '}';
- LOGD(("%s::%s states[%s][%s]='%c'/'%s' -> %s", __CLASS__, __FUNCTION__,
- aPlugin.get(), aInstance.get(), aId, aState.get(), note.get()));
- CrashReporter::AnnotateCrashReport(
- NS_LITERAL_CSTRING("AsyncPluginShutdownStates"),
- note);
-}
-#endif // MOZ_CRASHREPORTER
-
void
GeckoMediaPluginServiceParent::NotifyAsyncShutdownComplete()
{
@@ -714,10 +617,6 @@ GeckoMediaPluginServiceParent::UnloadPlugins()
MOZ_ASSERT(NS_GetCurrentThread() == mGMPThread);
MOZ_ASSERT(!mShuttingDownOnGMPThread);
mShuttingDownOnGMPThread = true;
-#ifdef MOZ_CRASHREPORTER
- SetAsyncShutdownPluginState(nullptr, '2',
- NS_LITERAL_CSTRING("Starting to unload plugins"));
-#endif
nsTArray<RefPtr<GMPParent>> plugins;
{
@@ -742,17 +641,9 @@ GeckoMediaPluginServiceParent::UnloadPlugins()
// Note: CloseActive may be async; it could actually finish
// shutting down when all the plugins have unloaded.
for (const auto& plugin : plugins) {
-#ifdef MOZ_CRASHREPORTER
- SetAsyncShutdownPluginState(plugin, 'S',
- NS_LITERAL_CSTRING("CloseActive"));
-#endif
plugin->CloseActive(true);
}
-#ifdef MOZ_CRASHREPORTER
- SetAsyncShutdownPluginState(nullptr, '3',
- NS_LITERAL_CSTRING("Dispatching sync-shutdown-complete"));
-#endif
nsCOMPtr<nsIRunnable> task(NewRunnableMethod(
this, &GeckoMediaPluginServiceParent::NotifySyncShutdownComplete));
NS_DispatchToMainThread(task);
diff --git a/dom/media/gmp/GMPServiceParent.h b/dom/media/gmp/GMPServiceParent.h
index f3f43e2151..49d81055bd 100644
--- a/dom/media/gmp/GMPServiceParent.h
+++ b/dom/media/gmp/GMPServiceParent.h
@@ -54,9 +54,6 @@ public:
void AsyncShutdownComplete(GMPParent* aParent);
int32_t AsyncShutdownTimeoutMs();
-#ifdef MOZ_CRASHREPORTER
- void SetAsyncShutdownPluginState(GMPParent* aGMPParent, char aId, const nsCString& aState);
-#endif // MOZ_CRASHREPORTER
RefPtr<GenericPromise> EnsureInitialized();
RefPtr<GenericPromise> AsyncAddPluginDirectory(const nsAString& aDirectory);
@@ -169,21 +166,6 @@ private:
bool mShuttingDown;
nsTArray<RefPtr<GMPParent>> mAsyncShutdownPlugins;
-#ifdef MOZ_CRASHREPORTER
- Mutex mAsyncShutdownPluginStatesMutex; // Protects mAsyncShutdownPluginStates.
- class AsyncShutdownPluginStates
- {
- public:
- void Update(const nsCString& aPlugin, const nsCString& aInstance,
- char aId, const nsCString& aState);
- private:
- struct State { nsCString mStateSequence; nsCString mLastStateDescription; };
- typedef nsClassHashtable<nsCStringHashKey, State> StatesByInstance;
- typedef nsClassHashtable<nsCStringHashKey, StatesByInstance> StateInstancesByPlugin;
- StateInstancesByPlugin mStates;
- } mAsyncShutdownPluginStates;
-#endif // MOZ_CRASHREPORTER
-
// True if we've inspected MOZ_GMP_PATH on the GMP thread and loaded any
// plugins found there into mPlugins.
Atomic<bool> mScannedPluginOnDisk;
diff --git a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
index 5c1b6c97b1..aec1e91360 100644
--- a/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
+++ b/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp
@@ -181,8 +181,8 @@ FFmpegVideoDecoder<LIBAV_VER>::DoDecode(MediaRawData* aSample, bool* aGotFrame)
#endif
)) {
while (inputSize) {
- uint8_t* data;
- int size;
+ uint8_t* data = inputData;
+ int size = inputSize;
int len = mLib->av_parser_parse2(mCodecParser, mCodecContext, &data, &size,
inputData, inputSize,
aSample->mTime, aSample->mTimecode,
diff --git a/dom/media/test/test_background_video_suspend.html b/dom/media/test/test_background_video_suspend.html
index e872eacf86..a5ac5cc2c9 100644..100755
--- a/dom/media/test/test_background_video_suspend.html
+++ b/dom/media/test/test_background_video_suspend.html
@@ -15,7 +15,7 @@ var MIN_DELAY = 100;
function testDelay(v, start, min) {
let end = performance.now();
let delay = end - start;
- ok(delay > min, `${v.token} suspended with a delay of ${delay} ms`);
+ ok(delay >= min, `${v.token} suspended with a delay of ${delay} ms`);
}
startTest({
@@ -25,7 +25,7 @@ startTest({
[ "media.suspend-bkgnd-video.enabled", true ],
// User a short delay to ensure video decode suspend happens before end
// of video.
- [ "media.suspend-bkgnd-video.delay-ms", MIN_DELAY ]
+ [ "media.suspend-bkgnd-video.delay-ms", MIN_DELAY ],
],
tests: gDecodeSuspendTests,
runTest: (test, token) => {
diff --git a/dom/media/test/test_streams_element_capture.html b/dom/media/test/test_streams_element_capture.html
index 5e30a3ce44..a29eeef4d1 100644..100755
--- a/dom/media/test/test_streams_element_capture.html
+++ b/dom/media/test/test_streams_element_capture.html
@@ -38,7 +38,8 @@ function startTest(test) {
var stream;
var checkEnded = function() {
- is(stream.currentTime, vout.currentTime, test.name + " stream final currentTime");
+ // We know the video time won't match up to the stream time
+ // is(stream.currentTime, vout.currentTime, test.name + " stream final currentTime");
if (test.duration) {
isGreaterThanOrEqualEps(vout.currentTime, test.duration,
test.name + " current time at end");
diff --git a/dom/media/test/test_streams_element_capture_createObjectURL.html b/dom/media/test/test_streams_element_capture_createObjectURL.html
index d5d7efc5cb..d952c7142a 100644..100755
--- a/dom/media/test/test_streams_element_capture_createObjectURL.html
+++ b/dom/media/test/test_streams_element_capture_createObjectURL.html
@@ -38,7 +38,8 @@ function startTest(test, token) {
var stream;
var checkEnded = function() {
- is(stream.currentTime, vout.currentTime, test.name + " stream final currentTime");
+ // We know the video time won't match up to the stream time
+ // is(stream.currentTime, vout.currentTime, test.name + " stream final currentTime");
if (test.duration) {
isGreaterThanOrEqualEps(vout.currentTime, test.duration,
test.name + " current time at end");
diff --git a/dom/media/webaudio/AudioContext.cpp b/dom/media/webaudio/AudioContext.cpp
index a36eda6214..85842c8113 100644..100755
--- a/dom/media/webaudio/AudioContext.cpp
+++ b/dom/media/webaudio/AudioContext.cpp
@@ -41,6 +41,7 @@
#include "nsNetUtil.h"
#include "nsPIDOMWindow.h"
#include "nsPrintfCString.h"
+#include "mozilla/TimerClamping.h"
#include "OscillatorNode.h"
#include "PannerNode.h"
#include "PeriodicWave.h"
@@ -746,7 +747,7 @@ double
AudioContext::CurrentTime() const
{
MediaStream* stream = Destination()->Stream();
- return stream->StreamTimeToSeconds(stream->GetCurrentTime());
+ return TimerClamping::ReduceSTimeValue(stream->StreamTimeToSeconds(stream->GetCurrentTime()));
}
void
diff --git a/dom/performance/Performance.cpp b/dom/performance/Performance.cpp
index 17273c55df..93a6b73133 100644..100755
--- a/dom/performance/Performance.cpp
+++ b/dom/performance/Performance.cpp
@@ -13,14 +13,17 @@
#include "PerformanceMeasure.h"
#include "PerformanceObserver.h"
#include "PerformanceResourceTiming.h"
+#include "PerformanceService.h"
#include "PerformanceWorker.h"
#include "mozilla/ErrorResult.h"
#include "mozilla/dom/PerformanceBinding.h"
#include "mozilla/dom/PerformanceEntryEvent.h"
#include "mozilla/dom/PerformanceNavigationBinding.h"
#include "mozilla/dom/PerformanceObserverBinding.h"
+#include "mozilla/dom/PerformanceNavigationTiming.h"
#include "mozilla/IntegerPrintfMacros.h"
#include "mozilla/Preferences.h"
+#include "mozilla/TimerClamping.h"
#include "WorkerPrivate.h"
#include "WorkerRunnable.h"
@@ -37,27 +40,6 @@ using namespace workers;
namespace {
-// Helper classes
-class MOZ_STACK_CLASS PerformanceEntryComparator final
-{
-public:
- bool Equals(const PerformanceEntry* aElem1,
- const PerformanceEntry* aElem2) const
- {
- MOZ_ASSERT(aElem1 && aElem2,
- "Trying to compare null performance entries");
- return aElem1->StartTime() == aElem2->StartTime();
- }
-
- bool LessThan(const PerformanceEntry* aElem1,
- const PerformanceEntry* aElem2) const
- {
- MOZ_ASSERT(aElem1 && aElem2,
- "Trying to compare null performance entries");
- return aElem1->StartTime() < aElem2->StartTime();
- }
-};
-
class PrefEnabledRunnable final
: public WorkerCheckAPIExposureOnMainThreadRunnable
{
@@ -102,14 +84,12 @@ NS_IMPL_RELEASE_INHERITED(Performance, DOMEventTargetHelper)
/* static */ already_AddRefed<Performance>
Performance::CreateForMainThread(nsPIDOMWindowInner* aWindow,
nsDOMNavigationTiming* aDOMTiming,
- nsITimedChannel* aChannel,
- Performance* aParentPerformance)
+ nsITimedChannel* aChannel)
{
MOZ_ASSERT(NS_IsMainThread());
RefPtr<Performance> performance =
- new PerformanceMainThread(aWindow, aDOMTiming, aChannel,
- aParentPerformance);
+ new PerformanceMainThread(aWindow, aDOMTiming, aChannel);
return performance.forget();
}
@@ -141,6 +121,24 @@ Performance::Performance(nsPIDOMWindowInner* aWindow)
Performance::~Performance()
{}
+DOMHighResTimeStamp
+Performance::Now() const
+{
+ TimeDuration duration = TimeStamp::Now() - CreationTimeStamp();
+ return RoundTime(duration.ToMilliseconds());
+}
+
+DOMHighResTimeStamp
+Performance::TimeOrigin()
+{
+ if (!mPerformanceService) {
+ mPerformanceService = PerformanceService::GetOrCreate();
+ }
+
+ MOZ_ASSERT(mPerformanceService);
+ return mPerformanceService->TimeOrigin(CreationTimeStamp());
+}
+
JSObject*
Performance::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
@@ -228,9 +226,9 @@ Performance::ClearResourceTimings()
DOMHighResTimeStamp
Performance::RoundTime(double aTime) const
{
- // Round down to the nearest 20us, because if the timer is too accurate people
+ // Round down to the nearest 2ms, because if the timer is too accurate people
// can do nasty timing attacks with it.
- const double maxResolutionMs = 0.020;
+ const double maxResolutionMs = 2;
return floor(aTime / maxResolutionMs) * maxResolutionMs;
}
@@ -265,7 +263,7 @@ Performance::ClearMarks(const Optional<nsAString>& aName)
DOMHighResTimeStamp
Performance::ResolveTimestampFromName(const nsAString& aName,
- ErrorResult& aRv)
+ ErrorResult& aRv)
{
AutoTArray<RefPtr<PerformanceEntry>, 1> arr;
DOMHighResTimeStamp ts;
diff --git a/dom/performance/Performance.h b/dom/performance/Performance.h
index bc70589a5f..4debecc90f 100644
--- a/dom/performance/Performance.h
+++ b/dom/performance/Performance.h
@@ -24,6 +24,7 @@ namespace dom {
class PerformanceEntry;
class PerformanceNavigation;
class PerformanceObserver;
+class PerformanceService;
class PerformanceTiming;
namespace workers {
@@ -45,8 +46,7 @@ public:
static already_AddRefed<Performance>
CreateForMainThread(nsPIDOMWindowInner* aWindow,
nsDOMNavigationTiming* aDOMTiming,
- nsITimedChannel* aChannel,
- Performance* aParentPerformance);
+ nsITimedChannel* aChannel);
static already_AddRefed<Performance>
CreateForWorker(workers::WorkerPrivate* aWorkerPrivate);
@@ -54,21 +54,23 @@ public:
JSObject* WrapObject(JSContext *cx,
JS::Handle<JSObject*> aGivenProto) override;
- void GetEntries(nsTArray<RefPtr<PerformanceEntry>>& aRetval);
+ virtual void GetEntries(nsTArray<RefPtr<PerformanceEntry>>& aRetval);
- void GetEntriesByType(const nsAString& aEntryType,
- nsTArray<RefPtr<PerformanceEntry>>& aRetval);
+ virtual void GetEntriesByType(const nsAString& aEntryType,
+ nsTArray<RefPtr<PerformanceEntry>>& aRetval);
- void GetEntriesByName(const nsAString& aName,
- const Optional<nsAString>& aEntryType,
- nsTArray<RefPtr<PerformanceEntry>>& aRetval);
+ virtual void GetEntriesByName(const nsAString& aName,
+ const Optional<nsAString>& aEntryType,
+ nsTArray<RefPtr<PerformanceEntry>>& aRetval);
virtual void AddEntry(nsIHttpChannel* channel,
nsITimedChannel* timedChannel) = 0;
void ClearResourceTimings();
- virtual DOMHighResTimeStamp Now() const = 0;
+ DOMHighResTimeStamp Now() const;
+
+ DOMHighResTimeStamp TimeOrigin();
void Mark(const nsAString& aName, ErrorResult& aRv);
@@ -101,8 +103,6 @@ public:
virtual nsITimedChannel* GetChannel() const = 0;
- virtual Performance* GetParentPerformance() const = 0;
-
protected:
Performance();
explicit Performance(nsPIDOMWindowInner* aWindow);
@@ -126,10 +126,16 @@ protected:
virtual DOMHighResTimeStamp CreationTime() const = 0;
- virtual bool IsPerformanceTimingAttribute(const nsAString& aName) = 0;
+ virtual bool IsPerformanceTimingAttribute(const nsAString& aName)
+ {
+ return false;
+ }
virtual DOMHighResTimeStamp
- GetPerformanceTimingFromString(const nsAString& aTimingName) = 0;
+ GetPerformanceTimingFromString(const nsAString& aTimingName)
+ {
+ return 0;
+ }
bool IsResourceEntryLimitReached() const
{
@@ -147,13 +153,15 @@ protected:
nsTObserverArray<PerformanceObserver*> mObservers;
-private:
+protected:
nsTArray<RefPtr<PerformanceEntry>> mUserEntries;
nsTArray<RefPtr<PerformanceEntry>> mResourceEntries;
uint64_t mResourceTimingBufferSize;
static const uint64_t kDefaultResourceTimingBufferSize = 150;
bool mPendingNotificationObserversTask;
+
+ RefPtr<PerformanceService> mPerformanceService;
};
} // namespace dom
diff --git a/dom/performance/PerformanceEntry.h b/dom/performance/PerformanceEntry.h
index bc4f84f1c2..0af9f669ec 100644
--- a/dom/performance/PerformanceEntry.h
+++ b/dom/performance/PerformanceEntry.h
@@ -90,6 +90,27 @@ protected:
nsString mEntryType;
};
+// Helper classes
+class MOZ_STACK_CLASS PerformanceEntryComparator final
+{
+public:
+ bool Equals(const PerformanceEntry* aElem1,
+ const PerformanceEntry* aElem2) const
+ {
+ MOZ_ASSERT(aElem1 && aElem2,
+ "Trying to compare null performance entries");
+ return aElem1->StartTime() == aElem2->StartTime();
+ }
+
+ bool LessThan(const PerformanceEntry* aElem1,
+ const PerformanceEntry* aElem2) const
+ {
+ MOZ_ASSERT(aElem1 && aElem2,
+ "Trying to compare null performance entries");
+ return aElem1->StartTime() < aElem2->StartTime();
+ }
+};
+
} // namespace dom
} // namespace mozilla
diff --git a/dom/performance/PerformanceMainThread.cpp b/dom/performance/PerformanceMainThread.cpp
index 86d42c5f86..64c06d3ea1 100644
--- a/dom/performance/PerformanceMainThread.cpp
+++ b/dom/performance/PerformanceMainThread.cpp
@@ -6,6 +6,7 @@
#include "PerformanceMainThread.h"
#include "PerformanceNavigation.h"
+#include "nsICacheInfoChannel.h"
namespace mozilla {
namespace dom {
@@ -16,7 +17,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(PerformanceMainThread,
Performance)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mTiming,
mNavigation,
- mParentPerformance)
+ mDocEntry)
tmp->mMozMemory = nullptr;
mozilla::DropJSObjects(this);
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
@@ -25,7 +26,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(PerformanceMainThread,
Performance)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTiming,
mNavigation,
- mParentPerformance)
+ mDocEntry)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
@@ -45,12 +46,10 @@ NS_INTERFACE_MAP_END_INHERITING(Performance)
PerformanceMainThread::PerformanceMainThread(nsPIDOMWindowInner* aWindow,
nsDOMNavigationTiming* aDOMTiming,
- nsITimedChannel* aChannel,
- Performance* aParentPerformance)
+ nsITimedChannel* aChannel)
: Performance(aWindow)
, mDOMTiming(aDOMTiming)
, mChannel(aChannel)
- , mParentPerformance(aParentPerformance)
{
MOZ_ASSERT(aWindow, "Parent window object should be provided");
}
@@ -78,7 +77,7 @@ PerformanceTiming*
PerformanceMainThread::Timing()
{
if (!mTiming) {
- // For navigation timing, the third argument (an nsIHtttpChannel) is null
+ // For navigation timing, the third argument (an nsIHttpChannel) is null
// since the cross-domain redirect were already checked. The last argument
// (zero time) for performance.timing is the navigation start value.
mTiming = new PerformanceTiming(this, mChannel, nullptr,
@@ -108,12 +107,6 @@ PerformanceMainThread::Navigation()
return mNavigation;
}
-DOMHighResTimeStamp
-PerformanceMainThread::Now() const
-{
- return RoundTime(GetDOMTiming()->TimeStampToDOMHighRes(TimeStamp::Now()));
-}
-
/**
* An entry should be added only after the resource is loaded.
* This method is not thread safe and can only be called on the main thread.
@@ -161,27 +154,7 @@ PerformanceMainThread::AddEntry(nsIHttpChannel* channel,
// The PerformanceResourceTiming object will use the PerformanceTiming
// object to get all the required timings.
RefPtr<PerformanceResourceTiming> performanceEntry =
- new PerformanceResourceTiming(performanceTiming, this, entryName);
-
- nsAutoCString protocol;
- channel->GetProtocolVersion(protocol);
- performanceEntry->SetNextHopProtocol(NS_ConvertUTF8toUTF16(protocol));
-
- uint64_t encodedBodySize = 0;
- channel->GetEncodedBodySize(&encodedBodySize);
- performanceEntry->SetEncodedBodySize(encodedBodySize);
-
- uint64_t transferSize = 0;
- channel->GetTransferSize(&transferSize);
- performanceEntry->SetTransferSize(transferSize);
-
- uint64_t decodedBodySize = 0;
- channel->GetDecodedBodySize(&decodedBodySize);
- if (decodedBodySize == 0) {
- decodedBodySize = encodedBodySize;
- }
- performanceEntry->SetDecodedBodySize(decodedBodySize);
-
+ new PerformanceResourceTiming(performanceTiming, this, entryName, channel);
// If the initiator type had no valid value, then set it to the default
// ("other") value.
if (initiatorType.IsEmpty()) {
@@ -335,5 +308,65 @@ PerformanceMainThread::CreationTime() const
return GetDOMTiming()->GetNavigationStart();
}
+void
+PerformanceMainThread::EnsureDocEntry()
+{
+ if (!mDocEntry && nsContentUtils::IsPerformanceNavigationTimingEnabled()) {
+ nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(mChannel);
+ RefPtr<PerformanceTiming> timing =
+ new PerformanceTiming(this, mChannel, nullptr, 0);
+ mDocEntry = new PerformanceNavigationTiming(timing, this,
+ httpChannel);
+ }
+}
+
+
+void
+PerformanceMainThread::GetEntries(nsTArray<RefPtr<PerformanceEntry>>& aRetval)
+{
+ aRetval = mResourceEntries;
+ aRetval.AppendElements(mUserEntries);
+
+ EnsureDocEntry();
+ if (mDocEntry) {
+ aRetval.AppendElement(mDocEntry);
+ }
+
+ aRetval.Sort(PerformanceEntryComparator());
+}
+
+void
+PerformanceMainThread::GetEntriesByType(const nsAString& aEntryType,
+ nsTArray<RefPtr<PerformanceEntry>>& aRetval)
+{
+ if (aEntryType.EqualsLiteral("navigation")) {
+ aRetval.Clear();
+ EnsureDocEntry();
+ if (mDocEntry) {
+ aRetval.AppendElement(mDocEntry);
+ }
+ return;
+ }
+
+ Performance::GetEntriesByType(aEntryType, aRetval);
+}
+
+void
+PerformanceMainThread::GetEntriesByName(const nsAString& aName,
+ const Optional<nsAString>& aEntryType,
+ nsTArray<RefPtr<PerformanceEntry>>& aRetval)
+{
+ if (aName.EqualsLiteral("document")) {
+ aRetval.Clear();
+ EnsureDocEntry();
+ if (mDocEntry) {
+ aRetval.AppendElement(mDocEntry);
+ }
+ return;
+ }
+
+ Performance::GetEntriesByName(aName, aEntryType, aRetval);
+}
+
} // dom namespace
} // mozilla namespace
diff --git a/dom/performance/PerformanceMainThread.h b/dom/performance/PerformanceMainThread.h
index 84773f29b0..9f0e185fcf 100644
--- a/dom/performance/PerformanceMainThread.h
+++ b/dom/performance/PerformanceMainThread.h
@@ -17,16 +17,12 @@ class PerformanceMainThread final : public Performance
public:
PerformanceMainThread(nsPIDOMWindowInner* aWindow,
nsDOMNavigationTiming* aDOMTiming,
- nsITimedChannel* aChannel,
- Performance* aParentPerformance);
+ nsITimedChannel* aChannel);
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(PerformanceMainThread,
Performance)
- // Performance WebIDL methods
- DOMHighResTimeStamp Now() const override;
-
virtual PerformanceTiming* Timing() override;
virtual PerformanceNavigation* Navigation() override;
@@ -51,10 +47,14 @@ public:
return mChannel;
}
- virtual Performance* GetParentPerformance() const override
- {
- return mParentPerformance;
- }
+ // The GetEntries* methods need to be overriden in order to add the
+ // the document entry of type navigation.
+ virtual void GetEntries(nsTArray<RefPtr<PerformanceEntry>>& aRetval) override;
+ virtual void GetEntriesByType(const nsAString& aEntryType,
+ nsTArray<RefPtr<PerformanceEntry>>& aRetval) override;
+ virtual void GetEntriesByName(const nsAString& aName,
+ const Optional<nsAString>& aEntryType,
+ nsTArray<RefPtr<PerformanceEntry>>& aRetval) override;
protected:
~PerformanceMainThread();
@@ -72,12 +72,13 @@ protected:
GetPerformanceTimingFromString(const nsAString& aTimingName) override;
void DispatchBufferFullEvent() override;
+ void EnsureDocEntry();
+ RefPtr<PerformanceEntry> mDocEntry;
RefPtr<nsDOMNavigationTiming> mDOMTiming;
nsCOMPtr<nsITimedChannel> mChannel;
RefPtr<PerformanceTiming> mTiming;
RefPtr<PerformanceNavigation> mNavigation;
- RefPtr<Performance> mParentPerformance;
JS::Heap<JSObject*> mMozMemory;
};
diff --git a/dom/performance/PerformanceNavigationTiming.cpp b/dom/performance/PerformanceNavigationTiming.cpp
new file mode 100644
index 0000000000..4e00b2bb21
--- /dev/null
+++ b/dom/performance/PerformanceNavigationTiming.cpp
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "mozilla/dom/PerformanceNavigationTiming.h"
+#include "mozilla/dom/PerformanceNavigationTimingBinding.h"
+
+using namespace mozilla::dom;
+
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(PerformanceNavigationTiming)
+NS_INTERFACE_MAP_END_INHERITING(PerformanceResourceTiming)
+
+NS_IMPL_ADDREF_INHERITED(PerformanceNavigationTiming, PerformanceResourceTiming)
+NS_IMPL_RELEASE_INHERITED(PerformanceNavigationTiming, PerformanceResourceTiming)
+
+JSObject*
+PerformanceNavigationTiming::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
+{
+ return PerformanceNavigationTimingBinding::Wrap(aCx, this, aGivenProto);
+}
+
+DOMHighResTimeStamp
+PerformanceNavigationTiming::UnloadEventStart() const
+{
+ return mTiming->GetDOMTiming()->GetUnloadEventStartHighRes();
+}
+
+DOMHighResTimeStamp
+PerformanceNavigationTiming::UnloadEventEnd() const
+{
+ return mTiming->GetDOMTiming()->GetUnloadEventEndHighRes();
+}
+
+DOMHighResTimeStamp
+PerformanceNavigationTiming::DomInteractive() const
+{
+ return mTiming->GetDOMTiming()->GetDomInteractiveHighRes();
+}
+
+DOMHighResTimeStamp
+PerformanceNavigationTiming::DomContentLoadedEventStart() const
+{
+ return mTiming->GetDOMTiming()->GetDomContentLoadedEventStartHighRes();
+}
+
+DOMHighResTimeStamp
+PerformanceNavigationTiming::DomContentLoadedEventEnd() const
+{
+ return mTiming->GetDOMTiming()->GetDomContentLoadedEventEndHighRes();
+}
+
+DOMHighResTimeStamp
+PerformanceNavigationTiming::DomComplete() const
+{
+ return mTiming->GetDOMTiming()->GetDomCompleteHighRes();
+}
+
+DOMHighResTimeStamp
+PerformanceNavigationTiming::LoadEventStart() const
+{
+ return mTiming->GetDOMTiming()->GetLoadEventStartHighRes();
+}
+
+DOMHighResTimeStamp
+PerformanceNavigationTiming::LoadEventEnd() const
+{
+ return mTiming->GetDOMTiming()->GetLoadEventEndHighRes();
+}
+
+NavigationType
+PerformanceNavigationTiming::Type() const
+{
+ switch(mTiming->GetDOMTiming()->GetType()) {
+ case nsDOMNavigationTiming::TYPE_NAVIGATE:
+ return NavigationType::Navigate;
+ break;
+ case nsDOMNavigationTiming::TYPE_RELOAD:
+ return NavigationType::Reload;
+ break;
+ case nsDOMNavigationTiming::TYPE_BACK_FORWARD:
+ return NavigationType::Back_forward;
+ break;
+ default:
+ // The type is TYPE_RESERVED or some other value that was later added.
+ // We fallback to the default of Navigate.
+ return NavigationType::Navigate;
+ }
+}
+
+uint16_t
+PerformanceNavigationTiming::RedirectCount() const
+{
+ return mTiming->GetRedirectCount();
+}
diff --git a/dom/performance/PerformanceNavigationTiming.h b/dom/performance/PerformanceNavigationTiming.h
new file mode 100644
index 0000000000..8555f19872
--- /dev/null
+++ b/dom/performance/PerformanceNavigationTiming.h
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_dom_PerformanceNavigationTiming_h___
+#define mozilla_dom_PerformanceNavigationTiming_h___
+
+#include "nsCOMPtr.h"
+#include "nsIChannel.h"
+#include "nsITimedChannel.h"
+#include "mozilla/dom/PerformanceResourceTiming.h"
+#include "mozilla/dom/PerformanceNavigationTimingBinding.h"
+#include "nsIHttpChannel.h"
+
+namespace mozilla {
+namespace dom {
+
+// https://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming
+class PerformanceNavigationTiming final
+ : public PerformanceResourceTiming
+{
+public:
+ NS_DECL_ISUPPORTS_INHERITED
+
+ // Note that aPerformanceTiming must be initalized with zeroTime = 0
+ // so that timestamps are relative to startTime, as opposed to the
+ // performance.timing object for which timestamps are absolute and has a
+ // zeroTime initialized to navigationStart
+ explicit PerformanceNavigationTiming(PerformanceTiming* aPerformanceTiming,
+ Performance* aPerformance,
+ nsIHttpChannel* aChannel)
+ : PerformanceResourceTiming(aPerformanceTiming, aPerformance,
+ NS_LITERAL_STRING("document"), aChannel) {
+ SetEntryType(NS_LITERAL_STRING("navigation"));
+ SetInitiatorType(NS_LITERAL_STRING("navigation"));
+ }
+
+ DOMHighResTimeStamp Duration() const override
+ {
+ return LoadEventEnd() - StartTime();
+ }
+
+ DOMHighResTimeStamp StartTime() const override
+ {
+ return 0;
+ }
+
+ JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
+
+ DOMHighResTimeStamp UnloadEventStart() const;
+ DOMHighResTimeStamp UnloadEventEnd() const;
+
+ DOMHighResTimeStamp DomInteractive() const;
+ DOMHighResTimeStamp DomContentLoadedEventStart() const;
+ DOMHighResTimeStamp DomContentLoadedEventEnd() const;
+ DOMHighResTimeStamp DomComplete() const;
+ DOMHighResTimeStamp LoadEventStart() const;
+ DOMHighResTimeStamp LoadEventEnd() const;
+ NavigationType Type() const;
+ uint16_t RedirectCount() const;
+
+private:
+ ~PerformanceNavigationTiming() {}
+};
+
+} // namespace dom
+} // namespace mozilla
+
+#endif // mozilla_dom_PerformanceNavigationTiming_h___
diff --git a/dom/performance/PerformanceObserver.cpp b/dom/performance/PerformanceObserver.cpp
index 11dd30ac23..d02acfb09a 100644
--- a/dom/performance/PerformanceObserver.cpp
+++ b/dom/performance/PerformanceObserver.cpp
@@ -114,12 +114,13 @@ PerformanceObserver::Notify()
RefPtr<PerformanceObserverEntryList> list =
new PerformanceObserverEntryList(this, mQueuedEntries);
+ mQueuedEntries.Clear();
+
ErrorResult rv;
mCallback->Call(this, *list, *this, rv);
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
}
- mQueuedEntries.Clear();
}
void
@@ -170,6 +171,17 @@ PerformanceObserver::Observe(const PerformanceObserverInit& aOptions,
mEntryTypes.SwapElements(validEntryTypes);
mPerformance->AddObserver(this);
+
+ if (aOptions.mBuffered) {
+ for (auto entryType : mEntryTypes) {
+ nsTArray<RefPtr<PerformanceEntry>> existingEntries;
+ mPerformance->GetEntriesByType(entryType, existingEntries);
+ if (!existingEntries.IsEmpty()) {
+ mQueuedEntries.AppendElements(existingEntries);
+ }
+ }
+ }
+
mConnected = true;
}
diff --git a/dom/performance/PerformanceObserverEntryList.cpp b/dom/performance/PerformanceObserverEntryList.cpp
index 349103f08c..20e818f3d7 100644
--- a/dom/performance/PerformanceObserverEntryList.cpp
+++ b/dom/performance/PerformanceObserverEntryList.cpp
@@ -66,6 +66,7 @@ PerformanceObserverEntryList::GetEntries(
aRetval.AppendElement(entry);
}
+ aRetval.Sort(PerformanceEntryComparator());
}
void
@@ -79,6 +80,7 @@ PerformanceObserverEntryList::GetEntriesByType(
aRetval.AppendElement(entry);
}
}
+ aRetval.Sort(PerformanceEntryComparator());
}
void
@@ -88,9 +90,18 @@ PerformanceObserverEntryList::GetEntriesByName(
nsTArray<RefPtr<PerformanceEntry>>& aRetval)
{
aRetval.Clear();
+ const bool typePassed = aEntryType.WasPassed();
for (const RefPtr<PerformanceEntry>& entry : mEntries) {
- if (entry->GetName().Equals(aName)) {
- aRetval.AppendElement(entry);
+ if (!entry->GetName().Equals(aName)) {
+ continue;
}
+
+ if (typePassed &&
+ !entry->GetEntryType().Equals(aEntryType.Value())) {
+ continue;
+ }
+
+ aRetval.AppendElement(entry);
}
+ aRetval.Sort(PerformanceEntryComparator());
}
diff --git a/dom/performance/PerformanceResourceTiming.cpp b/dom/performance/PerformanceResourceTiming.cpp
index 60a20ca28c..2eaa4eb9aa 100644
--- a/dom/performance/PerformanceResourceTiming.cpp
+++ b/dom/performance/PerformanceResourceTiming.cpp
@@ -25,7 +25,8 @@ NS_IMPL_RELEASE_INHERITED(PerformanceResourceTiming, PerformanceEntry)
PerformanceResourceTiming::PerformanceResourceTiming(PerformanceTiming* aPerformanceTiming,
Performance* aPerformance,
- const nsAString& aName)
+ const nsAString& aName,
+ nsIHttpChannel* aChannel)
: PerformanceEntry(aPerformance, aName, NS_LITERAL_STRING("resource")),
mTiming(aPerformanceTiming),
mEncodedBodySize(0),
@@ -33,6 +34,34 @@ PerformanceResourceTiming::PerformanceResourceTiming(PerformanceTiming* aPerform
mDecodedBodySize(0)
{
MOZ_ASSERT(aPerformance, "Parent performance object should be provided");
+ SetPropertiesFromChannel(aChannel);
+}
+
+void
+PerformanceResourceTiming::SetPropertiesFromChannel(nsIHttpChannel* aChannel)
+{
+ if (!aChannel) {
+ return;
+ }
+
+ nsAutoCString protocol;
+ Unused << aChannel->GetProtocolVersion(protocol);
+ SetNextHopProtocol(NS_ConvertUTF8toUTF16(protocol));
+
+ uint64_t encodedBodySize = 0;
+ Unused << aChannel->GetEncodedBodySize(&encodedBodySize);
+ SetEncodedBodySize(encodedBodySize);
+
+ uint64_t transferSize = 0;
+ Unused << aChannel->GetTransferSize(&transferSize);
+ SetTransferSize(transferSize);
+
+ uint64_t decodedBodySize = 0;
+ Unused << aChannel->GetDecodedBodySize(&decodedBodySize);
+ if (decodedBodySize == 0) {
+ decodedBodySize = encodedBodySize;
+ }
+ SetDecodedBodySize(decodedBodySize);
}
PerformanceResourceTiming::~PerformanceResourceTiming()
@@ -42,8 +71,22 @@ PerformanceResourceTiming::~PerformanceResourceTiming()
DOMHighResTimeStamp
PerformanceResourceTiming::StartTime() const
{
- DOMHighResTimeStamp startTime = mTiming->RedirectStartHighRes();
- return startTime ? startTime : mTiming->FetchStartHighRes();
+ // Force the start time to be the earliest of:
+ // - RedirectStart
+ // - WorkerStart
+ // - AsyncOpen
+ // Ignore zero values. The RedirectStart and WorkerStart values
+ // can come from earlier redirected channels prior to the AsyncOpen
+ // time being recorded.
+ DOMHighResTimeStamp redirect = mTiming->RedirectStartHighRes();
+ redirect = redirect ? redirect : DBL_MAX;
+
+ DOMHighResTimeStamp worker = mTiming->WorkerStartHighRes();
+ worker = worker ? worker : DBL_MAX;
+
+ DOMHighResTimeStamp asyncOpen = mTiming->AsyncOpenHighRes();
+
+ return std::min(asyncOpen, std::min(redirect, worker));
}
JSObject*
diff --git a/dom/performance/PerformanceResourceTiming.h b/dom/performance/PerformanceResourceTiming.h
index 2dd6b4a06b..98a03327e9 100644
--- a/dom/performance/PerformanceResourceTiming.h
+++ b/dom/performance/PerformanceResourceTiming.h
@@ -18,7 +18,7 @@ namespace mozilla {
namespace dom {
// http://www.w3.org/TR/resource-timing/#performanceresourcetiming
-class PerformanceResourceTiming final : public PerformanceEntry
+class PerformanceResourceTiming : public PerformanceEntry
{
public:
typedef mozilla::TimeStamp TimeStamp;
@@ -30,7 +30,8 @@ public:
PerformanceResourceTiming(PerformanceTiming* aPerformanceTiming,
Performance* aPerformance,
- const nsAString& aName);
+ const nsAString& aName,
+ nsIHttpChannel* aChannel = nullptr);
virtual JSObject* WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
@@ -62,6 +63,12 @@ public:
mNextHopProtocol = aNextHopProtocol;
}
+ DOMHighResTimeStamp WorkerStart() const {
+ return mTiming && mTiming->TimingAllowed()
+ ? mTiming->WorkerStartHighRes()
+ : 0;
+ }
+
DOMHighResTimeStamp FetchStart() const {
return mTiming
? mTiming->FetchStartHighRes()
@@ -170,6 +177,7 @@ public:
protected:
virtual ~PerformanceResourceTiming();
+ void SetPropertiesFromChannel(nsIHttpChannel* aChannel);
nsString mInitiatorType;
nsString mNextHopProtocol;
diff --git a/dom/performance/PerformanceService.cpp b/dom/performance/PerformanceService.cpp
new file mode 100644
index 0000000000..cf119af898
--- /dev/null
+++ b/dom/performance/PerformanceService.cpp
@@ -0,0 +1,46 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "PerformanceService.h"
+
+#include "mozilla/ClearOnShutdown.h"
+#include "mozilla/StaticMutex.h"
+#include "mozilla/StaticPtr.h"
+
+namespace mozilla {
+namespace dom {
+
+static StaticRefPtr<PerformanceService> gPerformanceService;
+static StaticMutex gPerformanceServiceMutex;
+
+/* static */ PerformanceService*
+PerformanceService::GetOrCreate()
+{
+ StaticMutexAutoLock al(gPerformanceServiceMutex);
+
+ if (!gPerformanceService) {
+ gPerformanceService = new PerformanceService();
+ ClearOnShutdown(&gPerformanceService);
+ }
+
+ return gPerformanceService;
+}
+
+DOMHighResTimeStamp
+PerformanceService::TimeOrigin(const TimeStamp& aCreationTimeStamp) const
+{
+ return (aCreationTimeStamp - mCreationTimeStamp).ToMilliseconds() +
+ (mCreationEpochTime / PR_USEC_PER_MSEC);
+}
+
+PerformanceService::PerformanceService()
+{
+ mCreationTimeStamp = TimeStamp::Now();
+ mCreationEpochTime = PR_Now();
+}
+
+} // dom namespace
+} // mozilla namespace
diff --git a/dom/performance/PerformanceService.h b/dom/performance/PerformanceService.h
new file mode 100644
index 0000000000..9abbd674df
--- /dev/null
+++ b/dom/performance/PerformanceService.h
@@ -0,0 +1,48 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef dom_performance_PerformanceService_h
+#define dom_performance_PerformanceService_h
+
+#include "mozilla/TimeStamp.h"
+#include "nsCOMPtr.h"
+#include "nsDOMNavigationTiming.h"
+
+namespace mozilla {
+namespace dom {
+
+// This class is thread-safe.
+
+// We use this singleton for having the correct value of performance.timeOrigin.
+// This value must be calculated on top of the pair:
+// - mCreationTimeStamp (monotonic clock)
+// - mCreationEpochTime (unix epoch time)
+// These 2 values must be taken "at the same time" in order to be used
+// correctly.
+
+class PerformanceService
+{
+public:
+ NS_INLINE_DECL_THREADSAFE_REFCOUNTING(PerformanceService)
+
+ static PerformanceService*
+ GetOrCreate();
+
+ DOMHighResTimeStamp
+ TimeOrigin(const TimeStamp& aCreationTimeStamp) const;
+
+private:
+ PerformanceService();
+ ~PerformanceService() = default;
+
+ TimeStamp mCreationTimeStamp;
+ PRTime mCreationEpochTime;
+};
+
+} // dom namespace
+} // mozilla namespace
+
+#endif // dom_performance_PerformanceService_h
diff --git a/dom/performance/PerformanceTiming.cpp b/dom/performance/PerformanceTiming.cpp
index 4070b6a0f9..887a23938c 100644..100755
--- a/dom/performance/PerformanceTiming.cpp
+++ b/dom/performance/PerformanceTiming.cpp
@@ -21,7 +21,7 @@ PerformanceTiming::PerformanceTiming(Performance* aPerformance,
DOMHighResTimeStamp aZeroTime)
: mPerformance(aPerformance),
mFetchStart(0.0),
- mZeroTime(aZeroTime),
+ mZeroTime(TimerClamping::ReduceMsTimeValue(aZeroTime)),
mRedirectCount(0),
mTimingAllowed(true),
mAllRedirectsSameOrigin(true),
@@ -46,6 +46,23 @@ PerformanceTiming::PerformanceTiming(Performance* aPerformance,
mReportCrossOriginRedirect = mTimingAllowed && redirectsPassCheck;
}
+ mSecureConnection = false;
+ nsCOMPtr<nsIURI> uri;
+ if (aHttpChannel) {
+ aHttpChannel->GetURI(getter_AddRefs(uri));
+ } else {
+ nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(aChannel);
+ if (httpChannel) {
+ httpChannel->GetURI(getter_AddRefs(uri));
+ }
+ }
+
+ if (uri) {
+ nsresult rv = uri->SchemeIs("https", &mSecureConnection);
+ if (NS_FAILED(rv)) {
+ mSecureConnection = false;
+ }
+ }
InitializeTimingInfo(aChannel);
}
@@ -56,6 +73,7 @@ PerformanceTiming::InitializeTimingInfo(nsITimedChannel* aChannel)
{
if (aChannel) {
aChannel->GetAsyncOpen(&mAsyncOpen);
+ aChannel->GetDispatchFetchEventStart(&mWorkerStart);
aChannel->GetAllRedirectsSameOrigin(&mAllRedirectsSameOrigin);
aChannel->GetRedirectCount(&mRedirectCount);
aChannel->GetRedirectStart(&mRedirectStart);
@@ -71,30 +89,39 @@ PerformanceTiming::InitializeTimingInfo(nsITimedChannel* aChannel)
aChannel->GetResponseEnd(&mResponseEnd);
aChannel->GetCacheReadEnd(&mCacheReadEnd);
- // the performance timing api essentially requires that the event timestamps
- // are >= asyncOpen().. but in truth the browser engages in a number of
- // speculative activities that sometimes mean connections and lookups begin
- // earlier. Workaround that here by just using asyncOpen as the minimum
- // timestamp for dns and connection info.
+ // The performance timing api essentially requires that the event timestamps
+ // have a strict relation with each other. The truth, however, is the browser
+ // engages in a number of speculative activities that sometimes mean connections
+ // and lookups begin at different times. Workaround that here by clamping
+ // these values to what we expect FetchStart to be. This means the later of
+ // AsyncOpen or WorkerStart times.
if (!mAsyncOpen.IsNull()) {
- if (!mDomainLookupStart.IsNull() && mDomainLookupStart < mAsyncOpen) {
- mDomainLookupStart = mAsyncOpen;
+ // We want to clamp to the expected FetchStart value. This is later of
+ // the AsyncOpen and WorkerStart values.
+ const TimeStamp* clampTime = &mAsyncOpen;
+ if (!mWorkerStart.IsNull() && mWorkerStart > mAsyncOpen) {
+ clampTime = &mWorkerStart;
}
- if (!mDomainLookupEnd.IsNull() && mDomainLookupEnd < mAsyncOpen) {
- mDomainLookupEnd = mAsyncOpen;
+ if (!mDomainLookupStart.IsNull() && mDomainLookupStart < *clampTime) {
+ mDomainLookupStart = *clampTime;
}
- if (!mConnectStart.IsNull() && mConnectStart < mAsyncOpen) {
- mConnectStart = mAsyncOpen;
+ if (!mDomainLookupEnd.IsNull() && mDomainLookupEnd < *clampTime) {
+ mDomainLookupEnd = *clampTime;
}
- if (!mSecureConnectionStart.IsNull() && mSecureConnectionStart < mAsyncOpen) {
- mSecureConnectionStart = mAsyncOpen;
+ if (!mConnectStart.IsNull() && mConnectStart < *clampTime) {
+ mConnectStart = *clampTime;
}
- if (!mConnectEnd.IsNull() && mConnectEnd < mAsyncOpen) {
- mConnectEnd = mAsyncOpen;
+ if (mSecureConnection && !mSecureConnectionStart.IsNull() &&
+ mSecureConnectionStart < *clampTime) {
+ mSecureConnectionStart = *clampTime;
+ }
+
+ if (!mConnectEnd.IsNull() && mConnectEnd < *clampTime) {
+ mConnectEnd = *clampTime;
}
}
}
@@ -113,11 +140,15 @@ PerformanceTiming::FetchStartHighRes()
}
MOZ_ASSERT(!mAsyncOpen.IsNull(), "The fetch start time stamp should always be "
"valid if the performance timing is enabled");
- mFetchStart = (!mAsyncOpen.IsNull())
- ? TimeStampToDOMHighRes(mAsyncOpen)
- : 0.0;
+ if (!mAsyncOpen.IsNull()) {
+ if (!mWorkerStart.IsNull() && mWorkerStart > mAsyncOpen) {
+ mFetchStart = TimeStampToDOMHighRes(mWorkerStart);
+ } else {
+ mFetchStart = TimeStampToDOMHighRes(mAsyncOpen);
+ }
+ }
}
- return mFetchStart;
+ return TimerClamping::ReduceMsTimeValue(mFetchStart);
}
DOMTimeMilliSec
@@ -162,7 +193,7 @@ PerformanceTiming::TimingAllowed() const
return mTimingAllowed;
}
-uint16_t
+uint8_t
PerformanceTiming::GetRedirectCount() const
{
if (!nsContentUtils::IsPerformanceTimingEnabled() || !IsInitialized()) {
@@ -187,6 +218,26 @@ PerformanceTiming::ShouldReportCrossOriginRedirect() const
return (mRedirectCount != 0) && mReportCrossOriginRedirect;
}
+DOMHighResTimeStamp
+PerformanceTiming::AsyncOpenHighRes()
+{
+ if (!nsContentUtils::IsPerformanceTimingEnabled() || !IsInitialized() ||
+ mAsyncOpen.IsNull()) {
+ return mZeroTime;
+ }
+ return TimeStampToReducedDOMHighResOrFetchStart(mAsyncOpen);
+}
+
+DOMHighResTimeStamp
+PerformanceTiming::WorkerStartHighRes()
+{
+ if (!nsContentUtils::IsPerformanceTimingEnabled() || !IsInitialized() ||
+ mWorkerStart.IsNull()) {
+ return mZeroTime;
+ }
+ return TimeStampToReducedDOMHighResOrFetchStart(mWorkerStart);
+}
+
/**
* RedirectStartHighRes() is used by both the navigation timing and the
* resource timing. Since, navigation timing and resource timing check and
@@ -203,7 +254,7 @@ PerformanceTiming::RedirectStartHighRes()
if (!nsContentUtils::IsPerformanceTimingEnabled() || !IsInitialized()) {
return mZeroTime;
}
- return TimeStampToDOMHighResOrFetchStart(mRedirectStart);
+ return TimeStampToReducedDOMHighResOrFetchStart(mRedirectStart);
}
DOMTimeMilliSec
@@ -236,7 +287,7 @@ PerformanceTiming::RedirectEndHighRes()
if (!nsContentUtils::IsPerformanceTimingEnabled() || !IsInitialized()) {
return mZeroTime;
}
- return TimeStampToDOMHighResOrFetchStart(mRedirectEnd);
+ return TimeStampToReducedDOMHighResOrFetchStart(mRedirectEnd);
}
DOMTimeMilliSec
@@ -259,7 +310,7 @@ PerformanceTiming::DomainLookupStartHighRes()
if (!nsContentUtils::IsPerformanceTimingEnabled() || !IsInitialized()) {
return mZeroTime;
}
- return TimeStampToDOMHighResOrFetchStart(mDomainLookupStart);
+ return TimeStampToReducedDOMHighResOrFetchStart(mDomainLookupStart);
}
DOMTimeMilliSec
@@ -276,7 +327,7 @@ PerformanceTiming::DomainLookupEndHighRes()
}
// Bug 1155008 - nsHttpTransaction is racy. Return DomainLookupStart when null
return mDomainLookupEnd.IsNull() ? DomainLookupStartHighRes()
- : TimeStampToDOMHighRes(mDomainLookupEnd);
+ : TimerClamping::ReduceMsTimeValue(TimeStampToDOMHighRes(mDomainLookupEnd));
}
DOMTimeMilliSec
@@ -292,7 +343,7 @@ PerformanceTiming::ConnectStartHighRes()
return mZeroTime;
}
return mConnectStart.IsNull() ? DomainLookupEndHighRes()
- : TimeStampToDOMHighRes(mConnectStart);
+ : TimerClamping::ReduceMsTimeValue(TimeStampToDOMHighRes(mConnectStart));
}
DOMTimeMilliSec
@@ -307,12 +358,11 @@ PerformanceTiming::SecureConnectionStartHighRes()
if (!nsContentUtils::IsPerformanceTimingEnabled() || !IsInitialized()) {
return mZeroTime;
}
-
- // Round down to the nearest 1ms
- const double maxResolutionMs = 1;
- return mSecureConnectionStart.IsNull()
- ? mZeroTime
- : floor(TimeStampToDOMHighRes(mSecureConnectionStart) / maxResolutionMs) * maxResolutionMs;
+ return !mSecureConnection
+ ? 0 // We use 0 here, because mZeroTime is sometimes set to the navigation
+ // start time.
+ : (mSecureConnectionStart.IsNull() ? mZeroTime
+ : TimerClamping::ReduceMsTimeValue(TimeStampToDOMHighRes(mSecureConnectionStart)));
}
DOMTimeMilliSec
@@ -329,7 +379,7 @@ PerformanceTiming::ConnectEndHighRes()
}
// Bug 1155008 - nsHttpTransaction is racy. Return ConnectStart when null
return mConnectEnd.IsNull() ? ConnectStartHighRes()
- : TimeStampToDOMHighRes(mConnectEnd);
+ : TimerClamping::ReduceMsTimeValue(TimeStampToDOMHighRes(mConnectEnd));
}
DOMTimeMilliSec
@@ -344,7 +394,7 @@ PerformanceTiming::RequestStartHighRes()
if (!nsContentUtils::IsPerformanceTimingEnabled() || !IsInitialized()) {
return mZeroTime;
}
- return TimeStampToDOMHighResOrFetchStart(mRequestStart);
+ return TimeStampToReducedDOMHighResOrFetchStart(mRequestStart);
}
DOMTimeMilliSec
@@ -363,7 +413,7 @@ PerformanceTiming::ResponseStartHighRes()
(!mCacheReadStart.IsNull() && mCacheReadStart < mResponseStart)) {
mResponseStart = mCacheReadStart;
}
- return TimeStampToDOMHighResOrFetchStart(mResponseStart);
+ return TimeStampToReducedDOMHighResOrFetchStart(mResponseStart);
}
DOMTimeMilliSec
@@ -384,7 +434,7 @@ PerformanceTiming::ResponseEndHighRes()
}
// Bug 1155008 - nsHttpTransaction is racy. Return ResponseStart when null
return mResponseEnd.IsNull() ? ResponseStartHighRes()
- : TimeStampToDOMHighRes(mResponseEnd);
+ : TimerClamping::ReduceMsTimeValue(TimeStampToDOMHighRes(mResponseEnd));
}
DOMTimeMilliSec
diff --git a/dom/performance/PerformanceTiming.h b/dom/performance/PerformanceTiming.h
index 0bc73fd3ff..435e1bca1a 100644..100755
--- a/dom/performance/PerformanceTiming.h
+++ b/dom/performance/PerformanceTiming.h
@@ -10,6 +10,7 @@
#include "mozilla/Attributes.h"
#include "nsContentUtils.h"
#include "nsDOMNavigationTiming.h"
+#include "mozilla/TimerClamping.h"
#include "nsWrapperCache.h"
#include "Performance.h"
@@ -68,10 +69,10 @@ public:
* page), if the given TimeStamp is valid. Otherwise, it will return
* the FetchStart timing value.
*/
- inline DOMHighResTimeStamp TimeStampToDOMHighResOrFetchStart(TimeStamp aStamp)
+ inline DOMHighResTimeStamp TimeStampToReducedDOMHighResOrFetchStart(TimeStamp aStamp)
{
return (!aStamp.IsNull())
- ? TimeStampToDOMHighRes(aStamp)
+ ? TimerClamping::ReduceMsTimeValue(TimeStampToDOMHighRes(aStamp))
: FetchStartHighRes();
}
@@ -119,7 +120,7 @@ public:
if (!nsContentUtils::IsPerformanceTimingEnabled()) {
return 0;
}
- return GetDOMTiming()->GetNavigationStart();
+ return TimerClamping::ReduceMsTimeValue(GetDOMTiming()->GetNavigationStart());
}
DOMTimeMilliSec UnloadEventStart()
@@ -127,7 +128,7 @@ public:
if (!nsContentUtils::IsPerformanceTimingEnabled()) {
return 0;
}
- return GetDOMTiming()->GetUnloadEventStart();
+ return TimerClamping::ReduceMsTimeValue(GetDOMTiming()->GetUnloadEventStart());
}
DOMTimeMilliSec UnloadEventEnd()
@@ -135,10 +136,10 @@ public:
if (!nsContentUtils::IsPerformanceTimingEnabled()) {
return 0;
}
- return GetDOMTiming()->GetUnloadEventEnd();
+ return TimerClamping::ReduceMsTimeValue(GetDOMTiming()->GetUnloadEventEnd());
}
- uint16_t GetRedirectCount() const;
+ uint8_t GetRedirectCount() const;
// Checks if the resource is either same origin as the page that started
// the load, or if the response contains the Timing-Allow-Origin header
@@ -154,7 +155,12 @@ public:
// the timing-allow-origin check in HttpBaseChannel::TimingAllowCheck
bool ShouldReportCrossOriginRedirect() const;
+ // The last channel's AsyncOpen time. This may occur before the FetchStart
+ // in some cases.
+ DOMHighResTimeStamp AsyncOpenHighRes();
+
// High resolution (used by resource timing)
+ DOMHighResTimeStamp WorkerStartHighRes();
DOMHighResTimeStamp FetchStartHighRes();
DOMHighResTimeStamp RedirectStartHighRes();
DOMHighResTimeStamp RedirectEndHighRes();
@@ -185,7 +191,7 @@ public:
if (!nsContentUtils::IsPerformanceTimingEnabled()) {
return 0;
}
- return GetDOMTiming()->GetDomLoading();
+ return TimerClamping::ReduceMsTimeValue(GetDOMTiming()->GetDomLoading());
}
DOMTimeMilliSec DomInteractive() const
@@ -193,7 +199,7 @@ public:
if (!nsContentUtils::IsPerformanceTimingEnabled()) {
return 0;
}
- return GetDOMTiming()->GetDomInteractive();
+ return TimerClamping::ReduceMsTimeValue(GetDOMTiming()->GetDomInteractive());
}
DOMTimeMilliSec DomContentLoadedEventStart() const
@@ -201,7 +207,7 @@ public:
if (!nsContentUtils::IsPerformanceTimingEnabled()) {
return 0;
}
- return GetDOMTiming()->GetDomContentLoadedEventStart();
+ return TimerClamping::ReduceMsTimeValue(GetDOMTiming()->GetDomContentLoadedEventStart());
}
DOMTimeMilliSec DomContentLoadedEventEnd() const
@@ -209,7 +215,7 @@ public:
if (!nsContentUtils::IsPerformanceTimingEnabled()) {
return 0;
}
- return GetDOMTiming()->GetDomContentLoadedEventEnd();
+ return TimerClamping::ReduceMsTimeValue(GetDOMTiming()->GetDomContentLoadedEventEnd());
}
DOMTimeMilliSec DomComplete() const
@@ -217,7 +223,7 @@ public:
if (!nsContentUtils::IsPerformanceTimingEnabled()) {
return 0;
}
- return GetDOMTiming()->GetDomComplete();
+ return TimerClamping::ReduceMsTimeValue(GetDOMTiming()->GetDomComplete());
}
DOMTimeMilliSec LoadEventStart() const
@@ -225,7 +231,7 @@ public:
if (!nsContentUtils::IsPerformanceTimingEnabled()) {
return 0;
}
- return GetDOMTiming()->GetLoadEventStart();
+ return TimerClamping::ReduceMsTimeValue(GetDOMTiming()->GetLoadEventStart());
}
DOMTimeMilliSec LoadEventEnd() const
@@ -233,7 +239,15 @@ public:
if (!nsContentUtils::IsPerformanceTimingEnabled()) {
return 0;
}
- return GetDOMTiming()->GetLoadEventEnd();
+ return TimerClamping::ReduceMsTimeValue(GetDOMTiming()->GetLoadEventEnd());
+ }
+
+ DOMTimeMilliSec TimeToNonBlankPaint() const
+ {
+ if (!nsContentUtils::IsPerformanceTimingEnabled()) {
+ return 0;
+ }
+ return TimerClamping::ReduceMsTimeValue(GetDOMTiming()->GetTimeToNonBlankPaint());
}
private:
@@ -252,6 +266,7 @@ private:
DOMHighResTimeStamp mZeroTime;
TimeStamp mAsyncOpen;
+ TimeStamp mWorkerStart;
TimeStamp mRedirectStart;
TimeStamp mRedirectEnd;
TimeStamp mDomainLookupStart;
@@ -264,7 +279,7 @@ private:
TimeStamp mCacheReadStart;
TimeStamp mResponseEnd;
TimeStamp mCacheReadEnd;
- uint16_t mRedirectCount;
+ uint8_t mRedirectCount;
bool mTimingAllowed;
bool mAllRedirectsSameOrigin;
bool mInitialized;
@@ -273,6 +288,8 @@ private:
// redirectEnd attributes. It is false if there were no redirects, or if
// any of the responses didn't pass the timing-allow-check
bool mReportCrossOriginRedirect;
+
+ bool mSecureConnection;
};
} // namespace dom
diff --git a/dom/performance/PerformanceWorker.cpp b/dom/performance/PerformanceWorker.cpp
index 85ca2ccd82..f10c58446b 100644
--- a/dom/performance/PerformanceWorker.cpp
+++ b/dom/performance/PerformanceWorker.cpp
@@ -23,37 +23,6 @@ PerformanceWorker::~PerformanceWorker()
mWorkerPrivate->AssertIsOnWorkerThread();
}
-DOMHighResTimeStamp
-PerformanceWorker::Now() const
-{
- TimeDuration duration =
- TimeStamp::Now() - mWorkerPrivate->NowBaseTimeStamp();
- return RoundTime(duration.ToMilliseconds());
-}
-
-// To be removed once bug 1124165 lands
-bool
-PerformanceWorker::IsPerformanceTimingAttribute(const nsAString& aName)
-{
- // In workers we just support navigationStart.
- return aName.EqualsASCII("navigationStart");
-}
-
-DOMHighResTimeStamp
-PerformanceWorker::GetPerformanceTimingFromString(const nsAString& aProperty)
-{
- if (!IsPerformanceTimingAttribute(aProperty)) {
- return 0;
- }
-
- if (aProperty.EqualsLiteral("navigationStart")) {
- return mWorkerPrivate->NowBaseTime();
- }
-
- MOZ_CRASH("IsPerformanceTimingAttribute and GetPerformanceTimingFromString are out of sync");
- return 0;
-}
-
void
PerformanceWorker::InsertUserEntry(PerformanceEntry* aEntry)
{
@@ -72,13 +41,13 @@ PerformanceWorker::InsertUserEntry(PerformanceEntry* aEntry)
TimeStamp
PerformanceWorker::CreationTimeStamp() const
{
- return mWorkerPrivate->NowBaseTimeStamp();
+ return mWorkerPrivate->CreationTimeStamp();
}
DOMHighResTimeStamp
PerformanceWorker::CreationTime() const
{
- return mWorkerPrivate->NowBaseTime();
+ return mWorkerPrivate->CreationTime();
}
} // dom namespace
diff --git a/dom/performance/PerformanceWorker.h b/dom/performance/PerformanceWorker.h
index 7eef0d9748..346bdd0260 100644
--- a/dom/performance/PerformanceWorker.h
+++ b/dom/performance/PerformanceWorker.h
@@ -21,9 +21,6 @@ class PerformanceWorker final : public Performance
public:
explicit PerformanceWorker(workers::WorkerPrivate* aWorkerPrivate);
- // Performance WebIDL methods
- DOMHighResTimeStamp Now() const override;
-
virtual PerformanceTiming* Timing() override
{
MOZ_CRASH("This should not be called on workers.");
@@ -64,12 +61,6 @@ public:
return nullptr;
}
- virtual Performance* GetParentPerformance() const override
- {
- MOZ_CRASH("This should not be called on workers.");
- return nullptr;
- }
-
protected:
~PerformanceWorker();
@@ -80,11 +71,6 @@ protected:
void InsertUserEntry(PerformanceEntry* aEntry) override;
- bool IsPerformanceTimingAttribute(const nsAString& aName) override;
-
- DOMHighResTimeStamp
- GetPerformanceTimingFromString(const nsAString& aTimingName) override;
-
void DispatchBufferFullEvent() override
{
MOZ_CRASH("This should not be called on workers.");
diff --git a/dom/performance/moz.build b/dom/performance/moz.build
index 3286a0a4c7..e1f96fec84 100644
--- a/dom/performance/moz.build
+++ b/dom/performance/moz.build
@@ -10,9 +10,11 @@ EXPORTS.mozilla.dom += [
'PerformanceMark.h',
'PerformanceMeasure.h',
'PerformanceNavigation.h',
+ 'PerformanceNavigationTiming.h',
'PerformanceObserver.h',
'PerformanceObserverEntryList.h',
'PerformanceResourceTiming.h',
+ 'PerformanceService.h',
'PerformanceTiming.h',
]
@@ -23,9 +25,11 @@ UNIFIED_SOURCES += [
'PerformanceMark.cpp',
'PerformanceMeasure.cpp',
'PerformanceNavigation.cpp',
+ 'PerformanceNavigationTiming.cpp',
'PerformanceObserver.cpp',
'PerformanceObserverEntryList.cpp',
'PerformanceResourceTiming.cpp',
+ 'PerformanceService.cpp',
'PerformanceTiming.cpp',
'PerformanceWorker.cpp',
]
diff --git a/dom/performance/tests/mochitest.ini b/dom/performance/tests/mochitest.ini
index 18f7f0e455..bee0b2e700 100644
--- a/dom/performance/tests/mochitest.ini
+++ b/dom/performance/tests/mochitest.ini
@@ -1,13 +1,11 @@
[DEFAULT]
support-files =
- performance_observer.html
test_performance_observer.js
test_performance_user_timing.js
test_worker_performance_now.js
worker_performance_user_timing.js
worker_performance_observer.js
sharedworker_performance_user_timing.js
- worker_performance_observer.html
[test_performance_observer.html]
[test_performance_user_timing.html]
@@ -15,3 +13,4 @@ support-files =
[test_worker_observer.html]
[test_sharedWorker_performance_user_timing.html]
[test_worker_performance_now.html]
+[test_timeOrigin.html]
diff --git a/dom/performance/tests/performance_observer.html b/dom/performance/tests/performance_observer.html
deleted file mode 100644
index b8ced9296c..0000000000
--- a/dom/performance/tests/performance_observer.html
+++ /dev/null
@@ -1,74 +0,0 @@
-<!--
- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/
--->
-<!DOCTYPE html>
-<meta charset=utf-8>
-<html>
-<head>
-<title>Test for performance observer</title>
-<script>
-'use strict';
-[
- "promise_test", "test", "setup",
- "assert_true", "assert_equals", "assert_array_equals",
- "assert_throws", "assert_unreached"
-].forEach(func => {
- window[func] = opener[func].bind(opener);
-});
-function done() {
- opener.add_completion_callback(() => {
- self.close();
- });
- opener.done();
-}
-
-</script>
-<script src="test_performance_observer.js"></script>
-</head>
-<body>
-<div id="log"></div>
-<script>
-function makeXHR(aUrl) {
- var xmlhttp = new XMLHttpRequest();
- xmlhttp.open("get", aUrl, true);
- xmlhttp.send();
-}
-
-promise_test(t => {
- var promise = new Promise(resolve => {
- performance.clearResourceTimings();
-
- var observer = new PerformanceObserver(list => resolve(list));
- observer.observe({entryTypes: ['resource']});
- t.add_cleanup(() => observer.disconnect());
- });
-
- makeXHR("test-data.json");
-
- return promise.then(list => {
- assert_equals(list.getEntries().length, 1);
- assert_array_equals(list.getEntries(),
- performance.getEntriesByType("resource"),
- "Observed 'resource' entries should equal to entries obtained by getEntriesByType.");
-
- // getEntries filtering tests
- assert_array_equals(list.getEntries({name: "http://mochi.test:8888/tests/dom/base/test/test-data.json"}),
- performance.getEntriesByName("http://mochi.test:8888/tests/dom/base/test/test-data.json"),
- "getEntries with name filter should return correct results.");
- assert_array_equals(list.getEntries({entryType: "resource"}),
- performance.getEntriesByType("resource"),
- "getEntries with entryType filter should return correct results.");
- assert_array_equals(list.getEntries({initiatorType: "xmlhttprequest"}),
- performance.getEntriesByType("resource"),
- "getEntries with initiatorType filter should return correct results.");
- assert_array_equals(list.getEntries({initiatorType: "link"}),
- [],
- "getEntries with non-existent initiatorType filter should return an empty array.");
- });
-}, "resource-timing test");
-
-done();
-
-</script>
-</body>
diff --git a/dom/performance/tests/test_performance_observer.html b/dom/performance/tests/test_performance_observer.html
index d368783155..7df881bd48 100644
--- a/dom/performance/tests/test_performance_observer.html
+++ b/dom/performance/tests/test_performance_observer.html
@@ -3,15 +3,55 @@
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
+<html>
+<head>
<meta charset=utf-8>
<title>Test for performance observer</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
-<div id=log></div>
+</head>
+<body>
+<div id="log"></div>
+<script src="test_performance_observer.js"></script>
<script>
-'use strict';
-SpecialPowers.pushPrefEnv({"set": [["dom.enable_performance_observer", true]]},
- function() {
- window.open("performance_observer.html");
- });
+function makeXHR(aUrl) {
+ var xmlhttp = new XMLHttpRequest();
+ xmlhttp.open("get", aUrl, true);
+ xmlhttp.send();
+}
+
+promise_test(t => {
+ var promise = new Promise(resolve => {
+ performance.clearResourceTimings();
+
+ var observer = new PerformanceObserver(list => resolve(list));
+ observer.observe({entryTypes: ['resource']});
+ t.add_cleanup(() => observer.disconnect());
+ });
+
+ makeXHR("test-data.json");
+
+ return promise.then(list => {
+ assert_equals(list.getEntries().length, 1);
+ assert_array_equals(list.getEntries(),
+ performance.getEntriesByType("resource"),
+ "Observed 'resource' entries should equal to entries obtained by getEntriesByType.");
+
+ // getEntries filtering tests
+ assert_array_equals(list.getEntries({name: "http://mochi.test:8888/tests/dom/base/test/test-data.json"}),
+ performance.getEntriesByName("http://mochi.test:8888/tests/dom/base/test/test-data.json"),
+ "getEntries with name filter should return correct results.");
+ assert_array_equals(list.getEntries({entryType: "resource"}),
+ performance.getEntriesByType("resource"),
+ "getEntries with entryType filter should return correct results.");
+ assert_array_equals(list.getEntries({initiatorType: "xmlhttprequest"}),
+ performance.getEntriesByType("resource"),
+ "getEntries with initiatorType filter should return correct results.");
+ assert_array_equals(list.getEntries({initiatorType: "link"}),
+ [],
+ "getEntries with non-existent initiatorType filter should return an empty array.");
+ });
+}, "resource-timing test");
+
</script>
+</body>
diff --git a/dom/performance/tests/test_performance_user_timing.js b/dom/performance/tests/test_performance_user_timing.js
index 3d05ebb77c..a15dbebb64 100644
--- a/dom/performance/tests/test_performance_user_timing.js
+++ b/dom/performance/tests/test_performance_user_timing.js
@@ -126,15 +126,18 @@ var steps = [
},
// Test measure
function () {
- ok(true, "Running measure addition with no start/end time test");
- performance.measure("test");
- var measures = performance.getEntriesByType("measure");
- is(measures.length, 1, "number of measures should be 1");
- var measure = measures[0];
- is(measure.name, "test", "measure name should be 'test'");
- is(measure.entryType, "measure", "measure type should be 'measure'");
- is(measure.startTime, 0, "measure start time should be zero");
- ok(measure.duration >= 0, "measure duration should not be negative");
+ // We don't have navigationStart in workers.
+ if ("window" in self) {
+ ok(true, "Running measure addition with no start/end time test");
+ performance.measure("test", "navigationStart");
+ var measures = performance.getEntriesByType("measure");
+ is(measures.length, 1, "number of measures should be 1");
+ var measure = measures[0];
+ is(measure.name, "test", "measure name should be 'test'");
+ is(measure.entryType, "measure", "measure type should be 'measure'");
+ is(measure.startTime, 0, "measure start time should be zero");
+ ok(measure.duration >= 0, "measure duration should not be negative");
+ }
},
function () {
ok(true, "Running measure addition with only start time test");
@@ -263,7 +266,7 @@ var steps = [
performance.measure("test", n);
ok(true, "Measure created from reserved name as starting time: " + n);
} catch (e) {
- ok(["redirectStart", "redirectEnd", "unloadEventStart", "unloadEventEnd", "loadEventEnd"].indexOf(n) >= 0,
+ ok(["redirectStart", "redirectEnd", "unloadEventStart", "unloadEventEnd", "loadEventEnd", "secureConnectionStart"].indexOf(n) >= 0,
"Measure created from reserved name as starting time: " + n + " and threw expected error");
}
};
diff --git a/dom/performance/tests/test_timeOrigin.html b/dom/performance/tests/test_timeOrigin.html
new file mode 100644
index 0000000000..5a8a461f30
--- /dev/null
+++ b/dom/performance/tests/test_timeOrigin.html
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <title>Test for performance.timeOrigin</title>
+ <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="test_performance_user_timing.js"></script>
+ </head>
+ <body>
+ <script type="text/js-worker" id="worker-src">
+ postMessage({ now: performance.now(), timeOrigin: performance.timeOrigin });
+ </script>
+
+ <script type="text/js-worker" id="shared-worker-src">
+ onconnect = function(evt) {
+ evt.ports[0].postMessage({ now: performance.now(), timeOrigin: performance.timeOrigin });
+ };
+ </script>
+
+ <script class="testbody" type="text/javascript">
+
+function testBasic() {
+ ok("timeOrigin" in performance, "Performance.timeOrigin exists.");
+ ok(performance.timeOrigin > 0, "TimeOrigin must be greater than 0.");
+ next();
+}
+
+function testWorker() {
+ var now = performance.now();
+
+ var blob = new Blob([ document.getElementById("worker-src").textContent ],
+ { type: "text/javascript" });
+ var w = new Worker(URL.createObjectURL(blob));
+ w.onmessage = function(e) {
+ ok (e.now + e.timeOrigin > now + performance.now, "Comparing worker.now and window.now");
+ next();
+ }
+}
+
+function testSharedWorker() {
+ var now = performance.now();
+
+ var blob = new Blob([ document.getElementById("shared-worker-src").textContent ],
+ { type: "text/javascript" });
+ var w = new SharedWorker(URL.createObjectURL(blob));
+ w.port.onmessage = function(e) {
+ ok (e.now + e.timeOrigin > now + performance.now, "Comparing worker.now and window.now");
+ next();
+ }
+}
+
+var tests = [ testBasic, testWorker, testSharedWorker ];
+function next() {
+ if (!tests.length) {
+ SimpleTest.finish();
+ return;
+ }
+
+ var test = tests.shift();
+ test();
+}
+
+SimpleTest.waitForExplicitFinish();
+addLoadEvent(next);
+ </script>
+ </pre>
+ </body>
+</html>
diff --git a/dom/performance/tests/test_worker_observer.html b/dom/performance/tests/test_worker_observer.html
index b9ed0c9646..9a55ef1d5a 100644
--- a/dom/performance/tests/test_worker_observer.html
+++ b/dom/performance/tests/test_worker_observer.html
@@ -3,15 +3,16 @@
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!DOCTYPE html>
+<html>
+<head>
<meta charset=utf-8>
<title>Test for performance observer in worker</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
-<div id=log></div>
+</head>
+<body>
+<div id="log"></div>
<script>
-'use strict';
-SpecialPowers.pushPrefEnv({"set": [["dom.enable_performance_observer", true]]},
- function() {
- window.open("worker_performance_observer.html");
- });
+fetch_tests_from_worker(new Worker("worker_performance_observer.js"));
</script>
+</body>
diff --git a/dom/performance/tests/test_worker_performance_now.js b/dom/performance/tests/test_worker_performance_now.js
index c2a9050319..dee4efce68 100644
--- a/dom/performance/tests/test_worker_performance_now.js
+++ b/dom/performance/tests/test_worker_performance_now.js
@@ -26,51 +26,5 @@ var n = self.performance.now(), d = Date.now();
ok(n >= 0, "The value of now() should be equal to or greater than 0.");
ok(self.performance.now() >= n, "The value of now() should monotonically increase.");
-// The spec says performance.now() should have micro-second resolution, but allows 1ms if the platform doesn't support it.
-// Our implementation does provide micro-second resolution, except for windows XP combined with some HW properties
-// where we can't use QueryPerformanceCounters (see comments at mozilla-central/xpcom/ds/TimeStamp_windows.cpp).
-// This XP-low-res case results in about 15ms resolutions, and can be identified when perf.now() returns only integers.
-//
-// Since setTimeout might return too early/late, our goal is that perf.now() changed within 2ms
-// (or 25ms for XP-low-res), rather than specific number of setTimeout(N) invocations.
-// See bug 749894 (intermittent failures of this test)
-var platformPossiblyLowRes;
-workerTestGetOSCPU(function(oscpu) {
- platformPossiblyLowRes = oscpu.indexOf("Windows NT 5.1") == 0; // XP only
- setTimeout(checkAfterTimeout, 1);
-});
-var allInts = (n % 1) == 0; // Indicator of limited HW resolution.
-var checks = 0;
+workerTestDone();
-function checkAfterTimeout() {
- checks++;
- var d2 = Date.now();
- var n2 = self.performance.now();
-
- allInts = allInts && (n2 % 1) == 0;
- var lowResCounter = platformPossiblyLowRes && allInts;
-
- if ( n2 == n && checks < 50 && // 50 is just a failsafe. Our real goals are 2ms or 25ms.
- ( (d2 - d) < 2 // The spec allows 1ms resolution. We allow up to measured 2ms to ellapse.
- ||
- lowResCounter &&
- (d2 - d) < 25
- )
- ) {
- setTimeout(checkAfterTimeout, 1);
- return;
- }
-
- // Loose spec: 1ms resolution, or 15ms resolution for the XP-low-res case.
- // We shouldn't test that dt is actually within 2/25ms since the iterations break if it isn't, and timeout could be late.
- ok(n2 > n, "Loose - the value of now() should increase within 2ms (or 25ms if low-res counter) (delta now(): " + (n2 - n) + " ms).");
-
- // Strict spec: if it's not the XP-low-res case, while the spec allows 1ms resolution, it prefers microseconds, which we provide.
- // Since the fastest setTimeout return which I observed was ~500 microseconds, a microseconds counter should change in 1 iteretion.
- ok(n2 > n && (lowResCounter || checks == 1),
- "Strict - [if high-res counter] the value of now() should increase after one setTimeout (hi-res: " + (!lowResCounter) +
- ", iters: " + checks +
- ", dt: " + (d2 - d) +
- ", now(): " + n2 + ").");
- workerTestDone();
-};
diff --git a/dom/performance/tests/worker_performance_observer.html b/dom/performance/tests/worker_performance_observer.html
deleted file mode 100644
index 613762f521..0000000000
--- a/dom/performance/tests/worker_performance_observer.html
+++ /dev/null
@@ -1,32 +0,0 @@
-<!--
- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/
--->
-<!DOCTYPE html>
-<meta charset=utf-8>
-<html>
-<head>
-<title>Test for performance observer in worker</title>
-</head>
-<body>
-<div id="log"></div>
-<script>
-[
- "async_test", "test", "setup",
- "assert_true", "assert_equals", "assert_array_equals",
- "assert_throws", "fetch_tests_from_worker"
-].forEach(func => {
- window[func] = opener[func].bind(opener);
-});
-
-function done() {
- opener.add_completion_callback(() => {
- self.close();
- });
- opener.done();
-}
-
-fetch_tests_from_worker(new Worker("worker_performance_observer.js"));
-done();
-</script>
-</body>
diff --git a/dom/plugins/base/nsPluginHost.cpp b/dom/plugins/base/nsPluginHost.cpp
index bd71d6f654..916bdea0fb 100644
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -109,10 +109,6 @@
#define LOG(args...) __android_log_print(ANDROID_LOG_INFO, "GeckoPlugins" , ## args)
#endif
-#if MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
-
#include "npapi.h"
using namespace mozilla;
@@ -962,12 +958,6 @@ nsPluginHost::TrySetUpPluginInstance(const nsACString &aMimeType,
plugin->GetLibrary()->SetHasLocalInstance();
-#if defined(MOZ_WIDGET_ANDROID) && defined(MOZ_CRASHREPORTER)
- if (pluginTag->mIsFlashPlugin) {
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("FlashVersion"), pluginTag->Version());
- }
-#endif
-
RefPtr<nsNPAPIPluginInstance> instance = new nsNPAPIPluginInstance();
// This will create the owning reference. The connection must be made between the
diff --git a/dom/plugins/base/nsPluginInstanceOwner.cpp b/dom/plugins/base/nsPluginInstanceOwner.cpp
index b7651be1ad..291ae576dc 100644
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -2532,6 +2532,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
NS_ASSERTION(anEvent.mMessage == eMouseDown ||
anEvent.mMessage == eMouseUp ||
anEvent.mMessage == eMouseDoubleClick ||
+ anEvent.mMessage == eMouseAuxClick ||
anEvent.mMessage == eMouseOver ||
anEvent.mMessage == eMouseOut ||
anEvent.mMessage == eMouseMove ||
@@ -2594,6 +2595,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
switch (anEvent.mMessage) {
case eMouseClick:
case eMouseDoubleClick:
+ case eMouseAuxClick:
// Button up/down events sent instead.
return rv;
default:
@@ -2797,6 +2799,7 @@ nsEventStatus nsPluginInstanceOwner::ProcessEvent(const WidgetGUIEvent& anEvent)
switch (anEvent.mMessage) {
case eMouseClick:
case eMouseDoubleClick:
+ case eMouseAuxClick:
// Button up/down events sent instead.
return rv;
default:
diff --git a/dom/plugins/base/nsPluginsDirDarwin.cpp b/dom/plugins/base/nsPluginsDirDarwin.cpp
index 6edc4fd6a2..0085eec0d6 100644
--- a/dom/plugins/base/nsPluginsDirDarwin.cpp
+++ b/dom/plugins/base/nsPluginsDirDarwin.cpp
@@ -26,9 +26,6 @@
#include "mozilla/UniquePtr.h"
#include "nsCocoaFeatures.h"
-#if defined(MOZ_CRASHREPORTER)
-#include "nsExceptionHandler.h"
-#endif
#include <string.h>
#include <stdio.h>
@@ -487,14 +484,6 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info, PRLibrary **outLibrary)
NS_WARNING(msg.get());
return NS_ERROR_FAILURE;
}
-#if defined(MOZ_CRASHREPORTER)
- // The block above assumes that "fbplugin" is the filename of the plugin
- // to be blocked, or that the filename starts with "fbplugin_". But we
- // don't yet know for sure if this is always true. So for the time being
- // record extra information in our crash logs.
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Bug_1086977"),
- fileName);
-#endif
}
// It's possible that our plugin has 2 entry points that'll give us mime type
@@ -504,14 +493,6 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info, PRLibrary **outLibrary)
// Sadly we have to load the library for this to work.
rv = LoadPlugin(outLibrary);
-#if defined(MOZ_CRASHREPORTER)
- if (nsCocoaFeatures::OnYosemiteOrLater()) {
- // If we didn't crash in LoadPlugin(), change the previous annotation so we
- // don't sow confusion.
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Bug_1086977"),
- NS_LITERAL_CSTRING("Didn't crash, please ignore"));
- }
-#endif
if (NS_FAILED(rv))
return rv;
diff --git a/dom/plugins/ipc/PluginMessageUtils.h b/dom/plugins/ipc/PluginMessageUtils.h
index 55be59d621..4532fac93a 100644
--- a/dom/plugins/ipc/PluginMessageUtils.h
+++ b/dom/plugins/ipc/PluginMessageUtils.h
@@ -23,9 +23,6 @@
#include "nsTArray.h"
#include "mozilla/Logging.h"
#include "nsHashKeys.h"
-#ifdef MOZ_CRASHREPORTER
-# include "nsExceptionHandler.h"
-#endif
#ifdef XP_MACOSX
#include "PluginInterposeOSX.h"
#else
diff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp
index 84dc7c71f2..7350a7fa73 100644
--- a/dom/plugins/ipc/PluginModuleChild.cpp
+++ b/dom/plugins/ipc/PluginModuleChild.cpp
@@ -753,10 +753,6 @@ PluginModuleChild::AnswerPCrashReporterConstructor(
mozilla::dom::NativeThreadId* id,
uint32_t* processType)
{
-#ifdef MOZ_CRASHREPORTER
- *id = CrashReporter::CurrentThreadId();
- *processType = XRE_GetProcessType();
-#endif
return true;
}
diff --git a/dom/plugins/ipc/PluginModuleParent.cpp b/dom/plugins/ipc/PluginModuleParent.cpp
index b85a3e94bb..73f9c10259 100755
--- a/dom/plugins/ipc/PluginModuleParent.cpp
+++ b/dom/plugins/ipc/PluginModuleParent.cpp
@@ -74,12 +74,6 @@ using namespace mozilla;
using namespace mozilla::plugins;
using namespace mozilla::plugins::parent;
-#ifdef MOZ_CRASHREPORTER
-#include "mozilla/dom/CrashReporterParent.h"
-
-using namespace CrashReporter;
-#endif
-
static const char kContentTimeoutPref[] = "dom.ipc.plugins.contentTimeoutSecs";
static const char kChildTimeoutPref[] = "dom.ipc.plugins.timeoutSecs";
static const char kParentTimeoutPref[] = "dom.ipc.plugins.parentTimeoutSecs";
@@ -134,66 +128,6 @@ mozilla::plugins::SetupBridge(uint32_t aPluginId,
return true;
}
-#ifdef MOZ_CRASHREPORTER_INJECTOR
-
-/**
- * Use for executing CreateToolhelp32Snapshot off main thread
- */
-class mozilla::plugins::FinishInjectorInitTask : public mozilla::CancelableRunnable
-{
-public:
- FinishInjectorInitTask()
- : mMutex("FlashInjectorInitTask::mMutex")
- , mParent(nullptr)
- , mMainThreadMsgLoop(MessageLoop::current())
- {
- MOZ_ASSERT(NS_IsMainThread());
- }
-
- void Init(PluginModuleChromeParent* aParent)
- {
- MOZ_ASSERT(aParent);
- mParent = aParent;
- }
-
- void PostToMainThread()
- {
- RefPtr<Runnable> self = this;
- mSnapshot.own(CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0));
- { // Scope for lock
- mozilla::MutexAutoLock lock(mMutex);
- if (mMainThreadMsgLoop) {
- mMainThreadMsgLoop->PostTask(self.forget());
- }
- }
- }
-
- NS_IMETHOD Run() override
- {
- mParent->DoInjection(mSnapshot);
- // We don't need to hold this lock during DoInjection, but we do need
- // to obtain it before returning from Run() to ensure that
- // PostToMainThread has completed before we return.
- mozilla::MutexAutoLock lock(mMutex);
- return NS_OK;
- }
-
- nsresult Cancel() override
- {
- mozilla::MutexAutoLock lock(mMutex);
- mMainThreadMsgLoop = nullptr;
- return NS_OK;
- }
-
-private:
- mozilla::Mutex mMutex;
- nsAutoHandle mSnapshot;
- PluginModuleChromeParent* mParent;
- MessageLoop* mMainThreadMsgLoop;
-};
-
-#endif // MOZ_CRASHREPORTER_INJECTOR
-
namespace {
/**
@@ -578,29 +512,6 @@ PluginModuleChromeParent::OnProcessLaunched(const bool aSucceeded)
RegisterSettingsCallbacks();
-#ifdef MOZ_CRASHREPORTER
- // If this fails, we're having IPC troubles, and we're doomed anyways.
- if (!CrashReporterParent::CreateCrashReporter(this)) {
- mShutdown = true;
- Close();
- OnInitFailure();
- return;
- }
- CrashReporterParent* crashReporter = CrashReporter();
- if (crashReporter) {
- crashReporter->AnnotateCrashReport(NS_LITERAL_CSTRING("AsyncPluginInit"),
- mIsStartingAsync ?
- NS_LITERAL_CSTRING("1") :
- NS_LITERAL_CSTRING("0"));
- }
-#ifdef XP_WIN
- { // Scope for lock
- mozilla::MutexAutoLock lock(mCrashReporterMutex);
- mCrashReporter = CrashReporter();
- }
-#endif
-#endif
-
#if defined(XP_WIN) && defined(_X86_)
// Protected mode only applies to Windows and only to x86.
if (!mIsBlocklisted && mIsFlashPlugin &&
@@ -686,12 +597,6 @@ PluginModuleParent::PluginModuleParent(bool aIsChrome, bool aAllowAsyncInit)
, mIsNPShutdownPending(false)
, mAsyncNewRv(NS_ERROR_NOT_INITIALIZED)
{
-#if defined(MOZ_CRASHREPORTER)
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AsyncPluginInit"),
- mIsStartingAsync ?
- NS_LITERAL_CSTRING("1") :
- NS_LITERAL_CSTRING("0"));
-#endif
}
PluginModuleParent::~PluginModuleParent()
@@ -734,15 +639,6 @@ PluginModuleChromeParent::PluginModuleChromeParent(const char* aFilePath,
, mHangUIParent(nullptr)
, mHangUIEnabled(true)
, mIsTimerReset(true)
-#ifdef MOZ_CRASHREPORTER
- , mCrashReporterMutex("PluginModuleChromeParent::mCrashReporterMutex")
- , mCrashReporter(nullptr)
-#endif
-#endif
-#ifdef MOZ_CRASHREPORTER_INJECTOR
- , mFlashProcess1(0)
- , mFlashProcess2(0)
- , mFinishInitTask(nullptr)
#endif
, mInitOnAsyncConnect(false)
, mAsyncInitRv(NS_ERROR_NOT_INITIALIZED)
@@ -790,17 +686,6 @@ PluginModuleChromeParent::~PluginModuleChromeParent()
mSubprocess = nullptr;
}
-#ifdef MOZ_CRASHREPORTER_INJECTOR
- if (mFlashProcess1)
- UnregisterInjectorCallback(mFlashProcess1);
- if (mFlashProcess2)
- UnregisterInjectorCallback(mFlashProcess2);
- if (mFinishInitTask) {
- // mFinishInitTask will be deleted by the main thread message_loop
- mFinishInitTask->Cancel();
- }
-#endif
-
UnregisterSettingsCallbacks();
Preferences::UnregisterCallback(TimeoutChanged, kChildTimeoutPref, this);
@@ -818,52 +703,6 @@ PluginModuleChromeParent::~PluginModuleChromeParent()
mozilla::HangMonitor::UnregisterAnnotator(*this);
}
-#ifdef MOZ_CRASHREPORTER
-void
-PluginModuleChromeParent::WriteExtraDataForMinidump(AnnotationTable& notes)
-{
-#ifdef XP_WIN
- // mCrashReporterMutex is already held by the caller
- mCrashReporterMutex.AssertCurrentThreadOwns();
-#endif
- typedef nsDependentCString CS;
-
- // Get the plugin filename, try to get just the file leafname
- const std::string& pluginFile = mSubprocess->GetPluginFilePath();
- size_t filePos = pluginFile.rfind(FILE_PATH_SEPARATOR);
- if (filePos == std::string::npos)
- filePos = 0;
- else
- filePos++;
- notes.Put(NS_LITERAL_CSTRING("PluginFilename"), CS(pluginFile.substr(filePos).c_str()));
-
- notes.Put(NS_LITERAL_CSTRING("PluginName"), mPluginName);
- notes.Put(NS_LITERAL_CSTRING("PluginVersion"), mPluginVersion);
-
- CrashReporterParent* crashReporter = CrashReporter();
- if (crashReporter) {
-#ifdef XP_WIN
- if (mPluginCpuUsageOnHang.Length() > 0) {
- notes.Put(NS_LITERAL_CSTRING("NumberOfProcessors"),
- nsPrintfCString("%d", PR_GetNumberOfProcessors()));
-
- nsCString cpuUsageStr;
- cpuUsageStr.AppendFloat(std::ceil(mPluginCpuUsageOnHang[0] * 100) / 100);
- notes.Put(NS_LITERAL_CSTRING("PluginCpuUsage"), cpuUsageStr);
-
-#ifdef MOZ_CRASHREPORTER_INJECTOR
- for (uint32_t i=1; i<mPluginCpuUsageOnHang.Length(); ++i) {
- nsCString tempStr;
- tempStr.AppendFloat(std::ceil(mPluginCpuUsageOnHang[i] * 100) / 100);
- notes.Put(nsPrintfCString("CpuUsageFlashProcess%d", i), tempStr);
- }
-#endif
- }
-#endif
- }
-}
-#endif // MOZ_CRASHREPORTER
-
void
PluginModuleParent::SetChildTimeout(const int32_t aChildTimeout)
{
@@ -1123,20 +962,6 @@ PluginModuleChromeParent::AnnotateHang(mozilla::HangMonitor::HangAnnotations& aA
}
}
-#ifdef MOZ_CRASHREPORTER
-static bool
-CreatePluginMinidump(base::ProcessId processId, ThreadId childThread,
- nsIFile* parentMinidump, const nsACString& name)
-{
- mozilla::ipc::ScopedProcessHandle handle;
- if (processId == 0 ||
- !base::OpenPrivilegedProcessHandle(processId, &handle.rwget())) {
- return false;
- }
- return CreateAdditionalChildMinidump(handle, 0, parentMinidump, name);
-}
-#endif
-
bool
PluginModuleChromeParent::ShouldContinueFromReplyTimeout()
{
@@ -1184,87 +1009,7 @@ PluginModuleChromeParent::TakeFullMinidump(base::ProcessId aContentPid,
const nsAString& aBrowserDumpId,
nsString& aDumpId)
{
-#ifdef MOZ_CRASHREPORTER
-#ifdef XP_WIN
- mozilla::MutexAutoLock lock(mCrashReporterMutex);
-#endif // XP_WIN
-
- CrashReporterParent* crashReporter = CrashReporter();
- if (!crashReporter) {
- return;
- }
-
- bool reportsReady = false;
-
- // Check to see if we already have a browser dump id - with e10s plugin
- // hangs we take this earlier (see ProcessHangMonitor) from a background
- // thread. We do this before we message the main thread about the hang
- // since the posted message will trash our browser stack state.
- bool exists;
- nsCOMPtr<nsIFile> browserDumpFile;
- if (!aBrowserDumpId.IsEmpty() &&
- CrashReporter::GetMinidumpForID(aBrowserDumpId, getter_AddRefs(browserDumpFile)) &&
- browserDumpFile &&
- NS_SUCCEEDED(browserDumpFile->Exists(&exists)) && exists)
- {
- // We have a single browser report, generate a new plugin process parent
- // report and pair it up with the browser report handed in.
- reportsReady = crashReporter->GenerateMinidumpAndPair(this, browserDumpFile,
- NS_LITERAL_CSTRING("browser"));
- if (!reportsReady) {
- browserDumpFile = nullptr;
- CrashReporter::DeleteMinidumpFilesForID(aBrowserDumpId);
- }
- }
-
- // Generate crash report including plugin and browser process minidumps.
- // The plugin process is the parent report with additional dumps including
- // the browser process, content process when running under e10s, and
- // various flash subprocesses if we're the flash module.
- if (!reportsReady) {
- reportsReady = crashReporter->GeneratePairedMinidump(this);
- }
-
- if (reportsReady) {
- // Important to set this here, it tells the ActorDestroy handler
- // that we have an existing crash report that needs to be finalized.
- mPluginDumpID = crashReporter->ChildDumpID();
- aDumpId = mPluginDumpID;
- PLUGIN_LOG_DEBUG(
- ("generated paired browser/plugin minidumps: %s)",
- NS_ConvertUTF16toUTF8(mPluginDumpID).get()));
- nsAutoCString additionalDumps("browser");
- nsCOMPtr<nsIFile> pluginDumpFile;
- if (GetMinidumpForID(mPluginDumpID, getter_AddRefs(pluginDumpFile)) &&
- pluginDumpFile) {
-#ifdef MOZ_CRASHREPORTER_INJECTOR
- // If we have handles to the flash sandbox processes on Windows,
- // include those minidumps as well.
- if (CreatePluginMinidump(mFlashProcess1, 0, pluginDumpFile,
- NS_LITERAL_CSTRING("flash1"))) {
- additionalDumps.AppendLiteral(",flash1");
- }
- if (CreatePluginMinidump(mFlashProcess2, 0, pluginDumpFile,
- NS_LITERAL_CSTRING("flash2"))) {
- additionalDumps.AppendLiteral(",flash2");
- }
-#endif // MOZ_CRASHREPORTER_INJECTOR
- if (aContentPid != mozilla::ipc::kInvalidProcessId) {
- // Include the content process minidump
- if (CreatePluginMinidump(aContentPid, 0,
- pluginDumpFile,
- NS_LITERAL_CSTRING("content"))) {
- additionalDumps.AppendLiteral(",content");
- }
- }
- }
- crashReporter->AnnotateCrashReport(
- NS_LITERAL_CSTRING("additional_minidumps"),
- additionalDumps);
- } else {
- NS_WARNING("failed to capture paired minidumps from hang");
- }
-#endif // MOZ_CRASHREPORTER
+ /*** STUB ***/
}
void
@@ -1273,43 +1018,6 @@ PluginModuleChromeParent::TerminateChildProcess(MessageLoop* aMsgLoop,
const nsCString& aMonitorDescription,
const nsAString& aDumpId)
{
-#ifdef MOZ_CRASHREPORTER
- // Start by taking a full minidump if necessary, this is done early
- // because it also needs to lock the mCrashReporterMutex and Mutex doesn't
- // support recrusive locking.
- nsAutoString dumpId;
- if (aDumpId.IsEmpty()) {
- TakeFullMinidump(aContentPid, EmptyString(), dumpId);
- }
-
-#ifdef XP_WIN
- mozilla::MutexAutoLock lock(mCrashReporterMutex);
- CrashReporterParent* crashReporter = mCrashReporter;
- if (!crashReporter) {
- // If mCrashReporter is null then the hang has ended, the plugin module
- // is shutting down. There's nothing to do here.
- return;
- }
-#else
- CrashReporterParent* crashReporter = CrashReporter();
-#endif // XP_WIN
- crashReporter->AnnotateCrashReport(NS_LITERAL_CSTRING("PluginHang"),
- NS_LITERAL_CSTRING("1"));
- crashReporter->AnnotateCrashReport(NS_LITERAL_CSTRING("HangMonitorDescription"),
- aMonitorDescription);
-#ifdef XP_WIN
- if (mHangUIParent) {
- unsigned int hangUIDuration = mHangUIParent->LastShowDurationMs();
- if (hangUIDuration) {
- nsPrintfCString strHangUIDuration("%u", hangUIDuration);
- crashReporter->AnnotateCrashReport(
- NS_LITERAL_CSTRING("PluginHangUIDuration"),
- strHangUIDuration);
- }
- }
-#endif // XP_WIN
-#endif // MOZ_CRASHREPORTER
-
mozilla::ipc::ScopedProcessHandle geckoChildProcess;
bool childOpened = base::OpenProcessHandle(OtherPid(),
&geckoChildProcess.rwget());
@@ -1323,19 +1031,6 @@ PluginModuleChromeParent::TerminateChildProcess(MessageLoop* aMsgLoop,
processHandles.AppendElement(geckoChildProcess);
}
-#ifdef MOZ_CRASHREPORTER_INJECTOR
- mozilla::ipc::ScopedProcessHandle flashBrokerProcess;
- if (mFlashProcess1 &&
- base::OpenProcessHandle(mFlashProcess1, &flashBrokerProcess.rwget())) {
- processHandles.AppendElement(flashBrokerProcess);
- }
- mozilla::ipc::ScopedProcessHandle flashSandboxProcess;
- if (mFlashProcess2 &&
- base::OpenProcessHandle(mFlashProcess2, &flashSandboxProcess.rwget())) {
- processHandles.AppendElement(flashSandboxProcess);
- }
-#endif
-
if (!GetProcessCpuUsage(processHandles, mPluginCpuUsageOnHang)) {
mPluginCpuUsageOnHang.Clear();
}
@@ -1482,108 +1177,6 @@ PluginModuleChromeParent::OnHangUIContinue()
}
#endif // XP_WIN
-#ifdef MOZ_CRASHREPORTER
-CrashReporterParent*
-PluginModuleChromeParent::CrashReporter()
-{
- return static_cast<CrashReporterParent*>(LoneManagedOrNullAsserts(ManagedPCrashReporterParent()));
-}
-
-#ifdef MOZ_CRASHREPORTER_INJECTOR
-static void
-RemoveMinidump(nsIFile* minidump)
-{
- if (!minidump)
- return;
-
- minidump->Remove(false);
- nsCOMPtr<nsIFile> extraFile;
- if (GetExtraFileForMinidump(minidump,
- getter_AddRefs(extraFile))) {
- extraFile->Remove(true);
- }
-}
-#endif // MOZ_CRASHREPORTER_INJECTOR
-
-void
-PluginModuleChromeParent::ProcessFirstMinidump()
-{
-#ifdef XP_WIN
- mozilla::MutexAutoLock lock(mCrashReporterMutex);
-#endif
- CrashReporterParent* crashReporter = CrashReporter();
- if (!crashReporter)
- return;
-
- AnnotationTable notes(4);
- WriteExtraDataForMinidump(notes);
-
- if (!mPluginDumpID.IsEmpty()) {
- // mPluginDumpID may be set in TerminateChildProcess, which means the
- // process hang monitor has already collected a 3-way browser, plugin,
- // content crash report. If so, update the existing report with our
- // annotations and finalize it. If not, fall through for standard
- // plugin crash report handling.
- crashReporter->GenerateChildData(&notes);
- crashReporter->FinalizeChildData();
- return;
- }
-
- uint32_t sequence = UINT32_MAX;
- nsCOMPtr<nsIFile> dumpFile;
- nsAutoCString flashProcessType;
- TakeMinidump(getter_AddRefs(dumpFile), &sequence);
-
-#ifdef MOZ_CRASHREPORTER_INJECTOR
- nsCOMPtr<nsIFile> childDumpFile;
- uint32_t childSequence;
-
- if (mFlashProcess1 &&
- TakeMinidumpForChild(mFlashProcess1,
- getter_AddRefs(childDumpFile),
- &childSequence)) {
- if (childSequence < sequence) {
- RemoveMinidump(dumpFile);
- dumpFile = childDumpFile;
- sequence = childSequence;
- flashProcessType.AssignLiteral("Broker");
- }
- else {
- RemoveMinidump(childDumpFile);
- }
- }
- if (mFlashProcess2 &&
- TakeMinidumpForChild(mFlashProcess2,
- getter_AddRefs(childDumpFile),
- &childSequence)) {
- if (childSequence < sequence) {
- RemoveMinidump(dumpFile);
- dumpFile = childDumpFile;
- sequence = childSequence;
- flashProcessType.AssignLiteral("Sandbox");
- }
- else {
- RemoveMinidump(childDumpFile);
- }
- }
-#endif
-
- if (!dumpFile) {
- NS_WARNING("[PluginModuleParent::ActorDestroy] abnormal shutdown without minidump!");
- return;
- }
-
- PLUGIN_LOG_DEBUG(("got child minidump: %s",
- NS_ConvertUTF16toUTF8(mPluginDumpID).get()));
-
- GetIDFromMinidump(dumpFile, mPluginDumpID);
- if (!flashProcessType.IsEmpty()) {
- notes.Put(NS_LITERAL_CSTRING("FlashProcessDump"), flashProcessType);
- }
- crashReporter->GenerateCrashReportForMinidump(dumpFile, &notes);
-}
-#endif
-
void
PluginModuleParent::ActorDestroy(ActorDestroyReason why)
{
@@ -1621,9 +1214,6 @@ void
PluginModuleChromeParent::ActorDestroy(ActorDestroyReason why)
{
if (why == AbnormalShutdown) {
-#ifdef MOZ_CRASHREPORTER
- ProcessFirstMinidump();
-#endif
Telemetry::Accumulate(Telemetry::SUBPROCESS_ABNORMAL_ABORT,
NS_LITERAL_CSTRING("plugin"), 1);
}
@@ -2405,9 +1995,6 @@ PluginModuleChromeParent::RecvNP_InitializeResult(const NPError& aError)
}
#endif
-#ifdef MOZ_CRASHREPORTER_INJECTOR
- InitializeInjector();
-#endif
}
return PluginModuleParent::RecvNP_InitializeResult(aError) && ok;
@@ -2955,24 +2542,12 @@ PCrashReporterParent*
PluginModuleChromeParent::AllocPCrashReporterParent(mozilla::dom::NativeThreadId* id,
uint32_t* processType)
{
-#ifdef MOZ_CRASHREPORTER
- return new CrashReporterParent();
-#else
return nullptr;
-#endif
}
bool
PluginModuleChromeParent::DeallocPCrashReporterParent(PCrashReporterParent* actor)
{
-#ifdef MOZ_CRASHREPORTER
-#ifdef XP_WIN
- mozilla::MutexAutoLock lock(mCrashReporterMutex);
- if (actor == static_cast<PCrashReporterParent*>(mCrashReporter)) {
- mCrashReporter = nullptr;
- }
-#endif
-#endif
delete actor;
return true;
}
@@ -3134,107 +2709,6 @@ PluginModuleParent::AnswerNPN_SetValue_NPPVpluginRequiresAudioDeviceChanges(
return true;
}
-#ifdef MOZ_CRASHREPORTER_INJECTOR
-
-// We only add the crash reporter to subprocess which have the filename
-// FlashPlayerPlugin*
-#define FLASH_PROCESS_PREFIX "FLASHPLAYERPLUGIN"
-
-static DWORD
-GetFlashChildOfPID(DWORD pid, HANDLE snapshot)
-{
- PROCESSENTRY32 entry = {
- sizeof(entry)
- };
- for (BOOL ok = Process32First(snapshot, &entry);
- ok;
- ok = Process32Next(snapshot, &entry)) {
- if (entry.th32ParentProcessID == pid) {
- nsString name(entry.szExeFile);
- ToUpperCase(name);
- if (StringBeginsWith(name, NS_LITERAL_STRING(FLASH_PROCESS_PREFIX))) {
- return entry.th32ProcessID;
- }
- }
- }
- return 0;
-}
-
-// We only look for child processes of the Flash plugin, NPSWF*
-#define FLASH_PLUGIN_PREFIX "NPSWF"
-
-void
-PluginModuleChromeParent::InitializeInjector()
-{
- if (!Preferences::GetBool("dom.ipc.plugins.flash.subprocess.crashreporter.enabled", false))
- return;
-
- nsCString path(Process()->GetPluginFilePath().c_str());
- ToUpperCase(path);
- int32_t lastSlash = path.RFindCharInSet("\\/");
- if (kNotFound == lastSlash)
- return;
-
- if (!StringBeginsWith(Substring(path, lastSlash + 1),
- NS_LITERAL_CSTRING(FLASH_PLUGIN_PREFIX)))
- return;
-
- TimeStamp th32Start = TimeStamp::Now();
- mFinishInitTask = mChromeTaskFactory.NewTask<FinishInjectorInitTask>();
- mFinishInitTask->Init(this);
- if (!::QueueUserWorkItem(&PluginModuleChromeParent::GetToolhelpSnapshot,
- mFinishInitTask, WT_EXECUTEDEFAULT)) {
- mFinishInitTask = nullptr;
- return;
- }
- TimeStamp th32End = TimeStamp::Now();
- mTimeBlocked += (th32End - th32Start);
-}
-
-void
-PluginModuleChromeParent::DoInjection(const nsAutoHandle& aSnapshot)
-{
- DWORD pluginProcessPID = GetProcessId(Process()->GetChildProcessHandle());
- mFlashProcess1 = GetFlashChildOfPID(pluginProcessPID, aSnapshot);
- if (mFlashProcess1) {
- InjectCrashReporterIntoProcess(mFlashProcess1, this);
-
- mFlashProcess2 = GetFlashChildOfPID(mFlashProcess1, aSnapshot);
- if (mFlashProcess2) {
- InjectCrashReporterIntoProcess(mFlashProcess2, this);
- }
- }
- mFinishInitTask = nullptr;
-}
-
-DWORD WINAPI
-PluginModuleChromeParent::GetToolhelpSnapshot(LPVOID aContext)
-{
- FinishInjectorInitTask* task = static_cast<FinishInjectorInitTask*>(aContext);
- MOZ_ASSERT(task);
- task->PostToMainThread();
- return 0;
-}
-
-void
-PluginModuleChromeParent::OnCrash(DWORD processID)
-{
- if (!mShutdown) {
- GetIPCChannel()->CloseWithError();
- mozilla::ipc::ScopedProcessHandle geckoPluginChild;
- if (base::OpenProcessHandle(OtherPid(), &geckoPluginChild.rwget())) {
- if (!base::KillProcess(geckoPluginChild,
- base::PROCESS_END_KILLED_BY_USER, false)) {
- NS_ERROR("May have failed to kill child process.");
- }
- } else {
- NS_ERROR("Failed to open child process when attempting kill.");
- }
- }
-}
-
-#endif // MOZ_CRASHREPORTER_INJECTOR
-
#ifdef MOZ_ENABLE_PROFILER_SPS
class PluginProfilerObserver final : public nsIObserver,
public nsSupportsWeakReference
diff --git a/dom/plugins/ipc/PluginModuleParent.h b/dom/plugins/ipc/PluginModuleParent.h
index cc24d6ed28..946d4c2360 100644
--- a/dom/plugins/ipc/PluginModuleParent.h
+++ b/dom/plugins/ipc/PluginModuleParent.h
@@ -26,10 +26,6 @@
#include "nsWindowsHelpers.h"
#endif
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
-
class nsIProfileSaveEvent;
class nsPluginTag;
@@ -56,9 +52,6 @@ class PluginInstanceParent;
#ifdef XP_WIN
class PluginHangUIParent;
#endif
-#ifdef MOZ_CRASHREPORTER_INJECTOR
-class FinishInjectorInitTask;
-#endif
/**
* PluginModuleParent
@@ -80,9 +73,6 @@ class FinishInjectorInitTask;
class PluginModuleParent
: public PPluginModuleParent
, public PluginLibrary
-#ifdef MOZ_CRASHREPORTER_INJECTOR
- , public CrashReporter::InjectorCrashCallback
-#endif
{
protected:
typedef mozilla::PluginLibrary PluginLibrary;
@@ -395,10 +385,6 @@ class PluginModuleContentParent : public PluginModuleParent
virtual bool ShouldContinueFromReplyTimeout() override;
virtual void OnExitedSyncSend() override;
-#ifdef MOZ_CRASHREPORTER_INJECTOR
- void OnCrash(DWORD processID) override {}
-#endif
-
static PluginModuleContentParent* sSavedModuleParent;
uint32_t mPluginId;
@@ -522,11 +508,6 @@ private:
virtual bool ShouldContinueFromReplyTimeout() override;
-#ifdef MOZ_CRASHREPORTER
- void ProcessFirstMinidump();
- void WriteExtraDataForMinidump(CrashReporter::AnnotationTable& notes);
-#endif
-
virtual PCrashReporterParent*
AllocPCrashReporterParent(mozilla::dom::NativeThreadId* id,
uint32_t* processType) override;
@@ -594,17 +575,6 @@ private:
PluginHangUIParent *mHangUIParent;
bool mHangUIEnabled;
bool mIsTimerReset;
-#ifdef MOZ_CRASHREPORTER
- /**
- * This mutex protects the crash reporter when the Plugin Hang UI event
- * handler is executing off main thread. It is intended to protect both
- * the mCrashReporter variable in addition to the CrashReporterParent object
- * that mCrashReporter refers to.
- */
- mozilla::Mutex mCrashReporterMutex;
- CrashReporterParent* mCrashReporter;
-#endif // MOZ_CRASHREPORTER
-
/**
* Launches the Plugin Hang UI.
@@ -626,20 +596,6 @@ private:
friend class mozilla::dom::CrashReporterParent;
friend class mozilla::plugins::PluginAsyncSurrogate;
-#ifdef MOZ_CRASHREPORTER_INJECTOR
- friend class mozilla::plugins::FinishInjectorInitTask;
-
- void InitializeInjector();
- void DoInjection(const nsAutoHandle& aSnapshot);
- static DWORD WINAPI GetToolhelpSnapshot(LPVOID aContext);
-
- void OnCrash(DWORD processID) override;
-
- DWORD mFlashProcess1;
- DWORD mFlashProcess2;
- RefPtr<mozilla::plugins::FinishInjectorInitTask> mFinishInitTask;
-#endif
-
void OnProcessLaunched(const bool aSucceeded);
class LaunchedTask : public LaunchCompleteTask
diff --git a/dom/plugins/test/mochitest/test_crash_notify_no_report.xul b/dom/plugins/test/mochitest/test_crash_notify_no_report.xul
index a1344bf0f4..ac2b878fbb 100644
--- a/dom/plugins/test/mochitest/test_crash_notify_no_report.xul
+++ b/dom/plugins/test/mochitest/test_crash_notify_no_report.xul
@@ -83,21 +83,10 @@ function onPluginCrashed(aEvent) {
getService(Components.interfaces.nsIObserverService);
os.removeObserver(testObserver, "plugin-crashed");
- // re-set MOZ_CRASHREPORTER_NO_REPORT
- let env = Components.classes["@mozilla.org/process/environment;1"]
- .getService(Components.interfaces.nsIEnvironment);
- env.set("MOZ_CRASHREPORTER_NO_REPORT", "1");
SimpleTest.finish();
}
function runTests() {
- // the test harness will have set MOZ_CRASHREPORTER_NO_REPORT,
- // ensure that we can change the setting and have our minidumps
- // wind up in Crash Reports/pending
- let env = Components.classes["@mozilla.org/process/environment;1"]
- .getService(Components.interfaces.nsIEnvironment);
- env.set("MOZ_CRASHREPORTER_NO_REPORT", "");
-
var os = Components.classes["@mozilla.org/observer-service;1"].
getService(Components.interfaces.nsIObserverService);
os.addObserver(testObserver, "plugin-crashed", true);
diff --git a/dom/plugins/test/mochitest/test_crash_submit.xul b/dom/plugins/test/mochitest/test_crash_submit.xul
index 22f39384b5..53b42b25c1 100644
--- a/dom/plugins/test/mochitest/test_crash_submit.xul
+++ b/dom/plugins/test/mochitest/test_crash_submit.xul
@@ -70,11 +70,6 @@ var testObserver = {
getService(Components.interfaces.nsIObserverService);
os.removeObserver(testObserver, "crash-report-status");
- // Then re-set MOZ_CRASHREPORTER_NO_REPORT
- let env = Components.classes["@mozilla.org/process/environment;1"]
- .getService(Components.interfaces.nsIEnvironment);
- env.set("MOZ_CRASHREPORTER_NO_REPORT", "1");
-
// Finally re-set crashreporter URL
crashReporter.serverURL = oldServerURL;
@@ -123,13 +118,6 @@ function onPluginCrashed(aEvent) {
}
function runTests() {
- // the test harness will have set MOZ_CRASHREPORTER_NO_REPORT,
- // ensure that we can change the setting and have our minidumps
- // wind up in Crash Reports/pending
- let env = Components.classes["@mozilla.org/process/environment;1"]
- .getService(Components.interfaces.nsIEnvironment);
- env.set("MOZ_CRASHREPORTER_NO_REPORT", "");
-
// Override the crash reporter URL to send to our fake server
crashReporter.serverURL = NetUtil.newURI(SERVER_URL);
diff --git a/dom/plugins/test/mochitest/test_hang_submit.xul b/dom/plugins/test/mochitest/test_hang_submit.xul
index 6c037ecd49..52ed78c6b5 100644
--- a/dom/plugins/test/mochitest/test_hang_submit.xul
+++ b/dom/plugins/test/mochitest/test_hang_submit.xul
@@ -78,10 +78,6 @@ var testObserver = {
// Next unregister our observer
Services.obs.removeObserver(testObserver, "crash-report-status");
- // Then re-set MOZ_CRASHREPORTER_NO_REPORT
- let env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
- env.set("MOZ_CRASHREPORTER_NO_REPORT", "1");
-
// Finally re-set prefs
crashReporter.serverURL = oldServerURL;
Services.prefs.setIntPref("dom.ipc.plugins.timeoutSecs", oldTimeoutPref);
@@ -133,13 +129,6 @@ function runTests() {
// Default plugin hang timeout is too high for mochitests
Services.prefs.setIntPref("dom.ipc.plugins.timeoutSecs", 1);
- // the test harness will have set MOZ_CRASHREPORTER_NO_REPORT,
- // ensure that we can change the setting and have our minidumps
- // wind up in Crash Reports/pending
- let env = Cc["@mozilla.org/process/environment;1"]
- .getService(Ci.nsIEnvironment);
- env.set("MOZ_CRASHREPORTER_NO_REPORT", "");
-
// Override the crash reporter URL to send to our fake server
crashReporter.serverURL = NetUtil.newURI(SERVER_URL);
diff --git a/dom/promise/Promise.cpp b/dom/promise/Promise.cpp
index bf1fa5f504..557f3a1f98 100644
--- a/dom/promise/Promise.cpp
+++ b/dom/promise/Promise.cpp
@@ -38,9 +38,6 @@
#include "WorkerRunnable.h"
#include "WrapperFactory.h"
#include "xpcpublic.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
namespace mozilla {
namespace dom {
@@ -564,37 +561,40 @@ Promise::Reject(nsIGlobalObject* aGlobal, JSContext* aCx,
// static
already_AddRefed<Promise>
-Promise::All(const GlobalObject& aGlobal,
+Promise::All(JSContext* aCx,
const nsTArray<RefPtr<Promise>>& aPromiseList, ErrorResult& aRv)
{
- nsCOMPtr<nsIGlobalObject> global;
- global = do_QueryInterface(aGlobal.GetAsSupports());
- if (!global) {
+ JS::Rooted<JSObject*> globalObj(aCx, JS::CurrentGlobalOrNull(aCx));
+ if (!globalObj) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return nullptr;
}
- JSContext* cx = aGlobal.Context();
+ nsCOMPtr<nsIGlobalObject> global = xpc::NativeGlobal(globalObj);
+ if (!global) {
+ aRv.Throw(NS_ERROR_UNEXPECTED);
+ return nullptr;
+ }
- JS::AutoObjectVector promises(cx);
+ JS::AutoObjectVector promises(aCx);
if (!promises.reserve(aPromiseList.Length())) {
- aRv.NoteJSContextException(cx);
+ aRv.NoteJSContextException(aCx);
return nullptr;
}
for (auto& promise : aPromiseList) {
- JS::Rooted<JSObject*> promiseObj(cx, promise->PromiseObj());
+ JS::Rooted<JSObject*> promiseObj(aCx, promise->PromiseObj());
// Just in case, make sure these are all in the context compartment.
- if (!JS_WrapObject(cx, &promiseObj)) {
- aRv.NoteJSContextException(cx);
+ if (!JS_WrapObject(aCx, &promiseObj)) {
+ aRv.NoteJSContextException(aCx);
return nullptr;
}
promises.infallibleAppend(promiseObj);
}
- JS::Rooted<JSObject*> result(cx, JS::GetWaitForAllPromise(cx, promises));
+ JS::Rooted<JSObject*> result(aCx, JS::GetWaitForAllPromise(aCx, promises));
if (!result) {
- aRv.NoteJSContextException(cx);
+ aRv.NoteJSContextException(aCx);
return nullptr;
}
diff --git a/dom/promise/Promise.h b/dom/promise/Promise.h
index f2ad3bd6c1..642603a11c 100644
--- a/dom/promise/Promise.h
+++ b/dom/promise/Promise.h
@@ -188,23 +188,26 @@ public:
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto,
JS::MutableHandle<JSObject*> aWrapper);
- // Do the equivalent of Promise.resolve in the current compartment of aCx.
- // Errorrs are reported on the ErrorResult; if aRv comes back !Failed(), this
- // function MUST return a non-null value.
+ // Do the equivalent of Promise.resolve in the compartment of aGlobal. The
+ // compartment of aCx is ignored. Errors are reported on the ErrorResult; if
+ // aRv comes back !Failed(), this function MUST return a non-null value.
static already_AddRefed<Promise>
Resolve(nsIGlobalObject* aGlobal, JSContext* aCx,
JS::Handle<JS::Value> aValue, ErrorResult& aRv);
- // Do the equivalent of Promise.reject in the current compartment of aCx.
- // Errorrs are reported on the ErrorResult; if aRv comes back !Failed(), this
- // function MUST return a non-null value.
+ // Do the equivalent of Promise.reject in the compartment of aGlobal. The
+ // compartment of aCx is ignored. Errors are reported on the ErrorResult; if
+ // aRv comes back !Failed(), this function MUST return a non-null value.
static already_AddRefed<Promise>
Reject(nsIGlobalObject* aGlobal, JSContext* aCx,
JS::Handle<JS::Value> aValue, ErrorResult& aRv);
+ // Do the equivalent of Promise.all in the current compartment of aCx. Errors
+ // are reported on the ErrorResult; if aRv comes back !Failed(), this function
+ // MUST return a non-null value.
static already_AddRefed<Promise>
- All(const GlobalObject& aGlobal,
- const nsTArray<RefPtr<Promise>>& aPromiseList, ErrorResult& aRv);
+ All(JSContext* aCx, const nsTArray<RefPtr<Promise>>& aPromiseList,
+ ErrorResult& aRv);
void
Then(JSContext* aCx,
diff --git a/dom/security/nsCSPContext.cpp b/dom/security/nsCSPContext.cpp
index 5e435d4ca8..979bd915f2 100644
--- a/dom/security/nsCSPContext.cpp
+++ b/dom/security/nsCSPContext.cpp
@@ -171,9 +171,10 @@ nsCSPContext::ShouldLoad(nsContentPolicyType aContentType,
}
}
- // aExtra is only non-null if the channel got redirected.
- bool wasRedirected = (aExtra != nullptr);
+ // aExtra holds the original URI of the channel if the
+ // channel got redirected (until we fix Bug 1332422).
nsCOMPtr<nsIURI> originalURI = do_QueryInterface(aExtra);
+ bool wasRedirected = originalURI;
bool permitted = permitsInternal(dir,
aContentLocation,
@@ -219,14 +220,6 @@ nsCSPContext::permitsInternal(CSPDirective aDir,
nsAutoString violatedDirective;
for (uint32_t p = 0; p < mPolicies.Length(); p++) {
-
- // According to the W3C CSP spec, frame-ancestors checks are ignored for
- // report-only policies (when "monitoring").
- if (aDir == nsIContentSecurityPolicy::FRAME_ANCESTORS_DIRECTIVE &&
- mPolicies[p]->getReportOnlyFlag()) {
- continue;
- }
-
if (!mPolicies[p]->permits(aDir,
aContentLocation,
aNonce,
diff --git a/dom/security/nsContentSecurityManager.cpp b/dom/security/nsContentSecurityManager.cpp
index c4e1ed8e18..0cc4933fe1 100644
--- a/dom/security/nsContentSecurityManager.cpp
+++ b/dom/security/nsContentSecurityManager.cpp
@@ -1,8 +1,10 @@
#include "nsContentSecurityManager.h"
+#include "nsEscape.h"
#include "nsIChannel.h"
#include "nsIHttpChannelInternal.h"
#include "nsIStreamListener.h"
#include "nsILoadInfo.h"
+#include "nsIOService.h"
#include "nsContentUtils.h"
#include "nsCORSListenerProxy.h"
#include "nsIStreamListener.h"
@@ -10,11 +12,86 @@
#include "nsMixedContentBlocker.h"
#include "mozilla/dom/Element.h"
+#include "mozilla/dom/TabChild.h"
NS_IMPL_ISUPPORTS(nsContentSecurityManager,
nsIContentSecurityManager,
nsIChannelEventSink)
+/* static */ bool
+nsContentSecurityManager::AllowTopLevelNavigationToDataURI(nsIChannel* aChannel)
+{
+ // Let's block all toplevel document navigations to a data: URI.
+ // In all cases where the toplevel document is navigated to a
+ // data: URI the triggeringPrincipal is a codeBasePrincipal, or
+ // a NullPrincipal. In other cases, e.g. typing a data: URL into
+ // the URL-Bar, the triggeringPrincipal is a SystemPrincipal;
+ // we don't want to block those loads. Only exception, loads coming
+ // from an external applicaton (e.g. Thunderbird) don't load
+ // using a codeBasePrincipal, but we want to block those loads.
+ if (!mozilla::net::nsIOService::BlockToplevelDataUriNavigations()) {
+ return true;
+ }
+ nsCOMPtr<nsILoadInfo> loadInfo = aChannel->GetLoadInfo();
+ if (!loadInfo) {
+ return true;
+ }
+ if (loadInfo->GetExternalContentPolicyType() != nsIContentPolicy::TYPE_DOCUMENT) {
+ return true;
+ }
+ if (loadInfo->GetForceAllowDataURI()) {
+ // if the loadinfo explicitly allows the data URI navigation, let's allow it now
+ return true;
+ }
+ nsCOMPtr<nsIURI> uri;
+ nsresult rv = NS_GetFinalChannelURI(aChannel, getter_AddRefs(uri));
+ NS_ENSURE_SUCCESS(rv, true);
+ bool isDataURI =
+ (NS_SUCCEEDED(uri->SchemeIs("data", &isDataURI)) && isDataURI);
+ if (!isDataURI) {
+ return true;
+ }
+ // Whitelist data: images as long as they are not SVGs
+ nsAutoCString filePath;
+ uri->GetFilePath(filePath);
+ if (StringBeginsWith(filePath, NS_LITERAL_CSTRING("image/")) &&
+ !StringBeginsWith(filePath, NS_LITERAL_CSTRING("image/svg+xml"))) {
+ return true;
+ }
+ // Whitelist data: PDFs and JSON
+ if (StringBeginsWith(filePath, NS_LITERAL_CSTRING("application/pdf")) ||
+ StringBeginsWith(filePath, NS_LITERAL_CSTRING("application/json"))) {
+ return true;
+ }
+ // Redirecting to a toplevel data: URI is not allowed, hence we make
+ // sure the RedirectChain is empty.
+ if (!loadInfo->GetLoadTriggeredFromExternal() &&
+ nsContentUtils::IsSystemPrincipal(loadInfo->TriggeringPrincipal()) &&
+ loadInfo->RedirectChain().IsEmpty()) {
+ return true;
+ }
+ nsAutoCString dataSpec;
+ uri->GetSpec(dataSpec);
+ if (dataSpec.Length() > 50) {
+ dataSpec.Truncate(50);
+ dataSpec.AppendLiteral("...");
+ }
+ nsCOMPtr<nsITabChild> tabChild = do_QueryInterface(loadInfo->ContextForTopLevelLoad());
+ nsCOMPtr<nsIDocument> doc;
+ if (tabChild) {
+ doc = static_cast<mozilla::dom::TabChild*>(tabChild.get())->GetDocument();
+ }
+ NS_ConvertUTF8toUTF16 specUTF16(NS_UnescapeURL(dataSpec));
+ const char16_t* params[] = { specUTF16.get() };
+ nsContentUtils::ReportToConsole(nsIScriptError::warningFlag,
+ NS_LITERAL_CSTRING("DATA_URI_BLOCKED"),
+ doc,
+ nsContentUtils::eSECURITY_PROPERTIES,
+ "BlockTopLevelDataURINavigation",
+ params, ArrayLength(params));
+ return false;
+}
+
static nsresult
ValidateSecurityFlags(nsILoadInfo* aLoadInfo)
{
@@ -176,7 +253,7 @@ DoContentSecurityChecks(nsIChannel* aChannel, nsILoadInfo* aLoadInfo)
nsContentPolicyType internalContentPolicyType =
aLoadInfo->InternalContentPolicyType();
nsCString mimeTypeGuess;
- nsCOMPtr<nsINode> requestingContext = nullptr;
+ nsCOMPtr<nsISupports> requestingContext = nullptr;
#ifdef DEBUG
// Don't enforce TYPE_DOCUMENT assertions for loads
@@ -250,10 +327,13 @@ DoContentSecurityChecks(nsIChannel* aChannel, nsILoadInfo* aLoadInfo)
case nsIContentPolicy::TYPE_XMLHTTPREQUEST: {
// alias nsIContentPolicy::TYPE_DATAREQUEST:
requestingContext = aLoadInfo->LoadingNode();
- MOZ_ASSERT(!requestingContext ||
- requestingContext->NodeType() == nsIDOMNode::DOCUMENT_NODE,
- "type_xml requires requestingContext of type Document");
-
+#ifdef DEBUG
+ {
+ nsCOMPtr<nsINode> node = do_QueryInterface(requestingContext);
+ MOZ_ASSERT(!node || node->NodeType() == nsIDOMNode::DOCUMENT_NODE,
+ "type_xml requires requestingContext of type Document");
+ }
+#endif
// We're checking for the external TYPE_XMLHTTPREQUEST here in case
// an addon creates a request with that type.
if (internalContentPolicyType ==
@@ -274,18 +354,26 @@ DoContentSecurityChecks(nsIChannel* aChannel, nsILoadInfo* aLoadInfo)
case nsIContentPolicy::TYPE_OBJECT_SUBREQUEST: {
mimeTypeGuess = EmptyCString();
requestingContext = aLoadInfo->LoadingNode();
- MOZ_ASSERT(!requestingContext ||
- requestingContext->NodeType() == nsIDOMNode::ELEMENT_NODE,
- "type_subrequest requires requestingContext of type Element");
+#ifdef DEBUG
+ {
+ nsCOMPtr<nsINode> node = do_QueryInterface(requestingContext);
+ MOZ_ASSERT(!node || node->NodeType() == nsIDOMNode::ELEMENT_NODE,
+ "type_subrequest requires requestingContext of type Element");
+ }
+#endif
break;
}
case nsIContentPolicy::TYPE_DTD: {
mimeTypeGuess = EmptyCString();
requestingContext = aLoadInfo->LoadingNode();
- MOZ_ASSERT(!requestingContext ||
- requestingContext->NodeType() == nsIDOMNode::DOCUMENT_NODE,
- "type_dtd requires requestingContext of type Document");
+#ifdef DEBUG
+ {
+ nsCOMPtr<nsINode> node = do_QueryInterface(requestingContext);
+ MOZ_ASSERT(!node || node->NodeType() == nsIDOMNode::DOCUMENT_NODE,
+ "type_dtd requires requestingContext of type Document");
+ }
+#endif
break;
}
@@ -303,9 +391,13 @@ DoContentSecurityChecks(nsIChannel* aChannel, nsILoadInfo* aLoadInfo)
mimeTypeGuess = EmptyCString();
}
requestingContext = aLoadInfo->LoadingNode();
- MOZ_ASSERT(!requestingContext ||
- requestingContext->NodeType() == nsIDOMNode::ELEMENT_NODE,
- "type_media requires requestingContext of type Element");
+#ifdef DEBUG
+ {
+ nsCOMPtr<nsINode> node = do_QueryInterface(requestingContext);
+ MOZ_ASSERT(!node || node->NodeType() == nsIDOMNode::ELEMENT_NODE,
+ "type_media requires requestingContext of type Element");
+ }
+#endif
break;
}
@@ -332,18 +424,26 @@ DoContentSecurityChecks(nsIChannel* aChannel, nsILoadInfo* aLoadInfo)
case nsIContentPolicy::TYPE_XSLT: {
mimeTypeGuess = NS_LITERAL_CSTRING("application/xml");
requestingContext = aLoadInfo->LoadingNode();
- MOZ_ASSERT(!requestingContext ||
- requestingContext->NodeType() == nsIDOMNode::DOCUMENT_NODE,
- "type_xslt requires requestingContext of type Document");
+#ifdef DEBUG
+ {
+ nsCOMPtr<nsINode> node = do_QueryInterface(requestingContext);
+ MOZ_ASSERT(!node || node->NodeType() == nsIDOMNode::DOCUMENT_NODE,
+ "type_xslt requires requestingContext of type Document");
+ }
+#endif
break;
}
case nsIContentPolicy::TYPE_BEACON: {
mimeTypeGuess = EmptyCString();
requestingContext = aLoadInfo->LoadingNode();
- MOZ_ASSERT(!requestingContext ||
- requestingContext->NodeType() == nsIDOMNode::DOCUMENT_NODE,
- "type_beacon requires requestingContext of type Document");
+#ifdef DEBUG
+ {
+ nsCOMPtr<nsINode> node = do_QueryInterface(requestingContext);
+ MOZ_ASSERT(!node || node->NodeType() == nsIDOMNode::DOCUMENT_NODE,
+ "type_beacon requires requestingContext of type Document");
+ }
+#endif
break;
}
diff --git a/dom/security/nsContentSecurityManager.h b/dom/security/nsContentSecurityManager.h
index 912c0e89f1..bab8477434 100644
--- a/dom/security/nsContentSecurityManager.h
+++ b/dom/security/nsContentSecurityManager.h
@@ -32,6 +32,8 @@ public:
static nsresult doContentSecurityCheck(nsIChannel* aChannel,
nsCOMPtr<nsIStreamListener>& aInAndOutListener);
+ static bool AllowTopLevelNavigationToDataURI(nsIChannel* aChannel);
+
private:
static nsresult CheckChannel(nsIChannel* aChannel);
diff --git a/dom/security/test/csp/file_child-src_worker-redirect.html b/dom/security/test/csp/file_child-src_worker-redirect.html
index 188f173b86..b0029935c2 100644
--- a/dom/security/test/csp/file_child-src_worker-redirect.html
+++ b/dom/security/test/csp/file_child-src_worker-redirect.html
@@ -23,11 +23,8 @@
);
worker.onerror = function(error) {
- var msg = error.message;
- if (msg.match(/^NetworkError/) || msg.match(/Failed to load worker script/)) {
- // this means CSP blocked it
- msg = "blocked";
- }
+ // this means CSP blocked it
+ var msg = !("message" in error) ? "blocked" : e.message;
window.parent.postMessage({id:page_id, message:msg}, 'http://mochi.test:8888');
error.preventDefault();
};
diff --git a/dom/security/test/csp/file_frame_ancestors_ro.html b/dom/security/test/csp/file_frame_ancestors_ro.html
new file mode 100644
index 0000000000..ff5ae9cf9f
--- /dev/null
+++ b/dom/security/test/csp/file_frame_ancestors_ro.html
@@ -0,0 +1 @@
+<html><body>Child Document</body></html>
diff --git a/dom/security/test/csp/file_frame_ancestors_ro.html^headers^ b/dom/security/test/csp/file_frame_ancestors_ro.html^headers^
new file mode 100644
index 0000000000..d018af3a96
--- /dev/null
+++ b/dom/security/test/csp/file_frame_ancestors_ro.html^headers^
@@ -0,0 +1 @@
+Content-Security-Policy-Report-Only: frame-ancestors 'none'; report-uri http://mochi.test:8888/foo.sjs
diff --git a/dom/security/test/csp/mochitest.ini b/dom/security/test/csp/mochitest.ini
index ca5c2c6eab..33b1120202 100644
--- a/dom/security/test/csp/mochitest.ini
+++ b/dom/security/test/csp/mochitest.ini
@@ -91,6 +91,8 @@ support-files =
file_bug941404.html
file_bug941404_xhr.html
file_bug941404_xhr.html^headers^
+ file_frame_ancestors_ro.html
+ file_frame_ancestors_ro.html^headers^
file_hash_source.html
file_dual_header_testserver.sjs
file_hash_source.html^headers^
@@ -240,6 +242,7 @@ skip-if = toolkit == 'android' # Times out, not sure why (bug 1008445)
[test_bug910139.html]
[test_bug909029.html]
[test_bug1229639.html]
+[test_frame_ancestors_ro.html]
[test_policyuri_regression_from_multipolicy.html]
[test_nonce_source.html]
[test_bug941404.html]
diff --git a/dom/security/test/csp/test_frame_ancestors_ro.html b/dom/security/test/csp/test_frame_ancestors_ro.html
new file mode 100644
index 0000000000..90f68e25eb
--- /dev/null
+++ b/dom/security/test/csp/test_frame_ancestors_ro.html
@@ -0,0 +1,69 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test for frame-ancestors support in Content-Security-Policy-Report-Only</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<iframe style="width: 100%" id="cspframe"></iframe>
+<script type="text/javascript">
+const docUri = "http://mochi.test:8888/tests/dom/security/test/csp/file_frame_ancestors_ro.html";
+const frame = document.getElementById("cspframe");
+
+let testResults = {
+ reportFired: false,
+ frameLoaded: false
+};
+
+function checkResults(reportObj) {
+ let cspReport = reportObj["csp-report"];
+ is(cspReport["document-uri"], docUri, "Incorrect document-uri");
+
+ // we can not test for the whole referrer since it includes platform specific information
+ is(cspReport["referrer"], document.location.toString(), "Incorrect referrer");
+ is(cspReport["blocked-uri"], document.location.toString(), "Incorrect blocked-uri");
+ is(cspReport["violated-directive"], "frame-ancestors 'none'", "Incorrect violated-directive");
+ is(cspReport["original-policy"], "frame-ancestors 'none'; report-uri http://mochi.test:8888/foo.sjs", "Incorrect original-policy");
+ testResults.reportFired = true;
+}
+
+let chromeScriptUrl = SimpleTest.getTestFileURL("file_report_chromescript.js");
+let script = SpecialPowers.loadChromeScript(chromeScriptUrl);
+
+script.addMessageListener('opening-request-completed', function ml(msg) {
+ if (msg.error) {
+ ok(false, "Could not query report (exception: " + msg.error + ")");
+ } else {
+ try {
+ let reportObj = JSON.parse(msg.report);
+ // test for the proper values in the report object
+ checkResults(reportObj);
+ } catch (e) {
+ ok(false, "Error verifying report object (exception: " + e + ")");
+ }
+ }
+
+ script.removeMessageListener('opening-request-completed', ml);
+ script.sendAsyncMessage("finish");
+ checkTestResults();
+});
+
+frame.addEventListener( 'load', () => {
+ // Make sure the frame is still loaded
+ testResults.frameLoaded = true;
+ checkTestResults()
+} );
+
+function checkTestResults() {
+ if( testResults.reportFired && testResults.frameLoaded ) {
+ SimpleTest.finish();
+ }
+}
+
+SimpleTest.waitForExplicitFinish();
+frame.src = docUri;
+
+</script>
+</body>
+</html>
diff --git a/dom/security/test/general/browser.ini b/dom/security/test/general/browser.ini
new file mode 100644
index 0000000000..b00baa95dc
--- /dev/null
+++ b/dom/security/test/general/browser.ini
@@ -0,0 +1,14 @@
+[DEFAULT]
+[browser_test_toplevel_data_navigations.js]
+support-files =
+ file_toplevel_data_navigations.sjs
+ file_toplevel_data_meta_redirect.html
+[browser_test_data_download.js]
+support-files =
+ file_data_download.html
+[browser_test_data_text_csv.js]
+support-files =
+ file_data_text_csv.html
+[browser_test_view_image_data_navigation.js]
+support-files =
+ file_view_image_data_navigation.html
diff --git a/dom/security/test/general/browser_test_data_download.js b/dom/security/test/general/browser_test_data_download.js
new file mode 100644
index 0000000000..1ee8d58449
--- /dev/null
+++ b/dom/security/test/general/browser_test_data_download.js
@@ -0,0 +1,37 @@
+"use strict";
+
+const kTestPath = getRootDirectory(gTestPath)
+ .replace("chrome://mochitests/content", "http://example.com")
+const kTestURI = kTestPath + "file_data_download.html";
+
+function addWindowListener(aURL, aCallback) {
+ Services.wm.addListener({
+ onOpenWindow(aXULWindow) {
+ info("window opened, waiting for focus");
+ Services.wm.removeListener(this);
+ var domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindow);
+ waitForFocus(function() {
+ is(domwindow.document.location.href, aURL, "should have seen the right window open");
+ aCallback(domwindow);
+ }, domwindow);
+ },
+ onCloseWindow(aXULWindow) { },
+ onWindowTitleChange(aXULWindow, aNewTitle) { }
+ });
+}
+
+function test() {
+ waitForExplicitFinish();
+ Services.prefs.setBoolPref("security.data_uri.block_toplevel_data_uri_navigations", true);
+ registerCleanupFunction(function() {
+ Services.prefs.clearUserPref("security.data_uri.block_toplevel_data_uri_navigations");
+ });
+ addWindowListener("chrome://mozapps/content/downloads/unknownContentType.xul", function(win) {
+ is(win.document.getElementById("location").value, "data-foo.html",
+ "file name of download should match");
+ win.close();
+ finish();
+ });
+ gBrowser.loadURI(kTestURI);
+}
diff --git a/dom/security/test/general/browser_test_data_text_csv.js b/dom/security/test/general/browser_test_data_text_csv.js
new file mode 100644
index 0000000000..c45e40cc2e
--- /dev/null
+++ b/dom/security/test/general/browser_test_data_text_csv.js
@@ -0,0 +1,37 @@
+"use strict";
+
+const kTestPath = getRootDirectory(gTestPath)
+ .replace("chrome://mochitests/content", "http://example.com")
+const kTestURI = kTestPath + "file_data_text_csv.html";
+
+function addWindowListener(aURL, aCallback) {
+ Services.wm.addListener({
+ onOpenWindow(aXULWindow) {
+ info("window opened, waiting for focus");
+ Services.wm.removeListener(this);
+ var domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindow);
+ waitForFocus(function() {
+ is(domwindow.document.location.href, aURL, "should have seen the right window open");
+ aCallback(domwindow);
+ }, domwindow);
+ },
+ onCloseWindow(aXULWindow) { },
+ onWindowTitleChange(aXULWindow, aNewTitle) { }
+ });
+}
+
+function test() {
+ waitForExplicitFinish();
+ Services.prefs.setBoolPref("security.data_uri.block_toplevel_data_uri_navigations", true);
+ registerCleanupFunction(function() {
+ Services.prefs.clearUserPref("security.data_uri.block_toplevel_data_uri_navigations");
+ });
+ addWindowListener("chrome://mozapps/content/downloads/unknownContentType.xul", function(win) {
+ is(win.document.getElementById("location").value, "text/csv;foo,bar,foobar",
+ "file name of download should match");
+ win.close();
+ finish();
+ });
+ gBrowser.loadURI(kTestURI);
+}
diff --git a/dom/security/test/general/browser_test_toplevel_data_navigations.js b/dom/security/test/general/browser_test_toplevel_data_navigations.js
new file mode 100644
index 0000000000..a13a6350e9
--- /dev/null
+++ b/dom/security/test/general/browser_test_toplevel_data_navigations.js
@@ -0,0 +1,54 @@
+/* eslint-disable mozilla/no-arbitrary-setTimeout */
+
+"use strict";
+
+const kDataBody = "toplevel navigation to data: URI allowed";
+const kDataURI = "data:text/html,<body>" + kDataBody + "</body>";
+const kTestPath = getRootDirectory(gTestPath)
+ .replace("chrome://mochitests/content", "http://example.com")
+const kRedirectURI = kTestPath + "file_toplevel_data_navigations.sjs";
+const kMetaRedirectURI = kTestPath + "file_toplevel_data_meta_redirect.html";
+
+add_task(async function test_nav_data_uri() {
+ await SpecialPowers.pushPrefEnv({
+ "set": [["security.data_uri.block_toplevel_data_uri_navigations", true]],
+ });
+ await BrowserTestUtils.withNewTab(kDataURI, async function(browser) {
+ await ContentTask.spawn(gBrowser.selectedBrowser, {kDataBody}, async function({kDataBody}) { // eslint-disable-line
+ is(content.document.body.innerHTML, kDataBody,
+ "data: URI navigation from system should be allowed");
+ });
+ });
+});
+
+add_task(async function test_nav_data_uri_redirect() {
+ await SpecialPowers.pushPrefEnv({
+ "set": [["security.data_uri.block_toplevel_data_uri_navigations", true]],
+ });
+ let tab = BrowserTestUtils.addTab(gBrowser, kRedirectURI);
+ registerCleanupFunction(async function() {
+ await BrowserTestUtils.removeTab(tab);
+ });
+ // wait to make sure data: URI did not load before checking that it got blocked
+ await new Promise(resolve => setTimeout(resolve, 500));
+ await ContentTask.spawn(gBrowser.selectedBrowser, {}, async function() {
+ is(content.document.body.innerHTML, "",
+ "data: URI navigation after server redirect should be blocked");
+ });
+});
+
+add_task(async function test_nav_data_uri_meta_redirect() {
+ await SpecialPowers.pushPrefEnv({
+ "set": [["security.data_uri.block_toplevel_data_uri_navigations", true]],
+ });
+ let tab = BrowserTestUtils.addTab(gBrowser, kMetaRedirectURI);
+ registerCleanupFunction(async function() {
+ await BrowserTestUtils.removeTab(tab);
+ });
+ // wait to make sure data: URI did not load before checking that it got blocked
+ await new Promise(resolve => setTimeout(resolve, 500));
+ await ContentTask.spawn(gBrowser.selectedBrowser, {}, async function() {
+ is(content.document.body.innerHTML, "",
+ "data: URI navigation after meta redirect should be blocked");
+ });
+});
diff --git a/dom/security/test/general/browser_test_view_image_data_navigation.js b/dom/security/test/general/browser_test_view_image_data_navigation.js
new file mode 100644
index 0000000000..22de358940
--- /dev/null
+++ b/dom/security/test/general/browser_test_view_image_data_navigation.js
@@ -0,0 +1,30 @@
+"use strict";
+
+const TEST_PAGE = getRootDirectory(gTestPath) + "file_view_image_data_navigation.html";
+
+add_task(async function test_principal_right_click_open_link_in_new_tab() {
+ await SpecialPowers.pushPrefEnv({
+ "set": [["security.data_uri.block_toplevel_data_uri_navigations", true]],
+ });
+
+ await BrowserTestUtils.withNewTab(TEST_PAGE, async function(browser) {
+ let loadPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, true);
+
+ // simulate right-click->view-image
+ BrowserTestUtils.waitForEvent(document, "popupshown", false, event => {
+ // These are operations that must be executed synchronously with the event.
+ document.getElementById("context-viewimage").doCommand();
+ event.target.hidePopup();
+ return true;
+ });
+ BrowserTestUtils.synthesizeMouseAtCenter("#testimage",
+ { type: "contextmenu", button: 2 },
+ gBrowser.selectedBrowser);
+ await loadPromise;
+
+ await ContentTask.spawn(gBrowser.selectedBrowser, {}, async function() {
+ ok(content.document.location.toString().startsWith("data:image/svg+xml;"),
+ "data:image/svg navigation allowed through right-click view-image")
+ });
+ });
+});
diff --git a/dom/security/test/general/file_block_toplevel_data_navigation.html b/dom/security/test/general/file_block_toplevel_data_navigation.html
new file mode 100644
index 0000000000..5fbfdfdef4
--- /dev/null
+++ b/dom/security/test/general/file_block_toplevel_data_navigation.html
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Toplevel data navigation</title>
+</head>
+<body>
+test1: clicking data: URI tries to navigate window<br/>
+<a id="testlink" href="data:text/html,<body>toplevel data: URI navigations should be blocked</body>">click me</a>
+<script>
+ document.getElementById('testlink').click();
+</script>
+</body>
+</html>
diff --git a/dom/security/test/general/file_block_toplevel_data_navigation2.html b/dom/security/test/general/file_block_toplevel_data_navigation2.html
new file mode 100644
index 0000000000..e0308e1ae6
--- /dev/null
+++ b/dom/security/test/general/file_block_toplevel_data_navigation2.html
@@ -0,0 +1,29 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Toplevel data navigation</title>
+</head>
+<body>
+test2: data: URI in iframe tries to window.open(data:, _blank);<br/>
+<iframe id="testFrame" src=""></iframe>
+<script>
+ let DATA_URI = `data:text/html,<body><script>
+ var win = window.open("data:text/html,<body>toplevel data: URI navigations should be blocked</body>", "_blank");
+ setTimeout(function () {
+ var result = win.document.body.innerHTML === "" ? "blocked" : "navigated";
+ parent.postMessage(result, "*");
+ win.close();
+ }, 1000);
+ <\/script></body>`;
+
+ window.addEventListener("message", receiveMessage);
+ function receiveMessage(event) {
+ window.removeEventListener("message", receiveMessage);
+ // propagate the information back to the caller
+ window.opener.postMessage(event.data, "*");
+ }
+ document.getElementById('testFrame').src = DATA_URI;
+</script>
+</body>
+</html>
diff --git a/dom/security/test/general/file_block_toplevel_data_navigation3.html b/dom/security/test/general/file_block_toplevel_data_navigation3.html
new file mode 100644
index 0000000000..34aeddab36
--- /dev/null
+++ b/dom/security/test/general/file_block_toplevel_data_navigation3.html
@@ -0,0 +1,13 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Toplevel data navigation</title>
+</head>
+<body>
+test3: performing data: URI navigation through win.loc.href<br/>
+<script>
+ window.location.href = "data:text/html,<body>toplevel data: URI navigations should be blocked</body>";
+</script>
+</body>
+</html>
diff --git a/dom/security/test/general/file_block_toplevel_data_redirect.sjs b/dom/security/test/general/file_block_toplevel_data_redirect.sjs
new file mode 100644
index 0000000000..64e294cab1
--- /dev/null
+++ b/dom/security/test/general/file_block_toplevel_data_redirect.sjs
@@ -0,0 +1,14 @@
+// Custom *.sjs file specifically for the needs of Bug:
+// Bug 1394554 - Block toplevel data: URI navigations after redirect
+
+var DATA_URI =
+ "<body>toplevel data: URI navigations after redirect should be blocked</body>";
+
+function handleRequest(request, response)
+{
+ // avoid confusing cache behaviors
+ response.setHeader("Cache-Control", "no-cache", false);
+
+ response.setStatusLine("1.1", 302, "Found");
+ response.setHeader("Location", "data:text/html," + escape(DATA_URI), false);
+}
diff --git a/dom/security/test/general/file_data_download.html b/dom/security/test/general/file_data_download.html
new file mode 100644
index 0000000000..4cc92fe8f5
--- /dev/null
+++ b/dom/security/test/general/file_data_download.html
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test download attribute for data: URI</title>
+</head>
+<body>
+ <a href="data:text/html,<body>data download</body>" download="data-foo.html" id="testlink">download data</a>
+ <script>
+ // click the link to have the downoad panel appear
+ let testlink = document.getElementById("testlink");
+ testlink.click();
+ </script>
+ </body>
+</html>
diff --git a/dom/security/test/general/file_data_text_csv.html b/dom/security/test/general/file_data_text_csv.html
new file mode 100644
index 0000000000..a9ac369d16
--- /dev/null
+++ b/dom/security/test/general/file_data_text_csv.html
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Test open data:text/csv</title>
+</head>
+<body>
+ <a href="data:text/csv;foo,bar,foobar" id="testlink">test text/csv</a>
+ <script>
+ // click the link to have the downoad panel appear
+ let testlink = document.getElementById("testlink");
+ testlink.click();
+ </script>
+ </body>
+</html>
diff --git a/dom/security/test/general/file_toplevel_data_meta_redirect.html b/dom/security/test/general/file_toplevel_data_meta_redirect.html
new file mode 100644
index 0000000000..f4f5deb528
--- /dev/null
+++ b/dom/security/test/general/file_toplevel_data_meta_redirect.html
@@ -0,0 +1,10 @@
+<html>
+<body>
+<head>
+ <meta http-equiv="refresh"
+ content="0; url='data:text/html,<body>toplevel meta redirect to data: URI should be blocked</body>'">
+</head>
+<body>
+Meta Redirect to data: URI
+</body>
+</html>
diff --git a/dom/security/test/general/file_toplevel_data_navigations.sjs b/dom/security/test/general/file_toplevel_data_navigations.sjs
new file mode 100644
index 0000000000..501b833e5d
--- /dev/null
+++ b/dom/security/test/general/file_toplevel_data_navigations.sjs
@@ -0,0 +1,14 @@
+// Custom *.sjs file specifically for the needs of Bug:
+// Bug 1394554 - Block toplevel data: URI navigations after redirect
+
+var DATA_URI =
+ "data:text/html,<body>toplevel data: URI navigations after redirect should be blocked</body>";
+
+function handleRequest(request, response)
+{
+ // avoid confusing cache behaviors
+ response.setHeader("Cache-Control", "no-cache", false);
+
+ response.setStatusLine("1.1", 302, "Found");
+ response.setHeader("Location", DATA_URI, false);
+}
diff --git a/dom/security/test/general/file_view_image_data_navigation.html b/dom/security/test/general/file_view_image_data_navigation.html
new file mode 100644
index 0000000000..a3f9acfb4d
--- /dev/null
+++ b/dom/security/test/general/file_view_image_data_navigation.html
@@ -0,0 +1,12 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Bug 1407891: Test navigation for right-click view-image on data:image/svg</title>
+</head>
+<body>
+
+<img id="testimage" src="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2Ij4KICA8cGF0aCBkPSJNOCwxMkwzLDcsNCw2bDQsNCw0LTQsMSwxWiIgZmlsbD0iIzZBNkE2QSIgLz4KPC9zdmc+Cg=="></img>
+
+</body>
+</html>
diff --git a/dom/security/test/general/mochitest.ini b/dom/security/test/general/mochitest.ini
index 70c0c9fb60..f3bcca0727 100644
--- a/dom/security/test/general/mochitest.ini
+++ b/dom/security/test/general/mochitest.ini
@@ -3,7 +3,19 @@ support-files =
file_contentpolicytype_targeted_link_iframe.sjs
file_nosniff_testserver.sjs
file_block_script_wrong_mime_server.sjs
+ file_block_toplevel_data_navigation.html
+ file_block_toplevel_data_navigation2.html
+ file_block_toplevel_data_navigation3.html
+ file_block_toplevel_data_redirect.sjs
[test_contentpolicytype_targeted_link_iframe.html]
[test_nosniff.html]
[test_block_script_wrong_mime.html]
+[test_block_toplevel_data_navigation.html]
+skip-if = toolkit == 'android' # intermittent failure
+[test_block_toplevel_data_img_navigation.html]
+skip-if = toolkit == 'android' # intermittent failure
+[test_allow_opening_data_pdf.html]
+skip-if = toolkit == 'android'
+[test_allow_opening_data_json.html]
+skip-if = toolkit == 'android'
diff --git a/dom/security/test/general/test_allow_opening_data_json.html b/dom/security/test/general/test_allow_opening_data_json.html
new file mode 100644
index 0000000000..1530a24e84
--- /dev/null
+++ b/dom/security/test/general/test_allow_opening_data_json.html
@@ -0,0 +1,39 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Bug 1403814: Allow toplevel data URI navigation data:application/json</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+function test_toplevel_data_json() {
+ const DATA_JSON = "data:application/json,{'my_json_key':'my_json_value'}";
+
+ let win = window.open(DATA_JSON);
+ let wrappedWin = SpecialPowers.wrap(win);
+
+ // Unfortunately we can't detect whether the JSON has loaded or not using some
+ // event, hence we are constantly polling location.href till we see that
+ // the data: URI appears. Test times out on failure.
+ var jsonLoaded = setInterval(function() {
+ if (wrappedWin.document.location.href.startsWith("data:application/json")) {
+ clearInterval(jsonLoaded);
+ ok(true, "navigating to data:application/json allowed");
+ wrappedWin.close();
+ SimpleTest.finish();
+ }
+ }, 200);
+}
+
+SpecialPowers.pushPrefEnv({
+ set: [["security.data_uri.block_toplevel_data_uri_navigations", true]]
+}, test_toplevel_data_json);
+
+</script>
+</body>
+</html>
diff --git a/dom/security/test/general/test_allow_opening_data_pdf.html b/dom/security/test/general/test_allow_opening_data_pdf.html
new file mode 100644
index 0000000000..6b51fe57b0
--- /dev/null
+++ b/dom/security/test/general/test_allow_opening_data_pdf.html
@@ -0,0 +1,41 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Bug 1398692: Allow toplevel navigation to a data:application/pdf</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script class="testbody" type="text/javascript">
+
+SimpleTest.waitForExplicitFinish();
+
+function test_toplevel_data_pdf() {
+ // The PDF contains one page and it is a 3/72" square, the minimum allowed by the spec
+ const DATA_PDF =
+ "data:application/pdf;base64,JVBERi0xLjANCjEgMCBvYmo8PC9UeXBlL0NhdGFsb2cvUGFnZXMgMiAwIFI+PmVuZG9iaiAyIDAgb2JqPDwvVHlwZS9QYWdlcy9LaWRzWzMgMCBSXS9Db3VudCAxPj5lbmRvYmogMyAwIG9iajw8L1R5cGUvUGFnZS9NZWRpYUJveFswIDAgMyAzXT4+ZW5kb2JqDQp4cmVmDQowIDQNCjAwMDAwMDAwMDAgNjU1MzUgZg0KMDAwMDAwMDAxMCAwMDAwMCBuDQowMDAwMDAwMDUzIDAwMDAwIG4NCjAwMDAwMDAxMDIgMDAwMDAgbg0KdHJhaWxlcjw8L1NpemUgNC9Sb290IDEgMCBSPj4NCnN0YXJ0eHJlZg0KMTQ5DQolRU9G";
+
+ let win = window.open(DATA_PDF);
+ let wrappedWin = SpecialPowers.wrap(win);
+
+ // Unfortunately we can't detect whether the PDF has loaded or not using some
+ // event, hence we are constantly polling location.href till we see that
+ // the data: URI appears. Test times out on failure.
+ var pdfLoaded = setInterval(function() {
+ if (wrappedWin.document.location.href.startsWith("data:application/pdf")) {
+ clearInterval(pdfLoaded);
+ ok(true, "navigating to data:application/pdf allowed");
+ wrappedWin.close();
+ SimpleTest.finish();
+ }
+ }, 200);
+}
+
+SpecialPowers.pushPrefEnv({
+ set: [["security.data_uri.block_toplevel_data_uri_navigations", true]]
+}, test_toplevel_data_pdf);
+
+</script>
+</body>
+</html>
diff --git a/dom/security/test/general/test_block_script_wrong_mime.html b/dom/security/test/general/test_block_script_wrong_mime.html
index f4da9c577d..34d4b621bc 100644
--- a/dom/security/test/general/test_block_script_wrong_mime.html
+++ b/dom/security/test/general/test_block_script_wrong_mime.html
@@ -53,9 +53,6 @@ function testWorker([mime, shouldLoad]) {
};
worker.onerror = (error) => {
ok(!shouldLoad, `worker with wrong mime '${mime}' should be blocked`);
- let msg = error.message;
- ok(msg.match(/^NetworkError/) || msg.match(/Failed to load worker script/),
- "should gets correct error message");
error.preventDefault();
resolve();
}
@@ -74,9 +71,6 @@ function testWorkerImportScripts([mime, shouldLoad]) {
};
worker.onerror = (error) => {
ok(!shouldLoad, `worker/importScripts with wrong mime '${mime}' should be blocked`);
- let msg = error.message;
- ok(msg.match(/^NetworkError/) || msg.match(/Failed to load worker script/),
- "should gets correct error message");
error.preventDefault();
resolve();
}
diff --git a/dom/security/test/general/test_block_toplevel_data_img_navigation.html b/dom/security/test/general/test_block_toplevel_data_img_navigation.html
new file mode 100644
index 0000000000..7f8dfc7480
--- /dev/null
+++ b/dom/security/test/general/test_block_toplevel_data_img_navigation.html
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Bug 1396798: Do not block toplevel data: navigation to image (except svgs)</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script class="testbody" type="text/javascript">
+SpecialPowers.setBoolPref("security.data_uri.block_toplevel_data_uri_navigations", true);
+SimpleTest.registerCleanupFunction(() => {
+ SpecialPowers.clearUserPref("security.data_uri.block_toplevel_data_uri_navigations");
+});
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.requestFlakyTimeout("have to test that top level data:image loading is blocked/allowed");
+
+function test_toplevel_data_image() {
+ const DATA_PNG =
+ "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==";
+ let win1 = window.open(DATA_PNG);
+ let wrappedWin1 = SpecialPowers.wrap(win1);
+ setTimeout(function () {
+ let images = wrappedWin1.document.getElementsByTagName('img');
+ is(images.length, 1, "Loading data:image/png should be allowed");
+ is(images[0].src, DATA_PNG, "Sanity: img src matches");
+ wrappedWin1.close();
+ test_toplevel_data_image_svg();
+ }, 1000);
+}
+
+function test_toplevel_data_image_svg() {
+ const DATA_SVG =
+ "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgdmlld0JveD0iMCAwIDE2IDE2Ij4KICA8cGF0aCBkPSJNOCwxMkwzLDcsNCw2bDQsNCw0LTQsMSwxWiIgZmlsbD0iIzZBNkE2QSIgLz4KPC9zdmc+Cg==";
+ let win2 = window.open(DATA_SVG);
+ // Unfortunately we can't detect whether the window was closed using some event,
+ // hence we are constantly polling till we see that win == null.
+ // Test times out on failure.
+ var win2Closed = setInterval(function() {
+ if (win2 == null || win2.closed) {
+ clearInterval(win2Closed);
+ ok(true, "Loading data:image/svg+xml should be blocked");
+ SimpleTest.finish();
+ }
+ }, 200);
+}
+// fire up the tests
+test_toplevel_data_image();
+
+</script>
+</body>
+</html>
diff --git a/dom/security/test/general/test_block_toplevel_data_navigation.html b/dom/security/test/general/test_block_toplevel_data_navigation.html
new file mode 100644
index 0000000000..cef232b65a
--- /dev/null
+++ b/dom/security/test/general/test_block_toplevel_data_navigation.html
@@ -0,0 +1,86 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Bug 1331351 - Block top level window data: URI navigations</title>
+ <!-- Including SimpleTest.js so we can use waitForExplicitFinish !-->
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<script class="testbody" type="text/javascript">
+SpecialPowers.setBoolPref("security.data_uri.block_toplevel_data_uri_navigations", true);
+SimpleTest.registerCleanupFunction(() => {
+ SpecialPowers.clearUserPref("security.data_uri.block_toplevel_data_uri_navigations");
+});
+
+SimpleTest.waitForExplicitFinish();
+SimpleTest.requestFlakyTimeout("have to test that top level data: URI navgiation is blocked");
+
+function test1() {
+ // simple data: URI click navigation should be prevented
+ let TEST_FILE = "file_block_toplevel_data_navigation.html";
+ let win1 = window.open(TEST_FILE);
+ setTimeout(function () {
+ ok(SpecialPowers.wrap(win1).document.body.innerHTML.indexOf("test1:") !== -1,
+ "toplevel data: URI navigation through click() should be blocked");
+ win1.close();
+ test2();
+ }, 1000);
+}
+
+function test2() {
+ // data: URI in iframe which opens data: URI in _blank should be blocked
+ let win2 = window.open("file_block_toplevel_data_navigation2.html");
+ window.addEventListener("message", receiveMessage);
+ function receiveMessage(event) {
+ window.removeEventListener("message", receiveMessage);
+ is(event.data, "blocked",
+ "data: URI navigation using _blank from data: URI should be blocked");
+ win2.close();
+ test3();
+ }
+}
+
+function test3() {
+ // navigating to a data: URI using window.location.href should be blocked
+ let win3 = window.open("file_block_toplevel_data_navigation3.html");
+ setTimeout(function () {
+ ok(win3.document.body.innerHTML.indexOf("test3:") !== -1,
+ "data: URI navigation through win.loc.href should be blocked");
+ win3.close();
+ test4();
+ }, 1000);
+}
+
+function test4() {
+ // navigating to a data: URI using window.open() should be blocked
+ let win4 = window.open("data:text/html,<body>toplevel data: URI navigations should be blocked</body>");
+ setTimeout(function () {
+ // Please note that the data: URI will be displayed in the URL-Bar but not
+ // loaded, hence we rather rely on document.body than document.location
+ is(win4.document.body.innerHTML, "",
+ "navigating to a data: URI using window.open() should be blocked");
+ test5();
+ }, 1000);
+}
+
+function test5() {
+ // navigating to a URI which redirects to a data: URI using window.open() should be blocked
+ let win5 = window.open("file_block_toplevel_data_redirect.sjs");
+ setTimeout(function () {
+ // Please note that the data: URI will be displayed in the URL-Bar but not
+ // loaded, hence we rather rely on document.body than document.location
+ is(SpecialPowers.wrap(win5).document.body.innerHTML, "",
+ "navigating to URI which redirects to a data: URI using window.open() should be blocked");
+ win5.close();
+ SimpleTest.finish();
+ }, 1000);
+}
+
+// fire up the tests
+test1();
+
+</script>
+</body>
+</html>
diff --git a/dom/security/test/general/test_contentpolicytype_targeted_link_iframe.html b/dom/security/test/general/test_contentpolicytype_targeted_link_iframe.html
index 7b1ab72dc4..3ef2438240 100644
--- a/dom/security/test/general/test_contentpolicytype_targeted_link_iframe.html
+++ b/dom/security/test/general/test_contentpolicytype_targeted_link_iframe.html
@@ -61,6 +61,7 @@ var policy = {
"content policy type should TYPESUBDOCUMENT");
categoryManager.deleteCategoryEntry("content-policy", POLICYNAME, false);
SimpleTest.finish();
+ return Ci.nsIContentPolicy.REJECT_REQUEST;
}
return Ci.nsIContentPolicy.ACCEPT;
},
diff --git a/dom/security/test/moz.build b/dom/security/test/moz.build
index ddb4e9b895..946959deea 100644
--- a/dom/security/test/moz.build
+++ b/dom/security/test/moz.build
@@ -27,5 +27,6 @@ MOCHITEST_CHROME_MANIFESTS += [
BROWSER_CHROME_MANIFESTS += [
'contentverifier/browser.ini',
'csp/browser.ini',
+ 'general/browser.ini',
'hsts/browser.ini',
]
diff --git a/dom/svg/DOMSVGPathSegList.cpp b/dom/svg/DOMSVGPathSegList.cpp
index edacdfc93e..0b811cdb1f 100644
--- a/dom/svg/DOMSVGPathSegList.cpp
+++ b/dom/svg/DOMSVGPathSegList.cpp
@@ -460,6 +460,18 @@ DOMSVGPathSegList::ReplaceItem(DOMSVGPathSeg& aNewItem,
float segAsRaw[1 + NS_SVG_PATH_SEG_MAX_ARGS];
domItem->ToSVGPathSegEncodedData(segAsRaw);
+ if (AnimListMirrorsBaseList()) {
+ // The anim val list is in sync with the base val list - remove mirroring
+ // animVal item if necessary. We do this *before* touching InternalList()
+ // so the removed item can correctly store its internal value.
+ DOMSVGPathSegList* animVal =
+ GetDOMWrapperIfExists(InternalAList().GetAnimValKey());
+ if (animVal->ItemAt(aIndex)) {
+ animVal->ItemAt(aIndex)->RemovingFromList();
+ animVal->ItemAt(aIndex) = nullptr;
+ }
+ }
+
if (!InternalList().mData.ReplaceElementsAt(internalIndex, 1 + oldArgCount,
segAsRaw, 1 + newArgCount,
fallible)) {
@@ -474,8 +486,13 @@ DOMSVGPathSegList::ReplaceItem(DOMSVGPathSeg& aNewItem,
int32_t delta = newArgCount - oldArgCount;
if (delta != 0) {
- for (uint32_t i = aIndex + 1; i < LengthNoFlush(); ++i) {
- mItems[i].mInternalDataIndex += delta;
+ // Sync up the internal indexes of all ItemProxys that come after aIndex:
+ UpdateListIndicesFromIndex(aIndex + 1, delta);
+ if (AnimListMirrorsBaseList()) {
+ // The anim val list is in sync with the base val list
+ DOMSVGPathSegList* animVal =
+ GetDOMWrapperIfExists(InternalAList().GetAnimValKey());
+ animVal->UpdateListIndicesFromIndex(aIndex + 1, delta);
}
}
diff --git a/dom/svg/SVGClipPathElement.cpp b/dom/svg/SVGClipPathElement.cpp
index 60d72fdf04..682d1271e1 100644
--- a/dom/svg/SVGClipPathElement.cpp
+++ b/dom/svg/SVGClipPathElement.cpp
@@ -50,6 +50,13 @@ SVGClipPathElement::GetEnumInfo()
ArrayLength(sEnumInfo));
}
+bool
+SVGClipPathElement::IsUnitsObjectBoundingBox() const
+{
+ return mEnumAttributes[CLIPPATHUNITS].GetAnimValue() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX;
+}
+
+
//----------------------------------------------------------------------
// nsIDOMNode methods
diff --git a/dom/svg/SVGClipPathElement.h b/dom/svg/SVGClipPathElement.h
index d84f5b30fb..2d9f4c15e5 100644
--- a/dom/svg/SVGClipPathElement.h
+++ b/dom/svg/SVGClipPathElement.h
@@ -36,6 +36,10 @@ public:
// WebIDL
already_AddRefed<SVGAnimatedEnumeration> ClipPathUnits();
+ // This is an internal method that does not flush style, and thus
+ // the answer may be out of date if there's a pending style flush.
+ bool IsUnitsObjectBoundingBox() const;
+
protected:
enum { CLIPPATHUNITS };
diff --git a/dom/svg/SVGTextContentElement.h b/dom/svg/SVGTextContentElement.h
index 905468228f..5f126c8112 100644
--- a/dom/svg/SVGTextContentElement.h
+++ b/dom/svg/SVGTextContentElement.h
@@ -29,6 +29,7 @@ typedef SVGGraphicsElement SVGTextContentElementBase;
class SVGTextContentElement : public SVGTextContentElementBase
{
+ friend class ::SVGTextFrame;
public:
using FragmentOrElement::TextLength;
diff --git a/dom/tests/browser/browser.ini b/dom/tests/browser/browser.ini
index 35ebd56c67..4d3a60a2cc 100644..100755
--- a/dom/tests/browser/browser.ini
+++ b/dom/tests/browser/browser.ini
@@ -8,6 +8,7 @@ support-files =
worker_bug1004814.js
geo_leak_test.html
dummy.html
+ file_workerPerformance.js
test_largeAllocation.html
test_largeAllocation.html^headers^
!/dom/tests/mochitest/geolocation/network_geolocation.sjs
@@ -44,3 +45,4 @@ support-files =
support-files =
test_new_window_from_content_child.html
[browser_xhr_sandbox.js]
+[browser_performanceAPI.js]
diff --git a/dom/tests/browser/browser_performanceAPI.js b/dom/tests/browser/browser_performanceAPI.js
new file mode 100755
index 0000000000..2c28fe3d17
--- /dev/null
+++ b/dom/tests/browser/browser_performanceAPI.js
@@ -0,0 +1,139 @@
+/**
+ * Bug 1369303 - A test for making sure that performance APIs have been correctly
+ * spoofed or disabled.
+ */
+
+const TEST_PATH = "http://example.net/browser/" +
+ "dom/tests/browser/";
+
+const PERFORMANCE_TIMINGS = [
+ "navigationStart",
+ "unloadEventStart",
+ "unloadEventEnd",
+ "redirectStart",
+ "redirectEnd",
+ "fetchStart",
+ "domainLookupStart",
+ "domainLookupEnd",
+ "connectStart",
+ "connectEnd",
+ "requestStart",
+ "responseStart",
+ "responseEnd",
+ "domLoading",
+ "domInteractive",
+ "domContentLoadedEventStart",
+ "domContentLoadedEventEnd",
+ "domComplete",
+ "loadEventStart",
+ "loadEventEnd",
+];
+
+let isRounded = (x, expectedPrecision) => {
+ let rounded = (Math.floor(x / expectedPrecision) * expectedPrecision);
+ // First we do the perfectly normal check that should work just fine
+ if (rounded === x || x === 0)
+ return true;
+
+ // When we're diving by non-whole numbers, we may not get perfect
+ // multiplication/division because of floating points
+ if (Math.abs(rounded - x + expectedPrecision) < .0000001) {
+ return true;
+ } else if (Math.abs(rounded - x) < .0000001) {
+ return true;
+ }
+
+ // Then we handle the case where you're sub-millisecond and the timer is not
+ // We check that the timer is not sub-millisecond by assuming it is not if it
+ // returns an even number of milliseconds
+ if (expectedPrecision < 1 && Math.round(x) == x) {
+ if (Math.round(rounded) == x) {
+ return true;
+ }
+ }
+
+ ok(false, "Looming Test Failure, Additional Debugging Info: Expected Precision: " + expectedPrecision + " Measured Value: " + x +
+ " Rounded Vaue: " + rounded + " Fuzzy1: " + Math.abs(rounded - x + expectedPrecision) +
+ " Fuzzy 2: " + Math.abs(rounded - x));
+
+ return false;
+};
+
+// ================================================================================================
+// ================================================================================================
+add_task(function* () {
+ let tab = yield BrowserTestUtils.openNewForegroundTab(
+ gBrowser, TEST_PATH + "dummy.html");
+
+ yield ContentTask.spawn(tab.linkedBrowser, {
+ list: PERFORMANCE_TIMINGS,
+ precision: 2,
+ isRoundedFunc: isRounded.toString()
+ }, (data) => {
+ let timerlist = data.list;
+ let expectedPrecision = data.precision;
+ // eslint beleives that isrounded is available in this scope, but if you
+ // remove the assignment, you will see it is not
+ // eslint-disable-next-line
+ let isRounded = eval(data.isRoundedFunc);
+
+ // Check that whether the performance timing API is correctly spoofed.
+ for (let time of timerlist) {
+ ok(isRounded(content.performance.timing[time], expectedPrecision), `For reduceTimerPrecision(` + expectedPrecision + `), the timing(${time}) is not correctly rounded: ` + content.performance.timing[time]);
+ }
+
+ // Try to add some entries.
+ content.performance.mark("Test");
+ content.performance.mark("Test-End");
+ content.performance.measure("Test-Measure", "Test", "Test-End");
+
+ // Check the entries for performance.getEntries/getEntriesByType/getEntriesByName.
+ is(content.performance.getEntries().length, 3, "For reduceTimerPrecision, there should be 3 entries for performance.getEntries()");
+ for (var i = 0; i < 3; i++) {
+ let startTime = content.performance.getEntries()[i].startTime;
+ let duration = content.performance.getEntries()[i].duration;
+ ok(isRounded(startTime, expectedPrecision), "For reduceTimerPrecision(" + expectedPrecision + "), performance.getEntries(" + i + ").startTime is not rounded: " + startTime);
+ ok(isRounded(duration, expectedPrecision), "For reduceTimerPrecision(" + expectedPrecision + "), performance.getEntries(" + i + ").duration is not rounded: " + duration);
+ }
+ is(content.performance.getEntriesByType("mark").length, 2, "For reduceTimerPrecision, there should be 2 entries for performance.getEntriesByType()");
+ is(content.performance.getEntriesByName("Test", "mark").length, 1, "For reduceTimerPrecision, there should be 1 entry for performance.getEntriesByName()");
+ content.performance.clearMarks();
+ content.performance.clearMeasures();
+ content.performance.clearResourceTimings();
+ });
+ gBrowser.removeTab(tab);
+});
+
+// ================================================================================================
+// ================================================================================================
+add_task(function*() {
+ let tab = yield BrowserTestUtils.openNewForegroundTab(
+ gBrowser, TEST_PATH + "dummy.html");
+
+ yield ContentTask.spawn(tab.linkedBrowser, {
+ list: PERFORMANCE_TIMINGS,
+ precision: 2,
+ isRoundedFunc: isRounded.toString()
+ }, (data) => {
+ let expectedPrecision = data.precision;
+ let workerCall = data.workerCall;
+ return new Promise(resolve => {
+ let worker = new content.Worker("file_workerPerformance.js");
+ worker.onmessage = function(e) {
+ if (e.data.type == "status") {
+ ok(e.data.status, e.data.msg);
+ } else if (e.data.type == "finish") {
+ worker.terminate();
+ resolve();
+ } else {
+ ok(false, "Unknown message type");
+ worker.terminate();
+ resolve();
+ }
+ };
+ worker.postMessage({precision: expectedPrecision});
+ });
+ });
+
+ gBrowser.removeTab(tab);
+});
diff --git a/dom/tests/browser/file_workerPerformance.js b/dom/tests/browser/file_workerPerformance.js
new file mode 100755
index 0000000000..c77ba4377b
--- /dev/null
+++ b/dom/tests/browser/file_workerPerformance.js
@@ -0,0 +1,65 @@
+function ok(a, msg) {
+ postMessage({type: "status", status: !!a, msg});
+}
+
+function is(a, b, msg) {
+ ok(a === b, msg);
+}
+
+function finish() {
+ postMessage({type: "finish"});
+}
+
+let isRounded = (x, expectedPrecision) => {
+ let rounded = (Math.floor(x / expectedPrecision) * expectedPrecision);
+ // First we do the perfectly normal check that should work just fine
+ if (rounded === x || x === 0)
+ return true;
+
+ // When we're diving by non-whole numbers, we may not get perfect
+ // multiplication/division because of floating points
+ if (Math.abs(rounded - x + expectedPrecision) < .0000001) {
+ return true;
+ } else if (Math.abs(rounded - x) < .0000001) {
+ return true;
+ }
+
+ // Then we handle the case where you're sub-millisecond and the timer is not
+ // We check that the timer is not sub-millisecond by assuming it is not if it
+ // returns an even number of milliseconds
+ if (expectedPrecision < 1 && Math.round(x) == x) {
+ if (Math.round(rounded) == x) {
+ return true;
+ }
+ }
+
+ ok(false, "Looming Test Failure, Additional Debugging Info: Expected Precision: " + expectedPrecision + " Measured Value: " + x +
+ " Rounded Vaue: " + rounded + " Fuzzy1: " + Math.abs(rounded - x + expectedPrecision) +
+ " Fuzzy 2: " + Math.abs(rounded - x));
+
+ return false;
+};
+
+function runRTPTests(expectedPrecision) {
+ // Try to add some entries.
+ performance.mark("Test");
+ performance.mark("Test-End");
+ performance.measure("Test-Measure", "Test", "Test-End");
+
+ // Check the entries in performance.getEntries/getEntriesByType/getEntriesByName.
+ is(performance.getEntries().length, 3, "In a worker, for reduceTimerPrecision: Incorrect number of entries for performance.getEntries() for workers: " + performance.getEntries().length);
+ for (var i = 0; i < 3; i++) {
+ let startTime = performance.getEntries()[i].startTime;
+ let duration = performance.getEntries()[i].duration;
+ ok(isRounded(startTime, expectedPrecision), "In a worker, for reduceTimerPrecision(" + expectedPrecision + "), performance.getEntries(" + i.toString() + ").startTime is not rounded: " + startTime.toString());
+ ok(isRounded(duration, expectedPrecision), "In a worker, for reduceTimerPrecision(" + expectedPrecision + "), performance.getEntries(" + i.toString() + ").duration is not rounded: " + duration.toString());
+ }
+ is(performance.getEntriesByType("mark").length, 2, "In a worker, for reduceTimerPrecision: Incorrect number of entries for performance.getEntriesByType() for workers: " + performance.getEntriesByType("resource").length);
+ is(performance.getEntriesByName("Test", "mark").length, 1, "In a worker, for reduceTimerPrecision: Incorrect number of entries for performance.getEntriesByName() for workers: " + performance.getEntriesByName("Test", "mark").length);
+
+ finish();
+}
+
+self.onmessage = function(e) {
+ runRTPTests(e.data.precision);
+};
diff --git a/dom/tests/mochitest/fetch/test_headers_common.js b/dom/tests/mochitest/fetch/test_headers_common.js
index fe792b25b5..8b17b6b12a 100644
--- a/dom/tests/mochitest/fetch/test_headers_common.js
+++ b/dom/tests/mochitest/fetch/test_headers_common.js
@@ -213,12 +213,12 @@ function TestHeadersIterator() {
var value_iter = headers.values();
var entries_iter = headers.entries();
- arrayEquals(iterate(key_iter), ["foo", "foo", "foo2"], "Correct key iterator");
- arrayEquals(iterate(value_iter), ["bar", ehsanInflated, "baz2"], "Correct value iterator");
- arrayEquals(iterate(entries_iter), [["foo", "bar"], ["foo", ehsanInflated], ["foo2", "baz2"]], "Correct entries iterator");
+ arrayEquals(iterate(key_iter), ["foo", "foo2"], "Correct key iterator");
+ arrayEquals(iterate(value_iter), ["bar, " + ehsanInflated, "baz2"], "Correct value iterator");
+ arrayEquals(iterate(entries_iter), [["foo", "bar, " + ehsanInflated], ["foo2", "baz2"]], "Correct entries iterator");
- arrayEquals(iterateForOf(headers), [["foo", "bar"], ["foo", ehsanInflated], ["foo2", "baz2"]], "Correct entries iterator");
- arrayEquals(iterateForOf(new Headers(headers)), [["foo", "bar"], ["foo", ehsanInflated], ["foo2", "baz2"]], "Correct entries iterator");
+ arrayEquals(iterateForOf(headers), [["foo", "bar, " + ehsanInflated], ["foo2", "baz2"]], "Correct entries iterator");
+ arrayEquals(iterateForOf(new Headers(headers)), [["foo", "bar, " + ehsanInflated], ["foo2", "baz2"]], "Correct entries iterator");
}
function runTest() {
diff --git a/dom/tests/mochitest/general/mochitest.ini b/dom/tests/mochitest/general/mochitest.ini
index d595278015..d00ea1d4bc 100644..100755
--- a/dom/tests/mochitest/general/mochitest.ini
+++ b/dom/tests/mochitest/general/mochitest.ini
@@ -43,6 +43,8 @@ support-files =
frameStoragePrevented.html
frameStorageChrome.html
frameStorageNullprincipal.sjs
+ worker_child.js
+ worker_grandchild.js
workerStorageAllowed.js
workerStoragePrevented.js
storagePermissionsUtils.js
@@ -108,6 +110,7 @@ support-files = test_offsets.js
[test_picture_mutations.html]
[test_pointerPreserves3D.html]
[test_pointerPreserves3DClip.html]
+[test_reduce_time_precision.html]
[test_resource_timing.html]
[test_resource_timing_cross_origin.html]
[test_resource_timing_frameset.html]
diff --git a/dom/tests/mochitest/general/test_interfaces.html b/dom/tests/mochitest/general/test_interfaces.html
index acbc12e072..4b47d2b4f7 100644
--- a/dom/tests/mochitest/general/test_interfaces.html
+++ b/dom/tests/mochitest/general/test_interfaces.html
@@ -751,9 +751,11 @@ var interfaceNamesInGlobalScope =
// IMPORTANT: Do not change this list without review from a DOM peer!
"PerformanceNavigation",
// IMPORTANT: Do not change this list without review from a DOM peer!
- {name: "PerformanceObserver", nightly: true},
+ "PerformanceNavigationTiming",
// IMPORTANT: Do not change this list without review from a DOM peer!
- {name: "PerformanceObserverEntryList", nightly: true},
+ "PerformanceObserver"
+// IMPORTANT: Do not change this list without review from a DOM peer!
+ "PerformanceObserverEntryList"
// IMPORTANT: Do not change this list without review from a DOM peer!
"PerformanceResourceTiming",
// IMPORTANT: Do not change this list without review from a DOM peer!
diff --git a/dom/tests/mochitest/general/test_reduce_time_precision.html b/dom/tests/mochitest/general/test_reduce_time_precision.html
new file mode 100755
index 0000000000..6f149f28d8
--- /dev/null
+++ b/dom/tests/mochitest/general/test_reduce_time_precision.html
@@ -0,0 +1,143 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+Tor bug
+https://trac.torproject.org/projects/tor/ticket/1517
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Tor Bug 1517 and Mozilla Bug 1424341</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://trac.torproject.org/projects/tor/ticket/1517">Tor Bug 1517</a>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1424341">Mozilla Bug 1424341</a>
+
+<!-- Canvas for testing 'currentTime' -->
+<canvas id="test-canvas" width="100" height="100"></canvas>
+
+<!-- The main testing script -->
+<script type="application/javascript">
+ SimpleTest.requestFlakyTimeout("testing JS time-based fingerprinting");
+
+ // Prepare for test of AudioContext.currentTime
+ let audioContext = new AudioContext();
+ // Prepare for test of CanvasStream.currentTime
+ let canvas = document.getElementById("test-canvas");
+ let context = canvas.getContext("2d");
+ context.fillText("test", 20, 20);
+ let canvasStream = canvas.captureStream(25);
+
+ // Known ways to generate time stamps, in milliseconds
+ const timeStampCodes = [
+ "performance.now()",
+ "new Date().getTime()",
+ "new Event(\"\").timeStamp",
+ "new File([], \"\").lastModified",
+ "new File([], \"\").lastModifiedDate.getTime()",
+ ];
+ // These are measured in seconds, so we need to scale them up
+ var timeStampCodesDOM = timeStampCodes.concat([
+ "audioContext.currentTime * 1000",
+ "canvasStream.currentTime * 1000",
+ ]);
+
+ let isRounded = (x) => {
+ expectedPrecision = 2;
+ let rounded = (Math.floor(x / expectedPrecision) * expectedPrecision);
+ // First we do the perfectly normal check that should work just fine
+ if (rounded === x || x === 0)
+ return true;
+
+ // When we're diving by non-whole numbers, we may not get perfect
+ // multiplication/division because of floating points.
+ // When dealing with ms since epoch, a double's precision is on the order
+ // of 1/5 of a microsecond, so we use a value a little higher than that as
+ // our epsilon.
+ // To be clear, this error is introduced in our re-calculation of 'rounded'
+ // above in JavaScript.
+ if (Math.abs(rounded - x + expectedPrecision) < .0005) {
+ return true;
+ } else if (Math.abs(rounded - x) < .0005) {
+ return true;
+ }
+
+ // Then we handle the case where you're sub-millisecond and the timer is not
+ // We check that the timer is not sub-millisecond by assuming it is not if it
+ // returns an even number of milliseconds
+ if (expectedPrecision < 1 && Math.round(x) == x) {
+ if (Math.round(rounded) == x) {
+ return true;
+ }
+ }
+
+ ok(false, "Looming Test Failure, Additional Debugging Info: Expected Precision: " + expectedPrecision + " Measured Value: " + x +
+ " Rounded Vaue: " + rounded + " Fuzzy1: " + Math.abs(rounded - x + expectedPrecision) +
+ " Fuzzy 2: " + Math.abs(rounded - x));
+
+ return false;
+ };
+
+ // ================================================================================================
+ // ================================================================================================
+
+ function* checkWorker(worker) {
+ // The child worker will send the results back.
+ let checkWorkerTimeStamps = () => new Promise(function(resolve) {
+ let onMessage = function(event) {
+ worker.removeEventListener("message", onMessage);
+
+ let timeStamps = event.data;
+ for (let i = 0; i < timeStampCodes.length; i++) {
+ let timeStamp = timeStamps[i];
+ ok(isRounded(timeStamp),
+ "'" + timeStampCodes[i] +
+ "' should be rounded to nearest 2 ms in workers; saw " +
+ timeStamp);
+ }
+ resolve();
+ };
+ worker.addEventListener("message", onMessage);
+ });
+
+ // Send the codes to its child worker.
+ worker.postMessage(timeStampCodes);
+
+ // First, check the child's results.
+ yield checkWorkerTimeStamps();
+ // Then, check the grandchild's results.
+ yield checkWorkerTimeStamps();
+
+ worker.terminate();
+ }
+
+ add_task(function*() {
+ let worker = new Worker("worker_child.js");
+ // Allow ~550 ms to elapse, so we can get non-zero
+ // time values for all elements.
+ yield new Promise(resolve => window.setTimeout(resolve, 550));
+ yield checkWorker(worker);
+ });
+
+ // ================================================================================================
+ // ================================================================================================
+
+
+ add_task(function*() {
+ // Loop through each timeStampCode, evaluate it,
+ // and check if it is rounded
+ for (let timeStampCode of timeStampCodesDOM) {
+ let timeStamp = eval(timeStampCode);
+ ok(isRounded(timeStamp),
+ "'" + timeStampCode + "' should be rounded to nearest 2ms" +
+ " saw " + timeStamp);
+ }
+ });
+
+</script>
+
+
+</body>
+</html>
diff --git a/dom/tests/mochitest/general/worker_child.js b/dom/tests/mochitest/general/worker_child.js
new file mode 100755
index 0000000000..fa340fc652
--- /dev/null
+++ b/dom/tests/mochitest/general/worker_child.js
@@ -0,0 +1,28 @@
+let timeStampCodes;
+let worker = new Worker("worker_grandchild.js");
+
+function listenToParent(event) {
+ self.removeEventListener("message", listenToParent);
+ timeStampCodes = event.data;
+
+ let timeStamps = [];
+ for (let timeStampCode of timeStampCodes) {
+ timeStamps.push(eval(timeStampCode));
+ }
+ // Send the timeStamps to the parent.
+ postMessage(timeStamps);
+
+ // Tell the grandchild to start.
+ worker.postMessage(timeStampCodes);
+}
+
+// The worker grandchild will send results back.
+function listenToChild(event) {
+ worker.removeEventListener("message", listenToChild);
+ // Pass the results to the parent.
+ postMessage(event.data);
+ worker.terminate();
+}
+
+worker.addEventListener("message", listenToChild);
+self.addEventListener("message", listenToParent);
diff --git a/dom/tests/mochitest/general/worker_grandchild.js b/dom/tests/mochitest/general/worker_grandchild.js
new file mode 100755
index 0000000000..cd21508b2b
--- /dev/null
+++ b/dom/tests/mochitest/general/worker_grandchild.js
@@ -0,0 +1,10 @@
+self.addEventListener("message", function(event) {
+ let timeStampCodes = event.data;
+
+ let timeStamps = [];
+ for (let timeStampCode of timeStampCodes) {
+ timeStamps.push(eval(timeStampCode));
+ }
+ // Send the timeStamps to the parent.
+ postMessage(timeStamps);
+});
diff --git a/dom/url/URL.cpp b/dom/url/URL.cpp
index 1f15e11514..c8724c3597 100644
--- a/dom/url/URL.cpp
+++ b/dom/url/URL.cpp
@@ -17,7 +17,6 @@
#include "nsEscape.h"
#include "nsHostObjectProtocolHandler.h"
#include "nsIIOService.h"
-#include "nsIURIWithQuery.h"
#include "nsIURL.h"
#include "nsNetCID.h"
#include "nsNetUtil.h"
@@ -525,21 +524,10 @@ URLMainThread::GetPathname(nsAString& aPathname, ErrorResult& aRv) const
// Do not throw! Not having a valid URI or URL should result in an empty
// string.
- nsCOMPtr<nsIURIWithQuery> url(do_QueryInterface(mURI));
- if (url) {
- nsAutoCString file;
- nsresult rv = url->GetFilePath(file);
- if (NS_SUCCEEDED(rv)) {
- CopyUTF8toUTF16(file, aPathname);
- }
-
- return;
- }
-
- nsAutoCString path;
- nsresult rv = mURI->GetPath(path);
+ nsAutoCString file;
+ nsresult rv = mURI->GetFilePath(file);
if (NS_SUCCEEDED(rv)) {
- CopyUTF8toUTF16(path, aPathname);
+ CopyUTF8toUTF16(file, aPathname);
}
}
@@ -548,11 +536,7 @@ URLMainThread::SetPathname(const nsAString& aPathname, ErrorResult& aRv)
{
// Do not throw!
- nsCOMPtr<nsIURIWithQuery> url(do_QueryInterface(mURI));
- if (url) {
- url->SetFilePath(NS_ConvertUTF16toUTF8(aPathname));
- return;
- }
+ mURI->SetFilePath(NS_ConvertUTF16toUTF8(aPathname));
}
void
@@ -566,13 +550,9 @@ URLMainThread::GetSearch(nsAString& aSearch, ErrorResult& aRv) const
nsAutoCString search;
nsresult rv;
- nsCOMPtr<nsIURIWithQuery> url(do_QueryInterface(mURI));
- if (url) {
- rv = url->GetQuery(search);
- if (NS_SUCCEEDED(rv) && !search.IsEmpty()) {
- CopyUTF8toUTF16(NS_LITERAL_CSTRING("?") + search, aSearch);
- }
- return;
+ rv = mURI->GetQuery(search);
+ if (NS_SUCCEEDED(rv) && !search.IsEmpty()) {
+ CopyUTF8toUTF16(NS_LITERAL_CSTRING("?") + search, aSearch);
}
}
@@ -603,11 +583,7 @@ URLMainThread::SetSearchInternal(const nsAString& aSearch, ErrorResult& aRv)
{
// Ignore failures to be compatible with NS4.
- nsCOMPtr<nsIURIWithQuery> uriWithQuery(do_QueryInterface(mURI));
- if (uriWithQuery) {
- uriWithQuery->SetQuery(NS_ConvertUTF16toUTF8(aSearch));
- return;
- }
+ mURI->SetQuery(NS_ConvertUTF16toUTF8(aSearch));
}
} // anonymous namespace
diff --git a/dom/url/tests/test_url.html b/dom/url/tests/test_url.html
index d07a752bb4..73e75667d8 100644
--- a/dom/url/tests/test_url.html
+++ b/dom/url/tests/test_url.html
@@ -399,6 +399,18 @@
</script>
<script>
+ /** Test for Bug 1275746 **/
+ SimpleTest.doesThrow(() => { var url = new URL("http:"); }, "http: is not a valid URL");
+ SimpleTest.doesThrow(() => { var url = new URL("http:///"); }, "http: is not a valid URL");
+
+ var url = new URL("file:");
+ is(url.href, "file:///", "Parsing file: should work.");
+
+ url = new URL("file:///");
+ is(url.href, "file:///", "Parsing file:/// should work.");
+ </script>
+
+ <script>
var url = new URL("scheme:path/to/file?query#hash");
is(url.href, "scheme:path/to/file?query#hash");
is(url.pathname, "path/to/file");
diff --git a/dom/webidl/CanvasRenderingContext2D.webidl b/dom/webidl/CanvasRenderingContext2D.webidl
index 38a30f9e39..1c55642152 100644
--- a/dom/webidl/CanvasRenderingContext2D.webidl
+++ b/dom/webidl/CanvasRenderingContext2D.webidl
@@ -27,6 +27,9 @@ dictionary HitRegionOptions {
};
typedef (HTMLImageElement or
+ SVGImageElement) HTMLOrSVGImageElement;
+
+typedef (HTMLOrSVGImageElement or
HTMLCanvasElement or
HTMLVideoElement or
ImageBitmap) CanvasImageSource;
diff --git a/dom/webidl/Document.webidl b/dom/webidl/Document.webidl
index f05656e840..0b8c278fea 100644
--- a/dom/webidl/Document.webidl
+++ b/dom/webidl/Document.webidl
@@ -430,6 +430,12 @@ partial interface Document {
void removeAnonymousContent(AnonymousContent aContent);
};
+// http://w3c.github.io/selection-api/#extensions-to-document-interface
+partial interface Document {
+ [Throws]
+ Selection? getSelection();
+};
+
// Extension to give chrome JS the ability to determine whether
// the user has interacted with the document or not.
partial interface Document {
diff --git a/dom/webidl/EventHandler.webidl b/dom/webidl/EventHandler.webidl
index 306372ff11..1edc45ac93 100644
--- a/dom/webidl/EventHandler.webidl
+++ b/dom/webidl/EventHandler.webidl
@@ -33,6 +33,7 @@ interface GlobalEventHandlers {
// attribute OnErrorEventHandler onerror;
attribute EventHandler onfocus;
//(Not implemented)attribute EventHandler oncancel;
+ attribute EventHandler onauxclick;
attribute EventHandler oncanplay;
attribute EventHandler oncanplaythrough;
attribute EventHandler onchange;
diff --git a/dom/webidl/HTMLDocument.webidl b/dom/webidl/HTMLDocument.webidl
index 61b466ff0d..42f6d98f79 100644
--- a/dom/webidl/HTMLDocument.webidl
+++ b/dom/webidl/HTMLDocument.webidl
@@ -73,10 +73,6 @@ interface HTMLDocument : Document {
readonly attribute HTMLAllCollection all;
- // https://dvcs.w3.org/hg/editing/raw-file/tip/editing.html#selections
- [Throws]
- Selection? getSelection();
-
// @deprecated These are old Netscape 4 methods. Do not use,
// the implementation is no-op.
// XXXbz do we actually need these anymore?
diff --git a/dom/webidl/HTMLInputElement.webidl b/dom/webidl/HTMLInputElement.webidl
index 050d195107..cf3e9a4c71 100644
--- a/dom/webidl/HTMLInputElement.webidl
+++ b/dom/webidl/HTMLInputElement.webidl
@@ -238,6 +238,9 @@ partial interface HTMLInputElement {
dictionary DateTimeValue {
long hour;
long minute;
+ long year;
+ long month;
+ long day;
};
partial interface HTMLInputElement {
@@ -250,6 +253,14 @@ partial interface HTMLInputElement {
[Pref="dom.forms.datetime", ChromeOnly]
void setDateTimePickerState(boolean open);
+ [Pref="dom.forms.datetime", ChromeOnly,
+ BinaryName="getMinimumAsDouble"]
+ double getMinimum();
+
+ [Pref="dom.forms.datetime", ChromeOnly,
+ BinaryName="getMaximumAsDouble"]
+ double getMaximum();
+
[Pref="dom.forms.datetime", Func="IsChromeOrXBL"]
void openDateTimePicker(optional DateTimeValue initialValue);
@@ -258,4 +269,12 @@ partial interface HTMLInputElement {
[Pref="dom.forms.datetime", Func="IsChromeOrXBL"]
void closeDateTimePicker();
+
+ [Pref="dom.forms.datetime", Func="IsChromeOrXBL",
+ BinaryName="getStepAsDouble"]
+ double getStep();
+
+ [Pref="dom.forms.datetime", Func="IsChromeOrXBL",
+ BinaryName="getStepBaseAsDouble"]
+ double getStepBase();
};
diff --git a/dom/webidl/Performance.webidl b/dom/webidl/Performance.webidl
index eaede253cf..0bd2677df7 100644
--- a/dom/webidl/Performance.webidl
+++ b/dom/webidl/Performance.webidl
@@ -17,6 +17,9 @@ typedef sequence <PerformanceEntry> PerformanceEntryList;
interface Performance {
[DependsOn=DeviceState, Affects=Nothing]
DOMHighResTimeStamp now();
+
+ [Constant]
+ readonly attribute DOMHighResTimeStamp timeOrigin;
};
[Exposed=Window]
diff --git a/dom/webidl/PerformanceNavigationTiming.webidl b/dom/webidl/PerformanceNavigationTiming.webidl
new file mode 100644
index 0000000000..fa3ecaec48
--- /dev/null
+++ b/dom/webidl/PerformanceNavigationTiming.webidl
@@ -0,0 +1,33 @@
+/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * The origin of this IDL file is
+ * https://www.w3.org/TR/navigation-timing-2/#sec-PerformanceNavigationTiming
+ *
+ * Copyright © 2016 W3C® (MIT, ERCIM, Keio, Beihang).
+ * W3C liability, trademark and document use rules apply.
+ */
+
+enum NavigationType {
+ "navigate",
+ "reload",
+ "back_forward",
+ "prerender"
+};
+
+interface PerformanceNavigationTiming : PerformanceResourceTiming {
+ readonly attribute DOMHighResTimeStamp unloadEventStart;
+ readonly attribute DOMHighResTimeStamp unloadEventEnd;
+ readonly attribute DOMHighResTimeStamp domInteractive;
+ readonly attribute DOMHighResTimeStamp domContentLoadedEventStart;
+ readonly attribute DOMHighResTimeStamp domContentLoadedEventEnd;
+ readonly attribute DOMHighResTimeStamp domComplete;
+ readonly attribute DOMHighResTimeStamp loadEventStart;
+ readonly attribute DOMHighResTimeStamp loadEventEnd;
+ readonly attribute NavigationType type;
+ readonly attribute unsigned short redirectCount;
+
+ jsonifier;
+};
diff --git a/dom/webidl/PerformanceObserver.webidl b/dom/webidl/PerformanceObserver.webidl
index a3a14cb1e5..4cebecbeba 100644
--- a/dom/webidl/PerformanceObserver.webidl
+++ b/dom/webidl/PerformanceObserver.webidl
@@ -9,6 +9,7 @@
dictionary PerformanceObserverInit {
required sequence<DOMString> entryTypes;
+ boolean buffered = false;
};
callback PerformanceObserverCallback = void (PerformanceObserverEntryList entries, PerformanceObserver observer);
diff --git a/dom/webidl/PerformanceResourceTiming.webidl b/dom/webidl/PerformanceResourceTiming.webidl
index 021b84ae2c..112228325a 100644
--- a/dom/webidl/PerformanceResourceTiming.webidl
+++ b/dom/webidl/PerformanceResourceTiming.webidl
@@ -4,7 +4,7 @@
* You can obtain one at http://mozilla.org/MPL/2.0/.
*
* The origin of this IDL file is
- * http://w3c-test.org/webperf/specs/ResourceTiming/#performanceresourcetiming
+ * https://w3c.github.io/resource-timing/#performanceresourcetiming
*
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
* liability, trademark and document use rules apply.
@@ -12,14 +12,10 @@
interface PerformanceResourceTiming : PerformanceEntry
{
- // A string with the name of that element that initiated the load.
- // If the initiator is a CSS resource, the initiatorType attribute must return
- // the string "css".
- // If the initiator is an XMLHttpRequest object, the initiatorType attribute
- // must return the string "xmlhttprequest".
readonly attribute DOMString initiatorType;
readonly attribute DOMString nextHopProtocol;
+ readonly attribute DOMHighResTimeStamp workerStart;
readonly attribute DOMHighResTimeStamp redirectStart;
readonly attribute DOMHighResTimeStamp redirectEnd;
readonly attribute DOMHighResTimeStamp fetchStart;
diff --git a/dom/webidl/PerformanceTiming.webidl b/dom/webidl/PerformanceTiming.webidl
index e142014407..4aa403a50c 100644
--- a/dom/webidl/PerformanceTiming.webidl
+++ b/dom/webidl/PerformanceTiming.webidl
@@ -33,5 +33,11 @@ interface PerformanceTiming {
readonly attribute unsigned long long loadEventStart;
readonly attribute unsigned long long loadEventEnd;
+ // This is a Chrome proprietary extension and not part of the
+ // performance/navigation timing specification.
+ // Returns 0 if a non-blank paint has not happened.
+ [Pref="dom.performance.time_to_non_blank_paint.enabled"]
+ readonly attribute unsigned long long timeToNonBlankPaint;
+
jsonifier;
};
diff --git a/dom/webidl/PointerEvent.webidl b/dom/webidl/PointerEvent.webidl
index 2e83922c84..4e8a0eb901 100644
--- a/dom/webidl/PointerEvent.webidl
+++ b/dom/webidl/PointerEvent.webidl
@@ -17,8 +17,10 @@ interface PointerEvent : MouseEvent
readonly attribute long width;
readonly attribute long height;
readonly attribute float pressure;
+ readonly attribute float tangentialPressure;
readonly attribute long tiltX;
readonly attribute long tiltY;
+ readonly attribute long twist;
readonly attribute DOMString pointerType;
readonly attribute boolean isPrimary;
};
@@ -29,8 +31,10 @@ dictionary PointerEventInit : MouseEventInit
long width = 1;
long height = 1;
float pressure = 0;
+ float tangentialPressure = 0;
long tiltX = 0;
long tiltY = 0;
+ long twist = 0;
DOMString pointerType = "";
boolean isPrimary = false;
};
diff --git a/dom/webidl/Response.webidl b/dom/webidl/Response.webidl
index 8713146aa4..08f31fe29a 100644
--- a/dom/webidl/Response.webidl
+++ b/dom/webidl/Response.webidl
@@ -7,7 +7,7 @@
* https://fetch.spec.whatwg.org/#response-class
*/
-[Constructor(optional BodyInit body, optional ResponseInit init),
+[Constructor(optional BodyInit? body, optional ResponseInit init),
Exposed=(Window,Worker)]
interface Response {
[NewObject] static Response error();
diff --git a/dom/webidl/Selection.webidl b/dom/webidl/Selection.webidl
index c90844dfa2..c3eac016cb 100644
--- a/dom/webidl/Selection.webidl
+++ b/dom/webidl/Selection.webidl
@@ -33,6 +33,7 @@ interface Selection {
void deleteFromDocument();
readonly attribute unsigned long rangeCount;
+ readonly attribute DOMString type;
[Throws]
Range getRangeAt(unsigned long index);
[Throws]
@@ -77,7 +78,7 @@ partial interface Selection {
void removeSelectionListener(nsISelectionListener listenerToRemove);
[ChromeOnly,BinaryName="rawType"]
- readonly attribute short type;
+ readonly attribute short selectionType;
[ChromeOnly,Throws,Pref="dom.testing.selection.GetRangesForInterval"]
sequence<Range> GetRangesForInterval(Node beginNode, long beginOffset, Node endNode, long endOffset,
diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build
index 8682aee97e..8469c90012 100644
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -347,6 +347,7 @@ WEBIDL_FILES = [
'PerformanceMark.webidl',
'PerformanceMeasure.webidl',
'PerformanceNavigation.webidl',
+ 'PerformanceNavigationTiming.webidl',
'PerformanceObserver.webidl',
'PerformanceObserverEntryList.webidl',
'PerformanceResourceTiming.webidl',
diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp
index 1f56168732..1739f3d315 100644
--- a/dom/workers/RuntimeService.cpp
+++ b/dom/workers/RuntimeService.cpp
@@ -301,7 +301,9 @@ LoadContextOptions(const char* aPrefName, void* /* aClosure */)
.setNativeRegExp(GetWorkerPref<bool>(NS_LITERAL_CSTRING("native_regexp")))
.setAsyncStack(GetWorkerPref<bool>(NS_LITERAL_CSTRING("asyncstack")))
.setWerror(GetWorkerPref<bool>(NS_LITERAL_CSTRING("werror")))
- .setExtraWarnings(GetWorkerPref<bool>(NS_LITERAL_CSTRING("strict")));
+ .setExtraWarnings(GetWorkerPref<bool>(NS_LITERAL_CSTRING("strict")))
+ .setArrayProtoValues(GetWorkerPref<bool>(
+ NS_LITERAL_CSTRING("array_prototype_values")));
RuntimeService::SetDefaultContextOptions(contextOptions);
diff --git a/dom/workers/ServiceWorkerEvents.cpp b/dom/workers/ServiceWorkerEvents.cpp
index 09b09a24b6..1f79e2c92f 100644
--- a/dom/workers/ServiceWorkerEvents.cpp
+++ b/dom/workers/ServiceWorkerEvents.cpp
@@ -12,6 +12,7 @@
#include "nsINetworkInterceptController.h"
#include "nsIOutputStream.h"
#include "nsIScriptError.h"
+#include "nsITimedChannel.h"
#include "nsIUnicodeDecoder.h"
#include "nsIUnicodeEncoder.h"
#include "nsContentPolicyUtils.h"
@@ -108,6 +109,12 @@ NS_IMETHODIMP
CancelChannelRunnable::Run()
{
MOZ_ASSERT(NS_IsMainThread());
+
+ // TODO: When bug 1204254 is implemented, this time marker should be moved to
+ // the point where the body of the network request is complete.
+ mChannel->SetHandleFetchEventEnd(TimeStamp::Now());
+ mChannel->SaveTimeStampsToUnderlyingChannel();
+
mChannel->Cancel(mStatus);
mRegistration->MaybeScheduleUpdate();
return NS_OK;
@@ -230,6 +237,9 @@ public:
return NS_OK;
}
+ mChannel->SetHandleFetchEventEnd(TimeStamp::Now());
+ mChannel->SaveTimeStampsToUnderlyingChannel();
+
nsCOMPtr<nsIObserverService> obsService = services::GetObserverService();
if (obsService) {
obsService->NotifyObservers(underlyingChannel, "service-worker-synthesized-response", nullptr);
@@ -948,10 +958,8 @@ ExtendableEvent::GetPromise()
}
JSContext* cx = jsapi.cx();
- GlobalObject global(cx, globalObj->GetGlobalJSObject());
-
ErrorResult result;
- RefPtr<Promise> p = Promise::All(global, Move(mPromises), result);
+ RefPtr<Promise> p = Promise::All(cx, Move(mPromises), result);
if (NS_WARN_IF(result.MaybeSetPendingException(cx))) {
return nullptr;
}
diff --git a/dom/workers/ServiceWorkerPrivate.cpp b/dom/workers/ServiceWorkerPrivate.cpp
index eaa548f956..24b2e11e6b 100644
--- a/dom/workers/ServiceWorkerPrivate.cpp
+++ b/dom/workers/ServiceWorkerPrivate.cpp
@@ -13,6 +13,7 @@
#include "nsINetworkInterceptController.h"
#include "nsIPushErrorReporter.h"
#include "nsISupportsImpl.h"
+#include "nsITimedChannel.h"
#include "nsIUploadChannel2.h"
#include "nsNetUtil.h"
#include "nsProxyRelease.h"
@@ -1255,6 +1256,7 @@ class FetchEventRunnable : public ExtendableFunctionalEventWorkerRunnable
nsCString mMethod;
nsString mClientId;
bool mIsReload;
+ bool mMarkLaunchServiceWorkerEnd;
RequestCache mCacheMode;
RequestMode mRequestMode;
RequestRedirect mRequestRedirect;
@@ -1273,13 +1275,15 @@ public:
const nsACString& aScriptSpec,
nsMainThreadPtrHandle<ServiceWorkerRegistrationInfo>& aRegistration,
const nsAString& aDocumentId,
- bool aIsReload)
+ bool aIsReload,
+ bool aMarkLaunchServiceWorkerEnd)
: ExtendableFunctionalEventWorkerRunnable(
aWorkerPrivate, aKeepAliveToken, aRegistration)
, mInterceptedChannel(aChannel)
, mScriptSpec(aScriptSpec)
, mClientId(aDocumentId)
, mIsReload(aIsReload)
+ , mMarkLaunchServiceWorkerEnd(aMarkLaunchServiceWorkerEnd)
, mCacheMode(RequestCache::Default)
, mRequestMode(RequestMode::No_cors)
, mRequestRedirect(RequestRedirect::Follow)
@@ -1417,6 +1421,12 @@ public:
WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
{
MOZ_ASSERT(aWorkerPrivate);
+
+ if (mMarkLaunchServiceWorkerEnd) {
+ mInterceptedChannel->SetLaunchServiceWorkerEnd(TimeStamp::Now());
+ }
+
+ mInterceptedChannel->SetDispatchFetchEventEnd(TimeStamp::Now());
return DispatchFetchEvent(aCx, aWorkerPrivate);
}
@@ -1445,6 +1455,10 @@ private:
NS_IMETHOD Run() override
{
AssertIsOnMainThread();
+
+ mChannel->SetHandleFetchEventEnd(TimeStamp::Now());
+ mChannel->SaveTimeStampsToUnderlyingChannel();
+
nsresult rv = mChannel->ResetInterception();
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
"Failed to resume intercepted network request");
@@ -1520,6 +1534,8 @@ private:
event->PostInit(mInterceptedChannel, mRegistration, mScriptSpec);
event->SetTrusted(true);
+ mInterceptedChannel->SetHandleFetchEventStart(TimeStamp::Now());
+
RefPtr<EventTarget> target = do_QueryObject(aWorkerPrivate->GlobalScope());
nsresult rv2 = target->DispatchDOMEvent(nullptr, event, nullptr, nullptr);
if (NS_WARN_IF(NS_FAILED(rv2)) || !event->WaitToRespond()) {
@@ -1614,9 +1630,21 @@ ServiceWorkerPrivate::SendFetchEvent(nsIInterceptedChannel* aChannel,
nsCOMPtr<nsIRunnable> failRunnable =
NewRunnableMethod(aChannel, &nsIInterceptedChannel::ResetInterception);
- nsresult rv = SpawnWorkerIfNeeded(FetchEvent, failRunnable, aLoadGroup);
+ aChannel->SetLaunchServiceWorkerStart(TimeStamp::Now());
+ aChannel->SetDispatchFetchEventStart(TimeStamp::Now());
+
+ bool newWorkerCreated = false;
+ nsresult rv = SpawnWorkerIfNeeded(FetchEvent,
+ failRunnable,
+ &newWorkerCreated,
+ aLoadGroup);
+
NS_ENSURE_SUCCESS(rv, rv);
+ if (!newWorkerCreated) {
+ aChannel->SetLaunchServiceWorkerEnd(TimeStamp::Now());
+ }
+
nsMainThreadPtrHandle<nsIInterceptedChannel> handle(
new nsMainThreadPtrHolder<nsIInterceptedChannel>(aChannel, false));
@@ -1646,7 +1674,7 @@ ServiceWorkerPrivate::SendFetchEvent(nsIInterceptedChannel* aChannel,
RefPtr<FetchEventRunnable> r =
new FetchEventRunnable(mWorkerPrivate, token, handle,
mInfo->ScriptSpec(), regInfo,
- aDocumentId, aIsReload);
+ aDocumentId, aIsReload, newWorkerCreated);
rv = r->Init();
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
@@ -1669,6 +1697,7 @@ ServiceWorkerPrivate::SendFetchEvent(nsIInterceptedChannel* aChannel,
nsresult
ServiceWorkerPrivate::SpawnWorkerIfNeeded(WakeUpReason aWhy,
nsIRunnable* aLoadFailedRunnable,
+ bool* aNewWorkerCreated,
nsILoadGroup* aLoadGroup)
{
AssertIsOnMainThread();
@@ -1679,6 +1708,12 @@ ServiceWorkerPrivate::SpawnWorkerIfNeeded(WakeUpReason aWhy,
// the overriden load group when intercepting a fetch.
MOZ_ASSERT_IF(aWhy == FetchEvent, aLoadGroup);
+ // Defaults to no new worker created, but if there is one, we'll set the value
+ // to true at the end of this function.
+ if (aNewWorkerCreated) {
+ *aNewWorkerCreated = false;
+ }
+
if (mWorkerPrivate) {
mWorkerPrivate->UpdateOverridenLoadGroup(aLoadGroup);
RenewKeepAliveToken(aWhy);
@@ -1762,6 +1797,10 @@ ServiceWorkerPrivate::SpawnWorkerIfNeeded(WakeUpReason aWhy,
RenewKeepAliveToken(aWhy);
+ if (aNewWorkerCreated) {
+ *aNewWorkerCreated = true;
+ }
+
return NS_OK;
}
diff --git a/dom/workers/ServiceWorkerPrivate.h b/dom/workers/ServiceWorkerPrivate.h
index 8d59ea1d0b..911b07a110 100644
--- a/dom/workers/ServiceWorkerPrivate.h
+++ b/dom/workers/ServiceWorkerPrivate.h
@@ -189,6 +189,7 @@ private:
nsresult
SpawnWorkerIfNeeded(WakeUpReason aWhy,
nsIRunnable* aLoadFailedRunnable,
+ bool* aNewWorkerCreated = nullptr,
nsILoadGroup* aLoadGroup = nullptr);
~ServiceWorkerPrivate();
diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp
index c2ab4aca38..8848e881a7 100644
--- a/dom/workers/WorkerPrivate.cpp
+++ b/dom/workers/WorkerPrivate.cpp
@@ -495,6 +495,82 @@ private:
}
};
+class ReportCompileErrorRunnable final : public WorkerRunnable
+{
+public:
+ static void
+ CreateAndDispatch(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
+ {
+ MOZ_ASSERT(aWorkerPrivate);
+ aWorkerPrivate->AssertIsOnWorkerThread();
+
+ RefPtr<ReportCompileErrorRunnable> runnable =
+ new ReportCompileErrorRunnable(aCx, aWorkerPrivate);
+ runnable->Dispatch();
+ }
+
+private:
+ ReportCompileErrorRunnable(JSContext* aCx, WorkerPrivate* aWorkerPrivate)
+ : WorkerRunnable(aWorkerPrivate, ParentThreadUnchangedBusyCount)
+ {
+ aWorkerPrivate->AssertIsOnWorkerThread();
+ }
+
+ void
+ PostDispatch(WorkerPrivate* aWorkerPrivate, bool aDispatchResult) override
+ {
+ aWorkerPrivate->AssertIsOnWorkerThread();
+
+ // Dispatch may fail if the worker was canceled, no need to report that as
+ // an error, so don't call base class PostDispatch.
+ }
+
+ bool
+ WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) override
+ {
+ if (aWorkerPrivate->IsFrozen() ||
+ aWorkerPrivate->IsParentWindowPaused()) {
+ MOZ_ASSERT(!IsDebuggerRunnable());
+ aWorkerPrivate->QueueRunnable(this);
+ return true;
+ }
+
+ if (aWorkerPrivate->IsSharedWorker()) {
+ aWorkerPrivate->BroadcastErrorToSharedWorkers(aCx, EmptyString(),
+ EmptyString(),
+ EmptyString(), 0, 0,
+ JSREPORT_ERROR,
+ /* isErrorEvent */ false);
+ return true;
+ }
+
+ if (aWorkerPrivate->IsServiceWorker()) {
+ RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
+ if (swm) {
+ swm->HandleError(aCx, aWorkerPrivate->GetPrincipal(),
+ aWorkerPrivate->WorkerName(),
+ aWorkerPrivate->ScriptURL(),
+ EmptyString(), EmptyString(), EmptyString(),
+ 0, 0, JSREPORT_ERROR, JSEXN_ERR);
+ }
+ return true;
+ }
+
+ if (!aWorkerPrivate->IsAcceptingEvents()) {
+ return true;
+ }
+
+ RefPtr<Event> event =
+ Event::Constructor(aWorkerPrivate, NS_LITERAL_STRING("error"),
+ EventInit());
+ event->SetTrusted(true);
+
+ nsEventStatus status = nsEventStatus_eIgnore;
+ aWorkerPrivate->DispatchDOMEvent(nullptr, event, nullptr, &status);
+ return true;
+ }
+};
+
class CompileScriptRunnable final : public WorkerRunnable
{
nsString mScriptURL;
@@ -538,9 +614,15 @@ private:
}
// Make sure to propagate exceptions from rv onto aCx, so that they will get
- // reported after we return. We do this for all failures on rv, because now
- // we're using rv to track all the state we care about.
- //
+ // reported after we return. We want to propagate just JS exceptions,
+ // because all the other errors are handled when the script is loaded.
+ // See: https://dom.spec.whatwg.org/#concept-event-fire
+ if (rv.Failed() && !rv.IsJSException()) {
+ ReportCompileErrorRunnable::CreateAndDispatch(aCx, aWorkerPrivate);
+ rv.SuppressException();
+ return false;
+ }
+
// This is a little dumb, but aCx is in the null compartment here because we
// set it up that way in our Run(), since we had not created the global at
// that point yet. So we need to enter the compartment of our global,
@@ -1171,7 +1253,8 @@ private:
if (aWorkerPrivate->IsSharedWorker()) {
aWorkerPrivate->BroadcastErrorToSharedWorkers(aCx, mMessage, mFilename,
mLine, mLineNumber,
- mColumnNumber, mFlags);
+ mColumnNumber, mFlags,
+ /* isErrorEvent */ true);
return true;
}
@@ -2336,8 +2419,6 @@ WorkerPrivateParent<Derived>::WorkerPrivateParent(
MOZ_ASSERT_IF(mIsChromeWorker, mIsSecureContext);
MOZ_ASSERT(IsDedicatedWorker());
- mNowBaseTimeStamp = aParent->NowBaseTimeStamp();
- mNowBaseTimeHighRes = aParent->NowBaseTime();
if (aParent->mParentFrozen) {
Freeze(nullptr);
@@ -2368,18 +2449,6 @@ WorkerPrivateParent<Derived>::WorkerPrivateParent(
.creationOptions().setSecureContext(true);
}
- if (IsDedicatedWorker() && mLoadInfo.mWindow &&
- mLoadInfo.mWindow->GetPerformance()) {
- mNowBaseTimeStamp = mLoadInfo.mWindow->GetPerformance()->GetDOMTiming()->
- GetNavigationStartTimeStamp();
- mNowBaseTimeHighRes =
- mLoadInfo.mWindow->GetPerformance()->GetDOMTiming()->
- GetNavigationStartHighRes();
- } else {
- mNowBaseTimeStamp = CreationTimeStamp();
- mNowBaseTimeHighRes = CreationTime();
- }
-
// Our parent can get suspended after it initiates the async creation
// of a new worker thread. In this case suspend the new worker as well.
if (mLoadInfo.mWindow && mLoadInfo.mWindow->IsSuspended()) {
@@ -3250,7 +3319,8 @@ WorkerPrivateParent<Derived>::BroadcastErrorToSharedWorkers(
const nsAString& aLine,
uint32_t aLineNumber,
uint32_t aColumnNumber,
- uint32_t aFlags)
+ uint32_t aFlags,
+ bool aIsErrorEvent)
{
AssertIsOnMainThread();
@@ -3281,31 +3351,42 @@ WorkerPrivateParent<Derived>::BroadcastErrorToSharedWorkers(
// May be null.
nsPIDOMWindowInner* window = sharedWorker->GetOwner();
- RootedDictionary<ErrorEventInit> errorInit(aCx);
- errorInit.mBubbles = false;
- errorInit.mCancelable = true;
- errorInit.mMessage = aMessage;
- errorInit.mFilename = aFilename;
- errorInit.mLineno = aLineNumber;
- errorInit.mColno = aColumnNumber;
-
- RefPtr<ErrorEvent> errorEvent =
- ErrorEvent::Constructor(sharedWorker, NS_LITERAL_STRING("error"),
- errorInit);
- if (!errorEvent) {
+ RefPtr<Event> event;
+
+ if (aIsErrorEvent) {
+ RootedDictionary<ErrorEventInit> errorInit(aCx);
+ errorInit.mBubbles = false;
+ errorInit.mCancelable = true;
+ errorInit.mMessage = aMessage;
+ errorInit.mFilename = aFilename;
+ errorInit.mLineno = aLineNumber;
+ errorInit.mColno = aColumnNumber;
+
+ event = ErrorEvent::Constructor(sharedWorker, NS_LITERAL_STRING("error"),
+ errorInit);
+ } else {
+ event = Event::Constructor(sharedWorker, NS_LITERAL_STRING("error"),
+ EventInit());
+ }
+
+ if (!event) {
ThrowAndReport(window, NS_ERROR_UNEXPECTED);
continue;
}
- errorEvent->SetTrusted(true);
+ event->SetTrusted(true);
bool defaultActionEnabled;
- nsresult rv = sharedWorker->DispatchEvent(errorEvent, &defaultActionEnabled);
+ nsresult rv = sharedWorker->DispatchEvent(event, &defaultActionEnabled);
if (NS_FAILED(rv)) {
ThrowAndReport(window, rv);
continue;
}
+ if (!aIsErrorEvent) {
+ continue;
+ }
+
if (defaultActionEnabled) {
// Add the owning window to our list so that we will fire an error event
// at it later.
diff --git a/dom/workers/WorkerPrivate.h b/dom/workers/WorkerPrivate.h
index 8008f30e54..28283bed78 100644
--- a/dom/workers/WorkerPrivate.h
+++ b/dom/workers/WorkerPrivate.h
@@ -216,8 +216,6 @@ private:
WorkerType mWorkerType;
TimeStamp mCreationTimeStamp;
DOMHighResTimeStamp mCreationTimeHighRes;
- TimeStamp mNowBaseTimeStamp;
- DOMHighResTimeStamp mNowBaseTimeHighRes;
protected:
// The worker is owned by its thread, which is represented here. This is set
@@ -408,7 +406,8 @@ public:
const nsAString& aLine,
uint32_t aLineNumber,
uint32_t aColumnNumber,
- uint32_t aFlags);
+ uint32_t aFlags,
+ bool aIsErrorEvent);
void
WorkerScriptLoaded();
@@ -578,14 +577,11 @@ public:
return mCreationTimeHighRes;
}
- TimeStamp NowBaseTimeStamp() const
+ DOMHighResTimeStamp TimeStampToDOMHighRes(const TimeStamp& aTimeStamp) const
{
- return mNowBaseTimeStamp;
- }
-
- DOMHighResTimeStamp NowBaseTime() const
- {
- return mNowBaseTimeHighRes;
+ MOZ_ASSERT(!aTimeStamp.IsNull());
+ TimeDuration duration = aTimeStamp - mCreationTimeStamp;
+ return duration.ToMilliseconds();
}
nsIPrincipal*
diff --git a/dom/workers/test/serviceworkers/chrome.ini b/dom/workers/test/serviceworkers/chrome.ini
index e064e7fd0a..6d7dbebd08 100644
--- a/dom/workers/test/serviceworkers/chrome.ini
+++ b/dom/workers/test/serviceworkers/chrome.ini
@@ -3,6 +3,8 @@ skip-if = os == 'android'
support-files =
chrome_helpers.js
empty.js
+ fetch.js
+ hello.html
serviceworker.html
serviceworkerinfo_iframe.html
serviceworkermanager_iframe.html
@@ -10,6 +12,7 @@ support-files =
worker.js
worker2.js
+[test_devtools_serviceworker_interception.html]
[test_privateBrowsing.html]
[test_serviceworkerinfo.xul]
[test_serviceworkermanager.xul]
diff --git a/dom/workers/test/serviceworkers/test_devtools_serviceworker_interception.html b/dom/workers/test/serviceworkers/test_devtools_serviceworker_interception.html
new file mode 100644
index 0000000000..d49ebb2c93
--- /dev/null
+++ b/dom/workers/test/serviceworkers/test_devtools_serviceworker_interception.html
@@ -0,0 +1,168 @@
+<!--
+ Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/
+-->
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>Bug 1168875 - test devtools serviceworker interception.</title>
+ <script type="application/javascript"
+ src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet"
+ type="text/css"
+ href="chrome://mochikit/content/tests/SimpleTest/test.css"?>
+</head>
+<body>
+<p id="display"></p>
+<div id="content" style="display: none"></div>
+<pre id="test"></pre>
+<script class="testbody" type="text/javascript">
+
+// Constants
+const Ci = Components.interfaces;
+const workerScope = "http://mochi.test:8888/chrome/dom/workers/test/serviceworkers/";
+const workerURL = workerScope + "fetch.js";
+const contentPage = workerScope + "hello.html";
+
+function createTestWindow(aURL) {
+ var mainwindow = window.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShellTreeItem)
+ .rootTreeItem
+ .QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIDOMWindow);
+ var win = mainwindow.OpenBrowserWindow(contentPage);
+
+ return new Promise(aResolve => {
+ win.addEventListener("DOMContentLoaded", function callback() {
+ if (win.content.location.href != aURL) {
+ win.gBrowser.loadURI(aURL);
+ return;
+ }
+
+ win.removeEventListener("DOMContentLoaded", callback);
+ aResolve(win.content);
+ });
+ });
+}
+
+function executeTest(aWindow) {
+ var registration;
+
+ return Promise.resolve()
+ // Should not be intercepted.
+ .then(_ => fetchAndCheckTimedChannel(aWindow, false, true, "hello.html"))
+
+ // Regist a service worker.
+ .then(_ => register(aWindow, workerURL, workerScope))
+ .then(r => registration = r)
+
+ // Should be intercpeted and synthesized.
+ .then(_ => fetchAndCheckTimedChannel(aWindow, true, false, "fake.html"))
+
+ // Should be intercepted but still fetch from network.
+ .then(_ => fetchAndCheckTimedChannel(aWindow, true, true,
+ "hello.html?ForBypassingHttpCache"))
+
+ // Tear down
+ .then(_ => registration.unregister());
+}
+
+function register(aWindow, aURL, aScope) {
+ return aWindow.navigator.serviceWorker.register(aURL, {scope: aScope})
+ .then(r => {
+ var worker = r.installing;
+ return new Promise(function(aResolve) {
+ worker.onstatechange = function() {
+ if (worker.state == "activated") {
+ aResolve(r);
+ }
+ }
+ });
+ });
+}
+
+function fetchAndCheckTimedChannel(aWindow, aIntercepted, aFetch, aURL) {
+ var resolveFunction;
+ var promise = new Promise(aResolve => resolveFunction = aResolve);
+
+ var topic = aFetch ? "http-on-examine-response"
+ : "service-worker-synthesized-response";
+
+ function observer(aSubject) {
+ var channel = aSubject.QueryInterface(Ci.nsIChannel);
+ ok(channel.URI.spec.endsWith(aURL));
+
+ var tc = aSubject.QueryInterface(Ci.nsITimedChannel);
+
+ // Check service worker related timings.
+ var serviceWorkerTimings = [{start: tc.launchServiceWorkerStartTime,
+ end: tc.launchServiceWorkerEndTime},
+ {start: tc.dispatchFetchEventStartTime,
+ end: tc.dispatchFetchEventEndTime},
+ {start: tc.handleFetchEventStartTime,
+ end: tc.handleFetchEventEndTime}];
+ if (aIntercepted) {
+ serviceWorkerTimings.reduce((aPreviousTimings, aCurrentTimings) => {
+ ok(aPreviousTimings.start <= aCurrentTimings.start,
+ "Start time order check.");
+ ok(aPreviousTimings.end <= aCurrentTimings.end,
+ "End time order check.");
+ ok(aCurrentTimings.start <= aCurrentTimings.end,
+ "Start time should be smaller than end time.");
+ return aCurrentTimings;
+ });
+ } else {
+ serviceWorkerTimings.forEach(aTimings => {
+ is(aTimings.start, 0);
+ is(aTimings.end, 0);
+ });
+ }
+
+ // Check network related timings.
+ var networkTimings = [tc.domainLookupStartTime,
+ tc.domainLookupEndTime,
+ tc.connectStartTime,
+ tc.connectEndTime,
+ tc.requestStartTime,
+ tc.responseStartTime,
+ tc.responseEndTime];
+ if (aFetch) {
+ networkTimings.reduce((aPreviousTiming, aCurrentTiming) => {
+ ok(aPreviousTiming <= aCurrentTiming);
+ return aCurrentTiming;
+ });
+ } else {
+ networkTimings.forEach(aTiming => is(aTiming, 0));
+ }
+
+ SpecialPowers.removeObserver(observer, topic);
+ resolveFunction();
+ }
+
+ SpecialPowers.addObserver(observer, topic, false);
+
+ // return promise;
+ return Promise.all([aWindow.fetch(aURL), promise]);
+}
+
+function runTest() {
+ return Promise.resolve()
+ .then(_ => createTestWindow(contentPage))
+ .then(w => executeTest(w))
+ .catch(e => ok(false, "Some test failed with error " + e))
+ .then(_ => SimpleTest.finish());
+}
+
+SimpleTest.waitForExplicitFinish();
+SpecialPowers.pushPrefEnv({"set": [
+ ["dom.serviceWorkers.exemptFromPerDomainMax", true],
+ ["dom.serviceWorkers.enabled", true],
+ ["dom.serviceWorkers.testing.enabled", true],
+]}, runTest);
+
+</script>
+</pre>
+</body>
+</html>
+
diff --git a/dom/workers/test/serviceworkers/test_serviceworker_interfaces.js b/dom/workers/test/serviceworkers/test_serviceworker_interfaces.js
index 9dbfcc0990..a4d498fb86 100644
--- a/dom/workers/test/serviceworkers/test_serviceworker_interfaces.js
+++ b/dom/workers/test/serviceworkers/test_serviceworker_interfaces.js
@@ -172,9 +172,9 @@ var interfaceNamesInGlobalScope =
// IMPORTANT: Do not change this list without review from a DOM peer!
"PerformanceMeasure",
// IMPORTANT: Do not change this list without review from a DOM peer!
- { name: "PerformanceObserver", nightly: true },
+ "PerformanceObserver",
// IMPORTANT: Do not change this list without review from a DOM peer!
- { name: "PerformanceObserverEntryList", nightly: true },
+ "PerformanceObserverEntryList",
// IMPORTANT: Do not change this list without review from a DOM peer!
"Request",
// IMPORTANT: Do not change this list without review from a DOM peer!
diff --git a/dom/workers/test/test_404.html b/dom/workers/test/test_404.html
index e2e83a35e3..15e5ded684 100644
--- a/dom/workers/test/test_404.html
+++ b/dom/workers/test/test_404.html
@@ -25,7 +25,6 @@ Tests of DOM Worker Threads
worker.onerror = function(event) {
is(event.target, worker);
- is(event.message, 'NetworkError: Failed to load worker script at "nonexistent_worker.js"');
event.preventDefault();
SimpleTest.finish();
};
diff --git a/dom/workers/test/test_bug1036484.html b/dom/workers/test/test_bug1036484.html
index 17b9d490fe..49c31bbc9e 100644
--- a/dom/workers/test/test_bug1036484.html
+++ b/dom/workers/test/test_bug1036484.html
@@ -25,7 +25,6 @@ function test(script) {
worker.onerror = function(event) {
is(event.target, worker);
- ok(event.message.startsWith("NetworkError: Failed to load worker script"))
event.preventDefault();
runTests();
};
diff --git a/dom/workers/test/test_loadError.html b/dom/workers/test/test_loadError.html
index dc109b796b..b9a215d11e 100644
--- a/dom/workers/test/test_loadError.html
+++ b/dom/workers/test/test_loadError.html
@@ -13,15 +13,13 @@
<script class="testbody" type="text/javascript">
"use strict";
-var loadErrorMessage = 'SecurityError: Failed to load worker script at "about:blank"';
-
function nextTest() {
(function(){
function workerfunc() {
var subworker = new Worker("about:blank");
subworker.onerror = function(e) {
e.preventDefault();
- postMessage(e.message);
+ postMessage("ERROR");
}
}
var b = new Blob([workerfunc+'workerfunc();']);
@@ -37,7 +35,7 @@ function nextTest() {
return;
}
w.onmessage = function(e) {
- is(e.data, loadErrorMessage,
+ is(e.data, "ERROR",
"Should catch the error when loading inner script");
if (++i < 2) callworker(i);
else SimpleTest.finish();
@@ -54,8 +52,6 @@ try {
var worker = new Worker("about:blank");
worker.onerror = function(e) {
e.preventDefault();
- is(e.message, loadErrorMessage,
- "Should get the right error from the toplevel script");
nextTest();
}
diff --git a/dom/workers/test/test_worker_interfaces.js b/dom/workers/test/test_worker_interfaces.js
index e0647682c7..6fe5fcaff0 100644
--- a/dom/workers/test/test_worker_interfaces.js
+++ b/dom/workers/test/test_worker_interfaces.js
@@ -163,9 +163,9 @@ var interfaceNamesInGlobalScope =
// IMPORTANT: Do not change this list without review from a DOM peer!
"PerformanceMeasure",
// IMPORTANT: Do not change this list without review from a DOM peer!
- { name: "PerformanceObserver", nightly: true },
+ "PerformanceObserver",
// IMPORTANT: Do not change this list without review from a DOM peer!
- { name: "PerformanceObserverEntryList", nightly: true },
+ "PerformanceObserverEntryList",
// IMPORTANT: Do not change this list without review from a DOM peer!
"Request",
// IMPORTANT: Do not change this list without review from a DOM peer!
diff --git a/dom/xhr/XMLHttpRequestMainThread.cpp b/dom/xhr/XMLHttpRequestMainThread.cpp
index a47a01aa0d..4fd34a9933 100644
--- a/dom/xhr/XMLHttpRequestMainThread.cpp
+++ b/dom/xhr/XMLHttpRequestMainThread.cpp
@@ -1081,10 +1081,75 @@ XMLHttpRequestMainThread::CloseRequestWithError(const ProgressEventType aType)
}
void
-XMLHttpRequestMainThread::Abort(ErrorResult& arv)
+XMLHttpRequestMainThread::RequestErrorSteps(const ProgressEventType aEventType,
+ const nsresult aOptionalException,
+ ErrorResult& aRv)
+{
+ // Step 1
+ mState = State::done;
+
+ StopProgressEventTimer();
+
+ // Step 2
+ mFlagSend = false;
+
+ // Step 3
+ ResetResponse();
+
+ // If we're in the destructor, don't risk dispatching an event.
+ if (mFlagDeleted) {
+ mFlagSyncLooping = false;
+ return;
+ }
+
+ // Step 4
+ if (mFlagSynchronous && NS_FAILED(aOptionalException)) {
+ aRv.Throw(aOptionalException);
+ return;
+ }
+
+ // Step 5
+ FireReadystatechangeEvent();
+
+ // Step 6
+ if (mUpload && !mUploadComplete) {
+
+ // Step 6-1
+ mUploadComplete = true;
+
+ // Step 6-2
+ if (mFlagHadUploadListenersOnSend) {
+
+ // Steps 6-3, 6-4 (loadend is fired for us)
+ DispatchProgressEvent(mUpload, aEventType, 0, -1);
+ }
+ }
+
+ // Steps 7 and 8 (loadend is fired for us)
+ DispatchProgressEvent(this, aEventType, 0, -1);
+}
+
+void
+XMLHttpRequestMainThread::Abort(ErrorResult& aRv)
{
mFlagAborted = true;
- CloseRequestWithError(ProgressEventType::abort);
+
+ // Step 1
+ CloseRequest();
+
+ // Step 2
+ if ((mState == State::opened && mFlagSend) ||
+ mState == State::headers_received ||
+ mState == State::loading) {
+ RequestErrorSteps(ProgressEventType::abort, NS_OK, aRv);
+ }
+
+ // Step 3
+ if (mState == State::done) {
+ ChangeState(State::unsent, false); // no ReadystateChange event
+ }
+
+ mFlagSyncLooping = false;
}
NS_IMETHODIMP
diff --git a/dom/xhr/XMLHttpRequestMainThread.h b/dom/xhr/XMLHttpRequestMainThread.h
index c9bcddf994..68499874a9 100644
--- a/dom/xhr/XMLHttpRequestMainThread.h
+++ b/dom/xhr/XMLHttpRequestMainThread.h
@@ -397,6 +397,11 @@ public:
}
void
+ RequestErrorSteps(const ProgressEventType aEventType,
+ const nsresult aOptionalException,
+ ErrorResult& aRv);
+
+ void
Abort() {
ErrorResult rv;
Abort(rv);
diff --git a/dom/xhr/XMLHttpRequestWorker.cpp b/dom/xhr/XMLHttpRequestWorker.cpp
index f61383baf9..e7193a2794 100644
--- a/dom/xhr/XMLHttpRequestWorker.cpp
+++ b/dom/xhr/XMLHttpRequestWorker.cpp
@@ -1148,8 +1148,8 @@ EventRunnable::PreDispatch(WorkerPrivate* /* unused */)
} else {
bool doClone = true;
JS::Rooted<JS::Value> transferable(cx);
- JS::Rooted<JSObject*> obj(cx, response.isObjectOrNull() ?
- response.toObjectOrNull() : nullptr);
+ JS::Rooted<JSObject*> obj(cx, response.isObject() ?
+ &response.toObject() : nullptr);
if (obj && JS_IsArrayBufferObject(obj)) {
// Use cached response if the arraybuffer has been transfered.
if (mProxy->mArrayBufferResponseWasTransferred) {
@@ -1669,7 +1669,9 @@ XMLHttpRequestWorker::MaybeDispatchPrematureAbortEvents(ErrorResult& aRv)
// Only send readystatechange event when state changed.
bool isStateChanged = false;
- if (mStateData.mReadyState != 4) {
+ if ((mStateData.mReadyState == 1 && mStateData.mFlagSend) ||
+ mStateData.mReadyState == 2 ||
+ mStateData.mReadyState == 3) {
isStateChanged = true;
mStateData.mReadyState = 4;
}
@@ -1811,6 +1813,8 @@ XMLHttpRequestWorker::SendInternal(SendRunnable* aRunnable,
aRunnable->SetSyncLoopTarget(syncLoopTarget);
aRunnable->SetHaveUploadListeners(hasUploadListeners);
+ mStateData.mFlagSend = true;
+
aRunnable->Dispatch(aRv);
if (aRv.Failed()) {
// Dispatch() may have spun the event loop and we may have already unrooted.
@@ -1837,6 +1841,7 @@ XMLHttpRequestWorker::SendInternal(SendRunnable* aRunnable,
if (!autoSyncLoop->Run() && !aRv.Failed()) {
aRv.Throw(NS_ERROR_FAILURE);
}
+ mStateData.mFlagSend = false;
}
bool
diff --git a/dom/xhr/XMLHttpRequestWorker.h b/dom/xhr/XMLHttpRequestWorker.h
index 90232fe855..c6647f8f36 100644
--- a/dom/xhr/XMLHttpRequestWorker.h
+++ b/dom/xhr/XMLHttpRequestWorker.h
@@ -34,15 +34,16 @@ public:
uint32_t mStatus;
nsCString mStatusText;
uint16_t mReadyState;
+ bool mFlagSend;
JS::Heap<JS::Value> mResponse;
nsresult mResponseTextResult;
nsresult mStatusResult;
nsresult mResponseResult;
StateData()
- : mStatus(0), mReadyState(0), mResponse(JS::UndefinedValue()),
- mResponseTextResult(NS_OK), mStatusResult(NS_OK),
- mResponseResult(NS_OK)
+ : mStatus(0), mReadyState(0), mFlagSend(false),
+ mResponse(JS::UndefinedValue()), mResponseTextResult(NS_OK),
+ mStatusResult(NS_OK), mResponseResult(NS_OK)
{ }
void trace(JSTracer* trc);
diff --git a/dom/xslt/xpath/txXPCOMExtensionFunction.cpp b/dom/xslt/xpath/txXPCOMExtensionFunction.cpp
index 4913702aa2..032161722f 100644
--- a/dom/xslt/xpath/txXPCOMExtensionFunction.cpp
+++ b/dom/xslt/xpath/txXPCOMExtensionFunction.cpp
@@ -322,7 +322,7 @@ public:
void trace(JSTracer* trc) {
for (uint8_t i = 0; i < mCount; ++i) {
if (mArray[i].type == nsXPTType::T_JSVAL) {
- JS::UnsafeTraceRoot(trc, &mArray[i].val.j, "txParam value");
+ JS::UnsafeTraceRoot(trc, &mArray[i].val.j.asValueRef(), "txParam value");
}
}
}
diff --git a/editor/libeditor/EditorBase.cpp b/editor/libeditor/EditorBase.cpp
index b793f39b8c..0c4a2a41d1 100644
--- a/editor/libeditor/EditorBase.cpp
+++ b/editor/libeditor/EditorBase.cpp
@@ -175,7 +175,14 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(EditorBase)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mEditorObservers)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocStateListeners)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mEventTarget)
- NS_IMPL_CYCLE_COLLECTION_UNLINK(mEventListener)
+
+ if (tmp->mEventListener) {
+ EditorEventListener* listener =
+ reinterpret_cast<EditorEventListener*>(tmp->mEventListener.get());
+ listener->Disconnect();
+ tmp->mEventListener = nullptr;
+ }
+
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSavedSel);
NS_IMPL_CYCLE_COLLECTION_UNLINK(mRangeUpdater);
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
diff --git a/editor/libeditor/HTMLEditorDataTransfer.cpp b/editor/libeditor/HTMLEditorDataTransfer.cpp
index b9cd8adb95..c56fbead77 100644
--- a/editor/libeditor/HTMLEditorDataTransfer.cpp
+++ b/editor/libeditor/HTMLEditorDataTransfer.cpp
@@ -1538,6 +1538,13 @@ HTMLEditor::CanPaste(int32_t aSelectionType,
NS_ENSURE_ARG_POINTER(aCanPaste);
*aCanPaste = false;
+ // Always enable the paste command when inside of a HTML or XHTML document.
+ nsCOMPtr<nsIDocument> doc = GetDocument();
+ if (doc && doc->IsHTMLOrXHTML()) {
+ *aCanPaste = true;
+ return NS_OK;
+ }
+
// can't paste if readonly
if (!IsModifiable()) {
return NS_OK;
@@ -2382,27 +2389,26 @@ HTMLEditor::ReplaceOrphanedStructure(
}
// If we found substructure, paste it instead of its descendants.
- // Only replace with the substructure if all the nodes in the list are
- // descendants.
- bool shouldReplaceNodes = true;
- for (uint32_t i = 0; i < aNodeArray.Length(); i++) {
+ // Postprocess list to remove any descendants of this node so that we don't
+ // insert them twice.
+ uint32_t removedCount = 0;
+ uint32_t originalLength = aNodeArray.Length();
+ for (uint32_t i = 0; i < originalLength; i++) {
uint32_t idx = aStartOrEnd == StartOrEnd::start ?
- i : (aNodeArray.Length() - i - 1);
+ (i - removedCount) : (originalLength - i - 1);
OwningNonNull<nsINode> endpoint = aNodeArray[idx];
- if (!EditorUtils::IsDescendantOf(endpoint, replaceNode)) {
- shouldReplaceNodes = false;
- break;
+ if (endpoint == replaceNode ||
+ EditorUtils::IsDescendantOf(endpoint, replaceNode)) {
+ aNodeArray.RemoveElementAt(idx);
+ removedCount++;
}
}
- if (shouldReplaceNodes) {
- // Now replace the removed nodes with the structural parent
- aNodeArray.Clear();
- if (aStartOrEnd == StartOrEnd::end) {
- aNodeArray.AppendElement(*replaceNode);
- } else {
- aNodeArray.InsertElementAt(0, *replaceNode);
- }
+ // Now replace the removed nodes with the structural parent
+ if (aStartOrEnd == StartOrEnd::end) {
+ aNodeArray.AppendElement(*replaceNode);
+ } else {
+ aNodeArray.InsertElementAt(0, *replaceNode);
}
}
diff --git a/editor/libeditor/TextEditorDataTransfer.cpp b/editor/libeditor/TextEditorDataTransfer.cpp
index 0388aa4a84..2cc2906fa0 100644
--- a/editor/libeditor/TextEditorDataTransfer.cpp
+++ b/editor/libeditor/TextEditorDataTransfer.cpp
@@ -383,6 +383,13 @@ TextEditor::CanPaste(int32_t aSelectionType,
NS_ENSURE_ARG_POINTER(aCanPaste);
*aCanPaste = false;
+ // Always enable the paste command when inside of a HTML or XHTML document.
+ nsCOMPtr<nsIDocument> doc = GetDocument();
+ if (doc && doc->IsHTMLOrXHTML()) {
+ *aCanPaste = true;
+ return NS_OK;
+ }
+
// can't paste if readonly
if (!IsModifiable()) {
return NS_OK;
diff --git a/editor/libeditor/tests/chrome.ini b/editor/libeditor/tests/chrome.ini
index 98db300014..dd13370a5c 100644
--- a/editor/libeditor/tests/chrome.ini
+++ b/editor/libeditor/tests/chrome.ini
@@ -12,3 +12,4 @@ support-files = green.png
[test_set_document_title_transaction.html]
[test_texteditor_keyevent_handling.html]
skip-if = (debug && os=='win') || (os == 'linux') # Bug 1116205, leaks on windows debug, fails delete key on linux
+[test_pasteImgTextarea.xul]
diff --git a/editor/libeditor/tests/mochitest.ini b/editor/libeditor/tests/mochitest.ini
index 447fb8b65f..33b1648192 100644
--- a/editor/libeditor/tests/mochitest.ini
+++ b/editor/libeditor/tests/mochitest.ini
@@ -217,6 +217,9 @@ skip-if = toolkit == 'android'
[test_bug1258085.html]
[test_bug1268736.html]
[test_bug1270235.html]
+[test_bug1306532.html]
+subsuite = clipboard
+skip-if = toolkit == 'android'
[test_bug1310912.html]
skip-if = toolkit == 'android' # bug 1315898
[test_bug1314790.html]
@@ -224,6 +227,7 @@ skip-if = toolkit == 'android' # bug 1315898
[test_bug1328023.html]
[test_bug1330796.html]
[test_bug1332876.html]
+[test_bug1352799.html]
[test_CF_HTML_clipboard.html]
subsuite = clipboard
@@ -243,3 +247,5 @@ skip-if = toolkit == 'android'
[test_css_chrome_load_access.html]
skip-if = toolkit == 'android' # chrome urls not available due to packaging
[test_selection_move_commands.html]
+[test_pasteImgTextarea.html]
+skip-if = toolkit == 'android' # bug 1299578
diff --git a/editor/libeditor/tests/test_bug1306532.html b/editor/libeditor/tests/test_bug1306532.html
new file mode 100644
index 0000000000..1d7b3e7afd
--- /dev/null
+++ b/editor/libeditor/tests/test_bug1306532.html
@@ -0,0 +1,64 @@
+<!DOCTYPE HTML>
+<html><head>
+<title>Test for bug 1306532</title>
+<style src="/tests/SimpleTest/test.css" type="text/css"></style>
+<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+
+<script class="testbody" type="application/javascript">
+
+function runTest() {
+ // Copy content from table.
+ var selection = getSelection();
+ var startRange = document.createRange();
+ startRange.setStart(headingone, 0);
+ startRange.setEnd(celltwo, 0);
+ selection.removeAllRanges();
+ selection.addRange(startRange);
+ SpecialPowers.wrap(document).execCommand("copy", false, null);
+
+ // Paste content into "pasteframe"
+ var pasteContainer = pasteframe.contentDocument.body;
+ var pasteRange = pasteframe.contentDocument.createRange();
+ pasteRange.selectNodeContents(pasteContainer);
+ pasteRange.collapse(false);
+ selection.removeAllRanges();
+ selection.addRange(pasteRange);
+ SpecialPowers.wrap(pasteframe.contentDocument).execCommand("paste", false, null);
+
+ is(pasteContainer.querySelector("#headingone").textContent, "Month", "First heading should be 'Month'.");
+ is(pasteContainer.querySelector("#headingtwo").textContent, "Savings", "Second heading should be 'Savings'.");
+ is(pasteContainer.querySelector("#cellone").textContent, "January", "First cell should be 'January'.");
+ is(pasteContainer.querySelector("#celltwo").textContent, "$100", "Second cell should be '$100'.");
+
+ SimpleTest.finish();
+}
+
+SimpleTest.waitForExplicitFinish();
+
+</script>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1306532">Mozilla Bug 1306532</a>
+<p id="display"></p>
+
+<pre id="test">
+</pre>
+
+<div id="container">
+<table border="1">
+ <tr>
+ <th id="headingone">Month</th>
+ <th id="headingtwo">Savings</th>
+ </tr>
+ <tr>
+ <td id="cellone">January</td>
+ <td id="celltwo">$100</td>
+ </tr>
+</table>
+</div>
+
+<iframe onload="runTest();" id="pasteframe" src="data:text/html,<html><body contenteditable='true'>"></iframe>
+
+</body>
+</html>
diff --git a/editor/libeditor/tests/test_bug1352799.html b/editor/libeditor/tests/test_bug1352799.html
new file mode 100644
index 0000000000..daedc40fcb
--- /dev/null
+++ b/editor/libeditor/tests/test_bug1352799.html
@@ -0,0 +1,98 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1352799
+-->
+<head>
+ <title>Test for Bug 1352799</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1352799">Mozilla Bug 1352799</a>
+<p id="display"></p>
+<div id="content">
+<div id="input-container" style="display: none;">
+<input id="input" maxlength="1">
+</div>
+</div>
+<pre id="test">
+<script type="application/javascript">
+
+/** Test for Bug 1352799 **/
+SimpleTest.waitForExplicitFinish();
+SimpleTest.waitForFocus(() => {
+ var input = document.getElementById("input");
+
+ var inputcontainer = document.getElementById('input-container');
+ input.setAttribute('maxlength', 2);
+ inputcontainer.style.display = 'block';
+
+ input.focus();
+
+ synthesizeKey('1', {});
+ synthesizeKey('2', {});
+ synthesizeKey('3', {});
+
+ is(input.value, '12', 'value should be 12 with maxlength = 2');
+
+ input.value = '';
+ inputcontainer.style.display = 'none';
+
+ window.setTimeout(() => {
+ input.setAttribute('maxlength', 4);
+ inputcontainer.style.display = 'block';
+
+ input.focus();
+
+ synthesizeKey('4', {});
+ synthesizeKey('5', {});
+ synthesizeKey('6', {});
+ synthesizeKey('7', {});
+ synthesizeKey('8', {});
+
+ is(input.value, '4567', 'value should be 4567 with maxlength = 4');
+
+ inputcontainer.style.display = 'none';
+
+ window.setTimeout(() => {
+ input.setAttribute('maxlength', 2);
+ inputcontainer.style.display = 'block';
+
+ input.focus();
+
+ synthesizeKey('1', {});
+ synthesizeKey('2', {});
+
+ todo_is(input.value, '45', 'value should be 45 with maxlength = 2');
+
+ input.value = '';
+ inputcontainer.style.display = 'none';
+
+ window.setTimeout(() => {
+ input.removeAttribute('maxlength');
+ inputcontainer.style.display = 'block';
+
+ input.focus();
+
+ synthesizeKey('1', {});
+ synthesizeKey('2', {});
+ synthesizeKey('3', {});
+ synthesizeKey('4', {});
+ synthesizeKey('5', {});
+ synthesizeKey('6', {});
+ synthesizeKey('7', {});
+ synthesizeKey('8', {});
+
+ is(input.value, '12345678', 'value should be 12345678 without maxlength');
+
+ SimpleTest.finish();
+ }, 0);
+ }, 0);
+ }, 0);
+});
+</script>
+</pre>
+</body>
+</html>
diff --git a/editor/libeditor/tests/test_pasteImgTextarea.html b/editor/libeditor/tests/test_pasteImgTextarea.html
new file mode 100644
index 0000000000..3168ae7290
--- /dev/null
+++ b/editor/libeditor/tests/test_pasteImgTextarea.html
@@ -0,0 +1,20 @@
+<!doctype html>
+<script src="/tests/SimpleTest/SimpleTest.js"></script>
+<script src="/tests/SimpleTest/SpawnTask.js"></script>
+<img id="i" src="green.png">
+<textarea id="t"></textarea>
+
+<script>
+let loaded = new Promise(resolve => addLoadEvent(resolve));
+ add_task(function*() {
+ yield loaded;
+ SpecialPowers.setCommandNode(window, document.getElementById("i"));
+ SpecialPowers.doCommand(window, "cmd_copyImageContents");
+ let input = document.getElementById("t");
+ input.focus();
+ var controller =
+ SpecialPowers.wrap(input).controllers.getControllerForCommand("cmd_paste");
+ is(controller.isCommandEnabled("cmd_paste"), true,
+ "paste should be enabled in html textareas when an image is on the clipboard");
+ });
+</script>
diff --git a/editor/libeditor/tests/test_pasteImgTextarea.xul b/editor/libeditor/tests/test_pasteImgTextarea.xul
new file mode 100644
index 0000000000..545027aa32
--- /dev/null
+++ b/editor/libeditor/tests/test_pasteImgTextarea.xul
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
+<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" type="text/css"?>
+<window xmlns:html="http://www.w3.org/1999/xhtml"
+ xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SpawnTask.js"></script>
+
+ <body xmlns="http://www.w3.org/1999/xhtml">
+ <html:img id="i" src="green.png" />
+ <html:textarea id="t"></html:textarea>
+ </body>
+ <script type="text/javascript"><![CDATA[
+ let loaded = new Promise(resolve => addLoadEvent(resolve));
+ add_task(function*() {
+ yield loaded;
+ SpecialPowers.setCommandNode(window, document.getElementById("i"));
+ SpecialPowers.doCommand(window, "cmd_copyImageContents");
+ let input = document.getElementById("t");
+ input.focus();
+ var controller =
+ SpecialPowers.wrap(input).controllers.getControllerForCommand("cmd_paste");
+ is(controller.isCommandEnabled("cmd_paste"), false,
+ "paste should not be enabled in xul textareas when an image is on the clipboard");
+ });
+ ]]></script>
+</window>
diff --git a/extensions/cookie/test/unit/test_bug526789.js b/extensions/cookie/test/unit/test_bug526789.js
index 0eac1d4929..624044577c 100644
--- a/extensions/cookie/test/unit/test_bug526789.js
+++ b/extensions/cookie/test/unit/test_bug526789.js
@@ -79,23 +79,11 @@ function run_test() {
cm.removeAll();
- // test that setting an empty or '.' http:// host results in a no-op
var uri = NetUtil.newURI("http://baz.com/");
- var emptyuri = NetUtil.newURI("http:///");
- var doturi = NetUtil.newURI("http://./");
do_check_eq(uri.asciiHost, "baz.com");
- do_check_eq(emptyuri.asciiHost, "");
- do_check_eq(doturi.asciiHost, ".");
- cs.setCookieString(emptyuri, null, "foo2=bar", null);
- do_check_eq(getCookieCount(), 0);
- cs.setCookieString(doturi, null, "foo3=bar", null);
- do_check_eq(getCookieCount(), 0);
cs.setCookieString(uri, null, "foo=bar", null);
- do_check_eq(getCookieCount(), 1);
do_check_eq(cs.getCookieString(uri, null), "foo=bar");
- do_check_eq(cs.getCookieString(emptyuri, null), null);
- do_check_eq(cs.getCookieString(doturi, null), null);
do_check_eq(cm.countCookiesFromHost(""), 0);
do_check_throws(function() {
diff --git a/gfx/2d/FilterNodeSoftware.cpp b/gfx/2d/FilterNodeSoftware.cpp
index 3abdb7a02e..1696940698 100644
--- a/gfx/2d/FilterNodeSoftware.cpp
+++ b/gfx/2d/FilterNodeSoftware.cpp
@@ -2796,7 +2796,7 @@ FilterNodeArithmeticCombineSoftware::SetAttribute(uint32_t aIndex,
uint32_t aSize)
{
MOZ_ASSERT(aIndex == ATT_ARITHMETIC_COMBINE_COEFFICIENTS);
- MOZ_ASSERT(aSize == 4);
+ MOZ_RELEASE_ASSERT(aSize == 4);
mK1 = aFloat[0];
mK2 = aFloat[1];
diff --git a/gfx/cairo/cairo/src/cairo-mutex-impl-private.h b/gfx/cairo/cairo/src/cairo-mutex-impl-private.h
index 25223f3eac..6c67f6ebbc 100644
--- a/gfx/cairo/cairo/src/cairo-mutex-impl-private.h
+++ b/gfx/cairo/cairo/src/cairo-mutex-impl-private.h
@@ -36,6 +36,7 @@
* Carl D. Worth <cworth@cworth.org>
* Mathias Hasselmann <mathias.hasselmann@gmx.de>
* Behdad Esfahbod <behdad@behdad.org>
+ * Mark Straver <moonchild@palemoon.org>
*/
#ifndef CAIRO_MUTEX_IMPL_PRIVATE_H
@@ -178,24 +179,24 @@
#elif defined(_WIN32) /******************************************************/
#define WIN32_LEAN_AND_MEAN
-/* We require Windows 2000 features such as ETO_PDY */
-#if !defined(WINVER) || (WINVER < 0x0500)
-# define WINVER 0x0500
+/* We require Windows 7 features */
+#if !defined(WINVER) || (WINVER < 0x0601)
+# define WINVER 0x0601
#endif
-#if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0500)
-# define _WIN32_WINNT 0x0500
+#if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0601)
+# define _WIN32_WINNT 0x0601
#endif
# include <windows.h>
- typedef CRITICAL_SECTION cairo_mutex_impl_t;
+ typedef SRWLOCK cairo_mutex_impl_t;
# define CAIRO_MUTEX_IMPL_WIN32 1
-# define CAIRO_MUTEX_IMPL_LOCK(mutex) EnterCriticalSection (&(mutex))
-# define CAIRO_MUTEX_IMPL_UNLOCK(mutex) LeaveCriticalSection (&(mutex))
-# define CAIRO_MUTEX_IMPL_INIT(mutex) InitializeCriticalSection (&(mutex))
-# define CAIRO_MUTEX_IMPL_FINI(mutex) DeleteCriticalSection (&(mutex))
-# define CAIRO_MUTEX_IMPL_NIL_INITIALIZER { NULL, 0, 0, NULL, NULL, 0 }
+# define CAIRO_MUTEX_IMPL_LOCK(mutex) AcquireSRWLockExclusive (&(mutex))
+# define CAIRO_MUTEX_IMPL_UNLOCK(mutex) ReleaseSRWLockExclusive (&(mutex))
+# define CAIRO_MUTEX_IMPL_INIT(mutex) InitializeSRWLock (&(mutex))
+# define CAIRO_MUTEX_IMPL_FINI(mutex) CAIRO_MUTEX_IMPL_NOOP
+# define CAIRO_MUTEX_IMPL_NIL_INITIALIZER SRWLOCK_INIT
#elif defined __OS2__ /******************************************************/
diff --git a/gfx/gl/GLTextureImage.cpp b/gfx/gl/GLTextureImage.cpp
index c91d558af4..65678432da 100644
--- a/gfx/gl/GLTextureImage.cpp
+++ b/gfx/gl/GLTextureImage.cpp
@@ -149,6 +149,9 @@ BasicTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion
&uploadSize,
needInit,
aFrom);
+ if (mTextureFormat == SurfaceFormat::UNKNOWN) {
+ return false;
+ }
if (uploadSize > 0) {
UpdateUploadSize(uploadSize);
diff --git a/gfx/gl/GLUploadHelpers.cpp b/gfx/gl/GLUploadHelpers.cpp
index 75165eedf7..ca1c890a48 100644
--- a/gfx/gl/GLUploadHelpers.cpp
+++ b/gfx/gl/GLUploadHelpers.cpp
@@ -27,6 +27,23 @@ DataOffset(const IntPoint& aPoint, int32_t aStride, SurfaceFormat aFormat)
return data;
}
+static bool
+CheckUploadBounds(const IntSize& aDst, const IntSize& aSrc, const IntPoint& aOffset)
+{
+ if (aOffset.x < 0 || aOffset.y < 0 ||
+ aOffset.x >= aSrc.width ||
+ aOffset.y >= aSrc.height) {
+ MOZ_ASSERT_UNREACHABLE("Offset outside source bounds");
+ return false;
+ }
+ if (aDst.width > (aSrc.width - aOffset.x) ||
+ aDst.height > (aSrc.height - aOffset.y)) {
+ MOZ_ASSERT_UNREACHABLE("Source has insufficient data");
+ return false;
+ }
+ return true;
+}
+
static GLint GetAddressAlignment(ptrdiff_t aAddress)
{
if (!(aAddress & 0x7)) {
@@ -375,6 +392,7 @@ TexImage2DHelper(GLContext* gl,
SurfaceFormat
UploadImageDataToTexture(GLContext* gl,
unsigned char* aData,
+ const gfx::IntSize& aDataSize,
int32_t aStride,
SurfaceFormat aFormat,
const nsIntRegion& aDstRegion,
@@ -498,6 +516,10 @@ UploadImageDataToTexture(GLContext* gl,
// Upload each rect in the region to the texture
for (auto iter = aDstRegion.RectIter(); !iter.Done(); iter.Next()) {
const IntRect& rect = iter.Get();
+ if (!CheckUploadBounds(rect.Size(), aDataSize, rect.TopLeft())) {
+ return SurfaceFormat::UNKNOWN;
+ }
+
const unsigned char* rectData =
aData + DataOffset(rect.TopLeft(), aStride, aFormat);
@@ -534,10 +556,17 @@ UploadSurfaceToTexture(GLContext* gl,
int32_t stride = aSurface->Stride();
SurfaceFormat format = aSurface->GetFormat();
+ gfx::IntSize size = aSurface->GetSize();
+ if (!CheckUploadBounds(aSize, size, aSrcPoint)) {
+ return SurfaceFormat::UNKNOWN;
+ }
+
unsigned char* data = aSurface->GetData() +
DataOffset(aSrcPoint, stride, format);
+ size.width -= aSrcPoint.x;
+ size.height -= aSrcPoint.y;
- return UploadImageDataToTexture(gl, data, stride, format,
+ return UploadImageDataToTexture(gl, data, size, stride, format,
aDstRegion, aTexture, aSize,
aOutUploadSize, aNeedInit,
aTextureUnit, aTextureTarget);
diff --git a/gfx/gl/GLUploadHelpers.h b/gfx/gl/GLUploadHelpers.h
index 866d44adbe..f732d2b383 100644
--- a/gfx/gl/GLUploadHelpers.h
+++ b/gfx/gl/GLUploadHelpers.h
@@ -28,6 +28,7 @@ class GLContext;
* \param gl The GL Context to use.
* \param aData Start of image data of surface to upload.
* Corresponds to the first pixel of the texture.
+ * \param aDataSize The image data's size.
* \param aStride The image data's stride.
* \param aFormat The image data's format.
* \param aDstRegion Region of the texture to upload.
@@ -46,6 +47,7 @@ class GLContext;
gfx::SurfaceFormat
UploadImageDataToTexture(GLContext* gl,
unsigned char* aData,
+ const gfx::IntSize& aDataSize,
int32_t aStride,
gfx::SurfaceFormat aFormat,
const nsIntRegion& aDstRegion,
diff --git a/gfx/gl/GfxTexturesReporter.cpp b/gfx/gl/GfxTexturesReporter.cpp
index 8007fe6b13..d2ca70d277 100644
--- a/gfx/gl/GfxTexturesReporter.cpp
+++ b/gfx/gl/GfxTexturesReporter.cpp
@@ -9,10 +9,6 @@
#include "GfxTexturesReporter.h"
#include "gfxPrefs.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
-
using namespace mozilla;
using namespace mozilla::gl;
@@ -75,8 +71,4 @@ GfxTexturesReporter::UpdateAmount(MemoryUse action, size_t amount)
}
}
}
-
-#ifdef MOZ_CRASHREPORTER
- CrashReporter::AnnotateTexturesSize(sAmount);
-#endif
}
diff --git a/gfx/gl/TextureImageEGL.cpp b/gfx/gl/TextureImageEGL.cpp
index 87a547c269..3bb2987d1d 100644
--- a/gfx/gl/TextureImageEGL.cpp
+++ b/gfx/gl/TextureImageEGL.cpp
@@ -119,6 +119,10 @@ TextureImageEGL::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion&
&uploadSize,
needInit,
aFrom);
+ if (mTextureFormat == SurfaceFormat::UNKNOWN) {
+ return false;
+ }
+
if (uploadSize > 0) {
UpdateUploadSize(uploadSize);
}
diff --git a/gfx/ipc/GPUChild.cpp b/gfx/ipc/GPUChild.cpp
index 72328ac0b6..3c27976832 100644
--- a/gfx/ipc/GPUChild.cpp
+++ b/gfx/ipc/GPUChild.cpp
@@ -121,9 +121,6 @@ GPUChild::RecvGraphicsError(const nsCString& aError)
bool
GPUChild::RecvInitCrashReporter(Shmem&& aShmem)
{
-#ifdef MOZ_CRASHREPORTER
- mCrashReporter = MakeUnique<ipc::CrashReporterHost>(GeckoProcessType_GPU, aShmem);
-#endif
return true;
}
@@ -163,12 +160,6 @@ void
GPUChild::ActorDestroy(ActorDestroyReason aWhy)
{
if (aWhy == AbnormalShutdown) {
-#ifdef MOZ_CRASHREPORTER
- if (mCrashReporter) {
- mCrashReporter->GenerateCrashReport(OtherPid());
- mCrashReporter = nullptr;
- }
-#endif
Telemetry::Accumulate(Telemetry::SUBPROCESS_ABNORMAL_ABORT,
nsDependentCString(XRE_ChildProcessTypeToString(GeckoProcessType_GPU), 1));
}
diff --git a/gfx/ipc/GPUParent.cpp b/gfx/ipc/GPUParent.cpp
index d63e17e2f4..896c7b36bc 100644
--- a/gfx/ipc/GPUParent.cpp
+++ b/gfx/ipc/GPUParent.cpp
@@ -82,11 +82,6 @@ GPUParent::Init(base::ProcessId aParentPid,
nsDebugImpl::SetMultiprocessMode("GPU");
-#ifdef MOZ_CRASHREPORTER
- // Init crash reporter support.
- CrashReporterClient::InitSingleton(this);
-#endif
-
// Ensure gfxPrefs are initialized.
gfxPrefs::GetSingleton();
gfxConfig::Init();
@@ -380,9 +375,6 @@ GPUParent::ActorDestroy(ActorDestroyReason aWhy)
gfxVars::Shutdown();
gfxConfig::Shutdown();
gfxPrefs::DestroySingleton();
-#ifdef MOZ_CRASHREPORTER
- CrashReporterClient::DestroySingleton();
-#endif
XRE_ShutdownChildProcess();
}
diff --git a/gfx/layers/ImageContainer.cpp b/gfx/layers/ImageContainer.cpp
index 8072e04012..5e4019e861 100644
--- a/gfx/layers/ImageContainer.cpp
+++ b/gfx/layers/ImageContainer.cpp
@@ -438,12 +438,15 @@ static void
CopyPlane(uint8_t *aDst, const uint8_t *aSrc,
const gfx::IntSize &aSize, int32_t aStride, int32_t aSkip)
{
+ int32_t height = aSize.height;
+ int32_t width = aSize.width;
+
+ MOZ_RELEASE_ASSERT(width <= aStride);
+
if (!aSkip) {
// Fast path: planar input.
- memcpy(aDst, aSrc, aSize.height * aStride);
+ memcpy(aDst, aSrc, height * aStride);
} else {
- int32_t height = aSize.height;
- int32_t width = aSize.width;
for (int y = 0; y < height; ++y) {
const uint8_t *src = aSrc;
uint8_t *dst = aDst;
@@ -461,13 +464,11 @@ CopyPlane(uint8_t *aDst, const uint8_t *aSrc,
bool
RecyclingPlanarYCbCrImage::CopyData(const Data& aData)
{
- mData = aData;
-
// update buffer size
// Use uint32_t throughout to match AllocateBuffer's param and mBufferSize
const auto checkedSize =
- CheckedInt<uint32_t>(mData.mCbCrStride) * mData.mCbCrSize.height * 2 +
- CheckedInt<uint32_t>(mData.mYStride) * mData.mYSize.height;
+ CheckedInt<uint32_t>(aData.mCbCrStride) * aData.mCbCrSize.height * 2 +
+ CheckedInt<uint32_t>(aData.mYStride) * aData.mYSize.height;
if (!checkedSize.isValid())
return false;
@@ -482,16 +483,18 @@ RecyclingPlanarYCbCrImage::CopyData(const Data& aData)
// update buffer size
mBufferSize = size;
+ mData = aData;
mData.mYChannel = mBuffer.get();
mData.mCbChannel = mData.mYChannel + mData.mYStride * mData.mYSize.height;
mData.mCrChannel = mData.mCbChannel + mData.mCbCrStride * mData.mCbCrSize.height;
+ mData.mYSkip = mData.mCbSkip = mData.mCrSkip = 0;
CopyPlane(mData.mYChannel, aData.mYChannel,
- mData.mYSize, mData.mYStride, mData.mYSkip);
+ aData.mYSize, aData.mYStride, aData.mYSkip);
CopyPlane(mData.mCbChannel, aData.mCbChannel,
- mData.mCbCrSize, mData.mCbCrStride, mData.mCbSkip);
+ aData.mCbCrSize, aData.mCbCrStride, aData.mCbSkip);
CopyPlane(mData.mCrChannel, aData.mCrChannel,
- mData.mCbCrSize, mData.mCbCrStride, mData.mCrSkip);
+ aData.mCbCrSize, aData.mCbCrStride, aData.mCrSkip);
mSize = aData.mPicSize;
mOrigin = gfx::IntPoint(aData.mPicX, aData.mPicY);
diff --git a/gfx/layers/apz/src/APZCTreeManager.cpp b/gfx/layers/apz/src/APZCTreeManager.cpp
index 857ae59582..f543263602 100644
--- a/gfx/layers/apz/src/APZCTreeManager.cpp
+++ b/gfx/layers/apz/src/APZCTreeManager.cpp
@@ -1145,6 +1145,7 @@ APZCTreeManager::UpdateWheelTransaction(LayoutDeviceIntPoint aRefPoint,
case eMouseUp:
case eMouseDown:
case eMouseDoubleClick:
+ case eMouseAuxClick:
case eMouseClick:
case eContextMenu:
case eDrop:
diff --git a/gfx/layers/composite/TextureHost.cpp b/gfx/layers/composite/TextureHost.cpp
index 8c5b8c7b77..c930373847 100644
--- a/gfx/layers/composite/TextureHost.cpp
+++ b/gfx/layers/composite/TextureHost.cpp
@@ -100,15 +100,9 @@ TextureHost::CreateIPDLActor(HostIPCAllocator* aAllocator,
TextureFlags aFlags,
uint64_t aSerial)
{
- if (aSharedData.type() == SurfaceDescriptor::TSurfaceDescriptorBuffer &&
- aSharedData.get_SurfaceDescriptorBuffer().data().type() == MemoryOrShmem::Tuintptr_t &&
- !aAllocator->IsSameProcess())
- {
- NS_ERROR("A client process is trying to peek at our address space using a MemoryTexture!");
- return nullptr;
- }
TextureParent* actor = new TextureParent(aAllocator, aSerial);
if (!actor->Init(aSharedData, aLayersBackend, aFlags)) {
+ actor->ActorDestroy(ipc::IProtocol::ActorDestroyReason::FailedConstructor);
delete actor;
return nullptr;
}
@@ -210,6 +204,11 @@ TextureHost::Create(const SurfaceDescriptor& aDesc,
#ifdef MOZ_X11
case SurfaceDescriptor::TSurfaceDescriptorX11: {
+ if (!aDeallocator->IsSameProcess()) {
+ NS_ERROR("A client process is trying to peek at our address space using a X11Texture!");
+ return nullptr;
+ }
+
const SurfaceDescriptorX11& desc = aDesc.get_SurfaceDescriptorX11();
return MakeAndAddRef<X11TextureHost>(aFlags, desc);
}
@@ -244,13 +243,49 @@ CreateBackendIndependentTextureHost(const SurfaceDescriptor& aDesc,
const MemoryOrShmem& data = bufferDesc.data();
switch (data.type()) {
case MemoryOrShmem::TShmem: {
- result = new ShmemTextureHost(data.get_Shmem(),
- bufferDesc.desc(),
- aDeallocator,
- aFlags);
+ const ipc::Shmem& shmem = data.get_Shmem();
+ const BufferDescriptor& desc = bufferDesc.desc();
+ if (!shmem.IsReadable()) {
+ // We failed to map the shmem so we can't verify its size. This
+ // should not be a fatal error, so just create the texture with
+ // nothing backing it.
+ result = new ShmemTextureHost(shmem, desc, aDeallocator, aFlags);
+ break;
+ }
+
+ size_t bufSize = shmem.Size<char>();
+ size_t reqSize = SIZE_MAX;
+ switch (desc.type()) {
+ case BufferDescriptor::TYCbCrDescriptor: {
+ const YCbCrDescriptor& ycbcr = desc.get_YCbCrDescriptor();
+ reqSize =
+ ImageDataSerializer::ComputeYCbCrBufferSize(ycbcr.ySize(), ycbcr.cbCrSize());
+ break;
+ }
+ case BufferDescriptor::TRGBDescriptor: {
+ const RGBDescriptor& rgb = desc.get_RGBDescriptor();
+ reqSize = ImageDataSerializer::ComputeRGBBufferSize(rgb.size(), rgb.format());
+ break;
+ }
+ default:
+ gfxCriticalError() << "Bad buffer host descriptor " << (int)desc.type();
+ MOZ_CRASH("GFX: Bad descriptor");
+ }
+
+ if (bufSize < reqSize) {
+ NS_ERROR("A client process gave a shmem too small to fit for its descriptor!");
+ return nullptr;
+ }
+
+ result = new ShmemTextureHost(shmem, desc, aDeallocator, aFlags);
break;
}
case MemoryOrShmem::Tuintptr_t: {
+ if (!aDeallocator->IsSameProcess()) {
+ NS_ERROR("A client process is trying to peek at our address space using a MemoryTexture!");
+ return nullptr;
+ }
+
result = new MemoryTextureHost(reinterpret_cast<uint8_t*>(data.get_uintptr_t()),
bufferDesc.desc(),
aFlags);
@@ -268,6 +303,11 @@ CreateBackendIndependentTextureHost(const SurfaceDescriptor& aDesc,
}
#ifdef XP_WIN
case SurfaceDescriptor::TSurfaceDescriptorDIB: {
+ if (!aDeallocator->IsSameProcess()) {
+ NS_ERROR("A client process is trying to peek at our address space using a DIBTexture!");
+ return nullptr;
+ }
+
result = new DIBTextureHost(aFlags, aDesc);
break;
}
@@ -848,8 +888,7 @@ BufferTextureHost::Upload(nsIntRegion *aRegion)
mFirstSource = mCompositor->CreateDataTextureSource(mFlags|TextureFlags::RGB_FROM_YCBCR);
mFirstSource->SetOwner(this);
}
- mFirstSource->Update(surf, aRegion);
- return true;
+ return mFirstSource->Update(surf, aRegion);
}
RefPtr<DataTextureSource> srcY;
diff --git a/gfx/layers/composite/X11TextureHost.cpp b/gfx/layers/composite/X11TextureHost.cpp
index 7ca42426dd..92b6f8e91a 100644
--- a/gfx/layers/composite/X11TextureHost.cpp
+++ b/gfx/layers/composite/X11TextureHost.cpp
@@ -22,10 +22,9 @@ X11TextureHost::X11TextureHost(TextureFlags aFlags,
const SurfaceDescriptorX11& aDescriptor)
: TextureHost(aFlags)
{
- RefPtr<gfxXlibSurface> surface = aDescriptor.OpenForeign();
- mSurface = surface.get();
+ mSurface = aDescriptor.OpenForeign();
- if (!(aFlags & TextureFlags::DEALLOCATE_CLIENT)) {
+ if (mSurface && !(aFlags & TextureFlags::DEALLOCATE_CLIENT)) {
mSurface->TakePixmap();
}
}
@@ -33,7 +32,7 @@ X11TextureHost::X11TextureHost(TextureFlags aFlags,
bool
X11TextureHost::Lock()
{
- if (!mCompositor) {
+ if (!mCompositor || !mSurface) {
return false;
}
@@ -69,6 +68,9 @@ X11TextureHost::SetCompositor(Compositor* aCompositor)
SurfaceFormat
X11TextureHost::GetFormat() const
{
+ if (!mSurface) {
+ return SurfaceFormat::UNKNOWN;
+ }
gfxContentType type = mSurface->GetContentType();
#ifdef GL_PROVIDER_GLX
if (mCompositor->GetBackendType() == LayersBackend::LAYERS_OPENGL) {
@@ -81,6 +83,9 @@ X11TextureHost::GetFormat() const
IntSize
X11TextureHost::GetSize() const
{
+ if (!mSurface) {
+ return IntSize();
+ }
return mSurface->GetSize();
}
diff --git a/gfx/layers/d3d11/TextureD3D11.cpp b/gfx/layers/d3d11/TextureD3D11.cpp
index 8fbcfd234c..9542425855 100644
--- a/gfx/layers/d3d11/TextureD3D11.cpp
+++ b/gfx/layers/d3d11/TextureD3D11.cpp
@@ -632,10 +632,6 @@ CreateTextureHostD3D11(const SurfaceDescriptor& aDesc,
{
RefPtr<TextureHost> result;
switch (aDesc.type()) {
- case SurfaceDescriptor::TSurfaceDescriptorBuffer: {
- result = CreateBackendIndependentTextureHost(aDesc, aDeallocator, aFlags);
- break;
- }
case SurfaceDescriptor::TSurfaceDescriptorD3D10: {
result = new DXGITextureHostD3D11(aFlags,
aDesc.get_SurfaceDescriptorD3D10());
@@ -647,7 +643,7 @@ CreateTextureHostD3D11(const SurfaceDescriptor& aDesc,
break;
}
default: {
- NS_WARNING("Unsupported SurfaceDescriptor type");
+ MOZ_ASSERT_UNREACHABLE("Unsupported SurfaceDescriptor type");
}
}
return result.forget();
diff --git a/gfx/layers/opengl/CompositingRenderTargetOGL.cpp b/gfx/layers/opengl/CompositingRenderTargetOGL.cpp
index c05b8edfd3..a1521c56da 100644
--- a/gfx/layers/opengl/CompositingRenderTargetOGL.cpp
+++ b/gfx/layers/opengl/CompositingRenderTargetOGL.cpp
@@ -60,7 +60,7 @@ CompositingRenderTargetOGL::BindRenderTarget()
msg.AppendPrintf("Framebuffer not complete -- CheckFramebufferStatus returned 0x%x, "
"GLContext=%p, IsOffscreen()=%d, mFBO=%d, aFBOTextureTarget=0x%x, "
"aRect.width=%d, aRect.height=%d",
- result, mGL, mGL->IsOffscreen(), mFBO, mInitParams.mFBOTextureTarget,
+ result, mGL.get(), mGL->IsOffscreen(), mFBO, mInitParams.mFBOTextureTarget,
mInitParams.mSize.width, mInitParams.mSize.height);
NS_WARNING(msg.get());
}
diff --git a/gfx/layers/opengl/CompositingRenderTargetOGL.h b/gfx/layers/opengl/CompositingRenderTargetOGL.h
index 501701d6f1..071dc5cac1 100644
--- a/gfx/layers/opengl/CompositingRenderTargetOGL.h
+++ b/gfx/layers/opengl/CompositingRenderTargetOGL.h
@@ -184,7 +184,7 @@ private:
* the target is always cleared at the end of a frame.
*/
RefPtr<CompositorOGL> mCompositor;
- GLContext* mGL;
+ RefPtr<GLContext> mGL;
GLuint mTextureHandle;
GLuint mFBO;
};
diff --git a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp
index 05f8cf38f1..9736618f7e 100644
--- a/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp
+++ b/gfx/layers/opengl/MacIOSurfaceTextureHostOGL.cpp
@@ -28,6 +28,8 @@ MacIOSurfaceTextureHostOGL::~MacIOSurfaceTextureHostOGL()
GLTextureSource*
MacIOSurfaceTextureHostOGL::CreateTextureSourceForPlane(size_t aPlane)
{
+ MOZ_ASSERT(mSurface);
+
GLuint textureHandle;
gl::GLContext* gl = mCompositor->gl();
gl->fGenTextures(1, &textureHandle);
@@ -84,11 +86,17 @@ MacIOSurfaceTextureHostOGL::SetCompositor(Compositor* aCompositor)
gfx::SurfaceFormat
MacIOSurfaceTextureHostOGL::GetFormat() const {
+ if (!mSurface) {
+ return gfx::SurfaceFormat::UNKNOWN;
+ }
return mSurface->GetFormat();
}
gfx::SurfaceFormat
MacIOSurfaceTextureHostOGL::GetReadFormat() const {
+ if (!mSurface) {
+ return gfx::SurfaceFormat::UNKNOWN;
+ }
return mSurface->GetReadFormat();
}
diff --git a/gfx/layers/opengl/TextureHostOGL.cpp b/gfx/layers/opengl/TextureHostOGL.cpp
index 854160bc67..ec6ba91312 100644
--- a/gfx/layers/opengl/TextureHostOGL.cpp
+++ b/gfx/layers/opengl/TextureHostOGL.cpp
@@ -25,10 +25,6 @@
#include "mozilla/layers/MacIOSurfaceTextureHostOGL.h"
#endif
-#ifdef GL_PROVIDER_GLX
-#include "mozilla/layers/X11TextureHost.h"
-#endif
-
using namespace mozilla::gl;
using namespace mozilla::gfx;
@@ -44,12 +40,6 @@ CreateTextureHostOGL(const SurfaceDescriptor& aDesc,
{
RefPtr<TextureHost> result;
switch (aDesc.type()) {
- case SurfaceDescriptor::TSurfaceDescriptorBuffer: {
- result = CreateBackendIndependentTextureHost(aDesc,
- aDeallocator, aFlags);
- break;
- }
-
#ifdef MOZ_WIDGET_ANDROID
case SurfaceDescriptor::TSurfaceTextureDescriptor: {
const SurfaceTextureDescriptor& desc = aDesc.get_SurfaceTextureDescriptor();
@@ -79,14 +69,6 @@ CreateTextureHostOGL(const SurfaceDescriptor& aDesc,
}
#endif
-#ifdef GL_PROVIDER_GLX
- case SurfaceDescriptor::TSurfaceDescriptorX11: {
- const auto& desc = aDesc.get_SurfaceDescriptorX11();
- result = new X11TextureHost(aFlags, desc);
- break;
- }
-#endif
-
case SurfaceDescriptor::TSurfaceDescriptorSharedGLTexture: {
const auto& desc = aDesc.get_SurfaceDescriptorSharedGLTexture();
result = new GLTextureHost(aFlags, desc.texture(),
@@ -96,7 +78,10 @@ CreateTextureHostOGL(const SurfaceDescriptor& aDesc,
desc.hasAlpha());
break;
}
- default: return nullptr;
+ default: {
+ MOZ_ASSERT_UNREACHABLE("Unsupported SurfaceDescriptor type");
+ break;
+ }
}
return result.forget();
}
@@ -176,9 +161,7 @@ TextureImageTextureSourceOGL::Update(gfx::DataSourceSurface* aSurface,
}
}
- mTexImage->UpdateFromDataSource(aSurface, aDestRegion, aSrcOffset);
-
- return true;
+ return mTexImage->UpdateFromDataSource(aSurface, aDestRegion, aSrcOffset);
}
void
diff --git a/gfx/skia/skia/include/core/SkTypes.h b/gfx/skia/skia/include/core/SkTypes.h
index 0cef8a1257..f45c3c2b70 100644
--- a/gfx/skia/skia/include/core/SkTypes.h
+++ b/gfx/skia/skia/include/core/SkTypes.h
@@ -109,6 +109,11 @@ SK_API extern void* sk_calloc(size_t size);
*/
SK_API extern void* sk_calloc_throw(size_t size);
+// Performs a safe multiply count * elemSize, checking for overflow
+SK_API extern void* sk_calloc_throw(size_t count, size_t elemSize);
+SK_API extern void* sk_malloc_throw(size_t count, size_t elemSize);
+SK_API extern void* sk_realloc_throw(void* buffer, size_t count, size_t elemSize);
+
// bzero is safer than memset, but we can't rely on it, so... sk_bzero()
static inline void sk_bzero(void* buffer, size_t size) {
// Please c.f. sk_careful_memcpy. It's undefined behavior to call memset(null, 0, 0).
@@ -295,6 +300,7 @@ template <typename D, typename S> D SkTo(S s) {
#define SK_MaxU32 0xFFFFFFFF
#define SK_MinU32 0
#define SK_NaN32 ((int) (1U << 31))
+#define SK_MaxSizeT SIZE_MAX
/** Returns true if the value can be represented with signed 16bits
*/
diff --git a/gfx/skia/skia/include/private/SkTDArray.h b/gfx/skia/skia/include/private/SkTDArray.h
index f71d357005..a46a05e9d8 100644
--- a/gfx/skia/skia/include/private/SkTDArray.h
+++ b/gfx/skia/skia/include/private/SkTDArray.h
@@ -21,7 +21,7 @@ public:
fReserve = fCount = 0;
fArray = NULL;
if (count) {
- fArray = (T*)sk_malloc_throw(count * sizeof(T));
+ fArray = (T*)sk_malloc_throw(count, sizeof(T));
memcpy(fArray, src, sizeof(T) * count);
fReserve = fCount = count;
}
@@ -346,7 +346,7 @@ public:
void shrinkToFit() {
fReserve = fCount;
- fArray = (T*)sk_realloc_throw(fArray, fReserve * sizeof(T));
+ fArray = (T*)sk_realloc_throw(fArray, fReserve, sizeof(T));
}
private:
@@ -359,6 +359,7 @@ private:
* This is the same as calling setCount(count() + delta).
*/
void adjustCount(int delta) {
+ SkASSERT_RELEASE(fCount <= std::numeric_limits<int>::max() - delta);
this->setCount(fCount + delta);
}
@@ -372,9 +373,10 @@ private:
*/
void resizeStorageToAtLeast(int count) {
SkASSERT(count > fReserve);
+ SkASSERT_RELEASE(count <= std::numeric_limits<int>::max() - std::numeric_limits<int>::max() / 5 - 4);
fReserve = count + 4;
fReserve += fReserve / 4;
- fArray = (T*)sk_realloc_throw(fArray, fReserve * sizeof(T));
+ fArray = (T*)sk_realloc_throw(fArray, fReserve, sizeof(T));
}
};
diff --git a/gfx/skia/skia/src/core/SkMallocPixelRef.cpp b/gfx/skia/skia/src/core/SkMallocPixelRef.cpp
index fffc044848..8db704fa46 100644
--- a/gfx/skia/skia/src/core/SkMallocPixelRef.cpp
+++ b/gfx/skia/skia/src/core/SkMallocPixelRef.cpp
@@ -8,8 +8,21 @@
#include "SkMallocPixelRef.h"
#include "SkBitmap.h"
#include "SkReadBuffer.h"
+#include "SkSafeMath.h"
#include "SkWriteBuffer.h"
+void* sk_calloc_throw(size_t count, size_t elemSize) {
+ return sk_calloc_throw(SkSafeMath::Mul(count, elemSize));
+}
+
+void* sk_malloc_throw(size_t count, size_t elemSize) {
+ return sk_malloc_throw(SkSafeMath::Mul(count, elemSize));
+}
+
+void* sk_realloc_throw(void* buffer, size_t count, size_t elemSize) {
+ return sk_realloc_throw(buffer, SkSafeMath::Mul(count, elemSize));
+}
+
// assumes ptr was allocated via sk_malloc
static void sk_free_releaseproc(void* ptr, void*) {
sk_free(ptr);
diff --git a/gfx/skia/skia/src/core/SkMath.cpp b/gfx/skia/skia/src/core/SkMath.cpp
index 6eff790c85..84796c522b 100644
--- a/gfx/skia/skia/src/core/SkMath.cpp
+++ b/gfx/skia/skia/src/core/SkMath.cpp
@@ -84,3 +84,18 @@ float SkScalarSinCos(float radians, float* cosValue) {
}
return sinValue;
}
+
+///////////////////////////////////////////////////////////////////////////////////////////////////
+
+size_t SkSafeMath::Add(size_t x, size_t y) {
+ SkSafeMath tmp;
+ size_t sum = tmp.add(x, y);
+ return tmp.ok() ? sum : SK_MaxSizeT;
+}
+
+size_t SkSafeMath::Mul(size_t x, size_t y) {
+ SkSafeMath tmp;
+ size_t prod = tmp.mul(x, y);
+ return tmp.ok() ? prod : SK_MaxSizeT;
+}
+
diff --git a/gfx/skia/skia/src/core/SkSafeMath.h b/gfx/skia/skia/src/core/SkSafeMath.h
new file mode 100644
index 0000000000..0bc0fbfac4
--- /dev/null
+++ b/gfx/skia/skia/src/core/SkSafeMath.h
@@ -0,0 +1,106 @@
+/*
+ * Copyright 2017 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#ifndef SkSafeMath_DEFINED
+#define SkSafeMath_DEFINED
+
+#include "SkTypes.h"
+
+// SkSafeMath always check that a series of operations do not overflow.
+// This must be correct for all platforms, because this is a check for safety at runtime.
+
+class SkSafeMath {
+public:
+ SkSafeMath() = default;
+
+ bool ok() const { return fOK; }
+ explicit operator bool() const { return fOK; }
+
+ size_t mul(size_t x, size_t y) {
+ return sizeof(size_t) == sizeof(uint64_t) ? mul64(x, y) : mul32(x, y);
+ }
+
+ size_t add(size_t x, size_t y) {
+ size_t result = x + y;
+ fOK &= result >= x;
+ return result;
+ }
+
+ /**
+ * Return a + b, unless this result is an overflow/underflow. In those cases, fOK will
+ * be set to false, and it is undefined what this returns.
+ */
+ int addInt(int a, int b) {
+ if (b < 0 && a < std::numeric_limits<int>::min() - b) {
+ fOK = false;
+ return a;
+ } else if (b > 0 && a > std::numeric_limits<int>::max() - b) {
+ fOK = false;
+ return a;
+ }
+ return a + b;
+ }
+
+ size_t alignUp(size_t x, size_t alignment) {
+ SkASSERT(alignment && !(alignment & (alignment - 1)));
+ return add(x, alignment - 1) & ~(alignment - 1);
+ }
+
+ template <typename T> T castTo(size_t value) {
+ if (!SkTFitsIn<T>(value)) {
+ fOK = false;
+ }
+ return static_cast<T>(value);
+ }
+
+ // These saturate to their results
+ static size_t Add(size_t x, size_t y);
+ static size_t Mul(size_t x, size_t y);
+ static size_t Align4(size_t x) {
+ SkSafeMath safe;
+ return safe.alignUp(x, 4);
+ }
+
+private:
+ uint32_t mul32(uint32_t x, uint32_t y) {
+ uint64_t bx = x;
+ uint64_t by = y;
+ uint64_t result = bx * by;
+ fOK &= result >> 32 == 0;
+ return result;
+ }
+
+ uint64_t mul64(uint64_t x, uint64_t y) {
+ if (x <= std::numeric_limits<uint64_t>::max() >> 32
+ && y <= std::numeric_limits<uint64_t>::max() >> 32) {
+ return x * y;
+ } else {
+ auto hi = [](uint64_t x) { return x >> 32; };
+ auto lo = [](uint64_t x) { return x & 0xFFFFFFFF; };
+
+ uint64_t lx_ly = lo(x) * lo(y);
+ uint64_t hx_ly = hi(x) * lo(y);
+ uint64_t lx_hy = lo(x) * hi(y);
+ uint64_t hx_hy = hi(x) * hi(y);
+ uint64_t result = 0;
+ result = this->add(lx_ly, (hx_ly << 32));
+ result = this->add(result, (lx_hy << 32));
+ fOK &= (hx_hy + (hx_ly >> 32) + (lx_hy >> 32)) == 0;
+
+ #if defined(SK_DEBUG) && defined(__clang__) && defined(__x86_64__)
+ auto double_check = (unsigned __int128)x * y;
+ SkASSERT(result == (double_check & 0xFFFFFFFFFFFFFFFF));
+ SkASSERT(!fOK || (double_check >> 64 == 0));
+ #endif
+
+ return result;
+ }
+ }
+ bool fOK = true;
+};
+
+#endif//SkSafeMath_DEFINED
diff --git a/gfx/src/DriverCrashGuard.cpp b/gfx/src/DriverCrashGuard.cpp
index 36d08dcf39..4754c26adf 100644
--- a/gfx/src/DriverCrashGuard.cpp
+++ b/gfx/src/DriverCrashGuard.cpp
@@ -7,9 +7,6 @@
#include "gfxPrefs.h"
#include "nsAppDirectoryServiceDefs.h"
#include "nsDirectoryServiceUtils.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
#include "nsServiceManagerUtils.h"
#include "nsString.h"
#include "nsXULAppAPI.h"
@@ -164,12 +161,6 @@ DriverCrashGuard::~DriverCrashGuard()
} else {
dom::ContentChild::GetSingleton()->SendEndDriverCrashGuard(uint32_t(mType));
}
-
-#ifdef MOZ_CRASHREPORTER
- // Remove the crash report annotation.
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("GraphicsStartupTest"),
- NS_LITERAL_CSTRING(""));
-#endif
}
bool
@@ -208,16 +199,6 @@ DriverCrashGuard::ActivateGuard()
{
mGuardActivated = true;
-#ifdef MOZ_CRASHREPORTER
- // Anotate crash reports only if we're a real guard. Otherwise, we could
- // attribute a random parent process crash to a graphics problem in a child
- // process.
- if (mMode != Mode::Proxy) {
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("GraphicsStartupTest"),
- NS_LITERAL_CSTRING("1"));
- }
-#endif
-
// If we're in the content process, the rest of the guarding is handled
// in the parent.
if (XRE_IsContentProcess()) {
diff --git a/gfx/src/gfxCrashReporterUtils.cpp b/gfx/src/gfxCrashReporterUtils.cpp
index 42647ccc60..757c15527a 100644
--- a/gfx/src/gfxCrashReporterUtils.cpp
+++ b/gfx/src/gfxCrashReporterUtils.cpp
@@ -5,10 +5,6 @@
#include "gfxCrashReporterUtils.h"
-#if defined(MOZ_CRASHREPORTER)
-#define MOZ_GFXFEATUREREPORTER 1
-#endif
-
#ifdef MOZ_GFXFEATUREREPORTER
#include "gfxCrashReporterUtils.h"
#include <string.h> // for strcmp
diff --git a/gfx/tests/gtest/TestGfxPrefs.cpp b/gfx/tests/gtest/TestGfxPrefs.cpp
index 72b698ed61..4e3b6037e0 100644
--- a/gfx/tests/gtest/TestGfxPrefs.cpp
+++ b/gfx/tests/gtest/TestGfxPrefs.cpp
@@ -80,27 +80,3 @@ TEST(GfxPrefs, Set) {
ASSERT_TRUE(gfxPrefs::APZMaxVelocity() == -1.0f);
}
-#ifdef MOZ_CRASHREPORTER
-// Randomly test the function we use in nsExceptionHandler.cpp here:
-extern bool SimpleNoCLibDtoA(double aValue, char* aBuffer, int aBufferLength);
-TEST(GfxPrefs, StringUtility)
-{
- char testBuffer[64];
- double testVal[] = {13.4,
- 3324243.42,
- 0.332424342,
- 864.0,
- 86400 * 100000000.0 * 10000000000.0 * 10000000000.0 * 100.0,
- 86400.0 * 366.0 * 100.0 + 14243.44332};
- for (size_t i=0; i<mozilla::ArrayLength(testVal); i++) {
- ASSERT_TRUE(SimpleNoCLibDtoA(testVal[i], testBuffer, sizeof(testBuffer)));
- ASSERT_TRUE(fabs(1.0 - atof(testBuffer)/testVal[i]) < 0.0001);
- }
-
- // We do not like negative numbers (random limitation)
- ASSERT_FALSE(SimpleNoCLibDtoA(-864.0, testBuffer, sizeof(testBuffer)));
-
- // It won't fit into 32:
- ASSERT_FALSE(SimpleNoCLibDtoA(testVal[4], testBuffer, sizeof(testBuffer)/2));
-}
-#endif
diff --git a/gfx/tests/gtest/TestLayers.h b/gfx/tests/gtest/TestLayers.h
index 18e351f771..fc6b750f1c 100644
--- a/gfx/tests/gtest/TestLayers.h
+++ b/gfx/tests/gtest/TestLayers.h
@@ -8,6 +8,22 @@
#include "Layers.h"
#include "nsTArray.h"
+#include "mozilla/layers/ISurfaceAllocator.h"
+
+namespace mozilla {
+namespace layers {
+
+class TestSurfaceAllocator final : public ISurfaceAllocator
+{
+public:
+ TestSurfaceAllocator() {}
+ ~TestSurfaceAllocator() override {}
+
+ bool IsSameProcess() const override { return true; }
+};
+
+} // layers
+} // mozilla
/* Create layer tree from a simple layer tree description syntax.
* Each index is either the first letter of the layer type or
diff --git a/gfx/tests/gtest/TestTextures.cpp b/gfx/tests/gtest/TestTextures.cpp
index b4856ae6b1..8f413cb3b2 100644
--- a/gfx/tests/gtest/TestTextures.cpp
+++ b/gfx/tests/gtest/TestTextures.cpp
@@ -5,6 +5,7 @@
#include "gtest/gtest.h"
#include "gmock/gmock.h"
+#include "TestLayers.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/Tools.h"
@@ -147,7 +148,8 @@ void TestTextureClientSurface(TextureClient* texture, gfxImageSurface* surface)
ASSERT_NE(descriptor.type(), SurfaceDescriptor::Tnull_t);
// host deserialization
- RefPtr<TextureHost> host = CreateBackendIndependentTextureHost(descriptor, nullptr,
+ RefPtr<TestSurfaceAllocator> deallocator = new TestSurfaceAllocator();
+ RefPtr<TextureHost> host = CreateBackendIndependentTextureHost(descriptor, deallocator,
texture->GetFlags());
ASSERT_TRUE(host.get() != nullptr);
@@ -191,7 +193,8 @@ void TestTextureClientYCbCr(TextureClient* client, PlanarYCbCrData& ycbcrData) {
ASSERT_EQ(ycbcrDesc.stereoMode(), ycbcrData.mStereoMode);
// host deserialization
- RefPtr<TextureHost> textureHost = CreateBackendIndependentTextureHost(descriptor, nullptr,
+ RefPtr<TestSurfaceAllocator> deallocator = new TestSurfaceAllocator();
+ RefPtr<TextureHost> textureHost = CreateBackendIndependentTextureHost(descriptor, deallocator,
client->GetFlags());
RefPtr<BufferTextureHost> host = static_cast<BufferTextureHost*>(textureHost.get());
diff --git a/gfx/thebes/gfxFT2Utils.cpp b/gfx/thebes/gfxFT2Utils.cpp
index a544a8cb42..77e1c96327 100644
--- a/gfx/thebes/gfxFT2Utils.cpp
+++ b/gfx/thebes/gfxFT2Utils.cpp
@@ -10,6 +10,10 @@
#include FT_TRUETYPE_TABLES_H
#include <algorithm>
+#ifndef FT_FACE_FLAG_COLOR
+#define FT_FACE_FLAG_COLOR ( 1L << 14 )
+#endif
+
#ifdef HAVE_FONTCONFIG_FCFREETYPE_H
#include <fontconfig/fcfreetype.h>
#endif
@@ -53,7 +57,7 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics,
if (MOZ_UNLIKELY(!mFace)) {
// No face. This unfortunate situation might happen if the font
// file is (re)moved at the wrong time.
- const gfxFloat emHeight = mGfxFont->GetStyle()->size;
+ const gfxFloat emHeight = mGfxFont->GetAdjustedSize();
aMetrics->emHeight = emHeight;
aMetrics->maxAscent = aMetrics->emAscent = 0.8 * emHeight;
aMetrics->maxDescent = aMetrics->emDescent = 0.2 * emHeight;
@@ -80,6 +84,11 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics,
const FT_Size_Metrics& ftMetrics = mFace->size->metrics;
+ aMetrics->maxAscent = FLOAT_FROM_26_6(ftMetrics.ascender);
+ aMetrics->maxDescent = -FLOAT_FROM_26_6(ftMetrics.descender);
+ aMetrics->maxAdvance = FLOAT_FROM_26_6(ftMetrics.max_advance);
+ gfxFloat lineHeight = FLOAT_FROM_26_6(ftMetrics.height);
+
gfxFloat emHeight;
// Scale for vertical design metric conversion: pixels per design unit.
// If this remains at 0.0, we can't use metrics from OS/2 etc.
@@ -103,6 +112,19 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics,
const TT_Header* head =
static_cast<TT_Header*>(FT_Get_Sfnt_Table(mFace, ft_sfnt_head));
if (head) {
+ // Even if the font is not explicitly scalable, if the face has
+ // color bitmaps, it should be treated as scalable and scaled to
+ // the desired size. Metrics based on y_ppem need to be rescaled
+ // for the adjusted size. This makes metrics agree with the
+ // scales we pass to Cairo for Fontconfig fonts.
+ if (mFace->face_flags & FT_FACE_FLAG_COLOR) {
+ emHeight = mGfxFont->GetAdjustedSize();
+ gfxFloat adjustScale = emHeight / ftMetrics.y_ppem;
+ aMetrics->maxAscent *= adjustScale;
+ aMetrics->maxDescent *= adjustScale;
+ aMetrics->maxAdvance *= adjustScale;
+ lineHeight *= adjustScale;
+ }
gfxFloat emUnit = head->Units_Per_EM;
yScale = emHeight / emUnit;
}
@@ -111,11 +133,6 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics,
TT_OS2 *os2 =
static_cast<TT_OS2*>(FT_Get_Sfnt_Table(mFace, ft_sfnt_os2));
- aMetrics->maxAscent = FLOAT_FROM_26_6(ftMetrics.ascender);
- aMetrics->maxDescent = -FLOAT_FROM_26_6(ftMetrics.descender);
- aMetrics->maxAdvance = FLOAT_FROM_26_6(ftMetrics.max_advance);
-
- gfxFloat lineHeight;
if (os2 && os2->sTypoAscender && yScale > 0.0) {
aMetrics->emAscent = os2->sTypoAscender * yScale;
aMetrics->emDescent = -os2->sTypoDescender * yScale;
@@ -142,7 +159,6 @@ gfxFT2LockedFace::GetMetrics(gfxFont::Metrics* aMetrics,
} else {
aMetrics->emAscent = aMetrics->maxAscent;
aMetrics->emDescent = aMetrics->maxDescent;
- lineHeight = FLOAT_FROM_26_6(ftMetrics.height);
}
cairo_text_extents_t extents;
diff --git a/gfx/thebes/gfxFcPlatformFontList.cpp b/gfx/thebes/gfxFcPlatformFontList.cpp
index 601e7a90cb..75e8fb76a0 100644
--- a/gfx/thebes/gfxFcPlatformFontList.cpp
+++ b/gfx/thebes/gfxFcPlatformFontList.cpp
@@ -811,6 +811,15 @@ ChooseFontSize(gfxFontconfigFontEntry* aEntry,
bestSize = size;
}
}
+ // If the font has bitmaps but wants to be scaled, then let it scale.
+ if (bestSize >= 0.0) {
+ FcBool scalable;
+ if (FcPatternGetBool(aEntry->GetPattern(),
+ FC_SCALABLE, 0, &scalable) == FcResultMatch &&
+ scalable) {
+ return requestedSize;
+ }
+ }
return bestSize;
}
@@ -946,10 +955,16 @@ gfxFontconfigFontFamily::AddFontPattern(FcPattern* aFontPattern)
NS_ASSERTION(!mHasStyles,
"font patterns must not be added to already enumerated families");
- FcBool scalable;
- if (FcPatternGetBool(aFontPattern, FC_SCALABLE, 0, &scalable) != FcResultMatch ||
- !scalable) {
+ FcBool outline;
+ if (FcPatternGetBool(aFontPattern, FC_OUTLINE, 0, &outline) != FcResultMatch ||
+ !outline) {
mHasNonScalableFaces = true;
+
+ FcBool scalable;
+ if (FcPatternGetBool(aFontPattern, FC_SCALABLE, 0, &scalable) == FcResultMatch &&
+ scalable) {
+ mForceScalable = true;
+ }
}
nsCountedRef<FcPattern> pattern(aFontPattern);
@@ -961,7 +976,9 @@ static const double kRejectDistance = 10000.0;
// Calculate a distance score representing the size disparity between the
// requested style's size and the font entry's size.
static double
-SizeDistance(gfxFontconfigFontEntry* aEntry, const gfxFontStyle& aStyle)
+SizeDistance(gfxFontconfigFontEntry* aEntry,
+ const gfxFontStyle& aStyle,
+ bool aForceScalable)
{
double requestedSize = SizeForStyle(aEntry, aStyle);
double bestDist = -1.0;
@@ -978,7 +995,7 @@ SizeDistance(gfxFontconfigFontEntry* aEntry, const gfxFontStyle& aStyle)
if (bestDist < 0.0) {
// No size means scalable
return -1.0;
- } else if (5.0 * bestDist < requestedSize) {
+ } else if (aForceScalable || 5.0 * bestDist < requestedSize) {
// fontconfig prefers a matching family or lang to pixelsize of bitmap
// fonts. CSS suggests a tolerance of 20% on pixelsize.
return bestDist;
@@ -1012,7 +1029,7 @@ gfxFontconfigFontFamily::FindAllFontsForStyle(const gfxFontStyle& aFontStyle,
for (size_t i = 0; i < aFontEntryList.Length(); i++) {
gfxFontconfigFontEntry* entry =
static_cast<gfxFontconfigFontEntry*>(aFontEntryList[i]);
- double dist = SizeDistance(entry, aFontStyle);
+ double dist = SizeDistance(entry, aFontStyle, mForceScalable);
// If the entry is scalable or has a style that does not match
// the group of unscalable fonts, then start a new group.
if (dist < 0.0 ||
diff --git a/gfx/thebes/gfxFcPlatformFontList.h b/gfx/thebes/gfxFcPlatformFontList.h
index 1bc35021e5..aa8f614a90 100644
--- a/gfx/thebes/gfxFcPlatformFontList.h
+++ b/gfx/thebes/gfxFcPlatformFontList.h
@@ -175,7 +175,8 @@ public:
explicit gfxFontconfigFontFamily(const nsAString& aName) :
gfxFontFamily(aName),
mContainsAppFonts(false),
- mHasNonScalableFaces(false)
+ mHasNonScalableFaces(false),
+ mForceScalable(false)
{ }
void FindStyleVariations(FontInfoData *aFontInfoData = nullptr) override;
@@ -201,6 +202,7 @@ protected:
bool mContainsAppFonts;
bool mHasNonScalableFaces;
+ bool mForceScalable;
};
class gfxFontconfigFont : public gfxFontconfigFontBase {
diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp
index 2e4ec990f8..a468592fe9 100644
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -71,9 +71,6 @@
#include "nsIScreenManager.h"
#include "FrameMetrics.h"
#include "MainThreadUtils.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
#include "nsWeakReference.h"
@@ -293,12 +290,7 @@ void CrashStatsLogForwarder::UpdateCrashReport()
message << logAnnotation << Get<0>(*it) << "]" << Get<1>(*it) << " (t=" << Get<2>(*it) << ") ";
}
-#ifdef MOZ_CRASHREPORTER
- nsCString reportString(message.str().c_str());
- nsresult annotated = CrashReporter::AnnotateCrashReport(mCrashCriticalKey, reportString);
-#else
nsresult annotated = NS_ERROR_NOT_IMPLEMENTED;
-#endif
if (annotated != NS_OK) {
printf("Crash Annotation %s: %s",
mCrashCriticalKey.get(), message.str().c_str());
diff --git a/gfx/thebes/gfxPlatformGtk.cpp b/gfx/thebes/gfxPlatformGtk.cpp
index 9d7f512f27..1fb3bc4fd8 100644
--- a/gfx/thebes/gfxPlatformGtk.cpp
+++ b/gfx/thebes/gfxPlatformGtk.cpp
@@ -227,10 +227,10 @@ gfxPlatformGtk::UpdateFontList()
// out a more general list
static const char kFontDejaVuSans[] = "DejaVu Sans";
static const char kFontDejaVuSerif[] = "DejaVu Serif";
-static const char kFontEmojiOneMozilla[] = "EmojiOne Mozilla";
static const char kFontFreeSans[] = "FreeSans";
static const char kFontFreeSerif[] = "FreeSerif";
static const char kFontTakaoPGothic[] = "TakaoPGothic";
+static const char kFontTwemojiMozilla[] = "Twemoji Mozilla";
static const char kFontDroidSansFallback[] = "Droid Sans Fallback";
static const char kFontWenQuanYiMicroHei[] = "WenQuanYi Micro Hei";
static const char kFontNanumGothic[] = "NanumGothic";
@@ -242,7 +242,7 @@ gfxPlatformGtk::GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh,
{
if (aNextCh == 0xfe0fu) {
// if char is followed by VS16, try for a color emoji glyph
- aFontList.AppendElement(kFontEmojiOneMozilla);
+ aFontList.AppendElement(kFontTwemojiMozilla);
}
aFontList.AppendElement(kFontDejaVuSerif);
@@ -254,7 +254,7 @@ gfxPlatformGtk::GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh,
uint32_t p = aCh >> 16;
if (p == 1) { // try color emoji font, unless VS15 (text style) present
if (aNextCh != 0xfe0fu && aNextCh != 0xfe0eu) {
- aFontList.AppendElement(kFontEmojiOneMozilla);
+ aFontList.AppendElement(kFontTwemojiMozilla);
}
}
}
diff --git a/gfx/thebes/gfxWindowsPlatform.cpp b/gfx/thebes/gfxWindowsPlatform.cpp
index 84199170bd..af4d932a90 100755
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -634,7 +634,6 @@ static const char kFontCambriaMath[] = "Cambria Math";
static const char kFontEbrima[] = "Ebrima";
static const char kFontEstrangeloEdessa[] = "Estrangelo Edessa";
static const char kFontEuphemia[] = "Euphemia";
-static const char kFontEmojiOneMozilla[] = "EmojiOne Mozilla";
static const char kFontGabriola[] = "Gabriola";
static const char kFontJavaneseText[] = "Javanese Text";
static const char kFontKhmerUI[] = "Khmer UI";
@@ -661,6 +660,7 @@ static const char kFontSegoeUIEmoji[] = "Segoe UI Emoji";
static const char kFontSegoeUISymbol[] = "Segoe UI Symbol";
static const char kFontSylfaen[] = "Sylfaen";
static const char kFontTraditionalArabic[] = "Traditional Arabic";
+static const char kFontTwemojiMozilla[] = "Twemoji Mozilla";
static const char kFontUtsaah[] = "Utsaah";
static const char kFontYuGothic[] = "Yu Gothic";
@@ -671,7 +671,7 @@ gfxWindowsPlatform::GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh,
{
if (aNextCh == 0xfe0fu) {
aFontList.AppendElement(kFontSegoeUIEmoji);
- aFontList.AppendElement(kFontEmojiOneMozilla);
+ aFontList.AppendElement(kFontTwemojiMozilla);
}
// Arial is used as the default fallback for system fallback
@@ -683,11 +683,11 @@ gfxWindowsPlatform::GetCommonFallbackFonts(uint32_t aCh, uint32_t aNextCh,
if (aNextCh == 0xfe0eu) {
aFontList.AppendElement(kFontSegoeUISymbol);
aFontList.AppendElement(kFontSegoeUIEmoji);
- aFontList.AppendElement(kFontEmojiOneMozilla);
+ aFontList.AppendElement(kFontTwemojiMozilla);
} else {
if (aNextCh != 0xfe0fu) {
aFontList.AppendElement(kFontSegoeUIEmoji);
- aFontList.AppendElement(kFontEmojiOneMozilla);
+ aFontList.AppendElement(kFontTwemojiMozilla);
}
aFontList.AppendElement(kFontSegoeUISymbol);
}
diff --git a/image/Downscaler.cpp b/image/Downscaler.cpp
index 18f09c5961..2ded487a54 100644
--- a/image/Downscaler.cpp
+++ b/image/Downscaler.cpp
@@ -231,6 +231,7 @@ Downscaler::CommitRow()
int32_t inLineToRead = filterOffset + mLinesInBuffer;
MOZ_ASSERT(mCurrentInLine <= inLineToRead, "Reading past end of input");
if (mCurrentInLine == inLineToRead) {
+ MOZ_RELEASE_ASSERT(mLinesInBuffer < mWindowCapacity, "Need more rows than capacity!");
skia::ConvolveHorizontally(mRowBuffer.get(), *mXFilter,
mWindow[mLinesInBuffer++], mHasAlpha,
supports_sse2() || supports_mmi());
@@ -239,7 +240,7 @@ Downscaler::CommitRow()
MOZ_ASSERT(mCurrentOutLine < mTargetSize.height,
"Writing past end of output");
- while (mLinesInBuffer == filterLength) {
+ while (mLinesInBuffer >= filterLength) {
DownscaleInputLine();
if (mCurrentOutLine == mTargetSize.height) {
@@ -340,9 +341,14 @@ Downscaler::DownscaleInputLine()
// Shift the buffer. We're just moving pointers here, so this is cheap.
mLinesInBuffer -= diff;
- mLinesInBuffer = max(mLinesInBuffer, 0);
- for (int32_t i = 0; i < mLinesInBuffer; ++i) {
- swap(mWindow[i], mWindow[filterLength - mLinesInBuffer + i]);
+ mLinesInBuffer = min(max(mLinesInBuffer, 0), mWindowCapacity);
+
+ // If we already have enough rows to satisfy the filter, there is no need
+ // to swap as we won't be writing more before the next convolution.
+ if (filterLength > mLinesInBuffer) {
+ for (int32_t i = 0; i < mLinesInBuffer; ++i) {
+ swap(mWindow[i], mWindow[filterLength - mLinesInBuffer + i]);
+ }
}
}
diff --git a/image/DownscalingFilter.h b/image/DownscalingFilter.h
index 6b0d3b26bd..1485b85c20 100644
--- a/image/DownscalingFilter.h
+++ b/image/DownscalingFilter.h
@@ -246,6 +246,7 @@ protected:
int32_t inputRowToRead = filterOffset + mRowsInWindow;
MOZ_ASSERT(mInputRow <= inputRowToRead, "Reading past end of input");
if (mInputRow == inputRowToRead) {
+ MOZ_RELEASE_ASSERT(mRowsInWindow < mWindowCapacity, "Need more rows than capacity!");
skia::ConvolveHorizontally(mRowBuffer.get(), *mXFilter,
mWindow[mRowsInWindow++], mHasAlpha,
supports_sse2() || supports_mmi());
@@ -254,7 +255,7 @@ protected:
MOZ_ASSERT(mOutputRow < mNext.InputSize().height,
"Writing past end of output");
- while (mRowsInWindow == filterLength) {
+ while (mRowsInWindow >= filterLength) {
DownscaleInputRow();
if (mOutputRow == mNext.InputSize().height) {
@@ -330,9 +331,14 @@ private:
// Shift the buffer. We're just moving pointers here, so this is cheap.
mRowsInWindow -= diff;
- mRowsInWindow = std::max(mRowsInWindow, 0);
- for (int32_t i = 0; i < mRowsInWindow; ++i) {
- std::swap(mWindow[i], mWindow[filterLength - mRowsInWindow + i]);
+ mRowsInWindow = std::min(std::max(mRowsInWindow, 0), mWindowCapacity);
+
+ // If we already have enough rows to satisfy the filter, there is no need
+ // to swap as we won't be writing more before the next convolution.
+ if (filterLength > mRowsInWindow) {
+ for (int32_t i = 0; i < mRowsInWindow; ++i) {
+ std::swap(mWindow[i], mWindow[filterLength - mRowsInWindow + i]);
+ }
}
}
diff --git a/image/VectorImage.cpp b/image/VectorImage.cpp
index fd970e1795..1e59b13fa7 100644
--- a/image/VectorImage.cpp
+++ b/image/VectorImage.cpp
@@ -9,6 +9,7 @@
#include "gfxContext.h"
#include "gfxDrawable.h"
#include "gfxPlatform.h"
+#include "gfxPrefs.h" // for surface cache size
#include "gfxUtils.h"
#include "imgFrame.h"
#include "mozilla/AutoRestore.h"
@@ -931,11 +932,14 @@ VectorImage::CreateSurfaceAndShow(const SVGDrawingParameters& aParams, BackendTy
RefPtr<gfxDrawable> svgDrawable =
new gfxCallbackDrawable(cb, aParams.size);
- // We take an early exit without using the surface cache if
- // x or y > maxDimension, because for vector images this can cause bad perf
- // issues if large sizes are scaled repeatedly (a rather common scenario)
- // that can quickly exhaust the cache.
- int32_t maxDimension = 3000;
+ // We take an early exit without using the surface cache if too large,
+ // because for vector images this can cause bad perf issues if large sizes
+ // are scaled repeatedly (a rather common scenario) that can quickly exhaust
+ // the cache.
+ // Similar to max image size calculations, this has a max cap and size check.
+ // max cap = 8000 (pixels); size check = 5% of cache
+ int32_t maxDimension = 8000;
+ int32_t maxCacheElemSize = (gfxPrefs::ImageMemSurfaceCacheMaxSizeKB() * 1024) / 20;
bool bypassCache = bool(aParams.flags & FLAG_BYPASS_SURFACE_CACHE) ||
// Refuse to cache animated images:
@@ -946,6 +950,14 @@ VectorImage::CreateSurfaceAndShow(const SVGDrawingParameters& aParams, BackendTy
// Image x or y is larger than our cache cap:
aParams.size.width > maxDimension ||
aParams.size.height > maxDimension;
+ if (!bypassCache) {
+ // This is separated out to make sure width and height are sane at this point
+ // and the result can't overflow. Note: keep maxDimension low enough so that
+ // (maxDimension)^2 x 4 < INT32_MAX.
+ // Assuming surface size for any rendered vector image is RGBA, so 4Bpp.
+ bypassCache = (aParams.size.width * aParams.size.height * 4) > maxCacheElemSize;
+ }
+
if (bypassCache) {
return Show(svgDrawable, aParams);
}
diff --git a/image/decoders/icon/nsIconURI.cpp b/image/decoders/icon/nsIconURI.cpp
index 2c2788c8f1..632a733fe9 100644
--- a/image/decoders/icon/nsIconURI.cpp
+++ b/image/decoders/icon/nsIconURI.cpp
@@ -372,6 +372,32 @@ nsMozIconURI::SetPath(const nsACString& aPath)
}
NS_IMETHODIMP
+nsMozIconURI::GetFilePath(nsACString& aFilePath)
+{
+ aFilePath.Truncate();
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+nsMozIconURI::SetFilePath(const nsACString& aFilePath)
+{
+ return NS_ERROR_FAILURE;
+}
+
+NS_IMETHODIMP
+nsMozIconURI::GetQuery(nsACString& aQuery)
+{
+ aQuery.Truncate();
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+nsMozIconURI::SetQuery(const nsACString& aQuery)
+{
+ return NS_ERROR_FAILURE;
+}
+
+NS_IMETHODIMP
nsMozIconURI::GetRef(nsACString& aRef)
{
aRef.Truncate();
diff --git a/intl/icu/source/common/umutex.h b/intl/icu/source/common/umutex.h
index e26ac3555c..f13da130c1 100644
--- a/intl/icu/source/common/umutex.h
+++ b/intl/icu/source/common/umutex.h
@@ -333,7 +333,9 @@ U_NAMESPACE_END
* win32 APIs for Critical Sections.
*/
+# ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
+# endif
# define VC_EXTRALEAN
# define NOUSER
# define NOSERVICE
diff --git a/intl/tzdata/SVN-INFO b/intl/tzdata/SVN-INFO
index 7a0ccb8338..fba30f87c6 100644
--- a/intl/tzdata/SVN-INFO
+++ b/intl/tzdata/SVN-INFO
@@ -1,10 +1,10 @@
Path: 44
-URL: https://ssl.icu-project.org/repos/icu/data/trunk/tzdata/icunew/2017c/44
-Relative URL: ^/data/trunk/tzdata/icunew/2017c/44
+URL: https://ssl.icu-project.org/repos/icu/data/trunk/tzdata/icunew/2018d/44
+Relative URL: ^/data/trunk/tzdata/icunew/2018d/44
Repository Root: https://ssl.icu-project.org/repos/icu
Repository UUID: 251d0590-4201-4cf1-90de-194747b24ca1
Node Kind: directory
Last Changed Author: yoshito
-Last Changed Rev: 40633
-Last Changed Date: 2017-10-25 15:39:04 +0000 (Wed, 25 Oct 2017)
+Last Changed Rev: 41166
+Last Changed Date: 2018-03-28 13:41:38 +0000
diff --git a/intl/tzdata/source/be/metaZones.res b/intl/tzdata/source/be/metaZones.res
index 24d510e804..68d92ec3ba 100644
--- a/intl/tzdata/source/be/metaZones.res
+++ b/intl/tzdata/source/be/metaZones.res
Binary files differ
diff --git a/intl/tzdata/source/be/windowsZones.res b/intl/tzdata/source/be/windowsZones.res
index 3200daca40..356411c0f0 100644
--- a/intl/tzdata/source/be/windowsZones.res
+++ b/intl/tzdata/source/be/windowsZones.res
Binary files differ
diff --git a/intl/tzdata/source/be/zoneinfo64.res b/intl/tzdata/source/be/zoneinfo64.res
index dc7f4f35a8..2edd8942ef 100644
--- a/intl/tzdata/source/be/zoneinfo64.res
+++ b/intl/tzdata/source/be/zoneinfo64.res
Binary files differ
diff --git a/intl/tzdata/source/ee/metaZones.res b/intl/tzdata/source/ee/metaZones.res
index cb119e6130..349853711e 100644
--- a/intl/tzdata/source/ee/metaZones.res
+++ b/intl/tzdata/source/ee/metaZones.res
Binary files differ
diff --git a/intl/tzdata/source/ee/windowsZones.res b/intl/tzdata/source/ee/windowsZones.res
index 50708270ad..56f1b19ec9 100644
--- a/intl/tzdata/source/ee/windowsZones.res
+++ b/intl/tzdata/source/ee/windowsZones.res
Binary files differ
diff --git a/intl/tzdata/source/ee/zoneinfo64.res b/intl/tzdata/source/ee/zoneinfo64.res
index daf50fd4a9..144ff1530f 100644
--- a/intl/tzdata/source/ee/zoneinfo64.res
+++ b/intl/tzdata/source/ee/zoneinfo64.res
Binary files differ
diff --git a/intl/tzdata/source/le/metaZones.res b/intl/tzdata/source/le/metaZones.res
index e3b8a805e2..c7fd90cee2 100644
--- a/intl/tzdata/source/le/metaZones.res
+++ b/intl/tzdata/source/le/metaZones.res
Binary files differ
diff --git a/intl/tzdata/source/le/windowsZones.res b/intl/tzdata/source/le/windowsZones.res
index 353d5a8294..2409ae8778 100644
--- a/intl/tzdata/source/le/windowsZones.res
+++ b/intl/tzdata/source/le/windowsZones.res
Binary files differ
diff --git a/intl/tzdata/source/le/zoneinfo64.res b/intl/tzdata/source/le/zoneinfo64.res
index 3a0b6913de..60d2ac03a5 100644
--- a/intl/tzdata/source/le/zoneinfo64.res
+++ b/intl/tzdata/source/le/zoneinfo64.res
Binary files differ
diff --git a/intl/tzdata/source/metaZones.txt b/intl/tzdata/source/metaZones.txt
index e90883d24c..a9c148a3a3 100644
--- a/intl/tzdata/source/metaZones.txt
+++ b/intl/tzdata/source/metaZones.txt
@@ -131,11 +131,11 @@ metaZones:table(nofallback){
001{"America/Halifax"}
AG{"America/Antigua"}
AI{"America/Anguilla"}
- AN{"America/Curacao"}
AW{"America/Aruba"}
BB{"America/Barbados"}
BM{"Atlantic/Bermuda"}
BQ{"America/Kralendijk"}
+ CW{"America/Curacao"}
DM{"America/Dominica"}
GD{"America/Grenada"}
GL{"America/Thule"}
@@ -344,7 +344,6 @@ metaZones:table(nofallback){
SH{"Atlantic/St_Helena"}
SL{"Africa/Freetown"}
SN{"Africa/Dakar"}
- ST{"Africa/Sao_Tome"}
TG{"Africa/Lome"}
}
Galapagos{
@@ -1030,6 +1029,13 @@ metaZones:table(nofallback){
"Africa:Sao_Tome"{
{
"GMT",
+ "1970-01-01 00:00",
+ "2018-01-01 01:00",
+ }
+ {
+ "Africa_Western",
+ "2018-01-01 01:00",
+ "9999-12-31 23:59",
}
}
"Africa:Tripoli"{
@@ -2553,6 +2559,11 @@ metaZones:table(nofallback){
{
"Casey",
"2016-10-21 16:00",
+ "2016-03-10 17:00",
+ }
+ {
+ "Australia_Western",
+ "2018-03-10 17:00",
"9999-12-31 23:59",
}
}
diff --git a/intl/tzdata/source/windowsZones.txt b/intl/tzdata/source/windowsZones.txt
index ec393d912b..6428c54e84 100644
--- a/intl/tzdata/source/windowsZones.txt
+++ b/intl/tzdata/source/windowsZones.txt
@@ -156,7 +156,6 @@ windowsZones:table(nofallback){
}
"Central Pacific Standard Time"{
001{"Pacific/Guadalcanal"}
- AQ{"Antarctica/Casey"}
AU{"Antarctica/Macquarie"}
FM{"Pacific/Ponape Pacific/Kosrae"}
NC{"Pacific/Noumea"}
@@ -212,7 +211,6 @@ windowsZones:table(nofallback){
KE{"Africa/Nairobi"}
KM{"Indian/Comoro"}
MG{"Indian/Antananarivo"}
- SD{"Africa/Khartoum"}
SO{"Africa/Mogadishu"}
SS{"Africa/Juba"}
TZ{"Africa/Dar_es_Salaam"}
@@ -316,7 +314,6 @@ windowsZones:table(nofallback){
SH{"Atlantic/St_Helena"}
SL{"Africa/Freetown"}
SN{"Africa/Dakar"}
- ST{"Africa/Sao_Tome"}
TG{"Africa/Lome"}
}
"Haiti Standard Time"{
@@ -615,6 +612,10 @@ windowsZones:table(nofallback){
001{"Asia/Colombo"}
LK{"Asia/Colombo"}
}
+ "Sudan Standard Time"{
+ 001{"Africa/Khartoum"}
+ SD{"Africa/Khartoum"}
+ }
"Syria Standard Time"{
001{"Asia/Damascus"}
SY{"Asia/Damascus"}
@@ -729,6 +730,7 @@ windowsZones:table(nofallback){
}
"W. Australia Standard Time"{
001{"Australia/Perth"}
+ AQ{"Antarctica/Casey"}
AU{"Australia/Perth"}
}
"W. Central Africa Standard Time"{
@@ -744,6 +746,7 @@ windowsZones:table(nofallback){
GQ{"Africa/Malabo"}
NE{"Africa/Niamey"}
NG{"Africa/Lagos"}
+ ST{"Africa/Sao_Tome"}
TD{"Africa/Ndjamena"}
TN{"Africa/Tunis"}
ZZ{"Etc/GMT-1"}
diff --git a/intl/tzdata/source/zoneinfo64.txt b/intl/tzdata/source/zoneinfo64.txt
index 154470b3ac..30fab0972f 100644
--- a/intl/tzdata/source/zoneinfo64.txt
+++ b/intl/tzdata/source/zoneinfo64.txt
@@ -3,17 +3,17 @@
// License & terms of use: http://www.unicode.org/copyright.html#License
//---------------------------------------------------------
// Build tool: tz2icu
-// Build date: Tue Oct 24 17:35:27 2017
+// Build date: Wed Mar 28 09:18:39 2018
// tz database: ftp://ftp.iana.org/tz/
-// tz version: 2017c
-// ICU version: 60.1
+// tz version: 2018d
+// ICU version: 61.1
//---------------------------------------------------------
// >> !!! >> THIS IS A MACHINE-GENERATED FILE << !!! <<
// >> !!! >>> DO NOT EDIT <<< !!! <<
//---------------------------------------------------------
zoneinfo64:table(nofallback) {
- TZVersion { "2017c" }
+ TZVersion { "2018d" }
Zones:array {
/* ACT */ :int { 354 } //Z#0
/* AET */ :int { 366 } //Z#1
@@ -24,7 +24,7 @@ zoneinfo64:table(nofallback) {
trans:intvector { -1830383032 }
typeOffsets:intvector { -968, 0, 0, 0 }
typeMap:bin { "01" }
- links:intvector { 5, 11, 13, 21, 22, 27, 38, 51, 52, 54, 55, 346 }
+ links:intvector { 5, 11, 13, 21, 22, 27, 38, 51, 52, 55, 346 }
} //Z#5
/* Africa/Accra */ :table {
trans:intvector { -1640995148, -1556841600, -1546388400, -1525305600, -1514852400, -1493769600, -1483316400, -1462233600, -1451780400, -1430611200, -1420158000, -1399075200, -1388622000, -1367539200, -1357086000, -1336003200, -1325550000, -1304380800, -1293927600, -1272844800, -1262391600, -1241308800, -1230855600, -1209772800, -1199319600, -1178150400, -1167697200, -1146614400, -1136161200, -1115078400, -1104625200, -1083542400, -1073089200, -1051920000, -1041466800, -1020384000, -1009930800, -988848000, -978394800, -957312000, -946858800, -925689600, -915236400, -894153600, -883700400, -862617600, -852164400 }
@@ -44,7 +44,7 @@ zoneinfo64:table(nofallback) {
/* Africa/Bangui */ :int { 36 } //Z#12
/* Africa/Banjul */ :int { 5 } //Z#13
/* Africa/Bissau */ :table {
- trans:intvector { -1830380260, 157770000 }
+ trans:intvector { -1830380400, 157770000 }
typeOffsets:intvector { -3740, 0, -3600, 0, 0, 0 }
typeMap:bin { "0102" }
} //Z#14
@@ -154,7 +154,12 @@ zoneinfo64:table(nofallback) {
/* Africa/Nouakchott */ :int { 5 } //Z#51
/* Africa/Ouagadougou */ :int { 5 } //Z#52
/* Africa/Porto-Novo */ :int { 36 } //Z#53
- /* Africa/Sao_Tome */ :int { 5 } //Z#54
+ /* Africa/Sao_Tome */ :table {
+ transPre32:intvector { -1, 1581055280 }
+ trans:intvector { -1830384000, 1514768400 }
+ typeOffsets:intvector { 1616, 0, -2205, 0, 0, 0, 3600, 0 }
+ typeMap:bin { "010203" }
+ } //Z#54
/* Africa/Timbuktu */ :int { 5 } //Z#55
/* Africa/Tripoli */ :table {
trans:intvector { -1577926364, -574902000, -568087200, -512175600, -504928800, -449888400, -441856800, -347158800, 378684000, 386463600, 402271200, 417999600, 433807200, 449622000, 465429600, 481590000, 496965600, 512953200, 528674400, 544230000, 560037600, 575852400, 591660000, 607388400, 623196000, 641775600, 844034400, 860108400, 875916000, 1352505600, 1364515200, 1382659200 }
@@ -358,8 +363,8 @@ zoneinfo64:table(nofallback) {
finalYear:int { 2008 }
} //Z#91
/* America/Campo_Grande */ :table {
- trans:intvector { -1767212492, -1206954000, -1191358800, -1175371200, -1159822800, -633816000, -622065600, -602280000, -591829200, -570744000, -560206800, -539121600, -531349200, -191361600, -184194000, -155160000, -150066000, -128894400, -121122000, -99950400, -89586000, -68414400, -57963600, 499752000, 511239600, 530596800, 540270000, 562132800, 571201200, 592977600, 602046000, 624427200, 634705200, 656481600, 666759600, 687931200, 697604400, 719985600, 728449200, 750830400, 761713200, 782280000, 793162800, 813729600, 824007600, 844574400, 856062000, 876110400, 888721200, 908078400, 919566000, 938923200, 951620400, 970977600, 982465200, 1003032000, 1013914800, 1036296000, 1045364400, 1066536000, 1076814000, 1099368000, 1108868400, 1129435200, 1140318000, 1162699200, 1172372400, 1192334400, 1203217200, 1224388800, 1234666800, 1255838400, 1266721200, 1287288000, 1298170800, 1318737600, 1330225200, 1350792000, 1361070000, 1382241600, 1392519600, 1413691200, 1424574000, 1445140800, 1456023600, 1476590400, 1487473200, 1508040000, 1518922800, 1540094400, 1550372400, 1571544000, 1581822000, 1602993600, 1613876400, 1634443200, 1645326000, 1665892800, 1677380400, 1697342400, 1708225200, 1729396800, 1739674800, 1760846400, 1771729200, 1792296000, 1803178800, 1823745600, 1834628400, 1855195200, 1866078000, 1887249600, 1897527600, 1918699200, 1928977200, 1950148800, 1960426800, 1981598400, 1992481200, 2013048000, 2024535600, 2044497600, 2055380400, 2076552000, 2086830000, 2108001600, 2118884400, 2139451200 }
- transPost32:intvector { 0, -2144633296, 0, -2124066496 }
+ trans:intvector { -1767212492, -1206954000, -1191358800, -1175371200, -1159822800, -633816000, -622065600, -602280000, -591829200, -570744000, -560206800, -539121600, -531349200, -191361600, -184194000, -155160000, -150066000, -128894400, -121122000, -99950400, -89586000, -68414400, -57963600, 499752000, 511239600, 530596800, 540270000, 562132800, 571201200, 592977600, 602046000, 624427200, 634705200, 656481600, 666759600, 687931200, 697604400, 719985600, 728449200, 750830400, 761713200, 782280000, 793162800, 813729600, 824007600, 844574400, 856062000, 876110400, 888721200, 908078400, 919566000, 938923200, 951620400, 970977600, 982465200, 1003032000, 1013914800, 1036296000, 1045364400, 1066536000, 1076814000, 1099368000, 1108868400, 1129435200, 1140318000, 1162699200, 1172372400, 1192334400, 1203217200, 1224388800, 1234666800, 1255838400, 1266721200, 1287288000, 1298170800, 1318737600, 1330225200, 1350792000, 1361070000, 1382241600, 1392519600, 1413691200, 1424574000, 1445140800, 1456023600, 1476590400, 1487473200, 1508040000, 1518922800, 1541304000, 1550372400, 1572753600, 1581822000, 1604203200, 1613876400, 1636257600, 1645326000, 1667707200, 1677380400, 1699156800, 1708225200, 1730606400, 1739674800, 1762056000, 1771729200, 1793505600, 1803178800, 1825560000, 1834628400, 1857009600, 1866078000, 1888459200, 1897527600, 1919908800, 1928977200, 1951358400, 1960426800, 1983412800, 1992481200, 2014862400, 2024535600, 2046312000, 2055380400, 2077761600, 2086830000, 2109211200, 2118884400, 2140660800 }
+ transPost32:intvector { 0, -2144633296, 0, -2122252096 }
typeOffsets:intvector { -13108, 0, -14400, 0, -14400, 3600 }
typeMap:bin { "01020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102" }
finalRule { "Brazil" }
@@ -416,8 +421,8 @@ zoneinfo64:table(nofallback) {
typeMap:bin { "020102" }
} //Z#103
/* America/Cuiaba */ :table {
- trans:intvector { -1767212140, -1206954000, -1191358800, -1175371200, -1159822800, -633816000, -622065600, -602280000, -591829200, -570744000, -560206800, -539121600, -531349200, -191361600, -184194000, -155160000, -150066000, -128894400, -121122000, -99950400, -89586000, -68414400, -57963600, 499752000, 511239600, 530596800, 540270000, 562132800, 571201200, 592977600, 602046000, 624427200, 634705200, 656481600, 666759600, 687931200, 697604400, 719985600, 728449200, 750830400, 761713200, 782280000, 793162800, 813729600, 824007600, 844574400, 856062000, 876110400, 888721200, 908078400, 919566000, 938923200, 951620400, 970977600, 982465200, 1003032000, 1013914800, 1036296000, 1045364400, 1099368000, 1108868400, 1129435200, 1140318000, 1162699200, 1172372400, 1192334400, 1203217200, 1224388800, 1234666800, 1255838400, 1266721200, 1287288000, 1298170800, 1318737600, 1330225200, 1350792000, 1361070000, 1382241600, 1392519600, 1413691200, 1424574000, 1445140800, 1456023600, 1476590400, 1487473200, 1508040000, 1518922800, 1540094400, 1550372400, 1571544000, 1581822000, 1602993600, 1613876400, 1634443200, 1645326000, 1665892800, 1677380400, 1697342400, 1708225200, 1729396800, 1739674800, 1760846400, 1771729200, 1792296000, 1803178800, 1823745600, 1834628400, 1855195200, 1866078000, 1887249600, 1897527600, 1918699200, 1928977200, 1950148800, 1960426800, 1981598400, 1992481200, 2013048000, 2024535600, 2044497600, 2055380400, 2076552000, 2086830000, 2108001600, 2118884400, 2139451200 }
- transPost32:intvector { 0, -2144633296, 0, -2124066496 }
+ trans:intvector { -1767212140, -1206954000, -1191358800, -1175371200, -1159822800, -633816000, -622065600, -602280000, -591829200, -570744000, -560206800, -539121600, -531349200, -191361600, -184194000, -155160000, -150066000, -128894400, -121122000, -99950400, -89586000, -68414400, -57963600, 499752000, 511239600, 530596800, 540270000, 562132800, 571201200, 592977600, 602046000, 624427200, 634705200, 656481600, 666759600, 687931200, 697604400, 719985600, 728449200, 750830400, 761713200, 782280000, 793162800, 813729600, 824007600, 844574400, 856062000, 876110400, 888721200, 908078400, 919566000, 938923200, 951620400, 970977600, 982465200, 1003032000, 1013914800, 1036296000, 1045364400, 1099368000, 1108868400, 1129435200, 1140318000, 1162699200, 1172372400, 1192334400, 1203217200, 1224388800, 1234666800, 1255838400, 1266721200, 1287288000, 1298170800, 1318737600, 1330225200, 1350792000, 1361070000, 1382241600, 1392519600, 1413691200, 1424574000, 1445140800, 1456023600, 1476590400, 1487473200, 1508040000, 1518922800, 1541304000, 1550372400, 1572753600, 1581822000, 1604203200, 1613876400, 1636257600, 1645326000, 1667707200, 1677380400, 1699156800, 1708225200, 1730606400, 1739674800, 1762056000, 1771729200, 1793505600, 1803178800, 1825560000, 1834628400, 1857009600, 1866078000, 1888459200, 1897527600, 1919908800, 1928977200, 1951358400, 1960426800, 1983412800, 1992481200, 2014862400, 2024535600, 2046312000, 2055380400, 2077761600, 2086830000, 2109211200, 2118884400, 2140660800 }
+ transPost32:intvector { 0, -2144633296, 0, -2122252096 }
typeOffsets:intvector { -13460, 0, -14400, 0, -14400, 3600 }
typeMap:bin { "0102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102" }
finalRule { "Brazil" }
@@ -529,8 +534,8 @@ zoneinfo64:table(nofallback) {
} //Z#121
/* America/Grand_Turk */ :table {
transPre32:intvector { -1, 1770462768 }
- trans:intvector { -1827687169, 294217200, 309938400, 325666800, 341388000, 357116400, 372837600, 388566000, 404892000, 420015600, 436341600, 452070000, 467791200, 483519600, 499240800, 514969200, 530690400, 544604400, 562140000, 576054000, 594194400, 607503600, 625644000, 638953200, 657093600, 671007600, 688543200, 702457200, 719992800, 733906800, 752047200, 765356400, 783496800, 796806000, 814946400, 828860400, 846396000, 860310000, 877845600, 891759600, 909295200, 923209200, 941349600, 954658800, 972799200, 986108400, 1004248800, 1018162800, 1035698400, 1049612400, 1067148000, 1081062000, 1099202400, 1112511600, 1130652000, 1143961200, 1162101600, 1173596400, 1194156000, 1205046000, 1225605600, 1236495600, 1257055200, 1268550000, 1289109600, 1299999600, 1320559200, 1331449200, 1352008800, 1362898800, 1383458400, 1394348400, 1414908000, 1425798000, 1446357600, 1520751600, 1541311200 }
- typeOffsets:intvector { -17072, 0, -18431, 0, -18000, 0, -18000, 3600, -14400, 0 }
+ trans:intvector { -1827687170, 294217200, 309938400, 325666800, 341388000, 357116400, 372837600, 388566000, 404892000, 420015600, 436341600, 452070000, 467791200, 483519600, 499240800, 514969200, 530690400, 544604400, 562140000, 576054000, 594194400, 607503600, 625644000, 638953200, 657093600, 671007600, 688543200, 702457200, 719992800, 733906800, 752047200, 765356400, 783496800, 796806000, 814946400, 828860400, 846396000, 860310000, 877845600, 891759600, 909295200, 923209200, 941349600, 954658800, 972799200, 986108400, 1004248800, 1018162800, 1035698400, 1049612400, 1067148000, 1081062000, 1099202400, 1112511600, 1130652000, 1143961200, 1162101600, 1173596400, 1194156000, 1205046000, 1225605600, 1236495600, 1257055200, 1268550000, 1289109600, 1299999600, 1320559200, 1331449200, 1352008800, 1362898800, 1383458400, 1394348400, 1414908000, 1425798000, 1446357600, 1520751600, 1541311200 }
+ typeOffsets:intvector { -17072, 0, -18430, 0, -18000, 0, -18000, 3600, -14400, 0 }
typeMap:bin { "010203020302030203020302030203020302030203020302030203020302030203020302030203020302030203020302030203020302030203020302030203020302030203020302030203040302" }
finalRule { "US" }
finalRaw:int { -18000 }
@@ -670,8 +675,8 @@ zoneinfo64:table(nofallback) {
finalYear:int { 2008 }
} //Z#141
/* America/Jamaica */ :table {
- trans:intvector { -1827687169, 126687600, 152085600, 162370800, 183535200, 199263600, 215589600, 230713200, 247039200, 262767600, 278488800, 294217200, 309938400, 325666800, 341388000, 357116400, 372837600, 388566000, 404892000, 420015600, 436341600 }
- typeOffsets:intvector { -18431, 0, -18000, 0, -18000, 3600 }
+ trans:intvector { -1827687170, 126687600, 152085600, 162370800, 183535200, 199263600, 215589600, 230713200, 247039200, 262767600, 278488800, 294217200, 309938400, 325666800, 341388000, 357116400, 372837600, 388566000, 404892000, 420015600, 436341600 }
+ typeOffsets:intvector { -18430, 0, -18000, 0, -18000, 3600 }
typeMap:bin { "010201020102010201020102010201020102010201" }
links:intvector { 142, 528 }
} //Z#142
@@ -831,9 +836,9 @@ zoneinfo64:table(nofallback) {
finalYear:int { 2003 }
} //Z#168
/* America/Montevideo */ :table {
- trans:intvector { -1567455316, -1459542600, -1443819600, -1428006600, -1412283600, -1396470600, -1380747600, -1141590600, -1128286800, -1110141000, -1096837200, -1078691400, -1065387600, -1046637000, -1033938000, -1015187400, -1002488400, -983737800, -971038800, -952288200, -938984400, -920838600, -907534800, -896819400, -883602000, -853619400, -845848800, -334789200, -319672800, -314226000, -309996000, -149720400, -134604000, -118270800, -100044000, -86821200, -68508000, -50446800, -34119000, -18910800, -2583000, 12625200, 28953000, 72932400, 82692000, 132116400, 156911400, 212983200, 250052400, 260244000, 307594800, 325994400, 566449200, 574308000, 597812400, 605671200, 625633200, 636516000, 656478000, 667965600, 688532400, 699415200, 719377200, 730864800, 1095562800, 1111896000, 1128834000, 1142136000, 1159678800, 1173585600, 1191733200, 1205035200, 1223182800, 1236484800, 1254632400, 1268539200, 1286082000, 1299988800, 1317531600, 1331438400, 1349586000, 1362888000, 1381035600, 1394337600, 1412485200, 1425787200 }
- typeOffsets:intvector { -13484, 0, -12600, 0, -12600, 1800, -10800, 0, -10800, 1800, -10800, 3600 }
- typeMap:bin { "0102010201020102010201020102010201020102010201020105030503050305030503050304030403040305030405030503050305030503050305030503050305030503050305030503050305030503050305030503" }
+ trans:intvector { -1567455309, -1459627200, -1443819600, -1428006600, -1412283600, -1396470600, -1380747600, -1141590600, -1128286800, -1110141000, -1096837200, -1078691400, -1065387600, -1047241800, -1033938000, -1015187400, -1002488400, -983737800, -971038800, -954707400, -938984400, -920838600, -907534800, -896819400, -853621200, -845847000, -334789200, -319671000, -314226000, -309996000, -149720400, -134604000, -50446800, -34205400, 9860400, 14176800, 72846000, 80100000, 127278000, 132111000, 147234600, 156913200, 165376800, 219812400, 226461600, 250052400, 257911200, 282711600, 289360800, 294202800, 322020000, 566449200, 573012000, 597812400, 605066400, 625633200, 635911200, 656478000, 667965600, 688532400, 699415200, 719377200, 730864800, 1095562800, 1111896000, 1128834000, 1142136000, 1159678800, 1173585600, 1191733200, 1205035200, 1223182800, 1236484800, 1254632400, 1268539200, 1286082000, 1299988800, 1317531600, 1331438400, 1349586000, 1362888000, 1381035600, 1394337600, 1412485200, 1425787200 }
+ typeOffsets:intvector { -13491, 0, -14400, 0, -12600, 0, -12600, 1800, -10800, 0, -10800, 1800, -10800, 3600, -10800, 5400 }
+ typeMap:bin { "01030203020302030203020302030203020302030203020305040504060406040504060406040705040604060406040604060406040604060406040604060406040604060406040604060406040604060406040604" }
} //Z#169
/* America/Montreal */ :int { 217 } //Z#170
/* America/Montserrat */ :int { 186 } //Z#171
@@ -1040,8 +1045,8 @@ zoneinfo64:table(nofallback) {
typeMap:bin { "0401030102010201020102010201050105" }
} //Z#201
/* America/Sao_Paulo */ :table {
- trans:intvector { -1767214412, -1206957600, -1191362400, -1175374800, -1159826400, -633819600, -622069200, -602283600, -591832800, -570747600, -560210400, -539125200, -531352800, -195426000, -184197600, -155163600, -150069600, -128898000, -121125600, -99954000, -89589600, -68418000, -57967200, 499748400, 511236000, 530593200, 540266400, 562129200, 571197600, 592974000, 602042400, 624423600, 634701600, 656478000, 666756000, 687927600, 697600800, 719982000, 728445600, 750826800, 761709600, 782276400, 793159200, 813726000, 824004000, 844570800, 856058400, 876106800, 888717600, 908074800, 919562400, 938919600, 951616800, 970974000, 982461600, 1003028400, 1013911200, 1036292400, 1045360800, 1066532400, 1076810400, 1099364400, 1108864800, 1129431600, 1140314400, 1162695600, 1172368800, 1192330800, 1203213600, 1224385200, 1234663200, 1255834800, 1266717600, 1287284400, 1298167200, 1318734000, 1330221600, 1350788400, 1361066400, 1382238000, 1392516000, 1413687600, 1424570400, 1445137200, 1456020000, 1476586800, 1487469600, 1508036400, 1518919200, 1540090800, 1550368800, 1571540400, 1581818400, 1602990000, 1613872800, 1634439600, 1645322400, 1665889200, 1677376800, 1697338800, 1708221600, 1729393200, 1739671200, 1760842800, 1771725600, 1792292400, 1803175200, 1823742000, 1834624800, 1855191600, 1866074400, 1887246000, 1897524000, 1918695600, 1928973600, 1950145200, 1960423200, 1981594800, 1992477600, 2013044400, 2024532000, 2044494000, 2055376800, 2076548400, 2086826400, 2107998000, 2118880800, 2139447600 }
- transPost32:intvector { 0, -2144636896, 0, -2124070096 }
+ trans:intvector { -1767214412, -1206957600, -1191362400, -1175374800, -1159826400, -633819600, -622069200, -602283600, -591832800, -570747600, -560210400, -539125200, -531352800, -195426000, -184197600, -155163600, -150069600, -128898000, -121125600, -99954000, -89589600, -68418000, -57967200, 499748400, 511236000, 530593200, 540266400, 562129200, 571197600, 592974000, 602042400, 624423600, 634701600, 656478000, 666756000, 687927600, 697600800, 719982000, 728445600, 750826800, 761709600, 782276400, 793159200, 813726000, 824004000, 844570800, 856058400, 876106800, 888717600, 908074800, 919562400, 938919600, 951616800, 970974000, 982461600, 1003028400, 1013911200, 1036292400, 1045360800, 1066532400, 1076810400, 1099364400, 1108864800, 1129431600, 1140314400, 1162695600, 1172368800, 1192330800, 1203213600, 1224385200, 1234663200, 1255834800, 1266717600, 1287284400, 1298167200, 1318734000, 1330221600, 1350788400, 1361066400, 1382238000, 1392516000, 1413687600, 1424570400, 1445137200, 1456020000, 1476586800, 1487469600, 1508036400, 1518919200, 1541300400, 1550368800, 1572750000, 1581818400, 1604199600, 1613872800, 1636254000, 1645322400, 1667703600, 1677376800, 1699153200, 1708221600, 1730602800, 1739671200, 1762052400, 1771725600, 1793502000, 1803175200, 1825556400, 1834624800, 1857006000, 1866074400, 1888455600, 1897524000, 1919905200, 1928973600, 1951354800, 1960423200, 1983409200, 1992477600, 2014858800, 2024532000, 2046308400, 2055376800, 2077758000, 2086826400, 2109207600, 2118880800, 2140657200 }
+ transPost32:intvector { 0, -2144636896, 0, -2122255696 }
typeOffsets:intvector { -11188, 0, -10800, 0, -10800, 3600 }
typeMap:bin { "01020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102010201020102" }
finalRule { "Brazil" }
@@ -1177,9 +1182,9 @@ zoneinfo64:table(nofallback) {
finalYear:int { 2008 }
} //Z#224
/* Antarctica/Casey */ :table {
- trans:intvector { -31536000, 1255802400, 1267714800, 1319738400, 1329843600, 1477065600 }
+ trans:intvector { -31536000, 1255802400, 1267714800, 1319738400, 1329843600, 1477065600, 1520701200 }
typeOffsets:intvector { 0, 0, 28800, 0, 39600, 0 }
- typeMap:bin { "010201020102" }
+ typeMap:bin { "01020102010201" }
} //Z#225
/* Antarctica/Davis */ :table {
trans:intvector { -409190400, -163062000, -28857600, 1255806000, 1268251200, 1319742000, 1329854400 }
@@ -1493,7 +1498,7 @@ zoneinfo64:table(nofallback) {
/* Asia/Kuwait */ :int { 308 } //Z#290
/* Asia/Macao */ :int { 292 } //Z#291
/* Asia/Macau */ :table {
- trans:intvector { -1830411260, -277360200, -257405400, -245910600, -225955800, -214473600, -194506200, -182406600, -163056600, -150969600, -131619600, -117088200, -101367000, -85638600, -69312600, -53584200, -37863000, -22134600, -6413400, 9315000, 25036200, 40764600, 56485800, 72201600, 87922800, 103651200, 119977200, 135705600, 151439400, 167167800, 182889000, 198617400, 214338600, 230067000, 245788200, 261504000, 277225200, 292953600, 309279600, 325008000, 340729200 }
+ trans:intvector { -1830412800, -277360200, -257405400, -245910600, -225955800, -214473600, -194506200, -182406600, -163056600, -150969600, -131619600, -117088200, -101367000, -85638600, -69312600, -53584200, -37863000, -22134600, -6413400, 9315000, 25036200, 40764600, 56485800, 72201600, 87922800, 103651200, 119977200, 135705600, 151439400, 167167800, 182889000, 198617400, 214338600, 230067000, 245788200, 261504000, 277225200, 292953600, 309279600, 325008000, 340729200 }
typeOffsets:intvector { 27260, 0, 28800, 0, 28800, 3600 }
typeMap:bin { "0102010201020102010201020102010201020102010201020102010201020102010201020102010201" }
links:intvector { 291, 292 }
@@ -1645,7 +1650,7 @@ zoneinfo64:table(nofallback) {
} //Z#322
/* Asia/Tokyo */ :table {
transPre32:intvector { -1, 1707254896 }
- trans:intvector { -683794800, -672393600, -654764400, -640944000, -620290800, -609494400, -588841200, -578044800 }
+ trans:intvector { -683802000, -672314400, -654771600, -640864800, -620298000, -609415200, -588848400, -577965600 }
typeOffsets:intvector { 33539, 0, 32400, 0, 32400, 3600 }
typeMap:bin { "010201020102010201" }
links:intvector { 323, 527, 529 }
@@ -1704,7 +1709,7 @@ zoneinfo64:table(nofallback) {
} //Z#335
/* Atlantic/Azores */ :table {
transPre32:intvector { -1, 1581063056 }
- trans:intvector { -1830377128, -1689548400, -1677794400, -1667430000, -1647730800, -1635807600, -1616194800, -1604358000, -1584658800, -1572735600, -1553036400, -1541199600, -1521500400, -1442444400, -1426806000, -1379286000, -1364770800, -1348441200, -1333321200, -1316386800, -1301266800, -1284332400, -1269817200, -1221433200, -1206918000, -1191193200, -1175468400, -1127689200, -1111964400, -1096844400, -1080514800, -1063580400, -1049065200, -1033340400, -1017615600, -1002495600, -986166000, -969231600, -950482800, -942015600, -922662000, -906937200, -891126000, -877302000, -873676800, -864000000, -857948400, -845852400, -842832000, -831340800, -825894000, -814402800, -810777600, -799891200, -794444400, -782953200, -779328000, -768441600, -762994800, -749084400, -733359600, -717624000, -701899200, -686174400, -670449600, -654724800, -639000000, -591825600, -575496000, -559771200, -544046400, -528321600, -512596800, -496872000, -481147200, -465422400, -449697600, -433972800, -417643200, -401918400, -386193600, -370468800, -354744000, -339019200, -323294400, -307569600, -291844800, -276120000, -260395200, -244670400, -228340800, -212616000, -196891200, -181166400, -165441600, -149716800, -133992000, -118267200, 228272400, 243997200, 260326800, 276051600, 291776400, 307504800, 323226000, 338954400, 354679200, 370404000, 386128800, 401853600, 417582000, 433303200, 449028000, 465357600, 481082400, 496807200, 512532000, 528256800, 543981600, 559706400, 575431200, 591156000, 606880800, 622605600, 638330400, 654660000, 670384800, 686109600, 701834400, 717559200, 733280400, 749005200, 764730000, 780454800, 796179600, 811904400, 828234000, 846378000 }
+ trans:intvector { -1830376800, -1689548400, -1677794400, -1667430000, -1647730800, -1635807600, -1616194800, -1604358000, -1584658800, -1572735600, -1553036400, -1541199600, -1521500400, -1442444400, -1426806000, -1379286000, -1364770800, -1348441200, -1333321200, -1316386800, -1301266800, -1284332400, -1269817200, -1221433200, -1206918000, -1191193200, -1175468400, -1127689200, -1111964400, -1096844400, -1080514800, -1063580400, -1049065200, -1033340400, -1017615600, -1002495600, -986166000, -969231600, -950482800, -942015600, -922662000, -906937200, -891126000, -877302000, -873676800, -864000000, -857948400, -845852400, -842832000, -831340800, -825894000, -814402800, -810777600, -799891200, -794444400, -782953200, -779328000, -768441600, -762994800, -749084400, -733359600, -717624000, -701899200, -686174400, -670449600, -654724800, -639000000, -591825600, -575496000, -559771200, -544046400, -528321600, -512596800, -496872000, -481147200, -465422400, -449697600, -433972800, -417643200, -401918400, -386193600, -370468800, -354744000, -339019200, -323294400, -307569600, -291844800, -276120000, -260395200, -244670400, -228340800, -212616000, -196891200, -181166400, -165441600, -149716800, -133992000, -118267200, 228272400, 243997200, 260326800, 276051600, 291776400, 307504800, 323226000, 338954400, 354679200, 370404000, 386128800, 401853600, 417582000, 433303200, 449028000, 465357600, 481082400, 496807200, 512532000, 528256800, 543981600, 559706400, 575431200, 591156000, 606880800, 622605600, 638330400, 654660000, 670384800, 686109600, 701834400, 717559200, 733280400, 749005200, 764730000, 780454800, 796179600, 811904400, 828234000, 846378000 }
typeOffsets:intvector { -6160, 0, -7200, 0, -7200, 3600, -7200, 7200, -6872, 0, -3600, 0, -3600, 3600, 0, 0 }
typeMap:bin { "04010201020102010201020102010201020102010201020102010201020102010201020102010201020102010203020102030201020302010203020102010201020102010201020102010201020102010201020102010201020102010201020102010506050605060506050605060506050605060506050605060506050605060506070605060506050605" }
finalRule { "EU" }
@@ -1728,7 +1733,7 @@ zoneinfo64:table(nofallback) {
finalYear:int { 1997 }
} //Z#338
/* Atlantic/Cape_Verde */ :table {
- trans:intvector { -1988144756, -862610400, -764118000, 186120000 }
+ trans:intvector { -1830376800, -862610400, -764118000, 186120000 }
typeOffsets:intvector { -5644, 0, -7200, 0, -7200, 3600, -3600, 0 }
typeMap:bin { "01020103" }
} //Z#339
@@ -1744,7 +1749,7 @@ zoneinfo64:table(nofallback) {
} //Z#341
/* Atlantic/Jan_Mayen */ :int { 473 } //Z#342
/* Atlantic/Madeira */ :table {
- trans:intvector { -1830379944, -1689552000, -1677798000, -1667433600, -1647734400, -1635811200, -1616198400, -1604361600, -1584662400, -1572739200, -1553040000, -1541203200, -1521504000, -1442448000, -1426809600, -1379289600, -1364774400, -1348444800, -1333324800, -1316390400, -1301270400, -1284336000, -1269820800, -1221436800, -1206921600, -1191196800, -1175472000, -1127692800, -1111968000, -1096848000, -1080518400, -1063584000, -1049068800, -1033344000, -1017619200, -1002499200, -986169600, -969235200, -950486400, -942019200, -922665600, -906940800, -891129600, -877305600, -873680400, -864003600, -857952000, -845856000, -842835600, -831344400, -825897600, -814406400, -810781200, -799894800, -794448000, -782956800, -779331600, -768445200, -762998400, -749088000, -733363200, -717627600, -701902800, -686178000, -670453200, -654728400, -639003600, -591829200, -575499600, -559774800, -544050000, -528325200, -512600400, -496875600, -481150800, -465426000, -449701200, -433976400, -417646800, -401922000, -386197200, -370472400, -354747600, -339022800, -323298000, -307573200, -291848400, -276123600, -260398800, -244674000, -228344400, -212619600, -196894800, -181170000, -165445200, -149720400, -133995600, -118270800, 228268800, 243993600, 260323200, 276048000, 291772800, 307501200, 323222400, 338950800, 354675600, 370400400, 386125200, 401850000, 417578400, 433299600, 449024400, 465354000, 481078800, 496803600, 512528400, 528253200, 543978000, 559702800, 575427600, 591152400, 606877200, 622602000, 638326800, 654656400, 670381200, 686106000, 701830800, 717555600, 733280400, 749005200, 764730000, 780454800, 796179600, 811904400, 828234000, 846378000 }
+ trans:intvector { -1830380400, -1689552000, -1677798000, -1667433600, -1647734400, -1635811200, -1616198400, -1604361600, -1584662400, -1572739200, -1553040000, -1541203200, -1521504000, -1442448000, -1426809600, -1379289600, -1364774400, -1348444800, -1333324800, -1316390400, -1301270400, -1284336000, -1269820800, -1221436800, -1206921600, -1191196800, -1175472000, -1127692800, -1111968000, -1096848000, -1080518400, -1063584000, -1049068800, -1033344000, -1017619200, -1002499200, -986169600, -969235200, -950486400, -942019200, -922665600, -906940800, -891129600, -877305600, -873680400, -864003600, -857952000, -845856000, -842835600, -831344400, -825897600, -814406400, -810781200, -799894800, -794448000, -782956800, -779331600, -768445200, -762998400, -749088000, -733363200, -717627600, -701902800, -686178000, -670453200, -654728400, -639003600, -591829200, -575499600, -559774800, -544050000, -528325200, -512600400, -496875600, -481150800, -465426000, -449701200, -433976400, -417646800, -401922000, -386197200, -370472400, -354747600, -339022800, -323298000, -307573200, -291848400, -276123600, -260398800, -244674000, -228344400, -212619600, -196894800, -181170000, -165445200, -149720400, -133995600, -118270800, 228268800, 243993600, 260323200, 276048000, 291772800, 307501200, 323222400, 338950800, 354675600, 370400400, 386125200, 401850000, 417578400, 433299600, 449024400, 465354000, 481078800, 496803600, 512528400, 528253200, 543978000, 559702800, 575427600, 591152400, 606877200, 622602000, 638326800, 654656400, 670381200, 686106000, 701830800, 717555600, 733280400, 749005200, 764730000, 780454800, 796179600, 811904400, 828234000, 846378000 }
typeOffsets:intvector { -4056, 0, -3600, 0, -3600, 3600, -3600, 7200, 0, 0, 0, 3600 }
typeMap:bin { "010201020102010201020102010201020102010201020102010201020102010201020102010201020102010203020102030201020302010203020102010201020102010201020102010201020102010201020102010201020102010201020102010405040504050405040504050405040504050405040504050405040504050405040504050405040504" }
finalRule { "EU" }
@@ -2196,7 +2201,7 @@ zoneinfo64:table(nofallback) {
typeMap:bin { "010304030403040304030403040304030403020102010302010201020102010201020102010201020102010201020102010201020102010201020102010301" }
} //Z#461
/* Europe/Lisbon */ :table {
- trans:intvector { -1830381795, -1689555600, -1677801600, -1667437200, -1647738000, -1635814800, -1616202000, -1604365200, -1584666000, -1572742800, -1553043600, -1541206800, -1521507600, -1442451600, -1426813200, -1379293200, -1364778000, -1348448400, -1333328400, -1316394000, -1301274000, -1284339600, -1269824400, -1221440400, -1206925200, -1191200400, -1175475600, -1127696400, -1111971600, -1096851600, -1080522000, -1063587600, -1049072400, -1033347600, -1017622800, -1002502800, -986173200, -969238800, -950490000, -942022800, -922669200, -906944400, -891133200, -877309200, -873684000, -864007200, -857955600, -845859600, -842839200, -831348000, -825901200, -814410000, -810784800, -799898400, -794451600, -782960400, -779335200, -768448800, -763002000, -749091600, -733366800, -717631200, -701906400, -686181600, -670456800, -654732000, -639007200, -591832800, -575503200, -559778400, -544053600, -528328800, -512604000, -496879200, -481154400, -465429600, -449704800, -433980000, -417650400, -401925600, -386200800, -370476000, -354751200, -339026400, -323301600, -307576800, -291852000, -276127200, -260402400, -244677600, -228348000, -212623200, -196898400, -181173600, -165448800, -149724000, -133999200, -118274400, 212544000, 228268800, 243993600, 260323200, 276048000, 291772800, 307501200, 323222400, 338950800, 354675600, 370400400, 386125200, 401850000, 417578400, 433299600, 449024400, 465354000, 481078800, 496803600, 512528400, 528253200, 543978000, 559702800, 575427600, 591152400, 606877200, 622602000, 638326800, 654656400, 670381200, 686106000, 701830800, 717555600, 733280400, 749005200, 764730000, 780454800, 796179600, 811904400, 828234000, 846378000 }
+ trans:intvector { -1830384000, -1689555600, -1677801600, -1667437200, -1647738000, -1635814800, -1616202000, -1604365200, -1584666000, -1572742800, -1553043600, -1541206800, -1521507600, -1442451600, -1426813200, -1379293200, -1364778000, -1348448400, -1333328400, -1316394000, -1301274000, -1284339600, -1269824400, -1221440400, -1206925200, -1191200400, -1175475600, -1127696400, -1111971600, -1096851600, -1080522000, -1063587600, -1049072400, -1033347600, -1017622800, -1002502800, -986173200, -969238800, -950490000, -942022800, -922669200, -906944400, -891133200, -877309200, -873684000, -864007200, -857955600, -845859600, -842839200, -831348000, -825901200, -814410000, -810784800, -799898400, -794451600, -782960400, -779335200, -768448800, -763002000, -749091600, -733366800, -717631200, -701906400, -686181600, -670456800, -654732000, -639007200, -591832800, -575503200, -559778400, -544053600, -528328800, -512604000, -496879200, -481154400, -465429600, -449704800, -433980000, -417650400, -401925600, -386200800, -370476000, -354751200, -339026400, -323301600, -307576800, -291852000, -276127200, -260402400, -244677600, -228348000, -212623200, -196898400, -181173600, -165448800, -149724000, -133999200, -118274400, 212544000, 228268800, 243993600, 260323200, 276048000, 291772800, 307501200, 323222400, 338950800, 354675600, 370400400, 386125200, 401850000, 417578400, 433299600, 449024400, 465354000, 481078800, 496803600, 512528400, 528253200, 543978000, 559702800, 575427600, 591152400, 606877200, 622602000, 638326800, 654656400, 670381200, 686106000, 701830800, 717555600, 733280400, 749005200, 764730000, 780454800, 796179600, 811904400, 828234000, 846378000 }
typeOffsets:intvector { -2205, 0, 0, 0, 0, 3600, 0, 7200, 3600, 0, 3600, 3600 }
typeMap:bin { "01020102010201020102010201020102010201020102010201020102010201020102010201020102010201020302010203020102030201020302010201020102010201020102010201020102010201020102010201020102010201020102010201040102010201020102010201020102010201020102010201020102010201020102040504050405040201" }
finalRule { "EU" }
@@ -2600,7 +2605,7 @@ zoneinfo64:table(nofallback) {
} //Z#556
/* Pacific/Enderbury */ :table {
transPre32:intvector { -1, 2117555556 }
- trans:intvector { 307627200, 788958000 }
+ trans:intvector { 307627200, 788871600 }
typeOffsets:intvector { -41060, 0, -43200, 0, -39600, 0, 46800, 0 }
typeMap:bin { "010203" }
} //Z#557
@@ -2655,7 +2660,7 @@ zoneinfo64:table(nofallback) {
/* Pacific/Johnston */ :int { 565 } //Z#566
/* Pacific/Kiritimati */ :table {
transPre32:intvector { -1, 2117552256 }
- trans:intvector { 307622400, 788954400 }
+ trans:intvector { 307622400, 788868000 }
typeOffsets:intvector { -37760, 0, -38400, 0, -36000, 0, 50400, 0 }
typeMap:bin { "010203" }
} //Z#567
@@ -3083,7 +3088,7 @@ zoneinfo64:table(nofallback) {
9, 1, -1, 7200, 1, 3, 1, -1, 7200, 1, 3600
} //_#3
Brazil:intvector {
- 9, 15, -1, 0, 0, 1, 15, -1, 0, 0, 3600
+ 10, 1, -1, 0, 0, 1, 15, -1, 0, 0, 3600
} //_#4
C-Eur:intvector {
2, -31, -1, 7200, 1, 9, -31, -1, 7200, 1, 3600
@@ -3137,7 +3142,7 @@ zoneinfo64:table(nofallback) {
8, -30, -1, 7200, 1, 3, 1, -1, 7200, 1, 3600
} //_#21
Palestine:intvector {
- 2, -31, -7, 3600, 0, 9, -31, -7, 3600, 0, 3600
+ 2, 22, -7, 3600, 0, 9, -31, -7, 3600, 0, 3600
} //_#22
Para:intvector {
9, 1, -1, 0, 0, 2, 22, -1, 0, 0, 3600
diff --git a/intl/uconv/nsScriptableUConv.cpp b/intl/uconv/nsScriptableUConv.cpp
index 7d4e932e20..43889ffa25 100644
--- a/intl/uconv/nsScriptableUConv.cpp
+++ b/intl/uconv/nsScriptableUConv.cpp
@@ -11,6 +11,7 @@
#include "nsIUnicodeDecoder.h"
#include "nsIUnicodeEncoder.h"
#include "mozilla/dom/EncodingUtils.h"
+#include "mozilla/CheckedInt.h"
using mozilla::dom::EncodingUtils;
@@ -39,7 +40,12 @@ nsScriptableUnicodeConverter::ConvertFromUnicodeWithLength(const nsAString& aSrc
const nsAFlatString& flatSrc = PromiseFlatString(aSrc);
rv = mEncoder->GetMaxLength(flatSrc.get(), inLength, aOutLen);
if (NS_SUCCEEDED(rv)) {
- *_retval = (char*)malloc(*aOutLen+1);
+ mozilla::CheckedInt<int32_t> needed(*aOutLen);
+ needed += 1;
+ if (!needed.isValid()) {
+ return NS_ERROR_OUT_OF_MEMORY;
+ }
+ *_retval = (char*)malloc(needed.value());
if (!*_retval)
return NS_ERROR_OUT_OF_MEMORY;
@@ -145,7 +151,13 @@ nsScriptableUnicodeConverter::ConvertFromByteArray(const uint8_t* aData,
inLength, &outLength);
if (NS_SUCCEEDED(rv))
{
- char16_t* buf = (char16_t*)malloc((outLength+1) * sizeof(char16_t));
+ mozilla::CheckedInt<nsACString::size_type> needed(outLength);
+ needed += 1;
+ needed *= sizeof(char16_t);
+ if (!needed.isValid()) {
+ return NS_ERROR_OUT_OF_MEMORY;
+ }
+ char16_t* buf = (char16_t*)malloc(needed.value());
if (!buf)
return NS_ERROR_OUT_OF_MEMORY;
diff --git a/intl/uconv/ucvtw/nsBIG5ToUnicode.cpp b/intl/uconv/ucvtw/nsBIG5ToUnicode.cpp
index 8dbf84a147..b07df3d76e 100644
--- a/intl/uconv/ucvtw/nsBIG5ToUnicode.cpp
+++ b/intl/uconv/ucvtw/nsBIG5ToUnicode.cpp
@@ -152,7 +152,17 @@ nsBIG5ToUnicode::GetMaxLength(const char* aSrc,
{
// The length of the output in UTF-16 code units never exceeds the length
// of the input in bytes.
- *aDestLength = aSrcLength + (mPendingTrail ? 1 : 0) + (mBig5Lead ? 1 : 0);
+ mozilla::CheckedInt32 length = aSrcLength;
+ if (mPendingTrail) {
+ length += 1;
+ }
+ if (mBig5Lead) {
+ length += 1;
+ }
+ if (!length.isValid()) {
+ return NS_ERROR_OUT_OF_MEMORY;
+ }
+ *aDestLength = length.value();
return NS_OK;
}
diff --git a/intl/uconv/ucvtw/nsUnicodeToBIG5.cpp b/intl/uconv/ucvtw/nsUnicodeToBIG5.cpp
index c3c9658dfb..b30be2f9b9 100644
--- a/intl/uconv/ucvtw/nsUnicodeToBIG5.cpp
+++ b/intl/uconv/ucvtw/nsUnicodeToBIG5.cpp
@@ -211,12 +211,21 @@ nsUnicodeToBIG5::GetMaxLength(const char16_t* aSrc,
int32_t aSrcLength,
int32_t* aDestLength)
{
- *aDestLength = (aSrcLength * 2) +
- (mPendingTrail ? 1 : 0) +
- // If the lead ends up being paired, the bytes produced
- // are already included above.
- // If not, it produces a single '?'.
- (mUtf16Lead ? 1 : 0);
+ mozilla::CheckedInt32 length = aSrcLength;
+ length *= 2;
+ if (mPendingTrail) {
+ length += 1;
+ }
+ // If the lead ends up being paired, the bytes produced
+ // are already included above.
+ // If not, it produces a single '?'.
+ if (mUtf16Lead) {
+ length += 1;
+ }
+ if (!length.isValid()) {
+ return NS_ERROR_OUT_OF_MEMORY;
+ }
+ *aDestLength = length.value();
return NS_OK;
}
diff --git a/ipc/glue/BackgroundUtils.cpp b/ipc/glue/BackgroundUtils.cpp
index b335f5c23d..e115fa74c7 100644
--- a/ipc/glue/BackgroundUtils.cpp
+++ b/ipc/glue/BackgroundUtils.cpp
@@ -280,6 +280,7 @@ LoadInfoToLoadInfoArgs(nsILoadInfo *aLoadInfo,
aLoadInfo->GetUpgradeInsecureRequests(),
aLoadInfo->GetVerifySignedContent(),
aLoadInfo->GetEnforceSRI(),
+ aLoadInfo->GetForceAllowDataURI(),
aLoadInfo->GetForceInheritPrincipalDropped(),
aLoadInfo->GetInnerWindowID(),
aLoadInfo->GetOuterWindowID(),
@@ -294,6 +295,7 @@ LoadInfoToLoadInfoArgs(nsILoadInfo *aLoadInfo,
aLoadInfo->CorsUnsafeHeaders(),
aLoadInfo->GetForcePreflight(),
aLoadInfo->GetIsPreflight(),
+ aLoadInfo->GetLoadTriggeredFromExternal(),
aLoadInfo->GetForceHSTSPriming(),
aLoadInfo->GetMixedContentWouldBlock());
@@ -356,6 +358,7 @@ LoadInfoArgsToLoadInfo(const OptionalLoadInfoArgs& aOptionalLoadInfoArgs,
loadInfoArgs.upgradeInsecureRequests(),
loadInfoArgs.verifySignedContent(),
loadInfoArgs.enforceSRI(),
+ loadInfoArgs.forceAllowDataURI(),
loadInfoArgs.forceInheritPrincipalDropped(),
loadInfoArgs.innerWindowID(),
loadInfoArgs.outerWindowID(),
@@ -370,6 +373,7 @@ LoadInfoArgsToLoadInfo(const OptionalLoadInfoArgs& aOptionalLoadInfoArgs,
loadInfoArgs.corsUnsafeHeaders(),
loadInfoArgs.forcePreflight(),
loadInfoArgs.isPreflight(),
+ loadInfoArgs.loadTriggeredFromExternal(),
loadInfoArgs.forceHSTSPriming(),
loadInfoArgs.mixedContentWouldBlock()
);
diff --git a/ipc/glue/CrashReporterHost.cpp b/ipc/glue/CrashReporterHost.cpp
index 76052ae663..85552cba5d 100644
--- a/ipc/glue/CrashReporterHost.cpp
+++ b/ipc/glue/CrashReporterHost.cpp
@@ -9,9 +9,6 @@
#include "mozilla/Sprintf.h"
#include "mozilla/SyncRunnable.h"
#include "mozilla/Telemetry.h"
-#ifdef MOZ_CRASHREPORTER
-# include "nsICrashService.h"
-#endif
namespace mozilla {
namespace ipc {
@@ -24,105 +21,5 @@ CrashReporterHost::CrashReporterHost(GeckoProcessType aProcessType,
{
}
-#ifdef MOZ_CRASHREPORTER
-void
-CrashReporterHost::GenerateCrashReport(RefPtr<nsIFile> aCrashDump)
-{
- nsString dumpID;
- if (!CrashReporter::GetIDFromMinidump(aCrashDump, dumpID)) {
- return;
- }
-
- CrashReporter::AnnotationTable notes;
-
- nsAutoCString type;
- switch (mProcessType) {
- case GeckoProcessType_Content:
- type = NS_LITERAL_CSTRING("content");
- break;
- case GeckoProcessType_Plugin:
- case GeckoProcessType_GMPlugin:
- type = NS_LITERAL_CSTRING("plugin");
- break;
- case GeckoProcessType_GPU:
- type = NS_LITERAL_CSTRING("gpu");
- break;
- default:
- NS_ERROR("unknown process type");
- break;
- }
- notes.Put(NS_LITERAL_CSTRING("ProcessType"), type);
-
- char startTime[32];
- SprintfLiteral(startTime, "%lld", static_cast<long long>(mStartTime));
- notes.Put(NS_LITERAL_CSTRING("StartupTime"), nsDependentCString(startTime));
-
- CrashReporterMetadataShmem::ReadAppNotes(mShmem, &notes);
-
- CrashReporter::AppendExtraData(dumpID, notes);
- NotifyCrashService(mProcessType, dumpID, &notes);
-}
-
-/* static */ void
-CrashReporterHost::NotifyCrashService(GeckoProcessType aProcessType,
- const nsString& aChildDumpID,
- const AnnotationTable* aNotes)
-{
- if (!NS_IsMainThread()) {
- RefPtr<Runnable> runnable = NS_NewRunnableFunction([=] () -> void {
- CrashReporterHost::NotifyCrashService(aProcessType, aChildDumpID, aNotes);
- });
- RefPtr<nsIThread> mainThread = do_GetMainThread();
- SyncRunnable::DispatchToThread(mainThread, runnable);
- return;
- }
-
- MOZ_ASSERT(!aChildDumpID.IsEmpty());
-
- nsCOMPtr<nsICrashService> crashService =
- do_GetService("@mozilla.org/crashservice;1");
- if (!crashService) {
- return;
- }
-
- int32_t processType;
- int32_t crashType = nsICrashService::CRASH_TYPE_CRASH;
-
- nsCString telemetryKey;
-
- switch (aProcessType) {
- case GeckoProcessType_Content:
- processType = nsICrashService::PROCESS_TYPE_CONTENT;
- telemetryKey.AssignLiteral("content");
- break;
- case GeckoProcessType_Plugin: {
- processType = nsICrashService::PROCESS_TYPE_PLUGIN;
- telemetryKey.AssignLiteral("plugin");
- nsAutoCString val;
- if (aNotes->Get(NS_LITERAL_CSTRING("PluginHang"), &val) &&
- val.Equals(NS_LITERAL_CSTRING("1"))) {
- crashType = nsICrashService::CRASH_TYPE_HANG;
- telemetryKey.AssignLiteral("pluginhang");
- }
- break;
- }
- case GeckoProcessType_GMPlugin:
- processType = nsICrashService::PROCESS_TYPE_GMPLUGIN;
- telemetryKey.AssignLiteral("gmplugin");
- break;
- case GeckoProcessType_GPU:
- processType = nsICrashService::PROCESS_TYPE_GPU;
- telemetryKey.AssignLiteral("gpu");
- break;
- default:
- NS_ERROR("unknown process type");
- return;
- }
-
- crashService->AddCrash(processType, crashType, aChildDumpID);
- Telemetry::Accumulate(Telemetry::SUBPROCESS_CRASHES_WITH_DUMP, telemetryKey, 1);
-}
-#endif
-
} // namespace ipc
} // namespace mozilla
diff --git a/ipc/glue/CrashReporterHost.h b/ipc/glue/CrashReporterHost.h
index 36c5923c27..1089781c56 100644
--- a/ipc/glue/CrashReporterHost.h
+++ b/ipc/glue/CrashReporterHost.h
@@ -28,26 +28,6 @@ class CrashReporterHost
public:
CrashReporterHost(GeckoProcessType aProcessType, const Shmem& aShmem);
-#ifdef MOZ_CRASHREPORTER
- void GenerateCrashReport(base::ProcessId aPid) {
- RefPtr<nsIFile> crashDump;
- if (!XRE_TakeMinidumpForChild(aPid, getter_AddRefs(crashDump), nullptr)) {
- return;
- }
- GenerateCrashReport(crashDump);
- }
-
- // This is a static helper function to notify the crash service that a
- // crash has occurred. When PCrashReporter is removed, we can make this
- // a member function. This can be called from any thread, and if not
- // called from the main thread, will post a synchronous message to the
- // main thread.
- static void NotifyCrashService(
- GeckoProcessType aProcessType,
- const nsString& aChildDumpID,
- const AnnotationTable* aNotes);
-#endif
-
private:
void GenerateCrashReport(RefPtr<nsIFile> aCrashDump);
diff --git a/ipc/glue/CrashReporterMetadataShmem.cpp b/ipc/glue/CrashReporterMetadataShmem.cpp
index f579d5bb0e..5b889948bc 100644
--- a/ipc/glue/CrashReporterMetadataShmem.cpp
+++ b/ipc/glue/CrashReporterMetadataShmem.cpp
@@ -208,28 +208,5 @@ private:
EntryType mEntryType;
};
-#ifdef MOZ_CRASHREPORTER
-void
-CrashReporterMetadataShmem::ReadAppNotes(const Shmem& aShmem, CrashReporter::AnnotationTable* aNotes)
-{
- for (MetadataShmemReader reader(aShmem); !reader.Done(); reader.Next()) {
- switch (reader.Type()) {
- case EntryType::Annotation: {
- nsCString key, value;
- if (!reader.Read(key) || !reader.Read(value)) {
- return;
- }
-
- aNotes->Put(key, value);
- break;
- }
- default:
- NS_ASSERTION(false, "Unknown metadata entry type");
- break;
- }
- }
-}
-#endif
-
} // namespace ipc
} // namespace mozilla
diff --git a/ipc/glue/CrashReporterMetadataShmem.h b/ipc/glue/CrashReporterMetadataShmem.h
index d2d8670a22..ad67c6d750 100644
--- a/ipc/glue/CrashReporterMetadataShmem.h
+++ b/ipc/glue/CrashReporterMetadataShmem.h
@@ -28,10 +28,6 @@ public:
void AnnotateCrashReport(const nsCString& aKey, const nsCString& aData);
void AppendAppNotes(const nsCString& aData);
-#ifdef MOZ_CRASHREPORTER
- static void ReadAppNotes(const Shmem& aShmem, CrashReporter::AnnotationTable* aNotes);
-#endif
-
private:
void SyncNotesToShmem();
diff --git a/ipc/glue/GeckoChildProcessHost.cpp b/ipc/glue/GeckoChildProcessHost.cpp
index 48051472aa..db8ab3d0a7 100644
--- a/ipc/glue/GeckoChildProcessHost.cpp
+++ b/ipc/glue/GeckoChildProcessHost.cpp
@@ -307,12 +307,6 @@ GeckoChildProcessHost::GetUniqueID()
void
GeckoChildProcessHost::PrepareLaunch()
{
-#ifdef MOZ_CRASHREPORTER
- if (CrashReporter::GetEnabled()) {
- CrashReporter::OOPInit();
- }
-#endif
-
#ifdef XP_WIN
if (mProcessType == GeckoProcessType_Plugin) {
InitWindowsGroupID();
@@ -902,26 +896,6 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
childArgv.push_back(pidstring);
-#if defined(MOZ_CRASHREPORTER)
-# if defined(OS_LINUX) || defined(OS_BSD)
- int childCrashFd, childCrashRemapFd;
- if (!CrashReporter::CreateNotificationPipeForChild(
- &childCrashFd, &childCrashRemapFd))
- return false;
- if (0 <= childCrashFd) {
- mFileMap.push_back(std::pair<int,int>(childCrashFd, childCrashRemapFd));
- // "true" == crash reporting enabled
- childArgv.push_back("true");
- }
- else {
- // "false" == crash reporting disabled
- childArgv.push_back("false");
- }
-# elif defined(MOZ_WIDGET_COCOA)
- childArgv.push_back(CrashReporter::GetChildNotificationPipe());
-# endif // OS_LINUX
-#endif
-
#ifdef MOZ_WIDGET_COCOA
// Add a mach port to the command line so the child can communicate its
// 'task_t' back to the parent.
@@ -1139,11 +1113,6 @@ GeckoChildProcessHost::PerformAsyncLaunchInternal(std::vector<std::string>& aExt
// Process id
cmdLine.AppendLooseValue(UTF8ToWide(pidstring));
-#if defined(MOZ_CRASHREPORTER)
- cmdLine.AppendLooseValue(
- UTF8ToWide(CrashReporter::GetChildNotificationPipe()));
-#endif
-
// Process type
cmdLine.AppendLooseValue(UTF8ToWide(childProcessType));
diff --git a/ipc/glue/IPCMessageUtils.h b/ipc/glue/IPCMessageUtils.h
index 094aa978a8..15834a8548 100644
--- a/ipc/glue/IPCMessageUtils.h
+++ b/ipc/glue/IPCMessageUtils.h
@@ -25,9 +25,6 @@
#include <stdint.h>
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
#include "nsID.h"
#include "nsIWidget.h"
#include "nsMemory.h"
@@ -127,16 +124,8 @@ struct EnumSerializer {
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult) {
uintParamType value;
if (!ReadParam(aMsg, aIter, &value)) {
-#ifdef MOZ_CRASHREPORTER
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCReadErrorReason"),
- NS_LITERAL_CSTRING("Bad iter"));
-#endif
return false;
} else if (!EnumValidator::IsLegalValue(paramType(value))) {
-#ifdef MOZ_CRASHREPORTER
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCReadErrorReason"),
- NS_LITERAL_CSTRING("Illegal value"));
-#endif
return false;
}
*aResult = paramType(value);
diff --git a/ipc/glue/MessageChannel.h b/ipc/glue/MessageChannel.h
index df70899dff..4c9edf9dd7 100644
--- a/ipc/glue/MessageChannel.h
+++ b/ipc/glue/MessageChannel.h
@@ -19,10 +19,6 @@
#include "mozilla/ipc/Neutering.h"
#endif // defined(OS_WIN)
#include "mozilla/ipc/Transport.h"
-#if defined(MOZ_CRASHREPORTER) && defined(OS_WIN)
-#include "mozilla/mozalloc_oom.h"
-#include "nsExceptionHandler.h"
-#endif
#include "MessageLink.h"
#include <deque>
diff --git a/ipc/glue/MessageLink.cpp b/ipc/glue/MessageLink.cpp
index 6a1bda02df..a66fbbb326 100644
--- a/ipc/glue/MessageLink.cpp
+++ b/ipc/glue/MessageLink.cpp
@@ -14,9 +14,6 @@
#include "mozilla/Assertions.h"
#include "mozilla/DebugOnly.h"
#include "nsDebug.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
#include "nsISupportsImpl.h"
#include "nsXULAppAPI.h"
@@ -135,10 +132,6 @@ void
ProcessLink::SendMessage(Message *msg)
{
if (msg->size() > IPC::Channel::kMaximumMessageSize) {
-#ifdef MOZ_CRASHREPORTER
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCMessageName"), nsDependentCString(msg->name()));
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCMessageSize"), nsPrintfCString("%d", msg->size()));
-#endif
MOZ_CRASH("IPC message size is too large");
}
diff --git a/ipc/glue/ProtocolUtils.cpp b/ipc/glue/ProtocolUtils.cpp
index 1a022048fc..4de1314692 100644
--- a/ipc/glue/ProtocolUtils.cpp
+++ b/ipc/glue/ProtocolUtils.cpp
@@ -25,13 +25,6 @@
#include "mozilla/sandboxTarget.h"
#endif
-#if defined(MOZ_CRASHREPORTER) && defined(XP_WIN)
-#include "aclapi.h"
-#include "sddl.h"
-
-#include "mozilla/TypeTraits.h"
-#endif
-
#include "nsAutoPtr.h"
using namespace IPC;
@@ -42,16 +35,6 @@ using base::ProcessId;
namespace mozilla {
-#if defined(MOZ_CRASHREPORTER) && defined(XP_WIN)
-// Generate RAII classes for LPTSTR and PSECURITY_DESCRIPTOR.
-MOZ_TYPE_SPECIFIC_SCOPED_POINTER_TEMPLATE(ScopedLPTStr, \
- RemovePointer<LPTSTR>::Type, \
- ::LocalFree)
-MOZ_TYPE_SPECIFIC_SCOPED_POINTER_TEMPLATE(ScopedPSecurityDescriptor, \
- RemovePointer<PSECURITY_DESCRIPTOR>::Type, \
- ::LocalFree)
-#endif
-
namespace ipc {
class ChannelOpened : public IPC::Message
@@ -195,11 +178,6 @@ bool DuplicateHandle(HANDLE aSourceHandle,
FALSE,
aTargetProcessId));
if (!targetProcess) {
-#ifdef MOZ_CRASHREPORTER
- CrashReporter::AnnotateCrashReport(
- NS_LITERAL_CSTRING("IPCTransportFailureReason"),
- NS_LITERAL_CSTRING("Failed to open target process."));
-#endif
return false;
}
@@ -209,34 +187,6 @@ bool DuplicateHandle(HANDLE aSourceHandle,
}
#endif
-#ifdef MOZ_CRASHREPORTER
-void
-AnnotateSystemError()
-{
- int64_t error = 0;
-#if defined(XP_WIN)
- error = ::GetLastError();
-#elif defined(OS_POSIX)
- error = errno;
-#endif
- if (error) {
- CrashReporter::AnnotateCrashReport(
- NS_LITERAL_CSTRING("IPCSystemError"),
- nsPrintfCString("%lld", error));
- }
-}
-#endif
-
-#if defined(MOZ_CRASHREPORTER) && defined(XP_MACOSX)
-void
-AnnotateCrashReportWithErrno(const char* tag, int error)
-{
- CrashReporter::AnnotateCrashReport(
- nsCString(tag),
- nsPrintfCString("%d", error));
-}
-#endif
-
void
LogMessageForProtocol(const char* aTopLevelProtocol, base::ProcessId aOtherPid,
const char* aContextDescription,
@@ -274,18 +224,6 @@ FatalError(const char* aProtocolName, const char* aMsg, bool aIsParent)
formattedMessage.AppendLiteral("]: \"");
formattedMessage.AppendASCII(aMsg);
if (aIsParent) {
-#ifdef MOZ_CRASHREPORTER
- // We're going to crash the parent process because at this time
- // there's no other really nice way of getting a minidump out of
- // this process if we're off the main thread.
- formattedMessage.AppendLiteral("\". Intentionally crashing.");
- NS_ERROR(formattedMessage.get());
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCFatalErrorProtocol"),
- nsDependentCString(aProtocolName));
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("IPCFatalErrorMsg"),
- nsDependentCString(aMsg));
- AnnotateSystemError();
-#endif
MOZ_CRASH("IPC FatalError in the parent process!");
} else {
formattedMessage.AppendLiteral("\". abort()ing as a result.");
@@ -540,12 +478,9 @@ IToplevelProtocol::SetOtherProcessId(base::ProcessId aOtherPid)
bool
IToplevelProtocol::TakeMinidump(nsIFile** aDump, uint32_t* aSequence)
{
+ /*** STUB ***/
MOZ_RELEASE_ASSERT(GetSide() == ParentSide);
-#ifdef MOZ_CRASHREPORTER
- return XRE_TakeMinidumpForChild(OtherPid(), aDump, aSequence);
-#else
return false;
-#endif
}
bool
diff --git a/ipc/glue/ProtocolUtils.h b/ipc/glue/ProtocolUtils.h
index 9184aae547..83860d93a4 100644
--- a/ipc/glue/ProtocolUtils.h
+++ b/ipc/glue/ProtocolUtils.h
@@ -472,14 +472,10 @@ DuplicateHandle(HANDLE aSourceHandle,
#endif
/**
- * Annotate the crash reporter with the error code from the most recent system
- * call. Returns the system error.
+ * Hist: Annotated the crash reporter with the error code from the most
+ * recent system call. Returned the system error.
*/
-#ifdef MOZ_CRASHREPORTER
-void AnnotateSystemError();
-#else
#define AnnotateSystemError() do { } while (0)
-#endif
/**
* An endpoint represents one end of a partially initialized IPDL channel. To
@@ -599,12 +595,8 @@ private:
ProtocolId mProtocolId;
};
-#if defined(MOZ_CRASHREPORTER) && defined(XP_MACOSX)
-void AnnotateCrashReportWithErrno(const char* tag, int error);
-#else
static inline void AnnotateCrashReportWithErrno(const char* tag, int error)
{}
-#endif
// This function is used internally to create a pair of Endpoints. See the
// comment above Endpoint for a description of how it might be used.
diff --git a/ipc/ipdl/ipdl/lower.py b/ipc/ipdl/ipdl/lower.py
index f810cccb03..61855a7a9e 100644
--- a/ipc/ipdl/ipdl/lower.py
+++ b/ipc/ipdl/ipdl/lower.py
@@ -2610,13 +2610,6 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
'"'+ _protocolHeaderName(self.protocol, self.side) +'.h"') ]
+ setToIncludes(self.externalIncludes))
- if self.protocol.decl.type.isToplevel():
- cf.addthings([
- CppDirective('ifdef', 'MOZ_CRASHREPORTER'),
- CppDirective(' include', '"nsXULAppAPI.h"'),
- CppDirective('endif')
- ])
-
cppheaders = [CppDirective('include', '"%s"' % filename)
for filename in ipdl.builtin.CppIncludes]
diff --git a/js/public/CallArgs.h b/js/public/CallArgs.h
index 6e6164e55a..a7774309aa 100644
--- a/js/public/CallArgs.h
+++ b/js/public/CallArgs.h
@@ -290,7 +290,7 @@ class MOZ_STACK_CLASS CallArgs : public detail::CallArgsBase<detail::IncludeUsed
args.constructing_ = constructing;
#ifdef DEBUG
for (unsigned i = 0; i < argc; ++i)
- MOZ_ASSERT_IF(argv[i].isMarkable(), !GCThingIsMarkedGray(GCCellPtr(argv[i])));
+ MOZ_ASSERT_IF(argv[i].isGCThing(), !GCThingIsMarkedGray(GCCellPtr(argv[i])));
#endif
return args;
}
diff --git a/js/public/Date.h b/js/public/Date.h
index cba0ea875d..cab36a3de9 100644
--- a/js/public/Date.h
+++ b/js/public/Date.h
@@ -134,6 +134,14 @@ NewDateObject(JSContext* cx, ClippedTime time);
JS_PUBLIC_API(double)
MakeDate(double year, unsigned month, unsigned day);
+// Year is a year, month is 0-11, day is 1-based, and time is in milliseconds.
+// The return value is a number of milliseconds since the epoch.
+//
+// Consistent with the MakeDate algorithm defined in ECMAScript, this value is
+// *not* clipped! Use JS::TimeClip if you need a clipped date.
+JS_PUBLIC_API(double)
+MakeDate(double year, unsigned month, unsigned day, double time);
+
// Takes an integer number of milliseconds since the epoch and returns the
// year. Can return NaN, and will do so if NaN is passed in.
JS_PUBLIC_API(double)
diff --git a/js/public/Proxy.h b/js/public/Proxy.h
index 3e95538db6..5acb91b26e 100644
--- a/js/public/Proxy.h
+++ b/js/public/Proxy.h
@@ -456,7 +456,7 @@ SetProxyExtra(JSObject* obj, size_t n, const Value& extra)
Value* vp = &detail::GetProxyDataLayout(obj)->values->extraSlots[n];
// Trigger a barrier before writing the slot.
- if (vp->isMarkable() || extra.isMarkable())
+ if (vp->isGCThing() || extra.isGCThing())
SetValueInProxy(vp, extra);
else
*vp = extra;
@@ -482,7 +482,7 @@ SetReservedOrProxyPrivateSlot(JSObject* obj, size_t slot, const Value& value)
MOZ_ASSERT(slot == 0);
MOZ_ASSERT(slot < JSCLASS_RESERVED_SLOTS(GetObjectClass(obj)) || IsProxy(obj));
shadow::Object* sobj = reinterpret_cast<shadow::Object*>(obj);
- if (sobj->slotRef(slot).isMarkable() || value.isMarkable())
+ if (sobj->slotRef(slot).isGCThing() || value.isGCThing())
SetReservedOrProxyPrivateSlotWithBarrier(obj, slot, value);
else
sobj->slotRef(slot) = value;
diff --git a/js/public/TraceKind.h b/js/public/TraceKind.h
index 2eda9cb2c1..3270966fc2 100644
--- a/js/public/TraceKind.h
+++ b/js/public/TraceKind.h
@@ -40,9 +40,11 @@ enum class TraceKind
// Note: The order here is determined by our Value packing. Other users
// should sort alphabetically, for consistency.
Object = 0x00,
- String = 0x01,
- Symbol = 0x02,
- Script = 0x03,
+ String = 0x02,
+ Symbol = 0x03,
+
+ // 0x1 is not used for any GCThing Value tag, so we use it for Script.
+ Script = 0x01,
// Shape details are exposed through JS_TraceShapeCycleCollectorChildren.
Shape = 0x04,
diff --git a/js/public/Value.h b/js/public/Value.h
index 00fdad5861..01666ed4e1 100644
--- a/js/public/Value.h
+++ b/js/public/Value.h
@@ -51,12 +51,12 @@ JS_ENUM_HEADER(JSValueType, uint8_t)
JSVAL_TYPE_DOUBLE = 0x00,
JSVAL_TYPE_INT32 = 0x01,
JSVAL_TYPE_UNDEFINED = 0x02,
- JSVAL_TYPE_BOOLEAN = 0x03,
- JSVAL_TYPE_MAGIC = 0x04,
- JSVAL_TYPE_STRING = 0x05,
- JSVAL_TYPE_SYMBOL = 0x06,
- JSVAL_TYPE_PRIVATE_GCTHING = 0x07,
- JSVAL_TYPE_NULL = 0x08,
+ JSVAL_TYPE_NULL = 0x03,
+ JSVAL_TYPE_BOOLEAN = 0x04,
+ JSVAL_TYPE_MAGIC = 0x05,
+ JSVAL_TYPE_STRING = 0x06,
+ JSVAL_TYPE_SYMBOL = 0x07,
+ JSVAL_TYPE_PRIVATE_GCTHING = 0x08,
JSVAL_TYPE_OBJECT = 0x0c,
/* These never appear in a jsval; they are only provided as an out-of-band value. */
@@ -75,11 +75,11 @@ JS_ENUM_HEADER(JSValueTag, uint32_t)
JSVAL_TAG_CLEAR = 0xFFFFFF80,
JSVAL_TAG_INT32 = JSVAL_TAG_CLEAR | JSVAL_TYPE_INT32,
JSVAL_TAG_UNDEFINED = JSVAL_TAG_CLEAR | JSVAL_TYPE_UNDEFINED,
+ JSVAL_TAG_NULL = JSVAL_TAG_CLEAR | JSVAL_TYPE_NULL,
JSVAL_TAG_STRING = JSVAL_TAG_CLEAR | JSVAL_TYPE_STRING,
JSVAL_TAG_SYMBOL = JSVAL_TAG_CLEAR | JSVAL_TYPE_SYMBOL,
JSVAL_TAG_BOOLEAN = JSVAL_TAG_CLEAR | JSVAL_TYPE_BOOLEAN,
JSVAL_TAG_MAGIC = JSVAL_TAG_CLEAR | JSVAL_TYPE_MAGIC,
- JSVAL_TAG_NULL = JSVAL_TAG_CLEAR | JSVAL_TYPE_NULL,
JSVAL_TAG_OBJECT = JSVAL_TAG_CLEAR | JSVAL_TYPE_OBJECT,
JSVAL_TAG_PRIVATE_GCTHING = JSVAL_TAG_CLEAR | JSVAL_TYPE_PRIVATE_GCTHING
} JS_ENUM_FOOTER(JSValueTag);
@@ -95,11 +95,11 @@ JS_ENUM_HEADER(JSValueTag, uint32_t)
JSVAL_TAG_MAX_DOUBLE = 0x1FFF0,
JSVAL_TAG_INT32 = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_INT32,
JSVAL_TAG_UNDEFINED = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_UNDEFINED,
+ JSVAL_TAG_NULL = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_NULL,
JSVAL_TAG_STRING = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_STRING,
JSVAL_TAG_SYMBOL = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_SYMBOL,
JSVAL_TAG_BOOLEAN = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_BOOLEAN,
JSVAL_TAG_MAGIC = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_MAGIC,
- JSVAL_TAG_NULL = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_NULL,
JSVAL_TAG_OBJECT = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_OBJECT,
JSVAL_TAG_PRIVATE_GCTHING = JSVAL_TAG_MAX_DOUBLE | JSVAL_TYPE_PRIVATE_GCTHING
} JS_ENUM_FOOTER(JSValueTag);
@@ -112,11 +112,11 @@ JS_ENUM_HEADER(JSValueShiftedTag, uint64_t)
JSVAL_SHIFTED_TAG_MAX_DOUBLE = ((((uint64_t)JSVAL_TAG_MAX_DOUBLE) << JSVAL_TAG_SHIFT) | 0xFFFFFFFF),
JSVAL_SHIFTED_TAG_INT32 = (((uint64_t)JSVAL_TAG_INT32) << JSVAL_TAG_SHIFT),
JSVAL_SHIFTED_TAG_UNDEFINED = (((uint64_t)JSVAL_TAG_UNDEFINED) << JSVAL_TAG_SHIFT),
+ JSVAL_SHIFTED_TAG_NULL = (((uint64_t)JSVAL_TAG_NULL) << JSVAL_TAG_SHIFT),
JSVAL_SHIFTED_TAG_STRING = (((uint64_t)JSVAL_TAG_STRING) << JSVAL_TAG_SHIFT),
JSVAL_SHIFTED_TAG_SYMBOL = (((uint64_t)JSVAL_TAG_SYMBOL) << JSVAL_TAG_SHIFT),
JSVAL_SHIFTED_TAG_BOOLEAN = (((uint64_t)JSVAL_TAG_BOOLEAN) << JSVAL_TAG_SHIFT),
JSVAL_SHIFTED_TAG_MAGIC = (((uint64_t)JSVAL_TAG_MAGIC) << JSVAL_TAG_SHIFT),
- JSVAL_SHIFTED_TAG_NULL = (((uint64_t)JSVAL_TAG_NULL) << JSVAL_TAG_SHIFT),
JSVAL_SHIFTED_TAG_OBJECT = (((uint64_t)JSVAL_TAG_OBJECT) << JSVAL_TAG_SHIFT),
JSVAL_SHIFTED_TAG_PRIVATE_GCTHING = (((uint64_t)JSVAL_TAG_PRIVATE_GCTHING) << JSVAL_TAG_SHIFT)
} JS_ENUM_FOOTER(JSValueShiftedTag);
@@ -140,24 +140,25 @@ static_assert(sizeof(JSValueShiftedTag) == sizeof(uint64_t),
#define JSVAL_TYPE_TO_TAG(type) ((JSValueTag)(JSVAL_TAG_CLEAR | (type)))
-#define JSVAL_LOWER_INCL_TAG_OF_OBJ_OR_NULL_SET JSVAL_TAG_NULL
+#define JSVAL_RAW64_UNDEFINED (uint64_t(JSVAL_TAG_UNDEFINED) << 32)
+
#define JSVAL_UPPER_EXCL_TAG_OF_PRIMITIVE_SET JSVAL_TAG_OBJECT
#define JSVAL_UPPER_INCL_TAG_OF_NUMBER_SET JSVAL_TAG_INT32
#define JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET JSVAL_TAG_STRING
#elif defined(JS_PUNBOX64)
+#define JSVAL_RAW64_UNDEFINED (uint64_t(JSVAL_TAG_UNDEFINED) << JSVAL_TAG_SHIFT)
+
#define JSVAL_PAYLOAD_MASK 0x00007FFFFFFFFFFFLL
#define JSVAL_TAG_MASK 0xFFFF800000000000LL
#define JSVAL_TYPE_TO_TAG(type) ((JSValueTag)(JSVAL_TAG_MAX_DOUBLE | (type)))
#define JSVAL_TYPE_TO_SHIFTED_TAG(type) (((uint64_t)JSVAL_TYPE_TO_TAG(type)) << JSVAL_TAG_SHIFT)
-#define JSVAL_LOWER_INCL_TAG_OF_OBJ_OR_NULL_SET JSVAL_TAG_NULL
#define JSVAL_UPPER_EXCL_TAG_OF_PRIMITIVE_SET JSVAL_TAG_OBJECT
#define JSVAL_UPPER_INCL_TAG_OF_NUMBER_SET JSVAL_TAG_INT32
#define JSVAL_LOWER_INCL_TAG_OF_GCTHING_SET JSVAL_TAG_STRING
-#define JSVAL_LOWER_INCL_SHIFTED_TAG_OF_OBJ_OR_NULL_SET JSVAL_SHIFTED_TAG_NULL
#define JSVAL_UPPER_EXCL_SHIFTED_TAG_OF_PRIMITIVE_SET JSVAL_SHIFTED_TAG_OBJECT
#define JSVAL_UPPER_EXCL_SHIFTED_TAG_OF_NUMBER_SET JSVAL_SHIFTED_TAG_UNDEFINED
#define JSVAL_LOWER_INCL_SHIFTED_TAG_OF_GCTHING_SET JSVAL_SHIFTED_TAG_STRING
@@ -537,12 +538,7 @@ class MOZ_NON_PARAM alignas(8) Value
}
bool isObjectOrNull() const {
- MOZ_ASSERT(uint32_t(toTag()) <= uint32_t(JSVAL_TAG_OBJECT));
-#if defined(JS_NUNBOX32)
- return uint32_t(toTag()) >= uint32_t(JSVAL_LOWER_INCL_TAG_OF_OBJ_OR_NULL_SET);
-#elif defined(JS_PUNBOX64)
- return data.asBits >= JSVAL_LOWER_INCL_SHIFTED_TAG_OF_OBJ_OR_NULL_SET;
-#endif
+ return isObject() || isNull();
}
bool isGCThing() const {
@@ -575,12 +571,8 @@ class MOZ_NON_PARAM alignas(8) Value
return isMagic();
}
- bool isMarkable() const {
- return isGCThing() && !isNull();
- }
-
JS::TraceKind traceKind() const {
- MOZ_ASSERT(isMarkable());
+ MOZ_ASSERT(isGCThing());
static_assert((JSVAL_TAG_STRING & 0x03) == size_t(JS::TraceKind::String),
"Value type tags must correspond with JS::TraceKinds.");
static_assert((JSVAL_TAG_SYMBOL & 0x03) == size_t(JS::TraceKind::Symbol),
@@ -684,11 +676,6 @@ class MOZ_NON_PARAM alignas(8) Value
#endif
}
- js::gc::Cell* toMarkablePointer() const {
- MOZ_ASSERT(isMarkable());
- return toGCThing();
- }
-
GCCellPtr toGCCellPtr() const {
return GCCellPtr(toGCThing(), traceKind());
}
@@ -760,9 +747,9 @@ class MOZ_NON_PARAM alignas(8) Value
* Private GC Thing API
*
* Non-JSObject, JSString, and JS::Symbol cells may be put into the 64-bit
- * payload as private GC things. Such Values are considered isMarkable()
- * and isGCThing(), and as such, automatically marked. Their traceKind()
- * is gotten via their cells.
+ * payload as private GC things. Such Values are considered isGCThing(), and
+ * as such, automatically marked. Their traceKind() is gotten via their
+ * cells.
*/
void setPrivateGCThing(js::gc::Cell* cell) {
@@ -834,7 +821,7 @@ class MOZ_NON_PARAM alignas(8) Value
double asDouble;
void* asPtr;
- layout() = default;
+ layout() : asBits(JSVAL_RAW64_UNDEFINED) {}
explicit constexpr layout(uint64_t bits) : asBits(bits) {}
explicit constexpr layout(double d) : asDouble(d) {}
} data;
@@ -860,7 +847,7 @@ class MOZ_NON_PARAM alignas(8) Value
size_t asWord;
uintptr_t asUIntPtr;
- layout() = default;
+ layout() : asBits(JSVAL_RAW64_UNDEFINED) {}
explicit constexpr layout(uint64_t bits) : asBits(bits) {}
explicit constexpr layout(double d) : asDouble(d) {}
} data;
@@ -888,7 +875,7 @@ class MOZ_NON_PARAM alignas(8) Value
double asDouble;
void* asPtr;
- layout() = default;
+ layout() : asBits(JSVAL_RAW64_UNDEFINED) {}
explicit constexpr layout(uint64_t bits) : asBits(bits) {}
explicit constexpr layout(double d) : asDouble(d) {}
} data;
@@ -912,7 +899,7 @@ class MOZ_NON_PARAM alignas(8) Value
size_t asWord;
uintptr_t asUIntPtr;
- layout() = default;
+ layout() : asBits(JSVAL_RAW64_UNDEFINED) {}
explicit constexpr layout(uint64_t bits) : asBits(bits) {}
explicit constexpr layout(double d) : asDouble(d) {}
} data;
@@ -965,8 +952,51 @@ class MOZ_NON_PARAM alignas(8) Value
}
} JS_HAZ_GC_POINTER;
+/**
+ * This is a null-constructible structure that can convert to and from
+ * a Value, allowing UninitializedValue to be stored in unions.
+ */
+struct MOZ_NON_PARAM alignas(8) UninitializedValue
+{
+ private:
+ uint64_t bits;
+
+ public:
+ UninitializedValue() = default;
+ UninitializedValue(const UninitializedValue&) = default;
+ MOZ_IMPLICIT UninitializedValue(const Value& val) : bits(val.asRawBits()) {}
+
+ inline uint64_t asRawBits() const {
+ return bits;
+ }
+
+ inline Value& asValueRef() {
+ return *reinterpret_cast<Value*>(this);
+ }
+ inline const Value& asValueRef() const {
+ return *reinterpret_cast<const Value*>(this);
+ }
+
+ inline operator Value&() {
+ return asValueRef();
+ }
+ inline operator Value const&() const {
+ return asValueRef();
+ }
+ inline operator Value() const {
+ return asValueRef();
+ }
+
+ inline void operator=(Value const& other) {
+ asValueRef() = other;
+ }
+};
+
static_assert(sizeof(Value) == 8, "Value size must leave three tag bits, be a binary power, and is ubiquitously depended upon everywhere");
+static_assert(sizeof(UninitializedValue) == sizeof(Value), "Value and UninitializedValue must be the same size");
+static_assert(alignof(UninitializedValue) == alignof(Value), "Value and UninitializedValue must have same alignment");
+
inline bool
IsOptimizedPlaceholderMagicValue(const Value& v)
{
@@ -980,7 +1010,7 @@ IsOptimizedPlaceholderMagicValue(const Value& v)
static MOZ_ALWAYS_INLINE void
ExposeValueToActiveJS(const Value& v)
{
- if (v.isMarkable())
+ if (v.isGCThing())
js::gc::ExposeGCThingToActiveJS(GCCellPtr(v));
}
@@ -1298,7 +1328,7 @@ template <>
struct BarrierMethods<JS::Value>
{
static gc::Cell* asGCThingOrNull(const JS::Value& v) {
- return v.isMarkable() ? v.toGCThing() : nullptr;
+ return v.isGCThing() ? v.toGCThing() : nullptr;
}
static void postBarrier(JS::Value* v, const JS::Value& prev, const JS::Value& next) {
JS::HeapValuePostBarrier(v, prev, next);
@@ -1338,9 +1368,8 @@ class ValueOperations
bool isObject() const { return value().isObject(); }
bool isMagic() const { return value().isMagic(); }
bool isMagic(JSWhyMagic why) const { return value().isMagic(why); }
- bool isMarkable() const { return value().isMarkable(); }
- bool isPrimitive() const { return value().isPrimitive(); }
bool isGCThing() const { return value().isGCThing(); }
+ bool isPrimitive() const { return value().isPrimitive(); }
bool isNullOrUndefined() const { return value().isNullOrUndefined(); }
bool isObjectOrNull() const { return value().isObjectOrNull(); }
@@ -1485,7 +1514,7 @@ DispatchTyped(F f, const JS::Value& val, Args&&... args)
return f(val.toSymbol(), mozilla::Forward<Args>(args)...);
if (MOZ_UNLIKELY(val.isPrivateGCThing()))
return DispatchTyped(f, val.toGCCellPtr(), mozilla::Forward<Args>(args)...);
- MOZ_ASSERT(!val.isMarkable());
+ MOZ_ASSERT(!val.isGCThing());
return F::defaultValue(val);
}
diff --git a/js/src/Makefile.in b/js/src/Makefile.in
index 3be6a67817..b007954b1f 100644
--- a/js/src/Makefile.in
+++ b/js/src/Makefile.in
@@ -147,13 +147,6 @@ ifeq ($(OS_ARCH),AIX)
CFLAGS += -qsuppress=1540-1281 -qsuppress=1540-1608
CXXFLAGS += -qsuppress=1540-1281 -qsuppress=1540-1608
endif
-ifeq ($(OS_ARCH),HP-UX)
-# Suppress warnings from aCC
-# 3055: anonymous unions declaring types
-# 4189: offsetof() on non-POD types
-CFLAGS += +W3055,4189
-CXXFLAGS += +W3055,4189
-endif
endif
ifeq ($(OS_ARCH),SunOS)
ifeq ($(TARGET_CPU),sparc)
diff --git a/js/src/aclocal.m4 b/js/src/aclocal.m4
index 627837a412..abbbd4873a 100644
--- a/js/src/aclocal.m4
+++ b/js/src/aclocal.m4
@@ -25,7 +25,6 @@ builtin(include, ../../build/autoconf/zlib.m4)dnl
builtin(include, ../../build/autoconf/icu.m4)dnl
builtin(include, ../../build/autoconf/clang-plugin.m4)dnl
builtin(include, ../../build/autoconf/alloc.m4)dnl
-builtin(include, ../../build/autoconf/jemalloc.m4)dnl
builtin(include, ../../build/autoconf/sanitize.m4)dnl
builtin(include, ../../build/autoconf/ios.m4)dnl
diff --git a/js/src/builtin/Array.js b/js/src/builtin/Array.js
index 54b47b72f5..45f90a7b80 100644
--- a/js/src/builtin/Array.js
+++ b/js/src/builtin/Array.js
@@ -784,7 +784,7 @@ function ArrayKeys() {
return CreateArrayIterator(this, ITEM_KIND_KEY);
}
-// ES6 draft rev31 (2015/01/15) 22.1.2.1 Array.from(source[, mapfn[, thisArg]]).
+// ES 2017 draft 0f10dba4ad18de92d47d421f378233a2eae8f077 22.1.2.1
function ArrayFrom(items, mapfn=undefined, thisArg=undefined) {
// Step 1.
var C = this;
@@ -795,44 +795,40 @@ function ArrayFrom(items, mapfn=undefined, thisArg=undefined) {
ThrowTypeError(JSMSG_NOT_FUNCTION, DecompileArg(1, mapfn));
var T = thisArg;
- // Steps 4-5.
+ // Step 4.
var usingIterator = GetMethod(items, std_iterator);
- // Step 6.
+ // Step 5.
if (usingIterator !== undefined) {
- // Steps 6.a-c.
+ // Steps 5.a-c.
var A = IsConstructor(C) ? new C() : [];
- // Steps 6.d-e.
- var iterator = GetIterator(items, usingIterator);
-
- // Step 6.f.
+ // Step 5.d.
var k = 0;
- // Step 6.g.
- // These steps cannot be implemented using a for-of loop.
- // See <https://bugs.ecmascript.org/show_bug.cgi?id=2883>.
- while (true) {
- // Steps 6.g.i-iii.
- var next = callContentFunction(iterator.next, iterator);
- if (!IsObject(next))
- ThrowTypeError(JSMSG_NEXT_RETURNED_PRIMITIVE);
-
- // Step 6.g.iv.
- if (next.done) {
- A.length = k;
- return A;
- }
-
- // Steps 6.g.v-vi.
- var nextValue = next.value;
+ // Step 5.c, 5.e.
+ var iteratorWrapper = { [std_iterator]() { return GetIterator(items, usingIterator); } };
+ for (var nextValue of allowContentIter(iteratorWrapper)) {
+ // Step 5.e.i.
+ // Disabled for performance reason. We won't hit this case on
+ // normal array, since _DefineDataProperty will throw before it.
+ // We could hit this when |A| is a proxy and it ignores
+ // |_DefineDataProperty|, but it happens only after too long loop.
+ /*
+ if (k >= 0x1fffffffffffff)
+ ThrowTypeError(JSMSG_TOO_LONG_ARRAY);
+ */
- // Steps 6.g.vii-viii.
+ // Steps 5.e.vi-vii.
var mappedValue = mapping ? callContentFunction(mapfn, thisArg, nextValue, k) : nextValue;
- // Steps 6.g.ix-xi.
+ // Steps 5.e.ii (reordered), 5.e.viii.
_DefineDataProperty(A, k++, mappedValue);
}
+
+ // Step 5.e.iv.
+ A.length = k;
+ return A;
}
// Step 7.
diff --git a/js/src/builtin/Classes.js b/js/src/builtin/Classes.js
index d0f20b5fd7..24841d605e 100644
--- a/js/src/builtin/Classes.js
+++ b/js/src/builtin/Classes.js
@@ -5,7 +5,7 @@
var DefaultDerivedClassConstructor =
class extends null {
constructor(...args) {
- super(...allowContentSpread(args));
+ super(...allowContentIter(args));
}
};
MakeDefaultConstructor(DefaultDerivedClassConstructor);
diff --git a/js/src/builtin/Intl.cpp b/js/src/builtin/Intl.cpp
index 990a4acdb7..cd808cb107 100644
--- a/js/src/builtin/Intl.cpp
+++ b/js/src/builtin/Intl.cpp
@@ -102,6 +102,18 @@ Char16ToUChar(char16_t* chars)
MOZ_CRASH("Char16ToUChar: Intl API disabled");
}
+inline char16_t*
+UCharToChar16(UChar* chars)
+{
+ MOZ_CRASH("UCharToChar16: Intl API disabled");
+}
+
+inline const char16_t*
+UCharToChar16(const UChar* chars)
+{
+ MOZ_CRASH("UCharToChar16: Intl API disabled");
+}
+
static int32_t
u_strlen(const UChar* s)
{
@@ -356,6 +368,27 @@ enum UCalendarDateFields {
UCAL_DAY_OF_MONTH = UCAL_DATE
};
+enum UCalendarMonths {
+ UCAL_JANUARY,
+ UCAL_FEBRUARY,
+ UCAL_MARCH,
+ UCAL_APRIL,
+ UCAL_MAY,
+ UCAL_JUNE,
+ UCAL_JULY,
+ UCAL_AUGUST,
+ UCAL_SEPTEMBER,
+ UCAL_OCTOBER,
+ UCAL_NOVEMBER,
+ UCAL_DECEMBER,
+ UCAL_UNDECIMBER
+};
+
+enum UCalendarAMPMs {
+ UCAL_AM,
+ UCAL_PM
+};
+
static UCalendar*
ucal_open(const UChar* zoneID, int32_t len, const char* locale,
UCalendarType type, UErrorCode* status)
@@ -420,6 +453,13 @@ ucal_getDefaultTimeZone(UChar* result, int32_t resultCapacity, UErrorCode* statu
MOZ_CRASH("ucal_getDefaultTimeZone: Intl API disabled");
}
+enum UDateTimePatternField {
+ UDATPG_YEAR_FIELD,
+ UDATPG_MONTH_FIELD,
+ UDATPG_WEEK_OF_YEAR_FIELD,
+ UDATPG_DAY_FIELD,
+};
+
typedef void* UDateTimePatternGenerator;
static UDateTimePatternGenerator*
@@ -436,6 +476,14 @@ udatpg_getBestPattern(UDateTimePatternGenerator* dtpg, const UChar* skeleton,
MOZ_CRASH("udatpg_getBestPattern: Intl API disabled");
}
+static const UChar *
+udatpg_getAppendItemName(const UDateTimePatternGenerator *dtpg,
+ UDateTimePatternField field,
+ int32_t *pLength)
+{
+ MOZ_CRASH("udatpg_getAppendItemName: Intl API disabled");
+}
+
static void
udatpg_close(UDateTimePatternGenerator* dtpg)
{
@@ -488,10 +536,46 @@ enum UDateFormatField {
};
enum UDateFormatStyle {
+ UDAT_FULL,
+ UDAT_LONG,
+ UDAT_MEDIUM,
+ UDAT_SHORT,
+ UDAT_DEFAULT = UDAT_MEDIUM,
UDAT_PATTERN = -2,
UDAT_IGNORE = UDAT_PATTERN
};
+enum UDateFormatSymbolType {
+ UDAT_ERAS,
+ UDAT_MONTHS,
+ UDAT_SHORT_MONTHS,
+ UDAT_WEEKDAYS,
+ UDAT_SHORT_WEEKDAYS,
+ UDAT_AM_PMS,
+ UDAT_LOCALIZED_CHARS,
+ UDAT_ERA_NAMES,
+ UDAT_NARROW_MONTHS,
+ UDAT_NARROW_WEEKDAYS,
+ UDAT_STANDALONE_MONTHS,
+ UDAT_STANDALONE_SHORT_MONTHS,
+ UDAT_STANDALONE_NARROW_MONTHS,
+ UDAT_STANDALONE_WEEKDAYS,
+ UDAT_STANDALONE_SHORT_WEEKDAYS,
+ UDAT_STANDALONE_NARROW_WEEKDAYS,
+ UDAT_QUARTERS,
+ UDAT_SHORT_QUARTERS,
+ UDAT_STANDALONE_QUARTERS,
+ UDAT_STANDALONE_SHORT_QUARTERS,
+ UDAT_SHORTER_WEEKDAYS,
+ UDAT_STANDALONE_SHORTER_WEEKDAYS,
+ UDAT_CYCLIC_YEARS_WIDE,
+ UDAT_CYCLIC_YEARS_ABBREVIATED,
+ UDAT_CYCLIC_YEARS_NARROW,
+ UDAT_ZODIAC_NAMES_WIDE,
+ UDAT_ZODIAC_NAMES_ABBREVIATED,
+ UDAT_ZODIAC_NAMES_NARROW
+};
+
static int32_t
udat_countAvailable()
{
@@ -563,6 +647,13 @@ udat_close(UDateFormat* format)
MOZ_CRASH("udat_close: Intl API disabled");
}
+static int32_t
+udat_getSymbols(const UDateFormat *fmt, UDateFormatSymbolType type, int32_t symbolIndex,
+ UChar *result, int32_t resultLength, UErrorCode *status)
+{
+ MOZ_CRASH("udat_getSymbols: Intl API disabled");
+}
+
#endif
@@ -765,42 +856,53 @@ static const JSFunctionSpec collator_methods[] = {
};
/**
- * Collator constructor.
- * Spec: ECMAScript Internationalization API Specification, 10.1
+ * 10.1.2 Intl.Collator([ locales [, options]])
+ *
+ * ES2017 Intl draft rev 94045d234762ad107a3d09bb6f7381a65f1a2f9b
*/
static bool
Collator(JSContext* cx, const CallArgs& args, bool construct)
{
RootedObject obj(cx);
+ // We're following ECMA-402 1st Edition when Collator is called because of
+ // backward compatibility issues.
+ // See https://github.com/tc39/ecma402/issues/57
if (!construct) {
- // 10.1.2.1 step 3
+ // ES Intl 1st ed., 10.1.2.1 step 3
JSObject* intl = cx->global()->getOrCreateIntlObject(cx);
if (!intl)
return false;
RootedValue self(cx, args.thisv());
if (!self.isUndefined() && (!self.isObject() || self.toObject() != *intl)) {
- // 10.1.2.1 step 4
+ // ES Intl 1st ed., 10.1.2.1 step 4
obj = ToObject(cx, self);
if (!obj)
return false;
- // 10.1.2.1 step 5
+ // ES Intl 1st ed., 10.1.2.1 step 5
bool extensible;
if (!IsExtensible(cx, obj, &extensible))
return false;
if (!extensible)
return Throw(cx, obj, JSMSG_OBJECT_NOT_EXTENSIBLE);
} else {
- // 10.1.2.1 step 3.a
+ // ES Intl 1st ed., 10.1.2.1 step 3.a
construct = true;
}
}
if (construct) {
- // 10.1.3.1 paragraph 2
- RootedObject proto(cx, cx->global()->getOrCreateCollatorPrototype(cx));
- if (!proto)
+ // Steps 2-5 (Inlined 9.1.14, OrdinaryCreateFromConstructor).
+ RootedObject proto(cx);
+ if (args.isConstructing() && !GetPrototypeFromCallableConstructor(cx, args, &proto))
return false;
+
+ if (!proto) {
+ proto = cx->global()->getOrCreateCollatorPrototype(cx);
+ if (!proto)
+ return false;
+ }
+
obj = NewObjectWithGivenProto(cx, &CollatorClass, proto);
if (!obj)
return false;
@@ -808,15 +910,13 @@ Collator(JSContext* cx, const CallArgs& args, bool construct)
obj->as<NativeObject>().setReservedSlot(UCOLLATOR_SLOT, PrivateValue(nullptr));
}
- // 10.1.2.1 steps 1 and 2; 10.1.3.1 steps 1 and 2
RootedValue locales(cx, args.length() > 0 ? args[0] : UndefinedValue());
RootedValue options(cx, args.length() > 1 ? args[1] : UndefinedValue());
- // 10.1.2.1 step 6; 10.1.3.1 step 3
+ // Step 6.
if (!IntlInitialize(cx, obj, cx->names().InitializeCollator, locales, options))
return false;
- // 10.1.2.1 steps 3.a and 7
args.rval().setObject(*obj);
return true;
}
@@ -833,6 +933,7 @@ js::intl_Collator(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
MOZ_ASSERT(args.length() == 2);
+ MOZ_ASSERT(!args.isConstructing());
// intl_Collator is an intrinsic for self-hosted JavaScript, so it cannot
// be used with "new", but it still has to be treated as a constructor.
return Collator(cx, args, true);
@@ -1257,42 +1358,53 @@ static const JSFunctionSpec numberFormat_methods[] = {
};
/**
- * NumberFormat constructor.
- * Spec: ECMAScript Internationalization API Specification, 11.1
+ * 11.2.1 Intl.NumberFormat([ locales [, options]])
+ *
+ * ES2017 Intl draft rev 94045d234762ad107a3d09bb6f7381a65f1a2f9b
*/
static bool
NumberFormat(JSContext* cx, const CallArgs& args, bool construct)
{
RootedObject obj(cx);
+ // We're following ECMA-402 1st Edition when NumberFormat is called
+ // because of backward compatibility issues.
+ // See https://github.com/tc39/ecma402/issues/57
if (!construct) {
- // 11.1.2.1 step 3
+ // ES Intl 1st ed., 11.1.2.1 step 3
JSObject* intl = cx->global()->getOrCreateIntlObject(cx);
if (!intl)
return false;
RootedValue self(cx, args.thisv());
if (!self.isUndefined() && (!self.isObject() || self.toObject() != *intl)) {
- // 11.1.2.1 step 4
+ // ES Intl 1st ed., 11.1.2.1 step 4
obj = ToObject(cx, self);
if (!obj)
return false;
- // 11.1.2.1 step 5
+ // ES Intl 1st ed., 11.1.2.1 step 5
bool extensible;
if (!IsExtensible(cx, obj, &extensible))
return false;
if (!extensible)
return Throw(cx, obj, JSMSG_OBJECT_NOT_EXTENSIBLE);
} else {
- // 11.1.2.1 step 3.a
+ // ES Intl 1st ed., 11.1.2.1 step 3.a
construct = true;
}
}
if (construct) {
- // 11.1.3.1 paragraph 2
- RootedObject proto(cx, cx->global()->getOrCreateNumberFormatPrototype(cx));
- if (!proto)
+ // Step 2 (Inlined 9.1.14, OrdinaryCreateFromConstructor).
+ RootedObject proto(cx);
+ if (args.isConstructing() && !GetPrototypeFromCallableConstructor(cx, args, &proto))
return false;
+
+ if (!proto) {
+ proto = cx->global()->getOrCreateNumberFormatPrototype(cx);
+ if (!proto)
+ return false;
+ }
+
obj = NewObjectWithGivenProto(cx, &NumberFormatClass, proto);
if (!obj)
return false;
@@ -1300,15 +1412,13 @@ NumberFormat(JSContext* cx, const CallArgs& args, bool construct)
obj->as<NativeObject>().setReservedSlot(UNUMBER_FORMAT_SLOT, PrivateValue(nullptr));
}
- // 11.1.2.1 steps 1 and 2; 11.1.3.1 steps 1 and 2
RootedValue locales(cx, args.length() > 0 ? args[0] : UndefinedValue());
RootedValue options(cx, args.length() > 1 ? args[1] : UndefinedValue());
- // 11.1.2.1 step 6; 11.1.3.1 step 3
+ // Step 3.
if (!IntlInitialize(cx, obj, cx->names().InitializeNumberFormat, locales, options))
return false;
- // 11.1.2.1 steps 3.a and 7
args.rval().setObject(*obj);
return true;
}
@@ -1325,6 +1435,7 @@ js::intl_NumberFormat(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
MOZ_ASSERT(args.length() == 2);
+ MOZ_ASSERT(!args.isConstructing());
// intl_NumberFormat is an intrinsic for self-hosted JavaScript, so it
// cannot be used with "new", but it still has to be treated as a
// constructor.
@@ -1725,42 +1836,53 @@ static const JSFunctionSpec dateTimeFormat_methods[] = {
};
/**
- * DateTimeFormat constructor.
- * Spec: ECMAScript Internationalization API Specification, 12.1
+ * 12.2.1 Intl.DateTimeFormat([ locales [, options]])
+ *
+ * ES2017 Intl draft rev 94045d234762ad107a3d09bb6f7381a65f1a2f9b
*/
static bool
DateTimeFormat(JSContext* cx, const CallArgs& args, bool construct)
{
RootedObject obj(cx);
+ // We're following ECMA-402 1st Edition when DateTimeFormat is called
+ // because of backward compatibility issues.
+ // See https://github.com/tc39/ecma402/issues/57
if (!construct) {
- // 12.1.2.1 step 3
+ // ES Intl 1st ed., 12.1.2.1 step 3
JSObject* intl = cx->global()->getOrCreateIntlObject(cx);
if (!intl)
return false;
RootedValue self(cx, args.thisv());
if (!self.isUndefined() && (!self.isObject() || self.toObject() != *intl)) {
- // 12.1.2.1 step 4
+ // ES Intl 1st ed., 12.1.2.1 step 4
obj = ToObject(cx, self);
if (!obj)
return false;
- // 12.1.2.1 step 5
+ // ES Intl 1st ed., 12.1.2.1 step 5
bool extensible;
if (!IsExtensible(cx, obj, &extensible))
return false;
if (!extensible)
return Throw(cx, obj, JSMSG_OBJECT_NOT_EXTENSIBLE);
} else {
- // 12.1.2.1 step 3.a
+ // ES Intl 1st ed., 12.1.2.1 step 3.a
construct = true;
}
}
if (construct) {
- // 12.1.3.1 paragraph 2
- RootedObject proto(cx, cx->global()->getOrCreateDateTimeFormatPrototype(cx));
- if (!proto)
+ // Step 2 (Inlined 9.1.14, OrdinaryCreateFromConstructor).
+ RootedObject proto(cx);
+ if (args.isConstructing() && !GetPrototypeFromCallableConstructor(cx, args, &proto))
return false;
+
+ if (!proto) {
+ proto = cx->global()->getOrCreateDateTimeFormatPrototype(cx);
+ if (!proto)
+ return false;
+ }
+
obj = NewObjectWithGivenProto(cx, &DateTimeFormatClass, proto);
if (!obj)
return false;
@@ -1768,15 +1890,13 @@ DateTimeFormat(JSContext* cx, const CallArgs& args, bool construct)
obj->as<NativeObject>().setReservedSlot(UDATE_FORMAT_SLOT, PrivateValue(nullptr));
}
- // 12.1.2.1 steps 1 and 2; 12.1.3.1 steps 1 and 2
RootedValue locales(cx, args.length() > 0 ? args[0] : UndefinedValue());
RootedValue options(cx, args.length() > 1 ? args[1] : UndefinedValue());
- // 12.1.2.1 step 6; 12.1.3.1 step 3
+ // Step 3.
if (!IntlInitialize(cx, obj, cx->names().InitializeDateTimeFormat, locales, options))
return false;
- // 12.1.2.1 steps 3.a and 7
args.rval().setObject(*obj);
return true;
}
@@ -1793,6 +1913,7 @@ js::intl_DateTimeFormat(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
MOZ_ASSERT(args.length() == 2);
+ MOZ_ASSERT(!args.isConstructing());
// intl_DateTimeFormat is an intrinsic for self-hosted JavaScript, so it
// cannot be used with "new", but it still has to be treated as a
// constructor.
@@ -2891,6 +3012,296 @@ js::intl_GetCalendarInfo(JSContext* cx, unsigned argc, Value* vp)
return true;
}
+template<size_t N>
+inline bool
+MatchPart(const char** pattern, const char (&part)[N])
+{
+ if (strncmp(*pattern, part, N - 1))
+ return false;
+
+ *pattern += N - 1;
+ return true;
+}
+
+bool
+js::intl_ComputeDisplayNames(JSContext* cx, unsigned argc, Value* vp)
+{
+ CallArgs args = CallArgsFromVp(argc, vp);
+ MOZ_ASSERT(args.length() == 3);
+ // 1. Assert: locale is a string.
+ MOZ_ASSERT(args[0].isString());
+ // 2. Assert: style is a string.
+ MOZ_ASSERT(args[1].isString());
+ // 3. Assert: keys is an Array.
+ MOZ_ASSERT(args[2].isObject());
+
+ JSAutoByteString locale(cx, args[0].toString());
+ if (!locale)
+ return false;
+
+ JSAutoByteString style(cx, args[1].toString());
+ if (!style)
+ return false;
+
+ RootedArrayObject keys(cx, &args[2].toObject().as<ArrayObject>());
+ if (!keys)
+ return false;
+
+ // 4. Let result be ArrayCreate(0).
+ RootedArrayObject result(cx, NewDenseUnallocatedArray(cx, keys->length()));
+ if (!result)
+ return false;
+
+ UErrorCode status = U_ZERO_ERROR;
+
+ UDateFormat* fmt =
+ udat_open(UDAT_DEFAULT, UDAT_DEFAULT, icuLocale(locale.ptr()),
+ nullptr, 0, nullptr, 0, &status);
+ if (U_FAILURE(status)) {
+ JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
+ return false;
+ }
+ ScopedICUObject<UDateFormat, udat_close> datToClose(fmt);
+
+ // UDateTimePatternGenerator will be needed for translations of date and
+ // time fields like "month", "week", "day" etc.
+ UDateTimePatternGenerator* dtpg = udatpg_open(icuLocale(locale.ptr()), &status);
+ if (U_FAILURE(status)) {
+ JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
+ return false;
+ }
+ ScopedICUObject<UDateTimePatternGenerator, udatpg_close> datPgToClose(dtpg);
+
+ RootedValue keyValue(cx);
+ RootedString keyValStr(cx);
+ RootedValue wordVal(cx);
+ Vector<char16_t, INITIAL_CHAR_BUFFER_SIZE> chars(cx);
+ if (!chars.resize(INITIAL_CHAR_BUFFER_SIZE))
+ return false;
+
+ // 5. For each element of keys,
+ for (uint32_t i = 0; i < keys->length(); i++) {
+ /**
+ * We iterate over keys array looking for paths that we have code
+ * branches for.
+ *
+ * For any unknown path branch, the wordVal will keep NullValue and
+ * we'll throw at the end.
+ */
+
+ if (!GetElement(cx, keys, keys, i, &keyValue))
+ return false;
+
+ JSAutoByteString pattern;
+ keyValStr = keyValue.toString();
+ if (!pattern.encodeUtf8(cx, keyValStr))
+ return false;
+
+ wordVal.setNull();
+
+ // 5.a. Perform an implementation dependent algorithm to map a key to a
+ // corresponding display name.
+ const char* pat = pattern.ptr();
+
+ if (!MatchPart(&pat, "dates")) {
+ JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_INVALID_KEY, pattern.ptr());
+ return false;
+ }
+
+ if (!MatchPart(&pat, "/")) {
+ JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_INVALID_KEY, pattern.ptr());
+ return false;
+ }
+
+ if (MatchPart(&pat, "fields")) {
+ if (!MatchPart(&pat, "/")) {
+ JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_INVALID_KEY, pattern.ptr());
+ return false;
+ }
+
+ UDateTimePatternField fieldType;
+
+ if (MatchPart(&pat, "year")) {
+ fieldType = UDATPG_YEAR_FIELD;
+ } else if (MatchPart(&pat, "month")) {
+ fieldType = UDATPG_MONTH_FIELD;
+ } else if (MatchPart(&pat, "week")) {
+ fieldType = UDATPG_WEEK_OF_YEAR_FIELD;
+ } else if (MatchPart(&pat, "day")) {
+ fieldType = UDATPG_DAY_FIELD;
+ } else {
+ JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_INVALID_KEY, pattern.ptr());
+ return false;
+ }
+
+ // This part must be the final part with no trailing data.
+ if (*pat != '\0') {
+ JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_INVALID_KEY, pattern.ptr());
+ return false;
+ }
+
+ int32_t resultSize;
+
+ const UChar* value = udatpg_getAppendItemName(dtpg, fieldType, &resultSize);
+ if (U_FAILURE(status)) {
+ JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
+ return false;
+ }
+
+ JSString* word = NewStringCopyN<CanGC>(cx, UCharToChar16(value), resultSize);
+ if (!word)
+ return false;
+
+ wordVal.setString(word);
+ } else if (MatchPart(&pat, "gregorian")) {
+ if (!MatchPart(&pat, "/")) {
+ JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_INVALID_KEY, pattern.ptr());
+ return false;
+ }
+
+ UDateFormatSymbolType symbolType;
+ int32_t index;
+
+ if (MatchPart(&pat, "months")) {
+ if (!MatchPart(&pat, "/")) {
+ JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_INVALID_KEY, pattern.ptr());
+ return false;
+ }
+
+ if (equal(style, "narrow")) {
+ symbolType = UDAT_STANDALONE_NARROW_MONTHS;
+ } else if (equal(style, "short")) {
+ symbolType = UDAT_STANDALONE_SHORT_MONTHS;
+ } else {
+ MOZ_ASSERT(equal(style, "long"));
+ symbolType = UDAT_STANDALONE_MONTHS;
+ }
+
+ if (MatchPart(&pat, "january")) {
+ index = UCAL_JANUARY;
+ } else if (MatchPart(&pat, "february")) {
+ index = UCAL_FEBRUARY;
+ } else if (MatchPart(&pat, "march")) {
+ index = UCAL_MARCH;
+ } else if (MatchPart(&pat, "april")) {
+ index = UCAL_APRIL;
+ } else if (MatchPart(&pat, "may")) {
+ index = UCAL_MAY;
+ } else if (MatchPart(&pat, "june")) {
+ index = UCAL_JUNE;
+ } else if (MatchPart(&pat, "july")) {
+ index = UCAL_JULY;
+ } else if (MatchPart(&pat, "august")) {
+ index = UCAL_AUGUST;
+ } else if (MatchPart(&pat, "september")) {
+ index = UCAL_SEPTEMBER;
+ } else if (MatchPart(&pat, "october")) {
+ index = UCAL_OCTOBER;
+ } else if (MatchPart(&pat, "november")) {
+ index = UCAL_NOVEMBER;
+ } else if (MatchPart(&pat, "december")) {
+ index = UCAL_DECEMBER;
+ } else {
+ JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_INVALID_KEY, pattern.ptr());
+ return false;
+ }
+ } else if (MatchPart(&pat, "weekdays")) {
+ if (!MatchPart(&pat, "/")) {
+ JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_INVALID_KEY, pattern.ptr());
+ return false;
+ }
+
+ if (equal(style, "narrow")) {
+ symbolType = UDAT_STANDALONE_NARROW_WEEKDAYS;
+ } else if (equal(style, "short")) {
+ symbolType = UDAT_STANDALONE_SHORT_WEEKDAYS;
+ } else {
+ MOZ_ASSERT(equal(style, "long"));
+ symbolType = UDAT_STANDALONE_WEEKDAYS;
+ }
+
+ if (MatchPart(&pat, "monday")) {
+ index = UCAL_MONDAY;
+ } else if (MatchPart(&pat, "tuesday")) {
+ index = UCAL_TUESDAY;
+ } else if (MatchPart(&pat, "wednesday")) {
+ index = UCAL_WEDNESDAY;
+ } else if (MatchPart(&pat, "thursday")) {
+ index = UCAL_THURSDAY;
+ } else if (MatchPart(&pat, "friday")) {
+ index = UCAL_FRIDAY;
+ } else if (MatchPart(&pat, "saturday")) {
+ index = UCAL_SATURDAY;
+ } else if (MatchPart(&pat, "sunday")) {
+ index = UCAL_SUNDAY;
+ } else {
+ JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_INVALID_KEY, pattern.ptr());
+ return false;
+ }
+ } else if (MatchPart(&pat, "dayperiods")) {
+ if (!MatchPart(&pat, "/")) {
+ JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_INVALID_KEY, pattern.ptr());
+ return false;
+ }
+
+ symbolType = UDAT_AM_PMS;
+
+ if (MatchPart(&pat, "am")) {
+ index = UCAL_AM;
+ } else if (MatchPart(&pat, "pm")) {
+ index = UCAL_PM;
+ } else {
+ JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_INVALID_KEY, pattern.ptr());
+ return false;
+ }
+ } else {
+ JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_INVALID_KEY, pattern.ptr());
+ return false;
+ }
+
+ // This part must be the final part with no trailing data.
+ if (*pat != '\0') {
+ JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_INVALID_KEY, pattern.ptr());
+ return false;
+ }
+
+ int32_t resultSize =
+ udat_getSymbols(fmt, symbolType, index, Char16ToUChar(chars.begin()),
+ INITIAL_CHAR_BUFFER_SIZE, &status);
+ if (status == U_BUFFER_OVERFLOW_ERROR) {
+ if (!chars.resize(resultSize))
+ return false;
+ status = U_ZERO_ERROR;
+ udat_getSymbols(fmt, symbolType, index, Char16ToUChar(chars.begin()),
+ resultSize, &status);
+ }
+ if (U_FAILURE(status)) {
+ JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_INTERNAL_INTL_ERROR);
+ return false;
+ }
+
+ JSString* word = NewStringCopyN<CanGC>(cx, chars.begin(), resultSize);
+ if (!word)
+ return false;
+
+ wordVal.setString(word);
+ } else {
+ JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_INVALID_KEY, pattern.ptr());
+ return false;
+ }
+
+ MOZ_ASSERT(wordVal.isString());
+
+ // 5.b. Append the result string to result.
+ if (!DefineElement(cx, result, i, wordVal))
+ return false;
+ }
+
+ // 6. Return result.
+ args.rval().setObject(*result);
+ return true;
+}
+
/******************** Intl ********************/
const Class js::IntlClass = {
diff --git a/js/src/builtin/Intl.h b/js/src/builtin/Intl.h
index 54764605bc..b2197060d6 100644
--- a/js/src/builtin/Intl.h
+++ b/js/src/builtin/Intl.h
@@ -387,6 +387,48 @@ intl_FormatDateTime(JSContext* cx, unsigned argc, Value* vp);
extern MOZ_MUST_USE bool
intl_GetCalendarInfo(JSContext* cx, unsigned argc, Value* vp);
+/**
+ * Returns an Array with CLDR-based fields display names.
+ * The function takes three arguments:
+ *
+ * locale
+ * BCP47 compliant locale string
+ * style
+ * A string with values: long or short or narrow
+ * keys
+ * An array or path-like strings that identify keys to be returned
+ * At the moment the following types of keys are supported:
+ *
+ * 'dates/fields/{year|month|week|day}'
+ * 'dates/gregorian/months/{january|...|december}'
+ * 'dates/gregorian/weekdays/{sunday|...|saturday}'
+ * 'dates/gregorian/dayperiods/{am|pm}'
+ *
+ * Example:
+ *
+ * let info = intl_ComputeDisplayNames(
+ * 'en-US',
+ * 'long',
+ * [
+ * 'dates/fields/year',
+ * 'dates/gregorian/months/january',
+ * 'dates/gregorian/weekdays/monday',
+ * 'dates/gregorian/dayperiods/am',
+ * ]
+ * );
+ *
+ * Returned value:
+ *
+ * [
+ * 'year',
+ * 'January',
+ * 'Monday',
+ * 'AM'
+ * ]
+ */
+extern MOZ_MUST_USE bool
+intl_ComputeDisplayNames(JSContext* cx, unsigned argc, Value* vp);
+
#if ENABLE_INTL_API
/**
* Cast char16_t* strings to UChar* strings used by ICU.
@@ -402,6 +444,18 @@ Char16ToUChar(char16_t* chars)
{
return reinterpret_cast<UChar*>(chars);
}
+
+inline char16_t*
+UCharToChar16(UChar* chars)
+{
+ return reinterpret_cast<char16_t*>(chars);
+}
+
+inline const char16_t*
+UCharToChar16(const UChar* chars)
+{
+ return reinterpret_cast<const char16_t*>(chars);
+}
#endif // ENABLE_INTL_API
} // namespace js
diff --git a/js/src/builtin/Intl.js b/js/src/builtin/Intl.js
index 37c87365b3..509168d7a0 100644
--- a/js/src/builtin/Intl.js
+++ b/js/src/builtin/Intl.js
@@ -9,8 +9,7 @@
JSMSG_INVALID_OPTION_VALUE: false, JSMSG_INVALID_DIGITS_VALUE: false,
JSMSG_INTL_OBJECT_REINITED: false, JSMSG_INVALID_CURRENCY_CODE: false,
JSMSG_UNDEFINED_CURRENCY: false, JSMSG_INVALID_TIME_ZONE: false,
- JSMSG_DATE_NOT_FINITE: false, JSMSG_INVALID_KEYS_TYPE: false,
- JSMSG_INVALID_KEY: false,
+ JSMSG_DATE_NOT_FINITE: false,
intl_Collator_availableLocales: false,
intl_availableCollations: false,
intl_CompareStrings: false,
@@ -21,9 +20,6 @@
intl_availableCalendars: false,
intl_patternForSkeleton: false,
intl_FormatDateTime: false,
- intl_SelectPluralRule: false,
- intl_GetPluralCategories: false,
- intl_GetCalendarInfo: false,
*/
/*
@@ -860,7 +856,6 @@ function BestAvailableLocaleIgnoringDefault(availableLocales, locale) {
return BestAvailableLocaleHelper(availableLocales, locale, false);
}
-var noRelevantExtensionKeys = [];
/**
* Compares a BCP 47 language priority list against the set of locales in
@@ -1188,10 +1183,9 @@ function GetOption(options, property, type, values, fallback) {
* Spec: ECMAScript Internationalization API Specification, 9.2.10.
*/
function GetNumberOption(options, property, minimum, maximum, fallback) {
- assert(typeof minimum === "number" && (minimum | 0) === minimum, "GetNumberOption");
- assert(typeof maximum === "number" && (maximum | 0) === maximum, "GetNumberOption");
- assert(typeof fallback === "number" && (fallback | 0) === fallback, "GetNumberOption");
- assert(minimum <= fallback && fallback <= maximum, "GetNumberOption");
+ assert(typeof minimum === "number", "GetNumberOption");
+ assert(typeof maximum === "number", "GetNumberOption");
+ assert(fallback === undefined || (fallback >= minimum && fallback <= maximum), "GetNumberOption");
// Step 1.
var value = options[property];
@@ -1201,10 +1195,7 @@ function GetNumberOption(options, property, minimum, maximum, fallback) {
value = ToNumber(value);
if (Number_isNaN(value) || value < minimum || value > maximum)
ThrowRangeError(JSMSG_INVALID_DIGITS_VALUE, value);
-
- // Apply bitwise-or to convert -0 to +0 per ES2017, 5.2 and to ensure
- // the result is an int32 value.
- return std_Math_floor(value) | 0;
+ return std_Math_floor(value);
}
// Step 3.
@@ -1278,9 +1269,7 @@ function initializeIntlObject(obj) {
function setLazyData(internals, type, lazyData)
{
assert(internals.type === "partial", "can't set lazy data for anything but a newborn");
- assert(type === "Collator" || type === "DateTimeFormat" ||
- type == "NumberFormat" || type === "PluralRules",
- "bad type");
+ assert(type === "Collator" || type === "DateTimeFormat" || type == "NumberFormat", "bad type");
assert(IsObject(lazyData), "non-object lazy data");
// Set in reverse order so that the .type change is a barrier.
@@ -1330,9 +1319,7 @@ function isInitializedIntlObject(obj) {
if (IsObject(internals)) {
assert(callFunction(std_Object_hasOwnProperty, internals, "type"), "missing type");
var type = internals.type;
- assert(type === "partial" || type === "Collator" ||
- type === "DateTimeFormat" || type === "NumberFormat" || type === "PluralRules",
- "unexpected type");
+ assert(type === "partial" || type === "Collator" || type === "DateTimeFormat" || type === "NumberFormat", "unexpected type");
assert(callFunction(std_Object_hasOwnProperty, internals, "lazyData"), "missing lazyData");
assert(callFunction(std_Object_hasOwnProperty, internals, "internalProps"), "missing internalProps");
} else {
@@ -1389,8 +1376,6 @@ function getInternals(obj)
internalProps = resolveCollatorInternals(lazyData)
else if (type === "DateTimeFormat")
internalProps = resolveDateTimeFormatInternals(lazyData)
- else if (type === "PluralRules")
- internalProps = resolvePluralRulesInternals(lazyData)
else
internalProps = resolveNumberFormatInternals(lazyData);
setInternalProperties(internals, internalProps);
@@ -1722,7 +1707,6 @@ function Intl_Collator_compare_get() {
// Step 2.
return internals.boundCompare;
}
-_SetCanonicalName(Intl_Collator_compare_get, "get compare");
/**
@@ -1791,37 +1775,45 @@ function resolveNumberFormatInternals(lazyNumberFormatData) {
// Step 6.
var opt = lazyNumberFormatData.opt;
+ // Compute effective locale.
+ // Step 9.
var NumberFormat = numberFormatInternalProperties;
- // Step 9.
+ // Step 10.
var localeData = NumberFormat.localeData;
- // Step 10.
+ // Step 11.
var r = ResolveLocale(callFunction(NumberFormat.availableLocales, NumberFormat),
lazyNumberFormatData.requestedLocales,
lazyNumberFormatData.opt,
NumberFormat.relevantExtensionKeys,
localeData);
- // Steps 11-12. (Step 13 is not relevant to our implementation.)
+ // Steps 12-13. (Step 14 is not relevant to our implementation.)
internalProps.locale = r.locale;
internalProps.numberingSystem = r.nu;
// Compute formatting options.
- // Step 15.
- var style = lazyNumberFormatData.style;
- internalProps.style = style;
+ // Step 16.
+ var s = lazyNumberFormatData.style;
+ internalProps.style = s;
- // Steps 19, 21.
- if (style === "currency") {
+ // Steps 20, 22.
+ if (s === "currency") {
internalProps.currency = lazyNumberFormatData.currency;
internalProps.currencyDisplay = lazyNumberFormatData.currencyDisplay;
}
+ // Step 24.
internalProps.minimumIntegerDigits = lazyNumberFormatData.minimumIntegerDigits;
+
+ // Steps 27.
internalProps.minimumFractionDigits = lazyNumberFormatData.minimumFractionDigits;
+
+ // Step 30.
internalProps.maximumFractionDigits = lazyNumberFormatData.maximumFractionDigits;
+ // Step 33.
if ("minimumSignificantDigits" in lazyNumberFormatData) {
// Note: Intl.NumberFormat.prototype.resolvedOptions() exposes the
// actual presence (versus undefined-ness) of these properties.
@@ -1830,10 +1822,10 @@ function resolveNumberFormatInternals(lazyNumberFormatData) {
internalProps.maximumSignificantDigits = lazyNumberFormatData.maximumSignificantDigits;
}
- // Step 27.
+ // Step 35.
internalProps.useGrouping = lazyNumberFormatData.useGrouping;
- // Step 34.
+ // Step 42.
internalProps.boundFormat = undefined;
// The caller is responsible for associating |internalProps| with the right
@@ -1861,44 +1853,6 @@ function getNumberFormatInternals(obj, methodName) {
return internalProps;
}
-/**
- * Applies digit options used for number formatting onto the intl object.
- *
- * Spec: ECMAScript Internationalization API Specification, 11.1.1.
- */
-function SetNumberFormatDigitOptions(lazyData, options, mnfdDefault, mxfdDefault) {
- // We skip Step 1 because we set the properties on a lazyData object.
-
- // Step 2-3.
- assert(IsObject(options), "SetNumberFormatDigitOptions");
- assert(typeof mnfdDefault === "number", "SetNumberFormatDigitOptions");
- assert(typeof mxfdDefault === "number", "SetNumberFormatDigitOptions");
- assert(mnfdDefault <= mxfdDefault, "SetNumberFormatDigitOptions");
-
- // Steps 4-6.
- const mnid = GetNumberOption(options, "minimumIntegerDigits", 1, 21, 1);
- const mnfd = GetNumberOption(options, "minimumFractionDigits", 0, 20, mnfdDefault);
- const mxfdActualDefault = std_Math_max(mnfd, mxfdDefault);
- const mxfd = GetNumberOption(options, "maximumFractionDigits", mnfd, 20, mxfdActualDefault);
-
- // Steps 7-8.
- let mnsd = options.minimumSignificantDigits;
- let mxsd = options.maximumSignificantDigits;
-
- // Steps 9-11.
- lazyData.minimumIntegerDigits = mnid;
- lazyData.minimumFractionDigits = mnfd;
- lazyData.maximumFractionDigits = mxfd;
-
- // Step 12.
- if (mnsd !== undefined || mxsd !== undefined) {
- mnsd = GetNumberOption(options, "minimumSignificantDigits", 1, 21, 1);
- mxsd = GetNumberOption(options, "maximumSignificantDigits", mnsd, 21, 21);
- lazyData.minimumSignificantDigits = mnsd;
- lazyData.maximumSignificantDigits = mxsd;
- }
-}
-
/**
* Initializes an object as a NumberFormat.
@@ -1948,7 +1902,7 @@ function InitializeNumberFormat(numberFormat, locales, options) {
// }
//
// Note that lazy data is only installed as a final step of initialization,
- // so every NumberFormat lazy data object has *all* these properties, never a
+ // so every Collator lazy data object has *all* these properties, never a
// subset of them.
var lazyNumberFormatData = std_Object_create(null);
@@ -1978,46 +1932,67 @@ function InitializeNumberFormat(numberFormat, locales, options) {
opt.localeMatcher = matcher;
// Compute formatting options.
- // Step 14.
- var style = GetOption(options, "style", "string", ["decimal", "percent", "currency"], "decimal");
- lazyNumberFormatData.style = style;
+ // Step 15.
+ var s = GetOption(options, "style", "string", ["decimal", "percent", "currency"], "decimal");
+ lazyNumberFormatData.style = s;
- // Steps 16-19.
+ // Steps 17-20.
var c = GetOption(options, "currency", "string", undefined, undefined);
if (c !== undefined && !IsWellFormedCurrencyCode(c))
ThrowRangeError(JSMSG_INVALID_CURRENCY_CODE, c);
var cDigits;
- if (style === "currency") {
+ if (s === "currency") {
if (c === undefined)
ThrowTypeError(JSMSG_UNDEFINED_CURRENCY);
- // Steps 19.a-c.
+ // Steps 20.a-c.
c = toASCIIUpperCase(c);
lazyNumberFormatData.currency = c;
cDigits = CurrencyDigits(c);
}
- // Step 20.
+ // Step 21.
var cd = GetOption(options, "currencyDisplay", "string", ["code", "symbol", "name"], "symbol");
- if (style === "currency")
+ if (s === "currency")
lazyNumberFormatData.currencyDisplay = cd;
- // Steps 22-25.
- var mnfdDefault, mxfdDefault;
- if (style === "currency") {
- mnfdDefault = cDigits;
- mxfdDefault = cDigits;
- } else {
- mnfdDefault = 0;
- mxfdDefault = style === "percent" ? 0 : 3;
+ // Step 23.
+ var mnid = GetNumberOption(options, "minimumIntegerDigits", 1, 21, 1);
+ lazyNumberFormatData.minimumIntegerDigits = mnid;
+
+ // Steps 25-26.
+ var mnfdDefault = (s === "currency") ? cDigits : 0;
+ var mnfd = GetNumberOption(options, "minimumFractionDigits", 0, 20, mnfdDefault);
+ lazyNumberFormatData.minimumFractionDigits = mnfd;
+
+ // Steps 28-29.
+ var mxfdDefault;
+ if (s === "currency")
+ mxfdDefault = std_Math_max(mnfd, cDigits);
+ else if (s === "percent")
+ mxfdDefault = std_Math_max(mnfd, 0);
+ else
+ mxfdDefault = std_Math_max(mnfd, 3);
+ var mxfd = GetNumberOption(options, "maximumFractionDigits", mnfd, 20, mxfdDefault);
+ lazyNumberFormatData.maximumFractionDigits = mxfd;
+
+ // Steps 31-32.
+ var mnsd = options.minimumSignificantDigits;
+ var mxsd = options.maximumSignificantDigits;
+
+ // Step 33.
+ if (mnsd !== undefined || mxsd !== undefined) {
+ mnsd = GetNumberOption(options, "minimumSignificantDigits", 1, 21, 1);
+ mxsd = GetNumberOption(options, "maximumSignificantDigits", mnsd, 21, 21);
+ lazyNumberFormatData.minimumSignificantDigits = mnsd;
+ lazyNumberFormatData.maximumSignificantDigits = mxsd;
}
- SetNumberFormatDigitOptions(lazyNumberFormatData, options, mnfdDefault, mxfdDefault);
- // Steps 26.
+ // Step 34.
var g = GetOption(options, "useGrouping", "boolean", undefined, true);
lazyNumberFormatData.useGrouping = g;
- // Steps 35-36.
+ // Step 43.
//
// We've done everything that must be done now: mark the lazy data as fully
// computed and install it.
@@ -2026,6 +2001,43 @@ function InitializeNumberFormat(numberFormat, locales, options) {
/**
+ * Mapping from currency codes to the number of decimal digits used for them.
+ * Default is 2 digits.
+ *
+ * Spec: ISO 4217 Currency and Funds Code List.
+ * http://www.currency-iso.org/en/home/tables/table-a1.html
+ */
+var currencyDigits = {
+ BHD: 3,
+ BIF: 0,
+ BYR: 0,
+ CLF: 4,
+ CLP: 0,
+ DJF: 0,
+ GNF: 0,
+ IQD: 3,
+ ISK: 0,
+ JOD: 3,
+ JPY: 0,
+ KMF: 0,
+ KRW: 0,
+ KWD: 3,
+ LYD: 3,
+ OMR: 3,
+ PYG: 0,
+ RWF: 0,
+ TND: 3,
+ UGX: 0,
+ UYI: 0,
+ VND: 0,
+ VUV: 0,
+ XAF: 0,
+ XOF: 0,
+ XPF: 0
+};
+
+
+/**
* Returns the number of decimal digits to be used for the given currency.
*
* Spec: ECMAScript Internationalization API Specification, 11.1.1.
@@ -2106,7 +2118,7 @@ function numberFormatFormatToBind(value) {
// Step 1.a.ii-iii.
var x = ToNumber(value);
- return intl_FormatNumber(this, x, /* formatToParts = */ false);
+ return intl_FormatNumber(this, x);
}
@@ -2133,22 +2145,6 @@ function Intl_NumberFormat_format_get() {
// Step 2.
return internals.boundFormat;
}
-_SetCanonicalName(Intl_NumberFormat_format_get, "get format");
-
-
-function Intl_NumberFormat_formatToParts(value) {
- // Step 1.
- var nf = this;
-
- // Steps 2-3.
- getNumberFormatInternals(nf, "formatToParts");
-
- // Step 4.
- var x = ToNumber(value);
-
- // Step 5.
- return intl_FormatNumber(nf, x, /* formatToParts = */ true);
-}
/**
@@ -2290,6 +2286,26 @@ function getDateTimeFormatInternals(obj, methodName) {
return internalProps;
}
+/**
+ * Components of date and time formats and their values.
+ *
+ * Spec: ECMAScript Internationalization API Specification, 12.1.1.
+ */
+var dateTimeComponentValues = {
+ weekday: ["narrow", "short", "long"],
+ era: ["narrow", "short", "long"],
+ year: ["2-digit", "numeric"],
+ month: ["2-digit", "numeric", "narrow", "short", "long"],
+ day: ["2-digit", "numeric"],
+ hour: ["2-digit", "numeric"],
+ minute: ["2-digit", "numeric"],
+ second: ["2-digit", "numeric"],
+ timeZoneName: ["short", "long"]
+};
+
+
+var dateTimeComponents = std_Object_getOwnPropertyNames(dateTimeComponentValues);
+
/**
* Initializes an object as a DateTimeFormat.
@@ -2379,19 +2395,12 @@ function InitializeDateTimeFormat(dateTimeFormat, locales, options) {
lazyDateTimeFormatData.formatOpt = formatOpt;
// Step 19.
- // 12.1, Table 4: Components of date and time formats.
- formatOpt.weekday = GetOption(options, "weekday", "string", ["narrow", "short", "long"],
- undefined);
- formatOpt.era = GetOption(options, "era", "string", ["narrow", "short", "long"], undefined);
- formatOpt.year = GetOption(options, "year", "string", ["2-digit", "numeric"], undefined);
- formatOpt.month = GetOption(options, "month", "string",
- ["2-digit", "numeric", "narrow", "short", "long"], undefined);
- formatOpt.day = GetOption(options, "day", "string", ["2-digit", "numeric"], undefined);
- formatOpt.hour = GetOption(options, "hour", "string", ["2-digit", "numeric"], undefined);
- formatOpt.minute = GetOption(options, "minute", "string", ["2-digit", "numeric"], undefined);
- formatOpt.second = GetOption(options, "second", "string", ["2-digit", "numeric"], undefined);
- formatOpt.timeZoneName = GetOption(options, "timeZoneName", "string", ["short", "long"],
- undefined);
+ var i, prop;
+ for (i = 0; i < dateTimeComponents.length; i++) {
+ prop = dateTimeComponents[i];
+ var value = GetOption(options, prop, "string", dateTimeComponentValues[prop], undefined);
+ formatOpt[prop] = value;
+ }
// Steps 20-21 provided by ICU - see comment after this function.
@@ -2659,6 +2668,7 @@ function ToDateTimeOptions(options, required, defaults) {
return options;
}
+
/**
* Compares the date and time components requested by options with the available
* date and time formats in formats, and selects the best match according
@@ -2844,7 +2854,6 @@ function Intl_DateTimeFormat_format_get() {
// Step 2.
return internals.boundFormat;
}
-_SetCanonicalName(Intl_DateTimeFormat_format_get, "get format");
function Intl_DateTimeFormat_formatToParts() {
@@ -2980,232 +2989,6 @@ function resolveICUPattern(pattern, result) {
}
}
-/********** Intl.PluralRules **********/
-
-/**
- * PluralRules internal properties.
- *
- * Spec: ECMAScript 402 API, PluralRules, 1.3.3.
- */
-var pluralRulesInternalProperties = {
- _availableLocales: null,
- availableLocales: function()
- {
- var locales = this._availableLocales;
- if (locales)
- return locales;
-
- locales = intl_PluralRules_availableLocales();
- addSpecialMissingLanguageTags(locales);
- return (this._availableLocales = locales);
- }
-};
-
-/**
- * Compute an internal properties object from |lazyPluralRulesData|.
- */
-function resolvePluralRulesInternals(lazyPluralRulesData) {
- assert(IsObject(lazyPluralRulesData), "lazy data not an object?");
-
- var internalProps = std_Object_create(null);
-
- var requestedLocales = lazyPluralRulesData.requestedLocales;
-
- var PluralRules = pluralRulesInternalProperties;
-
- // Step 13.
- const r = ResolveLocale(callFunction(PluralRules.availableLocales, PluralRules),
- lazyPluralRulesData.requestedLocales,
- lazyPluralRulesData.opt,
- noRelevantExtensionKeys, undefined);
-
- // Step 14.
- internalProps.locale = r.locale;
- internalProps.type = lazyPluralRulesData.type;
-
- internalProps.pluralCategories = intl_GetPluralCategories(
- internalProps.locale,
- internalProps.type);
-
- internalProps.minimumIntegerDigits = lazyPluralRulesData.minimumIntegerDigits;
- internalProps.minimumFractionDigits = lazyPluralRulesData.minimumFractionDigits;
- internalProps.maximumFractionDigits = lazyPluralRulesData.maximumFractionDigits;
-
- if ("minimumSignificantDigits" in lazyPluralRulesData) {
- assert("maximumSignificantDigits" in lazyPluralRulesData, "min/max sig digits mismatch");
- internalProps.minimumSignificantDigits = lazyPluralRulesData.minimumSignificantDigits;
- internalProps.maximumSignificantDigits = lazyPluralRulesData.maximumSignificantDigits;
- }
-
- return internalProps;
-}
-
-/**
- * Returns an object containing the PluralRules internal properties of |obj|,
- * or throws a TypeError if |obj| isn't PluralRules-initialized.
- */
-function getPluralRulesInternals(obj, methodName) {
- var internals = getIntlObjectInternals(obj, "PluralRules", methodName);
- assert(internals.type === "PluralRules", "bad type escaped getIntlObjectInternals");
-
- var internalProps = maybeInternalProperties(internals);
- if (internalProps)
- return internalProps;
-
- internalProps = resolvePluralRulesInternals(internals.lazyData);
- setInternalProperties(internals, internalProps);
- return internalProps;
-}
-
-/**
- * Initializes an object as a PluralRules.
- *
- * This method is complicated a moderate bit by its implementing initialization
- * as a *lazy* concept. Everything that must happen now, does -- but we defer
- * all the work we can until the object is actually used as a PluralRules.
- * This later work occurs in |resolvePluralRulesInternals|; steps not noted
- * here occur there.
- *
- * Spec: ECMAScript 402 API, PluralRules, 1.1.1.
- */
-function InitializePluralRules(pluralRules, locales, options) {
- assert(IsObject(pluralRules), "InitializePluralRules");
-
- // Step 1.
- if (isInitializedIntlObject(pluralRules))
- ThrowTypeError(JSMSG_INTL_OBJECT_REINITED);
-
- let internals = initializeIntlObject(pluralRules);
-
- // Lazy PluralRules data has the following structure:
- //
- // {
- // requestedLocales: List of locales,
- // type: "cardinal" / "ordinal",
- //
- // opt: // opt object computer in InitializePluralRules
- // {
- // localeMatcher: "lookup" / "best fit",
- // }
- //
- // minimumIntegerDigits: integer ∈ [1, 21],
- // minimumFractionDigits: integer ∈ [0, 20],
- // maximumFractionDigits: integer ∈ [0, 20],
- //
- // // optional
- // minimumSignificantDigits: integer ∈ [1, 21],
- // maximumSignificantDigits: integer ∈ [1, 21],
- // }
- //
- // Note that lazy data is only installed as a final step of initialization,
- // so every PluralRules lazy data object has *all* these properties, never a
- // subset of them.
- const lazyPluralRulesData = std_Object_create(null);
-
- // Step 3.
- let requestedLocales = CanonicalizeLocaleList(locales);
- lazyPluralRulesData.requestedLocales = requestedLocales;
-
- // Steps 4-5.
- if (options === undefined)
- options = {};
- else
- options = ToObject(options);
-
- // Step 6.
- const type = GetOption(options, "type", "string", ["cardinal", "ordinal"], "cardinal");
- lazyPluralRulesData.type = type;
-
- // Step 8.
- let opt = new Record();
- lazyPluralRulesData.opt = opt;
-
- // Steps 9-10.
- let matcher = GetOption(options, "localeMatcher", "string", ["lookup", "best fit"], "best fit");
- opt.localeMatcher = matcher;
-
- // Steps 11-12.
- SetNumberFormatDigitOptions(lazyPluralRulesData, options, 0, 3);
-
- setLazyData(internals, "PluralRules", lazyPluralRulesData)
-}
-
-/**
- * Returns the subset of the given locale list for which this locale list has a
- * matching (possibly fallback) locale. Locales appear in the same order in the
- * returned list as in the input list.
- *
- * Spec: ECMAScript 402 API, PluralRules, 1.3.2.
- */
-function Intl_PluralRules_supportedLocalesOf(locales /*, options*/) {
- var options = arguments.length > 1 ? arguments[1] : undefined;
-
- // Step 1.
- var availableLocales = callFunction(pluralRulesInternalProperties.availableLocales,
- pluralRulesInternalProperties);
- // Step 2.
- let requestedLocales = CanonicalizeLocaleList(locales);
-
- // Step 3.
- return SupportedLocales(availableLocales, requestedLocales, options);
-}
-
-/**
- * Returns a String value representing the plural category matching
- * the number passed as value according to the
- * effective locale and the formatting options of this PluralRules.
- *
- * Spec: ECMAScript 402 API, PluralRules, 1.4.3.
- */
-function Intl_PluralRules_select(value) {
- // Step 1.
- let pluralRules = this;
- // Step 2.
- let internals = getPluralRulesInternals(pluralRules, "select");
-
- // Steps 3-4.
- let n = ToNumber(value);
-
- // Step 5.
- return intl_SelectPluralRule(pluralRules, n);
-}
-
-/**
- * Returns the resolved options for a PluralRules object.
- *
- * Spec: ECMAScript 402 API, PluralRules, 1.4.4.
- */
-function Intl_PluralRules_resolvedOptions() {
- var internals = getPluralRulesInternals(this, "resolvedOptions");
-
- var internalsPluralCategories = internals.pluralCategories;
- var pluralCategories = [];
- for (var i = 0; i < internalsPluralCategories.length; i++)
- _DefineDataProperty(pluralCategories, i, internalsPluralCategories[i]);
-
- var result = {
- locale: internals.locale,
- type: internals.type,
- pluralCategories,
- minimumIntegerDigits: internals.minimumIntegerDigits,
- minimumFractionDigits: internals.minimumFractionDigits,
- maximumFractionDigits: internals.maximumFractionDigits,
- };
-
- var optionalProperties = [
- "minimumSignificantDigits",
- "maximumSignificantDigits"
- ];
-
- for (var i = 0; i < optionalProperties.length; i++) {
- var p = optionalProperties[i];
- if (callFunction(std_Object_hasOwnProperty, internals, p))
- _DefineDataProperty(result, p, internals[p]);
- }
- return result;
-}
-
-
function Intl_getCanonicalLocales(locales) {
let codes = CanonicalizeLocaleList(locales);
let result = [];
@@ -3241,126 +3024,3 @@ function Intl_getCalendarInfo(locales) {
return result;
}
-
-/**
- * This function is a custom method designed after Intl API, but currently
- * not part of the spec or spec proposal.
- * We want to use it internally to retrieve translated values from CLDR in
- * order to ensure they're aligned with what Intl API returns.
- *
- * This API may one day be a foundation for an ECMA402 API spec proposal.
- *
- * The function takes two arguments - locales which is a list of locale strings
- * and options which is an object with two optional properties:
- *
- * keys:
- * an Array of string values that are paths to individual terms
- *
- * style:
- * a String with a value "long", "short" or "narrow"
- *
- * It returns an object with properties:
- *
- * locale:
- * a negotiated locale string
- *
- * style:
- * negotiated style
- *
- * values:
- * A key-value pair list of requested keys and corresponding
- * translated values
- *
- */
-function Intl_getDisplayNames(locales, options) {
- // 1. Let requestLocales be ? CanonicalizeLocaleList(locales).
- const requestedLocales = CanonicalizeLocaleList(locales);
-
- // 2. If options is undefined, then
- if (options === undefined)
- // a. Let options be ObjectCreate(%ObjectPrototype%).
- options = {};
- // 3. Else,
- else
- // a. Let options be ? ToObject(options).
- options = ToObject(options);
-
- const DateTimeFormat = dateTimeFormatInternalProperties;
-
- // 4. Let localeData be %DateTimeFormat%.[[localeData]].
- const localeData = DateTimeFormat.localeData;
-
- // 5. Let opt be a new Record.
- const localeOpt = new Record();
- // 6. Set localeOpt.[[localeMatcher]] to "best fit".
- localeOpt.localeMatcher = "best fit";
-
- // 7. Let r be ResolveLocale(%DateTimeFormat%.[[availableLocales]], requestedLocales, localeOpt,
- // %DateTimeFormat%.[[relevantExtensionKeys]], localeData).
- const r = ResolveLocale(callFunction(DateTimeFormat.availableLocales, DateTimeFormat),
- requestedLocales,
- localeOpt,
- DateTimeFormat.relevantExtensionKeys,
- localeData);
-
- // 8. Let style be ? GetOption(options, "style", "string", « "long", "short", "narrow" », "long").
- const style = GetOption(options, "style", "string", ["long", "short", "narrow"], "long");
- // 9. Let keys be ? Get(options, "keys").
- let keys = options.keys;
-
- // 10. If keys is undefined,
- if (keys === undefined) {
- // a. Let keys be ArrayCreate(0).
- keys = [];
- } else if (!IsObject(keys)) {
- // 11. Else,
- // a. If Type(keys) is not Object, throw a TypeError exception.
- ThrowTypeError(JSMSG_INVALID_KEYS_TYPE);
- }
-
- // 12. Let processedKeys be ArrayCreate(0).
- // (This really should be a List, but we use an Array here in order that
- // |intl_ComputeDisplayNames| may infallibly access the list's length via
- // |ArrayObject::length|.)
- let processedKeys = [];
- // 13. Let len be ? ToLength(? Get(keys, "length")).
- let len = ToLength(keys.length);
- // 14. Let i be 0.
- // 15. Repeat, while i < len
- for (let i = 0; i < len; i++) {
- // a. Let processedKey be ? ToString(? Get(keys, i)).
- // b. Perform ? CreateDataPropertyOrThrow(processedKeys, i, processedKey).
- callFunction(std_Array_push, processedKeys, ToString(keys[i]));
- }
-
- // 16. Let names be ? ComputeDisplayNames(r.[[locale]], style, processedKeys).
- const names = intl_ComputeDisplayNames(r.locale, style, processedKeys);
-
- // 17. Let values be ObjectCreate(%ObjectPrototype%).
- const values = {};
-
- // 18. Set i to 0.
- // 19. Repeat, while i < len
- for (let i = 0; i < len; i++) {
- // a. Let key be ? Get(processedKeys, i).
- const key = processedKeys[i];
- // b. Let name be ? Get(names, i).
- const name = names[i];
- // c. Assert: Type(name) is string.
- assert(typeof name === "string", "unexpected non-string value");
- // d. Assert: the length of name is greater than zero.
- assert(name.length > 0, "empty string value");
- // e. Perform ? DefinePropertyOrThrow(values, key, name).
- _DefineDataProperty(values, key, name);
- }
-
- // 20. Let options be ObjectCreate(%ObjectPrototype%).
- // 21. Perform ! DefinePropertyOrThrow(result, "locale", r.[[locale]]).
- // 22. Perform ! DefinePropertyOrThrow(result, "style", style).
- // 23. Perform ! DefinePropertyOrThrow(result, "values", values).
- const result = { locale: r.locale, style, values };
-
- // 24. Return result.
- return result;
-}
-
diff --git a/js/src/builtin/IntlTimeZoneData.h b/js/src/builtin/IntlTimeZoneData.h
index bb7d22109f..3d5c1b0d5b 100644
--- a/js/src/builtin/IntlTimeZoneData.h
+++ b/js/src/builtin/IntlTimeZoneData.h
@@ -1,5 +1,5 @@
// Generated by make_intl_data.py. DO NOT EDIT.
-// tzdata version = 2017c
+// tzdata version = 2018d
#ifndef builtin_IntlTimeZoneData_h
#define builtin_IntlTimeZoneData_h
diff --git a/js/src/builtin/Map.js b/js/src/builtin/Map.js
index 432364614b..580629a132 100644
--- a/js/src/builtin/Map.js
+++ b/js/src/builtin/Map.js
@@ -14,31 +14,8 @@ function MapConstructorInit(iterable) {
if (!IsCallable(adder))
ThrowTypeError(JSMSG_NOT_FUNCTION, typeof adder);
- // Step 6.c.
- var iterFn = iterable[std_iterator];
- if (!IsCallable(iterFn))
- ThrowTypeError(JSMSG_NOT_ITERABLE, DecompileArg(0, iterable));
-
- var iter = callContentFunction(iterFn, iterable);
- if (!IsObject(iter))
- ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT, typeof iter);
-
- // Step 7 (not applicable).
-
- // Step 8.
- while (true) {
- // Step 8.a.
- var next = callContentFunction(iter.next, iter);
- if (!IsObject(next))
- ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT, typeof next);
-
- // Step 8.b.
- if (next.done)
- return;
-
- // Step 8.c.
- var nextItem = next.value;
-
+ // Steps 6.c-8.
+ for (var nextItem of allowContentIter(iterable)) {
// Step 8.d.
if (!IsObject(nextItem))
ThrowTypeError(JSMSG_INVALID_MAP_ITERABLE, "Map");
diff --git a/js/src/builtin/ModuleObject.cpp b/js/src/builtin/ModuleObject.cpp
index 3bfc8f60b1..710c7a76cb 100644
--- a/js/src/builtin/ModuleObject.cpp
+++ b/js/src/builtin/ModuleObject.cpp
@@ -1159,7 +1159,7 @@ bool
ModuleBuilder::processExport(frontend::ParseNode* pn)
{
MOZ_ASSERT(pn->isKind(PNK_EXPORT) || pn->isKind(PNK_EXPORT_DEFAULT));
- MOZ_ASSERT(pn->getArity() == pn->isKind(PNK_EXPORT) ? PN_UNARY : PN_BINARY);
+ MOZ_ASSERT(pn->getArity() == (pn->isKind(PNK_EXPORT) ? PN_UNARY : PN_BINARY));
bool isDefault = pn->getKind() == PNK_EXPORT_DEFAULT;
ParseNode* kid = isDefault ? pn->pn_left : pn->pn_kid;
@@ -1205,7 +1205,7 @@ ModuleBuilder::processExport(frontend::ParseNode* pn)
case PNK_FUNCTION: {
RootedFunction func(cx_, kid->pn_funbox->function());
if (!func->isArrow()) {
- RootedAtom localName(cx_, func->name());
+ RootedAtom localName(cx_, func->explicitName());
RootedAtom exportName(cx_, isDefault ? cx_->names().default_ : localName.get());
MOZ_ASSERT_IF(isDefault, localName);
if (!appendExportEntry(exportName, localName))
diff --git a/js/src/builtin/Promise.cpp b/js/src/builtin/Promise.cpp
index 59c97e5299..c781a336de 100644
--- a/js/src/builtin/Promise.cpp
+++ b/js/src/builtin/Promise.cpp
@@ -1369,7 +1369,8 @@ PromiseObject::create(JSContext* cx, HandleObject executor, HandleObject proto /
static MOZ_MUST_USE bool PerformPromiseAll(JSContext *cx, JS::ForOfIterator& iterator,
HandleObject C, HandleObject promiseObj,
- HandleObject resolve, HandleObject reject);
+ HandleObject resolve, HandleObject reject,
+ bool* done);
// ES2016, 25.4.4.1.
static bool
@@ -1410,12 +1411,14 @@ Promise_static_all(JSContext* cx, unsigned argc, Value* vp)
// Step 6 (implicit).
// Step 7.
- bool result = PerformPromiseAll(cx, iter, C, resultPromise, resolve, reject);
+ bool done;
+ bool result = PerformPromiseAll(cx, iter, C, resultPromise, resolve, reject, &done);
// Step 8.
if (!result) {
// Step 8.a.
- // TODO: implement iterator closing.
+ if (!done)
+ iter.closeThrow();
// Step 8.b.
return AbruptRejectPromise(cx, args, resultPromise, reject);
@@ -1598,8 +1601,11 @@ RunResolutionFunction(JSContext *cx, HandleObject resolutionFun, HandleValue res
// ES2016, 25.4.4.1.1.
static MOZ_MUST_USE bool
PerformPromiseAll(JSContext *cx, JS::ForOfIterator& iterator, HandleObject C,
- HandleObject promiseObj, HandleObject resolve, HandleObject reject)
+ HandleObject promiseObj, HandleObject resolve, HandleObject reject,
+ bool* done)
{
+ *done = false;
+
RootedObject unwrappedPromiseObj(cx);
if (IsWrapper(promiseObj)) {
unwrappedPromiseObj = CheckedUnwrap(promiseObj);
@@ -1666,14 +1672,19 @@ PerformPromiseAll(JSContext *cx, JS::ForOfIterator& iterator, HandleObject C,
RootedValue rejectFunVal(cx, ObjectOrNullValue(reject));
while (true) {
- bool done;
- // Steps a, b, c, e, f, g.
- if (!iterator.next(&nextValue, &done))
+ // Steps a-c, e-g.
+ if (!iterator.next(&nextValue, done)) {
+ // Steps b, f.
+ *done = true;
+
+ // Steps c, g.
return false;
+ }
// Step d.
- if (done) {
+ if (*done) {
// Step d.i (implicit).
+
// Step d.ii.
int32_t remainingCount = dataHolder->decreaseRemainingCount();
@@ -1822,7 +1833,8 @@ PromiseAllResolveElementFunction(JSContext* cx, unsigned argc, Value* vp)
static MOZ_MUST_USE bool PerformPromiseRace(JSContext *cx, JS::ForOfIterator& iterator,
HandleObject C, HandleObject promiseObj,
- HandleObject resolve, HandleObject reject);
+ HandleObject resolve, HandleObject reject,
+ bool* done);
// ES2016, 25.4.4.3.
static bool
@@ -1863,12 +1875,14 @@ Promise_static_race(JSContext* cx, unsigned argc, Value* vp)
// Step 6 (implicit).
// Step 7.
- bool result = PerformPromiseRace(cx, iter, C, resultPromise, resolve, reject);
+ bool done;
+ bool result = PerformPromiseRace(cx, iter, C, resultPromise, resolve, reject, &done);
// Step 8.
if (!result) {
// Step 8.a.
- // TODO: implement iterator closing.
+ if (!done)
+ iter.closeThrow();
// Step 8.b.
return AbruptRejectPromise(cx, args, resultPromise, reject);
@@ -1882,25 +1896,30 @@ Promise_static_race(JSContext* cx, unsigned argc, Value* vp)
// ES2016, 25.4.4.3.1.
static MOZ_MUST_USE bool
PerformPromiseRace(JSContext *cx, JS::ForOfIterator& iterator, HandleObject C,
- HandleObject promiseObj, HandleObject resolve, HandleObject reject)
+ HandleObject promiseObj, HandleObject resolve, HandleObject reject,
+ bool* done)
{
+ *done = false;
MOZ_ASSERT(C->isConstructor());
RootedValue CVal(cx, ObjectValue(*C));
RootedValue nextValue(cx);
RootedValue resolveFunVal(cx, ObjectOrNullValue(resolve));
RootedValue rejectFunVal(cx, ObjectOrNullValue(reject));
- bool done;
while (true) {
// Steps a-c, e-g.
- if (!iterator.next(&nextValue, &done))
+ if (!iterator.next(&nextValue, done)) {
+ // Steps b, f.
+ *done = true;
+
+ // Steps c, g.
return false;
+ }
// Step d.
- if (done) {
- // Step d.i.
- // TODO: implement iterator closing.
+ if (*done) {
+ // Step d.i (implicit).
// Step d.ii.
return true;
diff --git a/js/src/builtin/ReflectParse.cpp b/js/src/builtin/ReflectParse.cpp
index 748ff7351b..beff58e133 100644
--- a/js/src/builtin/ReflectParse.cpp
+++ b/js/src/builtin/ReflectParse.cpp
@@ -2140,7 +2140,7 @@ ASTSerializer::exportDeclaration(ParseNode* pn, MutableHandleValue dst)
MOZ_ASSERT(pn->isKind(PNK_EXPORT) ||
pn->isKind(PNK_EXPORT_FROM) ||
pn->isKind(PNK_EXPORT_DEFAULT));
- MOZ_ASSERT(pn->getArity() == pn->isKind(PNK_EXPORT) ? PN_UNARY : PN_BINARY);
+ MOZ_ASSERT(pn->getArity() == (pn->isKind(PNK_EXPORT) ? PN_UNARY : PN_BINARY));
MOZ_ASSERT_IF(pn->isKind(PNK_EXPORT_FROM), pn->pn_right->isKind(PNK_STRING));
RootedValue decl(cx, NullValue());
@@ -3415,7 +3415,7 @@ ASTSerializer::function(ParseNode* pn, ASTType type, MutableHandleValue dst)
#endif
RootedValue id(cx);
- RootedAtom funcAtom(cx, func->name());
+ RootedAtom funcAtom(cx, func->explicitName());
if (!optIdentifier(funcAtom, nullptr, &id))
return false;
@@ -3423,7 +3423,7 @@ ASTSerializer::function(ParseNode* pn, ASTType type, MutableHandleValue dst)
NodeVector defaults(cx);
RootedValue body(cx), rest(cx);
- if (func->hasRest())
+ if (pn->pn_funbox->hasRest())
rest.setUndefined();
else
rest.setNull();
diff --git a/js/src/builtin/RegExp.cpp b/js/src/builtin/RegExp.cpp
index 80a4bb5bde..b20f41c53e 100644
--- a/js/src/builtin/RegExp.cpp
+++ b/js/src/builtin/RegExp.cpp
@@ -577,14 +577,29 @@ js::regexp_clone(JSContext* cx, unsigned argc, Value* vp)
return true;
}
-/* ES6 draft rev32 21.2.5.4. */
+MOZ_ALWAYS_INLINE bool
+IsRegExpInstanceOrPrototype(HandleValue v)
+{
+ if (!v.isObject())
+ return false;
+
+ return StandardProtoKeyOrNull(&v.toObject()) == JSProto_RegExp;
+}
+
+// ES 2017 draft 21.2.5.4.
MOZ_ALWAYS_INLINE bool
regexp_global_impl(JSContext* cx, const CallArgs& args)
{
- MOZ_ASSERT(IsRegExpObject(args.thisv()));
- Rooted<RegExpObject*> reObj(cx, &args.thisv().toObject().as<RegExpObject>());
+ MOZ_ASSERT(IsRegExpInstanceOrPrototype(args.thisv()));
- /* Steps 4-6. */
+ // Step 3.a.
+ if (!IsRegExpObject(args.thisv())) {
+ args.rval().setUndefined();
+ return true;
+ }
+
+ // Steps 4-6.
+ Rooted<RegExpObject*> reObj(cx, &args.thisv().toObject().as<RegExpObject>());
args.rval().setBoolean(reObj->global());
return true;
}
@@ -592,19 +607,25 @@ regexp_global_impl(JSContext* cx, const CallArgs& args)
bool
js::regexp_global(JSContext* cx, unsigned argc, JS::Value* vp)
{
- /* Steps 1-3. */
+ // Steps 1-3.
CallArgs args = CallArgsFromVp(argc, vp);
- return CallNonGenericMethod<IsRegExpObject, regexp_global_impl>(cx, args);
+ return CallNonGenericMethod<IsRegExpInstanceOrPrototype, regexp_global_impl>(cx, args);
}
-/* ES6 draft rev32 21.2.5.5. */
+// ES 2017 draft 21.2.5.5.
MOZ_ALWAYS_INLINE bool
regexp_ignoreCase_impl(JSContext* cx, const CallArgs& args)
{
- MOZ_ASSERT(IsRegExpObject(args.thisv()));
- Rooted<RegExpObject*> reObj(cx, &args.thisv().toObject().as<RegExpObject>());
+ MOZ_ASSERT(IsRegExpInstanceOrPrototype(args.thisv()));
- /* Steps 4-6. */
+ // Step 3.a
+ if (!IsRegExpObject(args.thisv())) {
+ args.rval().setUndefined();
+ return true;
+ }
+
+ // Steps 4-6.
+ Rooted<RegExpObject*> reObj(cx, &args.thisv().toObject().as<RegExpObject>());
args.rval().setBoolean(reObj->ignoreCase());
return true;
}
@@ -612,19 +633,25 @@ regexp_ignoreCase_impl(JSContext* cx, const CallArgs& args)
bool
js::regexp_ignoreCase(JSContext* cx, unsigned argc, JS::Value* vp)
{
- /* Steps 1-3. */
+ // Steps 1-3.
CallArgs args = CallArgsFromVp(argc, vp);
- return CallNonGenericMethod<IsRegExpObject, regexp_ignoreCase_impl>(cx, args);
+ return CallNonGenericMethod<IsRegExpInstanceOrPrototype, regexp_ignoreCase_impl>(cx, args);
}
-/* ES6 draft rev32 21.2.5.7. */
+// ES 2017 draft 21.2.5.7.
MOZ_ALWAYS_INLINE bool
regexp_multiline_impl(JSContext* cx, const CallArgs& args)
{
- MOZ_ASSERT(IsRegExpObject(args.thisv()));
- Rooted<RegExpObject*> reObj(cx, &args.thisv().toObject().as<RegExpObject>());
+ MOZ_ASSERT(IsRegExpInstanceOrPrototype(args.thisv()));
- /* Steps 4-6. */
+ // Step 3.a.
+ if (!IsRegExpObject(args.thisv())) {
+ args.rval().setUndefined();
+ return true;
+ }
+
+ // Steps 4-6.
+ Rooted<RegExpObject*> reObj(cx, &args.thisv().toObject().as<RegExpObject>());
args.rval().setBoolean(reObj->multiline());
return true;
}
@@ -632,24 +659,30 @@ regexp_multiline_impl(JSContext* cx, const CallArgs& args)
bool
js::regexp_multiline(JSContext* cx, unsigned argc, JS::Value* vp)
{
- /* Steps 1-3. */
+ // Steps 1-3.
CallArgs args = CallArgsFromVp(argc, vp);
- return CallNonGenericMethod<IsRegExpObject, regexp_multiline_impl>(cx, args);
+ return CallNonGenericMethod<IsRegExpInstanceOrPrototype, regexp_multiline_impl>(cx, args);
}
-/* ES6 draft rev32 21.2.5.10. */
+// ES 2017 draft rev32 21.2.5.10.
MOZ_ALWAYS_INLINE bool
regexp_source_impl(JSContext* cx, const CallArgs& args)
{
- MOZ_ASSERT(IsRegExpObject(args.thisv()));
- Rooted<RegExpObject*> reObj(cx, &args.thisv().toObject().as<RegExpObject>());
+ MOZ_ASSERT(IsRegExpInstanceOrPrototype(args.thisv()));
+
+ // Step 3.a.
+ if (!IsRegExpObject(args.thisv())) {
+ args.rval().setString(cx->names().emptyRegExp);
+ return true;
+ }
- /* Step 5. */
+ // Step 5.
+ Rooted<RegExpObject*> reObj(cx, &args.thisv().toObject().as<RegExpObject>());
RootedAtom src(cx, reObj->getSource());
if (!src)
return false;
- /* Step 7. */
+ // Step 7.
RootedString str(cx, EscapeRegExpPattern(cx, src));
if (!str)
return false;
@@ -661,19 +694,25 @@ regexp_source_impl(JSContext* cx, const CallArgs& args)
static bool
regexp_source(JSContext* cx, unsigned argc, JS::Value* vp)
{
- /* Steps 1-4. */
+ // Steps 1-4.
CallArgs args = CallArgsFromVp(argc, vp);
- return CallNonGenericMethod<IsRegExpObject, regexp_source_impl>(cx, args);
+ return CallNonGenericMethod<IsRegExpInstanceOrPrototype, regexp_source_impl>(cx, args);
}
-/* ES6 draft rev32 21.2.5.12. */
+// ES 2017 draft 21.2.5.12.
MOZ_ALWAYS_INLINE bool
regexp_sticky_impl(JSContext* cx, const CallArgs& args)
{
- MOZ_ASSERT(IsRegExpObject(args.thisv()));
- Rooted<RegExpObject*> reObj(cx, &args.thisv().toObject().as<RegExpObject>());
+ MOZ_ASSERT(IsRegExpInstanceOrPrototype(args.thisv()));
- /* Steps 4-6. */
+ // Step 3.a.
+ if (!IsRegExpObject(args.thisv())) {
+ args.rval().setUndefined();
+ return true;
+ }
+
+ // Steps 4-6.
+ Rooted<RegExpObject*> reObj(cx, &args.thisv().toObject().as<RegExpObject>());
args.rval().setBoolean(reObj->sticky());
return true;
}
@@ -681,27 +720,35 @@ regexp_sticky_impl(JSContext* cx, const CallArgs& args)
bool
js::regexp_sticky(JSContext* cx, unsigned argc, JS::Value* vp)
{
- /* Steps 1-3. */
+ // Steps 1-3.
CallArgs args = CallArgsFromVp(argc, vp);
- return CallNonGenericMethod<IsRegExpObject, regexp_sticky_impl>(cx, args);
+ return CallNonGenericMethod<IsRegExpInstanceOrPrototype, regexp_sticky_impl>(cx, args);
}
-/* ES6 21.2.5.15. */
+// ES 2017 draft 21.2.5.15.
MOZ_ALWAYS_INLINE bool
regexp_unicode_impl(JSContext* cx, const CallArgs& args)
{
- MOZ_ASSERT(IsRegExpObject(args.thisv()));
- /* Steps 4-6. */
- args.rval().setBoolean(args.thisv().toObject().as<RegExpObject>().unicode());
+ MOZ_ASSERT(IsRegExpInstanceOrPrototype(args.thisv()));
+
+ // Step 3.a.
+ if (!IsRegExpObject(args.thisv())) {
+ args.rval().setUndefined();
+ return true;
+ }
+
+ // Steps 4-6.
+ Rooted<RegExpObject*> reObj(cx, &args.thisv().toObject().as<RegExpObject>());
+ args.rval().setBoolean(reObj->unicode());
return true;
}
bool
js::regexp_unicode(JSContext* cx, unsigned argc, JS::Value* vp)
{
- /* Steps 1-3. */
+ // Steps 1-3.
CallArgs args = CallArgsFromVp(argc, vp);
- return CallNonGenericMethod<IsRegExpObject, regexp_unicode_impl>(cx, args);
+ return CallNonGenericMethod<IsRegExpInstanceOrPrototype, regexp_unicode_impl>(cx, args);
}
const JSPropertySpec js::regexp_properties[] = {
@@ -829,25 +876,6 @@ const JSPropertySpec js::regexp_static_props[] = {
JS_PS_END
};
-JSObject*
-js::CreateRegExpPrototype(JSContext* cx, JSProtoKey key)
-{
- MOZ_ASSERT(key == JSProto_RegExp);
-
- Rooted<RegExpObject*> proto(cx, cx->global()->createBlankPrototype<RegExpObject>(cx));
- if (!proto)
- return nullptr;
- proto->NativeObject::setPrivate(nullptr);
-
- if (!RegExpObject::assignInitialShape(cx, proto))
- return nullptr;
-
- RootedAtom source(cx, cx->names().empty);
- proto->initAndZeroLastIndex(source, RegExpFlag(0), cx);
-
- return proto;
-}
-
template <typename CharT>
static bool
IsTrailSurrogateWithLeadSurrogateImpl(JSContext* cx, HandleLinearString input, size_t index)
diff --git a/js/src/builtin/RegExp.js b/js/src/builtin/RegExp.js
index 1ffea01050..0b849292cf 100644
--- a/js/src/builtin/RegExp.js
+++ b/js/src/builtin/RegExp.js
@@ -122,8 +122,7 @@ function RegExpMatch(string) {
}
// Step 5.
- var sticky = !!(flags & REGEXP_STICKY_FLAG);
- return RegExpLocalMatchOpt(rx, S, sticky);
+ return RegExpBuiltinExec(rx, S, false);
}
// Stes 4-6
@@ -220,37 +219,6 @@ function RegExpGlobalMatchOpt(rx, S, fullUnicode) {
}
}
-// ES 2017 draft rev 6859bb9ccaea9c6ede81d71e5320e3833b92cb3e 21.2.5.6 step 5.
-// Optimized path for @@match without global flag.
-function RegExpLocalMatchOpt(rx, S, sticky) {
- // Step 4.
- var lastIndex = ToLength(rx.lastIndex);
-
- // Step 8.
- if (!sticky) {
- lastIndex = 0;
- } else {
- if (lastIndex > S.length) {
- // Steps 12.a.i-ii, 12.c.i.1-2.
- rx.lastIndex = 0;
- return null;
- }
- }
-
- // Steps 3, 9-25, except 12.a.i-ii, 12.c.i.1-2, 15.
- var result = RegExpMatcher(rx, S, lastIndex);
- if (result === null) {
- // Steps 12.a.i-ii, 12.c.i.1-2.
- rx.lastIndex = 0;
- } else {
- // Step 15.
- if (sticky)
- rx.lastIndex = result.index + result[0].length;
- }
-
- return result;
-}
-
// Checks if following properties and getters are not modified, and accessing
// them not observed by content script:
// * flags
@@ -318,9 +286,10 @@ function RegExpReplace(string, replaceValue) {
if (functionalReplace) {
var elemBase = GetElemBaseForLambda(replaceValue);
- if (IsObject(elemBase))
+ if (IsObject(elemBase)) {
return RegExpGlobalReplaceOptElemBase(rx, S, lengthS, replaceValue,
fullUnicode, elemBase);
+ }
return RegExpGlobalReplaceOptFunc(rx, S, lengthS, replaceValue,
fullUnicode);
}
@@ -336,18 +305,11 @@ function RegExpReplace(string, replaceValue) {
fullUnicode);
}
- var sticky = !!(flags & REGEXP_STICKY_FLAG);
-
- if (functionalReplace) {
- return RegExpLocalReplaceOptFunc(rx, S, lengthS, replaceValue,
- sticky);
- }
- if (firstDollarIndex !== -1) {
- return RegExpLocalReplaceOptSubst(rx, S, lengthS, replaceValue,
- sticky, firstDollarIndex);
- }
- return RegExpLocalReplaceOpt(rx, S, lengthS, replaceValue,
- sticky);
+ if (functionalReplace)
+ return RegExpLocalReplaceOptFunc(rx, S, lengthS, replaceValue);
+ if (firstDollarIndex !== -1)
+ return RegExpLocalReplaceOptSubst(rx, S, lengthS, replaceValue, firstDollarIndex);
+ return RegExpLocalReplaceOpt(rx, S, lengthS, replaceValue);
}
// Steps 8-16.
@@ -647,7 +609,8 @@ function RegExpGlobalReplaceShortOpt(rx, S, lengthS, replaceValue, fullUnicode)
#undef SUBSTITUTION
#undef FUNC_NAME
-// ES 2017 draft 6859bb9ccaea9c6ede81d71e5320e3833b92cb3e 21.2.5.9.
+// ES2017 draft rev 6390c2f1b34b309895d31d8c0512eac8660a0210
+// 21.2.5.9 RegExp.prototype [ @@search ] ( string )
function RegExpSearch(string) {
// Step 1.
var rx = this;
@@ -659,41 +622,69 @@ function RegExpSearch(string) {
// Step 3.
var S = ToString(string);
+ // Step 4.
+ var previousLastIndex = rx.lastIndex;
+
+ // Step 5.
+ var lastIndexIsZero = SameValue(previousLastIndex, 0);
+ if (!lastIndexIsZero)
+ rx.lastIndex = 0;
+
if (IsRegExpMethodOptimizable(rx) && S.length < 0x7fff) {
// Step 6.
var result = RegExpSearcher(rx, S, 0);
- // Step 8.
+ // We need to consider two cases:
+ //
+ // 1. Neither global nor sticky is set:
+ // RegExpBuiltinExec doesn't modify lastIndex for local RegExps, that
+ // means |SameValue(rx.lastIndex, 0)| is true after calling exec. The
+ // comparison in steps 7-8 |SameValue(rx.lastIndex, previousLastIndex)|
+ // is therefore equal to the already computed |lastIndexIsZero| value.
+ //
+ // 2. Global or sticky flag is set.
+ // RegExpBuiltinExec will always update lastIndex and we need to
+ // restore the property to its original value.
+
+ // Steps 7-8.
+ if (!lastIndexIsZero) {
+ rx.lastIndex = previousLastIndex;
+ } else {
+ var flags = UnsafeGetInt32FromReservedSlot(rx, REGEXP_FLAGS_SLOT);
+ if (flags & (REGEXP_GLOBAL_FLAG | REGEXP_STICKY_FLAG))
+ rx.lastIndex = previousLastIndex;
+ }
+
+ // Step 9.
if (result === -1)
return -1;
- // Step 9.
+ // Step 10.
return result & 0x7fff;
}
- return RegExpSearchSlowPath(rx, S);
+ return RegExpSearchSlowPath(rx, S, previousLastIndex);
}
-// ES 2017 draft 6859bb9ccaea9c6ede81d71e5320e3833b92cb3e 21.2.5.9
-// steps 4-9.
-function RegExpSearchSlowPath(rx, S) {
- // Step 4.
- var previousLastIndex = rx.lastIndex;
-
- // Step 5.
- rx.lastIndex = 0;
-
+// ES2017 draft rev 6390c2f1b34b309895d31d8c0512eac8660a0210
+// 21.2.5.9 RegExp.prototype [ @@search ] ( string )
+// Steps 6-10.
+function RegExpSearchSlowPath(rx, S, previousLastIndex) {
// Step 6.
var result = RegExpExec(rx, S, false);
// Step 7.
- rx.lastIndex = previousLastIndex;
+ var currentLastIndex = rx.lastIndex;
// Step 8.
+ if (!SameValue(currentLastIndex, previousLastIndex))
+ rx.lastIndex = previousLastIndex;
+
+ // Step 9.
if (result === null)
return -1;
- // Step 9.
+ // Step 10.
return result.index;
}
@@ -942,15 +933,16 @@ function RegExpExec(R, S, forTest) {
return forTest ? result !== null : result;
}
-// ES 2017 draft rev 6a13789aa9e7c6de4e96b7d3e24d9e6eba6584ad 21.2.5.2.2.
+// ES2017 draft rev 6390c2f1b34b309895d31d8c0512eac8660a0210
+// 21.2.5.2.2 Runtime Semantics: RegExpBuiltinExec ( R, S )
function RegExpBuiltinExec(R, S, forTest) {
- // ES6 21.2.5.2.1 step 6.
+ // 21.2.5.2.1 Runtime Semantics: RegExpExec, step 5.
// This check is here for RegExpTest. RegExp_prototype_Exec does same
// thing already.
if (!IsRegExpObject(R))
return UnwrapAndCallRegExpBuiltinExec(R, S, forTest);
- // Steps 1-2 (skipped).
+ // Steps 1-3 (skipped).
// Step 4.
var lastIndex = ToLength(R.lastIndex);
@@ -965,9 +957,11 @@ function RegExpBuiltinExec(R, S, forTest) {
if (!globalOrSticky) {
lastIndex = 0;
} else {
+ // Step 12.a.
if (lastIndex > S.length) {
- // Steps 12.a.i-ii, 12.c.i.1-2.
- R.lastIndex = 0;
+ // Steps 12.a.i-ii.
+ if (globalOrSticky)
+ R.lastIndex = 0;
return forTest ? false : null;
}
}
@@ -977,7 +971,8 @@ function RegExpBuiltinExec(R, S, forTest) {
var endIndex = RegExpTester(R, S, lastIndex);
if (endIndex == -1) {
// Steps 12.a.i-ii, 12.c.i.1-2.
- R.lastIndex = 0;
+ if (globalOrSticky)
+ R.lastIndex = 0;
return false;
}
@@ -991,8 +986,9 @@ function RegExpBuiltinExec(R, S, forTest) {
// Steps 3, 9-25, except 12.a.i-ii, 12.c.i.1-2, 15.
var result = RegExpMatcher(R, S, lastIndex);
if (result === null) {
- // Steps 12.a.i-ii, 12.c.i.1-2.
- R.lastIndex = 0;
+ // Steps 12.a.i, 12.c.i.
+ if (globalOrSticky)
+ R.lastIndex = 0;
} else {
// Step 15.
if (globalOrSticky)
diff --git a/js/src/builtin/RegExpLocalReplaceOpt.h.js b/js/src/builtin/RegExpLocalReplaceOpt.h.js
index edc2e2056c..1acd6a73a4 100644
--- a/js/src/builtin/RegExpLocalReplaceOpt.h.js
+++ b/js/src/builtin/RegExpLocalReplaceOpt.h.js
@@ -11,24 +11,39 @@
// * FUNCTIONAL -- replaceValue is a function
// * neither of above -- replaceValue is a string without "$"
-// ES 2017 draft 03bfda119d060aca4099d2b77cf43f6d4f11cfa2 21.2.5.8
+// ES 2017 draft 6390c2f1b34b309895d31d8c0512eac8660a0210 21.2.5.8
// steps 11.a-16.
// Optimized path for @@replace with the following conditions:
// * global flag is false
-function FUNC_NAME(rx, S, lengthS, replaceValue, sticky
+function FUNC_NAME(rx, S, lengthS, replaceValue
#ifdef SUBSTITUTION
, firstDollarIndex
#endif
)
{
- var lastIndex;
- if (sticky) {
- lastIndex = ToLength(rx.lastIndex);
+ // 21.2.5.2.2 RegExpBuiltinExec, step 4.
+ var lastIndex = ToLength(rx.lastIndex);
+
+ // 21.2.5.2.2 RegExpBuiltinExec, step 5.
+ // Side-effects in step 4 can recompile the RegExp, so we need to read the
+ // flags again and handle the case when global was enabled even though this
+ // function is optimized for non-global RegExps.
+ var flags = UnsafeGetInt32FromReservedSlot(rx, REGEXP_FLAGS_SLOT);
+
+ // 21.2.5.2.2 RegExpBuiltinExec, steps 6-7.
+ var globalOrSticky = !!(flags & (REGEXP_GLOBAL_FLAG | REGEXP_STICKY_FLAG));
+
+ if (globalOrSticky) {
+ // 21.2.5.2.2 RegExpBuiltinExec, step 12.a.
if (lastIndex > lengthS) {
- rx.lastIndex = 0;
+ if (globalOrSticky)
+ rx.lastIndex = 0;
+
+ // Steps 12-16.
return S;
}
} else {
+ // 21.2.5.2.2 RegExpBuiltinExec, step 8.
lastIndex = 0;
}
@@ -37,7 +52,11 @@ function FUNC_NAME(rx, S, lengthS, replaceValue, sticky
// Step 11.b.
if (result === null) {
- rx.lastIndex = 0;
+ // 21.2.5.2.2 RegExpBuiltinExec, steps 12.a.i, 12.c.i.
+ if (globalOrSticky)
+ rx.lastIndex = 0;
+
+ // Steps 12-16.
return S;
}
@@ -61,7 +80,8 @@ function FUNC_NAME(rx, S, lengthS, replaceValue, sticky
// To set rx.lastIndex before RegExpGetComplexReplacement.
var nextSourcePosition = position + matchLength;
- if (sticky)
+ // 21.2.5.2.2 RegExpBuiltinExec, step 15.
+ if (globalOrSticky)
rx.lastIndex = nextSourcePosition;
var replacement;
diff --git a/js/src/builtin/Set.js b/js/src/builtin/Set.js
index accc701201..9af6cf8d1a 100644
--- a/js/src/builtin/Set.js
+++ b/js/src/builtin/Set.js
@@ -14,34 +14,9 @@ function SetConstructorInit(iterable) {
if (!IsCallable(adder))
ThrowTypeError(JSMSG_NOT_FUNCTION, typeof adder);
- // Step 6.c.
- var iterFn = iterable[std_iterator];
- if (!IsCallable(iterFn))
- ThrowTypeError(JSMSG_NOT_ITERABLE, DecompileArg(0, iterable));
-
- var iter = callContentFunction(iterFn, iterable);
- if (!IsObject(iter))
- ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT, typeof iter);
-
- // Step 7 (not applicable).
-
- // Step 8.
- while (true) {
- // Step 8.a.
- var next = callContentFunction(iter.next, iter);
- if (!IsObject(next))
- ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT, typeof next);
-
- // Step 8.b.
- if (next.done)
- return;
-
- // Step 8.c.
- var nextValue = next.value;
-
- // Steps 8.d-e.
+ // Steps 6.c-8.
+ for (var nextValue of allowContentIter(iterable))
callContentFunction(adder, set, nextValue);
- }
}
/* ES6 20121122 draft 15.16.4.6. */
diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp
index acf449b7e5..a14f9ba69a 100644
--- a/js/src/builtin/TestingFunctions.cpp
+++ b/js/src/builtin/TestingFunctions.cpp
@@ -881,7 +881,7 @@ HasChild(JSContext* cx, unsigned argc, Value* vp)
RootedValue parent(cx, args.get(0));
RootedValue child(cx, args.get(1));
- if (!parent.isMarkable() || !child.isMarkable()) {
+ if (!parent.isGCThing() || !child.isGCThing()) {
args.rval().setBoolean(false);
return true;
}
diff --git a/js/src/builtin/TypedArray.js b/js/src/builtin/TypedArray.js
index 4d2d6488f4..a2205dc92a 100644
--- a/js/src/builtin/TypedArray.js
+++ b/js/src/builtin/TypedArray.js
@@ -35,6 +35,10 @@ function IsDetachedBuffer(buffer) {
return (flags & JS_ARRAYBUFFER_DETACHED_FLAG) !== 0;
}
+function TypedArrayLengthMethod() {
+ return TypedArrayLength(this);
+}
+
function GetAttachedArrayBuffer(tarray) {
var buffer = ViewedArrayBufferIfReified(tarray);
if (IsDetachedBuffer(buffer))
@@ -42,6 +46,10 @@ function GetAttachedArrayBuffer(tarray) {
return buffer;
}
+function GetAttachedArrayBufferMethod() {
+ return GetAttachedArrayBuffer(this);
+}
+
// A function which ensures that the argument is either a typed array or a
// cross-compartment wrapper for a typed array and that the typed array involved
// has an attached array buffer. If one of those conditions doesn't hold (wrong
@@ -54,10 +62,7 @@ function IsTypedArrayEnsuringArrayBuffer(arg) {
return true;
}
- // This is a bit hacky but gets the job done: the first `arg` is used to
- // test for a wrapped typed array, the second as an argument to
- // GetAttachedArrayBuffer.
- callFunction(CallTypedArrayMethodIfWrapped, arg, arg, "GetAttachedArrayBuffer");
+ callFunction(CallTypedArrayMethodIfWrapped, arg, "GetAttachedArrayBufferMethod");
return false;
}
@@ -98,8 +103,8 @@ function TypedArrayCreateWithLength(constructor, length) {
if (isTypedArray) {
len = TypedArrayLength(newTypedArray);
} else {
- len = callFunction(CallTypedArrayMethodIfWrapped, newTypedArray, newTypedArray,
- "TypedArrayLength");
+ len = callFunction(CallTypedArrayMethodIfWrapped, newTypedArray,
+ "TypedArrayLengthMethod");
}
if (len < length)
@@ -259,15 +264,14 @@ function TypedArrayEvery(callbackfn/*, thisArg*/) {
// We want to make sure that we have an attached buffer, per spec prose.
var isTypedArray = IsTypedArrayEnsuringArrayBuffer(O);
- // If we got here, `this` is either a typed array or a cross-compartment
- // wrapper for one.
+ // If we got here, `this` is either a typed array or a wrapper for one.
// Steps 3-5.
var len;
if (isTypedArray)
len = TypedArrayLength(O);
else
- len = callFunction(CallTypedArrayMethodIfWrapped, O, O, "TypedArrayLength");
+ len = callFunction(CallTypedArrayMethodIfWrapped, O, "TypedArrayLengthMethod");
// Step 6.
if (arguments.length === 0)
@@ -348,15 +352,14 @@ function TypedArrayFilter(callbackfn/*, thisArg*/) {
// We want to make sure that we have an attached buffer, per spec prose.
var isTypedArray = IsTypedArrayEnsuringArrayBuffer(O);
- // If we got here, `this` is either a typed array or a cross-compartment
- // wrapper for one.
+ // If we got here, `this` is either a typed array or a wrapper for one.
// Step 3.
var len;
if (isTypedArray)
len = TypedArrayLength(O);
else
- len = callFunction(CallTypedArrayMethodIfWrapped, O, O, "TypedArrayLength");
+ len = callFunction(CallTypedArrayMethodIfWrapped, O, "TypedArrayLengthMethod");
// Step 4.
if (arguments.length === 0)
@@ -410,15 +413,14 @@ function TypedArrayFind(predicate/*, thisArg*/) {
// We want to make sure that we have an attached buffer, per spec prose.
var isTypedArray = IsTypedArrayEnsuringArrayBuffer(O);
- // If we got here, `this` is either a typed array or a cross-compartment
- // wrapper for one.
+ // If we got here, `this` is either a typed array or a wrapper for one.
// Steps 3-5.
var len;
if (isTypedArray)
len = TypedArrayLength(O);
else
- len = callFunction(CallTypedArrayMethodIfWrapped, O, O, "TypedArrayLength");
+ len = callFunction(CallTypedArrayMethodIfWrapped, O, "TypedArrayLengthMethod");
// Step 6.
if (arguments.length === 0)
@@ -452,15 +454,14 @@ function TypedArrayFindIndex(predicate/*, thisArg*/) {
// We want to make sure that we have an attached buffer, per spec prose.
var isTypedArray = IsTypedArrayEnsuringArrayBuffer(O);
- // If we got here, `this` is either a typed array or a cross-compartment
- // wrapper for one.
+ // If we got here, `this` is either a typed array or a wrapper for one.
// Steps 3-5.
var len;
if (isTypedArray)
len = TypedArrayLength(O);
else
- len = callFunction(CallTypedArrayMethodIfWrapped, O, O, "TypedArrayLength");
+ len = callFunction(CallTypedArrayMethodIfWrapped, O, "TypedArrayLengthMethod");
// Step 6.
if (arguments.length === 0)
@@ -492,15 +493,14 @@ function TypedArrayForEach(callbackfn/*, thisArg*/) {
// We want to make sure that we have an attached buffer, per spec prose.
var isTypedArray = IsTypedArrayEnsuringArrayBuffer(O);
- // If we got here, `this` is either a typed array or a cross-compartment
- // wrapper for one.
+ // If we got here, `this` is either a typed array or a wrapper for one.
// Step 3-4.
var len;
if (isTypedArray)
len = TypedArrayLength(O);
else
- len = callFunction(CallTypedArrayMethodIfWrapped, O, O, "TypedArrayLength");
+ len = callFunction(CallTypedArrayMethodIfWrapped, O, "TypedArrayLengthMethod");
// Step 5.
if (arguments.length === 0)
@@ -686,15 +686,14 @@ function TypedArrayMap(callbackfn/*, thisArg*/) {
// We want to make sure that we have an attached buffer, per spec prose.
var isTypedArray = IsTypedArrayEnsuringArrayBuffer(O);
- // If we got here, `this` is either a typed array or a cross-compartment
- // wrapper for one.
+ // If we got here, `this` is either a typed array or a wrapper for one.
// Step 3.
var len;
if (isTypedArray)
len = TypedArrayLength(O);
else
- len = callFunction(CallTypedArrayMethodIfWrapped, O, O, "TypedArrayLength");
+ len = callFunction(CallTypedArrayMethodIfWrapped, O, "TypedArrayLengthMethod");
// Step 4.
if (arguments.length === 0)
@@ -730,15 +729,14 @@ function TypedArrayReduce(callbackfn/*, initialValue*/) {
// We want to make sure that we have an attached buffer, per spec prose.
var isTypedArray = IsTypedArrayEnsuringArrayBuffer(O);
- // If we got here, `this` is either a typed array or a cross-compartment
- // wrapper for one.
+ // If we got here, `this` is either a typed array or a wrapper for one.
// Steps 3-5.
var len;
if (isTypedArray)
len = TypedArrayLength(O);
else
- len = callFunction(CallTypedArrayMethodIfWrapped, O, O, "TypedArrayLength");
+ len = callFunction(CallTypedArrayMethodIfWrapped, O, "TypedArrayLengthMethod");
// Step 6.
if (arguments.length === 0)
@@ -776,15 +774,14 @@ function TypedArrayReduceRight(callbackfn/*, initialValue*/) {
// We want to make sure that we have an attached buffer, per spec prose.
var isTypedArray = IsTypedArrayEnsuringArrayBuffer(O);
- // If we got here, `this` is either a typed array or a cross-compartment
- // wrapper for one.
+ // If we got here, `this` is either a typed array or a wrapper for one.
// Steps 3-5.
var len;
if (isTypedArray)
len = TypedArrayLength(O);
else
- len = callFunction(CallTypedArrayMethodIfWrapped, O, O, "TypedArrayLength");
+ len = callFunction(CallTypedArrayMethodIfWrapped, O, "TypedArrayLengthMethod");
// Step 6.
if (arguments.length === 0)
@@ -1034,15 +1031,14 @@ function TypedArraySome(callbackfn/*, thisArg*/) {
// We want to make sure that we have an attached buffer, per spec prose.
var isTypedArray = IsTypedArrayEnsuringArrayBuffer(O);
- // If we got here, `this` is either a typed array or a cross-compartment
- // wrapper for one.
+ // If we got here, `this` is either a typed array or a wrapper for one.
// Steps 3-5.
var len;
if (isTypedArray)
len = TypedArrayLength(O);
else
- len = callFunction(CallTypedArrayMethodIfWrapped, O, O, "TypedArrayLength");
+ len = callFunction(CallTypedArrayMethodIfWrapped, O, "TypedArrayLengthMethod");
// Step 6.
if (arguments.length === 0)
@@ -1137,7 +1133,7 @@ function TypedArraySort(comparefn) {
if (isTypedArray) {
buffer = GetAttachedArrayBuffer(obj);
} else {
- buffer = callFunction(CallTypedArrayMethodIfWrapped, obj, obj, "GetAttachedArrayBuffer");
+ buffer = callFunction(CallTypedArrayMethodIfWrapped, obj, "GetAttachedArrayBufferMethod");
}
// Step 3.
@@ -1145,7 +1141,7 @@ function TypedArraySort(comparefn) {
if (isTypedArray) {
len = TypedArrayLength(obj);
} else {
- len = callFunction(CallTypedArrayMethodIfWrapped, obj, obj, "TypedArrayLength");
+ len = callFunction(CallTypedArrayMethodIfWrapped, obj, "TypedArrayLengthMethod");
}
if (comparefn === undefined) {
@@ -1181,8 +1177,8 @@ function TypedArraySort(comparefn) {
if (isTypedArray) {
buffer = GetAttachedArrayBuffer(obj);
} else {
- buffer = callFunction(CallTypedArrayMethodIfWrapped, obj, obj,
- "GetAttachedArrayBuffer");
+ buffer = callFunction(CallTypedArrayMethodIfWrapped, obj,
+ "GetAttachedArrayBufferMethod");
}
}
var bufferDetached;
@@ -1217,15 +1213,14 @@ function TypedArrayToLocaleString(locales = undefined, options = undefined) {
// We want to make sure that we have an attached buffer, per spec prose.
var isTypedArray = IsTypedArrayEnsuringArrayBuffer(array);
- // If we got here, `this` is either a typed array or a cross-compartment
- // wrapper for one.
+ // If we got here, `this` is either a typed array or a wrapper for one.
// Step 2.
var len;
if (isTypedArray)
len = TypedArrayLength(array);
else
- len = callFunction(CallTypedArrayMethodIfWrapped, array, array, "TypedArrayLength");
+ len = callFunction(CallTypedArrayMethodIfWrapped, array, "TypedArrayLengthMethod");
// Step 4.
if (len === 0)
@@ -1433,7 +1428,7 @@ function TypedArrayStaticFrom(source, mapfn = undefined, thisArg = undefined) {
// 22.2.2.1.1 IterableToList, step 4.a.
var next = callContentFunction(iterator.next, iterator);
if (!IsObject(next))
- ThrowTypeError(JSMSG_NEXT_RETURNED_PRIMITIVE);
+ ThrowTypeError(JSMSG_ITER_METHOD_RETURNED_PRIMITIVE, "next");
// 22.2.2.1.1 IterableToList, step 4.b.
if (next.done)
@@ -1560,7 +1555,7 @@ function IterableToList(items, method) {
// Step 4.a.
var next = callContentFunction(iterator.next, iterator);
if (!IsObject(next))
- ThrowTypeError(JSMSG_NEXT_RETURNED_PRIMITIVE);
+ ThrowTypeError(JSMSG_ITER_METHOD_RETURNED_PRIMITIVE, "next");
// Step 4.b.
if (next.done)
diff --git a/js/src/builtin/TypedObject.cpp b/js/src/builtin/TypedObject.cpp
index b7297c8944..ae74f01bf6 100644
--- a/js/src/builtin/TypedObject.cpp
+++ b/js/src/builtin/TypedObject.cpp
@@ -230,7 +230,7 @@ const Class js::ScalarTypeDescr::class_ = {
const JSFunctionSpec js::ScalarTypeDescr::typeObjectMethods[] = {
JS_SELF_HOSTED_FN("toSource", "DescrToSource", 0, 0),
- JS_SELF_HOSTED_FN("array", "ArrayShorthand", 1, JSFUN_HAS_REST),
+ JS_SELF_HOSTED_FN("array", "ArrayShorthand", 1, 0),
JS_SELF_HOSTED_FN("equivalent", "TypeDescrEquivalent", 1, 0),
JS_FS_END
};
diff --git a/js/src/builtin/Utilities.js b/js/src/builtin/Utilities.js
index bfb1fe7f45..c73bc5e7f7 100644
--- a/js/src/builtin/Utilities.js
+++ b/js/src/builtin/Utilities.js
@@ -106,7 +106,17 @@ function ToLength(v) {
return std_Math_min(v, 0x1fffffffffffff);
}
-/* Spec: ECMAScript Draft, 6th edition Oct 14, 2014, 7.2.4 */
+// ES2017 draft rev aebf014403a3e641fb1622aec47c40f051943527
+// 7.2.9 SameValue ( x, y )
+function SameValue(x, y) {
+ if (x === y) {
+ return (x !== 0) || (1 / x === 1 / y);
+ }
+ return (x !== x && y !== y);
+}
+
+// ES2017 draft rev aebf014403a3e641fb1622aec47c40f051943527
+// 7.2.10 SameValueZero ( x, y )
function SameValueZero(x, y) {
return x === y || (x !== x && y !== y);
}
diff --git a/js/src/builtin/WeakMap.js b/js/src/builtin/WeakMap.js
index 066a72bfe3..6755b7a7b8 100644
--- a/js/src/builtin/WeakMap.js
+++ b/js/src/builtin/WeakMap.js
@@ -14,31 +14,8 @@ function WeakMapConstructorInit(iterable) {
if (!IsCallable(adder))
ThrowTypeError(JSMSG_NOT_FUNCTION, typeof adder);
- // Step 6.c.
- var iterFn = iterable[std_iterator];
- if (!IsCallable(iterFn))
- ThrowTypeError(JSMSG_NOT_ITERABLE, DecompileArg(0, iterable));
-
- var iter = callContentFunction(iterFn, iterable);
- if (!IsObject(iter))
- ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT, typeof iter);
-
- // Step 7 (not applicable).
-
- // Step 8.
- while (true) {
- // Step 8.a.
- var next = callContentFunction(iter.next, iter);
- if (!IsObject(next))
- ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT, typeof next);
-
- // Step 8.b.
- if (next.done)
- return;
-
- // Step 8.c.
- var nextItem = next.value;
-
+ // Steps 6.c-8.
+ for (var nextItem of allowContentIter(iterable)) {
// Step 8.d.
if (!IsObject(nextItem))
ThrowTypeError(JSMSG_INVALID_MAP_ITERABLE, "WeakMap");
diff --git a/js/src/builtin/WeakSet.js b/js/src/builtin/WeakSet.js
index eb7c2378f8..b16b4634dd 100644
--- a/js/src/builtin/WeakSet.js
+++ b/js/src/builtin/WeakSet.js
@@ -14,34 +14,9 @@ function WeakSetConstructorInit(iterable) {
if (!IsCallable(adder))
ThrowTypeError(JSMSG_NOT_FUNCTION, typeof adder);
- // Step 6.c.
- var iterFn = iterable[std_iterator];
- if (!IsCallable(iterFn))
- ThrowTypeError(JSMSG_NOT_ITERABLE, DecompileArg(0, iterable));
-
- var iter = callContentFunction(iterFn, iterable);
- if (!IsObject(iter))
- ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT, typeof iter);
-
- // Step 7 (not applicable).
-
- // Step 8.
- while (true) {
- // Step 8.a.
- var next = callContentFunction(iter.next, iter);
- if (!IsObject(next))
- ThrowTypeError(JSMSG_NOT_NONNULL_OBJECT, typeof next);
-
- // Step 8.b.
- if (next.done)
- return;
-
- // Step 8.c.
- var nextValue = next.value;
-
- // Steps 8.d-e.
+ // Steps 6.c-8.
+ for (var nextValue of allowContentIter(iterable))
callContentFunction(adder, set, nextValue);
- }
}
// 23.4.3.1
diff --git a/js/src/frontend/BytecodeCompiler.cpp b/js/src/frontend/BytecodeCompiler.cpp
index d4c758b6c2..76afe80b13 100644
--- a/js/src/frontend/BytecodeCompiler.cpp
+++ b/js/src/frontend/BytecodeCompiler.cpp
@@ -7,6 +7,7 @@
#include "frontend/BytecodeCompiler.h"
#include "mozilla/IntegerPrintfMacros.h"
+#include "mozilla/Maybe.h"
#include "jscntxt.h"
#include "jsscript.h"
@@ -28,6 +29,7 @@
using namespace js;
using namespace js::frontend;
using mozilla::Maybe;
+using mozilla::Nothing;
class MOZ_STACK_CLASS AutoCompilationTraceLogger
{
@@ -57,24 +59,24 @@ class MOZ_STACK_CLASS BytecodeCompiler
// Call setters for optional arguments.
void maybeSetSourceCompressor(SourceCompressionTask* sourceCompressor);
- void setSourceArgumentsNotIncluded();
JSScript* compileGlobalScript(ScopeKind scopeKind);
JSScript* compileEvalScript(HandleObject environment, HandleScope enclosingScope);
ModuleObject* compileModule();
- bool compileFunctionBody(MutableHandleFunction fun, Handle<PropertyNameVector> formals,
- GeneratorKind generatorKind, FunctionAsyncKind asyncKind);
+ bool compileStandaloneFunction(MutableHandleFunction fun, GeneratorKind generatorKind,
+ FunctionAsyncKind asyncKind,
+ Maybe<uint32_t> parameterListEnd);
ScriptSourceObject* sourceObjectPtr() const;
private:
JSScript* compileScript(HandleObject environment, SharedContext* sc);
bool checkLength();
- bool createScriptSource();
+ bool createScriptSource(Maybe<uint32_t> parameterListEnd);
bool maybeCompressSource();
bool canLazilyParse();
bool createParser();
- bool createSourceAndParser();
+ bool createSourceAndParser(Maybe<uint32_t> parameterListEnd = Nothing());
bool createScript();
bool emplaceEmitter(Maybe<BytecodeEmitter>& emitter, SharedContext* sharedContext);
bool handleParseFailure(const Directives& newDirectives);
@@ -90,7 +92,6 @@ class MOZ_STACK_CLASS BytecodeCompiler
SourceBufferHolder& sourceBuffer;
RootedScope enclosingScope;
- bool sourceArgumentsNotIncluded;
RootedScriptSource sourceObject;
ScriptSource* scriptSource;
@@ -130,7 +131,6 @@ BytecodeCompiler::BytecodeCompiler(ExclusiveContext* cx,
options(options),
sourceBuffer(sourceBuffer),
enclosingScope(cx, enclosingScope),
- sourceArgumentsNotIncluded(false),
sourceObject(cx),
scriptSource(nullptr),
sourceCompressor(nullptr),
@@ -147,12 +147,6 @@ BytecodeCompiler::maybeSetSourceCompressor(SourceCompressionTask* sourceCompress
this->sourceCompressor = sourceCompressor;
}
-void
-BytecodeCompiler::setSourceArgumentsNotIncluded()
-{
- sourceArgumentsNotIncluded = true;
-}
-
bool
BytecodeCompiler::checkLength()
{
@@ -169,12 +163,12 @@ BytecodeCompiler::checkLength()
}
bool
-BytecodeCompiler::createScriptSource()
+BytecodeCompiler::createScriptSource(Maybe<uint32_t> parameterListEnd)
{
if (!checkLength())
return false;
- sourceObject = CreateScriptSourceObject(cx, options);
+ sourceObject = CreateScriptSourceObject(cx, options, parameterListEnd);
if (!sourceObject)
return false;
@@ -193,9 +187,7 @@ BytecodeCompiler::maybeCompressSource()
if (!cx->compartment()->behaviors().discardSource()) {
if (options.sourceIsLazy) {
scriptSource->setSourceRetrievable();
- } else if (!scriptSource->setSourceCopy(cx, sourceBuffer, sourceArgumentsNotIncluded,
- sourceCompressor))
- {
+ } else if (!scriptSource->setSourceCopy(cx, sourceBuffer, sourceCompressor)) {
return false;
}
}
@@ -242,9 +234,9 @@ BytecodeCompiler::createParser()
}
bool
-BytecodeCompiler::createSourceAndParser()
+BytecodeCompiler::createSourceAndParser(Maybe<uint32_t> parameterListEnd /* = Nothing() */)
{
- return createScriptSource() &&
+ return createScriptSource(parameterListEnd) &&
maybeCompressSource() &&
createParser();
}
@@ -344,10 +336,10 @@ BytecodeCompiler::compileScript(HandleObject environment, SharedContext* sc)
if (!deoptimizeArgumentsInEnclosingScripts(cx->asJSContext(), environment))
return nullptr;
}
- if (!NameFunctions(cx, pn))
- return nullptr;
if (!emitter->emitScript(pn))
return nullptr;
+ if (!NameFunctions(cx, pn))
+ return nullptr;
parser->handler.freeTree(pn);
break;
@@ -405,15 +397,15 @@ BytecodeCompiler::compileModule()
if (!pn)
return nullptr;
- if (!NameFunctions(cx, pn))
- return nullptr;
-
Maybe<BytecodeEmitter> emitter;
if (!emplaceEmitter(emitter, &modulesc))
return nullptr;
if (!emitter->emitScript(pn->pn_body))
return nullptr;
+ if (!NameFunctions(cx, pn))
+ return nullptr;
+
parser->handler.freeTree(pn);
if (!builder.initModule())
@@ -432,18 +424,19 @@ BytecodeCompiler::compileModule()
return module;
}
+// Compile a standalone JS function, which might appear as the value of an
+// event handler attribute in an HTML <INPUT> tag, or in a Function()
+// constructor.
bool
-BytecodeCompiler::compileFunctionBody(MutableHandleFunction fun,
- Handle<PropertyNameVector> formals,
- GeneratorKind generatorKind,
- FunctionAsyncKind asyncKind)
+BytecodeCompiler::compileStandaloneFunction(MutableHandleFunction fun,
+ GeneratorKind generatorKind,
+ FunctionAsyncKind asyncKind,
+ Maybe<uint32_t> parameterListEnd)
{
MOZ_ASSERT(fun);
MOZ_ASSERT(fun->isTenured());
- fun->setArgCount(formals.length());
-
- if (!createSourceAndParser())
+ if (!createSourceAndParser(parameterListEnd))
return false;
// Speculatively parse using the default directives implied by the context.
@@ -454,15 +447,12 @@ BytecodeCompiler::compileFunctionBody(MutableHandleFunction fun,
ParseNode* fn;
do {
Directives newDirectives = directives;
- fn = parser->standaloneFunctionBody(fun, enclosingScope, formals, generatorKind, asyncKind,
- directives, &newDirectives);
+ fn = parser->standaloneFunction(fun, enclosingScope, parameterListEnd, generatorKind,
+ asyncKind, directives, &newDirectives);
if (!fn && !handleParseFailure(newDirectives))
return false;
} while (!fn);
- if (!NameFunctions(cx, fn))
- return false;
-
if (fn->pn_funbox->function()->isInterpreted()) {
MOZ_ASSERT(fun == fn->pn_funbox->function());
@@ -479,6 +469,9 @@ BytecodeCompiler::compileFunctionBody(MutableHandleFunction fun,
MOZ_ASSERT(IsAsmJSModule(fun));
}
+ if (!NameFunctions(cx, fn))
+ return false;
+
if (!maybeCompleteCompressSource())
return false;
@@ -492,14 +485,15 @@ BytecodeCompiler::sourceObjectPtr() const
}
ScriptSourceObject*
-frontend::CreateScriptSourceObject(ExclusiveContext* cx, const ReadOnlyCompileOptions& options)
+frontend::CreateScriptSourceObject(ExclusiveContext* cx, const ReadOnlyCompileOptions& options,
+ Maybe<uint32_t> parameterListEnd /* = Nothing() */)
{
ScriptSource* ss = cx->new_<ScriptSource>();
if (!ss)
return nullptr;
ScriptSourceHolder ssHolder(ss);
- if (!ss->initFromOptions(cx, options))
+ if (!ss->initFromOptions(cx, options, parameterListEnd))
return nullptr;
RootedScriptSource sso(cx, ScriptSourceObject::create(cx, ss));
@@ -652,9 +646,6 @@ frontend::CompileLazyFunction(JSContext* cx, Handle<LazyScript*> lazy, const cha
if (!pn)
return false;
- if (!NameFunctions(cx, pn))
- return false;
-
RootedScriptSource sourceObject(cx, lazy->sourceObject());
MOZ_ASSERT(sourceObject);
@@ -673,66 +664,53 @@ frontend::CompileLazyFunction(JSContext* cx, Handle<LazyScript*> lazy, const cha
if (!bce.init())
return false;
- return bce.emitFunctionScript(pn->pn_body);
-}
-
-// Compile a JS function body, which might appear as the value of an event
-// handler attribute in an HTML <INPUT> tag, or in a Function() constructor.
-static bool
-CompileFunctionBody(JSContext* cx, MutableHandleFunction fun, const ReadOnlyCompileOptions& options,
- Handle<PropertyNameVector> formals, SourceBufferHolder& srcBuf,
- HandleScope enclosingScope, GeneratorKind generatorKind,
- FunctionAsyncKind asyncKind)
-{
- MOZ_ASSERT(!options.isRunOnce);
+ if (!bce.emitFunctionScript(pn->pn_body))
+ return false;
- // FIXME: make Function pass in two strings and parse them as arguments and
- // ProgramElements respectively.
+ if (!NameFunctions(cx, pn))
+ return false;
- BytecodeCompiler compiler(cx, cx->tempLifoAlloc(), options, srcBuf, enclosingScope,
- TraceLogger_ParserCompileFunction);
- compiler.setSourceArgumentsNotIncluded();
- return compiler.compileFunctionBody(fun, formals, generatorKind, asyncKind);
+ return true;
}
bool
-frontend::CompileFunctionBody(JSContext* cx, MutableHandleFunction fun,
- const ReadOnlyCompileOptions& options,
- Handle<PropertyNameVector> formals, JS::SourceBufferHolder& srcBuf,
- HandleScope enclosingScope)
+frontend::CompileStandaloneFunction(JSContext* cx, MutableHandleFunction fun,
+ const ReadOnlyCompileOptions& options,
+ JS::SourceBufferHolder& srcBuf,
+ Maybe<uint32_t> parameterListEnd,
+ HandleScope enclosingScope /* = nullptr */)
{
- return CompileFunctionBody(cx, fun, options, formals, srcBuf, enclosingScope, NotGenerator,
- SyncFunction);
-}
+ RootedScope scope(cx, enclosingScope);
+ if (!scope)
+ scope = &cx->global()->emptyGlobalScope();
-bool
-frontend::CompileFunctionBody(JSContext* cx, MutableHandleFunction fun,
- const ReadOnlyCompileOptions& options,
- Handle<PropertyNameVector> formals, JS::SourceBufferHolder& srcBuf)
-{
- RootedScope emptyGlobalScope(cx, &cx->global()->emptyGlobalScope());
- return CompileFunctionBody(cx, fun, options, formals, srcBuf, emptyGlobalScope,
- NotGenerator, SyncFunction);
+ BytecodeCompiler compiler(cx, cx->tempLifoAlloc(), options, srcBuf, scope,
+ TraceLogger_ParserCompileFunction);
+ return compiler.compileStandaloneFunction(fun, NotGenerator, SyncFunction, parameterListEnd);
}
bool
-frontend::CompileStarGeneratorBody(JSContext* cx, MutableHandleFunction fun,
- const ReadOnlyCompileOptions& options,
- Handle<PropertyNameVector> formals,
- JS::SourceBufferHolder& srcBuf)
+frontend::CompileStandaloneGenerator(JSContext* cx, MutableHandleFunction fun,
+ const ReadOnlyCompileOptions& options,
+ JS::SourceBufferHolder& srcBuf,
+ Maybe<uint32_t> parameterListEnd)
{
RootedScope emptyGlobalScope(cx, &cx->global()->emptyGlobalScope());
- return CompileFunctionBody(cx, fun, options, formals, srcBuf, emptyGlobalScope,
- StarGenerator, SyncFunction);
+
+ BytecodeCompiler compiler(cx, cx->tempLifoAlloc(), options, srcBuf, emptyGlobalScope,
+ TraceLogger_ParserCompileFunction);
+ return compiler.compileStandaloneFunction(fun, StarGenerator, SyncFunction, parameterListEnd);
}
bool
-frontend::CompileAsyncFunctionBody(JSContext* cx, MutableHandleFunction fun,
- const ReadOnlyCompileOptions& options,
- Handle<PropertyNameVector> formals,
- JS::SourceBufferHolder& srcBuf)
+frontend::CompileStandaloneAsyncFunction(JSContext* cx, MutableHandleFunction fun,
+ const ReadOnlyCompileOptions& options,
+ JS::SourceBufferHolder& srcBuf,
+ Maybe<uint32_t> parameterListEnd)
{
RootedScope emptyGlobalScope(cx, &cx->global()->emptyGlobalScope());
- return CompileFunctionBody(cx, fun, options, formals, srcBuf, emptyGlobalScope,
- StarGenerator, AsyncFunction);
+
+ BytecodeCompiler compiler(cx, cx->tempLifoAlloc(), options, srcBuf, emptyGlobalScope,
+ TraceLogger_ParserCompileFunction);
+ return compiler.compileStandaloneFunction(fun, StarGenerator, AsyncFunction, parameterListEnd);
}
diff --git a/js/src/frontend/BytecodeCompiler.h b/js/src/frontend/BytecodeCompiler.h
index 1d86f11607..72e9676395 100644
--- a/js/src/frontend/BytecodeCompiler.h
+++ b/js/src/frontend/BytecodeCompiler.h
@@ -7,6 +7,8 @@
#ifndef frontend_BytecodeCompiler_h
#define frontend_BytecodeCompiler_h
+#include "mozilla/Maybe.h"
+
#include "NamespaceImports.h"
#include "vm/Scope.h"
@@ -51,22 +53,36 @@ CompileModule(ExclusiveContext* cx, const ReadOnlyCompileOptions& options,
MOZ_MUST_USE bool
CompileLazyFunction(JSContext* cx, Handle<LazyScript*> lazy, const char16_t* chars, size_t length);
+//
+// Compile a single function. The source in srcBuf must match the ECMA-262
+// FunctionExpression production.
+//
+// If nonzero, parameterListEnd is the offset within srcBuf where the parameter
+// list is expected to end. During parsing, if we find that it ends anywhere
+// else, it's a SyntaxError. This is used to implement the Function constructor;
+// it's how we detect that these weird cases are SyntaxErrors:
+//
+// Function("/*", "*/x) {")
+// Function("x){ if (3", "return x;}")
+//
MOZ_MUST_USE bool
-CompileFunctionBody(JSContext* cx, MutableHandleFunction fun,
- const ReadOnlyCompileOptions& options,
- Handle<PropertyNameVector> formals, JS::SourceBufferHolder& srcBuf,
- HandleScope enclosingScope);
+CompileStandaloneFunction(JSContext* cx, MutableHandleFunction fun,
+ const ReadOnlyCompileOptions& options,
+ JS::SourceBufferHolder& srcBuf,
+ mozilla::Maybe<uint32_t> parameterListEnd,
+ HandleScope enclosingScope = nullptr);
-// As above, but defaults to the global lexical scope as the enclosing scope.
MOZ_MUST_USE bool
-CompileFunctionBody(JSContext* cx, MutableHandleFunction fun,
- const ReadOnlyCompileOptions& options,
- Handle<PropertyNameVector> formals, JS::SourceBufferHolder& srcBuf);
+CompileStandaloneGenerator(JSContext* cx, MutableHandleFunction fun,
+ const ReadOnlyCompileOptions& options,
+ JS::SourceBufferHolder& srcBuf,
+ mozilla::Maybe<uint32_t> parameterListEnd);
MOZ_MUST_USE bool
-CompileStarGeneratorBody(JSContext* cx, MutableHandleFunction fun,
- const ReadOnlyCompileOptions& options,
- Handle<PropertyNameVector> formals, JS::SourceBufferHolder& srcBuf);
+CompileStandaloneAsyncFunction(JSContext* cx, MutableHandleFunction fun,
+ const ReadOnlyCompileOptions& options,
+ JS::SourceBufferHolder& srcBuf,
+ mozilla::Maybe<uint32_t> parameterListEnd);
MOZ_MUST_USE bool
CompileAsyncFunctionBody(JSContext* cx, MutableHandleFunction fun,
@@ -74,7 +90,8 @@ CompileAsyncFunctionBody(JSContext* cx, MutableHandleFunction fun,
Handle<PropertyNameVector> formals, JS::SourceBufferHolder& srcBuf);
ScriptSourceObject*
-CreateScriptSourceObject(ExclusiveContext* cx, const ReadOnlyCompileOptions& options);
+CreateScriptSourceObject(ExclusiveContext* cx, const ReadOnlyCompileOptions& options,
+ mozilla::Maybe<uint32_t> parameterListEnd = mozilla::Nothing());
/*
* True if str consists of an IdentifierStart character, followed by one or
diff --git a/js/src/frontend/BytecodeEmitter.cpp b/js/src/frontend/BytecodeEmitter.cpp
index 1e9d8f2243..c7c615ccfe 100644
--- a/js/src/frontend/BytecodeEmitter.cpp
+++ b/js/src/frontend/BytecodeEmitter.cpp
@@ -58,6 +58,7 @@ using mozilla::Some;
class BreakableControl;
class LabelControl;
class LoopControl;
+class ForOfLoopControl;
class TryFinallyControl;
static bool
@@ -152,6 +153,13 @@ BytecodeEmitter::NestableControl::is<LoopControl>() const
template <>
bool
+BytecodeEmitter::NestableControl::is<ForOfLoopControl>() const
+{
+ return kind_ == StatementKind::ForOfLoop;
+}
+
+template <>
+bool
BytecodeEmitter::NestableControl::is<TryFinallyControl>() const
{
return kind_ == StatementKind::Try || kind_ == StatementKind::Finally;
@@ -236,9 +244,9 @@ class LoopControl : public BreakableControl
loopDepth_ = enclosingLoop ? enclosingLoop->loopDepth_ + 1 : 1;
int loopSlots;
- if (loopKind == StatementKind::Spread)
+ if (loopKind == StatementKind::Spread || loopKind == StatementKind::ForOfLoop)
loopSlots = 3;
- else if (loopKind == StatementKind::ForInLoop || loopKind == StatementKind::ForOfLoop)
+ else if (loopKind == StatementKind::ForInLoop)
loopSlots = 2;
else
loopSlots = 0;
@@ -1053,7 +1061,7 @@ BytecodeEmitter::EmitterScope::enterFunction(BytecodeEmitter* bce, FunctionBox*
if (p) {
MOZ_ASSERT(bi.kind() == BindingKind::FormalParameter);
MOZ_ASSERT(!funbox->hasDestructuringArgs);
- MOZ_ASSERT(!funbox->function()->hasRest());
+ MOZ_ASSERT(!funbox->hasRest());
p->value() = loc;
continue;
}
@@ -1497,6 +1505,659 @@ BytecodeEmitter::TDZCheckCache::noteTDZCheck(BytecodeEmitter* bce, JSAtom* name,
return true;
}
+class MOZ_STACK_CLASS TryEmitter
+{
+ public:
+ enum Kind {
+ TryCatch,
+ TryCatchFinally,
+ TryFinally
+ };
+ enum ShouldUseRetVal {
+ UseRetVal,
+ DontUseRetVal
+ };
+ enum ShouldUseControl {
+ UseControl,
+ DontUseControl,
+ };
+
+ private:
+ BytecodeEmitter* bce_;
+ Kind kind_;
+ ShouldUseRetVal retValKind_;
+
+ // Track jumps-over-catches and gosubs-to-finally for later fixup.
+ //
+ // When a finally block is active, non-local jumps (including
+ // jumps-over-catches) result in a GOSUB being written into the bytecode
+ // stream and fixed-up later.
+ //
+ // If ShouldUseControl is DontUseControl, all that handling is skipped.
+ // DontUseControl is used by yield* and the internal try-catch around
+ // IteratorClose. These internal uses must:
+ // * have only one catch block
+ // * have no catch guard
+ // * have JSOP_GOTO at the end of catch-block
+ // * have no non-local-jump
+ // * don't use finally block for normal completion of try-block and
+ // catch-block
+ //
+ // Additionally, a finally block may be emitted when ShouldUseControl is
+ // DontUseControl, even if the kind is not TryCatchFinally or TryFinally,
+ // because GOSUBs are not emitted. This internal use shares the
+ // requirements as above.
+ Maybe<TryFinallyControl> controlInfo_;
+
+ int depth_;
+ unsigned noteIndex_;
+ ptrdiff_t tryStart_;
+ JumpList catchAndFinallyJump_;
+ JumpTarget tryEnd_;
+ JumpTarget finallyStart_;
+
+ enum State {
+ Start,
+ Try,
+ TryEnd,
+ Catch,
+ CatchEnd,
+ Finally,
+ FinallyEnd,
+ End
+ };
+ State state_;
+
+ bool hasCatch() const {
+ return kind_ == TryCatch || kind_ == TryCatchFinally;
+ }
+ bool hasFinally() const {
+ return kind_ == TryCatchFinally || kind_ == TryFinally;
+ }
+
+ public:
+ TryEmitter(BytecodeEmitter* bce, Kind kind, ShouldUseRetVal retValKind = UseRetVal,
+ ShouldUseControl controlKind = UseControl)
+ : bce_(bce),
+ kind_(kind),
+ retValKind_(retValKind),
+ depth_(0),
+ noteIndex_(0),
+ tryStart_(0),
+ state_(Start)
+ {
+ if (controlKind == UseControl)
+ controlInfo_.emplace(bce_, hasFinally() ? StatementKind::Finally : StatementKind::Try);
+ finallyStart_.offset = 0;
+ }
+
+ bool emitJumpOverCatchAndFinally() {
+ if (!bce_->emitJump(JSOP_GOTO, &catchAndFinallyJump_))
+ return false;
+ return true;
+ }
+
+ bool emitTry() {
+ MOZ_ASSERT(state_ == Start);
+
+ // Since an exception can be thrown at any place inside the try block,
+ // we need to restore the stack and the scope chain before we transfer
+ // the control to the exception handler.
+ //
+ // For that we store in a try note associated with the catch or
+ // finally block the stack depth upon the try entry. The interpreter
+ // uses this depth to properly unwind the stack and the scope chain.
+ depth_ = bce_->stackDepth;
+
+ // Record the try location, then emit the try block.
+ if (!bce_->newSrcNote(SRC_TRY, &noteIndex_))
+ return false;
+ if (!bce_->emit1(JSOP_TRY))
+ return false;
+ tryStart_ = bce_->offset();
+
+ state_ = Try;
+ return true;
+ }
+
+ private:
+ bool emitTryEnd() {
+ MOZ_ASSERT(state_ == Try);
+ MOZ_ASSERT(depth_ == bce_->stackDepth);
+
+ // GOSUB to finally, if present.
+ if (hasFinally() && controlInfo_) {
+ if (!bce_->emitJump(JSOP_GOSUB, &controlInfo_->gosubs))
+ return false;
+ }
+
+ // Source note points to the jump at the end of the try block.
+ if (!bce_->setSrcNoteOffset(noteIndex_, 0, bce_->offset() - tryStart_ + JSOP_TRY_LENGTH))
+ return false;
+
+ // Emit jump over catch and/or finally.
+ if (!bce_->emitJump(JSOP_GOTO, &catchAndFinallyJump_))
+ return false;
+
+ if (!bce_->emitJumpTarget(&tryEnd_))
+ return false;
+
+ return true;
+ }
+
+ public:
+ bool emitCatch() {
+ if (state_ == Try) {
+ if (!emitTryEnd())
+ return false;
+ } else {
+ MOZ_ASSERT(state_ == Catch);
+ if (!emitCatchEnd(true))
+ return false;
+ }
+
+ MOZ_ASSERT(bce_->stackDepth == depth_);
+
+ if (retValKind_ == UseRetVal) {
+ // Clear the frame's return value that might have been set by the
+ // try block:
+ //
+ // eval("try { 1; throw 2 } catch(e) {}"); // undefined, not 1
+ if (!bce_->emit1(JSOP_UNDEFINED))
+ return false;
+ if (!bce_->emit1(JSOP_SETRVAL))
+ return false;
+ }
+
+ state_ = Catch;
+ return true;
+ }
+
+ private:
+ bool emitCatchEnd(bool hasNext) {
+ MOZ_ASSERT(state_ == Catch);
+
+ if (!controlInfo_)
+ return true;
+
+ // gosub <finally>, if required.
+ if (hasFinally()) {
+ if (!bce_->emitJump(JSOP_GOSUB, &controlInfo_->gosubs))
+ return false;
+ MOZ_ASSERT(bce_->stackDepth == depth_);
+ }
+
+ // Jump over the remaining catch blocks. This will get fixed
+ // up to jump to after catch/finally.
+ if (!bce_->emitJump(JSOP_GOTO, &catchAndFinallyJump_))
+ return false;
+
+ // If this catch block had a guard clause, patch the guard jump to
+ // come here.
+ if (controlInfo_->guardJump.offset != -1) {
+ if (!bce_->emitJumpTargetAndPatch(controlInfo_->guardJump))
+ return false;
+ controlInfo_->guardJump.offset = -1;
+
+ // If this catch block is the last one, rethrow, delegating
+ // execution of any finally block to the exception handler.
+ if (!hasNext) {
+ if (!bce_->emit1(JSOP_EXCEPTION))
+ return false;
+ if (!bce_->emit1(JSOP_THROW))
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ public:
+ bool emitFinally(Maybe<uint32_t> finallyPos = Nothing()) {
+ // If we are using controlInfo_ (i.e., emitting a syntactic try
+ // blocks), we must have specified up front if there will be a finally
+ // close. For internal try blocks, like those emitted for yield* and
+ // IteratorClose inside for-of loops, we can emitFinally even without
+ // specifying up front, since the internal try blocks emit no GOSUBs.
+ if (!controlInfo_) {
+ if (kind_ == TryCatch)
+ kind_ = TryCatchFinally;
+ } else {
+ MOZ_ASSERT(hasFinally());
+ }
+
+ if (state_ == Try) {
+ if (!emitTryEnd())
+ return false;
+ } else {
+ MOZ_ASSERT(state_ == Catch);
+ if (!emitCatchEnd(false))
+ return false;
+ }
+
+ MOZ_ASSERT(bce_->stackDepth == depth_);
+
+ if (!bce_->emitJumpTarget(&finallyStart_))
+ return false;
+
+ if (controlInfo_) {
+ // Fix up the gosubs that might have been emitted before non-local
+ // jumps to the finally code.
+ bce_->patchJumpsToTarget(controlInfo_->gosubs, finallyStart_);
+
+ // Indicate that we're emitting a subroutine body.
+ controlInfo_->setEmittingSubroutine();
+ }
+ if (finallyPos) {
+ if (!bce_->updateSourceCoordNotes(finallyPos.value()))
+ return false;
+ }
+ if (!bce_->emit1(JSOP_FINALLY))
+ return false;
+
+ if (retValKind_ == UseRetVal) {
+ if (!bce_->emit1(JSOP_GETRVAL))
+ return false;
+
+ // Clear the frame's return value to make break/continue return
+ // correct value even if there's no other statement before them:
+ //
+ // eval("x: try { 1 } finally { break x; }"); // undefined, not 1
+ if (!bce_->emit1(JSOP_UNDEFINED))
+ return false;
+ if (!bce_->emit1(JSOP_SETRVAL))
+ return false;
+ }
+
+ state_ = Finally;
+ return true;
+ }
+
+ private:
+ bool emitFinallyEnd() {
+ MOZ_ASSERT(state_ == Finally);
+
+ if (retValKind_ == UseRetVal) {
+ if (!bce_->emit1(JSOP_SETRVAL))
+ return false;
+ }
+
+ if (!bce_->emit1(JSOP_RETSUB))
+ return false;
+
+ bce_->hasTryFinally = true;
+ return true;
+ }
+
+ public:
+ bool emitEnd() {
+ if (state_ == Catch) {
+ MOZ_ASSERT(!hasFinally());
+ if (!emitCatchEnd(false))
+ return false;
+ } else {
+ MOZ_ASSERT(state_ == Finally);
+ MOZ_ASSERT(hasFinally());
+ if (!emitFinallyEnd())
+ return false;
+ }
+
+ MOZ_ASSERT(bce_->stackDepth == depth_);
+
+ // ReconstructPCStack needs a NOP here to mark the end of the last
+ // catch block.
+ if (!bce_->emit1(JSOP_NOP))
+ return false;
+
+ // Fix up the end-of-try/catch jumps to come here.
+ if (!bce_->emitJumpTargetAndPatch(catchAndFinallyJump_))
+ return false;
+
+ // Add the try note last, to let post-order give us the right ordering
+ // (first to last for a given nesting level, inner to outer by level).
+ if (hasCatch()) {
+ if (!bce_->tryNoteList.append(JSTRY_CATCH, depth_, tryStart_, tryEnd_.offset))
+ return false;
+ }
+
+ // If we've got a finally, mark try+catch region with additional
+ // trynote to catch exceptions (re)thrown from a catch block or
+ // for the try{}finally{} case.
+ if (hasFinally()) {
+ if (!bce_->tryNoteList.append(JSTRY_FINALLY, depth_, tryStart_, finallyStart_.offset))
+ return false;
+ }
+
+ state_ = End;
+ return true;
+ }
+};
+
+class MOZ_STACK_CLASS IfThenElseEmitter
+{
+ BytecodeEmitter* bce_;
+ JumpList jumpAroundThen_;
+ JumpList jumpsAroundElse_;
+ unsigned noteIndex_;
+ int32_t thenDepth_;
+#ifdef DEBUG
+ int32_t pushed_;
+ bool calculatedPushed_;
+#endif
+ enum State {
+ Start,
+ If,
+ Cond,
+ IfElse,
+ Else,
+ End
+ };
+ State state_;
+
+ public:
+ explicit IfThenElseEmitter(BytecodeEmitter* bce)
+ : bce_(bce),
+ noteIndex_(-1),
+ thenDepth_(0),
+#ifdef DEBUG
+ pushed_(0),
+ calculatedPushed_(false),
+#endif
+ state_(Start)
+ {}
+
+ ~IfThenElseEmitter()
+ {}
+
+ private:
+ bool emitIf(State nextState) {
+ MOZ_ASSERT(state_ == Start || state_ == Else);
+ MOZ_ASSERT(nextState == If || nextState == IfElse || nextState == Cond);
+
+ // Clear jumpAroundThen_ offset that points previous JSOP_IFEQ.
+ if (state_ == Else)
+ jumpAroundThen_ = JumpList();
+
+ // Emit an annotated branch-if-false around the then part.
+ SrcNoteType type = nextState == If ? SRC_IF : nextState == IfElse ? SRC_IF_ELSE : SRC_COND;
+ if (!bce_->newSrcNote(type, &noteIndex_))
+ return false;
+ if (!bce_->emitJump(JSOP_IFEQ, &jumpAroundThen_))
+ return false;
+
+ // To restore stack depth in else part, save depth of the then part.
+#ifdef DEBUG
+ // If DEBUG, this is also necessary to calculate |pushed_|.
+ thenDepth_ = bce_->stackDepth;
+#else
+ if (nextState == IfElse || nextState == Cond)
+ thenDepth_ = bce_->stackDepth;
+#endif
+ state_ = nextState;
+ return true;
+ }
+
+ public:
+ bool emitIf() {
+ return emitIf(If);
+ }
+
+ bool emitCond() {
+ return emitIf(Cond);
+ }
+
+ bool emitIfElse() {
+ return emitIf(IfElse);
+ }
+
+ bool emitElse() {
+ MOZ_ASSERT(state_ == IfElse || state_ == Cond);
+
+ calculateOrCheckPushed();
+
+ // Emit a jump from the end of our then part around the else part. The
+ // patchJumpsToTarget call at the bottom of this function will fix up
+ // the offset with jumpsAroundElse value.
+ if (!bce_->emitJump(JSOP_GOTO, &jumpsAroundElse_))
+ return false;
+
+ // Ensure the branch-if-false comes here, then emit the else.
+ if (!bce_->emitJumpTargetAndPatch(jumpAroundThen_))
+ return false;
+
+ // Annotate SRC_IF_ELSE or SRC_COND with the offset from branch to
+ // jump, for IonMonkey's benefit. We can't just "back up" from the pc
+ // of the else clause, because we don't know whether an extended
+ // jump was required to leap from the end of the then clause over
+ // the else clause.
+ if (!bce_->setSrcNoteOffset(noteIndex_, 0,
+ jumpsAroundElse_.offset - jumpAroundThen_.offset))
+ {
+ return false;
+ }
+
+ // Restore stack depth of the then part.
+ bce_->stackDepth = thenDepth_;
+ state_ = Else;
+ return true;
+ }
+
+ bool emitEnd() {
+ MOZ_ASSERT(state_ == If || state_ == Else);
+
+ calculateOrCheckPushed();
+
+ if (state_ == If) {
+ // No else part, fixup the branch-if-false to come here.
+ if (!bce_->emitJumpTargetAndPatch(jumpAroundThen_))
+ return false;
+ }
+
+ // Patch all the jumps around else parts.
+ if (!bce_->emitJumpTargetAndPatch(jumpsAroundElse_))
+ return false;
+
+ state_ = End;
+ return true;
+ }
+
+ void calculateOrCheckPushed() {
+#ifdef DEBUG
+ if (!calculatedPushed_) {
+ pushed_ = bce_->stackDepth - thenDepth_;
+ calculatedPushed_ = true;
+ } else {
+ MOZ_ASSERT(pushed_ == bce_->stackDepth - thenDepth_);
+ }
+#endif
+ }
+
+#ifdef DEBUG
+ int32_t pushed() const {
+ return pushed_;
+ }
+
+ int32_t popped() const {
+ return -pushed_;
+ }
+#endif
+};
+
+class ForOfLoopControl : public LoopControl
+{
+ // The stack depth of the iterator.
+ int32_t iterDepth_;
+
+ // for-of loops, when throwing from non-iterator code (i.e. from the body
+ // or from evaluating the LHS of the loop condition), need to call
+ // IteratorClose. This is done by enclosing non-iterator code with
+ // try-catch and call IteratorClose in `catch` block.
+ // If IteratorClose itself throws, we must not re-call IteratorClose. Since
+ // non-local jumps like break and return call IteratorClose, whenever a
+ // non-local jump is emitted, we must tell catch block not to perform
+ // IteratorClose.
+ //
+ // for (x of y) {
+ // // Operations for iterator (IteratorNext etc) are outside of
+ // // try-block.
+ // try {
+ // ...
+ // if (...) {
+ // // Before non-local jump, clear iterator on the stack to tell
+ // // catch block not to perform IteratorClose.
+ // tmpIterator = iterator;
+ // iterator = undefined;
+ // IteratorClose(tmpIterator, { break });
+ // break;
+ // }
+ // ...
+ // } catch (e) {
+ // // Just throw again when iterator is cleared by non-local jump.
+ // if (iterator === undefined)
+ // throw e;
+ // IteratorClose(iterator, { throw, e });
+ // }
+ // }
+ Maybe<TryEmitter> tryCatch_;
+
+ // Used to track if any yields were emitted between calls to to
+ // emitBeginCodeNeedingIteratorClose and emitEndCodeNeedingIteratorClose.
+ uint32_t numYieldsAtBeginCodeNeedingIterClose_;
+
+ bool allowSelfHosted_;
+
+ public:
+ ForOfLoopControl(BytecodeEmitter* bce, int32_t iterDepth, bool allowSelfHosted)
+ : LoopControl(bce, StatementKind::ForOfLoop),
+ iterDepth_(iterDepth),
+ numYieldsAtBeginCodeNeedingIterClose_(UINT32_MAX),
+ allowSelfHosted_(allowSelfHosted)
+ {
+ }
+
+ bool emitBeginCodeNeedingIteratorClose(BytecodeEmitter* bce) {
+ tryCatch_.emplace(bce, TryEmitter::TryCatch, TryEmitter::DontUseRetVal,
+ TryEmitter::DontUseControl);
+
+ if (!tryCatch_->emitTry())
+ return false;
+
+ MOZ_ASSERT(numYieldsAtBeginCodeNeedingIterClose_ == UINT32_MAX);
+ numYieldsAtBeginCodeNeedingIterClose_ = bce->yieldOffsetList.numYields;
+
+ return true;
+ }
+
+ bool emitEndCodeNeedingIteratorClose(BytecodeEmitter* bce) {
+ if (!tryCatch_->emitCatch()) // ITER ...
+ return false;
+
+ if (!bce->emit1(JSOP_EXCEPTION)) // ITER ... EXCEPTION
+ return false;
+ unsigned slotFromTop = bce->stackDepth - iterDepth_;
+ if (!bce->emitDupAt(slotFromTop)) // ITER ... EXCEPTION ITER
+ return false;
+
+ // If ITER is undefined, it means the exception is thrown by
+ // IteratorClose for non-local jump, and we should't perform
+ // IteratorClose again here.
+ if (!bce->emit1(JSOP_UNDEFINED)) // ITER ... EXCEPTION ITER UNDEF
+ return false;
+ if (!bce->emit1(JSOP_STRICTNE)) // ITER ... EXCEPTION NE
+ return false;
+
+ IfThenElseEmitter ifIteratorIsNotClosed(bce);
+ if (!ifIteratorIsNotClosed.emitIf()) // ITER ... EXCEPTION
+ return false;
+
+ MOZ_ASSERT(slotFromTop == unsigned(bce->stackDepth - iterDepth_));
+ if (!bce->emitDupAt(slotFromTop)) // ITER ... EXCEPTION ITER
+ return false;
+ if (!emitIteratorClose(bce, CompletionKind::Throw)) // ITER ... EXCEPTION
+ return false;
+
+ if (!ifIteratorIsNotClosed.emitEnd()) // ITER ... EXCEPTION
+ return false;
+
+ if (!bce->emit1(JSOP_THROW)) // ITER ...
+ return false;
+
+ // If any yields were emitted, then this for-of loop is inside a star
+ // generator and must handle the case of Generator.return. Like in
+ // yield*, it is handled with a finally block.
+ uint32_t numYieldsEmitted = bce->yieldOffsetList.numYields;
+ if (numYieldsEmitted > numYieldsAtBeginCodeNeedingIterClose_) {
+ if (!tryCatch_->emitFinally())
+ return false;
+
+ IfThenElseEmitter ifGeneratorClosing(bce);
+ if (!bce->emit1(JSOP_ISGENCLOSING)) // ITER ... FTYPE FVALUE CLOSING
+ return false;
+ if (!ifGeneratorClosing.emitIf()) // ITER ... FTYPE FVALUE
+ return false;
+ if (!bce->emitDupAt(slotFromTop + 1)) // ITER ... FTYPE FVALUE ITER
+ return false;
+ if (!emitIteratorClose(bce, CompletionKind::Normal)) // ITER ... FTYPE FVALUE
+ return false;
+ if (!ifGeneratorClosing.emitEnd()) // ITER ... FTYPE FVALUE
+ return false;
+ }
+
+ if (!tryCatch_->emitEnd())
+ return false;
+
+ tryCatch_.reset();
+ numYieldsAtBeginCodeNeedingIterClose_ = UINT32_MAX;
+
+ return true;
+ }
+
+ bool emitIteratorClose(BytecodeEmitter* bce,
+ CompletionKind completionKind = CompletionKind::Normal) {
+ ptrdiff_t start = bce->offset();
+ if (!bce->emitIteratorClose(completionKind, allowSelfHosted_))
+ return false;
+ ptrdiff_t end = bce->offset();
+ return bce->tryNoteList.append(JSTRY_FOR_OF_ITERCLOSE, 0, start, end);
+ }
+
+ bool emitPrepareForNonLocalJump(BytecodeEmitter* bce, bool isTarget) {
+ // Pop unnecessary values from the stack. Effectively this means
+ // leaving try-catch block. However, the performing IteratorClose can
+ // reach the depth for try-catch, and effectively re-enter the
+ // try-catch block.
+ if (!bce->emit1(JSOP_POP)) // ITER RESULT
+ return false;
+ if (!bce->emit1(JSOP_POP)) // ITER
+ return false;
+
+ // Clear ITER slot on the stack to tell catch block to avoid performing
+ // IteratorClose again.
+ if (!bce->emit1(JSOP_UNDEFINED)) // ITER UNDEF
+ return false;
+ if (!bce->emit1(JSOP_SWAP)) // UNDEF ITER
+ return false;
+
+ if (!emitIteratorClose(bce)) // UNDEF
+ return false;
+
+ if (isTarget) {
+ // At the level of the target block, there's bytecode after the
+ // loop that will pop the iterator and the value, so push
+ // undefineds to balance the stack.
+ if (!bce->emit1(JSOP_UNDEFINED)) // UNDEF UNDEF
+ return false;
+ if (!bce->emit1(JSOP_UNDEFINED)) // UNDEF UNDEF UNDEF
+ return false;
+ } else {
+ if (!bce->emit1(JSOP_POP)) //
+ return false;
+ }
+
+ return true;
+ }
+};
+
BytecodeEmitter::BytecodeEmitter(BytecodeEmitter* parent,
Parser<FullParseHandler>* parser, SharedContext* sc,
HandleScript script, Handle<LazyScript*> lazyScript,
@@ -1855,6 +2516,12 @@ BytecodeEmitter::emitCheckIsObj(CheckIsObjectKind kind)
return emit2(JSOP_CHECKISOBJ, uint8_t(kind));
}
+bool
+BytecodeEmitter::emitCheckIsCallable(CheckIsCallableKind kind)
+{
+ return emit2(JSOP_CHECKISCALLABLE, uint8_t(kind));
+}
+
static inline unsigned
LengthOfSetLine(unsigned line)
{
@@ -2000,35 +2667,45 @@ BytecodeEmitter::emitUint32Operand(JSOp op, uint32_t operand)
return true;
}
-bool
-BytecodeEmitter::flushPops(int* npops)
-{
- MOZ_ASSERT(*npops != 0);
- if (!emitUint16Operand(JSOP_POPN, *npops))
- return false;
-
- *npops = 0;
- return true;
-}
-
namespace {
-class NonLocalExitControl {
+class NonLocalExitControl
+{
+ public:
+ enum Kind
+ {
+ // IteratorClose is handled especially inside the exception unwinder.
+ Throw,
+
+ // A 'continue' statement does not call IteratorClose for the loop it
+ // is continuing, i.e. excluding the target loop.
+ Continue,
+
+ // A 'break' or 'return' statement does call IteratorClose for the
+ // loop it is breaking out of or returning from, i.e. including the
+ // target loop.
+ Break,
+ Return
+ };
+
+ private:
BytecodeEmitter* bce_;
const uint32_t savedScopeNoteIndex_;
const int savedDepth_;
uint32_t openScopeNoteIndex_;
+ Kind kind_;
NonLocalExitControl(const NonLocalExitControl&) = delete;
MOZ_MUST_USE bool leaveScope(BytecodeEmitter::EmitterScope* scope);
public:
- explicit NonLocalExitControl(BytecodeEmitter* bce)
+ NonLocalExitControl(BytecodeEmitter* bce, Kind kind)
: bce_(bce),
savedScopeNoteIndex_(bce->scopeNoteList.length()),
savedDepth_(bce->stackDepth),
- openScopeNoteIndex_(bce->innermostEmitterScope->noteIndex())
+ openScopeNoteIndex_(bce->innermostEmitterScope->noteIndex()),
+ kind_(kind)
{ }
~NonLocalExitControl() {
@@ -2076,9 +2753,16 @@ NonLocalExitControl::prepareForNonLocalJump(BytecodeEmitter::NestableControl* ta
EmitterScope* es = bce_->innermostEmitterScope;
int npops = 0;
+ // For 'continue', 'break', and 'return' statements, emit IteratorClose
+ // bytecode inline. 'continue' statements do not call IteratorClose for
+ // the loop they are continuing.
+ bool emitIteratorClose = kind_ == Continue || kind_ == Break || kind_ == Return;
+ bool emitIteratorCloseAtTarget = emitIteratorClose && kind_ != Continue;
+
auto flushPops = [&npops](BytecodeEmitter* bce) {
- if (npops && !bce->flushPops(&npops))
+ if (npops && !bce->emitUint16Operand(JSOP_POPN, npops))
return false;
+ npops = 0;
return true;
};
@@ -2107,22 +2791,33 @@ NonLocalExitControl::prepareForNonLocalJump(BytecodeEmitter::NestableControl* ta
} else {
if (!flushPops(bce_))
return false;
- if (!bce_->emitJump(JSOP_GOSUB, &finallyControl.gosubs))
+ if (!bce_->emitJump(JSOP_GOSUB, &finallyControl.gosubs)) // ...
return false;
}
break;
}
case StatementKind::ForOfLoop:
- npops += 2;
+ if (emitIteratorClose) {
+ if (!flushPops(bce_))
+ return false;
+
+ ForOfLoopControl& loopinfo = control->as<ForOfLoopControl>();
+ if (!loopinfo.emitPrepareForNonLocalJump(bce_, /* isTarget = */ false)) // ...
+ return false;
+ } else {
+ npops += 3;
+ }
break;
case StatementKind::ForInLoop:
- /* The iterator and the current value are on the stack. */
- npops += 1;
if (!flushPops(bce_))
return false;
- if (!bce_->emit1(JSOP_ENDITER))
+
+ // The iterator and the current value are on the stack.
+ if (!bce_->emit1(JSOP_POP)) // ... ITER
+ return false;
+ if (!bce_->emit1(JSOP_ENDITER)) // ...
return false;
break;
@@ -2131,13 +2826,22 @@ NonLocalExitControl::prepareForNonLocalJump(BytecodeEmitter::NestableControl* ta
}
}
+ if (!flushPops(bce_))
+ return false;
+
+ if (target && emitIteratorCloseAtTarget && target->is<ForOfLoopControl>()) {
+ ForOfLoopControl& loopinfo = target->as<ForOfLoopControl>();
+ if (!loopinfo.emitPrepareForNonLocalJump(bce_, /* isTarget = */ true)) // ... UNDEF UNDEF UNDEF
+ return false;
+ }
+
EmitterScope* targetEmitterScope = target ? target->emitterScope() : bce_->varEmitterScope;
for (; es != targetEmitterScope; es = es->enclosingInFrame()) {
if (!leaveScope(es))
return false;
}
- return flushPops(bce_);
+ return true;
}
} // anonymous namespace
@@ -2145,7 +2849,9 @@ NonLocalExitControl::prepareForNonLocalJump(BytecodeEmitter::NestableControl* ta
bool
BytecodeEmitter::emitGoto(NestableControl* target, JumpList* jumplist, SrcNoteType noteType)
{
- NonLocalExitControl nle(this);
+ NonLocalExitControl nle(this, noteType == SRC_CONTINUE
+ ? NonLocalExitControl::Continue
+ : NonLocalExitControl::Break);
if (!nle.prepareForNonLocalJump(target))
return false;
@@ -4070,7 +4776,7 @@ BytecodeEmitter::isRunOnceLambda()
FunctionBox* funbox = sc->asFunctionBox();
return !funbox->argumentsHasLocalBinding() &&
!funbox->isGenerator() &&
- !funbox->function()->name();
+ !funbox->function()->explicitName();
}
bool
@@ -4091,6 +4797,11 @@ BytecodeEmitter::emitYieldOp(JSOp op)
return false;
}
+ if (op == JSOP_YIELD)
+ yieldOffsetList.numYields++;
+ else
+ yieldOffsetList.numAwaits++;
+
SET_UINT24(code(off), yieldIndex);
if (!yieldOffsetList.append(offset()))
@@ -4325,7 +5036,69 @@ BytecodeEmitter::emitDestructuringDeclsWithEmitter(ParseNode* pattern, NameEmitt
}
bool
-BytecodeEmitter::emitDestructuringLHS(ParseNode* target, DestructuringFlavor flav)
+BytecodeEmitter::emitDestructuringLHSRef(ParseNode* target, size_t* emitted)
+{
+ *emitted = 0;
+
+ if (target->isKind(PNK_SPREAD))
+ target = target->pn_kid;
+ else if (target->isKind(PNK_ASSIGN))
+ target = target->pn_left;
+
+ // No need to recur into PNK_ARRAY and PNK_OBJECT subpatterns here, since
+ // emitSetOrInitializeDestructuring does the recursion when setting or
+ // initializing value. Getting reference doesn't recur.
+ if (target->isKind(PNK_NAME) || target->isKind(PNK_ARRAY) || target->isKind(PNK_OBJECT))
+ return true;
+
+#ifdef DEBUG
+ int depth = stackDepth;
+#endif
+
+ switch (target->getKind()) {
+ case PNK_DOT: {
+ if (target->as<PropertyAccess>().isSuper()) {
+ if (!emitSuperPropLHS(&target->as<PropertyAccess>().expression()))
+ return false;
+ *emitted = 2;
+ } else {
+ if (!emitTree(target->pn_expr))
+ return false;
+ *emitted = 1;
+ }
+ break;
+ }
+
+ case PNK_ELEM: {
+ if (target->as<PropertyByValue>().isSuper()) {
+ if (!emitSuperElemOperands(target, EmitElemOption::Ref))
+ return false;
+ *emitted = 3;
+ } else {
+ if (!emitElemOperands(target, EmitElemOption::Ref))
+ return false;
+ *emitted = 2;
+ }
+ break;
+ }
+
+ case PNK_CALL:
+ MOZ_ASSERT_UNREACHABLE("Parser::reportIfNotValidSimpleAssignmentTarget "
+ "rejects function calls as assignment "
+ "targets in destructuring assignments");
+ break;
+
+ default:
+ MOZ_CRASH("emitDestructuringLHSRef: bad lhs kind");
+ }
+
+ MOZ_ASSERT(stackDepth == depth + int(*emitted));
+
+ return true;
+}
+
+bool
+BytecodeEmitter::emitSetOrInitializeDestructuring(ParseNode* target, DestructuringFlavor flav)
{
// Now emit the lvalue opcode sequence. If the lvalue is a nested
// destructuring initialiser-form, call ourselves to handle it, then pop
@@ -4401,44 +5174,28 @@ BytecodeEmitter::emitDestructuringLHS(ParseNode* target, DestructuringFlavor fla
}
case PNK_DOT: {
- // See the (PNK_NAME, JSOP_SETNAME) case above.
- //
- // In `a.x = b`, `a` is evaluated first, then `b`, then a
- // JSOP_SETPROP instruction.
- //
- // In `[a.x] = [b]`, per spec, `b` is evaluated before `a`. Then we
- // need a property set -- but the operands are on the stack in the
- // wrong order for JSOP_SETPROP, so we have to add a JSOP_SWAP.
+ // The reference is already pushed by emitDestructuringLHSRef.
JSOp setOp;
- if (target->as<PropertyAccess>().isSuper()) {
- if (!emitSuperPropLHS(&target->as<PropertyAccess>().expression()))
- return false;
- if (!emit2(JSOP_PICK, 2))
- return false;
+ if (target->as<PropertyAccess>().isSuper())
setOp = sc->strict() ? JSOP_STRICTSETPROP_SUPER : JSOP_SETPROP_SUPER;
- } else {
- if (!emitTree(target->pn_expr))
- return false;
- if (!emit1(JSOP_SWAP))
- return false;
+ else
setOp = sc->strict() ? JSOP_STRICTSETPROP : JSOP_SETPROP;
- }
if (!emitAtomOp(target, setOp))
return false;
break;
}
case PNK_ELEM: {
- // See the comment at `case PNK_DOT:` above. This case,
- // `[a[x]] = [b]`, is handled much the same way. The JSOP_SWAP
- // is emitted by emitElemOperands.
+ // The reference is already pushed by emitDestructuringLHSRef.
if (target->as<PropertyByValue>().isSuper()) {
JSOp setOp = sc->strict() ? JSOP_STRICTSETELEM_SUPER : JSOP_SETELEM_SUPER;
- if (!emitSuperElemOp(target, setOp))
+ // emitDestructuringLHSRef already did emitSuperElemOperands
+ // part of emitSuperElemOp. Perform remaining part here.
+ if (!emitElemOpBase(setOp))
return false;
} else {
JSOp setOp = sc->strict() ? JSOP_STRICTSETELEM : JSOP_SETELEM;
- if (!emitElemOp(target, setOp))
+ if (!emitElemOpBase(setOp))
return false;
}
break;
@@ -4451,7 +5208,7 @@ BytecodeEmitter::emitDestructuringLHS(ParseNode* target, DestructuringFlavor fla
break;
default:
- MOZ_CRASH("emitDestructuringLHS: bad lhs kind");
+ MOZ_CRASH("emitSetOrInitializeDestructuring: bad lhs kind");
}
// Pop the assigned value.
@@ -4463,14 +5220,7 @@ BytecodeEmitter::emitDestructuringLHS(ParseNode* target, DestructuringFlavor fla
}
bool
-BytecodeEmitter::emitConditionallyExecutedDestructuringLHS(ParseNode* target, DestructuringFlavor flav)
-{
- TDZCheckCache tdzCache(this);
- return emitDestructuringLHS(target, flav);
-}
-
-bool
-BytecodeEmitter::emitIteratorNext(ParseNode* pn, bool allowSelfHosted)
+BytecodeEmitter::emitIteratorNext(ParseNode* pn, bool allowSelfHosted /* = false */)
{
MOZ_ASSERT(allowSelfHosted || emitterMode != BytecodeEmitter::SelfHosting,
".next() iteration is prohibited in self-hosted code because it "
@@ -4491,178 +5241,241 @@ BytecodeEmitter::emitIteratorNext(ParseNode* pn, bool allowSelfHosted)
}
bool
-BytecodeEmitter::emitDefault(ParseNode* defaultExpr)
+BytecodeEmitter::emitIteratorClose(CompletionKind completionKind /* = CompletionKind::Normal */,
+ bool allowSelfHosted /* = false */)
{
- if (!emit1(JSOP_DUP)) // VALUE VALUE
- return false;
- if (!emit1(JSOP_UNDEFINED)) // VALUE VALUE UNDEFINED
- return false;
- if (!emit1(JSOP_STRICTEQ)) // VALUE EQL?
+ MOZ_ASSERT(allowSelfHosted || emitterMode != BytecodeEmitter::SelfHosting,
+ ".close() on iterators is prohibited in self-hosted code because it "
+ "can run user-modifiable iteration code");
+
+ // Generate inline logic corresponding to IteratorClose (ES 7.4.6).
+ //
+ // Callers need to ensure that the iterator object is at the top of the
+ // stack.
+
+ if (!emit1(JSOP_DUP)) // ... ITER ITER
return false;
- // Emit source note to enable ion compilation.
- if (!newSrcNote(SRC_IF))
+
+ // Step 3.
+ //
+ // Get the "return" method.
+ if (!emitAtomOp(cx->names().return_, JSOP_CALLPROP)) // ... ITER RET
return false;
- JumpList jump;
- if (!emitJump(JSOP_IFEQ, &jump)) // VALUE
+
+ // Step 4.
+ //
+ // Do nothing if "return" is null or undefined.
+ IfThenElseEmitter ifReturnMethodIsDefined(this);
+ if (!emit1(JSOP_DUP)) // ... ITER RET RET
return false;
- if (!emit1(JSOP_POP)) // .
+ if (!emit1(JSOP_UNDEFINED)) // ... ITER RET RET UNDEFINED
return false;
- if (!emitConditionallyExecutedTree(defaultExpr)) // DEFAULTVALUE
+ if (!emit1(JSOP_NE)) // ... ITER RET ?NEQL
return false;
- if (!emitJumpTargetAndPatch(jump))
+ if (!ifReturnMethodIsDefined.emitIfElse())
return false;
- return true;
-}
-
-class MOZ_STACK_CLASS IfThenElseEmitter
-{
- BytecodeEmitter* bce_;
- JumpList jumpAroundThen_;
- JumpList jumpsAroundElse_;
- unsigned noteIndex_;
- int32_t thenDepth_;
-#ifdef DEBUG
- int32_t pushed_;
- bool calculatedPushed_;
-#endif
- enum State {
- Start,
- If,
- Cond,
- IfElse,
- Else,
- End
- };
- State state_;
- public:
- explicit IfThenElseEmitter(BytecodeEmitter* bce)
- : bce_(bce),
- noteIndex_(-1),
- thenDepth_(0),
-#ifdef DEBUG
- pushed_(0),
- calculatedPushed_(false),
-#endif
- state_(Start)
- {}
+ if (completionKind == CompletionKind::Throw) {
+ // 7.4.6 IteratorClose ( iterator, completion )
+ // ...
+ // 3. Let return be ? GetMethod(iterator, "return").
+ // 4. If return is undefined, return Completion(completion).
+ // 5. Let innerResult be Call(return, iterator, « »).
+ // 6. If completion.[[Type]] is throw, return Completion(completion).
+ // 7. If innerResult.[[Type]] is throw, return
+ // Completion(innerResult).
+ //
+ // For CompletionKind::Normal case, JSOP_CALL for step 5 checks if RET
+ // is callable, and throws if not. Since step 6 doesn't match and
+ // error handling in step 3 and step 7 can be merged.
+ //
+ // For CompletionKind::Throw case, an error thrown by JSOP_CALL for
+ // step 5 is ignored by try-catch. So we should check if RET is
+ // callable here, outside of try-catch, and the throw immediately if
+ // not.
+ CheckIsCallableKind kind = CheckIsCallableKind::IteratorReturn;
+ if (!emitCheckIsCallable(kind)) // ... ITER RET
+ return false;
+ }
- ~IfThenElseEmitter()
- {}
+ // Steps 5, 8.
+ //
+ // Call "return" if it is not undefined or null, and check that it returns
+ // an Object.
+ if (!emit1(JSOP_SWAP)) // ... RET ITER
+ return false;
- private:
- bool emitIf(State nextState) {
- MOZ_ASSERT(state_ == Start || state_ == Else);
- MOZ_ASSERT(nextState == If || nextState == IfElse || nextState == Cond);
+ Maybe<TryEmitter> tryCatch;
- // Clear jumpAroundThen_ offset that points previous JSOP_IFEQ.
- if (state_ == Else)
- jumpAroundThen_ = JumpList();
+ if (completionKind == CompletionKind::Throw) {
+ tryCatch.emplace(this, TryEmitter::TryCatch, TryEmitter::DontUseRetVal,
+ TryEmitter::DontUseControl);
- // Emit an annotated branch-if-false around the then part.
- SrcNoteType type = nextState == If ? SRC_IF : nextState == IfElse ? SRC_IF_ELSE : SRC_COND;
- if (!bce_->newSrcNote(type, &noteIndex_))
+ // Mutate stack to balance stack for try-catch.
+ if (!emit1(JSOP_UNDEFINED)) // ... RET ITER UNDEF
return false;
- if (!bce_->emitJump(JSOP_IFEQ, &jumpAroundThen_))
+ if (!tryCatch->emitTry()) // ... RET ITER UNDEF
+ return false;
+ if (!emitDupAt(2)) // ... RET ITER UNDEF RET
+ return false;
+ if (!emitDupAt(2)) // ... RET ITER UNDEF RET ITER
return false;
-
- // To restore stack depth in else part, save depth of the then part.
-#ifdef DEBUG
- // If DEBUG, this is also necessary to calculate |pushed_|.
- thenDepth_ = bce_->stackDepth;
-#else
- if (nextState == IfElse || nextState == Cond)
- thenDepth_ = bce_->stackDepth;
-#endif
- state_ = nextState;
- return true;
- }
-
- public:
- bool emitIf() {
- return emitIf(If);
- }
-
- bool emitCond() {
- return emitIf(Cond);
- }
-
- bool emitIfElse() {
- return emitIf(IfElse);
}
- bool emitElse() {
- MOZ_ASSERT(state_ == IfElse || state_ == Cond);
+ if (!emitCall(JSOP_CALL, 0)) // ... ... RESULT
+ return false;
+ checkTypeSet(JSOP_CALL);
- calculateOrCheckPushed();
+ if (completionKind == CompletionKind::Throw) {
+ if (!emit1(JSOP_SWAP)) // ... RET ITER RESULT UNDEF
+ return false;
+ if (!emit1(JSOP_POP)) // ... RET ITER RESULT
+ return false;
- // Emit a jump from the end of our then part around the else part. The
- // patchJumpsToTarget call at the bottom of this function will fix up
- // the offset with jumpsAroundElse value.
- if (!bce_->emitJump(JSOP_GOTO, &jumpsAroundElse_))
+ if (!tryCatch->emitCatch()) // ... RET ITER RESULT
return false;
- // Ensure the branch-if-false comes here, then emit the else.
- if (!bce_->emitJumpTargetAndPatch(jumpAroundThen_))
+ // Just ignore the exception thrown by call.
+ if (!emit1(JSOP_EXCEPTION)) // ... RET ITER RESULT EXC
+ return false;
+ if (!emit1(JSOP_POP)) // ... RET ITER RESULT
return false;
- // Annotate SRC_IF_ELSE or SRC_COND with the offset from branch to
- // jump, for IonMonkey's benefit. We can't just "back up" from the pc
- // of the else clause, because we don't know whether an extended
- // jump was required to leap from the end of the then clause over
- // the else clause.
- if (!bce_->setSrcNoteOffset(noteIndex_, 0,
- jumpsAroundElse_.offset - jumpAroundThen_.offset))
- {
+ if (!tryCatch->emitEnd()) // ... RET ITER RESULT
return false;
- }
- // Restore stack depth of the then part.
- bce_->stackDepth = thenDepth_;
- state_ = Else;
- return true;
+ // Restore stack.
+ if (!emit2(JSOP_UNPICK, 2)) // ... RESULT RET ITER
+ return false;
+ if (!emit1(JSOP_POP)) // ... RESULT RET
+ return false;
+ if (!emit1(JSOP_POP)) // ... RESULT
+ return false;
+ } else {
+ if (!emitCheckIsObj(CheckIsObjectKind::IteratorReturn)) // ... RESULT
+ return false;
}
- bool emitEnd() {
- MOZ_ASSERT(state_ == If || state_ == Else);
+ if (!ifReturnMethodIsDefined.emitElse())
+ return false;
+ if (!emit1(JSOP_POP)) // ... ITER
+ return false;
+ if (!ifReturnMethodIsDefined.emitEnd())
+ return false;
- calculateOrCheckPushed();
+ return emit1(JSOP_POP); // ...
+}
- if (state_ == If) {
- // No else part, fixup the branch-if-false to come here.
- if (!bce_->emitJumpTargetAndPatch(jumpAroundThen_))
+template <typename InnerEmitter>
+bool
+BytecodeEmitter::wrapWithDestructuringIteratorCloseTryNote(int32_t iterDepth, InnerEmitter emitter)
+{
+ MOZ_ASSERT(this->stackDepth >= iterDepth);
+
+ // Pad a nop at the beginning of the bytecode covered by the trynote so
+ // that when unwinding environments, we may unwind to the scope
+ // corresponding to the pc *before* the start, in case the first bytecode
+ // emitted by |emitter| is the start of an inner scope. See comment above
+ // UnwindEnvironmentToTryPc.
+ if (!emit1(JSOP_TRY_DESTRUCTURING_ITERCLOSE))
+ return false;
+
+ ptrdiff_t start = offset();
+ if (!emitter(this))
+ return false;
+ ptrdiff_t end = offset();
+ if (start != end)
+ return tryNoteList.append(JSTRY_DESTRUCTURING_ITERCLOSE, iterDepth, start, end);
+ return true;
+}
+
+bool
+BytecodeEmitter::emitDefault(ParseNode* defaultExpr, ParseNode* pattern)
+{
+ if (!emit1(JSOP_DUP)) // VALUE VALUE
+ return false;
+ if (!emit1(JSOP_UNDEFINED)) // VALUE VALUE UNDEFINED
+ return false;
+ if (!emit1(JSOP_STRICTEQ)) // VALUE EQL?
+ return false;
+ // Emit source note to enable ion compilation.
+ if (!newSrcNote(SRC_IF))
+ return false;
+ JumpList jump;
+ if (!emitJump(JSOP_IFEQ, &jump)) // VALUE
+ return false;
+ if (!emit1(JSOP_POP)) // .
+ return false;
+ if (!emitInitializerInBranch(defaultExpr, pattern)) // DEFAULTVALUE
+ return false;
+ if (!emitJumpTargetAndPatch(jump))
+ return false;
+ return true;
+}
+
+bool
+BytecodeEmitter::setOrEmitSetFunName(ParseNode* maybeFun, HandleAtom name,
+ FunctionPrefixKind prefixKind)
+{
+ if (maybeFun->isKind(PNK_FUNCTION)) {
+ // Function doesn't have 'name' property at this point.
+ // Set function's name at compile time.
+ RootedFunction fun(cx, maybeFun->pn_funbox->function());
+
+ // Single node can be emitted multiple times if it appears in
+ // array destructuring default. If function already has a name,
+ // just return.
+ if (fun->hasCompileTimeName()) {
+#ifdef DEBUG
+ RootedAtom funName(cx, NameToFunctionName(cx, name, prefixKind));
+ if (!funName)
return false;
+ MOZ_ASSERT(funName == maybeFun->pn_funbox->function()->compileTimeName());
+#endif
+ return true;
}
- // Patch all the jumps around else parts.
- if (!bce_->emitJumpTargetAndPatch(jumpsAroundElse_))
+ RootedAtom funName(cx, NameToFunctionName(cx, name, prefixKind));
+ if (!funName)
return false;
-
- state_ = End;
+ fun->setCompileTimeName(name);
return true;
}
- void calculateOrCheckPushed() {
-#ifdef DEBUG
- if (!calculatedPushed_) {
- pushed_ = bce_->stackDepth - thenDepth_;
- calculatedPushed_ = true;
- } else {
- MOZ_ASSERT(pushed_ == bce_->stackDepth - thenDepth_);
- }
-#endif
- }
+ uint32_t nameIndex;
+ if (!makeAtomIndex(name, &nameIndex))
+ return false;
+ if (!emitIndexOp(JSOP_STRING, nameIndex)) // FUN NAME
+ return false;
+ uint8_t kind = uint8_t(prefixKind);
+ if (!emit2(JSOP_SETFUNNAME, kind)) // FUN
+ return false;
+ return true;
+}
-#ifdef DEBUG
- int32_t pushed() const {
- return pushed_;
- }
+bool
+BytecodeEmitter::emitInitializer(ParseNode* initializer, ParseNode* pattern)
+{
+ if (!emitTree(initializer))
+ return false;
- int32_t popped() const {
- return -pushed_;
+ if (!pattern->isInParens() && pattern->isKind(PNK_NAME) &&
+ initializer->isDirectRHSAnonFunction())
+ {
+ RootedAtom name(cx, pattern->name());
+ if (!setOrEmitSetFunName(initializer, name, FunctionPrefixKind::None))
+ return false;
}
-#endif
-};
+
+ return true;
+}
+
+bool
+BytecodeEmitter::emitInitializerInBranch(ParseNode* initializer, ParseNode* pattern)
+{
+ TDZCheckCache tdzCache(this);
+ return emitInitializer(initializer, pattern);
+}
bool
BytecodeEmitter::emitDestructuringOpsArray(ParseNode* pattern, DestructuringFlavor flav)
@@ -4673,240 +5486,304 @@ BytecodeEmitter::emitDestructuringOpsArray(ParseNode* pattern, DestructuringFlav
// Here's pseudo code for |let [a, b, , c=y, ...d] = x;|
//
+ // Lines that are annotated "covered by trynote" mean that upon throwing
+ // an exception, IteratorClose is called on iter only if done is false.
+ //
// let x, y;
// let a, b, c, d;
- // let tmp, done, iter, result; // stack values
+ // let iter, lref, result, done, value; // stack values
//
// iter = x[Symbol.iterator]();
//
// // ==== emitted by loop for a ====
+ // lref = GetReference(a); // covered by trynote
+ //
// result = iter.next();
// done = result.done;
//
- // if (done) {
- // a = undefined;
+ // if (done)
+ // value = undefined;
+ // else
+ // value = result.value;
//
- // result = undefined;
- // done = true;
- // } else {
- // a = result.value;
- //
- // // Do next element's .next() and .done access here
- // result = iter.next();
- // done = result.done;
- // }
+ // SetOrInitialize(lref, value); // covered by trynote
//
// // ==== emitted by loop for b ====
- // if (done) {
- // b = undefined;
+ // lref = GetReference(b); // covered by trynote
//
- // result = undefined;
- // done = true;
+ // if (done) {
+ // value = undefined;
// } else {
- // b = result.value;
- //
// result = iter.next();
// done = result.done;
+ // if (done)
+ // value = undefined;
+ // else
+ // value = result.value;
// }
//
+ // SetOrInitialize(lref, value); // covered by trynote
+ //
// // ==== emitted by loop for elision ====
// if (done) {
- // result = undefined
- // done = true
+ // value = undefined;
// } else {
- // result.value;
- //
// result = iter.next();
// done = result.done;
+ // if (done)
+ // value = undefined;
+ // else
+ // value = result.value;
// }
//
// // ==== emitted by loop for c ====
+ // lref = GetReference(c); // covered by trynote
+ //
// if (done) {
- // c = y;
+ // value = undefined;
// } else {
- // tmp = result.value;
- // if (tmp === undefined)
- // tmp = y;
- // c = tmp;
- //
- // // Don't do next element's .next() and .done access if
- // // this is the last non-spread element.
+ // result = iter.next();
+ // done = result.done;
+ // if (done)
+ // value = undefined;
+ // else
+ // value = result.value;
// }
//
+ // if (value === undefined)
+ // value = y; // covered by trynote
+ //
+ // SetOrInitialize(lref, value); // covered by trynote
+ //
// // ==== emitted by loop for d ====
- // if (done) {
- // // Assing empty array when completed
- // d = [];
- // } else {
- // d = [...iter];
- // }
+ // lref = GetReference(d); // covered by trynote
+ //
+ // if (done)
+ // value = [];
+ // else
+ // value = [...iter];
+ //
+ // SetOrInitialize(lref, value); // covered by trynote
+ //
+ // // === emitted after loop ===
+ // if (!done)
+ // IteratorClose(iter);
- /*
- * Use an iterator to destructure the RHS, instead of index lookup. We
- * must leave the *original* value on the stack.
- */
+ // Use an iterator to destructure the RHS, instead of index lookup. We
+ // must leave the *original* value on the stack.
if (!emit1(JSOP_DUP)) // ... OBJ OBJ
return false;
- if (!emitIterator()) // ... OBJ? ITER
+ if (!emitIterator()) // ... OBJ ITER
+ return false;
+
+ // For an empty pattern [], call IteratorClose unconditionally. Nothing
+ // else needs to be done.
+ if (!pattern->pn_head)
+ return emitIteratorClose(); // ... OBJ
+
+ // Push an initial FALSE value for DONE.
+ if (!emit1(JSOP_FALSE)) // ... OBJ ITER FALSE
return false;
- bool needToPopIterator = true;
+
+ // JSTRY_DESTRUCTURING_ITERCLOSE expects the iterator and the done value
+ // to be the second to top and the top of the stack, respectively.
+ // IteratorClose is called upon exception only if done is false.
+ int32_t tryNoteDepth = stackDepth;
for (ParseNode* member = pattern->pn_head; member; member = member->pn_next) {
- bool isHead = member == pattern->pn_head;
+ bool isFirst = member == pattern->pn_head;
+ DebugOnly<bool> hasNext = !!member->pn_next;
+
+ size_t emitted = 0;
+
+ // Spec requires LHS reference to be evaluated first.
+ ParseNode* lhsPattern = member;
+ if (lhsPattern->isKind(PNK_ASSIGN))
+ lhsPattern = lhsPattern->pn_left;
+
+ bool isElision = lhsPattern->isKind(PNK_ELISION);
+ if (!isElision) {
+ auto emitLHSRef = [lhsPattern, &emitted](BytecodeEmitter* bce) {
+ return bce->emitDestructuringLHSRef(lhsPattern, &emitted); // ... OBJ ITER DONE *LREF
+ };
+ if (!wrapWithDestructuringIteratorCloseTryNote(tryNoteDepth, emitLHSRef))
+ return false;
+ }
+
+ // Pick the DONE value to the top of the stack.
+ if (emitted) {
+ if (!emit2(JSOP_PICK, emitted)) // ... OBJ ITER *LREF DONE
+ return false;
+ }
+
+ if (isFirst) {
+ // If this element is the first, DONE is always FALSE, so pop it.
+ //
+ // Non-first elements should emit if-else depending on the
+ // member pattern, below.
+ if (!emit1(JSOP_POP)) // ... OBJ ITER *LREF
+ return false;
+ }
+
if (member->isKind(PNK_SPREAD)) {
IfThenElseEmitter ifThenElse(this);
- if (!isHead) {
+ if (!isFirst) {
// If spread is not the first element of the pattern,
// iterator can already be completed.
- if (!ifThenElse.emitIfElse()) // ... OBJ? ITER
+ // ... OBJ ITER *LREF DONE
+ if (!ifThenElse.emitIfElse()) // ... OBJ ITER *LREF
return false;
- if (!emit1(JSOP_POP)) // ... OBJ?
- return false;
- if (!emitUint32Operand(JSOP_NEWARRAY, 0)) // ... OBJ? ARRAY
- return false;
- if (!emitConditionallyExecutedDestructuringLHS(member, flav)) // ... OBJ?
+ if (!emitUint32Operand(JSOP_NEWARRAY, 0)) // ... OBJ ITER *LREF ARRAY
return false;
-
- if (!ifThenElse.emitElse()) // ... OBJ? ITER
+ if (!ifThenElse.emitElse()) // ... OBJ ITER *LREF
return false;
}
// If iterator is not completed, create a new array with the rest
// of the iterator.
- if (!emitUint32Operand(JSOP_NEWARRAY, 0)) // ... OBJ? ITER ARRAY
+ if (!emitDupAt(emitted)) // ... OBJ ITER *LREF ITER
return false;
- if (!emitNumberOp(0)) // ... OBJ? ITER ARRAY INDEX
+ if (!emitUint32Operand(JSOP_NEWARRAY, 0)) // ... OBJ ITER *LREF ITER ARRAY
return false;
- if (!emitSpread()) // ... OBJ? ARRAY INDEX
+ if (!emitNumberOp(0)) // ... OBJ ITER *LREF ITER ARRAY INDEX
return false;
- if (!emit1(JSOP_POP)) // ... OBJ? ARRAY
+ if (!emitSpread()) // ... OBJ ITER *LREF ARRAY INDEX
return false;
- if (!emitConditionallyExecutedDestructuringLHS(member, flav)) // ... OBJ?
+ if (!emit1(JSOP_POP)) // ... OBJ ITER *LREF ARRAY
return false;
- if (!isHead) {
+ if (!isFirst) {
if (!ifThenElse.emitEnd())
return false;
- MOZ_ASSERT(ifThenElse.popped() == 1);
+ MOZ_ASSERT(ifThenElse.pushed() == 1);
}
- needToPopIterator = false;
- MOZ_ASSERT(!member->pn_next);
+
+ // At this point the iterator is done. Unpick a TRUE value for DONE above ITER.
+ if (!emit1(JSOP_TRUE)) // ... OBJ ITER *LREF ARRAY TRUE
+ return false;
+ if (!emit2(JSOP_UNPICK, emitted + 1)) // ... OBJ ITER TRUE *LREF ARRAY
+ return false;
+
+ auto emitAssignment = [member, flav](BytecodeEmitter* bce) {
+ return bce->emitSetOrInitializeDestructuring(member, flav); // ... OBJ ITER TRUE
+ };
+ if (!wrapWithDestructuringIteratorCloseTryNote(tryNoteDepth, emitAssignment))
+ return false;
+
+ MOZ_ASSERT(!hasNext);
break;
}
ParseNode* pndefault = nullptr;
- ParseNode* subpattern = member;
- if (subpattern->isKind(PNK_ASSIGN)) {
- pndefault = subpattern->pn_right;
- subpattern = subpattern->pn_left;
- }
+ if (member->isKind(PNK_ASSIGN))
+ pndefault = member->pn_right;
- bool isElision = subpattern->isKind(PNK_ELISION);
- bool hasNextNonSpread = member->pn_next && !member->pn_next->isKind(PNK_SPREAD);
- bool hasNextSpread = member->pn_next && member->pn_next->isKind(PNK_SPREAD);
+ MOZ_ASSERT(!member->isKind(PNK_SPREAD));
- MOZ_ASSERT(!subpattern->isKind(PNK_SPREAD));
+ IfThenElseEmitter ifAlreadyDone(this);
+ if (!isFirst) {
+ // ... OBJ ITER *LREF DONE
+ if (!ifAlreadyDone.emitIfElse()) // ... OBJ ITER *LREF
+ return false;
- auto emitNext = [pattern](ExclusiveContext* cx, BytecodeEmitter* bce) {
- if (!bce->emit1(JSOP_DUP)) // ... OBJ? ITER ITER
+ if (!emit1(JSOP_UNDEFINED)) // ... OBJ ITER *LREF UNDEF
return false;
- if (!bce->emitIteratorNext(pattern)) // ... OBJ? ITER RESULT
+ if (!emit1(JSOP_NOP_DESTRUCTURING)) // ... OBJ ITER *LREF UNDEF
return false;
- if (!bce->emit1(JSOP_DUP)) // ... OBJ? ITER RESULT RESULT
+
+ // The iterator is done. Unpick a TRUE value for DONE above ITER.
+ if (!emit1(JSOP_TRUE)) // ... OBJ ITER *LREF UNDEF TRUE
return false;
- if (!bce->emitAtomOp(cx->names().done, JSOP_GETPROP)) // ... OBJ? ITER RESULT DONE?
+ if (!emit2(JSOP_UNPICK, emitted + 1)) // ... OBJ ITER TRUE *LREF UNDEF
return false;
- return true;
- };
- if (isHead) {
- if (!emitNext(cx, this)) // ... OBJ? ITER RESULT DONE?
+ if (!ifAlreadyDone.emitElse()) // ... OBJ ITER *LREF
return false;
}
- IfThenElseEmitter ifThenElse(this);
- if (!ifThenElse.emitIfElse()) // ... OBJ? ITER RESULT
- return false;
-
- if (!emit1(JSOP_POP)) // ... OBJ? ITER
- return false;
- if (pndefault) {
- // Emit only pndefault tree here, as undefined check in emitDefault
- // should always be true.
- if (!emitConditionallyExecutedTree(pndefault)) // ... OBJ? ITER VALUE
+ if (emitted) {
+ if (!emitDupAt(emitted)) // ... OBJ ITER *LREF ITER
return false;
} else {
- if (!isElision) {
- if (!emit1(JSOP_UNDEFINED)) // ... OBJ? ITER UNDEFINED
- return false;
- if (!emit1(JSOP_NOP_DESTRUCTURING))
- return false;
- }
- }
- if (!isElision) {
- if (!emitConditionallyExecutedDestructuringLHS(subpattern, flav)) // ... OBJ? ITER
- return false;
- } else if (pndefault) {
- if (!emit1(JSOP_POP)) // ... OBJ? ITER
+ if (!emit1(JSOP_DUP)) // ... OBJ ITER *LREF ITER
return false;
}
+ if (!emitIteratorNext(pattern)) // ... OBJ ITER *LREF RESULT
+ return false;
+ if (!emit1(JSOP_DUP)) // ... OBJ ITER *LREF RESULT RESULT
+ return false;
+ if (!emitAtomOp(cx->names().done, JSOP_GETPROP)) // ... OBJ ITER *LREF RESULT DONE
+ return false;
- // Setup next element's result when the iterator is done.
- if (hasNextNonSpread) {
- if (!emit1(JSOP_UNDEFINED)) // ... OBJ? ITER RESULT
- return false;
- if (!emit1(JSOP_NOP_DESTRUCTURING))
- return false;
- if (!emit1(JSOP_TRUE)) // ... OBJ? ITER RESULT DONE?
- return false;
- } else if (hasNextSpread) {
- if (!emit1(JSOP_TRUE)) // ... OBJ? ITER DONE?
- return false;
- }
+ if (!emit1(JSOP_DUP)) // ... OBJ ITER *LREF RESULT DONE DONE
+ return false;
+ if (!emit2(JSOP_UNPICK, emitted + 2)) // ... OBJ ITER DONE *LREF RESULT DONE
+ return false;
+
+ IfThenElseEmitter ifDone(this);
+ if (!ifDone.emitIfElse()) // ... OBJ ITER DONE *LREF RESULT
+ return false;
- if (!ifThenElse.emitElse()) // ... OBJ? ITER RESULT
+ if (!emit1(JSOP_POP)) // ... OBJ ITER DONE *LREF
+ return false;
+ if (!emit1(JSOP_UNDEFINED)) // ... OBJ ITER DONE *LREF UNDEF
+ return false;
+ if (!emit1(JSOP_NOP_DESTRUCTURING)) // ... OBJ ITER DONE *LREF UNDEF
return false;
- if (!emitAtomOp(cx->names().value, JSOP_GETPROP)) // ... OBJ? ITER VALUE
+ if (!ifDone.emitElse()) // ... OBJ ITER DONE *LREF RESULT
return false;
- if (pndefault) {
- if (!emitDefault(pndefault)) // ... OBJ? ITER VALUE
+ if (!emitAtomOp(cx->names().value, JSOP_GETPROP)) // ... OBJ ITER DONE *LREF VALUE
+ return false;
+
+ if (!ifDone.emitEnd())
+ return false;
+ MOZ_ASSERT(ifDone.pushed() == 0);
+
+ if (!isFirst) {
+ if (!ifAlreadyDone.emitEnd())
return false;
+ MOZ_ASSERT(ifAlreadyDone.pushed() == 2);
}
- if (!isElision) {
- if (!emitConditionallyExecutedDestructuringLHS(subpattern, flav)) // ... OBJ? ITER
- return false;
- } else {
- if (!emit1(JSOP_POP)) // ... OBJ? ITER
+ if (pndefault) {
+ auto emitDefault = [pndefault, lhsPattern](BytecodeEmitter* bce) {
+ return bce->emitDefault(pndefault, lhsPattern); // ... OBJ ITER DONE *LREF VALUE
+ };
+
+ if (!wrapWithDestructuringIteratorCloseTryNote(tryNoteDepth, emitDefault))
return false;
}
- // Setup next element's result when the iterator is not done.
- if (hasNextNonSpread) {
- if (!emitNext(cx, this)) // ... OBJ? ITER RESULT DONE?
+ if (!isElision) {
+ auto emitAssignment = [lhsPattern, flav](BytecodeEmitter* bce) {
+ return bce->emitSetOrInitializeDestructuring(lhsPattern, flav); // ... OBJ ITER DONE
+ };
+
+ if (!wrapWithDestructuringIteratorCloseTryNote(tryNoteDepth, emitAssignment))
return false;
- } else if (hasNextSpread) {
- if (!emit1(JSOP_FALSE)) // ... OBJ? ITER DONE?
+ } else {
+ if (!emit1(JSOP_POP)) // ... OBJ ITER DONE
return false;
}
-
- if (!ifThenElse.emitEnd())
- return false;
- if (hasNextNonSpread)
- MOZ_ASSERT(ifThenElse.pushed() == 1);
- else if (hasNextSpread)
- MOZ_ASSERT(ifThenElse.pushed() == 0);
- else
- MOZ_ASSERT(ifThenElse.popped() == 1);
}
- if (needToPopIterator) {
- if (!emit1(JSOP_POP)) // ... OBJ?
- return false;
- }
+ // The last DONE value is on top of the stack. If not DONE, call
+ // IteratorClose.
+ // ... OBJ ITER DONE
+ IfThenElseEmitter ifDone(this);
+ if (!ifDone.emitIfElse()) // ... OBJ ITER
+ return false;
+ if (!emit1(JSOP_POP)) // ... OBJ
+ return false;
+ if (!ifDone.emitElse()) // ... OBJ ITER
+ return false;
+ if (!emitIteratorClose()) // ... OBJ
+ return false;
+ if (!ifDone.emitEnd())
+ return false;
return true;
}
@@ -4930,27 +5807,43 @@ BytecodeEmitter::emitDestructuringOpsObject(ParseNode* pattern, DestructuringFla
return false;
for (ParseNode* member = pattern->pn_head; member; member = member->pn_next) {
- // Duplicate the value being destructured to use as a reference base.
- if (!emit1(JSOP_DUP)) // ... RHS RHS
+ ParseNode* subpattern;
+ if (member->isKind(PNK_MUTATEPROTO))
+ subpattern = member->pn_kid;
+ else
+ subpattern = member->pn_right;
+ ParseNode* lhs = subpattern;
+ if (lhs->isKind(PNK_ASSIGN))
+ lhs = lhs->pn_left;
+
+ size_t emitted;
+ if (!emitDestructuringLHSRef(lhs, &emitted)) // ... RHS *LREF
return false;
+ // Duplicate the value being destructured to use as a reference base.
+ if (emitted) {
+ if (!emitDupAt(emitted)) // ... RHS *LREF RHS
+ return false;
+ } else {
+ if (!emit1(JSOP_DUP)) // ... RHS RHS
+ return false;
+ }
+
// Now push the property name currently being matched, which is the
// current property name "label" on the left of a colon in the object
// initialiser.
bool needsGetElem = true;
- ParseNode* subpattern;
if (member->isKind(PNK_MUTATEPROTO)) {
- if (!emitAtomOp(cx->names().proto, JSOP_GETPROP)) // ... RHS PROP
+ if (!emitAtomOp(cx->names().proto, JSOP_GETPROP)) // ... RHS *LREF PROP
return false;
needsGetElem = false;
- subpattern = member->pn_kid;
} else {
MOZ_ASSERT(member->isKind(PNK_COLON) || member->isKind(PNK_SHORTHAND));
ParseNode* key = member->pn_left;
if (key->isKind(PNK_NUMBER)) {
- if (!emitNumberOp(key->pn_dval)) // ... RHS RHS KEY
+ if (!emitNumberOp(key->pn_dval)) // ... RHS *LREF RHS KEY
return false;
} else if (key->isKind(PNK_OBJECT_PROPERTY_NAME) || key->isKind(PNK_STRING)) {
PropertyName* name = key->pn_atom->asPropertyName();
@@ -4960,33 +5853,30 @@ BytecodeEmitter::emitDestructuringOpsObject(ParseNode* pattern, DestructuringFla
// as indexes for simplification of downstream analysis.
jsid id = NameToId(name);
if (id != IdToTypeId(id)) {
- if (!emitTree(key)) // ... RHS RHS KEY
+ if (!emitTree(key)) // ... RHS *LREF RHS KEY
return false;
} else {
- if (!emitAtomOp(name, JSOP_GETPROP)) // ...RHS PROP
+ if (!emitAtomOp(name, JSOP_GETPROP)) // ... RHS *LREF PROP
return false;
needsGetElem = false;
}
} else {
- if (!emitComputedPropertyName(key)) // ... RHS RHS KEY
+ if (!emitComputedPropertyName(key)) // ... RHS *LREF RHS KEY
return false;
}
-
- subpattern = member->pn_right;
}
// Get the property value if not done already.
- if (needsGetElem && !emitElemOpBase(JSOP_GETELEM)) // ... RHS PROP
+ if (needsGetElem && !emitElemOpBase(JSOP_GETELEM)) // ... RHS *LREF PROP
return false;
if (subpattern->isKind(PNK_ASSIGN)) {
- if (!emitDefault(subpattern->pn_right))
+ if (!emitDefault(subpattern->pn_right, lhs)) // ... RHS *LREF VALUE
return false;
- subpattern = subpattern->pn_left;
}
- // Destructure PROP per this member's subpattern.
- if (!emitDestructuringLHS(subpattern, flav))
+ // Destructure PROP per this member's lhs.
+ if (!emitSetOrInitializeDestructuring(subpattern, flav)) // ... RHS
return false;
}
@@ -5094,7 +5984,7 @@ BytecodeEmitter::emitSingleDeclaration(ParseNode* declList, ParseNode* decl,
if (!initializer && declList->isKind(PNK_VAR))
return true;
- auto emitRhs = [initializer, declList](BytecodeEmitter* bce, const NameLocation&, bool) {
+ auto emitRhs = [initializer, declList, decl](BytecodeEmitter* bce, const NameLocation&, bool) {
if (!initializer) {
// Lexical declarations are initialized to undefined without an
// initializer.
@@ -5105,7 +5995,7 @@ BytecodeEmitter::emitSingleDeclaration(ParseNode* declList, ParseNode* decl,
}
MOZ_ASSERT(initializer);
- return bce->emitTree(initializer);
+ return bce->emitInitializer(initializer, decl);
};
if (!emitInitializeName(decl, emitRhs))
@@ -5164,6 +6054,12 @@ BytecodeEmitter::emitAssignment(ParseNode* lhs, JSOp op, ParseNode* rhs)
if (!EmitAssignmentRhs(bce, rhs, emittedBindOp ? 2 : 1))
return false;
+ if (!lhs->isInParens() && op == JSOP_NOP && rhs && rhs->isDirectRHSAnonFunction()) {
+ RootedAtom name(bce->cx, lhs->name());
+ if (!bce->setOrEmitSetFunName(rhs, name, FunctionPrefixKind::None))
+ return false;
+ }
+
// Emit the compound assignment op if there is one.
if (op != JSOP_NOP && !bce->emit1(op))
return false;
@@ -5558,7 +6454,7 @@ BytecodeEmitter::emitCatch(ParseNode* pn)
return false;
{
- NonLocalExitControl nle(this);
+ NonLocalExitControl nle(this, NonLocalExitControl::Throw);
// Move exception back to cx->exception to prepare for
// the next catch.
@@ -5592,57 +6488,28 @@ BytecodeEmitter::emitCatch(ParseNode* pn)
MOZ_NEVER_INLINE bool
BytecodeEmitter::emitTry(ParseNode* pn)
{
- // Track jumps-over-catches and gosubs-to-finally for later fixup.
- //
- // When a finally block is active, non-local jumps (including
- // jumps-over-catches) result in a GOSUB being written into the bytecode
- // stream and fixed-up later.
- //
- TryFinallyControl controlInfo(this, pn->pn_kid3 ? StatementKind::Finally : StatementKind::Try);
-
- // Since an exception can be thrown at any place inside the try block,
- // we need to restore the stack and the scope chain before we transfer
- // the control to the exception handler.
- //
- // For that we store in a try note associated with the catch or
- // finally block the stack depth upon the try entry. The interpreter
- // uses this depth to properly unwind the stack and the scope chain.
- //
- int depth = stackDepth;
-
- // Record the try location, then emit the try block.
- unsigned noteIndex;
- if (!newSrcNote(SRC_TRY, &noteIndex))
- return false;
- if (!emit1(JSOP_TRY))
- return false;
-
- ptrdiff_t tryStart = offset();
- if (!emitTree(pn->pn_kid1))
- return false;
- MOZ_ASSERT(depth == stackDepth);
+ ParseNode* catchList = pn->pn_kid2;
+ ParseNode* finallyNode = pn->pn_kid3;
- // GOSUB to finally, if present.
- if (pn->pn_kid3) {
- if (!emitJump(JSOP_GOSUB, &controlInfo.gosubs))
- return false;
+ TryEmitter::Kind kind;
+ if (catchList) {
+ if (finallyNode)
+ kind = TryEmitter::TryCatchFinally;
+ else
+ kind = TryEmitter::TryCatch;
+ } else {
+ MOZ_ASSERT(finallyNode);
+ kind = TryEmitter::TryFinally;
}
+ TryEmitter tryCatch(this, kind);
- // Source note points to the jump at the end of the try block.
- if (!setSrcNoteOffset(noteIndex, 0, offset() - tryStart + JSOP_TRY_LENGTH))
- return false;
-
- // Emit jump over catch and/or finally.
- JumpList catchJump;
- if (!emitJump(JSOP_GOTO, &catchJump))
+ if (!tryCatch.emitTry())
return false;
- JumpTarget tryEnd;
- if (!emitJumpTarget(&tryEnd))
+ if (!emitTree(pn->pn_kid1))
return false;
// If this try has a catch block, emit it.
- ParseNode* catchList = pn->pn_kid2;
if (catchList) {
MOZ_ASSERT(catchList->isKind(PNK_CATCHLIST));
@@ -5672,110 +6539,26 @@ BytecodeEmitter::emitTry(ParseNode* pn)
// capturing exceptions thrown from catch{} blocks.
//
for (ParseNode* pn3 = catchList->pn_head; pn3; pn3 = pn3->pn_next) {
- MOZ_ASSERT(this->stackDepth == depth);
-
- // Clear the frame's return value that might have been set by the
- // try block:
- //
- // eval("try { 1; throw 2 } catch(e) {}"); // undefined, not 1
- if (!emit1(JSOP_UNDEFINED))
- return false;
- if (!emit1(JSOP_SETRVAL))
+ if (!tryCatch.emitCatch())
return false;
// Emit the lexical scope and catch body.
MOZ_ASSERT(pn3->isKind(PNK_LEXICALSCOPE));
if (!emitTree(pn3))
return false;
-
- // gosub <finally>, if required.
- if (pn->pn_kid3) {
- if (!emitJump(JSOP_GOSUB, &controlInfo.gosubs))
- return false;
- MOZ_ASSERT(this->stackDepth == depth);
- }
-
- // Jump over the remaining catch blocks. This will get fixed
- // up to jump to after catch/finally.
- if (!emitJump(JSOP_GOTO, &catchJump))
- return false;
-
- // If this catch block had a guard clause, patch the guard jump to
- // come here.
- if (controlInfo.guardJump.offset != -1) {
- if (!emitJumpTargetAndPatch(controlInfo.guardJump))
- return false;
- controlInfo.guardJump.offset = -1;
-
- // If this catch block is the last one, rethrow, delegating
- // execution of any finally block to the exception handler.
- if (!pn3->pn_next) {
- if (!emit1(JSOP_EXCEPTION))
- return false;
- if (!emit1(JSOP_THROW))
- return false;
- }
- }
}
}
- MOZ_ASSERT(this->stackDepth == depth);
-
// Emit the finally handler, if there is one.
- JumpTarget finallyStart{ 0 };
- if (pn->pn_kid3) {
- if (!emitJumpTarget(&finallyStart))
+ if (finallyNode) {
+ if (!tryCatch.emitFinally(Some(finallyNode->pn_pos.begin)))
return false;
- // Fix up the gosubs that might have been emitted before non-local
- // jumps to the finally code.
- patchJumpsToTarget(controlInfo.gosubs, finallyStart);
-
- // Indicate that we're emitting a subroutine body.
- controlInfo.setEmittingSubroutine();
- if (!updateSourceCoordNotes(pn->pn_kid3->pn_pos.begin))
- return false;
- if (!emit1(JSOP_FINALLY))
+ if (!emitTree(finallyNode))
return false;
- if (!emit1(JSOP_GETRVAL))
- return false;
-
- // Clear the frame's return value to make break/continue return
- // correct value even if there's no other statement before them:
- //
- // eval("x: try { 1 } finally { break x; }"); // undefined, not 1
- if (!emit1(JSOP_UNDEFINED))
- return false;
- if (!emit1(JSOP_SETRVAL))
- return false;
-
- if (!emitTree(pn->pn_kid3))
- return false;
- if (!emit1(JSOP_SETRVAL))
- return false;
- if (!emit1(JSOP_RETSUB))
- return false;
- hasTryFinally = true;
- MOZ_ASSERT(this->stackDepth == depth);
}
- // ReconstructPCStack needs a NOP here to mark the end of the last catch block.
- if (!emit1(JSOP_NOP))
- return false;
-
- // Fix up the end-of-try/catch jumps to come here.
- if (!emitJumpTargetAndPatch(catchJump))
- return false;
-
- // Add the try note last, to let post-order give us the right ordering
- // (first to last for a given nesting level, inner to outer by level).
- if (catchList && !tryNoteList.append(JSTRY_CATCH, depth, tryStart, tryEnd.offset))
- return false;
-
- // If we've got a finally, mark try+catch region with additional
- // trynote to catch exceptions (re)thrown from a catch block or
- // for the try{}finally{} case.
- if (pn->pn_kid3 && !tryNoteList.append(JSTRY_FINALLY, depth, tryStart, finallyStart.offset))
+ if (!tryCatch.emitEnd())
return false;
return true;
@@ -5788,7 +6571,7 @@ BytecodeEmitter::emitIf(ParseNode* pn)
if_again:
/* Emit code for the condition before pushing stmtInfo. */
- if (!emitConditionallyExecutedTree(pn->pn_kid1))
+ if (!emitTreeInBranch(pn->pn_kid1))
return false;
ParseNode* elseNode = pn->pn_kid3;
@@ -5801,7 +6584,7 @@ BytecodeEmitter::emitIf(ParseNode* pn)
}
/* Emit code for the then part. */
- if (!emitConditionallyExecutedTree(pn->pn_kid2))
+ if (!emitTreeInBranch(pn->pn_kid2))
return false;
if (elseNode) {
@@ -5814,7 +6597,7 @@ BytecodeEmitter::emitIf(ParseNode* pn)
}
/* Emit code for the else part. */
- if (!emitConditionallyExecutedTree(elseNode))
+ if (!emitTreeInBranch(elseNode))
return false;
}
@@ -6048,7 +6831,7 @@ BytecodeEmitter::emitSpread(bool allowSelfHosted)
return false;
if (!emit1(JSOP_DUP)) // ITER ARR I RESULT RESULT
return false;
- if (!emitAtomOp(cx->names().done, JSOP_GETPROP)) // ITER ARR I RESULT DONE?
+ if (!emitAtomOp(cx->names().done, JSOP_GETPROP)) // ITER ARR I RESULT DONE
return false;
if (!emitBackwardJump(JSOP_IFEQ, top, &beq, &breakTarget)) // ITER ARR I RESULT
@@ -6144,19 +6927,34 @@ BytecodeEmitter::emitForOf(ParseNode* forOfLoop, EmitterScope* headLexicalEmitte
MOZ_ASSERT(forOfHead->isKind(PNK_FOROF));
MOZ_ASSERT(forOfHead->isArity(PN_TERNARY));
- // Evaluate the expression being iterated.
ParseNode* forHeadExpr = forOfHead->pn_kid3;
+
+ // Certain builtins (e.g. Array.from) are implemented in self-hosting
+ // as for-of loops.
+ bool allowSelfHostedIter = false;
+ if (emitterMode == BytecodeEmitter::SelfHosting &&
+ forHeadExpr->isKind(PNK_CALL) &&
+ forHeadExpr->pn_head->name() == cx->names().allowContentIter)
+ {
+ allowSelfHostedIter = true;
+ }
+
+ // Evaluate the expression being iterated.
if (!emitTree(forHeadExpr)) // ITERABLE
return false;
if (!emitIterator()) // ITER
return false;
- // For-of loops have both the iterator and the value on the stack. Push
- // undefined to balance the stack.
+ int32_t iterDepth = stackDepth;
+
+ // For-of loops have both the iterator, the result, and the result.value
+ // on the stack. Push undefineds to balance the stack.
if (!emit1(JSOP_UNDEFINED)) // ITER RESULT
return false;
+ if (!emit1(JSOP_UNDEFINED)) // ITER RESULT UNDEF
+ return false;
- LoopControl loopInfo(this, StatementKind::ForOfLoop);
+ ForOfLoopControl loopInfo(this, iterDepth, allowSelfHostedIter);
// Annotate so IonMonkey can find the loop-closing jump.
unsigned noteIndex;
@@ -6164,11 +6962,11 @@ BytecodeEmitter::emitForOf(ParseNode* forOfLoop, EmitterScope* headLexicalEmitte
return false;
JumpList initialJump;
- if (!emitJump(JSOP_GOTO, &initialJump)) // ITER RESULT
+ if (!emitJump(JSOP_GOTO, &initialJump)) // ITER RESULT UNDEF
return false;
JumpTarget top{ -1 };
- if (!emitLoopHead(nullptr, &top)) // ITER RESULT
+ if (!emitLoopHead(nullptr, &top)) // ITER RESULT UNDEF
return false;
// If the loop had an escaping lexical declaration, replace the current
@@ -6185,7 +6983,7 @@ BytecodeEmitter::emitForOf(ParseNode* forOfLoop, EmitterScope* headLexicalEmitte
MOZ_ASSERT(headLexicalEmitterScope->scope(this)->kind() == ScopeKind::Lexical);
if (headLexicalEmitterScope->hasEnvironment()) {
- if (!emit1(JSOP_RECREATELEXICALENV)) // ITER RESULT
+ if (!emit1(JSOP_RECREATELEXICALENV)) // ITER RESULT UNDEF
return false;
}
@@ -6202,46 +7000,69 @@ BytecodeEmitter::emitForOf(ParseNode* forOfLoop, EmitterScope* headLexicalEmitte
#endif
// Emit code to assign result.value to the iteration variable.
+ //
+ // Note that ES 13.7.5.13, step 5.c says getting result.value does not
+ // call IteratorClose, so start JSTRY_ITERCLOSE after the GETPROP.
+ if (!emit1(JSOP_POP)) // ITER RESULT
+ return false;
if (!emit1(JSOP_DUP)) // ITER RESULT RESULT
return false;
if (!emitAtomOp(cx->names().value, JSOP_GETPROP)) // ITER RESULT VALUE
return false;
- if (!emitInitializeForInOrOfTarget(forOfHead)) // ITER RESULT VALUE
+ if (!loopInfo.emitBeginCodeNeedingIteratorClose(this))
return false;
- if (!emit1(JSOP_POP)) // ITER RESULT
+ if (!emitInitializeForInOrOfTarget(forOfHead)) // ITER RESULT VALUE
return false;
- MOZ_ASSERT(this->stackDepth == loopDepth,
+ MOZ_ASSERT(stackDepth == loopDepth,
"the stack must be balanced around the initializing "
"operation");
+ // Remove VALUE from the stack to release it.
+ if (!emit1(JSOP_POP)) // ITER RESULT
+ return false;
+ if (!emit1(JSOP_UNDEFINED)) // ITER RESULT UNDEF
+ return false;
+
// Perform the loop body.
ParseNode* forBody = forOfLoop->pn_right;
- if (!emitTree(forBody)) // ITER RESULT
+ if (!emitTree(forBody)) // ITER RESULT UNDEF
+ return false;
+
+ MOZ_ASSERT(stackDepth == loopDepth,
+ "the stack must be balanced around the for-of body");
+
+ if (!loopInfo.emitEndCodeNeedingIteratorClose(this))
return false;
// Set offset for continues.
loopInfo.continueTarget = { offset() };
- if (!emitLoopEntry(forHeadExpr, initialJump)) // ITER RESULT
+ if (!emitLoopEntry(forHeadExpr, initialJump)) // ITER RESULT UNDEF
return false;
- if (!emit1(JSOP_POP)) // ITER
+ if (!emit1(JSOP_SWAP)) // ITER UNDEF RESULT
+ return false;
+ if (!emit1(JSOP_POP)) // ITER UNDEF
return false;
- if (!emit1(JSOP_DUP)) // ITER ITER
+ if (!emitDupAt(1)) // ITER UNDEF ITER
return false;
- if (!emitIteratorNext(forOfHead)) // ITER RESULT
+ if (!emitIteratorNext(forOfHead, allowSelfHostedIter)) // ITER UNDEF RESULT
return false;
- if (!emit1(JSOP_DUP)) // ITER RESULT RESULT
+
+ if (!emit1(JSOP_SWAP)) // ITER RESULT UNDEF
return false;
- if (!emitAtomOp(cx->names().done, JSOP_GETPROP)) // ITER RESULT DONE?
+
+ if (!emitDupAt(1)) // ITER RESULT UNDEF RESULT
+ return false;
+ if (!emitAtomOp(cx->names().done, JSOP_GETPROP)) // ITER RESULT UNDEF DONE
return false;
if (!emitBackwardJump(JSOP_IFEQ, top, &beq, &breakTarget))
- return false; // ITER RESULT
+ return false; // ITER RESULT UNDEF
MOZ_ASSERT(this->stackDepth == loopDepth);
}
@@ -6256,7 +7077,7 @@ BytecodeEmitter::emitForOf(ParseNode* forOfLoop, EmitterScope* headLexicalEmitte
if (!tryNoteList.append(JSTRY_FOR_OF, stackDepth, top.offset, breakTarget.offset))
return false;
- return emitUint16Operand(JSOP_POPN, 2); //
+ return emitUint16Operand(JSOP_POPN, 3); //
}
bool
@@ -6283,8 +7104,8 @@ BytecodeEmitter::emitForIn(ParseNode* forInLoop, EmitterScope* headLexicalEmitte
if (!updateSourceCoordNotes(decl->pn_pos.begin))
return false;
- auto emitRhs = [initializer](BytecodeEmitter* bce, const NameLocation&, bool) {
- return bce->emitTree(initializer);
+ auto emitRhs = [decl, initializer](BytecodeEmitter* bce, const NameLocation&, bool) {
+ return bce->emitInitializer(initializer, decl);
};
if (!emitInitializeName(decl, emitRhs))
@@ -6504,7 +7325,7 @@ BytecodeEmitter::emitCStyleFor(ParseNode* pn, EmitterScope* headLexicalEmitterSc
if (jmp.offset == -1 && !emitLoopEntry(forBody, jmp))
return false;
- if (!emitConditionallyExecutedTree(forBody))
+ if (!emitTreeInBranch(forBody))
return false;
// Set loop and enclosing "update" offsets, for continue. Note that we
@@ -6666,6 +7487,8 @@ BytecodeEmitter::emitComprehensionForOf(ParseNode* pn)
// Push a dummy result so that we properly enter iteration midstream.
if (!emit1(JSOP_UNDEFINED)) // ITER RESULT
return false;
+ if (!emit1(JSOP_UNDEFINED)) // ITER RESULT VALUE
+ return false;
// Enter the block before the loop body, after evaluating the obj.
// Initialize let bindings with undefined when entering, as the name
@@ -6703,42 +7526,59 @@ BytecodeEmitter::emitComprehensionForOf(ParseNode* pn)
#endif
// Emit code to assign result.value to the iteration variable.
+ if (!emit1(JSOP_POP)) // ITER RESULT
+ return false;
if (!emit1(JSOP_DUP)) // ITER RESULT RESULT
return false;
if (!emitAtomOp(cx->names().value, JSOP_GETPROP)) // ITER RESULT VALUE
return false;
+
+ // Notice: Comprehension for-of doesn't perform IteratorClose, since it's
+ // not in the spec.
+
if (!emitAssignment(loopVariableName, JSOP_NOP, nullptr)) // ITER RESULT VALUE
return false;
+
+ // Remove VALUE from the stack to release it.
if (!emit1(JSOP_POP)) // ITER RESULT
return false;
+ if (!emit1(JSOP_UNDEFINED)) // ITER RESULT UNDEF
+ return false;
// The stack should be balanced around the assignment opcode sequence.
MOZ_ASSERT(this->stackDepth == loopDepth);
// Emit code for the loop body.
- if (!emitTree(forBody))
+ if (!emitTree(forBody)) // ITER RESULT UNDEF
return false;
+ // The stack should be balanced around the assignment opcode sequence.
+ MOZ_ASSERT(this->stackDepth == loopDepth);
+
// Set offset for continues.
loopInfo.continueTarget = { offset() };
if (!emitLoopEntry(forHeadExpr, jmp))
return false;
- if (!emit1(JSOP_POP)) // ITER
+ if (!emit1(JSOP_SWAP)) // ITER UNDEF RESULT
return false;
- if (!emit1(JSOP_DUP)) // ITER ITER
+ if (!emit1(JSOP_POP)) // ITER UNDEF
return false;
- if (!emitIteratorNext(forHead)) // ITER RESULT
+ if (!emitDupAt(1)) // ITER UNDEF ITER
return false;
- if (!emit1(JSOP_DUP)) // ITER RESULT RESULT
+ if (!emitIteratorNext(forHead)) // ITER UNDEF RESULT
+ return false;
+ if (!emit1(JSOP_SWAP)) // ITER RESULT UNDEF
return false;
- if (!emitAtomOp(cx->names().done, JSOP_GETPROP)) // ITER RESULT DONE?
+ if (!emitDupAt(1)) // ITER RESULT UNDEF RESULT
+ return false;
+ if (!emitAtomOp(cx->names().done, JSOP_GETPROP)) // ITER RESULT UNDEF DONE
return false;
JumpList beq;
JumpTarget breakTarget{ -1 };
- if (!emitBackwardJump(JSOP_IFEQ, top, &beq, &breakTarget)) // ITER RESULT
+ if (!emitBackwardJump(JSOP_IFEQ, top, &beq, &breakTarget)) // ITER RESULT UNDEF
return false;
MOZ_ASSERT(this->stackDepth == loopDepth);
@@ -6760,7 +7600,7 @@ BytecodeEmitter::emitComprehensionForOf(ParseNode* pn)
}
// Pop the result and the iter.
- return emitUint16Operand(JSOP_POPN, 2); //
+ return emitUint16Operand(JSOP_POPN, 3); //
}
bool
@@ -6903,16 +7743,15 @@ BytecodeEmitter::emitFunction(ParseNode* pn, bool needsProto)
{
FunctionBox* funbox = pn->pn_funbox;
RootedFunction fun(cx, funbox->function());
- RootedAtom name(cx, fun->name());
+ RootedAtom name(cx, fun->explicitName());
MOZ_ASSERT_IF(fun->isInterpretedLazy(), fun->lazyScript());
- MOZ_ASSERT_IF(pn->isOp(JSOP_FUNWITHPROTO), needsProto);
/*
* Set the |wasEmitted| flag in the funbox once the function has been
* emitted. Function definitions that need hoisting to the top of the
* function will be seen by emitFunction in two places.
*/
- if (funbox->wasEmitted && pn->functionIsHoisted()) {
+ if (funbox->wasEmitted) {
// Annex B block-scoped functions are hoisted like any other
// block-scoped function to the top of their scope. When their
// definitions are seen for the second time, we need to emit the
@@ -7041,7 +7880,7 @@ BytecodeEmitter::emitFunction(ParseNode* pn, bool needsProto)
}
if (needsProto) {
- MOZ_ASSERT(pn->getOp() == JSOP_FUNWITHPROTO || pn->getOp() == JSOP_LAMBDA);
+ MOZ_ASSERT(pn->getOp() == JSOP_LAMBDA);
pn->setOp(JSOP_FUNWITHPROTO);
}
@@ -7284,7 +8123,7 @@ BytecodeEmitter::emitWhile(ParseNode* pn)
if (!emitLoopHead(pn->pn_right, &top))
return false;
- if (!emitConditionallyExecutedTree(pn->pn_right))
+ if (!emitTreeInBranch(pn->pn_right))
return false;
if (!emitLoopEntry(pn->pn_left, jmp))
@@ -7458,7 +8297,7 @@ BytecodeEmitter::emitReturn(ParseNode* pn)
return false;
}
- NonLocalExitControl nle(this);
+ NonLocalExitControl nle(this, NonLocalExitControl::Return);
if (!nle.prepareForNonLocalJumpToOutermost())
return false;
@@ -7528,110 +8367,208 @@ BytecodeEmitter::emitYieldStar(ParseNode* iter, ParseNode* gen)
MOZ_ASSERT(sc->isFunctionBox());
MOZ_ASSERT(sc->asFunctionBox()->isStarGenerator());
- if (!emitTree(iter)) // ITERABLE
+ if (!emitTree(iter)) // ITERABLE
return false;
- if (!emitIterator()) // ITER
+ if (!emitIterator()) // ITER
return false;
// Initial send value is undefined.
- if (!emit1(JSOP_UNDEFINED)) // ITER RECEIVED
+ if (!emit1(JSOP_UNDEFINED)) // ITER RECEIVED
return false;
- int depth = stackDepth;
- MOZ_ASSERT(depth >= 2);
+ int32_t savedDepthTemp;
+ int32_t startDepth = stackDepth;
+ MOZ_ASSERT(startDepth >= 2);
- JumpList send;
- if (!emitJump(JSOP_GOTO, &send)) // goto send
+ TryEmitter tryCatch(this, TryEmitter::TryCatchFinally, TryEmitter::DontUseRetVal,
+ TryEmitter::DontUseControl);
+ if (!tryCatch.emitJumpOverCatchAndFinally()) // ITER RESULT
return false;
- // Try prologue. // ITER RESULT
- unsigned noteIndex;
- if (!newSrcNote(SRC_TRY, &noteIndex))
- return false;
JumpTarget tryStart{ offset() };
- if (!emit1(JSOP_TRY)) // tryStart:
+ if (!tryCatch.emitTry()) // ITER RESULT
return false;
- MOZ_ASSERT(this->stackDepth == depth);
+
+ MOZ_ASSERT(this->stackDepth == startDepth);
// Load the generator object.
- if (!emitTree(gen)) // ITER RESULT GENOBJ
+ if (!emitTree(gen)) // ITER RESULT GENOBJ
return false;
// Yield RESULT as-is, without re-boxing.
- if (!emitYieldOp(JSOP_YIELD)) // ITER RECEIVED
+ if (!emitYieldOp(JSOP_YIELD)) // ITER RECEIVED
return false;
- // Try epilogue.
- if (!setSrcNoteOffset(noteIndex, 0, offset() - tryStart.offset))
- return false;
- if (!emitJump(JSOP_GOTO, &send)) // goto send
+ if (!tryCatch.emitCatch()) // ITER RESULT
return false;
- JumpTarget tryEnd;
- if (!emitJumpTarget(&tryEnd)) // tryEnd:
+ stackDepth = startDepth; // ITER RESULT
+ if (!emit1(JSOP_EXCEPTION)) // ITER RESULT EXCEPTION
+ return false;
+ if (!emitDupAt(2)) // ITER RESULT EXCEPTION ITER
+ return false;
+ if (!emit1(JSOP_DUP)) // ITER RESULT EXCEPTION ITER ITER
+ return false;
+ if (!emitAtomOp(cx->names().throw_, JSOP_CALLPROP)) // ITER RESULT EXCEPTION ITER THROW
+ return false;
+ if (!emit1(JSOP_DUP)) // ITER RESULT EXCEPTION ITER THROW THROW
+ return false;
+ if (!emit1(JSOP_UNDEFINED)) // ITER RESULT EXCEPTION ITER THROW THROW UNDEFINED
+ return false;
+ if (!emit1(JSOP_EQ)) // ITER RESULT EXCEPTION ITER THROW ?EQL
return false;
- // Catch location.
- stackDepth = uint32_t(depth); // ITER RESULT
- if (!emit1(JSOP_POP)) // ITER
+ IfThenElseEmitter ifThrowMethodIsNotDefined(this);
+ if (!ifThrowMethodIsNotDefined.emitIf()) // ITER RESULT EXCEPTION ITER THROW
+ return false;
+ savedDepthTemp = stackDepth;
+ if (!emit1(JSOP_POP)) // ITER RESULT EXCEPTION ITER
+ return false;
+ // ES 14.4.13, YieldExpression : yield * AssignmentExpression, step 5.b.iii.2
+ //
+ // If the iterator does not have a "throw" method, it calls IteratorClose
+ // and then throws a TypeError.
+ if (!emitIteratorClose()) // ITER RESULT EXCEPTION
+ return false;
+ if (!emitUint16Operand(JSOP_THROWMSG, JSMSG_ITERATOR_NO_THROW)) // throw
return false;
- // THROW? = 'throw' in ITER
- if (!emit1(JSOP_EXCEPTION)) // ITER EXCEPTION
+ stackDepth = savedDepthTemp;
+ if (!ifThrowMethodIsNotDefined.emitEnd()) // ITER OLDRESULT EXCEPTION ITER THROW
return false;
- if (!emit1(JSOP_SWAP)) // EXCEPTION ITER
+ // ES 14.4.13, YieldExpression : yield * AssignmentExpression, step 5.b.iii.4.
+ // RESULT = ITER.throw(EXCEPTION) // ITER OLDRESULT EXCEPTION ITER THROW
+ if (!emit1(JSOP_SWAP)) // ITER OLDRESULT EXCEPTION THROW ITER
return false;
- if (!emit1(JSOP_DUP)) // EXCEPTION ITER ITER
+ if (!emit2(JSOP_PICK, 2)) // ITER OLDRESULT THROW ITER EXCEPTION
return false;
- if (!emitAtomOp(cx->names().throw_, JSOP_STRING)) // EXCEPTION ITER ITER "throw"
+ if (!emitCall(JSOP_CALL, 1, iter)) // ITER OLDRESULT RESULT
+ return false;
+ checkTypeSet(JSOP_CALL);
+ if (!emitCheckIsObj(CheckIsObjectKind::IteratorThrow)) // ITER OLDRESULT RESULT
return false;
- if (!emit1(JSOP_SWAP)) // EXCEPTION ITER "throw" ITER
+ if (!emit1(JSOP_SWAP)) // ITER RESULT OLDRESULT
return false;
- if (!emit1(JSOP_IN)) // EXCEPTION ITER THROW?
+ if (!emit1(JSOP_POP)) // ITER RESULT
return false;
- // if (THROW?) goto delegate
- JumpList checkThrow;
- if (!emitJump(JSOP_IFNE, &checkThrow)) // EXCEPTION ITER
+ MOZ_ASSERT(this->stackDepth == startDepth);
+ JumpList checkResult;
+ // ES 14.4.13, YieldExpression : yield * AssignmentExpression, step 5.b.ii.
+ //
+ // Note that there is no GOSUB to the finally block here. If the iterator has a
+ // "throw" method, it does not perform IteratorClose.
+ if (!emitJump(JSOP_GOTO, &checkResult)) // goto checkResult
return false;
- if (!emit1(JSOP_POP)) // EXCEPTION
+
+ if (!tryCatch.emitFinally())
+ return false;
+
+ // ES 14.4.13, yield * AssignmentExpression, step 5.c
+ //
+ // Call iterator.return() for receiving a "forced return" completion from
+ // the generator.
+
+ IfThenElseEmitter ifGeneratorClosing(this);
+ if (!emit1(JSOP_ISGENCLOSING)) // ITER RESULT FTYPE FVALUE CLOSING
return false;
- if (!emit1(JSOP_THROW)) // throw EXCEPTION
+ if (!ifGeneratorClosing.emitIf()) // ITER RESULT FTYPE FVALUE
return false;
- if (!emitJumpTargetAndPatch(checkThrow)) // delegate:
+ // Step ii.
+ //
+ // Get the "return" method.
+ if (!emitDupAt(3)) // ITER RESULT FTYPE FVALUE ITER
return false;
- // RESULT = ITER.throw(EXCEPTION) // EXCEPTION ITER
- stackDepth = uint32_t(depth);
- if (!emit1(JSOP_DUP)) // EXCEPTION ITER ITER
+ if (!emit1(JSOP_DUP)) // ITER RESULT FTYPE FVALUE ITER ITER
return false;
- if (!emit1(JSOP_DUP)) // EXCEPTION ITER ITER ITER
+ if (!emitAtomOp(cx->names().return_, JSOP_CALLPROP)) // ITER RESULT FTYPE FVALUE ITER RET
return false;
- if (!emitAtomOp(cx->names().throw_, JSOP_CALLPROP)) // EXCEPTION ITER ITER THROW
+
+ // Step iii.
+ //
+ // Do nothing if "return" is undefined.
+ IfThenElseEmitter ifReturnMethodIsDefined(this);
+ if (!emit1(JSOP_DUP)) // ITER RESULT FTYPE FVALUE ITER RET RET
return false;
- if (!emit1(JSOP_SWAP)) // EXCEPTION ITER THROW ITER
+ if (!emit1(JSOP_UNDEFINED)) // ITER RESULT FTYPE FVALUE ITER RET RET UNDEFINED
return false;
- if (!emit2(JSOP_PICK, 3)) // ITER THROW ITER EXCEPTION
+ if (!emit1(JSOP_NE)) // ITER RESULT FTYPE FVALUE ITER RET ?NEQL
return false;
- if (!emitCall(JSOP_CALL, 1, iter)) // ITER RESULT
+
+ // Step iv.
+ //
+ // Call "return" with the argument passed to Generator.prototype.return,
+ // which is currently in rval.value.
+ if (!ifReturnMethodIsDefined.emitIfElse()) // ITER OLDRESULT FTYPE FVALUE ITER RET
+ return false;
+ if (!emit1(JSOP_SWAP)) // ITER OLDRESULT FTYPE FVALUE RET ITER
+ return false;
+ if (!emit1(JSOP_GETRVAL)) // ITER OLDRESULT FTYPE FVALUE RET ITER RVAL
+ return false;
+ if (!emitAtomOp(cx->names().value, JSOP_GETPROP)) // ITER OLDRESULT FTYPE FVALUE RET ITER VALUE
+ return false;
+ if (!emitCall(JSOP_CALL, 1)) // ITER OLDRESULT FTYPE FVALUE RESULT
return false;
checkTypeSet(JSOP_CALL);
- MOZ_ASSERT(this->stackDepth == depth);
- JumpList checkResult;
- if (!emitJump(JSOP_GOTO, &checkResult)) // goto checkResult
+
+ // Step v.
+ if (!emitCheckIsObj(CheckIsObjectKind::IteratorReturn)) // ITER OLDRESULT FTYPE FVALUE RESULT
return false;
- // Catch epilogue.
+ // Steps vi-viii.
+ //
+ // Check if the returned object from iterator.return() is done. If not,
+ // continuing yielding.
+ IfThenElseEmitter ifReturnDone(this);
+ if (!emit1(JSOP_DUP)) // ITER OLDRESULT FTYPE FVALUE RESULT RESULT
+ return false;
+ if (!emitAtomOp(cx->names().done, JSOP_GETPROP)) // ITER OLDRESULT FTYPE FVALUE RESULT DONE
+ return false;
+ if (!ifReturnDone.emitIfElse()) // ITER OLDRESULT FTYPE FVALUE RESULT
+ return false;
+ if (!emitAtomOp(cx->names().value, JSOP_GETPROP)) // ITER OLDRESULT FTYPE FVALUE VALUE
+ return false;
+ if (!emitPrepareIteratorResult()) // ITER OLDRESULT FTYPE FVALUE VALUE RESULT
+ return false;
+ if (!emit1(JSOP_SWAP)) // ITER OLDRESULT FTYPE FVALUE RESULT VALUE
+ return false;
+ if (!emitFinishIteratorResult(true)) // ITER OLDRESULT FTYPE FVALUE RESULT
+ return false;
+ if (!emit1(JSOP_SETRVAL)) // ITER OLDRESULT FTYPE FVALUE
+ return false;
+ savedDepthTemp = this->stackDepth;
+ if (!ifReturnDone.emitElse()) // ITER OLDRESULT FTYPE FVALUE RESULT
+ return false;
+ if (!emit2(JSOP_UNPICK, 3)) // ITER RESULT OLDRESULT FTYPE FVALUE
+ return false;
+ if (!emitUint16Operand(JSOP_POPN, 3)) // ITER RESULT
+ return false;
+ {
+ // goto tryStart;
+ JumpList beq;
+ JumpTarget breakTarget{ -1 };
+ if (!emitBackwardJump(JSOP_GOTO, tryStart, &beq, &breakTarget)) // ITER RESULT
+ return false;
+ }
+ this->stackDepth = savedDepthTemp;
+ if (!ifReturnDone.emitEnd())
+ return false;
- // This is a peace offering to ReconstructPCStack. See the note in EmitTry.
- if (!emit1(JSOP_NOP))
+ if (!ifReturnMethodIsDefined.emitElse()) // ITER RESULT FTYPE FVALUE ITER RET
return false;
- if (!tryNoteList.append(JSTRY_CATCH, depth, tryStart.offset + JSOP_TRY_LENGTH, tryEnd.offset))
+ if (!emit1(JSOP_POP)) // ITER RESULT FTYPE FVALUE ITER
+ return false;
+ if (!emit1(JSOP_POP)) // ITER RESULT FTYPE FVALUE
+ return false;
+ if (!ifReturnMethodIsDefined.emitEnd())
+ return false;
+
+ if (!ifGeneratorClosing.emitEnd())
return false;
- // After the try/catch block: send the received value to the iterator.
- if (!emitJumpTargetAndPatch(send)) // send:
+ if (!tryCatch.emitEnd())
return false;
- // Send location.
+ // After the try-catch-finally block: send the received value to the iterator.
// result = iter.next(received) // ITER RECEIVED
if (!emit1(JSOP_SWAP)) // RECEIVED ITER
return false;
@@ -7650,7 +8587,7 @@ BytecodeEmitter::emitYieldStar(ParseNode* iter, ParseNode* gen)
if (!emitCheckIsObj(CheckIsObjectKind::IteratorNext)) // ITER RESULT
return false;
checkTypeSet(JSOP_CALL);
- MOZ_ASSERT(this->stackDepth == depth);
+ MOZ_ASSERT(this->stackDepth == startDepth);
if (!emitJumpTargetAndPatch(checkResult)) // checkResult:
return false;
@@ -7661,10 +8598,12 @@ BytecodeEmitter::emitYieldStar(ParseNode* iter, ParseNode* gen)
if (!emitAtomOp(cx->names().done, JSOP_GETPROP)) // ITER RESULT DONE
return false;
// if (!DONE) goto tryStart;
- JumpList beq;
- JumpTarget breakTarget{ -1 };
- if (!emitBackwardJump(JSOP_IFEQ, tryStart, &beq, &breakTarget)) // ITER RESULT
- return false;
+ {
+ JumpList beq;
+ JumpTarget breakTarget{ -1 };
+ if (!emitBackwardJump(JSOP_IFEQ, tryStart, &beq, &breakTarget)) // ITER RESULT
+ return false;
+ }
// result.value
if (!emit1(JSOP_SWAP)) // RESULT ITER
@@ -7674,7 +8613,7 @@ BytecodeEmitter::emitYieldStar(ParseNode* iter, ParseNode* gen)
if (!emitAtomOp(cx->names().value, JSOP_GETPROP)) // VALUE
return false;
- MOZ_ASSERT(this->stackDepth == depth - 1);
+ MOZ_ASSERT(this->stackDepth == startDepth - 1);
return true;
}
@@ -7996,10 +8935,10 @@ BytecodeEmitter::emitSelfHostedForceInterpreter(ParseNode* pn)
}
bool
-BytecodeEmitter::emitSelfHostedAllowContentSpread(ParseNode* pn)
+BytecodeEmitter::emitSelfHostedAllowContentIter(ParseNode* pn)
{
if (pn->pn_count != 2) {
- reportError(pn, JSMSG_MORE_ARGS_NEEDED, "allowContentSpread", "1", "");
+ reportError(pn, JSMSG_MORE_ARGS_NEEDED, "allowContentIter", "1", "");
return false;
}
@@ -8017,7 +8956,7 @@ BytecodeEmitter::isRestParameter(ParseNode* pn, bool* result)
FunctionBox* funbox = sc->asFunctionBox();
RootedFunction fun(cx, funbox->function());
- if (!fun->hasRest()) {
+ if (!funbox->hasRest()) {
*result = false;
return true;
}
@@ -8025,7 +8964,7 @@ BytecodeEmitter::isRestParameter(ParseNode* pn, bool* result)
if (!pn->isKind(PNK_NAME)) {
if (emitterMode == BytecodeEmitter::SelfHosting && pn->isKind(PNK_CALL)) {
ParseNode* pn2 = pn->pn_head;
- if (pn2->getKind() == PNK_NAME && pn2->name() == cx->names().allowContentSpread)
+ if (pn2->getKind() == PNK_NAME && pn2->name() == cx->names().allowContentIter)
return isRestParameter(pn2->pn_next, result);
}
*result = false;
@@ -8133,8 +9072,8 @@ BytecodeEmitter::emitCallOrNew(ParseNode* pn)
return emitSelfHostedResumeGenerator(pn);
if (pn2->name() == cx->names().forceInterpreter)
return emitSelfHostedForceInterpreter(pn);
- if (pn2->name() == cx->names().allowContentSpread)
- return emitSelfHostedAllowContentSpread(pn);
+ if (pn2->name() == cx->names().allowContentIter)
+ return emitSelfHostedAllowContentIter(pn);
// Fall through.
}
if (!emitGetName(pn2, callop))
@@ -8449,13 +9388,13 @@ BytecodeEmitter::emitConditionalExpression(ConditionalExpression& conditional)
if (!ifThenElse.emitCond())
return false;
- if (!emitConditionallyExecutedTree(&conditional.thenExpression()))
+ if (!emitTreeInBranch(&conditional.thenExpression()))
return false;
if (!ifThenElse.emitElse())
return false;
- if (!emitConditionallyExecutedTree(&conditional.elseExpression()))
+ if (!emitTreeInBranch(&conditional.elseExpression()))
return false;
if (!ifThenElse.emitEnd())
@@ -8532,6 +9471,10 @@ BytecodeEmitter::emitPropertyList(ParseNode* pn, MutableHandlePlainObject objp,
op == JSOP_INITPROP_GETTER ||
op == JSOP_INITPROP_SETTER);
+ FunctionPrefixKind prefixKind = op == JSOP_INITPROP_GETTER ? FunctionPrefixKind::Get
+ : op == JSOP_INITPROP_SETTER ? FunctionPrefixKind::Set
+ : FunctionPrefixKind::None;
+
if (op == JSOP_INITPROP_GETTER || op == JSOP_INITPROP_SETTER)
objp.set(nullptr);
@@ -8573,6 +9516,12 @@ BytecodeEmitter::emitPropertyList(ParseNode* pn, MutableHandlePlainObject objp,
case JSOP_INITHIDDENPROP_SETTER: op = JSOP_INITHIDDENELEM_SETTER; break;
default: MOZ_CRASH("Invalid op");
}
+ if (propdef->pn_right->isDirectRHSAnonFunction()) {
+ if (!emitDupAt(1))
+ return false;
+ if (!emit2(JSOP_SETFUNNAME, uint8_t(prefixKind)))
+ return false;
+ }
if (!emit1(op))
return false;
} else {
@@ -8597,6 +9546,11 @@ BytecodeEmitter::emitPropertyList(ParseNode* pn, MutableHandlePlainObject objp,
objp.set(nullptr);
}
+ if (propdef->pn_right->isDirectRHSAnonFunction()) {
+ RootedAtom keyName(cx, key->pn_atom);
+ if (!setOrEmitSetFunName(propdef->pn_right, keyName, prefixKind))
+ return false;
+ }
if (!emitIndex32(op, index))
return false;
}
@@ -8774,7 +9728,7 @@ BytecodeEmitter::emitArray(ParseNode* pn, uint32_t count, JSOp op)
if (!updateSourceCoordNotes(pn2->pn_pos.begin))
return false;
- bool allowSelfHostedSpread = false;
+ bool allowSelfHostedIter = false;
if (pn2->isKind(PNK_ELISION)) {
if (!emit1(JSOP_HOLE))
return false;
@@ -8785,9 +9739,9 @@ BytecodeEmitter::emitArray(ParseNode* pn, uint32_t count, JSOp op)
if (emitterMode == BytecodeEmitter::SelfHosting &&
expr->isKind(PNK_CALL) &&
- expr->pn_head->name() == cx->names().allowContentSpread)
+ expr->pn_head->name() == cx->names().allowContentIter)
{
- allowSelfHostedSpread = true;
+ allowSelfHostedIter = true;
}
} else {
expr = pn2;
@@ -8802,7 +9756,7 @@ BytecodeEmitter::emitArray(ParseNode* pn, uint32_t count, JSOp op)
return false;
if (!emit2(JSOP_PICK, 2)) // ITER ARRAY INDEX
return false;
- if (!emitSpread(allowSelfHostedSpread)) // ARRAY INDEX
+ if (!emitSpread(allowSelfHostedIter)) // ARRAY INDEX
return false;
} else if (afterSpread) {
if (!emit1(JSOP_INITELEM_INC))
@@ -8960,7 +9914,7 @@ BytecodeEmitter::emitFunctionFormalParameters(ParseNode* pn)
EmitterScope* funScope = innermostEmitterScope;
bool hasParameterExprs = funbox->hasParameterExprs;
- bool hasRest = funbox->function()->hasRest();
+ bool hasRest = funbox->hasRest();
uint16_t argSlot = 0;
for (ParseNode* arg = pn->pn_head; arg != funBody; arg = arg->pn_next, argSlot++) {
@@ -9017,7 +9971,7 @@ BytecodeEmitter::emitFunctionFormalParameters(ParseNode* pn)
return false;
if (!emit1(JSOP_POP))
return false;
- if (!emitConditionallyExecutedTree(initializer))
+ if (!emitInitializerInBranch(initializer, bindingElement))
return false;
if (!emitJumpTargetAndPatch(jump))
return false;
@@ -9728,7 +10682,7 @@ BytecodeEmitter::emitTree(ParseNode* pn, EmitLineNumberNote emitLineNote)
}
bool
-BytecodeEmitter::emitConditionallyExecutedTree(ParseNode* pn)
+BytecodeEmitter::emitTreeInBranch(ParseNode* pn)
{
// Code that may be conditionally executed always need their own TDZ
// cache.
@@ -9962,15 +10916,6 @@ CGConstList::finish(ConstArray* array)
array->vector[i] = list[i];
}
-bool
-CGObjectList::isAdded(ObjectBox* objbox)
-{
- // An objbox added to CGObjectList as non-first element has non-null
- // emitLink member. The first element has null emitLink.
- // Check for firstbox to cover the first element.
- return objbox->emitLink || objbox == firstbox;
-}
-
/*
* Find the index of the given object for code generator.
*
@@ -9982,15 +10927,9 @@ CGObjectList::isAdded(ObjectBox* objbox)
unsigned
CGObjectList::add(ObjectBox* objbox)
{
- if (isAdded(objbox))
- return indexOf(objbox->object);
-
+ MOZ_ASSERT(!objbox->emitLink);
objbox->emitLink = lastbox;
lastbox = objbox;
-
- // See the comment in CGObjectList::isAdded.
- if (!firstbox)
- firstbox = objbox;
return length++;
}
@@ -10017,12 +10956,7 @@ CGObjectList::finish(ObjectArray* array)
MOZ_ASSERT(!*cursor);
MOZ_ASSERT(objbox->object->isTenured());
*cursor = objbox->object;
-
- ObjectBox* tmp = objbox->emitLink;
- // Clear emitLink for CGObjectList::isAdded.
- objbox->emitLink = nullptr;
- objbox = tmp;
- } while (objbox != nullptr);
+ } while ((objbox = objbox->emitLink) != nullptr);
MOZ_ASSERT(cursor == array->vector);
}
diff --git a/js/src/frontend/BytecodeEmitter.h b/js/src/frontend/BytecodeEmitter.h
index 1bb4191ee1..04307c8c19 100644
--- a/js/src/frontend/BytecodeEmitter.h
+++ b/js/src/frontend/BytecodeEmitter.h
@@ -43,12 +43,10 @@ class CGConstList {
struct CGObjectList {
uint32_t length; /* number of emitted so far objects */
- ObjectBox* firstbox; /* first emitted object */
ObjectBox* lastbox; /* last emitted object */
- CGObjectList() : length(0), firstbox(nullptr), lastbox(nullptr) {}
+ CGObjectList() : length(0), lastbox(nullptr) {}
- bool isAdded(ObjectBox* objbox);
unsigned add(ObjectBox* objbox);
unsigned indexOf(JSObject* obj);
void finish(ObjectArray* array);
@@ -102,7 +100,9 @@ struct CGScopeNoteList {
struct CGYieldOffsetList {
Vector<uint32_t> list;
- explicit CGYieldOffsetList(ExclusiveContext* cx) : list(cx) {}
+ uint32_t numYields;
+ uint32_t numAwaits;
+ explicit CGYieldOffsetList(ExclusiveContext* cx) : list(cx), numYields(0), numAwaits(0) {}
MOZ_MUST_USE bool append(uint32_t offset) { return list.append(offset); }
size_t length() const { return list.length(); }
@@ -435,7 +435,7 @@ struct MOZ_STACK_CLASS BytecodeEmitter
MOZ_MUST_USE bool emitTree(ParseNode* pn, EmitLineNumberNote emitLineNote = EMIT_LINENOTE);
// Emit code for the tree rooted at pn with its own TDZ cache.
- MOZ_MUST_USE bool emitConditionallyExecutedTree(ParseNode* pn);
+ MOZ_MUST_USE bool emitTreeInBranch(ParseNode* pn);
// Emit global, eval, or module code for tree rooted at body. Always
// encompasses the entire source.
@@ -454,8 +454,6 @@ struct MOZ_STACK_CLASS BytecodeEmitter
JSOp strictifySetNameOp(JSOp op);
- MOZ_MUST_USE bool flushPops(int* npops);
-
MOZ_MUST_USE bool emitCheck(ptrdiff_t delta, ptrdiff_t* offset);
// Emit one bytecode.
@@ -475,6 +473,9 @@ struct MOZ_STACK_CLASS BytecodeEmitter
// Helper to emit JSOP_CHECKISOBJ.
MOZ_MUST_USE bool emitCheckIsObj(CheckIsObjectKind kind);
+ // Helper to emit JSOP_CHECKISCALLABLE.
+ MOZ_MUST_USE bool emitCheckIsCallable(CheckIsCallableKind kind);
+
// Emit a bytecode followed by an uint16 immediate operand stored in
// big-endian order.
MOZ_MUST_USE bool emitUint16Operand(JSOp op, uint32_t operand);
@@ -611,7 +612,7 @@ struct MOZ_STACK_CLASS BytecodeEmitter
// Emit bytecode to put operands for a JSOP_GETELEM/CALLELEM/SETELEM/DELELEM
// opcode onto the stack in the right order. In the case of SETELEM, the
// value to be assigned must already be pushed.
- enum class EmitElemOption { Get, Set, Call, IncDec, CompoundAssign };
+ enum class EmitElemOption { Get, Set, Call, IncDec, CompoundAssign, Ref };
MOZ_MUST_USE bool emitElemOperands(ParseNode* pn, EmitElemOption opts);
MOZ_MUST_USE bool emitElemOpBase(JSOp op);
@@ -644,12 +645,18 @@ struct MOZ_STACK_CLASS BytecodeEmitter
DestructuringAssignment
};
- // emitDestructuringLHS assumes the to-be-destructured value has been pushed on
- // the stack and emits code to destructure a single lhs expression (either a
- // name or a compound []/{} expression).
- MOZ_MUST_USE bool emitDestructuringLHS(ParseNode* target, DestructuringFlavor flav);
- MOZ_MUST_USE bool emitConditionallyExecutedDestructuringLHS(ParseNode* target,
- DestructuringFlavor flav);
+ // emitDestructuringLHSRef emits the lhs expression's reference.
+ // If the lhs expression is object property |OBJ.prop|, it emits |OBJ|.
+ // If it's object element |OBJ[ELEM]|, it emits |OBJ| and |ELEM|.
+ // If there's nothing to evaluate for the reference, it emits nothing.
+ // |emitted| parameter receives the number of values pushed onto the stack.
+ MOZ_MUST_USE bool emitDestructuringLHSRef(ParseNode* target, size_t* emitted);
+
+ // emitSetOrInitializeDestructuring assumes the lhs expression's reference
+ // and the to-be-destructured value has been pushed on the stack. It emits
+ // code to destructure a single lhs expression (either a name or a compound
+ // []/{} expression).
+ MOZ_MUST_USE bool emitSetOrInitializeDestructuring(ParseNode* target, DestructuringFlavor flav);
// emitDestructuringOps assumes the to-be-destructured value has been
// pushed on the stack and emits code to destructure each part of a [] or
@@ -675,10 +682,25 @@ struct MOZ_STACK_CLASS BytecodeEmitter
// Pops iterator from the top of the stack. Pushes the result of |.next()|
// onto the stack.
MOZ_MUST_USE bool emitIteratorNext(ParseNode* pn, bool allowSelfHosted = false);
+ MOZ_MUST_USE bool emitIteratorClose(CompletionKind completionKind = CompletionKind::Normal,
+ bool allowSelfHosted = false);
+
+ template <typename InnerEmitter>
+ MOZ_MUST_USE bool wrapWithDestructuringIteratorCloseTryNote(int32_t iterDepth,
+ InnerEmitter emitter);
// Check if the value on top of the stack is "undefined". If so, replace
// that value on the stack with the value defined by |defaultExpr|.
- MOZ_MUST_USE bool emitDefault(ParseNode* defaultExpr);
+ // |pattern| is a lhs node of the default expression. If it's an
+ // identifier and |defaultExpr| is an anonymous function, |SetFunctionName|
+ // is called at compile time.
+ MOZ_MUST_USE bool emitDefault(ParseNode* defaultExpr, ParseNode* pattern);
+
+ MOZ_MUST_USE bool setOrEmitSetFunName(ParseNode* maybeFun, HandleAtom name,
+ FunctionPrefixKind prefixKind);
+
+ MOZ_MUST_USE bool emitInitializer(ParseNode* initializer, ParseNode* pattern);
+ MOZ_MUST_USE bool emitInitializerInBranch(ParseNode* initializer, ParseNode* pattern);
MOZ_MUST_USE bool emitCallSiteObject(ParseNode* pn);
MOZ_MUST_USE bool emitTemplateString(ParseNode* pn);
@@ -713,7 +735,7 @@ struct MOZ_STACK_CLASS BytecodeEmitter
MOZ_MUST_USE bool emitSelfHostedCallFunction(ParseNode* pn);
MOZ_MUST_USE bool emitSelfHostedResumeGenerator(ParseNode* pn);
MOZ_MUST_USE bool emitSelfHostedForceInterpreter(ParseNode* pn);
- MOZ_MUST_USE bool emitSelfHostedAllowContentSpread(ParseNode* pn);
+ MOZ_MUST_USE bool emitSelfHostedAllowContentIter(ParseNode* pn);
MOZ_MUST_USE bool emitComprehensionFor(ParseNode* compFor);
MOZ_MUST_USE bool emitComprehensionForIn(ParseNode* pn);
diff --git a/js/src/frontend/FullParseHandler.h b/js/src/frontend/FullParseHandler.h
index add881900a..0fd1377962 100644
--- a/js/src/frontend/FullParseHandler.h
+++ b/js/src/frontend/FullParseHandler.h
@@ -665,6 +665,11 @@ class FullParseHandler
ParseNode* pn);
inline void setLastFunctionFormalParameterDestructuring(ParseNode* funcpn, ParseNode* pn);
+ void checkAndSetIsDirectRHSAnonFunction(ParseNode* pn) {
+ if (IsAnonymousFunctionDefinition(pn))
+ pn->setDirectRHSAnonFunction(true);
+ }
+
ParseNode* newFunctionDefinition() {
return new_<CodeNode>(PNK_FUNCTION, pos());
}
@@ -942,6 +947,8 @@ FullParseHandler::setLastFunctionFormalParameterDefault(ParseNode* funcpn, Parse
if (!pn)
return false;
+ checkAndSetIsDirectRHSAnonFunction(defaultValue);
+
funcpn->pn_body->pn_pos.end = pn->pn_pos.end;
ParseNode* pnchild = funcpn->pn_body->pn_head;
ParseNode* pnlast = funcpn->pn_body->last();
diff --git a/js/src/frontend/ParseNode-inl.h b/js/src/frontend/ParseNode-inl.h
index 395d09b5b9..21bd837668 100644
--- a/js/src/frontend/ParseNode-inl.h
+++ b/js/src/frontend/ParseNode-inl.h
@@ -18,7 +18,7 @@ inline PropertyName*
ParseNode::name() const
{
MOZ_ASSERT(isKind(PNK_FUNCTION) || isKind(PNK_NAME));
- JSAtom* atom = isKind(PNK_FUNCTION) ? pn_funbox->function()->name() : pn_atom;
+ JSAtom* atom = isKind(PNK_FUNCTION) ? pn_funbox->function()->explicitName() : pn_atom;
return atom->asPropertyName();
}
diff --git a/js/src/frontend/ParseNode.cpp b/js/src/frontend/ParseNode.cpp
index f79baba9ef..ece3a45dfb 100644
--- a/js/src/frontend/ParseNode.cpp
+++ b/js/src/frontend/ParseNode.cpp
@@ -902,3 +902,21 @@ FunctionBox::trace(JSTracer* trc)
if (enclosingScope_)
TraceRoot(trc, &enclosingScope_, "funbox-enclosingScope");
}
+
+bool
+js::frontend::IsAnonymousFunctionDefinition(ParseNode* pn)
+{
+ // ES 2017 draft
+ // 12.15.2 (ArrowFunction, AsyncArrowFunction).
+ // 14.1.12 (FunctionExpression).
+ // 14.4.8 (GeneratorExpression).
+ // 14.6.8 (AsyncFunctionExpression)
+ if (pn->isKind(PNK_FUNCTION) && !pn->pn_funbox->function()->explicitName())
+ return true;
+
+ // 14.5.8 (ClassExpression)
+ if (pn->is<ClassNode>() && !pn->as<ClassNode>().names())
+ return true;
+
+ return false;
+}
diff --git a/js/src/frontend/ParseNode.h b/js/src/frontend/ParseNode.h
index d37aaaae08..c58dab431b 100644
--- a/js/src/frontend/ParseNode.h
+++ b/js/src/frontend/ParseNode.h
@@ -450,6 +450,9 @@ class ParseNode
uint8_t pn_op; /* see JSOp enum and jsopcode.tbl */
uint8_t pn_arity:4; /* see ParseNodeArity enum */
bool pn_parens:1; /* this expr was enclosed in parens */
+ bool pn_rhs_anon_fun:1; /* this expr is anonymous function or class that
+ * is a direct RHS of PNK_ASSIGN or PNK_COLON of
+ * property, that needs SetFunctionName. */
ParseNode(const ParseNode& other) = delete;
void operator=(const ParseNode& other) = delete;
@@ -460,6 +463,7 @@ class ParseNode
pn_op(op),
pn_arity(arity),
pn_parens(false),
+ pn_rhs_anon_fun(false),
pn_pos(0, 0),
pn_next(nullptr)
{
@@ -472,6 +476,7 @@ class ParseNode
pn_op(op),
pn_arity(arity),
pn_parens(false),
+ pn_rhs_anon_fun(false),
pn_pos(pos),
pn_next(nullptr)
{
@@ -512,6 +517,13 @@ class ParseNode
bool isLikelyIIFE() const { return isInParens(); }
void setInParens(bool enabled) { pn_parens = enabled; }
+ bool isDirectRHSAnonFunction() const {
+ return pn_rhs_anon_fun;
+ }
+ void setDirectRHSAnonFunction(bool enabled) {
+ pn_rhs_anon_fun = enabled;
+ }
+
TokenPos pn_pos; /* two 16-bit pairs here, for 64 bits */
ParseNode* pn_next; /* intrinsic link in parent PN_LIST */
@@ -637,14 +649,12 @@ class ParseNode
MOZ_ASSERT(pn_arity == PN_CODE && getKind() == PNK_FUNCTION);
MOZ_ASSERT(isOp(JSOP_LAMBDA) || // lambda, genexpr
isOp(JSOP_LAMBDA_ARROW) || // arrow function
- isOp(JSOP_FUNWITHPROTO) || // already emitted lambda with needsProto
isOp(JSOP_DEFFUN) || // non-body-level function statement
isOp(JSOP_NOP) || // body-level function stmt in global code
isOp(JSOP_GETLOCAL) || // body-level function stmt in function code
isOp(JSOP_GETARG) || // body-level function redeclaring formal
isOp(JSOP_INITLEXICAL)); // block-level function stmt
- return !isOp(JSOP_LAMBDA) && !isOp(JSOP_LAMBDA_ARROW) &&
- !isOp(JSOP_FUNWITHPROTO) && !isOp(JSOP_DEFFUN);
+ return !isOp(JSOP_LAMBDA) && !isOp(JSOP_LAMBDA_ARROW) && !isOp(JSOP_DEFFUN);
}
/*
@@ -1444,6 +1454,9 @@ FunctionFormalParametersList(ParseNode* fn, unsigned* numFormals)
return argsBody->pn_head;
}
+bool
+IsAnonymousFunctionDefinition(ParseNode* pn);
+
} /* namespace frontend */
} /* namespace js */
diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp
index 49fef2bf95..623379f61f 100644
--- a/js/src/frontend/Parser.cpp
+++ b/js/src/frontend/Parser.cpp
@@ -326,10 +326,14 @@ ParseContext::init()
if (fun->isNamedLambda()) {
if (!namedLambdaScope_->init(this))
return false;
- AddDeclaredNamePtr p = namedLambdaScope_->lookupDeclaredNameForAdd(fun->name());
+ AddDeclaredNamePtr p =
+ namedLambdaScope_->lookupDeclaredNameForAdd(fun->explicitName());
MOZ_ASSERT(!p);
- if (!namedLambdaScope_->addDeclaredName(this, p, fun->name(), DeclarationKind::Const))
+ if (!namedLambdaScope_->addDeclaredName(this, p, fun->explicitName(),
+ DeclarationKind::Const))
+ {
return false;
+ }
}
if (!functionScope_->init(this))
@@ -367,7 +371,7 @@ ParseContext::removeInnerFunctionBoxesForAnnexB(JSAtom* name)
{
for (uint32_t i = 0; i < innerFunctionBoxesForAnnexB_->length(); i++) {
if (FunctionBox* funbox = innerFunctionBoxesForAnnexB_[i]) {
- if (funbox->function()->name() == name)
+ if (funbox->function()->explicitName() == name)
innerFunctionBoxesForAnnexB_[i] = nullptr;
}
}
@@ -465,6 +469,7 @@ FunctionBox::FunctionBox(ExclusiveContext* cx, LifoAlloc& alloc, ObjectBox* trac
usesApply(false),
usesThis(false),
usesReturn(false),
+ hasRest_(false),
funCxFlags()
{
// Functions created at parse time may be set singleton after parsing and
@@ -477,7 +482,6 @@ void
FunctionBox::initFromLazyFunction()
{
JSFunction* fun = function();
- length = fun->nargs() - fun->hasRest();
if (fun->lazyScript()->isDerivedClassConstructor())
setDerivedClassConstructor();
if (fun->lazyScript()->needsHomeObject())
@@ -492,8 +496,6 @@ FunctionBox::initStandaloneFunction(Scope* enclosingScope)
// Standalone functions are Function or Generator constructors and are
// always scoped to the global.
MOZ_ASSERT(enclosingScope->is<GlobalScope>());
- JSFunction* fun = function();
- length = fun->nargs() - fun->hasRest();
enclosingScope_ = enclosingScope;
allowNewTarget_ = true;
thisBinding_ = ThisBinding::Function;
@@ -836,7 +838,7 @@ Parser<ParseHandler>::reportBadReturn(Node pn, ParseReportKind kind,
unsigned errnum, unsigned anonerrnum)
{
JSAutoByteString name;
- if (JSAtom* atom = pc->functionBox()->function()->name()) {
+ if (JSAtom* atom = pc->functionBox()->function()->explicitName()) {
if (!AtomToPrintableString(context, atom, &name))
return false;
} else {
@@ -2214,6 +2216,8 @@ Parser<SyntaxParseHandler>::finishFunction()
lazy->setStrict();
lazy->setGeneratorKind(funbox->generatorKind());
lazy->setAsyncKind(funbox->asyncKind());
+ if (funbox->hasRest())
+ lazy->setHasRest();
if (funbox->isLikelyConstructorWrapper())
lazy->setLikelyConstructorWrapper();
if (funbox->isDerivedClassConstructor())
@@ -2245,13 +2249,13 @@ GetYieldHandling(GeneratorKind generatorKind, FunctionAsyncKind asyncKind)
template <>
ParseNode*
-Parser<FullParseHandler>::standaloneFunctionBody(HandleFunction fun,
- HandleScope enclosingScope,
- Handle<PropertyNameVector> formals,
- GeneratorKind generatorKind,
- FunctionAsyncKind asyncKind,
- Directives inheritedDirectives,
- Directives* newDirectives)
+Parser<FullParseHandler>::standaloneFunction(HandleFunction fun,
+ HandleScope enclosingScope,
+ Maybe<uint32_t> parameterListEnd,
+ GeneratorKind generatorKind,
+ FunctionAsyncKind asyncKind,
+ Directives inheritedDirectives,
+ Directives* newDirectives)
{
MOZ_ASSERT(checkOptionsCalled);
@@ -2274,25 +2278,14 @@ Parser<FullParseHandler>::standaloneFunctionBody(HandleFunction fun,
if (!funpc.init())
return null();
funpc.setIsStandaloneFunctionBody();
- funpc.functionScope().useAsVarScope(&funpc);
-
- if (formals.length() >= ARGNO_LIMIT) {
- report(ParseError, false, null(), JSMSG_TOO_MANY_FUN_ARGS);
- return null();
- }
-
- bool duplicatedParam = false;
- for (uint32_t i = 0; i < formals.length(); i++) {
- if (!notePositionalFormalParameter(fn, formals[i], false, &duplicatedParam))
- return null();
- }
- funbox->hasDuplicateParameters = duplicatedParam;
YieldHandling yieldHandling = GetYieldHandling(generatorKind, asyncKind);
AutoAwaitIsKeyword awaitIsKeyword(&tokenStream, asyncKind == AsyncFunction);
- ParseNode* pn = functionBody(InAllowed, yieldHandling, Statement, StatementListBody);
- if (!pn)
+ if (!functionFormalParametersAndBody(InAllowed, yieldHandling, fn, Statement,
+ parameterListEnd))
+ {
return null();
+ }
TokenKind tt;
if (!tokenStream.getToken(&tt, TokenStream::Operand))
@@ -2303,15 +2296,7 @@ Parser<FullParseHandler>::standaloneFunctionBody(HandleFunction fun,
return null();
}
- if (!FoldConstants(context, &pn, this))
- return null();
-
- fn->pn_pos.end = pos().end;
-
- MOZ_ASSERT(fn->pn_body->isKind(PNK_PARAMSBODY));
- fn->pn_body->append(pn);
-
- if (!finishFunction())
+ if (!FoldConstants(context, &fn, this))
return null();
return fn;
@@ -2776,7 +2761,7 @@ Parser<ParseHandler>::functionArguments(YieldHandling yieldHandling, FunctionSyn
}
hasRest = true;
- funbox->function()->setHasRest();
+ funbox->setHasRest();
if (!tokenStream.getToken(&tt))
return false;
@@ -3415,7 +3400,8 @@ template <typename ParseHandler>
bool
Parser<ParseHandler>::functionFormalParametersAndBody(InHandling inHandling,
YieldHandling yieldHandling,
- Node pn, FunctionSyntaxKind kind)
+ Node pn, FunctionSyntaxKind kind,
+ Maybe<uint32_t> parameterListEnd /* = Nothing() */)
{
// Given a properly initialized parse context, try to parse an actual
// function without concern for conversion to strict mode, use of lazy
@@ -3447,6 +3433,13 @@ Parser<ParseHandler>::functionFormalParametersAndBody(InHandling inHandling,
}
}
+ // When parsing something for new Function() we have to make sure to
+ // only treat a certain part of the source as a parameter list.
+ if (parameterListEnd.isSome() && parameterListEnd.value() != pos().begin) {
+ report(ParseError, false, null(), JSMSG_UNEXPECTED_PARAMLIST_END);
+ return false;
+ }
+
// Parse the function body.
FunctionBodyType bodyType = StatementListBody;
TokenKind tt;
@@ -3488,8 +3481,8 @@ Parser<ParseHandler>::functionFormalParametersAndBody(InHandling inHandling,
if (!body)
return false;
- if ((kind != Method && !IsConstructorKind(kind)) && fun->name()) {
- RootedPropertyName propertyName(context, fun->name()->asPropertyName());
+ if ((kind != Method && !IsConstructorKind(kind)) && fun->explicitName()) {
+ RootedPropertyName propertyName(context, fun->explicitName()->asPropertyName());
if (!checkStrictBinding(propertyName, handler.getPosition(pn)))
return false;
}
@@ -3502,7 +3495,7 @@ Parser<ParseHandler>::functionFormalParametersAndBody(InHandling inHandling,
report(ParseError, false, null(), JSMSG_CURLY_AFTER_BODY);
return false;
}
- funbox->bufEnd = pos().begin + 1;
+ funbox->bufEnd = pos().end;
} else {
#if !JS_HAS_EXPR_CLOSURES
MOZ_ASSERT(kind == Arrow);
@@ -4348,6 +4341,8 @@ Parser<ParseHandler>::declarationPattern(Node decl, DeclarationKind declKind, To
if (!init)
return null();
+ handler.checkAndSetIsDirectRHSAnonFunction(init);
+
if (forHeadKind) {
// For for(;;) declarations, consistency with |for (;| parsing requires
// that the ';' first be examined as Operand, even though absence of a
@@ -4377,6 +4372,8 @@ Parser<ParseHandler>::initializerInNameDeclaration(Node decl, Node binding,
if (!initializer)
return false;
+ handler.checkAndSetIsDirectRHSAnonFunction(initializer);
+
if (forHeadKind) {
if (initialDeclaration) {
bool isForIn, isForOf;
@@ -5074,7 +5071,7 @@ Parser<FullParseHandler>::exportDeclaration()
if (!kid)
return null();
- if (!checkExportedName(kid->pn_funbox->function()->name()))
+ if (!checkExportedName(kid->pn_funbox->function()->explicitName()))
return null();
break;
@@ -6681,8 +6678,6 @@ Parser<ParseHandler>::classDefinition(YieldHandling yieldHandling,
return null();
}
- // FIXME: Implement ES6 function "name" property semantics
- // (bug 883377).
RootedAtom funName(context);
switch (propType) {
case PropertyType::GetterNoExpressionClosure:
@@ -6705,6 +6700,8 @@ Parser<ParseHandler>::classDefinition(YieldHandling yieldHandling,
if (!fn)
return null();
+ handler.checkAndSetIsDirectRHSAnonFunction(fn);
+
JSOp op = JSOpFromPropertyType(propType);
if (!handler.addClassMethodDefinition(classMethods, propName, fn, op, isStatic))
return null();
@@ -7764,6 +7761,9 @@ Parser<ParseHandler>::assignExpr(InHandling inHandling, YieldHandling yieldHandl
return null();
}
+ if (kind == PNK_ASSIGN)
+ handler.checkAndSetIsDirectRHSAnonFunction(rhs);
+
return handler.newAssignment(kind, lhs, rhs, op);
}
@@ -9166,6 +9166,8 @@ Parser<ParseHandler>::objectLiteral(YieldHandling yieldHandling, PossibleError*
if (!propExpr)
return null();
+ handler.checkAndSetIsDirectRHSAnonFunction(propExpr);
+
if (foldConstants && !FoldConstants(context, &propExpr, this))
return null();
@@ -9279,6 +9281,8 @@ Parser<ParseHandler>::objectLiteral(YieldHandling yieldHandling, PossibleError*
return null();
}
+ handler.checkAndSetIsDirectRHSAnonFunction(rhs);
+
Node propExpr = handler.newAssignment(PNK_ASSIGN, lhs, rhs, JSOP_NOP);
if (!propExpr)
return null();
@@ -9289,8 +9293,6 @@ Parser<ParseHandler>::objectLiteral(YieldHandling yieldHandling, PossibleError*
if (!abortIfSyntaxParser())
return null();
} else {
- // FIXME: Implement ES6 function "name" property semantics
- // (bug 883377).
RootedAtom funName(context);
if (!tokenStream.isCurrentTokenType(TOK_RB)) {
funName = propAtom;
@@ -9306,6 +9308,8 @@ Parser<ParseHandler>::objectLiteral(YieldHandling yieldHandling, PossibleError*
if (!fn)
return null();
+ handler.checkAndSetIsDirectRHSAnonFunction(fn);
+
JSOp op = JSOpFromPropertyType(propType);
if (!handler.addObjectMethodDefinition(literal, propName, fn, op))
return null();
@@ -9613,8 +9617,9 @@ Parser<ParseHandler>::warnOnceAboutForEach()
return true;
if (!cx->compartment()->warnedAboutForEach) {
- if (!report(ParseWarning, false, null(), JSMSG_DEPRECATED_FOR_EACH))
- return false;
+ // Disabled warning spew.
+ // if (!report(ParseWarning, false, null(), JSMSG_DEPRECATED_FOR_EACH))
+ // return false;
cx->compartment()->warnedAboutForEach = true;
}
return true;
diff --git a/js/src/frontend/Parser.h b/js/src/frontend/Parser.h
index 0ad4d56a0b..b58b021cd7 100644
--- a/js/src/frontend/Parser.h
+++ b/js/src/frontend/Parser.h
@@ -1020,12 +1020,12 @@ class Parser final : private JS::AutoGCRooter, public StrictModeGetter
// Parse a module.
Node moduleBody(ModuleSharedContext* modulesc);
- // Parse a function, given only its body. Used for the Function and
- // Generator constructors.
- Node standaloneFunctionBody(HandleFunction fun, HandleScope enclosingScope,
- Handle<PropertyNameVector> formals,
- GeneratorKind generatorKind, FunctionAsyncKind asyncKind,
- Directives inheritedDirectives, Directives* newDirectives);
+ // Parse a function, used for the Function, GeneratorFunction, and
+ // AsyncFunction constructors.
+ Node standaloneFunction(HandleFunction fun, HandleScope enclosingScope,
+ mozilla::Maybe<uint32_t> parameterListEnd,
+ GeneratorKind generatorKind, FunctionAsyncKind asyncKind,
+ Directives inheritedDirectives, Directives* newDirectives);
// Parse a function, given only its arguments and body. Used for lazily
// parsed functions.
@@ -1041,7 +1041,9 @@ class Parser final : private JS::AutoGCRooter, public StrictModeGetter
// Parse a function's formal parameters and its body assuming its function
// ParseContext is already on the stack.
bool functionFormalParametersAndBody(InHandling inHandling, YieldHandling yieldHandling,
- Node pn, FunctionSyntaxKind kind);
+ Node pn, FunctionSyntaxKind kind,
+ mozilla::Maybe<uint32_t> parameterListEnd = mozilla::Nothing());
+
// Determine whether |yield| is a valid name in the current context, or
// whether it's prohibited due to strictness, JS version, or occurrence
diff --git a/js/src/frontend/SharedContext.h b/js/src/frontend/SharedContext.h
index 39df47c20a..a6ac542f67 100644
--- a/js/src/frontend/SharedContext.h
+++ b/js/src/frontend/SharedContext.h
@@ -471,6 +471,7 @@ class FunctionBox : public ObjectBox, public SharedContext
bool usesApply:1; /* contains an f.apply() call */
bool usesThis:1; /* contains 'this' */
bool usesReturn:1; /* contains a 'return' statement */
+ bool hasRest_:1; /* has rest parameter */
FunctionContextFlags funCxFlags;
@@ -539,6 +540,11 @@ class FunctionBox : public ObjectBox, public SharedContext
bool isAsync() const { return asyncKind() == AsyncFunction; }
bool isArrow() const { return function()->isArrow(); }
+ bool hasRest() const { return hasRest_; }
+ void setHasRest() {
+ hasRest_ = true;
+ }
+
void setGeneratorKind(GeneratorKind kind) {
// A generator kind can be set at initialization, or when "yield" is
// first seen. In both cases the transition can only happen from
@@ -567,7 +573,7 @@ class FunctionBox : public ObjectBox, public SharedContext
void setHasInnerFunctions() { funCxFlags.hasInnerFunctions = true; }
bool hasSimpleParameterList() const {
- return !function()->hasRest() && !hasParameterExprs && !hasDestructuringArgs;
+ return !hasRest() && !hasParameterExprs && !hasDestructuringArgs;
}
bool hasMappedArgsObj() const {
diff --git a/js/src/frontend/SyntaxParseHandler.h b/js/src/frontend/SyntaxParseHandler.h
index 75c7e33337..b7f00605be 100644
--- a/js/src/frontend/SyntaxParseHandler.h
+++ b/js/src/frontend/SyntaxParseHandler.h
@@ -339,6 +339,9 @@ class SyntaxParseHandler
Node catchGuard, Node catchBody) { return true; }
MOZ_MUST_USE bool setLastFunctionFormalParameterDefault(Node funcpn, Node pn) { return true; }
+
+ void checkAndSetIsDirectRHSAnonFunction(Node pn) {}
+
Node newFunctionDefinition() { return NodeFunctionDefinition; }
bool setComprehensionLambdaBody(Node pn, Node body) { return true; }
void setFunctionFormalParametersAndBody(Node pn, Node kid) {}
diff --git a/js/src/frontend/TokenStream.cpp b/js/src/frontend/TokenStream.cpp
index c166ed4145..179a7c2447 100644
--- a/js/src/frontend/TokenStream.cpp
+++ b/js/src/frontend/TokenStream.cpp
@@ -118,13 +118,57 @@ IsIdentifier(const CharT* chars, size_t length)
return true;
}
+static uint32_t
+GetSingleCodePoint(const char16_t** p, const char16_t* end)
+{
+ uint32_t codePoint;
+ if (MOZ_UNLIKELY(unicode::IsLeadSurrogate(**p)) && *p + 1 < end) {
+ char16_t lead = **p;
+ char16_t maybeTrail = *(*p + 1);
+ if (unicode::IsTrailSurrogate(maybeTrail)) {
+ *p += 2;
+ return unicode::UTF16Decode(lead, maybeTrail);
+ }
+ }
+
+ codePoint = **p;
+ (*p)++;
+ return codePoint;
+}
+
+static bool
+IsIdentifierMaybeNonBMP(const char16_t* chars, size_t length)
+{
+ if (IsIdentifier(chars, length))
+ return true;
+
+ if (length == 0)
+ return false;
+
+ const char16_t* p = chars;
+ const char16_t* end = chars + length;
+ uint32_t codePoint;
+
+ codePoint = GetSingleCodePoint(&p, end);
+ if (!unicode::IsIdentifierStart(codePoint))
+ return false;
+
+ while (p < end) {
+ codePoint = GetSingleCodePoint(&p, end);
+ if (!unicode::IsIdentifierPart(codePoint))
+ return false;
+ }
+
+ return true;
+}
+
bool
frontend::IsIdentifier(JSLinearString* str)
{
JS::AutoCheckCannotGC nogc;
return str->hasLatin1Chars()
? ::IsIdentifier(str->latin1Chars(nogc), str->length())
- : ::IsIdentifier(str->twoByteChars(nogc), str->length());
+ : ::IsIdentifierMaybeNonBMP(str->twoByteChars(nogc), str->length());
}
bool
@@ -993,6 +1037,21 @@ IsTokenSane(Token* tp)
#endif
bool
+TokenStream::matchTrailForLeadSurrogate(char16_t lead, char16_t* trail, uint32_t* codePoint)
+{
+ int32_t maybeTrail = getCharIgnoreEOL();
+ if (!unicode::IsTrailSurrogate(maybeTrail)) {
+ ungetCharIgnoreEOL(maybeTrail);
+ return false;
+ }
+
+ if (trail)
+ *trail = maybeTrail;
+ *codePoint = unicode::UTF16Decode(lead, maybeTrail);
+ return true;
+}
+
+bool
TokenStream::putIdentInTokenbuf(const char16_t* identStart)
{
int32_t c;
@@ -1003,11 +1062,39 @@ TokenStream::putIdentInTokenbuf(const char16_t* identStart)
tokenbuf.clear();
for (;;) {
c = getCharIgnoreEOL();
+
+ if (MOZ_UNLIKELY(unicode::IsLeadSurrogate(c))) {
+ char16_t trail;
+ uint32_t codePoint;
+ if (matchTrailForLeadSurrogate(c, &trail, &codePoint)) {
+ if (!unicode::IsIdentifierPart(codePoint))
+ break;
+
+ if (!tokenbuf.append(c) || !tokenbuf.append(trail)) {
+ userbuf.setAddressOfNextRawChar(tmp);
+ return false;
+ }
+ continue;
+ }
+ }
+
if (!unicode::IsIdentifierPart(char16_t(c))) {
if (c != '\\' || !matchUnicodeEscapeIdent(&qc))
break;
+
+ if (MOZ_UNLIKELY(unicode::IsSupplementary(qc))) {
+ char16_t lead, trail;
+ unicode::UTF16Encode(qc, &lead, &trail);
+ if (!tokenbuf.append(lead) || !tokenbuf.append(trail)) {
+ userbuf.setAddressOfNextRawChar(tmp);
+ return false;
+ }
+ continue;
+ }
+
c = qc;
}
+
if (!tokenbuf.append(c)) {
userbuf.setAddressOfNextRawChar(tmp);
return false;
@@ -1168,12 +1255,23 @@ TokenStream::getTokenInternal(TokenKind* ttp, Modifier modifier)
static_assert('_' < 128,
"IdentifierStart contains '_', but as !IsUnicodeIDStart('_'), "
"ensure that '_' is never handled here");
- if (unicode::IsUnicodeIDStart(c)) {
+ if (unicode::IsUnicodeIDStart(char16_t(c))) {
identStart = userbuf.addressOfNextRawChar() - 1;
hadUnicodeEscape = false;
goto identifier;
}
+ if (MOZ_UNLIKELY(unicode::IsLeadSurrogate(c))) {
+ uint32_t codePoint;
+ if (matchTrailForLeadSurrogate(c, nullptr, &codePoint) &&
+ unicode::IsUnicodeIDStart(codePoint))
+ {
+ identStart = userbuf.addressOfNextRawChar() - 2;
+ hadUnicodeEscape = false;
+ goto identifier;
+ }
+ }
+
goto badchar;
}
@@ -1224,6 +1322,17 @@ TokenStream::getTokenInternal(TokenKind* ttp, Modifier modifier)
c = getCharIgnoreEOL();
if (c == EOF)
break;
+
+ if (MOZ_UNLIKELY(unicode::IsLeadSurrogate(c))) {
+ uint32_t codePoint;
+ if (matchTrailForLeadSurrogate(c, nullptr, &codePoint)) {
+ if (!unicode::IsIdentifierPart(codePoint))
+ break;
+
+ continue;
+ }
+ }
+
if (!unicode::IsIdentifierPart(char16_t(c))) {
if (c != '\\' || !matchUnicodeEscapeIdent(&qc))
break;
@@ -1318,9 +1427,21 @@ TokenStream::getTokenInternal(TokenKind* ttp, Modifier modifier)
}
ungetCharIgnoreEOL(c);
- if (c != EOF && unicode::IsIdentifierStart(char16_t(c))) {
- reportError(JSMSG_IDSTART_AFTER_NUMBER);
- goto error;
+ if (c != EOF) {
+ if (unicode::IsIdentifierStart(char16_t(c))) {
+ reportError(JSMSG_IDSTART_AFTER_NUMBER);
+ goto error;
+ }
+
+ if (MOZ_UNLIKELY(unicode::IsLeadSurrogate(c))) {
+ uint32_t codePoint;
+ if (matchTrailForLeadSurrogate(c, nullptr, &codePoint) &&
+ unicode::IsIdentifierStart(codePoint))
+ {
+ reportError(JSMSG_IDSTART_AFTER_NUMBER);
+ goto error;
+ }
+ }
}
// Unlike identifiers and strings, numbers cannot contain escaped
@@ -1425,9 +1546,21 @@ TokenStream::getTokenInternal(TokenKind* ttp, Modifier modifier)
}
ungetCharIgnoreEOL(c);
- if (c != EOF && unicode::IsIdentifierStart(char16_t(c))) {
- reportError(JSMSG_IDSTART_AFTER_NUMBER);
- goto error;
+ if (c != EOF) {
+ if (unicode::IsIdentifierStart(char16_t(c))) {
+ reportError(JSMSG_IDSTART_AFTER_NUMBER);
+ goto error;
+ }
+
+ if (MOZ_UNLIKELY(unicode::IsLeadSurrogate(c))) {
+ uint32_t codePoint;
+ if (matchTrailForLeadSurrogate(c, nullptr, &codePoint) &&
+ unicode::IsIdentifierStart(codePoint))
+ {
+ reportError(JSMSG_IDSTART_AFTER_NUMBER);
+ goto error;
+ }
+ }
}
double dval;
diff --git a/js/src/frontend/TokenStream.h b/js/src/frontend/TokenStream.h
index 29dcead62e..5d6b4b795a 100644
--- a/js/src/frontend/TokenStream.h
+++ b/js/src/frontend/TokenStream.h
@@ -952,6 +952,7 @@ class MOZ_STACK_CLASS TokenStream
uint32_t peekExtendedUnicodeEscape(uint32_t* codePoint);
uint32_t matchUnicodeEscapeIdStart(uint32_t* codePoint);
bool matchUnicodeEscapeIdent(uint32_t* codePoint);
+ bool matchTrailForLeadSurrogate(char16_t lead, char16_t* trail, uint32_t* codePoint);
bool peekChars(int n, char16_t* cp);
MOZ_MUST_USE bool getDirectives(bool isMultiline, bool shouldWarnDeprecated);
diff --git a/js/src/gc/Allocator.cpp b/js/src/gc/Allocator.cpp
index 3994d5a5b2..212493d86c 100644
--- a/js/src/gc/Allocator.cpp
+++ b/js/src/gc/Allocator.cpp
@@ -39,8 +39,12 @@ js::Allocate(ExclusiveContext* cx, AllocKind kind, size_t nDynamicSlots, Initial
MOZ_ASSERT_IF(nDynamicSlots != 0, clasp->isNative() || clasp->isProxy());
// Off-main-thread alloc cannot trigger GC or make runtime assertions.
- if (!cx->isJSContext())
- return GCRuntime::tryNewTenuredObject<NoGC>(cx, kind, thingSize, nDynamicSlots);
+ if (!cx->isJSContext()) {
+ JSObject* obj = GCRuntime::tryNewTenuredObject<NoGC>(cx, kind, thingSize, nDynamicSlots);
+ if (MOZ_UNLIKELY(allowGC && !obj))
+ ReportOutOfMemory(cx);
+ return obj;
+ }
JSContext* ncx = cx->asJSContext();
JSRuntime* rt = ncx->runtime();
diff --git a/js/src/gc/Barrier.cpp b/js/src/gc/Barrier.cpp
index f19f6f0466..6dab8d25b4 100644
--- a/js/src/gc/Barrier.cpp
+++ b/js/src/gc/Barrier.cpp
@@ -56,7 +56,7 @@ HeapSlot::preconditionForWriteBarrierPost(NativeObject* obj, Kind kind, uint32_t
bool isCorrectSlot = kind == Slot
? obj->getSlotAddressUnchecked(slot)->get() == target
: static_cast<HeapSlot*>(obj->getDenseElements() + slot)->get() == target;
- bool isBlackToGray = target.isMarkable() &&
+ bool isBlackToGray = target.isGCThing() &&
IsMarkedBlack(obj) && JS::GCThingIsMarkedGray(JS::GCCellPtr(target));
return isCorrectSlot && !isBlackToGray;
}
diff --git a/js/src/gc/Barrier.h b/js/src/gc/Barrier.h
index 950c96314c..effc9233ea 100644
--- a/js/src/gc/Barrier.h
+++ b/js/src/gc/Barrier.h
@@ -282,7 +282,7 @@ template <typename S> struct ReadBarrierFunctor : public VoidDefaultAdaptor<S> {
template <>
struct InternalBarrierMethods<Value>
{
- static bool isMarkable(const Value& v) { return v.isMarkable(); }
+ static bool isMarkable(const Value& v) { return v.isGCThing(); }
static bool isMarkableTaggedPointer(const Value& v) { return isMarkable(v); }
static void preBarrier(const Value& v) {
diff --git a/js/src/gc/Marking.cpp b/js/src/gc/Marking.cpp
index d9235f9acf..b2c105999a 100644
--- a/js/src/gc/Marking.cpp
+++ b/js/src/gc/Marking.cpp
@@ -328,7 +328,7 @@ ShouldMarkCrossCompartment(JSTracer* trc, JSObject* src, Cell* cell)
static bool
ShouldMarkCrossCompartment(JSTracer* trc, JSObject* src, const Value& val)
{
- return val.isMarkable() && ShouldMarkCrossCompartment(trc, src, (Cell*)val.toGCThing());
+ return val.isGCThing() && ShouldMarkCrossCompartment(trc, src, val.toGCThing());
}
static void
@@ -1599,7 +1599,7 @@ ObjectDenseElementsMayBeMarkable(NativeObject* nobj)
if (!mayBeMarkable) {
const Value* elements = nobj->getDenseElementsAllowCopyOnWrite();
for (unsigned i = 0; i < nobj->getDenseInitializedLength(); i++)
- MOZ_ASSERT(!elements[i].isMarkable());
+ MOZ_ASSERT(!elements[i].isGCThing());
}
#endif
diff --git a/js/src/gc/Marking.h b/js/src/gc/Marking.h
index ec4c69a2ff..73f63d804e 100644
--- a/js/src/gc/Marking.h
+++ b/js/src/gc/Marking.h
@@ -404,7 +404,7 @@ IsAboutToBeFinalizedDuringSweep(TenuredCell& tenured);
inline Cell*
ToMarkable(const Value& v)
{
- if (v.isMarkable())
+ if (v.isGCThing())
return (Cell*)v.toGCThing();
return nullptr;
}
diff --git a/js/src/jit-test/tests/auto-regress/for-of-iterator-close-debugger.js b/js/src/jit-test/tests/auto-regress/for-of-iterator-close-debugger.js
new file mode 100644
index 0000000000..a4d0bf654e
--- /dev/null
+++ b/js/src/jit-test/tests/auto-regress/for-of-iterator-close-debugger.js
@@ -0,0 +1,15 @@
+// |jit-test| error:ReferenceError
+
+// for-of should close iterator even if the exception is once caught by the
+// debugger.
+
+var g = newGlobal();
+g.parent = this;
+g.eval("new Debugger(parent).onExceptionUnwind = function () { };");
+// jsfunfuzz-generated
+for (var x of []) {};
+for (var l of [0]) {
+ for (var y = 0; y < 1; y++) {
+ g2;
+ }
+}
diff --git a/js/src/jit-test/tests/basic/constructor-name.js b/js/src/jit-test/tests/basic/constructor-name.js
index 4bc6a61ead..2dd4c073fc 100644
--- a/js/src/jit-test/tests/basic/constructor-name.js
+++ b/js/src/jit-test/tests/basic/constructor-name.js
@@ -17,7 +17,7 @@ function makeObject() {
let tests = [
{ name: "Ctor", object: new Ctor },
{ name: "nested.Ctor", object: new nested.Ctor },
- { name: "makeInstance/LexicalCtor", object: makeInstance() },
+ { name: "LexicalCtor", object: makeInstance() },
{ name: null, object: {} },
{ name: null, object: nested.object },
{ name: null, object: makeObject() },
diff --git a/js/src/jit-test/tests/basic/destructuring-default.js b/js/src/jit-test/tests/basic/destructuring-default.js
index 168977e806..49a908b8aa 100644
--- a/js/src/jit-test/tests/basic/destructuring-default.js
+++ b/js/src/jit-test/tests/basic/destructuring-default.js
@@ -84,10 +84,7 @@ function testArgumentFunction(pattern, input) {
'return [a, b, c, d, e, f];'
)(input);
}
-// XXX: ES6 requires the `Function` constructor to accept arbitrary
-// `BindingElement`s as formal parameters. See Bug 1037939.
-// Once fixed, please update the assertions below.
-assertThrowsInstanceOf(() => testAll(testArgumentFunction), SyntaxError);
+testAll(testArgumentFunction);
function testThrow(pattern, input) {
return new Function('input',
diff --git a/js/src/jit-test/tests/basic/destructuring-rest.js b/js/src/jit-test/tests/basic/destructuring-rest.js
index f53f07e037..fcb7b79bba 100644
--- a/js/src/jit-test/tests/basic/destructuring-rest.js
+++ b/js/src/jit-test/tests/basic/destructuring-rest.js
@@ -132,10 +132,9 @@ function testArgumentFunction(pattern, input, binding) {
'return ' + binding
)(input);
}
-// XXX: ES6 requires the `Function` constructor to accept arbitrary
-// `BindingElement`s as formal parameters. See Bug 1037939.
-// Once fixed, please update the assertions below.
-assertThrowsInstanceOf(() => testDeclaration(testArgumentFunction), SyntaxError);
+// ES6 requires the `Function` constructor to accept arbitrary
+// `BindingElement`s as formal parameters.
+testDeclaration(testArgumentFunction);
function testThrow(pattern, input, binding) {
binding = binding || 'rest';
diff --git a/js/src/jit-test/tests/basic/functionnames.js b/js/src/jit-test/tests/basic/functionnames.js
index 935292ee35..7fef872fce 100644
--- a/js/src/jit-test/tests/basic/functionnames.js
+++ b/js/src/jit-test/tests/basic/functionnames.js
@@ -40,7 +40,7 @@ assertName(Foo, 'Foo</<');
/* various properties and such */
var x = {fox: { bax: function(){} } };
-assertName(x.fox.bax, 'x.fox.bax');
+assertName(x.fox.bax, 'bax');
var foo = {foo: {foo: {}}};
foo.foo.foo = function(){};
assertName(foo.foo.foo, 'foo.foo.foo');
@@ -48,20 +48,20 @@ var z = {
foz: function() {
var baz = function() {
var y = {bay: function() {}};
- assertName(y.bay, 'z.foz/baz/y.bay');
+ assertName(y.bay, 'bay');
};
- assertName(baz, 'z.foz/baz');
+ assertName(baz, 'baz');
baz();
}
};
-assertName(z.foz, 'z.foz');
+assertName(z.foz, 'foz');
z.foz();
var outer = function() {
x.fox.bax.nx = function(){};
var w = {fow: { baw: function(){} } };
assertName(x.fox.bax.nx, 'outer/x.fox.bax.nx')
- assertName(w.fow.baw, 'outer/w.fow.baw');
+ assertName(w.fow.baw, 'baw');
};
assertName(outer, 'outer');
outer();
@@ -69,7 +69,7 @@ function Fuz(){};
Fuz.prototype = {
add: function() {}
}
-assertName(Fuz.prototype.add, 'Fuz.prototype.add');
+assertName(Fuz.prototype.add, 'add');
var x = 1;
x = function(){};
@@ -94,7 +94,7 @@ a.b = function() {
assertName(arguments.callee, 'a.b<');
return { a: function() {} }
}();
-assertName(a.b.a, 'a.b</<.a');
+assertName(a.b.a, 'a');
a = {
b: function(a) {
@@ -104,9 +104,9 @@ a = {
return function() {};
}
};
-assertName(a.b, 'a.b');
-assertName(a.b(true), 'a.b/<')
-assertName(a.b(false), 'a.b/<')
+assertName(a.b, 'b');
+assertName(a.b(true), 'b/<')
+assertName(a.b(false), 'b/<')
function f(g) {
assertName(g, 'x<');
@@ -116,7 +116,7 @@ var x = f(function () { return function() {}; });
assertName(x, 'x</<');
var a = {'b': function(){}};
-assertName(a.b, 'a.b');
+assertName(a.b, 'b');
function g(f) {
assertName(f, '');
@@ -138,15 +138,15 @@ a = {
"\"\'quotes\'\"": function(){},
"!@#$%": function(){}
};
-assertName(a["embedded spaces"], 'a["embedded spaces"]');
-assertName(a["dots.look.like.property.references"], 'a["dots.look.like.property.references"]');
-assertName(a["\"\'quotes\'\""], 'a["\\\"\'quotes\'\\\""]');
-assertName(a["!@#$%"], 'a["!@#$%"]');
+assertName(a["embedded spaces"], 'embedded spaces');
+assertName(a["dots.look.like.property.references"], 'dots.look.like.property.references');
+assertName(a["\"\'quotes\'\""], '"\'quotes\'"');
+assertName(a["!@#$%"], '!@#$%');
a.b = {};
a.b.c = {};
a.b["c"]["d e"] = { f: { 1: { "g": { "h i": function() {} } } } };
-assertName(a.b.c["d e"].f[1].g["h i"], 'a.b.c["d e"].f[1].g["h i"]');
+assertName(a.b.c["d e"].f[1].g["h i"], 'h i');
this.m = function () {};
assertName(m, "this.m");
diff --git a/js/src/jit-test/tests/basic/regexpLastIndexReset.js b/js/src/jit-test/tests/basic/regexpLastIndexReset.js
index 2a54d8ef5e..dbe3c3b763 100644
--- a/js/src/jit-test/tests/basic/regexpLastIndexReset.js
+++ b/js/src/jit-test/tests/basic/regexpLastIndexReset.js
@@ -7,7 +7,7 @@ function test() {
pattern.lastIndex = 3;
var result = pattern.exec(string);
assertEq(result, null);
- assertEq(pattern.lastIndex, 0);
+ assertEq(pattern.lastIndex, 3);
}
for (let i = 0; i < 10; i++) {
@@ -18,7 +18,7 @@ function test2() {
pattern.lastIndex = 3;
var result = pattern.test(string);
assertEq(result, false);
- assertEq(pattern.lastIndex, 0);
+ assertEq(pattern.lastIndex, 3);
}
for (let i = 0; i < 10; i++) {
diff --git a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-16.js b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-16.js
index b147d6ded0..5c73a1ad30 100644
--- a/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-16.js
+++ b/js/src/jit-test/tests/debug/Memory-drainAllocationsLog-16.js
@@ -24,7 +24,7 @@ root.eval(
this.tests = [
{ name: "Ctor", fn: () => new Ctor },
{ name: "nested.Ctor", fn: () => new nested.Ctor },
- { name: "makeInstance/LexicalCtor", fn: () => makeInstance() },
+ { name: "LexicalCtor", fn: () => makeInstance() },
{ name: null, fn: () => ({}) },
{ name: null, fn: () => (nested.object = {}) },
{ name: null, fn: () => makeObject() },
diff --git a/js/src/jit-test/tests/debug/Script-gc-02.js b/js/src/jit-test/tests/debug/Script-gc-02.js
index 33d33dfc1d..04dd4b220f 100644
--- a/js/src/jit-test/tests/debug/Script-gc-02.js
+++ b/js/src/jit-test/tests/debug/Script-gc-02.js
@@ -10,5 +10,5 @@ assertEq(arr.length, 10);
gc();
for (var i = 0; i < arr.length; i++)
- assertEq(arr[i].lineCount, 1);
+ assertEq(arr[i].lineCount, 3);
diff --git a/js/src/jit-test/tests/debug/Script-gc-03.js b/js/src/jit-test/tests/debug/Script-gc-03.js
index b2cb702323..30c3e8dbca 100644
--- a/js/src/jit-test/tests/debug/Script-gc-03.js
+++ b/js/src/jit-test/tests/debug/Script-gc-03.js
@@ -10,6 +10,6 @@ assertEq(arr.length, 100);
gc(g);
for (var i = 0; i < arr.length; i++)
- assertEq(arr[i].lineCount, 1);
+ assertEq(arr[i].lineCount, 3);
gc();
diff --git a/js/src/jit-test/tests/debug/Script-sourceStart-04.js b/js/src/jit-test/tests/debug/Script-sourceStart-04.js
index c12e669bf4..2aa382b7b4 100644
--- a/js/src/jit-test/tests/debug/Script-sourceStart-04.js
+++ b/js/src/jit-test/tests/debug/Script-sourceStart-04.js
@@ -20,6 +20,6 @@ function test(string, range) {
}
test("eval('2 * 3')", [0, 5]);
-test("new Function('2 * 3')", [0, 5]);
-test("new Function('x', 'x * x')", [0, 5]);
+test("new Function('2 * 3')", [0, 12]);
+test("new Function('x', 'x * x')", [0, 13]);
assertEq(count, 6);
diff --git a/js/src/jit-test/tests/for-of/bug-1331444.js b/js/src/jit-test/tests/for-of/bug-1331444.js
new file mode 100644
index 0000000000..9770c584bc
--- /dev/null
+++ b/js/src/jit-test/tests/for-of/bug-1331444.js
@@ -0,0 +1,7 @@
+// |jit-test| error: ReferenceError
+
+symbols = [Symbol];
+for (comparator of[, ])
+ for (a of symbols)
+ for (;;)
+ expect;
diff --git a/js/src/jit-test/tests/for-of/bug-1341339.js b/js/src/jit-test/tests/for-of/bug-1341339.js
new file mode 100644
index 0000000000..1f88acdafa
--- /dev/null
+++ b/js/src/jit-test/tests/for-of/bug-1341339.js
@@ -0,0 +1,9 @@
+let m = parseModule(`
+function* values() {}
+var iterator = values();
+for (var i=0; i < 10000; ++i) {
+ for (var x of iterator) {}
+}
+`);
+m.declarationInstantiation();
+m.evaluation();
diff --git a/js/src/jit-test/tests/gc/bug-1323868.js b/js/src/jit-test/tests/gc/bug-1323868.js
new file mode 100644
index 0000000000..c7e8c9b08b
--- /dev/null
+++ b/js/src/jit-test/tests/gc/bug-1323868.js
@@ -0,0 +1,5 @@
+if (helperThreadCount() == 0)
+ quit();
+startgc(8301);
+offThreadCompileScript("(({a,b,c}))");
+gcparam("maxBytes", gcparam("gcBytes"));
diff --git a/js/src/jit-test/tests/ion/bug1333946.js b/js/src/jit-test/tests/ion/bug1333946.js
new file mode 100644
index 0000000000..1fa1b9c491
--- /dev/null
+++ b/js/src/jit-test/tests/ion/bug1333946.js
@@ -0,0 +1,8 @@
+// |jit-test| error: 42;
+
+for (var x of [0]) {
+ for (var i = 0; ; i++) {
+ if (i === 20000)
+ throw 42;
+ }
+}
diff --git a/js/src/jit-test/tests/ion/bug1334314.js b/js/src/jit-test/tests/ion/bug1334314.js
new file mode 100644
index 0000000000..488fc90274
--- /dev/null
+++ b/js/src/jit-test/tests/ion/bug1334314.js
@@ -0,0 +1,16 @@
+// |jit-test| error: TypeError
+
+var g = newGlobal();
+g.parent = this;
+g.eval("new Debugger(parent).onExceptionUnwind = function () { };");
+
+function f() {
+ [[]] = [];
+}
+try {
+ f();
+} catch (e) {};
+try {
+ f();
+} catch (e) {};
+f();
diff --git a/js/src/jit-test/tests/parser/bug-1357075.js b/js/src/jit-test/tests/parser/bug-1357075.js
new file mode 100644
index 0000000000..47482e372b
--- /dev/null
+++ b/js/src/jit-test/tests/parser/bug-1357075.js
@@ -0,0 +1,10 @@
+// |jit-test| error: TypeError
+
+var iterable = {};
+var iterator = {
+ return: 1
+};
+iterable[Symbol.iterator] = function() {
+ return iterator;
+};
+for ([ class get {} ().iterator ] of [iterable]) {}
diff --git a/js/src/jit-test/tests/proxy/testWrapWithProtoIter.js b/js/src/jit-test/tests/proxy/testWrapWithProtoIter.js
new file mode 100644
index 0000000000..c6854b2067
--- /dev/null
+++ b/js/src/jit-test/tests/proxy/testWrapWithProtoIter.js
@@ -0,0 +1 @@
+[...wrapWithProto(new Int8Array(), new Int8Array())]
diff --git a/js/src/jit-test/tests/proxy/testWrapWithProtoTypedArray.js b/js/src/jit-test/tests/proxy/testWrapWithProtoTypedArray.js
new file mode 100644
index 0000000000..1b805d30a1
--- /dev/null
+++ b/js/src/jit-test/tests/proxy/testWrapWithProtoTypedArray.js
@@ -0,0 +1,19 @@
+let a = wrapWithProto(new Int8Array([1, 3, 5, 6, 9]), new Int8Array());
+
+assertEq([...a].toString(), "1,3,5,6,9");
+assertEq(a.every(e => e < 100), true);
+assertEq(a.filter(e => e % 2 == 1).toString(), "1,3,5,9");
+assertEq(a.find(e => e > 3), 5);
+assertEq(a.findIndex(e => e % 2 == 0), 3);
+assertEq(a.map(e => e * 10).toString(), "10,30,50,60,90");
+assertEq(a.reduce((a, b) => a + b, ""), "13569");
+assertEq(a.reduceRight((acc, e) => "(" + e + acc + ")", ""), "(1(3(5(6(9)))))");
+assertEq(a.some(e => e % 2 == 0), true);
+
+let s = "";
+assertEq(a.forEach(e => s += e), undefined);
+assertEq(s, "13569");
+
+a.sort((a, b) => b - a);
+assertEq(a.toString(), "9,6,5,3,1");
+
diff --git a/js/src/jit-test/tests/saved-stacks/function-display-name.js b/js/src/jit-test/tests/saved-stacks/function-display-name.js
index cfe175758c..f10b7de6bd 100644
--- a/js/src/jit-test/tests/saved-stacks/function-display-name.js
+++ b/js/src/jit-test/tests/saved-stacks/function-display-name.js
@@ -2,9 +2,8 @@
function uno() { return dos(); }
const dos = () => tres.quattro();
-const tres = {
- quattro: () => saveStack()
-};
+let tres = {};
+tres.quattro = () => saveStack()
const frame = uno();
diff --git a/js/src/jit-test/tests/self-test/assertDeepEq.js b/js/src/jit-test/tests/self-test/assertDeepEq.js
index b2a949abc6..9c1b37e8e3 100644
--- a/js/src/jit-test/tests/self-test/assertDeepEq.js
+++ b/js/src/jit-test/tests/self-test/assertDeepEq.js
@@ -77,7 +77,8 @@ assertDeepEq(q, p);
assertNotDeepEq(() => 1, () => 2);
assertNotDeepEq((...x) => 1, x => 1);
assertNotDeepEq(function f(){}, function g(){});
-var f1 = function () {}, f2 = function () {};
+// Avoid setting name property.
+var [f1, f2] = [function () {}, function () {}];
assertDeepEq(f1, f1);
assertDeepEq(f1, f2); // same text, close enough
f1.prop = 1;
diff --git a/js/src/jit/BaselineBailouts.cpp b/js/src/jit/BaselineBailouts.cpp
index 8fc8a522d4..3ab722b3d6 100644
--- a/js/src/jit/BaselineBailouts.cpp
+++ b/js/src/jit/BaselineBailouts.cpp
@@ -487,7 +487,7 @@ GetNextNonLoopEntryPc(jsbytecode* pc)
}
static bool
-HasLiveIteratorAtStackDepth(JSScript* script, jsbytecode* pc, uint32_t stackDepth)
+HasLiveStackValueAtDepth(JSScript* script, jsbytecode* pc, uint32_t stackDepth)
{
if (!script->hasTrynotes())
return false;
@@ -501,14 +501,31 @@ HasLiveIteratorAtStackDepth(JSScript* script, jsbytecode* pc, uint32_t stackDept
if (pcOffset >= tn->start + tn->length)
continue;
- // For-in loops have only the iterator on stack.
- if (tn->kind == JSTRY_FOR_IN && stackDepth == tn->stackDepth)
- return true;
+ switch (tn->kind) {
+ case JSTRY_FOR_IN:
+ // For-in loops have only the iterator on stack.
+ if (stackDepth == tn->stackDepth)
+ return true;
+ break;
+
+ case JSTRY_FOR_OF:
+ // For-of loops have the iterator, the result object, and the value
+ // of the result object on stack. The iterator is below the result
+ // object and the value.
+ if (stackDepth == tn->stackDepth - 2)
+ return true;
+ break;
+
+ case JSTRY_DESTRUCTURING_ITERCLOSE:
+ // Destructuring code that need to call IteratorClose have both
+ // the iterator and the "done" value on the stack.
+ if (stackDepth == tn->stackDepth || stackDepth == tn->stackDepth - 1)
+ return true;
+ break;
- // For-of loops have both the iterator and the result object on
- // stack. The iterator is below the result object.
- if (tn->kind == JSTRY_FOR_OF && stackDepth == tn->stackDepth - 1)
- return true;
+ default:
+ break;
+ }
}
return false;
@@ -945,7 +962,7 @@ InitFromBailout(JSContext* cx, HandleScript caller, jsbytecode* callerPC,
// iterators, however, so read them out. They will be closed by
// HandleExceptionBaseline.
MOZ_ASSERT(cx->compartment()->isDebuggee());
- if (iter.moreFrames() || HasLiveIteratorAtStackDepth(script, pc, i + 1)) {
+ if (iter.moreFrames() || HasLiveStackValueAtDepth(script, pc, i + 1)) {
v = iter.read();
} else {
iter.skip();
diff --git a/js/src/jit/BaselineCompiler.cpp b/js/src/jit/BaselineCompiler.cpp
index c58367aa39..3fa5a80ed6 100644
--- a/js/src/jit/BaselineCompiler.cpp
+++ b/js/src/jit/BaselineCompiler.cpp
@@ -9,6 +9,8 @@
#include "mozilla/Casting.h"
#include "mozilla/SizePrintfMacros.h"
+#include "jsfun.h"
+
#include "jit/BaselineIC.h"
#include "jit/BaselineJIT.h"
#include "jit/FixedList.h"
@@ -1061,6 +1063,12 @@ BaselineCompiler::emit_JSOP_NOP_DESTRUCTURING()
}
bool
+BaselineCompiler::emit_JSOP_TRY_DESTRUCTURING_ITERCLOSE()
+{
+ return true;
+}
+
+bool
BaselineCompiler::emit_JSOP_LABEL()
{
return true;
@@ -1145,7 +1153,7 @@ BaselineCompiler::emit_JSOP_PICK()
// after : A B D E C
// First, move value at -(amount + 1) into R0.
- int depth = -(GET_INT8(pc) + 1);
+ int32_t depth = -(GET_INT8(pc) + 1);
masm.loadValue(frame.addressOfStackValue(frame.peek(depth)), R0);
// Move the other values down.
@@ -1164,6 +1172,34 @@ BaselineCompiler::emit_JSOP_PICK()
}
bool
+BaselineCompiler::emit_JSOP_UNPICK()
+{
+ frame.syncStack(0);
+
+ // Pick takes the top of the stack value and moves it under the nth value.
+ // For instance, unpick 2:
+ // before: A B C D E
+ // after : A B E C D
+
+ // First, move value at -1 into R0.
+ masm.loadValue(frame.addressOfStackValue(frame.peek(-1)), R0);
+
+ // Move the other values up.
+ int32_t depth = -(GET_INT8(pc) + 1);
+ for (int32_t i = -1; i > depth; i--) {
+ Address source = frame.addressOfStackValue(frame.peek(i - 1));
+ Address dest = frame.addressOfStackValue(frame.peek(i));
+ masm.loadValue(source, R1);
+ masm.storeValue(R1, dest);
+ }
+
+ // Store R0 under the nth value.
+ Address dest = frame.addressOfStackValue(frame.peek(depth));
+ masm.storeValue(R0, dest);
+ return true;
+}
+
+bool
BaselineCompiler::emit_JSOP_GOTO()
{
frame.syncStack(0);
@@ -1351,6 +1387,26 @@ BaselineCompiler::emit_JSOP_CHECKISOBJ()
return true;
}
+typedef bool (*CheckIsCallableFn)(JSContext*, HandleValue, CheckIsCallableKind);
+static const VMFunction CheckIsCallableInfo =
+ FunctionInfo<CheckIsCallableFn>(CheckIsCallable, "CheckIsCallable");
+
+bool
+BaselineCompiler::emit_JSOP_CHECKISCALLABLE()
+{
+ frame.syncStack(0);
+ masm.loadValue(frame.addressOfStackValue(frame.peek(-1)), R0);
+
+ prepareVMCall();
+
+ pushArg(Imm32(GET_UINT8(pc)));
+ pushArg(R0);
+ if (!callVM(CheckIsCallableInfo))
+ return false;
+
+ return true;
+}
+
typedef bool (*ThrowUninitializedThisFn)(JSContext*, BaselineFrame* frame);
static const VMFunction ThrowUninitializedThisInfo =
FunctionInfo<ThrowUninitializedThisFn>(BaselineThrowUninitializedThis,
@@ -1681,6 +1737,29 @@ BaselineCompiler::emit_JSOP_LAMBDA_ARROW()
return true;
}
+typedef bool (*SetFunNameFn)(JSContext*, HandleFunction, HandleValue, FunctionPrefixKind);
+static const VMFunction SetFunNameInfo =
+ FunctionInfo<SetFunNameFn>(js::SetFunctionNameIfNoOwnName, "SetFunName");
+
+bool
+BaselineCompiler::emit_JSOP_SETFUNNAME()
+{
+ frame.popRegsAndSync(2);
+
+ frame.push(R0);
+ frame.syncStack(0);
+
+ FunctionPrefixKind prefixKind = FunctionPrefixKind(GET_UINT8(pc));
+ masm.unboxObject(R0, R0.scratchReg());
+
+ prepareVMCall();
+
+ pushArg(Imm32(int32_t(prefixKind)));
+ pushArg(R1);
+ pushArg(R0.scratchReg());
+ return callVM(SetFunNameInfo);
+}
+
void
BaselineCompiler::storeValue(const StackValue* source, const Address& dest,
const ValueOperand& scratch)
@@ -3922,7 +4001,7 @@ BaselineCompiler::emit_JSOP_MOREITER()
}
bool
-BaselineCompiler::emit_JSOP_ISNOITER()
+BaselineCompiler::emitIsMagicValue()
{
frame.syncStack(0);
@@ -3941,6 +4020,12 @@ BaselineCompiler::emit_JSOP_ISNOITER()
}
bool
+BaselineCompiler::emit_JSOP_ISNOITER()
+{
+ return emitIsMagicValue();
+}
+
+bool
BaselineCompiler::emit_JSOP_ENDITER()
{
if (!emit_JSOP_JUMPTARGET())
@@ -3952,6 +4037,12 @@ BaselineCompiler::emit_JSOP_ENDITER()
}
bool
+BaselineCompiler::emit_JSOP_ISGENCLOSING()
+{
+ return emitIsMagicValue();
+}
+
+bool
BaselineCompiler::emit_JSOP_GETRVAL()
{
frame.syncStack(0);
diff --git a/js/src/jit/BaselineCompiler.h b/js/src/jit/BaselineCompiler.h
index 9adf65c27b..6b5bf009ed 100644
--- a/js/src/jit/BaselineCompiler.h
+++ b/js/src/jit/BaselineCompiler.h
@@ -42,6 +42,7 @@ namespace jit {
_(JSOP_DUP2) \
_(JSOP_SWAP) \
_(JSOP_PICK) \
+ _(JSOP_UNPICK) \
_(JSOP_GOTO) \
_(JSOP_IFEQ) \
_(JSOP_IFNE) \
@@ -71,6 +72,7 @@ namespace jit {
_(JSOP_REGEXP) \
_(JSOP_LAMBDA) \
_(JSOP_LAMBDA_ARROW) \
+ _(JSOP_SETFUNNAME) \
_(JSOP_BITOR) \
_(JSOP_BITXOR) \
_(JSOP_BITAND) \
@@ -201,6 +203,7 @@ namespace jit {
_(JSOP_MOREITER) \
_(JSOP_ISNOITER) \
_(JSOP_ENDITER) \
+ _(JSOP_ISGENCLOSING) \
_(JSOP_GENERATOR) \
_(JSOP_INITIALYIELD) \
_(JSOP_YIELD) \
@@ -215,6 +218,7 @@ namespace jit {
_(JSOP_FUNCTIONTHIS) \
_(JSOP_GLOBALTHIS) \
_(JSOP_CHECKISOBJ) \
+ _(JSOP_CHECKISCALLABLE) \
_(JSOP_CHECKTHIS) \
_(JSOP_CHECKRETURN) \
_(JSOP_NEWTARGET) \
@@ -222,7 +226,7 @@ namespace jit {
_(JSOP_SPREADSUPERCALL) \
_(JSOP_THROWSETCONST) \
_(JSOP_THROWSETALIASEDCONST) \
- _(JSOP_THROWSETCALLEE) \
+ _(JSOP_THROWSETCALLEE) \
_(JSOP_INITHIDDENPROP_GETTER) \
_(JSOP_INITHIDDENPROP_SETTER) \
_(JSOP_INITHIDDENELEM) \
@@ -230,8 +234,9 @@ namespace jit {
_(JSOP_INITHIDDENELEM_SETTER) \
_(JSOP_CHECKOBJCOERCIBLE) \
_(JSOP_DEBUGCHECKSELFHOSTED) \
- _(JSOP_JUMPTARGET) \
- _(JSOP_IS_CONSTRUCTING)
+ _(JSOP_JUMPTARGET) \
+ _(JSOP_IS_CONSTRUCTING) \
+ _(JSOP_TRY_DESTRUCTURING_ITERCLOSE)
class BaselineCompiler : public BaselineCompilerSpecific
{
@@ -340,6 +345,8 @@ class BaselineCompiler : public BaselineCompilerSpecific
MOZ_MUST_USE bool emitThrowConstAssignment();
MOZ_MUST_USE bool emitUninitializedLexicalCheck(const ValueOperand& val);
+ MOZ_MUST_USE bool emitIsMagicValue();
+
MOZ_MUST_USE bool addPCMappingEntry(bool addIndexEntry);
MOZ_MUST_USE bool addYieldOffset();
diff --git a/js/src/jit/BaselineFrameInfo.h b/js/src/jit/BaselineFrameInfo.h
index 13bf0358d9..1691270acf 100644
--- a/js/src/jit/BaselineFrameInfo.h
+++ b/js/src/jit/BaselineFrameInfo.h
@@ -67,7 +67,7 @@ class StackValue
union {
struct {
- Value v;
+ JS::UninitializedValue v;
} constant;
struct {
mozilla::AlignedStorage2<ValueOperand> reg;
@@ -112,7 +112,7 @@ class StackValue
}
Value constant() const {
MOZ_ASSERT(kind_ == Constant);
- return data.constant.v;
+ return data.constant.v.asValueRef();
}
ValueOperand reg() const {
MOZ_ASSERT(kind_ == Register);
diff --git a/js/src/jit/CodeGenerator.cpp b/js/src/jit/CodeGenerator.cpp
index ce97363be8..7b2f8214ba 100644
--- a/js/src/jit/CodeGenerator.cpp
+++ b/js/src/jit/CodeGenerator.cpp
@@ -2548,6 +2548,20 @@ CodeGenerator::emitLambdaInit(Register output, Register envChain,
masm.storePtr(ImmGCPtr(info.fun->displayAtom()), Address(output, JSFunction::offsetOfAtom()));
}
+typedef bool (*SetFunNameFn)(JSContext*, HandleFunction, HandleValue, FunctionPrefixKind);
+static const VMFunction SetFunNameInfo =
+ FunctionInfo<SetFunNameFn>(js::SetFunctionNameIfNoOwnName, "SetFunName");
+
+void
+CodeGenerator::visitSetFunName(LSetFunName* lir)
+{
+ pushArg(Imm32(lir->mir()->prefixKind()));
+ pushArg(ToValue(lir, LSetFunName::NameValue));
+ pushArg(ToRegister(lir->fun()));
+
+ callVM(SetFunNameInfo, lir);
+}
+
void
CodeGenerator::visitOsiPoint(LOsiPoint* lir)
{
@@ -8512,8 +8526,8 @@ StoreUnboxedPointer(MacroAssembler& masm, T address, MIRType type, const LAlloca
masm.patchableCallPreBarrier(address, type);
if (value->isConstant()) {
Value v = value->toConstant()->toJSValue();
- if (v.isMarkable()) {
- masm.storePtr(ImmGCPtr(v.toMarkablePointer()), address);
+ if (v.isGCThing()) {
+ masm.storePtr(ImmGCPtr(v.toGCThing()), address);
} else {
MOZ_ASSERT(v.isNull());
masm.storePtr(ImmWord(0), address);
@@ -11312,25 +11326,35 @@ class OutOfLineIsCallable : public OutOfLineCodeBase<CodeGenerator>
}
};
+template <CodeGenerator::CallableOrConstructor mode>
void
-CodeGenerator::visitIsCallable(LIsCallable* ins)
+CodeGenerator::emitIsCallableOrConstructor(Register object, Register output, Label* failure)
{
- Register object = ToRegister(ins->object());
- Register output = ToRegister(ins->output());
-
- OutOfLineIsCallable* ool = new(alloc()) OutOfLineIsCallable(ins);
- addOutOfLineCode(ool, ins->mir());
-
Label notFunction, hasCOps, done;
masm.loadObjClass(object, output);
- // Just skim proxies off. Their notion of isCallable() is more complicated.
- masm.branchTestClassIsProxy(true, output, ool->entry());
+ // Just skim proxies off. Their notion of isCallable()/isConstructor() is
+ // more complicated.
+ masm.branchTestClassIsProxy(true, output, failure);
// An object is callable iff:
// is<JSFunction>() || (getClass()->cOps && getClass()->cOps->call).
+ // An object is constructor iff:
+ // ((is<JSFunction>() && as<JSFunction>().isConstructor) ||
+ // (getClass()->cOps && getClass()->cOps->construct)).
masm.branchPtr(Assembler::NotEqual, output, ImmPtr(&JSFunction::class_), &notFunction);
- masm.move32(Imm32(1), output);
+ if (mode == Callable) {
+ masm.move32(Imm32(1), output);
+ } else {
+ Label notConstructor;
+ masm.load16ZeroExtend(Address(object, JSFunction::offsetOfFlags()), output);
+ masm.and32(Imm32(JSFunction::CONSTRUCTOR), output);
+ masm.branchTest32(Assembler::Zero, output, output, &notConstructor);
+ masm.move32(Imm32(1), output);
+ masm.jump(&done);
+ masm.bind(&notConstructor);
+ masm.move32(Imm32(0), output);
+ }
masm.jump(&done);
masm.bind(&notFunction);
@@ -11341,10 +11365,26 @@ CodeGenerator::visitIsCallable(LIsCallable* ins)
masm.bind(&hasCOps);
masm.loadPtr(Address(output, offsetof(js::Class, cOps)), output);
- masm.cmpPtrSet(Assembler::NonZero, Address(output, offsetof(js::ClassOps, call)),
+ size_t opsOffset = mode == Callable
+ ? offsetof(js::ClassOps, call)
+ : offsetof(js::ClassOps, construct);
+ masm.cmpPtrSet(Assembler::NonZero, Address(output, opsOffset),
ImmPtr(nullptr), output);
masm.bind(&done);
+}
+
+void
+CodeGenerator::visitIsCallable(LIsCallable* ins)
+{
+ Register object = ToRegister(ins->object());
+ Register output = ToRegister(ins->output());
+
+ OutOfLineIsCallable* ool = new(alloc()) OutOfLineIsCallable(ins);
+ addOutOfLineCode(ool, ins->mir());
+
+ emitIsCallableOrConstructor<Callable>(object, output, ool->entry());
+
masm.bind(ool->rejoin());
}
@@ -11364,6 +11404,36 @@ CodeGenerator::visitOutOfLineIsCallable(OutOfLineIsCallable* ool)
masm.jump(ool->rejoin());
}
+typedef bool (*CheckIsCallableFn)(JSContext*, HandleValue, CheckIsCallableKind);
+static const VMFunction CheckIsCallableInfo =
+ FunctionInfo<CheckIsCallableFn>(CheckIsCallable, "CheckIsCallable");
+
+void
+CodeGenerator::visitCheckIsCallable(LCheckIsCallable* ins)
+{
+ ValueOperand checkValue = ToValue(ins, LCheckIsCallable::CheckValue);
+ Register temp = ToRegister(ins->temp());
+
+ // OOL code is used in the following 2 cases:
+ // * checkValue is not callable
+ // * checkValue is proxy and it's unknown whether it's callable or not
+ // CheckIsCallable checks if passed value is callable, regardless of the
+ // cases above. IsCallable operation is not observable and checking it
+ // again doesn't matter.
+ OutOfLineCode* ool = oolCallVM(CheckIsCallableInfo, ins,
+ ArgList(checkValue, Imm32(ins->mir()->checkKind())),
+ StoreNothing());
+
+ masm.branchTestObject(Assembler::NotEqual, checkValue, ool->entry());
+
+ Register object = masm.extractObject(checkValue, temp);
+ emitIsCallableOrConstructor<Callable>(object, temp, ool->entry());
+
+ masm.branchTest32(Assembler::Zero, temp, temp, ool->entry());
+
+ masm.bind(ool->rejoin());
+}
+
class OutOfLineIsConstructor : public OutOfLineCodeBase<CodeGenerator>
{
LIsConstructor* ins_;
@@ -11390,37 +11460,8 @@ CodeGenerator::visitIsConstructor(LIsConstructor* ins)
OutOfLineIsConstructor* ool = new(alloc()) OutOfLineIsConstructor(ins);
addOutOfLineCode(ool, ins->mir());
- Label notFunction, notConstructor, hasCOps, done;
- masm.loadObjClass(object, output);
-
- // Just skim proxies off. Their notion of isConstructor() is more complicated.
- masm.branchTestClassIsProxy(true, output, ool->entry());
-
- // An object is constructor iff
- // ((is<JSFunction>() && as<JSFunction>().isConstructor) ||
- // (getClass()->cOps && getClass()->cOps->construct)).
- masm.branchPtr(Assembler::NotEqual, output, ImmPtr(&JSFunction::class_), &notFunction);
- masm.load16ZeroExtend(Address(object, JSFunction::offsetOfFlags()), output);
- masm.and32(Imm32(JSFunction::CONSTRUCTOR), output);
- masm.branchTest32(Assembler::Zero, output, output, &notConstructor);
- masm.move32(Imm32(1), output);
- masm.jump(&done);
- masm.bind(&notConstructor);
- masm.move32(Imm32(0), output);
- masm.jump(&done);
-
- masm.bind(&notFunction);
- masm.branchPtr(Assembler::NonZero, Address(output, offsetof(js::Class, cOps)),
- ImmPtr(nullptr), &hasCOps);
- masm.move32(Imm32(0), output);
- masm.jump(&done);
-
- masm.bind(&hasCOps);
- masm.loadPtr(Address(output, offsetof(js::Class, cOps)), output);
- masm.cmpPtrSet(Assembler::NonZero, Address(output, offsetof(js::ClassOps, construct)),
- ImmPtr(nullptr), output);
+ emitIsCallableOrConstructor<Constructor>(object, output, ool->entry());
- masm.bind(&done);
masm.bind(ool->rejoin());
}
diff --git a/js/src/jit/CodeGenerator.h b/js/src/jit/CodeGenerator.h
index 8f4bcc813e..d3126651bc 100644
--- a/js/src/jit/CodeGenerator.h
+++ b/js/src/jit/CodeGenerator.h
@@ -134,6 +134,7 @@ class CodeGenerator final : public CodeGeneratorSpecific
void visitOutOfLineLambdaArrow(OutOfLineLambdaArrow* ool);
void visitLambdaArrow(LLambdaArrow* lir);
void visitLambdaForSingleton(LLambdaForSingleton* lir);
+ void visitSetFunName(LSetFunName* lir);
void visitPointer(LPointer* lir);
void visitKeepAliveObject(LKeepAliveObject* lir);
void visitSlots(LSlots* lir);
@@ -363,6 +364,12 @@ class CodeGenerator final : public CodeGeneratorSpecific
void visitCallDOMNative(LCallDOMNative* lir);
void visitCallGetIntrinsicValue(LCallGetIntrinsicValue* lir);
void visitCallBindVar(LCallBindVar* lir);
+ enum CallableOrConstructor {
+ Callable,
+ Constructor
+ };
+ template <CallableOrConstructor mode>
+ void emitIsCallableOrConstructor(Register object, Register output, Label* failure);
void visitIsCallable(LIsCallable* lir);
void visitOutOfLineIsCallable(OutOfLineIsCallable* ool);
void visitIsConstructor(LIsConstructor* lir);
@@ -383,6 +390,7 @@ class CodeGenerator final : public CodeGeneratorSpecific
void visitArrowNewTarget(LArrowNewTarget* ins);
void visitCheckReturn(LCheckReturn* ins);
void visitCheckIsObj(LCheckIsObj* ins);
+ void visitCheckIsCallable(LCheckIsCallable* ins);
void visitCheckObjCoercible(LCheckObjCoercible* ins);
void visitDebugCheckSelfHosted(LDebugCheckSelfHosted* ins);
void visitNaNToZero(LNaNToZero* ins);
diff --git a/js/src/jit/IonAnalysis.cpp b/js/src/jit/IonAnalysis.cpp
index 90303255df..2c9ffb607d 100644
--- a/js/src/jit/IonAnalysis.cpp
+++ b/js/src/jit/IonAnalysis.cpp
@@ -2188,6 +2188,12 @@ IsRegExpHoistable(MIRGenerator* mir, MDefinition* regexp, MDefinitionVector& wor
bool
jit::MakeMRegExpHoistable(MIRGenerator* mir, MIRGraph& graph)
{
+ // If we are compiling try blocks, regular expressions may be observable
+ // from catch blocks (which Ion does not compile). For now just disable the
+ // pass in this case.
+ if (graph.hasTryBlock())
+ return true;
+
MDefinitionVector worklist(graph.alloc());
for (ReversePostorderIterator block(graph.rpoBegin()); block != graph.rpoEnd(); block++) {
diff --git a/js/src/jit/IonBuilder.cpp b/js/src/jit/IonBuilder.cpp
index 1488d7d348..54d05cac4e 100644
--- a/js/src/jit/IonBuilder.cpp
+++ b/js/src/jit/IonBuilder.cpp
@@ -958,30 +958,35 @@ IonBuilder::build()
bool
IonBuilder::processIterators()
{
- // Find phis that must directly hold an iterator live.
- Vector<MPhi*, 0, SystemAllocPolicy> worklist;
+ // Find and mark phis that must transitively hold an iterator live.
+
+ Vector<MDefinition*, 8, SystemAllocPolicy> worklist;
+
for (size_t i = 0; i < iterators_.length(); i++) {
- MInstruction* ins = iterators_[i];
- for (MUseDefIterator iter(ins); iter; iter++) {
- if (iter.def()->isPhi()) {
- if (!worklist.append(iter.def()->toPhi()))
- return false;
- }
+ MDefinition* iter = iterators_[i];
+ if (!iter->isInWorklist()) {
+ if (!worklist.append(iter))
+ return false;
+ iter->setInWorklist();
}
}
- // Propagate the iterator and live status of phis to all other connected
- // phis.
while (!worklist.empty()) {
- MPhi* phi = worklist.popCopy();
- phi->setIterator();
- phi->setImplicitlyUsedUnchecked();
-
- for (MUseDefIterator iter(phi); iter; iter++) {
- if (iter.def()->isPhi()) {
- MPhi* other = iter.def()->toPhi();
- if (!other->isIterator() && !worklist.append(other))
+ MDefinition* def = worklist.popCopy();
+ def->setNotInWorklist();
+
+ if (def->isPhi()) {
+ MPhi* phi = def->toPhi();
+ phi->setIterator();
+ phi->setImplicitlyUsedUnchecked();
+ }
+
+ for (MUseDefIterator iter(def); iter; iter++) {
+ MDefinition* use = iter.def();
+ if (!use->isInWorklist() && (!use->isPhi() || !use->toPhi()->isIterator())) {
+ if (!worklist.append(use))
return false;
+ use->setInWorklist();
}
}
}
@@ -1563,6 +1568,7 @@ IonBuilder::traverseBytecode()
case JSOP_DUP:
case JSOP_DUP2:
case JSOP_PICK:
+ case JSOP_UNPICK:
case JSOP_SWAP:
case JSOP_SETARG:
case JSOP_SETLOCAL:
@@ -1672,6 +1678,7 @@ IonBuilder::inspectOpcode(JSOp op)
switch (op) {
case JSOP_NOP:
case JSOP_NOP_DESTRUCTURING:
+ case JSOP_TRY_DESTRUCTURING_ITERCLOSE:
case JSOP_LINENO:
case JSOP_LOOPENTRY:
case JSOP_JUMPTARGET:
@@ -1935,6 +1942,10 @@ IonBuilder::inspectOpcode(JSOp op)
case JSOP_CALLITER:
case JSOP_NEW:
case JSOP_SUPERCALL:
+ if (op == JSOP_CALLITER) {
+ if (!outermostBuilder()->iterators_.append(current->peek(-1)))
+ return false;
+ }
return jsop_call(GET_ARGC(pc), (JSOp)*pc == JSOP_NEW || (JSOp)*pc == JSOP_SUPERCALL);
case JSOP_EVAL:
@@ -2017,6 +2028,10 @@ IonBuilder::inspectOpcode(JSOp op)
current->pick(-GET_INT8(pc));
return true;
+ case JSOP_UNPICK:
+ current->unpick(-GET_INT8(pc));
+ return true;
+
case JSOP_GETALIASEDVAR:
return jsop_getaliasedvar(EnvironmentCoordinate(pc));
@@ -2122,6 +2137,9 @@ IonBuilder::inspectOpcode(JSOp op)
case JSOP_LAMBDA_ARROW:
return jsop_lambda_arrow(info().getFunction(pc));
+ case JSOP_SETFUNNAME:
+ return jsop_setfunname(GET_UINT8(pc));
+
case JSOP_ITER:
return jsop_iter(GET_INT8(pc));
@@ -2166,6 +2184,9 @@ IonBuilder::inspectOpcode(JSOp op)
case JSOP_CHECKISOBJ:
return jsop_checkisobj(GET_UINT8(pc));
+ case JSOP_CHECKISCALLABLE:
+ return jsop_checkiscallable(GET_UINT8(pc));
+
case JSOP_CHECKOBJCOERCIBLE:
return jsop_checkobjcoercible();
@@ -10883,6 +10904,15 @@ IonBuilder::jsop_checkisobj(uint8_t kind)
}
bool
+IonBuilder::jsop_checkiscallable(uint8_t kind)
+{
+ MCheckIsCallable* check = MCheckIsCallable::New(alloc(), current->pop(), kind);
+ current->add(check);
+ current->push(check);
+ return true;
+}
+
+bool
IonBuilder::jsop_checkobjcoercible()
{
MDefinition* toCheck = current->peek(-1);
@@ -13340,6 +13370,21 @@ IonBuilder::jsop_lambda_arrow(JSFunction* fun)
}
bool
+IonBuilder::jsop_setfunname(uint8_t prefixKind)
+{
+ MDefinition* name = current->pop();
+ MDefinition* fun = current->pop();
+ MOZ_ASSERT(fun->type() == MIRType::Object);
+
+ MSetFunName* ins = MSetFunName::New(alloc(), fun, name, prefixKind);
+
+ current->add(ins);
+ current->push(fun);
+
+ return resumeAfter(ins);
+}
+
+bool
IonBuilder::jsop_setarg(uint32_t arg)
{
// To handle this case, we should spill the arguments to the space where
diff --git a/js/src/jit/IonBuilder.h b/js/src/jit/IonBuilder.h
index 38647a88f2..35ad120f7d 100644
--- a/js/src/jit/IonBuilder.h
+++ b/js/src/jit/IonBuilder.h
@@ -766,6 +766,7 @@ class IonBuilder
MOZ_MUST_USE bool jsop_object(JSObject* obj);
MOZ_MUST_USE bool jsop_lambda(JSFunction* fun);
MOZ_MUST_USE bool jsop_lambda_arrow(JSFunction* fun);
+ MOZ_MUST_USE bool jsop_setfunname(uint8_t prefixKind);
MOZ_MUST_USE bool jsop_functionthis();
MOZ_MUST_USE bool jsop_globalthis();
MOZ_MUST_USE bool jsop_typeof();
@@ -782,6 +783,7 @@ class IonBuilder
MOZ_MUST_USE bool jsop_debugger();
MOZ_MUST_USE bool jsop_newtarget();
MOZ_MUST_USE bool jsop_checkisobj(uint8_t kind);
+ MOZ_MUST_USE bool jsop_checkiscallable(uint8_t kind);
MOZ_MUST_USE bool jsop_checkobjcoercible();
MOZ_MUST_USE bool jsop_pushcallobj();
@@ -1241,7 +1243,7 @@ class IonBuilder
Vector<ControlFlowInfo, 4, JitAllocPolicy> loops_;
Vector<ControlFlowInfo, 0, JitAllocPolicy> switches_;
Vector<ControlFlowInfo, 2, JitAllocPolicy> labels_;
- Vector<MInstruction*, 2, JitAllocPolicy> iterators_;
+ Vector<MDefinition*, 2, JitAllocPolicy> iterators_;
Vector<LoopHeader, 0, JitAllocPolicy> loopHeaders_;
BaselineInspector* inspector;
diff --git a/js/src/jit/JitFrames.cpp b/js/src/jit/JitFrames.cpp
index 646442b4c0..f11f17225c 100644
--- a/js/src/jit/JitFrames.cpp
+++ b/js/src/jit/JitFrames.cpp
@@ -328,23 +328,46 @@ NumArgAndLocalSlots(const InlineFrameIterator& frame)
}
static void
-CloseLiveIteratorIon(JSContext* cx, const InlineFrameIterator& frame, uint32_t stackSlot)
+CloseLiveIteratorIon(JSContext* cx, const InlineFrameIterator& frame, JSTryNote* tn)
{
+ MOZ_ASSERT(tn->kind == JSTRY_FOR_IN ||
+ tn->kind == JSTRY_DESTRUCTURING_ITERCLOSE);
+
+ bool isDestructuring = tn->kind == JSTRY_DESTRUCTURING_ITERCLOSE;
+ MOZ_ASSERT_IF(!isDestructuring, tn->stackDepth > 0);
+ MOZ_ASSERT_IF(isDestructuring, tn->stackDepth > 1);
+
SnapshotIterator si = frame.snapshotIterator();
- // Skip stack slots until we reach the iterator object.
- uint32_t skipSlots = NumArgAndLocalSlots(frame) + stackSlot - 1;
+ // Skip stack slots until we reach the iterator object on the stack. For
+ // the destructuring case, we also need to get the "done" value.
+ uint32_t stackSlot = tn->stackDepth;
+ uint32_t adjust = isDestructuring ? 2 : 1;
+ uint32_t skipSlots = NumArgAndLocalSlots(frame) + stackSlot - adjust;
for (unsigned i = 0; i < skipSlots; i++)
si.skip();
Value v = si.read();
- RootedObject obj(cx, &v.toObject());
+ RootedObject iterObject(cx, &v.toObject());
+
+ if (isDestructuring) {
+ RootedValue doneValue(cx, si.read());
+ bool done = ToBoolean(doneValue);
+ // Do not call IteratorClose if the destructuring iterator is already
+ // done.
+ if (done)
+ return;
+ }
- if (cx->isExceptionPending())
- UnwindIteratorForException(cx, obj);
- else
- UnwindIteratorForUncatchableException(cx, obj);
+ if (cx->isExceptionPending()) {
+ if (tn->kind == JSTRY_FOR_IN)
+ UnwindIteratorForException(cx, iterObject);
+ else
+ IteratorCloseForException(cx, iterObject);
+ } else {
+ UnwindIteratorForUncatchableException(cx, iterObject);
+ }
}
class IonFrameStackDepthOp
@@ -413,25 +436,36 @@ HandleExceptionIon(JSContext* cx, const InlineFrameIterator& frame, ResumeFromEx
if (!script->hasTrynotes())
return;
+ bool inForOfIterClose = false;
+
for (TryNoteIterIon tni(cx, frame); !tni.done(); ++tni) {
JSTryNote* tn = *tni;
switch (tn->kind) {
- case JSTRY_FOR_IN: {
- MOZ_ASSERT(JSOp(*(script->main() + tn->start + tn->length)) == JSOP_ENDITER);
- MOZ_ASSERT(tn->stackDepth > 0);
+ case JSTRY_FOR_IN:
+ case JSTRY_DESTRUCTURING_ITERCLOSE:
+ MOZ_ASSERT_IF(tn->kind == JSTRY_FOR_IN,
+ JSOp(*(script->main() + tn->start + tn->length)) == JSOP_ENDITER);
+ CloseLiveIteratorIon(cx, frame, tn);
+ break;
- uint32_t localSlot = tn->stackDepth;
- CloseLiveIteratorIon(cx, frame, localSlot);
+ case JSTRY_FOR_OF_ITERCLOSE:
+ inForOfIterClose = true;
break;
- }
case JSTRY_FOR_OF:
+ inForOfIterClose = false;
+ break;
+
case JSTRY_LOOP:
break;
case JSTRY_CATCH:
if (cx->isExceptionPending()) {
+ // See corresponding comment in ProcessTryNotes.
+ if (inForOfIterClose)
+ break;
+
// Ion can compile try-catch, but bailing out to catch
// exceptions is slow. Reset the warm-up counter so that if we
// catch many exceptions we won't Ion-compile the script.
@@ -562,6 +596,7 @@ ProcessTryNotesBaseline(JSContext* cx, const JitFrameIterator& frame, Environmen
ResumeFromException* rfe, jsbytecode** pc)
{
RootedScript script(cx, frame.baselineFrame()->script());
+ bool inForOfIterClose = false;
for (TryNoteIterBaseline tni(cx, frame.baselineFrame(), *pc); !tni.done(); ++tni) {
JSTryNote* tn = *tni;
@@ -572,7 +607,11 @@ ProcessTryNotesBaseline(JSContext* cx, const JitFrameIterator& frame, Environmen
// If we're closing a legacy generator, we have to skip catch
// blocks.
if (cx->isClosingGenerator())
- continue;
+ break;
+
+ // See corresponding comment in ProcessTryNotes.
+ if (inForOfIterClose)
+ break;
SettleOnTryNote(cx, tn, frame, ei, rfe, pc);
@@ -588,6 +627,10 @@ ProcessTryNotesBaseline(JSContext* cx, const JitFrameIterator& frame, Environmen
}
case JSTRY_FINALLY: {
+ // See corresponding comment in ProcessTryNotes.
+ if (inForOfIterClose)
+ break;
+
SettleOnTryNote(cx, tn, frame, ei, rfe, pc);
rfe->kind = ResumeFromException::RESUME_FINALLY;
rfe->target = script->baselineScript()->nativeCodeForPC(script, *pc);
@@ -602,7 +645,7 @@ ProcessTryNotesBaseline(JSContext* cx, const JitFrameIterator& frame, Environmen
uint8_t* framePointer;
uint8_t* stackPointer;
BaselineFrameAndStackPointersFromTryNote(tn, frame, &framePointer, &stackPointer);
- Value iterValue(*(Value*) stackPointer);
+ Value iterValue(*reinterpret_cast<Value*>(stackPointer));
RootedObject iterObject(cx, &iterValue.toObject());
if (!UnwindIteratorForException(cx, iterObject)) {
// See comment in the JSTRY_FOR_IN case in Interpreter.cpp's
@@ -614,7 +657,31 @@ ProcessTryNotesBaseline(JSContext* cx, const JitFrameIterator& frame, Environmen
break;
}
+ case JSTRY_DESTRUCTURING_ITERCLOSE: {
+ uint8_t* framePointer;
+ uint8_t* stackPointer;
+ BaselineFrameAndStackPointersFromTryNote(tn, frame, &framePointer, &stackPointer);
+ RootedValue doneValue(cx, *(reinterpret_cast<Value*>(stackPointer)));
+ bool done = ToBoolean(doneValue);
+ if (!done) {
+ Value iterValue(*(reinterpret_cast<Value*>(stackPointer) + 1));
+ RootedObject iterObject(cx, &iterValue.toObject());
+ if (!IteratorCloseForException(cx, iterObject)) {
+ SettleOnTryNote(cx, tn, frame, ei, rfe, pc);
+ return false;
+ }
+ }
+ break;
+ }
+
+ case JSTRY_FOR_OF_ITERCLOSE:
+ inForOfIterClose = true;
+ break;
+
case JSTRY_FOR_OF:
+ inForOfIterClose = false;
+ break;
+
case JSTRY_LOOP:
break;
@@ -1995,7 +2062,7 @@ SnapshotIterator::traceAllocation(JSTracer* trc)
return;
Value v = allocationValue(alloc, RM_AlwaysDefault);
- if (!v.isMarkable())
+ if (!v.isGCThing())
return;
Value copy = v;
diff --git a/js/src/jit/Lowering.cpp b/js/src/jit/Lowering.cpp
index 13e50820e0..730697163f 100644
--- a/js/src/jit/Lowering.cpp
+++ b/js/src/jit/Lowering.cpp
@@ -2460,6 +2460,18 @@ LIRGenerator::visitLambdaArrow(MLambdaArrow* ins)
}
void
+LIRGenerator::visitSetFunName(MSetFunName* ins)
+{
+ MOZ_ASSERT(ins->fun()->type() == MIRType::Object);
+ MOZ_ASSERT(ins->name()->type() == MIRType::Value);
+
+ LSetFunName* lir = new(alloc()) LSetFunName(useRegisterAtStart(ins->fun()),
+ useBoxAtStart(ins->name()));
+ add(lir, ins);
+ assignSafepoint(lir, ins);
+}
+
+void
LIRGenerator::visitKeepAliveObject(MKeepAliveObject* ins)
{
MDefinition* obj = ins->object();
@@ -2675,7 +2687,7 @@ IsNonNurseryConstant(MDefinition* def)
if (!def->isConstant())
return false;
Value v = def->toConstant()->toJSValue();
- return !v.isMarkable() || !IsInsideNursery(v.toMarkablePointer());
+ return !v.isGCThing() || !IsInsideNursery(v.toGCThing());
}
void
@@ -4677,6 +4689,19 @@ LIRGenerator::visitCheckIsObj(MCheckIsObj* ins)
}
void
+LIRGenerator::visitCheckIsCallable(MCheckIsCallable* ins)
+{
+ MDefinition* checkVal = ins->checkValue();
+ MOZ_ASSERT(checkVal->type() == MIRType::Value);
+
+ LCheckIsCallable* lir = new(alloc()) LCheckIsCallable(useBox(checkVal),
+ temp());
+ redefine(ins, checkVal);
+ add(lir, ins);
+ assignSafepoint(lir, ins);
+}
+
+void
LIRGenerator::visitCheckObjCoercible(MCheckObjCoercible* ins)
{
MDefinition* checkVal = ins->checkValue();
diff --git a/js/src/jit/Lowering.h b/js/src/jit/Lowering.h
index 0f66a3c240..b2805cb7a6 100644
--- a/js/src/jit/Lowering.h
+++ b/js/src/jit/Lowering.h
@@ -185,6 +185,7 @@ class LIRGenerator : public LIRGeneratorSpecific
void visitNullarySharedStub(MNullarySharedStub* ins);
void visitLambda(MLambda* ins);
void visitLambdaArrow(MLambdaArrow* ins);
+ void visitSetFunName(MSetFunName* ins);
void visitKeepAliveObject(MKeepAliveObject* ins);
void visitSlots(MSlots* ins);
void visitElements(MElements* ins);
@@ -328,6 +329,7 @@ class LIRGenerator : public LIRGeneratorSpecific
void visitGuardSharedTypedArray(MGuardSharedTypedArray* ins);
void visitCheckReturn(MCheckReturn* ins);
void visitCheckIsObj(MCheckIsObj* ins);
+ void visitCheckIsCallable(MCheckIsCallable* ins);
void visitCheckObjCoercible(MCheckObjCoercible* ins);
void visitDebugCheckSelfHosted(MDebugCheckSelfHosted* ins);
};
diff --git a/js/src/jit/MIR.h b/js/src/jit/MIR.h
index dcb08c3171..2de91e2df4 100644
--- a/js/src/jit/MIR.h
+++ b/js/src/jit/MIR.h
@@ -8464,6 +8464,34 @@ class MLambdaArrow
}
};
+class MSetFunName
+ : public MAryInstruction<2>,
+ public MixPolicy<ObjectPolicy<0>, BoxPolicy<1> >::Data
+{
+ uint8_t prefixKind_;
+
+ explicit MSetFunName(MDefinition* fun, MDefinition* name, uint8_t prefixKind)
+ : prefixKind_(prefixKind)
+ {
+ initOperand(0, fun);
+ initOperand(1, name);
+ setResultType(MIRType::None);
+ }
+
+ public:
+ INSTRUCTION_HEADER(SetFunName)
+ TRIVIAL_NEW_WRAPPERS
+ NAMED_OPERANDS((0, fun), (1, name))
+
+ uint8_t prefixKind() const {
+ return prefixKind_;
+ }
+
+ bool possiblyCalls() const override {
+ return true;
+ }
+};
+
// Returns obj->slots.
class MSlots
: public MUnaryInstruction,
@@ -13427,8 +13455,9 @@ class MCheckIsObj
{
uint8_t checkKind_;
- explicit MCheckIsObj(MDefinition* toCheck, uint8_t checkKind)
- : MUnaryInstruction(toCheck), checkKind_(checkKind)
+ MCheckIsObj(MDefinition* toCheck, uint8_t checkKind)
+ : MUnaryInstruction(toCheck),
+ checkKind_(checkKind)
{
setResultType(MIRType::Value);
setResultTypeSet(toCheck->resultTypeSet());
@@ -13447,6 +13476,33 @@ class MCheckIsObj
}
};
+class MCheckIsCallable
+ : public MUnaryInstruction,
+ public BoxInputsPolicy::Data
+{
+ uint8_t checkKind_;
+
+ MCheckIsCallable(MDefinition* toCheck, uint8_t checkKind)
+ : MUnaryInstruction(toCheck),
+ checkKind_(checkKind)
+ {
+ setResultType(MIRType::Value);
+ setResultTypeSet(toCheck->resultTypeSet());
+ setGuard();
+ }
+
+ public:
+ INSTRUCTION_HEADER(CheckIsCallable)
+ TRIVIAL_NEW_WRAPPERS
+ NAMED_OPERANDS((0, checkValue))
+
+ uint8_t checkKind() const { return checkKind_; }
+
+ AliasSet getAliasSet() const override {
+ return AliasSet::None();
+ }
+};
+
class MCheckObjCoercible
: public MUnaryInstruction,
public BoxInputsPolicy::Data
diff --git a/js/src/jit/MIRGraph.cpp b/js/src/jit/MIRGraph.cpp
index 3a363a5bfa..d6e0fa8ffc 100644
--- a/js/src/jit/MIRGraph.cpp
+++ b/js/src/jit/MIRGraph.cpp
@@ -790,6 +790,19 @@ MBasicBlock::pick(int32_t depth)
}
void
+MBasicBlock::unpick(int32_t depth)
+{
+ // unpick take the top of the stack element and move it under the depth-th
+ // element;
+ // unpick(-2):
+ // A B C D E
+ // A B C E D [ swapAt(-1) ]
+ // A B E C D [ swapAt(-2) ]
+ for (int32_t n = -1; n >= depth; n--)
+ swapAt(n);
+}
+
+void
MBasicBlock::swapAt(int32_t depth)
{
uint32_t lhsDepth = stackPosition_ + depth - 1;
diff --git a/js/src/jit/MIRGraph.h b/js/src/jit/MIRGraph.h
index b986218f42..705d70fa1f 100644
--- a/js/src/jit/MIRGraph.h
+++ b/js/src/jit/MIRGraph.h
@@ -142,6 +142,9 @@ class MBasicBlock : public TempObject, public InlineListNode<MBasicBlock>
// Move the definition to the top of the stack.
void pick(int32_t depth);
+ // Move the top of the stack definition under the depth-th stack value.
+ void unpick(int32_t depth);
+
// Exchange 2 stack slots at the defined depth
void swapAt(int32_t depth);
diff --git a/js/src/jit/MOpcodes.h b/js/src/jit/MOpcodes.h
index 74594cb359..bb2ab8190d 100644
--- a/js/src/jit/MOpcodes.h
+++ b/js/src/jit/MOpcodes.h
@@ -161,6 +161,7 @@ namespace jit {
_(StringReplace) \
_(Lambda) \
_(LambdaArrow) \
+ _(SetFunName) \
_(KeepAliveObject) \
_(Slots) \
_(Elements) \
@@ -284,6 +285,7 @@ namespace jit {
_(ArrowNewTarget) \
_(CheckReturn) \
_(CheckIsObj) \
+ _(CheckIsCallable) \
_(CheckObjCoercible) \
_(DebugCheckSelfHosted) \
_(AsmJSNeg) \
diff --git a/js/src/jit/MacroAssembler.cpp b/js/src/jit/MacroAssembler.cpp
index f633b9b7b9..9dbbe76242 100644
--- a/js/src/jit/MacroAssembler.cpp
+++ b/js/src/jit/MacroAssembler.cpp
@@ -2214,6 +2214,12 @@ MacroAssembler::finish()
}
MacroAssemblerSpecific::finish();
+
+ MOZ_RELEASE_ASSERT(size() <= MaxCodeBytesPerProcess,
+ "AssemblerBuffer should ensure we don't exceed MaxCodeBytesPerProcess");
+
+ if (bytesNeeded() > MaxCodeBytesPerProcess)
+ setOOM();
}
void
diff --git a/js/src/jit/ProcessExecutableMemory.cpp b/js/src/jit/ProcessExecutableMemory.cpp
index 71c2ab0dce..301541541e 100644
--- a/js/src/jit/ProcessExecutableMemory.cpp
+++ b/js/src/jit/ProcessExecutableMemory.cpp
@@ -385,14 +385,6 @@ class PageBitSet
#endif
};
-// Limit on the number of bytes of executable memory to prevent JIT spraying
-// attacks.
-#if JS_BITS_PER_WORD == 32
-static const size_t MaxCodeBytesPerProcess = 128 * 1024 * 1024;
-#else
-static const size_t MaxCodeBytesPerProcess = 1 * 1024 * 1024 * 1024;
-#endif
-
// Per-process executable memory allocator. It reserves a block of memory of
// MaxCodeBytesPerProcess bytes, then allocates/deallocates pages from that.
//
diff --git a/js/src/jit/ProcessExecutableMemory.h b/js/src/jit/ProcessExecutableMemory.h
index 078ce7cb75..a0e2fab985 100644
--- a/js/src/jit/ProcessExecutableMemory.h
+++ b/js/src/jit/ProcessExecutableMemory.h
@@ -17,6 +17,14 @@ namespace jit {
// alignment though.
static const size_t ExecutableCodePageSize = 64 * 1024;
+// Limit on the number of bytes of executable memory to prevent JIT spraying
+// attacks.
+#if JS_BITS_PER_WORD == 32
+static const size_t MaxCodeBytesPerProcess = 128 * 1024 * 1024;
+#else
+static const size_t MaxCodeBytesPerProcess = 1 * 1024 * 1024 * 1024;
+#endif
+
enum class ProtectionSetting {
Protected, // Not readable, writable, or executable.
Writable,
diff --git a/js/src/jit/RegisterSets.h b/js/src/jit/RegisterSets.h
index 0a4045dd74..08ae53f167 100644
--- a/js/src/jit/RegisterSets.h
+++ b/js/src/jit/RegisterSets.h
@@ -226,13 +226,13 @@ class ConstantOrRegister
// Space to hold either a Value or a TypedOrValueRegister.
union U {
- Value constant;
+ JS::UninitializedValue constant;
TypedOrValueRegister reg;
} data;
- const Value& dataValue() const {
+ Value dataValue() const {
MOZ_ASSERT(constant());
- return data.constant;
+ return data.constant.asValueRef();
}
void setDataValue(const Value& value) {
MOZ_ASSERT(constant());
@@ -268,7 +268,7 @@ class ConstantOrRegister
return constant_;
}
- const Value& value() const {
+ Value value() const {
return dataValue();
}
diff --git a/js/src/jit/RematerializedFrame.cpp b/js/src/jit/RematerializedFrame.cpp
index cb324220cd..32fad1267d 100644
--- a/js/src/jit/RematerializedFrame.cpp
+++ b/js/src/jit/RematerializedFrame.cpp
@@ -61,9 +61,17 @@ RematerializedFrame::New(JSContext* cx, uint8_t* top, InlineFrameIterator& iter,
{
unsigned numFormals = iter.isFunctionFrame() ? iter.calleeTemplate()->nargs() : 0;
unsigned argSlots = Max(numFormals, iter.numActualArgs());
- size_t numBytes = sizeof(RematerializedFrame) +
- (argSlots + iter.script()->nfixed()) * sizeof(Value) -
- sizeof(Value); // 1 Value included in sizeof(RematerializedFrame)
+ unsigned extraSlots = argSlots + iter.script()->nfixed();
+
+ // One Value slot is included in sizeof(RematerializedFrame), so we can
+ // reduce the extra slot count by one. However, if there are zero slot
+ // allocations total, then reducing the slots by one will lead to
+ // the memory allocation being smaller than sizeof(RematerializedFrame).
+ if (extraSlots > 0)
+ extraSlots -= 1;
+
+ size_t numBytes = sizeof(RematerializedFrame) + (extraSlots * sizeof(Value));
+ MOZ_ASSERT(numBytes >= sizeof(RematerializedFrame));
void* buf = cx->pod_calloc<uint8_t>(numBytes);
if (!buf)
diff --git a/js/src/jit/VMFunctions.cpp b/js/src/jit/VMFunctions.cpp
index 4edbc3c836..77b9e36470 100644
--- a/js/src/jit/VMFunctions.cpp
+++ b/js/src/jit/VMFunctions.cpp
@@ -1349,5 +1349,14 @@ BaselineGetFunctionThis(JSContext* cx, BaselineFrame* frame, MutableHandleValue
return GetFunctionThis(cx, frame, res);
}
+bool
+CheckIsCallable(JSContext* cx, HandleValue v, CheckIsCallableKind kind)
+{
+ if (!IsCallable(v))
+ return ThrowCheckIsCallable(cx, kind);
+
+ return true;
+}
+
} // namespace jit
} // namespace js
diff --git a/js/src/jit/VMFunctions.h b/js/src/jit/VMFunctions.h
index f754d58c71..572f053732 100644
--- a/js/src/jit/VMFunctions.h
+++ b/js/src/jit/VMFunctions.h
@@ -13,6 +13,7 @@
#include "jit/CompileInfo.h"
#include "jit/JitFrames.h"
+#include "vm/Interpreter.h"
namespace js {
@@ -802,6 +803,9 @@ ThrowObjectCoercible(JSContext* cx, HandleValue v);
MOZ_MUST_USE bool
BaselineGetFunctionThis(JSContext* cx, BaselineFrame* frame, MutableHandleValue res);
+MOZ_MUST_USE bool
+CheckIsCallable(JSContext* cx, HandleValue v, CheckIsCallableKind kind);
+
} // namespace jit
} // namespace js
diff --git a/js/src/jit/arm/MacroAssembler-arm.cpp b/js/src/jit/arm/MacroAssembler-arm.cpp
index c6e627db68..d405785144 100644
--- a/js/src/jit/arm/MacroAssembler-arm.cpp
+++ b/js/src/jit/arm/MacroAssembler-arm.cpp
@@ -3286,8 +3286,8 @@ void
MacroAssemblerARMCompat::moveValue(const Value& val, Register type, Register data)
{
ma_mov(Imm32(val.toNunboxTag()), type);
- if (val.isMarkable())
- ma_mov(ImmGCPtr(val.toMarkablePointer()), data);
+ if (val.isGCThing())
+ ma_mov(ImmGCPtr(val.toGCThing()), data);
else
ma_mov(Imm32(val.toNunboxPayload()), data);
}
@@ -3484,8 +3484,8 @@ MacroAssemblerARMCompat::storePayload(const Value& val, const BaseIndex& dest)
ScratchRegisterScope scratch(asMasm());
SecondScratchRegisterScope scratch2(asMasm());
- if (val.isMarkable())
- ma_mov(ImmGCPtr(val.toMarkablePointer()), scratch);
+ if (val.isGCThing())
+ ma_mov(ImmGCPtr(val.toGCThing()), scratch);
else
ma_mov(Imm32(val.toNunboxPayload()), scratch);
@@ -5314,8 +5314,8 @@ MacroAssembler::branchTestValue(Condition cond, const ValueOperand& lhs,
// equal, short circuit false (NotEqual).
ScratchRegisterScope scratch(*this);
- if (rhs.isMarkable())
- ma_cmp(lhs.payloadReg(), ImmGCPtr(rhs.toMarkablePointer()), scratch);
+ if (rhs.isGCThing())
+ ma_cmp(lhs.payloadReg(), ImmGCPtr(rhs.toGCThing()), scratch);
else
ma_cmp(lhs.payloadReg(), Imm32(rhs.toNunboxPayload()), scratch);
ma_cmp(lhs.typeReg(), Imm32(rhs.toNunboxTag()), scratch, Equal);
diff --git a/js/src/jit/arm/MacroAssembler-arm.h b/js/src/jit/arm/MacroAssembler-arm.h
index c011af3c3b..c20a6c3e55 100644
--- a/js/src/jit/arm/MacroAssembler-arm.h
+++ b/js/src/jit/arm/MacroAssembler-arm.h
@@ -915,8 +915,8 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
ma_mov(Imm32(val.toNunboxTag()), scratch);
ma_str(scratch, ToType(dest), scratch2);
- if (val.isMarkable())
- ma_mov(ImmGCPtr(val.toMarkablePointer()), scratch);
+ if (val.isGCThing())
+ ma_mov(ImmGCPtr(val.toGCThing()), scratch);
else
ma_mov(Imm32(val.toNunboxPayload()), scratch);
ma_str(scratch, ToPayload(dest), scratch2);
@@ -944,15 +944,15 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
// Store the payload, marking if necessary.
if (payloadoffset < 4096 && payloadoffset > -4096) {
- if (val.isMarkable())
- ma_mov(ImmGCPtr(val.toMarkablePointer()), scratch2);
+ if (val.isGCThing())
+ ma_mov(ImmGCPtr(val.toGCThing()), scratch2);
else
ma_mov(Imm32(val.toNunboxPayload()), scratch2);
ma_str(scratch2, DTRAddr(scratch, DtrOffImm(payloadoffset)));
} else {
ma_add(Imm32(payloadoffset), scratch, scratch2);
- if (val.isMarkable())
- ma_mov(ImmGCPtr(val.toMarkablePointer()), scratch2);
+ if (val.isGCThing())
+ ma_mov(ImmGCPtr(val.toGCThing()), scratch2);
else
ma_mov(Imm32(val.toNunboxPayload()), scratch2);
ma_str(scratch2, DTRAddr(scratch, DtrOffImm(0)));
@@ -977,8 +977,8 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
void popValue(ValueOperand val);
void pushValue(const Value& val) {
push(Imm32(val.toNunboxTag()));
- if (val.isMarkable())
- push(ImmGCPtr(val.toMarkablePointer()));
+ if (val.isGCThing())
+ push(ImmGCPtr(val.toGCThing()));
else
push(Imm32(val.toNunboxPayload()));
}
diff --git a/js/src/jit/arm64/MacroAssembler-arm64.h b/js/src/jit/arm64/MacroAssembler-arm64.h
index b958314435..c21e2fd662 100644
--- a/js/src/jit/arm64/MacroAssembler-arm64.h
+++ b/js/src/jit/arm64/MacroAssembler-arm64.h
@@ -306,7 +306,7 @@ class MacroAssemblerCompat : public vixl::MacroAssembler
void pushValue(const Value& val) {
vixl::UseScratchRegisterScope temps(this);
const Register scratch = temps.AcquireX().asUnsized();
- if (val.isMarkable()) {
+ if (val.isGCThing()) {
BufferOffset load = movePatchablePtr(ImmPtr(val.bitsAsPunboxPointer()), scratch);
writeDataRelocation(val, load);
push(scratch);
@@ -349,7 +349,7 @@ class MacroAssemblerCompat : public vixl::MacroAssembler
}
}
void moveValue(const Value& val, Register dest) {
- if (val.isMarkable()) {
+ if (val.isGCThing()) {
BufferOffset load = movePatchablePtr(ImmPtr(val.bitsAsPunboxPointer()), dest);
writeDataRelocation(val, load);
} else {
@@ -1835,8 +1835,8 @@ class MacroAssemblerCompat : public vixl::MacroAssembler
dataRelocations_.writeUnsigned(load.getOffset());
}
void writeDataRelocation(const Value& val, BufferOffset load) {
- if (val.isMarkable()) {
- gc::Cell* cell = val.toMarkablePointer();
+ if (val.isGCThing()) {
+ gc::Cell* cell = val.toGCThing();
if (cell && gc::IsInsideNursery(cell))
embedsNurseryPointers_ = true;
dataRelocations_.writeUnsigned(load.getOffset());
diff --git a/js/src/jit/mips32/MacroAssembler-mips32.cpp b/js/src/jit/mips32/MacroAssembler-mips32.cpp
index 0d3e55e215..2b2fab92d3 100644
--- a/js/src/jit/mips32/MacroAssembler-mips32.cpp
+++ b/js/src/jit/mips32/MacroAssembler-mips32.cpp
@@ -1527,8 +1527,8 @@ MacroAssemblerMIPSCompat::getType(const Value& val)
void
MacroAssemblerMIPSCompat::moveData(const Value& val, Register data)
{
- if (val.isMarkable())
- ma_li(data, ImmGCPtr(val.toMarkablePointer()));
+ if (val.isGCThing())
+ ma_li(data, ImmGCPtr(val.toGCThing()));
else
ma_li(data, Imm32(val.toNunboxPayload()));
}
diff --git a/js/src/jit/mips32/MacroAssembler-mips32.h b/js/src/jit/mips32/MacroAssembler-mips32.h
index 4c7618d08d..adb626bb0f 100644
--- a/js/src/jit/mips32/MacroAssembler-mips32.h
+++ b/js/src/jit/mips32/MacroAssembler-mips32.h
@@ -480,8 +480,8 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS
void popValue(ValueOperand val);
void pushValue(const Value& val) {
push(Imm32(val.toNunboxTag()));
- if (val.isMarkable())
- push(ImmGCPtr(val.toMarkablePointer()));
+ if (val.isGCThing())
+ push(ImmGCPtr(val.toGCThing()));
else
push(Imm32(val.toNunboxPayload()));
}
diff --git a/js/src/jit/mips64/MacroAssembler-mips64.cpp b/js/src/jit/mips64/MacroAssembler-mips64.cpp
index 329fa83f81..f58184bca1 100644
--- a/js/src/jit/mips64/MacroAssembler-mips64.cpp
+++ b/js/src/jit/mips64/MacroAssembler-mips64.cpp
@@ -1885,7 +1885,7 @@ MacroAssemblerMIPS64Compat::storeValue(JSValueType type, Register reg, Address d
void
MacroAssemblerMIPS64Compat::storeValue(const Value& val, Address dest)
{
- if (val.isMarkable()) {
+ if (val.isGCThing()) {
writeDataRelocation(val);
movWithPatch(ImmWord(val.asRawBits()), SecondScratchReg);
} else {
diff --git a/js/src/jit/mips64/MacroAssembler-mips64.h b/js/src/jit/mips64/MacroAssembler-mips64.h
index 4cff872368..bfe4529741 100644
--- a/js/src/jit/mips64/MacroAssembler-mips64.h
+++ b/js/src/jit/mips64/MacroAssembler-mips64.h
@@ -221,8 +221,8 @@ class MacroAssemblerMIPS64Compat : public MacroAssemblerMIPS64
}
void writeDataRelocation(const Value& val) {
- if (val.isMarkable()) {
- gc::Cell* cell = val.toMarkablePointer();
+ if (val.isGCThing()) {
+ gc::Cell* cell = val.toGCThing();
if (cell && gc::IsInsideNursery(cell))
embedsNurseryPointers_ = true;
dataRelocations_.writeUnsigned(currentOffset());
@@ -498,7 +498,7 @@ class MacroAssemblerMIPS64Compat : public MacroAssemblerMIPS64
void pushValue(ValueOperand val);
void popValue(ValueOperand val);
void pushValue(const Value& val) {
- if (val.isMarkable()) {
+ if (val.isGCThing()) {
writeDataRelocation(val);
movWithPatch(ImmWord(val.asRawBits()), ScratchRegister);
push(ScratchRegister);
diff --git a/js/src/jit/shared/IonAssemblerBuffer.h b/js/src/jit/shared/IonAssemblerBuffer.h
index cc20e26d21..3a65526968 100644
--- a/js/src/jit/shared/IonAssemblerBuffer.h
+++ b/js/src/jit/shared/IonAssemblerBuffer.h
@@ -181,6 +181,10 @@ class AssemblerBuffer
protected:
virtual Slice* newSlice(LifoAlloc& a) {
+ if (size() > MaxCodeBytesPerProcess - sizeof(Slice)) {
+ fail_oom();
+ return nullptr;
+ }
Slice* tmp = static_cast<Slice*>(a.alloc(sizeof(Slice)));
if (!tmp) {
fail_oom();
diff --git a/js/src/jit/shared/LIR-shared.h b/js/src/jit/shared/LIR-shared.h
index a352f5d8ab..9dcb527c5d 100644
--- a/js/src/jit/shared/LIR-shared.h
+++ b/js/src/jit/shared/LIR-shared.h
@@ -4995,6 +4995,25 @@ class LLambdaArrow : public LInstructionHelper<1, 1 + BOX_PIECES, 0>
}
};
+class LSetFunName : public LCallInstructionHelper<1, 1 + BOX_PIECES, 0>
+{
+ public:
+ LIR_HEADER(SetFunName)
+
+ static const size_t NameValue = 1;
+
+ LSetFunName(const LAllocation& fun, const LBoxAllocation& name) {
+ setOperand(0, fun);
+ setBoxOperand(NameValue, name);
+ }
+ const LAllocation* fun() {
+ return getOperand(0);
+ }
+ const MSetFunName* mir() const {
+ return mir_->toSetFunName();
+ }
+};
+
class LKeepAliveObject : public LInstructionHelper<0, 1, 0>
{
public:
@@ -8874,6 +8893,27 @@ class LCheckIsObj : public LInstructionHelper<BOX_PIECES, BOX_PIECES, 0>
}
};
+class LCheckIsCallable : public LInstructionHelper<BOX_PIECES, BOX_PIECES, 1>
+{
+ public:
+ LIR_HEADER(CheckIsCallable)
+
+ static const size_t CheckValue = 0;
+
+ LCheckIsCallable(const LBoxAllocation& value, const LDefinition& temp) {
+ setBoxOperand(CheckValue, value);
+ setTemp(0, temp);
+ }
+
+ const LDefinition* temp() {
+ return getTemp(0);
+ }
+
+ MCheckIsCallable* mir() const {
+ return mir_->toCheckIsCallable();
+ }
+};
+
class LCheckObjCoercible : public LCallInstructionHelper<BOX_PIECES, BOX_PIECES, 0>
{
public:
diff --git a/js/src/jit/shared/LOpcodes-shared.h b/js/src/jit/shared/LOpcodes-shared.h
index bb04553a6b..3eea1b449b 100644
--- a/js/src/jit/shared/LOpcodes-shared.h
+++ b/js/src/jit/shared/LOpcodes-shared.h
@@ -242,6 +242,7 @@
_(Lambda) \
_(LambdaArrow) \
_(LambdaForSingleton) \
+ _(SetFunName) \
_(KeepAliveObject) \
_(Slots) \
_(Elements) \
@@ -401,6 +402,7 @@
_(ArrowNewTarget) \
_(CheckReturn) \
_(CheckIsObj) \
+ _(CheckIsCallable) \
_(CheckObjCoercible) \
_(DebugCheckSelfHosted) \
_(AsmJSLoadHeap) \
diff --git a/js/src/jit/x64/MacroAssembler-x64.h b/js/src/jit/x64/MacroAssembler-x64.h
index cb81bd7c1a..be450767b2 100644
--- a/js/src/jit/x64/MacroAssembler-x64.h
+++ b/js/src/jit/x64/MacroAssembler-x64.h
@@ -58,8 +58,8 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
// X64 helpers.
/////////////////////////////////////////////////////////////////
void writeDataRelocation(const Value& val) {
- if (val.isMarkable()) {
- gc::Cell* cell = val.toMarkablePointer();
+ if (val.isGCThing()) {
+ gc::Cell* cell = val.toGCThing();
if (cell && gc::IsInsideNursery(cell))
embedsNurseryPointers_ = true;
dataRelocations_.writeUnsigned(masm.currentOffset());
@@ -132,7 +132,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
template <typename T>
void storeValue(const Value& val, const T& dest) {
ScratchRegisterScope scratch(asMasm());
- if (val.isMarkable()) {
+ if (val.isGCThing()) {
movWithPatch(ImmWord(val.asRawBits()), scratch);
writeDataRelocation(val);
} else {
@@ -171,7 +171,7 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
pop(val.valueReg());
}
void pushValue(const Value& val) {
- if (val.isMarkable()) {
+ if (val.isGCThing()) {
ScratchRegisterScope scratch(asMasm());
movWithPatch(ImmWord(val.asRawBits()), scratch);
writeDataRelocation(val);
diff --git a/js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h b/js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h
index 8cb5577848..fe678fc7db 100644
--- a/js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h
+++ b/js/src/jit/x86-shared/AssemblerBuffer-x86-shared.h
@@ -68,6 +68,33 @@ namespace js {
namespace jit {
+ // AllocPolicy for AssemblerBuffer. OOMs when trying to allocate more than
+ // MaxCodeBytesPerProcess bytes. Use private inheritance to make sure we
+ // explicitly have to expose SystemAllocPolicy methods.
+ class AssemblerBufferAllocPolicy : private SystemAllocPolicy
+ {
+ public:
+ using SystemAllocPolicy::checkSimulatedOOM;
+ using SystemAllocPolicy::reportAllocOverflow;
+ using SystemAllocPolicy::free_;
+
+ template <typename T> T* pod_realloc(T* p, size_t oldSize, size_t newSize) {
+ static_assert(sizeof(T) == 1,
+ "AssemblerBufferAllocPolicy should only be used with byte vectors");
+ MOZ_ASSERT(oldSize <= MaxCodeBytesPerProcess);
+ if (MOZ_UNLIKELY(newSize > MaxCodeBytesPerProcess))
+ return nullptr;
+ return SystemAllocPolicy::pod_realloc<T>(p, oldSize, newSize);
+ }
+ template <typename T> T* pod_malloc(size_t numElems) {
+ static_assert(sizeof(T) == 1,
+ "AssemblerBufferAllocPolicy should only be used with byte vectors");
+ if (MOZ_UNLIKELY(numElems > MaxCodeBytesPerProcess))
+ return nullptr;
+ return SystemAllocPolicy::pod_malloc<T>(numElems);
+ }
+ };
+
class AssemblerBuffer
{
template<size_t size, typename T>
@@ -93,6 +120,9 @@ namespace jit {
void ensureSpace(size_t space)
{
+ // This should only be called with small |space| values to ensure
+ // we don't overflow below.
+ MOZ_ASSERT(space <= 16);
if (MOZ_UNLIKELY(!m_buffer.reserve(m_buffer.length() + space)))
oomDetected();
}
@@ -168,7 +198,7 @@ namespace jit {
m_buffer.clear();
}
- PageProtectingVector<unsigned char, 256, SystemAllocPolicy> m_buffer;
+ PageProtectingVector<unsigned char, 256, AssemblerBufferAllocPolicy> m_buffer;
bool m_oom;
};
diff --git a/js/src/jit/x86/MacroAssembler-x86.cpp b/js/src/jit/x86/MacroAssembler-x86.cpp
index 754b29c2d1..dc97b5b5bd 100644
--- a/js/src/jit/x86/MacroAssembler-x86.cpp
+++ b/js/src/jit/x86/MacroAssembler-x86.cpp
@@ -499,8 +499,8 @@ MacroAssembler::branchTestValue(Condition cond, const ValueOperand& lhs,
const Value& rhs, Label* label)
{
MOZ_ASSERT(cond == Equal || cond == NotEqual);
- if (rhs.isMarkable())
- cmpPtr(lhs.payloadReg(), ImmGCPtr(rhs.toMarkablePointer()));
+ if (rhs.isGCThing())
+ cmpPtr(lhs.payloadReg(), ImmGCPtr(rhs.toGCThing()));
else
cmpPtr(lhs.payloadReg(), ImmWord(rhs.toNunboxPayload()));
diff --git a/js/src/jit/x86/MacroAssembler-x86.h b/js/src/jit/x86/MacroAssembler-x86.h
index 21cd63a0cc..2b2507c777 100644
--- a/js/src/jit/x86/MacroAssembler-x86.h
+++ b/js/src/jit/x86/MacroAssembler-x86.h
@@ -94,8 +94,8 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
}
void moveValue(const Value& val, Register type, Register data) {
movl(Imm32(val.toNunboxTag()), type);
- if (val.isMarkable())
- movl(ImmGCPtr(val.toMarkablePointer()), data);
+ if (val.isGCThing())
+ movl(ImmGCPtr(val.toGCThing()), data);
else
movl(Imm32(val.toNunboxPayload()), data);
}
@@ -213,8 +213,8 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
}
void pushValue(const Value& val) {
push(Imm32(val.toNunboxTag()));
- if (val.isMarkable())
- push(ImmGCPtr(val.toMarkablePointer()));
+ if (val.isGCThing())
+ push(ImmGCPtr(val.toGCThing()));
else
push(Imm32(val.toNunboxPayload()));
}
@@ -235,8 +235,8 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
pop(dest.high);
}
void storePayload(const Value& val, Operand dest) {
- if (val.isMarkable())
- movl(ImmGCPtr(val.toMarkablePointer()), ToPayload(dest));
+ if (val.isGCThing())
+ movl(ImmGCPtr(val.toGCThing()), ToPayload(dest));
else
movl(Imm32(val.toNunboxPayload()), ToPayload(dest));
}
diff --git a/js/src/js.msg b/js/src/js.msg
index cb5fc383bd..a276dab944 100644
--- a/js/src/js.msg
+++ b/js/src/js.msg
@@ -96,7 +96,7 @@ MSG_DEF(JSMSG_NOT_ITERABLE, 1, JSEXN_TYPEERR, "{0} is not iterable")
MSG_DEF(JSMSG_NOT_ITERATOR, 1, JSEXN_TYPEERR, "{0} is not iterator")
MSG_DEF(JSMSG_ALREADY_HAS_PRAGMA, 2, JSEXN_WARN, "{0} is being assigned a {1}, but already has one")
MSG_DEF(JSMSG_GET_ITER_RETURNED_PRIMITIVE, 0, JSEXN_TYPEERR, "[Symbol.iterator]() returned a non-object value")
-MSG_DEF(JSMSG_NEXT_RETURNED_PRIMITIVE, 0, JSEXN_TYPEERR, "iterator.next() returned a non-object value")
+MSG_DEF(JSMSG_ITER_METHOD_RETURNED_PRIMITIVE, 1, JSEXN_TYPEERR, "iterator.{0}() returned a non-object value")
MSG_DEF(JSMSG_CANT_SET_PROTO, 0, JSEXN_TYPEERR, "can't set prototype of this object")
MSG_DEF(JSMSG_CANT_SET_PROTO_OF, 1, JSEXN_TYPEERR, "can't set prototype of {0}")
MSG_DEF(JSMSG_CANT_SET_PROTO_CYCLE, 0, JSEXN_TYPEERR, "can't set prototype: it would cause a prototype chain cycle")
@@ -329,6 +329,7 @@ MSG_DEF(JSMSG_TOO_MANY_LOCALS, 0, JSEXN_SYNTAXERR, "too many local varia
MSG_DEF(JSMSG_TOO_MANY_YIELDS, 0, JSEXN_SYNTAXERR, "too many yield expressions")
MSG_DEF(JSMSG_TOUGH_BREAK, 0, JSEXN_SYNTAXERR, "unlabeled break must be inside loop or switch")
MSG_DEF(JSMSG_UNEXPECTED_TOKEN, 2, JSEXN_SYNTAXERR, "expected {0}, got {1}")
+MSG_DEF(JSMSG_UNEXPECTED_PARAMLIST_END,0, JSEXN_SYNTAXERR, "unexpected end of function parameter list")
MSG_DEF(JSMSG_UNNAMED_CLASS_STMT, 0, JSEXN_SYNTAXERR, "class statement requires a name")
MSG_DEF(JSMSG_UNNAMED_FUNCTION_STMT, 0, JSEXN_SYNTAXERR, "function statement requires a name")
MSG_DEF(JSMSG_UNTERMINATED_COMMENT, 0, JSEXN_SYNTAXERR, "unterminated comment")
@@ -473,6 +474,8 @@ MSG_DEF(JSMSG_INTL_OBJECT_NOT_INITED, 3, JSEXN_TYPEERR, "Intl.{0}.prototype.{1}
MSG_DEF(JSMSG_INTL_OBJECT_REINITED, 0, JSEXN_TYPEERR, "can't initialize object twice as an object of an Intl constructor")
MSG_DEF(JSMSG_INVALID_CURRENCY_CODE, 1, JSEXN_RANGEERR, "invalid currency code in NumberFormat(): {0}")
MSG_DEF(JSMSG_INVALID_DIGITS_VALUE, 1, JSEXN_RANGEERR, "invalid digits value: {0}")
+MSG_DEF(JSMSG_INVALID_KEYS_TYPE, 0, JSEXN_TYPEERR, "calendar info keys must be an object or undefined")
+MSG_DEF(JSMSG_INVALID_KEY, 1, JSEXN_RANGEERR, "invalid key: {0}")
MSG_DEF(JSMSG_INVALID_LANGUAGE_TAG, 1, JSEXN_RANGEERR, "invalid language tag: {0}")
MSG_DEF(JSMSG_INVALID_LOCALES_ELEMENT, 0, JSEXN_TYPEERR, "invalid element in locales argument")
MSG_DEF(JSMSG_INVALID_LOCALE_MATCHER, 1, JSEXN_RANGEERR, "invalid locale matcher in supportedLocalesOf(): {0}")
@@ -579,3 +582,7 @@ MSG_DEF(JSMSG_PROMISE_CAPABILITY_HAS_SOMETHING_ALREADY, 0, JSEXN_TYPEERR, "GetCa
MSG_DEF(JSMSG_PROMISE_RESOLVE_FUNCTION_NOT_CALLABLE, 0, JSEXN_TYPEERR, "A Promise subclass passed a non-callable value as the resolve function.")
MSG_DEF(JSMSG_PROMISE_REJECT_FUNCTION_NOT_CALLABLE, 0, JSEXN_TYPEERR, "A Promise subclass passed a non-callable value as the reject function.")
MSG_DEF(JSMSG_PROMISE_ERROR_IN_WRAPPED_REJECTION_REASON,0, JSEXN_INTERNALERR, "Promise rejection value is a non-unwrappable cross-compartment wrapper.")
+
+// Iterator
+MSG_DEF(JSMSG_RETURN_NOT_CALLABLE, 0, JSEXN_TYPEERR, "property 'return' of iterator is not callable")
+MSG_DEF(JSMSG_ITERATOR_NO_THROW, 0, JSEXN_TYPEERR, "iterator does not have a 'throw' method")
diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp
index ee9c610594..85a38bba42 100644
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -11,6 +11,7 @@
#include "jsapi.h"
#include "mozilla/FloatingPoint.h"
+#include "mozilla/Maybe.h"
#include "mozilla/PodOperations.h"
#include "mozilla/Sprintf.h"
@@ -107,6 +108,7 @@ using namespace js::gc;
using mozilla::Maybe;
using mozilla::PodCopy;
using mozilla::PodZero;
+using mozilla::Some;
using JS::AutoGCRooter;
using JS::ToInt32;
@@ -2093,7 +2095,7 @@ DefinePropertyById(JSContext* cx, HandleObject obj, HandleId id, HandleValue val
getter != JS_PropertyStub && setter != JS_StrictPropertyStub)
{
if (getter && !(attrs & JSPROP_GETTER)) {
- RootedAtom atom(cx, IdToFunctionName(cx, id, "get"));
+ RootedAtom atom(cx, IdToFunctionName(cx, id, FunctionPrefixKind::Get));
if (!atom)
return false;
JSFunction* getobj = NewNativeFunction(cx, (Native) getter, 0, atom);
@@ -2109,7 +2111,7 @@ DefinePropertyById(JSContext* cx, HandleObject obj, HandleId id, HandleValue val
if (setter && !(attrs & JSPROP_SETTER)) {
// Root just the getter, since the setter is not yet a JSObject.
AutoRooterGetterSetter getRoot(cx, JSPROP_GETTER, &getter, nullptr);
- RootedAtom atom(cx, IdToFunctionName(cx, id, "set"));
+ RootedAtom atom(cx, IdToFunctionName(cx, id, FunctionPrefixKind::Set));
if (!atom)
return false;
JSFunction* setobj = NewNativeFunction(cx, (Native) setter, 1, atom);
@@ -3433,10 +3435,7 @@ JS::NewFunctionFromSpec(JSContext* cx, const JSFunctionSpec* fs, HandleId id)
{
return nullptr;
}
- JSFunction* fun = &funVal.toObject().as<JSFunction>();
- if (fs->flags & JSFUN_HAS_REST)
- fun->setHasRest();
- return fun;
+ return &funVal.toObject().as<JSFunction>();
}
RootedAtom atom(cx, IdToFunctionName(cx, id));
@@ -3616,7 +3615,7 @@ JS_GetFunctionObject(JSFunction* fun)
JS_PUBLIC_API(JSString*)
JS_GetFunctionId(JSFunction* fun)
{
- return fun->name();
+ return fun->explicitName();
}
JS_PUBLIC_API(JSString*)
@@ -4232,15 +4231,15 @@ JS_GetFunctionScript(JSContext* cx, HandleFunction fun)
}
/*
- * enclosingScope is a static enclosing scope, if any (e.g. a WithScope). If
- * the enclosing scope is the global scope, this must be null.
+ * enclosingScope is a scope, if any (e.g. a WithScope). If the scope is the
+ * global scope, this must be null.
*
- * enclosingDynamicScope is a dynamic scope to use, if it's not the global.
+ * enclosingEnv is an environment to use, if it's not the global.
*/
static bool
CompileFunction(JSContext* cx, const ReadOnlyCompileOptions& optionsArg,
- const char* name, unsigned nargs, const char* const* argnames,
- SourceBufferHolder& srcBuf,
+ const char* name,
+ SourceBufferHolder& srcBuf, uint32_t parameterListEnd,
HandleObject enclosingEnv, HandleScope enclosingScope,
MutableHandleFunction fun)
{
@@ -4256,13 +4255,6 @@ CompileFunction(JSContext* cx, const ReadOnlyCompileOptions& optionsArg,
return false;
}
- Rooted<PropertyNameVector> formals(cx, PropertyNameVector(cx));
- for (unsigned i = 0; i < nargs; i++) {
- RootedAtom argAtom(cx, Atomize(cx, argnames[i], strlen(argnames[i])));
- if (!argAtom || !formals.append(argAtom->asPropertyName()))
- return false;
- }
-
fun.set(NewScriptedFunction(cx, 0, JSFunction::INTERPRETED_NORMAL, funAtom,
/* proto = */ nullptr,
gc::AllocKind::FUNCTION, TenuredObject,
@@ -4275,7 +4267,45 @@ CompileFunction(JSContext* cx, const ReadOnlyCompileOptions& optionsArg,
MOZ_ASSERT_IF(!IsGlobalLexicalEnvironment(enclosingEnv),
enclosingScope->hasOnChain(ScopeKind::NonSyntactic));
- if (!frontend::CompileFunctionBody(cx, fun, optionsArg, formals, srcBuf, enclosingScope))
+ if (!frontend::CompileStandaloneFunction(cx, fun, optionsArg, srcBuf,
+ Some(parameterListEnd), enclosingScope))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+static MOZ_MUST_USE bool
+BuildFunctionString(unsigned nargs, const char* const* argnames,
+ const SourceBufferHolder& srcBuf, StringBuffer* out,
+ uint32_t* parameterListEnd)
+{
+ MOZ_ASSERT(out);
+ MOZ_ASSERT(parameterListEnd);
+
+ if (!out->ensureTwoByteChars())
+ return false;
+ if (!out->append("("))
+ return false;
+ for (unsigned i = 0; i < nargs; i++) {
+ if (i != 0) {
+ if (!out->append(", "))
+ return false;
+ }
+ if (!out->append(argnames[i], strlen(argnames[i])))
+ return false;
+ }
+
+ // Remember the position of ")".
+ *parameterListEnd = out->length();
+ MOZ_ASSERT(FunctionConstructorMedialSigils[0] == ')');
+
+ if (!out->append(FunctionConstructorMedialSigils))
+ return false;
+ if (!out->append(srcBuf.get(), srcBuf.length()))
+ return false;
+ if (!out->append(FunctionConstructorFinalBrace))
return false;
return true;
@@ -4291,7 +4321,16 @@ JS::CompileFunction(JSContext* cx, AutoObjectVector& envChain,
RootedScope scope(cx);
if (!CreateNonSyntacticEnvironmentChain(cx, envChain, &env, &scope))
return false;
- return CompileFunction(cx, options, name, nargs, argnames, srcBuf, env, scope, fun);
+
+ uint32_t parameterListEnd;
+ StringBuffer funStr(cx);
+ if (!BuildFunctionString(nargs, argnames, srcBuf, &funStr, &parameterListEnd))
+ return false;
+
+ size_t newLen = funStr.length();
+ SourceBufferHolder newSrcBuf(funStr.stealChars(), newLen, SourceBufferHolder::GiveOwnership);
+
+ return CompileFunction(cx, options, name, newSrcBuf, parameterListEnd, env, scope, fun);
}
JS_PUBLIC_API(bool)
diff --git a/js/src/jsapi.h b/js/src/jsapi.h
index 2d6ff462c0..989abe47c1 100644
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -650,7 +650,8 @@ typedef enum JSExnType {
JSEXN_DEBUGGEEWOULDRUN,
JSEXN_WASMCOMPILEERROR,
JSEXN_WASMRUNTIMEERROR,
- JSEXN_WARN,
+ JSEXN_ERROR_LIMIT,
+ JSEXN_WARN = JSEXN_ERROR_LIMIT,
JSEXN_LIMIT
} JSExnType;
@@ -874,11 +875,7 @@ class MOZ_STACK_CLASS SourceBufferHolder final
#define JSFUN_CONSTRUCTOR 0x400 /* native that can be called as a ctor */
-// 0x800 /* Unused */
-
-#define JSFUN_HAS_REST 0x1000 /* function has ...rest parameter. */
-
-#define JSFUN_FLAGS_MASK 0x1e00 /* | of all the JSFUN_* flags */
+#define JSFUN_FLAGS_MASK 0x600 /* | of all the JSFUN_* flags */
/*
* If set, will allow redefining a non-configurable property, but only on a
@@ -1102,7 +1099,8 @@ class JS_PUBLIC_API(ContextOptions) {
dumpStackOnDebuggeeWouldRun_(false),
werror_(false),
strictMode_(false),
- extraWarnings_(false)
+ extraWarnings_(false),
+ arrayProtoValues_(true)
{
}
@@ -1226,6 +1224,12 @@ class JS_PUBLIC_API(ContextOptions) {
return *this;
}
+ bool arrayProtoValues() const { return arrayProtoValues_; }
+ ContextOptions& setArrayProtoValues(bool flag) {
+ arrayProtoValues_ = flag;
+ return *this;
+ }
+
private:
bool baseline_ : 1;
bool ion_ : 1;
@@ -1241,6 +1245,7 @@ class JS_PUBLIC_API(ContextOptions) {
bool werror_ : 1;
bool strictMode_ : 1;
bool extraWarnings_ : 1;
+ bool arrayProtoValues_ : 1;
};
JS_PUBLIC_API(ContextOptions&)
@@ -6167,6 +6172,12 @@ class MOZ_STACK_CLASS JS_PUBLIC_API(ForOfIterator) {
bool next(JS::MutableHandleValue val, bool* done);
/**
+ * Close the iterator.
+ * For the case that completion type is throw.
+ */
+ void closeThrow();
+
+ /**
* If initialized with throwOnNonCallable = false, check whether
* the value is iterable.
*/
@@ -6619,5 +6630,14 @@ SetGetPerformanceGroupsCallback(JSContext*, GetGroupsCallback, void*);
} /* namespace js */
+namespace js {
+
+enum class CompletionKind {
+ Normal,
+ Return,
+ Throw
+};
+
+} /* namespace js */
#endif /* jsapi_h */
diff --git a/js/src/jsarray.cpp b/js/src/jsarray.cpp
index 9cbeff6a2e..7a67c00954 100644
--- a/js/src/jsarray.cpp
+++ b/js/src/jsarray.cpp
@@ -3165,9 +3165,7 @@ static const JSFunctionSpec array_methods[] = {
JS_SELF_HOSTED_SYM_FN(iterator, "ArrayValues", 0,0),
JS_SELF_HOSTED_FN("entries", "ArrayEntries", 0,0),
JS_SELF_HOSTED_FN("keys", "ArrayKeys", 0,0),
-#ifdef NIGHTLY_BUILD
JS_SELF_HOSTED_FN("values", "ArrayValues", 0,0),
-#endif
/* ES7 additions */
JS_SELF_HOSTED_FN("includes", "ArrayIncludes", 2,0),
diff --git a/js/src/jsatom.cpp b/js/src/jsatom.cpp
index 3f8e8d8f81..2a3c58638a 100644
--- a/js/src/jsatom.cpp
+++ b/js/src/jsatom.cpp
@@ -510,6 +510,14 @@ ToAtomSlow(ExclusiveContext* cx, typename MaybeRooted<Value, allowGC>::HandleTyp
return v.toBoolean() ? cx->names().true_ : cx->names().false_;
if (v.isNull())
return cx->names().null;
+ if (v.isSymbol()) {
+ if (cx->shouldBeJSContext() && allowGC) {
+ JS_ReportErrorNumberASCII(cx->asJSContext(), GetErrorMessage, nullptr,
+ JSMSG_SYMBOL_TO_STRING);
+ }
+ return nullptr;
+ }
+ MOZ_ASSERT(v.isUndefined());
return cx->names().undefined;
}
diff --git a/js/src/jscntxt.cpp b/js/src/jscntxt.cpp
index 3ffd9ad7b1..31d62332d8 100644
--- a/js/src/jscntxt.cpp
+++ b/js/src/jscntxt.cpp
@@ -803,7 +803,7 @@ js::ReportMissingArg(JSContext* cx, HandleValue v, unsigned arg)
SprintfLiteral(argbuf, "%u", arg);
if (IsFunctionObject(v)) {
- RootedAtom name(cx, v.toObject().as<JSFunction>().name());
+ RootedAtom name(cx, v.toObject().as<JSFunction>().explicitName());
bytes = DecompileValueGenerator(cx, JSDVG_SEARCH_STACK, v, name);
if (!bytes)
return;
diff --git a/js/src/jscompartmentinlines.h b/js/src/jscompartmentinlines.h
index 08d315db09..6a54bc5a64 100644
--- a/js/src/jscompartmentinlines.h
+++ b/js/src/jscompartmentinlines.h
@@ -61,7 +61,7 @@ inline bool
JSCompartment::wrap(JSContext* cx, JS::MutableHandleValue vp)
{
/* Only GC things have to be wrapped or copied. */
- if (!vp.isMarkable())
+ if (!vp.isGCThing())
return true;
/*
diff --git a/js/src/jsdate.cpp b/js/src/jsdate.cpp
index d73fb93d2e..00a8abf848 100644..100755
--- a/js/src/jsdate.cpp
+++ b/js/src/jsdate.cpp
@@ -354,10 +354,22 @@ MakeDate(double day, double time)
JS_PUBLIC_API(double)
JS::MakeDate(double year, unsigned month, unsigned day)
{
+ MOZ_ASSERT(month <= 11);
+ MOZ_ASSERT(day >= 1 && day <= 31);
+
return ::MakeDate(MakeDay(year, month, day), 0);
}
JS_PUBLIC_API(double)
+JS::MakeDate(double year, unsigned month, unsigned day, double time)
+{
+ MOZ_ASSERT(month <= 11);
+ MOZ_ASSERT(day >= 1 && day <= 31);
+
+ return ::MakeDate(MakeDay(year, month, day), time);
+}
+
+JS_PUBLIC_API(double)
JS::YearFromTime(double time)
{
return ::YearFromTime(time);
@@ -1232,7 +1244,10 @@ date_parse(JSContext* cx, unsigned argc, Value* vp)
static ClippedTime
NowAsMillis()
{
- return TimeClip(static_cast<double>(PRMJ_Now()) / PRMJ_USEC_PER_MSEC);
+ const double maxResolutionMs = 2;
+ double timestamp = static_cast<double>(PRMJ_Now()) / PRMJ_USEC_PER_MSEC;
+ timestamp = floor(timestamp / maxResolutionMs) * maxResolutionMs;
+ return TimeClip(timestamp);
}
bool
diff --git a/js/src/jsexn.cpp b/js/src/jsexn.cpp
index d17c6f8b7c..9a8e364edd 100644
--- a/js/src/jsexn.cpp
+++ b/js/src/jsexn.cpp
@@ -48,18 +48,35 @@ using mozilla::PodArrayZero;
static void
exn_finalize(FreeOp* fop, JSObject* obj);
-bool
-Error(JSContext* cx, unsigned argc, Value* vp);
-
static bool
exn_toSource(JSContext* cx, unsigned argc, Value* vp);
-static const JSPropertySpec exception_properties[] = {
- JS_PSGS("stack", ErrorObject::getStack, ErrorObject::setStack, 0),
- JS_PS_END
+#define IMPLEMENT_ERROR_PROTO_CLASS(name) \
+ { \
+ js_Object_str, \
+ JSCLASS_HAS_CACHED_PROTO(JSProto_##name), \
+ JS_NULL_CLASS_OPS, \
+ &ErrorObject::classSpecs[JSProto_##name - JSProto_Error] \
+ }
+
+const Class
+ErrorObject::protoClasses[JSEXN_ERROR_LIMIT] = {
+ IMPLEMENT_ERROR_PROTO_CLASS(Error),
+
+ IMPLEMENT_ERROR_PROTO_CLASS(InternalError),
+ IMPLEMENT_ERROR_PROTO_CLASS(EvalError),
+ IMPLEMENT_ERROR_PROTO_CLASS(RangeError),
+ IMPLEMENT_ERROR_PROTO_CLASS(ReferenceError),
+ IMPLEMENT_ERROR_PROTO_CLASS(SyntaxError),
+ IMPLEMENT_ERROR_PROTO_CLASS(TypeError),
+ IMPLEMENT_ERROR_PROTO_CLASS(URIError),
+
+ IMPLEMENT_ERROR_PROTO_CLASS(DebuggeeWouldRun),
+ IMPLEMENT_ERROR_PROTO_CLASS(CompileError),
+ IMPLEMENT_ERROR_PROTO_CLASS(RuntimeError)
};
-static const JSFunctionSpec exception_methods[] = {
+static const JSFunctionSpec error_methods[] = {
#if JS_HAS_TOSOURCE
JS_FN(js_toSource_str, exn_toSource, 0, 0),
#endif
@@ -67,6 +84,92 @@ static const JSFunctionSpec exception_methods[] = {
JS_FS_END
};
+static const JSPropertySpec error_properties[] = {
+ JS_STRING_PS("message", "", 0),
+ JS_STRING_PS("name", "Error", 0),
+ // Only Error.prototype has .stack!
+ JS_PSGS("stack", ErrorObject::getStack, ErrorObject::setStack, 0),
+ JS_PS_END
+};
+
+#define IMPLEMENT_ERROR_PROPERTIES(name) \
+ { \
+ JS_STRING_PS("message", "", 0), \
+ JS_STRING_PS("name", #name, 0), \
+ JS_PS_END \
+ }
+
+static const JSPropertySpec other_error_properties[JSEXN_ERROR_LIMIT - 1][3] = {
+ IMPLEMENT_ERROR_PROPERTIES(InternalError),
+ IMPLEMENT_ERROR_PROPERTIES(EvalError),
+ IMPLEMENT_ERROR_PROPERTIES(RangeError),
+ IMPLEMENT_ERROR_PROPERTIES(ReferenceError),
+ IMPLEMENT_ERROR_PROPERTIES(SyntaxError),
+ IMPLEMENT_ERROR_PROPERTIES(TypeError),
+ IMPLEMENT_ERROR_PROPERTIES(URIError),
+ IMPLEMENT_ERROR_PROPERTIES(DebuggeeWouldRun),
+ IMPLEMENT_ERROR_PROPERTIES(CompileError),
+ IMPLEMENT_ERROR_PROPERTIES(RuntimeError)
+};
+
+#define IMPLEMENT_NATIVE_ERROR_SPEC(name) \
+ { \
+ ErrorObject::createConstructor, \
+ ErrorObject::createProto, \
+ nullptr, \
+ nullptr, \
+ nullptr, \
+ other_error_properties[JSProto_##name - JSProto_Error - 1], \
+ nullptr, \
+ JSProto_Error \
+ }
+
+#define IMPLEMENT_NONGLOBAL_ERROR_SPEC(name) \
+ { \
+ ErrorObject::createConstructor, \
+ ErrorObject::createProto, \
+ nullptr, \
+ nullptr, \
+ nullptr, \
+ other_error_properties[JSProto_##name - JSProto_Error - 1], \
+ nullptr, \
+ JSProto_Error | ClassSpec::DontDefineConstructor \
+ }
+
+const ClassSpec
+ErrorObject::classSpecs[JSEXN_ERROR_LIMIT] = {
+ {
+ ErrorObject::createConstructor,
+ ErrorObject::createProto,
+ nullptr,
+ nullptr,
+ error_methods,
+ error_properties
+ },
+
+ IMPLEMENT_NATIVE_ERROR_SPEC(InternalError),
+ IMPLEMENT_NATIVE_ERROR_SPEC(EvalError),
+ IMPLEMENT_NATIVE_ERROR_SPEC(RangeError),
+ IMPLEMENT_NATIVE_ERROR_SPEC(ReferenceError),
+ IMPLEMENT_NATIVE_ERROR_SPEC(SyntaxError),
+ IMPLEMENT_NATIVE_ERROR_SPEC(TypeError),
+ IMPLEMENT_NATIVE_ERROR_SPEC(URIError),
+
+ IMPLEMENT_NONGLOBAL_ERROR_SPEC(DebuggeeWouldRun),
+ IMPLEMENT_NONGLOBAL_ERROR_SPEC(CompileError),
+ IMPLEMENT_NONGLOBAL_ERROR_SPEC(RuntimeError)
+};
+
+#define IMPLEMENT_ERROR_CLASS(name) \
+ { \
+ js_Error_str, /* yes, really */ \
+ JSCLASS_HAS_CACHED_PROTO(JSProto_##name) | \
+ JSCLASS_HAS_RESERVED_SLOTS(ErrorObject::RESERVED_SLOTS) | \
+ JSCLASS_BACKGROUND_FINALIZE, \
+ &ErrorObjectClassOps, \
+ &ErrorObject::classSpecs[JSProto_##name - JSProto_Error ] \
+ }
+
static const ClassOps ErrorObjectClassOps = {
nullptr, /* addProperty */
nullptr, /* delProperty */
@@ -82,67 +185,20 @@ static const ClassOps ErrorObjectClassOps = {
nullptr, /* trace */
};
-#define IMPLEMENT_ERROR_CLASS(name, classSpecPtr) \
- { \
- js_Error_str, /* yes, really */ \
- JSCLASS_HAS_CACHED_PROTO(JSProto_##name) | \
- JSCLASS_HAS_RESERVED_SLOTS(ErrorObject::RESERVED_SLOTS) | \
- JSCLASS_BACKGROUND_FINALIZE, \
- &ErrorObjectClassOps, \
- classSpecPtr \
- }
-
-const ClassSpec
-ErrorObject::errorClassSpec_ = {
- ErrorObject::createConstructor,
- ErrorObject::createProto,
- nullptr,
- nullptr,
- exception_methods,
- exception_properties,
- nullptr,
- 0
-};
-
-const ClassSpec
-ErrorObject::subErrorClassSpec_ = {
- ErrorObject::createConstructor,
- ErrorObject::createProto,
- nullptr,
- nullptr,
- nullptr,
- nullptr,
- nullptr,
- JSProto_Error
-};
-
-const ClassSpec
-ErrorObject::nonGlobalErrorClassSpec_ = {
- ErrorObject::createConstructor,
- ErrorObject::createProto,
- nullptr,
- nullptr,
- exception_methods,
- exception_properties,
- nullptr,
- JSProto_Error | ClassSpec::DontDefineConstructor
-};
-
const Class
-ErrorObject::classes[JSEXN_LIMIT] = {
- IMPLEMENT_ERROR_CLASS(Error, &ErrorObject::errorClassSpec_),
- IMPLEMENT_ERROR_CLASS(InternalError, &ErrorObject::subErrorClassSpec_),
- IMPLEMENT_ERROR_CLASS(EvalError, &ErrorObject::subErrorClassSpec_),
- IMPLEMENT_ERROR_CLASS(RangeError, &ErrorObject::subErrorClassSpec_),
- IMPLEMENT_ERROR_CLASS(ReferenceError, &ErrorObject::subErrorClassSpec_),
- IMPLEMENT_ERROR_CLASS(SyntaxError, &ErrorObject::subErrorClassSpec_),
- IMPLEMENT_ERROR_CLASS(TypeError, &ErrorObject::subErrorClassSpec_),
- IMPLEMENT_ERROR_CLASS(URIError, &ErrorObject::subErrorClassSpec_),
-
+ErrorObject::classes[JSEXN_ERROR_LIMIT] = {
+ IMPLEMENT_ERROR_CLASS(Error),
+ IMPLEMENT_ERROR_CLASS(InternalError),
+ IMPLEMENT_ERROR_CLASS(EvalError),
+ IMPLEMENT_ERROR_CLASS(RangeError),
+ IMPLEMENT_ERROR_CLASS(ReferenceError),
+ IMPLEMENT_ERROR_CLASS(SyntaxError),
+ IMPLEMENT_ERROR_CLASS(TypeError),
+ IMPLEMENT_ERROR_CLASS(URIError),
// These Error subclasses are not accessible via the global object:
- IMPLEMENT_ERROR_CLASS(DebuggeeWouldRun, &ErrorObject::nonGlobalErrorClassSpec_),
- IMPLEMENT_ERROR_CLASS(CompileError, &ErrorObject::nonGlobalErrorClassSpec_),
- IMPLEMENT_ERROR_CLASS(RuntimeError, &ErrorObject::nonGlobalErrorClassSpec_)
+ IMPLEMENT_ERROR_CLASS(DebuggeeWouldRun),
+ IMPLEMENT_ERROR_CLASS(CompileError),
+ IMPLEMENT_ERROR_CLASS(RuntimeError)
};
JSErrorReport*
@@ -454,35 +510,41 @@ exn_toSource(JSContext* cx, unsigned argc, Value* vp)
/* static */ JSObject*
ErrorObject::createProto(JSContext* cx, JSProtoKey key)
{
- RootedObject errorProto(cx, GenericCreatePrototype(cx, key));
- if (!errorProto)
- return nullptr;
-
- Rooted<ErrorObject*> err(cx, &errorProto->as<ErrorObject>());
- RootedString emptyStr(cx, cx->names().empty);
JSExnType type = ExnTypeFromProtoKey(key);
- if (!ErrorObject::init(cx, err, type, nullptr, emptyStr, nullptr, 0, 0, emptyStr))
- return nullptr;
- // The various prototypes also have .name in addition to the normal error
- // instance properties.
- RootedPropertyName name(cx, ClassName(key, cx));
- RootedValue nameValue(cx, StringValue(name));
- if (!DefineProperty(cx, err, cx->names().name, nameValue, nullptr, nullptr, 0))
+ if (type == JSEXN_ERR)
+ return cx->global()->createBlankPrototype(cx, &ErrorObject::protoClasses[JSEXN_ERR]);
+
+ RootedObject protoProto(cx, GlobalObject::getOrCreateErrorPrototype(cx, cx->global()));
+ if (!protoProto)
return nullptr;
- return errorProto;
+ return cx->global()->createBlankPrototypeInheriting(cx, &ErrorObject::protoClasses[type],
+ protoProto);
}
/* static */ JSObject*
ErrorObject::createConstructor(JSContext* cx, JSProtoKey key)
{
+ JSExnType type = ExnTypeFromProtoKey(key);
RootedObject ctor(cx);
- ctor = GenericCreateConstructor<Error, 1, gc::AllocKind::FUNCTION_EXTENDED>(cx, key);
+
+ if (type == JSEXN_ERR) {
+ ctor = GenericCreateConstructor<Error, 1, gc::AllocKind::FUNCTION_EXTENDED>(cx, key);
+ } else {
+ RootedFunction proto(cx, GlobalObject::getOrCreateErrorConstructor(cx, cx->global()));
+ if (!proto)
+ return nullptr;
+
+ ctor = NewFunctionWithProto(cx, Error, 1, JSFunction::NATIVE_CTOR, nullptr,
+ ClassName(key, cx), proto, gc::AllocKind::FUNCTION_EXTENDED,
+ SingletonObject);
+ }
+
if (!ctor)
return nullptr;
- ctor->as<JSFunction>().setExtendedSlot(0, Int32Value(ExnTypeFromProtoKey(key)));
+ ctor->as<JSFunction>().setExtendedSlot(0, Int32Value(type));
return ctor;
}
diff --git a/js/src/jsexn.h b/js/src/jsexn.h
index a63c70909e..ae6335209b 100644
--- a/js/src/jsexn.h
+++ b/js/src/jsexn.h
@@ -85,10 +85,17 @@ ExnTypeFromProtoKey(JSProtoKey key)
{
JSExnType type = static_cast<JSExnType>(key - JSProto_Error);
MOZ_ASSERT(type >= JSEXN_ERR);
- MOZ_ASSERT(type < JSEXN_WARN);
+ MOZ_ASSERT(type < JSEXN_ERROR_LIMIT);
return type;
}
+static inline bool
+IsErrorProtoKey(JSProtoKey key)
+{
+ JSExnType type = static_cast<JSExnType>(key - JSProto_Error);
+ return type >= JSEXN_ERR && type < JSEXN_ERROR_LIMIT;
+}
+
class AutoClearPendingException
{
JSContext* cx;
diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h
index b1c7cb0dcb..7220855491 100644
--- a/js/src/jsfriendapi.h
+++ b/js/src/jsfriendapi.h
@@ -761,7 +761,7 @@ SetReservedSlot(JSObject* obj, size_t slot, const JS::Value& value)
{
MOZ_ASSERT(slot < JSCLASS_RESERVED_SLOTS(GetObjectClass(obj)));
shadow::Object* sobj = reinterpret_cast<shadow::Object*>(obj);
- if (sobj->slotRef(slot).isMarkable() || value.isMarkable())
+ if (sobj->slotRef(slot).isGCThing() || value.isGCThing())
SetReservedOrProxyPrivateSlotWithBarrier(obj, slot, value);
else
sobj->slotRef(slot) = value;
diff --git a/js/src/jsfun.cpp b/js/src/jsfun.cpp
index c952441ad5..bcb0da80b2 100644
--- a/js/src/jsfun.cpp
+++ b/js/src/jsfun.cpp
@@ -12,6 +12,7 @@
#include "mozilla/ArrayUtils.h"
#include "mozilla/CheckedInt.h"
+#include "mozilla/Maybe.h"
#include "mozilla/PodOperations.h"
#include "mozilla/Range.h"
@@ -60,8 +61,10 @@ using namespace js::gc;
using namespace js::frontend;
using mozilla::ArrayLength;
+using mozilla::Maybe;
using mozilla::PodCopy;
using mozilla::RangedPtr;
+using mozilla::Some;
static bool
fun_enumerate(JSContext* cx, HandleObject obj)
@@ -559,7 +562,7 @@ js::XDRInterpretedFunction(XDRState<mode>* xdr, HandleScope enclosingScope,
return false;
}
- if (fun->name() || fun->hasGuessedAtom())
+ if (fun->explicitName() || fun->hasCompileTimeName() || fun->hasGuessedAtom())
firstword |= HasAtom;
if (fun->isStarGenerator())
@@ -985,19 +988,19 @@ js::FindBody(JSContext* cx, HandleFunction fun, HandleLinearString src, size_t*
}
JSString*
-js::FunctionToString(JSContext* cx, HandleFunction fun, bool lambdaParen)
+js::FunctionToString(JSContext* cx, HandleFunction fun, bool prettyPrint)
{
if (fun->isInterpretedLazy() && !fun->getOrCreateScript(cx))
return nullptr;
if (IsAsmJSModule(fun))
- return AsmJSModuleToString(cx, fun, !lambdaParen);
+ return AsmJSModuleToString(cx, fun, !prettyPrint);
if (IsAsmJSFunction(fun))
return AsmJSFunctionToString(cx, fun);
if (IsWrappedAsyncFunction(fun)) {
RootedFunction unwrapped(cx, GetUnwrappedAsyncFunction(fun));
- return FunctionToString(cx, unwrapped, lambdaParen);
+ return FunctionToString(cx, unwrapped, prettyPrint);
}
StringBuffer out(cx);
@@ -1023,11 +1026,10 @@ js::FunctionToString(JSContext* cx, HandleFunction fun, bool lambdaParen)
bool funIsMethodOrNonArrowLambda = (fun->isLambda() && !fun->isArrow()) || fun->isMethod() ||
fun->isGetter() || fun->isSetter();
+ bool haveSource = fun->isInterpreted() && !fun->isSelfHostedBuiltin();
// If we're not in pretty mode, put parentheses around lambda functions and methods.
- if (fun->isInterpreted() && !lambdaParen && funIsMethodOrNonArrowLambda &&
- !fun->isSelfHostedBuiltin())
- {
+ if (haveSource && !prettyPrint && funIsMethodOrNonArrowLambda) {
if (!out.append("("))
return nullptr;
}
@@ -1040,12 +1042,11 @@ js::FunctionToString(JSContext* cx, HandleFunction fun, bool lambdaParen)
if (!ok)
return nullptr;
}
- if (fun->name()) {
- if (!out.append(fun->name()))
+ if (fun->explicitName()) {
+ if (!out.append(fun->explicitName()))
return nullptr;
}
- bool haveSource = fun->isInterpreted() && !fun->isSelfHostedBuiltin();
if (haveSource && !script->scriptSource()->hasSourceData() &&
!JSScript::loadSource(cx, script->scriptSource(), &haveSource))
{
@@ -1056,54 +1057,10 @@ js::FunctionToString(JSContext* cx, HandleFunction fun, bool lambdaParen)
if (!src)
return nullptr;
- // The source data for functions created by calling the Function
- // constructor is only the function's body. This depends on the fact,
- // asserted below, that in Function("function f() {}"), the inner
- // function's sourceStart points to the '(', not the 'f'.
- bool funCon = !fun->isArrow() &&
- script->sourceStart() == 0 &&
- script->sourceEnd() == script->scriptSource()->length() &&
- script->scriptSource()->argumentsNotIncluded();
-
- // Functions created with the constructor can't be arrow functions or
- // expression closures.
- MOZ_ASSERT_IF(funCon, !fun->isArrow());
- MOZ_ASSERT_IF(funCon, !fun->isExprBody());
- MOZ_ASSERT_IF(!funCon && !fun->isArrow(),
- src->length() > 0 && src->latin1OrTwoByteChar(0) == '(');
-
- bool buildBody = funCon;
- if (buildBody) {
- // This function was created with the Function constructor. We don't
- // have source for the arguments, so we have to generate that. Part
- // of bug 755821 should be cobbling the arguments passed into the
- // Function constructor into the source string.
- if (!out.append("("))
- return nullptr;
-
- // Fish out the argument names.
- MOZ_ASSERT(script->numArgs() == fun->nargs());
-
- BindingIter bi(script);
- for (unsigned i = 0; i < fun->nargs(); i++, bi++) {
- MOZ_ASSERT(bi.argumentSlot() == i);
- if (i && !out.append(", "))
- return nullptr;
- if (i == unsigned(fun->nargs() - 1) && fun->hasRest() && !out.append("..."))
- return nullptr;
- if (!out.append(bi.name()))
- return nullptr;
- }
- if (!out.append(") {\n"))
- return nullptr;
- }
if (!out.append(src))
return nullptr;
- if (buildBody) {
- if (!out.append("\n}"))
- return nullptr;
- }
- if (!lambdaParen && funIsMethodOrNonArrowLambda) {
+
+ if (!prettyPrint && funIsMethodOrNonArrowLambda) {
if (!out.append(")"))
return nullptr;
}
@@ -1114,8 +1071,6 @@ js::FunctionToString(JSContext* cx, HandleFunction fun, bool lambdaParen)
{
return nullptr;
}
- if (!lambdaParen && fun->isLambda() && !fun->isArrow() && !out.append(")"))
- return nullptr;
} else {
MOZ_ASSERT(!fun->isExprBody());
@@ -1374,8 +1329,7 @@ JSFunction::getLength(JSContext* cx, uint16_t* length)
if (self->isInterpretedLazy() && !self->getOrCreateScript(cx))
return false;
- *length = self->hasScript() ? self->nonLazyScript()->funLength()
- : (self->nargs() - self->hasRest());
+ *length = self->isNative() ? self->nargs() : self->nonLazyScript()->funLength();
return true;
}
@@ -1410,14 +1364,14 @@ JSFunction::getUnresolvedName(JSContext* cx)
if (isClassConstructor()) {
// It's impossible to have an empty named class expression. We use
// empty as a sentinel when creating default class constructors.
- MOZ_ASSERT(name() != cx->names().empty);
+ MOZ_ASSERT(explicitOrCompileTimeName() != cx->names().empty);
// Unnamed class expressions should not get a .name property at all.
- return name();
+ return explicitOrCompileTimeName();
}
- // Returns the empty string for unnamed functions (FIXME: bug 883377).
- return name() != nullptr ? name() : cx->names().empty;
+ return explicitOrCompileTimeName() != nullptr ? explicitOrCompileTimeName()
+ : cx->names().empty;
}
static const js::Value&
@@ -1657,17 +1611,6 @@ fun_isGenerator(JSContext* cx, unsigned argc, Value* vp)
return true;
}
-/*
- * Report "malformed formal parameter" iff no illegal char or similar scanner
- * error was already reported.
- */
-static bool
-OnBadFormal(JSContext* cx)
-{
- JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_BAD_FORMAL);
- return false;
-}
-
const JSFunctionSpec js::function_methods[] = {
#if JS_HAS_TOSOURCE
JS_FN(js_toSource_str, fun_toSource, 0,0),
@@ -1676,18 +1619,17 @@ const JSFunctionSpec js::function_methods[] = {
JS_FN(js_apply_str, fun_apply, 2,0),
JS_FN(js_call_str, fun_call, 1,0),
JS_FN("isGenerator", fun_isGenerator,0,0),
- JS_SELF_HOSTED_FN("bind", "FunctionBind", 2, JSFUN_HAS_REST),
+ JS_SELF_HOSTED_FN("bind", "FunctionBind", 2, 0),
JS_SYM_FN(hasInstance, fun_symbolHasInstance, 1, JSPROP_READONLY | JSPROP_PERMANENT),
JS_FS_END
};
+// ES 2017 draft rev 0f10dba4ad18de92d47d421f378233a2eae8f077 19.2.1.1.1.
static bool
-FunctionConstructor(JSContext* cx, unsigned argc, Value* vp, GeneratorKind generatorKind,
+FunctionConstructor(JSContext* cx, const CallArgs& args, GeneratorKind generatorKind,
FunctionAsyncKind asyncKind)
{
- CallArgs args = CallArgsFromVp(argc, vp);
-
- /* Block this call if security callbacks forbid it. */
+ // Block this call if security callbacks forbid it.
Rooted<GlobalObject*> global(cx, &args.callee().global());
if (!GlobalObject::isRuntimeCodeGenEnabled(cx, global)) {
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_CSP_BLOCKED_FUNCTION);
@@ -1719,82 +1661,65 @@ FunctionConstructor(JSContext* cx, unsigned argc, Value* vp, GeneratorKind gener
introducerFilename = maybeScript->scriptSource()->introducerFilename();
CompileOptions options(cx);
+ // Use line 0 to make the function body starts from line 1.
options.setMutedErrors(mutedErrors)
- .setFileAndLine(filename, 1)
+ .setFileAndLine(filename, 0)
.setNoScriptRval(false)
.setIntroductionInfo(introducerFilename, introductionType, lineno, maybeScript, pcOffset);
- Vector<char16_t> paramStr(cx);
- RootedString bodyText(cx);
+ StringBuffer sb(cx);
- if (args.length() == 0) {
- bodyText = cx->names().empty;
- } else {
- // Collect the function-argument arguments into one string, separated
- // by commas, then make a tokenstream from that string, and scan it to
- // get the arguments. We need to throw the full scanner at the
- // problem because the argument string may contain comments, newlines,
- // destructuring arguments, and similar manner of insanities. ("I have
- // a feeling we're not in simple-comma-separated-parameters land any
- // more, Toto....")
- //
- // XXX It'd be better if the parser provided utility methods to parse
- // an argument list, and to parse a function body given a parameter
- // list. But our parser provides no such pleasant interface now.
- unsigned n = args.length() - 1;
+ if (!sb.append('('))
+ return false;
- // Convert the parameters-related arguments to strings, and determine
- // the length of the string containing the overall parameter list.
- mozilla::CheckedInt<uint32_t> paramStrLen = 0;
+ if (args.length() > 1) {
RootedString str(cx);
+
+ // Steps 5-6, 9.
+ unsigned n = args.length() - 1;
+
for (unsigned i = 0; i < n; i++) {
+ // Steps 9.a-b, 9.d.i-ii.
str = ToString<CanGC>(cx, args[i]);
if (!str)
return false;
- args[i].setString(str);
- paramStrLen += str->length();
- }
-
- // Tack in space for any combining commas.
- if (n > 0)
- paramStrLen += n - 1;
+ // Steps 9.b, 9.d.iii.
+ if (!sb.append(str))
+ return false;
- // Check for integer and string-size overflow.
- if (!paramStrLen.isValid() || paramStrLen.value() > JSString::MAX_LENGTH) {
- ReportAllocationOverflow(cx);
- return false;
+ if (i < args.length() - 2) {
+ // Step 9.d.iii.
+ if (!sb.append(", "))
+ return false;
+ }
}
+ }
- uint32_t paramsLen = paramStrLen.value();
-
- // Fill a vector with the comma-joined arguments. Careful! This
- // string is *not* null-terminated!
- MOZ_ASSERT(paramStr.length() == 0);
- if (!paramStr.growBy(paramsLen)) {
- ReportOutOfMemory(cx);
- return false;
- }
+ // Remember the position of ")".
+ Maybe<uint32_t> parameterListEnd = Some(uint32_t(sb.length()));
+ MOZ_ASSERT(FunctionConstructorMedialSigils[0] == ')');
- char16_t* cp = paramStr.begin();
- for (unsigned i = 0; i < n; i++) {
- JSLinearString* argLinear = args[i].toString()->ensureLinear(cx);
- if (!argLinear)
- return false;
+ if (!sb.append(FunctionConstructorMedialSigils))
+ return false;
- CopyChars(cp, *argLinear);
- cp += argLinear->length();
+ if (args.length() > 0) {
+ // Steps 7-8, 10.
+ RootedString body(cx, ToString<CanGC>(cx, args[args.length() - 1]));
+ if (!body || !sb.append(body))
+ return false;
+ }
- if (i + 1 < n)
- *cp++ = ',';
- }
+ if (!sb.append(FunctionConstructorFinalBrace))
+ return false;
- MOZ_ASSERT(cp == paramStr.end());
+ // The parser only accepts two byte strings.
+ if (!sb.ensureTwoByteChars())
+ return false;
- bodyText = ToString(cx, args[n]);
- if (!bodyText)
- return false;
- }
+ RootedString functionText(cx, sb.finishString());
+ if (!functionText)
+ return false;
/*
* NB: (new Function) is not lexically closed by its caller, it's just an
@@ -1803,18 +1728,23 @@ FunctionConstructor(JSContext* cx, unsigned argc, Value* vp, GeneratorKind gener
* and so would a call to f from another top-level's script or function.
*/
RootedAtom anonymousAtom(cx, cx->names().anonymous);
+
+ // Step 24.
RootedObject proto(cx);
- if (isStarGenerator) {
- // Unwrapped function of async function should use GeneratorFunction,
- // while wrapped function isn't generator.
+ if (!isAsync) {
+ if (!GetPrototypeFromCallableConstructor(cx, args, &proto))
+ return false;
+ }
+
+ // Step 4.d, use %Generator% as the fallback prototype.
+ // Also use %Generator% for the unwrapped function of async functions.
+ if (!proto && isStarGenerator) {
proto = GlobalObject::getOrCreateStarGeneratorFunctionPrototype(cx, global);
if (!proto)
return false;
- } else {
- if (!GetPrototypeFromCallableConstructor(cx, args, &proto))
- return false;
}
+ // Step 25-32 (reordered).
RootedObject globalLexical(cx, &global->lexicalEnvironment());
AllocKind allocKind = isAsync ? AllocKind::FUNCTION_EXTENDED : AllocKind::FUNCTION;
RootedFunction fun(cx, NewFunctionWithProto(cx, nullptr, 0,
@@ -1827,81 +1757,11 @@ FunctionConstructor(JSContext* cx, unsigned argc, Value* vp, GeneratorKind gener
if (!JSFunction::setTypeForScriptedFunction(cx, fun))
return false;
+ // Steps 2.a-b, 3.a-b, 4.a-b, 11-23.
AutoStableStringChars stableChars(cx);
- if (!stableChars.initTwoByte(cx, bodyText))
+ if (!stableChars.initTwoByte(cx, functionText))
return false;
- bool hasRest = false;
-
- Rooted<PropertyNameVector> formals(cx, PropertyNameVector(cx));
- if (args.length() > 1) {
- // Initialize a tokenstream to parse the new function's arguments. No
- // StrictModeGetter is needed because this TokenStream won't report any
- // strict mode errors. Strict mode errors that might be reported here
- // (duplicate argument names, etc.) will be detected when we compile
- // the function body.
- //
- // XXX Bug! We have to parse the body first to determine strictness.
- // We have to know strictness to parse arguments correctly, in case
- // arguments contains a strict mode violation. And we should be
- // using full-fledged arguments parsing here, in order to handle
- // destructuring and other exotic syntaxes.
- AutoKeepAtoms keepAtoms(cx->perThreadData);
- TokenStream ts(cx, options, paramStr.begin(), paramStr.length(),
- /* strictModeGetter = */ nullptr);
- bool yieldIsValidName = ts.versionNumber() < JSVERSION_1_7 && !isStarGenerator;
-
- // The argument string may be empty or contain no tokens.
- TokenKind tt;
- if (!ts.getToken(&tt))
- return false;
- if (tt != TOK_EOF) {
- while (true) {
- // Check that it's a name.
- if (hasRest) {
- ts.reportError(JSMSG_PARAMETER_AFTER_REST);
- return false;
- }
-
- if (tt == TOK_YIELD && yieldIsValidName)
- tt = TOK_NAME;
-
- if (tt != TOK_NAME) {
- if (tt == TOK_TRIPLEDOT) {
- hasRest = true;
- if (!ts.getToken(&tt))
- return false;
- if (tt == TOK_YIELD && yieldIsValidName)
- tt = TOK_NAME;
- if (tt != TOK_NAME) {
- ts.reportError(JSMSG_NO_REST_NAME);
- return false;
- }
- } else {
- return OnBadFormal(cx);
- }
- }
-
- if (!formals.append(ts.currentName()))
- return false;
-
- // Get the next token. Stop on end of stream. Otherwise
- // insist on a comma, get another name, and iterate.
- if (!ts.getToken(&tt))
- return false;
- if (tt == TOK_EOF)
- break;
- if (tt != TOK_COMMA)
- return OnBadFormal(cx);
- if (!ts.getToken(&tt))
- return false;
- }
- }
- }
-
- if (hasRest)
- fun->setHasRest();
-
mozilla::Range<const char16_t> chars = stableChars.twoByteRange();
SourceBufferHolder::Ownership ownership = stableChars.maybeGiveOwnershipToCaller()
? SourceBufferHolder::GiveOwnership
@@ -1909,11 +1769,13 @@ FunctionConstructor(JSContext* cx, unsigned argc, Value* vp, GeneratorKind gener
bool ok;
SourceBufferHolder srcBuf(chars.begin().get(), chars.length(), ownership);
if (isAsync)
- ok = frontend::CompileAsyncFunctionBody(cx, &fun, options, formals, srcBuf);
+ ok = frontend::CompileStandaloneAsyncFunction(cx, &fun, options, srcBuf, parameterListEnd);
else if (isStarGenerator)
- ok = frontend::CompileStarGeneratorBody(cx, &fun, options, formals, srcBuf);
+ ok = frontend::CompileStandaloneGenerator(cx, &fun, options, srcBuf, parameterListEnd);
else
- ok = frontend::CompileFunctionBody(cx, &fun, options, formals, srcBuf);
+ ok = frontend::CompileStandaloneFunction(cx, &fun, options, srcBuf, parameterListEnd);
+
+ // Step 33.
args.rval().setObject(*fun);
return ok;
}
@@ -1921,24 +1783,47 @@ FunctionConstructor(JSContext* cx, unsigned argc, Value* vp, GeneratorKind gener
bool
js::Function(JSContext* cx, unsigned argc, Value* vp)
{
- return FunctionConstructor(cx, argc, vp, NotGenerator, SyncFunction);
+ CallArgs args = CallArgsFromVp(argc, vp);
+ return FunctionConstructor(cx, args, NotGenerator, SyncFunction);
}
bool
js::Generator(JSContext* cx, unsigned argc, Value* vp)
{
- return FunctionConstructor(cx, argc, vp, StarGenerator, SyncFunction);
+ CallArgs args = CallArgsFromVp(argc, vp);
+ return FunctionConstructor(cx, args, StarGenerator, SyncFunction);
}
bool
js::AsyncFunctionConstructor(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
- if (!FunctionConstructor(cx, argc, vp, StarGenerator, AsyncFunction))
+
+ // Save the callee before its reset in FunctionConstructor().
+ RootedObject newTarget(cx);
+ if (args.isConstructing())
+ newTarget = &args.newTarget().toObject();
+ else
+ newTarget = &args.callee();
+
+ if (!FunctionConstructor(cx, args, StarGenerator, AsyncFunction))
+ return false;
+
+ // ES2017, draft rev 0f10dba4ad18de92d47d421f378233a2eae8f077
+ // 19.2.1.1.1 Runtime Semantics: CreateDynamicFunction, step 24.
+ RootedObject proto(cx);
+ if (!GetPrototypeFromConstructor(cx, newTarget, &proto))
return false;
+ // 19.2.1.1.1, step 4.d, use %AsyncFunctionPrototype% as the fallback.
+ if (!proto) {
+ proto = GlobalObject::getOrCreateAsyncFunctionPrototype(cx, cx->global());
+ if (!proto)
+ return false;
+ }
+
RootedFunction unwrapped(cx, &args.rval().toObject().as<JSFunction>());
- RootedObject wrapped(cx, WrapAsyncFunction(cx, unwrapped));
+ RootedObject wrapped(cx, WrapAsyncFunctionWithProto(cx, unwrapped, proto));
if (!wrapped)
return false;
@@ -2246,34 +2131,115 @@ js::CloneFunctionAndScript(JSContext* cx, HandleFunction fun, HandleObject enclo
*
* Function names are always strings. If id is the well-known @@iterator
* symbol, this returns "[Symbol.iterator]". If a prefix is supplied the final
- * name is |prefix + " " + name|.
+ * name is |prefix + " " + name|. A prefix cannot be supplied if id is a
+ * symbol value.
*
- * Implements step 4 and 5 of SetFunctionName in ES 2016 draft Dec 20, 2015.
+ * Implements steps 3-5 of 9.2.11 SetFunctionName in ES2016.
*/
JSAtom*
-js::IdToFunctionName(JSContext* cx, HandleId id, const char* prefix /* = nullptr */)
+js::IdToFunctionName(JSContext* cx, HandleId id,
+ FunctionPrefixKind prefixKind /* = FunctionPrefixKind::None */)
{
- if (JSID_IS_ATOM(id) && !prefix)
+ // No prefix fastpath.
+ if (JSID_IS_ATOM(id) && prefixKind == FunctionPrefixKind::None)
return JSID_TO_ATOM(id);
- if (JSID_IS_SYMBOL(id) && !prefix) {
+ // Step 3 (implicit).
+
+ // Step 4.
+ if (JSID_IS_SYMBOL(id)) {
+ // Step 4.a.
RootedAtom desc(cx, JSID_TO_SYMBOL(id)->description());
+
+ // Step 4.b, no prefix fastpath.
+ if (!desc && prefixKind == FunctionPrefixKind::None)
+ return cx->names().empty;
+
+ // Step 5 (reordered).
StringBuffer sb(cx);
- if (!sb.append('[') || !sb.append(desc) || !sb.append(']'))
- return nullptr;
+ if (prefixKind == FunctionPrefixKind::Get) {
+ if (!sb.append("get "))
+ return nullptr;
+ } else if (prefixKind == FunctionPrefixKind::Set) {
+ if (!sb.append("set "))
+ return nullptr;
+ }
+
+ // Step 4.b.
+ if (desc) {
+ // Step 4.c.
+ if (!sb.append('[') || !sb.append(desc) || !sb.append(']'))
+ return nullptr;
+ }
return sb.finishAtom();
}
RootedValue idv(cx, IdToValue(id));
- if (!prefix)
- return ToAtom<CanGC>(cx, idv);
+ RootedAtom name(cx, ToAtom<CanGC>(cx, idv));
+ if (!name)
+ return nullptr;
+
+ // Step 5.
+ return NameToFunctionName(cx, name, prefixKind);
+}
+
+JSAtom*
+js::NameToFunctionName(ExclusiveContext* cx, HandleAtom name,
+ FunctionPrefixKind prefixKind /* = FunctionPrefixKind::None */)
+{
+ if (prefixKind == FunctionPrefixKind::None)
+ return name;
StringBuffer sb(cx);
- if (!sb.append(prefix, strlen(prefix)) || !sb.append(' ') || !sb.append(ToAtom<CanGC>(cx, idv)))
+ if (prefixKind == FunctionPrefixKind::Get) {
+ if (!sb.append("get "))
+ return nullptr;
+ } else {
+ if (!sb.append("set "))
+ return nullptr;
+ }
+ if (!sb.append(name))
return nullptr;
return sb.finishAtom();
}
+bool
+js::SetFunctionNameIfNoOwnName(JSContext* cx, HandleFunction fun, HandleValue name,
+ FunctionPrefixKind prefixKind)
+{
+ MOZ_ASSERT(name.isString() || name.isSymbol() || name.isNumber());
+
+ if (fun->isClassConstructor()) {
+ // A class may have static 'name' method or accessor.
+ RootedId nameId(cx, NameToId(cx->names().name));
+ bool result;
+ if (!HasOwnProperty(cx, fun, nameId, &result))
+ return false;
+
+ if (result)
+ return true;
+ } else {
+ // Anonymous function shouldn't have own 'name' property at this point.
+ MOZ_ASSERT(!fun->containsPure(cx->names().name));
+ }
+
+ RootedId id(cx);
+ if (!ValueToId<CanGC>(cx, name, &id))
+ return false;
+
+ RootedAtom funNameAtom(cx, IdToFunctionName(cx, id, prefixKind));
+ if (!funNameAtom)
+ return false;
+
+ RootedValue funNameVal(cx, StringValue(funNameAtom));
+ if (!NativeDefineProperty(cx, fun, cx->names().name, funNameVal, nullptr, nullptr,
+ JSPROP_READONLY))
+ {
+ return false;
+ }
+ return true;
+}
+
JSFunction*
js::DefineFunction(JSContext* cx, HandleObject obj, HandleId id, Native native,
unsigned nargs, unsigned flags, AllocKind allocKind /* = AllocKind::FUNCTION */)
diff --git a/js/src/jsfun.h b/js/src/jsfun.h
index ef4a603d03..7da831aa2b 100644
--- a/js/src/jsfun.h
+++ b/js/src/jsfun.h
@@ -28,6 +28,15 @@ static const uint32_t JSSLOT_BOUND_FUNCTION_TARGET = 2;
static const uint32_t JSSLOT_BOUND_FUNCTION_THIS = 3;
static const uint32_t JSSLOT_BOUND_FUNCTION_ARGS = 4;
+static const char FunctionConstructorMedialSigils[] = ") {\n";
+static const char FunctionConstructorFinalBrace[] = "\n}";
+
+enum class FunctionPrefixKind {
+ None,
+ Get,
+ Set
+};
+
class JSFunction : public js::NativeObject
{
public:
@@ -58,7 +67,9 @@ class JSFunction : public js::NativeObject
function-statement) */
SELF_HOSTED = 0x0080, /* function is self-hosted builtin and must not be
decompilable nor constructible. */
- HAS_REST = 0x0100, /* function has a rest (...) parameter */
+ HAS_COMPILE_TIME_NAME = 0x0100, /* function had no explicit name, but a
+ name was set by SetFunctionName
+ at compile time */
INTERPRETED_LAZY = 0x0200, /* function is interpreted but doesn't have a script yet */
RESOLVED_LENGTH = 0x0400, /* f.length has been resolved (see fun_resolve). */
RESOLVED_NAME = 0x0800, /* f.name has been resolved (see fun_resolve). */
@@ -92,7 +103,7 @@ class JSFunction : public js::NativeObject
NO_XDR_FLAGS = RESOLVED_LENGTH | RESOLVED_NAME,
STABLE_ACROSS_CLONES = CONSTRUCTOR | EXPR_BODY | HAS_GUESSED_ATOM | LAMBDA |
- SELF_HOSTED | HAS_REST | FUNCTION_KIND_MASK
+ SELF_HOSTED | HAS_COMPILE_TIME_NAME | FUNCTION_KIND_MASK
};
static_assert((INTERPRETED | INTERPRETED_LAZY) == js::JS_FUNCTION_INTERPRETED_BITS,
@@ -177,10 +188,10 @@ class JSFunction : public js::NativeObject
/* Possible attributes of an interpreted function: */
bool isExprBody() const { return flags() & EXPR_BODY; }
+ bool hasCompileTimeName() const { return flags() & HAS_COMPILE_TIME_NAME; }
bool hasGuessedAtom() const { return flags() & HAS_GUESSED_ATOM; }
bool isLambda() const { return flags() & LAMBDA; }
bool isBoundFunction() const { return flags() & BOUND_FUN; }
- bool hasRest() const { return flags() & HAS_REST; }
bool isInterpretedLazy() const { return flags() & INTERPRETED_LAZY; }
bool hasScript() const { return flags() & INTERPRETED; }
@@ -219,7 +230,7 @@ class JSFunction : public js::NativeObject
}
bool isNamedLambda() const {
- return isLambda() && displayAtom() && !hasGuessedAtom();
+ return isLambda() && displayAtom() && !hasCompileTimeName() && !hasGuessedAtom();
}
bool hasLexicalThis() const {
@@ -261,11 +272,6 @@ class JSFunction : public js::NativeObject
this->nargs_ = nargs;
}
- // Can be called multiple times by the parser.
- void setHasRest() {
- flags_ |= HAS_REST;
- }
-
void setIsBoundFunction() {
MOZ_ASSERT(!isBoundFunction());
flags_ |= BOUND_FUN;
@@ -312,14 +318,12 @@ class JSFunction : public js::NativeObject
JSAtom* getUnresolvedName(JSContext* cx);
- JSAtom* name() const { return hasGuessedAtom() ? nullptr : atom_.get(); }
-
- // Because display names (see Debugger.Object.displayName) are already stored
- // on functions and will always contain a valid es6 function name, as described
- // in "ECMA-262 (2016-02-27) 9.2.11 SetFunctionName," we have opted to save
- // memory by parsing the existing display name when a function's name property
- // is accessed.
- JSAtom* functionName(JSContext* cx) const;
+ JSAtom* explicitName() const {
+ return (hasCompileTimeName() || hasGuessedAtom()) ? nullptr : atom_.get();
+ }
+ JSAtom* explicitOrCompileTimeName() const {
+ return hasGuessedAtom() ? nullptr : atom_.get();
+ }
void initAtom(JSAtom* atom) { atom_.init(atom); }
@@ -329,9 +333,24 @@ class JSFunction : public js::NativeObject
return atom_;
}
+ void setCompileTimeName(JSAtom* atom) {
+ MOZ_ASSERT(!atom_);
+ MOZ_ASSERT(atom);
+ MOZ_ASSERT(!hasGuessedAtom());
+ MOZ_ASSERT(!isClassConstructor());
+ atom_ = atom;
+ flags_ |= HAS_COMPILE_TIME_NAME;
+ }
+ JSAtom* compileTimeName() const {
+ MOZ_ASSERT(hasCompileTimeName());
+ MOZ_ASSERT(atom_);
+ return atom_;
+ }
+
void setGuessedAtom(JSAtom* atom) {
MOZ_ASSERT(!atom_);
MOZ_ASSERT(atom);
+ MOZ_ASSERT(!hasCompileTimeName());
MOZ_ASSERT(!hasGuessedAtom());
atom_ = atom;
flags_ |= HAS_GUESSED_ATOM;
@@ -676,7 +695,16 @@ NewFunctionWithProto(ExclusiveContext* cx, JSNative native, unsigned nargs,
NewFunctionProtoHandling protoHandling = NewFunctionClassProto);
extern JSAtom*
-IdToFunctionName(JSContext* cx, HandleId id, const char* prefix = nullptr);
+IdToFunctionName(JSContext* cx, HandleId id,
+ FunctionPrefixKind prefixKind = FunctionPrefixKind::None);
+
+extern JSAtom*
+NameToFunctionName(ExclusiveContext* cx, HandleAtom name,
+ FunctionPrefixKind prefixKind = FunctionPrefixKind::None);
+
+extern bool
+SetFunctionNameIfNoOwnName(JSContext* cx, HandleFunction fun, HandleValue name,
+ FunctionPrefixKind prefixKind);
extern JSFunction*
DefineFunction(JSContext* cx, HandleObject obj, HandleId id, JSNative native,
@@ -802,7 +830,7 @@ inline void
JSFunction::setExtendedSlot(size_t which, const js::Value& val)
{
MOZ_ASSERT(which < mozilla::ArrayLength(toExtended()->extendedSlots));
- MOZ_ASSERT_IF(js::IsMarkedBlack(this) && val.isMarkable(),
+ MOZ_ASSERT_IF(js::IsMarkedBlack(this) && val.isGCThing(),
!JS::GCThingIsMarkedGray(JS::GCCellPtr(val)));
toExtended()->extendedSlots[which] = val;
}
@@ -816,7 +844,7 @@ JSFunction::getExtendedSlot(size_t which) const
namespace js {
-JSString* FunctionToString(JSContext* cx, HandleFunction fun, bool lambdaParen);
+JSString* FunctionToString(JSContext* cx, HandleFunction fun, bool prettyPring);
template<XDRMode mode>
bool
diff --git a/js/src/jsfuninlines.h b/js/src/jsfuninlines.h
index 8286a7d6af..e134def617 100644
--- a/js/src/jsfuninlines.h
+++ b/js/src/jsfuninlines.h
@@ -16,7 +16,7 @@ namespace js {
inline const char*
GetFunctionNameBytes(JSContext* cx, JSFunction* fun, JSAutoByteString* bytes)
{
- if (JSAtom* name = fun->name())
+ if (JSAtom* name = fun->explicitName())
return bytes->encodeLatin1(cx, name);
return js_anonymous_str;
}
diff --git a/js/src/jsiter.cpp b/js/src/jsiter.cpp
index 63c81e6af8..c1ae5dc159 100644
--- a/js/src/jsiter.cpp
+++ b/js/src/jsiter.cpp
@@ -12,6 +12,7 @@
#include "mozilla/Maybe.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/PodOperations.h"
+#include "mozilla/Unused.h"
#include "jsarray.h"
#include "jsatom.h"
@@ -1229,6 +1230,7 @@ js::CloseIterator(JSContext* cx, HandleObject obj)
}
return LegacyGeneratorObject::close(cx, obj);
}
+
return true;
}
@@ -1246,6 +1248,56 @@ js::UnwindIteratorForException(JSContext* cx, HandleObject obj)
return true;
}
+bool
+js::IteratorCloseForException(JSContext* cx, HandleObject obj)
+{
+ MOZ_ASSERT(cx->isExceptionPending());
+
+ bool isClosingGenerator = cx->isClosingGenerator();
+ JS::AutoSaveExceptionState savedExc(cx);
+
+ // Implements IteratorClose (ES 7.4.6) for exception unwinding. See
+ // also the bytecode generated by BytecodeEmitter::emitIteratorClose.
+
+ // Step 3.
+ //
+ // Get the "return" method.
+ RootedValue returnMethod(cx);
+ if (!GetProperty(cx, obj, obj, cx->names().return_, &returnMethod))
+ return false;
+
+ // Step 4.
+ //
+ // Do nothing if "return" is null or undefined. Throw a TypeError if the
+ // method is not IsCallable.
+ if (returnMethod.isNullOrUndefined())
+ return true;
+ if (!IsCallable(returnMethod))
+ return ReportIsNotFunction(cx, returnMethod);
+
+ // Step 5, 6, 8.
+ //
+ // Call "return" if it is not null or undefined.
+ RootedValue rval(cx);
+ bool ok = Call(cx, returnMethod, obj, &rval);
+ if (isClosingGenerator) {
+ // Closing an iterator is implemented as an exception, but in spec
+ // terms it is a Completion value with [[Type]] return. In this case
+ // we *do* care if the call threw and if it returned an object.
+ if (!ok)
+ return false;
+ if (!rval.isObject())
+ return ThrowCheckIsObject(cx, CheckIsObjectKind::IteratorReturn);
+ } else {
+ // We don't care if the call threw or that it returned an Object, as
+ // Step 6 says if IteratorClose is being called during a throw, the
+ // original throw has primacy.
+ savedExc.restore();
+ }
+
+ return true;
+}
+
void
js::UnwindIteratorForUncatchableException(JSContext* cx, JSObject* obj)
{
diff --git a/js/src/jsiter.h b/js/src/jsiter.h
index 35d7ef118c..f11f09b550 100644
--- a/js/src/jsiter.h
+++ b/js/src/jsiter.h
@@ -189,6 +189,9 @@ CloseIterator(JSContext* cx, HandleObject iterObj);
bool
UnwindIteratorForException(JSContext* cx, HandleObject obj);
+bool
+IteratorCloseForException(JSContext* cx, HandleObject obj);
+
void
UnwindIteratorForUncatchableException(JSContext* cx, JSObject* obj);
diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp
index 33feb0a546..b17c845bb7 100644
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -2936,6 +2936,11 @@ DefineFunctionFromSpec(JSContext* cx, HandleObject obj, const JSFunctionSpec* fs
if (!PropertySpecNameToId(cx, fs->name, &id))
return false;
+ if (StandardProtoKeyOrNull(obj) == JSProto_Array && id == NameToId(cx->names().values)) {
+ if (!cx->options().arrayProtoValues())
+ return true;
+ }
+
JSFunction* fun = NewFunctionFromSpec(cx, fs, id);
if (!fun)
return false;
diff --git a/js/src/jsopcode.cpp b/js/src/jsopcode.cpp
index 31bbfb4717..6adb5401ea 100644
--- a/js/src/jsopcode.cpp
+++ b/js/src/jsopcode.cpp
@@ -92,7 +92,8 @@ const char * const js::CodeName[] = {
/************************************************************************/
-#define COUNTS_LEN 16
+static bool
+DecompileArgumentFromStack(JSContext* cx, int formalIndex, char** res);
size_t
js::GetVariableBytecodeLength(jsbytecode* pc)
@@ -460,6 +461,34 @@ BytecodeParser::simulateOp(JSOp op, uint32_t offset, uint32_t* offsetStack, uint
offsetStack[stackDepth] = tmp;
}
break;
+
+ case JSOP_PICK: {
+ jsbytecode* pc = script_->offsetToPC(offset);
+ unsigned n = GET_UINT8(pc);
+ MOZ_ASSERT(ndefs == n + 1);
+ if (offsetStack) {
+ uint32_t top = stackDepth + n;
+ uint32_t tmp = offsetStack[stackDepth];
+ for (uint32_t i = stackDepth; i < top; i++)
+ offsetStack[i] = offsetStack[i + 1];
+ offsetStack[top] = tmp;
+ }
+ break;
+ }
+
+ case JSOP_UNPICK: {
+ jsbytecode* pc = script_->offsetToPC(offset);
+ unsigned n = GET_UINT8(pc);
+ MOZ_ASSERT(ndefs == n + 1);
+ if (offsetStack) {
+ uint32_t top = stackDepth + n;
+ uint32_t tmp = offsetStack[top];
+ for (uint32_t i = top; i > stackDepth; i--)
+ offsetStack[i] = offsetStack[i - 1];
+ offsetStack[stackDepth] = tmp;
+ }
+ break;
+ }
}
stackDepth += ndefs;
return stackDepth;
@@ -1230,6 +1259,24 @@ ExpressionDecompiler::decompilePC(jsbytecode* pc)
return write(loadAtom(pc));
case JSOP_GETARG: {
unsigned slot = GET_ARGNO(pc);
+
+ // For self-hosted scripts that are called from non-self-hosted code,
+ // decompiling the parameter name in the self-hosted script is
+ // unhelpful. Decompile the argument name instead.
+ if (script->selfHosted()) {
+ char* result;
+ if (!DecompileArgumentFromStack(cx, slot, &result))
+ return false;
+
+ // Note that decompiling the argument in the parent frame might
+ // not succeed.
+ if (result) {
+ bool ok = write(result);
+ js_free(result);
+ return ok;
+ }
+ }
+
JSAtom* atom = getArg(slot);
if (!atom)
return false;
@@ -1593,12 +1640,17 @@ DecompileArgumentFromStack(JSContext* cx, int formalIndex, char** res)
MOZ_ASSERT(frameIter.script()->selfHosted());
/*
- * Get the second-to-top frame, the caller of the builtin that called the
- * intrinsic.
+ * Get the second-to-top frame, the non-self-hosted caller of the builtin
+ * that called the intrinsic.
*/
++frameIter;
- if (frameIter.done() || !frameIter.hasScript() || frameIter.compartment() != cx->compartment())
+ if (frameIter.done() ||
+ !frameIter.hasScript() ||
+ frameIter.script()->selfHosted() ||
+ frameIter.compartment() != cx->compartment())
+ {
return true;
+ }
RootedScript script(cx, frameIter.script());
jsbytecode* current = frameIter.pc();
diff --git a/js/src/jsopcode.h b/js/src/jsopcode.h
index 4f78596656..e56eebb2d4 100644
--- a/js/src/jsopcode.h
+++ b/js/src/jsopcode.h
@@ -423,6 +423,7 @@ BytecodeFallsThrough(JSOp op)
case JSOP_RETRVAL:
case JSOP_FINALYIELDRVAL:
case JSOP_THROW:
+ case JSOP_THROWMSG:
case JSOP_TABLESWITCH:
return false;
case JSOP_GOSUB:
diff --git a/js/src/jsopcodeinlines.h b/js/src/jsopcodeinlines.h
index cf9c8357a8..5b0ce0cf95 100644
--- a/js/src/jsopcodeinlines.h
+++ b/js/src/jsopcodeinlines.h
@@ -27,6 +27,7 @@ GetDefCount(JSScript* script, unsigned offset)
case JSOP_AND:
return 1;
case JSOP_PICK:
+ case JSOP_UNPICK:
/*
* Pick pops and pushes how deep it looks in the stack + 1
* items. i.e. if the stack were |a b[2] c[1] d[0]|, pick 2
@@ -44,7 +45,7 @@ GetUseCount(JSScript* script, unsigned offset)
{
jsbytecode* pc = script->offsetToPC(offset);
- if (JSOp(*pc) == JSOP_PICK)
+ if (JSOp(*pc) == JSOP_PICK || JSOp(*pc) == JSOP_UNPICK)
return pc[1] + 1;
if (CodeSpec[*pc].nuses == -1)
return StackUses(script, pc);
diff --git a/js/src/jsscript.cpp b/js/src/jsscript.cpp
index 10821f26ae..9f914943ec 100644
--- a/js/src/jsscript.cpp
+++ b/js/src/jsscript.cpp
@@ -316,6 +316,7 @@ js::XDRScript(XDRState<mode>* xdr, HandleScope scriptEnclosingScope, HandleScrip
IsLegacyGenerator,
IsStarGenerator,
IsAsync,
+ HasRest,
OwnSource,
ExplicitUseStrict,
SelfHosted,
@@ -431,6 +432,8 @@ js::XDRScript(XDRState<mode>* xdr, HandleScope scriptEnclosingScope, HandleScrip
scriptBits |= (1 << IsStarGenerator);
if (script->asyncKind() == AsyncFunction)
scriptBits |= (1 << IsAsync);
+ if (script->hasRest())
+ scriptBits |= (1 << HasRest);
if (script->hasSingletons())
scriptBits |= (1 << HasSingleton);
if (script->treatAsRunOnce())
@@ -582,6 +585,8 @@ js::XDRScript(XDRState<mode>* xdr, HandleScope scriptEnclosingScope, HandleScrip
if (scriptBits & (1 << IsAsync))
script->setAsyncKind(AsyncFunction);
+ if (scriptBits & (1 << HasRest))
+ script->setHasRest();
}
JS_STATIC_ASSERT(sizeof(jsbytecode) == 1);
@@ -1689,6 +1694,16 @@ ScriptSource::substringDontDeflate(JSContext* cx, size_t start, size_t stop)
return NewStringCopyNDontDeflate<CanGC>(cx, chars, len);
}
+JSFlatString*
+ScriptSource::functionBodyString(JSContext* cx)
+{
+ MOZ_ASSERT(isFunctionBody());
+
+ size_t start = parameterListEnd_ + (sizeof(FunctionConstructorMedialSigils) - 1);
+ size_t stop = length() - (sizeof(FunctionConstructorFinalBrace) - 1);
+ return substring(cx, start, stop);
+}
+
MOZ_MUST_USE bool
ScriptSource::setSource(ExclusiveContext* cx,
mozilla::UniquePtr<char16_t[], JS::FreePolicy>&& source,
@@ -1740,10 +1755,9 @@ ScriptSource::setCompressedSource(SharedImmutableString&& raw, size_t uncompress
bool
ScriptSource::setSourceCopy(ExclusiveContext* cx, SourceBufferHolder& srcBuf,
- bool argumentsNotIncluded, SourceCompressionTask* task)
+ SourceCompressionTask* task)
{
MOZ_ASSERT(!hasSourceData());
- argumentsNotIncluded_ = argumentsNotIncluded;
auto& cache = cx->zone()->runtimeFromAnyThread()->sharedImmutableStrings();
auto deduped = cache.getOrCreate(srcBuf.get(), srcBuf.length(), [&]() {
@@ -1940,16 +1954,6 @@ ScriptSource::performXDR(XDRState<mode>* xdr)
if (!xdr->codeUint32(&compressedLength))
return false;
- {
- uint8_t argumentsNotIncluded;
- if (mode == XDR_ENCODE)
- argumentsNotIncluded = argumentsNotIncluded_;
- if (!xdr->codeUint8(&argumentsNotIncluded))
- return false;
- if (mode == XDR_DECODE)
- argumentsNotIncluded_ = argumentsNotIncluded;
- }
-
size_t byteLen = compressedLength ? compressedLength : (len * sizeof(char16_t));
if (mode == XDR_DECODE) {
uint8_t* p = xdr->cx()->template pod_malloc<uint8_t>(Max<size_t>(byteLen, 1));
@@ -2074,7 +2078,8 @@ FormatIntroducedFilename(ExclusiveContext* cx, const char* filename, unsigned li
}
bool
-ScriptSource::initFromOptions(ExclusiveContext* cx, const ReadOnlyCompileOptions& options)
+ScriptSource::initFromOptions(ExclusiveContext* cx, const ReadOnlyCompileOptions& options,
+ Maybe<uint32_t> parameterListEnd)
{
MOZ_ASSERT(!filename_);
MOZ_ASSERT(!introducerFilename_);
@@ -2083,6 +2088,7 @@ ScriptSource::initFromOptions(ExclusiveContext* cx, const ReadOnlyCompileOptions
introductionType_ = options.introductionType;
setIntroductionOffset(options.introductionOffset);
+ parameterListEnd_ = parameterListEnd.isSome() ? parameterListEnd.value() : 0;
if (options.hasIntroductionInfo) {
MOZ_ASSERT(options.introductionType != nullptr);
@@ -2636,6 +2642,8 @@ JSScript::initFromFunctionBox(ExclusiveContext* cx, HandleScript script,
script->isGeneratorExp_ = funbox->isGenexpLambda;
script->setGeneratorKind(funbox->generatorKind());
script->setAsyncKind(funbox->asyncKind());
+ if (funbox->hasRest())
+ script->setHasRest();
PositionalFormalParameterIter fi(script);
while (fi && !fi.closedOver())
@@ -2796,9 +2804,10 @@ JSScript::assertValidJumpTargets() const
for (; tn < tnlimit; tn++) {
jsbytecode* tryStart = mainEntry + tn->start;
jsbytecode* tryPc = tryStart - 1;
- if (JSOp(*tryPc) != JSOP_TRY)
+ if (tn->kind != JSTRY_CATCH && tn->kind != JSTRY_FINALLY)
continue;
+ MOZ_ASSERT(JSOp(*tryPc) == JSOP_TRY);
jsbytecode* tryTarget = tryStart + tn->length;
MOZ_ASSERT(mainEntry <= tryTarget && tryTarget < end);
MOZ_ASSERT(BytecodeIsJumpTarget(JSOp(*tryTarget)));
@@ -3294,12 +3303,13 @@ js::detail::CopyScript(JSContext* cx, HandleScript src, HandleScript dst,
dst->needsHomeObject_ = src->needsHomeObject();
dst->isDefaultClassConstructor_ = src->isDefaultClassConstructor();
dst->isAsync_ = src->asyncKind() == AsyncFunction;
+ dst->hasRest_ = src->hasRest_;
if (nconsts != 0) {
GCPtrValue* vector = Rebase<GCPtrValue>(dst, src, src->consts()->vector);
dst->consts()->vector = vector;
for (unsigned i = 0; i < nconsts; ++i)
- MOZ_ASSERT_IF(vector[i].isMarkable(), vector[i].toString()->isAtom());
+ MOZ_ASSERT_IF(vector[i].isGCThing(), vector[i].toString()->isAtom());
}
if (nobjects != 0) {
GCPtrObject* vector = Rebase<GCPtrObject>(dst, src, src->objects()->vector);
@@ -4027,6 +4037,7 @@ LazyScript::Create(ExclusiveContext* cx, HandleFunction fun,
p.shouldDeclareArguments = false;
p.hasThisBinding = false;
p.isAsync = false;
+ p.hasRest = false;
p.numClosedOverBindings = closedOverBindings.length();
p.numInnerFunctions = innerFunctions.length();
p.generatorKindBits = GeneratorKindAsBits(NotGenerator);
@@ -4168,7 +4179,7 @@ JSScript::hasLoops()
bool
JSScript::mayReadFrameArgsDirectly()
{
- return argumentsHasVarBinding() || (function() && function()->hasRest());
+ return argumentsHasVarBinding() || hasRest();
}
static inline void
diff --git a/js/src/jsscript.h b/js/src/jsscript.h
index bc8bda83d3..87da79901d 100644
--- a/js/src/jsscript.h
+++ b/js/src/jsscript.h
@@ -10,6 +10,7 @@
#define jsscript_h
#include "mozilla/Atomics.h"
+#include "mozilla/Maybe.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/PodOperations.h"
#include "mozilla/Variant.h"
@@ -83,7 +84,9 @@ enum JSTryNoteKind {
JSTRY_FINALLY,
JSTRY_FOR_IN,
JSTRY_FOR_OF,
- JSTRY_LOOP
+ JSTRY_LOOP,
+ JSTRY_FOR_OF_ITERCLOSE,
+ JSTRY_DESTRUCTURING_ITERCLOSE
};
/*
@@ -399,6 +402,11 @@ class ScriptSource
// scripts.
uint32_t introductionOffset_;
+ // If this source is for Function constructor, the position of ")" after
+ // parameter list in the source. This is used to get function body.
+ // 0 for other cases.
+ uint32_t parameterListEnd_;
+
// If this ScriptSource was generated by a code-introduction mechanism such
// as |eval| or |new Function|, the debugger needs access to the "raw"
// filename of the top-level script that contains the eval-ing code. To
@@ -428,7 +436,6 @@ class ScriptSource
// demand. If sourceRetrievable_ and hasSourceData() are false, it is not
// possible to get source at all.
bool sourceRetrievable_:1;
- bool argumentsNotIncluded_:1;
bool hasIntroductionOffset_:1;
const char16_t* chunkChars(JSContext* cx, UncompressedSourceCache::AutoHoldEntry& holder,
@@ -443,10 +450,10 @@ class ScriptSource
sourceMapURL_(nullptr),
mutedErrors_(false),
introductionOffset_(0),
+ parameterListEnd_(0),
introducerFilename_(nullptr),
introductionType_(nullptr),
sourceRetrievable_(false),
- argumentsNotIncluded_(false),
hasIntroductionOffset_(false)
{
}
@@ -461,10 +468,10 @@ class ScriptSource
if (--refs == 0)
js_delete(this);
}
- bool initFromOptions(ExclusiveContext* cx, const ReadOnlyCompileOptions& options);
+ bool initFromOptions(ExclusiveContext* cx, const ReadOnlyCompileOptions& options,
+ mozilla::Maybe<uint32_t> parameterListEnd = mozilla::Nothing());
bool setSourceCopy(ExclusiveContext* cx,
JS::SourceBufferHolder& srcBuf,
- bool argumentsNotIncluded,
SourceCompressionTask* tok);
void setSourceRetrievable() { sourceRetrievable_ = true; }
bool sourceRetrievable() const { return sourceRetrievable_; }
@@ -492,11 +499,6 @@ class ScriptSource
return data.match(LengthMatcher());
}
- bool argumentsNotIncluded() const {
- MOZ_ASSERT(hasSourceData());
- return argumentsNotIncluded_;
- }
-
// Return a string containing the chars starting at |begin| and ending at
// |begin + len|.
const char16_t* chars(JSContext* cx, UncompressedSourceCache::AutoHoldEntry& asp,
@@ -504,6 +506,12 @@ class ScriptSource
JSFlatString* substring(JSContext* cx, size_t start, size_t stop);
JSFlatString* substringDontDeflate(JSContext* cx, size_t start, size_t stop);
+
+ bool isFunctionBody() {
+ return parameterListEnd_ != 0;
+ }
+ JSFlatString* functionBodyString(JSContext* cx);
+
void addSizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf,
JS::ScriptSourceInfo* info) const;
@@ -567,6 +575,10 @@ class ScriptSource
introductionOffset_ = offset;
hasIntroductionOffset_ = true;
}
+
+ uint32_t parameterListEnd() const {
+ return parameterListEnd_;
+ }
};
class ScriptSourceHolder
@@ -1002,6 +1014,8 @@ class JSScript : public js::gc::TenuredCell
bool isAsync_:1;
+ bool hasRest_:1;
+
// Add padding so JSScript is gc::Cell aligned. Make padding protected
// instead of private to suppress -Wunused-private-field compiler warnings.
protected:
@@ -1298,6 +1312,13 @@ class JSScript : public js::gc::TenuredCell
isAsync_ = kind == js::AsyncFunction;
}
+ bool hasRest() const {
+ return hasRest_;
+ }
+ void setHasRest() {
+ hasRest_ = true;
+ }
+
void setNeedsHomeObject() {
needsHomeObject_ = true;
}
@@ -1930,6 +1951,7 @@ class LazyScript : public gc::TenuredCell
uint32_t treatAsRunOnce : 1;
uint32_t isDerivedClassConstructor : 1;
uint32_t needsHomeObject : 1;
+ uint32_t hasRest : 1;
};
union {
@@ -2058,6 +2080,13 @@ class LazyScript : public gc::TenuredCell
p_.isAsync = kind == AsyncFunction;
}
+ bool hasRest() const {
+ return p_.hasRest;
+ }
+ void setHasRest() {
+ p_.hasRest = true;
+ }
+
bool strict() const {
return p_.strict;
}
diff --git a/js/src/jsstr.cpp b/js/src/jsstr.cpp
index 32a85dc13f..7adeed6204 100644
--- a/js/src/jsstr.cpp
+++ b/js/src/jsstr.cpp
@@ -2894,7 +2894,7 @@ static const JSFunctionSpec string_static_methods[] = {
JS_INLINABLE_FN("fromCharCode", js::str_fromCharCode, 1, 0, StringFromCharCode),
JS_INLINABLE_FN("fromCodePoint", js::str_fromCodePoint, 1, 0, StringFromCodePoint),
- JS_SELF_HOSTED_FN("raw", "String_static_raw", 2,JSFUN_HAS_REST),
+ JS_SELF_HOSTED_FN("raw", "String_static_raw", 2,0),
JS_SELF_HOSTED_FN("substring", "String_static_substring", 3,0),
JS_SELF_HOSTED_FN("substr", "String_static_substr", 3,0),
JS_SELF_HOSTED_FN("slice", "String_static_slice", 3,0),
diff --git a/js/src/jsstr.h b/js/src/jsstr.h
index 3b92aa21b3..7e9621d4a2 100644
--- a/js/src/jsstr.h
+++ b/js/src/jsstr.h
@@ -9,6 +9,7 @@
#include "mozilla/HashFunctions.h"
#include "mozilla/PodOperations.h"
+#include "mozilla/TextUtils.h"
#include <stdio.h>
@@ -95,7 +96,7 @@ struct JSSubString {
#define JS7_UNOCT(c) (JS7_UNDEC(c))
#define JS7_ISHEX(c) ((c) < 128 && isxdigit(c))
#define JS7_UNHEX(c) (unsigned)(JS7_ISDEC(c) ? (c) - '0' : 10 + tolower(c) - 'a')
-#define JS7_ISLET(c) ((c) < 128 && isalpha(c))
+#define JS7_ISLET(c) (mozilla::IsAsciiAlpha(c))
extern size_t
js_strlen(const char16_t* s);
diff --git a/js/src/jstypes.h b/js/src/jstypes.h
index 6593d2067f..75774e5b82 100644
--- a/js/src/jstypes.h
+++ b/js/src/jstypes.h
@@ -160,10 +160,6 @@
# if defined(__64BIT__)
# define JS_64BIT
# endif
-#elif defined(__HP_cc) || defined(__HP_aCC) /* HP-UX cc/aCC */
-# if defined(__LP64__)
-# define JS_64BIT
-# endif
#else
# error "Implement me"
#endif
diff --git a/js/src/make-source-package.sh b/js/src/make-source-package.sh
index f4131b98fb..e6d3f6df52 100755
--- a/js/src/make-source-package.sh
+++ b/js/src/make-source-package.sh
@@ -95,10 +95,6 @@ case $cmd in
# copy build and config directory.
cp -pPR ${TOPSRCDIR}/build ${TOPSRCDIR}/config ${tgtpath}
- # copy cargo config
- ${MKDIR} -p ${tgtpath}/.cargo
- cp -pPR ${TOPSRCDIR}/.cargo/config.in ${tgtpath}/.cargo
-
# generate configure files to avoid build dependency on autoconf-2.13
cp -PR ${TOPSRCDIR}/js/src/configure.in ${tgtpath}/js/src/configure
chmod a+x ${tgtpath}/js/src/configure
@@ -155,7 +151,6 @@ case $cmd in
${TOPSRCDIR}/memory/moz.build \
${TOPSRCDIR}/memory/build \
${TOPSRCDIR}/memory/fallible \
- ${TOPSRCDIR}/memory/jemalloc \
${TOPSRCDIR}/memory/mozalloc \
${TOPSRCDIR}/memory/mozjemalloc \
${tgtpath}/memory
diff --git a/js/src/moz.build b/js/src/moz.build
index a18170a75e..2d4e83db37 100644
--- a/js/src/moz.build
+++ b/js/src/moz.build
@@ -708,7 +708,7 @@ if CONFIG['_MSC_VER']:
CXXFLAGS += ['-wd4577']
CXXFLAGS += ['-wd4312']
-if CONFIG['OS_ARCH'] not in ('WINNT', 'HP-UX'):
+if CONFIG['OS_ARCH'] not in ('WINNT'):
OS_LIBS += [
'm',
]
diff --git a/js/src/old-configure.in b/js/src/old-configure.in
index 5da81ce3ee..162a071d7f 100644
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -1534,6 +1534,14 @@ MOZ_ARG_ENABLE_STRING(ui-locale,
AC_SUBST(MOZ_UI_LOCALE)
dnl ========================================================
+dnl Build the tests?
+dnl ========================================================
+MOZ_ARG_ENABLE_BOOL(tests,
+[ --enable-tests Build test libraries & programs],
+ ENABLE_TESTS=1,
+ ENABLE_TESTS= )
+
+dnl ========================================================
dnl =
dnl = Module specific options
dnl =
@@ -2091,6 +2099,8 @@ AC_SUBST(MOZ_DEBUG_LDFLAGS)
AC_SUBST(WARNINGS_AS_ERRORS)
AC_SUBST(LIBICONV)
+AC_SUBST(ENABLE_TESTS)
+
AC_SUBST(ENABLE_STRIP)
AC_SUBST(PKG_SKIP_STRIP)
AC_SUBST(INCREMENTAL_LINKER)
@@ -2106,6 +2116,7 @@ AC_SUBST(MOZ_APP_VERSION)
AC_SUBST(MOZ_PKG_SPECIAL)
AC_SUBST(MOZILLA_OFFICIAL)
+AC_SUBST(MC_OFFICIAL)
dnl ========================================================
dnl ECMAScript Internationalization API Support (uses ICU)
@@ -2243,8 +2254,6 @@ AC_SUBST(JS_LIBRARY_NAME)
AC_SUBST(JS_CONFIG_MOZ_JS_LIBS)
AC_SUBST(JS_CONFIG_LIBS)
-MOZ_SUBCONFIGURE_JEMALLOC()
-
# Avoid using obsolete NSPR features
AC_DEFINE(NO_NSPR_10_SUPPORT)
diff --git a/js/src/shell/js.cpp b/js/src/shell/js.cpp
index 3f56981cd3..8d69ca942b 100644
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -323,6 +323,7 @@ static bool enableNativeRegExp = false;
static bool enableUnboxedArrays = false;
static bool enableSharedMemory = SHARED_MEMORY_DEFAULT;
static bool enableWasmAlwaysBaseline = false;
+static bool enableArrayProtoValues = true;
static bool printTiming = false;
static const char* jsCacheDir = nullptr;
static const char* jsCacheAsmJSPath = nullptr;
@@ -905,6 +906,7 @@ AddIntlExtras(JSContext* cx, unsigned argc, Value* vp)
static const JSFunctionSpec funcs[] = {
JS_SELF_HOSTED_FN("getCalendarInfo", "Intl_getCalendarInfo", 1, 0),
+ JS_SELF_HOSTED_FN("getDisplayNames", "Intl_getDisplayNames", 2, 0),
JS_FS_END
};
@@ -2585,11 +2587,28 @@ Notes(JSContext* cx, unsigned argc, Value* vp)
return true;
}
-JS_STATIC_ASSERT(JSTRY_CATCH == 0);
-JS_STATIC_ASSERT(JSTRY_FINALLY == 1);
-JS_STATIC_ASSERT(JSTRY_FOR_IN == 2);
+static const char*
+TryNoteName(JSTryNoteKind kind)
+{
+ switch (kind) {
+ case JSTRY_CATCH:
+ return "catch";
+ case JSTRY_FINALLY:
+ return "finally";
+ case JSTRY_FOR_IN:
+ return "for-in";
+ case JSTRY_FOR_OF:
+ return "for-of";
+ case JSTRY_LOOP:
+ return "loop";
+ case JSTRY_FOR_OF_ITERCLOSE:
+ return "for-of-iterclose";
+ case JSTRY_DESTRUCTURING_ITERCLOSE:
+ return "dstr-iterclose";
+ }
-static const char* const TryNoteNames[] = { "catch", "finally", "for-in", "for-of", "loop" };
+ MOZ_CRASH("Bad JSTryNoteKind");
+}
static MOZ_MUST_USE bool
TryNotes(JSContext* cx, HandleScript script, Sprinter* sp)
@@ -2597,17 +2616,16 @@ TryNotes(JSContext* cx, HandleScript script, Sprinter* sp)
if (!script->hasTrynotes())
return true;
- if (sp->put("\nException table:\nkind stack start end\n") < 0)
+ if (sp->put("\nException table:\nkind stack start end\n") < 0)
return false;
JSTryNote* tn = script->trynotes()->vector;
JSTryNote* tnlimit = tn + script->trynotes()->length;
do {
- MOZ_ASSERT(tn->kind < ArrayLength(TryNoteNames));
- uint8_t startOff = script->pcToOffset(script->main()) + tn->start;
- if (!sp->jsprintf(" %-7s %6u %8u %8u\n",
- TryNoteNames[tn->kind], tn->stackDepth,
- startOff, startOff + tn->length))
+ uint32_t startOff = script->pcToOffset(script->main()) + tn->start;
+ if (!sp->jsprintf(" %-16s %6u %8u %8u\n",
+ TryNoteName(static_cast<JSTryNoteKind>(tn->kind)),
+ tn->stackDepth, startOff, startOff + tn->length))
{
return false;
}
@@ -7248,6 +7266,7 @@ SetContextOptions(JSContext* cx, const OptionParser& op)
enableNativeRegExp = !op.getBoolOption("no-native-regexp");
enableUnboxedArrays = op.getBoolOption("unboxed-arrays");
enableWasmAlwaysBaseline = op.getBoolOption("wasm-always-baseline");
+ enableArrayProtoValues = !op.getBoolOption("no-array-proto-values");
JS::ContextOptionsRef(cx).setBaseline(enableBaseline)
.setIon(enableIon)
@@ -7255,7 +7274,8 @@ SetContextOptions(JSContext* cx, const OptionParser& op)
.setWasm(enableWasm)
.setWasmAlwaysBaseline(enableWasmAlwaysBaseline)
.setNativeRegExp(enableNativeRegExp)
- .setUnboxedArrays(enableUnboxedArrays);
+ .setUnboxedArrays(enableUnboxedArrays)
+ .setArrayProtoValues(enableArrayProtoValues);
if (op.getBoolOption("wasm-check-bce"))
jit::JitOptions.wasmAlwaysCheckBounds = true;
@@ -7526,7 +7546,8 @@ SetWorkerContextOptions(JSContext* cx)
.setWasm(enableWasm)
.setWasmAlwaysBaseline(enableWasmAlwaysBaseline)
.setNativeRegExp(enableNativeRegExp)
- .setUnboxedArrays(enableUnboxedArrays);
+ .setUnboxedArrays(enableUnboxedArrays)
+ .setArrayProtoValues(enableArrayProtoValues);
cx->setOffthreadIonCompilationEnabled(offthreadCompilation);
cx->profilingScripts = enableCodeCoverage || enableDisassemblyDumps;
@@ -7699,6 +7720,7 @@ main(int argc, char** argv, char** envp)
|| !op.addBoolOption('\0', "unboxed-arrays", "Allow creating unboxed arrays")
|| !op.addBoolOption('\0', "wasm-always-baseline", "Enable wasm baseline compiler when possible")
|| !op.addBoolOption('\0', "wasm-check-bce", "Always generate wasm bounds check, even redundant ones.")
+ || !op.addBoolOption('\0', "no-array-proto-values", "Remove Array.prototype.values")
#ifdef ENABLE_SHARED_ARRAY_BUFFER
|| !op.addStringOption('\0', "shared-memory", "on/off",
"SharedArrayBuffer and Atomics "
diff --git a/js/src/tests/Intl/Collator/construct-newtarget.js b/js/src/tests/Intl/Collator/construct-newtarget.js
new file mode 100644
index 0000000000..5db1abf373
--- /dev/null
+++ b/js/src/tests/Intl/Collator/construct-newtarget.js
@@ -0,0 +1,81 @@
+// |reftest| skip-if(!this.hasOwnProperty("Intl"))
+
+/* 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/. */
+
+
+// Test subclassing %Intl.Collator% works correctly.
+class MyCollator extends Intl.Collator {}
+
+var obj = new MyCollator();
+assertEq(obj instanceof MyCollator, true);
+assertEq(obj instanceof Intl.Collator, true);
+assertEq(Object.getPrototypeOf(obj), MyCollator.prototype);
+
+obj = Reflect.construct(MyCollator, []);
+assertEq(obj instanceof MyCollator, true);
+assertEq(obj instanceof Intl.Collator, true);
+assertEq(Object.getPrototypeOf(obj), MyCollator.prototype);
+
+obj = Reflect.construct(MyCollator, [], MyCollator);
+assertEq(obj instanceof MyCollator, true);
+assertEq(obj instanceof Intl.Collator, true);
+assertEq(Object.getPrototypeOf(obj), MyCollator.prototype);
+
+obj = Reflect.construct(MyCollator, [], Intl.Collator);
+assertEq(obj instanceof MyCollator, false);
+assertEq(obj instanceof Intl.Collator, true);
+assertEq(Object.getPrototypeOf(obj), Intl.Collator.prototype);
+
+
+// Set a different constructor as NewTarget.
+obj = Reflect.construct(MyCollator, [], Array);
+assertEq(obj instanceof MyCollator, false);
+assertEq(obj instanceof Intl.Collator, false);
+assertEq(obj instanceof Array, true);
+assertEq(Object.getPrototypeOf(obj), Array.prototype);
+
+obj = Reflect.construct(Intl.Collator, [], Array);
+assertEq(obj instanceof Intl.Collator, false);
+assertEq(obj instanceof Array, true);
+assertEq(Object.getPrototypeOf(obj), Array.prototype);
+
+
+// The prototype defaults to %CollatorPrototype% if null.
+function NewTargetNullPrototype() {}
+NewTargetNullPrototype.prototype = null;
+
+obj = Reflect.construct(Intl.Collator, [], NewTargetNullPrototype);
+assertEq(obj instanceof Intl.Collator, true);
+assertEq(Object.getPrototypeOf(obj), Intl.Collator.prototype);
+
+obj = Reflect.construct(MyCollator, [], NewTargetNullPrototype);
+assertEq(obj instanceof MyCollator, false);
+assertEq(obj instanceof Intl.Collator, true);
+assertEq(Object.getPrototypeOf(obj), Intl.Collator.prototype);
+
+
+// "prototype" property is retrieved exactly once.
+var trapLog = [], getLog = [];
+var ProxiedConstructor = new Proxy(Intl.Collator, new Proxy({
+ get(target, propertyKey, receiver) {
+ getLog.push(propertyKey);
+ return Reflect.get(target, propertyKey, receiver);
+ }
+}, {
+ get(target, propertyKey, receiver) {
+ trapLog.push(propertyKey);
+ return Reflect.get(target, propertyKey, receiver);
+ }
+}));
+
+obj = Reflect.construct(Intl.Collator, [], ProxiedConstructor);
+assertEqArray(trapLog, ["get"]);
+assertEqArray(getLog, ["prototype"]);
+assertEq(obj instanceof Intl.Collator, true);
+assertEq(Object.getPrototypeOf(obj), Intl.Collator.prototype);
+
+
+if (typeof reportCompare === "function")
+ reportCompare(0, 0);
diff --git a/js/src/tests/Intl/DateTimeFormat/construct-newtarget.js b/js/src/tests/Intl/DateTimeFormat/construct-newtarget.js
new file mode 100644
index 0000000000..bbc08c79a1
--- /dev/null
+++ b/js/src/tests/Intl/DateTimeFormat/construct-newtarget.js
@@ -0,0 +1,81 @@
+// |reftest| skip-if(!this.hasOwnProperty("Intl"))
+
+/* 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/. */
+
+
+// Test subclassing %Intl.DateTimeFormat% works correctly.
+class MyDateTimeFormat extends Intl.DateTimeFormat {}
+
+var obj = new MyDateTimeFormat();
+assertEq(obj instanceof MyDateTimeFormat, true);
+assertEq(obj instanceof Intl.DateTimeFormat, true);
+assertEq(Object.getPrototypeOf(obj), MyDateTimeFormat.prototype);
+
+obj = Reflect.construct(MyDateTimeFormat, []);
+assertEq(obj instanceof MyDateTimeFormat, true);
+assertEq(obj instanceof Intl.DateTimeFormat, true);
+assertEq(Object.getPrototypeOf(obj), MyDateTimeFormat.prototype);
+
+obj = Reflect.construct(MyDateTimeFormat, [], MyDateTimeFormat);
+assertEq(obj instanceof MyDateTimeFormat, true);
+assertEq(obj instanceof Intl.DateTimeFormat, true);
+assertEq(Object.getPrototypeOf(obj), MyDateTimeFormat.prototype);
+
+obj = Reflect.construct(MyDateTimeFormat, [], Intl.DateTimeFormat);
+assertEq(obj instanceof MyDateTimeFormat, false);
+assertEq(obj instanceof Intl.DateTimeFormat, true);
+assertEq(Object.getPrototypeOf(obj), Intl.DateTimeFormat.prototype);
+
+
+// Set a different constructor as NewTarget.
+obj = Reflect.construct(MyDateTimeFormat, [], Array);
+assertEq(obj instanceof MyDateTimeFormat, false);
+assertEq(obj instanceof Intl.DateTimeFormat, false);
+assertEq(obj instanceof Array, true);
+assertEq(Object.getPrototypeOf(obj), Array.prototype);
+
+obj = Reflect.construct(Intl.DateTimeFormat, [], Array);
+assertEq(obj instanceof Intl.DateTimeFormat, false);
+assertEq(obj instanceof Array, true);
+assertEq(Object.getPrototypeOf(obj), Array.prototype);
+
+
+// The prototype defaults to %DateTimeFormatPrototype% if null.
+function NewTargetNullPrototype() {}
+NewTargetNullPrototype.prototype = null;
+
+obj = Reflect.construct(Intl.DateTimeFormat, [], NewTargetNullPrototype);
+assertEq(obj instanceof Intl.DateTimeFormat, true);
+assertEq(Object.getPrototypeOf(obj), Intl.DateTimeFormat.prototype);
+
+obj = Reflect.construct(MyDateTimeFormat, [], NewTargetNullPrototype);
+assertEq(obj instanceof MyDateTimeFormat, false);
+assertEq(obj instanceof Intl.DateTimeFormat, true);
+assertEq(Object.getPrototypeOf(obj), Intl.DateTimeFormat.prototype);
+
+
+// "prototype" property is retrieved exactly once.
+var trapLog = [], getLog = [];
+var ProxiedConstructor = new Proxy(Intl.DateTimeFormat, new Proxy({
+ get(target, propertyKey, receiver) {
+ getLog.push(propertyKey);
+ return Reflect.get(target, propertyKey, receiver);
+ }
+}, {
+ get(target, propertyKey, receiver) {
+ trapLog.push(propertyKey);
+ return Reflect.get(target, propertyKey, receiver);
+ }
+}));
+
+obj = Reflect.construct(Intl.DateTimeFormat, [], ProxiedConstructor);
+assertEqArray(trapLog, ["get"]);
+assertEqArray(getLog, ["prototype"]);
+assertEq(obj instanceof Intl.DateTimeFormat, true);
+assertEq(Object.getPrototypeOf(obj), Intl.DateTimeFormat.prototype);
+
+
+if (typeof reportCompare === "function")
+ reportCompare(0, 0);
diff --git a/js/src/tests/Intl/DateTimeFormat/timeZone_backward_links.js b/js/src/tests/Intl/DateTimeFormat/timeZone_backward_links.js
index aeb1fc0431..7b3a46a60a 100644
--- a/js/src/tests/Intl/DateTimeFormat/timeZone_backward_links.js
+++ b/js/src/tests/Intl/DateTimeFormat/timeZone_backward_links.js
@@ -1,7 +1,7 @@
// |reftest| skip-if(!this.hasOwnProperty("Intl"))
// Generated by make_intl_data.py. DO NOT EDIT.
-// tzdata version = 2017c
+// tzdata version = 2018d
const tzMapper = [
x => x,
diff --git a/js/src/tests/Intl/DateTimeFormat/timeZone_backzone.js b/js/src/tests/Intl/DateTimeFormat/timeZone_backzone.js
index b9d957a829..ed63df9217 100644
--- a/js/src/tests/Intl/DateTimeFormat/timeZone_backzone.js
+++ b/js/src/tests/Intl/DateTimeFormat/timeZone_backzone.js
@@ -1,7 +1,7 @@
// |reftest| skip-if(!this.hasOwnProperty("Intl"))
// Generated by make_intl_data.py. DO NOT EDIT.
-// tzdata version = 2017c
+// tzdata version = 2018d
const tzMapper = [
x => x,
@@ -47,7 +47,6 @@ const links = {
"Africa/Nouakchott": "Africa/Nouakchott",
"Africa/Ouagadougou": "Africa/Ouagadougou",
"Africa/Porto-Novo": "Africa/Porto-Novo",
- "Africa/Sao_Tome": "Africa/Sao_Tome",
"Africa/Timbuktu": "Africa/Timbuktu",
"America/Anguilla": "America/Anguilla",
"America/Antigua": "America/Antigua",
diff --git a/js/src/tests/Intl/DateTimeFormat/timeZone_backzone_links.js b/js/src/tests/Intl/DateTimeFormat/timeZone_backzone_links.js
index 7a358e9975..215808765c 100644
--- a/js/src/tests/Intl/DateTimeFormat/timeZone_backzone_links.js
+++ b/js/src/tests/Intl/DateTimeFormat/timeZone_backzone_links.js
@@ -1,7 +1,7 @@
// |reftest| skip-if(!this.hasOwnProperty("Intl"))
// Generated by make_intl_data.py. DO NOT EDIT.
-// tzdata version = 2017c
+// tzdata version = 2018d
const tzMapper = [
x => x,
diff --git a/js/src/tests/Intl/DateTimeFormat/timeZone_notbackward_links.js b/js/src/tests/Intl/DateTimeFormat/timeZone_notbackward_links.js
index 9515cb3945..48242dfbdc 100644
--- a/js/src/tests/Intl/DateTimeFormat/timeZone_notbackward_links.js
+++ b/js/src/tests/Intl/DateTimeFormat/timeZone_notbackward_links.js
@@ -1,7 +1,7 @@
// |reftest| skip-if(!this.hasOwnProperty("Intl"))
// Generated by make_intl_data.py. DO NOT EDIT.
-// tzdata version = 2017c
+// tzdata version = 2018d
const tzMapper = [
x => x,
diff --git a/js/src/tests/Intl/NumberFormat/construct-newtarget.js b/js/src/tests/Intl/NumberFormat/construct-newtarget.js
new file mode 100644
index 0000000000..0053b2737e
--- /dev/null
+++ b/js/src/tests/Intl/NumberFormat/construct-newtarget.js
@@ -0,0 +1,81 @@
+// |reftest| skip-if(!this.hasOwnProperty("Intl"))
+
+/* 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/. */
+
+
+// Test subclassing %Intl.NumberFormat% works correctly.
+class MyNumberFormat extends Intl.NumberFormat {}
+
+var obj = new MyNumberFormat();
+assertEq(obj instanceof MyNumberFormat, true);
+assertEq(obj instanceof Intl.NumberFormat, true);
+assertEq(Object.getPrototypeOf(obj), MyNumberFormat.prototype);
+
+obj = Reflect.construct(MyNumberFormat, []);
+assertEq(obj instanceof MyNumberFormat, true);
+assertEq(obj instanceof Intl.NumberFormat, true);
+assertEq(Object.getPrototypeOf(obj), MyNumberFormat.prototype);
+
+obj = Reflect.construct(MyNumberFormat, [], MyNumberFormat);
+assertEq(obj instanceof MyNumberFormat, true);
+assertEq(obj instanceof Intl.NumberFormat, true);
+assertEq(Object.getPrototypeOf(obj), MyNumberFormat.prototype);
+
+obj = Reflect.construct(MyNumberFormat, [], Intl.NumberFormat);
+assertEq(obj instanceof MyNumberFormat, false);
+assertEq(obj instanceof Intl.NumberFormat, true);
+assertEq(Object.getPrototypeOf(obj), Intl.NumberFormat.prototype);
+
+
+// Set a different constructor as NewTarget.
+obj = Reflect.construct(MyNumberFormat, [], Array);
+assertEq(obj instanceof MyNumberFormat, false);
+assertEq(obj instanceof Intl.NumberFormat, false);
+assertEq(obj instanceof Array, true);
+assertEq(Object.getPrototypeOf(obj), Array.prototype);
+
+obj = Reflect.construct(Intl.NumberFormat, [], Array);
+assertEq(obj instanceof Intl.NumberFormat, false);
+assertEq(obj instanceof Array, true);
+assertEq(Object.getPrototypeOf(obj), Array.prototype);
+
+
+// The prototype defaults to %NumberFormatPrototype% if null.
+function NewTargetNullPrototype() {}
+NewTargetNullPrototype.prototype = null;
+
+obj = Reflect.construct(Intl.NumberFormat, [], NewTargetNullPrototype);
+assertEq(obj instanceof Intl.NumberFormat, true);
+assertEq(Object.getPrototypeOf(obj), Intl.NumberFormat.prototype);
+
+obj = Reflect.construct(MyNumberFormat, [], NewTargetNullPrototype);
+assertEq(obj instanceof MyNumberFormat, false);
+assertEq(obj instanceof Intl.NumberFormat, true);
+assertEq(Object.getPrototypeOf(obj), Intl.NumberFormat.prototype);
+
+
+// "prototype" property is retrieved exactly once.
+var trapLog = [], getLog = [];
+var ProxiedConstructor = new Proxy(Intl.NumberFormat, new Proxy({
+ get(target, propertyKey, receiver) {
+ getLog.push(propertyKey);
+ return Reflect.get(target, propertyKey, receiver);
+ }
+}, {
+ get(target, propertyKey, receiver) {
+ trapLog.push(propertyKey);
+ return Reflect.get(target, propertyKey, receiver);
+ }
+}));
+
+obj = Reflect.construct(Intl.NumberFormat, [], ProxiedConstructor);
+assertEqArray(trapLog, ["get"]);
+assertEqArray(getLog, ["prototype"]);
+assertEq(obj instanceof Intl.NumberFormat, true);
+assertEq(Object.getPrototypeOf(obj), Intl.NumberFormat.prototype);
+
+
+if (typeof reportCompare === "function")
+ reportCompare(0, 0);
diff --git a/js/src/tests/Intl/PluralRules/resolvedOptions-overridden-species.js b/js/src/tests/Intl/PluralRules/resolvedOptions-overridden-species.js
deleted file mode 100644
index f5f5b62a8b..0000000000
--- a/js/src/tests/Intl/PluralRules/resolvedOptions-overridden-species.js
+++ /dev/null
@@ -1,27 +0,0 @@
-// |reftest| skip-if(!this.hasOwnProperty("Intl")||!this.hasOwnProperty("addIntlExtras"))
-
-// Tests the PluralRules.resolvedOptions function for overriden Array[Symbol.species].
-
-addIntlExtras(Intl);
-
-var pl = new Intl.PluralRules("de");
-
-Object.defineProperty(Array, Symbol.species, {
- value: function() {
- return new Proxy(["?"], {
- get(t, pk, r) {
- return Reflect.get(t, pk, r);
- },
- defineProperty(t, pk) {
- return true;
- }
- });
- }
-});
-
-var pluralCategories = pl.resolvedOptions().pluralCategories;
-
-assertEqArray(pluralCategories, ["one", "other"]);
-
-if (typeof reportCompare === "function")
- reportCompare(0, 0);
diff --git a/js/src/tests/Intl/getCanonicalLocales-overridden-species.js b/js/src/tests/Intl/getCanonicalLocales-overridden-species.js
deleted file mode 100644
index 858735b581..0000000000
--- a/js/src/tests/Intl/getCanonicalLocales-overridden-species.js
+++ /dev/null
@@ -1,23 +0,0 @@
-// |reftest| skip-if(!this.hasOwnProperty("Intl"))
-
-// Tests the getCanonicalLocales function for overriden Array[Symbol.species].
-
-Object.defineProperty(Array, Symbol.species, {
- value: function() {
- return new Proxy(["?"], {
- get(t, pk, r) {
- return Reflect.get(t, pk, r);
- },
- defineProperty(t, pk) {
- return true;
- }
- });
- }
-});
-
-var arr = Intl.getCanonicalLocales("de-x-private");
-
-assertEqArray(arr, ["de-x-private"]);
-
-if (typeof reportCompare === "function")
- reportCompare(0, 0);
diff --git a/js/src/tests/Intl/getDisplayNames.js b/js/src/tests/Intl/getDisplayNames.js
new file mode 100644
index 0000000000..ad2dbc9408
--- /dev/null
+++ b/js/src/tests/Intl/getDisplayNames.js
@@ -0,0 +1,238 @@
+// |reftest| skip-if(!this.hasOwnProperty('Intl')||!this.hasOwnProperty('addIntlExtras'))
+/* 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/. */
+
+// Tests the getCalendarInfo function with a diverse set of arguments.
+
+/*
+ * Test if getDisplayNames return value matches expected values.
+ */
+function checkDisplayNames(names, expected)
+{
+ assertEq(Object.getPrototypeOf(names), Object.prototype);
+
+ assertEq(names.locale, expected.locale);
+ assertEq(names.style, expected.style);
+
+ const nameValues = names.values;
+ const expectedValues = expected.values;
+
+ const nameValuesKeys = Object.getOwnPropertyNames(nameValues).sort();
+ const expectedValuesKeys = Object.getOwnPropertyNames(expectedValues).sort();
+
+ assertEqArray(nameValuesKeys, expectedValuesKeys);
+
+ for (let key of expectedValuesKeys)
+ assertEq(nameValues[key], expectedValues[key]);
+}
+
+addIntlExtras(Intl);
+
+let gDN = Intl.getDisplayNames;
+
+assertEq(gDN.length, 2);
+
+checkDisplayNames(gDN('en-US', {
+}), {
+ locale: 'en-US',
+ style: 'long',
+ values: {}
+});
+
+checkDisplayNames(gDN('en-US', {
+ keys: [
+ 'dates/gregorian/weekdays/wednesday'
+ ],
+ style: 'narrow'
+}), {
+ locale: 'en-US',
+ style: 'narrow',
+ values: {
+ 'dates/gregorian/weekdays/wednesday': 'W'
+ }
+});
+
+checkDisplayNames(gDN('en-US', {
+ keys: [
+ 'dates/fields/year',
+ 'dates/fields/month',
+ 'dates/fields/week',
+ 'dates/fields/day',
+ 'dates/gregorian/months/january',
+ 'dates/gregorian/months/february',
+ 'dates/gregorian/months/march',
+ 'dates/gregorian/weekdays/tuesday'
+ ]
+}), {
+ locale: 'en-US',
+ style: 'long',
+ values: {
+ 'dates/fields/year': 'year',
+ 'dates/fields/month': 'month',
+ 'dates/fields/week': 'week',
+ 'dates/fields/day': 'day',
+ 'dates/gregorian/months/january': 'January',
+ 'dates/gregorian/months/february': 'February',
+ 'dates/gregorian/months/march': 'March',
+ 'dates/gregorian/weekdays/tuesday': 'Tuesday',
+ }
+});
+
+checkDisplayNames(gDN('fr', {
+ keys: [
+ 'dates/fields/year',
+ 'dates/fields/day',
+ 'dates/gregorian/months/october',
+ 'dates/gregorian/weekdays/saturday',
+ 'dates/gregorian/dayperiods/pm'
+ ]
+}), {
+ locale: 'fr',
+ style: 'long',
+ values: {
+ 'dates/fields/year': 'année',
+ 'dates/fields/day': 'jour',
+ 'dates/gregorian/months/october': 'octobre',
+ 'dates/gregorian/weekdays/saturday': 'samedi',
+ 'dates/gregorian/dayperiods/pm': 'PM'
+ }
+});
+
+checkDisplayNames(gDN('it', {
+ style: 'short',
+ keys: [
+ 'dates/gregorian/weekdays/thursday',
+ 'dates/gregorian/months/august',
+ 'dates/gregorian/dayperiods/am',
+ 'dates/fields/month',
+ ]
+}), {
+ locale: 'it',
+ style: 'short',
+ values: {
+ 'dates/gregorian/weekdays/thursday': 'gio',
+ 'dates/gregorian/months/august': 'ago',
+ 'dates/gregorian/dayperiods/am': 'AM',
+ 'dates/fields/month': 'mese'
+ }
+});
+
+checkDisplayNames(gDN('ar', {
+ style: 'long',
+ keys: [
+ 'dates/gregorian/weekdays/thursday',
+ 'dates/gregorian/months/august',
+ 'dates/gregorian/dayperiods/am',
+ 'dates/fields/month',
+ ]
+}), {
+ locale: 'ar',
+ style: 'long',
+ values: {
+ 'dates/gregorian/weekdays/thursday': 'الخميس',
+ 'dates/gregorian/months/august': 'أغسطس',
+ 'dates/gregorian/dayperiods/am': 'ص',
+ 'dates/fields/month': 'الشهر'
+ }
+});
+
+/* Invalid input */
+
+assertThrowsInstanceOf(() => {
+ gDN('en-US', {
+ style: '',
+ keys: [
+ 'dates/gregorian/weekdays/thursday',
+ ]
+ });
+}, RangeError);
+
+assertThrowsInstanceOf(() => {
+ gDN('en-US', {
+ style: 'bogus',
+ keys: [
+ 'dates/gregorian/weekdays/thursday',
+ ]
+ });
+}, RangeError);
+
+assertThrowsInstanceOf(() => {
+ gDN('foo-X', {
+ keys: [
+ 'dates/gregorian/weekdays/thursday',
+ ]
+ });
+}, RangeError);
+
+const typeErrorKeys = [
+ null,
+ 'string',
+ Symbol.iterator,
+ 15,
+ 1,
+ 3.7,
+ NaN,
+ Infinity
+];
+
+for (let keys of typeErrorKeys) {
+ assertThrowsInstanceOf(() => {
+ gDN('en-US', {
+ keys
+ });
+ }, TypeError);
+}
+
+const rangeErrorKeys = [
+ [''],
+ ['foo'],
+ ['dates/foo'],
+ ['/dates/foo'],
+ ['dates/foo/foo'],
+ ['dates/fields'],
+ ['dates/fields/'],
+ ['dates/fields/foo'],
+ ['dates/fields/foo/month'],
+ ['/dates/foo/faa/bar/baz'],
+ ['dates///bar/baz'],
+ ['dates/gregorian'],
+ ['dates/gregorian/'],
+ ['dates/gregorian/foo'],
+ ['dates/gregorian/months'],
+ ['dates/gregorian/months/foo'],
+ ['dates/gregorian/weekdays'],
+ ['dates/gregorian/weekdays/foo'],
+ ['dates/gregorian/dayperiods'],
+ ['dates/gregorian/dayperiods/foo'],
+ ['dates/gregorian/months/الشهر'],
+ [3],
+ [null],
+ ['d', 'a', 't', 'e', 's'],
+ ['datesEXTRA'],
+ ['dates/fieldsEXTRA'],
+ ['dates/gregorianEXTRA'],
+ ['dates/gregorian/monthsEXTRA'],
+ ['dates/gregorian/weekdaysEXTRA'],
+ ['dates/fields/dayperiods/amEXTRA'],
+ ['dates/gregori\u1161n/months/january'],
+ ["dates/fields/year/"],
+ ["dates/fields/month/"],
+ ["dates/fields/week/"],
+ ["dates/fields/day/"],
+ ["dates/gregorian/months/january/"],
+ ["dates/gregorian/weekdays/saturday/"],
+ ["dates/gregorian/dayperiods/am/"],
+ ["dates/fields/months/january/"],
+];
+
+for (let keys of rangeErrorKeys) {
+ assertThrowsInstanceOf(() => {
+ gDN('en-US', {
+ keys
+ });
+ }, RangeError);
+}
+
+if (typeof reportCompare === 'function')
+ reportCompare(0, 0);
diff --git a/js/src/tests/ecma_2017/AsyncFunctions/construct-newtarget.js b/js/src/tests/ecma_2017/AsyncFunctions/construct-newtarget.js
new file mode 100644
index 0000000000..7d75d0c939
--- /dev/null
+++ b/js/src/tests/ecma_2017/AsyncFunctions/construct-newtarget.js
@@ -0,0 +1,79 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+const AsyncFunction = async function(){}.constructor;
+
+
+// Test subclassing %AsyncFunction% works correctly.
+class MyAsync extends AsyncFunction {}
+
+var fn = new MyAsync();
+assertEq(fn instanceof MyAsync, true);
+assertEq(fn instanceof AsyncFunction, true);
+assertEq(Object.getPrototypeOf(fn), MyAsync.prototype);
+
+fn = Reflect.construct(MyAsync, []);
+assertEq(fn instanceof MyAsync, true);
+assertEq(fn instanceof AsyncFunction, true);
+assertEq(Object.getPrototypeOf(fn), MyAsync.prototype);
+
+fn = Reflect.construct(MyAsync, [], MyAsync);
+assertEq(fn instanceof MyAsync, true);
+assertEq(fn instanceof AsyncFunction, true);
+assertEq(Object.getPrototypeOf(fn), MyAsync.prototype);
+
+fn = Reflect.construct(MyAsync, [], AsyncFunction);
+assertEq(fn instanceof MyAsync, false);
+assertEq(fn instanceof AsyncFunction, true);
+assertEq(Object.getPrototypeOf(fn), AsyncFunction.prototype);
+
+
+// Set a different constructor as NewTarget.
+fn = Reflect.construct(MyAsync, [], Array);
+assertEq(fn instanceof MyAsync, false);
+assertEq(fn instanceof AsyncFunction, false);
+assertEq(Object.getPrototypeOf(fn), Array.prototype);
+
+fn = Reflect.construct(AsyncFunction, [], Array);
+assertEq(fn instanceof AsyncFunction, false);
+assertEq(Object.getPrototypeOf(fn), Array.prototype);
+
+
+// The prototype defaults to %AsyncFunctionPrototype% if null.
+function NewTargetNullPrototype() {}
+NewTargetNullPrototype.prototype = null;
+
+fn = Reflect.construct(AsyncFunction, [], NewTargetNullPrototype);
+assertEq(fn instanceof AsyncFunction, true);
+assertEq(Object.getPrototypeOf(fn), AsyncFunction.prototype);
+
+fn = Reflect.construct(MyAsync, [], NewTargetNullPrototype);
+assertEq(fn instanceof MyAsync, false);
+assertEq(fn instanceof AsyncFunction, true);
+assertEq(Object.getPrototypeOf(fn), AsyncFunction.prototype);
+
+
+// "prototype" property is retrieved exactly once.
+var trapLog = [], getLog = [];
+var ProxiedConstructor = new Proxy(AsyncFunction, new Proxy({
+ get(target, propertyKey, receiver) {
+ getLog.push(propertyKey);
+ return Reflect.get(target, propertyKey, receiver);
+ }
+}, {
+ get(target, propertyKey, receiver) {
+ trapLog.push(propertyKey);
+ return Reflect.get(target, propertyKey, receiver);
+ }
+}));
+
+fn = Reflect.construct(AsyncFunction, [], ProxiedConstructor);
+assertEqArray(trapLog, ["get"]);
+assertEqArray(getLog, ["prototype"]);
+assertEq(fn instanceof AsyncFunction, true);
+assertEq(Object.getPrototypeOf(fn), AsyncFunction.prototype);
+
+
+if (typeof reportCompare === "function")
+ reportCompare(0, 0);
diff --git a/js/src/tests/ecma_2017/AsyncFunctions/subclass.js b/js/src/tests/ecma_2017/AsyncFunctions/subclass.js
new file mode 100644
index 0000000000..da20ab19b8
--- /dev/null
+++ b/js/src/tests/ecma_2017/AsyncFunctions/subclass.js
@@ -0,0 +1,31 @@
+// |reftest| skip-if(!xulRuntime.shell) -- needs drainJobQueue
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+const AsyncFunction = async function(){}.constructor;
+
+class MyAsync extends AsyncFunction {}
+
+// MyGen inherits from %AsyncFunction%.
+assertEq(Object.getPrototypeOf(MyAsync), AsyncFunction);
+
+// MyGen.prototype inherits from %AsyncFunctionPrototype%.
+assertEq(Object.getPrototypeOf(MyAsync.prototype), AsyncFunction.prototype);
+
+var fn = new MyAsync("return await 'ok';");
+
+// fn inherits from MyAsync.prototype.
+assertEq(Object.getPrototypeOf(fn), MyAsync.prototype);
+
+// Ensure the new async function can be executed.
+var promise = fn();
+
+// promise inherits from %Promise.prototype%.
+assertEq(Object.getPrototypeOf(promise), Promise.prototype);
+
+// Computes the expected result.
+assertEventuallyEq(promise, "ok");
+
+if (typeof reportCompare === "function")
+ reportCompare(0, 0);
diff --git a/js/src/tests/ecma_2017/lastIndex-exec.js b/js/src/tests/ecma_2017/lastIndex-exec.js
new file mode 100644
index 0000000000..f42facbe34
--- /dev/null
+++ b/js/src/tests/ecma_2017/lastIndex-exec.js
@@ -0,0 +1,80 @@
+// RegExp.prototype.exec: Test lastIndex changes for ES2017.
+
+// Test various combinations of:
+// - Pattern matches or doesn't match
+// - Global and/or sticky flag is set.
+// - lastIndex exceeds the input string length
+// - lastIndex is +-0
+const testCases = [
+ { regExp: /a/, lastIndex: 0, input: "a", result: 0 },
+ { regExp: /a/g, lastIndex: 0, input: "a", result: 1 },
+ { regExp: /a/y, lastIndex: 0, input: "a", result: 1 },
+
+ { regExp: /a/, lastIndex: 0, input: "b", result: 0 },
+ { regExp: /a/g, lastIndex: 0, input: "b", result: 0 },
+ { regExp: /a/y, lastIndex: 0, input: "b", result: 0 },
+
+ { regExp: /a/, lastIndex: -0, input: "a", result: -0 },
+ { regExp: /a/g, lastIndex: -0, input: "a", result: 1 },
+ { regExp: /a/y, lastIndex: -0, input: "a", result: 1 },
+
+ { regExp: /a/, lastIndex: -0, input: "b", result: -0 },
+ { regExp: /a/g, lastIndex: -0, input: "b", result: 0 },
+ { regExp: /a/y, lastIndex: -0, input: "b", result: 0 },
+
+ { regExp: /a/, lastIndex: -1, input: "a", result: -1 },
+ { regExp: /a/g, lastIndex: -1, input: "a", result: 1 },
+ { regExp: /a/y, lastIndex: -1, input: "a", result: 1 },
+
+ { regExp: /a/, lastIndex: -1, input: "b", result: -1 },
+ { regExp: /a/g, lastIndex: -1, input: "b", result: 0 },
+ { regExp: /a/y, lastIndex: -1, input: "b", result: 0 },
+
+ { regExp: /a/, lastIndex: 100, input: "a", result: 100 },
+ { regExp: /a/g, lastIndex: 100, input: "a", result: 0 },
+ { regExp: /a/y, lastIndex: 100, input: "a", result: 0 },
+];
+
+// Basic test.
+for (let {regExp, lastIndex, input, result} of testCases) {
+ let re = new RegExp(regExp);
+ re.lastIndex = lastIndex;
+ re.exec(input);
+ assertEq(re.lastIndex, result);
+}
+
+// Test when lastIndex is non-writable.
+for (let {regExp, lastIndex, input} of testCases) {
+ let re = new RegExp(regExp);
+ Object.defineProperty(re, "lastIndex", { value: lastIndex, writable: false });
+ if (re.global || re.sticky) {
+ assertThrowsInstanceOf(() => re.exec(input), TypeError);
+ } else {
+ re.exec(input);
+ }
+ assertEq(re.lastIndex, lastIndex);
+}
+
+// Test when lastIndex is changed to non-writable as a side-effect.
+for (let {regExp, lastIndex, input} of testCases) {
+ let re = new RegExp(regExp);
+ let called = false;
+ re.lastIndex = {
+ valueOf() {
+ assertEq(called, false);
+ called = true;
+ Object.defineProperty(re, "lastIndex", { value: 9000, writable: false });
+ return lastIndex;
+ }
+ };
+ if (re.global || re.sticky) {
+ assertThrowsInstanceOf(() => re.exec(input), TypeError);
+ } else {
+ re.exec(input);
+ }
+ assertEq(re.lastIndex, 9000);
+ assertEq(called, true);
+}
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
diff --git a/js/src/tests/ecma_2017/lastIndex-match-or-replace.js b/js/src/tests/ecma_2017/lastIndex-match-or-replace.js
new file mode 100644
index 0000000000..b0a8b537ce
--- /dev/null
+++ b/js/src/tests/ecma_2017/lastIndex-match-or-replace.js
@@ -0,0 +1,122 @@
+// RegExp.prototype[Symbol.match, Symbol.replace]: Test lastIndex changes for ES2017.
+
+// RegExp-like class to test the RegExp method slow paths.
+class DuckRegExp extends RegExp {
+ constructor(pattern, flags) {
+ return Object.create(DuckRegExp.prototype, {
+ regExp: {
+ value: new RegExp(pattern, flags)
+ },
+ lastIndex: {
+ value: 0, writable: true, enumerable: false, configurable: false
+ }
+ });
+ }
+
+ exec(...args) {
+ this.regExp.lastIndex = this.lastIndex;
+ try {
+ return this.regExp.exec(...args);
+ } finally {
+ if (this.global || this.sticky)
+ this.lastIndex = this.regExp.lastIndex;
+ }
+ }
+
+ get source() { return this.regExp.source; }
+
+ get global() { return this.regExp.global; }
+ get ignoreCase() { return this.regExp.ignoreCase; }
+ get multiline() { return this.regExp.multiline; }
+ get sticky() { return this.regExp.sticky; }
+ get unicode() { return this.regExp.unicode; }
+}
+
+// Test various combinations of:
+// - Pattern matches or doesn't match
+// - Global and/or sticky flag is set.
+// - lastIndex exceeds the input string length
+// - lastIndex is +-0
+const testCases = [
+ { regExp: /a/, lastIndex: 0, input: "a", result: 0 },
+ { regExp: /a/g, lastIndex: 0, input: "a", result: 0 },
+ { regExp: /a/y, lastIndex: 0, input: "a", result: 1 },
+
+ { regExp: /a/, lastIndex: 0, input: "b", result: 0 },
+ { regExp: /a/g, lastIndex: 0, input: "b", result: 0 },
+ { regExp: /a/y, lastIndex: 0, input: "b", result: 0 },
+
+ { regExp: /a/, lastIndex: -0, input: "a", result: -0 },
+ { regExp: /a/g, lastIndex: -0, input: "a", result: 0 },
+ { regExp: /a/y, lastIndex: -0, input: "a", result: 1 },
+
+ { regExp: /a/, lastIndex: -0, input: "b", result: -0 },
+ { regExp: /a/g, lastIndex: -0, input: "b", result: 0 },
+ { regExp: /a/y, lastIndex: -0, input: "b", result: 0 },
+
+ { regExp: /a/, lastIndex: -1, input: "a", result: -1 },
+ { regExp: /a/g, lastIndex: -1, input: "a", result: 0 },
+ { regExp: /a/y, lastIndex: -1, input: "a", result: 1 },
+
+ { regExp: /a/, lastIndex: -1, input: "b", result: -1 },
+ { regExp: /a/g, lastIndex: -1, input: "b", result: 0 },
+ { regExp: /a/y, lastIndex: -1, input: "b", result: 0 },
+
+ { regExp: /a/, lastIndex: 100, input: "a", result: 100 },
+ { regExp: /a/g, lastIndex: 100, input: "a", result: 0 },
+ { regExp: /a/y, lastIndex: 100, input: "a", result: 0 },
+];
+
+for (let method of [RegExp.prototype[Symbol.match], RegExp.prototype[Symbol.replace]]) {
+ for (let Constructor of [RegExp, DuckRegExp]) {
+ // Basic test.
+ for (let {regExp, lastIndex, input, result} of testCases) {
+ let re = new Constructor(regExp);
+ re.lastIndex = lastIndex;
+ Reflect.apply(method, re, [input]);
+ assertEq(re.lastIndex, result);
+ }
+
+ // Test when lastIndex is non-writable.
+ for (let {regExp, lastIndex, input} of testCases) {
+ let re = new Constructor(regExp);
+ Object.defineProperty(re, "lastIndex", { value: lastIndex, writable: false });
+ if (re.global || re.sticky) {
+ assertThrowsInstanceOf(() => Reflect.apply(method, re, [input]), TypeError);
+ } else {
+ Reflect.apply(method, re, [input]);
+ }
+ assertEq(re.lastIndex, lastIndex);
+ }
+
+ // Test when lastIndex is changed to non-writable as a side-effect.
+ for (let {regExp, lastIndex, input, result} of testCases) {
+ let re = new Constructor(regExp);
+ let called = false;
+ re.lastIndex = {
+ valueOf() {
+ assertEq(called, false);
+ called = true;
+ Object.defineProperty(re, "lastIndex", { value: 9000, writable: false });
+ return lastIndex;
+ }
+ };
+ if (re.sticky) {
+ assertThrowsInstanceOf(() => Reflect.apply(method, re, [input]), TypeError);
+ assertEq(called, true);
+ assertEq(re.lastIndex, 9000);
+ } else if (re.global) {
+ Reflect.apply(method, re, [input]);
+ assertEq(called, false);
+ assertEq(re.lastIndex, result);
+ } else {
+ Reflect.apply(method, re, [input]);
+ assertEq(called, true);
+ assertEq(re.lastIndex, 9000);
+ }
+ }
+ }
+}
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
diff --git a/js/src/tests/ecma_2017/lastIndex-search.js b/js/src/tests/ecma_2017/lastIndex-search.js
new file mode 100644
index 0000000000..5953b3a885
--- /dev/null
+++ b/js/src/tests/ecma_2017/lastIndex-search.js
@@ -0,0 +1,118 @@
+// RegExp.prototype[Symbol.search]: Test lastIndex changes for ES2017.
+
+// RegExp-like class to test the RegExp method slow paths.
+class DuckRegExp extends RegExp {
+ constructor(pattern, flags) {
+ return Object.create(DuckRegExp.prototype, {
+ regExp: {
+ value: new RegExp(pattern, flags)
+ },
+ lastIndex: {
+ value: 0, writable: true, enumerable: false, configurable: false
+ }
+ });
+ }
+
+ exec(...args) {
+ this.regExp.lastIndex = this.lastIndex;
+ try {
+ return this.regExp.exec(...args);
+ } finally {
+ if (this.global || this.sticky)
+ this.lastIndex = this.regExp.lastIndex;
+ }
+ }
+
+ get source() { return this.regExp.source; }
+
+ get global() { return this.regExp.global; }
+ get ignoreCase() { return this.regExp.ignoreCase; }
+ get multiline() { return this.regExp.multiline; }
+ get sticky() { return this.regExp.sticky; }
+ get unicode() { return this.regExp.unicode; }
+}
+
+// Test various combinations of:
+// - Pattern matches or doesn't match
+// - Global and/or sticky flag is set.
+// - lastIndex exceeds the input string length
+// - lastIndex is +-0
+const testCasesNotPositiveZero = [
+ { regExp: /a/, lastIndex: -1, input: "a" },
+ { regExp: /a/g, lastIndex: -1, input: "a" },
+ { regExp: /a/y, lastIndex: -1, input: "a" },
+
+ { regExp: /a/, lastIndex: 100, input: "a" },
+ { regExp: /a/g, lastIndex: 100, input: "a" },
+ { regExp: /a/y, lastIndex: 100, input: "a" },
+
+ { regExp: /a/, lastIndex: -1, input: "b" },
+ { regExp: /a/g, lastIndex: -1, input: "b" },
+ { regExp: /a/y, lastIndex: -1, input: "b" },
+
+ { regExp: /a/, lastIndex: -0, input: "a" },
+ { regExp: /a/g, lastIndex: -0, input: "a" },
+ { regExp: /a/y, lastIndex: -0, input: "a" },
+
+ { regExp: /a/, lastIndex: -0, input: "b" },
+ { regExp: /a/g, lastIndex: -0, input: "b" },
+ { regExp: /a/y, lastIndex: -0, input: "b" },
+];
+
+const testCasesPositiveZero = [
+ { regExp: /a/, lastIndex: 0, input: "a" },
+ { regExp: /a/g, lastIndex: 0, input: "a" },
+ { regExp: /a/y, lastIndex: 0, input: "a" },
+
+ { regExp: /a/, lastIndex: 0, input: "b" },
+ { regExp: /a/g, lastIndex: 0, input: "b" },
+ { regExp: /a/y, lastIndex: 0, input: "b" },
+];
+
+const testCases = [...testCasesNotPositiveZero, ...testCasesPositiveZero];
+
+for (let Constructor of [RegExp, DuckRegExp]) {
+ // Basic test.
+ for (let {regExp, lastIndex, input} of testCases) {
+ let re = new Constructor(regExp);
+ re.lastIndex = lastIndex;
+ re[Symbol.search](input);
+ assertEq(re.lastIndex, lastIndex);
+ }
+
+ // Test when lastIndex is non-writable and not positive zero.
+ for (let {regExp, lastIndex, input} of testCasesNotPositiveZero) {
+ let re = new Constructor(regExp);
+ Object.defineProperty(re, "lastIndex", { value: lastIndex, writable: false });
+ assertThrowsInstanceOf(() => re[Symbol.search](input), TypeError);
+ assertEq(re.lastIndex, lastIndex);
+ }
+
+ // Test when lastIndex is non-writable and positive zero.
+ for (let {regExp, lastIndex, input} of testCasesPositiveZero) {
+ let re = new Constructor(regExp);
+ Object.defineProperty(re, "lastIndex", { value: lastIndex, writable: false });
+ if (re.global || re.sticky) {
+ assertThrowsInstanceOf(() => re[Symbol.search](input), TypeError);
+ } else {
+ re[Symbol.search](input);
+ }
+ assertEq(re.lastIndex, lastIndex);
+ }
+
+ // Test lastIndex isn't converted to a number.
+ for (let {regExp, lastIndex, input} of testCases) {
+ let re = new RegExp(regExp);
+ let badIndex = {
+ valueOf() {
+ assertEq(false, true);
+ }
+ };
+ re.lastIndex = badIndex;
+ re[Symbol.search](input);
+ assertEq(re.lastIndex, badIndex);
+ }
+}
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
diff --git a/js/src/tests/ecma_3/String/15.5.4.11.js b/js/src/tests/ecma_3/String/15.5.4.11.js
index 0fd6caaf47..a5515286a0 100644
--- a/js/src/tests/ecma_3/String/15.5.4.11.js
+++ b/js/src/tests/ecma_3/String/15.5.4.11.js
@@ -157,7 +157,7 @@ reportCompare(
rex = /y/, rex.lastIndex = 1;
reportCompare(
- "xxx0",
+ "xxx1",
"xxx".replace(rex, "y") + rex.lastIndex,
"Section 25"
);
diff --git a/js/src/tests/ecma_5/Function/arguments-caller-callee.js b/js/src/tests/ecma_5/Function/arguments-caller-callee.js
index 3eda27b492..57efd9eb91 100644
--- a/js/src/tests/ecma_5/Function/arguments-caller-callee.js
+++ b/js/src/tests/ecma_5/Function/arguments-caller-callee.js
@@ -5,7 +5,8 @@
var gTestfile = 'arguments-caller-callee.js';
var BUGNUMBER = 514563;
-var summary = "arguments.caller and arguments.callee are poison pills in ES5";
+var summary = "arguments.caller and arguments.callee are poison pills in ES5, " +
+ "later changed in ES2017 to only poison pill arguments.callee.";
print(BUGNUMBER + ": " + summary);
@@ -31,7 +32,7 @@ function expectTypeError(fun)
}
function bar() { "use strict"; return arguments; }
-expectTypeError(function barCaller() { bar().caller; });
+assertEq(bar().caller, undefined); // No error when accessing arguments.caller in ES2017+
expectTypeError(function barCallee() { bar().callee; });
function baz() { return arguments; }
@@ -41,15 +42,12 @@ assertEq(baz().callee, baz);
// accessor identity
function strictMode() { "use strict"; return arguments; }
-var canonicalTTE = Object.getOwnPropertyDescriptor(strictMode(), "caller").get;
+var canonicalTTE = Object.getOwnPropertyDescriptor(strictMode(), "callee").get;
var args = strictMode();
var argsCaller = Object.getOwnPropertyDescriptor(args, "caller");
-assertEq("get" in argsCaller, true);
-assertEq("set" in argsCaller, true);
-assertEq(argsCaller.get, canonicalTTE);
-assertEq(argsCaller.set, canonicalTTE);
+assertEq(argsCaller, undefined);
var argsCallee = Object.getOwnPropertyDescriptor(args, "callee");
assertEq("get" in argsCallee, true);
diff --git a/js/src/tests/ecma_5/Function/arguments-property-attributes.js b/js/src/tests/ecma_5/Function/arguments-property-attributes.js
index 994b97ca41..f50c1e6dad 100644
--- a/js/src/tests/ecma_5/Function/arguments-property-attributes.js
+++ b/js/src/tests/ecma_5/Function/arguments-property-attributes.js
@@ -56,7 +56,7 @@ var sa = strictArgs(0, 1);
var strictArgProps = Object.getOwnPropertyNames(sa).sort();
assertEq(strictArgProps.indexOf("callee") >= 0, true);
-assertEq(strictArgProps.indexOf("caller") >= 0, true);
+assertEq(strictArgProps.indexOf("caller") >= 0, false);
assertEq(strictArgProps.indexOf("0") >= 0, true);
assertEq(strictArgProps.indexOf("1") >= 0, true);
assertEq(strictArgProps.indexOf("length") >= 0, true);
@@ -69,11 +69,7 @@ assertEq(strictCalleeDesc.enumerable, false);
assertEq(strictCalleeDesc.configurable, false);
var strictCallerDesc = Object.getOwnPropertyDescriptor(sa, "caller");
-assertEq(typeof strictCallerDesc.get, "function");
-assertEq(typeof strictCallerDesc.set, "function");
-assertEq(strictCallerDesc.get, strictCallerDesc.set);
-assertEq(strictCallerDesc.enumerable, false);
-assertEq(strictCallerDesc.configurable, false);
+assertEq(strictCallerDesc, undefined);
var strictZeroDesc = Object.getOwnPropertyDescriptor(sa, "0");
assertEq(strictZeroDesc.value, 0);
diff --git a/js/src/tests/ecma_5/RegExp/exec.js b/js/src/tests/ecma_5/RegExp/exec.js
index 411f348d91..4284b6e014 100644
--- a/js/src/tests/ecma_5/RegExp/exec.js
+++ b/js/src/tests/ecma_5/RegExp/exec.js
@@ -165,7 +165,7 @@ r = /abc/;
r.lastIndex = -17;
res = r.exec("cdefg");
assertEq(res, null);
-assertEq(r.lastIndex, 0);
+assertEq(r.lastIndex, -17);
r = /abc/g;
r.lastIndex = -42;
diff --git a/js/src/tests/ecma_5/RegExp/instance-property-storage-introspection.js b/js/src/tests/ecma_5/RegExp/instance-property-storage-introspection.js
index 1f7c7042f0..998d25e2c0 100644
--- a/js/src/tests/ecma_5/RegExp/instance-property-storage-introspection.js
+++ b/js/src/tests/ecma_5/RegExp/instance-property-storage-introspection.js
@@ -40,9 +40,7 @@ function checkDataProperty(obj, p, expect, msg)
// Check a bunch of "empty" regular expressions first.
-var choices = [{ msg: "RegExp.prototype",
- get: function() { return RegExp.prototype; } },
- { msg: "new RegExp()",
+var choices = [{ msg: "new RegExp()",
get: function() { return new RegExp(); } },
{ msg: "/(?:)/",
get: Function("return /(?:)/;") }];
@@ -55,7 +53,6 @@ function checkRegExp(r, msg, lastIndex)
checkDataProperty(r, "lastIndex", expect, msg);
}
-checkRegExp(RegExp.prototype, "RegExp.prototype", 0);
checkRegExp(new RegExp(), "new RegExp()", 0);
checkRegExp(/(?:)/, "/(?:)/", 0);
checkRegExp(Function("return /(?:)/;")(), 'Function("return /(?:)/;")()', 0);
diff --git a/js/src/tests/ecma_5/extensions/error-tostring-function.js b/js/src/tests/ecma_5/extensions/error-tostring-function.js
index 5e92f1075a..86751c39d8 100644
--- a/js/src/tests/ecma_5/extensions/error-tostring-function.js
+++ b/js/src/tests/ecma_5/extensions/error-tostring-function.js
@@ -27,7 +27,7 @@ assertEq(ErrorToString(function(){}), "");
var fn1 = function() {};
fn1.message = "ohai";
-assertEq(ErrorToString(fn1), "ohai");
+assertEq(ErrorToString(fn1), "fn1: ohai");
var fn2 = function blerch() {};
fn2.message = "fnord";
@@ -35,7 +35,7 @@ assertEq(ErrorToString(fn2), "blerch: fnord");
var fn3 = function() {};
fn3.message = "";
-assertEq(ErrorToString(fn3), "");
+assertEq(ErrorToString(fn3), "fn3");
/******************************************************************************/
diff --git a/js/src/tests/ecma_6/Array/from-iterator-close.js b/js/src/tests/ecma_6/Array/from-iterator-close.js
new file mode 100644
index 0000000000..fa97ea282a
--- /dev/null
+++ b/js/src/tests/ecma_6/Array/from-iterator-close.js
@@ -0,0 +1,183 @@
+var BUGNUMBER = 1180306;
+var summary = 'Array.from should close iterator on error';
+
+print(BUGNUMBER + ": " + summary);
+
+function test(ctor, { mapVal=undefined,
+ nextVal=undefined,
+ nextThrowVal=undefined,
+ modifier=undefined,
+ exceptionVal=undefined,
+ exceptionType=undefined,
+ closed=true }) {
+ let iterable = {
+ closed: false,
+ [Symbol.iterator]() {
+ let iterator = {
+ first: true,
+ next() {
+ if (this.first) {
+ this.first = false;
+ if (nextThrowVal)
+ throw nextThrowVal;
+ return nextVal;
+ }
+ return { value: undefined, done: true };
+ },
+ return() {
+ iterable.closed = true;
+ return {};
+ }
+ };
+ if (modifier)
+ modifier(iterator, iterable);
+
+ return iterator;
+ }
+ };
+ if (exceptionVal) {
+ let caught = false;
+ try {
+ ctor.from(iterable, mapVal);
+ } catch (e) {
+ assertEq(e, exceptionVal);
+ caught = true;
+ }
+ assertEq(caught, true);
+ } else if (exceptionType) {
+ assertThrowsInstanceOf(() => ctor.from(iterable, mapVal), exceptionType);
+ } else {
+ ctor.from(iterable, mapVal);
+ }
+ assertEq(iterable.closed, closed);
+}
+
+// == Error cases with close ==
+
+// ES 2017 draft 22.1.2.1 step 5.e.i.1.
+// Cannot test.
+
+// ES 2017 draft 22.1.2.1 step 5.e.vi.2.
+test(Array, {
+ mapVal: () => { throw "map throws"; },
+ nextVal: { value: 1, done: false },
+ exceptionVal: "map throws",
+ closed: true,
+});
+
+// ES 2017 draft 22.1.2.1 step 5.e.ix.
+class MyArray extends Array {
+ constructor() {
+ return new Proxy({}, {
+ defineProperty() {
+ throw "defineProperty throws";
+ }
+ });
+ }
+}
+test(MyArray, {
+ nextVal: { value: 1, done: false },
+ exceptionVal: "defineProperty throws",
+ closed: true,
+});
+
+// ES 2017 draft 7.4.6 step 3.
+// if GetMethod fails, the thrown value should be used.
+test(MyArray, {
+ nextVal: { value: 1, done: false },
+ modifier: (iterator, iterable) => {
+ Object.defineProperty(iterator, "return", {
+ get: function() {
+ iterable.closed = true;
+ throw "return getter throws";
+ }
+ });
+ },
+ exceptionVal: "return getter throws",
+ closed: true,
+});
+test(MyArray, {
+ nextVal: { value: 1, done: false },
+ modifier: (iterator, iterable) => {
+ Object.defineProperty(iterator, "return", {
+ get: function() {
+ iterable.closed = true;
+ return "non object";
+ }
+ });
+ },
+ exceptionType: TypeError,
+ closed: true,
+});
+test(MyArray, {
+ nextVal: { value: 1, done: false },
+ modifier: (iterator, iterable) => {
+ Object.defineProperty(iterator, "return", {
+ get: function() {
+ iterable.closed = true;
+ // Non callable.
+ return {};
+ }
+ });
+ },
+ exceptionType: TypeError,
+ closed: true,
+});
+
+// ES 2017 draft 7.4.6 steps 6.
+// if return method throws, the thrown value should be ignored.
+test(MyArray, {
+ nextVal: { value: 1, done: false },
+ modifier: (iterator, iterable) => {
+ iterator.return = function() {
+ iterable.closed = true;
+ throw "return throws";
+ };
+ },
+ exceptionVal: "defineProperty throws",
+ closed: true,
+});
+
+test(MyArray, {
+ nextVal: { value: 1, done: false },
+ modifier: (iterator, iterable) => {
+ iterator.return = function() {
+ iterable.closed = true;
+ return "non object";
+ };
+ },
+ exceptionVal: "defineProperty throws",
+ closed: true,
+});
+
+// == Error cases without close ==
+
+// ES 2017 draft 22.1.2.1 step 5.e.iii.
+test(Array, {
+ nextThrowVal: "next throws",
+ exceptionVal: "next throws",
+ closed: false,
+});
+
+test(Array, {
+ nextVal: { value: {}, get done() { throw "done getter throws"; } },
+ exceptionVal: "done getter throws",
+ closed: false,
+});
+
+// ES 2017 draft 22.1.2.1 step 5.e.v.
+test(Array, {
+ nextVal: { get value() { throw "value getter throws"; }, done: false },
+ exceptionVal: "value getter throws",
+ closed: false,
+});
+
+// == Successful cases ==
+
+test(Array, {
+ nextVal: { value: 1, done: false },
+ closed: false,
+});
+
+if (typeof reportCompare === 'function')
+ reportCompare(true, true);
diff --git a/js/src/tests/ecma_6/Class/className.js b/js/src/tests/ecma_6/Class/className.js
index a33397a8a3..ad3920c151 100644
--- a/js/src/tests/ecma_6/Class/className.js
+++ b/js/src/tests/ecma_6/Class/className.js
@@ -174,27 +174,29 @@ testName(ExtendedExpr3, "base", false, false, false);
// Anonymous class expressions don't get name properties unless specified in a
// static manner.
-let Anon = class {
+// Use property assignment to avoid setting name property.
+let tmp = {};
+let Anon = tmp.value = class {
constructor() {}
};
testName(Anon, "", false, false, false);
-let AnonDefault = class { };
+let AnonDefault = tmp.value = class { };
testName(AnonDefault, "", false, false, false);
-let AnonWithGetter = class {
+let AnonWithGetter = tmp.value = class {
constructor() {}
static get name() { return "base"; }
};
testName(AnonWithGetter, "base", false, true, false);
-let AnonWithSetter = class {
+let AnonWithSetter = tmp.value = class {
constructor() {}
static set name(v) {}
};
testName(AnonWithSetter, undefined, false, false, true);
-let AnonWithGetterSetter = class {
+let AnonWithGetterSetter = tmp.value = class {
constructor() {}
static get name() { return "base"; }
static set name(v) {}
@@ -202,15 +204,15 @@ let AnonWithGetterSetter = class {
testName(AnonWithGetterSetter, "base", false, true, true);
-let ExtendedAnon1 = class extends Anon {
+let ExtendedAnon1 = tmp.value = class extends Anon {
constructor() {}
};
testName(ExtendedAnon1, "", false, false, false);
-let ExtendedAnonDefault = class extends Anon { };
+let ExtendedAnonDefault = tmp.value = class extends Anon { };
testName(ExtendedAnonDefault, "", false, false, false);
-let ExtendedAnon2 = class extends AnonWithGetterSetter {
+let ExtendedAnon2 = tmp.value = class extends AnonWithGetterSetter {
constructor() {}
static get name() { return "extend"; }
};
@@ -218,7 +220,7 @@ testName(ExtendedAnon2, "extend", false, true, false);
delete ExtendedAnon2.name;
testName(ExtendedAnon2, "base", false, false, false);
-let ExtendedAnon3 = class extends AnonWithGetterSetter {
+let ExtendedAnon3 = tmp.value = class extends AnonWithGetterSetter {
constructor() {}
static set name(v) {}
};
diff --git a/js/src/tests/ecma_6/Destructuring/array-default-class.js b/js/src/tests/ecma_6/Destructuring/array-default-class.js
new file mode 100644
index 0000000000..5aa9c579b1
--- /dev/null
+++ b/js/src/tests/ecma_6/Destructuring/array-default-class.js
@@ -0,0 +1,25 @@
+var BUGNUMBER = 1322314;
+var summary = "Function in computed property in class expression in array destructuring default";
+
+print(BUGNUMBER + ": " + summary);
+
+function* g([
+ a = class E {
+ [ (function() { return "foo"; })() ]() {
+ return 10;
+ }
+ }
+]) {
+ yield a;
+}
+
+let C = [...g([])][0];
+let x = new C();
+assertEq(x.foo(), 10);
+
+C = [...g([undefined])][0];
+x = new C();
+assertEq(x.foo(), 10);
+
+if (typeof reportCompare === "function")
+ reportCompare(0, 0);
diff --git a/js/src/tests/ecma_6/Destructuring/array-iterator-close.js b/js/src/tests/ecma_6/Destructuring/array-iterator-close.js
new file mode 100644
index 0000000000..ed35135dba
--- /dev/null
+++ b/js/src/tests/ecma_6/Destructuring/array-iterator-close.js
@@ -0,0 +1,93 @@
+// Tests that IteratorClose is called in array destructuring patterns.
+
+function test() {
+ var returnCalled = 0;
+ var returnCalledExpected = 0;
+ var iterable = {};
+
+ // empty [] calls IteratorClose regardless of "done" on the result.
+ iterable[Symbol.iterator] = makeIterator({
+ next: function() {
+ return { done: true };
+ },
+ ret: function() {
+ returnCalled++;
+ return {};
+ }
+ });
+ var [] = iterable;
+ assertEq(returnCalled, ++returnCalledExpected);
+
+ iterable[Symbol.iterator] = makeIterator({
+ ret: function() {
+ returnCalled++;
+ return {};
+ }
+ });
+ var [] = iterable;
+ assertEq(returnCalled, ++returnCalledExpected);
+
+ // Non-empty destructuring calls IteratorClose if iterator is not done by
+ // the end of destructuring.
+ var [a,b] = iterable;
+ assertEq(returnCalled, ++returnCalledExpected);
+ var [c,] = iterable;
+ assertEq(returnCalled, ++returnCalledExpected);
+
+ // throw in lhs ref calls IteratorClose
+ function throwlhs() {
+ throw "in lhs";
+ }
+ assertThrowsValue(function() {
+ 0, [...{}[throwlhs()]] = iterable;
+ }, "in lhs");
+ assertEq(returnCalled, ++returnCalledExpected);
+
+ // throw in lhs ref calls IteratorClose with falsy "done".
+ iterable[Symbol.iterator] = makeIterator({
+ next: function() {
+ // "done" is undefined.
+ return {};
+ },
+ ret: function() {
+ returnCalled++;
+ return {};
+ }
+ });
+ assertThrowsValue(function() {
+ 0, [...{}[throwlhs()]] = iterable;
+ }, "in lhs");
+ assertEq(returnCalled, ++returnCalledExpected);
+
+ // throw in iter.next doesn't call IteratorClose
+ iterable[Symbol.iterator] = makeIterator({
+ next: function() {
+ throw "in next";
+ },
+ ret: function() {
+ returnCalled++;
+ return {};
+ }
+ });
+ assertThrowsValue(function() {
+ var [d] = iterable;
+ }, "in next");
+ assertEq(returnCalled, returnCalledExpected);
+
+ // "return" must return an Object.
+ iterable[Symbol.iterator] = makeIterator({
+ ret: function() {
+ returnCalled++;
+ return 42;
+ }
+ });
+ assertThrowsInstanceOf(function() {
+ var [] = iterable;
+ }, TypeError);
+ assertEq(returnCalled, ++returnCalledExpected);
+}
+
+test();
+
+if (typeof reportCompare === "function")
+ reportCompare(0, 0);
diff --git a/js/src/tests/ecma_6/Destructuring/order-super.js b/js/src/tests/ecma_6/Destructuring/order-super.js
new file mode 100644
index 0000000000..afe11e2d91
--- /dev/null
+++ b/js/src/tests/ecma_6/Destructuring/order-super.js
@@ -0,0 +1,727 @@
+var BUGNUMBER = 1204028;
+var summary = "Destructuring should evaluate lhs reference before rhs in super property";
+
+if (typeof assertEq === "undefined") {
+ assertEq = function(a, b) {
+ if (a !== b)
+ throw new Error(`expected ${b}, got ${a}\n${new Error().stack}`);
+ };
+}
+
+print(BUGNUMBER + ": " + summary);
+
+let logs = [];
+function log(x) {
+ logs.push(x);
+}
+
+let unwrapMap = new Map();
+function unwrap(maybeWrapped) {
+ if (unwrapMap.has(maybeWrapped))
+ return unwrapMap.get(maybeWrapped);
+ return maybeWrapped;
+}
+function ToString(name) {
+ if (name == Symbol.iterator)
+ return "@@iterator";
+ return String(name);
+}
+function logger(obj, prefix=[]) {
+ let wrapped = new Proxy(obj, {
+ get(that, name) {
+ if (name == "return") {
+ // FIXME: Bug 1147371.
+ // We ignore IteratorClose for now.
+ return obj[name];
+ }
+
+ let names = prefix.concat(ToString(name));
+ log("rhs get " + names.join("::"));
+ let v = obj[name];
+ if (typeof v === "object" || typeof v === "function")
+ return logger(v, names);
+ return v;
+ },
+ apply(that, thisArg, args) {
+ let names = prefix.slice();
+ log("rhs call " + names.join("::"));
+ let v = obj.apply(unwrap(thisArg), args);
+ if (typeof v === "object" || typeof v === "function") {
+ names[names.length - 1] += "()";
+ return logger(v, names);
+ }
+ return v;
+ }
+ });
+ unwrapMap.set(wrapped, obj);
+ return wrapped;
+}
+
+class C1 {
+ constructor() {
+ this.clear();
+ }
+ clear() {
+ this.values = {};
+ }
+}
+for (let name of [
+ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m",
+ "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
+ "0", "1", "length"
+]) {
+ Object.defineProperty(C1.prototype, name, {
+ set: function(value) {
+ log("lhs set " + name);
+ this.values[name] = value;
+ }
+ });
+}
+class C2 extends C1 {
+ constructor() {
+ super();
+
+ let clear = () => {
+ logs = [];
+ this.clear();
+ };
+
+ // Array.
+
+ clear();
+ [
+ super.a
+ ] = logger(["A"]);
+ assertEq(logs.join(","),
+ [
+ "rhs get @@iterator",
+ "rhs call @@iterator",
+
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "lhs set a",
+ ].join(","));
+ assertEq(this.values.a, "A");
+
+ clear();
+ [
+ super[ (log("lhs before name a"), "a") ]
+ ] = logger(["A"]);
+ assertEq(logs.join(","),
+ [
+ "rhs get @@iterator",
+ "rhs call @@iterator",
+
+ "lhs before name a",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "lhs set a",
+ ].join(","));
+ assertEq(this.values.a, "A");
+
+ // Array rest.
+
+ clear();
+ [
+ ...super.a
+ ] = logger(["A", "B", "C"]);
+ assertEq(logs.join(","),
+ [
+ "rhs get @@iterator",
+ "rhs call @@iterator",
+
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "lhs set a",
+ ].join(","));
+ assertEq(this.values.a.join(","), "A,B,C");
+
+ clear();
+ [
+ ...super[ (log("lhs before name a"), "a") ]
+ ] = logger(["A", "B", "C"]);;
+ assertEq(logs.join(","),
+ [
+ "rhs get @@iterator",
+ "rhs call @@iterator",
+
+ "lhs before name a",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "lhs set a",
+ ].join(","));
+ assertEq(this.values.a.join(","), "A,B,C");
+
+ // Array combined.
+
+ clear();
+ [
+ super.a,
+ super[ (log("lhs before name b"), "b") ],
+ ...super[ (log("lhs before name c"), "c") ]
+ ] = logger(["A", "B", "C"]);
+ assertEq(logs.join(","),
+ [
+ "rhs get @@iterator",
+ "rhs call @@iterator",
+
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "lhs set a",
+
+ "lhs before name b",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "lhs set b",
+
+ "lhs before name c",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "lhs set c",
+ ].join(","));
+ assertEq(this.values.a, "A");
+ assertEq(this.values.b, "B");
+ assertEq(this.values.c.join(","), "C");
+
+ // Object.
+
+ clear();
+ ({
+ a: super.a
+ } = logger({a: "A"}));
+ assertEq(logs.join(","),
+ [
+ "rhs get a",
+ "lhs set a",
+ ].join(","));
+ assertEq(this.values.a, "A");
+
+ clear();
+ ({
+ a: super[ (log("lhs before name a"), "a") ]
+ } = logger({a: "A"}));
+ assertEq(logs.join(","),
+ [
+ "lhs before name a",
+ "rhs get a",
+ "lhs set a",
+ ].join(","));
+ assertEq(this.values.a, "A");
+
+ // Object combined.
+
+ clear();
+ ({
+ a: super.a,
+ b: super[ (log("lhs before name b"), "b") ]
+ } = logger({a: "A", b: "B"}));
+ assertEq(logs.join(","),
+ [
+ "rhs get a",
+ "lhs set a",
+
+ "lhs before name b",
+ "rhs get b",
+ "lhs set b",
+ ].join(","));
+ assertEq(this.values.a, "A");
+ assertEq(this.values.b, "B");
+
+ // == Nested ==
+
+ // Array -> Array
+
+ clear();
+ [
+ [
+ super[ (log("lhs before name a"), "a") ],
+ ...super[ (log("lhs before name b"), "b") ]
+ ]
+ ] = logger([["A", "B"]]);
+ assertEq(logs.join(","),
+ [
+ "rhs get @@iterator",
+ "rhs call @@iterator",
+
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next()::value::@@iterator",
+ "rhs call @@iterator()::next()::value::@@iterator",
+
+ "lhs before name a",
+ "rhs get @@iterator()::next()::value::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value",
+ "lhs set a",
+
+ "lhs before name b",
+ "rhs get @@iterator()::next()::value::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value",
+ "rhs get @@iterator()::next()::value::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::done",
+ "lhs set b",
+ ].join(","));
+ assertEq(this.values.a, "A");
+ assertEq(this.values.b.length, 1);
+ assertEq(this.values.b[0], "B");
+
+ // Array rest -> Array
+
+ clear();
+ [
+ ...[
+ super[ (log("lhs before name a"), "a") ],
+ ...super[ (log("lhs before name b"), "b") ]
+ ]
+ ] = logger(["A", "B"]);
+ assertEq(logs.join(","),
+ [
+ "rhs get @@iterator",
+ "rhs call @@iterator",
+
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+
+ "lhs before name a",
+ "lhs set a",
+
+ "lhs before name b",
+ "lhs set b",
+ ].join(","));
+ assertEq(this.values.a, "A");
+ assertEq(this.values.b.join(","), "B");
+
+ // Array -> Object
+ clear();
+ [
+ {
+ a: super[ (log("lhs before name a"), "a") ]
+ }
+ ] = logger([{a: "A"}]);
+ assertEq(logs.join(","),
+ [
+ "rhs get @@iterator",
+ "rhs call @@iterator",
+
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+
+ "lhs before name a",
+ "rhs get @@iterator()::next()::value::a",
+ "lhs set a",
+ ].join(","));
+ assertEq(this.values.a, "A");
+
+ // Array rest -> Object
+ clear();
+ [
+ ...{
+ 0: super[ (log("lhs before name 0"), "0") ],
+ 1: super[ (log("lhs before name 1"), "1") ],
+ length: super[ (log("lhs before name length"), "length") ],
+ }
+ ] = logger(["A", "B"]);
+ assertEq(logs.join(","),
+ [
+ "rhs get @@iterator",
+ "rhs call @@iterator",
+
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+
+ "lhs before name 0",
+ "lhs set 0",
+
+ "lhs before name 1",
+ "lhs set 1",
+
+ "lhs before name length",
+ "lhs set length",
+ ].join(","));
+ assertEq(this.values["0"], "A");
+ assertEq(this.values["1"], "B");
+ assertEq(this.values.length, 2);
+
+ // Object -> Array
+ clear();
+ ({
+ a: [
+ super[ (log("lhs before name b"), "b") ]
+ ]
+ } = logger({a: ["B"]}));
+ assertEq(logs.join(","),
+ [
+ "rhs get a",
+ "rhs get a::@@iterator",
+ "rhs call a::@@iterator",
+
+ "lhs before name b",
+ "rhs get a::@@iterator()::next",
+ "rhs call a::@@iterator()::next",
+ "rhs get a::@@iterator()::next()::done",
+ "rhs get a::@@iterator()::next()::value",
+ "lhs set b",
+ ].join(","));
+ assertEq(this.values.b, "B");
+
+ // Object -> Object
+ clear();
+ ({
+ a: {
+ b: super[ (log("lhs before name b"), "b") ]
+ }
+ } = logger({a: {b: "B"}}));
+ assertEq(logs.join(","),
+ [
+ "rhs get a",
+ "lhs before name b",
+ "rhs get a::b",
+ "lhs set b",
+ ].join(","));
+ assertEq(this.values.b, "B");
+
+ // All combined
+
+ clear();
+ [
+ super[ (log("lhs before name a"), "a") ],
+ [
+ super[ (log("lhs before name b"), "b") ],
+ {
+ c: super[ (log("lhs before name c"), "c") ],
+ d: {
+ e: super[ (log("lhs before name e"), "e") ],
+ f: [
+ super[ (log("lhs before name g"), "g") ]
+ ]
+ }
+ }
+ ],
+ {
+ h: super[ (log("lhs before name h"), "h") ],
+ i: [
+ super[ (log("lhs before name j"), "j") ],
+ {
+ k: [
+ super[ (log("lhs before name l"), "l") ]
+ ]
+ }
+ ]
+ },
+ ...[
+ super[ (log("lhs before name m"), "m") ],
+ [
+ super[ (log("lhs before name n"), "n") ],
+ {
+ o: super[ (log("lhs before name o"), "o") ],
+ p: {
+ q: super[ (log("lhs before name q"), "q") ],
+ r: [
+ super[ (log("lhs before name s"), "s") ]
+ ]
+ }
+ }
+ ],
+ ...{
+ 0: super[ (log("lhs before name t"), "t") ],
+ 1: [
+ super[ (log("lhs before name u"), "u") ],
+ {
+ v: super[ (log("lhs before name v"), "v") ],
+ w: {
+ x: super[ (log("lhs before name x"), "x") ],
+ y: [
+ super[ (log("lhs before name z"), "z") ]
+ ]
+ }
+ }
+ ],
+ length: super[ (log("lhs before name length"), "length") ],
+ }
+ ]
+ ] = logger(["A",
+ ["B", {c: "C", d: {e: "E", f: ["G"]}}],
+ {h: "H", i: ["J", {k: ["L"]}]},
+ "M",
+ ["N", {o: "O", p: {q: "Q", r: ["S"]}}],
+ "T", ["U", {v: "V", w: {x: "X", y: ["Z"]}}]]);
+ assertEq(logs.join(","),
+ [
+ "rhs get @@iterator",
+ "rhs call @@iterator",
+
+ "lhs before name a",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "lhs set a",
+
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next()::value::@@iterator",
+ "rhs call @@iterator()::next()::value::@@iterator",
+
+ "lhs before name b",
+ "rhs get @@iterator()::next()::value::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value",
+ "lhs set b",
+
+ "rhs get @@iterator()::next()::value::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value",
+
+ "lhs before name c",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::c",
+ "lhs set c",
+
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::d",
+
+ "lhs before name e",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::d::e",
+ "lhs set e",
+
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::d::f",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::d::f::@@iterator",
+ "rhs call @@iterator()::next()::value::@@iterator()::next()::value::d::f::@@iterator",
+
+ "lhs before name g",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::d::f::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::@@iterator()::next()::value::d::f::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::d::f::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::d::f::@@iterator()::next()::value",
+ "lhs set g",
+
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+
+ "lhs before name h",
+ "rhs get @@iterator()::next()::value::h",
+ "lhs set h",
+
+ "rhs get @@iterator()::next()::value::i",
+ "rhs get @@iterator()::next()::value::i::@@iterator",
+ "rhs call @@iterator()::next()::value::i::@@iterator",
+
+ "lhs before name j",
+ "rhs get @@iterator()::next()::value::i::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::i::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::i::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::i::@@iterator()::next()::value",
+ "lhs set j",
+
+ "rhs get @@iterator()::next()::value::i::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::i::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::i::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::i::@@iterator()::next()::value",
+
+ "rhs get @@iterator()::next()::value::i::@@iterator()::next()::value::k",
+ "rhs get @@iterator()::next()::value::i::@@iterator()::next()::value::k::@@iterator",
+ "rhs call @@iterator()::next()::value::i::@@iterator()::next()::value::k::@@iterator",
+
+ "lhs before name l",
+ "rhs get @@iterator()::next()::value::i::@@iterator()::next()::value::k::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::i::@@iterator()::next()::value::k::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::i::@@iterator()::next()::value::k::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::i::@@iterator()::next()::value::k::@@iterator()::next()::value",
+ "lhs set l",
+
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+
+ "lhs before name m",
+ "lhs set m",
+
+ "rhs get @@iterator()::next()::value::@@iterator",
+ "rhs call @@iterator()::next()::value::@@iterator",
+
+ "lhs before name n",
+ "rhs get @@iterator()::next()::value::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value",
+ "lhs set n",
+
+ "rhs get @@iterator()::next()::value::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value",
+
+ "lhs before name o",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::o",
+ "lhs set o",
+
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::p",
+
+ "lhs before name q",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::p::q",
+ "lhs set q",
+
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::p::r",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::p::r::@@iterator",
+ "rhs call @@iterator()::next()::value::@@iterator()::next()::value::p::r::@@iterator",
+
+ "lhs before name s",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::p::r::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::@@iterator()::next()::value::p::r::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::p::r::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::p::r::@@iterator()::next()::value",
+ "lhs set s",
+
+ "lhs before name t",
+ "lhs set t",
+
+ "rhs get @@iterator()::next()::value::@@iterator",
+ "rhs call @@iterator()::next()::value::@@iterator",
+
+ "lhs before name u",
+ "rhs get @@iterator()::next()::value::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value",
+ "lhs set u",
+
+ "rhs get @@iterator()::next()::value::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value",
+
+ "lhs before name v",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::v",
+ "lhs set v",
+
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::w",
+
+ "lhs before name x",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::w::x",
+ "lhs set x",
+
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::w::y",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::w::y::@@iterator",
+ "rhs call @@iterator()::next()::value::@@iterator()::next()::value::w::y::@@iterator",
+
+ "lhs before name z",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::w::y::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::@@iterator()::next()::value::w::y::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::w::y::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::w::y::@@iterator()::next()::value",
+ "lhs set z",
+
+ "lhs before name length",
+ "lhs set length",
+ ].join(","));
+ assertEq(this.values.a, "A");
+ assertEq(this.values.b, "B");
+ assertEq(this.values.c, "C");
+ assertEq(this.values.e, "E");
+ assertEq(this.values.g, "G");
+ assertEq(this.values.h, "H");
+ assertEq(this.values.j, "J");
+ assertEq(this.values.l, "L");
+ assertEq(this.values.m, "M");
+ assertEq(this.values.n, "N");
+ assertEq(this.values.o, "O");
+ assertEq(this.values.q, "Q");
+ assertEq(this.values.s, "S");
+ assertEq(this.values.t, "T");
+ assertEq(this.values.u, "U");
+ assertEq(this.values.v, "V");
+ assertEq(this.values.x, "X");
+ assertEq(this.values.z, "Z");
+ assertEq(this.values.length, 2);
+ }
+}
+
+new C2();
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
diff --git a/js/src/tests/ecma_6/Destructuring/order.js b/js/src/tests/ecma_6/Destructuring/order.js
new file mode 100644
index 0000000000..4eb48cd2b0
--- /dev/null
+++ b/js/src/tests/ecma_6/Destructuring/order.js
@@ -0,0 +1,745 @@
+var BUGNUMBER = 1204028;
+var summary = "Destructuring should evaluate lhs reference before rhs";
+
+print(BUGNUMBER + ": " + summary);
+
+let storage = {
+ clear() {
+ this.values = {};
+ }
+};
+storage.clear();
+let obj = new Proxy(storage, {
+ set(that, name, value) {
+ log("lhs set " + name);
+ storage.values[name] = value;
+ }
+});
+
+let logs = [];
+function log(x) {
+ logs.push(x);
+}
+
+function clear() {
+ logs = [];
+ storage.clear();
+}
+
+let unwrapMap = new Map();
+function unwrap(maybeWrapped) {
+ if (unwrapMap.has(maybeWrapped))
+ return unwrapMap.get(maybeWrapped);
+ return maybeWrapped;
+}
+function ToString(name) {
+ if (name == Symbol.iterator)
+ return "@@iterator";
+ return String(name);
+}
+function logger(obj, prefix=[]) {
+ let wrapped = new Proxy(obj, {
+ get(that, name) {
+ if (name == "return") {
+ // FIXME: Bug 1147371.
+ // We ignore IteratorClose for now.
+ return obj[name];
+ }
+
+ let names = prefix.concat(ToString(name));
+ log("rhs get " + names.join("::"));
+ let v = obj[name];
+ if (typeof v === "object" || typeof v === "function")
+ return logger(v, names);
+ return v;
+ },
+ apply(that, thisArg, args) {
+ let names = prefix.slice();
+ log("rhs call " + names.join("::"));
+ let v = obj.apply(unwrap(thisArg), args);
+ if (typeof v === "object" || typeof v === "function") {
+ names[names.length - 1] += "()";
+ return logger(v, names);
+ }
+ return v;
+ }
+ });
+ unwrapMap.set(wrapped, obj);
+ return wrapped;
+}
+
+// Array.
+
+clear();
+[
+ ( log("lhs before obj a"), obj ).a
+] = logger(["A"]);
+assertEq(logs.join(","),
+ [
+ "rhs get @@iterator",
+ "rhs call @@iterator",
+
+ "lhs before obj a",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "lhs set a",
+ ].join(","));
+assertEq(storage.values.a, "A");
+
+clear();
+[
+ ( log("lhs before obj a"), obj )[ (log("lhs before name a"), "a") ]
+] = logger(["A"]);
+assertEq(logs.join(","),
+ [
+ "rhs get @@iterator",
+ "rhs call @@iterator",
+
+ "lhs before obj a",
+ "lhs before name a",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "lhs set a",
+ ].join(","));
+assertEq(storage.values.a, "A");
+
+// Array rest.
+
+clear();
+[
+ ...( log("lhs before obj a"), obj ).a
+] = logger(["A", "B", "C"]);
+assertEq(logs.join(","),
+ [
+ "rhs get @@iterator",
+ "rhs call @@iterator",
+
+ "lhs before obj a",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "lhs set a",
+ ].join(","));
+assertEq(storage.values.a.join(","), "A,B,C");
+
+clear();
+[
+ ...( log("lhs before obj a"), obj )[ (log("lhs before name a"), "a") ]
+] = logger(["A", "B", "C"]);;
+assertEq(logs.join(","),
+ [
+ "rhs get @@iterator",
+ "rhs call @@iterator",
+
+ "lhs before obj a",
+ "lhs before name a",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "lhs set a",
+ ].join(","));
+assertEq(storage.values.a.join(","), "A,B,C");
+
+// Array combined.
+
+clear();
+[
+ ( log("lhs before obj a"), obj ).a,
+ ( log("lhs before obj b"), obj )[ (log("lhs before name b"), "b") ],
+ ...( log("lhs before obj c"), obj )[ (log("lhs before name c"), "c") ]
+] = logger(["A", "B", "C"]);
+assertEq(logs.join(","),
+ [
+ "rhs get @@iterator",
+ "rhs call @@iterator",
+
+ "lhs before obj a",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "lhs set a",
+
+ "lhs before obj b",
+ "lhs before name b",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "lhs set b",
+
+ "lhs before obj c",
+ "lhs before name c",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "lhs set c",
+ ].join(","));
+assertEq(storage.values.a, "A");
+assertEq(storage.values.b, "B");
+assertEq(storage.values.c.join(","), "C");
+
+// Object.
+
+clear();
+({
+ a: ( log("lhs before obj a"), obj ).a
+} = logger({a: "A"}));
+assertEq(logs.join(","),
+ [
+ "lhs before obj a",
+ "rhs get a",
+ "lhs set a",
+ ].join(","));
+assertEq(storage.values.a, "A");
+
+clear();
+({
+ a: ( log("lhs before obj a"), obj )[ (log("lhs before name a"), "a") ]
+} = logger({a: "A"}));
+assertEq(logs.join(","),
+ [
+ "lhs before obj a",
+ "lhs before name a",
+ "rhs get a",
+ "lhs set a",
+ ].join(","));
+assertEq(storage.values.a, "A");
+
+// Object combined.
+
+clear();
+({
+ a: ( log("lhs before obj a"), obj ).a,
+ b: ( log("lhs before obj b"), obj )[ (log("lhs before name b"), "b") ]
+} = logger({a: "A", b: "B"}));
+assertEq(logs.join(","),
+ [
+ "lhs before obj a",
+ "rhs get a",
+ "lhs set a",
+
+ "lhs before obj b",
+ "lhs before name b",
+ "rhs get b",
+ "lhs set b",
+ ].join(","));
+assertEq(storage.values.a, "A");
+assertEq(storage.values.b, "B");
+
+// == Nested ==
+
+// Array -> Array
+
+clear();
+[
+ [
+ ( log("lhs before obj a"), obj )[ (log("lhs before name a"), "a") ],
+ ...( log("lhs before obj b"), obj )[ (log("lhs before name b"), "b") ]
+ ]
+] = logger([["A", "B"]]);
+assertEq(logs.join(","),
+ [
+ "rhs get @@iterator",
+ "rhs call @@iterator",
+
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next()::value::@@iterator",
+ "rhs call @@iterator()::next()::value::@@iterator",
+
+ "lhs before obj a",
+ "lhs before name a",
+ "rhs get @@iterator()::next()::value::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value",
+ "lhs set a",
+
+ "lhs before obj b",
+ "lhs before name b",
+ "rhs get @@iterator()::next()::value::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value",
+ "rhs get @@iterator()::next()::value::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::done",
+ "lhs set b",
+ ].join(","));
+assertEq(storage.values.a, "A");
+assertEq(storage.values.b.length, 1);
+assertEq(storage.values.b[0], "B");
+
+// Array rest -> Array
+
+clear();
+[
+ ...[
+ ( log("lhs before obj a"), obj )[ (log("lhs before name a"), "a") ],
+ ...( log("lhs before obj b"), obj )[ (log("lhs before name b"), "b") ]
+ ]
+] = logger(["A", "B"]);
+assertEq(logs.join(","),
+ [
+ "rhs get @@iterator",
+ "rhs call @@iterator",
+
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+
+ "lhs before obj a",
+ "lhs before name a",
+ "lhs set a",
+
+ "lhs before obj b",
+ "lhs before name b",
+ "lhs set b",
+ ].join(","));
+assertEq(storage.values.a, "A");
+assertEq(storage.values.b.join(","), "B");
+
+// Array -> Object
+clear();
+[
+ {
+ a: ( log("lhs before obj a"), obj )[ (log("lhs before name a"), "a") ]
+ }
+] = logger([{a: "A"}]);
+assertEq(logs.join(","),
+ [
+ "rhs get @@iterator",
+ "rhs call @@iterator",
+
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+
+ "lhs before obj a",
+ "lhs before name a",
+ "rhs get @@iterator()::next()::value::a",
+ "lhs set a",
+ ].join(","));
+assertEq(storage.values.a, "A");
+
+// Array rest -> Object
+clear();
+[
+ ...{
+ 0: ( log("lhs before obj 0"), obj )[ (log("lhs before name 0"), "0") ],
+ 1: ( log("lhs before obj 1"), obj )[ (log("lhs before name 1"), "1") ],
+ length: ( log("lhs before obj length"), obj )[ (log("lhs before name length"), "length") ],
+ }
+] = logger(["A", "B"]);
+assertEq(logs.join(","),
+ [
+ "rhs get @@iterator",
+ "rhs call @@iterator",
+
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+
+ "lhs before obj 0",
+ "lhs before name 0",
+ "lhs set 0",
+
+ "lhs before obj 1",
+ "lhs before name 1",
+ "lhs set 1",
+
+ "lhs before obj length",
+ "lhs before name length",
+ "lhs set length",
+ ].join(","));
+assertEq(storage.values["0"], "A");
+assertEq(storage.values["1"], "B");
+assertEq(storage.values.length, 2);
+
+// Object -> Array
+clear();
+({
+ a: [
+ ( log("lhs before obj b"), obj )[ (log("lhs before name b"), "b") ]
+ ]
+} = logger({a: ["B"]}));
+assertEq(logs.join(","),
+ [
+ "rhs get a",
+ "rhs get a::@@iterator",
+ "rhs call a::@@iterator",
+
+ "lhs before obj b",
+ "lhs before name b",
+ "rhs get a::@@iterator()::next",
+ "rhs call a::@@iterator()::next",
+ "rhs get a::@@iterator()::next()::done",
+ "rhs get a::@@iterator()::next()::value",
+ "lhs set b",
+ ].join(","));
+assertEq(storage.values.b, "B");
+
+// Object -> Object
+clear();
+({
+ a: {
+ b: ( log("lhs before obj b"), obj )[ (log("lhs before name b"), "b") ]
+ }
+} = logger({a: {b: "B"}}));
+assertEq(logs.join(","),
+ [
+ "rhs get a",
+ "lhs before obj b",
+ "lhs before name b",
+ "rhs get a::b",
+ "lhs set b",
+ ].join(","));
+assertEq(storage.values.b, "B");
+
+// All combined
+
+clear();
+[
+ ( log("lhs before obj a"), obj )[ (log("lhs before name a"), "a") ],
+ [
+ ( log("lhs before obj b"), obj )[ (log("lhs before name b"), "b") ],
+ {
+ c: ( log("lhs before obj c"), obj )[ (log("lhs before name c"), "c") ],
+ d: {
+ e: ( log("lhs before obj e"), obj )[ (log("lhs before name e"), "e") ],
+ f: [
+ ( log("lhs before obj g"), obj )[ (log("lhs before name g"), "g") ]
+ ]
+ }
+ }
+ ],
+ {
+ h: ( log("lhs before obj h"), obj )[ (log("lhs before name h"), "h") ],
+ i: [
+ ( log("lhs before obj j"), obj )[ (log("lhs before name j"), "j") ],
+ {
+ k: [
+ ( log("lhs before obj l"), obj )[ (log("lhs before name l"), "l") ]
+ ]
+ }
+ ]
+ },
+ ...[
+ ( log("lhs before obj m"), obj )[ (log("lhs before name m"), "m") ],
+ [
+ ( log("lhs before obj n"), obj )[ (log("lhs before name n"), "n") ],
+ {
+ o: ( log("lhs before obj o"), obj )[ (log("lhs before name o"), "o") ],
+ p: {
+ q: ( log("lhs before obj q"), obj )[ (log("lhs before name q"), "q") ],
+ r: [
+ ( log("lhs before obj s"), obj )[ (log("lhs before name s"), "s") ]
+ ]
+ }
+ }
+ ],
+ ...{
+ 0: ( log("lhs before obj t"), obj )[ (log("lhs before name t"), "t") ],
+ 1: [
+ ( log("lhs before obj u"), obj )[ (log("lhs before name u"), "u") ],
+ {
+ v: ( log("lhs before obj v"), obj )[ (log("lhs before name v"), "v") ],
+ w: {
+ x: ( log("lhs before obj x"), obj )[ (log("lhs before name x"), "x") ],
+ y: [
+ ( log("lhs before obj z"), obj )[ (log("lhs before name z"), "z") ]
+ ]
+ }
+ }
+ ],
+ length: ( log("lhs before obj length"), obj )[ (log("lhs before name length"), "length") ],
+ }
+ ]
+] = logger(["A",
+ ["B", {c: "C", d: {e: "E", f: ["G"]}}],
+ {h: "H", i: ["J", {k: ["L"]}]},
+ "M",
+ ["N", {o: "O", p: {q: "Q", r: ["S"]}}],
+ "T", ["U", {v: "V", w: {x: "X", y: ["Z"]}}]]);
+assertEq(logs.join(","),
+ [
+ "rhs get @@iterator",
+ "rhs call @@iterator",
+
+ "lhs before obj a",
+ "lhs before name a",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "lhs set a",
+
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next()::value::@@iterator",
+ "rhs call @@iterator()::next()::value::@@iterator",
+
+ "lhs before obj b",
+ "lhs before name b",
+ "rhs get @@iterator()::next()::value::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value",
+ "lhs set b",
+
+ "rhs get @@iterator()::next()::value::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value",
+
+ "lhs before obj c",
+ "lhs before name c",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::c",
+ "lhs set c",
+
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::d",
+
+ "lhs before obj e",
+ "lhs before name e",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::d::e",
+ "lhs set e",
+
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::d::f",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::d::f::@@iterator",
+ "rhs call @@iterator()::next()::value::@@iterator()::next()::value::d::f::@@iterator",
+
+ "lhs before obj g",
+ "lhs before name g",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::d::f::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::@@iterator()::next()::value::d::f::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::d::f::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::d::f::@@iterator()::next()::value",
+ "lhs set g",
+
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+
+ "lhs before obj h",
+ "lhs before name h",
+ "rhs get @@iterator()::next()::value::h",
+ "lhs set h",
+
+ "rhs get @@iterator()::next()::value::i",
+ "rhs get @@iterator()::next()::value::i::@@iterator",
+ "rhs call @@iterator()::next()::value::i::@@iterator",
+
+ "lhs before obj j",
+ "lhs before name j",
+ "rhs get @@iterator()::next()::value::i::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::i::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::i::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::i::@@iterator()::next()::value",
+ "lhs set j",
+
+ "rhs get @@iterator()::next()::value::i::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::i::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::i::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::i::@@iterator()::next()::value",
+
+ "rhs get @@iterator()::next()::value::i::@@iterator()::next()::value::k",
+ "rhs get @@iterator()::next()::value::i::@@iterator()::next()::value::k::@@iterator",
+ "rhs call @@iterator()::next()::value::i::@@iterator()::next()::value::k::@@iterator",
+
+ "lhs before obj l",
+ "lhs before name l",
+ "rhs get @@iterator()::next()::value::i::@@iterator()::next()::value::k::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::i::@@iterator()::next()::value::k::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::i::@@iterator()::next()::value::k::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::i::@@iterator()::next()::value::k::@@iterator()::next()::value",
+ "lhs set l",
+
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value",
+ "rhs get @@iterator()::next",
+ "rhs call @@iterator()::next",
+ "rhs get @@iterator()::next()::done",
+
+ "lhs before obj m",
+ "lhs before name m",
+ "lhs set m",
+
+ "rhs get @@iterator()::next()::value::@@iterator",
+ "rhs call @@iterator()::next()::value::@@iterator",
+
+ "lhs before obj n",
+ "lhs before name n",
+ "rhs get @@iterator()::next()::value::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value",
+ "lhs set n",
+
+ "rhs get @@iterator()::next()::value::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value",
+
+ "lhs before obj o",
+ "lhs before name o",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::o",
+ "lhs set o",
+
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::p",
+
+ "lhs before obj q",
+ "lhs before name q",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::p::q",
+ "lhs set q",
+
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::p::r",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::p::r::@@iterator",
+ "rhs call @@iterator()::next()::value::@@iterator()::next()::value::p::r::@@iterator",
+
+ "lhs before obj s",
+ "lhs before name s",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::p::r::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::@@iterator()::next()::value::p::r::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::p::r::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::p::r::@@iterator()::next()::value",
+ "lhs set s",
+
+ "lhs before obj t",
+ "lhs before name t",
+ "lhs set t",
+
+ "rhs get @@iterator()::next()::value::@@iterator",
+ "rhs call @@iterator()::next()::value::@@iterator",
+
+ "lhs before obj u",
+ "lhs before name u",
+ "rhs get @@iterator()::next()::value::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value",
+ "lhs set u",
+
+ "rhs get @@iterator()::next()::value::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value",
+
+ "lhs before obj v",
+ "lhs before name v",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::v",
+ "lhs set v",
+
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::w",
+
+ "lhs before obj x",
+ "lhs before name x",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::w::x",
+ "lhs set x",
+
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::w::y",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::w::y::@@iterator",
+ "rhs call @@iterator()::next()::value::@@iterator()::next()::value::w::y::@@iterator",
+
+ "lhs before obj z",
+ "lhs before name z",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::w::y::@@iterator()::next",
+ "rhs call @@iterator()::next()::value::@@iterator()::next()::value::w::y::@@iterator()::next",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::w::y::@@iterator()::next()::done",
+ "rhs get @@iterator()::next()::value::@@iterator()::next()::value::w::y::@@iterator()::next()::value",
+ "lhs set z",
+
+ "lhs before obj length",
+ "lhs before name length",
+ "lhs set length",
+ ].join(","));
+assertEq(storage.values.a, "A");
+assertEq(storage.values.b, "B");
+assertEq(storage.values.c, "C");
+assertEq(storage.values.e, "E");
+assertEq(storage.values.g, "G");
+assertEq(storage.values.h, "H");
+assertEq(storage.values.j, "J");
+assertEq(storage.values.l, "L");
+assertEq(storage.values.m, "M");
+assertEq(storage.values.n, "N");
+assertEq(storage.values.o, "O");
+assertEq(storage.values.q, "Q");
+assertEq(storage.values.s, "S");
+assertEq(storage.values.t, "T");
+assertEq(storage.values.u, "U");
+assertEq(storage.values.v, "V");
+assertEq(storage.values.x, "X");
+assertEq(storage.values.z, "Z");
+assertEq(storage.values.length, 2);
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
diff --git a/js/src/tests/ecma_6/Error/constructor-proto.js b/js/src/tests/ecma_6/Error/constructor-proto.js
new file mode 100644
index 0000000000..4ddc6025e8
--- /dev/null
+++ b/js/src/tests/ecma_6/Error/constructor-proto.js
@@ -0,0 +1,17 @@
+const nativeErrors = [
+ InternalError,
+ EvalError,
+ RangeError,
+ ReferenceError,
+ SyntaxError,
+ TypeError,
+ URIError
+];
+
+assertEq(Reflect.getPrototypeOf(Error), Function.prototype)
+
+for (const error of nativeErrors)
+ assertEq(Reflect.getPrototypeOf(error), Error);
+
+if (typeof reportCompare === "function")
+ reportCompare(0, 0);
diff --git a/js/src/tests/ecma_6/Error/prototype-properties.js b/js/src/tests/ecma_6/Error/prototype-properties.js
new file mode 100644
index 0000000000..c66caf2bcb
--- /dev/null
+++ b/js/src/tests/ecma_6/Error/prototype-properties.js
@@ -0,0 +1,24 @@
+const nativeErrors = [
+ InternalError,
+ EvalError,
+ RangeError,
+ ReferenceError,
+ SyntaxError,
+ TypeError,
+ URIError
+];
+
+
+assertEq(Reflect.ownKeys(Error.prototype).toString(), "toSource,toString,message,name,stack,constructor");
+assertEq(Error.prototype.name, "Error");
+assertEq(Error.prototype.message, "");
+
+for (const error of nativeErrors) {
+ assertEq(Reflect.ownKeys(error.prototype).toString(), "message,name,constructor");
+ assertEq(error.prototype.name, error.name);
+ assertEq(error.prototype.message, "");
+ assertEq(error.prototype.constructor, error);
+}
+
+if (typeof reportCompare === "function")
+ reportCompare(0, 0);
diff --git a/js/src/tests/ecma_6/Error/prototype.js b/js/src/tests/ecma_6/Error/prototype.js
new file mode 100644
index 0000000000..b22a8e084b
--- /dev/null
+++ b/js/src/tests/ecma_6/Error/prototype.js
@@ -0,0 +1,18 @@
+const nativeErrors = [
+ InternalError,
+ EvalError,
+ RangeError,
+ ReferenceError,
+ SyntaxError,
+ TypeError,
+ URIError
+];
+
+assertEq(Reflect.getPrototypeOf(Error.prototype), Object.prototype)
+
+for (const error of nativeErrors) {
+ assertEq(Reflect.getPrototypeOf(error.prototype), Error.prototype);
+}
+
+if (typeof reportCompare === "function")
+ reportCompare(0, 0);
diff --git a/js/src/tests/ecma_6/Error/shell.js b/js/src/tests/ecma_6/Error/shell.js
new file mode 100644
index 0000000000..e69de29bb2
--- /dev/null
+++ b/js/src/tests/ecma_6/Error/shell.js
diff --git a/js/src/tests/ecma_6/Function/function-name-assignment.js b/js/src/tests/ecma_6/Function/function-name-assignment.js
new file mode 100644
index 0000000000..5e4d1c004f
--- /dev/null
+++ b/js/src/tests/ecma_6/Function/function-name-assignment.js
@@ -0,0 +1,139 @@
+var BUGNUMBER = 883377;
+var summary = "Anonymous function name should be set based on assignment";
+
+print(BUGNUMBER + ": " + summary);
+
+var fooSymbol = Symbol("foo");
+var emptySymbol = Symbol("");
+var undefSymbol = Symbol();
+var globalVar;
+
+var exprs = [
+ ["function() {}", false],
+ ["function named() {}", true],
+ ["function*() {}", false],
+ ["function* named() {}", true],
+ ["async function() {}", false],
+ ["async function named() {}", true],
+ ["() => {}", false],
+ ["async () => {}", false],
+ ["class {}", false],
+ ["class named {}", true],
+];
+
+function testAssignmentExpression(expr, named) {
+ eval(`
+ var assignment;
+ assignment = ${expr};
+ assertEq(assignment.name, named ? "named" : "assignment");
+
+ globalVar = ${expr};
+ assertEq(globalVar.name, named ? "named" : "globalVar");
+
+ var obj = { dynamic: null };
+ with (obj) {
+ dynamic = ${expr};
+ }
+ assertEq(obj.dynamic.name, named ? "named" : "dynamic");
+
+ (function namedLambda(param1, param2) {
+ var assignedToNamedLambda;
+ assignedToNamedLambda = namedLambda = ${expr};
+ assertEq(namedLambda.name, "namedLambda");
+ assertEq(assignedToNamedLambda.name, named ? "named" : "namedLambda");
+
+ param1 = ${expr};
+ assertEq(param1.name, named ? "named" : "param1");
+
+ {
+ let param1 = ${expr};
+ assertEq(param1.name, named ? "named" : "param1");
+
+ param2 = ${expr};
+ assertEq(param2.name, named ? "named" : "param2");
+ }
+ })();
+
+ {
+ let nextedLexical1, nextedLexical2;
+ {
+ let nextedLexical1 = ${expr};
+ assertEq(nextedLexical1.name, named ? "named" : "nextedLexical1");
+
+ nextedLexical2 = ${expr};
+ assertEq(nextedLexical2.name, named ? "named" : "nextedLexical2");
+ }
+ }
+ `);
+
+ // Not applicable cases: not IsIdentifierRef.
+ eval(`
+ var inParen;
+ (inParen) = ${expr};
+ assertEq(inParen.name, named ? "named" : "");
+ `);
+
+ // Not applicable cases: not direct RHS.
+ if (!expr.includes("=>")) {
+ eval(`
+ var a = true && ${expr};
+ assertEq(a.name, named ? "named" : "");
+ `);
+ } else {
+ // Arrow function cannot be RHS of &&.
+ eval(`
+ var a = true && (${expr});
+ assertEq(a.name, named ? "named" : "");
+ `);
+ }
+
+ // Not applicable cases: property.
+ eval(`
+ var obj = {};
+
+ obj.prop = ${expr};
+ assertEq(obj.prop.name, named ? "named" : "");
+
+ obj["literal"] = ${expr};
+ assertEq(obj["literal"].name, named ? "named" : "");
+ `);
+
+ // Not applicable cases: assigned again.
+ eval(`
+ var tmp = [${expr}];
+ assertEq(tmp[0].name, named ? "named" : "");
+
+ var assignment;
+ assignment = tmp[0];
+ assertEq(assignment.name, named ? "named" : "");
+ `);
+}
+for (var [expr, named] of exprs) {
+ testAssignmentExpression(expr, named);
+}
+
+function testVariableDeclaration(expr, named) {
+ eval(`
+ var varDecl = ${expr};
+ assertEq(varDecl.name, named ? "named" : "varDecl");
+ `);
+}
+for (var [expr, named] of exprs) {
+ testVariableDeclaration(expr, named);
+}
+
+function testLexicalBinding(expr, named) {
+ eval(`
+ let lexical = ${expr};
+ assertEq(lexical.name, named ? "named" : "lexical");
+
+ const constLexical = ${expr};
+ assertEq(constLexical.name, named ? "named" : "constLexical");
+ `);
+}
+for (var [expr, named] of exprs) {
+ testLexicalBinding(expr, named);
+}
+
+if (typeof reportCompare === "function")
+ reportCompare(0, 0);
diff --git a/js/src/tests/ecma_6/Function/function-name-binding.js b/js/src/tests/ecma_6/Function/function-name-binding.js
new file mode 100644
index 0000000000..bdd6c131c0
--- /dev/null
+++ b/js/src/tests/ecma_6/Function/function-name-binding.js
@@ -0,0 +1,54 @@
+var BUGNUMBER = 883377;
+var summary = "Anonymous function name should be set based on binding pattern";
+
+print(BUGNUMBER + ": " + summary);
+
+var exprs = [
+ ["function() {}", false],
+ ["function named() {}", true],
+ ["function*() {}", false],
+ ["function* named() {}", true],
+ ["async function() {}", false],
+ ["async function named() {}", true],
+ ["() => {}", false],
+ ["async () => {}", false],
+ ["class {}", false],
+ ["class named {}", true],
+];
+
+function testAssignmentProperty(expr, named) {
+ var f = eval(`(function({ prop1 = ${expr} }) { return prop1; })`);
+ assertEq(f({}).name, named ? "named" : "prop1");
+
+ eval(`
+ var { prop1 = ${expr} } = {};
+ assertEq(prop1.name, named ? "named" : "prop1");
+ `);
+}
+for (var [expr, named] of exprs) {
+ testAssignmentProperty(expr, named);
+}
+
+function testAssignmentElement(expr, named) {
+ var f = eval(`(function([elem1 = ${expr}]) { return elem1; })`);
+ assertEq(f([]).name, named ? "named" : "elem1");
+
+ eval(`
+ var [elem1 = ${expr}] = [];
+ assertEq(elem1.name, named ? "named" : "elem1");
+ `);
+}
+for (var [expr, named] of exprs) {
+ testAssignmentElement(expr, named);
+}
+
+function testSingleNameBinding(expr, named) {
+ var f = eval(`(function(param1 = ${expr}) { return param1; })`);
+ assertEq(f().name, named ? "named" : "param1");
+}
+for (var [expr, named] of exprs) {
+ testSingleNameBinding(expr, named);
+}
+
+if (typeof reportCompare === "function")
+ reportCompare(0, 0);
diff --git a/js/src/tests/ecma_6/Function/function-name-class.js b/js/src/tests/ecma_6/Function/function-name-class.js
new file mode 100644
index 0000000000..edde690556
--- /dev/null
+++ b/js/src/tests/ecma_6/Function/function-name-class.js
@@ -0,0 +1,32 @@
+var BUGNUMBER = 883377;
+var summary = "Anonymous class with name method shouldn't be affected by assignment";
+
+print(BUGNUMBER + ": " + summary);
+
+var classWithStaticNameMethod = class { static name() {} };
+assertEq(typeof classWithStaticNameMethod.name, "function");
+
+var classWithStaticNameGetter = class { static get name() { return "static name"; } };
+assertEq(typeof Object.getOwnPropertyDescriptor(classWithStaticNameGetter, "name").get, "function");
+assertEq(classWithStaticNameGetter.name, "static name");
+
+var classWithStaticNameSetter = class { static set name(v) {} };
+assertEq(typeof Object.getOwnPropertyDescriptor(classWithStaticNameSetter, "name").set, "function");
+
+var n = "NAME".toLowerCase();
+var classWithStaticNameMethodComputed = class { static [n]() {} };
+assertEq(typeof classWithStaticNameMethodComputed.name, "function");
+
+// It doesn't apply for non-static method.
+
+var classWithNameMethod = class { name() {} };
+assertEq(classWithNameMethod.name, "classWithNameMethod");
+
+var classWithNameGetter = class { get name() { return "name"; } };
+assertEq(classWithNameGetter.name, "classWithNameGetter");
+
+var classWithNameSetter = class { set name(v) {} };
+assertEq(classWithNameSetter.name, "classWithNameSetter");
+
+if (typeof reportCompare === "function")
+ reportCompare(0, 0);
diff --git a/js/src/tests/ecma_6/Function/function-name-for.js b/js/src/tests/ecma_6/Function/function-name-for.js
new file mode 100644
index 0000000000..2f04a5fa8d
--- /dev/null
+++ b/js/src/tests/ecma_6/Function/function-name-for.js
@@ -0,0 +1,31 @@
+var BUGNUMBER = 883377;
+var summary = "Anonymous function name should be set based on for-in initializer";
+
+print(BUGNUMBER + ": " + summary);
+
+var exprs = [
+ ["function() {}", false],
+ ["function named() {}", true],
+ ["function*() {}", false],
+ ["function* named() {}", true],
+ ["async function() {}", false],
+ ["async function named() {}", true],
+ ["() => {}", false],
+ ["async () => {}", false],
+ ["class {}", false],
+ ["class named {}", true],
+];
+
+function testForInHead(expr, named) {
+ eval(`
+ for (var forInHead = ${expr} in {}) {
+ }
+ `);
+ assertEq(forInHead.name, named ? "named" : "forInHead");
+}
+for (var [expr, named] of exprs) {
+ testForInHead(expr, named);
+}
+
+if (typeof reportCompare === "function")
+ reportCompare(0, 0);
diff --git a/js/src/tests/ecma_6/Function/function-name-method.js b/js/src/tests/ecma_6/Function/function-name-method.js
new file mode 100644
index 0000000000..3b2eeee793
--- /dev/null
+++ b/js/src/tests/ecma_6/Function/function-name-method.js
@@ -0,0 +1,70 @@
+var BUGNUMBER = 883377;
+var summary = "Anonymous function name should be set based on method definition";
+
+print(BUGNUMBER + ": " + summary);
+
+var fooSymbol = Symbol("foo");
+var emptySymbol = Symbol("");
+var undefSymbol = Symbol();
+
+function testMethod(prefix, classPrefix="", prototype=false) {
+ var param = (prefix == "set" || prefix == "static set") ? "v" : "";
+ var sep = classPrefix ? "" : ",";
+ var objOrClass = eval(`(${classPrefix}{
+ ${prefix} prop(${param}) {} ${sep}
+ ${prefix} "literal"(${param}) {} ${sep}
+ ${prefix} ""(${param}) {} ${sep}
+ ${prefix} 5(${param}) {} ${sep}
+ ${prefix} [Symbol.iterator](${param}) {} ${sep}
+ ${prefix} [fooSymbol](${param}) {} ${sep}
+ ${prefix} [emptySymbol](${param}) {} ${sep}
+ ${prefix} [undefSymbol](${param}) {} ${sep}
+ ${prefix} [/a/](${param}) {} ${sep}
+ })`);
+
+ var target = prototype ? objOrClass.prototype : objOrClass;
+
+ function testOne(methodName, expectedName) {
+ var f;
+ if (prefix == "get" || prefix == "static get") {
+ f = Object.getOwnPropertyDescriptor(target, methodName).get;
+ expectedName = "get " + expectedName;
+ } else if (prefix == "set" || prefix == "static set") {
+ f = Object.getOwnPropertyDescriptor(target, methodName).set;
+ expectedName = "set " + expectedName;
+ } else {
+ f = Object.getOwnPropertyDescriptor(target, methodName).value;
+ }
+
+ assertEq(f.name, expectedName);
+ }
+ testOne("prop", "prop");
+ testOne("literal", "literal");
+ testOne("", "");
+ testOne(5, "5");
+ testOne(Symbol.iterator, "[Symbol.iterator]");
+ testOne(fooSymbol, "[foo]");
+ testOne(emptySymbol, "[]");
+ testOne(undefSymbol, "");
+ testOne(/a/, "/a/");
+}
+testMethod("");
+testMethod("*");
+testMethod("async");
+testMethod("get");
+testMethod("set");
+
+testMethod("", "class", true);
+testMethod("*", "class", true);
+testMethod("async", "class", true);
+testMethod("get", "class", true);
+testMethod("set", "class", true);
+
+testMethod("static", "class");
+testMethod("static *", "class");
+testMethod("static async", "class");
+testMethod("static get", "class");
+testMethod("static set", "class");
+
+if (typeof reportCompare === "function")
+ reportCompare(0, 0);
diff --git a/js/src/tests/ecma_6/Function/function-name-property.js b/js/src/tests/ecma_6/Function/function-name-property.js
new file mode 100644
index 0000000000..7ad174b10f
--- /dev/null
+++ b/js/src/tests/ecma_6/Function/function-name-property.js
@@ -0,0 +1,58 @@
+var BUGNUMBER = 883377;
+var summary = "Anonymous function name should be set based on property name";
+
+print(BUGNUMBER + ": " + summary);
+
+var fooSymbol = Symbol("foo");
+var emptySymbol = Symbol("");
+var undefSymbol = Symbol();
+
+var exprs = [
+ ["function() {}", false],
+ ["function named() {}", true],
+ ["function*() {}", false],
+ ["function* named() {}", true],
+ ["async function() {}", false],
+ ["async function named() {}", true],
+ ["() => {}", false],
+ ["async () => {}", false],
+ ["class {}", false],
+ ["class named {}", true],
+];
+
+function testPropertyDefinition(expr, named) {
+ var obj = eval(`({
+ prop: ${expr},
+ "literal": ${expr},
+ "": ${expr},
+ 5: ${expr},
+ 0.4: ${expr},
+ [Symbol.iterator]: ${expr},
+ [fooSymbol]: ${expr},
+ [emptySymbol]: ${expr},
+ [undefSymbol]: ${expr},
+ [/a/]: ${expr},
+ })`);
+ assertEq(obj.prop.name, named ? "named" : "prop");
+ assertEq(obj["literal"].name, named ? "named" : "literal");
+ assertEq(obj[""].name, named ? "named" : "");
+ assertEq(obj[5].name, named ? "named" : "5");
+ assertEq(obj[0.4].name, named ? "named" : "0.4");
+ assertEq(obj[Symbol.iterator].name, named ? "named" : "[Symbol.iterator]");
+ assertEq(obj[fooSymbol].name, named ? "named" : "[foo]");
+ assertEq(obj[emptySymbol].name, named ? "named" : "[]");
+ assertEq(obj[undefSymbol].name, named ? "named" : "");
+ assertEq(obj[/a/].name, named ? "named" : "/a/");
+
+ // Not applicable cases: __proto__.
+ obj = {
+ __proto__: function() {}
+ };
+ assertEq(obj.__proto__.name, "");
+}
+for (var [expr, named] of exprs) {
+ testPropertyDefinition(expr, named);
+}
+
+if (typeof reportCompare === "function")
+ reportCompare(0, 0);
diff --git a/js/src/tests/ecma_6/Function/invalid-parameter-list.js b/js/src/tests/ecma_6/Function/invalid-parameter-list.js
new file mode 100644
index 0000000000..8aae89ef15
--- /dev/null
+++ b/js/src/tests/ecma_6/Function/invalid-parameter-list.js
@@ -0,0 +1,27 @@
+// This constructor behaves like `Function` without checking
+// if the parameter list end is at the expected position.
+// We use this to make sure that the tests we use are otherwise
+// syntactically correct.
+function DumpFunction(...args) {
+ let code = "function anonymous(";
+ code += args.slice(0, -1).join(", ");
+ code += ") {\n";
+ code += args[args.length -1];
+ code += "\n}";
+ eval(code);
+}
+
+const tests = [
+ ["/*", "*/) {"],
+ ["//", ") {"],
+ ["a = `", "` ) {"],
+ [") { var x = function (", "} "],
+ ["x = function (", "}) {"]
+];
+
+for (const test of tests) {
+ DumpFunction(...test);
+ assertThrowsInstanceOf(() => new Function(...test), SyntaxError);
+}
+
+reportCompare(0, 0, 'ok');
diff --git a/js/src/tests/ecma_6/Generators/construct-newtarget.js b/js/src/tests/ecma_6/Generators/construct-newtarget.js
new file mode 100644
index 0000000000..f2087852b0
--- /dev/null
+++ b/js/src/tests/ecma_6/Generators/construct-newtarget.js
@@ -0,0 +1,79 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+const GeneratorFunction = function*(){}.constructor;
+
+
+// Test subclassing %GeneratorFunction% works correctly.
+class MyGenerator extends GeneratorFunction {}
+
+var fn = new MyGenerator();
+assertEq(fn instanceof MyGenerator, true);
+assertEq(fn instanceof GeneratorFunction, true);
+assertEq(Object.getPrototypeOf(fn), MyGenerator.prototype);
+
+fn = Reflect.construct(MyGenerator, []);
+assertEq(fn instanceof MyGenerator, true);
+assertEq(fn instanceof GeneratorFunction, true);
+assertEq(Object.getPrototypeOf(fn), MyGenerator.prototype);
+
+fn = Reflect.construct(MyGenerator, [], MyGenerator);
+assertEq(fn instanceof MyGenerator, true);
+assertEq(fn instanceof GeneratorFunction, true);
+assertEq(Object.getPrototypeOf(fn), MyGenerator.prototype);
+
+fn = Reflect.construct(MyGenerator, [], GeneratorFunction);
+assertEq(fn instanceof MyGenerator, false);
+assertEq(fn instanceof GeneratorFunction, true);
+assertEq(Object.getPrototypeOf(fn), GeneratorFunction.prototype);
+
+
+// Set a different constructor as NewTarget.
+fn = Reflect.construct(MyGenerator, [], Array);
+assertEq(fn instanceof MyGenerator, false);
+assertEq(fn instanceof GeneratorFunction, false);
+assertEq(Object.getPrototypeOf(fn), Array.prototype);
+
+fn = Reflect.construct(GeneratorFunction, [], Array);
+assertEq(fn instanceof GeneratorFunction, false);
+assertEq(Object.getPrototypeOf(fn), Array.prototype);
+
+
+// The prototype defaults to %GeneratorFunctionPrototype% if null.
+function NewTargetNullPrototype() {}
+NewTargetNullPrototype.prototype = null;
+
+fn = Reflect.construct(GeneratorFunction, [], NewTargetNullPrototype);
+assertEq(fn instanceof GeneratorFunction, true);
+assertEq(Object.getPrototypeOf(fn), GeneratorFunction.prototype);
+
+fn = Reflect.construct(MyGenerator, [], NewTargetNullPrototype);
+assertEq(fn instanceof MyGenerator, false);
+assertEq(fn instanceof GeneratorFunction, true);
+assertEq(Object.getPrototypeOf(fn), GeneratorFunction.prototype);
+
+
+// "prototype" property is retrieved exactly once.
+var trapLog = [], getLog = [];
+var ProxiedConstructor = new Proxy(GeneratorFunction, new Proxy({
+ get(target, propertyKey, receiver) {
+ getLog.push(propertyKey);
+ return Reflect.get(target, propertyKey, receiver);
+ }
+}, {
+ get(target, propertyKey, receiver) {
+ trapLog.push(propertyKey);
+ return Reflect.get(target, propertyKey, receiver);
+ }
+}));
+
+fn = Reflect.construct(GeneratorFunction, [], ProxiedConstructor);
+assertEqArray(trapLog, ["get"]);
+assertEqArray(getLog, ["prototype"]);
+assertEq(fn instanceof GeneratorFunction, true);
+assertEq(Object.getPrototypeOf(fn), GeneratorFunction.prototype);
+
+
+if (typeof reportCompare === "function")
+ reportCompare(0, 0);
diff --git a/js/src/tests/ecma_6/Generators/delegating-yield-2.js b/js/src/tests/ecma_6/Generators/delegating-yield-2.js
index 918fb33e11..34cb3f4a9f 100644
--- a/js/src/tests/ecma_6/Generators/delegating-yield-2.js
+++ b/js/src/tests/ecma_6/Generators/delegating-yield-2.js
@@ -25,8 +25,8 @@ assertThrowsValue(function () { outer.throw(42) }, 42);
inner = g1();
outer = delegate(inner);
assertIteratorNext(outer, 1);
-inner.throw = function(e) { return e*2; };
-assertEq(84, outer.throw(42));
+inner.throw = function(e) { return { value: e*2 }; };
+assertEq(84, outer.throw(42).value);
assertIteratorDone(outer, undefined);
// Monkeypatching inner.next.
@@ -41,7 +41,9 @@ outer = delegate(inner);
assertIteratorNext(outer, 1);
delete GeneratorObjectPrototype.throw;
var outer_throw_42 = GeneratorObjectPrototype_throw.bind(outer, 42);
-assertThrowsValue(outer_throw_42, 42);
+// yield* protocol violation: no 'throw' method
+assertThrowsInstanceOf(outer_throw_42, TypeError);
+// Now done, so just throws.
assertThrowsValue(outer_throw_42, 42);
// Monkeypunch a different throw handler.
@@ -49,11 +51,11 @@ inner = g2();
outer = delegate(inner);
outer_throw_42 = GeneratorObjectPrototype_throw.bind(outer, 42);
assertIteratorNext(outer, 1);
-GeneratorObjectPrototype.throw = function(e) { return e*2; }
-assertEq(84, outer_throw_42());
-assertEq(84, outer_throw_42());
+GeneratorObjectPrototype.throw = function(e) { return { value: e*2 }; }
+assertEq(84, outer_throw_42().value);
+assertEq(84, outer_throw_42().value);
// This continues indefinitely.
-assertEq(84, outer_throw_42());
+assertEq(84, outer_throw_42().value);
assertIteratorDone(outer, undefined);
// The same, but restoring the original pre-monkey throw.
@@ -61,8 +63,8 @@ inner = g2();
outer = delegate(inner);
outer_throw_42 = GeneratorObjectPrototype_throw.bind(outer, 42);
assertIteratorNext(outer, 1);
-assertEq(84, outer_throw_42());
-assertEq(84, outer_throw_42());
+assertEq(84, outer_throw_42().value);
+assertEq(84, outer_throw_42().value);
GeneratorObjectPrototype.throw = GeneratorObjectPrototype_throw;
assertIteratorResult(outer_throw_42(), 42, false);
assertIteratorDone(outer, undefined);
diff --git a/js/src/tests/ecma_6/Generators/subclass.js b/js/src/tests/ecma_6/Generators/subclass.js
new file mode 100644
index 0000000000..f93f4df4db
--- /dev/null
+++ b/js/src/tests/ecma_6/Generators/subclass.js
@@ -0,0 +1,33 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+const GeneratorFunction = function*(){}.constructor;
+
+class MyGen extends GeneratorFunction {}
+
+// MyGen inherits from %GeneratorFunction%.
+assertEq(Object.getPrototypeOf(MyGen), GeneratorFunction);
+
+// MyGen.prototype inherits from %Generator%.
+assertEq(Object.getPrototypeOf(MyGen.prototype), GeneratorFunction.prototype);
+
+var fn = new MyGen("yield* [1, 2, 3]");
+
+// fn inherits from MyGen.prototype.
+assertEq(Object.getPrototypeOf(fn), MyGen.prototype);
+
+// fn.prototype inherits from %GeneratorPrototype%.
+assertEq(Object.getPrototypeOf(fn.prototype), GeneratorFunction.prototype.prototype);
+
+// Ensure the new generator function can be executed.
+var it = fn();
+
+// it inherits from fn.prototype.
+assertEq(Object.getPrototypeOf(it), fn.prototype);
+
+// Computes the expected result.
+assertEqArray([...it], [1, 2, 3]);
+
+if (typeof reportCompare === "function")
+ reportCompare(0, 0);
diff --git a/js/src/tests/ecma_6/Generators/yield-iterator-close.js b/js/src/tests/ecma_6/Generators/yield-iterator-close.js
new file mode 100644
index 0000000000..970ad494d2
--- /dev/null
+++ b/js/src/tests/ecma_6/Generators/yield-iterator-close.js
@@ -0,0 +1,58 @@
+// Test that IteratorClose is called when a Generator is abruptly completed by
+// Generator.return.
+
+var returnCalled = 0;
+function* wrapNoThrow() {
+ let iter = {
+ [Symbol.iterator]() {
+ return this;
+ },
+ next() {
+ return { value: 10, done: false };
+ },
+ return() {
+ returnCalled++;
+ return {};
+ }
+ };
+ for (const i of iter) {
+ yield i;
+ }
+}
+
+// Breaking calls Generator.return, which causes the yield above to resume with
+// an abrupt completion of kind "return", which then calls
+// iter.return.
+for (const i of wrapNoThrow()) {
+ break;
+}
+assertEq(returnCalled, 1);
+
+function* wrapThrow() {
+ let iter = {
+ [Symbol.iterator]() {
+ return this;
+ },
+ next() {
+ return { value: 10, done: false };
+ },
+ return() {
+ throw 42;
+ }
+ };
+ for (const i of iter) {
+ yield i;
+ }
+}
+
+// Breaking calls Generator.return, which, like above, calls iter.return. If
+// iter.return throws, since the yield is resuming with an abrupt completion of
+// kind "return", the newly thrown value takes precedence over returning.
+assertThrowsValue(() => {
+ for (const i of wrapThrow()) {
+ break;
+ }
+}, 42);
+
+if (typeof reportCompare === "function")
+ reportCompare(0, 0);
diff --git a/js/src/tests/ecma_6/Generators/yield-star-iterator-close.js b/js/src/tests/ecma_6/Generators/yield-star-iterator-close.js
new file mode 100644
index 0000000000..91ad31cb64
--- /dev/null
+++ b/js/src/tests/ecma_6/Generators/yield-star-iterator-close.js
@@ -0,0 +1,153 @@
+// Tests that the "return" method on iterators is called in yield*
+// expressions.
+
+function test() {
+ var returnCalled = 0;
+ var returnCalledExpected = 0;
+ var nextCalled = 0;
+ var nextCalledExpected = 0;
+ var throwCalled = 0;
+ var throwCalledExpected = 0;
+ var iterable = {};
+ iterable[Symbol.iterator] = makeIterator({
+ next: function() {
+ nextCalled++;
+ return { done: false };
+ },
+ ret: function() {
+ returnCalled++;
+ return { done: true, value: "iter.return" };
+ }
+ });
+
+ function* y() {
+ yield* iterable;
+ }
+
+ // G.p.throw on an iterator without "throw" calls IteratorClose.
+ var g1 = y();
+ g1.next();
+ assertThrowsInstanceOf(function() {
+ g1.throw("foo");
+ }, TypeError);
+ assertEq(returnCalled, ++returnCalledExpected);
+ assertEq(nextCalled, ++nextCalledExpected);
+ g1.next();
+ assertEq(nextCalled, nextCalledExpected);
+
+ // G.p.return calls "return", and if the result.done is true, return the
+ // result.
+ var g2 = y();
+ g2.next();
+ var v2 = g2.return("test return");
+ assertEq(v2.done, true);
+ assertEq(v2.value, "iter.return");
+ assertEq(returnCalled, ++returnCalledExpected);
+ assertEq(nextCalled, ++nextCalledExpected);
+ g2.next();
+ assertEq(nextCalled, nextCalledExpected);
+
+ // G.p.return calls "return", and if the result.done is false, continue
+ // yielding.
+ iterable[Symbol.iterator] = makeIterator({
+ next: function() {
+ nextCalled++;
+ return { done: false };
+ },
+ ret: function() {
+ returnCalled++;
+ return { done: false, value: "iter.return" };
+ }
+ });
+ var g3 = y();
+ g3.next();
+ var v3 = g3.return("test return");
+ assertEq(v3.done, false);
+ assertEq(v3.value, "iter.return");
+ assertEq(returnCalled, ++returnCalledExpected);
+ assertEq(nextCalled, ++nextCalledExpected);
+ g3.next();
+ assertEq(nextCalled, ++nextCalledExpected);
+
+ // G.p.return throwing does not re-call iter.return.
+ iterable[Symbol.iterator] = makeIterator({
+ ret: function() {
+ returnCalled++;
+ throw "in iter.return";
+ }
+ });
+ var g4 = y();
+ g4.next();
+ assertThrowsValue(function() {
+ g4.return("in test");
+ }, "in iter.return");
+ assertEq(returnCalled, ++returnCalledExpected);
+
+ // G.p.return expects iter.return to return an Object.
+ iterable[Symbol.iterator] = makeIterator({
+ ret: function() {
+ returnCalled++;
+ return 42;
+ }
+ });
+ var g5 = y();
+ g5.next();
+ assertThrowsInstanceOf(function() {
+ g5.return("foo");
+ }, TypeError);
+ assertEq(returnCalled, ++returnCalledExpected);
+
+ // IteratorClose expects iter.return to return an Object.
+ var g6 = y();
+ g6.next();
+ var exc;
+ try {
+ g6.throw("foo");
+ } catch (e) {
+ exc = e;
+ } finally {
+ assertEq(exc instanceof TypeError, true);
+ // The message test is here because instanceof TypeError doesn't
+ // distinguish the non-Object return TypeError and the
+ // throw-method-is-not-defined iterator protocol error.
+ assertEq(exc.toString().indexOf("non-object") > 0, true);
+ }
+ assertEq(returnCalled, ++returnCalledExpected);
+
+ // G.p.return passes its argument to "return".
+ iterable[Symbol.iterator] = makeIterator({
+ ret: function(x) {
+ assertEq(x, "in test");
+ returnCalled++;
+ return { done: true };
+ }
+ });
+ var g7 = y();
+ g7.next();
+ g7.return("in test");
+ assertEq(returnCalled, ++returnCalledExpected);
+
+ // If a throw method is present, do not call "return".
+ iterable[Symbol.iterator] = makeIterator({
+ throw: function(e) {
+ throwCalled++;
+ throw e;
+ },
+ ret: function(x) {
+ returnCalled++;
+ return { done: true };
+ }
+ });
+ var g8 = y();
+ g8.next();
+ assertThrowsValue(function() {
+ g8.throw("foo");
+ }, "foo");
+ assertEq(throwCalled, ++throwCalledExpected);
+ assertEq(returnCalled, returnCalledExpected);
+}
+
+test();
+
+if (typeof reportCompare === "function")
+ reportCompare(0, 0);
diff --git a/js/src/tests/ecma_6/Map/constructor-iterator-close.js b/js/src/tests/ecma_6/Map/constructor-iterator-close.js
new file mode 100644
index 0000000000..ba4bee4a74
--- /dev/null
+++ b/js/src/tests/ecma_6/Map/constructor-iterator-close.js
@@ -0,0 +1,253 @@
+var BUGNUMBER = 1180306;
+var summary = 'Map/Set/WeakMap/WeakSet constructor should close iterator on error';
+
+print(BUGNUMBER + ": " + summary);
+
+function test(ctors, { nextVal=undefined,
+ nextThrowVal=undefined,
+ modifier=undefined,
+ exceptionVal=undefined,
+ exceptionType=undefined,
+ closed=true }) {
+ function getIterable() {
+ let iterable = {
+ closed: false,
+ [Symbol.iterator]() {
+ let iterator = {
+ first: true,
+ next() {
+ if (this.first) {
+ this.first = false;
+ if (nextThrowVal)
+ throw nextThrowVal;
+ return nextVal;
+ }
+ return { value: undefined, done: true };
+ },
+ return() {
+ iterable.closed = true;
+ return {};
+ }
+ };
+ if (modifier)
+ modifier(iterator, iterable);
+
+ return iterator;
+ }
+ };
+ return iterable;
+ }
+
+ for (let ctor of ctors) {
+ let iterable = getIterable();
+ if (exceptionVal) {
+ let caught = false;
+ try {
+ new ctor(iterable);
+ } catch (e) {
+ assertEq(e, exceptionVal);
+ caught = true;
+ }
+ assertEq(caught, true);
+ } else if (exceptionType) {
+ assertThrowsInstanceOf(() => new ctor(iterable), exceptionType);
+ } else {
+ new ctor(iterable);
+ }
+ assertEq(iterable.closed, closed);
+ }
+}
+
+// == Error cases with close ==
+
+// ES 2017 draft 23.1.1.1 Map step 8.d.ii.
+// ES 2017 draft 23.3.1.1 WeakMap step 8.d.ii.
+test([Map, WeakMap], {
+ nextVal: { value: "non object", done: false },
+ exceptionType: TypeError,
+ closed: true,
+});
+
+// ES 2017 draft 23.1.1.1 Map step 8.f.
+// ES 2017 draft 23.3.1.1 WeakMap step 8.f.
+test([Map, WeakMap], {
+ nextVal: { value: { get 0() { throw "0 getter throws"; } }, done: false },
+ exceptionVal: "0 getter throws",
+ closed: true,
+});
+
+// ES 2017 draft 23.1.1.1 Map step 8.h.
+// ES 2017 draft 23.3.1.1 WeakMap step 8.h.
+test([Map, WeakMap], {
+ nextVal: { value: { 0: {}, get 1() { throw "1 getter throws"; } }, done: false },
+ exceptionVal: "1 getter throws",
+ closed: true,
+});
+
+// ES 2017 draft 23.1.1.1 Map step 8.j.
+// ES 2017 draft 23.3.1.1 WeakMap step 8.j.
+class MyMap extends Map {
+ set(k, v) {
+ throw "setter throws";
+ }
+}
+class MyWeakMap extends WeakMap {
+ set(k, v) {
+ throw "setter throws";
+ }
+}
+test([MyMap, MyWeakMap], {
+ nextVal: { value: [{}, {}], done: false },
+ exceptionVal: "setter throws",
+ closed: true,
+});
+
+// ES 2017 draft 23.2.1.1 Set step 8.e.
+// ES 2017 draft 23.4.1.1 WeakSet step 8.e.
+class MySet extends Set {
+ add(v) {
+ throw "adder throws";
+ }
+}
+class MyWeakSet extends WeakSet {
+ add(v) {
+ throw "adder throws";
+ }
+}
+test([MySet, MyWeakSet], {
+ nextVal: { value: {}, done: false },
+ exceptionVal: "adder throws",
+ closed: true,
+});
+
+// ES 2017 draft 7.4.6 step 3.
+// if GetMethod fails, the thrown value should be used.
+test([MyMap, MySet, MyWeakMap, MyWeakSet], {
+ nextVal: { value: [{}, {}], done: false },
+ modifier: (iterator, iterable) => {
+ Object.defineProperty(iterator, "return", {
+ get: function() {
+ iterable.closed = true;
+ throw "return getter throws";
+ }
+ });
+ },
+ exceptionVal: "return getter throws",
+ closed: true,
+});
+test([MyMap, MySet, MyWeakMap, MyWeakSet], {
+ nextVal: { value: [{}, {}], done: false },
+ modifier: (iterator, iterable) => {
+ Object.defineProperty(iterator, "return", {
+ get: function() {
+ iterable.closed = true;
+ return "non object";
+ }
+ });
+ },
+ exceptionType: TypeError,
+ closed: true,
+});
+test([MyMap, MySet, MyWeakMap, MyWeakSet], {
+ nextVal: { value: [{}, {}], done: false },
+ modifier: (iterator, iterable) => {
+ Object.defineProperty(iterator, "return", {
+ get: function() {
+ iterable.closed = true;
+ // Non callable.
+ return {};
+ }
+ });
+ },
+ exceptionType: TypeError,
+ closed: true,
+});
+
+// ES 2017 draft 7.4.6 steps 6.
+// if return method throws, the thrown value should be ignored.
+test([MyMap, MyWeakMap], {
+ nextVal: { value: [{}, {}], done: false },
+ modifier: (iterator, iterable) => {
+ iterator.return = function() {
+ iterable.closed = true;
+ throw "return throws";
+ };
+ },
+ exceptionVal: "setter throws",
+ closed: true,
+});
+test([MySet, MyWeakSet], {
+ nextVal: { value: [{}, {}], done: false },
+ modifier: (iterator, iterable) => {
+ iterator.return = function() {
+ iterable.closed = true;
+ throw "return throws";
+ };
+ },
+ exceptionVal: "adder throws",
+ closed: true,
+});
+
+test([MyMap, MyWeakMap], {
+ nextVal: { value: [{}, {}], done: false },
+ modifier: (iterator, iterable) => {
+ iterator.return = function() {
+ iterable.closed = true;
+ return "non object";
+ };
+ },
+ exceptionVal: "setter throws",
+ closed: true,
+});
+test([MySet, MyWeakSet], {
+ nextVal: { value: [{}, {}], done: false },
+ modifier: (iterator, iterable) => {
+ iterator.return = function() {
+ iterable.closed = true;
+ return "non object";
+ };
+ },
+ exceptionVal: "adder throws",
+ closed: true,
+});
+
+// == Error cases without close ==
+
+// ES 2017 draft 23.1.1.1 Map step 8.a.
+// ES 2017 draft 23.3.1.1 WeakMap step 8.a.
+// ES 2017 draft 23.2.1.1 Set step 8.a.
+// ES 2017 draft 23.4.1.1 WeakSet step 8.a.
+test([Map, WeakMap, Set, WeakSet], {
+ nextThrowVal: "next throws",
+ exceptionVal: "next throws",
+ closed: false,
+});
+test([Map, WeakMap, Set, WeakSet], {
+ nextVal: { value: {}, get done() { throw "done getter throws"; } },
+ exceptionVal: "done getter throws",
+ closed: false,
+});
+
+// ES 2017 draft 23.1.1.1 Map step 8.c.
+// ES 2017 draft 23.3.1.1 WeakMap step 8.c.
+// ES 2017 draft 23.2.1.1 Set step 8.c.
+// ES 2017 draft 23.4.1.1 WeakSet step 8.c.
+test([Map, WeakMap, Set, WeakSet], {
+ nextVal: { get value() { throw "value getter throws"; }, done: false },
+ exceptionVal: "value getter throws",
+ closed: false,
+});
+
+// == Successful cases ==
+
+test([Map, WeakMap], {
+ nextVal: { value: [{}, {}], done: false },
+ closed: false,
+});
+test([Set, WeakSet], {
+ nextVal: { value: {}, done: false },
+ closed: false,
+});
+
+if (typeof reportCompare === 'function')
+ reportCompare(true, true);
diff --git a/js/src/tests/ecma_6/Object/accessor-name.js b/js/src/tests/ecma_6/Object/accessor-name.js
index 1b5268e072..f238a2aefc 100644
--- a/js/src/tests/ecma_6/Object/accessor-name.js
+++ b/js/src/tests/ecma_6/Object/accessor-name.js
@@ -27,10 +27,9 @@ o = {get case() { }, set case(v) {}}
assertEq(name(o, "case", true), "get case");
assertEq(name(o, "case", false), "set case");
-// Congratulations on implementing these!
-assertEq(name({get ["a"]() {}}, "a", true), "");
-assertEq(name({get [123]() {}}, "123", true), "");
-assertEq(name({set ["a"](v) {}}, "a", false), "");
-assertEq(name({set [123](v) {}}, "123", false), "");
+assertEq(name({get ["a"]() {}}, "a", true), "get a");
+assertEq(name({get [123]() {}}, "123", true), "get 123");
+assertEq(name({set ["a"](v) {}}, "a", false), "set a");
+assertEq(name({set [123](v) {}}, "123", false), "set 123");
reportCompare(true, true);
diff --git a/js/src/tests/ecma_6/Promise/iterator-close.js b/js/src/tests/ecma_6/Promise/iterator-close.js
new file mode 100644
index 0000000000..f17260d05b
--- /dev/null
+++ b/js/src/tests/ecma_6/Promise/iterator-close.js
@@ -0,0 +1,234 @@
+// |reftest| skip-if(!xulRuntime.shell) -- needs drainJobQueue
+
+var BUGNUMBER = 1180306;
+var summary = 'Promise.{all,race} should close iterator on error';
+
+print(BUGNUMBER + ": " + summary);
+
+function test(ctor, props, { nextVal=undefined,
+ nextThrowVal=undefined,
+ modifier=undefined,
+ rejectReason=undefined,
+ rejectType=undefined,
+ closed=true }) {
+ function getIterable() {
+ let iterable = {
+ closed: false,
+ [Symbol.iterator]() {
+ let iterator = {
+ first: true,
+ next() {
+ if (this.first) {
+ this.first = false;
+ if (nextThrowVal)
+ throw nextThrowVal;
+ return nextVal;
+ }
+ return { value: undefined, done: true };
+ },
+ return() {
+ iterable.closed = true;
+ return {};
+ }
+ };
+ if (modifier)
+ modifier(iterator, iterable);
+
+ return iterator;
+ }
+ };
+ return iterable;
+ }
+ for (let prop of props) {
+ let iterable = getIterable();
+ let e;
+ ctor[prop](iterable).catch(e_ => { e = e_; });
+ drainJobQueue();
+ if(rejectType)
+ assertEq(e instanceof rejectType, true);
+ else
+ assertEq(e, rejectReason);
+ assertEq(iterable.closed, closed);
+ }
+}
+
+// == Error cases with close ==
+
+// ES 2017 draft 25.4.4.1.1 step 6.i.
+// ES 2017 draft 25.4.4.3.1 step 3.h.
+class MyPromiseStaticResolveGetterThrows extends Promise {
+ static get resolve() {
+ throw "static resolve getter throws";
+ }
+};
+test(MyPromiseStaticResolveGetterThrows, ["all", "race"], {
+ nextVal: { value: Promise.resolve(1), done: false },
+ rejectReason: "static resolve getter throws",
+ closed: true,
+});
+
+class MyPromiseStaticResolveThrows extends Promise {
+ static resolve() {
+ throw "static resolve throws";
+ }
+};
+test(MyPromiseStaticResolveThrows, ["all", "race"], {
+ nextVal: { value: Promise.resolve(1), done: false },
+ rejectReason: "static resolve throws",
+ closed: true,
+});
+
+// ES 2017 draft 25.4.4.1.1 step 6.q.
+// ES 2017 draft 25.4.4.3.1 step 3.i.
+class MyPromiseThenGetterThrows extends Promise {
+ static resolve() {
+ return {
+ get then() {
+ throw "then getter throws";
+ }
+ };
+ }
+};
+test(MyPromiseThenGetterThrows, ["all", "race"], {
+ nextVal: { value: Promise.resolve(1), done: false },
+ rejectReason: "then getter throws",
+ closed: true,
+});
+
+class MyPromiseThenThrows extends Promise {
+ static resolve() {
+ return {
+ then() {
+ throw "then throws";
+ }
+ };
+ }
+};
+test(MyPromiseThenThrows, ["all", "race"], {
+ nextVal: { value: Promise.resolve(1), done: false },
+ rejectReason: "then throws",
+ closed: true,
+});
+
+// ES 2017 draft 7.4.6 step 3.
+// if GetMethod fails, the thrown value should be used.
+test(MyPromiseThenThrows, ["all", "race"], {
+ nextVal: { value: Promise.resolve(1), done: false },
+ modifier: (iterator, iterable) => {
+ Object.defineProperty(iterator, "return", {
+ get: function() {
+ iterable.closed = true;
+ throw "return getter throws";
+ }
+ });
+ },
+ rejectReason: "return getter throws",
+ closed: true,
+});
+test(MyPromiseThenThrows, ["all", "race"], {
+ nextVal: { value: Promise.resolve(1), done: false },
+ modifier: (iterator, iterable) => {
+ Object.defineProperty(iterator, "return", {
+ get: function() {
+ iterable.closed = true;
+ return "non object";
+ }
+ });
+ },
+ rejectType: TypeError,
+ closed: true,
+});
+test(MyPromiseThenThrows, ["all", "race"], {
+ nextVal: { value: Promise.resolve(1), done: false },
+ modifier: (iterator, iterable) => {
+ Object.defineProperty(iterator, "return", {
+ get: function() {
+ iterable.closed = true;
+ // Non callable.
+ return {};
+ }
+ });
+ },
+ rejectType: TypeError,
+ closed: true,
+});
+
+// ES 2017 draft 7.4.6 steps 6.
+// if return method throws, the thrown value should be ignored.
+test(MyPromiseThenThrows, ["all", "race"], {
+ nextVal: { value: Promise.resolve(1), done: false },
+ modifier: (iterator, iterable) => {
+ iterator.return = function() {
+ iterable.closed = true;
+ throw "return throws";
+ };
+ },
+ rejectReason: "then throws",
+ closed: true,
+});
+
+test(MyPromiseThenThrows, ["all", "race"], {
+ nextVal: { value: Promise.resolve(1), done: false },
+ modifier: (iterator, iterable) => {
+ iterator.return = function() {
+ iterable.closed = true;
+ return "non object";
+ };
+ },
+ rejectReason: "then throws",
+ closed: true,
+});
+
+// == Error cases without close ==
+
+// ES 2017 draft 25.4.4.1.1 step 6.a.
+test(Promise, ["all", "race"], {
+ nextThrowVal: "next throws",
+ rejectReason: "next throws",
+ closed: false,
+});
+
+test(Promise, ["all", "race"], {
+ nextVal: { value: {}, get done() { throw "done getter throws"; } },
+ rejectReason: "done getter throws",
+ closed: false,
+});
+
+// ES 2017 draft 25.4.4.1.1 step 6.e.
+test(Promise, ["all", "race"], {
+ nextVal: { get value() { throw "value getter throws"; }, done: false },
+ rejectReason: "value getter throws",
+ closed: false,
+});
+
+// ES 2017 draft 25.4.4.1.1 step 6.d.iii.2.
+let first = true;
+class MyPromiseResolveThrows extends Promise {
+ constructor(executer) {
+ if (first) {
+ first = false;
+ super((resolve, reject) => {
+ executer(() => {
+ throw "resolve throws";
+ }, reject);
+ });
+ return;
+ }
+ super(executer);
+ }
+};
+test(MyPromiseResolveThrows, ["all"], {
+ nextVal: { value: undefined, done: true },
+ rejectReason: "resolve throws",
+ closed: false,
+});
+
+// == Successful cases ==
+
+test(Promise, ["all", "race"], {
+ nextVal: { value: Promise.resolve(1), done: false },
+ closed: false,
+});
+
+if (typeof reportCompare === 'function')
+ reportCompare(true, true);
diff --git a/js/src/tests/ecma_6/RegExp/compile-lastIndex.js b/js/src/tests/ecma_6/RegExp/compile-lastIndex.js
index 80c820f43d..5bd7e0b983 100644
--- a/js/src/tests/ecma_6/RegExp/compile-lastIndex.js
+++ b/js/src/tests/ecma_6/RegExp/compile-lastIndex.js
@@ -17,15 +17,12 @@ print(BUGNUMBER + ": " + summary);
var regex = /foo/i;
-// Aside from making .lastIndex non-writable, this has two incidental effects
+// Aside from making .lastIndex non-writable, this has one incidental effect
// ubiquitously tested through the remainder of this test:
//
// * RegExp.prototype.compile will do everything it ordinarily does, BUT it
// will throw a TypeError when attempting to zero .lastIndex immediately
// before succeeding overall.
-// * RegExp.prototype.test for a non-global and non-sticky regular expression,
-// in case of a match, will return true (as normal). BUT if no match is
-// found, it will throw a TypeError when attempting to modify .lastIndex.
//
// Ain't it great?
Object.defineProperty(regex, "lastIndex", { value: 42, writable: false });
@@ -40,8 +37,8 @@ assertEq(regex.lastIndex, 42);
assertEq(regex.test("foo"), true);
assertEq(regex.test("FOO"), true);
-assertThrowsInstanceOf(() => regex.test("bar"), TypeError);
-assertThrowsInstanceOf(() => regex.test("BAR"), TypeError);
+assertEq(regex.test("bar"), false);
+assertEq(regex.test("BAR"), false);
assertThrowsInstanceOf(() => regex.compile("bar"), TypeError);
@@ -52,10 +49,10 @@ assertEq(regex.unicode, false);
assertEq(regex.sticky, false);
assertEq(Object.getOwnPropertyDescriptor(regex, "lastIndex").writable, false);
assertEq(regex.lastIndex, 42);
-assertThrowsInstanceOf(() => regex.test("foo"), TypeError);
-assertThrowsInstanceOf(() => regex.test("FOO"), TypeError);
+assertEq(regex.test("foo"), false);
+assertEq(regex.test("FOO"), false);
assertEq(regex.test("bar"), true);
-assertThrowsInstanceOf(() => regex.test("BAR"), TypeError);
+assertEq(regex.test("BAR"), false);
assertThrowsInstanceOf(() => regex.compile("^baz", "m"), TypeError);
@@ -66,19 +63,16 @@ assertEq(regex.unicode, false);
assertEq(regex.sticky, false);
assertEq(Object.getOwnPropertyDescriptor(regex, "lastIndex").writable, false);
assertEq(regex.lastIndex, 42);
-assertThrowsInstanceOf(() => regex.test("foo"), TypeError);
-assertThrowsInstanceOf(() => regex.test("FOO"), TypeError);
-assertThrowsInstanceOf(() => regex.test("bar"), TypeError);
-assertThrowsInstanceOf(() => regex.test("BAR"), TypeError);
+assertEq(regex.test("foo"), false);
+assertEq(regex.test("FOO"), false);
+assertEq(regex.test("bar"), false);
+assertEq(regex.test("BAR"), false);
assertEq(regex.test("baz"), true);
-assertThrowsInstanceOf(() => regex.test("BAZ"), TypeError);
-assertThrowsInstanceOf(() => regex.test("012345678901234567890123456789012345678901baz"),
- TypeError);
+assertEq(regex.test("BAZ"), false);
+assertEq(regex.test("012345678901234567890123456789012345678901baz"), false);
assertEq(regex.test("012345678901234567890123456789012345678901\nbaz"), true);
-assertThrowsInstanceOf(() => regex.test("012345678901234567890123456789012345678901BAZ"),
- TypeError);
-assertThrowsInstanceOf(() => regex.test("012345678901234567890123456789012345678901\nBAZ"),
- TypeError);
+assertEq(regex.test("012345678901234567890123456789012345678901BAZ"), false);
+assertEq(regex.test("012345678901234567890123456789012345678901\nBAZ"), false);
/******************************************************************************/
diff --git a/js/src/tests/ecma_6/RegExp/compile-symbol.js b/js/src/tests/ecma_6/RegExp/compile-symbol.js
new file mode 100644
index 0000000000..9eea1124c8
--- /dev/null
+++ b/js/src/tests/ecma_6/RegExp/compile-symbol.js
@@ -0,0 +1,14 @@
+/* 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/. */
+
+for (let sym of [Symbol.iterator, Symbol(), Symbol("description")]) {
+ let re = /a/;
+
+ assertEq(re.source, "a");
+ assertThrowsInstanceOf(() => re.compile(sym), TypeError);
+ assertEq(re.source, "a");
+}
+
+if (typeof reportCompare === 'function')
+ reportCompare(0, 0);
diff --git a/js/src/tests/ecma_6/RegExp/constructor-symbol.js b/js/src/tests/ecma_6/RegExp/constructor-symbol.js
new file mode 100644
index 0000000000..503d7e5a85
--- /dev/null
+++ b/js/src/tests/ecma_6/RegExp/constructor-symbol.js
@@ -0,0 +1,14 @@
+/* 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/. */
+
+for (let sym of [Symbol.iterator, Symbol(), Symbol("description")]) {
+ assertThrowsInstanceOf(() => RegExp(sym), TypeError);
+ assertThrowsInstanceOf(() => new RegExp(sym), TypeError);
+
+ assertThrowsInstanceOf(() => RegExp(sym, "g"), TypeError);
+ assertThrowsInstanceOf(() => new RegExp(sym, "g"), TypeError);
+}
+
+if (typeof reportCompare === 'function')
+ reportCompare(0, 0);
diff --git a/js/src/tests/ecma_6/RegExp/match-local-tolength-recompilation.js b/js/src/tests/ecma_6/RegExp/match-local-tolength-recompilation.js
new file mode 100644
index 0000000000..9a992f81f4
--- /dev/null
+++ b/js/src/tests/ecma_6/RegExp/match-local-tolength-recompilation.js
@@ -0,0 +1,75 @@
+// Side-effects when calling ToLength(regExp.lastIndex) in
+// RegExp.prototype[@@match] for non-global RegExp can recompile the RegExp.
+
+for (var flag of ["", "y"]) {
+ var regExp = new RegExp("a", flag);
+
+ regExp.lastIndex = {
+ valueOf() {
+ regExp.compile("b");
+ return 0;
+ }
+ };
+
+ var result = regExp[Symbol.match]("b");
+ assertEq(result !== null, true);
+}
+
+// Recompilation modifies flag:
+// Case 1: Adds global flag, validate by checking lastIndex.
+var regExp = new RegExp("a", "");
+regExp.lastIndex = {
+ valueOf() {
+ // |regExp| is now in global mode, RegExpBuiltinExec should update the
+ // lastIndex property to reflect last match.
+ regExp.compile("a", "g");
+ return 0;
+ }
+};
+regExp[Symbol.match]("a");
+assertEq(regExp.lastIndex, 1);
+
+// Case 2: Removes sticky flag with match, validate by checking lastIndex.
+var regExp = new RegExp("a", "y");
+regExp.lastIndex = {
+ valueOf() {
+ // |regExp| is no longer sticky, RegExpBuiltinExec shouldn't modify the
+ // lastIndex property.
+ regExp.compile("a", "");
+ regExp.lastIndex = 9000;
+ return 0;
+ }
+};
+regExp[Symbol.match]("a");
+assertEq(regExp.lastIndex, 9000);
+
+// Case 3.a: Removes sticky flag without match, validate by checking lastIndex.
+var regExp = new RegExp("a", "y");
+regExp.lastIndex = {
+ valueOf() {
+ // |regExp| is no longer sticky, RegExpBuiltinExec shouldn't modify the
+ // lastIndex property.
+ regExp.compile("b", "");
+ regExp.lastIndex = 9001;
+ return 0;
+ }
+};
+regExp[Symbol.match]("a");
+assertEq(regExp.lastIndex, 9001);
+
+// Case 3.b: Removes sticky flag without match, validate by checking lastIndex.
+var regExp = new RegExp("a", "y");
+regExp.lastIndex = {
+ valueOf() {
+ // |regExp| is no longer sticky, RegExpBuiltinExec shouldn't modify the
+ // lastIndex property.
+ regExp.compile("b", "");
+ regExp.lastIndex = 9002;
+ return 10000;
+ }
+};
+regExp[Symbol.match]("a");
+assertEq(regExp.lastIndex, 9002);
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
diff --git a/js/src/tests/ecma_6/RegExp/prototype.js b/js/src/tests/ecma_6/RegExp/prototype.js
new file mode 100644
index 0000000000..528142ab0c
--- /dev/null
+++ b/js/src/tests/ecma_6/RegExp/prototype.js
@@ -0,0 +1,31 @@
+const t = RegExp.prototype;
+
+const properties = "toSource,toString,compile,exec,test," +
+ "flags,global,ignoreCase,multiline,source,sticky,unicode," +
+ "constructor," +
+ "Symbol(Symbol.match),Symbol(Symbol.replace),Symbol(Symbol.search),Symbol(Symbol.split)";
+assertEq(Reflect.ownKeys(t).map(String).toString(), properties);
+
+
+// Invoking getters on the prototype should not throw
+function getter(name) {
+ return Object.getOwnPropertyDescriptor(t, name).get.call(t);
+}
+
+assertEq(getter("flags"), "");
+assertEq(getter("global"), undefined);
+assertEq(getter("ignoreCase"), undefined);
+assertEq(getter("multiline"), undefined);
+assertEq(getter("source"), "(?:)");
+assertEq(getter("sticky"), undefined);
+assertEq(getter("unicode"), undefined);
+
+assertEq(t.toString(), "/(?:)/");
+
+// The methods don't work with the prototype
+assertThrowsInstanceOf(() => t.compile("b", "i"), TypeError);
+assertThrowsInstanceOf(() => t.test("x"), TypeError);
+assertThrowsInstanceOf(() => t.exec("x"), TypeError);
+
+if (typeof reportCompare === "function")
+ reportCompare(0, 0);
diff --git a/js/src/tests/ecma_6/RegExp/replace-local-tolength-lastindex.js b/js/src/tests/ecma_6/RegExp/replace-local-tolength-lastindex.js
new file mode 100644
index 0000000000..7ba840e000
--- /dev/null
+++ b/js/src/tests/ecma_6/RegExp/replace-local-tolength-lastindex.js
@@ -0,0 +1,22 @@
+// RegExp.prototype[@@replace] always executes ToLength(regExp.lastIndex) for
+// non-global RegExps.
+
+for (var flag of ["", "g", "y", "gy"]) {
+ var regExp = new RegExp("a", flag);
+
+ var called = false;
+ regExp.lastIndex = {
+ valueOf() {
+ assertEq(called, false);
+ called = true;
+ return 0;
+ }
+ };
+
+ assertEq(called, false);
+ regExp[Symbol.replace]("");
+ assertEq(called, !flag.includes("g"));
+}
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
diff --git a/js/src/tests/ecma_6/RegExp/replace-local-tolength-recompilation.js b/js/src/tests/ecma_6/RegExp/replace-local-tolength-recompilation.js
new file mode 100644
index 0000000000..e03177286f
--- /dev/null
+++ b/js/src/tests/ecma_6/RegExp/replace-local-tolength-recompilation.js
@@ -0,0 +1,75 @@
+// Side-effects when calling ToLength(regExp.lastIndex) in
+// RegExp.prototype[@@replace] for non-global RegExp can recompile the RegExp.
+
+for (var flag of ["", "y"]) {
+ var regExp = new RegExp("a", flag);
+
+ regExp.lastIndex = {
+ valueOf() {
+ regExp.compile("b");
+ return 0;
+ }
+ };
+
+ var result = regExp[Symbol.replace]("b", "pass");
+ assertEq(result, "pass");
+}
+
+// Recompilation modifies flag:
+// Case 1: Adds global flag, validate by checking lastIndex.
+var regExp = new RegExp("a", "");
+regExp.lastIndex = {
+ valueOf() {
+ // |regExp| is now in global mode, RegExpBuiltinExec should update the
+ // lastIndex property to reflect last match.
+ regExp.compile("a", "g");
+ return 0;
+ }
+};
+regExp[Symbol.replace]("a", "");
+assertEq(regExp.lastIndex, 1);
+
+// Case 2: Removes sticky flag with match, validate by checking lastIndex.
+var regExp = new RegExp("a", "y");
+regExp.lastIndex = {
+ valueOf() {
+ // |regExp| is no longer sticky, RegExpBuiltinExec shouldn't modify the
+ // lastIndex property.
+ regExp.compile("a", "");
+ regExp.lastIndex = 9000;
+ return 0;
+ }
+};
+regExp[Symbol.replace]("a", "");
+assertEq(regExp.lastIndex, 9000);
+
+// Case 3.a: Removes sticky flag without match, validate by checking lastIndex.
+var regExp = new RegExp("a", "y");
+regExp.lastIndex = {
+ valueOf() {
+ // |regExp| is no longer sticky, RegExpBuiltinExec shouldn't modify the
+ // lastIndex property.
+ regExp.compile("b", "");
+ regExp.lastIndex = 9001;
+ return 0;
+ }
+};
+regExp[Symbol.replace]("a", "");
+assertEq(regExp.lastIndex, 9001);
+
+// Case 3.b: Removes sticky flag without match, validate by checking lastIndex.
+var regExp = new RegExp("a", "y");
+regExp.lastIndex = {
+ valueOf() {
+ // |regExp| is no longer sticky, RegExpBuiltinExec shouldn't modify the
+ // lastIndex property.
+ regExp.compile("b", "");
+ regExp.lastIndex = 9002;
+ return 10000;
+ }
+};
+regExp[Symbol.replace]("a", "");
+assertEq(regExp.lastIndex, 9002);
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
diff --git a/js/src/tests/ecma_6/RegExp/search-trace.js b/js/src/tests/ecma_6/RegExp/search-trace.js
index ef14514c65..fc6bee754c 100644
--- a/js/src/tests/ecma_6/RegExp/search-trace.js
+++ b/js/src/tests/ecma_6/RegExp/search-trace.js
@@ -56,6 +56,7 @@ assertEq(log,
"get:lastIndex," +
"set:lastIndex," +
"get:exec,call:exec," +
+ "get:lastIndex," +
"set:lastIndex," +
"get:result[index],");
@@ -70,6 +71,7 @@ assertEq(log,
"get:lastIndex," +
"set:lastIndex," +
"get:exec,call:exec," +
+ "get:lastIndex," +
"set:lastIndex,");
if (typeof reportCompare === "function")
diff --git a/js/src/tests/ecma_6/Statements/for-inof-finally.js b/js/src/tests/ecma_6/Statements/for-inof-finally.js
new file mode 100644
index 0000000000..e1f0c77e12
--- /dev/null
+++ b/js/src/tests/ecma_6/Statements/for-inof-finally.js
@@ -0,0 +1,78 @@
+var BUGNUMBER = 1332881;
+var summary =
+ "Leaving for-in and try should handle stack value in correct order";
+
+print(BUGNUMBER + ": " + summary);
+
+var called = 0;
+function reset() {
+ called = 0;
+}
+var obj = {
+ [Symbol.iterator]() {
+ return {
+ next() {
+ return { value: 10, done: false };
+ },
+ return() {
+ called++;
+ return {};
+ }
+ };
+ }
+};
+
+var a = (function () {
+ for (var x in [0]) {
+ try {} finally {
+ return 11;
+ }
+ }
+})();
+assertEq(a, 11);
+
+reset();
+var b = (function () {
+ for (var x of obj) {
+ try {} finally {
+ return 12;
+ }
+ }
+})();
+assertEq(called, 1);
+assertEq(b, 12);
+
+reset();
+var c = (function () {
+ for (var x in [0]) {
+ for (var y of obj) {
+ try {} finally {
+ return 13;
+ }
+ }
+ }
+})();
+assertEq(called, 1);
+assertEq(c, 13);
+
+reset();
+var d = (function () {
+ for (var x in [0]) {
+ for (var y of obj) {
+ try {} finally {
+ for (var z in [0]) {
+ for (var w of obj) {
+ try {} finally {
+ return 14;
+ }
+ }
+ }
+ }
+ }
+ }
+})();
+assertEq(called, 2);
+assertEq(d, 14);
+
+if (typeof reportCompare === "function")
+ reportCompare(true, true);
diff --git a/js/src/tests/ecma_6/Statements/for-of-iterator-close-throw.js b/js/src/tests/ecma_6/Statements/for-of-iterator-close-throw.js
new file mode 100644
index 0000000000..1974e416be
--- /dev/null
+++ b/js/src/tests/ecma_6/Statements/for-of-iterator-close-throw.js
@@ -0,0 +1,35 @@
+function test() {
+ var returnCalled = 0;
+ var returnCalledExpected = 0;
+ var catchEntered = 0;
+ var finallyEntered = 0;
+ var finallyEnteredExpected = 0;
+ var iterable = {};
+ iterable[Symbol.iterator] = makeIterator({
+ ret: function() {
+ returnCalled++;
+ throw 42;
+ }
+ });
+
+ // inner try cannot catch IteratorClose throwing
+ assertThrowsValue(function() {
+ for (var x of iterable) {
+ try {
+ return;
+ } catch (e) {
+ catchEntered++;
+ } finally {
+ finallyEntered++;
+ }
+ }
+ }, 42);
+ assertEq(returnCalled, ++returnCalledExpected);
+ assertEq(catchEntered, 0);
+ assertEq(finallyEntered, ++finallyEnteredExpected);
+}
+
+test();
+
+if (typeof reportCompare === "function")
+ reportCompare(0, 0);
diff --git a/js/src/tests/ecma_6/Statements/for-of-iterator-close.js b/js/src/tests/ecma_6/Statements/for-of-iterator-close.js
new file mode 100644
index 0000000000..b28895d8fe
--- /dev/null
+++ b/js/src/tests/ecma_6/Statements/for-of-iterator-close.js
@@ -0,0 +1,102 @@
+// Tests that IteratorReturn is called when a for-of loop has an abrupt
+// completion value during non-iterator code.
+
+function test() {
+ var returnCalled = 0;
+ var returnCalledExpected = 0;
+ var iterable = {};
+ iterable[Symbol.iterator] = makeIterator({
+ ret: function() {
+ returnCalled++;
+ return {};
+ }
+ });
+
+ // break calls iter.return
+ for (var x of iterable)
+ break;
+ assertEq(returnCalled, ++returnCalledExpected);
+
+ // throw in body calls iter.return
+ assertThrowsValue(function() {
+ for (var x of iterable)
+ throw "in body";
+ }, "in body");
+ assertEq(returnCalled, ++returnCalledExpected);
+
+ // throw in lhs ref calls iter.return
+ function throwlhs() {
+ throw "in lhs";
+ }
+ assertThrowsValue(function() {
+ for ((throwlhs()) of iterable)
+ continue;
+ }, "in lhs");
+ assertEq(returnCalled, ++returnCalledExpected);
+
+ // throw in iter.return doesn't re-call iter.return
+ iterable[Symbol.iterator] = makeIterator({
+ ret: function() {
+ returnCalled++;
+ throw "in iter.return";
+ }
+ });
+ assertThrowsValue(function() {
+ for (var x of iterable)
+ break;
+ }, "in iter.return");
+ assertEq(returnCalled, ++returnCalledExpected);
+
+ // throw in iter.next doesn't call IteratorClose
+ iterable[Symbol.iterator] = makeIterator({
+ next: function() {
+ throw "in next";
+ }
+ });
+ assertThrowsValue(function() {
+ for (var x of iterable)
+ break;
+ }, "in next");
+ assertEq(returnCalled, returnCalledExpected);
+
+ // "return" must return an Object.
+ iterable[Symbol.iterator] = makeIterator({
+ ret: function() {
+ returnCalled++;
+ return 42;
+ }
+ });
+ assertThrowsInstanceOf(function() {
+ for (var x of iterable)
+ break;
+ }, TypeError);
+ assertEq(returnCalled, ++returnCalledExpected);
+
+ // continue doesn't call iter.return for the loop it's continuing
+ var i = 0;
+ iterable[Symbol.iterator] = makeIterator({
+ next: function() {
+ return { done: i++ > 5 };
+ },
+ ret: function() {
+ returnCalled++;
+ return {};
+ }
+ });
+ for (var x of iterable)
+ continue;
+ assertEq(returnCalled, returnCalledExpected);
+
+ // continue does call iter.return for loops it skips
+ i = 0;
+ L: do {
+ for (var x of iterable)
+ continue L;
+ } while (false);
+ assertEq(returnCalled, ++returnCalledExpected);
+}
+
+test();
+
+if (typeof reportCompare === "function")
+ reportCompare(0, 0);
diff --git a/js/src/tests/ecma_6/Syntax/identifiers-with-extended-unicode-escape.js b/js/src/tests/ecma_6/Syntax/identifiers-with-extended-unicode-escape.js
index 8e0a05fb50..e4b5f46029 100644
--- a/js/src/tests/ecma_6/Syntax/identifiers-with-extended-unicode-escape.js
+++ b/js/src/tests/ecma_6/Syntax/identifiers-with-extended-unicode-escape.js
@@ -98,7 +98,7 @@ const otherIdContinue = [
0x19DA, // NEW TAI LUE THAM DIGIT ONE, Gc=No
];
-for (let ident of [...idStart, ...otherIdStart]) {
+for (let ident of [...idStart, ...otherIdStart, ...idStartSupplemental]) {
for (let count of leadingZeros) {
let zeros = "0".repeat(count);
eval(`
@@ -108,20 +108,13 @@ for (let ident of [...idStart, ...otherIdStart]) {
}
}
-// Move this to the loop above when Bug 1197230 is fixed.
-for (let ident of [...idStartSupplemental]) {
- for (let zeros of leadingZeros) {
- assertThrowsInstanceOf(() => eval(`\\u{${zeros}${ident.toString(16)}}`), SyntaxError);
- }
-}
-
for (let ident of [...idContinue, ...idContinueSupplemental, ...otherIdContinue]) {
for (let zeros of leadingZeros) {
assertThrowsInstanceOf(() => eval(`\\u{${zeros}${ident.toString(16)}}`), SyntaxError);
}
}
-for (let ident of [...idStart, ...otherIdStart, ...idContinue, ...otherIdContinue]) {
+for (let ident of [...idStart, ...otherIdStart, ...idContinue, ...otherIdContinue, ...idStartSupplemental, ...idContinueSupplemental]) {
for (let zeros of leadingZeros) {
eval(`
let A\\u{${zeros}${ident.toString(16)}} = 123;
@@ -130,13 +123,6 @@ for (let ident of [...idStart, ...otherIdStart, ...idContinue, ...otherIdContinu
}
}
-// Move this to the loop above when Bug 1197230 is fixed.
-for (let ident of [...idStartSupplemental, ...idContinueSupplemental]) {
- for (let zeros of leadingZeros) {
- assertThrowsInstanceOf(() => eval(`\\u{${zeros}${ident.toString(16)}}`), SyntaxError);
- }
-}
-
const notIdentifiers = [
0x0000, // NULL, Gc=Cc
diff --git a/js/src/tests/ecma_6/shell.js b/js/src/tests/ecma_6/shell.js
index 06be6f2db6..756da9f36c 100644
--- a/js/src/tests/ecma_6/shell.js
+++ b/js/src/tests/ecma_6/shell.js
@@ -3,21 +3,43 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
(function(global) {
- /** Yield every permutation of the elements in some array. */
- global.Permutations = function* Permutations(items) {
- if (items.length == 0) {
- yield [];
- } else {
- items = items.slice(0);
- for (let i = 0; i < items.length; i++) {
- let swap = items[0];
- items[0] = items[i];
- items[i] = swap;
- for (let e of Permutations(items.slice(1, items.length)))
- yield [items[0]].concat(e);
- }
- }
- };
+ /** Yield every permutation of the elements in some array. */
+ global.Permutations = function* Permutations(items) {
+ if (items.length == 0) {
+ yield [];
+ } else {
+ items = items.slice(0);
+ for (let i = 0; i < items.length; i++) {
+ let swap = items[0];
+ items[0] = items[i];
+ items[i] = swap;
+ for (let e of Permutations(items.slice(1, items.length)))
+ yield [items[0]].concat(e);
+ }
+ }
+ };
+
+ /** Make an iterator with a return method. */
+ global.makeIterator = function makeIterator(overrides) {
+ var throwMethod;
+ if (overrides && overrides.throw)
+ throwMethod = overrides.throw;
+ var iterator = {
+ throw: throwMethod,
+ next: function(x) {
+ if (overrides && overrides.next)
+ return overrides.next(x);
+ return { done: false };
+ },
+ return: function(x) {
+ if (overrides && overrides.ret)
+ return overrides.ret(x);
+ return { done: true };
+ }
+ };
+
+ return function() { return iterator; };
+ };
})(this);
if (typeof assertThrowsInstanceOf === 'undefined') {
diff --git a/js/src/tests/js1_8_5/extensions/clone-regexp.js b/js/src/tests/js1_8_5/extensions/clone-regexp.js
index 97f7557853..8541dae98c 100644
--- a/js/src/tests/js1_8_5/extensions/clone-regexp.js
+++ b/js/src/tests/js1_8_5/extensions/clone-regexp.js
@@ -22,7 +22,6 @@ function testRegExp(b, c=b) {
testRegExp(RegExp(""));
testRegExp(/(?:)/);
testRegExp(/^(.*)$/gimy);
-testRegExp(RegExp.prototype);
var re = /\bx\b/gi;
re.expando = true;
diff --git a/js/src/tests/jstests.list b/js/src/tests/jstests.list
index a0f2f08bdd..1e23a3da37 100644
--- a/js/src/tests/jstests.list
+++ b/js/src/tests/jstests.list
@@ -46,6 +46,16 @@ skip script test262/ch09/9.3/9.3.1/S9.3.1_A2.js
skip script test262/ch09/9.3/9.3.1/S9.3.1_A3_T2.js
skip script test262/ch09/9.3/9.3.1/S9.3.1_A3_T1.js
+# ES2017 removed the strict arguments poison pill for the "caller" property
+# (bug 1324208).
+skip script test262/ch13/13.2/S13.2.3_A1.js
+skip script test262/ch10/10.6/10.6-14-1-s.js
+skip script test262/ch10/10.6/10.6-13-b-3-s.js
+skip script test262/ch10/10.6/10.6-14-b-1-s.js
+skip script test262/ch10/10.6/10.6-14-b-4-s.js
+skip script test262/ch10/10.6/10.6-13-b-1-s.js
+skip script test262/ch10/10.6/10.6-13-b-2-s.js
+
#######################################################################
# Tests disabled due to jstest limitations wrt imported test262 tests #
#######################################################################
diff --git a/js/src/threading/windows/ConditionVariable.cpp b/js/src/threading/windows/ConditionVariable.cpp
index 3c75a0f27d..92e0249b73 100644
--- a/js/src/threading/windows/ConditionVariable.cpp
+++ b/js/src/threading/windows/ConditionVariable.cpp
@@ -54,8 +54,8 @@ js::ConditionVariable::notify_all()
void
js::ConditionVariable::wait(UniqueLock<Mutex>& lock)
{
- CRITICAL_SECTION* cs = &lock.lock.platformData()->criticalSection;
- bool r = SleepConditionVariableCS(&platformData()->cv_, cs, INFINITE);
+ SRWLOCK* srwlock = &lock.lock.platformData()->lock;
+ bool r = SleepConditionVariableSRW(&platformData()->cv_, srwlock, INFINITE, 0);
MOZ_RELEASE_ASSERT(r);
}
@@ -70,7 +70,7 @@ js::CVStatus
js::ConditionVariable::wait_for(UniqueLock<Mutex>& lock,
const mozilla::TimeDuration& rel_time)
{
- CRITICAL_SECTION* cs = &lock.lock.platformData()->criticalSection;
+ SRWLOCK* srwlock = &lock.lock.platformData()->lock;
// Note that DWORD is unsigned, so we have to be careful to clamp at 0.
// If rel_time is Forever, then ToMilliseconds is +inf, which evaluates as
@@ -82,7 +82,7 @@ js::ConditionVariable::wait_for(UniqueLock<Mutex>& lock,
? INFINITE
: static_cast<DWORD>(msecd);
- BOOL r = SleepConditionVariableCS(&platformData()->cv_, cs, msec);
+ BOOL r = SleepConditionVariableSRW(&platformData()->cv_, srwlock, msec, 0);
if (r)
return CVStatus::NoTimeout;
MOZ_RELEASE_ASSERT(GetLastError() == ERROR_TIMEOUT);
diff --git a/js/src/threading/windows/MutexImpl.cpp b/js/src/threading/windows/MutexImpl.cpp
index 385d1c8dec..e838459b50 100644
--- a/js/src/threading/windows/MutexImpl.cpp
+++ b/js/src/threading/windows/MutexImpl.cpp
@@ -13,35 +13,6 @@
#include "threading/Mutex.h"
#include "threading/windows/MutexPlatformData.h"
-namespace {
-
-// We build with a toolkit that supports WinXP, so we have to probe
-// for modern features at runtime. This is necessary because Vista and
-// later automatically allocate and subsequently leak a debug info
-// object for each critical section that we allocate unless we tell it
-// not to. In order to tell it not to, we need the extra flags field
-// provided by the Ex version of InitializeCriticalSection.
-struct MutexNativeImports
-{
- using InitializeCriticalSectionExT = BOOL (WINAPI*)(CRITICAL_SECTION*, DWORD, DWORD);
- InitializeCriticalSectionExT InitializeCriticalSectionEx;
-
- MutexNativeImports() {
- HMODULE kernel32_dll = GetModuleHandle("kernel32.dll");
- MOZ_RELEASE_ASSERT(kernel32_dll != NULL);
- InitializeCriticalSectionEx = reinterpret_cast<InitializeCriticalSectionExT>(
- GetProcAddress(kernel32_dll, "InitializeCriticalSectionEx"));
- }
-
- bool hasInitializeCriticalSectionEx() const {
- return InitializeCriticalSectionEx;
- }
-};
-
-static MutexNativeImports NativeImports;
-
-} // (anonymous namespace)
-
js::detail::MutexImpl::MutexImpl()
{
AutoEnterOOMUnsafeRegion oom;
@@ -49,18 +20,7 @@ js::detail::MutexImpl::MutexImpl()
if (!platformData_)
oom.crash("js::Mutex::Mutex");
- // This number was adopted from NSPR.
- const static DWORD LockSpinCount = 1500;
- BOOL r;
- if (NativeImports.hasInitializeCriticalSectionEx()) {
- r = NativeImports.InitializeCriticalSectionEx(&platformData()->criticalSection,
- LockSpinCount,
- CRITICAL_SECTION_NO_DEBUG_INFO);
- } else {
- r = InitializeCriticalSectionAndSpinCount(&platformData()->criticalSection,
- LockSpinCount);
- }
- MOZ_RELEASE_ASSERT(r);
+ InitializeSRWLock(&platformData()->lock);
}
js::detail::MutexImpl::~MutexImpl()
@@ -68,18 +28,17 @@ js::detail::MutexImpl::~MutexImpl()
if (!platformData_)
return;
- DeleteCriticalSection(&platformData()->criticalSection);
js_delete(platformData());
}
void
js::detail::MutexImpl::lock()
{
- EnterCriticalSection(&platformData()->criticalSection);
+ AcquireSRWLockExclusive(&platformData()->lock);
}
void
js::detail::MutexImpl::unlock()
{
- LeaveCriticalSection(&platformData()->criticalSection);
+ ReleaseSRWLockExclusive(&platformData()->lock);
}
diff --git a/js/src/threading/windows/MutexPlatformData.h b/js/src/threading/windows/MutexPlatformData.h
index fbe7fc80d8..1d741c5d08 100644
--- a/js/src/threading/windows/MutexPlatformData.h
+++ b/js/src/threading/windows/MutexPlatformData.h
@@ -13,7 +13,7 @@
struct js::detail::MutexImpl::PlatformData
{
- CRITICAL_SECTION criticalSection;
+ SRWLOCK lock;
};
#endif // platform_win_MutexPlatformData_h
diff --git a/js/src/vm/ArgumentsObject.cpp b/js/src/vm/ArgumentsObject.cpp
index d01121ef04..717aa10508 100644
--- a/js/src/vm/ArgumentsObject.cpp
+++ b/js/src/vm/ArgumentsObject.cpp
@@ -676,7 +676,7 @@ UnmappedArgumentsObject::obj_resolve(JSContext* cx, HandleObject obj, HandleId i
if (argsobj->hasOverriddenLength())
return true;
} else {
- if (!JSID_IS_ATOM(id, cx->names().callee) && !JSID_IS_ATOM(id, cx->names().caller))
+ if (!JSID_IS_ATOM(id, cx->names().callee))
return true;
attrs = JSPROP_PERMANENT | JSPROP_GETTER | JSPROP_SETTER | JSPROP_SHARED;
@@ -709,10 +709,6 @@ UnmappedArgumentsObject::obj_enumerate(JSContext* cx, HandleObject obj)
if (!HasProperty(cx, argsobj, id, &found))
return false;
- id = NameToId(cx->names().caller);
- if (!HasProperty(cx, argsobj, id, &found))
- return false;
-
id = SYMBOL_TO_JSID(cx->wellKnownSymbols().iterator);
if (!HasProperty(cx, argsobj, id, &found))
return false;
diff --git a/js/src/vm/AsyncFunction.cpp b/js/src/vm/AsyncFunction.cpp
index bd0b4f32ae..f50c871141 100644
--- a/js/src/vm/AsyncFunction.cpp
+++ b/js/src/vm/AsyncFunction.cpp
@@ -107,19 +107,16 @@ WrappedAsyncFunction(JSContext* cx, unsigned argc, Value* vp)
// the async function's body, replacing `await` with `yield`. `wrapped` is a
// function that is visible to the outside, and handles yielded values.
JSObject*
-js::WrapAsyncFunction(JSContext* cx, HandleFunction unwrapped)
+js::WrapAsyncFunctionWithProto(JSContext* cx, HandleFunction unwrapped, HandleObject proto)
{
MOZ_ASSERT(unwrapped->isStarGenerator());
+ MOZ_ASSERT(proto, "We need an explicit prototype to avoid the default"
+ "%FunctionPrototype% fallback in NewFunctionWithProto().");
// Create a new function with AsyncFunctionPrototype, reusing the name and
// the length of `unwrapped`.
- // Step 1.
- RootedObject proto(cx, GlobalObject::getOrCreateAsyncFunctionPrototype(cx, cx->global()));
- if (!proto)
- return nullptr;
-
- RootedAtom funName(cx, unwrapped->name());
+ RootedAtom funName(cx, unwrapped->explicitName());
uint16_t length;
if (!unwrapped->getLength(cx, &length))
return nullptr;
@@ -133,6 +130,9 @@ js::WrapAsyncFunction(JSContext* cx, HandleFunction unwrapped)
if (!wrapped)
return nullptr;
+ if (unwrapped->hasCompileTimeName())
+ wrapped->setCompileTimeName(unwrapped->compileTimeName());
+
// Link them to each other to make GetWrappedAsyncFunction and
// GetUnwrappedAsyncFunction work.
unwrapped->setExtendedSlot(UNWRAPPED_ASYNC_WRAPPED_SLOT, ObjectValue(*wrapped));
@@ -141,6 +141,16 @@ js::WrapAsyncFunction(JSContext* cx, HandleFunction unwrapped)
return wrapped;
}
+JSObject*
+js::WrapAsyncFunction(JSContext* cx, HandleFunction unwrapped)
+{
+ RootedObject proto(cx, GlobalObject::getOrCreateAsyncFunctionPrototype(cx, cx->global()));
+ if (!proto)
+ return nullptr;
+
+ return WrapAsyncFunctionWithProto(cx, unwrapped, proto);
+}
+
enum class ResumeKind {
Normal,
Throw
diff --git a/js/src/vm/AsyncFunction.h b/js/src/vm/AsyncFunction.h
index ddf81a1774..d7f2c13117 100644
--- a/js/src/vm/AsyncFunction.h
+++ b/js/src/vm/AsyncFunction.h
@@ -22,6 +22,9 @@ bool
IsWrappedAsyncFunction(JSFunction* fun);
JSObject*
+WrapAsyncFunctionWithProto(JSContext* cx, HandleFunction unwrapped, HandleObject proto);
+
+JSObject*
WrapAsyncFunction(JSContext* cx, HandleFunction unwrapped);
MOZ_MUST_USE bool
diff --git a/js/src/vm/CommonPropertyNames.h b/js/src/vm/CommonPropertyNames.h
index bd0705446d..e971dc8443 100644
--- a/js/src/vm/CommonPropertyNames.h
+++ b/js/src/vm/CommonPropertyNames.h
@@ -13,7 +13,7 @@
#define FOR_EACH_COMMON_PROPERTYNAME(macro) \
macro(add, add, "add") \
- macro(allowContentSpread, allowContentSpread, "allowContentSpread") \
+ macro(allowContentIter, allowContentIter, "allowContentIter") \
macro(anonymous, anonymous, "anonymous") \
macro(Any, Any, "Any") \
macro(apply, apply, "apply") \
diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp
index b6bc7d62af..d16781326d 100644
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -6890,8 +6890,13 @@ class DebuggerSourceGetTextMatcher
bool hasSourceData = ss->hasSourceData();
if (!ss->hasSourceData() && !JSScript::loadSource(cx_, ss, &hasSourceData))
return nullptr;
- return hasSourceData ? ss->substring(cx_, 0, ss->length())
- : NewStringCopyZ<CanGC>(cx_, "[no source]");
+ if (!hasSourceData)
+ return NewStringCopyZ<CanGC>(cx_, "[no source]");
+
+ if (ss->isFunctionBody())
+ return ss->functionBodyString(cx_);
+
+ return ss->substring(cx_, 0, ss->length());
}
ReturnType match(Handle<WasmInstanceObject*> wasmInstance) {
@@ -9504,7 +9509,7 @@ DebuggerObject::name() const
{
MOZ_ASSERT(isFunction());
- return referent()->as<JSFunction>().name();
+ return referent()->as<JSFunction>().explicitName();
}
JSAtom*
diff --git a/js/src/vm/ErrorObject.cpp b/js/src/vm/ErrorObject.cpp
index 47b61b57b0..d8d29830b1 100644
--- a/js/src/vm/ErrorObject.cpp
+++ b/js/src/vm/ErrorObject.cpp
@@ -164,29 +164,25 @@ js::ErrorObject::getOrCreateErrorReport(JSContext* cx)
}
static bool
-ErrorObject_checkAndUnwrapThis(JSContext* cx, CallArgs& args, const char* fnName,
- MutableHandle<ErrorObject*> error)
+FindErrorInstanceOrPrototype(JSContext* cx, HandleObject obj, MutableHandleObject result)
{
- const Value& thisValue = args.thisv();
-
- if (!thisValue.isObject()) {
- JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_NOT_NONNULL_OBJECT,
- InformalValueTypeName(thisValue));
- return false;
- }
-
- // Walk up the prototype chain until we find the first ErrorObject that has
- // the slots we need. This allows us to support the poor-man's subclassing
- // of error: Object.create(Error.prototype).
-
- RootedObject target(cx, CheckedUnwrap(&thisValue.toObject()));
+ // Walk up the prototype chain until we find an error object instance or
+ // prototype object. This allows code like:
+ // Object.create(Error.prototype).stack
+ // or
+ // function NYI() { }
+ // NYI.prototype = new Error;
+ // (new NYI).stack
+ // to continue returning stacks that are useless, but at least don't throw.
+
+ RootedObject target(cx, CheckedUnwrap(obj));
if (!target) {
JS_ReportErrorASCII(cx, "Permission denied to access object");
return false;
}
RootedObject proto(cx);
- while (!target->is<ErrorObject>()) {
+ while (!IsErrorProtoKey(StandardProtoKeyOrNull(target))) {
if (!GetPrototype(cx, target, &proto))
return false;
@@ -194,7 +190,7 @@ ErrorObject_checkAndUnwrapThis(JSContext* cx, CallArgs& args, const char* fnName
// We walked the whole prototype chain and did not find an Error
// object.
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_INCOMPATIBLE_PROTO,
- js_Error_str, fnName, thisValue.toObject().getClass()->name);
+ js_Error_str, "(get stack)", obj->getClass()->name);
return false;
}
@@ -205,19 +201,40 @@ ErrorObject_checkAndUnwrapThis(JSContext* cx, CallArgs& args, const char* fnName
}
}
- error.set(&target->as<ErrorObject>());
+ result.set(target);
return true;
}
+
+static MOZ_ALWAYS_INLINE bool
+IsObject(HandleValue v)
+{
+ return v.isObject();
+}
+
/* static */ bool
js::ErrorObject::getStack(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
- Rooted<ErrorObject*> error(cx);
- if (!ErrorObject_checkAndUnwrapThis(cx, args, "(get stack)", &error))
+ // We accept any object here, because of poor-man's subclassing of Error.
+ return CallNonGenericMethod<IsObject, getStack_impl>(cx, args);
+}
+
+/* static */ bool
+js::ErrorObject::getStack_impl(JSContext* cx, const CallArgs& args)
+{
+ RootedObject thisObj(cx, &args.thisv().toObject());
+
+ RootedObject obj(cx);
+ if (!FindErrorInstanceOrPrototype(cx, thisObj, &obj))
return false;
- RootedObject savedFrameObj(cx, error->stack());
+ if (!obj->is<ErrorObject>()) {
+ args.rval().setString(cx->runtime()->emptyString);
+ return true;
+ }
+
+ RootedObject savedFrameObj(cx, obj->as<ErrorObject>().stack());
RootedString stackString(cx);
if (!BuildStackString(cx, savedFrameObj, &stackString))
return false;
@@ -245,12 +262,6 @@ js::ErrorObject::getStack(JSContext* cx, unsigned argc, Value* vp)
return true;
}
-static MOZ_ALWAYS_INLINE bool
-IsObject(HandleValue v)
-{
- return v.isObject();
-}
-
/* static */ bool
js::ErrorObject::setStack(JSContext* cx, unsigned argc, Value* vp)
{
@@ -262,9 +273,7 @@ js::ErrorObject::setStack(JSContext* cx, unsigned argc, Value* vp)
/* static */ bool
js::ErrorObject::setStack_impl(JSContext* cx, const CallArgs& args)
{
- const Value& thisValue = args.thisv();
- MOZ_ASSERT(thisValue.isObject());
- RootedObject thisObj(cx, &thisValue.toObject());
+ RootedObject thisObj(cx, &args.thisv().toObject());
if (!args.requireAtLeast(cx, "(set stack)", 1))
return false;
diff --git a/js/src/vm/ErrorObject.h b/js/src/vm/ErrorObject.h
index 32a691bb4a..0c2d00610a 100644
--- a/js/src/vm/ErrorObject.h
+++ b/js/src/vm/ErrorObject.h
@@ -38,9 +38,8 @@ class ErrorObject : public NativeObject
ScopedJSFreePtr<JSErrorReport>* errorReport, HandleString fileName, HandleObject stack,
uint32_t lineNumber, uint32_t columnNumber, HandleString message);
- static const ClassSpec errorClassSpec_;
- static const ClassSpec subErrorClassSpec_;
- static const ClassSpec nonGlobalErrorClassSpec_;
+ static const ClassSpec classSpecs[JSEXN_ERROR_LIMIT];
+ static const Class protoClasses[JSEXN_ERROR_LIMIT];
protected:
static const uint32_t EXNTYPE_SLOT = 0;
@@ -54,7 +53,7 @@ class ErrorObject : public NativeObject
static const uint32_t RESERVED_SLOTS = MESSAGE_SLOT + 1;
public:
- static const Class classes[JSEXN_LIMIT];
+ static const Class classes[JSEXN_ERROR_LIMIT];
static const Class * classForType(JSExnType type) {
MOZ_ASSERT(type < JSEXN_WARN);
@@ -107,6 +106,7 @@ class ErrorObject : public NativeObject
// Getter and setter for the Error.prototype.stack accessor.
static bool getStack(JSContext* cx, unsigned argc, Value* vp);
+ static bool getStack_impl(JSContext* cx, const CallArgs& args);
static bool setStack(JSContext* cx, unsigned argc, Value* vp);
static bool setStack_impl(JSContext* cx, const CallArgs& args);
};
diff --git a/js/src/vm/ForOfIterator.cpp b/js/src/vm/ForOfIterator.cpp
index 7bd521a6a5..a67b36774d 100644
--- a/js/src/vm/ForOfIterator.cpp
+++ b/js/src/vm/ForOfIterator.cpp
@@ -151,6 +151,57 @@ ForOfIterator::next(MutableHandleValue vp, bool* done)
return GetProperty(cx_, resultObj, resultObj, cx_->names().value, vp);
}
+// ES 2017 draft 0f10dba4ad18de92d47d421f378233a2eae8f077 7.4.6.
+// When completion.[[Type]] is throw.
+void
+ForOfIterator::closeThrow()
+{
+ MOZ_ASSERT(iterator);
+
+ RootedValue completionException(cx_);
+ if (cx_->isExceptionPending()) {
+ if (!GetAndClearException(cx_, &completionException))
+ completionException.setUndefined();
+ }
+
+ // Steps 1-2 (implicit)
+
+ // Step 3 (partial).
+ RootedValue returnVal(cx_);
+ if (!GetProperty(cx_, iterator, iterator, cx_->names().return_, &returnVal))
+ return;
+
+ // Step 4.
+ if (returnVal.isUndefined()) {
+ cx_->setPendingException(completionException);
+ return;
+ }
+
+ // Step 3 (remaining part)
+ if (!returnVal.isObject()) {
+ JS_ReportErrorNumberASCII(cx_, GetErrorMessage, nullptr, JSMSG_RETURN_NOT_CALLABLE);
+ return;
+ }
+ RootedObject returnObj(cx_, &returnVal.toObject());
+ if (!returnObj->isCallable()) {
+ JS_ReportErrorNumberASCII(cx_, GetErrorMessage, nullptr, JSMSG_RETURN_NOT_CALLABLE);
+ return;
+ }
+
+ // Step 5.
+ RootedValue innerResultValue(cx_);
+ if (!js::Call(cx_, returnVal, iterator, &innerResultValue)) {
+ if (cx_->isExceptionPending())
+ cx_->clearPendingException();
+ }
+
+ // Step 6.
+ cx_->setPendingException(completionException);
+
+ // Steps 7-9 (skipped).
+ return;
+}
+
bool
ForOfIterator::materializeArrayIterator()
{
diff --git a/js/src/vm/GlobalObject.cpp b/js/src/vm/GlobalObject.cpp
index 039be2e325..280548cd60 100644
--- a/js/src/vm/GlobalObject.cpp
+++ b/js/src/vm/GlobalObject.cpp
@@ -802,10 +802,10 @@ GlobalObject::getSelfHostedFunction(JSContext* cx, Handle<GlobalObject*> global,
return false;
if (exists) {
RootedFunction fun(cx, &funVal.toObject().as<JSFunction>());
- if (fun->name() == name)
+ if (fun->explicitName() == name)
return true;
- if (fun->name() == selfHostedName) {
+ if (fun->explicitName() == selfHostedName) {
// This function was initially cloned because it was called by
// other self-hosted code, so the clone kept its self-hosted name,
// instead of getting the name it's intended to have in content
diff --git a/js/src/vm/GlobalObject.h b/js/src/vm/GlobalObject.h
index 05984bc5f0..3534ef2f6c 100644
--- a/js/src/vm/GlobalObject.h
+++ b/js/src/vm/GlobalObject.h
@@ -427,6 +427,18 @@ class GlobalObject : public NativeObject
return &global->getPrototype(key).toObject();
}
+ static JSFunction*
+ getOrCreateErrorConstructor(JSContext* cx, Handle<GlobalObject*> global) {
+ if (!ensureConstructor(cx, global, JSProto_Error))
+ return nullptr;
+ return &global->getConstructor(JSProto_Error).toObject().as<JSFunction>();
+ }
+
+ static JSObject*
+ getOrCreateErrorPrototype(JSContext* cx, Handle<GlobalObject*> global) {
+ return getOrCreateCustomErrorPrototype(cx, global, JSEXN_ERR);
+ }
+
static NativeObject* getOrCreateSetPrototype(JSContext* cx, Handle<GlobalObject*> global) {
if (!ensureConstructor(cx, global, JSProto_Set))
return nullptr;
@@ -1003,10 +1015,7 @@ GenericCreatePrototype(JSContext* cx, JSProtoKey key)
inline JSProtoKey
StandardProtoKeyOrNull(const JSObject* obj)
{
- JSProtoKey key = JSCLASS_CACHED_PROTO_KEY(obj->getClass());
- if (key == JSProto_Error)
- return GetExceptionProtoKey(obj->as<ErrorObject>().type());
- return key;
+ return JSCLASS_CACHED_PROTO_KEY(obj->getClass());
}
JSObject*
diff --git a/js/src/vm/Interpreter.cpp b/js/src/vm/Interpreter.cpp
index fbf526ae5b..b747e4d7a0 100644
--- a/js/src/vm/Interpreter.cpp
+++ b/js/src/vm/Interpreter.cpp
@@ -282,8 +282,6 @@ MakeDefaultConstructor(JSContext* cx, JSOp op, JSAtom* atom, HandleObject proto)
ctor->setIsConstructor();
ctor->setIsClassConstructor();
- if (derived)
- ctor->setHasRest();
MOZ_ASSERT(ctor->infallibleIsDefaultClassConstructor(cx));
@@ -1082,6 +1080,9 @@ js::UnwindEnvironmentToTryPc(JSScript* script, JSTryNote* tn)
if (tn->kind == JSTRY_CATCH || tn->kind == JSTRY_FINALLY) {
pc -= JSOP_TRY_LENGTH;
MOZ_ASSERT(*pc == JSOP_TRY);
+ } else if (tn->kind == JSTRY_DESTRUCTURING_ITERCLOSE) {
+ pc -= JSOP_TRY_DESTRUCTURING_ITERCLOSE_LENGTH;
+ MOZ_ASSERT(*pc == JSOP_TRY_DESTRUCTURING_ITERCLOSE);
}
return pc;
}
@@ -1158,6 +1159,7 @@ enum HandleErrorContinuation
static HandleErrorContinuation
ProcessTryNotes(JSContext* cx, EnvironmentIter& ei, InterpreterRegs& regs)
{
+ bool inForOfIterClose = false;
for (TryNoteIterInterpreter tni(cx, regs); !tni.done(); ++tni) {
JSTryNote* tn = *tni;
@@ -1166,10 +1168,38 @@ ProcessTryNotes(JSContext* cx, EnvironmentIter& ei, InterpreterRegs& regs)
/* Catch cannot intercept the closing of a generator. */
if (cx->isClosingGenerator())
break;
+
+ // If IteratorClose due to abnormal completion threw inside a
+ // for-of loop, it is not catchable by try statements inside of
+ // the for-of loop.
+ //
+ // This is handled by this weirdness in the exception handler
+ // instead of in bytecode because it is hard to do so in bytecode:
+ //
+ // 1. IteratorClose emitted due to abnormal completion (break,
+ // throw, return) are emitted inline, at the source location of
+ // the break, throw, or return statement. For example:
+ //
+ // for (x of iter) {
+ // try { return; } catch (e) { }
+ // }
+ //
+ // From the try-note nesting's perspective, the IteratorClose
+ // resulting from |return| is covered by the inner try, when it
+ // should not be.
+ //
+ // 2. Try-catch notes cannot be disjoint. That is, we can't have
+ // multiple notes with disjoint pc ranges jumping to the same
+ // catch block.
+ if (inForOfIterClose)
+ break;
SettleOnTryNote(cx, tn, ei, regs);
return CatchContinuation;
case JSTRY_FINALLY:
+ // See note above.
+ if (inForOfIterClose)
+ break;
SettleOnTryNote(cx, tn, ei, regs);
return FinallyContinuation;
@@ -1191,7 +1221,31 @@ ProcessTryNotes(JSContext* cx, EnvironmentIter& ei, InterpreterRegs& regs)
break;
}
+ case JSTRY_DESTRUCTURING_ITERCLOSE: {
+ // Whether the destructuring iterator is done is at the top of the
+ // stack. The iterator object is second from the top.
+ MOZ_ASSERT(tn->stackDepth > 1);
+ Value* sp = regs.spForStackDepth(tn->stackDepth);
+ RootedValue doneValue(cx, sp[-1]);
+ bool done = ToBoolean(doneValue);
+ if (!done) {
+ RootedObject iterObject(cx, &sp[-2].toObject());
+ if (!IteratorCloseForException(cx, iterObject)) {
+ SettleOnTryNote(cx, tn, ei, regs);
+ return ErrorReturnContinuation;
+ }
+ }
+ break;
+ }
+
+ case JSTRY_FOR_OF_ITERCLOSE:
+ inForOfIterClose = true;
+ break;
+
case JSTRY_FOR_OF:
+ inForOfIterClose = false;
+ break;
+
case JSTRY_LOOP:
break;
@@ -1862,15 +1916,11 @@ CASE(EnableInterruptsPseudoOpcode)
/* Various 1-byte no-ops. */
CASE(JSOP_NOP)
CASE(JSOP_NOP_DESTRUCTURING)
-CASE(JSOP_UNUSED182)
-CASE(JSOP_UNUSED183)
-CASE(JSOP_UNUSED187)
CASE(JSOP_UNUSED192)
CASE(JSOP_UNUSED209)
CASE(JSOP_UNUSED210)
CASE(JSOP_UNUSED211)
-CASE(JSOP_UNUSED219)
-CASE(JSOP_UNUSED220)
+CASE(JSOP_TRY_DESTRUCTURING_ITERCLOSE)
CASE(JSOP_UNUSED221)
CASE(JSOP_UNUSED222)
CASE(JSOP_UNUSED223)
@@ -2159,6 +2209,13 @@ CASE(JSOP_ENDITER)
}
END_CASE(JSOP_ENDITER)
+CASE(JSOP_ISGENCLOSING)
+{
+ bool b = REGS.sp[-1].isMagic(JS_GENERATOR_CLOSING);
+ PUSH_BOOLEAN(b);
+}
+END_CASE(JSOP_ISGENCLOSING)
+
CASE(JSOP_DUP)
{
MOZ_ASSERT(REGS.stackDepth() >= 1);
@@ -2196,6 +2253,16 @@ CASE(JSOP_PICK)
}
END_CASE(JSOP_PICK)
+CASE(JSOP_UNPICK)
+{
+ int i = GET_UINT8(REGS.pc);
+ MOZ_ASSERT(REGS.stackDepth() >= unsigned(i) + 1);
+ Value lval = REGS.sp[-1];
+ memmove(REGS.sp - i, REGS.sp - (i + 1), sizeof(Value) * i);
+ REGS.sp[-(i + 1)] = lval;
+}
+END_CASE(JSOP_UNPICK)
+
CASE(JSOP_BINDGNAME)
CASE(JSOP_BINDNAME)
{
@@ -2597,6 +2664,15 @@ CASE(JSOP_CHECKISOBJ)
}
END_CASE(JSOP_CHECKISOBJ)
+CASE(JSOP_CHECKISCALLABLE)
+{
+ if (!IsCallable(REGS.sp[-1])) {
+ MOZ_ALWAYS_FALSE(ThrowCheckIsCallable(cx, CheckIsCallableKind(GET_UINT8(REGS.pc))));
+ goto error;
+ }
+}
+END_CASE(JSOP_CHECKISCALLABLE)
+
CASE(JSOP_CHECKTHIS)
{
if (REGS.sp[-1].isMagic(JS_UNINITIALIZED_LEXICAL)) {
@@ -3484,6 +3560,19 @@ CASE(JSOP_TOASYNC)
}
END_CASE(JSOP_TOASYNC)
+CASE(JSOP_SETFUNNAME)
+{
+ MOZ_ASSERT(REGS.stackDepth() >= 2);
+ FunctionPrefixKind prefixKind = FunctionPrefixKind(GET_UINT8(REGS.pc));
+ ReservedRooted<Value> name(&rootValue0, REGS.sp[-1]);
+ ReservedRooted<JSFunction*> fun(&rootFunction0, &REGS.sp[-2].toObject().as<JSFunction>());
+ if (!SetFunctionNameIfNoOwnName(cx, fun, name, prefixKind))
+ goto error;
+
+ REGS.sp--;
+}
+END_CASE(JSOP_SETFUNNAME)
+
CASE(JSOP_CALLEE)
MOZ_ASSERT(REGS.fp()->isFunctionFrame());
PUSH_COPY(REGS.fp()->calleev());
@@ -4345,7 +4434,7 @@ js::DefFunOperation(JSContext* cx, HandleScript script, HandleObject envChain,
parent = parent->enclosingEnvironment();
/* ES5 10.5 (NB: with subsequent errata). */
- RootedPropertyName name(cx, fun->name()->asPropertyName());
+ RootedPropertyName name(cx, fun->explicitName()->asPropertyName());
RootedShape shape(cx);
RootedObject pobj(cx);
@@ -4993,7 +5082,7 @@ js::ReportRuntimeLexicalError(JSContext* cx, unsigned errorNumber,
RootedPropertyName name(cx);
if (op == JSOP_THROWSETCALLEE) {
- name = script->functionNonDelazifying()->name()->asPropertyName();
+ name = script->functionNonDelazifying()->explicitName()->asPropertyName();
} else if (IsLocalOp(op)) {
name = FrameSlotName(script, pc)->asPropertyName();
} else if (IsAtomOp(op)) {
@@ -5021,7 +5110,16 @@ js::ThrowCheckIsObject(JSContext* cx, CheckIsObjectKind kind)
{
switch (kind) {
case CheckIsObjectKind::IteratorNext:
- JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_NEXT_RETURNED_PRIMITIVE);
+ JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
+ JSMSG_ITER_METHOD_RETURNED_PRIMITIVE, "next");
+ break;
+ case CheckIsObjectKind::IteratorReturn:
+ JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
+ JSMSG_ITER_METHOD_RETURNED_PRIMITIVE, "return");
+ break;
+ case CheckIsObjectKind::IteratorThrow:
+ JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
+ JSMSG_ITER_METHOD_RETURNED_PRIMITIVE, "throw");
break;
case CheckIsObjectKind::GetIterator:
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_GET_ITER_RETURNED_PRIMITIVE);
@@ -5033,6 +5131,19 @@ js::ThrowCheckIsObject(JSContext* cx, CheckIsObjectKind kind)
}
bool
+js::ThrowCheckIsCallable(JSContext* cx, CheckIsCallableKind kind)
+{
+ switch (kind) {
+ case CheckIsCallableKind::IteratorReturn:
+ JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr, JSMSG_RETURN_NOT_CALLABLE);
+ break;
+ default:
+ MOZ_CRASH("Unknown kind");
+ }
+ return false;
+}
+
+bool
js::ThrowUninitializedThis(JSContext* cx, AbstractFramePtr frame)
{
RootedFunction fun(cx);
@@ -5061,8 +5172,8 @@ js::ThrowUninitializedThis(JSContext* cx, AbstractFramePtr frame)
if (fun->isDerivedClassConstructor()) {
const char* name = "anonymous";
JSAutoByteString str;
- if (fun->name()) {
- if (!AtomToPrintableString(cx, fun->name(), &str))
+ if (fun->explicitName()) {
+ if (!AtomToPrintableString(cx, fun->explicitName(), &str))
return false;
name = str.ptr();
}
diff --git a/js/src/vm/Interpreter.h b/js/src/vm/Interpreter.h
index 1ffe1fdcaf..330dbef5f5 100644
--- a/js/src/vm/Interpreter.h
+++ b/js/src/vm/Interpreter.h
@@ -562,12 +562,21 @@ ReportRuntimeRedeclaration(JSContext* cx, HandlePropertyName name, const char* r
enum class CheckIsObjectKind : uint8_t {
IteratorNext,
+ IteratorReturn,
+ IteratorThrow,
GetIterator
};
bool
ThrowCheckIsObject(JSContext* cx, CheckIsObjectKind kind);
+enum class CheckIsCallableKind : uint8_t {
+ IteratorReturn
+};
+
+bool
+ThrowCheckIsCallable(JSContext* cx, CheckIsCallableKind kind);
+
bool
ThrowUninitializedThis(JSContext* cx, AbstractFramePtr frame);
diff --git a/js/src/vm/ObjectGroup.cpp b/js/src/vm/ObjectGroup.cpp
index 7be697fb68..d6a8fcaa46 100644
--- a/js/src/vm/ObjectGroup.cpp
+++ b/js/src/vm/ObjectGroup.cpp
@@ -6,6 +6,7 @@
#include "vm/ObjectGroup.h"
+#include "jsexn.h"
#include "jshashutil.h"
#include "jsobj.h"
@@ -578,11 +579,10 @@ ObjectGroup::defaultNewGroup(ExclusiveContext* cx, const Class* clasp,
AddTypePropertyId(cx, group, nullptr, NameToId(names.lastIndex), TypeSet::Int32Type());
} else if (clasp == &StringObject::class_) {
AddTypePropertyId(cx, group, nullptr, NameToId(names.length), TypeSet::Int32Type());
- } else if (ErrorObject::isErrorClass((clasp))) {
+ } else if (ErrorObject::isErrorClass(clasp)) {
AddTypePropertyId(cx, group, nullptr, NameToId(names.fileName), TypeSet::StringType());
AddTypePropertyId(cx, group, nullptr, NameToId(names.lineNumber), TypeSet::Int32Type());
AddTypePropertyId(cx, group, nullptr, NameToId(names.columnNumber), TypeSet::Int32Type());
- AddTypePropertyId(cx, group, nullptr, NameToId(names.stack), TypeSet::StringType());
}
return group;
diff --git a/js/src/vm/Opcodes.h b/js/src/vm/Opcodes.h
index 18ae6f0736..4b044c8d8f 100644
--- a/js/src/vm/Opcodes.h
+++ b/js/src/vm/Opcodes.h
@@ -1870,9 +1870,24 @@
* Stack: =>
*/ \
macro(JSOP_POPVARENV, 181, "popvarenv", NULL, 1, 0, 0, JOF_BYTE) \
- macro(JSOP_UNUSED182, 182,"unused182", NULL, 1, 0, 0, JOF_BYTE) \
- macro(JSOP_UNUSED183, 183,"unused183", NULL, 1, 0, 0, JOF_BYTE) \
- \
+ /*
+ * Pops the top two values on the stack as 'name' and 'fun', defines the
+ * name of 'fun' to 'name' with prefix if any, and pushes 'fun' back onto
+ * the stack.
+ * Category: Statements
+ * Type: Function
+ * Operands: uint8_t prefixKind
+ * Stack: fun, name => fun
+ */ \
+ macro(JSOP_SETFUNNAME, 182,"setfunname", NULL, 2, 2, 1, JOF_UINT8) \
+ /*
+ * Moves the top of the stack value under the nth element of the stack.
+ * Category: Operators
+ * Type: Stack Operations
+ * Operands: uint8_t n
+ * Stack: v[n], v[n-1], ..., v[1], v[0] => v[0], v[n], v[n-1], ..., v[1]
+ */ \
+ macro(JSOP_UNPICK, 183,"unpick", NULL, 2, 0, 0, JOF_UINT8) \
/*
* Pops the top of stack value, pushes property of it onto the stack.
*
@@ -1901,8 +1916,16 @@
* Stack: => this
*/ \
macro(JSOP_GLOBALTHIS, 186,"globalthis", NULL, 1, 0, 1, JOF_BYTE) \
- macro(JSOP_UNUSED187, 187,"unused187", NULL, 1, 0, 0, JOF_BYTE) \
- \
+ /*
+ * Pushes a boolean indicating whether the top of the stack is
+ * MagicValue(JS_GENERATOR_CLOSING).
+ *
+ * Category: Statements
+ * Type: For-In Statement
+ * Operands:
+ * Stack: val => val, res
+ */ \
+ macro(JSOP_ISGENCLOSING, 187, "isgenclosing", NULL, 1, 1, 2, JOF_BYTE) \
/*
* Pushes unsigned 24-bit int immediate integer operand onto the stack.
* Category: Literals
@@ -2178,8 +2201,26 @@
*/ \
macro(JSOP_HOLE, 218, "hole", NULL, 1, 0, 1, JOF_BYTE) \
\
- macro(JSOP_UNUSED219, 219,"unused219", NULL, 1, 0, 0, JOF_BYTE) \
- macro(JSOP_UNUSED220, 220,"unused220", NULL, 1, 0, 0, JOF_BYTE) \
+ /*
+ * Checks that the top value on the stack is callable, and throws a
+ * TypeError if not. The operand 'kind' is used only to generate an
+ * appropriate error message.
+ * Category: Statements
+ * Type: Function
+ * Operands: uint8_t kind
+ * Stack: result => result, callable
+ */ \
+ macro(JSOP_CHECKISCALLABLE, 219, "checkiscallable", NULL, 2, 1, 1, JOF_UINT8) \
+ \
+ /*
+ * No-op used by the exception unwinder to determine the correct
+ * environment to unwind to when performing IteratorClose due to
+ * destructuring.
+ * Category: Other
+ * Operands:
+ * Stack: =>
+ */ \
+ macro(JSOP_TRY_DESTRUCTURING_ITERCLOSE, 220, "try-destructuring-iterclose", NULL, 1, 0, 0, JOF_BYTE) \
macro(JSOP_UNUSED221, 221,"unused221", NULL, 1, 0, 0, JOF_BYTE) \
macro(JSOP_UNUSED222, 222,"unused222", NULL, 1, 0, 0, JOF_BYTE) \
macro(JSOP_UNUSED223, 223,"unused223", NULL, 1, 0, 0, JOF_BYTE) \
diff --git a/js/src/vm/ProxyObject.cpp b/js/src/vm/ProxyObject.cpp
index 49ed5a6241..69b4cd952f 100644
--- a/js/src/vm/ProxyObject.cpp
+++ b/js/src/vm/ProxyObject.cpp
@@ -45,7 +45,7 @@ ProxyObject::New(JSContext* cx, const BaseProxyHandler* handler, HandleValue pri
// wrappee. Prefer to allocate in the nursery, when possible.
NewObjectKind newKind = NurseryAllocatedProxy;
if (options.singleton()) {
- MOZ_ASSERT(priv.isGCThing() && priv.toGCThing()->isTenured());
+ MOZ_ASSERT(priv.isNull() || (priv.isGCThing() && priv.toGCThing()->isTenured()));
newKind = SingletonObject;
} else if ((priv.isGCThing() && priv.toGCThing()->isTenured()) ||
!handler->canNurseryAllocate() ||
diff --git a/js/src/vm/RegExpObject.cpp b/js/src/vm/RegExpObject.cpp
index 97f1163aa8..e0b44e1eb7 100644
--- a/js/src/vm/RegExpObject.cpp
+++ b/js/src/vm/RegExpObject.cpp
@@ -196,6 +196,12 @@ RegExpObject::trace(JSTracer* trc, JSObject* obj)
}
}
+static JSObject*
+CreateRegExpPrototype(JSContext* cx, JSProtoKey key)
+{
+ return cx->global()->createBlankPrototype(cx, &RegExpObject::protoClass_);
+}
+
static const ClassOps RegExpObjectClassOps = {
nullptr, /* addProperty */
nullptr, /* delProperty */
@@ -229,6 +235,13 @@ const Class RegExpObject::class_ = {
&RegExpObjectClassSpec
};
+const Class RegExpObject::protoClass_ = {
+ js_Object_str,
+ JSCLASS_HAS_CACHED_PROTO(JSProto_RegExp),
+ JS_NULL_CLASS_OPS,
+ &RegExpObjectClassSpec
+};
+
RegExpObject*
RegExpObject::create(ExclusiveContext* cx, const char16_t* chars, size_t length, RegExpFlag flags,
TokenStream* tokenStream, LifoAlloc& alloc)
diff --git a/js/src/vm/RegExpObject.h b/js/src/vm/RegExpObject.h
index d6dde16684..dc428a9735 100644
--- a/js/src/vm/RegExpObject.h
+++ b/js/src/vm/RegExpObject.h
@@ -79,9 +79,6 @@ RegExpAlloc(ExclusiveContext* cx, HandleObject proto = nullptr);
extern JSObject*
CloneRegExpObject(JSContext* cx, JSObject* regexp);
-extern JSObject*
-CreateRegExpPrototype(JSContext* cx, JSProtoKey key);
-
/*
* A RegExpShared is the compiled representation of a regexp. A RegExpShared is
* potentially pointed to by multiple RegExpObjects. Additionally, C++ code may
@@ -411,6 +408,7 @@ class RegExpObject : public NativeObject
static const unsigned PRIVATE_SLOT = 3;
static const Class class_;
+ static const Class protoClass_;
// The maximum number of pairs a MatchResult can have, without having to
// allocate a bigger MatchResult.
diff --git a/js/src/vm/SelfHosting.cpp b/js/src/vm/SelfHosting.cpp
index 6737e774ce..9a8ec7679f 100644
--- a/js/src/vm/SelfHosting.cpp
+++ b/js/src/vm/SelfHosting.cpp
@@ -2477,6 +2477,7 @@ static const JSFunctionSpec intrinsic_functions[] = {
JS_FN("intl_FormatDateTime", intl_FormatDateTime, 2,0),
JS_FN("intl_FormatNumber", intl_FormatNumber, 2,0),
JS_FN("intl_GetCalendarInfo", intl_GetCalendarInfo, 1,0),
+ JS_FN("intl_ComputeDisplayNames", intl_ComputeDisplayNames, 3,0),
JS_FN("intl_IsValidTimeZoneName", intl_IsValidTimeZoneName, 1,0),
JS_FN("intl_NumberFormat", intl_NumberFormat, 2,0),
JS_FN("intl_NumberFormat_availableLocales", intl_NumberFormat_availableLocales, 0,0),
@@ -2878,7 +2879,7 @@ CloneObject(JSContext* cx, HandleNativeObject selfHostedObject)
RootedObject clone(cx);
if (selfHostedObject->is<JSFunction>()) {
RootedFunction selfHostedFunction(cx, &selfHostedObject->as<JSFunction>());
- bool hasName = selfHostedFunction->name() != nullptr;
+ bool hasName = selfHostedFunction->explicitName() != nullptr;
// Arrow functions use the first extended slot for their lexical |this| value.
MOZ_ASSERT(!selfHostedFunction->isArrow());
@@ -2894,7 +2895,7 @@ CloneObject(JSContext* cx, HandleNativeObject selfHostedObject)
// self-hosting compartment has to be stored on the clone.
if (clone && hasName) {
clone->as<JSFunction>().setExtendedSlot(LAZY_FUNCTION_NAME_SLOT,
- StringValue(selfHostedFunction->name()));
+ StringValue(selfHostedFunction->explicitName()));
}
} else if (selfHostedObject->is<RegExpObject>()) {
RegExpObject& reobj = selfHostedObject->as<RegExpObject>();
@@ -2977,10 +2978,10 @@ JSRuntime::createLazySelfHostedFunctionClone(JSContext* cx, HandlePropertyName s
return false;
if (!selfHostedFun->isClassConstructor() && !selfHostedFun->hasGuessedAtom() &&
- selfHostedFun->name() != selfHostedName)
+ selfHostedFun->explicitName() != selfHostedName)
{
MOZ_ASSERT(selfHostedFun->getExtendedSlot(HAS_SELFHOSTED_CANONICAL_NAME_SLOT).toBoolean());
- funName = selfHostedFun->name();
+ funName = selfHostedFun->explicitName();
}
fun.set(NewScriptedFunction(cx, nargs, JSFunction::INTERPRETED_LAZY,
@@ -3022,7 +3023,7 @@ JSRuntime::cloneSelfHostedFunctionScript(JSContext* cx, HandlePropertyName name,
MOZ_ASSERT(!targetFun->isInterpretedLazy());
MOZ_ASSERT(sourceFun->nargs() == targetFun->nargs());
- MOZ_ASSERT(sourceFun->hasRest() == targetFun->hasRest());
+ MOZ_ASSERT(sourceScript->hasRest() == targetFun->nonLazyScript()->hasRest());
// The target function might have been relazified after its flags changed.
targetFun->setFlags(targetFun->flags() | sourceFun->flags());
diff --git a/js/src/vm/Shape.cpp b/js/src/vm/Shape.cpp
index a64dc529a6..306a2c5400 100644
--- a/js/src/vm/Shape.cpp
+++ b/js/src/vm/Shape.cpp
@@ -1214,6 +1214,10 @@ JSObject::setFlags(ExclusiveContext* cx, BaseShape::Flag flags, GenerateShape ge
RootedObject self(cx, this);
+ Shape* existingShape = self->ensureShape(cx);
+ if (!existingShape)
+ return false;
+
if (isNative() && as<NativeObject>().inDictionaryMode()) {
if (generateShape == GENERATE_SHAPE && !as<NativeObject>().generateOwnShape(cx))
return false;
@@ -1227,10 +1231,6 @@ JSObject::setFlags(ExclusiveContext* cx, BaseShape::Flag flags, GenerateShape ge
return true;
}
- Shape* existingShape = self->ensureShape(cx);
- if (!existingShape)
- return false;
-
Shape* newShape = Shape::setObjectFlags(cx, flags, self->taggedProto(), existingShape);
if (!newShape)
return false;
diff --git a/js/src/vm/Stack.cpp b/js/src/vm/Stack.cpp
index 439bb1ed49..87e95c8936 100644
--- a/js/src/vm/Stack.cpp
+++ b/js/src/vm/Stack.cpp
@@ -85,7 +85,7 @@ InterpreterFrame::isNonGlobalEvalFrame() const
JSObject*
InterpreterFrame::createRestParameter(JSContext* cx)
{
- MOZ_ASSERT(callee().hasRest());
+ MOZ_ASSERT(script()->hasRest());
unsigned nformal = callee().nargs() - 1, nactual = numActualArgs();
unsigned nrest = (nactual > nformal) ? nactual - nformal : 0;
Value* restvp = argv() + nformal;
diff --git a/js/src/vm/StructuredClone.cpp b/js/src/vm/StructuredClone.cpp
index 4b01cda85b..3a062c3b8b 100644
--- a/js/src/vm/StructuredClone.cpp
+++ b/js/src/vm/StructuredClone.cpp
@@ -2188,12 +2188,14 @@ JSStructuredCloneReader::readHeader()
return in.reportTruncated();
if (tag != SCTAG_HEADER) {
- // Old structured clone buffer. We must have read it from disk or
- // somewhere, so we can assume it's scope-compatible.
+ // Old structured clone buffer. We must have read it from disk.
+ storedScope = JS::StructuredCloneScope::DifferentProcess;
return true;
}
MOZ_ALWAYS_TRUE(in.readPair(&tag, &data));
+ storedScope = JS::StructuredCloneScope(data);
+
if (data != uint32_t(JS::StructuredCloneScope::SameProcessSameThread) &&
data != uint32_t(JS::StructuredCloneScope::SameProcessDifferentThread) &&
data != uint32_t(JS::StructuredCloneScope::DifferentProcess))
@@ -2202,7 +2204,6 @@ JSStructuredCloneReader::readHeader()
"invalid structured clone scope");
return false;
}
- storedScope = JS::StructuredCloneScope(data);
if (storedScope < allowedScope) {
JS_ReportErrorNumberASCII(context(), GetErrorMessage, nullptr, JSMSG_SC_BAD_SERIALIZED_DATA,
"incompatible structured clone scope");
diff --git a/js/src/vm/TypeInference.cpp b/js/src/vm/TypeInference.cpp
index 2a7762e4f1..3d09c74641 100644
--- a/js/src/vm/TypeInference.cpp
+++ b/js/src/vm/TypeInference.cpp
@@ -4541,7 +4541,7 @@ TypeScript::printTypes(JSContext* cx, HandleScript script) const
uintptr_t(script.get()), script->filename(), script->lineno());
if (script->functionNonDelazifying()) {
- if (JSAtom* name = script->functionNonDelazifying()->name())
+ if (JSAtom* name = script->functionNonDelazifying()->explicitName())
name->dumpCharsNoNewline();
}
diff --git a/js/src/vm/TypedArrayObject.cpp b/js/src/vm/TypedArrayObject.cpp
index 9d4ee94c6d..ae97be0de0 100644
--- a/js/src/vm/TypedArrayObject.cpp
+++ b/js/src/vm/TypedArrayObject.cpp
@@ -2870,7 +2870,7 @@ bool
DataViewObject::defineGetter(JSContext* cx, PropertyName* name, HandleNativeObject proto)
{
RootedId id(cx, NameToId(name));
- RootedAtom atom(cx, IdToFunctionName(cx, id, "get"));
+ RootedAtom atom(cx, IdToFunctionName(cx, id, FunctionPrefixKind::Get));
if (!atom)
return false;
unsigned attrs = JSPROP_SHARED | JSPROP_GETTER;
diff --git a/js/src/vm/Unicode.cpp b/js/src/vm/Unicode.cpp
index f4acf8f31f..82541c2312 100644
--- a/js/src/vm/Unicode.cpp
+++ b/js/src/vm/Unicode.cpp
@@ -1748,3 +1748,882 @@ const uint8_t unicode::folding_index2[] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
};
+bool
+js::unicode::IsIdentifierStartNonBMP(uint32_t codePoint)
+{
+ if (codePoint >= 0x10000 && codePoint <= 0x1000b)
+ return true;
+ if (codePoint >= 0x1000d && codePoint <= 0x10026)
+ return true;
+ if (codePoint >= 0x10028 && codePoint <= 0x1003a)
+ return true;
+ if (codePoint >= 0x1003c && codePoint <= 0x1003d)
+ return true;
+ if (codePoint >= 0x1003f && codePoint <= 0x1004d)
+ return true;
+ if (codePoint >= 0x10050 && codePoint <= 0x1005d)
+ return true;
+ if (codePoint >= 0x10080 && codePoint <= 0x100fa)
+ return true;
+ if (codePoint >= 0x10140 && codePoint <= 0x10174)
+ return true;
+ if (codePoint >= 0x10280 && codePoint <= 0x1029c)
+ return true;
+ if (codePoint >= 0x102a0 && codePoint <= 0x102d0)
+ return true;
+ if (codePoint >= 0x10300 && codePoint <= 0x1031f)
+ return true;
+ if (codePoint >= 0x10330 && codePoint <= 0x1034a)
+ return true;
+ if (codePoint >= 0x10350 && codePoint <= 0x10375)
+ return true;
+ if (codePoint >= 0x10380 && codePoint <= 0x1039d)
+ return true;
+ if (codePoint >= 0x103a0 && codePoint <= 0x103c3)
+ return true;
+ if (codePoint >= 0x103c8 && codePoint <= 0x103cf)
+ return true;
+ if (codePoint >= 0x103d1 && codePoint <= 0x103d5)
+ return true;
+ if (codePoint >= 0x10400 && codePoint <= 0x1049d)
+ return true;
+ if (codePoint >= 0x104b0 && codePoint <= 0x104d3)
+ return true;
+ if (codePoint >= 0x104d8 && codePoint <= 0x104fb)
+ return true;
+ if (codePoint >= 0x10500 && codePoint <= 0x10527)
+ return true;
+ if (codePoint >= 0x10530 && codePoint <= 0x10563)
+ return true;
+ if (codePoint >= 0x10600 && codePoint <= 0x10736)
+ return true;
+ if (codePoint >= 0x10740 && codePoint <= 0x10755)
+ return true;
+ if (codePoint >= 0x10760 && codePoint <= 0x10767)
+ return true;
+ if (codePoint >= 0x10800 && codePoint <= 0x10805)
+ return true;
+ if (codePoint >= 0x10808 && codePoint <= 0x10808)
+ return true;
+ if (codePoint >= 0x1080a && codePoint <= 0x10835)
+ return true;
+ if (codePoint >= 0x10837 && codePoint <= 0x10838)
+ return true;
+ if (codePoint >= 0x1083c && codePoint <= 0x1083c)
+ return true;
+ if (codePoint >= 0x1083f && codePoint <= 0x10855)
+ return true;
+ if (codePoint >= 0x10860 && codePoint <= 0x10876)
+ return true;
+ if (codePoint >= 0x10880 && codePoint <= 0x1089e)
+ return true;
+ if (codePoint >= 0x108e0 && codePoint <= 0x108f2)
+ return true;
+ if (codePoint >= 0x108f4 && codePoint <= 0x108f5)
+ return true;
+ if (codePoint >= 0x10900 && codePoint <= 0x10915)
+ return true;
+ if (codePoint >= 0x10920 && codePoint <= 0x10939)
+ return true;
+ if (codePoint >= 0x10980 && codePoint <= 0x109b7)
+ return true;
+ if (codePoint >= 0x109be && codePoint <= 0x109bf)
+ return true;
+ if (codePoint >= 0x10a00 && codePoint <= 0x10a00)
+ return true;
+ if (codePoint >= 0x10a10 && codePoint <= 0x10a13)
+ return true;
+ if (codePoint >= 0x10a15 && codePoint <= 0x10a17)
+ return true;
+ if (codePoint >= 0x10a19 && codePoint <= 0x10a33)
+ return true;
+ if (codePoint >= 0x10a60 && codePoint <= 0x10a7c)
+ return true;
+ if (codePoint >= 0x10a80 && codePoint <= 0x10a9c)
+ return true;
+ if (codePoint >= 0x10ac0 && codePoint <= 0x10ac7)
+ return true;
+ if (codePoint >= 0x10ac9 && codePoint <= 0x10ae4)
+ return true;
+ if (codePoint >= 0x10b00 && codePoint <= 0x10b35)
+ return true;
+ if (codePoint >= 0x10b40 && codePoint <= 0x10b55)
+ return true;
+ if (codePoint >= 0x10b60 && codePoint <= 0x10b72)
+ return true;
+ if (codePoint >= 0x10b80 && codePoint <= 0x10b91)
+ return true;
+ if (codePoint >= 0x10c00 && codePoint <= 0x10c48)
+ return true;
+ if (codePoint >= 0x10c80 && codePoint <= 0x10cb2)
+ return true;
+ if (codePoint >= 0x10cc0 && codePoint <= 0x10cf2)
+ return true;
+ if (codePoint >= 0x11003 && codePoint <= 0x11037)
+ return true;
+ if (codePoint >= 0x11083 && codePoint <= 0x110af)
+ return true;
+ if (codePoint >= 0x110d0 && codePoint <= 0x110e8)
+ return true;
+ if (codePoint >= 0x11103 && codePoint <= 0x11126)
+ return true;
+ if (codePoint >= 0x11150 && codePoint <= 0x11172)
+ return true;
+ if (codePoint >= 0x11176 && codePoint <= 0x11176)
+ return true;
+ if (codePoint >= 0x11183 && codePoint <= 0x111b2)
+ return true;
+ if (codePoint >= 0x111c1 && codePoint <= 0x111c4)
+ return true;
+ if (codePoint >= 0x111da && codePoint <= 0x111da)
+ return true;
+ if (codePoint >= 0x111dc && codePoint <= 0x111dc)
+ return true;
+ if (codePoint >= 0x11200 && codePoint <= 0x11211)
+ return true;
+ if (codePoint >= 0x11213 && codePoint <= 0x1122b)
+ return true;
+ if (codePoint >= 0x11280 && codePoint <= 0x11286)
+ return true;
+ if (codePoint >= 0x11288 && codePoint <= 0x11288)
+ return true;
+ if (codePoint >= 0x1128a && codePoint <= 0x1128d)
+ return true;
+ if (codePoint >= 0x1128f && codePoint <= 0x1129d)
+ return true;
+ if (codePoint >= 0x1129f && codePoint <= 0x112a8)
+ return true;
+ if (codePoint >= 0x112b0 && codePoint <= 0x112de)
+ return true;
+ if (codePoint >= 0x11305 && codePoint <= 0x1130c)
+ return true;
+ if (codePoint >= 0x1130f && codePoint <= 0x11310)
+ return true;
+ if (codePoint >= 0x11313 && codePoint <= 0x11328)
+ return true;
+ if (codePoint >= 0x1132a && codePoint <= 0x11330)
+ return true;
+ if (codePoint >= 0x11332 && codePoint <= 0x11333)
+ return true;
+ if (codePoint >= 0x11335 && codePoint <= 0x11339)
+ return true;
+ if (codePoint >= 0x1133d && codePoint <= 0x1133d)
+ return true;
+ if (codePoint >= 0x11350 && codePoint <= 0x11350)
+ return true;
+ if (codePoint >= 0x1135d && codePoint <= 0x11361)
+ return true;
+ if (codePoint >= 0x11400 && codePoint <= 0x11434)
+ return true;
+ if (codePoint >= 0x11447 && codePoint <= 0x1144a)
+ return true;
+ if (codePoint >= 0x11480 && codePoint <= 0x114af)
+ return true;
+ if (codePoint >= 0x114c4 && codePoint <= 0x114c5)
+ return true;
+ if (codePoint >= 0x114c7 && codePoint <= 0x114c7)
+ return true;
+ if (codePoint >= 0x11580 && codePoint <= 0x115ae)
+ return true;
+ if (codePoint >= 0x115d8 && codePoint <= 0x115db)
+ return true;
+ if (codePoint >= 0x11600 && codePoint <= 0x1162f)
+ return true;
+ if (codePoint >= 0x11644 && codePoint <= 0x11644)
+ return true;
+ if (codePoint >= 0x11680 && codePoint <= 0x116aa)
+ return true;
+ if (codePoint >= 0x11700 && codePoint <= 0x11719)
+ return true;
+ if (codePoint >= 0x118a0 && codePoint <= 0x118df)
+ return true;
+ if (codePoint >= 0x118ff && codePoint <= 0x118ff)
+ return true;
+ if (codePoint >= 0x11ac0 && codePoint <= 0x11af8)
+ return true;
+ if (codePoint >= 0x11c00 && codePoint <= 0x11c08)
+ return true;
+ if (codePoint >= 0x11c0a && codePoint <= 0x11c2e)
+ return true;
+ if (codePoint >= 0x11c40 && codePoint <= 0x11c40)
+ return true;
+ if (codePoint >= 0x11c72 && codePoint <= 0x11c8f)
+ return true;
+ if (codePoint >= 0x12000 && codePoint <= 0x12399)
+ return true;
+ if (codePoint >= 0x12400 && codePoint <= 0x1246e)
+ return true;
+ if (codePoint >= 0x12480 && codePoint <= 0x12543)
+ return true;
+ if (codePoint >= 0x13000 && codePoint <= 0x1342e)
+ return true;
+ if (codePoint >= 0x14400 && codePoint <= 0x14646)
+ return true;
+ if (codePoint >= 0x16800 && codePoint <= 0x16a38)
+ return true;
+ if (codePoint >= 0x16a40 && codePoint <= 0x16a5e)
+ return true;
+ if (codePoint >= 0x16ad0 && codePoint <= 0x16aed)
+ return true;
+ if (codePoint >= 0x16b00 && codePoint <= 0x16b2f)
+ return true;
+ if (codePoint >= 0x16b40 && codePoint <= 0x16b43)
+ return true;
+ if (codePoint >= 0x16b63 && codePoint <= 0x16b77)
+ return true;
+ if (codePoint >= 0x16b7d && codePoint <= 0x16b8f)
+ return true;
+ if (codePoint >= 0x16f00 && codePoint <= 0x16f44)
+ return true;
+ if (codePoint >= 0x16f50 && codePoint <= 0x16f50)
+ return true;
+ if (codePoint >= 0x16f93 && codePoint <= 0x16f9f)
+ return true;
+ if (codePoint >= 0x16fe0 && codePoint <= 0x16fe0)
+ return true;
+ if (codePoint >= 0x17000 && codePoint <= 0x187ec)
+ return true;
+ if (codePoint >= 0x18800 && codePoint <= 0x18af2)
+ return true;
+ if (codePoint >= 0x1b000 && codePoint <= 0x1b001)
+ return true;
+ if (codePoint >= 0x1bc00 && codePoint <= 0x1bc6a)
+ return true;
+ if (codePoint >= 0x1bc70 && codePoint <= 0x1bc7c)
+ return true;
+ if (codePoint >= 0x1bc80 && codePoint <= 0x1bc88)
+ return true;
+ if (codePoint >= 0x1bc90 && codePoint <= 0x1bc99)
+ return true;
+ if (codePoint >= 0x1d400 && codePoint <= 0x1d454)
+ return true;
+ if (codePoint >= 0x1d456 && codePoint <= 0x1d49c)
+ return true;
+ if (codePoint >= 0x1d49e && codePoint <= 0x1d49f)
+ return true;
+ if (codePoint >= 0x1d4a2 && codePoint <= 0x1d4a2)
+ return true;
+ if (codePoint >= 0x1d4a5 && codePoint <= 0x1d4a6)
+ return true;
+ if (codePoint >= 0x1d4a9 && codePoint <= 0x1d4ac)
+ return true;
+ if (codePoint >= 0x1d4ae && codePoint <= 0x1d4b9)
+ return true;
+ if (codePoint >= 0x1d4bb && codePoint <= 0x1d4bb)
+ return true;
+ if (codePoint >= 0x1d4bd && codePoint <= 0x1d4c3)
+ return true;
+ if (codePoint >= 0x1d4c5 && codePoint <= 0x1d505)
+ return true;
+ if (codePoint >= 0x1d507 && codePoint <= 0x1d50a)
+ return true;
+ if (codePoint >= 0x1d50d && codePoint <= 0x1d514)
+ return true;
+ if (codePoint >= 0x1d516 && codePoint <= 0x1d51c)
+ return true;
+ if (codePoint >= 0x1d51e && codePoint <= 0x1d539)
+ return true;
+ if (codePoint >= 0x1d53b && codePoint <= 0x1d53e)
+ return true;
+ if (codePoint >= 0x1d540 && codePoint <= 0x1d544)
+ return true;
+ if (codePoint >= 0x1d546 && codePoint <= 0x1d546)
+ return true;
+ if (codePoint >= 0x1d54a && codePoint <= 0x1d550)
+ return true;
+ if (codePoint >= 0x1d552 && codePoint <= 0x1d6a5)
+ return true;
+ if (codePoint >= 0x1d6a8 && codePoint <= 0x1d6c0)
+ return true;
+ if (codePoint >= 0x1d6c2 && codePoint <= 0x1d6da)
+ return true;
+ if (codePoint >= 0x1d6dc && codePoint <= 0x1d6fa)
+ return true;
+ if (codePoint >= 0x1d6fc && codePoint <= 0x1d714)
+ return true;
+ if (codePoint >= 0x1d716 && codePoint <= 0x1d734)
+ return true;
+ if (codePoint >= 0x1d736 && codePoint <= 0x1d74e)
+ return true;
+ if (codePoint >= 0x1d750 && codePoint <= 0x1d76e)
+ return true;
+ if (codePoint >= 0x1d770 && codePoint <= 0x1d788)
+ return true;
+ if (codePoint >= 0x1d78a && codePoint <= 0x1d7a8)
+ return true;
+ if (codePoint >= 0x1d7aa && codePoint <= 0x1d7c2)
+ return true;
+ if (codePoint >= 0x1d7c4 && codePoint <= 0x1d7cb)
+ return true;
+ if (codePoint >= 0x1e800 && codePoint <= 0x1e8c4)
+ return true;
+ if (codePoint >= 0x1e900 && codePoint <= 0x1e943)
+ return true;
+ if (codePoint >= 0x1ee00 && codePoint <= 0x1ee03)
+ return true;
+ if (codePoint >= 0x1ee05 && codePoint <= 0x1ee1f)
+ return true;
+ if (codePoint >= 0x1ee21 && codePoint <= 0x1ee22)
+ return true;
+ if (codePoint >= 0x1ee24 && codePoint <= 0x1ee24)
+ return true;
+ if (codePoint >= 0x1ee27 && codePoint <= 0x1ee27)
+ return true;
+ if (codePoint >= 0x1ee29 && codePoint <= 0x1ee32)
+ return true;
+ if (codePoint >= 0x1ee34 && codePoint <= 0x1ee37)
+ return true;
+ if (codePoint >= 0x1ee39 && codePoint <= 0x1ee39)
+ return true;
+ if (codePoint >= 0x1ee3b && codePoint <= 0x1ee3b)
+ return true;
+ if (codePoint >= 0x1ee42 && codePoint <= 0x1ee42)
+ return true;
+ if (codePoint >= 0x1ee47 && codePoint <= 0x1ee47)
+ return true;
+ if (codePoint >= 0x1ee49 && codePoint <= 0x1ee49)
+ return true;
+ if (codePoint >= 0x1ee4b && codePoint <= 0x1ee4b)
+ return true;
+ if (codePoint >= 0x1ee4d && codePoint <= 0x1ee4f)
+ return true;
+ if (codePoint >= 0x1ee51 && codePoint <= 0x1ee52)
+ return true;
+ if (codePoint >= 0x1ee54 && codePoint <= 0x1ee54)
+ return true;
+ if (codePoint >= 0x1ee57 && codePoint <= 0x1ee57)
+ return true;
+ if (codePoint >= 0x1ee59 && codePoint <= 0x1ee59)
+ return true;
+ if (codePoint >= 0x1ee5b && codePoint <= 0x1ee5b)
+ return true;
+ if (codePoint >= 0x1ee5d && codePoint <= 0x1ee5d)
+ return true;
+ if (codePoint >= 0x1ee5f && codePoint <= 0x1ee5f)
+ return true;
+ if (codePoint >= 0x1ee61 && codePoint <= 0x1ee62)
+ return true;
+ if (codePoint >= 0x1ee64 && codePoint <= 0x1ee64)
+ return true;
+ if (codePoint >= 0x1ee67 && codePoint <= 0x1ee6a)
+ return true;
+ if (codePoint >= 0x1ee6c && codePoint <= 0x1ee72)
+ return true;
+ if (codePoint >= 0x1ee74 && codePoint <= 0x1ee77)
+ return true;
+ if (codePoint >= 0x1ee79 && codePoint <= 0x1ee7c)
+ return true;
+ if (codePoint >= 0x1ee7e && codePoint <= 0x1ee7e)
+ return true;
+ if (codePoint >= 0x1ee80 && codePoint <= 0x1ee89)
+ return true;
+ if (codePoint >= 0x1ee8b && codePoint <= 0x1ee9b)
+ return true;
+ if (codePoint >= 0x1eea1 && codePoint <= 0x1eea3)
+ return true;
+ if (codePoint >= 0x1eea5 && codePoint <= 0x1eea9)
+ return true;
+ if (codePoint >= 0x1eeab && codePoint <= 0x1eebb)
+ return true;
+ if (codePoint >= 0x20000 && codePoint <= 0x2a6d6)
+ return true;
+ if (codePoint >= 0x2a700 && codePoint <= 0x2b734)
+ return true;
+ if (codePoint >= 0x2b740 && codePoint <= 0x2b81d)
+ return true;
+ if (codePoint >= 0x2b820 && codePoint <= 0x2cea1)
+ return true;
+ if (codePoint >= 0x2f800 && codePoint <= 0x2fa1d)
+ return true;
+ return false;
+}
+
+bool
+js::unicode::IsIdentifierPartNonBMP(uint32_t codePoint)
+{
+ if (codePoint >= 0x10000 && codePoint <= 0x1000b)
+ return true;
+ if (codePoint >= 0x1000d && codePoint <= 0x10026)
+ return true;
+ if (codePoint >= 0x10028 && codePoint <= 0x1003a)
+ return true;
+ if (codePoint >= 0x1003c && codePoint <= 0x1003d)
+ return true;
+ if (codePoint >= 0x1003f && codePoint <= 0x1004d)
+ return true;
+ if (codePoint >= 0x10050 && codePoint <= 0x1005d)
+ return true;
+ if (codePoint >= 0x10080 && codePoint <= 0x100fa)
+ return true;
+ if (codePoint >= 0x10140 && codePoint <= 0x10174)
+ return true;
+ if (codePoint >= 0x101fd && codePoint <= 0x101fd)
+ return true;
+ if (codePoint >= 0x10280 && codePoint <= 0x1029c)
+ return true;
+ if (codePoint >= 0x102a0 && codePoint <= 0x102d0)
+ return true;
+ if (codePoint >= 0x102e0 && codePoint <= 0x102e0)
+ return true;
+ if (codePoint >= 0x10300 && codePoint <= 0x1031f)
+ return true;
+ if (codePoint >= 0x10330 && codePoint <= 0x1034a)
+ return true;
+ if (codePoint >= 0x10350 && codePoint <= 0x1037a)
+ return true;
+ if (codePoint >= 0x10380 && codePoint <= 0x1039d)
+ return true;
+ if (codePoint >= 0x103a0 && codePoint <= 0x103c3)
+ return true;
+ if (codePoint >= 0x103c8 && codePoint <= 0x103cf)
+ return true;
+ if (codePoint >= 0x103d1 && codePoint <= 0x103d5)
+ return true;
+ if (codePoint >= 0x10400 && codePoint <= 0x1049d)
+ return true;
+ if (codePoint >= 0x104a0 && codePoint <= 0x104a9)
+ return true;
+ if (codePoint >= 0x104b0 && codePoint <= 0x104d3)
+ return true;
+ if (codePoint >= 0x104d8 && codePoint <= 0x104fb)
+ return true;
+ if (codePoint >= 0x10500 && codePoint <= 0x10527)
+ return true;
+ if (codePoint >= 0x10530 && codePoint <= 0x10563)
+ return true;
+ if (codePoint >= 0x10600 && codePoint <= 0x10736)
+ return true;
+ if (codePoint >= 0x10740 && codePoint <= 0x10755)
+ return true;
+ if (codePoint >= 0x10760 && codePoint <= 0x10767)
+ return true;
+ if (codePoint >= 0x10800 && codePoint <= 0x10805)
+ return true;
+ if (codePoint >= 0x10808 && codePoint <= 0x10808)
+ return true;
+ if (codePoint >= 0x1080a && codePoint <= 0x10835)
+ return true;
+ if (codePoint >= 0x10837 && codePoint <= 0x10838)
+ return true;
+ if (codePoint >= 0x1083c && codePoint <= 0x1083c)
+ return true;
+ if (codePoint >= 0x1083f && codePoint <= 0x10855)
+ return true;
+ if (codePoint >= 0x10860 && codePoint <= 0x10876)
+ return true;
+ if (codePoint >= 0x10880 && codePoint <= 0x1089e)
+ return true;
+ if (codePoint >= 0x108e0 && codePoint <= 0x108f2)
+ return true;
+ if (codePoint >= 0x108f4 && codePoint <= 0x108f5)
+ return true;
+ if (codePoint >= 0x10900 && codePoint <= 0x10915)
+ return true;
+ if (codePoint >= 0x10920 && codePoint <= 0x10939)
+ return true;
+ if (codePoint >= 0x10980 && codePoint <= 0x109b7)
+ return true;
+ if (codePoint >= 0x109be && codePoint <= 0x109bf)
+ return true;
+ if (codePoint >= 0x10a00 && codePoint <= 0x10a03)
+ return true;
+ if (codePoint >= 0x10a05 && codePoint <= 0x10a06)
+ return true;
+ if (codePoint >= 0x10a0c && codePoint <= 0x10a13)
+ return true;
+ if (codePoint >= 0x10a15 && codePoint <= 0x10a17)
+ return true;
+ if (codePoint >= 0x10a19 && codePoint <= 0x10a33)
+ return true;
+ if (codePoint >= 0x10a38 && codePoint <= 0x10a3a)
+ return true;
+ if (codePoint >= 0x10a3f && codePoint <= 0x10a3f)
+ return true;
+ if (codePoint >= 0x10a60 && codePoint <= 0x10a7c)
+ return true;
+ if (codePoint >= 0x10a80 && codePoint <= 0x10a9c)
+ return true;
+ if (codePoint >= 0x10ac0 && codePoint <= 0x10ac7)
+ return true;
+ if (codePoint >= 0x10ac9 && codePoint <= 0x10ae6)
+ return true;
+ if (codePoint >= 0x10b00 && codePoint <= 0x10b35)
+ return true;
+ if (codePoint >= 0x10b40 && codePoint <= 0x10b55)
+ return true;
+ if (codePoint >= 0x10b60 && codePoint <= 0x10b72)
+ return true;
+ if (codePoint >= 0x10b80 && codePoint <= 0x10b91)
+ return true;
+ if (codePoint >= 0x10c00 && codePoint <= 0x10c48)
+ return true;
+ if (codePoint >= 0x10c80 && codePoint <= 0x10cb2)
+ return true;
+ if (codePoint >= 0x10cc0 && codePoint <= 0x10cf2)
+ return true;
+ if (codePoint >= 0x11000 && codePoint <= 0x11046)
+ return true;
+ if (codePoint >= 0x11066 && codePoint <= 0x1106f)
+ return true;
+ if (codePoint >= 0x1107f && codePoint <= 0x110ba)
+ return true;
+ if (codePoint >= 0x110d0 && codePoint <= 0x110e8)
+ return true;
+ if (codePoint >= 0x110f0 && codePoint <= 0x110f9)
+ return true;
+ if (codePoint >= 0x11100 && codePoint <= 0x11134)
+ return true;
+ if (codePoint >= 0x11136 && codePoint <= 0x1113f)
+ return true;
+ if (codePoint >= 0x11150 && codePoint <= 0x11173)
+ return true;
+ if (codePoint >= 0x11176 && codePoint <= 0x11176)
+ return true;
+ if (codePoint >= 0x11180 && codePoint <= 0x111c4)
+ return true;
+ if (codePoint >= 0x111ca && codePoint <= 0x111cc)
+ return true;
+ if (codePoint >= 0x111d0 && codePoint <= 0x111da)
+ return true;
+ if (codePoint >= 0x111dc && codePoint <= 0x111dc)
+ return true;
+ if (codePoint >= 0x11200 && codePoint <= 0x11211)
+ return true;
+ if (codePoint >= 0x11213 && codePoint <= 0x11237)
+ return true;
+ if (codePoint >= 0x1123e && codePoint <= 0x1123e)
+ return true;
+ if (codePoint >= 0x11280 && codePoint <= 0x11286)
+ return true;
+ if (codePoint >= 0x11288 && codePoint <= 0x11288)
+ return true;
+ if (codePoint >= 0x1128a && codePoint <= 0x1128d)
+ return true;
+ if (codePoint >= 0x1128f && codePoint <= 0x1129d)
+ return true;
+ if (codePoint >= 0x1129f && codePoint <= 0x112a8)
+ return true;
+ if (codePoint >= 0x112b0 && codePoint <= 0x112ea)
+ return true;
+ if (codePoint >= 0x112f0 && codePoint <= 0x112f9)
+ return true;
+ if (codePoint >= 0x11300 && codePoint <= 0x11303)
+ return true;
+ if (codePoint >= 0x11305 && codePoint <= 0x1130c)
+ return true;
+ if (codePoint >= 0x1130f && codePoint <= 0x11310)
+ return true;
+ if (codePoint >= 0x11313 && codePoint <= 0x11328)
+ return true;
+ if (codePoint >= 0x1132a && codePoint <= 0x11330)
+ return true;
+ if (codePoint >= 0x11332 && codePoint <= 0x11333)
+ return true;
+ if (codePoint >= 0x11335 && codePoint <= 0x11339)
+ return true;
+ if (codePoint >= 0x1133c && codePoint <= 0x11344)
+ return true;
+ if (codePoint >= 0x11347 && codePoint <= 0x11348)
+ return true;
+ if (codePoint >= 0x1134b && codePoint <= 0x1134d)
+ return true;
+ if (codePoint >= 0x11350 && codePoint <= 0x11350)
+ return true;
+ if (codePoint >= 0x11357 && codePoint <= 0x11357)
+ return true;
+ if (codePoint >= 0x1135d && codePoint <= 0x11363)
+ return true;
+ if (codePoint >= 0x11366 && codePoint <= 0x1136c)
+ return true;
+ if (codePoint >= 0x11370 && codePoint <= 0x11374)
+ return true;
+ if (codePoint >= 0x11400 && codePoint <= 0x1144a)
+ return true;
+ if (codePoint >= 0x11450 && codePoint <= 0x11459)
+ return true;
+ if (codePoint >= 0x11480 && codePoint <= 0x114c5)
+ return true;
+ if (codePoint >= 0x114c7 && codePoint <= 0x114c7)
+ return true;
+ if (codePoint >= 0x114d0 && codePoint <= 0x114d9)
+ return true;
+ if (codePoint >= 0x11580 && codePoint <= 0x115b5)
+ return true;
+ if (codePoint >= 0x115b8 && codePoint <= 0x115c0)
+ return true;
+ if (codePoint >= 0x115d8 && codePoint <= 0x115dd)
+ return true;
+ if (codePoint >= 0x11600 && codePoint <= 0x11640)
+ return true;
+ if (codePoint >= 0x11644 && codePoint <= 0x11644)
+ return true;
+ if (codePoint >= 0x11650 && codePoint <= 0x11659)
+ return true;
+ if (codePoint >= 0x11680 && codePoint <= 0x116b7)
+ return true;
+ if (codePoint >= 0x116c0 && codePoint <= 0x116c9)
+ return true;
+ if (codePoint >= 0x11700 && codePoint <= 0x11719)
+ return true;
+ if (codePoint >= 0x1171d && codePoint <= 0x1172b)
+ return true;
+ if (codePoint >= 0x11730 && codePoint <= 0x11739)
+ return true;
+ if (codePoint >= 0x118a0 && codePoint <= 0x118e9)
+ return true;
+ if (codePoint >= 0x118ff && codePoint <= 0x118ff)
+ return true;
+ if (codePoint >= 0x11ac0 && codePoint <= 0x11af8)
+ return true;
+ if (codePoint >= 0x11c00 && codePoint <= 0x11c08)
+ return true;
+ if (codePoint >= 0x11c0a && codePoint <= 0x11c36)
+ return true;
+ if (codePoint >= 0x11c38 && codePoint <= 0x11c40)
+ return true;
+ if (codePoint >= 0x11c50 && codePoint <= 0x11c59)
+ return true;
+ if (codePoint >= 0x11c72 && codePoint <= 0x11c8f)
+ return true;
+ if (codePoint >= 0x11c92 && codePoint <= 0x11ca7)
+ return true;
+ if (codePoint >= 0x11ca9 && codePoint <= 0x11cb6)
+ return true;
+ if (codePoint >= 0x12000 && codePoint <= 0x12399)
+ return true;
+ if (codePoint >= 0x12400 && codePoint <= 0x1246e)
+ return true;
+ if (codePoint >= 0x12480 && codePoint <= 0x12543)
+ return true;
+ if (codePoint >= 0x13000 && codePoint <= 0x1342e)
+ return true;
+ if (codePoint >= 0x14400 && codePoint <= 0x14646)
+ return true;
+ if (codePoint >= 0x16800 && codePoint <= 0x16a38)
+ return true;
+ if (codePoint >= 0x16a40 && codePoint <= 0x16a5e)
+ return true;
+ if (codePoint >= 0x16a60 && codePoint <= 0x16a69)
+ return true;
+ if (codePoint >= 0x16ad0 && codePoint <= 0x16aed)
+ return true;
+ if (codePoint >= 0x16af0 && codePoint <= 0x16af4)
+ return true;
+ if (codePoint >= 0x16b00 && codePoint <= 0x16b36)
+ return true;
+ if (codePoint >= 0x16b40 && codePoint <= 0x16b43)
+ return true;
+ if (codePoint >= 0x16b50 && codePoint <= 0x16b59)
+ return true;
+ if (codePoint >= 0x16b63 && codePoint <= 0x16b77)
+ return true;
+ if (codePoint >= 0x16b7d && codePoint <= 0x16b8f)
+ return true;
+ if (codePoint >= 0x16f00 && codePoint <= 0x16f44)
+ return true;
+ if (codePoint >= 0x16f50 && codePoint <= 0x16f7e)
+ return true;
+ if (codePoint >= 0x16f8f && codePoint <= 0x16f9f)
+ return true;
+ if (codePoint >= 0x16fe0 && codePoint <= 0x16fe0)
+ return true;
+ if (codePoint >= 0x17000 && codePoint <= 0x187ec)
+ return true;
+ if (codePoint >= 0x18800 && codePoint <= 0x18af2)
+ return true;
+ if (codePoint >= 0x1b000 && codePoint <= 0x1b001)
+ return true;
+ if (codePoint >= 0x1bc00 && codePoint <= 0x1bc6a)
+ return true;
+ if (codePoint >= 0x1bc70 && codePoint <= 0x1bc7c)
+ return true;
+ if (codePoint >= 0x1bc80 && codePoint <= 0x1bc88)
+ return true;
+ if (codePoint >= 0x1bc90 && codePoint <= 0x1bc99)
+ return true;
+ if (codePoint >= 0x1bc9d && codePoint <= 0x1bc9e)
+ return true;
+ if (codePoint >= 0x1d165 && codePoint <= 0x1d169)
+ return true;
+ if (codePoint >= 0x1d16d && codePoint <= 0x1d172)
+ return true;
+ if (codePoint >= 0x1d17b && codePoint <= 0x1d182)
+ return true;
+ if (codePoint >= 0x1d185 && codePoint <= 0x1d18b)
+ return true;
+ if (codePoint >= 0x1d1aa && codePoint <= 0x1d1ad)
+ return true;
+ if (codePoint >= 0x1d242 && codePoint <= 0x1d244)
+ return true;
+ if (codePoint >= 0x1d400 && codePoint <= 0x1d454)
+ return true;
+ if (codePoint >= 0x1d456 && codePoint <= 0x1d49c)
+ return true;
+ if (codePoint >= 0x1d49e && codePoint <= 0x1d49f)
+ return true;
+ if (codePoint >= 0x1d4a2 && codePoint <= 0x1d4a2)
+ return true;
+ if (codePoint >= 0x1d4a5 && codePoint <= 0x1d4a6)
+ return true;
+ if (codePoint >= 0x1d4a9 && codePoint <= 0x1d4ac)
+ return true;
+ if (codePoint >= 0x1d4ae && codePoint <= 0x1d4b9)
+ return true;
+ if (codePoint >= 0x1d4bb && codePoint <= 0x1d4bb)
+ return true;
+ if (codePoint >= 0x1d4bd && codePoint <= 0x1d4c3)
+ return true;
+ if (codePoint >= 0x1d4c5 && codePoint <= 0x1d505)
+ return true;
+ if (codePoint >= 0x1d507 && codePoint <= 0x1d50a)
+ return true;
+ if (codePoint >= 0x1d50d && codePoint <= 0x1d514)
+ return true;
+ if (codePoint >= 0x1d516 && codePoint <= 0x1d51c)
+ return true;
+ if (codePoint >= 0x1d51e && codePoint <= 0x1d539)
+ return true;
+ if (codePoint >= 0x1d53b && codePoint <= 0x1d53e)
+ return true;
+ if (codePoint >= 0x1d540 && codePoint <= 0x1d544)
+ return true;
+ if (codePoint >= 0x1d546 && codePoint <= 0x1d546)
+ return true;
+ if (codePoint >= 0x1d54a && codePoint <= 0x1d550)
+ return true;
+ if (codePoint >= 0x1d552 && codePoint <= 0x1d6a5)
+ return true;
+ if (codePoint >= 0x1d6a8 && codePoint <= 0x1d6c0)
+ return true;
+ if (codePoint >= 0x1d6c2 && codePoint <= 0x1d6da)
+ return true;
+ if (codePoint >= 0x1d6dc && codePoint <= 0x1d6fa)
+ return true;
+ if (codePoint >= 0x1d6fc && codePoint <= 0x1d714)
+ return true;
+ if (codePoint >= 0x1d716 && codePoint <= 0x1d734)
+ return true;
+ if (codePoint >= 0x1d736 && codePoint <= 0x1d74e)
+ return true;
+ if (codePoint >= 0x1d750 && codePoint <= 0x1d76e)
+ return true;
+ if (codePoint >= 0x1d770 && codePoint <= 0x1d788)
+ return true;
+ if (codePoint >= 0x1d78a && codePoint <= 0x1d7a8)
+ return true;
+ if (codePoint >= 0x1d7aa && codePoint <= 0x1d7c2)
+ return true;
+ if (codePoint >= 0x1d7c4 && codePoint <= 0x1d7cb)
+ return true;
+ if (codePoint >= 0x1d7ce && codePoint <= 0x1d7ff)
+ return true;
+ if (codePoint >= 0x1da00 && codePoint <= 0x1da36)
+ return true;
+ if (codePoint >= 0x1da3b && codePoint <= 0x1da6c)
+ return true;
+ if (codePoint >= 0x1da75 && codePoint <= 0x1da75)
+ return true;
+ if (codePoint >= 0x1da84 && codePoint <= 0x1da84)
+ return true;
+ if (codePoint >= 0x1da9b && codePoint <= 0x1da9f)
+ return true;
+ if (codePoint >= 0x1daa1 && codePoint <= 0x1daaf)
+ return true;
+ if (codePoint >= 0x1e000 && codePoint <= 0x1e006)
+ return true;
+ if (codePoint >= 0x1e008 && codePoint <= 0x1e018)
+ return true;
+ if (codePoint >= 0x1e01b && codePoint <= 0x1e021)
+ return true;
+ if (codePoint >= 0x1e023 && codePoint <= 0x1e024)
+ return true;
+ if (codePoint >= 0x1e026 && codePoint <= 0x1e02a)
+ return true;
+ if (codePoint >= 0x1e800 && codePoint <= 0x1e8c4)
+ return true;
+ if (codePoint >= 0x1e8d0 && codePoint <= 0x1e8d6)
+ return true;
+ if (codePoint >= 0x1e900 && codePoint <= 0x1e94a)
+ return true;
+ if (codePoint >= 0x1e950 && codePoint <= 0x1e959)
+ return true;
+ if (codePoint >= 0x1ee00 && codePoint <= 0x1ee03)
+ return true;
+ if (codePoint >= 0x1ee05 && codePoint <= 0x1ee1f)
+ return true;
+ if (codePoint >= 0x1ee21 && codePoint <= 0x1ee22)
+ return true;
+ if (codePoint >= 0x1ee24 && codePoint <= 0x1ee24)
+ return true;
+ if (codePoint >= 0x1ee27 && codePoint <= 0x1ee27)
+ return true;
+ if (codePoint >= 0x1ee29 && codePoint <= 0x1ee32)
+ return true;
+ if (codePoint >= 0x1ee34 && codePoint <= 0x1ee37)
+ return true;
+ if (codePoint >= 0x1ee39 && codePoint <= 0x1ee39)
+ return true;
+ if (codePoint >= 0x1ee3b && codePoint <= 0x1ee3b)
+ return true;
+ if (codePoint >= 0x1ee42 && codePoint <= 0x1ee42)
+ return true;
+ if (codePoint >= 0x1ee47 && codePoint <= 0x1ee47)
+ return true;
+ if (codePoint >= 0x1ee49 && codePoint <= 0x1ee49)
+ return true;
+ if (codePoint >= 0x1ee4b && codePoint <= 0x1ee4b)
+ return true;
+ if (codePoint >= 0x1ee4d && codePoint <= 0x1ee4f)
+ return true;
+ if (codePoint >= 0x1ee51 && codePoint <= 0x1ee52)
+ return true;
+ if (codePoint >= 0x1ee54 && codePoint <= 0x1ee54)
+ return true;
+ if (codePoint >= 0x1ee57 && codePoint <= 0x1ee57)
+ return true;
+ if (codePoint >= 0x1ee59 && codePoint <= 0x1ee59)
+ return true;
+ if (codePoint >= 0x1ee5b && codePoint <= 0x1ee5b)
+ return true;
+ if (codePoint >= 0x1ee5d && codePoint <= 0x1ee5d)
+ return true;
+ if (codePoint >= 0x1ee5f && codePoint <= 0x1ee5f)
+ return true;
+ if (codePoint >= 0x1ee61 && codePoint <= 0x1ee62)
+ return true;
+ if (codePoint >= 0x1ee64 && codePoint <= 0x1ee64)
+ return true;
+ if (codePoint >= 0x1ee67 && codePoint <= 0x1ee6a)
+ return true;
+ if (codePoint >= 0x1ee6c && codePoint <= 0x1ee72)
+ return true;
+ if (codePoint >= 0x1ee74 && codePoint <= 0x1ee77)
+ return true;
+ if (codePoint >= 0x1ee79 && codePoint <= 0x1ee7c)
+ return true;
+ if (codePoint >= 0x1ee7e && codePoint <= 0x1ee7e)
+ return true;
+ if (codePoint >= 0x1ee80 && codePoint <= 0x1ee89)
+ return true;
+ if (codePoint >= 0x1ee8b && codePoint <= 0x1ee9b)
+ return true;
+ if (codePoint >= 0x1eea1 && codePoint <= 0x1eea3)
+ return true;
+ if (codePoint >= 0x1eea5 && codePoint <= 0x1eea9)
+ return true;
+ if (codePoint >= 0x1eeab && codePoint <= 0x1eebb)
+ return true;
+ if (codePoint >= 0x20000 && codePoint <= 0x2a6d6)
+ return true;
+ if (codePoint >= 0x2a700 && codePoint <= 0x2b734)
+ return true;
+ if (codePoint >= 0x2b740 && codePoint <= 0x2b81d)
+ return true;
+ if (codePoint >= 0x2b820 && codePoint <= 0x2cea1)
+ return true;
+ if (codePoint >= 0x2f800 && codePoint <= 0x2fa1d)
+ return true;
+ if (codePoint >= 0xe0100 && codePoint <= 0xe01ef)
+ return true;
+ return false;
+}
diff --git a/js/src/vm/Unicode.h b/js/src/vm/Unicode.h
index 8b538d06de..bdac848fbd 100644
--- a/js/src/vm/Unicode.h
+++ b/js/src/vm/Unicode.h
@@ -143,11 +143,15 @@ IsIdentifierStart(char16_t ch)
return CharInfo(ch).isUnicodeIDStart();
}
+bool
+IsIdentifierStartNonBMP(uint32_t codePoint);
+
inline bool
IsIdentifierStart(uint32_t codePoint)
{
- // TODO: Supplemental code points not yet supported (bug 1197230).
- return codePoint <= UTF16Max && IsIdentifierStart(char16_t(codePoint));
+ if (MOZ_UNLIKELY(codePoint > UTF16Max))
+ return IsIdentifierStartNonBMP(codePoint);
+ return IsIdentifierStart(char16_t(codePoint));
}
inline bool
@@ -170,11 +174,16 @@ IsIdentifierPart(char16_t ch)
return CharInfo(ch).isUnicodeIDContinue();
}
+
+bool
+IsIdentifierPartNonBMP(uint32_t codePoint);
+
inline bool
IsIdentifierPart(uint32_t codePoint)
{
- // TODO: Supplemental code points not yet supported (bug 1197230).
- return codePoint <= UTF16Max && IsIdentifierPart(char16_t(codePoint));
+ if (MOZ_UNLIKELY(codePoint > UTF16Max))
+ return IsIdentifierPartNonBMP(codePoint);
+ return IsIdentifierPart(char16_t(codePoint));
}
inline bool
@@ -183,6 +192,17 @@ IsUnicodeIDStart(char16_t ch)
return CharInfo(ch).isUnicodeIDStart();
}
+bool
+IsUnicodeIDStartNonBMP(uint32_t codePoint);
+
+inline bool
+IsUnicodeIDStart(uint32_t codePoint)
+{
+ if (MOZ_UNLIKELY(codePoint > UTF16Max))
+ return IsIdentifierStartNonBMP(codePoint);
+ return IsUnicodeIDStart(char16_t(codePoint));
+}
+
inline bool
IsSpace(char16_t ch)
{
diff --git a/js/src/vm/UnicodeNonBMP.h b/js/src/vm/UnicodeNonBMP.h
index 6cc64cde4a..f99e227cdd 100644
--- a/js/src/vm/UnicodeNonBMP.h
+++ b/js/src/vm/UnicodeNonBMP.h
@@ -10,6 +10,16 @@
#ifndef vm_UnicodeNonBMP_h
#define vm_UnicodeNonBMP_h
+// |macro| receives the following arguments
+// macro(FROM, TO, LEAD, TRAIL_FROM, TRAIL_TO, DIFF)
+// FROM: code point where the range starts
+// TO: code point where the range ends
+// LEAD: common lead surrogate of FROM and TO
+// TRAIL_FROM: trail surrogate of FROM
+// TRAIL_FROM: trail surrogate of TO
+// DIFF: the difference between the code point in the range and
+// converted code point
+
#define FOR_EACH_NON_BMP_LOWERCASE(macro) \
macro(0x10400, 0x10427, 0xd801, 0xdc00, 0xdc27, 40) \
macro(0x104b0, 0x104d3, 0xd801, 0xdcb0, 0xdcd3, 40) \
diff --git a/js/src/vm/make_unicode.py b/js/src/vm/make_unicode.py
index 73c090ac91..83f0d004b3 100755
--- a/js/src/vm/make_unicode.py
+++ b/js/src/vm/make_unicode.py
@@ -155,37 +155,65 @@ def utf16_encode(code):
return lead, trail
def make_non_bmp_convert_macro(out_file, name, convert_map):
+ # Find continuous range in convert_map.
convert_list = []
entry = None
for code in sorted(convert_map.keys()):
+ lead, trail = utf16_encode(code)
converted = convert_map[code]
diff = converted - code
- if entry and code == entry['code'] + entry['length'] and diff == entry['diff']:
+ if (entry and code == entry['code'] + entry['length'] and
+ diff == entry['diff'] and lead == entry['lead']):
+
entry['length'] += 1
continue
- entry = { 'code': code, 'diff': diff, 'length': 1 }
+ entry = {
+ 'code': code,
+ 'diff': diff,
+ 'length': 1,
+ 'lead': lead,
+ 'trail': trail,
+ }
convert_list.append(entry)
+ # Generate macro call for each range.
lines = []
for entry in convert_list:
from_code = entry['code']
to_code = entry['code'] + entry['length'] - 1
diff = entry['diff']
- from_lead, from_trail = utf16_encode(from_code)
- to_lead, to_trail = utf16_encode(to_code)
-
- assert from_lead == to_lead
+ lead = entry['lead']
+ from_trail = entry['trail']
+ to_trail = entry['trail'] + entry['length'] - 1
lines.append(' macro(0x{:x}, 0x{:x}, 0x{:x}, 0x{:x}, 0x{:x}, {:d})'.format(
- from_code, to_code, from_lead, from_trail, to_trail, diff))
+ from_code, to_code, lead, from_trail, to_trail, diff))
out_file.write('#define FOR_EACH_NON_BMP_{}(macro) \\\n'.format(name))
out_file.write(' \\\n'.join(lines))
out_file.write('\n')
+def for_each_non_bmp_group(group_set):
+ # Find continuous range in group_set.
+ group_list = []
+ entry = None
+ for code in sorted(group_set.keys()):
+ if entry and code == entry['code'] + entry['length']:
+ entry['length'] += 1
+ continue
+
+ entry = {
+ 'code': code,
+ 'length': 1
+ }
+ group_list.append(entry)
+
+ for entry in group_list:
+ yield (entry['code'], entry['code'] + entry['length'] - 1)
+
def process_derived_core_properties(derived_core_properties):
id_start = set()
id_continue = set()
@@ -214,6 +242,9 @@ def process_unicode_data(unicode_data, derived_core_properties):
non_bmp_lower_map = {}
non_bmp_upper_map = {}
+ non_bmp_id_start_set = {}
+ non_bmp_id_cont_set = {}
+ non_bmp_space_set = {}
(id_start, id_continue) = process_derived_core_properties(derived_core_properties)
@@ -246,6 +277,13 @@ def process_unicode_data(unicode_data, derived_core_properties):
non_bmp_lower_map[code] = lower
if code != upper:
non_bmp_upper_map[code] = upper
+ if category == 'Zs':
+ non_bmp_space_set[code] = 1
+ test_space_table.append(code)
+ if code in id_start:
+ non_bmp_id_start_set[code] = 1
+ if code in id_continue:
+ non_bmp_id_cont_set[code] = 1
continue
# we combine whitespace and lineterminators because in pratice we don't need them separated
@@ -315,6 +353,8 @@ def process_unicode_data(unicode_data, derived_core_properties):
table, index,
same_upper_table, same_upper_index,
non_bmp_lower_map, non_bmp_upper_map,
+ non_bmp_space_set,
+ non_bmp_id_start_set, non_bmp_id_cont_set,
test_table, test_space_table,
)
@@ -412,6 +452,16 @@ def make_non_bmp_file(version,
#ifndef vm_UnicodeNonBMP_h
#define vm_UnicodeNonBMP_h
+// |macro| receives the following arguments
+// macro(FROM, TO, LEAD, TRAIL_FROM, TRAIL_TO, DIFF)
+// FROM: code point where the range starts
+// TO: code point where the range ends
+// LEAD: common lead surrogate of FROM and TO
+// TRAIL_FROM: trail surrogate of FROM
+// TRAIL_FROM: trail surrogate of TO
+// DIFF: the difference between the code point in the range and
+// converted code point
+
""")
make_non_bmp_convert_macro(non_bmp_file, 'LOWERCASE', non_bmp_lower_map)
@@ -525,7 +575,9 @@ if (typeof reportCompare === "function")
def make_unicode_file(version,
table, index,
same_upper_table, same_upper_index,
- folding_table, folding_index):
+ folding_table, folding_index,
+ non_bmp_space_set,
+ non_bmp_id_start_set, non_bmp_id_cont_set):
index1, index2, shift = splitbins(index)
# Don't forget to update CharInfo in Unicode.h if you need to change this
@@ -682,6 +734,43 @@ def make_unicode_file(version,
dump(folding_index2, 'folding_index2', data_file)
data_file.write('\n')
+ # If the following assert fails, it means space character is added to
+ # non-BMP area. In that case the following code should be uncommented
+ # and the corresponding code should be added to frontend.
+ assert len(non_bmp_space_set.keys()) == 0
+
+ data_file.write("""\
+bool
+js::unicode::IsIdentifierStartNonBMP(uint32_t codePoint)
+{
+""")
+
+ for (from_code, to_code) in for_each_non_bmp_group(non_bmp_id_start_set):
+ data_file.write("""\
+ if (codePoint >= 0x{:x} && codePoint <= 0x{:x})
+ return true;
+""".format(from_code, to_code))
+
+ data_file.write("""\
+ return false;
+}
+
+bool
+js::unicode::IsIdentifierPartNonBMP(uint32_t codePoint)
+{
+""")
+
+ for (from_code, to_code) in for_each_non_bmp_group(non_bmp_id_cont_set):
+ data_file.write("""\
+ if (codePoint >= 0x{:x} && codePoint <= 0x{:x})
+ return true;
+""".format(from_code, to_code))
+
+ data_file.write("""\
+ return false;
+}
+""")
+
def getsize(data):
""" return smallest possible integer size for the given array """
maxdata = max(data)
@@ -1000,6 +1089,8 @@ def update_unicode(args):
table, index,
same_upper_table, same_upper_index,
non_bmp_lower_map, non_bmp_upper_map,
+ non_bmp_space_set,
+ non_bmp_id_start_set, non_bmp_id_cont_set,
test_table, test_space_table
) = process_unicode_data(unicode_data, derived_core_properties)
(
@@ -1012,7 +1103,9 @@ def update_unicode(args):
make_unicode_file(unicode_version,
table, index,
same_upper_table, same_upper_index,
- folding_table, folding_index)
+ folding_table, folding_index,
+ non_bmp_space_set,
+ non_bmp_id_start_set, non_bmp_id_cont_set)
make_non_bmp_file(unicode_version,
non_bmp_lower_map, non_bmp_upper_map,
non_bmp_folding_map, non_bmp_rev_folding_map)
diff --git a/js/src/wasm/AsmJS.cpp b/js/src/wasm/AsmJS.cpp
index 34f5a8c0d7..7fade24fb5 100644
--- a/js/src/wasm/AsmJS.cpp
+++ b/js/src/wasm/AsmJS.cpp
@@ -21,6 +21,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/Compression.h"
#include "mozilla/MathAlgorithms.h"
+#include "mozilla/Maybe.h"
#include "jsmath.h"
#include "jsprf.h"
@@ -678,7 +679,7 @@ FunctionObject(ParseNode* fn)
static inline PropertyName*
FunctionName(ParseNode* fn)
{
- if (JSAtom* name = FunctionObject(fn)->name())
+ if (JSAtom* name = FunctionObject(fn)->explicitName())
return name->asPropertyName();
return nullptr;
}
@@ -856,7 +857,7 @@ class NumLit
private:
Which which_;
union {
- Value scalar_;
+ JS::UninitializedValue scalar_;
SimdConstant simd_;
} u;
@@ -879,7 +880,7 @@ class NumLit
int32_t toInt32() const {
MOZ_ASSERT(which_ == Fixnum || which_ == NegativeInt || which_ == BigUnsigned);
- return u.scalar_.toInt32();
+ return u.scalar_.asValueRef().toInt32();
}
uint32_t toUint32() const {
@@ -888,17 +889,17 @@ class NumLit
RawF64 toDouble() const {
MOZ_ASSERT(which_ == Double);
- return RawF64(u.scalar_.toDouble());
+ return RawF64(u.scalar_.asValueRef().toDouble());
}
RawF32 toFloat() const {
MOZ_ASSERT(which_ == Float);
- return RawF32(float(u.scalar_.toDouble()));
+ return RawF32(float(u.scalar_.asValueRef().toDouble()));
}
Value scalarValue() const {
MOZ_ASSERT(which_ != OutOfRangeInt);
- return u.scalar_;
+ return u.scalar_.asValueRef();
}
bool isSimd() const
@@ -3248,7 +3249,7 @@ static bool
CheckFunctionHead(ModuleValidator& m, ParseNode* fn)
{
JSFunction* fun = FunctionObject(fn);
- if (fun->hasRest())
+ if (fn->pn_funbox->hasRest())
return m.fail(fn, "rest args not allowed");
if (fun->isExprBody())
return m.fail(fn, "expression closures not allowed");
@@ -8033,25 +8034,10 @@ TryInstantiate(JSContext* cx, CallArgs args, Module& module, const AsmJSMetadata
return true;
}
-static MOZ_MUST_USE bool
-MaybeAppendUTF8Name(JSContext* cx, const char* utf8Chars, MutableHandle<PropertyNameVector> names)
-{
- if (!utf8Chars)
- return true;
-
- UTF8Chars utf8(utf8Chars, strlen(utf8Chars));
-
- JSAtom* atom = AtomizeUTF8Chars(cx, utf8Chars, strlen(utf8Chars));
- if (!atom)
- return false;
-
- return names.append(atom->asPropertyName());
-}
-
static bool
HandleInstantiationFailure(JSContext* cx, CallArgs args, const AsmJSMetadata& metadata)
{
- RootedAtom name(cx, args.callee().as<JSFunction>().name());
+ RootedAtom name(cx, args.callee().as<JSFunction>().explicitName());
if (cx->isExceptionPending())
return false;
@@ -8068,8 +8054,8 @@ HandleInstantiationFailure(JSContext* cx, CallArgs args, const AsmJSMetadata& me
return false;
}
- uint32_t begin = metadata.srcBodyStart; // starts right after 'use asm'
- uint32_t end = metadata.srcEndBeforeCurly();
+ uint32_t begin = metadata.srcStart;
+ uint32_t end = metadata.srcEndAfterCurly();
Rooted<JSFlatString*> src(cx, source->substringDontDeflate(cx, begin, end));
if (!src)
return false;
@@ -8080,18 +8066,11 @@ HandleInstantiationFailure(JSContext* cx, CallArgs args, const AsmJSMetadata& me
if (!fun)
return false;
- Rooted<PropertyNameVector> formals(cx, PropertyNameVector(cx));
- if (!MaybeAppendUTF8Name(cx, metadata.globalArgumentName.get(), &formals))
- return false;
- if (!MaybeAppendUTF8Name(cx, metadata.importArgumentName.get(), &formals))
- return false;
- if (!MaybeAppendUTF8Name(cx, metadata.bufferArgumentName.get(), &formals))
- return false;
-
CompileOptions options(cx);
options.setMutedErrors(source->mutedErrors())
.setFile(source->filename())
.setNoScriptRval(false);
+ options.asmJSOption = AsmJSOption::Disabled;
// The exported function inherits an implicit strict context if the module
// also inherited it somehow.
@@ -8106,8 +8085,8 @@ HandleInstantiationFailure(JSContext* cx, CallArgs args, const AsmJSMetadata& me
SourceBufferHolder::Ownership ownership = stableChars.maybeGiveOwnershipToCaller()
? SourceBufferHolder::GiveOwnership
: SourceBufferHolder::NoOwnership;
- SourceBufferHolder srcBuf(chars, end - begin, ownership);
- if (!frontend::CompileFunctionBody(cx, &fun, options, formals, srcBuf))
+ SourceBufferHolder srcBuf(chars, stableChars.twoByteRange().length(), ownership);
+ if (!frontend::CompileStandaloneFunction(cx, &fun, options, srcBuf, Nothing()))
return false;
// Call the function we just recompiled.
@@ -8149,7 +8128,7 @@ InstantiateAsmJS(JSContext* cx, unsigned argc, JS::Value* vp)
static JSFunction*
NewAsmJSModuleFunction(ExclusiveContext* cx, JSFunction* origFun, HandleObject moduleObj)
{
- RootedAtom name(cx, origFun->name());
+ RootedAtom name(cx, origFun->explicitName());
JSFunction::Flags flags = origFun->isLambda() ? JSFunction::ASMJS_LAMBDA_CTOR
: JSFunction::ASMJS_CTOR;
@@ -8849,23 +8828,6 @@ js::IsAsmJSModuleLoadedFromCache(JSContext* cx, unsigned argc, Value* vp)
/*****************************************************************************/
// asm.js toString/toSource support
-static MOZ_MUST_USE bool
-MaybeAppendUTF8Chars(JSContext* cx, const char* sep, const char* utf8Chars, StringBuffer* sb)
-{
- if (!utf8Chars)
- return true;
-
- UTF8Chars utf8(utf8Chars, strlen(utf8Chars));
-
- size_t length;
- UniqueTwoByteChars twoByteChars(UTF8CharsToNewTwoByteCharsZ(cx, utf8, &length).get());
- if (!twoByteChars)
- return false;
-
- return sb->append(sep, strlen(sep)) &&
- sb->append(twoByteChars.get(), length);
-}
-
JSString*
js::AsmJSModuleToString(JSContext* cx, HandleFunction fun, bool addParenToLambda)
{
@@ -8884,7 +8846,7 @@ js::AsmJSModuleToString(JSContext* cx, HandleFunction fun, bool addParenToLambda
if (!out.append("function "))
return nullptr;
- if (fun->name() && !out.append(fun->name()))
+ if (fun->explicitName() && !out.append(fun->explicitName()))
return nullptr;
bool haveSource = source->hasSourceData();
@@ -8895,33 +8857,12 @@ js::AsmJSModuleToString(JSContext* cx, HandleFunction fun, bool addParenToLambda
if (!out.append("() {\n [sourceless code]\n}"))
return nullptr;
} else {
- // Whether the function has been created with a Function ctor
- bool funCtor = begin == 0 && end == source->length() && source->argumentsNotIncluded();
- if (funCtor) {
- // Functions created with the function constructor don't have arguments in their source.
- if (!out.append("("))
- return nullptr;
-
- if (!MaybeAppendUTF8Chars(cx, "", metadata.globalArgumentName.get(), &out))
- return nullptr;
- if (!MaybeAppendUTF8Chars(cx, ", ", metadata.importArgumentName.get(), &out))
- return nullptr;
- if (!MaybeAppendUTF8Chars(cx, ", ", metadata.bufferArgumentName.get(), &out))
- return nullptr;
-
- if (!out.append(") {\n"))
- return nullptr;
- }
-
Rooted<JSFlatString*> src(cx, source->substring(cx, begin, end));
if (!src)
return nullptr;
if (!out.append(src))
return nullptr;
-
- if (funCtor && !out.append("\n}"))
- return nullptr;
}
if (addParenToLambda && fun->isLambda() && !out.append(")"))
@@ -8953,16 +8894,12 @@ js::AsmJSFunctionToString(JSContext* cx, HandleFunction fun)
if (!haveSource) {
// asm.js functions can't be anonymous
- MOZ_ASSERT(fun->name());
- if (!out.append(fun->name()))
+ MOZ_ASSERT(fun->explicitName());
+ if (!out.append(fun->explicitName()))
return nullptr;
if (!out.append("() {\n [sourceless code]\n}"))
return nullptr;
} else {
- // asm.js functions cannot have been created with a Function constructor
- // as they belong within a module.
- MOZ_ASSERT(!(begin == 0 && end == source->length() && source->argumentsNotIncluded()));
-
Rooted<JSFlatString*> src(cx, source->substring(cx, begin, end));
if (!src)
return nullptr;
diff --git a/js/xpconnect/loader/mozJSSubScriptLoader.cpp b/js/xpconnect/loader/mozJSSubScriptLoader.cpp
index 824e9ab9e5..9c8908ea41 100644
--- a/js/xpconnect/loader/mozJSSubScriptLoader.cpp
+++ b/js/xpconnect/loader/mozJSSubScriptLoader.cpp
@@ -130,7 +130,9 @@ PrepareScript(nsIURI* uri,
MutableHandleFunction function)
{
JS::CompileOptions options(cx);
- options.setFileAndLine(uriStr, 1)
+ // Use line 0 to make the function body starts from line 1 when
+ // |reuseGlobal == true|.
+ options.setFileAndLine(uriStr, reuseGlobal ? 0 : 1)
.setVersion(JSVERSION_LATEST);
if (!charset.IsVoid()) {
char16_t* scriptBuf = nullptr;
diff --git a/js/xpconnect/src/ExportHelpers.cpp b/js/xpconnect/src/ExportHelpers.cpp
index 3dbf83e3ba..e574e708ca 100644
--- a/js/xpconnect/src/ExportHelpers.cpp
+++ b/js/xpconnect/src/ExportHelpers.cpp
@@ -329,11 +329,20 @@ NewFunctionForwarder(JSContext* cx, HandleId idArg, HandleObject callable,
if (id == JSID_VOIDHANDLE)
id = GetJSIDByIndex(cx, XPCJSContext::IDX_EMPTYSTRING);
+ // If our callable is a (possibly wrapped) function, we can give
+ // the exported thing the right number of args.
+ unsigned nargs = 0;
+ RootedObject unwrapped(cx, js::UncheckedUnwrap(callable));
+ if (unwrapped) {
+ if (JSFunction* fun = JS_GetObjectFunction(unwrapped))
+ nargs = JS_GetFunctionArity(fun);
+ }
+
// We have no way of knowing whether the underlying function wants to be a
// constructor or not, so we just mark all forwarders as constructors, and
// let the underlying function throw for construct calls if it wants.
JSFunction* fun = js::NewFunctionByIdWithReserved(cx, FunctionForwarder,
- 0, JSFUN_CONSTRUCTOR, id);
+ nargs, JSFUN_CONSTRUCTOR, id);
if (!fun)
return false;
diff --git a/js/xpconnect/src/XPCJSContext.cpp b/js/xpconnect/src/XPCJSContext.cpp
index defd1b7852..8862bca321 100644
--- a/js/xpconnect/src/XPCJSContext.cpp
+++ b/js/xpconnect/src/XPCJSContext.cpp
@@ -59,14 +59,6 @@
#include "nsIXULRuntime.h"
#include "nsJSPrincipals.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
-
-#if defined(MOZ_JEMALLOC4)
-#include "mozmemory.h"
-#endif
-
#ifdef XP_WIN
#include <windows.h>
#endif
@@ -151,18 +143,6 @@ public:
mActive = false;
}
} else {
-#if defined(MOZ_JEMALLOC4)
- if (mPurge) {
- /* Jemalloc purges dirty pages regularly during free() when the
- * ratio of dirty pages compared to active pages is higher than
- * 1 << lg_dirty_mult. A high ratio can have an impact on
- * performance, so we use the default ratio of 8, but force a
- * regular purge of all remaining dirty pages, after cycle
- * collection. */
- Telemetry::AutoTimer<Telemetry::MEMORY_FREE_PURGED_PAGES_MS> timer;
- jemalloc_free_dirty_pages();
- }
-#endif
mActive = false;
}
return NS_OK;
@@ -709,11 +689,6 @@ XPCJSContext::GCSliceCallback(JSContext* cx,
if (!self)
return;
-#ifdef MOZ_CRASHREPORTER
- CrashReporter::SetGarbageCollecting(progress == JS::GC_CYCLE_BEGIN ||
- progress == JS::GC_SLICE_BEGIN);
-#endif
-
if (self->mPrevGCSliceCallback)
(*self->mPrevGCSliceCallback)(cx, progress, desc);
}
@@ -1473,6 +1448,8 @@ ReloadPrefsCallback(const char* pref, void* data)
sExtraWarningsForSystemJS = Preferences::GetBool(JS_OPTIONS_DOT_STR "strict.debug");
#endif
+ bool arrayProtoValues = Preferences::GetBool(JS_OPTIONS_DOT_STR "array_prototype_values");
+
JS::ContextOptionsRef(cx).setBaseline(useBaseline)
.setIon(useIon)
.setAsmJS(useAsmJS)
@@ -1484,7 +1461,8 @@ ReloadPrefsCallback(const char* pref, void* data)
.setThrowOnDebuggeeWouldRun(throwOnDebuggeeWouldRun)
.setDumpStackOnDebuggeeWouldRun(dumpStackOnDebuggeeWouldRun)
.setWerror(werror)
- .setExtraWarnings(extraWarnings);
+ .setExtraWarnings(extraWarnings)
+ .setArrayProtoValues(arrayProtoValues);
JS_SetParallelParsingEnabled(cx, parallelParsing);
JS_SetOffthreadIonCompilationEnabled(cx, offthreadIonCompilation);
diff --git a/js/xpconnect/src/XPCShellImpl.cpp b/js/xpconnect/src/XPCShellImpl.cpp
index d9629bfeda..45d00d3905 100644
--- a/js/xpconnect/src/XPCShellImpl.cpp
+++ b/js/xpconnect/src/XPCShellImpl.cpp
@@ -59,11 +59,6 @@
#include <unistd.h> /* for isatty() */
#endif
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#include "nsICrashReporter.h"
-#endif
-
using namespace mozilla;
using namespace JS;
using mozilla::dom::AutoJSAPI;
@@ -1372,18 +1367,6 @@ XRE_XPCShellMain(int argc, char** argv, char** envp,
argv += 2;
}
-#ifdef MOZ_CRASHREPORTER
- const char* val = getenv("MOZ_CRASHREPORTER");
- if (val && *val) {
- rv = CrashReporter::SetExceptionHandler(greDir, true);
- if (NS_FAILED(rv)) {
- printf("CrashReporter::SetExceptionHandler failed!\n");
- return 1;
- }
- MOZ_ASSERT(CrashReporter::GetEnabled());
- }
-#endif
-
{
if (argc > 1 && !strcmp(argv[1], "--greomni")) {
nsCOMPtr<nsIFile> greOmni;
@@ -1603,12 +1586,6 @@ XRE_XPCShellMain(int argc, char** argv, char** envp,
dirprovider.ClearPluginDir();
dirprovider.ClearAppFile();
-#ifdef MOZ_CRASHREPORTER
- // Shut down the crashreporter service to prevent leaking some strings it holds.
- if (CrashReporter::GetEnabled())
- CrashReporter::UnsetExceptionHandler();
-#endif
-
NS_LogTerm();
return result;
diff --git a/js/xpconnect/src/XPCVariant.cpp b/js/xpconnect/src/XPCVariant.cpp
index a3d2b88c50..4c12301728 100644
--- a/js/xpconnect/src/XPCVariant.cpp
+++ b/js/xpconnect/src/XPCVariant.cpp
@@ -55,7 +55,7 @@ XPCTraceableVariant::~XPCTraceableVariant()
{
Value val = GetJSValPreserveColor();
- MOZ_ASSERT(val.isGCThing(), "Must be traceable or unlinked");
+ MOZ_ASSERT(val.isGCThing() || val.isNull(), "Must be traceable or unlinked");
mData.Cleanup();
@@ -65,7 +65,7 @@ XPCTraceableVariant::~XPCTraceableVariant()
void XPCTraceableVariant::TraceJS(JSTracer* trc)
{
- MOZ_ASSERT(GetJSValPreserveColor().isMarkable());
+ MOZ_ASSERT(GetJSValPreserveColor().isGCThing());
JS::TraceEdge(trc, &mJSVal, "XPCTraceableVariant::mJSVal");
}
@@ -86,7 +86,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(XPCVariant)
tmp->mData.Cleanup();
- if (val.isMarkable()) {
+ if (val.isGCThing()) {
XPCTraceableVariant* v = static_cast<XPCTraceableVariant*>(tmp);
v->RemoveFromRootSet();
}
@@ -99,7 +99,7 @@ XPCVariant::newVariant(JSContext* cx, const Value& aJSVal)
{
RefPtr<XPCVariant> variant;
- if (!aJSVal.isMarkable())
+ if (!aJSVal.isGCThing())
variant = new XPCVariant(cx, aJSVal);
else
variant = new XPCTraceableVariant(cx, aJSVal);
diff --git a/js/xpconnect/src/XPCWrappedNative.cpp b/js/xpconnect/src/XPCWrappedNative.cpp
index acf92f3c37..a12e36baab 100644
--- a/js/xpconnect/src/XPCWrappedNative.cpp
+++ b/js/xpconnect/src/XPCWrappedNative.cpp
@@ -1785,9 +1785,12 @@ CallMethodHelper::ConvertIndependentParam(uint8_t i)
// indirectly, regardless of in/out-ness.
if (type_tag == nsXPTType::T_JSVAL) {
// Root the value.
- dp->val.j.setUndefined();
- if (!js::AddRawValueRoot(mCallContext, &dp->val.j, "XPCWrappedNative::CallMethod param"))
+ dp->val.j.asValueRef().setUndefined();
+ if (!js::AddRawValueRoot(mCallContext, &dp->val.j.asValueRef(),
+ "XPCWrappedNative::CallMethod param"))
+ {
return false;
+ }
}
// Flag cleanup for anything that isn't self-contained.
diff --git a/js/xpconnect/tests/chrome/test_xrayToJS.xul b/js/xpconnect/tests/chrome/test_xrayToJS.xul
index 2f4e70f47c..ed67a34fe7 100644
--- a/js/xpconnect/tests/chrome/test_xrayToJS.xul
+++ b/js/xpconnect/tests/chrome/test_xrayToJS.xul
@@ -198,9 +198,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=933681
"pop", "shift", "unshift", "splice", "concat", "slice", "lastIndexOf", "indexOf",
"includes", "forEach", "map", "reduce", "reduceRight", "filter", "some", "every", "find",
"findIndex", "copyWithin", "fill", Symbol.iterator, Symbol.unscopables, "entries", "keys",
- "constructor"];
+ "values", "constructor"];
if (isNightlyBuild) {
- gPrototypeProperties['Array'].push("values");
+ // ...nothing now
}
gConstructorProperties['Array'] =
constructorProps(["join", "reverse", "sort", "push", "pop", "shift",
@@ -220,11 +220,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=933681
// There is no TypedArray constructor, looks like.
is(window.TypedArray, undefined, "If this ever changes, add to this test!");
for (var c of errorObjectClasses) {
- gPrototypeProperties[c] = ["constructor", "name",
- // We don't actually resolve these empty data properties
- // onto the Xray prototypes, but we list them here to make
- // the test happy.
- "lineNumber", "columnNumber", "fileName", "message", "stack"];
+ gPrototypeProperties[c] = ["constructor", "name", "message", "stack"];
gConstructorProperties[c] = constructorProps([]);
}
// toString and toSource only live on the parent proto (Error.prototype).
@@ -239,8 +235,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=933681
gPrototypeProperties['RegExp'] =
["constructor", "toSource", "toString", "compile", "exec", "test",
Symbol.match, Symbol.replace, Symbol.search, Symbol.split,
- "flags", "global", "ignoreCase", "multiline", "source", "sticky", "unicode",
- "lastIndex"];
+ "flags", "global", "ignoreCase", "multiline", "source", "sticky", "unicode"];
gConstructorProperties['RegExp'] =
constructorProps(["input", "lastMatch", "lastParen",
"leftContext", "rightContext", "$1", "$2", "$3", "$4",
@@ -791,8 +786,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=933681
// We only invoke testXray with Error, because that function isn't set up
// to deal with dependent classes and fixing it up is more trouble than
// it's worth.
- testXray('Error', new iwin.Error('some error message'), new iwin.Error(),
- ['fileName', 'lineNumber', 'columnNumber', 'message']);
+ testXray('Error', new iwin.Error('some error message'), new iwin.Error());
// Make sure that the dependent classes have their prototypes set up correctly.
for (let c of errorObjectClasses.filter(x => x != "Error")) {
@@ -806,7 +800,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=933681
e.wrappedJSObject[name] = goodReplacement;
is(e[name], goodReplacement, name + " property ok after replacement: " + goodReplacement);
e.wrappedJSObject[name] = faultyReplacement;
- is(e[name], undefined, name + " property censored after suspicious replacement");
+ is(e[name], name == 'message' ? "" : undefined, name + " property skipped after suspicious replacement");
}
testProperty('message', x => x == 'some message', 'some other message', 42);
testProperty('fileName', x => x == '', 'otherFilename.html', new iwin.Object());
diff --git a/js/xpconnect/tests/unit/test_exportFunction.js b/js/xpconnect/tests/unit/test_exportFunction.js
index 830816342b..9e1bf20829 100644
--- a/js/xpconnect/tests/unit/test_exportFunction.js
+++ b/js/xpconnect/tests/unit/test_exportFunction.js
@@ -10,12 +10,14 @@ function run_test() {
epsb.do_check_true = do_check_true;
epsb.do_check_eq = do_check_eq;
subsb.do_check_true = do_check_true;
+ subsb.do_check_eq = do_check_eq;
// Exporting should work if prinicipal of the source sandbox
// subsumes the principal of the target sandbox.
Cu.evalInSandbox("(" + function() {
var wasCalled = false;
this.funToExport = function(expectedThis, a, obj, native, mixed, callback) {
+ do_check_eq(arguments.callee.length, 6);
do_check_eq(a, 42);
do_check_eq(obj, subsb.tobecloned);
do_check_eq(obj.cloned, "cloned");
@@ -53,6 +55,7 @@ function run_test() {
invokedCallback = false;
callback = function() { invokedCallback = true; };
imported(this, 42, tobecloned, native, mixed, callback);
+ do_check_eq(imported.length, 6);
do_check_true(invokedCallback);
}.toSource() + ")()", subsb);
diff --git a/js/xpconnect/tests/unit/test_xray_regexp.js b/js/xpconnect/tests/unit/test_xray_regexp.js
new file mode 100644
index 0000000000..4baffd63e9
--- /dev/null
+++ b/js/xpconnect/tests/unit/test_xray_regexp.js
@@ -0,0 +1,9 @@
+const Cu = Components.utils;
+
+function run_test() {
+ var sandbox = Cu.Sandbox('http://www.example.com');
+ var regexp = Cu.evalInSandbox("/test/i", sandbox);
+ equal(RegExp.prototype.toString.call(regexp), "/test/i");
+ var prototype = Cu.evalInSandbox("RegExp.prototype", sandbox);
+ equal(typeof prototype.lastIndex, "undefined");
+}
diff --git a/js/xpconnect/tests/unit/xpcshell.ini b/js/xpconnect/tests/unit/xpcshell.ini
index 99d44b975b..12648d3ecc 100644
--- a/js/xpconnect/tests/unit/xpcshell.ini
+++ b/js/xpconnect/tests/unit/xpcshell.ini
@@ -133,5 +133,6 @@ head = head_watchdog.js
[test_xrayed_iterator.js]
[test_xray_SavedFrame.js]
[test_xray_SavedFrame-02.js]
+[test_xray_regexp.js]
[test_resolve_dead_promise.js]
[test_asyncLoadSubScriptError.js]
diff --git a/js/xpconnect/wrappers/XrayWrapper.cpp b/js/xpconnect/wrappers/XrayWrapper.cpp
index 5e537692d0..48a9fdc68e 100644
--- a/js/xpconnect/wrappers/XrayWrapper.cpp
+++ b/js/xpconnect/wrappers/XrayWrapper.cpp
@@ -636,18 +636,6 @@ JSXrayTraits::resolveOwnProperty(JSContext* cx, const Wrapper& jsWrapper,
return true;
}
- // Handle the 'name' property for error prototypes.
- if (IsErrorObjectKey(key) && id == GetJSIDByIndex(cx, XPCJSContext::IDX_NAME)) {
- RootedId className(cx);
- ProtoKeyToId(cx, key, &className);
- FillPropertyDescriptor(desc, wrapper, 0, UndefinedValue());
- return JS_IdToValue(cx, className, desc.value());
- }
-
- // Handle the 'lastIndex' property for RegExp prototypes.
- if (key == JSProto_RegExp && id == GetJSIDByIndex(cx, XPCJSContext::IDX_LASTINDEX))
- return getOwnPropertyFromWrapperIfSafe(cx, wrapper, id, desc);
-
// Grab the JSClass. We require all Xrayable classes to have a ClassSpec.
const js::Class* clasp = js::GetObjectClass(target);
MOZ_ASSERT(clasp->specDefined());
@@ -889,14 +877,6 @@ JSXrayTraits::enumerateNames(JSContext* cx, HandleObject wrapper, unsigned flags
if (!props.append(GetJSIDByIndex(cx, XPCJSContext::IDX_CONSTRUCTOR)))
return false;
- // For Error protoypes, add the 'name' property.
- if (IsErrorObjectKey(key) && !props.append(GetJSIDByIndex(cx, XPCJSContext::IDX_NAME)))
- return false;
-
- // For RegExp protoypes, add the 'lastIndex' property.
- if (key == JSProto_RegExp && !props.append(GetJSIDByIndex(cx, XPCJSContext::IDX_LASTINDEX)))
- return false;
-
// Grab the JSClass. We require all Xrayable classes to have a ClassSpec.
const js::Class* clasp = js::GetObjectClass(target);
MOZ_ASSERT(clasp->specDefined());
diff --git a/layout/base/RestyleManagerBase.cpp b/layout/base/RestyleManagerBase.cpp
index 9a5ce43ebf..d96d9dbbb0 100644
--- a/layout/base/RestyleManagerBase.cpp
+++ b/layout/base/RestyleManagerBase.cpp
@@ -154,7 +154,7 @@ RestyleManagerBase::ChangeHintToString(nsChangeHint aHint)
"NeutralChange", "InvalidateRenderingObservers",
"ReflowChangesSizeOrPosition", "UpdateComputedBSize",
"UpdateUsesOpacity", "UpdateBackgroundPosition",
- "AddOrRemoveTransform"
+ "AddOrRemoveTransform", "CSSOverflowChange",
};
static_assert(nsChangeHint_AllHints == (1 << ArrayLength(names)) - 1,
"Name list doesn't match change hints.");
@@ -1070,6 +1070,67 @@ RestyleManagerBase::ProcessRestyledFrames(nsStyleChangeList& aChangeList)
FramePropertyTable* propTable = presContext->PropertyTable();
nsCSSFrameConstructor* frameConstructor = presContext->FrameConstructor();
+ // Handle nsChangeHint_CSSOverflowChange, by either updating the
+ // scrollbars on the viewport, or upgrading the change hint to frame-reconstruct.
+ for (nsStyleChangeData& data : aChangeList) {
+ if (data.mHint & nsChangeHint_CSSOverflowChange) {
+ data.mHint &= ~nsChangeHint_CSSOverflowChange;
+ bool doReconstruct = true; // assume the worst
+
+ // Only bother with this if we're html/body, since:
+ // (a) It'd be *expensive* to reframe these particular nodes. They're
+ // at the root, so reframing would mean rebuilding the world.
+ // (b) It's often *unnecessary* to reframe for "overflow" changes on
+ // these particular nodes. In general, the only reason we reframe
+ // for "overflow" changes is so we can construct (or destroy) a
+ // scrollframe & scrollbars -- and the html/body nodes often don't
+ // need their own scrollframe/scrollbars because they coopt the ones
+ // on the viewport (which always exist). So depending on whether
+ // that's happening, we can skip the reframe for these nodes.
+ if (data.mContent->IsAnyOfHTMLElements(nsGkAtoms::body,
+ nsGkAtoms::html)) {
+ // If the restyled element provided/provides the scrollbar styles for
+ // the viewport before and/or after this restyle, AND it's not coopting
+ // that responsibility from some other element (which would need
+ // reconstruction to make its own scrollframe now), THEN: we don't need
+ // to reconstruct - we can just reflow, because no scrollframe is being
+ // added/removed.
+ nsIContent* prevOverrideNode =
+ presContext->GetViewportScrollbarStylesOverrideNode();
+ nsIContent* newOverrideNode =
+ presContext->UpdateViewportScrollbarStylesOverride();
+
+ if (data.mContent == prevOverrideNode ||
+ data.mContent == newOverrideNode) {
+ // If we get here, the restyled element provided the scrollbar styles
+ // for viewport before this restyle, OR it will provide them after.
+ if (!prevOverrideNode || !newOverrideNode ||
+ prevOverrideNode == newOverrideNode) {
+ // If we get here, the restyled element is NOT replacing (or being
+ // replaced by) some other element as the viewport's
+ // scrollbar-styles provider. (If it were, we'd potentially need to
+ // reframe to create a dedicated scrollframe for whichever element
+ // is being booted from providing viewport scrollbar styles.)
+ //
+ // Under these conditions, we're OK to assume that this "overflow"
+ // change only impacts the root viewport's scrollframe, which
+ // already exists, so we can simply reflow instead of reframing.
+ // When requesting this reflow, we send the exact same change hints
+ // that "width" and "height" would send (since conceptually,
+ // adding/removing scrollbars is like changing the available
+ // space).
+ data.mHint |= (nsChangeHint_ReflowHintsForISizeChange |
+ nsChangeHint_ReflowHintsForBSizeChange);
+ doReconstruct = false;
+ }
+ }
+ }
+ if (doReconstruct) {
+ data.mHint |= nsChangeHint_ReconstructFrame;
+ }
+ }
+ }
+
// Make sure to not rebuild quote or counter lists while we're
// processing restyles
frameConstructor->BeginUpdate();
diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp
index a118c38f93..767298b85c 100644
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -3658,13 +3658,13 @@ nsCSSFrameConstructor::FindInputData(Element* aElement,
nsCSSAnonBoxes::buttonContent) },
// TODO: this is temporary until a frame is written: bug 635240.
SIMPLE_INT_CREATE(NS_FORM_INPUT_NUMBER, NS_NewNumberControlFrame),
- // TODO: this is temporary until a frame is written: bug 888320.
- SIMPLE_INT_CREATE(NS_FORM_INPUT_DATE, NS_NewTextControlFrame),
#if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
// On Android/B2G, date/time input appears as a normal text box.
SIMPLE_INT_CREATE(NS_FORM_INPUT_TIME, NS_NewTextControlFrame),
+ SIMPLE_INT_CREATE(NS_FORM_INPUT_DATE, NS_NewTextControlFrame),
#else
SIMPLE_INT_CREATE(NS_FORM_INPUT_TIME, NS_NewDateTimeControlFrame),
+ SIMPLE_INT_CREATE(NS_FORM_INPUT_DATE, NS_NewDateTimeControlFrame),
#endif
// TODO: this is temporary until a frame is written: bug 888320
SIMPLE_INT_CREATE(NS_FORM_INPUT_MONTH, NS_NewTextControlFrame),
@@ -8246,11 +8246,19 @@ nsCSSFrameConstructor::ContentRemoved(nsIContent* aContainer,
*aDestroyedFramesFor = aChild;
}
+ nsPresContext* presContext = mPresShell->GetPresContext();
+ MOZ_ASSERT(presContext, "Our presShell should have a valid presContext");
+
if (aChild->IsHTMLElement(nsGkAtoms::body) ||
(!aContainer && aChild->IsElement())) {
- // This might be the element we propagated viewport scrollbar
- // styles from. Recompute those.
- mPresShell->GetPresContext()->UpdateViewportScrollbarStylesOverride();
+ // We might be removing the element that we propagated viewport scrollbar
+ // styles from. Recompute those. (This clause covers two of the three
+ // possible scrollbar-propagation sources: the <body> [as aChild or a
+ // descendant] and the root node. The other possible scrollbar-propagation
+ // source is a fullscreen element, and we have code elsewhere to update
+ // scrollbars after fullscreen elements are removed -- specifically, it's
+ // part of the fullscreen cleanup code called by Element::UnbindFromTree.)
+ presContext->UpdateViewportScrollbarStylesOverride();
}
// XXXldb Do we need to re-resolve style to handle the CSS2 + combinator and
@@ -8316,7 +8324,6 @@ nsCSSFrameConstructor::ContentRemoved(nsIContent* aContainer,
ClearDisplayContentsIn(aChild, aContainer);
}
- nsPresContext* presContext = mPresShell->GetPresContext();
#ifdef MOZ_XUL
if (NotifyListBoxBody(presContext, aContainer, aChild, aOldNextSibling,
childFrame, CONTENT_REMOVED)) {
diff --git a/layout/base/nsCaret.cpp b/layout/base/nsCaret.cpp
index 2f08d156e6..8ad4359501 100644
--- a/layout/base/nsCaret.cpp
+++ b/layout/base/nsCaret.cpp
@@ -200,8 +200,8 @@ nsCaret::ComputeMetrics(nsIFrame* aFrame, int32_t aOffset, nscoord aCaretHeight)
// between 0 and 1 goes up to 1 so we don't let the caret disappear.
int32_t tpp = aFrame->PresContext()->AppUnitsPerDevPixel();
Metrics result;
- result.mCaretWidth = NS_ROUND_BORDER_TO_PIXELS(caretWidth, tpp);
- result.mBidiIndicatorSize = NS_ROUND_BORDER_TO_PIXELS(bidiIndicatorSize, tpp);
+ result.mCaretWidth = NS_ROUND_CARET_TO_PIXELS(caretWidth, tpp);
+ result.mBidiIndicatorSize = NS_ROUND_CARET_TO_PIXELS(bidiIndicatorSize, tpp);
return result;
}
diff --git a/layout/base/nsChangeHint.h b/layout/base/nsChangeHint.h
index 318b848407..eb2709de65 100644
--- a/layout/base/nsChangeHint.h
+++ b/layout/base/nsChangeHint.h
@@ -217,6 +217,16 @@ enum nsChangeHint {
*/
nsChangeHint_AddOrRemoveTransform = 1 << 27,
+ /**
+ * Indicates that the overflow-x and/or overflow-y property changed.
+ *
+ * In most cases, this is equivalent to nsChangeHint_ReconstructFrame. But
+ * in some special cases where the change is really targeting the viewport's
+ * scrollframe, this is instead equivalent to nsChangeHint_AllReflowHints
+ * (because the viewport always has an associated scrollframe).
+ */
+ nsChangeHint_CSSOverflowChange = 1 << 28,
+
// IMPORTANT NOTE: When adding new hints, consider whether you need
// to add them to NS_HintsNotHandledForDescendantsIn() below. Please
// also add them to RestyleManager::ChangeHintToString and modify
@@ -225,7 +235,7 @@ enum nsChangeHint {
/**
* Dummy hint value for all hints. It exists for compile time check.
*/
- nsChangeHint_AllHints = (1 << 28) - 1,
+ nsChangeHint_AllHints = (1 << 29) - 1,
};
// Redefine these operators to return nothing. This will catch any use
@@ -306,6 +316,7 @@ inline nsChangeHint operator^=(nsChangeHint& aLeft, nsChangeHint aRight)
nsChangeHint_UpdatePostTransformOverflow | \
nsChangeHint_UpdateParentOverflow | \
nsChangeHint_ChildrenOnlyTransform | \
+ nsChangeHint_CSSOverflowChange | \
nsChangeHint_RecomputePosition | \
nsChangeHint_UpdateContainingBlock | \
nsChangeHint_AddOrRemoveTransform | \
@@ -374,6 +385,48 @@ inline nsChangeHint NS_HintsNotHandledForDescendantsIn(nsChangeHint aChangeHint)
nsChangeHint_ClearAncestorIntrinsics | \
nsChangeHint_ClearDescendantIntrinsics | \
nsChangeHint_NeedDirtyReflow)
+
+// Below are the change hints that we send for ISize & BSize changes.
+// Each is similar to nsChangeHint_AllReflowHints with a few changes.
+
+// * For an ISize change, we send nsChangeHint_AllReflowHints, with two bits
+// excluded: nsChangeHint_ClearDescendantIntrinsics (because an ancestor's
+// inline-size change can't affect descendant intrinsic sizes), and
+// nsChangeHint_NeedDirtyReflow (because ISize changes don't need to *force*
+// all descendants to reflow).
+#define nsChangeHint_ReflowHintsForISizeChange \
+ nsChangeHint(nsChangeHint_AllReflowHints & \
+ ~(nsChangeHint_ClearDescendantIntrinsics | \
+ nsChangeHint_NeedDirtyReflow))
+
+// * For a BSize change, we send almost the same hints as for ISize changes,
+// with one extra: nsChangeHint_UpdateComputedBSize. We need this hint because
+// BSize changes CAN affect descendant intrinsic sizes, due to replaced
+// elements with percentage BSizes in descendants which also have percentage
+// BSizes. nsChangeHint_UpdateComputedBSize clears intrinsic sizes for frames
+// that have such replaced elements. (We could instead send
+// nsChangeHint_ClearDescendantIntrinsics, but that's broader than we need.)
+//
+// NOTE: You might think that BSize changes could exclude
+// nsChangeHint_ClearAncestorIntrinsics (which is inline-axis specific), but we
+// do need to send it, to clear cached results from CSS Flex measuring reflows.
+#define nsChangeHint_ReflowHintsForBSizeChange \
+ nsChangeHint((nsChangeHint_AllReflowHints | \
+ nsChangeHint_UpdateComputedBSize) & \
+ ~(nsChangeHint_ClearDescendantIntrinsics | \
+ nsChangeHint_NeedDirtyReflow))
+
+// * For changes to the float area of an already-floated element, we need all
+// reflow hints, but not the ones that apply to descendants.
+// Our descendants aren't impacted when our float area only changes
+// placement but not size/shape. (e.g. if we change which side we float to).
+// But our ancestors/siblings are potentially impacted, so we need to send
+// the non-descendant reflow hints.
+#define nsChangeHint_ReflowHintsForFloatAreaChange \
+ nsChangeHint(nsChangeHint_AllReflowHints & \
+ ~(nsChangeHint_ClearDescendantIntrinsics | \
+ nsChangeHint_NeedDirtyReflow))
+
#define NS_STYLE_HINT_REFLOW \
nsChangeHint(NS_STYLE_HINT_VISUAL | nsChangeHint_AllReflowHints)
diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp
index 782ac332ce..137efb3cdb 100644
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -1617,7 +1617,6 @@ nsDocumentViewer::Destroy()
// We also keep the viewer from being cached in session history, since
// we require all documents there to be sanitized.
if (mDestroyRefCount != 0) {
- --mDestroyRefCount;
return NS_OK;
}
@@ -4426,6 +4425,12 @@ nsDocumentViewer::IncrementDestroyRefCount()
++mDestroyRefCount;
}
+void
+nsDocumentViewer::DecrementDestroyRefCount()
+{
+ --mDestroyRefCount;
+}
+
//------------------------------------------------------------
#if defined(NS_PRINTING) && defined(NS_PRINT_PREVIEW)
diff --git a/layout/base/nsIDocumentViewerPrint.h b/layout/base/nsIDocumentViewerPrint.h
index 8bc2465a15..e3c397f3a3 100644
--- a/layout/base/nsIDocumentViewerPrint.h
+++ b/layout/base/nsIDocumentViewerPrint.h
@@ -41,6 +41,7 @@ public:
virtual mozilla::StyleSetHandle CreateStyleSet(nsIDocument* aDocument) = 0;
virtual void IncrementDestroyRefCount() = 0;
+ virtual void DecrementDestroyRefCount() = 0;
virtual void ReturnToGalleyPresentation() = 0;
@@ -75,6 +76,7 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocumentViewerPrint,
bool GetIsPrintPreview() override; \
mozilla::StyleSetHandle CreateStyleSet(nsIDocument* aDocument) override; \
void IncrementDestroyRefCount() override; \
+ void DecrementDestroyRefCount() override; \
void ReturnToGalleyPresentation() override; \
void OnDonePrinting() override; \
bool IsInitializedForPrintPreview() override; \
diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h
index cbbae0e8fd..5990402ed5 100644
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -1298,11 +1298,11 @@ public:
}
};
- static void DispatchGotOrLostPointerCaptureEvent(bool aIsGotCapture,
- uint32_t aPointerId,
- uint16_t aPointerType,
- bool aIsPrimary,
- nsIContent* aCaptureTarget);
+ static void DispatchGotOrLostPointerCaptureEvent(
+ bool aIsGotCapture,
+ const mozilla::WidgetPointerEvent* aPointerEvent,
+ nsIContent* aCaptureTarget);
+
static PointerCaptureInfo* GetPointerCaptureInfo(uint32_t aPointerId);
static void SetPointerCapturingContent(uint32_t aPointerId,
nsIContent* aContent);
@@ -1311,8 +1311,8 @@ public:
// CheckPointerCaptureState checks cases, when got/lostpointercapture events
// should be fired.
- static void CheckPointerCaptureState(uint32_t aPointerId,
- uint16_t aPointerType, bool aIsPrimary);
+ static void CheckPointerCaptureState(
+ const mozilla::WidgetPointerEvent* aPointerEvent);
// GetPointerInfo returns true if pointer with aPointerId is situated in
// device, false otherwise.
diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp
index d9f7b368c7..4a54a84323 100644
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -208,6 +208,7 @@ nsPresContext::nsPresContext(nsIDocument* aDocument, nsPresContextType aType)
mTextZoom(1.0), mFullZoom(1.0), mOverrideDPPX(0.0),
mLastFontInflationScreenSize(gfxSize(-1.0, -1.0)),
mPageSize(-1, -1), mPPScale(1.0f),
+ mViewportScrollbarOverrideNode(nullptr),
mViewportStyleScrollbar(NS_STYLE_OVERFLOW_AUTO, NS_STYLE_OVERFLOW_AUTO),
mImageAnimationModePref(imgIContainer::kNormalAnimMode),
mAllInvalidated(false),
@@ -1423,10 +1424,10 @@ nsPresContext::UpdateViewportScrollbarStylesOverride()
// Start off with our default styles, and then update them as needed.
mViewportStyleScrollbar = ScrollbarStyles(NS_STYLE_OVERFLOW_AUTO,
NS_STYLE_OVERFLOW_AUTO);
- nsIContent* propagatedFrom = nullptr;
+ mViewportScrollbarOverrideNode = nullptr;
// Don't propagate the scrollbar state in printing or print preview.
if (!IsPaginated()) {
- propagatedFrom =
+ mViewportScrollbarOverrideNode =
GetPropagatedScrollbarStylesForViewport(this, &mViewportStyleScrollbar);
}
@@ -1438,13 +1439,13 @@ nsPresContext::UpdateViewportScrollbarStylesOverride()
// the styles are from, so that the state of those elements is not
// affected across fullscreen change.
if (fullscreenElement != document->GetRootElement() &&
- fullscreenElement != propagatedFrom) {
+ fullscreenElement != mViewportScrollbarOverrideNode) {
mViewportStyleScrollbar = ScrollbarStyles(NS_STYLE_OVERFLOW_HIDDEN,
NS_STYLE_OVERFLOW_HIDDEN);
}
}
- return propagatedFrom;
+ return mViewportScrollbarOverrideNode;
}
bool
diff --git a/layout/base/nsPresContext.h b/layout/base/nsPresContext.h
index 4fdc60a2ea..d8f876291c 100644
--- a/layout/base/nsPresContext.h
+++ b/layout/base/nsPresContext.h
@@ -719,7 +719,18 @@ public:
* it was propagated from.
*/
nsIContent* UpdateViewportScrollbarStylesOverride();
- const ScrollbarStyles& GetViewportScrollbarStylesOverride()
+
+ /**
+ * Returns the cached result from the last call to
+ * UpdateViewportScrollbarStylesOverride() -- i.e. return the node
+ * whose scrollbar styles we have propagated to the viewport (or nullptr if
+ * there is no such node).
+ */
+ nsIContent* GetViewportScrollbarStylesOverrideNode() const {
+ return mViewportScrollbarOverrideNode;
+ }
+
+ const ScrollbarStyles& GetViewportScrollbarStylesOverride() const
{
return mViewportStyleScrollbar;
}
@@ -1310,7 +1321,16 @@ protected:
nscolor mBodyTextColor;
+ // This is a non-owning pointer. May be null. If non-null, it's guaranteed
+ // to be pointing to a node that's still alive, because we'll reset it in
+ // UpdateViewportScrollbarStylesOverride() as part of the cleanup code
+ // when this node is removed from the document. (For <body> and the root node,
+ // this call happens in nsCSSFrameConstructor::ContentRemoved(). For
+ // fullscreen elements, it happens in the fullscreen-specific cleanup
+ // invoked by Element::UnbindFromTree().)
+ nsIContent* MOZ_NON_OWNING_REF mViewportScrollbarOverrideNode;
ScrollbarStyles mViewportStyleScrollbar;
+
uint8_t mFocusRingWidth;
bool mExistThrottledUpdates;
diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp
index 56ac370b96..42b39c8607 100644
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -6514,10 +6514,11 @@ nsIPresShell::GetPointerCapturingContent(uint32_t aPointerId)
}
/* static */ void
-nsIPresShell::CheckPointerCaptureState(uint32_t aPointerId,
- uint16_t aPointerType, bool aIsPrimary)
+nsIPresShell::CheckPointerCaptureState(const WidgetPointerEvent* aPointerEvent)
{
- PointerCaptureInfo* captureInfo = GetPointerCaptureInfo(aPointerId);
+ PointerCaptureInfo* captureInfo =
+ GetPointerCaptureInfo(aPointerEvent->pointerId);
+
if (captureInfo &&
captureInfo->mPendingContent != captureInfo->mOverrideContent) {
// cache captureInfo->mPendingContent since it may be changed in the pointer
@@ -6525,17 +6526,16 @@ nsIPresShell::CheckPointerCaptureState(uint32_t aPointerId,
nsIContent* pendingContent = captureInfo->mPendingContent.get();
if (captureInfo->mOverrideContent) {
DispatchGotOrLostPointerCaptureEvent(/* aIsGotCapture */ false,
- aPointerId, aPointerType, aIsPrimary,
+ aPointerEvent,
captureInfo->mOverrideContent);
}
if (pendingContent) {
- DispatchGotOrLostPointerCaptureEvent(/* aIsGotCapture */ true, aPointerId,
- aPointerType, aIsPrimary,
- pendingContent);
+ DispatchGotOrLostPointerCaptureEvent(/* aIsGotCapture */ true,
+ aPointerEvent, pendingContent);
}
captureInfo->mOverrideContent = pendingContent;
if (captureInfo->Empty()) {
- sPointerCaptureList->Remove(aPointerId);
+ sPointerCaptureList->Remove(aPointerEvent->pointerId);
}
}
}
@@ -6976,37 +6976,30 @@ DispatchPointerFromMouseOrTouch(PresShell* aShell,
return NS_OK;
}
-class ReleasePointerCaptureCaller
+class ReleasePointerCaptureCaller final
{
public:
- ReleasePointerCaptureCaller() :
- mPointerId(0),
- mPointerType(nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN),
- mIsPrimary(false),
- mIsSet(false)
+ ReleasePointerCaptureCaller()
+ : mPointerEvent(nullptr)
{
}
~ReleasePointerCaptureCaller()
{
- if (mIsSet) {
- nsIPresShell::ReleasePointerCapturingContent(mPointerId);
- nsIPresShell::CheckPointerCaptureState(mPointerId, mPointerType,
- mIsPrimary);
+ if (mPointerEvent) {
+ nsIPresShell::ReleasePointerCapturingContent(mPointerEvent->pointerId);
+ nsIPresShell::CheckPointerCaptureState(mPointerEvent);
}
}
- void SetTarget(uint32_t aPointerId, uint16_t aPointerType, bool aIsPrimary)
+
+ void SetTarget(const WidgetPointerEvent* aPointerEvent)
{
- mPointerId = aPointerId;
- mPointerType = aPointerType;
- mIsPrimary = aIsPrimary;
- mIsSet = true;
+ MOZ_ASSERT(aPointerEvent);
+ mPointerEvent = aPointerEvent;
}
private:
- int32_t mPointerId;
- uint16_t mPointerType;
- bool mIsPrimary;
- bool mIsSet;
+ // This is synchronously used inside PresShell::HandleEvent.
+ const WidgetPointerEvent* mPointerEvent;
};
static bool
@@ -7719,9 +7712,7 @@ PresShell::HandleEvent(nsIFrame* aFrame,
nsWeakFrame frameKeeper(frame);
// Handle pending pointer capture before any pointer events except
// gotpointercapture / lostpointercapture.
- CheckPointerCaptureState(pointerEvent->pointerId,
- pointerEvent->inputSource,
- pointerEvent->mIsPrimary);
+ CheckPointerCaptureState(pointerEvent);
// Prevent application crashes, in case damaged frame.
if (!frameKeeper.IsAlive()) {
frame = nullptr;
@@ -7742,33 +7733,29 @@ PresShell::HandleEvent(nsIFrame* aFrame,
}
}
- if (aEvent->mClass == ePointerEventClass &&
- aEvent->mMessage != ePointerDown) {
- if (WidgetPointerEvent* pointerEvent = aEvent->AsPointerEvent()) {
- uint32_t pointerId = pointerEvent->pointerId;
+ // Mouse events should be fired to the same target as their mapped pointer
+ // events
+ if ((aEvent->mClass == ePointerEventClass ||
+ aEvent->mClass == eMouseEventClass) &&
+ aEvent->mMessage != ePointerDown && aEvent->mMessage != eMouseDown) {
+ if (WidgetMouseEvent* mouseEvent = aEvent->AsMouseEvent()) {
+ uint32_t pointerId = mouseEvent->pointerId;
nsIContent* pointerCapturingContent =
GetPointerCapturingContent(pointerId);
if (pointerCapturingContent) {
if (nsIFrame* capturingFrame = pointerCapturingContent->GetPrimaryFrame()) {
- // If pointer capture is set, we should suppress
- // pointerover/pointerenter events for all elements except element
- // which have pointer capture. (Code in EventStateManager)
- pointerEvent->retargetedByPointerCapture =
- frame && frame->GetContent() &&
- !nsContentUtils::ContentIsDescendantOf(frame->GetContent(),
- pointerCapturingContent);
frame = capturingFrame;
}
- if (pointerEvent->mMessage == ePointerUp ||
- pointerEvent->mMessage == ePointerCancel) {
+ if (aEvent->mMessage == ePointerUp ||
+ aEvent->mMessage == ePointerCancel) {
// Implicitly releasing capture for given pointer.
// ePointerLostCapture should be send after ePointerUp or
// ePointerCancel.
- releasePointerCaptureCaller.SetTarget(pointerId,
- pointerEvent->inputSource,
- pointerEvent->mIsPrimary);
+ WidgetPointerEvent* pointerEvent = aEvent->AsPointerEvent();
+ MOZ_ASSERT(pointerEvent);
+ releasePointerCaptureCaller.SetTarget(pointerEvent);
}
}
}
@@ -8204,6 +8191,8 @@ PresShell::HandleEventInternal(WidgetEvent* aEvent,
}
case eMouseDown:
case eMouseUp:
+ case ePointerDown:
+ case ePointerUp:
isHandlingUserInput = true;
break;
@@ -8340,35 +8329,44 @@ PresShell::HandleEventInternal(WidgetEvent* aEvent,
return rv;
}
-void
-nsIPresShell::DispatchGotOrLostPointerCaptureEvent(bool aIsGotCapture,
- uint32_t aPointerId,
- uint16_t aPointerType,
- bool aIsPrimary,
- nsIContent* aCaptureTarget)
-{
- PointerEventInit init;
- init.mPointerId = aPointerId;
- init.mBubbles = true;
- ConvertPointerTypeToString(aPointerType, init.mPointerType);
- init.mIsPrimary = aIsPrimary;
- RefPtr<mozilla::dom::PointerEvent> event;
- event = PointerEvent::Constructor(aCaptureTarget,
- aIsGotCapture
- ? NS_LITERAL_STRING("gotpointercapture")
- : NS_LITERAL_STRING("lostpointercapture"),
- init);
- if (event) {
+/* static */ void
+nsIPresShell::DispatchGotOrLostPointerCaptureEvent(
+ bool aIsGotCapture,
+ const WidgetPointerEvent* aPointerEvent,
+ nsIContent* aCaptureTarget)
+{
+ nsIDocument* targetDoc = aCaptureTarget->OwnerDoc();
+ nsCOMPtr<nsIPresShell> shell = targetDoc->GetShell();
+ NS_ENSURE_TRUE_VOID(shell);
+
+ if (!aIsGotCapture && !aCaptureTarget->IsInUncomposedDoc()) {
+ // If the capturing element was removed from the DOM tree, fire
+ // ePointerLostCapture at the document.
+ PointerEventInit init;
+ init.mPointerId = aPointerEvent->pointerId;
+ init.mBubbles = true;
+ init.mComposed = true;
+ ConvertPointerTypeToString(aPointerEvent->inputSource, init.mPointerType);
+ init.mIsPrimary = aPointerEvent->mIsPrimary;
+ RefPtr<mozilla::dom::PointerEvent> event;
+ event = PointerEvent::Constructor(aCaptureTarget,
+ NS_LITERAL_STRING("lostpointercapture"),
+ init);
bool dummy;
- // If the capturing element was removed from the DOM tree,
- // lostpointercapture event should be fired at the document.
- if (!aIsGotCapture && !aCaptureTarget->IsInUncomposedDoc()) {
- aCaptureTarget->OwnerDoc()->DispatchEvent(event->InternalDOMEvent(),
- &dummy);
- } else {
- aCaptureTarget->DispatchEvent(event->InternalDOMEvent(), &dummy);
- }
+ targetDoc->DispatchEvent(event->InternalDOMEvent(), &dummy);
+ return;
}
+ nsEventStatus status = nsEventStatus_eIgnore;
+ WidgetPointerEvent localEvent(aPointerEvent->IsTrusted(),
+ aIsGotCapture ? ePointerGotCapture :
+ ePointerLostCapture,
+ aPointerEvent->mWidget);
+ localEvent.AssignPointerEventData(*aPointerEvent, true);
+ nsresult rv = shell->HandleEventWithTarget(
+ &localEvent,
+ aCaptureTarget->GetPrimaryFrame(),
+ aCaptureTarget, &status);
+ NS_ENSURE_SUCCESS_VOID(rv);
}
nsresult
diff --git a/layout/base/tests/bug1078327_inner.html b/layout/base/tests/bug1078327_inner.html
index 9e32fc996f..0cfb9da7f8 100644
--- a/layout/base/tests/bug1078327_inner.html
+++ b/layout/base/tests/bug1078327_inner.html
@@ -24,16 +24,16 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1078327
var test_mediator_move = false;
var test_mediator_out = false;
var test_listener = false;
+ var test_lost_capture = false;
function TargetHandler(event) {
logger("Target receive event: " + event.type + ". Mediator.setPointerCapture()");
mediator.setPointerCapture(event.pointerId);
test_target = true;
+ test_capture = true;
}
function MediatorHandler(event) {
logger("Mediator receive event: " + event.type);
- if(event.type == "gotpointercapture")
- test_capture = true;
if(!test_capture)
return;
if(event.type == "pointermove")
@@ -43,7 +43,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1078327
if(event.type == "pointerout")
test_mediator_out++;
if(event.type == "lostpointercapture")
- test_capture = false;
+ test_lost_capture = true;
}
function ListenerHandler(event) {
logger("Listener receive event: " + event.type);
@@ -86,7 +86,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1078327
}
function finishTest() {
parent.is(test_target, true, "pointerdown event should be received by target");
- parent.is(test_capture, false, "test_capture should be false at the end of the test");
+ parent.is(test_lost_capture, true, "mediator should receive lostpointercapture");
parent.is(test_mediator_over, 1, "mediator should receive pointerover event only once");
parent.is(test_mediator_move, 5, "mediator should receive pointermove event five times");
parent.is(test_mediator_out, 1, "mediator should receive pointerout event only once");
diff --git a/layout/base/tests/bug1162990_inner_1.html b/layout/base/tests/bug1162990_inner_1.html
index 4ea5edb5c8..0f950df8d4 100644
--- a/layout/base/tests/bug1162990_inner_1.html
+++ b/layout/base/tests/bug1162990_inner_1.html
@@ -111,10 +111,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1162990
}
function finishTest() {
- parent.is(test_basketLeave, 0, "Part1: basket should not receive pointerleave event after pointer capturing");
+ parent.is(test_basketLeave, 1, "Part1: basket should receive pointerleave event after pointer capturing");
parent.is(test_targetGotCapture, 1, "Part1: target should receive gotpointercapture event");
parent.is(test_targetLostCapture, 1, "Part1: target should receive lostpointercapture event");
- parent.is(test_targetLeave, 2, "Part1: target should receive pointerleave event two times");
+ parent.is(test_targetLeave, 1, "Part1: target should receive pointerleave event only one time");
parent.is(test_childLeave, 0, "Part1: child should not receive pointerleave event after pointer capturing");
parent.is(test_listenerDown, 1, "Part1: listener should receive pointerdown event");
parent.is(test_listenerLeave, 1, "Part1: listener should receive pointerleave event only one time");
diff --git a/layout/base/tests/bug1162990_inner_2.html b/layout/base/tests/bug1162990_inner_2.html
index 54aa74ca3a..e418927bd6 100644
--- a/layout/base/tests/bug1162990_inner_2.html
+++ b/layout/base/tests/bug1162990_inner_2.html
@@ -116,7 +116,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1162990
parent.is(test_targetDown, 1, "Part2: target should receive pointerdown event");
parent.is(test_targetGotCapture, 1, "Part2: target should receive gotpointercapture event");
parent.is(test_targetLostCapture, 1, "Part2: target should receive lostpointercapture event");
- parent.is(test_targetLeave, 1, "Part2: target should receive pointerleave event");
+ parent.is(test_targetLeave, 0, "Part2: target should not receive pointerleave event");
parent.is(test_childLeave, 0, "Part2: child should not receive pointerleave event after pointer capturing");
parent.is(test_listenerLeave, 0, "Part2: listener should not receive pointerleave event after pointer capturing");
logger("finishTest");
diff --git a/layout/base/tests/bug976963_inner.html b/layout/base/tests/bug976963_inner.html
deleted file mode 100644
index 2c55fbccd4..0000000000
--- a/layout/base/tests/bug976963_inner.html
+++ /dev/null
@@ -1,241 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=976963
--->
-<head>
- <meta charset="utf-8">
- <title>Test for Bug 976963</title>
- <meta name="author" content="Maksim Lebedev" />
- <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
- <style>
- div#listener {
- background: yellow;
- position: absolute;
- top: -100px;
- }
- div#middler {
- background: yellow;
- margin: 10px;
- }
- div#target {
- background: yellow;
- }
- </style>
- <script type="application/javascript">
- /** Test for Bug 976963 **/
- var All_Pointer_Events = ["pointerover", "pointerenter",
- "pointermove",
- "pointerdown", "pointerup",
- "pointerout", "pointerleave",
- "pointercancel",
- "gotpointercapture", "lostpointercapture"];
-
- function on_event(object, event, callback) {
- object.addEventListener(event, callback, false);
- }
- function ok(check, msg) {
- parent.ok(check, msg);
- }
- function is(a, b, msg) {
- parent.is(a, b, msg);
- }
-
- var listener = undefined;
- var middler = undefined;
- var target = undefined;
-
- var test_ListenerGotCapture = 0;
- var test_ListenerUnwanted = 0;
- var test_ListenerLostCapture = 0;
- var test_ListenerAfterCapture = 0;
- var test_MiddlerGotCapture = 0;
- var test_MiddlerOver = 0;
- var test_MiddlerLeave = 0;
- var test_MiddlerUp = 0;
- var test_MiddlerLostCapture = 0;
- var test_TargetDown = 0;
- var test_TargetUnwanted = 0;
- var test_TargetUp = 0;
-
- var captured_event = undefined;
- var f_gotPointerCapture = false;
- var f_lostPointerCapture = false;
- var f_gotMiddlerPointerCapture = false;
-
- function listenerEventHandler(event) {
- logger("Listener: " + event.type + ". Captured_event: " + captured_event);
- if(test_ListenerLostCapture)
- test_ListenerAfterCapture++;
- if (event.type == "gotpointercapture") {
- f_gotPointerCapture = true;
- test_ListenerGotCapture++;
- }
- else if (event.type == "lostpointercapture") {
- f_lostPointerCapture = true;
- f_gotPointerCapture = false;
- test_ListenerLostCapture++;
- }
- else if (event.type == "pointermove") {
- ok(captured_event && captured_event.pointerId == event.pointerId, "Listener: equals pointerId for lostpointercapture event");
- if (f_gotPointerCapture) {
- // on first event received for capture, release capture
- logger("Listener call release");
- ok(!!listener, "Listener should be live!");
- ok(typeof(listener.releasePointerCapture) == "function", "Listener should have a function releasePointerCapture");
- listener.releasePointerCapture(event.pointerId);
- }
- else {
- logger("Listener.ASSERT: " + event.type);
- test_ListenerUnwanted++;
- // if any other events are received after releaseCapture, then the test fails
- ok(false, event.target.id + "-" + event.type + " should be handled by target element handler");
- }
- }
- else {
- test_ListenerUnwanted++;
- logger("Listener.ASSERT: " + event.type);
- ok(false, event.type + "should be never handled by listener");
- }
- }
-
- function middlerEventHandler(event) {
- logger("Middler: " + event.type + ". Captured_event: " + captured_event);
- if (event.type == "gotpointercapture") {
- test_MiddlerGotCapture++;
- f_gotMiddlerPointerCapture = true;
- ok(captured_event && captured_event.pointerId == event.pointerId, "Middler: equals pointerId for gotpointercapture event");
- }
- else if (event.type == "pointerover") {
- test_MiddlerOver++;
- ok(captured_event && captured_event.pointerId == event.pointerId, "Middler: equals pointerId for pointerover event");
- }
- else if (event.type == "pointerleave") {
- test_MiddlerLeave++;
- ok(captured_event && captured_event.pointerId == event.pointerId, "Middler: equals pointerId for pointerleave event");
- ok(!!listener, "Listener should be live!");
- ok(typeof(listener.setPointerCapture) == "function", "Listener should have a function setPointerCapture");
- listener.setPointerCapture(event.pointerId);
- }
- else if (event.type == "lostpointercapture") {
- test_MiddlerLostCapture++;
- f_gotMiddlerPointerCapture = false;
- ok(captured_event && captured_event.pointerId == event.pointerId, "Middler: equals pointerId for lostpointercapture event");
- }
- else if (event.type == "pointerup" ) {
- test_MiddlerUp++;
- }
- }
-
- function targetEventHandler(event) {
- logger("Target: " + event.type + ". Captured_event: " + captured_event);
- if (f_gotPointerCapture || f_gotMiddlerPointerCapture) {
- if (event.type != "pointerout" && event.type != "pointerleave") {
- logger("Target.ASSERT: " + event.type + " " + event.pointerId);
- test_TargetUnwanted++;
- ok(false, "The Target element should not have received any events while capture is active. Event recieved:" + event.type + ". ");
- }
- }
- if (event.type == "pointerdown") {
- logger("Target.pointerdown 1: " + captured_event);
- test_TargetDown++;
- captured_event = event;
- ok(!!middler, "Middler should be live!");
- ok(typeof(middler.setPointerCapture) == "function", "Middler should have a function setPointerCapture");
- middler.setPointerCapture(event.pointerId);
- logger("Target.pointerdown 2: " + captured_event);
- }
- else if (event.type == "pointerup") {
- ok(f_lostPointerCapture, "Target should have received pointerup");
- ok(captured_event && captured_event.pointerId == event.pointerId, "Target: equals pointerId for lostpointercapture event");
- test_TargetUp++; // complete test
- }
- }
-
- function colorerHandler(event) {
- if(event.type == "pointerover")
- event.target.style.background = "red";
- else if(event.type == "pointerout")
- event.target.style.background = "yellow";
- }
-
- function setEventHandlers() {
- listener = document.getElementById("listener");
- middler = document.getElementById("middler");
- target = document.getElementById("target");
- target.style["touchAction"] = "none";
-
- // target and listener - handle all events
- for (var i = 0; i < All_Pointer_Events.length; i++) {
- on_event(target, All_Pointer_Events[i], targetEventHandler);
- on_event(listener, All_Pointer_Events[i], listenerEventHandler);
- on_event(middler, All_Pointer_Events[i], middlerEventHandler);
- on_event(target, All_Pointer_Events[i], colorerHandler);
- on_event(middler, All_Pointer_Events[i], colorerHandler);
- }
- }
-
- function prepareTest() {
- SpecialPowers.pushPrefEnv({
- "set": [
- ["dom.w3c_pointer_events.enabled", true]
- ]
- }, executeTest);
- }
-
- function executeTest()
- {
- logger("executeTest");
- setEventHandlers();
- document.body.offsetLeft;
- var rect = target.getBoundingClientRect();
- synthesizePointer(target, rect.width/2, rect.height/2, {type: "pointermove"});
- synthesizePointer(target, rect.width/2, rect.height/2, {type: "pointerdown"});
- synthesizePointer(target, rect.width/3, rect.height/3, {type: "pointermove"});
- synthesizePointer(middler, rect.width/2, rect.height/2, {type: "pointermove"});
- synthesizePointer(target, rect.width/2, rect.height/2, {type: "pointermove"});
- synthesizePointer(middler, rect.width/2, rect.height/2, {type: "pointermove"});
- synthesizePointer(target, rect.width/2, rect.height/2, {type: "pointermove"});
- synthesizePointer(target, rect.width/2, rect.height/2, {type: "pointerup"});
- finishTest();
- }
-
- function finishTest() {
- setTimeout(function() {
- is(test_ListenerGotCapture, 1, "Listener should receive gotpointercapture event");
- is(test_ListenerUnwanted, 0, "Listener should not receive any unwanted events");
- is(test_ListenerLostCapture, 1, "Listener should receive lostpointercapture event");
- is(test_ListenerAfterCapture, 0, "Listener should not receive any events after release pointer capture");
- is(test_MiddlerGotCapture, 1, "Middler should receive gotpointercapture event");
- is(test_MiddlerOver, 1, "Middler should receive pointerover event");
- is(test_MiddlerLeave, 1, "Middler should receive pointerleave event");
- is(test_MiddlerUp, 0, "Middler should not receive pointerup event");
- is(test_MiddlerLostCapture, 1, "Middler should receive lostpointercapture event");
- is(test_TargetDown, 1, "Target should receive pointerdown event");
- is(test_TargetUnwanted, 0, "Target should not receive any event while pointer capture is active");
- is(test_TargetUp, 1, "Target should receive pointerup event");
- logger("finishTest");
- parent.finishTest();
- }, 1000);
- }
-
- function logger(message) {
- console.log(message);
- var log = document.getElementById('log');
- log.innerHTML = message + "<br>" + log.innerHTML;
- }
- </script>
-</head>
-<body onload="prepareTest()">
- <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=976963">Mozilla Bug 976963</a>
- <p id="display"></p>
- <div id="content" style="display: none">
- </div>
- <div id="listener">div id=listener</div>
- <div id="middler">div id=middler</div>
- <div id="target">div id=target</div>
- <pre id="log">
- </pre>
-</body>
-</html>
diff --git a/layout/base/tests/bug977003_inner_5.html b/layout/base/tests/bug977003_inner_5.html
index 70fc5ba403..81094043c5 100644
--- a/layout/base/tests/bug977003_inner_5.html
+++ b/layout/base/tests/bug977003_inner_5.html
@@ -26,6 +26,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1098139
var test_lost_listener = false;
var test_lost_type = "";
var test_move_listener = false;
+ var test_over_listener = false;
var test_listener = false;
var test_lost_primary = false;
@@ -53,6 +54,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1098139
logger("Receive event on Listener: " + event.type);
test_move_listener = true;
}
+ function ListenerOverHandler(event) {
+ logger("Receive event on Listener: " + event.type);
+ test_over_listener = true;
+ }
function ListenerHandler(event) {
logger("Receive event on Listener: " + event.type);
test_listener = true;
@@ -74,7 +79,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1098139
target.addEventListener("pointerdown", TargetDownHandler, false);
listener.addEventListener("gotpointercapture", ListenerGotPCHandler, false);
listener.addEventListener("lostpointercapture", ListenerLostPCHandler, false);
- listener.addEventListener("pointerover", ListenerHandler, false);
+ listener.addEventListener("pointerover", ListenerOverHandler, false);
listener.addEventListener("pointermove", ListenerMoveHandler, false);
listener.addEventListener("pointerup", ListenerHandler, false);
listener.addEventListener("pointerout", ListenerHandler, false);
@@ -93,6 +98,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1098139
parent.is(test_lost_type, "touch", "Part 5: lostpointercapture event should have pointerType touch");
parent.is(test_lost_primary, true, "Part 5: lostpointercapture event should have isPrimary as true");
parent.is(test_move_listener, true, "Part 5: gotpointercapture should be triggered by pointermove");
+ parent.is(test_over_listener, true, "Part 5: listener should receive pointerover when capturing pointer");
parent.is(test_listener, false, "Part 5: listener should not receive any other events");
logger("finishTest");
parent.finishTest();
diff --git a/layout/base/tests/bug977003_inner_6.html b/layout/base/tests/bug977003_inner_6.html
index 12424b1f2b..b60ca5c314 100644
--- a/layout/base/tests/bug977003_inner_6.html
+++ b/layout/base/tests/bug977003_inner_6.html
@@ -19,6 +19,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1073563
var listener = undefined;
var test_target = false;
var test_move = false;
+ var test_over = false;
var test_listener = false;
var receive_lostpointercapture = false;
@@ -44,6 +45,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1073563
}
} else if(event.type == "pointermove") {
test_move = true;
+ } else if(event.type == "pointerover") {
+ test_over = true;
} else {
test_listener = true;
}
@@ -81,7 +84,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1073563
// PE level 2 defines that the pending pointer capture is processed when firing next pointer events.
// In this test case, pointer capture release is processed when firing pointermove
parent.is(test_move, true, "Part 6: gotpointercapture should be triggered by pointermove");
- parent.is(test_listener, false, "Part 6: no other pointerevents should be fired before gotpointercapture");
+ parent.is(test_over, true, "Part 6: pointerover should be received when capturing pointer");
+ parent.is(test_listener, false, "Part 6: no other pointerevents should be fired before gotpointercapture except pointerover");
logger("finishTest");
parent.finishTest();
}
diff --git a/layout/base/tests/mochitest.ini b/layout/base/tests/mochitest.ini
index 279b0af8aa..405697977c 100644
--- a/layout/base/tests/mochitest.ini
+++ b/layout/base/tests/mochitest.ini
@@ -256,8 +256,6 @@ skip-if = toolkit == 'android'
support-files = bug851445_helper.html
[test_bug970964.html]
support-files = bug970964_inner.html
-[test_bug976963.html]
-support-files = bug976963_inner.html
[test_bug977003.html]
support-files =
bug977003_inner_1.html
diff --git a/layout/base/tests/test_bug976963.html b/layout/base/tests/test_bug976963.html
deleted file mode 100644
index 4b8da3a6e8..0000000000
--- a/layout/base/tests/test_bug976963.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=976963
--->
- <head>
- <meta charset="utf-8">
- <meta name="author" content="Maksim Lebedev" />
- <title>Test for Bug 976963</title>
- <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
- <script type="text/javascript">
- function prepareTest() {
- SimpleTest.waitForExplicitFinish();
- SimpleTest.requestFlakyTimeout("untriaged");
- SpecialPowers.pushPrefEnv({
- "set": [
- ["dom.w3c_pointer_events.enabled", true],
- ["layout.reflow.synthMouseMove", false]
- ]
- }, startTest);
- }
- function startTest() {
- var iframe = document.getElementById("testFrame");
- iframe.src = "bug976963_inner.html";
- }
- function finishTest() {
- SimpleTest.finish();
- }
- </script>
- </head>
- <body onload="prepareTest()">
- <iframe id="testFrame" height="700" width="700"></iframe>
- </body>
-</html>
diff --git a/layout/forms/nsDateTimeControlFrame.cpp b/layout/forms/nsDateTimeControlFrame.cpp
index df2e43986b..fa22dcebac 100644
--- a/layout/forms/nsDateTimeControlFrame.cpp
+++ b/layout/forms/nsDateTimeControlFrame.cpp
@@ -372,7 +372,8 @@ nsDateTimeControlFrame::AttributeChanged(int32_t aNameSpaceID,
auto contentAsInputElem = static_cast<dom::HTMLInputElement*>(mContent);
// If script changed the <input>'s type before setting these attributes
// then we don't need to do anything since we are going to be reframed.
- if (contentAsInputElem->GetType() == NS_FORM_INPUT_TIME) {
+ if (contentAsInputElem->GetType() == NS_FORM_INPUT_TIME ||
+ contentAsInputElem->GetType() == NS_FORM_INPUT_DATE) {
if (aAttribute == nsGkAtoms::value) {
nsCOMPtr<nsIDateTimeInputArea> inputAreaContent =
do_QueryInterface(mInputAreaContent);
diff --git a/layout/generic/Selection.h b/layout/generic/Selection.h
index 6f94303ca2..3d5e334fc0 100644
--- a/layout/generic/Selection.h
+++ b/layout/generic/Selection.h
@@ -179,6 +179,9 @@ public:
{
return mRanges.Length();
}
+
+ void GetType(nsAString& aOutType) const;
+
nsRange* GetRangeAt(uint32_t aIndex, mozilla::ErrorResult& aRv);
void AddRange(nsRange& aRange, mozilla::ErrorResult& aRv);
void RemoveRange(nsRange& aRange, mozilla::ErrorResult& aRv);
diff --git a/layout/generic/nsFlexContainerFrame.cpp b/layout/generic/nsFlexContainerFrame.cpp
index b610243247..3818d3cb77 100644
--- a/layout/generic/nsFlexContainerFrame.cpp
+++ b/layout/generic/nsFlexContainerFrame.cpp
@@ -33,6 +33,8 @@ typedef nsFlexContainerFrame::FlexItem FlexItem;
typedef nsFlexContainerFrame::FlexLine FlexLine;
typedef nsFlexContainerFrame::FlexboxAxisTracker FlexboxAxisTracker;
typedef nsFlexContainerFrame::StrutInfo StrutInfo;
+typedef nsFlexContainerFrame::CachedMeasuringReflowResult
+ CachedMeasuringReflowResult;
static mozilla::LazyLogModule gFlexContainerLog("nsFlexContainerFrame");
@@ -1756,6 +1758,108 @@ nsFlexContainerFrame::
}
}
+/**
+ * A cached result for a measuring reflow.
+ *
+ * Right now we only need to cache the available size and the computed height
+ * for checking that the reflow input is valid, and the height and the ascent
+ * to be used. This can be extended later if needed.
+ *
+ * The assumption here is that a given flex item measurement won't change until
+ * either the available size or computed height changes, or the flex container
+ * intrinsic size is marked as dirty (due to a style or DOM change).
+ *
+ * In particular the computed height may change between measuring reflows due to
+ * how the mIsFlexContainerMeasuringReflow flag affects size computation (see
+ * bug 1336708).
+ *
+ * Caching it prevents us from doing exponential reflows in cases of deeply
+ * nested flex and scroll frames.
+ *
+ * We store them in the frame property table for simplicity.
+ */
+class nsFlexContainerFrame::CachedMeasuringReflowResult
+{
+ // Members that are part of the cache key:
+ const LogicalSize mAvailableSize;
+ const nscoord mComputedHeight;
+
+ // Members that are part of the cache value:
+ const nscoord mHeight;
+ const nscoord mAscent;
+
+public:
+ CachedMeasuringReflowResult(const ReflowInput& aReflowInput,
+ const ReflowOutput& aDesiredSize)
+ : mAvailableSize(aReflowInput.AvailableSize())
+ , mComputedHeight(aReflowInput.ComputedHeight())
+ , mHeight(aDesiredSize.Height())
+ , mAscent(aDesiredSize.BlockStartAscent())
+ {}
+
+ bool IsValidFor(const ReflowInput& aReflowInput) const {
+ return mAvailableSize == aReflowInput.AvailableSize() &&
+ mComputedHeight == aReflowInput.ComputedHeight();
+ }
+
+ nscoord Height() const { return mHeight; }
+
+ nscoord Ascent() const { return mAscent; }
+};
+
+NS_DECLARE_FRAME_PROPERTY_DELETABLE(CachedFlexMeasuringReflow,
+ CachedMeasuringReflowResult);
+
+const CachedMeasuringReflowResult&
+nsFlexContainerFrame::MeasureAscentAndHeightForFlexItem(
+ FlexItem& aItem,
+ nsPresContext* aPresContext,
+ ReflowInput& aChildReflowInput)
+{
+ const FrameProperties props = aItem.Frame()->Properties();
+ if (const auto* cachedResult = props.Get(CachedFlexMeasuringReflow())) {
+ if (cachedResult->IsValidFor(aChildReflowInput)) {
+ return *cachedResult;
+ }
+ }
+
+ ReflowOutput childDesiredSize(aChildReflowInput);
+ nsReflowStatus childReflowStatus;
+
+ const uint32_t flags = NS_FRAME_NO_MOVE_FRAME;
+ ReflowChild(aItem.Frame(), aPresContext,
+ childDesiredSize, aChildReflowInput,
+ 0, 0, flags, childReflowStatus);
+ aItem.SetHadMeasuringReflow();
+
+ // XXXdholbert Once we do pagination / splitting, we'll need to actually
+ // handle incomplete childReflowStatuses. But for now, we give our kids
+ // unconstrained available height, which means they should always complete.
+ MOZ_ASSERT(NS_FRAME_IS_COMPLETE(childReflowStatus),
+ "We gave flex item unconstrained available height, so it "
+ "should be complete");
+
+ // Tell the child we're done with its initial reflow.
+ // (Necessary for e.g. GetBaseline() to work below w/out asserting)
+ FinishReflowChild(aItem.Frame(), aPresContext,
+ childDesiredSize, &aChildReflowInput, 0, 0, flags);
+
+ auto result =
+ new CachedMeasuringReflowResult(aChildReflowInput, childDesiredSize);
+
+ props.Set(CachedFlexMeasuringReflow(), result);
+ return *result;
+}
+
+/* virtual */ void
+nsFlexContainerFrame::MarkIntrinsicISizesDirty()
+{
+ for (nsIFrame* childFrame : mFrames) {
+ childFrame->Properties().Delete(CachedFlexMeasuringReflow());
+ }
+ nsContainerFrame::MarkIntrinsicISizesDirty();
+}
+
nscoord
nsFlexContainerFrame::
MeasureFlexItemContentHeight(nsPresContext* aPresContext,
@@ -1783,27 +1887,15 @@ nsFlexContainerFrame::
childRIForMeasuringHeight.SetVResize(true);
}
- ReflowOutput childDesiredSize(childRIForMeasuringHeight);
- nsReflowStatus childReflowStatus;
- const uint32_t flags = NS_FRAME_NO_MOVE_FRAME;
- ReflowChild(aFlexItem.Frame(), aPresContext,
- childDesiredSize, childRIForMeasuringHeight,
- 0, 0, flags, childReflowStatus);
-
- MOZ_ASSERT(NS_FRAME_IS_COMPLETE(childReflowStatus),
- "We gave flex item unconstrained available height, so it "
- "should be complete");
-
- FinishReflowChild(aFlexItem.Frame(), aPresContext,
- childDesiredSize, &childRIForMeasuringHeight,
- 0, 0, flags);
+ const CachedMeasuringReflowResult& reflowResult =
+ MeasureAscentAndHeightForFlexItem(aFlexItem, aPresContext,
+ childRIForMeasuringHeight);
- aFlexItem.SetHadMeasuringReflow();
- aFlexItem.SetAscent(childDesiredSize.BlockStartAscent());
+ aFlexItem.SetAscent(reflowResult.Ascent());
// Subtract border/padding in vertical axis, to get _just_
// the effective computed value of the "height" property.
- nscoord childDesiredHeight = childDesiredSize.Height() -
+ nscoord childDesiredHeight = reflowResult.Height() -
childRIForMeasuringHeight.ComputedPhysicalBorderPadding().TopBottom();
return std::max(0, childDesiredHeight);
@@ -3959,25 +4051,10 @@ nsFlexContainerFrame::SizeItemInCrossAxis(
// whether any of its ancestors are being resized).
aChildReflowInput.SetVResize(true);
}
- ReflowOutput childDesiredSize(aChildReflowInput);
- nsReflowStatus childReflowStatus;
- const uint32_t flags = NS_FRAME_NO_MOVE_FRAME;
- ReflowChild(aItem.Frame(), aPresContext,
- childDesiredSize, aChildReflowInput,
- 0, 0, flags, childReflowStatus);
- aItem.SetHadMeasuringReflow();
-
- // XXXdholbert Once we do pagination / splitting, we'll need to actually
- // handle incomplete childReflowStatuses. But for now, we give our kids
- // unconstrained available height, which means they should always complete.
- MOZ_ASSERT(NS_FRAME_IS_COMPLETE(childReflowStatus),
- "We gave flex item unconstrained available height, so it "
- "should be complete");
- // Tell the child we're done with its initial reflow.
- // (Necessary for e.g. GetBaseline() to work below w/out asserting)
- FinishReflowChild(aItem.Frame(), aPresContext,
- childDesiredSize, &aChildReflowInput, 0, 0, flags);
+ // Potentially reflow the item, and get the sizing info.
+ const CachedMeasuringReflowResult& reflowResult =
+ MeasureAscentAndHeightForFlexItem(aItem, aPresContext, aChildReflowInput);
// Save the sizing info that we learned from this reflow
// -----------------------------------------------------
@@ -3989,7 +4066,7 @@ nsFlexContainerFrame::SizeItemInCrossAxis(
// so we don't bother with making aAxisTracker pick the cross-axis component
// for us.)
nscoord crossAxisBorderPadding = aItem.GetBorderPadding().TopBottom();
- if (childDesiredSize.Height() < crossAxisBorderPadding) {
+ if (reflowResult.Height() < crossAxisBorderPadding) {
// Child's requested size isn't large enough for its border/padding!
// This is OK for the trivial nsFrame::Reflow() impl, but other frame
// classes should know better. So, if we get here, the child had better be
@@ -4002,10 +4079,10 @@ nsFlexContainerFrame::SizeItemInCrossAxis(
aItem.SetCrossSize(0);
} else {
// (normal case)
- aItem.SetCrossSize(childDesiredSize.Height() - crossAxisBorderPadding);
+ aItem.SetCrossSize(reflowResult.Height() - crossAxisBorderPadding);
}
- aItem.SetAscent(childDesiredSize.BlockStartAscent());
+ aItem.SetAscent(reflowResult.Ascent());
}
void
@@ -4295,7 +4372,7 @@ nsFlexContainerFrame::DoFlexLayout(nsPresContext* aPresContext,
LogicalSize availSize = aReflowInput.ComputedSize(wm);
availSize.BSize(wm) = NS_UNCONSTRAINEDSIZE;
ReflowInput childReflowInput(aPresContext, aReflowInput,
- item->Frame(), availSize);
+ item->Frame(), availSize);
if (!sizeOverride) {
// Directly override the computed main-size, by tweaking reflow state:
if (aAxisTracker.IsMainAxisHorizontal()) {
diff --git a/layout/generic/nsFlexContainerFrame.h b/layout/generic/nsFlexContainerFrame.h
index 22b420d85b..459ae8e20f 100644
--- a/layout/generic/nsFlexContainerFrame.h
+++ b/layout/generic/nsFlexContainerFrame.h
@@ -56,6 +56,7 @@ public:
class FlexLine;
class FlexboxAxisTracker;
struct StrutInfo;
+ class CachedMeasuringReflowResult;
// nsIFrame overrides
void Init(nsIContent* aContent,
@@ -66,6 +67,8 @@ public:
const nsRect& aDirtyRect,
const nsDisplayListSet& aLists) override;
+ void MarkIntrinsicISizesDirty() override;
+
virtual void Reflow(nsPresContext* aPresContext,
ReflowOutput& aDesiredSize,
const ReflowInput& aReflowInput,
@@ -195,6 +198,18 @@ protected:
const FlexboxAxisTracker& aAxisTracker);
/**
+ * This method gets a cached measuring reflow for a flex item, or does it and
+ * caches it.
+ *
+ * This avoids exponential reflows, see the comment on
+ * CachedMeasuringReflowResult.
+ */
+ const CachedMeasuringReflowResult& MeasureAscentAndHeightForFlexItem(
+ FlexItem& aItem,
+ nsPresContext* aPresContext,
+ ReflowInput& aChildReflowInput);
+
+ /**
* This method performs a "measuring" reflow to get the content height of
* aFlexItem.Frame() (treating it as if it had auto-height), & returns the
* resulting height.
diff --git a/layout/generic/nsSelection.cpp b/layout/generic/nsSelection.cpp
index e0d65632eb..a2227c39c3 100644
--- a/layout/generic/nsSelection.cpp
+++ b/layout/generic/nsSelection.cpp
@@ -5349,6 +5349,18 @@ Selection::GetRangeCount(int32_t* aRangeCount)
return NS_OK;
}
+void
+Selection::GetType(nsAString& aOutType) const
+{
+ if (!RangeCount()) {
+ aOutType.AssignLiteral("None");
+ } else if (IsCollapsed()) {
+ aOutType.AssignLiteral("Caret");
+ } else {
+ aOutType.AssignLiteral("Range");
+ }
+}
+
NS_IMETHODIMP
Selection::GetRangeAt(int32_t aIndex, nsIDOMRange** aReturn)
{
diff --git a/layout/generic/nsTextFrame.cpp b/layout/generic/nsTextFrame.cpp
index b9848bcf18..00c0016fd1 100644
--- a/layout/generic/nsTextFrame.cpp
+++ b/layout/generic/nsTextFrame.cpp
@@ -9751,9 +9751,13 @@ nsTextFrame::GetRenderedText(uint32_t aStartOffset,
startOffset = aStartOffset;
endOffset = std::min<uint32_t>(INT32_MAX, aEndOffset);
}
+
+ // If startOffset and/or endOffset are inside of trimmedOffsets' range,
+ // then clamp the edges of trimmedOffsets accordingly.
+ int32_t origTrimmedOffsetsEnd = trimmedOffsets.GetEnd();
trimmedOffsets.mStart = std::max<uint32_t>(trimmedOffsets.mStart,
startOffset);
- trimmedOffsets.mLength = std::min<uint32_t>(trimmedOffsets.GetEnd(),
+ trimmedOffsets.mLength = std::min<uint32_t>(origTrimmedOffsetsEnd,
endOffset) - trimmedOffsets.mStart;
if (trimmedOffsets.mLength <= 0) {
offsetInRenderedString = nextOffsetInRenderedString;
diff --git a/layout/printing/nsPagePrintTimer.cpp b/layout/printing/nsPagePrintTimer.cpp
index b56569a9a9..164b0469a0 100644
--- a/layout/printing/nsPagePrintTimer.cpp
+++ b/layout/printing/nsPagePrintTimer.cpp
@@ -14,14 +14,8 @@ NS_IMPL_ISUPPORTS_INHERITED(nsPagePrintTimer, mozilla::Runnable, nsITimerCallbac
nsPagePrintTimer::~nsPagePrintTimer()
{
- // "Destroy" the document viewer; this normally doesn't actually
- // destroy it because of the IncrementDestroyRefCount call below
- // XXX This is messy; the document viewer should use a single approach
- // to keep itself alive during printing
- nsCOMPtr<nsIContentViewer> cv(do_QueryInterface(mDocViewerPrint));
- if (cv) {
- cv->Destroy();
- }
+ // This matches the IncrementDestroyRefCount call in the constructor.
+ mDocViewerPrint->DecrementDestroyRefCount();
}
nsresult
diff --git a/layout/reftests/forms/input/datetime/reftest.list b/layout/reftests/forms/input/datetime/reftest.list
index 0ce2002bd3..a62d56c7c8 100644
--- a/layout/reftests/forms/input/datetime/reftest.list
+++ b/layout/reftests/forms/input/datetime/reftest.list
@@ -11,3 +11,14 @@ skip-if(!Android&&!B2G&&!Mulet) == time-simple-unthemed.html time-simple-untheme
# type change
skip-if(Android||B2G||Mulet) == to-time-from-other-type-unthemed.html time-simple-unthemed.html
skip-if(Android||B2G||Mulet) == from-time-to-other-type-unthemed.html from-time-to-other-type-unthemed-ref.html
+
+# content should not overflow on small width/height
+skip-if(Android) == time-small-width.html time-small-width-ref.html
+skip-if(Android) == time-small-height.html time-small-height-ref.html
+skip-if(Android) == time-small-width-height.html time-small-width-height-ref.html
+
+# content (text) should be left aligned
+skip-if(Android) == time-content-left-aligned.html time-content-left-aligned-ref.html
+
+# reset button should be right aligned
+skip-if(Android) fails-if(styloVsGecko) == time-reset-button-right-aligned.html time-reset-button-right-aligned-ref.html # bug 1372062
diff --git a/layout/reftests/forms/input/datetime/time-content-left-aligned-ref.html b/layout/reftests/forms/input/datetime/time-content-left-aligned-ref.html
new file mode 100644
index 0000000000..ad8be9adc1
--- /dev/null
+++ b/layout/reftests/forms/input/datetime/time-content-left-aligned-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <input type="time" style="width: 200px;">
+ <!-- div to cover the right area -->
+ <div style="display:block; position:absolute; background-color:black;
+ top:0px; left:40px; width:200px; height:100px;"></div>
+ </body>
+</html>
diff --git a/layout/reftests/forms/input/datetime/time-content-left-aligned.html b/layout/reftests/forms/input/datetime/time-content-left-aligned.html
new file mode 100644
index 0000000000..aa910cddf9
--- /dev/null
+++ b/layout/reftests/forms/input/datetime/time-content-left-aligned.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <input type="time" style="width: 50px;">
+ <!-- div to cover the right area -->
+ <div style="display:block; position:absolute; background-color:black;
+ top:0px; left:40px; width:200px; height:100px;"></div>
+ </body>
+</html>
diff --git a/layout/reftests/forms/input/datetime/time-reset-button-right-aligned-ref.html b/layout/reftests/forms/input/datetime/time-reset-button-right-aligned-ref.html
new file mode 100644
index 0000000000..3d36f20680
--- /dev/null
+++ b/layout/reftests/forms/input/datetime/time-reset-button-right-aligned-ref.html
@@ -0,0 +1,9 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <input type="time" value="10:00" style="float: right; color: white;">
+ <!-- div to cover the left area -->
+ <div style="display:block; position:absolute; background-color:black;
+ top:0px; right:30px; width:500px; height:100px;"></div>
+ </body>
+</html>
diff --git a/layout/reftests/forms/input/datetime/time-reset-button-right-aligned.html b/layout/reftests/forms/input/datetime/time-reset-button-right-aligned.html
new file mode 100644
index 0000000000..72d5cc140e
--- /dev/null
+++ b/layout/reftests/forms/input/datetime/time-reset-button-right-aligned.html
@@ -0,0 +1,10 @@
+<!DOCTYPE html>
+<html>
+ <body>
+ <input type="time" value="10:00" style="width: 150px; float: right;
+ color: white;">
+ <!-- div to cover the left area -->
+ <div style="display:block; position:absolute; background-color:black;
+ top:0px; right:30px; width:500px; height:100px;"></div>
+ </body>
+</html>
diff --git a/layout/reftests/forms/input/datetime/time-small-height-ref.html b/layout/reftests/forms/input/datetime/time-small-height-ref.html
new file mode 100644
index 0000000000..fcda93df9a
--- /dev/null
+++ b/layout/reftests/forms/input/datetime/time-small-height-ref.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <style>
+input {
+ width: 200px;
+ height: 5px;
+ outline: 1px dotted black;
+ /* Disable baseline alignment, so that our y-position isn't influenced by the
+ * choice of font inside of input: */
+ vertical-align: top;
+}
+ </style>
+ </head>
+ <body>
+ <input>
+ </body>
+</html>
diff --git a/layout/reftests/forms/input/datetime/time-small-height.html b/layout/reftests/forms/input/datetime/time-small-height.html
new file mode 100644
index 0000000000..3044822fe8
--- /dev/null
+++ b/layout/reftests/forms/input/datetime/time-small-height.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <style>
+input {
+ width: 200px;
+ height: 5px;
+ outline: 1px dotted black;
+ color: white;
+ /* Disable baseline alignment, so that our y-position isn't influenced by the
+ * choice of font inside of input: */
+ vertical-align: top;
+}
+ </style>
+ </head>
+ <body>
+ <input type="time">
+ </body>
+</html>
diff --git a/layout/reftests/forms/input/datetime/time-small-width-height-ref.html b/layout/reftests/forms/input/datetime/time-small-width-height-ref.html
new file mode 100644
index 0000000000..0979243db0
--- /dev/null
+++ b/layout/reftests/forms/input/datetime/time-small-width-height-ref.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <style>
+input {
+ width: 8px;
+ height: 8px;
+ outline: 1px dotted black;
+ /* Disable baseline alignment, so that our y-position isn't influenced by the
+ * choice of font inside of input: */
+ vertical-align: top;
+}
+ </style>
+ </head>
+ <body>
+ <input>
+ </body>
+</html>
diff --git a/layout/reftests/forms/input/datetime/time-small-width-height.html b/layout/reftests/forms/input/datetime/time-small-width-height.html
new file mode 100644
index 0000000000..a221b28195
--- /dev/null
+++ b/layout/reftests/forms/input/datetime/time-small-width-height.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <style>
+input {
+ width: 8px;
+ height: 8px;
+ outline: 1px dotted black;
+ color: white;
+ /* Disable baseline alignment, so that our y-position isn't influenced by the
+ * choice of font inside of input: */
+ vertical-align: top;
+}
+ </style>
+ </head>
+ <body>
+ <input type="time">
+ </body>
+</html>
diff --git a/layout/reftests/forms/input/datetime/time-small-width-ref.html b/layout/reftests/forms/input/datetime/time-small-width-ref.html
new file mode 100644
index 0000000000..2379c70809
--- /dev/null
+++ b/layout/reftests/forms/input/datetime/time-small-width-ref.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <style>
+input {
+ width: 10px;
+ height: 1.5em;
+ outline: 1px dotted black;
+ background: white;
+ /* Disable baseline alignment, so that our y-position isn't influenced by the
+ * choice of font inside of input: */
+ vertical-align: top;
+}
+ </style>
+ </head>
+ <body>
+ <input>
+ </body>
+</html>
diff --git a/layout/reftests/forms/input/datetime/time-small-width.html b/layout/reftests/forms/input/datetime/time-small-width.html
new file mode 100644
index 0000000000..f76f7fdfa9
--- /dev/null
+++ b/layout/reftests/forms/input/datetime/time-small-width.html
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <style>
+input {
+ width: 10px;
+ height: 1.5em;
+ outline: 1px dotted black;
+ color: white;
+ background: white;
+ /* Disable baseline alignment, so that our y-position isn't influenced by the
+ * choice of font inside of input: */
+ vertical-align: top;
+}
+ </style>
+ </head>
+ <body>
+ <input type="time">
+ </body>
+</html>
diff --git a/layout/reftests/scrolling/propagated-overflow-style-1-ref.html b/layout/reftests/scrolling/propagated-overflow-style-1-ref.html
new file mode 100644
index 0000000000..7c2b1b3150
--- /dev/null
+++ b/layout/reftests/scrolling/propagated-overflow-style-1-ref.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>
+ Reference case with body and html *independently* scrollable.
+ </title>
+ <style>
+ html {
+ overflow: scroll;
+ }
+ body {
+ overflow: scroll;
+ }
+ </style>
+</head>
+<body>
+</body>
+</html>
diff --git a/layout/reftests/scrolling/propagated-overflow-style-1a.html b/layout/reftests/scrolling/propagated-overflow-style-1a.html
new file mode 100644
index 0000000000..b5115d36fe
--- /dev/null
+++ b/layout/reftests/scrolling/propagated-overflow-style-1a.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<head>
+ <title>
+ Testcase with body and html *independently* scrollable,
+ with body's "overflow" set dynamically.
+ </title>
+ <style>
+ html {
+ overflow: scroll;
+ }
+ </style>
+ <script>
+ function doTest() {
+ document.body.style.overflow = "scroll";
+ document.documentElement.removeAttribute("class");
+ }
+ window.addEventListener("MozReftestInvalidate", doTest);
+ </script>
+</head>
+<body>
+</body>
+</html>
diff --git a/layout/reftests/scrolling/propagated-overflow-style-1b.html b/layout/reftests/scrolling/propagated-overflow-style-1b.html
new file mode 100644
index 0000000000..4608b87d62
--- /dev/null
+++ b/layout/reftests/scrolling/propagated-overflow-style-1b.html
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<head>
+ <title>
+ Testcase with body and html *independently* scrollable,
+ with html's "overflow" set dynamically.
+ </title>
+ <style>
+ body {
+ overflow: scroll;
+ }
+ </style>
+ <script>
+ function doTest() {
+ document.documentElement.style.overflow = "scroll";
+ document.documentElement.removeAttribute("class");
+ }
+ window.addEventListener("MozReftestInvalidate", doTest);
+ </script>
+</head>
+<body>
+</body>
+</html>
diff --git a/layout/reftests/scrolling/propagated-overflow-style-1c.html b/layout/reftests/scrolling/propagated-overflow-style-1c.html
new file mode 100644
index 0000000000..11809915a0
--- /dev/null
+++ b/layout/reftests/scrolling/propagated-overflow-style-1c.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<head>
+ <title>
+ Testcase with body and html *independently* scrollable,
+ with both html & body's "overflow" set dynamically.
+ </title>
+ <script>
+ function doTest() {
+ document.documentElement.style.overflow = "scroll";
+ document.body.style.overflow = "scroll";
+ document.documentElement.removeAttribute("class");
+ }
+ window.addEventListener("MozReftestInvalidate", doTest);
+ </script>
+</head>
+<body>
+</body>
+</html>
diff --git a/layout/reftests/scrolling/propagated-overflow-style-2-ref.html b/layout/reftests/scrolling/propagated-overflow-style-2-ref.html
new file mode 100644
index 0000000000..20c3b8ae5b
--- /dev/null
+++ b/layout/reftests/scrolling/propagated-overflow-style-2-ref.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>
+ Reference case with the root viewport scrollable, via styles on html node.
+ </title>
+ <style>
+ html {
+ overflow: scroll;
+ }
+ </style>
+</head>
+<body>
+</body>
+</html>
diff --git a/layout/reftests/scrolling/propagated-overflow-style-2a.html b/layout/reftests/scrolling/propagated-overflow-style-2a.html
new file mode 100644
index 0000000000..250bedd6c6
--- /dev/null
+++ b/layout/reftests/scrolling/propagated-overflow-style-2a.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<head>
+ <title>
+ Testcase with only one of [html,body] being scrollable,
+ after body's "overflow" is reset dynamically.
+ </title>
+ <style>
+ html {
+ overflow: scroll;
+ }
+ body {
+ overflow: scroll;
+ }
+ </style>
+ <script>
+ function doTest() {
+ document.body.style.overflow = "visible";
+ document.documentElement.removeAttribute("class");
+ }
+ window.addEventListener("MozReftestInvalidate", doTest);
+ </script>
+</head>
+<body>
+</body>
+</html>
diff --git a/layout/reftests/scrolling/propagated-overflow-style-2b.html b/layout/reftests/scrolling/propagated-overflow-style-2b.html
new file mode 100644
index 0000000000..c94ddedb26
--- /dev/null
+++ b/layout/reftests/scrolling/propagated-overflow-style-2b.html
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<head>
+ <title>
+ Testcase with only one of [html,body] being scrollable,
+ after html's "overflow" is reset dynamically.
+ </title>
+ <style>
+ html {
+ overflow: scroll;
+ }
+ body {
+ overflow: scroll;
+ }
+ </style>
+ <script>
+ function doTest() {
+ document.documentElement.style.overflow = "visible";
+ document.documentElement.removeAttribute("class");
+ }
+ window.addEventListener("MozReftestInvalidate", doTest);
+ </script>
+</head>
+<body>
+</body>
+</html>
diff --git a/layout/reftests/scrolling/propagated-overflow-style-2c.html b/layout/reftests/scrolling/propagated-overflow-style-2c.html
new file mode 100644
index 0000000000..0ceb1f21ab
--- /dev/null
+++ b/layout/reftests/scrolling/propagated-overflow-style-2c.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<head>
+ <title>
+ Testcase with only one of [html,body] being scrollable,
+ with their "overflow" styles being dynamically swapped.
+ </title>
+ <style>
+ html {
+ overflow: scroll;
+ }
+ </style>
+ <script>
+ function doTest() {
+ document.documentElement.style.overflow = "visible";
+ document.body.style.overflow = "scroll";
+ document.documentElement.removeAttribute("class");
+ }
+ window.addEventListener("MozReftestInvalidate", doTest);
+ </script>
+</head>
+<body>
+</body>
+</html>
diff --git a/layout/reftests/scrolling/propagated-overflow-style-2d.html b/layout/reftests/scrolling/propagated-overflow-style-2d.html
new file mode 100644
index 0000000000..3353a33744
--- /dev/null
+++ b/layout/reftests/scrolling/propagated-overflow-style-2d.html
@@ -0,0 +1,24 @@
+<!DOCTYPE html>
+<html class="reftest-wait">
+<head>
+ <title>
+ Testcase with only one of [html,body] being scrollable,
+ with their "overflow" styles being dynamically swapped.
+ </title>
+ <style>
+ body {
+ overflow: scroll;
+ }
+ </style>
+ <script>
+ function doTest() {
+ document.documentElement.style.overflow = "scroll";
+ document.body.style.overflow = "visible";
+ document.documentElement.removeAttribute("class");
+ }
+ window.addEventListener("MozReftestInvalidate", doTest);
+ </script>
+</head>
+<body>
+</body>
+</html>
diff --git a/layout/reftests/scrolling/propagated-overflow-style-2e.html b/layout/reftests/scrolling/propagated-overflow-style-2e.html
new file mode 100644
index 0000000000..f9105185b1
--- /dev/null
+++ b/layout/reftests/scrolling/propagated-overflow-style-2e.html
@@ -0,0 +1,15 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>
+ Testcase with the root viewport scrollable, via styles on body node.
+ </title>
+ <style>
+ body {
+ overflow: scroll;
+ }
+ </style>
+</head>
+<body>
+</body>
+</html>
diff --git a/layout/reftests/scrolling/reftest.list b/layout/reftests/scrolling/reftest.list
index db1b81db6f..43997ced7d 100644
--- a/layout/reftests/scrolling/reftest.list
+++ b/layout/reftests/scrolling/reftest.list
@@ -85,3 +85,13 @@ fuzzy-if(asyncPan&&!layersGPUAccelerated,102,2420) == frame-scrolling-attr-2.htm
== fractional-scroll-area.html?top=0.4&outerBottom=99.6&innerBottom=200.4&scrollBefore=999 fractional-scroll-area.html?top=0&outerBottom=100&innerBottom=200&scrollBefore=999
== fractional-scroll-area.html?top=0.4&outerBottom=100.4&innerBottom=200.4&scrollBefore=999 fractional-scroll-area.html?top=0&outerBottom=100&innerBottom=200&scrollBefore=999
!= fractional-scroll-area-invalidation.html about:blank
+
+# Tests for "overflow" styles that may be propagated to the viewport:
+== propagated-overflow-style-1a.html propagated-overflow-style-1-ref.html
+== propagated-overflow-style-1b.html propagated-overflow-style-1-ref.html
+== propagated-overflow-style-1c.html propagated-overflow-style-1-ref.html
+== propagated-overflow-style-2a.html propagated-overflow-style-2-ref.html
+== propagated-overflow-style-2b.html propagated-overflow-style-2-ref.html
+== propagated-overflow-style-2c.html propagated-overflow-style-2-ref.html
+== propagated-overflow-style-2d.html propagated-overflow-style-2-ref.html
+== propagated-overflow-style-2e.html propagated-overflow-style-2-ref.html
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-align-items-center-nested-001-ref.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-align-items-center-nested-001-ref.html
new file mode 100644
index 0000000000..2473417b82
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-align-items-center-nested-001-ref.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<title>CSS Test Reference</title>
+<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
+<style>
+html, body { margin: 0; padding: 0; }
+
+.content {
+ margin-top: 100px;
+ width: 200px;
+ height: 200px;
+ background: blue;
+}
+</style>
+<body>
+ <div class="content"></div>
+</body>
diff --git a/layout/reftests/w3c-css/submitted/flexbox/flexbox-align-items-center-nested-001.html b/layout/reftests/w3c-css/submitted/flexbox/flexbox-align-items-center-nested-001.html
new file mode 100644
index 0000000000..b6e2fdff0a
--- /dev/null
+++ b/layout/reftests/w3c-css/submitted/flexbox/flexbox-align-items-center-nested-001.html
@@ -0,0 +1,47 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSS Test: Flexbox nested containers with align-items: center and flexible items</title>
+<link rel="match" href="flexbox-align-items-center-nested-001-ref.html">
+<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
+<link rel="help" href="https://www.w3.org/TR/css-flexbox-1/#align-items-property">
+<style>
+html, body { margin: 0; padding: 0; }
+body {
+ height: 400px;
+ position: relative;
+}
+
+.container-0 {
+ display: flex;
+ position: absolute;
+ height: 100%;
+ flex-direction: column;
+}
+
+.container-1 {
+ flex: 1 0 auto;
+ display: flex;
+ align-items: center;
+}
+
+.container-2 {
+ height: 100%;
+ display: flex;
+ align-items: center;
+}
+
+.content {
+ width: 200px;
+ height: 200px;
+ background: blue;
+}
+</style>
+<body>
+ <div class="container-0">
+ <div class="container-1">
+ <div class="container-2">
+ <div class="content"></div>
+ </div>
+ </div>
+ </div>
+</body>
diff --git a/layout/reftests/w3c-css/submitted/flexbox/reftest.list b/layout/reftests/w3c-css/submitted/flexbox/reftest.list
index a623a0b599..fd8bfccc90 100644
--- a/layout/reftests/w3c-css/submitted/flexbox/reftest.list
+++ b/layout/reftests/w3c-css/submitted/flexbox/reftest.list
@@ -39,6 +39,8 @@ fuzzy-if(Android,158,32) == flexbox-align-self-vert-rtl-001.xhtml flexbox-align
== flexbox-align-self-vert-rtl-003.xhtml flexbox-align-self-vert-rtl-003-ref.xhtml
== flexbox-align-self-vert-rtl-004.xhtml flexbox-align-self-vert-rtl-004-ref.xhtml
+== flexbox-align-items-center-nested-001.html flexbox-align-items-center-nested-001-ref.html
+
# Tests for computing the baseline of a flex container
== flexbox-baseline-align-self-baseline-horiz-001.html flexbox-baseline-align-self-baseline-horiz-001-ref.html
== flexbox-baseline-align-self-baseline-vert-001.html flexbox-baseline-align-self-baseline-vert-001-ref.html
diff --git a/layout/reftests/xul/css-flex-1-ref.html b/layout/reftests/xul/css-flex-1-ref.html
new file mode 100644
index 0000000000..a47eb8e9cf
--- /dev/null
+++ b/layout/reftests/xul/css-flex-1-ref.html
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <style>
+ body { margin: 0 }
+ div.ref {
+ border: 1px solid black;
+ box-sizing: border-box;
+ background: green;
+ height: 50px;
+ width: 100px;
+ }
+ </style>
+</head>
+<body>
+ <div class="ref"></div>
+</body>
+</html>
diff --git a/layout/reftests/xul/css-flex-1.xul b/layout/reftests/xul/css-flex-1.xul
new file mode 100644
index 0000000000..7955373dd4
--- /dev/null
+++ b/layout/reftests/xul/css-flex-1.xul
@@ -0,0 +1,153 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
+<head>
+<link rel="icon" href="/mozilla-central/static/hgicon.png" type="image/png" />
+<meta name="robots" content="index, nofollow"/>
+<link rel="stylesheet" href="/mozilla-central/static/style-gitweb.css" type="text/css" />
+
+<style type="text/css">
+div.feed {
+ float: right;
+}
+a img {
+ border-width: 0px;
+}
+div.log_link {
+ width: 80px;
+ background-color: white;
+}
+
+div.log_body {
+ padding-left: 96px;
+}
+</style>
+<script type="text/javascript" src="/mozilla-central/static/mercurial.js"></script>
+
+<link rel="stylesheet" href="/mozilla-central/highlightcss" type="text/css" />
+<title>mozilla-central: layout/reftests/xul/css-flex-1.xul@67bbef772796</title>
+<link rel="alternate" type="application/atom+xml"
+ href="/mozilla-central/atom-log" title="Atom feed for mozilla-central"/>
+<link rel="alternate" type="application/rss+xml"
+ href="/mozilla-central/rss-log" title="RSS feed for mozilla-central"/>
+</head>
+<body>
+
+<div class="page_header">
+<div class="logo"> <a href="https://developer.mozilla.org/en/docs/Mercurial"> <img src="/mozilla-central/static/moz-logo-bw-rgb.svg" alt="mercurial" /> </a> </div>
+<a href="/">Mercurial</a> &gt; <a href="/mozilla-central">mozilla-central</a> / file revision / layout/reftests/xul/css-flex-1.xul@67bbef772796
+</div>
+
+<div class="page_nav">
+<div>
+<a href="/mozilla-central/summary">summary</a> |
+<a href="/mozilla-central/shortlog">shortlog</a> |
+<a href="/mozilla-central/log">changelog</a> |
+<a href="/mozilla-central/pushloghtml">pushlog</a> |
+<a href="/mozilla-central/graph">graph</a> |
+<a href="/mozilla-central/tags">tags</a> |
+<a href="/mozilla-central/bookmarks">bookmarks</a> |
+<a href="/mozilla-central/branches">branches</a> |
+<a href="/mozilla-central/file/67bbef772796/layout/reftests/xul/">files</a> |
+<a href="/mozilla-central/rev/67bbef772796">changeset</a> |
+file |
+<a href="/mozilla-central/file/tip/layout/reftests/xul/css-flex-1.xul">latest</a> |
+<a href="/mozilla-central/log/67bbef772796/layout/reftests/xul/css-flex-1.xul">revisions</a> |
+<a href="/mozilla-central/annotate/67bbef772796/layout/reftests/xul/css-flex-1.xul">annotate</a> |
+<a href="/mozilla-central/diff/67bbef772796/layout/reftests/xul/css-flex-1.xul">diff</a> |
+<a href="/mozilla-central/comparison/67bbef772796/layout/reftests/xul/css-flex-1.xul">comparison</a> |
+<a href="/mozilla-central/raw-file/67bbef772796/layout/reftests/xul/css-flex-1.xul">raw</a> |
+<a href="/mozilla-central/help">help</a>
+</div>
+
+<div class="search">
+<form id="searchform" action="/mozilla-central/log">
+
+<input name="rev" type="text" value="" size="40" />
+<div id="hint">Find changesets by keywords (author, files, the commit message), revision
+number or hash, or <a href="/mozilla-central/help/revsets">revset expression</a>.</div>
+</form>
+</div>
+</div>
+
+<div class="title">layout/reftests/xul/css-flex-1.xul</div>
+
+<div class="title_text">
+<table cellspacing="0">
+<tr>
+ <td>author</td>
+ <td>&#68;&#97;&#110;&#105;&#101;&#108;&#32;&#72;&#111;&#108;&#98;&#101;&#114;&#116;&#32;&#60;&#100;&#104;&#111;&#108;&#98;&#101;&#114;&#116;&#64;&#99;&#115;&#46;&#115;&#116;&#97;&#110;&#102;&#111;&#114;&#100;&#46;&#101;&#100;&#117;&#62;</td>
+</tr>
+<tr>
+ <td></td>
+ <td class="date age">Wed, 08 Feb 2017 23:08:43 -0800</td>
+</tr>
+
+<tr>
+ <td>changeset 341731</td>
+ <td style="font-family:monospace"><a class="list" href="/mozilla-central/rev/67bbef772796">67bbef772796</a></td>
+</tr>
+
+
+<tr>
+ <td>permissions</td>
+ <td style="font-family:monospace">-rw-r--r--</td>
+</tr>
+</table>
+</div>
+
+<div class="page_path description"><a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1338053">Bug 1338053</a>: Make nsFlexContainerFrame::MarkIntrinsicISizesDirty() also call its parent class's method. r=emilio
+
+MozReview-Commit-ID: 72oIlunLcVq</div>
+
+<div class="page_body">
+<pre class="sourcelines stripes"
+ data-logurl="/mozilla-central/log/67bbef772796/layout/reftests/xul/css-flex-1.xul"
+ data-selectabletag="SPAN"
+ data-ishead="1">
+
+<a href="#l1"></a><span id="l1">&lt;?xml version=&quot;1.0&quot;?&gt;</span>
+<a href="#l2"></a><span id="l2">&lt;window xmlns=&quot;http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul&quot;</span>
+<a href="#l3"></a><span id="l3"> class=&quot;reftest-wait&quot;</span>
+<a href="#l4"></a><span id="l4"> onload=&quot;tweak()&quot;&gt;</span>
+<a href="#l5"></a><span id="l5"> &lt;style xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;</span>
+<a href="#l6"></a><span id="l6"> &lt;![CDATA[</span>
+<a href="#l7"></a><span id="l7"> panelview {</span>
+<a href="#l8"></a><span id="l8"> border: 1px solid black;</span>
+<a href="#l9"></a><span id="l9"> background: green;</span>
+<a href="#l10"></a><span id="l10"> display: flex;</span>
+<a href="#l11"></a><span id="l11"> height: 50px;</span>
+<a href="#l12"></a><span id="l12"> }</span>
+<a href="#l13"></a><span id="l13"> ]]&gt;</span>
+<a href="#l14"></a><span id="l14"> &lt;/style&gt;</span>
+<a href="#l15"></a><span id="l15"> &lt;script&gt;</span>
+<a href="#l16"></a><span id="l16"> &lt;![CDATA[</span>
+<a href="#l17"></a><span id="l17"> function tweak() {</span>
+<a href="#l18"></a><span id="l18"> var tweakMe = document.getElementById(&quot;tweakMe&quot;);</span>
+<a href="#l19"></a><span id="l19"> tweakMe.style.width = &quot;100px&quot;;</span>
+<a href="#l20"></a><span id="l20"> document.documentElement.className = &quot;&quot;;</span>
+<a href="#l21"></a><span id="l21"> }</span>
+<a href="#l22"></a><span id="l22"> ]]&gt;</span>
+<a href="#l23"></a><span id="l23"> &lt;/script&gt;</span>
+<a href="#l24"></a><span id="l24"> &lt;hbox&gt;</span>
+<a href="#l25"></a><span id="l25"> &lt;panelview id=&quot;tweakMe&quot;&gt;&lt;/panelview&gt;</span>
+<a href="#l26"></a><span id="l26"> &lt;/hbox&gt;</span>
+<a href="#l27"></a><span id="l27">&lt;/window&gt;</span>
+</pre>
+</div>
+
+<script type="text/javascript" src="/mozilla-central/static/followlines.js"></script>
+
+<div class="page_footer">
+<div class="page_footer_text">mozilla-central</div>
+<div class="page_footer_text" style="padding-left: 10px">Deployed from <a href="https://hg.mozilla.org/hgcustom/version-control-tools/rev/bd13917afa61">bd13917afa61</a> at 2018-04-20T21:06:08Z.</div>
+<div class="rss_logo">
+<a href="/mozilla-central/rss-log">RSS</a>
+<a href="/mozilla-central/atom-log">Atom</a>
+</div>
+<br />
+
+</div>
+</body>
+</html>
+
diff --git a/layout/reftests/xul/reftest.list b/layout/reftests/xul/reftest.list
index da09b7c81f..35b9f90257 100644
--- a/layout/reftests/xul/reftest.list
+++ b/layout/reftests/xul/reftest.list
@@ -1,3 +1,5 @@
+== css-flex-1.xul css-flex-1-ref.html
+
== menuitem-key.xul menuitem-key-ref.xul
# these random-if(Android) are due to differences between Android Native & Xul, see bug 732569
random-if(Android) == menulist-shrinkwrap-1.xul menulist-shrinkwrap-1-ref.xul
diff --git a/layout/style/FontFaceSet.cpp b/layout/style/FontFaceSet.cpp
index 59626fba4c..550a7d71a3 100644
--- a/layout/style/FontFaceSet.cpp
+++ b/layout/style/FontFaceSet.cpp
@@ -343,17 +343,7 @@ FontFaceSet::Load(JSContext* aCx,
}
}
- nsIGlobalObject* globalObject = GetParentObject();
- if (!globalObject) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- JS::Rooted<JSObject*> jsGlobal(aCx, globalObject->GetGlobalJSObject());
- GlobalObject global(aCx, jsGlobal);
-
- RefPtr<Promise> result = Promise::All(global, promises, aRv);
- return result.forget();
+ return Promise::All(aCx, promises, aRv);
}
bool
diff --git a/layout/style/nsLayoutStylesheetCache.cpp b/layout/style/nsLayoutStylesheetCache.cpp
index f8aea5541f..e8c6d09d7e 100644
--- a/layout/style/nsLayoutStylesheetCache.cpp
+++ b/layout/style/nsLayoutStylesheetCache.cpp
@@ -23,19 +23,6 @@
#include "nsPrintfCString.h"
#include "nsXULAppAPI.h"
-// Includes for the crash report annotation in ErrorLoadingSheet.
-#ifdef MOZ_CRASHREPORTER
-#include "mozilla/Omnijar.h"
-#include "nsDirectoryService.h"
-#include "nsDirectoryServiceDefs.h"
-#include "nsExceptionHandler.h"
-#include "nsIChromeRegistry.h"
-#include "nsISimpleEnumerator.h"
-#include "nsISubstitutingProtocolHandler.h"
-#include "zlib.h"
-#include "nsZipArchive.h"
-#endif
-
using namespace mozilla;
using namespace mozilla::css;
@@ -463,280 +450,6 @@ nsLayoutStylesheetCache::LoadSheetFile(nsIFile* aFile,
LoadSheet(uri, aSheet, aParsingMode, aFailureAction);
}
-#ifdef MOZ_CRASHREPORTER
-static inline nsresult
-ComputeCRC32(nsIFile* aFile, uint32_t* aResult)
-{
- PRFileDesc* fd;
- nsresult rv = aFile->OpenNSPRFileDesc(PR_RDONLY, 0, &fd);
- NS_ENSURE_SUCCESS(rv, rv);
-
- uint32_t crc = crc32(0, nullptr, 0);
-
- unsigned char buf[512];
- int32_t n;
- while ((n = PR_Read(fd, buf, sizeof(buf))) > 0) {
- crc = crc32(crc, buf, n);
- }
- PR_Close(fd);
-
- if (n < 0) {
- return NS_ERROR_FAILURE;
- }
-
- *aResult = crc;
- return NS_OK;
-}
-
-static void
-ListInterestingFiles(nsString& aAnnotation, nsIFile* aFile,
- const nsTArray<nsString>& aInterestingFilenames)
-{
- nsString filename;
- aFile->GetLeafName(filename);
- for (const nsString& interestingFilename : aInterestingFilenames) {
- if (interestingFilename == filename) {
- nsString path;
- aFile->GetPath(path);
- aAnnotation.AppendLiteral(" ");
- aAnnotation.Append(path);
- aAnnotation.AppendLiteral(" (");
- int64_t size;
- if (NS_SUCCEEDED(aFile->GetFileSize(&size))) {
- aAnnotation.AppendPrintf("%ld", size);
- } else {
- aAnnotation.AppendLiteral("???");
- }
- aAnnotation.AppendLiteral(" bytes, crc32 = ");
- uint32_t crc;
- nsresult rv = ComputeCRC32(aFile, &crc);
- if (NS_SUCCEEDED(rv)) {
- aAnnotation.AppendPrintf("0x%08x)\n", crc);
- } else {
- aAnnotation.AppendPrintf("error 0x%08x)\n", uint32_t(rv));
- }
- return;
- }
- }
-
- bool isDir = false;
- aFile->IsDirectory(&isDir);
-
- if (!isDir) {
- return;
- }
-
- nsCOMPtr<nsISimpleEnumerator> entries;
- if (NS_FAILED(aFile->GetDirectoryEntries(getter_AddRefs(entries)))) {
- aAnnotation.AppendLiteral(" (failed to enumerated directory)\n");
- return;
- }
-
- for (;;) {
- bool hasMore = false;
- if (NS_FAILED(entries->HasMoreElements(&hasMore))) {
- aAnnotation.AppendLiteral(" (failed during directory enumeration)\n");
- return;
- }
- if (!hasMore) {
- break;
- }
-
- nsCOMPtr<nsISupports> entry;
- if (NS_FAILED(entries->GetNext(getter_AddRefs(entry)))) {
- aAnnotation.AppendLiteral(" (failed during directory enumeration)\n");
- return;
- }
-
- nsCOMPtr<nsIFile> file = do_QueryInterface(entry);
- if (file) {
- ListInterestingFiles(aAnnotation, file, aInterestingFilenames);
- }
- }
-}
-
-// Generate a crash report annotation to help debug issues with style
-// sheets failing to load (bug 1194856).
-static void
-AnnotateCrashReport(nsIURI* aURI)
-{
- nsAutoCString spec;
- nsAutoCString scheme;
- nsDependentCSubstring filename;
- if (aURI) {
- spec = aURI->GetSpecOrDefault();
- aURI->GetScheme(scheme);
- int32_t i = spec.RFindChar('/');
- if (i != -1) {
- filename.Rebind(spec, i + 1);
- }
- }
-
- nsString annotation;
-
- // The URL of the sheet that failed to load.
- annotation.AppendLiteral("Error loading sheet: ");
- annotation.Append(NS_ConvertUTF8toUTF16(spec).get());
- annotation.Append('\n');
-
- annotation.AppendLiteral("NS_ERROR_FILE_CORRUPTION reason: ");
- if (nsZipArchive::sFileCorruptedReason) {
- annotation.Append(NS_ConvertUTF8toUTF16(nsZipArchive::sFileCorruptedReason).get());
- annotation.Append('\n');
- } else {
- annotation.AppendLiteral("(none)\n");
- }
-
- // The jar: or file: URL that the sheet's resource: or chrome: URL
- // resolves to.
- if (scheme.EqualsLiteral("resource")) {
- annotation.AppendLiteral("Real location: ");
- nsCOMPtr<nsISubstitutingProtocolHandler> handler;
- nsCOMPtr<nsIIOService> io(do_GetIOService());
- if (io) {
- nsCOMPtr<nsIProtocolHandler> ph;
- io->GetProtocolHandler(scheme.get(), getter_AddRefs(ph));
- if (ph) {
- handler = do_QueryInterface(ph);
- }
- }
- if (!handler) {
- annotation.AppendLiteral("(ResolveURI failed)\n");
- } else {
- nsAutoCString resolvedSpec;
- handler->ResolveURI(aURI, resolvedSpec);
- annotation.Append(NS_ConvertUTF8toUTF16(resolvedSpec));
- annotation.Append('\n');
- }
- } else if (scheme.EqualsLiteral("chrome")) {
- annotation.AppendLiteral("Real location: ");
- nsCOMPtr<nsIChromeRegistry> reg =
- mozilla::services::GetChromeRegistryService();
- if (!reg) {
- annotation.AppendLiteral("(no chrome registry)\n");
- } else {
- nsCOMPtr<nsIURI> resolvedURI;
- reg->ConvertChromeURL(aURI, getter_AddRefs(resolvedURI));
- if (!resolvedURI) {
- annotation.AppendLiteral("(ConvertChromeURL failed)\n");
- } else {
- annotation.Append(
- NS_ConvertUTF8toUTF16(resolvedURI->GetSpecOrDefault()));
- annotation.Append('\n');
- }
- }
- }
-
- nsTArray<nsString> interestingFiles;
- interestingFiles.AppendElement(NS_LITERAL_STRING("chrome.manifest"));
- interestingFiles.AppendElement(NS_LITERAL_STRING("omni.ja"));
- interestingFiles.AppendElement(NS_ConvertUTF8toUTF16(filename));
-
- annotation.AppendLiteral("GRE directory: ");
- nsCOMPtr<nsIFile> file;
- nsDirectoryService::gService->Get(NS_GRE_DIR, NS_GET_IID(nsIFile),
- getter_AddRefs(file));
- if (file) {
- // The Firefox installation directory.
- nsString path;
- file->GetPath(path);
- annotation.Append(path);
- annotation.Append('\n');
-
- // List interesting files -- any chrome.manifest or omni.ja file or any file
- // whose name is the sheet's filename -- under the Firefox installation
- // directory.
- annotation.AppendLiteral("Interesting files in the GRE directory:\n");
- ListInterestingFiles(annotation, file, interestingFiles);
-
- // If the Firefox installation directory has a chrome.manifest file, let's
- // see what's in it.
- file->Append(NS_LITERAL_STRING("chrome.manifest"));
- bool exists = false;
- file->Exists(&exists);
- if (exists) {
- annotation.AppendLiteral("Contents of chrome.manifest:\n[[[\n");
- PRFileDesc* fd;
- if (NS_SUCCEEDED(file->OpenNSPRFileDesc(PR_RDONLY, 0, &fd))) {
- nsCString contents;
- char buf[512];
- int32_t n;
- while ((n = PR_Read(fd, buf, sizeof(buf))) > 0) {
- contents.Append(buf, n);
- }
- if (n < 0) {
- annotation.AppendLiteral(" (error while reading)\n");
- } else {
- annotation.Append(NS_ConvertUTF8toUTF16(contents));
- }
- PR_Close(fd);
- }
- annotation.AppendLiteral("]]]\n");
- }
- } else {
- annotation.AppendLiteral("(none)\n");
- }
-
- // The jar: or file: URL prefix that chrome: and resource: URLs get translated
- // to.
- annotation.AppendLiteral("GRE omnijar URI string: ");
- nsCString uri;
- nsresult rv = Omnijar::GetURIString(Omnijar::GRE, uri);
- if (NS_FAILED(rv)) {
- annotation.AppendLiteral("(failed)\n");
- } else {
- annotation.Append(NS_ConvertUTF8toUTF16(uri));
- annotation.Append('\n');
- }
-
- RefPtr<nsZipArchive> zip = Omnijar::GetReader(Omnijar::GRE);
- if (zip) {
- // List interesting files in the GRE omnijar.
- annotation.AppendLiteral("Interesting files in the GRE omnijar:\n");
- nsZipFind* find;
- rv = zip->FindInit(nullptr, &find);
- if (NS_FAILED(rv)) {
- annotation.AppendPrintf(" (FindInit failed with 0x%08x)\n", rv);
- } else if (!find) {
- annotation.AppendLiteral(" (FindInit returned null)\n");
- } else {
- const char* result;
- uint16_t len;
- while (NS_SUCCEEDED(find->FindNext(&result, &len))) {
- nsCString itemPathname;
- nsString itemFilename;
- itemPathname.Append(result, len);
- int32_t i = itemPathname.RFindChar('/');
- if (i != -1) {
- itemFilename = NS_ConvertUTF8toUTF16(Substring(itemPathname, i + 1));
- }
- for (const nsString& interestingFile : interestingFiles) {
- if (interestingFile == itemFilename) {
- annotation.AppendLiteral(" ");
- annotation.Append(NS_ConvertUTF8toUTF16(itemPathname));
- nsZipItem* item = zip->GetItem(itemPathname.get());
- if (!item) {
- annotation.AppendLiteral(" (GetItem failed)\n");
- } else {
- annotation.AppendPrintf(" (%d bytes, crc32 = 0x%08x)\n",
- item->RealSize(),
- item->CRC32());
- }
- break;
- }
- }
- }
- delete find;
- }
- } else {
- annotation.AppendLiteral("No GRE omnijar\n");
- }
-
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("SheetLoadFailure"),
- NS_ConvertUTF16toUTF8(annotation));
-}
-#endif
-
static void
ErrorLoadingSheet(nsIURI* aURI, const char* aMsg, FailureAction aFailureAction)
{
@@ -751,9 +464,6 @@ ErrorLoadingSheet(nsIURI* aURI, const char* aMsg, FailureAction aFailureAction)
}
}
-#ifdef MOZ_CRASHREPORTER
- AnnotateCrashReport(aURI);
-#endif
NS_RUNTIMEABORT(errorMessage.get());
}
@@ -780,9 +490,6 @@ nsLayoutStylesheetCache::LoadSheet(nsIURI* aURI,
}
}
-#ifdef MOZ_CRASHREPORTER
- nsZipArchive::sFileCorruptedReason = nullptr;
-#endif
nsresult rv = loader->LoadSheetSync(aURI, aParsingMode, true, aSheet);
if (NS_FAILED(rv)) {
ErrorLoadingSheet(aURI,
diff --git a/layout/style/nsStyleStruct.cpp b/layout/style/nsStyleStruct.cpp
index 2f12d62018..553239e0ed 100644
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -1629,23 +1629,11 @@ nsStylePosition::CalcDifference(const nsStylePosition& aNewData,
if (aOldStyleVisibility) {
bool isVertical = WritingMode(aOldStyleVisibility).IsVertical();
if (isVertical ? widthChanged : heightChanged) {
- // Block-size changes can affect descendant intrinsic sizes due to
- // replaced elements with percentage bsizes in descendants which
- // also have percentage bsizes. This is handled via
- // nsChangeHint_UpdateComputedBSize which clears intrinsic sizes
- // for frames that have such replaced elements.
- hint |= nsChangeHint_NeedReflow |
- nsChangeHint_UpdateComputedBSize |
- nsChangeHint_ReflowChangesSizeOrPosition;
+ hint |= nsChangeHint_ReflowHintsForBSizeChange;
}
if (isVertical ? heightChanged : widthChanged) {
- // None of our inline-size differences can affect descendant
- // intrinsic sizes and none of them need to force children to
- // reflow.
- hint |= nsChangeHint_AllReflowHints &
- ~(nsChangeHint_ClearDescendantIntrinsics |
- nsChangeHint_NeedDirtyReflow);
+ hint |= nsChangeHint_ReflowHintsForISizeChange;
}
} else {
if (widthChanged || heightChanged) {
@@ -3258,8 +3246,6 @@ nsStyleDisplay::CalcDifference(const nsStyleDisplay& aNewData) const
|| mDisplay != aNewData.mDisplay
|| mContain != aNewData.mContain
|| (mFloat == StyleFloat::None) != (aNewData.mFloat == StyleFloat::None)
- || mOverflowX != aNewData.mOverflowX
- || mOverflowY != aNewData.mOverflowY
|| mScrollBehavior != aNewData.mScrollBehavior
|| mScrollSnapTypeX != aNewData.mScrollSnapTypeX
|| mScrollSnapTypeY != aNewData.mScrollSnapTypeY
@@ -3271,6 +3257,11 @@ nsStyleDisplay::CalcDifference(const nsStyleDisplay& aNewData) const
hint |= nsChangeHint_ReconstructFrame;
}
+ if (mOverflowX != aNewData.mOverflowX
+ || mOverflowY != aNewData.mOverflowY) {
+ hint |= nsChangeHint_CSSOverflowChange;
+ }
+
/* Note: When mScrollBehavior, mScrollSnapTypeX, mScrollSnapTypeY,
* mScrollSnapPointsX, mScrollSnapPointsY, or mScrollSnapDestination are
* changed, nsChangeHint_NeutralChange is not sufficient to enter
diff --git a/layout/style/nsStyleStruct.h b/layout/style/nsStyleStruct.h
index ca5d030566..05a6be91e2 100644
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -1197,11 +1197,14 @@ private:
nsCSSShadowItem mArray[1]; // This MUST be the last item
};
-// Border widths are rounded to the nearest-below integer number of pixels,
-// but values between zero and one device pixels are always rounded up to
-// one device pixel.
+// Border widths are rounded to the nearest integer number of pixels, but values
+// between zero and one device pixels are always rounded up to one device pixel.
#define NS_ROUND_BORDER_TO_PIXELS(l,tpp) \
- ((l) == 0) ? 0 : std::max((tpp), (l) / (tpp) * (tpp))
+ ((l) == 0) ? 0 : std::max((tpp), ((l) + ((tpp) / 2)) / (tpp) * (tpp))
+// Caret widths are rounded to the nearest-below integer number of pixels, but values
+// between zero and one device pixels are always rounded up to one device pixel.
+#define NS_ROUND_CARET_TO_PIXELS(l,tpp) \
+ ((l) == 0) ? 0 : std::max((tpp), (l) / (tpp) * (tpp))
// Outline offset is rounded to the nearest integer number of pixels, but values
// between zero and one device pixels are always rounded up to one device pixel.
// Note that the offset can be negative.
diff --git a/layout/style/res/forms.css b/layout/style/res/forms.css
index f045540b18..e7566e183f 100644
--- a/layout/style/res/forms.css
+++ b/layout/style/res/forms.css
@@ -1135,3 +1135,8 @@ input[type="number"] > div > div > div:hover {
/* give some indication of hover state for the up/down buttons */
background-color: lightblue;
}
+
+input[type="date"],
+input[type="time"] {
+ overflow: hidden !important;
+}
diff --git a/layout/style/res/html.css b/layout/style/res/html.css
index a779461de9..bc3f082100 100644
--- a/layout/style/res/html.css
+++ b/layout/style/res/html.css
@@ -774,6 +774,11 @@ input[type="time"] > xul|datetimebox {
-moz-binding: url("chrome://global/content/bindings/datetimebox.xml#time-input");
}
+input[type="date"] > xul|datetimebox {
+ display: flex;
+ -moz-binding: url("chrome://global/content/bindings/datetimebox.xml#date-input");
+}
+
/* details & summary */
/* Need to revert Bug 1259889 Part 2 when removing details preference. */
@supports -moz-bool-pref("dom.details_element.enabled") {
diff --git a/layout/style/test/mochitest.ini b/layout/style/test/mochitest.ini
index 406c6f9015..8182691ca9 100644
--- a/layout/style/test/mochitest.ini
+++ b/layout/style/test/mochitest.ini
@@ -295,6 +295,7 @@ skip-if = toolkit == 'android'
[test_variables.html]
support-files = support/external-variable-url.css
[test_video_object_fit.html]
+[test_viewport_scrollbar_causing_reflow.html]
[test_viewport_units.html]
[test_visited_image_loading.html]
skip-if = toolkit == 'android' #TIMED_OUT
diff --git a/layout/style/test/test_dynamic_change_causing_reflow.html b/layout/style/test/test_dynamic_change_causing_reflow.html
index a941191f60..a5bb3045c1 100644
--- a/layout/style/test/test_dynamic_change_causing_reflow.html
+++ b/layout/style/test/test_dynamic_change_causing_reflow.html
@@ -95,6 +95,90 @@ const gTestcases = [
expectReflow: true,
},
+ // * Changing 'overflow' on <body> should cause reflow,
+ // but not frame reconstruction
+ {
+ elem: document.body,
+ /* beforeStyle: implicitly 'overflow:visible' */
+ afterStyle: "overflow: hidden",
+ expectConstruction: false,
+ expectReflow: true,
+ },
+ {
+ elem: document.body,
+ /* beforeStyle: implicitly 'overflow:visible' */
+ afterStyle: "overflow: scroll",
+ expectConstruction: false,
+ expectReflow: true,
+ },
+ {
+ elem: document.body,
+ beforeStyle: "overflow: hidden",
+ afterStyle: "overflow: auto",
+ expectConstruction: false,
+ expectReflow: true,
+ },
+ {
+ elem: document.body,
+ beforeStyle: "overflow: hidden",
+ afterStyle: "overflow: scroll",
+ expectConstruction: false,
+ expectReflow: true,
+ },
+ {
+ elem: document.body,
+ beforeStyle: "overflow: hidden",
+ afterStyle: "overflow: visible",
+ expectConstruction: false,
+ expectReflow: true,
+ },
+ {
+ elem: document.body,
+ beforeStyle: "overflow: auto",
+ afterStyle: "overflow: hidden",
+ expectConstruction: false,
+ expectReflow: true,
+ },
+ {
+ elem: document.body,
+ beforeStyle: "overflow: visible",
+ afterStyle: "overflow: hidden",
+ expectConstruction: false,
+ expectReflow: true,
+ },
+
+ // * Changing 'overflow' on <html> should cause reflow,
+ // but not frame reconstruction
+ {
+ elem: document.documentElement,
+ /* beforeStyle: implicitly 'overflow:visible' */
+ afterStyle: "overflow: auto",
+ expectConstruction: false,
+ expectReflow: true,
+ },
+ {
+ elem: document.documentElement,
+ beforeStyle: "overflow: visible",
+ afterStyle: "overflow: auto",
+ expectConstruction: false,
+ expectReflow: true,
+ },
+
+ // * Setting 'overflow' on arbitrary node should cause reflow as well as
+ // frame reconstruction
+ {
+ /* beforeStyle: implicitly 'overflow:visible' */
+ afterStyle: "overflow: auto",
+ expectConstruction: true,
+ expectReflow: true,
+ },
+ {
+ beforeStyle: "overflow: auto",
+ afterStyle: "overflow: visible",
+ expectConstruction: true,
+ expectReflow: true,
+ },
+
// * Changing 'display' should cause frame construction and reflow.
{
beforeStyle: "display: inline",
@@ -135,23 +219,34 @@ function runOneTest(aTestcase)
return;
}
+ // Figure out which element we'll be tweaking (defaulting to gElem)
+ let elem = aTestcase.elem ?
+ aTestcase.elem : gElem;
+
+ // Verify that 'style' attribute is unset (avoid causing ourselves trouble):
+ if (elem.hasAttribute("style")) {
+ ok(false,
+ "test element has 'style' attribute already set! We're going to stomp " +
+ "on whatever's there when we clean up...");
+ }
+
// Set the "before" style, and compose the first part of the message
// to be used in our "is"/"isnot" invocations:
let msgPrefix = "Changing style ";
if (aTestcase.beforeStyle) {
- gElem.setAttribute("style", aTestcase.beforeStyle);
+ elem.setAttribute("style", aTestcase.beforeStyle);
msgPrefix += "from '" + aTestcase.beforeStyle + "' ";
}
- msgPrefix += "to '" + aTestcase.afterStyle + "' ";
+ msgPrefix += "on " + elem.nodeName + " ";
// Establish initial counts:
- let unusedVal = gElem.offsetHeight; // flush layout
+ let unusedVal = elem.offsetHeight; // flush layout
let origFramesConstructed = gUtils.framesConstructed;
let origFramesReflowed = gUtils.framesReflowed;
// Make the change and flush:
- gElem.setAttribute("style", aTestcase.afterStyle);
- unusedVal = gElem.offsetHeight; // flush layout
+ elem.setAttribute("style", aTestcase.afterStyle);
+ unusedVal = elem.offsetHeight; // flush layout
// Make our is/isnot assertions about whether things should have changed:
checkFinalCount(gUtils.framesConstructed, origFramesConstructed,
@@ -162,7 +257,7 @@ function runOneTest(aTestcase)
"reflow");
// Clean up!
- gElem.removeAttribute("style");
+ elem.removeAttribute("style");
}
gTestcases.forEach(runOneTest);
diff --git a/layout/style/test/test_viewport_scrollbar_causing_reflow.html b/layout/style/test/test_viewport_scrollbar_causing_reflow.html
new file mode 100644
index 0000000000..dfd7ec450d
--- /dev/null
+++ b/layout/style/test/test_viewport_scrollbar_causing_reflow.html
@@ -0,0 +1,125 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1367568
+-->
+<head>
+ <meta charset="utf-8">
+ <title>Test for Bug 1367568</title>
+ <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=">Mozilla Bug 1367568</a>
+<div id="content">
+ <!-- Some fixed-width divs that we shouldn't have to reflow when the viewport
+ changes: -->
+ <div style="width: 100px">
+ fixed-width
+ <div>(child)</div>
+ </div>
+ <div style="position: absolute; width: 150px">
+ abs-fixed-width
+ <div>(child)</div>
+ </div>
+</div>
+<pre id="test">
+<script type="application/javascript">
+"use strict";
+
+/** Test for Bug 1367568 **/
+
+/**
+ * This test verifies that "overflow" changes on the <body> don't cause
+ * an unnecessarily large amount of reflow.
+ */
+
+// Vars used in setStyleAndMeasure that we really only have to look up once:
+const gUtils = SpecialPowers.getDOMWindowUtils(window);
+
+function setStyleAndMeasure(initialStyle, finalStyle) {
+ is(document.body.style.length, 0,
+ "Bug in test - body should start with empty style");
+ let unusedVal = document.body.offsetHeight; // flush layout
+ let constructCount = gUtils.framesConstructed;
+
+ document.body.style = initialStyle;
+ unusedVal = document.body.offsetHeight; // flush layout
+ let reflowCountBeforeTweak = gUtils.framesReflowed;
+
+ document.body.style = finalStyle;
+ unusedVal = document.body.offsetHeight; // flush layout
+ let reflowCountAfterTweak = gUtils.framesReflowed;
+
+ // Clean up:
+ document.body.style = "";
+
+ is(gUtils.framesConstructed, constructCount,
+ "Style tweak shouldn't have triggered frame construction");
+
+ // ...and return the delta:
+ return reflowCountAfterTweak - reflowCountBeforeTweak;
+}
+
+function main() {
+ // First, we sanity-check that our measurement make sense -- if we leave
+ // styles unchanged, we should measure no frames being reflowed:
+ let count = setStyleAndMeasure("width: 50px; height: 80px",
+ "width: 50px; height: 80px");
+ is(count, 0,
+ "Shouldn't reflow anything when we leave 'width' & 'height' unchanged");
+
+ // Now: see how many frames are reflowed when the "width" & "height" change.
+ // We'll use this as the reference when measuring reflow counts for various
+ // changes to "overflow" below.
+ count = setStyleAndMeasure("width: 50px; height: 80px",
+ "width: 90px; height: 60px");
+ ok(count > 0,
+ "Should reflow some frames when 'width' & 'height' change");
+
+ // Expected maximum number of frames reflowed for "overflow" changes
+ // (+2 is to allow for reflowing scrollbars themselves):
+ const expectedMax = count + 2;
+
+ // Shared ending for messages in all ok() checks below:
+ const messageSuffix =
+ " shouldn't be greater than count for tweaking width/height on body (" +
+ expectedMax + ")";
+
+ // OK, here is where the relevant tests actually begin!!
+ // See how many frames we reflow for various tweaks to "overflow" on
+ // the body -- we expect the count to be no larger than |expectedMax|.
+ count = setStyleAndMeasure("", "overflow: scroll");
+ ok(count <= expectedMax,
+ "Reflow count when setting 'overflow: scroll' on body (" + count + ")" +
+ messageSuffix);
+
+ count = setStyleAndMeasure("", "overflow: hidden");
+ ok(count <= expectedMax,
+ "Reflow count when setting 'overflow: hidden' on body (" + count + ")" +
+ messageSuffix);
+
+ // Test removal of "overflow: scroll":
+ count = setStyleAndMeasure("overflow: scroll", "");
+ ok(count <= expectedMax,
+ "Reflow count when removing 'overflow: scroll' from body (" + count + ")" +
+ messageSuffix);
+
+ count = setStyleAndMeasure("overflow: hidden", "");
+ ok(count <= expectedMax,
+ "Reflow count when removing 'overflow: hidden' from body (" + count + ")" +
+ messageSuffix);
+
+ // Test change between two non-'visible' overflow values:
+ count = setStyleAndMeasure("overflow: scroll", "overflow: hidden");
+ ok(count <= expectedMax,
+ "Reflow count when changing 'overflow' on body (" + count + ")" +
+ messageSuffix);
+}
+
+main();
+
+</script>
+</pre>
+</body>
+</html>
diff --git a/layout/svg/SVGTextFrame.cpp b/layout/svg/SVGTextFrame.cpp
index e681260682..e5a03333f9 100644
--- a/layout/svg/SVGTextFrame.cpp
+++ b/layout/svg/SVGTextFrame.cpp
@@ -5111,8 +5111,8 @@ SVGTextFrame::DoGlyphPositioning()
float actualTextLength =
static_cast<float>(presContext->AppUnitsToGfxUnits(frameLength) * factor);
- RefPtr<SVGAnimatedEnumeration> lengthAdjustEnum = element->LengthAdjust();
- uint16_t lengthAdjust = lengthAdjustEnum->AnimVal();
+ uint16_t lengthAdjust =
+ element->EnumAttributes()[SVGTextContentElement::LENGTHADJUST].GetAnimValue();
switch (lengthAdjust) {
case SVG_LENGTHADJUST_SPACINGANDGLYPHS:
// Scale the glyphs and their positions.
diff --git a/layout/svg/nsSVGUtils.cpp b/layout/svg/nsSVGUtils.cpp
index ff74d5bafc..344ebf645a 100644
--- a/layout/svg/nsSVGUtils.cpp
+++ b/layout/svg/nsSVGUtils.cpp
@@ -1127,8 +1127,7 @@ nsSVGUtils::GetBBox(nsIFrame *aFrame, uint32_t aFlags)
if (clipPathFrame && isOK) {
SVGClipPathElement *clipContent =
static_cast<SVGClipPathElement*>(clipPathFrame->GetContent());
- RefPtr<SVGAnimatedEnumeration> units = clipContent->ClipPathUnits();
- if (units->AnimVal() == SVG_UNIT_TYPE_OBJECTBOUNDINGBOX) {
+ if (clipContent->IsUnitsObjectBoundingBox()) {
matrix.Translate(gfxPoint(x, y));
matrix.Scale(width, height);
} else if (aFrame->GetType() == nsGkAtoms::svgForeignObjectFrame) {
diff --git a/media/ffvpx/COPYING.GPLv2 b/media/ffvpx/COPYING.GPLv2
deleted file mode 100644
index d159169d10..0000000000
--- a/media/ffvpx/COPYING.GPLv2
+++ /dev/null
@@ -1,339 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- <signature of Ty Coon>, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
diff --git a/media/ffvpx/COPYING.GPLv3 b/media/ffvpx/COPYING.GPLv3
deleted file mode 100644
index 94a9ed024d..0000000000
--- a/media/ffvpx/COPYING.GPLv3
+++ /dev/null
@@ -1,674 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
- The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works. By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users. We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors. You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
- To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights. Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received. You must make sure that they, too, receive
-or can get the source code. And you must show them these terms so they
-know their rights.
-
- Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
- For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software. For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
- Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so. This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software. The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable. Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products. If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
- Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary. To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- TERMS AND CONDITIONS
-
- 0. Definitions.
-
- "This License" refers to version 3 of the GNU General Public License.
-
- "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
- "The Program" refers to any copyrightable work licensed under this
-License. Each licensee is addressed as "you". "Licensees" and
-"recipients" may be individuals or organizations.
-
- To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy. The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
- A "covered work" means either the unmodified Program or a work based
-on the Program.
-
- To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy. Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
- To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies. Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
- An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License. If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
- 1. Source Code.
-
- The "source code" for a work means the preferred form of the work
-for making modifications to it. "Object code" means any non-source
-form of a work.
-
- A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
- The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form. A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
- The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities. However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work. For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
- The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
- The Corresponding Source for a work in source code form is that
-same work.
-
- 2. Basic Permissions.
-
- All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met. This License explicitly affirms your unlimited
-permission to run the unmodified Program. The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work. This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
- You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force. You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright. Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
- Conveying under any other circumstances is permitted solely under
-the conditions stated below. Sublicensing is not allowed; section 10
-makes it unnecessary.
-
- 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
- No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
- When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
- 4. Conveying Verbatim Copies.
-
- You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
- You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
- 5. Conveying Modified Source Versions.
-
- You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
- a) The work must carry prominent notices stating that you modified
- it, and giving a relevant date.
-
- b) The work must carry prominent notices stating that it is
- released under this License and any conditions added under section
- 7. This requirement modifies the requirement in section 4 to
- "keep intact all notices".
-
- c) You must license the entire work, as a whole, under this
- License to anyone who comes into possession of a copy. This
- License will therefore apply, along with any applicable section 7
- additional terms, to the whole of the work, and all its parts,
- regardless of how they are packaged. This License gives no
- permission to license the work in any other way, but it does not
- invalidate such permission if you have separately received it.
-
- d) If the work has interactive user interfaces, each must display
- Appropriate Legal Notices; however, if the Program has interactive
- interfaces that do not display Appropriate Legal Notices, your
- work need not make them do so.
-
- A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit. Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
- 6. Conveying Non-Source Forms.
-
- You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
- a) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by the
- Corresponding Source fixed on a durable physical medium
- customarily used for software interchange.
-
- b) Convey the object code in, or embodied in, a physical product
- (including a physical distribution medium), accompanied by a
- written offer, valid for at least three years and valid for as
- long as you offer spare parts or customer support for that product
- model, to give anyone who possesses the object code either (1) a
- copy of the Corresponding Source for all the software in the
- product that is covered by this License, on a durable physical
- medium customarily used for software interchange, for a price no
- more than your reasonable cost of physically performing this
- conveying of source, or (2) access to copy the
- Corresponding Source from a network server at no charge.
-
- c) Convey individual copies of the object code with a copy of the
- written offer to provide the Corresponding Source. This
- alternative is allowed only occasionally and noncommercially, and
- only if you received the object code with such an offer, in accord
- with subsection 6b.
-
- d) Convey the object code by offering access from a designated
- place (gratis or for a charge), and offer equivalent access to the
- Corresponding Source in the same way through the same place at no
- further charge. You need not require recipients to copy the
- Corresponding Source along with the object code. If the place to
- copy the object code is a network server, the Corresponding Source
- may be on a different server (operated by you or a third party)
- that supports equivalent copying facilities, provided you maintain
- clear directions next to the object code saying where to find the
- Corresponding Source. Regardless of what server hosts the
- Corresponding Source, you remain obligated to ensure that it is
- available for as long as needed to satisfy these requirements.
-
- e) Convey the object code using peer-to-peer transmission, provided
- you inform other peers where the object code and Corresponding
- Source of the work are being offered to the general public at no
- charge under subsection 6d.
-
- A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
- A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling. In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage. For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product. A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
- "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source. The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
- If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information. But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
- The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed. Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
- Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
- 7. Additional Terms.
-
- "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law. If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
- When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it. (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.) You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
- Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
- a) Disclaiming warranty or limiting liability differently from the
- terms of sections 15 and 16 of this License; or
-
- b) Requiring preservation of specified reasonable legal notices or
- author attributions in that material or in the Appropriate Legal
- Notices displayed by works containing it; or
-
- c) Prohibiting misrepresentation of the origin of that material, or
- requiring that modified versions of such material be marked in
- reasonable ways as different from the original version; or
-
- d) Limiting the use for publicity purposes of names of licensors or
- authors of the material; or
-
- e) Declining to grant rights under trademark law for use of some
- trade names, trademarks, or service marks; or
-
- f) Requiring indemnification of licensors and authors of that
- material by anyone who conveys the material (or modified versions of
- it) with contractual assumptions of liability to the recipient, for
- any liability that these contractual assumptions directly impose on
- those licensors and authors.
-
- All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10. If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term. If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
- If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
- Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
- 8. Termination.
-
- You may not propagate or modify a covered work except as expressly
-provided under this License. Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
- However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
- Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
- Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License. If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
- 9. Acceptance Not Required for Having Copies.
-
- You are not required to accept this License in order to receive or
-run a copy of the Program. Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance. However,
-nothing other than this License grants you permission to propagate or
-modify any covered work. These actions infringe copyright if you do
-not accept this License. Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
- 10. Automatic Licensing of Downstream Recipients.
-
- Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License. You are not responsible
-for enforcing compliance by third parties with this License.
-
- An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations. If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
- You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License. For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
- 11. Patents.
-
- A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based. The
-work thus licensed is called the contributor's "contributor version".
-
- A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version. For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
- Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
- In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement). To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
- If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients. "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
- If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
- A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License. You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
- Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
- 12. No Surrender of Others' Freedom.
-
- If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all. For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
- 13. Use with the GNU Affero General Public License.
-
- Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work. The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
- 14. Revised Versions of this License.
-
- The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
- Each version is given a distinguishing version number. If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation. If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
- If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
- Later license versions may give you additional or different
-permissions. However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
- 15. Disclaimer of Warranty.
-
- THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. Limitation of Liability.
-
- IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
- 17. Interpretation of Sections 15 and 16.
-
- If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- <one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-Also add information on how to contact you by electronic and paper mail.
-
- If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
- <program> Copyright (C) <year> <name of author>
- This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
- You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-<http://www.gnu.org/licenses/>.
-
- The GNU General Public License does not permit incorporating your program
-into proprietary programs. If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License. But first, please read
-<http://www.gnu.org/philosophy/why-not-lgpl.html>.
diff --git a/media/ffvpx/CREDITS b/media/ffvpx/CREDITS
deleted file mode 100644
index e29f0b853c..0000000000
--- a/media/ffvpx/CREDITS
+++ /dev/null
@@ -1,6 +0,0 @@
-See the Git history of the project (git://source.ffmpeg.org/ffmpeg) to
-get the names of people who have contributed to FFmpeg.
-
-To check the log, you can type the command "git log" in the FFmpeg
-source directory, or browse the online repository at
-http://source.ffmpeg.org.
diff --git a/media/ffvpx/Changelog b/media/ffvpx/Changelog
deleted file mode 100644
index 2e1cd36f5f..0000000000
--- a/media/ffvpx/Changelog
+++ /dev/null
@@ -1,1476 +0,0 @@
-Entries are sorted chronologically from oldest to youngest within each release,
-releases are sorted from youngest to oldest.
-
-version 3.0:
-- Common Encryption (CENC) MP4 encoding and decoding support
-- DXV decoding
-- extrastereo filter
-- ocr filter
-- alimiter filter
-- stereowiden filter
-- stereotools filter
-- rubberband filter
-- tremolo filter
-- agate filter
-- chromakey filter
-- maskedmerge filter
-- Screenpresso SPV1 decoding
-- chromaprint fingerprinting muxer
-- ffplay dynamic volume control
-- displace filter
-- selectivecolor filter
-- extensive native AAC encoder improvements and removal of experimental flag
-- ADPCM PSX decoder
-- 3dostr, dcstr, fsb, genh, vag, xvag, ads, msf, svag & vpk demuxer
-- zscale filter
-- wve demuxer
-- zero-copy Intel QSV transcoding in ffmpeg
-- shuffleframes filter
-- SDX2 DPCM decoder
-- vibrato filter
-- innoHeim/Rsupport Screen Capture Codec decoder
-- ADPCM AICA decoder
-- Interplay ACM demuxer and audio decoder
-- XMA1 & XMA2 decoder
-- realtime filter
-- anoisesrc audio filter source
-- IVR demuxer
-- compensationdelay filter
-- acompressor filter
-- support encoding 16-bit RLE SGI images
-- apulsator filter
-- sidechaingate audio filter
-- mipsdspr1 option has been renamed to mipsdsp
-- aemphasis filter
-- mips32r5 option has been removed
-- mips64r6 option has been removed
-- DXVA2-accelerated VP9 decoding
-- SOFAlizer: virtual binaural acoustics filter
-- VAAPI VP9 hwaccel
-- audio high-order multiband parametric equalizer
-- automatic bitstream filtering
-- showspectrumpic filter
-- libstagefright support removed
-- spectrumsynth filter
-- ahistogram filter
-- only seek with the right mouse button in ffplay
-- toggle full screen when double-clicking with the left mouse button in ffplay
-- afftfilt filter
-- convolution filter
-- libquvi support removed
-- support for dvaudio in wav and avi
-- libaacplus and libvo-aacenc support removed
-- Cineform HD decoder
-- new DCA decoder with full support for DTS-HD extensions
-- significant performance improvements in Windows Television (WTV) demuxer
-- nnedi deinterlacer
-- streamselect video and astreamselect audio filter
-- swaprect filter
-- metadata video and ametadata audio filter
-- SMPTE VC-2 HQ profile support for the Dirac decoder
-- SMPTE VC-2 native encoder supporting the HQ profile
-
-
-version 2.8:
-- colorkey video filter
-- BFSTM/BCSTM demuxer
-- little-endian ADPCM_THP decoder
-- Hap decoder and encoder
-- DirectDraw Surface image/texture decoder
-- ssim filter
-- optional new ASF demuxer
-- showvolume filter
-- Many improvements to the JPEG 2000 decoder
-- Go2Meeting decoding support
-- adrawgraph audio and drawgraph video filter
-- removegrain video filter
-- Intel QSV-accelerated MPEG-2 video and HEVC encoding
-- Intel QSV-accelerated MPEG-2 video and HEVC decoding
-- Intel QSV-accelerated VC-1 video decoding
-- libkvazaar HEVC encoder
-- erosion, dilation, deflate and inflate video filters
-- Dynamic Audio Normalizer as dynaudnorm filter
-- Reverse video and areverse audio filter
-- Random filter
-- deband filter
-- AAC fixed-point decoding
-- sidechaincompress audio filter
-- bitstream filter for converting HEVC from MP4 to Annex B
-- acrossfade audio filter
-- allyuv and allrgb video sources
-- atadenoise video filter
-- OS X VideoToolbox support
-- aphasemeter filter
-- showfreqs filter
-- vectorscope filter
-- waveform filter
-- hstack and vstack filter
-- Support DNx100 (1440x1080@8)
-- VAAPI hevc hwaccel
-- VDPAU hevc hwaccel
-- framerate filter
-- Switched default encoders for webm to VP9 and Opus
-- Removed experimental flag from the JPEG 2000 encoder
-
-
-version 2.7:
-- FFT video filter
-- TDSC decoder
-- DTS lossless extension (XLL) decoding (not lossless, disabled by default)
-- showwavespic filter
-- DTS decoding through libdcadec
-- Drop support for nvenc API before 5.0
-- nvenc HEVC encoder
-- Detelecine filter
-- Intel QSV-accelerated H.264 encoding
-- MMAL-accelerated H.264 decoding
-- basic APNG encoder and muxer with default extension "apng"
-- unpack DivX-style packed B-frames in MPEG-4 bitstream filter
-- WebM Live Chunk Muxer
-- nvenc level and tier options
-- chorus filter
-- Canopus HQ/HQA decoder
-- Automatically rotate videos based on metadata in ffmpeg
-- improved Quickdraw compatibility
-- VP9 high bit-depth and extended colorspaces decoding support
-- WebPAnimEncoder API when available for encoding and muxing WebP
-- Direct3D11-accelerated decoding
-- Support Secure Transport
-- Multipart JPEG demuxer
-
-
-version 2.6:
-- nvenc encoder
-- 10bit spp filter
-- colorlevels filter
-- RIFX format for *.wav files
-- RTP/mpegts muxer
-- non continuous cache protocol support
-- tblend filter
-- cropdetect support for non 8bpp, absolute (if limit >= 1) and relative (if limit < 1.0) threshold
-- Camellia symmetric block cipher
-- OpenH264 encoder wrapper
-- VOC seeking support
-- Closed caption Decoder
-- fspp, uspp, pp7 MPlayer postprocessing filters ported to native filters
-- showpalette filter
-- Twofish symmetric block cipher
-- Support DNx100 (960x720@8)
-- eq2 filter ported from libmpcodecs as eq filter
-- removed libmpcodecs
-- Changed default DNxHD colour range in QuickTime .mov derivatives to mpeg range
-- ported softpulldown filter from libmpcodecs as repeatfields filter
-- dcshift filter
-- RTP depacketizer for loss tolerant payload format for MP3 audio (RFC 5219)
-- RTP depacketizer for AC3 payload format (RFC 4184)
-- palettegen and paletteuse filters
-- VP9 RTP payload format (draft 0) experimental depacketizer
-- RTP depacketizer for DV (RFC 6469)
-- DXVA2-accelerated HEVC decoding
-- AAC ELD 480 decoding
-- Intel QSV-accelerated H.264 decoding
-- DSS SP decoder and DSS demuxer
-- Fix stsd atom corruption in DNxHD QuickTimes
-- Canopus HQX decoder
-- RTP depacketization of T.140 text (RFC 4103)
-- Port MIPS optimizations to 64-bit
-
-
-version 2.5:
-- HEVC/H.265 RTP payload format (draft v6) packetizer
-- SUP/PGS subtitle demuxer
-- ffprobe -show_pixel_formats option
-- CAST128 symmetric block cipher, ECB mode
-- STL subtitle demuxer and decoder
-- libutvideo YUV 4:2:2 10bit support
-- XCB-based screen-grabber
-- UDP-Lite support (RFC 3828)
-- xBR scaling filter
-- AVFoundation screen capturing support
-- ffserver supports codec private options
-- creating DASH compatible fragmented MP4, MPEG-DASH segmenting muxer
-- WebP muxer with animated WebP support
-- zygoaudio decoding support
-- APNG demuxer
-- postproc visualization support
-
-
-version 2.4:
-- Icecast protocol
-- ported lenscorrection filter from frei0r filter
-- large optimizations in dctdnoiz to make it usable
-- ICY metadata are now requested by default with the HTTP protocol
-- support for using metadata in stream specifiers in fftools
-- LZMA compression support in TIFF decoder
-- H.261 RTP payload format (RFC 4587) depacketizer and experimental packetizer
-- HEVC/H.265 RTP payload format (draft v6) depacketizer
-- added codecview filter to visualize information exported by some codecs
-- Matroska 3D support thorugh side data
-- HTML generation using texi2html is deprecated in favor of makeinfo/texi2any
-- silenceremove filter
-
-
-version 2.3:
-- AC3 fixed-point decoding
-- shuffleplanes filter
-- subfile protocol
-- Phantom Cine demuxer
-- replaygain data export
-- VP7 video decoder
-- Alias PIX image encoder and decoder
-- Improvements to the BRender PIX image decoder
-- Improvements to the XBM decoder
-- QTKit input device
-- improvements to OpenEXR image decoder
-- support decoding 16-bit RLE SGI images
-- GDI screen grabbing for Windows
-- alternative rendition support for HTTP Live Streaming
-- AVFoundation input device
-- Direct Stream Digital (DSD) decoder
-- Magic Lantern Video (MLV) demuxer
-- On2 AVC (Audio for Video) decoder
-- support for decoding through DXVA2 in ffmpeg
-- libbs2b-based stereo-to-binaural audio filter
-- libx264 reference frames count limiting depending on level
-- native Opus decoder
-- display matrix export and rotation API
-- WebVTT encoder
-- showcqt multimedia filter
-- zoompan filter
-- signalstats filter
-- hqx filter (hq2x, hq3x, hq4x)
-- flanger filter
-- Image format auto-detection
-- LRC demuxer and muxer
-- Samba protocol (via libsmbclient)
-- WebM DASH Manifest muxer
-- libfribidi support in drawtext
-
-
-version 2.2:
-
-- HNM version 4 demuxer and video decoder
-- Live HDS muxer
-- setsar/setdar filters now support variables in ratio expressions
-- elbg filter
-- string validation in ffprobe
-- support for decoding through VDPAU in ffmpeg (the -hwaccel option)
-- complete Voxware MetaSound decoder
-- remove mp3_header_compress bitstream filter
-- Windows resource files for shared libraries
-- aeval filter
-- stereoscopic 3d metadata handling
-- WebP encoding via libwebp
-- ATRAC3+ decoder
-- VP8 in Ogg demuxing
-- side & metadata support in NUT
-- framepack filter
-- XYZ12 rawvideo support in NUT
-- Exif metadata support in WebP decoder
-- OpenGL device
-- Use metadata_header_padding to control padding in ID3 tags (currently used in
- MP3, AIFF, and OMA files), FLAC header, and the AVI "junk" block.
-- Mirillis FIC video decoder
-- Support DNx444
-- libx265 encoder
-- dejudder filter
-- Autodetect VDA like all other hardware accelerations
-- aliases and defaults for Ogg subtypes (opus, spx)
-
-
-version 2.1:
-
-- aecho filter
-- perspective filter ported from libmpcodecs
-- ffprobe -show_programs option
-- compand filter
-- RTMP seek support
-- when transcoding with ffmpeg (i.e. not streamcopying), -ss is now accurate
- even when used as an input option. Previous behavior can be restored with
- the -noaccurate_seek option.
-- ffmpeg -t option can now be used for inputs, to limit the duration of
- data read from an input file
-- incomplete Voxware MetaSound decoder
-- read EXIF metadata from JPEG
-- DVB teletext decoder
-- phase filter ported from libmpcodecs
-- w3fdif filter
-- Opus support in Matroska
-- FFV1 version 1.3 is stable and no longer experimental
-- FFV1: YUVA(444,422,420) 9, 10 and 16 bit support
-- changed DTS stream id in lavf mpeg ps muxer from 0x8a to 0x88, to be
- more consistent with other muxers.
-- adelay filter
-- pullup filter ported from libmpcodecs
-- ffprobe -read_intervals option
-- Lossless and alpha support for WebP decoder
-- Error Resilient AAC syntax (ER AAC LC) decoding
-- Low Delay AAC (ER AAC LD) decoding
-- mux chapters in ASF files
-- SFTP protocol (via libssh)
-- libx264: add ability to encode in YUVJ422P and YUVJ444P
-- Fraps: use BT.709 colorspace by default for yuv, as reference fraps decoder does
-- make decoding alpha optional for prores, ffv1 and vp6 by setting
- the skip_alpha flag.
-- ladspa wrapper filter
-- native VP9 decoder
-- dpx parser
-- max_error_rate parameter in ffmpeg
-- PulseAudio output device
-- ReplayGain scanner
-- Enhanced Low Delay AAC (ER AAC ELD) decoding (no LD SBR support)
-- Linux framebuffer output device
-- HEVC decoder
-- raw HEVC, HEVC in MOV/MP4, HEVC in Matroska, HEVC in MPEG-TS demuxing
-- mergeplanes filter
-
-
-version 2.0:
-
-- curves filter
-- reference-counting for AVFrame and AVPacket data
-- ffmpeg now fails when input options are used for output file
- or vice versa
-- support for Monkey's Audio versions from 3.93
-- perms and aperms filters
-- audio filtering support in ffplay
-- 10% faster aac encoding on x86 and MIPS
-- sine audio filter source
-- WebP demuxing and decoding support
-- ffmpeg options -filter_script and -filter_complex_script, which allow a
- filtergraph description to be read from a file
-- OpenCL support
-- audio phaser filter
-- separatefields filter
-- libquvi demuxer
-- uniform options syntax across all filters
-- telecine filter
-- interlace filter
-- smptehdbars source
-- inverse telecine filters (fieldmatch and decimate)
-- colorbalance filter
-- colorchannelmixer filter
-- The matroska demuxer can now output proper verbatim ASS packets. It will
- become the default at the next libavformat major bump.
-- decent native animated GIF encoding
-- asetrate filter
-- interleave filter
-- timeline editing with filters
-- vidstabdetect and vidstabtransform filters for video stabilization using
- the vid.stab library
-- astats filter
-- trim and atrim filters
-- ffmpeg -t and -ss (output-only) options are now sample-accurate when
- transcoding audio
-- Matroska muxer can now put the index at the beginning of the file.
-- extractplanes filter
-- avectorscope filter
-- ADPCM DTK decoder
-- ADP demuxer
-- RSD demuxer
-- RedSpark demuxer
-- ADPCM IMA Radical decoder
-- zmq filters
-- DCT denoiser filter (dctdnoiz)
-- Wavelet denoiser filter ported from libmpcodecs as owdenoise (formerly "ow")
-- Apple Intermediate Codec decoder
-- Escape 130 video decoder
-- FTP protocol support
-- V4L2 output device
-- 3D LUT filter (lut3d)
-- SMPTE 302M audio encoder
-- support for slice multithreading in libavfilter
-- Hald CLUT support (generation and filtering)
-- VC-1 interlaced B-frame support
-- support for WavPack muxing (raw and in Matroska)
-- XVideo output device
-- vignette filter
-- True Audio (TTA) encoder
-- Go2Webinar decoder
-- mcdeint filter ported from libmpcodecs
-- sab filter ported from libmpcodecs
-- ffprobe -show_chapters option
-- WavPack encoding through libwavpack
-- rotate filter
-- spp filter ported from libmpcodecs
-- libgme support
-- psnr filter
-
-
-version 1.2:
-
-- VDPAU hardware acceleration through normal hwaccel
-- SRTP support
-- Error diffusion dither in Swscale
-- Chained Ogg support
-- Theora Midstream reconfiguration support
-- EVRC decoder
-- audio fade filter
-- filtering audio with unknown channel layout
-- allpass, bass, bandpass, bandreject, biquad, equalizer, highpass, lowpass
- and treble audio filter
-- improved showspectrum filter, with multichannel support and sox-like colors
-- histogram filter
-- tee muxer
-- il filter ported from libmpcodecs
-- support ID3v2 tags in ASF files
-- encrypted TTA stream decoding support
-- RF64 support in WAV muxer
-- noise filter ported from libmpcodecs
-- Subtitles character encoding conversion
-- blend filter
-- stereo3d filter ported from libmpcodecs
-
-
-version 1.1:
-
-- stream disposition information printing in ffprobe
-- filter for loudness analysis following EBU R128
-- Opus encoder using libopus
-- ffprobe -select_streams option
-- Pinnacle TARGA CineWave YUV16 decoder
-- TAK demuxer, decoder and parser
-- DTS-HD demuxer
-- remove -same_quant, it hasn't worked for years
-- FFM2 support
-- X-Face image encoder and decoder
-- 24-bit FLAC encoding
-- multi-channel ALAC encoding up to 7.1
-- metadata (INFO tag) support in WAV muxer
-- subtitles raw text decoder
-- support for building DLLs using MSVC
-- LVF demuxer
-- ffescape tool
-- metadata (info chunk) support in CAF muxer
-- field filter ported from libmpcodecs
-- AVR demuxer
-- geq filter ported from libmpcodecs
-- remove ffserver daemon mode
-- AST muxer/demuxer
-- new expansion syntax for drawtext
-- BRender PIX image decoder
-- ffprobe -show_entries option
-- ffprobe -sections option
-- ADPCM IMA Dialogic decoder
-- BRSTM demuxer
-- animated GIF decoder and demuxer
-- PVF demuxer
-- subtitles filter
-- IRCAM muxer/demuxer
-- Paris Audio File demuxer
-- Virtual concatenation demuxer
-- VobSub demuxer
-- JSON captions for TED talks decoding support
-- SOX Resampler support in libswresample
-- aselect filter
-- SGI RLE 8-bit / Silicon Graphics RLE 8-bit video decoder
-- Silicon Graphics Motion Video Compressor 1 & 2 decoder
-- Silicon Graphics Movie demuxer
-- apad filter
-- Resolution & pixel format change support with multithreading for H.264
-- documentation split into per-component manuals
-- pp (postproc) filter ported from MPlayer
-- NIST Sphere demuxer
-- MPL2, VPlayer, MPlayer, AQTitle, PJS and SubViewer v1 subtitles demuxers and decoders
-- Sony Wave64 muxer
-- adobe and limelight publisher authentication in RTMP
-- data: URI scheme
-- support building on the Plan 9 operating system
-- kerndeint filter ported from MPlayer
-- histeq filter ported from VirtualDub
-- Megalux Frame demuxer
-- 012v decoder
-- Improved AVC Intra decoding support
-
-
-version 1.0:
-
-- INI and flat output in ffprobe
-- Scene detection in libavfilter
-- Indeo Audio decoder
-- channelsplit audio filter
-- setnsamples audio filter
-- atempo filter
-- ffprobe -show_data option
-- RTMPT protocol support
-- iLBC encoding/decoding via libilbc
-- Microsoft Screen 1 decoder
-- join audio filter
-- audio channel mapping filter
-- Microsoft ATC Screen decoder
-- RTSP listen mode
-- TechSmith Screen Codec 2 decoder
-- AAC encoding via libfdk-aac
-- Microsoft Expression Encoder Screen decoder
-- RTMPS protocol support
-- RTMPTS protocol support
-- RTMPE protocol support
-- RTMPTE protocol support
-- showwaves and showspectrum filter
-- LucasArts SMUSH SANM playback support
-- LucasArts SMUSH VIMA audio decoder (ADPCM)
-- LucasArts SMUSH demuxer
-- SAMI, RealText and SubViewer demuxers and decoders
-- Heart Of Darkness PAF playback support
-- iec61883 device
-- asettb filter
-- new option: -progress
-- 3GPP Timed Text encoder/decoder
-- GeoTIFF decoder support
-- ffmpeg -(no)stdin option
-- Opus decoder using libopus
-- caca output device using libcaca
-- alphaextract and alphamerge filters
-- concat filter
-- flite filter
-- Canopus Lossless Codec decoder
-- bitmap subtitles in filters (experimental and temporary)
-- MP2 encoding via TwoLAME
-- bmp parser
-- smptebars source
-- asetpts filter
-- hue filter
-- ICO muxer
-- SubRip encoder and decoder without embedded timing
-- edge detection filter
-- framestep filter
-- ffmpeg -shortest option is now per-output file
- -pass and -passlogfile are now per-output stream
-- volume measurement filter
-- Ut Video encoder
-- Microsoft Screen 2 decoder
-- smartblur filter ported from MPlayer
-- CPiA decoder
-- decimate filter ported from MPlayer
-- RTP depacketization of JPEG
-- Smooth Streaming live segmenter muxer
-- F4V muxer
-- sendcmd and asendcmd filters
-- WebVTT demuxer and decoder (simple tags supported)
-- RTP packetization of JPEG
-- faststart option in the MOV/MP4 muxer
-- support for building with MSVC
-
-
-version 0.11:
-
-- Fixes: CVE-2012-2772, CVE-2012-2774, CVE-2012-2775, CVE-2012-2776, CVE-2012-2777,
- CVE-2012-2779, CVE-2012-2782, CVE-2012-2783, CVE-2012-2784, CVE-2012-2785,
- CVE-2012-2786, CVE-2012-2787, CVE-2012-2788, CVE-2012-2789, CVE-2012-2790,
- CVE-2012-2791, CVE-2012-2792, CVE-2012-2793, CVE-2012-2794, CVE-2012-2795,
- CVE-2012-2796, CVE-2012-2797, CVE-2012-2798, CVE-2012-2799, CVE-2012-2800,
- CVE-2012-2801, CVE-2012-2802, CVE-2012-2803, CVE-2012-2804,
-- v408 Quicktime and Microsoft AYUV Uncompressed 4:4:4:4 encoder and decoder
-- setfield filter
-- CDXL demuxer and decoder
-- Apple ProRes encoder
-- ffprobe -count_packets and -count_frames options
-- Sun Rasterfile Encoder
-- ID3v2 attached pictures reading and writing
-- WMA Lossless decoder
-- bluray protocol
-- blackdetect filter
-- libutvideo encoder wrapper (--enable-libutvideo)
-- swapuv filter
-- bbox filter
-- XBM encoder and decoder
-- RealAudio Lossless decoder
-- ZeroCodec decoder
-- tile video filter
-- Metal Gear Solid: The Twin Snakes demuxer
-- OpenEXR image decoder
-- removelogo filter
-- drop support for ffmpeg without libavfilter
-- drawtext video filter: fontconfig support
-- ffmpeg -benchmark_all option
-- super2xsai filter ported from libmpcodecs
-- add libavresample audio conversion library for compatibility
-- MicroDVD decoder
-- Avid Meridien (AVUI) encoder and decoder
-- accept + prefix to -pix_fmt option to disable automatic conversions.
-- complete audio filtering in libavfilter and ffmpeg
-- add fps filter
-- vorbis parser
-- png parser
-- audio mix filter
-- ffv1: support (draft) version 1.3
-
-
-version 0.10:
-
-- Fixes: CVE-2011-3929, CVE-2011-3934, CVE-2011-3935, CVE-2011-3936,
- CVE-2011-3937, CVE-2011-3940, CVE-2011-3941, CVE-2011-3944,
- CVE-2011-3945, CVE-2011-3946, CVE-2011-3947, CVE-2011-3949,
- CVE-2011-3950, CVE-2011-3951, CVE-2011-3952
-- v410 Quicktime Uncompressed 4:4:4 10-bit encoder and decoder
-- SBaGen (SBG) binaural beats script demuxer
-- OpenMG Audio muxer
-- Timecode extraction in DV and MOV
-- thumbnail video filter
-- XML output in ffprobe
-- asplit audio filter
-- tinterlace video filter
-- astreamsync audio filter
-- amerge audio filter
-- ISMV (Smooth Streaming) muxer
-- GSM audio parser
-- SMJPEG muxer
-- XWD encoder and decoder
-- Automatic thread count based on detection number of (available) CPU cores
-- y41p Brooktree Uncompressed 4:1:1 12-bit encoder and decoder
-- ffprobe -show_error option
-- Avid 1:1 10-bit RGB Packer codec
-- v308 Quicktime Uncompressed 4:4:4 encoder and decoder
-- yuv4 libquicktime packed 4:2:0 encoder and decoder
-- ffprobe -show_frames option
-- silencedetect audio filter
-- ffprobe -show_program_version, -show_library_versions, -show_versions options
-- rv34: frame-level multi-threading
-- optimized iMDCT transform on x86 using SSE for for mpegaudiodec
-- Improved PGS subtitle decoder
-- dumpgraph option to lavfi device
-- r210 and r10k encoders
-- ffwavesynth decoder
-- aviocat tool
-- ffeval tool
-- support encoding and decoding 4-channel SGI images
-
-
-version 0.9:
-
-- openal input device added
-- boxblur filter added
-- BWF muxer
-- Flash Screen Video 2 decoder
-- lavfi input device added
-- added avconv, which is almost the same for now, except
-for a few incompatible changes in the options, which will hopefully make them
-easier to use. The changes are:
- * The options placement is now strictly enforced! While in theory the
- options for ffmpeg should be given in [input options] -i INPUT [output
- options] OUTPUT order, in practice it was possible to give output options
- before the -i and it mostly worked. Except when it didn't - the behavior was
- a bit inconsistent. In avconv, it is not possible to mix input and output
- options. All non-global options are reset after an input or output filename.
- * All per-file options are now truly per-file - they apply only to the next
- input or output file and specifying different values for different files
- will now work properly (notably -ss and -t options).
- * All per-stream options are now truly per-stream - it is possible to
- specify which stream(s) should a given option apply to. See the Stream
- specifiers section in the avconv manual for details.
- * In ffmpeg some options (like -newvideo/-newaudio/...) are irregular in the
- sense that they're specified after the output filename instead of before,
- like all other options. In avconv this irregularity is removed, all options
- apply to the next input or output file.
- * -newvideo/-newaudio/-newsubtitle options were removed. Not only were they
- irregular and highly confusing, they were also redundant. In avconv the -map
- option will create new streams in the output file and map input streams to
- them. E.g. avconv -i INPUT -map 0 OUTPUT will create an output stream for
- each stream in the first input file.
- * The -map option now has slightly different and more powerful syntax:
- + Colons (':') are used to separate file index/stream type/stream index
- instead of dots. Comma (',') is used to separate the sync stream instead
- of colon.. This is done for consistency with other options.
- + It's possible to specify stream type. E.g. -map 0:a:2 creates an
- output stream from the third input audio stream.
- + Omitting the stream index now maps all the streams of the given type,
- not just the first. E.g. -map 0:s creates output streams for all the
- subtitle streams in the first input file.
- + Since -map can now match multiple streams, negative mappings were
- introduced. Negative mappings disable some streams from an already
- defined map. E.g. '-map 0 -map -0:a:1' means 'create output streams for
- all the stream in the first input file, except for the second audio
- stream'.
- * There is a new option -c (or -codec) for choosing the decoder/encoder to
- use, which makes it possible to precisely specify target stream(s) consistently with
- other options. E.g. -c:v lib264 sets the codec for all video streams, -c:a:0
- libvorbis sets the codec for the first audio stream and -c copy copies all
- the streams without reencoding. Old -vcodec/-acodec/-scodec options are now
- aliases to -c:v/a/s
- * It is now possible to precisely specify which stream should an AVOption
- apply to. E.g. -b:v:0 2M sets the bitrate for the first video stream, while
- -b:a 128k sets the bitrate for all audio streams. Note that the old -ab 128k
- syntax is deprecated and will stop working soon.
- * -map_chapters now takes only an input file index and applies to the next
- output file. This is consistent with how all the other options work.
- * -map_metadata now takes only an input metadata specifier and applies to
- the next output file. Output metadata specifier is now part of the option
- name, similarly to the AVOptions/map/codec feature above.
- * -metadata can now be used to set metadata on streams and chapters, e.g.
- -metadata:s:1 language=eng sets the language of the first stream to 'eng'.
- This made -vlang/-alang/-slang options redundant, so they were removed.
- * -qscale option now uses stream specifiers and applies to all streams, not
- just video. I.e. plain -qscale number would now apply to all streams. To get
- the old behavior, use -qscale:v. Also there is now a shortcut -q for -qscale
- and -aq is now an alias for -q:a.
- * -vbsf/-absf/-sbsf options were removed and replaced by a -bsf option which
- uses stream specifiers. Use -bsf:v/a/s instead of the old options.
- * -itsscale option now uses stream specifiers, so its argument is only the
- scale parameter.
- * -intra option was removed, use -g 0 for the same effect.
- * -psnr option was removed, use -flags +psnr for the same effect.
- * -vf option is now an alias to the new -filter option, which uses stream specifiers.
- * -vframes/-aframes/-dframes options are now aliases to the new -frames option.
- * -vtag/-atag/-stag options are now aliases to the new -tag option.
-- XMV demuxer
-- LOAS demuxer
-- ashowinfo filter added
-- Windows Media Image decoder
-- amovie source added
-- LATM muxer/demuxer
-- Speex encoder via libspeex
-- JSON output in ffprobe
-- WTV muxer
-- Optional C++ Support (needed for libstagefright)
-- H.264 Decoding on Android via Stagefright
-- Prores decoder
-- BIN/XBIN/ADF/IDF text file decoder
-- aconvert audio filter added
-- audio support to lavfi input device added
-- libcdio-paranoia input device for audio CD grabbing
-- Apple ProRes decoder
-- CELT in Ogg demuxing
-- G.723.1 demuxer and decoder
-- libmodplug support (--enable-libmodplug)
-- VC-1 interlaced decoding
-- libutvideo wrapper (--enable-libutvideo)
-- aevalsrc audio source added
-- Ut Video decoder
-- Speex encoding via libspeex
-- 4:2:2 H.264 decoding support
-- 4:2:2 and 4:4:4 H.264 encoding with libx264
-- Pulseaudio input device
-- Prores encoder
-- Video Decoder Acceleration (VDA) HWAccel module.
-- replacement Indeo 3 decoder
-- new ffmpeg option: -map_channel
-- volume audio filter added
-- earwax audio filter added
-- libv4l2 support (--enable-libv4l2)
-- TLS/SSL and HTTPS protocol support
-- AVOptions API rewritten and documented
-- most of CODEC_FLAG2_*, some CODEC_FLAG_* and many codec-specific fields in
- AVCodecContext deprecated. Codec private options should be used instead.
-- Properly working defaults in libx264 wrapper, support for native presets.
-- Encrypted OMA files support
-- Discworld II BMV decoding support
-- VBLE Decoder
-- OS X Video Decoder Acceleration (VDA) support
-- compact and csv output in ffprobe
-- pan audio filter
-- IFF Amiga Continuous Bitmap (ACBM) decoder
-- ass filter
-- CRI ADX audio format muxer and demuxer
-- Playstation Portable PMP format demuxer
-- Microsoft Windows ICO demuxer
-- life source
-- PCM format support in OMA demuxer
-- CLJR encoder
-- new option: -report
-- Dxtory capture format decoder
-- cellauto source
-- Simple segmenting muxer
-- Indeo 4 decoder
-- SMJPEG demuxer
-
-
-version 0.8:
-
-- many many things we forgot because we rather write code than changelogs
-- WebM support in Matroska de/muxer
-- low overhead Ogg muxing
-- MMS-TCP support
-- VP8 de/encoding via libvpx
-- Demuxer for On2's IVF format
-- Pictor/PC Paint decoder
-- HE-AAC v2 decoder
-- HE-AAC v2 encoding with libaacplus
-- libfaad2 wrapper removed
-- DTS-ES extension (XCh) decoding support
-- native VP8 decoder
-- RTSP tunneling over HTTP
-- RTP depacketization of SVQ3
-- -strict inofficial replaced by -strict unofficial
-- ffplay -exitonkeydown and -exitonmousedown options added
-- native GSM / GSM MS decoder
-- RTP depacketization of QDM2
-- ANSI/ASCII art playback system
-- Lego Mindstorms RSO de/muxer
-- libavcore added (and subsequently removed)
-- SubRip subtitle file muxer and demuxer
-- Chinese AVS encoding via libxavs
-- ffprobe -show_packets option added
-- RTP packetization of Theora and Vorbis
-- RTP depacketization of MP4A-LATM
-- RTP packetization and depacketization of VP8
-- hflip filter
-- Apple HTTP Live Streaming demuxer
-- a64 codec
-- MMS-HTTP support
-- G.722 ADPCM audio encoder/decoder
-- R10k video decoder
-- ocv_smooth filter
-- frei0r wrapper filter
-- change crop filter syntax to width:height:x:y
-- make the crop filter accept parametric expressions
-- make ffprobe accept AVFormatContext options
-- yadif filter
-- blackframe filter
-- Demuxer for Leitch/Harris' VR native stream format (LXF)
-- RTP depacketization of the X-QT QuickTime format
-- SAP (Session Announcement Protocol, RFC 2974) muxer and demuxer
-- cropdetect filter
-- ffmpeg -crop* options removed
-- transpose filter added
-- ffmpeg -force_key_frames option added
-- demuxer for receiving raw rtp:// URLs without an SDP description
-- single stream LATM/LOAS decoder
-- setpts filter added
-- Win64 support for optimized x86 assembly functions
-- MJPEG/AVI1 to JPEG/JFIF bitstream filter
-- ASS subtitle encoder and decoder
-- IEC 61937 encapsulation for E-AC-3, TrueHD, DTS-HD (for HDMI passthrough)
-- overlay filter added
-- rename aspect filter to setdar, and pixelaspect to setsar
-- IEC 61937 demuxer
-- Mobotix .mxg demuxer
-- frei0r source added
-- hqdn3d filter added
-- RTP depacketization of QCELP
-- FLAC parser added
-- gradfun filter added
-- AMR-WB decoder
-- replace the ocv_smooth filter with a more generic ocv filter
-- Windows Televison (WTV) demuxer
-- FFmpeg metadata format muxer and demuxer
-- SubRip (srt) subtitle encoder and decoder
-- floating-point AC-3 encoder added
-- Lagarith decoder
-- ffmpeg -copytb option added
-- IVF muxer added
-- Wing Commander IV movies decoder added
-- movie source added
-- Bink version 'b' audio and video decoder
-- Bitmap Brothers JV playback system
-- Apple HTTP Live Streaming protocol handler
-- sndio support for playback and record
-- Linux framebuffer input device added
-- Chronomaster DFA decoder
-- DPX image encoder
-- MicroDVD subtitle file muxer and demuxer
-- Playstation Portable PMP format demuxer
-- fieldorder video filter added
-- AAC encoding via libvo-aacenc
-- AMR-WB encoding via libvo-amrwbenc
-- xWMA demuxer
-- Mobotix MxPEG decoder
-- VP8 frame-multithreading
-- NEON optimizations for VP8
-- Lots of deprecated API cruft removed
-- fft and imdct optimizations for AVX (Sandy Bridge) processors
-- showinfo filter added
-- SMPTE 302M AES3 audio decoder
-- Apple Core Audio Format muxer
-- 9bit and 10bit per sample support in the H.264 decoder
-- 9bit and 10bit FFV1 encoding / decoding
-- split filter added
-- select filter added
-- sdl output device added
-- libmpcodecs video filter support (3 times as many filters than before)
-- mpeg2 aspect ratio dection fixed
-- libxvid aspect pickiness fixed
-- Frame multithreaded decoding
-- E-AC-3 audio encoder
-- ac3enc: add channel coupling support
-- floating-point sample format support to the ac3, eac3, dca, aac, and vorbis decoders.
-- H264/MPEG frame-level multi-threading
-- All av_metadata_* functions renamed to av_dict_* and moved to libavutil
-- 4:4:4 H.264 decoding support
-- 10-bit H.264 optimizations for x86
-- lut, lutrgb, and lutyuv filters added
-- buffersink libavfilter sink added
-- Bump libswscale for recently reported ABI break
-- New J2K encoder (via OpenJPEG)
-
-
-version 0.7:
-
-- all the changes for 0.8, but keeping API/ABI compatibility with the 0.6 release
-
-
-version 0.6:
-
-- PB-frame decoding for H.263
-- deprecated vhook subsystem removed
-- deprecated old scaler removed
-- VQF demuxer
-- Alpha channel scaler
-- PCX encoder
-- RTP packetization of H.263
-- RTP packetization of AMR
-- RTP depacketization of Vorbis
-- CorePNG decoding support
-- Cook multichannel decoding support
-- introduced avlanguage helpers in libavformat
-- 8088flex TMV demuxer and decoder
-- per-stream language-tags extraction in asfdec
-- V210 decoder and encoder
-- remaining GPL parts in AC-3 decoder converted to LGPL
-- QCP demuxer
-- SoX native format muxer and demuxer
-- AMR-NB decoding/encoding, AMR-WB decoding via OpenCORE libraries
-- DPX image decoder
-- Electronic Arts Madcow decoder
-- DivX (XSUB) subtitle encoder
-- nonfree libamr support for AMR-NB/WB decoding/encoding removed
-- experimental AAC encoder
-- RTP depacketization of ASF and RTSP from WMS servers
-- RTMP support in libavformat
-- noX handling for OPT_BOOL X options
-- Wave64 demuxer
-- IEC-61937 compatible Muxer
-- TwinVQ decoder
-- Bluray (PGS) subtitle decoder
-- LPCM support in MPEG-TS (HDMV RID as found on Blu-ray disks)
-- WMA Pro decoder
-- Core Audio Format demuxer
-- ATRAC1 decoder
-- MD STUDIO audio demuxer
-- RF64 support in WAV demuxer
-- MPEG-4 Audio Lossless Coding (ALS) decoder
-- -formats option split into -formats, -codecs, -bsfs, and -protocols
-- IV8 demuxer
-- CDG demuxer and decoder
-- R210 decoder
-- Auravision Aura 1 and 2 decoders
-- Deluxe Paint Animation playback system
-- SIPR decoder
-- Adobe Filmstrip muxer and demuxer
-- RTP depacketization of H.263
-- Bink demuxer and audio/video decoders
-- enable symbol versioning by default for linkers that support it
-- IFF PBM/ILBM bitmap decoder
-- concat protocol
-- Indeo 5 decoder
-- RTP depacketization of AMR
-- WMA Voice decoder
-- ffprobe tool
-- AMR-NB decoder
-- RTSP muxer
-- HE-AAC v1 decoder
-- Kega Game Video (KGV1) decoder
-- VorbisComment writing for FLAC, Ogg FLAC and Ogg Speex files
-- RTP depacketization of Theora
-- HTTP Digest authentication
-- RTMP/RTMPT/RTMPS/RTMPE/RTMPTE protocol support via librtmp
-- Psygnosis YOP demuxer and video decoder
-- spectral extension support in the E-AC-3 decoder
-- unsharp video filter
-- RTP hinting in the mov/3gp/mp4 muxer
-- Dirac in Ogg demuxing
-- seek to keyframes in Ogg
-- 4:2:2 and 4:4:4 Theora decoding
-- 35% faster VP3/Theora decoding
-- faster AAC decoding
-- faster H.264 decoding
-- RealAudio 1.0 (14.4K) encoder
-
-
-version 0.5:
-
-- DV50 AKA DVCPRO50 encoder, decoder, muxer and demuxer
-- TechSmith Camtasia (TSCC) video decoder
-- IBM Ultimotion (ULTI) video decoder
-- Sierra Online audio file demuxer and decoder
-- Apple QuickDraw (qdrw) video decoder
-- Creative ADPCM audio decoder (16 bits as well as 8 bits schemes)
-- Electronic Arts Multimedia (WVE/UV2/etc.) file demuxer
-- Miro VideoXL (VIXL) video decoder
-- H.261 video encoder
-- QPEG video decoder
-- Nullsoft Video (NSV) file demuxer
-- Shorten audio decoder
-- LOCO video decoder
-- Apple Lossless Audio Codec (ALAC) decoder
-- Winnov WNV1 video decoder
-- Autodesk Animator Studio Codec (AASC) decoder
-- Indeo 2 video decoder
-- Fraps FPS1 video decoder
-- Snow video encoder/decoder
-- Sonic audio encoder/decoder
-- Vorbis audio decoder
-- Macromedia ADPCM decoder
-- Duck TrueMotion 2 video decoder
-- support for decoding FLX and DTA extensions in FLIC files
-- H.264 custom quantization matrices support
-- ffserver fixed, it should now be usable again
-- QDM2 audio decoder
-- Real Cooker audio decoder
-- TrueSpeech audio decoder
-- WMA2 audio decoder fixed, now all files should play correctly
-- RealAudio 14.4 and 28.8 decoders fixed
-- JPEG-LS decoder
-- build system improvements
-- tabs and trailing whitespace removed from the codebase
-- CamStudio video decoder
-- AIFF/AIFF-C audio format, encoding and decoding
-- ADTS AAC file reading and writing
-- Creative VOC file reading and writing
-- American Laser Games multimedia (*.mm) playback system
-- Zip Motion Blocks Video decoder
-- improved Theora/VP3 decoder
-- True Audio (TTA) decoder
-- AVS demuxer and video decoder
-- JPEG-LS encoder
-- Smacker demuxer and decoder
-- NuppelVideo/MythTV demuxer and RTjpeg decoder
-- KMVC decoder
-- MPEG-2 intra VLC support
-- MPEG-2 4:2:2 encoder
-- Flash Screen Video decoder
-- GXF demuxer
-- Chinese AVS decoder
-- GXF muxer
-- MXF demuxer
-- VC-1/WMV3/WMV9 video decoder
-- MacIntel support
-- AviSynth support
-- VMware video decoder
-- VP5 video decoder
-- VP6 video decoder
-- WavPack lossless audio decoder
-- Targa (.TGA) picture decoder
-- Vorbis audio encoder
-- Delphine Software .cin demuxer/audio and video decoder
-- Tiertex .seq demuxer/video decoder
-- MTV demuxer
-- TIFF picture encoder and decoder
-- GIF picture decoder
-- Intel Music Coder decoder
-- Zip Motion Blocks Video encoder
-- Musepack decoder
-- Flash Screen Video encoder
-- Theora encoding via libtheora
-- BMP encoder
-- WMA encoder
-- GSM-MS encoder and decoder
-- DCA decoder
-- DXA demuxer and decoder
-- DNxHD decoder
-- Gamecube movie (.THP) playback system
-- Blackfin optimizations
-- Interplay C93 demuxer and video decoder
-- Bethsoft VID demuxer and video decoder
-- CRYO APC demuxer
-- ATRAC3 decoder
-- V.Flash PTX decoder
-- RoQ muxer, RoQ audio encoder
-- Renderware TXD demuxer and decoder
-- extern C declarations for C++ removed from headers
-- sws_flags command line option
-- codebook generator
-- RoQ video encoder
-- QTRLE encoder
-- OS/2 support removed and restored again
-- AC-3 decoder
-- NUT muxer
-- additional SPARC (VIS) optimizations
-- Matroska muxer
-- slice-based parallel H.264 decoding
-- Monkey's Audio demuxer and decoder
-- AMV audio and video decoder
-- DNxHD encoder
-- H.264 PAFF decoding
-- Nellymoser ASAO decoder
-- Beam Software SIFF demuxer and decoder
-- libvorbis Vorbis decoding removed in favor of native decoder
-- IntraX8 (J-Frame) subdecoder for WMV2 and VC-1
-- Ogg (Theora, Vorbis and FLAC) muxer
-- The "device" muxers and demuxers are now in a new libavdevice library
-- PC Paintbrush PCX decoder
-- Sun Rasterfile decoder
-- TechnoTrend PVA demuxer
-- Linux Media Labs MPEG-4 (LMLM4) demuxer
-- AVM2 (Flash 9) SWF muxer
-- QT variant of IMA ADPCM encoder
-- VFW grabber
-- iPod/iPhone compatible mp4 muxer
-- Mimic decoder
-- MSN TCP Webcam stream demuxer
-- RL2 demuxer / decoder
-- IFF demuxer
-- 8SVX audio decoder
-- non-recursive Makefiles
-- BFI demuxer
-- MAXIS EA XA (.xa) demuxer / decoder
-- BFI video decoder
-- OMA demuxer
-- MLP/TrueHD decoder
-- Electronic Arts CMV decoder
-- Motion Pixels Video decoder
-- Motion Pixels MVI demuxer
-- removed animated GIF decoder/demuxer
-- D-Cinema audio muxer
-- Electronic Arts TGV decoder
-- Apple Lossless Audio Codec (ALAC) encoder
-- AAC decoder
-- floating point PCM encoder/decoder
-- MXF muxer
-- DV100 AKA DVCPRO HD decoder and demuxer
-- E-AC-3 support added to AC-3 decoder
-- Nellymoser ASAO encoder
-- ASS and SSA demuxer and muxer
-- liba52 wrapper removed
-- SVQ3 watermark decoding support
-- Speex decoding via libspeex
-- Electronic Arts TGQ decoder
-- RV40 decoder
-- QCELP / PureVoice decoder
-- RV30 decoder
-- hybrid WavPack support
-- R3D REDCODE demuxer
-- ALSA support for playback and record
-- Electronic Arts TQI decoder
-- OpenJPEG based JPEG 2000 decoder
-- NC (NC4600) camera file demuxer
-- Gopher client support
-- MXF D-10 muxer
-- generic metadata API
-- flash ScreenVideo2 encoder
-
-
-version 0.4.9-pre1:
-
-- DV encoder, DV muxer
-- Microsoft RLE video decoder
-- Microsoft Video-1 decoder
-- Apple Animation (RLE) decoder
-- Apple Graphics (SMC) decoder
-- Apple Video (RPZA) decoder
-- Cinepak decoder
-- Sega FILM (CPK) file demuxer
-- Westwood multimedia support (VQA & AUD files)
-- Id Quake II CIN playback support
-- 8BPS video decoder
-- FLIC playback support
-- RealVideo 2.0 (RV20) decoder
-- Duck TrueMotion v1 (DUCK) video decoder
-- Sierra VMD demuxer and video decoder
-- MSZH and ZLIB decoder support
-- SVQ1 video encoder
-- AMR-WB support
-- PPC optimizations
-- rate distortion optimal cbp support
-- rate distorted optimal ac prediction for MPEG-4
-- rate distorted optimal lambda->qp support
-- AAC encoding with libfaac
-- Sunplus JPEG codec (SP5X) support
-- use Lagrange multipler instead of QP for ratecontrol
-- Theora/VP3 decoding support
-- XA and ADX ADPCM codecs
-- export MPEG-2 active display area / pan scan
-- Add support for configuring with IBM XLC
-- floating point AAN DCT
-- initial support for zygo video (not complete)
-- RGB ffv1 support
-- new audio/video parser API
-- av_log() system
-- av_read_frame() and av_seek_frame() support
-- missing last frame fixes
-- seek by mouse in ffplay
-- noise reduction of DCT coefficients
-- H.263 OBMC & 4MV support
-- H.263 alternative inter vlc support
-- H.263 loop filter
-- H.263 slice structured mode
-- interlaced DCT support for MPEG-2 encoding
-- stuffing to stay above min_bitrate
-- MB type & QP visualization
-- frame stepping for ffplay
-- interlaced motion estimation
-- alternate scantable support
-- SVCD scan offset support
-- closed GOP support
-- SSE2 FDCT
-- quantizer noise shaping
-- G.726 ADPCM audio codec
-- MS ADPCM encoding
-- multithreaded/SMP motion estimation
-- multithreaded/SMP encoding for MPEG-1/MPEG-2/MPEG-4/H.263
-- multithreaded/SMP decoding for MPEG-2
-- FLAC decoder
-- Metrowerks CodeWarrior suppport
-- H.263+ custom pcf support
-- nicer output for 'ffmpeg -formats'
-- Matroska demuxer
-- SGI image format, encoding and decoding
-- H.264 loop filter support
-- H.264 CABAC support
-- nicer looking arrows for the motion vector visualization
-- improved VCD support
-- audio timestamp drift compensation
-- MPEG-2 YUV 422/444 support
-- polyphase kaiser windowed sinc and blackman nuttall windowed sinc audio resample
-- better image scaling
-- H.261 support
-- correctly interleave packets during encoding
-- VIS optimized motion compensation
-- intra_dc_precision>0 encoding support
-- support reuse of motion vectors/MB types/field select values of the source video
-- more accurate deblock filter
-- padding support
-- many optimizations and bugfixes
-- FunCom ISS audio file demuxer and according ADPCM decoding
-
-
-version 0.4.8:
-
-- MPEG-2 video encoding (Michael)
-- Id RoQ playback subsystem (Mike Melanson and Tim Ferguson)
-- Wing Commander III Movie (.mve) file playback subsystem (Mike Melanson
- and Mario Brito)
-- Xan DPCM audio decoder (Mario Brito)
-- Interplay MVE playback subsystem (Mike Melanson)
-- Duck DK3 and DK4 ADPCM audio decoders (Mike Melanson)
-
-
-version 0.4.7:
-
-- RealAudio 1.0 (14_4) and 2.0 (28_8) native decoders. Author unknown, code from mplayerhq
- (originally from public domain player for Amiga at http://www.honeypot.net/audio)
-- current version now also compiles with older GCC (Fabrice)
-- 4X multimedia playback system including 4xm file demuxer (Mike
- Melanson), and 4X video and audio codecs (Michael)
-- Creative YUV (CYUV) decoder (Mike Melanson)
-- FFV1 codec (our very simple lossless intra only codec, compresses much better
- than HuffYUV) (Michael)
-- ASV1 (Asus), H.264, Intel indeo3 codecs have been added (various)
-- tiny PNG encoder and decoder, tiny GIF decoder, PAM decoder (PPM with
- alpha support), JPEG YUV colorspace support. (Fabrice Bellard)
-- ffplay has been replaced with a newer version which uses SDL (optionally)
- for multiplatform support (Fabrice)
-- Sorenson Version 3 codec (SVQ3) support has been added (decoding only) - donated
- by anonymous
-- AMR format has been added (Johannes Carlsson)
-- 3GP support has been added (Johannes Carlsson)
-- VP3 codec has been added (Mike Melanson)
-- more MPEG-1/2 fixes
-- better multiplatform support, MS Visual Studio fixes (various)
-- AltiVec optimizations (Magnus Damn and others)
-- SH4 processor support has been added (BERO)
-- new public interfaces (avcodec_get_pix_fmt) (Roman Shaposhnick)
-- VOB streaming support (Brian Foley)
-- better MP3 autodetection (Andriy Rysin)
-- qpel encoding (Michael)
-- 4mv+b frames encoding finally fixed (Michael)
-- chroma ME (Michael)
-- 5 comparison functions for ME (Michael)
-- B-frame encoding speedup (Michael)
-- WMV2 codec (unfinished - Michael)
-- user specified diamond size for EPZS (Michael)
-- Playstation STR playback subsystem, still experimental (Mike and Michael)
-- ASV2 codec (Michael)
-- CLJR decoder (Alex)
-
-.. And lots more new enhancements and fixes.
-
-
-version 0.4.6:
-
-- completely new integer only MPEG audio layer 1/2/3 decoder rewritten
- from scratch
-- Recoded DCT and motion vector search with gcc (no longer depends on nasm)
-- fix quantization bug in AC3 encoder
-- added PCM codecs and format. Corrected WAV/AVI/ASF PCM issues
-- added prototype ffplay program
-- added GOB header parsing on H.263/H.263+ decoder (Juanjo)
-- bug fix on MCBPC tables of H.263 (Juanjo)
-- bug fix on DC coefficients of H.263 (Juanjo)
-- added Advanced Prediction Mode on H.263/H.263+ decoder (Juanjo)
-- now we can decode H.263 streams found in QuickTime files (Juanjo)
-- now we can decode H.263 streams found in VIVO v1 files(Juanjo)
-- preliminary RTP "friendly" mode for H.263/H.263+ coding. (Juanjo)
-- added GOB header for H.263/H.263+ coding on RTP mode (Juanjo)
-- now H.263 picture size is returned on the first decoded frame (Juanjo)
-- added first regression tests
-- added MPEG-2 TS demuxer
-- new demux API for libav
-- more accurate and faster IDCT (Michael)
-- faster and entropy-controlled motion search (Michael)
-- two pass video encoding (Michael)
-- new video rate control (Michael)
-- added MSMPEG4V1, MSMPEGV2 and WMV1 support (Michael)
-- great performance improvement of video encoders and decoders (Michael)
-- new and faster bit readers and vlc parsers (Michael)
-- high quality encoding mode: tries all macroblock/VLC types (Michael)
-- added DV video decoder
-- preliminary RTP/RTSP support in ffserver and libavformat
-- H.263+ AIC decoding/encoding support (Juanjo)
-- VCD MPEG-PS mode (Juanjo)
-- PSNR stuff (Juanjo)
-- simple stats output (Juanjo)
-- 16-bit and 15-bit RGB/BGR/GBR support (Bisqwit)
-
-
-version 0.4.5:
-
-- some header fixes (Zdenek Kabelac <kabi at informatics.muni.cz>)
-- many MMX optimizations (Nick Kurshev <nickols_k at mail.ru>)
-- added configure system (actually a small shell script)
-- added MPEG audio layer 1/2/3 decoding using LGPL'ed mpglib by
- Michael Hipp (temporary solution - waiting for integer only
- decoder)
-- fixed VIDIOCSYNC interrupt
-- added Intel H.263 decoding support ('I263' AVI fourCC)
-- added Real Video 1.0 decoding (needs further testing)
-- simplified image formats again. Added PGM format (=grey
- pgm). Renamed old PGM to PGMYUV.
-- fixed msmpeg4 slice issues (tell me if you still find problems)
-- fixed OpenDivX bugs with newer versions (added VOL header decoding)
-- added support for MPlayer interface
-- added macroblock skip optimization
-- added MJPEG decoder
-- added mmx/mmxext IDCT from libmpeg2
-- added pgmyuvpipe, ppm, and ppm_pipe formats (original patch by Celer
- <celer at shell.scrypt.net>)
-- added pixel format conversion layer (e.g. for MJPEG or PPM)
-- added deinterlacing option
-- MPEG-1/2 fixes
-- MPEG-4 vol header fixes (Jonathan Marsden <snmjbm at pacbell.net>)
-- ARM optimizations (Lionel Ulmer <lionel.ulmer at free.fr>).
-- Windows porting of file converter
-- added MJPEG raw format (input/output)
-- added JPEG image format support (input/output)
-
-
-version 0.4.4:
-
-- fixed some std header definitions (Bjorn Lindgren
- <bjorn.e.lindgren at telia.com>).
-- added MPEG demuxer (MPEG-1 and 2 compatible).
-- added ASF demuxer
-- added prototype RM demuxer
-- added AC3 decoding (done with libac3 by Aaron Holtzman)
-- added decoding codec parameter guessing (.e.g. for MPEG, because the
- header does not include them)
-- fixed header generation in MPEG-1, AVI and ASF muxer: wmplayer can now
- play them (only tested video)
-- fixed H.263 white bug
-- fixed phase rounding in img resample filter
-- add MMX code for polyphase img resample filter
-- added CPU autodetection
-- added generic title/author/copyright/comment string handling (ASF and RM
- use them)
-- added SWF demux to extract MP3 track (not usable yet because no MP3
- decoder)
-- added fractional frame rate support
-- codecs are no longer searched by read_header() (should fix ffserver
- segfault)
-
-
-version 0.4.3:
-
-- BGR24 patch (initial patch by Jeroen Vreeken <pe1rxq at amsat.org>)
-- fixed raw yuv output
-- added motion rounding support in MPEG-4
-- fixed motion bug rounding in MSMPEG4
-- added B-frame handling in video core
-- added full MPEG-1 decoding support
-- added partial (frame only) MPEG-2 support
-- changed the FOURCC code for H.263 to "U263" to be able to see the
- +AVI/H.263 file with the UB Video H.263+ decoder. MPlayer works with
- this +codec ;) (JuanJo).
-- Halfpel motion estimation after MB type selection (JuanJo)
-- added pgm and .Y.U.V output format
-- suppressed 'img:' protocol. Simply use: /tmp/test%d.[pgm|Y] as input or
- output.
-- added pgmpipe I/O format (original patch from Martin Aumueller
- <lists at reserv.at>, but changed completely since we use a format
- instead of a protocol)
-
-
-version 0.4.2:
-
-- added H.263/MPEG-4/MSMPEG4 decoding support. MPEG-4 decoding support
- (for OpenDivX) is almost complete: 8x8 MVs and rounding are
- missing. MSMPEG4 support is complete.
-- added prototype MPEG-1 decoder. Only I- and P-frames handled yet (it
- can decode ffmpeg MPEGs :-)).
-- added libavcodec API documentation (see apiexample.c).
-- fixed image polyphase bug (the bottom of some images could be
- greenish)
-- added support for non clipped motion vectors (decoding only)
- and image sizes non-multiple of 16
-- added support for AC prediction (decoding only)
-- added file overwrite confirmation (can be disabled with -y)
-- added custom size picture to H.263 using H.263+ (Juanjo)
-
-
-version 0.4.1:
-
-- added MSMPEG4 (aka DivX) compatible encoder. Changed default codec
- of AVI and ASF to DIV3.
-- added -me option to set motion estimation method
- (default=log). suppressed redundant -hq option.
-- added options -acodec and -vcodec to force a given codec (useful for
- AVI for example)
-- fixed -an option
-- improved dct_quantize speed
-- factorized some motion estimation code
-
-
-version 0.4.0:
-
-- removing grab code from ffserver and moved it to ffmpeg. Added
- multistream support to ffmpeg.
-- added timeshifting support for live feeds (option ?date=xxx in the
- URL)
-- added high quality image resize code with polyphase filter (need
- mmx/see optimization). Enable multiple image size support in ffserver.
-- added multi live feed support in ffserver
-- suppressed master feature from ffserver (it should be done with an
- external program which opens the .ffm url and writes it to another
- ffserver)
-- added preliminary support for video stream parsing (WAV and AVI half
- done). Added proper support for audio/video file conversion in
- ffmpeg.
-- added preliminary support for video file sending from ffserver
-- redesigning I/O subsystem: now using URL based input and output
- (see avio.h)
-- added WAV format support
-- added "tty user interface" to ffmpeg to stop grabbing gracefully
-- added MMX/SSE optimizations to SAD (Sums of Absolutes Differences)
- (Juan J. Sierralta P. a.k.a. "Juanjo" <juanjo at atmlab.utfsm.cl>)
-- added MMX DCT from mpeg2_movie 1.5 (Juanjo)
-- added new motion estimation algorithms, log and phods (Juanjo)
-- changed directories: libav for format handling, libavcodec for
- codecs
-
-
-version 0.3.4:
-
-- added stereo in MPEG audio encoder
-
-
-version 0.3.3:
-
-- added 'high quality' mode which use motion vectors. It can be used in
- real time at low resolution.
-- fixed rounding problems which caused quality problems at high
- bitrates and large GOP size
-
-
-version 0.3.2: small fixes
-
-- ASF fixes
-- put_seek bug fix
-
-
-version 0.3.1: added avi/divx support
-
-- added AVI support
-- added MPEG-4 codec compatible with OpenDivX. It is based on the H.263 codec
-- added sound for flash format (not tested)
-
-
-version 0.3: initial public release
diff --git a/media/ffvpx/FILES b/media/ffvpx/FILES
new file mode 100644
index 0000000000..ff8a2da437
--- /dev/null
+++ b/media/ffvpx/FILES
@@ -0,0 +1,282 @@
+./COPYING.LGPLv2.1
+./COPYING.LGPLv3
+./compat/va_copy.h
+./compat/w32pthreads.h
+./compat/atomics/win32/stdatomic.h
+./libavcodec/audioconvert.c
+./libavcodec/audioconvert.h
+./libavcodec/avpicture.c
+./libavcodec/bit_depth_template.c
+./libavcodec/fdctdsp.h
+./libavcodec/flacdata.c
+./libavcodec/flacdata.h
+./libavcodec/flacdsp_lpc_template.c
+./libavcodec/frame_thread_encoder.h
+./libavcodec/golomb.c
+./libavcodec/h263dsp.h
+./libavcodec/h264pred.c
+./libavcodec/h264pred.h
+./libavcodec/h264pred_template.c
+./libavcodec/log2_tab.c
+./libavcodec/mathtables.c
+./libavcodec/motion_est.h
+./libavcodec/mpeg12data.h
+./libavcodec/mpegpicture.h
+./libavcodec/mpegutils.h
+./libavcodec/mpegvideodsp.h
+./libavcodec/mpegvideoencdsp.h
+./libavcodec/parser.h
+./libavcodec/profiles.c
+./libavcodec/profiles.h
+./libavcodec/pthread.c
+./libavcodec/pthread_internal.h
+./libavcodec/qpeldsp.h
+./libavcodec/qsv_api.c
+./libavcodec/raw.h
+./libavcodec/rectangle.h
+./libavcodec/resample.c
+./libavcodec/resample2.c
+./libavcodec/reverse.c
+./libavcodec/rl.h
+./libavcodec/rnd_avg.h
+./libavcodec/unary.h
+./libavcodec/videodsp_template.c
+./libavcodec/vorbis_parser.c
+./libavcodec/vorbis_parser_internal.h
+./libavcodec/vp8data.h
+./libavcodec/vp9_parser.c
+./libavcodec/vp9dsp_10bpp.c
+./libavcodec/vp9dsp_12bpp.c
+./libavcodec/vp9dsp_8bpp.c
+./libavcodec/x86/constants.c
+./libavcodec/x86/flacdsp.asm
+./libavcodec/x86/mathops.h
+./libavcodec/x86/vp56_arith.h
+./libavcodec/x86/vp9dsp_init.h
+./libavcodec/x86/vp9dsp_init_10bpp.c
+./libavcodec/x86/vp9dsp_init_12bpp.c
+./libavcodec/x86/vp9intrapred.asm
+./libavcodec/x86/vp9itxfm_16bpp.asm
+./libavcodec/x86/vp9itxfm_template.asm
+./libavcodec/x86/vp9mc_16bpp.asm
+./libavcodec/x86/vp9lpf.asm
+./libavcodec/x86/vp9lpf_16bpp.asm
+./libavcodec/x86/constants.h
+./libavcodec/x86/flacdsp_init.c
+./libavcodec/x86/h264_intrapred.asm
+./libavcodec/x86/h264_intrapred_10bit.asm
+./libavcodec/x86/h264_intrapred_init.c
+./libavcodec/x86/videodsp.asm
+./libavcodec/x86/videodsp_init.c
+./libavcodec/x86/vp8dsp.asm
+./libavcodec/x86/vp8dsp_init.c
+./libavcodec/x86/vp8dsp_loopfilter.asm
+./libavcodec/x86/vp9dsp_init.c
+./libavcodec/x86/vp9dsp_init_16bpp.c
+./libavcodec/x86/vp9dsp_init_16bpp_template.c
+./libavcodec/x86/vp9intrapred_16bpp.asm
+./libavcodec/x86/vp9itxfm.asm
+./libavcodec/x86/vp9mc.asm
+./libavcodec/xiph.c
+./libavcodec/xiph.h
+./libavcodec/bsf.h
+./libavcodec/h264dsp.h
+./libavcodec/imgconvert.c
+./libavcodec/bsf.c
+./libavcodec/decode.c
+./libavcodec/decode.h
+./libavcodec/hwaccel.h
+./libavcodec/vp9block.c
+./libavcodec/vp9data.c
+./libavcodec/vp9dec.h
+./libavcodec/vp9lpf.c
+./libavcodec/vp9mvs.c
+./libavcodec/vp9prob.c
+./libavcodec/vp9recon.c
+./libavcodec/vp9shared.h
+./libavcodec/allcodecs.c
+./libavcodec/avcodec.h
+./libavcodec/avpacket.c
+./libavcodec/bitstream.c
+./libavcodec/blockdsp.h
+./libavcodec/bytestream.h
+./libavcodec/codec_desc.c
+./libavcodec/error_resilience.h
+./libavcodec/flac.c
+./libavcodec/flac.h
+./libavcodec/flac_parser.c
+./libavcodec/flacdec.c
+./libavcodec/flacdsp.c
+./libavcodec/flacdsp.h
+./libavcodec/flacdsp_template.c
+./libavcodec/get_bits.h
+./libavcodec/golomb.h
+./libavcodec/h264chroma.h
+./libavcodec/hpeldsp.h
+./libavcodec/idctdsp.h
+./libavcodec/internal.h
+./libavcodec/mathops.h
+./libavcodec/me_cmp.h
+./libavcodec/mpegvideo.h
+./libavcodec/options.c
+./libavcodec/options_table.h
+./libavcodec/parser.c
+./libavcodec/pixblockdsp.h
+./libavcodec/pthread_frame.c
+./libavcodec/pthread_slice.c
+./libavcodec/put_bits.h
+./libavcodec/ratecontrol.h
+./libavcodec/raw.c
+./libavcodec/thread.h
+./libavcodec/utils.c
+./libavcodec/version.h
+./libavcodec/videodsp.c
+./libavcodec/videodsp.h
+./libavcodec/vlc.h
+./libavcodec/vorbis_parser.h
+./libavcodec/vp3dsp.h
+./libavcodec/vp56.h
+./libavcodec/vp56dsp.h
+./libavcodec/vp56rac.c
+./libavcodec/vp8.c
+./libavcodec/vp8.h
+./libavcodec/vp8_parser.c
+./libavcodec/vp8dsp.c
+./libavcodec/vp8dsp.h
+./libavcodec/vp9.c
+./libavcodec/vp9.h
+./libavcodec/vp9_mc_template.c
+./libavcodec/vp9data.h
+./libavcodec/vp9dsp.c
+./libavcodec/vp9dsp.h
+./libavcodec/vp9dsp_template.c
+./libavcodec/bitstream_filters.c
+./libavcodec/bitstream_filter.c
+./libavcodec/bsf_list.c
+./libavcodec/null_bsf.c
+./libavutil/adler32.c
+./libavutil/atomic.c
+./libavutil/atomic.h
+./libavutil/atomic_win32.h
+./libavutil/avutilres.rc
+./libavutil/base64.c
+./libavutil/base64.h
+./libavutil/bprint.c
+./libavutil/bprint.h
+./libavutil/bswap.h
+./libavutil/color_utils.c
+./libavutil/color_utils.h
+./libavutil/colorspace.h
+./libavutil/common.h
+./libavutil/crc.c
+./libavutil/dict.h
+./libavutil/error.c
+./libavutil/error.h
+./libavutil/eval.h
+./libavutil/ffmath.h
+./libavutil/ffversion.h
+./libavutil/fifo.c
+./libavutil/fifo.h
+./libavutil/fixed_dsp.c
+./libavutil/fixed_dsp.h
+./libavutil/integer.c
+./libavutil/integer.h
+./libavutil/intfloat.h
+./libavutil/intmath.c
+./libavutil/intmath.h
+./libavutil/libm.h
+./libavutil/lls.c
+./libavutil/lls.h
+./libavutil/log2_tab.c
+./libavutil/macros.h
+./libavutil/mem_internal.h
+./libavutil/parseutils.h
+./libavutil/pixelutils.c
+./libavutil/pixelutils.h
+./libavutil/qsort.h
+./libavutil/rational.c
+./libavutil/replaygain.h
+./libavutil/reverse.c
+./libavutil/threadmessage.h
+./libavutil/time_internal.h
+./libavutil/x86/bswap.h
+./libavutil/x86/cpuid.asm
+./libavutil/x86/fixed_dsp.asm
+./libavutil/x86/fixed_dsp_init.c
+./libavutil/x86/intmath.h
+./libavutil/x86/intreadwrite.h
+./libavutil/x86/lls.asm
+./libavutil/x86/lls_init.c
+./libavutil/x86/pixelutils.asm
+./libavutil/x86/pixelutils.h
+./libavutil/x86/pixelutils_init.c
+./libavutil/x86/timer.h
+./libavutil/x86/asm.h
+./libavutil/x86/imgutils.asm
+./libavutil/x86/imgutils_init.c
+./libavutil/x86/cpu.c
+./libavutil/x86/cpu.h
+./libavutil/x86/emms.asm
+./libavutil/x86/emms.h
+./libavutil/x86/float_dsp.asm
+./libavutil/x86/float_dsp_init.c
+./libavutil/x86/x86inc.asm
+./libavutil/x86/x86util.asm
+./libavutil/adler32.h
+./libavutil/avassert.h
+./libavutil/avconfig.h
+./libavutil/crc.h
+./libavutil/dict.c
+./libavutil/dynarray.h
+./libavutil/log.h
+./libavutil/mathematics.h
+./libavutil/rational.h
+./libavutil/samplefmt.c
+./libavutil/samplefmt.h
+./libavutil/timestamp.h
+./libavutil/opt.c
+./libavutil/imgutils_internal.h
+./libavutil/reverse.h
+./libavutil/slicethread.c
+./libavutil/slicethread.h
+./libavutil/atomic_gcc.h
+./libavutil/attributes.h
+./libavutil/avstring.c
+./libavutil/avstring.h
+./libavutil/avutil.h
+./libavutil/buffer.c
+./libavutil/buffer.h
+./libavutil/buffer_internal.h
+./libavutil/channel_layout.c
+./libavutil/channel_layout.h
+./libavutil/cpu.c
+./libavutil/cpu.h
+./libavutil/cpu_internal.h
+./libavutil/eval.c
+./libavutil/float_dsp.c
+./libavutil/float_dsp.h
+./libavutil/frame.c
+./libavutil/frame.h
+./libavutil/hwcontext.h
+./libavutil/imgutils.c
+./libavutil/imgutils.h
+./libavutil/internal.h
+./libavutil/intreadwrite.h
+./libavutil/log.c
+./libavutil/mathematics.c
+./libavutil/mem.c
+./libavutil/mem.h
+./libavutil/opt.h
+./libavutil/parseutils.c
+./libavutil/pixdesc.c
+./libavutil/pixdesc.h
+./libavutil/pixfmt.h
+./libavutil/thread.h
+./libavutil/threadmessage.c
+./libavutil/time.c
+./libavutil/timecode.c
+./libavutil/timecode.h
+./libavutil/timer.h
+./libavutil/utils.c
+./libavutil/version.h
+
diff --git a/media/ffvpx/INSTALL.md b/media/ffvpx/INSTALL.md
deleted file mode 100644
index 5db912231c..0000000000
--- a/media/ffvpx/INSTALL.md
+++ /dev/null
@@ -1,17 +0,0 @@
-#Installing FFmpeg:
-
-1. Type `./configure` to create the configuration. A list of configure
-options is printed by running `configure --help`.
-
- `configure` can be launched from a directory different from the FFmpeg
-sources to build the objects out of tree. To do this, use an absolute
-path when launching `configure`, e.g. `/ffmpegdir/ffmpeg/configure`.
-
-2. Then type `make` to build FFmpeg. GNU Make 3.81 or later is required.
-
-3. Type `make install` to install all binaries and libraries you built.
-
-NOTICE
-------
-
- - Non system dependencies (e.g. libx264, libvpx) are disabled by default.
diff --git a/media/ffvpx/LICENSE.md b/media/ffvpx/LICENSE.md
deleted file mode 100644
index 0c53d0f5a9..0000000000
--- a/media/ffvpx/LICENSE.md
+++ /dev/null
@@ -1,114 +0,0 @@
-#FFmpeg:
-
-Most files in FFmpeg are under the GNU Lesser General Public License version 2.1
-or later (LGPL v2.1+). Read the file `COPYING.LGPLv2.1` for details. Some other
-files have MIT/X11/BSD-style licenses. In combination the LGPL v2.1+ applies to
-FFmpeg.
-
-Some optional parts of FFmpeg are licensed under the GNU General Public License
-version 2 or later (GPL v2+). See the file `COPYING.GPLv2` for details. None of
-these parts are used by default, you have to explicitly pass `--enable-gpl` to
-configure to activate them. In this case, FFmpeg's license changes to GPL v2+.
-
-Specifically, the GPL parts of FFmpeg are:
-
-- libpostproc
-- optional x86 optimizations in the files
- - `libavcodec/x86/flac_dsp_gpl.asm`
- - `libavcodec/x86/idct_mmx.c`
- - `libavfilter/x86/vf_removegrain.asm`
-- libutvideo encoding/decoding wrappers in
- `libavcodec/libutvideo*.cpp`
-- the X11 grabber in `libavdevice/x11grab.c`
-- the swresample test app in
- `libswresample/swresample-test.c`
-- the `texi2pod.pl` tool
-- the following filters in libavfilter:
- - `f_ebur128.c`
- - `vf_blackframe.c`
- - `vf_boxblur.c`
- - `vf_colormatrix.c`
- - `vf_cover_rect.c`
- - `vf_cropdetect.c`
- - `vf_delogo.c`
- - `vf_eq.c`
- - `vf_find_rect.c`
- - `vf_fspp.c`
- - `vf_geq.c`
- - `vf_histeq.c`
- - `vf_hqdn3d.c`
- - `vf_interlace.c`
- - `vf_kerndeint.c`
- - `vf_mcdeint.c`
- - `vf_mpdecimate.c`
- - `vf_owdenoise.c`
- - `vf_perspective.c`
- - `vf_phase.c`
- - `vf_pp.c`
- - `vf_pp7.c`
- - `vf_pullup.c`
- - `vf_sab.c`
- - `vf_smartblur.c`
- - `vf_repeatfields.c`
- - `vf_spp.c`
- - `vf_stereo3d.c`
- - `vf_super2xsai.c`
- - `vf_tinterlace.c`
- - `vf_uspp.c`
- - `vsrc_mptestsrc.c`
-
-Should you, for whatever reason, prefer to use version 3 of the (L)GPL, then
-the configure parameter `--enable-version3` will activate this licensing option
-for you. Read the file `COPYING.LGPLv3` or, if you have enabled GPL parts,
-`COPYING.GPLv3` to learn the exact legal terms that apply in this case.
-
-There are a handful of files under other licensing terms, namely:
-
-* The files `libavcodec/jfdctfst.c`, `libavcodec/jfdctint_template.c` and
- `libavcodec/jrevdct.c` are taken from libjpeg, see the top of the files for
- licensing details. Specifically note that you must credit the IJG in the
- documentation accompanying your program if you only distribute executables.
- You must also indicate any changes including additions and deletions to
- those three files in the documentation.
-* `tests/reference.pnm` is under the expat license.
-
-
-external libraries
-==================
-
-FFmpeg can be combined with a number of external libraries, which sometimes
-affect the licensing of binaries resulting from the combination.
-
-compatible libraries
---------------------
-
-The following libraries are under GPL:
-- frei0r
-- libcdio
-- librubberband
-- libutvideo
-- libvidstab
-- libx264
-- libx265
-- libxavs
-- libxvid
-
-When combining them with FFmpeg, FFmpeg needs to be licensed as GPL as well by
-passing `--enable-gpl` to configure.
-
-The OpenCORE and VisualOn libraries are under the Apache License 2.0. That
-license is incompatible with the LGPL v2.1 and the GPL v2, but not with
-version 3 of those licenses. So to combine these libraries with FFmpeg, the
-license version needs to be upgraded by passing `--enable-version3` to configure.
-
-incompatible libraries
-----------------------
-
-The Fraunhofer AAC library and FAAC are under licenses which
-are incompatible with the GPLv2 and v3. We do not know for certain if their
-licenses are compatible with the LGPL.
-If you wish to enable these libraries, pass `--enable-nonfree` to configure.
-But note that if you enable any of these libraries the resulting binary will
-be under a complex license mix that is more restrictive than the LGPL and that
-may result in additional obligations. It is possible that these
-restrictions cause the resulting binary to be unredistributeable.
diff --git a/media/ffvpx/MAINTAINERS b/media/ffvpx/MAINTAINERS
deleted file mode 100644
index e57150da90..0000000000
--- a/media/ffvpx/MAINTAINERS
+++ /dev/null
@@ -1,619 +0,0 @@
-FFmpeg maintainers
-==================
-
-Below is a list of the people maintaining different parts of the
-FFmpeg code.
-
-Please try to keep entries where you are the maintainer up to date!
-
-Names in () mean that the maintainer currently has no time to maintain the code.
-A (CC <address>) after the name means that the maintainer prefers to be CC-ed on
-patches and related discussions.
-
-
-Project Leader
-==============
-
- final design decisions
-
-
-Applications
-============
-
-ffmpeg:
- ffmpeg.c Michael Niedermayer
-
-ffplay:
- ffplay.c Marton Balint
-
-ffprobe:
- ffprobe.c Stefano Sabatini
-
-ffserver:
- ffserver.c Reynaldo H. Verdejo Pinochet
-
-Commandline utility code:
- cmdutils.c, cmdutils.h Michael Niedermayer
-
-QuickTime faststart:
- tools/qt-faststart.c Baptiste Coudurier
-
-
-Miscellaneous Areas
-===================
-
-documentation Stefano Sabatini, Mike Melanson, Timothy Gu, Lou Logan
-build system (configure, makefiles) Diego Biurrun, Mans Rullgard
-project server Árpád Gereöffy, Michael Niedermayer, Reimar Doeffinger, Alexander Strasser, Lou Logan
-presets Robert Swain
-metadata subsystem Aurelien Jacobs
-release management Michael Niedermayer
-
-
-Communication
-=============
-
-website Deby Barbara Lepage
-fate.ffmpeg.org Timothy Gu
-Trac bug tracker Alexander Strasser, Michael Niedermayer, Carl Eugen Hoyos, Lou Logan
-mailing lists Michael Niedermayer, Baptiste Coudurier, Lou Logan
-Google+ Paul B Mahol, Michael Niedermayer, Alexander Strasser
-Twitter Lou Logan, Reynaldo H. Verdejo Pinochet
-Launchpad Timothy Gu
-
-
-libavutil
-=========
-
-External Interfaces:
- libavutil/avutil.h Michael Niedermayer
-Internal Interfaces:
- libavutil/common.h Michael Niedermayer
-
-Other:
- aes_ctr.c, aes_ctr.h Eran Kornblau
- bprint Nicolas George
- bswap.h
- des Reimar Doeffinger
- dynarray.h Nicolas George
- eval.c, eval.h Michael Niedermayer
- float_dsp Loren Merritt
- hash Reimar Doeffinger
- intfloat* Michael Niedermayer
- integer.c, integer.h Michael Niedermayer
- lzo Reimar Doeffinger
- mathematics.c, mathematics.h Michael Niedermayer
- mem.c, mem.h Michael Niedermayer
- opencl.c, opencl.h Wei Gao
- opt.c, opt.h Michael Niedermayer
- rational.c, rational.h Michael Niedermayer
- rc4 Reimar Doeffinger
- ripemd.c, ripemd.h James Almer
- timecode Clément Bœsch
-
-
-libavcodec
-==========
-
-Generic Parts:
- External Interfaces:
- avcodec.h Michael Niedermayer
- utility code:
- utils.c Michael Niedermayer
- audio and video frame extraction:
- parser.c Michael Niedermayer
- bitstream reading:
- bitstream.c, bitstream.h Michael Niedermayer
- CABAC:
- cabac.h, cabac.c Michael Niedermayer
- codec names:
- codec_names.sh Nicolas George
- DSP utilities:
- dsputils.c, dsputils.h Michael Niedermayer
- entropy coding:
- rangecoder.c, rangecoder.h Michael Niedermayer
- lzw.* Michael Niedermayer
- floating point AAN DCT:
- faandct.c, faandct.h Michael Niedermayer
- Golomb coding:
- golomb.c, golomb.h Michael Niedermayer
- LPC:
- lpc.c, lpc.h Justin Ruggles
- motion estimation:
- motion* Michael Niedermayer
- rate control:
- ratecontrol.c Michael Niedermayer
- libxvid_rc.c Michael Niedermayer
- simple IDCT:
- simple_idct.c, simple_idct.h Michael Niedermayer
- postprocessing:
- libpostproc/* Michael Niedermayer
- table generation:
- tableprint.c, tableprint.h Reimar Doeffinger
- fixed point FFT:
- fft* Zeljko Lukac
- Text Subtitles Clément Bœsch
-
-Codecs:
- 4xm.c Michael Niedermayer
- 8bps.c Roberto Togni
- 8svx.c Jaikrishnan Menon
- aacenc*, aaccoder.c Rostislav Pehlivanov
- aasc.c Kostya Shishkov
- ac3* Justin Ruggles
- alacenc.c Jaikrishnan Menon
- alsdec.c Thilo Borgmann
- apedec.c Kostya Shishkov
- ass* Aurelien Jacobs
- asv* Michael Niedermayer
- atrac3* Benjamin Larsson
- atrac3plus* Maxim Poliakovski
- bgmc.c, bgmc.h Thilo Borgmann
- bink.c Kostya Shishkov
- binkaudio.c Peter Ross
- bmp.c Mans Rullgard, Kostya Shishkov
- cavs* Stefan Gehrer
- cdxl.c Paul B Mahol
- celp_filters.* Vitor Sessak
- cinepak.c Roberto Togni
- cinepakenc.c Rl / Aetey G.T. AB
- ccaption_dec.c Anshul Maheshwari
- cljr Alex Beregszaszi
- cllc.c Derek Buitenhuis
- cook.c, cookdata.h Benjamin Larsson
- cpia.c Stephan Hilb
- crystalhd.c Philip Langdale
- cscd.c Reimar Doeffinger
- dca.c Kostya Shishkov, Benjamin Larsson
- dirac* Rostislav Pehlivanov
- dnxhd* Baptiste Coudurier
- dpcm.c Mike Melanson
- dss_sp.c Oleksij Rempel, Michael Niedermayer
- dv.c Roman Shaposhnik
- dvbsubdec.c Anshul Maheshwari
- dxa.c Kostya Shishkov
- eacmv*, eaidct*, eat* Peter Ross
- evrc* Paul B Mahol
- exif.c, exif.h Thilo Borgmann
- ffv1* Michael Niedermayer
- ffwavesynth.c Nicolas George
- fic.c Derek Buitenhuis
- flac* Justin Ruggles
- flashsv* Benjamin Larsson
- flicvideo.c Mike Melanson
- g722.c Martin Storsjo
- g726.c Roman Shaposhnik
- gifdec.c Baptiste Coudurier
- h261* Michael Niedermayer
- h263* Michael Niedermayer
- h264* Loren Merritt, Michael Niedermayer
- hap* Tom Butterworth
- huffyuv* Michael Niedermayer, Christophe Gisquet
- idcinvideo.c Mike Melanson
- imc* Benjamin Larsson
- indeo2* Kostya Shishkov
- indeo5* Kostya Shishkov
- interplayvideo.c Mike Melanson
- ivi* Kostya Shishkov
- jacosub* Clément Bœsch
- jpeg2000* Nicolas Bertrand
- jpeg_ls.c Kostya Shishkov
- jvdec.c Peter Ross
- kmvc.c Kostya Shishkov
- lcl*.c Roberto Togni, Reimar Doeffinger
- libcelt_dec.c Nicolas George
- libdirac* David Conrad
- libgsm.c Michel Bardiaux
- libkvazaar.c Arttu Ylä-Outinen
- libopenjpeg.c Jaikrishnan Menon
- libopenjpegenc.c Michael Bradshaw
- libschroedinger* David Conrad
- libspeexdec.c Justin Ruggles
- libtheoraenc.c David Conrad
- libutvideo* Carl Eugen Hoyos
- libvorbis.c David Conrad
- libvpx* James Zern
- libx264.c Mans Rullgard, Jason Garrett-Glaser
- libx265.c Derek Buitenhuis
- libxavs.c Stefan Gehrer
- libzvbi-teletextdec.c Marton Balint
- loco.c Kostya Shishkov
- lzo.h, lzo.c Reimar Doeffinger
- mdec.c Michael Niedermayer
- mimic.c Ramiro Polla
- mjpeg*.c Michael Niedermayer
- mlp* Ramiro Polla
- mmvideo.c Peter Ross
- mpc* Kostya Shishkov
- mpeg12.c, mpeg12data.h Michael Niedermayer
- mpegvideo.c, mpegvideo.h Michael Niedermayer
- mqc* Nicolas Bertrand
- msmpeg4.c, msmpeg4data.h Michael Niedermayer
- msrle.c Mike Melanson
- msvideo1.c Mike Melanson
- nellymoserdec.c Benjamin Larsson
- nuv.c Reimar Doeffinger
- nvenc.c Timo Rothenpieler
- paf.* Paul B Mahol
- pcx.c Ivo van Poorten
- pgssubdec.c Reimar Doeffinger
- ptx.c Ivo van Poorten
- qcelp* Reynaldo H. Verdejo Pinochet
- qdm2.c, qdm2data.h Roberto Togni, Benjamin Larsson
- qdrw.c Kostya Shishkov
- qpeg.c Kostya Shishkov
- qsv* Ivan Uskov
- qtrle.c Mike Melanson
- ra144.c, ra144.h, ra288.c, ra288.h Roberto Togni
- resample2.c Michael Niedermayer
- rl2.c Sascha Sommer
- rpza.c Roberto Togni
- rtjpeg.c, rtjpeg.h Reimar Doeffinger
- rv10.c Michael Niedermayer
- rv3* Kostya Shishkov
- rv4* Kostya Shishkov, Christophe Gisquet
- s3tc* Ivo van Poorten
- smacker.c Kostya Shishkov
- smc.c Mike Melanson
- smvjpegdec.c Ash Hughes
- snow* Michael Niedermayer, Loren Merritt
- sonic.c Alex Beregszaszi
- srt* Aurelien Jacobs
- sunrast.c Ivo van Poorten
- svq3.c Michael Niedermayer
- tak* Paul B Mahol
- targa.c Kostya Shishkov
- tiff.c Kostya Shishkov
- truemotion1* Mike Melanson
- truemotion2* Kostya Shishkov
- truespeech.c Kostya Shishkov
- tscc.c Kostya Shishkov
- tta.c Alex Beregszaszi, Jaikrishnan Menon
- ttaenc.c Paul B Mahol
- txd.c Ivo van Poorten
- ulti* Kostya Shishkov
- v410*.c Derek Buitenhuis
- vb.c Kostya Shishkov
- vble.c Derek Buitenhuis
- vc1* Kostya Shishkov, Christophe Gisquet
- vc2* Rostislav Pehlivanov
- vcr1.c Michael Niedermayer
- vda_h264_dec.c Xidorn Quan
- vima.c Paul B Mahol
- vmnc.c Kostya Shishkov
- vorbisdec.c Denes Balatoni, David Conrad
- vorbisenc.c Oded Shimon
- vp3* Mike Melanson
- vp5 Aurelien Jacobs
- vp6 Aurelien Jacobs
- vp8 David Conrad, Jason Garrett-Glaser, Ronald Bultje
- vp9 Ronald Bultje, Clément Bœsch
- vqavideo.c Mike Melanson
- wavpack.c Kostya Shishkov
- wmaprodec.c Sascha Sommer
- wmavoice.c Ronald S. Bultje
- wmv2.c Michael Niedermayer
- wnv1.c Kostya Shishkov
- xan.c Mike Melanson
- xbm* Paul B Mahol
- xface Stefano Sabatini
- xl.c Kostya Shishkov
- xvmc.c Ivan Kalvachev
- xwd* Paul B Mahol
- zerocodec.c Derek Buitenhuis
- zmbv* Kostya Shishkov
-
-Hardware acceleration:
- crystalhd.c Philip Langdale
- dxva2* Hendrik Leppkes, Laurent Aimar
- vaapi* Gwenole Beauchesne
- vda* Sebastien Zwickert
- vdpau* Philip Langdale, Carl Eugen Hoyos
- videotoolbox* Sebastien Zwickert
-
-
-libavdevice
-===========
- External Interface:
- libavdevice/avdevice.h
-
-
- avfoundation.m Thilo Borgmann
- decklink* Deti Fliegl
- dshow.c Roger Pack (CC rogerdpack@gmail.com)
- fbdev_enc.c Lukasz Marek
- gdigrab.c Roger Pack (CC rogerdpack@gmail.com)
- iec61883.c Georg Lippitsch
- lavfi Stefano Sabatini
- libdc1394.c Roman Shaposhnik
- opengl_enc.c Lukasz Marek
- pulse_audio_enc.c Lukasz Marek
- qtkit.m Thilo Borgmann
- sdl Stefano Sabatini
- v4l2.c Giorgio Vazzana
- vfwcap.c Ramiro Polla
- xv.c Lukasz Marek
-
-libavfilter
-===========
-
-Generic parts:
- graphdump.c Nicolas George
-
-Filters:
- f_drawgraph.c Paul B Mahol
- af_adelay.c Paul B Mahol
- af_aecho.c Paul B Mahol
- af_afade.c Paul B Mahol
- af_amerge.c Nicolas George
- af_aphaser.c Paul B Mahol
- af_aresample.c Michael Niedermayer
- af_astats.c Paul B Mahol
- af_atempo.c Pavel Koshevoy
- af_biquads.c Paul B Mahol
- af_chorus.c Paul B Mahol
- af_compand.c Paul B Mahol
- af_ladspa.c Paul B Mahol
- af_pan.c Nicolas George
- af_sidechaincompress.c Paul B Mahol
- af_silenceremove.c Paul B Mahol
- avf_aphasemeter.c Paul B Mahol
- avf_avectorscope.c Paul B Mahol
- avf_showcqt.c Muhammad Faiz
- vf_blend.c Paul B Mahol
- vf_chromakey.c Timo Rothenpieler
- vf_colorchannelmixer.c Paul B Mahol
- vf_colorbalance.c Paul B Mahol
- vf_colorkey.c Timo Rothenpieler
- vf_colorlevels.c Paul B Mahol
- vf_deband.c Paul B Mahol
- vf_dejudder.c Nicholas Robbins
- vf_delogo.c Jean Delvare (CC <jdelvare@suse.com>)
- vf_drawbox.c/drawgrid Andrey Utkin
- vf_extractplanes.c Paul B Mahol
- vf_histogram.c Paul B Mahol
- vf_hqx.c Clément Bœsch
- vf_idet.c Pascal Massimino
- vf_il.c Paul B Mahol
- vf_lenscorrection.c Daniel Oberhoff
- vf_mergeplanes.c Paul B Mahol
- vf_neighbor.c Paul B Mahol
- vf_psnr.c Paul B Mahol
- vf_random.c Paul B Mahol
- vf_scale.c Michael Niedermayer
- vf_separatefields.c Paul B Mahol
- vf_ssim.c Paul B Mahol
- vf_stereo3d.c Paul B Mahol
- vf_telecine.c Paul B Mahol
- vf_yadif.c Michael Niedermayer
- vf_zoompan.c Paul B Mahol
-
-Sources:
- vsrc_mandelbrot.c Michael Niedermayer
-
-libavformat
-===========
-
-Generic parts:
- External Interface:
- libavformat/avformat.h Michael Niedermayer
- Utility Code:
- libavformat/utils.c Michael Niedermayer
-
-
-Muxers/Demuxers:
- 4xm.c Mike Melanson
- aadec.c Vesselin Bontchev (vesselin.bontchev at yandex dot com)
- adtsenc.c Robert Swain
- afc.c Paul B Mahol
- aiffdec.c Baptiste Coudurier, Matthieu Bouron
- aiffenc.c Baptiste Coudurier, Matthieu Bouron
- ape.c Kostya Shishkov
- apngdec.c Benoit Fouet
- ass* Aurelien Jacobs
- astdec.c Paul B Mahol
- astenc.c James Almer
- avi* Michael Niedermayer
- avisynth.c AvxSynth Team (avxsynth.testing at gmail dot com)
- avr.c Paul B Mahol
- bink.c Peter Ross
- brstm.c Paul B Mahol
- caf* Peter Ross
- cdxl.c Paul B Mahol
- crc.c Michael Niedermayer
- daud.c Reimar Doeffinger
- dss.c Oleksij Rempel, Michael Niedermayer
- dtshddec.c Paul B Mahol
- dv.c Roman Shaposhnik
- dxa.c Kostya Shishkov
- electronicarts.c Peter Ross
- epafdec.c Paul B Mahol
- ffm* Baptiste Coudurier
- flac* Justin Ruggles
- flic.c Mike Melanson
- flvdec.c, flvenc.c Michael Niedermayer
- gxf.c Reimar Doeffinger
- gxfenc.c Baptiste Coudurier
- hls.c Anssi Hannula
- hls encryption (hlsenc.c) Christian Suloway
- idcin.c Mike Melanson
- idroqdec.c Mike Melanson
- iff.c Jaikrishnan Menon
- img2*.c Michael Niedermayer
- ipmovie.c Mike Melanson
- ircam* Paul B Mahol
- iss.c Stefan Gehrer
- jacosub* Clément Bœsch
- jvdec.c Peter Ross
- libmodplug.c Clément Bœsch
- libnut.c Oded Shimon
- lmlm4.c Ivo van Poorten
- lvfdec.c Paul B Mahol
- lxfdec.c Tomas Härdin
- matroska.c Aurelien Jacobs
- matroskadec.c Aurelien Jacobs
- matroskaenc.c David Conrad
- matroska subtitles (matroskaenc.c) John Peebles
- metadata* Aurelien Jacobs
- mgsts.c Paul B Mahol
- microdvd* Aurelien Jacobs
- mm.c Peter Ross
- mov.c Michael Niedermayer, Baptiste Coudurier
- movenc.c Baptiste Coudurier, Matthieu Bouron
- movenccenc.c Eran Kornblau
- mpc.c Kostya Shishkov
- mpeg.c Michael Niedermayer
- mpegenc.c Michael Niedermayer
- mpegts.c Marton Balint
- mpegtsenc.c Baptiste Coudurier
- msnwc_tcp.c Ramiro Polla
- mtv.c Reynaldo H. Verdejo Pinochet
- mxf* Baptiste Coudurier
- mxfdec.c Tomas Härdin
- nistspheredec.c Paul B Mahol
- nsvdec.c Francois Revol
- nut* Michael Niedermayer
- nuv.c Reimar Doeffinger
- oggdec.c, oggdec.h David Conrad
- oggenc.c Baptiste Coudurier
- oggparse*.c David Conrad
- oggparsedaala* Rostislav Pehlivanov
- oma.c Maxim Poliakovski
- paf.c Paul B Mahol
- psxstr.c Mike Melanson
- pva.c Ivo van Poorten
- pvfdec.c Paul B Mahol
- r3d.c Baptiste Coudurier
- raw.c Michael Niedermayer
- rdt.c Ronald S. Bultje
- rl2.c Sascha Sommer
- rmdec.c, rmenc.c Ronald S. Bultje, Kostya Shishkov
- rtmp* Kostya Shishkov
- rtp.c, rtpenc.c Martin Storsjo
- rtpdec_ac3.* Gilles Chanteperdrix
- rtpdec_dv.* Thomas Volkert
- rtpdec_h261.*, rtpenc_h261.* Thomas Volkert
- rtpdec_hevc.*, rtpenc_hevc.* Thomas Volkert
- rtpdec_mpa_robust.* Gilles Chanteperdrix
- rtpdec_asf.* Ronald S. Bultje
- rtpdec_vp9.c Thomas Volkert
- rtpenc_mpv.*, rtpenc_aac.* Martin Storsjo
- rtsp.c Luca Barbato
- sbgdec.c Nicolas George
- sdp.c Martin Storsjo
- segafilm.c Mike Melanson
- segment.c Stefano Sabatini
- siff.c Kostya Shishkov
- smacker.c Kostya Shishkov
- smjpeg* Paul B Mahol
- spdif* Anssi Hannula
- srtdec.c Aurelien Jacobs
- swf.c Baptiste Coudurier
- takdec.c Paul B Mahol
- tta.c Alex Beregszaszi
- txd.c Ivo van Poorten
- voc.c Aurelien Jacobs
- wav.c Michael Niedermayer
- wc3movie.c Mike Melanson
- webm dash (matroskaenc.c) Vignesh Venkatasubramanian
- webvtt* Matthew J Heaney
- westwood.c Mike Melanson
- wtv.c Peter Ross
- wv.c Kostya Shishkov
- wvenc.c Paul B Mahol
-
-Protocols:
- async.c Zhang Rui
- bluray.c Petri Hintukainen
- ftp.c Lukasz Marek
- http.c Ronald S. Bultje
- libssh.c Lukasz Marek
- mms*.c Ronald S. Bultje
- udp.c Luca Abeni
- icecast.c Marvin Scholz
-
-
-libswresample
-=============
-
-Generic parts:
- audioconvert.c Michael Niedermayer
- dither.c Michael Niedermayer
- rematrix*.c Michael Niedermayer
- swresample*.c Michael Niedermayer
-
-Resamplers:
- resample*.c Michael Niedermayer
- soxr_resample.c Rob Sykes
-
-
-Operating systems / CPU architectures
-=====================================
-
-Alpha Mans Rullgard, Falk Hueffner
-ARM Mans Rullgard
-AVR32 Mans Rullgard
-MIPS Mans Rullgard, Nedeljko Babic
-Mac OS X / PowerPC Romain Dolbeau, Guillaume Poirier
-Amiga / PowerPC Colin Ward
-Linux / PowerPC Luca Barbato
-Windows MinGW Alex Beregszaszi, Ramiro Polla
-Windows Cygwin Victor Paesa
-Windows MSVC Matthew Oliver, Hendrik Leppkes
-Windows ICL Matthew Oliver
-ADI/Blackfin DSP Marc Hoffman
-Sparc Roman Shaposhnik
-x86 Michael Niedermayer
-
-
-Releases
-========
-
-2.8 Michael Niedermayer
-2.7 Michael Niedermayer
-2.6 Michael Niedermayer
-2.5 Michael Niedermayer
-2.4 Michael Niedermayer
-
-If you want to maintain an older release, please contact us
-
-
-GnuPG Fingerprints of maintainers and contributors
-==================================================
-
-Alexander Strasser 1C96 78B7 83CB 8AA7 9AF5 D1EB A7D8 A57B A876 E58F
-Anssi Hannula 1A92 FF42 2DD9 8D2E 8AF7 65A9 4278 C520 513D F3CB
-Anton Khirnov 6D0C 6625 56F8 65D1 E5F5 814B B50A 1241 C067 07AB
-Ash Hughes 694D 43D2 D180 C7C7 6421 ABD3 A641 D0B7 623D 6029
-Attila Kinali 11F0 F9A6 A1D2 11F6 C745 D10C 6520 BCDD F2DF E765
-Baptiste Coudurier 8D77 134D 20CC 9220 201F C5DB 0AC9 325C 5C1A BAAA
-Ben Littler 3EE3 3723 E560 3214 A8CD 4DEB 2CDB FCE7 768C 8D2C
-Benoit Fouet B22A 4F4F 43EF 636B BB66 FCDC 0023 AE1E 2985 49C8
-Clément Bœsch 52D0 3A82 D445 F194 DB8B 2B16 87EE 2CB8 F4B8 FCF9
-Daniel Verkamp 78A6 07ED 782C 653E C628 B8B9 F0EB 8DD8 2F0E 21C7
-Diego Biurrun 8227 1E31 B6D9 4994 7427 E220 9CAE D6CC 4757 FCC5
-FFmpeg release signing key FCF9 86EA 15E6 E293 A564 4F10 B432 2F04 D676 58D8
-Ganesh Ajjanagadde C96A 848E 97C3 CEA2 AB72 5CE4 45F9 6A2D 3C36 FB1B
-Gwenole Beauchesne 2E63 B3A6 3E44 37E2 017D 2704 53C7 6266 B153 99C4
-Jaikrishnan Menon 61A1 F09F 01C9 2D45 78E1 C862 25DC 8831 AF70 D368
-Jean Delvare 7CA6 9F44 60F1 BDC4 1FD2 C858 A552 6B9B B3CD 4E6A
-Justin Ruggles 3136 ECC0 C10D 6C04 5F43 CA29 FCBE CD2A 3787 1EBF
-Loren Merritt ABD9 08F4 C920 3F65 D8BE 35D7 1540 DAA7 060F 56DE
-Lou Logan 7D68 DC73 CBEF EABB 671A B6CF 621C 2E28 82F8 DC3A
-Luca Barbato 6677 4209 213C 8843 5B67 29E7 E84C 78C2 84E9 0E34
-Michael Niedermayer 9FF2 128B 147E F673 0BAD F133 611E C787 040B 0FAB
-Nicolas George 24CE 01CE 9ACC 5CEB 74D8 8D9D B063 D997 36E5 4C93
-Panagiotis Issaris 6571 13A3 33D9 3726 F728 AA98 F643 B12E ECF3 E029
-Peter Ross A907 E02F A6E5 0CD2 34CD 20D2 6760 79C5 AC40 DD6B
-Philip Langdale 5DC5 8D66 5FBA 3A43 18EC 045E F8D6 B194 6A75 682E
-Reimar Doeffinger C61D 16E5 9E2C D10C 8958 38A4 0899 A2B9 06D4 D9C7
-Reinhard Tartler 9300 5DC2 7E87 6C37 ED7B CA9A 9808 3544 9453 48A4
-Reynaldo H. Verdejo Pinochet 6E27 CD34 170C C78E 4D4F 5F40 C18E 077F 3114 452A
-Robert Swain EE7A 56EA 4A81 A7B5 2001 A521 67FA 362D A2FC 3E71
-Sascha Sommer 38A0 F88B 868E 9D3A 97D4 D6A0 E823 706F 1E07 0D3C
-Stefano Sabatini 0D0B AD6B 5330 BBAD D3D6 6A0C 719C 2839 FC43 2D5F
-Stephan Hilb 4F38 0B3A 5F39 B99B F505 E562 8D5C 5554 4E17 8863
-Tiancheng "Timothy" Gu 9456 AFC0 814A 8139 E994 8351 7FE6 B095 B582 B0D4
-Tim Nicholson 38CF DB09 3ED0 F607 8B67 6CED 0C0B FC44 8B0B FC83
-Tomas Härdin A79D 4E3D F38F 763F 91F5 8B33 A01E 8AE0 41BB 2551
-Wei Gao 4269 7741 857A 0E60 9EC5 08D2 4744 4EFA 62C1 87B9
diff --git a/media/ffvpx/README.md b/media/ffvpx/README.md
deleted file mode 100644
index 241919193d..0000000000
--- a/media/ffvpx/README.md
+++ /dev/null
@@ -1,49 +0,0 @@
-FFmpeg README
-=============
-
-FFmpeg is a collection of libraries and tools to process multimedia content
-such as audio, video, subtitles and related metadata.
-
-## Libraries
-
-* `libavcodec` provides implementation of a wider range of codecs.
-* `libavformat` implements streaming protocols, container formats and basic I/O access.
-* `libavutil` includes hashers, decompressors and miscellaneous utility functions.
-* `libavfilter` provides a mean to alter decoded Audio and Video through chain of filters.
-* `libavdevice` provides an abstraction to access capture and playback devices.
-* `libswresample` implements audio mixing and resampling routines.
-* `libswscale` implements color conversion and scaling routines.
-
-## Tools
-
-* [ffmpeg](https://ffmpeg.org/ffmpeg.html) is a command line toolbox to
- manipulate, convert and stream multimedia content.
-* [ffplay](https://ffmpeg.org/ffplay.html) is a minimalistic multimedia player.
-* [ffprobe](https://ffmpeg.org/ffprobe.html) is a simple analysis tool to inspect
- multimedia content.
-* [ffserver](https://ffmpeg.org/ffserver.html) is a multimedia streaming server
- for live broadcasts.
-* Additional small tools such as `aviocat`, `ismindex` and `qt-faststart`.
-
-## Documentation
-
-The offline documentation is available in the **doc/** directory.
-
-The online documentation is available in the main [website](https://ffmpeg.org)
-and in the [wiki](https://trac.ffmpeg.org).
-
-### Examples
-
-Coding examples are available in the **doc/examples** directory.
-
-## License
-
-FFmpeg codebase is mainly LGPL-licensed with optional components licensed under
-GPL. Please refer to the LICENSE file for detailed information.
-
-## Contributing
-
-Patches should be submitted to the ffmpeg-devel mailing list using
-`git format-patch` or `git send-email`. Github pull requests should be
-avoided because they are not part of our review process. Few developers
-follow pull requests so they will likely be ignored.
diff --git a/media/ffvpx/README_MCP b/media/ffvpx/README_MCP
new file mode 100644
index 0000000000..4555e08da6
--- /dev/null
+++ b/media/ffvpx/README_MCP
@@ -0,0 +1,48 @@
+This directory contains files used in goanna builds from FFmpeg
+(http://ffmpeg.org). The current files are from FFmpeg as of
+Release 3.4.2
+All source files match their path from the library's source archive.
+
+Currently, we only use the vp8 and vp9 portion of the library, and only on x86
+based platforms. If this changes, configuration files will most likely
+need to be updated.
+
+AVX2 must be disabled on Linux 32 bits due to the use of yasm 1.1 on the build bots.
+Once yasm is upgraded to 1.2 or later, AVX2 code could be re-enabled.
+Add --disable-avx2 to configure on those platforms.
+
+configuration files were generated as follow using the configure script:
+./configure --disable-everything --disable-protocols --disable-demuxers --disable-muxers --disable-filters --disable-programs --disable-doc --disable-parsers --enable-parser=vp8 --enable-parser=vp9 --enable-decoder=vp8 --enable-decoder=vp9 --disable-static --enable-shared --disable-debug --disable-sdl2 --disable-libxcb --disable-securetransport --disable-iconv --disable-swresample --disable-swscale --disable-avdevice --disable-avfilter --disable-avformat --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vda --disable-vdpau --disable-videotoolbox --enable-decoder=flac --enable-asm --enable-x86asm
+
+config*:
+replace: /HAVE_(MALLOC_H|ARC4RANDOM|LOCALTIME_R|MEMALIGN|POSIX_MEMALIGN)/d
+
+config_darwin32.h:
+add to configure command: --disable-asm --disable-yasm --cc='clang -m32'
+
+config_unix32.h:
+add to configure command: --disable-asm --disable-x86asm --cc='clang -m32'
+replace: s/HAVE_SYSCTL 1/HAVE_SYSCTL 0/ and s/HAVE_MEMALIGN 1/HAVE_MEMALIGN 0/ and s/HAVE_POSIX_MEMALIGN 1/HAVE_POSIX_MEMALIGN 0/
+
+
+config_unix32.h/config_unix64.h/config_unix64.asm:
+replace: s/HAVE_SYSCTL 1/HAVE_SYSCTL 0
+
+config_win32/64.h/asm:
+add to configure command: --toolchain=msvc
+
+Regenerate defaults_disabled.{h,asm} with:
+$ grep -E ".*_(INDEV|OUTDEV|DECODER|ENCODER|DEMUXER|MUXER|PARSER|FILTER|HWACCEL|PROTOCOL|ENCODERS|DECODERS|HWACCELS|INDEVS|OUTDEVS|FILTERS|DEMUXERS|MUXERS|PROTOCOLS) 0" config.h > ~/Work/Mozilla/mozilla-central/media/ffvpx/defaults_disabled.h
+$ grep -E ".*_(INDEV|OUTDEV|DECODER|ENCODER|DEMUXER|MUXER|PARSER|FILTER|HWACCEL|PROTOCOL|ENCODERS|DECODERS|HWACCELS|INDEVS|OUTDEVS|FILTERS|DEMUXERS|MUXERS|PROTOCOLS) 0" config.asm > ~/Work/Mozilla/mozilla-central/media/ffvpx/defaults_disabled.asm
+
+All new decoders/muxers/encoders/... should be added in the list of dummy functions found in libavcodec/dummy_funcs.c
+otherwise linkage will fail on Windows. On other platforms they are optimised out and aren't necessary.
+The GNU comm utility is a useful tool to compare and extract only the changes.
+
+To update the source tree, perform a diff on the files listed in FILES.
+The diffs should typically apply to the ffvpx tree.
+e.g. something like this would do:
+Run in the ffmpeg original tree:
+$ for i in `cat $PATH_CENTRAL/media/ffvpx/FILES`; do diff $REV_LASTSYNC HEAD >> patch.diff; done
+Then apply patch.diff on the ffvpx tree.
+Compilation will reveal if any files are missing.
diff --git a/media/ffvpx/README_MOZILLA b/media/ffvpx/README_MOZILLA
deleted file mode 100644
index 7f42d0513a..0000000000
--- a/media/ffvpx/README_MOZILLA
+++ /dev/null
@@ -1,39 +0,0 @@
-This directory contains files used in goanna builds from FFmpeg
-(http://ffmpeg.org). The current files are from FFmpeg as of
-revision n3.2-65-gee56777
-All source files match their path from the library's source archive.
-
-Currently, we only use the vp8 and vp9 portion of the library, and only on x86
-based platforms. If this changes, configuration files will most likely
-need to be updated.
-
-AVX2 must be disabled on Linux due to the use of yasm 1.1 on the build bots.
-Once yasm is upgraded to 1.2 or later, AVX2 code could be re-enabled.
-Add --disable-avx2 to configure on those platforms.
-
-configuration files were generated as follow using the configure script:
-./configure --disable-everything --disable-protocols --disable-demuxers --disable-muxers --disable-filters --disable-programs --disable-doc --disable-parsers --enable-parser=vp8 --enable-parser=vp9 --enable-decoder=vp8 --enable-decoder=vp9 --disable-static --enable-shared --disable-debug --disable-sdl --disable-libxcb --disable-securetransport --disable-iconv --disable-swresample --disable-swscale --disable-avdevice --disable-avfilter --disable-avformat --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vda --disable-vdpau --disable-videotoolbox --enable-asm --enable-yasm
-
-config*:
-replace: /HAVE_(MALLOC_H|ARC4RANDOM|LOCALTIME_R|MEMALIGN|POSIX_MEMALIGN)/d
-
-config_darwin32.h:
-add to configure command: --disable-asm --disable-yasm --cc='clang -m32'
-
-config_unix32.h:
-add to configure command: --disable-asm --disable-yasm --cc='clang -m32'
-replace: s/HAVE_SYSCTL 1/HAVE_SYSCTL 0/ and s/HAVE_MEMALIGN 1/HAVE_MEMALIGN 0/ and s/HAVE_POSIX_MEMALIGN 1/HAVE_POSIX_MEMALIGN 0/
-
-
-config_unix64.h/config_unix64.asm:
-replace: s/HAVE_SYSCTL 1/HAVE_SYSCTL 0
-
-config_win32/64.h/asm:
-add to configure command: --toolchain=msvc
-
-23 Sept 2016: libavcodec/pthread_frame.c has been patched so as to avoid
-generating large numbers of warnings from TSan (Thread Sanitizer) when
-decoding vp9 streams. This will likely be fixed upstream sometime soon.
-When resyncing with upstream, first un-apply the patch shown at
-https://bugzilla.mozilla.org/show_bug.cgi?id=1274256#c60, then resync,
-then assess whether the patch is still necessary.
diff --git a/media/ffvpx/RELEASE b/media/ffvpx/RELEASE
deleted file mode 100644
index 9f55b2ccb5..0000000000
--- a/media/ffvpx/RELEASE
+++ /dev/null
@@ -1 +0,0 @@
-3.0
diff --git a/media/ffvpx/RELEASE_NOTES b/media/ffvpx/RELEASE_NOTES
deleted file mode 100644
index 861dc04a13..0000000000
--- a/media/ffvpx/RELEASE_NOTES
+++ /dev/null
@@ -1,15 +0,0 @@
-
- ┌─────────────────────────────────────────┐
- │ RELEASE NOTES for FFmpeg 3.0 "Einstein" │
- └─────────────────────────────────────────┘
-
- The FFmpeg Project proudly presents FFmpeg 3.0 "Einstein", about 5
- months after the release of FFmpeg 2.8.
-
- A complete Changelog is available at the root of the project, and the
- complete Git history on http://source.ffmpeg.org.
-
- We hope you will like this release as much as we enjoyed working on it, and
- as usual, if you have any questions about it, or any FFmpeg related topic,
- feel free to join us on the #ffmpeg IRC channel (on irc.freenode.net) or ask
- on the mailing-lists.
diff --git a/media/ffvpx/changes.patch b/media/ffvpx/changes.patch
index 9cb49afaf2..49a49b26b7 100644
--- a/media/ffvpx/changes.patch
+++ b/media/ffvpx/changes.patch
@@ -50,16 +50,3 @@ index 9fb8d0a..97ad3b9 100644
rgba_color[0] = rgba >> 24;
rgba_color[1] = rgba >> 16;
rgba_color[2] = rgba >> 8;
-diff --git a/media/ffvpx/libavcodec/options.c b/media/ffvpx/libavcodec/options.c
-index d8e3dbf..f25df2a 100644
---- a/media/ffvpx/libavcodec/options.c
-+++ b/media/ffvpx/libavcodec/options.c
-@@ -34,7 +34,7 @@
- #include <string.h>
-
- FF_DISABLE_DEPRECATION_WARNINGS
--#include "options_table.h"
-+#include "ff_options_table.h"
- FF_ENABLE_DEPRECATION_WARNINGS
-
- static const char* context_to_name(void* ptr) {
diff --git a/media/ffvpx/compat/atomics/win32/stdatomic.h b/media/ffvpx/compat/atomics/win32/stdatomic.h
new file mode 100644
index 0000000000..bb8e6e7e15
--- /dev/null
+++ b/media/ffvpx/compat/atomics/win32/stdatomic.h
@@ -0,0 +1,181 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef COMPAT_ATOMICS_WIN32_STDATOMIC_H
+#define COMPAT_ATOMICS_WIN32_STDATOMIC_H
+
+#define WIN32_LEAN_AND_MEAN
+#include <stddef.h>
+#include <stdint.h>
+#include <windows.h>
+
+#define ATOMIC_FLAG_INIT 0
+
+#define ATOMIC_VAR_INIT(value) (value)
+
+#define atomic_init(obj, value) \
+do { \
+ *(obj) = (value); \
+} while(0)
+
+#define kill_dependency(y) ((void)0)
+
+#define atomic_thread_fence(order) \
+ MemoryBarrier();
+
+#define atomic_signal_fence(order) \
+ ((void)0)
+
+#define atomic_is_lock_free(obj) 0
+
+typedef intptr_t atomic_flag;
+typedef intptr_t atomic_bool;
+typedef intptr_t atomic_char;
+typedef intptr_t atomic_schar;
+typedef intptr_t atomic_uchar;
+typedef intptr_t atomic_short;
+typedef intptr_t atomic_ushort;
+typedef intptr_t atomic_int;
+typedef intptr_t atomic_uint;
+typedef intptr_t atomic_long;
+typedef intptr_t atomic_ulong;
+typedef intptr_t atomic_llong;
+typedef intptr_t atomic_ullong;
+typedef intptr_t atomic_wchar_t;
+typedef intptr_t atomic_int_least8_t;
+typedef intptr_t atomic_uint_least8_t;
+typedef intptr_t atomic_int_least16_t;
+typedef intptr_t atomic_uint_least16_t;
+typedef intptr_t atomic_int_least32_t;
+typedef intptr_t atomic_uint_least32_t;
+typedef intptr_t atomic_int_least64_t;
+typedef intptr_t atomic_uint_least64_t;
+typedef intptr_t atomic_int_fast8_t;
+typedef intptr_t atomic_uint_fast8_t;
+typedef intptr_t atomic_int_fast16_t;
+typedef intptr_t atomic_uint_fast16_t;
+typedef intptr_t atomic_int_fast32_t;
+typedef intptr_t atomic_uint_fast32_t;
+typedef intptr_t atomic_int_fast64_t;
+typedef intptr_t atomic_uint_fast64_t;
+typedef intptr_t atomic_intptr_t;
+typedef intptr_t atomic_uintptr_t;
+typedef intptr_t atomic_size_t;
+typedef intptr_t atomic_ptrdiff_t;
+typedef intptr_t atomic_intmax_t;
+typedef intptr_t atomic_uintmax_t;
+
+#define atomic_store(object, desired) \
+do { \
+ *(object) = (desired); \
+ MemoryBarrier(); \
+} while (0)
+
+#define atomic_store_explicit(object, desired, order) \
+ atomic_store(object, desired)
+
+#define atomic_load(object) \
+ (MemoryBarrier(), *(object))
+
+#define atomic_load_explicit(object, order) \
+ atomic_load(object)
+
+#define atomic_exchange(object, desired) \
+ InterlockedExchangePointer(object, desired);
+
+#define atomic_exchange_explicit(object, desired, order) \
+ atomic_exchange(object, desired)
+
+static inline int atomic_compare_exchange_strong(intptr_t *object, intptr_t *expected,
+ intptr_t desired)
+{
+ intptr_t old = *expected;
+ *expected = (intptr_t)InterlockedCompareExchangePointer(
+ (PVOID *)object, (PVOID)desired, (PVOID)old);
+ return *expected == old;
+}
+
+#define atomic_compare_exchange_strong_explicit(object, expected, desired, success, failure) \
+ atomic_compare_exchange_strong(object, expected, desired)
+
+#define atomic_compare_exchange_weak(object, expected, desired) \
+ atomic_compare_exchange_strong(object, expected, desired)
+
+#define atomic_compare_exchange_weak_explicit(object, expected, desired, success, failure) \
+ atomic_compare_exchange_weak(object, expected, desired)
+
+#ifdef _WIN64
+#define atomic_fetch_add(object, operand) \
+ InterlockedExchangeAdd64(object, operand)
+
+#define atomic_fetch_sub(object, operand) \
+ InterlockedExchangeAdd64(object, -(operand))
+
+#define atomic_fetch_or(object, operand) \
+ InterlockedOr64(object, operand)
+
+#define atomic_fetch_xor(object, operand) \
+ InterlockedXor64(object, operand)
+
+#define atomic_fetch_and(object, operand) \
+ InterlockedAnd64(object, operand)
+#else
+#define atomic_fetch_add(object, operand) \
+ InterlockedExchangeAdd(object, operand)
+
+#define atomic_fetch_sub(object, operand) \
+ InterlockedExchangeAdd(object, -(operand))
+
+#define atomic_fetch_or(object, operand) \
+ InterlockedOr(object, operand)
+
+#define atomic_fetch_xor(object, operand) \
+ InterlockedXor(object, operand)
+
+#define atomic_fetch_and(object, operand) \
+ InterlockedAnd(object, operand)
+#endif /* _WIN64 */
+
+#define atomic_fetch_add_explicit(object, operand, order) \
+ atomic_fetch_add(object, operand)
+
+#define atomic_fetch_sub_explicit(object, operand, order) \
+ atomic_fetch_sub(object, operand)
+
+#define atomic_fetch_or_explicit(object, operand, order) \
+ atomic_fetch_or(object, operand)
+
+#define atomic_fetch_xor_explicit(object, operand, order) \
+ atomic_fetch_xor(object, operand)
+
+#define atomic_fetch_and_explicit(object, operand, order) \
+ atomic_fetch_and(object, operand)
+
+#define atomic_flag_test_and_set(object) \
+ atomic_exchange(object, 1)
+
+#define atomic_flag_test_and_set_explicit(object, order) \
+ atomic_flag_test_and_set(object)
+
+#define atomic_flag_clear(object) \
+ atomic_store(object, 0)
+
+#define atomic_flag_clear_explicit(object, order) \
+ atomic_flag_clear(object)
+
+#endif /* COMPAT_ATOMICS_WIN32_STDATOMIC_H */
diff --git a/media/ffvpx/compat/w32pthreads.h b/media/ffvpx/compat/w32pthreads.h
index 4ac2a995b8..eeead6051f 100644
--- a/media/ffvpx/compat/w32pthreads.h
+++ b/media/ffvpx/compat/w32pthreads.h
@@ -77,7 +77,7 @@ typedef struct pthread_cond_t {
static av_unused unsigned __stdcall attribute_align_arg win32thread_worker(void *arg)
{
- pthread_t *h = arg;
+ pthread_t *h = (pthread_t*)arg;
h->ret = h->func(h->arg);
return 0;
}
@@ -270,7 +270,7 @@ static av_unused int pthread_cond_init(pthread_cond_t *cond, const void *unused_
}
/* non native condition variables */
- win32_cond = av_mallocz(sizeof(win32_cond_t));
+ win32_cond = (win32_cond_t*)av_mallocz(sizeof(win32_cond_t));
if (!win32_cond)
return ENOMEM;
cond->Ptr = win32_cond;
@@ -288,7 +288,7 @@ static av_unused int pthread_cond_init(pthread_cond_t *cond, const void *unused_
static av_unused int pthread_cond_destroy(pthread_cond_t *cond)
{
- win32_cond_t *win32_cond = cond->Ptr;
+ win32_cond_t *win32_cond = (win32_cond_t*)cond->Ptr;
/* native condition variables do not destroy */
if (cond_init)
return 0;
@@ -305,7 +305,7 @@ static av_unused int pthread_cond_destroy(pthread_cond_t *cond)
static av_unused int pthread_cond_broadcast(pthread_cond_t *cond)
{
- win32_cond_t *win32_cond = cond->Ptr;
+ win32_cond_t *win32_cond = (win32_cond_t*)cond->Ptr;
int have_waiter;
if (cond_broadcast) {
@@ -337,7 +337,7 @@ static av_unused int pthread_cond_broadcast(pthread_cond_t *cond)
static av_unused int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex)
{
- win32_cond_t *win32_cond = cond->Ptr;
+ win32_cond_t *win32_cond = (win32_cond_t*)cond->Ptr;
int last_waiter;
if (cond_wait) {
cond_wait(cond, mutex, INFINITE);
@@ -369,7 +369,7 @@ static av_unused int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mu
static av_unused int pthread_cond_signal(pthread_cond_t *cond)
{
- win32_cond_t *win32_cond = cond->Ptr;
+ win32_cond_t *win32_cond = (win32_cond_t*)cond->Ptr;
int have_waiter;
if (cond_signal) {
cond_signal(cond);
@@ -397,20 +397,20 @@ static av_unused int pthread_cond_signal(pthread_cond_t *cond)
static av_unused void w32thread_init(void)
{
#if _WIN32_WINNT < 0x0600
- HANDLE kernel_dll = GetModuleHandle(TEXT("kernel32.dll"));
+ HMODULE kernel_dll = GetModuleHandle(TEXT("kernel32.dll"));
/* if one is available, then they should all be available */
- cond_init =
- (void*)GetProcAddress(kernel_dll, "InitializeConditionVariable");
- cond_broadcast =
- (void*)GetProcAddress(kernel_dll, "WakeAllConditionVariable");
- cond_signal =
- (void*)GetProcAddress(kernel_dll, "WakeConditionVariable");
- cond_wait =
- (void*)GetProcAddress(kernel_dll, "SleepConditionVariableCS");
- initonce_begin =
- (void*)GetProcAddress(kernel_dll, "InitOnceBeginInitialize");
- initonce_complete =
- (void*)GetProcAddress(kernel_dll, "InitOnceComplete");
+ cond_init = (void (WINAPI*)(pthread_cond_t *))
+ GetProcAddress(kernel_dll, "InitializeConditionVariable");
+ cond_broadcast = (void (WINAPI*)(pthread_cond_t *))
+ GetProcAddress(kernel_dll, "WakeAllConditionVariable");
+ cond_signal = (void (WINAPI*)(pthread_cond_t *))
+ GetProcAddress(kernel_dll, "WakeConditionVariable");
+ cond_wait = (BOOL (WINAPI*)(pthread_cond_t *, pthread_mutex_t *, DWORD))
+ GetProcAddress(kernel_dll, "SleepConditionVariableCS");
+ initonce_begin = (BOOL (WINAPI*)(pthread_once_t *, DWORD, BOOL *, void **))
+ GetProcAddress(kernel_dll, "InitOnceBeginInitialize");
+ initonce_complete = (BOOL (WINAPI*)(pthread_once_t *, DWORD, void *))
+ GetProcAddress(kernel_dll, "InitOnceComplete");
#endif
}
diff --git a/media/ffvpx/config_common.h b/media/ffvpx/config_common.h
index 6ee60762f9..dd3b3e1707 100644
--- a/media/ffvpx/config_common.h
+++ b/media/ffvpx/config_common.h
@@ -1,3 +1,4 @@
#ifndef MOZ_FFVPX_CONFIG_COMMON_H
#define MOZ_FFVPX_CONFIG_COMMON_H
+#include "defaults_disabled.h"
#endif
diff --git a/media/ffvpx/config_darwin32.h b/media/ffvpx/config_darwin32.h
index de232dca27..f92be8737d 100644
--- a/media/ffvpx/config_darwin32.h
+++ b/media/ffvpx/config_darwin32.h
@@ -384,15 +384,7 @@
#define HAVE_XLIB 0
#define CONFIG_BSFS 0
#define CONFIG_DECODERS 1
-#define CONFIG_ENCODERS 0
-#define CONFIG_HWACCELS 0
#define CONFIG_PARSERS 1
-#define CONFIG_INDEVS 0
-#define CONFIG_OUTDEVS 0
-#define CONFIG_FILTERS 0
-#define CONFIG_DEMUXERS 0
-#define CONFIG_MUXERS 0
-#define CONFIG_PROTOCOLS 0
#define CONFIG_DOC 0
#define CONFIG_HTMLPAGES 1
#define CONFIG_MANPAGES 1
@@ -514,7 +506,6 @@
#define CONFIG_VAAPI 0
#define CONFIG_VDA 0
#define CONFIG_VDPAU 0
-#define CONFIG_VIDEOTOOLBOX_HWACCEL 0
#define CONFIG_XVMC 0
#define CONFIG_FTRAPV 0
#define CONFIG_GRAY 0
@@ -579,7 +570,6 @@
#define CONFIG_FDCTDSP 0
#define CONFIG_FLACDSP 1
#define CONFIG_FMTCONVERT 0
-#define CONFIG_FRAME_THREAD_ENCODER 0
#define CONFIG_G722DSP 0
#define CONFIG_GOLOMB 1
#define CONFIG_GPLV3 0
@@ -655,1570 +645,10 @@
#define CONFIG_REMOVE_EXTRADATA_BSF 0
#define CONFIG_TEXT2MOVSUB_BSF 0
#define CONFIG_VP9_SUPERFRAME_BSF 0
-#define CONFIG_AASC_DECODER 0
-#define CONFIG_AIC_DECODER 0
-#define CONFIG_ALIAS_PIX_DECODER 0
-#define CONFIG_AMV_DECODER 0
-#define CONFIG_ANM_DECODER 0
-#define CONFIG_ANSI_DECODER 0
-#define CONFIG_APNG_DECODER 0
-#define CONFIG_ASV1_DECODER 0
-#define CONFIG_ASV2_DECODER 0
-#define CONFIG_AURA_DECODER 0
-#define CONFIG_AURA2_DECODER 0
-#define CONFIG_AVRP_DECODER 0
-#define CONFIG_AVRN_DECODER 0
-#define CONFIG_AVS_DECODER 0
-#define CONFIG_AVUI_DECODER 0
-#define CONFIG_AYUV_DECODER 0
-#define CONFIG_BETHSOFTVID_DECODER 0
-#define CONFIG_BFI_DECODER 0
-#define CONFIG_BINK_DECODER 0
-#define CONFIG_BMP_DECODER 0
-#define CONFIG_BMV_VIDEO_DECODER 0
-#define CONFIG_BRENDER_PIX_DECODER 0
-#define CONFIG_C93_DECODER 0
-#define CONFIG_CAVS_DECODER 0
-#define CONFIG_CDGRAPHICS_DECODER 0
-#define CONFIG_CDXL_DECODER 0
-#define CONFIG_CFHD_DECODER 0
-#define CONFIG_CINEPAK_DECODER 0
-#define CONFIG_CLJR_DECODER 0
-#define CONFIG_CLLC_DECODER 0
-#define CONFIG_COMFORTNOISE_DECODER 0
-#define CONFIG_CPIA_DECODER 0
-#define CONFIG_CSCD_DECODER 0
-#define CONFIG_CYUV_DECODER 0
-#define CONFIG_DDS_DECODER 0
-#define CONFIG_DFA_DECODER 0
-#define CONFIG_DIRAC_DECODER 0
-#define CONFIG_DNXHD_DECODER 0
-#define CONFIG_DPX_DECODER 0
-#define CONFIG_DSICINVIDEO_DECODER 0
-#define CONFIG_DVAUDIO_DECODER 0
-#define CONFIG_DVVIDEO_DECODER 0
-#define CONFIG_DXA_DECODER 0
-#define CONFIG_DXTORY_DECODER 0
-#define CONFIG_DXV_DECODER 0
-#define CONFIG_EACMV_DECODER 0
-#define CONFIG_EAMAD_DECODER 0
-#define CONFIG_EATGQ_DECODER 0
-#define CONFIG_EATGV_DECODER 0
-#define CONFIG_EATQI_DECODER 0
-#define CONFIG_EIGHTBPS_DECODER 0
-#define CONFIG_EIGHTSVX_EXP_DECODER 0
-#define CONFIG_EIGHTSVX_FIB_DECODER 0
-#define CONFIG_ESCAPE124_DECODER 0
-#define CONFIG_ESCAPE130_DECODER 0
-#define CONFIG_EXR_DECODER 0
-#define CONFIG_FFV1_DECODER 0
-#define CONFIG_FFVHUFF_DECODER 0
-#define CONFIG_FIC_DECODER 0
-#define CONFIG_FLASHSV_DECODER 0
-#define CONFIG_FLASHSV2_DECODER 0
-#define CONFIG_FLIC_DECODER 0
-#define CONFIG_FLV_DECODER 0
-#define CONFIG_FOURXM_DECODER 0
-#define CONFIG_FRAPS_DECODER 0
-#define CONFIG_FRWU_DECODER 0
-#define CONFIG_G2M_DECODER 0
-#define CONFIG_GIF_DECODER 0
-#define CONFIG_H261_DECODER 0
-#define CONFIG_H263_DECODER 0
-#define CONFIG_H263I_DECODER 0
-#define CONFIG_H263P_DECODER 0
-#define CONFIG_H264_DECODER 0
-#define CONFIG_H264_CRYSTALHD_DECODER 0
-#define CONFIG_H264_MEDIACODEC_DECODER 0
-#define CONFIG_H264_MMAL_DECODER 0
-#define CONFIG_H264_QSV_DECODER 0
-#define CONFIG_H264_VDA_DECODER 0
-#define CONFIG_H264_VDPAU_DECODER 0
-#define CONFIG_HAP_DECODER 0
-#define CONFIG_HEVC_DECODER 0
-#define CONFIG_HEVC_QSV_DECODER 0
-#define CONFIG_HNM4_VIDEO_DECODER 0
-#define CONFIG_HQ_HQA_DECODER 0
-#define CONFIG_HQX_DECODER 0
-#define CONFIG_HUFFYUV_DECODER 0
-#define CONFIG_IDCIN_DECODER 0
-#define CONFIG_IFF_ILBM_DECODER 0
-#define CONFIG_INDEO2_DECODER 0
-#define CONFIG_INDEO3_DECODER 0
-#define CONFIG_INDEO4_DECODER 0
-#define CONFIG_INDEO5_DECODER 0
-#define CONFIG_INTERPLAY_VIDEO_DECODER 0
-#define CONFIG_JPEG2000_DECODER 0
-#define CONFIG_JPEGLS_DECODER 0
-#define CONFIG_JV_DECODER 0
-#define CONFIG_KGV1_DECODER 0
-#define CONFIG_KMVC_DECODER 0
-#define CONFIG_LAGARITH_DECODER 0
-#define CONFIG_LOCO_DECODER 0
-#define CONFIG_M101_DECODER 0
-#define CONFIG_MAGICYUV_DECODER 0
-#define CONFIG_MDEC_DECODER 0
-#define CONFIG_MIMIC_DECODER 0
-#define CONFIG_MJPEG_DECODER 0
-#define CONFIG_MJPEGB_DECODER 0
-#define CONFIG_MMVIDEO_DECODER 0
-#define CONFIG_MOTIONPIXELS_DECODER 0
-#define CONFIG_MPEG_XVMC_DECODER 0
-#define CONFIG_MPEG1VIDEO_DECODER 0
-#define CONFIG_MPEG2VIDEO_DECODER 0
-#define CONFIG_MPEG4_DECODER 0
-#define CONFIG_MPEG4_CRYSTALHD_DECODER 0
-#define CONFIG_MPEG4_MMAL_DECODER 0
-#define CONFIG_MPEG4_VDPAU_DECODER 0
-#define CONFIG_MPEGVIDEO_DECODER 0
-#define CONFIG_MPEG_VDPAU_DECODER 0
-#define CONFIG_MPEG1_VDPAU_DECODER 0
-#define CONFIG_MPEG2_MMAL_DECODER 0
-#define CONFIG_MPEG2_CRYSTALHD_DECODER 0
-#define CONFIG_MPEG2_QSV_DECODER 0
-#define CONFIG_MSA1_DECODER 0
-#define CONFIG_MSMPEG4_CRYSTALHD_DECODER 0
-#define CONFIG_MSMPEG4V1_DECODER 0
-#define CONFIG_MSMPEG4V2_DECODER 0
-#define CONFIG_MSMPEG4V3_DECODER 0
-#define CONFIG_MSRLE_DECODER 0
-#define CONFIG_MSS1_DECODER 0
-#define CONFIG_MSS2_DECODER 0
-#define CONFIG_MSVIDEO1_DECODER 0
-#define CONFIG_MSZH_DECODER 0
-#define CONFIG_MTS2_DECODER 0
-#define CONFIG_MVC1_DECODER 0
-#define CONFIG_MVC2_DECODER 0
-#define CONFIG_MXPEG_DECODER 0
-#define CONFIG_NUV_DECODER 0
-#define CONFIG_PAF_VIDEO_DECODER 0
-#define CONFIG_PAM_DECODER 0
-#define CONFIG_PBM_DECODER 0
-#define CONFIG_PCX_DECODER 0
-#define CONFIG_PGM_DECODER 0
-#define CONFIG_PGMYUV_DECODER 0
-#define CONFIG_PICTOR_DECODER 0
-#define CONFIG_PNG_DECODER 0
-#define CONFIG_PPM_DECODER 0
-#define CONFIG_PRORES_DECODER 0
-#define CONFIG_PRORES_LGPL_DECODER 0
-#define CONFIG_PTX_DECODER 0
-#define CONFIG_QDRAW_DECODER 0
-#define CONFIG_QPEG_DECODER 0
-#define CONFIG_QTRLE_DECODER 0
-#define CONFIG_R10K_DECODER 0
-#define CONFIG_R210_DECODER 0
-#define CONFIG_RAWVIDEO_DECODER 0
-#define CONFIG_RL2_DECODER 0
-#define CONFIG_ROQ_DECODER 0
-#define CONFIG_RPZA_DECODER 0
-#define CONFIG_RSCC_DECODER 0
-#define CONFIG_RV10_DECODER 0
-#define CONFIG_RV20_DECODER 0
-#define CONFIG_RV30_DECODER 0
-#define CONFIG_RV40_DECODER 0
-#define CONFIG_S302M_DECODER 0
-#define CONFIG_SANM_DECODER 0
-#define CONFIG_SCREENPRESSO_DECODER 0
-#define CONFIG_SDX2_DPCM_DECODER 0
-#define CONFIG_SGI_DECODER 0
-#define CONFIG_SGIRLE_DECODER 0
-#define CONFIG_SHEERVIDEO_DECODER 0
-#define CONFIG_SMACKER_DECODER 0
-#define CONFIG_SMC_DECODER 0
-#define CONFIG_SMVJPEG_DECODER 0
-#define CONFIG_SNOW_DECODER 0
-#define CONFIG_SP5X_DECODER 0
-#define CONFIG_SUNRAST_DECODER 0
-#define CONFIG_SVQ1_DECODER 0
-#define CONFIG_SVQ3_DECODER 0
-#define CONFIG_TARGA_DECODER 0
-#define CONFIG_TARGA_Y216_DECODER 0
-#define CONFIG_TDSC_DECODER 0
-#define CONFIG_THEORA_DECODER 0
-#define CONFIG_THP_DECODER 0
-#define CONFIG_TIERTEXSEQVIDEO_DECODER 0
-#define CONFIG_TIFF_DECODER 0
-#define CONFIG_TMV_DECODER 0
-#define CONFIG_TRUEMOTION1_DECODER 0
-#define CONFIG_TRUEMOTION2_DECODER 0
-#define CONFIG_TRUEMOTION2RT_DECODER 0
-#define CONFIG_TSCC_DECODER 0
-#define CONFIG_TSCC2_DECODER 0
-#define CONFIG_TXD_DECODER 0
-#define CONFIG_ULTI_DECODER 0
-#define CONFIG_UTVIDEO_DECODER 0
-#define CONFIG_V210_DECODER 0
-#define CONFIG_V210X_DECODER 0
-#define CONFIG_V308_DECODER 0
-#define CONFIG_V408_DECODER 0
-#define CONFIG_V410_DECODER 0
-#define CONFIG_VB_DECODER 0
-#define CONFIG_VBLE_DECODER 0
-#define CONFIG_VC1_DECODER 0
-#define CONFIG_VC1_CRYSTALHD_DECODER 0
-#define CONFIG_VC1_VDPAU_DECODER 0
-#define CONFIG_VC1IMAGE_DECODER 0
-#define CONFIG_VC1_MMAL_DECODER 0
-#define CONFIG_VC1_QSV_DECODER 0
-#define CONFIG_VCR1_DECODER 0
-#define CONFIG_VMDVIDEO_DECODER 0
-#define CONFIG_VMNC_DECODER 0
-#define CONFIG_VP3_DECODER 0
-#define CONFIG_VP5_DECODER 0
-#define CONFIG_VP6_DECODER 0
-#define CONFIG_VP6A_DECODER 0
-#define CONFIG_VP6F_DECODER 0
-#define CONFIG_VP7_DECODER 0
#define CONFIG_VP8_DECODER 1
#define CONFIG_VP9_DECODER 1
-#define CONFIG_VQA_DECODER 0
-#define CONFIG_WEBP_DECODER 0
-#define CONFIG_WMV1_DECODER 0
-#define CONFIG_WMV2_DECODER 0
-#define CONFIG_WMV3_DECODER 0
-#define CONFIG_WMV3_CRYSTALHD_DECODER 0
-#define CONFIG_WMV3_VDPAU_DECODER 0
-#define CONFIG_WMV3IMAGE_DECODER 0
-#define CONFIG_WNV1_DECODER 0
-#define CONFIG_XAN_WC3_DECODER 0
-#define CONFIG_XAN_WC4_DECODER 0
-#define CONFIG_XBM_DECODER 0
-#define CONFIG_XFACE_DECODER 0
-#define CONFIG_XL_DECODER 0
-#define CONFIG_XWD_DECODER 0
-#define CONFIG_Y41P_DECODER 0
-#define CONFIG_YLC_DECODER 0
-#define CONFIG_YOP_DECODER 0
-#define CONFIG_YUV4_DECODER 0
-#define CONFIG_ZERO12V_DECODER 0
-#define CONFIG_ZEROCODEC_DECODER 0
-#define CONFIG_ZLIB_DECODER 0
-#define CONFIG_ZMBV_DECODER 0
-#define CONFIG_AAC_DECODER 0
-#define CONFIG_AAC_FIXED_DECODER 0
-#define CONFIG_AAC_LATM_DECODER 0
-#define CONFIG_AC3_DECODER 0
-#define CONFIG_AC3_FIXED_DECODER 0
-#define CONFIG_ALAC_DECODER 0
-#define CONFIG_ALS_DECODER 0
-#define CONFIG_AMRNB_DECODER 0
-#define CONFIG_AMRWB_DECODER 0
-#define CONFIG_APE_DECODER 0
-#define CONFIG_ATRAC1_DECODER 0
-#define CONFIG_ATRAC3_DECODER 0
-#define CONFIG_ATRAC3P_DECODER 0
-#define CONFIG_BINKAUDIO_DCT_DECODER 0
-#define CONFIG_BINKAUDIO_RDFT_DECODER 0
-#define CONFIG_BMV_AUDIO_DECODER 0
-#define CONFIG_COOK_DECODER 0
-#define CONFIG_DCA_DECODER 0
-#define CONFIG_DSD_LSBF_DECODER 0
-#define CONFIG_DSD_MSBF_DECODER 0
-#define CONFIG_DSD_LSBF_PLANAR_DECODER 0
-#define CONFIG_DSD_MSBF_PLANAR_DECODER 0
-#define CONFIG_DSICINAUDIO_DECODER 0
-#define CONFIG_DSS_SP_DECODER 0
-#define CONFIG_DST_DECODER 0
-#define CONFIG_EAC3_DECODER 0
-#define CONFIG_EVRC_DECODER 0
-#define CONFIG_FFWAVESYNTH_DECODER 0
#define CONFIG_FLAC_DECODER 1
-#define CONFIG_G723_1_DECODER 0
-#define CONFIG_G729_DECODER 0
-#define CONFIG_GSM_DECODER 0
-#define CONFIG_GSM_MS_DECODER 0
-#define CONFIG_IAC_DECODER 0
-#define CONFIG_IMC_DECODER 0
-#define CONFIG_INTERPLAY_ACM_DECODER 0
-#define CONFIG_MACE3_DECODER 0
-#define CONFIG_MACE6_DECODER 0
-#define CONFIG_METASOUND_DECODER 0
-#define CONFIG_MLP_DECODER 0
-#define CONFIG_MP1_DECODER 0
-#define CONFIG_MP1FLOAT_DECODER 0
-#define CONFIG_MP2_DECODER 0
-#define CONFIG_MP2FLOAT_DECODER 0
-#define CONFIG_MP3_DECODER 0
-#define CONFIG_MP3FLOAT_DECODER 0
-#define CONFIG_MP3ADU_DECODER 0
-#define CONFIG_MP3ADUFLOAT_DECODER 0
-#define CONFIG_MP3ON4_DECODER 0
-#define CONFIG_MP3ON4FLOAT_DECODER 0
-#define CONFIG_MPC7_DECODER 0
-#define CONFIG_MPC8_DECODER 0
-#define CONFIG_NELLYMOSER_DECODER 0
-#define CONFIG_ON2AVC_DECODER 0
-#define CONFIG_OPUS_DECODER 0
-#define CONFIG_PAF_AUDIO_DECODER 0
-#define CONFIG_QCELP_DECODER 0
-#define CONFIG_QDM2_DECODER 0
-#define CONFIG_RA_144_DECODER 0
-#define CONFIG_RA_288_DECODER 0
-#define CONFIG_RALF_DECODER 0
-#define CONFIG_SHORTEN_DECODER 0
-#define CONFIG_SIPR_DECODER 0
-#define CONFIG_SMACKAUD_DECODER 0
-#define CONFIG_SONIC_DECODER 0
-#define CONFIG_TAK_DECODER 0
-#define CONFIG_TRUEHD_DECODER 0
-#define CONFIG_TRUESPEECH_DECODER 0
-#define CONFIG_TTA_DECODER 0
-#define CONFIG_TWINVQ_DECODER 0
-#define CONFIG_VMDAUDIO_DECODER 0
-#define CONFIG_VORBIS_DECODER 0
-#define CONFIG_WAVPACK_DECODER 0
-#define CONFIG_WMALOSSLESS_DECODER 0
-#define CONFIG_WMAPRO_DECODER 0
-#define CONFIG_WMAV1_DECODER 0
-#define CONFIG_WMAV2_DECODER 0
-#define CONFIG_WMAVOICE_DECODER 0
-#define CONFIG_WS_SND1_DECODER 0
-#define CONFIG_XMA1_DECODER 0
-#define CONFIG_XMA2_DECODER 0
-#define CONFIG_PCM_ALAW_DECODER 0
-#define CONFIG_PCM_BLURAY_DECODER 0
-#define CONFIG_PCM_DVD_DECODER 0
-#define CONFIG_PCM_F32BE_DECODER 0
-#define CONFIG_PCM_F32LE_DECODER 0
-#define CONFIG_PCM_F64BE_DECODER 0
-#define CONFIG_PCM_F64LE_DECODER 0
-#define CONFIG_PCM_LXF_DECODER 0
-#define CONFIG_PCM_MULAW_DECODER 0
-#define CONFIG_PCM_S8_DECODER 0
-#define CONFIG_PCM_S8_PLANAR_DECODER 0
-#define CONFIG_PCM_S16BE_DECODER 0
-#define CONFIG_PCM_S16BE_PLANAR_DECODER 0
-#define CONFIG_PCM_S16LE_DECODER 0
-#define CONFIG_PCM_S16LE_PLANAR_DECODER 0
-#define CONFIG_PCM_S24BE_DECODER 0
-#define CONFIG_PCM_S24DAUD_DECODER 0
-#define CONFIG_PCM_S24LE_DECODER 0
-#define CONFIG_PCM_S24LE_PLANAR_DECODER 0
-#define CONFIG_PCM_S32BE_DECODER 0
-#define CONFIG_PCM_S32LE_DECODER 0
-#define CONFIG_PCM_S32LE_PLANAR_DECODER 0
-#define CONFIG_PCM_S64BE_DECODER 0
-#define CONFIG_PCM_S64LE_DECODER 0
-#define CONFIG_PCM_U8_DECODER 0
-#define CONFIG_PCM_U16BE_DECODER 0
-#define CONFIG_PCM_U16LE_DECODER 0
-#define CONFIG_PCM_U24BE_DECODER 0
-#define CONFIG_PCM_U24LE_DECODER 0
-#define CONFIG_PCM_U32BE_DECODER 0
-#define CONFIG_PCM_U32LE_DECODER 0
-#define CONFIG_PCM_ZORK_DECODER 0
-#define CONFIG_INTERPLAY_DPCM_DECODER 0
-#define CONFIG_ROQ_DPCM_DECODER 0
-#define CONFIG_SOL_DPCM_DECODER 0
-#define CONFIG_XAN_DPCM_DECODER 0
-#define CONFIG_ADPCM_4XM_DECODER 0
-#define CONFIG_ADPCM_ADX_DECODER 0
-#define CONFIG_ADPCM_AFC_DECODER 0
-#define CONFIG_ADPCM_AICA_DECODER 0
-#define CONFIG_ADPCM_CT_DECODER 0
-#define CONFIG_ADPCM_DTK_DECODER 0
-#define CONFIG_ADPCM_EA_DECODER 0
-#define CONFIG_ADPCM_EA_MAXIS_XA_DECODER 0
-#define CONFIG_ADPCM_EA_R1_DECODER 0
-#define CONFIG_ADPCM_EA_R2_DECODER 0
-#define CONFIG_ADPCM_EA_R3_DECODER 0
-#define CONFIG_ADPCM_EA_XAS_DECODER 0
-#define CONFIG_ADPCM_G722_DECODER 0
-#define CONFIG_ADPCM_G726_DECODER 0
-#define CONFIG_ADPCM_G726LE_DECODER 0
-#define CONFIG_ADPCM_IMA_AMV_DECODER 0
-#define CONFIG_ADPCM_IMA_APC_DECODER 0
-#define CONFIG_ADPCM_IMA_DAT4_DECODER 0
-#define CONFIG_ADPCM_IMA_DK3_DECODER 0
-#define CONFIG_ADPCM_IMA_DK4_DECODER 0
-#define CONFIG_ADPCM_IMA_EA_EACS_DECODER 0
-#define CONFIG_ADPCM_IMA_EA_SEAD_DECODER 0
-#define CONFIG_ADPCM_IMA_ISS_DECODER 0
-#define CONFIG_ADPCM_IMA_OKI_DECODER 0
-#define CONFIG_ADPCM_IMA_QT_DECODER 0
-#define CONFIG_ADPCM_IMA_RAD_DECODER 0
-#define CONFIG_ADPCM_IMA_SMJPEG_DECODER 0
-#define CONFIG_ADPCM_IMA_WAV_DECODER 0
-#define CONFIG_ADPCM_IMA_WS_DECODER 0
-#define CONFIG_ADPCM_MS_DECODER 0
-#define CONFIG_ADPCM_MTAF_DECODER 0
-#define CONFIG_ADPCM_PSX_DECODER 0
-#define CONFIG_ADPCM_SBPRO_2_DECODER 0
-#define CONFIG_ADPCM_SBPRO_3_DECODER 0
-#define CONFIG_ADPCM_SBPRO_4_DECODER 0
-#define CONFIG_ADPCM_SWF_DECODER 0
-#define CONFIG_ADPCM_THP_DECODER 0
-#define CONFIG_ADPCM_THP_LE_DECODER 0
-#define CONFIG_ADPCM_VIMA_DECODER 0
-#define CONFIG_ADPCM_XA_DECODER 0
-#define CONFIG_ADPCM_YAMAHA_DECODER 0
-#define CONFIG_SSA_DECODER 0
-#define CONFIG_ASS_DECODER 0
-#define CONFIG_CCAPTION_DECODER 0
-#define CONFIG_DVBSUB_DECODER 0
-#define CONFIG_DVDSUB_DECODER 0
-#define CONFIG_JACOSUB_DECODER 0
-#define CONFIG_MICRODVD_DECODER 0
-#define CONFIG_MOVTEXT_DECODER 0
-#define CONFIG_MPL2_DECODER 0
-#define CONFIG_PGSSUB_DECODER 0
-#define CONFIG_PJS_DECODER 0
-#define CONFIG_REALTEXT_DECODER 0
-#define CONFIG_SAMI_DECODER 0
-#define CONFIG_SRT_DECODER 0
-#define CONFIG_STL_DECODER 0
-#define CONFIG_SUBRIP_DECODER 0
-#define CONFIG_SUBVIEWER_DECODER 0
-#define CONFIG_SUBVIEWER1_DECODER 0
-#define CONFIG_TEXT_DECODER 0
-#define CONFIG_VPLAYER_DECODER 0
-#define CONFIG_WEBVTT_DECODER 0
-#define CONFIG_XSUB_DECODER 0
-#define CONFIG_AAC_AT_DECODER 0
-#define CONFIG_AC3_AT_DECODER 0
-#define CONFIG_ADPCM_IMA_QT_AT_DECODER 0
-#define CONFIG_ALAC_AT_DECODER 0
-#define CONFIG_AMR_NB_AT_DECODER 0
-#define CONFIG_EAC3_AT_DECODER 0
-#define CONFIG_GSM_MS_AT_DECODER 0
-#define CONFIG_ILBC_AT_DECODER 0
-#define CONFIG_MP1_AT_DECODER 0
-#define CONFIG_MP2_AT_DECODER 0
-#define CONFIG_MP3_AT_DECODER 0
-#define CONFIG_PCM_ALAW_AT_DECODER 0
-#define CONFIG_PCM_MULAW_AT_DECODER 0
-#define CONFIG_QDMC_AT_DECODER 0
-#define CONFIG_QDM2_AT_DECODER 0
-#define CONFIG_LIBCELT_DECODER 0
-#define CONFIG_LIBFDK_AAC_DECODER 0
-#define CONFIG_LIBGSM_DECODER 0
-#define CONFIG_LIBGSM_MS_DECODER 0
-#define CONFIG_LIBILBC_DECODER 0
-#define CONFIG_LIBOPENCORE_AMRNB_DECODER 0
-#define CONFIG_LIBOPENCORE_AMRWB_DECODER 0
-#define CONFIG_LIBOPENJPEG_DECODER 0
-#define CONFIG_LIBOPUS_DECODER 0
-#define CONFIG_LIBSCHROEDINGER_DECODER 0
-#define CONFIG_LIBSPEEX_DECODER 0
-#define CONFIG_LIBVORBIS_DECODER 0
-#define CONFIG_LIBVPX_VP8_DECODER 0
-#define CONFIG_LIBVPX_VP9_DECODER 0
-#define CONFIG_LIBZVBI_TELETEXT_DECODER 0
-#define CONFIG_BINTEXT_DECODER 0
-#define CONFIG_XBIN_DECODER 0
-#define CONFIG_IDF_DECODER 0
-#define CONFIG_LIBOPENH264_DECODER 0
-#define CONFIG_H263_CUVID_DECODER 0
-#define CONFIG_H264_CUVID_DECODER 0
-#define CONFIG_HEVC_CUVID_DECODER 0
-#define CONFIG_HEVC_MEDIACODEC_DECODER 0
-#define CONFIG_MJPEG_CUVID_DECODER 0
-#define CONFIG_MPEG1_CUVID_DECODER 0
-#define CONFIG_MPEG2_CUVID_DECODER 0
-#define CONFIG_MPEG4_CUVID_DECODER 0
-#define CONFIG_MPEG4_MEDIACODEC_DECODER 0
-#define CONFIG_VC1_CUVID_DECODER 0
-#define CONFIG_VP8_CUVID_DECODER 0
-#define CONFIG_VP8_MEDIACODEC_DECODER 0
-#define CONFIG_VP9_CUVID_DECODER 0
-#define CONFIG_VP9_MEDIACODEC_DECODER 0
-#define CONFIG_AA_DEMUXER 0
-#define CONFIG_AAC_DEMUXER 0
-#define CONFIG_AC3_DEMUXER 0
-#define CONFIG_ACM_DEMUXER 0
-#define CONFIG_ACT_DEMUXER 0
-#define CONFIG_ADF_DEMUXER 0
-#define CONFIG_ADP_DEMUXER 0
-#define CONFIG_ADS_DEMUXER 0
-#define CONFIG_ADX_DEMUXER 0
-#define CONFIG_AEA_DEMUXER 0
-#define CONFIG_AFC_DEMUXER 0
-#define CONFIG_AIFF_DEMUXER 0
-#define CONFIG_AIX_DEMUXER 0
-#define CONFIG_AMR_DEMUXER 0
-#define CONFIG_ANM_DEMUXER 0
-#define CONFIG_APC_DEMUXER 0
-#define CONFIG_APE_DEMUXER 0
-#define CONFIG_APNG_DEMUXER 0
-#define CONFIG_AQTITLE_DEMUXER 0
-#define CONFIG_ASF_DEMUXER 0
-#define CONFIG_ASF_O_DEMUXER 0
-#define CONFIG_ASS_DEMUXER 0
-#define CONFIG_AST_DEMUXER 0
-#define CONFIG_AU_DEMUXER 0
-#define CONFIG_AVI_DEMUXER 0
-#define CONFIG_AVISYNTH_DEMUXER 0
-#define CONFIG_AVR_DEMUXER 0
-#define CONFIG_AVS_DEMUXER 0
-#define CONFIG_BETHSOFTVID_DEMUXER 0
-#define CONFIG_BFI_DEMUXER 0
-#define CONFIG_BINTEXT_DEMUXER 0
-#define CONFIG_BINK_DEMUXER 0
-#define CONFIG_BIT_DEMUXER 0
-#define CONFIG_BMV_DEMUXER 0
-#define CONFIG_BFSTM_DEMUXER 0
-#define CONFIG_BRSTM_DEMUXER 0
-#define CONFIG_BOA_DEMUXER 0
-#define CONFIG_C93_DEMUXER 0
-#define CONFIG_CAF_DEMUXER 0
-#define CONFIG_CAVSVIDEO_DEMUXER 0
-#define CONFIG_CDG_DEMUXER 0
-#define CONFIG_CDXL_DEMUXER 0
-#define CONFIG_CINE_DEMUXER 0
-#define CONFIG_CONCAT_DEMUXER 0
-#define CONFIG_DATA_DEMUXER 0
-#define CONFIG_DAUD_DEMUXER 0
-#define CONFIG_DCSTR_DEMUXER 0
-#define CONFIG_DFA_DEMUXER 0
-#define CONFIG_DIRAC_DEMUXER 0
-#define CONFIG_DNXHD_DEMUXER 0
-#define CONFIG_DSF_DEMUXER 0
-#define CONFIG_DSICIN_DEMUXER 0
-#define CONFIG_DSS_DEMUXER 0
-#define CONFIG_DTS_DEMUXER 0
-#define CONFIG_DTSHD_DEMUXER 0
-#define CONFIG_DV_DEMUXER 0
-#define CONFIG_DVBSUB_DEMUXER 0
-#define CONFIG_DVBTXT_DEMUXER 0
-#define CONFIG_DXA_DEMUXER 0
-#define CONFIG_EA_DEMUXER 0
-#define CONFIG_EA_CDATA_DEMUXER 0
-#define CONFIG_EAC3_DEMUXER 0
-#define CONFIG_EPAF_DEMUXER 0
-#define CONFIG_FFM_DEMUXER 0
-#define CONFIG_FFMETADATA_DEMUXER 0
-#define CONFIG_FILMSTRIP_DEMUXER 0
-#define CONFIG_FLAC_DEMUXER 0
-#define CONFIG_FLIC_DEMUXER 0
-#define CONFIG_FLV_DEMUXER 0
-#define CONFIG_LIVE_FLV_DEMUXER 0
-#define CONFIG_FOURXM_DEMUXER 0
-#define CONFIG_FRM_DEMUXER 0
-#define CONFIG_FSB_DEMUXER 0
-#define CONFIG_G722_DEMUXER 0
-#define CONFIG_G723_1_DEMUXER 0
-#define CONFIG_G729_DEMUXER 0
-#define CONFIG_GENH_DEMUXER 0
-#define CONFIG_GIF_DEMUXER 0
-#define CONFIG_GSM_DEMUXER 0
-#define CONFIG_GXF_DEMUXER 0
-#define CONFIG_H261_DEMUXER 0
-#define CONFIG_H263_DEMUXER 0
-#define CONFIG_H264_DEMUXER 0
-#define CONFIG_HEVC_DEMUXER 0
-#define CONFIG_HLS_DEMUXER 0
-#define CONFIG_HNM_DEMUXER 0
-#define CONFIG_ICO_DEMUXER 0
-#define CONFIG_IDCIN_DEMUXER 0
-#define CONFIG_IDF_DEMUXER 0
-#define CONFIG_IFF_DEMUXER 0
-#define CONFIG_ILBC_DEMUXER 0
-#define CONFIG_IMAGE2_DEMUXER 0
-#define CONFIG_IMAGE2PIPE_DEMUXER 0
-#define CONFIG_IMAGE2_ALIAS_PIX_DEMUXER 0
-#define CONFIG_IMAGE2_BRENDER_PIX_DEMUXER 0
-#define CONFIG_INGENIENT_DEMUXER 0
-#define CONFIG_IPMOVIE_DEMUXER 0
-#define CONFIG_IRCAM_DEMUXER 0
-#define CONFIG_ISS_DEMUXER 0
-#define CONFIG_IV8_DEMUXER 0
-#define CONFIG_IVF_DEMUXER 0
-#define CONFIG_IVR_DEMUXER 0
-#define CONFIG_JACOSUB_DEMUXER 0
-#define CONFIG_JV_DEMUXER 0
-#define CONFIG_LMLM4_DEMUXER 0
-#define CONFIG_LOAS_DEMUXER 0
-#define CONFIG_LRC_DEMUXER 0
-#define CONFIG_LVF_DEMUXER 0
-#define CONFIG_LXF_DEMUXER 0
-#define CONFIG_M4V_DEMUXER 0
-#define CONFIG_MATROSKA_DEMUXER 0
-#define CONFIG_MGSTS_DEMUXER 0
-#define CONFIG_MICRODVD_DEMUXER 0
-#define CONFIG_MJPEG_DEMUXER 0
-#define CONFIG_MLP_DEMUXER 0
-#define CONFIG_MLV_DEMUXER 0
-#define CONFIG_MM_DEMUXER 0
-#define CONFIG_MMF_DEMUXER 0
-#define CONFIG_MOV_DEMUXER 0
-#define CONFIG_MP3_DEMUXER 0
-#define CONFIG_MPC_DEMUXER 0
-#define CONFIG_MPC8_DEMUXER 0
-#define CONFIG_MPEGPS_DEMUXER 0
-#define CONFIG_MPEGTS_DEMUXER 0
-#define CONFIG_MPEGTSRAW_DEMUXER 0
-#define CONFIG_MPEGVIDEO_DEMUXER 0
-#define CONFIG_MPJPEG_DEMUXER 0
-#define CONFIG_MPL2_DEMUXER 0
-#define CONFIG_MPSUB_DEMUXER 0
-#define CONFIG_MSF_DEMUXER 0
-#define CONFIG_MSNWC_TCP_DEMUXER 0
-#define CONFIG_MTAF_DEMUXER 0
-#define CONFIG_MTV_DEMUXER 0
-#define CONFIG_MUSX_DEMUXER 0
-#define CONFIG_MV_DEMUXER 0
-#define CONFIG_MVI_DEMUXER 0
-#define CONFIG_MXF_DEMUXER 0
-#define CONFIG_MXG_DEMUXER 0
-#define CONFIG_NC_DEMUXER 0
-#define CONFIG_NISTSPHERE_DEMUXER 0
-#define CONFIG_NSV_DEMUXER 0
-#define CONFIG_NUT_DEMUXER 0
-#define CONFIG_NUV_DEMUXER 0
-#define CONFIG_OGG_DEMUXER 0
-#define CONFIG_OMA_DEMUXER 0
-#define CONFIG_PAF_DEMUXER 0
-#define CONFIG_PCM_ALAW_DEMUXER 0
-#define CONFIG_PCM_MULAW_DEMUXER 0
-#define CONFIG_PCM_F64BE_DEMUXER 0
-#define CONFIG_PCM_F64LE_DEMUXER 0
-#define CONFIG_PCM_F32BE_DEMUXER 0
-#define CONFIG_PCM_F32LE_DEMUXER 0
-#define CONFIG_PCM_S32BE_DEMUXER 0
-#define CONFIG_PCM_S32LE_DEMUXER 0
-#define CONFIG_PCM_S24BE_DEMUXER 0
-#define CONFIG_PCM_S24LE_DEMUXER 0
-#define CONFIG_PCM_S16BE_DEMUXER 0
-#define CONFIG_PCM_S16LE_DEMUXER 0
-#define CONFIG_PCM_S8_DEMUXER 0
-#define CONFIG_PCM_U32BE_DEMUXER 0
-#define CONFIG_PCM_U32LE_DEMUXER 0
-#define CONFIG_PCM_U24BE_DEMUXER 0
-#define CONFIG_PCM_U24LE_DEMUXER 0
-#define CONFIG_PCM_U16BE_DEMUXER 0
-#define CONFIG_PCM_U16LE_DEMUXER 0
-#define CONFIG_PCM_U8_DEMUXER 0
-#define CONFIG_PJS_DEMUXER 0
-#define CONFIG_PMP_DEMUXER 0
-#define CONFIG_PVA_DEMUXER 0
-#define CONFIG_PVF_DEMUXER 0
-#define CONFIG_QCP_DEMUXER 0
-#define CONFIG_R3D_DEMUXER 0
-#define CONFIG_RAWVIDEO_DEMUXER 0
-#define CONFIG_REALTEXT_DEMUXER 0
-#define CONFIG_REDSPARK_DEMUXER 0
-#define CONFIG_RL2_DEMUXER 0
-#define CONFIG_RM_DEMUXER 0
-#define CONFIG_ROQ_DEMUXER 0
-#define CONFIG_RPL_DEMUXER 0
-#define CONFIG_RSD_DEMUXER 0
-#define CONFIG_RSO_DEMUXER 0
-#define CONFIG_RTP_DEMUXER 0
-#define CONFIG_RTSP_DEMUXER 0
-#define CONFIG_SAMI_DEMUXER 0
-#define CONFIG_SAP_DEMUXER 0
-#define CONFIG_SBG_DEMUXER 0
-#define CONFIG_SDP_DEMUXER 0
-#define CONFIG_SDR2_DEMUXER 0
-#define CONFIG_SEGAFILM_DEMUXER 0
-#define CONFIG_SHORTEN_DEMUXER 0
-#define CONFIG_SIFF_DEMUXER 0
-#define CONFIG_SLN_DEMUXER 0
-#define CONFIG_SMACKER_DEMUXER 0
-#define CONFIG_SMJPEG_DEMUXER 0
-#define CONFIG_SMUSH_DEMUXER 0
-#define CONFIG_SOL_DEMUXER 0
-#define CONFIG_SOX_DEMUXER 0
-#define CONFIG_SPDIF_DEMUXER 0
-#define CONFIG_SRT_DEMUXER 0
-#define CONFIG_STR_DEMUXER 0
-#define CONFIG_STL_DEMUXER 0
-#define CONFIG_SUBVIEWER1_DEMUXER 0
-#define CONFIG_SUBVIEWER_DEMUXER 0
-#define CONFIG_SUP_DEMUXER 0
-#define CONFIG_SVAG_DEMUXER 0
-#define CONFIG_SWF_DEMUXER 0
-#define CONFIG_TAK_DEMUXER 0
-#define CONFIG_TEDCAPTIONS_DEMUXER 0
-#define CONFIG_THP_DEMUXER 0
-#define CONFIG_THREEDOSTR_DEMUXER 0
-#define CONFIG_TIERTEXSEQ_DEMUXER 0
-#define CONFIG_TMV_DEMUXER 0
-#define CONFIG_TRUEHD_DEMUXER 0
-#define CONFIG_TTA_DEMUXER 0
-#define CONFIG_TXD_DEMUXER 0
-#define CONFIG_TTY_DEMUXER 0
-#define CONFIG_V210_DEMUXER 0
-#define CONFIG_V210X_DEMUXER 0
-#define CONFIG_VAG_DEMUXER 0
-#define CONFIG_VC1_DEMUXER 0
-#define CONFIG_VC1T_DEMUXER 0
-#define CONFIG_VIVO_DEMUXER 0
-#define CONFIG_VMD_DEMUXER 0
-#define CONFIG_VOBSUB_DEMUXER 0
-#define CONFIG_VOC_DEMUXER 0
-#define CONFIG_VPK_DEMUXER 0
-#define CONFIG_VPLAYER_DEMUXER 0
-#define CONFIG_VQF_DEMUXER 0
-#define CONFIG_W64_DEMUXER 0
-#define CONFIG_WAV_DEMUXER 0
-#define CONFIG_WC3_DEMUXER 0
-#define CONFIG_WEBM_DASH_MANIFEST_DEMUXER 0
-#define CONFIG_WEBVTT_DEMUXER 0
-#define CONFIG_WSAUD_DEMUXER 0
-#define CONFIG_WSD_DEMUXER 0
-#define CONFIG_WSVQA_DEMUXER 0
-#define CONFIG_WTV_DEMUXER 0
-#define CONFIG_WVE_DEMUXER 0
-#define CONFIG_WV_DEMUXER 0
-#define CONFIG_XA_DEMUXER 0
-#define CONFIG_XBIN_DEMUXER 0
-#define CONFIG_XMV_DEMUXER 0
-#define CONFIG_XVAG_DEMUXER 0
-#define CONFIG_XWMA_DEMUXER 0
-#define CONFIG_YOP_DEMUXER 0
-#define CONFIG_YUV4MPEGPIPE_DEMUXER 0
-#define CONFIG_IMAGE_BMP_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_DDS_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_DPX_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_EXR_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_J2K_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_JPEG_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_JPEGLS_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PAM_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PBM_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PCX_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PGMYUV_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PGM_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PICTOR_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PNG_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PPM_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_QDRAW_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_SGI_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_SUNRAST_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_TIFF_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_WEBP_PIPE_DEMUXER 0
-#define CONFIG_LIBGME_DEMUXER 0
-#define CONFIG_LIBMODPLUG_DEMUXER 0
-#define CONFIG_LIBNUT_DEMUXER 0
-#define CONFIG_LIBOPENMPT_DEMUXER 0
-#define CONFIG_A64MULTI_ENCODER 0
-#define CONFIG_A64MULTI5_ENCODER 0
-#define CONFIG_ALIAS_PIX_ENCODER 0
-#define CONFIG_AMV_ENCODER 0
-#define CONFIG_APNG_ENCODER 0
-#define CONFIG_ASV1_ENCODER 0
-#define CONFIG_ASV2_ENCODER 0
-#define CONFIG_AVRP_ENCODER 0
-#define CONFIG_AVUI_ENCODER 0
-#define CONFIG_AYUV_ENCODER 0
-#define CONFIG_BMP_ENCODER 0
-#define CONFIG_CINEPAK_ENCODER 0
-#define CONFIG_CLJR_ENCODER 0
-#define CONFIG_COMFORTNOISE_ENCODER 0
-#define CONFIG_DNXHD_ENCODER 0
-#define CONFIG_DPX_ENCODER 0
-#define CONFIG_DVVIDEO_ENCODER 0
-#define CONFIG_FFV1_ENCODER 0
-#define CONFIG_FFVHUFF_ENCODER 0
-#define CONFIG_FLASHSV_ENCODER 0
-#define CONFIG_FLASHSV2_ENCODER 0
-#define CONFIG_FLV_ENCODER 0
-#define CONFIG_GIF_ENCODER 0
-#define CONFIG_H261_ENCODER 0
-#define CONFIG_H263_ENCODER 0
-#define CONFIG_H263P_ENCODER 0
-#define CONFIG_HAP_ENCODER 0
-#define CONFIG_HUFFYUV_ENCODER 0
-#define CONFIG_JPEG2000_ENCODER 0
-#define CONFIG_JPEGLS_ENCODER 0
-#define CONFIG_LJPEG_ENCODER 0
-#define CONFIG_MJPEG_ENCODER 0
-#define CONFIG_MPEG1VIDEO_ENCODER 0
-#define CONFIG_MPEG2VIDEO_ENCODER 0
-#define CONFIG_MPEG4_ENCODER 0
-#define CONFIG_MSMPEG4V2_ENCODER 0
-#define CONFIG_MSMPEG4V3_ENCODER 0
-#define CONFIG_MSVIDEO1_ENCODER 0
-#define CONFIG_PAM_ENCODER 0
-#define CONFIG_PBM_ENCODER 0
-#define CONFIG_PCX_ENCODER 0
-#define CONFIG_PGM_ENCODER 0
-#define CONFIG_PGMYUV_ENCODER 0
-#define CONFIG_PNG_ENCODER 0
-#define CONFIG_PPM_ENCODER 0
-#define CONFIG_PRORES_ENCODER 0
-#define CONFIG_PRORES_AW_ENCODER 0
-#define CONFIG_PRORES_KS_ENCODER 0
-#define CONFIG_QTRLE_ENCODER 0
-#define CONFIG_R10K_ENCODER 0
-#define CONFIG_R210_ENCODER 0
-#define CONFIG_RAWVIDEO_ENCODER 0
-#define CONFIG_ROQ_ENCODER 0
-#define CONFIG_RV10_ENCODER 0
-#define CONFIG_RV20_ENCODER 0
-#define CONFIG_S302M_ENCODER 0
-#define CONFIG_SGI_ENCODER 0
-#define CONFIG_SNOW_ENCODER 0
-#define CONFIG_SUNRAST_ENCODER 0
-#define CONFIG_SVQ1_ENCODER 0
-#define CONFIG_TARGA_ENCODER 0
-#define CONFIG_TIFF_ENCODER 0
-#define CONFIG_UTVIDEO_ENCODER 0
-#define CONFIG_V210_ENCODER 0
-#define CONFIG_V308_ENCODER 0
-#define CONFIG_V408_ENCODER 0
-#define CONFIG_V410_ENCODER 0
-#define CONFIG_VC2_ENCODER 0
-#define CONFIG_WRAPPED_AVFRAME_ENCODER 0
-#define CONFIG_WMV1_ENCODER 0
-#define CONFIG_WMV2_ENCODER 0
-#define CONFIG_XBM_ENCODER 0
-#define CONFIG_XFACE_ENCODER 0
-#define CONFIG_XWD_ENCODER 0
-#define CONFIG_Y41P_ENCODER 0
-#define CONFIG_YUV4_ENCODER 0
-#define CONFIG_ZLIB_ENCODER 0
-#define CONFIG_ZMBV_ENCODER 0
-#define CONFIG_AAC_ENCODER 0
-#define CONFIG_AC3_ENCODER 0
-#define CONFIG_AC3_FIXED_ENCODER 0
-#define CONFIG_ALAC_ENCODER 0
-#define CONFIG_DCA_ENCODER 0
-#define CONFIG_EAC3_ENCODER 0
-#define CONFIG_FLAC_ENCODER 0
-#define CONFIG_G723_1_ENCODER 0
-#define CONFIG_MLP_ENCODER 0
-#define CONFIG_MP2_ENCODER 0
-#define CONFIG_MP2FIXED_ENCODER 0
-#define CONFIG_NELLYMOSER_ENCODER 0
-#define CONFIG_RA_144_ENCODER 0
-#define CONFIG_SONIC_ENCODER 0
-#define CONFIG_SONIC_LS_ENCODER 0
-#define CONFIG_TRUEHD_ENCODER 0
-#define CONFIG_TTA_ENCODER 0
-#define CONFIG_VORBIS_ENCODER 0
-#define CONFIG_WAVPACK_ENCODER 0
-#define CONFIG_WMAV1_ENCODER 0
-#define CONFIG_WMAV2_ENCODER 0
-#define CONFIG_PCM_ALAW_ENCODER 0
-#define CONFIG_PCM_F32BE_ENCODER 0
-#define CONFIG_PCM_F32LE_ENCODER 0
-#define CONFIG_PCM_F64BE_ENCODER 0
-#define CONFIG_PCM_F64LE_ENCODER 0
-#define CONFIG_PCM_MULAW_ENCODER 0
-#define CONFIG_PCM_S8_ENCODER 0
-#define CONFIG_PCM_S8_PLANAR_ENCODER 0
-#define CONFIG_PCM_S16BE_ENCODER 0
-#define CONFIG_PCM_S16BE_PLANAR_ENCODER 0
-#define CONFIG_PCM_S16LE_ENCODER 0
-#define CONFIG_PCM_S16LE_PLANAR_ENCODER 0
-#define CONFIG_PCM_S24BE_ENCODER 0
-#define CONFIG_PCM_S24DAUD_ENCODER 0
-#define CONFIG_PCM_S24LE_ENCODER 0
-#define CONFIG_PCM_S24LE_PLANAR_ENCODER 0
-#define CONFIG_PCM_S32BE_ENCODER 0
-#define CONFIG_PCM_S32LE_ENCODER 0
-#define CONFIG_PCM_S32LE_PLANAR_ENCODER 0
-#define CONFIG_PCM_S64BE_ENCODER 0
-#define CONFIG_PCM_S64LE_ENCODER 0
-#define CONFIG_PCM_U8_ENCODER 0
-#define CONFIG_PCM_U16BE_ENCODER 0
-#define CONFIG_PCM_U16LE_ENCODER 0
-#define CONFIG_PCM_U24BE_ENCODER 0
-#define CONFIG_PCM_U24LE_ENCODER 0
-#define CONFIG_PCM_U32BE_ENCODER 0
-#define CONFIG_PCM_U32LE_ENCODER 0
-#define CONFIG_ROQ_DPCM_ENCODER 0
-#define CONFIG_ADPCM_ADX_ENCODER 0
-#define CONFIG_ADPCM_G722_ENCODER 0
-#define CONFIG_ADPCM_G726_ENCODER 0
-#define CONFIG_ADPCM_IMA_QT_ENCODER 0
-#define CONFIG_ADPCM_IMA_WAV_ENCODER 0
-#define CONFIG_ADPCM_MS_ENCODER 0
-#define CONFIG_ADPCM_SWF_ENCODER 0
-#define CONFIG_ADPCM_YAMAHA_ENCODER 0
-#define CONFIG_SSA_ENCODER 0
-#define CONFIG_ASS_ENCODER 0
-#define CONFIG_DVBSUB_ENCODER 0
-#define CONFIG_DVDSUB_ENCODER 0
-#define CONFIG_MOVTEXT_ENCODER 0
-#define CONFIG_SRT_ENCODER 0
-#define CONFIG_SUBRIP_ENCODER 0
-#define CONFIG_TEXT_ENCODER 0
-#define CONFIG_WEBVTT_ENCODER 0
-#define CONFIG_XSUB_ENCODER 0
-#define CONFIG_AAC_AT_ENCODER 0
-#define CONFIG_ALAC_AT_ENCODER 0
-#define CONFIG_ILBC_AT_ENCODER 0
-#define CONFIG_PCM_ALAW_AT_ENCODER 0
-#define CONFIG_PCM_MULAW_AT_ENCODER 0
-#define CONFIG_LIBFDK_AAC_ENCODER 0
-#define CONFIG_LIBGSM_ENCODER 0
-#define CONFIG_LIBGSM_MS_ENCODER 0
-#define CONFIG_LIBILBC_ENCODER 0
-#define CONFIG_LIBMP3LAME_ENCODER 0
-#define CONFIG_LIBOPENCORE_AMRNB_ENCODER 0
-#define CONFIG_LIBOPENJPEG_ENCODER 0
-#define CONFIG_LIBOPUS_ENCODER 0
-#define CONFIG_LIBSCHROEDINGER_ENCODER 0
-#define CONFIG_LIBSHINE_ENCODER 0
-#define CONFIG_LIBSPEEX_ENCODER 0
-#define CONFIG_LIBTHEORA_ENCODER 0
-#define CONFIG_LIBTWOLAME_ENCODER 0
-#define CONFIG_LIBVO_AMRWBENC_ENCODER 0
-#define CONFIG_LIBVORBIS_ENCODER 0
-#define CONFIG_LIBVPX_VP8_ENCODER 0
-#define CONFIG_LIBVPX_VP9_ENCODER 0
-#define CONFIG_LIBWAVPACK_ENCODER 0
-#define CONFIG_LIBWEBP_ANIM_ENCODER 0
-#define CONFIG_LIBWEBP_ENCODER 0
-#define CONFIG_LIBX262_ENCODER 0
-#define CONFIG_LIBX264_ENCODER 0
-#define CONFIG_LIBX264RGB_ENCODER 0
-#define CONFIG_LIBX265_ENCODER 0
-#define CONFIG_LIBXAVS_ENCODER 0
-#define CONFIG_LIBXVID_ENCODER 0
-#define CONFIG_LIBOPENH264_ENCODER 0
-#define CONFIG_H264_NVENC_ENCODER 0
-#define CONFIG_H264_OMX_ENCODER 0
-#define CONFIG_H264_QSV_ENCODER 0
-#define CONFIG_H264_VAAPI_ENCODER 0
-#define CONFIG_H264_VIDEOTOOLBOX_ENCODER 0
-#define CONFIG_NVENC_ENCODER 0
-#define CONFIG_NVENC_H264_ENCODER 0
-#define CONFIG_NVENC_HEVC_ENCODER 0
-#define CONFIG_HEVC_NVENC_ENCODER 0
-#define CONFIG_HEVC_QSV_ENCODER 0
-#define CONFIG_HEVC_VAAPI_ENCODER 0
-#define CONFIG_LIBKVAZAAR_ENCODER 0
-#define CONFIG_MJPEG_VAAPI_ENCODER 0
-#define CONFIG_MPEG2_QSV_ENCODER 0
-#define CONFIG_ABENCH_FILTER 0
-#define CONFIG_ACOMPRESSOR_FILTER 0
-#define CONFIG_ACROSSFADE_FILTER 0
-#define CONFIG_ACRUSHER_FILTER 0
-#define CONFIG_ADELAY_FILTER 0
-#define CONFIG_AECHO_FILTER 0
-#define CONFIG_AEMPHASIS_FILTER 0
-#define CONFIG_AEVAL_FILTER 0
-#define CONFIG_AFADE_FILTER 0
-#define CONFIG_AFFTFILT_FILTER 0
-#define CONFIG_AFORMAT_FILTER 0
-#define CONFIG_AGATE_FILTER 0
-#define CONFIG_AINTERLEAVE_FILTER 0
-#define CONFIG_ALIMITER_FILTER 0
-#define CONFIG_ALLPASS_FILTER 0
-#define CONFIG_ALOOP_FILTER 0
-#define CONFIG_AMERGE_FILTER 0
-#define CONFIG_AMETADATA_FILTER 0
-#define CONFIG_AMIX_FILTER 0
-#define CONFIG_ANEQUALIZER_FILTER 0
-#define CONFIG_ANULL_FILTER 0
-#define CONFIG_APAD_FILTER 0
-#define CONFIG_APERMS_FILTER 0
-#define CONFIG_APHASER_FILTER 0
-#define CONFIG_APULSATOR_FILTER 0
-#define CONFIG_AREALTIME_FILTER 0
-#define CONFIG_ARESAMPLE_FILTER 0
-#define CONFIG_AREVERSE_FILTER 0
-#define CONFIG_ASELECT_FILTER 0
-#define CONFIG_ASENDCMD_FILTER 0
-#define CONFIG_ASETNSAMPLES_FILTER 0
-#define CONFIG_ASETPTS_FILTER 0
-#define CONFIG_ASETRATE_FILTER 0
-#define CONFIG_ASETTB_FILTER 0
-#define CONFIG_ASHOWINFO_FILTER 0
-#define CONFIG_ASIDEDATA_FILTER 0
-#define CONFIG_ASPLIT_FILTER 0
-#define CONFIG_ASTATS_FILTER 0
-#define CONFIG_ASTREAMSELECT_FILTER 0
-#define CONFIG_ASYNCTS_FILTER 0
-#define CONFIG_ATEMPO_FILTER 0
-#define CONFIG_ATRIM_FILTER 0
-#define CONFIG_AZMQ_FILTER 0
-#define CONFIG_BANDPASS_FILTER 0
-#define CONFIG_BANDREJECT_FILTER 0
-#define CONFIG_BASS_FILTER 0
-#define CONFIG_BIQUAD_FILTER 0
-#define CONFIG_BS2B_FILTER 0
-#define CONFIG_CHANNELMAP_FILTER 0
-#define CONFIG_CHANNELSPLIT_FILTER 0
-#define CONFIG_CHORUS_FILTER 0
-#define CONFIG_COMPAND_FILTER 0
-#define CONFIG_COMPENSATIONDELAY_FILTER 0
-#define CONFIG_CRYSTALIZER_FILTER 0
-#define CONFIG_DCSHIFT_FILTER 0
-#define CONFIG_DYNAUDNORM_FILTER 0
-#define CONFIG_EARWAX_FILTER 0
-#define CONFIG_EBUR128_FILTER 0
-#define CONFIG_EQUALIZER_FILTER 0
-#define CONFIG_EXTRASTEREO_FILTER 0
-#define CONFIG_FIREQUALIZER_FILTER 0
-#define CONFIG_FLANGER_FILTER 0
-#define CONFIG_HDCD_FILTER 0
-#define CONFIG_HIGHPASS_FILTER 0
-#define CONFIG_JOIN_FILTER 0
-#define CONFIG_LADSPA_FILTER 0
-#define CONFIG_LOUDNORM_FILTER 0
-#define CONFIG_LOWPASS_FILTER 0
-#define CONFIG_PAN_FILTER 0
-#define CONFIG_REPLAYGAIN_FILTER 0
-#define CONFIG_RESAMPLE_FILTER 0
-#define CONFIG_RUBBERBAND_FILTER 0
-#define CONFIG_SIDECHAINCOMPRESS_FILTER 0
-#define CONFIG_SIDECHAINGATE_FILTER 0
-#define CONFIG_SILENCEDETECT_FILTER 0
-#define CONFIG_SILENCEREMOVE_FILTER 0
-#define CONFIG_SOFALIZER_FILTER 0
-#define CONFIG_STEREOTOOLS_FILTER 0
-#define CONFIG_STEREOWIDEN_FILTER 0
-#define CONFIG_TREBLE_FILTER 0
-#define CONFIG_TREMOLO_FILTER 0
-#define CONFIG_VIBRATO_FILTER 0
-#define CONFIG_VOLUME_FILTER 0
-#define CONFIG_VOLUMEDETECT_FILTER 0
-#define CONFIG_AEVALSRC_FILTER 0
-#define CONFIG_ANOISESRC_FILTER 0
-#define CONFIG_ANULLSRC_FILTER 0
-#define CONFIG_FLITE_FILTER 0
-#define CONFIG_SINE_FILTER 0
-#define CONFIG_ANULLSINK_FILTER 0
-#define CONFIG_ALPHAEXTRACT_FILTER 0
-#define CONFIG_ALPHAMERGE_FILTER 0
-#define CONFIG_ASS_FILTER 0
-#define CONFIG_ATADENOISE_FILTER 0
-#define CONFIG_AVGBLUR_FILTER 0
-#define CONFIG_BBOX_FILTER 0
-#define CONFIG_BENCH_FILTER 0
-#define CONFIG_BITPLANENOISE_FILTER 0
-#define CONFIG_BLACKDETECT_FILTER 0
-#define CONFIG_BLACKFRAME_FILTER 0
-#define CONFIG_BLEND_FILTER 0
-#define CONFIG_BOXBLUR_FILTER 0
-#define CONFIG_BWDIF_FILTER 0
-#define CONFIG_CHROMAKEY_FILTER 0
-#define CONFIG_CIESCOPE_FILTER 0
-#define CONFIG_CODECVIEW_FILTER 0
-#define CONFIG_COLORBALANCE_FILTER 0
-#define CONFIG_COLORCHANNELMIXER_FILTER 0
-#define CONFIG_COLORKEY_FILTER 0
-#define CONFIG_COLORLEVELS_FILTER 0
-#define CONFIG_COLORMATRIX_FILTER 0
-#define CONFIG_COLORSPACE_FILTER 0
-#define CONFIG_CONVOLUTION_FILTER 0
-#define CONFIG_COPY_FILTER 0
-#define CONFIG_COREIMAGE_FILTER 0
-#define CONFIG_COVER_RECT_FILTER 0
-#define CONFIG_CROP_FILTER 0
-#define CONFIG_CROPDETECT_FILTER 0
-#define CONFIG_CURVES_FILTER 0
-#define CONFIG_DATASCOPE_FILTER 0
-#define CONFIG_DCTDNOIZ_FILTER 0
-#define CONFIG_DEBAND_FILTER 0
-#define CONFIG_DECIMATE_FILTER 0
-#define CONFIG_DEFLATE_FILTER 0
-#define CONFIG_DEJUDDER_FILTER 0
-#define CONFIG_DELOGO_FILTER 0
-#define CONFIG_DESHAKE_FILTER 0
-#define CONFIG_DETELECINE_FILTER 0
-#define CONFIG_DILATION_FILTER 0
-#define CONFIG_DISPLACE_FILTER 0
-#define CONFIG_DRAWBOX_FILTER 0
-#define CONFIG_DRAWGRAPH_FILTER 0
-#define CONFIG_DRAWGRID_FILTER 0
-#define CONFIG_DRAWTEXT_FILTER 0
-#define CONFIG_EDGEDETECT_FILTER 0
-#define CONFIG_ELBG_FILTER 0
-#define CONFIG_EQ_FILTER 0
-#define CONFIG_EROSION_FILTER 0
-#define CONFIG_EXTRACTPLANES_FILTER 0
-#define CONFIG_FADE_FILTER 0
-#define CONFIG_FFTFILT_FILTER 0
-#define CONFIG_FIELD_FILTER 0
-#define CONFIG_FIELDHINT_FILTER 0
-#define CONFIG_FIELDMATCH_FILTER 0
-#define CONFIG_FIELDORDER_FILTER 0
-#define CONFIG_FIND_RECT_FILTER 0
-#define CONFIG_FORMAT_FILTER 0
-#define CONFIG_FPS_FILTER 0
-#define CONFIG_FRAMEPACK_FILTER 0
-#define CONFIG_FRAMERATE_FILTER 0
-#define CONFIG_FRAMESTEP_FILTER 0
-#define CONFIG_FREI0R_FILTER 0
-#define CONFIG_FSPP_FILTER 0
-#define CONFIG_GBLUR_FILTER 0
-#define CONFIG_GEQ_FILTER 0
-#define CONFIG_GRADFUN_FILTER 0
-#define CONFIG_HALDCLUT_FILTER 0
-#define CONFIG_HFLIP_FILTER 0
-#define CONFIG_HISTEQ_FILTER 0
-#define CONFIG_HISTOGRAM_FILTER 0
-#define CONFIG_HQDN3D_FILTER 0
-#define CONFIG_HQX_FILTER 0
-#define CONFIG_HSTACK_FILTER 0
-#define CONFIG_HUE_FILTER 0
-#define CONFIG_HWDOWNLOAD_FILTER 0
-#define CONFIG_HWUPLOAD_FILTER 0
-#define CONFIG_HWUPLOAD_CUDA_FILTER 0
-#define CONFIG_HYSTERESIS_FILTER 0
-#define CONFIG_IDET_FILTER 0
-#define CONFIG_IL_FILTER 0
-#define CONFIG_INFLATE_FILTER 0
-#define CONFIG_INTERLACE_FILTER 0
-#define CONFIG_INTERLEAVE_FILTER 0
-#define CONFIG_KERNDEINT_FILTER 0
-#define CONFIG_LENSCORRECTION_FILTER 0
-#define CONFIG_LOOP_FILTER 0
-#define CONFIG_LUT_FILTER 0
-#define CONFIG_LUT2_FILTER 0
-#define CONFIG_LUT3D_FILTER 0
-#define CONFIG_LUTRGB_FILTER 0
-#define CONFIG_LUTYUV_FILTER 0
-#define CONFIG_MASKEDCLAMP_FILTER 0
-#define CONFIG_MASKEDMERGE_FILTER 0
-#define CONFIG_MCDEINT_FILTER 0
-#define CONFIG_MERGEPLANES_FILTER 0
-#define CONFIG_MESTIMATE_FILTER 0
-#define CONFIG_METADATA_FILTER 0
-#define CONFIG_MINTERPOLATE_FILTER 0
-#define CONFIG_MPDECIMATE_FILTER 0
-#define CONFIG_NEGATE_FILTER 0
-#define CONFIG_NLMEANS_FILTER 0
-#define CONFIG_NNEDI_FILTER 0
-#define CONFIG_NOFORMAT_FILTER 0
-#define CONFIG_NOISE_FILTER 0
-#define CONFIG_NULL_FILTER 0
-#define CONFIG_OCR_FILTER 0
-#define CONFIG_OCV_FILTER 0
-#define CONFIG_OVERLAY_FILTER 0
-#define CONFIG_OWDENOISE_FILTER 0
-#define CONFIG_PAD_FILTER 0
-#define CONFIG_PALETTEGEN_FILTER 0
-#define CONFIG_PALETTEUSE_FILTER 0
-#define CONFIG_PERMS_FILTER 0
-#define CONFIG_PERSPECTIVE_FILTER 0
-#define CONFIG_PHASE_FILTER 0
-#define CONFIG_PIXDESCTEST_FILTER 0
-#define CONFIG_PP_FILTER 0
-#define CONFIG_PP7_FILTER 0
-#define CONFIG_PREWITT_FILTER 0
-#define CONFIG_PSNR_FILTER 0
-#define CONFIG_PULLUP_FILTER 0
-#define CONFIG_QP_FILTER 0
-#define CONFIG_RANDOM_FILTER 0
-#define CONFIG_READVITC_FILTER 0
-#define CONFIG_REALTIME_FILTER 0
-#define CONFIG_REMAP_FILTER 0
-#define CONFIG_REMOVEGRAIN_FILTER 0
-#define CONFIG_REMOVELOGO_FILTER 0
-#define CONFIG_REPEATFIELDS_FILTER 0
-#define CONFIG_REVERSE_FILTER 0
-#define CONFIG_ROTATE_FILTER 0
-#define CONFIG_SAB_FILTER 0
-#define CONFIG_SCALE_FILTER 0
-#define CONFIG_SCALE_NPP_FILTER 0
-#define CONFIG_SCALE_VAAPI_FILTER 0
-#define CONFIG_SCALE2REF_FILTER 0
-#define CONFIG_SELECT_FILTER 0
-#define CONFIG_SELECTIVECOLOR_FILTER 0
-#define CONFIG_SENDCMD_FILTER 0
-#define CONFIG_SEPARATEFIELDS_FILTER 0
-#define CONFIG_SETDAR_FILTER 0
-#define CONFIG_SETFIELD_FILTER 0
-#define CONFIG_SETPTS_FILTER 0
-#define CONFIG_SETSAR_FILTER 0
-#define CONFIG_SETTB_FILTER 0
-#define CONFIG_SHOWINFO_FILTER 0
-#define CONFIG_SHOWPALETTE_FILTER 0
-#define CONFIG_SHUFFLEFRAMES_FILTER 0
-#define CONFIG_SHUFFLEPLANES_FILTER 0
-#define CONFIG_SIDEDATA_FILTER 0
-#define CONFIG_SIGNALSTATS_FILTER 0
-#define CONFIG_SMARTBLUR_FILTER 0
-#define CONFIG_SOBEL_FILTER 0
-#define CONFIG_SPLIT_FILTER 0
-#define CONFIG_SPP_FILTER 0
-#define CONFIG_SSIM_FILTER 0
-#define CONFIG_STEREO3D_FILTER 0
-#define CONFIG_STREAMSELECT_FILTER 0
-#define CONFIG_SUBTITLES_FILTER 0
-#define CONFIG_SUPER2XSAI_FILTER 0
-#define CONFIG_SWAPRECT_FILTER 0
-#define CONFIG_SWAPUV_FILTER 0
-#define CONFIG_TBLEND_FILTER 0
-#define CONFIG_TELECINE_FILTER 0
-#define CONFIG_THUMBNAIL_FILTER 0
-#define CONFIG_TILE_FILTER 0
-#define CONFIG_TINTERLACE_FILTER 0
-#define CONFIG_TRANSPOSE_FILTER 0
-#define CONFIG_TRIM_FILTER 0
-#define CONFIG_UNSHARP_FILTER 0
-#define CONFIG_USPP_FILTER 0
-#define CONFIG_VAGUEDENOISER_FILTER 0
-#define CONFIG_VECTORSCOPE_FILTER 0
-#define CONFIG_VFLIP_FILTER 0
-#define CONFIG_VIDSTABDETECT_FILTER 0
-#define CONFIG_VIDSTABTRANSFORM_FILTER 0
-#define CONFIG_VIGNETTE_FILTER 0
-#define CONFIG_VSTACK_FILTER 0
-#define CONFIG_W3FDIF_FILTER 0
-#define CONFIG_WAVEFORM_FILTER 0
-#define CONFIG_WEAVE_FILTER 0
-#define CONFIG_XBR_FILTER 0
-#define CONFIG_YADIF_FILTER 0
-#define CONFIG_ZMQ_FILTER 0
-#define CONFIG_ZOOMPAN_FILTER 0
-#define CONFIG_ZSCALE_FILTER 0
-#define CONFIG_ALLRGB_FILTER 0
-#define CONFIG_ALLYUV_FILTER 0
-#define CONFIG_CELLAUTO_FILTER 0
-#define CONFIG_COLOR_FILTER 0
-#define CONFIG_COREIMAGESRC_FILTER 0
-#define CONFIG_FREI0R_SRC_FILTER 0
-#define CONFIG_HALDCLUTSRC_FILTER 0
-#define CONFIG_LIFE_FILTER 0
-#define CONFIG_MANDELBROT_FILTER 0
-#define CONFIG_MPTESTSRC_FILTER 0
-#define CONFIG_NULLSRC_FILTER 0
-#define CONFIG_RGBTESTSRC_FILTER 0
-#define CONFIG_SMPTEBARS_FILTER 0
-#define CONFIG_SMPTEHDBARS_FILTER 0
-#define CONFIG_TESTSRC_FILTER 0
-#define CONFIG_TESTSRC2_FILTER 0
-#define CONFIG_YUVTESTSRC_FILTER 0
-#define CONFIG_NULLSINK_FILTER 0
-#define CONFIG_ADRAWGRAPH_FILTER 0
-#define CONFIG_AHISTOGRAM_FILTER 0
-#define CONFIG_APHASEMETER_FILTER 0
-#define CONFIG_AVECTORSCOPE_FILTER 0
-#define CONFIG_CONCAT_FILTER 0
-#define CONFIG_SHOWCQT_FILTER 0
-#define CONFIG_SHOWFREQS_FILTER 0
-#define CONFIG_SHOWSPECTRUM_FILTER 0
-#define CONFIG_SHOWSPECTRUMPIC_FILTER 0
-#define CONFIG_SHOWVOLUME_FILTER 0
-#define CONFIG_SHOWWAVES_FILTER 0
-#define CONFIG_SHOWWAVESPIC_FILTER 0
-#define CONFIG_SPECTRUMSYNTH_FILTER 0
-#define CONFIG_AMOVIE_FILTER 0
-#define CONFIG_MOVIE_FILTER 0
-#define CONFIG_H263_CUVID_HWACCEL 0
-#define CONFIG_H263_VAAPI_HWACCEL 0
-#define CONFIG_H263_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_H264_CUVID_HWACCEL 0
-#define CONFIG_H264_D3D11VA_HWACCEL 0
-#define CONFIG_H264_DXVA2_HWACCEL 0
-#define CONFIG_H264_MEDIACODEC_HWACCEL 0
-#define CONFIG_H264_MMAL_HWACCEL 0
-#define CONFIG_H264_QSV_HWACCEL 0
-#define CONFIG_H264_VAAPI_HWACCEL 0
-#define CONFIG_H264_VDA_HWACCEL 0
-#define CONFIG_H264_VDA_OLD_HWACCEL 0
-#define CONFIG_H264_VDPAU_HWACCEL 0
-#define CONFIG_H264_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_HEVC_CUVID_HWACCEL 0
-#define CONFIG_HEVC_D3D11VA_HWACCEL 0
-#define CONFIG_HEVC_DXVA2_HWACCEL 0
-#define CONFIG_HEVC_MEDIACODEC_HWACCEL 0
-#define CONFIG_HEVC_QSV_HWACCEL 0
-#define CONFIG_HEVC_VAAPI_HWACCEL 0
-#define CONFIG_HEVC_VDPAU_HWACCEL 0
-#define CONFIG_MJPEG_CUVID_HWACCEL 0
-#define CONFIG_MPEG1_CUVID_HWACCEL 0
-#define CONFIG_MPEG1_XVMC_HWACCEL 0
-#define CONFIG_MPEG1_VDPAU_HWACCEL 0
-#define CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_MPEG2_CUVID_HWACCEL 0
-#define CONFIG_MPEG2_XVMC_HWACCEL 0
-#define CONFIG_MPEG2_D3D11VA_HWACCEL 0
-#define CONFIG_MPEG2_DXVA2_HWACCEL 0
-#define CONFIG_MPEG2_MMAL_HWACCEL 0
-#define CONFIG_MPEG2_QSV_HWACCEL 0
-#define CONFIG_MPEG2_VAAPI_HWACCEL 0
-#define CONFIG_MPEG2_VDPAU_HWACCEL 0
-#define CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_MPEG4_CUVID_HWACCEL 0
-#define CONFIG_MPEG4_MEDIACODEC_HWACCEL 0
-#define CONFIG_MPEG4_MMAL_HWACCEL 0
-#define CONFIG_MPEG4_VAAPI_HWACCEL 0
-#define CONFIG_MPEG4_VDPAU_HWACCEL 0
-#define CONFIG_MPEG4_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_VC1_CUVID_HWACCEL 0
-#define CONFIG_VC1_D3D11VA_HWACCEL 0
-#define CONFIG_VC1_DXVA2_HWACCEL 0
-#define CONFIG_VC1_VAAPI_HWACCEL 0
-#define CONFIG_VC1_VDPAU_HWACCEL 0
-#define CONFIG_VC1_MMAL_HWACCEL 0
-#define CONFIG_VC1_QSV_HWACCEL 0
-#define CONFIG_VP8_CUVID_HWACCEL 0
-#define CONFIG_VP8_MEDIACODEC_HWACCEL 0
-#define CONFIG_VP9_CUVID_HWACCEL 0
-#define CONFIG_VP9_D3D11VA_HWACCEL 0
-#define CONFIG_VP9_DXVA2_HWACCEL 0
-#define CONFIG_VP9_MEDIACODEC_HWACCEL 0
-#define CONFIG_VP9_VAAPI_HWACCEL 0
-#define CONFIG_WMV3_D3D11VA_HWACCEL 0
-#define CONFIG_WMV3_DXVA2_HWACCEL 0
-#define CONFIG_WMV3_VAAPI_HWACCEL 0
-#define CONFIG_WMV3_VDPAU_HWACCEL 0
-#define CONFIG_ALSA_INDEV 0
-#define CONFIG_AVFOUNDATION_INDEV 0
-#define CONFIG_BKTR_INDEV 0
-#define CONFIG_DECKLINK_INDEV 0
-#define CONFIG_DSHOW_INDEV 0
-#define CONFIG_DV1394_INDEV 0
-#define CONFIG_FBDEV_INDEV 0
-#define CONFIG_GDIGRAB_INDEV 0
-#define CONFIG_IEC61883_INDEV 0
-#define CONFIG_JACK_INDEV 0
-#define CONFIG_LAVFI_INDEV 0
-#define CONFIG_OPENAL_INDEV 0
-#define CONFIG_OSS_INDEV 0
-#define CONFIG_PULSE_INDEV 0
-#define CONFIG_QTKIT_INDEV 0
-#define CONFIG_SNDIO_INDEV 0
-#define CONFIG_V4L2_INDEV 0
-#define CONFIG_VFWCAP_INDEV 0
-#define CONFIG_X11GRAB_INDEV 0
-#define CONFIG_X11GRAB_XCB_INDEV 0
-#define CONFIG_LIBCDIO_INDEV 0
-#define CONFIG_LIBDC1394_INDEV 0
-#define CONFIG_A64_MUXER 0
-#define CONFIG_AC3_MUXER 0
-#define CONFIG_ADTS_MUXER 0
-#define CONFIG_ADX_MUXER 0
-#define CONFIG_AIFF_MUXER 0
-#define CONFIG_AMR_MUXER 0
-#define CONFIG_APNG_MUXER 0
-#define CONFIG_ASF_MUXER 0
-#define CONFIG_ASS_MUXER 0
-#define CONFIG_AST_MUXER 0
-#define CONFIG_ASF_STREAM_MUXER 0
-#define CONFIG_AU_MUXER 0
-#define CONFIG_AVI_MUXER 0
-#define CONFIG_AVM2_MUXER 0
-#define CONFIG_BIT_MUXER 0
-#define CONFIG_CAF_MUXER 0
-#define CONFIG_CAVSVIDEO_MUXER 0
-#define CONFIG_CRC_MUXER 0
-#define CONFIG_DASH_MUXER 0
-#define CONFIG_DATA_MUXER 0
-#define CONFIG_DAUD_MUXER 0
-#define CONFIG_DIRAC_MUXER 0
-#define CONFIG_DNXHD_MUXER 0
-#define CONFIG_DTS_MUXER 0
-#define CONFIG_DV_MUXER 0
-#define CONFIG_EAC3_MUXER 0
-#define CONFIG_F4V_MUXER 0
-#define CONFIG_FFM_MUXER 0
-#define CONFIG_FFMETADATA_MUXER 0
-#define CONFIG_FIFO_MUXER 0
-#define CONFIG_FILMSTRIP_MUXER 0
-#define CONFIG_FLAC_MUXER 0
-#define CONFIG_FLV_MUXER 0
-#define CONFIG_FRAMECRC_MUXER 0
-#define CONFIG_FRAMEHASH_MUXER 0
-#define CONFIG_FRAMEMD5_MUXER 0
-#define CONFIG_G722_MUXER 0
-#define CONFIG_G723_1_MUXER 0
-#define CONFIG_GIF_MUXER 0
-#define CONFIG_GSM_MUXER 0
-#define CONFIG_GXF_MUXER 0
-#define CONFIG_H261_MUXER 0
-#define CONFIG_H263_MUXER 0
-#define CONFIG_H264_MUXER 0
-#define CONFIG_HASH_MUXER 0
-#define CONFIG_HDS_MUXER 0
-#define CONFIG_HEVC_MUXER 0
-#define CONFIG_HLS_MUXER 0
-#define CONFIG_ICO_MUXER 0
-#define CONFIG_ILBC_MUXER 0
-#define CONFIG_IMAGE2_MUXER 0
-#define CONFIG_IMAGE2PIPE_MUXER 0
-#define CONFIG_IPOD_MUXER 0
-#define CONFIG_IRCAM_MUXER 0
-#define CONFIG_ISMV_MUXER 0
-#define CONFIG_IVF_MUXER 0
-#define CONFIG_JACOSUB_MUXER 0
-#define CONFIG_LATM_MUXER 0
-#define CONFIG_LRC_MUXER 0
-#define CONFIG_M4V_MUXER 0
-#define CONFIG_MD5_MUXER 0
-#define CONFIG_MATROSKA_MUXER 0
-#define CONFIG_MATROSKA_AUDIO_MUXER 0
-#define CONFIG_MICRODVD_MUXER 0
-#define CONFIG_MJPEG_MUXER 0
-#define CONFIG_MLP_MUXER 0
-#define CONFIG_MMF_MUXER 0
-#define CONFIG_MOV_MUXER 0
-#define CONFIG_MP2_MUXER 0
-#define CONFIG_MP3_MUXER 0
-#define CONFIG_MP4_MUXER 0
-#define CONFIG_MPEG1SYSTEM_MUXER 0
-#define CONFIG_MPEG1VCD_MUXER 0
-#define CONFIG_MPEG1VIDEO_MUXER 0
-#define CONFIG_MPEG2DVD_MUXER 0
-#define CONFIG_MPEG2SVCD_MUXER 0
-#define CONFIG_MPEG2VIDEO_MUXER 0
-#define CONFIG_MPEG2VOB_MUXER 0
-#define CONFIG_MPEGTS_MUXER 0
-#define CONFIG_MPJPEG_MUXER 0
-#define CONFIG_MXF_MUXER 0
-#define CONFIG_MXF_D10_MUXER 0
-#define CONFIG_MXF_OPATOM_MUXER 0
-#define CONFIG_NULL_MUXER 0
-#define CONFIG_NUT_MUXER 0
-#define CONFIG_OGA_MUXER 0
-#define CONFIG_OGG_MUXER 0
-#define CONFIG_OGV_MUXER 0
-#define CONFIG_OMA_MUXER 0
-#define CONFIG_OPUS_MUXER 0
-#define CONFIG_PCM_ALAW_MUXER 0
-#define CONFIG_PCM_MULAW_MUXER 0
-#define CONFIG_PCM_F64BE_MUXER 0
-#define CONFIG_PCM_F64LE_MUXER 0
-#define CONFIG_PCM_F32BE_MUXER 0
-#define CONFIG_PCM_F32LE_MUXER 0
-#define CONFIG_PCM_S32BE_MUXER 0
-#define CONFIG_PCM_S32LE_MUXER 0
-#define CONFIG_PCM_S24BE_MUXER 0
-#define CONFIG_PCM_S24LE_MUXER 0
-#define CONFIG_PCM_S16BE_MUXER 0
-#define CONFIG_PCM_S16LE_MUXER 0
-#define CONFIG_PCM_S8_MUXER 0
-#define CONFIG_PCM_U32BE_MUXER 0
-#define CONFIG_PCM_U32LE_MUXER 0
-#define CONFIG_PCM_U24BE_MUXER 0
-#define CONFIG_PCM_U24LE_MUXER 0
-#define CONFIG_PCM_U16BE_MUXER 0
-#define CONFIG_PCM_U16LE_MUXER 0
-#define CONFIG_PCM_U8_MUXER 0
-#define CONFIG_PSP_MUXER 0
-#define CONFIG_RAWVIDEO_MUXER 0
-#define CONFIG_RM_MUXER 0
-#define CONFIG_ROQ_MUXER 0
-#define CONFIG_RSO_MUXER 0
-#define CONFIG_RTP_MUXER 0
-#define CONFIG_RTP_MPEGTS_MUXER 0
-#define CONFIG_RTSP_MUXER 0
-#define CONFIG_SAP_MUXER 0
-#define CONFIG_SEGMENT_MUXER 0
-#define CONFIG_STREAM_SEGMENT_MUXER 0
-#define CONFIG_SINGLEJPEG_MUXER 0
-#define CONFIG_SMJPEG_MUXER 0
-#define CONFIG_SMOOTHSTREAMING_MUXER 0
-#define CONFIG_SOX_MUXER 0
-#define CONFIG_SPX_MUXER 0
-#define CONFIG_SPDIF_MUXER 0
-#define CONFIG_SRT_MUXER 0
-#define CONFIG_SWF_MUXER 0
-#define CONFIG_TEE_MUXER 0
-#define CONFIG_TG2_MUXER 0
-#define CONFIG_TGP_MUXER 0
-#define CONFIG_MKVTIMESTAMP_V2_MUXER 0
-#define CONFIG_TRUEHD_MUXER 0
-#define CONFIG_TTA_MUXER 0
-#define CONFIG_UNCODEDFRAMECRC_MUXER 0
-#define CONFIG_VC1_MUXER 0
-#define CONFIG_VC1T_MUXER 0
-#define CONFIG_VOC_MUXER 0
-#define CONFIG_W64_MUXER 0
-#define CONFIG_WAV_MUXER 0
-#define CONFIG_WEBM_MUXER 0
-#define CONFIG_WEBM_DASH_MANIFEST_MUXER 0
-#define CONFIG_WEBM_CHUNK_MUXER 0
-#define CONFIG_WEBP_MUXER 0
-#define CONFIG_WEBVTT_MUXER 0
-#define CONFIG_WTV_MUXER 0
-#define CONFIG_WV_MUXER 0
-#define CONFIG_YUV4MPEGPIPE_MUXER 0
-#define CONFIG_CHROMAPRINT_MUXER 0
-#define CONFIG_LIBNUT_MUXER 0
-#define CONFIG_ALSA_OUTDEV 0
-#define CONFIG_CACA_OUTDEV 0
-#define CONFIG_DECKLINK_OUTDEV 0
-#define CONFIG_FBDEV_OUTDEV 0
-#define CONFIG_OPENGL_OUTDEV 0
-#define CONFIG_OSS_OUTDEV 0
-#define CONFIG_PULSE_OUTDEV 0
-#define CONFIG_SDL2_OUTDEV 0
-#define CONFIG_SNDIO_OUTDEV 0
-#define CONFIG_V4L2_OUTDEV 0
-#define CONFIG_XV_OUTDEV 0
-#define CONFIG_AAC_PARSER 0
-#define CONFIG_AAC_LATM_PARSER 0
-#define CONFIG_AC3_PARSER 0
-#define CONFIG_ADX_PARSER 0
-#define CONFIG_BMP_PARSER 0
-#define CONFIG_CAVSVIDEO_PARSER 0
-#define CONFIG_COOK_PARSER 0
-#define CONFIG_DCA_PARSER 0
-#define CONFIG_DIRAC_PARSER 0
-#define CONFIG_DNXHD_PARSER 0
-#define CONFIG_DPX_PARSER 0
-#define CONFIG_DVAUDIO_PARSER 0
-#define CONFIG_DVBSUB_PARSER 0
-#define CONFIG_DVDSUB_PARSER 0
-#define CONFIG_DVD_NAV_PARSER 0
#define CONFIG_FLAC_PARSER 1
-#define CONFIG_G729_PARSER 0
-#define CONFIG_GSM_PARSER 0
-#define CONFIG_H261_PARSER 0
-#define CONFIG_H263_PARSER 0
-#define CONFIG_H264_PARSER 0
-#define CONFIG_HEVC_PARSER 0
-#define CONFIG_MJPEG_PARSER 0
-#define CONFIG_MLP_PARSER 0
-#define CONFIG_MPEG4VIDEO_PARSER 0
-#define CONFIG_MPEGAUDIO_PARSER 0
-#define CONFIG_MPEGVIDEO_PARSER 0
-#define CONFIG_OPUS_PARSER 0
-#define CONFIG_PNG_PARSER 0
-#define CONFIG_PNM_PARSER 0
-#define CONFIG_RV30_PARSER 0
-#define CONFIG_RV40_PARSER 0
-#define CONFIG_TAK_PARSER 0
-#define CONFIG_VC1_PARSER 0
-#define CONFIG_VORBIS_PARSER 0
-#define CONFIG_VP3_PARSER 0
#define CONFIG_VP8_PARSER 1
#define CONFIG_VP9_PARSER 1
-#define CONFIG_ASYNC_PROTOCOL 0
-#define CONFIG_BLURAY_PROTOCOL 0
-#define CONFIG_CACHE_PROTOCOL 0
-#define CONFIG_CONCAT_PROTOCOL 0
-#define CONFIG_CRYPTO_PROTOCOL 0
-#define CONFIG_DATA_PROTOCOL 0
-#define CONFIG_FFRTMPCRYPT_PROTOCOL 0
-#define CONFIG_FFRTMPHTTP_PROTOCOL 0
-#define CONFIG_FILE_PROTOCOL 0
-#define CONFIG_FTP_PROTOCOL 0
-#define CONFIG_GOPHER_PROTOCOL 0
-#define CONFIG_HLS_PROTOCOL 0
-#define CONFIG_HTTP_PROTOCOL 0
-#define CONFIG_HTTPPROXY_PROTOCOL 0
-#define CONFIG_HTTPS_PROTOCOL 0
-#define CONFIG_ICECAST_PROTOCOL 0
-#define CONFIG_MMSH_PROTOCOL 0
-#define CONFIG_MMST_PROTOCOL 0
-#define CONFIG_MD5_PROTOCOL 0
-#define CONFIG_PIPE_PROTOCOL 0
-#define CONFIG_RTMP_PROTOCOL 0
-#define CONFIG_RTMPE_PROTOCOL 0
-#define CONFIG_RTMPS_PROTOCOL 0
-#define CONFIG_RTMPT_PROTOCOL 0
-#define CONFIG_RTMPTE_PROTOCOL 0
-#define CONFIG_RTMPTS_PROTOCOL 0
-#define CONFIG_RTP_PROTOCOL 0
-#define CONFIG_SCTP_PROTOCOL 0
-#define CONFIG_SRTP_PROTOCOL 0
-#define CONFIG_SUBFILE_PROTOCOL 0
-#define CONFIG_TEE_PROTOCOL 0
-#define CONFIG_TCP_PROTOCOL 0
-#define CONFIG_TLS_GNUTLS_PROTOCOL 0
-#define CONFIG_TLS_SCHANNEL_PROTOCOL 0
-#define CONFIG_TLS_SECURETRANSPORT_PROTOCOL 0
-#define CONFIG_TLS_OPENSSL_PROTOCOL 0
-#define CONFIG_UDP_PROTOCOL 0
-#define CONFIG_UDPLITE_PROTOCOL 0
-#define CONFIG_UNIX_PROTOCOL 0
-#define CONFIG_LIBRTMP_PROTOCOL 0
-#define CONFIG_LIBRTMPE_PROTOCOL 0
-#define CONFIG_LIBRTMPS_PROTOCOL 0
-#define CONFIG_LIBRTMPT_PROTOCOL 0
-#define CONFIG_LIBRTMPTE_PROTOCOL 0
-#define CONFIG_LIBSSH_PROTOCOL 0
-#define CONFIG_LIBSMBCLIENT_PROTOCOL 0
#endif /* FFMPEG_CONFIG_H */
diff --git a/media/ffvpx/config_darwin64.asm b/media/ffvpx/config_darwin64.asm
index 0e386ee143..7eccf378eb 100644
--- a/media/ffvpx/config_darwin64.asm
+++ b/media/ffvpx/config_darwin64.asm
@@ -63,8 +63,8 @@
%define HAVE_MIPSDSP 0
%define HAVE_MIPSDSPR2 0
%define HAVE_MSA 0
-%define HAVE_LOONGSON2 1
-%define HAVE_LOONGSON3 1
+%define HAVE_LOONGSON2 0
+%define HAVE_LOONGSON3 0
%define HAVE_MMI 0
%define HAVE_ARMV5TE_EXTERNAL 0
%define HAVE_ARMV6_EXTERNAL 0
@@ -162,32 +162,33 @@
%define HAVE_LOCAL_ALIGNED_16 1
%define HAVE_LOCAL_ALIGNED_32 1
%define HAVE_SIMD_ALIGN_16 1
+%define HAVE_SIMD_ALIGN_32 1
%define HAVE_ATOMICS_GCC 1
%define HAVE_ATOMICS_SUNCC 0
%define HAVE_ATOMICS_WIN32 0
%define HAVE_ATOMIC_CAS_PTR 0
-%define HAVE_ATOMIC_COMPARE_EXCHANGE 1
%define HAVE_MACHINE_RW_BARRIER 0
%define HAVE_MEMORYBARRIER 0
%define HAVE_MM_EMPTY 1
%define HAVE_RDTSC 0
%define HAVE_SARESTART 1
-%define HAVE_SEM_TIMEDWAIT 1
+%define HAVE_SEM_TIMEDWAIT 0
%define HAVE_SYNC_VAL_COMPARE_AND_SWAP 1
%define HAVE_CABS 1
%define HAVE_CEXP 1
%define HAVE_INLINE_ASM 1
%define HAVE_SYMVER 1
-%define HAVE_YASM 1
+%define HAVE_X86ASM 1
%define HAVE_BIGENDIAN 0
%define HAVE_FAST_UNALIGNED 1
-%define HAVE_ALSA_ASOUNDLIB_H 0
%define HAVE_ALTIVEC_H 0
%define HAVE_ARPA_INET_H 1
%define HAVE_ASM_TYPES_H 0
%define HAVE_CDIO_PARANOIA_H 0
%define HAVE_CDIO_PARANOIA_PARANOIA_H 0
-%define HAVE_DISPATCH_DISPATCH_H 0
+%define HAVE_CUDA_H 0
+%define HAVE_D3D11_H 0
+%define HAVE_DISPATCH_DISPATCH_H 1
%define HAVE_DEV_BKTR_IOCTL_BT848_H 0
%define HAVE_DEV_BKTR_IOCTL_METEOR_H 0
%define HAVE_DEV_IC_BT8XX_H 0
@@ -196,7 +197,7 @@
%define HAVE_DIRECT_H 0
%define HAVE_DIRENT_H 1
%define HAVE_DLFCN_H 1
-%define HAVE_D3D11_H 0
+%define HAVE_DXGIDEBUG_H 0
%define HAVE_DXVA_H 0
%define HAVE_ES2_GL_H 0
%define HAVE_GSM_H 0
@@ -205,13 +206,15 @@
%define HAVE_MACHINE_IOCTL_BT848_H 0
%define HAVE_MACHINE_IOCTL_METEOR_H 0
%define HAVE_OPENCV2_CORE_CORE_C_H 0
+%define HAVE_OPENJPEG_2_3_OPENJPEG_H 0
+%define HAVE_OPENJPEG_2_2_OPENJPEG_H 0
%define HAVE_OPENJPEG_2_1_OPENJPEG_H 0
%define HAVE_OPENJPEG_2_0_OPENJPEG_H 0
%define HAVE_OPENJPEG_1_5_OPENJPEG_H 0
%define HAVE_OPENGL_GL3_H 0
%define HAVE_POLL_H 1
-%define HAVE_SNDIO_H 0
%define HAVE_SOUNDCARD_H 0
+%define HAVE_STDATOMIC_H 1
%define HAVE_SYS_MMAN_H 1
%define HAVE_SYS_PARAM_H 1
%define HAVE_SYS_RESOURCE_H 1
@@ -258,12 +261,11 @@
%define HAVE_TRUNCF 1
%define HAVE_ACCESS 1
%define HAVE_ALIGNED_MALLOC 0
-%define HAVE_CLOCK_GETTIME 0
+%define HAVE_CLOCK_GETTIME 1
%define HAVE_CLOSESOCKET 0
%define HAVE_COMMANDLINETOARGVW 0
%define HAVE_COTASKMEMFREE 0
%define HAVE_CRYPTGENRANDOM 0
-%define HAVE_DLOPEN 1
%define HAVE_FCNTL 1
%define HAVE_FLT_LIM 1
%define HAVE_FORK 1
@@ -304,18 +306,20 @@
%define HAVE_SYSCONF 1
%define HAVE_SYSCTL 1
%define HAVE_USLEEP 1
-%define HAVE_UTGETOSTYPEFROMSTRING 1
+%define HAVE_UTGETOSTYPEFROMSTRING 0
%define HAVE_VIRTUALALLOC 0
%define HAVE_WGLGETPROCADDRESS 0
%define HAVE_PTHREADS 1
%define HAVE_OS2THREADS 0
%define HAVE_W32THREADS 0
%define HAVE_AS_DN_DIRECTIVE 0
+%define HAVE_AS_FPU_DIRECTIVE 0
%define HAVE_AS_FUNC 0
%define HAVE_AS_OBJECT_ARCH 0
%define HAVE_ASM_MOD_Q 0
%define HAVE_ATTRIBUTE_MAY_ALIAS 1
%define HAVE_ATTRIBUTE_PACKED 1
+%define HAVE_BLOCKS_EXTENSION 1
%define HAVE_EBP_AVAILABLE 1
%define HAVE_EBX_AVAILABLE 1
%define HAVE_GNU_AS 0
@@ -332,6 +336,7 @@
%define HAVE_XFORM_ASM 0
%define HAVE_XMM_CLOBBERS 1
%define HAVE_CONDITION_VARIABLE_PTR 0
+%define HAVE_KCMVIDEOCODECTYPE_HEVC 0
%define HAVE_SOCKLEN_T 1
%define HAVE_STRUCT_ADDRINFO 1
%define HAVE_STRUCT_GROUP_SOURCE_REQ 1
@@ -348,50 +353,38 @@
%define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 0
%define HAVE_ATOMICS_NATIVE 1
%define HAVE_DOS_PATHS 0
-%define HAVE_DXVA2_LIB 0
-%define HAVE_DXVA2API_COBJ 0
%define HAVE_LIBC_MSVCRT 0
-%define HAVE_LIBDC1394_1 0
-%define HAVE_LIBDC1394_2 0
%define HAVE_MAKEINFO 1
-%define HAVE_MAKEINFO_HTML 1
+%define HAVE_MAKEINFO_HTML 0
%define HAVE_MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS 0
%define HAVE_PERL 1
%define HAVE_POD2MAN 1
-%define HAVE_SDL2 0
%define HAVE_SECTION_DATA_REL_RO 0
%define HAVE_TEXI2HTML 0
%define HAVE_THREADS 1
+%define HAVE_UWP 0
%define HAVE_VAAPI_DRM 0
%define HAVE_VAAPI_X11 0
%define HAVE_VDPAU_X11 0
%define HAVE_WINRT 0
-%define HAVE_XLIB 0
-%define CONFIG_BSFS 0
-%define CONFIG_DECODERS 1
-%define CONFIG_ENCODERS 0
-%define CONFIG_HWACCELS 0
-%define CONFIG_PARSERS 1
-%define CONFIG_INDEVS 0
-%define CONFIG_OUTDEVS 0
-%define CONFIG_FILTERS 0
-%define CONFIG_DEMUXERS 0
-%define CONFIG_MUXERS 0
-%define CONFIG_PROTOCOLS 0
%define CONFIG_DOC 0
-%define CONFIG_HTMLPAGES 1
+%define CONFIG_HTMLPAGES 0
%define CONFIG_MANPAGES 1
%define CONFIG_PODPAGES 1
%define CONFIG_TXTPAGES 1
%define CONFIG_AVIO_DIR_CMD_EXAMPLE 1
%define CONFIG_AVIO_READING_EXAMPLE 1
-%define CONFIG_DECODING_ENCODING_EXAMPLE 0
+%define CONFIG_DECODE_AUDIO_EXAMPLE 1
+%define CONFIG_DECODE_VIDEO_EXAMPLE 1
%define CONFIG_DEMUXING_DECODING_EXAMPLE 0
+%define CONFIG_ENCODE_AUDIO_EXAMPLE 1
+%define CONFIG_ENCODE_VIDEO_EXAMPLE 1
%define CONFIG_EXTRACT_MVS_EXAMPLE 0
%define CONFIG_FILTER_AUDIO_EXAMPLE 0
%define CONFIG_FILTERING_AUDIO_EXAMPLE 0
%define CONFIG_FILTERING_VIDEO_EXAMPLE 0
%define CONFIG_HTTP_MULTICLIENT_EXAMPLE 0
+%define CONFIG_HW_DECODE_EXAMPLE 0
%define CONFIG_METADATA_EXAMPLE 0
%define CONFIG_MUXING_EXAMPLE 0
%define CONFIG_QSVDEC_EXAMPLE 0
@@ -400,27 +393,55 @@
%define CONFIG_SCALING_VIDEO_EXAMPLE 0
%define CONFIG_TRANSCODE_AAC_EXAMPLE 0
%define CONFIG_TRANSCODING_EXAMPLE 0
+%define CONFIG_ALSA 0
+%define CONFIG_APPKIT 1
+%define CONFIG_AVFOUNDATION 1
+%define CONFIG_BZLIB 1
+%define CONFIG_COREIMAGE 1
+%define CONFIG_ICONV 0
+%define CONFIG_JACK 0
+%define CONFIG_LIBXCB 0
+%define CONFIG_LIBXCB_SHM 0
+%define CONFIG_LIBXCB_SHAPE 0
+%define CONFIG_LIBXCB_XFIXES 0
+%define CONFIG_LZMA 0
+%define CONFIG_SCHANNEL 0
+%define CONFIG_SDL2 0
+%define CONFIG_SECURETRANSPORT 0
+%define CONFIG_SNDIO 0
+%define CONFIG_XLIB 1
+%define CONFIG_ZLIB 1
%define CONFIG_AVISYNTH 0
-%define CONFIG_BZLIB 0
-%define CONFIG_CHROMAPRINT 0
-%define CONFIG_CRYSTALHD 0
-%define CONFIG_DECKLINK 0
%define CONFIG_FREI0R 0
-%define CONFIG_GCRYPT 0
+%define CONFIG_LIBCDIO 0
+%define CONFIG_LIBRUBBERBAND 0
+%define CONFIG_LIBVIDSTAB 0
+%define CONFIG_LIBX264 0
+%define CONFIG_LIBX265 0
+%define CONFIG_LIBXAVS 0
+%define CONFIG_LIBXVID 0
+%define CONFIG_DECKLINK 0
+%define CONFIG_LIBNDI_NEWTEK 0
+%define CONFIG_LIBFDK_AAC 0
+%define CONFIG_OPENSSL 0
%define CONFIG_GMP 0
+%define CONFIG_LIBOPENCORE_AMRNB 0
+%define CONFIG_LIBOPENCORE_AMRWB 0
+%define CONFIG_LIBVO_AMRWBENC 0
+%define CONFIG_RKMPP 0
+%define CONFIG_LIBSMBCLIENT 0
+%define CONFIG_CHROMAPRINT 0
+%define CONFIG_GCRYPT 0
%define CONFIG_GNUTLS 0
-%define CONFIG_ICONV 0
%define CONFIG_JNI 0
%define CONFIG_LADSPA 0
%define CONFIG_LIBASS 0
%define CONFIG_LIBBLURAY 0
%define CONFIG_LIBBS2B 0
%define CONFIG_LIBCACA 0
-%define CONFIG_LIBCDIO 0
%define CONFIG_LIBCELT 0
%define CONFIG_LIBDC1394 0
-%define CONFIG_LIBEBUR128 0
-%define CONFIG_LIBFDK_AAC 0
+%define CONFIG_LIBDRM 0
%define CONFIG_LIBFLITE 0
%define CONFIG_LIBFONTCONFIG 0
%define CONFIG_LIBFREETYPE 0
@@ -432,18 +453,15 @@
%define CONFIG_LIBKVAZAAR 0
%define CONFIG_LIBMODPLUG 0
%define CONFIG_LIBMP3LAME 0
-%define CONFIG_LIBNUT 0
-%define CONFIG_LIBOPENCORE_AMRNB 0
-%define CONFIG_LIBOPENCORE_AMRWB 0
+%define CONFIG_LIBMYSOFA 0
%define CONFIG_LIBOPENCV 0
%define CONFIG_LIBOPENH264 0
%define CONFIG_LIBOPENJPEG 0
%define CONFIG_LIBOPENMPT 0
%define CONFIG_LIBOPUS 0
%define CONFIG_LIBPULSE 0
+%define CONFIG_LIBRSVG 0
%define CONFIG_LIBRTMP 0
-%define CONFIG_LIBRUBBERBAND 0
-%define CONFIG_LIBSCHROEDINGER 0
%define CONFIG_LIBSHINE 0
%define CONFIG_LIBSMBCLIENT 0
%define CONFIG_LIBSNAPPY 0
@@ -454,53 +472,37 @@
%define CONFIG_LIBTHEORA 0
%define CONFIG_LIBTWOLAME 0
%define CONFIG_LIBV4L2 0
-%define CONFIG_LIBVIDSTAB 0
-%define CONFIG_LIBVO_AMRWBENC 0
+%define CONFIG_LIBVMAF 0
%define CONFIG_LIBVORBIS 0
%define CONFIG_LIBVPX 0
%define CONFIG_LIBWAVPACK 0
%define CONFIG_LIBWEBP 0
-%define CONFIG_LIBX264 0
-%define CONFIG_LIBX265 0
-%define CONFIG_LIBXAVS 0
-%define CONFIG_LIBXCB 0
-%define CONFIG_LIBXCB_SHM 0
-%define CONFIG_LIBXCB_SHAPE 0
-%define CONFIG_LIBXCB_XFIXES 0
-%define CONFIG_LIBXVID 0
+%define CONFIG_LIBXML2 0
%define CONFIG_LIBZIMG 0
%define CONFIG_LIBZMQ 0
%define CONFIG_LIBZVBI 0
-%define CONFIG_LZMA 0
%define CONFIG_MEDIACODEC 0
-%define CONFIG_NETCDF 0
%define CONFIG_OPENAL 0
%define CONFIG_OPENCL 0
%define CONFIG_OPENGL 0
-%define CONFIG_OPENSSL 0
-%define CONFIG_SCHANNEL 0
-%define CONFIG_SDL 0
-%define CONFIG_SDL2 0
-%define CONFIG_SECURETRANSPORT 0
-%define CONFIG_VIDEOTOOLBOX 0
-%define CONFIG_X11GRAB 0
-%define CONFIG_XLIB 0
-%define CONFIG_ZLIB 0
-%define CONFIG_AUDIOTOOLBOX 0
+%define CONFIG_AUDIOTOOLBOX 1
+%define CONFIG_CRYSTALHD 0
%define CONFIG_CUDA 0
%define CONFIG_CUVID 0
%define CONFIG_D3D11VA 0
%define CONFIG_DXVA2 0
-%define CONFIG_LIBMFX 0
-%define CONFIG_LIBNPP 0
-%define CONFIG_MMAL 0
%define CONFIG_NVENC 0
-%define CONFIG_OMX 0
%define CONFIG_VAAPI 0
%define CONFIG_VDA 0
%define CONFIG_VDPAU 0
-%define CONFIG_VIDEOTOOLBOX_HWACCEL 0
+%define CONFIG_VIDEOTOOLBOX 0
+%define CONFIG_V4L2_M2M 0
%define CONFIG_XVMC 0
+%define CONFIG_CUDA_SDK 0
+%define CONFIG_LIBNPP 0
+%define CONFIG_LIBMFX 0
+%define CONFIG_MMAL 0
+%define CONFIG_OMX 0
%define CONFIG_FTRAPV 0
%define CONFIG_GRAY 0
%define CONFIG_HARDCODED_TABLES 0
@@ -539,16 +541,27 @@
%define CONFIG_PIXELUTILS 0
%define CONFIG_NETWORK 0
%define CONFIG_RDFT 0
+%define CONFIG_AUTODETECT 0
%define CONFIG_FONTCONFIG 0
-%define CONFIG_MEMALIGN_HACK 0
+%define CONFIG_LINUX_PERF 0
%define CONFIG_MEMORY_POISONING 0
%define CONFIG_NEON_CLOBBER_TEST 0
+%define CONFIG_OSSFUZZ 0
%define CONFIG_PIC 1
-%define CONFIG_POD2MAN 1
-%define CONFIG_RAISE_MAJOR 0
%define CONFIG_THUMB 0
%define CONFIG_VALGRIND_BACKTRACE 0
%define CONFIG_XMM_CLOBBER_TEST 0
+%define CONFIG_BSFS 1
+%define CONFIG_DECODERS 1
+%define CONFIG_ENCODERS 0
+%define CONFIG_HWACCELS 0
+%define CONFIG_PARSERS 1
+%define CONFIG_INDEVS 0
+%define CONFIG_OUTDEVS 0
+%define CONFIG_FILTERS 0
+%define CONFIG_DEMUXERS 0
+%define CONFIG_MUXERS 0
+%define CONFIG_PROTOCOLS 0
%define CONFIG_AANDCTTABLES 0
%define CONFIG_AC3DSP 0
%define CONFIG_AUDIO_FRAME_QUEUE 0
@@ -566,20 +579,22 @@
%define CONFIG_FMTCONVERT 0
%define CONFIG_FRAME_THREAD_ENCODER 0
%define CONFIG_G722DSP 0
-%define CONFIG_GOLOMB 1
+%define CONFIG_GOLOMB 0
%define CONFIG_GPLV3 0
%define CONFIG_H263DSP 0
%define CONFIG_H264CHROMA 0
%define CONFIG_H264DSP 0
+%define CONFIG_H264PARSE 0
%define CONFIG_H264PRED 1
%define CONFIG_H264QPEL 0
+%define CONFIG_HEVCPARSE 0
%define CONFIG_HPELDSP 0
%define CONFIG_HUFFMAN 0
%define CONFIG_HUFFYUVDSP 0
%define CONFIG_HUFFYUVENCDSP 0
%define CONFIG_IDCTDSP 0
%define CONFIG_IIRFILTER 0
-%define CONFIG_IMDCT15 0
+%define CONFIG_MDCT15 0
%define CONFIG_INTRAX8 0
%define CONFIG_ISO_MEDIA 0
%define CONFIG_IVIDSP 0
@@ -588,12 +603,14 @@
%define CONFIG_LIBX262 0
%define CONFIG_LLAUDDSP 0
%define CONFIG_LLVIDDSP 0
+%define CONFIG_LLVIDENCDSP 0
%define CONFIG_LPC 0
%define CONFIG_LZF 0
%define CONFIG_ME_CMP 0
%define CONFIG_MPEG_ER 0
%define CONFIG_MPEGAUDIO 0
%define CONFIG_MPEGAUDIODSP 0
+%define CONFIG_MPEGAUDIOHEADER 0
%define CONFIG_MPEGVIDEO 0
%define CONFIG_MPEGVIDEOENC 0
%define CONFIG_MSS34DSP 0
@@ -615,1594 +632,19 @@
%define CONFIG_TEXTUREDSP 0
%define CONFIG_TEXTUREDSPENC 0
%define CONFIG_TPELDSP 0
+%define CONFIG_VAAPI_1 0
%define CONFIG_VAAPI_ENCODE 0
%define CONFIG_VC1DSP 0
%define CONFIG_VIDEODSP 1
%define CONFIG_VP3DSP 0
%define CONFIG_VP56DSP 0
%define CONFIG_VP8DSP 1
-%define CONFIG_VT_BT2020 0
%define CONFIG_WMA_FREQS 0
%define CONFIG_WMV2DSP 0
-%define CONFIG_AAC_ADTSTOASC_BSF 0
-%define CONFIG_CHOMP_BSF 0
-%define CONFIG_DUMP_EXTRADATA_BSF 0
-%define CONFIG_DCA_CORE_BSF 0
-%define CONFIG_H264_MP4TOANNEXB_BSF 0
-%define CONFIG_HEVC_MP4TOANNEXB_BSF 0
-%define CONFIG_IMX_DUMP_HEADER_BSF 0
-%define CONFIG_MJPEG2JPEG_BSF 0
-%define CONFIG_MJPEGA_DUMP_HEADER_BSF 0
-%define CONFIG_MP3_HEADER_DECOMPRESS_BSF 0
-%define CONFIG_MPEG4_UNPACK_BFRAMES_BSF 0
-%define CONFIG_MOV2TEXTSUB_BSF 0
-%define CONFIG_NOISE_BSF 0
-%define CONFIG_REMOVE_EXTRADATA_BSF 0
-%define CONFIG_TEXT2MOVSUB_BSF 0
-%define CONFIG_VP9_SUPERFRAME_BSF 0
-%define CONFIG_AASC_DECODER 0
-%define CONFIG_AIC_DECODER 0
-%define CONFIG_ALIAS_PIX_DECODER 0
-%define CONFIG_AMV_DECODER 0
-%define CONFIG_ANM_DECODER 0
-%define CONFIG_ANSI_DECODER 0
-%define CONFIG_APNG_DECODER 0
-%define CONFIG_ASV1_DECODER 0
-%define CONFIG_ASV2_DECODER 0
-%define CONFIG_AURA_DECODER 0
-%define CONFIG_AURA2_DECODER 0
-%define CONFIG_AVRP_DECODER 0
-%define CONFIG_AVRN_DECODER 0
-%define CONFIG_AVS_DECODER 0
-%define CONFIG_AVUI_DECODER 0
-%define CONFIG_AYUV_DECODER 0
-%define CONFIG_BETHSOFTVID_DECODER 0
-%define CONFIG_BFI_DECODER 0
-%define CONFIG_BINK_DECODER 0
-%define CONFIG_BMP_DECODER 0
-%define CONFIG_BMV_VIDEO_DECODER 0
-%define CONFIG_BRENDER_PIX_DECODER 0
-%define CONFIG_C93_DECODER 0
-%define CONFIG_CAVS_DECODER 0
-%define CONFIG_CDGRAPHICS_DECODER 0
-%define CONFIG_CDXL_DECODER 0
-%define CONFIG_CFHD_DECODER 0
-%define CONFIG_CINEPAK_DECODER 0
-%define CONFIG_CLJR_DECODER 0
-%define CONFIG_CLLC_DECODER 0
-%define CONFIG_COMFORTNOISE_DECODER 0
-%define CONFIG_CPIA_DECODER 0
-%define CONFIG_CSCD_DECODER 0
-%define CONFIG_CYUV_DECODER 0
-%define CONFIG_DDS_DECODER 0
-%define CONFIG_DFA_DECODER 0
-%define CONFIG_DIRAC_DECODER 0
-%define CONFIG_DNXHD_DECODER 0
-%define CONFIG_DPX_DECODER 0
-%define CONFIG_DSICINVIDEO_DECODER 0
-%define CONFIG_DVAUDIO_DECODER 0
-%define CONFIG_DVVIDEO_DECODER 0
-%define CONFIG_DXA_DECODER 0
-%define CONFIG_DXTORY_DECODER 0
-%define CONFIG_DXV_DECODER 0
-%define CONFIG_EACMV_DECODER 0
-%define CONFIG_EAMAD_DECODER 0
-%define CONFIG_EATGQ_DECODER 0
-%define CONFIG_EATGV_DECODER 0
-%define CONFIG_EATQI_DECODER 0
-%define CONFIG_EIGHTBPS_DECODER 0
-%define CONFIG_EIGHTSVX_EXP_DECODER 0
-%define CONFIG_EIGHTSVX_FIB_DECODER 0
-%define CONFIG_ESCAPE124_DECODER 0
-%define CONFIG_ESCAPE130_DECODER 0
-%define CONFIG_EXR_DECODER 0
-%define CONFIG_FFV1_DECODER 0
-%define CONFIG_FFVHUFF_DECODER 0
-%define CONFIG_FIC_DECODER 0
-%define CONFIG_FLASHSV_DECODER 0
-%define CONFIG_FLASHSV2_DECODER 0
-%define CONFIG_FLIC_DECODER 0
-%define CONFIG_FLV_DECODER 0
-%define CONFIG_FOURXM_DECODER 0
-%define CONFIG_FRAPS_DECODER 0
-%define CONFIG_FRWU_DECODER 0
-%define CONFIG_G2M_DECODER 0
-%define CONFIG_GIF_DECODER 0
-%define CONFIG_H261_DECODER 0
-%define CONFIG_H263_DECODER 0
-%define CONFIG_H263I_DECODER 0
-%define CONFIG_H263P_DECODER 0
-%define CONFIG_H264_DECODER 0
-%define CONFIG_H264_CRYSTALHD_DECODER 0
-%define CONFIG_H264_MEDIACODEC_DECODER 0
-%define CONFIG_H264_MMAL_DECODER 0
-%define CONFIG_H264_QSV_DECODER 0
-%define CONFIG_H264_VDA_DECODER 0
-%define CONFIG_H264_VDPAU_DECODER 0
-%define CONFIG_HAP_DECODER 0
-%define CONFIG_HEVC_DECODER 0
-%define CONFIG_HEVC_QSV_DECODER 0
-%define CONFIG_HNM4_VIDEO_DECODER 0
-%define CONFIG_HQ_HQA_DECODER 0
-%define CONFIG_HQX_DECODER 0
-%define CONFIG_HUFFYUV_DECODER 0
-%define CONFIG_IDCIN_DECODER 0
-%define CONFIG_IFF_ILBM_DECODER 0
-%define CONFIG_INDEO2_DECODER 0
-%define CONFIG_INDEO3_DECODER 0
-%define CONFIG_INDEO4_DECODER 0
-%define CONFIG_INDEO5_DECODER 0
-%define CONFIG_INTERPLAY_VIDEO_DECODER 0
-%define CONFIG_JPEG2000_DECODER 0
-%define CONFIG_JPEGLS_DECODER 0
-%define CONFIG_JV_DECODER 0
-%define CONFIG_KGV1_DECODER 0
-%define CONFIG_KMVC_DECODER 0
-%define CONFIG_LAGARITH_DECODER 0
-%define CONFIG_LOCO_DECODER 0
-%define CONFIG_M101_DECODER 0
-%define CONFIG_MAGICYUV_DECODER 0
-%define CONFIG_MDEC_DECODER 0
-%define CONFIG_MIMIC_DECODER 0
-%define CONFIG_MJPEG_DECODER 0
-%define CONFIG_MJPEGB_DECODER 0
-%define CONFIG_MMVIDEO_DECODER 0
-%define CONFIG_MOTIONPIXELS_DECODER 0
-%define CONFIG_MPEG_XVMC_DECODER 0
-%define CONFIG_MPEG1VIDEO_DECODER 0
-%define CONFIG_MPEG2VIDEO_DECODER 0
-%define CONFIG_MPEG4_DECODER 0
-%define CONFIG_MPEG4_CRYSTALHD_DECODER 0
-%define CONFIG_MPEG4_MMAL_DECODER 0
-%define CONFIG_MPEG4_VDPAU_DECODER 0
-%define CONFIG_MPEGVIDEO_DECODER 0
-%define CONFIG_MPEG_VDPAU_DECODER 0
-%define CONFIG_MPEG1_VDPAU_DECODER 0
-%define CONFIG_MPEG2_MMAL_DECODER 0
-%define CONFIG_MPEG2_CRYSTALHD_DECODER 0
-%define CONFIG_MPEG2_QSV_DECODER 0
-%define CONFIG_MSA1_DECODER 0
-%define CONFIG_MSMPEG4_CRYSTALHD_DECODER 0
-%define CONFIG_MSMPEG4V1_DECODER 0
-%define CONFIG_MSMPEG4V2_DECODER 0
-%define CONFIG_MSMPEG4V3_DECODER 0
-%define CONFIG_MSRLE_DECODER 0
-%define CONFIG_MSS1_DECODER 0
-%define CONFIG_MSS2_DECODER 0
-%define CONFIG_MSVIDEO1_DECODER 0
-%define CONFIG_MSZH_DECODER 0
-%define CONFIG_MTS2_DECODER 0
-%define CONFIG_MVC1_DECODER 0
-%define CONFIG_MVC2_DECODER 0
-%define CONFIG_MXPEG_DECODER 0
-%define CONFIG_NUV_DECODER 0
-%define CONFIG_PAF_VIDEO_DECODER 0
-%define CONFIG_PAM_DECODER 0
-%define CONFIG_PBM_DECODER 0
-%define CONFIG_PCX_DECODER 0
-%define CONFIG_PGM_DECODER 0
-%define CONFIG_PGMYUV_DECODER 0
-%define CONFIG_PICTOR_DECODER 0
-%define CONFIG_PNG_DECODER 0
-%define CONFIG_PPM_DECODER 0
-%define CONFIG_PRORES_DECODER 0
-%define CONFIG_PRORES_LGPL_DECODER 0
-%define CONFIG_PTX_DECODER 0
-%define CONFIG_QDRAW_DECODER 0
-%define CONFIG_QPEG_DECODER 0
-%define CONFIG_QTRLE_DECODER 0
-%define CONFIG_R10K_DECODER 0
-%define CONFIG_R210_DECODER 0
-%define CONFIG_RAWVIDEO_DECODER 0
-%define CONFIG_RL2_DECODER 0
-%define CONFIG_ROQ_DECODER 0
-%define CONFIG_RPZA_DECODER 0
-%define CONFIG_RSCC_DECODER 0
-%define CONFIG_RV10_DECODER 0
-%define CONFIG_RV20_DECODER 0
-%define CONFIG_RV30_DECODER 0
-%define CONFIG_RV40_DECODER 0
-%define CONFIG_S302M_DECODER 0
-%define CONFIG_SANM_DECODER 0
-%define CONFIG_SCREENPRESSO_DECODER 0
-%define CONFIG_SDX2_DPCM_DECODER 0
-%define CONFIG_SGI_DECODER 0
-%define CONFIG_SGIRLE_DECODER 0
-%define CONFIG_SHEERVIDEO_DECODER 0
-%define CONFIG_SMACKER_DECODER 0
-%define CONFIG_SMC_DECODER 0
-%define CONFIG_SMVJPEG_DECODER 0
-%define CONFIG_SNOW_DECODER 0
-%define CONFIG_SP5X_DECODER 0
-%define CONFIG_SUNRAST_DECODER 0
-%define CONFIG_SVQ1_DECODER 0
-%define CONFIG_SVQ3_DECODER 0
-%define CONFIG_TARGA_DECODER 0
-%define CONFIG_TARGA_Y216_DECODER 0
-%define CONFIG_TDSC_DECODER 0
-%define CONFIG_THEORA_DECODER 0
-%define CONFIG_THP_DECODER 0
-%define CONFIG_TIERTEXSEQVIDEO_DECODER 0
-%define CONFIG_TIFF_DECODER 0
-%define CONFIG_TMV_DECODER 0
-%define CONFIG_TRUEMOTION1_DECODER 0
-%define CONFIG_TRUEMOTION2_DECODER 0
-%define CONFIG_TRUEMOTION2RT_DECODER 0
-%define CONFIG_TSCC_DECODER 0
-%define CONFIG_TSCC2_DECODER 0
-%define CONFIG_TXD_DECODER 0
-%define CONFIG_ULTI_DECODER 0
-%define CONFIG_UTVIDEO_DECODER 0
-%define CONFIG_V210_DECODER 0
-%define CONFIG_V210X_DECODER 0
-%define CONFIG_V308_DECODER 0
-%define CONFIG_V408_DECODER 0
-%define CONFIG_V410_DECODER 0
-%define CONFIG_VB_DECODER 0
-%define CONFIG_VBLE_DECODER 0
-%define CONFIG_VC1_DECODER 0
-%define CONFIG_VC1_CRYSTALHD_DECODER 0
-%define CONFIG_VC1_VDPAU_DECODER 0
-%define CONFIG_VC1IMAGE_DECODER 0
-%define CONFIG_VC1_MMAL_DECODER 0
-%define CONFIG_VC1_QSV_DECODER 0
-%define CONFIG_VCR1_DECODER 0
-%define CONFIG_VMDVIDEO_DECODER 0
-%define CONFIG_VMNC_DECODER 0
-%define CONFIG_VP3_DECODER 0
-%define CONFIG_VP5_DECODER 0
-%define CONFIG_VP6_DECODER 0
-%define CONFIG_VP6A_DECODER 0
-%define CONFIG_VP6F_DECODER 0
-%define CONFIG_VP7_DECODER 0
+%define CONFIG_NULL_BSF 1
%define CONFIG_VP8_DECODER 1
%define CONFIG_VP9_DECODER 1
-%define CONFIG_VQA_DECODER 0
-%define CONFIG_WEBP_DECODER 0
-%define CONFIG_WMV1_DECODER 0
-%define CONFIG_WMV2_DECODER 0
-%define CONFIG_WMV3_DECODER 0
-%define CONFIG_WMV3_CRYSTALHD_DECODER 0
-%define CONFIG_WMV3_VDPAU_DECODER 0
-%define CONFIG_WMV3IMAGE_DECODER 0
-%define CONFIG_WNV1_DECODER 0
-%define CONFIG_XAN_WC3_DECODER 0
-%define CONFIG_XAN_WC4_DECODER 0
-%define CONFIG_XBM_DECODER 0
-%define CONFIG_XFACE_DECODER 0
-%define CONFIG_XL_DECODER 0
-%define CONFIG_XWD_DECODER 0
-%define CONFIG_Y41P_DECODER 0
-%define CONFIG_YLC_DECODER 0
-%define CONFIG_YOP_DECODER 0
-%define CONFIG_YUV4_DECODER 0
-%define CONFIG_ZERO12V_DECODER 0
-%define CONFIG_ZEROCODEC_DECODER 0
-%define CONFIG_ZLIB_DECODER 0
-%define CONFIG_ZMBV_DECODER 0
-%define CONFIG_AAC_DECODER 0
-%define CONFIG_AAC_FIXED_DECODER 0
-%define CONFIG_AAC_LATM_DECODER 0
-%define CONFIG_AC3_DECODER 0
-%define CONFIG_AC3_FIXED_DECODER 0
-%define CONFIG_ALAC_DECODER 0
-%define CONFIG_ALS_DECODER 0
-%define CONFIG_AMRNB_DECODER 0
-%define CONFIG_AMRWB_DECODER 0
-%define CONFIG_APE_DECODER 0
-%define CONFIG_ATRAC1_DECODER 0
-%define CONFIG_ATRAC3_DECODER 0
-%define CONFIG_ATRAC3P_DECODER 0
-%define CONFIG_BINKAUDIO_DCT_DECODER 0
-%define CONFIG_BINKAUDIO_RDFT_DECODER 0
-%define CONFIG_BMV_AUDIO_DECODER 0
-%define CONFIG_COOK_DECODER 0
-%define CONFIG_DCA_DECODER 0
-%define CONFIG_DSD_LSBF_DECODER 0
-%define CONFIG_DSD_MSBF_DECODER 0
-%define CONFIG_DSD_LSBF_PLANAR_DECODER 0
-%define CONFIG_DSD_MSBF_PLANAR_DECODER 0
-%define CONFIG_DSICINAUDIO_DECODER 0
-%define CONFIG_DSS_SP_DECODER 0
-%define CONFIG_DST_DECODER 0
-%define CONFIG_EAC3_DECODER 0
-%define CONFIG_EVRC_DECODER 0
-%define CONFIG_FFWAVESYNTH_DECODER 0
%define CONFIG_FLAC_DECODER 1
-%define CONFIG_G723_1_DECODER 0
-%define CONFIG_G729_DECODER 0
-%define CONFIG_GSM_DECODER 0
-%define CONFIG_GSM_MS_DECODER 0
-%define CONFIG_IAC_DECODER 0
-%define CONFIG_IMC_DECODER 0
-%define CONFIG_INTERPLAY_ACM_DECODER 0
-%define CONFIG_MACE3_DECODER 0
-%define CONFIG_MACE6_DECODER 0
-%define CONFIG_METASOUND_DECODER 0
-%define CONFIG_MLP_DECODER 0
-%define CONFIG_MP1_DECODER 0
-%define CONFIG_MP1FLOAT_DECODER 0
-%define CONFIG_MP2_DECODER 0
-%define CONFIG_MP2FLOAT_DECODER 0
-%define CONFIG_MP3_DECODER 0
-%define CONFIG_MP3FLOAT_DECODER 0
-%define CONFIG_MP3ADU_DECODER 0
-%define CONFIG_MP3ADUFLOAT_DECODER 0
-%define CONFIG_MP3ON4_DECODER 0
-%define CONFIG_MP3ON4FLOAT_DECODER 0
-%define CONFIG_MPC7_DECODER 0
-%define CONFIG_MPC8_DECODER 0
-%define CONFIG_NELLYMOSER_DECODER 0
-%define CONFIG_ON2AVC_DECODER 0
-%define CONFIG_OPUS_DECODER 0
-%define CONFIG_PAF_AUDIO_DECODER 0
-%define CONFIG_QCELP_DECODER 0
-%define CONFIG_QDM2_DECODER 0
-%define CONFIG_RA_144_DECODER 0
-%define CONFIG_RA_288_DECODER 0
-%define CONFIG_RALF_DECODER 0
-%define CONFIG_SHORTEN_DECODER 0
-%define CONFIG_SIPR_DECODER 0
-%define CONFIG_SMACKAUD_DECODER 0
-%define CONFIG_SONIC_DECODER 0
-%define CONFIG_TAK_DECODER 0
-%define CONFIG_TRUEHD_DECODER 0
-%define CONFIG_TRUESPEECH_DECODER 0
-%define CONFIG_TTA_DECODER 0
-%define CONFIG_TWINVQ_DECODER 0
-%define CONFIG_VMDAUDIO_DECODER 0
-%define CONFIG_VORBIS_DECODER 0
-%define CONFIG_WAVPACK_DECODER 0
-%define CONFIG_WMALOSSLESS_DECODER 0
-%define CONFIG_WMAPRO_DECODER 0
-%define CONFIG_WMAV1_DECODER 0
-%define CONFIG_WMAV2_DECODER 0
-%define CONFIG_WMAVOICE_DECODER 0
-%define CONFIG_WS_SND1_DECODER 0
-%define CONFIG_XMA1_DECODER 0
-%define CONFIG_XMA2_DECODER 0
-%define CONFIG_PCM_ALAW_DECODER 0
-%define CONFIG_PCM_BLURAY_DECODER 0
-%define CONFIG_PCM_DVD_DECODER 0
-%define CONFIG_PCM_F32BE_DECODER 0
-%define CONFIG_PCM_F32LE_DECODER 0
-%define CONFIG_PCM_F64BE_DECODER 0
-%define CONFIG_PCM_F64LE_DECODER 0
-%define CONFIG_PCM_LXF_DECODER 0
-%define CONFIG_PCM_MULAW_DECODER 0
-%define CONFIG_PCM_S8_DECODER 0
-%define CONFIG_PCM_S8_PLANAR_DECODER 0
-%define CONFIG_PCM_S16BE_DECODER 0
-%define CONFIG_PCM_S16BE_PLANAR_DECODER 0
-%define CONFIG_PCM_S16LE_DECODER 0
-%define CONFIG_PCM_S16LE_PLANAR_DECODER 0
-%define CONFIG_PCM_S24BE_DECODER 0
-%define CONFIG_PCM_S24DAUD_DECODER 0
-%define CONFIG_PCM_S24LE_DECODER 0
-%define CONFIG_PCM_S24LE_PLANAR_DECODER 0
-%define CONFIG_PCM_S32BE_DECODER 0
-%define CONFIG_PCM_S32LE_DECODER 0
-%define CONFIG_PCM_S32LE_PLANAR_DECODER 0
-%define CONFIG_PCM_S64BE_DECODER 0
-%define CONFIG_PCM_S64LE_DECODER 0
-%define CONFIG_PCM_U8_DECODER 0
-%define CONFIG_PCM_U16BE_DECODER 0
-%define CONFIG_PCM_U16LE_DECODER 0
-%define CONFIG_PCM_U24BE_DECODER 0
-%define CONFIG_PCM_U24LE_DECODER 0
-%define CONFIG_PCM_U32BE_DECODER 0
-%define CONFIG_PCM_U32LE_DECODER 0
-%define CONFIG_PCM_ZORK_DECODER 0
-%define CONFIG_INTERPLAY_DPCM_DECODER 0
-%define CONFIG_ROQ_DPCM_DECODER 0
-%define CONFIG_SOL_DPCM_DECODER 0
-%define CONFIG_XAN_DPCM_DECODER 0
-%define CONFIG_ADPCM_4XM_DECODER 0
-%define CONFIG_ADPCM_ADX_DECODER 0
-%define CONFIG_ADPCM_AFC_DECODER 0
-%define CONFIG_ADPCM_AICA_DECODER 0
-%define CONFIG_ADPCM_CT_DECODER 0
-%define CONFIG_ADPCM_DTK_DECODER 0
-%define CONFIG_ADPCM_EA_DECODER 0
-%define CONFIG_ADPCM_EA_MAXIS_XA_DECODER 0
-%define CONFIG_ADPCM_EA_R1_DECODER 0
-%define CONFIG_ADPCM_EA_R2_DECODER 0
-%define CONFIG_ADPCM_EA_R3_DECODER 0
-%define CONFIG_ADPCM_EA_XAS_DECODER 0
-%define CONFIG_ADPCM_G722_DECODER 0
-%define CONFIG_ADPCM_G726_DECODER 0
-%define CONFIG_ADPCM_G726LE_DECODER 0
-%define CONFIG_ADPCM_IMA_AMV_DECODER 0
-%define CONFIG_ADPCM_IMA_APC_DECODER 0
-%define CONFIG_ADPCM_IMA_DAT4_DECODER 0
-%define CONFIG_ADPCM_IMA_DK3_DECODER 0
-%define CONFIG_ADPCM_IMA_DK4_DECODER 0
-%define CONFIG_ADPCM_IMA_EA_EACS_DECODER 0
-%define CONFIG_ADPCM_IMA_EA_SEAD_DECODER 0
-%define CONFIG_ADPCM_IMA_ISS_DECODER 0
-%define CONFIG_ADPCM_IMA_OKI_DECODER 0
-%define CONFIG_ADPCM_IMA_QT_DECODER 0
-%define CONFIG_ADPCM_IMA_RAD_DECODER 0
-%define CONFIG_ADPCM_IMA_SMJPEG_DECODER 0
-%define CONFIG_ADPCM_IMA_WAV_DECODER 0
-%define CONFIG_ADPCM_IMA_WS_DECODER 0
-%define CONFIG_ADPCM_MS_DECODER 0
-%define CONFIG_ADPCM_MTAF_DECODER 0
-%define CONFIG_ADPCM_PSX_DECODER 0
-%define CONFIG_ADPCM_SBPRO_2_DECODER 0
-%define CONFIG_ADPCM_SBPRO_3_DECODER 0
-%define CONFIG_ADPCM_SBPRO_4_DECODER 0
-%define CONFIG_ADPCM_SWF_DECODER 0
-%define CONFIG_ADPCM_THP_DECODER 0
-%define CONFIG_ADPCM_THP_LE_DECODER 0
-%define CONFIG_ADPCM_VIMA_DECODER 0
-%define CONFIG_ADPCM_XA_DECODER 0
-%define CONFIG_ADPCM_YAMAHA_DECODER 0
-%define CONFIG_SSA_DECODER 0
-%define CONFIG_ASS_DECODER 0
-%define CONFIG_CCAPTION_DECODER 0
-%define CONFIG_DVBSUB_DECODER 0
-%define CONFIG_DVDSUB_DECODER 0
-%define CONFIG_JACOSUB_DECODER 0
-%define CONFIG_MICRODVD_DECODER 0
-%define CONFIG_MOVTEXT_DECODER 0
-%define CONFIG_MPL2_DECODER 0
-%define CONFIG_PGSSUB_DECODER 0
-%define CONFIG_PJS_DECODER 0
-%define CONFIG_REALTEXT_DECODER 0
-%define CONFIG_SAMI_DECODER 0
-%define CONFIG_SRT_DECODER 0
-%define CONFIG_STL_DECODER 0
-%define CONFIG_SUBRIP_DECODER 0
-%define CONFIG_SUBVIEWER_DECODER 0
-%define CONFIG_SUBVIEWER1_DECODER 0
-%define CONFIG_TEXT_DECODER 0
-%define CONFIG_VPLAYER_DECODER 0
-%define CONFIG_WEBVTT_DECODER 0
-%define CONFIG_XSUB_DECODER 0
-%define CONFIG_AAC_AT_DECODER 0
-%define CONFIG_AC3_AT_DECODER 0
-%define CONFIG_ADPCM_IMA_QT_AT_DECODER 0
-%define CONFIG_ALAC_AT_DECODER 0
-%define CONFIG_AMR_NB_AT_DECODER 0
-%define CONFIG_EAC3_AT_DECODER 0
-%define CONFIG_GSM_MS_AT_DECODER 0
-%define CONFIG_ILBC_AT_DECODER 0
-%define CONFIG_MP1_AT_DECODER 0
-%define CONFIG_MP2_AT_DECODER 0
-%define CONFIG_MP3_AT_DECODER 0
-%define CONFIG_PCM_ALAW_AT_DECODER 0
-%define CONFIG_PCM_MULAW_AT_DECODER 0
-%define CONFIG_QDMC_AT_DECODER 0
-%define CONFIG_QDM2_AT_DECODER 0
-%define CONFIG_LIBCELT_DECODER 0
-%define CONFIG_LIBFDK_AAC_DECODER 0
-%define CONFIG_LIBGSM_DECODER 0
-%define CONFIG_LIBGSM_MS_DECODER 0
-%define CONFIG_LIBILBC_DECODER 0
-%define CONFIG_LIBOPENCORE_AMRNB_DECODER 0
-%define CONFIG_LIBOPENCORE_AMRWB_DECODER 0
-%define CONFIG_LIBOPENJPEG_DECODER 0
-%define CONFIG_LIBOPUS_DECODER 0
-%define CONFIG_LIBSCHROEDINGER_DECODER 0
-%define CONFIG_LIBSPEEX_DECODER 0
-%define CONFIG_LIBVORBIS_DECODER 0
-%define CONFIG_LIBVPX_VP8_DECODER 0
-%define CONFIG_LIBVPX_VP9_DECODER 0
-%define CONFIG_LIBZVBI_TELETEXT_DECODER 0
-%define CONFIG_BINTEXT_DECODER 0
-%define CONFIG_XBIN_DECODER 0
-%define CONFIG_IDF_DECODER 0
-%define CONFIG_LIBOPENH264_DECODER 0
-%define CONFIG_H263_CUVID_DECODER 0
-%define CONFIG_H264_CUVID_DECODER 0
-%define CONFIG_HEVC_CUVID_DECODER 0
-%define CONFIG_HEVC_MEDIACODEC_DECODER 0
-%define CONFIG_MJPEG_CUVID_DECODER 0
-%define CONFIG_MPEG1_CUVID_DECODER 0
-%define CONFIG_MPEG2_CUVID_DECODER 0
-%define CONFIG_MPEG4_CUVID_DECODER 0
-%define CONFIG_MPEG4_MEDIACODEC_DECODER 0
-%define CONFIG_VC1_CUVID_DECODER 0
-%define CONFIG_VP8_CUVID_DECODER 0
-%define CONFIG_VP8_MEDIACODEC_DECODER 0
-%define CONFIG_VP9_CUVID_DECODER 0
-%define CONFIG_VP9_MEDIACODEC_DECODER 0
-%define CONFIG_AA_DEMUXER 0
-%define CONFIG_AAC_DEMUXER 0
-%define CONFIG_AC3_DEMUXER 0
-%define CONFIG_ACM_DEMUXER 0
-%define CONFIG_ACT_DEMUXER 0
-%define CONFIG_ADF_DEMUXER 0
-%define CONFIG_ADP_DEMUXER 0
-%define CONFIG_ADS_DEMUXER 0
-%define CONFIG_ADX_DEMUXER 0
-%define CONFIG_AEA_DEMUXER 0
-%define CONFIG_AFC_DEMUXER 0
-%define CONFIG_AIFF_DEMUXER 0
-%define CONFIG_AIX_DEMUXER 0
-%define CONFIG_AMR_DEMUXER 0
-%define CONFIG_ANM_DEMUXER 0
-%define CONFIG_APC_DEMUXER 0
-%define CONFIG_APE_DEMUXER 0
-%define CONFIG_APNG_DEMUXER 0
-%define CONFIG_AQTITLE_DEMUXER 0
-%define CONFIG_ASF_DEMUXER 0
-%define CONFIG_ASF_O_DEMUXER 0
-%define CONFIG_ASS_DEMUXER 0
-%define CONFIG_AST_DEMUXER 0
-%define CONFIG_AU_DEMUXER 0
-%define CONFIG_AVI_DEMUXER 0
-%define CONFIG_AVISYNTH_DEMUXER 0
-%define CONFIG_AVR_DEMUXER 0
-%define CONFIG_AVS_DEMUXER 0
-%define CONFIG_BETHSOFTVID_DEMUXER 0
-%define CONFIG_BFI_DEMUXER 0
-%define CONFIG_BINTEXT_DEMUXER 0
-%define CONFIG_BINK_DEMUXER 0
-%define CONFIG_BIT_DEMUXER 0
-%define CONFIG_BMV_DEMUXER 0
-%define CONFIG_BFSTM_DEMUXER 0
-%define CONFIG_BRSTM_DEMUXER 0
-%define CONFIG_BOA_DEMUXER 0
-%define CONFIG_C93_DEMUXER 0
-%define CONFIG_CAF_DEMUXER 0
-%define CONFIG_CAVSVIDEO_DEMUXER 0
-%define CONFIG_CDG_DEMUXER 0
-%define CONFIG_CDXL_DEMUXER 0
-%define CONFIG_CINE_DEMUXER 0
-%define CONFIG_CONCAT_DEMUXER 0
-%define CONFIG_DATA_DEMUXER 0
-%define CONFIG_DAUD_DEMUXER 0
-%define CONFIG_DCSTR_DEMUXER 0
-%define CONFIG_DFA_DEMUXER 0
-%define CONFIG_DIRAC_DEMUXER 0
-%define CONFIG_DNXHD_DEMUXER 0
-%define CONFIG_DSF_DEMUXER 0
-%define CONFIG_DSICIN_DEMUXER 0
-%define CONFIG_DSS_DEMUXER 0
-%define CONFIG_DTS_DEMUXER 0
-%define CONFIG_DTSHD_DEMUXER 0
-%define CONFIG_DV_DEMUXER 0
-%define CONFIG_DVBSUB_DEMUXER 0
-%define CONFIG_DVBTXT_DEMUXER 0
-%define CONFIG_DXA_DEMUXER 0
-%define CONFIG_EA_DEMUXER 0
-%define CONFIG_EA_CDATA_DEMUXER 0
-%define CONFIG_EAC3_DEMUXER 0
-%define CONFIG_EPAF_DEMUXER 0
-%define CONFIG_FFM_DEMUXER 0
-%define CONFIG_FFMETADATA_DEMUXER 0
-%define CONFIG_FILMSTRIP_DEMUXER 0
-%define CONFIG_FLAC_DEMUXER 0
-%define CONFIG_FLIC_DEMUXER 0
-%define CONFIG_FLV_DEMUXER 0
-%define CONFIG_LIVE_FLV_DEMUXER 0
-%define CONFIG_FOURXM_DEMUXER 0
-%define CONFIG_FRM_DEMUXER 0
-%define CONFIG_FSB_DEMUXER 0
-%define CONFIG_G722_DEMUXER 0
-%define CONFIG_G723_1_DEMUXER 0
-%define CONFIG_G729_DEMUXER 0
-%define CONFIG_GENH_DEMUXER 0
-%define CONFIG_GIF_DEMUXER 0
-%define CONFIG_GSM_DEMUXER 0
-%define CONFIG_GXF_DEMUXER 0
-%define CONFIG_H261_DEMUXER 0
-%define CONFIG_H263_DEMUXER 0
-%define CONFIG_H264_DEMUXER 0
-%define CONFIG_HEVC_DEMUXER 0
-%define CONFIG_HLS_DEMUXER 0
-%define CONFIG_HNM_DEMUXER 0
-%define CONFIG_ICO_DEMUXER 0
-%define CONFIG_IDCIN_DEMUXER 0
-%define CONFIG_IDF_DEMUXER 0
-%define CONFIG_IFF_DEMUXER 0
-%define CONFIG_ILBC_DEMUXER 0
-%define CONFIG_IMAGE2_DEMUXER 0
-%define CONFIG_IMAGE2PIPE_DEMUXER 0
-%define CONFIG_IMAGE2_ALIAS_PIX_DEMUXER 0
-%define CONFIG_IMAGE2_BRENDER_PIX_DEMUXER 0
-%define CONFIG_INGENIENT_DEMUXER 0
-%define CONFIG_IPMOVIE_DEMUXER 0
-%define CONFIG_IRCAM_DEMUXER 0
-%define CONFIG_ISS_DEMUXER 0
-%define CONFIG_IV8_DEMUXER 0
-%define CONFIG_IVF_DEMUXER 0
-%define CONFIG_IVR_DEMUXER 0
-%define CONFIG_JACOSUB_DEMUXER 0
-%define CONFIG_JV_DEMUXER 0
-%define CONFIG_LMLM4_DEMUXER 0
-%define CONFIG_LOAS_DEMUXER 0
-%define CONFIG_LRC_DEMUXER 0
-%define CONFIG_LVF_DEMUXER 0
-%define CONFIG_LXF_DEMUXER 0
-%define CONFIG_M4V_DEMUXER 0
-%define CONFIG_MATROSKA_DEMUXER 0
-%define CONFIG_MGSTS_DEMUXER 0
-%define CONFIG_MICRODVD_DEMUXER 0
-%define CONFIG_MJPEG_DEMUXER 0
-%define CONFIG_MLP_DEMUXER 0
-%define CONFIG_MLV_DEMUXER 0
-%define CONFIG_MM_DEMUXER 0
-%define CONFIG_MMF_DEMUXER 0
-%define CONFIG_MOV_DEMUXER 0
-%define CONFIG_MP3_DEMUXER 0
-%define CONFIG_MPC_DEMUXER 0
-%define CONFIG_MPC8_DEMUXER 0
-%define CONFIG_MPEGPS_DEMUXER 0
-%define CONFIG_MPEGTS_DEMUXER 0
-%define CONFIG_MPEGTSRAW_DEMUXER 0
-%define CONFIG_MPEGVIDEO_DEMUXER 0
-%define CONFIG_MPJPEG_DEMUXER 0
-%define CONFIG_MPL2_DEMUXER 0
-%define CONFIG_MPSUB_DEMUXER 0
-%define CONFIG_MSF_DEMUXER 0
-%define CONFIG_MSNWC_TCP_DEMUXER 0
-%define CONFIG_MTAF_DEMUXER 0
-%define CONFIG_MTV_DEMUXER 0
-%define CONFIG_MUSX_DEMUXER 0
-%define CONFIG_MV_DEMUXER 0
-%define CONFIG_MVI_DEMUXER 0
-%define CONFIG_MXF_DEMUXER 0
-%define CONFIG_MXG_DEMUXER 0
-%define CONFIG_NC_DEMUXER 0
-%define CONFIG_NISTSPHERE_DEMUXER 0
-%define CONFIG_NSV_DEMUXER 0
-%define CONFIG_NUT_DEMUXER 0
-%define CONFIG_NUV_DEMUXER 0
-%define CONFIG_OGG_DEMUXER 0
-%define CONFIG_OMA_DEMUXER 0
-%define CONFIG_PAF_DEMUXER 0
-%define CONFIG_PCM_ALAW_DEMUXER 0
-%define CONFIG_PCM_MULAW_DEMUXER 0
-%define CONFIG_PCM_F64BE_DEMUXER 0
-%define CONFIG_PCM_F64LE_DEMUXER 0
-%define CONFIG_PCM_F32BE_DEMUXER 0
-%define CONFIG_PCM_F32LE_DEMUXER 0
-%define CONFIG_PCM_S32BE_DEMUXER 0
-%define CONFIG_PCM_S32LE_DEMUXER 0
-%define CONFIG_PCM_S24BE_DEMUXER 0
-%define CONFIG_PCM_S24LE_DEMUXER 0
-%define CONFIG_PCM_S16BE_DEMUXER 0
-%define CONFIG_PCM_S16LE_DEMUXER 0
-%define CONFIG_PCM_S8_DEMUXER 0
-%define CONFIG_PCM_U32BE_DEMUXER 0
-%define CONFIG_PCM_U32LE_DEMUXER 0
-%define CONFIG_PCM_U24BE_DEMUXER 0
-%define CONFIG_PCM_U24LE_DEMUXER 0
-%define CONFIG_PCM_U16BE_DEMUXER 0
-%define CONFIG_PCM_U16LE_DEMUXER 0
-%define CONFIG_PCM_U8_DEMUXER 0
-%define CONFIG_PJS_DEMUXER 0
-%define CONFIG_PMP_DEMUXER 0
-%define CONFIG_PVA_DEMUXER 0
-%define CONFIG_PVF_DEMUXER 0
-%define CONFIG_QCP_DEMUXER 0
-%define CONFIG_R3D_DEMUXER 0
-%define CONFIG_RAWVIDEO_DEMUXER 0
-%define CONFIG_REALTEXT_DEMUXER 0
-%define CONFIG_REDSPARK_DEMUXER 0
-%define CONFIG_RL2_DEMUXER 0
-%define CONFIG_RM_DEMUXER 0
-%define CONFIG_ROQ_DEMUXER 0
-%define CONFIG_RPL_DEMUXER 0
-%define CONFIG_RSD_DEMUXER 0
-%define CONFIG_RSO_DEMUXER 0
-%define CONFIG_RTP_DEMUXER 0
-%define CONFIG_RTSP_DEMUXER 0
-%define CONFIG_SAMI_DEMUXER 0
-%define CONFIG_SAP_DEMUXER 0
-%define CONFIG_SBG_DEMUXER 0
-%define CONFIG_SDP_DEMUXER 0
-%define CONFIG_SDR2_DEMUXER 0
-%define CONFIG_SEGAFILM_DEMUXER 0
-%define CONFIG_SHORTEN_DEMUXER 0
-%define CONFIG_SIFF_DEMUXER 0
-%define CONFIG_SLN_DEMUXER 0
-%define CONFIG_SMACKER_DEMUXER 0
-%define CONFIG_SMJPEG_DEMUXER 0
-%define CONFIG_SMUSH_DEMUXER 0
-%define CONFIG_SOL_DEMUXER 0
-%define CONFIG_SOX_DEMUXER 0
-%define CONFIG_SPDIF_DEMUXER 0
-%define CONFIG_SRT_DEMUXER 0
-%define CONFIG_STR_DEMUXER 0
-%define CONFIG_STL_DEMUXER 0
-%define CONFIG_SUBVIEWER1_DEMUXER 0
-%define CONFIG_SUBVIEWER_DEMUXER 0
-%define CONFIG_SUP_DEMUXER 0
-%define CONFIG_SVAG_DEMUXER 0
-%define CONFIG_SWF_DEMUXER 0
-%define CONFIG_TAK_DEMUXER 0
-%define CONFIG_TEDCAPTIONS_DEMUXER 0
-%define CONFIG_THP_DEMUXER 0
-%define CONFIG_THREEDOSTR_DEMUXER 0
-%define CONFIG_TIERTEXSEQ_DEMUXER 0
-%define CONFIG_TMV_DEMUXER 0
-%define CONFIG_TRUEHD_DEMUXER 0
-%define CONFIG_TTA_DEMUXER 0
-%define CONFIG_TXD_DEMUXER 0
-%define CONFIG_TTY_DEMUXER 0
-%define CONFIG_V210_DEMUXER 0
-%define CONFIG_V210X_DEMUXER 0
-%define CONFIG_VAG_DEMUXER 0
-%define CONFIG_VC1_DEMUXER 0
-%define CONFIG_VC1T_DEMUXER 0
-%define CONFIG_VIVO_DEMUXER 0
-%define CONFIG_VMD_DEMUXER 0
-%define CONFIG_VOBSUB_DEMUXER 0
-%define CONFIG_VOC_DEMUXER 0
-%define CONFIG_VPK_DEMUXER 0
-%define CONFIG_VPLAYER_DEMUXER 0
-%define CONFIG_VQF_DEMUXER 0
-%define CONFIG_W64_DEMUXER 0
-%define CONFIG_WAV_DEMUXER 0
-%define CONFIG_WC3_DEMUXER 0
-%define CONFIG_WEBM_DASH_MANIFEST_DEMUXER 0
-%define CONFIG_WEBVTT_DEMUXER 0
-%define CONFIG_WSAUD_DEMUXER 0
-%define CONFIG_WSD_DEMUXER 0
-%define CONFIG_WSVQA_DEMUXER 0
-%define CONFIG_WTV_DEMUXER 0
-%define CONFIG_WVE_DEMUXER 0
-%define CONFIG_WV_DEMUXER 0
-%define CONFIG_XA_DEMUXER 0
-%define CONFIG_XBIN_DEMUXER 0
-%define CONFIG_XMV_DEMUXER 0
-%define CONFIG_XVAG_DEMUXER 0
-%define CONFIG_XWMA_DEMUXER 0
-%define CONFIG_YOP_DEMUXER 0
-%define CONFIG_YUV4MPEGPIPE_DEMUXER 0
-%define CONFIG_IMAGE_BMP_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_DDS_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_DPX_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_EXR_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_J2K_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_JPEG_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_JPEGLS_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PAM_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PBM_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PCX_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PGMYUV_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PGM_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PICTOR_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PNG_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PPM_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_QDRAW_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_SGI_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_SUNRAST_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_TIFF_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_WEBP_PIPE_DEMUXER 0
-%define CONFIG_LIBGME_DEMUXER 0
-%define CONFIG_LIBMODPLUG_DEMUXER 0
-%define CONFIG_LIBNUT_DEMUXER 0
-%define CONFIG_LIBOPENMPT_DEMUXER 0
-%define CONFIG_A64MULTI_ENCODER 0
-%define CONFIG_A64MULTI5_ENCODER 0
-%define CONFIG_ALIAS_PIX_ENCODER 0
-%define CONFIG_AMV_ENCODER 0
-%define CONFIG_APNG_ENCODER 0
-%define CONFIG_ASV1_ENCODER 0
-%define CONFIG_ASV2_ENCODER 0
-%define CONFIG_AVRP_ENCODER 0
-%define CONFIG_AVUI_ENCODER 0
-%define CONFIG_AYUV_ENCODER 0
-%define CONFIG_BMP_ENCODER 0
-%define CONFIG_CINEPAK_ENCODER 0
-%define CONFIG_CLJR_ENCODER 0
-%define CONFIG_COMFORTNOISE_ENCODER 0
-%define CONFIG_DNXHD_ENCODER 0
-%define CONFIG_DPX_ENCODER 0
-%define CONFIG_DVVIDEO_ENCODER 0
-%define CONFIG_FFV1_ENCODER 0
-%define CONFIG_FFVHUFF_ENCODER 0
-%define CONFIG_FLASHSV_ENCODER 0
-%define CONFIG_FLASHSV2_ENCODER 0
-%define CONFIG_FLV_ENCODER 0
-%define CONFIG_GIF_ENCODER 0
-%define CONFIG_H261_ENCODER 0
-%define CONFIG_H263_ENCODER 0
-%define CONFIG_H263P_ENCODER 0
-%define CONFIG_HAP_ENCODER 0
-%define CONFIG_HUFFYUV_ENCODER 0
-%define CONFIG_JPEG2000_ENCODER 0
-%define CONFIG_JPEGLS_ENCODER 0
-%define CONFIG_LJPEG_ENCODER 0
-%define CONFIG_MJPEG_ENCODER 0
-%define CONFIG_MPEG1VIDEO_ENCODER 0
-%define CONFIG_MPEG2VIDEO_ENCODER 0
-%define CONFIG_MPEG4_ENCODER 0
-%define CONFIG_MSMPEG4V2_ENCODER 0
-%define CONFIG_MSMPEG4V3_ENCODER 0
-%define CONFIG_MSVIDEO1_ENCODER 0
-%define CONFIG_PAM_ENCODER 0
-%define CONFIG_PBM_ENCODER 0
-%define CONFIG_PCX_ENCODER 0
-%define CONFIG_PGM_ENCODER 0
-%define CONFIG_PGMYUV_ENCODER 0
-%define CONFIG_PNG_ENCODER 0
-%define CONFIG_PPM_ENCODER 0
-%define CONFIG_PRORES_ENCODER 0
-%define CONFIG_PRORES_AW_ENCODER 0
-%define CONFIG_PRORES_KS_ENCODER 0
-%define CONFIG_QTRLE_ENCODER 0
-%define CONFIG_R10K_ENCODER 0
-%define CONFIG_R210_ENCODER 0
-%define CONFIG_RAWVIDEO_ENCODER 0
-%define CONFIG_ROQ_ENCODER 0
-%define CONFIG_RV10_ENCODER 0
-%define CONFIG_RV20_ENCODER 0
-%define CONFIG_S302M_ENCODER 0
-%define CONFIG_SGI_ENCODER 0
-%define CONFIG_SNOW_ENCODER 0
-%define CONFIG_SUNRAST_ENCODER 0
-%define CONFIG_SVQ1_ENCODER 0
-%define CONFIG_TARGA_ENCODER 0
-%define CONFIG_TIFF_ENCODER 0
-%define CONFIG_UTVIDEO_ENCODER 0
-%define CONFIG_V210_ENCODER 0
-%define CONFIG_V308_ENCODER 0
-%define CONFIG_V408_ENCODER 0
-%define CONFIG_V410_ENCODER 0
-%define CONFIG_VC2_ENCODER 0
-%define CONFIG_WRAPPED_AVFRAME_ENCODER 0
-%define CONFIG_WMV1_ENCODER 0
-%define CONFIG_WMV2_ENCODER 0
-%define CONFIG_XBM_ENCODER 0
-%define CONFIG_XFACE_ENCODER 0
-%define CONFIG_XWD_ENCODER 0
-%define CONFIG_Y41P_ENCODER 0
-%define CONFIG_YUV4_ENCODER 0
-%define CONFIG_ZLIB_ENCODER 0
-%define CONFIG_ZMBV_ENCODER 0
-%define CONFIG_AAC_ENCODER 0
-%define CONFIG_AC3_ENCODER 0
-%define CONFIG_AC3_FIXED_ENCODER 0
-%define CONFIG_ALAC_ENCODER 0
-%define CONFIG_DCA_ENCODER 0
-%define CONFIG_EAC3_ENCODER 0
-%define CONFIG_FLAC_ENCODER 0
-%define CONFIG_G723_1_ENCODER 0
-%define CONFIG_MLP_ENCODER 0
-%define CONFIG_MP2_ENCODER 0
-%define CONFIG_MP2FIXED_ENCODER 0
-%define CONFIG_NELLYMOSER_ENCODER 0
-%define CONFIG_RA_144_ENCODER 0
-%define CONFIG_SONIC_ENCODER 0
-%define CONFIG_SONIC_LS_ENCODER 0
-%define CONFIG_TRUEHD_ENCODER 0
-%define CONFIG_TTA_ENCODER 0
-%define CONFIG_VORBIS_ENCODER 0
-%define CONFIG_WAVPACK_ENCODER 0
-%define CONFIG_WMAV1_ENCODER 0
-%define CONFIG_WMAV2_ENCODER 0
-%define CONFIG_PCM_ALAW_ENCODER 0
-%define CONFIG_PCM_F32BE_ENCODER 0
-%define CONFIG_PCM_F32LE_ENCODER 0
-%define CONFIG_PCM_F64BE_ENCODER 0
-%define CONFIG_PCM_F64LE_ENCODER 0
-%define CONFIG_PCM_MULAW_ENCODER 0
-%define CONFIG_PCM_S8_ENCODER 0
-%define CONFIG_PCM_S8_PLANAR_ENCODER 0
-%define CONFIG_PCM_S16BE_ENCODER 0
-%define CONFIG_PCM_S16BE_PLANAR_ENCODER 0
-%define CONFIG_PCM_S16LE_ENCODER 0
-%define CONFIG_PCM_S16LE_PLANAR_ENCODER 0
-%define CONFIG_PCM_S24BE_ENCODER 0
-%define CONFIG_PCM_S24DAUD_ENCODER 0
-%define CONFIG_PCM_S24LE_ENCODER 0
-%define CONFIG_PCM_S24LE_PLANAR_ENCODER 0
-%define CONFIG_PCM_S32BE_ENCODER 0
-%define CONFIG_PCM_S32LE_ENCODER 0
-%define CONFIG_PCM_S32LE_PLANAR_ENCODER 0
-%define CONFIG_PCM_S64BE_ENCODER 0
-%define CONFIG_PCM_S64LE_ENCODER 0
-%define CONFIG_PCM_U8_ENCODER 0
-%define CONFIG_PCM_U16BE_ENCODER 0
-%define CONFIG_PCM_U16LE_ENCODER 0
-%define CONFIG_PCM_U24BE_ENCODER 0
-%define CONFIG_PCM_U24LE_ENCODER 0
-%define CONFIG_PCM_U32BE_ENCODER 0
-%define CONFIG_PCM_U32LE_ENCODER 0
-%define CONFIG_ROQ_DPCM_ENCODER 0
-%define CONFIG_ADPCM_ADX_ENCODER 0
-%define CONFIG_ADPCM_G722_ENCODER 0
-%define CONFIG_ADPCM_G726_ENCODER 0
-%define CONFIG_ADPCM_IMA_QT_ENCODER 0
-%define CONFIG_ADPCM_IMA_WAV_ENCODER 0
-%define CONFIG_ADPCM_MS_ENCODER 0
-%define CONFIG_ADPCM_SWF_ENCODER 0
-%define CONFIG_ADPCM_YAMAHA_ENCODER 0
-%define CONFIG_SSA_ENCODER 0
-%define CONFIG_ASS_ENCODER 0
-%define CONFIG_DVBSUB_ENCODER 0
-%define CONFIG_DVDSUB_ENCODER 0
-%define CONFIG_MOVTEXT_ENCODER 0
-%define CONFIG_SRT_ENCODER 0
-%define CONFIG_SUBRIP_ENCODER 0
-%define CONFIG_TEXT_ENCODER 0
-%define CONFIG_WEBVTT_ENCODER 0
-%define CONFIG_XSUB_ENCODER 0
-%define CONFIG_AAC_AT_ENCODER 0
-%define CONFIG_ALAC_AT_ENCODER 0
-%define CONFIG_ILBC_AT_ENCODER 0
-%define CONFIG_PCM_ALAW_AT_ENCODER 0
-%define CONFIG_PCM_MULAW_AT_ENCODER 0
-%define CONFIG_LIBFDK_AAC_ENCODER 0
-%define CONFIG_LIBGSM_ENCODER 0
-%define CONFIG_LIBGSM_MS_ENCODER 0
-%define CONFIG_LIBILBC_ENCODER 0
-%define CONFIG_LIBMP3LAME_ENCODER 0
-%define CONFIG_LIBOPENCORE_AMRNB_ENCODER 0
-%define CONFIG_LIBOPENJPEG_ENCODER 0
-%define CONFIG_LIBOPUS_ENCODER 0
-%define CONFIG_LIBSCHROEDINGER_ENCODER 0
-%define CONFIG_LIBSHINE_ENCODER 0
-%define CONFIG_LIBSPEEX_ENCODER 0
-%define CONFIG_LIBTHEORA_ENCODER 0
-%define CONFIG_LIBTWOLAME_ENCODER 0
-%define CONFIG_LIBVO_AMRWBENC_ENCODER 0
-%define CONFIG_LIBVORBIS_ENCODER 0
-%define CONFIG_LIBVPX_VP8_ENCODER 0
-%define CONFIG_LIBVPX_VP9_ENCODER 0
-%define CONFIG_LIBWAVPACK_ENCODER 0
-%define CONFIG_LIBWEBP_ANIM_ENCODER 0
-%define CONFIG_LIBWEBP_ENCODER 0
-%define CONFIG_LIBX262_ENCODER 0
-%define CONFIG_LIBX264_ENCODER 0
-%define CONFIG_LIBX264RGB_ENCODER 0
-%define CONFIG_LIBX265_ENCODER 0
-%define CONFIG_LIBXAVS_ENCODER 0
-%define CONFIG_LIBXVID_ENCODER 0
-%define CONFIG_LIBOPENH264_ENCODER 0
-%define CONFIG_H264_NVENC_ENCODER 0
-%define CONFIG_H264_OMX_ENCODER 0
-%define CONFIG_H264_QSV_ENCODER 0
-%define CONFIG_H264_VAAPI_ENCODER 0
-%define CONFIG_H264_VIDEOTOOLBOX_ENCODER 0
-%define CONFIG_NVENC_ENCODER 0
-%define CONFIG_NVENC_H264_ENCODER 0
-%define CONFIG_NVENC_HEVC_ENCODER 0
-%define CONFIG_HEVC_NVENC_ENCODER 0
-%define CONFIG_HEVC_QSV_ENCODER 0
-%define CONFIG_HEVC_VAAPI_ENCODER 0
-%define CONFIG_LIBKVAZAAR_ENCODER 0
-%define CONFIG_MJPEG_VAAPI_ENCODER 0
-%define CONFIG_MPEG2_QSV_ENCODER 0
-%define CONFIG_ABENCH_FILTER 0
-%define CONFIG_ACOMPRESSOR_FILTER 0
-%define CONFIG_ACROSSFADE_FILTER 0
-%define CONFIG_ACRUSHER_FILTER 0
-%define CONFIG_ADELAY_FILTER 0
-%define CONFIG_AECHO_FILTER 0
-%define CONFIG_AEMPHASIS_FILTER 0
-%define CONFIG_AEVAL_FILTER 0
-%define CONFIG_AFADE_FILTER 0
-%define CONFIG_AFFTFILT_FILTER 0
-%define CONFIG_AFORMAT_FILTER 0
-%define CONFIG_AGATE_FILTER 0
-%define CONFIG_AINTERLEAVE_FILTER 0
-%define CONFIG_ALIMITER_FILTER 0
-%define CONFIG_ALLPASS_FILTER 0
-%define CONFIG_ALOOP_FILTER 0
-%define CONFIG_AMERGE_FILTER 0
-%define CONFIG_AMETADATA_FILTER 0
-%define CONFIG_AMIX_FILTER 0
-%define CONFIG_ANEQUALIZER_FILTER 0
-%define CONFIG_ANULL_FILTER 0
-%define CONFIG_APAD_FILTER 0
-%define CONFIG_APERMS_FILTER 0
-%define CONFIG_APHASER_FILTER 0
-%define CONFIG_APULSATOR_FILTER 0
-%define CONFIG_AREALTIME_FILTER 0
-%define CONFIG_ARESAMPLE_FILTER 0
-%define CONFIG_AREVERSE_FILTER 0
-%define CONFIG_ASELECT_FILTER 0
-%define CONFIG_ASENDCMD_FILTER 0
-%define CONFIG_ASETNSAMPLES_FILTER 0
-%define CONFIG_ASETPTS_FILTER 0
-%define CONFIG_ASETRATE_FILTER 0
-%define CONFIG_ASETTB_FILTER 0
-%define CONFIG_ASHOWINFO_FILTER 0
-%define CONFIG_ASIDEDATA_FILTER 0
-%define CONFIG_ASPLIT_FILTER 0
-%define CONFIG_ASTATS_FILTER 0
-%define CONFIG_ASTREAMSELECT_FILTER 0
-%define CONFIG_ASYNCTS_FILTER 0
-%define CONFIG_ATEMPO_FILTER 0
-%define CONFIG_ATRIM_FILTER 0
-%define CONFIG_AZMQ_FILTER 0
-%define CONFIG_BANDPASS_FILTER 0
-%define CONFIG_BANDREJECT_FILTER 0
-%define CONFIG_BASS_FILTER 0
-%define CONFIG_BIQUAD_FILTER 0
-%define CONFIG_BS2B_FILTER 0
-%define CONFIG_CHANNELMAP_FILTER 0
-%define CONFIG_CHANNELSPLIT_FILTER 0
-%define CONFIG_CHORUS_FILTER 0
-%define CONFIG_COMPAND_FILTER 0
-%define CONFIG_COMPENSATIONDELAY_FILTER 0
-%define CONFIG_CRYSTALIZER_FILTER 0
-%define CONFIG_DCSHIFT_FILTER 0
-%define CONFIG_DYNAUDNORM_FILTER 0
-%define CONFIG_EARWAX_FILTER 0
-%define CONFIG_EBUR128_FILTER 0
-%define CONFIG_EQUALIZER_FILTER 0
-%define CONFIG_EXTRASTEREO_FILTER 0
-%define CONFIG_FIREQUALIZER_FILTER 0
-%define CONFIG_FLANGER_FILTER 0
-%define CONFIG_HDCD_FILTER 0
-%define CONFIG_HIGHPASS_FILTER 0
-%define CONFIG_JOIN_FILTER 0
-%define CONFIG_LADSPA_FILTER 0
-%define CONFIG_LOUDNORM_FILTER 0
-%define CONFIG_LOWPASS_FILTER 0
-%define CONFIG_PAN_FILTER 0
-%define CONFIG_REPLAYGAIN_FILTER 0
-%define CONFIG_RESAMPLE_FILTER 0
-%define CONFIG_RUBBERBAND_FILTER 0
-%define CONFIG_SIDECHAINCOMPRESS_FILTER 0
-%define CONFIG_SIDECHAINGATE_FILTER 0
-%define CONFIG_SILENCEDETECT_FILTER 0
-%define CONFIG_SILENCEREMOVE_FILTER 0
-%define CONFIG_SOFALIZER_FILTER 0
-%define CONFIG_STEREOTOOLS_FILTER 0
-%define CONFIG_STEREOWIDEN_FILTER 0
-%define CONFIG_TREBLE_FILTER 0
-%define CONFIG_TREMOLO_FILTER 0
-%define CONFIG_VIBRATO_FILTER 0
-%define CONFIG_VOLUME_FILTER 0
-%define CONFIG_VOLUMEDETECT_FILTER 0
-%define CONFIG_AEVALSRC_FILTER 0
-%define CONFIG_ANOISESRC_FILTER 0
-%define CONFIG_ANULLSRC_FILTER 0
-%define CONFIG_FLITE_FILTER 0
-%define CONFIG_SINE_FILTER 0
-%define CONFIG_ANULLSINK_FILTER 0
-%define CONFIG_ALPHAEXTRACT_FILTER 0
-%define CONFIG_ALPHAMERGE_FILTER 0
-%define CONFIG_ASS_FILTER 0
-%define CONFIG_ATADENOISE_FILTER 0
-%define CONFIG_AVGBLUR_FILTER 0
-%define CONFIG_BBOX_FILTER 0
-%define CONFIG_BENCH_FILTER 0
-%define CONFIG_BITPLANENOISE_FILTER 0
-%define CONFIG_BLACKDETECT_FILTER 0
-%define CONFIG_BLACKFRAME_FILTER 0
-%define CONFIG_BLEND_FILTER 0
-%define CONFIG_BOXBLUR_FILTER 0
-%define CONFIG_BWDIF_FILTER 0
-%define CONFIG_CHROMAKEY_FILTER 0
-%define CONFIG_CIESCOPE_FILTER 0
-%define CONFIG_CODECVIEW_FILTER 0
-%define CONFIG_COLORBALANCE_FILTER 0
-%define CONFIG_COLORCHANNELMIXER_FILTER 0
-%define CONFIG_COLORKEY_FILTER 0
-%define CONFIG_COLORLEVELS_FILTER 0
-%define CONFIG_COLORMATRIX_FILTER 0
-%define CONFIG_COLORSPACE_FILTER 0
-%define CONFIG_CONVOLUTION_FILTER 0
-%define CONFIG_COPY_FILTER 0
-%define CONFIG_COREIMAGE_FILTER 0
-%define CONFIG_COVER_RECT_FILTER 0
-%define CONFIG_CROP_FILTER 0
-%define CONFIG_CROPDETECT_FILTER 0
-%define CONFIG_CURVES_FILTER 0
-%define CONFIG_DATASCOPE_FILTER 0
-%define CONFIG_DCTDNOIZ_FILTER 0
-%define CONFIG_DEBAND_FILTER 0
-%define CONFIG_DECIMATE_FILTER 0
-%define CONFIG_DEFLATE_FILTER 0
-%define CONFIG_DEJUDDER_FILTER 0
-%define CONFIG_DELOGO_FILTER 0
-%define CONFIG_DESHAKE_FILTER 0
-%define CONFIG_DETELECINE_FILTER 0
-%define CONFIG_DILATION_FILTER 0
-%define CONFIG_DISPLACE_FILTER 0
-%define CONFIG_DRAWBOX_FILTER 0
-%define CONFIG_DRAWGRAPH_FILTER 0
-%define CONFIG_DRAWGRID_FILTER 0
-%define CONFIG_DRAWTEXT_FILTER 0
-%define CONFIG_EDGEDETECT_FILTER 0
-%define CONFIG_ELBG_FILTER 0
-%define CONFIG_EQ_FILTER 0
-%define CONFIG_EROSION_FILTER 0
-%define CONFIG_EXTRACTPLANES_FILTER 0
-%define CONFIG_FADE_FILTER 0
-%define CONFIG_FFTFILT_FILTER 0
-%define CONFIG_FIELD_FILTER 0
-%define CONFIG_FIELDHINT_FILTER 0
-%define CONFIG_FIELDMATCH_FILTER 0
-%define CONFIG_FIELDORDER_FILTER 0
-%define CONFIG_FIND_RECT_FILTER 0
-%define CONFIG_FORMAT_FILTER 0
-%define CONFIG_FPS_FILTER 0
-%define CONFIG_FRAMEPACK_FILTER 0
-%define CONFIG_FRAMERATE_FILTER 0
-%define CONFIG_FRAMESTEP_FILTER 0
-%define CONFIG_FREI0R_FILTER 0
-%define CONFIG_FSPP_FILTER 0
-%define CONFIG_GBLUR_FILTER 0
-%define CONFIG_GEQ_FILTER 0
-%define CONFIG_GRADFUN_FILTER 0
-%define CONFIG_HALDCLUT_FILTER 0
-%define CONFIG_HFLIP_FILTER 0
-%define CONFIG_HISTEQ_FILTER 0
-%define CONFIG_HISTOGRAM_FILTER 0
-%define CONFIG_HQDN3D_FILTER 0
-%define CONFIG_HQX_FILTER 0
-%define CONFIG_HSTACK_FILTER 0
-%define CONFIG_HUE_FILTER 0
-%define CONFIG_HWDOWNLOAD_FILTER 0
-%define CONFIG_HWUPLOAD_FILTER 0
-%define CONFIG_HWUPLOAD_CUDA_FILTER 0
-%define CONFIG_HYSTERESIS_FILTER 0
-%define CONFIG_IDET_FILTER 0
-%define CONFIG_IL_FILTER 0
-%define CONFIG_INFLATE_FILTER 0
-%define CONFIG_INTERLACE_FILTER 0
-%define CONFIG_INTERLEAVE_FILTER 0
-%define CONFIG_KERNDEINT_FILTER 0
-%define CONFIG_LENSCORRECTION_FILTER 0
-%define CONFIG_LOOP_FILTER 0
-%define CONFIG_LUT_FILTER 0
-%define CONFIG_LUT2_FILTER 0
-%define CONFIG_LUT3D_FILTER 0
-%define CONFIG_LUTRGB_FILTER 0
-%define CONFIG_LUTYUV_FILTER 0
-%define CONFIG_MASKEDCLAMP_FILTER 0
-%define CONFIG_MASKEDMERGE_FILTER 0
-%define CONFIG_MCDEINT_FILTER 0
-%define CONFIG_MERGEPLANES_FILTER 0
-%define CONFIG_MESTIMATE_FILTER 0
-%define CONFIG_METADATA_FILTER 0
-%define CONFIG_MINTERPOLATE_FILTER 0
-%define CONFIG_MPDECIMATE_FILTER 0
-%define CONFIG_NEGATE_FILTER 0
-%define CONFIG_NLMEANS_FILTER 0
-%define CONFIG_NNEDI_FILTER 0
-%define CONFIG_NOFORMAT_FILTER 0
-%define CONFIG_NOISE_FILTER 0
-%define CONFIG_NULL_FILTER 0
-%define CONFIG_OCR_FILTER 0
-%define CONFIG_OCV_FILTER 0
-%define CONFIG_OVERLAY_FILTER 0
-%define CONFIG_OWDENOISE_FILTER 0
-%define CONFIG_PAD_FILTER 0
-%define CONFIG_PALETTEGEN_FILTER 0
-%define CONFIG_PALETTEUSE_FILTER 0
-%define CONFIG_PERMS_FILTER 0
-%define CONFIG_PERSPECTIVE_FILTER 0
-%define CONFIG_PHASE_FILTER 0
-%define CONFIG_PIXDESCTEST_FILTER 0
-%define CONFIG_PP_FILTER 0
-%define CONFIG_PP7_FILTER 0
-%define CONFIG_PREWITT_FILTER 0
-%define CONFIG_PSNR_FILTER 0
-%define CONFIG_PULLUP_FILTER 0
-%define CONFIG_QP_FILTER 0
-%define CONFIG_RANDOM_FILTER 0
-%define CONFIG_READVITC_FILTER 0
-%define CONFIG_REALTIME_FILTER 0
-%define CONFIG_REMAP_FILTER 0
-%define CONFIG_REMOVEGRAIN_FILTER 0
-%define CONFIG_REMOVELOGO_FILTER 0
-%define CONFIG_REPEATFIELDS_FILTER 0
-%define CONFIG_REVERSE_FILTER 0
-%define CONFIG_ROTATE_FILTER 0
-%define CONFIG_SAB_FILTER 0
-%define CONFIG_SCALE_FILTER 0
-%define CONFIG_SCALE_NPP_FILTER 0
-%define CONFIG_SCALE_VAAPI_FILTER 0
-%define CONFIG_SCALE2REF_FILTER 0
-%define CONFIG_SELECT_FILTER 0
-%define CONFIG_SELECTIVECOLOR_FILTER 0
-%define CONFIG_SENDCMD_FILTER 0
-%define CONFIG_SEPARATEFIELDS_FILTER 0
-%define CONFIG_SETDAR_FILTER 0
-%define CONFIG_SETFIELD_FILTER 0
-%define CONFIG_SETPTS_FILTER 0
-%define CONFIG_SETSAR_FILTER 0
-%define CONFIG_SETTB_FILTER 0
-%define CONFIG_SHOWINFO_FILTER 0
-%define CONFIG_SHOWPALETTE_FILTER 0
-%define CONFIG_SHUFFLEFRAMES_FILTER 0
-%define CONFIG_SHUFFLEPLANES_FILTER 0
-%define CONFIG_SIDEDATA_FILTER 0
-%define CONFIG_SIGNALSTATS_FILTER 0
-%define CONFIG_SMARTBLUR_FILTER 0
-%define CONFIG_SOBEL_FILTER 0
-%define CONFIG_SPLIT_FILTER 0
-%define CONFIG_SPP_FILTER 0
-%define CONFIG_SSIM_FILTER 0
-%define CONFIG_STEREO3D_FILTER 0
-%define CONFIG_STREAMSELECT_FILTER 0
-%define CONFIG_SUBTITLES_FILTER 0
-%define CONFIG_SUPER2XSAI_FILTER 0
-%define CONFIG_SWAPRECT_FILTER 0
-%define CONFIG_SWAPUV_FILTER 0
-%define CONFIG_TBLEND_FILTER 0
-%define CONFIG_TELECINE_FILTER 0
-%define CONFIG_THUMBNAIL_FILTER 0
-%define CONFIG_TILE_FILTER 0
-%define CONFIG_TINTERLACE_FILTER 0
-%define CONFIG_TRANSPOSE_FILTER 0
-%define CONFIG_TRIM_FILTER 0
-%define CONFIG_UNSHARP_FILTER 0
-%define CONFIG_USPP_FILTER 0
-%define CONFIG_VAGUEDENOISER_FILTER 0
-%define CONFIG_VECTORSCOPE_FILTER 0
-%define CONFIG_VFLIP_FILTER 0
-%define CONFIG_VIDSTABDETECT_FILTER 0
-%define CONFIG_VIDSTABTRANSFORM_FILTER 0
-%define CONFIG_VIGNETTE_FILTER 0
-%define CONFIG_VSTACK_FILTER 0
-%define CONFIG_W3FDIF_FILTER 0
-%define CONFIG_WAVEFORM_FILTER 0
-%define CONFIG_WEAVE_FILTER 0
-%define CONFIG_XBR_FILTER 0
-%define CONFIG_YADIF_FILTER 0
-%define CONFIG_ZMQ_FILTER 0
-%define CONFIG_ZOOMPAN_FILTER 0
-%define CONFIG_ZSCALE_FILTER 0
-%define CONFIG_ALLRGB_FILTER 0
-%define CONFIG_ALLYUV_FILTER 0
-%define CONFIG_CELLAUTO_FILTER 0
-%define CONFIG_COLOR_FILTER 0
-%define CONFIG_COREIMAGESRC_FILTER 0
-%define CONFIG_FREI0R_SRC_FILTER 0
-%define CONFIG_HALDCLUTSRC_FILTER 0
-%define CONFIG_LIFE_FILTER 0
-%define CONFIG_MANDELBROT_FILTER 0
-%define CONFIG_MPTESTSRC_FILTER 0
-%define CONFIG_NULLSRC_FILTER 0
-%define CONFIG_RGBTESTSRC_FILTER 0
-%define CONFIG_SMPTEBARS_FILTER 0
-%define CONFIG_SMPTEHDBARS_FILTER 0
-%define CONFIG_TESTSRC_FILTER 0
-%define CONFIG_TESTSRC2_FILTER 0
-%define CONFIG_YUVTESTSRC_FILTER 0
-%define CONFIG_NULLSINK_FILTER 0
-%define CONFIG_ADRAWGRAPH_FILTER 0
-%define CONFIG_AHISTOGRAM_FILTER 0
-%define CONFIG_APHASEMETER_FILTER 0
-%define CONFIG_AVECTORSCOPE_FILTER 0
-%define CONFIG_CONCAT_FILTER 0
-%define CONFIG_SHOWCQT_FILTER 0
-%define CONFIG_SHOWFREQS_FILTER 0
-%define CONFIG_SHOWSPECTRUM_FILTER 0
-%define CONFIG_SHOWSPECTRUMPIC_FILTER 0
-%define CONFIG_SHOWVOLUME_FILTER 0
-%define CONFIG_SHOWWAVES_FILTER 0
-%define CONFIG_SHOWWAVESPIC_FILTER 0
-%define CONFIG_SPECTRUMSYNTH_FILTER 0
-%define CONFIG_AMOVIE_FILTER 0
-%define CONFIG_MOVIE_FILTER 0
-%define CONFIG_H263_CUVID_HWACCEL 0
-%define CONFIG_H263_VAAPI_HWACCEL 0
-%define CONFIG_H263_VIDEOTOOLBOX_HWACCEL 0
-%define CONFIG_H264_CUVID_HWACCEL 0
-%define CONFIG_H264_D3D11VA_HWACCEL 0
-%define CONFIG_H264_DXVA2_HWACCEL 0
-%define CONFIG_H264_MEDIACODEC_HWACCEL 0
-%define CONFIG_H264_MMAL_HWACCEL 0
-%define CONFIG_H264_QSV_HWACCEL 0
-%define CONFIG_H264_VAAPI_HWACCEL 0
-%define CONFIG_H264_VDA_HWACCEL 0
-%define CONFIG_H264_VDA_OLD_HWACCEL 0
-%define CONFIG_H264_VDPAU_HWACCEL 0
-%define CONFIG_H264_VIDEOTOOLBOX_HWACCEL 0
-%define CONFIG_HEVC_CUVID_HWACCEL 0
-%define CONFIG_HEVC_D3D11VA_HWACCEL 0
-%define CONFIG_HEVC_DXVA2_HWACCEL 0
-%define CONFIG_HEVC_MEDIACODEC_HWACCEL 0
-%define CONFIG_HEVC_QSV_HWACCEL 0
-%define CONFIG_HEVC_VAAPI_HWACCEL 0
-%define CONFIG_HEVC_VDPAU_HWACCEL 0
-%define CONFIG_MJPEG_CUVID_HWACCEL 0
-%define CONFIG_MPEG1_CUVID_HWACCEL 0
-%define CONFIG_MPEG1_XVMC_HWACCEL 0
-%define CONFIG_MPEG1_VDPAU_HWACCEL 0
-%define CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL 0
-%define CONFIG_MPEG2_CUVID_HWACCEL 0
-%define CONFIG_MPEG2_XVMC_HWACCEL 0
-%define CONFIG_MPEG2_D3D11VA_HWACCEL 0
-%define CONFIG_MPEG2_DXVA2_HWACCEL 0
-%define CONFIG_MPEG2_MMAL_HWACCEL 0
-%define CONFIG_MPEG2_QSV_HWACCEL 0
-%define CONFIG_MPEG2_VAAPI_HWACCEL 0
-%define CONFIG_MPEG2_VDPAU_HWACCEL 0
-%define CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL 0
-%define CONFIG_MPEG4_CUVID_HWACCEL 0
-%define CONFIG_MPEG4_MEDIACODEC_HWACCEL 0
-%define CONFIG_MPEG4_MMAL_HWACCEL 0
-%define CONFIG_MPEG4_VAAPI_HWACCEL 0
-%define CONFIG_MPEG4_VDPAU_HWACCEL 0
-%define CONFIG_MPEG4_VIDEOTOOLBOX_HWACCEL 0
-%define CONFIG_VC1_CUVID_HWACCEL 0
-%define CONFIG_VC1_D3D11VA_HWACCEL 0
-%define CONFIG_VC1_DXVA2_HWACCEL 0
-%define CONFIG_VC1_VAAPI_HWACCEL 0
-%define CONFIG_VC1_VDPAU_HWACCEL 0
-%define CONFIG_VC1_MMAL_HWACCEL 0
-%define CONFIG_VC1_QSV_HWACCEL 0
-%define CONFIG_VP8_CUVID_HWACCEL 0
-%define CONFIG_VP8_MEDIACODEC_HWACCEL 0
-%define CONFIG_VP9_CUVID_HWACCEL 0
-%define CONFIG_VP9_D3D11VA_HWACCEL 0
-%define CONFIG_VP9_DXVA2_HWACCEL 0
-%define CONFIG_VP9_MEDIACODEC_HWACCEL 0
-%define CONFIG_VP9_VAAPI_HWACCEL 0
-%define CONFIG_WMV3_D3D11VA_HWACCEL 0
-%define CONFIG_WMV3_DXVA2_HWACCEL 0
-%define CONFIG_WMV3_VAAPI_HWACCEL 0
-%define CONFIG_WMV3_VDPAU_HWACCEL 0
-%define CONFIG_ALSA_INDEV 0
-%define CONFIG_AVFOUNDATION_INDEV 0
-%define CONFIG_BKTR_INDEV 0
-%define CONFIG_DECKLINK_INDEV 0
-%define CONFIG_DSHOW_INDEV 0
-%define CONFIG_DV1394_INDEV 0
-%define CONFIG_FBDEV_INDEV 0
-%define CONFIG_GDIGRAB_INDEV 0
-%define CONFIG_IEC61883_INDEV 0
-%define CONFIG_JACK_INDEV 0
-%define CONFIG_LAVFI_INDEV 0
-%define CONFIG_OPENAL_INDEV 0
-%define CONFIG_OSS_INDEV 0
-%define CONFIG_PULSE_INDEV 0
-%define CONFIG_QTKIT_INDEV 0
-%define CONFIG_SNDIO_INDEV 0
-%define CONFIG_V4L2_INDEV 0
-%define CONFIG_VFWCAP_INDEV 0
-%define CONFIG_X11GRAB_INDEV 0
-%define CONFIG_X11GRAB_XCB_INDEV 0
-%define CONFIG_LIBCDIO_INDEV 0
-%define CONFIG_LIBDC1394_INDEV 0
-%define CONFIG_A64_MUXER 0
-%define CONFIG_AC3_MUXER 0
-%define CONFIG_ADTS_MUXER 0
-%define CONFIG_ADX_MUXER 0
-%define CONFIG_AIFF_MUXER 0
-%define CONFIG_AMR_MUXER 0
-%define CONFIG_APNG_MUXER 0
-%define CONFIG_ASF_MUXER 0
-%define CONFIG_ASS_MUXER 0
-%define CONFIG_AST_MUXER 0
-%define CONFIG_ASF_STREAM_MUXER 0
-%define CONFIG_AU_MUXER 0
-%define CONFIG_AVI_MUXER 0
-%define CONFIG_AVM2_MUXER 0
-%define CONFIG_BIT_MUXER 0
-%define CONFIG_CAF_MUXER 0
-%define CONFIG_CAVSVIDEO_MUXER 0
-%define CONFIG_CRC_MUXER 0
-%define CONFIG_DASH_MUXER 0
-%define CONFIG_DATA_MUXER 0
-%define CONFIG_DAUD_MUXER 0
-%define CONFIG_DIRAC_MUXER 0
-%define CONFIG_DNXHD_MUXER 0
-%define CONFIG_DTS_MUXER 0
-%define CONFIG_DV_MUXER 0
-%define CONFIG_EAC3_MUXER 0
-%define CONFIG_F4V_MUXER 0
-%define CONFIG_FFM_MUXER 0
-%define CONFIG_FFMETADATA_MUXER 0
-%define CONFIG_FIFO_MUXER 0
-%define CONFIG_FILMSTRIP_MUXER 0
-%define CONFIG_FLAC_MUXER 0
-%define CONFIG_FLV_MUXER 0
-%define CONFIG_FRAMECRC_MUXER 0
-%define CONFIG_FRAMEHASH_MUXER 0
-%define CONFIG_FRAMEMD5_MUXER 0
-%define CONFIG_G722_MUXER 0
-%define CONFIG_G723_1_MUXER 0
-%define CONFIG_GIF_MUXER 0
-%define CONFIG_GSM_MUXER 0
-%define CONFIG_GXF_MUXER 0
-%define CONFIG_H261_MUXER 0
-%define CONFIG_H263_MUXER 0
-%define CONFIG_H264_MUXER 0
-%define CONFIG_HASH_MUXER 0
-%define CONFIG_HDS_MUXER 0
-%define CONFIG_HEVC_MUXER 0
-%define CONFIG_HLS_MUXER 0
-%define CONFIG_ICO_MUXER 0
-%define CONFIG_ILBC_MUXER 0
-%define CONFIG_IMAGE2_MUXER 0
-%define CONFIG_IMAGE2PIPE_MUXER 0
-%define CONFIG_IPOD_MUXER 0
-%define CONFIG_IRCAM_MUXER 0
-%define CONFIG_ISMV_MUXER 0
-%define CONFIG_IVF_MUXER 0
-%define CONFIG_JACOSUB_MUXER 0
-%define CONFIG_LATM_MUXER 0
-%define CONFIG_LRC_MUXER 0
-%define CONFIG_M4V_MUXER 0
-%define CONFIG_MD5_MUXER 0
-%define CONFIG_MATROSKA_MUXER 0
-%define CONFIG_MATROSKA_AUDIO_MUXER 0
-%define CONFIG_MICRODVD_MUXER 0
-%define CONFIG_MJPEG_MUXER 0
-%define CONFIG_MLP_MUXER 0
-%define CONFIG_MMF_MUXER 0
-%define CONFIG_MOV_MUXER 0
-%define CONFIG_MP2_MUXER 0
-%define CONFIG_MP3_MUXER 0
-%define CONFIG_MP4_MUXER 0
-%define CONFIG_MPEG1SYSTEM_MUXER 0
-%define CONFIG_MPEG1VCD_MUXER 0
-%define CONFIG_MPEG1VIDEO_MUXER 0
-%define CONFIG_MPEG2DVD_MUXER 0
-%define CONFIG_MPEG2SVCD_MUXER 0
-%define CONFIG_MPEG2VIDEO_MUXER 0
-%define CONFIG_MPEG2VOB_MUXER 0
-%define CONFIG_MPEGTS_MUXER 0
-%define CONFIG_MPJPEG_MUXER 0
-%define CONFIG_MXF_MUXER 0
-%define CONFIG_MXF_D10_MUXER 0
-%define CONFIG_MXF_OPATOM_MUXER 0
-%define CONFIG_NULL_MUXER 0
-%define CONFIG_NUT_MUXER 0
-%define CONFIG_OGA_MUXER 0
-%define CONFIG_OGG_MUXER 0
-%define CONFIG_OGV_MUXER 0
-%define CONFIG_OMA_MUXER 0
-%define CONFIG_OPUS_MUXER 0
-%define CONFIG_PCM_ALAW_MUXER 0
-%define CONFIG_PCM_MULAW_MUXER 0
-%define CONFIG_PCM_F64BE_MUXER 0
-%define CONFIG_PCM_F64LE_MUXER 0
-%define CONFIG_PCM_F32BE_MUXER 0
-%define CONFIG_PCM_F32LE_MUXER 0
-%define CONFIG_PCM_S32BE_MUXER 0
-%define CONFIG_PCM_S32LE_MUXER 0
-%define CONFIG_PCM_S24BE_MUXER 0
-%define CONFIG_PCM_S24LE_MUXER 0
-%define CONFIG_PCM_S16BE_MUXER 0
-%define CONFIG_PCM_S16LE_MUXER 0
-%define CONFIG_PCM_S8_MUXER 0
-%define CONFIG_PCM_U32BE_MUXER 0
-%define CONFIG_PCM_U32LE_MUXER 0
-%define CONFIG_PCM_U24BE_MUXER 0
-%define CONFIG_PCM_U24LE_MUXER 0
-%define CONFIG_PCM_U16BE_MUXER 0
-%define CONFIG_PCM_U16LE_MUXER 0
-%define CONFIG_PCM_U8_MUXER 0
-%define CONFIG_PSP_MUXER 0
-%define CONFIG_RAWVIDEO_MUXER 0
-%define CONFIG_RM_MUXER 0
-%define CONFIG_ROQ_MUXER 0
-%define CONFIG_RSO_MUXER 0
-%define CONFIG_RTP_MUXER 0
-%define CONFIG_RTP_MPEGTS_MUXER 0
-%define CONFIG_RTSP_MUXER 0
-%define CONFIG_SAP_MUXER 0
-%define CONFIG_SEGMENT_MUXER 0
-%define CONFIG_STREAM_SEGMENT_MUXER 0
-%define CONFIG_SINGLEJPEG_MUXER 0
-%define CONFIG_SMJPEG_MUXER 0
-%define CONFIG_SMOOTHSTREAMING_MUXER 0
-%define CONFIG_SOX_MUXER 0
-%define CONFIG_SPX_MUXER 0
-%define CONFIG_SPDIF_MUXER 0
-%define CONFIG_SRT_MUXER 0
-%define CONFIG_SWF_MUXER 0
-%define CONFIG_TEE_MUXER 0
-%define CONFIG_TG2_MUXER 0
-%define CONFIG_TGP_MUXER 0
-%define CONFIG_MKVTIMESTAMP_V2_MUXER 0
-%define CONFIG_TRUEHD_MUXER 0
-%define CONFIG_TTA_MUXER 0
-%define CONFIG_UNCODEDFRAMECRC_MUXER 0
-%define CONFIG_VC1_MUXER 0
-%define CONFIG_VC1T_MUXER 0
-%define CONFIG_VOC_MUXER 0
-%define CONFIG_W64_MUXER 0
-%define CONFIG_WAV_MUXER 0
-%define CONFIG_WEBM_MUXER 0
-%define CONFIG_WEBM_DASH_MANIFEST_MUXER 0
-%define CONFIG_WEBM_CHUNK_MUXER 0
-%define CONFIG_WEBP_MUXER 0
-%define CONFIG_WEBVTT_MUXER 0
-%define CONFIG_WTV_MUXER 0
-%define CONFIG_WV_MUXER 0
-%define CONFIG_YUV4MPEGPIPE_MUXER 0
-%define CONFIG_CHROMAPRINT_MUXER 0
-%define CONFIG_LIBNUT_MUXER 0
-%define CONFIG_ALSA_OUTDEV 0
-%define CONFIG_CACA_OUTDEV 0
-%define CONFIG_DECKLINK_OUTDEV 0
-%define CONFIG_FBDEV_OUTDEV 0
-%define CONFIG_OPENGL_OUTDEV 0
-%define CONFIG_OSS_OUTDEV 0
-%define CONFIG_PULSE_OUTDEV 0
-%define CONFIG_SDL2_OUTDEV 0
-%define CONFIG_SNDIO_OUTDEV 0
-%define CONFIG_V4L2_OUTDEV 0
-%define CONFIG_XV_OUTDEV 0
-%define CONFIG_AAC_PARSER 0
-%define CONFIG_AAC_LATM_PARSER 0
-%define CONFIG_AC3_PARSER 0
-%define CONFIG_ADX_PARSER 0
-%define CONFIG_BMP_PARSER 0
-%define CONFIG_CAVSVIDEO_PARSER 0
-%define CONFIG_COOK_PARSER 0
-%define CONFIG_DCA_PARSER 0
-%define CONFIG_DIRAC_PARSER 0
-%define CONFIG_DNXHD_PARSER 0
-%define CONFIG_DPX_PARSER 0
-%define CONFIG_DVAUDIO_PARSER 0
-%define CONFIG_DVBSUB_PARSER 0
-%define CONFIG_DVDSUB_PARSER 0
-%define CONFIG_DVD_NAV_PARSER 0
-%define CONFIG_FLAC_PARSER 1
-%define CONFIG_G729_PARSER 0
-%define CONFIG_GSM_PARSER 0
-%define CONFIG_H261_PARSER 0
-%define CONFIG_H263_PARSER 0
-%define CONFIG_H264_PARSER 0
-%define CONFIG_HEVC_PARSER 0
-%define CONFIG_MJPEG_PARSER 0
-%define CONFIG_MLP_PARSER 0
-%define CONFIG_MPEG4VIDEO_PARSER 0
-%define CONFIG_MPEGAUDIO_PARSER 0
-%define CONFIG_MPEGVIDEO_PARSER 0
-%define CONFIG_OPUS_PARSER 0
-%define CONFIG_PNG_PARSER 0
-%define CONFIG_PNM_PARSER 0
-%define CONFIG_RV30_PARSER 0
-%define CONFIG_RV40_PARSER 0
-%define CONFIG_TAK_PARSER 0
-%define CONFIG_VC1_PARSER 0
-%define CONFIG_VORBIS_PARSER 0
-%define CONFIG_VP3_PARSER 0
+%define CONFIG_FLAC_PARSER 0
%define CONFIG_VP8_PARSER 1
%define CONFIG_VP9_PARSER 1
-%define CONFIG_ASYNC_PROTOCOL 0
-%define CONFIG_BLURAY_PROTOCOL 0
-%define CONFIG_CACHE_PROTOCOL 0
-%define CONFIG_CONCAT_PROTOCOL 0
-%define CONFIG_CRYPTO_PROTOCOL 0
-%define CONFIG_DATA_PROTOCOL 0
-%define CONFIG_FFRTMPCRYPT_PROTOCOL 0
-%define CONFIG_FFRTMPHTTP_PROTOCOL 0
-%define CONFIG_FILE_PROTOCOL 0
-%define CONFIG_FTP_PROTOCOL 0
-%define CONFIG_GOPHER_PROTOCOL 0
-%define CONFIG_HLS_PROTOCOL 0
-%define CONFIG_HTTP_PROTOCOL 0
-%define CONFIG_HTTPPROXY_PROTOCOL 0
-%define CONFIG_HTTPS_PROTOCOL 0
-%define CONFIG_ICECAST_PROTOCOL 0
-%define CONFIG_MMSH_PROTOCOL 0
-%define CONFIG_MMST_PROTOCOL 0
-%define CONFIG_MD5_PROTOCOL 0
-%define CONFIG_PIPE_PROTOCOL 0
-%define CONFIG_RTMP_PROTOCOL 0
-%define CONFIG_RTMPE_PROTOCOL 0
-%define CONFIG_RTMPS_PROTOCOL 0
-%define CONFIG_RTMPT_PROTOCOL 0
-%define CONFIG_RTMPTE_PROTOCOL 0
-%define CONFIG_RTMPTS_PROTOCOL 0
-%define CONFIG_RTP_PROTOCOL 0
-%define CONFIG_SCTP_PROTOCOL 0
-%define CONFIG_SRTP_PROTOCOL 0
-%define CONFIG_SUBFILE_PROTOCOL 0
-%define CONFIG_TEE_PROTOCOL 0
-%define CONFIG_TCP_PROTOCOL 0
-%define CONFIG_TLS_GNUTLS_PROTOCOL 0
-%define CONFIG_TLS_SCHANNEL_PROTOCOL 0
-%define CONFIG_TLS_SECURETRANSPORT_PROTOCOL 0
-%define CONFIG_TLS_OPENSSL_PROTOCOL 0
-%define CONFIG_UDP_PROTOCOL 0
-%define CONFIG_UDPLITE_PROTOCOL 0
-%define CONFIG_UNIX_PROTOCOL 0
-%define CONFIG_LIBRTMP_PROTOCOL 0
-%define CONFIG_LIBRTMPE_PROTOCOL 0
-%define CONFIG_LIBRTMPS_PROTOCOL 0
-%define CONFIG_LIBRTMPT_PROTOCOL 0
-%define CONFIG_LIBRTMPTE_PROTOCOL 0
-%define CONFIG_LIBSSH_PROTOCOL 0
-%define CONFIG_LIBSMBCLIENT_PROTOCOL 0
diff --git a/media/ffvpx/config_darwin64.h b/media/ffvpx/config_darwin64.h
index e1d42ad39c..72f1d6dad7 100644
--- a/media/ffvpx/config_darwin64.h
+++ b/media/ffvpx/config_darwin64.h
@@ -1,12 +1,12 @@
/* Automatically generated by configure - do not modify! */
#ifndef FFMPEG_CONFIG_H
#define FFMPEG_CONFIG_H
-#define FFMPEG_CONFIGURATION "--disable-everything --disable-protocols --disable-demuxers --disable-muxers --disable-filters --disable-programs --disable-doc --disable-parsers --enable-parser=vp8 --enable-parser=vp9 --enable-decoder=vp8 --enable-decoder=vp9 --disable-static --enable-shared --disable-debug --disable-sdl --disable-libxcb --disable-securetransport --disable-iconv --disable-swresample --disable-swscale --disable-avdevice --disable-avfilter --disable-avformat --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vda --disable-vdpau --disable-videotoolbox --enable-asm --enable-yasm"
+#define FFMPEG_CONFIGURATION "--disable-everything --disable-protocols --disable-demuxers --disable-muxers --disable-filters --disable-programs --disable-doc --disable-parsers --enable-parser=vp8 --enable-parser=vp9 --enable-decoder=vp8 --enable-decoder=vp9 --disable-static --enable-shared --disable-debug --disable-sdl2 --disable-libxcb --disable-securetransport --disable-iconv --disable-swresample --disable-swscale --disable-avdevice --disable-avfilter --disable-avformat --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vdpau --disable-videotoolbox --enable-decoder=flac --enable-asm --enable-x86asm"
#define FFMPEG_LICENSE "LGPL version 2.1 or later"
-#define CONFIG_THIS_YEAR 2016
+#define CONFIG_THIS_YEAR 2017
#define FFMPEG_DATADIR "/usr/local/share/ffmpeg"
#define AVCONV_DATADIR "/usr/local/share/ffmpeg"
-#define CC_IDENT "Apple LLVM version 7.0.2 (clang-700.1.81)"
+#define CC_IDENT "Apple LLVM version 9.0.0 (clang-900.0.38)"
#define av_restrict restrict
#define EXTERN_PREFIX "_"
#define EXTERN_ASM _
@@ -79,8 +79,8 @@
#define HAVE_MIPSDSP 0
#define HAVE_MIPSDSPR2 0
#define HAVE_MSA 0
-#define HAVE_LOONGSON2 1
-#define HAVE_LOONGSON3 1
+#define HAVE_LOONGSON2 0
+#define HAVE_LOONGSON3 0
#define HAVE_MMI 0
#define HAVE_ARMV5TE_EXTERNAL 0
#define HAVE_ARMV6_EXTERNAL 0
@@ -178,33 +178,33 @@
#define HAVE_LOCAL_ALIGNED_16 1
#define HAVE_LOCAL_ALIGNED_32 1
#define HAVE_SIMD_ALIGN_16 1
+#define HAVE_SIMD_ALIGN_32 1
#define HAVE_ATOMICS_GCC 1
#define HAVE_ATOMICS_SUNCC 0
#define HAVE_ATOMICS_WIN32 0
#define HAVE_ATOMIC_CAS_PTR 0
-#define HAVE_ATOMIC_COMPARE_EXCHANGE 1
#define HAVE_MACHINE_RW_BARRIER 0
#define HAVE_MEMORYBARRIER 0
#define HAVE_MM_EMPTY 1
#define HAVE_RDTSC 0
#define HAVE_SARESTART 1
-#define HAVE_SEM_TIMEDWAIT 1
+#define HAVE_SEM_TIMEDWAIT 0
#define HAVE_SYNC_VAL_COMPARE_AND_SWAP 1
#define HAVE_CABS 1
#define HAVE_CEXP 1
#define HAVE_INLINE_ASM 1
#define HAVE_SYMVER 1
-#define HAVE_YASM 1
+#define HAVE_X86ASM 1
#define HAVE_BIGENDIAN 0
#define HAVE_FAST_UNALIGNED 1
-#define HAVE_INCOMPATIBLE_LIBAV_ABI 0
-#define HAVE_ALSA_ASOUNDLIB_H 0
#define HAVE_ALTIVEC_H 0
#define HAVE_ARPA_INET_H 1
#define HAVE_ASM_TYPES_H 0
#define HAVE_CDIO_PARANOIA_H 0
#define HAVE_CDIO_PARANOIA_PARANOIA_H 0
-#define HAVE_DISPATCH_DISPATCH_H 0
+#define HAVE_CUDA_H 0
+#define HAVE_D3D11_H 0
+#define HAVE_DISPATCH_DISPATCH_H 1
#define HAVE_DEV_BKTR_IOCTL_BT848_H 0
#define HAVE_DEV_BKTR_IOCTL_METEOR_H 0
#define HAVE_DEV_IC_BT8XX_H 0
@@ -213,7 +213,7 @@
#define HAVE_DIRECT_H 0
#define HAVE_DIRENT_H 1
#define HAVE_DLFCN_H 1
-#define HAVE_D3D11_H 0
+#define HAVE_DXGIDEBUG_H 0
#define HAVE_DXVA_H 0
#define HAVE_ES2_GL_H 0
#define HAVE_GSM_H 0
@@ -222,13 +222,15 @@
#define HAVE_MACHINE_IOCTL_BT848_H 0
#define HAVE_MACHINE_IOCTL_METEOR_H 0
#define HAVE_OPENCV2_CORE_CORE_C_H 0
+#define HAVE_OPENJPEG_2_3_OPENJPEG_H 0
+#define HAVE_OPENJPEG_2_2_OPENJPEG_H 0
#define HAVE_OPENJPEG_2_1_OPENJPEG_H 0
#define HAVE_OPENJPEG_2_0_OPENJPEG_H 0
#define HAVE_OPENJPEG_1_5_OPENJPEG_H 0
#define HAVE_OPENGL_GL3_H 0
#define HAVE_POLL_H 1
-#define HAVE_SNDIO_H 0
#define HAVE_SOUNDCARD_H 0
+#define HAVE_STDATOMIC_H 1
#define HAVE_SYS_MMAN_H 1
#define HAVE_SYS_PARAM_H 1
#define HAVE_SYS_RESOURCE_H 1
@@ -275,12 +277,11 @@
#define HAVE_TRUNCF 1
#define HAVE_ACCESS 1
#define HAVE_ALIGNED_MALLOC 0
-#define HAVE_CLOCK_GETTIME 0
+#define HAVE_CLOCK_GETTIME 1
#define HAVE_CLOSESOCKET 0
#define HAVE_COMMANDLINETOARGVW 0
#define HAVE_COTASKMEMFREE 0
#define HAVE_CRYPTGENRANDOM 0
-#define HAVE_DLOPEN 1
#define HAVE_FCNTL 1
#define HAVE_FLT_LIM 1
#define HAVE_FORK 1
@@ -319,19 +320,22 @@
#define HAVE_SLEEP 0
#define HAVE_STRERROR_R 1
#define HAVE_SYSCONF 1
+#define HAVE_SYSCTL 1
#define HAVE_USLEEP 1
-#define HAVE_UTGETOSTYPEFROMSTRING 1
+#define HAVE_UTGETOSTYPEFROMSTRING 0
#define HAVE_VIRTUALALLOC 0
#define HAVE_WGLGETPROCADDRESS 0
#define HAVE_PTHREADS 1
#define HAVE_OS2THREADS 0
#define HAVE_W32THREADS 0
#define HAVE_AS_DN_DIRECTIVE 0
+#define HAVE_AS_FPU_DIRECTIVE 0
#define HAVE_AS_FUNC 0
#define HAVE_AS_OBJECT_ARCH 0
#define HAVE_ASM_MOD_Q 0
#define HAVE_ATTRIBUTE_MAY_ALIAS 1
#define HAVE_ATTRIBUTE_PACKED 1
+#define HAVE_BLOCKS_EXTENSION 1
#define HAVE_EBP_AVAILABLE 1
#define HAVE_EBX_AVAILABLE 1
#define HAVE_GNU_AS 0
@@ -348,6 +352,7 @@
#define HAVE_XFORM_ASM 0
#define HAVE_XMM_CLOBBERS 1
#define HAVE_CONDITION_VARIABLE_PTR 0
+#define HAVE_KCMVIDEOCODECTYPE_HEVC 0
#define HAVE_SOCKLEN_T 1
#define HAVE_STRUCT_ADDRINFO 1
#define HAVE_STRUCT_GROUP_SOURCE_REQ 1
@@ -364,50 +369,38 @@
#define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 0
#define HAVE_ATOMICS_NATIVE 1
#define HAVE_DOS_PATHS 0
-#define HAVE_DXVA2_LIB 0
-#define HAVE_DXVA2API_COBJ 0
#define HAVE_LIBC_MSVCRT 0
-#define HAVE_LIBDC1394_1 0
-#define HAVE_LIBDC1394_2 0
#define HAVE_MAKEINFO 1
-#define HAVE_MAKEINFO_HTML 1
+#define HAVE_MAKEINFO_HTML 0
#define HAVE_MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS 0
#define HAVE_PERL 1
#define HAVE_POD2MAN 1
-#define HAVE_SDL2 0
#define HAVE_SECTION_DATA_REL_RO 0
#define HAVE_TEXI2HTML 0
#define HAVE_THREADS 1
+#define HAVE_UWP 0
#define HAVE_VAAPI_DRM 0
#define HAVE_VAAPI_X11 0
#define HAVE_VDPAU_X11 0
#define HAVE_WINRT 0
-#define HAVE_XLIB 0
-#define CONFIG_BSFS 0
-#define CONFIG_DECODERS 1
-#define CONFIG_ENCODERS 0
-#define CONFIG_HWACCELS 0
-#define CONFIG_PARSERS 1
-#define CONFIG_INDEVS 0
-#define CONFIG_OUTDEVS 0
-#define CONFIG_FILTERS 0
-#define CONFIG_DEMUXERS 0
-#define CONFIG_MUXERS 0
-#define CONFIG_PROTOCOLS 0
#define CONFIG_DOC 0
-#define CONFIG_HTMLPAGES 1
+#define CONFIG_HTMLPAGES 0
#define CONFIG_MANPAGES 1
#define CONFIG_PODPAGES 1
#define CONFIG_TXTPAGES 1
#define CONFIG_AVIO_DIR_CMD_EXAMPLE 1
#define CONFIG_AVIO_READING_EXAMPLE 1
-#define CONFIG_DECODING_ENCODING_EXAMPLE 0
+#define CONFIG_DECODE_AUDIO_EXAMPLE 1
+#define CONFIG_DECODE_VIDEO_EXAMPLE 1
#define CONFIG_DEMUXING_DECODING_EXAMPLE 0
+#define CONFIG_ENCODE_AUDIO_EXAMPLE 1
+#define CONFIG_ENCODE_VIDEO_EXAMPLE 1
#define CONFIG_EXTRACT_MVS_EXAMPLE 0
#define CONFIG_FILTER_AUDIO_EXAMPLE 0
#define CONFIG_FILTERING_AUDIO_EXAMPLE 0
#define CONFIG_FILTERING_VIDEO_EXAMPLE 0
#define CONFIG_HTTP_MULTICLIENT_EXAMPLE 0
+#define CONFIG_HW_DECODE_EXAMPLE 0
#define CONFIG_METADATA_EXAMPLE 0
#define CONFIG_MUXING_EXAMPLE 0
#define CONFIG_QSVDEC_EXAMPLE 0
@@ -416,27 +409,55 @@
#define CONFIG_SCALING_VIDEO_EXAMPLE 0
#define CONFIG_TRANSCODE_AAC_EXAMPLE 0
#define CONFIG_TRANSCODING_EXAMPLE 0
+#define CONFIG_ALSA 0
+#define CONFIG_APPKIT 1
+#define CONFIG_AVFOUNDATION 1
+#define CONFIG_BZLIB 1
+#define CONFIG_COREIMAGE 1
+#define CONFIG_ICONV 0
+#define CONFIG_JACK 0
+#define CONFIG_LIBXCB 0
+#define CONFIG_LIBXCB_SHM 0
+#define CONFIG_LIBXCB_SHAPE 0
+#define CONFIG_LIBXCB_XFIXES 0
+#define CONFIG_LZMA 0
+#define CONFIG_SCHANNEL 0
+#define CONFIG_SDL2 0
+#define CONFIG_SECURETRANSPORT 0
+#define CONFIG_SNDIO 0
+#define CONFIG_XLIB 1
+#define CONFIG_ZLIB 1
#define CONFIG_AVISYNTH 0
-#define CONFIG_BZLIB 0
-#define CONFIG_CHROMAPRINT 0
-#define CONFIG_CRYSTALHD 0
-#define CONFIG_DECKLINK 0
#define CONFIG_FREI0R 0
-#define CONFIG_GCRYPT 0
+#define CONFIG_LIBCDIO 0
+#define CONFIG_LIBRUBBERBAND 0
+#define CONFIG_LIBVIDSTAB 0
+#define CONFIG_LIBX264 0
+#define CONFIG_LIBX265 0
+#define CONFIG_LIBXAVS 0
+#define CONFIG_LIBXVID 0
+#define CONFIG_DECKLINK 0
+#define CONFIG_LIBNDI_NEWTEK 0
+#define CONFIG_LIBFDK_AAC 0
+#define CONFIG_OPENSSL 0
#define CONFIG_GMP 0
+#define CONFIG_LIBOPENCORE_AMRNB 0
+#define CONFIG_LIBOPENCORE_AMRWB 0
+#define CONFIG_LIBVO_AMRWBENC 0
+#define CONFIG_RKMPP 0
+#define CONFIG_LIBSMBCLIENT 0
+#define CONFIG_CHROMAPRINT 0
+#define CONFIG_GCRYPT 0
#define CONFIG_GNUTLS 0
-#define CONFIG_ICONV 0
#define CONFIG_JNI 0
#define CONFIG_LADSPA 0
#define CONFIG_LIBASS 0
#define CONFIG_LIBBLURAY 0
#define CONFIG_LIBBS2B 0
#define CONFIG_LIBCACA 0
-#define CONFIG_LIBCDIO 0
#define CONFIG_LIBCELT 0
#define CONFIG_LIBDC1394 0
-#define CONFIG_LIBEBUR128 0
-#define CONFIG_LIBFDK_AAC 0
+#define CONFIG_LIBDRM 0
#define CONFIG_LIBFLITE 0
#define CONFIG_LIBFONTCONFIG 0
#define CONFIG_LIBFREETYPE 0
@@ -448,18 +469,15 @@
#define CONFIG_LIBKVAZAAR 0
#define CONFIG_LIBMODPLUG 0
#define CONFIG_LIBMP3LAME 0
-#define CONFIG_LIBNUT 0
-#define CONFIG_LIBOPENCORE_AMRNB 0
-#define CONFIG_LIBOPENCORE_AMRWB 0
+#define CONFIG_LIBMYSOFA 0
#define CONFIG_LIBOPENCV 0
#define CONFIG_LIBOPENH264 0
#define CONFIG_LIBOPENJPEG 0
#define CONFIG_LIBOPENMPT 0
#define CONFIG_LIBOPUS 0
#define CONFIG_LIBPULSE 0
+#define CONFIG_LIBRSVG 0
#define CONFIG_LIBRTMP 0
-#define CONFIG_LIBRUBBERBAND 0
-#define CONFIG_LIBSCHROEDINGER 0
#define CONFIG_LIBSHINE 0
#define CONFIG_LIBSMBCLIENT 0
#define CONFIG_LIBSNAPPY 0
@@ -470,53 +488,37 @@
#define CONFIG_LIBTHEORA 0
#define CONFIG_LIBTWOLAME 0
#define CONFIG_LIBV4L2 0
-#define CONFIG_LIBVIDSTAB 0
-#define CONFIG_LIBVO_AMRWBENC 0
+#define CONFIG_LIBVMAF 0
#define CONFIG_LIBVORBIS 0
#define CONFIG_LIBVPX 0
#define CONFIG_LIBWAVPACK 0
#define CONFIG_LIBWEBP 0
-#define CONFIG_LIBX264 0
-#define CONFIG_LIBX265 0
-#define CONFIG_LIBXAVS 0
-#define CONFIG_LIBXCB 0
-#define CONFIG_LIBXCB_SHM 0
-#define CONFIG_LIBXCB_SHAPE 0
-#define CONFIG_LIBXCB_XFIXES 0
-#define CONFIG_LIBXVID 0
+#define CONFIG_LIBXML2 0
#define CONFIG_LIBZIMG 0
#define CONFIG_LIBZMQ 0
#define CONFIG_LIBZVBI 0
-#define CONFIG_LZMA 0
#define CONFIG_MEDIACODEC 0
-#define CONFIG_NETCDF 0
#define CONFIG_OPENAL 0
#define CONFIG_OPENCL 0
#define CONFIG_OPENGL 0
-#define CONFIG_OPENSSL 0
-#define CONFIG_SCHANNEL 0
-#define CONFIG_SDL 0
-#define CONFIG_SDL2 0
-#define CONFIG_SECURETRANSPORT 0
-#define CONFIG_VIDEOTOOLBOX 0
-#define CONFIG_X11GRAB 0
-#define CONFIG_XLIB 0
-#define CONFIG_ZLIB 0
-#define CONFIG_AUDIOTOOLBOX 0
+#define CONFIG_AUDIOTOOLBOX 1
+#define CONFIG_CRYSTALHD 0
#define CONFIG_CUDA 0
#define CONFIG_CUVID 0
#define CONFIG_D3D11VA 0
#define CONFIG_DXVA2 0
-#define CONFIG_LIBMFX 0
-#define CONFIG_LIBNPP 0
-#define CONFIG_MMAL 0
#define CONFIG_NVENC 0
-#define CONFIG_OMX 0
#define CONFIG_VAAPI 0
#define CONFIG_VDA 0
#define CONFIG_VDPAU 0
-#define CONFIG_VIDEOTOOLBOX_HWACCEL 0
+#define CONFIG_VIDEOTOOLBOX 0
+#define CONFIG_V4L2_M2M 0
#define CONFIG_XVMC 0
+#define CONFIG_CUDA_SDK 0
+#define CONFIG_LIBNPP 0
+#define CONFIG_LIBMFX 0
+#define CONFIG_MMAL 0
+#define CONFIG_OMX 0
#define CONFIG_FTRAPV 0
#define CONFIG_GRAY 0
#define CONFIG_HARDCODED_TABLES 0
@@ -555,16 +557,27 @@
#define CONFIG_PIXELUTILS 0
#define CONFIG_NETWORK 0
#define CONFIG_RDFT 0
+#define CONFIG_AUTODETECT 0
#define CONFIG_FONTCONFIG 0
-#define CONFIG_MEMALIGN_HACK 0
+#define CONFIG_LINUX_PERF 0
#define CONFIG_MEMORY_POISONING 0
#define CONFIG_NEON_CLOBBER_TEST 0
+#define CONFIG_OSSFUZZ 0
#define CONFIG_PIC 1
-#define CONFIG_POD2MAN 1
-#define CONFIG_RAISE_MAJOR 0
#define CONFIG_THUMB 0
#define CONFIG_VALGRIND_BACKTRACE 0
#define CONFIG_XMM_CLOBBER_TEST 0
+#define CONFIG_BSFS 1
+#define CONFIG_DECODERS 1
+#define CONFIG_ENCODERS 0
+#define CONFIG_HWACCELS 0
+#define CONFIG_PARSERS 1
+#define CONFIG_INDEVS 0
+#define CONFIG_OUTDEVS 0
+#define CONFIG_FILTERS 0
+#define CONFIG_DEMUXERS 0
+#define CONFIG_MUXERS 0
+#define CONFIG_PROTOCOLS 0
#define CONFIG_AANDCTTABLES 0
#define CONFIG_AC3DSP 0
#define CONFIG_AUDIO_FRAME_QUEUE 0
@@ -582,20 +595,22 @@
#define CONFIG_FMTCONVERT 0
#define CONFIG_FRAME_THREAD_ENCODER 0
#define CONFIG_G722DSP 0
-#define CONFIG_GOLOMB 1
+#define CONFIG_GOLOMB 0
#define CONFIG_GPLV3 0
#define CONFIG_H263DSP 0
#define CONFIG_H264CHROMA 0
#define CONFIG_H264DSP 0
+#define CONFIG_H264PARSE 0
#define CONFIG_H264PRED 1
#define CONFIG_H264QPEL 0
+#define CONFIG_HEVCPARSE 0
#define CONFIG_HPELDSP 0
#define CONFIG_HUFFMAN 0
#define CONFIG_HUFFYUVDSP 0
#define CONFIG_HUFFYUVENCDSP 0
#define CONFIG_IDCTDSP 0
#define CONFIG_IIRFILTER 0
-#define CONFIG_IMDCT15 0
+#define CONFIG_MDCT15 0
#define CONFIG_INTRAX8 0
#define CONFIG_ISO_MEDIA 0
#define CONFIG_IVIDSP 0
@@ -604,12 +619,14 @@
#define CONFIG_LIBX262 0
#define CONFIG_LLAUDDSP 0
#define CONFIG_LLVIDDSP 0
+#define CONFIG_LLVIDENCDSP 0
#define CONFIG_LPC 0
#define CONFIG_LZF 0
#define CONFIG_ME_CMP 0
#define CONFIG_MPEG_ER 0
#define CONFIG_MPEGAUDIO 0
#define CONFIG_MPEGAUDIODSP 0
+#define CONFIG_MPEGAUDIOHEADER 0
#define CONFIG_MPEGVIDEO 0
#define CONFIG_MPEGVIDEOENC 0
#define CONFIG_MSS34DSP 0
@@ -631,1595 +648,20 @@
#define CONFIG_TEXTUREDSP 0
#define CONFIG_TEXTUREDSPENC 0
#define CONFIG_TPELDSP 0
+#define CONFIG_VAAPI_1 0
#define CONFIG_VAAPI_ENCODE 0
#define CONFIG_VC1DSP 0
#define CONFIG_VIDEODSP 1
#define CONFIG_VP3DSP 0
#define CONFIG_VP56DSP 0
#define CONFIG_VP8DSP 1
-#define CONFIG_VT_BT2020 0
#define CONFIG_WMA_FREQS 0
#define CONFIG_WMV2DSP 0
-#define CONFIG_AAC_ADTSTOASC_BSF 0
-#define CONFIG_CHOMP_BSF 0
-#define CONFIG_DUMP_EXTRADATA_BSF 0
-#define CONFIG_DCA_CORE_BSF 0
-#define CONFIG_H264_MP4TOANNEXB_BSF 0
-#define CONFIG_HEVC_MP4TOANNEXB_BSF 0
-#define CONFIG_IMX_DUMP_HEADER_BSF 0
-#define CONFIG_MJPEG2JPEG_BSF 0
-#define CONFIG_MJPEGA_DUMP_HEADER_BSF 0
-#define CONFIG_MP3_HEADER_DECOMPRESS_BSF 0
-#define CONFIG_MPEG4_UNPACK_BFRAMES_BSF 0
-#define CONFIG_MOV2TEXTSUB_BSF 0
-#define CONFIG_NOISE_BSF 0
-#define CONFIG_REMOVE_EXTRADATA_BSF 0
-#define CONFIG_TEXT2MOVSUB_BSF 0
-#define CONFIG_VP9_SUPERFRAME_BSF 0
-#define CONFIG_AASC_DECODER 0
-#define CONFIG_AIC_DECODER 0
-#define CONFIG_ALIAS_PIX_DECODER 0
-#define CONFIG_AMV_DECODER 0
-#define CONFIG_ANM_DECODER 0
-#define CONFIG_ANSI_DECODER 0
-#define CONFIG_APNG_DECODER 0
-#define CONFIG_ASV1_DECODER 0
-#define CONFIG_ASV2_DECODER 0
-#define CONFIG_AURA_DECODER 0
-#define CONFIG_AURA2_DECODER 0
-#define CONFIG_AVRP_DECODER 0
-#define CONFIG_AVRN_DECODER 0
-#define CONFIG_AVS_DECODER 0
-#define CONFIG_AVUI_DECODER 0
-#define CONFIG_AYUV_DECODER 0
-#define CONFIG_BETHSOFTVID_DECODER 0
-#define CONFIG_BFI_DECODER 0
-#define CONFIG_BINK_DECODER 0
-#define CONFIG_BMP_DECODER 0
-#define CONFIG_BMV_VIDEO_DECODER 0
-#define CONFIG_BRENDER_PIX_DECODER 0
-#define CONFIG_C93_DECODER 0
-#define CONFIG_CAVS_DECODER 0
-#define CONFIG_CDGRAPHICS_DECODER 0
-#define CONFIG_CDXL_DECODER 0
-#define CONFIG_CFHD_DECODER 0
-#define CONFIG_CINEPAK_DECODER 0
-#define CONFIG_CLJR_DECODER 0
-#define CONFIG_CLLC_DECODER 0
-#define CONFIG_COMFORTNOISE_DECODER 0
-#define CONFIG_CPIA_DECODER 0
-#define CONFIG_CSCD_DECODER 0
-#define CONFIG_CYUV_DECODER 0
-#define CONFIG_DDS_DECODER 0
-#define CONFIG_DFA_DECODER 0
-#define CONFIG_DIRAC_DECODER 0
-#define CONFIG_DNXHD_DECODER 0
-#define CONFIG_DPX_DECODER 0
-#define CONFIG_DSICINVIDEO_DECODER 0
-#define CONFIG_DVAUDIO_DECODER 0
-#define CONFIG_DVVIDEO_DECODER 0
-#define CONFIG_DXA_DECODER 0
-#define CONFIG_DXTORY_DECODER 0
-#define CONFIG_DXV_DECODER 0
-#define CONFIG_EACMV_DECODER 0
-#define CONFIG_EAMAD_DECODER 0
-#define CONFIG_EATGQ_DECODER 0
-#define CONFIG_EATGV_DECODER 0
-#define CONFIG_EATQI_DECODER 0
-#define CONFIG_EIGHTBPS_DECODER 0
-#define CONFIG_EIGHTSVX_EXP_DECODER 0
-#define CONFIG_EIGHTSVX_FIB_DECODER 0
-#define CONFIG_ESCAPE124_DECODER 0
-#define CONFIG_ESCAPE130_DECODER 0
-#define CONFIG_EXR_DECODER 0
-#define CONFIG_FFV1_DECODER 0
-#define CONFIG_FFVHUFF_DECODER 0
-#define CONFIG_FIC_DECODER 0
-#define CONFIG_FLASHSV_DECODER 0
-#define CONFIG_FLASHSV2_DECODER 0
-#define CONFIG_FLIC_DECODER 0
-#define CONFIG_FLV_DECODER 0
-#define CONFIG_FOURXM_DECODER 0
-#define CONFIG_FRAPS_DECODER 0
-#define CONFIG_FRWU_DECODER 0
-#define CONFIG_G2M_DECODER 0
-#define CONFIG_GIF_DECODER 0
-#define CONFIG_H261_DECODER 0
-#define CONFIG_H263_DECODER 0
-#define CONFIG_H263I_DECODER 0
-#define CONFIG_H263P_DECODER 0
-#define CONFIG_H264_DECODER 0
-#define CONFIG_H264_CRYSTALHD_DECODER 0
-#define CONFIG_H264_MEDIACODEC_DECODER 0
-#define CONFIG_H264_MMAL_DECODER 0
-#define CONFIG_H264_QSV_DECODER 0
-#define CONFIG_H264_VDA_DECODER 0
-#define CONFIG_H264_VDPAU_DECODER 0
-#define CONFIG_HAP_DECODER 0
-#define CONFIG_HEVC_DECODER 0
-#define CONFIG_HEVC_QSV_DECODER 0
-#define CONFIG_HNM4_VIDEO_DECODER 0
-#define CONFIG_HQ_HQA_DECODER 0
-#define CONFIG_HQX_DECODER 0
-#define CONFIG_HUFFYUV_DECODER 0
-#define CONFIG_IDCIN_DECODER 0
-#define CONFIG_IFF_ILBM_DECODER 0
-#define CONFIG_INDEO2_DECODER 0
-#define CONFIG_INDEO3_DECODER 0
-#define CONFIG_INDEO4_DECODER 0
-#define CONFIG_INDEO5_DECODER 0
-#define CONFIG_INTERPLAY_VIDEO_DECODER 0
-#define CONFIG_JPEG2000_DECODER 0
-#define CONFIG_JPEGLS_DECODER 0
-#define CONFIG_JV_DECODER 0
-#define CONFIG_KGV1_DECODER 0
-#define CONFIG_KMVC_DECODER 0
-#define CONFIG_LAGARITH_DECODER 0
-#define CONFIG_LOCO_DECODER 0
-#define CONFIG_M101_DECODER 0
-#define CONFIG_MAGICYUV_DECODER 0
-#define CONFIG_MDEC_DECODER 0
-#define CONFIG_MIMIC_DECODER 0
-#define CONFIG_MJPEG_DECODER 0
-#define CONFIG_MJPEGB_DECODER 0
-#define CONFIG_MMVIDEO_DECODER 0
-#define CONFIG_MOTIONPIXELS_DECODER 0
-#define CONFIG_MPEG_XVMC_DECODER 0
-#define CONFIG_MPEG1VIDEO_DECODER 0
-#define CONFIG_MPEG2VIDEO_DECODER 0
-#define CONFIG_MPEG4_DECODER 0
-#define CONFIG_MPEG4_CRYSTALHD_DECODER 0
-#define CONFIG_MPEG4_MMAL_DECODER 0
-#define CONFIG_MPEG4_VDPAU_DECODER 0
-#define CONFIG_MPEGVIDEO_DECODER 0
-#define CONFIG_MPEG_VDPAU_DECODER 0
-#define CONFIG_MPEG1_VDPAU_DECODER 0
-#define CONFIG_MPEG2_MMAL_DECODER 0
-#define CONFIG_MPEG2_CRYSTALHD_DECODER 0
-#define CONFIG_MPEG2_QSV_DECODER 0
-#define CONFIG_MSA1_DECODER 0
-#define CONFIG_MSMPEG4_CRYSTALHD_DECODER 0
-#define CONFIG_MSMPEG4V1_DECODER 0
-#define CONFIG_MSMPEG4V2_DECODER 0
-#define CONFIG_MSMPEG4V3_DECODER 0
-#define CONFIG_MSRLE_DECODER 0
-#define CONFIG_MSS1_DECODER 0
-#define CONFIG_MSS2_DECODER 0
-#define CONFIG_MSVIDEO1_DECODER 0
-#define CONFIG_MSZH_DECODER 0
-#define CONFIG_MTS2_DECODER 0
-#define CONFIG_MVC1_DECODER 0
-#define CONFIG_MVC2_DECODER 0
-#define CONFIG_MXPEG_DECODER 0
-#define CONFIG_NUV_DECODER 0
-#define CONFIG_PAF_VIDEO_DECODER 0
-#define CONFIG_PAM_DECODER 0
-#define CONFIG_PBM_DECODER 0
-#define CONFIG_PCX_DECODER 0
-#define CONFIG_PGM_DECODER 0
-#define CONFIG_PGMYUV_DECODER 0
-#define CONFIG_PICTOR_DECODER 0
-#define CONFIG_PNG_DECODER 0
-#define CONFIG_PPM_DECODER 0
-#define CONFIG_PRORES_DECODER 0
-#define CONFIG_PRORES_LGPL_DECODER 0
-#define CONFIG_PTX_DECODER 0
-#define CONFIG_QDRAW_DECODER 0
-#define CONFIG_QPEG_DECODER 0
-#define CONFIG_QTRLE_DECODER 0
-#define CONFIG_R10K_DECODER 0
-#define CONFIG_R210_DECODER 0
-#define CONFIG_RAWVIDEO_DECODER 0
-#define CONFIG_RL2_DECODER 0
-#define CONFIG_ROQ_DECODER 0
-#define CONFIG_RPZA_DECODER 0
-#define CONFIG_RSCC_DECODER 0
-#define CONFIG_RV10_DECODER 0
-#define CONFIG_RV20_DECODER 0
-#define CONFIG_RV30_DECODER 0
-#define CONFIG_RV40_DECODER 0
-#define CONFIG_S302M_DECODER 0
-#define CONFIG_SANM_DECODER 0
-#define CONFIG_SCREENPRESSO_DECODER 0
-#define CONFIG_SDX2_DPCM_DECODER 0
-#define CONFIG_SGI_DECODER 0
-#define CONFIG_SGIRLE_DECODER 0
-#define CONFIG_SHEERVIDEO_DECODER 0
-#define CONFIG_SMACKER_DECODER 0
-#define CONFIG_SMC_DECODER 0
-#define CONFIG_SMVJPEG_DECODER 0
-#define CONFIG_SNOW_DECODER 0
-#define CONFIG_SP5X_DECODER 0
-#define CONFIG_SUNRAST_DECODER 0
-#define CONFIG_SVQ1_DECODER 0
-#define CONFIG_SVQ3_DECODER 0
-#define CONFIG_TARGA_DECODER 0
-#define CONFIG_TARGA_Y216_DECODER 0
-#define CONFIG_TDSC_DECODER 0
-#define CONFIG_THEORA_DECODER 0
-#define CONFIG_THP_DECODER 0
-#define CONFIG_TIERTEXSEQVIDEO_DECODER 0
-#define CONFIG_TIFF_DECODER 0
-#define CONFIG_TMV_DECODER 0
-#define CONFIG_TRUEMOTION1_DECODER 0
-#define CONFIG_TRUEMOTION2_DECODER 0
-#define CONFIG_TRUEMOTION2RT_DECODER 0
-#define CONFIG_TSCC_DECODER 0
-#define CONFIG_TSCC2_DECODER 0
-#define CONFIG_TXD_DECODER 0
-#define CONFIG_ULTI_DECODER 0
-#define CONFIG_UTVIDEO_DECODER 0
-#define CONFIG_V210_DECODER 0
-#define CONFIG_V210X_DECODER 0
-#define CONFIG_V308_DECODER 0
-#define CONFIG_V408_DECODER 0
-#define CONFIG_V410_DECODER 0
-#define CONFIG_VB_DECODER 0
-#define CONFIG_VBLE_DECODER 0
-#define CONFIG_VC1_DECODER 0
-#define CONFIG_VC1_CRYSTALHD_DECODER 0
-#define CONFIG_VC1_VDPAU_DECODER 0
-#define CONFIG_VC1IMAGE_DECODER 0
-#define CONFIG_VC1_MMAL_DECODER 0
-#define CONFIG_VC1_QSV_DECODER 0
-#define CONFIG_VCR1_DECODER 0
-#define CONFIG_VMDVIDEO_DECODER 0
-#define CONFIG_VMNC_DECODER 0
-#define CONFIG_VP3_DECODER 0
-#define CONFIG_VP5_DECODER 0
-#define CONFIG_VP6_DECODER 0
-#define CONFIG_VP6A_DECODER 0
-#define CONFIG_VP6F_DECODER 0
-#define CONFIG_VP7_DECODER 0
+#define CONFIG_NULL_BSF 1
#define CONFIG_VP8_DECODER 1
#define CONFIG_VP9_DECODER 1
-#define CONFIG_VQA_DECODER 0
-#define CONFIG_WEBP_DECODER 0
-#define CONFIG_WMV1_DECODER 0
-#define CONFIG_WMV2_DECODER 0
-#define CONFIG_WMV3_DECODER 0
-#define CONFIG_WMV3_CRYSTALHD_DECODER 0
-#define CONFIG_WMV3_VDPAU_DECODER 0
-#define CONFIG_WMV3IMAGE_DECODER 0
-#define CONFIG_WNV1_DECODER 0
-#define CONFIG_XAN_WC3_DECODER 0
-#define CONFIG_XAN_WC4_DECODER 0
-#define CONFIG_XBM_DECODER 0
-#define CONFIG_XFACE_DECODER 0
-#define CONFIG_XL_DECODER 0
-#define CONFIG_XWD_DECODER 0
-#define CONFIG_Y41P_DECODER 0
-#define CONFIG_YLC_DECODER 0
-#define CONFIG_YOP_DECODER 0
-#define CONFIG_YUV4_DECODER 0
-#define CONFIG_ZERO12V_DECODER 0
-#define CONFIG_ZEROCODEC_DECODER 0
-#define CONFIG_ZLIB_DECODER 0
-#define CONFIG_ZMBV_DECODER 0
-#define CONFIG_AAC_DECODER 0
-#define CONFIG_AAC_FIXED_DECODER 0
-#define CONFIG_AAC_LATM_DECODER 0
-#define CONFIG_AC3_DECODER 0
-#define CONFIG_AC3_FIXED_DECODER 0
-#define CONFIG_ALAC_DECODER 0
-#define CONFIG_ALS_DECODER 0
-#define CONFIG_AMRNB_DECODER 0
-#define CONFIG_AMRWB_DECODER 0
-#define CONFIG_APE_DECODER 0
-#define CONFIG_ATRAC1_DECODER 0
-#define CONFIG_ATRAC3_DECODER 0
-#define CONFIG_ATRAC3P_DECODER 0
-#define CONFIG_BINKAUDIO_DCT_DECODER 0
-#define CONFIG_BINKAUDIO_RDFT_DECODER 0
-#define CONFIG_BMV_AUDIO_DECODER 0
-#define CONFIG_COOK_DECODER 0
-#define CONFIG_DCA_DECODER 0
-#define CONFIG_DSD_LSBF_DECODER 0
-#define CONFIG_DSD_MSBF_DECODER 0
-#define CONFIG_DSD_LSBF_PLANAR_DECODER 0
-#define CONFIG_DSD_MSBF_PLANAR_DECODER 0
-#define CONFIG_DSICINAUDIO_DECODER 0
-#define CONFIG_DSS_SP_DECODER 0
-#define CONFIG_DST_DECODER 0
-#define CONFIG_EAC3_DECODER 0
-#define CONFIG_EVRC_DECODER 0
-#define CONFIG_FFWAVESYNTH_DECODER 0
#define CONFIG_FLAC_DECODER 1
-#define CONFIG_G723_1_DECODER 0
-#define CONFIG_G729_DECODER 0
-#define CONFIG_GSM_DECODER 0
-#define CONFIG_GSM_MS_DECODER 0
-#define CONFIG_IAC_DECODER 0
-#define CONFIG_IMC_DECODER 0
-#define CONFIG_INTERPLAY_ACM_DECODER 0
-#define CONFIG_MACE3_DECODER 0
-#define CONFIG_MACE6_DECODER 0
-#define CONFIG_METASOUND_DECODER 0
-#define CONFIG_MLP_DECODER 0
-#define CONFIG_MP1_DECODER 0
-#define CONFIG_MP1FLOAT_DECODER 0
-#define CONFIG_MP2_DECODER 0
-#define CONFIG_MP2FLOAT_DECODER 0
-#define CONFIG_MP3_DECODER 0
-#define CONFIG_MP3FLOAT_DECODER 0
-#define CONFIG_MP3ADU_DECODER 0
-#define CONFIG_MP3ADUFLOAT_DECODER 0
-#define CONFIG_MP3ON4_DECODER 0
-#define CONFIG_MP3ON4FLOAT_DECODER 0
-#define CONFIG_MPC7_DECODER 0
-#define CONFIG_MPC8_DECODER 0
-#define CONFIG_NELLYMOSER_DECODER 0
-#define CONFIG_ON2AVC_DECODER 0
-#define CONFIG_OPUS_DECODER 0
-#define CONFIG_PAF_AUDIO_DECODER 0
-#define CONFIG_QCELP_DECODER 0
-#define CONFIG_QDM2_DECODER 0
-#define CONFIG_RA_144_DECODER 0
-#define CONFIG_RA_288_DECODER 0
-#define CONFIG_RALF_DECODER 0
-#define CONFIG_SHORTEN_DECODER 0
-#define CONFIG_SIPR_DECODER 0
-#define CONFIG_SMACKAUD_DECODER 0
-#define CONFIG_SONIC_DECODER 0
-#define CONFIG_TAK_DECODER 0
-#define CONFIG_TRUEHD_DECODER 0
-#define CONFIG_TRUESPEECH_DECODER 0
-#define CONFIG_TTA_DECODER 0
-#define CONFIG_TWINVQ_DECODER 0
-#define CONFIG_VMDAUDIO_DECODER 0
-#define CONFIG_VORBIS_DECODER 0
-#define CONFIG_WAVPACK_DECODER 0
-#define CONFIG_WMALOSSLESS_DECODER 0
-#define CONFIG_WMAPRO_DECODER 0
-#define CONFIG_WMAV1_DECODER 0
-#define CONFIG_WMAV2_DECODER 0
-#define CONFIG_WMAVOICE_DECODER 0
-#define CONFIG_WS_SND1_DECODER 0
-#define CONFIG_XMA1_DECODER 0
-#define CONFIG_XMA2_DECODER 0
-#define CONFIG_PCM_ALAW_DECODER 0
-#define CONFIG_PCM_BLURAY_DECODER 0
-#define CONFIG_PCM_DVD_DECODER 0
-#define CONFIG_PCM_F32BE_DECODER 0
-#define CONFIG_PCM_F32LE_DECODER 0
-#define CONFIG_PCM_F64BE_DECODER 0
-#define CONFIG_PCM_F64LE_DECODER 0
-#define CONFIG_PCM_LXF_DECODER 0
-#define CONFIG_PCM_MULAW_DECODER 0
-#define CONFIG_PCM_S8_DECODER 0
-#define CONFIG_PCM_S8_PLANAR_DECODER 0
-#define CONFIG_PCM_S16BE_DECODER 0
-#define CONFIG_PCM_S16BE_PLANAR_DECODER 0
-#define CONFIG_PCM_S16LE_DECODER 0
-#define CONFIG_PCM_S16LE_PLANAR_DECODER 0
-#define CONFIG_PCM_S24BE_DECODER 0
-#define CONFIG_PCM_S24DAUD_DECODER 0
-#define CONFIG_PCM_S24LE_DECODER 0
-#define CONFIG_PCM_S24LE_PLANAR_DECODER 0
-#define CONFIG_PCM_S32BE_DECODER 0
-#define CONFIG_PCM_S32LE_DECODER 0
-#define CONFIG_PCM_S32LE_PLANAR_DECODER 0
-#define CONFIG_PCM_S64BE_DECODER 0
-#define CONFIG_PCM_S64LE_DECODER 0
-#define CONFIG_PCM_U8_DECODER 0
-#define CONFIG_PCM_U16BE_DECODER 0
-#define CONFIG_PCM_U16LE_DECODER 0
-#define CONFIG_PCM_U24BE_DECODER 0
-#define CONFIG_PCM_U24LE_DECODER 0
-#define CONFIG_PCM_U32BE_DECODER 0
-#define CONFIG_PCM_U32LE_DECODER 0
-#define CONFIG_PCM_ZORK_DECODER 0
-#define CONFIG_INTERPLAY_DPCM_DECODER 0
-#define CONFIG_ROQ_DPCM_DECODER 0
-#define CONFIG_SOL_DPCM_DECODER 0
-#define CONFIG_XAN_DPCM_DECODER 0
-#define CONFIG_ADPCM_4XM_DECODER 0
-#define CONFIG_ADPCM_ADX_DECODER 0
-#define CONFIG_ADPCM_AFC_DECODER 0
-#define CONFIG_ADPCM_AICA_DECODER 0
-#define CONFIG_ADPCM_CT_DECODER 0
-#define CONFIG_ADPCM_DTK_DECODER 0
-#define CONFIG_ADPCM_EA_DECODER 0
-#define CONFIG_ADPCM_EA_MAXIS_XA_DECODER 0
-#define CONFIG_ADPCM_EA_R1_DECODER 0
-#define CONFIG_ADPCM_EA_R2_DECODER 0
-#define CONFIG_ADPCM_EA_R3_DECODER 0
-#define CONFIG_ADPCM_EA_XAS_DECODER 0
-#define CONFIG_ADPCM_G722_DECODER 0
-#define CONFIG_ADPCM_G726_DECODER 0
-#define CONFIG_ADPCM_G726LE_DECODER 0
-#define CONFIG_ADPCM_IMA_AMV_DECODER 0
-#define CONFIG_ADPCM_IMA_APC_DECODER 0
-#define CONFIG_ADPCM_IMA_DAT4_DECODER 0
-#define CONFIG_ADPCM_IMA_DK3_DECODER 0
-#define CONFIG_ADPCM_IMA_DK4_DECODER 0
-#define CONFIG_ADPCM_IMA_EA_EACS_DECODER 0
-#define CONFIG_ADPCM_IMA_EA_SEAD_DECODER 0
-#define CONFIG_ADPCM_IMA_ISS_DECODER 0
-#define CONFIG_ADPCM_IMA_OKI_DECODER 0
-#define CONFIG_ADPCM_IMA_QT_DECODER 0
-#define CONFIG_ADPCM_IMA_RAD_DECODER 0
-#define CONFIG_ADPCM_IMA_SMJPEG_DECODER 0
-#define CONFIG_ADPCM_IMA_WAV_DECODER 0
-#define CONFIG_ADPCM_IMA_WS_DECODER 0
-#define CONFIG_ADPCM_MS_DECODER 0
-#define CONFIG_ADPCM_MTAF_DECODER 0
-#define CONFIG_ADPCM_PSX_DECODER 0
-#define CONFIG_ADPCM_SBPRO_2_DECODER 0
-#define CONFIG_ADPCM_SBPRO_3_DECODER 0
-#define CONFIG_ADPCM_SBPRO_4_DECODER 0
-#define CONFIG_ADPCM_SWF_DECODER 0
-#define CONFIG_ADPCM_THP_DECODER 0
-#define CONFIG_ADPCM_THP_LE_DECODER 0
-#define CONFIG_ADPCM_VIMA_DECODER 0
-#define CONFIG_ADPCM_XA_DECODER 0
-#define CONFIG_ADPCM_YAMAHA_DECODER 0
-#define CONFIG_SSA_DECODER 0
-#define CONFIG_ASS_DECODER 0
-#define CONFIG_CCAPTION_DECODER 0
-#define CONFIG_DVBSUB_DECODER 0
-#define CONFIG_DVDSUB_DECODER 0
-#define CONFIG_JACOSUB_DECODER 0
-#define CONFIG_MICRODVD_DECODER 0
-#define CONFIG_MOVTEXT_DECODER 0
-#define CONFIG_MPL2_DECODER 0
-#define CONFIG_PGSSUB_DECODER 0
-#define CONFIG_PJS_DECODER 0
-#define CONFIG_REALTEXT_DECODER 0
-#define CONFIG_SAMI_DECODER 0
-#define CONFIG_SRT_DECODER 0
-#define CONFIG_STL_DECODER 0
-#define CONFIG_SUBRIP_DECODER 0
-#define CONFIG_SUBVIEWER_DECODER 0
-#define CONFIG_SUBVIEWER1_DECODER 0
-#define CONFIG_TEXT_DECODER 0
-#define CONFIG_VPLAYER_DECODER 0
-#define CONFIG_WEBVTT_DECODER 0
-#define CONFIG_XSUB_DECODER 0
-#define CONFIG_AAC_AT_DECODER 0
-#define CONFIG_AC3_AT_DECODER 0
-#define CONFIG_ADPCM_IMA_QT_AT_DECODER 0
-#define CONFIG_ALAC_AT_DECODER 0
-#define CONFIG_AMR_NB_AT_DECODER 0
-#define CONFIG_EAC3_AT_DECODER 0
-#define CONFIG_GSM_MS_AT_DECODER 0
-#define CONFIG_ILBC_AT_DECODER 0
-#define CONFIG_MP1_AT_DECODER 0
-#define CONFIG_MP2_AT_DECODER 0
-#define CONFIG_MP3_AT_DECODER 0
-#define CONFIG_PCM_ALAW_AT_DECODER 0
-#define CONFIG_PCM_MULAW_AT_DECODER 0
-#define CONFIG_QDMC_AT_DECODER 0
-#define CONFIG_QDM2_AT_DECODER 0
-#define CONFIG_LIBCELT_DECODER 0
-#define CONFIG_LIBFDK_AAC_DECODER 0
-#define CONFIG_LIBGSM_DECODER 0
-#define CONFIG_LIBGSM_MS_DECODER 0
-#define CONFIG_LIBILBC_DECODER 0
-#define CONFIG_LIBOPENCORE_AMRNB_DECODER 0
-#define CONFIG_LIBOPENCORE_AMRWB_DECODER 0
-#define CONFIG_LIBOPENJPEG_DECODER 0
-#define CONFIG_LIBOPUS_DECODER 0
-#define CONFIG_LIBSCHROEDINGER_DECODER 0
-#define CONFIG_LIBSPEEX_DECODER 0
-#define CONFIG_LIBVORBIS_DECODER 0
-#define CONFIG_LIBVPX_VP8_DECODER 0
-#define CONFIG_LIBVPX_VP9_DECODER 0
-#define CONFIG_LIBZVBI_TELETEXT_DECODER 0
-#define CONFIG_BINTEXT_DECODER 0
-#define CONFIG_XBIN_DECODER 0
-#define CONFIG_IDF_DECODER 0
-#define CONFIG_LIBOPENH264_DECODER 0
-#define CONFIG_H263_CUVID_DECODER 0
-#define CONFIG_H264_CUVID_DECODER 0
-#define CONFIG_HEVC_CUVID_DECODER 0
-#define CONFIG_HEVC_MEDIACODEC_DECODER 0
-#define CONFIG_MJPEG_CUVID_DECODER 0
-#define CONFIG_MPEG1_CUVID_DECODER 0
-#define CONFIG_MPEG2_CUVID_DECODER 0
-#define CONFIG_MPEG4_CUVID_DECODER 0
-#define CONFIG_MPEG4_MEDIACODEC_DECODER 0
-#define CONFIG_VC1_CUVID_DECODER 0
-#define CONFIG_VP8_CUVID_DECODER 0
-#define CONFIG_VP8_MEDIACODEC_DECODER 0
-#define CONFIG_VP9_CUVID_DECODER 0
-#define CONFIG_VP9_MEDIACODEC_DECODER 0
-#define CONFIG_AA_DEMUXER 0
-#define CONFIG_AAC_DEMUXER 0
-#define CONFIG_AC3_DEMUXER 0
-#define CONFIG_ACM_DEMUXER 0
-#define CONFIG_ACT_DEMUXER 0
-#define CONFIG_ADF_DEMUXER 0
-#define CONFIG_ADP_DEMUXER 0
-#define CONFIG_ADS_DEMUXER 0
-#define CONFIG_ADX_DEMUXER 0
-#define CONFIG_AEA_DEMUXER 0
-#define CONFIG_AFC_DEMUXER 0
-#define CONFIG_AIFF_DEMUXER 0
-#define CONFIG_AIX_DEMUXER 0
-#define CONFIG_AMR_DEMUXER 0
-#define CONFIG_ANM_DEMUXER 0
-#define CONFIG_APC_DEMUXER 0
-#define CONFIG_APE_DEMUXER 0
-#define CONFIG_APNG_DEMUXER 0
-#define CONFIG_AQTITLE_DEMUXER 0
-#define CONFIG_ASF_DEMUXER 0
-#define CONFIG_ASF_O_DEMUXER 0
-#define CONFIG_ASS_DEMUXER 0
-#define CONFIG_AST_DEMUXER 0
-#define CONFIG_AU_DEMUXER 0
-#define CONFIG_AVI_DEMUXER 0
-#define CONFIG_AVISYNTH_DEMUXER 0
-#define CONFIG_AVR_DEMUXER 0
-#define CONFIG_AVS_DEMUXER 0
-#define CONFIG_BETHSOFTVID_DEMUXER 0
-#define CONFIG_BFI_DEMUXER 0
-#define CONFIG_BINTEXT_DEMUXER 0
-#define CONFIG_BINK_DEMUXER 0
-#define CONFIG_BIT_DEMUXER 0
-#define CONFIG_BMV_DEMUXER 0
-#define CONFIG_BFSTM_DEMUXER 0
-#define CONFIG_BRSTM_DEMUXER 0
-#define CONFIG_BOA_DEMUXER 0
-#define CONFIG_C93_DEMUXER 0
-#define CONFIG_CAF_DEMUXER 0
-#define CONFIG_CAVSVIDEO_DEMUXER 0
-#define CONFIG_CDG_DEMUXER 0
-#define CONFIG_CDXL_DEMUXER 0
-#define CONFIG_CINE_DEMUXER 0
-#define CONFIG_CONCAT_DEMUXER 0
-#define CONFIG_DATA_DEMUXER 0
-#define CONFIG_DAUD_DEMUXER 0
-#define CONFIG_DCSTR_DEMUXER 0
-#define CONFIG_DFA_DEMUXER 0
-#define CONFIG_DIRAC_DEMUXER 0
-#define CONFIG_DNXHD_DEMUXER 0
-#define CONFIG_DSF_DEMUXER 0
-#define CONFIG_DSICIN_DEMUXER 0
-#define CONFIG_DSS_DEMUXER 0
-#define CONFIG_DTS_DEMUXER 0
-#define CONFIG_DTSHD_DEMUXER 0
-#define CONFIG_DV_DEMUXER 0
-#define CONFIG_DVBSUB_DEMUXER 0
-#define CONFIG_DVBTXT_DEMUXER 0
-#define CONFIG_DXA_DEMUXER 0
-#define CONFIG_EA_DEMUXER 0
-#define CONFIG_EA_CDATA_DEMUXER 0
-#define CONFIG_EAC3_DEMUXER 0
-#define CONFIG_EPAF_DEMUXER 0
-#define CONFIG_FFM_DEMUXER 0
-#define CONFIG_FFMETADATA_DEMUXER 0
-#define CONFIG_FILMSTRIP_DEMUXER 0
-#define CONFIG_FLAC_DEMUXER 0
-#define CONFIG_FLIC_DEMUXER 0
-#define CONFIG_FLV_DEMUXER 0
-#define CONFIG_LIVE_FLV_DEMUXER 0
-#define CONFIG_FOURXM_DEMUXER 0
-#define CONFIG_FRM_DEMUXER 0
-#define CONFIG_FSB_DEMUXER 0
-#define CONFIG_G722_DEMUXER 0
-#define CONFIG_G723_1_DEMUXER 0
-#define CONFIG_G729_DEMUXER 0
-#define CONFIG_GENH_DEMUXER 0
-#define CONFIG_GIF_DEMUXER 0
-#define CONFIG_GSM_DEMUXER 0
-#define CONFIG_GXF_DEMUXER 0
-#define CONFIG_H261_DEMUXER 0
-#define CONFIG_H263_DEMUXER 0
-#define CONFIG_H264_DEMUXER 0
-#define CONFIG_HEVC_DEMUXER 0
-#define CONFIG_HLS_DEMUXER 0
-#define CONFIG_HNM_DEMUXER 0
-#define CONFIG_ICO_DEMUXER 0
-#define CONFIG_IDCIN_DEMUXER 0
-#define CONFIG_IDF_DEMUXER 0
-#define CONFIG_IFF_DEMUXER 0
-#define CONFIG_ILBC_DEMUXER 0
-#define CONFIG_IMAGE2_DEMUXER 0
-#define CONFIG_IMAGE2PIPE_DEMUXER 0
-#define CONFIG_IMAGE2_ALIAS_PIX_DEMUXER 0
-#define CONFIG_IMAGE2_BRENDER_PIX_DEMUXER 0
-#define CONFIG_INGENIENT_DEMUXER 0
-#define CONFIG_IPMOVIE_DEMUXER 0
-#define CONFIG_IRCAM_DEMUXER 0
-#define CONFIG_ISS_DEMUXER 0
-#define CONFIG_IV8_DEMUXER 0
-#define CONFIG_IVF_DEMUXER 0
-#define CONFIG_IVR_DEMUXER 0
-#define CONFIG_JACOSUB_DEMUXER 0
-#define CONFIG_JV_DEMUXER 0
-#define CONFIG_LMLM4_DEMUXER 0
-#define CONFIG_LOAS_DEMUXER 0
-#define CONFIG_LRC_DEMUXER 0
-#define CONFIG_LVF_DEMUXER 0
-#define CONFIG_LXF_DEMUXER 0
-#define CONFIG_M4V_DEMUXER 0
-#define CONFIG_MATROSKA_DEMUXER 0
-#define CONFIG_MGSTS_DEMUXER 0
-#define CONFIG_MICRODVD_DEMUXER 0
-#define CONFIG_MJPEG_DEMUXER 0
-#define CONFIG_MLP_DEMUXER 0
-#define CONFIG_MLV_DEMUXER 0
-#define CONFIG_MM_DEMUXER 0
-#define CONFIG_MMF_DEMUXER 0
-#define CONFIG_MOV_DEMUXER 0
-#define CONFIG_MP3_DEMUXER 0
-#define CONFIG_MPC_DEMUXER 0
-#define CONFIG_MPC8_DEMUXER 0
-#define CONFIG_MPEGPS_DEMUXER 0
-#define CONFIG_MPEGTS_DEMUXER 0
-#define CONFIG_MPEGTSRAW_DEMUXER 0
-#define CONFIG_MPEGVIDEO_DEMUXER 0
-#define CONFIG_MPJPEG_DEMUXER 0
-#define CONFIG_MPL2_DEMUXER 0
-#define CONFIG_MPSUB_DEMUXER 0
-#define CONFIG_MSF_DEMUXER 0
-#define CONFIG_MSNWC_TCP_DEMUXER 0
-#define CONFIG_MTAF_DEMUXER 0
-#define CONFIG_MTV_DEMUXER 0
-#define CONFIG_MUSX_DEMUXER 0
-#define CONFIG_MV_DEMUXER 0
-#define CONFIG_MVI_DEMUXER 0
-#define CONFIG_MXF_DEMUXER 0
-#define CONFIG_MXG_DEMUXER 0
-#define CONFIG_NC_DEMUXER 0
-#define CONFIG_NISTSPHERE_DEMUXER 0
-#define CONFIG_NSV_DEMUXER 0
-#define CONFIG_NUT_DEMUXER 0
-#define CONFIG_NUV_DEMUXER 0
-#define CONFIG_OGG_DEMUXER 0
-#define CONFIG_OMA_DEMUXER 0
-#define CONFIG_PAF_DEMUXER 0
-#define CONFIG_PCM_ALAW_DEMUXER 0
-#define CONFIG_PCM_MULAW_DEMUXER 0
-#define CONFIG_PCM_F64BE_DEMUXER 0
-#define CONFIG_PCM_F64LE_DEMUXER 0
-#define CONFIG_PCM_F32BE_DEMUXER 0
-#define CONFIG_PCM_F32LE_DEMUXER 0
-#define CONFIG_PCM_S32BE_DEMUXER 0
-#define CONFIG_PCM_S32LE_DEMUXER 0
-#define CONFIG_PCM_S24BE_DEMUXER 0
-#define CONFIG_PCM_S24LE_DEMUXER 0
-#define CONFIG_PCM_S16BE_DEMUXER 0
-#define CONFIG_PCM_S16LE_DEMUXER 0
-#define CONFIG_PCM_S8_DEMUXER 0
-#define CONFIG_PCM_U32BE_DEMUXER 0
-#define CONFIG_PCM_U32LE_DEMUXER 0
-#define CONFIG_PCM_U24BE_DEMUXER 0
-#define CONFIG_PCM_U24LE_DEMUXER 0
-#define CONFIG_PCM_U16BE_DEMUXER 0
-#define CONFIG_PCM_U16LE_DEMUXER 0
-#define CONFIG_PCM_U8_DEMUXER 0
-#define CONFIG_PJS_DEMUXER 0
-#define CONFIG_PMP_DEMUXER 0
-#define CONFIG_PVA_DEMUXER 0
-#define CONFIG_PVF_DEMUXER 0
-#define CONFIG_QCP_DEMUXER 0
-#define CONFIG_R3D_DEMUXER 0
-#define CONFIG_RAWVIDEO_DEMUXER 0
-#define CONFIG_REALTEXT_DEMUXER 0
-#define CONFIG_REDSPARK_DEMUXER 0
-#define CONFIG_RL2_DEMUXER 0
-#define CONFIG_RM_DEMUXER 0
-#define CONFIG_ROQ_DEMUXER 0
-#define CONFIG_RPL_DEMUXER 0
-#define CONFIG_RSD_DEMUXER 0
-#define CONFIG_RSO_DEMUXER 0
-#define CONFIG_RTP_DEMUXER 0
-#define CONFIG_RTSP_DEMUXER 0
-#define CONFIG_SAMI_DEMUXER 0
-#define CONFIG_SAP_DEMUXER 0
-#define CONFIG_SBG_DEMUXER 0
-#define CONFIG_SDP_DEMUXER 0
-#define CONFIG_SDR2_DEMUXER 0
-#define CONFIG_SEGAFILM_DEMUXER 0
-#define CONFIG_SHORTEN_DEMUXER 0
-#define CONFIG_SIFF_DEMUXER 0
-#define CONFIG_SLN_DEMUXER 0
-#define CONFIG_SMACKER_DEMUXER 0
-#define CONFIG_SMJPEG_DEMUXER 0
-#define CONFIG_SMUSH_DEMUXER 0
-#define CONFIG_SOL_DEMUXER 0
-#define CONFIG_SOX_DEMUXER 0
-#define CONFIG_SPDIF_DEMUXER 0
-#define CONFIG_SRT_DEMUXER 0
-#define CONFIG_STR_DEMUXER 0
-#define CONFIG_STL_DEMUXER 0
-#define CONFIG_SUBVIEWER1_DEMUXER 0
-#define CONFIG_SUBVIEWER_DEMUXER 0
-#define CONFIG_SUP_DEMUXER 0
-#define CONFIG_SVAG_DEMUXER 0
-#define CONFIG_SWF_DEMUXER 0
-#define CONFIG_TAK_DEMUXER 0
-#define CONFIG_TEDCAPTIONS_DEMUXER 0
-#define CONFIG_THP_DEMUXER 0
-#define CONFIG_THREEDOSTR_DEMUXER 0
-#define CONFIG_TIERTEXSEQ_DEMUXER 0
-#define CONFIG_TMV_DEMUXER 0
-#define CONFIG_TRUEHD_DEMUXER 0
-#define CONFIG_TTA_DEMUXER 0
-#define CONFIG_TXD_DEMUXER 0
-#define CONFIG_TTY_DEMUXER 0
-#define CONFIG_V210_DEMUXER 0
-#define CONFIG_V210X_DEMUXER 0
-#define CONFIG_VAG_DEMUXER 0
-#define CONFIG_VC1_DEMUXER 0
-#define CONFIG_VC1T_DEMUXER 0
-#define CONFIG_VIVO_DEMUXER 0
-#define CONFIG_VMD_DEMUXER 0
-#define CONFIG_VOBSUB_DEMUXER 0
-#define CONFIG_VOC_DEMUXER 0
-#define CONFIG_VPK_DEMUXER 0
-#define CONFIG_VPLAYER_DEMUXER 0
-#define CONFIG_VQF_DEMUXER 0
-#define CONFIG_W64_DEMUXER 0
-#define CONFIG_WAV_DEMUXER 0
-#define CONFIG_WC3_DEMUXER 0
-#define CONFIG_WEBM_DASH_MANIFEST_DEMUXER 0
-#define CONFIG_WEBVTT_DEMUXER 0
-#define CONFIG_WSAUD_DEMUXER 0
-#define CONFIG_WSD_DEMUXER 0
-#define CONFIG_WSVQA_DEMUXER 0
-#define CONFIG_WTV_DEMUXER 0
-#define CONFIG_WVE_DEMUXER 0
-#define CONFIG_WV_DEMUXER 0
-#define CONFIG_XA_DEMUXER 0
-#define CONFIG_XBIN_DEMUXER 0
-#define CONFIG_XMV_DEMUXER 0
-#define CONFIG_XVAG_DEMUXER 0
-#define CONFIG_XWMA_DEMUXER 0
-#define CONFIG_YOP_DEMUXER 0
-#define CONFIG_YUV4MPEGPIPE_DEMUXER 0
-#define CONFIG_IMAGE_BMP_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_DDS_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_DPX_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_EXR_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_J2K_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_JPEG_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_JPEGLS_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PAM_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PBM_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PCX_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PGMYUV_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PGM_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PICTOR_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PNG_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PPM_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_QDRAW_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_SGI_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_SUNRAST_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_TIFF_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_WEBP_PIPE_DEMUXER 0
-#define CONFIG_LIBGME_DEMUXER 0
-#define CONFIG_LIBMODPLUG_DEMUXER 0
-#define CONFIG_LIBNUT_DEMUXER 0
-#define CONFIG_LIBOPENMPT_DEMUXER 0
-#define CONFIG_A64MULTI_ENCODER 0
-#define CONFIG_A64MULTI5_ENCODER 0
-#define CONFIG_ALIAS_PIX_ENCODER 0
-#define CONFIG_AMV_ENCODER 0
-#define CONFIG_APNG_ENCODER 0
-#define CONFIG_ASV1_ENCODER 0
-#define CONFIG_ASV2_ENCODER 0
-#define CONFIG_AVRP_ENCODER 0
-#define CONFIG_AVUI_ENCODER 0
-#define CONFIG_AYUV_ENCODER 0
-#define CONFIG_BMP_ENCODER 0
-#define CONFIG_CINEPAK_ENCODER 0
-#define CONFIG_CLJR_ENCODER 0
-#define CONFIG_COMFORTNOISE_ENCODER 0
-#define CONFIG_DNXHD_ENCODER 0
-#define CONFIG_DPX_ENCODER 0
-#define CONFIG_DVVIDEO_ENCODER 0
-#define CONFIG_FFV1_ENCODER 0
-#define CONFIG_FFVHUFF_ENCODER 0
-#define CONFIG_FLASHSV_ENCODER 0
-#define CONFIG_FLASHSV2_ENCODER 0
-#define CONFIG_FLV_ENCODER 0
-#define CONFIG_GIF_ENCODER 0
-#define CONFIG_H261_ENCODER 0
-#define CONFIG_H263_ENCODER 0
-#define CONFIG_H263P_ENCODER 0
-#define CONFIG_HAP_ENCODER 0
-#define CONFIG_HUFFYUV_ENCODER 0
-#define CONFIG_JPEG2000_ENCODER 0
-#define CONFIG_JPEGLS_ENCODER 0
-#define CONFIG_LJPEG_ENCODER 0
-#define CONFIG_MJPEG_ENCODER 0
-#define CONFIG_MPEG1VIDEO_ENCODER 0
-#define CONFIG_MPEG2VIDEO_ENCODER 0
-#define CONFIG_MPEG4_ENCODER 0
-#define CONFIG_MSMPEG4V2_ENCODER 0
-#define CONFIG_MSMPEG4V3_ENCODER 0
-#define CONFIG_MSVIDEO1_ENCODER 0
-#define CONFIG_PAM_ENCODER 0
-#define CONFIG_PBM_ENCODER 0
-#define CONFIG_PCX_ENCODER 0
-#define CONFIG_PGM_ENCODER 0
-#define CONFIG_PGMYUV_ENCODER 0
-#define CONFIG_PNG_ENCODER 0
-#define CONFIG_PPM_ENCODER 0
-#define CONFIG_PRORES_ENCODER 0
-#define CONFIG_PRORES_AW_ENCODER 0
-#define CONFIG_PRORES_KS_ENCODER 0
-#define CONFIG_QTRLE_ENCODER 0
-#define CONFIG_R10K_ENCODER 0
-#define CONFIG_R210_ENCODER 0
-#define CONFIG_RAWVIDEO_ENCODER 0
-#define CONFIG_ROQ_ENCODER 0
-#define CONFIG_RV10_ENCODER 0
-#define CONFIG_RV20_ENCODER 0
-#define CONFIG_S302M_ENCODER 0
-#define CONFIG_SGI_ENCODER 0
-#define CONFIG_SNOW_ENCODER 0
-#define CONFIG_SUNRAST_ENCODER 0
-#define CONFIG_SVQ1_ENCODER 0
-#define CONFIG_TARGA_ENCODER 0
-#define CONFIG_TIFF_ENCODER 0
-#define CONFIG_UTVIDEO_ENCODER 0
-#define CONFIG_V210_ENCODER 0
-#define CONFIG_V308_ENCODER 0
-#define CONFIG_V408_ENCODER 0
-#define CONFIG_V410_ENCODER 0
-#define CONFIG_VC2_ENCODER 0
-#define CONFIG_WRAPPED_AVFRAME_ENCODER 0
-#define CONFIG_WMV1_ENCODER 0
-#define CONFIG_WMV2_ENCODER 0
-#define CONFIG_XBM_ENCODER 0
-#define CONFIG_XFACE_ENCODER 0
-#define CONFIG_XWD_ENCODER 0
-#define CONFIG_Y41P_ENCODER 0
-#define CONFIG_YUV4_ENCODER 0
-#define CONFIG_ZLIB_ENCODER 0
-#define CONFIG_ZMBV_ENCODER 0
-#define CONFIG_AAC_ENCODER 0
-#define CONFIG_AC3_ENCODER 0
-#define CONFIG_AC3_FIXED_ENCODER 0
-#define CONFIG_ALAC_ENCODER 0
-#define CONFIG_DCA_ENCODER 0
-#define CONFIG_EAC3_ENCODER 0
-#define CONFIG_FLAC_ENCODER 0
-#define CONFIG_G723_1_ENCODER 0
-#define CONFIG_MLP_ENCODER 0
-#define CONFIG_MP2_ENCODER 0
-#define CONFIG_MP2FIXED_ENCODER 0
-#define CONFIG_NELLYMOSER_ENCODER 0
-#define CONFIG_RA_144_ENCODER 0
-#define CONFIG_SONIC_ENCODER 0
-#define CONFIG_SONIC_LS_ENCODER 0
-#define CONFIG_TRUEHD_ENCODER 0
-#define CONFIG_TTA_ENCODER 0
-#define CONFIG_VORBIS_ENCODER 0
-#define CONFIG_WAVPACK_ENCODER 0
-#define CONFIG_WMAV1_ENCODER 0
-#define CONFIG_WMAV2_ENCODER 0
-#define CONFIG_PCM_ALAW_ENCODER 0
-#define CONFIG_PCM_F32BE_ENCODER 0
-#define CONFIG_PCM_F32LE_ENCODER 0
-#define CONFIG_PCM_F64BE_ENCODER 0
-#define CONFIG_PCM_F64LE_ENCODER 0
-#define CONFIG_PCM_MULAW_ENCODER 0
-#define CONFIG_PCM_S8_ENCODER 0
-#define CONFIG_PCM_S8_PLANAR_ENCODER 0
-#define CONFIG_PCM_S16BE_ENCODER 0
-#define CONFIG_PCM_S16BE_PLANAR_ENCODER 0
-#define CONFIG_PCM_S16LE_ENCODER 0
-#define CONFIG_PCM_S16LE_PLANAR_ENCODER 0
-#define CONFIG_PCM_S24BE_ENCODER 0
-#define CONFIG_PCM_S24DAUD_ENCODER 0
-#define CONFIG_PCM_S24LE_ENCODER 0
-#define CONFIG_PCM_S24LE_PLANAR_ENCODER 0
-#define CONFIG_PCM_S32BE_ENCODER 0
-#define CONFIG_PCM_S32LE_ENCODER 0
-#define CONFIG_PCM_S32LE_PLANAR_ENCODER 0
-#define CONFIG_PCM_S64BE_ENCODER 0
-#define CONFIG_PCM_S64LE_ENCODER 0
-#define CONFIG_PCM_U8_ENCODER 0
-#define CONFIG_PCM_U16BE_ENCODER 0
-#define CONFIG_PCM_U16LE_ENCODER 0
-#define CONFIG_PCM_U24BE_ENCODER 0
-#define CONFIG_PCM_U24LE_ENCODER 0
-#define CONFIG_PCM_U32BE_ENCODER 0
-#define CONFIG_PCM_U32LE_ENCODER 0
-#define CONFIG_ROQ_DPCM_ENCODER 0
-#define CONFIG_ADPCM_ADX_ENCODER 0
-#define CONFIG_ADPCM_G722_ENCODER 0
-#define CONFIG_ADPCM_G726_ENCODER 0
-#define CONFIG_ADPCM_IMA_QT_ENCODER 0
-#define CONFIG_ADPCM_IMA_WAV_ENCODER 0
-#define CONFIG_ADPCM_MS_ENCODER 0
-#define CONFIG_ADPCM_SWF_ENCODER 0
-#define CONFIG_ADPCM_YAMAHA_ENCODER 0
-#define CONFIG_SSA_ENCODER 0
-#define CONFIG_ASS_ENCODER 0
-#define CONFIG_DVBSUB_ENCODER 0
-#define CONFIG_DVDSUB_ENCODER 0
-#define CONFIG_MOVTEXT_ENCODER 0
-#define CONFIG_SRT_ENCODER 0
-#define CONFIG_SUBRIP_ENCODER 0
-#define CONFIG_TEXT_ENCODER 0
-#define CONFIG_WEBVTT_ENCODER 0
-#define CONFIG_XSUB_ENCODER 0
-#define CONFIG_AAC_AT_ENCODER 0
-#define CONFIG_ALAC_AT_ENCODER 0
-#define CONFIG_ILBC_AT_ENCODER 0
-#define CONFIG_PCM_ALAW_AT_ENCODER 0
-#define CONFIG_PCM_MULAW_AT_ENCODER 0
-#define CONFIG_LIBFDK_AAC_ENCODER 0
-#define CONFIG_LIBGSM_ENCODER 0
-#define CONFIG_LIBGSM_MS_ENCODER 0
-#define CONFIG_LIBILBC_ENCODER 0
-#define CONFIG_LIBMP3LAME_ENCODER 0
-#define CONFIG_LIBOPENCORE_AMRNB_ENCODER 0
-#define CONFIG_LIBOPENJPEG_ENCODER 0
-#define CONFIG_LIBOPUS_ENCODER 0
-#define CONFIG_LIBSCHROEDINGER_ENCODER 0
-#define CONFIG_LIBSHINE_ENCODER 0
-#define CONFIG_LIBSPEEX_ENCODER 0
-#define CONFIG_LIBTHEORA_ENCODER 0
-#define CONFIG_LIBTWOLAME_ENCODER 0
-#define CONFIG_LIBVO_AMRWBENC_ENCODER 0
-#define CONFIG_LIBVORBIS_ENCODER 0
-#define CONFIG_LIBVPX_VP8_ENCODER 0
-#define CONFIG_LIBVPX_VP9_ENCODER 0
-#define CONFIG_LIBWAVPACK_ENCODER 0
-#define CONFIG_LIBWEBP_ANIM_ENCODER 0
-#define CONFIG_LIBWEBP_ENCODER 0
-#define CONFIG_LIBX262_ENCODER 0
-#define CONFIG_LIBX264_ENCODER 0
-#define CONFIG_LIBX264RGB_ENCODER 0
-#define CONFIG_LIBX265_ENCODER 0
-#define CONFIG_LIBXAVS_ENCODER 0
-#define CONFIG_LIBXVID_ENCODER 0
-#define CONFIG_LIBOPENH264_ENCODER 0
-#define CONFIG_H264_NVENC_ENCODER 0
-#define CONFIG_H264_OMX_ENCODER 0
-#define CONFIG_H264_QSV_ENCODER 0
-#define CONFIG_H264_VAAPI_ENCODER 0
-#define CONFIG_H264_VIDEOTOOLBOX_ENCODER 0
-#define CONFIG_NVENC_ENCODER 0
-#define CONFIG_NVENC_H264_ENCODER 0
-#define CONFIG_NVENC_HEVC_ENCODER 0
-#define CONFIG_HEVC_NVENC_ENCODER 0
-#define CONFIG_HEVC_QSV_ENCODER 0
-#define CONFIG_HEVC_VAAPI_ENCODER 0
-#define CONFIG_LIBKVAZAAR_ENCODER 0
-#define CONFIG_MJPEG_VAAPI_ENCODER 0
-#define CONFIG_MPEG2_QSV_ENCODER 0
-#define CONFIG_ABENCH_FILTER 0
-#define CONFIG_ACOMPRESSOR_FILTER 0
-#define CONFIG_ACROSSFADE_FILTER 0
-#define CONFIG_ACRUSHER_FILTER 0
-#define CONFIG_ADELAY_FILTER 0
-#define CONFIG_AECHO_FILTER 0
-#define CONFIG_AEMPHASIS_FILTER 0
-#define CONFIG_AEVAL_FILTER 0
-#define CONFIG_AFADE_FILTER 0
-#define CONFIG_AFFTFILT_FILTER 0
-#define CONFIG_AFORMAT_FILTER 0
-#define CONFIG_AGATE_FILTER 0
-#define CONFIG_AINTERLEAVE_FILTER 0
-#define CONFIG_ALIMITER_FILTER 0
-#define CONFIG_ALLPASS_FILTER 0
-#define CONFIG_ALOOP_FILTER 0
-#define CONFIG_AMERGE_FILTER 0
-#define CONFIG_AMETADATA_FILTER 0
-#define CONFIG_AMIX_FILTER 0
-#define CONFIG_ANEQUALIZER_FILTER 0
-#define CONFIG_ANULL_FILTER 0
-#define CONFIG_APAD_FILTER 0
-#define CONFIG_APERMS_FILTER 0
-#define CONFIG_APHASER_FILTER 0
-#define CONFIG_APULSATOR_FILTER 0
-#define CONFIG_AREALTIME_FILTER 0
-#define CONFIG_ARESAMPLE_FILTER 0
-#define CONFIG_AREVERSE_FILTER 0
-#define CONFIG_ASELECT_FILTER 0
-#define CONFIG_ASENDCMD_FILTER 0
-#define CONFIG_ASETNSAMPLES_FILTER 0
-#define CONFIG_ASETPTS_FILTER 0
-#define CONFIG_ASETRATE_FILTER 0
-#define CONFIG_ASETTB_FILTER 0
-#define CONFIG_ASHOWINFO_FILTER 0
-#define CONFIG_ASIDEDATA_FILTER 0
-#define CONFIG_ASPLIT_FILTER 0
-#define CONFIG_ASTATS_FILTER 0
-#define CONFIG_ASTREAMSELECT_FILTER 0
-#define CONFIG_ASYNCTS_FILTER 0
-#define CONFIG_ATEMPO_FILTER 0
-#define CONFIG_ATRIM_FILTER 0
-#define CONFIG_AZMQ_FILTER 0
-#define CONFIG_BANDPASS_FILTER 0
-#define CONFIG_BANDREJECT_FILTER 0
-#define CONFIG_BASS_FILTER 0
-#define CONFIG_BIQUAD_FILTER 0
-#define CONFIG_BS2B_FILTER 0
-#define CONFIG_CHANNELMAP_FILTER 0
-#define CONFIG_CHANNELSPLIT_FILTER 0
-#define CONFIG_CHORUS_FILTER 0
-#define CONFIG_COMPAND_FILTER 0
-#define CONFIG_COMPENSATIONDELAY_FILTER 0
-#define CONFIG_CRYSTALIZER_FILTER 0
-#define CONFIG_DCSHIFT_FILTER 0
-#define CONFIG_DYNAUDNORM_FILTER 0
-#define CONFIG_EARWAX_FILTER 0
-#define CONFIG_EBUR128_FILTER 0
-#define CONFIG_EQUALIZER_FILTER 0
-#define CONFIG_EXTRASTEREO_FILTER 0
-#define CONFIG_FIREQUALIZER_FILTER 0
-#define CONFIG_FLANGER_FILTER 0
-#define CONFIG_HDCD_FILTER 0
-#define CONFIG_HIGHPASS_FILTER 0
-#define CONFIG_JOIN_FILTER 0
-#define CONFIG_LADSPA_FILTER 0
-#define CONFIG_LOUDNORM_FILTER 0
-#define CONFIG_LOWPASS_FILTER 0
-#define CONFIG_PAN_FILTER 0
-#define CONFIG_REPLAYGAIN_FILTER 0
-#define CONFIG_RESAMPLE_FILTER 0
-#define CONFIG_RUBBERBAND_FILTER 0
-#define CONFIG_SIDECHAINCOMPRESS_FILTER 0
-#define CONFIG_SIDECHAINGATE_FILTER 0
-#define CONFIG_SILENCEDETECT_FILTER 0
-#define CONFIG_SILENCEREMOVE_FILTER 0
-#define CONFIG_SOFALIZER_FILTER 0
-#define CONFIG_STEREOTOOLS_FILTER 0
-#define CONFIG_STEREOWIDEN_FILTER 0
-#define CONFIG_TREBLE_FILTER 0
-#define CONFIG_TREMOLO_FILTER 0
-#define CONFIG_VIBRATO_FILTER 0
-#define CONFIG_VOLUME_FILTER 0
-#define CONFIG_VOLUMEDETECT_FILTER 0
-#define CONFIG_AEVALSRC_FILTER 0
-#define CONFIG_ANOISESRC_FILTER 0
-#define CONFIG_ANULLSRC_FILTER 0
-#define CONFIG_FLITE_FILTER 0
-#define CONFIG_SINE_FILTER 0
-#define CONFIG_ANULLSINK_FILTER 0
-#define CONFIG_ALPHAEXTRACT_FILTER 0
-#define CONFIG_ALPHAMERGE_FILTER 0
-#define CONFIG_ASS_FILTER 0
-#define CONFIG_ATADENOISE_FILTER 0
-#define CONFIG_AVGBLUR_FILTER 0
-#define CONFIG_BBOX_FILTER 0
-#define CONFIG_BENCH_FILTER 0
-#define CONFIG_BITPLANENOISE_FILTER 0
-#define CONFIG_BLACKDETECT_FILTER 0
-#define CONFIG_BLACKFRAME_FILTER 0
-#define CONFIG_BLEND_FILTER 0
-#define CONFIG_BOXBLUR_FILTER 0
-#define CONFIG_BWDIF_FILTER 0
-#define CONFIG_CHROMAKEY_FILTER 0
-#define CONFIG_CIESCOPE_FILTER 0
-#define CONFIG_CODECVIEW_FILTER 0
-#define CONFIG_COLORBALANCE_FILTER 0
-#define CONFIG_COLORCHANNELMIXER_FILTER 0
-#define CONFIG_COLORKEY_FILTER 0
-#define CONFIG_COLORLEVELS_FILTER 0
-#define CONFIG_COLORMATRIX_FILTER 0
-#define CONFIG_COLORSPACE_FILTER 0
-#define CONFIG_CONVOLUTION_FILTER 0
-#define CONFIG_COPY_FILTER 0
-#define CONFIG_COREIMAGE_FILTER 0
-#define CONFIG_COVER_RECT_FILTER 0
-#define CONFIG_CROP_FILTER 0
-#define CONFIG_CROPDETECT_FILTER 0
-#define CONFIG_CURVES_FILTER 0
-#define CONFIG_DATASCOPE_FILTER 0
-#define CONFIG_DCTDNOIZ_FILTER 0
-#define CONFIG_DEBAND_FILTER 0
-#define CONFIG_DECIMATE_FILTER 0
-#define CONFIG_DEFLATE_FILTER 0
-#define CONFIG_DEJUDDER_FILTER 0
-#define CONFIG_DELOGO_FILTER 0
-#define CONFIG_DESHAKE_FILTER 0
-#define CONFIG_DETELECINE_FILTER 0
-#define CONFIG_DILATION_FILTER 0
-#define CONFIG_DISPLACE_FILTER 0
-#define CONFIG_DRAWBOX_FILTER 0
-#define CONFIG_DRAWGRAPH_FILTER 0
-#define CONFIG_DRAWGRID_FILTER 0
-#define CONFIG_DRAWTEXT_FILTER 0
-#define CONFIG_EDGEDETECT_FILTER 0
-#define CONFIG_ELBG_FILTER 0
-#define CONFIG_EQ_FILTER 0
-#define CONFIG_EROSION_FILTER 0
-#define CONFIG_EXTRACTPLANES_FILTER 0
-#define CONFIG_FADE_FILTER 0
-#define CONFIG_FFTFILT_FILTER 0
-#define CONFIG_FIELD_FILTER 0
-#define CONFIG_FIELDHINT_FILTER 0
-#define CONFIG_FIELDMATCH_FILTER 0
-#define CONFIG_FIELDORDER_FILTER 0
-#define CONFIG_FIND_RECT_FILTER 0
-#define CONFIG_FORMAT_FILTER 0
-#define CONFIG_FPS_FILTER 0
-#define CONFIG_FRAMEPACK_FILTER 0
-#define CONFIG_FRAMERATE_FILTER 0
-#define CONFIG_FRAMESTEP_FILTER 0
-#define CONFIG_FREI0R_FILTER 0
-#define CONFIG_FSPP_FILTER 0
-#define CONFIG_GBLUR_FILTER 0
-#define CONFIG_GEQ_FILTER 0
-#define CONFIG_GRADFUN_FILTER 0
-#define CONFIG_HALDCLUT_FILTER 0
-#define CONFIG_HFLIP_FILTER 0
-#define CONFIG_HISTEQ_FILTER 0
-#define CONFIG_HISTOGRAM_FILTER 0
-#define CONFIG_HQDN3D_FILTER 0
-#define CONFIG_HQX_FILTER 0
-#define CONFIG_HSTACK_FILTER 0
-#define CONFIG_HUE_FILTER 0
-#define CONFIG_HWDOWNLOAD_FILTER 0
-#define CONFIG_HWUPLOAD_FILTER 0
-#define CONFIG_HWUPLOAD_CUDA_FILTER 0
-#define CONFIG_HYSTERESIS_FILTER 0
-#define CONFIG_IDET_FILTER 0
-#define CONFIG_IL_FILTER 0
-#define CONFIG_INFLATE_FILTER 0
-#define CONFIG_INTERLACE_FILTER 0
-#define CONFIG_INTERLEAVE_FILTER 0
-#define CONFIG_KERNDEINT_FILTER 0
-#define CONFIG_LENSCORRECTION_FILTER 0
-#define CONFIG_LOOP_FILTER 0
-#define CONFIG_LUT_FILTER 0
-#define CONFIG_LUT2_FILTER 0
-#define CONFIG_LUT3D_FILTER 0
-#define CONFIG_LUTRGB_FILTER 0
-#define CONFIG_LUTYUV_FILTER 0
-#define CONFIG_MASKEDCLAMP_FILTER 0
-#define CONFIG_MASKEDMERGE_FILTER 0
-#define CONFIG_MCDEINT_FILTER 0
-#define CONFIG_MERGEPLANES_FILTER 0
-#define CONFIG_MESTIMATE_FILTER 0
-#define CONFIG_METADATA_FILTER 0
-#define CONFIG_MINTERPOLATE_FILTER 0
-#define CONFIG_MPDECIMATE_FILTER 0
-#define CONFIG_NEGATE_FILTER 0
-#define CONFIG_NLMEANS_FILTER 0
-#define CONFIG_NNEDI_FILTER 0
-#define CONFIG_NOFORMAT_FILTER 0
-#define CONFIG_NOISE_FILTER 0
-#define CONFIG_NULL_FILTER 0
-#define CONFIG_OCR_FILTER 0
-#define CONFIG_OCV_FILTER 0
-#define CONFIG_OVERLAY_FILTER 0
-#define CONFIG_OWDENOISE_FILTER 0
-#define CONFIG_PAD_FILTER 0
-#define CONFIG_PALETTEGEN_FILTER 0
-#define CONFIG_PALETTEUSE_FILTER 0
-#define CONFIG_PERMS_FILTER 0
-#define CONFIG_PERSPECTIVE_FILTER 0
-#define CONFIG_PHASE_FILTER 0
-#define CONFIG_PIXDESCTEST_FILTER 0
-#define CONFIG_PP_FILTER 0
-#define CONFIG_PP7_FILTER 0
-#define CONFIG_PREWITT_FILTER 0
-#define CONFIG_PSNR_FILTER 0
-#define CONFIG_PULLUP_FILTER 0
-#define CONFIG_QP_FILTER 0
-#define CONFIG_RANDOM_FILTER 0
-#define CONFIG_READVITC_FILTER 0
-#define CONFIG_REALTIME_FILTER 0
-#define CONFIG_REMAP_FILTER 0
-#define CONFIG_REMOVEGRAIN_FILTER 0
-#define CONFIG_REMOVELOGO_FILTER 0
-#define CONFIG_REPEATFIELDS_FILTER 0
-#define CONFIG_REVERSE_FILTER 0
-#define CONFIG_ROTATE_FILTER 0
-#define CONFIG_SAB_FILTER 0
-#define CONFIG_SCALE_FILTER 0
-#define CONFIG_SCALE_NPP_FILTER 0
-#define CONFIG_SCALE_VAAPI_FILTER 0
-#define CONFIG_SCALE2REF_FILTER 0
-#define CONFIG_SELECT_FILTER 0
-#define CONFIG_SELECTIVECOLOR_FILTER 0
-#define CONFIG_SENDCMD_FILTER 0
-#define CONFIG_SEPARATEFIELDS_FILTER 0
-#define CONFIG_SETDAR_FILTER 0
-#define CONFIG_SETFIELD_FILTER 0
-#define CONFIG_SETPTS_FILTER 0
-#define CONFIG_SETSAR_FILTER 0
-#define CONFIG_SETTB_FILTER 0
-#define CONFIG_SHOWINFO_FILTER 0
-#define CONFIG_SHOWPALETTE_FILTER 0
-#define CONFIG_SHUFFLEFRAMES_FILTER 0
-#define CONFIG_SHUFFLEPLANES_FILTER 0
-#define CONFIG_SIDEDATA_FILTER 0
-#define CONFIG_SIGNALSTATS_FILTER 0
-#define CONFIG_SMARTBLUR_FILTER 0
-#define CONFIG_SOBEL_FILTER 0
-#define CONFIG_SPLIT_FILTER 0
-#define CONFIG_SPP_FILTER 0
-#define CONFIG_SSIM_FILTER 0
-#define CONFIG_STEREO3D_FILTER 0
-#define CONFIG_STREAMSELECT_FILTER 0
-#define CONFIG_SUBTITLES_FILTER 0
-#define CONFIG_SUPER2XSAI_FILTER 0
-#define CONFIG_SWAPRECT_FILTER 0
-#define CONFIG_SWAPUV_FILTER 0
-#define CONFIG_TBLEND_FILTER 0
-#define CONFIG_TELECINE_FILTER 0
-#define CONFIG_THUMBNAIL_FILTER 0
-#define CONFIG_TILE_FILTER 0
-#define CONFIG_TINTERLACE_FILTER 0
-#define CONFIG_TRANSPOSE_FILTER 0
-#define CONFIG_TRIM_FILTER 0
-#define CONFIG_UNSHARP_FILTER 0
-#define CONFIG_USPP_FILTER 0
-#define CONFIG_VAGUEDENOISER_FILTER 0
-#define CONFIG_VECTORSCOPE_FILTER 0
-#define CONFIG_VFLIP_FILTER 0
-#define CONFIG_VIDSTABDETECT_FILTER 0
-#define CONFIG_VIDSTABTRANSFORM_FILTER 0
-#define CONFIG_VIGNETTE_FILTER 0
-#define CONFIG_VSTACK_FILTER 0
-#define CONFIG_W3FDIF_FILTER 0
-#define CONFIG_WAVEFORM_FILTER 0
-#define CONFIG_WEAVE_FILTER 0
-#define CONFIG_XBR_FILTER 0
-#define CONFIG_YADIF_FILTER 0
-#define CONFIG_ZMQ_FILTER 0
-#define CONFIG_ZOOMPAN_FILTER 0
-#define CONFIG_ZSCALE_FILTER 0
-#define CONFIG_ALLRGB_FILTER 0
-#define CONFIG_ALLYUV_FILTER 0
-#define CONFIG_CELLAUTO_FILTER 0
-#define CONFIG_COLOR_FILTER 0
-#define CONFIG_COREIMAGESRC_FILTER 0
-#define CONFIG_FREI0R_SRC_FILTER 0
-#define CONFIG_HALDCLUTSRC_FILTER 0
-#define CONFIG_LIFE_FILTER 0
-#define CONFIG_MANDELBROT_FILTER 0
-#define CONFIG_MPTESTSRC_FILTER 0
-#define CONFIG_NULLSRC_FILTER 0
-#define CONFIG_RGBTESTSRC_FILTER 0
-#define CONFIG_SMPTEBARS_FILTER 0
-#define CONFIG_SMPTEHDBARS_FILTER 0
-#define CONFIG_TESTSRC_FILTER 0
-#define CONFIG_TESTSRC2_FILTER 0
-#define CONFIG_YUVTESTSRC_FILTER 0
-#define CONFIG_NULLSINK_FILTER 0
-#define CONFIG_ADRAWGRAPH_FILTER 0
-#define CONFIG_AHISTOGRAM_FILTER 0
-#define CONFIG_APHASEMETER_FILTER 0
-#define CONFIG_AVECTORSCOPE_FILTER 0
-#define CONFIG_CONCAT_FILTER 0
-#define CONFIG_SHOWCQT_FILTER 0
-#define CONFIG_SHOWFREQS_FILTER 0
-#define CONFIG_SHOWSPECTRUM_FILTER 0
-#define CONFIG_SHOWSPECTRUMPIC_FILTER 0
-#define CONFIG_SHOWVOLUME_FILTER 0
-#define CONFIG_SHOWWAVES_FILTER 0
-#define CONFIG_SHOWWAVESPIC_FILTER 0
-#define CONFIG_SPECTRUMSYNTH_FILTER 0
-#define CONFIG_AMOVIE_FILTER 0
-#define CONFIG_MOVIE_FILTER 0
-#define CONFIG_H263_CUVID_HWACCEL 0
-#define CONFIG_H263_VAAPI_HWACCEL 0
-#define CONFIG_H263_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_H264_CUVID_HWACCEL 0
-#define CONFIG_H264_D3D11VA_HWACCEL 0
-#define CONFIG_H264_DXVA2_HWACCEL 0
-#define CONFIG_H264_MEDIACODEC_HWACCEL 0
-#define CONFIG_H264_MMAL_HWACCEL 0
-#define CONFIG_H264_QSV_HWACCEL 0
-#define CONFIG_H264_VAAPI_HWACCEL 0
-#define CONFIG_H264_VDA_HWACCEL 0
-#define CONFIG_H264_VDA_OLD_HWACCEL 0
-#define CONFIG_H264_VDPAU_HWACCEL 0
-#define CONFIG_H264_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_HEVC_CUVID_HWACCEL 0
-#define CONFIG_HEVC_D3D11VA_HWACCEL 0
-#define CONFIG_HEVC_DXVA2_HWACCEL 0
-#define CONFIG_HEVC_MEDIACODEC_HWACCEL 0
-#define CONFIG_HEVC_QSV_HWACCEL 0
-#define CONFIG_HEVC_VAAPI_HWACCEL 0
-#define CONFIG_HEVC_VDPAU_HWACCEL 0
-#define CONFIG_MJPEG_CUVID_HWACCEL 0
-#define CONFIG_MPEG1_CUVID_HWACCEL 0
-#define CONFIG_MPEG1_XVMC_HWACCEL 0
-#define CONFIG_MPEG1_VDPAU_HWACCEL 0
-#define CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_MPEG2_CUVID_HWACCEL 0
-#define CONFIG_MPEG2_XVMC_HWACCEL 0
-#define CONFIG_MPEG2_D3D11VA_HWACCEL 0
-#define CONFIG_MPEG2_DXVA2_HWACCEL 0
-#define CONFIG_MPEG2_MMAL_HWACCEL 0
-#define CONFIG_MPEG2_QSV_HWACCEL 0
-#define CONFIG_MPEG2_VAAPI_HWACCEL 0
-#define CONFIG_MPEG2_VDPAU_HWACCEL 0
-#define CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_MPEG4_CUVID_HWACCEL 0
-#define CONFIG_MPEG4_MEDIACODEC_HWACCEL 0
-#define CONFIG_MPEG4_MMAL_HWACCEL 0
-#define CONFIG_MPEG4_VAAPI_HWACCEL 0
-#define CONFIG_MPEG4_VDPAU_HWACCEL 0
-#define CONFIG_MPEG4_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_VC1_CUVID_HWACCEL 0
-#define CONFIG_VC1_D3D11VA_HWACCEL 0
-#define CONFIG_VC1_DXVA2_HWACCEL 0
-#define CONFIG_VC1_VAAPI_HWACCEL 0
-#define CONFIG_VC1_VDPAU_HWACCEL 0
-#define CONFIG_VC1_MMAL_HWACCEL 0
-#define CONFIG_VC1_QSV_HWACCEL 0
-#define CONFIG_VP8_CUVID_HWACCEL 0
-#define CONFIG_VP8_MEDIACODEC_HWACCEL 0
-#define CONFIG_VP9_CUVID_HWACCEL 0
-#define CONFIG_VP9_D3D11VA_HWACCEL 0
-#define CONFIG_VP9_DXVA2_HWACCEL 0
-#define CONFIG_VP9_MEDIACODEC_HWACCEL 0
-#define CONFIG_VP9_VAAPI_HWACCEL 0
-#define CONFIG_WMV3_D3D11VA_HWACCEL 0
-#define CONFIG_WMV3_DXVA2_HWACCEL 0
-#define CONFIG_WMV3_VAAPI_HWACCEL 0
-#define CONFIG_WMV3_VDPAU_HWACCEL 0
-#define CONFIG_ALSA_INDEV 0
-#define CONFIG_AVFOUNDATION_INDEV 0
-#define CONFIG_BKTR_INDEV 0
-#define CONFIG_DECKLINK_INDEV 0
-#define CONFIG_DSHOW_INDEV 0
-#define CONFIG_DV1394_INDEV 0
-#define CONFIG_FBDEV_INDEV 0
-#define CONFIG_GDIGRAB_INDEV 0
-#define CONFIG_IEC61883_INDEV 0
-#define CONFIG_JACK_INDEV 0
-#define CONFIG_LAVFI_INDEV 0
-#define CONFIG_OPENAL_INDEV 0
-#define CONFIG_OSS_INDEV 0
-#define CONFIG_PULSE_INDEV 0
-#define CONFIG_QTKIT_INDEV 0
-#define CONFIG_SNDIO_INDEV 0
-#define CONFIG_V4L2_INDEV 0
-#define CONFIG_VFWCAP_INDEV 0
-#define CONFIG_X11GRAB_INDEV 0
-#define CONFIG_X11GRAB_XCB_INDEV 0
-#define CONFIG_LIBCDIO_INDEV 0
-#define CONFIG_LIBDC1394_INDEV 0
-#define CONFIG_A64_MUXER 0
-#define CONFIG_AC3_MUXER 0
-#define CONFIG_ADTS_MUXER 0
-#define CONFIG_ADX_MUXER 0
-#define CONFIG_AIFF_MUXER 0
-#define CONFIG_AMR_MUXER 0
-#define CONFIG_APNG_MUXER 0
-#define CONFIG_ASF_MUXER 0
-#define CONFIG_ASS_MUXER 0
-#define CONFIG_AST_MUXER 0
-#define CONFIG_ASF_STREAM_MUXER 0
-#define CONFIG_AU_MUXER 0
-#define CONFIG_AVI_MUXER 0
-#define CONFIG_AVM2_MUXER 0
-#define CONFIG_BIT_MUXER 0
-#define CONFIG_CAF_MUXER 0
-#define CONFIG_CAVSVIDEO_MUXER 0
-#define CONFIG_CRC_MUXER 0
-#define CONFIG_DASH_MUXER 0
-#define CONFIG_DATA_MUXER 0
-#define CONFIG_DAUD_MUXER 0
-#define CONFIG_DIRAC_MUXER 0
-#define CONFIG_DNXHD_MUXER 0
-#define CONFIG_DTS_MUXER 0
-#define CONFIG_DV_MUXER 0
-#define CONFIG_EAC3_MUXER 0
-#define CONFIG_F4V_MUXER 0
-#define CONFIG_FFM_MUXER 0
-#define CONFIG_FFMETADATA_MUXER 0
-#define CONFIG_FIFO_MUXER 0
-#define CONFIG_FILMSTRIP_MUXER 0
-#define CONFIG_FLAC_MUXER 0
-#define CONFIG_FLV_MUXER 0
-#define CONFIG_FRAMECRC_MUXER 0
-#define CONFIG_FRAMEHASH_MUXER 0
-#define CONFIG_FRAMEMD5_MUXER 0
-#define CONFIG_G722_MUXER 0
-#define CONFIG_G723_1_MUXER 0
-#define CONFIG_GIF_MUXER 0
-#define CONFIG_GSM_MUXER 0
-#define CONFIG_GXF_MUXER 0
-#define CONFIG_H261_MUXER 0
-#define CONFIG_H263_MUXER 0
-#define CONFIG_H264_MUXER 0
-#define CONFIG_HASH_MUXER 0
-#define CONFIG_HDS_MUXER 0
-#define CONFIG_HEVC_MUXER 0
-#define CONFIG_HLS_MUXER 0
-#define CONFIG_ICO_MUXER 0
-#define CONFIG_ILBC_MUXER 0
-#define CONFIG_IMAGE2_MUXER 0
-#define CONFIG_IMAGE2PIPE_MUXER 0
-#define CONFIG_IPOD_MUXER 0
-#define CONFIG_IRCAM_MUXER 0
-#define CONFIG_ISMV_MUXER 0
-#define CONFIG_IVF_MUXER 0
-#define CONFIG_JACOSUB_MUXER 0
-#define CONFIG_LATM_MUXER 0
-#define CONFIG_LRC_MUXER 0
-#define CONFIG_M4V_MUXER 0
-#define CONFIG_MD5_MUXER 0
-#define CONFIG_MATROSKA_MUXER 0
-#define CONFIG_MATROSKA_AUDIO_MUXER 0
-#define CONFIG_MICRODVD_MUXER 0
-#define CONFIG_MJPEG_MUXER 0
-#define CONFIG_MLP_MUXER 0
-#define CONFIG_MMF_MUXER 0
-#define CONFIG_MOV_MUXER 0
-#define CONFIG_MP2_MUXER 0
-#define CONFIG_MP3_MUXER 0
-#define CONFIG_MP4_MUXER 0
-#define CONFIG_MPEG1SYSTEM_MUXER 0
-#define CONFIG_MPEG1VCD_MUXER 0
-#define CONFIG_MPEG1VIDEO_MUXER 0
-#define CONFIG_MPEG2DVD_MUXER 0
-#define CONFIG_MPEG2SVCD_MUXER 0
-#define CONFIG_MPEG2VIDEO_MUXER 0
-#define CONFIG_MPEG2VOB_MUXER 0
-#define CONFIG_MPEGTS_MUXER 0
-#define CONFIG_MPJPEG_MUXER 0
-#define CONFIG_MXF_MUXER 0
-#define CONFIG_MXF_D10_MUXER 0
-#define CONFIG_MXF_OPATOM_MUXER 0
-#define CONFIG_NULL_MUXER 0
-#define CONFIG_NUT_MUXER 0
-#define CONFIG_OGA_MUXER 0
-#define CONFIG_OGG_MUXER 0
-#define CONFIG_OGV_MUXER 0
-#define CONFIG_OMA_MUXER 0
-#define CONFIG_OPUS_MUXER 0
-#define CONFIG_PCM_ALAW_MUXER 0
-#define CONFIG_PCM_MULAW_MUXER 0
-#define CONFIG_PCM_F64BE_MUXER 0
-#define CONFIG_PCM_F64LE_MUXER 0
-#define CONFIG_PCM_F32BE_MUXER 0
-#define CONFIG_PCM_F32LE_MUXER 0
-#define CONFIG_PCM_S32BE_MUXER 0
-#define CONFIG_PCM_S32LE_MUXER 0
-#define CONFIG_PCM_S24BE_MUXER 0
-#define CONFIG_PCM_S24LE_MUXER 0
-#define CONFIG_PCM_S16BE_MUXER 0
-#define CONFIG_PCM_S16LE_MUXER 0
-#define CONFIG_PCM_S8_MUXER 0
-#define CONFIG_PCM_U32BE_MUXER 0
-#define CONFIG_PCM_U32LE_MUXER 0
-#define CONFIG_PCM_U24BE_MUXER 0
-#define CONFIG_PCM_U24LE_MUXER 0
-#define CONFIG_PCM_U16BE_MUXER 0
-#define CONFIG_PCM_U16LE_MUXER 0
-#define CONFIG_PCM_U8_MUXER 0
-#define CONFIG_PSP_MUXER 0
-#define CONFIG_RAWVIDEO_MUXER 0
-#define CONFIG_RM_MUXER 0
-#define CONFIG_ROQ_MUXER 0
-#define CONFIG_RSO_MUXER 0
-#define CONFIG_RTP_MUXER 0
-#define CONFIG_RTP_MPEGTS_MUXER 0
-#define CONFIG_RTSP_MUXER 0
-#define CONFIG_SAP_MUXER 0
-#define CONFIG_SEGMENT_MUXER 0
-#define CONFIG_STREAM_SEGMENT_MUXER 0
-#define CONFIG_SINGLEJPEG_MUXER 0
-#define CONFIG_SMJPEG_MUXER 0
-#define CONFIG_SMOOTHSTREAMING_MUXER 0
-#define CONFIG_SOX_MUXER 0
-#define CONFIG_SPX_MUXER 0
-#define CONFIG_SPDIF_MUXER 0
-#define CONFIG_SRT_MUXER 0
-#define CONFIG_SWF_MUXER 0
-#define CONFIG_TEE_MUXER 0
-#define CONFIG_TG2_MUXER 0
-#define CONFIG_TGP_MUXER 0
-#define CONFIG_MKVTIMESTAMP_V2_MUXER 0
-#define CONFIG_TRUEHD_MUXER 0
-#define CONFIG_TTA_MUXER 0
-#define CONFIG_UNCODEDFRAMECRC_MUXER 0
-#define CONFIG_VC1_MUXER 0
-#define CONFIG_VC1T_MUXER 0
-#define CONFIG_VOC_MUXER 0
-#define CONFIG_W64_MUXER 0
-#define CONFIG_WAV_MUXER 0
-#define CONFIG_WEBM_MUXER 0
-#define CONFIG_WEBM_DASH_MANIFEST_MUXER 0
-#define CONFIG_WEBM_CHUNK_MUXER 0
-#define CONFIG_WEBP_MUXER 0
-#define CONFIG_WEBVTT_MUXER 0
-#define CONFIG_WTV_MUXER 0
-#define CONFIG_WV_MUXER 0
-#define CONFIG_YUV4MPEGPIPE_MUXER 0
-#define CONFIG_CHROMAPRINT_MUXER 0
-#define CONFIG_LIBNUT_MUXER 0
-#define CONFIG_ALSA_OUTDEV 0
-#define CONFIG_CACA_OUTDEV 0
-#define CONFIG_DECKLINK_OUTDEV 0
-#define CONFIG_FBDEV_OUTDEV 0
-#define CONFIG_OPENGL_OUTDEV 0
-#define CONFIG_OSS_OUTDEV 0
-#define CONFIG_PULSE_OUTDEV 0
-#define CONFIG_SDL2_OUTDEV 0
-#define CONFIG_SNDIO_OUTDEV 0
-#define CONFIG_V4L2_OUTDEV 0
-#define CONFIG_XV_OUTDEV 0
-#define CONFIG_AAC_PARSER 0
-#define CONFIG_AAC_LATM_PARSER 0
-#define CONFIG_AC3_PARSER 0
-#define CONFIG_ADX_PARSER 0
-#define CONFIG_BMP_PARSER 0
-#define CONFIG_CAVSVIDEO_PARSER 0
-#define CONFIG_COOK_PARSER 0
-#define CONFIG_DCA_PARSER 0
-#define CONFIG_DIRAC_PARSER 0
-#define CONFIG_DNXHD_PARSER 0
-#define CONFIG_DPX_PARSER 0
-#define CONFIG_DVAUDIO_PARSER 0
-#define CONFIG_DVBSUB_PARSER 0
-#define CONFIG_DVDSUB_PARSER 0
-#define CONFIG_DVD_NAV_PARSER 0
-#define CONFIG_FLAC_PARSER 1
-#define CONFIG_G729_PARSER 0
-#define CONFIG_GSM_PARSER 0
-#define CONFIG_H261_PARSER 0
-#define CONFIG_H263_PARSER 0
-#define CONFIG_H264_PARSER 0
-#define CONFIG_HEVC_PARSER 0
-#define CONFIG_MJPEG_PARSER 0
-#define CONFIG_MLP_PARSER 0
-#define CONFIG_MPEG4VIDEO_PARSER 0
-#define CONFIG_MPEGAUDIO_PARSER 0
-#define CONFIG_MPEGVIDEO_PARSER 0
-#define CONFIG_OPUS_PARSER 0
-#define CONFIG_PNG_PARSER 0
-#define CONFIG_PNM_PARSER 0
-#define CONFIG_RV30_PARSER 0
-#define CONFIG_RV40_PARSER 0
-#define CONFIG_TAK_PARSER 0
-#define CONFIG_VC1_PARSER 0
-#define CONFIG_VORBIS_PARSER 0
-#define CONFIG_VP3_PARSER 0
+#define CONFIG_FLAC_PARSER 0
#define CONFIG_VP8_PARSER 1
#define CONFIG_VP9_PARSER 1
-#define CONFIG_ASYNC_PROTOCOL 0
-#define CONFIG_BLURAY_PROTOCOL 0
-#define CONFIG_CACHE_PROTOCOL 0
-#define CONFIG_CONCAT_PROTOCOL 0
-#define CONFIG_CRYPTO_PROTOCOL 0
-#define CONFIG_DATA_PROTOCOL 0
-#define CONFIG_FFRTMPCRYPT_PROTOCOL 0
-#define CONFIG_FFRTMPHTTP_PROTOCOL 0
-#define CONFIG_FILE_PROTOCOL 0
-#define CONFIG_FTP_PROTOCOL 0
-#define CONFIG_GOPHER_PROTOCOL 0
-#define CONFIG_HLS_PROTOCOL 0
-#define CONFIG_HTTP_PROTOCOL 0
-#define CONFIG_HTTPPROXY_PROTOCOL 0
-#define CONFIG_HTTPS_PROTOCOL 0
-#define CONFIG_ICECAST_PROTOCOL 0
-#define CONFIG_MMSH_PROTOCOL 0
-#define CONFIG_MMST_PROTOCOL 0
-#define CONFIG_MD5_PROTOCOL 0
-#define CONFIG_PIPE_PROTOCOL 0
-#define CONFIG_RTMP_PROTOCOL 0
-#define CONFIG_RTMPE_PROTOCOL 0
-#define CONFIG_RTMPS_PROTOCOL 0
-#define CONFIG_RTMPT_PROTOCOL 0
-#define CONFIG_RTMPTE_PROTOCOL 0
-#define CONFIG_RTMPTS_PROTOCOL 0
-#define CONFIG_RTP_PROTOCOL 0
-#define CONFIG_SCTP_PROTOCOL 0
-#define CONFIG_SRTP_PROTOCOL 0
-#define CONFIG_SUBFILE_PROTOCOL 0
-#define CONFIG_TEE_PROTOCOL 0
-#define CONFIG_TCP_PROTOCOL 0
-#define CONFIG_TLS_GNUTLS_PROTOCOL 0
-#define CONFIG_TLS_SCHANNEL_PROTOCOL 0
-#define CONFIG_TLS_SECURETRANSPORT_PROTOCOL 0
-#define CONFIG_TLS_OPENSSL_PROTOCOL 0
-#define CONFIG_UDP_PROTOCOL 0
-#define CONFIG_UDPLITE_PROTOCOL 0
-#define CONFIG_UNIX_PROTOCOL 0
-#define CONFIG_LIBRTMP_PROTOCOL 0
-#define CONFIG_LIBRTMPE_PROTOCOL 0
-#define CONFIG_LIBRTMPS_PROTOCOL 0
-#define CONFIG_LIBRTMPT_PROTOCOL 0
-#define CONFIG_LIBRTMPTE_PROTOCOL 0
-#define CONFIG_LIBSSH_PROTOCOL 0
-#define CONFIG_LIBSMBCLIENT_PROTOCOL 0
#endif /* FFMPEG_CONFIG_H */
diff --git a/media/ffvpx/config_unix32.h b/media/ffvpx/config_unix32.h
index 9318d1851d..c2316caab5 100644
--- a/media/ffvpx/config_unix32.h
+++ b/media/ffvpx/config_unix32.h
@@ -1,12 +1,12 @@
/* Automatically generated by configure - do not modify! */
#ifndef FFMPEG_CONFIG_H
#define FFMPEG_CONFIG_H
-#define FFMPEG_CONFIGURATION "--disable-everything --disable-protocols --disable-demuxers --disable-muxers --disable-filters --disable-programs --disable-doc --disable-parsers --enable-parser=vp8 --enable-parser=vp9 --enable-decoder=vp8 --enable-decoder=vp9 --disable-static --enable-shared --disable-debug --disable-sdl --disable-libxcb --disable-securetransport --disable-iconv --disable-swresample --disable-swscale --disable-avdevice --disable-avfilter --disable-avformat --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vda --disable-vdpau --disable-videotoolbox --enable-asm --enable-yasm --disable-asm --disable-yasm --cc='gcc -m32'"
+#define FFMPEG_CONFIGURATION "--disable-everything --disable-protocols --disable-demuxers --disable-muxers --disable-filters --disable-programs --disable-doc --disable-parsers --enable-parser=vp8 --enable-parser=vp9 --enable-decoder=vp8 --enable-decoder=vp9 --disable-static --enable-shared --disable-debug --disable-sdl2 --disable-libxcb --disable-securetransport --disable-iconv --disable-swresample --disable-swscale --disable-avdevice --disable-avfilter --disable-avformat --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vda --disable-vdpau --disable-videotoolbox --enable-decoder=flac --disable-asm --disable-x86asm"
#define FFMPEG_LICENSE "LGPL version 2.1 or later"
-#define CONFIG_THIS_YEAR 2016
+#define CONFIG_THIS_YEAR 2017
#define FFMPEG_DATADIR "/usr/local/share/ffmpeg"
#define AVCONV_DATADIR "/usr/local/share/ffmpeg"
-#define CC_IDENT "gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)"
+#define CC_IDENT "gcc 6.3.0 (Ubuntu 6.3.0-12ubuntu2) 20170406"
#define av_restrict restrict
#define EXTERN_PREFIX ""
#define EXTERN_ASM
@@ -178,11 +178,11 @@
#define HAVE_LOCAL_ALIGNED_16 1
#define HAVE_LOCAL_ALIGNED_32 1
#define HAVE_SIMD_ALIGN_16 0
+#define HAVE_SIMD_ALIGN_32 0
#define HAVE_ATOMICS_GCC 1
#define HAVE_ATOMICS_SUNCC 0
#define HAVE_ATOMICS_WIN32 0
#define HAVE_ATOMIC_CAS_PTR 0
-#define HAVE_ATOMIC_COMPARE_EXCHANGE 0
#define HAVE_MACHINE_RW_BARRIER 0
#define HAVE_MEMORYBARRIER 0
#define HAVE_MM_EMPTY 0
@@ -194,15 +194,16 @@
#define HAVE_CEXP 1
#define HAVE_INLINE_ASM 1
#define HAVE_SYMVER 1
-#define HAVE_YASM 0
+#define HAVE_X86ASM 0
#define HAVE_BIGENDIAN 0
#define HAVE_FAST_UNALIGNED 0
-#define HAVE_ALSA_ASOUNDLIB_H 0
#define HAVE_ALTIVEC_H 0
#define HAVE_ARPA_INET_H 1
#define HAVE_ASM_TYPES_H 1
#define HAVE_CDIO_PARANOIA_H 0
#define HAVE_CDIO_PARANOIA_PARANOIA_H 0
+#define HAVE_CUDA_H 0
+#define HAVE_D3D11_H 0
#define HAVE_DISPATCH_DISPATCH_H 0
#define HAVE_DEV_BKTR_IOCTL_BT848_H 0
#define HAVE_DEV_BKTR_IOCTL_METEOR_H 0
@@ -212,7 +213,7 @@
#define HAVE_DIRECT_H 0
#define HAVE_DIRENT_H 1
#define HAVE_DLFCN_H 1
-#define HAVE_D3D11_H 0
+#define HAVE_DXGIDEBUG_H 0
#define HAVE_DXVA_H 0
#define HAVE_ES2_GL_H 0
#define HAVE_GSM_H 0
@@ -221,13 +222,15 @@
#define HAVE_MACHINE_IOCTL_BT848_H 0
#define HAVE_MACHINE_IOCTL_METEOR_H 0
#define HAVE_OPENCV2_CORE_CORE_C_H 0
+#define HAVE_OPENJPEG_2_3_OPENJPEG_H 0
+#define HAVE_OPENJPEG_2_2_OPENJPEG_H 0
#define HAVE_OPENJPEG_2_1_OPENJPEG_H 0
#define HAVE_OPENJPEG_2_0_OPENJPEG_H 0
#define HAVE_OPENJPEG_1_5_OPENJPEG_H 0
#define HAVE_OPENGL_GL3_H 0
#define HAVE_POLL_H 1
-#define HAVE_SNDIO_H 0
#define HAVE_SOUNDCARD_H 0
+#define HAVE_STDATOMIC_H 1
#define HAVE_SYS_MMAN_H 1
#define HAVE_SYS_PARAM_H 1
#define HAVE_SYS_RESOURCE_H 1
@@ -279,7 +282,6 @@
#define HAVE_COMMANDLINETOARGVW 0
#define HAVE_COTASKMEMFREE 0
#define HAVE_CRYPTGENRANDOM 0
-#define HAVE_DLOPEN 1
#define HAVE_FCNTL 1
#define HAVE_FLT_LIM 1
#define HAVE_FORK 1
@@ -318,6 +320,7 @@
#define HAVE_SLEEP 0
#define HAVE_STRERROR_R 1
#define HAVE_SYSCONF 1
+#define HAVE_SYSCTL 0
#define HAVE_USLEEP 1
#define HAVE_UTGETOSTYPEFROMSTRING 0
#define HAVE_VIRTUALALLOC 0
@@ -326,11 +329,13 @@
#define HAVE_OS2THREADS 0
#define HAVE_W32THREADS 0
#define HAVE_AS_DN_DIRECTIVE 0
+#define HAVE_AS_FPU_DIRECTIVE 0
#define HAVE_AS_FUNC 0
#define HAVE_AS_OBJECT_ARCH 0
#define HAVE_ASM_MOD_Q 0
#define HAVE_ATTRIBUTE_MAY_ALIAS 1
#define HAVE_ATTRIBUTE_PACKED 1
+#define HAVE_BLOCKS_EXTENSION 0
#define HAVE_EBP_AVAILABLE 1
#define HAVE_EBX_AVAILABLE 1
#define HAVE_GNU_AS 0
@@ -347,6 +352,7 @@
#define HAVE_XFORM_ASM 0
#define HAVE_XMM_CLOBBERS 0
#define HAVE_CONDITION_VARIABLE_PTR 0
+#define HAVE_KCMVIDEOCODECTYPE_HEVC 0
#define HAVE_SOCKLEN_T 1
#define HAVE_STRUCT_ADDRINFO 1
#define HAVE_STRUCT_GROUP_SOURCE_REQ 1
@@ -363,36 +369,20 @@
#define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 1
#define HAVE_ATOMICS_NATIVE 1
#define HAVE_DOS_PATHS 0
-#define HAVE_DXVA2_LIB 0
-#define HAVE_DXVA2API_COBJ 0
#define HAVE_LIBC_MSVCRT 0
-#define HAVE_LIBDC1394_1 0
-#define HAVE_LIBDC1394_2 0
#define HAVE_MAKEINFO 0
#define HAVE_MAKEINFO_HTML 0
#define HAVE_MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS 0
#define HAVE_PERL 1
#define HAVE_POD2MAN 1
-#define HAVE_SDL2 0
#define HAVE_SECTION_DATA_REL_RO 1
#define HAVE_TEXI2HTML 0
#define HAVE_THREADS 1
+#define HAVE_UWP 0
#define HAVE_VAAPI_DRM 0
#define HAVE_VAAPI_X11 0
#define HAVE_VDPAU_X11 0
#define HAVE_WINRT 0
-#define HAVE_XLIB 0
-#define CONFIG_BSFS 0
-#define CONFIG_DECODERS 1
-#define CONFIG_ENCODERS 0
-#define CONFIG_HWACCELS 0
-#define CONFIG_PARSERS 1
-#define CONFIG_INDEVS 0
-#define CONFIG_OUTDEVS 0
-#define CONFIG_FILTERS 0
-#define CONFIG_DEMUXERS 0
-#define CONFIG_MUXERS 0
-#define CONFIG_PROTOCOLS 0
#define CONFIG_DOC 0
#define CONFIG_HTMLPAGES 0
#define CONFIG_MANPAGES 1
@@ -400,13 +390,17 @@
#define CONFIG_TXTPAGES 0
#define CONFIG_AVIO_DIR_CMD_EXAMPLE 1
#define CONFIG_AVIO_READING_EXAMPLE 1
-#define CONFIG_DECODING_ENCODING_EXAMPLE 0
+#define CONFIG_DECODE_AUDIO_EXAMPLE 1
+#define CONFIG_DECODE_VIDEO_EXAMPLE 1
#define CONFIG_DEMUXING_DECODING_EXAMPLE 0
+#define CONFIG_ENCODE_AUDIO_EXAMPLE 1
+#define CONFIG_ENCODE_VIDEO_EXAMPLE 1
#define CONFIG_EXTRACT_MVS_EXAMPLE 0
#define CONFIG_FILTER_AUDIO_EXAMPLE 0
#define CONFIG_FILTERING_AUDIO_EXAMPLE 0
#define CONFIG_FILTERING_VIDEO_EXAMPLE 0
#define CONFIG_HTTP_MULTICLIENT_EXAMPLE 0
+#define CONFIG_HW_DECODE_EXAMPLE 0
#define CONFIG_METADATA_EXAMPLE 0
#define CONFIG_MUXING_EXAMPLE 0
#define CONFIG_QSVDEC_EXAMPLE 0
@@ -415,27 +409,55 @@
#define CONFIG_SCALING_VIDEO_EXAMPLE 0
#define CONFIG_TRANSCODE_AAC_EXAMPLE 0
#define CONFIG_TRANSCODING_EXAMPLE 0
-#define CONFIG_AVISYNTH 0
+#define CONFIG_ALSA 0
+#define CONFIG_APPKIT 0
+#define CONFIG_AVFOUNDATION 0
#define CONFIG_BZLIB 0
-#define CONFIG_CHROMAPRINT 0
-#define CONFIG_CRYSTALHD 0
-#define CONFIG_DECKLINK 0
+#define CONFIG_COREIMAGE 0
+#define CONFIG_ICONV 0
+#define CONFIG_JACK 0
+#define CONFIG_LIBXCB 0
+#define CONFIG_LIBXCB_SHM 0
+#define CONFIG_LIBXCB_SHAPE 0
+#define CONFIG_LIBXCB_XFIXES 0
+#define CONFIG_LZMA 0
+#define CONFIG_SCHANNEL 0
+#define CONFIG_SDL2 0
+#define CONFIG_SECURETRANSPORT 0
+#define CONFIG_SNDIO 0
+#define CONFIG_XLIB 1
+#define CONFIG_ZLIB 0
+#define CONFIG_AVISYNTH 0
#define CONFIG_FREI0R 0
-#define CONFIG_GCRYPT 0
+#define CONFIG_LIBCDIO 0
+#define CONFIG_LIBRUBBERBAND 0
+#define CONFIG_LIBVIDSTAB 0
+#define CONFIG_LIBX264 0
+#define CONFIG_LIBX265 0
+#define CONFIG_LIBXAVS 0
+#define CONFIG_LIBXVID 0
+#define CONFIG_DECKLINK 0
+#define CONFIG_LIBNDI_NEWTEK 0
+#define CONFIG_LIBFDK_AAC 0
+#define CONFIG_OPENSSL 0
#define CONFIG_GMP 0
+#define CONFIG_LIBOPENCORE_AMRNB 0
+#define CONFIG_LIBOPENCORE_AMRWB 0
+#define CONFIG_LIBVO_AMRWBENC 0
+#define CONFIG_RKMPP 0
+#define CONFIG_LIBSMBCLIENT 0
+#define CONFIG_CHROMAPRINT 0
+#define CONFIG_GCRYPT 0
#define CONFIG_GNUTLS 0
-#define CONFIG_ICONV 0
#define CONFIG_JNI 0
#define CONFIG_LADSPA 0
#define CONFIG_LIBASS 0
#define CONFIG_LIBBLURAY 0
#define CONFIG_LIBBS2B 0
#define CONFIG_LIBCACA 0
-#define CONFIG_LIBCDIO 0
#define CONFIG_LIBCELT 0
#define CONFIG_LIBDC1394 0
-#define CONFIG_LIBEBUR128 0
-#define CONFIG_LIBFDK_AAC 0
+#define CONFIG_LIBDRM 0
#define CONFIG_LIBFLITE 0
#define CONFIG_LIBFONTCONFIG 0
#define CONFIG_LIBFREETYPE 0
@@ -447,18 +469,15 @@
#define CONFIG_LIBKVAZAAR 0
#define CONFIG_LIBMODPLUG 0
#define CONFIG_LIBMP3LAME 0
-#define CONFIG_LIBNUT 0
-#define CONFIG_LIBOPENCORE_AMRNB 0
-#define CONFIG_LIBOPENCORE_AMRWB 0
+#define CONFIG_LIBMYSOFA 0
#define CONFIG_LIBOPENCV 0
#define CONFIG_LIBOPENH264 0
#define CONFIG_LIBOPENJPEG 0
#define CONFIG_LIBOPENMPT 0
#define CONFIG_LIBOPUS 0
#define CONFIG_LIBPULSE 0
+#define CONFIG_LIBRSVG 0
#define CONFIG_LIBRTMP 0
-#define CONFIG_LIBRUBBERBAND 0
-#define CONFIG_LIBSCHROEDINGER 0
#define CONFIG_LIBSHINE 0
#define CONFIG_LIBSMBCLIENT 0
#define CONFIG_LIBSNAPPY 0
@@ -469,52 +488,37 @@
#define CONFIG_LIBTHEORA 0
#define CONFIG_LIBTWOLAME 0
#define CONFIG_LIBV4L2 0
-#define CONFIG_LIBVIDSTAB 0
-#define CONFIG_LIBVO_AMRWBENC 0
+#define CONFIG_LIBVMAF 0
#define CONFIG_LIBVORBIS 0
#define CONFIG_LIBVPX 0
#define CONFIG_LIBWAVPACK 0
#define CONFIG_LIBWEBP 0
-#define CONFIG_LIBX264 0
-#define CONFIG_LIBX265 0
-#define CONFIG_LIBXAVS 0
-#define CONFIG_LIBXCB 0
-#define CONFIG_LIBXCB_SHM 0
-#define CONFIG_LIBXCB_SHAPE 0
-#define CONFIG_LIBXCB_XFIXES 0
-#define CONFIG_LIBXVID 0
+#define CONFIG_LIBXML2 0
#define CONFIG_LIBZIMG 0
#define CONFIG_LIBZMQ 0
#define CONFIG_LIBZVBI 0
-#define CONFIG_LZMA 0
#define CONFIG_MEDIACODEC 0
-#define CONFIG_NETCDF 0
#define CONFIG_OPENAL 0
#define CONFIG_OPENCL 0
#define CONFIG_OPENGL 0
-#define CONFIG_OPENSSL 0
-#define CONFIG_SCHANNEL 0
-#define CONFIG_SDL 0
-#define CONFIG_SDL2 0
-#define CONFIG_SECURETRANSPORT 0
-#define CONFIG_X11GRAB 0
-#define CONFIG_XLIB 0
-#define CONFIG_ZLIB 0
#define CONFIG_AUDIOTOOLBOX 0
-#define CONFIG_CUDA 0
-#define CONFIG_CUVID 0
+#define CONFIG_CRYSTALHD 0
+#define CONFIG_CUDA 1
+#define CONFIG_CUVID 1
#define CONFIG_D3D11VA 0
#define CONFIG_DXVA2 0
-#define CONFIG_LIBMFX 0
-#define CONFIG_LIBNPP 0
-#define CONFIG_MMAL 0
-#define CONFIG_NVENC 0
-#define CONFIG_OMX 0
+#define CONFIG_NVENC 1
#define CONFIG_VAAPI 0
#define CONFIG_VDA 0
#define CONFIG_VDPAU 0
-#define CONFIG_VIDEOTOOLBOX_HWACCEL 0
+#define CONFIG_VIDEOTOOLBOX 0
+#define CONFIG_V4L2_M2M 1
#define CONFIG_XVMC 0
+#define CONFIG_CUDA_SDK 0
+#define CONFIG_LIBNPP 0
+#define CONFIG_LIBMFX 0
+#define CONFIG_MMAL 0
+#define CONFIG_OMX 0
#define CONFIG_FTRAPV 0
#define CONFIG_GRAY 0
#define CONFIG_HARDCODED_TABLES 0
@@ -553,16 +557,27 @@
#define CONFIG_PIXELUTILS 0
#define CONFIG_NETWORK 0
#define CONFIG_RDFT 0
+#define CONFIG_AUTODETECT 0
#define CONFIG_FONTCONFIG 0
-#define CONFIG_MEMALIGN_HACK 0
+#define CONFIG_LINUX_PERF 0
#define CONFIG_MEMORY_POISONING 0
#define CONFIG_NEON_CLOBBER_TEST 0
-#define CONFIG_PIC 0
-#define CONFIG_POD2MAN 1
-#define CONFIG_RAISE_MAJOR 0
+#define CONFIG_OSSFUZZ 0
+#define CONFIG_PIC 1
#define CONFIG_THUMB 0
#define CONFIG_VALGRIND_BACKTRACE 0
#define CONFIG_XMM_CLOBBER_TEST 0
+#define CONFIG_BSFS 1
+#define CONFIG_DECODERS 1
+#define CONFIG_ENCODERS 0
+#define CONFIG_HWACCELS 0
+#define CONFIG_PARSERS 1
+#define CONFIG_INDEVS 0
+#define CONFIG_OUTDEVS 0
+#define CONFIG_FILTERS 0
+#define CONFIG_DEMUXERS 0
+#define CONFIG_MUXERS 0
+#define CONFIG_PROTOCOLS 0
#define CONFIG_AANDCTTABLES 0
#define CONFIG_AC3DSP 0
#define CONFIG_AUDIO_FRAME_QUEUE 0
@@ -580,20 +595,22 @@
#define CONFIG_FMTCONVERT 0
#define CONFIG_FRAME_THREAD_ENCODER 0
#define CONFIG_G722DSP 0
-#define CONFIG_GOLOMB 1
+#define CONFIG_GOLOMB 0
#define CONFIG_GPLV3 0
#define CONFIG_H263DSP 0
#define CONFIG_H264CHROMA 0
#define CONFIG_H264DSP 0
+#define CONFIG_H264PARSE 0
#define CONFIG_H264PRED 1
#define CONFIG_H264QPEL 0
+#define CONFIG_HEVCPARSE 0
#define CONFIG_HPELDSP 0
#define CONFIG_HUFFMAN 0
#define CONFIG_HUFFYUVDSP 0
#define CONFIG_HUFFYUVENCDSP 0
#define CONFIG_IDCTDSP 0
#define CONFIG_IIRFILTER 0
-#define CONFIG_IMDCT15 0
+#define CONFIG_MDCT15 0
#define CONFIG_INTRAX8 0
#define CONFIG_ISO_MEDIA 0
#define CONFIG_IVIDSP 0
@@ -602,12 +619,14 @@
#define CONFIG_LIBX262 0
#define CONFIG_LLAUDDSP 0
#define CONFIG_LLVIDDSP 0
+#define CONFIG_LLVIDENCDSP 0
#define CONFIG_LPC 0
#define CONFIG_LZF 0
#define CONFIG_ME_CMP 0
#define CONFIG_MPEG_ER 0
#define CONFIG_MPEGAUDIO 0
#define CONFIG_MPEGAUDIODSP 0
+#define CONFIG_MPEGAUDIOHEADER 0
#define CONFIG_MPEGVIDEO 0
#define CONFIG_MPEGVIDEOENC 0
#define CONFIG_MSS34DSP 0
@@ -629,1595 +648,20 @@
#define CONFIG_TEXTUREDSP 0
#define CONFIG_TEXTUREDSPENC 0
#define CONFIG_TPELDSP 0
+#define CONFIG_VAAPI_1 0
#define CONFIG_VAAPI_ENCODE 0
#define CONFIG_VC1DSP 0
#define CONFIG_VIDEODSP 1
#define CONFIG_VP3DSP 0
#define CONFIG_VP56DSP 0
#define CONFIG_VP8DSP 1
-#define CONFIG_VT_BT2020 0
#define CONFIG_WMA_FREQS 0
#define CONFIG_WMV2DSP 0
-#define CONFIG_AAC_ADTSTOASC_BSF 0
-#define CONFIG_CHOMP_BSF 0
-#define CONFIG_DUMP_EXTRADATA_BSF 0
-#define CONFIG_DCA_CORE_BSF 0
-#define CONFIG_H264_MP4TOANNEXB_BSF 0
-#define CONFIG_HEVC_MP4TOANNEXB_BSF 0
-#define CONFIG_IMX_DUMP_HEADER_BSF 0
-#define CONFIG_MJPEG2JPEG_BSF 0
-#define CONFIG_MJPEGA_DUMP_HEADER_BSF 0
-#define CONFIG_MP3_HEADER_DECOMPRESS_BSF 0
-#define CONFIG_MPEG4_UNPACK_BFRAMES_BSF 0
-#define CONFIG_MOV2TEXTSUB_BSF 0
-#define CONFIG_NOISE_BSF 0
-#define CONFIG_REMOVE_EXTRADATA_BSF 0
-#define CONFIG_TEXT2MOVSUB_BSF 0
-#define CONFIG_VP9_SUPERFRAME_BSF 0
-#define CONFIG_AASC_DECODER 0
-#define CONFIG_AIC_DECODER 0
-#define CONFIG_ALIAS_PIX_DECODER 0
-#define CONFIG_AMV_DECODER 0
-#define CONFIG_ANM_DECODER 0
-#define CONFIG_ANSI_DECODER 0
-#define CONFIG_APNG_DECODER 0
-#define CONFIG_ASV1_DECODER 0
-#define CONFIG_ASV2_DECODER 0
-#define CONFIG_AURA_DECODER 0
-#define CONFIG_AURA2_DECODER 0
-#define CONFIG_AVRP_DECODER 0
-#define CONFIG_AVRN_DECODER 0
-#define CONFIG_AVS_DECODER 0
-#define CONFIG_AVUI_DECODER 0
-#define CONFIG_AYUV_DECODER 0
-#define CONFIG_BETHSOFTVID_DECODER 0
-#define CONFIG_BFI_DECODER 0
-#define CONFIG_BINK_DECODER 0
-#define CONFIG_BMP_DECODER 0
-#define CONFIG_BMV_VIDEO_DECODER 0
-#define CONFIG_BRENDER_PIX_DECODER 0
-#define CONFIG_C93_DECODER 0
-#define CONFIG_CAVS_DECODER 0
-#define CONFIG_CDGRAPHICS_DECODER 0
-#define CONFIG_CDXL_DECODER 0
-#define CONFIG_CFHD_DECODER 0
-#define CONFIG_CINEPAK_DECODER 0
-#define CONFIG_CLJR_DECODER 0
-#define CONFIG_CLLC_DECODER 0
-#define CONFIG_COMFORTNOISE_DECODER 0
-#define CONFIG_CPIA_DECODER 0
-#define CONFIG_CSCD_DECODER 0
-#define CONFIG_CYUV_DECODER 0
-#define CONFIG_DDS_DECODER 0
-#define CONFIG_DFA_DECODER 0
-#define CONFIG_DIRAC_DECODER 0
-#define CONFIG_DNXHD_DECODER 0
-#define CONFIG_DPX_DECODER 0
-#define CONFIG_DSICINVIDEO_DECODER 0
-#define CONFIG_DVAUDIO_DECODER 0
-#define CONFIG_DVVIDEO_DECODER 0
-#define CONFIG_DXA_DECODER 0
-#define CONFIG_DXTORY_DECODER 0
-#define CONFIG_DXV_DECODER 0
-#define CONFIG_EACMV_DECODER 0
-#define CONFIG_EAMAD_DECODER 0
-#define CONFIG_EATGQ_DECODER 0
-#define CONFIG_EATGV_DECODER 0
-#define CONFIG_EATQI_DECODER 0
-#define CONFIG_EIGHTBPS_DECODER 0
-#define CONFIG_EIGHTSVX_EXP_DECODER 0
-#define CONFIG_EIGHTSVX_FIB_DECODER 0
-#define CONFIG_ESCAPE124_DECODER 0
-#define CONFIG_ESCAPE130_DECODER 0
-#define CONFIG_EXR_DECODER 0
-#define CONFIG_FFV1_DECODER 0
-#define CONFIG_FFVHUFF_DECODER 0
-#define CONFIG_FIC_DECODER 0
-#define CONFIG_FLASHSV_DECODER 0
-#define CONFIG_FLASHSV2_DECODER 0
-#define CONFIG_FLIC_DECODER 0
-#define CONFIG_FLV_DECODER 0
-#define CONFIG_FOURXM_DECODER 0
-#define CONFIG_FRAPS_DECODER 0
-#define CONFIG_FRWU_DECODER 0
-#define CONFIG_G2M_DECODER 0
-#define CONFIG_GIF_DECODER 0
-#define CONFIG_H261_DECODER 0
-#define CONFIG_H263_DECODER 0
-#define CONFIG_H263I_DECODER 0
-#define CONFIG_H263P_DECODER 0
-#define CONFIG_H264_DECODER 0
-#define CONFIG_H264_CRYSTALHD_DECODER 0
-#define CONFIG_H264_MEDIACODEC_DECODER 0
-#define CONFIG_H264_MMAL_DECODER 0
-#define CONFIG_H264_QSV_DECODER 0
-#define CONFIG_H264_VDA_DECODER 0
-#define CONFIG_H264_VDPAU_DECODER 0
-#define CONFIG_HAP_DECODER 0
-#define CONFIG_HEVC_DECODER 0
-#define CONFIG_HEVC_QSV_DECODER 0
-#define CONFIG_HNM4_VIDEO_DECODER 0
-#define CONFIG_HQ_HQA_DECODER 0
-#define CONFIG_HQX_DECODER 0
-#define CONFIG_HUFFYUV_DECODER 0
-#define CONFIG_IDCIN_DECODER 0
-#define CONFIG_IFF_ILBM_DECODER 0
-#define CONFIG_INDEO2_DECODER 0
-#define CONFIG_INDEO3_DECODER 0
-#define CONFIG_INDEO4_DECODER 0
-#define CONFIG_INDEO5_DECODER 0
-#define CONFIG_INTERPLAY_VIDEO_DECODER 0
-#define CONFIG_JPEG2000_DECODER 0
-#define CONFIG_JPEGLS_DECODER 0
-#define CONFIG_JV_DECODER 0
-#define CONFIG_KGV1_DECODER 0
-#define CONFIG_KMVC_DECODER 0
-#define CONFIG_LAGARITH_DECODER 0
-#define CONFIG_LOCO_DECODER 0
-#define CONFIG_M101_DECODER 0
-#define CONFIG_MAGICYUV_DECODER 0
-#define CONFIG_MDEC_DECODER 0
-#define CONFIG_MIMIC_DECODER 0
-#define CONFIG_MJPEG_DECODER 0
-#define CONFIG_MJPEGB_DECODER 0
-#define CONFIG_MMVIDEO_DECODER 0
-#define CONFIG_MOTIONPIXELS_DECODER 0
-#define CONFIG_MPEG_XVMC_DECODER 0
-#define CONFIG_MPEG1VIDEO_DECODER 0
-#define CONFIG_MPEG2VIDEO_DECODER 0
-#define CONFIG_MPEG4_DECODER 0
-#define CONFIG_MPEG4_CRYSTALHD_DECODER 0
-#define CONFIG_MPEG4_MMAL_DECODER 0
-#define CONFIG_MPEG4_VDPAU_DECODER 0
-#define CONFIG_MPEGVIDEO_DECODER 0
-#define CONFIG_MPEG_VDPAU_DECODER 0
-#define CONFIG_MPEG1_VDPAU_DECODER 0
-#define CONFIG_MPEG2_MMAL_DECODER 0
-#define CONFIG_MPEG2_CRYSTALHD_DECODER 0
-#define CONFIG_MPEG2_QSV_DECODER 0
-#define CONFIG_MSA1_DECODER 0
-#define CONFIG_MSMPEG4_CRYSTALHD_DECODER 0
-#define CONFIG_MSMPEG4V1_DECODER 0
-#define CONFIG_MSMPEG4V2_DECODER 0
-#define CONFIG_MSMPEG4V3_DECODER 0
-#define CONFIG_MSRLE_DECODER 0
-#define CONFIG_MSS1_DECODER 0
-#define CONFIG_MSS2_DECODER 0
-#define CONFIG_MSVIDEO1_DECODER 0
-#define CONFIG_MSZH_DECODER 0
-#define CONFIG_MTS2_DECODER 0
-#define CONFIG_MVC1_DECODER 0
-#define CONFIG_MVC2_DECODER 0
-#define CONFIG_MXPEG_DECODER 0
-#define CONFIG_NUV_DECODER 0
-#define CONFIG_PAF_VIDEO_DECODER 0
-#define CONFIG_PAM_DECODER 0
-#define CONFIG_PBM_DECODER 0
-#define CONFIG_PCX_DECODER 0
-#define CONFIG_PGM_DECODER 0
-#define CONFIG_PGMYUV_DECODER 0
-#define CONFIG_PICTOR_DECODER 0
-#define CONFIG_PNG_DECODER 0
-#define CONFIG_PPM_DECODER 0
-#define CONFIG_PRORES_DECODER 0
-#define CONFIG_PRORES_LGPL_DECODER 0
-#define CONFIG_PTX_DECODER 0
-#define CONFIG_QDRAW_DECODER 0
-#define CONFIG_QPEG_DECODER 0
-#define CONFIG_QTRLE_DECODER 0
-#define CONFIG_R10K_DECODER 0
-#define CONFIG_R210_DECODER 0
-#define CONFIG_RAWVIDEO_DECODER 0
-#define CONFIG_RL2_DECODER 0
-#define CONFIG_ROQ_DECODER 0
-#define CONFIG_RPZA_DECODER 0
-#define CONFIG_RSCC_DECODER 0
-#define CONFIG_RV10_DECODER 0
-#define CONFIG_RV20_DECODER 0
-#define CONFIG_RV30_DECODER 0
-#define CONFIG_RV40_DECODER 0
-#define CONFIG_S302M_DECODER 0
-#define CONFIG_SANM_DECODER 0
-#define CONFIG_SCREENPRESSO_DECODER 0
-#define CONFIG_SDX2_DPCM_DECODER 0
-#define CONFIG_SGI_DECODER 0
-#define CONFIG_SGIRLE_DECODER 0
-#define CONFIG_SHEERVIDEO_DECODER 0
-#define CONFIG_SMACKER_DECODER 0
-#define CONFIG_SMC_DECODER 0
-#define CONFIG_SMVJPEG_DECODER 0
-#define CONFIG_SNOW_DECODER 0
-#define CONFIG_SP5X_DECODER 0
-#define CONFIG_SUNRAST_DECODER 0
-#define CONFIG_SVQ1_DECODER 0
-#define CONFIG_SVQ3_DECODER 0
-#define CONFIG_TARGA_DECODER 0
-#define CONFIG_TARGA_Y216_DECODER 0
-#define CONFIG_TDSC_DECODER 0
-#define CONFIG_THEORA_DECODER 0
-#define CONFIG_THP_DECODER 0
-#define CONFIG_TIERTEXSEQVIDEO_DECODER 0
-#define CONFIG_TIFF_DECODER 0
-#define CONFIG_TMV_DECODER 0
-#define CONFIG_TRUEMOTION1_DECODER 0
-#define CONFIG_TRUEMOTION2_DECODER 0
-#define CONFIG_TRUEMOTION2RT_DECODER 0
-#define CONFIG_TSCC_DECODER 0
-#define CONFIG_TSCC2_DECODER 0
-#define CONFIG_TXD_DECODER 0
-#define CONFIG_ULTI_DECODER 0
-#define CONFIG_UTVIDEO_DECODER 0
-#define CONFIG_V210_DECODER 0
-#define CONFIG_V210X_DECODER 0
-#define CONFIG_V308_DECODER 0
-#define CONFIG_V408_DECODER 0
-#define CONFIG_V410_DECODER 0
-#define CONFIG_VB_DECODER 0
-#define CONFIG_VBLE_DECODER 0
-#define CONFIG_VC1_DECODER 0
-#define CONFIG_VC1_CRYSTALHD_DECODER 0
-#define CONFIG_VC1_VDPAU_DECODER 0
-#define CONFIG_VC1IMAGE_DECODER 0
-#define CONFIG_VC1_MMAL_DECODER 0
-#define CONFIG_VC1_QSV_DECODER 0
-#define CONFIG_VCR1_DECODER 0
-#define CONFIG_VMDVIDEO_DECODER 0
-#define CONFIG_VMNC_DECODER 0
-#define CONFIG_VP3_DECODER 0
-#define CONFIG_VP5_DECODER 0
-#define CONFIG_VP6_DECODER 0
-#define CONFIG_VP6A_DECODER 0
-#define CONFIG_VP6F_DECODER 0
-#define CONFIG_VP7_DECODER 0
+#define CONFIG_NULL_BSF 1
#define CONFIG_VP8_DECODER 1
#define CONFIG_VP9_DECODER 1
-#define CONFIG_VQA_DECODER 0
-#define CONFIG_WEBP_DECODER 0
-#define CONFIG_WMV1_DECODER 0
-#define CONFIG_WMV2_DECODER 0
-#define CONFIG_WMV3_DECODER 0
-#define CONFIG_WMV3_CRYSTALHD_DECODER 0
-#define CONFIG_WMV3_VDPAU_DECODER 0
-#define CONFIG_WMV3IMAGE_DECODER 0
-#define CONFIG_WNV1_DECODER 0
-#define CONFIG_XAN_WC3_DECODER 0
-#define CONFIG_XAN_WC4_DECODER 0
-#define CONFIG_XBM_DECODER 0
-#define CONFIG_XFACE_DECODER 0
-#define CONFIG_XL_DECODER 0
-#define CONFIG_XWD_DECODER 0
-#define CONFIG_Y41P_DECODER 0
-#define CONFIG_YLC_DECODER 0
-#define CONFIG_YOP_DECODER 0
-#define CONFIG_YUV4_DECODER 0
-#define CONFIG_ZERO12V_DECODER 0
-#define CONFIG_ZEROCODEC_DECODER 0
-#define CONFIG_ZLIB_DECODER 0
-#define CONFIG_ZMBV_DECODER 0
-#define CONFIG_AAC_DECODER 0
-#define CONFIG_AAC_FIXED_DECODER 0
-#define CONFIG_AAC_LATM_DECODER 0
-#define CONFIG_AC3_DECODER 0
-#define CONFIG_AC3_FIXED_DECODER 0
-#define CONFIG_ALAC_DECODER 0
-#define CONFIG_ALS_DECODER 0
-#define CONFIG_AMRNB_DECODER 0
-#define CONFIG_AMRWB_DECODER 0
-#define CONFIG_APE_DECODER 0
-#define CONFIG_ATRAC1_DECODER 0
-#define CONFIG_ATRAC3_DECODER 0
-#define CONFIG_ATRAC3P_DECODER 0
-#define CONFIG_BINKAUDIO_DCT_DECODER 0
-#define CONFIG_BINKAUDIO_RDFT_DECODER 0
-#define CONFIG_BMV_AUDIO_DECODER 0
-#define CONFIG_COOK_DECODER 0
-#define CONFIG_DCA_DECODER 0
-#define CONFIG_DSD_LSBF_DECODER 0
-#define CONFIG_DSD_MSBF_DECODER 0
-#define CONFIG_DSD_LSBF_PLANAR_DECODER 0
-#define CONFIG_DSD_MSBF_PLANAR_DECODER 0
-#define CONFIG_DSICINAUDIO_DECODER 0
-#define CONFIG_DSS_SP_DECODER 0
-#define CONFIG_DST_DECODER 0
-#define CONFIG_EAC3_DECODER 0
-#define CONFIG_EVRC_DECODER 0
-#define CONFIG_FFWAVESYNTH_DECODER 0
#define CONFIG_FLAC_DECODER 1
-#define CONFIG_G723_1_DECODER 0
-#define CONFIG_G729_DECODER 0
-#define CONFIG_GSM_DECODER 0
-#define CONFIG_GSM_MS_DECODER 0
-#define CONFIG_IAC_DECODER 0
-#define CONFIG_IMC_DECODER 0
-#define CONFIG_INTERPLAY_ACM_DECODER 0
-#define CONFIG_MACE3_DECODER 0
-#define CONFIG_MACE6_DECODER 0
-#define CONFIG_METASOUND_DECODER 0
-#define CONFIG_MLP_DECODER 0
-#define CONFIG_MP1_DECODER 0
-#define CONFIG_MP1FLOAT_DECODER 0
-#define CONFIG_MP2_DECODER 0
-#define CONFIG_MP2FLOAT_DECODER 0
-#define CONFIG_MP3_DECODER 0
-#define CONFIG_MP3FLOAT_DECODER 0
-#define CONFIG_MP3ADU_DECODER 0
-#define CONFIG_MP3ADUFLOAT_DECODER 0
-#define CONFIG_MP3ON4_DECODER 0
-#define CONFIG_MP3ON4FLOAT_DECODER 0
-#define CONFIG_MPC7_DECODER 0
-#define CONFIG_MPC8_DECODER 0
-#define CONFIG_NELLYMOSER_DECODER 0
-#define CONFIG_ON2AVC_DECODER 0
-#define CONFIG_OPUS_DECODER 0
-#define CONFIG_PAF_AUDIO_DECODER 0
-#define CONFIG_QCELP_DECODER 0
-#define CONFIG_QDM2_DECODER 0
-#define CONFIG_RA_144_DECODER 0
-#define CONFIG_RA_288_DECODER 0
-#define CONFIG_RALF_DECODER 0
-#define CONFIG_SHORTEN_DECODER 0
-#define CONFIG_SIPR_DECODER 0
-#define CONFIG_SMACKAUD_DECODER 0
-#define CONFIG_SONIC_DECODER 0
-#define CONFIG_TAK_DECODER 0
-#define CONFIG_TRUEHD_DECODER 0
-#define CONFIG_TRUESPEECH_DECODER 0
-#define CONFIG_TTA_DECODER 0
-#define CONFIG_TWINVQ_DECODER 0
-#define CONFIG_VMDAUDIO_DECODER 0
-#define CONFIG_VORBIS_DECODER 0
-#define CONFIG_WAVPACK_DECODER 0
-#define CONFIG_WMALOSSLESS_DECODER 0
-#define CONFIG_WMAPRO_DECODER 0
-#define CONFIG_WMAV1_DECODER 0
-#define CONFIG_WMAV2_DECODER 0
-#define CONFIG_WMAVOICE_DECODER 0
-#define CONFIG_WS_SND1_DECODER 0
-#define CONFIG_XMA1_DECODER 0
-#define CONFIG_XMA2_DECODER 0
-#define CONFIG_PCM_ALAW_DECODER 0
-#define CONFIG_PCM_BLURAY_DECODER 0
-#define CONFIG_PCM_DVD_DECODER 0
-#define CONFIG_PCM_F32BE_DECODER 0
-#define CONFIG_PCM_F32LE_DECODER 0
-#define CONFIG_PCM_F64BE_DECODER 0
-#define CONFIG_PCM_F64LE_DECODER 0
-#define CONFIG_PCM_LXF_DECODER 0
-#define CONFIG_PCM_MULAW_DECODER 0
-#define CONFIG_PCM_S8_DECODER 0
-#define CONFIG_PCM_S8_PLANAR_DECODER 0
-#define CONFIG_PCM_S16BE_DECODER 0
-#define CONFIG_PCM_S16BE_PLANAR_DECODER 0
-#define CONFIG_PCM_S16LE_DECODER 0
-#define CONFIG_PCM_S16LE_PLANAR_DECODER 0
-#define CONFIG_PCM_S24BE_DECODER 0
-#define CONFIG_PCM_S24DAUD_DECODER 0
-#define CONFIG_PCM_S24LE_DECODER 0
-#define CONFIG_PCM_S24LE_PLANAR_DECODER 0
-#define CONFIG_PCM_S32BE_DECODER 0
-#define CONFIG_PCM_S32LE_DECODER 0
-#define CONFIG_PCM_S32LE_PLANAR_DECODER 0
-#define CONFIG_PCM_S64BE_DECODER 0
-#define CONFIG_PCM_S64LE_DECODER 0
-#define CONFIG_PCM_U8_DECODER 0
-#define CONFIG_PCM_U16BE_DECODER 0
-#define CONFIG_PCM_U16LE_DECODER 0
-#define CONFIG_PCM_U24BE_DECODER 0
-#define CONFIG_PCM_U24LE_DECODER 0
-#define CONFIG_PCM_U32BE_DECODER 0
-#define CONFIG_PCM_U32LE_DECODER 0
-#define CONFIG_PCM_ZORK_DECODER 0
-#define CONFIG_INTERPLAY_DPCM_DECODER 0
-#define CONFIG_ROQ_DPCM_DECODER 0
-#define CONFIG_SOL_DPCM_DECODER 0
-#define CONFIG_XAN_DPCM_DECODER 0
-#define CONFIG_ADPCM_4XM_DECODER 0
-#define CONFIG_ADPCM_ADX_DECODER 0
-#define CONFIG_ADPCM_AFC_DECODER 0
-#define CONFIG_ADPCM_AICA_DECODER 0
-#define CONFIG_ADPCM_CT_DECODER 0
-#define CONFIG_ADPCM_DTK_DECODER 0
-#define CONFIG_ADPCM_EA_DECODER 0
-#define CONFIG_ADPCM_EA_MAXIS_XA_DECODER 0
-#define CONFIG_ADPCM_EA_R1_DECODER 0
-#define CONFIG_ADPCM_EA_R2_DECODER 0
-#define CONFIG_ADPCM_EA_R3_DECODER 0
-#define CONFIG_ADPCM_EA_XAS_DECODER 0
-#define CONFIG_ADPCM_G722_DECODER 0
-#define CONFIG_ADPCM_G726_DECODER 0
-#define CONFIG_ADPCM_G726LE_DECODER 0
-#define CONFIG_ADPCM_IMA_AMV_DECODER 0
-#define CONFIG_ADPCM_IMA_APC_DECODER 0
-#define CONFIG_ADPCM_IMA_DAT4_DECODER 0
-#define CONFIG_ADPCM_IMA_DK3_DECODER 0
-#define CONFIG_ADPCM_IMA_DK4_DECODER 0
-#define CONFIG_ADPCM_IMA_EA_EACS_DECODER 0
-#define CONFIG_ADPCM_IMA_EA_SEAD_DECODER 0
-#define CONFIG_ADPCM_IMA_ISS_DECODER 0
-#define CONFIG_ADPCM_IMA_OKI_DECODER 0
-#define CONFIG_ADPCM_IMA_QT_DECODER 0
-#define CONFIG_ADPCM_IMA_RAD_DECODER 0
-#define CONFIG_ADPCM_IMA_SMJPEG_DECODER 0
-#define CONFIG_ADPCM_IMA_WAV_DECODER 0
-#define CONFIG_ADPCM_IMA_WS_DECODER 0
-#define CONFIG_ADPCM_MS_DECODER 0
-#define CONFIG_ADPCM_MTAF_DECODER 0
-#define CONFIG_ADPCM_PSX_DECODER 0
-#define CONFIG_ADPCM_SBPRO_2_DECODER 0
-#define CONFIG_ADPCM_SBPRO_3_DECODER 0
-#define CONFIG_ADPCM_SBPRO_4_DECODER 0
-#define CONFIG_ADPCM_SWF_DECODER 0
-#define CONFIG_ADPCM_THP_DECODER 0
-#define CONFIG_ADPCM_THP_LE_DECODER 0
-#define CONFIG_ADPCM_VIMA_DECODER 0
-#define CONFIG_ADPCM_XA_DECODER 0
-#define CONFIG_ADPCM_YAMAHA_DECODER 0
-#define CONFIG_SSA_DECODER 0
-#define CONFIG_ASS_DECODER 0
-#define CONFIG_CCAPTION_DECODER 0
-#define CONFIG_DVBSUB_DECODER 0
-#define CONFIG_DVDSUB_DECODER 0
-#define CONFIG_JACOSUB_DECODER 0
-#define CONFIG_MICRODVD_DECODER 0
-#define CONFIG_MOVTEXT_DECODER 0
-#define CONFIG_MPL2_DECODER 0
-#define CONFIG_PGSSUB_DECODER 0
-#define CONFIG_PJS_DECODER 0
-#define CONFIG_REALTEXT_DECODER 0
-#define CONFIG_SAMI_DECODER 0
-#define CONFIG_SRT_DECODER 0
-#define CONFIG_STL_DECODER 0
-#define CONFIG_SUBRIP_DECODER 0
-#define CONFIG_SUBVIEWER_DECODER 0
-#define CONFIG_SUBVIEWER1_DECODER 0
-#define CONFIG_TEXT_DECODER 0
-#define CONFIG_VPLAYER_DECODER 0
-#define CONFIG_WEBVTT_DECODER 0
-#define CONFIG_XSUB_DECODER 0
-#define CONFIG_AAC_AT_DECODER 0
-#define CONFIG_AC3_AT_DECODER 0
-#define CONFIG_ADPCM_IMA_QT_AT_DECODER 0
-#define CONFIG_ALAC_AT_DECODER 0
-#define CONFIG_AMR_NB_AT_DECODER 0
-#define CONFIG_EAC3_AT_DECODER 0
-#define CONFIG_GSM_MS_AT_DECODER 0
-#define CONFIG_ILBC_AT_DECODER 0
-#define CONFIG_MP1_AT_DECODER 0
-#define CONFIG_MP2_AT_DECODER 0
-#define CONFIG_MP3_AT_DECODER 0
-#define CONFIG_PCM_ALAW_AT_DECODER 0
-#define CONFIG_PCM_MULAW_AT_DECODER 0
-#define CONFIG_QDMC_AT_DECODER 0
-#define CONFIG_QDM2_AT_DECODER 0
-#define CONFIG_LIBCELT_DECODER 0
-#define CONFIG_LIBFDK_AAC_DECODER 0
-#define CONFIG_LIBGSM_DECODER 0
-#define CONFIG_LIBGSM_MS_DECODER 0
-#define CONFIG_LIBILBC_DECODER 0
-#define CONFIG_LIBOPENCORE_AMRNB_DECODER 0
-#define CONFIG_LIBOPENCORE_AMRWB_DECODER 0
-#define CONFIG_LIBOPENJPEG_DECODER 0
-#define CONFIG_LIBOPUS_DECODER 0
-#define CONFIG_LIBSCHROEDINGER_DECODER 0
-#define CONFIG_LIBSPEEX_DECODER 0
-#define CONFIG_LIBVORBIS_DECODER 0
-#define CONFIG_LIBVPX_VP8_DECODER 0
-#define CONFIG_LIBVPX_VP9_DECODER 0
-#define CONFIG_LIBZVBI_TELETEXT_DECODER 0
-#define CONFIG_BINTEXT_DECODER 0
-#define CONFIG_XBIN_DECODER 0
-#define CONFIG_IDF_DECODER 0
-#define CONFIG_LIBOPENH264_DECODER 0
-#define CONFIG_H263_CUVID_DECODER 0
-#define CONFIG_H264_CUVID_DECODER 0
-#define CONFIG_HEVC_CUVID_DECODER 0
-#define CONFIG_HEVC_MEDIACODEC_DECODER 0
-#define CONFIG_MJPEG_CUVID_DECODER 0
-#define CONFIG_MPEG1_CUVID_DECODER 0
-#define CONFIG_MPEG2_CUVID_DECODER 0
-#define CONFIG_MPEG4_CUVID_DECODER 0
-#define CONFIG_MPEG4_MEDIACODEC_DECODER 0
-#define CONFIG_VC1_CUVID_DECODER 0
-#define CONFIG_VP8_CUVID_DECODER 0
-#define CONFIG_VP8_MEDIACODEC_DECODER 0
-#define CONFIG_VP9_CUVID_DECODER 0
-#define CONFIG_VP9_MEDIACODEC_DECODER 0
-#define CONFIG_AA_DEMUXER 0
-#define CONFIG_AAC_DEMUXER 0
-#define CONFIG_AC3_DEMUXER 0
-#define CONFIG_ACM_DEMUXER 0
-#define CONFIG_ACT_DEMUXER 0
-#define CONFIG_ADF_DEMUXER 0
-#define CONFIG_ADP_DEMUXER 0
-#define CONFIG_ADS_DEMUXER 0
-#define CONFIG_ADX_DEMUXER 0
-#define CONFIG_AEA_DEMUXER 0
-#define CONFIG_AFC_DEMUXER 0
-#define CONFIG_AIFF_DEMUXER 0
-#define CONFIG_AIX_DEMUXER 0
-#define CONFIG_AMR_DEMUXER 0
-#define CONFIG_ANM_DEMUXER 0
-#define CONFIG_APC_DEMUXER 0
-#define CONFIG_APE_DEMUXER 0
-#define CONFIG_APNG_DEMUXER 0
-#define CONFIG_AQTITLE_DEMUXER 0
-#define CONFIG_ASF_DEMUXER 0
-#define CONFIG_ASF_O_DEMUXER 0
-#define CONFIG_ASS_DEMUXER 0
-#define CONFIG_AST_DEMUXER 0
-#define CONFIG_AU_DEMUXER 0
-#define CONFIG_AVI_DEMUXER 0
-#define CONFIG_AVISYNTH_DEMUXER 0
-#define CONFIG_AVR_DEMUXER 0
-#define CONFIG_AVS_DEMUXER 0
-#define CONFIG_BETHSOFTVID_DEMUXER 0
-#define CONFIG_BFI_DEMUXER 0
-#define CONFIG_BINTEXT_DEMUXER 0
-#define CONFIG_BINK_DEMUXER 0
-#define CONFIG_BIT_DEMUXER 0
-#define CONFIG_BMV_DEMUXER 0
-#define CONFIG_BFSTM_DEMUXER 0
-#define CONFIG_BRSTM_DEMUXER 0
-#define CONFIG_BOA_DEMUXER 0
-#define CONFIG_C93_DEMUXER 0
-#define CONFIG_CAF_DEMUXER 0
-#define CONFIG_CAVSVIDEO_DEMUXER 0
-#define CONFIG_CDG_DEMUXER 0
-#define CONFIG_CDXL_DEMUXER 0
-#define CONFIG_CINE_DEMUXER 0
-#define CONFIG_CONCAT_DEMUXER 0
-#define CONFIG_DATA_DEMUXER 0
-#define CONFIG_DAUD_DEMUXER 0
-#define CONFIG_DCSTR_DEMUXER 0
-#define CONFIG_DFA_DEMUXER 0
-#define CONFIG_DIRAC_DEMUXER 0
-#define CONFIG_DNXHD_DEMUXER 0
-#define CONFIG_DSF_DEMUXER 0
-#define CONFIG_DSICIN_DEMUXER 0
-#define CONFIG_DSS_DEMUXER 0
-#define CONFIG_DTS_DEMUXER 0
-#define CONFIG_DTSHD_DEMUXER 0
-#define CONFIG_DV_DEMUXER 0
-#define CONFIG_DVBSUB_DEMUXER 0
-#define CONFIG_DVBTXT_DEMUXER 0
-#define CONFIG_DXA_DEMUXER 0
-#define CONFIG_EA_DEMUXER 0
-#define CONFIG_EA_CDATA_DEMUXER 0
-#define CONFIG_EAC3_DEMUXER 0
-#define CONFIG_EPAF_DEMUXER 0
-#define CONFIG_FFM_DEMUXER 0
-#define CONFIG_FFMETADATA_DEMUXER 0
-#define CONFIG_FILMSTRIP_DEMUXER 0
-#define CONFIG_FLAC_DEMUXER 0
-#define CONFIG_FLIC_DEMUXER 0
-#define CONFIG_FLV_DEMUXER 0
-#define CONFIG_LIVE_FLV_DEMUXER 0
-#define CONFIG_FOURXM_DEMUXER 0
-#define CONFIG_FRM_DEMUXER 0
-#define CONFIG_FSB_DEMUXER 0
-#define CONFIG_G722_DEMUXER 0
-#define CONFIG_G723_1_DEMUXER 0
-#define CONFIG_G729_DEMUXER 0
-#define CONFIG_GENH_DEMUXER 0
-#define CONFIG_GIF_DEMUXER 0
-#define CONFIG_GSM_DEMUXER 0
-#define CONFIG_GXF_DEMUXER 0
-#define CONFIG_H261_DEMUXER 0
-#define CONFIG_H263_DEMUXER 0
-#define CONFIG_H264_DEMUXER 0
-#define CONFIG_HEVC_DEMUXER 0
-#define CONFIG_HLS_DEMUXER 0
-#define CONFIG_HNM_DEMUXER 0
-#define CONFIG_ICO_DEMUXER 0
-#define CONFIG_IDCIN_DEMUXER 0
-#define CONFIG_IDF_DEMUXER 0
-#define CONFIG_IFF_DEMUXER 0
-#define CONFIG_ILBC_DEMUXER 0
-#define CONFIG_IMAGE2_DEMUXER 0
-#define CONFIG_IMAGE2PIPE_DEMUXER 0
-#define CONFIG_IMAGE2_ALIAS_PIX_DEMUXER 0
-#define CONFIG_IMAGE2_BRENDER_PIX_DEMUXER 0
-#define CONFIG_INGENIENT_DEMUXER 0
-#define CONFIG_IPMOVIE_DEMUXER 0
-#define CONFIG_IRCAM_DEMUXER 0
-#define CONFIG_ISS_DEMUXER 0
-#define CONFIG_IV8_DEMUXER 0
-#define CONFIG_IVF_DEMUXER 0
-#define CONFIG_IVR_DEMUXER 0
-#define CONFIG_JACOSUB_DEMUXER 0
-#define CONFIG_JV_DEMUXER 0
-#define CONFIG_LMLM4_DEMUXER 0
-#define CONFIG_LOAS_DEMUXER 0
-#define CONFIG_LRC_DEMUXER 0
-#define CONFIG_LVF_DEMUXER 0
-#define CONFIG_LXF_DEMUXER 0
-#define CONFIG_M4V_DEMUXER 0
-#define CONFIG_MATROSKA_DEMUXER 0
-#define CONFIG_MGSTS_DEMUXER 0
-#define CONFIG_MICRODVD_DEMUXER 0
-#define CONFIG_MJPEG_DEMUXER 0
-#define CONFIG_MLP_DEMUXER 0
-#define CONFIG_MLV_DEMUXER 0
-#define CONFIG_MM_DEMUXER 0
-#define CONFIG_MMF_DEMUXER 0
-#define CONFIG_MOV_DEMUXER 0
-#define CONFIG_MP3_DEMUXER 0
-#define CONFIG_MPC_DEMUXER 0
-#define CONFIG_MPC8_DEMUXER 0
-#define CONFIG_MPEGPS_DEMUXER 0
-#define CONFIG_MPEGTS_DEMUXER 0
-#define CONFIG_MPEGTSRAW_DEMUXER 0
-#define CONFIG_MPEGVIDEO_DEMUXER 0
-#define CONFIG_MPJPEG_DEMUXER 0
-#define CONFIG_MPL2_DEMUXER 0
-#define CONFIG_MPSUB_DEMUXER 0
-#define CONFIG_MSF_DEMUXER 0
-#define CONFIG_MSNWC_TCP_DEMUXER 0
-#define CONFIG_MTAF_DEMUXER 0
-#define CONFIG_MTV_DEMUXER 0
-#define CONFIG_MUSX_DEMUXER 0
-#define CONFIG_MV_DEMUXER 0
-#define CONFIG_MVI_DEMUXER 0
-#define CONFIG_MXF_DEMUXER 0
-#define CONFIG_MXG_DEMUXER 0
-#define CONFIG_NC_DEMUXER 0
-#define CONFIG_NISTSPHERE_DEMUXER 0
-#define CONFIG_NSV_DEMUXER 0
-#define CONFIG_NUT_DEMUXER 0
-#define CONFIG_NUV_DEMUXER 0
-#define CONFIG_OGG_DEMUXER 0
-#define CONFIG_OMA_DEMUXER 0
-#define CONFIG_PAF_DEMUXER 0
-#define CONFIG_PCM_ALAW_DEMUXER 0
-#define CONFIG_PCM_MULAW_DEMUXER 0
-#define CONFIG_PCM_F64BE_DEMUXER 0
-#define CONFIG_PCM_F64LE_DEMUXER 0
-#define CONFIG_PCM_F32BE_DEMUXER 0
-#define CONFIG_PCM_F32LE_DEMUXER 0
-#define CONFIG_PCM_S32BE_DEMUXER 0
-#define CONFIG_PCM_S32LE_DEMUXER 0
-#define CONFIG_PCM_S24BE_DEMUXER 0
-#define CONFIG_PCM_S24LE_DEMUXER 0
-#define CONFIG_PCM_S16BE_DEMUXER 0
-#define CONFIG_PCM_S16LE_DEMUXER 0
-#define CONFIG_PCM_S8_DEMUXER 0
-#define CONFIG_PCM_U32BE_DEMUXER 0
-#define CONFIG_PCM_U32LE_DEMUXER 0
-#define CONFIG_PCM_U24BE_DEMUXER 0
-#define CONFIG_PCM_U24LE_DEMUXER 0
-#define CONFIG_PCM_U16BE_DEMUXER 0
-#define CONFIG_PCM_U16LE_DEMUXER 0
-#define CONFIG_PCM_U8_DEMUXER 0
-#define CONFIG_PJS_DEMUXER 0
-#define CONFIG_PMP_DEMUXER 0
-#define CONFIG_PVA_DEMUXER 0
-#define CONFIG_PVF_DEMUXER 0
-#define CONFIG_QCP_DEMUXER 0
-#define CONFIG_R3D_DEMUXER 0
-#define CONFIG_RAWVIDEO_DEMUXER 0
-#define CONFIG_REALTEXT_DEMUXER 0
-#define CONFIG_REDSPARK_DEMUXER 0
-#define CONFIG_RL2_DEMUXER 0
-#define CONFIG_RM_DEMUXER 0
-#define CONFIG_ROQ_DEMUXER 0
-#define CONFIG_RPL_DEMUXER 0
-#define CONFIG_RSD_DEMUXER 0
-#define CONFIG_RSO_DEMUXER 0
-#define CONFIG_RTP_DEMUXER 0
-#define CONFIG_RTSP_DEMUXER 0
-#define CONFIG_SAMI_DEMUXER 0
-#define CONFIG_SAP_DEMUXER 0
-#define CONFIG_SBG_DEMUXER 0
-#define CONFIG_SDP_DEMUXER 0
-#define CONFIG_SDR2_DEMUXER 0
-#define CONFIG_SEGAFILM_DEMUXER 0
-#define CONFIG_SHORTEN_DEMUXER 0
-#define CONFIG_SIFF_DEMUXER 0
-#define CONFIG_SLN_DEMUXER 0
-#define CONFIG_SMACKER_DEMUXER 0
-#define CONFIG_SMJPEG_DEMUXER 0
-#define CONFIG_SMUSH_DEMUXER 0
-#define CONFIG_SOL_DEMUXER 0
-#define CONFIG_SOX_DEMUXER 0
-#define CONFIG_SPDIF_DEMUXER 0
-#define CONFIG_SRT_DEMUXER 0
-#define CONFIG_STR_DEMUXER 0
-#define CONFIG_STL_DEMUXER 0
-#define CONFIG_SUBVIEWER1_DEMUXER 0
-#define CONFIG_SUBVIEWER_DEMUXER 0
-#define CONFIG_SUP_DEMUXER 0
-#define CONFIG_SVAG_DEMUXER 0
-#define CONFIG_SWF_DEMUXER 0
-#define CONFIG_TAK_DEMUXER 0
-#define CONFIG_TEDCAPTIONS_DEMUXER 0
-#define CONFIG_THP_DEMUXER 0
-#define CONFIG_THREEDOSTR_DEMUXER 0
-#define CONFIG_TIERTEXSEQ_DEMUXER 0
-#define CONFIG_TMV_DEMUXER 0
-#define CONFIG_TRUEHD_DEMUXER 0
-#define CONFIG_TTA_DEMUXER 0
-#define CONFIG_TXD_DEMUXER 0
-#define CONFIG_TTY_DEMUXER 0
-#define CONFIG_V210_DEMUXER 0
-#define CONFIG_V210X_DEMUXER 0
-#define CONFIG_VAG_DEMUXER 0
-#define CONFIG_VC1_DEMUXER 0
-#define CONFIG_VC1T_DEMUXER 0
-#define CONFIG_VIVO_DEMUXER 0
-#define CONFIG_VMD_DEMUXER 0
-#define CONFIG_VOBSUB_DEMUXER 0
-#define CONFIG_VOC_DEMUXER 0
-#define CONFIG_VPK_DEMUXER 0
-#define CONFIG_VPLAYER_DEMUXER 0
-#define CONFIG_VQF_DEMUXER 0
-#define CONFIG_W64_DEMUXER 0
-#define CONFIG_WAV_DEMUXER 0
-#define CONFIG_WC3_DEMUXER 0
-#define CONFIG_WEBM_DASH_MANIFEST_DEMUXER 0
-#define CONFIG_WEBVTT_DEMUXER 0
-#define CONFIG_WSAUD_DEMUXER 0
-#define CONFIG_WSD_DEMUXER 0
-#define CONFIG_WSVQA_DEMUXER 0
-#define CONFIG_WTV_DEMUXER 0
-#define CONFIG_WVE_DEMUXER 0
-#define CONFIG_WV_DEMUXER 0
-#define CONFIG_XA_DEMUXER 0
-#define CONFIG_XBIN_DEMUXER 0
-#define CONFIG_XMV_DEMUXER 0
-#define CONFIG_XVAG_DEMUXER 0
-#define CONFIG_XWMA_DEMUXER 0
-#define CONFIG_YOP_DEMUXER 0
-#define CONFIG_YUV4MPEGPIPE_DEMUXER 0
-#define CONFIG_IMAGE_BMP_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_DDS_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_DPX_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_EXR_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_J2K_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_JPEG_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_JPEGLS_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PAM_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PBM_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PCX_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PGMYUV_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PGM_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PICTOR_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PNG_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PPM_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_QDRAW_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_SGI_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_SUNRAST_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_TIFF_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_WEBP_PIPE_DEMUXER 0
-#define CONFIG_LIBGME_DEMUXER 0
-#define CONFIG_LIBMODPLUG_DEMUXER 0
-#define CONFIG_LIBNUT_DEMUXER 0
-#define CONFIG_LIBOPENMPT_DEMUXER 0
-#define CONFIG_A64MULTI_ENCODER 0
-#define CONFIG_A64MULTI5_ENCODER 0
-#define CONFIG_ALIAS_PIX_ENCODER 0
-#define CONFIG_AMV_ENCODER 0
-#define CONFIG_APNG_ENCODER 0
-#define CONFIG_ASV1_ENCODER 0
-#define CONFIG_ASV2_ENCODER 0
-#define CONFIG_AVRP_ENCODER 0
-#define CONFIG_AVUI_ENCODER 0
-#define CONFIG_AYUV_ENCODER 0
-#define CONFIG_BMP_ENCODER 0
-#define CONFIG_CINEPAK_ENCODER 0
-#define CONFIG_CLJR_ENCODER 0
-#define CONFIG_COMFORTNOISE_ENCODER 0
-#define CONFIG_DNXHD_ENCODER 0
-#define CONFIG_DPX_ENCODER 0
-#define CONFIG_DVVIDEO_ENCODER 0
-#define CONFIG_FFV1_ENCODER 0
-#define CONFIG_FFVHUFF_ENCODER 0
-#define CONFIG_FLASHSV_ENCODER 0
-#define CONFIG_FLASHSV2_ENCODER 0
-#define CONFIG_FLV_ENCODER 0
-#define CONFIG_GIF_ENCODER 0
-#define CONFIG_H261_ENCODER 0
-#define CONFIG_H263_ENCODER 0
-#define CONFIG_H263P_ENCODER 0
-#define CONFIG_HAP_ENCODER 0
-#define CONFIG_HUFFYUV_ENCODER 0
-#define CONFIG_JPEG2000_ENCODER 0
-#define CONFIG_JPEGLS_ENCODER 0
-#define CONFIG_LJPEG_ENCODER 0
-#define CONFIG_MJPEG_ENCODER 0
-#define CONFIG_MPEG1VIDEO_ENCODER 0
-#define CONFIG_MPEG2VIDEO_ENCODER 0
-#define CONFIG_MPEG4_ENCODER 0
-#define CONFIG_MSMPEG4V2_ENCODER 0
-#define CONFIG_MSMPEG4V3_ENCODER 0
-#define CONFIG_MSVIDEO1_ENCODER 0
-#define CONFIG_PAM_ENCODER 0
-#define CONFIG_PBM_ENCODER 0
-#define CONFIG_PCX_ENCODER 0
-#define CONFIG_PGM_ENCODER 0
-#define CONFIG_PGMYUV_ENCODER 0
-#define CONFIG_PNG_ENCODER 0
-#define CONFIG_PPM_ENCODER 0
-#define CONFIG_PRORES_ENCODER 0
-#define CONFIG_PRORES_AW_ENCODER 0
-#define CONFIG_PRORES_KS_ENCODER 0
-#define CONFIG_QTRLE_ENCODER 0
-#define CONFIG_R10K_ENCODER 0
-#define CONFIG_R210_ENCODER 0
-#define CONFIG_RAWVIDEO_ENCODER 0
-#define CONFIG_ROQ_ENCODER 0
-#define CONFIG_RV10_ENCODER 0
-#define CONFIG_RV20_ENCODER 0
-#define CONFIG_S302M_ENCODER 0
-#define CONFIG_SGI_ENCODER 0
-#define CONFIG_SNOW_ENCODER 0
-#define CONFIG_SUNRAST_ENCODER 0
-#define CONFIG_SVQ1_ENCODER 0
-#define CONFIG_TARGA_ENCODER 0
-#define CONFIG_TIFF_ENCODER 0
-#define CONFIG_UTVIDEO_ENCODER 0
-#define CONFIG_V210_ENCODER 0
-#define CONFIG_V308_ENCODER 0
-#define CONFIG_V408_ENCODER 0
-#define CONFIG_V410_ENCODER 0
-#define CONFIG_VC2_ENCODER 0
-#define CONFIG_WRAPPED_AVFRAME_ENCODER 0
-#define CONFIG_WMV1_ENCODER 0
-#define CONFIG_WMV2_ENCODER 0
-#define CONFIG_XBM_ENCODER 0
-#define CONFIG_XFACE_ENCODER 0
-#define CONFIG_XWD_ENCODER 0
-#define CONFIG_Y41P_ENCODER 0
-#define CONFIG_YUV4_ENCODER 0
-#define CONFIG_ZLIB_ENCODER 0
-#define CONFIG_ZMBV_ENCODER 0
-#define CONFIG_AAC_ENCODER 0
-#define CONFIG_AC3_ENCODER 0
-#define CONFIG_AC3_FIXED_ENCODER 0
-#define CONFIG_ALAC_ENCODER 0
-#define CONFIG_DCA_ENCODER 0
-#define CONFIG_EAC3_ENCODER 0
-#define CONFIG_FLAC_ENCODER 0
-#define CONFIG_G723_1_ENCODER 0
-#define CONFIG_MLP_ENCODER 0
-#define CONFIG_MP2_ENCODER 0
-#define CONFIG_MP2FIXED_ENCODER 0
-#define CONFIG_NELLYMOSER_ENCODER 0
-#define CONFIG_RA_144_ENCODER 0
-#define CONFIG_SONIC_ENCODER 0
-#define CONFIG_SONIC_LS_ENCODER 0
-#define CONFIG_TRUEHD_ENCODER 0
-#define CONFIG_TTA_ENCODER 0
-#define CONFIG_VORBIS_ENCODER 0
-#define CONFIG_WAVPACK_ENCODER 0
-#define CONFIG_WMAV1_ENCODER 0
-#define CONFIG_WMAV2_ENCODER 0
-#define CONFIG_PCM_ALAW_ENCODER 0
-#define CONFIG_PCM_F32BE_ENCODER 0
-#define CONFIG_PCM_F32LE_ENCODER 0
-#define CONFIG_PCM_F64BE_ENCODER 0
-#define CONFIG_PCM_F64LE_ENCODER 0
-#define CONFIG_PCM_MULAW_ENCODER 0
-#define CONFIG_PCM_S8_ENCODER 0
-#define CONFIG_PCM_S8_PLANAR_ENCODER 0
-#define CONFIG_PCM_S16BE_ENCODER 0
-#define CONFIG_PCM_S16BE_PLANAR_ENCODER 0
-#define CONFIG_PCM_S16LE_ENCODER 0
-#define CONFIG_PCM_S16LE_PLANAR_ENCODER 0
-#define CONFIG_PCM_S24BE_ENCODER 0
-#define CONFIG_PCM_S24DAUD_ENCODER 0
-#define CONFIG_PCM_S24LE_ENCODER 0
-#define CONFIG_PCM_S24LE_PLANAR_ENCODER 0
-#define CONFIG_PCM_S32BE_ENCODER 0
-#define CONFIG_PCM_S32LE_ENCODER 0
-#define CONFIG_PCM_S32LE_PLANAR_ENCODER 0
-#define CONFIG_PCM_S64BE_ENCODER 0
-#define CONFIG_PCM_S64LE_ENCODER 0
-#define CONFIG_PCM_U8_ENCODER 0
-#define CONFIG_PCM_U16BE_ENCODER 0
-#define CONFIG_PCM_U16LE_ENCODER 0
-#define CONFIG_PCM_U24BE_ENCODER 0
-#define CONFIG_PCM_U24LE_ENCODER 0
-#define CONFIG_PCM_U32BE_ENCODER 0
-#define CONFIG_PCM_U32LE_ENCODER 0
-#define CONFIG_ROQ_DPCM_ENCODER 0
-#define CONFIG_ADPCM_ADX_ENCODER 0
-#define CONFIG_ADPCM_G722_ENCODER 0
-#define CONFIG_ADPCM_G726_ENCODER 0
-#define CONFIG_ADPCM_IMA_QT_ENCODER 0
-#define CONFIG_ADPCM_IMA_WAV_ENCODER 0
-#define CONFIG_ADPCM_MS_ENCODER 0
-#define CONFIG_ADPCM_SWF_ENCODER 0
-#define CONFIG_ADPCM_YAMAHA_ENCODER 0
-#define CONFIG_SSA_ENCODER 0
-#define CONFIG_ASS_ENCODER 0
-#define CONFIG_DVBSUB_ENCODER 0
-#define CONFIG_DVDSUB_ENCODER 0
-#define CONFIG_MOVTEXT_ENCODER 0
-#define CONFIG_SRT_ENCODER 0
-#define CONFIG_SUBRIP_ENCODER 0
-#define CONFIG_TEXT_ENCODER 0
-#define CONFIG_WEBVTT_ENCODER 0
-#define CONFIG_XSUB_ENCODER 0
-#define CONFIG_AAC_AT_ENCODER 0
-#define CONFIG_ALAC_AT_ENCODER 0
-#define CONFIG_ILBC_AT_ENCODER 0
-#define CONFIG_PCM_ALAW_AT_ENCODER 0
-#define CONFIG_PCM_MULAW_AT_ENCODER 0
-#define CONFIG_LIBFDK_AAC_ENCODER 0
-#define CONFIG_LIBGSM_ENCODER 0
-#define CONFIG_LIBGSM_MS_ENCODER 0
-#define CONFIG_LIBILBC_ENCODER 0
-#define CONFIG_LIBMP3LAME_ENCODER 0
-#define CONFIG_LIBOPENCORE_AMRNB_ENCODER 0
-#define CONFIG_LIBOPENJPEG_ENCODER 0
-#define CONFIG_LIBOPUS_ENCODER 0
-#define CONFIG_LIBSCHROEDINGER_ENCODER 0
-#define CONFIG_LIBSHINE_ENCODER 0
-#define CONFIG_LIBSPEEX_ENCODER 0
-#define CONFIG_LIBTHEORA_ENCODER 0
-#define CONFIG_LIBTWOLAME_ENCODER 0
-#define CONFIG_LIBVO_AMRWBENC_ENCODER 0
-#define CONFIG_LIBVORBIS_ENCODER 0
-#define CONFIG_LIBVPX_VP8_ENCODER 0
-#define CONFIG_LIBVPX_VP9_ENCODER 0
-#define CONFIG_LIBWAVPACK_ENCODER 0
-#define CONFIG_LIBWEBP_ANIM_ENCODER 0
-#define CONFIG_LIBWEBP_ENCODER 0
-#define CONFIG_LIBX262_ENCODER 0
-#define CONFIG_LIBX264_ENCODER 0
-#define CONFIG_LIBX264RGB_ENCODER 0
-#define CONFIG_LIBX265_ENCODER 0
-#define CONFIG_LIBXAVS_ENCODER 0
-#define CONFIG_LIBXVID_ENCODER 0
-#define CONFIG_LIBOPENH264_ENCODER 0
-#define CONFIG_H264_NVENC_ENCODER 0
-#define CONFIG_H264_OMX_ENCODER 0
-#define CONFIG_H264_QSV_ENCODER 0
-#define CONFIG_H264_VAAPI_ENCODER 0
-#define CONFIG_H264_VIDEOTOOLBOX_ENCODER 0
-#define CONFIG_NVENC_ENCODER 0
-#define CONFIG_NVENC_H264_ENCODER 0
-#define CONFIG_NVENC_HEVC_ENCODER 0
-#define CONFIG_HEVC_NVENC_ENCODER 0
-#define CONFIG_HEVC_QSV_ENCODER 0
-#define CONFIG_HEVC_VAAPI_ENCODER 0
-#define CONFIG_LIBKVAZAAR_ENCODER 0
-#define CONFIG_MJPEG_VAAPI_ENCODER 0
-#define CONFIG_MPEG2_QSV_ENCODER 0
-#define CONFIG_ABENCH_FILTER 0
-#define CONFIG_ACOMPRESSOR_FILTER 0
-#define CONFIG_ACROSSFADE_FILTER 0
-#define CONFIG_ACRUSHER_FILTER 0
-#define CONFIG_ADELAY_FILTER 0
-#define CONFIG_AECHO_FILTER 0
-#define CONFIG_AEMPHASIS_FILTER 0
-#define CONFIG_AEVAL_FILTER 0
-#define CONFIG_AFADE_FILTER 0
-#define CONFIG_AFFTFILT_FILTER 0
-#define CONFIG_AFORMAT_FILTER 0
-#define CONFIG_AGATE_FILTER 0
-#define CONFIG_AINTERLEAVE_FILTER 0
-#define CONFIG_ALIMITER_FILTER 0
-#define CONFIG_ALLPASS_FILTER 0
-#define CONFIG_ALOOP_FILTER 0
-#define CONFIG_AMERGE_FILTER 0
-#define CONFIG_AMETADATA_FILTER 0
-#define CONFIG_AMIX_FILTER 0
-#define CONFIG_ANEQUALIZER_FILTER 0
-#define CONFIG_ANULL_FILTER 0
-#define CONFIG_APAD_FILTER 0
-#define CONFIG_APERMS_FILTER 0
-#define CONFIG_APHASER_FILTER 0
-#define CONFIG_APULSATOR_FILTER 0
-#define CONFIG_AREALTIME_FILTER 0
-#define CONFIG_ARESAMPLE_FILTER 0
-#define CONFIG_AREVERSE_FILTER 0
-#define CONFIG_ASELECT_FILTER 0
-#define CONFIG_ASENDCMD_FILTER 0
-#define CONFIG_ASETNSAMPLES_FILTER 0
-#define CONFIG_ASETPTS_FILTER 0
-#define CONFIG_ASETRATE_FILTER 0
-#define CONFIG_ASETTB_FILTER 0
-#define CONFIG_ASHOWINFO_FILTER 0
-#define CONFIG_ASIDEDATA_FILTER 0
-#define CONFIG_ASPLIT_FILTER 0
-#define CONFIG_ASTATS_FILTER 0
-#define CONFIG_ASTREAMSELECT_FILTER 0
-#define CONFIG_ASYNCTS_FILTER 0
-#define CONFIG_ATEMPO_FILTER 0
-#define CONFIG_ATRIM_FILTER 0
-#define CONFIG_AZMQ_FILTER 0
-#define CONFIG_BANDPASS_FILTER 0
-#define CONFIG_BANDREJECT_FILTER 0
-#define CONFIG_BASS_FILTER 0
-#define CONFIG_BIQUAD_FILTER 0
-#define CONFIG_BS2B_FILTER 0
-#define CONFIG_CHANNELMAP_FILTER 0
-#define CONFIG_CHANNELSPLIT_FILTER 0
-#define CONFIG_CHORUS_FILTER 0
-#define CONFIG_COMPAND_FILTER 0
-#define CONFIG_COMPENSATIONDELAY_FILTER 0
-#define CONFIG_CRYSTALIZER_FILTER 0
-#define CONFIG_DCSHIFT_FILTER 0
-#define CONFIG_DYNAUDNORM_FILTER 0
-#define CONFIG_EARWAX_FILTER 0
-#define CONFIG_EBUR128_FILTER 0
-#define CONFIG_EQUALIZER_FILTER 0
-#define CONFIG_EXTRASTEREO_FILTER 0
-#define CONFIG_FIREQUALIZER_FILTER 0
-#define CONFIG_FLANGER_FILTER 0
-#define CONFIG_HDCD_FILTER 0
-#define CONFIG_HIGHPASS_FILTER 0
-#define CONFIG_JOIN_FILTER 0
-#define CONFIG_LADSPA_FILTER 0
-#define CONFIG_LOUDNORM_FILTER 0
-#define CONFIG_LOWPASS_FILTER 0
-#define CONFIG_PAN_FILTER 0
-#define CONFIG_REPLAYGAIN_FILTER 0
-#define CONFIG_RESAMPLE_FILTER 0
-#define CONFIG_RUBBERBAND_FILTER 0
-#define CONFIG_SIDECHAINCOMPRESS_FILTER 0
-#define CONFIG_SIDECHAINGATE_FILTER 0
-#define CONFIG_SILENCEDETECT_FILTER 0
-#define CONFIG_SILENCEREMOVE_FILTER 0
-#define CONFIG_SOFALIZER_FILTER 0
-#define CONFIG_STEREOTOOLS_FILTER 0
-#define CONFIG_STEREOWIDEN_FILTER 0
-#define CONFIG_TREBLE_FILTER 0
-#define CONFIG_TREMOLO_FILTER 0
-#define CONFIG_VIBRATO_FILTER 0
-#define CONFIG_VOLUME_FILTER 0
-#define CONFIG_VOLUMEDETECT_FILTER 0
-#define CONFIG_AEVALSRC_FILTER 0
-#define CONFIG_ANOISESRC_FILTER 0
-#define CONFIG_ANULLSRC_FILTER 0
-#define CONFIG_FLITE_FILTER 0
-#define CONFIG_SINE_FILTER 0
-#define CONFIG_ANULLSINK_FILTER 0
-#define CONFIG_ALPHAEXTRACT_FILTER 0
-#define CONFIG_ALPHAMERGE_FILTER 0
-#define CONFIG_ASS_FILTER 0
-#define CONFIG_ATADENOISE_FILTER 0
-#define CONFIG_AVGBLUR_FILTER 0
-#define CONFIG_BBOX_FILTER 0
-#define CONFIG_BENCH_FILTER 0
-#define CONFIG_BITPLANENOISE_FILTER 0
-#define CONFIG_BLACKDETECT_FILTER 0
-#define CONFIG_BLACKFRAME_FILTER 0
-#define CONFIG_BLEND_FILTER 0
-#define CONFIG_BOXBLUR_FILTER 0
-#define CONFIG_BWDIF_FILTER 0
-#define CONFIG_CHROMAKEY_FILTER 0
-#define CONFIG_CIESCOPE_FILTER 0
-#define CONFIG_CODECVIEW_FILTER 0
-#define CONFIG_COLORBALANCE_FILTER 0
-#define CONFIG_COLORCHANNELMIXER_FILTER 0
-#define CONFIG_COLORKEY_FILTER 0
-#define CONFIG_COLORLEVELS_FILTER 0
-#define CONFIG_COLORMATRIX_FILTER 0
-#define CONFIG_COLORSPACE_FILTER 0
-#define CONFIG_CONVOLUTION_FILTER 0
-#define CONFIG_COPY_FILTER 0
-#define CONFIG_COREIMAGE_FILTER 0
-#define CONFIG_COVER_RECT_FILTER 0
-#define CONFIG_CROP_FILTER 0
-#define CONFIG_CROPDETECT_FILTER 0
-#define CONFIG_CURVES_FILTER 0
-#define CONFIG_DATASCOPE_FILTER 0
-#define CONFIG_DCTDNOIZ_FILTER 0
-#define CONFIG_DEBAND_FILTER 0
-#define CONFIG_DECIMATE_FILTER 0
-#define CONFIG_DEFLATE_FILTER 0
-#define CONFIG_DEJUDDER_FILTER 0
-#define CONFIG_DELOGO_FILTER 0
-#define CONFIG_DESHAKE_FILTER 0
-#define CONFIG_DETELECINE_FILTER 0
-#define CONFIG_DILATION_FILTER 0
-#define CONFIG_DISPLACE_FILTER 0
-#define CONFIG_DRAWBOX_FILTER 0
-#define CONFIG_DRAWGRAPH_FILTER 0
-#define CONFIG_DRAWGRID_FILTER 0
-#define CONFIG_DRAWTEXT_FILTER 0
-#define CONFIG_EDGEDETECT_FILTER 0
-#define CONFIG_ELBG_FILTER 0
-#define CONFIG_EQ_FILTER 0
-#define CONFIG_EROSION_FILTER 0
-#define CONFIG_EXTRACTPLANES_FILTER 0
-#define CONFIG_FADE_FILTER 0
-#define CONFIG_FFTFILT_FILTER 0
-#define CONFIG_FIELD_FILTER 0
-#define CONFIG_FIELDHINT_FILTER 0
-#define CONFIG_FIELDMATCH_FILTER 0
-#define CONFIG_FIELDORDER_FILTER 0
-#define CONFIG_FIND_RECT_FILTER 0
-#define CONFIG_FORMAT_FILTER 0
-#define CONFIG_FPS_FILTER 0
-#define CONFIG_FRAMEPACK_FILTER 0
-#define CONFIG_FRAMERATE_FILTER 0
-#define CONFIG_FRAMESTEP_FILTER 0
-#define CONFIG_FREI0R_FILTER 0
-#define CONFIG_FSPP_FILTER 0
-#define CONFIG_GBLUR_FILTER 0
-#define CONFIG_GEQ_FILTER 0
-#define CONFIG_GRADFUN_FILTER 0
-#define CONFIG_HALDCLUT_FILTER 0
-#define CONFIG_HFLIP_FILTER 0
-#define CONFIG_HISTEQ_FILTER 0
-#define CONFIG_HISTOGRAM_FILTER 0
-#define CONFIG_HQDN3D_FILTER 0
-#define CONFIG_HQX_FILTER 0
-#define CONFIG_HSTACK_FILTER 0
-#define CONFIG_HUE_FILTER 0
-#define CONFIG_HWDOWNLOAD_FILTER 0
-#define CONFIG_HWUPLOAD_FILTER 0
-#define CONFIG_HWUPLOAD_CUDA_FILTER 0
-#define CONFIG_HYSTERESIS_FILTER 0
-#define CONFIG_IDET_FILTER 0
-#define CONFIG_IL_FILTER 0
-#define CONFIG_INFLATE_FILTER 0
-#define CONFIG_INTERLACE_FILTER 0
-#define CONFIG_INTERLEAVE_FILTER 0
-#define CONFIG_KERNDEINT_FILTER 0
-#define CONFIG_LENSCORRECTION_FILTER 0
-#define CONFIG_LOOP_FILTER 0
-#define CONFIG_LUT_FILTER 0
-#define CONFIG_LUT2_FILTER 0
-#define CONFIG_LUT3D_FILTER 0
-#define CONFIG_LUTRGB_FILTER 0
-#define CONFIG_LUTYUV_FILTER 0
-#define CONFIG_MASKEDCLAMP_FILTER 0
-#define CONFIG_MASKEDMERGE_FILTER 0
-#define CONFIG_MCDEINT_FILTER 0
-#define CONFIG_MERGEPLANES_FILTER 0
-#define CONFIG_MESTIMATE_FILTER 0
-#define CONFIG_METADATA_FILTER 0
-#define CONFIG_MINTERPOLATE_FILTER 0
-#define CONFIG_MPDECIMATE_FILTER 0
-#define CONFIG_NEGATE_FILTER 0
-#define CONFIG_NLMEANS_FILTER 0
-#define CONFIG_NNEDI_FILTER 0
-#define CONFIG_NOFORMAT_FILTER 0
-#define CONFIG_NOISE_FILTER 0
-#define CONFIG_NULL_FILTER 0
-#define CONFIG_OCR_FILTER 0
-#define CONFIG_OCV_FILTER 0
-#define CONFIG_OVERLAY_FILTER 0
-#define CONFIG_OWDENOISE_FILTER 0
-#define CONFIG_PAD_FILTER 0
-#define CONFIG_PALETTEGEN_FILTER 0
-#define CONFIG_PALETTEUSE_FILTER 0
-#define CONFIG_PERMS_FILTER 0
-#define CONFIG_PERSPECTIVE_FILTER 0
-#define CONFIG_PHASE_FILTER 0
-#define CONFIG_PIXDESCTEST_FILTER 0
-#define CONFIG_PP_FILTER 0
-#define CONFIG_PP7_FILTER 0
-#define CONFIG_PREWITT_FILTER 0
-#define CONFIG_PSNR_FILTER 0
-#define CONFIG_PULLUP_FILTER 0
-#define CONFIG_QP_FILTER 0
-#define CONFIG_RANDOM_FILTER 0
-#define CONFIG_READVITC_FILTER 0
-#define CONFIG_REALTIME_FILTER 0
-#define CONFIG_REMAP_FILTER 0
-#define CONFIG_REMOVEGRAIN_FILTER 0
-#define CONFIG_REMOVELOGO_FILTER 0
-#define CONFIG_REPEATFIELDS_FILTER 0
-#define CONFIG_REVERSE_FILTER 0
-#define CONFIG_ROTATE_FILTER 0
-#define CONFIG_SAB_FILTER 0
-#define CONFIG_SCALE_FILTER 0
-#define CONFIG_SCALE_NPP_FILTER 0
-#define CONFIG_SCALE_VAAPI_FILTER 0
-#define CONFIG_SCALE2REF_FILTER 0
-#define CONFIG_SELECT_FILTER 0
-#define CONFIG_SELECTIVECOLOR_FILTER 0
-#define CONFIG_SENDCMD_FILTER 0
-#define CONFIG_SEPARATEFIELDS_FILTER 0
-#define CONFIG_SETDAR_FILTER 0
-#define CONFIG_SETFIELD_FILTER 0
-#define CONFIG_SETPTS_FILTER 0
-#define CONFIG_SETSAR_FILTER 0
-#define CONFIG_SETTB_FILTER 0
-#define CONFIG_SHOWINFO_FILTER 0
-#define CONFIG_SHOWPALETTE_FILTER 0
-#define CONFIG_SHUFFLEFRAMES_FILTER 0
-#define CONFIG_SHUFFLEPLANES_FILTER 0
-#define CONFIG_SIDEDATA_FILTER 0
-#define CONFIG_SIGNALSTATS_FILTER 0
-#define CONFIG_SMARTBLUR_FILTER 0
-#define CONFIG_SOBEL_FILTER 0
-#define CONFIG_SPLIT_FILTER 0
-#define CONFIG_SPP_FILTER 0
-#define CONFIG_SSIM_FILTER 0
-#define CONFIG_STEREO3D_FILTER 0
-#define CONFIG_STREAMSELECT_FILTER 0
-#define CONFIG_SUBTITLES_FILTER 0
-#define CONFIG_SUPER2XSAI_FILTER 0
-#define CONFIG_SWAPRECT_FILTER 0
-#define CONFIG_SWAPUV_FILTER 0
-#define CONFIG_TBLEND_FILTER 0
-#define CONFIG_TELECINE_FILTER 0
-#define CONFIG_THUMBNAIL_FILTER 0
-#define CONFIG_TILE_FILTER 0
-#define CONFIG_TINTERLACE_FILTER 0
-#define CONFIG_TRANSPOSE_FILTER 0
-#define CONFIG_TRIM_FILTER 0
-#define CONFIG_UNSHARP_FILTER 0
-#define CONFIG_USPP_FILTER 0
-#define CONFIG_VAGUEDENOISER_FILTER 0
-#define CONFIG_VECTORSCOPE_FILTER 0
-#define CONFIG_VFLIP_FILTER 0
-#define CONFIG_VIDSTABDETECT_FILTER 0
-#define CONFIG_VIDSTABTRANSFORM_FILTER 0
-#define CONFIG_VIGNETTE_FILTER 0
-#define CONFIG_VSTACK_FILTER 0
-#define CONFIG_W3FDIF_FILTER 0
-#define CONFIG_WAVEFORM_FILTER 0
-#define CONFIG_WEAVE_FILTER 0
-#define CONFIG_XBR_FILTER 0
-#define CONFIG_YADIF_FILTER 0
-#define CONFIG_ZMQ_FILTER 0
-#define CONFIG_ZOOMPAN_FILTER 0
-#define CONFIG_ZSCALE_FILTER 0
-#define CONFIG_ALLRGB_FILTER 0
-#define CONFIG_ALLYUV_FILTER 0
-#define CONFIG_CELLAUTO_FILTER 0
-#define CONFIG_COLOR_FILTER 0
-#define CONFIG_COREIMAGESRC_FILTER 0
-#define CONFIG_FREI0R_SRC_FILTER 0
-#define CONFIG_HALDCLUTSRC_FILTER 0
-#define CONFIG_LIFE_FILTER 0
-#define CONFIG_MANDELBROT_FILTER 0
-#define CONFIG_MPTESTSRC_FILTER 0
-#define CONFIG_NULLSRC_FILTER 0
-#define CONFIG_RGBTESTSRC_FILTER 0
-#define CONFIG_SMPTEBARS_FILTER 0
-#define CONFIG_SMPTEHDBARS_FILTER 0
-#define CONFIG_TESTSRC_FILTER 0
-#define CONFIG_TESTSRC2_FILTER 0
-#define CONFIG_YUVTESTSRC_FILTER 0
-#define CONFIG_NULLSINK_FILTER 0
-#define CONFIG_ADRAWGRAPH_FILTER 0
-#define CONFIG_AHISTOGRAM_FILTER 0
-#define CONFIG_APHASEMETER_FILTER 0
-#define CONFIG_AVECTORSCOPE_FILTER 0
-#define CONFIG_CONCAT_FILTER 0
-#define CONFIG_SHOWCQT_FILTER 0
-#define CONFIG_SHOWFREQS_FILTER 0
-#define CONFIG_SHOWSPECTRUM_FILTER 0
-#define CONFIG_SHOWSPECTRUMPIC_FILTER 0
-#define CONFIG_SHOWVOLUME_FILTER 0
-#define CONFIG_SHOWWAVES_FILTER 0
-#define CONFIG_SHOWWAVESPIC_FILTER 0
-#define CONFIG_SPECTRUMSYNTH_FILTER 0
-#define CONFIG_AMOVIE_FILTER 0
-#define CONFIG_MOVIE_FILTER 0
-#define CONFIG_H263_CUVID_HWACCEL 0
-#define CONFIG_H263_VAAPI_HWACCEL 0
-#define CONFIG_H263_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_H264_CUVID_HWACCEL 0
-#define CONFIG_H264_D3D11VA_HWACCEL 0
-#define CONFIG_H264_DXVA2_HWACCEL 0
-#define CONFIG_H264_MEDIACODEC_HWACCEL 0
-#define CONFIG_H264_MMAL_HWACCEL 0
-#define CONFIG_H264_QSV_HWACCEL 0
-#define CONFIG_H264_VAAPI_HWACCEL 0
-#define CONFIG_H264_VDA_HWACCEL 0
-#define CONFIG_H264_VDA_OLD_HWACCEL 0
-#define CONFIG_H264_VDPAU_HWACCEL 0
-#define CONFIG_H264_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_HEVC_CUVID_HWACCEL 0
-#define CONFIG_HEVC_D3D11VA_HWACCEL 0
-#define CONFIG_HEVC_DXVA2_HWACCEL 0
-#define CONFIG_HEVC_MEDIACODEC_HWACCEL 0
-#define CONFIG_HEVC_QSV_HWACCEL 0
-#define CONFIG_HEVC_VAAPI_HWACCEL 0
-#define CONFIG_HEVC_VDPAU_HWACCEL 0
-#define CONFIG_MJPEG_CUVID_HWACCEL 0
-#define CONFIG_MPEG1_CUVID_HWACCEL 0
-#define CONFIG_MPEG1_XVMC_HWACCEL 0
-#define CONFIG_MPEG1_VDPAU_HWACCEL 0
-#define CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_MPEG2_CUVID_HWACCEL 0
-#define CONFIG_MPEG2_XVMC_HWACCEL 0
-#define CONFIG_MPEG2_D3D11VA_HWACCEL 0
-#define CONFIG_MPEG2_DXVA2_HWACCEL 0
-#define CONFIG_MPEG2_MMAL_HWACCEL 0
-#define CONFIG_MPEG2_QSV_HWACCEL 0
-#define CONFIG_MPEG2_VAAPI_HWACCEL 0
-#define CONFIG_MPEG2_VDPAU_HWACCEL 0
-#define CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_MPEG4_CUVID_HWACCEL 0
-#define CONFIG_MPEG4_MEDIACODEC_HWACCEL 0
-#define CONFIG_MPEG4_MMAL_HWACCEL 0
-#define CONFIG_MPEG4_VAAPI_HWACCEL 0
-#define CONFIG_MPEG4_VDPAU_HWACCEL 0
-#define CONFIG_MPEG4_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_VC1_CUVID_HWACCEL 0
-#define CONFIG_VC1_D3D11VA_HWACCEL 0
-#define CONFIG_VC1_DXVA2_HWACCEL 0
-#define CONFIG_VC1_VAAPI_HWACCEL 0
-#define CONFIG_VC1_VDPAU_HWACCEL 0
-#define CONFIG_VC1_MMAL_HWACCEL 0
-#define CONFIG_VC1_QSV_HWACCEL 0
-#define CONFIG_VP8_CUVID_HWACCEL 0
-#define CONFIG_VP8_MEDIACODEC_HWACCEL 0
-#define CONFIG_VP9_CUVID_HWACCEL 0
-#define CONFIG_VP9_D3D11VA_HWACCEL 0
-#define CONFIG_VP9_DXVA2_HWACCEL 0
-#define CONFIG_VP9_MEDIACODEC_HWACCEL 0
-#define CONFIG_VP9_VAAPI_HWACCEL 0
-#define CONFIG_WMV3_D3D11VA_HWACCEL 0
-#define CONFIG_WMV3_DXVA2_HWACCEL 0
-#define CONFIG_WMV3_VAAPI_HWACCEL 0
-#define CONFIG_WMV3_VDPAU_HWACCEL 0
-#define CONFIG_ALSA_INDEV 0
-#define CONFIG_AVFOUNDATION_INDEV 0
-#define CONFIG_BKTR_INDEV 0
-#define CONFIG_DECKLINK_INDEV 0
-#define CONFIG_DSHOW_INDEV 0
-#define CONFIG_DV1394_INDEV 0
-#define CONFIG_FBDEV_INDEV 0
-#define CONFIG_GDIGRAB_INDEV 0
-#define CONFIG_IEC61883_INDEV 0
-#define CONFIG_JACK_INDEV 0
-#define CONFIG_LAVFI_INDEV 0
-#define CONFIG_OPENAL_INDEV 0
-#define CONFIG_OSS_INDEV 0
-#define CONFIG_PULSE_INDEV 0
-#define CONFIG_QTKIT_INDEV 0
-#define CONFIG_SNDIO_INDEV 0
-#define CONFIG_V4L2_INDEV 0
-#define CONFIG_VFWCAP_INDEV 0
-#define CONFIG_X11GRAB_INDEV 0
-#define CONFIG_X11GRAB_XCB_INDEV 0
-#define CONFIG_LIBCDIO_INDEV 0
-#define CONFIG_LIBDC1394_INDEV 0
-#define CONFIG_A64_MUXER 0
-#define CONFIG_AC3_MUXER 0
-#define CONFIG_ADTS_MUXER 0
-#define CONFIG_ADX_MUXER 0
-#define CONFIG_AIFF_MUXER 0
-#define CONFIG_AMR_MUXER 0
-#define CONFIG_APNG_MUXER 0
-#define CONFIG_ASF_MUXER 0
-#define CONFIG_ASS_MUXER 0
-#define CONFIG_AST_MUXER 0
-#define CONFIG_ASF_STREAM_MUXER 0
-#define CONFIG_AU_MUXER 0
-#define CONFIG_AVI_MUXER 0
-#define CONFIG_AVM2_MUXER 0
-#define CONFIG_BIT_MUXER 0
-#define CONFIG_CAF_MUXER 0
-#define CONFIG_CAVSVIDEO_MUXER 0
-#define CONFIG_CRC_MUXER 0
-#define CONFIG_DASH_MUXER 0
-#define CONFIG_DATA_MUXER 0
-#define CONFIG_DAUD_MUXER 0
-#define CONFIG_DIRAC_MUXER 0
-#define CONFIG_DNXHD_MUXER 0
-#define CONFIG_DTS_MUXER 0
-#define CONFIG_DV_MUXER 0
-#define CONFIG_EAC3_MUXER 0
-#define CONFIG_F4V_MUXER 0
-#define CONFIG_FFM_MUXER 0
-#define CONFIG_FFMETADATA_MUXER 0
-#define CONFIG_FIFO_MUXER 0
-#define CONFIG_FILMSTRIP_MUXER 0
-#define CONFIG_FLAC_MUXER 0
-#define CONFIG_FLV_MUXER 0
-#define CONFIG_FRAMECRC_MUXER 0
-#define CONFIG_FRAMEHASH_MUXER 0
-#define CONFIG_FRAMEMD5_MUXER 0
-#define CONFIG_G722_MUXER 0
-#define CONFIG_G723_1_MUXER 0
-#define CONFIG_GIF_MUXER 0
-#define CONFIG_GSM_MUXER 0
-#define CONFIG_GXF_MUXER 0
-#define CONFIG_H261_MUXER 0
-#define CONFIG_H263_MUXER 0
-#define CONFIG_H264_MUXER 0
-#define CONFIG_HASH_MUXER 0
-#define CONFIG_HDS_MUXER 0
-#define CONFIG_HEVC_MUXER 0
-#define CONFIG_HLS_MUXER 0
-#define CONFIG_ICO_MUXER 0
-#define CONFIG_ILBC_MUXER 0
-#define CONFIG_IMAGE2_MUXER 0
-#define CONFIG_IMAGE2PIPE_MUXER 0
-#define CONFIG_IPOD_MUXER 0
-#define CONFIG_IRCAM_MUXER 0
-#define CONFIG_ISMV_MUXER 0
-#define CONFIG_IVF_MUXER 0
-#define CONFIG_JACOSUB_MUXER 0
-#define CONFIG_LATM_MUXER 0
-#define CONFIG_LRC_MUXER 0
-#define CONFIG_M4V_MUXER 0
-#define CONFIG_MD5_MUXER 0
-#define CONFIG_MATROSKA_MUXER 0
-#define CONFIG_MATROSKA_AUDIO_MUXER 0
-#define CONFIG_MICRODVD_MUXER 0
-#define CONFIG_MJPEG_MUXER 0
-#define CONFIG_MLP_MUXER 0
-#define CONFIG_MMF_MUXER 0
-#define CONFIG_MOV_MUXER 0
-#define CONFIG_MP2_MUXER 0
-#define CONFIG_MP3_MUXER 0
-#define CONFIG_MP4_MUXER 0
-#define CONFIG_MPEG1SYSTEM_MUXER 0
-#define CONFIG_MPEG1VCD_MUXER 0
-#define CONFIG_MPEG1VIDEO_MUXER 0
-#define CONFIG_MPEG2DVD_MUXER 0
-#define CONFIG_MPEG2SVCD_MUXER 0
-#define CONFIG_MPEG2VIDEO_MUXER 0
-#define CONFIG_MPEG2VOB_MUXER 0
-#define CONFIG_MPEGTS_MUXER 0
-#define CONFIG_MPJPEG_MUXER 0
-#define CONFIG_MXF_MUXER 0
-#define CONFIG_MXF_D10_MUXER 0
-#define CONFIG_MXF_OPATOM_MUXER 0
-#define CONFIG_NULL_MUXER 0
-#define CONFIG_NUT_MUXER 0
-#define CONFIG_OGA_MUXER 0
-#define CONFIG_OGG_MUXER 0
-#define CONFIG_OGV_MUXER 0
-#define CONFIG_OMA_MUXER 0
-#define CONFIG_OPUS_MUXER 0
-#define CONFIG_PCM_ALAW_MUXER 0
-#define CONFIG_PCM_MULAW_MUXER 0
-#define CONFIG_PCM_F64BE_MUXER 0
-#define CONFIG_PCM_F64LE_MUXER 0
-#define CONFIG_PCM_F32BE_MUXER 0
-#define CONFIG_PCM_F32LE_MUXER 0
-#define CONFIG_PCM_S32BE_MUXER 0
-#define CONFIG_PCM_S32LE_MUXER 0
-#define CONFIG_PCM_S24BE_MUXER 0
-#define CONFIG_PCM_S24LE_MUXER 0
-#define CONFIG_PCM_S16BE_MUXER 0
-#define CONFIG_PCM_S16LE_MUXER 0
-#define CONFIG_PCM_S8_MUXER 0
-#define CONFIG_PCM_U32BE_MUXER 0
-#define CONFIG_PCM_U32LE_MUXER 0
-#define CONFIG_PCM_U24BE_MUXER 0
-#define CONFIG_PCM_U24LE_MUXER 0
-#define CONFIG_PCM_U16BE_MUXER 0
-#define CONFIG_PCM_U16LE_MUXER 0
-#define CONFIG_PCM_U8_MUXER 0
-#define CONFIG_PSP_MUXER 0
-#define CONFIG_RAWVIDEO_MUXER 0
-#define CONFIG_RM_MUXER 0
-#define CONFIG_ROQ_MUXER 0
-#define CONFIG_RSO_MUXER 0
-#define CONFIG_RTP_MUXER 0
-#define CONFIG_RTP_MPEGTS_MUXER 0
-#define CONFIG_RTSP_MUXER 0
-#define CONFIG_SAP_MUXER 0
-#define CONFIG_SEGMENT_MUXER 0
-#define CONFIG_STREAM_SEGMENT_MUXER 0
-#define CONFIG_SINGLEJPEG_MUXER 0
-#define CONFIG_SMJPEG_MUXER 0
-#define CONFIG_SMOOTHSTREAMING_MUXER 0
-#define CONFIG_SOX_MUXER 0
-#define CONFIG_SPX_MUXER 0
-#define CONFIG_SPDIF_MUXER 0
-#define CONFIG_SRT_MUXER 0
-#define CONFIG_SWF_MUXER 0
-#define CONFIG_TEE_MUXER 0
-#define CONFIG_TG2_MUXER 0
-#define CONFIG_TGP_MUXER 0
-#define CONFIG_MKVTIMESTAMP_V2_MUXER 0
-#define CONFIG_TRUEHD_MUXER 0
-#define CONFIG_TTA_MUXER 0
-#define CONFIG_UNCODEDFRAMECRC_MUXER 0
-#define CONFIG_VC1_MUXER 0
-#define CONFIG_VC1T_MUXER 0
-#define CONFIG_VOC_MUXER 0
-#define CONFIG_W64_MUXER 0
-#define CONFIG_WAV_MUXER 0
-#define CONFIG_WEBM_MUXER 0
-#define CONFIG_WEBM_DASH_MANIFEST_MUXER 0
-#define CONFIG_WEBM_CHUNK_MUXER 0
-#define CONFIG_WEBP_MUXER 0
-#define CONFIG_WEBVTT_MUXER 0
-#define CONFIG_WTV_MUXER 0
-#define CONFIG_WV_MUXER 0
-#define CONFIG_YUV4MPEGPIPE_MUXER 0
-#define CONFIG_CHROMAPRINT_MUXER 0
-#define CONFIG_LIBNUT_MUXER 0
-#define CONFIG_ALSA_OUTDEV 0
-#define CONFIG_CACA_OUTDEV 0
-#define CONFIG_DECKLINK_OUTDEV 0
-#define CONFIG_FBDEV_OUTDEV 0
-#define CONFIG_OPENGL_OUTDEV 0
-#define CONFIG_OSS_OUTDEV 0
-#define CONFIG_PULSE_OUTDEV 0
-#define CONFIG_SDL2_OUTDEV 0
-#define CONFIG_SNDIO_OUTDEV 0
-#define CONFIG_V4L2_OUTDEV 0
-#define CONFIG_XV_OUTDEV 0
-#define CONFIG_AAC_PARSER 0
-#define CONFIG_AAC_LATM_PARSER 0
-#define CONFIG_AC3_PARSER 0
-#define CONFIG_ADX_PARSER 0
-#define CONFIG_BMP_PARSER 0
-#define CONFIG_CAVSVIDEO_PARSER 0
-#define CONFIG_COOK_PARSER 0
-#define CONFIG_DCA_PARSER 0
-#define CONFIG_DIRAC_PARSER 0
-#define CONFIG_DNXHD_PARSER 0
-#define CONFIG_DPX_PARSER 0
-#define CONFIG_DVAUDIO_PARSER 0
-#define CONFIG_DVBSUB_PARSER 0
-#define CONFIG_DVDSUB_PARSER 0
-#define CONFIG_DVD_NAV_PARSER 0
-#define CONFIG_FLAC_PARSER 1
-#define CONFIG_G729_PARSER 0
-#define CONFIG_GSM_PARSER 0
-#define CONFIG_H261_PARSER 0
-#define CONFIG_H263_PARSER 0
-#define CONFIG_H264_PARSER 0
-#define CONFIG_HEVC_PARSER 0
-#define CONFIG_MJPEG_PARSER 0
-#define CONFIG_MLP_PARSER 0
-#define CONFIG_MPEG4VIDEO_PARSER 0
-#define CONFIG_MPEGAUDIO_PARSER 0
-#define CONFIG_MPEGVIDEO_PARSER 0
-#define CONFIG_OPUS_PARSER 0
-#define CONFIG_PNG_PARSER 0
-#define CONFIG_PNM_PARSER 0
-#define CONFIG_RV30_PARSER 0
-#define CONFIG_RV40_PARSER 0
-#define CONFIG_TAK_PARSER 0
-#define CONFIG_VC1_PARSER 0
-#define CONFIG_VORBIS_PARSER 0
-#define CONFIG_VP3_PARSER 0
+#define CONFIG_FLAC_PARSER 0
#define CONFIG_VP8_PARSER 1
#define CONFIG_VP9_PARSER 1
-#define CONFIG_ASYNC_PROTOCOL 0
-#define CONFIG_BLURAY_PROTOCOL 0
-#define CONFIG_CACHE_PROTOCOL 0
-#define CONFIG_CONCAT_PROTOCOL 0
-#define CONFIG_CRYPTO_PROTOCOL 0
-#define CONFIG_DATA_PROTOCOL 0
-#define CONFIG_FFRTMPCRYPT_PROTOCOL 0
-#define CONFIG_FFRTMPHTTP_PROTOCOL 0
-#define CONFIG_FILE_PROTOCOL 0
-#define CONFIG_FTP_PROTOCOL 0
-#define CONFIG_GOPHER_PROTOCOL 0
-#define CONFIG_HLS_PROTOCOL 0
-#define CONFIG_HTTP_PROTOCOL 0
-#define CONFIG_HTTPPROXY_PROTOCOL 0
-#define CONFIG_HTTPS_PROTOCOL 0
-#define CONFIG_ICECAST_PROTOCOL 0
-#define CONFIG_MMSH_PROTOCOL 0
-#define CONFIG_MMST_PROTOCOL 0
-#define CONFIG_MD5_PROTOCOL 0
-#define CONFIG_PIPE_PROTOCOL 0
-#define CONFIG_RTMP_PROTOCOL 0
-#define CONFIG_RTMPE_PROTOCOL 0
-#define CONFIG_RTMPS_PROTOCOL 0
-#define CONFIG_RTMPT_PROTOCOL 0
-#define CONFIG_RTMPTE_PROTOCOL 0
-#define CONFIG_RTMPTS_PROTOCOL 0
-#define CONFIG_RTP_PROTOCOL 0
-#define CONFIG_SCTP_PROTOCOL 0
-#define CONFIG_SRTP_PROTOCOL 0
-#define CONFIG_SUBFILE_PROTOCOL 0
-#define CONFIG_TEE_PROTOCOL 0
-#define CONFIG_TCP_PROTOCOL 0
-#define CONFIG_TLS_GNUTLS_PROTOCOL 0
-#define CONFIG_TLS_SCHANNEL_PROTOCOL 0
-#define CONFIG_TLS_SECURETRANSPORT_PROTOCOL 0
-#define CONFIG_TLS_OPENSSL_PROTOCOL 0
-#define CONFIG_UDP_PROTOCOL 0
-#define CONFIG_UDPLITE_PROTOCOL 0
-#define CONFIG_UNIX_PROTOCOL 0
-#define CONFIG_LIBRTMP_PROTOCOL 0
-#define CONFIG_LIBRTMPE_PROTOCOL 0
-#define CONFIG_LIBRTMPS_PROTOCOL 0
-#define CONFIG_LIBRTMPT_PROTOCOL 0
-#define CONFIG_LIBRTMPTE_PROTOCOL 0
-#define CONFIG_LIBSSH_PROTOCOL 0
-#define CONFIG_LIBSMBCLIENT_PROTOCOL 0
#endif /* FFMPEG_CONFIG_H */
diff --git a/media/ffvpx/config_unix64.asm b/media/ffvpx/config_unix64.asm
index 61cfce6a6f..beb7f3b027 100644
--- a/media/ffvpx/config_unix64.asm
+++ b/media/ffvpx/config_unix64.asm
@@ -40,7 +40,7 @@
%define HAVE_AMD3DNOW 1
%define HAVE_AMD3DNOWEXT 1
%define HAVE_AVX 1
-%define HAVE_AVX2 0
+%define HAVE_AVX2 1
%define HAVE_FMA3 1
%define HAVE_FMA4 1
%define HAVE_MMX 1
@@ -63,8 +63,8 @@
%define HAVE_MIPSDSP 0
%define HAVE_MIPSDSPR2 0
%define HAVE_MSA 0
-%define HAVE_LOONGSON2 1
-%define HAVE_LOONGSON3 1
+%define HAVE_LOONGSON2 0
+%define HAVE_LOONGSON3 0
%define HAVE_MMI 0
%define HAVE_ARMV5TE_EXTERNAL 0
%define HAVE_ARMV6_EXTERNAL 0
@@ -84,7 +84,7 @@
%define HAVE_AMD3DNOW_EXTERNAL 1
%define HAVE_AMD3DNOWEXT_EXTERNAL 1
%define HAVE_AVX_EXTERNAL 1
-%define HAVE_AVX2_EXTERNAL 0
+%define HAVE_AVX2_EXTERNAL 1
%define HAVE_FMA3_EXTERNAL 1
%define HAVE_FMA4_EXTERNAL 1
%define HAVE_MMX_EXTERNAL 1
@@ -128,7 +128,7 @@
%define HAVE_AMD3DNOW_INLINE 1
%define HAVE_AMD3DNOWEXT_INLINE 1
%define HAVE_AVX_INLINE 1
-%define HAVE_AVX2_INLINE 0
+%define HAVE_AVX2_INLINE 1
%define HAVE_FMA3_INLINE 1
%define HAVE_FMA4_INLINE 1
%define HAVE_MMX_INLINE 1
@@ -162,11 +162,11 @@
%define HAVE_LOCAL_ALIGNED_16 1
%define HAVE_LOCAL_ALIGNED_32 1
%define HAVE_SIMD_ALIGN_16 1
+%define HAVE_SIMD_ALIGN_32 1
%define HAVE_ATOMICS_GCC 1
%define HAVE_ATOMICS_SUNCC 0
%define HAVE_ATOMICS_WIN32 0
%define HAVE_ATOMIC_CAS_PTR 0
-%define HAVE_ATOMIC_COMPARE_EXCHANGE 0
%define HAVE_MACHINE_RW_BARRIER 0
%define HAVE_MEMORYBARRIER 0
%define HAVE_MM_EMPTY 1
@@ -178,15 +178,16 @@
%define HAVE_CEXP 1
%define HAVE_INLINE_ASM 1
%define HAVE_SYMVER 1
-%define HAVE_YASM 1
+%define HAVE_X86ASM 1
%define HAVE_BIGENDIAN 0
%define HAVE_FAST_UNALIGNED 1
-%define HAVE_ALSA_ASOUNDLIB_H 0
%define HAVE_ALTIVEC_H 0
%define HAVE_ARPA_INET_H 1
%define HAVE_ASM_TYPES_H 1
%define HAVE_CDIO_PARANOIA_H 0
%define HAVE_CDIO_PARANOIA_PARANOIA_H 0
+%define HAVE_CUDA_H 0
+%define HAVE_D3D11_H 0
%define HAVE_DISPATCH_DISPATCH_H 0
%define HAVE_DEV_BKTR_IOCTL_BT848_H 0
%define HAVE_DEV_BKTR_IOCTL_METEOR_H 0
@@ -196,7 +197,7 @@
%define HAVE_DIRECT_H 0
%define HAVE_DIRENT_H 1
%define HAVE_DLFCN_H 1
-%define HAVE_D3D11_H 0
+%define HAVE_DXGIDEBUG_H 0
%define HAVE_DXVA_H 0
%define HAVE_ES2_GL_H 0
%define HAVE_GSM_H 0
@@ -205,13 +206,15 @@
%define HAVE_MACHINE_IOCTL_BT848_H 0
%define HAVE_MACHINE_IOCTL_METEOR_H 0
%define HAVE_OPENCV2_CORE_CORE_C_H 0
+%define HAVE_OPENJPEG_2_3_OPENJPEG_H 0
+%define HAVE_OPENJPEG_2_2_OPENJPEG_H 0
%define HAVE_OPENJPEG_2_1_OPENJPEG_H 0
%define HAVE_OPENJPEG_2_0_OPENJPEG_H 0
%define HAVE_OPENJPEG_1_5_OPENJPEG_H 0
%define HAVE_OPENGL_GL3_H 0
%define HAVE_POLL_H 1
-%define HAVE_SNDIO_H 0
%define HAVE_SOUNDCARD_H 0
+%define HAVE_STDATOMIC_H 1
%define HAVE_SYS_MMAN_H 1
%define HAVE_SYS_PARAM_H 1
%define HAVE_SYS_RESOURCE_H 1
@@ -263,7 +266,6 @@
%define HAVE_COMMANDLINETOARGVW 0
%define HAVE_COTASKMEMFREE 0
%define HAVE_CRYPTGENRANDOM 0
-%define HAVE_DLOPEN 1
%define HAVE_FCNTL 1
%define HAVE_FLT_LIM 1
%define HAVE_FORK 1
@@ -311,11 +313,13 @@
%define HAVE_OS2THREADS 0
%define HAVE_W32THREADS 0
%define HAVE_AS_DN_DIRECTIVE 0
+%define HAVE_AS_FPU_DIRECTIVE 0
%define HAVE_AS_FUNC 0
%define HAVE_AS_OBJECT_ARCH 0
%define HAVE_ASM_MOD_Q 0
%define HAVE_ATTRIBUTE_MAY_ALIAS 1
%define HAVE_ATTRIBUTE_PACKED 1
+%define HAVE_BLOCKS_EXTENSION 0
%define HAVE_EBP_AVAILABLE 1
%define HAVE_EBX_AVAILABLE 1
%define HAVE_GNU_AS 0
@@ -332,6 +336,7 @@
%define HAVE_XFORM_ASM 0
%define HAVE_XMM_CLOBBERS 1
%define HAVE_CONDITION_VARIABLE_PTR 0
+%define HAVE_KCMVIDEOCODECTYPE_HEVC 0
%define HAVE_SOCKLEN_T 1
%define HAVE_STRUCT_ADDRINFO 1
%define HAVE_STRUCT_GROUP_SOURCE_REQ 1
@@ -348,36 +353,20 @@
%define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 1
%define HAVE_ATOMICS_NATIVE 1
%define HAVE_DOS_PATHS 0
-%define HAVE_DXVA2_LIB 0
-%define HAVE_DXVA2API_COBJ 0
%define HAVE_LIBC_MSVCRT 0
-%define HAVE_LIBDC1394_1 0
-%define HAVE_LIBDC1394_2 0
%define HAVE_MAKEINFO 0
%define HAVE_MAKEINFO_HTML 0
%define HAVE_MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS 0
%define HAVE_PERL 1
%define HAVE_POD2MAN 1
-%define HAVE_SDL2 0
%define HAVE_SECTION_DATA_REL_RO 1
%define HAVE_TEXI2HTML 0
%define HAVE_THREADS 1
+%define HAVE_UWP 0
%define HAVE_VAAPI_DRM 0
%define HAVE_VAAPI_X11 0
%define HAVE_VDPAU_X11 0
%define HAVE_WINRT 0
-%define HAVE_XLIB 0
-%define CONFIG_BSFS 0
-%define CONFIG_DECODERS 1
-%define CONFIG_ENCODERS 0
-%define CONFIG_HWACCELS 0
-%define CONFIG_PARSERS 1
-%define CONFIG_INDEVS 0
-%define CONFIG_OUTDEVS 0
-%define CONFIG_FILTERS 0
-%define CONFIG_DEMUXERS 0
-%define CONFIG_MUXERS 0
-%define CONFIG_PROTOCOLS 0
%define CONFIG_DOC 0
%define CONFIG_HTMLPAGES 0
%define CONFIG_MANPAGES 1
@@ -385,13 +374,17 @@
%define CONFIG_TXTPAGES 0
%define CONFIG_AVIO_DIR_CMD_EXAMPLE 1
%define CONFIG_AVIO_READING_EXAMPLE 1
-%define CONFIG_DECODING_ENCODING_EXAMPLE 0
+%define CONFIG_DECODE_AUDIO_EXAMPLE 1
+%define CONFIG_DECODE_VIDEO_EXAMPLE 1
%define CONFIG_DEMUXING_DECODING_EXAMPLE 0
+%define CONFIG_ENCODE_AUDIO_EXAMPLE 1
+%define CONFIG_ENCODE_VIDEO_EXAMPLE 1
%define CONFIG_EXTRACT_MVS_EXAMPLE 0
%define CONFIG_FILTER_AUDIO_EXAMPLE 0
%define CONFIG_FILTERING_AUDIO_EXAMPLE 0
%define CONFIG_FILTERING_VIDEO_EXAMPLE 0
%define CONFIG_HTTP_MULTICLIENT_EXAMPLE 0
+%define CONFIG_HW_DECODE_EXAMPLE 0
%define CONFIG_METADATA_EXAMPLE 0
%define CONFIG_MUXING_EXAMPLE 0
%define CONFIG_QSVDEC_EXAMPLE 0
@@ -400,27 +393,55 @@
%define CONFIG_SCALING_VIDEO_EXAMPLE 0
%define CONFIG_TRANSCODE_AAC_EXAMPLE 0
%define CONFIG_TRANSCODING_EXAMPLE 0
-%define CONFIG_AVISYNTH 0
+%define CONFIG_ALSA 1
+%define CONFIG_APPKIT 0
+%define CONFIG_AVFOUNDATION 0
%define CONFIG_BZLIB 0
-%define CONFIG_CHROMAPRINT 0
-%define CONFIG_CRYSTALHD 0
-%define CONFIG_DECKLINK 0
+%define CONFIG_COREIMAGE 0
+%define CONFIG_ICONV 0
+%define CONFIG_JACK 0
+%define CONFIG_LIBXCB 0
+%define CONFIG_LIBXCB_SHM 0
+%define CONFIG_LIBXCB_SHAPE 0
+%define CONFIG_LIBXCB_XFIXES 0
+%define CONFIG_LZMA 1
+%define CONFIG_SCHANNEL 0
+%define CONFIG_SDL2 0
+%define CONFIG_SECURETRANSPORT 0
+%define CONFIG_SNDIO 0
+%define CONFIG_XLIB 1
+%define CONFIG_ZLIB 1
+%define CONFIG_AVISYNTH 0
%define CONFIG_FREI0R 0
-%define CONFIG_GCRYPT 0
+%define CONFIG_LIBCDIO 0
+%define CONFIG_LIBRUBBERBAND 0
+%define CONFIG_LIBVIDSTAB 0
+%define CONFIG_LIBX264 0
+%define CONFIG_LIBX265 0
+%define CONFIG_LIBXAVS 0
+%define CONFIG_LIBXVID 0
+%define CONFIG_DECKLINK 0
+%define CONFIG_LIBNDI_NEWTEK 0
+%define CONFIG_LIBFDK_AAC 0
+%define CONFIG_OPENSSL 0
%define CONFIG_GMP 0
+%define CONFIG_LIBOPENCORE_AMRNB 0
+%define CONFIG_LIBOPENCORE_AMRWB 0
+%define CONFIG_LIBVO_AMRWBENC 0
+%define CONFIG_RKMPP 0
+%define CONFIG_LIBSMBCLIENT 0
+%define CONFIG_CHROMAPRINT 0
+%define CONFIG_GCRYPT 0
%define CONFIG_GNUTLS 0
-%define CONFIG_ICONV 0
%define CONFIG_JNI 0
%define CONFIG_LADSPA 0
%define CONFIG_LIBASS 0
%define CONFIG_LIBBLURAY 0
%define CONFIG_LIBBS2B 0
%define CONFIG_LIBCACA 0
-%define CONFIG_LIBCDIO 0
%define CONFIG_LIBCELT 0
%define CONFIG_LIBDC1394 0
-%define CONFIG_LIBEBUR128 0
-%define CONFIG_LIBFDK_AAC 0
+%define CONFIG_LIBDRM 0
%define CONFIG_LIBFLITE 0
%define CONFIG_LIBFONTCONFIG 0
%define CONFIG_LIBFREETYPE 0
@@ -432,18 +453,15 @@
%define CONFIG_LIBKVAZAAR 0
%define CONFIG_LIBMODPLUG 0
%define CONFIG_LIBMP3LAME 0
-%define CONFIG_LIBNUT 0
-%define CONFIG_LIBOPENCORE_AMRNB 0
-%define CONFIG_LIBOPENCORE_AMRWB 0
+%define CONFIG_LIBMYSOFA 0
%define CONFIG_LIBOPENCV 0
%define CONFIG_LIBOPENH264 0
%define CONFIG_LIBOPENJPEG 0
%define CONFIG_LIBOPENMPT 0
%define CONFIG_LIBOPUS 0
%define CONFIG_LIBPULSE 0
+%define CONFIG_LIBRSVG 0
%define CONFIG_LIBRTMP 0
-%define CONFIG_LIBRUBBERBAND 0
-%define CONFIG_LIBSCHROEDINGER 0
%define CONFIG_LIBSHINE 0
%define CONFIG_LIBSMBCLIENT 0
%define CONFIG_LIBSNAPPY 0
@@ -454,53 +472,37 @@
%define CONFIG_LIBTHEORA 0
%define CONFIG_LIBTWOLAME 0
%define CONFIG_LIBV4L2 0
-%define CONFIG_LIBVIDSTAB 0
-%define CONFIG_LIBVO_AMRWBENC 0
+%define CONFIG_LIBVMAF 0
%define CONFIG_LIBVORBIS 0
%define CONFIG_LIBVPX 0
%define CONFIG_LIBWAVPACK 0
%define CONFIG_LIBWEBP 0
-%define CONFIG_LIBX264 0
-%define CONFIG_LIBX265 0
-%define CONFIG_LIBXAVS 0
-%define CONFIG_LIBXCB 0
-%define CONFIG_LIBXCB_SHM 0
-%define CONFIG_LIBXCB_SHAPE 0
-%define CONFIG_LIBXCB_XFIXES 0
-%define CONFIG_LIBXVID 0
+%define CONFIG_LIBXML2 0
%define CONFIG_LIBZIMG 0
%define CONFIG_LIBZMQ 0
%define CONFIG_LIBZVBI 0
-%define CONFIG_LZMA 0
%define CONFIG_MEDIACODEC 0
-%define CONFIG_NETCDF 0
%define CONFIG_OPENAL 0
%define CONFIG_OPENCL 0
%define CONFIG_OPENGL 0
-%define CONFIG_OPENSSL 0
-%define CONFIG_SCHANNEL 0
-%define CONFIG_SDL 0
-%define CONFIG_SDL2 0
-%define CONFIG_SECURETRANSPORT 0
-%define CONFIG_VIDEOTOOLBOX 0
-%define CONFIG_X11GRAB 0
-%define CONFIG_XLIB 0
-%define CONFIG_ZLIB 0
%define CONFIG_AUDIOTOOLBOX 0
-%define CONFIG_CUDA 0
-%define CONFIG_CUVID 0
+%define CONFIG_CRYSTALHD 0
+%define CONFIG_CUDA 1
+%define CONFIG_CUVID 1
%define CONFIG_D3D11VA 0
%define CONFIG_DXVA2 0
-%define CONFIG_LIBMFX 0
-%define CONFIG_LIBNPP 0
-%define CONFIG_MMAL 0
-%define CONFIG_NVENC 0
-%define CONFIG_OMX 0
+%define CONFIG_NVENC 1
%define CONFIG_VAAPI 0
%define CONFIG_VDA 0
%define CONFIG_VDPAU 0
-%define CONFIG_VIDEOTOOLBOX_HWACCEL 0
+%define CONFIG_VIDEOTOOLBOX 0
+%define CONFIG_V4L2_M2M 1
%define CONFIG_XVMC 0
+%define CONFIG_CUDA_SDK 0
+%define CONFIG_LIBNPP 0
+%define CONFIG_LIBMFX 0
+%define CONFIG_MMAL 0
+%define CONFIG_OMX 0
%define CONFIG_FTRAPV 0
%define CONFIG_GRAY 0
%define CONFIG_HARDCODED_TABLES 0
@@ -539,16 +541,27 @@
%define CONFIG_PIXELUTILS 0
%define CONFIG_NETWORK 0
%define CONFIG_RDFT 0
+%define CONFIG_AUTODETECT 0
%define CONFIG_FONTCONFIG 0
-%define CONFIG_MEMALIGN_HACK 0
+%define CONFIG_LINUX_PERF 0
%define CONFIG_MEMORY_POISONING 0
%define CONFIG_NEON_CLOBBER_TEST 0
+%define CONFIG_OSSFUZZ 0
%define CONFIG_PIC 1
-%define CONFIG_POD2MAN 1
-%define CONFIG_RAISE_MAJOR 0
%define CONFIG_THUMB 0
%define CONFIG_VALGRIND_BACKTRACE 0
%define CONFIG_XMM_CLOBBER_TEST 0
+%define CONFIG_BSFS 1
+%define CONFIG_DECODERS 1
+%define CONFIG_ENCODERS 0
+%define CONFIG_HWACCELS 0
+%define CONFIG_PARSERS 1
+%define CONFIG_INDEVS 0
+%define CONFIG_OUTDEVS 0
+%define CONFIG_FILTERS 0
+%define CONFIG_DEMUXERS 0
+%define CONFIG_MUXERS 0
+%define CONFIG_PROTOCOLS 0
%define CONFIG_AANDCTTABLES 0
%define CONFIG_AC3DSP 0
%define CONFIG_AUDIO_FRAME_QUEUE 0
@@ -566,20 +579,22 @@
%define CONFIG_FMTCONVERT 0
%define CONFIG_FRAME_THREAD_ENCODER 0
%define CONFIG_G722DSP 0
-%define CONFIG_GOLOMB 1
+%define CONFIG_GOLOMB 0
%define CONFIG_GPLV3 0
%define CONFIG_H263DSP 0
%define CONFIG_H264CHROMA 0
%define CONFIG_H264DSP 0
+%define CONFIG_H264PARSE 0
%define CONFIG_H264PRED 1
%define CONFIG_H264QPEL 0
+%define CONFIG_HEVCPARSE 0
%define CONFIG_HPELDSP 0
%define CONFIG_HUFFMAN 0
%define CONFIG_HUFFYUVDSP 0
%define CONFIG_HUFFYUVENCDSP 0
%define CONFIG_IDCTDSP 0
%define CONFIG_IIRFILTER 0
-%define CONFIG_IMDCT15 0
+%define CONFIG_MDCT15 0
%define CONFIG_INTRAX8 0
%define CONFIG_ISO_MEDIA 0
%define CONFIG_IVIDSP 0
@@ -588,12 +603,14 @@
%define CONFIG_LIBX262 0
%define CONFIG_LLAUDDSP 0
%define CONFIG_LLVIDDSP 0
+%define CONFIG_LLVIDENCDSP 0
%define CONFIG_LPC 0
%define CONFIG_LZF 0
%define CONFIG_ME_CMP 0
%define CONFIG_MPEG_ER 0
%define CONFIG_MPEGAUDIO 0
%define CONFIG_MPEGAUDIODSP 0
+%define CONFIG_MPEGAUDIOHEADER 0
%define CONFIG_MPEGVIDEO 0
%define CONFIG_MPEGVIDEOENC 0
%define CONFIG_MSS34DSP 0
@@ -615,1594 +632,19 @@
%define CONFIG_TEXTUREDSP 0
%define CONFIG_TEXTUREDSPENC 0
%define CONFIG_TPELDSP 0
+%define CONFIG_VAAPI_1 0
%define CONFIG_VAAPI_ENCODE 0
%define CONFIG_VC1DSP 0
%define CONFIG_VIDEODSP 1
%define CONFIG_VP3DSP 0
%define CONFIG_VP56DSP 0
%define CONFIG_VP8DSP 1
-%define CONFIG_VT_BT2020 0
%define CONFIG_WMA_FREQS 0
%define CONFIG_WMV2DSP 0
-%define CONFIG_AAC_ADTSTOASC_BSF 0
-%define CONFIG_CHOMP_BSF 0
-%define CONFIG_DUMP_EXTRADATA_BSF 0
-%define CONFIG_DCA_CORE_BSF 0
-%define CONFIG_H264_MP4TOANNEXB_BSF 0
-%define CONFIG_HEVC_MP4TOANNEXB_BSF 0
-%define CONFIG_IMX_DUMP_HEADER_BSF 0
-%define CONFIG_MJPEG2JPEG_BSF 0
-%define CONFIG_MJPEGA_DUMP_HEADER_BSF 0
-%define CONFIG_MP3_HEADER_DECOMPRESS_BSF 0
-%define CONFIG_MPEG4_UNPACK_BFRAMES_BSF 0
-%define CONFIG_MOV2TEXTSUB_BSF 0
-%define CONFIG_NOISE_BSF 0
-%define CONFIG_REMOVE_EXTRADATA_BSF 0
-%define CONFIG_TEXT2MOVSUB_BSF 0
-%define CONFIG_VP9_SUPERFRAME_BSF 0
-%define CONFIG_AASC_DECODER 0
-%define CONFIG_AIC_DECODER 0
-%define CONFIG_ALIAS_PIX_DECODER 0
-%define CONFIG_AMV_DECODER 0
-%define CONFIG_ANM_DECODER 0
-%define CONFIG_ANSI_DECODER 0
-%define CONFIG_APNG_DECODER 0
-%define CONFIG_ASV1_DECODER 0
-%define CONFIG_ASV2_DECODER 0
-%define CONFIG_AURA_DECODER 0
-%define CONFIG_AURA2_DECODER 0
-%define CONFIG_AVRP_DECODER 0
-%define CONFIG_AVRN_DECODER 0
-%define CONFIG_AVS_DECODER 0
-%define CONFIG_AVUI_DECODER 0
-%define CONFIG_AYUV_DECODER 0
-%define CONFIG_BETHSOFTVID_DECODER 0
-%define CONFIG_BFI_DECODER 0
-%define CONFIG_BINK_DECODER 0
-%define CONFIG_BMP_DECODER 0
-%define CONFIG_BMV_VIDEO_DECODER 0
-%define CONFIG_BRENDER_PIX_DECODER 0
-%define CONFIG_C93_DECODER 0
-%define CONFIG_CAVS_DECODER 0
-%define CONFIG_CDGRAPHICS_DECODER 0
-%define CONFIG_CDXL_DECODER 0
-%define CONFIG_CFHD_DECODER 0
-%define CONFIG_CINEPAK_DECODER 0
-%define CONFIG_CLJR_DECODER 0
-%define CONFIG_CLLC_DECODER 0
-%define CONFIG_COMFORTNOISE_DECODER 0
-%define CONFIG_CPIA_DECODER 0
-%define CONFIG_CSCD_DECODER 0
-%define CONFIG_CYUV_DECODER 0
-%define CONFIG_DDS_DECODER 0
-%define CONFIG_DFA_DECODER 0
-%define CONFIG_DIRAC_DECODER 0
-%define CONFIG_DNXHD_DECODER 0
-%define CONFIG_DPX_DECODER 0
-%define CONFIG_DSICINVIDEO_DECODER 0
-%define CONFIG_DVAUDIO_DECODER 0
-%define CONFIG_DVVIDEO_DECODER 0
-%define CONFIG_DXA_DECODER 0
-%define CONFIG_DXTORY_DECODER 0
-%define CONFIG_DXV_DECODER 0
-%define CONFIG_EACMV_DECODER 0
-%define CONFIG_EAMAD_DECODER 0
-%define CONFIG_EATGQ_DECODER 0
-%define CONFIG_EATGV_DECODER 0
-%define CONFIG_EATQI_DECODER 0
-%define CONFIG_EIGHTBPS_DECODER 0
-%define CONFIG_EIGHTSVX_EXP_DECODER 0
-%define CONFIG_EIGHTSVX_FIB_DECODER 0
-%define CONFIG_ESCAPE124_DECODER 0
-%define CONFIG_ESCAPE130_DECODER 0
-%define CONFIG_EXR_DECODER 0
-%define CONFIG_FFV1_DECODER 0
-%define CONFIG_FFVHUFF_DECODER 0
-%define CONFIG_FIC_DECODER 0
-%define CONFIG_FLASHSV_DECODER 0
-%define CONFIG_FLASHSV2_DECODER 0
-%define CONFIG_FLIC_DECODER 0
-%define CONFIG_FLV_DECODER 0
-%define CONFIG_FOURXM_DECODER 0
-%define CONFIG_FRAPS_DECODER 0
-%define CONFIG_FRWU_DECODER 0
-%define CONFIG_G2M_DECODER 0
-%define CONFIG_GIF_DECODER 0
-%define CONFIG_H261_DECODER 0
-%define CONFIG_H263_DECODER 0
-%define CONFIG_H263I_DECODER 0
-%define CONFIG_H263P_DECODER 0
-%define CONFIG_H264_DECODER 0
-%define CONFIG_H264_CRYSTALHD_DECODER 0
-%define CONFIG_H264_MEDIACODEC_DECODER 0
-%define CONFIG_H264_MMAL_DECODER 0
-%define CONFIG_H264_QSV_DECODER 0
-%define CONFIG_H264_VDA_DECODER 0
-%define CONFIG_H264_VDPAU_DECODER 0
-%define CONFIG_HAP_DECODER 0
-%define CONFIG_HEVC_DECODER 0
-%define CONFIG_HEVC_QSV_DECODER 0
-%define CONFIG_HNM4_VIDEO_DECODER 0
-%define CONFIG_HQ_HQA_DECODER 0
-%define CONFIG_HQX_DECODER 0
-%define CONFIG_HUFFYUV_DECODER 0
-%define CONFIG_IDCIN_DECODER 0
-%define CONFIG_IFF_ILBM_DECODER 0
-%define CONFIG_INDEO2_DECODER 0
-%define CONFIG_INDEO3_DECODER 0
-%define CONFIG_INDEO4_DECODER 0
-%define CONFIG_INDEO5_DECODER 0
-%define CONFIG_INTERPLAY_VIDEO_DECODER 0
-%define CONFIG_JPEG2000_DECODER 0
-%define CONFIG_JPEGLS_DECODER 0
-%define CONFIG_JV_DECODER 0
-%define CONFIG_KGV1_DECODER 0
-%define CONFIG_KMVC_DECODER 0
-%define CONFIG_LAGARITH_DECODER 0
-%define CONFIG_LOCO_DECODER 0
-%define CONFIG_M101_DECODER 0
-%define CONFIG_MAGICYUV_DECODER 0
-%define CONFIG_MDEC_DECODER 0
-%define CONFIG_MIMIC_DECODER 0
-%define CONFIG_MJPEG_DECODER 0
-%define CONFIG_MJPEGB_DECODER 0
-%define CONFIG_MMVIDEO_DECODER 0
-%define CONFIG_MOTIONPIXELS_DECODER 0
-%define CONFIG_MPEG_XVMC_DECODER 0
-%define CONFIG_MPEG1VIDEO_DECODER 0
-%define CONFIG_MPEG2VIDEO_DECODER 0
-%define CONFIG_MPEG4_DECODER 0
-%define CONFIG_MPEG4_CRYSTALHD_DECODER 0
-%define CONFIG_MPEG4_MMAL_DECODER 0
-%define CONFIG_MPEG4_VDPAU_DECODER 0
-%define CONFIG_MPEGVIDEO_DECODER 0
-%define CONFIG_MPEG_VDPAU_DECODER 0
-%define CONFIG_MPEG1_VDPAU_DECODER 0
-%define CONFIG_MPEG2_MMAL_DECODER 0
-%define CONFIG_MPEG2_CRYSTALHD_DECODER 0
-%define CONFIG_MPEG2_QSV_DECODER 0
-%define CONFIG_MSA1_DECODER 0
-%define CONFIG_MSMPEG4_CRYSTALHD_DECODER 0
-%define CONFIG_MSMPEG4V1_DECODER 0
-%define CONFIG_MSMPEG4V2_DECODER 0
-%define CONFIG_MSMPEG4V3_DECODER 0
-%define CONFIG_MSRLE_DECODER 0
-%define CONFIG_MSS1_DECODER 0
-%define CONFIG_MSS2_DECODER 0
-%define CONFIG_MSVIDEO1_DECODER 0
-%define CONFIG_MSZH_DECODER 0
-%define CONFIG_MTS2_DECODER 0
-%define CONFIG_MVC1_DECODER 0
-%define CONFIG_MVC2_DECODER 0
-%define CONFIG_MXPEG_DECODER 0
-%define CONFIG_NUV_DECODER 0
-%define CONFIG_PAF_VIDEO_DECODER 0
-%define CONFIG_PAM_DECODER 0
-%define CONFIG_PBM_DECODER 0
-%define CONFIG_PCX_DECODER 0
-%define CONFIG_PGM_DECODER 0
-%define CONFIG_PGMYUV_DECODER 0
-%define CONFIG_PICTOR_DECODER 0
-%define CONFIG_PNG_DECODER 0
-%define CONFIG_PPM_DECODER 0
-%define CONFIG_PRORES_DECODER 0
-%define CONFIG_PRORES_LGPL_DECODER 0
-%define CONFIG_PTX_DECODER 0
-%define CONFIG_QDRAW_DECODER 0
-%define CONFIG_QPEG_DECODER 0
-%define CONFIG_QTRLE_DECODER 0
-%define CONFIG_R10K_DECODER 0
-%define CONFIG_R210_DECODER 0
-%define CONFIG_RAWVIDEO_DECODER 0
-%define CONFIG_RL2_DECODER 0
-%define CONFIG_ROQ_DECODER 0
-%define CONFIG_RPZA_DECODER 0
-%define CONFIG_RSCC_DECODER 0
-%define CONFIG_RV10_DECODER 0
-%define CONFIG_RV20_DECODER 0
-%define CONFIG_RV30_DECODER 0
-%define CONFIG_RV40_DECODER 0
-%define CONFIG_S302M_DECODER 0
-%define CONFIG_SANM_DECODER 0
-%define CONFIG_SCREENPRESSO_DECODER 0
-%define CONFIG_SDX2_DPCM_DECODER 0
-%define CONFIG_SGI_DECODER 0
-%define CONFIG_SGIRLE_DECODER 0
-%define CONFIG_SHEERVIDEO_DECODER 0
-%define CONFIG_SMACKER_DECODER 0
-%define CONFIG_SMC_DECODER 0
-%define CONFIG_SMVJPEG_DECODER 0
-%define CONFIG_SNOW_DECODER 0
-%define CONFIG_SP5X_DECODER 0
-%define CONFIG_SUNRAST_DECODER 0
-%define CONFIG_SVQ1_DECODER 0
-%define CONFIG_SVQ3_DECODER 0
-%define CONFIG_TARGA_DECODER 0
-%define CONFIG_TARGA_Y216_DECODER 0
-%define CONFIG_TDSC_DECODER 0
-%define CONFIG_THEORA_DECODER 0
-%define CONFIG_THP_DECODER 0
-%define CONFIG_TIERTEXSEQVIDEO_DECODER 0
-%define CONFIG_TIFF_DECODER 0
-%define CONFIG_TMV_DECODER 0
-%define CONFIG_TRUEMOTION1_DECODER 0
-%define CONFIG_TRUEMOTION2_DECODER 0
-%define CONFIG_TRUEMOTION2RT_DECODER 0
-%define CONFIG_TSCC_DECODER 0
-%define CONFIG_TSCC2_DECODER 0
-%define CONFIG_TXD_DECODER 0
-%define CONFIG_ULTI_DECODER 0
-%define CONFIG_UTVIDEO_DECODER 0
-%define CONFIG_V210_DECODER 0
-%define CONFIG_V210X_DECODER 0
-%define CONFIG_V308_DECODER 0
-%define CONFIG_V408_DECODER 0
-%define CONFIG_V410_DECODER 0
-%define CONFIG_VB_DECODER 0
-%define CONFIG_VBLE_DECODER 0
-%define CONFIG_VC1_DECODER 0
-%define CONFIG_VC1_CRYSTALHD_DECODER 0
-%define CONFIG_VC1_VDPAU_DECODER 0
-%define CONFIG_VC1IMAGE_DECODER 0
-%define CONFIG_VC1_MMAL_DECODER 0
-%define CONFIG_VC1_QSV_DECODER 0
-%define CONFIG_VCR1_DECODER 0
-%define CONFIG_VMDVIDEO_DECODER 0
-%define CONFIG_VMNC_DECODER 0
-%define CONFIG_VP3_DECODER 0
-%define CONFIG_VP5_DECODER 0
-%define CONFIG_VP6_DECODER 0
-%define CONFIG_VP6A_DECODER 0
-%define CONFIG_VP6F_DECODER 0
-%define CONFIG_VP7_DECODER 0
+%define CONFIG_NULL_BSF 1
%define CONFIG_VP8_DECODER 1
%define CONFIG_VP9_DECODER 1
-%define CONFIG_VQA_DECODER 0
-%define CONFIG_WEBP_DECODER 0
-%define CONFIG_WMV1_DECODER 0
-%define CONFIG_WMV2_DECODER 0
-%define CONFIG_WMV3_DECODER 0
-%define CONFIG_WMV3_CRYSTALHD_DECODER 0
-%define CONFIG_WMV3_VDPAU_DECODER 0
-%define CONFIG_WMV3IMAGE_DECODER 0
-%define CONFIG_WNV1_DECODER 0
-%define CONFIG_XAN_WC3_DECODER 0
-%define CONFIG_XAN_WC4_DECODER 0
-%define CONFIG_XBM_DECODER 0
-%define CONFIG_XFACE_DECODER 0
-%define CONFIG_XL_DECODER 0
-%define CONFIG_XWD_DECODER 0
-%define CONFIG_Y41P_DECODER 0
-%define CONFIG_YLC_DECODER 0
-%define CONFIG_YOP_DECODER 0
-%define CONFIG_YUV4_DECODER 0
-%define CONFIG_ZERO12V_DECODER 0
-%define CONFIG_ZEROCODEC_DECODER 0
-%define CONFIG_ZLIB_DECODER 0
-%define CONFIG_ZMBV_DECODER 0
-%define CONFIG_AAC_DECODER 0
-%define CONFIG_AAC_FIXED_DECODER 0
-%define CONFIG_AAC_LATM_DECODER 0
-%define CONFIG_AC3_DECODER 0
-%define CONFIG_AC3_FIXED_DECODER 0
-%define CONFIG_ALAC_DECODER 0
-%define CONFIG_ALS_DECODER 0
-%define CONFIG_AMRNB_DECODER 0
-%define CONFIG_AMRWB_DECODER 0
-%define CONFIG_APE_DECODER 0
-%define CONFIG_ATRAC1_DECODER 0
-%define CONFIG_ATRAC3_DECODER 0
-%define CONFIG_ATRAC3P_DECODER 0
-%define CONFIG_BINKAUDIO_DCT_DECODER 0
-%define CONFIG_BINKAUDIO_RDFT_DECODER 0
-%define CONFIG_BMV_AUDIO_DECODER 0
-%define CONFIG_COOK_DECODER 0
-%define CONFIG_DCA_DECODER 0
-%define CONFIG_DSD_LSBF_DECODER 0
-%define CONFIG_DSD_MSBF_DECODER 0
-%define CONFIG_DSD_LSBF_PLANAR_DECODER 0
-%define CONFIG_DSD_MSBF_PLANAR_DECODER 0
-%define CONFIG_DSICINAUDIO_DECODER 0
-%define CONFIG_DSS_SP_DECODER 0
-%define CONFIG_DST_DECODER 0
-%define CONFIG_EAC3_DECODER 0
-%define CONFIG_EVRC_DECODER 0
-%define CONFIG_FFWAVESYNTH_DECODER 0
%define CONFIG_FLAC_DECODER 1
-%define CONFIG_G723_1_DECODER 0
-%define CONFIG_G729_DECODER 0
-%define CONFIG_GSM_DECODER 0
-%define CONFIG_GSM_MS_DECODER 0
-%define CONFIG_IAC_DECODER 0
-%define CONFIG_IMC_DECODER 0
-%define CONFIG_INTERPLAY_ACM_DECODER 0
-%define CONFIG_MACE3_DECODER 0
-%define CONFIG_MACE6_DECODER 0
-%define CONFIG_METASOUND_DECODER 0
-%define CONFIG_MLP_DECODER 0
-%define CONFIG_MP1_DECODER 0
-%define CONFIG_MP1FLOAT_DECODER 0
-%define CONFIG_MP2_DECODER 0
-%define CONFIG_MP2FLOAT_DECODER 0
-%define CONFIG_MP3_DECODER 0
-%define CONFIG_MP3FLOAT_DECODER 0
-%define CONFIG_MP3ADU_DECODER 0
-%define CONFIG_MP3ADUFLOAT_DECODER 0
-%define CONFIG_MP3ON4_DECODER 0
-%define CONFIG_MP3ON4FLOAT_DECODER 0
-%define CONFIG_MPC7_DECODER 0
-%define CONFIG_MPC8_DECODER 0
-%define CONFIG_NELLYMOSER_DECODER 0
-%define CONFIG_ON2AVC_DECODER 0
-%define CONFIG_OPUS_DECODER 0
-%define CONFIG_PAF_AUDIO_DECODER 0
-%define CONFIG_QCELP_DECODER 0
-%define CONFIG_QDM2_DECODER 0
-%define CONFIG_RA_144_DECODER 0
-%define CONFIG_RA_288_DECODER 0
-%define CONFIG_RALF_DECODER 0
-%define CONFIG_SHORTEN_DECODER 0
-%define CONFIG_SIPR_DECODER 0
-%define CONFIG_SMACKAUD_DECODER 0
-%define CONFIG_SONIC_DECODER 0
-%define CONFIG_TAK_DECODER 0
-%define CONFIG_TRUEHD_DECODER 0
-%define CONFIG_TRUESPEECH_DECODER 0
-%define CONFIG_TTA_DECODER 0
-%define CONFIG_TWINVQ_DECODER 0
-%define CONFIG_VMDAUDIO_DECODER 0
-%define CONFIG_VORBIS_DECODER 0
-%define CONFIG_WAVPACK_DECODER 0
-%define CONFIG_WMALOSSLESS_DECODER 0
-%define CONFIG_WMAPRO_DECODER 0
-%define CONFIG_WMAV1_DECODER 0
-%define CONFIG_WMAV2_DECODER 0
-%define CONFIG_WMAVOICE_DECODER 0
-%define CONFIG_WS_SND1_DECODER 0
-%define CONFIG_XMA1_DECODER 0
-%define CONFIG_XMA2_DECODER 0
-%define CONFIG_PCM_ALAW_DECODER 0
-%define CONFIG_PCM_BLURAY_DECODER 0
-%define CONFIG_PCM_DVD_DECODER 0
-%define CONFIG_PCM_F32BE_DECODER 0
-%define CONFIG_PCM_F32LE_DECODER 0
-%define CONFIG_PCM_F64BE_DECODER 0
-%define CONFIG_PCM_F64LE_DECODER 0
-%define CONFIG_PCM_LXF_DECODER 0
-%define CONFIG_PCM_MULAW_DECODER 0
-%define CONFIG_PCM_S8_DECODER 0
-%define CONFIG_PCM_S8_PLANAR_DECODER 0
-%define CONFIG_PCM_S16BE_DECODER 0
-%define CONFIG_PCM_S16BE_PLANAR_DECODER 0
-%define CONFIG_PCM_S16LE_DECODER 0
-%define CONFIG_PCM_S16LE_PLANAR_DECODER 0
-%define CONFIG_PCM_S24BE_DECODER 0
-%define CONFIG_PCM_S24DAUD_DECODER 0
-%define CONFIG_PCM_S24LE_DECODER 0
-%define CONFIG_PCM_S24LE_PLANAR_DECODER 0
-%define CONFIG_PCM_S32BE_DECODER 0
-%define CONFIG_PCM_S32LE_DECODER 0
-%define CONFIG_PCM_S32LE_PLANAR_DECODER 0
-%define CONFIG_PCM_S64BE_DECODER 0
-%define CONFIG_PCM_S64LE_DECODER 0
-%define CONFIG_PCM_U8_DECODER 0
-%define CONFIG_PCM_U16BE_DECODER 0
-%define CONFIG_PCM_U16LE_DECODER 0
-%define CONFIG_PCM_U24BE_DECODER 0
-%define CONFIG_PCM_U24LE_DECODER 0
-%define CONFIG_PCM_U32BE_DECODER 0
-%define CONFIG_PCM_U32LE_DECODER 0
-%define CONFIG_PCM_ZORK_DECODER 0
-%define CONFIG_INTERPLAY_DPCM_DECODER 0
-%define CONFIG_ROQ_DPCM_DECODER 0
-%define CONFIG_SOL_DPCM_DECODER 0
-%define CONFIG_XAN_DPCM_DECODER 0
-%define CONFIG_ADPCM_4XM_DECODER 0
-%define CONFIG_ADPCM_ADX_DECODER 0
-%define CONFIG_ADPCM_AFC_DECODER 0
-%define CONFIG_ADPCM_AICA_DECODER 0
-%define CONFIG_ADPCM_CT_DECODER 0
-%define CONFIG_ADPCM_DTK_DECODER 0
-%define CONFIG_ADPCM_EA_DECODER 0
-%define CONFIG_ADPCM_EA_MAXIS_XA_DECODER 0
-%define CONFIG_ADPCM_EA_R1_DECODER 0
-%define CONFIG_ADPCM_EA_R2_DECODER 0
-%define CONFIG_ADPCM_EA_R3_DECODER 0
-%define CONFIG_ADPCM_EA_XAS_DECODER 0
-%define CONFIG_ADPCM_G722_DECODER 0
-%define CONFIG_ADPCM_G726_DECODER 0
-%define CONFIG_ADPCM_G726LE_DECODER 0
-%define CONFIG_ADPCM_IMA_AMV_DECODER 0
-%define CONFIG_ADPCM_IMA_APC_DECODER 0
-%define CONFIG_ADPCM_IMA_DAT4_DECODER 0
-%define CONFIG_ADPCM_IMA_DK3_DECODER 0
-%define CONFIG_ADPCM_IMA_DK4_DECODER 0
-%define CONFIG_ADPCM_IMA_EA_EACS_DECODER 0
-%define CONFIG_ADPCM_IMA_EA_SEAD_DECODER 0
-%define CONFIG_ADPCM_IMA_ISS_DECODER 0
-%define CONFIG_ADPCM_IMA_OKI_DECODER 0
-%define CONFIG_ADPCM_IMA_QT_DECODER 0
-%define CONFIG_ADPCM_IMA_RAD_DECODER 0
-%define CONFIG_ADPCM_IMA_SMJPEG_DECODER 0
-%define CONFIG_ADPCM_IMA_WAV_DECODER 0
-%define CONFIG_ADPCM_IMA_WS_DECODER 0
-%define CONFIG_ADPCM_MS_DECODER 0
-%define CONFIG_ADPCM_MTAF_DECODER 0
-%define CONFIG_ADPCM_PSX_DECODER 0
-%define CONFIG_ADPCM_SBPRO_2_DECODER 0
-%define CONFIG_ADPCM_SBPRO_3_DECODER 0
-%define CONFIG_ADPCM_SBPRO_4_DECODER 0
-%define CONFIG_ADPCM_SWF_DECODER 0
-%define CONFIG_ADPCM_THP_DECODER 0
-%define CONFIG_ADPCM_THP_LE_DECODER 0
-%define CONFIG_ADPCM_VIMA_DECODER 0
-%define CONFIG_ADPCM_XA_DECODER 0
-%define CONFIG_ADPCM_YAMAHA_DECODER 0
-%define CONFIG_SSA_DECODER 0
-%define CONFIG_ASS_DECODER 0
-%define CONFIG_CCAPTION_DECODER 0
-%define CONFIG_DVBSUB_DECODER 0
-%define CONFIG_DVDSUB_DECODER 0
-%define CONFIG_JACOSUB_DECODER 0
-%define CONFIG_MICRODVD_DECODER 0
-%define CONFIG_MOVTEXT_DECODER 0
-%define CONFIG_MPL2_DECODER 0
-%define CONFIG_PGSSUB_DECODER 0
-%define CONFIG_PJS_DECODER 0
-%define CONFIG_REALTEXT_DECODER 0
-%define CONFIG_SAMI_DECODER 0
-%define CONFIG_SRT_DECODER 0
-%define CONFIG_STL_DECODER 0
-%define CONFIG_SUBRIP_DECODER 0
-%define CONFIG_SUBVIEWER_DECODER 0
-%define CONFIG_SUBVIEWER1_DECODER 0
-%define CONFIG_TEXT_DECODER 0
-%define CONFIG_VPLAYER_DECODER 0
-%define CONFIG_WEBVTT_DECODER 0
-%define CONFIG_XSUB_DECODER 0
-%define CONFIG_AAC_AT_DECODER 0
-%define CONFIG_AC3_AT_DECODER 0
-%define CONFIG_ADPCM_IMA_QT_AT_DECODER 0
-%define CONFIG_ALAC_AT_DECODER 0
-%define CONFIG_AMR_NB_AT_DECODER 0
-%define CONFIG_EAC3_AT_DECODER 0
-%define CONFIG_GSM_MS_AT_DECODER 0
-%define CONFIG_ILBC_AT_DECODER 0
-%define CONFIG_MP1_AT_DECODER 0
-%define CONFIG_MP2_AT_DECODER 0
-%define CONFIG_MP3_AT_DECODER 0
-%define CONFIG_PCM_ALAW_AT_DECODER 0
-%define CONFIG_PCM_MULAW_AT_DECODER 0
-%define CONFIG_QDMC_AT_DECODER 0
-%define CONFIG_QDM2_AT_DECODER 0
-%define CONFIG_LIBCELT_DECODER 0
-%define CONFIG_LIBFDK_AAC_DECODER 0
-%define CONFIG_LIBGSM_DECODER 0
-%define CONFIG_LIBGSM_MS_DECODER 0
-%define CONFIG_LIBILBC_DECODER 0
-%define CONFIG_LIBOPENCORE_AMRNB_DECODER 0
-%define CONFIG_LIBOPENCORE_AMRWB_DECODER 0
-%define CONFIG_LIBOPENJPEG_DECODER 0
-%define CONFIG_LIBOPUS_DECODER 0
-%define CONFIG_LIBSCHROEDINGER_DECODER 0
-%define CONFIG_LIBSPEEX_DECODER 0
-%define CONFIG_LIBVORBIS_DECODER 0
-%define CONFIG_LIBVPX_VP8_DECODER 0
-%define CONFIG_LIBVPX_VP9_DECODER 0
-%define CONFIG_LIBZVBI_TELETEXT_DECODER 0
-%define CONFIG_BINTEXT_DECODER 0
-%define CONFIG_XBIN_DECODER 0
-%define CONFIG_IDF_DECODER 0
-%define CONFIG_LIBOPENH264_DECODER 0
-%define CONFIG_H263_CUVID_DECODER 0
-%define CONFIG_H264_CUVID_DECODER 0
-%define CONFIG_HEVC_CUVID_DECODER 0
-%define CONFIG_HEVC_MEDIACODEC_DECODER 0
-%define CONFIG_MJPEG_CUVID_DECODER 0
-%define CONFIG_MPEG1_CUVID_DECODER 0
-%define CONFIG_MPEG2_CUVID_DECODER 0
-%define CONFIG_MPEG4_CUVID_DECODER 0
-%define CONFIG_MPEG4_MEDIACODEC_DECODER 0
-%define CONFIG_VC1_CUVID_DECODER 0
-%define CONFIG_VP8_CUVID_DECODER 0
-%define CONFIG_VP8_MEDIACODEC_DECODER 0
-%define CONFIG_VP9_CUVID_DECODER 0
-%define CONFIG_VP9_MEDIACODEC_DECODER 0
-%define CONFIG_AA_DEMUXER 0
-%define CONFIG_AAC_DEMUXER 0
-%define CONFIG_AC3_DEMUXER 0
-%define CONFIG_ACM_DEMUXER 0
-%define CONFIG_ACT_DEMUXER 0
-%define CONFIG_ADF_DEMUXER 0
-%define CONFIG_ADP_DEMUXER 0
-%define CONFIG_ADS_DEMUXER 0
-%define CONFIG_ADX_DEMUXER 0
-%define CONFIG_AEA_DEMUXER 0
-%define CONFIG_AFC_DEMUXER 0
-%define CONFIG_AIFF_DEMUXER 0
-%define CONFIG_AIX_DEMUXER 0
-%define CONFIG_AMR_DEMUXER 0
-%define CONFIG_ANM_DEMUXER 0
-%define CONFIG_APC_DEMUXER 0
-%define CONFIG_APE_DEMUXER 0
-%define CONFIG_APNG_DEMUXER 0
-%define CONFIG_AQTITLE_DEMUXER 0
-%define CONFIG_ASF_DEMUXER 0
-%define CONFIG_ASF_O_DEMUXER 0
-%define CONFIG_ASS_DEMUXER 0
-%define CONFIG_AST_DEMUXER 0
-%define CONFIG_AU_DEMUXER 0
-%define CONFIG_AVI_DEMUXER 0
-%define CONFIG_AVISYNTH_DEMUXER 0
-%define CONFIG_AVR_DEMUXER 0
-%define CONFIG_AVS_DEMUXER 0
-%define CONFIG_BETHSOFTVID_DEMUXER 0
-%define CONFIG_BFI_DEMUXER 0
-%define CONFIG_BINTEXT_DEMUXER 0
-%define CONFIG_BINK_DEMUXER 0
-%define CONFIG_BIT_DEMUXER 0
-%define CONFIG_BMV_DEMUXER 0
-%define CONFIG_BFSTM_DEMUXER 0
-%define CONFIG_BRSTM_DEMUXER 0
-%define CONFIG_BOA_DEMUXER 0
-%define CONFIG_C93_DEMUXER 0
-%define CONFIG_CAF_DEMUXER 0
-%define CONFIG_CAVSVIDEO_DEMUXER 0
-%define CONFIG_CDG_DEMUXER 0
-%define CONFIG_CDXL_DEMUXER 0
-%define CONFIG_CINE_DEMUXER 0
-%define CONFIG_CONCAT_DEMUXER 0
-%define CONFIG_DATA_DEMUXER 0
-%define CONFIG_DAUD_DEMUXER 0
-%define CONFIG_DCSTR_DEMUXER 0
-%define CONFIG_DFA_DEMUXER 0
-%define CONFIG_DIRAC_DEMUXER 0
-%define CONFIG_DNXHD_DEMUXER 0
-%define CONFIG_DSF_DEMUXER 0
-%define CONFIG_DSICIN_DEMUXER 0
-%define CONFIG_DSS_DEMUXER 0
-%define CONFIG_DTS_DEMUXER 0
-%define CONFIG_DTSHD_DEMUXER 0
-%define CONFIG_DV_DEMUXER 0
-%define CONFIG_DVBSUB_DEMUXER 0
-%define CONFIG_DVBTXT_DEMUXER 0
-%define CONFIG_DXA_DEMUXER 0
-%define CONFIG_EA_DEMUXER 0
-%define CONFIG_EA_CDATA_DEMUXER 0
-%define CONFIG_EAC3_DEMUXER 0
-%define CONFIG_EPAF_DEMUXER 0
-%define CONFIG_FFM_DEMUXER 0
-%define CONFIG_FFMETADATA_DEMUXER 0
-%define CONFIG_FILMSTRIP_DEMUXER 0
-%define CONFIG_FLAC_DEMUXER 0
-%define CONFIG_FLIC_DEMUXER 0
-%define CONFIG_FLV_DEMUXER 0
-%define CONFIG_LIVE_FLV_DEMUXER 0
-%define CONFIG_FOURXM_DEMUXER 0
-%define CONFIG_FRM_DEMUXER 0
-%define CONFIG_FSB_DEMUXER 0
-%define CONFIG_G722_DEMUXER 0
-%define CONFIG_G723_1_DEMUXER 0
-%define CONFIG_G729_DEMUXER 0
-%define CONFIG_GENH_DEMUXER 0
-%define CONFIG_GIF_DEMUXER 0
-%define CONFIG_GSM_DEMUXER 0
-%define CONFIG_GXF_DEMUXER 0
-%define CONFIG_H261_DEMUXER 0
-%define CONFIG_H263_DEMUXER 0
-%define CONFIG_H264_DEMUXER 0
-%define CONFIG_HEVC_DEMUXER 0
-%define CONFIG_HLS_DEMUXER 0
-%define CONFIG_HNM_DEMUXER 0
-%define CONFIG_ICO_DEMUXER 0
-%define CONFIG_IDCIN_DEMUXER 0
-%define CONFIG_IDF_DEMUXER 0
-%define CONFIG_IFF_DEMUXER 0
-%define CONFIG_ILBC_DEMUXER 0
-%define CONFIG_IMAGE2_DEMUXER 0
-%define CONFIG_IMAGE2PIPE_DEMUXER 0
-%define CONFIG_IMAGE2_ALIAS_PIX_DEMUXER 0
-%define CONFIG_IMAGE2_BRENDER_PIX_DEMUXER 0
-%define CONFIG_INGENIENT_DEMUXER 0
-%define CONFIG_IPMOVIE_DEMUXER 0
-%define CONFIG_IRCAM_DEMUXER 0
-%define CONFIG_ISS_DEMUXER 0
-%define CONFIG_IV8_DEMUXER 0
-%define CONFIG_IVF_DEMUXER 0
-%define CONFIG_IVR_DEMUXER 0
-%define CONFIG_JACOSUB_DEMUXER 0
-%define CONFIG_JV_DEMUXER 0
-%define CONFIG_LMLM4_DEMUXER 0
-%define CONFIG_LOAS_DEMUXER 0
-%define CONFIG_LRC_DEMUXER 0
-%define CONFIG_LVF_DEMUXER 0
-%define CONFIG_LXF_DEMUXER 0
-%define CONFIG_M4V_DEMUXER 0
-%define CONFIG_MATROSKA_DEMUXER 0
-%define CONFIG_MGSTS_DEMUXER 0
-%define CONFIG_MICRODVD_DEMUXER 0
-%define CONFIG_MJPEG_DEMUXER 0
-%define CONFIG_MLP_DEMUXER 0
-%define CONFIG_MLV_DEMUXER 0
-%define CONFIG_MM_DEMUXER 0
-%define CONFIG_MMF_DEMUXER 0
-%define CONFIG_MOV_DEMUXER 0
-%define CONFIG_MP3_DEMUXER 0
-%define CONFIG_MPC_DEMUXER 0
-%define CONFIG_MPC8_DEMUXER 0
-%define CONFIG_MPEGPS_DEMUXER 0
-%define CONFIG_MPEGTS_DEMUXER 0
-%define CONFIG_MPEGTSRAW_DEMUXER 0
-%define CONFIG_MPEGVIDEO_DEMUXER 0
-%define CONFIG_MPJPEG_DEMUXER 0
-%define CONFIG_MPL2_DEMUXER 0
-%define CONFIG_MPSUB_DEMUXER 0
-%define CONFIG_MSF_DEMUXER 0
-%define CONFIG_MSNWC_TCP_DEMUXER 0
-%define CONFIG_MTAF_DEMUXER 0
-%define CONFIG_MTV_DEMUXER 0
-%define CONFIG_MUSX_DEMUXER 0
-%define CONFIG_MV_DEMUXER 0
-%define CONFIG_MVI_DEMUXER 0
-%define CONFIG_MXF_DEMUXER 0
-%define CONFIG_MXG_DEMUXER 0
-%define CONFIG_NC_DEMUXER 0
-%define CONFIG_NISTSPHERE_DEMUXER 0
-%define CONFIG_NSV_DEMUXER 0
-%define CONFIG_NUT_DEMUXER 0
-%define CONFIG_NUV_DEMUXER 0
-%define CONFIG_OGG_DEMUXER 0
-%define CONFIG_OMA_DEMUXER 0
-%define CONFIG_PAF_DEMUXER 0
-%define CONFIG_PCM_ALAW_DEMUXER 0
-%define CONFIG_PCM_MULAW_DEMUXER 0
-%define CONFIG_PCM_F64BE_DEMUXER 0
-%define CONFIG_PCM_F64LE_DEMUXER 0
-%define CONFIG_PCM_F32BE_DEMUXER 0
-%define CONFIG_PCM_F32LE_DEMUXER 0
-%define CONFIG_PCM_S32BE_DEMUXER 0
-%define CONFIG_PCM_S32LE_DEMUXER 0
-%define CONFIG_PCM_S24BE_DEMUXER 0
-%define CONFIG_PCM_S24LE_DEMUXER 0
-%define CONFIG_PCM_S16BE_DEMUXER 0
-%define CONFIG_PCM_S16LE_DEMUXER 0
-%define CONFIG_PCM_S8_DEMUXER 0
-%define CONFIG_PCM_U32BE_DEMUXER 0
-%define CONFIG_PCM_U32LE_DEMUXER 0
-%define CONFIG_PCM_U24BE_DEMUXER 0
-%define CONFIG_PCM_U24LE_DEMUXER 0
-%define CONFIG_PCM_U16BE_DEMUXER 0
-%define CONFIG_PCM_U16LE_DEMUXER 0
-%define CONFIG_PCM_U8_DEMUXER 0
-%define CONFIG_PJS_DEMUXER 0
-%define CONFIG_PMP_DEMUXER 0
-%define CONFIG_PVA_DEMUXER 0
-%define CONFIG_PVF_DEMUXER 0
-%define CONFIG_QCP_DEMUXER 0
-%define CONFIG_R3D_DEMUXER 0
-%define CONFIG_RAWVIDEO_DEMUXER 0
-%define CONFIG_REALTEXT_DEMUXER 0
-%define CONFIG_REDSPARK_DEMUXER 0
-%define CONFIG_RL2_DEMUXER 0
-%define CONFIG_RM_DEMUXER 0
-%define CONFIG_ROQ_DEMUXER 0
-%define CONFIG_RPL_DEMUXER 0
-%define CONFIG_RSD_DEMUXER 0
-%define CONFIG_RSO_DEMUXER 0
-%define CONFIG_RTP_DEMUXER 0
-%define CONFIG_RTSP_DEMUXER 0
-%define CONFIG_SAMI_DEMUXER 0
-%define CONFIG_SAP_DEMUXER 0
-%define CONFIG_SBG_DEMUXER 0
-%define CONFIG_SDP_DEMUXER 0
-%define CONFIG_SDR2_DEMUXER 0
-%define CONFIG_SEGAFILM_DEMUXER 0
-%define CONFIG_SHORTEN_DEMUXER 0
-%define CONFIG_SIFF_DEMUXER 0
-%define CONFIG_SLN_DEMUXER 0
-%define CONFIG_SMACKER_DEMUXER 0
-%define CONFIG_SMJPEG_DEMUXER 0
-%define CONFIG_SMUSH_DEMUXER 0
-%define CONFIG_SOL_DEMUXER 0
-%define CONFIG_SOX_DEMUXER 0
-%define CONFIG_SPDIF_DEMUXER 0
-%define CONFIG_SRT_DEMUXER 0
-%define CONFIG_STR_DEMUXER 0
-%define CONFIG_STL_DEMUXER 0
-%define CONFIG_SUBVIEWER1_DEMUXER 0
-%define CONFIG_SUBVIEWER_DEMUXER 0
-%define CONFIG_SUP_DEMUXER 0
-%define CONFIG_SVAG_DEMUXER 0
-%define CONFIG_SWF_DEMUXER 0
-%define CONFIG_TAK_DEMUXER 0
-%define CONFIG_TEDCAPTIONS_DEMUXER 0
-%define CONFIG_THP_DEMUXER 0
-%define CONFIG_THREEDOSTR_DEMUXER 0
-%define CONFIG_TIERTEXSEQ_DEMUXER 0
-%define CONFIG_TMV_DEMUXER 0
-%define CONFIG_TRUEHD_DEMUXER 0
-%define CONFIG_TTA_DEMUXER 0
-%define CONFIG_TXD_DEMUXER 0
-%define CONFIG_TTY_DEMUXER 0
-%define CONFIG_V210_DEMUXER 0
-%define CONFIG_V210X_DEMUXER 0
-%define CONFIG_VAG_DEMUXER 0
-%define CONFIG_VC1_DEMUXER 0
-%define CONFIG_VC1T_DEMUXER 0
-%define CONFIG_VIVO_DEMUXER 0
-%define CONFIG_VMD_DEMUXER 0
-%define CONFIG_VOBSUB_DEMUXER 0
-%define CONFIG_VOC_DEMUXER 0
-%define CONFIG_VPK_DEMUXER 0
-%define CONFIG_VPLAYER_DEMUXER 0
-%define CONFIG_VQF_DEMUXER 0
-%define CONFIG_W64_DEMUXER 0
-%define CONFIG_WAV_DEMUXER 0
-%define CONFIG_WC3_DEMUXER 0
-%define CONFIG_WEBM_DASH_MANIFEST_DEMUXER 0
-%define CONFIG_WEBVTT_DEMUXER 0
-%define CONFIG_WSAUD_DEMUXER 0
-%define CONFIG_WSD_DEMUXER 0
-%define CONFIG_WSVQA_DEMUXER 0
-%define CONFIG_WTV_DEMUXER 0
-%define CONFIG_WVE_DEMUXER 0
-%define CONFIG_WV_DEMUXER 0
-%define CONFIG_XA_DEMUXER 0
-%define CONFIG_XBIN_DEMUXER 0
-%define CONFIG_XMV_DEMUXER 0
-%define CONFIG_XVAG_DEMUXER 0
-%define CONFIG_XWMA_DEMUXER 0
-%define CONFIG_YOP_DEMUXER 0
-%define CONFIG_YUV4MPEGPIPE_DEMUXER 0
-%define CONFIG_IMAGE_BMP_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_DDS_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_DPX_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_EXR_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_J2K_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_JPEG_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_JPEGLS_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PAM_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PBM_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PCX_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PGMYUV_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PGM_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PICTOR_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PNG_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PPM_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_QDRAW_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_SGI_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_SUNRAST_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_TIFF_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_WEBP_PIPE_DEMUXER 0
-%define CONFIG_LIBGME_DEMUXER 0
-%define CONFIG_LIBMODPLUG_DEMUXER 0
-%define CONFIG_LIBNUT_DEMUXER 0
-%define CONFIG_LIBOPENMPT_DEMUXER 0
-%define CONFIG_A64MULTI_ENCODER 0
-%define CONFIG_A64MULTI5_ENCODER 0
-%define CONFIG_ALIAS_PIX_ENCODER 0
-%define CONFIG_AMV_ENCODER 0
-%define CONFIG_APNG_ENCODER 0
-%define CONFIG_ASV1_ENCODER 0
-%define CONFIG_ASV2_ENCODER 0
-%define CONFIG_AVRP_ENCODER 0
-%define CONFIG_AVUI_ENCODER 0
-%define CONFIG_AYUV_ENCODER 0
-%define CONFIG_BMP_ENCODER 0
-%define CONFIG_CINEPAK_ENCODER 0
-%define CONFIG_CLJR_ENCODER 0
-%define CONFIG_COMFORTNOISE_ENCODER 0
-%define CONFIG_DNXHD_ENCODER 0
-%define CONFIG_DPX_ENCODER 0
-%define CONFIG_DVVIDEO_ENCODER 0
-%define CONFIG_FFV1_ENCODER 0
-%define CONFIG_FFVHUFF_ENCODER 0
-%define CONFIG_FLASHSV_ENCODER 0
-%define CONFIG_FLASHSV2_ENCODER 0
-%define CONFIG_FLV_ENCODER 0
-%define CONFIG_GIF_ENCODER 0
-%define CONFIG_H261_ENCODER 0
-%define CONFIG_H263_ENCODER 0
-%define CONFIG_H263P_ENCODER 0
-%define CONFIG_HAP_ENCODER 0
-%define CONFIG_HUFFYUV_ENCODER 0
-%define CONFIG_JPEG2000_ENCODER 0
-%define CONFIG_JPEGLS_ENCODER 0
-%define CONFIG_LJPEG_ENCODER 0
-%define CONFIG_MJPEG_ENCODER 0
-%define CONFIG_MPEG1VIDEO_ENCODER 0
-%define CONFIG_MPEG2VIDEO_ENCODER 0
-%define CONFIG_MPEG4_ENCODER 0
-%define CONFIG_MSMPEG4V2_ENCODER 0
-%define CONFIG_MSMPEG4V3_ENCODER 0
-%define CONFIG_MSVIDEO1_ENCODER 0
-%define CONFIG_PAM_ENCODER 0
-%define CONFIG_PBM_ENCODER 0
-%define CONFIG_PCX_ENCODER 0
-%define CONFIG_PGM_ENCODER 0
-%define CONFIG_PGMYUV_ENCODER 0
-%define CONFIG_PNG_ENCODER 0
-%define CONFIG_PPM_ENCODER 0
-%define CONFIG_PRORES_ENCODER 0
-%define CONFIG_PRORES_AW_ENCODER 0
-%define CONFIG_PRORES_KS_ENCODER 0
-%define CONFIG_QTRLE_ENCODER 0
-%define CONFIG_R10K_ENCODER 0
-%define CONFIG_R210_ENCODER 0
-%define CONFIG_RAWVIDEO_ENCODER 0
-%define CONFIG_ROQ_ENCODER 0
-%define CONFIG_RV10_ENCODER 0
-%define CONFIG_RV20_ENCODER 0
-%define CONFIG_S302M_ENCODER 0
-%define CONFIG_SGI_ENCODER 0
-%define CONFIG_SNOW_ENCODER 0
-%define CONFIG_SUNRAST_ENCODER 0
-%define CONFIG_SVQ1_ENCODER 0
-%define CONFIG_TARGA_ENCODER 0
-%define CONFIG_TIFF_ENCODER 0
-%define CONFIG_UTVIDEO_ENCODER 0
-%define CONFIG_V210_ENCODER 0
-%define CONFIG_V308_ENCODER 0
-%define CONFIG_V408_ENCODER 0
-%define CONFIG_V410_ENCODER 0
-%define CONFIG_VC2_ENCODER 0
-%define CONFIG_WRAPPED_AVFRAME_ENCODER 0
-%define CONFIG_WMV1_ENCODER 0
-%define CONFIG_WMV2_ENCODER 0
-%define CONFIG_XBM_ENCODER 0
-%define CONFIG_XFACE_ENCODER 0
-%define CONFIG_XWD_ENCODER 0
-%define CONFIG_Y41P_ENCODER 0
-%define CONFIG_YUV4_ENCODER 0
-%define CONFIG_ZLIB_ENCODER 0
-%define CONFIG_ZMBV_ENCODER 0
-%define CONFIG_AAC_ENCODER 0
-%define CONFIG_AC3_ENCODER 0
-%define CONFIG_AC3_FIXED_ENCODER 0
-%define CONFIG_ALAC_ENCODER 0
-%define CONFIG_DCA_ENCODER 0
-%define CONFIG_EAC3_ENCODER 0
-%define CONFIG_FLAC_ENCODER 0
-%define CONFIG_G723_1_ENCODER 0
-%define CONFIG_MLP_ENCODER 0
-%define CONFIG_MP2_ENCODER 0
-%define CONFIG_MP2FIXED_ENCODER 0
-%define CONFIG_NELLYMOSER_ENCODER 0
-%define CONFIG_RA_144_ENCODER 0
-%define CONFIG_SONIC_ENCODER 0
-%define CONFIG_SONIC_LS_ENCODER 0
-%define CONFIG_TRUEHD_ENCODER 0
-%define CONFIG_TTA_ENCODER 0
-%define CONFIG_VORBIS_ENCODER 0
-%define CONFIG_WAVPACK_ENCODER 0
-%define CONFIG_WMAV1_ENCODER 0
-%define CONFIG_WMAV2_ENCODER 0
-%define CONFIG_PCM_ALAW_ENCODER 0
-%define CONFIG_PCM_F32BE_ENCODER 0
-%define CONFIG_PCM_F32LE_ENCODER 0
-%define CONFIG_PCM_F64BE_ENCODER 0
-%define CONFIG_PCM_F64LE_ENCODER 0
-%define CONFIG_PCM_MULAW_ENCODER 0
-%define CONFIG_PCM_S8_ENCODER 0
-%define CONFIG_PCM_S8_PLANAR_ENCODER 0
-%define CONFIG_PCM_S16BE_ENCODER 0
-%define CONFIG_PCM_S16BE_PLANAR_ENCODER 0
-%define CONFIG_PCM_S16LE_ENCODER 0
-%define CONFIG_PCM_S16LE_PLANAR_ENCODER 0
-%define CONFIG_PCM_S24BE_ENCODER 0
-%define CONFIG_PCM_S24DAUD_ENCODER 0
-%define CONFIG_PCM_S24LE_ENCODER 0
-%define CONFIG_PCM_S24LE_PLANAR_ENCODER 0
-%define CONFIG_PCM_S32BE_ENCODER 0
-%define CONFIG_PCM_S32LE_ENCODER 0
-%define CONFIG_PCM_S32LE_PLANAR_ENCODER 0
-%define CONFIG_PCM_S64BE_ENCODER 0
-%define CONFIG_PCM_S64LE_ENCODER 0
-%define CONFIG_PCM_U8_ENCODER 0
-%define CONFIG_PCM_U16BE_ENCODER 0
-%define CONFIG_PCM_U16LE_ENCODER 0
-%define CONFIG_PCM_U24BE_ENCODER 0
-%define CONFIG_PCM_U24LE_ENCODER 0
-%define CONFIG_PCM_U32BE_ENCODER 0
-%define CONFIG_PCM_U32LE_ENCODER 0
-%define CONFIG_ROQ_DPCM_ENCODER 0
-%define CONFIG_ADPCM_ADX_ENCODER 0
-%define CONFIG_ADPCM_G722_ENCODER 0
-%define CONFIG_ADPCM_G726_ENCODER 0
-%define CONFIG_ADPCM_IMA_QT_ENCODER 0
-%define CONFIG_ADPCM_IMA_WAV_ENCODER 0
-%define CONFIG_ADPCM_MS_ENCODER 0
-%define CONFIG_ADPCM_SWF_ENCODER 0
-%define CONFIG_ADPCM_YAMAHA_ENCODER 0
-%define CONFIG_SSA_ENCODER 0
-%define CONFIG_ASS_ENCODER 0
-%define CONFIG_DVBSUB_ENCODER 0
-%define CONFIG_DVDSUB_ENCODER 0
-%define CONFIG_MOVTEXT_ENCODER 0
-%define CONFIG_SRT_ENCODER 0
-%define CONFIG_SUBRIP_ENCODER 0
-%define CONFIG_TEXT_ENCODER 0
-%define CONFIG_WEBVTT_ENCODER 0
-%define CONFIG_XSUB_ENCODER 0
-%define CONFIG_AAC_AT_ENCODER 0
-%define CONFIG_ALAC_AT_ENCODER 0
-%define CONFIG_ILBC_AT_ENCODER 0
-%define CONFIG_PCM_ALAW_AT_ENCODER 0
-%define CONFIG_PCM_MULAW_AT_ENCODER 0
-%define CONFIG_LIBFDK_AAC_ENCODER 0
-%define CONFIG_LIBGSM_ENCODER 0
-%define CONFIG_LIBGSM_MS_ENCODER 0
-%define CONFIG_LIBILBC_ENCODER 0
-%define CONFIG_LIBMP3LAME_ENCODER 0
-%define CONFIG_LIBOPENCORE_AMRNB_ENCODER 0
-%define CONFIG_LIBOPENJPEG_ENCODER 0
-%define CONFIG_LIBOPUS_ENCODER 0
-%define CONFIG_LIBSCHROEDINGER_ENCODER 0
-%define CONFIG_LIBSHINE_ENCODER 0
-%define CONFIG_LIBSPEEX_ENCODER 0
-%define CONFIG_LIBTHEORA_ENCODER 0
-%define CONFIG_LIBTWOLAME_ENCODER 0
-%define CONFIG_LIBVO_AMRWBENC_ENCODER 0
-%define CONFIG_LIBVORBIS_ENCODER 0
-%define CONFIG_LIBVPX_VP8_ENCODER 0
-%define CONFIG_LIBVPX_VP9_ENCODER 0
-%define CONFIG_LIBWAVPACK_ENCODER 0
-%define CONFIG_LIBWEBP_ANIM_ENCODER 0
-%define CONFIG_LIBWEBP_ENCODER 0
-%define CONFIG_LIBX262_ENCODER 0
-%define CONFIG_LIBX264_ENCODER 0
-%define CONFIG_LIBX264RGB_ENCODER 0
-%define CONFIG_LIBX265_ENCODER 0
-%define CONFIG_LIBXAVS_ENCODER 0
-%define CONFIG_LIBXVID_ENCODER 0
-%define CONFIG_LIBOPENH264_ENCODER 0
-%define CONFIG_H264_NVENC_ENCODER 0
-%define CONFIG_H264_OMX_ENCODER 0
-%define CONFIG_H264_QSV_ENCODER 0
-%define CONFIG_H264_VAAPI_ENCODER 0
-%define CONFIG_H264_VIDEOTOOLBOX_ENCODER 0
-%define CONFIG_NVENC_ENCODER 0
-%define CONFIG_NVENC_H264_ENCODER 0
-%define CONFIG_NVENC_HEVC_ENCODER 0
-%define CONFIG_HEVC_NVENC_ENCODER 0
-%define CONFIG_HEVC_QSV_ENCODER 0
-%define CONFIG_HEVC_VAAPI_ENCODER 0
-%define CONFIG_LIBKVAZAAR_ENCODER 0
-%define CONFIG_MJPEG_VAAPI_ENCODER 0
-%define CONFIG_MPEG2_QSV_ENCODER 0
-%define CONFIG_ABENCH_FILTER 0
-%define CONFIG_ACOMPRESSOR_FILTER 0
-%define CONFIG_ACROSSFADE_FILTER 0
-%define CONFIG_ACRUSHER_FILTER 0
-%define CONFIG_ADELAY_FILTER 0
-%define CONFIG_AECHO_FILTER 0
-%define CONFIG_AEMPHASIS_FILTER 0
-%define CONFIG_AEVAL_FILTER 0
-%define CONFIG_AFADE_FILTER 0
-%define CONFIG_AFFTFILT_FILTER 0
-%define CONFIG_AFORMAT_FILTER 0
-%define CONFIG_AGATE_FILTER 0
-%define CONFIG_AINTERLEAVE_FILTER 0
-%define CONFIG_ALIMITER_FILTER 0
-%define CONFIG_ALLPASS_FILTER 0
-%define CONFIG_ALOOP_FILTER 0
-%define CONFIG_AMERGE_FILTER 0
-%define CONFIG_AMETADATA_FILTER 0
-%define CONFIG_AMIX_FILTER 0
-%define CONFIG_ANEQUALIZER_FILTER 0
-%define CONFIG_ANULL_FILTER 0
-%define CONFIG_APAD_FILTER 0
-%define CONFIG_APERMS_FILTER 0
-%define CONFIG_APHASER_FILTER 0
-%define CONFIG_APULSATOR_FILTER 0
-%define CONFIG_AREALTIME_FILTER 0
-%define CONFIG_ARESAMPLE_FILTER 0
-%define CONFIG_AREVERSE_FILTER 0
-%define CONFIG_ASELECT_FILTER 0
-%define CONFIG_ASENDCMD_FILTER 0
-%define CONFIG_ASETNSAMPLES_FILTER 0
-%define CONFIG_ASETPTS_FILTER 0
-%define CONFIG_ASETRATE_FILTER 0
-%define CONFIG_ASETTB_FILTER 0
-%define CONFIG_ASHOWINFO_FILTER 0
-%define CONFIG_ASIDEDATA_FILTER 0
-%define CONFIG_ASPLIT_FILTER 0
-%define CONFIG_ASTATS_FILTER 0
-%define CONFIG_ASTREAMSELECT_FILTER 0
-%define CONFIG_ASYNCTS_FILTER 0
-%define CONFIG_ATEMPO_FILTER 0
-%define CONFIG_ATRIM_FILTER 0
-%define CONFIG_AZMQ_FILTER 0
-%define CONFIG_BANDPASS_FILTER 0
-%define CONFIG_BANDREJECT_FILTER 0
-%define CONFIG_BASS_FILTER 0
-%define CONFIG_BIQUAD_FILTER 0
-%define CONFIG_BS2B_FILTER 0
-%define CONFIG_CHANNELMAP_FILTER 0
-%define CONFIG_CHANNELSPLIT_FILTER 0
-%define CONFIG_CHORUS_FILTER 0
-%define CONFIG_COMPAND_FILTER 0
-%define CONFIG_COMPENSATIONDELAY_FILTER 0
-%define CONFIG_CRYSTALIZER_FILTER 0
-%define CONFIG_DCSHIFT_FILTER 0
-%define CONFIG_DYNAUDNORM_FILTER 0
-%define CONFIG_EARWAX_FILTER 0
-%define CONFIG_EBUR128_FILTER 0
-%define CONFIG_EQUALIZER_FILTER 0
-%define CONFIG_EXTRASTEREO_FILTER 0
-%define CONFIG_FIREQUALIZER_FILTER 0
-%define CONFIG_FLANGER_FILTER 0
-%define CONFIG_HDCD_FILTER 0
-%define CONFIG_HIGHPASS_FILTER 0
-%define CONFIG_JOIN_FILTER 0
-%define CONFIG_LADSPA_FILTER 0
-%define CONFIG_LOUDNORM_FILTER 0
-%define CONFIG_LOWPASS_FILTER 0
-%define CONFIG_PAN_FILTER 0
-%define CONFIG_REPLAYGAIN_FILTER 0
-%define CONFIG_RESAMPLE_FILTER 0
-%define CONFIG_RUBBERBAND_FILTER 0
-%define CONFIG_SIDECHAINCOMPRESS_FILTER 0
-%define CONFIG_SIDECHAINGATE_FILTER 0
-%define CONFIG_SILENCEDETECT_FILTER 0
-%define CONFIG_SILENCEREMOVE_FILTER 0
-%define CONFIG_SOFALIZER_FILTER 0
-%define CONFIG_STEREOTOOLS_FILTER 0
-%define CONFIG_STEREOWIDEN_FILTER 0
-%define CONFIG_TREBLE_FILTER 0
-%define CONFIG_TREMOLO_FILTER 0
-%define CONFIG_VIBRATO_FILTER 0
-%define CONFIG_VOLUME_FILTER 0
-%define CONFIG_VOLUMEDETECT_FILTER 0
-%define CONFIG_AEVALSRC_FILTER 0
-%define CONFIG_ANOISESRC_FILTER 0
-%define CONFIG_ANULLSRC_FILTER 0
-%define CONFIG_FLITE_FILTER 0
-%define CONFIG_SINE_FILTER 0
-%define CONFIG_ANULLSINK_FILTER 0
-%define CONFIG_ALPHAEXTRACT_FILTER 0
-%define CONFIG_ALPHAMERGE_FILTER 0
-%define CONFIG_ASS_FILTER 0
-%define CONFIG_ATADENOISE_FILTER 0
-%define CONFIG_AVGBLUR_FILTER 0
-%define CONFIG_BBOX_FILTER 0
-%define CONFIG_BENCH_FILTER 0
-%define CONFIG_BITPLANENOISE_FILTER 0
-%define CONFIG_BLACKDETECT_FILTER 0
-%define CONFIG_BLACKFRAME_FILTER 0
-%define CONFIG_BLEND_FILTER 0
-%define CONFIG_BOXBLUR_FILTER 0
-%define CONFIG_BWDIF_FILTER 0
-%define CONFIG_CHROMAKEY_FILTER 0
-%define CONFIG_CIESCOPE_FILTER 0
-%define CONFIG_CODECVIEW_FILTER 0
-%define CONFIG_COLORBALANCE_FILTER 0
-%define CONFIG_COLORCHANNELMIXER_FILTER 0
-%define CONFIG_COLORKEY_FILTER 0
-%define CONFIG_COLORLEVELS_FILTER 0
-%define CONFIG_COLORMATRIX_FILTER 0
-%define CONFIG_COLORSPACE_FILTER 0
-%define CONFIG_CONVOLUTION_FILTER 0
-%define CONFIG_COPY_FILTER 0
-%define CONFIG_COREIMAGE_FILTER 0
-%define CONFIG_COVER_RECT_FILTER 0
-%define CONFIG_CROP_FILTER 0
-%define CONFIG_CROPDETECT_FILTER 0
-%define CONFIG_CURVES_FILTER 0
-%define CONFIG_DATASCOPE_FILTER 0
-%define CONFIG_DCTDNOIZ_FILTER 0
-%define CONFIG_DEBAND_FILTER 0
-%define CONFIG_DECIMATE_FILTER 0
-%define CONFIG_DEFLATE_FILTER 0
-%define CONFIG_DEJUDDER_FILTER 0
-%define CONFIG_DELOGO_FILTER 0
-%define CONFIG_DESHAKE_FILTER 0
-%define CONFIG_DETELECINE_FILTER 0
-%define CONFIG_DILATION_FILTER 0
-%define CONFIG_DISPLACE_FILTER 0
-%define CONFIG_DRAWBOX_FILTER 0
-%define CONFIG_DRAWGRAPH_FILTER 0
-%define CONFIG_DRAWGRID_FILTER 0
-%define CONFIG_DRAWTEXT_FILTER 0
-%define CONFIG_EDGEDETECT_FILTER 0
-%define CONFIG_ELBG_FILTER 0
-%define CONFIG_EQ_FILTER 0
-%define CONFIG_EROSION_FILTER 0
-%define CONFIG_EXTRACTPLANES_FILTER 0
-%define CONFIG_FADE_FILTER 0
-%define CONFIG_FFTFILT_FILTER 0
-%define CONFIG_FIELD_FILTER 0
-%define CONFIG_FIELDHINT_FILTER 0
-%define CONFIG_FIELDMATCH_FILTER 0
-%define CONFIG_FIELDORDER_FILTER 0
-%define CONFIG_FIND_RECT_FILTER 0
-%define CONFIG_FORMAT_FILTER 0
-%define CONFIG_FPS_FILTER 0
-%define CONFIG_FRAMEPACK_FILTER 0
-%define CONFIG_FRAMERATE_FILTER 0
-%define CONFIG_FRAMESTEP_FILTER 0
-%define CONFIG_FREI0R_FILTER 0
-%define CONFIG_FSPP_FILTER 0
-%define CONFIG_GBLUR_FILTER 0
-%define CONFIG_GEQ_FILTER 0
-%define CONFIG_GRADFUN_FILTER 0
-%define CONFIG_HALDCLUT_FILTER 0
-%define CONFIG_HFLIP_FILTER 0
-%define CONFIG_HISTEQ_FILTER 0
-%define CONFIG_HISTOGRAM_FILTER 0
-%define CONFIG_HQDN3D_FILTER 0
-%define CONFIG_HQX_FILTER 0
-%define CONFIG_HSTACK_FILTER 0
-%define CONFIG_HUE_FILTER 0
-%define CONFIG_HWDOWNLOAD_FILTER 0
-%define CONFIG_HWUPLOAD_FILTER 0
-%define CONFIG_HWUPLOAD_CUDA_FILTER 0
-%define CONFIG_HYSTERESIS_FILTER 0
-%define CONFIG_IDET_FILTER 0
-%define CONFIG_IL_FILTER 0
-%define CONFIG_INFLATE_FILTER 0
-%define CONFIG_INTERLACE_FILTER 0
-%define CONFIG_INTERLEAVE_FILTER 0
-%define CONFIG_KERNDEINT_FILTER 0
-%define CONFIG_LENSCORRECTION_FILTER 0
-%define CONFIG_LOOP_FILTER 0
-%define CONFIG_LUT_FILTER 0
-%define CONFIG_LUT2_FILTER 0
-%define CONFIG_LUT3D_FILTER 0
-%define CONFIG_LUTRGB_FILTER 0
-%define CONFIG_LUTYUV_FILTER 0
-%define CONFIG_MASKEDCLAMP_FILTER 0
-%define CONFIG_MASKEDMERGE_FILTER 0
-%define CONFIG_MCDEINT_FILTER 0
-%define CONFIG_MERGEPLANES_FILTER 0
-%define CONFIG_MESTIMATE_FILTER 0
-%define CONFIG_METADATA_FILTER 0
-%define CONFIG_MINTERPOLATE_FILTER 0
-%define CONFIG_MPDECIMATE_FILTER 0
-%define CONFIG_NEGATE_FILTER 0
-%define CONFIG_NLMEANS_FILTER 0
-%define CONFIG_NNEDI_FILTER 0
-%define CONFIG_NOFORMAT_FILTER 0
-%define CONFIG_NOISE_FILTER 0
-%define CONFIG_NULL_FILTER 0
-%define CONFIG_OCR_FILTER 0
-%define CONFIG_OCV_FILTER 0
-%define CONFIG_OVERLAY_FILTER 0
-%define CONFIG_OWDENOISE_FILTER 0
-%define CONFIG_PAD_FILTER 0
-%define CONFIG_PALETTEGEN_FILTER 0
-%define CONFIG_PALETTEUSE_FILTER 0
-%define CONFIG_PERMS_FILTER 0
-%define CONFIG_PERSPECTIVE_FILTER 0
-%define CONFIG_PHASE_FILTER 0
-%define CONFIG_PIXDESCTEST_FILTER 0
-%define CONFIG_PP_FILTER 0
-%define CONFIG_PP7_FILTER 0
-%define CONFIG_PREWITT_FILTER 0
-%define CONFIG_PSNR_FILTER 0
-%define CONFIG_PULLUP_FILTER 0
-%define CONFIG_QP_FILTER 0
-%define CONFIG_RANDOM_FILTER 0
-%define CONFIG_READVITC_FILTER 0
-%define CONFIG_REALTIME_FILTER 0
-%define CONFIG_REMAP_FILTER 0
-%define CONFIG_REMOVEGRAIN_FILTER 0
-%define CONFIG_REMOVELOGO_FILTER 0
-%define CONFIG_REPEATFIELDS_FILTER 0
-%define CONFIG_REVERSE_FILTER 0
-%define CONFIG_ROTATE_FILTER 0
-%define CONFIG_SAB_FILTER 0
-%define CONFIG_SCALE_FILTER 0
-%define CONFIG_SCALE_NPP_FILTER 0
-%define CONFIG_SCALE_VAAPI_FILTER 0
-%define CONFIG_SCALE2REF_FILTER 0
-%define CONFIG_SELECT_FILTER 0
-%define CONFIG_SELECTIVECOLOR_FILTER 0
-%define CONFIG_SENDCMD_FILTER 0
-%define CONFIG_SEPARATEFIELDS_FILTER 0
-%define CONFIG_SETDAR_FILTER 0
-%define CONFIG_SETFIELD_FILTER 0
-%define CONFIG_SETPTS_FILTER 0
-%define CONFIG_SETSAR_FILTER 0
-%define CONFIG_SETTB_FILTER 0
-%define CONFIG_SHOWINFO_FILTER 0
-%define CONFIG_SHOWPALETTE_FILTER 0
-%define CONFIG_SHUFFLEFRAMES_FILTER 0
-%define CONFIG_SHUFFLEPLANES_FILTER 0
-%define CONFIG_SIDEDATA_FILTER 0
-%define CONFIG_SIGNALSTATS_FILTER 0
-%define CONFIG_SMARTBLUR_FILTER 0
-%define CONFIG_SOBEL_FILTER 0
-%define CONFIG_SPLIT_FILTER 0
-%define CONFIG_SPP_FILTER 0
-%define CONFIG_SSIM_FILTER 0
-%define CONFIG_STEREO3D_FILTER 0
-%define CONFIG_STREAMSELECT_FILTER 0
-%define CONFIG_SUBTITLES_FILTER 0
-%define CONFIG_SUPER2XSAI_FILTER 0
-%define CONFIG_SWAPRECT_FILTER 0
-%define CONFIG_SWAPUV_FILTER 0
-%define CONFIG_TBLEND_FILTER 0
-%define CONFIG_TELECINE_FILTER 0
-%define CONFIG_THUMBNAIL_FILTER 0
-%define CONFIG_TILE_FILTER 0
-%define CONFIG_TINTERLACE_FILTER 0
-%define CONFIG_TRANSPOSE_FILTER 0
-%define CONFIG_TRIM_FILTER 0
-%define CONFIG_UNSHARP_FILTER 0
-%define CONFIG_USPP_FILTER 0
-%define CONFIG_VAGUEDENOISER_FILTER 0
-%define CONFIG_VECTORSCOPE_FILTER 0
-%define CONFIG_VFLIP_FILTER 0
-%define CONFIG_VIDSTABDETECT_FILTER 0
-%define CONFIG_VIDSTABTRANSFORM_FILTER 0
-%define CONFIG_VIGNETTE_FILTER 0
-%define CONFIG_VSTACK_FILTER 0
-%define CONFIG_W3FDIF_FILTER 0
-%define CONFIG_WAVEFORM_FILTER 0
-%define CONFIG_WEAVE_FILTER 0
-%define CONFIG_XBR_FILTER 0
-%define CONFIG_YADIF_FILTER 0
-%define CONFIG_ZMQ_FILTER 0
-%define CONFIG_ZOOMPAN_FILTER 0
-%define CONFIG_ZSCALE_FILTER 0
-%define CONFIG_ALLRGB_FILTER 0
-%define CONFIG_ALLYUV_FILTER 0
-%define CONFIG_CELLAUTO_FILTER 0
-%define CONFIG_COLOR_FILTER 0
-%define CONFIG_COREIMAGESRC_FILTER 0
-%define CONFIG_FREI0R_SRC_FILTER 0
-%define CONFIG_HALDCLUTSRC_FILTER 0
-%define CONFIG_LIFE_FILTER 0
-%define CONFIG_MANDELBROT_FILTER 0
-%define CONFIG_MPTESTSRC_FILTER 0
-%define CONFIG_NULLSRC_FILTER 0
-%define CONFIG_RGBTESTSRC_FILTER 0
-%define CONFIG_SMPTEBARS_FILTER 0
-%define CONFIG_SMPTEHDBARS_FILTER 0
-%define CONFIG_TESTSRC_FILTER 0
-%define CONFIG_TESTSRC2_FILTER 0
-%define CONFIG_YUVTESTSRC_FILTER 0
-%define CONFIG_NULLSINK_FILTER 0
-%define CONFIG_ADRAWGRAPH_FILTER 0
-%define CONFIG_AHISTOGRAM_FILTER 0
-%define CONFIG_APHASEMETER_FILTER 0
-%define CONFIG_AVECTORSCOPE_FILTER 0
-%define CONFIG_CONCAT_FILTER 0
-%define CONFIG_SHOWCQT_FILTER 0
-%define CONFIG_SHOWFREQS_FILTER 0
-%define CONFIG_SHOWSPECTRUM_FILTER 0
-%define CONFIG_SHOWSPECTRUMPIC_FILTER 0
-%define CONFIG_SHOWVOLUME_FILTER 0
-%define CONFIG_SHOWWAVES_FILTER 0
-%define CONFIG_SHOWWAVESPIC_FILTER 0
-%define CONFIG_SPECTRUMSYNTH_FILTER 0
-%define CONFIG_AMOVIE_FILTER 0
-%define CONFIG_MOVIE_FILTER 0
-%define CONFIG_H263_CUVID_HWACCEL 0
-%define CONFIG_H263_VAAPI_HWACCEL 0
-%define CONFIG_H263_VIDEOTOOLBOX_HWACCEL 0
-%define CONFIG_H264_CUVID_HWACCEL 0
-%define CONFIG_H264_D3D11VA_HWACCEL 0
-%define CONFIG_H264_DXVA2_HWACCEL 0
-%define CONFIG_H264_MEDIACODEC_HWACCEL 0
-%define CONFIG_H264_MMAL_HWACCEL 0
-%define CONFIG_H264_QSV_HWACCEL 0
-%define CONFIG_H264_VAAPI_HWACCEL 0
-%define CONFIG_H264_VDA_HWACCEL 0
-%define CONFIG_H264_VDA_OLD_HWACCEL 0
-%define CONFIG_H264_VDPAU_HWACCEL 0
-%define CONFIG_H264_VIDEOTOOLBOX_HWACCEL 0
-%define CONFIG_HEVC_CUVID_HWACCEL 0
-%define CONFIG_HEVC_D3D11VA_HWACCEL 0
-%define CONFIG_HEVC_DXVA2_HWACCEL 0
-%define CONFIG_HEVC_MEDIACODEC_HWACCEL 0
-%define CONFIG_HEVC_QSV_HWACCEL 0
-%define CONFIG_HEVC_VAAPI_HWACCEL 0
-%define CONFIG_HEVC_VDPAU_HWACCEL 0
-%define CONFIG_MJPEG_CUVID_HWACCEL 0
-%define CONFIG_MPEG1_CUVID_HWACCEL 0
-%define CONFIG_MPEG1_XVMC_HWACCEL 0
-%define CONFIG_MPEG1_VDPAU_HWACCEL 0
-%define CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL 0
-%define CONFIG_MPEG2_CUVID_HWACCEL 0
-%define CONFIG_MPEG2_XVMC_HWACCEL 0
-%define CONFIG_MPEG2_D3D11VA_HWACCEL 0
-%define CONFIG_MPEG2_DXVA2_HWACCEL 0
-%define CONFIG_MPEG2_MMAL_HWACCEL 0
-%define CONFIG_MPEG2_QSV_HWACCEL 0
-%define CONFIG_MPEG2_VAAPI_HWACCEL 0
-%define CONFIG_MPEG2_VDPAU_HWACCEL 0
-%define CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL 0
-%define CONFIG_MPEG4_CUVID_HWACCEL 0
-%define CONFIG_MPEG4_MEDIACODEC_HWACCEL 0
-%define CONFIG_MPEG4_MMAL_HWACCEL 0
-%define CONFIG_MPEG4_VAAPI_HWACCEL 0
-%define CONFIG_MPEG4_VDPAU_HWACCEL 0
-%define CONFIG_MPEG4_VIDEOTOOLBOX_HWACCEL 0
-%define CONFIG_VC1_CUVID_HWACCEL 0
-%define CONFIG_VC1_D3D11VA_HWACCEL 0
-%define CONFIG_VC1_DXVA2_HWACCEL 0
-%define CONFIG_VC1_VAAPI_HWACCEL 0
-%define CONFIG_VC1_VDPAU_HWACCEL 0
-%define CONFIG_VC1_MMAL_HWACCEL 0
-%define CONFIG_VC1_QSV_HWACCEL 0
-%define CONFIG_VP8_CUVID_HWACCEL 0
-%define CONFIG_VP8_MEDIACODEC_HWACCEL 0
-%define CONFIG_VP9_CUVID_HWACCEL 0
-%define CONFIG_VP9_D3D11VA_HWACCEL 0
-%define CONFIG_VP9_DXVA2_HWACCEL 0
-%define CONFIG_VP9_MEDIACODEC_HWACCEL 0
-%define CONFIG_VP9_VAAPI_HWACCEL 0
-%define CONFIG_WMV3_D3D11VA_HWACCEL 0
-%define CONFIG_WMV3_DXVA2_HWACCEL 0
-%define CONFIG_WMV3_VAAPI_HWACCEL 0
-%define CONFIG_WMV3_VDPAU_HWACCEL 0
-%define CONFIG_ALSA_INDEV 0
-%define CONFIG_AVFOUNDATION_INDEV 0
-%define CONFIG_BKTR_INDEV 0
-%define CONFIG_DECKLINK_INDEV 0
-%define CONFIG_DSHOW_INDEV 0
-%define CONFIG_DV1394_INDEV 0
-%define CONFIG_FBDEV_INDEV 0
-%define CONFIG_GDIGRAB_INDEV 0
-%define CONFIG_IEC61883_INDEV 0
-%define CONFIG_JACK_INDEV 0
-%define CONFIG_LAVFI_INDEV 0
-%define CONFIG_OPENAL_INDEV 0
-%define CONFIG_OSS_INDEV 0
-%define CONFIG_PULSE_INDEV 0
-%define CONFIG_QTKIT_INDEV 0
-%define CONFIG_SNDIO_INDEV 0
-%define CONFIG_V4L2_INDEV 0
-%define CONFIG_VFWCAP_INDEV 0
-%define CONFIG_X11GRAB_INDEV 0
-%define CONFIG_X11GRAB_XCB_INDEV 0
-%define CONFIG_LIBCDIO_INDEV 0
-%define CONFIG_LIBDC1394_INDEV 0
-%define CONFIG_A64_MUXER 0
-%define CONFIG_AC3_MUXER 0
-%define CONFIG_ADTS_MUXER 0
-%define CONFIG_ADX_MUXER 0
-%define CONFIG_AIFF_MUXER 0
-%define CONFIG_AMR_MUXER 0
-%define CONFIG_APNG_MUXER 0
-%define CONFIG_ASF_MUXER 0
-%define CONFIG_ASS_MUXER 0
-%define CONFIG_AST_MUXER 0
-%define CONFIG_ASF_STREAM_MUXER 0
-%define CONFIG_AU_MUXER 0
-%define CONFIG_AVI_MUXER 0
-%define CONFIG_AVM2_MUXER 0
-%define CONFIG_BIT_MUXER 0
-%define CONFIG_CAF_MUXER 0
-%define CONFIG_CAVSVIDEO_MUXER 0
-%define CONFIG_CRC_MUXER 0
-%define CONFIG_DASH_MUXER 0
-%define CONFIG_DATA_MUXER 0
-%define CONFIG_DAUD_MUXER 0
-%define CONFIG_DIRAC_MUXER 0
-%define CONFIG_DNXHD_MUXER 0
-%define CONFIG_DTS_MUXER 0
-%define CONFIG_DV_MUXER 0
-%define CONFIG_EAC3_MUXER 0
-%define CONFIG_F4V_MUXER 0
-%define CONFIG_FFM_MUXER 0
-%define CONFIG_FFMETADATA_MUXER 0
-%define CONFIG_FIFO_MUXER 0
-%define CONFIG_FILMSTRIP_MUXER 0
-%define CONFIG_FLAC_MUXER 0
-%define CONFIG_FLV_MUXER 0
-%define CONFIG_FRAMECRC_MUXER 0
-%define CONFIG_FRAMEHASH_MUXER 0
-%define CONFIG_FRAMEMD5_MUXER 0
-%define CONFIG_G722_MUXER 0
-%define CONFIG_G723_1_MUXER 0
-%define CONFIG_GIF_MUXER 0
-%define CONFIG_GSM_MUXER 0
-%define CONFIG_GXF_MUXER 0
-%define CONFIG_H261_MUXER 0
-%define CONFIG_H263_MUXER 0
-%define CONFIG_H264_MUXER 0
-%define CONFIG_HASH_MUXER 0
-%define CONFIG_HDS_MUXER 0
-%define CONFIG_HEVC_MUXER 0
-%define CONFIG_HLS_MUXER 0
-%define CONFIG_ICO_MUXER 0
-%define CONFIG_ILBC_MUXER 0
-%define CONFIG_IMAGE2_MUXER 0
-%define CONFIG_IMAGE2PIPE_MUXER 0
-%define CONFIG_IPOD_MUXER 0
-%define CONFIG_IRCAM_MUXER 0
-%define CONFIG_ISMV_MUXER 0
-%define CONFIG_IVF_MUXER 0
-%define CONFIG_JACOSUB_MUXER 0
-%define CONFIG_LATM_MUXER 0
-%define CONFIG_LRC_MUXER 0
-%define CONFIG_M4V_MUXER 0
-%define CONFIG_MD5_MUXER 0
-%define CONFIG_MATROSKA_MUXER 0
-%define CONFIG_MATROSKA_AUDIO_MUXER 0
-%define CONFIG_MICRODVD_MUXER 0
-%define CONFIG_MJPEG_MUXER 0
-%define CONFIG_MLP_MUXER 0
-%define CONFIG_MMF_MUXER 0
-%define CONFIG_MOV_MUXER 0
-%define CONFIG_MP2_MUXER 0
-%define CONFIG_MP3_MUXER 0
-%define CONFIG_MP4_MUXER 0
-%define CONFIG_MPEG1SYSTEM_MUXER 0
-%define CONFIG_MPEG1VCD_MUXER 0
-%define CONFIG_MPEG1VIDEO_MUXER 0
-%define CONFIG_MPEG2DVD_MUXER 0
-%define CONFIG_MPEG2SVCD_MUXER 0
-%define CONFIG_MPEG2VIDEO_MUXER 0
-%define CONFIG_MPEG2VOB_MUXER 0
-%define CONFIG_MPEGTS_MUXER 0
-%define CONFIG_MPJPEG_MUXER 0
-%define CONFIG_MXF_MUXER 0
-%define CONFIG_MXF_D10_MUXER 0
-%define CONFIG_MXF_OPATOM_MUXER 0
-%define CONFIG_NULL_MUXER 0
-%define CONFIG_NUT_MUXER 0
-%define CONFIG_OGA_MUXER 0
-%define CONFIG_OGG_MUXER 0
-%define CONFIG_OGV_MUXER 0
-%define CONFIG_OMA_MUXER 0
-%define CONFIG_OPUS_MUXER 0
-%define CONFIG_PCM_ALAW_MUXER 0
-%define CONFIG_PCM_MULAW_MUXER 0
-%define CONFIG_PCM_F64BE_MUXER 0
-%define CONFIG_PCM_F64LE_MUXER 0
-%define CONFIG_PCM_F32BE_MUXER 0
-%define CONFIG_PCM_F32LE_MUXER 0
-%define CONFIG_PCM_S32BE_MUXER 0
-%define CONFIG_PCM_S32LE_MUXER 0
-%define CONFIG_PCM_S24BE_MUXER 0
-%define CONFIG_PCM_S24LE_MUXER 0
-%define CONFIG_PCM_S16BE_MUXER 0
-%define CONFIG_PCM_S16LE_MUXER 0
-%define CONFIG_PCM_S8_MUXER 0
-%define CONFIG_PCM_U32BE_MUXER 0
-%define CONFIG_PCM_U32LE_MUXER 0
-%define CONFIG_PCM_U24BE_MUXER 0
-%define CONFIG_PCM_U24LE_MUXER 0
-%define CONFIG_PCM_U16BE_MUXER 0
-%define CONFIG_PCM_U16LE_MUXER 0
-%define CONFIG_PCM_U8_MUXER 0
-%define CONFIG_PSP_MUXER 0
-%define CONFIG_RAWVIDEO_MUXER 0
-%define CONFIG_RM_MUXER 0
-%define CONFIG_ROQ_MUXER 0
-%define CONFIG_RSO_MUXER 0
-%define CONFIG_RTP_MUXER 0
-%define CONFIG_RTP_MPEGTS_MUXER 0
-%define CONFIG_RTSP_MUXER 0
-%define CONFIG_SAP_MUXER 0
-%define CONFIG_SEGMENT_MUXER 0
-%define CONFIG_STREAM_SEGMENT_MUXER 0
-%define CONFIG_SINGLEJPEG_MUXER 0
-%define CONFIG_SMJPEG_MUXER 0
-%define CONFIG_SMOOTHSTREAMING_MUXER 0
-%define CONFIG_SOX_MUXER 0
-%define CONFIG_SPX_MUXER 0
-%define CONFIG_SPDIF_MUXER 0
-%define CONFIG_SRT_MUXER 0
-%define CONFIG_SWF_MUXER 0
-%define CONFIG_TEE_MUXER 0
-%define CONFIG_TG2_MUXER 0
-%define CONFIG_TGP_MUXER 0
-%define CONFIG_MKVTIMESTAMP_V2_MUXER 0
-%define CONFIG_TRUEHD_MUXER 0
-%define CONFIG_TTA_MUXER 0
-%define CONFIG_UNCODEDFRAMECRC_MUXER 0
-%define CONFIG_VC1_MUXER 0
-%define CONFIG_VC1T_MUXER 0
-%define CONFIG_VOC_MUXER 0
-%define CONFIG_W64_MUXER 0
-%define CONFIG_WAV_MUXER 0
-%define CONFIG_WEBM_MUXER 0
-%define CONFIG_WEBM_DASH_MANIFEST_MUXER 0
-%define CONFIG_WEBM_CHUNK_MUXER 0
-%define CONFIG_WEBP_MUXER 0
-%define CONFIG_WEBVTT_MUXER 0
-%define CONFIG_WTV_MUXER 0
-%define CONFIG_WV_MUXER 0
-%define CONFIG_YUV4MPEGPIPE_MUXER 0
-%define CONFIG_CHROMAPRINT_MUXER 0
-%define CONFIG_LIBNUT_MUXER 0
-%define CONFIG_ALSA_OUTDEV 0
-%define CONFIG_CACA_OUTDEV 0
-%define CONFIG_DECKLINK_OUTDEV 0
-%define CONFIG_FBDEV_OUTDEV 0
-%define CONFIG_OPENGL_OUTDEV 0
-%define CONFIG_OSS_OUTDEV 0
-%define CONFIG_PULSE_OUTDEV 0
-%define CONFIG_SDL2_OUTDEV 0
-%define CONFIG_SNDIO_OUTDEV 0
-%define CONFIG_V4L2_OUTDEV 0
-%define CONFIG_XV_OUTDEV 0
-%define CONFIG_AAC_PARSER 0
-%define CONFIG_AAC_LATM_PARSER 0
-%define CONFIG_AC3_PARSER 0
-%define CONFIG_ADX_PARSER 0
-%define CONFIG_BMP_PARSER 0
-%define CONFIG_CAVSVIDEO_PARSER 0
-%define CONFIG_COOK_PARSER 0
-%define CONFIG_DCA_PARSER 0
-%define CONFIG_DIRAC_PARSER 0
-%define CONFIG_DNXHD_PARSER 0
-%define CONFIG_DPX_PARSER 0
-%define CONFIG_DVAUDIO_PARSER 0
-%define CONFIG_DVBSUB_PARSER 0
-%define CONFIG_DVDSUB_PARSER 0
-%define CONFIG_DVD_NAV_PARSER 0
-%define CONFIG_FLAC_PARSER 1
-%define CONFIG_G729_PARSER 0
-%define CONFIG_GSM_PARSER 0
-%define CONFIG_H261_PARSER 0
-%define CONFIG_H263_PARSER 0
-%define CONFIG_H264_PARSER 0
-%define CONFIG_HEVC_PARSER 0
-%define CONFIG_MJPEG_PARSER 0
-%define CONFIG_MLP_PARSER 0
-%define CONFIG_MPEG4VIDEO_PARSER 0
-%define CONFIG_MPEGAUDIO_PARSER 0
-%define CONFIG_MPEGVIDEO_PARSER 0
-%define CONFIG_OPUS_PARSER 0
-%define CONFIG_PNG_PARSER 0
-%define CONFIG_PNM_PARSER 0
-%define CONFIG_RV30_PARSER 0
-%define CONFIG_RV40_PARSER 0
-%define CONFIG_TAK_PARSER 0
-%define CONFIG_VC1_PARSER 0
-%define CONFIG_VORBIS_PARSER 0
-%define CONFIG_VP3_PARSER 0
+%define CONFIG_FLAC_PARSER 0
%define CONFIG_VP8_PARSER 1
%define CONFIG_VP9_PARSER 1
-%define CONFIG_ASYNC_PROTOCOL 0
-%define CONFIG_BLURAY_PROTOCOL 0
-%define CONFIG_CACHE_PROTOCOL 0
-%define CONFIG_CONCAT_PROTOCOL 0
-%define CONFIG_CRYPTO_PROTOCOL 0
-%define CONFIG_DATA_PROTOCOL 0
-%define CONFIG_FFRTMPCRYPT_PROTOCOL 0
-%define CONFIG_FFRTMPHTTP_PROTOCOL 0
-%define CONFIG_FILE_PROTOCOL 0
-%define CONFIG_FTP_PROTOCOL 0
-%define CONFIG_GOPHER_PROTOCOL 0
-%define CONFIG_HLS_PROTOCOL 0
-%define CONFIG_HTTP_PROTOCOL 0
-%define CONFIG_HTTPPROXY_PROTOCOL 0
-%define CONFIG_HTTPS_PROTOCOL 0
-%define CONFIG_ICECAST_PROTOCOL 0
-%define CONFIG_MMSH_PROTOCOL 0
-%define CONFIG_MMST_PROTOCOL 0
-%define CONFIG_MD5_PROTOCOL 0
-%define CONFIG_PIPE_PROTOCOL 0
-%define CONFIG_RTMP_PROTOCOL 0
-%define CONFIG_RTMPE_PROTOCOL 0
-%define CONFIG_RTMPS_PROTOCOL 0
-%define CONFIG_RTMPT_PROTOCOL 0
-%define CONFIG_RTMPTE_PROTOCOL 0
-%define CONFIG_RTMPTS_PROTOCOL 0
-%define CONFIG_RTP_PROTOCOL 0
-%define CONFIG_SCTP_PROTOCOL 0
-%define CONFIG_SRTP_PROTOCOL 0
-%define CONFIG_SUBFILE_PROTOCOL 0
-%define CONFIG_TEE_PROTOCOL 0
-%define CONFIG_TCP_PROTOCOL 0
-%define CONFIG_TLS_GNUTLS_PROTOCOL 0
-%define CONFIG_TLS_SCHANNEL_PROTOCOL 0
-%define CONFIG_TLS_SECURETRANSPORT_PROTOCOL 0
-%define CONFIG_TLS_OPENSSL_PROTOCOL 0
-%define CONFIG_UDP_PROTOCOL 0
-%define CONFIG_UDPLITE_PROTOCOL 0
-%define CONFIG_UNIX_PROTOCOL 0
-%define CONFIG_LIBRTMP_PROTOCOL 0
-%define CONFIG_LIBRTMPE_PROTOCOL 0
-%define CONFIG_LIBRTMPS_PROTOCOL 0
-%define CONFIG_LIBRTMPT_PROTOCOL 0
-%define CONFIG_LIBRTMPTE_PROTOCOL 0
-%define CONFIG_LIBSSH_PROTOCOL 0
-%define CONFIG_LIBSMBCLIENT_PROTOCOL 0
diff --git a/media/ffvpx/config_unix64.h b/media/ffvpx/config_unix64.h
index 26d6be5d4f..97bc765f84 100644
--- a/media/ffvpx/config_unix64.h
+++ b/media/ffvpx/config_unix64.h
@@ -1,12 +1,12 @@
/* Automatically generated by configure - do not modify! */
#ifndef FFMPEG_CONFIG_H
#define FFMPEG_CONFIG_H
-#define FFMPEG_CONFIGURATION "--disable-everything --disable-protocols --disable-demuxers --disable-muxers --disable-filters --disable-programs --disable-doc --disable-parsers --enable-parser=vp8 --enable-parser=vp9 --enable-decoder=vp8 --enable-decoder=vp9 --disable-static --enable-shared --disable-debug --disable-sdl --disable-libxcb --disable-securetransport --disable-iconv --disable-swresample --disable-swscale --disable-avdevice --disable-avfilter --disable-avformat --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vda --disable-vdpau --disable-videotoolbox --enable-asm --enable-yasm --disable-avx2"
+#define FFMPEG_CONFIGURATION "--disable-everything --disable-protocols --disable-demuxers --disable-muxers --disable-filters --disable-programs --disable-doc --disable-parsers --enable-parser=vp8 --enable-parser=vp9 --enable-decoder=vp8 --enable-decoder=vp9 --disable-static --enable-shared --disable-debug --disable-sdl2 --disable-libxcb --disable-securetransport --disable-iconv --disable-swresample --disable-swscale --disable-avdevice --disable-avfilter --disable-avformat --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vda --disable-vdpau --disable-videotoolbox --enable-decoder=flac --enable-asm --enable-x86asm"
#define FFMPEG_LICENSE "LGPL version 2.1 or later"
-#define CONFIG_THIS_YEAR 2016
+#define CONFIG_THIS_YEAR 2017
#define FFMPEG_DATADIR "/usr/local/share/ffmpeg"
#define AVCONV_DATADIR "/usr/local/share/ffmpeg"
-#define CC_IDENT "gcc 4.6 (Ubuntu/Linaro 4.6.3-1ubuntu5)"
+#define CC_IDENT "gcc 6.3.0 (Ubuntu 6.3.0-12ubuntu2) 20170406"
#define av_restrict restrict
#define EXTERN_PREFIX ""
#define EXTERN_ASM
@@ -56,7 +56,7 @@
#define HAVE_AMD3DNOW 1
#define HAVE_AMD3DNOWEXT 1
#define HAVE_AVX 1
-#define HAVE_AVX2 0
+#define HAVE_AVX2 1
#define HAVE_FMA3 1
#define HAVE_FMA4 1
#define HAVE_MMX 1
@@ -79,8 +79,8 @@
#define HAVE_MIPSDSP 0
#define HAVE_MIPSDSPR2 0
#define HAVE_MSA 0
-#define HAVE_LOONGSON2 1
-#define HAVE_LOONGSON3 1
+#define HAVE_LOONGSON2 0
+#define HAVE_LOONGSON3 0
#define HAVE_MMI 0
#define HAVE_ARMV5TE_EXTERNAL 0
#define HAVE_ARMV6_EXTERNAL 0
@@ -100,7 +100,7 @@
#define HAVE_AMD3DNOW_EXTERNAL 1
#define HAVE_AMD3DNOWEXT_EXTERNAL 1
#define HAVE_AVX_EXTERNAL 1
-#define HAVE_AVX2_EXTERNAL 0
+#define HAVE_AVX2_EXTERNAL 1
#define HAVE_FMA3_EXTERNAL 1
#define HAVE_FMA4_EXTERNAL 1
#define HAVE_MMX_EXTERNAL 1
@@ -144,7 +144,7 @@
#define HAVE_AMD3DNOW_INLINE 1
#define HAVE_AMD3DNOWEXT_INLINE 1
#define HAVE_AVX_INLINE 1
-#define HAVE_AVX2_INLINE 0
+#define HAVE_AVX2_INLINE 1
#define HAVE_FMA3_INLINE 1
#define HAVE_FMA4_INLINE 1
#define HAVE_MMX_INLINE 1
@@ -178,11 +178,11 @@
#define HAVE_LOCAL_ALIGNED_16 1
#define HAVE_LOCAL_ALIGNED_32 1
#define HAVE_SIMD_ALIGN_16 1
+#define HAVE_SIMD_ALIGN_32 1
#define HAVE_ATOMICS_GCC 1
#define HAVE_ATOMICS_SUNCC 0
#define HAVE_ATOMICS_WIN32 0
#define HAVE_ATOMIC_CAS_PTR 0
-#define HAVE_ATOMIC_COMPARE_EXCHANGE 0
#define HAVE_MACHINE_RW_BARRIER 0
#define HAVE_MEMORYBARRIER 0
#define HAVE_MM_EMPTY 1
@@ -194,15 +194,16 @@
#define HAVE_CEXP 1
#define HAVE_INLINE_ASM 1
#define HAVE_SYMVER 1
-#define HAVE_YASM 1
+#define HAVE_X86ASM 1
#define HAVE_BIGENDIAN 0
#define HAVE_FAST_UNALIGNED 1
-#define HAVE_ALSA_ASOUNDLIB_H 0
#define HAVE_ALTIVEC_H 0
#define HAVE_ARPA_INET_H 1
#define HAVE_ASM_TYPES_H 1
#define HAVE_CDIO_PARANOIA_H 0
#define HAVE_CDIO_PARANOIA_PARANOIA_H 0
+#define HAVE_CUDA_H 0
+#define HAVE_D3D11_H 0
#define HAVE_DISPATCH_DISPATCH_H 0
#define HAVE_DEV_BKTR_IOCTL_BT848_H 0
#define HAVE_DEV_BKTR_IOCTL_METEOR_H 0
@@ -212,7 +213,7 @@
#define HAVE_DIRECT_H 0
#define HAVE_DIRENT_H 1
#define HAVE_DLFCN_H 1
-#define HAVE_D3D11_H 0
+#define HAVE_DXGIDEBUG_H 0
#define HAVE_DXVA_H 0
#define HAVE_ES2_GL_H 0
#define HAVE_GSM_H 0
@@ -221,13 +222,15 @@
#define HAVE_MACHINE_IOCTL_BT848_H 0
#define HAVE_MACHINE_IOCTL_METEOR_H 0
#define HAVE_OPENCV2_CORE_CORE_C_H 0
+#define HAVE_OPENJPEG_2_3_OPENJPEG_H 0
+#define HAVE_OPENJPEG_2_2_OPENJPEG_H 0
#define HAVE_OPENJPEG_2_1_OPENJPEG_H 0
#define HAVE_OPENJPEG_2_0_OPENJPEG_H 0
#define HAVE_OPENJPEG_1_5_OPENJPEG_H 0
#define HAVE_OPENGL_GL3_H 0
#define HAVE_POLL_H 1
-#define HAVE_SNDIO_H 0
#define HAVE_SOUNDCARD_H 0
+#define HAVE_STDATOMIC_H 1
#define HAVE_SYS_MMAN_H 1
#define HAVE_SYS_PARAM_H 1
#define HAVE_SYS_RESOURCE_H 1
@@ -279,7 +282,6 @@
#define HAVE_COMMANDLINETOARGVW 0
#define HAVE_COTASKMEMFREE 0
#define HAVE_CRYPTGENRANDOM 0
-#define HAVE_DLOPEN 1
#define HAVE_FCNTL 1
#define HAVE_FLT_LIM 1
#define HAVE_FORK 1
@@ -318,6 +320,7 @@
#define HAVE_SLEEP 0
#define HAVE_STRERROR_R 1
#define HAVE_SYSCONF 1
+#define HAVE_SYSCTL 0
#define HAVE_USLEEP 1
#define HAVE_UTGETOSTYPEFROMSTRING 0
#define HAVE_VIRTUALALLOC 0
@@ -326,11 +329,13 @@
#define HAVE_OS2THREADS 0
#define HAVE_W32THREADS 0
#define HAVE_AS_DN_DIRECTIVE 0
+#define HAVE_AS_FPU_DIRECTIVE 0
#define HAVE_AS_FUNC 0
#define HAVE_AS_OBJECT_ARCH 0
#define HAVE_ASM_MOD_Q 0
#define HAVE_ATTRIBUTE_MAY_ALIAS 1
#define HAVE_ATTRIBUTE_PACKED 1
+#define HAVE_BLOCKS_EXTENSION 0
#define HAVE_EBP_AVAILABLE 1
#define HAVE_EBX_AVAILABLE 1
#define HAVE_GNU_AS 0
@@ -347,6 +352,7 @@
#define HAVE_XFORM_ASM 0
#define HAVE_XMM_CLOBBERS 1
#define HAVE_CONDITION_VARIABLE_PTR 0
+#define HAVE_KCMVIDEOCODECTYPE_HEVC 0
#define HAVE_SOCKLEN_T 1
#define HAVE_STRUCT_ADDRINFO 1
#define HAVE_STRUCT_GROUP_SOURCE_REQ 1
@@ -363,36 +369,20 @@
#define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 1
#define HAVE_ATOMICS_NATIVE 1
#define HAVE_DOS_PATHS 0
-#define HAVE_DXVA2_LIB 0
-#define HAVE_DXVA2API_COBJ 0
#define HAVE_LIBC_MSVCRT 0
-#define HAVE_LIBDC1394_1 0
-#define HAVE_LIBDC1394_2 0
#define HAVE_MAKEINFO 0
#define HAVE_MAKEINFO_HTML 0
#define HAVE_MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS 0
#define HAVE_PERL 1
#define HAVE_POD2MAN 1
-#define HAVE_SDL2 0
#define HAVE_SECTION_DATA_REL_RO 1
#define HAVE_TEXI2HTML 0
#define HAVE_THREADS 1
+#define HAVE_UWP 0
#define HAVE_VAAPI_DRM 0
#define HAVE_VAAPI_X11 0
#define HAVE_VDPAU_X11 0
#define HAVE_WINRT 0
-#define HAVE_XLIB 0
-#define CONFIG_BSFS 0
-#define CONFIG_DECODERS 1
-#define CONFIG_ENCODERS 0
-#define CONFIG_HWACCELS 0
-#define CONFIG_PARSERS 1
-#define CONFIG_INDEVS 0
-#define CONFIG_OUTDEVS 0
-#define CONFIG_FILTERS 0
-#define CONFIG_DEMUXERS 0
-#define CONFIG_MUXERS 0
-#define CONFIG_PROTOCOLS 0
#define CONFIG_DOC 0
#define CONFIG_HTMLPAGES 0
#define CONFIG_MANPAGES 1
@@ -400,13 +390,17 @@
#define CONFIG_TXTPAGES 0
#define CONFIG_AVIO_DIR_CMD_EXAMPLE 1
#define CONFIG_AVIO_READING_EXAMPLE 1
-#define CONFIG_DECODING_ENCODING_EXAMPLE 0
+#define CONFIG_DECODE_AUDIO_EXAMPLE 1
+#define CONFIG_DECODE_VIDEO_EXAMPLE 1
#define CONFIG_DEMUXING_DECODING_EXAMPLE 0
+#define CONFIG_ENCODE_AUDIO_EXAMPLE 1
+#define CONFIG_ENCODE_VIDEO_EXAMPLE 1
#define CONFIG_EXTRACT_MVS_EXAMPLE 0
#define CONFIG_FILTER_AUDIO_EXAMPLE 0
#define CONFIG_FILTERING_AUDIO_EXAMPLE 0
#define CONFIG_FILTERING_VIDEO_EXAMPLE 0
#define CONFIG_HTTP_MULTICLIENT_EXAMPLE 0
+#define CONFIG_HW_DECODE_EXAMPLE 0
#define CONFIG_METADATA_EXAMPLE 0
#define CONFIG_MUXING_EXAMPLE 0
#define CONFIG_QSVDEC_EXAMPLE 0
@@ -415,27 +409,55 @@
#define CONFIG_SCALING_VIDEO_EXAMPLE 0
#define CONFIG_TRANSCODE_AAC_EXAMPLE 0
#define CONFIG_TRANSCODING_EXAMPLE 0
-#define CONFIG_AVISYNTH 0
+#define CONFIG_ALSA 1
+#define CONFIG_APPKIT 0
+#define CONFIG_AVFOUNDATION 0
#define CONFIG_BZLIB 0
-#define CONFIG_CHROMAPRINT 0
-#define CONFIG_CRYSTALHD 0
-#define CONFIG_DECKLINK 0
+#define CONFIG_COREIMAGE 0
+#define CONFIG_ICONV 0
+#define CONFIG_JACK 0
+#define CONFIG_LIBXCB 0
+#define CONFIG_LIBXCB_SHM 0
+#define CONFIG_LIBXCB_SHAPE 0
+#define CONFIG_LIBXCB_XFIXES 0
+#define CONFIG_LZMA 1
+#define CONFIG_SCHANNEL 0
+#define CONFIG_SDL2 0
+#define CONFIG_SECURETRANSPORT 0
+#define CONFIG_SNDIO 0
+#define CONFIG_XLIB 1
+#define CONFIG_ZLIB 1
+#define CONFIG_AVISYNTH 0
#define CONFIG_FREI0R 0
-#define CONFIG_GCRYPT 0
+#define CONFIG_LIBCDIO 0
+#define CONFIG_LIBRUBBERBAND 0
+#define CONFIG_LIBVIDSTAB 0
+#define CONFIG_LIBX264 0
+#define CONFIG_LIBX265 0
+#define CONFIG_LIBXAVS 0
+#define CONFIG_LIBXVID 0
+#define CONFIG_DECKLINK 0
+#define CONFIG_LIBNDI_NEWTEK 0
+#define CONFIG_LIBFDK_AAC 0
+#define CONFIG_OPENSSL 0
#define CONFIG_GMP 0
+#define CONFIG_LIBOPENCORE_AMRNB 0
+#define CONFIG_LIBOPENCORE_AMRWB 0
+#define CONFIG_LIBVO_AMRWBENC 0
+#define CONFIG_RKMPP 0
+#define CONFIG_LIBSMBCLIENT 0
+#define CONFIG_CHROMAPRINT 0
+#define CONFIG_GCRYPT 0
#define CONFIG_GNUTLS 0
-#define CONFIG_ICONV 0
#define CONFIG_JNI 0
#define CONFIG_LADSPA 0
#define CONFIG_LIBASS 0
#define CONFIG_LIBBLURAY 0
#define CONFIG_LIBBS2B 0
#define CONFIG_LIBCACA 0
-#define CONFIG_LIBCDIO 0
#define CONFIG_LIBCELT 0
#define CONFIG_LIBDC1394 0
-#define CONFIG_LIBEBUR128 0
-#define CONFIG_LIBFDK_AAC 0
+#define CONFIG_LIBDRM 0
#define CONFIG_LIBFLITE 0
#define CONFIG_LIBFONTCONFIG 0
#define CONFIG_LIBFREETYPE 0
@@ -447,18 +469,15 @@
#define CONFIG_LIBKVAZAAR 0
#define CONFIG_LIBMODPLUG 0
#define CONFIG_LIBMP3LAME 0
-#define CONFIG_LIBNUT 0
-#define CONFIG_LIBOPENCORE_AMRNB 0
-#define CONFIG_LIBOPENCORE_AMRWB 0
+#define CONFIG_LIBMYSOFA 0
#define CONFIG_LIBOPENCV 0
#define CONFIG_LIBOPENH264 0
#define CONFIG_LIBOPENJPEG 0
#define CONFIG_LIBOPENMPT 0
#define CONFIG_LIBOPUS 0
#define CONFIG_LIBPULSE 0
+#define CONFIG_LIBRSVG 0
#define CONFIG_LIBRTMP 0
-#define CONFIG_LIBRUBBERBAND 0
-#define CONFIG_LIBSCHROEDINGER 0
#define CONFIG_LIBSHINE 0
#define CONFIG_LIBSMBCLIENT 0
#define CONFIG_LIBSNAPPY 0
@@ -469,53 +488,37 @@
#define CONFIG_LIBTHEORA 0
#define CONFIG_LIBTWOLAME 0
#define CONFIG_LIBV4L2 0
-#define CONFIG_LIBVIDSTAB 0
-#define CONFIG_LIBVO_AMRWBENC 0
+#define CONFIG_LIBVMAF 0
#define CONFIG_LIBVORBIS 0
#define CONFIG_LIBVPX 0
#define CONFIG_LIBWAVPACK 0
#define CONFIG_LIBWEBP 0
-#define CONFIG_LIBX264 0
-#define CONFIG_LIBX265 0
-#define CONFIG_LIBXAVS 0
-#define CONFIG_LIBXCB 0
-#define CONFIG_LIBXCB_SHM 0
-#define CONFIG_LIBXCB_SHAPE 0
-#define CONFIG_LIBXCB_XFIXES 0
-#define CONFIG_LIBXVID 0
+#define CONFIG_LIBXML2 0
#define CONFIG_LIBZIMG 0
#define CONFIG_LIBZMQ 0
#define CONFIG_LIBZVBI 0
-#define CONFIG_LZMA 0
#define CONFIG_MEDIACODEC 0
-#define CONFIG_NETCDF 0
#define CONFIG_OPENAL 0
#define CONFIG_OPENCL 0
#define CONFIG_OPENGL 0
-#define CONFIG_OPENSSL 0
-#define CONFIG_SCHANNEL 0
-#define CONFIG_SDL 0
-#define CONFIG_SDL2 0
-#define CONFIG_SECURETRANSPORT 0
-#define CONFIG_VIDEOTOOLBOX 0
-#define CONFIG_X11GRAB 0
-#define CONFIG_XLIB 0
-#define CONFIG_ZLIB 0
#define CONFIG_AUDIOTOOLBOX 0
-#define CONFIG_CUDA 0
-#define CONFIG_CUVID 0
+#define CONFIG_CRYSTALHD 0
+#define CONFIG_CUDA 1
+#define CONFIG_CUVID 1
#define CONFIG_D3D11VA 0
#define CONFIG_DXVA2 0
-#define CONFIG_LIBMFX 0
-#define CONFIG_LIBNPP 0
-#define CONFIG_MMAL 0
-#define CONFIG_NVENC 0
-#define CONFIG_OMX 0
+#define CONFIG_NVENC 1
#define CONFIG_VAAPI 0
#define CONFIG_VDA 0
#define CONFIG_VDPAU 0
-#define CONFIG_VIDEOTOOLBOX_HWACCEL 0
+#define CONFIG_VIDEOTOOLBOX 0
+#define CONFIG_V4L2_M2M 1
#define CONFIG_XVMC 0
+#define CONFIG_CUDA_SDK 0
+#define CONFIG_LIBNPP 0
+#define CONFIG_LIBMFX 0
+#define CONFIG_MMAL 0
+#define CONFIG_OMX 0
#define CONFIG_FTRAPV 0
#define CONFIG_GRAY 0
#define CONFIG_HARDCODED_TABLES 0
@@ -554,16 +557,27 @@
#define CONFIG_PIXELUTILS 0
#define CONFIG_NETWORK 0
#define CONFIG_RDFT 0
+#define CONFIG_AUTODETECT 0
#define CONFIG_FONTCONFIG 0
-#define CONFIG_MEMALIGN_HACK 0
+#define CONFIG_LINUX_PERF 0
#define CONFIG_MEMORY_POISONING 0
#define CONFIG_NEON_CLOBBER_TEST 0
+#define CONFIG_OSSFUZZ 0
#define CONFIG_PIC 1
-#define CONFIG_POD2MAN 1
-#define CONFIG_RAISE_MAJOR 0
#define CONFIG_THUMB 0
#define CONFIG_VALGRIND_BACKTRACE 0
#define CONFIG_XMM_CLOBBER_TEST 0
+#define CONFIG_BSFS 1
+#define CONFIG_DECODERS 1
+#define CONFIG_ENCODERS 0
+#define CONFIG_HWACCELS 0
+#define CONFIG_PARSERS 1
+#define CONFIG_INDEVS 0
+#define CONFIG_OUTDEVS 0
+#define CONFIG_FILTERS 0
+#define CONFIG_DEMUXERS 0
+#define CONFIG_MUXERS 0
+#define CONFIG_PROTOCOLS 0
#define CONFIG_AANDCTTABLES 0
#define CONFIG_AC3DSP 0
#define CONFIG_AUDIO_FRAME_QUEUE 0
@@ -581,20 +595,22 @@
#define CONFIG_FMTCONVERT 0
#define CONFIG_FRAME_THREAD_ENCODER 0
#define CONFIG_G722DSP 0
-#define CONFIG_GOLOMB 1
+#define CONFIG_GOLOMB 0
#define CONFIG_GPLV3 0
#define CONFIG_H263DSP 0
#define CONFIG_H264CHROMA 0
#define CONFIG_H264DSP 0
+#define CONFIG_H264PARSE 0
#define CONFIG_H264PRED 1
#define CONFIG_H264QPEL 0
+#define CONFIG_HEVCPARSE 0
#define CONFIG_HPELDSP 0
#define CONFIG_HUFFMAN 0
#define CONFIG_HUFFYUVDSP 0
#define CONFIG_HUFFYUVENCDSP 0
#define CONFIG_IDCTDSP 0
#define CONFIG_IIRFILTER 0
-#define CONFIG_IMDCT15 0
+#define CONFIG_MDCT15 0
#define CONFIG_INTRAX8 0
#define CONFIG_ISO_MEDIA 0
#define CONFIG_IVIDSP 0
@@ -603,12 +619,14 @@
#define CONFIG_LIBX262 0
#define CONFIG_LLAUDDSP 0
#define CONFIG_LLVIDDSP 0
+#define CONFIG_LLVIDENCDSP 0
#define CONFIG_LPC 0
#define CONFIG_LZF 0
#define CONFIG_ME_CMP 0
#define CONFIG_MPEG_ER 0
#define CONFIG_MPEGAUDIO 0
#define CONFIG_MPEGAUDIODSP 0
+#define CONFIG_MPEGAUDIOHEADER 0
#define CONFIG_MPEGVIDEO 0
#define CONFIG_MPEGVIDEOENC 0
#define CONFIG_MSS34DSP 0
@@ -630,1595 +648,20 @@
#define CONFIG_TEXTUREDSP 0
#define CONFIG_TEXTUREDSPENC 0
#define CONFIG_TPELDSP 0
+#define CONFIG_VAAPI_1 0
#define CONFIG_VAAPI_ENCODE 0
#define CONFIG_VC1DSP 0
#define CONFIG_VIDEODSP 1
#define CONFIG_VP3DSP 0
#define CONFIG_VP56DSP 0
#define CONFIG_VP8DSP 1
-#define CONFIG_VT_BT2020 0
#define CONFIG_WMA_FREQS 0
#define CONFIG_WMV2DSP 0
-#define CONFIG_AAC_ADTSTOASC_BSF 0
-#define CONFIG_CHOMP_BSF 0
-#define CONFIG_DUMP_EXTRADATA_BSF 0
-#define CONFIG_DCA_CORE_BSF 0
-#define CONFIG_H264_MP4TOANNEXB_BSF 0
-#define CONFIG_HEVC_MP4TOANNEXB_BSF 0
-#define CONFIG_IMX_DUMP_HEADER_BSF 0
-#define CONFIG_MJPEG2JPEG_BSF 0
-#define CONFIG_MJPEGA_DUMP_HEADER_BSF 0
-#define CONFIG_MP3_HEADER_DECOMPRESS_BSF 0
-#define CONFIG_MPEG4_UNPACK_BFRAMES_BSF 0
-#define CONFIG_MOV2TEXTSUB_BSF 0
-#define CONFIG_NOISE_BSF 0
-#define CONFIG_REMOVE_EXTRADATA_BSF 0
-#define CONFIG_TEXT2MOVSUB_BSF 0
-#define CONFIG_VP9_SUPERFRAME_BSF 0
-#define CONFIG_AASC_DECODER 0
-#define CONFIG_AIC_DECODER 0
-#define CONFIG_ALIAS_PIX_DECODER 0
-#define CONFIG_AMV_DECODER 0
-#define CONFIG_ANM_DECODER 0
-#define CONFIG_ANSI_DECODER 0
-#define CONFIG_APNG_DECODER 0
-#define CONFIG_ASV1_DECODER 0
-#define CONFIG_ASV2_DECODER 0
-#define CONFIG_AURA_DECODER 0
-#define CONFIG_AURA2_DECODER 0
-#define CONFIG_AVRP_DECODER 0
-#define CONFIG_AVRN_DECODER 0
-#define CONFIG_AVS_DECODER 0
-#define CONFIG_AVUI_DECODER 0
-#define CONFIG_AYUV_DECODER 0
-#define CONFIG_BETHSOFTVID_DECODER 0
-#define CONFIG_BFI_DECODER 0
-#define CONFIG_BINK_DECODER 0
-#define CONFIG_BMP_DECODER 0
-#define CONFIG_BMV_VIDEO_DECODER 0
-#define CONFIG_BRENDER_PIX_DECODER 0
-#define CONFIG_C93_DECODER 0
-#define CONFIG_CAVS_DECODER 0
-#define CONFIG_CDGRAPHICS_DECODER 0
-#define CONFIG_CDXL_DECODER 0
-#define CONFIG_CFHD_DECODER 0
-#define CONFIG_CINEPAK_DECODER 0
-#define CONFIG_CLJR_DECODER 0
-#define CONFIG_CLLC_DECODER 0
-#define CONFIG_COMFORTNOISE_DECODER 0
-#define CONFIG_CPIA_DECODER 0
-#define CONFIG_CSCD_DECODER 0
-#define CONFIG_CYUV_DECODER 0
-#define CONFIG_DDS_DECODER 0
-#define CONFIG_DFA_DECODER 0
-#define CONFIG_DIRAC_DECODER 0
-#define CONFIG_DNXHD_DECODER 0
-#define CONFIG_DPX_DECODER 0
-#define CONFIG_DSICINVIDEO_DECODER 0
-#define CONFIG_DVAUDIO_DECODER 0
-#define CONFIG_DVVIDEO_DECODER 0
-#define CONFIG_DXA_DECODER 0
-#define CONFIG_DXTORY_DECODER 0
-#define CONFIG_DXV_DECODER 0
-#define CONFIG_EACMV_DECODER 0
-#define CONFIG_EAMAD_DECODER 0
-#define CONFIG_EATGQ_DECODER 0
-#define CONFIG_EATGV_DECODER 0
-#define CONFIG_EATQI_DECODER 0
-#define CONFIG_EIGHTBPS_DECODER 0
-#define CONFIG_EIGHTSVX_EXP_DECODER 0
-#define CONFIG_EIGHTSVX_FIB_DECODER 0
-#define CONFIG_ESCAPE124_DECODER 0
-#define CONFIG_ESCAPE130_DECODER 0
-#define CONFIG_EXR_DECODER 0
-#define CONFIG_FFV1_DECODER 0
-#define CONFIG_FFVHUFF_DECODER 0
-#define CONFIG_FIC_DECODER 0
-#define CONFIG_FLASHSV_DECODER 0
-#define CONFIG_FLASHSV2_DECODER 0
-#define CONFIG_FLIC_DECODER 0
-#define CONFIG_FLV_DECODER 0
-#define CONFIG_FOURXM_DECODER 0
-#define CONFIG_FRAPS_DECODER 0
-#define CONFIG_FRWU_DECODER 0
-#define CONFIG_G2M_DECODER 0
-#define CONFIG_GIF_DECODER 0
-#define CONFIG_H261_DECODER 0
-#define CONFIG_H263_DECODER 0
-#define CONFIG_H263I_DECODER 0
-#define CONFIG_H263P_DECODER 0
-#define CONFIG_H264_DECODER 0
-#define CONFIG_H264_CRYSTALHD_DECODER 0
-#define CONFIG_H264_MEDIACODEC_DECODER 0
-#define CONFIG_H264_MMAL_DECODER 0
-#define CONFIG_H264_QSV_DECODER 0
-#define CONFIG_H264_VDA_DECODER 0
-#define CONFIG_H264_VDPAU_DECODER 0
-#define CONFIG_HAP_DECODER 0
-#define CONFIG_HEVC_DECODER 0
-#define CONFIG_HEVC_QSV_DECODER 0
-#define CONFIG_HNM4_VIDEO_DECODER 0
-#define CONFIG_HQ_HQA_DECODER 0
-#define CONFIG_HQX_DECODER 0
-#define CONFIG_HUFFYUV_DECODER 0
-#define CONFIG_IDCIN_DECODER 0
-#define CONFIG_IFF_ILBM_DECODER 0
-#define CONFIG_INDEO2_DECODER 0
-#define CONFIG_INDEO3_DECODER 0
-#define CONFIG_INDEO4_DECODER 0
-#define CONFIG_INDEO5_DECODER 0
-#define CONFIG_INTERPLAY_VIDEO_DECODER 0
-#define CONFIG_JPEG2000_DECODER 0
-#define CONFIG_JPEGLS_DECODER 0
-#define CONFIG_JV_DECODER 0
-#define CONFIG_KGV1_DECODER 0
-#define CONFIG_KMVC_DECODER 0
-#define CONFIG_LAGARITH_DECODER 0
-#define CONFIG_LOCO_DECODER 0
-#define CONFIG_M101_DECODER 0
-#define CONFIG_MAGICYUV_DECODER 0
-#define CONFIG_MDEC_DECODER 0
-#define CONFIG_MIMIC_DECODER 0
-#define CONFIG_MJPEG_DECODER 0
-#define CONFIG_MJPEGB_DECODER 0
-#define CONFIG_MMVIDEO_DECODER 0
-#define CONFIG_MOTIONPIXELS_DECODER 0
-#define CONFIG_MPEG_XVMC_DECODER 0
-#define CONFIG_MPEG1VIDEO_DECODER 0
-#define CONFIG_MPEG2VIDEO_DECODER 0
-#define CONFIG_MPEG4_DECODER 0
-#define CONFIG_MPEG4_CRYSTALHD_DECODER 0
-#define CONFIG_MPEG4_MMAL_DECODER 0
-#define CONFIG_MPEG4_VDPAU_DECODER 0
-#define CONFIG_MPEGVIDEO_DECODER 0
-#define CONFIG_MPEG_VDPAU_DECODER 0
-#define CONFIG_MPEG1_VDPAU_DECODER 0
-#define CONFIG_MPEG2_MMAL_DECODER 0
-#define CONFIG_MPEG2_CRYSTALHD_DECODER 0
-#define CONFIG_MPEG2_QSV_DECODER 0
-#define CONFIG_MSA1_DECODER 0
-#define CONFIG_MSMPEG4_CRYSTALHD_DECODER 0
-#define CONFIG_MSMPEG4V1_DECODER 0
-#define CONFIG_MSMPEG4V2_DECODER 0
-#define CONFIG_MSMPEG4V3_DECODER 0
-#define CONFIG_MSRLE_DECODER 0
-#define CONFIG_MSS1_DECODER 0
-#define CONFIG_MSS2_DECODER 0
-#define CONFIG_MSVIDEO1_DECODER 0
-#define CONFIG_MSZH_DECODER 0
-#define CONFIG_MTS2_DECODER 0
-#define CONFIG_MVC1_DECODER 0
-#define CONFIG_MVC2_DECODER 0
-#define CONFIG_MXPEG_DECODER 0
-#define CONFIG_NUV_DECODER 0
-#define CONFIG_PAF_VIDEO_DECODER 0
-#define CONFIG_PAM_DECODER 0
-#define CONFIG_PBM_DECODER 0
-#define CONFIG_PCX_DECODER 0
-#define CONFIG_PGM_DECODER 0
-#define CONFIG_PGMYUV_DECODER 0
-#define CONFIG_PICTOR_DECODER 0
-#define CONFIG_PNG_DECODER 0
-#define CONFIG_PPM_DECODER 0
-#define CONFIG_PRORES_DECODER 0
-#define CONFIG_PRORES_LGPL_DECODER 0
-#define CONFIG_PTX_DECODER 0
-#define CONFIG_QDRAW_DECODER 0
-#define CONFIG_QPEG_DECODER 0
-#define CONFIG_QTRLE_DECODER 0
-#define CONFIG_R10K_DECODER 0
-#define CONFIG_R210_DECODER 0
-#define CONFIG_RAWVIDEO_DECODER 0
-#define CONFIG_RL2_DECODER 0
-#define CONFIG_ROQ_DECODER 0
-#define CONFIG_RPZA_DECODER 0
-#define CONFIG_RSCC_DECODER 0
-#define CONFIG_RV10_DECODER 0
-#define CONFIG_RV20_DECODER 0
-#define CONFIG_RV30_DECODER 0
-#define CONFIG_RV40_DECODER 0
-#define CONFIG_S302M_DECODER 0
-#define CONFIG_SANM_DECODER 0
-#define CONFIG_SCREENPRESSO_DECODER 0
-#define CONFIG_SDX2_DPCM_DECODER 0
-#define CONFIG_SGI_DECODER 0
-#define CONFIG_SGIRLE_DECODER 0
-#define CONFIG_SHEERVIDEO_DECODER 0
-#define CONFIG_SMACKER_DECODER 0
-#define CONFIG_SMC_DECODER 0
-#define CONFIG_SMVJPEG_DECODER 0
-#define CONFIG_SNOW_DECODER 0
-#define CONFIG_SP5X_DECODER 0
-#define CONFIG_SUNRAST_DECODER 0
-#define CONFIG_SVQ1_DECODER 0
-#define CONFIG_SVQ3_DECODER 0
-#define CONFIG_TARGA_DECODER 0
-#define CONFIG_TARGA_Y216_DECODER 0
-#define CONFIG_TDSC_DECODER 0
-#define CONFIG_THEORA_DECODER 0
-#define CONFIG_THP_DECODER 0
-#define CONFIG_TIERTEXSEQVIDEO_DECODER 0
-#define CONFIG_TIFF_DECODER 0
-#define CONFIG_TMV_DECODER 0
-#define CONFIG_TRUEMOTION1_DECODER 0
-#define CONFIG_TRUEMOTION2_DECODER 0
-#define CONFIG_TRUEMOTION2RT_DECODER 0
-#define CONFIG_TSCC_DECODER 0
-#define CONFIG_TSCC2_DECODER 0
-#define CONFIG_TXD_DECODER 0
-#define CONFIG_ULTI_DECODER 0
-#define CONFIG_UTVIDEO_DECODER 0
-#define CONFIG_V210_DECODER 0
-#define CONFIG_V210X_DECODER 0
-#define CONFIG_V308_DECODER 0
-#define CONFIG_V408_DECODER 0
-#define CONFIG_V410_DECODER 0
-#define CONFIG_VB_DECODER 0
-#define CONFIG_VBLE_DECODER 0
-#define CONFIG_VC1_DECODER 0
-#define CONFIG_VC1_CRYSTALHD_DECODER 0
-#define CONFIG_VC1_VDPAU_DECODER 0
-#define CONFIG_VC1IMAGE_DECODER 0
-#define CONFIG_VC1_MMAL_DECODER 0
-#define CONFIG_VC1_QSV_DECODER 0
-#define CONFIG_VCR1_DECODER 0
-#define CONFIG_VMDVIDEO_DECODER 0
-#define CONFIG_VMNC_DECODER 0
-#define CONFIG_VP3_DECODER 0
-#define CONFIG_VP5_DECODER 0
-#define CONFIG_VP6_DECODER 0
-#define CONFIG_VP6A_DECODER 0
-#define CONFIG_VP6F_DECODER 0
-#define CONFIG_VP7_DECODER 0
+#define CONFIG_NULL_BSF 1
#define CONFIG_VP8_DECODER 1
#define CONFIG_VP9_DECODER 1
-#define CONFIG_VQA_DECODER 0
-#define CONFIG_WEBP_DECODER 0
-#define CONFIG_WMV1_DECODER 0
-#define CONFIG_WMV2_DECODER 0
-#define CONFIG_WMV3_DECODER 0
-#define CONFIG_WMV3_CRYSTALHD_DECODER 0
-#define CONFIG_WMV3_VDPAU_DECODER 0
-#define CONFIG_WMV3IMAGE_DECODER 0
-#define CONFIG_WNV1_DECODER 0
-#define CONFIG_XAN_WC3_DECODER 0
-#define CONFIG_XAN_WC4_DECODER 0
-#define CONFIG_XBM_DECODER 0
-#define CONFIG_XFACE_DECODER 0
-#define CONFIG_XL_DECODER 0
-#define CONFIG_XWD_DECODER 0
-#define CONFIG_Y41P_DECODER 0
-#define CONFIG_YLC_DECODER 0
-#define CONFIG_YOP_DECODER 0
-#define CONFIG_YUV4_DECODER 0
-#define CONFIG_ZERO12V_DECODER 0
-#define CONFIG_ZEROCODEC_DECODER 0
-#define CONFIG_ZLIB_DECODER 0
-#define CONFIG_ZMBV_DECODER 0
-#define CONFIG_AAC_DECODER 0
-#define CONFIG_AAC_FIXED_DECODER 0
-#define CONFIG_AAC_LATM_DECODER 0
-#define CONFIG_AC3_DECODER 0
-#define CONFIG_AC3_FIXED_DECODER 0
-#define CONFIG_ALAC_DECODER 0
-#define CONFIG_ALS_DECODER 0
-#define CONFIG_AMRNB_DECODER 0
-#define CONFIG_AMRWB_DECODER 0
-#define CONFIG_APE_DECODER 0
-#define CONFIG_ATRAC1_DECODER 0
-#define CONFIG_ATRAC3_DECODER 0
-#define CONFIG_ATRAC3P_DECODER 0
-#define CONFIG_BINKAUDIO_DCT_DECODER 0
-#define CONFIG_BINKAUDIO_RDFT_DECODER 0
-#define CONFIG_BMV_AUDIO_DECODER 0
-#define CONFIG_COOK_DECODER 0
-#define CONFIG_DCA_DECODER 0
-#define CONFIG_DSD_LSBF_DECODER 0
-#define CONFIG_DSD_MSBF_DECODER 0
-#define CONFIG_DSD_LSBF_PLANAR_DECODER 0
-#define CONFIG_DSD_MSBF_PLANAR_DECODER 0
-#define CONFIG_DSICINAUDIO_DECODER 0
-#define CONFIG_DSS_SP_DECODER 0
-#define CONFIG_DST_DECODER 0
-#define CONFIG_EAC3_DECODER 0
-#define CONFIG_EVRC_DECODER 0
-#define CONFIG_FFWAVESYNTH_DECODER 0
#define CONFIG_FLAC_DECODER 1
-#define CONFIG_G723_1_DECODER 0
-#define CONFIG_G729_DECODER 0
-#define CONFIG_GSM_DECODER 0
-#define CONFIG_GSM_MS_DECODER 0
-#define CONFIG_IAC_DECODER 0
-#define CONFIG_IMC_DECODER 0
-#define CONFIG_INTERPLAY_ACM_DECODER 0
-#define CONFIG_MACE3_DECODER 0
-#define CONFIG_MACE6_DECODER 0
-#define CONFIG_METASOUND_DECODER 0
-#define CONFIG_MLP_DECODER 0
-#define CONFIG_MP1_DECODER 0
-#define CONFIG_MP1FLOAT_DECODER 0
-#define CONFIG_MP2_DECODER 0
-#define CONFIG_MP2FLOAT_DECODER 0
-#define CONFIG_MP3_DECODER 0
-#define CONFIG_MP3FLOAT_DECODER 0
-#define CONFIG_MP3ADU_DECODER 0
-#define CONFIG_MP3ADUFLOAT_DECODER 0
-#define CONFIG_MP3ON4_DECODER 0
-#define CONFIG_MP3ON4FLOAT_DECODER 0
-#define CONFIG_MPC7_DECODER 0
-#define CONFIG_MPC8_DECODER 0
-#define CONFIG_NELLYMOSER_DECODER 0
-#define CONFIG_ON2AVC_DECODER 0
-#define CONFIG_OPUS_DECODER 0
-#define CONFIG_PAF_AUDIO_DECODER 0
-#define CONFIG_QCELP_DECODER 0
-#define CONFIG_QDM2_DECODER 0
-#define CONFIG_RA_144_DECODER 0
-#define CONFIG_RA_288_DECODER 0
-#define CONFIG_RALF_DECODER 0
-#define CONFIG_SHORTEN_DECODER 0
-#define CONFIG_SIPR_DECODER 0
-#define CONFIG_SMACKAUD_DECODER 0
-#define CONFIG_SONIC_DECODER 0
-#define CONFIG_TAK_DECODER 0
-#define CONFIG_TRUEHD_DECODER 0
-#define CONFIG_TRUESPEECH_DECODER 0
-#define CONFIG_TTA_DECODER 0
-#define CONFIG_TWINVQ_DECODER 0
-#define CONFIG_VMDAUDIO_DECODER 0
-#define CONFIG_VORBIS_DECODER 0
-#define CONFIG_WAVPACK_DECODER 0
-#define CONFIG_WMALOSSLESS_DECODER 0
-#define CONFIG_WMAPRO_DECODER 0
-#define CONFIG_WMAV1_DECODER 0
-#define CONFIG_WMAV2_DECODER 0
-#define CONFIG_WMAVOICE_DECODER 0
-#define CONFIG_WS_SND1_DECODER 0
-#define CONFIG_XMA1_DECODER 0
-#define CONFIG_XMA2_DECODER 0
-#define CONFIG_PCM_ALAW_DECODER 0
-#define CONFIG_PCM_BLURAY_DECODER 0
-#define CONFIG_PCM_DVD_DECODER 0
-#define CONFIG_PCM_F32BE_DECODER 0
-#define CONFIG_PCM_F32LE_DECODER 0
-#define CONFIG_PCM_F64BE_DECODER 0
-#define CONFIG_PCM_F64LE_DECODER 0
-#define CONFIG_PCM_LXF_DECODER 0
-#define CONFIG_PCM_MULAW_DECODER 0
-#define CONFIG_PCM_S8_DECODER 0
-#define CONFIG_PCM_S8_PLANAR_DECODER 0
-#define CONFIG_PCM_S16BE_DECODER 0
-#define CONFIG_PCM_S16BE_PLANAR_DECODER 0
-#define CONFIG_PCM_S16LE_DECODER 0
-#define CONFIG_PCM_S16LE_PLANAR_DECODER 0
-#define CONFIG_PCM_S24BE_DECODER 0
-#define CONFIG_PCM_S24DAUD_DECODER 0
-#define CONFIG_PCM_S24LE_DECODER 0
-#define CONFIG_PCM_S24LE_PLANAR_DECODER 0
-#define CONFIG_PCM_S32BE_DECODER 0
-#define CONFIG_PCM_S32LE_DECODER 0
-#define CONFIG_PCM_S32LE_PLANAR_DECODER 0
-#define CONFIG_PCM_S64BE_DECODER 0
-#define CONFIG_PCM_S64LE_DECODER 0
-#define CONFIG_PCM_U8_DECODER 0
-#define CONFIG_PCM_U16BE_DECODER 0
-#define CONFIG_PCM_U16LE_DECODER 0
-#define CONFIG_PCM_U24BE_DECODER 0
-#define CONFIG_PCM_U24LE_DECODER 0
-#define CONFIG_PCM_U32BE_DECODER 0
-#define CONFIG_PCM_U32LE_DECODER 0
-#define CONFIG_PCM_ZORK_DECODER 0
-#define CONFIG_INTERPLAY_DPCM_DECODER 0
-#define CONFIG_ROQ_DPCM_DECODER 0
-#define CONFIG_SOL_DPCM_DECODER 0
-#define CONFIG_XAN_DPCM_DECODER 0
-#define CONFIG_ADPCM_4XM_DECODER 0
-#define CONFIG_ADPCM_ADX_DECODER 0
-#define CONFIG_ADPCM_AFC_DECODER 0
-#define CONFIG_ADPCM_AICA_DECODER 0
-#define CONFIG_ADPCM_CT_DECODER 0
-#define CONFIG_ADPCM_DTK_DECODER 0
-#define CONFIG_ADPCM_EA_DECODER 0
-#define CONFIG_ADPCM_EA_MAXIS_XA_DECODER 0
-#define CONFIG_ADPCM_EA_R1_DECODER 0
-#define CONFIG_ADPCM_EA_R2_DECODER 0
-#define CONFIG_ADPCM_EA_R3_DECODER 0
-#define CONFIG_ADPCM_EA_XAS_DECODER 0
-#define CONFIG_ADPCM_G722_DECODER 0
-#define CONFIG_ADPCM_G726_DECODER 0
-#define CONFIG_ADPCM_G726LE_DECODER 0
-#define CONFIG_ADPCM_IMA_AMV_DECODER 0
-#define CONFIG_ADPCM_IMA_APC_DECODER 0
-#define CONFIG_ADPCM_IMA_DAT4_DECODER 0
-#define CONFIG_ADPCM_IMA_DK3_DECODER 0
-#define CONFIG_ADPCM_IMA_DK4_DECODER 0
-#define CONFIG_ADPCM_IMA_EA_EACS_DECODER 0
-#define CONFIG_ADPCM_IMA_EA_SEAD_DECODER 0
-#define CONFIG_ADPCM_IMA_ISS_DECODER 0
-#define CONFIG_ADPCM_IMA_OKI_DECODER 0
-#define CONFIG_ADPCM_IMA_QT_DECODER 0
-#define CONFIG_ADPCM_IMA_RAD_DECODER 0
-#define CONFIG_ADPCM_IMA_SMJPEG_DECODER 0
-#define CONFIG_ADPCM_IMA_WAV_DECODER 0
-#define CONFIG_ADPCM_IMA_WS_DECODER 0
-#define CONFIG_ADPCM_MS_DECODER 0
-#define CONFIG_ADPCM_MTAF_DECODER 0
-#define CONFIG_ADPCM_PSX_DECODER 0
-#define CONFIG_ADPCM_SBPRO_2_DECODER 0
-#define CONFIG_ADPCM_SBPRO_3_DECODER 0
-#define CONFIG_ADPCM_SBPRO_4_DECODER 0
-#define CONFIG_ADPCM_SWF_DECODER 0
-#define CONFIG_ADPCM_THP_DECODER 0
-#define CONFIG_ADPCM_THP_LE_DECODER 0
-#define CONFIG_ADPCM_VIMA_DECODER 0
-#define CONFIG_ADPCM_XA_DECODER 0
-#define CONFIG_ADPCM_YAMAHA_DECODER 0
-#define CONFIG_SSA_DECODER 0
-#define CONFIG_ASS_DECODER 0
-#define CONFIG_CCAPTION_DECODER 0
-#define CONFIG_DVBSUB_DECODER 0
-#define CONFIG_DVDSUB_DECODER 0
-#define CONFIG_JACOSUB_DECODER 0
-#define CONFIG_MICRODVD_DECODER 0
-#define CONFIG_MOVTEXT_DECODER 0
-#define CONFIG_MPL2_DECODER 0
-#define CONFIG_PGSSUB_DECODER 0
-#define CONFIG_PJS_DECODER 0
-#define CONFIG_REALTEXT_DECODER 0
-#define CONFIG_SAMI_DECODER 0
-#define CONFIG_SRT_DECODER 0
-#define CONFIG_STL_DECODER 0
-#define CONFIG_SUBRIP_DECODER 0
-#define CONFIG_SUBVIEWER_DECODER 0
-#define CONFIG_SUBVIEWER1_DECODER 0
-#define CONFIG_TEXT_DECODER 0
-#define CONFIG_VPLAYER_DECODER 0
-#define CONFIG_WEBVTT_DECODER 0
-#define CONFIG_XSUB_DECODER 0
-#define CONFIG_AAC_AT_DECODER 0
-#define CONFIG_AC3_AT_DECODER 0
-#define CONFIG_ADPCM_IMA_QT_AT_DECODER 0
-#define CONFIG_ALAC_AT_DECODER 0
-#define CONFIG_AMR_NB_AT_DECODER 0
-#define CONFIG_EAC3_AT_DECODER 0
-#define CONFIG_GSM_MS_AT_DECODER 0
-#define CONFIG_ILBC_AT_DECODER 0
-#define CONFIG_MP1_AT_DECODER 0
-#define CONFIG_MP2_AT_DECODER 0
-#define CONFIG_MP3_AT_DECODER 0
-#define CONFIG_PCM_ALAW_AT_DECODER 0
-#define CONFIG_PCM_MULAW_AT_DECODER 0
-#define CONFIG_QDMC_AT_DECODER 0
-#define CONFIG_QDM2_AT_DECODER 0
-#define CONFIG_LIBCELT_DECODER 0
-#define CONFIG_LIBFDK_AAC_DECODER 0
-#define CONFIG_LIBGSM_DECODER 0
-#define CONFIG_LIBGSM_MS_DECODER 0
-#define CONFIG_LIBILBC_DECODER 0
-#define CONFIG_LIBOPENCORE_AMRNB_DECODER 0
-#define CONFIG_LIBOPENCORE_AMRWB_DECODER 0
-#define CONFIG_LIBOPENJPEG_DECODER 0
-#define CONFIG_LIBOPUS_DECODER 0
-#define CONFIG_LIBSCHROEDINGER_DECODER 0
-#define CONFIG_LIBSPEEX_DECODER 0
-#define CONFIG_LIBVORBIS_DECODER 0
-#define CONFIG_LIBVPX_VP8_DECODER 0
-#define CONFIG_LIBVPX_VP9_DECODER 0
-#define CONFIG_LIBZVBI_TELETEXT_DECODER 0
-#define CONFIG_BINTEXT_DECODER 0
-#define CONFIG_XBIN_DECODER 0
-#define CONFIG_IDF_DECODER 0
-#define CONFIG_LIBOPENH264_DECODER 0
-#define CONFIG_H263_CUVID_DECODER 0
-#define CONFIG_H264_CUVID_DECODER 0
-#define CONFIG_HEVC_CUVID_DECODER 0
-#define CONFIG_HEVC_MEDIACODEC_DECODER 0
-#define CONFIG_MJPEG_CUVID_DECODER 0
-#define CONFIG_MPEG1_CUVID_DECODER 0
-#define CONFIG_MPEG2_CUVID_DECODER 0
-#define CONFIG_MPEG4_CUVID_DECODER 0
-#define CONFIG_MPEG4_MEDIACODEC_DECODER 0
-#define CONFIG_VC1_CUVID_DECODER 0
-#define CONFIG_VP8_CUVID_DECODER 0
-#define CONFIG_VP8_MEDIACODEC_DECODER 0
-#define CONFIG_VP9_CUVID_DECODER 0
-#define CONFIG_VP9_MEDIACODEC_DECODER 0
-#define CONFIG_AA_DEMUXER 0
-#define CONFIG_AAC_DEMUXER 0
-#define CONFIG_AC3_DEMUXER 0
-#define CONFIG_ACM_DEMUXER 0
-#define CONFIG_ACT_DEMUXER 0
-#define CONFIG_ADF_DEMUXER 0
-#define CONFIG_ADP_DEMUXER 0
-#define CONFIG_ADS_DEMUXER 0
-#define CONFIG_ADX_DEMUXER 0
-#define CONFIG_AEA_DEMUXER 0
-#define CONFIG_AFC_DEMUXER 0
-#define CONFIG_AIFF_DEMUXER 0
-#define CONFIG_AIX_DEMUXER 0
-#define CONFIG_AMR_DEMUXER 0
-#define CONFIG_ANM_DEMUXER 0
-#define CONFIG_APC_DEMUXER 0
-#define CONFIG_APE_DEMUXER 0
-#define CONFIG_APNG_DEMUXER 0
-#define CONFIG_AQTITLE_DEMUXER 0
-#define CONFIG_ASF_DEMUXER 0
-#define CONFIG_ASF_O_DEMUXER 0
-#define CONFIG_ASS_DEMUXER 0
-#define CONFIG_AST_DEMUXER 0
-#define CONFIG_AU_DEMUXER 0
-#define CONFIG_AVI_DEMUXER 0
-#define CONFIG_AVISYNTH_DEMUXER 0
-#define CONFIG_AVR_DEMUXER 0
-#define CONFIG_AVS_DEMUXER 0
-#define CONFIG_BETHSOFTVID_DEMUXER 0
-#define CONFIG_BFI_DEMUXER 0
-#define CONFIG_BINTEXT_DEMUXER 0
-#define CONFIG_BINK_DEMUXER 0
-#define CONFIG_BIT_DEMUXER 0
-#define CONFIG_BMV_DEMUXER 0
-#define CONFIG_BFSTM_DEMUXER 0
-#define CONFIG_BRSTM_DEMUXER 0
-#define CONFIG_BOA_DEMUXER 0
-#define CONFIG_C93_DEMUXER 0
-#define CONFIG_CAF_DEMUXER 0
-#define CONFIG_CAVSVIDEO_DEMUXER 0
-#define CONFIG_CDG_DEMUXER 0
-#define CONFIG_CDXL_DEMUXER 0
-#define CONFIG_CINE_DEMUXER 0
-#define CONFIG_CONCAT_DEMUXER 0
-#define CONFIG_DATA_DEMUXER 0
-#define CONFIG_DAUD_DEMUXER 0
-#define CONFIG_DCSTR_DEMUXER 0
-#define CONFIG_DFA_DEMUXER 0
-#define CONFIG_DIRAC_DEMUXER 0
-#define CONFIG_DNXHD_DEMUXER 0
-#define CONFIG_DSF_DEMUXER 0
-#define CONFIG_DSICIN_DEMUXER 0
-#define CONFIG_DSS_DEMUXER 0
-#define CONFIG_DTS_DEMUXER 0
-#define CONFIG_DTSHD_DEMUXER 0
-#define CONFIG_DV_DEMUXER 0
-#define CONFIG_DVBSUB_DEMUXER 0
-#define CONFIG_DVBTXT_DEMUXER 0
-#define CONFIG_DXA_DEMUXER 0
-#define CONFIG_EA_DEMUXER 0
-#define CONFIG_EA_CDATA_DEMUXER 0
-#define CONFIG_EAC3_DEMUXER 0
-#define CONFIG_EPAF_DEMUXER 0
-#define CONFIG_FFM_DEMUXER 0
-#define CONFIG_FFMETADATA_DEMUXER 0
-#define CONFIG_FILMSTRIP_DEMUXER 0
-#define CONFIG_FLAC_DEMUXER 0
-#define CONFIG_FLIC_DEMUXER 0
-#define CONFIG_FLV_DEMUXER 0
-#define CONFIG_LIVE_FLV_DEMUXER 0
-#define CONFIG_FOURXM_DEMUXER 0
-#define CONFIG_FRM_DEMUXER 0
-#define CONFIG_FSB_DEMUXER 0
-#define CONFIG_G722_DEMUXER 0
-#define CONFIG_G723_1_DEMUXER 0
-#define CONFIG_G729_DEMUXER 0
-#define CONFIG_GENH_DEMUXER 0
-#define CONFIG_GIF_DEMUXER 0
-#define CONFIG_GSM_DEMUXER 0
-#define CONFIG_GXF_DEMUXER 0
-#define CONFIG_H261_DEMUXER 0
-#define CONFIG_H263_DEMUXER 0
-#define CONFIG_H264_DEMUXER 0
-#define CONFIG_HEVC_DEMUXER 0
-#define CONFIG_HLS_DEMUXER 0
-#define CONFIG_HNM_DEMUXER 0
-#define CONFIG_ICO_DEMUXER 0
-#define CONFIG_IDCIN_DEMUXER 0
-#define CONFIG_IDF_DEMUXER 0
-#define CONFIG_IFF_DEMUXER 0
-#define CONFIG_ILBC_DEMUXER 0
-#define CONFIG_IMAGE2_DEMUXER 0
-#define CONFIG_IMAGE2PIPE_DEMUXER 0
-#define CONFIG_IMAGE2_ALIAS_PIX_DEMUXER 0
-#define CONFIG_IMAGE2_BRENDER_PIX_DEMUXER 0
-#define CONFIG_INGENIENT_DEMUXER 0
-#define CONFIG_IPMOVIE_DEMUXER 0
-#define CONFIG_IRCAM_DEMUXER 0
-#define CONFIG_ISS_DEMUXER 0
-#define CONFIG_IV8_DEMUXER 0
-#define CONFIG_IVF_DEMUXER 0
-#define CONFIG_IVR_DEMUXER 0
-#define CONFIG_JACOSUB_DEMUXER 0
-#define CONFIG_JV_DEMUXER 0
-#define CONFIG_LMLM4_DEMUXER 0
-#define CONFIG_LOAS_DEMUXER 0
-#define CONFIG_LRC_DEMUXER 0
-#define CONFIG_LVF_DEMUXER 0
-#define CONFIG_LXF_DEMUXER 0
-#define CONFIG_M4V_DEMUXER 0
-#define CONFIG_MATROSKA_DEMUXER 0
-#define CONFIG_MGSTS_DEMUXER 0
-#define CONFIG_MICRODVD_DEMUXER 0
-#define CONFIG_MJPEG_DEMUXER 0
-#define CONFIG_MLP_DEMUXER 0
-#define CONFIG_MLV_DEMUXER 0
-#define CONFIG_MM_DEMUXER 0
-#define CONFIG_MMF_DEMUXER 0
-#define CONFIG_MOV_DEMUXER 0
-#define CONFIG_MP3_DEMUXER 0
-#define CONFIG_MPC_DEMUXER 0
-#define CONFIG_MPC8_DEMUXER 0
-#define CONFIG_MPEGPS_DEMUXER 0
-#define CONFIG_MPEGTS_DEMUXER 0
-#define CONFIG_MPEGTSRAW_DEMUXER 0
-#define CONFIG_MPEGVIDEO_DEMUXER 0
-#define CONFIG_MPJPEG_DEMUXER 0
-#define CONFIG_MPL2_DEMUXER 0
-#define CONFIG_MPSUB_DEMUXER 0
-#define CONFIG_MSF_DEMUXER 0
-#define CONFIG_MSNWC_TCP_DEMUXER 0
-#define CONFIG_MTAF_DEMUXER 0
-#define CONFIG_MTV_DEMUXER 0
-#define CONFIG_MUSX_DEMUXER 0
-#define CONFIG_MV_DEMUXER 0
-#define CONFIG_MVI_DEMUXER 0
-#define CONFIG_MXF_DEMUXER 0
-#define CONFIG_MXG_DEMUXER 0
-#define CONFIG_NC_DEMUXER 0
-#define CONFIG_NISTSPHERE_DEMUXER 0
-#define CONFIG_NSV_DEMUXER 0
-#define CONFIG_NUT_DEMUXER 0
-#define CONFIG_NUV_DEMUXER 0
-#define CONFIG_OGG_DEMUXER 0
-#define CONFIG_OMA_DEMUXER 0
-#define CONFIG_PAF_DEMUXER 0
-#define CONFIG_PCM_ALAW_DEMUXER 0
-#define CONFIG_PCM_MULAW_DEMUXER 0
-#define CONFIG_PCM_F64BE_DEMUXER 0
-#define CONFIG_PCM_F64LE_DEMUXER 0
-#define CONFIG_PCM_F32BE_DEMUXER 0
-#define CONFIG_PCM_F32LE_DEMUXER 0
-#define CONFIG_PCM_S32BE_DEMUXER 0
-#define CONFIG_PCM_S32LE_DEMUXER 0
-#define CONFIG_PCM_S24BE_DEMUXER 0
-#define CONFIG_PCM_S24LE_DEMUXER 0
-#define CONFIG_PCM_S16BE_DEMUXER 0
-#define CONFIG_PCM_S16LE_DEMUXER 0
-#define CONFIG_PCM_S8_DEMUXER 0
-#define CONFIG_PCM_U32BE_DEMUXER 0
-#define CONFIG_PCM_U32LE_DEMUXER 0
-#define CONFIG_PCM_U24BE_DEMUXER 0
-#define CONFIG_PCM_U24LE_DEMUXER 0
-#define CONFIG_PCM_U16BE_DEMUXER 0
-#define CONFIG_PCM_U16LE_DEMUXER 0
-#define CONFIG_PCM_U8_DEMUXER 0
-#define CONFIG_PJS_DEMUXER 0
-#define CONFIG_PMP_DEMUXER 0
-#define CONFIG_PVA_DEMUXER 0
-#define CONFIG_PVF_DEMUXER 0
-#define CONFIG_QCP_DEMUXER 0
-#define CONFIG_R3D_DEMUXER 0
-#define CONFIG_RAWVIDEO_DEMUXER 0
-#define CONFIG_REALTEXT_DEMUXER 0
-#define CONFIG_REDSPARK_DEMUXER 0
-#define CONFIG_RL2_DEMUXER 0
-#define CONFIG_RM_DEMUXER 0
-#define CONFIG_ROQ_DEMUXER 0
-#define CONFIG_RPL_DEMUXER 0
-#define CONFIG_RSD_DEMUXER 0
-#define CONFIG_RSO_DEMUXER 0
-#define CONFIG_RTP_DEMUXER 0
-#define CONFIG_RTSP_DEMUXER 0
-#define CONFIG_SAMI_DEMUXER 0
-#define CONFIG_SAP_DEMUXER 0
-#define CONFIG_SBG_DEMUXER 0
-#define CONFIG_SDP_DEMUXER 0
-#define CONFIG_SDR2_DEMUXER 0
-#define CONFIG_SEGAFILM_DEMUXER 0
-#define CONFIG_SHORTEN_DEMUXER 0
-#define CONFIG_SIFF_DEMUXER 0
-#define CONFIG_SLN_DEMUXER 0
-#define CONFIG_SMACKER_DEMUXER 0
-#define CONFIG_SMJPEG_DEMUXER 0
-#define CONFIG_SMUSH_DEMUXER 0
-#define CONFIG_SOL_DEMUXER 0
-#define CONFIG_SOX_DEMUXER 0
-#define CONFIG_SPDIF_DEMUXER 0
-#define CONFIG_SRT_DEMUXER 0
-#define CONFIG_STR_DEMUXER 0
-#define CONFIG_STL_DEMUXER 0
-#define CONFIG_SUBVIEWER1_DEMUXER 0
-#define CONFIG_SUBVIEWER_DEMUXER 0
-#define CONFIG_SUP_DEMUXER 0
-#define CONFIG_SVAG_DEMUXER 0
-#define CONFIG_SWF_DEMUXER 0
-#define CONFIG_TAK_DEMUXER 0
-#define CONFIG_TEDCAPTIONS_DEMUXER 0
-#define CONFIG_THP_DEMUXER 0
-#define CONFIG_THREEDOSTR_DEMUXER 0
-#define CONFIG_TIERTEXSEQ_DEMUXER 0
-#define CONFIG_TMV_DEMUXER 0
-#define CONFIG_TRUEHD_DEMUXER 0
-#define CONFIG_TTA_DEMUXER 0
-#define CONFIG_TXD_DEMUXER 0
-#define CONFIG_TTY_DEMUXER 0
-#define CONFIG_V210_DEMUXER 0
-#define CONFIG_V210X_DEMUXER 0
-#define CONFIG_VAG_DEMUXER 0
-#define CONFIG_VC1_DEMUXER 0
-#define CONFIG_VC1T_DEMUXER 0
-#define CONFIG_VIVO_DEMUXER 0
-#define CONFIG_VMD_DEMUXER 0
-#define CONFIG_VOBSUB_DEMUXER 0
-#define CONFIG_VOC_DEMUXER 0
-#define CONFIG_VPK_DEMUXER 0
-#define CONFIG_VPLAYER_DEMUXER 0
-#define CONFIG_VQF_DEMUXER 0
-#define CONFIG_W64_DEMUXER 0
-#define CONFIG_WAV_DEMUXER 0
-#define CONFIG_WC3_DEMUXER 0
-#define CONFIG_WEBM_DASH_MANIFEST_DEMUXER 0
-#define CONFIG_WEBVTT_DEMUXER 0
-#define CONFIG_WSAUD_DEMUXER 0
-#define CONFIG_WSD_DEMUXER 0
-#define CONFIG_WSVQA_DEMUXER 0
-#define CONFIG_WTV_DEMUXER 0
-#define CONFIG_WVE_DEMUXER 0
-#define CONFIG_WV_DEMUXER 0
-#define CONFIG_XA_DEMUXER 0
-#define CONFIG_XBIN_DEMUXER 0
-#define CONFIG_XMV_DEMUXER 0
-#define CONFIG_XVAG_DEMUXER 0
-#define CONFIG_XWMA_DEMUXER 0
-#define CONFIG_YOP_DEMUXER 0
-#define CONFIG_YUV4MPEGPIPE_DEMUXER 0
-#define CONFIG_IMAGE_BMP_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_DDS_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_DPX_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_EXR_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_J2K_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_JPEG_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_JPEGLS_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PAM_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PBM_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PCX_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PGMYUV_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PGM_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PICTOR_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PNG_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PPM_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_QDRAW_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_SGI_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_SUNRAST_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_TIFF_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_WEBP_PIPE_DEMUXER 0
-#define CONFIG_LIBGME_DEMUXER 0
-#define CONFIG_LIBMODPLUG_DEMUXER 0
-#define CONFIG_LIBNUT_DEMUXER 0
-#define CONFIG_LIBOPENMPT_DEMUXER 0
-#define CONFIG_A64MULTI_ENCODER 0
-#define CONFIG_A64MULTI5_ENCODER 0
-#define CONFIG_ALIAS_PIX_ENCODER 0
-#define CONFIG_AMV_ENCODER 0
-#define CONFIG_APNG_ENCODER 0
-#define CONFIG_ASV1_ENCODER 0
-#define CONFIG_ASV2_ENCODER 0
-#define CONFIG_AVRP_ENCODER 0
-#define CONFIG_AVUI_ENCODER 0
-#define CONFIG_AYUV_ENCODER 0
-#define CONFIG_BMP_ENCODER 0
-#define CONFIG_CINEPAK_ENCODER 0
-#define CONFIG_CLJR_ENCODER 0
-#define CONFIG_COMFORTNOISE_ENCODER 0
-#define CONFIG_DNXHD_ENCODER 0
-#define CONFIG_DPX_ENCODER 0
-#define CONFIG_DVVIDEO_ENCODER 0
-#define CONFIG_FFV1_ENCODER 0
-#define CONFIG_FFVHUFF_ENCODER 0
-#define CONFIG_FLASHSV_ENCODER 0
-#define CONFIG_FLASHSV2_ENCODER 0
-#define CONFIG_FLV_ENCODER 0
-#define CONFIG_GIF_ENCODER 0
-#define CONFIG_H261_ENCODER 0
-#define CONFIG_H263_ENCODER 0
-#define CONFIG_H263P_ENCODER 0
-#define CONFIG_HAP_ENCODER 0
-#define CONFIG_HUFFYUV_ENCODER 0
-#define CONFIG_JPEG2000_ENCODER 0
-#define CONFIG_JPEGLS_ENCODER 0
-#define CONFIG_LJPEG_ENCODER 0
-#define CONFIG_MJPEG_ENCODER 0
-#define CONFIG_MPEG1VIDEO_ENCODER 0
-#define CONFIG_MPEG2VIDEO_ENCODER 0
-#define CONFIG_MPEG4_ENCODER 0
-#define CONFIG_MSMPEG4V2_ENCODER 0
-#define CONFIG_MSMPEG4V3_ENCODER 0
-#define CONFIG_MSVIDEO1_ENCODER 0
-#define CONFIG_PAM_ENCODER 0
-#define CONFIG_PBM_ENCODER 0
-#define CONFIG_PCX_ENCODER 0
-#define CONFIG_PGM_ENCODER 0
-#define CONFIG_PGMYUV_ENCODER 0
-#define CONFIG_PNG_ENCODER 0
-#define CONFIG_PPM_ENCODER 0
-#define CONFIG_PRORES_ENCODER 0
-#define CONFIG_PRORES_AW_ENCODER 0
-#define CONFIG_PRORES_KS_ENCODER 0
-#define CONFIG_QTRLE_ENCODER 0
-#define CONFIG_R10K_ENCODER 0
-#define CONFIG_R210_ENCODER 0
-#define CONFIG_RAWVIDEO_ENCODER 0
-#define CONFIG_ROQ_ENCODER 0
-#define CONFIG_RV10_ENCODER 0
-#define CONFIG_RV20_ENCODER 0
-#define CONFIG_S302M_ENCODER 0
-#define CONFIG_SGI_ENCODER 0
-#define CONFIG_SNOW_ENCODER 0
-#define CONFIG_SUNRAST_ENCODER 0
-#define CONFIG_SVQ1_ENCODER 0
-#define CONFIG_TARGA_ENCODER 0
-#define CONFIG_TIFF_ENCODER 0
-#define CONFIG_UTVIDEO_ENCODER 0
-#define CONFIG_V210_ENCODER 0
-#define CONFIG_V308_ENCODER 0
-#define CONFIG_V408_ENCODER 0
-#define CONFIG_V410_ENCODER 0
-#define CONFIG_VC2_ENCODER 0
-#define CONFIG_WRAPPED_AVFRAME_ENCODER 0
-#define CONFIG_WMV1_ENCODER 0
-#define CONFIG_WMV2_ENCODER 0
-#define CONFIG_XBM_ENCODER 0
-#define CONFIG_XFACE_ENCODER 0
-#define CONFIG_XWD_ENCODER 0
-#define CONFIG_Y41P_ENCODER 0
-#define CONFIG_YUV4_ENCODER 0
-#define CONFIG_ZLIB_ENCODER 0
-#define CONFIG_ZMBV_ENCODER 0
-#define CONFIG_AAC_ENCODER 0
-#define CONFIG_AC3_ENCODER 0
-#define CONFIG_AC3_FIXED_ENCODER 0
-#define CONFIG_ALAC_ENCODER 0
-#define CONFIG_DCA_ENCODER 0
-#define CONFIG_EAC3_ENCODER 0
-#define CONFIG_FLAC_ENCODER 0
-#define CONFIG_G723_1_ENCODER 0
-#define CONFIG_MLP_ENCODER 0
-#define CONFIG_MP2_ENCODER 0
-#define CONFIG_MP2FIXED_ENCODER 0
-#define CONFIG_NELLYMOSER_ENCODER 0
-#define CONFIG_RA_144_ENCODER 0
-#define CONFIG_SONIC_ENCODER 0
-#define CONFIG_SONIC_LS_ENCODER 0
-#define CONFIG_TRUEHD_ENCODER 0
-#define CONFIG_TTA_ENCODER 0
-#define CONFIG_VORBIS_ENCODER 0
-#define CONFIG_WAVPACK_ENCODER 0
-#define CONFIG_WMAV1_ENCODER 0
-#define CONFIG_WMAV2_ENCODER 0
-#define CONFIG_PCM_ALAW_ENCODER 0
-#define CONFIG_PCM_F32BE_ENCODER 0
-#define CONFIG_PCM_F32LE_ENCODER 0
-#define CONFIG_PCM_F64BE_ENCODER 0
-#define CONFIG_PCM_F64LE_ENCODER 0
-#define CONFIG_PCM_MULAW_ENCODER 0
-#define CONFIG_PCM_S8_ENCODER 0
-#define CONFIG_PCM_S8_PLANAR_ENCODER 0
-#define CONFIG_PCM_S16BE_ENCODER 0
-#define CONFIG_PCM_S16BE_PLANAR_ENCODER 0
-#define CONFIG_PCM_S16LE_ENCODER 0
-#define CONFIG_PCM_S16LE_PLANAR_ENCODER 0
-#define CONFIG_PCM_S24BE_ENCODER 0
-#define CONFIG_PCM_S24DAUD_ENCODER 0
-#define CONFIG_PCM_S24LE_ENCODER 0
-#define CONFIG_PCM_S24LE_PLANAR_ENCODER 0
-#define CONFIG_PCM_S32BE_ENCODER 0
-#define CONFIG_PCM_S32LE_ENCODER 0
-#define CONFIG_PCM_S32LE_PLANAR_ENCODER 0
-#define CONFIG_PCM_S64BE_ENCODER 0
-#define CONFIG_PCM_S64LE_ENCODER 0
-#define CONFIG_PCM_U8_ENCODER 0
-#define CONFIG_PCM_U16BE_ENCODER 0
-#define CONFIG_PCM_U16LE_ENCODER 0
-#define CONFIG_PCM_U24BE_ENCODER 0
-#define CONFIG_PCM_U24LE_ENCODER 0
-#define CONFIG_PCM_U32BE_ENCODER 0
-#define CONFIG_PCM_U32LE_ENCODER 0
-#define CONFIG_ROQ_DPCM_ENCODER 0
-#define CONFIG_ADPCM_ADX_ENCODER 0
-#define CONFIG_ADPCM_G722_ENCODER 0
-#define CONFIG_ADPCM_G726_ENCODER 0
-#define CONFIG_ADPCM_IMA_QT_ENCODER 0
-#define CONFIG_ADPCM_IMA_WAV_ENCODER 0
-#define CONFIG_ADPCM_MS_ENCODER 0
-#define CONFIG_ADPCM_SWF_ENCODER 0
-#define CONFIG_ADPCM_YAMAHA_ENCODER 0
-#define CONFIG_SSA_ENCODER 0
-#define CONFIG_ASS_ENCODER 0
-#define CONFIG_DVBSUB_ENCODER 0
-#define CONFIG_DVDSUB_ENCODER 0
-#define CONFIG_MOVTEXT_ENCODER 0
-#define CONFIG_SRT_ENCODER 0
-#define CONFIG_SUBRIP_ENCODER 0
-#define CONFIG_TEXT_ENCODER 0
-#define CONFIG_WEBVTT_ENCODER 0
-#define CONFIG_XSUB_ENCODER 0
-#define CONFIG_AAC_AT_ENCODER 0
-#define CONFIG_ALAC_AT_ENCODER 0
-#define CONFIG_ILBC_AT_ENCODER 0
-#define CONFIG_PCM_ALAW_AT_ENCODER 0
-#define CONFIG_PCM_MULAW_AT_ENCODER 0
-#define CONFIG_LIBFDK_AAC_ENCODER 0
-#define CONFIG_LIBGSM_ENCODER 0
-#define CONFIG_LIBGSM_MS_ENCODER 0
-#define CONFIG_LIBILBC_ENCODER 0
-#define CONFIG_LIBMP3LAME_ENCODER 0
-#define CONFIG_LIBOPENCORE_AMRNB_ENCODER 0
-#define CONFIG_LIBOPENJPEG_ENCODER 0
-#define CONFIG_LIBOPUS_ENCODER 0
-#define CONFIG_LIBSCHROEDINGER_ENCODER 0
-#define CONFIG_LIBSHINE_ENCODER 0
-#define CONFIG_LIBSPEEX_ENCODER 0
-#define CONFIG_LIBTHEORA_ENCODER 0
-#define CONFIG_LIBTWOLAME_ENCODER 0
-#define CONFIG_LIBVO_AMRWBENC_ENCODER 0
-#define CONFIG_LIBVORBIS_ENCODER 0
-#define CONFIG_LIBVPX_VP8_ENCODER 0
-#define CONFIG_LIBVPX_VP9_ENCODER 0
-#define CONFIG_LIBWAVPACK_ENCODER 0
-#define CONFIG_LIBWEBP_ANIM_ENCODER 0
-#define CONFIG_LIBWEBP_ENCODER 0
-#define CONFIG_LIBX262_ENCODER 0
-#define CONFIG_LIBX264_ENCODER 0
-#define CONFIG_LIBX264RGB_ENCODER 0
-#define CONFIG_LIBX265_ENCODER 0
-#define CONFIG_LIBXAVS_ENCODER 0
-#define CONFIG_LIBXVID_ENCODER 0
-#define CONFIG_LIBOPENH264_ENCODER 0
-#define CONFIG_H264_NVENC_ENCODER 0
-#define CONFIG_H264_OMX_ENCODER 0
-#define CONFIG_H264_QSV_ENCODER 0
-#define CONFIG_H264_VAAPI_ENCODER 0
-#define CONFIG_H264_VIDEOTOOLBOX_ENCODER 0
-#define CONFIG_NVENC_ENCODER 0
-#define CONFIG_NVENC_H264_ENCODER 0
-#define CONFIG_NVENC_HEVC_ENCODER 0
-#define CONFIG_HEVC_NVENC_ENCODER 0
-#define CONFIG_HEVC_QSV_ENCODER 0
-#define CONFIG_HEVC_VAAPI_ENCODER 0
-#define CONFIG_LIBKVAZAAR_ENCODER 0
-#define CONFIG_MJPEG_VAAPI_ENCODER 0
-#define CONFIG_MPEG2_QSV_ENCODER 0
-#define CONFIG_ABENCH_FILTER 0
-#define CONFIG_ACOMPRESSOR_FILTER 0
-#define CONFIG_ACROSSFADE_FILTER 0
-#define CONFIG_ACRUSHER_FILTER 0
-#define CONFIG_ADELAY_FILTER 0
-#define CONFIG_AECHO_FILTER 0
-#define CONFIG_AEMPHASIS_FILTER 0
-#define CONFIG_AEVAL_FILTER 0
-#define CONFIG_AFADE_FILTER 0
-#define CONFIG_AFFTFILT_FILTER 0
-#define CONFIG_AFORMAT_FILTER 0
-#define CONFIG_AGATE_FILTER 0
-#define CONFIG_AINTERLEAVE_FILTER 0
-#define CONFIG_ALIMITER_FILTER 0
-#define CONFIG_ALLPASS_FILTER 0
-#define CONFIG_ALOOP_FILTER 0
-#define CONFIG_AMERGE_FILTER 0
-#define CONFIG_AMETADATA_FILTER 0
-#define CONFIG_AMIX_FILTER 0
-#define CONFIG_ANEQUALIZER_FILTER 0
-#define CONFIG_ANULL_FILTER 0
-#define CONFIG_APAD_FILTER 0
-#define CONFIG_APERMS_FILTER 0
-#define CONFIG_APHASER_FILTER 0
-#define CONFIG_APULSATOR_FILTER 0
-#define CONFIG_AREALTIME_FILTER 0
-#define CONFIG_ARESAMPLE_FILTER 0
-#define CONFIG_AREVERSE_FILTER 0
-#define CONFIG_ASELECT_FILTER 0
-#define CONFIG_ASENDCMD_FILTER 0
-#define CONFIG_ASETNSAMPLES_FILTER 0
-#define CONFIG_ASETPTS_FILTER 0
-#define CONFIG_ASETRATE_FILTER 0
-#define CONFIG_ASETTB_FILTER 0
-#define CONFIG_ASHOWINFO_FILTER 0
-#define CONFIG_ASIDEDATA_FILTER 0
-#define CONFIG_ASPLIT_FILTER 0
-#define CONFIG_ASTATS_FILTER 0
-#define CONFIG_ASTREAMSELECT_FILTER 0
-#define CONFIG_ASYNCTS_FILTER 0
-#define CONFIG_ATEMPO_FILTER 0
-#define CONFIG_ATRIM_FILTER 0
-#define CONFIG_AZMQ_FILTER 0
-#define CONFIG_BANDPASS_FILTER 0
-#define CONFIG_BANDREJECT_FILTER 0
-#define CONFIG_BASS_FILTER 0
-#define CONFIG_BIQUAD_FILTER 0
-#define CONFIG_BS2B_FILTER 0
-#define CONFIG_CHANNELMAP_FILTER 0
-#define CONFIG_CHANNELSPLIT_FILTER 0
-#define CONFIG_CHORUS_FILTER 0
-#define CONFIG_COMPAND_FILTER 0
-#define CONFIG_COMPENSATIONDELAY_FILTER 0
-#define CONFIG_CRYSTALIZER_FILTER 0
-#define CONFIG_DCSHIFT_FILTER 0
-#define CONFIG_DYNAUDNORM_FILTER 0
-#define CONFIG_EARWAX_FILTER 0
-#define CONFIG_EBUR128_FILTER 0
-#define CONFIG_EQUALIZER_FILTER 0
-#define CONFIG_EXTRASTEREO_FILTER 0
-#define CONFIG_FIREQUALIZER_FILTER 0
-#define CONFIG_FLANGER_FILTER 0
-#define CONFIG_HDCD_FILTER 0
-#define CONFIG_HIGHPASS_FILTER 0
-#define CONFIG_JOIN_FILTER 0
-#define CONFIG_LADSPA_FILTER 0
-#define CONFIG_LOUDNORM_FILTER 0
-#define CONFIG_LOWPASS_FILTER 0
-#define CONFIG_PAN_FILTER 0
-#define CONFIG_REPLAYGAIN_FILTER 0
-#define CONFIG_RESAMPLE_FILTER 0
-#define CONFIG_RUBBERBAND_FILTER 0
-#define CONFIG_SIDECHAINCOMPRESS_FILTER 0
-#define CONFIG_SIDECHAINGATE_FILTER 0
-#define CONFIG_SILENCEDETECT_FILTER 0
-#define CONFIG_SILENCEREMOVE_FILTER 0
-#define CONFIG_SOFALIZER_FILTER 0
-#define CONFIG_STEREOTOOLS_FILTER 0
-#define CONFIG_STEREOWIDEN_FILTER 0
-#define CONFIG_TREBLE_FILTER 0
-#define CONFIG_TREMOLO_FILTER 0
-#define CONFIG_VIBRATO_FILTER 0
-#define CONFIG_VOLUME_FILTER 0
-#define CONFIG_VOLUMEDETECT_FILTER 0
-#define CONFIG_AEVALSRC_FILTER 0
-#define CONFIG_ANOISESRC_FILTER 0
-#define CONFIG_ANULLSRC_FILTER 0
-#define CONFIG_FLITE_FILTER 0
-#define CONFIG_SINE_FILTER 0
-#define CONFIG_ANULLSINK_FILTER 0
-#define CONFIG_ALPHAEXTRACT_FILTER 0
-#define CONFIG_ALPHAMERGE_FILTER 0
-#define CONFIG_ASS_FILTER 0
-#define CONFIG_ATADENOISE_FILTER 0
-#define CONFIG_AVGBLUR_FILTER 0
-#define CONFIG_BBOX_FILTER 0
-#define CONFIG_BENCH_FILTER 0
-#define CONFIG_BITPLANENOISE_FILTER 0
-#define CONFIG_BLACKDETECT_FILTER 0
-#define CONFIG_BLACKFRAME_FILTER 0
-#define CONFIG_BLEND_FILTER 0
-#define CONFIG_BOXBLUR_FILTER 0
-#define CONFIG_BWDIF_FILTER 0
-#define CONFIG_CHROMAKEY_FILTER 0
-#define CONFIG_CIESCOPE_FILTER 0
-#define CONFIG_CODECVIEW_FILTER 0
-#define CONFIG_COLORBALANCE_FILTER 0
-#define CONFIG_COLORCHANNELMIXER_FILTER 0
-#define CONFIG_COLORKEY_FILTER 0
-#define CONFIG_COLORLEVELS_FILTER 0
-#define CONFIG_COLORMATRIX_FILTER 0
-#define CONFIG_COLORSPACE_FILTER 0
-#define CONFIG_CONVOLUTION_FILTER 0
-#define CONFIG_COPY_FILTER 0
-#define CONFIG_COREIMAGE_FILTER 0
-#define CONFIG_COVER_RECT_FILTER 0
-#define CONFIG_CROP_FILTER 0
-#define CONFIG_CROPDETECT_FILTER 0
-#define CONFIG_CURVES_FILTER 0
-#define CONFIG_DATASCOPE_FILTER 0
-#define CONFIG_DCTDNOIZ_FILTER 0
-#define CONFIG_DEBAND_FILTER 0
-#define CONFIG_DECIMATE_FILTER 0
-#define CONFIG_DEFLATE_FILTER 0
-#define CONFIG_DEJUDDER_FILTER 0
-#define CONFIG_DELOGO_FILTER 0
-#define CONFIG_DESHAKE_FILTER 0
-#define CONFIG_DETELECINE_FILTER 0
-#define CONFIG_DILATION_FILTER 0
-#define CONFIG_DISPLACE_FILTER 0
-#define CONFIG_DRAWBOX_FILTER 0
-#define CONFIG_DRAWGRAPH_FILTER 0
-#define CONFIG_DRAWGRID_FILTER 0
-#define CONFIG_DRAWTEXT_FILTER 0
-#define CONFIG_EDGEDETECT_FILTER 0
-#define CONFIG_ELBG_FILTER 0
-#define CONFIG_EQ_FILTER 0
-#define CONFIG_EROSION_FILTER 0
-#define CONFIG_EXTRACTPLANES_FILTER 0
-#define CONFIG_FADE_FILTER 0
-#define CONFIG_FFTFILT_FILTER 0
-#define CONFIG_FIELD_FILTER 0
-#define CONFIG_FIELDHINT_FILTER 0
-#define CONFIG_FIELDMATCH_FILTER 0
-#define CONFIG_FIELDORDER_FILTER 0
-#define CONFIG_FIND_RECT_FILTER 0
-#define CONFIG_FORMAT_FILTER 0
-#define CONFIG_FPS_FILTER 0
-#define CONFIG_FRAMEPACK_FILTER 0
-#define CONFIG_FRAMERATE_FILTER 0
-#define CONFIG_FRAMESTEP_FILTER 0
-#define CONFIG_FREI0R_FILTER 0
-#define CONFIG_FSPP_FILTER 0
-#define CONFIG_GBLUR_FILTER 0
-#define CONFIG_GEQ_FILTER 0
-#define CONFIG_GRADFUN_FILTER 0
-#define CONFIG_HALDCLUT_FILTER 0
-#define CONFIG_HFLIP_FILTER 0
-#define CONFIG_HISTEQ_FILTER 0
-#define CONFIG_HISTOGRAM_FILTER 0
-#define CONFIG_HQDN3D_FILTER 0
-#define CONFIG_HQX_FILTER 0
-#define CONFIG_HSTACK_FILTER 0
-#define CONFIG_HUE_FILTER 0
-#define CONFIG_HWDOWNLOAD_FILTER 0
-#define CONFIG_HWUPLOAD_FILTER 0
-#define CONFIG_HWUPLOAD_CUDA_FILTER 0
-#define CONFIG_HYSTERESIS_FILTER 0
-#define CONFIG_IDET_FILTER 0
-#define CONFIG_IL_FILTER 0
-#define CONFIG_INFLATE_FILTER 0
-#define CONFIG_INTERLACE_FILTER 0
-#define CONFIG_INTERLEAVE_FILTER 0
-#define CONFIG_KERNDEINT_FILTER 0
-#define CONFIG_LENSCORRECTION_FILTER 0
-#define CONFIG_LOOP_FILTER 0
-#define CONFIG_LUT_FILTER 0
-#define CONFIG_LUT2_FILTER 0
-#define CONFIG_LUT3D_FILTER 0
-#define CONFIG_LUTRGB_FILTER 0
-#define CONFIG_LUTYUV_FILTER 0
-#define CONFIG_MASKEDCLAMP_FILTER 0
-#define CONFIG_MASKEDMERGE_FILTER 0
-#define CONFIG_MCDEINT_FILTER 0
-#define CONFIG_MERGEPLANES_FILTER 0
-#define CONFIG_MESTIMATE_FILTER 0
-#define CONFIG_METADATA_FILTER 0
-#define CONFIG_MINTERPOLATE_FILTER 0
-#define CONFIG_MPDECIMATE_FILTER 0
-#define CONFIG_NEGATE_FILTER 0
-#define CONFIG_NLMEANS_FILTER 0
-#define CONFIG_NNEDI_FILTER 0
-#define CONFIG_NOFORMAT_FILTER 0
-#define CONFIG_NOISE_FILTER 0
-#define CONFIG_NULL_FILTER 0
-#define CONFIG_OCR_FILTER 0
-#define CONFIG_OCV_FILTER 0
-#define CONFIG_OVERLAY_FILTER 0
-#define CONFIG_OWDENOISE_FILTER 0
-#define CONFIG_PAD_FILTER 0
-#define CONFIG_PALETTEGEN_FILTER 0
-#define CONFIG_PALETTEUSE_FILTER 0
-#define CONFIG_PERMS_FILTER 0
-#define CONFIG_PERSPECTIVE_FILTER 0
-#define CONFIG_PHASE_FILTER 0
-#define CONFIG_PIXDESCTEST_FILTER 0
-#define CONFIG_PP_FILTER 0
-#define CONFIG_PP7_FILTER 0
-#define CONFIG_PREWITT_FILTER 0
-#define CONFIG_PSNR_FILTER 0
-#define CONFIG_PULLUP_FILTER 0
-#define CONFIG_QP_FILTER 0
-#define CONFIG_RANDOM_FILTER 0
-#define CONFIG_READVITC_FILTER 0
-#define CONFIG_REALTIME_FILTER 0
-#define CONFIG_REMAP_FILTER 0
-#define CONFIG_REMOVEGRAIN_FILTER 0
-#define CONFIG_REMOVELOGO_FILTER 0
-#define CONFIG_REPEATFIELDS_FILTER 0
-#define CONFIG_REVERSE_FILTER 0
-#define CONFIG_ROTATE_FILTER 0
-#define CONFIG_SAB_FILTER 0
-#define CONFIG_SCALE_FILTER 0
-#define CONFIG_SCALE_NPP_FILTER 0
-#define CONFIG_SCALE_VAAPI_FILTER 0
-#define CONFIG_SCALE2REF_FILTER 0
-#define CONFIG_SELECT_FILTER 0
-#define CONFIG_SELECTIVECOLOR_FILTER 0
-#define CONFIG_SENDCMD_FILTER 0
-#define CONFIG_SEPARATEFIELDS_FILTER 0
-#define CONFIG_SETDAR_FILTER 0
-#define CONFIG_SETFIELD_FILTER 0
-#define CONFIG_SETPTS_FILTER 0
-#define CONFIG_SETSAR_FILTER 0
-#define CONFIG_SETTB_FILTER 0
-#define CONFIG_SHOWINFO_FILTER 0
-#define CONFIG_SHOWPALETTE_FILTER 0
-#define CONFIG_SHUFFLEFRAMES_FILTER 0
-#define CONFIG_SHUFFLEPLANES_FILTER 0
-#define CONFIG_SIDEDATA_FILTER 0
-#define CONFIG_SIGNALSTATS_FILTER 0
-#define CONFIG_SMARTBLUR_FILTER 0
-#define CONFIG_SOBEL_FILTER 0
-#define CONFIG_SPLIT_FILTER 0
-#define CONFIG_SPP_FILTER 0
-#define CONFIG_SSIM_FILTER 0
-#define CONFIG_STEREO3D_FILTER 0
-#define CONFIG_STREAMSELECT_FILTER 0
-#define CONFIG_SUBTITLES_FILTER 0
-#define CONFIG_SUPER2XSAI_FILTER 0
-#define CONFIG_SWAPRECT_FILTER 0
-#define CONFIG_SWAPUV_FILTER 0
-#define CONFIG_TBLEND_FILTER 0
-#define CONFIG_TELECINE_FILTER 0
-#define CONFIG_THUMBNAIL_FILTER 0
-#define CONFIG_TILE_FILTER 0
-#define CONFIG_TINTERLACE_FILTER 0
-#define CONFIG_TRANSPOSE_FILTER 0
-#define CONFIG_TRIM_FILTER 0
-#define CONFIG_UNSHARP_FILTER 0
-#define CONFIG_USPP_FILTER 0
-#define CONFIG_VAGUEDENOISER_FILTER 0
-#define CONFIG_VECTORSCOPE_FILTER 0
-#define CONFIG_VFLIP_FILTER 0
-#define CONFIG_VIDSTABDETECT_FILTER 0
-#define CONFIG_VIDSTABTRANSFORM_FILTER 0
-#define CONFIG_VIGNETTE_FILTER 0
-#define CONFIG_VSTACK_FILTER 0
-#define CONFIG_W3FDIF_FILTER 0
-#define CONFIG_WAVEFORM_FILTER 0
-#define CONFIG_WEAVE_FILTER 0
-#define CONFIG_XBR_FILTER 0
-#define CONFIG_YADIF_FILTER 0
-#define CONFIG_ZMQ_FILTER 0
-#define CONFIG_ZOOMPAN_FILTER 0
-#define CONFIG_ZSCALE_FILTER 0
-#define CONFIG_ALLRGB_FILTER 0
-#define CONFIG_ALLYUV_FILTER 0
-#define CONFIG_CELLAUTO_FILTER 0
-#define CONFIG_COLOR_FILTER 0
-#define CONFIG_COREIMAGESRC_FILTER 0
-#define CONFIG_FREI0R_SRC_FILTER 0
-#define CONFIG_HALDCLUTSRC_FILTER 0
-#define CONFIG_LIFE_FILTER 0
-#define CONFIG_MANDELBROT_FILTER 0
-#define CONFIG_MPTESTSRC_FILTER 0
-#define CONFIG_NULLSRC_FILTER 0
-#define CONFIG_RGBTESTSRC_FILTER 0
-#define CONFIG_SMPTEBARS_FILTER 0
-#define CONFIG_SMPTEHDBARS_FILTER 0
-#define CONFIG_TESTSRC_FILTER 0
-#define CONFIG_TESTSRC2_FILTER 0
-#define CONFIG_YUVTESTSRC_FILTER 0
-#define CONFIG_NULLSINK_FILTER 0
-#define CONFIG_ADRAWGRAPH_FILTER 0
-#define CONFIG_AHISTOGRAM_FILTER 0
-#define CONFIG_APHASEMETER_FILTER 0
-#define CONFIG_AVECTORSCOPE_FILTER 0
-#define CONFIG_CONCAT_FILTER 0
-#define CONFIG_SHOWCQT_FILTER 0
-#define CONFIG_SHOWFREQS_FILTER 0
-#define CONFIG_SHOWSPECTRUM_FILTER 0
-#define CONFIG_SHOWSPECTRUMPIC_FILTER 0
-#define CONFIG_SHOWVOLUME_FILTER 0
-#define CONFIG_SHOWWAVES_FILTER 0
-#define CONFIG_SHOWWAVESPIC_FILTER 0
-#define CONFIG_SPECTRUMSYNTH_FILTER 0
-#define CONFIG_AMOVIE_FILTER 0
-#define CONFIG_MOVIE_FILTER 0
-#define CONFIG_H263_CUVID_HWACCEL 0
-#define CONFIG_H263_VAAPI_HWACCEL 0
-#define CONFIG_H263_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_H264_CUVID_HWACCEL 0
-#define CONFIG_H264_D3D11VA_HWACCEL 0
-#define CONFIG_H264_DXVA2_HWACCEL 0
-#define CONFIG_H264_MEDIACODEC_HWACCEL 0
-#define CONFIG_H264_MMAL_HWACCEL 0
-#define CONFIG_H264_QSV_HWACCEL 0
-#define CONFIG_H264_VAAPI_HWACCEL 0
-#define CONFIG_H264_VDA_HWACCEL 0
-#define CONFIG_H264_VDA_OLD_HWACCEL 0
-#define CONFIG_H264_VDPAU_HWACCEL 0
-#define CONFIG_H264_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_HEVC_CUVID_HWACCEL 0
-#define CONFIG_HEVC_D3D11VA_HWACCEL 0
-#define CONFIG_HEVC_DXVA2_HWACCEL 0
-#define CONFIG_HEVC_MEDIACODEC_HWACCEL 0
-#define CONFIG_HEVC_QSV_HWACCEL 0
-#define CONFIG_HEVC_VAAPI_HWACCEL 0
-#define CONFIG_HEVC_VDPAU_HWACCEL 0
-#define CONFIG_MJPEG_CUVID_HWACCEL 0
-#define CONFIG_MPEG1_CUVID_HWACCEL 0
-#define CONFIG_MPEG1_XVMC_HWACCEL 0
-#define CONFIG_MPEG1_VDPAU_HWACCEL 0
-#define CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_MPEG2_CUVID_HWACCEL 0
-#define CONFIG_MPEG2_XVMC_HWACCEL 0
-#define CONFIG_MPEG2_D3D11VA_HWACCEL 0
-#define CONFIG_MPEG2_DXVA2_HWACCEL 0
-#define CONFIG_MPEG2_MMAL_HWACCEL 0
-#define CONFIG_MPEG2_QSV_HWACCEL 0
-#define CONFIG_MPEG2_VAAPI_HWACCEL 0
-#define CONFIG_MPEG2_VDPAU_HWACCEL 0
-#define CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_MPEG4_CUVID_HWACCEL 0
-#define CONFIG_MPEG4_MEDIACODEC_HWACCEL 0
-#define CONFIG_MPEG4_MMAL_HWACCEL 0
-#define CONFIG_MPEG4_VAAPI_HWACCEL 0
-#define CONFIG_MPEG4_VDPAU_HWACCEL 0
-#define CONFIG_MPEG4_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_VC1_CUVID_HWACCEL 0
-#define CONFIG_VC1_D3D11VA_HWACCEL 0
-#define CONFIG_VC1_DXVA2_HWACCEL 0
-#define CONFIG_VC1_VAAPI_HWACCEL 0
-#define CONFIG_VC1_VDPAU_HWACCEL 0
-#define CONFIG_VC1_MMAL_HWACCEL 0
-#define CONFIG_VC1_QSV_HWACCEL 0
-#define CONFIG_VP8_CUVID_HWACCEL 0
-#define CONFIG_VP8_MEDIACODEC_HWACCEL 0
-#define CONFIG_VP9_CUVID_HWACCEL 0
-#define CONFIG_VP9_D3D11VA_HWACCEL 0
-#define CONFIG_VP9_DXVA2_HWACCEL 0
-#define CONFIG_VP9_MEDIACODEC_HWACCEL 0
-#define CONFIG_VP9_VAAPI_HWACCEL 0
-#define CONFIG_WMV3_D3D11VA_HWACCEL 0
-#define CONFIG_WMV3_DXVA2_HWACCEL 0
-#define CONFIG_WMV3_VAAPI_HWACCEL 0
-#define CONFIG_WMV3_VDPAU_HWACCEL 0
-#define CONFIG_ALSA_INDEV 0
-#define CONFIG_AVFOUNDATION_INDEV 0
-#define CONFIG_BKTR_INDEV 0
-#define CONFIG_DECKLINK_INDEV 0
-#define CONFIG_DSHOW_INDEV 0
-#define CONFIG_DV1394_INDEV 0
-#define CONFIG_FBDEV_INDEV 0
-#define CONFIG_GDIGRAB_INDEV 0
-#define CONFIG_IEC61883_INDEV 0
-#define CONFIG_JACK_INDEV 0
-#define CONFIG_LAVFI_INDEV 0
-#define CONFIG_OPENAL_INDEV 0
-#define CONFIG_OSS_INDEV 0
-#define CONFIG_PULSE_INDEV 0
-#define CONFIG_QTKIT_INDEV 0
-#define CONFIG_SNDIO_INDEV 0
-#define CONFIG_V4L2_INDEV 0
-#define CONFIG_VFWCAP_INDEV 0
-#define CONFIG_X11GRAB_INDEV 0
-#define CONFIG_X11GRAB_XCB_INDEV 0
-#define CONFIG_LIBCDIO_INDEV 0
-#define CONFIG_LIBDC1394_INDEV 0
-#define CONFIG_A64_MUXER 0
-#define CONFIG_AC3_MUXER 0
-#define CONFIG_ADTS_MUXER 0
-#define CONFIG_ADX_MUXER 0
-#define CONFIG_AIFF_MUXER 0
-#define CONFIG_AMR_MUXER 0
-#define CONFIG_APNG_MUXER 0
-#define CONFIG_ASF_MUXER 0
-#define CONFIG_ASS_MUXER 0
-#define CONFIG_AST_MUXER 0
-#define CONFIG_ASF_STREAM_MUXER 0
-#define CONFIG_AU_MUXER 0
-#define CONFIG_AVI_MUXER 0
-#define CONFIG_AVM2_MUXER 0
-#define CONFIG_BIT_MUXER 0
-#define CONFIG_CAF_MUXER 0
-#define CONFIG_CAVSVIDEO_MUXER 0
-#define CONFIG_CRC_MUXER 0
-#define CONFIG_DASH_MUXER 0
-#define CONFIG_DATA_MUXER 0
-#define CONFIG_DAUD_MUXER 0
-#define CONFIG_DIRAC_MUXER 0
-#define CONFIG_DNXHD_MUXER 0
-#define CONFIG_DTS_MUXER 0
-#define CONFIG_DV_MUXER 0
-#define CONFIG_EAC3_MUXER 0
-#define CONFIG_F4V_MUXER 0
-#define CONFIG_FFM_MUXER 0
-#define CONFIG_FFMETADATA_MUXER 0
-#define CONFIG_FIFO_MUXER 0
-#define CONFIG_FILMSTRIP_MUXER 0
-#define CONFIG_FLAC_MUXER 0
-#define CONFIG_FLV_MUXER 0
-#define CONFIG_FRAMECRC_MUXER 0
-#define CONFIG_FRAMEHASH_MUXER 0
-#define CONFIG_FRAMEMD5_MUXER 0
-#define CONFIG_G722_MUXER 0
-#define CONFIG_G723_1_MUXER 0
-#define CONFIG_GIF_MUXER 0
-#define CONFIG_GSM_MUXER 0
-#define CONFIG_GXF_MUXER 0
-#define CONFIG_H261_MUXER 0
-#define CONFIG_H263_MUXER 0
-#define CONFIG_H264_MUXER 0
-#define CONFIG_HASH_MUXER 0
-#define CONFIG_HDS_MUXER 0
-#define CONFIG_HEVC_MUXER 0
-#define CONFIG_HLS_MUXER 0
-#define CONFIG_ICO_MUXER 0
-#define CONFIG_ILBC_MUXER 0
-#define CONFIG_IMAGE2_MUXER 0
-#define CONFIG_IMAGE2PIPE_MUXER 0
-#define CONFIG_IPOD_MUXER 0
-#define CONFIG_IRCAM_MUXER 0
-#define CONFIG_ISMV_MUXER 0
-#define CONFIG_IVF_MUXER 0
-#define CONFIG_JACOSUB_MUXER 0
-#define CONFIG_LATM_MUXER 0
-#define CONFIG_LRC_MUXER 0
-#define CONFIG_M4V_MUXER 0
-#define CONFIG_MD5_MUXER 0
-#define CONFIG_MATROSKA_MUXER 0
-#define CONFIG_MATROSKA_AUDIO_MUXER 0
-#define CONFIG_MICRODVD_MUXER 0
-#define CONFIG_MJPEG_MUXER 0
-#define CONFIG_MLP_MUXER 0
-#define CONFIG_MMF_MUXER 0
-#define CONFIG_MOV_MUXER 0
-#define CONFIG_MP2_MUXER 0
-#define CONFIG_MP3_MUXER 0
-#define CONFIG_MP4_MUXER 0
-#define CONFIG_MPEG1SYSTEM_MUXER 0
-#define CONFIG_MPEG1VCD_MUXER 0
-#define CONFIG_MPEG1VIDEO_MUXER 0
-#define CONFIG_MPEG2DVD_MUXER 0
-#define CONFIG_MPEG2SVCD_MUXER 0
-#define CONFIG_MPEG2VIDEO_MUXER 0
-#define CONFIG_MPEG2VOB_MUXER 0
-#define CONFIG_MPEGTS_MUXER 0
-#define CONFIG_MPJPEG_MUXER 0
-#define CONFIG_MXF_MUXER 0
-#define CONFIG_MXF_D10_MUXER 0
-#define CONFIG_MXF_OPATOM_MUXER 0
-#define CONFIG_NULL_MUXER 0
-#define CONFIG_NUT_MUXER 0
-#define CONFIG_OGA_MUXER 0
-#define CONFIG_OGG_MUXER 0
-#define CONFIG_OGV_MUXER 0
-#define CONFIG_OMA_MUXER 0
-#define CONFIG_OPUS_MUXER 0
-#define CONFIG_PCM_ALAW_MUXER 0
-#define CONFIG_PCM_MULAW_MUXER 0
-#define CONFIG_PCM_F64BE_MUXER 0
-#define CONFIG_PCM_F64LE_MUXER 0
-#define CONFIG_PCM_F32BE_MUXER 0
-#define CONFIG_PCM_F32LE_MUXER 0
-#define CONFIG_PCM_S32BE_MUXER 0
-#define CONFIG_PCM_S32LE_MUXER 0
-#define CONFIG_PCM_S24BE_MUXER 0
-#define CONFIG_PCM_S24LE_MUXER 0
-#define CONFIG_PCM_S16BE_MUXER 0
-#define CONFIG_PCM_S16LE_MUXER 0
-#define CONFIG_PCM_S8_MUXER 0
-#define CONFIG_PCM_U32BE_MUXER 0
-#define CONFIG_PCM_U32LE_MUXER 0
-#define CONFIG_PCM_U24BE_MUXER 0
-#define CONFIG_PCM_U24LE_MUXER 0
-#define CONFIG_PCM_U16BE_MUXER 0
-#define CONFIG_PCM_U16LE_MUXER 0
-#define CONFIG_PCM_U8_MUXER 0
-#define CONFIG_PSP_MUXER 0
-#define CONFIG_RAWVIDEO_MUXER 0
-#define CONFIG_RM_MUXER 0
-#define CONFIG_ROQ_MUXER 0
-#define CONFIG_RSO_MUXER 0
-#define CONFIG_RTP_MUXER 0
-#define CONFIG_RTP_MPEGTS_MUXER 0
-#define CONFIG_RTSP_MUXER 0
-#define CONFIG_SAP_MUXER 0
-#define CONFIG_SEGMENT_MUXER 0
-#define CONFIG_STREAM_SEGMENT_MUXER 0
-#define CONFIG_SINGLEJPEG_MUXER 0
-#define CONFIG_SMJPEG_MUXER 0
-#define CONFIG_SMOOTHSTREAMING_MUXER 0
-#define CONFIG_SOX_MUXER 0
-#define CONFIG_SPX_MUXER 0
-#define CONFIG_SPDIF_MUXER 0
-#define CONFIG_SRT_MUXER 0
-#define CONFIG_SWF_MUXER 0
-#define CONFIG_TEE_MUXER 0
-#define CONFIG_TG2_MUXER 0
-#define CONFIG_TGP_MUXER 0
-#define CONFIG_MKVTIMESTAMP_V2_MUXER 0
-#define CONFIG_TRUEHD_MUXER 0
-#define CONFIG_TTA_MUXER 0
-#define CONFIG_UNCODEDFRAMECRC_MUXER 0
-#define CONFIG_VC1_MUXER 0
-#define CONFIG_VC1T_MUXER 0
-#define CONFIG_VOC_MUXER 0
-#define CONFIG_W64_MUXER 0
-#define CONFIG_WAV_MUXER 0
-#define CONFIG_WEBM_MUXER 0
-#define CONFIG_WEBM_DASH_MANIFEST_MUXER 0
-#define CONFIG_WEBM_CHUNK_MUXER 0
-#define CONFIG_WEBP_MUXER 0
-#define CONFIG_WEBVTT_MUXER 0
-#define CONFIG_WTV_MUXER 0
-#define CONFIG_WV_MUXER 0
-#define CONFIG_YUV4MPEGPIPE_MUXER 0
-#define CONFIG_CHROMAPRINT_MUXER 0
-#define CONFIG_LIBNUT_MUXER 0
-#define CONFIG_ALSA_OUTDEV 0
-#define CONFIG_CACA_OUTDEV 0
-#define CONFIG_DECKLINK_OUTDEV 0
-#define CONFIG_FBDEV_OUTDEV 0
-#define CONFIG_OPENGL_OUTDEV 0
-#define CONFIG_OSS_OUTDEV 0
-#define CONFIG_PULSE_OUTDEV 0
-#define CONFIG_SDL2_OUTDEV 0
-#define CONFIG_SNDIO_OUTDEV 0
-#define CONFIG_V4L2_OUTDEV 0
-#define CONFIG_XV_OUTDEV 0
-#define CONFIG_AAC_PARSER 0
-#define CONFIG_AAC_LATM_PARSER 0
-#define CONFIG_AC3_PARSER 0
-#define CONFIG_ADX_PARSER 0
-#define CONFIG_BMP_PARSER 0
-#define CONFIG_CAVSVIDEO_PARSER 0
-#define CONFIG_COOK_PARSER 0
-#define CONFIG_DCA_PARSER 0
-#define CONFIG_DIRAC_PARSER 0
-#define CONFIG_DNXHD_PARSER 0
-#define CONFIG_DPX_PARSER 0
-#define CONFIG_DVAUDIO_PARSER 0
-#define CONFIG_DVBSUB_PARSER 0
-#define CONFIG_DVDSUB_PARSER 0
-#define CONFIG_DVD_NAV_PARSER 0
-#define CONFIG_FLAC_PARSER 1
-#define CONFIG_G729_PARSER 0
-#define CONFIG_GSM_PARSER 0
-#define CONFIG_H261_PARSER 0
-#define CONFIG_H263_PARSER 0
-#define CONFIG_H264_PARSER 0
-#define CONFIG_HEVC_PARSER 0
-#define CONFIG_MJPEG_PARSER 0
-#define CONFIG_MLP_PARSER 0
-#define CONFIG_MPEG4VIDEO_PARSER 0
-#define CONFIG_MPEGAUDIO_PARSER 0
-#define CONFIG_MPEGVIDEO_PARSER 0
-#define CONFIG_OPUS_PARSER 0
-#define CONFIG_PNG_PARSER 0
-#define CONFIG_PNM_PARSER 0
-#define CONFIG_RV30_PARSER 0
-#define CONFIG_RV40_PARSER 0
-#define CONFIG_TAK_PARSER 0
-#define CONFIG_VC1_PARSER 0
-#define CONFIG_VORBIS_PARSER 0
-#define CONFIG_VP3_PARSER 0
+#define CONFIG_FLAC_PARSER 0
#define CONFIG_VP8_PARSER 1
#define CONFIG_VP9_PARSER 1
-#define CONFIG_ASYNC_PROTOCOL 0
-#define CONFIG_BLURAY_PROTOCOL 0
-#define CONFIG_CACHE_PROTOCOL 0
-#define CONFIG_CONCAT_PROTOCOL 0
-#define CONFIG_CRYPTO_PROTOCOL 0
-#define CONFIG_DATA_PROTOCOL 0
-#define CONFIG_FFRTMPCRYPT_PROTOCOL 0
-#define CONFIG_FFRTMPHTTP_PROTOCOL 0
-#define CONFIG_FILE_PROTOCOL 0
-#define CONFIG_FTP_PROTOCOL 0
-#define CONFIG_GOPHER_PROTOCOL 0
-#define CONFIG_HLS_PROTOCOL 0
-#define CONFIG_HTTP_PROTOCOL 0
-#define CONFIG_HTTPPROXY_PROTOCOL 0
-#define CONFIG_HTTPS_PROTOCOL 0
-#define CONFIG_ICECAST_PROTOCOL 0
-#define CONFIG_MMSH_PROTOCOL 0
-#define CONFIG_MMST_PROTOCOL 0
-#define CONFIG_MD5_PROTOCOL 0
-#define CONFIG_PIPE_PROTOCOL 0
-#define CONFIG_RTMP_PROTOCOL 0
-#define CONFIG_RTMPE_PROTOCOL 0
-#define CONFIG_RTMPS_PROTOCOL 0
-#define CONFIG_RTMPT_PROTOCOL 0
-#define CONFIG_RTMPTE_PROTOCOL 0
-#define CONFIG_RTMPTS_PROTOCOL 0
-#define CONFIG_RTP_PROTOCOL 0
-#define CONFIG_SCTP_PROTOCOL 0
-#define CONFIG_SRTP_PROTOCOL 0
-#define CONFIG_SUBFILE_PROTOCOL 0
-#define CONFIG_TEE_PROTOCOL 0
-#define CONFIG_TCP_PROTOCOL 0
-#define CONFIG_TLS_GNUTLS_PROTOCOL 0
-#define CONFIG_TLS_SCHANNEL_PROTOCOL 0
-#define CONFIG_TLS_SECURETRANSPORT_PROTOCOL 0
-#define CONFIG_TLS_OPENSSL_PROTOCOL 0
-#define CONFIG_UDP_PROTOCOL 0
-#define CONFIG_UDPLITE_PROTOCOL 0
-#define CONFIG_UNIX_PROTOCOL 0
-#define CONFIG_LIBRTMP_PROTOCOL 0
-#define CONFIG_LIBRTMPE_PROTOCOL 0
-#define CONFIG_LIBRTMPS_PROTOCOL 0
-#define CONFIG_LIBRTMPT_PROTOCOL 0
-#define CONFIG_LIBRTMPTE_PROTOCOL 0
-#define CONFIG_LIBSSH_PROTOCOL 0
-#define CONFIG_LIBSMBCLIENT_PROTOCOL 0
#endif /* FFMPEG_CONFIG_H */
diff --git a/media/ffvpx/config_win32.asm b/media/ffvpx/config_win32.asm
index 85eef2216e..c804c01550 100644
--- a/media/ffvpx/config_win32.asm
+++ b/media/ffvpx/config_win32.asm
@@ -63,8 +63,8 @@
%define HAVE_MIPSDSP 0
%define HAVE_MIPSDSPR2 0
%define HAVE_MSA 0
-%define HAVE_LOONGSON2 1
-%define HAVE_LOONGSON3 1
+%define HAVE_LOONGSON2 0
+%define HAVE_LOONGSON3 0
%define HAVE_MMI 0
%define HAVE_ARMV5TE_EXTERNAL 0
%define HAVE_ARMV6_EXTERNAL 0
@@ -162,31 +162,32 @@
%define HAVE_LOCAL_ALIGNED_16 1
%define HAVE_LOCAL_ALIGNED_32 1
%define HAVE_SIMD_ALIGN_16 1
+%define HAVE_SIMD_ALIGN_32 1
%define HAVE_ATOMICS_GCC 0
%define HAVE_ATOMICS_SUNCC 0
%define HAVE_ATOMICS_WIN32 1
%define HAVE_ATOMIC_CAS_PTR 0
-%define HAVE_ATOMIC_COMPARE_EXCHANGE 0
%define HAVE_MACHINE_RW_BARRIER 0
%define HAVE_MEMORYBARRIER 1
%define HAVE_MM_EMPTY 1
%define HAVE_RDTSC 1
%define HAVE_SARESTART 0
-%define HAVE_SEM_TIMEDWAIT 1
+%define HAVE_SEM_TIMEDWAIT 0
%define HAVE_SYNC_VAL_COMPARE_AND_SWAP 0
%define HAVE_CABS 0
%define HAVE_CEXP 0
%define HAVE_INLINE_ASM 0
%define HAVE_SYMVER 0
-%define HAVE_YASM 1
+%define HAVE_X86ASM 1
%define HAVE_BIGENDIAN 0
%define HAVE_FAST_UNALIGNED 1
-%define HAVE_ALSA_ASOUNDLIB_H 0
%define HAVE_ALTIVEC_H 0
%define HAVE_ARPA_INET_H 0
%define HAVE_ASM_TYPES_H 0
%define HAVE_CDIO_PARANOIA_H 0
%define HAVE_CDIO_PARANOIA_PARANOIA_H 0
+%define HAVE_CUDA_H 0
+%define HAVE_D3D11_H 1
%define HAVE_DISPATCH_DISPATCH_H 0
%define HAVE_DEV_BKTR_IOCTL_BT848_H 0
%define HAVE_DEV_BKTR_IOCTL_METEOR_H 0
@@ -196,7 +197,7 @@
%define HAVE_DIRECT_H 1
%define HAVE_DIRENT_H 0
%define HAVE_DLFCN_H 0
-%define HAVE_D3D11_H 1
+%define HAVE_DXGIDEBUG_H 1
%define HAVE_DXVA_H 1
%define HAVE_ES2_GL_H 0
%define HAVE_GSM_H 0
@@ -205,13 +206,15 @@
%define HAVE_MACHINE_IOCTL_BT848_H 0
%define HAVE_MACHINE_IOCTL_METEOR_H 0
%define HAVE_OPENCV2_CORE_CORE_C_H 0
+%define HAVE_OPENJPEG_2_3_OPENJPEG_H 0
+%define HAVE_OPENJPEG_2_2_OPENJPEG_H 0
%define HAVE_OPENJPEG_2_1_OPENJPEG_H 0
%define HAVE_OPENJPEG_2_0_OPENJPEG_H 0
%define HAVE_OPENJPEG_1_5_OPENJPEG_H 0
%define HAVE_OPENGL_GL3_H 0
%define HAVE_POLL_H 0
-%define HAVE_SNDIO_H 0
%define HAVE_SOUNDCARD_H 0
+%define HAVE_STDATOMIC_H 0
%define HAVE_SYS_MMAN_H 0
%define HAVE_SYS_PARAM_H 0
%define HAVE_SYS_RESOURCE_H 0
@@ -263,7 +266,6 @@
%define HAVE_COMMANDLINETOARGVW 1
%define HAVE_COTASKMEMFREE 1
%define HAVE_CRYPTGENRANDOM 1
-%define HAVE_DLOPEN 0
%define HAVE_FCNTL 0
%define HAVE_FLT_LIM 1
%define HAVE_FORK 0
@@ -283,7 +285,7 @@
%define HAVE_ISATTY 1
%define HAVE_JACK_PORT_GET_LATENCY_RANGE 0
%define HAVE_KBHIT 1
-%define HAVE_LOADLIBRARY 0
+%define HAVE_LOADLIBRARY 1
%define HAVE_LSTAT 0
%define HAVE_LZO1X_999_COMPRESS 0
%define HAVE_MACH_ABSOLUTE_TIME 0
@@ -311,11 +313,13 @@
%define HAVE_OS2THREADS 0
%define HAVE_W32THREADS 1
%define HAVE_AS_DN_DIRECTIVE 0
+%define HAVE_AS_FPU_DIRECTIVE 0
%define HAVE_AS_FUNC 0
%define HAVE_AS_OBJECT_ARCH 0
%define HAVE_ASM_MOD_Q 0
%define HAVE_ATTRIBUTE_MAY_ALIAS 0
%define HAVE_ATTRIBUTE_PACKED 0
+%define HAVE_BLOCKS_EXTENSION 0
%define HAVE_EBP_AVAILABLE 0
%define HAVE_EBX_AVAILABLE 0
%define HAVE_GNU_AS 0
@@ -332,12 +336,13 @@
%define HAVE_XFORM_ASM 0
%define HAVE_XMM_CLOBBERS 0
%define HAVE_CONDITION_VARIABLE_PTR 1
+%define HAVE_KCMVIDEOCODECTYPE_HEVC 0
%define HAVE_SOCKLEN_T 1
%define HAVE_STRUCT_ADDRINFO 1
%define HAVE_STRUCT_GROUP_SOURCE_REQ 1
%define HAVE_STRUCT_IP_MREQ_SOURCE 1
%define HAVE_STRUCT_IPV6_MREQ 1
-%define HAVE_STRUCT_MSGHDR_MSG_FLAGS 1
+%define HAVE_STRUCT_MSGHDR_MSG_FLAGS 0
%define HAVE_STRUCT_POLLFD 0
%define HAVE_STRUCT_RUSAGE_RU_MAXRSS 0
%define HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE 0
@@ -348,36 +353,20 @@
%define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 0
%define HAVE_ATOMICS_NATIVE 1
%define HAVE_DOS_PATHS 1
-%define HAVE_DXVA2_LIB 0
-%define HAVE_DXVA2API_COBJ 1
%define HAVE_LIBC_MSVCRT 1
-%define HAVE_LIBDC1394_1 0
-%define HAVE_LIBDC1394_2 0
%define HAVE_MAKEINFO 1
%define HAVE_MAKEINFO_HTML 0
%define HAVE_MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS 0
%define HAVE_PERL 1
%define HAVE_POD2MAN 1
-%define HAVE_SDL2 0
%define HAVE_SECTION_DATA_REL_RO 0
%define HAVE_TEXI2HTML 0
%define HAVE_THREADS 1
+%define HAVE_UWP 0
%define HAVE_VAAPI_DRM 0
%define HAVE_VAAPI_X11 0
%define HAVE_VDPAU_X11 0
%define HAVE_WINRT 0
-%define HAVE_XLIB 0
-%define CONFIG_BSFS 0
-%define CONFIG_DECODERS 1
-%define CONFIG_ENCODERS 0
-%define CONFIG_HWACCELS 0
-%define CONFIG_PARSERS 1
-%define CONFIG_INDEVS 0
-%define CONFIG_OUTDEVS 0
-%define CONFIG_FILTERS 0
-%define CONFIG_DEMUXERS 0
-%define CONFIG_MUXERS 0
-%define CONFIG_PROTOCOLS 0
%define CONFIG_DOC 0
%define CONFIG_HTMLPAGES 0
%define CONFIG_MANPAGES 1
@@ -385,13 +374,17 @@
%define CONFIG_TXTPAGES 1
%define CONFIG_AVIO_DIR_CMD_EXAMPLE 1
%define CONFIG_AVIO_READING_EXAMPLE 1
-%define CONFIG_DECODING_ENCODING_EXAMPLE 0
+%define CONFIG_DECODE_AUDIO_EXAMPLE 1
+%define CONFIG_DECODE_VIDEO_EXAMPLE 1
%define CONFIG_DEMUXING_DECODING_EXAMPLE 0
+%define CONFIG_ENCODE_AUDIO_EXAMPLE 1
+%define CONFIG_ENCODE_VIDEO_EXAMPLE 1
%define CONFIG_EXTRACT_MVS_EXAMPLE 0
%define CONFIG_FILTER_AUDIO_EXAMPLE 0
%define CONFIG_FILTERING_AUDIO_EXAMPLE 0
%define CONFIG_FILTERING_VIDEO_EXAMPLE 0
%define CONFIG_HTTP_MULTICLIENT_EXAMPLE 0
+%define CONFIG_HW_DECODE_EXAMPLE 0
%define CONFIG_METADATA_EXAMPLE 0
%define CONFIG_MUXING_EXAMPLE 0
%define CONFIG_QSVDEC_EXAMPLE 0
@@ -400,27 +393,55 @@
%define CONFIG_SCALING_VIDEO_EXAMPLE 0
%define CONFIG_TRANSCODE_AAC_EXAMPLE 0
%define CONFIG_TRANSCODING_EXAMPLE 0
-%define CONFIG_AVISYNTH 0
+%define CONFIG_ALSA 0
+%define CONFIG_APPKIT 0
+%define CONFIG_AVFOUNDATION 0
%define CONFIG_BZLIB 0
-%define CONFIG_CHROMAPRINT 0
-%define CONFIG_CRYSTALHD 0
-%define CONFIG_DECKLINK 0
+%define CONFIG_COREIMAGE 0
+%define CONFIG_ICONV 0
+%define CONFIG_JACK 0
+%define CONFIG_LIBXCB 0
+%define CONFIG_LIBXCB_SHM 0
+%define CONFIG_LIBXCB_SHAPE 0
+%define CONFIG_LIBXCB_XFIXES 0
+%define CONFIG_LZMA 0
+%define CONFIG_SCHANNEL 1
+%define CONFIG_SDL2 0
+%define CONFIG_SECURETRANSPORT 0
+%define CONFIG_SNDIO 0
+%define CONFIG_XLIB 1
+%define CONFIG_ZLIB 0
+%define CONFIG_AVISYNTH 0
%define CONFIG_FREI0R 0
-%define CONFIG_GCRYPT 0
+%define CONFIG_LIBCDIO 0
+%define CONFIG_LIBRUBBERBAND 0
+%define CONFIG_LIBVIDSTAB 0
+%define CONFIG_LIBX264 0
+%define CONFIG_LIBX265 0
+%define CONFIG_LIBXAVS 0
+%define CONFIG_LIBXVID 0
+%define CONFIG_DECKLINK 0
+%define CONFIG_LIBNDI_NEWTEK 0
+%define CONFIG_LIBFDK_AAC 0
+%define CONFIG_OPENSSL 0
%define CONFIG_GMP 0
+%define CONFIG_LIBOPENCORE_AMRNB 0
+%define CONFIG_LIBOPENCORE_AMRWB 0
+%define CONFIG_LIBVO_AMRWBENC 0
+%define CONFIG_RKMPP 0
+%define CONFIG_LIBSMBCLIENT 0
+%define CONFIG_CHROMAPRINT 0
+%define CONFIG_GCRYPT 0
%define CONFIG_GNUTLS 0
-%define CONFIG_ICONV 0
%define CONFIG_JNI 0
%define CONFIG_LADSPA 0
%define CONFIG_LIBASS 0
%define CONFIG_LIBBLURAY 0
%define CONFIG_LIBBS2B 0
%define CONFIG_LIBCACA 0
-%define CONFIG_LIBCDIO 0
%define CONFIG_LIBCELT 0
%define CONFIG_LIBDC1394 0
-%define CONFIG_LIBEBUR128 0
-%define CONFIG_LIBFDK_AAC 0
+%define CONFIG_LIBDRM 0
%define CONFIG_LIBFLITE 0
%define CONFIG_LIBFONTCONFIG 0
%define CONFIG_LIBFREETYPE 0
@@ -432,18 +453,15 @@
%define CONFIG_LIBKVAZAAR 0
%define CONFIG_LIBMODPLUG 0
%define CONFIG_LIBMP3LAME 0
-%define CONFIG_LIBNUT 0
-%define CONFIG_LIBOPENCORE_AMRNB 0
-%define CONFIG_LIBOPENCORE_AMRWB 0
+%define CONFIG_LIBMYSOFA 0
%define CONFIG_LIBOPENCV 0
%define CONFIG_LIBOPENH264 0
%define CONFIG_LIBOPENJPEG 0
%define CONFIG_LIBOPENMPT 0
%define CONFIG_LIBOPUS 0
%define CONFIG_LIBPULSE 0
+%define CONFIG_LIBRSVG 0
%define CONFIG_LIBRTMP 0
-%define CONFIG_LIBRUBBERBAND 0
-%define CONFIG_LIBSCHROEDINGER 0
%define CONFIG_LIBSHINE 0
%define CONFIG_LIBSMBCLIENT 0
%define CONFIG_LIBSNAPPY 0
@@ -454,53 +472,37 @@
%define CONFIG_LIBTHEORA 0
%define CONFIG_LIBTWOLAME 0
%define CONFIG_LIBV4L2 0
-%define CONFIG_LIBVIDSTAB 0
-%define CONFIG_LIBVO_AMRWBENC 0
+%define CONFIG_LIBVMAF 0
%define CONFIG_LIBVORBIS 0
%define CONFIG_LIBVPX 0
%define CONFIG_LIBWAVPACK 0
%define CONFIG_LIBWEBP 0
-%define CONFIG_LIBX264 0
-%define CONFIG_LIBX265 0
-%define CONFIG_LIBXAVS 0
-%define CONFIG_LIBXCB 0
-%define CONFIG_LIBXCB_SHM 0
-%define CONFIG_LIBXCB_SHAPE 0
-%define CONFIG_LIBXCB_XFIXES 0
-%define CONFIG_LIBXVID 0
+%define CONFIG_LIBXML2 0
%define CONFIG_LIBZIMG 0
%define CONFIG_LIBZMQ 0
%define CONFIG_LIBZVBI 0
-%define CONFIG_LZMA 0
%define CONFIG_MEDIACODEC 0
-%define CONFIG_NETCDF 0
%define CONFIG_OPENAL 0
%define CONFIG_OPENCL 0
%define CONFIG_OPENGL 0
-%define CONFIG_OPENSSL 0
-%define CONFIG_SCHANNEL 1
-%define CONFIG_SDL 0
-%define CONFIG_SDL2 0
-%define CONFIG_SECURETRANSPORT 0
-%define CONFIG_VIDEOTOOLBOX 0
-%define CONFIG_X11GRAB 0
-%define CONFIG_XLIB 0
-%define CONFIG_ZLIB 0
%define CONFIG_AUDIOTOOLBOX 0
-%define CONFIG_CUDA 0
-%define CONFIG_CUVID 0
+%define CONFIG_CRYSTALHD 0
+%define CONFIG_CUDA 1
+%define CONFIG_CUVID 1
%define CONFIG_D3D11VA 0
%define CONFIG_DXVA2 0
-%define CONFIG_LIBMFX 0
-%define CONFIG_LIBNPP 0
-%define CONFIG_MMAL 0
-%define CONFIG_NVENC 0
-%define CONFIG_OMX 0
+%define CONFIG_NVENC 1
%define CONFIG_VAAPI 0
%define CONFIG_VDA 0
%define CONFIG_VDPAU 0
-%define CONFIG_VIDEOTOOLBOX_HWACCEL 0
+%define CONFIG_VIDEOTOOLBOX 0
+%define CONFIG_V4L2_M2M 0
%define CONFIG_XVMC 0
+%define CONFIG_CUDA_SDK 0
+%define CONFIG_LIBNPP 0
+%define CONFIG_LIBMFX 0
+%define CONFIG_MMAL 0
+%define CONFIG_OMX 0
%define CONFIG_FTRAPV 0
%define CONFIG_GRAY 0
%define CONFIG_HARDCODED_TABLES 0
@@ -539,16 +541,27 @@
%define CONFIG_PIXELUTILS 0
%define CONFIG_NETWORK 0
%define CONFIG_RDFT 0
+%define CONFIG_AUTODETECT 0
%define CONFIG_FONTCONFIG 0
-%define CONFIG_MEMALIGN_HACK 0
+%define CONFIG_LINUX_PERF 0
%define CONFIG_MEMORY_POISONING 0
%define CONFIG_NEON_CLOBBER_TEST 0
+%define CONFIG_OSSFUZZ 0
%define CONFIG_PIC 0
-%define CONFIG_POD2MAN 1
-%define CONFIG_RAISE_MAJOR 0
%define CONFIG_THUMB 0
%define CONFIG_VALGRIND_BACKTRACE 0
%define CONFIG_XMM_CLOBBER_TEST 0
+%define CONFIG_BSFS 1
+%define CONFIG_DECODERS 1
+%define CONFIG_ENCODERS 0
+%define CONFIG_HWACCELS 0
+%define CONFIG_PARSERS 1
+%define CONFIG_INDEVS 0
+%define CONFIG_OUTDEVS 0
+%define CONFIG_FILTERS 0
+%define CONFIG_DEMUXERS 0
+%define CONFIG_MUXERS 0
+%define CONFIG_PROTOCOLS 0
%define CONFIG_AANDCTTABLES 0
%define CONFIG_AC3DSP 0
%define CONFIG_AUDIO_FRAME_QUEUE 0
@@ -566,20 +579,22 @@
%define CONFIG_FMTCONVERT 0
%define CONFIG_FRAME_THREAD_ENCODER 0
%define CONFIG_G722DSP 0
-%define CONFIG_GOLOMB 1
+%define CONFIG_GOLOMB 0
%define CONFIG_GPLV3 0
%define CONFIG_H263DSP 0
%define CONFIG_H264CHROMA 0
%define CONFIG_H264DSP 0
+%define CONFIG_H264PARSE 0
%define CONFIG_H264PRED 1
%define CONFIG_H264QPEL 0
+%define CONFIG_HEVCPARSE 0
%define CONFIG_HPELDSP 0
%define CONFIG_HUFFMAN 0
%define CONFIG_HUFFYUVDSP 0
%define CONFIG_HUFFYUVENCDSP 0
%define CONFIG_IDCTDSP 0
%define CONFIG_IIRFILTER 0
-%define CONFIG_IMDCT15 0
+%define CONFIG_MDCT15 0
%define CONFIG_INTRAX8 0
%define CONFIG_ISO_MEDIA 0
%define CONFIG_IVIDSP 0
@@ -588,12 +603,14 @@
%define CONFIG_LIBX262 0
%define CONFIG_LLAUDDSP 0
%define CONFIG_LLVIDDSP 0
+%define CONFIG_LLVIDENCDSP 0
%define CONFIG_LPC 0
%define CONFIG_LZF 0
%define CONFIG_ME_CMP 0
%define CONFIG_MPEG_ER 0
%define CONFIG_MPEGAUDIO 0
%define CONFIG_MPEGAUDIODSP 0
+%define CONFIG_MPEGAUDIOHEADER 0
%define CONFIG_MPEGVIDEO 0
%define CONFIG_MPEGVIDEOENC 0
%define CONFIG_MSS34DSP 0
@@ -615,1594 +632,19 @@
%define CONFIG_TEXTUREDSP 0
%define CONFIG_TEXTUREDSPENC 0
%define CONFIG_TPELDSP 0
+%define CONFIG_VAAPI_1 0
%define CONFIG_VAAPI_ENCODE 0
%define CONFIG_VC1DSP 0
%define CONFIG_VIDEODSP 1
%define CONFIG_VP3DSP 0
%define CONFIG_VP56DSP 0
%define CONFIG_VP8DSP 1
-%define CONFIG_VT_BT2020 0
%define CONFIG_WMA_FREQS 0
%define CONFIG_WMV2DSP 0
-%define CONFIG_AAC_ADTSTOASC_BSF 0
-%define CONFIG_CHOMP_BSF 0
-%define CONFIG_DUMP_EXTRADATA_BSF 0
-%define CONFIG_DCA_CORE_BSF 0
-%define CONFIG_H264_MP4TOANNEXB_BSF 0
-%define CONFIG_HEVC_MP4TOANNEXB_BSF 0
-%define CONFIG_IMX_DUMP_HEADER_BSF 0
-%define CONFIG_MJPEG2JPEG_BSF 0
-%define CONFIG_MJPEGA_DUMP_HEADER_BSF 0
-%define CONFIG_MP3_HEADER_DECOMPRESS_BSF 0
-%define CONFIG_MPEG4_UNPACK_BFRAMES_BSF 0
-%define CONFIG_MOV2TEXTSUB_BSF 0
-%define CONFIG_NOISE_BSF 0
-%define CONFIG_REMOVE_EXTRADATA_BSF 0
-%define CONFIG_TEXT2MOVSUB_BSF 0
-%define CONFIG_VP9_SUPERFRAME_BSF 0
-%define CONFIG_AASC_DECODER 0
-%define CONFIG_AIC_DECODER 0
-%define CONFIG_ALIAS_PIX_DECODER 0
-%define CONFIG_AMV_DECODER 0
-%define CONFIG_ANM_DECODER 0
-%define CONFIG_ANSI_DECODER 0
-%define CONFIG_APNG_DECODER 0
-%define CONFIG_ASV1_DECODER 0
-%define CONFIG_ASV2_DECODER 0
-%define CONFIG_AURA_DECODER 0
-%define CONFIG_AURA2_DECODER 0
-%define CONFIG_AVRP_DECODER 0
-%define CONFIG_AVRN_DECODER 0
-%define CONFIG_AVS_DECODER 0
-%define CONFIG_AVUI_DECODER 0
-%define CONFIG_AYUV_DECODER 0
-%define CONFIG_BETHSOFTVID_DECODER 0
-%define CONFIG_BFI_DECODER 0
-%define CONFIG_BINK_DECODER 0
-%define CONFIG_BMP_DECODER 0
-%define CONFIG_BMV_VIDEO_DECODER 0
-%define CONFIG_BRENDER_PIX_DECODER 0
-%define CONFIG_C93_DECODER 0
-%define CONFIG_CAVS_DECODER 0
-%define CONFIG_CDGRAPHICS_DECODER 0
-%define CONFIG_CDXL_DECODER 0
-%define CONFIG_CFHD_DECODER 0
-%define CONFIG_CINEPAK_DECODER 0
-%define CONFIG_CLJR_DECODER 0
-%define CONFIG_CLLC_DECODER 0
-%define CONFIG_COMFORTNOISE_DECODER 0
-%define CONFIG_CPIA_DECODER 0
-%define CONFIG_CSCD_DECODER 0
-%define CONFIG_CYUV_DECODER 0
-%define CONFIG_DDS_DECODER 0
-%define CONFIG_DFA_DECODER 0
-%define CONFIG_DIRAC_DECODER 0
-%define CONFIG_DNXHD_DECODER 0
-%define CONFIG_DPX_DECODER 0
-%define CONFIG_DSICINVIDEO_DECODER 0
-%define CONFIG_DVAUDIO_DECODER 0
-%define CONFIG_DVVIDEO_DECODER 0
-%define CONFIG_DXA_DECODER 0
-%define CONFIG_DXTORY_DECODER 0
-%define CONFIG_DXV_DECODER 0
-%define CONFIG_EACMV_DECODER 0
-%define CONFIG_EAMAD_DECODER 0
-%define CONFIG_EATGQ_DECODER 0
-%define CONFIG_EATGV_DECODER 0
-%define CONFIG_EATQI_DECODER 0
-%define CONFIG_EIGHTBPS_DECODER 0
-%define CONFIG_EIGHTSVX_EXP_DECODER 0
-%define CONFIG_EIGHTSVX_FIB_DECODER 0
-%define CONFIG_ESCAPE124_DECODER 0
-%define CONFIG_ESCAPE130_DECODER 0
-%define CONFIG_EXR_DECODER 0
-%define CONFIG_FFV1_DECODER 0
-%define CONFIG_FFVHUFF_DECODER 0
-%define CONFIG_FIC_DECODER 0
-%define CONFIG_FLASHSV_DECODER 0
-%define CONFIG_FLASHSV2_DECODER 0
-%define CONFIG_FLIC_DECODER 0
-%define CONFIG_FLV_DECODER 0
-%define CONFIG_FOURXM_DECODER 0
-%define CONFIG_FRAPS_DECODER 0
-%define CONFIG_FRWU_DECODER 0
-%define CONFIG_G2M_DECODER 0
-%define CONFIG_GIF_DECODER 0
-%define CONFIG_H261_DECODER 0
-%define CONFIG_H263_DECODER 0
-%define CONFIG_H263I_DECODER 0
-%define CONFIG_H263P_DECODER 0
-%define CONFIG_H264_DECODER 0
-%define CONFIG_H264_CRYSTALHD_DECODER 0
-%define CONFIG_H264_MEDIACODEC_DECODER 0
-%define CONFIG_H264_MMAL_DECODER 0
-%define CONFIG_H264_QSV_DECODER 0
-%define CONFIG_H264_VDA_DECODER 0
-%define CONFIG_H264_VDPAU_DECODER 0
-%define CONFIG_HAP_DECODER 0
-%define CONFIG_HEVC_DECODER 0
-%define CONFIG_HEVC_QSV_DECODER 0
-%define CONFIG_HNM4_VIDEO_DECODER 0
-%define CONFIG_HQ_HQA_DECODER 0
-%define CONFIG_HQX_DECODER 0
-%define CONFIG_HUFFYUV_DECODER 0
-%define CONFIG_IDCIN_DECODER 0
-%define CONFIG_IFF_ILBM_DECODER 0
-%define CONFIG_INDEO2_DECODER 0
-%define CONFIG_INDEO3_DECODER 0
-%define CONFIG_INDEO4_DECODER 0
-%define CONFIG_INDEO5_DECODER 0
-%define CONFIG_INTERPLAY_VIDEO_DECODER 0
-%define CONFIG_JPEG2000_DECODER 0
-%define CONFIG_JPEGLS_DECODER 0
-%define CONFIG_JV_DECODER 0
-%define CONFIG_KGV1_DECODER 0
-%define CONFIG_KMVC_DECODER 0
-%define CONFIG_LAGARITH_DECODER 0
-%define CONFIG_LOCO_DECODER 0
-%define CONFIG_M101_DECODER 0
-%define CONFIG_MAGICYUV_DECODER 0
-%define CONFIG_MDEC_DECODER 0
-%define CONFIG_MIMIC_DECODER 0
-%define CONFIG_MJPEG_DECODER 0
-%define CONFIG_MJPEGB_DECODER 0
-%define CONFIG_MMVIDEO_DECODER 0
-%define CONFIG_MOTIONPIXELS_DECODER 0
-%define CONFIG_MPEG_XVMC_DECODER 0
-%define CONFIG_MPEG1VIDEO_DECODER 0
-%define CONFIG_MPEG2VIDEO_DECODER 0
-%define CONFIG_MPEG4_DECODER 0
-%define CONFIG_MPEG4_CRYSTALHD_DECODER 0
-%define CONFIG_MPEG4_MMAL_DECODER 0
-%define CONFIG_MPEG4_VDPAU_DECODER 0
-%define CONFIG_MPEGVIDEO_DECODER 0
-%define CONFIG_MPEG_VDPAU_DECODER 0
-%define CONFIG_MPEG1_VDPAU_DECODER 0
-%define CONFIG_MPEG2_MMAL_DECODER 0
-%define CONFIG_MPEG2_CRYSTALHD_DECODER 0
-%define CONFIG_MPEG2_QSV_DECODER 0
-%define CONFIG_MSA1_DECODER 0
-%define CONFIG_MSMPEG4_CRYSTALHD_DECODER 0
-%define CONFIG_MSMPEG4V1_DECODER 0
-%define CONFIG_MSMPEG4V2_DECODER 0
-%define CONFIG_MSMPEG4V3_DECODER 0
-%define CONFIG_MSRLE_DECODER 0
-%define CONFIG_MSS1_DECODER 0
-%define CONFIG_MSS2_DECODER 0
-%define CONFIG_MSVIDEO1_DECODER 0
-%define CONFIG_MSZH_DECODER 0
-%define CONFIG_MTS2_DECODER 0
-%define CONFIG_MVC1_DECODER 0
-%define CONFIG_MVC2_DECODER 0
-%define CONFIG_MXPEG_DECODER 0
-%define CONFIG_NUV_DECODER 0
-%define CONFIG_PAF_VIDEO_DECODER 0
-%define CONFIG_PAM_DECODER 0
-%define CONFIG_PBM_DECODER 0
-%define CONFIG_PCX_DECODER 0
-%define CONFIG_PGM_DECODER 0
-%define CONFIG_PGMYUV_DECODER 0
-%define CONFIG_PICTOR_DECODER 0
-%define CONFIG_PNG_DECODER 0
-%define CONFIG_PPM_DECODER 0
-%define CONFIG_PRORES_DECODER 0
-%define CONFIG_PRORES_LGPL_DECODER 0
-%define CONFIG_PTX_DECODER 0
-%define CONFIG_QDRAW_DECODER 0
-%define CONFIG_QPEG_DECODER 0
-%define CONFIG_QTRLE_DECODER 0
-%define CONFIG_R10K_DECODER 0
-%define CONFIG_R210_DECODER 0
-%define CONFIG_RAWVIDEO_DECODER 0
-%define CONFIG_RL2_DECODER 0
-%define CONFIG_ROQ_DECODER 0
-%define CONFIG_RPZA_DECODER 0
-%define CONFIG_RSCC_DECODER 0
-%define CONFIG_RV10_DECODER 0
-%define CONFIG_RV20_DECODER 0
-%define CONFIG_RV30_DECODER 0
-%define CONFIG_RV40_DECODER 0
-%define CONFIG_S302M_DECODER 0
-%define CONFIG_SANM_DECODER 0
-%define CONFIG_SCREENPRESSO_DECODER 0
-%define CONFIG_SDX2_DPCM_DECODER 0
-%define CONFIG_SGI_DECODER 0
-%define CONFIG_SGIRLE_DECODER 0
-%define CONFIG_SHEERVIDEO_DECODER 0
-%define CONFIG_SMACKER_DECODER 0
-%define CONFIG_SMC_DECODER 0
-%define CONFIG_SMVJPEG_DECODER 0
-%define CONFIG_SNOW_DECODER 0
-%define CONFIG_SP5X_DECODER 0
-%define CONFIG_SUNRAST_DECODER 0
-%define CONFIG_SVQ1_DECODER 0
-%define CONFIG_SVQ3_DECODER 0
-%define CONFIG_TARGA_DECODER 0
-%define CONFIG_TARGA_Y216_DECODER 0
-%define CONFIG_TDSC_DECODER 0
-%define CONFIG_THEORA_DECODER 0
-%define CONFIG_THP_DECODER 0
-%define CONFIG_TIERTEXSEQVIDEO_DECODER 0
-%define CONFIG_TIFF_DECODER 0
-%define CONFIG_TMV_DECODER 0
-%define CONFIG_TRUEMOTION1_DECODER 0
-%define CONFIG_TRUEMOTION2_DECODER 0
-%define CONFIG_TRUEMOTION2RT_DECODER 0
-%define CONFIG_TSCC_DECODER 0
-%define CONFIG_TSCC2_DECODER 0
-%define CONFIG_TXD_DECODER 0
-%define CONFIG_ULTI_DECODER 0
-%define CONFIG_UTVIDEO_DECODER 0
-%define CONFIG_V210_DECODER 0
-%define CONFIG_V210X_DECODER 0
-%define CONFIG_V308_DECODER 0
-%define CONFIG_V408_DECODER 0
-%define CONFIG_V410_DECODER 0
-%define CONFIG_VB_DECODER 0
-%define CONFIG_VBLE_DECODER 0
-%define CONFIG_VC1_DECODER 0
-%define CONFIG_VC1_CRYSTALHD_DECODER 0
-%define CONFIG_VC1_VDPAU_DECODER 0
-%define CONFIG_VC1IMAGE_DECODER 0
-%define CONFIG_VC1_MMAL_DECODER 0
-%define CONFIG_VC1_QSV_DECODER 0
-%define CONFIG_VCR1_DECODER 0
-%define CONFIG_VMDVIDEO_DECODER 0
-%define CONFIG_VMNC_DECODER 0
-%define CONFIG_VP3_DECODER 0
-%define CONFIG_VP5_DECODER 0
-%define CONFIG_VP6_DECODER 0
-%define CONFIG_VP6A_DECODER 0
-%define CONFIG_VP6F_DECODER 0
-%define CONFIG_VP7_DECODER 0
+%define CONFIG_NULL_BSF 1
%define CONFIG_VP8_DECODER 1
%define CONFIG_VP9_DECODER 1
-%define CONFIG_VQA_DECODER 0
-%define CONFIG_WEBP_DECODER 0
-%define CONFIG_WMV1_DECODER 0
-%define CONFIG_WMV2_DECODER 0
-%define CONFIG_WMV3_DECODER 0
-%define CONFIG_WMV3_CRYSTALHD_DECODER 0
-%define CONFIG_WMV3_VDPAU_DECODER 0
-%define CONFIG_WMV3IMAGE_DECODER 0
-%define CONFIG_WNV1_DECODER 0
-%define CONFIG_XAN_WC3_DECODER 0
-%define CONFIG_XAN_WC4_DECODER 0
-%define CONFIG_XBM_DECODER 0
-%define CONFIG_XFACE_DECODER 0
-%define CONFIG_XL_DECODER 0
-%define CONFIG_XWD_DECODER 0
-%define CONFIG_Y41P_DECODER 0
-%define CONFIG_YLC_DECODER 0
-%define CONFIG_YOP_DECODER 0
-%define CONFIG_YUV4_DECODER 0
-%define CONFIG_ZERO12V_DECODER 0
-%define CONFIG_ZEROCODEC_DECODER 0
-%define CONFIG_ZLIB_DECODER 0
-%define CONFIG_ZMBV_DECODER 0
-%define CONFIG_AAC_DECODER 0
-%define CONFIG_AAC_FIXED_DECODER 0
-%define CONFIG_AAC_LATM_DECODER 0
-%define CONFIG_AC3_DECODER 0
-%define CONFIG_AC3_FIXED_DECODER 0
-%define CONFIG_ALAC_DECODER 0
-%define CONFIG_ALS_DECODER 0
-%define CONFIG_AMRNB_DECODER 0
-%define CONFIG_AMRWB_DECODER 0
-%define CONFIG_APE_DECODER 0
-%define CONFIG_ATRAC1_DECODER 0
-%define CONFIG_ATRAC3_DECODER 0
-%define CONFIG_ATRAC3P_DECODER 0
-%define CONFIG_BINKAUDIO_DCT_DECODER 0
-%define CONFIG_BINKAUDIO_RDFT_DECODER 0
-%define CONFIG_BMV_AUDIO_DECODER 0
-%define CONFIG_COOK_DECODER 0
-%define CONFIG_DCA_DECODER 0
-%define CONFIG_DSD_LSBF_DECODER 0
-%define CONFIG_DSD_MSBF_DECODER 0
-%define CONFIG_DSD_LSBF_PLANAR_DECODER 0
-%define CONFIG_DSD_MSBF_PLANAR_DECODER 0
-%define CONFIG_DSICINAUDIO_DECODER 0
-%define CONFIG_DSS_SP_DECODER 0
-%define CONFIG_DST_DECODER 0
-%define CONFIG_EAC3_DECODER 0
-%define CONFIG_EVRC_DECODER 0
-%define CONFIG_FFWAVESYNTH_DECODER 0
%define CONFIG_FLAC_DECODER 1
-%define CONFIG_G723_1_DECODER 0
-%define CONFIG_G729_DECODER 0
-%define CONFIG_GSM_DECODER 0
-%define CONFIG_GSM_MS_DECODER 0
-%define CONFIG_IAC_DECODER 0
-%define CONFIG_IMC_DECODER 0
-%define CONFIG_INTERPLAY_ACM_DECODER 0
-%define CONFIG_MACE3_DECODER 0
-%define CONFIG_MACE6_DECODER 0
-%define CONFIG_METASOUND_DECODER 0
-%define CONFIG_MLP_DECODER 0
-%define CONFIG_MP1_DECODER 0
-%define CONFIG_MP1FLOAT_DECODER 0
-%define CONFIG_MP2_DECODER 0
-%define CONFIG_MP2FLOAT_DECODER 0
-%define CONFIG_MP3_DECODER 0
-%define CONFIG_MP3FLOAT_DECODER 0
-%define CONFIG_MP3ADU_DECODER 0
-%define CONFIG_MP3ADUFLOAT_DECODER 0
-%define CONFIG_MP3ON4_DECODER 0
-%define CONFIG_MP3ON4FLOAT_DECODER 0
-%define CONFIG_MPC7_DECODER 0
-%define CONFIG_MPC8_DECODER 0
-%define CONFIG_NELLYMOSER_DECODER 0
-%define CONFIG_ON2AVC_DECODER 0
-%define CONFIG_OPUS_DECODER 0
-%define CONFIG_PAF_AUDIO_DECODER 0
-%define CONFIG_QCELP_DECODER 0
-%define CONFIG_QDM2_DECODER 0
-%define CONFIG_RA_144_DECODER 0
-%define CONFIG_RA_288_DECODER 0
-%define CONFIG_RALF_DECODER 0
-%define CONFIG_SHORTEN_DECODER 0
-%define CONFIG_SIPR_DECODER 0
-%define CONFIG_SMACKAUD_DECODER 0
-%define CONFIG_SONIC_DECODER 0
-%define CONFIG_TAK_DECODER 0
-%define CONFIG_TRUEHD_DECODER 0
-%define CONFIG_TRUESPEECH_DECODER 0
-%define CONFIG_TTA_DECODER 0
-%define CONFIG_TWINVQ_DECODER 0
-%define CONFIG_VMDAUDIO_DECODER 0
-%define CONFIG_VORBIS_DECODER 0
-%define CONFIG_WAVPACK_DECODER 0
-%define CONFIG_WMALOSSLESS_DECODER 0
-%define CONFIG_WMAPRO_DECODER 0
-%define CONFIG_WMAV1_DECODER 0
-%define CONFIG_WMAV2_DECODER 0
-%define CONFIG_WMAVOICE_DECODER 0
-%define CONFIG_WS_SND1_DECODER 0
-%define CONFIG_XMA1_DECODER 0
-%define CONFIG_XMA2_DECODER 0
-%define CONFIG_PCM_ALAW_DECODER 0
-%define CONFIG_PCM_BLURAY_DECODER 0
-%define CONFIG_PCM_DVD_DECODER 0
-%define CONFIG_PCM_F32BE_DECODER 0
-%define CONFIG_PCM_F32LE_DECODER 0
-%define CONFIG_PCM_F64BE_DECODER 0
-%define CONFIG_PCM_F64LE_DECODER 0
-%define CONFIG_PCM_LXF_DECODER 0
-%define CONFIG_PCM_MULAW_DECODER 0
-%define CONFIG_PCM_S8_DECODER 0
-%define CONFIG_PCM_S8_PLANAR_DECODER 0
-%define CONFIG_PCM_S16BE_DECODER 0
-%define CONFIG_PCM_S16BE_PLANAR_DECODER 0
-%define CONFIG_PCM_S16LE_DECODER 0
-%define CONFIG_PCM_S16LE_PLANAR_DECODER 0
-%define CONFIG_PCM_S24BE_DECODER 0
-%define CONFIG_PCM_S24DAUD_DECODER 0
-%define CONFIG_PCM_S24LE_DECODER 0
-%define CONFIG_PCM_S24LE_PLANAR_DECODER 0
-%define CONFIG_PCM_S32BE_DECODER 0
-%define CONFIG_PCM_S32LE_DECODER 0
-%define CONFIG_PCM_S32LE_PLANAR_DECODER 0
-%define CONFIG_PCM_S64BE_DECODER 0
-%define CONFIG_PCM_S64LE_DECODER 0
-%define CONFIG_PCM_U8_DECODER 0
-%define CONFIG_PCM_U16BE_DECODER 0
-%define CONFIG_PCM_U16LE_DECODER 0
-%define CONFIG_PCM_U24BE_DECODER 0
-%define CONFIG_PCM_U24LE_DECODER 0
-%define CONFIG_PCM_U32BE_DECODER 0
-%define CONFIG_PCM_U32LE_DECODER 0
-%define CONFIG_PCM_ZORK_DECODER 0
-%define CONFIG_INTERPLAY_DPCM_DECODER 0
-%define CONFIG_ROQ_DPCM_DECODER 0
-%define CONFIG_SOL_DPCM_DECODER 0
-%define CONFIG_XAN_DPCM_DECODER 0
-%define CONFIG_ADPCM_4XM_DECODER 0
-%define CONFIG_ADPCM_ADX_DECODER 0
-%define CONFIG_ADPCM_AFC_DECODER 0
-%define CONFIG_ADPCM_AICA_DECODER 0
-%define CONFIG_ADPCM_CT_DECODER 0
-%define CONFIG_ADPCM_DTK_DECODER 0
-%define CONFIG_ADPCM_EA_DECODER 0
-%define CONFIG_ADPCM_EA_MAXIS_XA_DECODER 0
-%define CONFIG_ADPCM_EA_R1_DECODER 0
-%define CONFIG_ADPCM_EA_R2_DECODER 0
-%define CONFIG_ADPCM_EA_R3_DECODER 0
-%define CONFIG_ADPCM_EA_XAS_DECODER 0
-%define CONFIG_ADPCM_G722_DECODER 0
-%define CONFIG_ADPCM_G726_DECODER 0
-%define CONFIG_ADPCM_G726LE_DECODER 0
-%define CONFIG_ADPCM_IMA_AMV_DECODER 0
-%define CONFIG_ADPCM_IMA_APC_DECODER 0
-%define CONFIG_ADPCM_IMA_DAT4_DECODER 0
-%define CONFIG_ADPCM_IMA_DK3_DECODER 0
-%define CONFIG_ADPCM_IMA_DK4_DECODER 0
-%define CONFIG_ADPCM_IMA_EA_EACS_DECODER 0
-%define CONFIG_ADPCM_IMA_EA_SEAD_DECODER 0
-%define CONFIG_ADPCM_IMA_ISS_DECODER 0
-%define CONFIG_ADPCM_IMA_OKI_DECODER 0
-%define CONFIG_ADPCM_IMA_QT_DECODER 0
-%define CONFIG_ADPCM_IMA_RAD_DECODER 0
-%define CONFIG_ADPCM_IMA_SMJPEG_DECODER 0
-%define CONFIG_ADPCM_IMA_WAV_DECODER 0
-%define CONFIG_ADPCM_IMA_WS_DECODER 0
-%define CONFIG_ADPCM_MS_DECODER 0
-%define CONFIG_ADPCM_MTAF_DECODER 0
-%define CONFIG_ADPCM_PSX_DECODER 0
-%define CONFIG_ADPCM_SBPRO_2_DECODER 0
-%define CONFIG_ADPCM_SBPRO_3_DECODER 0
-%define CONFIG_ADPCM_SBPRO_4_DECODER 0
-%define CONFIG_ADPCM_SWF_DECODER 0
-%define CONFIG_ADPCM_THP_DECODER 0
-%define CONFIG_ADPCM_THP_LE_DECODER 0
-%define CONFIG_ADPCM_VIMA_DECODER 0
-%define CONFIG_ADPCM_XA_DECODER 0
-%define CONFIG_ADPCM_YAMAHA_DECODER 0
-%define CONFIG_SSA_DECODER 0
-%define CONFIG_ASS_DECODER 0
-%define CONFIG_CCAPTION_DECODER 0
-%define CONFIG_DVBSUB_DECODER 0
-%define CONFIG_DVDSUB_DECODER 0
-%define CONFIG_JACOSUB_DECODER 0
-%define CONFIG_MICRODVD_DECODER 0
-%define CONFIG_MOVTEXT_DECODER 0
-%define CONFIG_MPL2_DECODER 0
-%define CONFIG_PGSSUB_DECODER 0
-%define CONFIG_PJS_DECODER 0
-%define CONFIG_REALTEXT_DECODER 0
-%define CONFIG_SAMI_DECODER 0
-%define CONFIG_SRT_DECODER 0
-%define CONFIG_STL_DECODER 0
-%define CONFIG_SUBRIP_DECODER 0
-%define CONFIG_SUBVIEWER_DECODER 0
-%define CONFIG_SUBVIEWER1_DECODER 0
-%define CONFIG_TEXT_DECODER 0
-%define CONFIG_VPLAYER_DECODER 0
-%define CONFIG_WEBVTT_DECODER 0
-%define CONFIG_XSUB_DECODER 0
-%define CONFIG_AAC_AT_DECODER 0
-%define CONFIG_AC3_AT_DECODER 0
-%define CONFIG_ADPCM_IMA_QT_AT_DECODER 0
-%define CONFIG_ALAC_AT_DECODER 0
-%define CONFIG_AMR_NB_AT_DECODER 0
-%define CONFIG_EAC3_AT_DECODER 0
-%define CONFIG_GSM_MS_AT_DECODER 0
-%define CONFIG_ILBC_AT_DECODER 0
-%define CONFIG_MP1_AT_DECODER 0
-%define CONFIG_MP2_AT_DECODER 0
-%define CONFIG_MP3_AT_DECODER 0
-%define CONFIG_PCM_ALAW_AT_DECODER 0
-%define CONFIG_PCM_MULAW_AT_DECODER 0
-%define CONFIG_QDMC_AT_DECODER 0
-%define CONFIG_QDM2_AT_DECODER 0
-%define CONFIG_LIBCELT_DECODER 0
-%define CONFIG_LIBFDK_AAC_DECODER 0
-%define CONFIG_LIBGSM_DECODER 0
-%define CONFIG_LIBGSM_MS_DECODER 0
-%define CONFIG_LIBILBC_DECODER 0
-%define CONFIG_LIBOPENCORE_AMRNB_DECODER 0
-%define CONFIG_LIBOPENCORE_AMRWB_DECODER 0
-%define CONFIG_LIBOPENJPEG_DECODER 0
-%define CONFIG_LIBOPUS_DECODER 0
-%define CONFIG_LIBSCHROEDINGER_DECODER 0
-%define CONFIG_LIBSPEEX_DECODER 0
-%define CONFIG_LIBVORBIS_DECODER 0
-%define CONFIG_LIBVPX_VP8_DECODER 0
-%define CONFIG_LIBVPX_VP9_DECODER 0
-%define CONFIG_LIBZVBI_TELETEXT_DECODER 0
-%define CONFIG_BINTEXT_DECODER 0
-%define CONFIG_XBIN_DECODER 0
-%define CONFIG_IDF_DECODER 0
-%define CONFIG_LIBOPENH264_DECODER 0
-%define CONFIG_H263_CUVID_DECODER 0
-%define CONFIG_H264_CUVID_DECODER 0
-%define CONFIG_HEVC_CUVID_DECODER 0
-%define CONFIG_HEVC_MEDIACODEC_DECODER 0
-%define CONFIG_MJPEG_CUVID_DECODER 0
-%define CONFIG_MPEG1_CUVID_DECODER 0
-%define CONFIG_MPEG2_CUVID_DECODER 0
-%define CONFIG_MPEG4_CUVID_DECODER 0
-%define CONFIG_MPEG4_MEDIACODEC_DECODER 0
-%define CONFIG_VC1_CUVID_DECODER 0
-%define CONFIG_VP8_CUVID_DECODER 0
-%define CONFIG_VP8_MEDIACODEC_DECODER 0
-%define CONFIG_VP9_CUVID_DECODER 0
-%define CONFIG_VP9_MEDIACODEC_DECODER 0
-%define CONFIG_AA_DEMUXER 0
-%define CONFIG_AAC_DEMUXER 0
-%define CONFIG_AC3_DEMUXER 0
-%define CONFIG_ACM_DEMUXER 0
-%define CONFIG_ACT_DEMUXER 0
-%define CONFIG_ADF_DEMUXER 0
-%define CONFIG_ADP_DEMUXER 0
-%define CONFIG_ADS_DEMUXER 0
-%define CONFIG_ADX_DEMUXER 0
-%define CONFIG_AEA_DEMUXER 0
-%define CONFIG_AFC_DEMUXER 0
-%define CONFIG_AIFF_DEMUXER 0
-%define CONFIG_AIX_DEMUXER 0
-%define CONFIG_AMR_DEMUXER 0
-%define CONFIG_ANM_DEMUXER 0
-%define CONFIG_APC_DEMUXER 0
-%define CONFIG_APE_DEMUXER 0
-%define CONFIG_APNG_DEMUXER 0
-%define CONFIG_AQTITLE_DEMUXER 0
-%define CONFIG_ASF_DEMUXER 0
-%define CONFIG_ASF_O_DEMUXER 0
-%define CONFIG_ASS_DEMUXER 0
-%define CONFIG_AST_DEMUXER 0
-%define CONFIG_AU_DEMUXER 0
-%define CONFIG_AVI_DEMUXER 0
-%define CONFIG_AVISYNTH_DEMUXER 0
-%define CONFIG_AVR_DEMUXER 0
-%define CONFIG_AVS_DEMUXER 0
-%define CONFIG_BETHSOFTVID_DEMUXER 0
-%define CONFIG_BFI_DEMUXER 0
-%define CONFIG_BINTEXT_DEMUXER 0
-%define CONFIG_BINK_DEMUXER 0
-%define CONFIG_BIT_DEMUXER 0
-%define CONFIG_BMV_DEMUXER 0
-%define CONFIG_BFSTM_DEMUXER 0
-%define CONFIG_BRSTM_DEMUXER 0
-%define CONFIG_BOA_DEMUXER 0
-%define CONFIG_C93_DEMUXER 0
-%define CONFIG_CAF_DEMUXER 0
-%define CONFIG_CAVSVIDEO_DEMUXER 0
-%define CONFIG_CDG_DEMUXER 0
-%define CONFIG_CDXL_DEMUXER 0
-%define CONFIG_CINE_DEMUXER 0
-%define CONFIG_CONCAT_DEMUXER 0
-%define CONFIG_DATA_DEMUXER 0
-%define CONFIG_DAUD_DEMUXER 0
-%define CONFIG_DCSTR_DEMUXER 0
-%define CONFIG_DFA_DEMUXER 0
-%define CONFIG_DIRAC_DEMUXER 0
-%define CONFIG_DNXHD_DEMUXER 0
-%define CONFIG_DSF_DEMUXER 0
-%define CONFIG_DSICIN_DEMUXER 0
-%define CONFIG_DSS_DEMUXER 0
-%define CONFIG_DTS_DEMUXER 0
-%define CONFIG_DTSHD_DEMUXER 0
-%define CONFIG_DV_DEMUXER 0
-%define CONFIG_DVBSUB_DEMUXER 0
-%define CONFIG_DVBTXT_DEMUXER 0
-%define CONFIG_DXA_DEMUXER 0
-%define CONFIG_EA_DEMUXER 0
-%define CONFIG_EA_CDATA_DEMUXER 0
-%define CONFIG_EAC3_DEMUXER 0
-%define CONFIG_EPAF_DEMUXER 0
-%define CONFIG_FFM_DEMUXER 0
-%define CONFIG_FFMETADATA_DEMUXER 0
-%define CONFIG_FILMSTRIP_DEMUXER 0
-%define CONFIG_FLAC_DEMUXER 0
-%define CONFIG_FLIC_DEMUXER 0
-%define CONFIG_FLV_DEMUXER 0
-%define CONFIG_LIVE_FLV_DEMUXER 0
-%define CONFIG_FOURXM_DEMUXER 0
-%define CONFIG_FRM_DEMUXER 0
-%define CONFIG_FSB_DEMUXER 0
-%define CONFIG_G722_DEMUXER 0
-%define CONFIG_G723_1_DEMUXER 0
-%define CONFIG_G729_DEMUXER 0
-%define CONFIG_GENH_DEMUXER 0
-%define CONFIG_GIF_DEMUXER 0
-%define CONFIG_GSM_DEMUXER 0
-%define CONFIG_GXF_DEMUXER 0
-%define CONFIG_H261_DEMUXER 0
-%define CONFIG_H263_DEMUXER 0
-%define CONFIG_H264_DEMUXER 0
-%define CONFIG_HEVC_DEMUXER 0
-%define CONFIG_HLS_DEMUXER 0
-%define CONFIG_HNM_DEMUXER 0
-%define CONFIG_ICO_DEMUXER 0
-%define CONFIG_IDCIN_DEMUXER 0
-%define CONFIG_IDF_DEMUXER 0
-%define CONFIG_IFF_DEMUXER 0
-%define CONFIG_ILBC_DEMUXER 0
-%define CONFIG_IMAGE2_DEMUXER 0
-%define CONFIG_IMAGE2PIPE_DEMUXER 0
-%define CONFIG_IMAGE2_ALIAS_PIX_DEMUXER 0
-%define CONFIG_IMAGE2_BRENDER_PIX_DEMUXER 0
-%define CONFIG_INGENIENT_DEMUXER 0
-%define CONFIG_IPMOVIE_DEMUXER 0
-%define CONFIG_IRCAM_DEMUXER 0
-%define CONFIG_ISS_DEMUXER 0
-%define CONFIG_IV8_DEMUXER 0
-%define CONFIG_IVF_DEMUXER 0
-%define CONFIG_IVR_DEMUXER 0
-%define CONFIG_JACOSUB_DEMUXER 0
-%define CONFIG_JV_DEMUXER 0
-%define CONFIG_LMLM4_DEMUXER 0
-%define CONFIG_LOAS_DEMUXER 0
-%define CONFIG_LRC_DEMUXER 0
-%define CONFIG_LVF_DEMUXER 0
-%define CONFIG_LXF_DEMUXER 0
-%define CONFIG_M4V_DEMUXER 0
-%define CONFIG_MATROSKA_DEMUXER 0
-%define CONFIG_MGSTS_DEMUXER 0
-%define CONFIG_MICRODVD_DEMUXER 0
-%define CONFIG_MJPEG_DEMUXER 0
-%define CONFIG_MLP_DEMUXER 0
-%define CONFIG_MLV_DEMUXER 0
-%define CONFIG_MM_DEMUXER 0
-%define CONFIG_MMF_DEMUXER 0
-%define CONFIG_MOV_DEMUXER 0
-%define CONFIG_MP3_DEMUXER 0
-%define CONFIG_MPC_DEMUXER 0
-%define CONFIG_MPC8_DEMUXER 0
-%define CONFIG_MPEGPS_DEMUXER 0
-%define CONFIG_MPEGTS_DEMUXER 0
-%define CONFIG_MPEGTSRAW_DEMUXER 0
-%define CONFIG_MPEGVIDEO_DEMUXER 0
-%define CONFIG_MPJPEG_DEMUXER 0
-%define CONFIG_MPL2_DEMUXER 0
-%define CONFIG_MPSUB_DEMUXER 0
-%define CONFIG_MSF_DEMUXER 0
-%define CONFIG_MSNWC_TCP_DEMUXER 0
-%define CONFIG_MTAF_DEMUXER 0
-%define CONFIG_MTV_DEMUXER 0
-%define CONFIG_MUSX_DEMUXER 0
-%define CONFIG_MV_DEMUXER 0
-%define CONFIG_MVI_DEMUXER 0
-%define CONFIG_MXF_DEMUXER 0
-%define CONFIG_MXG_DEMUXER 0
-%define CONFIG_NC_DEMUXER 0
-%define CONFIG_NISTSPHERE_DEMUXER 0
-%define CONFIG_NSV_DEMUXER 0
-%define CONFIG_NUT_DEMUXER 0
-%define CONFIG_NUV_DEMUXER 0
-%define CONFIG_OGG_DEMUXER 0
-%define CONFIG_OMA_DEMUXER 0
-%define CONFIG_PAF_DEMUXER 0
-%define CONFIG_PCM_ALAW_DEMUXER 0
-%define CONFIG_PCM_MULAW_DEMUXER 0
-%define CONFIG_PCM_F64BE_DEMUXER 0
-%define CONFIG_PCM_F64LE_DEMUXER 0
-%define CONFIG_PCM_F32BE_DEMUXER 0
-%define CONFIG_PCM_F32LE_DEMUXER 0
-%define CONFIG_PCM_S32BE_DEMUXER 0
-%define CONFIG_PCM_S32LE_DEMUXER 0
-%define CONFIG_PCM_S24BE_DEMUXER 0
-%define CONFIG_PCM_S24LE_DEMUXER 0
-%define CONFIG_PCM_S16BE_DEMUXER 0
-%define CONFIG_PCM_S16LE_DEMUXER 0
-%define CONFIG_PCM_S8_DEMUXER 0
-%define CONFIG_PCM_U32BE_DEMUXER 0
-%define CONFIG_PCM_U32LE_DEMUXER 0
-%define CONFIG_PCM_U24BE_DEMUXER 0
-%define CONFIG_PCM_U24LE_DEMUXER 0
-%define CONFIG_PCM_U16BE_DEMUXER 0
-%define CONFIG_PCM_U16LE_DEMUXER 0
-%define CONFIG_PCM_U8_DEMUXER 0
-%define CONFIG_PJS_DEMUXER 0
-%define CONFIG_PMP_DEMUXER 0
-%define CONFIG_PVA_DEMUXER 0
-%define CONFIG_PVF_DEMUXER 0
-%define CONFIG_QCP_DEMUXER 0
-%define CONFIG_R3D_DEMUXER 0
-%define CONFIG_RAWVIDEO_DEMUXER 0
-%define CONFIG_REALTEXT_DEMUXER 0
-%define CONFIG_REDSPARK_DEMUXER 0
-%define CONFIG_RL2_DEMUXER 0
-%define CONFIG_RM_DEMUXER 0
-%define CONFIG_ROQ_DEMUXER 0
-%define CONFIG_RPL_DEMUXER 0
-%define CONFIG_RSD_DEMUXER 0
-%define CONFIG_RSO_DEMUXER 0
-%define CONFIG_RTP_DEMUXER 0
-%define CONFIG_RTSP_DEMUXER 0
-%define CONFIG_SAMI_DEMUXER 0
-%define CONFIG_SAP_DEMUXER 0
-%define CONFIG_SBG_DEMUXER 0
-%define CONFIG_SDP_DEMUXER 0
-%define CONFIG_SDR2_DEMUXER 0
-%define CONFIG_SEGAFILM_DEMUXER 0
-%define CONFIG_SHORTEN_DEMUXER 0
-%define CONFIG_SIFF_DEMUXER 0
-%define CONFIG_SLN_DEMUXER 0
-%define CONFIG_SMACKER_DEMUXER 0
-%define CONFIG_SMJPEG_DEMUXER 0
-%define CONFIG_SMUSH_DEMUXER 0
-%define CONFIG_SOL_DEMUXER 0
-%define CONFIG_SOX_DEMUXER 0
-%define CONFIG_SPDIF_DEMUXER 0
-%define CONFIG_SRT_DEMUXER 0
-%define CONFIG_STR_DEMUXER 0
-%define CONFIG_STL_DEMUXER 0
-%define CONFIG_SUBVIEWER1_DEMUXER 0
-%define CONFIG_SUBVIEWER_DEMUXER 0
-%define CONFIG_SUP_DEMUXER 0
-%define CONFIG_SVAG_DEMUXER 0
-%define CONFIG_SWF_DEMUXER 0
-%define CONFIG_TAK_DEMUXER 0
-%define CONFIG_TEDCAPTIONS_DEMUXER 0
-%define CONFIG_THP_DEMUXER 0
-%define CONFIG_THREEDOSTR_DEMUXER 0
-%define CONFIG_TIERTEXSEQ_DEMUXER 0
-%define CONFIG_TMV_DEMUXER 0
-%define CONFIG_TRUEHD_DEMUXER 0
-%define CONFIG_TTA_DEMUXER 0
-%define CONFIG_TXD_DEMUXER 0
-%define CONFIG_TTY_DEMUXER 0
-%define CONFIG_V210_DEMUXER 0
-%define CONFIG_V210X_DEMUXER 0
-%define CONFIG_VAG_DEMUXER 0
-%define CONFIG_VC1_DEMUXER 0
-%define CONFIG_VC1T_DEMUXER 0
-%define CONFIG_VIVO_DEMUXER 0
-%define CONFIG_VMD_DEMUXER 0
-%define CONFIG_VOBSUB_DEMUXER 0
-%define CONFIG_VOC_DEMUXER 0
-%define CONFIG_VPK_DEMUXER 0
-%define CONFIG_VPLAYER_DEMUXER 0
-%define CONFIG_VQF_DEMUXER 0
-%define CONFIG_W64_DEMUXER 0
-%define CONFIG_WAV_DEMUXER 0
-%define CONFIG_WC3_DEMUXER 0
-%define CONFIG_WEBM_DASH_MANIFEST_DEMUXER 0
-%define CONFIG_WEBVTT_DEMUXER 0
-%define CONFIG_WSAUD_DEMUXER 0
-%define CONFIG_WSD_DEMUXER 0
-%define CONFIG_WSVQA_DEMUXER 0
-%define CONFIG_WTV_DEMUXER 0
-%define CONFIG_WVE_DEMUXER 0
-%define CONFIG_WV_DEMUXER 0
-%define CONFIG_XA_DEMUXER 0
-%define CONFIG_XBIN_DEMUXER 0
-%define CONFIG_XMV_DEMUXER 0
-%define CONFIG_XVAG_DEMUXER 0
-%define CONFIG_XWMA_DEMUXER 0
-%define CONFIG_YOP_DEMUXER 0
-%define CONFIG_YUV4MPEGPIPE_DEMUXER 0
-%define CONFIG_IMAGE_BMP_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_DDS_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_DPX_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_EXR_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_J2K_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_JPEG_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_JPEGLS_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PAM_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PBM_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PCX_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PGMYUV_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PGM_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PICTOR_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PNG_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PPM_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_QDRAW_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_SGI_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_SUNRAST_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_TIFF_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_WEBP_PIPE_DEMUXER 0
-%define CONFIG_LIBGME_DEMUXER 0
-%define CONFIG_LIBMODPLUG_DEMUXER 0
-%define CONFIG_LIBNUT_DEMUXER 0
-%define CONFIG_LIBOPENMPT_DEMUXER 0
-%define CONFIG_A64MULTI_ENCODER 0
-%define CONFIG_A64MULTI5_ENCODER 0
-%define CONFIG_ALIAS_PIX_ENCODER 0
-%define CONFIG_AMV_ENCODER 0
-%define CONFIG_APNG_ENCODER 0
-%define CONFIG_ASV1_ENCODER 0
-%define CONFIG_ASV2_ENCODER 0
-%define CONFIG_AVRP_ENCODER 0
-%define CONFIG_AVUI_ENCODER 0
-%define CONFIG_AYUV_ENCODER 0
-%define CONFIG_BMP_ENCODER 0
-%define CONFIG_CINEPAK_ENCODER 0
-%define CONFIG_CLJR_ENCODER 0
-%define CONFIG_COMFORTNOISE_ENCODER 0
-%define CONFIG_DNXHD_ENCODER 0
-%define CONFIG_DPX_ENCODER 0
-%define CONFIG_DVVIDEO_ENCODER 0
-%define CONFIG_FFV1_ENCODER 0
-%define CONFIG_FFVHUFF_ENCODER 0
-%define CONFIG_FLASHSV_ENCODER 0
-%define CONFIG_FLASHSV2_ENCODER 0
-%define CONFIG_FLV_ENCODER 0
-%define CONFIG_GIF_ENCODER 0
-%define CONFIG_H261_ENCODER 0
-%define CONFIG_H263_ENCODER 0
-%define CONFIG_H263P_ENCODER 0
-%define CONFIG_HAP_ENCODER 0
-%define CONFIG_HUFFYUV_ENCODER 0
-%define CONFIG_JPEG2000_ENCODER 0
-%define CONFIG_JPEGLS_ENCODER 0
-%define CONFIG_LJPEG_ENCODER 0
-%define CONFIG_MJPEG_ENCODER 0
-%define CONFIG_MPEG1VIDEO_ENCODER 0
-%define CONFIG_MPEG2VIDEO_ENCODER 0
-%define CONFIG_MPEG4_ENCODER 0
-%define CONFIG_MSMPEG4V2_ENCODER 0
-%define CONFIG_MSMPEG4V3_ENCODER 0
-%define CONFIG_MSVIDEO1_ENCODER 0
-%define CONFIG_PAM_ENCODER 0
-%define CONFIG_PBM_ENCODER 0
-%define CONFIG_PCX_ENCODER 0
-%define CONFIG_PGM_ENCODER 0
-%define CONFIG_PGMYUV_ENCODER 0
-%define CONFIG_PNG_ENCODER 0
-%define CONFIG_PPM_ENCODER 0
-%define CONFIG_PRORES_ENCODER 0
-%define CONFIG_PRORES_AW_ENCODER 0
-%define CONFIG_PRORES_KS_ENCODER 0
-%define CONFIG_QTRLE_ENCODER 0
-%define CONFIG_R10K_ENCODER 0
-%define CONFIG_R210_ENCODER 0
-%define CONFIG_RAWVIDEO_ENCODER 0
-%define CONFIG_ROQ_ENCODER 0
-%define CONFIG_RV10_ENCODER 0
-%define CONFIG_RV20_ENCODER 0
-%define CONFIG_S302M_ENCODER 0
-%define CONFIG_SGI_ENCODER 0
-%define CONFIG_SNOW_ENCODER 0
-%define CONFIG_SUNRAST_ENCODER 0
-%define CONFIG_SVQ1_ENCODER 0
-%define CONFIG_TARGA_ENCODER 0
-%define CONFIG_TIFF_ENCODER 0
-%define CONFIG_UTVIDEO_ENCODER 0
-%define CONFIG_V210_ENCODER 0
-%define CONFIG_V308_ENCODER 0
-%define CONFIG_V408_ENCODER 0
-%define CONFIG_V410_ENCODER 0
-%define CONFIG_VC2_ENCODER 0
-%define CONFIG_WRAPPED_AVFRAME_ENCODER 0
-%define CONFIG_WMV1_ENCODER 0
-%define CONFIG_WMV2_ENCODER 0
-%define CONFIG_XBM_ENCODER 0
-%define CONFIG_XFACE_ENCODER 0
-%define CONFIG_XWD_ENCODER 0
-%define CONFIG_Y41P_ENCODER 0
-%define CONFIG_YUV4_ENCODER 0
-%define CONFIG_ZLIB_ENCODER 0
-%define CONFIG_ZMBV_ENCODER 0
-%define CONFIG_AAC_ENCODER 0
-%define CONFIG_AC3_ENCODER 0
-%define CONFIG_AC3_FIXED_ENCODER 0
-%define CONFIG_ALAC_ENCODER 0
-%define CONFIG_DCA_ENCODER 0
-%define CONFIG_EAC3_ENCODER 0
-%define CONFIG_FLAC_ENCODER 0
-%define CONFIG_G723_1_ENCODER 0
-%define CONFIG_MLP_ENCODER 0
-%define CONFIG_MP2_ENCODER 0
-%define CONFIG_MP2FIXED_ENCODER 0
-%define CONFIG_NELLYMOSER_ENCODER 0
-%define CONFIG_RA_144_ENCODER 0
-%define CONFIG_SONIC_ENCODER 0
-%define CONFIG_SONIC_LS_ENCODER 0
-%define CONFIG_TRUEHD_ENCODER 0
-%define CONFIG_TTA_ENCODER 0
-%define CONFIG_VORBIS_ENCODER 0
-%define CONFIG_WAVPACK_ENCODER 0
-%define CONFIG_WMAV1_ENCODER 0
-%define CONFIG_WMAV2_ENCODER 0
-%define CONFIG_PCM_ALAW_ENCODER 0
-%define CONFIG_PCM_F32BE_ENCODER 0
-%define CONFIG_PCM_F32LE_ENCODER 0
-%define CONFIG_PCM_F64BE_ENCODER 0
-%define CONFIG_PCM_F64LE_ENCODER 0
-%define CONFIG_PCM_MULAW_ENCODER 0
-%define CONFIG_PCM_S8_ENCODER 0
-%define CONFIG_PCM_S8_PLANAR_ENCODER 0
-%define CONFIG_PCM_S16BE_ENCODER 0
-%define CONFIG_PCM_S16BE_PLANAR_ENCODER 0
-%define CONFIG_PCM_S16LE_ENCODER 0
-%define CONFIG_PCM_S16LE_PLANAR_ENCODER 0
-%define CONFIG_PCM_S24BE_ENCODER 0
-%define CONFIG_PCM_S24DAUD_ENCODER 0
-%define CONFIG_PCM_S24LE_ENCODER 0
-%define CONFIG_PCM_S24LE_PLANAR_ENCODER 0
-%define CONFIG_PCM_S32BE_ENCODER 0
-%define CONFIG_PCM_S32LE_ENCODER 0
-%define CONFIG_PCM_S32LE_PLANAR_ENCODER 0
-%define CONFIG_PCM_S64BE_ENCODER 0
-%define CONFIG_PCM_S64LE_ENCODER 0
-%define CONFIG_PCM_U8_ENCODER 0
-%define CONFIG_PCM_U16BE_ENCODER 0
-%define CONFIG_PCM_U16LE_ENCODER 0
-%define CONFIG_PCM_U24BE_ENCODER 0
-%define CONFIG_PCM_U24LE_ENCODER 0
-%define CONFIG_PCM_U32BE_ENCODER 0
-%define CONFIG_PCM_U32LE_ENCODER 0
-%define CONFIG_ROQ_DPCM_ENCODER 0
-%define CONFIG_ADPCM_ADX_ENCODER 0
-%define CONFIG_ADPCM_G722_ENCODER 0
-%define CONFIG_ADPCM_G726_ENCODER 0
-%define CONFIG_ADPCM_IMA_QT_ENCODER 0
-%define CONFIG_ADPCM_IMA_WAV_ENCODER 0
-%define CONFIG_ADPCM_MS_ENCODER 0
-%define CONFIG_ADPCM_SWF_ENCODER 0
-%define CONFIG_ADPCM_YAMAHA_ENCODER 0
-%define CONFIG_SSA_ENCODER 0
-%define CONFIG_ASS_ENCODER 0
-%define CONFIG_DVBSUB_ENCODER 0
-%define CONFIG_DVDSUB_ENCODER 0
-%define CONFIG_MOVTEXT_ENCODER 0
-%define CONFIG_SRT_ENCODER 0
-%define CONFIG_SUBRIP_ENCODER 0
-%define CONFIG_TEXT_ENCODER 0
-%define CONFIG_WEBVTT_ENCODER 0
-%define CONFIG_XSUB_ENCODER 0
-%define CONFIG_AAC_AT_ENCODER 0
-%define CONFIG_ALAC_AT_ENCODER 0
-%define CONFIG_ILBC_AT_ENCODER 0
-%define CONFIG_PCM_ALAW_AT_ENCODER 0
-%define CONFIG_PCM_MULAW_AT_ENCODER 0
-%define CONFIG_LIBFDK_AAC_ENCODER 0
-%define CONFIG_LIBGSM_ENCODER 0
-%define CONFIG_LIBGSM_MS_ENCODER 0
-%define CONFIG_LIBILBC_ENCODER 0
-%define CONFIG_LIBMP3LAME_ENCODER 0
-%define CONFIG_LIBOPENCORE_AMRNB_ENCODER 0
-%define CONFIG_LIBOPENJPEG_ENCODER 0
-%define CONFIG_LIBOPUS_ENCODER 0
-%define CONFIG_LIBSCHROEDINGER_ENCODER 0
-%define CONFIG_LIBSHINE_ENCODER 0
-%define CONFIG_LIBSPEEX_ENCODER 0
-%define CONFIG_LIBTHEORA_ENCODER 0
-%define CONFIG_LIBTWOLAME_ENCODER 0
-%define CONFIG_LIBVO_AMRWBENC_ENCODER 0
-%define CONFIG_LIBVORBIS_ENCODER 0
-%define CONFIG_LIBVPX_VP8_ENCODER 0
-%define CONFIG_LIBVPX_VP9_ENCODER 0
-%define CONFIG_LIBWAVPACK_ENCODER 0
-%define CONFIG_LIBWEBP_ANIM_ENCODER 0
-%define CONFIG_LIBWEBP_ENCODER 0
-%define CONFIG_LIBX262_ENCODER 0
-%define CONFIG_LIBX264_ENCODER 0
-%define CONFIG_LIBX264RGB_ENCODER 0
-%define CONFIG_LIBX265_ENCODER 0
-%define CONFIG_LIBXAVS_ENCODER 0
-%define CONFIG_LIBXVID_ENCODER 0
-%define CONFIG_LIBOPENH264_ENCODER 0
-%define CONFIG_H264_NVENC_ENCODER 0
-%define CONFIG_H264_OMX_ENCODER 0
-%define CONFIG_H264_QSV_ENCODER 0
-%define CONFIG_H264_VAAPI_ENCODER 0
-%define CONFIG_H264_VIDEOTOOLBOX_ENCODER 0
-%define CONFIG_NVENC_ENCODER 0
-%define CONFIG_NVENC_H264_ENCODER 0
-%define CONFIG_NVENC_HEVC_ENCODER 0
-%define CONFIG_HEVC_NVENC_ENCODER 0
-%define CONFIG_HEVC_QSV_ENCODER 0
-%define CONFIG_HEVC_VAAPI_ENCODER 0
-%define CONFIG_LIBKVAZAAR_ENCODER 0
-%define CONFIG_MJPEG_VAAPI_ENCODER 0
-%define CONFIG_MPEG2_QSV_ENCODER 0
-%define CONFIG_ABENCH_FILTER 0
-%define CONFIG_ACOMPRESSOR_FILTER 0
-%define CONFIG_ACROSSFADE_FILTER 0
-%define CONFIG_ACRUSHER_FILTER 0
-%define CONFIG_ADELAY_FILTER 0
-%define CONFIG_AECHO_FILTER 0
-%define CONFIG_AEMPHASIS_FILTER 0
-%define CONFIG_AEVAL_FILTER 0
-%define CONFIG_AFADE_FILTER 0
-%define CONFIG_AFFTFILT_FILTER 0
-%define CONFIG_AFORMAT_FILTER 0
-%define CONFIG_AGATE_FILTER 0
-%define CONFIG_AINTERLEAVE_FILTER 0
-%define CONFIG_ALIMITER_FILTER 0
-%define CONFIG_ALLPASS_FILTER 0
-%define CONFIG_ALOOP_FILTER 0
-%define CONFIG_AMERGE_FILTER 0
-%define CONFIG_AMETADATA_FILTER 0
-%define CONFIG_AMIX_FILTER 0
-%define CONFIG_ANEQUALIZER_FILTER 0
-%define CONFIG_ANULL_FILTER 0
-%define CONFIG_APAD_FILTER 0
-%define CONFIG_APERMS_FILTER 0
-%define CONFIG_APHASER_FILTER 0
-%define CONFIG_APULSATOR_FILTER 0
-%define CONFIG_AREALTIME_FILTER 0
-%define CONFIG_ARESAMPLE_FILTER 0
-%define CONFIG_AREVERSE_FILTER 0
-%define CONFIG_ASELECT_FILTER 0
-%define CONFIG_ASENDCMD_FILTER 0
-%define CONFIG_ASETNSAMPLES_FILTER 0
-%define CONFIG_ASETPTS_FILTER 0
-%define CONFIG_ASETRATE_FILTER 0
-%define CONFIG_ASETTB_FILTER 0
-%define CONFIG_ASHOWINFO_FILTER 0
-%define CONFIG_ASIDEDATA_FILTER 0
-%define CONFIG_ASPLIT_FILTER 0
-%define CONFIG_ASTATS_FILTER 0
-%define CONFIG_ASTREAMSELECT_FILTER 0
-%define CONFIG_ASYNCTS_FILTER 0
-%define CONFIG_ATEMPO_FILTER 0
-%define CONFIG_ATRIM_FILTER 0
-%define CONFIG_AZMQ_FILTER 0
-%define CONFIG_BANDPASS_FILTER 0
-%define CONFIG_BANDREJECT_FILTER 0
-%define CONFIG_BASS_FILTER 0
-%define CONFIG_BIQUAD_FILTER 0
-%define CONFIG_BS2B_FILTER 0
-%define CONFIG_CHANNELMAP_FILTER 0
-%define CONFIG_CHANNELSPLIT_FILTER 0
-%define CONFIG_CHORUS_FILTER 0
-%define CONFIG_COMPAND_FILTER 0
-%define CONFIG_COMPENSATIONDELAY_FILTER 0
-%define CONFIG_CRYSTALIZER_FILTER 0
-%define CONFIG_DCSHIFT_FILTER 0
-%define CONFIG_DYNAUDNORM_FILTER 0
-%define CONFIG_EARWAX_FILTER 0
-%define CONFIG_EBUR128_FILTER 0
-%define CONFIG_EQUALIZER_FILTER 0
-%define CONFIG_EXTRASTEREO_FILTER 0
-%define CONFIG_FIREQUALIZER_FILTER 0
-%define CONFIG_FLANGER_FILTER 0
-%define CONFIG_HDCD_FILTER 0
-%define CONFIG_HIGHPASS_FILTER 0
-%define CONFIG_JOIN_FILTER 0
-%define CONFIG_LADSPA_FILTER 0
-%define CONFIG_LOUDNORM_FILTER 0
-%define CONFIG_LOWPASS_FILTER 0
-%define CONFIG_PAN_FILTER 0
-%define CONFIG_REPLAYGAIN_FILTER 0
-%define CONFIG_RESAMPLE_FILTER 0
-%define CONFIG_RUBBERBAND_FILTER 0
-%define CONFIG_SIDECHAINCOMPRESS_FILTER 0
-%define CONFIG_SIDECHAINGATE_FILTER 0
-%define CONFIG_SILENCEDETECT_FILTER 0
-%define CONFIG_SILENCEREMOVE_FILTER 0
-%define CONFIG_SOFALIZER_FILTER 0
-%define CONFIG_STEREOTOOLS_FILTER 0
-%define CONFIG_STEREOWIDEN_FILTER 0
-%define CONFIG_TREBLE_FILTER 0
-%define CONFIG_TREMOLO_FILTER 0
-%define CONFIG_VIBRATO_FILTER 0
-%define CONFIG_VOLUME_FILTER 0
-%define CONFIG_VOLUMEDETECT_FILTER 0
-%define CONFIG_AEVALSRC_FILTER 0
-%define CONFIG_ANOISESRC_FILTER 0
-%define CONFIG_ANULLSRC_FILTER 0
-%define CONFIG_FLITE_FILTER 0
-%define CONFIG_SINE_FILTER 0
-%define CONFIG_ANULLSINK_FILTER 0
-%define CONFIG_ALPHAEXTRACT_FILTER 0
-%define CONFIG_ALPHAMERGE_FILTER 0
-%define CONFIG_ASS_FILTER 0
-%define CONFIG_ATADENOISE_FILTER 0
-%define CONFIG_AVGBLUR_FILTER 0
-%define CONFIG_BBOX_FILTER 0
-%define CONFIG_BENCH_FILTER 0
-%define CONFIG_BITPLANENOISE_FILTER 0
-%define CONFIG_BLACKDETECT_FILTER 0
-%define CONFIG_BLACKFRAME_FILTER 0
-%define CONFIG_BLEND_FILTER 0
-%define CONFIG_BOXBLUR_FILTER 0
-%define CONFIG_BWDIF_FILTER 0
-%define CONFIG_CHROMAKEY_FILTER 0
-%define CONFIG_CIESCOPE_FILTER 0
-%define CONFIG_CODECVIEW_FILTER 0
-%define CONFIG_COLORBALANCE_FILTER 0
-%define CONFIG_COLORCHANNELMIXER_FILTER 0
-%define CONFIG_COLORKEY_FILTER 0
-%define CONFIG_COLORLEVELS_FILTER 0
-%define CONFIG_COLORMATRIX_FILTER 0
-%define CONFIG_COLORSPACE_FILTER 0
-%define CONFIG_CONVOLUTION_FILTER 0
-%define CONFIG_COPY_FILTER 0
-%define CONFIG_COREIMAGE_FILTER 0
-%define CONFIG_COVER_RECT_FILTER 0
-%define CONFIG_CROP_FILTER 0
-%define CONFIG_CROPDETECT_FILTER 0
-%define CONFIG_CURVES_FILTER 0
-%define CONFIG_DATASCOPE_FILTER 0
-%define CONFIG_DCTDNOIZ_FILTER 0
-%define CONFIG_DEBAND_FILTER 0
-%define CONFIG_DECIMATE_FILTER 0
-%define CONFIG_DEFLATE_FILTER 0
-%define CONFIG_DEJUDDER_FILTER 0
-%define CONFIG_DELOGO_FILTER 0
-%define CONFIG_DESHAKE_FILTER 0
-%define CONFIG_DETELECINE_FILTER 0
-%define CONFIG_DILATION_FILTER 0
-%define CONFIG_DISPLACE_FILTER 0
-%define CONFIG_DRAWBOX_FILTER 0
-%define CONFIG_DRAWGRAPH_FILTER 0
-%define CONFIG_DRAWGRID_FILTER 0
-%define CONFIG_DRAWTEXT_FILTER 0
-%define CONFIG_EDGEDETECT_FILTER 0
-%define CONFIG_ELBG_FILTER 0
-%define CONFIG_EQ_FILTER 0
-%define CONFIG_EROSION_FILTER 0
-%define CONFIG_EXTRACTPLANES_FILTER 0
-%define CONFIG_FADE_FILTER 0
-%define CONFIG_FFTFILT_FILTER 0
-%define CONFIG_FIELD_FILTER 0
-%define CONFIG_FIELDHINT_FILTER 0
-%define CONFIG_FIELDMATCH_FILTER 0
-%define CONFIG_FIELDORDER_FILTER 0
-%define CONFIG_FIND_RECT_FILTER 0
-%define CONFIG_FORMAT_FILTER 0
-%define CONFIG_FPS_FILTER 0
-%define CONFIG_FRAMEPACK_FILTER 0
-%define CONFIG_FRAMERATE_FILTER 0
-%define CONFIG_FRAMESTEP_FILTER 0
-%define CONFIG_FREI0R_FILTER 0
-%define CONFIG_FSPP_FILTER 0
-%define CONFIG_GBLUR_FILTER 0
-%define CONFIG_GEQ_FILTER 0
-%define CONFIG_GRADFUN_FILTER 0
-%define CONFIG_HALDCLUT_FILTER 0
-%define CONFIG_HFLIP_FILTER 0
-%define CONFIG_HISTEQ_FILTER 0
-%define CONFIG_HISTOGRAM_FILTER 0
-%define CONFIG_HQDN3D_FILTER 0
-%define CONFIG_HQX_FILTER 0
-%define CONFIG_HSTACK_FILTER 0
-%define CONFIG_HUE_FILTER 0
-%define CONFIG_HWDOWNLOAD_FILTER 0
-%define CONFIG_HWUPLOAD_FILTER 0
-%define CONFIG_HWUPLOAD_CUDA_FILTER 0
-%define CONFIG_HYSTERESIS_FILTER 0
-%define CONFIG_IDET_FILTER 0
-%define CONFIG_IL_FILTER 0
-%define CONFIG_INFLATE_FILTER 0
-%define CONFIG_INTERLACE_FILTER 0
-%define CONFIG_INTERLEAVE_FILTER 0
-%define CONFIG_KERNDEINT_FILTER 0
-%define CONFIG_LENSCORRECTION_FILTER 0
-%define CONFIG_LOOP_FILTER 0
-%define CONFIG_LUT_FILTER 0
-%define CONFIG_LUT2_FILTER 0
-%define CONFIG_LUT3D_FILTER 0
-%define CONFIG_LUTRGB_FILTER 0
-%define CONFIG_LUTYUV_FILTER 0
-%define CONFIG_MASKEDCLAMP_FILTER 0
-%define CONFIG_MASKEDMERGE_FILTER 0
-%define CONFIG_MCDEINT_FILTER 0
-%define CONFIG_MERGEPLANES_FILTER 0
-%define CONFIG_MESTIMATE_FILTER 0
-%define CONFIG_METADATA_FILTER 0
-%define CONFIG_MINTERPOLATE_FILTER 0
-%define CONFIG_MPDECIMATE_FILTER 0
-%define CONFIG_NEGATE_FILTER 0
-%define CONFIG_NLMEANS_FILTER 0
-%define CONFIG_NNEDI_FILTER 0
-%define CONFIG_NOFORMAT_FILTER 0
-%define CONFIG_NOISE_FILTER 0
-%define CONFIG_NULL_FILTER 0
-%define CONFIG_OCR_FILTER 0
-%define CONFIG_OCV_FILTER 0
-%define CONFIG_OVERLAY_FILTER 0
-%define CONFIG_OWDENOISE_FILTER 0
-%define CONFIG_PAD_FILTER 0
-%define CONFIG_PALETTEGEN_FILTER 0
-%define CONFIG_PALETTEUSE_FILTER 0
-%define CONFIG_PERMS_FILTER 0
-%define CONFIG_PERSPECTIVE_FILTER 0
-%define CONFIG_PHASE_FILTER 0
-%define CONFIG_PIXDESCTEST_FILTER 0
-%define CONFIG_PP_FILTER 0
-%define CONFIG_PP7_FILTER 0
-%define CONFIG_PREWITT_FILTER 0
-%define CONFIG_PSNR_FILTER 0
-%define CONFIG_PULLUP_FILTER 0
-%define CONFIG_QP_FILTER 0
-%define CONFIG_RANDOM_FILTER 0
-%define CONFIG_READVITC_FILTER 0
-%define CONFIG_REALTIME_FILTER 0
-%define CONFIG_REMAP_FILTER 0
-%define CONFIG_REMOVEGRAIN_FILTER 0
-%define CONFIG_REMOVELOGO_FILTER 0
-%define CONFIG_REPEATFIELDS_FILTER 0
-%define CONFIG_REVERSE_FILTER 0
-%define CONFIG_ROTATE_FILTER 0
-%define CONFIG_SAB_FILTER 0
-%define CONFIG_SCALE_FILTER 0
-%define CONFIG_SCALE_NPP_FILTER 0
-%define CONFIG_SCALE_VAAPI_FILTER 0
-%define CONFIG_SCALE2REF_FILTER 0
-%define CONFIG_SELECT_FILTER 0
-%define CONFIG_SELECTIVECOLOR_FILTER 0
-%define CONFIG_SENDCMD_FILTER 0
-%define CONFIG_SEPARATEFIELDS_FILTER 0
-%define CONFIG_SETDAR_FILTER 0
-%define CONFIG_SETFIELD_FILTER 0
-%define CONFIG_SETPTS_FILTER 0
-%define CONFIG_SETSAR_FILTER 0
-%define CONFIG_SETTB_FILTER 0
-%define CONFIG_SHOWINFO_FILTER 0
-%define CONFIG_SHOWPALETTE_FILTER 0
-%define CONFIG_SHUFFLEFRAMES_FILTER 0
-%define CONFIG_SHUFFLEPLANES_FILTER 0
-%define CONFIG_SIDEDATA_FILTER 0
-%define CONFIG_SIGNALSTATS_FILTER 0
-%define CONFIG_SMARTBLUR_FILTER 0
-%define CONFIG_SOBEL_FILTER 0
-%define CONFIG_SPLIT_FILTER 0
-%define CONFIG_SPP_FILTER 0
-%define CONFIG_SSIM_FILTER 0
-%define CONFIG_STEREO3D_FILTER 0
-%define CONFIG_STREAMSELECT_FILTER 0
-%define CONFIG_SUBTITLES_FILTER 0
-%define CONFIG_SUPER2XSAI_FILTER 0
-%define CONFIG_SWAPRECT_FILTER 0
-%define CONFIG_SWAPUV_FILTER 0
-%define CONFIG_TBLEND_FILTER 0
-%define CONFIG_TELECINE_FILTER 0
-%define CONFIG_THUMBNAIL_FILTER 0
-%define CONFIG_TILE_FILTER 0
-%define CONFIG_TINTERLACE_FILTER 0
-%define CONFIG_TRANSPOSE_FILTER 0
-%define CONFIG_TRIM_FILTER 0
-%define CONFIG_UNSHARP_FILTER 0
-%define CONFIG_USPP_FILTER 0
-%define CONFIG_VAGUEDENOISER_FILTER 0
-%define CONFIG_VECTORSCOPE_FILTER 0
-%define CONFIG_VFLIP_FILTER 0
-%define CONFIG_VIDSTABDETECT_FILTER 0
-%define CONFIG_VIDSTABTRANSFORM_FILTER 0
-%define CONFIG_VIGNETTE_FILTER 0
-%define CONFIG_VSTACK_FILTER 0
-%define CONFIG_W3FDIF_FILTER 0
-%define CONFIG_WAVEFORM_FILTER 0
-%define CONFIG_WEAVE_FILTER 0
-%define CONFIG_XBR_FILTER 0
-%define CONFIG_YADIF_FILTER 0
-%define CONFIG_ZMQ_FILTER 0
-%define CONFIG_ZOOMPAN_FILTER 0
-%define CONFIG_ZSCALE_FILTER 0
-%define CONFIG_ALLRGB_FILTER 0
-%define CONFIG_ALLYUV_FILTER 0
-%define CONFIG_CELLAUTO_FILTER 0
-%define CONFIG_COLOR_FILTER 0
-%define CONFIG_COREIMAGESRC_FILTER 0
-%define CONFIG_FREI0R_SRC_FILTER 0
-%define CONFIG_HALDCLUTSRC_FILTER 0
-%define CONFIG_LIFE_FILTER 0
-%define CONFIG_MANDELBROT_FILTER 0
-%define CONFIG_MPTESTSRC_FILTER 0
-%define CONFIG_NULLSRC_FILTER 0
-%define CONFIG_RGBTESTSRC_FILTER 0
-%define CONFIG_SMPTEBARS_FILTER 0
-%define CONFIG_SMPTEHDBARS_FILTER 0
-%define CONFIG_TESTSRC_FILTER 0
-%define CONFIG_TESTSRC2_FILTER 0
-%define CONFIG_YUVTESTSRC_FILTER 0
-%define CONFIG_NULLSINK_FILTER 0
-%define CONFIG_ADRAWGRAPH_FILTER 0
-%define CONFIG_AHISTOGRAM_FILTER 0
-%define CONFIG_APHASEMETER_FILTER 0
-%define CONFIG_AVECTORSCOPE_FILTER 0
-%define CONFIG_CONCAT_FILTER 0
-%define CONFIG_SHOWCQT_FILTER 0
-%define CONFIG_SHOWFREQS_FILTER 0
-%define CONFIG_SHOWSPECTRUM_FILTER 0
-%define CONFIG_SHOWSPECTRUMPIC_FILTER 0
-%define CONFIG_SHOWVOLUME_FILTER 0
-%define CONFIG_SHOWWAVES_FILTER 0
-%define CONFIG_SHOWWAVESPIC_FILTER 0
-%define CONFIG_SPECTRUMSYNTH_FILTER 0
-%define CONFIG_AMOVIE_FILTER 0
-%define CONFIG_MOVIE_FILTER 0
-%define CONFIG_H263_CUVID_HWACCEL 0
-%define CONFIG_H263_VAAPI_HWACCEL 0
-%define CONFIG_H263_VIDEOTOOLBOX_HWACCEL 0
-%define CONFIG_H264_CUVID_HWACCEL 0
-%define CONFIG_H264_D3D11VA_HWACCEL 0
-%define CONFIG_H264_DXVA2_HWACCEL 0
-%define CONFIG_H264_MEDIACODEC_HWACCEL 0
-%define CONFIG_H264_MMAL_HWACCEL 0
-%define CONFIG_H264_QSV_HWACCEL 0
-%define CONFIG_H264_VAAPI_HWACCEL 0
-%define CONFIG_H264_VDA_HWACCEL 0
-%define CONFIG_H264_VDA_OLD_HWACCEL 0
-%define CONFIG_H264_VDPAU_HWACCEL 0
-%define CONFIG_H264_VIDEOTOOLBOX_HWACCEL 0
-%define CONFIG_HEVC_CUVID_HWACCEL 0
-%define CONFIG_HEVC_D3D11VA_HWACCEL 0
-%define CONFIG_HEVC_DXVA2_HWACCEL 0
-%define CONFIG_HEVC_MEDIACODEC_HWACCEL 0
-%define CONFIG_HEVC_QSV_HWACCEL 0
-%define CONFIG_HEVC_VAAPI_HWACCEL 0
-%define CONFIG_HEVC_VDPAU_HWACCEL 0
-%define CONFIG_MJPEG_CUVID_HWACCEL 0
-%define CONFIG_MPEG1_CUVID_HWACCEL 0
-%define CONFIG_MPEG1_XVMC_HWACCEL 0
-%define CONFIG_MPEG1_VDPAU_HWACCEL 0
-%define CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL 0
-%define CONFIG_MPEG2_CUVID_HWACCEL 0
-%define CONFIG_MPEG2_XVMC_HWACCEL 0
-%define CONFIG_MPEG2_D3D11VA_HWACCEL 0
-%define CONFIG_MPEG2_DXVA2_HWACCEL 0
-%define CONFIG_MPEG2_MMAL_HWACCEL 0
-%define CONFIG_MPEG2_QSV_HWACCEL 0
-%define CONFIG_MPEG2_VAAPI_HWACCEL 0
-%define CONFIG_MPEG2_VDPAU_HWACCEL 0
-%define CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL 0
-%define CONFIG_MPEG4_CUVID_HWACCEL 0
-%define CONFIG_MPEG4_MEDIACODEC_HWACCEL 0
-%define CONFIG_MPEG4_MMAL_HWACCEL 0
-%define CONFIG_MPEG4_VAAPI_HWACCEL 0
-%define CONFIG_MPEG4_VDPAU_HWACCEL 0
-%define CONFIG_MPEG4_VIDEOTOOLBOX_HWACCEL 0
-%define CONFIG_VC1_CUVID_HWACCEL 0
-%define CONFIG_VC1_D3D11VA_HWACCEL 0
-%define CONFIG_VC1_DXVA2_HWACCEL 0
-%define CONFIG_VC1_VAAPI_HWACCEL 0
-%define CONFIG_VC1_VDPAU_HWACCEL 0
-%define CONFIG_VC1_MMAL_HWACCEL 0
-%define CONFIG_VC1_QSV_HWACCEL 0
-%define CONFIG_VP8_CUVID_HWACCEL 0
-%define CONFIG_VP8_MEDIACODEC_HWACCEL 0
-%define CONFIG_VP9_CUVID_HWACCEL 0
-%define CONFIG_VP9_D3D11VA_HWACCEL 0
-%define CONFIG_VP9_DXVA2_HWACCEL 0
-%define CONFIG_VP9_MEDIACODEC_HWACCEL 0
-%define CONFIG_VP9_VAAPI_HWACCEL 0
-%define CONFIG_WMV3_D3D11VA_HWACCEL 0
-%define CONFIG_WMV3_DXVA2_HWACCEL 0
-%define CONFIG_WMV3_VAAPI_HWACCEL 0
-%define CONFIG_WMV3_VDPAU_HWACCEL 0
-%define CONFIG_ALSA_INDEV 0
-%define CONFIG_AVFOUNDATION_INDEV 0
-%define CONFIG_BKTR_INDEV 0
-%define CONFIG_DECKLINK_INDEV 0
-%define CONFIG_DSHOW_INDEV 0
-%define CONFIG_DV1394_INDEV 0
-%define CONFIG_FBDEV_INDEV 0
-%define CONFIG_GDIGRAB_INDEV 0
-%define CONFIG_IEC61883_INDEV 0
-%define CONFIG_JACK_INDEV 0
-%define CONFIG_LAVFI_INDEV 0
-%define CONFIG_OPENAL_INDEV 0
-%define CONFIG_OSS_INDEV 0
-%define CONFIG_PULSE_INDEV 0
-%define CONFIG_QTKIT_INDEV 0
-%define CONFIG_SNDIO_INDEV 0
-%define CONFIG_V4L2_INDEV 0
-%define CONFIG_VFWCAP_INDEV 0
-%define CONFIG_X11GRAB_INDEV 0
-%define CONFIG_X11GRAB_XCB_INDEV 0
-%define CONFIG_LIBCDIO_INDEV 0
-%define CONFIG_LIBDC1394_INDEV 0
-%define CONFIG_A64_MUXER 0
-%define CONFIG_AC3_MUXER 0
-%define CONFIG_ADTS_MUXER 0
-%define CONFIG_ADX_MUXER 0
-%define CONFIG_AIFF_MUXER 0
-%define CONFIG_AMR_MUXER 0
-%define CONFIG_APNG_MUXER 0
-%define CONFIG_ASF_MUXER 0
-%define CONFIG_ASS_MUXER 0
-%define CONFIG_AST_MUXER 0
-%define CONFIG_ASF_STREAM_MUXER 0
-%define CONFIG_AU_MUXER 0
-%define CONFIG_AVI_MUXER 0
-%define CONFIG_AVM2_MUXER 0
-%define CONFIG_BIT_MUXER 0
-%define CONFIG_CAF_MUXER 0
-%define CONFIG_CAVSVIDEO_MUXER 0
-%define CONFIG_CRC_MUXER 0
-%define CONFIG_DASH_MUXER 0
-%define CONFIG_DATA_MUXER 0
-%define CONFIG_DAUD_MUXER 0
-%define CONFIG_DIRAC_MUXER 0
-%define CONFIG_DNXHD_MUXER 0
-%define CONFIG_DTS_MUXER 0
-%define CONFIG_DV_MUXER 0
-%define CONFIG_EAC3_MUXER 0
-%define CONFIG_F4V_MUXER 0
-%define CONFIG_FFM_MUXER 0
-%define CONFIG_FFMETADATA_MUXER 0
-%define CONFIG_FIFO_MUXER 0
-%define CONFIG_FILMSTRIP_MUXER 0
-%define CONFIG_FLAC_MUXER 0
-%define CONFIG_FLV_MUXER 0
-%define CONFIG_FRAMECRC_MUXER 0
-%define CONFIG_FRAMEHASH_MUXER 0
-%define CONFIG_FRAMEMD5_MUXER 0
-%define CONFIG_G722_MUXER 0
-%define CONFIG_G723_1_MUXER 0
-%define CONFIG_GIF_MUXER 0
-%define CONFIG_GSM_MUXER 0
-%define CONFIG_GXF_MUXER 0
-%define CONFIG_H261_MUXER 0
-%define CONFIG_H263_MUXER 0
-%define CONFIG_H264_MUXER 0
-%define CONFIG_HASH_MUXER 0
-%define CONFIG_HDS_MUXER 0
-%define CONFIG_HEVC_MUXER 0
-%define CONFIG_HLS_MUXER 0
-%define CONFIG_ICO_MUXER 0
-%define CONFIG_ILBC_MUXER 0
-%define CONFIG_IMAGE2_MUXER 0
-%define CONFIG_IMAGE2PIPE_MUXER 0
-%define CONFIG_IPOD_MUXER 0
-%define CONFIG_IRCAM_MUXER 0
-%define CONFIG_ISMV_MUXER 0
-%define CONFIG_IVF_MUXER 0
-%define CONFIG_JACOSUB_MUXER 0
-%define CONFIG_LATM_MUXER 0
-%define CONFIG_LRC_MUXER 0
-%define CONFIG_M4V_MUXER 0
-%define CONFIG_MD5_MUXER 0
-%define CONFIG_MATROSKA_MUXER 0
-%define CONFIG_MATROSKA_AUDIO_MUXER 0
-%define CONFIG_MICRODVD_MUXER 0
-%define CONFIG_MJPEG_MUXER 0
-%define CONFIG_MLP_MUXER 0
-%define CONFIG_MMF_MUXER 0
-%define CONFIG_MOV_MUXER 0
-%define CONFIG_MP2_MUXER 0
-%define CONFIG_MP3_MUXER 0
-%define CONFIG_MP4_MUXER 0
-%define CONFIG_MPEG1SYSTEM_MUXER 0
-%define CONFIG_MPEG1VCD_MUXER 0
-%define CONFIG_MPEG1VIDEO_MUXER 0
-%define CONFIG_MPEG2DVD_MUXER 0
-%define CONFIG_MPEG2SVCD_MUXER 0
-%define CONFIG_MPEG2VIDEO_MUXER 0
-%define CONFIG_MPEG2VOB_MUXER 0
-%define CONFIG_MPEGTS_MUXER 0
-%define CONFIG_MPJPEG_MUXER 0
-%define CONFIG_MXF_MUXER 0
-%define CONFIG_MXF_D10_MUXER 0
-%define CONFIG_MXF_OPATOM_MUXER 0
-%define CONFIG_NULL_MUXER 0
-%define CONFIG_NUT_MUXER 0
-%define CONFIG_OGA_MUXER 0
-%define CONFIG_OGG_MUXER 0
-%define CONFIG_OGV_MUXER 0
-%define CONFIG_OMA_MUXER 0
-%define CONFIG_OPUS_MUXER 0
-%define CONFIG_PCM_ALAW_MUXER 0
-%define CONFIG_PCM_MULAW_MUXER 0
-%define CONFIG_PCM_F64BE_MUXER 0
-%define CONFIG_PCM_F64LE_MUXER 0
-%define CONFIG_PCM_F32BE_MUXER 0
-%define CONFIG_PCM_F32LE_MUXER 0
-%define CONFIG_PCM_S32BE_MUXER 0
-%define CONFIG_PCM_S32LE_MUXER 0
-%define CONFIG_PCM_S24BE_MUXER 0
-%define CONFIG_PCM_S24LE_MUXER 0
-%define CONFIG_PCM_S16BE_MUXER 0
-%define CONFIG_PCM_S16LE_MUXER 0
-%define CONFIG_PCM_S8_MUXER 0
-%define CONFIG_PCM_U32BE_MUXER 0
-%define CONFIG_PCM_U32LE_MUXER 0
-%define CONFIG_PCM_U24BE_MUXER 0
-%define CONFIG_PCM_U24LE_MUXER 0
-%define CONFIG_PCM_U16BE_MUXER 0
-%define CONFIG_PCM_U16LE_MUXER 0
-%define CONFIG_PCM_U8_MUXER 0
-%define CONFIG_PSP_MUXER 0
-%define CONFIG_RAWVIDEO_MUXER 0
-%define CONFIG_RM_MUXER 0
-%define CONFIG_ROQ_MUXER 0
-%define CONFIG_RSO_MUXER 0
-%define CONFIG_RTP_MUXER 0
-%define CONFIG_RTP_MPEGTS_MUXER 0
-%define CONFIG_RTSP_MUXER 0
-%define CONFIG_SAP_MUXER 0
-%define CONFIG_SEGMENT_MUXER 0
-%define CONFIG_STREAM_SEGMENT_MUXER 0
-%define CONFIG_SINGLEJPEG_MUXER 0
-%define CONFIG_SMJPEG_MUXER 0
-%define CONFIG_SMOOTHSTREAMING_MUXER 0
-%define CONFIG_SOX_MUXER 0
-%define CONFIG_SPX_MUXER 0
-%define CONFIG_SPDIF_MUXER 0
-%define CONFIG_SRT_MUXER 0
-%define CONFIG_SWF_MUXER 0
-%define CONFIG_TEE_MUXER 0
-%define CONFIG_TG2_MUXER 0
-%define CONFIG_TGP_MUXER 0
-%define CONFIG_MKVTIMESTAMP_V2_MUXER 0
-%define CONFIG_TRUEHD_MUXER 0
-%define CONFIG_TTA_MUXER 0
-%define CONFIG_UNCODEDFRAMECRC_MUXER 0
-%define CONFIG_VC1_MUXER 0
-%define CONFIG_VC1T_MUXER 0
-%define CONFIG_VOC_MUXER 0
-%define CONFIG_W64_MUXER 0
-%define CONFIG_WAV_MUXER 0
-%define CONFIG_WEBM_MUXER 0
-%define CONFIG_WEBM_DASH_MANIFEST_MUXER 0
-%define CONFIG_WEBM_CHUNK_MUXER 0
-%define CONFIG_WEBP_MUXER 0
-%define CONFIG_WEBVTT_MUXER 0
-%define CONFIG_WTV_MUXER 0
-%define CONFIG_WV_MUXER 0
-%define CONFIG_YUV4MPEGPIPE_MUXER 0
-%define CONFIG_CHROMAPRINT_MUXER 0
-%define CONFIG_LIBNUT_MUXER 0
-%define CONFIG_ALSA_OUTDEV 0
-%define CONFIG_CACA_OUTDEV 0
-%define CONFIG_DECKLINK_OUTDEV 0
-%define CONFIG_FBDEV_OUTDEV 0
-%define CONFIG_OPENGL_OUTDEV 0
-%define CONFIG_OSS_OUTDEV 0
-%define CONFIG_PULSE_OUTDEV 0
-%define CONFIG_SDL2_OUTDEV 0
-%define CONFIG_SNDIO_OUTDEV 0
-%define CONFIG_V4L2_OUTDEV 0
-%define CONFIG_XV_OUTDEV 0
-%define CONFIG_AAC_PARSER 0
-%define CONFIG_AAC_LATM_PARSER 0
-%define CONFIG_AC3_PARSER 0
-%define CONFIG_ADX_PARSER 0
-%define CONFIG_BMP_PARSER 0
-%define CONFIG_CAVSVIDEO_PARSER 0
-%define CONFIG_COOK_PARSER 0
-%define CONFIG_DCA_PARSER 0
-%define CONFIG_DIRAC_PARSER 0
-%define CONFIG_DNXHD_PARSER 0
-%define CONFIG_DPX_PARSER 0
-%define CONFIG_DVAUDIO_PARSER 0
-%define CONFIG_DVBSUB_PARSER 0
-%define CONFIG_DVDSUB_PARSER 0
-%define CONFIG_DVD_NAV_PARSER 0
-%define CONFIG_FLAC_PARSER 1
-%define CONFIG_G729_PARSER 0
-%define CONFIG_GSM_PARSER 0
-%define CONFIG_H261_PARSER 0
-%define CONFIG_H263_PARSER 0
-%define CONFIG_H264_PARSER 0
-%define CONFIG_HEVC_PARSER 0
-%define CONFIG_MJPEG_PARSER 0
-%define CONFIG_MLP_PARSER 0
-%define CONFIG_MPEG4VIDEO_PARSER 0
-%define CONFIG_MPEGAUDIO_PARSER 0
-%define CONFIG_MPEGVIDEO_PARSER 0
-%define CONFIG_OPUS_PARSER 0
-%define CONFIG_PNG_PARSER 0
-%define CONFIG_PNM_PARSER 0
-%define CONFIG_RV30_PARSER 0
-%define CONFIG_RV40_PARSER 0
-%define CONFIG_TAK_PARSER 0
-%define CONFIG_VC1_PARSER 0
-%define CONFIG_VORBIS_PARSER 0
-%define CONFIG_VP3_PARSER 0
+%define CONFIG_FLAC_PARSER 0
%define CONFIG_VP8_PARSER 1
%define CONFIG_VP9_PARSER 1
-%define CONFIG_ASYNC_PROTOCOL 0
-%define CONFIG_BLURAY_PROTOCOL 0
-%define CONFIG_CACHE_PROTOCOL 0
-%define CONFIG_CONCAT_PROTOCOL 0
-%define CONFIG_CRYPTO_PROTOCOL 0
-%define CONFIG_DATA_PROTOCOL 0
-%define CONFIG_FFRTMPCRYPT_PROTOCOL 0
-%define CONFIG_FFRTMPHTTP_PROTOCOL 0
-%define CONFIG_FILE_PROTOCOL 0
-%define CONFIG_FTP_PROTOCOL 0
-%define CONFIG_GOPHER_PROTOCOL 0
-%define CONFIG_HLS_PROTOCOL 0
-%define CONFIG_HTTP_PROTOCOL 0
-%define CONFIG_HTTPPROXY_PROTOCOL 0
-%define CONFIG_HTTPS_PROTOCOL 0
-%define CONFIG_ICECAST_PROTOCOL 0
-%define CONFIG_MMSH_PROTOCOL 0
-%define CONFIG_MMST_PROTOCOL 0
-%define CONFIG_MD5_PROTOCOL 0
-%define CONFIG_PIPE_PROTOCOL 0
-%define CONFIG_RTMP_PROTOCOL 0
-%define CONFIG_RTMPE_PROTOCOL 0
-%define CONFIG_RTMPS_PROTOCOL 0
-%define CONFIG_RTMPT_PROTOCOL 0
-%define CONFIG_RTMPTE_PROTOCOL 0
-%define CONFIG_RTMPTS_PROTOCOL 0
-%define CONFIG_RTP_PROTOCOL 0
-%define CONFIG_SCTP_PROTOCOL 0
-%define CONFIG_SRTP_PROTOCOL 0
-%define CONFIG_SUBFILE_PROTOCOL 0
-%define CONFIG_TEE_PROTOCOL 0
-%define CONFIG_TCP_PROTOCOL 0
-%define CONFIG_TLS_GNUTLS_PROTOCOL 0
-%define CONFIG_TLS_SCHANNEL_PROTOCOL 0
-%define CONFIG_TLS_SECURETRANSPORT_PROTOCOL 0
-%define CONFIG_TLS_OPENSSL_PROTOCOL 0
-%define CONFIG_UDP_PROTOCOL 0
-%define CONFIG_UDPLITE_PROTOCOL 0
-%define CONFIG_UNIX_PROTOCOL 0
-%define CONFIG_LIBRTMP_PROTOCOL 0
-%define CONFIG_LIBRTMPE_PROTOCOL 0
-%define CONFIG_LIBRTMPS_PROTOCOL 0
-%define CONFIG_LIBRTMPT_PROTOCOL 0
-%define CONFIG_LIBRTMPTE_PROTOCOL 0
-%define CONFIG_LIBSSH_PROTOCOL 0
-%define CONFIG_LIBSMBCLIENT_PROTOCOL 0
diff --git a/media/ffvpx/config_win32.h b/media/ffvpx/config_win32.h
index b23b2ad9f8..36bb2d3c3d 100644
--- a/media/ffvpx/config_win32.h
+++ b/media/ffvpx/config_win32.h
@@ -1,12 +1,12 @@
/* Automatically generated by configure - do not modify! */
#ifndef FFMPEG_CONFIG_H
#define FFMPEG_CONFIG_H
-#define FFMPEG_CONFIGURATION "--disable-everything --disable-protocols --disable-demuxers --disable-muxers --disable-filters --disable-programs --disable-doc --disable-parsers --enable-parser=vp8 --enable-parser=vp9 --enable-decoder=vp8 --enable-decoder=vp9 --disable-static --enable-shared --disable-debug --disable-sdl --disable-libxcb --disable-securetransport --disable-iconv --disable-swresample --disable-swscale --disable-avdevice --disable-avfilter --disable-avformat --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vda --disable-vdpau --disable-videotoolbox --enable-asm --enable-yasm --toolchain=msvc"
+#define FFMPEG_CONFIGURATION "--disable-everything --disable-protocols --disable-demuxers --disable-muxers --disable-filters --disable-programs --disable-doc --disable-parsers --enable-parser=vp8 --enable-parser=vp9 --enable-decoder=vp8 --enable-decoder=vp9 --disable-static --enable-shared --disable-debug --disable-sdl2 --disable-libxcb --disable-securetransport --disable-iconv --disable-swresample --disable-swscale --disable-avdevice --disable-avfilter --disable-avformat --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vdpau --disable-videotoolbox --enable-decoder=flac --enable-asm --enable-x86asm --toolchain=msvc"
#define FFMPEG_LICENSE "LGPL version 2.1 or later"
-#define CONFIG_THIS_YEAR 2016
+#define CONFIG_THIS_YEAR 2017
#define FFMPEG_DATADIR "/usr/local/share/ffmpeg"
#define AVCONV_DATADIR "/usr/local/share/ffmpeg"
-#define CC_IDENT "Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x86"
+#define CC_IDENT "Microsoft (R) C/C++ Optimizing Compiler Version 19.11.25508.2 for x86"
#define av_restrict __restrict
#define EXTERN_PREFIX "_"
#define EXTERN_ASM _
@@ -79,8 +79,8 @@
#define HAVE_MIPSDSP 0
#define HAVE_MIPSDSPR2 0
#define HAVE_MSA 0
-#define HAVE_LOONGSON2 1
-#define HAVE_LOONGSON3 1
+#define HAVE_LOONGSON2 0
+#define HAVE_LOONGSON3 0
#define HAVE_MMI 0
#define HAVE_ARMV5TE_EXTERNAL 0
#define HAVE_ARMV6_EXTERNAL 0
@@ -172,37 +172,38 @@
#define HAVE_MMI_INLINE 0
#define HAVE_ALIGNED_STACK 0
#define HAVE_FAST_64BIT 0
-#define HAVE_FAST_CLZ 1
+#define HAVE_FAST_CLZ 0
#define HAVE_FAST_CMOV 0
#define HAVE_LOCAL_ALIGNED_8 1
#define HAVE_LOCAL_ALIGNED_16 1
#define HAVE_LOCAL_ALIGNED_32 1
#define HAVE_SIMD_ALIGN_16 1
+#define HAVE_SIMD_ALIGN_32 1
#define HAVE_ATOMICS_GCC 0
#define HAVE_ATOMICS_SUNCC 0
#define HAVE_ATOMICS_WIN32 1
#define HAVE_ATOMIC_CAS_PTR 0
-#define HAVE_ATOMIC_COMPARE_EXCHANGE 0
#define HAVE_MACHINE_RW_BARRIER 0
#define HAVE_MEMORYBARRIER 1
#define HAVE_MM_EMPTY 1
#define HAVE_RDTSC 1
#define HAVE_SARESTART 0
-#define HAVE_SEM_TIMEDWAIT 1
+#define HAVE_SEM_TIMEDWAIT 0
#define HAVE_SYNC_VAL_COMPARE_AND_SWAP 0
#define HAVE_CABS 0
#define HAVE_CEXP 0
#define HAVE_INLINE_ASM 0
#define HAVE_SYMVER 0
-#define HAVE_YASM 1
+#define HAVE_X86ASM 1
#define HAVE_BIGENDIAN 0
#define HAVE_FAST_UNALIGNED 1
-#define HAVE_ALSA_ASOUNDLIB_H 0
#define HAVE_ALTIVEC_H 0
#define HAVE_ARPA_INET_H 0
#define HAVE_ASM_TYPES_H 0
#define HAVE_CDIO_PARANOIA_H 0
#define HAVE_CDIO_PARANOIA_PARANOIA_H 0
+#define HAVE_CUDA_H 0
+#define HAVE_D3D11_H 1
#define HAVE_DISPATCH_DISPATCH_H 0
#define HAVE_DEV_BKTR_IOCTL_BT848_H 0
#define HAVE_DEV_BKTR_IOCTL_METEOR_H 0
@@ -212,7 +213,7 @@
#define HAVE_DIRECT_H 1
#define HAVE_DIRENT_H 0
#define HAVE_DLFCN_H 0
-#define HAVE_D3D11_H 1
+#define HAVE_DXGIDEBUG_H 1
#define HAVE_DXVA_H 1
#define HAVE_ES2_GL_H 0
#define HAVE_GSM_H 0
@@ -221,13 +222,15 @@
#define HAVE_MACHINE_IOCTL_BT848_H 0
#define HAVE_MACHINE_IOCTL_METEOR_H 0
#define HAVE_OPENCV2_CORE_CORE_C_H 0
+#define HAVE_OPENJPEG_2_3_OPENJPEG_H 0
+#define HAVE_OPENJPEG_2_2_OPENJPEG_H 0
#define HAVE_OPENJPEG_2_1_OPENJPEG_H 0
#define HAVE_OPENJPEG_2_0_OPENJPEG_H 0
#define HAVE_OPENJPEG_1_5_OPENJPEG_H 0
#define HAVE_OPENGL_GL3_H 0
#define HAVE_POLL_H 0
-#define HAVE_SNDIO_H 0
#define HAVE_SOUNDCARD_H 0
+#define HAVE_STDATOMIC_H 0
#define HAVE_SYS_MMAN_H 0
#define HAVE_SYS_PARAM_H 0
#define HAVE_SYS_RESOURCE_H 0
@@ -279,7 +282,6 @@
#define HAVE_COMMANDLINETOARGVW 1
#define HAVE_COTASKMEMFREE 1
#define HAVE_CRYPTGENRANDOM 1
-#define HAVE_DLOPEN 0
#define HAVE_FCNTL 0
#define HAVE_FLT_LIM 1
#define HAVE_FORK 0
@@ -299,7 +301,7 @@
#define HAVE_ISATTY 1
#define HAVE_JACK_PORT_GET_LATENCY_RANGE 0
#define HAVE_KBHIT 1
-#define HAVE_LOADLIBRARY 0
+#define HAVE_LOADLIBRARY 1
#define HAVE_LSTAT 0
#define HAVE_LZO1X_999_COMPRESS 0
#define HAVE_MACH_ABSOLUTE_TIME 0
@@ -318,6 +320,7 @@
#define HAVE_SLEEP 1
#define HAVE_STRERROR_R 0
#define HAVE_SYSCONF 0
+#define HAVE_SYSCTL 0
#define HAVE_USLEEP 0
#define HAVE_UTGETOSTYPEFROMSTRING 0
#define HAVE_VIRTUALALLOC 1
@@ -326,11 +329,13 @@
#define HAVE_OS2THREADS 0
#define HAVE_W32THREADS 1
#define HAVE_AS_DN_DIRECTIVE 0
+#define HAVE_AS_FPU_DIRECTIVE 0
#define HAVE_AS_FUNC 0
#define HAVE_AS_OBJECT_ARCH 0
#define HAVE_ASM_MOD_Q 0
#define HAVE_ATTRIBUTE_MAY_ALIAS 0
#define HAVE_ATTRIBUTE_PACKED 0
+#define HAVE_BLOCKS_EXTENSION 0
#define HAVE_EBP_AVAILABLE 0
#define HAVE_EBX_AVAILABLE 0
#define HAVE_GNU_AS 0
@@ -347,12 +352,13 @@
#define HAVE_XFORM_ASM 0
#define HAVE_XMM_CLOBBERS 0
#define HAVE_CONDITION_VARIABLE_PTR 1
+#define HAVE_KCMVIDEOCODECTYPE_HEVC 0
#define HAVE_SOCKLEN_T 1
#define HAVE_STRUCT_ADDRINFO 1
#define HAVE_STRUCT_GROUP_SOURCE_REQ 1
#define HAVE_STRUCT_IP_MREQ_SOURCE 1
#define HAVE_STRUCT_IPV6_MREQ 1
-#define HAVE_STRUCT_MSGHDR_MSG_FLAGS 1
+#define HAVE_STRUCT_MSGHDR_MSG_FLAGS 0
#define HAVE_STRUCT_POLLFD 0
#define HAVE_STRUCT_RUSAGE_RU_MAXRSS 0
#define HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE 0
@@ -363,36 +369,20 @@
#define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 0
#define HAVE_ATOMICS_NATIVE 1
#define HAVE_DOS_PATHS 1
-#define HAVE_DXVA2_LIB 0
-#define HAVE_DXVA2API_COBJ 1
#define HAVE_LIBC_MSVCRT 1
-#define HAVE_LIBDC1394_1 0
-#define HAVE_LIBDC1394_2 0
#define HAVE_MAKEINFO 1
#define HAVE_MAKEINFO_HTML 0
#define HAVE_MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS 0
#define HAVE_PERL 1
#define HAVE_POD2MAN 1
-#define HAVE_SDL2 0
#define HAVE_SECTION_DATA_REL_RO 0
#define HAVE_TEXI2HTML 0
#define HAVE_THREADS 1
+#define HAVE_UWP 0
#define HAVE_VAAPI_DRM 0
#define HAVE_VAAPI_X11 0
#define HAVE_VDPAU_X11 0
#define HAVE_WINRT 0
-#define HAVE_XLIB 0
-#define CONFIG_BSFS 0
-#define CONFIG_DECODERS 1
-#define CONFIG_ENCODERS 0
-#define CONFIG_HWACCELS 0
-#define CONFIG_PARSERS 1
-#define CONFIG_INDEVS 0
-#define CONFIG_OUTDEVS 0
-#define CONFIG_FILTERS 0
-#define CONFIG_DEMUXERS 0
-#define CONFIG_MUXERS 0
-#define CONFIG_PROTOCOLS 0
#define CONFIG_DOC 0
#define CONFIG_HTMLPAGES 0
#define CONFIG_MANPAGES 1
@@ -400,13 +390,17 @@
#define CONFIG_TXTPAGES 1
#define CONFIG_AVIO_DIR_CMD_EXAMPLE 1
#define CONFIG_AVIO_READING_EXAMPLE 1
-#define CONFIG_DECODING_ENCODING_EXAMPLE 0
+#define CONFIG_DECODE_AUDIO_EXAMPLE 1
+#define CONFIG_DECODE_VIDEO_EXAMPLE 1
#define CONFIG_DEMUXING_DECODING_EXAMPLE 0
+#define CONFIG_ENCODE_AUDIO_EXAMPLE 1
+#define CONFIG_ENCODE_VIDEO_EXAMPLE 1
#define CONFIG_EXTRACT_MVS_EXAMPLE 0
#define CONFIG_FILTER_AUDIO_EXAMPLE 0
#define CONFIG_FILTERING_AUDIO_EXAMPLE 0
#define CONFIG_FILTERING_VIDEO_EXAMPLE 0
#define CONFIG_HTTP_MULTICLIENT_EXAMPLE 0
+#define CONFIG_HW_DECODE_EXAMPLE 0
#define CONFIG_METADATA_EXAMPLE 0
#define CONFIG_MUXING_EXAMPLE 0
#define CONFIG_QSVDEC_EXAMPLE 0
@@ -415,27 +409,55 @@
#define CONFIG_SCALING_VIDEO_EXAMPLE 0
#define CONFIG_TRANSCODE_AAC_EXAMPLE 0
#define CONFIG_TRANSCODING_EXAMPLE 0
-#define CONFIG_AVISYNTH 0
+#define CONFIG_ALSA 0
+#define CONFIG_APPKIT 0
+#define CONFIG_AVFOUNDATION 0
#define CONFIG_BZLIB 0
-#define CONFIG_CHROMAPRINT 0
-#define CONFIG_CRYSTALHD 0
-#define CONFIG_DECKLINK 0
+#define CONFIG_COREIMAGE 0
+#define CONFIG_ICONV 0
+#define CONFIG_JACK 0
+#define CONFIG_LIBXCB 0
+#define CONFIG_LIBXCB_SHM 0
+#define CONFIG_LIBXCB_SHAPE 0
+#define CONFIG_LIBXCB_XFIXES 0
+#define CONFIG_LZMA 0
+#define CONFIG_SCHANNEL 1
+#define CONFIG_SDL2 0
+#define CONFIG_SECURETRANSPORT 0
+#define CONFIG_SNDIO 0
+#define CONFIG_XLIB 1
+#define CONFIG_ZLIB 0
+#define CONFIG_AVISYNTH 0
#define CONFIG_FREI0R 0
-#define CONFIG_GCRYPT 0
+#define CONFIG_LIBCDIO 0
+#define CONFIG_LIBRUBBERBAND 0
+#define CONFIG_LIBVIDSTAB 0
+#define CONFIG_LIBX264 0
+#define CONFIG_LIBX265 0
+#define CONFIG_LIBXAVS 0
+#define CONFIG_LIBXVID 0
+#define CONFIG_DECKLINK 0
+#define CONFIG_LIBNDI_NEWTEK 0
+#define CONFIG_LIBFDK_AAC 0
+#define CONFIG_OPENSSL 0
#define CONFIG_GMP 0
+#define CONFIG_LIBOPENCORE_AMRNB 0
+#define CONFIG_LIBOPENCORE_AMRWB 0
+#define CONFIG_LIBVO_AMRWBENC 0
+#define CONFIG_RKMPP 0
+#define CONFIG_LIBSMBCLIENT 0
+#define CONFIG_CHROMAPRINT 0
+#define CONFIG_GCRYPT 0
#define CONFIG_GNUTLS 0
-#define CONFIG_ICONV 0
#define CONFIG_JNI 0
#define CONFIG_LADSPA 0
#define CONFIG_LIBASS 0
#define CONFIG_LIBBLURAY 0
#define CONFIG_LIBBS2B 0
#define CONFIG_LIBCACA 0
-#define CONFIG_LIBCDIO 0
#define CONFIG_LIBCELT 0
#define CONFIG_LIBDC1394 0
-#define CONFIG_LIBEBUR128 0
-#define CONFIG_LIBFDK_AAC 0
+#define CONFIG_LIBDRM 0
#define CONFIG_LIBFLITE 0
#define CONFIG_LIBFONTCONFIG 0
#define CONFIG_LIBFREETYPE 0
@@ -447,18 +469,15 @@
#define CONFIG_LIBKVAZAAR 0
#define CONFIG_LIBMODPLUG 0
#define CONFIG_LIBMP3LAME 0
-#define CONFIG_LIBNUT 0
-#define CONFIG_LIBOPENCORE_AMRNB 0
-#define CONFIG_LIBOPENCORE_AMRWB 0
+#define CONFIG_LIBMYSOFA 0
#define CONFIG_LIBOPENCV 0
#define CONFIG_LIBOPENH264 0
#define CONFIG_LIBOPENJPEG 0
#define CONFIG_LIBOPENMPT 0
#define CONFIG_LIBOPUS 0
#define CONFIG_LIBPULSE 0
+#define CONFIG_LIBRSVG 0
#define CONFIG_LIBRTMP 0
-#define CONFIG_LIBRUBBERBAND 0
-#define CONFIG_LIBSCHROEDINGER 0
#define CONFIG_LIBSHINE 0
#define CONFIG_LIBSMBCLIENT 0
#define CONFIG_LIBSNAPPY 0
@@ -469,53 +488,37 @@
#define CONFIG_LIBTHEORA 0
#define CONFIG_LIBTWOLAME 0
#define CONFIG_LIBV4L2 0
-#define CONFIG_LIBVIDSTAB 0
-#define CONFIG_LIBVO_AMRWBENC 0
+#define CONFIG_LIBVMAF 0
#define CONFIG_LIBVORBIS 0
#define CONFIG_LIBVPX 0
#define CONFIG_LIBWAVPACK 0
#define CONFIG_LIBWEBP 0
-#define CONFIG_LIBX264 0
-#define CONFIG_LIBX265 0
-#define CONFIG_LIBXAVS 0
-#define CONFIG_LIBXCB 0
-#define CONFIG_LIBXCB_SHM 0
-#define CONFIG_LIBXCB_SHAPE 0
-#define CONFIG_LIBXCB_XFIXES 0
-#define CONFIG_LIBXVID 0
+#define CONFIG_LIBXML2 0
#define CONFIG_LIBZIMG 0
#define CONFIG_LIBZMQ 0
#define CONFIG_LIBZVBI 0
-#define CONFIG_LZMA 0
#define CONFIG_MEDIACODEC 0
-#define CONFIG_NETCDF 0
#define CONFIG_OPENAL 0
#define CONFIG_OPENCL 0
#define CONFIG_OPENGL 0
-#define CONFIG_OPENSSL 0
-#define CONFIG_SCHANNEL 1
-#define CONFIG_SDL 0
-#define CONFIG_SDL2 0
-#define CONFIG_SECURETRANSPORT 0
-#define CONFIG_VIDEOTOOLBOX 0
-#define CONFIG_X11GRAB 0
-#define CONFIG_XLIB 0
-#define CONFIG_ZLIB 0
#define CONFIG_AUDIOTOOLBOX 0
-#define CONFIG_CUDA 0
-#define CONFIG_CUVID 0
+#define CONFIG_CRYSTALHD 0
+#define CONFIG_CUDA 1
+#define CONFIG_CUVID 1
#define CONFIG_D3D11VA 0
#define CONFIG_DXVA2 0
-#define CONFIG_LIBMFX 0
-#define CONFIG_LIBNPP 0
-#define CONFIG_MMAL 0
-#define CONFIG_NVENC 0
-#define CONFIG_OMX 0
+#define CONFIG_NVENC 1
#define CONFIG_VAAPI 0
#define CONFIG_VDA 0
#define CONFIG_VDPAU 0
-#define CONFIG_VIDEOTOOLBOX_HWACCEL 0
+#define CONFIG_VIDEOTOOLBOX 0
+#define CONFIG_V4L2_M2M 0
#define CONFIG_XVMC 0
+#define CONFIG_CUDA_SDK 0
+#define CONFIG_LIBNPP 0
+#define CONFIG_LIBMFX 0
+#define CONFIG_MMAL 0
+#define CONFIG_OMX 0
#define CONFIG_FTRAPV 0
#define CONFIG_GRAY 0
#define CONFIG_HARDCODED_TABLES 0
@@ -554,16 +557,27 @@
#define CONFIG_PIXELUTILS 0
#define CONFIG_NETWORK 0
#define CONFIG_RDFT 0
+#define CONFIG_AUTODETECT 0
#define CONFIG_FONTCONFIG 0
-#define CONFIG_MEMALIGN_HACK 0
+#define CONFIG_LINUX_PERF 0
#define CONFIG_MEMORY_POISONING 0
#define CONFIG_NEON_CLOBBER_TEST 0
+#define CONFIG_OSSFUZZ 0
#define CONFIG_PIC 0
-#define CONFIG_POD2MAN 1
-#define CONFIG_RAISE_MAJOR 0
#define CONFIG_THUMB 0
#define CONFIG_VALGRIND_BACKTRACE 0
#define CONFIG_XMM_CLOBBER_TEST 0
+#define CONFIG_BSFS 1
+#define CONFIG_DECODERS 1
+#define CONFIG_ENCODERS 0
+#define CONFIG_HWACCELS 0
+#define CONFIG_PARSERS 1
+#define CONFIG_INDEVS 0
+#define CONFIG_OUTDEVS 0
+#define CONFIG_FILTERS 0
+#define CONFIG_DEMUXERS 0
+#define CONFIG_MUXERS 0
+#define CONFIG_PROTOCOLS 0
#define CONFIG_AANDCTTABLES 0
#define CONFIG_AC3DSP 0
#define CONFIG_AUDIO_FRAME_QUEUE 0
@@ -581,20 +595,22 @@
#define CONFIG_FMTCONVERT 0
#define CONFIG_FRAME_THREAD_ENCODER 0
#define CONFIG_G722DSP 0
-#define CONFIG_GOLOMB 1
+#define CONFIG_GOLOMB 0
#define CONFIG_GPLV3 0
#define CONFIG_H263DSP 0
#define CONFIG_H264CHROMA 0
#define CONFIG_H264DSP 0
+#define CONFIG_H264PARSE 0
#define CONFIG_H264PRED 1
#define CONFIG_H264QPEL 0
+#define CONFIG_HEVCPARSE 0
#define CONFIG_HPELDSP 0
#define CONFIG_HUFFMAN 0
#define CONFIG_HUFFYUVDSP 0
#define CONFIG_HUFFYUVENCDSP 0
#define CONFIG_IDCTDSP 0
#define CONFIG_IIRFILTER 0
-#define CONFIG_IMDCT15 0
+#define CONFIG_MDCT15 0
#define CONFIG_INTRAX8 0
#define CONFIG_ISO_MEDIA 0
#define CONFIG_IVIDSP 0
@@ -603,12 +619,14 @@
#define CONFIG_LIBX262 0
#define CONFIG_LLAUDDSP 0
#define CONFIG_LLVIDDSP 0
+#define CONFIG_LLVIDENCDSP 0
#define CONFIG_LPC 0
#define CONFIG_LZF 0
#define CONFIG_ME_CMP 0
#define CONFIG_MPEG_ER 0
#define CONFIG_MPEGAUDIO 0
#define CONFIG_MPEGAUDIODSP 0
+#define CONFIG_MPEGAUDIOHEADER 0
#define CONFIG_MPEGVIDEO 0
#define CONFIG_MPEGVIDEOENC 0
#define CONFIG_MSS34DSP 0
@@ -630,1595 +648,20 @@
#define CONFIG_TEXTUREDSP 0
#define CONFIG_TEXTUREDSPENC 0
#define CONFIG_TPELDSP 0
+#define CONFIG_VAAPI_1 0
#define CONFIG_VAAPI_ENCODE 0
#define CONFIG_VC1DSP 0
#define CONFIG_VIDEODSP 1
#define CONFIG_VP3DSP 0
#define CONFIG_VP56DSP 0
#define CONFIG_VP8DSP 1
-#define CONFIG_VT_BT2020 0
#define CONFIG_WMA_FREQS 0
#define CONFIG_WMV2DSP 0
-#define CONFIG_AAC_ADTSTOASC_BSF 0
-#define CONFIG_CHOMP_BSF 0
-#define CONFIG_DUMP_EXTRADATA_BSF 0
-#define CONFIG_DCA_CORE_BSF 0
-#define CONFIG_H264_MP4TOANNEXB_BSF 0
-#define CONFIG_HEVC_MP4TOANNEXB_BSF 0
-#define CONFIG_IMX_DUMP_HEADER_BSF 0
-#define CONFIG_MJPEG2JPEG_BSF 0
-#define CONFIG_MJPEGA_DUMP_HEADER_BSF 0
-#define CONFIG_MP3_HEADER_DECOMPRESS_BSF 0
-#define CONFIG_MPEG4_UNPACK_BFRAMES_BSF 0
-#define CONFIG_MOV2TEXTSUB_BSF 0
-#define CONFIG_NOISE_BSF 0
-#define CONFIG_REMOVE_EXTRADATA_BSF 0
-#define CONFIG_TEXT2MOVSUB_BSF 0
-#define CONFIG_VP9_SUPERFRAME_BSF 0
-#define CONFIG_AASC_DECODER 0
-#define CONFIG_AIC_DECODER 0
-#define CONFIG_ALIAS_PIX_DECODER 0
-#define CONFIG_AMV_DECODER 0
-#define CONFIG_ANM_DECODER 0
-#define CONFIG_ANSI_DECODER 0
-#define CONFIG_APNG_DECODER 0
-#define CONFIG_ASV1_DECODER 0
-#define CONFIG_ASV2_DECODER 0
-#define CONFIG_AURA_DECODER 0
-#define CONFIG_AURA2_DECODER 0
-#define CONFIG_AVRP_DECODER 0
-#define CONFIG_AVRN_DECODER 0
-#define CONFIG_AVS_DECODER 0
-#define CONFIG_AVUI_DECODER 0
-#define CONFIG_AYUV_DECODER 0
-#define CONFIG_BETHSOFTVID_DECODER 0
-#define CONFIG_BFI_DECODER 0
-#define CONFIG_BINK_DECODER 0
-#define CONFIG_BMP_DECODER 0
-#define CONFIG_BMV_VIDEO_DECODER 0
-#define CONFIG_BRENDER_PIX_DECODER 0
-#define CONFIG_C93_DECODER 0
-#define CONFIG_CAVS_DECODER 0
-#define CONFIG_CDGRAPHICS_DECODER 0
-#define CONFIG_CDXL_DECODER 0
-#define CONFIG_CFHD_DECODER 0
-#define CONFIG_CINEPAK_DECODER 0
-#define CONFIG_CLJR_DECODER 0
-#define CONFIG_CLLC_DECODER 0
-#define CONFIG_COMFORTNOISE_DECODER 0
-#define CONFIG_CPIA_DECODER 0
-#define CONFIG_CSCD_DECODER 0
-#define CONFIG_CYUV_DECODER 0
-#define CONFIG_DDS_DECODER 0
-#define CONFIG_DFA_DECODER 0
-#define CONFIG_DIRAC_DECODER 0
-#define CONFIG_DNXHD_DECODER 0
-#define CONFIG_DPX_DECODER 0
-#define CONFIG_DSICINVIDEO_DECODER 0
-#define CONFIG_DVAUDIO_DECODER 0
-#define CONFIG_DVVIDEO_DECODER 0
-#define CONFIG_DXA_DECODER 0
-#define CONFIG_DXTORY_DECODER 0
-#define CONFIG_DXV_DECODER 0
-#define CONFIG_EACMV_DECODER 0
-#define CONFIG_EAMAD_DECODER 0
-#define CONFIG_EATGQ_DECODER 0
-#define CONFIG_EATGV_DECODER 0
-#define CONFIG_EATQI_DECODER 0
-#define CONFIG_EIGHTBPS_DECODER 0
-#define CONFIG_EIGHTSVX_EXP_DECODER 0
-#define CONFIG_EIGHTSVX_FIB_DECODER 0
-#define CONFIG_ESCAPE124_DECODER 0
-#define CONFIG_ESCAPE130_DECODER 0
-#define CONFIG_EXR_DECODER 0
-#define CONFIG_FFV1_DECODER 0
-#define CONFIG_FFVHUFF_DECODER 0
-#define CONFIG_FIC_DECODER 0
-#define CONFIG_FLASHSV_DECODER 0
-#define CONFIG_FLASHSV2_DECODER 0
-#define CONFIG_FLIC_DECODER 0
-#define CONFIG_FLV_DECODER 0
-#define CONFIG_FOURXM_DECODER 0
-#define CONFIG_FRAPS_DECODER 0
-#define CONFIG_FRWU_DECODER 0
-#define CONFIG_G2M_DECODER 0
-#define CONFIG_GIF_DECODER 0
-#define CONFIG_H261_DECODER 0
-#define CONFIG_H263_DECODER 0
-#define CONFIG_H263I_DECODER 0
-#define CONFIG_H263P_DECODER 0
-#define CONFIG_H264_DECODER 0
-#define CONFIG_H264_CRYSTALHD_DECODER 0
-#define CONFIG_H264_MEDIACODEC_DECODER 0
-#define CONFIG_H264_MMAL_DECODER 0
-#define CONFIG_H264_QSV_DECODER 0
-#define CONFIG_H264_VDA_DECODER 0
-#define CONFIG_H264_VDPAU_DECODER 0
-#define CONFIG_HAP_DECODER 0
-#define CONFIG_HEVC_DECODER 0
-#define CONFIG_HEVC_QSV_DECODER 0
-#define CONFIG_HNM4_VIDEO_DECODER 0
-#define CONFIG_HQ_HQA_DECODER 0
-#define CONFIG_HQX_DECODER 0
-#define CONFIG_HUFFYUV_DECODER 0
-#define CONFIG_IDCIN_DECODER 0
-#define CONFIG_IFF_ILBM_DECODER 0
-#define CONFIG_INDEO2_DECODER 0
-#define CONFIG_INDEO3_DECODER 0
-#define CONFIG_INDEO4_DECODER 0
-#define CONFIG_INDEO5_DECODER 0
-#define CONFIG_INTERPLAY_VIDEO_DECODER 0
-#define CONFIG_JPEG2000_DECODER 0
-#define CONFIG_JPEGLS_DECODER 0
-#define CONFIG_JV_DECODER 0
-#define CONFIG_KGV1_DECODER 0
-#define CONFIG_KMVC_DECODER 0
-#define CONFIG_LAGARITH_DECODER 0
-#define CONFIG_LOCO_DECODER 0
-#define CONFIG_M101_DECODER 0
-#define CONFIG_MAGICYUV_DECODER 0
-#define CONFIG_MDEC_DECODER 0
-#define CONFIG_MIMIC_DECODER 0
-#define CONFIG_MJPEG_DECODER 0
-#define CONFIG_MJPEGB_DECODER 0
-#define CONFIG_MMVIDEO_DECODER 0
-#define CONFIG_MOTIONPIXELS_DECODER 0
-#define CONFIG_MPEG_XVMC_DECODER 0
-#define CONFIG_MPEG1VIDEO_DECODER 0
-#define CONFIG_MPEG2VIDEO_DECODER 0
-#define CONFIG_MPEG4_DECODER 0
-#define CONFIG_MPEG4_CRYSTALHD_DECODER 0
-#define CONFIG_MPEG4_MMAL_DECODER 0
-#define CONFIG_MPEG4_VDPAU_DECODER 0
-#define CONFIG_MPEGVIDEO_DECODER 0
-#define CONFIG_MPEG_VDPAU_DECODER 0
-#define CONFIG_MPEG1_VDPAU_DECODER 0
-#define CONFIG_MPEG2_MMAL_DECODER 0
-#define CONFIG_MPEG2_CRYSTALHD_DECODER 0
-#define CONFIG_MPEG2_QSV_DECODER 0
-#define CONFIG_MSA1_DECODER 0
-#define CONFIG_MSMPEG4_CRYSTALHD_DECODER 0
-#define CONFIG_MSMPEG4V1_DECODER 0
-#define CONFIG_MSMPEG4V2_DECODER 0
-#define CONFIG_MSMPEG4V3_DECODER 0
-#define CONFIG_MSRLE_DECODER 0
-#define CONFIG_MSS1_DECODER 0
-#define CONFIG_MSS2_DECODER 0
-#define CONFIG_MSVIDEO1_DECODER 0
-#define CONFIG_MSZH_DECODER 0
-#define CONFIG_MTS2_DECODER 0
-#define CONFIG_MVC1_DECODER 0
-#define CONFIG_MVC2_DECODER 0
-#define CONFIG_MXPEG_DECODER 0
-#define CONFIG_NUV_DECODER 0
-#define CONFIG_PAF_VIDEO_DECODER 0
-#define CONFIG_PAM_DECODER 0
-#define CONFIG_PBM_DECODER 0
-#define CONFIG_PCX_DECODER 0
-#define CONFIG_PGM_DECODER 0
-#define CONFIG_PGMYUV_DECODER 0
-#define CONFIG_PICTOR_DECODER 0
-#define CONFIG_PNG_DECODER 0
-#define CONFIG_PPM_DECODER 0
-#define CONFIG_PRORES_DECODER 0
-#define CONFIG_PRORES_LGPL_DECODER 0
-#define CONFIG_PTX_DECODER 0
-#define CONFIG_QDRAW_DECODER 0
-#define CONFIG_QPEG_DECODER 0
-#define CONFIG_QTRLE_DECODER 0
-#define CONFIG_R10K_DECODER 0
-#define CONFIG_R210_DECODER 0
-#define CONFIG_RAWVIDEO_DECODER 0
-#define CONFIG_RL2_DECODER 0
-#define CONFIG_ROQ_DECODER 0
-#define CONFIG_RPZA_DECODER 0
-#define CONFIG_RSCC_DECODER 0
-#define CONFIG_RV10_DECODER 0
-#define CONFIG_RV20_DECODER 0
-#define CONFIG_RV30_DECODER 0
-#define CONFIG_RV40_DECODER 0
-#define CONFIG_S302M_DECODER 0
-#define CONFIG_SANM_DECODER 0
-#define CONFIG_SCREENPRESSO_DECODER 0
-#define CONFIG_SDX2_DPCM_DECODER 0
-#define CONFIG_SGI_DECODER 0
-#define CONFIG_SGIRLE_DECODER 0
-#define CONFIG_SHEERVIDEO_DECODER 0
-#define CONFIG_SMACKER_DECODER 0
-#define CONFIG_SMC_DECODER 0
-#define CONFIG_SMVJPEG_DECODER 0
-#define CONFIG_SNOW_DECODER 0
-#define CONFIG_SP5X_DECODER 0
-#define CONFIG_SUNRAST_DECODER 0
-#define CONFIG_SVQ1_DECODER 0
-#define CONFIG_SVQ3_DECODER 0
-#define CONFIG_TARGA_DECODER 0
-#define CONFIG_TARGA_Y216_DECODER 0
-#define CONFIG_TDSC_DECODER 0
-#define CONFIG_THEORA_DECODER 0
-#define CONFIG_THP_DECODER 0
-#define CONFIG_TIERTEXSEQVIDEO_DECODER 0
-#define CONFIG_TIFF_DECODER 0
-#define CONFIG_TMV_DECODER 0
-#define CONFIG_TRUEMOTION1_DECODER 0
-#define CONFIG_TRUEMOTION2_DECODER 0
-#define CONFIG_TRUEMOTION2RT_DECODER 0
-#define CONFIG_TSCC_DECODER 0
-#define CONFIG_TSCC2_DECODER 0
-#define CONFIG_TXD_DECODER 0
-#define CONFIG_ULTI_DECODER 0
-#define CONFIG_UTVIDEO_DECODER 0
-#define CONFIG_V210_DECODER 0
-#define CONFIG_V210X_DECODER 0
-#define CONFIG_V308_DECODER 0
-#define CONFIG_V408_DECODER 0
-#define CONFIG_V410_DECODER 0
-#define CONFIG_VB_DECODER 0
-#define CONFIG_VBLE_DECODER 0
-#define CONFIG_VC1_DECODER 0
-#define CONFIG_VC1_CRYSTALHD_DECODER 0
-#define CONFIG_VC1_VDPAU_DECODER 0
-#define CONFIG_VC1IMAGE_DECODER 0
-#define CONFIG_VC1_MMAL_DECODER 0
-#define CONFIG_VC1_QSV_DECODER 0
-#define CONFIG_VCR1_DECODER 0
-#define CONFIG_VMDVIDEO_DECODER 0
-#define CONFIG_VMNC_DECODER 0
-#define CONFIG_VP3_DECODER 0
-#define CONFIG_VP5_DECODER 0
-#define CONFIG_VP6_DECODER 0
-#define CONFIG_VP6A_DECODER 0
-#define CONFIG_VP6F_DECODER 0
-#define CONFIG_VP7_DECODER 0
+#define CONFIG_NULL_BSF 1
#define CONFIG_VP8_DECODER 1
#define CONFIG_VP9_DECODER 1
-#define CONFIG_VQA_DECODER 0
-#define CONFIG_WEBP_DECODER 0
-#define CONFIG_WMV1_DECODER 0
-#define CONFIG_WMV2_DECODER 0
-#define CONFIG_WMV3_DECODER 0
-#define CONFIG_WMV3_CRYSTALHD_DECODER 0
-#define CONFIG_WMV3_VDPAU_DECODER 0
-#define CONFIG_WMV3IMAGE_DECODER 0
-#define CONFIG_WNV1_DECODER 0
-#define CONFIG_XAN_WC3_DECODER 0
-#define CONFIG_XAN_WC4_DECODER 0
-#define CONFIG_XBM_DECODER 0
-#define CONFIG_XFACE_DECODER 0
-#define CONFIG_XL_DECODER 0
-#define CONFIG_XWD_DECODER 0
-#define CONFIG_Y41P_DECODER 0
-#define CONFIG_YLC_DECODER 0
-#define CONFIG_YOP_DECODER 0
-#define CONFIG_YUV4_DECODER 0
-#define CONFIG_ZERO12V_DECODER 0
-#define CONFIG_ZEROCODEC_DECODER 0
-#define CONFIG_ZLIB_DECODER 0
-#define CONFIG_ZMBV_DECODER 0
-#define CONFIG_AAC_DECODER 0
-#define CONFIG_AAC_FIXED_DECODER 0
-#define CONFIG_AAC_LATM_DECODER 0
-#define CONFIG_AC3_DECODER 0
-#define CONFIG_AC3_FIXED_DECODER 0
-#define CONFIG_ALAC_DECODER 0
-#define CONFIG_ALS_DECODER 0
-#define CONFIG_AMRNB_DECODER 0
-#define CONFIG_AMRWB_DECODER 0
-#define CONFIG_APE_DECODER 0
-#define CONFIG_ATRAC1_DECODER 0
-#define CONFIG_ATRAC3_DECODER 0
-#define CONFIG_ATRAC3P_DECODER 0
-#define CONFIG_BINKAUDIO_DCT_DECODER 0
-#define CONFIG_BINKAUDIO_RDFT_DECODER 0
-#define CONFIG_BMV_AUDIO_DECODER 0
-#define CONFIG_COOK_DECODER 0
-#define CONFIG_DCA_DECODER 0
-#define CONFIG_DSD_LSBF_DECODER 0
-#define CONFIG_DSD_MSBF_DECODER 0
-#define CONFIG_DSD_LSBF_PLANAR_DECODER 0
-#define CONFIG_DSD_MSBF_PLANAR_DECODER 0
-#define CONFIG_DSICINAUDIO_DECODER 0
-#define CONFIG_DSS_SP_DECODER 0
-#define CONFIG_DST_DECODER 0
-#define CONFIG_EAC3_DECODER 0
-#define CONFIG_EVRC_DECODER 0
-#define CONFIG_FFWAVESYNTH_DECODER 0
#define CONFIG_FLAC_DECODER 1
-#define CONFIG_G723_1_DECODER 0
-#define CONFIG_G729_DECODER 0
-#define CONFIG_GSM_DECODER 0
-#define CONFIG_GSM_MS_DECODER 0
-#define CONFIG_IAC_DECODER 0
-#define CONFIG_IMC_DECODER 0
-#define CONFIG_INTERPLAY_ACM_DECODER 0
-#define CONFIG_MACE3_DECODER 0
-#define CONFIG_MACE6_DECODER 0
-#define CONFIG_METASOUND_DECODER 0
-#define CONFIG_MLP_DECODER 0
-#define CONFIG_MP1_DECODER 0
-#define CONFIG_MP1FLOAT_DECODER 0
-#define CONFIG_MP2_DECODER 0
-#define CONFIG_MP2FLOAT_DECODER 0
-#define CONFIG_MP3_DECODER 0
-#define CONFIG_MP3FLOAT_DECODER 0
-#define CONFIG_MP3ADU_DECODER 0
-#define CONFIG_MP3ADUFLOAT_DECODER 0
-#define CONFIG_MP3ON4_DECODER 0
-#define CONFIG_MP3ON4FLOAT_DECODER 0
-#define CONFIG_MPC7_DECODER 0
-#define CONFIG_MPC8_DECODER 0
-#define CONFIG_NELLYMOSER_DECODER 0
-#define CONFIG_ON2AVC_DECODER 0
-#define CONFIG_OPUS_DECODER 0
-#define CONFIG_PAF_AUDIO_DECODER 0
-#define CONFIG_QCELP_DECODER 0
-#define CONFIG_QDM2_DECODER 0
-#define CONFIG_RA_144_DECODER 0
-#define CONFIG_RA_288_DECODER 0
-#define CONFIG_RALF_DECODER 0
-#define CONFIG_SHORTEN_DECODER 0
-#define CONFIG_SIPR_DECODER 0
-#define CONFIG_SMACKAUD_DECODER 0
-#define CONFIG_SONIC_DECODER 0
-#define CONFIG_TAK_DECODER 0
-#define CONFIG_TRUEHD_DECODER 0
-#define CONFIG_TRUESPEECH_DECODER 0
-#define CONFIG_TTA_DECODER 0
-#define CONFIG_TWINVQ_DECODER 0
-#define CONFIG_VMDAUDIO_DECODER 0
-#define CONFIG_VORBIS_DECODER 0
-#define CONFIG_WAVPACK_DECODER 0
-#define CONFIG_WMALOSSLESS_DECODER 0
-#define CONFIG_WMAPRO_DECODER 0
-#define CONFIG_WMAV1_DECODER 0
-#define CONFIG_WMAV2_DECODER 0
-#define CONFIG_WMAVOICE_DECODER 0
-#define CONFIG_WS_SND1_DECODER 0
-#define CONFIG_XMA1_DECODER 0
-#define CONFIG_XMA2_DECODER 0
-#define CONFIG_PCM_ALAW_DECODER 0
-#define CONFIG_PCM_BLURAY_DECODER 0
-#define CONFIG_PCM_DVD_DECODER 0
-#define CONFIG_PCM_F32BE_DECODER 0
-#define CONFIG_PCM_F32LE_DECODER 0
-#define CONFIG_PCM_F64BE_DECODER 0
-#define CONFIG_PCM_F64LE_DECODER 0
-#define CONFIG_PCM_LXF_DECODER 0
-#define CONFIG_PCM_MULAW_DECODER 0
-#define CONFIG_PCM_S8_DECODER 0
-#define CONFIG_PCM_S8_PLANAR_DECODER 0
-#define CONFIG_PCM_S16BE_DECODER 0
-#define CONFIG_PCM_S16BE_PLANAR_DECODER 0
-#define CONFIG_PCM_S16LE_DECODER 0
-#define CONFIG_PCM_S16LE_PLANAR_DECODER 0
-#define CONFIG_PCM_S24BE_DECODER 0
-#define CONFIG_PCM_S24DAUD_DECODER 0
-#define CONFIG_PCM_S24LE_DECODER 0
-#define CONFIG_PCM_S24LE_PLANAR_DECODER 0
-#define CONFIG_PCM_S32BE_DECODER 0
-#define CONFIG_PCM_S32LE_DECODER 0
-#define CONFIG_PCM_S32LE_PLANAR_DECODER 0
-#define CONFIG_PCM_S64BE_DECODER 0
-#define CONFIG_PCM_S64LE_DECODER 0
-#define CONFIG_PCM_U8_DECODER 0
-#define CONFIG_PCM_U16BE_DECODER 0
-#define CONFIG_PCM_U16LE_DECODER 0
-#define CONFIG_PCM_U24BE_DECODER 0
-#define CONFIG_PCM_U24LE_DECODER 0
-#define CONFIG_PCM_U32BE_DECODER 0
-#define CONFIG_PCM_U32LE_DECODER 0
-#define CONFIG_PCM_ZORK_DECODER 0
-#define CONFIG_INTERPLAY_DPCM_DECODER 0
-#define CONFIG_ROQ_DPCM_DECODER 0
-#define CONFIG_SOL_DPCM_DECODER 0
-#define CONFIG_XAN_DPCM_DECODER 0
-#define CONFIG_ADPCM_4XM_DECODER 0
-#define CONFIG_ADPCM_ADX_DECODER 0
-#define CONFIG_ADPCM_AFC_DECODER 0
-#define CONFIG_ADPCM_AICA_DECODER 0
-#define CONFIG_ADPCM_CT_DECODER 0
-#define CONFIG_ADPCM_DTK_DECODER 0
-#define CONFIG_ADPCM_EA_DECODER 0
-#define CONFIG_ADPCM_EA_MAXIS_XA_DECODER 0
-#define CONFIG_ADPCM_EA_R1_DECODER 0
-#define CONFIG_ADPCM_EA_R2_DECODER 0
-#define CONFIG_ADPCM_EA_R3_DECODER 0
-#define CONFIG_ADPCM_EA_XAS_DECODER 0
-#define CONFIG_ADPCM_G722_DECODER 0
-#define CONFIG_ADPCM_G726_DECODER 0
-#define CONFIG_ADPCM_G726LE_DECODER 0
-#define CONFIG_ADPCM_IMA_AMV_DECODER 0
-#define CONFIG_ADPCM_IMA_APC_DECODER 0
-#define CONFIG_ADPCM_IMA_DAT4_DECODER 0
-#define CONFIG_ADPCM_IMA_DK3_DECODER 0
-#define CONFIG_ADPCM_IMA_DK4_DECODER 0
-#define CONFIG_ADPCM_IMA_EA_EACS_DECODER 0
-#define CONFIG_ADPCM_IMA_EA_SEAD_DECODER 0
-#define CONFIG_ADPCM_IMA_ISS_DECODER 0
-#define CONFIG_ADPCM_IMA_OKI_DECODER 0
-#define CONFIG_ADPCM_IMA_QT_DECODER 0
-#define CONFIG_ADPCM_IMA_RAD_DECODER 0
-#define CONFIG_ADPCM_IMA_SMJPEG_DECODER 0
-#define CONFIG_ADPCM_IMA_WAV_DECODER 0
-#define CONFIG_ADPCM_IMA_WS_DECODER 0
-#define CONFIG_ADPCM_MS_DECODER 0
-#define CONFIG_ADPCM_MTAF_DECODER 0
-#define CONFIG_ADPCM_PSX_DECODER 0
-#define CONFIG_ADPCM_SBPRO_2_DECODER 0
-#define CONFIG_ADPCM_SBPRO_3_DECODER 0
-#define CONFIG_ADPCM_SBPRO_4_DECODER 0
-#define CONFIG_ADPCM_SWF_DECODER 0
-#define CONFIG_ADPCM_THP_DECODER 0
-#define CONFIG_ADPCM_THP_LE_DECODER 0
-#define CONFIG_ADPCM_VIMA_DECODER 0
-#define CONFIG_ADPCM_XA_DECODER 0
-#define CONFIG_ADPCM_YAMAHA_DECODER 0
-#define CONFIG_SSA_DECODER 0
-#define CONFIG_ASS_DECODER 0
-#define CONFIG_CCAPTION_DECODER 0
-#define CONFIG_DVBSUB_DECODER 0
-#define CONFIG_DVDSUB_DECODER 0
-#define CONFIG_JACOSUB_DECODER 0
-#define CONFIG_MICRODVD_DECODER 0
-#define CONFIG_MOVTEXT_DECODER 0
-#define CONFIG_MPL2_DECODER 0
-#define CONFIG_PGSSUB_DECODER 0
-#define CONFIG_PJS_DECODER 0
-#define CONFIG_REALTEXT_DECODER 0
-#define CONFIG_SAMI_DECODER 0
-#define CONFIG_SRT_DECODER 0
-#define CONFIG_STL_DECODER 0
-#define CONFIG_SUBRIP_DECODER 0
-#define CONFIG_SUBVIEWER_DECODER 0
-#define CONFIG_SUBVIEWER1_DECODER 0
-#define CONFIG_TEXT_DECODER 0
-#define CONFIG_VPLAYER_DECODER 0
-#define CONFIG_WEBVTT_DECODER 0
-#define CONFIG_XSUB_DECODER 0
-#define CONFIG_AAC_AT_DECODER 0
-#define CONFIG_AC3_AT_DECODER 0
-#define CONFIG_ADPCM_IMA_QT_AT_DECODER 0
-#define CONFIG_ALAC_AT_DECODER 0
-#define CONFIG_AMR_NB_AT_DECODER 0
-#define CONFIG_EAC3_AT_DECODER 0
-#define CONFIG_GSM_MS_AT_DECODER 0
-#define CONFIG_ILBC_AT_DECODER 0
-#define CONFIG_MP1_AT_DECODER 0
-#define CONFIG_MP2_AT_DECODER 0
-#define CONFIG_MP3_AT_DECODER 0
-#define CONFIG_PCM_ALAW_AT_DECODER 0
-#define CONFIG_PCM_MULAW_AT_DECODER 0
-#define CONFIG_QDMC_AT_DECODER 0
-#define CONFIG_QDM2_AT_DECODER 0
-#define CONFIG_LIBCELT_DECODER 0
-#define CONFIG_LIBFDK_AAC_DECODER 0
-#define CONFIG_LIBGSM_DECODER 0
-#define CONFIG_LIBGSM_MS_DECODER 0
-#define CONFIG_LIBILBC_DECODER 0
-#define CONFIG_LIBOPENCORE_AMRNB_DECODER 0
-#define CONFIG_LIBOPENCORE_AMRWB_DECODER 0
-#define CONFIG_LIBOPENJPEG_DECODER 0
-#define CONFIG_LIBOPUS_DECODER 0
-#define CONFIG_LIBSCHROEDINGER_DECODER 0
-#define CONFIG_LIBSPEEX_DECODER 0
-#define CONFIG_LIBVORBIS_DECODER 0
-#define CONFIG_LIBVPX_VP8_DECODER 0
-#define CONFIG_LIBVPX_VP9_DECODER 0
-#define CONFIG_LIBZVBI_TELETEXT_DECODER 0
-#define CONFIG_BINTEXT_DECODER 0
-#define CONFIG_XBIN_DECODER 0
-#define CONFIG_IDF_DECODER 0
-#define CONFIG_LIBOPENH264_DECODER 0
-#define CONFIG_H263_CUVID_DECODER 0
-#define CONFIG_H264_CUVID_DECODER 0
-#define CONFIG_HEVC_CUVID_DECODER 0
-#define CONFIG_HEVC_MEDIACODEC_DECODER 0
-#define CONFIG_MJPEG_CUVID_DECODER 0
-#define CONFIG_MPEG1_CUVID_DECODER 0
-#define CONFIG_MPEG2_CUVID_DECODER 0
-#define CONFIG_MPEG4_CUVID_DECODER 0
-#define CONFIG_MPEG4_MEDIACODEC_DECODER 0
-#define CONFIG_VC1_CUVID_DECODER 0
-#define CONFIG_VP8_CUVID_DECODER 0
-#define CONFIG_VP8_MEDIACODEC_DECODER 0
-#define CONFIG_VP9_CUVID_DECODER 0
-#define CONFIG_VP9_MEDIACODEC_DECODER 0
-#define CONFIG_AA_DEMUXER 0
-#define CONFIG_AAC_DEMUXER 0
-#define CONFIG_AC3_DEMUXER 0
-#define CONFIG_ACM_DEMUXER 0
-#define CONFIG_ACT_DEMUXER 0
-#define CONFIG_ADF_DEMUXER 0
-#define CONFIG_ADP_DEMUXER 0
-#define CONFIG_ADS_DEMUXER 0
-#define CONFIG_ADX_DEMUXER 0
-#define CONFIG_AEA_DEMUXER 0
-#define CONFIG_AFC_DEMUXER 0
-#define CONFIG_AIFF_DEMUXER 0
-#define CONFIG_AIX_DEMUXER 0
-#define CONFIG_AMR_DEMUXER 0
-#define CONFIG_ANM_DEMUXER 0
-#define CONFIG_APC_DEMUXER 0
-#define CONFIG_APE_DEMUXER 0
-#define CONFIG_APNG_DEMUXER 0
-#define CONFIG_AQTITLE_DEMUXER 0
-#define CONFIG_ASF_DEMUXER 0
-#define CONFIG_ASF_O_DEMUXER 0
-#define CONFIG_ASS_DEMUXER 0
-#define CONFIG_AST_DEMUXER 0
-#define CONFIG_AU_DEMUXER 0
-#define CONFIG_AVI_DEMUXER 0
-#define CONFIG_AVISYNTH_DEMUXER 0
-#define CONFIG_AVR_DEMUXER 0
-#define CONFIG_AVS_DEMUXER 0
-#define CONFIG_BETHSOFTVID_DEMUXER 0
-#define CONFIG_BFI_DEMUXER 0
-#define CONFIG_BINTEXT_DEMUXER 0
-#define CONFIG_BINK_DEMUXER 0
-#define CONFIG_BIT_DEMUXER 0
-#define CONFIG_BMV_DEMUXER 0
-#define CONFIG_BFSTM_DEMUXER 0
-#define CONFIG_BRSTM_DEMUXER 0
-#define CONFIG_BOA_DEMUXER 0
-#define CONFIG_C93_DEMUXER 0
-#define CONFIG_CAF_DEMUXER 0
-#define CONFIG_CAVSVIDEO_DEMUXER 0
-#define CONFIG_CDG_DEMUXER 0
-#define CONFIG_CDXL_DEMUXER 0
-#define CONFIG_CINE_DEMUXER 0
-#define CONFIG_CONCAT_DEMUXER 0
-#define CONFIG_DATA_DEMUXER 0
-#define CONFIG_DAUD_DEMUXER 0
-#define CONFIG_DCSTR_DEMUXER 0
-#define CONFIG_DFA_DEMUXER 0
-#define CONFIG_DIRAC_DEMUXER 0
-#define CONFIG_DNXHD_DEMUXER 0
-#define CONFIG_DSF_DEMUXER 0
-#define CONFIG_DSICIN_DEMUXER 0
-#define CONFIG_DSS_DEMUXER 0
-#define CONFIG_DTS_DEMUXER 0
-#define CONFIG_DTSHD_DEMUXER 0
-#define CONFIG_DV_DEMUXER 0
-#define CONFIG_DVBSUB_DEMUXER 0
-#define CONFIG_DVBTXT_DEMUXER 0
-#define CONFIG_DXA_DEMUXER 0
-#define CONFIG_EA_DEMUXER 0
-#define CONFIG_EA_CDATA_DEMUXER 0
-#define CONFIG_EAC3_DEMUXER 0
-#define CONFIG_EPAF_DEMUXER 0
-#define CONFIG_FFM_DEMUXER 0
-#define CONFIG_FFMETADATA_DEMUXER 0
-#define CONFIG_FILMSTRIP_DEMUXER 0
-#define CONFIG_FLAC_DEMUXER 0
-#define CONFIG_FLIC_DEMUXER 0
-#define CONFIG_FLV_DEMUXER 0
-#define CONFIG_LIVE_FLV_DEMUXER 0
-#define CONFIG_FOURXM_DEMUXER 0
-#define CONFIG_FRM_DEMUXER 0
-#define CONFIG_FSB_DEMUXER 0
-#define CONFIG_G722_DEMUXER 0
-#define CONFIG_G723_1_DEMUXER 0
-#define CONFIG_G729_DEMUXER 0
-#define CONFIG_GENH_DEMUXER 0
-#define CONFIG_GIF_DEMUXER 0
-#define CONFIG_GSM_DEMUXER 0
-#define CONFIG_GXF_DEMUXER 0
-#define CONFIG_H261_DEMUXER 0
-#define CONFIG_H263_DEMUXER 0
-#define CONFIG_H264_DEMUXER 0
-#define CONFIG_HEVC_DEMUXER 0
-#define CONFIG_HLS_DEMUXER 0
-#define CONFIG_HNM_DEMUXER 0
-#define CONFIG_ICO_DEMUXER 0
-#define CONFIG_IDCIN_DEMUXER 0
-#define CONFIG_IDF_DEMUXER 0
-#define CONFIG_IFF_DEMUXER 0
-#define CONFIG_ILBC_DEMUXER 0
-#define CONFIG_IMAGE2_DEMUXER 0
-#define CONFIG_IMAGE2PIPE_DEMUXER 0
-#define CONFIG_IMAGE2_ALIAS_PIX_DEMUXER 0
-#define CONFIG_IMAGE2_BRENDER_PIX_DEMUXER 0
-#define CONFIG_INGENIENT_DEMUXER 0
-#define CONFIG_IPMOVIE_DEMUXER 0
-#define CONFIG_IRCAM_DEMUXER 0
-#define CONFIG_ISS_DEMUXER 0
-#define CONFIG_IV8_DEMUXER 0
-#define CONFIG_IVF_DEMUXER 0
-#define CONFIG_IVR_DEMUXER 0
-#define CONFIG_JACOSUB_DEMUXER 0
-#define CONFIG_JV_DEMUXER 0
-#define CONFIG_LMLM4_DEMUXER 0
-#define CONFIG_LOAS_DEMUXER 0
-#define CONFIG_LRC_DEMUXER 0
-#define CONFIG_LVF_DEMUXER 0
-#define CONFIG_LXF_DEMUXER 0
-#define CONFIG_M4V_DEMUXER 0
-#define CONFIG_MATROSKA_DEMUXER 0
-#define CONFIG_MGSTS_DEMUXER 0
-#define CONFIG_MICRODVD_DEMUXER 0
-#define CONFIG_MJPEG_DEMUXER 0
-#define CONFIG_MLP_DEMUXER 0
-#define CONFIG_MLV_DEMUXER 0
-#define CONFIG_MM_DEMUXER 0
-#define CONFIG_MMF_DEMUXER 0
-#define CONFIG_MOV_DEMUXER 0
-#define CONFIG_MP3_DEMUXER 0
-#define CONFIG_MPC_DEMUXER 0
-#define CONFIG_MPC8_DEMUXER 0
-#define CONFIG_MPEGPS_DEMUXER 0
-#define CONFIG_MPEGTS_DEMUXER 0
-#define CONFIG_MPEGTSRAW_DEMUXER 0
-#define CONFIG_MPEGVIDEO_DEMUXER 0
-#define CONFIG_MPJPEG_DEMUXER 0
-#define CONFIG_MPL2_DEMUXER 0
-#define CONFIG_MPSUB_DEMUXER 0
-#define CONFIG_MSF_DEMUXER 0
-#define CONFIG_MSNWC_TCP_DEMUXER 0
-#define CONFIG_MTAF_DEMUXER 0
-#define CONFIG_MTV_DEMUXER 0
-#define CONFIG_MUSX_DEMUXER 0
-#define CONFIG_MV_DEMUXER 0
-#define CONFIG_MVI_DEMUXER 0
-#define CONFIG_MXF_DEMUXER 0
-#define CONFIG_MXG_DEMUXER 0
-#define CONFIG_NC_DEMUXER 0
-#define CONFIG_NISTSPHERE_DEMUXER 0
-#define CONFIG_NSV_DEMUXER 0
-#define CONFIG_NUT_DEMUXER 0
-#define CONFIG_NUV_DEMUXER 0
-#define CONFIG_OGG_DEMUXER 0
-#define CONFIG_OMA_DEMUXER 0
-#define CONFIG_PAF_DEMUXER 0
-#define CONFIG_PCM_ALAW_DEMUXER 0
-#define CONFIG_PCM_MULAW_DEMUXER 0
-#define CONFIG_PCM_F64BE_DEMUXER 0
-#define CONFIG_PCM_F64LE_DEMUXER 0
-#define CONFIG_PCM_F32BE_DEMUXER 0
-#define CONFIG_PCM_F32LE_DEMUXER 0
-#define CONFIG_PCM_S32BE_DEMUXER 0
-#define CONFIG_PCM_S32LE_DEMUXER 0
-#define CONFIG_PCM_S24BE_DEMUXER 0
-#define CONFIG_PCM_S24LE_DEMUXER 0
-#define CONFIG_PCM_S16BE_DEMUXER 0
-#define CONFIG_PCM_S16LE_DEMUXER 0
-#define CONFIG_PCM_S8_DEMUXER 0
-#define CONFIG_PCM_U32BE_DEMUXER 0
-#define CONFIG_PCM_U32LE_DEMUXER 0
-#define CONFIG_PCM_U24BE_DEMUXER 0
-#define CONFIG_PCM_U24LE_DEMUXER 0
-#define CONFIG_PCM_U16BE_DEMUXER 0
-#define CONFIG_PCM_U16LE_DEMUXER 0
-#define CONFIG_PCM_U8_DEMUXER 0
-#define CONFIG_PJS_DEMUXER 0
-#define CONFIG_PMP_DEMUXER 0
-#define CONFIG_PVA_DEMUXER 0
-#define CONFIG_PVF_DEMUXER 0
-#define CONFIG_QCP_DEMUXER 0
-#define CONFIG_R3D_DEMUXER 0
-#define CONFIG_RAWVIDEO_DEMUXER 0
-#define CONFIG_REALTEXT_DEMUXER 0
-#define CONFIG_REDSPARK_DEMUXER 0
-#define CONFIG_RL2_DEMUXER 0
-#define CONFIG_RM_DEMUXER 0
-#define CONFIG_ROQ_DEMUXER 0
-#define CONFIG_RPL_DEMUXER 0
-#define CONFIG_RSD_DEMUXER 0
-#define CONFIG_RSO_DEMUXER 0
-#define CONFIG_RTP_DEMUXER 0
-#define CONFIG_RTSP_DEMUXER 0
-#define CONFIG_SAMI_DEMUXER 0
-#define CONFIG_SAP_DEMUXER 0
-#define CONFIG_SBG_DEMUXER 0
-#define CONFIG_SDP_DEMUXER 0
-#define CONFIG_SDR2_DEMUXER 0
-#define CONFIG_SEGAFILM_DEMUXER 0
-#define CONFIG_SHORTEN_DEMUXER 0
-#define CONFIG_SIFF_DEMUXER 0
-#define CONFIG_SLN_DEMUXER 0
-#define CONFIG_SMACKER_DEMUXER 0
-#define CONFIG_SMJPEG_DEMUXER 0
-#define CONFIG_SMUSH_DEMUXER 0
-#define CONFIG_SOL_DEMUXER 0
-#define CONFIG_SOX_DEMUXER 0
-#define CONFIG_SPDIF_DEMUXER 0
-#define CONFIG_SRT_DEMUXER 0
-#define CONFIG_STR_DEMUXER 0
-#define CONFIG_STL_DEMUXER 0
-#define CONFIG_SUBVIEWER1_DEMUXER 0
-#define CONFIG_SUBVIEWER_DEMUXER 0
-#define CONFIG_SUP_DEMUXER 0
-#define CONFIG_SVAG_DEMUXER 0
-#define CONFIG_SWF_DEMUXER 0
-#define CONFIG_TAK_DEMUXER 0
-#define CONFIG_TEDCAPTIONS_DEMUXER 0
-#define CONFIG_THP_DEMUXER 0
-#define CONFIG_THREEDOSTR_DEMUXER 0
-#define CONFIG_TIERTEXSEQ_DEMUXER 0
-#define CONFIG_TMV_DEMUXER 0
-#define CONFIG_TRUEHD_DEMUXER 0
-#define CONFIG_TTA_DEMUXER 0
-#define CONFIG_TXD_DEMUXER 0
-#define CONFIG_TTY_DEMUXER 0
-#define CONFIG_V210_DEMUXER 0
-#define CONFIG_V210X_DEMUXER 0
-#define CONFIG_VAG_DEMUXER 0
-#define CONFIG_VC1_DEMUXER 0
-#define CONFIG_VC1T_DEMUXER 0
-#define CONFIG_VIVO_DEMUXER 0
-#define CONFIG_VMD_DEMUXER 0
-#define CONFIG_VOBSUB_DEMUXER 0
-#define CONFIG_VOC_DEMUXER 0
-#define CONFIG_VPK_DEMUXER 0
-#define CONFIG_VPLAYER_DEMUXER 0
-#define CONFIG_VQF_DEMUXER 0
-#define CONFIG_W64_DEMUXER 0
-#define CONFIG_WAV_DEMUXER 0
-#define CONFIG_WC3_DEMUXER 0
-#define CONFIG_WEBM_DASH_MANIFEST_DEMUXER 0
-#define CONFIG_WEBVTT_DEMUXER 0
-#define CONFIG_WSAUD_DEMUXER 0
-#define CONFIG_WSD_DEMUXER 0
-#define CONFIG_WSVQA_DEMUXER 0
-#define CONFIG_WTV_DEMUXER 0
-#define CONFIG_WVE_DEMUXER 0
-#define CONFIG_WV_DEMUXER 0
-#define CONFIG_XA_DEMUXER 0
-#define CONFIG_XBIN_DEMUXER 0
-#define CONFIG_XMV_DEMUXER 0
-#define CONFIG_XVAG_DEMUXER 0
-#define CONFIG_XWMA_DEMUXER 0
-#define CONFIG_YOP_DEMUXER 0
-#define CONFIG_YUV4MPEGPIPE_DEMUXER 0
-#define CONFIG_IMAGE_BMP_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_DDS_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_DPX_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_EXR_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_J2K_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_JPEG_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_JPEGLS_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PAM_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PBM_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PCX_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PGMYUV_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PGM_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PICTOR_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PNG_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PPM_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_QDRAW_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_SGI_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_SUNRAST_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_TIFF_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_WEBP_PIPE_DEMUXER 0
-#define CONFIG_LIBGME_DEMUXER 0
-#define CONFIG_LIBMODPLUG_DEMUXER 0
-#define CONFIG_LIBNUT_DEMUXER 0
-#define CONFIG_LIBOPENMPT_DEMUXER 0
-#define CONFIG_A64MULTI_ENCODER 0
-#define CONFIG_A64MULTI5_ENCODER 0
-#define CONFIG_ALIAS_PIX_ENCODER 0
-#define CONFIG_AMV_ENCODER 0
-#define CONFIG_APNG_ENCODER 0
-#define CONFIG_ASV1_ENCODER 0
-#define CONFIG_ASV2_ENCODER 0
-#define CONFIG_AVRP_ENCODER 0
-#define CONFIG_AVUI_ENCODER 0
-#define CONFIG_AYUV_ENCODER 0
-#define CONFIG_BMP_ENCODER 0
-#define CONFIG_CINEPAK_ENCODER 0
-#define CONFIG_CLJR_ENCODER 0
-#define CONFIG_COMFORTNOISE_ENCODER 0
-#define CONFIG_DNXHD_ENCODER 0
-#define CONFIG_DPX_ENCODER 0
-#define CONFIG_DVVIDEO_ENCODER 0
-#define CONFIG_FFV1_ENCODER 0
-#define CONFIG_FFVHUFF_ENCODER 0
-#define CONFIG_FLASHSV_ENCODER 0
-#define CONFIG_FLASHSV2_ENCODER 0
-#define CONFIG_FLV_ENCODER 0
-#define CONFIG_GIF_ENCODER 0
-#define CONFIG_H261_ENCODER 0
-#define CONFIG_H263_ENCODER 0
-#define CONFIG_H263P_ENCODER 0
-#define CONFIG_HAP_ENCODER 0
-#define CONFIG_HUFFYUV_ENCODER 0
-#define CONFIG_JPEG2000_ENCODER 0
-#define CONFIG_JPEGLS_ENCODER 0
-#define CONFIG_LJPEG_ENCODER 0
-#define CONFIG_MJPEG_ENCODER 0
-#define CONFIG_MPEG1VIDEO_ENCODER 0
-#define CONFIG_MPEG2VIDEO_ENCODER 0
-#define CONFIG_MPEG4_ENCODER 0
-#define CONFIG_MSMPEG4V2_ENCODER 0
-#define CONFIG_MSMPEG4V3_ENCODER 0
-#define CONFIG_MSVIDEO1_ENCODER 0
-#define CONFIG_PAM_ENCODER 0
-#define CONFIG_PBM_ENCODER 0
-#define CONFIG_PCX_ENCODER 0
-#define CONFIG_PGM_ENCODER 0
-#define CONFIG_PGMYUV_ENCODER 0
-#define CONFIG_PNG_ENCODER 0
-#define CONFIG_PPM_ENCODER 0
-#define CONFIG_PRORES_ENCODER 0
-#define CONFIG_PRORES_AW_ENCODER 0
-#define CONFIG_PRORES_KS_ENCODER 0
-#define CONFIG_QTRLE_ENCODER 0
-#define CONFIG_R10K_ENCODER 0
-#define CONFIG_R210_ENCODER 0
-#define CONFIG_RAWVIDEO_ENCODER 0
-#define CONFIG_ROQ_ENCODER 0
-#define CONFIG_RV10_ENCODER 0
-#define CONFIG_RV20_ENCODER 0
-#define CONFIG_S302M_ENCODER 0
-#define CONFIG_SGI_ENCODER 0
-#define CONFIG_SNOW_ENCODER 0
-#define CONFIG_SUNRAST_ENCODER 0
-#define CONFIG_SVQ1_ENCODER 0
-#define CONFIG_TARGA_ENCODER 0
-#define CONFIG_TIFF_ENCODER 0
-#define CONFIG_UTVIDEO_ENCODER 0
-#define CONFIG_V210_ENCODER 0
-#define CONFIG_V308_ENCODER 0
-#define CONFIG_V408_ENCODER 0
-#define CONFIG_V410_ENCODER 0
-#define CONFIG_VC2_ENCODER 0
-#define CONFIG_WRAPPED_AVFRAME_ENCODER 0
-#define CONFIG_WMV1_ENCODER 0
-#define CONFIG_WMV2_ENCODER 0
-#define CONFIG_XBM_ENCODER 0
-#define CONFIG_XFACE_ENCODER 0
-#define CONFIG_XWD_ENCODER 0
-#define CONFIG_Y41P_ENCODER 0
-#define CONFIG_YUV4_ENCODER 0
-#define CONFIG_ZLIB_ENCODER 0
-#define CONFIG_ZMBV_ENCODER 0
-#define CONFIG_AAC_ENCODER 0
-#define CONFIG_AC3_ENCODER 0
-#define CONFIG_AC3_FIXED_ENCODER 0
-#define CONFIG_ALAC_ENCODER 0
-#define CONFIG_DCA_ENCODER 0
-#define CONFIG_EAC3_ENCODER 0
-#define CONFIG_FLAC_ENCODER 0
-#define CONFIG_G723_1_ENCODER 0
-#define CONFIG_MLP_ENCODER 0
-#define CONFIG_MP2_ENCODER 0
-#define CONFIG_MP2FIXED_ENCODER 0
-#define CONFIG_NELLYMOSER_ENCODER 0
-#define CONFIG_RA_144_ENCODER 0
-#define CONFIG_SONIC_ENCODER 0
-#define CONFIG_SONIC_LS_ENCODER 0
-#define CONFIG_TRUEHD_ENCODER 0
-#define CONFIG_TTA_ENCODER 0
-#define CONFIG_VORBIS_ENCODER 0
-#define CONFIG_WAVPACK_ENCODER 0
-#define CONFIG_WMAV1_ENCODER 0
-#define CONFIG_WMAV2_ENCODER 0
-#define CONFIG_PCM_ALAW_ENCODER 0
-#define CONFIG_PCM_F32BE_ENCODER 0
-#define CONFIG_PCM_F32LE_ENCODER 0
-#define CONFIG_PCM_F64BE_ENCODER 0
-#define CONFIG_PCM_F64LE_ENCODER 0
-#define CONFIG_PCM_MULAW_ENCODER 0
-#define CONFIG_PCM_S8_ENCODER 0
-#define CONFIG_PCM_S8_PLANAR_ENCODER 0
-#define CONFIG_PCM_S16BE_ENCODER 0
-#define CONFIG_PCM_S16BE_PLANAR_ENCODER 0
-#define CONFIG_PCM_S16LE_ENCODER 0
-#define CONFIG_PCM_S16LE_PLANAR_ENCODER 0
-#define CONFIG_PCM_S24BE_ENCODER 0
-#define CONFIG_PCM_S24DAUD_ENCODER 0
-#define CONFIG_PCM_S24LE_ENCODER 0
-#define CONFIG_PCM_S24LE_PLANAR_ENCODER 0
-#define CONFIG_PCM_S32BE_ENCODER 0
-#define CONFIG_PCM_S32LE_ENCODER 0
-#define CONFIG_PCM_S32LE_PLANAR_ENCODER 0
-#define CONFIG_PCM_S64BE_ENCODER 0
-#define CONFIG_PCM_S64LE_ENCODER 0
-#define CONFIG_PCM_U8_ENCODER 0
-#define CONFIG_PCM_U16BE_ENCODER 0
-#define CONFIG_PCM_U16LE_ENCODER 0
-#define CONFIG_PCM_U24BE_ENCODER 0
-#define CONFIG_PCM_U24LE_ENCODER 0
-#define CONFIG_PCM_U32BE_ENCODER 0
-#define CONFIG_PCM_U32LE_ENCODER 0
-#define CONFIG_ROQ_DPCM_ENCODER 0
-#define CONFIG_ADPCM_ADX_ENCODER 0
-#define CONFIG_ADPCM_G722_ENCODER 0
-#define CONFIG_ADPCM_G726_ENCODER 0
-#define CONFIG_ADPCM_IMA_QT_ENCODER 0
-#define CONFIG_ADPCM_IMA_WAV_ENCODER 0
-#define CONFIG_ADPCM_MS_ENCODER 0
-#define CONFIG_ADPCM_SWF_ENCODER 0
-#define CONFIG_ADPCM_YAMAHA_ENCODER 0
-#define CONFIG_SSA_ENCODER 0
-#define CONFIG_ASS_ENCODER 0
-#define CONFIG_DVBSUB_ENCODER 0
-#define CONFIG_DVDSUB_ENCODER 0
-#define CONFIG_MOVTEXT_ENCODER 0
-#define CONFIG_SRT_ENCODER 0
-#define CONFIG_SUBRIP_ENCODER 0
-#define CONFIG_TEXT_ENCODER 0
-#define CONFIG_WEBVTT_ENCODER 0
-#define CONFIG_XSUB_ENCODER 0
-#define CONFIG_AAC_AT_ENCODER 0
-#define CONFIG_ALAC_AT_ENCODER 0
-#define CONFIG_ILBC_AT_ENCODER 0
-#define CONFIG_PCM_ALAW_AT_ENCODER 0
-#define CONFIG_PCM_MULAW_AT_ENCODER 0
-#define CONFIG_LIBFDK_AAC_ENCODER 0
-#define CONFIG_LIBGSM_ENCODER 0
-#define CONFIG_LIBGSM_MS_ENCODER 0
-#define CONFIG_LIBILBC_ENCODER 0
-#define CONFIG_LIBMP3LAME_ENCODER 0
-#define CONFIG_LIBOPENCORE_AMRNB_ENCODER 0
-#define CONFIG_LIBOPENJPEG_ENCODER 0
-#define CONFIG_LIBOPUS_ENCODER 0
-#define CONFIG_LIBSCHROEDINGER_ENCODER 0
-#define CONFIG_LIBSHINE_ENCODER 0
-#define CONFIG_LIBSPEEX_ENCODER 0
-#define CONFIG_LIBTHEORA_ENCODER 0
-#define CONFIG_LIBTWOLAME_ENCODER 0
-#define CONFIG_LIBVO_AMRWBENC_ENCODER 0
-#define CONFIG_LIBVORBIS_ENCODER 0
-#define CONFIG_LIBVPX_VP8_ENCODER 0
-#define CONFIG_LIBVPX_VP9_ENCODER 0
-#define CONFIG_LIBWAVPACK_ENCODER 0
-#define CONFIG_LIBWEBP_ANIM_ENCODER 0
-#define CONFIG_LIBWEBP_ENCODER 0
-#define CONFIG_LIBX262_ENCODER 0
-#define CONFIG_LIBX264_ENCODER 0
-#define CONFIG_LIBX264RGB_ENCODER 0
-#define CONFIG_LIBX265_ENCODER 0
-#define CONFIG_LIBXAVS_ENCODER 0
-#define CONFIG_LIBXVID_ENCODER 0
-#define CONFIG_LIBOPENH264_ENCODER 0
-#define CONFIG_H264_NVENC_ENCODER 0
-#define CONFIG_H264_OMX_ENCODER 0
-#define CONFIG_H264_QSV_ENCODER 0
-#define CONFIG_H264_VAAPI_ENCODER 0
-#define CONFIG_H264_VIDEOTOOLBOX_ENCODER 0
-#define CONFIG_NVENC_ENCODER 0
-#define CONFIG_NVENC_H264_ENCODER 0
-#define CONFIG_NVENC_HEVC_ENCODER 0
-#define CONFIG_HEVC_NVENC_ENCODER 0
-#define CONFIG_HEVC_QSV_ENCODER 0
-#define CONFIG_HEVC_VAAPI_ENCODER 0
-#define CONFIG_LIBKVAZAAR_ENCODER 0
-#define CONFIG_MJPEG_VAAPI_ENCODER 0
-#define CONFIG_MPEG2_QSV_ENCODER 0
-#define CONFIG_ABENCH_FILTER 0
-#define CONFIG_ACOMPRESSOR_FILTER 0
-#define CONFIG_ACROSSFADE_FILTER 0
-#define CONFIG_ACRUSHER_FILTER 0
-#define CONFIG_ADELAY_FILTER 0
-#define CONFIG_AECHO_FILTER 0
-#define CONFIG_AEMPHASIS_FILTER 0
-#define CONFIG_AEVAL_FILTER 0
-#define CONFIG_AFADE_FILTER 0
-#define CONFIG_AFFTFILT_FILTER 0
-#define CONFIG_AFORMAT_FILTER 0
-#define CONFIG_AGATE_FILTER 0
-#define CONFIG_AINTERLEAVE_FILTER 0
-#define CONFIG_ALIMITER_FILTER 0
-#define CONFIG_ALLPASS_FILTER 0
-#define CONFIG_ALOOP_FILTER 0
-#define CONFIG_AMERGE_FILTER 0
-#define CONFIG_AMETADATA_FILTER 0
-#define CONFIG_AMIX_FILTER 0
-#define CONFIG_ANEQUALIZER_FILTER 0
-#define CONFIG_ANULL_FILTER 0
-#define CONFIG_APAD_FILTER 0
-#define CONFIG_APERMS_FILTER 0
-#define CONFIG_APHASER_FILTER 0
-#define CONFIG_APULSATOR_FILTER 0
-#define CONFIG_AREALTIME_FILTER 0
-#define CONFIG_ARESAMPLE_FILTER 0
-#define CONFIG_AREVERSE_FILTER 0
-#define CONFIG_ASELECT_FILTER 0
-#define CONFIG_ASENDCMD_FILTER 0
-#define CONFIG_ASETNSAMPLES_FILTER 0
-#define CONFIG_ASETPTS_FILTER 0
-#define CONFIG_ASETRATE_FILTER 0
-#define CONFIG_ASETTB_FILTER 0
-#define CONFIG_ASHOWINFO_FILTER 0
-#define CONFIG_ASIDEDATA_FILTER 0
-#define CONFIG_ASPLIT_FILTER 0
-#define CONFIG_ASTATS_FILTER 0
-#define CONFIG_ASTREAMSELECT_FILTER 0
-#define CONFIG_ASYNCTS_FILTER 0
-#define CONFIG_ATEMPO_FILTER 0
-#define CONFIG_ATRIM_FILTER 0
-#define CONFIG_AZMQ_FILTER 0
-#define CONFIG_BANDPASS_FILTER 0
-#define CONFIG_BANDREJECT_FILTER 0
-#define CONFIG_BASS_FILTER 0
-#define CONFIG_BIQUAD_FILTER 0
-#define CONFIG_BS2B_FILTER 0
-#define CONFIG_CHANNELMAP_FILTER 0
-#define CONFIG_CHANNELSPLIT_FILTER 0
-#define CONFIG_CHORUS_FILTER 0
-#define CONFIG_COMPAND_FILTER 0
-#define CONFIG_COMPENSATIONDELAY_FILTER 0
-#define CONFIG_CRYSTALIZER_FILTER 0
-#define CONFIG_DCSHIFT_FILTER 0
-#define CONFIG_DYNAUDNORM_FILTER 0
-#define CONFIG_EARWAX_FILTER 0
-#define CONFIG_EBUR128_FILTER 0
-#define CONFIG_EQUALIZER_FILTER 0
-#define CONFIG_EXTRASTEREO_FILTER 0
-#define CONFIG_FIREQUALIZER_FILTER 0
-#define CONFIG_FLANGER_FILTER 0
-#define CONFIG_HDCD_FILTER 0
-#define CONFIG_HIGHPASS_FILTER 0
-#define CONFIG_JOIN_FILTER 0
-#define CONFIG_LADSPA_FILTER 0
-#define CONFIG_LOUDNORM_FILTER 0
-#define CONFIG_LOWPASS_FILTER 0
-#define CONFIG_PAN_FILTER 0
-#define CONFIG_REPLAYGAIN_FILTER 0
-#define CONFIG_RESAMPLE_FILTER 0
-#define CONFIG_RUBBERBAND_FILTER 0
-#define CONFIG_SIDECHAINCOMPRESS_FILTER 0
-#define CONFIG_SIDECHAINGATE_FILTER 0
-#define CONFIG_SILENCEDETECT_FILTER 0
-#define CONFIG_SILENCEREMOVE_FILTER 0
-#define CONFIG_SOFALIZER_FILTER 0
-#define CONFIG_STEREOTOOLS_FILTER 0
-#define CONFIG_STEREOWIDEN_FILTER 0
-#define CONFIG_TREBLE_FILTER 0
-#define CONFIG_TREMOLO_FILTER 0
-#define CONFIG_VIBRATO_FILTER 0
-#define CONFIG_VOLUME_FILTER 0
-#define CONFIG_VOLUMEDETECT_FILTER 0
-#define CONFIG_AEVALSRC_FILTER 0
-#define CONFIG_ANOISESRC_FILTER 0
-#define CONFIG_ANULLSRC_FILTER 0
-#define CONFIG_FLITE_FILTER 0
-#define CONFIG_SINE_FILTER 0
-#define CONFIG_ANULLSINK_FILTER 0
-#define CONFIG_ALPHAEXTRACT_FILTER 0
-#define CONFIG_ALPHAMERGE_FILTER 0
-#define CONFIG_ASS_FILTER 0
-#define CONFIG_ATADENOISE_FILTER 0
-#define CONFIG_AVGBLUR_FILTER 0
-#define CONFIG_BBOX_FILTER 0
-#define CONFIG_BENCH_FILTER 0
-#define CONFIG_BITPLANENOISE_FILTER 0
-#define CONFIG_BLACKDETECT_FILTER 0
-#define CONFIG_BLACKFRAME_FILTER 0
-#define CONFIG_BLEND_FILTER 0
-#define CONFIG_BOXBLUR_FILTER 0
-#define CONFIG_BWDIF_FILTER 0
-#define CONFIG_CHROMAKEY_FILTER 0
-#define CONFIG_CIESCOPE_FILTER 0
-#define CONFIG_CODECVIEW_FILTER 0
-#define CONFIG_COLORBALANCE_FILTER 0
-#define CONFIG_COLORCHANNELMIXER_FILTER 0
-#define CONFIG_COLORKEY_FILTER 0
-#define CONFIG_COLORLEVELS_FILTER 0
-#define CONFIG_COLORMATRIX_FILTER 0
-#define CONFIG_COLORSPACE_FILTER 0
-#define CONFIG_CONVOLUTION_FILTER 0
-#define CONFIG_COPY_FILTER 0
-#define CONFIG_COREIMAGE_FILTER 0
-#define CONFIG_COVER_RECT_FILTER 0
-#define CONFIG_CROP_FILTER 0
-#define CONFIG_CROPDETECT_FILTER 0
-#define CONFIG_CURVES_FILTER 0
-#define CONFIG_DATASCOPE_FILTER 0
-#define CONFIG_DCTDNOIZ_FILTER 0
-#define CONFIG_DEBAND_FILTER 0
-#define CONFIG_DECIMATE_FILTER 0
-#define CONFIG_DEFLATE_FILTER 0
-#define CONFIG_DEJUDDER_FILTER 0
-#define CONFIG_DELOGO_FILTER 0
-#define CONFIG_DESHAKE_FILTER 0
-#define CONFIG_DETELECINE_FILTER 0
-#define CONFIG_DILATION_FILTER 0
-#define CONFIG_DISPLACE_FILTER 0
-#define CONFIG_DRAWBOX_FILTER 0
-#define CONFIG_DRAWGRAPH_FILTER 0
-#define CONFIG_DRAWGRID_FILTER 0
-#define CONFIG_DRAWTEXT_FILTER 0
-#define CONFIG_EDGEDETECT_FILTER 0
-#define CONFIG_ELBG_FILTER 0
-#define CONFIG_EQ_FILTER 0
-#define CONFIG_EROSION_FILTER 0
-#define CONFIG_EXTRACTPLANES_FILTER 0
-#define CONFIG_FADE_FILTER 0
-#define CONFIG_FFTFILT_FILTER 0
-#define CONFIG_FIELD_FILTER 0
-#define CONFIG_FIELDHINT_FILTER 0
-#define CONFIG_FIELDMATCH_FILTER 0
-#define CONFIG_FIELDORDER_FILTER 0
-#define CONFIG_FIND_RECT_FILTER 0
-#define CONFIG_FORMAT_FILTER 0
-#define CONFIG_FPS_FILTER 0
-#define CONFIG_FRAMEPACK_FILTER 0
-#define CONFIG_FRAMERATE_FILTER 0
-#define CONFIG_FRAMESTEP_FILTER 0
-#define CONFIG_FREI0R_FILTER 0
-#define CONFIG_FSPP_FILTER 0
-#define CONFIG_GBLUR_FILTER 0
-#define CONFIG_GEQ_FILTER 0
-#define CONFIG_GRADFUN_FILTER 0
-#define CONFIG_HALDCLUT_FILTER 0
-#define CONFIG_HFLIP_FILTER 0
-#define CONFIG_HISTEQ_FILTER 0
-#define CONFIG_HISTOGRAM_FILTER 0
-#define CONFIG_HQDN3D_FILTER 0
-#define CONFIG_HQX_FILTER 0
-#define CONFIG_HSTACK_FILTER 0
-#define CONFIG_HUE_FILTER 0
-#define CONFIG_HWDOWNLOAD_FILTER 0
-#define CONFIG_HWUPLOAD_FILTER 0
-#define CONFIG_HWUPLOAD_CUDA_FILTER 0
-#define CONFIG_HYSTERESIS_FILTER 0
-#define CONFIG_IDET_FILTER 0
-#define CONFIG_IL_FILTER 0
-#define CONFIG_INFLATE_FILTER 0
-#define CONFIG_INTERLACE_FILTER 0
-#define CONFIG_INTERLEAVE_FILTER 0
-#define CONFIG_KERNDEINT_FILTER 0
-#define CONFIG_LENSCORRECTION_FILTER 0
-#define CONFIG_LOOP_FILTER 0
-#define CONFIG_LUT_FILTER 0
-#define CONFIG_LUT2_FILTER 0
-#define CONFIG_LUT3D_FILTER 0
-#define CONFIG_LUTRGB_FILTER 0
-#define CONFIG_LUTYUV_FILTER 0
-#define CONFIG_MASKEDCLAMP_FILTER 0
-#define CONFIG_MASKEDMERGE_FILTER 0
-#define CONFIG_MCDEINT_FILTER 0
-#define CONFIG_MERGEPLANES_FILTER 0
-#define CONFIG_MESTIMATE_FILTER 0
-#define CONFIG_METADATA_FILTER 0
-#define CONFIG_MINTERPOLATE_FILTER 0
-#define CONFIG_MPDECIMATE_FILTER 0
-#define CONFIG_NEGATE_FILTER 0
-#define CONFIG_NLMEANS_FILTER 0
-#define CONFIG_NNEDI_FILTER 0
-#define CONFIG_NOFORMAT_FILTER 0
-#define CONFIG_NOISE_FILTER 0
-#define CONFIG_NULL_FILTER 0
-#define CONFIG_OCR_FILTER 0
-#define CONFIG_OCV_FILTER 0
-#define CONFIG_OVERLAY_FILTER 0
-#define CONFIG_OWDENOISE_FILTER 0
-#define CONFIG_PAD_FILTER 0
-#define CONFIG_PALETTEGEN_FILTER 0
-#define CONFIG_PALETTEUSE_FILTER 0
-#define CONFIG_PERMS_FILTER 0
-#define CONFIG_PERSPECTIVE_FILTER 0
-#define CONFIG_PHASE_FILTER 0
-#define CONFIG_PIXDESCTEST_FILTER 0
-#define CONFIG_PP_FILTER 0
-#define CONFIG_PP7_FILTER 0
-#define CONFIG_PREWITT_FILTER 0
-#define CONFIG_PSNR_FILTER 0
-#define CONFIG_PULLUP_FILTER 0
-#define CONFIG_QP_FILTER 0
-#define CONFIG_RANDOM_FILTER 0
-#define CONFIG_READVITC_FILTER 0
-#define CONFIG_REALTIME_FILTER 0
-#define CONFIG_REMAP_FILTER 0
-#define CONFIG_REMOVEGRAIN_FILTER 0
-#define CONFIG_REMOVELOGO_FILTER 0
-#define CONFIG_REPEATFIELDS_FILTER 0
-#define CONFIG_REVERSE_FILTER 0
-#define CONFIG_ROTATE_FILTER 0
-#define CONFIG_SAB_FILTER 0
-#define CONFIG_SCALE_FILTER 0
-#define CONFIG_SCALE_NPP_FILTER 0
-#define CONFIG_SCALE_VAAPI_FILTER 0
-#define CONFIG_SCALE2REF_FILTER 0
-#define CONFIG_SELECT_FILTER 0
-#define CONFIG_SELECTIVECOLOR_FILTER 0
-#define CONFIG_SENDCMD_FILTER 0
-#define CONFIG_SEPARATEFIELDS_FILTER 0
-#define CONFIG_SETDAR_FILTER 0
-#define CONFIG_SETFIELD_FILTER 0
-#define CONFIG_SETPTS_FILTER 0
-#define CONFIG_SETSAR_FILTER 0
-#define CONFIG_SETTB_FILTER 0
-#define CONFIG_SHOWINFO_FILTER 0
-#define CONFIG_SHOWPALETTE_FILTER 0
-#define CONFIG_SHUFFLEFRAMES_FILTER 0
-#define CONFIG_SHUFFLEPLANES_FILTER 0
-#define CONFIG_SIDEDATA_FILTER 0
-#define CONFIG_SIGNALSTATS_FILTER 0
-#define CONFIG_SMARTBLUR_FILTER 0
-#define CONFIG_SOBEL_FILTER 0
-#define CONFIG_SPLIT_FILTER 0
-#define CONFIG_SPP_FILTER 0
-#define CONFIG_SSIM_FILTER 0
-#define CONFIG_STEREO3D_FILTER 0
-#define CONFIG_STREAMSELECT_FILTER 0
-#define CONFIG_SUBTITLES_FILTER 0
-#define CONFIG_SUPER2XSAI_FILTER 0
-#define CONFIG_SWAPRECT_FILTER 0
-#define CONFIG_SWAPUV_FILTER 0
-#define CONFIG_TBLEND_FILTER 0
-#define CONFIG_TELECINE_FILTER 0
-#define CONFIG_THUMBNAIL_FILTER 0
-#define CONFIG_TILE_FILTER 0
-#define CONFIG_TINTERLACE_FILTER 0
-#define CONFIG_TRANSPOSE_FILTER 0
-#define CONFIG_TRIM_FILTER 0
-#define CONFIG_UNSHARP_FILTER 0
-#define CONFIG_USPP_FILTER 0
-#define CONFIG_VAGUEDENOISER_FILTER 0
-#define CONFIG_VECTORSCOPE_FILTER 0
-#define CONFIG_VFLIP_FILTER 0
-#define CONFIG_VIDSTABDETECT_FILTER 0
-#define CONFIG_VIDSTABTRANSFORM_FILTER 0
-#define CONFIG_VIGNETTE_FILTER 0
-#define CONFIG_VSTACK_FILTER 0
-#define CONFIG_W3FDIF_FILTER 0
-#define CONFIG_WAVEFORM_FILTER 0
-#define CONFIG_WEAVE_FILTER 0
-#define CONFIG_XBR_FILTER 0
-#define CONFIG_YADIF_FILTER 0
-#define CONFIG_ZMQ_FILTER 0
-#define CONFIG_ZOOMPAN_FILTER 0
-#define CONFIG_ZSCALE_FILTER 0
-#define CONFIG_ALLRGB_FILTER 0
-#define CONFIG_ALLYUV_FILTER 0
-#define CONFIG_CELLAUTO_FILTER 0
-#define CONFIG_COLOR_FILTER 0
-#define CONFIG_COREIMAGESRC_FILTER 0
-#define CONFIG_FREI0R_SRC_FILTER 0
-#define CONFIG_HALDCLUTSRC_FILTER 0
-#define CONFIG_LIFE_FILTER 0
-#define CONFIG_MANDELBROT_FILTER 0
-#define CONFIG_MPTESTSRC_FILTER 0
-#define CONFIG_NULLSRC_FILTER 0
-#define CONFIG_RGBTESTSRC_FILTER 0
-#define CONFIG_SMPTEBARS_FILTER 0
-#define CONFIG_SMPTEHDBARS_FILTER 0
-#define CONFIG_TESTSRC_FILTER 0
-#define CONFIG_TESTSRC2_FILTER 0
-#define CONFIG_YUVTESTSRC_FILTER 0
-#define CONFIG_NULLSINK_FILTER 0
-#define CONFIG_ADRAWGRAPH_FILTER 0
-#define CONFIG_AHISTOGRAM_FILTER 0
-#define CONFIG_APHASEMETER_FILTER 0
-#define CONFIG_AVECTORSCOPE_FILTER 0
-#define CONFIG_CONCAT_FILTER 0
-#define CONFIG_SHOWCQT_FILTER 0
-#define CONFIG_SHOWFREQS_FILTER 0
-#define CONFIG_SHOWSPECTRUM_FILTER 0
-#define CONFIG_SHOWSPECTRUMPIC_FILTER 0
-#define CONFIG_SHOWVOLUME_FILTER 0
-#define CONFIG_SHOWWAVES_FILTER 0
-#define CONFIG_SHOWWAVESPIC_FILTER 0
-#define CONFIG_SPECTRUMSYNTH_FILTER 0
-#define CONFIG_AMOVIE_FILTER 0
-#define CONFIG_MOVIE_FILTER 0
-#define CONFIG_H263_CUVID_HWACCEL 0
-#define CONFIG_H263_VAAPI_HWACCEL 0
-#define CONFIG_H263_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_H264_CUVID_HWACCEL 0
-#define CONFIG_H264_D3D11VA_HWACCEL 0
-#define CONFIG_H264_DXVA2_HWACCEL 0
-#define CONFIG_H264_MEDIACODEC_HWACCEL 0
-#define CONFIG_H264_MMAL_HWACCEL 0
-#define CONFIG_H264_QSV_HWACCEL 0
-#define CONFIG_H264_VAAPI_HWACCEL 0
-#define CONFIG_H264_VDA_HWACCEL 0
-#define CONFIG_H264_VDA_OLD_HWACCEL 0
-#define CONFIG_H264_VDPAU_HWACCEL 0
-#define CONFIG_H264_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_HEVC_CUVID_HWACCEL 0
-#define CONFIG_HEVC_D3D11VA_HWACCEL 0
-#define CONFIG_HEVC_DXVA2_HWACCEL 0
-#define CONFIG_HEVC_MEDIACODEC_HWACCEL 0
-#define CONFIG_HEVC_QSV_HWACCEL 0
-#define CONFIG_HEVC_VAAPI_HWACCEL 0
-#define CONFIG_HEVC_VDPAU_HWACCEL 0
-#define CONFIG_MJPEG_CUVID_HWACCEL 0
-#define CONFIG_MPEG1_CUVID_HWACCEL 0
-#define CONFIG_MPEG1_XVMC_HWACCEL 0
-#define CONFIG_MPEG1_VDPAU_HWACCEL 0
-#define CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_MPEG2_CUVID_HWACCEL 0
-#define CONFIG_MPEG2_XVMC_HWACCEL 0
-#define CONFIG_MPEG2_D3D11VA_HWACCEL 0
-#define CONFIG_MPEG2_DXVA2_HWACCEL 0
-#define CONFIG_MPEG2_MMAL_HWACCEL 0
-#define CONFIG_MPEG2_QSV_HWACCEL 0
-#define CONFIG_MPEG2_VAAPI_HWACCEL 0
-#define CONFIG_MPEG2_VDPAU_HWACCEL 0
-#define CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_MPEG4_CUVID_HWACCEL 0
-#define CONFIG_MPEG4_MEDIACODEC_HWACCEL 0
-#define CONFIG_MPEG4_MMAL_HWACCEL 0
-#define CONFIG_MPEG4_VAAPI_HWACCEL 0
-#define CONFIG_MPEG4_VDPAU_HWACCEL 0
-#define CONFIG_MPEG4_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_VC1_CUVID_HWACCEL 0
-#define CONFIG_VC1_D3D11VA_HWACCEL 0
-#define CONFIG_VC1_DXVA2_HWACCEL 0
-#define CONFIG_VC1_VAAPI_HWACCEL 0
-#define CONFIG_VC1_VDPAU_HWACCEL 0
-#define CONFIG_VC1_MMAL_HWACCEL 0
-#define CONFIG_VC1_QSV_HWACCEL 0
-#define CONFIG_VP8_CUVID_HWACCEL 0
-#define CONFIG_VP8_MEDIACODEC_HWACCEL 0
-#define CONFIG_VP9_CUVID_HWACCEL 0
-#define CONFIG_VP9_D3D11VA_HWACCEL 0
-#define CONFIG_VP9_DXVA2_HWACCEL 0
-#define CONFIG_VP9_MEDIACODEC_HWACCEL 0
-#define CONFIG_VP9_VAAPI_HWACCEL 0
-#define CONFIG_WMV3_D3D11VA_HWACCEL 0
-#define CONFIG_WMV3_DXVA2_HWACCEL 0
-#define CONFIG_WMV3_VAAPI_HWACCEL 0
-#define CONFIG_WMV3_VDPAU_HWACCEL 0
-#define CONFIG_ALSA_INDEV 0
-#define CONFIG_AVFOUNDATION_INDEV 0
-#define CONFIG_BKTR_INDEV 0
-#define CONFIG_DECKLINK_INDEV 0
-#define CONFIG_DSHOW_INDEV 0
-#define CONFIG_DV1394_INDEV 0
-#define CONFIG_FBDEV_INDEV 0
-#define CONFIG_GDIGRAB_INDEV 0
-#define CONFIG_IEC61883_INDEV 0
-#define CONFIG_JACK_INDEV 0
-#define CONFIG_LAVFI_INDEV 0
-#define CONFIG_OPENAL_INDEV 0
-#define CONFIG_OSS_INDEV 0
-#define CONFIG_PULSE_INDEV 0
-#define CONFIG_QTKIT_INDEV 0
-#define CONFIG_SNDIO_INDEV 0
-#define CONFIG_V4L2_INDEV 0
-#define CONFIG_VFWCAP_INDEV 0
-#define CONFIG_X11GRAB_INDEV 0
-#define CONFIG_X11GRAB_XCB_INDEV 0
-#define CONFIG_LIBCDIO_INDEV 0
-#define CONFIG_LIBDC1394_INDEV 0
-#define CONFIG_A64_MUXER 0
-#define CONFIG_AC3_MUXER 0
-#define CONFIG_ADTS_MUXER 0
-#define CONFIG_ADX_MUXER 0
-#define CONFIG_AIFF_MUXER 0
-#define CONFIG_AMR_MUXER 0
-#define CONFIG_APNG_MUXER 0
-#define CONFIG_ASF_MUXER 0
-#define CONFIG_ASS_MUXER 0
-#define CONFIG_AST_MUXER 0
-#define CONFIG_ASF_STREAM_MUXER 0
-#define CONFIG_AU_MUXER 0
-#define CONFIG_AVI_MUXER 0
-#define CONFIG_AVM2_MUXER 0
-#define CONFIG_BIT_MUXER 0
-#define CONFIG_CAF_MUXER 0
-#define CONFIG_CAVSVIDEO_MUXER 0
-#define CONFIG_CRC_MUXER 0
-#define CONFIG_DASH_MUXER 0
-#define CONFIG_DATA_MUXER 0
-#define CONFIG_DAUD_MUXER 0
-#define CONFIG_DIRAC_MUXER 0
-#define CONFIG_DNXHD_MUXER 0
-#define CONFIG_DTS_MUXER 0
-#define CONFIG_DV_MUXER 0
-#define CONFIG_EAC3_MUXER 0
-#define CONFIG_F4V_MUXER 0
-#define CONFIG_FFM_MUXER 0
-#define CONFIG_FFMETADATA_MUXER 0
-#define CONFIG_FIFO_MUXER 0
-#define CONFIG_FILMSTRIP_MUXER 0
-#define CONFIG_FLAC_MUXER 0
-#define CONFIG_FLV_MUXER 0
-#define CONFIG_FRAMECRC_MUXER 0
-#define CONFIG_FRAMEHASH_MUXER 0
-#define CONFIG_FRAMEMD5_MUXER 0
-#define CONFIG_G722_MUXER 0
-#define CONFIG_G723_1_MUXER 0
-#define CONFIG_GIF_MUXER 0
-#define CONFIG_GSM_MUXER 0
-#define CONFIG_GXF_MUXER 0
-#define CONFIG_H261_MUXER 0
-#define CONFIG_H263_MUXER 0
-#define CONFIG_H264_MUXER 0
-#define CONFIG_HASH_MUXER 0
-#define CONFIG_HDS_MUXER 0
-#define CONFIG_HEVC_MUXER 0
-#define CONFIG_HLS_MUXER 0
-#define CONFIG_ICO_MUXER 0
-#define CONFIG_ILBC_MUXER 0
-#define CONFIG_IMAGE2_MUXER 0
-#define CONFIG_IMAGE2PIPE_MUXER 0
-#define CONFIG_IPOD_MUXER 0
-#define CONFIG_IRCAM_MUXER 0
-#define CONFIG_ISMV_MUXER 0
-#define CONFIG_IVF_MUXER 0
-#define CONFIG_JACOSUB_MUXER 0
-#define CONFIG_LATM_MUXER 0
-#define CONFIG_LRC_MUXER 0
-#define CONFIG_M4V_MUXER 0
-#define CONFIG_MD5_MUXER 0
-#define CONFIG_MATROSKA_MUXER 0
-#define CONFIG_MATROSKA_AUDIO_MUXER 0
-#define CONFIG_MICRODVD_MUXER 0
-#define CONFIG_MJPEG_MUXER 0
-#define CONFIG_MLP_MUXER 0
-#define CONFIG_MMF_MUXER 0
-#define CONFIG_MOV_MUXER 0
-#define CONFIG_MP2_MUXER 0
-#define CONFIG_MP3_MUXER 0
-#define CONFIG_MP4_MUXER 0
-#define CONFIG_MPEG1SYSTEM_MUXER 0
-#define CONFIG_MPEG1VCD_MUXER 0
-#define CONFIG_MPEG1VIDEO_MUXER 0
-#define CONFIG_MPEG2DVD_MUXER 0
-#define CONFIG_MPEG2SVCD_MUXER 0
-#define CONFIG_MPEG2VIDEO_MUXER 0
-#define CONFIG_MPEG2VOB_MUXER 0
-#define CONFIG_MPEGTS_MUXER 0
-#define CONFIG_MPJPEG_MUXER 0
-#define CONFIG_MXF_MUXER 0
-#define CONFIG_MXF_D10_MUXER 0
-#define CONFIG_MXF_OPATOM_MUXER 0
-#define CONFIG_NULL_MUXER 0
-#define CONFIG_NUT_MUXER 0
-#define CONFIG_OGA_MUXER 0
-#define CONFIG_OGG_MUXER 0
-#define CONFIG_OGV_MUXER 0
-#define CONFIG_OMA_MUXER 0
-#define CONFIG_OPUS_MUXER 0
-#define CONFIG_PCM_ALAW_MUXER 0
-#define CONFIG_PCM_MULAW_MUXER 0
-#define CONFIG_PCM_F64BE_MUXER 0
-#define CONFIG_PCM_F64LE_MUXER 0
-#define CONFIG_PCM_F32BE_MUXER 0
-#define CONFIG_PCM_F32LE_MUXER 0
-#define CONFIG_PCM_S32BE_MUXER 0
-#define CONFIG_PCM_S32LE_MUXER 0
-#define CONFIG_PCM_S24BE_MUXER 0
-#define CONFIG_PCM_S24LE_MUXER 0
-#define CONFIG_PCM_S16BE_MUXER 0
-#define CONFIG_PCM_S16LE_MUXER 0
-#define CONFIG_PCM_S8_MUXER 0
-#define CONFIG_PCM_U32BE_MUXER 0
-#define CONFIG_PCM_U32LE_MUXER 0
-#define CONFIG_PCM_U24BE_MUXER 0
-#define CONFIG_PCM_U24LE_MUXER 0
-#define CONFIG_PCM_U16BE_MUXER 0
-#define CONFIG_PCM_U16LE_MUXER 0
-#define CONFIG_PCM_U8_MUXER 0
-#define CONFIG_PSP_MUXER 0
-#define CONFIG_RAWVIDEO_MUXER 0
-#define CONFIG_RM_MUXER 0
-#define CONFIG_ROQ_MUXER 0
-#define CONFIG_RSO_MUXER 0
-#define CONFIG_RTP_MUXER 0
-#define CONFIG_RTP_MPEGTS_MUXER 0
-#define CONFIG_RTSP_MUXER 0
-#define CONFIG_SAP_MUXER 0
-#define CONFIG_SEGMENT_MUXER 0
-#define CONFIG_STREAM_SEGMENT_MUXER 0
-#define CONFIG_SINGLEJPEG_MUXER 0
-#define CONFIG_SMJPEG_MUXER 0
-#define CONFIG_SMOOTHSTREAMING_MUXER 0
-#define CONFIG_SOX_MUXER 0
-#define CONFIG_SPX_MUXER 0
-#define CONFIG_SPDIF_MUXER 0
-#define CONFIG_SRT_MUXER 0
-#define CONFIG_SWF_MUXER 0
-#define CONFIG_TEE_MUXER 0
-#define CONFIG_TG2_MUXER 0
-#define CONFIG_TGP_MUXER 0
-#define CONFIG_MKVTIMESTAMP_V2_MUXER 0
-#define CONFIG_TRUEHD_MUXER 0
-#define CONFIG_TTA_MUXER 0
-#define CONFIG_UNCODEDFRAMECRC_MUXER 0
-#define CONFIG_VC1_MUXER 0
-#define CONFIG_VC1T_MUXER 0
-#define CONFIG_VOC_MUXER 0
-#define CONFIG_W64_MUXER 0
-#define CONFIG_WAV_MUXER 0
-#define CONFIG_WEBM_MUXER 0
-#define CONFIG_WEBM_DASH_MANIFEST_MUXER 0
-#define CONFIG_WEBM_CHUNK_MUXER 0
-#define CONFIG_WEBP_MUXER 0
-#define CONFIG_WEBVTT_MUXER 0
-#define CONFIG_WTV_MUXER 0
-#define CONFIG_WV_MUXER 0
-#define CONFIG_YUV4MPEGPIPE_MUXER 0
-#define CONFIG_CHROMAPRINT_MUXER 0
-#define CONFIG_LIBNUT_MUXER 0
-#define CONFIG_ALSA_OUTDEV 0
-#define CONFIG_CACA_OUTDEV 0
-#define CONFIG_DECKLINK_OUTDEV 0
-#define CONFIG_FBDEV_OUTDEV 0
-#define CONFIG_OPENGL_OUTDEV 0
-#define CONFIG_OSS_OUTDEV 0
-#define CONFIG_PULSE_OUTDEV 0
-#define CONFIG_SDL2_OUTDEV 0
-#define CONFIG_SNDIO_OUTDEV 0
-#define CONFIG_V4L2_OUTDEV 0
-#define CONFIG_XV_OUTDEV 0
-#define CONFIG_AAC_PARSER 0
-#define CONFIG_AAC_LATM_PARSER 0
-#define CONFIG_AC3_PARSER 0
-#define CONFIG_ADX_PARSER 0
-#define CONFIG_BMP_PARSER 0
-#define CONFIG_CAVSVIDEO_PARSER 0
-#define CONFIG_COOK_PARSER 0
-#define CONFIG_DCA_PARSER 0
-#define CONFIG_DIRAC_PARSER 0
-#define CONFIG_DNXHD_PARSER 0
-#define CONFIG_DPX_PARSER 0
-#define CONFIG_DVAUDIO_PARSER 0
-#define CONFIG_DVBSUB_PARSER 0
-#define CONFIG_DVDSUB_PARSER 0
-#define CONFIG_DVD_NAV_PARSER 0
-#define CONFIG_FLAC_PARSER 1
-#define CONFIG_G729_PARSER 0
-#define CONFIG_GSM_PARSER 0
-#define CONFIG_H261_PARSER 0
-#define CONFIG_H263_PARSER 0
-#define CONFIG_H264_PARSER 0
-#define CONFIG_HEVC_PARSER 0
-#define CONFIG_MJPEG_PARSER 0
-#define CONFIG_MLP_PARSER 0
-#define CONFIG_MPEG4VIDEO_PARSER 0
-#define CONFIG_MPEGAUDIO_PARSER 0
-#define CONFIG_MPEGVIDEO_PARSER 0
-#define CONFIG_OPUS_PARSER 0
-#define CONFIG_PNG_PARSER 0
-#define CONFIG_PNM_PARSER 0
-#define CONFIG_RV30_PARSER 0
-#define CONFIG_RV40_PARSER 0
-#define CONFIG_TAK_PARSER 0
-#define CONFIG_VC1_PARSER 0
-#define CONFIG_VORBIS_PARSER 0
-#define CONFIG_VP3_PARSER 0
+#define CONFIG_FLAC_PARSER 0
#define CONFIG_VP8_PARSER 1
#define CONFIG_VP9_PARSER 1
-#define CONFIG_ASYNC_PROTOCOL 0
-#define CONFIG_BLURAY_PROTOCOL 0
-#define CONFIG_CACHE_PROTOCOL 0
-#define CONFIG_CONCAT_PROTOCOL 0
-#define CONFIG_CRYPTO_PROTOCOL 0
-#define CONFIG_DATA_PROTOCOL 0
-#define CONFIG_FFRTMPCRYPT_PROTOCOL 0
-#define CONFIG_FFRTMPHTTP_PROTOCOL 0
-#define CONFIG_FILE_PROTOCOL 0
-#define CONFIG_FTP_PROTOCOL 0
-#define CONFIG_GOPHER_PROTOCOL 0
-#define CONFIG_HLS_PROTOCOL 0
-#define CONFIG_HTTP_PROTOCOL 0
-#define CONFIG_HTTPPROXY_PROTOCOL 0
-#define CONFIG_HTTPS_PROTOCOL 0
-#define CONFIG_ICECAST_PROTOCOL 0
-#define CONFIG_MMSH_PROTOCOL 0
-#define CONFIG_MMST_PROTOCOL 0
-#define CONFIG_MD5_PROTOCOL 0
-#define CONFIG_PIPE_PROTOCOL 0
-#define CONFIG_RTMP_PROTOCOL 0
-#define CONFIG_RTMPE_PROTOCOL 0
-#define CONFIG_RTMPS_PROTOCOL 0
-#define CONFIG_RTMPT_PROTOCOL 0
-#define CONFIG_RTMPTE_PROTOCOL 0
-#define CONFIG_RTMPTS_PROTOCOL 0
-#define CONFIG_RTP_PROTOCOL 0
-#define CONFIG_SCTP_PROTOCOL 0
-#define CONFIG_SRTP_PROTOCOL 0
-#define CONFIG_SUBFILE_PROTOCOL 0
-#define CONFIG_TEE_PROTOCOL 0
-#define CONFIG_TCP_PROTOCOL 0
-#define CONFIG_TLS_GNUTLS_PROTOCOL 0
-#define CONFIG_TLS_SCHANNEL_PROTOCOL 0
-#define CONFIG_TLS_SECURETRANSPORT_PROTOCOL 0
-#define CONFIG_TLS_OPENSSL_PROTOCOL 0
-#define CONFIG_UDP_PROTOCOL 0
-#define CONFIG_UDPLITE_PROTOCOL 0
-#define CONFIG_UNIX_PROTOCOL 0
-#define CONFIG_LIBRTMP_PROTOCOL 0
-#define CONFIG_LIBRTMPE_PROTOCOL 0
-#define CONFIG_LIBRTMPS_PROTOCOL 0
-#define CONFIG_LIBRTMPT_PROTOCOL 0
-#define CONFIG_LIBRTMPTE_PROTOCOL 0
-#define CONFIG_LIBSSH_PROTOCOL 0
-#define CONFIG_LIBSMBCLIENT_PROTOCOL 0
#endif /* FFMPEG_CONFIG_H */
diff --git a/media/ffvpx/config_win64.asm b/media/ffvpx/config_win64.asm
index d2ff064862..58c61e9709 100644
--- a/media/ffvpx/config_win64.asm
+++ b/media/ffvpx/config_win64.asm
@@ -63,8 +63,8 @@
%define HAVE_MIPSDSP 0
%define HAVE_MIPSDSPR2 0
%define HAVE_MSA 0
-%define HAVE_LOONGSON2 1
-%define HAVE_LOONGSON3 1
+%define HAVE_LOONGSON2 0
+%define HAVE_LOONGSON3 0
%define HAVE_MMI 0
%define HAVE_ARMV5TE_EXTERNAL 0
%define HAVE_ARMV6_EXTERNAL 0
@@ -156,37 +156,38 @@
%define HAVE_MMI_INLINE 0
%define HAVE_ALIGNED_STACK 1
%define HAVE_FAST_64BIT 1
-%define HAVE_FAST_CLZ 1
+%define HAVE_FAST_CLZ 0
%define HAVE_FAST_CMOV 1
%define HAVE_LOCAL_ALIGNED_8 1
%define HAVE_LOCAL_ALIGNED_16 1
%define HAVE_LOCAL_ALIGNED_32 1
%define HAVE_SIMD_ALIGN_16 1
+%define HAVE_SIMD_ALIGN_32 1
%define HAVE_ATOMICS_GCC 0
%define HAVE_ATOMICS_SUNCC 0
%define HAVE_ATOMICS_WIN32 1
%define HAVE_ATOMIC_CAS_PTR 0
-%define HAVE_ATOMIC_COMPARE_EXCHANGE 0
%define HAVE_MACHINE_RW_BARRIER 0
%define HAVE_MEMORYBARRIER 1
%define HAVE_MM_EMPTY 0
%define HAVE_RDTSC 1
%define HAVE_SARESTART 0
-%define HAVE_SEM_TIMEDWAIT 1
+%define HAVE_SEM_TIMEDWAIT 0
%define HAVE_SYNC_VAL_COMPARE_AND_SWAP 0
%define HAVE_CABS 0
%define HAVE_CEXP 0
%define HAVE_INLINE_ASM 0
%define HAVE_SYMVER 0
-%define HAVE_YASM 1
+%define HAVE_X86ASM 1
%define HAVE_BIGENDIAN 0
%define HAVE_FAST_UNALIGNED 1
-%define HAVE_ALSA_ASOUNDLIB_H 0
%define HAVE_ALTIVEC_H 0
%define HAVE_ARPA_INET_H 0
%define HAVE_ASM_TYPES_H 0
%define HAVE_CDIO_PARANOIA_H 0
%define HAVE_CDIO_PARANOIA_PARANOIA_H 0
+%define HAVE_CUDA_H 0
+%define HAVE_D3D11_H 1
%define HAVE_DISPATCH_DISPATCH_H 0
%define HAVE_DEV_BKTR_IOCTL_BT848_H 0
%define HAVE_DEV_BKTR_IOCTL_METEOR_H 0
@@ -196,7 +197,7 @@
%define HAVE_DIRECT_H 1
%define HAVE_DIRENT_H 0
%define HAVE_DLFCN_H 0
-%define HAVE_D3D11_H 1
+%define HAVE_DXGIDEBUG_H 1
%define HAVE_DXVA_H 1
%define HAVE_ES2_GL_H 0
%define HAVE_GSM_H 0
@@ -205,13 +206,15 @@
%define HAVE_MACHINE_IOCTL_BT848_H 0
%define HAVE_MACHINE_IOCTL_METEOR_H 0
%define HAVE_OPENCV2_CORE_CORE_C_H 0
+%define HAVE_OPENJPEG_2_3_OPENJPEG_H 0
+%define HAVE_OPENJPEG_2_2_OPENJPEG_H 0
%define HAVE_OPENJPEG_2_1_OPENJPEG_H 0
%define HAVE_OPENJPEG_2_0_OPENJPEG_H 0
%define HAVE_OPENJPEG_1_5_OPENJPEG_H 0
%define HAVE_OPENGL_GL3_H 0
%define HAVE_POLL_H 0
-%define HAVE_SNDIO_H 0
%define HAVE_SOUNDCARD_H 0
+%define HAVE_STDATOMIC_H 0
%define HAVE_SYS_MMAN_H 0
%define HAVE_SYS_PARAM_H 0
%define HAVE_SYS_RESOURCE_H 0
@@ -263,7 +266,6 @@
%define HAVE_COMMANDLINETOARGVW 1
%define HAVE_COTASKMEMFREE 1
%define HAVE_CRYPTGENRANDOM 1
-%define HAVE_DLOPEN 0
%define HAVE_FCNTL 0
%define HAVE_FLT_LIM 1
%define HAVE_FORK 0
@@ -283,7 +285,7 @@
%define HAVE_ISATTY 1
%define HAVE_JACK_PORT_GET_LATENCY_RANGE 0
%define HAVE_KBHIT 1
-%define HAVE_LOADLIBRARY 0
+%define HAVE_LOADLIBRARY 1
%define HAVE_LSTAT 0
%define HAVE_LZO1X_999_COMPRESS 0
%define HAVE_MACH_ABSOLUTE_TIME 0
@@ -311,11 +313,13 @@
%define HAVE_OS2THREADS 0
%define HAVE_W32THREADS 1
%define HAVE_AS_DN_DIRECTIVE 0
+%define HAVE_AS_FPU_DIRECTIVE 0
%define HAVE_AS_FUNC 0
%define HAVE_AS_OBJECT_ARCH 0
%define HAVE_ASM_MOD_Q 0
%define HAVE_ATTRIBUTE_MAY_ALIAS 0
%define HAVE_ATTRIBUTE_PACKED 0
+%define HAVE_BLOCKS_EXTENSION 0
%define HAVE_EBP_AVAILABLE 0
%define HAVE_EBX_AVAILABLE 0
%define HAVE_GNU_AS 0
@@ -332,12 +336,13 @@
%define HAVE_XFORM_ASM 0
%define HAVE_XMM_CLOBBERS 0
%define HAVE_CONDITION_VARIABLE_PTR 1
+%define HAVE_KCMVIDEOCODECTYPE_HEVC 0
%define HAVE_SOCKLEN_T 1
%define HAVE_STRUCT_ADDRINFO 1
%define HAVE_STRUCT_GROUP_SOURCE_REQ 1
%define HAVE_STRUCT_IP_MREQ_SOURCE 1
%define HAVE_STRUCT_IPV6_MREQ 1
-%define HAVE_STRUCT_MSGHDR_MSG_FLAGS 1
+%define HAVE_STRUCT_MSGHDR_MSG_FLAGS 0
%define HAVE_STRUCT_POLLFD 0
%define HAVE_STRUCT_RUSAGE_RU_MAXRSS 0
%define HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE 0
@@ -348,36 +353,20 @@
%define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 0
%define HAVE_ATOMICS_NATIVE 1
%define HAVE_DOS_PATHS 1
-%define HAVE_DXVA2_LIB 0
-%define HAVE_DXVA2API_COBJ 1
%define HAVE_LIBC_MSVCRT 1
-%define HAVE_LIBDC1394_1 0
-%define HAVE_LIBDC1394_2 0
%define HAVE_MAKEINFO 1
%define HAVE_MAKEINFO_HTML 0
%define HAVE_MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS 0
%define HAVE_PERL 1
%define HAVE_POD2MAN 1
-%define HAVE_SDL2 0
%define HAVE_SECTION_DATA_REL_RO 0
%define HAVE_TEXI2HTML 0
%define HAVE_THREADS 1
+%define HAVE_UWP 0
%define HAVE_VAAPI_DRM 0
%define HAVE_VAAPI_X11 0
%define HAVE_VDPAU_X11 0
%define HAVE_WINRT 0
-%define HAVE_XLIB 0
-%define CONFIG_BSFS 0
-%define CONFIG_DECODERS 1
-%define CONFIG_ENCODERS 0
-%define CONFIG_HWACCELS 0
-%define CONFIG_PARSERS 1
-%define CONFIG_INDEVS 0
-%define CONFIG_OUTDEVS 0
-%define CONFIG_FILTERS 0
-%define CONFIG_DEMUXERS 0
-%define CONFIG_MUXERS 0
-%define CONFIG_PROTOCOLS 0
%define CONFIG_DOC 0
%define CONFIG_HTMLPAGES 0
%define CONFIG_MANPAGES 1
@@ -385,13 +374,17 @@
%define CONFIG_TXTPAGES 1
%define CONFIG_AVIO_DIR_CMD_EXAMPLE 1
%define CONFIG_AVIO_READING_EXAMPLE 1
-%define CONFIG_DECODING_ENCODING_EXAMPLE 0
+%define CONFIG_DECODE_AUDIO_EXAMPLE 1
+%define CONFIG_DECODE_VIDEO_EXAMPLE 1
%define CONFIG_DEMUXING_DECODING_EXAMPLE 0
+%define CONFIG_ENCODE_AUDIO_EXAMPLE 1
+%define CONFIG_ENCODE_VIDEO_EXAMPLE 1
%define CONFIG_EXTRACT_MVS_EXAMPLE 0
%define CONFIG_FILTER_AUDIO_EXAMPLE 0
%define CONFIG_FILTERING_AUDIO_EXAMPLE 0
%define CONFIG_FILTERING_VIDEO_EXAMPLE 0
%define CONFIG_HTTP_MULTICLIENT_EXAMPLE 0
+%define CONFIG_HW_DECODE_EXAMPLE 0
%define CONFIG_METADATA_EXAMPLE 0
%define CONFIG_MUXING_EXAMPLE 0
%define CONFIG_QSVDEC_EXAMPLE 0
@@ -400,27 +393,55 @@
%define CONFIG_SCALING_VIDEO_EXAMPLE 0
%define CONFIG_TRANSCODE_AAC_EXAMPLE 0
%define CONFIG_TRANSCODING_EXAMPLE 0
-%define CONFIG_AVISYNTH 0
+%define CONFIG_ALSA 0
+%define CONFIG_APPKIT 0
+%define CONFIG_AVFOUNDATION 0
%define CONFIG_BZLIB 0
-%define CONFIG_CHROMAPRINT 0
-%define CONFIG_CRYSTALHD 0
-%define CONFIG_DECKLINK 0
+%define CONFIG_COREIMAGE 0
+%define CONFIG_ICONV 0
+%define CONFIG_JACK 0
+%define CONFIG_LIBXCB 0
+%define CONFIG_LIBXCB_SHM 0
+%define CONFIG_LIBXCB_SHAPE 0
+%define CONFIG_LIBXCB_XFIXES 0
+%define CONFIG_LZMA 0
+%define CONFIG_SCHANNEL 1
+%define CONFIG_SDL2 0
+%define CONFIG_SECURETRANSPORT 0
+%define CONFIG_SNDIO 0
+%define CONFIG_XLIB 1
+%define CONFIG_ZLIB 0
+%define CONFIG_AVISYNTH 0
%define CONFIG_FREI0R 0
-%define CONFIG_GCRYPT 0
+%define CONFIG_LIBCDIO 0
+%define CONFIG_LIBRUBBERBAND 0
+%define CONFIG_LIBVIDSTAB 0
+%define CONFIG_LIBX264 0
+%define CONFIG_LIBX265 0
+%define CONFIG_LIBXAVS 0
+%define CONFIG_LIBXVID 0
+%define CONFIG_DECKLINK 0
+%define CONFIG_LIBNDI_NEWTEK 0
+%define CONFIG_LIBFDK_AAC 0
+%define CONFIG_OPENSSL 0
%define CONFIG_GMP 0
+%define CONFIG_LIBOPENCORE_AMRNB 0
+%define CONFIG_LIBOPENCORE_AMRWB 0
+%define CONFIG_LIBVO_AMRWBENC 0
+%define CONFIG_RKMPP 0
+%define CONFIG_LIBSMBCLIENT 0
+%define CONFIG_CHROMAPRINT 0
+%define CONFIG_GCRYPT 0
%define CONFIG_GNUTLS 0
-%define CONFIG_ICONV 0
%define CONFIG_JNI 0
%define CONFIG_LADSPA 0
%define CONFIG_LIBASS 0
%define CONFIG_LIBBLURAY 0
%define CONFIG_LIBBS2B 0
%define CONFIG_LIBCACA 0
-%define CONFIG_LIBCDIO 0
%define CONFIG_LIBCELT 0
%define CONFIG_LIBDC1394 0
-%define CONFIG_LIBEBUR128 0
-%define CONFIG_LIBFDK_AAC 0
+%define CONFIG_LIBDRM 0
%define CONFIG_LIBFLITE 0
%define CONFIG_LIBFONTCONFIG 0
%define CONFIG_LIBFREETYPE 0
@@ -432,18 +453,15 @@
%define CONFIG_LIBKVAZAAR 0
%define CONFIG_LIBMODPLUG 0
%define CONFIG_LIBMP3LAME 0
-%define CONFIG_LIBNUT 0
-%define CONFIG_LIBOPENCORE_AMRNB 0
-%define CONFIG_LIBOPENCORE_AMRWB 0
+%define CONFIG_LIBMYSOFA 0
%define CONFIG_LIBOPENCV 0
%define CONFIG_LIBOPENH264 0
%define CONFIG_LIBOPENJPEG 0
%define CONFIG_LIBOPENMPT 0
%define CONFIG_LIBOPUS 0
%define CONFIG_LIBPULSE 0
+%define CONFIG_LIBRSVG 0
%define CONFIG_LIBRTMP 0
-%define CONFIG_LIBRUBBERBAND 0
-%define CONFIG_LIBSCHROEDINGER 0
%define CONFIG_LIBSHINE 0
%define CONFIG_LIBSMBCLIENT 0
%define CONFIG_LIBSNAPPY 0
@@ -454,53 +472,37 @@
%define CONFIG_LIBTHEORA 0
%define CONFIG_LIBTWOLAME 0
%define CONFIG_LIBV4L2 0
-%define CONFIG_LIBVIDSTAB 0
-%define CONFIG_LIBVO_AMRWBENC 0
+%define CONFIG_LIBVMAF 0
%define CONFIG_LIBVORBIS 0
%define CONFIG_LIBVPX 0
%define CONFIG_LIBWAVPACK 0
%define CONFIG_LIBWEBP 0
-%define CONFIG_LIBX264 0
-%define CONFIG_LIBX265 0
-%define CONFIG_LIBXAVS 0
-%define CONFIG_LIBXCB 0
-%define CONFIG_LIBXCB_SHM 0
-%define CONFIG_LIBXCB_SHAPE 0
-%define CONFIG_LIBXCB_XFIXES 0
-%define CONFIG_LIBXVID 0
+%define CONFIG_LIBXML2 0
%define CONFIG_LIBZIMG 0
%define CONFIG_LIBZMQ 0
%define CONFIG_LIBZVBI 0
-%define CONFIG_LZMA 0
%define CONFIG_MEDIACODEC 0
-%define CONFIG_NETCDF 0
%define CONFIG_OPENAL 0
%define CONFIG_OPENCL 0
%define CONFIG_OPENGL 0
-%define CONFIG_OPENSSL 0
-%define CONFIG_SCHANNEL 1
-%define CONFIG_SDL 0
-%define CONFIG_SDL2 0
-%define CONFIG_SECURETRANSPORT 0
-%define CONFIG_VIDEOTOOLBOX 0
-%define CONFIG_X11GRAB 0
-%define CONFIG_XLIB 0
-%define CONFIG_ZLIB 0
%define CONFIG_AUDIOTOOLBOX 0
-%define CONFIG_CUDA 0
-%define CONFIG_CUVID 0
+%define CONFIG_CRYSTALHD 0
+%define CONFIG_CUDA 1
+%define CONFIG_CUVID 1
%define CONFIG_D3D11VA 0
%define CONFIG_DXVA2 0
-%define CONFIG_LIBMFX 0
-%define CONFIG_LIBNPP 0
-%define CONFIG_MMAL 0
-%define CONFIG_NVENC 0
-%define CONFIG_OMX 0
+%define CONFIG_NVENC 1
%define CONFIG_VAAPI 0
%define CONFIG_VDA 0
%define CONFIG_VDPAU 0
-%define CONFIG_VIDEOTOOLBOX_HWACCEL 0
+%define CONFIG_VIDEOTOOLBOX 0
+%define CONFIG_V4L2_M2M 0
%define CONFIG_XVMC 0
+%define CONFIG_CUDA_SDK 0
+%define CONFIG_LIBNPP 0
+%define CONFIG_LIBMFX 0
+%define CONFIG_MMAL 0
+%define CONFIG_OMX 0
%define CONFIG_FTRAPV 0
%define CONFIG_GRAY 0
%define CONFIG_HARDCODED_TABLES 0
@@ -539,16 +541,27 @@
%define CONFIG_PIXELUTILS 0
%define CONFIG_NETWORK 0
%define CONFIG_RDFT 0
+%define CONFIG_AUTODETECT 0
%define CONFIG_FONTCONFIG 0
-%define CONFIG_MEMALIGN_HACK 0
+%define CONFIG_LINUX_PERF 0
%define CONFIG_MEMORY_POISONING 0
%define CONFIG_NEON_CLOBBER_TEST 0
+%define CONFIG_OSSFUZZ 0
%define CONFIG_PIC 1
-%define CONFIG_POD2MAN 1
-%define CONFIG_RAISE_MAJOR 0
%define CONFIG_THUMB 0
%define CONFIG_VALGRIND_BACKTRACE 0
%define CONFIG_XMM_CLOBBER_TEST 0
+%define CONFIG_BSFS 1
+%define CONFIG_DECODERS 1
+%define CONFIG_ENCODERS 0
+%define CONFIG_HWACCELS 0
+%define CONFIG_PARSERS 1
+%define CONFIG_INDEVS 0
+%define CONFIG_OUTDEVS 0
+%define CONFIG_FILTERS 0
+%define CONFIG_DEMUXERS 0
+%define CONFIG_MUXERS 0
+%define CONFIG_PROTOCOLS 0
%define CONFIG_AANDCTTABLES 0
%define CONFIG_AC3DSP 0
%define CONFIG_AUDIO_FRAME_QUEUE 0
@@ -566,20 +579,22 @@
%define CONFIG_FMTCONVERT 0
%define CONFIG_FRAME_THREAD_ENCODER 0
%define CONFIG_G722DSP 0
-%define CONFIG_GOLOMB 1
+%define CONFIG_GOLOMB 0
%define CONFIG_GPLV3 0
%define CONFIG_H263DSP 0
%define CONFIG_H264CHROMA 0
%define CONFIG_H264DSP 0
+%define CONFIG_H264PARSE 0
%define CONFIG_H264PRED 1
%define CONFIG_H264QPEL 0
+%define CONFIG_HEVCPARSE 0
%define CONFIG_HPELDSP 0
%define CONFIG_HUFFMAN 0
%define CONFIG_HUFFYUVDSP 0
%define CONFIG_HUFFYUVENCDSP 0
%define CONFIG_IDCTDSP 0
%define CONFIG_IIRFILTER 0
-%define CONFIG_IMDCT15 0
+%define CONFIG_MDCT15 0
%define CONFIG_INTRAX8 0
%define CONFIG_ISO_MEDIA 0
%define CONFIG_IVIDSP 0
@@ -588,12 +603,14 @@
%define CONFIG_LIBX262 0
%define CONFIG_LLAUDDSP 0
%define CONFIG_LLVIDDSP 0
+%define CONFIG_LLVIDENCDSP 0
%define CONFIG_LPC 0
%define CONFIG_LZF 0
%define CONFIG_ME_CMP 0
%define CONFIG_MPEG_ER 0
%define CONFIG_MPEGAUDIO 0
%define CONFIG_MPEGAUDIODSP 0
+%define CONFIG_MPEGAUDIOHEADER 0
%define CONFIG_MPEGVIDEO 0
%define CONFIG_MPEGVIDEOENC 0
%define CONFIG_MSS34DSP 0
@@ -615,1594 +632,19 @@
%define CONFIG_TEXTUREDSP 0
%define CONFIG_TEXTUREDSPENC 0
%define CONFIG_TPELDSP 0
+%define CONFIG_VAAPI_1 0
%define CONFIG_VAAPI_ENCODE 0
%define CONFIG_VC1DSP 0
%define CONFIG_VIDEODSP 1
%define CONFIG_VP3DSP 0
%define CONFIG_VP56DSP 0
%define CONFIG_VP8DSP 1
-%define CONFIG_VT_BT2020 0
%define CONFIG_WMA_FREQS 0
%define CONFIG_WMV2DSP 0
-%define CONFIG_AAC_ADTSTOASC_BSF 0
-%define CONFIG_CHOMP_BSF 0
-%define CONFIG_DUMP_EXTRADATA_BSF 0
-%define CONFIG_DCA_CORE_BSF 0
-%define CONFIG_H264_MP4TOANNEXB_BSF 0
-%define CONFIG_HEVC_MP4TOANNEXB_BSF 0
-%define CONFIG_IMX_DUMP_HEADER_BSF 0
-%define CONFIG_MJPEG2JPEG_BSF 0
-%define CONFIG_MJPEGA_DUMP_HEADER_BSF 0
-%define CONFIG_MP3_HEADER_DECOMPRESS_BSF 0
-%define CONFIG_MPEG4_UNPACK_BFRAMES_BSF 0
-%define CONFIG_MOV2TEXTSUB_BSF 0
-%define CONFIG_NOISE_BSF 0
-%define CONFIG_REMOVE_EXTRADATA_BSF 0
-%define CONFIG_TEXT2MOVSUB_BSF 0
-%define CONFIG_VP9_SUPERFRAME_BSF 0
-%define CONFIG_AASC_DECODER 0
-%define CONFIG_AIC_DECODER 0
-%define CONFIG_ALIAS_PIX_DECODER 0
-%define CONFIG_AMV_DECODER 0
-%define CONFIG_ANM_DECODER 0
-%define CONFIG_ANSI_DECODER 0
-%define CONFIG_APNG_DECODER 0
-%define CONFIG_ASV1_DECODER 0
-%define CONFIG_ASV2_DECODER 0
-%define CONFIG_AURA_DECODER 0
-%define CONFIG_AURA2_DECODER 0
-%define CONFIG_AVRP_DECODER 0
-%define CONFIG_AVRN_DECODER 0
-%define CONFIG_AVS_DECODER 0
-%define CONFIG_AVUI_DECODER 0
-%define CONFIG_AYUV_DECODER 0
-%define CONFIG_BETHSOFTVID_DECODER 0
-%define CONFIG_BFI_DECODER 0
-%define CONFIG_BINK_DECODER 0
-%define CONFIG_BMP_DECODER 0
-%define CONFIG_BMV_VIDEO_DECODER 0
-%define CONFIG_BRENDER_PIX_DECODER 0
-%define CONFIG_C93_DECODER 0
-%define CONFIG_CAVS_DECODER 0
-%define CONFIG_CDGRAPHICS_DECODER 0
-%define CONFIG_CDXL_DECODER 0
-%define CONFIG_CFHD_DECODER 0
-%define CONFIG_CINEPAK_DECODER 0
-%define CONFIG_CLJR_DECODER 0
-%define CONFIG_CLLC_DECODER 0
-%define CONFIG_COMFORTNOISE_DECODER 0
-%define CONFIG_CPIA_DECODER 0
-%define CONFIG_CSCD_DECODER 0
-%define CONFIG_CYUV_DECODER 0
-%define CONFIG_DDS_DECODER 0
-%define CONFIG_DFA_DECODER 0
-%define CONFIG_DIRAC_DECODER 0
-%define CONFIG_DNXHD_DECODER 0
-%define CONFIG_DPX_DECODER 0
-%define CONFIG_DSICINVIDEO_DECODER 0
-%define CONFIG_DVAUDIO_DECODER 0
-%define CONFIG_DVVIDEO_DECODER 0
-%define CONFIG_DXA_DECODER 0
-%define CONFIG_DXTORY_DECODER 0
-%define CONFIG_DXV_DECODER 0
-%define CONFIG_EACMV_DECODER 0
-%define CONFIG_EAMAD_DECODER 0
-%define CONFIG_EATGQ_DECODER 0
-%define CONFIG_EATGV_DECODER 0
-%define CONFIG_EATQI_DECODER 0
-%define CONFIG_EIGHTBPS_DECODER 0
-%define CONFIG_EIGHTSVX_EXP_DECODER 0
-%define CONFIG_EIGHTSVX_FIB_DECODER 0
-%define CONFIG_ESCAPE124_DECODER 0
-%define CONFIG_ESCAPE130_DECODER 0
-%define CONFIG_EXR_DECODER 0
-%define CONFIG_FFV1_DECODER 0
-%define CONFIG_FFVHUFF_DECODER 0
-%define CONFIG_FIC_DECODER 0
-%define CONFIG_FLASHSV_DECODER 0
-%define CONFIG_FLASHSV2_DECODER 0
-%define CONFIG_FLIC_DECODER 0
-%define CONFIG_FLV_DECODER 0
-%define CONFIG_FOURXM_DECODER 0
-%define CONFIG_FRAPS_DECODER 0
-%define CONFIG_FRWU_DECODER 0
-%define CONFIG_G2M_DECODER 0
-%define CONFIG_GIF_DECODER 0
-%define CONFIG_H261_DECODER 0
-%define CONFIG_H263_DECODER 0
-%define CONFIG_H263I_DECODER 0
-%define CONFIG_H263P_DECODER 0
-%define CONFIG_H264_DECODER 0
-%define CONFIG_H264_CRYSTALHD_DECODER 0
-%define CONFIG_H264_MEDIACODEC_DECODER 0
-%define CONFIG_H264_MMAL_DECODER 0
-%define CONFIG_H264_QSV_DECODER 0
-%define CONFIG_H264_VDA_DECODER 0
-%define CONFIG_H264_VDPAU_DECODER 0
-%define CONFIG_HAP_DECODER 0
-%define CONFIG_HEVC_DECODER 0
-%define CONFIG_HEVC_QSV_DECODER 0
-%define CONFIG_HNM4_VIDEO_DECODER 0
-%define CONFIG_HQ_HQA_DECODER 0
-%define CONFIG_HQX_DECODER 0
-%define CONFIG_HUFFYUV_DECODER 0
-%define CONFIG_IDCIN_DECODER 0
-%define CONFIG_IFF_ILBM_DECODER 0
-%define CONFIG_INDEO2_DECODER 0
-%define CONFIG_INDEO3_DECODER 0
-%define CONFIG_INDEO4_DECODER 0
-%define CONFIG_INDEO5_DECODER 0
-%define CONFIG_INTERPLAY_VIDEO_DECODER 0
-%define CONFIG_JPEG2000_DECODER 0
-%define CONFIG_JPEGLS_DECODER 0
-%define CONFIG_JV_DECODER 0
-%define CONFIG_KGV1_DECODER 0
-%define CONFIG_KMVC_DECODER 0
-%define CONFIG_LAGARITH_DECODER 0
-%define CONFIG_LOCO_DECODER 0
-%define CONFIG_M101_DECODER 0
-%define CONFIG_MAGICYUV_DECODER 0
-%define CONFIG_MDEC_DECODER 0
-%define CONFIG_MIMIC_DECODER 0
-%define CONFIG_MJPEG_DECODER 0
-%define CONFIG_MJPEGB_DECODER 0
-%define CONFIG_MMVIDEO_DECODER 0
-%define CONFIG_MOTIONPIXELS_DECODER 0
-%define CONFIG_MPEG_XVMC_DECODER 0
-%define CONFIG_MPEG1VIDEO_DECODER 0
-%define CONFIG_MPEG2VIDEO_DECODER 0
-%define CONFIG_MPEG4_DECODER 0
-%define CONFIG_MPEG4_CRYSTALHD_DECODER 0
-%define CONFIG_MPEG4_MMAL_DECODER 0
-%define CONFIG_MPEG4_VDPAU_DECODER 0
-%define CONFIG_MPEGVIDEO_DECODER 0
-%define CONFIG_MPEG_VDPAU_DECODER 0
-%define CONFIG_MPEG1_VDPAU_DECODER 0
-%define CONFIG_MPEG2_MMAL_DECODER 0
-%define CONFIG_MPEG2_CRYSTALHD_DECODER 0
-%define CONFIG_MPEG2_QSV_DECODER 0
-%define CONFIG_MSA1_DECODER 0
-%define CONFIG_MSMPEG4_CRYSTALHD_DECODER 0
-%define CONFIG_MSMPEG4V1_DECODER 0
-%define CONFIG_MSMPEG4V2_DECODER 0
-%define CONFIG_MSMPEG4V3_DECODER 0
-%define CONFIG_MSRLE_DECODER 0
-%define CONFIG_MSS1_DECODER 0
-%define CONFIG_MSS2_DECODER 0
-%define CONFIG_MSVIDEO1_DECODER 0
-%define CONFIG_MSZH_DECODER 0
-%define CONFIG_MTS2_DECODER 0
-%define CONFIG_MVC1_DECODER 0
-%define CONFIG_MVC2_DECODER 0
-%define CONFIG_MXPEG_DECODER 0
-%define CONFIG_NUV_DECODER 0
-%define CONFIG_PAF_VIDEO_DECODER 0
-%define CONFIG_PAM_DECODER 0
-%define CONFIG_PBM_DECODER 0
-%define CONFIG_PCX_DECODER 0
-%define CONFIG_PGM_DECODER 0
-%define CONFIG_PGMYUV_DECODER 0
-%define CONFIG_PICTOR_DECODER 0
-%define CONFIG_PNG_DECODER 0
-%define CONFIG_PPM_DECODER 0
-%define CONFIG_PRORES_DECODER 0
-%define CONFIG_PRORES_LGPL_DECODER 0
-%define CONFIG_PTX_DECODER 0
-%define CONFIG_QDRAW_DECODER 0
-%define CONFIG_QPEG_DECODER 0
-%define CONFIG_QTRLE_DECODER 0
-%define CONFIG_R10K_DECODER 0
-%define CONFIG_R210_DECODER 0
-%define CONFIG_RAWVIDEO_DECODER 0
-%define CONFIG_RL2_DECODER 0
-%define CONFIG_ROQ_DECODER 0
-%define CONFIG_RPZA_DECODER 0
-%define CONFIG_RSCC_DECODER 0
-%define CONFIG_RV10_DECODER 0
-%define CONFIG_RV20_DECODER 0
-%define CONFIG_RV30_DECODER 0
-%define CONFIG_RV40_DECODER 0
-%define CONFIG_S302M_DECODER 0
-%define CONFIG_SANM_DECODER 0
-%define CONFIG_SCREENPRESSO_DECODER 0
-%define CONFIG_SDX2_DPCM_DECODER 0
-%define CONFIG_SGI_DECODER 0
-%define CONFIG_SGIRLE_DECODER 0
-%define CONFIG_SHEERVIDEO_DECODER 0
-%define CONFIG_SMACKER_DECODER 0
-%define CONFIG_SMC_DECODER 0
-%define CONFIG_SMVJPEG_DECODER 0
-%define CONFIG_SNOW_DECODER 0
-%define CONFIG_SP5X_DECODER 0
-%define CONFIG_SUNRAST_DECODER 0
-%define CONFIG_SVQ1_DECODER 0
-%define CONFIG_SVQ3_DECODER 0
-%define CONFIG_TARGA_DECODER 0
-%define CONFIG_TARGA_Y216_DECODER 0
-%define CONFIG_TDSC_DECODER 0
-%define CONFIG_THEORA_DECODER 0
-%define CONFIG_THP_DECODER 0
-%define CONFIG_TIERTEXSEQVIDEO_DECODER 0
-%define CONFIG_TIFF_DECODER 0
-%define CONFIG_TMV_DECODER 0
-%define CONFIG_TRUEMOTION1_DECODER 0
-%define CONFIG_TRUEMOTION2_DECODER 0
-%define CONFIG_TRUEMOTION2RT_DECODER 0
-%define CONFIG_TSCC_DECODER 0
-%define CONFIG_TSCC2_DECODER 0
-%define CONFIG_TXD_DECODER 0
-%define CONFIG_ULTI_DECODER 0
-%define CONFIG_UTVIDEO_DECODER 0
-%define CONFIG_V210_DECODER 0
-%define CONFIG_V210X_DECODER 0
-%define CONFIG_V308_DECODER 0
-%define CONFIG_V408_DECODER 0
-%define CONFIG_V410_DECODER 0
-%define CONFIG_VB_DECODER 0
-%define CONFIG_VBLE_DECODER 0
-%define CONFIG_VC1_DECODER 0
-%define CONFIG_VC1_CRYSTALHD_DECODER 0
-%define CONFIG_VC1_VDPAU_DECODER 0
-%define CONFIG_VC1IMAGE_DECODER 0
-%define CONFIG_VC1_MMAL_DECODER 0
-%define CONFIG_VC1_QSV_DECODER 0
-%define CONFIG_VCR1_DECODER 0
-%define CONFIG_VMDVIDEO_DECODER 0
-%define CONFIG_VMNC_DECODER 0
-%define CONFIG_VP3_DECODER 0
-%define CONFIG_VP5_DECODER 0
-%define CONFIG_VP6_DECODER 0
-%define CONFIG_VP6A_DECODER 0
-%define CONFIG_VP6F_DECODER 0
-%define CONFIG_VP7_DECODER 0
+%define CONFIG_NULL_BSF 1
%define CONFIG_VP8_DECODER 1
%define CONFIG_VP9_DECODER 1
-%define CONFIG_VQA_DECODER 0
-%define CONFIG_WEBP_DECODER 0
-%define CONFIG_WMV1_DECODER 0
-%define CONFIG_WMV2_DECODER 0
-%define CONFIG_WMV3_DECODER 0
-%define CONFIG_WMV3_CRYSTALHD_DECODER 0
-%define CONFIG_WMV3_VDPAU_DECODER 0
-%define CONFIG_WMV3IMAGE_DECODER 0
-%define CONFIG_WNV1_DECODER 0
-%define CONFIG_XAN_WC3_DECODER 0
-%define CONFIG_XAN_WC4_DECODER 0
-%define CONFIG_XBM_DECODER 0
-%define CONFIG_XFACE_DECODER 0
-%define CONFIG_XL_DECODER 0
-%define CONFIG_XWD_DECODER 0
-%define CONFIG_Y41P_DECODER 0
-%define CONFIG_YLC_DECODER 0
-%define CONFIG_YOP_DECODER 0
-%define CONFIG_YUV4_DECODER 0
-%define CONFIG_ZERO12V_DECODER 0
-%define CONFIG_ZEROCODEC_DECODER 0
-%define CONFIG_ZLIB_DECODER 0
-%define CONFIG_ZMBV_DECODER 0
-%define CONFIG_AAC_DECODER 0
-%define CONFIG_AAC_FIXED_DECODER 0
-%define CONFIG_AAC_LATM_DECODER 0
-%define CONFIG_AC3_DECODER 0
-%define CONFIG_AC3_FIXED_DECODER 0
-%define CONFIG_ALAC_DECODER 0
-%define CONFIG_ALS_DECODER 0
-%define CONFIG_AMRNB_DECODER 0
-%define CONFIG_AMRWB_DECODER 0
-%define CONFIG_APE_DECODER 0
-%define CONFIG_ATRAC1_DECODER 0
-%define CONFIG_ATRAC3_DECODER 0
-%define CONFIG_ATRAC3P_DECODER 0
-%define CONFIG_BINKAUDIO_DCT_DECODER 0
-%define CONFIG_BINKAUDIO_RDFT_DECODER 0
-%define CONFIG_BMV_AUDIO_DECODER 0
-%define CONFIG_COOK_DECODER 0
-%define CONFIG_DCA_DECODER 0
-%define CONFIG_DSD_LSBF_DECODER 0
-%define CONFIG_DSD_MSBF_DECODER 0
-%define CONFIG_DSD_LSBF_PLANAR_DECODER 0
-%define CONFIG_DSD_MSBF_PLANAR_DECODER 0
-%define CONFIG_DSICINAUDIO_DECODER 0
-%define CONFIG_DSS_SP_DECODER 0
-%define CONFIG_DST_DECODER 0
-%define CONFIG_EAC3_DECODER 0
-%define CONFIG_EVRC_DECODER 0
-%define CONFIG_FFWAVESYNTH_DECODER 0
%define CONFIG_FLAC_DECODER 1
-%define CONFIG_G723_1_DECODER 0
-%define CONFIG_G729_DECODER 0
-%define CONFIG_GSM_DECODER 0
-%define CONFIG_GSM_MS_DECODER 0
-%define CONFIG_IAC_DECODER 0
-%define CONFIG_IMC_DECODER 0
-%define CONFIG_INTERPLAY_ACM_DECODER 0
-%define CONFIG_MACE3_DECODER 0
-%define CONFIG_MACE6_DECODER 0
-%define CONFIG_METASOUND_DECODER 0
-%define CONFIG_MLP_DECODER 0
-%define CONFIG_MP1_DECODER 0
-%define CONFIG_MP1FLOAT_DECODER 0
-%define CONFIG_MP2_DECODER 0
-%define CONFIG_MP2FLOAT_DECODER 0
-%define CONFIG_MP3_DECODER 0
-%define CONFIG_MP3FLOAT_DECODER 0
-%define CONFIG_MP3ADU_DECODER 0
-%define CONFIG_MP3ADUFLOAT_DECODER 0
-%define CONFIG_MP3ON4_DECODER 0
-%define CONFIG_MP3ON4FLOAT_DECODER 0
-%define CONFIG_MPC7_DECODER 0
-%define CONFIG_MPC8_DECODER 0
-%define CONFIG_NELLYMOSER_DECODER 0
-%define CONFIG_ON2AVC_DECODER 0
-%define CONFIG_OPUS_DECODER 0
-%define CONFIG_PAF_AUDIO_DECODER 0
-%define CONFIG_QCELP_DECODER 0
-%define CONFIG_QDM2_DECODER 0
-%define CONFIG_RA_144_DECODER 0
-%define CONFIG_RA_288_DECODER 0
-%define CONFIG_RALF_DECODER 0
-%define CONFIG_SHORTEN_DECODER 0
-%define CONFIG_SIPR_DECODER 0
-%define CONFIG_SMACKAUD_DECODER 0
-%define CONFIG_SONIC_DECODER 0
-%define CONFIG_TAK_DECODER 0
-%define CONFIG_TRUEHD_DECODER 0
-%define CONFIG_TRUESPEECH_DECODER 0
-%define CONFIG_TTA_DECODER 0
-%define CONFIG_TWINVQ_DECODER 0
-%define CONFIG_VMDAUDIO_DECODER 0
-%define CONFIG_VORBIS_DECODER 0
-%define CONFIG_WAVPACK_DECODER 0
-%define CONFIG_WMALOSSLESS_DECODER 0
-%define CONFIG_WMAPRO_DECODER 0
-%define CONFIG_WMAV1_DECODER 0
-%define CONFIG_WMAV2_DECODER 0
-%define CONFIG_WMAVOICE_DECODER 0
-%define CONFIG_WS_SND1_DECODER 0
-%define CONFIG_XMA1_DECODER 0
-%define CONFIG_XMA2_DECODER 0
-%define CONFIG_PCM_ALAW_DECODER 0
-%define CONFIG_PCM_BLURAY_DECODER 0
-%define CONFIG_PCM_DVD_DECODER 0
-%define CONFIG_PCM_F32BE_DECODER 0
-%define CONFIG_PCM_F32LE_DECODER 0
-%define CONFIG_PCM_F64BE_DECODER 0
-%define CONFIG_PCM_F64LE_DECODER 0
-%define CONFIG_PCM_LXF_DECODER 0
-%define CONFIG_PCM_MULAW_DECODER 0
-%define CONFIG_PCM_S8_DECODER 0
-%define CONFIG_PCM_S8_PLANAR_DECODER 0
-%define CONFIG_PCM_S16BE_DECODER 0
-%define CONFIG_PCM_S16BE_PLANAR_DECODER 0
-%define CONFIG_PCM_S16LE_DECODER 0
-%define CONFIG_PCM_S16LE_PLANAR_DECODER 0
-%define CONFIG_PCM_S24BE_DECODER 0
-%define CONFIG_PCM_S24DAUD_DECODER 0
-%define CONFIG_PCM_S24LE_DECODER 0
-%define CONFIG_PCM_S24LE_PLANAR_DECODER 0
-%define CONFIG_PCM_S32BE_DECODER 0
-%define CONFIG_PCM_S32LE_DECODER 0
-%define CONFIG_PCM_S32LE_PLANAR_DECODER 0
-%define CONFIG_PCM_S64BE_DECODER 0
-%define CONFIG_PCM_S64LE_DECODER 0
-%define CONFIG_PCM_U8_DECODER 0
-%define CONFIG_PCM_U16BE_DECODER 0
-%define CONFIG_PCM_U16LE_DECODER 0
-%define CONFIG_PCM_U24BE_DECODER 0
-%define CONFIG_PCM_U24LE_DECODER 0
-%define CONFIG_PCM_U32BE_DECODER 0
-%define CONFIG_PCM_U32LE_DECODER 0
-%define CONFIG_PCM_ZORK_DECODER 0
-%define CONFIG_INTERPLAY_DPCM_DECODER 0
-%define CONFIG_ROQ_DPCM_DECODER 0
-%define CONFIG_SOL_DPCM_DECODER 0
-%define CONFIG_XAN_DPCM_DECODER 0
-%define CONFIG_ADPCM_4XM_DECODER 0
-%define CONFIG_ADPCM_ADX_DECODER 0
-%define CONFIG_ADPCM_AFC_DECODER 0
-%define CONFIG_ADPCM_AICA_DECODER 0
-%define CONFIG_ADPCM_CT_DECODER 0
-%define CONFIG_ADPCM_DTK_DECODER 0
-%define CONFIG_ADPCM_EA_DECODER 0
-%define CONFIG_ADPCM_EA_MAXIS_XA_DECODER 0
-%define CONFIG_ADPCM_EA_R1_DECODER 0
-%define CONFIG_ADPCM_EA_R2_DECODER 0
-%define CONFIG_ADPCM_EA_R3_DECODER 0
-%define CONFIG_ADPCM_EA_XAS_DECODER 0
-%define CONFIG_ADPCM_G722_DECODER 0
-%define CONFIG_ADPCM_G726_DECODER 0
-%define CONFIG_ADPCM_G726LE_DECODER 0
-%define CONFIG_ADPCM_IMA_AMV_DECODER 0
-%define CONFIG_ADPCM_IMA_APC_DECODER 0
-%define CONFIG_ADPCM_IMA_DAT4_DECODER 0
-%define CONFIG_ADPCM_IMA_DK3_DECODER 0
-%define CONFIG_ADPCM_IMA_DK4_DECODER 0
-%define CONFIG_ADPCM_IMA_EA_EACS_DECODER 0
-%define CONFIG_ADPCM_IMA_EA_SEAD_DECODER 0
-%define CONFIG_ADPCM_IMA_ISS_DECODER 0
-%define CONFIG_ADPCM_IMA_OKI_DECODER 0
-%define CONFIG_ADPCM_IMA_QT_DECODER 0
-%define CONFIG_ADPCM_IMA_RAD_DECODER 0
-%define CONFIG_ADPCM_IMA_SMJPEG_DECODER 0
-%define CONFIG_ADPCM_IMA_WAV_DECODER 0
-%define CONFIG_ADPCM_IMA_WS_DECODER 0
-%define CONFIG_ADPCM_MS_DECODER 0
-%define CONFIG_ADPCM_MTAF_DECODER 0
-%define CONFIG_ADPCM_PSX_DECODER 0
-%define CONFIG_ADPCM_SBPRO_2_DECODER 0
-%define CONFIG_ADPCM_SBPRO_3_DECODER 0
-%define CONFIG_ADPCM_SBPRO_4_DECODER 0
-%define CONFIG_ADPCM_SWF_DECODER 0
-%define CONFIG_ADPCM_THP_DECODER 0
-%define CONFIG_ADPCM_THP_LE_DECODER 0
-%define CONFIG_ADPCM_VIMA_DECODER 0
-%define CONFIG_ADPCM_XA_DECODER 0
-%define CONFIG_ADPCM_YAMAHA_DECODER 0
-%define CONFIG_SSA_DECODER 0
-%define CONFIG_ASS_DECODER 0
-%define CONFIG_CCAPTION_DECODER 0
-%define CONFIG_DVBSUB_DECODER 0
-%define CONFIG_DVDSUB_DECODER 0
-%define CONFIG_JACOSUB_DECODER 0
-%define CONFIG_MICRODVD_DECODER 0
-%define CONFIG_MOVTEXT_DECODER 0
-%define CONFIG_MPL2_DECODER 0
-%define CONFIG_PGSSUB_DECODER 0
-%define CONFIG_PJS_DECODER 0
-%define CONFIG_REALTEXT_DECODER 0
-%define CONFIG_SAMI_DECODER 0
-%define CONFIG_SRT_DECODER 0
-%define CONFIG_STL_DECODER 0
-%define CONFIG_SUBRIP_DECODER 0
-%define CONFIG_SUBVIEWER_DECODER 0
-%define CONFIG_SUBVIEWER1_DECODER 0
-%define CONFIG_TEXT_DECODER 0
-%define CONFIG_VPLAYER_DECODER 0
-%define CONFIG_WEBVTT_DECODER 0
-%define CONFIG_XSUB_DECODER 0
-%define CONFIG_AAC_AT_DECODER 0
-%define CONFIG_AC3_AT_DECODER 0
-%define CONFIG_ADPCM_IMA_QT_AT_DECODER 0
-%define CONFIG_ALAC_AT_DECODER 0
-%define CONFIG_AMR_NB_AT_DECODER 0
-%define CONFIG_EAC3_AT_DECODER 0
-%define CONFIG_GSM_MS_AT_DECODER 0
-%define CONFIG_ILBC_AT_DECODER 0
-%define CONFIG_MP1_AT_DECODER 0
-%define CONFIG_MP2_AT_DECODER 0
-%define CONFIG_MP3_AT_DECODER 0
-%define CONFIG_PCM_ALAW_AT_DECODER 0
-%define CONFIG_PCM_MULAW_AT_DECODER 0
-%define CONFIG_QDMC_AT_DECODER 0
-%define CONFIG_QDM2_AT_DECODER 0
-%define CONFIG_LIBCELT_DECODER 0
-%define CONFIG_LIBFDK_AAC_DECODER 0
-%define CONFIG_LIBGSM_DECODER 0
-%define CONFIG_LIBGSM_MS_DECODER 0
-%define CONFIG_LIBILBC_DECODER 0
-%define CONFIG_LIBOPENCORE_AMRNB_DECODER 0
-%define CONFIG_LIBOPENCORE_AMRWB_DECODER 0
-%define CONFIG_LIBOPENJPEG_DECODER 0
-%define CONFIG_LIBOPUS_DECODER 0
-%define CONFIG_LIBSCHROEDINGER_DECODER 0
-%define CONFIG_LIBSPEEX_DECODER 0
-%define CONFIG_LIBVORBIS_DECODER 0
-%define CONFIG_LIBVPX_VP8_DECODER 0
-%define CONFIG_LIBVPX_VP9_DECODER 0
-%define CONFIG_LIBZVBI_TELETEXT_DECODER 0
-%define CONFIG_BINTEXT_DECODER 0
-%define CONFIG_XBIN_DECODER 0
-%define CONFIG_IDF_DECODER 0
-%define CONFIG_LIBOPENH264_DECODER 0
-%define CONFIG_H263_CUVID_DECODER 0
-%define CONFIG_H264_CUVID_DECODER 0
-%define CONFIG_HEVC_CUVID_DECODER 0
-%define CONFIG_HEVC_MEDIACODEC_DECODER 0
-%define CONFIG_MJPEG_CUVID_DECODER 0
-%define CONFIG_MPEG1_CUVID_DECODER 0
-%define CONFIG_MPEG2_CUVID_DECODER 0
-%define CONFIG_MPEG4_CUVID_DECODER 0
-%define CONFIG_MPEG4_MEDIACODEC_DECODER 0
-%define CONFIG_VC1_CUVID_DECODER 0
-%define CONFIG_VP8_CUVID_DECODER 0
-%define CONFIG_VP8_MEDIACODEC_DECODER 0
-%define CONFIG_VP9_CUVID_DECODER 0
-%define CONFIG_VP9_MEDIACODEC_DECODER 0
-%define CONFIG_AA_DEMUXER 0
-%define CONFIG_AAC_DEMUXER 0
-%define CONFIG_AC3_DEMUXER 0
-%define CONFIG_ACM_DEMUXER 0
-%define CONFIG_ACT_DEMUXER 0
-%define CONFIG_ADF_DEMUXER 0
-%define CONFIG_ADP_DEMUXER 0
-%define CONFIG_ADS_DEMUXER 0
-%define CONFIG_ADX_DEMUXER 0
-%define CONFIG_AEA_DEMUXER 0
-%define CONFIG_AFC_DEMUXER 0
-%define CONFIG_AIFF_DEMUXER 0
-%define CONFIG_AIX_DEMUXER 0
-%define CONFIG_AMR_DEMUXER 0
-%define CONFIG_ANM_DEMUXER 0
-%define CONFIG_APC_DEMUXER 0
-%define CONFIG_APE_DEMUXER 0
-%define CONFIG_APNG_DEMUXER 0
-%define CONFIG_AQTITLE_DEMUXER 0
-%define CONFIG_ASF_DEMUXER 0
-%define CONFIG_ASF_O_DEMUXER 0
-%define CONFIG_ASS_DEMUXER 0
-%define CONFIG_AST_DEMUXER 0
-%define CONFIG_AU_DEMUXER 0
-%define CONFIG_AVI_DEMUXER 0
-%define CONFIG_AVISYNTH_DEMUXER 0
-%define CONFIG_AVR_DEMUXER 0
-%define CONFIG_AVS_DEMUXER 0
-%define CONFIG_BETHSOFTVID_DEMUXER 0
-%define CONFIG_BFI_DEMUXER 0
-%define CONFIG_BINTEXT_DEMUXER 0
-%define CONFIG_BINK_DEMUXER 0
-%define CONFIG_BIT_DEMUXER 0
-%define CONFIG_BMV_DEMUXER 0
-%define CONFIG_BFSTM_DEMUXER 0
-%define CONFIG_BRSTM_DEMUXER 0
-%define CONFIG_BOA_DEMUXER 0
-%define CONFIG_C93_DEMUXER 0
-%define CONFIG_CAF_DEMUXER 0
-%define CONFIG_CAVSVIDEO_DEMUXER 0
-%define CONFIG_CDG_DEMUXER 0
-%define CONFIG_CDXL_DEMUXER 0
-%define CONFIG_CINE_DEMUXER 0
-%define CONFIG_CONCAT_DEMUXER 0
-%define CONFIG_DATA_DEMUXER 0
-%define CONFIG_DAUD_DEMUXER 0
-%define CONFIG_DCSTR_DEMUXER 0
-%define CONFIG_DFA_DEMUXER 0
-%define CONFIG_DIRAC_DEMUXER 0
-%define CONFIG_DNXHD_DEMUXER 0
-%define CONFIG_DSF_DEMUXER 0
-%define CONFIG_DSICIN_DEMUXER 0
-%define CONFIG_DSS_DEMUXER 0
-%define CONFIG_DTS_DEMUXER 0
-%define CONFIG_DTSHD_DEMUXER 0
-%define CONFIG_DV_DEMUXER 0
-%define CONFIG_DVBSUB_DEMUXER 0
-%define CONFIG_DVBTXT_DEMUXER 0
-%define CONFIG_DXA_DEMUXER 0
-%define CONFIG_EA_DEMUXER 0
-%define CONFIG_EA_CDATA_DEMUXER 0
-%define CONFIG_EAC3_DEMUXER 0
-%define CONFIG_EPAF_DEMUXER 0
-%define CONFIG_FFM_DEMUXER 0
-%define CONFIG_FFMETADATA_DEMUXER 0
-%define CONFIG_FILMSTRIP_DEMUXER 0
-%define CONFIG_FLAC_DEMUXER 0
-%define CONFIG_FLIC_DEMUXER 0
-%define CONFIG_FLV_DEMUXER 0
-%define CONFIG_LIVE_FLV_DEMUXER 0
-%define CONFIG_FOURXM_DEMUXER 0
-%define CONFIG_FRM_DEMUXER 0
-%define CONFIG_FSB_DEMUXER 0
-%define CONFIG_G722_DEMUXER 0
-%define CONFIG_G723_1_DEMUXER 0
-%define CONFIG_G729_DEMUXER 0
-%define CONFIG_GENH_DEMUXER 0
-%define CONFIG_GIF_DEMUXER 0
-%define CONFIG_GSM_DEMUXER 0
-%define CONFIG_GXF_DEMUXER 0
-%define CONFIG_H261_DEMUXER 0
-%define CONFIG_H263_DEMUXER 0
-%define CONFIG_H264_DEMUXER 0
-%define CONFIG_HEVC_DEMUXER 0
-%define CONFIG_HLS_DEMUXER 0
-%define CONFIG_HNM_DEMUXER 0
-%define CONFIG_ICO_DEMUXER 0
-%define CONFIG_IDCIN_DEMUXER 0
-%define CONFIG_IDF_DEMUXER 0
-%define CONFIG_IFF_DEMUXER 0
-%define CONFIG_ILBC_DEMUXER 0
-%define CONFIG_IMAGE2_DEMUXER 0
-%define CONFIG_IMAGE2PIPE_DEMUXER 0
-%define CONFIG_IMAGE2_ALIAS_PIX_DEMUXER 0
-%define CONFIG_IMAGE2_BRENDER_PIX_DEMUXER 0
-%define CONFIG_INGENIENT_DEMUXER 0
-%define CONFIG_IPMOVIE_DEMUXER 0
-%define CONFIG_IRCAM_DEMUXER 0
-%define CONFIG_ISS_DEMUXER 0
-%define CONFIG_IV8_DEMUXER 0
-%define CONFIG_IVF_DEMUXER 0
-%define CONFIG_IVR_DEMUXER 0
-%define CONFIG_JACOSUB_DEMUXER 0
-%define CONFIG_JV_DEMUXER 0
-%define CONFIG_LMLM4_DEMUXER 0
-%define CONFIG_LOAS_DEMUXER 0
-%define CONFIG_LRC_DEMUXER 0
-%define CONFIG_LVF_DEMUXER 0
-%define CONFIG_LXF_DEMUXER 0
-%define CONFIG_M4V_DEMUXER 0
-%define CONFIG_MATROSKA_DEMUXER 0
-%define CONFIG_MGSTS_DEMUXER 0
-%define CONFIG_MICRODVD_DEMUXER 0
-%define CONFIG_MJPEG_DEMUXER 0
-%define CONFIG_MLP_DEMUXER 0
-%define CONFIG_MLV_DEMUXER 0
-%define CONFIG_MM_DEMUXER 0
-%define CONFIG_MMF_DEMUXER 0
-%define CONFIG_MOV_DEMUXER 0
-%define CONFIG_MP3_DEMUXER 0
-%define CONFIG_MPC_DEMUXER 0
-%define CONFIG_MPC8_DEMUXER 0
-%define CONFIG_MPEGPS_DEMUXER 0
-%define CONFIG_MPEGTS_DEMUXER 0
-%define CONFIG_MPEGTSRAW_DEMUXER 0
-%define CONFIG_MPEGVIDEO_DEMUXER 0
-%define CONFIG_MPJPEG_DEMUXER 0
-%define CONFIG_MPL2_DEMUXER 0
-%define CONFIG_MPSUB_DEMUXER 0
-%define CONFIG_MSF_DEMUXER 0
-%define CONFIG_MSNWC_TCP_DEMUXER 0
-%define CONFIG_MTAF_DEMUXER 0
-%define CONFIG_MTV_DEMUXER 0
-%define CONFIG_MUSX_DEMUXER 0
-%define CONFIG_MV_DEMUXER 0
-%define CONFIG_MVI_DEMUXER 0
-%define CONFIG_MXF_DEMUXER 0
-%define CONFIG_MXG_DEMUXER 0
-%define CONFIG_NC_DEMUXER 0
-%define CONFIG_NISTSPHERE_DEMUXER 0
-%define CONFIG_NSV_DEMUXER 0
-%define CONFIG_NUT_DEMUXER 0
-%define CONFIG_NUV_DEMUXER 0
-%define CONFIG_OGG_DEMUXER 0
-%define CONFIG_OMA_DEMUXER 0
-%define CONFIG_PAF_DEMUXER 0
-%define CONFIG_PCM_ALAW_DEMUXER 0
-%define CONFIG_PCM_MULAW_DEMUXER 0
-%define CONFIG_PCM_F64BE_DEMUXER 0
-%define CONFIG_PCM_F64LE_DEMUXER 0
-%define CONFIG_PCM_F32BE_DEMUXER 0
-%define CONFIG_PCM_F32LE_DEMUXER 0
-%define CONFIG_PCM_S32BE_DEMUXER 0
-%define CONFIG_PCM_S32LE_DEMUXER 0
-%define CONFIG_PCM_S24BE_DEMUXER 0
-%define CONFIG_PCM_S24LE_DEMUXER 0
-%define CONFIG_PCM_S16BE_DEMUXER 0
-%define CONFIG_PCM_S16LE_DEMUXER 0
-%define CONFIG_PCM_S8_DEMUXER 0
-%define CONFIG_PCM_U32BE_DEMUXER 0
-%define CONFIG_PCM_U32LE_DEMUXER 0
-%define CONFIG_PCM_U24BE_DEMUXER 0
-%define CONFIG_PCM_U24LE_DEMUXER 0
-%define CONFIG_PCM_U16BE_DEMUXER 0
-%define CONFIG_PCM_U16LE_DEMUXER 0
-%define CONFIG_PCM_U8_DEMUXER 0
-%define CONFIG_PJS_DEMUXER 0
-%define CONFIG_PMP_DEMUXER 0
-%define CONFIG_PVA_DEMUXER 0
-%define CONFIG_PVF_DEMUXER 0
-%define CONFIG_QCP_DEMUXER 0
-%define CONFIG_R3D_DEMUXER 0
-%define CONFIG_RAWVIDEO_DEMUXER 0
-%define CONFIG_REALTEXT_DEMUXER 0
-%define CONFIG_REDSPARK_DEMUXER 0
-%define CONFIG_RL2_DEMUXER 0
-%define CONFIG_RM_DEMUXER 0
-%define CONFIG_ROQ_DEMUXER 0
-%define CONFIG_RPL_DEMUXER 0
-%define CONFIG_RSD_DEMUXER 0
-%define CONFIG_RSO_DEMUXER 0
-%define CONFIG_RTP_DEMUXER 0
-%define CONFIG_RTSP_DEMUXER 0
-%define CONFIG_SAMI_DEMUXER 0
-%define CONFIG_SAP_DEMUXER 0
-%define CONFIG_SBG_DEMUXER 0
-%define CONFIG_SDP_DEMUXER 0
-%define CONFIG_SDR2_DEMUXER 0
-%define CONFIG_SEGAFILM_DEMUXER 0
-%define CONFIG_SHORTEN_DEMUXER 0
-%define CONFIG_SIFF_DEMUXER 0
-%define CONFIG_SLN_DEMUXER 0
-%define CONFIG_SMACKER_DEMUXER 0
-%define CONFIG_SMJPEG_DEMUXER 0
-%define CONFIG_SMUSH_DEMUXER 0
-%define CONFIG_SOL_DEMUXER 0
-%define CONFIG_SOX_DEMUXER 0
-%define CONFIG_SPDIF_DEMUXER 0
-%define CONFIG_SRT_DEMUXER 0
-%define CONFIG_STR_DEMUXER 0
-%define CONFIG_STL_DEMUXER 0
-%define CONFIG_SUBVIEWER1_DEMUXER 0
-%define CONFIG_SUBVIEWER_DEMUXER 0
-%define CONFIG_SUP_DEMUXER 0
-%define CONFIG_SVAG_DEMUXER 0
-%define CONFIG_SWF_DEMUXER 0
-%define CONFIG_TAK_DEMUXER 0
-%define CONFIG_TEDCAPTIONS_DEMUXER 0
-%define CONFIG_THP_DEMUXER 0
-%define CONFIG_THREEDOSTR_DEMUXER 0
-%define CONFIG_TIERTEXSEQ_DEMUXER 0
-%define CONFIG_TMV_DEMUXER 0
-%define CONFIG_TRUEHD_DEMUXER 0
-%define CONFIG_TTA_DEMUXER 0
-%define CONFIG_TXD_DEMUXER 0
-%define CONFIG_TTY_DEMUXER 0
-%define CONFIG_V210_DEMUXER 0
-%define CONFIG_V210X_DEMUXER 0
-%define CONFIG_VAG_DEMUXER 0
-%define CONFIG_VC1_DEMUXER 0
-%define CONFIG_VC1T_DEMUXER 0
-%define CONFIG_VIVO_DEMUXER 0
-%define CONFIG_VMD_DEMUXER 0
-%define CONFIG_VOBSUB_DEMUXER 0
-%define CONFIG_VOC_DEMUXER 0
-%define CONFIG_VPK_DEMUXER 0
-%define CONFIG_VPLAYER_DEMUXER 0
-%define CONFIG_VQF_DEMUXER 0
-%define CONFIG_W64_DEMUXER 0
-%define CONFIG_WAV_DEMUXER 0
-%define CONFIG_WC3_DEMUXER 0
-%define CONFIG_WEBM_DASH_MANIFEST_DEMUXER 0
-%define CONFIG_WEBVTT_DEMUXER 0
-%define CONFIG_WSAUD_DEMUXER 0
-%define CONFIG_WSD_DEMUXER 0
-%define CONFIG_WSVQA_DEMUXER 0
-%define CONFIG_WTV_DEMUXER 0
-%define CONFIG_WVE_DEMUXER 0
-%define CONFIG_WV_DEMUXER 0
-%define CONFIG_XA_DEMUXER 0
-%define CONFIG_XBIN_DEMUXER 0
-%define CONFIG_XMV_DEMUXER 0
-%define CONFIG_XVAG_DEMUXER 0
-%define CONFIG_XWMA_DEMUXER 0
-%define CONFIG_YOP_DEMUXER 0
-%define CONFIG_YUV4MPEGPIPE_DEMUXER 0
-%define CONFIG_IMAGE_BMP_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_DDS_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_DPX_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_EXR_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_J2K_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_JPEG_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_JPEGLS_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PAM_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PBM_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PCX_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PGMYUV_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PGM_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PICTOR_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PNG_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_PPM_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_QDRAW_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_SGI_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_SUNRAST_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_TIFF_PIPE_DEMUXER 0
-%define CONFIG_IMAGE_WEBP_PIPE_DEMUXER 0
-%define CONFIG_LIBGME_DEMUXER 0
-%define CONFIG_LIBMODPLUG_DEMUXER 0
-%define CONFIG_LIBNUT_DEMUXER 0
-%define CONFIG_LIBOPENMPT_DEMUXER 0
-%define CONFIG_A64MULTI_ENCODER 0
-%define CONFIG_A64MULTI5_ENCODER 0
-%define CONFIG_ALIAS_PIX_ENCODER 0
-%define CONFIG_AMV_ENCODER 0
-%define CONFIG_APNG_ENCODER 0
-%define CONFIG_ASV1_ENCODER 0
-%define CONFIG_ASV2_ENCODER 0
-%define CONFIG_AVRP_ENCODER 0
-%define CONFIG_AVUI_ENCODER 0
-%define CONFIG_AYUV_ENCODER 0
-%define CONFIG_BMP_ENCODER 0
-%define CONFIG_CINEPAK_ENCODER 0
-%define CONFIG_CLJR_ENCODER 0
-%define CONFIG_COMFORTNOISE_ENCODER 0
-%define CONFIG_DNXHD_ENCODER 0
-%define CONFIG_DPX_ENCODER 0
-%define CONFIG_DVVIDEO_ENCODER 0
-%define CONFIG_FFV1_ENCODER 0
-%define CONFIG_FFVHUFF_ENCODER 0
-%define CONFIG_FLASHSV_ENCODER 0
-%define CONFIG_FLASHSV2_ENCODER 0
-%define CONFIG_FLV_ENCODER 0
-%define CONFIG_GIF_ENCODER 0
-%define CONFIG_H261_ENCODER 0
-%define CONFIG_H263_ENCODER 0
-%define CONFIG_H263P_ENCODER 0
-%define CONFIG_HAP_ENCODER 0
-%define CONFIG_HUFFYUV_ENCODER 0
-%define CONFIG_JPEG2000_ENCODER 0
-%define CONFIG_JPEGLS_ENCODER 0
-%define CONFIG_LJPEG_ENCODER 0
-%define CONFIG_MJPEG_ENCODER 0
-%define CONFIG_MPEG1VIDEO_ENCODER 0
-%define CONFIG_MPEG2VIDEO_ENCODER 0
-%define CONFIG_MPEG4_ENCODER 0
-%define CONFIG_MSMPEG4V2_ENCODER 0
-%define CONFIG_MSMPEG4V3_ENCODER 0
-%define CONFIG_MSVIDEO1_ENCODER 0
-%define CONFIG_PAM_ENCODER 0
-%define CONFIG_PBM_ENCODER 0
-%define CONFIG_PCX_ENCODER 0
-%define CONFIG_PGM_ENCODER 0
-%define CONFIG_PGMYUV_ENCODER 0
-%define CONFIG_PNG_ENCODER 0
-%define CONFIG_PPM_ENCODER 0
-%define CONFIG_PRORES_ENCODER 0
-%define CONFIG_PRORES_AW_ENCODER 0
-%define CONFIG_PRORES_KS_ENCODER 0
-%define CONFIG_QTRLE_ENCODER 0
-%define CONFIG_R10K_ENCODER 0
-%define CONFIG_R210_ENCODER 0
-%define CONFIG_RAWVIDEO_ENCODER 0
-%define CONFIG_ROQ_ENCODER 0
-%define CONFIG_RV10_ENCODER 0
-%define CONFIG_RV20_ENCODER 0
-%define CONFIG_S302M_ENCODER 0
-%define CONFIG_SGI_ENCODER 0
-%define CONFIG_SNOW_ENCODER 0
-%define CONFIG_SUNRAST_ENCODER 0
-%define CONFIG_SVQ1_ENCODER 0
-%define CONFIG_TARGA_ENCODER 0
-%define CONFIG_TIFF_ENCODER 0
-%define CONFIG_UTVIDEO_ENCODER 0
-%define CONFIG_V210_ENCODER 0
-%define CONFIG_V308_ENCODER 0
-%define CONFIG_V408_ENCODER 0
-%define CONFIG_V410_ENCODER 0
-%define CONFIG_VC2_ENCODER 0
-%define CONFIG_WRAPPED_AVFRAME_ENCODER 0
-%define CONFIG_WMV1_ENCODER 0
-%define CONFIG_WMV2_ENCODER 0
-%define CONFIG_XBM_ENCODER 0
-%define CONFIG_XFACE_ENCODER 0
-%define CONFIG_XWD_ENCODER 0
-%define CONFIG_Y41P_ENCODER 0
-%define CONFIG_YUV4_ENCODER 0
-%define CONFIG_ZLIB_ENCODER 0
-%define CONFIG_ZMBV_ENCODER 0
-%define CONFIG_AAC_ENCODER 0
-%define CONFIG_AC3_ENCODER 0
-%define CONFIG_AC3_FIXED_ENCODER 0
-%define CONFIG_ALAC_ENCODER 0
-%define CONFIG_DCA_ENCODER 0
-%define CONFIG_EAC3_ENCODER 0
-%define CONFIG_FLAC_ENCODER 0
-%define CONFIG_G723_1_ENCODER 0
-%define CONFIG_MLP_ENCODER 0
-%define CONFIG_MP2_ENCODER 0
-%define CONFIG_MP2FIXED_ENCODER 0
-%define CONFIG_NELLYMOSER_ENCODER 0
-%define CONFIG_RA_144_ENCODER 0
-%define CONFIG_SONIC_ENCODER 0
-%define CONFIG_SONIC_LS_ENCODER 0
-%define CONFIG_TRUEHD_ENCODER 0
-%define CONFIG_TTA_ENCODER 0
-%define CONFIG_VORBIS_ENCODER 0
-%define CONFIG_WAVPACK_ENCODER 0
-%define CONFIG_WMAV1_ENCODER 0
-%define CONFIG_WMAV2_ENCODER 0
-%define CONFIG_PCM_ALAW_ENCODER 0
-%define CONFIG_PCM_F32BE_ENCODER 0
-%define CONFIG_PCM_F32LE_ENCODER 0
-%define CONFIG_PCM_F64BE_ENCODER 0
-%define CONFIG_PCM_F64LE_ENCODER 0
-%define CONFIG_PCM_MULAW_ENCODER 0
-%define CONFIG_PCM_S8_ENCODER 0
-%define CONFIG_PCM_S8_PLANAR_ENCODER 0
-%define CONFIG_PCM_S16BE_ENCODER 0
-%define CONFIG_PCM_S16BE_PLANAR_ENCODER 0
-%define CONFIG_PCM_S16LE_ENCODER 0
-%define CONFIG_PCM_S16LE_PLANAR_ENCODER 0
-%define CONFIG_PCM_S24BE_ENCODER 0
-%define CONFIG_PCM_S24DAUD_ENCODER 0
-%define CONFIG_PCM_S24LE_ENCODER 0
-%define CONFIG_PCM_S24LE_PLANAR_ENCODER 0
-%define CONFIG_PCM_S32BE_ENCODER 0
-%define CONFIG_PCM_S32LE_ENCODER 0
-%define CONFIG_PCM_S32LE_PLANAR_ENCODER 0
-%define CONFIG_PCM_S64BE_ENCODER 0
-%define CONFIG_PCM_S64LE_ENCODER 0
-%define CONFIG_PCM_U8_ENCODER 0
-%define CONFIG_PCM_U16BE_ENCODER 0
-%define CONFIG_PCM_U16LE_ENCODER 0
-%define CONFIG_PCM_U24BE_ENCODER 0
-%define CONFIG_PCM_U24LE_ENCODER 0
-%define CONFIG_PCM_U32BE_ENCODER 0
-%define CONFIG_PCM_U32LE_ENCODER 0
-%define CONFIG_ROQ_DPCM_ENCODER 0
-%define CONFIG_ADPCM_ADX_ENCODER 0
-%define CONFIG_ADPCM_G722_ENCODER 0
-%define CONFIG_ADPCM_G726_ENCODER 0
-%define CONFIG_ADPCM_IMA_QT_ENCODER 0
-%define CONFIG_ADPCM_IMA_WAV_ENCODER 0
-%define CONFIG_ADPCM_MS_ENCODER 0
-%define CONFIG_ADPCM_SWF_ENCODER 0
-%define CONFIG_ADPCM_YAMAHA_ENCODER 0
-%define CONFIG_SSA_ENCODER 0
-%define CONFIG_ASS_ENCODER 0
-%define CONFIG_DVBSUB_ENCODER 0
-%define CONFIG_DVDSUB_ENCODER 0
-%define CONFIG_MOVTEXT_ENCODER 0
-%define CONFIG_SRT_ENCODER 0
-%define CONFIG_SUBRIP_ENCODER 0
-%define CONFIG_TEXT_ENCODER 0
-%define CONFIG_WEBVTT_ENCODER 0
-%define CONFIG_XSUB_ENCODER 0
-%define CONFIG_AAC_AT_ENCODER 0
-%define CONFIG_ALAC_AT_ENCODER 0
-%define CONFIG_ILBC_AT_ENCODER 0
-%define CONFIG_PCM_ALAW_AT_ENCODER 0
-%define CONFIG_PCM_MULAW_AT_ENCODER 0
-%define CONFIG_LIBFDK_AAC_ENCODER 0
-%define CONFIG_LIBGSM_ENCODER 0
-%define CONFIG_LIBGSM_MS_ENCODER 0
-%define CONFIG_LIBILBC_ENCODER 0
-%define CONFIG_LIBMP3LAME_ENCODER 0
-%define CONFIG_LIBOPENCORE_AMRNB_ENCODER 0
-%define CONFIG_LIBOPENJPEG_ENCODER 0
-%define CONFIG_LIBOPUS_ENCODER 0
-%define CONFIG_LIBSCHROEDINGER_ENCODER 0
-%define CONFIG_LIBSHINE_ENCODER 0
-%define CONFIG_LIBSPEEX_ENCODER 0
-%define CONFIG_LIBTHEORA_ENCODER 0
-%define CONFIG_LIBTWOLAME_ENCODER 0
-%define CONFIG_LIBVO_AMRWBENC_ENCODER 0
-%define CONFIG_LIBVORBIS_ENCODER 0
-%define CONFIG_LIBVPX_VP8_ENCODER 0
-%define CONFIG_LIBVPX_VP9_ENCODER 0
-%define CONFIG_LIBWAVPACK_ENCODER 0
-%define CONFIG_LIBWEBP_ANIM_ENCODER 0
-%define CONFIG_LIBWEBP_ENCODER 0
-%define CONFIG_LIBX262_ENCODER 0
-%define CONFIG_LIBX264_ENCODER 0
-%define CONFIG_LIBX264RGB_ENCODER 0
-%define CONFIG_LIBX265_ENCODER 0
-%define CONFIG_LIBXAVS_ENCODER 0
-%define CONFIG_LIBXVID_ENCODER 0
-%define CONFIG_LIBOPENH264_ENCODER 0
-%define CONFIG_H264_NVENC_ENCODER 0
-%define CONFIG_H264_OMX_ENCODER 0
-%define CONFIG_H264_QSV_ENCODER 0
-%define CONFIG_H264_VAAPI_ENCODER 0
-%define CONFIG_H264_VIDEOTOOLBOX_ENCODER 0
-%define CONFIG_NVENC_ENCODER 0
-%define CONFIG_NVENC_H264_ENCODER 0
-%define CONFIG_NVENC_HEVC_ENCODER 0
-%define CONFIG_HEVC_NVENC_ENCODER 0
-%define CONFIG_HEVC_QSV_ENCODER 0
-%define CONFIG_HEVC_VAAPI_ENCODER 0
-%define CONFIG_LIBKVAZAAR_ENCODER 0
-%define CONFIG_MJPEG_VAAPI_ENCODER 0
-%define CONFIG_MPEG2_QSV_ENCODER 0
-%define CONFIG_ABENCH_FILTER 0
-%define CONFIG_ACOMPRESSOR_FILTER 0
-%define CONFIG_ACROSSFADE_FILTER 0
-%define CONFIG_ACRUSHER_FILTER 0
-%define CONFIG_ADELAY_FILTER 0
-%define CONFIG_AECHO_FILTER 0
-%define CONFIG_AEMPHASIS_FILTER 0
-%define CONFIG_AEVAL_FILTER 0
-%define CONFIG_AFADE_FILTER 0
-%define CONFIG_AFFTFILT_FILTER 0
-%define CONFIG_AFORMAT_FILTER 0
-%define CONFIG_AGATE_FILTER 0
-%define CONFIG_AINTERLEAVE_FILTER 0
-%define CONFIG_ALIMITER_FILTER 0
-%define CONFIG_ALLPASS_FILTER 0
-%define CONFIG_ALOOP_FILTER 0
-%define CONFIG_AMERGE_FILTER 0
-%define CONFIG_AMETADATA_FILTER 0
-%define CONFIG_AMIX_FILTER 0
-%define CONFIG_ANEQUALIZER_FILTER 0
-%define CONFIG_ANULL_FILTER 0
-%define CONFIG_APAD_FILTER 0
-%define CONFIG_APERMS_FILTER 0
-%define CONFIG_APHASER_FILTER 0
-%define CONFIG_APULSATOR_FILTER 0
-%define CONFIG_AREALTIME_FILTER 0
-%define CONFIG_ARESAMPLE_FILTER 0
-%define CONFIG_AREVERSE_FILTER 0
-%define CONFIG_ASELECT_FILTER 0
-%define CONFIG_ASENDCMD_FILTER 0
-%define CONFIG_ASETNSAMPLES_FILTER 0
-%define CONFIG_ASETPTS_FILTER 0
-%define CONFIG_ASETRATE_FILTER 0
-%define CONFIG_ASETTB_FILTER 0
-%define CONFIG_ASHOWINFO_FILTER 0
-%define CONFIG_ASIDEDATA_FILTER 0
-%define CONFIG_ASPLIT_FILTER 0
-%define CONFIG_ASTATS_FILTER 0
-%define CONFIG_ASTREAMSELECT_FILTER 0
-%define CONFIG_ASYNCTS_FILTER 0
-%define CONFIG_ATEMPO_FILTER 0
-%define CONFIG_ATRIM_FILTER 0
-%define CONFIG_AZMQ_FILTER 0
-%define CONFIG_BANDPASS_FILTER 0
-%define CONFIG_BANDREJECT_FILTER 0
-%define CONFIG_BASS_FILTER 0
-%define CONFIG_BIQUAD_FILTER 0
-%define CONFIG_BS2B_FILTER 0
-%define CONFIG_CHANNELMAP_FILTER 0
-%define CONFIG_CHANNELSPLIT_FILTER 0
-%define CONFIG_CHORUS_FILTER 0
-%define CONFIG_COMPAND_FILTER 0
-%define CONFIG_COMPENSATIONDELAY_FILTER 0
-%define CONFIG_CRYSTALIZER_FILTER 0
-%define CONFIG_DCSHIFT_FILTER 0
-%define CONFIG_DYNAUDNORM_FILTER 0
-%define CONFIG_EARWAX_FILTER 0
-%define CONFIG_EBUR128_FILTER 0
-%define CONFIG_EQUALIZER_FILTER 0
-%define CONFIG_EXTRASTEREO_FILTER 0
-%define CONFIG_FIREQUALIZER_FILTER 0
-%define CONFIG_FLANGER_FILTER 0
-%define CONFIG_HDCD_FILTER 0
-%define CONFIG_HIGHPASS_FILTER 0
-%define CONFIG_JOIN_FILTER 0
-%define CONFIG_LADSPA_FILTER 0
-%define CONFIG_LOUDNORM_FILTER 0
-%define CONFIG_LOWPASS_FILTER 0
-%define CONFIG_PAN_FILTER 0
-%define CONFIG_REPLAYGAIN_FILTER 0
-%define CONFIG_RESAMPLE_FILTER 0
-%define CONFIG_RUBBERBAND_FILTER 0
-%define CONFIG_SIDECHAINCOMPRESS_FILTER 0
-%define CONFIG_SIDECHAINGATE_FILTER 0
-%define CONFIG_SILENCEDETECT_FILTER 0
-%define CONFIG_SILENCEREMOVE_FILTER 0
-%define CONFIG_SOFALIZER_FILTER 0
-%define CONFIG_STEREOTOOLS_FILTER 0
-%define CONFIG_STEREOWIDEN_FILTER 0
-%define CONFIG_TREBLE_FILTER 0
-%define CONFIG_TREMOLO_FILTER 0
-%define CONFIG_VIBRATO_FILTER 0
-%define CONFIG_VOLUME_FILTER 0
-%define CONFIG_VOLUMEDETECT_FILTER 0
-%define CONFIG_AEVALSRC_FILTER 0
-%define CONFIG_ANOISESRC_FILTER 0
-%define CONFIG_ANULLSRC_FILTER 0
-%define CONFIG_FLITE_FILTER 0
-%define CONFIG_SINE_FILTER 0
-%define CONFIG_ANULLSINK_FILTER 0
-%define CONFIG_ALPHAEXTRACT_FILTER 0
-%define CONFIG_ALPHAMERGE_FILTER 0
-%define CONFIG_ASS_FILTER 0
-%define CONFIG_ATADENOISE_FILTER 0
-%define CONFIG_AVGBLUR_FILTER 0
-%define CONFIG_BBOX_FILTER 0
-%define CONFIG_BENCH_FILTER 0
-%define CONFIG_BITPLANENOISE_FILTER 0
-%define CONFIG_BLACKDETECT_FILTER 0
-%define CONFIG_BLACKFRAME_FILTER 0
-%define CONFIG_BLEND_FILTER 0
-%define CONFIG_BOXBLUR_FILTER 0
-%define CONFIG_BWDIF_FILTER 0
-%define CONFIG_CHROMAKEY_FILTER 0
-%define CONFIG_CIESCOPE_FILTER 0
-%define CONFIG_CODECVIEW_FILTER 0
-%define CONFIG_COLORBALANCE_FILTER 0
-%define CONFIG_COLORCHANNELMIXER_FILTER 0
-%define CONFIG_COLORKEY_FILTER 0
-%define CONFIG_COLORLEVELS_FILTER 0
-%define CONFIG_COLORMATRIX_FILTER 0
-%define CONFIG_COLORSPACE_FILTER 0
-%define CONFIG_CONVOLUTION_FILTER 0
-%define CONFIG_COPY_FILTER 0
-%define CONFIG_COREIMAGE_FILTER 0
-%define CONFIG_COVER_RECT_FILTER 0
-%define CONFIG_CROP_FILTER 0
-%define CONFIG_CROPDETECT_FILTER 0
-%define CONFIG_CURVES_FILTER 0
-%define CONFIG_DATASCOPE_FILTER 0
-%define CONFIG_DCTDNOIZ_FILTER 0
-%define CONFIG_DEBAND_FILTER 0
-%define CONFIG_DECIMATE_FILTER 0
-%define CONFIG_DEFLATE_FILTER 0
-%define CONFIG_DEJUDDER_FILTER 0
-%define CONFIG_DELOGO_FILTER 0
-%define CONFIG_DESHAKE_FILTER 0
-%define CONFIG_DETELECINE_FILTER 0
-%define CONFIG_DILATION_FILTER 0
-%define CONFIG_DISPLACE_FILTER 0
-%define CONFIG_DRAWBOX_FILTER 0
-%define CONFIG_DRAWGRAPH_FILTER 0
-%define CONFIG_DRAWGRID_FILTER 0
-%define CONFIG_DRAWTEXT_FILTER 0
-%define CONFIG_EDGEDETECT_FILTER 0
-%define CONFIG_ELBG_FILTER 0
-%define CONFIG_EQ_FILTER 0
-%define CONFIG_EROSION_FILTER 0
-%define CONFIG_EXTRACTPLANES_FILTER 0
-%define CONFIG_FADE_FILTER 0
-%define CONFIG_FFTFILT_FILTER 0
-%define CONFIG_FIELD_FILTER 0
-%define CONFIG_FIELDHINT_FILTER 0
-%define CONFIG_FIELDMATCH_FILTER 0
-%define CONFIG_FIELDORDER_FILTER 0
-%define CONFIG_FIND_RECT_FILTER 0
-%define CONFIG_FORMAT_FILTER 0
-%define CONFIG_FPS_FILTER 0
-%define CONFIG_FRAMEPACK_FILTER 0
-%define CONFIG_FRAMERATE_FILTER 0
-%define CONFIG_FRAMESTEP_FILTER 0
-%define CONFIG_FREI0R_FILTER 0
-%define CONFIG_FSPP_FILTER 0
-%define CONFIG_GBLUR_FILTER 0
-%define CONFIG_GEQ_FILTER 0
-%define CONFIG_GRADFUN_FILTER 0
-%define CONFIG_HALDCLUT_FILTER 0
-%define CONFIG_HFLIP_FILTER 0
-%define CONFIG_HISTEQ_FILTER 0
-%define CONFIG_HISTOGRAM_FILTER 0
-%define CONFIG_HQDN3D_FILTER 0
-%define CONFIG_HQX_FILTER 0
-%define CONFIG_HSTACK_FILTER 0
-%define CONFIG_HUE_FILTER 0
-%define CONFIG_HWDOWNLOAD_FILTER 0
-%define CONFIG_HWUPLOAD_FILTER 0
-%define CONFIG_HWUPLOAD_CUDA_FILTER 0
-%define CONFIG_HYSTERESIS_FILTER 0
-%define CONFIG_IDET_FILTER 0
-%define CONFIG_IL_FILTER 0
-%define CONFIG_INFLATE_FILTER 0
-%define CONFIG_INTERLACE_FILTER 0
-%define CONFIG_INTERLEAVE_FILTER 0
-%define CONFIG_KERNDEINT_FILTER 0
-%define CONFIG_LENSCORRECTION_FILTER 0
-%define CONFIG_LOOP_FILTER 0
-%define CONFIG_LUT_FILTER 0
-%define CONFIG_LUT2_FILTER 0
-%define CONFIG_LUT3D_FILTER 0
-%define CONFIG_LUTRGB_FILTER 0
-%define CONFIG_LUTYUV_FILTER 0
-%define CONFIG_MASKEDCLAMP_FILTER 0
-%define CONFIG_MASKEDMERGE_FILTER 0
-%define CONFIG_MCDEINT_FILTER 0
-%define CONFIG_MERGEPLANES_FILTER 0
-%define CONFIG_MESTIMATE_FILTER 0
-%define CONFIG_METADATA_FILTER 0
-%define CONFIG_MINTERPOLATE_FILTER 0
-%define CONFIG_MPDECIMATE_FILTER 0
-%define CONFIG_NEGATE_FILTER 0
-%define CONFIG_NLMEANS_FILTER 0
-%define CONFIG_NNEDI_FILTER 0
-%define CONFIG_NOFORMAT_FILTER 0
-%define CONFIG_NOISE_FILTER 0
-%define CONFIG_NULL_FILTER 0
-%define CONFIG_OCR_FILTER 0
-%define CONFIG_OCV_FILTER 0
-%define CONFIG_OVERLAY_FILTER 0
-%define CONFIG_OWDENOISE_FILTER 0
-%define CONFIG_PAD_FILTER 0
-%define CONFIG_PALETTEGEN_FILTER 0
-%define CONFIG_PALETTEUSE_FILTER 0
-%define CONFIG_PERMS_FILTER 0
-%define CONFIG_PERSPECTIVE_FILTER 0
-%define CONFIG_PHASE_FILTER 0
-%define CONFIG_PIXDESCTEST_FILTER 0
-%define CONFIG_PP_FILTER 0
-%define CONFIG_PP7_FILTER 0
-%define CONFIG_PREWITT_FILTER 0
-%define CONFIG_PSNR_FILTER 0
-%define CONFIG_PULLUP_FILTER 0
-%define CONFIG_QP_FILTER 0
-%define CONFIG_RANDOM_FILTER 0
-%define CONFIG_READVITC_FILTER 0
-%define CONFIG_REALTIME_FILTER 0
-%define CONFIG_REMAP_FILTER 0
-%define CONFIG_REMOVEGRAIN_FILTER 0
-%define CONFIG_REMOVELOGO_FILTER 0
-%define CONFIG_REPEATFIELDS_FILTER 0
-%define CONFIG_REVERSE_FILTER 0
-%define CONFIG_ROTATE_FILTER 0
-%define CONFIG_SAB_FILTER 0
-%define CONFIG_SCALE_FILTER 0
-%define CONFIG_SCALE_NPP_FILTER 0
-%define CONFIG_SCALE_VAAPI_FILTER 0
-%define CONFIG_SCALE2REF_FILTER 0
-%define CONFIG_SELECT_FILTER 0
-%define CONFIG_SELECTIVECOLOR_FILTER 0
-%define CONFIG_SENDCMD_FILTER 0
-%define CONFIG_SEPARATEFIELDS_FILTER 0
-%define CONFIG_SETDAR_FILTER 0
-%define CONFIG_SETFIELD_FILTER 0
-%define CONFIG_SETPTS_FILTER 0
-%define CONFIG_SETSAR_FILTER 0
-%define CONFIG_SETTB_FILTER 0
-%define CONFIG_SHOWINFO_FILTER 0
-%define CONFIG_SHOWPALETTE_FILTER 0
-%define CONFIG_SHUFFLEFRAMES_FILTER 0
-%define CONFIG_SHUFFLEPLANES_FILTER 0
-%define CONFIG_SIDEDATA_FILTER 0
-%define CONFIG_SIGNALSTATS_FILTER 0
-%define CONFIG_SMARTBLUR_FILTER 0
-%define CONFIG_SOBEL_FILTER 0
-%define CONFIG_SPLIT_FILTER 0
-%define CONFIG_SPP_FILTER 0
-%define CONFIG_SSIM_FILTER 0
-%define CONFIG_STEREO3D_FILTER 0
-%define CONFIG_STREAMSELECT_FILTER 0
-%define CONFIG_SUBTITLES_FILTER 0
-%define CONFIG_SUPER2XSAI_FILTER 0
-%define CONFIG_SWAPRECT_FILTER 0
-%define CONFIG_SWAPUV_FILTER 0
-%define CONFIG_TBLEND_FILTER 0
-%define CONFIG_TELECINE_FILTER 0
-%define CONFIG_THUMBNAIL_FILTER 0
-%define CONFIG_TILE_FILTER 0
-%define CONFIG_TINTERLACE_FILTER 0
-%define CONFIG_TRANSPOSE_FILTER 0
-%define CONFIG_TRIM_FILTER 0
-%define CONFIG_UNSHARP_FILTER 0
-%define CONFIG_USPP_FILTER 0
-%define CONFIG_VAGUEDENOISER_FILTER 0
-%define CONFIG_VECTORSCOPE_FILTER 0
-%define CONFIG_VFLIP_FILTER 0
-%define CONFIG_VIDSTABDETECT_FILTER 0
-%define CONFIG_VIDSTABTRANSFORM_FILTER 0
-%define CONFIG_VIGNETTE_FILTER 0
-%define CONFIG_VSTACK_FILTER 0
-%define CONFIG_W3FDIF_FILTER 0
-%define CONFIG_WAVEFORM_FILTER 0
-%define CONFIG_WEAVE_FILTER 0
-%define CONFIG_XBR_FILTER 0
-%define CONFIG_YADIF_FILTER 0
-%define CONFIG_ZMQ_FILTER 0
-%define CONFIG_ZOOMPAN_FILTER 0
-%define CONFIG_ZSCALE_FILTER 0
-%define CONFIG_ALLRGB_FILTER 0
-%define CONFIG_ALLYUV_FILTER 0
-%define CONFIG_CELLAUTO_FILTER 0
-%define CONFIG_COLOR_FILTER 0
-%define CONFIG_COREIMAGESRC_FILTER 0
-%define CONFIG_FREI0R_SRC_FILTER 0
-%define CONFIG_HALDCLUTSRC_FILTER 0
-%define CONFIG_LIFE_FILTER 0
-%define CONFIG_MANDELBROT_FILTER 0
-%define CONFIG_MPTESTSRC_FILTER 0
-%define CONFIG_NULLSRC_FILTER 0
-%define CONFIG_RGBTESTSRC_FILTER 0
-%define CONFIG_SMPTEBARS_FILTER 0
-%define CONFIG_SMPTEHDBARS_FILTER 0
-%define CONFIG_TESTSRC_FILTER 0
-%define CONFIG_TESTSRC2_FILTER 0
-%define CONFIG_YUVTESTSRC_FILTER 0
-%define CONFIG_NULLSINK_FILTER 0
-%define CONFIG_ADRAWGRAPH_FILTER 0
-%define CONFIG_AHISTOGRAM_FILTER 0
-%define CONFIG_APHASEMETER_FILTER 0
-%define CONFIG_AVECTORSCOPE_FILTER 0
-%define CONFIG_CONCAT_FILTER 0
-%define CONFIG_SHOWCQT_FILTER 0
-%define CONFIG_SHOWFREQS_FILTER 0
-%define CONFIG_SHOWSPECTRUM_FILTER 0
-%define CONFIG_SHOWSPECTRUMPIC_FILTER 0
-%define CONFIG_SHOWVOLUME_FILTER 0
-%define CONFIG_SHOWWAVES_FILTER 0
-%define CONFIG_SHOWWAVESPIC_FILTER 0
-%define CONFIG_SPECTRUMSYNTH_FILTER 0
-%define CONFIG_AMOVIE_FILTER 0
-%define CONFIG_MOVIE_FILTER 0
-%define CONFIG_H263_CUVID_HWACCEL 0
-%define CONFIG_H263_VAAPI_HWACCEL 0
-%define CONFIG_H263_VIDEOTOOLBOX_HWACCEL 0
-%define CONFIG_H264_CUVID_HWACCEL 0
-%define CONFIG_H264_D3D11VA_HWACCEL 0
-%define CONFIG_H264_DXVA2_HWACCEL 0
-%define CONFIG_H264_MEDIACODEC_HWACCEL 0
-%define CONFIG_H264_MMAL_HWACCEL 0
-%define CONFIG_H264_QSV_HWACCEL 0
-%define CONFIG_H264_VAAPI_HWACCEL 0
-%define CONFIG_H264_VDA_HWACCEL 0
-%define CONFIG_H264_VDA_OLD_HWACCEL 0
-%define CONFIG_H264_VDPAU_HWACCEL 0
-%define CONFIG_H264_VIDEOTOOLBOX_HWACCEL 0
-%define CONFIG_HEVC_CUVID_HWACCEL 0
-%define CONFIG_HEVC_D3D11VA_HWACCEL 0
-%define CONFIG_HEVC_DXVA2_HWACCEL 0
-%define CONFIG_HEVC_MEDIACODEC_HWACCEL 0
-%define CONFIG_HEVC_QSV_HWACCEL 0
-%define CONFIG_HEVC_VAAPI_HWACCEL 0
-%define CONFIG_HEVC_VDPAU_HWACCEL 0
-%define CONFIG_MJPEG_CUVID_HWACCEL 0
-%define CONFIG_MPEG1_CUVID_HWACCEL 0
-%define CONFIG_MPEG1_XVMC_HWACCEL 0
-%define CONFIG_MPEG1_VDPAU_HWACCEL 0
-%define CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL 0
-%define CONFIG_MPEG2_CUVID_HWACCEL 0
-%define CONFIG_MPEG2_XVMC_HWACCEL 0
-%define CONFIG_MPEG2_D3D11VA_HWACCEL 0
-%define CONFIG_MPEG2_DXVA2_HWACCEL 0
-%define CONFIG_MPEG2_MMAL_HWACCEL 0
-%define CONFIG_MPEG2_QSV_HWACCEL 0
-%define CONFIG_MPEG2_VAAPI_HWACCEL 0
-%define CONFIG_MPEG2_VDPAU_HWACCEL 0
-%define CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL 0
-%define CONFIG_MPEG4_CUVID_HWACCEL 0
-%define CONFIG_MPEG4_MEDIACODEC_HWACCEL 0
-%define CONFIG_MPEG4_MMAL_HWACCEL 0
-%define CONFIG_MPEG4_VAAPI_HWACCEL 0
-%define CONFIG_MPEG4_VDPAU_HWACCEL 0
-%define CONFIG_MPEG4_VIDEOTOOLBOX_HWACCEL 0
-%define CONFIG_VC1_CUVID_HWACCEL 0
-%define CONFIG_VC1_D3D11VA_HWACCEL 0
-%define CONFIG_VC1_DXVA2_HWACCEL 0
-%define CONFIG_VC1_VAAPI_HWACCEL 0
-%define CONFIG_VC1_VDPAU_HWACCEL 0
-%define CONFIG_VC1_MMAL_HWACCEL 0
-%define CONFIG_VC1_QSV_HWACCEL 0
-%define CONFIG_VP8_CUVID_HWACCEL 0
-%define CONFIG_VP8_MEDIACODEC_HWACCEL 0
-%define CONFIG_VP9_CUVID_HWACCEL 0
-%define CONFIG_VP9_D3D11VA_HWACCEL 0
-%define CONFIG_VP9_DXVA2_HWACCEL 0
-%define CONFIG_VP9_MEDIACODEC_HWACCEL 0
-%define CONFIG_VP9_VAAPI_HWACCEL 0
-%define CONFIG_WMV3_D3D11VA_HWACCEL 0
-%define CONFIG_WMV3_DXVA2_HWACCEL 0
-%define CONFIG_WMV3_VAAPI_HWACCEL 0
-%define CONFIG_WMV3_VDPAU_HWACCEL 0
-%define CONFIG_ALSA_INDEV 0
-%define CONFIG_AVFOUNDATION_INDEV 0
-%define CONFIG_BKTR_INDEV 0
-%define CONFIG_DECKLINK_INDEV 0
-%define CONFIG_DSHOW_INDEV 0
-%define CONFIG_DV1394_INDEV 0
-%define CONFIG_FBDEV_INDEV 0
-%define CONFIG_GDIGRAB_INDEV 0
-%define CONFIG_IEC61883_INDEV 0
-%define CONFIG_JACK_INDEV 0
-%define CONFIG_LAVFI_INDEV 0
-%define CONFIG_OPENAL_INDEV 0
-%define CONFIG_OSS_INDEV 0
-%define CONFIG_PULSE_INDEV 0
-%define CONFIG_QTKIT_INDEV 0
-%define CONFIG_SNDIO_INDEV 0
-%define CONFIG_V4L2_INDEV 0
-%define CONFIG_VFWCAP_INDEV 0
-%define CONFIG_X11GRAB_INDEV 0
-%define CONFIG_X11GRAB_XCB_INDEV 0
-%define CONFIG_LIBCDIO_INDEV 0
-%define CONFIG_LIBDC1394_INDEV 0
-%define CONFIG_A64_MUXER 0
-%define CONFIG_AC3_MUXER 0
-%define CONFIG_ADTS_MUXER 0
-%define CONFIG_ADX_MUXER 0
-%define CONFIG_AIFF_MUXER 0
-%define CONFIG_AMR_MUXER 0
-%define CONFIG_APNG_MUXER 0
-%define CONFIG_ASF_MUXER 0
-%define CONFIG_ASS_MUXER 0
-%define CONFIG_AST_MUXER 0
-%define CONFIG_ASF_STREAM_MUXER 0
-%define CONFIG_AU_MUXER 0
-%define CONFIG_AVI_MUXER 0
-%define CONFIG_AVM2_MUXER 0
-%define CONFIG_BIT_MUXER 0
-%define CONFIG_CAF_MUXER 0
-%define CONFIG_CAVSVIDEO_MUXER 0
-%define CONFIG_CRC_MUXER 0
-%define CONFIG_DASH_MUXER 0
-%define CONFIG_DATA_MUXER 0
-%define CONFIG_DAUD_MUXER 0
-%define CONFIG_DIRAC_MUXER 0
-%define CONFIG_DNXHD_MUXER 0
-%define CONFIG_DTS_MUXER 0
-%define CONFIG_DV_MUXER 0
-%define CONFIG_EAC3_MUXER 0
-%define CONFIG_F4V_MUXER 0
-%define CONFIG_FFM_MUXER 0
-%define CONFIG_FFMETADATA_MUXER 0
-%define CONFIG_FIFO_MUXER 0
-%define CONFIG_FILMSTRIP_MUXER 0
-%define CONFIG_FLAC_MUXER 0
-%define CONFIG_FLV_MUXER 0
-%define CONFIG_FRAMECRC_MUXER 0
-%define CONFIG_FRAMEHASH_MUXER 0
-%define CONFIG_FRAMEMD5_MUXER 0
-%define CONFIG_G722_MUXER 0
-%define CONFIG_G723_1_MUXER 0
-%define CONFIG_GIF_MUXER 0
-%define CONFIG_GSM_MUXER 0
-%define CONFIG_GXF_MUXER 0
-%define CONFIG_H261_MUXER 0
-%define CONFIG_H263_MUXER 0
-%define CONFIG_H264_MUXER 0
-%define CONFIG_HASH_MUXER 0
-%define CONFIG_HDS_MUXER 0
-%define CONFIG_HEVC_MUXER 0
-%define CONFIG_HLS_MUXER 0
-%define CONFIG_ICO_MUXER 0
-%define CONFIG_ILBC_MUXER 0
-%define CONFIG_IMAGE2_MUXER 0
-%define CONFIG_IMAGE2PIPE_MUXER 0
-%define CONFIG_IPOD_MUXER 0
-%define CONFIG_IRCAM_MUXER 0
-%define CONFIG_ISMV_MUXER 0
-%define CONFIG_IVF_MUXER 0
-%define CONFIG_JACOSUB_MUXER 0
-%define CONFIG_LATM_MUXER 0
-%define CONFIG_LRC_MUXER 0
-%define CONFIG_M4V_MUXER 0
-%define CONFIG_MD5_MUXER 0
-%define CONFIG_MATROSKA_MUXER 0
-%define CONFIG_MATROSKA_AUDIO_MUXER 0
-%define CONFIG_MICRODVD_MUXER 0
-%define CONFIG_MJPEG_MUXER 0
-%define CONFIG_MLP_MUXER 0
-%define CONFIG_MMF_MUXER 0
-%define CONFIG_MOV_MUXER 0
-%define CONFIG_MP2_MUXER 0
-%define CONFIG_MP3_MUXER 0
-%define CONFIG_MP4_MUXER 0
-%define CONFIG_MPEG1SYSTEM_MUXER 0
-%define CONFIG_MPEG1VCD_MUXER 0
-%define CONFIG_MPEG1VIDEO_MUXER 0
-%define CONFIG_MPEG2DVD_MUXER 0
-%define CONFIG_MPEG2SVCD_MUXER 0
-%define CONFIG_MPEG2VIDEO_MUXER 0
-%define CONFIG_MPEG2VOB_MUXER 0
-%define CONFIG_MPEGTS_MUXER 0
-%define CONFIG_MPJPEG_MUXER 0
-%define CONFIG_MXF_MUXER 0
-%define CONFIG_MXF_D10_MUXER 0
-%define CONFIG_MXF_OPATOM_MUXER 0
-%define CONFIG_NULL_MUXER 0
-%define CONFIG_NUT_MUXER 0
-%define CONFIG_OGA_MUXER 0
-%define CONFIG_OGG_MUXER 0
-%define CONFIG_OGV_MUXER 0
-%define CONFIG_OMA_MUXER 0
-%define CONFIG_OPUS_MUXER 0
-%define CONFIG_PCM_ALAW_MUXER 0
-%define CONFIG_PCM_MULAW_MUXER 0
-%define CONFIG_PCM_F64BE_MUXER 0
-%define CONFIG_PCM_F64LE_MUXER 0
-%define CONFIG_PCM_F32BE_MUXER 0
-%define CONFIG_PCM_F32LE_MUXER 0
-%define CONFIG_PCM_S32BE_MUXER 0
-%define CONFIG_PCM_S32LE_MUXER 0
-%define CONFIG_PCM_S24BE_MUXER 0
-%define CONFIG_PCM_S24LE_MUXER 0
-%define CONFIG_PCM_S16BE_MUXER 0
-%define CONFIG_PCM_S16LE_MUXER 0
-%define CONFIG_PCM_S8_MUXER 0
-%define CONFIG_PCM_U32BE_MUXER 0
-%define CONFIG_PCM_U32LE_MUXER 0
-%define CONFIG_PCM_U24BE_MUXER 0
-%define CONFIG_PCM_U24LE_MUXER 0
-%define CONFIG_PCM_U16BE_MUXER 0
-%define CONFIG_PCM_U16LE_MUXER 0
-%define CONFIG_PCM_U8_MUXER 0
-%define CONFIG_PSP_MUXER 0
-%define CONFIG_RAWVIDEO_MUXER 0
-%define CONFIG_RM_MUXER 0
-%define CONFIG_ROQ_MUXER 0
-%define CONFIG_RSO_MUXER 0
-%define CONFIG_RTP_MUXER 0
-%define CONFIG_RTP_MPEGTS_MUXER 0
-%define CONFIG_RTSP_MUXER 0
-%define CONFIG_SAP_MUXER 0
-%define CONFIG_SEGMENT_MUXER 0
-%define CONFIG_STREAM_SEGMENT_MUXER 0
-%define CONFIG_SINGLEJPEG_MUXER 0
-%define CONFIG_SMJPEG_MUXER 0
-%define CONFIG_SMOOTHSTREAMING_MUXER 0
-%define CONFIG_SOX_MUXER 0
-%define CONFIG_SPX_MUXER 0
-%define CONFIG_SPDIF_MUXER 0
-%define CONFIG_SRT_MUXER 0
-%define CONFIG_SWF_MUXER 0
-%define CONFIG_TEE_MUXER 0
-%define CONFIG_TG2_MUXER 0
-%define CONFIG_TGP_MUXER 0
-%define CONFIG_MKVTIMESTAMP_V2_MUXER 0
-%define CONFIG_TRUEHD_MUXER 0
-%define CONFIG_TTA_MUXER 0
-%define CONFIG_UNCODEDFRAMECRC_MUXER 0
-%define CONFIG_VC1_MUXER 0
-%define CONFIG_VC1T_MUXER 0
-%define CONFIG_VOC_MUXER 0
-%define CONFIG_W64_MUXER 0
-%define CONFIG_WAV_MUXER 0
-%define CONFIG_WEBM_MUXER 0
-%define CONFIG_WEBM_DASH_MANIFEST_MUXER 0
-%define CONFIG_WEBM_CHUNK_MUXER 0
-%define CONFIG_WEBP_MUXER 0
-%define CONFIG_WEBVTT_MUXER 0
-%define CONFIG_WTV_MUXER 0
-%define CONFIG_WV_MUXER 0
-%define CONFIG_YUV4MPEGPIPE_MUXER 0
-%define CONFIG_CHROMAPRINT_MUXER 0
-%define CONFIG_LIBNUT_MUXER 0
-%define CONFIG_ALSA_OUTDEV 0
-%define CONFIG_CACA_OUTDEV 0
-%define CONFIG_DECKLINK_OUTDEV 0
-%define CONFIG_FBDEV_OUTDEV 0
-%define CONFIG_OPENGL_OUTDEV 0
-%define CONFIG_OSS_OUTDEV 0
-%define CONFIG_PULSE_OUTDEV 0
-%define CONFIG_SDL2_OUTDEV 0
-%define CONFIG_SNDIO_OUTDEV 0
-%define CONFIG_V4L2_OUTDEV 0
-%define CONFIG_XV_OUTDEV 0
-%define CONFIG_AAC_PARSER 0
-%define CONFIG_AAC_LATM_PARSER 0
-%define CONFIG_AC3_PARSER 0
-%define CONFIG_ADX_PARSER 0
-%define CONFIG_BMP_PARSER 0
-%define CONFIG_CAVSVIDEO_PARSER 0
-%define CONFIG_COOK_PARSER 0
-%define CONFIG_DCA_PARSER 0
-%define CONFIG_DIRAC_PARSER 0
-%define CONFIG_DNXHD_PARSER 0
-%define CONFIG_DPX_PARSER 0
-%define CONFIG_DVAUDIO_PARSER 0
-%define CONFIG_DVBSUB_PARSER 0
-%define CONFIG_DVDSUB_PARSER 0
-%define CONFIG_DVD_NAV_PARSER 0
-%define CONFIG_FLAC_PARSER 1
-%define CONFIG_G729_PARSER 0
-%define CONFIG_GSM_PARSER 0
-%define CONFIG_H261_PARSER 0
-%define CONFIG_H263_PARSER 0
-%define CONFIG_H264_PARSER 0
-%define CONFIG_HEVC_PARSER 0
-%define CONFIG_MJPEG_PARSER 0
-%define CONFIG_MLP_PARSER 0
-%define CONFIG_MPEG4VIDEO_PARSER 0
-%define CONFIG_MPEGAUDIO_PARSER 0
-%define CONFIG_MPEGVIDEO_PARSER 0
-%define CONFIG_OPUS_PARSER 0
-%define CONFIG_PNG_PARSER 0
-%define CONFIG_PNM_PARSER 0
-%define CONFIG_RV30_PARSER 0
-%define CONFIG_RV40_PARSER 0
-%define CONFIG_TAK_PARSER 0
-%define CONFIG_VC1_PARSER 0
-%define CONFIG_VORBIS_PARSER 0
-%define CONFIG_VP3_PARSER 0
+%define CONFIG_FLAC_PARSER 0
%define CONFIG_VP8_PARSER 1
%define CONFIG_VP9_PARSER 1
-%define CONFIG_ASYNC_PROTOCOL 0
-%define CONFIG_BLURAY_PROTOCOL 0
-%define CONFIG_CACHE_PROTOCOL 0
-%define CONFIG_CONCAT_PROTOCOL 0
-%define CONFIG_CRYPTO_PROTOCOL 0
-%define CONFIG_DATA_PROTOCOL 0
-%define CONFIG_FFRTMPCRYPT_PROTOCOL 0
-%define CONFIG_FFRTMPHTTP_PROTOCOL 0
-%define CONFIG_FILE_PROTOCOL 0
-%define CONFIG_FTP_PROTOCOL 0
-%define CONFIG_GOPHER_PROTOCOL 0
-%define CONFIG_HLS_PROTOCOL 0
-%define CONFIG_HTTP_PROTOCOL 0
-%define CONFIG_HTTPPROXY_PROTOCOL 0
-%define CONFIG_HTTPS_PROTOCOL 0
-%define CONFIG_ICECAST_PROTOCOL 0
-%define CONFIG_MMSH_PROTOCOL 0
-%define CONFIG_MMST_PROTOCOL 0
-%define CONFIG_MD5_PROTOCOL 0
-%define CONFIG_PIPE_PROTOCOL 0
-%define CONFIG_RTMP_PROTOCOL 0
-%define CONFIG_RTMPE_PROTOCOL 0
-%define CONFIG_RTMPS_PROTOCOL 0
-%define CONFIG_RTMPT_PROTOCOL 0
-%define CONFIG_RTMPTE_PROTOCOL 0
-%define CONFIG_RTMPTS_PROTOCOL 0
-%define CONFIG_RTP_PROTOCOL 0
-%define CONFIG_SCTP_PROTOCOL 0
-%define CONFIG_SRTP_PROTOCOL 0
-%define CONFIG_SUBFILE_PROTOCOL 0
-%define CONFIG_TEE_PROTOCOL 0
-%define CONFIG_TCP_PROTOCOL 0
-%define CONFIG_TLS_GNUTLS_PROTOCOL 0
-%define CONFIG_TLS_SCHANNEL_PROTOCOL 0
-%define CONFIG_TLS_SECURETRANSPORT_PROTOCOL 0
-%define CONFIG_TLS_OPENSSL_PROTOCOL 0
-%define CONFIG_UDP_PROTOCOL 0
-%define CONFIG_UDPLITE_PROTOCOL 0
-%define CONFIG_UNIX_PROTOCOL 0
-%define CONFIG_LIBRTMP_PROTOCOL 0
-%define CONFIG_LIBRTMPE_PROTOCOL 0
-%define CONFIG_LIBRTMPS_PROTOCOL 0
-%define CONFIG_LIBRTMPT_PROTOCOL 0
-%define CONFIG_LIBRTMPTE_PROTOCOL 0
-%define CONFIG_LIBSSH_PROTOCOL 0
-%define CONFIG_LIBSMBCLIENT_PROTOCOL 0
diff --git a/media/ffvpx/config_win64.h b/media/ffvpx/config_win64.h
index 64d09d2265..b74b8d5072 100644
--- a/media/ffvpx/config_win64.h
+++ b/media/ffvpx/config_win64.h
@@ -1,12 +1,12 @@
/* Automatically generated by configure - do not modify! */
#ifndef FFMPEG_CONFIG_H
#define FFMPEG_CONFIG_H
-#define FFMPEG_CONFIGURATION "--disable-everything --disable-protocols --disable-demuxers --disable-muxers --disable-filters --disable-programs --disable-doc --disable-parsers --enable-parser=vp8 --enable-parser=vp9 --enable-decoder=vp8 --enable-decoder=vp9 --disable-static --enable-shared --disable-debug --disable-sdl --disable-libxcb --disable-securetransport --disable-iconv --disable-swresample --disable-swscale --disable-avdevice --disable-avfilter --disable-avformat --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vda --disable-vdpau --disable-videotoolbox --enable-asm --enable-yasm --toolchain=msvc"
+#define FFMPEG_CONFIGURATION "--disable-everything --disable-protocols --disable-demuxers --disable-muxers --disable-filters --disable-programs --disable-doc --disable-parsers --enable-parser=vp8 --enable-parser=vp9 --enable-decoder=vp8 --enable-decoder=vp9 --disable-static --enable-shared --disable-debug --disable-sdl2 --disable-libxcb --disable-securetransport --disable-iconv --disable-swresample --disable-swscale --disable-avdevice --disable-avfilter --disable-avformat --disable-d3d11va --disable-dxva2 --disable-vaapi --disable-vdpau --disable-videotoolbox --enable-decoder=flac --enable-asm --enable-yasm --toolchain=msvc"
#define FFMPEG_LICENSE "LGPL version 2.1 or later"
-#define CONFIG_THIS_YEAR 2016
+#define CONFIG_THIS_YEAR 2017
#define FFMPEG_DATADIR "/usr/local/share/ffmpeg"
#define AVCONV_DATADIR "/usr/local/share/ffmpeg"
-#define CC_IDENT "Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x64"
+#define CC_IDENT "Microsoft (R) C/C++ Optimizing Compiler Version 19.11.25508.2 for x64"
#define av_restrict __restrict
#define EXTERN_PREFIX ""
#define EXTERN_ASM
@@ -79,8 +79,8 @@
#define HAVE_MIPSDSP 0
#define HAVE_MIPSDSPR2 0
#define HAVE_MSA 0
-#define HAVE_LOONGSON2 1
-#define HAVE_LOONGSON3 1
+#define HAVE_LOONGSON2 0
+#define HAVE_LOONGSON3 0
#define HAVE_MMI 0
#define HAVE_ARMV5TE_EXTERNAL 0
#define HAVE_ARMV6_EXTERNAL 0
@@ -172,37 +172,38 @@
#define HAVE_MMI_INLINE 0
#define HAVE_ALIGNED_STACK 1
#define HAVE_FAST_64BIT 1
-#define HAVE_FAST_CLZ 1
+#define HAVE_FAST_CLZ 0
#define HAVE_FAST_CMOV 1
#define HAVE_LOCAL_ALIGNED_8 1
#define HAVE_LOCAL_ALIGNED_16 1
#define HAVE_LOCAL_ALIGNED_32 1
#define HAVE_SIMD_ALIGN_16 1
+#define HAVE_SIMD_ALIGN_32 1
#define HAVE_ATOMICS_GCC 0
#define HAVE_ATOMICS_SUNCC 0
#define HAVE_ATOMICS_WIN32 1
#define HAVE_ATOMIC_CAS_PTR 0
-#define HAVE_ATOMIC_COMPARE_EXCHANGE 0
#define HAVE_MACHINE_RW_BARRIER 0
#define HAVE_MEMORYBARRIER 1
#define HAVE_MM_EMPTY 0
#define HAVE_RDTSC 1
#define HAVE_SARESTART 0
-#define HAVE_SEM_TIMEDWAIT 1
+#define HAVE_SEM_TIMEDWAIT 0
#define HAVE_SYNC_VAL_COMPARE_AND_SWAP 0
#define HAVE_CABS 0
#define HAVE_CEXP 0
#define HAVE_INLINE_ASM 0
#define HAVE_SYMVER 0
-#define HAVE_YASM 1
+#define HAVE_X86ASM 1
#define HAVE_BIGENDIAN 0
#define HAVE_FAST_UNALIGNED 1
-#define HAVE_ALSA_ASOUNDLIB_H 0
#define HAVE_ALTIVEC_H 0
#define HAVE_ARPA_INET_H 0
#define HAVE_ASM_TYPES_H 0
#define HAVE_CDIO_PARANOIA_H 0
#define HAVE_CDIO_PARANOIA_PARANOIA_H 0
+#define HAVE_CUDA_H 0
+#define HAVE_D3D11_H 1
#define HAVE_DISPATCH_DISPATCH_H 0
#define HAVE_DEV_BKTR_IOCTL_BT848_H 0
#define HAVE_DEV_BKTR_IOCTL_METEOR_H 0
@@ -212,7 +213,7 @@
#define HAVE_DIRECT_H 1
#define HAVE_DIRENT_H 0
#define HAVE_DLFCN_H 0
-#define HAVE_D3D11_H 1
+#define HAVE_DXGIDEBUG_H 1
#define HAVE_DXVA_H 1
#define HAVE_ES2_GL_H 0
#define HAVE_GSM_H 0
@@ -221,13 +222,15 @@
#define HAVE_MACHINE_IOCTL_BT848_H 0
#define HAVE_MACHINE_IOCTL_METEOR_H 0
#define HAVE_OPENCV2_CORE_CORE_C_H 0
+#define HAVE_OPENJPEG_2_3_OPENJPEG_H 0
+#define HAVE_OPENJPEG_2_2_OPENJPEG_H 0
#define HAVE_OPENJPEG_2_1_OPENJPEG_H 0
#define HAVE_OPENJPEG_2_0_OPENJPEG_H 0
#define HAVE_OPENJPEG_1_5_OPENJPEG_H 0
#define HAVE_OPENGL_GL3_H 0
#define HAVE_POLL_H 0
-#define HAVE_SNDIO_H 0
#define HAVE_SOUNDCARD_H 0
+#define HAVE_STDATOMIC_H 0
#define HAVE_SYS_MMAN_H 0
#define HAVE_SYS_PARAM_H 0
#define HAVE_SYS_RESOURCE_H 0
@@ -279,7 +282,6 @@
#define HAVE_COMMANDLINETOARGVW 1
#define HAVE_COTASKMEMFREE 1
#define HAVE_CRYPTGENRANDOM 1
-#define HAVE_DLOPEN 0
#define HAVE_FCNTL 0
#define HAVE_FLT_LIM 1
#define HAVE_FORK 0
@@ -299,7 +301,7 @@
#define HAVE_ISATTY 1
#define HAVE_JACK_PORT_GET_LATENCY_RANGE 0
#define HAVE_KBHIT 1
-#define HAVE_LOADLIBRARY 0
+#define HAVE_LOADLIBRARY 1
#define HAVE_LSTAT 0
#define HAVE_LZO1X_999_COMPRESS 0
#define HAVE_MACH_ABSOLUTE_TIME 0
@@ -326,11 +328,13 @@
#define HAVE_OS2THREADS 0
#define HAVE_W32THREADS 1
#define HAVE_AS_DN_DIRECTIVE 0
+#define HAVE_AS_FPU_DIRECTIVE 0
#define HAVE_AS_FUNC 0
#define HAVE_AS_OBJECT_ARCH 0
#define HAVE_ASM_MOD_Q 0
#define HAVE_ATTRIBUTE_MAY_ALIAS 0
#define HAVE_ATTRIBUTE_PACKED 0
+#define HAVE_BLOCKS_EXTENSION 0
#define HAVE_EBP_AVAILABLE 0
#define HAVE_EBX_AVAILABLE 0
#define HAVE_GNU_AS 0
@@ -347,12 +351,13 @@
#define HAVE_XFORM_ASM 0
#define HAVE_XMM_CLOBBERS 0
#define HAVE_CONDITION_VARIABLE_PTR 1
+#define HAVE_KCMVIDEOCODECTYPE_HEVC 0
#define HAVE_SOCKLEN_T 1
#define HAVE_STRUCT_ADDRINFO 1
#define HAVE_STRUCT_GROUP_SOURCE_REQ 1
#define HAVE_STRUCT_IP_MREQ_SOURCE 1
#define HAVE_STRUCT_IPV6_MREQ 1
-#define HAVE_STRUCT_MSGHDR_MSG_FLAGS 1
+#define HAVE_STRUCT_MSGHDR_MSG_FLAGS 0
#define HAVE_STRUCT_POLLFD 0
#define HAVE_STRUCT_RUSAGE_RU_MAXRSS 0
#define HAVE_STRUCT_SCTP_EVENT_SUBSCRIBE 0
@@ -363,36 +368,20 @@
#define HAVE_STRUCT_V4L2_FRMIVALENUM_DISCRETE 0
#define HAVE_ATOMICS_NATIVE 1
#define HAVE_DOS_PATHS 1
-#define HAVE_DXVA2_LIB 0
-#define HAVE_DXVA2API_COBJ 1
#define HAVE_LIBC_MSVCRT 1
-#define HAVE_LIBDC1394_1 0
-#define HAVE_LIBDC1394_2 0
#define HAVE_MAKEINFO 1
#define HAVE_MAKEINFO_HTML 0
#define HAVE_MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS 0
#define HAVE_PERL 1
#define HAVE_POD2MAN 1
-#define HAVE_SDL2 0
#define HAVE_SECTION_DATA_REL_RO 0
#define HAVE_TEXI2HTML 0
#define HAVE_THREADS 1
+#define HAVE_UWP 0
#define HAVE_VAAPI_DRM 0
#define HAVE_VAAPI_X11 0
#define HAVE_VDPAU_X11 0
#define HAVE_WINRT 0
-#define HAVE_XLIB 0
-#define CONFIG_BSFS 0
-#define CONFIG_DECODERS 1
-#define CONFIG_ENCODERS 0
-#define CONFIG_HWACCELS 0
-#define CONFIG_PARSERS 1
-#define CONFIG_INDEVS 0
-#define CONFIG_OUTDEVS 0
-#define CONFIG_FILTERS 0
-#define CONFIG_DEMUXERS 0
-#define CONFIG_MUXERS 0
-#define CONFIG_PROTOCOLS 0
#define CONFIG_DOC 0
#define CONFIG_HTMLPAGES 0
#define CONFIG_MANPAGES 1
@@ -400,13 +389,17 @@
#define CONFIG_TXTPAGES 1
#define CONFIG_AVIO_DIR_CMD_EXAMPLE 1
#define CONFIG_AVIO_READING_EXAMPLE 1
-#define CONFIG_DECODING_ENCODING_EXAMPLE 0
+#define CONFIG_DECODE_AUDIO_EXAMPLE 1
+#define CONFIG_DECODE_VIDEO_EXAMPLE 1
#define CONFIG_DEMUXING_DECODING_EXAMPLE 0
+#define CONFIG_ENCODE_AUDIO_EXAMPLE 1
+#define CONFIG_ENCODE_VIDEO_EXAMPLE 1
#define CONFIG_EXTRACT_MVS_EXAMPLE 0
#define CONFIG_FILTER_AUDIO_EXAMPLE 0
#define CONFIG_FILTERING_AUDIO_EXAMPLE 0
#define CONFIG_FILTERING_VIDEO_EXAMPLE 0
#define CONFIG_HTTP_MULTICLIENT_EXAMPLE 0
+#define CONFIG_HW_DECODE_EXAMPLE 0
#define CONFIG_METADATA_EXAMPLE 0
#define CONFIG_MUXING_EXAMPLE 0
#define CONFIG_QSVDEC_EXAMPLE 0
@@ -415,27 +408,55 @@
#define CONFIG_SCALING_VIDEO_EXAMPLE 0
#define CONFIG_TRANSCODE_AAC_EXAMPLE 0
#define CONFIG_TRANSCODING_EXAMPLE 0
-#define CONFIG_AVISYNTH 0
+#define CONFIG_ALSA 0
+#define CONFIG_APPKIT 0
+#define CONFIG_AVFOUNDATION 0
#define CONFIG_BZLIB 0
-#define CONFIG_CHROMAPRINT 0
-#define CONFIG_CRYSTALHD 0
-#define CONFIG_DECKLINK 0
+#define CONFIG_COREIMAGE 0
+#define CONFIG_ICONV 0
+#define CONFIG_JACK 0
+#define CONFIG_LIBXCB 0
+#define CONFIG_LIBXCB_SHM 0
+#define CONFIG_LIBXCB_SHAPE 0
+#define CONFIG_LIBXCB_XFIXES 0
+#define CONFIG_LZMA 0
+#define CONFIG_SCHANNEL 1
+#define CONFIG_SDL2 0
+#define CONFIG_SECURETRANSPORT 0
+#define CONFIG_SNDIO 0
+#define CONFIG_XLIB 1
+#define CONFIG_ZLIB 0
+#define CONFIG_AVISYNTH 0
#define CONFIG_FREI0R 0
-#define CONFIG_GCRYPT 0
+#define CONFIG_LIBCDIO 0
+#define CONFIG_LIBRUBBERBAND 0
+#define CONFIG_LIBVIDSTAB 0
+#define CONFIG_LIBX264 0
+#define CONFIG_LIBX265 0
+#define CONFIG_LIBXAVS 0
+#define CONFIG_LIBXVID 0
+#define CONFIG_DECKLINK 0
+#define CONFIG_LIBNDI_NEWTEK 0
+#define CONFIG_LIBFDK_AAC 0
+#define CONFIG_OPENSSL 0
#define CONFIG_GMP 0
+#define CONFIG_LIBOPENCORE_AMRNB 0
+#define CONFIG_LIBOPENCORE_AMRWB 0
+#define CONFIG_LIBVO_AMRWBENC 0
+#define CONFIG_RKMPP 0
+#define CONFIG_LIBSMBCLIENT 0
+#define CONFIG_CHROMAPRINT 0
+#define CONFIG_GCRYPT 0
#define CONFIG_GNUTLS 0
-#define CONFIG_ICONV 0
#define CONFIG_JNI 0
#define CONFIG_LADSPA 0
#define CONFIG_LIBASS 0
#define CONFIG_LIBBLURAY 0
#define CONFIG_LIBBS2B 0
#define CONFIG_LIBCACA 0
-#define CONFIG_LIBCDIO 0
#define CONFIG_LIBCELT 0
#define CONFIG_LIBDC1394 0
-#define CONFIG_LIBEBUR128 0
-#define CONFIG_LIBFDK_AAC 0
+#define CONFIG_LIBDRM 0
#define CONFIG_LIBFLITE 0
#define CONFIG_LIBFONTCONFIG 0
#define CONFIG_LIBFREETYPE 0
@@ -447,18 +468,15 @@
#define CONFIG_LIBKVAZAAR 0
#define CONFIG_LIBMODPLUG 0
#define CONFIG_LIBMP3LAME 0
-#define CONFIG_LIBNUT 0
-#define CONFIG_LIBOPENCORE_AMRNB 0
-#define CONFIG_LIBOPENCORE_AMRWB 0
+#define CONFIG_LIBMYSOFA 0
#define CONFIG_LIBOPENCV 0
#define CONFIG_LIBOPENH264 0
#define CONFIG_LIBOPENJPEG 0
#define CONFIG_LIBOPENMPT 0
#define CONFIG_LIBOPUS 0
#define CONFIG_LIBPULSE 0
+#define CONFIG_LIBRSVG 0
#define CONFIG_LIBRTMP 0
-#define CONFIG_LIBRUBBERBAND 0
-#define CONFIG_LIBSCHROEDINGER 0
#define CONFIG_LIBSHINE 0
#define CONFIG_LIBSMBCLIENT 0
#define CONFIG_LIBSNAPPY 0
@@ -469,53 +487,37 @@
#define CONFIG_LIBTHEORA 0
#define CONFIG_LIBTWOLAME 0
#define CONFIG_LIBV4L2 0
-#define CONFIG_LIBVIDSTAB 0
-#define CONFIG_LIBVO_AMRWBENC 0
+#define CONFIG_LIBVMAF 0
#define CONFIG_LIBVORBIS 0
#define CONFIG_LIBVPX 0
#define CONFIG_LIBWAVPACK 0
#define CONFIG_LIBWEBP 0
-#define CONFIG_LIBX264 0
-#define CONFIG_LIBX265 0
-#define CONFIG_LIBXAVS 0
-#define CONFIG_LIBXCB 0
-#define CONFIG_LIBXCB_SHM 0
-#define CONFIG_LIBXCB_SHAPE 0
-#define CONFIG_LIBXCB_XFIXES 0
-#define CONFIG_LIBXVID 0
+#define CONFIG_LIBXML2 0
#define CONFIG_LIBZIMG 0
#define CONFIG_LIBZMQ 0
#define CONFIG_LIBZVBI 0
-#define CONFIG_LZMA 0
#define CONFIG_MEDIACODEC 0
-#define CONFIG_NETCDF 0
#define CONFIG_OPENAL 0
#define CONFIG_OPENCL 0
#define CONFIG_OPENGL 0
-#define CONFIG_OPENSSL 0
-#define CONFIG_SCHANNEL 1
-#define CONFIG_SDL 0
-#define CONFIG_SDL2 0
-#define CONFIG_SECURETRANSPORT 0
-#define CONFIG_VIDEOTOOLBOX 0
-#define CONFIG_X11GRAB 0
-#define CONFIG_XLIB 0
-#define CONFIG_ZLIB 0
#define CONFIG_AUDIOTOOLBOX 0
-#define CONFIG_CUDA 0
-#define CONFIG_CUVID 0
+#define CONFIG_CRYSTALHD 0
+#define CONFIG_CUDA 1
+#define CONFIG_CUVID 1
#define CONFIG_D3D11VA 0
#define CONFIG_DXVA2 0
-#define CONFIG_LIBMFX 0
-#define CONFIG_LIBNPP 0
-#define CONFIG_MMAL 0
-#define CONFIG_NVENC 0
-#define CONFIG_OMX 0
+#define CONFIG_NVENC 1
#define CONFIG_VAAPI 0
#define CONFIG_VDA 0
#define CONFIG_VDPAU 0
-#define CONFIG_VIDEOTOOLBOX_HWACCEL 0
+#define CONFIG_VIDEOTOOLBOX 0
+#define CONFIG_V4L2_M2M 0
#define CONFIG_XVMC 0
+#define CONFIG_CUDA_SDK 0
+#define CONFIG_LIBNPP 0
+#define CONFIG_LIBMFX 0
+#define CONFIG_MMAL 0
+#define CONFIG_OMX 0
#define CONFIG_FTRAPV 0
#define CONFIG_GRAY 0
#define CONFIG_HARDCODED_TABLES 0
@@ -554,16 +556,27 @@
#define CONFIG_PIXELUTILS 0
#define CONFIG_NETWORK 0
#define CONFIG_RDFT 0
+#define CONFIG_AUTODETECT 0
#define CONFIG_FONTCONFIG 0
-#define CONFIG_MEMALIGN_HACK 0
+#define CONFIG_LINUX_PERF 0
#define CONFIG_MEMORY_POISONING 0
#define CONFIG_NEON_CLOBBER_TEST 0
+#define CONFIG_OSSFUZZ 0
#define CONFIG_PIC 1
-#define CONFIG_POD2MAN 1
-#define CONFIG_RAISE_MAJOR 0
#define CONFIG_THUMB 0
#define CONFIG_VALGRIND_BACKTRACE 0
#define CONFIG_XMM_CLOBBER_TEST 0
+#define CONFIG_BSFS 1
+#define CONFIG_DECODERS 1
+#define CONFIG_ENCODERS 0
+#define CONFIG_HWACCELS 0
+#define CONFIG_PARSERS 1
+#define CONFIG_INDEVS 0
+#define CONFIG_OUTDEVS 0
+#define CONFIG_FILTERS 0
+#define CONFIG_DEMUXERS 0
+#define CONFIG_MUXERS 0
+#define CONFIG_PROTOCOLS 0
#define CONFIG_AANDCTTABLES 0
#define CONFIG_AC3DSP 0
#define CONFIG_AUDIO_FRAME_QUEUE 0
@@ -581,20 +594,22 @@
#define CONFIG_FMTCONVERT 0
#define CONFIG_FRAME_THREAD_ENCODER 0
#define CONFIG_G722DSP 0
-#define CONFIG_GOLOMB 1
+#define CONFIG_GOLOMB 0
#define CONFIG_GPLV3 0
#define CONFIG_H263DSP 0
#define CONFIG_H264CHROMA 0
#define CONFIG_H264DSP 0
+#define CONFIG_H264PARSE 0
#define CONFIG_H264PRED 1
#define CONFIG_H264QPEL 0
+#define CONFIG_HEVCPARSE 0
#define CONFIG_HPELDSP 0
#define CONFIG_HUFFMAN 0
#define CONFIG_HUFFYUVDSP 0
#define CONFIG_HUFFYUVENCDSP 0
#define CONFIG_IDCTDSP 0
#define CONFIG_IIRFILTER 0
-#define CONFIG_IMDCT15 0
+#define CONFIG_MDCT15 0
#define CONFIG_INTRAX8 0
#define CONFIG_ISO_MEDIA 0
#define CONFIG_IVIDSP 0
@@ -603,12 +618,14 @@
#define CONFIG_LIBX262 0
#define CONFIG_LLAUDDSP 0
#define CONFIG_LLVIDDSP 0
+#define CONFIG_LLVIDENCDSP 0
#define CONFIG_LPC 0
#define CONFIG_LZF 0
#define CONFIG_ME_CMP 0
#define CONFIG_MPEG_ER 0
#define CONFIG_MPEGAUDIO 0
#define CONFIG_MPEGAUDIODSP 0
+#define CONFIG_MPEGAUDIOHEADER 0
#define CONFIG_MPEGVIDEO 0
#define CONFIG_MPEGVIDEOENC 0
#define CONFIG_MSS34DSP 0
@@ -630,1595 +647,20 @@
#define CONFIG_TEXTUREDSP 0
#define CONFIG_TEXTUREDSPENC 0
#define CONFIG_TPELDSP 0
+#define CONFIG_VAAPI_1 0
#define CONFIG_VAAPI_ENCODE 0
#define CONFIG_VC1DSP 0
#define CONFIG_VIDEODSP 1
#define CONFIG_VP3DSP 0
#define CONFIG_VP56DSP 0
#define CONFIG_VP8DSP 1
-#define CONFIG_VT_BT2020 0
#define CONFIG_WMA_FREQS 0
#define CONFIG_WMV2DSP 0
-#define CONFIG_AAC_ADTSTOASC_BSF 0
-#define CONFIG_CHOMP_BSF 0
-#define CONFIG_DUMP_EXTRADATA_BSF 0
-#define CONFIG_DCA_CORE_BSF 0
-#define CONFIG_H264_MP4TOANNEXB_BSF 0
-#define CONFIG_HEVC_MP4TOANNEXB_BSF 0
-#define CONFIG_IMX_DUMP_HEADER_BSF 0
-#define CONFIG_MJPEG2JPEG_BSF 0
-#define CONFIG_MJPEGA_DUMP_HEADER_BSF 0
-#define CONFIG_MP3_HEADER_DECOMPRESS_BSF 0
-#define CONFIG_MPEG4_UNPACK_BFRAMES_BSF 0
-#define CONFIG_MOV2TEXTSUB_BSF 0
-#define CONFIG_NOISE_BSF 0
-#define CONFIG_REMOVE_EXTRADATA_BSF 0
-#define CONFIG_TEXT2MOVSUB_BSF 0
-#define CONFIG_VP9_SUPERFRAME_BSF 0
-#define CONFIG_AASC_DECODER 0
-#define CONFIG_AIC_DECODER 0
-#define CONFIG_ALIAS_PIX_DECODER 0
-#define CONFIG_AMV_DECODER 0
-#define CONFIG_ANM_DECODER 0
-#define CONFIG_ANSI_DECODER 0
-#define CONFIG_APNG_DECODER 0
-#define CONFIG_ASV1_DECODER 0
-#define CONFIG_ASV2_DECODER 0
-#define CONFIG_AURA_DECODER 0
-#define CONFIG_AURA2_DECODER 0
-#define CONFIG_AVRP_DECODER 0
-#define CONFIG_AVRN_DECODER 0
-#define CONFIG_AVS_DECODER 0
-#define CONFIG_AVUI_DECODER 0
-#define CONFIG_AYUV_DECODER 0
-#define CONFIG_BETHSOFTVID_DECODER 0
-#define CONFIG_BFI_DECODER 0
-#define CONFIG_BINK_DECODER 0
-#define CONFIG_BMP_DECODER 0
-#define CONFIG_BMV_VIDEO_DECODER 0
-#define CONFIG_BRENDER_PIX_DECODER 0
-#define CONFIG_C93_DECODER 0
-#define CONFIG_CAVS_DECODER 0
-#define CONFIG_CDGRAPHICS_DECODER 0
-#define CONFIG_CDXL_DECODER 0
-#define CONFIG_CFHD_DECODER 0
-#define CONFIG_CINEPAK_DECODER 0
-#define CONFIG_CLJR_DECODER 0
-#define CONFIG_CLLC_DECODER 0
-#define CONFIG_COMFORTNOISE_DECODER 0
-#define CONFIG_CPIA_DECODER 0
-#define CONFIG_CSCD_DECODER 0
-#define CONFIG_CYUV_DECODER 0
-#define CONFIG_DDS_DECODER 0
-#define CONFIG_DFA_DECODER 0
-#define CONFIG_DIRAC_DECODER 0
-#define CONFIG_DNXHD_DECODER 0
-#define CONFIG_DPX_DECODER 0
-#define CONFIG_DSICINVIDEO_DECODER 0
-#define CONFIG_DVAUDIO_DECODER 0
-#define CONFIG_DVVIDEO_DECODER 0
-#define CONFIG_DXA_DECODER 0
-#define CONFIG_DXTORY_DECODER 0
-#define CONFIG_DXV_DECODER 0
-#define CONFIG_EACMV_DECODER 0
-#define CONFIG_EAMAD_DECODER 0
-#define CONFIG_EATGQ_DECODER 0
-#define CONFIG_EATGV_DECODER 0
-#define CONFIG_EATQI_DECODER 0
-#define CONFIG_EIGHTBPS_DECODER 0
-#define CONFIG_EIGHTSVX_EXP_DECODER 0
-#define CONFIG_EIGHTSVX_FIB_DECODER 0
-#define CONFIG_ESCAPE124_DECODER 0
-#define CONFIG_ESCAPE130_DECODER 0
-#define CONFIG_EXR_DECODER 0
-#define CONFIG_FFV1_DECODER 0
-#define CONFIG_FFVHUFF_DECODER 0
-#define CONFIG_FIC_DECODER 0
-#define CONFIG_FLASHSV_DECODER 0
-#define CONFIG_FLASHSV2_DECODER 0
-#define CONFIG_FLIC_DECODER 0
-#define CONFIG_FLV_DECODER 0
-#define CONFIG_FOURXM_DECODER 0
-#define CONFIG_FRAPS_DECODER 0
-#define CONFIG_FRWU_DECODER 0
-#define CONFIG_G2M_DECODER 0
-#define CONFIG_GIF_DECODER 0
-#define CONFIG_H261_DECODER 0
-#define CONFIG_H263_DECODER 0
-#define CONFIG_H263I_DECODER 0
-#define CONFIG_H263P_DECODER 0
-#define CONFIG_H264_DECODER 0
-#define CONFIG_H264_CRYSTALHD_DECODER 0
-#define CONFIG_H264_MEDIACODEC_DECODER 0
-#define CONFIG_H264_MMAL_DECODER 0
-#define CONFIG_H264_QSV_DECODER 0
-#define CONFIG_H264_VDA_DECODER 0
-#define CONFIG_H264_VDPAU_DECODER 0
-#define CONFIG_HAP_DECODER 0
-#define CONFIG_HEVC_DECODER 0
-#define CONFIG_HEVC_QSV_DECODER 0
-#define CONFIG_HNM4_VIDEO_DECODER 0
-#define CONFIG_HQ_HQA_DECODER 0
-#define CONFIG_HQX_DECODER 0
-#define CONFIG_HUFFYUV_DECODER 0
-#define CONFIG_IDCIN_DECODER 0
-#define CONFIG_IFF_ILBM_DECODER 0
-#define CONFIG_INDEO2_DECODER 0
-#define CONFIG_INDEO3_DECODER 0
-#define CONFIG_INDEO4_DECODER 0
-#define CONFIG_INDEO5_DECODER 0
-#define CONFIG_INTERPLAY_VIDEO_DECODER 0
-#define CONFIG_JPEG2000_DECODER 0
-#define CONFIG_JPEGLS_DECODER 0
-#define CONFIG_JV_DECODER 0
-#define CONFIG_KGV1_DECODER 0
-#define CONFIG_KMVC_DECODER 0
-#define CONFIG_LAGARITH_DECODER 0
-#define CONFIG_LOCO_DECODER 0
-#define CONFIG_M101_DECODER 0
-#define CONFIG_MAGICYUV_DECODER 0
-#define CONFIG_MDEC_DECODER 0
-#define CONFIG_MIMIC_DECODER 0
-#define CONFIG_MJPEG_DECODER 0
-#define CONFIG_MJPEGB_DECODER 0
-#define CONFIG_MMVIDEO_DECODER 0
-#define CONFIG_MOTIONPIXELS_DECODER 0
-#define CONFIG_MPEG_XVMC_DECODER 0
-#define CONFIG_MPEG1VIDEO_DECODER 0
-#define CONFIG_MPEG2VIDEO_DECODER 0
-#define CONFIG_MPEG4_DECODER 0
-#define CONFIG_MPEG4_CRYSTALHD_DECODER 0
-#define CONFIG_MPEG4_MMAL_DECODER 0
-#define CONFIG_MPEG4_VDPAU_DECODER 0
-#define CONFIG_MPEGVIDEO_DECODER 0
-#define CONFIG_MPEG_VDPAU_DECODER 0
-#define CONFIG_MPEG1_VDPAU_DECODER 0
-#define CONFIG_MPEG2_MMAL_DECODER 0
-#define CONFIG_MPEG2_CRYSTALHD_DECODER 0
-#define CONFIG_MPEG2_QSV_DECODER 0
-#define CONFIG_MSA1_DECODER 0
-#define CONFIG_MSMPEG4_CRYSTALHD_DECODER 0
-#define CONFIG_MSMPEG4V1_DECODER 0
-#define CONFIG_MSMPEG4V2_DECODER 0
-#define CONFIG_MSMPEG4V3_DECODER 0
-#define CONFIG_MSRLE_DECODER 0
-#define CONFIG_MSS1_DECODER 0
-#define CONFIG_MSS2_DECODER 0
-#define CONFIG_MSVIDEO1_DECODER 0
-#define CONFIG_MSZH_DECODER 0
-#define CONFIG_MTS2_DECODER 0
-#define CONFIG_MVC1_DECODER 0
-#define CONFIG_MVC2_DECODER 0
-#define CONFIG_MXPEG_DECODER 0
-#define CONFIG_NUV_DECODER 0
-#define CONFIG_PAF_VIDEO_DECODER 0
-#define CONFIG_PAM_DECODER 0
-#define CONFIG_PBM_DECODER 0
-#define CONFIG_PCX_DECODER 0
-#define CONFIG_PGM_DECODER 0
-#define CONFIG_PGMYUV_DECODER 0
-#define CONFIG_PICTOR_DECODER 0
-#define CONFIG_PNG_DECODER 0
-#define CONFIG_PPM_DECODER 0
-#define CONFIG_PRORES_DECODER 0
-#define CONFIG_PRORES_LGPL_DECODER 0
-#define CONFIG_PTX_DECODER 0
-#define CONFIG_QDRAW_DECODER 0
-#define CONFIG_QPEG_DECODER 0
-#define CONFIG_QTRLE_DECODER 0
-#define CONFIG_R10K_DECODER 0
-#define CONFIG_R210_DECODER 0
-#define CONFIG_RAWVIDEO_DECODER 0
-#define CONFIG_RL2_DECODER 0
-#define CONFIG_ROQ_DECODER 0
-#define CONFIG_RPZA_DECODER 0
-#define CONFIG_RSCC_DECODER 0
-#define CONFIG_RV10_DECODER 0
-#define CONFIG_RV20_DECODER 0
-#define CONFIG_RV30_DECODER 0
-#define CONFIG_RV40_DECODER 0
-#define CONFIG_S302M_DECODER 0
-#define CONFIG_SANM_DECODER 0
-#define CONFIG_SCREENPRESSO_DECODER 0
-#define CONFIG_SDX2_DPCM_DECODER 0
-#define CONFIG_SGI_DECODER 0
-#define CONFIG_SGIRLE_DECODER 0
-#define CONFIG_SHEERVIDEO_DECODER 0
-#define CONFIG_SMACKER_DECODER 0
-#define CONFIG_SMC_DECODER 0
-#define CONFIG_SMVJPEG_DECODER 0
-#define CONFIG_SNOW_DECODER 0
-#define CONFIG_SP5X_DECODER 0
-#define CONFIG_SUNRAST_DECODER 0
-#define CONFIG_SVQ1_DECODER 0
-#define CONFIG_SVQ3_DECODER 0
-#define CONFIG_TARGA_DECODER 0
-#define CONFIG_TARGA_Y216_DECODER 0
-#define CONFIG_TDSC_DECODER 0
-#define CONFIG_THEORA_DECODER 0
-#define CONFIG_THP_DECODER 0
-#define CONFIG_TIERTEXSEQVIDEO_DECODER 0
-#define CONFIG_TIFF_DECODER 0
-#define CONFIG_TMV_DECODER 0
-#define CONFIG_TRUEMOTION1_DECODER 0
-#define CONFIG_TRUEMOTION2_DECODER 0
-#define CONFIG_TRUEMOTION2RT_DECODER 0
-#define CONFIG_TSCC_DECODER 0
-#define CONFIG_TSCC2_DECODER 0
-#define CONFIG_TXD_DECODER 0
-#define CONFIG_ULTI_DECODER 0
-#define CONFIG_UTVIDEO_DECODER 0
-#define CONFIG_V210_DECODER 0
-#define CONFIG_V210X_DECODER 0
-#define CONFIG_V308_DECODER 0
-#define CONFIG_V408_DECODER 0
-#define CONFIG_V410_DECODER 0
-#define CONFIG_VB_DECODER 0
-#define CONFIG_VBLE_DECODER 0
-#define CONFIG_VC1_DECODER 0
-#define CONFIG_VC1_CRYSTALHD_DECODER 0
-#define CONFIG_VC1_VDPAU_DECODER 0
-#define CONFIG_VC1IMAGE_DECODER 0
-#define CONFIG_VC1_MMAL_DECODER 0
-#define CONFIG_VC1_QSV_DECODER 0
-#define CONFIG_VCR1_DECODER 0
-#define CONFIG_VMDVIDEO_DECODER 0
-#define CONFIG_VMNC_DECODER 0
-#define CONFIG_VP3_DECODER 0
-#define CONFIG_VP5_DECODER 0
-#define CONFIG_VP6_DECODER 0
-#define CONFIG_VP6A_DECODER 0
-#define CONFIG_VP6F_DECODER 0
-#define CONFIG_VP7_DECODER 0
+#define CONFIG_NULL_BSF 1
#define CONFIG_VP8_DECODER 1
#define CONFIG_VP9_DECODER 1
-#define CONFIG_VQA_DECODER 0
-#define CONFIG_WEBP_DECODER 0
-#define CONFIG_WMV1_DECODER 0
-#define CONFIG_WMV2_DECODER 0
-#define CONFIG_WMV3_DECODER 0
-#define CONFIG_WMV3_CRYSTALHD_DECODER 0
-#define CONFIG_WMV3_VDPAU_DECODER 0
-#define CONFIG_WMV3IMAGE_DECODER 0
-#define CONFIG_WNV1_DECODER 0
-#define CONFIG_XAN_WC3_DECODER 0
-#define CONFIG_XAN_WC4_DECODER 0
-#define CONFIG_XBM_DECODER 0
-#define CONFIG_XFACE_DECODER 0
-#define CONFIG_XL_DECODER 0
-#define CONFIG_XWD_DECODER 0
-#define CONFIG_Y41P_DECODER 0
-#define CONFIG_YLC_DECODER 0
-#define CONFIG_YOP_DECODER 0
-#define CONFIG_YUV4_DECODER 0
-#define CONFIG_ZERO12V_DECODER 0
-#define CONFIG_ZEROCODEC_DECODER 0
-#define CONFIG_ZLIB_DECODER 0
-#define CONFIG_ZMBV_DECODER 0
-#define CONFIG_AAC_DECODER 0
-#define CONFIG_AAC_FIXED_DECODER 0
-#define CONFIG_AAC_LATM_DECODER 0
-#define CONFIG_AC3_DECODER 0
-#define CONFIG_AC3_FIXED_DECODER 0
-#define CONFIG_ALAC_DECODER 0
-#define CONFIG_ALS_DECODER 0
-#define CONFIG_AMRNB_DECODER 0
-#define CONFIG_AMRWB_DECODER 0
-#define CONFIG_APE_DECODER 0
-#define CONFIG_ATRAC1_DECODER 0
-#define CONFIG_ATRAC3_DECODER 0
-#define CONFIG_ATRAC3P_DECODER 0
-#define CONFIG_BINKAUDIO_DCT_DECODER 0
-#define CONFIG_BINKAUDIO_RDFT_DECODER 0
-#define CONFIG_BMV_AUDIO_DECODER 0
-#define CONFIG_COOK_DECODER 0
-#define CONFIG_DCA_DECODER 0
-#define CONFIG_DSD_LSBF_DECODER 0
-#define CONFIG_DSD_MSBF_DECODER 0
-#define CONFIG_DSD_LSBF_PLANAR_DECODER 0
-#define CONFIG_DSD_MSBF_PLANAR_DECODER 0
-#define CONFIG_DSICINAUDIO_DECODER 0
-#define CONFIG_DSS_SP_DECODER 0
-#define CONFIG_DST_DECODER 0
-#define CONFIG_EAC3_DECODER 0
-#define CONFIG_EVRC_DECODER 0
-#define CONFIG_FFWAVESYNTH_DECODER 0
#define CONFIG_FLAC_DECODER 1
-#define CONFIG_G723_1_DECODER 0
-#define CONFIG_G729_DECODER 0
-#define CONFIG_GSM_DECODER 0
-#define CONFIG_GSM_MS_DECODER 0
-#define CONFIG_IAC_DECODER 0
-#define CONFIG_IMC_DECODER 0
-#define CONFIG_INTERPLAY_ACM_DECODER 0
-#define CONFIG_MACE3_DECODER 0
-#define CONFIG_MACE6_DECODER 0
-#define CONFIG_METASOUND_DECODER 0
-#define CONFIG_MLP_DECODER 0
-#define CONFIG_MP1_DECODER 0
-#define CONFIG_MP1FLOAT_DECODER 0
-#define CONFIG_MP2_DECODER 0
-#define CONFIG_MP2FLOAT_DECODER 0
-#define CONFIG_MP3_DECODER 0
-#define CONFIG_MP3FLOAT_DECODER 0
-#define CONFIG_MP3ADU_DECODER 0
-#define CONFIG_MP3ADUFLOAT_DECODER 0
-#define CONFIG_MP3ON4_DECODER 0
-#define CONFIG_MP3ON4FLOAT_DECODER 0
-#define CONFIG_MPC7_DECODER 0
-#define CONFIG_MPC8_DECODER 0
-#define CONFIG_NELLYMOSER_DECODER 0
-#define CONFIG_ON2AVC_DECODER 0
-#define CONFIG_OPUS_DECODER 0
-#define CONFIG_PAF_AUDIO_DECODER 0
-#define CONFIG_QCELP_DECODER 0
-#define CONFIG_QDM2_DECODER 0
-#define CONFIG_RA_144_DECODER 0
-#define CONFIG_RA_288_DECODER 0
-#define CONFIG_RALF_DECODER 0
-#define CONFIG_SHORTEN_DECODER 0
-#define CONFIG_SIPR_DECODER 0
-#define CONFIG_SMACKAUD_DECODER 0
-#define CONFIG_SONIC_DECODER 0
-#define CONFIG_TAK_DECODER 0
-#define CONFIG_TRUEHD_DECODER 0
-#define CONFIG_TRUESPEECH_DECODER 0
-#define CONFIG_TTA_DECODER 0
-#define CONFIG_TWINVQ_DECODER 0
-#define CONFIG_VMDAUDIO_DECODER 0
-#define CONFIG_VORBIS_DECODER 0
-#define CONFIG_WAVPACK_DECODER 0
-#define CONFIG_WMALOSSLESS_DECODER 0
-#define CONFIG_WMAPRO_DECODER 0
-#define CONFIG_WMAV1_DECODER 0
-#define CONFIG_WMAV2_DECODER 0
-#define CONFIG_WMAVOICE_DECODER 0
-#define CONFIG_WS_SND1_DECODER 0
-#define CONFIG_XMA1_DECODER 0
-#define CONFIG_XMA2_DECODER 0
-#define CONFIG_PCM_ALAW_DECODER 0
-#define CONFIG_PCM_BLURAY_DECODER 0
-#define CONFIG_PCM_DVD_DECODER 0
-#define CONFIG_PCM_F32BE_DECODER 0
-#define CONFIG_PCM_F32LE_DECODER 0
-#define CONFIG_PCM_F64BE_DECODER 0
-#define CONFIG_PCM_F64LE_DECODER 0
-#define CONFIG_PCM_LXF_DECODER 0
-#define CONFIG_PCM_MULAW_DECODER 0
-#define CONFIG_PCM_S8_DECODER 0
-#define CONFIG_PCM_S8_PLANAR_DECODER 0
-#define CONFIG_PCM_S16BE_DECODER 0
-#define CONFIG_PCM_S16BE_PLANAR_DECODER 0
-#define CONFIG_PCM_S16LE_DECODER 0
-#define CONFIG_PCM_S16LE_PLANAR_DECODER 0
-#define CONFIG_PCM_S24BE_DECODER 0
-#define CONFIG_PCM_S24DAUD_DECODER 0
-#define CONFIG_PCM_S24LE_DECODER 0
-#define CONFIG_PCM_S24LE_PLANAR_DECODER 0
-#define CONFIG_PCM_S32BE_DECODER 0
-#define CONFIG_PCM_S32LE_DECODER 0
-#define CONFIG_PCM_S32LE_PLANAR_DECODER 0
-#define CONFIG_PCM_S64BE_DECODER 0
-#define CONFIG_PCM_S64LE_DECODER 0
-#define CONFIG_PCM_U8_DECODER 0
-#define CONFIG_PCM_U16BE_DECODER 0
-#define CONFIG_PCM_U16LE_DECODER 0
-#define CONFIG_PCM_U24BE_DECODER 0
-#define CONFIG_PCM_U24LE_DECODER 0
-#define CONFIG_PCM_U32BE_DECODER 0
-#define CONFIG_PCM_U32LE_DECODER 0
-#define CONFIG_PCM_ZORK_DECODER 0
-#define CONFIG_INTERPLAY_DPCM_DECODER 0
-#define CONFIG_ROQ_DPCM_DECODER 0
-#define CONFIG_SOL_DPCM_DECODER 0
-#define CONFIG_XAN_DPCM_DECODER 0
-#define CONFIG_ADPCM_4XM_DECODER 0
-#define CONFIG_ADPCM_ADX_DECODER 0
-#define CONFIG_ADPCM_AFC_DECODER 0
-#define CONFIG_ADPCM_AICA_DECODER 0
-#define CONFIG_ADPCM_CT_DECODER 0
-#define CONFIG_ADPCM_DTK_DECODER 0
-#define CONFIG_ADPCM_EA_DECODER 0
-#define CONFIG_ADPCM_EA_MAXIS_XA_DECODER 0
-#define CONFIG_ADPCM_EA_R1_DECODER 0
-#define CONFIG_ADPCM_EA_R2_DECODER 0
-#define CONFIG_ADPCM_EA_R3_DECODER 0
-#define CONFIG_ADPCM_EA_XAS_DECODER 0
-#define CONFIG_ADPCM_G722_DECODER 0
-#define CONFIG_ADPCM_G726_DECODER 0
-#define CONFIG_ADPCM_G726LE_DECODER 0
-#define CONFIG_ADPCM_IMA_AMV_DECODER 0
-#define CONFIG_ADPCM_IMA_APC_DECODER 0
-#define CONFIG_ADPCM_IMA_DAT4_DECODER 0
-#define CONFIG_ADPCM_IMA_DK3_DECODER 0
-#define CONFIG_ADPCM_IMA_DK4_DECODER 0
-#define CONFIG_ADPCM_IMA_EA_EACS_DECODER 0
-#define CONFIG_ADPCM_IMA_EA_SEAD_DECODER 0
-#define CONFIG_ADPCM_IMA_ISS_DECODER 0
-#define CONFIG_ADPCM_IMA_OKI_DECODER 0
-#define CONFIG_ADPCM_IMA_QT_DECODER 0
-#define CONFIG_ADPCM_IMA_RAD_DECODER 0
-#define CONFIG_ADPCM_IMA_SMJPEG_DECODER 0
-#define CONFIG_ADPCM_IMA_WAV_DECODER 0
-#define CONFIG_ADPCM_IMA_WS_DECODER 0
-#define CONFIG_ADPCM_MS_DECODER 0
-#define CONFIG_ADPCM_MTAF_DECODER 0
-#define CONFIG_ADPCM_PSX_DECODER 0
-#define CONFIG_ADPCM_SBPRO_2_DECODER 0
-#define CONFIG_ADPCM_SBPRO_3_DECODER 0
-#define CONFIG_ADPCM_SBPRO_4_DECODER 0
-#define CONFIG_ADPCM_SWF_DECODER 0
-#define CONFIG_ADPCM_THP_DECODER 0
-#define CONFIG_ADPCM_THP_LE_DECODER 0
-#define CONFIG_ADPCM_VIMA_DECODER 0
-#define CONFIG_ADPCM_XA_DECODER 0
-#define CONFIG_ADPCM_YAMAHA_DECODER 0
-#define CONFIG_SSA_DECODER 0
-#define CONFIG_ASS_DECODER 0
-#define CONFIG_CCAPTION_DECODER 0
-#define CONFIG_DVBSUB_DECODER 0
-#define CONFIG_DVDSUB_DECODER 0
-#define CONFIG_JACOSUB_DECODER 0
-#define CONFIG_MICRODVD_DECODER 0
-#define CONFIG_MOVTEXT_DECODER 0
-#define CONFIG_MPL2_DECODER 0
-#define CONFIG_PGSSUB_DECODER 0
-#define CONFIG_PJS_DECODER 0
-#define CONFIG_REALTEXT_DECODER 0
-#define CONFIG_SAMI_DECODER 0
-#define CONFIG_SRT_DECODER 0
-#define CONFIG_STL_DECODER 0
-#define CONFIG_SUBRIP_DECODER 0
-#define CONFIG_SUBVIEWER_DECODER 0
-#define CONFIG_SUBVIEWER1_DECODER 0
-#define CONFIG_TEXT_DECODER 0
-#define CONFIG_VPLAYER_DECODER 0
-#define CONFIG_WEBVTT_DECODER 0
-#define CONFIG_XSUB_DECODER 0
-#define CONFIG_AAC_AT_DECODER 0
-#define CONFIG_AC3_AT_DECODER 0
-#define CONFIG_ADPCM_IMA_QT_AT_DECODER 0
-#define CONFIG_ALAC_AT_DECODER 0
-#define CONFIG_AMR_NB_AT_DECODER 0
-#define CONFIG_EAC3_AT_DECODER 0
-#define CONFIG_GSM_MS_AT_DECODER 0
-#define CONFIG_ILBC_AT_DECODER 0
-#define CONFIG_MP1_AT_DECODER 0
-#define CONFIG_MP2_AT_DECODER 0
-#define CONFIG_MP3_AT_DECODER 0
-#define CONFIG_PCM_ALAW_AT_DECODER 0
-#define CONFIG_PCM_MULAW_AT_DECODER 0
-#define CONFIG_QDMC_AT_DECODER 0
-#define CONFIG_QDM2_AT_DECODER 0
-#define CONFIG_LIBCELT_DECODER 0
-#define CONFIG_LIBFDK_AAC_DECODER 0
-#define CONFIG_LIBGSM_DECODER 0
-#define CONFIG_LIBGSM_MS_DECODER 0
-#define CONFIG_LIBILBC_DECODER 0
-#define CONFIG_LIBOPENCORE_AMRNB_DECODER 0
-#define CONFIG_LIBOPENCORE_AMRWB_DECODER 0
-#define CONFIG_LIBOPENJPEG_DECODER 0
-#define CONFIG_LIBOPUS_DECODER 0
-#define CONFIG_LIBSCHROEDINGER_DECODER 0
-#define CONFIG_LIBSPEEX_DECODER 0
-#define CONFIG_LIBVORBIS_DECODER 0
-#define CONFIG_LIBVPX_VP8_DECODER 0
-#define CONFIG_LIBVPX_VP9_DECODER 0
-#define CONFIG_LIBZVBI_TELETEXT_DECODER 0
-#define CONFIG_BINTEXT_DECODER 0
-#define CONFIG_XBIN_DECODER 0
-#define CONFIG_IDF_DECODER 0
-#define CONFIG_LIBOPENH264_DECODER 0
-#define CONFIG_H263_CUVID_DECODER 0
-#define CONFIG_H264_CUVID_DECODER 0
-#define CONFIG_HEVC_CUVID_DECODER 0
-#define CONFIG_HEVC_MEDIACODEC_DECODER 0
-#define CONFIG_MJPEG_CUVID_DECODER 0
-#define CONFIG_MPEG1_CUVID_DECODER 0
-#define CONFIG_MPEG2_CUVID_DECODER 0
-#define CONFIG_MPEG4_CUVID_DECODER 0
-#define CONFIG_MPEG4_MEDIACODEC_DECODER 0
-#define CONFIG_VC1_CUVID_DECODER 0
-#define CONFIG_VP8_CUVID_DECODER 0
-#define CONFIG_VP8_MEDIACODEC_DECODER 0
-#define CONFIG_VP9_CUVID_DECODER 0
-#define CONFIG_VP9_MEDIACODEC_DECODER 0
-#define CONFIG_AA_DEMUXER 0
-#define CONFIG_AAC_DEMUXER 0
-#define CONFIG_AC3_DEMUXER 0
-#define CONFIG_ACM_DEMUXER 0
-#define CONFIG_ACT_DEMUXER 0
-#define CONFIG_ADF_DEMUXER 0
-#define CONFIG_ADP_DEMUXER 0
-#define CONFIG_ADS_DEMUXER 0
-#define CONFIG_ADX_DEMUXER 0
-#define CONFIG_AEA_DEMUXER 0
-#define CONFIG_AFC_DEMUXER 0
-#define CONFIG_AIFF_DEMUXER 0
-#define CONFIG_AIX_DEMUXER 0
-#define CONFIG_AMR_DEMUXER 0
-#define CONFIG_ANM_DEMUXER 0
-#define CONFIG_APC_DEMUXER 0
-#define CONFIG_APE_DEMUXER 0
-#define CONFIG_APNG_DEMUXER 0
-#define CONFIG_AQTITLE_DEMUXER 0
-#define CONFIG_ASF_DEMUXER 0
-#define CONFIG_ASF_O_DEMUXER 0
-#define CONFIG_ASS_DEMUXER 0
-#define CONFIG_AST_DEMUXER 0
-#define CONFIG_AU_DEMUXER 0
-#define CONFIG_AVI_DEMUXER 0
-#define CONFIG_AVISYNTH_DEMUXER 0
-#define CONFIG_AVR_DEMUXER 0
-#define CONFIG_AVS_DEMUXER 0
-#define CONFIG_BETHSOFTVID_DEMUXER 0
-#define CONFIG_BFI_DEMUXER 0
-#define CONFIG_BINTEXT_DEMUXER 0
-#define CONFIG_BINK_DEMUXER 0
-#define CONFIG_BIT_DEMUXER 0
-#define CONFIG_BMV_DEMUXER 0
-#define CONFIG_BFSTM_DEMUXER 0
-#define CONFIG_BRSTM_DEMUXER 0
-#define CONFIG_BOA_DEMUXER 0
-#define CONFIG_C93_DEMUXER 0
-#define CONFIG_CAF_DEMUXER 0
-#define CONFIG_CAVSVIDEO_DEMUXER 0
-#define CONFIG_CDG_DEMUXER 0
-#define CONFIG_CDXL_DEMUXER 0
-#define CONFIG_CINE_DEMUXER 0
-#define CONFIG_CONCAT_DEMUXER 0
-#define CONFIG_DATA_DEMUXER 0
-#define CONFIG_DAUD_DEMUXER 0
-#define CONFIG_DCSTR_DEMUXER 0
-#define CONFIG_DFA_DEMUXER 0
-#define CONFIG_DIRAC_DEMUXER 0
-#define CONFIG_DNXHD_DEMUXER 0
-#define CONFIG_DSF_DEMUXER 0
-#define CONFIG_DSICIN_DEMUXER 0
-#define CONFIG_DSS_DEMUXER 0
-#define CONFIG_DTS_DEMUXER 0
-#define CONFIG_DTSHD_DEMUXER 0
-#define CONFIG_DV_DEMUXER 0
-#define CONFIG_DVBSUB_DEMUXER 0
-#define CONFIG_DVBTXT_DEMUXER 0
-#define CONFIG_DXA_DEMUXER 0
-#define CONFIG_EA_DEMUXER 0
-#define CONFIG_EA_CDATA_DEMUXER 0
-#define CONFIG_EAC3_DEMUXER 0
-#define CONFIG_EPAF_DEMUXER 0
-#define CONFIG_FFM_DEMUXER 0
-#define CONFIG_FFMETADATA_DEMUXER 0
-#define CONFIG_FILMSTRIP_DEMUXER 0
-#define CONFIG_FLAC_DEMUXER 0
-#define CONFIG_FLIC_DEMUXER 0
-#define CONFIG_FLV_DEMUXER 0
-#define CONFIG_LIVE_FLV_DEMUXER 0
-#define CONFIG_FOURXM_DEMUXER 0
-#define CONFIG_FRM_DEMUXER 0
-#define CONFIG_FSB_DEMUXER 0
-#define CONFIG_G722_DEMUXER 0
-#define CONFIG_G723_1_DEMUXER 0
-#define CONFIG_G729_DEMUXER 0
-#define CONFIG_GENH_DEMUXER 0
-#define CONFIG_GIF_DEMUXER 0
-#define CONFIG_GSM_DEMUXER 0
-#define CONFIG_GXF_DEMUXER 0
-#define CONFIG_H261_DEMUXER 0
-#define CONFIG_H263_DEMUXER 0
-#define CONFIG_H264_DEMUXER 0
-#define CONFIG_HEVC_DEMUXER 0
-#define CONFIG_HLS_DEMUXER 0
-#define CONFIG_HNM_DEMUXER 0
-#define CONFIG_ICO_DEMUXER 0
-#define CONFIG_IDCIN_DEMUXER 0
-#define CONFIG_IDF_DEMUXER 0
-#define CONFIG_IFF_DEMUXER 0
-#define CONFIG_ILBC_DEMUXER 0
-#define CONFIG_IMAGE2_DEMUXER 0
-#define CONFIG_IMAGE2PIPE_DEMUXER 0
-#define CONFIG_IMAGE2_ALIAS_PIX_DEMUXER 0
-#define CONFIG_IMAGE2_BRENDER_PIX_DEMUXER 0
-#define CONFIG_INGENIENT_DEMUXER 0
-#define CONFIG_IPMOVIE_DEMUXER 0
-#define CONFIG_IRCAM_DEMUXER 0
-#define CONFIG_ISS_DEMUXER 0
-#define CONFIG_IV8_DEMUXER 0
-#define CONFIG_IVF_DEMUXER 0
-#define CONFIG_IVR_DEMUXER 0
-#define CONFIG_JACOSUB_DEMUXER 0
-#define CONFIG_JV_DEMUXER 0
-#define CONFIG_LMLM4_DEMUXER 0
-#define CONFIG_LOAS_DEMUXER 0
-#define CONFIG_LRC_DEMUXER 0
-#define CONFIG_LVF_DEMUXER 0
-#define CONFIG_LXF_DEMUXER 0
-#define CONFIG_M4V_DEMUXER 0
-#define CONFIG_MATROSKA_DEMUXER 0
-#define CONFIG_MGSTS_DEMUXER 0
-#define CONFIG_MICRODVD_DEMUXER 0
-#define CONFIG_MJPEG_DEMUXER 0
-#define CONFIG_MLP_DEMUXER 0
-#define CONFIG_MLV_DEMUXER 0
-#define CONFIG_MM_DEMUXER 0
-#define CONFIG_MMF_DEMUXER 0
-#define CONFIG_MOV_DEMUXER 0
-#define CONFIG_MP3_DEMUXER 0
-#define CONFIG_MPC_DEMUXER 0
-#define CONFIG_MPC8_DEMUXER 0
-#define CONFIG_MPEGPS_DEMUXER 0
-#define CONFIG_MPEGTS_DEMUXER 0
-#define CONFIG_MPEGTSRAW_DEMUXER 0
-#define CONFIG_MPEGVIDEO_DEMUXER 0
-#define CONFIG_MPJPEG_DEMUXER 0
-#define CONFIG_MPL2_DEMUXER 0
-#define CONFIG_MPSUB_DEMUXER 0
-#define CONFIG_MSF_DEMUXER 0
-#define CONFIG_MSNWC_TCP_DEMUXER 0
-#define CONFIG_MTAF_DEMUXER 0
-#define CONFIG_MTV_DEMUXER 0
-#define CONFIG_MUSX_DEMUXER 0
-#define CONFIG_MV_DEMUXER 0
-#define CONFIG_MVI_DEMUXER 0
-#define CONFIG_MXF_DEMUXER 0
-#define CONFIG_MXG_DEMUXER 0
-#define CONFIG_NC_DEMUXER 0
-#define CONFIG_NISTSPHERE_DEMUXER 0
-#define CONFIG_NSV_DEMUXER 0
-#define CONFIG_NUT_DEMUXER 0
-#define CONFIG_NUV_DEMUXER 0
-#define CONFIG_OGG_DEMUXER 0
-#define CONFIG_OMA_DEMUXER 0
-#define CONFIG_PAF_DEMUXER 0
-#define CONFIG_PCM_ALAW_DEMUXER 0
-#define CONFIG_PCM_MULAW_DEMUXER 0
-#define CONFIG_PCM_F64BE_DEMUXER 0
-#define CONFIG_PCM_F64LE_DEMUXER 0
-#define CONFIG_PCM_F32BE_DEMUXER 0
-#define CONFIG_PCM_F32LE_DEMUXER 0
-#define CONFIG_PCM_S32BE_DEMUXER 0
-#define CONFIG_PCM_S32LE_DEMUXER 0
-#define CONFIG_PCM_S24BE_DEMUXER 0
-#define CONFIG_PCM_S24LE_DEMUXER 0
-#define CONFIG_PCM_S16BE_DEMUXER 0
-#define CONFIG_PCM_S16LE_DEMUXER 0
-#define CONFIG_PCM_S8_DEMUXER 0
-#define CONFIG_PCM_U32BE_DEMUXER 0
-#define CONFIG_PCM_U32LE_DEMUXER 0
-#define CONFIG_PCM_U24BE_DEMUXER 0
-#define CONFIG_PCM_U24LE_DEMUXER 0
-#define CONFIG_PCM_U16BE_DEMUXER 0
-#define CONFIG_PCM_U16LE_DEMUXER 0
-#define CONFIG_PCM_U8_DEMUXER 0
-#define CONFIG_PJS_DEMUXER 0
-#define CONFIG_PMP_DEMUXER 0
-#define CONFIG_PVA_DEMUXER 0
-#define CONFIG_PVF_DEMUXER 0
-#define CONFIG_QCP_DEMUXER 0
-#define CONFIG_R3D_DEMUXER 0
-#define CONFIG_RAWVIDEO_DEMUXER 0
-#define CONFIG_REALTEXT_DEMUXER 0
-#define CONFIG_REDSPARK_DEMUXER 0
-#define CONFIG_RL2_DEMUXER 0
-#define CONFIG_RM_DEMUXER 0
-#define CONFIG_ROQ_DEMUXER 0
-#define CONFIG_RPL_DEMUXER 0
-#define CONFIG_RSD_DEMUXER 0
-#define CONFIG_RSO_DEMUXER 0
-#define CONFIG_RTP_DEMUXER 0
-#define CONFIG_RTSP_DEMUXER 0
-#define CONFIG_SAMI_DEMUXER 0
-#define CONFIG_SAP_DEMUXER 0
-#define CONFIG_SBG_DEMUXER 0
-#define CONFIG_SDP_DEMUXER 0
-#define CONFIG_SDR2_DEMUXER 0
-#define CONFIG_SEGAFILM_DEMUXER 0
-#define CONFIG_SHORTEN_DEMUXER 0
-#define CONFIG_SIFF_DEMUXER 0
-#define CONFIG_SLN_DEMUXER 0
-#define CONFIG_SMACKER_DEMUXER 0
-#define CONFIG_SMJPEG_DEMUXER 0
-#define CONFIG_SMUSH_DEMUXER 0
-#define CONFIG_SOL_DEMUXER 0
-#define CONFIG_SOX_DEMUXER 0
-#define CONFIG_SPDIF_DEMUXER 0
-#define CONFIG_SRT_DEMUXER 0
-#define CONFIG_STR_DEMUXER 0
-#define CONFIG_STL_DEMUXER 0
-#define CONFIG_SUBVIEWER1_DEMUXER 0
-#define CONFIG_SUBVIEWER_DEMUXER 0
-#define CONFIG_SUP_DEMUXER 0
-#define CONFIG_SVAG_DEMUXER 0
-#define CONFIG_SWF_DEMUXER 0
-#define CONFIG_TAK_DEMUXER 0
-#define CONFIG_TEDCAPTIONS_DEMUXER 0
-#define CONFIG_THP_DEMUXER 0
-#define CONFIG_THREEDOSTR_DEMUXER 0
-#define CONFIG_TIERTEXSEQ_DEMUXER 0
-#define CONFIG_TMV_DEMUXER 0
-#define CONFIG_TRUEHD_DEMUXER 0
-#define CONFIG_TTA_DEMUXER 0
-#define CONFIG_TXD_DEMUXER 0
-#define CONFIG_TTY_DEMUXER 0
-#define CONFIG_V210_DEMUXER 0
-#define CONFIG_V210X_DEMUXER 0
-#define CONFIG_VAG_DEMUXER 0
-#define CONFIG_VC1_DEMUXER 0
-#define CONFIG_VC1T_DEMUXER 0
-#define CONFIG_VIVO_DEMUXER 0
-#define CONFIG_VMD_DEMUXER 0
-#define CONFIG_VOBSUB_DEMUXER 0
-#define CONFIG_VOC_DEMUXER 0
-#define CONFIG_VPK_DEMUXER 0
-#define CONFIG_VPLAYER_DEMUXER 0
-#define CONFIG_VQF_DEMUXER 0
-#define CONFIG_W64_DEMUXER 0
-#define CONFIG_WAV_DEMUXER 0
-#define CONFIG_WC3_DEMUXER 0
-#define CONFIG_WEBM_DASH_MANIFEST_DEMUXER 0
-#define CONFIG_WEBVTT_DEMUXER 0
-#define CONFIG_WSAUD_DEMUXER 0
-#define CONFIG_WSD_DEMUXER 0
-#define CONFIG_WSVQA_DEMUXER 0
-#define CONFIG_WTV_DEMUXER 0
-#define CONFIG_WVE_DEMUXER 0
-#define CONFIG_WV_DEMUXER 0
-#define CONFIG_XA_DEMUXER 0
-#define CONFIG_XBIN_DEMUXER 0
-#define CONFIG_XMV_DEMUXER 0
-#define CONFIG_XVAG_DEMUXER 0
-#define CONFIG_XWMA_DEMUXER 0
-#define CONFIG_YOP_DEMUXER 0
-#define CONFIG_YUV4MPEGPIPE_DEMUXER 0
-#define CONFIG_IMAGE_BMP_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_DDS_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_DPX_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_EXR_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_J2K_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_JPEG_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_JPEGLS_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PAM_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PBM_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PCX_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PGMYUV_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PGM_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PICTOR_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PNG_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_PPM_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_QDRAW_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_SGI_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_SUNRAST_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_TIFF_PIPE_DEMUXER 0
-#define CONFIG_IMAGE_WEBP_PIPE_DEMUXER 0
-#define CONFIG_LIBGME_DEMUXER 0
-#define CONFIG_LIBMODPLUG_DEMUXER 0
-#define CONFIG_LIBNUT_DEMUXER 0
-#define CONFIG_LIBOPENMPT_DEMUXER 0
-#define CONFIG_A64MULTI_ENCODER 0
-#define CONFIG_A64MULTI5_ENCODER 0
-#define CONFIG_ALIAS_PIX_ENCODER 0
-#define CONFIG_AMV_ENCODER 0
-#define CONFIG_APNG_ENCODER 0
-#define CONFIG_ASV1_ENCODER 0
-#define CONFIG_ASV2_ENCODER 0
-#define CONFIG_AVRP_ENCODER 0
-#define CONFIG_AVUI_ENCODER 0
-#define CONFIG_AYUV_ENCODER 0
-#define CONFIG_BMP_ENCODER 0
-#define CONFIG_CINEPAK_ENCODER 0
-#define CONFIG_CLJR_ENCODER 0
-#define CONFIG_COMFORTNOISE_ENCODER 0
-#define CONFIG_DNXHD_ENCODER 0
-#define CONFIG_DPX_ENCODER 0
-#define CONFIG_DVVIDEO_ENCODER 0
-#define CONFIG_FFV1_ENCODER 0
-#define CONFIG_FFVHUFF_ENCODER 0
-#define CONFIG_FLASHSV_ENCODER 0
-#define CONFIG_FLASHSV2_ENCODER 0
-#define CONFIG_FLV_ENCODER 0
-#define CONFIG_GIF_ENCODER 0
-#define CONFIG_H261_ENCODER 0
-#define CONFIG_H263_ENCODER 0
-#define CONFIG_H263P_ENCODER 0
-#define CONFIG_HAP_ENCODER 0
-#define CONFIG_HUFFYUV_ENCODER 0
-#define CONFIG_JPEG2000_ENCODER 0
-#define CONFIG_JPEGLS_ENCODER 0
-#define CONFIG_LJPEG_ENCODER 0
-#define CONFIG_MJPEG_ENCODER 0
-#define CONFIG_MPEG1VIDEO_ENCODER 0
-#define CONFIG_MPEG2VIDEO_ENCODER 0
-#define CONFIG_MPEG4_ENCODER 0
-#define CONFIG_MSMPEG4V2_ENCODER 0
-#define CONFIG_MSMPEG4V3_ENCODER 0
-#define CONFIG_MSVIDEO1_ENCODER 0
-#define CONFIG_PAM_ENCODER 0
-#define CONFIG_PBM_ENCODER 0
-#define CONFIG_PCX_ENCODER 0
-#define CONFIG_PGM_ENCODER 0
-#define CONFIG_PGMYUV_ENCODER 0
-#define CONFIG_PNG_ENCODER 0
-#define CONFIG_PPM_ENCODER 0
-#define CONFIG_PRORES_ENCODER 0
-#define CONFIG_PRORES_AW_ENCODER 0
-#define CONFIG_PRORES_KS_ENCODER 0
-#define CONFIG_QTRLE_ENCODER 0
-#define CONFIG_R10K_ENCODER 0
-#define CONFIG_R210_ENCODER 0
-#define CONFIG_RAWVIDEO_ENCODER 0
-#define CONFIG_ROQ_ENCODER 0
-#define CONFIG_RV10_ENCODER 0
-#define CONFIG_RV20_ENCODER 0
-#define CONFIG_S302M_ENCODER 0
-#define CONFIG_SGI_ENCODER 0
-#define CONFIG_SNOW_ENCODER 0
-#define CONFIG_SUNRAST_ENCODER 0
-#define CONFIG_SVQ1_ENCODER 0
-#define CONFIG_TARGA_ENCODER 0
-#define CONFIG_TIFF_ENCODER 0
-#define CONFIG_UTVIDEO_ENCODER 0
-#define CONFIG_V210_ENCODER 0
-#define CONFIG_V308_ENCODER 0
-#define CONFIG_V408_ENCODER 0
-#define CONFIG_V410_ENCODER 0
-#define CONFIG_VC2_ENCODER 0
-#define CONFIG_WRAPPED_AVFRAME_ENCODER 0
-#define CONFIG_WMV1_ENCODER 0
-#define CONFIG_WMV2_ENCODER 0
-#define CONFIG_XBM_ENCODER 0
-#define CONFIG_XFACE_ENCODER 0
-#define CONFIG_XWD_ENCODER 0
-#define CONFIG_Y41P_ENCODER 0
-#define CONFIG_YUV4_ENCODER 0
-#define CONFIG_ZLIB_ENCODER 0
-#define CONFIG_ZMBV_ENCODER 0
-#define CONFIG_AAC_ENCODER 0
-#define CONFIG_AC3_ENCODER 0
-#define CONFIG_AC3_FIXED_ENCODER 0
-#define CONFIG_ALAC_ENCODER 0
-#define CONFIG_DCA_ENCODER 0
-#define CONFIG_EAC3_ENCODER 0
-#define CONFIG_FLAC_ENCODER 0
-#define CONFIG_G723_1_ENCODER 0
-#define CONFIG_MLP_ENCODER 0
-#define CONFIG_MP2_ENCODER 0
-#define CONFIG_MP2FIXED_ENCODER 0
-#define CONFIG_NELLYMOSER_ENCODER 0
-#define CONFIG_RA_144_ENCODER 0
-#define CONFIG_SONIC_ENCODER 0
-#define CONFIG_SONIC_LS_ENCODER 0
-#define CONFIG_TRUEHD_ENCODER 0
-#define CONFIG_TTA_ENCODER 0
-#define CONFIG_VORBIS_ENCODER 0
-#define CONFIG_WAVPACK_ENCODER 0
-#define CONFIG_WMAV1_ENCODER 0
-#define CONFIG_WMAV2_ENCODER 0
-#define CONFIG_PCM_ALAW_ENCODER 0
-#define CONFIG_PCM_F32BE_ENCODER 0
-#define CONFIG_PCM_F32LE_ENCODER 0
-#define CONFIG_PCM_F64BE_ENCODER 0
-#define CONFIG_PCM_F64LE_ENCODER 0
-#define CONFIG_PCM_MULAW_ENCODER 0
-#define CONFIG_PCM_S8_ENCODER 0
-#define CONFIG_PCM_S8_PLANAR_ENCODER 0
-#define CONFIG_PCM_S16BE_ENCODER 0
-#define CONFIG_PCM_S16BE_PLANAR_ENCODER 0
-#define CONFIG_PCM_S16LE_ENCODER 0
-#define CONFIG_PCM_S16LE_PLANAR_ENCODER 0
-#define CONFIG_PCM_S24BE_ENCODER 0
-#define CONFIG_PCM_S24DAUD_ENCODER 0
-#define CONFIG_PCM_S24LE_ENCODER 0
-#define CONFIG_PCM_S24LE_PLANAR_ENCODER 0
-#define CONFIG_PCM_S32BE_ENCODER 0
-#define CONFIG_PCM_S32LE_ENCODER 0
-#define CONFIG_PCM_S32LE_PLANAR_ENCODER 0
-#define CONFIG_PCM_S64BE_ENCODER 0
-#define CONFIG_PCM_S64LE_ENCODER 0
-#define CONFIG_PCM_U8_ENCODER 0
-#define CONFIG_PCM_U16BE_ENCODER 0
-#define CONFIG_PCM_U16LE_ENCODER 0
-#define CONFIG_PCM_U24BE_ENCODER 0
-#define CONFIG_PCM_U24LE_ENCODER 0
-#define CONFIG_PCM_U32BE_ENCODER 0
-#define CONFIG_PCM_U32LE_ENCODER 0
-#define CONFIG_ROQ_DPCM_ENCODER 0
-#define CONFIG_ADPCM_ADX_ENCODER 0
-#define CONFIG_ADPCM_G722_ENCODER 0
-#define CONFIG_ADPCM_G726_ENCODER 0
-#define CONFIG_ADPCM_IMA_QT_ENCODER 0
-#define CONFIG_ADPCM_IMA_WAV_ENCODER 0
-#define CONFIG_ADPCM_MS_ENCODER 0
-#define CONFIG_ADPCM_SWF_ENCODER 0
-#define CONFIG_ADPCM_YAMAHA_ENCODER 0
-#define CONFIG_SSA_ENCODER 0
-#define CONFIG_ASS_ENCODER 0
-#define CONFIG_DVBSUB_ENCODER 0
-#define CONFIG_DVDSUB_ENCODER 0
-#define CONFIG_MOVTEXT_ENCODER 0
-#define CONFIG_SRT_ENCODER 0
-#define CONFIG_SUBRIP_ENCODER 0
-#define CONFIG_TEXT_ENCODER 0
-#define CONFIG_WEBVTT_ENCODER 0
-#define CONFIG_XSUB_ENCODER 0
-#define CONFIG_AAC_AT_ENCODER 0
-#define CONFIG_ALAC_AT_ENCODER 0
-#define CONFIG_ILBC_AT_ENCODER 0
-#define CONFIG_PCM_ALAW_AT_ENCODER 0
-#define CONFIG_PCM_MULAW_AT_ENCODER 0
-#define CONFIG_LIBFDK_AAC_ENCODER 0
-#define CONFIG_LIBGSM_ENCODER 0
-#define CONFIG_LIBGSM_MS_ENCODER 0
-#define CONFIG_LIBILBC_ENCODER 0
-#define CONFIG_LIBMP3LAME_ENCODER 0
-#define CONFIG_LIBOPENCORE_AMRNB_ENCODER 0
-#define CONFIG_LIBOPENJPEG_ENCODER 0
-#define CONFIG_LIBOPUS_ENCODER 0
-#define CONFIG_LIBSCHROEDINGER_ENCODER 0
-#define CONFIG_LIBSHINE_ENCODER 0
-#define CONFIG_LIBSPEEX_ENCODER 0
-#define CONFIG_LIBTHEORA_ENCODER 0
-#define CONFIG_LIBTWOLAME_ENCODER 0
-#define CONFIG_LIBVO_AMRWBENC_ENCODER 0
-#define CONFIG_LIBVORBIS_ENCODER 0
-#define CONFIG_LIBVPX_VP8_ENCODER 0
-#define CONFIG_LIBVPX_VP9_ENCODER 0
-#define CONFIG_LIBWAVPACK_ENCODER 0
-#define CONFIG_LIBWEBP_ANIM_ENCODER 0
-#define CONFIG_LIBWEBP_ENCODER 0
-#define CONFIG_LIBX262_ENCODER 0
-#define CONFIG_LIBX264_ENCODER 0
-#define CONFIG_LIBX264RGB_ENCODER 0
-#define CONFIG_LIBX265_ENCODER 0
-#define CONFIG_LIBXAVS_ENCODER 0
-#define CONFIG_LIBXVID_ENCODER 0
-#define CONFIG_LIBOPENH264_ENCODER 0
-#define CONFIG_H264_NVENC_ENCODER 0
-#define CONFIG_H264_OMX_ENCODER 0
-#define CONFIG_H264_QSV_ENCODER 0
-#define CONFIG_H264_VAAPI_ENCODER 0
-#define CONFIG_H264_VIDEOTOOLBOX_ENCODER 0
-#define CONFIG_NVENC_ENCODER 0
-#define CONFIG_NVENC_H264_ENCODER 0
-#define CONFIG_NVENC_HEVC_ENCODER 0
-#define CONFIG_HEVC_NVENC_ENCODER 0
-#define CONFIG_HEVC_QSV_ENCODER 0
-#define CONFIG_HEVC_VAAPI_ENCODER 0
-#define CONFIG_LIBKVAZAAR_ENCODER 0
-#define CONFIG_MJPEG_VAAPI_ENCODER 0
-#define CONFIG_MPEG2_QSV_ENCODER 0
-#define CONFIG_ABENCH_FILTER 0
-#define CONFIG_ACOMPRESSOR_FILTER 0
-#define CONFIG_ACROSSFADE_FILTER 0
-#define CONFIG_ACRUSHER_FILTER 0
-#define CONFIG_ADELAY_FILTER 0
-#define CONFIG_AECHO_FILTER 0
-#define CONFIG_AEMPHASIS_FILTER 0
-#define CONFIG_AEVAL_FILTER 0
-#define CONFIG_AFADE_FILTER 0
-#define CONFIG_AFFTFILT_FILTER 0
-#define CONFIG_AFORMAT_FILTER 0
-#define CONFIG_AGATE_FILTER 0
-#define CONFIG_AINTERLEAVE_FILTER 0
-#define CONFIG_ALIMITER_FILTER 0
-#define CONFIG_ALLPASS_FILTER 0
-#define CONFIG_ALOOP_FILTER 0
-#define CONFIG_AMERGE_FILTER 0
-#define CONFIG_AMETADATA_FILTER 0
-#define CONFIG_AMIX_FILTER 0
-#define CONFIG_ANEQUALIZER_FILTER 0
-#define CONFIG_ANULL_FILTER 0
-#define CONFIG_APAD_FILTER 0
-#define CONFIG_APERMS_FILTER 0
-#define CONFIG_APHASER_FILTER 0
-#define CONFIG_APULSATOR_FILTER 0
-#define CONFIG_AREALTIME_FILTER 0
-#define CONFIG_ARESAMPLE_FILTER 0
-#define CONFIG_AREVERSE_FILTER 0
-#define CONFIG_ASELECT_FILTER 0
-#define CONFIG_ASENDCMD_FILTER 0
-#define CONFIG_ASETNSAMPLES_FILTER 0
-#define CONFIG_ASETPTS_FILTER 0
-#define CONFIG_ASETRATE_FILTER 0
-#define CONFIG_ASETTB_FILTER 0
-#define CONFIG_ASHOWINFO_FILTER 0
-#define CONFIG_ASIDEDATA_FILTER 0
-#define CONFIG_ASPLIT_FILTER 0
-#define CONFIG_ASTATS_FILTER 0
-#define CONFIG_ASTREAMSELECT_FILTER 0
-#define CONFIG_ASYNCTS_FILTER 0
-#define CONFIG_ATEMPO_FILTER 0
-#define CONFIG_ATRIM_FILTER 0
-#define CONFIG_AZMQ_FILTER 0
-#define CONFIG_BANDPASS_FILTER 0
-#define CONFIG_BANDREJECT_FILTER 0
-#define CONFIG_BASS_FILTER 0
-#define CONFIG_BIQUAD_FILTER 0
-#define CONFIG_BS2B_FILTER 0
-#define CONFIG_CHANNELMAP_FILTER 0
-#define CONFIG_CHANNELSPLIT_FILTER 0
-#define CONFIG_CHORUS_FILTER 0
-#define CONFIG_COMPAND_FILTER 0
-#define CONFIG_COMPENSATIONDELAY_FILTER 0
-#define CONFIG_CRYSTALIZER_FILTER 0
-#define CONFIG_DCSHIFT_FILTER 0
-#define CONFIG_DYNAUDNORM_FILTER 0
-#define CONFIG_EARWAX_FILTER 0
-#define CONFIG_EBUR128_FILTER 0
-#define CONFIG_EQUALIZER_FILTER 0
-#define CONFIG_EXTRASTEREO_FILTER 0
-#define CONFIG_FIREQUALIZER_FILTER 0
-#define CONFIG_FLANGER_FILTER 0
-#define CONFIG_HDCD_FILTER 0
-#define CONFIG_HIGHPASS_FILTER 0
-#define CONFIG_JOIN_FILTER 0
-#define CONFIG_LADSPA_FILTER 0
-#define CONFIG_LOUDNORM_FILTER 0
-#define CONFIG_LOWPASS_FILTER 0
-#define CONFIG_PAN_FILTER 0
-#define CONFIG_REPLAYGAIN_FILTER 0
-#define CONFIG_RESAMPLE_FILTER 0
-#define CONFIG_RUBBERBAND_FILTER 0
-#define CONFIG_SIDECHAINCOMPRESS_FILTER 0
-#define CONFIG_SIDECHAINGATE_FILTER 0
-#define CONFIG_SILENCEDETECT_FILTER 0
-#define CONFIG_SILENCEREMOVE_FILTER 0
-#define CONFIG_SOFALIZER_FILTER 0
-#define CONFIG_STEREOTOOLS_FILTER 0
-#define CONFIG_STEREOWIDEN_FILTER 0
-#define CONFIG_TREBLE_FILTER 0
-#define CONFIG_TREMOLO_FILTER 0
-#define CONFIG_VIBRATO_FILTER 0
-#define CONFIG_VOLUME_FILTER 0
-#define CONFIG_VOLUMEDETECT_FILTER 0
-#define CONFIG_AEVALSRC_FILTER 0
-#define CONFIG_ANOISESRC_FILTER 0
-#define CONFIG_ANULLSRC_FILTER 0
-#define CONFIG_FLITE_FILTER 0
-#define CONFIG_SINE_FILTER 0
-#define CONFIG_ANULLSINK_FILTER 0
-#define CONFIG_ALPHAEXTRACT_FILTER 0
-#define CONFIG_ALPHAMERGE_FILTER 0
-#define CONFIG_ASS_FILTER 0
-#define CONFIG_ATADENOISE_FILTER 0
-#define CONFIG_AVGBLUR_FILTER 0
-#define CONFIG_BBOX_FILTER 0
-#define CONFIG_BENCH_FILTER 0
-#define CONFIG_BITPLANENOISE_FILTER 0
-#define CONFIG_BLACKDETECT_FILTER 0
-#define CONFIG_BLACKFRAME_FILTER 0
-#define CONFIG_BLEND_FILTER 0
-#define CONFIG_BOXBLUR_FILTER 0
-#define CONFIG_BWDIF_FILTER 0
-#define CONFIG_CHROMAKEY_FILTER 0
-#define CONFIG_CIESCOPE_FILTER 0
-#define CONFIG_CODECVIEW_FILTER 0
-#define CONFIG_COLORBALANCE_FILTER 0
-#define CONFIG_COLORCHANNELMIXER_FILTER 0
-#define CONFIG_COLORKEY_FILTER 0
-#define CONFIG_COLORLEVELS_FILTER 0
-#define CONFIG_COLORMATRIX_FILTER 0
-#define CONFIG_COLORSPACE_FILTER 0
-#define CONFIG_CONVOLUTION_FILTER 0
-#define CONFIG_COPY_FILTER 0
-#define CONFIG_COREIMAGE_FILTER 0
-#define CONFIG_COVER_RECT_FILTER 0
-#define CONFIG_CROP_FILTER 0
-#define CONFIG_CROPDETECT_FILTER 0
-#define CONFIG_CURVES_FILTER 0
-#define CONFIG_DATASCOPE_FILTER 0
-#define CONFIG_DCTDNOIZ_FILTER 0
-#define CONFIG_DEBAND_FILTER 0
-#define CONFIG_DECIMATE_FILTER 0
-#define CONFIG_DEFLATE_FILTER 0
-#define CONFIG_DEJUDDER_FILTER 0
-#define CONFIG_DELOGO_FILTER 0
-#define CONFIG_DESHAKE_FILTER 0
-#define CONFIG_DETELECINE_FILTER 0
-#define CONFIG_DILATION_FILTER 0
-#define CONFIG_DISPLACE_FILTER 0
-#define CONFIG_DRAWBOX_FILTER 0
-#define CONFIG_DRAWGRAPH_FILTER 0
-#define CONFIG_DRAWGRID_FILTER 0
-#define CONFIG_DRAWTEXT_FILTER 0
-#define CONFIG_EDGEDETECT_FILTER 0
-#define CONFIG_ELBG_FILTER 0
-#define CONFIG_EQ_FILTER 0
-#define CONFIG_EROSION_FILTER 0
-#define CONFIG_EXTRACTPLANES_FILTER 0
-#define CONFIG_FADE_FILTER 0
-#define CONFIG_FFTFILT_FILTER 0
-#define CONFIG_FIELD_FILTER 0
-#define CONFIG_FIELDHINT_FILTER 0
-#define CONFIG_FIELDMATCH_FILTER 0
-#define CONFIG_FIELDORDER_FILTER 0
-#define CONFIG_FIND_RECT_FILTER 0
-#define CONFIG_FORMAT_FILTER 0
-#define CONFIG_FPS_FILTER 0
-#define CONFIG_FRAMEPACK_FILTER 0
-#define CONFIG_FRAMERATE_FILTER 0
-#define CONFIG_FRAMESTEP_FILTER 0
-#define CONFIG_FREI0R_FILTER 0
-#define CONFIG_FSPP_FILTER 0
-#define CONFIG_GBLUR_FILTER 0
-#define CONFIG_GEQ_FILTER 0
-#define CONFIG_GRADFUN_FILTER 0
-#define CONFIG_HALDCLUT_FILTER 0
-#define CONFIG_HFLIP_FILTER 0
-#define CONFIG_HISTEQ_FILTER 0
-#define CONFIG_HISTOGRAM_FILTER 0
-#define CONFIG_HQDN3D_FILTER 0
-#define CONFIG_HQX_FILTER 0
-#define CONFIG_HSTACK_FILTER 0
-#define CONFIG_HUE_FILTER 0
-#define CONFIG_HWDOWNLOAD_FILTER 0
-#define CONFIG_HWUPLOAD_FILTER 0
-#define CONFIG_HWUPLOAD_CUDA_FILTER 0
-#define CONFIG_HYSTERESIS_FILTER 0
-#define CONFIG_IDET_FILTER 0
-#define CONFIG_IL_FILTER 0
-#define CONFIG_INFLATE_FILTER 0
-#define CONFIG_INTERLACE_FILTER 0
-#define CONFIG_INTERLEAVE_FILTER 0
-#define CONFIG_KERNDEINT_FILTER 0
-#define CONFIG_LENSCORRECTION_FILTER 0
-#define CONFIG_LOOP_FILTER 0
-#define CONFIG_LUT_FILTER 0
-#define CONFIG_LUT2_FILTER 0
-#define CONFIG_LUT3D_FILTER 0
-#define CONFIG_LUTRGB_FILTER 0
-#define CONFIG_LUTYUV_FILTER 0
-#define CONFIG_MASKEDCLAMP_FILTER 0
-#define CONFIG_MASKEDMERGE_FILTER 0
-#define CONFIG_MCDEINT_FILTER 0
-#define CONFIG_MERGEPLANES_FILTER 0
-#define CONFIG_MESTIMATE_FILTER 0
-#define CONFIG_METADATA_FILTER 0
-#define CONFIG_MINTERPOLATE_FILTER 0
-#define CONFIG_MPDECIMATE_FILTER 0
-#define CONFIG_NEGATE_FILTER 0
-#define CONFIG_NLMEANS_FILTER 0
-#define CONFIG_NNEDI_FILTER 0
-#define CONFIG_NOFORMAT_FILTER 0
-#define CONFIG_NOISE_FILTER 0
-#define CONFIG_NULL_FILTER 0
-#define CONFIG_OCR_FILTER 0
-#define CONFIG_OCV_FILTER 0
-#define CONFIG_OVERLAY_FILTER 0
-#define CONFIG_OWDENOISE_FILTER 0
-#define CONFIG_PAD_FILTER 0
-#define CONFIG_PALETTEGEN_FILTER 0
-#define CONFIG_PALETTEUSE_FILTER 0
-#define CONFIG_PERMS_FILTER 0
-#define CONFIG_PERSPECTIVE_FILTER 0
-#define CONFIG_PHASE_FILTER 0
-#define CONFIG_PIXDESCTEST_FILTER 0
-#define CONFIG_PP_FILTER 0
-#define CONFIG_PP7_FILTER 0
-#define CONFIG_PREWITT_FILTER 0
-#define CONFIG_PSNR_FILTER 0
-#define CONFIG_PULLUP_FILTER 0
-#define CONFIG_QP_FILTER 0
-#define CONFIG_RANDOM_FILTER 0
-#define CONFIG_READVITC_FILTER 0
-#define CONFIG_REALTIME_FILTER 0
-#define CONFIG_REMAP_FILTER 0
-#define CONFIG_REMOVEGRAIN_FILTER 0
-#define CONFIG_REMOVELOGO_FILTER 0
-#define CONFIG_REPEATFIELDS_FILTER 0
-#define CONFIG_REVERSE_FILTER 0
-#define CONFIG_ROTATE_FILTER 0
-#define CONFIG_SAB_FILTER 0
-#define CONFIG_SCALE_FILTER 0
-#define CONFIG_SCALE_NPP_FILTER 0
-#define CONFIG_SCALE_VAAPI_FILTER 0
-#define CONFIG_SCALE2REF_FILTER 0
-#define CONFIG_SELECT_FILTER 0
-#define CONFIG_SELECTIVECOLOR_FILTER 0
-#define CONFIG_SENDCMD_FILTER 0
-#define CONFIG_SEPARATEFIELDS_FILTER 0
-#define CONFIG_SETDAR_FILTER 0
-#define CONFIG_SETFIELD_FILTER 0
-#define CONFIG_SETPTS_FILTER 0
-#define CONFIG_SETSAR_FILTER 0
-#define CONFIG_SETTB_FILTER 0
-#define CONFIG_SHOWINFO_FILTER 0
-#define CONFIG_SHOWPALETTE_FILTER 0
-#define CONFIG_SHUFFLEFRAMES_FILTER 0
-#define CONFIG_SHUFFLEPLANES_FILTER 0
-#define CONFIG_SIDEDATA_FILTER 0
-#define CONFIG_SIGNALSTATS_FILTER 0
-#define CONFIG_SMARTBLUR_FILTER 0
-#define CONFIG_SOBEL_FILTER 0
-#define CONFIG_SPLIT_FILTER 0
-#define CONFIG_SPP_FILTER 0
-#define CONFIG_SSIM_FILTER 0
-#define CONFIG_STEREO3D_FILTER 0
-#define CONFIG_STREAMSELECT_FILTER 0
-#define CONFIG_SUBTITLES_FILTER 0
-#define CONFIG_SUPER2XSAI_FILTER 0
-#define CONFIG_SWAPRECT_FILTER 0
-#define CONFIG_SWAPUV_FILTER 0
-#define CONFIG_TBLEND_FILTER 0
-#define CONFIG_TELECINE_FILTER 0
-#define CONFIG_THUMBNAIL_FILTER 0
-#define CONFIG_TILE_FILTER 0
-#define CONFIG_TINTERLACE_FILTER 0
-#define CONFIG_TRANSPOSE_FILTER 0
-#define CONFIG_TRIM_FILTER 0
-#define CONFIG_UNSHARP_FILTER 0
-#define CONFIG_USPP_FILTER 0
-#define CONFIG_VAGUEDENOISER_FILTER 0
-#define CONFIG_VECTORSCOPE_FILTER 0
-#define CONFIG_VFLIP_FILTER 0
-#define CONFIG_VIDSTABDETECT_FILTER 0
-#define CONFIG_VIDSTABTRANSFORM_FILTER 0
-#define CONFIG_VIGNETTE_FILTER 0
-#define CONFIG_VSTACK_FILTER 0
-#define CONFIG_W3FDIF_FILTER 0
-#define CONFIG_WAVEFORM_FILTER 0
-#define CONFIG_WEAVE_FILTER 0
-#define CONFIG_XBR_FILTER 0
-#define CONFIG_YADIF_FILTER 0
-#define CONFIG_ZMQ_FILTER 0
-#define CONFIG_ZOOMPAN_FILTER 0
-#define CONFIG_ZSCALE_FILTER 0
-#define CONFIG_ALLRGB_FILTER 0
-#define CONFIG_ALLYUV_FILTER 0
-#define CONFIG_CELLAUTO_FILTER 0
-#define CONFIG_COLOR_FILTER 0
-#define CONFIG_COREIMAGESRC_FILTER 0
-#define CONFIG_FREI0R_SRC_FILTER 0
-#define CONFIG_HALDCLUTSRC_FILTER 0
-#define CONFIG_LIFE_FILTER 0
-#define CONFIG_MANDELBROT_FILTER 0
-#define CONFIG_MPTESTSRC_FILTER 0
-#define CONFIG_NULLSRC_FILTER 0
-#define CONFIG_RGBTESTSRC_FILTER 0
-#define CONFIG_SMPTEBARS_FILTER 0
-#define CONFIG_SMPTEHDBARS_FILTER 0
-#define CONFIG_TESTSRC_FILTER 0
-#define CONFIG_TESTSRC2_FILTER 0
-#define CONFIG_YUVTESTSRC_FILTER 0
-#define CONFIG_NULLSINK_FILTER 0
-#define CONFIG_ADRAWGRAPH_FILTER 0
-#define CONFIG_AHISTOGRAM_FILTER 0
-#define CONFIG_APHASEMETER_FILTER 0
-#define CONFIG_AVECTORSCOPE_FILTER 0
-#define CONFIG_CONCAT_FILTER 0
-#define CONFIG_SHOWCQT_FILTER 0
-#define CONFIG_SHOWFREQS_FILTER 0
-#define CONFIG_SHOWSPECTRUM_FILTER 0
-#define CONFIG_SHOWSPECTRUMPIC_FILTER 0
-#define CONFIG_SHOWVOLUME_FILTER 0
-#define CONFIG_SHOWWAVES_FILTER 0
-#define CONFIG_SHOWWAVESPIC_FILTER 0
-#define CONFIG_SPECTRUMSYNTH_FILTER 0
-#define CONFIG_AMOVIE_FILTER 0
-#define CONFIG_MOVIE_FILTER 0
-#define CONFIG_H263_CUVID_HWACCEL 0
-#define CONFIG_H263_VAAPI_HWACCEL 0
-#define CONFIG_H263_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_H264_CUVID_HWACCEL 0
-#define CONFIG_H264_D3D11VA_HWACCEL 0
-#define CONFIG_H264_DXVA2_HWACCEL 0
-#define CONFIG_H264_MEDIACODEC_HWACCEL 0
-#define CONFIG_H264_MMAL_HWACCEL 0
-#define CONFIG_H264_QSV_HWACCEL 0
-#define CONFIG_H264_VAAPI_HWACCEL 0
-#define CONFIG_H264_VDA_HWACCEL 0
-#define CONFIG_H264_VDA_OLD_HWACCEL 0
-#define CONFIG_H264_VDPAU_HWACCEL 0
-#define CONFIG_H264_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_HEVC_CUVID_HWACCEL 0
-#define CONFIG_HEVC_D3D11VA_HWACCEL 0
-#define CONFIG_HEVC_DXVA2_HWACCEL 0
-#define CONFIG_HEVC_MEDIACODEC_HWACCEL 0
-#define CONFIG_HEVC_QSV_HWACCEL 0
-#define CONFIG_HEVC_VAAPI_HWACCEL 0
-#define CONFIG_HEVC_VDPAU_HWACCEL 0
-#define CONFIG_MJPEG_CUVID_HWACCEL 0
-#define CONFIG_MPEG1_CUVID_HWACCEL 0
-#define CONFIG_MPEG1_XVMC_HWACCEL 0
-#define CONFIG_MPEG1_VDPAU_HWACCEL 0
-#define CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_MPEG2_CUVID_HWACCEL 0
-#define CONFIG_MPEG2_XVMC_HWACCEL 0
-#define CONFIG_MPEG2_D3D11VA_HWACCEL 0
-#define CONFIG_MPEG2_DXVA2_HWACCEL 0
-#define CONFIG_MPEG2_MMAL_HWACCEL 0
-#define CONFIG_MPEG2_QSV_HWACCEL 0
-#define CONFIG_MPEG2_VAAPI_HWACCEL 0
-#define CONFIG_MPEG2_VDPAU_HWACCEL 0
-#define CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_MPEG4_CUVID_HWACCEL 0
-#define CONFIG_MPEG4_MEDIACODEC_HWACCEL 0
-#define CONFIG_MPEG4_MMAL_HWACCEL 0
-#define CONFIG_MPEG4_VAAPI_HWACCEL 0
-#define CONFIG_MPEG4_VDPAU_HWACCEL 0
-#define CONFIG_MPEG4_VIDEOTOOLBOX_HWACCEL 0
-#define CONFIG_VC1_CUVID_HWACCEL 0
-#define CONFIG_VC1_D3D11VA_HWACCEL 0
-#define CONFIG_VC1_DXVA2_HWACCEL 0
-#define CONFIG_VC1_VAAPI_HWACCEL 0
-#define CONFIG_VC1_VDPAU_HWACCEL 0
-#define CONFIG_VC1_MMAL_HWACCEL 0
-#define CONFIG_VC1_QSV_HWACCEL 0
-#define CONFIG_VP8_CUVID_HWACCEL 0
-#define CONFIG_VP8_MEDIACODEC_HWACCEL 0
-#define CONFIG_VP9_CUVID_HWACCEL 0
-#define CONFIG_VP9_D3D11VA_HWACCEL 0
-#define CONFIG_VP9_DXVA2_HWACCEL 0
-#define CONFIG_VP9_MEDIACODEC_HWACCEL 0
-#define CONFIG_VP9_VAAPI_HWACCEL 0
-#define CONFIG_WMV3_D3D11VA_HWACCEL 0
-#define CONFIG_WMV3_DXVA2_HWACCEL 0
-#define CONFIG_WMV3_VAAPI_HWACCEL 0
-#define CONFIG_WMV3_VDPAU_HWACCEL 0
-#define CONFIG_ALSA_INDEV 0
-#define CONFIG_AVFOUNDATION_INDEV 0
-#define CONFIG_BKTR_INDEV 0
-#define CONFIG_DECKLINK_INDEV 0
-#define CONFIG_DSHOW_INDEV 0
-#define CONFIG_DV1394_INDEV 0
-#define CONFIG_FBDEV_INDEV 0
-#define CONFIG_GDIGRAB_INDEV 0
-#define CONFIG_IEC61883_INDEV 0
-#define CONFIG_JACK_INDEV 0
-#define CONFIG_LAVFI_INDEV 0
-#define CONFIG_OPENAL_INDEV 0
-#define CONFIG_OSS_INDEV 0
-#define CONFIG_PULSE_INDEV 0
-#define CONFIG_QTKIT_INDEV 0
-#define CONFIG_SNDIO_INDEV 0
-#define CONFIG_V4L2_INDEV 0
-#define CONFIG_VFWCAP_INDEV 0
-#define CONFIG_X11GRAB_INDEV 0
-#define CONFIG_X11GRAB_XCB_INDEV 0
-#define CONFIG_LIBCDIO_INDEV 0
-#define CONFIG_LIBDC1394_INDEV 0
-#define CONFIG_A64_MUXER 0
-#define CONFIG_AC3_MUXER 0
-#define CONFIG_ADTS_MUXER 0
-#define CONFIG_ADX_MUXER 0
-#define CONFIG_AIFF_MUXER 0
-#define CONFIG_AMR_MUXER 0
-#define CONFIG_APNG_MUXER 0
-#define CONFIG_ASF_MUXER 0
-#define CONFIG_ASS_MUXER 0
-#define CONFIG_AST_MUXER 0
-#define CONFIG_ASF_STREAM_MUXER 0
-#define CONFIG_AU_MUXER 0
-#define CONFIG_AVI_MUXER 0
-#define CONFIG_AVM2_MUXER 0
-#define CONFIG_BIT_MUXER 0
-#define CONFIG_CAF_MUXER 0
-#define CONFIG_CAVSVIDEO_MUXER 0
-#define CONFIG_CRC_MUXER 0
-#define CONFIG_DASH_MUXER 0
-#define CONFIG_DATA_MUXER 0
-#define CONFIG_DAUD_MUXER 0
-#define CONFIG_DIRAC_MUXER 0
-#define CONFIG_DNXHD_MUXER 0
-#define CONFIG_DTS_MUXER 0
-#define CONFIG_DV_MUXER 0
-#define CONFIG_EAC3_MUXER 0
-#define CONFIG_F4V_MUXER 0
-#define CONFIG_FFM_MUXER 0
-#define CONFIG_FFMETADATA_MUXER 0
-#define CONFIG_FIFO_MUXER 0
-#define CONFIG_FILMSTRIP_MUXER 0
-#define CONFIG_FLAC_MUXER 0
-#define CONFIG_FLV_MUXER 0
-#define CONFIG_FRAMECRC_MUXER 0
-#define CONFIG_FRAMEHASH_MUXER 0
-#define CONFIG_FRAMEMD5_MUXER 0
-#define CONFIG_G722_MUXER 0
-#define CONFIG_G723_1_MUXER 0
-#define CONFIG_GIF_MUXER 0
-#define CONFIG_GSM_MUXER 0
-#define CONFIG_GXF_MUXER 0
-#define CONFIG_H261_MUXER 0
-#define CONFIG_H263_MUXER 0
-#define CONFIG_H264_MUXER 0
-#define CONFIG_HASH_MUXER 0
-#define CONFIG_HDS_MUXER 0
-#define CONFIG_HEVC_MUXER 0
-#define CONFIG_HLS_MUXER 0
-#define CONFIG_ICO_MUXER 0
-#define CONFIG_ILBC_MUXER 0
-#define CONFIG_IMAGE2_MUXER 0
-#define CONFIG_IMAGE2PIPE_MUXER 0
-#define CONFIG_IPOD_MUXER 0
-#define CONFIG_IRCAM_MUXER 0
-#define CONFIG_ISMV_MUXER 0
-#define CONFIG_IVF_MUXER 0
-#define CONFIG_JACOSUB_MUXER 0
-#define CONFIG_LATM_MUXER 0
-#define CONFIG_LRC_MUXER 0
-#define CONFIG_M4V_MUXER 0
-#define CONFIG_MD5_MUXER 0
-#define CONFIG_MATROSKA_MUXER 0
-#define CONFIG_MATROSKA_AUDIO_MUXER 0
-#define CONFIG_MICRODVD_MUXER 0
-#define CONFIG_MJPEG_MUXER 0
-#define CONFIG_MLP_MUXER 0
-#define CONFIG_MMF_MUXER 0
-#define CONFIG_MOV_MUXER 0
-#define CONFIG_MP2_MUXER 0
-#define CONFIG_MP3_MUXER 0
-#define CONFIG_MP4_MUXER 0
-#define CONFIG_MPEG1SYSTEM_MUXER 0
-#define CONFIG_MPEG1VCD_MUXER 0
-#define CONFIG_MPEG1VIDEO_MUXER 0
-#define CONFIG_MPEG2DVD_MUXER 0
-#define CONFIG_MPEG2SVCD_MUXER 0
-#define CONFIG_MPEG2VIDEO_MUXER 0
-#define CONFIG_MPEG2VOB_MUXER 0
-#define CONFIG_MPEGTS_MUXER 0
-#define CONFIG_MPJPEG_MUXER 0
-#define CONFIG_MXF_MUXER 0
-#define CONFIG_MXF_D10_MUXER 0
-#define CONFIG_MXF_OPATOM_MUXER 0
-#define CONFIG_NULL_MUXER 0
-#define CONFIG_NUT_MUXER 0
-#define CONFIG_OGA_MUXER 0
-#define CONFIG_OGG_MUXER 0
-#define CONFIG_OGV_MUXER 0
-#define CONFIG_OMA_MUXER 0
-#define CONFIG_OPUS_MUXER 0
-#define CONFIG_PCM_ALAW_MUXER 0
-#define CONFIG_PCM_MULAW_MUXER 0
-#define CONFIG_PCM_F64BE_MUXER 0
-#define CONFIG_PCM_F64LE_MUXER 0
-#define CONFIG_PCM_F32BE_MUXER 0
-#define CONFIG_PCM_F32LE_MUXER 0
-#define CONFIG_PCM_S32BE_MUXER 0
-#define CONFIG_PCM_S32LE_MUXER 0
-#define CONFIG_PCM_S24BE_MUXER 0
-#define CONFIG_PCM_S24LE_MUXER 0
-#define CONFIG_PCM_S16BE_MUXER 0
-#define CONFIG_PCM_S16LE_MUXER 0
-#define CONFIG_PCM_S8_MUXER 0
-#define CONFIG_PCM_U32BE_MUXER 0
-#define CONFIG_PCM_U32LE_MUXER 0
-#define CONFIG_PCM_U24BE_MUXER 0
-#define CONFIG_PCM_U24LE_MUXER 0
-#define CONFIG_PCM_U16BE_MUXER 0
-#define CONFIG_PCM_U16LE_MUXER 0
-#define CONFIG_PCM_U8_MUXER 0
-#define CONFIG_PSP_MUXER 0
-#define CONFIG_RAWVIDEO_MUXER 0
-#define CONFIG_RM_MUXER 0
-#define CONFIG_ROQ_MUXER 0
-#define CONFIG_RSO_MUXER 0
-#define CONFIG_RTP_MUXER 0
-#define CONFIG_RTP_MPEGTS_MUXER 0
-#define CONFIG_RTSP_MUXER 0
-#define CONFIG_SAP_MUXER 0
-#define CONFIG_SEGMENT_MUXER 0
-#define CONFIG_STREAM_SEGMENT_MUXER 0
-#define CONFIG_SINGLEJPEG_MUXER 0
-#define CONFIG_SMJPEG_MUXER 0
-#define CONFIG_SMOOTHSTREAMING_MUXER 0
-#define CONFIG_SOX_MUXER 0
-#define CONFIG_SPX_MUXER 0
-#define CONFIG_SPDIF_MUXER 0
-#define CONFIG_SRT_MUXER 0
-#define CONFIG_SWF_MUXER 0
-#define CONFIG_TEE_MUXER 0
-#define CONFIG_TG2_MUXER 0
-#define CONFIG_TGP_MUXER 0
-#define CONFIG_MKVTIMESTAMP_V2_MUXER 0
-#define CONFIG_TRUEHD_MUXER 0
-#define CONFIG_TTA_MUXER 0
-#define CONFIG_UNCODEDFRAMECRC_MUXER 0
-#define CONFIG_VC1_MUXER 0
-#define CONFIG_VC1T_MUXER 0
-#define CONFIG_VOC_MUXER 0
-#define CONFIG_W64_MUXER 0
-#define CONFIG_WAV_MUXER 0
-#define CONFIG_WEBM_MUXER 0
-#define CONFIG_WEBM_DASH_MANIFEST_MUXER 0
-#define CONFIG_WEBM_CHUNK_MUXER 0
-#define CONFIG_WEBP_MUXER 0
-#define CONFIG_WEBVTT_MUXER 0
-#define CONFIG_WTV_MUXER 0
-#define CONFIG_WV_MUXER 0
-#define CONFIG_YUV4MPEGPIPE_MUXER 0
-#define CONFIG_CHROMAPRINT_MUXER 0
-#define CONFIG_LIBNUT_MUXER 0
-#define CONFIG_ALSA_OUTDEV 0
-#define CONFIG_CACA_OUTDEV 0
-#define CONFIG_DECKLINK_OUTDEV 0
-#define CONFIG_FBDEV_OUTDEV 0
-#define CONFIG_OPENGL_OUTDEV 0
-#define CONFIG_OSS_OUTDEV 0
-#define CONFIG_PULSE_OUTDEV 0
-#define CONFIG_SDL2_OUTDEV 0
-#define CONFIG_SNDIO_OUTDEV 0
-#define CONFIG_V4L2_OUTDEV 0
-#define CONFIG_XV_OUTDEV 0
-#define CONFIG_AAC_PARSER 0
-#define CONFIG_AAC_LATM_PARSER 0
-#define CONFIG_AC3_PARSER 0
-#define CONFIG_ADX_PARSER 0
-#define CONFIG_BMP_PARSER 0
-#define CONFIG_CAVSVIDEO_PARSER 0
-#define CONFIG_COOK_PARSER 0
-#define CONFIG_DCA_PARSER 0
-#define CONFIG_DIRAC_PARSER 0
-#define CONFIG_DNXHD_PARSER 0
-#define CONFIG_DPX_PARSER 0
-#define CONFIG_DVAUDIO_PARSER 0
-#define CONFIG_DVBSUB_PARSER 0
-#define CONFIG_DVDSUB_PARSER 0
-#define CONFIG_DVD_NAV_PARSER 0
-#define CONFIG_FLAC_PARSER 1
-#define CONFIG_G729_PARSER 0
-#define CONFIG_GSM_PARSER 0
-#define CONFIG_H261_PARSER 0
-#define CONFIG_H263_PARSER 0
-#define CONFIG_H264_PARSER 0
-#define CONFIG_HEVC_PARSER 0
-#define CONFIG_MJPEG_PARSER 0
-#define CONFIG_MLP_PARSER 0
-#define CONFIG_MPEG4VIDEO_PARSER 0
-#define CONFIG_MPEGAUDIO_PARSER 0
-#define CONFIG_MPEGVIDEO_PARSER 0
-#define CONFIG_OPUS_PARSER 0
-#define CONFIG_PNG_PARSER 0
-#define CONFIG_PNM_PARSER 0
-#define CONFIG_RV30_PARSER 0
-#define CONFIG_RV40_PARSER 0
-#define CONFIG_TAK_PARSER 0
-#define CONFIG_VC1_PARSER 0
-#define CONFIG_VORBIS_PARSER 0
-#define CONFIG_VP3_PARSER 0
+#define CONFIG_FLAC_PARSER 0
#define CONFIG_VP8_PARSER 1
#define CONFIG_VP9_PARSER 1
-#define CONFIG_ASYNC_PROTOCOL 0
-#define CONFIG_BLURAY_PROTOCOL 0
-#define CONFIG_CACHE_PROTOCOL 0
-#define CONFIG_CONCAT_PROTOCOL 0
-#define CONFIG_CRYPTO_PROTOCOL 0
-#define CONFIG_DATA_PROTOCOL 0
-#define CONFIG_FFRTMPCRYPT_PROTOCOL 0
-#define CONFIG_FFRTMPHTTP_PROTOCOL 0
-#define CONFIG_FILE_PROTOCOL 0
-#define CONFIG_FTP_PROTOCOL 0
-#define CONFIG_GOPHER_PROTOCOL 0
-#define CONFIG_HLS_PROTOCOL 0
-#define CONFIG_HTTP_PROTOCOL 0
-#define CONFIG_HTTPPROXY_PROTOCOL 0
-#define CONFIG_HTTPS_PROTOCOL 0
-#define CONFIG_ICECAST_PROTOCOL 0
-#define CONFIG_MMSH_PROTOCOL 0
-#define CONFIG_MMST_PROTOCOL 0
-#define CONFIG_MD5_PROTOCOL 0
-#define CONFIG_PIPE_PROTOCOL 0
-#define CONFIG_RTMP_PROTOCOL 0
-#define CONFIG_RTMPE_PROTOCOL 0
-#define CONFIG_RTMPS_PROTOCOL 0
-#define CONFIG_RTMPT_PROTOCOL 0
-#define CONFIG_RTMPTE_PROTOCOL 0
-#define CONFIG_RTMPTS_PROTOCOL 0
-#define CONFIG_RTP_PROTOCOL 0
-#define CONFIG_SCTP_PROTOCOL 0
-#define CONFIG_SRTP_PROTOCOL 0
-#define CONFIG_SUBFILE_PROTOCOL 0
-#define CONFIG_TEE_PROTOCOL 0
-#define CONFIG_TCP_PROTOCOL 0
-#define CONFIG_TLS_GNUTLS_PROTOCOL 0
-#define CONFIG_TLS_SCHANNEL_PROTOCOL 0
-#define CONFIG_TLS_SECURETRANSPORT_PROTOCOL 0
-#define CONFIG_TLS_OPENSSL_PROTOCOL 0
-#define CONFIG_UDP_PROTOCOL 0
-#define CONFIG_UDPLITE_PROTOCOL 0
-#define CONFIG_UNIX_PROTOCOL 0
-#define CONFIG_LIBRTMP_PROTOCOL 0
-#define CONFIG_LIBRTMPE_PROTOCOL 0
-#define CONFIG_LIBRTMPS_PROTOCOL 0
-#define CONFIG_LIBRTMPT_PROTOCOL 0
-#define CONFIG_LIBRTMPTE_PROTOCOL 0
-#define CONFIG_LIBSSH_PROTOCOL 0
-#define CONFIG_LIBSMBCLIENT_PROTOCOL 0
#endif /* FFMPEG_CONFIG_H */
diff --git a/media/ffvpx/defaults_disabled.asm b/media/ffvpx/defaults_disabled.asm
new file mode 100644
index 0000000000..a9fde4c527
--- /dev/null
+++ b/media/ffvpx/defaults_disabled.asm
@@ -0,0 +1,1674 @@
+%define CONFIG_ENCODERS 0
+%define CONFIG_HWACCELS 0
+%define CONFIG_INDEVS 0
+%define CONFIG_OUTDEVS 0
+%define CONFIG_FILTERS 0
+%define CONFIG_DEMUXERS 0
+%define CONFIG_MUXERS 0
+%define CONFIG_PROTOCOLS 0
+%define CONFIG_FRAME_THREAD_ENCODER 0
+%define CONFIG_AASC_DECODER 0
+%define CONFIG_AIC_DECODER 0
+%define CONFIG_ALIAS_PIX_DECODER 0
+%define CONFIG_AMV_DECODER 0
+%define CONFIG_ANM_DECODER 0
+%define CONFIG_ANSI_DECODER 0
+%define CONFIG_APNG_DECODER 0
+%define CONFIG_ASV1_DECODER 0
+%define CONFIG_ASV2_DECODER 0
+%define CONFIG_AURA_DECODER 0
+%define CONFIG_AURA2_DECODER 0
+%define CONFIG_AVRP_DECODER 0
+%define CONFIG_AVRN_DECODER 0
+%define CONFIG_AVS_DECODER 0
+%define CONFIG_AVUI_DECODER 0
+%define CONFIG_AYUV_DECODER 0
+%define CONFIG_BETHSOFTVID_DECODER 0
+%define CONFIG_BFI_DECODER 0
+%define CONFIG_BINK_DECODER 0
+%define CONFIG_BMP_DECODER 0
+%define CONFIG_BMV_VIDEO_DECODER 0
+%define CONFIG_BRENDER_PIX_DECODER 0
+%define CONFIG_C93_DECODER 0
+%define CONFIG_CAVS_DECODER 0
+%define CONFIG_CDGRAPHICS_DECODER 0
+%define CONFIG_CDXL_DECODER 0
+%define CONFIG_CFHD_DECODER 0
+%define CONFIG_CINEPAK_DECODER 0
+%define CONFIG_CLEARVIDEO_DECODER 0
+%define CONFIG_CLJR_DECODER 0
+%define CONFIG_CLLC_DECODER 0
+%define CONFIG_COMFORTNOISE_DECODER 0
+%define CONFIG_CPIA_DECODER 0
+%define CONFIG_CSCD_DECODER 0
+%define CONFIG_CYUV_DECODER 0
+%define CONFIG_DDS_DECODER 0
+%define CONFIG_DFA_DECODER 0
+%define CONFIG_DIRAC_DECODER 0
+%define CONFIG_DNXHD_DECODER 0
+%define CONFIG_DPX_DECODER 0
+%define CONFIG_DSICINVIDEO_DECODER 0
+%define CONFIG_DVAUDIO_DECODER 0
+%define CONFIG_DVVIDEO_DECODER 0
+%define CONFIG_DXA_DECODER 0
+%define CONFIG_DXTORY_DECODER 0
+%define CONFIG_DXV_DECODER 0
+%define CONFIG_EACMV_DECODER 0
+%define CONFIG_EAMAD_DECODER 0
+%define CONFIG_EATGQ_DECODER 0
+%define CONFIG_EATGV_DECODER 0
+%define CONFIG_EATQI_DECODER 0
+%define CONFIG_EIGHTBPS_DECODER 0
+%define CONFIG_EIGHTSVX_EXP_DECODER 0
+%define CONFIG_EIGHTSVX_FIB_DECODER 0
+%define CONFIG_ESCAPE124_DECODER 0
+%define CONFIG_ESCAPE130_DECODER 0
+%define CONFIG_EXR_DECODER 0
+%define CONFIG_FFV1_DECODER 0
+%define CONFIG_FFVHUFF_DECODER 0
+%define CONFIG_FIC_DECODER 0
+%define CONFIG_FITS_DECODER 0
+%define CONFIG_FLASHSV_DECODER 0
+%define CONFIG_FLASHSV2_DECODER 0
+%define CONFIG_FLIC_DECODER 0
+%define CONFIG_FLV_DECODER 0
+%define CONFIG_FMVC_DECODER 0
+%define CONFIG_FOURXM_DECODER 0
+%define CONFIG_FRAPS_DECODER 0
+%define CONFIG_FRWU_DECODER 0
+%define CONFIG_G2M_DECODER 0
+%define CONFIG_GDV_DECODER 0
+%define CONFIG_GIF_DECODER 0
+%define CONFIG_H261_DECODER 0
+%define CONFIG_H263_DECODER 0
+%define CONFIG_H263I_DECODER 0
+%define CONFIG_H263P_DECODER 0
+%define CONFIG_H263_V4L2M2M_DECODER 0
+%define CONFIG_H264_DECODER 0
+%define CONFIG_H264_CRYSTALHD_DECODER 0
+%define CONFIG_H264_V4L2M2M_DECODER 0
+%define CONFIG_H264_MEDIACODEC_DECODER 0
+%define CONFIG_H264_MMAL_DECODER 0
+%define CONFIG_H264_QSV_DECODER 0
+%define CONFIG_H264_RKMPP_DECODER 0
+%define CONFIG_H264_VDA_DECODER 0
+%define CONFIG_H264_VDPAU_DECODER 0
+%define CONFIG_HAP_DECODER 0
+%define CONFIG_HEVC_DECODER 0
+%define CONFIG_HEVC_QSV_DECODER 0
+%define CONFIG_HEVC_RKMPP_DECODER 0
+%define CONFIG_HEVC_V4L2M2M_DECODER 0
+%define CONFIG_HNM4_VIDEO_DECODER 0
+%define CONFIG_HQ_HQA_DECODER 0
+%define CONFIG_HQX_DECODER 0
+%define CONFIG_HUFFYUV_DECODER 0
+%define CONFIG_IDCIN_DECODER 0
+%define CONFIG_IFF_ILBM_DECODER 0
+%define CONFIG_INDEO2_DECODER 0
+%define CONFIG_INDEO3_DECODER 0
+%define CONFIG_INDEO4_DECODER 0
+%define CONFIG_INDEO5_DECODER 0
+%define CONFIG_INTERPLAY_VIDEO_DECODER 0
+%define CONFIG_JPEG2000_DECODER 0
+%define CONFIG_JPEGLS_DECODER 0
+%define CONFIG_JV_DECODER 0
+%define CONFIG_KGV1_DECODER 0
+%define CONFIG_KMVC_DECODER 0
+%define CONFIG_LAGARITH_DECODER 0
+%define CONFIG_LOCO_DECODER 0
+%define CONFIG_M101_DECODER 0
+%define CONFIG_MAGICYUV_DECODER 0
+%define CONFIG_MDEC_DECODER 0
+%define CONFIG_MIMIC_DECODER 0
+%define CONFIG_MJPEG_DECODER 0
+%define CONFIG_MJPEGB_DECODER 0
+%define CONFIG_MMVIDEO_DECODER 0
+%define CONFIG_MOTIONPIXELS_DECODER 0
+%define CONFIG_MPEG_XVMC_DECODER 0
+%define CONFIG_MPEG1VIDEO_DECODER 0
+%define CONFIG_MPEG2VIDEO_DECODER 0
+%define CONFIG_MPEG4_DECODER 0
+%define CONFIG_MPEG4_CRYSTALHD_DECODER 0
+%define CONFIG_MPEG4_V4L2M2M_DECODER 0
+%define CONFIG_MPEG4_MMAL_DECODER 0
+%define CONFIG_MPEG4_VDPAU_DECODER 0
+%define CONFIG_MPEGVIDEO_DECODER 0
+%define CONFIG_MPEG_VDPAU_DECODER 0
+%define CONFIG_MPEG1_VDPAU_DECODER 0
+%define CONFIG_MPEG1_V4L2M2M_DECODER 0
+%define CONFIG_MPEG2_MMAL_DECODER 0
+%define CONFIG_MPEG2_CRYSTALHD_DECODER 0
+%define CONFIG_MPEG2_V4L2M2M_DECODER 0
+%define CONFIG_MPEG2_QSV_DECODER 0
+%define CONFIG_MPEG2_MEDIACODEC_DECODER 0
+%define CONFIG_MSA1_DECODER 0
+%define CONFIG_MSCC_DECODER 0
+%define CONFIG_MSMPEG4V1_DECODER 0
+%define CONFIG_MSMPEG4V2_DECODER 0
+%define CONFIG_MSMPEG4V3_DECODER 0
+%define CONFIG_MSMPEG4_CRYSTALHD_DECODER 0
+%define CONFIG_MSRLE_DECODER 0
+%define CONFIG_MSS1_DECODER 0
+%define CONFIG_MSS2_DECODER 0
+%define CONFIG_MSVIDEO1_DECODER 0
+%define CONFIG_MSZH_DECODER 0
+%define CONFIG_MTS2_DECODER 0
+%define CONFIG_MVC1_DECODER 0
+%define CONFIG_MVC2_DECODER 0
+%define CONFIG_MXPEG_DECODER 0
+%define CONFIG_NUV_DECODER 0
+%define CONFIG_PAF_VIDEO_DECODER 0
+%define CONFIG_PAM_DECODER 0
+%define CONFIG_PBM_DECODER 0
+%define CONFIG_PCX_DECODER 0
+%define CONFIG_PGM_DECODER 0
+%define CONFIG_PGMYUV_DECODER 0
+%define CONFIG_PICTOR_DECODER 0
+%define CONFIG_PIXLET_DECODER 0
+%define CONFIG_PNG_DECODER 0
+%define CONFIG_PPM_DECODER 0
+%define CONFIG_PRORES_DECODER 0
+%define CONFIG_PRORES_LGPL_DECODER 0
+%define CONFIG_PSD_DECODER 0
+%define CONFIG_PTX_DECODER 0
+%define CONFIG_QDRAW_DECODER 0
+%define CONFIG_QPEG_DECODER 0
+%define CONFIG_QTRLE_DECODER 0
+%define CONFIG_R10K_DECODER 0
+%define CONFIG_R210_DECODER 0
+%define CONFIG_RAWVIDEO_DECODER 0
+%define CONFIG_RL2_DECODER 0
+%define CONFIG_ROQ_DECODER 0
+%define CONFIG_RPZA_DECODER 0
+%define CONFIG_RSCC_DECODER 0
+%define CONFIG_RV10_DECODER 0
+%define CONFIG_RV20_DECODER 0
+%define CONFIG_RV30_DECODER 0
+%define CONFIG_RV40_DECODER 0
+%define CONFIG_S302M_DECODER 0
+%define CONFIG_SANM_DECODER 0
+%define CONFIG_SCPR_DECODER 0
+%define CONFIG_SCREENPRESSO_DECODER 0
+%define CONFIG_SDX2_DPCM_DECODER 0
+%define CONFIG_SGI_DECODER 0
+%define CONFIG_SGIRLE_DECODER 0
+%define CONFIG_SHEERVIDEO_DECODER 0
+%define CONFIG_SMACKER_DECODER 0
+%define CONFIG_SMC_DECODER 0
+%define CONFIG_SMVJPEG_DECODER 0
+%define CONFIG_SNOW_DECODER 0
+%define CONFIG_SP5X_DECODER 0
+%define CONFIG_SPEEDHQ_DECODER 0
+%define CONFIG_SRGC_DECODER 0
+%define CONFIG_SUNRAST_DECODER 0
+%define CONFIG_SVQ1_DECODER 0
+%define CONFIG_SVQ3_DECODER 0
+%define CONFIG_TARGA_DECODER 0
+%define CONFIG_TARGA_Y216_DECODER 0
+%define CONFIG_TDSC_DECODER 0
+%define CONFIG_THEORA_DECODER 0
+%define CONFIG_THP_DECODER 0
+%define CONFIG_TIERTEXSEQVIDEO_DECODER 0
+%define CONFIG_TIFF_DECODER 0
+%define CONFIG_TMV_DECODER 0
+%define CONFIG_TRUEMOTION1_DECODER 0
+%define CONFIG_TRUEMOTION2_DECODER 0
+%define CONFIG_TRUEMOTION2RT_DECODER 0
+%define CONFIG_TSCC_DECODER 0
+%define CONFIG_TSCC2_DECODER 0
+%define CONFIG_TXD_DECODER 0
+%define CONFIG_ULTI_DECODER 0
+%define CONFIG_UTVIDEO_DECODER 0
+%define CONFIG_V210_DECODER 0
+%define CONFIG_V210X_DECODER 0
+%define CONFIG_V308_DECODER 0
+%define CONFIG_V408_DECODER 0
+%define CONFIG_V410_DECODER 0
+%define CONFIG_VB_DECODER 0
+%define CONFIG_VBLE_DECODER 0
+%define CONFIG_VC1_DECODER 0
+%define CONFIG_VC1_CRYSTALHD_DECODER 0
+%define CONFIG_VC1_VDPAU_DECODER 0
+%define CONFIG_VC1IMAGE_DECODER 0
+%define CONFIG_VC1_MMAL_DECODER 0
+%define CONFIG_VC1_QSV_DECODER 0
+%define CONFIG_VC1_V4L2M2M_DECODER 0
+%define CONFIG_VCR1_DECODER 0
+%define CONFIG_VMDVIDEO_DECODER 0
+%define CONFIG_VMNC_DECODER 0
+%define CONFIG_VP3_DECODER 0
+%define CONFIG_VP5_DECODER 0
+%define CONFIG_VP6_DECODER 0
+%define CONFIG_VP6A_DECODER 0
+%define CONFIG_VP6F_DECODER 0
+%define CONFIG_VP7_DECODER 0
+%define CONFIG_VP8_RKMPP_DECODER 0
+%define CONFIG_VP8_V4L2M2M_DECODER 0
+%define CONFIG_VP9_RKMPP_DECODER 0
+%define CONFIG_VP9_V4L2M2M_DECODER 0
+%define CONFIG_VQA_DECODER 0
+%define CONFIG_BITPACKED_DECODER 0
+%define CONFIG_WEBP_DECODER 0
+%define CONFIG_WRAPPED_AVFRAME_DECODER 0
+%define CONFIG_WMV1_DECODER 0
+%define CONFIG_WMV2_DECODER 0
+%define CONFIG_WMV3_DECODER 0
+%define CONFIG_WMV3_CRYSTALHD_DECODER 0
+%define CONFIG_WMV3_VDPAU_DECODER 0
+%define CONFIG_WMV3IMAGE_DECODER 0
+%define CONFIG_WNV1_DECODER 0
+%define CONFIG_XAN_WC3_DECODER 0
+%define CONFIG_XAN_WC4_DECODER 0
+%define CONFIG_XBM_DECODER 0
+%define CONFIG_XFACE_DECODER 0
+%define CONFIG_XL_DECODER 0
+%define CONFIG_XPM_DECODER 0
+%define CONFIG_XWD_DECODER 0
+%define CONFIG_Y41P_DECODER 0
+%define CONFIG_YLC_DECODER 0
+%define CONFIG_YOP_DECODER 0
+%define CONFIG_YUV4_DECODER 0
+%define CONFIG_ZERO12V_DECODER 0
+%define CONFIG_ZEROCODEC_DECODER 0
+%define CONFIG_ZLIB_DECODER 0
+%define CONFIG_ZMBV_DECODER 0
+%define CONFIG_AAC_DECODER 0
+%define CONFIG_AAC_FIXED_DECODER 0
+%define CONFIG_AAC_LATM_DECODER 0
+%define CONFIG_AC3_DECODER 0
+%define CONFIG_AC3_FIXED_DECODER 0
+%define CONFIG_ALAC_DECODER 0
+%define CONFIG_ALS_DECODER 0
+%define CONFIG_AMRNB_DECODER 0
+%define CONFIG_AMRWB_DECODER 0
+%define CONFIG_APE_DECODER 0
+%define CONFIG_ATRAC1_DECODER 0
+%define CONFIG_ATRAC3_DECODER 0
+%define CONFIG_ATRAC3AL_DECODER 0
+%define CONFIG_ATRAC3P_DECODER 0
+%define CONFIG_ATRAC3PAL_DECODER 0
+%define CONFIG_BINKAUDIO_DCT_DECODER 0
+%define CONFIG_BINKAUDIO_RDFT_DECODER 0
+%define CONFIG_BMV_AUDIO_DECODER 0
+%define CONFIG_COOK_DECODER 0
+%define CONFIG_DCA_DECODER 0
+%define CONFIG_DOLBY_E_DECODER 0
+%define CONFIG_DSD_LSBF_DECODER 0
+%define CONFIG_DSD_MSBF_DECODER 0
+%define CONFIG_DSD_LSBF_PLANAR_DECODER 0
+%define CONFIG_DSD_MSBF_PLANAR_DECODER 0
+%define CONFIG_DSICINAUDIO_DECODER 0
+%define CONFIG_DSS_SP_DECODER 0
+%define CONFIG_DST_DECODER 0
+%define CONFIG_EAC3_DECODER 0
+%define CONFIG_EVRC_DECODER 0
+%define CONFIG_FFWAVESYNTH_DECODER 0
+%define CONFIG_G723_1_DECODER 0
+%define CONFIG_G729_DECODER 0
+%define CONFIG_GSM_DECODER 0
+%define CONFIG_GSM_MS_DECODER 0
+%define CONFIG_IAC_DECODER 0
+%define CONFIG_IMC_DECODER 0
+%define CONFIG_INTERPLAY_ACM_DECODER 0
+%define CONFIG_MACE3_DECODER 0
+%define CONFIG_MACE6_DECODER 0
+%define CONFIG_METASOUND_DECODER 0
+%define CONFIG_MLP_DECODER 0
+%define CONFIG_MP1_DECODER 0
+%define CONFIG_MP1FLOAT_DECODER 0
+%define CONFIG_MP2_DECODER 0
+%define CONFIG_MP2FLOAT_DECODER 0
+%define CONFIG_MP3_DECODER 0
+%define CONFIG_MP3FLOAT_DECODER 0
+%define CONFIG_MP3ADU_DECODER 0
+%define CONFIG_MP3ADUFLOAT_DECODER 0
+%define CONFIG_MP3ON4_DECODER 0
+%define CONFIG_MP3ON4FLOAT_DECODER 0
+%define CONFIG_MPC7_DECODER 0
+%define CONFIG_MPC8_DECODER 0
+%define CONFIG_NELLYMOSER_DECODER 0
+%define CONFIG_ON2AVC_DECODER 0
+%define CONFIG_OPUS_DECODER 0
+%define CONFIG_PAF_AUDIO_DECODER 0
+%define CONFIG_QCELP_DECODER 0
+%define CONFIG_QDM2_DECODER 0
+%define CONFIG_QDMC_DECODER 0
+%define CONFIG_RA_144_DECODER 0
+%define CONFIG_RA_288_DECODER 0
+%define CONFIG_RALF_DECODER 0
+%define CONFIG_SHORTEN_DECODER 0
+%define CONFIG_SIPR_DECODER 0
+%define CONFIG_SMACKAUD_DECODER 0
+%define CONFIG_SONIC_DECODER 0
+%define CONFIG_TAK_DECODER 0
+%define CONFIG_TRUEHD_DECODER 0
+%define CONFIG_TRUESPEECH_DECODER 0
+%define CONFIG_TTA_DECODER 0
+%define CONFIG_TWINVQ_DECODER 0
+%define CONFIG_VMDAUDIO_DECODER 0
+%define CONFIG_VORBIS_DECODER 0
+%define CONFIG_WAVPACK_DECODER 0
+%define CONFIG_WMALOSSLESS_DECODER 0
+%define CONFIG_WMAPRO_DECODER 0
+%define CONFIG_WMAV1_DECODER 0
+%define CONFIG_WMAV2_DECODER 0
+%define CONFIG_WMAVOICE_DECODER 0
+%define CONFIG_WS_SND1_DECODER 0
+%define CONFIG_XMA1_DECODER 0
+%define CONFIG_XMA2_DECODER 0
+%define CONFIG_PCM_ALAW_DECODER 0
+%define CONFIG_PCM_BLURAY_DECODER 0
+%define CONFIG_PCM_DVD_DECODER 0
+%define CONFIG_PCM_F16LE_DECODER 0
+%define CONFIG_PCM_F24LE_DECODER 0
+%define CONFIG_PCM_F32BE_DECODER 0
+%define CONFIG_PCM_F32LE_DECODER 0
+%define CONFIG_PCM_F64BE_DECODER 0
+%define CONFIG_PCM_F64LE_DECODER 0
+%define CONFIG_PCM_LXF_DECODER 0
+%define CONFIG_PCM_MULAW_DECODER 0
+%define CONFIG_PCM_S8_DECODER 0
+%define CONFIG_PCM_S8_PLANAR_DECODER 0
+%define CONFIG_PCM_S16BE_DECODER 0
+%define CONFIG_PCM_S16BE_PLANAR_DECODER 0
+%define CONFIG_PCM_S16LE_DECODER 0
+%define CONFIG_PCM_S16LE_PLANAR_DECODER 0
+%define CONFIG_PCM_S24BE_DECODER 0
+%define CONFIG_PCM_S24DAUD_DECODER 0
+%define CONFIG_PCM_S24LE_DECODER 0
+%define CONFIG_PCM_S24LE_PLANAR_DECODER 0
+%define CONFIG_PCM_S32BE_DECODER 0
+%define CONFIG_PCM_S32LE_DECODER 0
+%define CONFIG_PCM_S32LE_PLANAR_DECODER 0
+%define CONFIG_PCM_S64BE_DECODER 0
+%define CONFIG_PCM_S64LE_DECODER 0
+%define CONFIG_PCM_U8_DECODER 0
+%define CONFIG_PCM_U16BE_DECODER 0
+%define CONFIG_PCM_U16LE_DECODER 0
+%define CONFIG_PCM_U24BE_DECODER 0
+%define CONFIG_PCM_U24LE_DECODER 0
+%define CONFIG_PCM_U32BE_DECODER 0
+%define CONFIG_PCM_U32LE_DECODER 0
+%define CONFIG_PCM_ZORK_DECODER 0
+%define CONFIG_GREMLIN_DPCM_DECODER 0
+%define CONFIG_INTERPLAY_DPCM_DECODER 0
+%define CONFIG_ROQ_DPCM_DECODER 0
+%define CONFIG_SOL_DPCM_DECODER 0
+%define CONFIG_XAN_DPCM_DECODER 0
+%define CONFIG_ADPCM_4XM_DECODER 0
+%define CONFIG_ADPCM_ADX_DECODER 0
+%define CONFIG_ADPCM_AFC_DECODER 0
+%define CONFIG_ADPCM_AICA_DECODER 0
+%define CONFIG_ADPCM_CT_DECODER 0
+%define CONFIG_ADPCM_DTK_DECODER 0
+%define CONFIG_ADPCM_EA_DECODER 0
+%define CONFIG_ADPCM_EA_MAXIS_XA_DECODER 0
+%define CONFIG_ADPCM_EA_R1_DECODER 0
+%define CONFIG_ADPCM_EA_R2_DECODER 0
+%define CONFIG_ADPCM_EA_R3_DECODER 0
+%define CONFIG_ADPCM_EA_XAS_DECODER 0
+%define CONFIG_ADPCM_G722_DECODER 0
+%define CONFIG_ADPCM_G726_DECODER 0
+%define CONFIG_ADPCM_G726LE_DECODER 0
+%define CONFIG_ADPCM_IMA_AMV_DECODER 0
+%define CONFIG_ADPCM_IMA_APC_DECODER 0
+%define CONFIG_ADPCM_IMA_DAT4_DECODER 0
+%define CONFIG_ADPCM_IMA_DK3_DECODER 0
+%define CONFIG_ADPCM_IMA_DK4_DECODER 0
+%define CONFIG_ADPCM_IMA_EA_EACS_DECODER 0
+%define CONFIG_ADPCM_IMA_EA_SEAD_DECODER 0
+%define CONFIG_ADPCM_IMA_ISS_DECODER 0
+%define CONFIG_ADPCM_IMA_OKI_DECODER 0
+%define CONFIG_ADPCM_IMA_QT_DECODER 0
+%define CONFIG_ADPCM_IMA_RAD_DECODER 0
+%define CONFIG_ADPCM_IMA_SMJPEG_DECODER 0
+%define CONFIG_ADPCM_IMA_WAV_DECODER 0
+%define CONFIG_ADPCM_IMA_WS_DECODER 0
+%define CONFIG_ADPCM_MS_DECODER 0
+%define CONFIG_ADPCM_MTAF_DECODER 0
+%define CONFIG_ADPCM_PSX_DECODER 0
+%define CONFIG_ADPCM_SBPRO_2_DECODER 0
+%define CONFIG_ADPCM_SBPRO_3_DECODER 0
+%define CONFIG_ADPCM_SBPRO_4_DECODER 0
+%define CONFIG_ADPCM_SWF_DECODER 0
+%define CONFIG_ADPCM_THP_DECODER 0
+%define CONFIG_ADPCM_THP_LE_DECODER 0
+%define CONFIG_ADPCM_VIMA_DECODER 0
+%define CONFIG_ADPCM_XA_DECODER 0
+%define CONFIG_ADPCM_YAMAHA_DECODER 0
+%define CONFIG_SSA_DECODER 0
+%define CONFIG_ASS_DECODER 0
+%define CONFIG_CCAPTION_DECODER 0
+%define CONFIG_DVBSUB_DECODER 0
+%define CONFIG_DVDSUB_DECODER 0
+%define CONFIG_JACOSUB_DECODER 0
+%define CONFIG_MICRODVD_DECODER 0
+%define CONFIG_MOVTEXT_DECODER 0
+%define CONFIG_MPL2_DECODER 0
+%define CONFIG_PGSSUB_DECODER 0
+%define CONFIG_PJS_DECODER 0
+%define CONFIG_REALTEXT_DECODER 0
+%define CONFIG_SAMI_DECODER 0
+%define CONFIG_SRT_DECODER 0
+%define CONFIG_STL_DECODER 0
+%define CONFIG_SUBRIP_DECODER 0
+%define CONFIG_SUBVIEWER_DECODER 0
+%define CONFIG_SUBVIEWER1_DECODER 0
+%define CONFIG_TEXT_DECODER 0
+%define CONFIG_VPLAYER_DECODER 0
+%define CONFIG_WEBVTT_DECODER 0
+%define CONFIG_XSUB_DECODER 0
+%define CONFIG_AAC_AT_DECODER 0
+%define CONFIG_AC3_AT_DECODER 0
+%define CONFIG_ADPCM_IMA_QT_AT_DECODER 0
+%define CONFIG_ALAC_AT_DECODER 0
+%define CONFIG_AMR_NB_AT_DECODER 0
+%define CONFIG_EAC3_AT_DECODER 0
+%define CONFIG_GSM_MS_AT_DECODER 0
+%define CONFIG_ILBC_AT_DECODER 0
+%define CONFIG_MP1_AT_DECODER 0
+%define CONFIG_MP2_AT_DECODER 0
+%define CONFIG_MP3_AT_DECODER 0
+%define CONFIG_PCM_ALAW_AT_DECODER 0
+%define CONFIG_PCM_MULAW_AT_DECODER 0
+%define CONFIG_QDMC_AT_DECODER 0
+%define CONFIG_QDM2_AT_DECODER 0
+%define CONFIG_LIBCELT_DECODER 0
+%define CONFIG_LIBFDK_AAC_DECODER 0
+%define CONFIG_LIBGSM_DECODER 0
+%define CONFIG_LIBGSM_MS_DECODER 0
+%define CONFIG_LIBILBC_DECODER 0
+%define CONFIG_LIBOPENCORE_AMRNB_DECODER 0
+%define CONFIG_LIBOPENCORE_AMRWB_DECODER 0
+%define CONFIG_LIBOPENJPEG_DECODER 0
+%define CONFIG_LIBOPUS_DECODER 0
+%define CONFIG_LIBRSVG_DECODER 0
+%define CONFIG_LIBSPEEX_DECODER 0
+%define CONFIG_LIBVORBIS_DECODER 0
+%define CONFIG_LIBVPX_VP8_DECODER 0
+%define CONFIG_LIBVPX_VP9_DECODER 0
+%define CONFIG_LIBZVBI_TELETEXT_DECODER 0
+%define CONFIG_BINTEXT_DECODER 0
+%define CONFIG_XBIN_DECODER 0
+%define CONFIG_IDF_DECODER 0
+%define CONFIG_LIBOPENH264_DECODER 0
+%define CONFIG_H264_CUVID_DECODER 0
+%define CONFIG_HEVC_CUVID_DECODER 0
+%define CONFIG_HEVC_MEDIACODEC_DECODER 0
+%define CONFIG_MJPEG_CUVID_DECODER 0
+%define CONFIG_MPEG1_CUVID_DECODER 0
+%define CONFIG_MPEG2_CUVID_DECODER 0
+%define CONFIG_MPEG4_CUVID_DECODER 0
+%define CONFIG_MPEG4_MEDIACODEC_DECODER 0
+%define CONFIG_VC1_CUVID_DECODER 0
+%define CONFIG_VP8_CUVID_DECODER 0
+%define CONFIG_VP8_MEDIACODEC_DECODER 0
+%define CONFIG_VP8_QSV_DECODER 0
+%define CONFIG_VP9_CUVID_DECODER 0
+%define CONFIG_VP9_MEDIACODEC_DECODER 0
+%define CONFIG_AA_DEMUXER 0
+%define CONFIG_AAC_DEMUXER 0
+%define CONFIG_AC3_DEMUXER 0
+%define CONFIG_ACM_DEMUXER 0
+%define CONFIG_ACT_DEMUXER 0
+%define CONFIG_ADF_DEMUXER 0
+%define CONFIG_ADP_DEMUXER 0
+%define CONFIG_ADS_DEMUXER 0
+%define CONFIG_ADX_DEMUXER 0
+%define CONFIG_AEA_DEMUXER 0
+%define CONFIG_AFC_DEMUXER 0
+%define CONFIG_AIFF_DEMUXER 0
+%define CONFIG_AIX_DEMUXER 0
+%define CONFIG_AMR_DEMUXER 0
+%define CONFIG_ANM_DEMUXER 0
+%define CONFIG_APC_DEMUXER 0
+%define CONFIG_APE_DEMUXER 0
+%define CONFIG_APNG_DEMUXER 0
+%define CONFIG_AQTITLE_DEMUXER 0
+%define CONFIG_ASF_DEMUXER 0
+%define CONFIG_ASF_O_DEMUXER 0
+%define CONFIG_ASS_DEMUXER 0
+%define CONFIG_AST_DEMUXER 0
+%define CONFIG_AU_DEMUXER 0
+%define CONFIG_AVI_DEMUXER 0
+%define CONFIG_AVISYNTH_DEMUXER 0
+%define CONFIG_AVR_DEMUXER 0
+%define CONFIG_AVS_DEMUXER 0
+%define CONFIG_BETHSOFTVID_DEMUXER 0
+%define CONFIG_BFI_DEMUXER 0
+%define CONFIG_BINTEXT_DEMUXER 0
+%define CONFIG_BINK_DEMUXER 0
+%define CONFIG_BIT_DEMUXER 0
+%define CONFIG_BMV_DEMUXER 0
+%define CONFIG_BFSTM_DEMUXER 0
+%define CONFIG_BRSTM_DEMUXER 0
+%define CONFIG_BOA_DEMUXER 0
+%define CONFIG_C93_DEMUXER 0
+%define CONFIG_CAF_DEMUXER 0
+%define CONFIG_CAVSVIDEO_DEMUXER 0
+%define CONFIG_CDG_DEMUXER 0
+%define CONFIG_CDXL_DEMUXER 0
+%define CONFIG_CINE_DEMUXER 0
+%define CONFIG_CONCAT_DEMUXER 0
+%define CONFIG_DASH_DEMUXER 0
+%define CONFIG_DATA_DEMUXER 0
+%define CONFIG_DAUD_DEMUXER 0
+%define CONFIG_DCSTR_DEMUXER 0
+%define CONFIG_DFA_DEMUXER 0
+%define CONFIG_DIRAC_DEMUXER 0
+%define CONFIG_DNXHD_DEMUXER 0
+%define CONFIG_DSF_DEMUXER 0
+%define CONFIG_DSICIN_DEMUXER 0
+%define CONFIG_DSS_DEMUXER 0
+%define CONFIG_DTS_DEMUXER 0
+%define CONFIG_DTSHD_DEMUXER 0
+%define CONFIG_DV_DEMUXER 0
+%define CONFIG_DVBSUB_DEMUXER 0
+%define CONFIG_DVBTXT_DEMUXER 0
+%define CONFIG_DXA_DEMUXER 0
+%define CONFIG_EA_DEMUXER 0
+%define CONFIG_EA_CDATA_DEMUXER 0
+%define CONFIG_EAC3_DEMUXER 0
+%define CONFIG_EPAF_DEMUXER 0
+%define CONFIG_FFM_DEMUXER 0
+%define CONFIG_FFMETADATA_DEMUXER 0
+%define CONFIG_FILMSTRIP_DEMUXER 0
+%define CONFIG_FITS_DEMUXER 0
+%define CONFIG_FLAC_DEMUXER 0
+%define CONFIG_FLIC_DEMUXER 0
+%define CONFIG_FLV_DEMUXER 0
+%define CONFIG_LIVE_FLV_DEMUXER 0
+%define CONFIG_FOURXM_DEMUXER 0
+%define CONFIG_FRM_DEMUXER 0
+%define CONFIG_FSB_DEMUXER 0
+%define CONFIG_G722_DEMUXER 0
+%define CONFIG_G723_1_DEMUXER 0
+%define CONFIG_G726_DEMUXER 0
+%define CONFIG_G726LE_DEMUXER 0
+%define CONFIG_G729_DEMUXER 0
+%define CONFIG_GDV_DEMUXER 0
+%define CONFIG_GENH_DEMUXER 0
+%define CONFIG_GIF_DEMUXER 0
+%define CONFIG_GSM_DEMUXER 0
+%define CONFIG_GXF_DEMUXER 0
+%define CONFIG_H261_DEMUXER 0
+%define CONFIG_H263_DEMUXER 0
+%define CONFIG_H264_DEMUXER 0
+%define CONFIG_HEVC_DEMUXER 0
+%define CONFIG_HLS_DEMUXER 0
+%define CONFIG_HNM_DEMUXER 0
+%define CONFIG_ICO_DEMUXER 0
+%define CONFIG_IDCIN_DEMUXER 0
+%define CONFIG_IDF_DEMUXER 0
+%define CONFIG_IFF_DEMUXER 0
+%define CONFIG_ILBC_DEMUXER 0
+%define CONFIG_IMAGE2_DEMUXER 0
+%define CONFIG_IMAGE2PIPE_DEMUXER 0
+%define CONFIG_IMAGE2_ALIAS_PIX_DEMUXER 0
+%define CONFIG_IMAGE2_BRENDER_PIX_DEMUXER 0
+%define CONFIG_INGENIENT_DEMUXER 0
+%define CONFIG_IPMOVIE_DEMUXER 0
+%define CONFIG_IRCAM_DEMUXER 0
+%define CONFIG_ISS_DEMUXER 0
+%define CONFIG_IV8_DEMUXER 0
+%define CONFIG_IVF_DEMUXER 0
+%define CONFIG_IVR_DEMUXER 0
+%define CONFIG_JACOSUB_DEMUXER 0
+%define CONFIG_JV_DEMUXER 0
+%define CONFIG_LMLM4_DEMUXER 0
+%define CONFIG_LOAS_DEMUXER 0
+%define CONFIG_LRC_DEMUXER 0
+%define CONFIG_LVF_DEMUXER 0
+%define CONFIG_LXF_DEMUXER 0
+%define CONFIG_M4V_DEMUXER 0
+%define CONFIG_MATROSKA_DEMUXER 0
+%define CONFIG_MGSTS_DEMUXER 0
+%define CONFIG_MICRODVD_DEMUXER 0
+%define CONFIG_MJPEG_DEMUXER 0
+%define CONFIG_MJPEG_2000_DEMUXER 0
+%define CONFIG_MLP_DEMUXER 0
+%define CONFIG_MLV_DEMUXER 0
+%define CONFIG_MM_DEMUXER 0
+%define CONFIG_MMF_DEMUXER 0
+%define CONFIG_MOV_DEMUXER 0
+%define CONFIG_MP3_DEMUXER 0
+%define CONFIG_MPC_DEMUXER 0
+%define CONFIG_MPC8_DEMUXER 0
+%define CONFIG_MPEGPS_DEMUXER 0
+%define CONFIG_MPEGTS_DEMUXER 0
+%define CONFIG_MPEGTSRAW_DEMUXER 0
+%define CONFIG_MPEGVIDEO_DEMUXER 0
+%define CONFIG_MPJPEG_DEMUXER 0
+%define CONFIG_MPL2_DEMUXER 0
+%define CONFIG_MPSUB_DEMUXER 0
+%define CONFIG_MSF_DEMUXER 0
+%define CONFIG_MSNWC_TCP_DEMUXER 0
+%define CONFIG_MTAF_DEMUXER 0
+%define CONFIG_MTV_DEMUXER 0
+%define CONFIG_MUSX_DEMUXER 0
+%define CONFIG_MV_DEMUXER 0
+%define CONFIG_MVI_DEMUXER 0
+%define CONFIG_MXF_DEMUXER 0
+%define CONFIG_MXG_DEMUXER 0
+%define CONFIG_NC_DEMUXER 0
+%define CONFIG_NISTSPHERE_DEMUXER 0
+%define CONFIG_NSV_DEMUXER 0
+%define CONFIG_NUT_DEMUXER 0
+%define CONFIG_NUV_DEMUXER 0
+%define CONFIG_OGG_DEMUXER 0
+%define CONFIG_OMA_DEMUXER 0
+%define CONFIG_PAF_DEMUXER 0
+%define CONFIG_PCM_ALAW_DEMUXER 0
+%define CONFIG_PCM_MULAW_DEMUXER 0
+%define CONFIG_PCM_F64BE_DEMUXER 0
+%define CONFIG_PCM_F64LE_DEMUXER 0
+%define CONFIG_PCM_F32BE_DEMUXER 0
+%define CONFIG_PCM_F32LE_DEMUXER 0
+%define CONFIG_PCM_S32BE_DEMUXER 0
+%define CONFIG_PCM_S32LE_DEMUXER 0
+%define CONFIG_PCM_S24BE_DEMUXER 0
+%define CONFIG_PCM_S24LE_DEMUXER 0
+%define CONFIG_PCM_S16BE_DEMUXER 0
+%define CONFIG_PCM_S16LE_DEMUXER 0
+%define CONFIG_PCM_S8_DEMUXER 0
+%define CONFIG_PCM_U32BE_DEMUXER 0
+%define CONFIG_PCM_U32LE_DEMUXER 0
+%define CONFIG_PCM_U24BE_DEMUXER 0
+%define CONFIG_PCM_U24LE_DEMUXER 0
+%define CONFIG_PCM_U16BE_DEMUXER 0
+%define CONFIG_PCM_U16LE_DEMUXER 0
+%define CONFIG_PCM_U8_DEMUXER 0
+%define CONFIG_PJS_DEMUXER 0
+%define CONFIG_PMP_DEMUXER 0
+%define CONFIG_PVA_DEMUXER 0
+%define CONFIG_PVF_DEMUXER 0
+%define CONFIG_QCP_DEMUXER 0
+%define CONFIG_R3D_DEMUXER 0
+%define CONFIG_RAWVIDEO_DEMUXER 0
+%define CONFIG_REALTEXT_DEMUXER 0
+%define CONFIG_REDSPARK_DEMUXER 0
+%define CONFIG_RL2_DEMUXER 0
+%define CONFIG_RM_DEMUXER 0
+%define CONFIG_ROQ_DEMUXER 0
+%define CONFIG_RPL_DEMUXER 0
+%define CONFIG_RSD_DEMUXER 0
+%define CONFIG_RSO_DEMUXER 0
+%define CONFIG_RTP_DEMUXER 0
+%define CONFIG_RTSP_DEMUXER 0
+%define CONFIG_S337M_DEMUXER 0
+%define CONFIG_SAMI_DEMUXER 0
+%define CONFIG_SAP_DEMUXER 0
+%define CONFIG_SBG_DEMUXER 0
+%define CONFIG_SCC_DEMUXER 0
+%define CONFIG_SDP_DEMUXER 0
+%define CONFIG_SDR2_DEMUXER 0
+%define CONFIG_SDS_DEMUXER 0
+%define CONFIG_SDX_DEMUXER 0
+%define CONFIG_SEGAFILM_DEMUXER 0
+%define CONFIG_SHORTEN_DEMUXER 0
+%define CONFIG_SIFF_DEMUXER 0
+%define CONFIG_SLN_DEMUXER 0
+%define CONFIG_SMACKER_DEMUXER 0
+%define CONFIG_SMJPEG_DEMUXER 0
+%define CONFIG_SMUSH_DEMUXER 0
+%define CONFIG_SOL_DEMUXER 0
+%define CONFIG_SOX_DEMUXER 0
+%define CONFIG_SPDIF_DEMUXER 0
+%define CONFIG_SRT_DEMUXER 0
+%define CONFIG_STR_DEMUXER 0
+%define CONFIG_STL_DEMUXER 0
+%define CONFIG_SUBVIEWER1_DEMUXER 0
+%define CONFIG_SUBVIEWER_DEMUXER 0
+%define CONFIG_SUP_DEMUXER 0
+%define CONFIG_SVAG_DEMUXER 0
+%define CONFIG_SWF_DEMUXER 0
+%define CONFIG_TAK_DEMUXER 0
+%define CONFIG_TEDCAPTIONS_DEMUXER 0
+%define CONFIG_THP_DEMUXER 0
+%define CONFIG_THREEDOSTR_DEMUXER 0
+%define CONFIG_TIERTEXSEQ_DEMUXER 0
+%define CONFIG_TMV_DEMUXER 0
+%define CONFIG_TRUEHD_DEMUXER 0
+%define CONFIG_TTA_DEMUXER 0
+%define CONFIG_TXD_DEMUXER 0
+%define CONFIG_TTY_DEMUXER 0
+%define CONFIG_V210_DEMUXER 0
+%define CONFIG_V210X_DEMUXER 0
+%define CONFIG_VAG_DEMUXER 0
+%define CONFIG_VC1_DEMUXER 0
+%define CONFIG_VC1T_DEMUXER 0
+%define CONFIG_VIVO_DEMUXER 0
+%define CONFIG_VMD_DEMUXER 0
+%define CONFIG_VOBSUB_DEMUXER 0
+%define CONFIG_VOC_DEMUXER 0
+%define CONFIG_VPK_DEMUXER 0
+%define CONFIG_VPLAYER_DEMUXER 0
+%define CONFIG_VQF_DEMUXER 0
+%define CONFIG_W64_DEMUXER 0
+%define CONFIG_WAV_DEMUXER 0
+%define CONFIG_WC3_DEMUXER 0
+%define CONFIG_WEBM_DASH_MANIFEST_DEMUXER 0
+%define CONFIG_WEBVTT_DEMUXER 0
+%define CONFIG_WSAUD_DEMUXER 0
+%define CONFIG_WSD_DEMUXER 0
+%define CONFIG_WSVQA_DEMUXER 0
+%define CONFIG_WTV_DEMUXER 0
+%define CONFIG_WVE_DEMUXER 0
+%define CONFIG_WV_DEMUXER 0
+%define CONFIG_XA_DEMUXER 0
+%define CONFIG_XBIN_DEMUXER 0
+%define CONFIG_XMV_DEMUXER 0
+%define CONFIG_XVAG_DEMUXER 0
+%define CONFIG_XWMA_DEMUXER 0
+%define CONFIG_YOP_DEMUXER 0
+%define CONFIG_YUV4MPEGPIPE_DEMUXER 0
+%define CONFIG_IMAGE_BMP_PIPE_DEMUXER 0
+%define CONFIG_IMAGE_DDS_PIPE_DEMUXER 0
+%define CONFIG_IMAGE_DPX_PIPE_DEMUXER 0
+%define CONFIG_IMAGE_EXR_PIPE_DEMUXER 0
+%define CONFIG_IMAGE_J2K_PIPE_DEMUXER 0
+%define CONFIG_IMAGE_JPEG_PIPE_DEMUXER 0
+%define CONFIG_IMAGE_JPEGLS_PIPE_DEMUXER 0
+%define CONFIG_IMAGE_PAM_PIPE_DEMUXER 0
+%define CONFIG_IMAGE_PBM_PIPE_DEMUXER 0
+%define CONFIG_IMAGE_PCX_PIPE_DEMUXER 0
+%define CONFIG_IMAGE_PGMYUV_PIPE_DEMUXER 0
+%define CONFIG_IMAGE_PGM_PIPE_DEMUXER 0
+%define CONFIG_IMAGE_PICTOR_PIPE_DEMUXER 0
+%define CONFIG_IMAGE_PNG_PIPE_DEMUXER 0
+%define CONFIG_IMAGE_PPM_PIPE_DEMUXER 0
+%define CONFIG_IMAGE_PSD_PIPE_DEMUXER 0
+%define CONFIG_IMAGE_QDRAW_PIPE_DEMUXER 0
+%define CONFIG_IMAGE_SGI_PIPE_DEMUXER 0
+%define CONFIG_IMAGE_SVG_PIPE_DEMUXER 0
+%define CONFIG_IMAGE_SUNRAST_PIPE_DEMUXER 0
+%define CONFIG_IMAGE_TIFF_PIPE_DEMUXER 0
+%define CONFIG_IMAGE_WEBP_PIPE_DEMUXER 0
+%define CONFIG_IMAGE_XPM_PIPE_DEMUXER 0
+%define CONFIG_LIBGME_DEMUXER 0
+%define CONFIG_LIBMODPLUG_DEMUXER 0
+%define CONFIG_LIBOPENMPT_DEMUXER 0
+%define CONFIG_A64MULTI_ENCODER 0
+%define CONFIG_A64MULTI5_ENCODER 0
+%define CONFIG_ALIAS_PIX_ENCODER 0
+%define CONFIG_AMV_ENCODER 0
+%define CONFIG_APNG_ENCODER 0
+%define CONFIG_ASV1_ENCODER 0
+%define CONFIG_ASV2_ENCODER 0
+%define CONFIG_AVRP_ENCODER 0
+%define CONFIG_AVUI_ENCODER 0
+%define CONFIG_AYUV_ENCODER 0
+%define CONFIG_BMP_ENCODER 0
+%define CONFIG_CINEPAK_ENCODER 0
+%define CONFIG_CLJR_ENCODER 0
+%define CONFIG_COMFORTNOISE_ENCODER 0
+%define CONFIG_DNXHD_ENCODER 0
+%define CONFIG_DPX_ENCODER 0
+%define CONFIG_DVVIDEO_ENCODER 0
+%define CONFIG_FFV1_ENCODER 0
+%define CONFIG_FFVHUFF_ENCODER 0
+%define CONFIG_FITS_ENCODER 0
+%define CONFIG_FLASHSV_ENCODER 0
+%define CONFIG_FLASHSV2_ENCODER 0
+%define CONFIG_FLV_ENCODER 0
+%define CONFIG_GIF_ENCODER 0
+%define CONFIG_H261_ENCODER 0
+%define CONFIG_H263_ENCODER 0
+%define CONFIG_H263P_ENCODER 0
+%define CONFIG_HAP_ENCODER 0
+%define CONFIG_HUFFYUV_ENCODER 0
+%define CONFIG_JPEG2000_ENCODER 0
+%define CONFIG_JPEGLS_ENCODER 0
+%define CONFIG_LJPEG_ENCODER 0
+%define CONFIG_MJPEG_ENCODER 0
+%define CONFIG_MPEG1VIDEO_ENCODER 0
+%define CONFIG_MPEG2VIDEO_ENCODER 0
+%define CONFIG_MPEG4_ENCODER 0
+%define CONFIG_MSMPEG4V2_ENCODER 0
+%define CONFIG_MSMPEG4V3_ENCODER 0
+%define CONFIG_MSVIDEO1_ENCODER 0
+%define CONFIG_PAM_ENCODER 0
+%define CONFIG_PBM_ENCODER 0
+%define CONFIG_PCX_ENCODER 0
+%define CONFIG_PGM_ENCODER 0
+%define CONFIG_PGMYUV_ENCODER 0
+%define CONFIG_PNG_ENCODER 0
+%define CONFIG_PPM_ENCODER 0
+%define CONFIG_PRORES_ENCODER 0
+%define CONFIG_PRORES_AW_ENCODER 0
+%define CONFIG_PRORES_KS_ENCODER 0
+%define CONFIG_QTRLE_ENCODER 0
+%define CONFIG_R10K_ENCODER 0
+%define CONFIG_R210_ENCODER 0
+%define CONFIG_RAWVIDEO_ENCODER 0
+%define CONFIG_ROQ_ENCODER 0
+%define CONFIG_RV10_ENCODER 0
+%define CONFIG_RV20_ENCODER 0
+%define CONFIG_S302M_ENCODER 0
+%define CONFIG_SGI_ENCODER 0
+%define CONFIG_SNOW_ENCODER 0
+%define CONFIG_SUNRAST_ENCODER 0
+%define CONFIG_SVQ1_ENCODER 0
+%define CONFIG_TARGA_ENCODER 0
+%define CONFIG_TIFF_ENCODER 0
+%define CONFIG_UTVIDEO_ENCODER 0
+%define CONFIG_V210_ENCODER 0
+%define CONFIG_V308_ENCODER 0
+%define CONFIG_V408_ENCODER 0
+%define CONFIG_V410_ENCODER 0
+%define CONFIG_VC2_ENCODER 0
+%define CONFIG_WRAPPED_AVFRAME_ENCODER 0
+%define CONFIG_WMV1_ENCODER 0
+%define CONFIG_WMV2_ENCODER 0
+%define CONFIG_XBM_ENCODER 0
+%define CONFIG_XFACE_ENCODER 0
+%define CONFIG_XWD_ENCODER 0
+%define CONFIG_Y41P_ENCODER 0
+%define CONFIG_YUV4_ENCODER 0
+%define CONFIG_ZLIB_ENCODER 0
+%define CONFIG_ZMBV_ENCODER 0
+%define CONFIG_AAC_ENCODER 0
+%define CONFIG_AC3_ENCODER 0
+%define CONFIG_AC3_FIXED_ENCODER 0
+%define CONFIG_ALAC_ENCODER 0
+%define CONFIG_DCA_ENCODER 0
+%define CONFIG_EAC3_ENCODER 0
+%define CONFIG_FLAC_ENCODER 0
+%define CONFIG_G723_1_ENCODER 0
+%define CONFIG_MLP_ENCODER 0
+%define CONFIG_MP2_ENCODER 0
+%define CONFIG_MP2FIXED_ENCODER 0
+%define CONFIG_NELLYMOSER_ENCODER 0
+%define CONFIG_OPUS_ENCODER 0
+%define CONFIG_RA_144_ENCODER 0
+%define CONFIG_SONIC_ENCODER 0
+%define CONFIG_SONIC_LS_ENCODER 0
+%define CONFIG_TRUEHD_ENCODER 0
+%define CONFIG_TTA_ENCODER 0
+%define CONFIG_VORBIS_ENCODER 0
+%define CONFIG_WAVPACK_ENCODER 0
+%define CONFIG_WMAV1_ENCODER 0
+%define CONFIG_WMAV2_ENCODER 0
+%define CONFIG_PCM_ALAW_ENCODER 0
+%define CONFIG_PCM_F32BE_ENCODER 0
+%define CONFIG_PCM_F32LE_ENCODER 0
+%define CONFIG_PCM_F64BE_ENCODER 0
+%define CONFIG_PCM_F64LE_ENCODER 0
+%define CONFIG_PCM_MULAW_ENCODER 0
+%define CONFIG_PCM_S8_ENCODER 0
+%define CONFIG_PCM_S8_PLANAR_ENCODER 0
+%define CONFIG_PCM_S16BE_ENCODER 0
+%define CONFIG_PCM_S16BE_PLANAR_ENCODER 0
+%define CONFIG_PCM_S16LE_ENCODER 0
+%define CONFIG_PCM_S16LE_PLANAR_ENCODER 0
+%define CONFIG_PCM_S24BE_ENCODER 0
+%define CONFIG_PCM_S24DAUD_ENCODER 0
+%define CONFIG_PCM_S24LE_ENCODER 0
+%define CONFIG_PCM_S24LE_PLANAR_ENCODER 0
+%define CONFIG_PCM_S32BE_ENCODER 0
+%define CONFIG_PCM_S32LE_ENCODER 0
+%define CONFIG_PCM_S32LE_PLANAR_ENCODER 0
+%define CONFIG_PCM_S64BE_ENCODER 0
+%define CONFIG_PCM_S64LE_ENCODER 0
+%define CONFIG_PCM_U8_ENCODER 0
+%define CONFIG_PCM_U16BE_ENCODER 0
+%define CONFIG_PCM_U16LE_ENCODER 0
+%define CONFIG_PCM_U24BE_ENCODER 0
+%define CONFIG_PCM_U24LE_ENCODER 0
+%define CONFIG_PCM_U32BE_ENCODER 0
+%define CONFIG_PCM_U32LE_ENCODER 0
+%define CONFIG_ROQ_DPCM_ENCODER 0
+%define CONFIG_ADPCM_ADX_ENCODER 0
+%define CONFIG_ADPCM_G722_ENCODER 0
+%define CONFIG_ADPCM_G726_ENCODER 0
+%define CONFIG_ADPCM_G726LE_ENCODER 0
+%define CONFIG_ADPCM_IMA_QT_ENCODER 0
+%define CONFIG_ADPCM_IMA_WAV_ENCODER 0
+%define CONFIG_ADPCM_MS_ENCODER 0
+%define CONFIG_ADPCM_SWF_ENCODER 0
+%define CONFIG_ADPCM_YAMAHA_ENCODER 0
+%define CONFIG_SSA_ENCODER 0
+%define CONFIG_ASS_ENCODER 0
+%define CONFIG_DVBSUB_ENCODER 0
+%define CONFIG_DVDSUB_ENCODER 0
+%define CONFIG_MOVTEXT_ENCODER 0
+%define CONFIG_SRT_ENCODER 0
+%define CONFIG_SUBRIP_ENCODER 0
+%define CONFIG_TEXT_ENCODER 0
+%define CONFIG_WEBVTT_ENCODER 0
+%define CONFIG_XSUB_ENCODER 0
+%define CONFIG_AAC_AT_ENCODER 0
+%define CONFIG_ALAC_AT_ENCODER 0
+%define CONFIG_ILBC_AT_ENCODER 0
+%define CONFIG_PCM_ALAW_AT_ENCODER 0
+%define CONFIG_PCM_MULAW_AT_ENCODER 0
+%define CONFIG_LIBFDK_AAC_ENCODER 0
+%define CONFIG_LIBGSM_ENCODER 0
+%define CONFIG_LIBGSM_MS_ENCODER 0
+%define CONFIG_LIBILBC_ENCODER 0
+%define CONFIG_LIBMP3LAME_ENCODER 0
+%define CONFIG_LIBOPENCORE_AMRNB_ENCODER 0
+%define CONFIG_LIBOPENJPEG_ENCODER 0
+%define CONFIG_LIBOPUS_ENCODER 0
+%define CONFIG_LIBSHINE_ENCODER 0
+%define CONFIG_LIBSPEEX_ENCODER 0
+%define CONFIG_LIBTHEORA_ENCODER 0
+%define CONFIG_LIBTWOLAME_ENCODER 0
+%define CONFIG_LIBVO_AMRWBENC_ENCODER 0
+%define CONFIG_LIBVORBIS_ENCODER 0
+%define CONFIG_LIBVPX_VP8_ENCODER 0
+%define CONFIG_LIBVPX_VP9_ENCODER 0
+%define CONFIG_LIBWAVPACK_ENCODER 0
+%define CONFIG_LIBWEBP_ANIM_ENCODER 0
+%define CONFIG_LIBWEBP_ENCODER 0
+%define CONFIG_LIBX262_ENCODER 0
+%define CONFIG_LIBX264_ENCODER 0
+%define CONFIG_LIBX264RGB_ENCODER 0
+%define CONFIG_LIBX265_ENCODER 0
+%define CONFIG_LIBXAVS_ENCODER 0
+%define CONFIG_LIBXVID_ENCODER 0
+%define CONFIG_H263_V4L2M2M_ENCODER 0
+%define CONFIG_LIBOPENH264_ENCODER 0
+%define CONFIG_H264_NVENC_ENCODER 0
+%define CONFIG_H264_OMX_ENCODER 0
+%define CONFIG_H264_QSV_ENCODER 0
+%define CONFIG_H264_V4L2M2M_ENCODER 0
+%define CONFIG_H264_VAAPI_ENCODER 0
+%define CONFIG_H264_VIDEOTOOLBOX_ENCODER 0
+%define CONFIG_NVENC_ENCODER 0
+%define CONFIG_NVENC_H264_ENCODER 0
+%define CONFIG_NVENC_HEVC_ENCODER 0
+%define CONFIG_HEVC_NVENC_ENCODER 0
+%define CONFIG_HEVC_QSV_ENCODER 0
+%define CONFIG_HEVC_V4L2M2M_ENCODER 0
+%define CONFIG_HEVC_VAAPI_ENCODER 0
+%define CONFIG_LIBKVAZAAR_ENCODER 0
+%define CONFIG_MJPEG_VAAPI_ENCODER 0
+%define CONFIG_MPEG2_QSV_ENCODER 0
+%define CONFIG_MPEG2_VAAPI_ENCODER 0
+%define CONFIG_MPEG4_V4L2M2M_ENCODER 0
+%define CONFIG_VP8_V4L2M2M_ENCODER 0
+%define CONFIG_VP8_VAAPI_ENCODER 0
+%define CONFIG_VP9_VAAPI_ENCODER 0
+%define CONFIG_ABENCH_FILTER 0
+%define CONFIG_ACOMPRESSOR_FILTER 0
+%define CONFIG_ACOPY_FILTER 0
+%define CONFIG_ACROSSFADE_FILTER 0
+%define CONFIG_ACRUSHER_FILTER 0
+%define CONFIG_ADELAY_FILTER 0
+%define CONFIG_AECHO_FILTER 0
+%define CONFIG_AEMPHASIS_FILTER 0
+%define CONFIG_AEVAL_FILTER 0
+%define CONFIG_AFADE_FILTER 0
+%define CONFIG_AFFTFILT_FILTER 0
+%define CONFIG_AFIR_FILTER 0
+%define CONFIG_AFORMAT_FILTER 0
+%define CONFIG_AGATE_FILTER 0
+%define CONFIG_AINTERLEAVE_FILTER 0
+%define CONFIG_ALIMITER_FILTER 0
+%define CONFIG_ALLPASS_FILTER 0
+%define CONFIG_ALOOP_FILTER 0
+%define CONFIG_AMERGE_FILTER 0
+%define CONFIG_AMETADATA_FILTER 0
+%define CONFIG_AMIX_FILTER 0
+%define CONFIG_ANEQUALIZER_FILTER 0
+%define CONFIG_ANULL_FILTER 0
+%define CONFIG_APAD_FILTER 0
+%define CONFIG_APERMS_FILTER 0
+%define CONFIG_APHASER_FILTER 0
+%define CONFIG_APULSATOR_FILTER 0
+%define CONFIG_AREALTIME_FILTER 0
+%define CONFIG_ARESAMPLE_FILTER 0
+%define CONFIG_AREVERSE_FILTER 0
+%define CONFIG_ASELECT_FILTER 0
+%define CONFIG_ASENDCMD_FILTER 0
+%define CONFIG_ASETNSAMPLES_FILTER 0
+%define CONFIG_ASETPTS_FILTER 0
+%define CONFIG_ASETRATE_FILTER 0
+%define CONFIG_ASETTB_FILTER 0
+%define CONFIG_ASHOWINFO_FILTER 0
+%define CONFIG_ASIDEDATA_FILTER 0
+%define CONFIG_ASPLIT_FILTER 0
+%define CONFIG_ASTATS_FILTER 0
+%define CONFIG_ASTREAMSELECT_FILTER 0
+%define CONFIG_ATEMPO_FILTER 0
+%define CONFIG_ATRIM_FILTER 0
+%define CONFIG_AZMQ_FILTER 0
+%define CONFIG_BANDPASS_FILTER 0
+%define CONFIG_BANDREJECT_FILTER 0
+%define CONFIG_BASS_FILTER 0
+%define CONFIG_BIQUAD_FILTER 0
+%define CONFIG_BS2B_FILTER 0
+%define CONFIG_CHANNELMAP_FILTER 0
+%define CONFIG_CHANNELSPLIT_FILTER 0
+%define CONFIG_CHORUS_FILTER 0
+%define CONFIG_COMPAND_FILTER 0
+%define CONFIG_COMPENSATIONDELAY_FILTER 0
+%define CONFIG_CROSSFEED_FILTER 0
+%define CONFIG_CRYSTALIZER_FILTER 0
+%define CONFIG_DCSHIFT_FILTER 0
+%define CONFIG_DYNAUDNORM_FILTER 0
+%define CONFIG_EARWAX_FILTER 0
+%define CONFIG_EBUR128_FILTER 0
+%define CONFIG_EQUALIZER_FILTER 0
+%define CONFIG_EXTRASTEREO_FILTER 0
+%define CONFIG_FIREQUALIZER_FILTER 0
+%define CONFIG_FLANGER_FILTER 0
+%define CONFIG_HAAS_FILTER 0
+%define CONFIG_HDCD_FILTER 0
+%define CONFIG_HEADPHONE_FILTER 0
+%define CONFIG_HIGHPASS_FILTER 0
+%define CONFIG_JOIN_FILTER 0
+%define CONFIG_LADSPA_FILTER 0
+%define CONFIG_LOUDNORM_FILTER 0
+%define CONFIG_LOWPASS_FILTER 0
+%define CONFIG_PAN_FILTER 0
+%define CONFIG_REPLAYGAIN_FILTER 0
+%define CONFIG_RESAMPLE_FILTER 0
+%define CONFIG_RUBBERBAND_FILTER 0
+%define CONFIG_SIDECHAINCOMPRESS_FILTER 0
+%define CONFIG_SIDECHAINGATE_FILTER 0
+%define CONFIG_SILENCEDETECT_FILTER 0
+%define CONFIG_SILENCEREMOVE_FILTER 0
+%define CONFIG_SOFALIZER_FILTER 0
+%define CONFIG_STEREOTOOLS_FILTER 0
+%define CONFIG_STEREOWIDEN_FILTER 0
+%define CONFIG_SUPEREQUALIZER_FILTER 0
+%define CONFIG_SURROUND_FILTER 0
+%define CONFIG_TREBLE_FILTER 0
+%define CONFIG_TREMOLO_FILTER 0
+%define CONFIG_VIBRATO_FILTER 0
+%define CONFIG_VOLUME_FILTER 0
+%define CONFIG_VOLUMEDETECT_FILTER 0
+%define CONFIG_AEVALSRC_FILTER 0
+%define CONFIG_ANOISESRC_FILTER 0
+%define CONFIG_ANULLSRC_FILTER 0
+%define CONFIG_FLITE_FILTER 0
+%define CONFIG_SINE_FILTER 0
+%define CONFIG_ANULLSINK_FILTER 0
+%define CONFIG_ALPHAEXTRACT_FILTER 0
+%define CONFIG_ALPHAMERGE_FILTER 0
+%define CONFIG_ASS_FILTER 0
+%define CONFIG_ATADENOISE_FILTER 0
+%define CONFIG_AVGBLUR_FILTER 0
+%define CONFIG_BBOX_FILTER 0
+%define CONFIG_BENCH_FILTER 0
+%define CONFIG_BITPLANENOISE_FILTER 0
+%define CONFIG_BLACKDETECT_FILTER 0
+%define CONFIG_BLACKFRAME_FILTER 0
+%define CONFIG_BLEND_FILTER 0
+%define CONFIG_BOXBLUR_FILTER 0
+%define CONFIG_BWDIF_FILTER 0
+%define CONFIG_CHROMAKEY_FILTER 0
+%define CONFIG_CIESCOPE_FILTER 0
+%define CONFIG_CODECVIEW_FILTER 0
+%define CONFIG_COLORBALANCE_FILTER 0
+%define CONFIG_COLORCHANNELMIXER_FILTER 0
+%define CONFIG_COLORKEY_FILTER 0
+%define CONFIG_COLORLEVELS_FILTER 0
+%define CONFIG_COLORMATRIX_FILTER 0
+%define CONFIG_COLORSPACE_FILTER 0
+%define CONFIG_CONVOLUTION_FILTER 0
+%define CONFIG_CONVOLVE_FILTER 0
+%define CONFIG_COPY_FILTER 0
+%define CONFIG_COREIMAGE_FILTER 0
+%define CONFIG_COVER_RECT_FILTER 0
+%define CONFIG_CROP_FILTER 0
+%define CONFIG_CROPDETECT_FILTER 0
+%define CONFIG_CURVES_FILTER 0
+%define CONFIG_DATASCOPE_FILTER 0
+%define CONFIG_DCTDNOIZ_FILTER 0
+%define CONFIG_DEBAND_FILTER 0
+%define CONFIG_DECIMATE_FILTER 0
+%define CONFIG_DEFLATE_FILTER 0
+%define CONFIG_DEFLICKER_FILTER 0
+%define CONFIG_DEINTERLACE_QSV_FILTER 0
+%define CONFIG_DEINTERLACE_VAAPI_FILTER 0
+%define CONFIG_DEJUDDER_FILTER 0
+%define CONFIG_DELOGO_FILTER 0
+%define CONFIG_DESHAKE_FILTER 0
+%define CONFIG_DESPILL_FILTER 0
+%define CONFIG_DETELECINE_FILTER 0
+%define CONFIG_DILATION_FILTER 0
+%define CONFIG_DISPLACE_FILTER 0
+%define CONFIG_DOUBLEWEAVE_FILTER 0
+%define CONFIG_DRAWBOX_FILTER 0
+%define CONFIG_DRAWGRAPH_FILTER 0
+%define CONFIG_DRAWGRID_FILTER 0
+%define CONFIG_DRAWTEXT_FILTER 0
+%define CONFIG_EDGEDETECT_FILTER 0
+%define CONFIG_ELBG_FILTER 0
+%define CONFIG_EQ_FILTER 0
+%define CONFIG_EROSION_FILTER 0
+%define CONFIG_EXTRACTPLANES_FILTER 0
+%define CONFIG_FADE_FILTER 0
+%define CONFIG_FFTFILT_FILTER 0
+%define CONFIG_FIELD_FILTER 0
+%define CONFIG_FIELDHINT_FILTER 0
+%define CONFIG_FIELDMATCH_FILTER 0
+%define CONFIG_FIELDORDER_FILTER 0
+%define CONFIG_FIND_RECT_FILTER 0
+%define CONFIG_FLOODFILL_FILTER 0
+%define CONFIG_FORMAT_FILTER 0
+%define CONFIG_FPS_FILTER 0
+%define CONFIG_FRAMEPACK_FILTER 0
+%define CONFIG_FRAMERATE_FILTER 0
+%define CONFIG_FRAMESTEP_FILTER 0
+%define CONFIG_FREI0R_FILTER 0
+%define CONFIG_FSPP_FILTER 0
+%define CONFIG_GBLUR_FILTER 0
+%define CONFIG_GEQ_FILTER 0
+%define CONFIG_GRADFUN_FILTER 0
+%define CONFIG_HALDCLUT_FILTER 0
+%define CONFIG_HFLIP_FILTER 0
+%define CONFIG_HISTEQ_FILTER 0
+%define CONFIG_HISTOGRAM_FILTER 0
+%define CONFIG_HQDN3D_FILTER 0
+%define CONFIG_HQX_FILTER 0
+%define CONFIG_HSTACK_FILTER 0
+%define CONFIG_HUE_FILTER 0
+%define CONFIG_HWDOWNLOAD_FILTER 0
+%define CONFIG_HWMAP_FILTER 0
+%define CONFIG_HWUPLOAD_FILTER 0
+%define CONFIG_HWUPLOAD_CUDA_FILTER 0
+%define CONFIG_HYSTERESIS_FILTER 0
+%define CONFIG_IDET_FILTER 0
+%define CONFIG_IL_FILTER 0
+%define CONFIG_INFLATE_FILTER 0
+%define CONFIG_INTERLACE_FILTER 0
+%define CONFIG_INTERLEAVE_FILTER 0
+%define CONFIG_KERNDEINT_FILTER 0
+%define CONFIG_LENSCORRECTION_FILTER 0
+%define CONFIG_LIBVMAF_FILTER 0
+%define CONFIG_LIMITER_FILTER 0
+%define CONFIG_LOOP_FILTER 0
+%define CONFIG_LUMAKEY_FILTER 0
+%define CONFIG_LUT_FILTER 0
+%define CONFIG_LUT2_FILTER 0
+%define CONFIG_LUT3D_FILTER 0
+%define CONFIG_LUTRGB_FILTER 0
+%define CONFIG_LUTYUV_FILTER 0
+%define CONFIG_MASKEDCLAMP_FILTER 0
+%define CONFIG_MASKEDMERGE_FILTER 0
+%define CONFIG_MCDEINT_FILTER 0
+%define CONFIG_MERGEPLANES_FILTER 0
+%define CONFIG_MESTIMATE_FILTER 0
+%define CONFIG_METADATA_FILTER 0
+%define CONFIG_MIDEQUALIZER_FILTER 0
+%define CONFIG_MINTERPOLATE_FILTER 0
+%define CONFIG_MPDECIMATE_FILTER 0
+%define CONFIG_NEGATE_FILTER 0
+%define CONFIG_NLMEANS_FILTER 0
+%define CONFIG_NNEDI_FILTER 0
+%define CONFIG_NOFORMAT_FILTER 0
+%define CONFIG_NOISE_FILTER 0
+%define CONFIG_NULL_FILTER 0
+%define CONFIG_OCR_FILTER 0
+%define CONFIG_OCV_FILTER 0
+%define CONFIG_OSCILLOSCOPE_FILTER 0
+%define CONFIG_OVERLAY_FILTER 0
+%define CONFIG_OWDENOISE_FILTER 0
+%define CONFIG_PAD_FILTER 0
+%define CONFIG_PALETTEGEN_FILTER 0
+%define CONFIG_PALETTEUSE_FILTER 0
+%define CONFIG_PERMS_FILTER 0
+%define CONFIG_PERSPECTIVE_FILTER 0
+%define CONFIG_PHASE_FILTER 0
+%define CONFIG_PIXDESCTEST_FILTER 0
+%define CONFIG_PIXSCOPE_FILTER 0
+%define CONFIG_PP_FILTER 0
+%define CONFIG_PP7_FILTER 0
+%define CONFIG_PREMULTIPLY_FILTER 0
+%define CONFIG_PREWITT_FILTER 0
+%define CONFIG_PSEUDOCOLOR_FILTER 0
+%define CONFIG_PSNR_FILTER 0
+%define CONFIG_PULLUP_FILTER 0
+%define CONFIG_QP_FILTER 0
+%define CONFIG_RANDOM_FILTER 0
+%define CONFIG_READEIA608_FILTER 0
+%define CONFIG_READVITC_FILTER 0
+%define CONFIG_REALTIME_FILTER 0
+%define CONFIG_REMAP_FILTER 0
+%define CONFIG_REMOVEGRAIN_FILTER 0
+%define CONFIG_REMOVELOGO_FILTER 0
+%define CONFIG_REPEATFIELDS_FILTER 0
+%define CONFIG_REVERSE_FILTER 0
+%define CONFIG_ROBERTS_FILTER 0
+%define CONFIG_ROTATE_FILTER 0
+%define CONFIG_SAB_FILTER 0
+%define CONFIG_SCALE_FILTER 0
+%define CONFIG_SCALE_CUDA_FILTER 0
+%define CONFIG_SCALE_NPP_FILTER 0
+%define CONFIG_SCALE_QSV_FILTER 0
+%define CONFIG_SCALE_VAAPI_FILTER 0
+%define CONFIG_SCALE2REF_FILTER 0
+%define CONFIG_SELECT_FILTER 0
+%define CONFIG_SELECTIVECOLOR_FILTER 0
+%define CONFIG_SENDCMD_FILTER 0
+%define CONFIG_SEPARATEFIELDS_FILTER 0
+%define CONFIG_SETDAR_FILTER 0
+%define CONFIG_SETFIELD_FILTER 0
+%define CONFIG_SETPTS_FILTER 0
+%define CONFIG_SETSAR_FILTER 0
+%define CONFIG_SETTB_FILTER 0
+%define CONFIG_SHOWINFO_FILTER 0
+%define CONFIG_SHOWPALETTE_FILTER 0
+%define CONFIG_SHUFFLEFRAMES_FILTER 0
+%define CONFIG_SHUFFLEPLANES_FILTER 0
+%define CONFIG_SIDEDATA_FILTER 0
+%define CONFIG_SIGNALSTATS_FILTER 0
+%define CONFIG_SIGNATURE_FILTER 0
+%define CONFIG_SMARTBLUR_FILTER 0
+%define CONFIG_SOBEL_FILTER 0
+%define CONFIG_SPLIT_FILTER 0
+%define CONFIG_SPP_FILTER 0
+%define CONFIG_SSIM_FILTER 0
+%define CONFIG_STEREO3D_FILTER 0
+%define CONFIG_STREAMSELECT_FILTER 0
+%define CONFIG_SUBTITLES_FILTER 0
+%define CONFIG_SUPER2XSAI_FILTER 0
+%define CONFIG_SWAPRECT_FILTER 0
+%define CONFIG_SWAPUV_FILTER 0
+%define CONFIG_TBLEND_FILTER 0
+%define CONFIG_TELECINE_FILTER 0
+%define CONFIG_THRESHOLD_FILTER 0
+%define CONFIG_THUMBNAIL_FILTER 0
+%define CONFIG_THUMBNAIL_CUDA_FILTER 0
+%define CONFIG_TILE_FILTER 0
+%define CONFIG_TINTERLACE_FILTER 0
+%define CONFIG_TLUT2_FILTER 0
+%define CONFIG_TONEMAP_FILTER 0
+%define CONFIG_TRANSPOSE_FILTER 0
+%define CONFIG_TRIM_FILTER 0
+%define CONFIG_UNPREMULTIPLY_FILTER 0
+%define CONFIG_UNSHARP_FILTER 0
+%define CONFIG_USPP_FILTER 0
+%define CONFIG_VAGUEDENOISER_FILTER 0
+%define CONFIG_VECTORSCOPE_FILTER 0
+%define CONFIG_VFLIP_FILTER 0
+%define CONFIG_VIDSTABDETECT_FILTER 0
+%define CONFIG_VIDSTABTRANSFORM_FILTER 0
+%define CONFIG_VIGNETTE_FILTER 0
+%define CONFIG_VMAFMOTION_FILTER 0
+%define CONFIG_VSTACK_FILTER 0
+%define CONFIG_W3FDIF_FILTER 0
+%define CONFIG_WAVEFORM_FILTER 0
+%define CONFIG_WEAVE_FILTER 0
+%define CONFIG_XBR_FILTER 0
+%define CONFIG_YADIF_FILTER 0
+%define CONFIG_ZMQ_FILTER 0
+%define CONFIG_ZOOMPAN_FILTER 0
+%define CONFIG_ZSCALE_FILTER 0
+%define CONFIG_ALLRGB_FILTER 0
+%define CONFIG_ALLYUV_FILTER 0
+%define CONFIG_CELLAUTO_FILTER 0
+%define CONFIG_COLOR_FILTER 0
+%define CONFIG_COREIMAGESRC_FILTER 0
+%define CONFIG_FREI0R_SRC_FILTER 0
+%define CONFIG_HALDCLUTSRC_FILTER 0
+%define CONFIG_LIFE_FILTER 0
+%define CONFIG_MANDELBROT_FILTER 0
+%define CONFIG_MPTESTSRC_FILTER 0
+%define CONFIG_NULLSRC_FILTER 0
+%define CONFIG_RGBTESTSRC_FILTER 0
+%define CONFIG_SMPTEBARS_FILTER 0
+%define CONFIG_SMPTEHDBARS_FILTER 0
+%define CONFIG_TESTSRC_FILTER 0
+%define CONFIG_TESTSRC2_FILTER 0
+%define CONFIG_YUVTESTSRC_FILTER 0
+%define CONFIG_NULLSINK_FILTER 0
+%define CONFIG_ABITSCOPE_FILTER 0
+%define CONFIG_ADRAWGRAPH_FILTER 0
+%define CONFIG_AHISTOGRAM_FILTER 0
+%define CONFIG_APHASEMETER_FILTER 0
+%define CONFIG_AVECTORSCOPE_FILTER 0
+%define CONFIG_CONCAT_FILTER 0
+%define CONFIG_SHOWCQT_FILTER 0
+%define CONFIG_SHOWFREQS_FILTER 0
+%define CONFIG_SHOWSPECTRUM_FILTER 0
+%define CONFIG_SHOWSPECTRUMPIC_FILTER 0
+%define CONFIG_SHOWVOLUME_FILTER 0
+%define CONFIG_SHOWWAVES_FILTER 0
+%define CONFIG_SHOWWAVESPIC_FILTER 0
+%define CONFIG_SPECTRUMSYNTH_FILTER 0
+%define CONFIG_AMOVIE_FILTER 0
+%define CONFIG_MOVIE_FILTER 0
+%define CONFIG_H263_VAAPI_HWACCEL 0
+%define CONFIG_H263_VIDEOTOOLBOX_HWACCEL 0
+%define CONFIG_H264_CUVID_HWACCEL 0
+%define CONFIG_H264_D3D11VA_HWACCEL 0
+%define CONFIG_H264_D3D11VA2_HWACCEL 0
+%define CONFIG_H264_DXVA2_HWACCEL 0
+%define CONFIG_H264_MEDIACODEC_HWACCEL 0
+%define CONFIG_H264_MMAL_HWACCEL 0
+%define CONFIG_H264_QSV_HWACCEL 0
+%define CONFIG_H264_VAAPI_HWACCEL 0
+%define CONFIG_H264_VDA_HWACCEL 0
+%define CONFIG_H264_VDA_OLD_HWACCEL 0
+%define CONFIG_H264_VDPAU_HWACCEL 0
+%define CONFIG_H264_VIDEOTOOLBOX_HWACCEL 0
+%define CONFIG_HEVC_CUVID_HWACCEL 0
+%define CONFIG_HEVC_D3D11VA_HWACCEL 0
+%define CONFIG_HEVC_D3D11VA2_HWACCEL 0
+%define CONFIG_HEVC_DXVA2_HWACCEL 0
+%define CONFIG_HEVC_MEDIACODEC_HWACCEL 0
+%define CONFIG_HEVC_QSV_HWACCEL 0
+%define CONFIG_HEVC_VAAPI_HWACCEL 0
+%define CONFIG_HEVC_VDPAU_HWACCEL 0
+%define CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL 0
+%define CONFIG_MJPEG_CUVID_HWACCEL 0
+%define CONFIG_MPEG1_CUVID_HWACCEL 0
+%define CONFIG_MPEG1_XVMC_HWACCEL 0
+%define CONFIG_MPEG1_VDPAU_HWACCEL 0
+%define CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL 0
+%define CONFIG_MPEG2_CUVID_HWACCEL 0
+%define CONFIG_MPEG2_XVMC_HWACCEL 0
+%define CONFIG_MPEG2_D3D11VA_HWACCEL 0
+%define CONFIG_MPEG2_D3D11VA2_HWACCEL 0
+%define CONFIG_MPEG2_DXVA2_HWACCEL 0
+%define CONFIG_MPEG2_MMAL_HWACCEL 0
+%define CONFIG_MPEG2_QSV_HWACCEL 0
+%define CONFIG_MPEG2_VAAPI_HWACCEL 0
+%define CONFIG_MPEG2_VDPAU_HWACCEL 0
+%define CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL 0
+%define CONFIG_MPEG2_MEDIACODEC_HWACCEL 0
+%define CONFIG_MPEG4_CUVID_HWACCEL 0
+%define CONFIG_MPEG4_MEDIACODEC_HWACCEL 0
+%define CONFIG_MPEG4_MMAL_HWACCEL 0
+%define CONFIG_MPEG4_VAAPI_HWACCEL 0
+%define CONFIG_MPEG4_VDPAU_HWACCEL 0
+%define CONFIG_MPEG4_VIDEOTOOLBOX_HWACCEL 0
+%define CONFIG_VC1_CUVID_HWACCEL 0
+%define CONFIG_VC1_D3D11VA_HWACCEL 0
+%define CONFIG_VC1_D3D11VA2_HWACCEL 0
+%define CONFIG_VC1_DXVA2_HWACCEL 0
+%define CONFIG_VC1_VAAPI_HWACCEL 0
+%define CONFIG_VC1_VDPAU_HWACCEL 0
+%define CONFIG_VC1_MMAL_HWACCEL 0
+%define CONFIG_VC1_QSV_HWACCEL 0
+%define CONFIG_VP8_CUVID_HWACCEL 0
+%define CONFIG_VP8_MEDIACODEC_HWACCEL 0
+%define CONFIG_VP8_QSV_HWACCEL 0
+%define CONFIG_VP9_CUVID_HWACCEL 0
+%define CONFIG_VP9_D3D11VA_HWACCEL 0
+%define CONFIG_VP9_D3D11VA2_HWACCEL 0
+%define CONFIG_VP9_DXVA2_HWACCEL 0
+%define CONFIG_VP9_MEDIACODEC_HWACCEL 0
+%define CONFIG_VP9_VAAPI_HWACCEL 0
+%define CONFIG_WMV3_D3D11VA_HWACCEL 0
+%define CONFIG_WMV3_D3D11VA2_HWACCEL 0
+%define CONFIG_WMV3_DXVA2_HWACCEL 0
+%define CONFIG_WMV3_VAAPI_HWACCEL 0
+%define CONFIG_WMV3_VDPAU_HWACCEL 0
+%define CONFIG_ALSA_INDEV 0
+%define CONFIG_AVFOUNDATION_INDEV 0
+%define CONFIG_BKTR_INDEV 0
+%define CONFIG_DECKLINK_INDEV 0
+%define CONFIG_LIBNDI_NEWTEK_INDEV 0
+%define CONFIG_DSHOW_INDEV 0
+%define CONFIG_FBDEV_INDEV 0
+%define CONFIG_GDIGRAB_INDEV 0
+%define CONFIG_IEC61883_INDEV 0
+%define CONFIG_JACK_INDEV 0
+%define CONFIG_KMSGRAB_INDEV 0
+%define CONFIG_LAVFI_INDEV 0
+%define CONFIG_OPENAL_INDEV 0
+%define CONFIG_OSS_INDEV 0
+%define CONFIG_PULSE_INDEV 0
+%define CONFIG_SNDIO_INDEV 0
+%define CONFIG_V4L2_INDEV 0
+%define CONFIG_VFWCAP_INDEV 0
+%define CONFIG_XCBGRAB_INDEV 0
+%define CONFIG_LIBCDIO_INDEV 0
+%define CONFIG_LIBDC1394_INDEV 0
+%define CONFIG_A64_MUXER 0
+%define CONFIG_AC3_MUXER 0
+%define CONFIG_ADTS_MUXER 0
+%define CONFIG_ADX_MUXER 0
+%define CONFIG_AIFF_MUXER 0
+%define CONFIG_AMR_MUXER 0
+%define CONFIG_APNG_MUXER 0
+%define CONFIG_ASF_MUXER 0
+%define CONFIG_ASS_MUXER 0
+%define CONFIG_AST_MUXER 0
+%define CONFIG_ASF_STREAM_MUXER 0
+%define CONFIG_AU_MUXER 0
+%define CONFIG_AVI_MUXER 0
+%define CONFIG_AVM2_MUXER 0
+%define CONFIG_BIT_MUXER 0
+%define CONFIG_CAF_MUXER 0
+%define CONFIG_CAVSVIDEO_MUXER 0
+%define CONFIG_CRC_MUXER 0
+%define CONFIG_DASH_MUXER 0
+%define CONFIG_DATA_MUXER 0
+%define CONFIG_DAUD_MUXER 0
+%define CONFIG_DIRAC_MUXER 0
+%define CONFIG_DNXHD_MUXER 0
+%define CONFIG_DTS_MUXER 0
+%define CONFIG_DV_MUXER 0
+%define CONFIG_EAC3_MUXER 0
+%define CONFIG_F4V_MUXER 0
+%define CONFIG_FFM_MUXER 0
+%define CONFIG_FFMETADATA_MUXER 0
+%define CONFIG_FIFO_MUXER 0
+%define CONFIG_FILMSTRIP_MUXER 0
+%define CONFIG_FITS_MUXER 0
+%define CONFIG_FLAC_MUXER 0
+%define CONFIG_FLV_MUXER 0
+%define CONFIG_FRAMECRC_MUXER 0
+%define CONFIG_FRAMEHASH_MUXER 0
+%define CONFIG_FRAMEMD5_MUXER 0
+%define CONFIG_G722_MUXER 0
+%define CONFIG_G723_1_MUXER 0
+%define CONFIG_G726_MUXER 0
+%define CONFIG_G726LE_MUXER 0
+%define CONFIG_GIF_MUXER 0
+%define CONFIG_GSM_MUXER 0
+%define CONFIG_GXF_MUXER 0
+%define CONFIG_H261_MUXER 0
+%define CONFIG_H263_MUXER 0
+%define CONFIG_H264_MUXER 0
+%define CONFIG_HASH_MUXER 0
+%define CONFIG_HDS_MUXER 0
+%define CONFIG_HEVC_MUXER 0
+%define CONFIG_HLS_MUXER 0
+%define CONFIG_ICO_MUXER 0
+%define CONFIG_ILBC_MUXER 0
+%define CONFIG_IMAGE2_MUXER 0
+%define CONFIG_IMAGE2PIPE_MUXER 0
+%define CONFIG_IPOD_MUXER 0
+%define CONFIG_IRCAM_MUXER 0
+%define CONFIG_ISMV_MUXER 0
+%define CONFIG_IVF_MUXER 0
+%define CONFIG_JACOSUB_MUXER 0
+%define CONFIG_LATM_MUXER 0
+%define CONFIG_LRC_MUXER 0
+%define CONFIG_M4V_MUXER 0
+%define CONFIG_MD5_MUXER 0
+%define CONFIG_MATROSKA_MUXER 0
+%define CONFIG_MATROSKA_AUDIO_MUXER 0
+%define CONFIG_MICRODVD_MUXER 0
+%define CONFIG_MJPEG_MUXER 0
+%define CONFIG_MLP_MUXER 0
+%define CONFIG_MMF_MUXER 0
+%define CONFIG_MOV_MUXER 0
+%define CONFIG_MP2_MUXER 0
+%define CONFIG_MP3_MUXER 0
+%define CONFIG_MP4_MUXER 0
+%define CONFIG_MPEG1SYSTEM_MUXER 0
+%define CONFIG_MPEG1VCD_MUXER 0
+%define CONFIG_MPEG1VIDEO_MUXER 0
+%define CONFIG_MPEG2DVD_MUXER 0
+%define CONFIG_MPEG2SVCD_MUXER 0
+%define CONFIG_MPEG2VIDEO_MUXER 0
+%define CONFIG_MPEG2VOB_MUXER 0
+%define CONFIG_MPEGTS_MUXER 0
+%define CONFIG_MPJPEG_MUXER 0
+%define CONFIG_MXF_MUXER 0
+%define CONFIG_MXF_D10_MUXER 0
+%define CONFIG_MXF_OPATOM_MUXER 0
+%define CONFIG_NULL_MUXER 0
+%define CONFIG_NUT_MUXER 0
+%define CONFIG_OGA_MUXER 0
+%define CONFIG_OGG_MUXER 0
+%define CONFIG_OGV_MUXER 0
+%define CONFIG_OMA_MUXER 0
+%define CONFIG_OPUS_MUXER 0
+%define CONFIG_PCM_ALAW_MUXER 0
+%define CONFIG_PCM_MULAW_MUXER 0
+%define CONFIG_PCM_F64BE_MUXER 0
+%define CONFIG_PCM_F64LE_MUXER 0
+%define CONFIG_PCM_F32BE_MUXER 0
+%define CONFIG_PCM_F32LE_MUXER 0
+%define CONFIG_PCM_S32BE_MUXER 0
+%define CONFIG_PCM_S32LE_MUXER 0
+%define CONFIG_PCM_S24BE_MUXER 0
+%define CONFIG_PCM_S24LE_MUXER 0
+%define CONFIG_PCM_S16BE_MUXER 0
+%define CONFIG_PCM_S16LE_MUXER 0
+%define CONFIG_PCM_S8_MUXER 0
+%define CONFIG_PCM_U32BE_MUXER 0
+%define CONFIG_PCM_U32LE_MUXER 0
+%define CONFIG_PCM_U24BE_MUXER 0
+%define CONFIG_PCM_U24LE_MUXER 0
+%define CONFIG_PCM_U16BE_MUXER 0
+%define CONFIG_PCM_U16LE_MUXER 0
+%define CONFIG_PCM_U8_MUXER 0
+%define CONFIG_PSP_MUXER 0
+%define CONFIG_RAWVIDEO_MUXER 0
+%define CONFIG_RM_MUXER 0
+%define CONFIG_ROQ_MUXER 0
+%define CONFIG_RSO_MUXER 0
+%define CONFIG_RTP_MUXER 0
+%define CONFIG_RTP_MPEGTS_MUXER 0
+%define CONFIG_RTSP_MUXER 0
+%define CONFIG_SAP_MUXER 0
+%define CONFIG_SCC_MUXER 0
+%define CONFIG_SEGMENT_MUXER 0
+%define CONFIG_STREAM_SEGMENT_MUXER 0
+%define CONFIG_SINGLEJPEG_MUXER 0
+%define CONFIG_SMJPEG_MUXER 0
+%define CONFIG_SMOOTHSTREAMING_MUXER 0
+%define CONFIG_SOX_MUXER 0
+%define CONFIG_SPX_MUXER 0
+%define CONFIG_SPDIF_MUXER 0
+%define CONFIG_SRT_MUXER 0
+%define CONFIG_SUP_MUXER 0
+%define CONFIG_SWF_MUXER 0
+%define CONFIG_TEE_MUXER 0
+%define CONFIG_TG2_MUXER 0
+%define CONFIG_TGP_MUXER 0
+%define CONFIG_MKVTIMESTAMP_V2_MUXER 0
+%define CONFIG_TRUEHD_MUXER 0
+%define CONFIG_TTA_MUXER 0
+%define CONFIG_UNCODEDFRAMECRC_MUXER 0
+%define CONFIG_VC1_MUXER 0
+%define CONFIG_VC1T_MUXER 0
+%define CONFIG_VOC_MUXER 0
+%define CONFIG_W64_MUXER 0
+%define CONFIG_WAV_MUXER 0
+%define CONFIG_WEBM_MUXER 0
+%define CONFIG_WEBM_DASH_MANIFEST_MUXER 0
+%define CONFIG_WEBM_CHUNK_MUXER 0
+%define CONFIG_WEBP_MUXER 0
+%define CONFIG_WEBVTT_MUXER 0
+%define CONFIG_WTV_MUXER 0
+%define CONFIG_WV_MUXER 0
+%define CONFIG_YUV4MPEGPIPE_MUXER 0
+%define CONFIG_CHROMAPRINT_MUXER 0
+%define CONFIG_ALSA_OUTDEV 0
+%define CONFIG_CACA_OUTDEV 0
+%define CONFIG_DECKLINK_OUTDEV 0
+%define CONFIG_LIBNDI_NEWTEK_OUTDEV 0
+%define CONFIG_FBDEV_OUTDEV 0
+%define CONFIG_OPENGL_OUTDEV 0
+%define CONFIG_OSS_OUTDEV 0
+%define CONFIG_PULSE_OUTDEV 0
+%define CONFIG_SDL2_OUTDEV 0
+%define CONFIG_SNDIO_OUTDEV 0
+%define CONFIG_V4L2_OUTDEV 0
+%define CONFIG_XV_OUTDEV 0
+%define CONFIG_AAC_PARSER 0
+%define CONFIG_AAC_LATM_PARSER 0
+%define CONFIG_AC3_PARSER 0
+%define CONFIG_ADX_PARSER 0
+%define CONFIG_BMP_PARSER 0
+%define CONFIG_CAVSVIDEO_PARSER 0
+%define CONFIG_COOK_PARSER 0
+%define CONFIG_DCA_PARSER 0
+%define CONFIG_DIRAC_PARSER 0
+%define CONFIG_DNXHD_PARSER 0
+%define CONFIG_DPX_PARSER 0
+%define CONFIG_DVAUDIO_PARSER 0
+%define CONFIG_DVBSUB_PARSER 0
+%define CONFIG_DVDSUB_PARSER 0
+%define CONFIG_DVD_NAV_PARSER 0
+%define CONFIG_G729_PARSER 0
+%define CONFIG_GSM_PARSER 0
+%define CONFIG_H261_PARSER 0
+%define CONFIG_H263_PARSER 0
+%define CONFIG_H264_PARSER 0
+%define CONFIG_HEVC_PARSER 0
+%define CONFIG_MJPEG_PARSER 0
+%define CONFIG_MLP_PARSER 0
+%define CONFIG_MPEG4VIDEO_PARSER 0
+%define CONFIG_MPEGAUDIO_PARSER 0
+%define CONFIG_MPEGVIDEO_PARSER 0
+%define CONFIG_OPUS_PARSER 0
+%define CONFIG_PNG_PARSER 0
+%define CONFIG_PNM_PARSER 0
+%define CONFIG_RV30_PARSER 0
+%define CONFIG_RV40_PARSER 0
+%define CONFIG_SIPR_PARSER 0
+%define CONFIG_TAK_PARSER 0
+%define CONFIG_VC1_PARSER 0
+%define CONFIG_VORBIS_PARSER 0
+%define CONFIG_VP3_PARSER 0
+%define CONFIG_XMA_PARSER 0
+%define CONFIG_ASYNC_PROTOCOL 0
+%define CONFIG_BLURAY_PROTOCOL 0
+%define CONFIG_CACHE_PROTOCOL 0
+%define CONFIG_CONCAT_PROTOCOL 0
+%define CONFIG_CRYPTO_PROTOCOL 0
+%define CONFIG_DATA_PROTOCOL 0
+%define CONFIG_FFRTMPCRYPT_PROTOCOL 0
+%define CONFIG_FFRTMPHTTP_PROTOCOL 0
+%define CONFIG_FILE_PROTOCOL 0
+%define CONFIG_FTP_PROTOCOL 0
+%define CONFIG_GOPHER_PROTOCOL 0
+%define CONFIG_HLS_PROTOCOL 0
+%define CONFIG_HTTP_PROTOCOL 0
+%define CONFIG_HTTPPROXY_PROTOCOL 0
+%define CONFIG_HTTPS_PROTOCOL 0
+%define CONFIG_ICECAST_PROTOCOL 0
+%define CONFIG_MMSH_PROTOCOL 0
+%define CONFIG_MMST_PROTOCOL 0
+%define CONFIG_MD5_PROTOCOL 0
+%define CONFIG_PIPE_PROTOCOL 0
+%define CONFIG_PROMPEG_PROTOCOL 0
+%define CONFIG_RTMP_PROTOCOL 0
+%define CONFIG_RTMPE_PROTOCOL 0
+%define CONFIG_RTMPS_PROTOCOL 0
+%define CONFIG_RTMPT_PROTOCOL 0
+%define CONFIG_RTMPTE_PROTOCOL 0
+%define CONFIG_RTMPTS_PROTOCOL 0
+%define CONFIG_RTP_PROTOCOL 0
+%define CONFIG_SCTP_PROTOCOL 0
+%define CONFIG_SRTP_PROTOCOL 0
+%define CONFIG_SUBFILE_PROTOCOL 0
+%define CONFIG_TEE_PROTOCOL 0
+%define CONFIG_TCP_PROTOCOL 0
+%define CONFIG_TLS_GNUTLS_PROTOCOL 0
+%define CONFIG_TLS_SCHANNEL_PROTOCOL 0
+%define CONFIG_TLS_SECURETRANSPORT_PROTOCOL 0
+%define CONFIG_TLS_OPENSSL_PROTOCOL 0
+%define CONFIG_UDP_PROTOCOL 0
+%define CONFIG_UDPLITE_PROTOCOL 0
+%define CONFIG_UNIX_PROTOCOL 0
+%define CONFIG_LIBRTMP_PROTOCOL 0
+%define CONFIG_LIBRTMPE_PROTOCOL 0
+%define CONFIG_LIBRTMPS_PROTOCOL 0
+%define CONFIG_LIBRTMPT_PROTOCOL 0
+%define CONFIG_LIBRTMPTE_PROTOCOL 0
+%define CONFIG_LIBSSH_PROTOCOL 0
+%define CONFIG_LIBSMBCLIENT_PROTOCOL 0
diff --git a/media/ffvpx/defaults_disabled.h b/media/ffvpx/defaults_disabled.h
new file mode 100644
index 0000000000..e526aa9e75
--- /dev/null
+++ b/media/ffvpx/defaults_disabled.h
@@ -0,0 +1,1674 @@
+#define CONFIG_ENCODERS 0
+#define CONFIG_HWACCELS 0
+#define CONFIG_INDEVS 0
+#define CONFIG_OUTDEVS 0
+#define CONFIG_FILTERS 0
+#define CONFIG_DEMUXERS 0
+#define CONFIG_MUXERS 0
+#define CONFIG_PROTOCOLS 0
+#define CONFIG_FRAME_THREAD_ENCODER 0
+#define CONFIG_AASC_DECODER 0
+#define CONFIG_AIC_DECODER 0
+#define CONFIG_ALIAS_PIX_DECODER 0
+#define CONFIG_AMV_DECODER 0
+#define CONFIG_ANM_DECODER 0
+#define CONFIG_ANSI_DECODER 0
+#define CONFIG_APNG_DECODER 0
+#define CONFIG_ASV1_DECODER 0
+#define CONFIG_ASV2_DECODER 0
+#define CONFIG_AURA_DECODER 0
+#define CONFIG_AURA2_DECODER 0
+#define CONFIG_AVRP_DECODER 0
+#define CONFIG_AVRN_DECODER 0
+#define CONFIG_AVS_DECODER 0
+#define CONFIG_AVUI_DECODER 0
+#define CONFIG_AYUV_DECODER 0
+#define CONFIG_BETHSOFTVID_DECODER 0
+#define CONFIG_BFI_DECODER 0
+#define CONFIG_BINK_DECODER 0
+#define CONFIG_BMP_DECODER 0
+#define CONFIG_BMV_VIDEO_DECODER 0
+#define CONFIG_BRENDER_PIX_DECODER 0
+#define CONFIG_C93_DECODER 0
+#define CONFIG_CAVS_DECODER 0
+#define CONFIG_CDGRAPHICS_DECODER 0
+#define CONFIG_CDXL_DECODER 0
+#define CONFIG_CFHD_DECODER 0
+#define CONFIG_CINEPAK_DECODER 0
+#define CONFIG_CLEARVIDEO_DECODER 0
+#define CONFIG_CLJR_DECODER 0
+#define CONFIG_CLLC_DECODER 0
+#define CONFIG_COMFORTNOISE_DECODER 0
+#define CONFIG_CPIA_DECODER 0
+#define CONFIG_CSCD_DECODER 0
+#define CONFIG_CYUV_DECODER 0
+#define CONFIG_DDS_DECODER 0
+#define CONFIG_DFA_DECODER 0
+#define CONFIG_DIRAC_DECODER 0
+#define CONFIG_DNXHD_DECODER 0
+#define CONFIG_DPX_DECODER 0
+#define CONFIG_DSICINVIDEO_DECODER 0
+#define CONFIG_DVAUDIO_DECODER 0
+#define CONFIG_DVVIDEO_DECODER 0
+#define CONFIG_DXA_DECODER 0
+#define CONFIG_DXTORY_DECODER 0
+#define CONFIG_DXV_DECODER 0
+#define CONFIG_EACMV_DECODER 0
+#define CONFIG_EAMAD_DECODER 0
+#define CONFIG_EATGQ_DECODER 0
+#define CONFIG_EATGV_DECODER 0
+#define CONFIG_EATQI_DECODER 0
+#define CONFIG_EIGHTBPS_DECODER 0
+#define CONFIG_EIGHTSVX_EXP_DECODER 0
+#define CONFIG_EIGHTSVX_FIB_DECODER 0
+#define CONFIG_ESCAPE124_DECODER 0
+#define CONFIG_ESCAPE130_DECODER 0
+#define CONFIG_EXR_DECODER 0
+#define CONFIG_FFV1_DECODER 0
+#define CONFIG_FFVHUFF_DECODER 0
+#define CONFIG_FIC_DECODER 0
+#define CONFIG_FITS_DECODER 0
+#define CONFIG_FLASHSV_DECODER 0
+#define CONFIG_FLASHSV2_DECODER 0
+#define CONFIG_FLIC_DECODER 0
+#define CONFIG_FLV_DECODER 0
+#define CONFIG_FMVC_DECODER 0
+#define CONFIG_FOURXM_DECODER 0
+#define CONFIG_FRAPS_DECODER 0
+#define CONFIG_FRWU_DECODER 0
+#define CONFIG_G2M_DECODER 0
+#define CONFIG_GDV_DECODER 0
+#define CONFIG_GIF_DECODER 0
+#define CONFIG_H261_DECODER 0
+#define CONFIG_H263_DECODER 0
+#define CONFIG_H263I_DECODER 0
+#define CONFIG_H263P_DECODER 0
+#define CONFIG_H263_V4L2M2M_DECODER 0
+#define CONFIG_H264_DECODER 0
+#define CONFIG_H264_CRYSTALHD_DECODER 0
+#define CONFIG_H264_V4L2M2M_DECODER 0
+#define CONFIG_H264_MEDIACODEC_DECODER 0
+#define CONFIG_H264_MMAL_DECODER 0
+#define CONFIG_H264_QSV_DECODER 0
+#define CONFIG_H264_RKMPP_DECODER 0
+#define CONFIG_H264_VDA_DECODER 0
+#define CONFIG_H264_VDPAU_DECODER 0
+#define CONFIG_HAP_DECODER 0
+#define CONFIG_HEVC_DECODER 0
+#define CONFIG_HEVC_QSV_DECODER 0
+#define CONFIG_HEVC_RKMPP_DECODER 0
+#define CONFIG_HEVC_V4L2M2M_DECODER 0
+#define CONFIG_HNM4_VIDEO_DECODER 0
+#define CONFIG_HQ_HQA_DECODER 0
+#define CONFIG_HQX_DECODER 0
+#define CONFIG_HUFFYUV_DECODER 0
+#define CONFIG_IDCIN_DECODER 0
+#define CONFIG_IFF_ILBM_DECODER 0
+#define CONFIG_INDEO2_DECODER 0
+#define CONFIG_INDEO3_DECODER 0
+#define CONFIG_INDEO4_DECODER 0
+#define CONFIG_INDEO5_DECODER 0
+#define CONFIG_INTERPLAY_VIDEO_DECODER 0
+#define CONFIG_JPEG2000_DECODER 0
+#define CONFIG_JPEGLS_DECODER 0
+#define CONFIG_JV_DECODER 0
+#define CONFIG_KGV1_DECODER 0
+#define CONFIG_KMVC_DECODER 0
+#define CONFIG_LAGARITH_DECODER 0
+#define CONFIG_LOCO_DECODER 0
+#define CONFIG_M101_DECODER 0
+#define CONFIG_MAGICYUV_DECODER 0
+#define CONFIG_MDEC_DECODER 0
+#define CONFIG_MIMIC_DECODER 0
+#define CONFIG_MJPEG_DECODER 0
+#define CONFIG_MJPEGB_DECODER 0
+#define CONFIG_MMVIDEO_DECODER 0
+#define CONFIG_MOTIONPIXELS_DECODER 0
+#define CONFIG_MPEG_XVMC_DECODER 0
+#define CONFIG_MPEG1VIDEO_DECODER 0
+#define CONFIG_MPEG2VIDEO_DECODER 0
+#define CONFIG_MPEG4_DECODER 0
+#define CONFIG_MPEG4_CRYSTALHD_DECODER 0
+#define CONFIG_MPEG4_V4L2M2M_DECODER 0
+#define CONFIG_MPEG4_MMAL_DECODER 0
+#define CONFIG_MPEG4_VDPAU_DECODER 0
+#define CONFIG_MPEGVIDEO_DECODER 0
+#define CONFIG_MPEG_VDPAU_DECODER 0
+#define CONFIG_MPEG1_VDPAU_DECODER 0
+#define CONFIG_MPEG1_V4L2M2M_DECODER 0
+#define CONFIG_MPEG2_MMAL_DECODER 0
+#define CONFIG_MPEG2_CRYSTALHD_DECODER 0
+#define CONFIG_MPEG2_V4L2M2M_DECODER 0
+#define CONFIG_MPEG2_QSV_DECODER 0
+#define CONFIG_MPEG2_MEDIACODEC_DECODER 0
+#define CONFIG_MSA1_DECODER 0
+#define CONFIG_MSCC_DECODER 0
+#define CONFIG_MSMPEG4V1_DECODER 0
+#define CONFIG_MSMPEG4V2_DECODER 0
+#define CONFIG_MSMPEG4V3_DECODER 0
+#define CONFIG_MSMPEG4_CRYSTALHD_DECODER 0
+#define CONFIG_MSRLE_DECODER 0
+#define CONFIG_MSS1_DECODER 0
+#define CONFIG_MSS2_DECODER 0
+#define CONFIG_MSVIDEO1_DECODER 0
+#define CONFIG_MSZH_DECODER 0
+#define CONFIG_MTS2_DECODER 0
+#define CONFIG_MVC1_DECODER 0
+#define CONFIG_MVC2_DECODER 0
+#define CONFIG_MXPEG_DECODER 0
+#define CONFIG_NUV_DECODER 0
+#define CONFIG_PAF_VIDEO_DECODER 0
+#define CONFIG_PAM_DECODER 0
+#define CONFIG_PBM_DECODER 0
+#define CONFIG_PCX_DECODER 0
+#define CONFIG_PGM_DECODER 0
+#define CONFIG_PGMYUV_DECODER 0
+#define CONFIG_PICTOR_DECODER 0
+#define CONFIG_PIXLET_DECODER 0
+#define CONFIG_PNG_DECODER 0
+#define CONFIG_PPM_DECODER 0
+#define CONFIG_PRORES_DECODER 0
+#define CONFIG_PRORES_LGPL_DECODER 0
+#define CONFIG_PSD_DECODER 0
+#define CONFIG_PTX_DECODER 0
+#define CONFIG_QDRAW_DECODER 0
+#define CONFIG_QPEG_DECODER 0
+#define CONFIG_QTRLE_DECODER 0
+#define CONFIG_R10K_DECODER 0
+#define CONFIG_R210_DECODER 0
+#define CONFIG_RAWVIDEO_DECODER 0
+#define CONFIG_RL2_DECODER 0
+#define CONFIG_ROQ_DECODER 0
+#define CONFIG_RPZA_DECODER 0
+#define CONFIG_RSCC_DECODER 0
+#define CONFIG_RV10_DECODER 0
+#define CONFIG_RV20_DECODER 0
+#define CONFIG_RV30_DECODER 0
+#define CONFIG_RV40_DECODER 0
+#define CONFIG_S302M_DECODER 0
+#define CONFIG_SANM_DECODER 0
+#define CONFIG_SCPR_DECODER 0
+#define CONFIG_SCREENPRESSO_DECODER 0
+#define CONFIG_SDX2_DPCM_DECODER 0
+#define CONFIG_SGI_DECODER 0
+#define CONFIG_SGIRLE_DECODER 0
+#define CONFIG_SHEERVIDEO_DECODER 0
+#define CONFIG_SMACKER_DECODER 0
+#define CONFIG_SMC_DECODER 0
+#define CONFIG_SMVJPEG_DECODER 0
+#define CONFIG_SNOW_DECODER 0
+#define CONFIG_SP5X_DECODER 0
+#define CONFIG_SPEEDHQ_DECODER 0
+#define CONFIG_SRGC_DECODER 0
+#define CONFIG_SUNRAST_DECODER 0
+#define CONFIG_SVQ1_DECODER 0
+#define CONFIG_SVQ3_DECODER 0
+#define CONFIG_TARGA_DECODER 0
+#define CONFIG_TARGA_Y216_DECODER 0
+#define CONFIG_TDSC_DECODER 0
+#define CONFIG_THEORA_DECODER 0
+#define CONFIG_THP_DECODER 0
+#define CONFIG_TIERTEXSEQVIDEO_DECODER 0
+#define CONFIG_TIFF_DECODER 0
+#define CONFIG_TMV_DECODER 0
+#define CONFIG_TRUEMOTION1_DECODER 0
+#define CONFIG_TRUEMOTION2_DECODER 0
+#define CONFIG_TRUEMOTION2RT_DECODER 0
+#define CONFIG_TSCC_DECODER 0
+#define CONFIG_TSCC2_DECODER 0
+#define CONFIG_TXD_DECODER 0
+#define CONFIG_ULTI_DECODER 0
+#define CONFIG_UTVIDEO_DECODER 0
+#define CONFIG_V210_DECODER 0
+#define CONFIG_V210X_DECODER 0
+#define CONFIG_V308_DECODER 0
+#define CONFIG_V408_DECODER 0
+#define CONFIG_V410_DECODER 0
+#define CONFIG_VB_DECODER 0
+#define CONFIG_VBLE_DECODER 0
+#define CONFIG_VC1_DECODER 0
+#define CONFIG_VC1_CRYSTALHD_DECODER 0
+#define CONFIG_VC1_VDPAU_DECODER 0
+#define CONFIG_VC1IMAGE_DECODER 0
+#define CONFIG_VC1_MMAL_DECODER 0
+#define CONFIG_VC1_QSV_DECODER 0
+#define CONFIG_VC1_V4L2M2M_DECODER 0
+#define CONFIG_VCR1_DECODER 0
+#define CONFIG_VMDVIDEO_DECODER 0
+#define CONFIG_VMNC_DECODER 0
+#define CONFIG_VP3_DECODER 0
+#define CONFIG_VP5_DECODER 0
+#define CONFIG_VP6_DECODER 0
+#define CONFIG_VP6A_DECODER 0
+#define CONFIG_VP6F_DECODER 0
+#define CONFIG_VP7_DECODER 0
+#define CONFIG_VP8_RKMPP_DECODER 0
+#define CONFIG_VP8_V4L2M2M_DECODER 0
+#define CONFIG_VP9_RKMPP_DECODER 0
+#define CONFIG_VP9_V4L2M2M_DECODER 0
+#define CONFIG_VQA_DECODER 0
+#define CONFIG_BITPACKED_DECODER 0
+#define CONFIG_WEBP_DECODER 0
+#define CONFIG_WRAPPED_AVFRAME_DECODER 0
+#define CONFIG_WMV1_DECODER 0
+#define CONFIG_WMV2_DECODER 0
+#define CONFIG_WMV3_DECODER 0
+#define CONFIG_WMV3_CRYSTALHD_DECODER 0
+#define CONFIG_WMV3_VDPAU_DECODER 0
+#define CONFIG_WMV3IMAGE_DECODER 0
+#define CONFIG_WNV1_DECODER 0
+#define CONFIG_XAN_WC3_DECODER 0
+#define CONFIG_XAN_WC4_DECODER 0
+#define CONFIG_XBM_DECODER 0
+#define CONFIG_XFACE_DECODER 0
+#define CONFIG_XL_DECODER 0
+#define CONFIG_XPM_DECODER 0
+#define CONFIG_XWD_DECODER 0
+#define CONFIG_Y41P_DECODER 0
+#define CONFIG_YLC_DECODER 0
+#define CONFIG_YOP_DECODER 0
+#define CONFIG_YUV4_DECODER 0
+#define CONFIG_ZERO12V_DECODER 0
+#define CONFIG_ZEROCODEC_DECODER 0
+#define CONFIG_ZLIB_DECODER 0
+#define CONFIG_ZMBV_DECODER 0
+#define CONFIG_AAC_DECODER 0
+#define CONFIG_AAC_FIXED_DECODER 0
+#define CONFIG_AAC_LATM_DECODER 0
+#define CONFIG_AC3_DECODER 0
+#define CONFIG_AC3_FIXED_DECODER 0
+#define CONFIG_ALAC_DECODER 0
+#define CONFIG_ALS_DECODER 0
+#define CONFIG_AMRNB_DECODER 0
+#define CONFIG_AMRWB_DECODER 0
+#define CONFIG_APE_DECODER 0
+#define CONFIG_ATRAC1_DECODER 0
+#define CONFIG_ATRAC3_DECODER 0
+#define CONFIG_ATRAC3AL_DECODER 0
+#define CONFIG_ATRAC3P_DECODER 0
+#define CONFIG_ATRAC3PAL_DECODER 0
+#define CONFIG_BINKAUDIO_DCT_DECODER 0
+#define CONFIG_BINKAUDIO_RDFT_DECODER 0
+#define CONFIG_BMV_AUDIO_DECODER 0
+#define CONFIG_COOK_DECODER 0
+#define CONFIG_DCA_DECODER 0
+#define CONFIG_DOLBY_E_DECODER 0
+#define CONFIG_DSD_LSBF_DECODER 0
+#define CONFIG_DSD_MSBF_DECODER 0
+#define CONFIG_DSD_LSBF_PLANAR_DECODER 0
+#define CONFIG_DSD_MSBF_PLANAR_DECODER 0
+#define CONFIG_DSICINAUDIO_DECODER 0
+#define CONFIG_DSS_SP_DECODER 0
+#define CONFIG_DST_DECODER 0
+#define CONFIG_EAC3_DECODER 0
+#define CONFIG_EVRC_DECODER 0
+#define CONFIG_FFWAVESYNTH_DECODER 0
+#define CONFIG_G723_1_DECODER 0
+#define CONFIG_G729_DECODER 0
+#define CONFIG_GSM_DECODER 0
+#define CONFIG_GSM_MS_DECODER 0
+#define CONFIG_IAC_DECODER 0
+#define CONFIG_IMC_DECODER 0
+#define CONFIG_INTERPLAY_ACM_DECODER 0
+#define CONFIG_MACE3_DECODER 0
+#define CONFIG_MACE6_DECODER 0
+#define CONFIG_METASOUND_DECODER 0
+#define CONFIG_MLP_DECODER 0
+#define CONFIG_MP1_DECODER 0
+#define CONFIG_MP1FLOAT_DECODER 0
+#define CONFIG_MP2_DECODER 0
+#define CONFIG_MP2FLOAT_DECODER 0
+#define CONFIG_MP3_DECODER 0
+#define CONFIG_MP3FLOAT_DECODER 0
+#define CONFIG_MP3ADU_DECODER 0
+#define CONFIG_MP3ADUFLOAT_DECODER 0
+#define CONFIG_MP3ON4_DECODER 0
+#define CONFIG_MP3ON4FLOAT_DECODER 0
+#define CONFIG_MPC7_DECODER 0
+#define CONFIG_MPC8_DECODER 0
+#define CONFIG_NELLYMOSER_DECODER 0
+#define CONFIG_ON2AVC_DECODER 0
+#define CONFIG_OPUS_DECODER 0
+#define CONFIG_PAF_AUDIO_DECODER 0
+#define CONFIG_QCELP_DECODER 0
+#define CONFIG_QDM2_DECODER 0
+#define CONFIG_QDMC_DECODER 0
+#define CONFIG_RA_144_DECODER 0
+#define CONFIG_RA_288_DECODER 0
+#define CONFIG_RALF_DECODER 0
+#define CONFIG_SHORTEN_DECODER 0
+#define CONFIG_SIPR_DECODER 0
+#define CONFIG_SMACKAUD_DECODER 0
+#define CONFIG_SONIC_DECODER 0
+#define CONFIG_TAK_DECODER 0
+#define CONFIG_TRUEHD_DECODER 0
+#define CONFIG_TRUESPEECH_DECODER 0
+#define CONFIG_TTA_DECODER 0
+#define CONFIG_TWINVQ_DECODER 0
+#define CONFIG_VMDAUDIO_DECODER 0
+#define CONFIG_VORBIS_DECODER 0
+#define CONFIG_WAVPACK_DECODER 0
+#define CONFIG_WMALOSSLESS_DECODER 0
+#define CONFIG_WMAPRO_DECODER 0
+#define CONFIG_WMAV1_DECODER 0
+#define CONFIG_WMAV2_DECODER 0
+#define CONFIG_WMAVOICE_DECODER 0
+#define CONFIG_WS_SND1_DECODER 0
+#define CONFIG_XMA1_DECODER 0
+#define CONFIG_XMA2_DECODER 0
+#define CONFIG_PCM_ALAW_DECODER 0
+#define CONFIG_PCM_BLURAY_DECODER 0
+#define CONFIG_PCM_DVD_DECODER 0
+#define CONFIG_PCM_F16LE_DECODER 0
+#define CONFIG_PCM_F24LE_DECODER 0
+#define CONFIG_PCM_F32BE_DECODER 0
+#define CONFIG_PCM_F32LE_DECODER 0
+#define CONFIG_PCM_F64BE_DECODER 0
+#define CONFIG_PCM_F64LE_DECODER 0
+#define CONFIG_PCM_LXF_DECODER 0
+#define CONFIG_PCM_MULAW_DECODER 0
+#define CONFIG_PCM_S8_DECODER 0
+#define CONFIG_PCM_S8_PLANAR_DECODER 0
+#define CONFIG_PCM_S16BE_DECODER 0
+#define CONFIG_PCM_S16BE_PLANAR_DECODER 0
+#define CONFIG_PCM_S16LE_DECODER 0
+#define CONFIG_PCM_S16LE_PLANAR_DECODER 0
+#define CONFIG_PCM_S24BE_DECODER 0
+#define CONFIG_PCM_S24DAUD_DECODER 0
+#define CONFIG_PCM_S24LE_DECODER 0
+#define CONFIG_PCM_S24LE_PLANAR_DECODER 0
+#define CONFIG_PCM_S32BE_DECODER 0
+#define CONFIG_PCM_S32LE_DECODER 0
+#define CONFIG_PCM_S32LE_PLANAR_DECODER 0
+#define CONFIG_PCM_S64BE_DECODER 0
+#define CONFIG_PCM_S64LE_DECODER 0
+#define CONFIG_PCM_U8_DECODER 0
+#define CONFIG_PCM_U16BE_DECODER 0
+#define CONFIG_PCM_U16LE_DECODER 0
+#define CONFIG_PCM_U24BE_DECODER 0
+#define CONFIG_PCM_U24LE_DECODER 0
+#define CONFIG_PCM_U32BE_DECODER 0
+#define CONFIG_PCM_U32LE_DECODER 0
+#define CONFIG_PCM_ZORK_DECODER 0
+#define CONFIG_GREMLIN_DPCM_DECODER 0
+#define CONFIG_INTERPLAY_DPCM_DECODER 0
+#define CONFIG_ROQ_DPCM_DECODER 0
+#define CONFIG_SOL_DPCM_DECODER 0
+#define CONFIG_XAN_DPCM_DECODER 0
+#define CONFIG_ADPCM_4XM_DECODER 0
+#define CONFIG_ADPCM_ADX_DECODER 0
+#define CONFIG_ADPCM_AFC_DECODER 0
+#define CONFIG_ADPCM_AICA_DECODER 0
+#define CONFIG_ADPCM_CT_DECODER 0
+#define CONFIG_ADPCM_DTK_DECODER 0
+#define CONFIG_ADPCM_EA_DECODER 0
+#define CONFIG_ADPCM_EA_MAXIS_XA_DECODER 0
+#define CONFIG_ADPCM_EA_R1_DECODER 0
+#define CONFIG_ADPCM_EA_R2_DECODER 0
+#define CONFIG_ADPCM_EA_R3_DECODER 0
+#define CONFIG_ADPCM_EA_XAS_DECODER 0
+#define CONFIG_ADPCM_G722_DECODER 0
+#define CONFIG_ADPCM_G726_DECODER 0
+#define CONFIG_ADPCM_G726LE_DECODER 0
+#define CONFIG_ADPCM_IMA_AMV_DECODER 0
+#define CONFIG_ADPCM_IMA_APC_DECODER 0
+#define CONFIG_ADPCM_IMA_DAT4_DECODER 0
+#define CONFIG_ADPCM_IMA_DK3_DECODER 0
+#define CONFIG_ADPCM_IMA_DK4_DECODER 0
+#define CONFIG_ADPCM_IMA_EA_EACS_DECODER 0
+#define CONFIG_ADPCM_IMA_EA_SEAD_DECODER 0
+#define CONFIG_ADPCM_IMA_ISS_DECODER 0
+#define CONFIG_ADPCM_IMA_OKI_DECODER 0
+#define CONFIG_ADPCM_IMA_QT_DECODER 0
+#define CONFIG_ADPCM_IMA_RAD_DECODER 0
+#define CONFIG_ADPCM_IMA_SMJPEG_DECODER 0
+#define CONFIG_ADPCM_IMA_WAV_DECODER 0
+#define CONFIG_ADPCM_IMA_WS_DECODER 0
+#define CONFIG_ADPCM_MS_DECODER 0
+#define CONFIG_ADPCM_MTAF_DECODER 0
+#define CONFIG_ADPCM_PSX_DECODER 0
+#define CONFIG_ADPCM_SBPRO_2_DECODER 0
+#define CONFIG_ADPCM_SBPRO_3_DECODER 0
+#define CONFIG_ADPCM_SBPRO_4_DECODER 0
+#define CONFIG_ADPCM_SWF_DECODER 0
+#define CONFIG_ADPCM_THP_DECODER 0
+#define CONFIG_ADPCM_THP_LE_DECODER 0
+#define CONFIG_ADPCM_VIMA_DECODER 0
+#define CONFIG_ADPCM_XA_DECODER 0
+#define CONFIG_ADPCM_YAMAHA_DECODER 0
+#define CONFIG_SSA_DECODER 0
+#define CONFIG_ASS_DECODER 0
+#define CONFIG_CCAPTION_DECODER 0
+#define CONFIG_DVBSUB_DECODER 0
+#define CONFIG_DVDSUB_DECODER 0
+#define CONFIG_JACOSUB_DECODER 0
+#define CONFIG_MICRODVD_DECODER 0
+#define CONFIG_MOVTEXT_DECODER 0
+#define CONFIG_MPL2_DECODER 0
+#define CONFIG_PGSSUB_DECODER 0
+#define CONFIG_PJS_DECODER 0
+#define CONFIG_REALTEXT_DECODER 0
+#define CONFIG_SAMI_DECODER 0
+#define CONFIG_SRT_DECODER 0
+#define CONFIG_STL_DECODER 0
+#define CONFIG_SUBRIP_DECODER 0
+#define CONFIG_SUBVIEWER_DECODER 0
+#define CONFIG_SUBVIEWER1_DECODER 0
+#define CONFIG_TEXT_DECODER 0
+#define CONFIG_VPLAYER_DECODER 0
+#define CONFIG_WEBVTT_DECODER 0
+#define CONFIG_XSUB_DECODER 0
+#define CONFIG_AAC_AT_DECODER 0
+#define CONFIG_AC3_AT_DECODER 0
+#define CONFIG_ADPCM_IMA_QT_AT_DECODER 0
+#define CONFIG_ALAC_AT_DECODER 0
+#define CONFIG_AMR_NB_AT_DECODER 0
+#define CONFIG_EAC3_AT_DECODER 0
+#define CONFIG_GSM_MS_AT_DECODER 0
+#define CONFIG_ILBC_AT_DECODER 0
+#define CONFIG_MP1_AT_DECODER 0
+#define CONFIG_MP2_AT_DECODER 0
+#define CONFIG_MP3_AT_DECODER 0
+#define CONFIG_PCM_ALAW_AT_DECODER 0
+#define CONFIG_PCM_MULAW_AT_DECODER 0
+#define CONFIG_QDMC_AT_DECODER 0
+#define CONFIG_QDM2_AT_DECODER 0
+#define CONFIG_LIBCELT_DECODER 0
+#define CONFIG_LIBFDK_AAC_DECODER 0
+#define CONFIG_LIBGSM_DECODER 0
+#define CONFIG_LIBGSM_MS_DECODER 0
+#define CONFIG_LIBILBC_DECODER 0
+#define CONFIG_LIBOPENCORE_AMRNB_DECODER 0
+#define CONFIG_LIBOPENCORE_AMRWB_DECODER 0
+#define CONFIG_LIBOPENJPEG_DECODER 0
+#define CONFIG_LIBOPUS_DECODER 0
+#define CONFIG_LIBRSVG_DECODER 0
+#define CONFIG_LIBSPEEX_DECODER 0
+#define CONFIG_LIBVORBIS_DECODER 0
+#define CONFIG_LIBVPX_VP8_DECODER 0
+#define CONFIG_LIBVPX_VP9_DECODER 0
+#define CONFIG_LIBZVBI_TELETEXT_DECODER 0
+#define CONFIG_BINTEXT_DECODER 0
+#define CONFIG_XBIN_DECODER 0
+#define CONFIG_IDF_DECODER 0
+#define CONFIG_LIBOPENH264_DECODER 0
+#define CONFIG_H264_CUVID_DECODER 0
+#define CONFIG_HEVC_CUVID_DECODER 0
+#define CONFIG_HEVC_MEDIACODEC_DECODER 0
+#define CONFIG_MJPEG_CUVID_DECODER 0
+#define CONFIG_MPEG1_CUVID_DECODER 0
+#define CONFIG_MPEG2_CUVID_DECODER 0
+#define CONFIG_MPEG4_CUVID_DECODER 0
+#define CONFIG_MPEG4_MEDIACODEC_DECODER 0
+#define CONFIG_VC1_CUVID_DECODER 0
+#define CONFIG_VP8_CUVID_DECODER 0
+#define CONFIG_VP8_MEDIACODEC_DECODER 0
+#define CONFIG_VP8_QSV_DECODER 0
+#define CONFIG_VP9_CUVID_DECODER 0
+#define CONFIG_VP9_MEDIACODEC_DECODER 0
+#define CONFIG_AA_DEMUXER 0
+#define CONFIG_AAC_DEMUXER 0
+#define CONFIG_AC3_DEMUXER 0
+#define CONFIG_ACM_DEMUXER 0
+#define CONFIG_ACT_DEMUXER 0
+#define CONFIG_ADF_DEMUXER 0
+#define CONFIG_ADP_DEMUXER 0
+#define CONFIG_ADS_DEMUXER 0
+#define CONFIG_ADX_DEMUXER 0
+#define CONFIG_AEA_DEMUXER 0
+#define CONFIG_AFC_DEMUXER 0
+#define CONFIG_AIFF_DEMUXER 0
+#define CONFIG_AIX_DEMUXER 0
+#define CONFIG_AMR_DEMUXER 0
+#define CONFIG_ANM_DEMUXER 0
+#define CONFIG_APC_DEMUXER 0
+#define CONFIG_APE_DEMUXER 0
+#define CONFIG_APNG_DEMUXER 0
+#define CONFIG_AQTITLE_DEMUXER 0
+#define CONFIG_ASF_DEMUXER 0
+#define CONFIG_ASF_O_DEMUXER 0
+#define CONFIG_ASS_DEMUXER 0
+#define CONFIG_AST_DEMUXER 0
+#define CONFIG_AU_DEMUXER 0
+#define CONFIG_AVI_DEMUXER 0
+#define CONFIG_AVISYNTH_DEMUXER 0
+#define CONFIG_AVR_DEMUXER 0
+#define CONFIG_AVS_DEMUXER 0
+#define CONFIG_BETHSOFTVID_DEMUXER 0
+#define CONFIG_BFI_DEMUXER 0
+#define CONFIG_BINTEXT_DEMUXER 0
+#define CONFIG_BINK_DEMUXER 0
+#define CONFIG_BIT_DEMUXER 0
+#define CONFIG_BMV_DEMUXER 0
+#define CONFIG_BFSTM_DEMUXER 0
+#define CONFIG_BRSTM_DEMUXER 0
+#define CONFIG_BOA_DEMUXER 0
+#define CONFIG_C93_DEMUXER 0
+#define CONFIG_CAF_DEMUXER 0
+#define CONFIG_CAVSVIDEO_DEMUXER 0
+#define CONFIG_CDG_DEMUXER 0
+#define CONFIG_CDXL_DEMUXER 0
+#define CONFIG_CINE_DEMUXER 0
+#define CONFIG_CONCAT_DEMUXER 0
+#define CONFIG_DASH_DEMUXER 0
+#define CONFIG_DATA_DEMUXER 0
+#define CONFIG_DAUD_DEMUXER 0
+#define CONFIG_DCSTR_DEMUXER 0
+#define CONFIG_DFA_DEMUXER 0
+#define CONFIG_DIRAC_DEMUXER 0
+#define CONFIG_DNXHD_DEMUXER 0
+#define CONFIG_DSF_DEMUXER 0
+#define CONFIG_DSICIN_DEMUXER 0
+#define CONFIG_DSS_DEMUXER 0
+#define CONFIG_DTS_DEMUXER 0
+#define CONFIG_DTSHD_DEMUXER 0
+#define CONFIG_DV_DEMUXER 0
+#define CONFIG_DVBSUB_DEMUXER 0
+#define CONFIG_DVBTXT_DEMUXER 0
+#define CONFIG_DXA_DEMUXER 0
+#define CONFIG_EA_DEMUXER 0
+#define CONFIG_EA_CDATA_DEMUXER 0
+#define CONFIG_EAC3_DEMUXER 0
+#define CONFIG_EPAF_DEMUXER 0
+#define CONFIG_FFM_DEMUXER 0
+#define CONFIG_FFMETADATA_DEMUXER 0
+#define CONFIG_FILMSTRIP_DEMUXER 0
+#define CONFIG_FITS_DEMUXER 0
+#define CONFIG_FLAC_DEMUXER 0
+#define CONFIG_FLIC_DEMUXER 0
+#define CONFIG_FLV_DEMUXER 0
+#define CONFIG_LIVE_FLV_DEMUXER 0
+#define CONFIG_FOURXM_DEMUXER 0
+#define CONFIG_FRM_DEMUXER 0
+#define CONFIG_FSB_DEMUXER 0
+#define CONFIG_G722_DEMUXER 0
+#define CONFIG_G723_1_DEMUXER 0
+#define CONFIG_G726_DEMUXER 0
+#define CONFIG_G726LE_DEMUXER 0
+#define CONFIG_G729_DEMUXER 0
+#define CONFIG_GDV_DEMUXER 0
+#define CONFIG_GENH_DEMUXER 0
+#define CONFIG_GIF_DEMUXER 0
+#define CONFIG_GSM_DEMUXER 0
+#define CONFIG_GXF_DEMUXER 0
+#define CONFIG_H261_DEMUXER 0
+#define CONFIG_H263_DEMUXER 0
+#define CONFIG_H264_DEMUXER 0
+#define CONFIG_HEVC_DEMUXER 0
+#define CONFIG_HLS_DEMUXER 0
+#define CONFIG_HNM_DEMUXER 0
+#define CONFIG_ICO_DEMUXER 0
+#define CONFIG_IDCIN_DEMUXER 0
+#define CONFIG_IDF_DEMUXER 0
+#define CONFIG_IFF_DEMUXER 0
+#define CONFIG_ILBC_DEMUXER 0
+#define CONFIG_IMAGE2_DEMUXER 0
+#define CONFIG_IMAGE2PIPE_DEMUXER 0
+#define CONFIG_IMAGE2_ALIAS_PIX_DEMUXER 0
+#define CONFIG_IMAGE2_BRENDER_PIX_DEMUXER 0
+#define CONFIG_INGENIENT_DEMUXER 0
+#define CONFIG_IPMOVIE_DEMUXER 0
+#define CONFIG_IRCAM_DEMUXER 0
+#define CONFIG_ISS_DEMUXER 0
+#define CONFIG_IV8_DEMUXER 0
+#define CONFIG_IVF_DEMUXER 0
+#define CONFIG_IVR_DEMUXER 0
+#define CONFIG_JACOSUB_DEMUXER 0
+#define CONFIG_JV_DEMUXER 0
+#define CONFIG_LMLM4_DEMUXER 0
+#define CONFIG_LOAS_DEMUXER 0
+#define CONFIG_LRC_DEMUXER 0
+#define CONFIG_LVF_DEMUXER 0
+#define CONFIG_LXF_DEMUXER 0
+#define CONFIG_M4V_DEMUXER 0
+#define CONFIG_MATROSKA_DEMUXER 0
+#define CONFIG_MGSTS_DEMUXER 0
+#define CONFIG_MICRODVD_DEMUXER 0
+#define CONFIG_MJPEG_DEMUXER 0
+#define CONFIG_MJPEG_2000_DEMUXER 0
+#define CONFIG_MLP_DEMUXER 0
+#define CONFIG_MLV_DEMUXER 0
+#define CONFIG_MM_DEMUXER 0
+#define CONFIG_MMF_DEMUXER 0
+#define CONFIG_MOV_DEMUXER 0
+#define CONFIG_MP3_DEMUXER 0
+#define CONFIG_MPC_DEMUXER 0
+#define CONFIG_MPC8_DEMUXER 0
+#define CONFIG_MPEGPS_DEMUXER 0
+#define CONFIG_MPEGTS_DEMUXER 0
+#define CONFIG_MPEGTSRAW_DEMUXER 0
+#define CONFIG_MPEGVIDEO_DEMUXER 0
+#define CONFIG_MPJPEG_DEMUXER 0
+#define CONFIG_MPL2_DEMUXER 0
+#define CONFIG_MPSUB_DEMUXER 0
+#define CONFIG_MSF_DEMUXER 0
+#define CONFIG_MSNWC_TCP_DEMUXER 0
+#define CONFIG_MTAF_DEMUXER 0
+#define CONFIG_MTV_DEMUXER 0
+#define CONFIG_MUSX_DEMUXER 0
+#define CONFIG_MV_DEMUXER 0
+#define CONFIG_MVI_DEMUXER 0
+#define CONFIG_MXF_DEMUXER 0
+#define CONFIG_MXG_DEMUXER 0
+#define CONFIG_NC_DEMUXER 0
+#define CONFIG_NISTSPHERE_DEMUXER 0
+#define CONFIG_NSV_DEMUXER 0
+#define CONFIG_NUT_DEMUXER 0
+#define CONFIG_NUV_DEMUXER 0
+#define CONFIG_OGG_DEMUXER 0
+#define CONFIG_OMA_DEMUXER 0
+#define CONFIG_PAF_DEMUXER 0
+#define CONFIG_PCM_ALAW_DEMUXER 0
+#define CONFIG_PCM_MULAW_DEMUXER 0
+#define CONFIG_PCM_F64BE_DEMUXER 0
+#define CONFIG_PCM_F64LE_DEMUXER 0
+#define CONFIG_PCM_F32BE_DEMUXER 0
+#define CONFIG_PCM_F32LE_DEMUXER 0
+#define CONFIG_PCM_S32BE_DEMUXER 0
+#define CONFIG_PCM_S32LE_DEMUXER 0
+#define CONFIG_PCM_S24BE_DEMUXER 0
+#define CONFIG_PCM_S24LE_DEMUXER 0
+#define CONFIG_PCM_S16BE_DEMUXER 0
+#define CONFIG_PCM_S16LE_DEMUXER 0
+#define CONFIG_PCM_S8_DEMUXER 0
+#define CONFIG_PCM_U32BE_DEMUXER 0
+#define CONFIG_PCM_U32LE_DEMUXER 0
+#define CONFIG_PCM_U24BE_DEMUXER 0
+#define CONFIG_PCM_U24LE_DEMUXER 0
+#define CONFIG_PCM_U16BE_DEMUXER 0
+#define CONFIG_PCM_U16LE_DEMUXER 0
+#define CONFIG_PCM_U8_DEMUXER 0
+#define CONFIG_PJS_DEMUXER 0
+#define CONFIG_PMP_DEMUXER 0
+#define CONFIG_PVA_DEMUXER 0
+#define CONFIG_PVF_DEMUXER 0
+#define CONFIG_QCP_DEMUXER 0
+#define CONFIG_R3D_DEMUXER 0
+#define CONFIG_RAWVIDEO_DEMUXER 0
+#define CONFIG_REALTEXT_DEMUXER 0
+#define CONFIG_REDSPARK_DEMUXER 0
+#define CONFIG_RL2_DEMUXER 0
+#define CONFIG_RM_DEMUXER 0
+#define CONFIG_ROQ_DEMUXER 0
+#define CONFIG_RPL_DEMUXER 0
+#define CONFIG_RSD_DEMUXER 0
+#define CONFIG_RSO_DEMUXER 0
+#define CONFIG_RTP_DEMUXER 0
+#define CONFIG_RTSP_DEMUXER 0
+#define CONFIG_S337M_DEMUXER 0
+#define CONFIG_SAMI_DEMUXER 0
+#define CONFIG_SAP_DEMUXER 0
+#define CONFIG_SBG_DEMUXER 0
+#define CONFIG_SCC_DEMUXER 0
+#define CONFIG_SDP_DEMUXER 0
+#define CONFIG_SDR2_DEMUXER 0
+#define CONFIG_SDS_DEMUXER 0
+#define CONFIG_SDX_DEMUXER 0
+#define CONFIG_SEGAFILM_DEMUXER 0
+#define CONFIG_SHORTEN_DEMUXER 0
+#define CONFIG_SIFF_DEMUXER 0
+#define CONFIG_SLN_DEMUXER 0
+#define CONFIG_SMACKER_DEMUXER 0
+#define CONFIG_SMJPEG_DEMUXER 0
+#define CONFIG_SMUSH_DEMUXER 0
+#define CONFIG_SOL_DEMUXER 0
+#define CONFIG_SOX_DEMUXER 0
+#define CONFIG_SPDIF_DEMUXER 0
+#define CONFIG_SRT_DEMUXER 0
+#define CONFIG_STR_DEMUXER 0
+#define CONFIG_STL_DEMUXER 0
+#define CONFIG_SUBVIEWER1_DEMUXER 0
+#define CONFIG_SUBVIEWER_DEMUXER 0
+#define CONFIG_SUP_DEMUXER 0
+#define CONFIG_SVAG_DEMUXER 0
+#define CONFIG_SWF_DEMUXER 0
+#define CONFIG_TAK_DEMUXER 0
+#define CONFIG_TEDCAPTIONS_DEMUXER 0
+#define CONFIG_THP_DEMUXER 0
+#define CONFIG_THREEDOSTR_DEMUXER 0
+#define CONFIG_TIERTEXSEQ_DEMUXER 0
+#define CONFIG_TMV_DEMUXER 0
+#define CONFIG_TRUEHD_DEMUXER 0
+#define CONFIG_TTA_DEMUXER 0
+#define CONFIG_TXD_DEMUXER 0
+#define CONFIG_TTY_DEMUXER 0
+#define CONFIG_V210_DEMUXER 0
+#define CONFIG_V210X_DEMUXER 0
+#define CONFIG_VAG_DEMUXER 0
+#define CONFIG_VC1_DEMUXER 0
+#define CONFIG_VC1T_DEMUXER 0
+#define CONFIG_VIVO_DEMUXER 0
+#define CONFIG_VMD_DEMUXER 0
+#define CONFIG_VOBSUB_DEMUXER 0
+#define CONFIG_VOC_DEMUXER 0
+#define CONFIG_VPK_DEMUXER 0
+#define CONFIG_VPLAYER_DEMUXER 0
+#define CONFIG_VQF_DEMUXER 0
+#define CONFIG_W64_DEMUXER 0
+#define CONFIG_WAV_DEMUXER 0
+#define CONFIG_WC3_DEMUXER 0
+#define CONFIG_WEBM_DASH_MANIFEST_DEMUXER 0
+#define CONFIG_WEBVTT_DEMUXER 0
+#define CONFIG_WSAUD_DEMUXER 0
+#define CONFIG_WSD_DEMUXER 0
+#define CONFIG_WSVQA_DEMUXER 0
+#define CONFIG_WTV_DEMUXER 0
+#define CONFIG_WVE_DEMUXER 0
+#define CONFIG_WV_DEMUXER 0
+#define CONFIG_XA_DEMUXER 0
+#define CONFIG_XBIN_DEMUXER 0
+#define CONFIG_XMV_DEMUXER 0
+#define CONFIG_XVAG_DEMUXER 0
+#define CONFIG_XWMA_DEMUXER 0
+#define CONFIG_YOP_DEMUXER 0
+#define CONFIG_YUV4MPEGPIPE_DEMUXER 0
+#define CONFIG_IMAGE_BMP_PIPE_DEMUXER 0
+#define CONFIG_IMAGE_DDS_PIPE_DEMUXER 0
+#define CONFIG_IMAGE_DPX_PIPE_DEMUXER 0
+#define CONFIG_IMAGE_EXR_PIPE_DEMUXER 0
+#define CONFIG_IMAGE_J2K_PIPE_DEMUXER 0
+#define CONFIG_IMAGE_JPEG_PIPE_DEMUXER 0
+#define CONFIG_IMAGE_JPEGLS_PIPE_DEMUXER 0
+#define CONFIG_IMAGE_PAM_PIPE_DEMUXER 0
+#define CONFIG_IMAGE_PBM_PIPE_DEMUXER 0
+#define CONFIG_IMAGE_PCX_PIPE_DEMUXER 0
+#define CONFIG_IMAGE_PGMYUV_PIPE_DEMUXER 0
+#define CONFIG_IMAGE_PGM_PIPE_DEMUXER 0
+#define CONFIG_IMAGE_PICTOR_PIPE_DEMUXER 0
+#define CONFIG_IMAGE_PNG_PIPE_DEMUXER 0
+#define CONFIG_IMAGE_PPM_PIPE_DEMUXER 0
+#define CONFIG_IMAGE_PSD_PIPE_DEMUXER 0
+#define CONFIG_IMAGE_QDRAW_PIPE_DEMUXER 0
+#define CONFIG_IMAGE_SGI_PIPE_DEMUXER 0
+#define CONFIG_IMAGE_SVG_PIPE_DEMUXER 0
+#define CONFIG_IMAGE_SUNRAST_PIPE_DEMUXER 0
+#define CONFIG_IMAGE_TIFF_PIPE_DEMUXER 0
+#define CONFIG_IMAGE_WEBP_PIPE_DEMUXER 0
+#define CONFIG_IMAGE_XPM_PIPE_DEMUXER 0
+#define CONFIG_LIBGME_DEMUXER 0
+#define CONFIG_LIBMODPLUG_DEMUXER 0
+#define CONFIG_LIBOPENMPT_DEMUXER 0
+#define CONFIG_A64MULTI_ENCODER 0
+#define CONFIG_A64MULTI5_ENCODER 0
+#define CONFIG_ALIAS_PIX_ENCODER 0
+#define CONFIG_AMV_ENCODER 0
+#define CONFIG_APNG_ENCODER 0
+#define CONFIG_ASV1_ENCODER 0
+#define CONFIG_ASV2_ENCODER 0
+#define CONFIG_AVRP_ENCODER 0
+#define CONFIG_AVUI_ENCODER 0
+#define CONFIG_AYUV_ENCODER 0
+#define CONFIG_BMP_ENCODER 0
+#define CONFIG_CINEPAK_ENCODER 0
+#define CONFIG_CLJR_ENCODER 0
+#define CONFIG_COMFORTNOISE_ENCODER 0
+#define CONFIG_DNXHD_ENCODER 0
+#define CONFIG_DPX_ENCODER 0
+#define CONFIG_DVVIDEO_ENCODER 0
+#define CONFIG_FFV1_ENCODER 0
+#define CONFIG_FFVHUFF_ENCODER 0
+#define CONFIG_FITS_ENCODER 0
+#define CONFIG_FLASHSV_ENCODER 0
+#define CONFIG_FLASHSV2_ENCODER 0
+#define CONFIG_FLV_ENCODER 0
+#define CONFIG_GIF_ENCODER 0
+#define CONFIG_H261_ENCODER 0
+#define CONFIG_H263_ENCODER 0
+#define CONFIG_H263P_ENCODER 0
+#define CONFIG_HAP_ENCODER 0
+#define CONFIG_HUFFYUV_ENCODER 0
+#define CONFIG_JPEG2000_ENCODER 0
+#define CONFIG_JPEGLS_ENCODER 0
+#define CONFIG_LJPEG_ENCODER 0
+#define CONFIG_MJPEG_ENCODER 0
+#define CONFIG_MPEG1VIDEO_ENCODER 0
+#define CONFIG_MPEG2VIDEO_ENCODER 0
+#define CONFIG_MPEG4_ENCODER 0
+#define CONFIG_MSMPEG4V2_ENCODER 0
+#define CONFIG_MSMPEG4V3_ENCODER 0
+#define CONFIG_MSVIDEO1_ENCODER 0
+#define CONFIG_PAM_ENCODER 0
+#define CONFIG_PBM_ENCODER 0
+#define CONFIG_PCX_ENCODER 0
+#define CONFIG_PGM_ENCODER 0
+#define CONFIG_PGMYUV_ENCODER 0
+#define CONFIG_PNG_ENCODER 0
+#define CONFIG_PPM_ENCODER 0
+#define CONFIG_PRORES_ENCODER 0
+#define CONFIG_PRORES_AW_ENCODER 0
+#define CONFIG_PRORES_KS_ENCODER 0
+#define CONFIG_QTRLE_ENCODER 0
+#define CONFIG_R10K_ENCODER 0
+#define CONFIG_R210_ENCODER 0
+#define CONFIG_RAWVIDEO_ENCODER 0
+#define CONFIG_ROQ_ENCODER 0
+#define CONFIG_RV10_ENCODER 0
+#define CONFIG_RV20_ENCODER 0
+#define CONFIG_S302M_ENCODER 0
+#define CONFIG_SGI_ENCODER 0
+#define CONFIG_SNOW_ENCODER 0
+#define CONFIG_SUNRAST_ENCODER 0
+#define CONFIG_SVQ1_ENCODER 0
+#define CONFIG_TARGA_ENCODER 0
+#define CONFIG_TIFF_ENCODER 0
+#define CONFIG_UTVIDEO_ENCODER 0
+#define CONFIG_V210_ENCODER 0
+#define CONFIG_V308_ENCODER 0
+#define CONFIG_V408_ENCODER 0
+#define CONFIG_V410_ENCODER 0
+#define CONFIG_VC2_ENCODER 0
+#define CONFIG_WRAPPED_AVFRAME_ENCODER 0
+#define CONFIG_WMV1_ENCODER 0
+#define CONFIG_WMV2_ENCODER 0
+#define CONFIG_XBM_ENCODER 0
+#define CONFIG_XFACE_ENCODER 0
+#define CONFIG_XWD_ENCODER 0
+#define CONFIG_Y41P_ENCODER 0
+#define CONFIG_YUV4_ENCODER 0
+#define CONFIG_ZLIB_ENCODER 0
+#define CONFIG_ZMBV_ENCODER 0
+#define CONFIG_AAC_ENCODER 0
+#define CONFIG_AC3_ENCODER 0
+#define CONFIG_AC3_FIXED_ENCODER 0
+#define CONFIG_ALAC_ENCODER 0
+#define CONFIG_DCA_ENCODER 0
+#define CONFIG_EAC3_ENCODER 0
+#define CONFIG_FLAC_ENCODER 0
+#define CONFIG_G723_1_ENCODER 0
+#define CONFIG_MLP_ENCODER 0
+#define CONFIG_MP2_ENCODER 0
+#define CONFIG_MP2FIXED_ENCODER 0
+#define CONFIG_NELLYMOSER_ENCODER 0
+#define CONFIG_OPUS_ENCODER 0
+#define CONFIG_RA_144_ENCODER 0
+#define CONFIG_SONIC_ENCODER 0
+#define CONFIG_SONIC_LS_ENCODER 0
+#define CONFIG_TRUEHD_ENCODER 0
+#define CONFIG_TTA_ENCODER 0
+#define CONFIG_VORBIS_ENCODER 0
+#define CONFIG_WAVPACK_ENCODER 0
+#define CONFIG_WMAV1_ENCODER 0
+#define CONFIG_WMAV2_ENCODER 0
+#define CONFIG_PCM_ALAW_ENCODER 0
+#define CONFIG_PCM_F32BE_ENCODER 0
+#define CONFIG_PCM_F32LE_ENCODER 0
+#define CONFIG_PCM_F64BE_ENCODER 0
+#define CONFIG_PCM_F64LE_ENCODER 0
+#define CONFIG_PCM_MULAW_ENCODER 0
+#define CONFIG_PCM_S8_ENCODER 0
+#define CONFIG_PCM_S8_PLANAR_ENCODER 0
+#define CONFIG_PCM_S16BE_ENCODER 0
+#define CONFIG_PCM_S16BE_PLANAR_ENCODER 0
+#define CONFIG_PCM_S16LE_ENCODER 0
+#define CONFIG_PCM_S16LE_PLANAR_ENCODER 0
+#define CONFIG_PCM_S24BE_ENCODER 0
+#define CONFIG_PCM_S24DAUD_ENCODER 0
+#define CONFIG_PCM_S24LE_ENCODER 0
+#define CONFIG_PCM_S24LE_PLANAR_ENCODER 0
+#define CONFIG_PCM_S32BE_ENCODER 0
+#define CONFIG_PCM_S32LE_ENCODER 0
+#define CONFIG_PCM_S32LE_PLANAR_ENCODER 0
+#define CONFIG_PCM_S64BE_ENCODER 0
+#define CONFIG_PCM_S64LE_ENCODER 0
+#define CONFIG_PCM_U8_ENCODER 0
+#define CONFIG_PCM_U16BE_ENCODER 0
+#define CONFIG_PCM_U16LE_ENCODER 0
+#define CONFIG_PCM_U24BE_ENCODER 0
+#define CONFIG_PCM_U24LE_ENCODER 0
+#define CONFIG_PCM_U32BE_ENCODER 0
+#define CONFIG_PCM_U32LE_ENCODER 0
+#define CONFIG_ROQ_DPCM_ENCODER 0
+#define CONFIG_ADPCM_ADX_ENCODER 0
+#define CONFIG_ADPCM_G722_ENCODER 0
+#define CONFIG_ADPCM_G726_ENCODER 0
+#define CONFIG_ADPCM_G726LE_ENCODER 0
+#define CONFIG_ADPCM_IMA_QT_ENCODER 0
+#define CONFIG_ADPCM_IMA_WAV_ENCODER 0
+#define CONFIG_ADPCM_MS_ENCODER 0
+#define CONFIG_ADPCM_SWF_ENCODER 0
+#define CONFIG_ADPCM_YAMAHA_ENCODER 0
+#define CONFIG_SSA_ENCODER 0
+#define CONFIG_ASS_ENCODER 0
+#define CONFIG_DVBSUB_ENCODER 0
+#define CONFIG_DVDSUB_ENCODER 0
+#define CONFIG_MOVTEXT_ENCODER 0
+#define CONFIG_SRT_ENCODER 0
+#define CONFIG_SUBRIP_ENCODER 0
+#define CONFIG_TEXT_ENCODER 0
+#define CONFIG_WEBVTT_ENCODER 0
+#define CONFIG_XSUB_ENCODER 0
+#define CONFIG_AAC_AT_ENCODER 0
+#define CONFIG_ALAC_AT_ENCODER 0
+#define CONFIG_ILBC_AT_ENCODER 0
+#define CONFIG_PCM_ALAW_AT_ENCODER 0
+#define CONFIG_PCM_MULAW_AT_ENCODER 0
+#define CONFIG_LIBFDK_AAC_ENCODER 0
+#define CONFIG_LIBGSM_ENCODER 0
+#define CONFIG_LIBGSM_MS_ENCODER 0
+#define CONFIG_LIBILBC_ENCODER 0
+#define CONFIG_LIBMP3LAME_ENCODER 0
+#define CONFIG_LIBOPENCORE_AMRNB_ENCODER 0
+#define CONFIG_LIBOPENJPEG_ENCODER 0
+#define CONFIG_LIBOPUS_ENCODER 0
+#define CONFIG_LIBSHINE_ENCODER 0
+#define CONFIG_LIBSPEEX_ENCODER 0
+#define CONFIG_LIBTHEORA_ENCODER 0
+#define CONFIG_LIBTWOLAME_ENCODER 0
+#define CONFIG_LIBVO_AMRWBENC_ENCODER 0
+#define CONFIG_LIBVORBIS_ENCODER 0
+#define CONFIG_LIBVPX_VP8_ENCODER 0
+#define CONFIG_LIBVPX_VP9_ENCODER 0
+#define CONFIG_LIBWAVPACK_ENCODER 0
+#define CONFIG_LIBWEBP_ANIM_ENCODER 0
+#define CONFIG_LIBWEBP_ENCODER 0
+#define CONFIG_LIBX262_ENCODER 0
+#define CONFIG_LIBX264_ENCODER 0
+#define CONFIG_LIBX264RGB_ENCODER 0
+#define CONFIG_LIBX265_ENCODER 0
+#define CONFIG_LIBXAVS_ENCODER 0
+#define CONFIG_LIBXVID_ENCODER 0
+#define CONFIG_H263_V4L2M2M_ENCODER 0
+#define CONFIG_LIBOPENH264_ENCODER 0
+#define CONFIG_H264_NVENC_ENCODER 0
+#define CONFIG_H264_OMX_ENCODER 0
+#define CONFIG_H264_QSV_ENCODER 0
+#define CONFIG_H264_V4L2M2M_ENCODER 0
+#define CONFIG_H264_VAAPI_ENCODER 0
+#define CONFIG_H264_VIDEOTOOLBOX_ENCODER 0
+#define CONFIG_NVENC_ENCODER 0
+#define CONFIG_NVENC_H264_ENCODER 0
+#define CONFIG_NVENC_HEVC_ENCODER 0
+#define CONFIG_HEVC_NVENC_ENCODER 0
+#define CONFIG_HEVC_QSV_ENCODER 0
+#define CONFIG_HEVC_V4L2M2M_ENCODER 0
+#define CONFIG_HEVC_VAAPI_ENCODER 0
+#define CONFIG_LIBKVAZAAR_ENCODER 0
+#define CONFIG_MJPEG_VAAPI_ENCODER 0
+#define CONFIG_MPEG2_QSV_ENCODER 0
+#define CONFIG_MPEG2_VAAPI_ENCODER 0
+#define CONFIG_MPEG4_V4L2M2M_ENCODER 0
+#define CONFIG_VP8_V4L2M2M_ENCODER 0
+#define CONFIG_VP8_VAAPI_ENCODER 0
+#define CONFIG_VP9_VAAPI_ENCODER 0
+#define CONFIG_ABENCH_FILTER 0
+#define CONFIG_ACOMPRESSOR_FILTER 0
+#define CONFIG_ACOPY_FILTER 0
+#define CONFIG_ACROSSFADE_FILTER 0
+#define CONFIG_ACRUSHER_FILTER 0
+#define CONFIG_ADELAY_FILTER 0
+#define CONFIG_AECHO_FILTER 0
+#define CONFIG_AEMPHASIS_FILTER 0
+#define CONFIG_AEVAL_FILTER 0
+#define CONFIG_AFADE_FILTER 0
+#define CONFIG_AFFTFILT_FILTER 0
+#define CONFIG_AFIR_FILTER 0
+#define CONFIG_AFORMAT_FILTER 0
+#define CONFIG_AGATE_FILTER 0
+#define CONFIG_AINTERLEAVE_FILTER 0
+#define CONFIG_ALIMITER_FILTER 0
+#define CONFIG_ALLPASS_FILTER 0
+#define CONFIG_ALOOP_FILTER 0
+#define CONFIG_AMERGE_FILTER 0
+#define CONFIG_AMETADATA_FILTER 0
+#define CONFIG_AMIX_FILTER 0
+#define CONFIG_ANEQUALIZER_FILTER 0
+#define CONFIG_ANULL_FILTER 0
+#define CONFIG_APAD_FILTER 0
+#define CONFIG_APERMS_FILTER 0
+#define CONFIG_APHASER_FILTER 0
+#define CONFIG_APULSATOR_FILTER 0
+#define CONFIG_AREALTIME_FILTER 0
+#define CONFIG_ARESAMPLE_FILTER 0
+#define CONFIG_AREVERSE_FILTER 0
+#define CONFIG_ASELECT_FILTER 0
+#define CONFIG_ASENDCMD_FILTER 0
+#define CONFIG_ASETNSAMPLES_FILTER 0
+#define CONFIG_ASETPTS_FILTER 0
+#define CONFIG_ASETRATE_FILTER 0
+#define CONFIG_ASETTB_FILTER 0
+#define CONFIG_ASHOWINFO_FILTER 0
+#define CONFIG_ASIDEDATA_FILTER 0
+#define CONFIG_ASPLIT_FILTER 0
+#define CONFIG_ASTATS_FILTER 0
+#define CONFIG_ASTREAMSELECT_FILTER 0
+#define CONFIG_ATEMPO_FILTER 0
+#define CONFIG_ATRIM_FILTER 0
+#define CONFIG_AZMQ_FILTER 0
+#define CONFIG_BANDPASS_FILTER 0
+#define CONFIG_BANDREJECT_FILTER 0
+#define CONFIG_BASS_FILTER 0
+#define CONFIG_BIQUAD_FILTER 0
+#define CONFIG_BS2B_FILTER 0
+#define CONFIG_CHANNELMAP_FILTER 0
+#define CONFIG_CHANNELSPLIT_FILTER 0
+#define CONFIG_CHORUS_FILTER 0
+#define CONFIG_COMPAND_FILTER 0
+#define CONFIG_COMPENSATIONDELAY_FILTER 0
+#define CONFIG_CROSSFEED_FILTER 0
+#define CONFIG_CRYSTALIZER_FILTER 0
+#define CONFIG_DCSHIFT_FILTER 0
+#define CONFIG_DYNAUDNORM_FILTER 0
+#define CONFIG_EARWAX_FILTER 0
+#define CONFIG_EBUR128_FILTER 0
+#define CONFIG_EQUALIZER_FILTER 0
+#define CONFIG_EXTRASTEREO_FILTER 0
+#define CONFIG_FIREQUALIZER_FILTER 0
+#define CONFIG_FLANGER_FILTER 0
+#define CONFIG_HAAS_FILTER 0
+#define CONFIG_HDCD_FILTER 0
+#define CONFIG_HEADPHONE_FILTER 0
+#define CONFIG_HIGHPASS_FILTER 0
+#define CONFIG_JOIN_FILTER 0
+#define CONFIG_LADSPA_FILTER 0
+#define CONFIG_LOUDNORM_FILTER 0
+#define CONFIG_LOWPASS_FILTER 0
+#define CONFIG_PAN_FILTER 0
+#define CONFIG_REPLAYGAIN_FILTER 0
+#define CONFIG_RESAMPLE_FILTER 0
+#define CONFIG_RUBBERBAND_FILTER 0
+#define CONFIG_SIDECHAINCOMPRESS_FILTER 0
+#define CONFIG_SIDECHAINGATE_FILTER 0
+#define CONFIG_SILENCEDETECT_FILTER 0
+#define CONFIG_SILENCEREMOVE_FILTER 0
+#define CONFIG_SOFALIZER_FILTER 0
+#define CONFIG_STEREOTOOLS_FILTER 0
+#define CONFIG_STEREOWIDEN_FILTER 0
+#define CONFIG_SUPEREQUALIZER_FILTER 0
+#define CONFIG_SURROUND_FILTER 0
+#define CONFIG_TREBLE_FILTER 0
+#define CONFIG_TREMOLO_FILTER 0
+#define CONFIG_VIBRATO_FILTER 0
+#define CONFIG_VOLUME_FILTER 0
+#define CONFIG_VOLUMEDETECT_FILTER 0
+#define CONFIG_AEVALSRC_FILTER 0
+#define CONFIG_ANOISESRC_FILTER 0
+#define CONFIG_ANULLSRC_FILTER 0
+#define CONFIG_FLITE_FILTER 0
+#define CONFIG_SINE_FILTER 0
+#define CONFIG_ANULLSINK_FILTER 0
+#define CONFIG_ALPHAEXTRACT_FILTER 0
+#define CONFIG_ALPHAMERGE_FILTER 0
+#define CONFIG_ASS_FILTER 0
+#define CONFIG_ATADENOISE_FILTER 0
+#define CONFIG_AVGBLUR_FILTER 0
+#define CONFIG_BBOX_FILTER 0
+#define CONFIG_BENCH_FILTER 0
+#define CONFIG_BITPLANENOISE_FILTER 0
+#define CONFIG_BLACKDETECT_FILTER 0
+#define CONFIG_BLACKFRAME_FILTER 0
+#define CONFIG_BLEND_FILTER 0
+#define CONFIG_BOXBLUR_FILTER 0
+#define CONFIG_BWDIF_FILTER 0
+#define CONFIG_CHROMAKEY_FILTER 0
+#define CONFIG_CIESCOPE_FILTER 0
+#define CONFIG_CODECVIEW_FILTER 0
+#define CONFIG_COLORBALANCE_FILTER 0
+#define CONFIG_COLORCHANNELMIXER_FILTER 0
+#define CONFIG_COLORKEY_FILTER 0
+#define CONFIG_COLORLEVELS_FILTER 0
+#define CONFIG_COLORMATRIX_FILTER 0
+#define CONFIG_COLORSPACE_FILTER 0
+#define CONFIG_CONVOLUTION_FILTER 0
+#define CONFIG_CONVOLVE_FILTER 0
+#define CONFIG_COPY_FILTER 0
+#define CONFIG_COREIMAGE_FILTER 0
+#define CONFIG_COVER_RECT_FILTER 0
+#define CONFIG_CROP_FILTER 0
+#define CONFIG_CROPDETECT_FILTER 0
+#define CONFIG_CURVES_FILTER 0
+#define CONFIG_DATASCOPE_FILTER 0
+#define CONFIG_DCTDNOIZ_FILTER 0
+#define CONFIG_DEBAND_FILTER 0
+#define CONFIG_DECIMATE_FILTER 0
+#define CONFIG_DEFLATE_FILTER 0
+#define CONFIG_DEFLICKER_FILTER 0
+#define CONFIG_DEINTERLACE_QSV_FILTER 0
+#define CONFIG_DEINTERLACE_VAAPI_FILTER 0
+#define CONFIG_DEJUDDER_FILTER 0
+#define CONFIG_DELOGO_FILTER 0
+#define CONFIG_DESHAKE_FILTER 0
+#define CONFIG_DESPILL_FILTER 0
+#define CONFIG_DETELECINE_FILTER 0
+#define CONFIG_DILATION_FILTER 0
+#define CONFIG_DISPLACE_FILTER 0
+#define CONFIG_DOUBLEWEAVE_FILTER 0
+#define CONFIG_DRAWBOX_FILTER 0
+#define CONFIG_DRAWGRAPH_FILTER 0
+#define CONFIG_DRAWGRID_FILTER 0
+#define CONFIG_DRAWTEXT_FILTER 0
+#define CONFIG_EDGEDETECT_FILTER 0
+#define CONFIG_ELBG_FILTER 0
+#define CONFIG_EQ_FILTER 0
+#define CONFIG_EROSION_FILTER 0
+#define CONFIG_EXTRACTPLANES_FILTER 0
+#define CONFIG_FADE_FILTER 0
+#define CONFIG_FFTFILT_FILTER 0
+#define CONFIG_FIELD_FILTER 0
+#define CONFIG_FIELDHINT_FILTER 0
+#define CONFIG_FIELDMATCH_FILTER 0
+#define CONFIG_FIELDORDER_FILTER 0
+#define CONFIG_FIND_RECT_FILTER 0
+#define CONFIG_FLOODFILL_FILTER 0
+#define CONFIG_FORMAT_FILTER 0
+#define CONFIG_FPS_FILTER 0
+#define CONFIG_FRAMEPACK_FILTER 0
+#define CONFIG_FRAMERATE_FILTER 0
+#define CONFIG_FRAMESTEP_FILTER 0
+#define CONFIG_FREI0R_FILTER 0
+#define CONFIG_FSPP_FILTER 0
+#define CONFIG_GBLUR_FILTER 0
+#define CONFIG_GEQ_FILTER 0
+#define CONFIG_GRADFUN_FILTER 0
+#define CONFIG_HALDCLUT_FILTER 0
+#define CONFIG_HFLIP_FILTER 0
+#define CONFIG_HISTEQ_FILTER 0
+#define CONFIG_HISTOGRAM_FILTER 0
+#define CONFIG_HQDN3D_FILTER 0
+#define CONFIG_HQX_FILTER 0
+#define CONFIG_HSTACK_FILTER 0
+#define CONFIG_HUE_FILTER 0
+#define CONFIG_HWDOWNLOAD_FILTER 0
+#define CONFIG_HWMAP_FILTER 0
+#define CONFIG_HWUPLOAD_FILTER 0
+#define CONFIG_HWUPLOAD_CUDA_FILTER 0
+#define CONFIG_HYSTERESIS_FILTER 0
+#define CONFIG_IDET_FILTER 0
+#define CONFIG_IL_FILTER 0
+#define CONFIG_INFLATE_FILTER 0
+#define CONFIG_INTERLACE_FILTER 0
+#define CONFIG_INTERLEAVE_FILTER 0
+#define CONFIG_KERNDEINT_FILTER 0
+#define CONFIG_LENSCORRECTION_FILTER 0
+#define CONFIG_LIBVMAF_FILTER 0
+#define CONFIG_LIMITER_FILTER 0
+#define CONFIG_LOOP_FILTER 0
+#define CONFIG_LUMAKEY_FILTER 0
+#define CONFIG_LUT_FILTER 0
+#define CONFIG_LUT2_FILTER 0
+#define CONFIG_LUT3D_FILTER 0
+#define CONFIG_LUTRGB_FILTER 0
+#define CONFIG_LUTYUV_FILTER 0
+#define CONFIG_MASKEDCLAMP_FILTER 0
+#define CONFIG_MASKEDMERGE_FILTER 0
+#define CONFIG_MCDEINT_FILTER 0
+#define CONFIG_MERGEPLANES_FILTER 0
+#define CONFIG_MESTIMATE_FILTER 0
+#define CONFIG_METADATA_FILTER 0
+#define CONFIG_MIDEQUALIZER_FILTER 0
+#define CONFIG_MINTERPOLATE_FILTER 0
+#define CONFIG_MPDECIMATE_FILTER 0
+#define CONFIG_NEGATE_FILTER 0
+#define CONFIG_NLMEANS_FILTER 0
+#define CONFIG_NNEDI_FILTER 0
+#define CONFIG_NOFORMAT_FILTER 0
+#define CONFIG_NOISE_FILTER 0
+#define CONFIG_NULL_FILTER 0
+#define CONFIG_OCR_FILTER 0
+#define CONFIG_OCV_FILTER 0
+#define CONFIG_OSCILLOSCOPE_FILTER 0
+#define CONFIG_OVERLAY_FILTER 0
+#define CONFIG_OWDENOISE_FILTER 0
+#define CONFIG_PAD_FILTER 0
+#define CONFIG_PALETTEGEN_FILTER 0
+#define CONFIG_PALETTEUSE_FILTER 0
+#define CONFIG_PERMS_FILTER 0
+#define CONFIG_PERSPECTIVE_FILTER 0
+#define CONFIG_PHASE_FILTER 0
+#define CONFIG_PIXDESCTEST_FILTER 0
+#define CONFIG_PIXSCOPE_FILTER 0
+#define CONFIG_PP_FILTER 0
+#define CONFIG_PP7_FILTER 0
+#define CONFIG_PREMULTIPLY_FILTER 0
+#define CONFIG_PREWITT_FILTER 0
+#define CONFIG_PSEUDOCOLOR_FILTER 0
+#define CONFIG_PSNR_FILTER 0
+#define CONFIG_PULLUP_FILTER 0
+#define CONFIG_QP_FILTER 0
+#define CONFIG_RANDOM_FILTER 0
+#define CONFIG_READEIA608_FILTER 0
+#define CONFIG_READVITC_FILTER 0
+#define CONFIG_REALTIME_FILTER 0
+#define CONFIG_REMAP_FILTER 0
+#define CONFIG_REMOVEGRAIN_FILTER 0
+#define CONFIG_REMOVELOGO_FILTER 0
+#define CONFIG_REPEATFIELDS_FILTER 0
+#define CONFIG_REVERSE_FILTER 0
+#define CONFIG_ROBERTS_FILTER 0
+#define CONFIG_ROTATE_FILTER 0
+#define CONFIG_SAB_FILTER 0
+#define CONFIG_SCALE_FILTER 0
+#define CONFIG_SCALE_CUDA_FILTER 0
+#define CONFIG_SCALE_NPP_FILTER 0
+#define CONFIG_SCALE_QSV_FILTER 0
+#define CONFIG_SCALE_VAAPI_FILTER 0
+#define CONFIG_SCALE2REF_FILTER 0
+#define CONFIG_SELECT_FILTER 0
+#define CONFIG_SELECTIVECOLOR_FILTER 0
+#define CONFIG_SENDCMD_FILTER 0
+#define CONFIG_SEPARATEFIELDS_FILTER 0
+#define CONFIG_SETDAR_FILTER 0
+#define CONFIG_SETFIELD_FILTER 0
+#define CONFIG_SETPTS_FILTER 0
+#define CONFIG_SETSAR_FILTER 0
+#define CONFIG_SETTB_FILTER 0
+#define CONFIG_SHOWINFO_FILTER 0
+#define CONFIG_SHOWPALETTE_FILTER 0
+#define CONFIG_SHUFFLEFRAMES_FILTER 0
+#define CONFIG_SHUFFLEPLANES_FILTER 0
+#define CONFIG_SIDEDATA_FILTER 0
+#define CONFIG_SIGNALSTATS_FILTER 0
+#define CONFIG_SIGNATURE_FILTER 0
+#define CONFIG_SMARTBLUR_FILTER 0
+#define CONFIG_SOBEL_FILTER 0
+#define CONFIG_SPLIT_FILTER 0
+#define CONFIG_SPP_FILTER 0
+#define CONFIG_SSIM_FILTER 0
+#define CONFIG_STEREO3D_FILTER 0
+#define CONFIG_STREAMSELECT_FILTER 0
+#define CONFIG_SUBTITLES_FILTER 0
+#define CONFIG_SUPER2XSAI_FILTER 0
+#define CONFIG_SWAPRECT_FILTER 0
+#define CONFIG_SWAPUV_FILTER 0
+#define CONFIG_TBLEND_FILTER 0
+#define CONFIG_TELECINE_FILTER 0
+#define CONFIG_THRESHOLD_FILTER 0
+#define CONFIG_THUMBNAIL_FILTER 0
+#define CONFIG_THUMBNAIL_CUDA_FILTER 0
+#define CONFIG_TILE_FILTER 0
+#define CONFIG_TINTERLACE_FILTER 0
+#define CONFIG_TLUT2_FILTER 0
+#define CONFIG_TONEMAP_FILTER 0
+#define CONFIG_TRANSPOSE_FILTER 0
+#define CONFIG_TRIM_FILTER 0
+#define CONFIG_UNPREMULTIPLY_FILTER 0
+#define CONFIG_UNSHARP_FILTER 0
+#define CONFIG_USPP_FILTER 0
+#define CONFIG_VAGUEDENOISER_FILTER 0
+#define CONFIG_VECTORSCOPE_FILTER 0
+#define CONFIG_VFLIP_FILTER 0
+#define CONFIG_VIDSTABDETECT_FILTER 0
+#define CONFIG_VIDSTABTRANSFORM_FILTER 0
+#define CONFIG_VIGNETTE_FILTER 0
+#define CONFIG_VMAFMOTION_FILTER 0
+#define CONFIG_VSTACK_FILTER 0
+#define CONFIG_W3FDIF_FILTER 0
+#define CONFIG_WAVEFORM_FILTER 0
+#define CONFIG_WEAVE_FILTER 0
+#define CONFIG_XBR_FILTER 0
+#define CONFIG_YADIF_FILTER 0
+#define CONFIG_ZMQ_FILTER 0
+#define CONFIG_ZOOMPAN_FILTER 0
+#define CONFIG_ZSCALE_FILTER 0
+#define CONFIG_ALLRGB_FILTER 0
+#define CONFIG_ALLYUV_FILTER 0
+#define CONFIG_CELLAUTO_FILTER 0
+#define CONFIG_COLOR_FILTER 0
+#define CONFIG_COREIMAGESRC_FILTER 0
+#define CONFIG_FREI0R_SRC_FILTER 0
+#define CONFIG_HALDCLUTSRC_FILTER 0
+#define CONFIG_LIFE_FILTER 0
+#define CONFIG_MANDELBROT_FILTER 0
+#define CONFIG_MPTESTSRC_FILTER 0
+#define CONFIG_NULLSRC_FILTER 0
+#define CONFIG_RGBTESTSRC_FILTER 0
+#define CONFIG_SMPTEBARS_FILTER 0
+#define CONFIG_SMPTEHDBARS_FILTER 0
+#define CONFIG_TESTSRC_FILTER 0
+#define CONFIG_TESTSRC2_FILTER 0
+#define CONFIG_YUVTESTSRC_FILTER 0
+#define CONFIG_NULLSINK_FILTER 0
+#define CONFIG_ABITSCOPE_FILTER 0
+#define CONFIG_ADRAWGRAPH_FILTER 0
+#define CONFIG_AHISTOGRAM_FILTER 0
+#define CONFIG_APHASEMETER_FILTER 0
+#define CONFIG_AVECTORSCOPE_FILTER 0
+#define CONFIG_CONCAT_FILTER 0
+#define CONFIG_SHOWCQT_FILTER 0
+#define CONFIG_SHOWFREQS_FILTER 0
+#define CONFIG_SHOWSPECTRUM_FILTER 0
+#define CONFIG_SHOWSPECTRUMPIC_FILTER 0
+#define CONFIG_SHOWVOLUME_FILTER 0
+#define CONFIG_SHOWWAVES_FILTER 0
+#define CONFIG_SHOWWAVESPIC_FILTER 0
+#define CONFIG_SPECTRUMSYNTH_FILTER 0
+#define CONFIG_AMOVIE_FILTER 0
+#define CONFIG_MOVIE_FILTER 0
+#define CONFIG_H263_VAAPI_HWACCEL 0
+#define CONFIG_H263_VIDEOTOOLBOX_HWACCEL 0
+#define CONFIG_H264_CUVID_HWACCEL 0
+#define CONFIG_H264_D3D11VA_HWACCEL 0
+#define CONFIG_H264_D3D11VA2_HWACCEL 0
+#define CONFIG_H264_DXVA2_HWACCEL 0
+#define CONFIG_H264_MEDIACODEC_HWACCEL 0
+#define CONFIG_H264_MMAL_HWACCEL 0
+#define CONFIG_H264_QSV_HWACCEL 0
+#define CONFIG_H264_VAAPI_HWACCEL 0
+#define CONFIG_H264_VDA_HWACCEL 0
+#define CONFIG_H264_VDA_OLD_HWACCEL 0
+#define CONFIG_H264_VDPAU_HWACCEL 0
+#define CONFIG_H264_VIDEOTOOLBOX_HWACCEL 0
+#define CONFIG_HEVC_CUVID_HWACCEL 0
+#define CONFIG_HEVC_D3D11VA_HWACCEL 0
+#define CONFIG_HEVC_D3D11VA2_HWACCEL 0
+#define CONFIG_HEVC_DXVA2_HWACCEL 0
+#define CONFIG_HEVC_MEDIACODEC_HWACCEL 0
+#define CONFIG_HEVC_QSV_HWACCEL 0
+#define CONFIG_HEVC_VAAPI_HWACCEL 0
+#define CONFIG_HEVC_VDPAU_HWACCEL 0
+#define CONFIG_HEVC_VIDEOTOOLBOX_HWACCEL 0
+#define CONFIG_MJPEG_CUVID_HWACCEL 0
+#define CONFIG_MPEG1_CUVID_HWACCEL 0
+#define CONFIG_MPEG1_XVMC_HWACCEL 0
+#define CONFIG_MPEG1_VDPAU_HWACCEL 0
+#define CONFIG_MPEG1_VIDEOTOOLBOX_HWACCEL 0
+#define CONFIG_MPEG2_CUVID_HWACCEL 0
+#define CONFIG_MPEG2_XVMC_HWACCEL 0
+#define CONFIG_MPEG2_D3D11VA_HWACCEL 0
+#define CONFIG_MPEG2_D3D11VA2_HWACCEL 0
+#define CONFIG_MPEG2_DXVA2_HWACCEL 0
+#define CONFIG_MPEG2_MMAL_HWACCEL 0
+#define CONFIG_MPEG2_QSV_HWACCEL 0
+#define CONFIG_MPEG2_VAAPI_HWACCEL 0
+#define CONFIG_MPEG2_VDPAU_HWACCEL 0
+#define CONFIG_MPEG2_VIDEOTOOLBOX_HWACCEL 0
+#define CONFIG_MPEG2_MEDIACODEC_HWACCEL 0
+#define CONFIG_MPEG4_CUVID_HWACCEL 0
+#define CONFIG_MPEG4_MEDIACODEC_HWACCEL 0
+#define CONFIG_MPEG4_MMAL_HWACCEL 0
+#define CONFIG_MPEG4_VAAPI_HWACCEL 0
+#define CONFIG_MPEG4_VDPAU_HWACCEL 0
+#define CONFIG_MPEG4_VIDEOTOOLBOX_HWACCEL 0
+#define CONFIG_VC1_CUVID_HWACCEL 0
+#define CONFIG_VC1_D3D11VA_HWACCEL 0
+#define CONFIG_VC1_D3D11VA2_HWACCEL 0
+#define CONFIG_VC1_DXVA2_HWACCEL 0
+#define CONFIG_VC1_VAAPI_HWACCEL 0
+#define CONFIG_VC1_VDPAU_HWACCEL 0
+#define CONFIG_VC1_MMAL_HWACCEL 0
+#define CONFIG_VC1_QSV_HWACCEL 0
+#define CONFIG_VP8_CUVID_HWACCEL 0
+#define CONFIG_VP8_MEDIACODEC_HWACCEL 0
+#define CONFIG_VP8_QSV_HWACCEL 0
+#define CONFIG_VP9_CUVID_HWACCEL 0
+#define CONFIG_VP9_D3D11VA_HWACCEL 0
+#define CONFIG_VP9_D3D11VA2_HWACCEL 0
+#define CONFIG_VP9_DXVA2_HWACCEL 0
+#define CONFIG_VP9_MEDIACODEC_HWACCEL 0
+#define CONFIG_VP9_VAAPI_HWACCEL 0
+#define CONFIG_WMV3_D3D11VA_HWACCEL 0
+#define CONFIG_WMV3_D3D11VA2_HWACCEL 0
+#define CONFIG_WMV3_DXVA2_HWACCEL 0
+#define CONFIG_WMV3_VAAPI_HWACCEL 0
+#define CONFIG_WMV3_VDPAU_HWACCEL 0
+#define CONFIG_ALSA_INDEV 0
+#define CONFIG_AVFOUNDATION_INDEV 0
+#define CONFIG_BKTR_INDEV 0
+#define CONFIG_DECKLINK_INDEV 0
+#define CONFIG_LIBNDI_NEWTEK_INDEV 0
+#define CONFIG_DSHOW_INDEV 0
+#define CONFIG_FBDEV_INDEV 0
+#define CONFIG_GDIGRAB_INDEV 0
+#define CONFIG_IEC61883_INDEV 0
+#define CONFIG_JACK_INDEV 0
+#define CONFIG_KMSGRAB_INDEV 0
+#define CONFIG_LAVFI_INDEV 0
+#define CONFIG_OPENAL_INDEV 0
+#define CONFIG_OSS_INDEV 0
+#define CONFIG_PULSE_INDEV 0
+#define CONFIG_SNDIO_INDEV 0
+#define CONFIG_V4L2_INDEV 0
+#define CONFIG_VFWCAP_INDEV 0
+#define CONFIG_XCBGRAB_INDEV 0
+#define CONFIG_LIBCDIO_INDEV 0
+#define CONFIG_LIBDC1394_INDEV 0
+#define CONFIG_A64_MUXER 0
+#define CONFIG_AC3_MUXER 0
+#define CONFIG_ADTS_MUXER 0
+#define CONFIG_ADX_MUXER 0
+#define CONFIG_AIFF_MUXER 0
+#define CONFIG_AMR_MUXER 0
+#define CONFIG_APNG_MUXER 0
+#define CONFIG_ASF_MUXER 0
+#define CONFIG_ASS_MUXER 0
+#define CONFIG_AST_MUXER 0
+#define CONFIG_ASF_STREAM_MUXER 0
+#define CONFIG_AU_MUXER 0
+#define CONFIG_AVI_MUXER 0
+#define CONFIG_AVM2_MUXER 0
+#define CONFIG_BIT_MUXER 0
+#define CONFIG_CAF_MUXER 0
+#define CONFIG_CAVSVIDEO_MUXER 0
+#define CONFIG_CRC_MUXER 0
+#define CONFIG_DASH_MUXER 0
+#define CONFIG_DATA_MUXER 0
+#define CONFIG_DAUD_MUXER 0
+#define CONFIG_DIRAC_MUXER 0
+#define CONFIG_DNXHD_MUXER 0
+#define CONFIG_DTS_MUXER 0
+#define CONFIG_DV_MUXER 0
+#define CONFIG_EAC3_MUXER 0
+#define CONFIG_F4V_MUXER 0
+#define CONFIG_FFM_MUXER 0
+#define CONFIG_FFMETADATA_MUXER 0
+#define CONFIG_FIFO_MUXER 0
+#define CONFIG_FILMSTRIP_MUXER 0
+#define CONFIG_FITS_MUXER 0
+#define CONFIG_FLAC_MUXER 0
+#define CONFIG_FLV_MUXER 0
+#define CONFIG_FRAMECRC_MUXER 0
+#define CONFIG_FRAMEHASH_MUXER 0
+#define CONFIG_FRAMEMD5_MUXER 0
+#define CONFIG_G722_MUXER 0
+#define CONFIG_G723_1_MUXER 0
+#define CONFIG_G726_MUXER 0
+#define CONFIG_G726LE_MUXER 0
+#define CONFIG_GIF_MUXER 0
+#define CONFIG_GSM_MUXER 0
+#define CONFIG_GXF_MUXER 0
+#define CONFIG_H261_MUXER 0
+#define CONFIG_H263_MUXER 0
+#define CONFIG_H264_MUXER 0
+#define CONFIG_HASH_MUXER 0
+#define CONFIG_HDS_MUXER 0
+#define CONFIG_HEVC_MUXER 0
+#define CONFIG_HLS_MUXER 0
+#define CONFIG_ICO_MUXER 0
+#define CONFIG_ILBC_MUXER 0
+#define CONFIG_IMAGE2_MUXER 0
+#define CONFIG_IMAGE2PIPE_MUXER 0
+#define CONFIG_IPOD_MUXER 0
+#define CONFIG_IRCAM_MUXER 0
+#define CONFIG_ISMV_MUXER 0
+#define CONFIG_IVF_MUXER 0
+#define CONFIG_JACOSUB_MUXER 0
+#define CONFIG_LATM_MUXER 0
+#define CONFIG_LRC_MUXER 0
+#define CONFIG_M4V_MUXER 0
+#define CONFIG_MD5_MUXER 0
+#define CONFIG_MATROSKA_MUXER 0
+#define CONFIG_MATROSKA_AUDIO_MUXER 0
+#define CONFIG_MICRODVD_MUXER 0
+#define CONFIG_MJPEG_MUXER 0
+#define CONFIG_MLP_MUXER 0
+#define CONFIG_MMF_MUXER 0
+#define CONFIG_MOV_MUXER 0
+#define CONFIG_MP2_MUXER 0
+#define CONFIG_MP3_MUXER 0
+#define CONFIG_MP4_MUXER 0
+#define CONFIG_MPEG1SYSTEM_MUXER 0
+#define CONFIG_MPEG1VCD_MUXER 0
+#define CONFIG_MPEG1VIDEO_MUXER 0
+#define CONFIG_MPEG2DVD_MUXER 0
+#define CONFIG_MPEG2SVCD_MUXER 0
+#define CONFIG_MPEG2VIDEO_MUXER 0
+#define CONFIG_MPEG2VOB_MUXER 0
+#define CONFIG_MPEGTS_MUXER 0
+#define CONFIG_MPJPEG_MUXER 0
+#define CONFIG_MXF_MUXER 0
+#define CONFIG_MXF_D10_MUXER 0
+#define CONFIG_MXF_OPATOM_MUXER 0
+#define CONFIG_NULL_MUXER 0
+#define CONFIG_NUT_MUXER 0
+#define CONFIG_OGA_MUXER 0
+#define CONFIG_OGG_MUXER 0
+#define CONFIG_OGV_MUXER 0
+#define CONFIG_OMA_MUXER 0
+#define CONFIG_OPUS_MUXER 0
+#define CONFIG_PCM_ALAW_MUXER 0
+#define CONFIG_PCM_MULAW_MUXER 0
+#define CONFIG_PCM_F64BE_MUXER 0
+#define CONFIG_PCM_F64LE_MUXER 0
+#define CONFIG_PCM_F32BE_MUXER 0
+#define CONFIG_PCM_F32LE_MUXER 0
+#define CONFIG_PCM_S32BE_MUXER 0
+#define CONFIG_PCM_S32LE_MUXER 0
+#define CONFIG_PCM_S24BE_MUXER 0
+#define CONFIG_PCM_S24LE_MUXER 0
+#define CONFIG_PCM_S16BE_MUXER 0
+#define CONFIG_PCM_S16LE_MUXER 0
+#define CONFIG_PCM_S8_MUXER 0
+#define CONFIG_PCM_U32BE_MUXER 0
+#define CONFIG_PCM_U32LE_MUXER 0
+#define CONFIG_PCM_U24BE_MUXER 0
+#define CONFIG_PCM_U24LE_MUXER 0
+#define CONFIG_PCM_U16BE_MUXER 0
+#define CONFIG_PCM_U16LE_MUXER 0
+#define CONFIG_PCM_U8_MUXER 0
+#define CONFIG_PSP_MUXER 0
+#define CONFIG_RAWVIDEO_MUXER 0
+#define CONFIG_RM_MUXER 0
+#define CONFIG_ROQ_MUXER 0
+#define CONFIG_RSO_MUXER 0
+#define CONFIG_RTP_MUXER 0
+#define CONFIG_RTP_MPEGTS_MUXER 0
+#define CONFIG_RTSP_MUXER 0
+#define CONFIG_SAP_MUXER 0
+#define CONFIG_SCC_MUXER 0
+#define CONFIG_SEGMENT_MUXER 0
+#define CONFIG_STREAM_SEGMENT_MUXER 0
+#define CONFIG_SINGLEJPEG_MUXER 0
+#define CONFIG_SMJPEG_MUXER 0
+#define CONFIG_SMOOTHSTREAMING_MUXER 0
+#define CONFIG_SOX_MUXER 0
+#define CONFIG_SPX_MUXER 0
+#define CONFIG_SPDIF_MUXER 0
+#define CONFIG_SRT_MUXER 0
+#define CONFIG_SUP_MUXER 0
+#define CONFIG_SWF_MUXER 0
+#define CONFIG_TEE_MUXER 0
+#define CONFIG_TG2_MUXER 0
+#define CONFIG_TGP_MUXER 0
+#define CONFIG_MKVTIMESTAMP_V2_MUXER 0
+#define CONFIG_TRUEHD_MUXER 0
+#define CONFIG_TTA_MUXER 0
+#define CONFIG_UNCODEDFRAMECRC_MUXER 0
+#define CONFIG_VC1_MUXER 0
+#define CONFIG_VC1T_MUXER 0
+#define CONFIG_VOC_MUXER 0
+#define CONFIG_W64_MUXER 0
+#define CONFIG_WAV_MUXER 0
+#define CONFIG_WEBM_MUXER 0
+#define CONFIG_WEBM_DASH_MANIFEST_MUXER 0
+#define CONFIG_WEBM_CHUNK_MUXER 0
+#define CONFIG_WEBP_MUXER 0
+#define CONFIG_WEBVTT_MUXER 0
+#define CONFIG_WTV_MUXER 0
+#define CONFIG_WV_MUXER 0
+#define CONFIG_YUV4MPEGPIPE_MUXER 0
+#define CONFIG_CHROMAPRINT_MUXER 0
+#define CONFIG_ALSA_OUTDEV 0
+#define CONFIG_CACA_OUTDEV 0
+#define CONFIG_DECKLINK_OUTDEV 0
+#define CONFIG_LIBNDI_NEWTEK_OUTDEV 0
+#define CONFIG_FBDEV_OUTDEV 0
+#define CONFIG_OPENGL_OUTDEV 0
+#define CONFIG_OSS_OUTDEV 0
+#define CONFIG_PULSE_OUTDEV 0
+#define CONFIG_SDL2_OUTDEV 0
+#define CONFIG_SNDIO_OUTDEV 0
+#define CONFIG_V4L2_OUTDEV 0
+#define CONFIG_XV_OUTDEV 0
+#define CONFIG_AAC_PARSER 0
+#define CONFIG_AAC_LATM_PARSER 0
+#define CONFIG_AC3_PARSER 0
+#define CONFIG_ADX_PARSER 0
+#define CONFIG_BMP_PARSER 0
+#define CONFIG_CAVSVIDEO_PARSER 0
+#define CONFIG_COOK_PARSER 0
+#define CONFIG_DCA_PARSER 0
+#define CONFIG_DIRAC_PARSER 0
+#define CONFIG_DNXHD_PARSER 0
+#define CONFIG_DPX_PARSER 0
+#define CONFIG_DVAUDIO_PARSER 0
+#define CONFIG_DVBSUB_PARSER 0
+#define CONFIG_DVDSUB_PARSER 0
+#define CONFIG_DVD_NAV_PARSER 0
+#define CONFIG_G729_PARSER 0
+#define CONFIG_GSM_PARSER 0
+#define CONFIG_H261_PARSER 0
+#define CONFIG_H263_PARSER 0
+#define CONFIG_H264_PARSER 0
+#define CONFIG_HEVC_PARSER 0
+#define CONFIG_MJPEG_PARSER 0
+#define CONFIG_MLP_PARSER 0
+#define CONFIG_MPEG4VIDEO_PARSER 0
+#define CONFIG_MPEGAUDIO_PARSER 0
+#define CONFIG_MPEGVIDEO_PARSER 0
+#define CONFIG_OPUS_PARSER 0
+#define CONFIG_PNG_PARSER 0
+#define CONFIG_PNM_PARSER 0
+#define CONFIG_RV30_PARSER 0
+#define CONFIG_RV40_PARSER 0
+#define CONFIG_SIPR_PARSER 0
+#define CONFIG_TAK_PARSER 0
+#define CONFIG_VC1_PARSER 0
+#define CONFIG_VORBIS_PARSER 0
+#define CONFIG_VP3_PARSER 0
+#define CONFIG_XMA_PARSER 0
+#define CONFIG_ASYNC_PROTOCOL 0
+#define CONFIG_BLURAY_PROTOCOL 0
+#define CONFIG_CACHE_PROTOCOL 0
+#define CONFIG_CONCAT_PROTOCOL 0
+#define CONFIG_CRYPTO_PROTOCOL 0
+#define CONFIG_DATA_PROTOCOL 0
+#define CONFIG_FFRTMPCRYPT_PROTOCOL 0
+#define CONFIG_FFRTMPHTTP_PROTOCOL 0
+#define CONFIG_FILE_PROTOCOL 0
+#define CONFIG_FTP_PROTOCOL 0
+#define CONFIG_GOPHER_PROTOCOL 0
+#define CONFIG_HLS_PROTOCOL 0
+#define CONFIG_HTTP_PROTOCOL 0
+#define CONFIG_HTTPPROXY_PROTOCOL 0
+#define CONFIG_HTTPS_PROTOCOL 0
+#define CONFIG_ICECAST_PROTOCOL 0
+#define CONFIG_MMSH_PROTOCOL 0
+#define CONFIG_MMST_PROTOCOL 0
+#define CONFIG_MD5_PROTOCOL 0
+#define CONFIG_PIPE_PROTOCOL 0
+#define CONFIG_PROMPEG_PROTOCOL 0
+#define CONFIG_RTMP_PROTOCOL 0
+#define CONFIG_RTMPE_PROTOCOL 0
+#define CONFIG_RTMPS_PROTOCOL 0
+#define CONFIG_RTMPT_PROTOCOL 0
+#define CONFIG_RTMPTE_PROTOCOL 0
+#define CONFIG_RTMPTS_PROTOCOL 0
+#define CONFIG_RTP_PROTOCOL 0
+#define CONFIG_SCTP_PROTOCOL 0
+#define CONFIG_SRTP_PROTOCOL 0
+#define CONFIG_SUBFILE_PROTOCOL 0
+#define CONFIG_TEE_PROTOCOL 0
+#define CONFIG_TCP_PROTOCOL 0
+#define CONFIG_TLS_GNUTLS_PROTOCOL 0
+#define CONFIG_TLS_SCHANNEL_PROTOCOL 0
+#define CONFIG_TLS_SECURETRANSPORT_PROTOCOL 0
+#define CONFIG_TLS_OPENSSL_PROTOCOL 0
+#define CONFIG_UDP_PROTOCOL 0
+#define CONFIG_UDPLITE_PROTOCOL 0
+#define CONFIG_UNIX_PROTOCOL 0
+#define CONFIG_LIBRTMP_PROTOCOL 0
+#define CONFIG_LIBRTMPE_PROTOCOL 0
+#define CONFIG_LIBRTMPS_PROTOCOL 0
+#define CONFIG_LIBRTMPT_PROTOCOL 0
+#define CONFIG_LIBRTMPTE_PROTOCOL 0
+#define CONFIG_LIBSSH_PROTOCOL 0
+#define CONFIG_LIBSMBCLIENT_PROTOCOL 0
diff --git a/media/ffvpx/ffvpxcommon.mozbuild b/media/ffvpx/ffvpxcommon.mozbuild
index 6d17e88074..620158694b 100644
--- a/media/ffvpx/ffvpxcommon.mozbuild
+++ b/media/ffvpx/ffvpxcommon.mozbuild
@@ -29,6 +29,8 @@ if CONFIG['FFVPX_ASFLAGS']:
else:
# Default to unix, similar to how ASFLAGS setup works in configure.in
ASFLAGS += ['-Pconfig_unix64.asm']
+ # default disabled components
+ ASFLAGS += ['-Pdefaults_disabled.asm']
LOCAL_INCLUDES += ['/media/ffvpx']
@@ -51,6 +53,8 @@ if CONFIG['GNU_CC']:
'-Wno-incompatible-pointer-types-discards-qualifiers',
'-Wno-string-conversion',
'-Wno-visibility',
+ # Workaround for https://bugs.llvm.org/show_bug.cgi?id=26828#c4 :
+ '-ffreestanding',
]
else:
CFLAGS += [
@@ -87,6 +91,7 @@ elif CONFIG['_MSC_VER']:
'-wd4057', '-wd4204', '-wd4706', '-wd4305', '-wd4152', '-wd4324',
'-we4013', '-wd4100', '-wd4214', '-wd4307', '-wd4273', '-wd4554',
]
+ LOCAL_INCLUDES += ['/media/ffvpx/compat/atomics/win32']
DEFINES['HAVE_AV_CONFIG_H'] = True
diff --git a/media/ffvpx/libavcodec/allcodecs.c b/media/ffvpx/libavcodec/allcodecs.c
index b592aa3b26..4f34312e67 100644
--- a/media/ffvpx/libavcodec/allcodecs.c
+++ b/media/ffvpx/libavcodec/allcodecs.c
@@ -25,6 +25,7 @@
*/
#include "config.h"
+#include "libavutil/thread.h"
#include "avcodec.h"
#include "version.h"
@@ -58,20 +59,14 @@
av_register_codec_parser(&ff_##x##_parser); \
}
-void avcodec_register_all(void)
+static void register_all(void)
{
- static int initialized;
-
- if (initialized)
- return;
- initialized = 1;
-
/* hardware accelerators */
- REGISTER_HWACCEL(H263_CUVID, h263_cuvid);
REGISTER_HWACCEL(H263_VAAPI, h263_vaapi);
REGISTER_HWACCEL(H263_VIDEOTOOLBOX, h263_videotoolbox);
REGISTER_HWACCEL(H264_CUVID, h264_cuvid);
REGISTER_HWACCEL(H264_D3D11VA, h264_d3d11va);
+ REGISTER_HWACCEL(H264_D3D11VA2, h264_d3d11va2);
REGISTER_HWACCEL(H264_DXVA2, h264_dxva2);
REGISTER_HWACCEL(H264_MEDIACODEC, h264_mediacodec);
REGISTER_HWACCEL(H264_MMAL, h264_mmal);
@@ -83,11 +78,13 @@ void avcodec_register_all(void)
REGISTER_HWACCEL(H264_VIDEOTOOLBOX, h264_videotoolbox);
REGISTER_HWACCEL(HEVC_CUVID, hevc_cuvid);
REGISTER_HWACCEL(HEVC_D3D11VA, hevc_d3d11va);
+ REGISTER_HWACCEL(HEVC_D3D11VA2, hevc_d3d11va2);
REGISTER_HWACCEL(HEVC_DXVA2, hevc_dxva2);
REGISTER_HWACCEL(HEVC_MEDIACODEC, hevc_mediacodec);
REGISTER_HWACCEL(HEVC_QSV, hevc_qsv);
REGISTER_HWACCEL(HEVC_VAAPI, hevc_vaapi);
REGISTER_HWACCEL(HEVC_VDPAU, hevc_vdpau);
+ REGISTER_HWACCEL(HEVC_VIDEOTOOLBOX, hevc_videotoolbox);
REGISTER_HWACCEL(MJPEG_CUVID, mjpeg_cuvid);
REGISTER_HWACCEL(MPEG1_CUVID, mpeg1_cuvid);
REGISTER_HWACCEL(MPEG1_XVMC, mpeg1_xvmc);
@@ -96,12 +93,14 @@ void avcodec_register_all(void)
REGISTER_HWACCEL(MPEG2_CUVID, mpeg2_cuvid);
REGISTER_HWACCEL(MPEG2_XVMC, mpeg2_xvmc);
REGISTER_HWACCEL(MPEG2_D3D11VA, mpeg2_d3d11va);
+ REGISTER_HWACCEL(MPEG2_D3D11VA2, mpeg2_d3d11va2);
REGISTER_HWACCEL(MPEG2_DXVA2, mpeg2_dxva2);
REGISTER_HWACCEL(MPEG2_MMAL, mpeg2_mmal);
REGISTER_HWACCEL(MPEG2_QSV, mpeg2_qsv);
REGISTER_HWACCEL(MPEG2_VAAPI, mpeg2_vaapi);
REGISTER_HWACCEL(MPEG2_VDPAU, mpeg2_vdpau);
REGISTER_HWACCEL(MPEG2_VIDEOTOOLBOX, mpeg2_videotoolbox);
+ REGISTER_HWACCEL(MPEG2_MEDIACODEC, mpeg2_mediacodec);
REGISTER_HWACCEL(MPEG4_CUVID, mpeg4_cuvid);
REGISTER_HWACCEL(MPEG4_MEDIACODEC, mpeg4_mediacodec);
REGISTER_HWACCEL(MPEG4_MMAL, mpeg4_mmal);
@@ -110,6 +109,7 @@ void avcodec_register_all(void)
REGISTER_HWACCEL(MPEG4_VIDEOTOOLBOX, mpeg4_videotoolbox);
REGISTER_HWACCEL(VC1_CUVID, vc1_cuvid);
REGISTER_HWACCEL(VC1_D3D11VA, vc1_d3d11va);
+ REGISTER_HWACCEL(VC1_D3D11VA2, vc1_d3d11va2);
REGISTER_HWACCEL(VC1_DXVA2, vc1_dxva2);
REGISTER_HWACCEL(VC1_VAAPI, vc1_vaapi);
REGISTER_HWACCEL(VC1_VDPAU, vc1_vdpau);
@@ -117,12 +117,15 @@ void avcodec_register_all(void)
REGISTER_HWACCEL(VC1_QSV, vc1_qsv);
REGISTER_HWACCEL(VP8_CUVID, vp8_cuvid);
REGISTER_HWACCEL(VP8_MEDIACODEC, vp8_mediacodec);
+ REGISTER_HWACCEL(VP8_QSV, vp8_qsv);
REGISTER_HWACCEL(VP9_CUVID, vp9_cuvid);
REGISTER_HWACCEL(VP9_D3D11VA, vp9_d3d11va);
+ REGISTER_HWACCEL(VP9_D3D11VA2, vp9_d3d11va2);
REGISTER_HWACCEL(VP9_DXVA2, vp9_dxva2);
REGISTER_HWACCEL(VP9_MEDIACODEC, vp9_mediacodec);
REGISTER_HWACCEL(VP9_VAAPI, vp9_vaapi);
REGISTER_HWACCEL(WMV3_D3D11VA, wmv3_d3d11va);
+ REGISTER_HWACCEL(WMV3_D3D11VA2, wmv3_d3d11va2);
REGISTER_HWACCEL(WMV3_DXVA2, wmv3_dxva2);
REGISTER_HWACCEL(WMV3_VAAPI, wmv3_vaapi);
REGISTER_HWACCEL(WMV3_VDPAU, wmv3_vdpau);
@@ -158,6 +161,7 @@ void avcodec_register_all(void)
REGISTER_DECODER(CDXL, cdxl);
REGISTER_DECODER(CFHD, cfhd);
REGISTER_ENCDEC (CINEPAK, cinepak);
+ REGISTER_DECODER(CLEARVIDEO, clearvideo);
REGISTER_ENCDEC (CLJR, cljr);
REGISTER_DECODER(CLLC, cllc);
REGISTER_ENCDEC (COMFORTNOISE, comfortnoise);
@@ -189,24 +193,30 @@ void avcodec_register_all(void)
REGISTER_ENCDEC (FFV1, ffv1);
REGISTER_ENCDEC (FFVHUFF, ffvhuff);
REGISTER_DECODER(FIC, fic);
+ REGISTER_ENCDEC (FITS, fits);
REGISTER_ENCDEC (FLASHSV, flashsv);
REGISTER_ENCDEC (FLASHSV2, flashsv2);
REGISTER_DECODER(FLIC, flic);
REGISTER_ENCDEC (FLV, flv);
+ REGISTER_DECODER(FMVC, fmvc);
REGISTER_DECODER(FOURXM, fourxm);
REGISTER_DECODER(FRAPS, fraps);
REGISTER_DECODER(FRWU, frwu);
REGISTER_DECODER(G2M, g2m);
+ REGISTER_DECODER(GDV, gdv);
REGISTER_ENCDEC (GIF, gif);
REGISTER_ENCDEC (H261, h261);
REGISTER_ENCDEC (H263, h263);
REGISTER_DECODER(H263I, h263i);
REGISTER_ENCDEC (H263P, h263p);
+ REGISTER_DECODER(H263_V4L2M2M, h263_v4l2m2m);
REGISTER_DECODER(H264, h264);
REGISTER_DECODER(H264_CRYSTALHD, h264_crystalhd);
+ REGISTER_DECODER(H264_V4L2M2M, h264_v4l2m2m);
REGISTER_DECODER(H264_MEDIACODEC, h264_mediacodec);
REGISTER_DECODER(H264_MMAL, h264_mmal);
REGISTER_DECODER(H264_QSV, h264_qsv);
+ REGISTER_DECODER(H264_RKMPP, h264_rkmpp);
REGISTER_DECODER(H264_VDA, h264_vda);
#if FF_API_VDPAU
REGISTER_DECODER(H264_VDPAU, h264_vdpau);
@@ -214,6 +224,8 @@ void avcodec_register_all(void)
REGISTER_ENCDEC (HAP, hap);
REGISTER_DECODER(HEVC, hevc);
REGISTER_DECODER(HEVC_QSV, hevc_qsv);
+ REGISTER_DECODER(HEVC_RKMPP, hevc_rkmpp);
+ REGISTER_DECODER(HEVC_V4L2M2M, hevc_v4l2m2m);
REGISTER_DECODER(HNM4_VIDEO, hnm4_video);
REGISTER_DECODER(HQ_HQA, hq_hqa);
REGISTER_DECODER(HQX, hqx);
@@ -248,6 +260,7 @@ void avcodec_register_all(void)
REGISTER_ENCDEC (MPEG2VIDEO, mpeg2video);
REGISTER_ENCDEC (MPEG4, mpeg4);
REGISTER_DECODER(MPEG4_CRYSTALHD, mpeg4_crystalhd);
+ REGISTER_DECODER(MPEG4_V4L2M2M, mpeg4_v4l2m2m);
REGISTER_DECODER(MPEG4_MMAL, mpeg4_mmal);
#if FF_API_VDPAU
REGISTER_DECODER(MPEG4_VDPAU, mpeg4_vdpau);
@@ -257,14 +270,18 @@ void avcodec_register_all(void)
REGISTER_DECODER(MPEG_VDPAU, mpeg_vdpau);
REGISTER_DECODER(MPEG1_VDPAU, mpeg1_vdpau);
#endif
+ REGISTER_DECODER(MPEG1_V4L2M2M, mpeg1_v4l2m2m);
REGISTER_DECODER(MPEG2_MMAL, mpeg2_mmal);
REGISTER_DECODER(MPEG2_CRYSTALHD, mpeg2_crystalhd);
+ REGISTER_DECODER(MPEG2_V4L2M2M, mpeg2_v4l2m2m);
REGISTER_DECODER(MPEG2_QSV, mpeg2_qsv);
+ REGISTER_DECODER(MPEG2_MEDIACODEC, mpeg2_mediacodec);
REGISTER_DECODER(MSA1, msa1);
- REGISTER_DECODER(MSMPEG4_CRYSTALHD, msmpeg4_crystalhd);
+ REGISTER_DECODER(MSCC, mscc);
REGISTER_DECODER(MSMPEG4V1, msmpeg4v1);
REGISTER_ENCDEC (MSMPEG4V2, msmpeg4v2);
REGISTER_ENCDEC (MSMPEG4V3, msmpeg4v3);
+ REGISTER_DECODER(MSMPEG4_CRYSTALHD, msmpeg4_crystalhd);
REGISTER_DECODER(MSRLE, msrle);
REGISTER_DECODER(MSS1, mss1);
REGISTER_DECODER(MSS2, mss2);
@@ -282,12 +299,14 @@ void avcodec_register_all(void)
REGISTER_ENCDEC (PGM, pgm);
REGISTER_ENCDEC (PGMYUV, pgmyuv);
REGISTER_DECODER(PICTOR, pictor);
+ REGISTER_DECODER(PIXLET, pixlet);
REGISTER_ENCDEC (PNG, png);
REGISTER_ENCDEC (PPM, ppm);
REGISTER_ENCDEC (PRORES, prores);
REGISTER_ENCODER(PRORES_AW, prores_aw);
REGISTER_ENCODER(PRORES_KS, prores_ks);
REGISTER_DECODER(PRORES_LGPL, prores_lgpl);
+ REGISTER_DECODER(PSD, psd);
REGISTER_DECODER(PTX, ptx);
REGISTER_DECODER(QDRAW, qdraw);
REGISTER_DECODER(QPEG, qpeg);
@@ -305,6 +324,7 @@ void avcodec_register_all(void)
REGISTER_DECODER(RV40, rv40);
REGISTER_ENCDEC (S302M, s302m);
REGISTER_DECODER(SANM, sanm);
+ REGISTER_DECODER(SCPR, scpr);
REGISTER_DECODER(SCREENPRESSO, screenpresso);
REGISTER_DECODER(SDX2_DPCM, sdx2_dpcm);
REGISTER_ENCDEC (SGI, sgi);
@@ -315,6 +335,8 @@ void avcodec_register_all(void)
REGISTER_DECODER(SMVJPEG, smvjpeg);
REGISTER_ENCDEC (SNOW, snow);
REGISTER_DECODER(SP5X, sp5x);
+ REGISTER_DECODER(SPEEDHQ, speedhq);
+ REGISTER_DECODER(SRGC, srgc);
REGISTER_ENCDEC (SUNRAST, sunrast);
REGISTER_ENCDEC (SVQ1, svq1);
REGISTER_DECODER(SVQ3, svq3);
@@ -349,6 +371,7 @@ void avcodec_register_all(void)
REGISTER_DECODER(VC1IMAGE, vc1image);
REGISTER_DECODER(VC1_MMAL, vc1_mmal);
REGISTER_DECODER(VC1_QSV, vc1_qsv);
+ REGISTER_DECODER(VC1_V4L2M2M, vc1_v4l2m2m);
REGISTER_ENCODER(VC2, vc2);
REGISTER_DECODER(VCR1, vcr1);
REGISTER_DECODER(VMDVIDEO, vmdvideo);
@@ -360,10 +383,15 @@ void avcodec_register_all(void)
REGISTER_DECODER(VP6F, vp6f);
REGISTER_DECODER(VP7, vp7);
REGISTER_DECODER(VP8, vp8);
+ REGISTER_DECODER(VP8_RKMPP, vp8_rkmpp);
+ REGISTER_DECODER(VP8_V4L2M2M, vp8_v4l2m2m);
REGISTER_DECODER(VP9, vp9);
+ REGISTER_DECODER(VP9_RKMPP, vp9_rkmpp);
+ REGISTER_DECODER(VP9_V4L2M2M, vp9_v4l2m2m);
REGISTER_DECODER(VQA, vqa);
+ REGISTER_DECODER(BITPACKED, bitpacked);
REGISTER_DECODER(WEBP, webp);
- REGISTER_ENCODER(WRAPPED_AVFRAME, wrapped_avframe);
+ REGISTER_ENCDEC (WRAPPED_AVFRAME, wrapped_avframe);
REGISTER_ENCDEC (WMV1, wmv1);
REGISTER_ENCDEC (WMV2, wmv2);
REGISTER_DECODER(WMV3, wmv3);
@@ -378,6 +406,7 @@ void avcodec_register_all(void)
REGISTER_ENCDEC (XBM, xbm);
REGISTER_ENCDEC (XFACE, xface);
REGISTER_DECODER(XL, xl);
+ REGISTER_DECODER(XPM, xpm);
REGISTER_ENCDEC (XWD, xwd);
REGISTER_ENCDEC (Y41P, y41p);
REGISTER_DECODER(YLC, ylc);
@@ -401,12 +430,15 @@ void avcodec_register_all(void)
REGISTER_DECODER(APE, ape);
REGISTER_DECODER(ATRAC1, atrac1);
REGISTER_DECODER(ATRAC3, atrac3);
+ REGISTER_DECODER(ATRAC3AL, atrac3al);
REGISTER_DECODER(ATRAC3P, atrac3p);
+ REGISTER_DECODER(ATRAC3PAL, atrac3pal);
REGISTER_DECODER(BINKAUDIO_DCT, binkaudio_dct);
REGISTER_DECODER(BINKAUDIO_RDFT, binkaudio_rdft);
REGISTER_DECODER(BMV_AUDIO, bmv_audio);
REGISTER_DECODER(COOK, cook);
REGISTER_ENCDEC (DCA, dca);
+ REGISTER_DECODER(DOLBY_E, dolby_e);
REGISTER_DECODER(DSD_LSBF, dsd_lsbf);
REGISTER_DECODER(DSD_MSBF, dsd_msbf);
REGISTER_DECODER(DSD_LSBF_PLANAR, dsd_lsbf_planar);
@@ -444,10 +476,11 @@ void avcodec_register_all(void)
REGISTER_DECODER(MPC8, mpc8);
REGISTER_ENCDEC (NELLYMOSER, nellymoser);
REGISTER_DECODER(ON2AVC, on2avc);
- REGISTER_DECODER(OPUS, opus);
+ REGISTER_ENCDEC (OPUS, opus);
REGISTER_DECODER(PAF_AUDIO, paf_audio);
REGISTER_DECODER(QCELP, qcelp);
REGISTER_DECODER(QDM2, qdm2);
+ REGISTER_DECODER(QDMC, qdmc);
REGISTER_ENCDEC (RA_144, ra_144);
REGISTER_DECODER(RA_288, ra_288);
REGISTER_DECODER(RALF, ralf);
@@ -477,6 +510,8 @@ void avcodec_register_all(void)
REGISTER_ENCDEC (PCM_ALAW, pcm_alaw);
REGISTER_DECODER(PCM_BLURAY, pcm_bluray);
REGISTER_DECODER(PCM_DVD, pcm_dvd);
+ REGISTER_DECODER(PCM_F16LE, pcm_f16le);
+ REGISTER_DECODER(PCM_F24LE, pcm_f24le);
REGISTER_ENCDEC (PCM_F32BE, pcm_f32be);
REGISTER_ENCDEC (PCM_F32LE, pcm_f32le);
REGISTER_ENCDEC (PCM_F64BE, pcm_f64be);
@@ -508,6 +543,7 @@ void avcodec_register_all(void)
REGISTER_DECODER(PCM_ZORK, pcm_zork);
/* DPCM codecs */
+ REGISTER_DECODER(GREMLIN_DPCM, gremlin_dpcm);
REGISTER_DECODER(INTERPLAY_DPCM, interplay_dpcm);
REGISTER_ENCDEC (ROQ_DPCM, roq_dpcm);
REGISTER_DECODER(SOL_DPCM, sol_dpcm);
@@ -528,7 +564,7 @@ void avcodec_register_all(void)
REGISTER_DECODER(ADPCM_EA_XAS, adpcm_ea_xas);
REGISTER_ENCDEC (ADPCM_G722, adpcm_g722);
REGISTER_ENCDEC (ADPCM_G726, adpcm_g726);
- REGISTER_DECODER(ADPCM_G726LE, adpcm_g726le);
+ REGISTER_ENCDEC (ADPCM_G726LE, adpcm_g726le);
REGISTER_DECODER(ADPCM_IMA_AMV, adpcm_ima_amv);
REGISTER_DECODER(ADPCM_IMA_APC, adpcm_ima_apc);
REGISTER_DECODER(ADPCM_IMA_DAT4, adpcm_ima_dat4);
@@ -606,7 +642,7 @@ void avcodec_register_all(void)
REGISTER_DECODER(LIBOPENCORE_AMRWB, libopencore_amrwb);
REGISTER_ENCDEC (LIBOPENJPEG, libopenjpeg);
REGISTER_ENCDEC (LIBOPUS, libopus);
- REGISTER_ENCDEC (LIBSCHROEDINGER, libschroedinger);
+ REGISTER_DECODER(LIBRSVG, librsvg);
REGISTER_ENCODER(LIBSHINE, libshine);
REGISTER_ENCDEC (LIBSPEEX, libspeex);
REGISTER_ENCODER(LIBTHEORA, libtheora);
@@ -633,12 +669,13 @@ void avcodec_register_all(void)
/* external libraries, that shouldn't be used by default if one of the
* above is available */
+ REGISTER_ENCODER(H263_V4L2M2M, h263_v4l2m2m);
REGISTER_ENCDEC (LIBOPENH264, libopenh264);
- REGISTER_DECODER(H263_CUVID, h263_cuvid);
REGISTER_DECODER(H264_CUVID, h264_cuvid);
REGISTER_ENCODER(H264_NVENC, h264_nvenc);
REGISTER_ENCODER(H264_OMX, h264_omx);
REGISTER_ENCODER(H264_QSV, h264_qsv);
+ REGISTER_ENCODER(H264_V4L2M2M, h264_v4l2m2m);
REGISTER_ENCODER(H264_VAAPI, h264_vaapi);
REGISTER_ENCODER(H264_VIDEOTOOLBOX, h264_videotoolbox);
#if FF_API_NVENC_OLD_NAME
@@ -650,6 +687,7 @@ void avcodec_register_all(void)
REGISTER_DECODER(HEVC_MEDIACODEC, hevc_mediacodec);
REGISTER_ENCODER(HEVC_NVENC, hevc_nvenc);
REGISTER_ENCODER(HEVC_QSV, hevc_qsv);
+ REGISTER_ENCODER(HEVC_V4L2M2M, hevc_v4l2m2m);
REGISTER_ENCODER(HEVC_VAAPI, hevc_vaapi);
REGISTER_ENCODER(LIBKVAZAAR, libkvazaar);
REGISTER_DECODER(MJPEG_CUVID, mjpeg_cuvid);
@@ -657,13 +695,19 @@ void avcodec_register_all(void)
REGISTER_DECODER(MPEG1_CUVID, mpeg1_cuvid);
REGISTER_DECODER(MPEG2_CUVID, mpeg2_cuvid);
REGISTER_ENCODER(MPEG2_QSV, mpeg2_qsv);
+ REGISTER_ENCODER(MPEG2_VAAPI, mpeg2_vaapi);
REGISTER_DECODER(MPEG4_CUVID, mpeg4_cuvid);
REGISTER_DECODER(MPEG4_MEDIACODEC, mpeg4_mediacodec);
+ REGISTER_ENCODER(MPEG4_V4L2M2M, mpeg4_v4l2m2m);
REGISTER_DECODER(VC1_CUVID, vc1_cuvid);
REGISTER_DECODER(VP8_CUVID, vp8_cuvid);
REGISTER_DECODER(VP8_MEDIACODEC, vp8_mediacodec);
+ REGISTER_DECODER(VP8_QSV, vp8_qsv);
+ REGISTER_ENCODER(VP8_V4L2M2M, vp8_v4l2m2m);
+ REGISTER_ENCODER(VP8_VAAPI, vp8_vaapi);
REGISTER_DECODER(VP9_CUVID, vp9_cuvid);
REGISTER_DECODER(VP9_MEDIACODEC, vp9_mediacodec);
+ REGISTER_ENCODER(VP9_VAAPI, vp9_vaapi);
/* parsers */
REGISTER_PARSER(AAC, aac);
@@ -698,10 +742,19 @@ void avcodec_register_all(void)
REGISTER_PARSER(PNM, pnm);
REGISTER_PARSER(RV30, rv30);
REGISTER_PARSER(RV40, rv40);
+ REGISTER_PARSER(SIPR, sipr);
REGISTER_PARSER(TAK, tak);
REGISTER_PARSER(VC1, vc1);
REGISTER_PARSER(VORBIS, vorbis);
REGISTER_PARSER(VP3, vp3);
REGISTER_PARSER(VP8, vp8);
REGISTER_PARSER(VP9, vp9);
+ REGISTER_PARSER(XMA, xma);
+}
+
+void avcodec_register_all(void)
+{
+ static AVOnce control = AV_ONCE_INIT;
+
+ ff_thread_once(&control, register_all);
}
diff --git a/media/ffvpx/libavcodec/avcodec.h b/media/ffvpx/libavcodec/avcodec.h
index e5e7f4225d..18c3e3ea1e 100644
--- a/media/ffvpx/libavcodec/avcodec.h
+++ b/media/ffvpx/libavcodec/avcodec.h
@@ -89,7 +89,7 @@
* - Send valid input:
* - For decoding, call avcodec_send_packet() to give the decoder raw
* compressed data in an AVPacket.
- * - For encoding, call avcodec_send_frame() to give the decoder an AVFrame
+ * - For encoding, call avcodec_send_frame() to give the encoder an AVFrame
* containing uncompressed audio or video.
* In both cases, it is recommended that AVPackets and AVFrames are
* refcounted, or libavcodec might have to copy the input data. (libavformat
@@ -112,6 +112,12 @@
* are filled. This situation is handled transparently if you follow the steps
* outlined above.
*
+ * In theory, sending input can result in EAGAIN - this should happen only if
+ * not all output was received. You can use this to structure alternative decode
+ * or encode loops other than the one suggested above. For example, you could
+ * try sending new input on each iteration, and try to receive output if that
+ * returns EAGAIN.
+ *
* End of stream situations. These require "flushing" (aka draining) the codec,
* as the codec might buffer multiple frames or packets internally for
* performance or out of necessity (consider B-frames).
@@ -136,8 +142,9 @@
*
* Not all codecs will follow a rigid and predictable dataflow; the only
* guarantee is that an AVERROR(EAGAIN) return value on a send/receive call on
- * one end implies that a receive/send call on the other end will succeed. In
- * general, no codec will permit unlimited buffering of input or output.
+ * one end implies that a receive/send call on the other end will succeed, or
+ * at least will not fail with AVERROR(EAGAIN). In general, no codec will
+ * permit unlimited buffering of input or output.
*
* This API replaces the following legacy functions:
* - avcodec_decode_video2() and avcodec_decode_audio4():
@@ -146,7 +153,8 @@
* Unlike with the old video decoding API, multiple frames might result from
* a packet. For audio, splitting the input packet into frames by partially
* decoding packets becomes transparent to the API user. You never need to
- * feed an AVPacket to the API twice.
+ * feed an AVPacket to the API twice (unless it is rejected with AVERROR(EAGAIN) - then
+ * no data was read from the packet).
* Additionally, sending a flush/draining packet is required only once.
* - avcodec_encode_video2()/avcodec_encode_audio2():
* Use avcodec_send_frame() to feed input to the encoder, then use
@@ -159,7 +167,22 @@
* and will result in undefined behavior.
*
* Some codecs might require using the new API; using the old API will return
- * an error when calling it.
+ * an error when calling it. All codecs support the new API.
+ *
+ * A codec is not allowed to return AVERROR(EAGAIN) for both sending and receiving. This
+ * would be an invalid state, which could put the codec user into an endless
+ * loop. The API has no concept of time either: it cannot happen that trying to
+ * do avcodec_send_packet() results in AVERROR(EAGAIN), but a repeated call 1 second
+ * later accepts the packet (with no other receive/flush API calls involved).
+ * The API is a strict state machine, and the passage of time is not supposed
+ * to influence it. Some timing-dependent behavior might still be deemed
+ * acceptable in certain cases. But it must never result in both send/receive
+ * returning EAGAIN at the same time at any point. It must also absolutely be
+ * avoided that the current state is "unstable" and can "flip-flop" between
+ * the send/receive APIs allowing progress. For example, it's not allowed that
+ * the codec randomly decides that it actually wants to consume a packet now
+ * instead of returning a frame, after it just returned AVERROR(EAGAIN) on an
+ * avcodec_send_packet() call.
* @}
*/
@@ -411,6 +434,20 @@ enum AVCodecID {
AV_CODEC_ID_MAGICYUV,
AV_CODEC_ID_SHEERVIDEO,
AV_CODEC_ID_YLC,
+ AV_CODEC_ID_PSD,
+ AV_CODEC_ID_PIXLET,
+ AV_CODEC_ID_SPEEDHQ,
+ AV_CODEC_ID_FMVC,
+ AV_CODEC_ID_SCPR,
+ AV_CODEC_ID_CLEARVIDEO,
+ AV_CODEC_ID_XPM,
+ AV_CODEC_ID_AV1,
+ AV_CODEC_ID_BITPACKED,
+ AV_CODEC_ID_MSCC,
+ AV_CODEC_ID_SRGC,
+ AV_CODEC_ID_SVG,
+ AV_CODEC_ID_GDV,
+ AV_CODEC_ID_FITS,
/* various PCM "codecs" */
AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs
@@ -448,6 +485,8 @@ enum AVCodecID {
AV_CODEC_ID_PCM_S64LE = 0x10800,
AV_CODEC_ID_PCM_S64BE,
+ AV_CODEC_ID_PCM_F16LE,
+ AV_CODEC_ID_PCM_F24LE,
/* various ADPCM codecs */
AV_CODEC_ID_ADPCM_IMA_QT = 0x11000,
@@ -511,6 +550,7 @@ enum AVCodecID {
AV_CODEC_ID_SOL_DPCM,
AV_CODEC_ID_SDX2_DPCM = 0x14800,
+ AV_CODEC_ID_GREMLIN_DPCM,
/* audio codecs */
AV_CODEC_ID_MP2 = 0x15000,
@@ -598,6 +638,9 @@ enum AVCodecID {
AV_CODEC_ID_XMA1,
AV_CODEC_ID_XMA2,
AV_CODEC_ID_DST,
+ AV_CODEC_ID_ATRAC3AL,
+ AV_CODEC_ID_ATRAC3PAL,
+ AV_CODEC_ID_DOLBY_E,
/* subtitle codecs */
AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs.
@@ -689,7 +732,7 @@ typedef struct AVCodecDescriptor {
/**
* Codec uses only intra compression.
- * Video codecs only.
+ * Video and audio codecs only.
*/
#define AV_CODEC_PROP_INTRA_ONLY (1 << 0)
/**
@@ -1360,6 +1403,11 @@ typedef struct AVCPBProperties {
* @{
*/
enum AVPacketSideDataType {
+ /**
+ * An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE
+ * bytes worth of palette. This side data signals that a new palette is
+ * present.
+ */
AV_PKT_DATA_PALETTE,
/**
@@ -1533,10 +1581,40 @@ enum AVPacketSideDataType {
/**
* Mastering display metadata (based on SMPTE-2086:2014). This metadata
- * should be associated with a video stream and containts data in the form
+ * should be associated with a video stream and contains data in the form
* of the AVMasteringDisplayMetadata struct.
*/
- AV_PKT_DATA_MASTERING_DISPLAY_METADATA
+ AV_PKT_DATA_MASTERING_DISPLAY_METADATA,
+
+ /**
+ * This side data should be associated with a video stream and corresponds
+ * to the AVSphericalMapping structure.
+ */
+ AV_PKT_DATA_SPHERICAL,
+
+ /**
+ * Content light level (based on CTA-861.3). This metadata should be
+ * associated with a video stream and contains data in the form of the
+ * AVContentLightMetadata struct.
+ */
+ AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
+
+ /**
+ * ATSC A53 Part 4 Closed Captions. This metadata should be associated with
+ * a video stream. A53 CC bitstream is stored as uint8_t in AVPacketSideData.data.
+ * The number of bytes of CC data is AVPacketSideData.size.
+ */
+ AV_PKT_DATA_A53_CC,
+
+ /**
+ * The number of side data elements (in fact a bit more than it).
+ * This is not part of the public API/ABI in the sense that it may
+ * change when new side data types are added.
+ * This must stay the last enum value.
+ * If its value becomes huge, some code using it
+ * needs to be updated as it assumes it to be smaller than other limits.
+ */
+ AV_PKT_DATA_NB
};
#define AV_PKT_DATA_QUALITY_FACTOR AV_PKT_DATA_QUALITY_STATS //DEPRECATED
@@ -1638,6 +1716,13 @@ typedef struct AVPacket {
* after decoding.
**/
#define AV_PKT_FLAG_DISCARD 0x0004
+/**
+ * The packet comes from a trusted source.
+ *
+ * Otherwise-unsafe constructs such as arbitrary pointers to data
+ * outside the packet may be followed.
+ */
+#define AV_PKT_FLAG_TRUSTED 0x0008
enum AVSideDataParamChangeFlags {
AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001,
@@ -1665,7 +1750,7 @@ enum AVFieldOrder {
* New fields can be added to the end with minor version bumps.
* Removal, reordering and changes to existing fields require a major
* version bump.
- * Please use AVOptions (av_opt* / av_set/get*()) to access these fields from user
+ * You can use AVOptions (av_opt* / av_set/get*()) to access these fields from user
* applications.
* The name string for AVOptions options matches the associated command line
* parameter name and can be found in libavcodec/options_table.h
@@ -2605,6 +2690,7 @@ typedef struct AVCodecContext {
* - encoding: unused
* - decoding: set by the caller before avcodec_open2().
*/
+ attribute_deprecated
int refcounted_frames;
/* - encoding parameters */
@@ -2936,8 +3022,8 @@ typedef struct AVCodecContext {
#define FF_DEBUG_MMCO 0x00000800
#define FF_DEBUG_BUGS 0x00001000
#if FF_API_DEBUG_MV
-#define FF_DEBUG_VIS_QP 0x00002000 ///< only access through AVOptions from outside libavcodec
-#define FF_DEBUG_VIS_MB_TYPE 0x00004000 ///< only access through AVOptions from outside libavcodec
+#define FF_DEBUG_VIS_QP 0x00002000
+#define FF_DEBUG_VIS_MB_TYPE 0x00004000
#endif
#define FF_DEBUG_BUFFERS 0x00008000
#define FF_DEBUG_THREADS 0x00010000
@@ -2947,7 +3033,6 @@ typedef struct AVCodecContext {
#if FF_API_DEBUG_MV
/**
* debug
- * Code outside libavcodec should access this field using AVOptions
* - encoding: Set by user.
* - decoding: Set by user.
*/
@@ -3061,6 +3146,7 @@ typedef struct AVCodecContext {
#if FF_API_ARCH_ALPHA
#define FF_IDCT_SIMPLEALPHA 23
#endif
+#define FF_IDCT_NONE 24 /* Used by XvMC to extract IDCT coefficients with FF_IDCT_PERM_NONE */
#define FF_IDCT_SIMPLEAUTO 128
/**
@@ -3082,8 +3168,6 @@ typedef struct AVCodecContext {
* low resolution decoding, 1-> 1/2 size, 2->1/4 size
* - encoding: unused
* - decoding: Set by user.
- * Code outside libavcodec should access this field using:
- * av_codec_{get,set}_lowres(avctx)
*/
int lowres;
#endif
@@ -3384,8 +3468,6 @@ typedef struct AVCodecContext {
/**
* Timebase in which pkt_dts/pts and AVPacket.dts/pts are.
- * Code outside libavcodec should access this field using:
- * av_codec_{get,set}_pkt_timebase(avctx)
* - encoding unused.
* - decoding set by user.
*/
@@ -3393,8 +3475,6 @@ typedef struct AVCodecContext {
/**
* AVCodecDescriptor
- * Code outside libavcodec should access this field using:
- * av_codec_{get,set}_codec_descriptor(avctx)
* - encoding: unused.
* - decoding: set by libavcodec.
*/
@@ -3405,8 +3485,6 @@ typedef struct AVCodecContext {
* low resolution decoding, 1-> 1/2 size, 2->1/4 size
* - encoding: unused
* - decoding: Set by user.
- * Code outside libavcodec should access this field using:
- * av_codec_{get,set}_lowres(avctx)
*/
int lowres;
#endif
@@ -3447,7 +3525,6 @@ typedef struct AVCodecContext {
* However for formats that do not use pre-multiplied alpha
* there might be serious artefacts (though e.g. libswscale currently
* assumes pre-multiplied alpha anyway).
- * Code outside libavcodec should access this field using AVOptions
*
* - decoding: set by user
* - encoding: unused
@@ -3464,7 +3541,6 @@ typedef struct AVCodecContext {
#if !FF_API_DEBUG_MV
/**
* debug motion vectors
- * Code outside libavcodec should access this field using AVOptions
* - encoding: Set by user.
* - decoding: Set by user.
*/
@@ -3476,7 +3552,6 @@ typedef struct AVCodecContext {
/**
* custom intra quantization matrix
- * Code outside libavcodec should access this field using av_codec_g/set_chroma_intra_matrix()
* - encoding: Set by user, can be NULL.
* - decoding: unused.
*/
@@ -3485,8 +3560,6 @@ typedef struct AVCodecContext {
/**
* dump format separator.
* can be ", " or "\n " or anything else
- * Code outside libavcodec should access this field using AVOptions
- * (NO direct access).
* - encoding: Set by user.
* - decoding: Set by user.
*/
@@ -3496,13 +3569,12 @@ typedef struct AVCodecContext {
* ',' separated list of allowed decoders.
* If NULL then all are allowed
* - encoding: unused
- * - decoding: set by user through AVOPtions (NO direct access)
+ * - decoding: set by user
*/
char *codec_whitelist;
- /*
+ /**
* Properties of the stream that gets decoded
- * To be accessed through av_codec_get_properties() (NO direct access)
* - encoding: unused
* - decoding: set by libavcodec
*/
@@ -3522,7 +3594,8 @@ typedef struct AVCodecContext {
/**
* A reference to the AVHWFramesContext describing the input (for encoding)
* or output (decoding) frames. The reference is set by the caller and
- * afterwards owned (and freed) by libavcodec.
+ * afterwards owned (and freed) by libavcodec - it should never be read by
+ * the caller after being set.
*
* - decoding: This field should be set by the caller from the get_format()
* callback. The previous reference (if any) will always be
@@ -3564,6 +3637,71 @@ typedef struct AVCodecContext {
*/
int trailing_padding;
+ /**
+ * The number of pixels per image to maximally accept.
+ *
+ * - decoding: set by user
+ * - encoding: set by user
+ */
+ int64_t max_pixels;
+
+ /**
+ * A reference to the AVHWDeviceContext describing the device which will
+ * be used by a hardware encoder/decoder. The reference is set by the
+ * caller and afterwards owned (and freed) by libavcodec.
+ *
+ * This should be used if either the codec device does not require
+ * hardware frames or any that are used are to be allocated internally by
+ * libavcodec. If the user wishes to supply any of the frames used as
+ * encoder input or decoder output then hw_frames_ctx should be used
+ * instead. When hw_frames_ctx is set in get_format() for a decoder, this
+ * field will be ignored while decoding the associated stream segment, but
+ * may again be used on a following one after another get_format() call.
+ *
+ * For both encoders and decoders this field should be set before
+ * avcodec_open2() is called and must not be written to thereafter.
+ *
+ * Note that some decoders may require this field to be set initially in
+ * order to support hw_frames_ctx at all - in that case, all frames
+ * contexts used must be created on the same device.
+ */
+ AVBufferRef *hw_device_ctx;
+
+ /**
+ * Bit set of AV_HWACCEL_FLAG_* flags, which affect hardware accelerated
+ * decoding (if active).
+ * - encoding: unused
+ * - decoding: Set by user (either before avcodec_open2(), or in the
+ * AVCodecContext.get_format callback)
+ */
+ int hwaccel_flags;
+
+ /**
+ * Video decoding only. Certain video codecs support cropping, meaning that
+ * only a sub-rectangle of the decoded frame is intended for display. This
+ * option controls how cropping is handled by libavcodec.
+ *
+ * When set to 1 (the default), libavcodec will apply cropping internally.
+ * I.e. it will modify the output frame width/height fields and offset the
+ * data pointers (only by as much as possible while preserving alignment, or
+ * by the full amount if the AV_CODEC_FLAG_UNALIGNED flag is set) so that
+ * the frames output by the decoder refer only to the cropped area. The
+ * crop_* fields of the output frames will be zero.
+ *
+ * When set to 0, the width/height fields of the output frames will be set
+ * to the coded dimensions and the crop_* fields will describe the cropping
+ * rectangle. Applying the cropping is left to the caller.
+ *
+ * @warning When hardware acceleration with opaque output frames is used,
+ * libavcodec is unable to apply cropping from the top/left border.
+ *
+ * @note when this option is set to zero, the width/height fields of the
+ * AVCodecContext and output AVFrames have different meanings. The codec
+ * context fields store display dimensions (with the coded dimensions in
+ * coded_width/height), while the frame fields store the coded dimensions
+ * (with the display dimensions being determined by the crop_* fields).
+ */
+ int apply_cropping;
} AVCodecContext;
AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx);
@@ -3623,7 +3761,7 @@ typedef struct AVCodec {
const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0
const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1
const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0
- uint8_t max_lowres; ///< maximum value for lowres supported by the decoder, no direct access, use av_codec_get_max_lowres()
+ uint8_t max_lowres; ///< maximum value for lowres supported by the decoder
const AVClass *priv_class; ///< AVClass for the private context
const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN}
@@ -3684,20 +3822,22 @@ typedef struct AVCodec {
int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt);
int (*close)(AVCodecContext *);
/**
- * Decode/encode API with decoupled packet/frame dataflow. The API is the
+ * Encode API with decoupled packet/frame dataflow. The API is the
* same as the avcodec_ prefixed APIs (avcodec_send_frame() etc.), except
* that:
* - never called if the codec is closed or the wrong type,
- * - AVPacket parameter change side data is applied right before calling
- * AVCodec->send_packet,
- * - if AV_CODEC_CAP_DELAY is not set, drain packets or frames are never sent,
- * - only one drain packet is ever passed down (until the next flush()),
- * - a drain AVPacket is always NULL (no need to check for avpkt->size).
+ * - if AV_CODEC_CAP_DELAY is not set, drain frames are never sent,
+ * - only one drain frame is ever passed down,
*/
int (*send_frame)(AVCodecContext *avctx, const AVFrame *frame);
- int (*send_packet)(AVCodecContext *avctx, const AVPacket *avpkt);
- int (*receive_frame)(AVCodecContext *avctx, AVFrame *frame);
int (*receive_packet)(AVCodecContext *avctx, AVPacket *avpkt);
+
+ /**
+ * Decode API with decoupled packet/frame dataflow. This function is called
+ * to get one output frame. It should call ff_decode_get_packet() to obtain
+ * input data.
+ */
+ int (*receive_frame)(AVCodecContext *avctx, AVFrame *frame);
/**
* Flush buffers.
* Will be called when seeking
@@ -3708,6 +3848,12 @@ typedef struct AVCodec {
* See FF_CODEC_CAP_* in internal.h
*/
int caps_internal;
+
+ /**
+ * Decoding only, a comma-separated list of bitstream filters to apply to
+ * packets before decoding.
+ */
+ const char *bsfs;
} AVCodec;
int av_codec_get_max_lowres(const AVCodec *codec);
@@ -3749,7 +3895,7 @@ typedef struct AVHWAccel {
/**
* Hardware accelerated codec capabilities.
- * see HWACCEL_CODEC_CAP_*
+ * see AV_HWACCEL_CODEC_CAP_*
*/
int capabilities;
@@ -3820,7 +3966,7 @@ typedef struct AVHWAccel {
/**
* Called for every Macroblock in a slice.
*
- * XvMC uses it to replace the ff_mpv_decode_mb().
+ * XvMC uses it to replace the ff_mpv_reconstruct_mb().
* Instead of decoding to raw picture, MB parameters are
* stored in an array provided by the video driver.
*
@@ -3850,9 +3996,20 @@ typedef struct AVHWAccel {
* AVCodecInternal.hwaccel_priv_data.
*/
int priv_data_size;
+
+ /**
+ * Internal hwaccel capabilities.
+ */
+ int caps_internal;
} AVHWAccel;
/**
+ * HWAccel is experimental and is thus avoided in favor of non experimental
+ * codecs
+ */
+#define AV_HWACCEL_CODEC_CAP_EXPERIMENTAL 0x0200
+
+/**
* Hardware acceleration should be used for decoding even if the codec level
* used is unknown or higher than the maximum supported level reported by the
* hardware driver.
@@ -3869,6 +4026,20 @@ typedef struct AVHWAccel {
#define AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH (1 << 1)
/**
+ * Hardware acceleration should still be attempted for decoding when the
+ * codec profile does not match the reported capabilities of the hardware.
+ *
+ * For example, this can be used to try to decode baseline profile H.264
+ * streams in hardware - it will often succeed, because many streams marked
+ * as baseline profile actually conform to constrained baseline profile.
+ *
+ * @warning If the stream is actually not supported then the behaviour is
+ * undefined, and may include returning entirely incorrect output
+ * while indicating success.
+ */
+#define AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH (1 << 2)
+
+/**
* @}
*/
@@ -4377,13 +4548,13 @@ AVPacket *av_packet_alloc(void);
* @see av_packet_alloc
* @see av_packet_ref
*/
-AVPacket *av_packet_clone(AVPacket *src);
+AVPacket *av_packet_clone(const AVPacket *src);
/**
* Free the packet, if the packet is reference counted, it will be
* unreferenced first.
*
- * @param packet packet to be freed. The pointer will be set to NULL.
+ * @param pkt packet to be freed. The pointer will be set to NULL.
* @note passing NULL is a no-op.
*/
void av_packet_free(AVPacket **pkt);
@@ -4452,14 +4623,20 @@ int av_dup_packet(AVPacket *pkt);
* Copy packet, including contents
*
* @return 0 on success, negative AVERROR on fail
+ *
+ * @deprecated Use av_packet_ref
*/
+attribute_deprecated
int av_copy_packet(AVPacket *dst, const AVPacket *src);
/**
* Copy packet side data
*
* @return 0 on success, negative AVERROR on fail
+ *
+ * @deprecated Use av_packet_copy_props
*/
+attribute_deprecated
int av_copy_packet_side_data(AVPacket *dst, const AVPacket *src);
/**
@@ -4518,12 +4695,16 @@ int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
* @param size pointer for side information size to store (optional)
* @return pointer to data if present or NULL otherwise
*/
-uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
+uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,
int *size);
+#if FF_API_MERGE_SD_API
+attribute_deprecated
int av_packet_merge_side_data(AVPacket *pkt);
+attribute_deprecated
int av_packet_split_side_data(AVPacket *pkt);
+#endif
const char *av_packet_side_data_name(enum AVPacketSideDataType type);
@@ -4823,13 +5004,13 @@ int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
* and reusing a get_buffer written for video codecs would probably perform badly
* due to a potentially very different allocation pattern.
*
- * Some decoders (those marked with CODEC_CAP_DELAY) have a delay between input
+ * Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input
* and output. This means that for some packets they will not immediately
* produce decoded output and need to be flushed at the end of decoding to get
* all the decoded data. Flushing is done by calling this function with packets
* with avpkt->data set to NULL and avpkt->size set to 0 until it stops
* returning subtitles. It is safe to flush even those decoders that are not
- * marked with CODEC_CAP_DELAY, then no subtitles will be returned.
+ * marked with AV_CODEC_CAP_DELAY, then no subtitles will be returned.
*
* @note The AVCodecContext MUST have been opened with @ref avcodec_open2()
* before packets may be fed to the decoder.
@@ -4883,8 +5064,10 @@ int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
* a flush packet.
*
* @return 0 on success, otherwise negative error code:
- * AVERROR(EAGAIN): input is not accepted right now - the packet must be
- * resent after trying to read output
+ * AVERROR(EAGAIN): input is not accepted in the current state - user
+ * must read output with avcodec_receive_frame() (once
+ * all output is read, the packet should be resent, and
+ * the call will not fail with EAGAIN).
* AVERROR_EOF: the decoder has been flushed, and no new packets can
* be sent to it (also returned if more than 1 flush
* packet is sent)
@@ -4905,7 +5088,7 @@ int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt);
*
* @return
* 0: success, a frame was returned
- * AVERROR(EAGAIN): output is not available right now - user must try
+ * AVERROR(EAGAIN): output is not available in this state - user must try
* to send new input
* AVERROR_EOF: the decoder has been fully flushed, and there will be
* no more output frames
@@ -4938,8 +5121,10 @@ int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame);
* avctx->frame_size for all frames except the last.
* The final frame may be smaller than avctx->frame_size.
* @return 0 on success, otherwise negative error code:
- * AVERROR(EAGAIN): input is not accepted right now - the frame must be
- * resent after trying to read output packets
+ * AVERROR(EAGAIN): input is not accepted in the current state - user
+ * must read output with avcodec_receive_packet() (once
+ * all output is read, the packet should be resent, and
+ * the call will not fail with EAGAIN).
* AVERROR_EOF: the encoder has been flushed, and no new frames can
* be sent to it
* AVERROR(EINVAL): codec not opened, refcounted_frames not set, it is a
@@ -4957,8 +5142,8 @@ int avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame);
* encoder. Note that the function will always call
* av_frame_unref(frame) before doing anything else.
* @return 0 on success, otherwise negative error code:
- * AVERROR(EAGAIN): output is not available right now - user must try
- * to send input
+ * AVERROR(EAGAIN): output is not available in the current state - user
+ * must try to send input
* AVERROR_EOF: the encoder has been fully flushed, and there will be
* no more output packets
* AVERROR(EINVAL): codec not opened, or it is an encoder
@@ -5509,22 +5694,14 @@ int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width,
* @{
*/
+#if FF_API_GETCHROMA
/**
- * Utility function to access log2_chroma_w log2_chroma_h from
- * the pixel format AVPixFmtDescriptor.
- *
- * This function asserts that pix_fmt is valid. See av_pix_fmt_get_chroma_sub_sample
- * for one that returns a failure code and continues in case of invalid
- * pix_fmts.
- *
- * @param[in] pix_fmt the pixel format
- * @param[out] h_shift store log2_chroma_w
- * @param[out] v_shift store log2_chroma_h
- *
- * @see av_pix_fmt_get_chroma_sub_sample
+ * @deprecated Use av_pix_fmt_get_chroma_sub_sample
*/
+attribute_deprecated
void avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift);
+#endif
/**
* Return a value representing the fourCC code associated to the
@@ -5584,6 +5761,7 @@ attribute_deprecated
void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
#endif
+#if FF_API_TAG_STRING
/**
* Put a string representing the codec tag codec_tag in buf.
*
@@ -5592,8 +5770,12 @@ void avcodec_set_dimensions(AVCodecContext *s, int width, int height);
* @param codec_tag codec tag to assign
* @return the length of the string that would have been generated if
* enough space had been available, excluding the trailing null
+ *
+ * @deprecated see av_fourcc_make_string() and av_fourcc2str().
*/
+attribute_deprecated
size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag);
+#endif
void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode);
@@ -5706,7 +5888,7 @@ int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes);
#if FF_API_OLD_BSF
typedef struct AVBitStreamFilterContext {
void *priv_data;
- struct AVBitStreamFilter *filter;
+ const struct AVBitStreamFilter *filter;
AVCodecParserContext *parser;
struct AVBitStreamFilterContext *next;
/**
@@ -5753,12 +5935,15 @@ typedef struct AVBSFContext {
void *priv_data;
/**
- * Parameters of the input stream. Set by the caller before av_bsf_init().
+ * Parameters of the input stream. This field is allocated in
+ * av_bsf_alloc(), it needs to be filled by the caller before
+ * av_bsf_init().
*/
AVCodecParameters *par_in;
/**
- * Parameters of the output stream. Set by the filter in av_bsf_init().
+ * Parameters of the output stream. This field is allocated in
+ * av_bsf_alloc(), it is set by the filter in av_bsf_init().
*/
AVCodecParameters *par_out;
@@ -5936,8 +6121,7 @@ int av_bsf_init(AVBSFContext *ctx);
* av_bsf_receive_packet() repeatedly until it returns AVERROR(EAGAIN) or
* AVERROR_EOF.
*
- * @param pkt the packet to filter. pkt must contain some payload (i.e data or
- * side data must be present in pkt). The bitstream filter will take ownership of
+ * @param pkt the packet to filter. The bitstream filter will take ownership of
* the packet and reset the contents of pkt. pkt is not touched if an error occurs.
* This parameter may be NULL, which signals the end of the stream (i.e. no more
* packets will be sent). That will cause the filter to output any packets it
diff --git a/media/ffvpx/libavcodec/avdct.h b/media/ffvpx/libavcodec/avdct.h
deleted file mode 100644
index 272422e44c..0000000000
--- a/media/ffvpx/libavcodec/avdct.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_AVDCT_H
-#define AVCODEC_AVDCT_H
-
-#include "libavutil/opt.h"
-
-/**
- * AVDCT context.
- * @note function pointers can be NULL if the specific features have been
- * disabled at build time.
- */
-typedef struct AVDCT {
- const AVClass *av_class;
-
- void (*idct)(int16_t *block /* align 16 */);
-
- /**
- * IDCT input permutation.
- * Several optimized IDCTs need a permutated input (relative to the
- * normal order of the reference IDCT).
- * This permutation must be performed before the idct_put/add.
- * Note, normally this can be merged with the zigzag/alternate scan<br>
- * An example to avoid confusion:
- * - (->decode coeffs -> zigzag reorder -> dequant -> reference IDCT -> ...)
- * - (x -> reference DCT -> reference IDCT -> x)
- * - (x -> reference DCT -> simple_mmx_perm = idct_permutation
- * -> simple_idct_mmx -> x)
- * - (-> decode coeffs -> zigzag reorder -> simple_mmx_perm -> dequant
- * -> simple_idct_mmx -> ...)
- */
- uint8_t idct_permutation[64];
-
- void (*fdct)(int16_t *block /* align 16 */);
-
-
- /**
- * DCT algorithm.
- * must use AVOptions to set this field.
- */
- int dct_algo;
-
- /**
- * IDCT algorithm.
- * must use AVOptions to set this field.
- */
- int idct_algo;
-
- void (*get_pixels)(int16_t *block /* align 16 */,
- const uint8_t *pixels /* align 8 */,
- ptrdiff_t line_size);
-
- int bits_per_sample;
-} AVDCT;
-
-/**
- * Allocates a AVDCT context.
- * This needs to be initialized with avcodec_dct_init() after optionally
- * configuring it with AVOptions.
- *
- * To free it use av_free()
- */
-AVDCT *avcodec_dct_alloc(void);
-int avcodec_dct_init(AVDCT *);
-
-const AVClass *avcodec_dct_get_class(void);
-
-#endif /* AVCODEC_AVDCT_H */
diff --git a/media/ffvpx/libavcodec/avpacket.c b/media/ffvpx/libavcodec/avpacket.c
index e5a8bdbe42..d1f4ea9eb3 100644
--- a/media/ffvpx/libavcodec/avpacket.c
+++ b/media/ffvpx/libavcodec/avpacket.c
@@ -247,8 +247,6 @@ failed_alloc:
av_packet_unref(pkt);
return AVERROR(ENOMEM);
}
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
int av_dup_packet(AVPacket *pkt)
{
@@ -266,6 +264,8 @@ int av_copy_packet(AVPacket *dst, const AVPacket *src)
*dst = *src;
return copy_packet_data(dst, src, 0);
}
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
void av_packet_free_side_data(AVPacket *pkt)
{
@@ -296,9 +296,20 @@ int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
uint8_t *data, size_t size)
{
AVPacketSideData *tmp;
- int elems = pkt->side_data_elems;
+ int i, elems = pkt->side_data_elems;
+
+ for (i = 0; i < elems; i++) {
+ AVPacketSideData *sd = &pkt->side_data[i];
+
+ if (sd->type == type) {
+ av_free(sd->data);
+ sd->data = data;
+ sd->size = size;
+ return 0;
+ }
+ }
- if ((unsigned)elems + 1 > INT_MAX / sizeof(*pkt->side_data))
+ if ((unsigned)elems + 1 > AV_PKT_DATA_NB)
return AVERROR(ERANGE);
tmp = av_realloc(pkt->side_data, (elems + 1) * sizeof(*tmp));
@@ -336,7 +347,7 @@ uint8_t *av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
return data;
}
-uint8_t *av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
+uint8_t *av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type,
int *size)
{
int i;
@@ -348,6 +359,8 @@ uint8_t *av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type,
return pkt->side_data[i].data;
}
}
+ if (size)
+ *size = 0;
return NULL;
}
@@ -372,10 +385,15 @@ const char *av_packet_side_data_name(enum AVPacketSideDataType type)
case AV_PKT_DATA_METADATA_UPDATE: return "Metadata Update";
case AV_PKT_DATA_MPEGTS_STREAM_ID: return "MPEGTS Stream ID";
case AV_PKT_DATA_MASTERING_DISPLAY_METADATA: return "Mastering display metadata";
+ case AV_PKT_DATA_CONTENT_LIGHT_LEVEL: return "Content light level metadata";
+ case AV_PKT_DATA_SPHERICAL: return "Spherical Mapping";
+ case AV_PKT_DATA_A53_CC: return "A53 Closed Captions";
}
return NULL;
}
+#if FF_API_MERGE_SD_API
+
#define FF_MERGE_MARKER 0x8c4d9d108e25e9feULL
int av_packet_merge_side_data(AVPacket *pkt){
@@ -431,6 +449,9 @@ int av_packet_split_side_data(AVPacket *pkt){
p-= size+5;
}
+ if (i > AV_PKT_DATA_NB)
+ return AVERROR(ERANGE);
+
pkt->side_data = av_malloc_array(i, sizeof(*pkt->side_data));
if (!pkt->side_data)
return AVERROR(ENOMEM);
@@ -456,6 +477,35 @@ int av_packet_split_side_data(AVPacket *pkt){
}
return 0;
}
+#endif
+
+#if FF_API_MERGE_SD
+int ff_packet_split_and_drop_side_data(AVPacket *pkt){
+ if (!pkt->side_data_elems && pkt->size >12 && AV_RB64(pkt->data + pkt->size - 8) == FF_MERGE_MARKER){
+ int i;
+ unsigned int size;
+ uint8_t *p;
+
+ p = pkt->data + pkt->size - 8 - 5;
+ for (i=1; ; i++){
+ size = AV_RB32(p);
+ if (size>INT_MAX - 5 || p - pkt->data < size)
+ return 0;
+ if (p[4]&128)
+ break;
+ if (p - pkt->data < size + 5)
+ return 0;
+ p-= size+5;
+ if (i > AV_PKT_DATA_NB)
+ return 0;
+ }
+ pkt->size = p - pkt->data - size;
+ av_assert0(pkt->size >= 0);
+ return 1;
+ }
+ return 0;
+}
+#endif
uint8_t *av_packet_pack_dictionary(AVDictionary *dict, int *size)
{
@@ -505,7 +555,7 @@ int av_packet_unpack_dictionary(const uint8_t *data, int size, AVDictionary **di
const uint8_t *key = data;
const uint8_t *val = data + strlen(key) + 1;
- if (val >= end)
+ if (val >= end || !*key)
return AVERROR_INVALIDDATA;
ret = av_dict_set(dict, key, val, 0);
@@ -607,7 +657,7 @@ fail:
return ret;
}
-AVPacket *av_packet_clone(AVPacket *src)
+AVPacket *av_packet_clone(const AVPacket *src)
{
AVPacket *ret = av_packet_alloc();
diff --git a/media/ffvpx/libavcodec/bitstream.c b/media/ffvpx/libavcodec/bitstream.c
index 562ca1cb82..ed528fe4af 100644
--- a/media/ffvpx/libavcodec/bitstream.c
+++ b/media/ffvpx/libavcodec/bitstream.c
@@ -28,7 +28,6 @@
* bitstream api.
*/
-#include "libavutil/atomic.h"
#include "libavutil/avassert.h"
#include "libavutil/qsort.h"
#include "avcodec.h"
@@ -99,9 +98,11 @@ void avpriv_copy_bits(PutBitContext *pb, const uint8_t *src, int length)
case 2: \
v = *(const uint16_t *)ptr; \
break; \
- default: \
+ case 4: \
v = *(const uint32_t *)ptr; \
break; \
+ default: \
+ av_assert1(0); \
} \
}
@@ -126,14 +127,6 @@ static int alloc_table(VLC *vlc, int size, int use_static)
return index;
}
-static av_always_inline uint32_t bitswap_32(uint32_t x)
-{
- return (uint32_t)ff_reverse[ x & 0xFF] << 24 |
- (uint32_t)ff_reverse[(x >> 8) & 0xFF] << 16 |
- (uint32_t)ff_reverse[(x >> 16) & 0xFF] << 8 |
- (uint32_t)ff_reverse[ x >> 24];
-}
-
typedef struct VLCcode {
uint8_t bits;
uint16_t symbol;
@@ -183,7 +176,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
n = codes[i].bits;
code = codes[i].code;
symbol = codes[i].symbol;
- ff_dlog(NULL, "i=%d n=%d code=0x%x\n", i, n, code);
+ ff_dlog(NULL, "i=%d n=%d code=0x%"PRIx32"\n", i, n, code);
if (n <= table_nb_bits) {
/* no need to add another table */
j = code >> (32 - table_nb_bits);
@@ -264,7 +257,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
'bits' or 'codes' tables.
'xxx_size' : gives the number of bytes of each entry of the 'bits'
- or 'codes' tables.
+ or 'codes' tables. Currently 1,2 and 4 are supported.
'wrap' and 'size' make it possible to use any memory configuration and types
(byte/word/long) to store the 'bits', 'codes', and 'symbols' tables.
@@ -317,7 +310,8 @@ int ff_init_vlc_sparse(VLC *vlc_arg, int nb_bits, int nb_codes,
} \
GET_DATA(buf[j].code, codes, i, codes_wrap, codes_size); \
if (buf[j].code >= (1LL<<buf[j].bits)) { \
- av_log(NULL, AV_LOG_ERROR, "Invalid code %x for %d in init_vlc\n", buf[j].code, i);\
+ av_log(NULL, AV_LOG_ERROR, "Invalid code %"PRIx32" for %d in " \
+ "init_vlc\n", buf[j].code, i); \
if (!(flags & INIT_VLC_USE_NEW_STATIC)) \
av_free(buf); \
return -1; \
diff --git a/media/ffvpx/libavcodec/bitstream_filter.c b/media/ffvpx/libavcodec/bitstream_filter.c
new file mode 100644
index 0000000000..8599b90d4a
--- /dev/null
+++ b/media/ffvpx/libavcodec/bitstream_filter.c
@@ -0,0 +1,185 @@
+/*
+ * copyright (c) 2006 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <string.h>
+
+#include "avcodec.h"
+#include "libavutil/internal.h"
+#include "libavutil/mem.h"
+#include "libavutil/opt.h"
+
+#if FF_API_OLD_BSF
+FF_DISABLE_DEPRECATION_WARNINGS
+
+AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f)
+{
+ const AVBitStreamFilter *filter = NULL;
+ void *opaque = NULL;
+
+ while (filter != f)
+ filter = av_bsf_next(&opaque);
+
+ return av_bsf_next(&opaque);
+}
+
+void av_register_bitstream_filter(AVBitStreamFilter *bsf)
+{
+}
+
+typedef struct BSFCompatContext {
+ AVBSFContext *ctx;
+ int extradata_updated;
+} BSFCompatContext;
+
+AVBitStreamFilterContext *av_bitstream_filter_init(const char *name)
+{
+ AVBitStreamFilterContext *ctx = NULL;
+ BSFCompatContext *priv = NULL;
+ const AVBitStreamFilter *bsf;
+
+ bsf = av_bsf_get_by_name(name);
+ if (!bsf)
+ return NULL;
+
+ ctx = av_mallocz(sizeof(*ctx));
+ if (!ctx)
+ return NULL;
+
+ priv = av_mallocz(sizeof(*priv));
+ if (!priv)
+ goto fail;
+
+
+ ctx->filter = bsf;
+ ctx->priv_data = priv;
+
+ return ctx;
+
+fail:
+ if (priv)
+ av_bsf_free(&priv->ctx);
+ av_freep(&priv);
+ av_freep(&ctx);
+ return NULL;
+}
+
+void av_bitstream_filter_close(AVBitStreamFilterContext *bsfc)
+{
+ BSFCompatContext *priv;
+
+ if (!bsfc)
+ return;
+
+ priv = bsfc->priv_data;
+
+ av_bsf_free(&priv->ctx);
+ av_freep(&bsfc->priv_data);
+ av_free(bsfc);
+}
+
+int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc,
+ AVCodecContext *avctx, const char *args,
+ uint8_t **poutbuf, int *poutbuf_size,
+ const uint8_t *buf, int buf_size, int keyframe)
+{
+ BSFCompatContext *priv = bsfc->priv_data;
+ AVPacket pkt = { 0 };
+ int ret;
+
+ if (!priv->ctx) {
+ ret = av_bsf_alloc(bsfc->filter, &priv->ctx);
+ if (ret < 0)
+ return ret;
+
+ ret = avcodec_parameters_from_context(priv->ctx->par_in, avctx);
+ if (ret < 0)
+ return ret;
+
+ priv->ctx->time_base_in = avctx->time_base;
+
+ if (bsfc->args && bsfc->filter->priv_class) {
+ const AVOption *opt = av_opt_next(priv->ctx->priv_data, NULL);
+ const char * shorthand[2] = {NULL};
+
+ if (opt)
+ shorthand[0] = opt->name;
+
+ ret = av_opt_set_from_string(priv->ctx->priv_data, bsfc->args, shorthand, "=", ":");
+ if (ret < 0)
+ return ret;
+ }
+
+ ret = av_bsf_init(priv->ctx);
+ if (ret < 0)
+ return ret;
+ }
+
+ pkt.data = buf;
+ pkt.size = buf_size;
+
+ ret = av_bsf_send_packet(priv->ctx, &pkt);
+ if (ret < 0)
+ return ret;
+
+ *poutbuf = NULL;
+ *poutbuf_size = 0;
+
+ ret = av_bsf_receive_packet(priv->ctx, &pkt);
+ if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
+ return 0;
+ else if (ret < 0)
+ return ret;
+
+ *poutbuf = av_malloc(pkt.size + AV_INPUT_BUFFER_PADDING_SIZE);
+ if (!*poutbuf) {
+ av_packet_unref(&pkt);
+ return AVERROR(ENOMEM);
+ }
+
+ *poutbuf_size = pkt.size;
+ memcpy(*poutbuf, pkt.data, pkt.size);
+
+ av_packet_unref(&pkt);
+
+ /* drain all the remaining packets we cannot return */
+ while (ret >= 0) {
+ ret = av_bsf_receive_packet(priv->ctx, &pkt);
+ av_packet_unref(&pkt);
+ }
+
+ if (!priv->extradata_updated) {
+ /* update extradata in avctx from the output codec parameters */
+ if (priv->ctx->par_out->extradata_size && (!args || !strstr(args, "private_spspps_buf"))) {
+ av_freep(&avctx->extradata);
+ avctx->extradata_size = 0;
+ avctx->extradata = av_mallocz(priv->ctx->par_out->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
+ if (!avctx->extradata)
+ return AVERROR(ENOMEM);
+ memcpy(avctx->extradata, priv->ctx->par_out->extradata, priv->ctx->par_out->extradata_size);
+ avctx->extradata_size = priv->ctx->par_out->extradata_size;
+ }
+
+ priv->extradata_updated = 1;
+ }
+
+ return 1;
+}
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
diff --git a/media/ffvpx/libavcodec/bitstream_filters.c b/media/ffvpx/libavcodec/bitstream_filters.c
new file mode 100644
index 0000000000..ce34de640d
--- /dev/null
+++ b/media/ffvpx/libavcodec/bitstream_filters.c
@@ -0,0 +1,91 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+
+#include "libavutil/common.h"
+#include "libavutil/log.h"
+
+#include "avcodec.h"
+#include "bsf.h"
+
+extern const AVBitStreamFilter ff_aac_adtstoasc_bsf;
+extern const AVBitStreamFilter ff_chomp_bsf;
+extern const AVBitStreamFilter ff_dump_extradata_bsf;
+extern const AVBitStreamFilter ff_dca_core_bsf;
+extern const AVBitStreamFilter ff_extract_extradata_bsf;
+extern const AVBitStreamFilter ff_h264_mp4toannexb_bsf;
+extern const AVBitStreamFilter ff_hevc_mp4toannexb_bsf;
+extern const AVBitStreamFilter ff_imx_dump_header_bsf;
+extern const AVBitStreamFilter ff_mjpeg2jpeg_bsf;
+extern const AVBitStreamFilter ff_mjpega_dump_header_bsf;
+extern const AVBitStreamFilter ff_mp3_header_decompress_bsf;
+extern const AVBitStreamFilter ff_mpeg4_unpack_bframes_bsf;
+extern const AVBitStreamFilter ff_mov2textsub_bsf;
+extern const AVBitStreamFilter ff_noise_bsf;
+extern const AVBitStreamFilter ff_null_bsf;
+extern const AVBitStreamFilter ff_remove_extradata_bsf;
+extern const AVBitStreamFilter ff_text2movsub_bsf;
+extern const AVBitStreamFilter ff_vp9_raw_reorder_bsf;
+extern const AVBitStreamFilter ff_vp9_superframe_bsf;
+extern const AVBitStreamFilter ff_vp9_superframe_split_bsf;
+
+#include "libavcodec/bsf_list.c"
+
+const AVBitStreamFilter *av_bsf_next(void **opaque)
+{
+ uintptr_t i = (uintptr_t)*opaque;
+ const AVBitStreamFilter *f = bitstream_filters[i];
+
+ if (f)
+ *opaque = (void*)(i + 1);
+
+ return f;
+}
+
+const AVBitStreamFilter *av_bsf_get_by_name(const char *name)
+{
+ int i;
+
+ for (i = 0; bitstream_filters[i]; i++) {
+ const AVBitStreamFilter *f = bitstream_filters[i];
+ if (!strcmp(f->name, name))
+ return f;
+ }
+
+ return NULL;
+}
+
+const AVClass *ff_bsf_child_class_next(const AVClass *prev)
+{
+ int i;
+
+ /* find the filter that corresponds to prev */
+ for (i = 0; prev && bitstream_filters[i]; i++) {
+ if (bitstream_filters[i]->priv_class == prev) {
+ i++;
+ break;
+ }
+ }
+
+ /* find next filter with priv options */
+ for (; bitstream_filters[i]; i++)
+ if (bitstream_filters[i]->priv_class)
+ return bitstream_filters[i]->priv_class;
+ return NULL;
+}
diff --git a/media/ffvpx/libavcodec/blockdsp.h b/media/ffvpx/libavcodec/blockdsp.h
index 95e1d0f32e..6e27a02ba5 100644
--- a/media/ffvpx/libavcodec/blockdsp.h
+++ b/media/ffvpx/libavcodec/blockdsp.h
@@ -19,6 +19,7 @@
#ifndef AVCODEC_BLOCKDSP_H
#define AVCODEC_BLOCKDSP_H
+#include <stddef.h>
#include <stdint.h>
#include "avcodec.h"
@@ -29,7 +30,7 @@
* h for op_pixels_func is limited to { width / 2, width },
* but never larger than 16 and never smaller than 4. */
typedef void (*op_fill_func)(uint8_t *block /* align width (8 or 16) */,
- uint8_t value, int line_size, int h);
+ uint8_t value, ptrdiff_t line_size, int h);
typedef struct BlockDSPContext {
void (*clear_block)(int16_t *block /* align 16 */);
diff --git a/media/ffvpx/libavcodec/bsf.c b/media/ffvpx/libavcodec/bsf.c
new file mode 100644
index 0000000000..38b423101c
--- /dev/null
+++ b/media/ffvpx/libavcodec/bsf.c
@@ -0,0 +1,542 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <string.h>
+
+#include "libavutil/log.h"
+#include "libavutil/mem.h"
+#include "libavutil/opt.h"
+#include "libavutil/avstring.h"
+#include "libavutil/bprint.h"
+
+#include "avcodec.h"
+#include "bsf.h"
+
+struct AVBSFInternal {
+ AVPacket *buffer_pkt;
+ int eof;
+};
+
+void av_bsf_free(AVBSFContext **pctx)
+{
+ AVBSFContext *ctx;
+
+ if (!pctx || !*pctx)
+ return;
+ ctx = *pctx;
+
+ if (ctx->filter->close)
+ ctx->filter->close(ctx);
+ if (ctx->filter->priv_class && ctx->priv_data)
+ av_opt_free(ctx->priv_data);
+
+ av_opt_free(ctx);
+
+ av_packet_free(&ctx->internal->buffer_pkt);
+ av_freep(&ctx->internal);
+ av_freep(&ctx->priv_data);
+
+ avcodec_parameters_free(&ctx->par_in);
+ avcodec_parameters_free(&ctx->par_out);
+
+ av_freep(pctx);
+}
+
+static void *bsf_child_next(void *obj, void *prev)
+{
+ AVBSFContext *ctx = obj;
+ if (!prev && ctx->filter->priv_class)
+ return ctx->priv_data;
+ return NULL;
+}
+
+static const AVClass bsf_class = {
+ .class_name = "AVBSFContext",
+ .item_name = av_default_item_name,
+ .version = LIBAVUTIL_VERSION_INT,
+ .child_next = bsf_child_next,
+ .child_class_next = ff_bsf_child_class_next,
+};
+
+const AVClass *av_bsf_get_class(void)
+{
+ return &bsf_class;
+}
+
+int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **pctx)
+{
+ AVBSFContext *ctx;
+ int ret;
+
+ ctx = av_mallocz(sizeof(*ctx));
+ if (!ctx)
+ return AVERROR(ENOMEM);
+
+ ctx->av_class = &bsf_class;
+ ctx->filter = filter;
+
+ ctx->par_in = avcodec_parameters_alloc();
+ ctx->par_out = avcodec_parameters_alloc();
+ if (!ctx->par_in || !ctx->par_out) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+
+ ctx->internal = av_mallocz(sizeof(*ctx->internal));
+ if (!ctx->internal) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+
+ ctx->internal->buffer_pkt = av_packet_alloc();
+ if (!ctx->internal->buffer_pkt) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+
+ av_opt_set_defaults(ctx);
+
+ /* allocate priv data and init private options */
+ if (filter->priv_data_size) {
+ ctx->priv_data = av_mallocz(filter->priv_data_size);
+ if (!ctx->priv_data) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ if (filter->priv_class) {
+ *(const AVClass **)ctx->priv_data = filter->priv_class;
+ av_opt_set_defaults(ctx->priv_data);
+ }
+ }
+
+ *pctx = ctx;
+ return 0;
+fail:
+ av_bsf_free(&ctx);
+ return ret;
+}
+
+int av_bsf_init(AVBSFContext *ctx)
+{
+ int ret, i;
+
+ /* check that the codec is supported */
+ if (ctx->filter->codec_ids) {
+ for (i = 0; ctx->filter->codec_ids[i] != AV_CODEC_ID_NONE; i++)
+ if (ctx->par_in->codec_id == ctx->filter->codec_ids[i])
+ break;
+ if (ctx->filter->codec_ids[i] == AV_CODEC_ID_NONE) {
+ const AVCodecDescriptor *desc = avcodec_descriptor_get(ctx->par_in->codec_id);
+ av_log(ctx, AV_LOG_ERROR, "Codec '%s' (%d) is not supported by the "
+ "bitstream filter '%s'. Supported codecs are: ",
+ desc ? desc->name : "unknown", ctx->par_in->codec_id, ctx->filter->name);
+ for (i = 0; ctx->filter->codec_ids[i] != AV_CODEC_ID_NONE; i++) {
+ desc = avcodec_descriptor_get(ctx->filter->codec_ids[i]);
+ av_log(ctx, AV_LOG_ERROR, "%s (%d) ",
+ desc ? desc->name : "unknown", ctx->filter->codec_ids[i]);
+ }
+ av_log(ctx, AV_LOG_ERROR, "\n");
+ return AVERROR(EINVAL);
+ }
+ }
+
+ /* initialize output parameters to be the same as input
+ * init below might overwrite that */
+ ret = avcodec_parameters_copy(ctx->par_out, ctx->par_in);
+ if (ret < 0)
+ return ret;
+
+ ctx->time_base_out = ctx->time_base_in;
+
+ if (ctx->filter->init) {
+ ret = ctx->filter->init(ctx);
+ if (ret < 0)
+ return ret;
+ }
+
+ return 0;
+}
+
+int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt)
+{
+ if (!pkt || (!pkt->data && !pkt->side_data_elems)) {
+ ctx->internal->eof = 1;
+ return 0;
+ }
+
+ if (ctx->internal->eof) {
+ av_log(ctx, AV_LOG_ERROR, "A non-NULL packet sent after an EOF.\n");
+ return AVERROR(EINVAL);
+ }
+
+ if (ctx->internal->buffer_pkt->data ||
+ ctx->internal->buffer_pkt->side_data_elems)
+ return AVERROR(EAGAIN);
+
+ av_packet_move_ref(ctx->internal->buffer_pkt, pkt);
+
+ return 0;
+}
+
+int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt)
+{
+ return ctx->filter->filter(ctx, pkt);
+}
+
+int ff_bsf_get_packet(AVBSFContext *ctx, AVPacket **pkt)
+{
+ AVBSFInternal *in = ctx->internal;
+ AVPacket *tmp_pkt;
+
+ if (in->eof)
+ return AVERROR_EOF;
+
+ if (!ctx->internal->buffer_pkt->data &&
+ !ctx->internal->buffer_pkt->side_data_elems)
+ return AVERROR(EAGAIN);
+
+ tmp_pkt = av_packet_alloc();
+ if (!tmp_pkt)
+ return AVERROR(ENOMEM);
+
+ *pkt = ctx->internal->buffer_pkt;
+ ctx->internal->buffer_pkt = tmp_pkt;
+
+ return 0;
+}
+
+int ff_bsf_get_packet_ref(AVBSFContext *ctx, AVPacket *pkt)
+{
+ AVBSFInternal *in = ctx->internal;
+
+ if (in->eof)
+ return AVERROR_EOF;
+
+ if (!ctx->internal->buffer_pkt->data &&
+ !ctx->internal->buffer_pkt->side_data_elems)
+ return AVERROR(EAGAIN);
+
+ av_packet_move_ref(pkt, ctx->internal->buffer_pkt);
+
+ return 0;
+}
+
+typedef struct BSFListContext {
+ const AVClass *class;
+
+ AVBSFContext **bsfs;
+ int nb_bsfs;
+
+ unsigned idx; // index of currently processed BSF
+ unsigned flushed_idx; // index of BSF being flushed
+
+ char * item_name;
+} BSFListContext;
+
+
+static int bsf_list_init(AVBSFContext *bsf)
+{
+ BSFListContext *lst = bsf->priv_data;
+ int ret, i;
+ const AVCodecParameters *cod_par = bsf->par_in;
+ AVRational tb = bsf->time_base_in;
+
+ for (i = 0; i < lst->nb_bsfs; ++i) {
+ ret = avcodec_parameters_copy(lst->bsfs[i]->par_in, cod_par);
+ if (ret < 0)
+ goto fail;
+
+ lst->bsfs[i]->time_base_in = tb;
+
+ ret = av_bsf_init(lst->bsfs[i]);
+ if (ret < 0)
+ goto fail;
+
+ cod_par = lst->bsfs[i]->par_out;
+ tb = lst->bsfs[i]->time_base_out;
+ }
+
+ bsf->time_base_out = tb;
+ ret = avcodec_parameters_copy(bsf->par_out, cod_par);
+
+fail:
+ return ret;
+}
+
+static int bsf_list_filter(AVBSFContext *bsf, AVPacket *out)
+{
+ BSFListContext *lst = bsf->priv_data;
+ int ret;
+
+ if (!lst->nb_bsfs)
+ return ff_bsf_get_packet_ref(bsf, out);
+
+ while (1) {
+ if (lst->idx > lst->flushed_idx) {
+ ret = av_bsf_receive_packet(lst->bsfs[lst->idx-1], out);
+ if (ret == AVERROR(EAGAIN)) {
+ /* no more packets from idx-1, try with previous */
+ ret = 0;
+ lst->idx--;
+ continue;
+ } else if (ret == AVERROR_EOF) {
+ /* filter idx-1 is done, continue with idx...nb_bsfs */
+ lst->flushed_idx = lst->idx;
+ continue;
+ }else if (ret < 0) {
+ /* filtering error */
+ break;
+ }
+ } else {
+ ret = ff_bsf_get_packet_ref(bsf, out);
+ if (ret == AVERROR_EOF) {
+ lst->idx = lst->flushed_idx;
+ } else if (ret < 0)
+ break;
+ }
+
+ if (lst->idx < lst->nb_bsfs) {
+ AVPacket *pkt;
+ if (ret == AVERROR_EOF && lst->idx == lst->flushed_idx) {
+ /* ff_bsf_get_packet_ref returned EOF and idx is first
+ * filter of yet not flushed filter chain */
+ pkt = NULL;
+ } else {
+ pkt = out;
+ }
+ ret = av_bsf_send_packet(lst->bsfs[lst->idx], pkt);
+ if (ret < 0)
+ break;
+ lst->idx++;
+ } else {
+ /* The end of filter chain, break to return result */
+ break;
+ }
+ }
+
+ if (ret < 0)
+ av_packet_unref(out);
+
+ return ret;
+}
+
+static void bsf_list_close(AVBSFContext *bsf)
+{
+ BSFListContext *lst = bsf->priv_data;
+ int i;
+
+ for (i = 0; i < lst->nb_bsfs; ++i)
+ av_bsf_free(&lst->bsfs[i]);
+ av_freep(&lst->bsfs);
+ av_freep(&lst->item_name);
+}
+
+static const char *bsf_list_item_name(void *ctx)
+{
+ static const char *null_filter_name = "null";
+ AVBSFContext *bsf_ctx = ctx;
+ BSFListContext *lst = bsf_ctx->priv_data;
+
+ if (!lst->nb_bsfs)
+ return null_filter_name;
+
+ if (!lst->item_name) {
+ int i;
+ AVBPrint bp;
+ av_bprint_init(&bp, 16, 128);
+
+ av_bprintf(&bp, "bsf_list(");
+ for (i = 0; i < lst->nb_bsfs; i++)
+ av_bprintf(&bp, i ? ",%s" : "%s", lst->bsfs[i]->filter->name);
+ av_bprintf(&bp, ")");
+
+ av_bprint_finalize(&bp, &lst->item_name);
+ }
+
+ return lst->item_name;
+}
+
+static const AVClass bsf_list_class = {
+ .class_name = "bsf_list",
+ .item_name = bsf_list_item_name,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
+const AVBitStreamFilter ff_list_bsf = {
+ .name = "bsf_list",
+ .priv_data_size = sizeof(BSFListContext),
+ .priv_class = &bsf_list_class,
+ .init = bsf_list_init,
+ .filter = bsf_list_filter,
+ .close = bsf_list_close,
+};
+
+struct AVBSFList {
+ AVBSFContext **bsfs;
+ int nb_bsfs;
+};
+
+AVBSFList *av_bsf_list_alloc(void)
+{
+ return av_mallocz(sizeof(AVBSFList));
+}
+
+void av_bsf_list_free(AVBSFList **lst)
+{
+ int i;
+
+ if (!*lst)
+ return;
+
+ for (i = 0; i < (*lst)->nb_bsfs; ++i)
+ av_bsf_free(&(*lst)->bsfs[i]);
+ av_free((*lst)->bsfs);
+ av_freep(lst);
+}
+
+int av_bsf_list_append(AVBSFList *lst, AVBSFContext *bsf)
+{
+ return av_dynarray_add_nofree(&lst->bsfs, &lst->nb_bsfs, bsf);
+}
+
+int av_bsf_list_append2(AVBSFList *lst, const char *bsf_name, AVDictionary ** options)
+{
+ int ret;
+ const AVBitStreamFilter *filter;
+ AVBSFContext *bsf;
+
+ filter = av_bsf_get_by_name(bsf_name);
+ if (!filter)
+ return AVERROR_BSF_NOT_FOUND;
+
+ ret = av_bsf_alloc(filter, &bsf);
+ if (ret < 0)
+ return ret;
+
+ if (options) {
+ ret = av_opt_set_dict2(bsf, options, AV_OPT_SEARCH_CHILDREN);
+ if (ret < 0)
+ goto end;
+ }
+
+ ret = av_bsf_list_append(lst, bsf);
+
+end:
+ if (ret < 0)
+ av_bsf_free(&bsf);
+
+ return ret;
+}
+
+int av_bsf_list_finalize(AVBSFList **lst, AVBSFContext **bsf)
+{
+ int ret = 0;
+ BSFListContext *ctx;
+
+ if ((*lst)->nb_bsfs == 1) {
+ *bsf = (*lst)->bsfs[0];
+ av_freep(&(*lst)->bsfs);
+ (*lst)->nb_bsfs = 0;
+ goto end;
+ }
+
+ ret = av_bsf_alloc(&ff_list_bsf, bsf);
+ if (ret < 0)
+ return ret;
+
+ ctx = (*bsf)->priv_data;
+
+ ctx->bsfs = (*lst)->bsfs;
+ ctx->nb_bsfs = (*lst)->nb_bsfs;
+
+end:
+ av_freep(lst);
+ return ret;
+}
+
+static int bsf_parse_single(const char *str, AVBSFList *bsf_lst)
+{
+ char *bsf_name, *bsf_options_str, *buf;
+ AVDictionary *bsf_options = NULL;
+ int ret = 0;
+
+ if (!(buf = av_strdup(str)))
+ return AVERROR(ENOMEM);
+
+ bsf_name = av_strtok(buf, "=", &bsf_options_str);
+ if (!bsf_name) {
+ ret = AVERROR(EINVAL);
+ goto end;
+ }
+
+ if (bsf_options_str) {
+ ret = av_dict_parse_string(&bsf_options, bsf_options_str, "=", ":", 0);
+ if (ret < 0)
+ goto end;
+ }
+
+ ret = av_bsf_list_append2(bsf_lst, bsf_name, &bsf_options);
+
+ av_dict_free(&bsf_options);
+end:
+ av_free(buf);
+ return ret;
+}
+
+int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf_lst)
+{
+ AVBSFList *lst;
+ char *bsf_str, *buf, *dup, *saveptr;
+ int ret;
+
+ if (!str)
+ return av_bsf_get_null_filter(bsf_lst);
+
+ lst = av_bsf_list_alloc();
+ if (!lst)
+ return AVERROR(ENOMEM);
+
+ if (!(dup = buf = av_strdup(str))) {
+ ret = AVERROR(ENOMEM);
+ goto end;
+ }
+
+ while (1) {
+ bsf_str = av_strtok(buf, ",", &saveptr);
+ if (!bsf_str)
+ break;
+
+ ret = bsf_parse_single(bsf_str, lst);
+ if (ret < 0)
+ goto end;
+
+ buf = NULL;
+ }
+
+ ret = av_bsf_list_finalize(&lst, bsf_lst);
+end:
+ if (ret < 0)
+ av_bsf_list_free(&lst);
+ av_free(dup);
+ return ret;
+}
+
+int av_bsf_get_null_filter(AVBSFContext **bsf)
+{
+ return av_bsf_alloc(&ff_list_bsf, bsf);
+}
diff --git a/media/ffvpx/libavcodec/bsf_list.c b/media/ffvpx/libavcodec/bsf_list.c
new file mode 100644
index 0000000000..d31ece942a
--- /dev/null
+++ b/media/ffvpx/libavcodec/bsf_list.c
@@ -0,0 +1,3 @@
+static const AVBitStreamFilter * const bitstream_filters[] = {
+ &ff_null_bsf,
+ NULL };
diff --git a/media/ffvpx/libavcodec/bytestream.h b/media/ffvpx/libavcodec/bytestream.h
index 7c05ea6cf5..7be7fc22fc 100644
--- a/media/ffvpx/libavcodec/bytestream.h
+++ b/media/ffvpx/libavcodec/bytestream.h
@@ -94,7 +94,7 @@ DEF(unsigned int, be24, 3, AV_RB24, AV_WB24)
DEF(unsigned int, be16, 2, AV_RB16, AV_WB16)
DEF(unsigned int, byte, 1, AV_RB8 , AV_WB8)
-#if HAVE_BIGENDIAN
+#if AV_HAVE_BIGENDIAN
# define bytestream2_get_ne16 bytestream2_get_be16
# define bytestream2_get_ne24 bytestream2_get_be24
# define bytestream2_get_ne32 bytestream2_get_be32
diff --git a/media/ffvpx/libavcodec/codec_desc.c b/media/ffvpx/libavcodec/codec_desc.c
index d862cc8f6c..6a13bbbf0e 100644
--- a/media/ffvpx/libavcodec/codec_desc.c
+++ b/media/ffvpx/libavcodec/codec_desc.c
@@ -170,6 +170,14 @@ static const AVCodecDescriptor codec_descriptors[] = {
.props = AV_CODEC_PROP_LOSSY,
},
{
+ .id = AV_CODEC_ID_SVG,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "svg",
+ .long_name = NULL_IF_CONFIG_SMALL("Scalable Vector Graphics"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ .mime_types= MT("image/svg+xml"),
+ },
+ {
.id = AV_CODEC_ID_SVQ1,
.type = AVMEDIA_TYPE_VIDEO,
.name = "svq1",
@@ -520,7 +528,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.type = AVMEDIA_TYPE_VIDEO,
.name = "fraps",
.long_name = NULL_IF_CONFIG_SMALL("Fraps"),
- .props = AV_CODEC_PROP_LOSSLESS,
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_TRUEMOTION2,
@@ -665,6 +673,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.name = "dnxhd",
.long_name = NULL_IF_CONFIG_SMALL("VC3/DNxHD"),
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ .profiles = NULL_IF_CONFIG_SMALL(ff_dnxhd_profiles),
},
{
.id = AV_CODEC_ID_THP,
@@ -1106,7 +1115,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.type = AVMEDIA_TYPE_VIDEO,
.name = "y41p",
.long_name = NULL_IF_CONFIG_SMALL("Uncompressed YUV 4:1:1 12-bit"),
- .props = AV_CODEC_PROP_INTRA_ONLY,
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_ESCAPE130,
@@ -1120,56 +1129,56 @@ static const AVCodecDescriptor codec_descriptors[] = {
.type = AVMEDIA_TYPE_VIDEO,
.name = "avrp",
.long_name = NULL_IF_CONFIG_SMALL("Avid 1:1 10-bit RGB Packer"),
- .props = AV_CODEC_PROP_INTRA_ONLY,
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_012V,
.type = AVMEDIA_TYPE_VIDEO,
.name = "012v",
.long_name = NULL_IF_CONFIG_SMALL("Uncompressed 4:2:2 10-bit"),
- .props = AV_CODEC_PROP_INTRA_ONLY,
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_AVUI,
.type = AVMEDIA_TYPE_VIDEO,
.name = "avui",
.long_name = NULL_IF_CONFIG_SMALL("Avid Meridien Uncompressed"),
- .props = AV_CODEC_PROP_INTRA_ONLY,
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_AYUV,
.type = AVMEDIA_TYPE_VIDEO,
.name = "ayuv",
.long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed MS 4:4:4:4"),
- .props = AV_CODEC_PROP_INTRA_ONLY,
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_TARGA_Y216,
.type = AVMEDIA_TYPE_VIDEO,
.name = "targa_y216",
.long_name = NULL_IF_CONFIG_SMALL("Pinnacle TARGA CineWave YUV16"),
- .props = AV_CODEC_PROP_INTRA_ONLY,
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_V308,
.type = AVMEDIA_TYPE_VIDEO,
.name = "v308",
.long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed 4:4:4"),
- .props = AV_CODEC_PROP_INTRA_ONLY,
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_V408,
.type = AVMEDIA_TYPE_VIDEO,
.name = "v408",
.long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed QT 4:4:4:4"),
- .props = AV_CODEC_PROP_INTRA_ONLY,
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_YUV4,
.type = AVMEDIA_TYPE_VIDEO,
.name = "yuv4",
.long_name = NULL_IF_CONFIG_SMALL("Uncompressed packed 4:2:0"),
- .props = AV_CODEC_PROP_INTRA_ONLY,
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_AVRN,
@@ -1272,7 +1281,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.id = AV_CODEC_ID_HAP,
.type = AVMEDIA_TYPE_VIDEO,
.name = "hap",
- .long_name = NULL_IF_CONFIG_SMALL("Vidvox Hap decoder"),
+ .long_name = NULL_IF_CONFIG_SMALL("Vidvox Hap"),
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
},
{
@@ -1290,6 +1299,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
.props = AV_CODEC_PROP_LOSSLESS,
},
{
+ .id = AV_CODEC_ID_SPEEDHQ,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "speedhq",
+ .long_name = NULL_IF_CONFIG_SMALL("NewTek SpeedHQ"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
.id = AV_CODEC_ID_WRAPPED_AVFRAME,
.type = AVMEDIA_TYPE_VIDEO,
.name = "wrapped_avframe",
@@ -1303,6 +1319,104 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("innoHeim/Rsupport Screen Capture Codec"),
.props = AV_CODEC_PROP_LOSSLESS,
},
+ {
+ .id = AV_CODEC_ID_MAGICYUV,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "magicyuv",
+ .long_name = NULL_IF_CONFIG_SMALL("MagicYUV video"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_TRUEMOTION2RT,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "truemotion2rt",
+ .long_name = NULL_IF_CONFIG_SMALL("Duck TrueMotion 2.0 Real Time"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_CFHD,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "cfhd",
+ .long_name = NULL_IF_CONFIG_SMALL("Cineform HD"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_SHEERVIDEO,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "sheervideo",
+ .long_name = NULL_IF_CONFIG_SMALL("BitJazz SheerVideo"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_YLC,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "ylc",
+ .long_name = NULL_IF_CONFIG_SMALL("YUY2 Lossless Codec"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PIXLET,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "pixlet",
+ .long_name = NULL_IF_CONFIG_SMALL("Apple Pixlet"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_FMVC,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "fmvc",
+ .long_name = NULL_IF_CONFIG_SMALL("FM Screen Capture Codec"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_SCPR,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "scpr",
+ .long_name = NULL_IF_CONFIG_SMALL("ScreenPressor"),
+ .props = AV_CODEC_PROP_LOSSLESS | AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_CLEARVIDEO,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "clearvideo",
+ .long_name = NULL_IF_CONFIG_SMALL("Iterated Systems ClearVideo"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_AV1,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "av1",
+ .long_name = NULL_IF_CONFIG_SMALL("Alliance for Open Media AV1"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
+ .id = AV_CODEC_ID_BITPACKED,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "bitpacked",
+ .long_name = NULL_IF_CONFIG_SMALL("Bitpacked"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_MSCC,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "mscc",
+ .long_name = NULL_IF_CONFIG_SMALL("Mandsoft Screen Capture Codec"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_SRGC,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "srgc",
+ .long_name = NULL_IF_CONFIG_SMALL("Screen Recorder Gold Codec"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_GDV,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "gdv",
+ .long_name = NULL_IF_CONFIG_SMALL("Gremlin Digital Video"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
/* image codecs */
{
@@ -1350,6 +1464,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
AV_CODEC_PROP_LOSSLESS,
},
{
+ .id = AV_CODEC_ID_FITS,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "fits",
+ .long_name = NULL_IF_CONFIG_SMALL("FITS (Flexible Image Transport System)"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
.id = AV_CODEC_ID_GIF,
.type = AVMEDIA_TYPE_VIDEO,
.name = "gif",
@@ -1425,6 +1546,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
},
{
+ .id = AV_CODEC_ID_PSD,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "psd",
+ .long_name = NULL_IF_CONFIG_SMALL("Photoshop PSD file"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ },
+ {
.id = AV_CODEC_ID_PTX,
.type = AVMEDIA_TYPE_VIDEO,
.name = "ptx",
@@ -1511,6 +1639,15 @@ static const AVCodecDescriptor codec_descriptors[] = {
.name = "xbm",
.long_name = NULL_IF_CONFIG_SMALL("XBM (X BitMap) image"),
.props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ .mime_types= MT("image/x-xbitmap"),
+ },
+ {
+ .id = AV_CODEC_ID_XPM,
+ .type = AVMEDIA_TYPE_VIDEO,
+ .name = "xpm",
+ .long_name = NULL_IF_CONFIG_SMALL("XPM (X PixMap) image"),
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
+ .mime_types= MT("image/x-xpixmap"),
},
{
.id = AV_CODEC_ID_XWD,
@@ -1528,41 +1665,6 @@ static const AVCodecDescriptor codec_descriptors[] = {
.props = AV_CODEC_PROP_LOSSLESS,
.mime_types= MT("image/png"),
},
- {
- .id = AV_CODEC_ID_CFHD,
- .type = AVMEDIA_TYPE_VIDEO,
- .name = "cfhd",
- .long_name = NULL_IF_CONFIG_SMALL("Cineform HD"),
- .props = AV_CODEC_PROP_LOSSY,
- },
- {
- .id = AV_CODEC_ID_TRUEMOTION2RT,
- .type = AVMEDIA_TYPE_VIDEO,
- .name = "truemotion2rt",
- .long_name = NULL_IF_CONFIG_SMALL("Duck TrueMotion 2.0 Real Time"),
- .props = AV_CODEC_PROP_LOSSY,
- },
- {
- .id = AV_CODEC_ID_MAGICYUV,
- .type = AVMEDIA_TYPE_VIDEO,
- .name = "magicyuv",
- .long_name = NULL_IF_CONFIG_SMALL("MagicYUV Lossless Video"),
- .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
- },
- {
- .id = AV_CODEC_ID_SHEERVIDEO,
- .type = AVMEDIA_TYPE_VIDEO,
- .name = "sheervideo",
- .long_name = NULL_IF_CONFIG_SMALL("BitJazz SheerVideo"),
- .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
- },
- {
- .id = AV_CODEC_ID_YLC,
- .type = AVMEDIA_TYPE_VIDEO,
- .name = "ylc",
- .long_name = NULL_IF_CONFIG_SMALL("YUY2 Lossless Codec"),
- .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
- },
/* various PCM "codecs" */
{
@@ -1636,6 +1738,20 @@ static const AVCodecDescriptor codec_descriptors[] = {
.props = AV_CODEC_PROP_LOSSLESS,
},
{
+ .id = AV_CODEC_ID_PCM_S64LE,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_s64le",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM signed 64-bit little-endian"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PCM_S64BE,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_s64be",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM signed 64-bit big-endian"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
.id = AV_CODEC_ID_PCM_U32LE,
.type = AVMEDIA_TYPE_AUDIO,
.name = "pcm_u32le",
@@ -1727,6 +1843,20 @@ static const AVCodecDescriptor codec_descriptors[] = {
.props = AV_CODEC_PROP_LOSSLESS,
},
{
+ .id = AV_CODEC_ID_PCM_F16LE,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_f16le",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM 16.8 floating point little-endian"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_PCM_F24LE,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "pcm_f24le",
+ .long_name = NULL_IF_CONFIG_SMALL("PCM 24.0 floating point little-endian"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
.id = AV_CODEC_ID_PCM_F32BE,
.type = AVMEDIA_TYPE_AUDIO,
.name = "pcm_f32be",
@@ -2133,6 +2263,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("DPCM Squareroot-Delta-Exact"),
.props = AV_CODEC_PROP_LOSSY,
},
+ {
+ .id = AV_CODEC_ID_GREMLIN_DPCM,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "gremlin_dpcm",
+ .long_name = NULL_IF_CONFIG_SMALL("DPCM Gremlin"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
/* audio codecs */
{
@@ -2226,7 +2363,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.type = AVMEDIA_TYPE_AUDIO,
.name = "flac",
.long_name = NULL_IF_CONFIG_SMALL("FLAC (Free Lossless Audio Codec)"),
- .props = AV_CODEC_PROP_LOSSLESS,
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_MP3ADU,
@@ -2254,7 +2391,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.type = AVMEDIA_TYPE_AUDIO,
.name = "alac",
.long_name = NULL_IF_CONFIG_SMALL("ALAC (Apple Lossless Audio Codec)"),
- .props = AV_CODEC_PROP_LOSSLESS,
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_WESTWOOD_SND1,
@@ -2281,7 +2418,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.id = AV_CODEC_ID_COOK,
.type = AVMEDIA_TYPE_AUDIO,
.name = "cook",
- .long_name = NULL_IF_CONFIG_SMALL("Cook / Cooker / Goanna (RealAudio G2)"),
+ .long_name = NULL_IF_CONFIG_SMALL("Cook / Cooker / Gecko (RealAudio G2)"),
.props = AV_CODEC_PROP_LOSSY,
},
{
@@ -2296,7 +2433,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.type = AVMEDIA_TYPE_AUDIO,
.name = "tta",
.long_name = NULL_IF_CONFIG_SMALL("TTA (True Audio)"),
- .props = AV_CODEC_PROP_LOSSLESS,
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_SMACKAUDIO,
@@ -2317,7 +2454,8 @@ static const AVCodecDescriptor codec_descriptors[] = {
.type = AVMEDIA_TYPE_AUDIO,
.name = "wavpack",
.long_name = NULL_IF_CONFIG_SMALL("WavPack"),
- .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS,
+ .props = AV_CODEC_PROP_INTRA_ONLY |
+ AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_DSICINAUDIO,
@@ -2427,6 +2565,20 @@ static const AVCodecDescriptor codec_descriptors[] = {
.props = AV_CODEC_PROP_LOSSY,
},
{
+ .id = AV_CODEC_ID_ATRAC3PAL,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "atrac3pal",
+ .long_name = NULL_IF_CONFIG_SMALL("ATRAC3+ AL (Adaptive TRansform Acoustic Coding 3+ Advanced Lossless)"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
+ .id = AV_CODEC_ID_ATRAC3AL,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "atrac3al",
+ .long_name = NULL_IF_CONFIG_SMALL("ATRAC3 AL (Adaptive TRansform Acoustic Coding 3 Advanced Lossless)"),
+ .props = AV_CODEC_PROP_LOSSLESS,
+ },
+ {
.id = AV_CODEC_ID_EAC3,
.type = AVMEDIA_TYPE_AUDIO,
.name = "eac3",
@@ -2526,6 +2678,13 @@ static const AVCodecDescriptor codec_descriptors[] = {
.props = AV_CODEC_PROP_LOSSY,
},
{
+ .id = AV_CODEC_ID_DOLBY_E,
+ .type = AVMEDIA_TYPE_AUDIO,
+ .name = "dolby_e",
+ .long_name = NULL_IF_CONFIG_SMALL("Dolby E"),
+ .props = AV_CODEC_PROP_LOSSY,
+ },
+ {
.id = AV_CODEC_ID_G729,
.type = AVMEDIA_TYPE_AUDIO,
.name = "g729",
@@ -2611,7 +2770,7 @@ static const AVCodecDescriptor codec_descriptors[] = {
.type = AVMEDIA_TYPE_AUDIO,
.name = "tak",
.long_name = NULL_IF_CONFIG_SMALL("TAK (Tom's lossless Audio Kompressor)"),
- .props = AV_CODEC_PROP_LOSSLESS,
+ .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSLESS,
},
{
.id = AV_CODEC_ID_METASOUND,
@@ -2949,6 +3108,12 @@ static const AVCodecDescriptor codec_descriptors[] = {
.long_name = NULL_IF_CONFIG_SMALL("binary data"),
.mime_types= MT("application/octet-stream"),
},
+ {
+ .id = AV_CODEC_ID_SCTE_35,
+ .type = AVMEDIA_TYPE_DATA,
+ .name = "scte_35",
+ .long_name = NULL_IF_CONFIG_SMALL("SCTE 35 Message Queue"),
+ },
/* deprecated codec ids */
};
diff --git a/media/ffvpx/libavcodec/dct.h b/media/ffvpx/libavcodec/dct.h
deleted file mode 100644
index 05297ba9db..0000000000
--- a/media/ffvpx/libavcodec/dct.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * (I)DCT Transforms
- * Copyright (c) 2009 Peter Ross <pross@xvid.org>
- * Copyright (c) 2010 Alex Converse <alex.converse@gmail.com>
- * Copyright (c) 2010 Vitor Sessak
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#if !defined(AVCODEC_DCT_H) && (!defined(FFT_FLOAT) || FFT_FLOAT)
-#define AVCODEC_DCT_H
-
-#include <stdint.h>
-
-#include "rdft.h"
-
-struct DCTContext {
- int nbits;
- int inverse;
- RDFTContext rdft;
- const float *costab;
- FFTSample *csc2;
- void (*dct_calc)(struct DCTContext *s, FFTSample *data);
- void (*dct32)(FFTSample *out, const FFTSample *in);
-};
-
-/**
- * Set up DCT.
- * @param nbits size of the input array:
- * (1 << nbits) for DCT-II, DCT-III and DST-I
- * (1 << nbits) + 1 for DCT-I
- *
- * @note the first element of the input of DST-I is ignored
- */
-int ff_dct_init(DCTContext *s, int nbits, enum DCTTransformType type);
-void ff_dct_end (DCTContext *s);
-
-void ff_dct_init_x86(DCTContext *s);
-
-void ff_fdct_ifast(int16_t *data);
-void ff_fdct_ifast248(int16_t *data);
-void ff_jpeg_fdct_islow_8(int16_t *data);
-void ff_jpeg_fdct_islow_10(int16_t *data);
-void ff_fdct248_islow_8(int16_t *data);
-void ff_fdct248_islow_10(int16_t *data);
-
-void ff_j_rev_dct(int16_t *data);
-void ff_j_rev_dct4(int16_t *data);
-void ff_j_rev_dct2(int16_t *data);
-void ff_j_rev_dct1(int16_t *data);
-void ff_jref_idct_put(uint8_t *dest, int line_size, int16_t *block);
-void ff_jref_idct_add(uint8_t *dest, int line_size, int16_t *block);
-
-#endif /* AVCODEC_DCT_H */
diff --git a/media/ffvpx/libavcodec/decode.c b/media/ffvpx/libavcodec/decode.c
new file mode 100644
index 0000000000..fb1824be1c
--- /dev/null
+++ b/media/ffvpx/libavcodec/decode.c
@@ -0,0 +1,1761 @@
+/*
+ * generic decoding-related code
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdint.h>
+#include <string.h>
+
+#include "config.h"
+
+#if CONFIG_ICONV
+# include <iconv.h>
+#endif
+
+#include "libavutil/avassert.h"
+#include "libavutil/avstring.h"
+#include "libavutil/bprint.h"
+#include "libavutil/common.h"
+#include "libavutil/frame.h"
+#include "libavutil/hwcontext.h"
+#include "libavutil/imgutils.h"
+#include "libavutil/internal.h"
+#include "libavutil/intmath.h"
+
+#include "avcodec.h"
+#include "bytestream.h"
+#include "decode.h"
+#include "internal.h"
+#include "thread.h"
+
+static int apply_param_change(AVCodecContext *avctx, const AVPacket *avpkt)
+{
+ int size = 0, ret;
+ const uint8_t *data;
+ uint32_t flags;
+ int64_t val;
+
+ data = av_packet_get_side_data(avpkt, AV_PKT_DATA_PARAM_CHANGE, &size);
+ if (!data)
+ return 0;
+
+ if (!(avctx->codec->capabilities & AV_CODEC_CAP_PARAM_CHANGE)) {
+ av_log(avctx, AV_LOG_ERROR, "This decoder does not support parameter "
+ "changes, but PARAM_CHANGE side data was sent to it.\n");
+ ret = AVERROR(EINVAL);
+ goto fail2;
+ }
+
+ if (size < 4)
+ goto fail;
+
+ flags = bytestream_get_le32(&data);
+ size -= 4;
+
+ if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) {
+ if (size < 4)
+ goto fail;
+ val = bytestream_get_le32(&data);
+ if (val <= 0 || val > INT_MAX) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid channel count");
+ ret = AVERROR_INVALIDDATA;
+ goto fail2;
+ }
+ avctx->channels = val;
+ size -= 4;
+ }
+ if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) {
+ if (size < 8)
+ goto fail;
+ avctx->channel_layout = bytestream_get_le64(&data);
+ size -= 8;
+ }
+ if (flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) {
+ if (size < 4)
+ goto fail;
+ val = bytestream_get_le32(&data);
+ if (val <= 0 || val > INT_MAX) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid sample rate");
+ ret = AVERROR_INVALIDDATA;
+ goto fail2;
+ }
+ avctx->sample_rate = val;
+ size -= 4;
+ }
+ if (flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS) {
+ if (size < 8)
+ goto fail;
+ avctx->width = bytestream_get_le32(&data);
+ avctx->height = bytestream_get_le32(&data);
+ size -= 8;
+ ret = ff_set_dimensions(avctx, avctx->width, avctx->height);
+ if (ret < 0)
+ goto fail2;
+ }
+
+ return 0;
+fail:
+ av_log(avctx, AV_LOG_ERROR, "PARAM_CHANGE side data too small.\n");
+ ret = AVERROR_INVALIDDATA;
+fail2:
+ if (ret < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error applying parameter changes.\n");
+ if (avctx->err_recognition & AV_EF_EXPLODE)
+ return ret;
+ }
+ return 0;
+}
+
+static int extract_packet_props(AVCodecInternal *avci, const AVPacket *pkt)
+{
+ int ret = 0;
+
+ av_packet_unref(avci->last_pkt_props);
+ if (pkt) {
+ ret = av_packet_copy_props(avci->last_pkt_props, pkt);
+ if (!ret)
+ avci->last_pkt_props->size = pkt->size; // HACK: Needed for ff_init_buffer_info().
+ }
+ return ret;
+}
+
+static int unrefcount_frame(AVCodecInternal *avci, AVFrame *frame)
+{
+ int ret;
+
+ /* move the original frame to our backup */
+ av_frame_unref(avci->to_free);
+ av_frame_move_ref(avci->to_free, frame);
+
+ /* now copy everything except the AVBufferRefs back
+ * note that we make a COPY of the side data, so calling av_frame_free() on
+ * the caller's frame will work properly */
+ ret = av_frame_copy_props(frame, avci->to_free);
+ if (ret < 0)
+ return ret;
+
+ memcpy(frame->data, avci->to_free->data, sizeof(frame->data));
+ memcpy(frame->linesize, avci->to_free->linesize, sizeof(frame->linesize));
+ if (avci->to_free->extended_data != avci->to_free->data) {
+ int planes = avci->to_free->channels;
+ int size = planes * sizeof(*frame->extended_data);
+
+ if (!size) {
+ av_frame_unref(frame);
+ return AVERROR_BUG;
+ }
+
+ frame->extended_data = av_malloc(size);
+ if (!frame->extended_data) {
+ av_frame_unref(frame);
+ return AVERROR(ENOMEM);
+ }
+ memcpy(frame->extended_data, avci->to_free->extended_data,
+ size);
+ } else
+ frame->extended_data = frame->data;
+
+ frame->format = avci->to_free->format;
+ frame->width = avci->to_free->width;
+ frame->height = avci->to_free->height;
+ frame->channel_layout = avci->to_free->channel_layout;
+ frame->nb_samples = avci->to_free->nb_samples;
+ frame->channels = avci->to_free->channels;
+
+ return 0;
+}
+
+static int bsfs_init(AVCodecContext *avctx)
+{
+ AVCodecInternal *avci = avctx->internal;
+ DecodeFilterContext *s = &avci->filter;
+ const char *bsfs_str;
+ int ret;
+
+ if (s->nb_bsfs)
+ return 0;
+
+ bsfs_str = avctx->codec->bsfs ? avctx->codec->bsfs : "null";
+ while (bsfs_str && *bsfs_str) {
+ AVBSFContext **tmp;
+ const AVBitStreamFilter *filter;
+ char *bsf;
+
+ bsf = av_get_token(&bsfs_str, ",");
+ if (!bsf) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+
+ filter = av_bsf_get_by_name(bsf);
+ if (!filter) {
+ av_log(avctx, AV_LOG_ERROR, "A non-existing bitstream filter %s "
+ "requested by a decoder. This is a bug, please report it.\n",
+ bsf);
+ ret = AVERROR_BUG;
+ av_freep(&bsf);
+ goto fail;
+ }
+ av_freep(&bsf);
+
+ tmp = av_realloc_array(s->bsfs, s->nb_bsfs + 1, sizeof(*s->bsfs));
+ if (!tmp) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ s->bsfs = tmp;
+ s->nb_bsfs++;
+
+ ret = av_bsf_alloc(filter, &s->bsfs[s->nb_bsfs - 1]);
+ if (ret < 0)
+ goto fail;
+
+ if (s->nb_bsfs == 1) {
+ /* We do not currently have an API for passing the input timebase into decoders,
+ * but no filters used here should actually need it.
+ * So we make up some plausible-looking number (the MPEG 90kHz timebase) */
+ s->bsfs[s->nb_bsfs - 1]->time_base_in = (AVRational){ 1, 90000 };
+ ret = avcodec_parameters_from_context(s->bsfs[s->nb_bsfs - 1]->par_in,
+ avctx);
+ } else {
+ s->bsfs[s->nb_bsfs - 1]->time_base_in = s->bsfs[s->nb_bsfs - 2]->time_base_out;
+ ret = avcodec_parameters_copy(s->bsfs[s->nb_bsfs - 1]->par_in,
+ s->bsfs[s->nb_bsfs - 2]->par_out);
+ }
+ if (ret < 0)
+ goto fail;
+
+ ret = av_bsf_init(s->bsfs[s->nb_bsfs - 1]);
+ if (ret < 0)
+ goto fail;
+ }
+
+ return 0;
+fail:
+ ff_decode_bsfs_uninit(avctx);
+ return ret;
+}
+
+/* try to get one output packet from the filter chain */
+static int bsfs_poll(AVCodecContext *avctx, AVPacket *pkt)
+{
+ DecodeFilterContext *s = &avctx->internal->filter;
+ int idx, ret;
+
+ /* start with the last filter in the chain */
+ idx = s->nb_bsfs - 1;
+ while (idx >= 0) {
+ /* request a packet from the currently selected filter */
+ ret = av_bsf_receive_packet(s->bsfs[idx], pkt);
+ if (ret == AVERROR(EAGAIN)) {
+ /* no packets available, try the next filter up the chain */
+ ret = 0;
+ idx--;
+ continue;
+ } else if (ret < 0 && ret != AVERROR_EOF) {
+ return ret;
+ }
+
+ /* got a packet or EOF -- pass it to the caller or to the next filter
+ * down the chain */
+ if (idx == s->nb_bsfs - 1) {
+ return ret;
+ } else {
+ idx++;
+ ret = av_bsf_send_packet(s->bsfs[idx], ret < 0 ? NULL : pkt);
+ if (ret < 0) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Error pre-processing a packet before decoding\n");
+ av_packet_unref(pkt);
+ return ret;
+ }
+ }
+ }
+
+ return AVERROR(EAGAIN);
+}
+
+int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt)
+{
+ AVCodecInternal *avci = avctx->internal;
+ int ret;
+
+ if (avci->draining)
+ return AVERROR_EOF;
+
+ ret = bsfs_poll(avctx, pkt);
+ if (ret == AVERROR_EOF)
+ avci->draining = 1;
+ if (ret < 0)
+ return ret;
+
+ ret = extract_packet_props(avctx->internal, pkt);
+ if (ret < 0)
+ goto finish;
+
+ ret = apply_param_change(avctx, pkt);
+ if (ret < 0)
+ goto finish;
+
+ if (avctx->codec->receive_frame)
+ avci->compat_decode_consumed += pkt->size;
+
+ return 0;
+finish:
+ av_packet_unref(pkt);
+ return ret;
+}
+
+/**
+ * Attempt to guess proper monotonic timestamps for decoded video frames
+ * which might have incorrect times. Input timestamps may wrap around, in
+ * which case the output will as well.
+ *
+ * @param pts the pts field of the decoded AVPacket, as passed through
+ * AVFrame.pts
+ * @param dts the dts field of the decoded AVPacket
+ * @return one of the input values, may be AV_NOPTS_VALUE
+ */
+static int64_t guess_correct_pts(AVCodecContext *ctx,
+ int64_t reordered_pts, int64_t dts)
+{
+ int64_t pts = AV_NOPTS_VALUE;
+
+ if (dts != AV_NOPTS_VALUE) {
+ ctx->pts_correction_num_faulty_dts += dts <= ctx->pts_correction_last_dts;
+ ctx->pts_correction_last_dts = dts;
+ } else if (reordered_pts != AV_NOPTS_VALUE)
+ ctx->pts_correction_last_dts = reordered_pts;
+
+ if (reordered_pts != AV_NOPTS_VALUE) {
+ ctx->pts_correction_num_faulty_pts += reordered_pts <= ctx->pts_correction_last_pts;
+ ctx->pts_correction_last_pts = reordered_pts;
+ } else if(dts != AV_NOPTS_VALUE)
+ ctx->pts_correction_last_pts = dts;
+
+ if ((ctx->pts_correction_num_faulty_pts<=ctx->pts_correction_num_faulty_dts || dts == AV_NOPTS_VALUE)
+ && reordered_pts != AV_NOPTS_VALUE)
+ pts = reordered_pts;
+ else
+ pts = dts;
+
+ return pts;
+}
+
+/*
+ * The core of the receive_frame_wrapper for the decoders implementing
+ * the simple API. Certain decoders might consume partial packets without
+ * returning any output, so this function needs to be called in a loop until it
+ * returns EAGAIN.
+ **/
+static int decode_simple_internal(AVCodecContext *avctx, AVFrame *frame)
+{
+ AVCodecInternal *avci = avctx->internal;
+ DecodeSimpleContext *ds = &avci->ds;
+ AVPacket *pkt = ds->in_pkt;
+ // copy to ensure we do not change pkt
+ AVPacket tmp;
+ int got_frame, actual_got_frame, did_split;
+ int ret;
+
+ if (!pkt->data && !avci->draining) {
+ av_packet_unref(pkt);
+ ret = ff_decode_get_packet(avctx, pkt);
+ if (ret < 0 && ret != AVERROR_EOF)
+ return ret;
+ }
+
+ // Some codecs (at least wma lossless) will crash when feeding drain packets
+ // after EOF was signaled.
+ if (avci->draining_done)
+ return AVERROR_EOF;
+
+ if (!pkt->data &&
+ !(avctx->codec->capabilities & AV_CODEC_CAP_DELAY ||
+ avctx->active_thread_type & FF_THREAD_FRAME))
+ return AVERROR_EOF;
+
+ tmp = *pkt;
+#if FF_API_MERGE_SD
+FF_DISABLE_DEPRECATION_WARNINGS
+ did_split = avci->compat_decode_partial_size ?
+ ff_packet_split_and_drop_side_data(&tmp) :
+ av_packet_split_side_data(&tmp);
+
+ if (did_split) {
+ ret = extract_packet_props(avctx->internal, &tmp);
+ if (ret < 0)
+ return ret;
+
+ ret = apply_param_change(avctx, &tmp);
+ if (ret < 0)
+ return ret;
+ }
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
+ got_frame = 0;
+
+ if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME) {
+ ret = ff_thread_decode_frame(avctx, frame, &got_frame, &tmp);
+ } else {
+ ret = avctx->codec->decode(avctx, frame, &got_frame, &tmp);
+
+ if (!(avctx->codec->caps_internal & FF_CODEC_CAP_SETS_PKT_DTS))
+ frame->pkt_dts = pkt->dts;
+ if (avctx->codec->type == AVMEDIA_TYPE_VIDEO) {
+ if(!avctx->has_b_frames)
+ frame->pkt_pos = pkt->pos;
+ //FIXME these should be under if(!avctx->has_b_frames)
+ /* get_buffer is supposed to set frame parameters */
+ if (!(avctx->codec->capabilities & AV_CODEC_CAP_DR1)) {
+ if (!frame->sample_aspect_ratio.num) frame->sample_aspect_ratio = avctx->sample_aspect_ratio;
+ if (!frame->width) frame->width = avctx->width;
+ if (!frame->height) frame->height = avctx->height;
+ if (frame->format == AV_PIX_FMT_NONE) frame->format = avctx->pix_fmt;
+ }
+ }
+ }
+ emms_c();
+ actual_got_frame = got_frame;
+
+ if (avctx->codec->type == AVMEDIA_TYPE_VIDEO) {
+ if (frame->flags & AV_FRAME_FLAG_DISCARD)
+ got_frame = 0;
+ if (got_frame)
+ frame->best_effort_timestamp = guess_correct_pts(avctx,
+ frame->pts,
+ frame->pkt_dts);
+ } else if (avctx->codec->type == AVMEDIA_TYPE_AUDIO) {
+ uint8_t *side;
+ int side_size;
+ uint32_t discard_padding = 0;
+ uint8_t skip_reason = 0;
+ uint8_t discard_reason = 0;
+
+ if (ret >= 0 && got_frame) {
+ frame->best_effort_timestamp = guess_correct_pts(avctx,
+ frame->pts,
+ frame->pkt_dts);
+ if (frame->format == AV_SAMPLE_FMT_NONE)
+ frame->format = avctx->sample_fmt;
+ if (!frame->channel_layout)
+ frame->channel_layout = avctx->channel_layout;
+ if (!frame->channels)
+ frame->channels = avctx->channels;
+ if (!frame->sample_rate)
+ frame->sample_rate = avctx->sample_rate;
+ }
+
+ side= av_packet_get_side_data(avci->last_pkt_props, AV_PKT_DATA_SKIP_SAMPLES, &side_size);
+ if(side && side_size>=10) {
+ avctx->internal->skip_samples = AV_RL32(side) * avctx->internal->skip_samples_multiplier;
+ discard_padding = AV_RL32(side + 4);
+ av_log(avctx, AV_LOG_DEBUG, "skip %d / discard %d samples due to side data\n",
+ avctx->internal->skip_samples, (int)discard_padding);
+ skip_reason = AV_RL8(side + 8);
+ discard_reason = AV_RL8(side + 9);
+ }
+
+ if ((frame->flags & AV_FRAME_FLAG_DISCARD) && got_frame &&
+ !(avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL)) {
+ avctx->internal->skip_samples = FFMAX(0, avctx->internal->skip_samples - frame->nb_samples);
+ got_frame = 0;
+ }
+
+ if (avctx->internal->skip_samples > 0 && got_frame &&
+ !(avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL)) {
+ if(frame->nb_samples <= avctx->internal->skip_samples){
+ got_frame = 0;
+ avctx->internal->skip_samples -= frame->nb_samples;
+ av_log(avctx, AV_LOG_DEBUG, "skip whole frame, skip left: %d\n",
+ avctx->internal->skip_samples);
+ } else {
+ av_samples_copy(frame->extended_data, frame->extended_data, 0, avctx->internal->skip_samples,
+ frame->nb_samples - avctx->internal->skip_samples, avctx->channels, frame->format);
+ if(avctx->pkt_timebase.num && avctx->sample_rate) {
+ int64_t diff_ts = av_rescale_q(avctx->internal->skip_samples,
+ (AVRational){1, avctx->sample_rate},
+ avctx->pkt_timebase);
+ if(frame->pts!=AV_NOPTS_VALUE)
+ frame->pts += diff_ts;
+#if FF_API_PKT_PTS
+FF_DISABLE_DEPRECATION_WARNINGS
+ if(frame->pkt_pts!=AV_NOPTS_VALUE)
+ frame->pkt_pts += diff_ts;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+ if(frame->pkt_dts!=AV_NOPTS_VALUE)
+ frame->pkt_dts += diff_ts;
+ if (frame->pkt_duration >= diff_ts)
+ frame->pkt_duration -= diff_ts;
+ } else {
+ av_log(avctx, AV_LOG_WARNING, "Could not update timestamps for skipped samples.\n");
+ }
+ av_log(avctx, AV_LOG_DEBUG, "skip %d/%d samples\n",
+ avctx->internal->skip_samples, frame->nb_samples);
+ frame->nb_samples -= avctx->internal->skip_samples;
+ avctx->internal->skip_samples = 0;
+ }
+ }
+
+ if (discard_padding > 0 && discard_padding <= frame->nb_samples && got_frame &&
+ !(avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL)) {
+ if (discard_padding == frame->nb_samples) {
+ got_frame = 0;
+ } else {
+ if(avctx->pkt_timebase.num && avctx->sample_rate) {
+ int64_t diff_ts = av_rescale_q(frame->nb_samples - discard_padding,
+ (AVRational){1, avctx->sample_rate},
+ avctx->pkt_timebase);
+ frame->pkt_duration = diff_ts;
+ } else {
+ av_log(avctx, AV_LOG_WARNING, "Could not update timestamps for discarded samples.\n");
+ }
+ av_log(avctx, AV_LOG_DEBUG, "discard %d/%d samples\n",
+ (int)discard_padding, frame->nb_samples);
+ frame->nb_samples -= discard_padding;
+ }
+ }
+
+ if ((avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL) && got_frame) {
+ AVFrameSideData *fside = av_frame_new_side_data(frame, AV_FRAME_DATA_SKIP_SAMPLES, 10);
+ if (fside) {
+ AV_WL32(fside->data, avctx->internal->skip_samples);
+ AV_WL32(fside->data + 4, discard_padding);
+ AV_WL8(fside->data + 8, skip_reason);
+ AV_WL8(fside->data + 9, discard_reason);
+ avctx->internal->skip_samples = 0;
+ }
+ }
+ }
+#if FF_API_MERGE_SD
+ if (did_split) {
+ av_packet_free_side_data(&tmp);
+ if(ret == tmp.size)
+ ret = pkt->size;
+ }
+#endif
+
+ if (avctx->codec->type == AVMEDIA_TYPE_AUDIO &&
+ !avci->showed_multi_packet_warning &&
+ ret >= 0 && ret != pkt->size && !(avctx->codec->capabilities & AV_CODEC_CAP_SUBFRAMES)) {
+ av_log(avctx, AV_LOG_WARNING, "Multiple frames in a packet.\n");
+ avci->showed_multi_packet_warning = 1;
+ }
+
+ if (!got_frame)
+ av_frame_unref(frame);
+
+ if (ret >= 0 && avctx->codec->type == AVMEDIA_TYPE_VIDEO && !(avctx->flags & AV_CODEC_FLAG_TRUNCATED))
+ ret = pkt->size;
+
+#if FF_API_AVCTX_TIMEBASE
+ if (avctx->framerate.num > 0 && avctx->framerate.den > 0)
+ avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1}));
+#endif
+
+ /* do not stop draining when actual_got_frame != 0 or ret < 0 */
+ /* got_frame == 0 but actual_got_frame != 0 when frame is discarded */
+ if (avctx->internal->draining && !actual_got_frame) {
+ if (ret < 0) {
+ /* prevent infinite loop if a decoder wrongly always return error on draining */
+ /* reasonable nb_errors_max = maximum b frames + thread count */
+ int nb_errors_max = 20 + (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME ?
+ avctx->thread_count : 1);
+
+ if (avci->nb_draining_errors++ >= nb_errors_max) {
+ av_log(avctx, AV_LOG_ERROR, "Too many errors when draining, this is a bug. "
+ "Stop draining and force EOF.\n");
+ avci->draining_done = 1;
+ ret = AVERROR_BUG;
+ }
+ } else {
+ avci->draining_done = 1;
+ }
+ }
+
+ avci->compat_decode_consumed += ret;
+
+ if (ret >= pkt->size || ret < 0) {
+ av_packet_unref(pkt);
+ } else {
+ int consumed = ret;
+
+ pkt->data += consumed;
+ pkt->size -= consumed;
+ avci->last_pkt_props->size -= consumed; // See extract_packet_props() comment.
+ pkt->pts = AV_NOPTS_VALUE;
+ pkt->dts = AV_NOPTS_VALUE;
+ avci->last_pkt_props->pts = AV_NOPTS_VALUE;
+ avci->last_pkt_props->dts = AV_NOPTS_VALUE;
+ }
+
+ if (got_frame)
+ av_assert0(frame->buf[0]);
+
+ return ret < 0 ? ret : 0;
+}
+
+static int decode_simple_receive_frame(AVCodecContext *avctx, AVFrame *frame)
+{
+ int ret;
+
+ while (!frame->buf[0]) {
+ ret = decode_simple_internal(avctx, frame);
+ if (ret < 0)
+ return ret;
+ }
+
+ return 0;
+}
+
+static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame)
+{
+ AVCodecInternal *avci = avctx->internal;
+ int ret;
+
+ av_assert0(!frame->buf[0]);
+
+ if (avctx->codec->receive_frame)
+ ret = avctx->codec->receive_frame(avctx, frame);
+ else
+ ret = decode_simple_receive_frame(avctx, frame);
+
+ if (ret == AVERROR_EOF)
+ avci->draining_done = 1;
+
+ return ret;
+}
+
+int attribute_align_arg avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt)
+{
+ AVCodecInternal *avci = avctx->internal;
+ int ret;
+
+ if (!avcodec_is_open(avctx) || !av_codec_is_decoder(avctx->codec))
+ return AVERROR(EINVAL);
+
+ if (avctx->internal->draining)
+ return AVERROR_EOF;
+
+ if (avpkt && !avpkt->size && avpkt->data)
+ return AVERROR(EINVAL);
+
+ ret = bsfs_init(avctx);
+ if (ret < 0)
+ return ret;
+
+ av_packet_unref(avci->buffer_pkt);
+ if (avpkt && (avpkt->data || avpkt->side_data_elems)) {
+ ret = av_packet_ref(avci->buffer_pkt, avpkt);
+ if (ret < 0)
+ return ret;
+ }
+
+ ret = av_bsf_send_packet(avci->filter.bsfs[0], avci->buffer_pkt);
+ if (ret < 0) {
+ av_packet_unref(avci->buffer_pkt);
+ return ret;
+ }
+
+ if (!avci->buffer_frame->buf[0]) {
+ ret = decode_receive_frame_internal(avctx, avci->buffer_frame);
+ if (ret < 0 && ret != AVERROR(EAGAIN) && ret != AVERROR_EOF)
+ return ret;
+ }
+
+ return 0;
+}
+
+static int apply_cropping(AVCodecContext *avctx, AVFrame *frame)
+{
+ /* make sure we are noisy about decoders returning invalid cropping data */
+ if (frame->crop_left >= INT_MAX - frame->crop_right ||
+ frame->crop_top >= INT_MAX - frame->crop_bottom ||
+ (frame->crop_left + frame->crop_right) >= frame->width ||
+ (frame->crop_top + frame->crop_bottom) >= frame->height) {
+ av_log(avctx, AV_LOG_WARNING,
+ "Invalid cropping information set by a decoder: "
+ "%"SIZE_SPECIFIER"/%"SIZE_SPECIFIER"/%"SIZE_SPECIFIER"/%"SIZE_SPECIFIER" "
+ "(frame size %dx%d). This is a bug, please report it\n",
+ frame->crop_left, frame->crop_right, frame->crop_top, frame->crop_bottom,
+ frame->width, frame->height);
+ frame->crop_left = 0;
+ frame->crop_right = 0;
+ frame->crop_top = 0;
+ frame->crop_bottom = 0;
+ return 0;
+ }
+
+ if (!avctx->apply_cropping)
+ return 0;
+
+ return av_frame_apply_cropping(frame, avctx->flags & AV_CODEC_FLAG_UNALIGNED ?
+ AV_FRAME_CROP_UNALIGNED : 0);
+}
+
+int attribute_align_arg avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
+{
+ AVCodecInternal *avci = avctx->internal;
+ int ret;
+
+ av_frame_unref(frame);
+
+ if (!avcodec_is_open(avctx) || !av_codec_is_decoder(avctx->codec))
+ return AVERROR(EINVAL);
+
+ ret = bsfs_init(avctx);
+ if (ret < 0)
+ return ret;
+
+ if (avci->buffer_frame->buf[0]) {
+ av_frame_move_ref(frame, avci->buffer_frame);
+ } else {
+ ret = decode_receive_frame_internal(avctx, frame);
+ if (ret < 0)
+ return ret;
+ }
+
+ if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
+ ret = apply_cropping(avctx, frame);
+ if (ret < 0) {
+ av_frame_unref(frame);
+ return ret;
+ }
+ }
+
+ avctx->frame_number++;
+
+ return 0;
+}
+
+static int compat_decode(AVCodecContext *avctx, AVFrame *frame,
+ int *got_frame, const AVPacket *pkt)
+{
+ AVCodecInternal *avci = avctx->internal;
+ int ret = 0;
+
+ av_assert0(avci->compat_decode_consumed == 0);
+
+ if (avci->draining_done && pkt && pkt->size != 0) {
+ av_log(avctx, AV_LOG_WARNING, "Got unexpected packet after EOF\n");
+ avcodec_flush_buffers(avctx);
+ }
+
+ *got_frame = 0;
+ avci->compat_decode = 1;
+
+ if (avci->compat_decode_partial_size > 0 &&
+ avci->compat_decode_partial_size != pkt->size) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Got unexpected packet size after a partial decode\n");
+ ret = AVERROR(EINVAL);
+ goto finish;
+ }
+
+ if (!avci->compat_decode_partial_size) {
+ ret = avcodec_send_packet(avctx, pkt);
+ if (ret == AVERROR_EOF)
+ ret = 0;
+ else if (ret == AVERROR(EAGAIN)) {
+ /* we fully drain all the output in each decode call, so this should not
+ * ever happen */
+ ret = AVERROR_BUG;
+ goto finish;
+ } else if (ret < 0)
+ goto finish;
+ }
+
+ while (ret >= 0) {
+ ret = avcodec_receive_frame(avctx, frame);
+ if (ret < 0) {
+ if (ret == AVERROR(EAGAIN) || ret == AVERROR_EOF)
+ ret = 0;
+ goto finish;
+ }
+
+ if (frame != avci->compat_decode_frame) {
+ if (!avctx->refcounted_frames) {
+ ret = unrefcount_frame(avci, frame);
+ if (ret < 0)
+ goto finish;
+ }
+
+ *got_frame = 1;
+ frame = avci->compat_decode_frame;
+ } else {
+ if (!avci->compat_decode_warned) {
+ av_log(avctx, AV_LOG_WARNING, "The deprecated avcodec_decode_* "
+ "API cannot return all the frames for this decoder. "
+ "Some frames will be dropped. Update your code to the "
+ "new decoding API to fix this.\n");
+ avci->compat_decode_warned = 1;
+ }
+ }
+
+ if (avci->draining || (!avctx->codec->bsfs && avci->compat_decode_consumed < pkt->size))
+ break;
+ }
+
+finish:
+ if (ret == 0) {
+ /* if there are any bsfs then assume full packet is always consumed */
+ if (avctx->codec->bsfs)
+ ret = pkt->size;
+ else
+ ret = FFMIN(avci->compat_decode_consumed, pkt->size);
+ }
+ avci->compat_decode_consumed = 0;
+ avci->compat_decode_partial_size = (ret >= 0) ? pkt->size - ret : 0;
+
+ return ret;
+}
+
+int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
+ int *got_picture_ptr,
+ const AVPacket *avpkt)
+{
+ return compat_decode(avctx, picture, got_picture_ptr, avpkt);
+}
+
+int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
+ AVFrame *frame,
+ int *got_frame_ptr,
+ const AVPacket *avpkt)
+{
+ return compat_decode(avctx, frame, got_frame_ptr, avpkt);
+}
+
+static void get_subtitle_defaults(AVSubtitle *sub)
+{
+ memset(sub, 0, sizeof(*sub));
+ sub->pts = AV_NOPTS_VALUE;
+}
+
+#define UTF8_MAX_BYTES 4 /* 5 and 6 bytes sequences should not be used */
+static int recode_subtitle(AVCodecContext *avctx,
+ AVPacket *outpkt, const AVPacket *inpkt)
+{
+#if CONFIG_ICONV
+ iconv_t cd = (iconv_t)-1;
+ int ret = 0;
+ char *inb, *outb;
+ size_t inl, outl;
+ AVPacket tmp;
+#endif
+
+ if (avctx->sub_charenc_mode != FF_SUB_CHARENC_MODE_PRE_DECODER || inpkt->size == 0)
+ return 0;
+
+#if CONFIG_ICONV
+ cd = iconv_open("UTF-8", avctx->sub_charenc);
+ av_assert0(cd != (iconv_t)-1);
+
+ inb = inpkt->data;
+ inl = inpkt->size;
+
+ if (inl >= INT_MAX / UTF8_MAX_BYTES - AV_INPUT_BUFFER_PADDING_SIZE) {
+ av_log(avctx, AV_LOG_ERROR, "Subtitles packet is too big for recoding\n");
+ ret = AVERROR(ENOMEM);
+ goto end;
+ }
+
+ ret = av_new_packet(&tmp, inl * UTF8_MAX_BYTES);
+ if (ret < 0)
+ goto end;
+ outpkt->buf = tmp.buf;
+ outpkt->data = tmp.data;
+ outpkt->size = tmp.size;
+ outb = outpkt->data;
+ outl = outpkt->size;
+
+ if (iconv(cd, &inb, &inl, &outb, &outl) == (size_t)-1 ||
+ iconv(cd, NULL, NULL, &outb, &outl) == (size_t)-1 ||
+ outl >= outpkt->size || inl != 0) {
+ ret = FFMIN(AVERROR(errno), -1);
+ av_log(avctx, AV_LOG_ERROR, "Unable to recode subtitle event \"%s\" "
+ "from %s to UTF-8\n", inpkt->data, avctx->sub_charenc);
+ av_packet_unref(&tmp);
+ goto end;
+ }
+ outpkt->size -= outl;
+ memset(outpkt->data + outpkt->size, 0, outl);
+
+end:
+ if (cd != (iconv_t)-1)
+ iconv_close(cd);
+ return ret;
+#else
+ av_log(avctx, AV_LOG_ERROR, "requesting subtitles recoding without iconv");
+ return AVERROR(EINVAL);
+#endif
+}
+
+static int utf8_check(const uint8_t *str)
+{
+ const uint8_t *byte;
+ uint32_t codepoint, min;
+
+ while (*str) {
+ byte = str;
+ GET_UTF8(codepoint, *(byte++), return 0;);
+ min = byte - str == 1 ? 0 : byte - str == 2 ? 0x80 :
+ 1 << (5 * (byte - str) - 4);
+ if (codepoint < min || codepoint >= 0x110000 ||
+ codepoint == 0xFFFE /* BOM */ ||
+ codepoint >= 0xD800 && codepoint <= 0xDFFF /* surrogates */)
+ return 0;
+ str = byte;
+ }
+ return 1;
+}
+
+#if FF_API_ASS_TIMING
+static void insert_ts(AVBPrint *buf, int ts)
+{
+ if (ts == -1) {
+ av_bprintf(buf, "9:59:59.99,");
+ } else {
+ int h, m, s;
+
+ h = ts/360000; ts -= 360000*h;
+ m = ts/ 6000; ts -= 6000*m;
+ s = ts/ 100; ts -= 100*s;
+ av_bprintf(buf, "%d:%02d:%02d.%02d,", h, m, s, ts);
+ }
+}
+
+static int convert_sub_to_old_ass_form(AVSubtitle *sub, const AVPacket *pkt, AVRational tb)
+{
+ int i;
+ AVBPrint buf;
+
+ av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);
+
+ for (i = 0; i < sub->num_rects; i++) {
+ char *final_dialog;
+ const char *dialog;
+ AVSubtitleRect *rect = sub->rects[i];
+ int ts_start, ts_duration = -1;
+ long int layer;
+
+ if (rect->type != SUBTITLE_ASS || !strncmp(rect->ass, "Dialogue: ", 10))
+ continue;
+
+ av_bprint_clear(&buf);
+
+ /* skip ReadOrder */
+ dialog = strchr(rect->ass, ',');
+ if (!dialog)
+ continue;
+ dialog++;
+
+ /* extract Layer or Marked */
+ layer = strtol(dialog, (char**)&dialog, 10);
+ if (*dialog != ',')
+ continue;
+ dialog++;
+
+ /* rescale timing to ASS time base (ms) */
+ ts_start = av_rescale_q(pkt->pts, tb, av_make_q(1, 100));
+ if (pkt->duration != -1)
+ ts_duration = av_rescale_q(pkt->duration, tb, av_make_q(1, 100));
+ sub->end_display_time = FFMAX(sub->end_display_time, 10 * ts_duration);
+
+ /* construct ASS (standalone file form with timestamps) string */
+ av_bprintf(&buf, "Dialogue: %ld,", layer);
+ insert_ts(&buf, ts_start);
+ insert_ts(&buf, ts_duration == -1 ? -1 : ts_start + ts_duration);
+ av_bprintf(&buf, "%s\r\n", dialog);
+
+ final_dialog = av_strdup(buf.str);
+ if (!av_bprint_is_complete(&buf) || !final_dialog) {
+ av_freep(&final_dialog);
+ av_bprint_finalize(&buf, NULL);
+ return AVERROR(ENOMEM);
+ }
+ av_freep(&rect->ass);
+ rect->ass = final_dialog;
+ }
+
+ av_bprint_finalize(&buf, NULL);
+ return 0;
+}
+#endif
+
+int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
+ int *got_sub_ptr,
+ AVPacket *avpkt)
+{
+ int i, ret = 0;
+ AVCodecInternal *avci = avctx->internal;
+
+ if (!avpkt->data && avpkt->size) {
+ av_log(avctx, AV_LOG_ERROR, "invalid packet: NULL data, size != 0\n");
+ return AVERROR(EINVAL);
+ }
+ if (!avctx->codec)
+ return AVERROR(EINVAL);
+ if (avctx->codec->type != AVMEDIA_TYPE_SUBTITLE) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid media type for subtitles\n");
+ return AVERROR(EINVAL);
+ }
+
+ *got_sub_ptr = 0;
+ get_subtitle_defaults(sub);
+
+ if ((avctx->codec->capabilities & AV_CODEC_CAP_DELAY) || avpkt->size) {
+ AVPacket pkt_recoded;
+ AVPacket tmp = *avpkt;
+#if FF_API_MERGE_SD
+FF_DISABLE_DEPRECATION_WARNINGS
+ int did_split = avci->compat_decode_partial_size ?
+ ff_packet_split_and_drop_side_data(&tmp) :
+ av_packet_split_side_data(&tmp);
+ //apply_param_change(avctx, &tmp);
+
+ if (did_split) {
+ /* FFMIN() prevents overflow in case the packet wasn't allocated with
+ * proper padding.
+ * If the side data is smaller than the buffer padding size, the
+ * remaining bytes should have already been filled with zeros by the
+ * original packet allocation anyway. */
+ memset(tmp.data + tmp.size, 0,
+ FFMIN(avpkt->size - tmp.size, AV_INPUT_BUFFER_PADDING_SIZE));
+ }
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+
+ pkt_recoded = tmp;
+ ret = recode_subtitle(avctx, &pkt_recoded, &tmp);
+ if (ret < 0) {
+ *got_sub_ptr = 0;
+ } else {
+ ret = extract_packet_props(avctx->internal, &pkt_recoded);
+ if (ret < 0)
+ return ret;
+
+ if (avctx->pkt_timebase.num && avpkt->pts != AV_NOPTS_VALUE)
+ sub->pts = av_rescale_q(avpkt->pts,
+ avctx->pkt_timebase, AV_TIME_BASE_Q);
+ ret = avctx->codec->decode(avctx, sub, got_sub_ptr, &pkt_recoded);
+ av_assert1((ret >= 0) >= !!*got_sub_ptr &&
+ !!*got_sub_ptr >= !!sub->num_rects);
+
+#if FF_API_ASS_TIMING
+ if (avctx->sub_text_format == FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS
+ && *got_sub_ptr && sub->num_rects) {
+ const AVRational tb = avctx->pkt_timebase.num ? avctx->pkt_timebase
+ : avctx->time_base;
+ int err = convert_sub_to_old_ass_form(sub, avpkt, tb);
+ if (err < 0)
+ ret = err;
+ }
+#endif
+
+ if (sub->num_rects && !sub->end_display_time && avpkt->duration &&
+ avctx->pkt_timebase.num) {
+ AVRational ms = { 1, 1000 };
+ sub->end_display_time = av_rescale_q(avpkt->duration,
+ avctx->pkt_timebase, ms);
+ }
+
+ if (avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB)
+ sub->format = 0;
+ else if (avctx->codec_descriptor->props & AV_CODEC_PROP_TEXT_SUB)
+ sub->format = 1;
+
+ for (i = 0; i < sub->num_rects; i++) {
+ if (sub->rects[i]->ass && !utf8_check(sub->rects[i]->ass)) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Invalid UTF-8 in decoded subtitles text; "
+ "maybe missing -sub_charenc option\n");
+ avsubtitle_free(sub);
+ ret = AVERROR_INVALIDDATA;
+ break;
+ }
+ }
+
+ if (tmp.data != pkt_recoded.data) { // did we recode?
+ /* prevent from destroying side data from original packet */
+ pkt_recoded.side_data = NULL;
+ pkt_recoded.side_data_elems = 0;
+
+ av_packet_unref(&pkt_recoded);
+ }
+ }
+
+#if FF_API_MERGE_SD
+ if (did_split) {
+ av_packet_free_side_data(&tmp);
+ if(ret == tmp.size)
+ ret = avpkt->size;
+ }
+#endif
+
+ if (*got_sub_ptr)
+ avctx->frame_number++;
+ }
+
+ return ret;
+}
+
+static int is_hwaccel_pix_fmt(enum AVPixelFormat pix_fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ return desc->flags & AV_PIX_FMT_FLAG_HWACCEL;
+}
+
+enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat *fmt)
+{
+ while (*fmt != AV_PIX_FMT_NONE && is_hwaccel_pix_fmt(*fmt))
+ ++fmt;
+ return fmt[0];
+}
+
+static AVHWAccel *find_hwaccel(enum AVCodecID codec_id,
+ enum AVPixelFormat pix_fmt)
+{
+ AVHWAccel *hwaccel = NULL;
+
+ while ((hwaccel = av_hwaccel_next(hwaccel)))
+ if (hwaccel->id == codec_id
+ && hwaccel->pix_fmt == pix_fmt)
+ return hwaccel;
+ return NULL;
+}
+
+static int setup_hwaccel(AVCodecContext *avctx,
+ const enum AVPixelFormat fmt,
+ const char *name)
+{
+ AVHWAccel *hwa = find_hwaccel(avctx->codec_id, fmt);
+ int ret = 0;
+
+ if (!hwa) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Could not find an AVHWAccel for the pixel format: %s",
+ name);
+ return AVERROR(ENOENT);
+ }
+
+ if (hwa->capabilities & AV_HWACCEL_CODEC_CAP_EXPERIMENTAL &&
+ avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
+ av_log(avctx, AV_LOG_WARNING, "Ignoring experimental hwaccel: %s\n",
+ hwa->name);
+ return AVERROR_PATCHWELCOME;
+ }
+
+ if (hwa->priv_data_size) {
+ avctx->internal->hwaccel_priv_data = av_mallocz(hwa->priv_data_size);
+ if (!avctx->internal->hwaccel_priv_data)
+ return AVERROR(ENOMEM);
+ }
+
+ avctx->hwaccel = hwa;
+ if (hwa->init) {
+ ret = hwa->init(avctx);
+ if (ret < 0) {
+ av_freep(&avctx->internal->hwaccel_priv_data);
+ avctx->hwaccel = NULL;
+ return ret;
+ }
+ }
+
+ return 0;
+}
+
+int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
+{
+ const AVPixFmtDescriptor *desc;
+ enum AVPixelFormat *choices;
+ enum AVPixelFormat ret;
+ unsigned n = 0;
+
+ while (fmt[n] != AV_PIX_FMT_NONE)
+ ++n;
+
+ av_assert0(n >= 1);
+ avctx->sw_pix_fmt = fmt[n - 1];
+ av_assert2(!is_hwaccel_pix_fmt(avctx->sw_pix_fmt));
+
+ choices = av_malloc_array(n + 1, sizeof(*choices));
+ if (!choices)
+ return AV_PIX_FMT_NONE;
+
+ memcpy(choices, fmt, (n + 1) * sizeof(*choices));
+
+ for (;;) {
+ if (avctx->hwaccel && avctx->hwaccel->uninit)
+ avctx->hwaccel->uninit(avctx);
+ av_freep(&avctx->internal->hwaccel_priv_data);
+ avctx->hwaccel = NULL;
+
+ av_buffer_unref(&avctx->hw_frames_ctx);
+
+ ret = avctx->get_format(avctx, choices);
+
+ desc = av_pix_fmt_desc_get(ret);
+ if (!desc) {
+ ret = AV_PIX_FMT_NONE;
+ break;
+ }
+
+ if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL))
+ break;
+#if FF_API_CAP_VDPAU
+ if (avctx->codec->capabilities&AV_CODEC_CAP_HWACCEL_VDPAU)
+ break;
+#endif
+
+ if (avctx->hw_frames_ctx) {
+ AVHWFramesContext *hw_frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;
+ if (hw_frames_ctx->format != ret) {
+ av_log(avctx, AV_LOG_ERROR, "Format returned from get_buffer() "
+ "does not match the format of provided AVHWFramesContext\n");
+ ret = AV_PIX_FMT_NONE;
+ break;
+ }
+ }
+
+ if (!setup_hwaccel(avctx, ret, desc->name))
+ break;
+
+ /* Remove failed hwaccel from choices */
+ for (n = 0; choices[n] != ret; n++)
+ av_assert0(choices[n] != AV_PIX_FMT_NONE);
+
+ do
+ choices[n] = choices[n + 1];
+ while (choices[n++] != AV_PIX_FMT_NONE);
+ }
+
+ av_freep(&choices);
+ return ret;
+}
+
+static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame)
+{
+ FramePool *pool = avctx->internal->pool;
+ int i, ret;
+
+ switch (avctx->codec_type) {
+ case AVMEDIA_TYPE_VIDEO: {
+ uint8_t *data[4];
+ int linesize[4];
+ int size[4] = { 0 };
+ int w = frame->width;
+ int h = frame->height;
+ int tmpsize, unaligned;
+
+ if (pool->format == frame->format &&
+ pool->width == frame->width && pool->height == frame->height)
+ return 0;
+
+ avcodec_align_dimensions2(avctx, &w, &h, pool->stride_align);
+
+ do {
+ // NOTE: do not align linesizes individually, this breaks e.g. assumptions
+ // that linesize[0] == 2*linesize[1] in the MPEG-encoder for 4:2:2
+ ret = av_image_fill_linesizes(linesize, avctx->pix_fmt, w);
+ if (ret < 0)
+ return ret;
+ // increase alignment of w for next try (rhs gives the lowest bit set in w)
+ w += w & ~(w - 1);
+
+ unaligned = 0;
+ for (i = 0; i < 4; i++)
+ unaligned |= linesize[i] % pool->stride_align[i];
+ } while (unaligned);
+
+ tmpsize = av_image_fill_pointers(data, avctx->pix_fmt, h,
+ NULL, linesize);
+ if (tmpsize < 0)
+ return -1;
+
+ for (i = 0; i < 3 && data[i + 1]; i++)
+ size[i] = data[i + 1] - data[i];
+ size[i] = tmpsize - (data[i] - data[0]);
+
+ for (i = 0; i < 4; i++) {
+ av_buffer_pool_uninit(&pool->pools[i]);
+ pool->linesize[i] = linesize[i];
+ if (size[i]) {
+ pool->pools[i] = av_buffer_pool_init(size[i] + 16 + STRIDE_ALIGN - 1,
+ CONFIG_MEMORY_POISONING ?
+ NULL :
+ av_buffer_allocz);
+ if (!pool->pools[i]) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ }
+ }
+ pool->format = frame->format;
+ pool->width = frame->width;
+ pool->height = frame->height;
+
+ break;
+ }
+ case AVMEDIA_TYPE_AUDIO: {
+ int ch = frame->channels; //av_get_channel_layout_nb_channels(frame->channel_layout);
+ int planar = av_sample_fmt_is_planar(frame->format);
+ int planes = planar ? ch : 1;
+
+ if (pool->format == frame->format && pool->planes == planes &&
+ pool->channels == ch && frame->nb_samples == pool->samples)
+ return 0;
+
+ av_buffer_pool_uninit(&pool->pools[0]);
+ ret = av_samples_get_buffer_size(&pool->linesize[0], ch,
+ frame->nb_samples, frame->format, 0);
+ if (ret < 0)
+ goto fail;
+
+ pool->pools[0] = av_buffer_pool_init(pool->linesize[0], NULL);
+ if (!pool->pools[0]) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+
+ pool->format = frame->format;
+ pool->planes = planes;
+ pool->channels = ch;
+ pool->samples = frame->nb_samples;
+ break;
+ }
+ default: av_assert0(0);
+ }
+ return 0;
+fail:
+ for (i = 0; i < 4; i++)
+ av_buffer_pool_uninit(&pool->pools[i]);
+ pool->format = -1;
+ pool->planes = pool->channels = pool->samples = 0;
+ pool->width = pool->height = 0;
+ return ret;
+}
+
+static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame)
+{
+ FramePool *pool = avctx->internal->pool;
+ int planes = pool->planes;
+ int i;
+
+ frame->linesize[0] = pool->linesize[0];
+
+ if (planes > AV_NUM_DATA_POINTERS) {
+ frame->extended_data = av_mallocz_array(planes, sizeof(*frame->extended_data));
+ frame->nb_extended_buf = planes - AV_NUM_DATA_POINTERS;
+ frame->extended_buf = av_mallocz_array(frame->nb_extended_buf,
+ sizeof(*frame->extended_buf));
+ if (!frame->extended_data || !frame->extended_buf) {
+ av_freep(&frame->extended_data);
+ av_freep(&frame->extended_buf);
+ return AVERROR(ENOMEM);
+ }
+ } else {
+ frame->extended_data = frame->data;
+ av_assert0(frame->nb_extended_buf == 0);
+ }
+
+ for (i = 0; i < FFMIN(planes, AV_NUM_DATA_POINTERS); i++) {
+ frame->buf[i] = av_buffer_pool_get(pool->pools[0]);
+ if (!frame->buf[i])
+ goto fail;
+ frame->extended_data[i] = frame->data[i] = frame->buf[i]->data;
+ }
+ for (i = 0; i < frame->nb_extended_buf; i++) {
+ frame->extended_buf[i] = av_buffer_pool_get(pool->pools[0]);
+ if (!frame->extended_buf[i])
+ goto fail;
+ frame->extended_data[i + AV_NUM_DATA_POINTERS] = frame->extended_buf[i]->data;
+ }
+
+ if (avctx->debug & FF_DEBUG_BUFFERS)
+ av_log(avctx, AV_LOG_DEBUG, "default_get_buffer called on frame %p", frame);
+
+ return 0;
+fail:
+ av_frame_unref(frame);
+ return AVERROR(ENOMEM);
+}
+
+static int video_get_buffer(AVCodecContext *s, AVFrame *pic)
+{
+ FramePool *pool = s->internal->pool;
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pic->format);
+ int i;
+
+ if (pic->data[0] || pic->data[1] || pic->data[2] || pic->data[3]) {
+ av_log(s, AV_LOG_ERROR, "pic->data[*]!=NULL in avcodec_default_get_buffer\n");
+ return -1;
+ }
+
+ if (!desc) {
+ av_log(s, AV_LOG_ERROR,
+ "Unable to get pixel format descriptor for format %s\n",
+ av_get_pix_fmt_name(pic->format));
+ return AVERROR(EINVAL);
+ }
+
+ memset(pic->data, 0, sizeof(pic->data));
+ pic->extended_data = pic->data;
+
+ for (i = 0; i < 4 && pool->pools[i]; i++) {
+ pic->linesize[i] = pool->linesize[i];
+
+ pic->buf[i] = av_buffer_pool_get(pool->pools[i]);
+ if (!pic->buf[i])
+ goto fail;
+
+ pic->data[i] = pic->buf[i]->data;
+ }
+ for (; i < AV_NUM_DATA_POINTERS; i++) {
+ pic->data[i] = NULL;
+ pic->linesize[i] = 0;
+ }
+ if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
+ desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)
+ avpriv_set_systematic_pal2((uint32_t *)pic->data[1], pic->format);
+
+ if (s->debug & FF_DEBUG_BUFFERS)
+ av_log(s, AV_LOG_DEBUG, "default_get_buffer called on pic %p\n", pic);
+
+ return 0;
+fail:
+ av_frame_unref(pic);
+ return AVERROR(ENOMEM);
+}
+
+int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags)
+{
+ int ret;
+
+ if (avctx->hw_frames_ctx) {
+ ret = av_hwframe_get_buffer(avctx->hw_frames_ctx, frame, 0);
+ frame->width = avctx->coded_width;
+ frame->height = avctx->coded_height;
+ return ret;
+ }
+
+ if ((ret = update_frame_pool(avctx, frame)) < 0)
+ return ret;
+
+ switch (avctx->codec_type) {
+ case AVMEDIA_TYPE_VIDEO:
+ return video_get_buffer(avctx, frame);
+ case AVMEDIA_TYPE_AUDIO:
+ return audio_get_buffer(avctx, frame);
+ default:
+ return -1;
+ }
+}
+
+static int add_metadata_from_side_data(const AVPacket *avpkt, AVFrame *frame)
+{
+ int size;
+ const uint8_t *side_metadata;
+
+ AVDictionary **frame_md = &frame->metadata;
+
+ side_metadata = av_packet_get_side_data(avpkt,
+ AV_PKT_DATA_STRINGS_METADATA, &size);
+ return av_packet_unpack_dictionary(side_metadata, size, frame_md);
+}
+
+int ff_init_buffer_info(AVCodecContext *avctx, AVFrame *frame)
+{
+ const AVPacket *pkt = avctx->internal->last_pkt_props;
+ int i;
+ static const struct {
+ enum AVPacketSideDataType packet;
+ enum AVFrameSideDataType frame;
+ } sd[] = {
+ { AV_PKT_DATA_REPLAYGAIN , AV_FRAME_DATA_REPLAYGAIN },
+ { AV_PKT_DATA_DISPLAYMATRIX, AV_FRAME_DATA_DISPLAYMATRIX },
+ { AV_PKT_DATA_SPHERICAL, AV_FRAME_DATA_SPHERICAL },
+ { AV_PKT_DATA_STEREO3D, AV_FRAME_DATA_STEREO3D },
+ { AV_PKT_DATA_AUDIO_SERVICE_TYPE, AV_FRAME_DATA_AUDIO_SERVICE_TYPE },
+ { AV_PKT_DATA_MASTERING_DISPLAY_METADATA, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA },
+ { AV_PKT_DATA_CONTENT_LIGHT_LEVEL, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL },
+ { AV_PKT_DATA_A53_CC, AV_FRAME_DATA_A53_CC },
+ };
+
+ if (pkt) {
+ frame->pts = pkt->pts;
+#if FF_API_PKT_PTS
+FF_DISABLE_DEPRECATION_WARNINGS
+ frame->pkt_pts = pkt->pts;
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+ frame->pkt_pos = pkt->pos;
+ frame->pkt_duration = pkt->duration;
+ frame->pkt_size = pkt->size;
+
+ for (i = 0; i < FF_ARRAY_ELEMS(sd); i++) {
+ int size;
+ uint8_t *packet_sd = av_packet_get_side_data(pkt, sd[i].packet, &size);
+ if (packet_sd) {
+ AVFrameSideData *frame_sd = av_frame_new_side_data(frame,
+ sd[i].frame,
+ size);
+ if (!frame_sd)
+ return AVERROR(ENOMEM);
+
+ memcpy(frame_sd->data, packet_sd, size);
+ }
+ }
+ add_metadata_from_side_data(pkt, frame);
+
+ if (pkt->flags & AV_PKT_FLAG_DISCARD) {
+ frame->flags |= AV_FRAME_FLAG_DISCARD;
+ } else {
+ frame->flags = (frame->flags & ~AV_FRAME_FLAG_DISCARD);
+ }
+ }
+ frame->reordered_opaque = avctx->reordered_opaque;
+
+ if (frame->color_primaries == AVCOL_PRI_UNSPECIFIED)
+ frame->color_primaries = avctx->color_primaries;
+ if (frame->color_trc == AVCOL_TRC_UNSPECIFIED)
+ frame->color_trc = avctx->color_trc;
+ if (frame->colorspace == AVCOL_SPC_UNSPECIFIED)
+ frame->colorspace = avctx->colorspace;
+ if (frame->color_range == AVCOL_RANGE_UNSPECIFIED)
+ frame->color_range = avctx->color_range;
+ if (frame->chroma_location == AVCHROMA_LOC_UNSPECIFIED)
+ frame->chroma_location = avctx->chroma_sample_location;
+
+ switch (avctx->codec->type) {
+ case AVMEDIA_TYPE_VIDEO:
+ frame->format = avctx->pix_fmt;
+ if (!frame->sample_aspect_ratio.num)
+ frame->sample_aspect_ratio = avctx->sample_aspect_ratio;
+
+ if (frame->width && frame->height &&
+ av_image_check_sar(frame->width, frame->height,
+ frame->sample_aspect_ratio) < 0) {
+ av_log(avctx, AV_LOG_WARNING, "ignoring invalid SAR: %u/%u\n",
+ frame->sample_aspect_ratio.num,
+ frame->sample_aspect_ratio.den);
+ frame->sample_aspect_ratio = (AVRational){ 0, 1 };
+ }
+
+ break;
+ case AVMEDIA_TYPE_AUDIO:
+ if (!frame->sample_rate)
+ frame->sample_rate = avctx->sample_rate;
+ if (frame->format < 0)
+ frame->format = avctx->sample_fmt;
+ if (!frame->channel_layout) {
+ if (avctx->channel_layout) {
+ if (av_get_channel_layout_nb_channels(avctx->channel_layout) !=
+ avctx->channels) {
+ av_log(avctx, AV_LOG_ERROR, "Inconsistent channel "
+ "configuration.\n");
+ return AVERROR(EINVAL);
+ }
+
+ frame->channel_layout = avctx->channel_layout;
+ } else {
+ if (avctx->channels > FF_SANE_NB_CHANNELS) {
+ av_log(avctx, AV_LOG_ERROR, "Too many channels: %d.\n",
+ avctx->channels);
+ return AVERROR(ENOSYS);
+ }
+ }
+ }
+ frame->channels = avctx->channels;
+ break;
+ }
+ return 0;
+}
+
+int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
+{
+ return ff_init_buffer_info(avctx, frame);
+}
+
+static void validate_avframe_allocation(AVCodecContext *avctx, AVFrame *frame)
+{
+ if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
+ int i;
+ int num_planes = av_pix_fmt_count_planes(frame->format);
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
+ int flags = desc ? desc->flags : 0;
+ if (num_planes == 1 && (flags & AV_PIX_FMT_FLAG_PAL))
+ num_planes = 2;
+ for (i = 0; i < num_planes; i++) {
+ av_assert0(frame->data[i]);
+ }
+ // For now do not enforce anything for palette of pseudopal formats
+ if (num_planes == 1 && (flags & AV_PIX_FMT_FLAG_PSEUDOPAL))
+ num_planes = 2;
+ // For formats without data like hwaccel allow unused pointers to be non-NULL.
+ for (i = num_planes; num_planes > 0 && i < FF_ARRAY_ELEMS(frame->data); i++) {
+ if (frame->data[i])
+ av_log(avctx, AV_LOG_ERROR, "Buffer returned by get_buffer2() did not zero unused plane pointers\n");
+ frame->data[i] = NULL;
+ }
+ }
+}
+
+static int get_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags)
+{
+ const AVHWAccel *hwaccel = avctx->hwaccel;
+ int override_dimensions = 1;
+ int ret;
+
+ if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
+ if ((ret = av_image_check_size2(avctx->width, avctx->height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx)) < 0 || avctx->pix_fmt<0) {
+ av_log(avctx, AV_LOG_ERROR, "video_get_buffer: image parameters invalid\n");
+ return AVERROR(EINVAL);
+ }
+
+ if (frame->width <= 0 || frame->height <= 0) {
+ frame->width = FFMAX(avctx->width, AV_CEIL_RSHIFT(avctx->coded_width, avctx->lowres));
+ frame->height = FFMAX(avctx->height, AV_CEIL_RSHIFT(avctx->coded_height, avctx->lowres));
+ override_dimensions = 0;
+ }
+
+ if (frame->data[0] || frame->data[1] || frame->data[2] || frame->data[3]) {
+ av_log(avctx, AV_LOG_ERROR, "pic->data[*]!=NULL in get_buffer_internal\n");
+ return AVERROR(EINVAL);
+ }
+ }
+ ret = ff_decode_frame_props(avctx, frame);
+ if (ret < 0)
+ return ret;
+
+ if (hwaccel) {
+ if (hwaccel->alloc_frame) {
+ ret = hwaccel->alloc_frame(avctx, frame);
+ goto end;
+ }
+ } else
+ avctx->sw_pix_fmt = avctx->pix_fmt;
+
+ ret = avctx->get_buffer2(avctx, frame, flags);
+ if (ret >= 0)
+ validate_avframe_allocation(avctx, frame);
+
+end:
+ if (avctx->codec_type == AVMEDIA_TYPE_VIDEO && !override_dimensions &&
+ !(avctx->codec->caps_internal & FF_CODEC_CAP_EXPORTS_CROPPING)) {
+ frame->width = avctx->width;
+ frame->height = avctx->height;
+ }
+
+ return ret;
+}
+
+int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
+{
+ int ret = get_buffer_internal(avctx, frame, flags);
+ if (ret < 0) {
+ av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
+ frame->width = frame->height = 0;
+ }
+ return ret;
+}
+
+static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame)
+{
+ AVFrame *tmp;
+ int ret;
+
+ av_assert0(avctx->codec_type == AVMEDIA_TYPE_VIDEO);
+
+ if (frame->data[0] && (frame->width != avctx->width || frame->height != avctx->height || frame->format != avctx->pix_fmt)) {
+ av_log(avctx, AV_LOG_WARNING, "Picture changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s in reget buffer()\n",
+ frame->width, frame->height, av_get_pix_fmt_name(frame->format), avctx->width, avctx->height, av_get_pix_fmt_name(avctx->pix_fmt));
+ av_frame_unref(frame);
+ }
+
+ ff_init_buffer_info(avctx, frame);
+
+ if (!frame->data[0])
+ return ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF);
+
+ if (av_frame_is_writable(frame))
+ return ff_decode_frame_props(avctx, frame);
+
+ tmp = av_frame_alloc();
+ if (!tmp)
+ return AVERROR(ENOMEM);
+
+ av_frame_move_ref(tmp, frame);
+
+ ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF);
+ if (ret < 0) {
+ av_frame_free(&tmp);
+ return ret;
+ }
+
+ av_frame_copy(frame, tmp);
+ av_frame_free(&tmp);
+
+ return 0;
+}
+
+int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame)
+{
+ int ret = reget_buffer_internal(avctx, frame);
+ if (ret < 0)
+ av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
+ return ret;
+}
+
+void avcodec_flush_buffers(AVCodecContext *avctx)
+{
+ avctx->internal->draining = 0;
+ avctx->internal->draining_done = 0;
+ avctx->internal->nb_draining_errors = 0;
+ av_frame_unref(avctx->internal->buffer_frame);
+ av_frame_unref(avctx->internal->compat_decode_frame);
+ av_packet_unref(avctx->internal->buffer_pkt);
+ avctx->internal->buffer_pkt_valid = 0;
+
+ av_packet_unref(avctx->internal->ds.in_pkt);
+
+ if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)
+ ff_thread_flush(avctx);
+ else if (avctx->codec->flush)
+ avctx->codec->flush(avctx);
+
+ avctx->pts_correction_last_pts =
+ avctx->pts_correction_last_dts = INT64_MIN;
+
+ ff_decode_bsfs_uninit(avctx);
+
+ if (!avctx->refcounted_frames)
+ av_frame_unref(avctx->internal->to_free);
+}
+
+void ff_decode_bsfs_uninit(AVCodecContext *avctx)
+{
+ DecodeFilterContext *s = &avctx->internal->filter;
+ int i;
+
+ for (i = 0; i < s->nb_bsfs; i++)
+ av_bsf_free(&s->bsfs[i]);
+ av_freep(&s->bsfs);
+ s->nb_bsfs = 0;
+}
diff --git a/media/ffvpx/libavcodec/decode.h b/media/ffvpx/libavcodec/decode.h
new file mode 100644
index 0000000000..c9630228dc
--- /dev/null
+++ b/media/ffvpx/libavcodec/decode.h
@@ -0,0 +1,39 @@
+/*
+ * generic decoding-related code
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_DECODE_H
+#define AVCODEC_DECODE_H
+
+#include "avcodec.h"
+
+/**
+ * Called by decoders to get the next packet for decoding.
+ *
+ * @param pkt An empty packet to be filled with data.
+ * @return 0 if a new reference has been successfully written to pkt
+ * AVERROR(EAGAIN) if no data is currently available
+ * AVERROR_EOF if and end of stream has been reached, so no more data
+ * will be available
+ */
+int ff_decode_get_packet(AVCodecContext *avctx, AVPacket *pkt);
+
+void ff_decode_bsfs_uninit(AVCodecContext *avctx);
+
+#endif /* AVCODEC_DECODE_H */
diff --git a/media/ffvpx/libavcodec/dummy_funcs.c b/media/ffvpx/libavcodec/dummy_funcs.c
index 200e1d266d..21b469f7e1 100644
--- a/media/ffvpx/libavcodec/dummy_funcs.c
+++ b/media/ffvpx/libavcodec/dummy_funcs.c
@@ -73,6 +73,16 @@ AVHWAccel ff_hevc_mediacodec_hwaccel;
AVHWAccel ff_mpeg4_mediacodec_hwaccel;
AVHWAccel ff_vp8_mediacodec_hwaccel;
AVHWAccel ff_vp9_mediacodec_hwaccel;
+/* Added by FFmpeg 3.4 */
+AVHWAccel ff_h264_d3d11va2_hwaccel;
+AVHWAccel ff_hevc_d3d11va2_hwaccel;
+AVHWAccel ff_hevc_videotoolbox_hwaccel;
+AVHWAccel ff_mpeg2_d3d11va2_hwaccel;
+AVHWAccel ff_mpeg2_mediacodec_hwaccel;
+AVHWAccel ff_vc1_d3d11va2_hwaccel;
+AVHWAccel ff_vp8_qsv_hwaccel;
+AVHWAccel ff_vp9_d3d11va2_hwaccel;
+AVHWAccel ff_wmv3_d3d11va2_hwaccel;
AVCodec ff_a64multi_encoder;
AVCodec ff_a64multi5_encoder;
@@ -741,6 +751,54 @@ AVCodec ff_pcm_s64be_decoder;
AVCodec ff_pcm_s64be_encoder;
AVCodec ff_truehd_encoder;
AVCodec ff_mlp_encoder;
+/* Added by FFmpeg 3.4 */
+AVCodec ff_clearvideo_decoder;
+AVCodec ff_fits_encoder;
+AVCodec ff_fits_decoder;
+AVCodec ff_fmvc_decoder;
+AVCodec ff_gdv_decoder;
+AVCodec ff_h263_v4l2m2m_decoder;
+AVCodec ff_h264_v4l2m2m_decoder;
+AVCodec ff_h264_rkmpp_decoder;
+AVCodec ff_hevc_rkmpp_decoder;
+AVCodec ff_hevc_v4l2m2m_decoder;
+AVCodec ff_mpeg4_v4l2m2m_decoder;
+AVCodec ff_mpeg1_v4l2m2m_decoder;
+AVCodec ff_mpeg2_v4l2m2m_decoder;
+AVCodec ff_mpeg2_mediacodec_decoder;
+AVCodec ff_mscc_decoder;
+AVCodec ff_pixlet_decoder;
+AVCodec ff_psd_decoder;
+AVCodec ff_scpr_decoder;
+AVCodec ff_speedhq_decoder;
+AVCodec ff_srgc_decoder;
+AVCodec ff_vc1_v4l2m2m_decoder;
+AVCodec ff_vp8_rkmpp_decoder;
+AVCodec ff_vp8_v4l2m2m_decoder;
+AVCodec ff_vp9_rkmpp_decoder;
+AVCodec ff_vp9_v4l2m2m_decoder;
+AVCodec ff_bitpacked_decoder;
+AVCodec ff_wrapped_avframe_decoder;
+AVCodec ff_xpm_decoder;
+AVCodec ff_atrac3al_decoder;
+AVCodec ff_atrac3pal_decoder;
+AVCodec ff_dolby_e_decoder;
+AVCodec ff_opus_encoder;
+AVCodec ff_qdmc_decoder;
+AVCodec ff_pcm_f16le_decoder;
+AVCodec ff_pcm_f24le_decoder;
+AVCodec ff_gremlin_dpcm_decoder;
+AVCodec ff_adpcm_g726le_encoder;
+AVCodec ff_librsvg_decoder;
+AVCodec ff_h263_v4l2m2m_encoder;
+AVCodec ff_h264_v4l2m2m_encoder;
+AVCodec ff_hevc_v4l2m2m_encoder;
+AVCodec ff_mpeg2_vaapi_encoder;
+AVCodec ff_mpeg4_v4l2m2m_encoder;
+AVCodec ff_vp8_qsv_decoder;
+AVCodec ff_vp8_v4l2m2m_encoder;
+AVCodec ff_vp8_vaapi_encoder;
+AVCodec ff_vp9_vaapi_encoder;
AVCodecParser ff_aac_parser;
AVCodecParser ff_aac_latm_parser;
@@ -777,6 +835,10 @@ AVCodecParser ff_tak_parser;
AVCodecParser ff_vc1_parser;
AVCodecParser ff_vorbis_parser;
AVCodecParser ff_vp3_parser;
+/* Added by FFmpeg 3.4 */
+AVCodecParser ff_sipr_parser;
+AVCodecParser ff_xma_parser;
+
AVBitStreamFilter ff_aac_adtstoasc_bsf;
AVBitStreamFilter ff_chomp_bsf;
AVBitStreamFilter ff_dump_extradata_bsf;
@@ -806,12 +868,15 @@ int ff_thread_video_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVF
void ff_videodsp_init_aarch64(VideoDSPContext *ctx, int bpc) {}
void ff_videodsp_init_arm(VideoDSPContext *ctx, int bpc) {}
void ff_videodsp_init_ppc(VideoDSPContext *ctx, int bpc) {}
+void ff_videodsp_init_mips(VideoDSPContext *ctx, int bpc) {}
void ff_vp7dsp_init(VP8DSPContext *c) {}
void ff_vp78dsp_init_arm(VP8DSPContext *c) {}
void ff_vp78dsp_init_ppc(VP8DSPContext *c) {}
void ff_vp8dsp_init_arm(VP8DSPContext *c) {}
void ff_vp8dsp_init_mips(VP8DSPContext *c) {}
void ff_vp9dsp_init_mips(VP9DSPContext *dsp, int bpp) {}
+void ff_vp9dsp_init_aarch64(VP9DSPContext *dsp, int bpp) {}
+void ff_vp9dsp_init_arm(VP9DSPContext *dsp, int bpp) {}
void ff_flacdsp_init_arm(FLACDSPContext *c, enum AVSampleFormat fmt, int channels, int bps) {}
#if !defined(HAVE_64BIT_BUILD)
void ff_flac_decorrelate_indep8_16_sse2(uint8_t **out, int32_t **in, int channels, int len, int shift) {}
@@ -819,11 +884,3 @@ void ff_flac_decorrelate_indep8_32_avx(uint8_t **out, int32_t **in, int channels
void ff_flac_decorrelate_indep8_16_avx(uint8_t **out, int32_t **in, int channels, int len, int shift) {}
void ff_flac_decorrelate_indep8_32_sse2(uint8_t **out, int32_t **in, int channels, int len, int shift) {}
#endif
-void av_bitstream_filter_close(AVBitStreamFilterContext *bsf) {}
-int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc,
- AVCodecContext *avctx, const char *args,
- uint8_t **poutbuf, int *poutbuf_size,
- const uint8_t *buf, int buf_size, int keyframe) { return 0; }
-AVBitStreamFilterContext *av_bitstream_filter_init(const char *name) { return NULL;}
-AVBitStreamFilter *av_bitstream_filter_next(const AVBitStreamFilter *f) { return NULL; }
-void av_register_bitstream_filter(AVBitStreamFilter *bsf) {}
diff --git a/media/ffvpx/libavcodec/error_resilience.h b/media/ffvpx/libavcodec/error_resilience.h
index d444ec3a3c..27c2008694 100644
--- a/media/ffvpx/libavcodec/error_resilience.h
+++ b/media/ffvpx/libavcodec/error_resilience.h
@@ -57,8 +57,8 @@ typedef struct ERContext {
int *mb_index2xy;
int mb_num;
int mb_width, mb_height;
- int mb_stride;
- int b8_stride;
+ ptrdiff_t mb_stride;
+ ptrdiff_t b8_stride;
volatile int error_count;
int error_occurred;
diff --git a/media/ffvpx/libavcodec/ff_options_table.h b/media/ffvpx/libavcodec/ff_options_table.h
deleted file mode 100644
index ee01275d35..0000000000
--- a/media/ffvpx/libavcodec/ff_options_table.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Copyright (c) 2001 Fabrice Bellard
- * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVCODEC_OPTIONS_TABLE_H
-#define AVCODEC_OPTIONS_TABLE_H
-
-#include "libavutil/opt.h"
-static const AVOption avcodec_options[] = {
-{NULL},
-};
-
-#endif /* AVCODEC_OPTIONS_TABLE_H */
diff --git a/media/ffvpx/libavcodec/flac.c b/media/ffvpx/libavcodec/flac.c
index f5154b9149..5ffbf93190 100644
--- a/media/ffvpx/libavcodec/flac.c
+++ b/media/ffvpx/libavcodec/flac.c
@@ -201,7 +201,7 @@ void ff_flac_set_channel_layout(AVCodecContext *avctx)
avctx->channel_layout = 0;
}
-void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
+int ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
const uint8_t *buffer)
{
GetBitContext gb;
@@ -213,6 +213,7 @@ void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
av_log(avctx, AV_LOG_WARNING, "invalid max blocksize: %d\n",
s->max_blocksize);
s->max_blocksize = 16;
+ return AVERROR_INVALIDDATA;
}
skip_bits(&gb, 24); /* skip min frame size */
@@ -222,6 +223,12 @@ void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
s->channels = get_bits(&gb, 3) + 1;
s->bps = get_bits(&gb, 5) + 1;
+ if (s->bps < 4) {
+ av_log(avctx, AV_LOG_ERROR, "invalid bps: %d\n", s->bps);
+ s->bps = 16;
+ return AVERROR_INVALIDDATA;
+ }
+
avctx->channels = s->channels;
avctx->sample_rate = s->samplerate;
avctx->bits_per_raw_sample = s->bps;
@@ -234,4 +241,6 @@ void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
skip_bits_long(&gb, 64); /* md5 sum */
skip_bits_long(&gb, 64); /* md5 sum */
+
+ return 0;
}
diff --git a/media/ffvpx/libavcodec/flac.h b/media/ffvpx/libavcodec/flac.h
index 96d971c9d7..991ab43f3c 100644
--- a/media/ffvpx/libavcodec/flac.h
+++ b/media/ffvpx/libavcodec/flac.h
@@ -95,8 +95,10 @@ typedef struct FLACFrameInfo {
* @param[out] avctx codec context to set basic stream parameters
* @param[out] s where parsed information is stored
* @param[in] buffer pointer to start of 34-byte streaminfo data
+ *
+ * @return negative error code on faiure or >= 0 on success
*/
-void ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
+int ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s,
const uint8_t *buffer);
/**
diff --git a/media/ffvpx/libavcodec/flac_parser.c b/media/ffvpx/libavcodec/flac_parser.c
index f5cc35a4f2..84da23f327 100644
--- a/media/ffvpx/libavcodec/flac_parser.c
+++ b/media/ffvpx/libavcodec/flac_parser.c
@@ -586,10 +586,12 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
temp = curr->next;
av_freep(&curr->link_penalty);
av_free(curr);
+ fpc->nb_headers_buffered--;
}
fpc->headers = fpc->best_header->next;
av_freep(&fpc->best_header->link_penalty);
av_freep(&fpc->best_header);
+ fpc->nb_headers_buffered--;
}
/* Find and score new headers. */
@@ -638,7 +640,7 @@ static int flac_parse(AVCodecParserContext *s, AVCodecContext *avctx,
read_end - read_start, NULL);
} else {
int8_t pad[MAX_FRAME_HEADER_SIZE] = { 0 };
- av_fifo_generic_write(fpc->fifo_buf, (void*) pad, sizeof(pad), NULL);
+ av_fifo_generic_write(fpc->fifo_buf, pad, sizeof(pad), NULL);
}
/* Tag headers and update sequences. */
diff --git a/media/ffvpx/libavcodec/flacdec.c b/media/ffvpx/libavcodec/flacdec.c
index b7237e18f0..3d41a1af7f 100644
--- a/media/ffvpx/libavcodec/flacdec.c
+++ b/media/ffvpx/libavcodec/flacdec.c
@@ -109,7 +109,9 @@ static av_cold int flac_decode_init(AVCodecContext *avctx)
return AVERROR_INVALIDDATA;
/* initialize based on the demuxer-supplied streamdata header */
- ff_flac_parse_streaminfo(avctx, &s->flac_stream_info, streaminfo);
+ ret = ff_flac_parse_streaminfo(avctx, &s->flac_stream_info, streaminfo);
+ if (ret < 0)
+ return ret;
ret = allocate_buffers(s);
if (ret < 0)
return ret;
@@ -175,7 +177,9 @@ static int parse_streaminfo(FLACContext *s, const uint8_t *buf, int buf_size)
metadata_size != FLAC_STREAMINFO_SIZE) {
return AVERROR_INVALIDDATA;
}
- ff_flac_parse_streaminfo(s->avctx, &s->flac_stream_info, &buf[8]);
+ ret = ff_flac_parse_streaminfo(s->avctx, &s->flac_stream_info, &buf[8]);
+ if (ret < 0)
+ return ret;
ret = allocate_buffers(s);
if (ret < 0)
return ret;
@@ -201,12 +205,12 @@ static int get_metadata_size(const uint8_t *buf, int buf_size)
buf += 4;
do {
if (buf_end - buf < 4)
- return 0;
+ return AVERROR_INVALIDDATA;
flac_parse_block_header(buf, &metadata_last, NULL, &metadata_size);
buf += 4;
if (buf_end - buf < metadata_size) {
/* need more data in order to read the complete header */
- return 0;
+ return AVERROR_INVALIDDATA;
}
buf += metadata_size;
} while (!metadata_last);
@@ -254,8 +258,15 @@ static int decode_residuals(FLACContext *s, int32_t *decoded, int pred_order)
for (; i < samples; i++)
*decoded++ = get_sbits_long(&s->gb, tmp);
} else {
+ int real_limit = tmp ? (INT_MAX >> tmp) + 2 : INT_MAX;
for (; i < samples; i++) {
- *decoded++ = get_sr_golomb_flac(&s->gb, tmp, INT_MAX, 0);
+ int v = get_sr_golomb_flac(&s->gb, tmp, real_limit, 0);
+ if (v == 0x80000000){
+ av_log(s->avctx, AV_LOG_ERROR, "invalid residual\n");
+ return AVERROR_INVALIDDATA;
+ }
+
+ *decoded++ = v;
}
}
i= 0;
@@ -268,7 +279,8 @@ static int decode_subframe_fixed(FLACContext *s, int32_t *decoded,
int pred_order, int bps)
{
const int blocksize = s->blocksize;
- int av_uninit(a), av_uninit(b), av_uninit(c), av_uninit(d), i;
+ unsigned av_uninit(a), av_uninit(b), av_uninit(c), av_uninit(d);
+ int i;
int ret;
/* warm up samples */
@@ -286,7 +298,7 @@ static int decode_subframe_fixed(FLACContext *s, int32_t *decoded,
if (pred_order > 2)
c = b - decoded[pred_order-2] + decoded[pred_order-3];
if (pred_order > 3)
- d = c - decoded[pred_order-2] + 2*decoded[pred_order-3] - decoded[pred_order-4];
+ d = c - decoded[pred_order-2] + 2U*decoded[pred_order-3] - decoded[pred_order-4];
switch (pred_order) {
case 0:
@@ -315,7 +327,7 @@ static int decode_subframe_fixed(FLACContext *s, int32_t *decoded,
return 0;
}
-static void lpc_analyze_remodulate(int32_t *decoded, const int coeffs[32],
+static void lpc_analyze_remodulate(SUINT32 *decoded, const int coeffs[32],
int order, int qlevel, int len, int bps)
{
int i, j;
@@ -331,7 +343,7 @@ static void lpc_analyze_remodulate(int32_t *decoded, const int coeffs[32],
for (i = len - 1; i >= order; i--) {
int64_t p = 0;
for (j = 0; j < order; j++)
- p += coeffs[j] * (int64_t)decoded[i-order+j];
+ p += coeffs[j] * (int64_t)(int32_t)decoded[i-order+j];
decoded[i] -= p >> qlevel;
}
for (i = order; i < len; i++, decoded++) {
@@ -444,10 +456,10 @@ static inline int decode_subframe(FLACContext *s, int channel)
return AVERROR_INVALIDDATA;
}
- if (wasted) {
+ if (wasted && wasted < 32) {
int i;
for (i = 0; i < s->blocksize; i++)
- decoded[i] <<= wasted;
+ decoded[i] = (unsigned)decoded[i] << wasted;
}
return 0;
diff --git a/media/ffvpx/libavcodec/flacdsp.c b/media/ffvpx/libavcodec/flacdsp.c
index 30b66484e8..bc9a5dbed9 100644
--- a/media/ffvpx/libavcodec/flacdsp.c
+++ b/media/ffvpx/libavcodec/flacdsp.c
@@ -49,8 +49,8 @@ static void flac_lpc_16_c(int32_t *decoded, const int coeffs[32],
int i, j;
for (i = pred_order; i < len - 1; i += 2, decoded += 2) {
- int c = coeffs[0];
- int d = decoded[0];
+ SUINT c = coeffs[0];
+ SUINT d = decoded[0];
int s0 = 0, s1 = 0;
for (j = 1; j < pred_order; j++) {
s0 += c*d;
@@ -59,15 +59,15 @@ static void flac_lpc_16_c(int32_t *decoded, const int coeffs[32],
c = coeffs[j];
}
s0 += c*d;
- d = decoded[j] += s0 >> qlevel;
+ d = decoded[j] += (SUINT)(s0 >> qlevel);
s1 += c*d;
- decoded[j + 1] += s1 >> qlevel;
+ decoded[j + 1] += (SUINT)(s1 >> qlevel);
}
if (i < len) {
int sum = 0;
for (j = 0; j < pred_order; j++)
- sum += coeffs[j] * decoded[j];
- decoded[j] += sum >> qlevel;
+ sum += coeffs[j] * (SUINT)decoded[j];
+ decoded[j] = decoded[j] + (unsigned)(sum >> qlevel);
}
}
diff --git a/media/ffvpx/libavcodec/flacdsp.h b/media/ffvpx/libavcodec/flacdsp.h
index f5cbd94724..7bb0dd0e9a 100644
--- a/media/ffvpx/libavcodec/flacdsp.h
+++ b/media/ffvpx/libavcodec/flacdsp.h
@@ -20,6 +20,7 @@
#define AVCODEC_FLACDSP_H
#include <stdint.h>
+#include "libavutil/internal.h"
#include "libavutil/samplefmt.h"
typedef struct FLACDSPContext {
diff --git a/media/ffvpx/libavcodec/flacdsp_template.c b/media/ffvpx/libavcodec/flacdsp_template.c
index 62c0a15ff6..776c78da71 100644
--- a/media/ffvpx/libavcodec/flacdsp_template.c
+++ b/media/ffvpx/libavcodec/flacdsp_template.c
@@ -56,7 +56,7 @@ static void FUNC(flac_decorrelate_indep_c)(uint8_t **out, int32_t **in,
for (j = 0; j < len; j++)
for (i = 0; i < channels; i++)
- S(samples, i, j) = in[i][j] << shift;
+ S(samples, i, j) = (int)((unsigned)in[i][j] << shift);
}
static void FUNC(flac_decorrelate_ls_c)(uint8_t **out, int32_t **in,
diff --git a/media/ffvpx/libavcodec/get_bits.h b/media/ffvpx/libavcodec/get_bits.h
index 0f183e0358..0c7f5ff0c6 100644
--- a/media/ffvpx/libavcodec/get_bits.h
+++ b/media/ffvpx/libavcodec/get_bits.h
@@ -229,6 +229,20 @@ static inline int get_xbits(GetBitContext *s, int n)
return (NEG_USR32(sign ^ cache, n) ^ sign) - sign;
}
+static inline int get_xbits_le(GetBitContext *s, int n)
+{
+ register int sign;
+ register int32_t cache;
+ OPEN_READER(re, s);
+ av_assert2(n>0 && n<=25);
+ UPDATE_CACHE_LE(re, s);
+ cache = GET_CACHE(re, s);
+ sign = sign_extend(~cache, n) >> 31;
+ LAST_SKIP_BITS(re, s, n);
+ CLOSE_READER(re, s);
+ return (zero_extend(sign ^ cache, n) ^ sign) - sign;
+}
+
static inline int get_sbits(GetBitContext *s, int n)
{
register int tmp;
@@ -331,6 +345,7 @@ static inline void skip_bits1(GetBitContext *s)
*/
static inline unsigned int get_bits_long(GetBitContext *s, int n)
{
+ av_assert2(n>=0 && n<=32);
if (!n) {
return 0;
} else if (n <= MIN_CACHE_BITS) {
@@ -369,6 +384,10 @@ static inline uint64_t get_bits64(GetBitContext *s, int n)
*/
static inline int get_sbits_long(GetBitContext *s, int n)
{
+ // sign_extend(x, 0) is undefined
+ if (!n)
+ return 0;
+
return sign_extend(get_bits_long(s, n), n);
}
@@ -531,6 +550,7 @@ static inline const uint8_t *align_get_bits(GetBitContext *s)
* @param max_depth is the number of times bits bits must be read to completely
* read the longest vlc code
* = (max_vlc_length + bits - 1) / bits
+ * @returns the code parsed or -1 if no vlc matches
*/
static av_always_inline int get_vlc2(GetBitContext *s, VLC_TYPE (*table)[2],
int bits, int max_depth)
diff --git a/media/ffvpx/libavcodec/golomb.h b/media/ffvpx/libavcodec/golomb.h
index 917ea54e14..efb1eff8aa 100644
--- a/media/ffvpx/libavcodec/golomb.h
+++ b/media/ffvpx/libavcodec/golomb.h
@@ -314,6 +314,8 @@ static inline int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit,
log = av_log2(buf);
+ av_assert2(k <= 31);
+
if (log - k >= 32 - MIN_CACHE_BITS + (MIN_CACHE_BITS == 32) &&
32 - log < limit) {
buf >>= log - k;
@@ -325,8 +327,10 @@ static inline int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit,
} else {
int i;
for (i = 0; i < limit && SHOW_UBITS(re, gb, 1) == 0; i++) {
- if (gb->size_in_bits <= re_index)
+ if (gb->size_in_bits <= re_index) {
+ CLOSE_READER(re, gb);
return -1;
+ }
LAST_SKIP_BITS(re, gb, 1);
UPDATE_CACHE(re, gb);
}
@@ -348,16 +352,17 @@ static inline int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit,
buf = 0;
}
- CLOSE_READER(re, gb);
- return buf + (i << k);
+ buf += ((SUINT)i << k);
} else if (i == limit - 1) {
buf = SHOW_UBITS(re, gb, esc_len);
LAST_SKIP_BITS(re, gb, esc_len);
- CLOSE_READER(re, gb);
- return buf + 1;
- } else
- return -1;
+ buf ++;
+ } else {
+ buf = -1;
+ }
+ CLOSE_READER(re, gb);
+ return buf;
}
}
@@ -445,19 +450,20 @@ static inline int get_te(GetBitContext *s, int r, char *file, const char *func,
return i;
}
-#define get_ue_golomb(a) get_ue(a, __FILE__, __PRETTY_FUNCTION__, __LINE__)
-#define get_se_golomb(a) get_se(a, __FILE__, __PRETTY_FUNCTION__, __LINE__)
-#define get_te_golomb(a, r) get_te(a, r, __FILE__, __PRETTY_FUNCTION__, __LINE__)
-#define get_te0_golomb(a, r) get_te(a, r, __FILE__, __PRETTY_FUNCTION__, __LINE__)
+#define get_ue_golomb(a) get_ue(a, __FILE__, __func__, __LINE__)
+#define get_se_golomb(a) get_se(a, __FILE__, __func__, __LINE__)
+#define get_te_golomb(a, r) get_te(a, r, __FILE__, __func__, __LINE__)
+#define get_te0_golomb(a, r) get_te(a, r, __FILE__, __func__, __LINE__)
#endif /* TRACE */
/**
- * write unsigned exp golomb code.
+ * write unsigned exp golomb code. 2^16 - 2 at most
*/
static inline void set_ue_golomb(PutBitContext *pb, int i)
{
av_assert2(i >= 0);
+ av_assert2(i <= 0xFFFE);
if (i < 256)
put_bits(pb, ff_ue_golomb_len[i], i + 1);
@@ -468,6 +474,21 @@ static inline void set_ue_golomb(PutBitContext *pb, int i)
}
/**
+ * write unsigned exp golomb code. 2^32-2 at most.
+ */
+static inline void set_ue_golomb_long(PutBitContext *pb, uint32_t i)
+{
+ av_assert2(i <= (UINT32_MAX - 1));
+
+ if (i < 256)
+ put_bits(pb, ff_ue_golomb_len[i], i + 1);
+ else {
+ int e = av_log2(i + 1);
+ put_bits64(pb, 2 * e + 1, i + 1);
+ }
+}
+
+/**
* write truncated unsigned exp golomb code.
*/
static inline void set_te_golomb(PutBitContext *pb, int i, int range)
@@ -486,19 +507,9 @@ static inline void set_te_golomb(PutBitContext *pb, int i, int range)
*/
static inline void set_se_golomb(PutBitContext *pb, int i)
{
-#if 0
- if (i <= 0)
- i = -2 * i;
- else
- i = 2 * i - 1;
-#elif 1
i = 2 * i - 1;
if (i < 0)
i ^= -1; //FIXME check if gcc does the right thing
-#else
- i = 2 * i - 1;
- i ^= (i >> 31);
-#endif
set_ue_golomb(pb, i);
}
diff --git a/media/ffvpx/libavcodec/h264chroma.h b/media/ffvpx/libavcodec/h264chroma.h
index e0f45ad13b..5c89fd12df 100644
--- a/media/ffvpx/libavcodec/h264chroma.h
+++ b/media/ffvpx/libavcodec/h264chroma.h
@@ -19,9 +19,10 @@
#ifndef AVCODEC_H264CHROMA_H
#define AVCODEC_H264CHROMA_H
+#include <stddef.h>
#include <stdint.h>
-typedef void (*h264_chroma_mc_func)(uint8_t *dst/*align 8*/, uint8_t *src/*align 1*/, int srcStride, int h, int x, int y);
+typedef void (*h264_chroma_mc_func)(uint8_t *dst /*align 8*/, uint8_t *src /*align 1*/, ptrdiff_t srcStride, int h, int x, int y);
typedef struct H264ChromaContext {
h264_chroma_mc_func put_h264_chroma_pixels_tab[4];
diff --git a/media/ffvpx/libavcodec/hpeldsp.h b/media/ffvpx/libavcodec/hpeldsp.h
index 1a3cea54b8..768139bfc9 100644
--- a/media/ffvpx/libavcodec/hpeldsp.h
+++ b/media/ffvpx/libavcodec/hpeldsp.h
@@ -76,6 +76,8 @@ typedef struct HpelDSPContext {
* @param pixels source
* @param line_size number of bytes in a horizontal line of block
* @param h height
+ * @note The size is kept at [4][4] to match the above pixel_tabs and avoid
+ * out of bounds reads in the motion estimation code.
*/
op_pixels_func put_no_rnd_pixels_tab[4][4];
diff --git a/media/ffvpx/libavcodec/hwaccel.h b/media/ffvpx/libavcodec/hwaccel.h
new file mode 100644
index 0000000000..124fbbf1fd
--- /dev/null
+++ b/media/ffvpx/libavcodec/hwaccel.h
@@ -0,0 +1,24 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_HWACCEL_H
+#define AVCODEC_HWACCEL_H
+
+#define HWACCEL_CAP_ASYNC_SAFE (1 << 0)
+
+#endif /* AVCODEC_HWACCEL_H */
diff --git a/media/ffvpx/libavcodec/idctdsp.h b/media/ffvpx/libavcodec/idctdsp.h
index b180a6762a..26221f6a9d 100644
--- a/media/ffvpx/libavcodec/idctdsp.h
+++ b/media/ffvpx/libavcodec/idctdsp.h
@@ -21,6 +21,8 @@
#include <stdint.h>
+#include "config.h"
+
#include "avcodec.h"
/**
@@ -51,13 +53,13 @@ int ff_init_scantable_permutation_x86(uint8_t *idct_permutation,
typedef struct IDCTDSPContext {
/* pixel ops : interface with DCT */
void (*put_pixels_clamped)(const int16_t *block /* align 16 */,
- uint8_t *pixels /* align 8 */,
+ uint8_t *av_restrict pixels /* align 8 */,
ptrdiff_t line_size);
void (*put_signed_pixels_clamped)(const int16_t *block /* align 16 */,
- uint8_t *pixels /* align 8 */,
+ uint8_t *av_restrict pixels /* align 8 */,
ptrdiff_t line_size);
void (*add_pixels_clamped)(const int16_t *block /* align 16 */,
- uint8_t *pixels /* align 8 */,
+ uint8_t *av_restrict pixels /* align 8 */,
ptrdiff_t line_size);
void (*idct)(int16_t *block /* align 16 */);
@@ -68,14 +70,14 @@ typedef struct IDCTDSPContext {
* @param line_size size in bytes of a horizontal line of dest
*/
void (*idct_put)(uint8_t *dest /* align 8 */,
- int line_size, int16_t *block /* align 16 */);
+ ptrdiff_t line_size, int16_t *block /* align 16 */);
/**
* block -> idct -> add dest -> clip to unsigned 8 bit -> dest.
* @param line_size size in bytes of a horizontal line of dest
*/
void (*idct_add)(uint8_t *dest /* align 8 */,
- int line_size, int16_t *block /* align 16 */);
+ ptrdiff_t line_size, int16_t *block /* align 16 */);
/**
* IDCT input permutation.
@@ -95,11 +97,15 @@ typedef struct IDCTDSPContext {
enum idct_permutation_type perm_type;
} IDCTDSPContext;
-extern void (*ff_put_pixels_clamped)(const int16_t *block, uint8_t *pixels, ptrdiff_t line_size);
-extern void (*ff_add_pixels_clamped)(const int16_t *block, uint8_t *pixels, ptrdiff_t line_size);
+void ff_put_pixels_clamped_c(const int16_t *block, uint8_t *av_restrict pixels,
+ ptrdiff_t line_size);
+void ff_add_pixels_clamped_c(const int16_t *block, uint8_t *av_restrict pixels,
+ ptrdiff_t line_size);
void ff_idctdsp_init(IDCTDSPContext *c, AVCodecContext *avctx);
+void ff_idctdsp_init_aarch64(IDCTDSPContext *c, AVCodecContext *avctx,
+ unsigned high_bit_depth);
void ff_idctdsp_init_alpha(IDCTDSPContext *c, AVCodecContext *avctx,
unsigned high_bit_depth);
void ff_idctdsp_init_arm(IDCTDSPContext *c, AVCodecContext *avctx,
diff --git a/media/ffvpx/libavcodec/internal.h b/media/ffvpx/libavcodec/internal.h
index 35b9630b52..faa923c11f 100644
--- a/media/ffvpx/libavcodec/internal.h
+++ b/media/ffvpx/libavcodec/internal.h
@@ -48,8 +48,8 @@
#define FF_CODEC_CAP_INIT_CLEANUP (1 << 1)
/**
* Decoders marked with FF_CODEC_CAP_SETS_PKT_DTS want to set
- * AVFrame.pkt_dts manually. If the flag is set, utils.c won't overwrite
- * this field. If it's unset, utils.c tries to guess the pkt_dts field
+ * AVFrame.pkt_dts manually. If the flag is set, decode.c won't overwrite
+ * this field. If it's unset, decode.c tries to guess the pkt_dts field
* from the input AVPacket.
*/
#define FF_CODEC_CAP_SETS_PKT_DTS (1 << 2)
@@ -58,6 +58,16 @@
* skipped due to the skip_frame setting.
*/
#define FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM (1 << 3)
+/**
+ * The decoder sets the cropping fields in the output frames manually.
+ * If this cap is set, the generic code will initialize output frame
+ * dimensions to coded rather than display values.
+ */
+#define FF_CODEC_CAP_EXPORTS_CROPPING (1 << 4)
+/**
+ * Codec initializes slice-based threading with a main function
+ */
+#define FF_CODEC_CAP_SLICE_THREAD_HAS_MF (1 << 5)
#ifdef TRACE
# define ff_tlog(ctx, ...) av_log(ctx, AV_LOG_TRACE, __VA_ARGS__)
@@ -70,11 +80,18 @@
#define FF_DEFAULT_QUANT_BIAS 999999
#endif
+#if !FF_API_QSCALE_TYPE
+#define FF_QSCALE_TYPE_MPEG1 0
+#define FF_QSCALE_TYPE_MPEG2 1
+#define FF_QSCALE_TYPE_H264 2
+#define FF_QSCALE_TYPE_VP56 3
+#endif
+
#define FF_SANE_NB_CHANNELS 64U
#define FF_SIGNBIT(x) ((x) >> CHAR_BIT * sizeof(x) - 1)
-#if HAVE_AVX
+#if HAVE_SIMD_ALIGN_32
# define STRIDE_ALIGN 32
#elif HAVE_SIMD_ALIGN_16
# define STRIDE_ALIGN 16
@@ -101,6 +118,16 @@ typedef struct FramePool {
int samples;
} FramePool;
+typedef struct DecodeSimpleContext {
+ AVPacket *in_pkt;
+ AVFrame *out_frame;
+} DecodeSimpleContext;
+
+typedef struct DecodeFilterContext {
+ AVBSFContext **bsfs;
+ int nb_bsfs;
+} DecodeFilterContext;
+
typedef struct AVCodecInternal {
/**
* Whether the parent AVCodecContext is a copy of the context which had
@@ -137,11 +164,14 @@ typedef struct AVCodecInternal {
void *thread_ctx;
+ DecodeSimpleContext ds;
+ DecodeFilterContext filter;
+
/**
- * Current packet as passed into the decoder, to avoid having to pass the
- * packet into every function.
+ * Properties (timestamps+side data) extracted from the last packet passed
+ * for decoding.
*/
- AVPacket *pkt;
+ AVPacket *last_pkt_props;
/**
* temporary buffer used for encoders to store their bitstream
@@ -173,7 +203,23 @@ typedef struct AVCodecInternal {
int buffer_pkt_valid; // encoding: packet without data can be valid
AVFrame *buffer_frame;
int draining_done;
+ /* set to 1 when the caller is using the old decoding API */
+ int compat_decode;
+ int compat_decode_warned;
+ /* this variable is set by the decoder internals to signal to the old
+ * API compat wrappers the amount of data consumed from the last packet */
+ size_t compat_decode_consumed;
+ /* when a partial packet has been consumed, this stores the remaining size
+ * of the packet (that should be submitted in the next decode call */
+ size_t compat_decode_partial_size;
+ AVFrame *compat_decode_frame;
+
int showed_multi_packet_warning;
+
+ int skip_samples_multiplier;
+
+ /* to prevent infinite loop on errors when draining */
+ int nb_draining_errors;
} AVCodecInternal;
struct AVCodecDefault {
@@ -262,7 +308,7 @@ static av_always_inline int64_t ff_samples_to_time_base(AVCodecContext *avctx,
static av_always_inline float ff_exp2fi(int x) {
/* Normal range */
if (-126 <= x && x <= 128)
- return av_int2float(x+127 << 23);
+ return av_int2float((x+127) << 23);
/* Too large */
else if (x > 128)
return INFINITY;
@@ -327,6 +373,10 @@ int ff_set_sar(AVCodecContext *avctx, AVRational sar);
int ff_side_data_update_matrix_encoding(AVFrame *frame,
enum AVMatrixEncoding matrix_encoding);
+#if FF_API_MERGE_SD
+int ff_packet_split_and_drop_side_data(AVPacket *pkt);
+#endif
+
/**
* Select the (possibly hardware accelerated) pixel format.
* This is a wrapper around AVCodecContext.get_format() and should be used
@@ -361,4 +411,10 @@ int ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, i
int ff_alloc_a53_sei(const AVFrame *frame, size_t prefix_len,
void **data, size_t *sei_size);
+/**
+ * Get an estimated video bitrate based on frame size, frame rate and coded
+ * bits per pixel.
+ */
+int64_t ff_guess_coded_bitrate(AVCodecContext *avctx);
+
#endif /* AVCODEC_INTERNAL_H */
diff --git a/media/ffvpx/libavcodec/mathops.h b/media/ffvpx/libavcodec/mathops.h
index 5168dc2ce0..1c35664318 100644
--- a/media/ffvpx/libavcodec/mathops.h
+++ b/media/ffvpx/libavcodec/mathops.h
@@ -25,6 +25,7 @@
#include <stdint.h>
#include "libavutil/common.h"
+#include "libavutil/reverse.h"
#include "config.h"
#define MAX_NEG_CROP 1024
@@ -96,15 +97,6 @@ static av_always_inline unsigned UMULH(unsigned a, unsigned b){
#define mid_pred mid_pred
static inline av_const int mid_pred(int a, int b, int c)
{
-#if 0
- int t= (a-b)&((a-b)>>31);
- a-=t;
- b+=t;
- b-= (b-c)&((b-c)>>31);
- b+= (a-b)&((a-b)>>31);
-
- return b;
-#else
if(a>b){
if(c>b){
if(c>a) b=a;
@@ -117,7 +109,6 @@ static inline av_const int mid_pred(int a, int b, int c)
}
}
return b;
-#endif
}
#endif
@@ -249,4 +240,12 @@ static inline int8_t ff_u8_to_s8(uint8_t a)
return b.s8;
}
+static av_always_inline uint32_t bitswap_32(uint32_t x)
+{
+ return (uint32_t)ff_reverse[ x & 0xFF] << 24 |
+ (uint32_t)ff_reverse[(x >> 8) & 0xFF] << 16 |
+ (uint32_t)ff_reverse[(x >> 16) & 0xFF] << 8 |
+ (uint32_t)ff_reverse[ x >> 24];
+}
+
#endif /* AVCODEC_MATHOPS_H */
diff --git a/media/ffvpx/libavcodec/me_cmp.h b/media/ffvpx/libavcodec/me_cmp.h
index 5666f59ade..0dbbcbb1d9 100644
--- a/media/ffvpx/libavcodec/me_cmp.h
+++ b/media/ffvpx/libavcodec/me_cmp.h
@@ -76,7 +76,7 @@ typedef struct MECmpContext {
me_cmp_func frame_skip_cmp[6]; // only width 8 used
me_cmp_func pix_abs[2][4];
- me_cmp_func median_sad[2];
+ me_cmp_func median_sad[6];
} MECmpContext;
void ff_me_cmp_init_static(void);
diff --git a/media/ffvpx/libavcodec/moz.build b/media/ffvpx/libavcodec/moz.build
index 443bbe978d..9980e1556f 100644
--- a/media/ffvpx/libavcodec/moz.build
+++ b/media/ffvpx/libavcodec/moz.build
@@ -16,7 +16,11 @@ SOURCES += [
'avpacket.c',
'avpicture.c',
'bitstream.c',
+ 'bitstream_filter.c',
+ 'bitstream_filters.c',
+ 'bsf.c',
'codec_desc.c',
+ 'decode.c',
'dummy_funcs.c',
'flac.c',
'flac_parser.c',
@@ -28,6 +32,7 @@ SOURCES += [
'imgconvert.c',
'log2_tab.c',
'mathtables.c',
+ 'null_bsf.c',
'options.c',
'parser.c',
'profiles.c',
@@ -48,10 +53,16 @@ SOURCES += [
'vp8dsp.c',
'vp9.c',
'vp9_parser.c',
+ 'vp9block.c',
+ 'vp9data.c',
'vp9dsp.c',
'vp9dsp_10bpp.c',
'vp9dsp_12bpp.c',
'vp9dsp_8bpp.c',
+ 'vp9lpf.c',
+ 'vp9mvs.c',
+ 'vp9prob.c',
+ 'vp9recon.c',
'xiph.c'
]
diff --git a/media/ffvpx/libavcodec/mpegvideo.h b/media/ffvpx/libavcodec/mpegvideo.h
index c82fa3e1a1..e9eb633d1b 100644
--- a/media/ffvpx/libavcodec/mpegvideo.h
+++ b/media/ffvpx/libavcodec/mpegvideo.h
@@ -422,6 +422,7 @@ typedef struct MpegEncContext {
struct MJpegContext *mjpeg_ctx;
int esc_pos;
int pred;
+ int huffman;
/* MSMPEG4 specific */
int mv_table_index;
@@ -679,7 +680,7 @@ void ff_mpv_common_end(MpegEncContext *s);
void ff_mpv_decode_defaults(MpegEncContext *s);
void ff_mpv_decode_init(MpegEncContext *s, AVCodecContext *avctx);
-void ff_mpv_decode_mb(MpegEncContext *s, int16_t block[12][64]);
+void ff_mpv_reconstruct_mb(MpegEncContext *s, int16_t block[12][64]);
void ff_mpv_report_decode_progress(MpegEncContext *s);
int ff_mpv_frame_start(MpegEncContext *s, AVCodecContext *avctx);
diff --git a/media/ffvpx/libavcodec/null_bsf.c b/media/ffvpx/libavcodec/null_bsf.c
new file mode 100644
index 0000000000..feb71248a9
--- /dev/null
+++ b/media/ffvpx/libavcodec/null_bsf.c
@@ -0,0 +1,43 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * Null bitstream filter -- pass the input through unchanged.
+ */
+
+#include "avcodec.h"
+#include "bsf.h"
+
+static int null_filter(AVBSFContext *ctx, AVPacket *out)
+{
+ AVPacket *in;
+ int ret;
+
+ ret = ff_bsf_get_packet(ctx, &in);
+ if (ret < 0)
+ return ret;
+ av_packet_move_ref(out, in);
+ av_packet_free(&in);
+ return 0;
+}
+
+const AVBitStreamFilter ff_null_bsf = {
+ .name = "null",
+ .filter = null_filter,
+};
diff --git a/media/ffvpx/libavcodec/options.c b/media/ffvpx/libavcodec/options.c
index f25df2ab36..82e12179a6 100644
--- a/media/ffvpx/libavcodec/options.c
+++ b/media/ffvpx/libavcodec/options.c
@@ -34,7 +34,7 @@
#include <string.h>
FF_DISABLE_DEPRECATION_WARNINGS
-#include "ff_options_table.h"
+#include "options_table.h"
FF_ENABLE_DEPRECATION_WARNINGS
static const char* context_to_name(void* ptr) {
@@ -119,6 +119,7 @@ static int init_context_defaults(AVCodecContext *s, const AVCodec *codec)
s->execute2 = avcodec_default_execute2;
s->sample_aspect_ratio = (AVRational){0,1};
s->pix_fmt = AV_PIX_FMT_NONE;
+ s->sw_pix_fmt = AV_PIX_FMT_NONE;
s->sample_fmt = AV_SAMPLE_FMT_NONE;
s->reordered_opaque = AV_NOPTS_VALUE;
@@ -187,6 +188,31 @@ void avcodec_free_context(AVCodecContext **pavctx)
}
#if FF_API_COPY_CONTEXT
+static void copy_context_reset(AVCodecContext *avctx)
+{
+ int i;
+
+ av_opt_free(avctx);
+#if FF_API_CODED_FRAME
+FF_DISABLE_DEPRECATION_WARNINGS
+ av_frame_free(&avctx->coded_frame);
+FF_ENABLE_DEPRECATION_WARNINGS
+#endif
+ av_freep(&avctx->rc_override);
+ av_freep(&avctx->intra_matrix);
+ av_freep(&avctx->inter_matrix);
+ av_freep(&avctx->extradata);
+ av_freep(&avctx->subtitle_header);
+ av_buffer_unref(&avctx->hw_frames_ctx);
+ av_buffer_unref(&avctx->hw_device_ctx);
+ for (i = 0; i < avctx->nb_coded_side_data; i++)
+ av_freep(&avctx->coded_side_data[i].data);
+ av_freep(&avctx->coded_side_data);
+ avctx->subtitle_header_size = 0;
+ avctx->nb_coded_side_data = 0;
+ avctx->extradata_size = 0;
+}
+
int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
{
const AVCodec *orig_codec = dest->codec;
@@ -199,12 +225,7 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src)
return AVERROR(EINVAL);
}
- av_opt_free(dest);
- av_freep(&dest->rc_override);
- av_freep(&dest->intra_matrix);
- av_freep(&dest->inter_matrix);
- av_freep(&dest->extradata);
- av_freep(&dest->subtitle_header);
+ copy_context_reset(dest);
memcpy(dest, src, sizeof(*dest));
av_opt_copy(dest, src);
@@ -229,11 +250,14 @@ FF_ENABLE_DEPRECATION_WARNINGS
/* reallocate values that should be allocated separately */
dest->extradata = NULL;
+ dest->coded_side_data = NULL;
dest->intra_matrix = NULL;
dest->inter_matrix = NULL;
dest->rc_override = NULL;
dest->subtitle_header = NULL;
dest->hw_frames_ctx = NULL;
+ dest->hw_device_ctx = NULL;
+ dest->nb_coded_side_data = 0;
#define alloc_and_copy_or_fail(obj, size, pad) \
if (src->obj && size > 0) { \
@@ -263,15 +287,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
return 0;
fail:
- av_freep(&dest->subtitle_header);
- av_freep(&dest->rc_override);
- av_freep(&dest->intra_matrix);
- av_freep(&dest->inter_matrix);
- av_freep(&dest->extradata);
- av_buffer_unref(&dest->hw_frames_ctx);
- dest->subtitle_header_size = 0;
- dest->extradata_size = 0;
- av_opt_free(dest);
+ copy_context_reset(dest);
return AVERROR(ENOMEM);
}
#endif
diff --git a/media/ffvpx/libavcodec/options_table.h b/media/ffvpx/libavcodec/options_table.h
new file mode 100644
index 0000000000..2ac37c3ff1
--- /dev/null
+++ b/media/ffvpx/libavcodec/options_table.h
@@ -0,0 +1,594 @@
+/*
+ * Copyright (c) 2001 Fabrice Bellard
+ * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_OPTIONS_TABLE_H
+#define AVCODEC_OPTIONS_TABLE_H
+
+#include <float.h>
+#include <limits.h>
+#include <stdint.h>
+
+#include "libavutil/opt.h"
+#include "avcodec.h"
+#include "version.h"
+
+#define OFFSET(x) offsetof(AVCodecContext,x)
+#define DEFAULT 0 //should be NAN but it does not work as it is not a constant in glibc as required by ANSI/ISO C
+//these names are too long to be readable
+#define V AV_OPT_FLAG_VIDEO_PARAM
+#define A AV_OPT_FLAG_AUDIO_PARAM
+#define S AV_OPT_FLAG_SUBTITLE_PARAM
+#define E AV_OPT_FLAG_ENCODING_PARAM
+#define D AV_OPT_FLAG_DECODING_PARAM
+
+#define AV_CODEC_DEFAULT_BITRATE 200*1000
+
+static const AVOption avcodec_options[] = {
+{"b", "set bitrate (in bits/s)", OFFSET(bit_rate), AV_OPT_TYPE_INT64, {.i64 = AV_CODEC_DEFAULT_BITRATE }, 0, INT64_MAX, A|V|E},
+{"ab", "set bitrate (in bits/s)", OFFSET(bit_rate), AV_OPT_TYPE_INT64, {.i64 = 128*1000 }, 0, INT_MAX, A|E},
+{"bt", "Set video bitrate tolerance (in bits/s). In 1-pass mode, bitrate tolerance specifies how far "
+ "ratecontrol is willing to deviate from the target average bitrate value. This is not related "
+ "to minimum/maximum bitrate. Lowering tolerance too much has an adverse effect on quality.",
+ OFFSET(bit_rate_tolerance), AV_OPT_TYPE_INT, {.i64 = AV_CODEC_DEFAULT_BITRATE*20 }, 1, INT_MAX, V|E},
+{"flags", NULL, OFFSET(flags), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT }, 0, UINT_MAX, V|A|S|E|D, "flags"},
+{"unaligned", "allow decoders to produce unaligned output", 0, AV_OPT_TYPE_CONST, { .i64 = AV_CODEC_FLAG_UNALIGNED }, INT_MIN, INT_MAX, V | D, "flags" },
+{"mv4", "use four motion vectors per macroblock (MPEG-4)", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_4MV }, INT_MIN, INT_MAX, V|E, "flags"},
+{"qpel", "use 1/4-pel motion compensation", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_QPEL }, INT_MIN, INT_MAX, V|E, "flags"},
+{"loop", "use loop filter", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_LOOP_FILTER }, INT_MIN, INT_MAX, V|E, "flags"},
+{"qscale", "use fixed qscale", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_QSCALE }, INT_MIN, INT_MAX, 0, "flags"},
+#if FF_API_GMC
+{"gmc", "use gmc", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_GMC }, INT_MIN, INT_MAX, V|E, "flags"},
+#endif
+#if FF_API_MV0
+{"mv0", "always try a mb with mv=<0,0>", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_MV0 }, INT_MIN, INT_MAX, V|E, "flags"},
+#endif
+#if FF_API_INPUT_PRESERVED
+{"input_preserved", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_INPUT_PRESERVED }, INT_MIN, INT_MAX, 0, "flags"},
+#endif
+{"pass1", "use internal 2-pass ratecontrol in first pass mode", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_PASS1 }, INT_MIN, INT_MAX, 0, "flags"},
+{"pass2", "use internal 2-pass ratecontrol in second pass mode", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_PASS2 }, INT_MIN, INT_MAX, 0, "flags"},
+{"gray", "only decode/encode grayscale", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_GRAY }, INT_MIN, INT_MAX, V|E|D, "flags"},
+#if FF_API_EMU_EDGE
+{"emu_edge", "do not draw edges", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_EMU_EDGE }, INT_MIN, INT_MAX, 0, "flags"},
+#endif
+{"psnr", "error[?] variables will be set during encoding", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_PSNR }, INT_MIN, INT_MAX, V|E, "flags"},
+{"truncated", "Input bitstream might be randomly truncated", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_TRUNCATED }, INT_MIN, INT_MAX, V|D, "flags"},
+#if FF_API_NORMALIZE_AQP
+{"naq", "normalize adaptive quantization", 0, AV_OPT_TYPE_CONST, {.i64 = CODEC_FLAG_NORMALIZE_AQP }, INT_MIN, INT_MAX, V|E, "flags"},
+#endif
+{"ildct", "use interlaced DCT", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_INTERLACED_DCT }, INT_MIN, INT_MAX, V|E, "flags"},
+{"low_delay", "force low delay", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_LOW_DELAY }, INT_MIN, INT_MAX, V|D|E, "flags"},
+{"global_header", "place global headers in extradata instead of every keyframe", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_GLOBAL_HEADER }, INT_MIN, INT_MAX, V|A|E, "flags"},
+{"bitexact", "use only bitexact functions (except (I)DCT)", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_BITEXACT }, INT_MIN, INT_MAX, A|V|S|D|E, "flags"},
+{"aic", "H.263 advanced intra coding / MPEG-4 AC prediction", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_AC_PRED }, INT_MIN, INT_MAX, V|E, "flags"},
+{"ilme", "interlaced motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_INTERLACED_ME }, INT_MIN, INT_MAX, V|E, "flags"},
+{"cgop", "closed GOP", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_CLOSED_GOP }, INT_MIN, INT_MAX, V|E, "flags"},
+{"output_corrupt", "Output even potentially corrupted frames", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_OUTPUT_CORRUPT }, INT_MIN, INT_MAX, V|D, "flags"},
+{"fast", "allow non-spec-compliant speedup tricks", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_FAST }, INT_MIN, INT_MAX, V|E, "flags2"},
+{"noout", "skip bitstream encoding", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_NO_OUTPUT }, INT_MIN, INT_MAX, V|E, "flags2"},
+{"ignorecrop", "ignore cropping information from sps", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_IGNORE_CROP }, INT_MIN, INT_MAX, V|D, "flags2"},
+{"local_header", "place global headers at every keyframe instead of in extradata", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_LOCAL_HEADER }, INT_MIN, INT_MAX, V|E, "flags2"},
+{"chunks", "Frame data might be split into multiple chunks", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_CHUNKS }, INT_MIN, INT_MAX, V|D, "flags2"},
+{"showall", "Show all frames before the first keyframe", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_SHOW_ALL }, INT_MIN, INT_MAX, V|D, "flags2"},
+{"export_mvs", "export motion vectors through frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_EXPORT_MVS}, INT_MIN, INT_MAX, V|D, "flags2"},
+{"skip_manual", "do not skip samples and export skip information as frame side data", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_SKIP_MANUAL}, INT_MIN, INT_MAX, V|D, "flags2"},
+{"ass_ro_flush_noop", "do not reset ASS ReadOrder field on flush", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_RO_FLUSH_NOOP}, INT_MIN, INT_MAX, S|D, "flags2"},
+#if FF_API_MOTION_EST
+{"me_method", "set motion estimation method", OFFSET(me_method), AV_OPT_TYPE_INT, {.i64 = ME_EPZS }, INT_MIN, INT_MAX, V|E, "me_method"},
+{"zero", "zero motion estimation (fastest)", 0, AV_OPT_TYPE_CONST, {.i64 = ME_ZERO }, INT_MIN, INT_MAX, V|E, "me_method" },
+{"full", "full motion estimation (slowest)", 0, AV_OPT_TYPE_CONST, {.i64 = ME_FULL }, INT_MIN, INT_MAX, V|E, "me_method" },
+{"epzs", "EPZS motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_EPZS }, INT_MIN, INT_MAX, V|E, "me_method" },
+{"esa", "esa motion estimation (alias for full)", 0, AV_OPT_TYPE_CONST, {.i64 = ME_FULL }, INT_MIN, INT_MAX, V|E, "me_method" },
+{"tesa", "tesa motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_TESA }, INT_MIN, INT_MAX, V|E, "me_method" },
+{"dia", "diamond motion estimation (alias for EPZS)", 0, AV_OPT_TYPE_CONST, {.i64 = ME_EPZS }, INT_MIN, INT_MAX, V|E, "me_method" },
+{"log", "log motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_LOG }, INT_MIN, INT_MAX, V|E, "me_method" },
+{"phods", "phods motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_PHODS }, INT_MIN, INT_MAX, V|E, "me_method" },
+{"x1", "X1 motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_X1 }, INT_MIN, INT_MAX, V|E, "me_method" },
+{"hex", "hex motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_HEX }, INT_MIN, INT_MAX, V|E, "me_method" },
+{"umh", "umh motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_UMH }, INT_MIN, INT_MAX, V|E, "me_method" },
+{"iter", "iter motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = ME_ITER }, INT_MIN, INT_MAX, V|E, "me_method" },
+#endif
+{"time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, 0, INT_MAX},
+{"g", "set the group of picture (GOP) size", OFFSET(gop_size), AV_OPT_TYPE_INT, {.i64 = 12 }, INT_MIN, INT_MAX, V|E},
+{"ar", "set audio sampling rate (in Hz)", OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|D|E},
+{"ac", "set number of audio channels", OFFSET(channels), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|D|E},
+{"cutoff", "set cutoff bandwidth", OFFSET(cutoff), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|E},
+{"frame_size", NULL, OFFSET(frame_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, A|E},
+{"frame_number", NULL, OFFSET(frame_number), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"delay", NULL, OFFSET(delay), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"qcomp", "video quantizer scale compression (VBR). Constant of ratecontrol equation. "
+ "Recommended range for default rc_eq: 0.0-1.0",
+ OFFSET(qcompress), AV_OPT_TYPE_FLOAT, {.dbl = 0.5 }, -FLT_MAX, FLT_MAX, V|E},
+{"qblur", "video quantizer scale blur (VBR)", OFFSET(qblur), AV_OPT_TYPE_FLOAT, {.dbl = 0.5 }, -1, FLT_MAX, V|E},
+{"qmin", "minimum video quantizer scale (VBR)", OFFSET(qmin), AV_OPT_TYPE_INT, {.i64 = 2 }, -1, 69, V|E},
+{"qmax", "maximum video quantizer scale (VBR)", OFFSET(qmax), AV_OPT_TYPE_INT, {.i64 = 31 }, -1, 1024, V|E},
+{"qdiff", "maximum difference between the quantizer scales (VBR)", OFFSET(max_qdiff), AV_OPT_TYPE_INT, {.i64 = 3 }, INT_MIN, INT_MAX, V|E},
+{"bf", "set maximum number of B-frames between non-B-frames", OFFSET(max_b_frames), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, -1, INT_MAX, V|E},
+{"b_qfactor", "QP factor between P- and B-frames", OFFSET(b_quant_factor), AV_OPT_TYPE_FLOAT, {.dbl = 1.25 }, -FLT_MAX, FLT_MAX, V|E},
+#if FF_API_RC_STRATEGY
+{"rc_strategy", "ratecontrol method", OFFSET(rc_strategy), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+#endif
+#if FF_API_PRIVATE_OPT
+{"b_strategy", "strategy to choose between I/P/B-frames", OFFSET(b_frame_strategy), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX, V|E},
+{"ps", "RTP payload size in bytes", OFFSET(rtp_payload_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+#endif
+#if FF_API_STAT_BITS
+{"mv_bits", NULL, OFFSET(mv_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"header_bits", NULL, OFFSET(header_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"i_tex_bits", NULL, OFFSET(i_tex_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"p_tex_bits", NULL, OFFSET(p_tex_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"i_count", NULL, OFFSET(i_count), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"p_count", NULL, OFFSET(p_count), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"skip_count", NULL, OFFSET(skip_count), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"misc_bits", NULL, OFFSET(misc_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"frame_bits", NULL, OFFSET(frame_bits), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+#endif
+{"codec_tag", NULL, OFFSET(codec_tag), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"bug", "work around not autodetected encoder bugs", OFFSET(workaround_bugs), AV_OPT_TYPE_FLAGS, {.i64 = FF_BUG_AUTODETECT }, INT_MIN, INT_MAX, V|D, "bug"},
+{"autodetect", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_AUTODETECT }, INT_MIN, INT_MAX, V|D, "bug"},
+#if FF_API_OLD_MSMPEG4
+{"old_msmpeg4", "some old lavc-generated MSMPEG4v3 files (no autodetection)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_OLD_MSMPEG4 }, INT_MIN, INT_MAX, V|D, "bug"},
+#endif
+{"xvid_ilace", "Xvid interlacing bug (autodetected if FOURCC == XVIX)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_XVID_ILACE }, INT_MIN, INT_MAX, V|D, "bug"},
+{"ump4", "(autodetected if FOURCC == UMP4)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_UMP4 }, INT_MIN, INT_MAX, V|D, "bug"},
+{"no_padding", "padding bug (autodetected)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_NO_PADDING }, INT_MIN, INT_MAX, V|D, "bug"},
+{"amv", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_AMV }, INT_MIN, INT_MAX, V|D, "bug"},
+#if FF_API_AC_VLC
+{"ac_vlc", "illegal VLC bug (autodetected per FOURCC)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_AC_VLC }, INT_MIN, INT_MAX, V|D, "bug"},
+#endif
+{"qpel_chroma", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_QPEL_CHROMA }, INT_MIN, INT_MAX, V|D, "bug"},
+{"std_qpel", "old standard qpel (autodetected per FOURCC/version)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_STD_QPEL }, INT_MIN, INT_MAX, V|D, "bug"},
+{"qpel_chroma2", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_QPEL_CHROMA2 }, INT_MIN, INT_MAX, V|D, "bug"},
+{"direct_blocksize", "direct-qpel-blocksize bug (autodetected per FOURCC/version)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_DIRECT_BLOCKSIZE }, INT_MIN, INT_MAX, V|D, "bug"},
+{"edge", "edge padding bug (autodetected per FOURCC/version)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_EDGE }, INT_MIN, INT_MAX, V|D, "bug"},
+{"hpel_chroma", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_HPEL_CHROMA }, INT_MIN, INT_MAX, V|D, "bug"},
+{"dc_clip", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_DC_CLIP }, INT_MIN, INT_MAX, V|D, "bug"},
+{"ms", "work around various bugs in Microsoft's broken decoders", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_MS }, INT_MIN, INT_MAX, V|D, "bug"},
+{"trunc", "truncated frames", 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_TRUNCATED}, INT_MIN, INT_MAX, V|D, "bug"},
+{"iedge", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_BUG_IEDGE }, INT_MIN, INT_MAX, V|D, "bug"},
+{"strict", "how strictly to follow the standards", OFFSET(strict_std_compliance), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|V|D|E, "strict"},
+{"very", "strictly conform to a older more strict version of the spec or reference software", 0, AV_OPT_TYPE_CONST, {.i64 = FF_COMPLIANCE_VERY_STRICT }, INT_MIN, INT_MAX, A|V|D|E, "strict"},
+{"strict", "strictly conform to all the things in the spec no matter what the consequences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_COMPLIANCE_STRICT }, INT_MIN, INT_MAX, A|V|D|E, "strict"},
+{"normal", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_COMPLIANCE_NORMAL }, INT_MIN, INT_MAX, A|V|D|E, "strict"},
+{"unofficial", "allow unofficial extensions", 0, AV_OPT_TYPE_CONST, {.i64 = FF_COMPLIANCE_UNOFFICIAL }, INT_MIN, INT_MAX, A|V|D|E, "strict"},
+{"experimental", "allow non-standardized experimental things", 0, AV_OPT_TYPE_CONST, {.i64 = FF_COMPLIANCE_EXPERIMENTAL }, INT_MIN, INT_MAX, A|V|D|E, "strict"},
+{"b_qoffset", "QP offset between P- and B-frames", OFFSET(b_quant_offset), AV_OPT_TYPE_FLOAT, {.dbl = 1.25 }, -FLT_MAX, FLT_MAX, V|E},
+{"err_detect", "set error detection flags", OFFSET(err_recognition), AV_OPT_TYPE_FLAGS, {.i64 = 0 }, INT_MIN, INT_MAX, A|V|D, "err_detect"},
+{"crccheck", "verify embedded CRCs", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_CRCCHECK }, INT_MIN, INT_MAX, A|V|D, "err_detect"},
+{"bitstream", "detect bitstream specification deviations", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_BITSTREAM }, INT_MIN, INT_MAX, A|V|D, "err_detect"},
+{"buffer", "detect improper bitstream length", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_BUFFER }, INT_MIN, INT_MAX, A|V|D, "err_detect"},
+{"explode", "abort decoding on minor error detection", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_EXPLODE }, INT_MIN, INT_MAX, A|V|D, "err_detect"},
+{"ignore_err", "ignore errors", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_IGNORE_ERR }, INT_MIN, INT_MAX, A|V|D, "err_detect"},
+{"careful", "consider things that violate the spec, are fast to check and have not been seen in the wild as errors", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_CAREFUL }, INT_MIN, INT_MAX, A|V|D, "err_detect"},
+{"compliant", "consider all spec non compliancies as errors", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_COMPLIANT }, INT_MIN, INT_MAX, A|V|D, "err_detect"},
+{"aggressive", "consider things that a sane encoder should not do as an error", 0, AV_OPT_TYPE_CONST, {.i64 = AV_EF_AGGRESSIVE }, INT_MIN, INT_MAX, A|V|D, "err_detect"},
+{"has_b_frames", NULL, OFFSET(has_b_frames), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX},
+{"block_align", NULL, OFFSET(block_align), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX},
+#if FF_API_PRIVATE_OPT
+{"mpeg_quant", "use MPEG quantizers instead of H.263", OFFSET(mpeg_quant), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+#endif
+#if FF_API_MPV_OPT
+{"qsquish", "deprecated, use encoder private options instead", OFFSET(rc_qsquish), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, 0, 99, V|E},
+{"rc_qmod_amp", "deprecated, use encoder private options instead", OFFSET(rc_qmod_amp), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, -FLT_MAX, FLT_MAX, V|E},
+{"rc_qmod_freq", "deprecated, use encoder private options instead", OFFSET(rc_qmod_freq), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+#endif
+{"rc_override_count", NULL, OFFSET(rc_override_count), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+#if FF_API_MPV_OPT
+{"rc_eq", "deprecated, use encoder private options instead", OFFSET(rc_eq), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, V|E},
+#endif
+{"maxrate", "maximum bitrate (in bits/s). Used for VBV together with bufsize.", OFFSET(rc_max_rate), AV_OPT_TYPE_INT64, {.i64 = DEFAULT }, 0, INT_MAX, V|A|E},
+{"minrate", "minimum bitrate (in bits/s). Most useful in setting up a CBR encode. It is of little use otherwise.",
+ OFFSET(rc_min_rate), AV_OPT_TYPE_INT64, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|A|E},
+{"bufsize", "set ratecontrol buffer size (in bits)", OFFSET(rc_buffer_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, A|V|E},
+#if FF_API_MPV_OPT
+{"rc_buf_aggressivity", "deprecated, use encoder private options instead", OFFSET(rc_buffer_aggressivity), AV_OPT_TYPE_FLOAT, {.dbl = 1.0 }, -FLT_MAX, FLT_MAX, V|E},
+#endif
+{"i_qfactor", "QP factor between P- and I-frames", OFFSET(i_quant_factor), AV_OPT_TYPE_FLOAT, {.dbl = -0.8 }, -FLT_MAX, FLT_MAX, V|E},
+{"i_qoffset", "QP offset between P- and I-frames", OFFSET(i_quant_offset), AV_OPT_TYPE_FLOAT, {.dbl = 0.0 }, -FLT_MAX, FLT_MAX, V|E},
+#if FF_API_MPV_OPT
+{"rc_init_cplx", "deprecated, use encoder private options instead", OFFSET(rc_initial_cplx), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, -FLT_MAX, FLT_MAX, V|E},
+#endif
+{"dct", "DCT algorithm", OFFSET(dct_algo), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, V|E, "dct"},
+{"auto", "autoselect a good one", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_AUTO }, INT_MIN, INT_MAX, V|E, "dct"},
+{"fastint", "fast integer", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_FASTINT }, INT_MIN, INT_MAX, V|E, "dct"},
+{"int", "accurate integer", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_INT }, INT_MIN, INT_MAX, V|E, "dct"},
+{"mmx", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_MMX }, INT_MIN, INT_MAX, V|E, "dct"},
+{"altivec", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_ALTIVEC }, INT_MIN, INT_MAX, V|E, "dct"},
+{"faan", "floating point AAN DCT", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DCT_FAAN }, INT_MIN, INT_MAX, V|E, "dct"},
+{"lumi_mask", "compresses bright areas stronger than medium ones", OFFSET(lumi_masking), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, V|E},
+{"tcplx_mask", "temporal complexity masking", OFFSET(temporal_cplx_masking), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, V|E},
+{"scplx_mask", "spatial complexity masking", OFFSET(spatial_cplx_masking), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, V|E},
+{"p_mask", "inter masking", OFFSET(p_masking), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, V|E},
+{"dark_mask", "compresses dark areas stronger than medium ones", OFFSET(dark_masking), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, -FLT_MAX, FLT_MAX, V|E},
+{"idct", "select IDCT implementation", OFFSET(idct_algo), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX, V|E|D, "idct"},
+{"auto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_AUTO }, INT_MIN, INT_MAX, V|E|D, "idct"},
+{"int", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_INT }, INT_MIN, INT_MAX, V|E|D, "idct"},
+{"simple", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLE }, INT_MIN, INT_MAX, V|E|D, "idct"},
+{"simplemmx", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEMMX }, INT_MIN, INT_MAX, V|E|D, "idct"},
+{"arm", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_ARM }, INT_MIN, INT_MAX, V|E|D, "idct"},
+{"altivec", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_ALTIVEC }, INT_MIN, INT_MAX, V|E|D, "idct"},
+#if FF_API_ARCH_SH4
+{"sh4", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SH4 }, INT_MIN, INT_MAX, V|E|D, "idct"},
+#endif
+{"simplearm", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEARM }, INT_MIN, INT_MAX, V|E|D, "idct"},
+{"simplearmv5te", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEARMV5TE }, INT_MIN, INT_MAX, V|E|D, "idct"},
+{"simplearmv6", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEARMV6 }, INT_MIN, INT_MAX, V|E|D, "idct"},
+{"simpleneon", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLENEON }, INT_MIN, INT_MAX, V|E|D, "idct"},
+#if FF_API_ARCH_ALPHA
+{"simplealpha", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEALPHA }, INT_MIN, INT_MAX, V|E|D, "idct"},
+#endif
+#if FF_API_UNUSED_MEMBERS
+{"ipp", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_IPP }, INT_MIN, INT_MAX, V|E|D, "idct"},
+#endif /* FF_API_UNUSED_MEMBERS */
+{"xvid", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_XVID }, INT_MIN, INT_MAX, V|E|D, "idct"},
+{"xvidmmx", "deprecated, for compatibility only", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_XVID }, INT_MIN, INT_MAX, V|E|D, "idct"},
+{"faani", "floating point AAN IDCT", 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_FAAN }, INT_MIN, INT_MAX, V|D|E, "idct"},
+{"simpleauto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_IDCT_SIMPLEAUTO }, INT_MIN, INT_MAX, V|E|D, "idct"},
+{"slice_count", NULL, OFFSET(slice_count), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+{"ec", "set error concealment strategy", OFFSET(error_concealment), AV_OPT_TYPE_FLAGS, {.i64 = 3 }, INT_MIN, INT_MAX, V|D, "ec"},
+{"guess_mvs", "iterative motion vector (MV) search (slow)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_EC_GUESS_MVS }, INT_MIN, INT_MAX, V|D, "ec"},
+{"deblock", "use strong deblock filter for damaged MBs", 0, AV_OPT_TYPE_CONST, {.i64 = FF_EC_DEBLOCK }, INT_MIN, INT_MAX, V|D, "ec"},
+{"favor_inter", "favor predicting from the previous frame", 0, AV_OPT_TYPE_CONST, {.i64 = FF_EC_FAVOR_INTER }, INT_MIN, INT_MAX, V|D, "ec"},
+{"bits_per_coded_sample", NULL, OFFSET(bits_per_coded_sample), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX},
+#if FF_API_PRIVATE_OPT
+{"pred", "prediction method", OFFSET(prediction_method), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "pred"},
+{"left", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PRED_LEFT }, INT_MIN, INT_MAX, V|E, "pred"},
+{"plane", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PRED_PLANE }, INT_MIN, INT_MAX, V|E, "pred"},
+{"median", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PRED_MEDIAN }, INT_MIN, INT_MAX, V|E, "pred"},
+#endif
+{"aspect", "sample aspect ratio", OFFSET(sample_aspect_ratio), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, 0, 10, V|E},
+{"sar", "sample aspect ratio", OFFSET(sample_aspect_ratio), AV_OPT_TYPE_RATIONAL, {.dbl = 0}, 0, 10, V|E},
+{"debug", "print specific debug info", OFFSET(debug), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT }, 0, INT_MAX, V|A|S|E|D, "debug"},
+{"pict", "picture info", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_PICT_INFO }, INT_MIN, INT_MAX, V|D, "debug"},
+{"rc", "rate control", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_RC }, INT_MIN, INT_MAX, V|E, "debug"},
+{"bitstream", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_BITSTREAM }, INT_MIN, INT_MAX, V|D, "debug"},
+{"mb_type", "macroblock (MB) type", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_MB_TYPE }, INT_MIN, INT_MAX, V|D, "debug"},
+{"qp", "per-block quantization parameter (QP)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_QP }, INT_MIN, INT_MAX, V|D, "debug"},
+#if FF_API_DEBUG_MV
+{"mv", "motion vector", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_MV }, INT_MIN, INT_MAX, V|D, "debug"},
+#endif
+{"dct_coeff", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_DCT_COEFF }, INT_MIN, INT_MAX, V|D, "debug"},
+{"green_metadata", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_GREEN_MD }, INT_MIN, INT_MAX, V|D, "debug"},
+{"skip", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_SKIP }, INT_MIN, INT_MAX, V|D, "debug"},
+{"startcode", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_STARTCODE }, INT_MIN, INT_MAX, V|D, "debug"},
+#if FF_API_UNUSED_MEMBERS
+{"pts", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_PTS }, INT_MIN, INT_MAX, V|D, "debug"},
+#endif /* FF_API_UNUSED_MEMBERS */
+{"er", "error recognition", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_ER }, INT_MIN, INT_MAX, V|D, "debug"},
+{"mmco", "memory management control operations (H.264)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_MMCO }, INT_MIN, INT_MAX, V|D, "debug"},
+{"bugs", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_BUGS }, INT_MIN, INT_MAX, V|D, "debug"},
+#if FF_API_DEBUG_MV
+{"vis_qp", "visualize quantization parameter (QP), lower QP are tinted greener", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_QP }, INT_MIN, INT_MAX, V|D, "debug"},
+{"vis_mb_type", "visualize block types", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_MB_TYPE }, INT_MIN, INT_MAX, V|D, "debug"},
+#endif
+{"buffers", "picture buffer allocations", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_BUFFERS }, INT_MIN, INT_MAX, V|D, "debug"},
+{"thread_ops", "threading operations", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_THREADS }, INT_MIN, INT_MAX, V|A|D, "debug"},
+{"nomc", "skip motion compensation", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_NOMC }, INT_MIN, INT_MAX, V|A|D, "debug"},
+#if FF_API_VISMV
+{"vismv", "visualize motion vectors (MVs) (deprecated)", OFFSET(debug_mv), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT }, 0, INT_MAX, V|D, "debug_mv"},
+{"pf", "forward predicted MVs of P-frames", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_MV_P_FOR }, INT_MIN, INT_MAX, V|D, "debug_mv"},
+{"bf", "forward predicted MVs of B-frames", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_MV_B_FOR }, INT_MIN, INT_MAX, V|D, "debug_mv"},
+{"bb", "backward predicted MVs of B-frames", 0, AV_OPT_TYPE_CONST, {.i64 = FF_DEBUG_VIS_MV_B_BACK }, INT_MIN, INT_MAX, V|D, "debug_mv"},
+#endif
+{"cmp", "full-pel ME compare function", OFFSET(me_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"subcmp", "sub-pel ME compare function", OFFSET(me_sub_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"mbcmp", "macroblock compare function", OFFSET(mb_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"ildctcmp", "interlaced DCT compare function", OFFSET(ildct_cmp), AV_OPT_TYPE_INT, {.i64 = FF_CMP_VSAD }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"dia_size", "diamond type & size for motion estimation", OFFSET(dia_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+{"last_pred", "amount of motion predictors from the previous frame", OFFSET(last_predictor_count), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+#if FF_API_PRIVATE_OPT
+{"preme", "pre motion estimation", OFFSET(pre_me), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+#endif
+{"precmp", "pre motion estimation compare function", OFFSET(me_pre_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"sad", "sum of absolute differences, fast", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_SAD }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"sse", "sum of squared errors", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_SSE }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"satd", "sum of absolute Hadamard transformed differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_SATD }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"dct", "sum of absolute DCT transformed differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_DCT }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"psnr", "sum of squared quantization errors (avoid, low quality)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_PSNR }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"bit", "number of bits needed for the block", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_BIT }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"rd", "rate distortion optimal, slow", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_RD }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"zero", "0", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_ZERO }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"vsad", "sum of absolute vertical differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_VSAD }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"vsse", "sum of squared vertical differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_VSSE }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"nsse", "noise preserving sum of squared differences", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_NSSE }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+#if CONFIG_SNOW_ENCODER
+{"w53", "5/3 wavelet, only used in snow", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_W53 }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"w97", "9/7 wavelet, only used in snow", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_W97 }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+#endif
+{"dctmax", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_DCTMAX }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"chroma", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_CHROMA }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"msad", "sum of absolute differences, median predicted", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CMP_MEDIAN_SAD }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+{"pre_dia_size", "diamond type & size for motion estimation pre-pass", OFFSET(pre_dia_size), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+{"subq", "sub-pel motion estimation quality", OFFSET(me_subpel_quality), AV_OPT_TYPE_INT, {.i64 = 8 }, INT_MIN, INT_MAX, V|E},
+#if FF_API_AFD
+{"dtg_active_format", NULL, OFFSET(dtg_active_format), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+#endif
+{"me_range", "limit motion vectors range (1023 for DivX player)", OFFSET(me_range), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+#if FF_API_QUANT_BIAS
+{"ibias", "intra quant bias", OFFSET(intra_quant_bias), AV_OPT_TYPE_INT, {.i64 = FF_DEFAULT_QUANT_BIAS }, INT_MIN, INT_MAX, V|E},
+{"pbias", "inter quant bias", OFFSET(inter_quant_bias), AV_OPT_TYPE_INT, {.i64 = FF_DEFAULT_QUANT_BIAS }, INT_MIN, INT_MAX, V|E},
+#endif
+{"global_quality", NULL, OFFSET(global_quality), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|A|E},
+#if FF_API_CODER_TYPE
+{"coder", NULL, OFFSET(coder_type), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, "coder"},
+{"vlc", "variable length coder / Huffman coder", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CODER_TYPE_VLC }, INT_MIN, INT_MAX, V|E, "coder"},
+{"ac", "arithmetic coder", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CODER_TYPE_AC }, INT_MIN, INT_MAX, V|E, "coder"},
+{"raw", "raw (no encoding)", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CODER_TYPE_RAW }, INT_MIN, INT_MAX, V|E, "coder"},
+{"rle", "run-length coder", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CODER_TYPE_RLE }, INT_MIN, INT_MAX, V|E, "coder"},
+#if FF_API_UNUSED_MEMBERS
+{"deflate", "deflate-based coder", 0, AV_OPT_TYPE_CONST, {.i64 = FF_CODER_TYPE_DEFLATE }, INT_MIN, INT_MAX, V|E, "coder"},
+#endif /* FF_API_UNUSED_MEMBERS */
+#endif /* FF_API_CODER_TYPE */
+#if FF_API_PRIVATE_OPT
+{"context", "context model", OFFSET(context_model), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+#endif
+{"slice_flags", NULL, OFFSET(slice_flags), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+#if FF_API_XVMC
+{"xvmc_acceleration", NULL, OFFSET(xvmc_acceleration), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+#endif /* FF_API_XVMC */
+{"mbd", "macroblock decision algorithm (high quality mode)", OFFSET(mb_decision), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, 2, V|E, "mbd"},
+{"simple", "use mbcmp", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MB_DECISION_SIMPLE }, INT_MIN, INT_MAX, V|E, "mbd"},
+{"bits", "use fewest bits", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MB_DECISION_BITS }, INT_MIN, INT_MAX, V|E, "mbd"},
+{"rd", "use best rate distortion", 0, AV_OPT_TYPE_CONST, {.i64 = FF_MB_DECISION_RD }, INT_MIN, INT_MAX, V|E, "mbd"},
+#if FF_API_STREAM_CODEC_TAG
+{"stream_codec_tag", NULL, OFFSET(stream_codec_tag), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX},
+#endif
+#if FF_API_PRIVATE_OPT
+{"sc_threshold", "scene change threshold", OFFSET(scenechange_threshold), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+#endif
+#if FF_API_MPV_OPT
+{"lmin", "deprecated, use encoder private options instead", OFFSET(lmin), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, V|E},
+{"lmax", "deprecated, use encoder private options instead", OFFSET(lmax), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, V|E},
+#endif
+#if FF_API_PRIVATE_OPT
+{"nr", "noise reduction", OFFSET(noise_reduction), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+#endif
+{"rc_init_occupancy", "number of bits which should be loaded into the rc buffer before decoding starts", OFFSET(rc_initial_buffer_occupancy), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+{"flags2", NULL, OFFSET(flags2), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT}, 0, UINT_MAX, V|A|E|D, "flags2"},
+#if FF_API_ERROR_RATE
+{"error", NULL, OFFSET(error_rate), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+#endif
+{"threads", "set the number of threads", OFFSET(thread_count), AV_OPT_TYPE_INT, {.i64 = 1 }, 0, INT_MAX, V|A|E|D, "threads"},
+{"auto", "autodetect a suitable number of threads to use", 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, INT_MIN, INT_MAX, V|E|D, "threads"},
+#if FF_API_MPV_OPT
+{"me_threshold", "motion estimation threshold", OFFSET(me_threshold), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+{"mb_threshold", "macroblock threshold", OFFSET(mb_threshold), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+#endif
+{"dc", "intra_dc_precision", OFFSET(intra_dc_precision), AV_OPT_TYPE_INT, {.i64 = 0 }, -8, 16, V|E},
+{"nssew", "nsse weight", OFFSET(nsse_weight), AV_OPT_TYPE_INT, {.i64 = 8 }, INT_MIN, INT_MAX, V|E},
+{"skip_top", "number of macroblock rows at the top which are skipped", OFFSET(skip_top), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|D},
+{"skip_bottom", "number of macroblock rows at the bottom which are skipped", OFFSET(skip_bottom), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|D},
+{"profile", NULL, OFFSET(profile), AV_OPT_TYPE_INT, {.i64 = FF_PROFILE_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "profile"},
+{"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "profile"},
+{"aac_main", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_MAIN }, INT_MIN, INT_MAX, A|E, "profile"},
+{"aac_low", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_LOW }, INT_MIN, INT_MAX, A|E, "profile"},
+{"aac_ssr", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_SSR }, INT_MIN, INT_MAX, A|E, "profile"},
+{"aac_ltp", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_LTP }, INT_MIN, INT_MAX, A|E, "profile"},
+{"aac_he", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_HE }, INT_MIN, INT_MAX, A|E, "profile"},
+{"aac_he_v2", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_HE_V2 }, INT_MIN, INT_MAX, A|E, "profile"},
+{"aac_ld", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_LD }, INT_MIN, INT_MAX, A|E, "profile"},
+{"aac_eld", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_AAC_ELD }, INT_MIN, INT_MAX, A|E, "profile"},
+{"mpeg2_aac_low", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_MPEG2_AAC_LOW }, INT_MIN, INT_MAX, A|E, "profile"},
+{"mpeg2_aac_he", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_MPEG2_AAC_HE }, INT_MIN, INT_MAX, A|E, "profile"},
+{"dts", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_DTS }, INT_MIN, INT_MAX, A|E, "profile"},
+{"dts_es", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_DTS_ES }, INT_MIN, INT_MAX, A|E, "profile"},
+{"dts_96_24", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_DTS_96_24 }, INT_MIN, INT_MAX, A|E, "profile"},
+{"dts_hd_hra", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_DTS_HD_HRA }, INT_MIN, INT_MAX, A|E, "profile"},
+{"dts_hd_ma", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_DTS_HD_MA }, INT_MIN, INT_MAX, A|E, "profile"},
+{"mpeg4_sp", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_MPEG4_SIMPLE }, INT_MIN, INT_MAX, V|E, "profile"},
+{"mpeg4_core", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_MPEG4_CORE }, INT_MIN, INT_MAX, V|E, "profile"},
+{"mpeg4_main", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_MPEG4_MAIN }, INT_MIN, INT_MAX, V|E, "profile"},
+{"mpeg4_asp", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_MPEG4_ADVANCED_SIMPLE }, INT_MIN, INT_MAX, V|E, "profile"},
+{"main10", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_PROFILE_HEVC_MAIN_10 }, INT_MIN, INT_MAX, V|E, "profile"},
+{"level", NULL, OFFSET(level), AV_OPT_TYPE_INT, {.i64 = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "level"},
+{"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, "level"},
+{"lowres", "decode at 1= 1/2, 2=1/4, 3=1/8 resolutions", OFFSET(lowres), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, V|A|D},
+#if FF_API_PRIVATE_OPT
+{"skip_threshold", "frame skip threshold", OFFSET(frame_skip_threshold), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+{"skip_factor", "frame skip factor", OFFSET(frame_skip_factor), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+{"skip_exp", "frame skip exponent", OFFSET(frame_skip_exp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+{"skipcmp", "frame skip compare function", OFFSET(frame_skip_cmp), AV_OPT_TYPE_INT, {.i64 = FF_CMP_DCTMAX }, INT_MIN, INT_MAX, V|E, "cmp_func"},
+#endif
+#if FF_API_MPV_OPT
+{"border_mask", "deprecated, use encoder private options instead", OFFSET(border_masking), AV_OPT_TYPE_FLOAT, {.dbl = DEFAULT }, -FLT_MAX, FLT_MAX, V|E},
+#endif
+{"mblmin", "minimum macroblock Lagrange factor (VBR)", OFFSET(mb_lmin), AV_OPT_TYPE_INT, {.i64 = FF_QP2LAMBDA * 2 }, 1, FF_LAMBDA_MAX, V|E},
+{"mblmax", "maximum macroblock Lagrange factor (VBR)", OFFSET(mb_lmax), AV_OPT_TYPE_INT, {.i64 = FF_QP2LAMBDA * 31 }, 1, FF_LAMBDA_MAX, V|E},
+#if FF_API_PRIVATE_OPT
+{"mepc", "motion estimation bitrate penalty compensation (1.0 = 256)", OFFSET(me_penalty_compensation), AV_OPT_TYPE_INT, {.i64 = 256 }, INT_MIN, INT_MAX, V|E},
+#endif
+{"skip_loop_filter", "skip loop filtering process for the selected frames", OFFSET(skip_loop_filter), AV_OPT_TYPE_INT, {.i64 = AVDISCARD_DEFAULT }, INT_MIN, INT_MAX, V|D, "avdiscard"},
+{"skip_idct" , "skip IDCT/dequantization for the selected frames", OFFSET(skip_idct), AV_OPT_TYPE_INT, {.i64 = AVDISCARD_DEFAULT }, INT_MIN, INT_MAX, V|D, "avdiscard"},
+{"skip_frame" , "skip decoding for the selected frames", OFFSET(skip_frame), AV_OPT_TYPE_INT, {.i64 = AVDISCARD_DEFAULT }, INT_MIN, INT_MAX, V|D, "avdiscard"},
+{"none" , "discard no frame", 0, AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_NONE }, INT_MIN, INT_MAX, V|D, "avdiscard"},
+{"default" , "discard useless frames", 0, AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_DEFAULT }, INT_MIN, INT_MAX, V|D, "avdiscard"},
+{"noref" , "discard all non-reference frames", 0, AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_NONREF }, INT_MIN, INT_MAX, V|D, "avdiscard"},
+{"bidir" , "discard all bidirectional frames", 0, AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_BIDIR }, INT_MIN, INT_MAX, V|D, "avdiscard"},
+{"nokey" , "discard all frames except keyframes", 0, AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_NONKEY }, INT_MIN, INT_MAX, V|D, "avdiscard"},
+{"nointra" , "discard all frames except I frames", 0, AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_NONINTRA}, INT_MIN, INT_MAX, V|D, "avdiscard"},
+{"all" , "discard all frames", 0, AV_OPT_TYPE_CONST, {.i64 = AVDISCARD_ALL }, INT_MIN, INT_MAX, V|D, "avdiscard"},
+{"bidir_refine", "refine the two motion vectors used in bidirectional macroblocks", OFFSET(bidir_refine), AV_OPT_TYPE_INT, {.i64 = 1 }, 0, 4, V|E},
+#if FF_API_PRIVATE_OPT
+{"brd_scale", "downscale frames for dynamic B-frame decision", OFFSET(brd_scale), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, 10, V|E},
+#endif
+{"keyint_min", "minimum interval between IDR-frames", OFFSET(keyint_min), AV_OPT_TYPE_INT, {.i64 = 25 }, INT_MIN, INT_MAX, V|E},
+{"refs", "reference frames to consider for motion compensation", OFFSET(refs), AV_OPT_TYPE_INT, {.i64 = 1 }, INT_MIN, INT_MAX, V|E},
+#if FF_API_PRIVATE_OPT
+{"chromaoffset", "chroma QP offset from luma", OFFSET(chromaoffset), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E},
+#endif
+{"trellis", "rate-distortion optimal quantization", OFFSET(trellis), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|A|E},
+#if FF_API_UNUSED_MEMBERS
+{"sc_factor", "multiplied by qscale for each frame and added to scene_change_score", OFFSET(scenechange_factor), AV_OPT_TYPE_INT, {.i64 = 6 }, 0, INT_MAX, V|E},
+#endif /* FF_API_UNUSED_MEMBERS */
+{"mv0_threshold", NULL, OFFSET(mv0_threshold), AV_OPT_TYPE_INT, {.i64 = 256 }, 0, INT_MAX, V|E},
+#if FF_API_PRIVATE_OPT
+{"b_sensitivity", "adjust sensitivity of b_frame_strategy 1", OFFSET(b_sensitivity), AV_OPT_TYPE_INT, {.i64 = 40 }, 1, INT_MAX, V|E},
+#endif
+{"compression_level", NULL, OFFSET(compression_level), AV_OPT_TYPE_INT, {.i64 = FF_COMPRESSION_DEFAULT }, INT_MIN, INT_MAX, V|A|E},
+#if FF_API_PRIVATE_OPT
+{"min_prediction_order", NULL, OFFSET(min_prediction_order), AV_OPT_TYPE_INT, {.i64 = -1 }, INT_MIN, INT_MAX, A|E},
+{"max_prediction_order", NULL, OFFSET(max_prediction_order), AV_OPT_TYPE_INT, {.i64 = -1 }, INT_MIN, INT_MAX, A|E},
+{"timecode_frame_start", "GOP timecode frame start number, in non-drop-frame format", OFFSET(timecode_frame_start), AV_OPT_TYPE_INT64, {.i64 = -1 }, -1, INT64_MAX, V|E},
+#endif
+{"bits_per_raw_sample", NULL, OFFSET(bits_per_raw_sample), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, 0, INT_MAX},
+{"channel_layout", NULL, OFFSET(channel_layout), AV_OPT_TYPE_UINT64, {.i64 = DEFAULT }, 0, UINT64_MAX, A|E|D, "channel_layout"},
+{"request_channel_layout", NULL, OFFSET(request_channel_layout), AV_OPT_TYPE_UINT64, {.i64 = DEFAULT }, 0, UINT64_MAX, A|D, "request_channel_layout"},
+{"rc_max_vbv_use", NULL, OFFSET(rc_max_available_vbv_use), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, 0.0, FLT_MAX, V|E},
+{"rc_min_vbv_use", NULL, OFFSET(rc_min_vbv_overflow_use), AV_OPT_TYPE_FLOAT, {.dbl = 3 }, 0.0, FLT_MAX, V|E},
+{"ticks_per_frame", NULL, OFFSET(ticks_per_frame), AV_OPT_TYPE_INT, {.i64 = 1 }, 1, INT_MAX, A|V|E|D},
+{"color_primaries", "color primaries", OFFSET(color_primaries), AV_OPT_TYPE_INT, {.i64 = AVCOL_PRI_UNSPECIFIED }, 1, INT_MAX, V|E|D, "color_primaries_type"},
+{"bt709", "BT.709", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_PRI_BT709 }, INT_MIN, INT_MAX, V|E|D, "color_primaries_type"},
+{"unknown", "Unspecified", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_PRI_UNSPECIFIED }, INT_MIN, INT_MAX, V|E|D, "color_primaries_type"},
+{"bt470m", "BT.470 M", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_PRI_BT470M }, INT_MIN, INT_MAX, V|E|D, "color_primaries_type"},
+{"bt470bg", "BT.470 BG", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_PRI_BT470BG }, INT_MIN, INT_MAX, V|E|D, "color_primaries_type"},
+{"smpte170m", "SMPTE 170 M", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_PRI_SMPTE170M }, INT_MIN, INT_MAX, V|E|D, "color_primaries_type"},
+{"smpte240m", "SMPTE 240 M", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_PRI_SMPTE240M }, INT_MIN, INT_MAX, V|E|D, "color_primaries_type"},
+{"film", "Film", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_PRI_FILM }, INT_MIN, INT_MAX, V|E|D, "color_primaries_type"},
+{"bt2020", "BT.2020", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_PRI_BT2020 }, INT_MIN, INT_MAX, V|E|D, "color_primaries_type"},
+{"smpte428", "SMPTE 428-1", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_PRI_SMPTE428 }, INT_MIN, INT_MAX, V|E|D, "color_primaries_type"},
+{"smpte428_1", "SMPTE 428-1", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_PRI_SMPTE428 }, INT_MIN, INT_MAX, V|E|D, "color_primaries_type"},
+{"smpte431", "SMPTE 431-2", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_PRI_SMPTE431 }, INT_MIN, INT_MAX, V|E|D, "color_primaries_type"},
+{"smpte432", "SMPTE 422-1", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_PRI_SMPTE432 }, INT_MIN, INT_MAX, V|E|D, "color_primaries_type"},
+{"jedec-p22", "JEDEC P22", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_PRI_JEDEC_P22 }, INT_MIN, INT_MAX, V|E|D, "color_primaries_type"},
+{"unspecified", "Unspecified", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_PRI_UNSPECIFIED }, INT_MIN, INT_MAX, V|E|D, "color_primaries_type"},
+{"color_trc", "color transfer characteristics", OFFSET(color_trc), AV_OPT_TYPE_INT, {.i64 = AVCOL_TRC_UNSPECIFIED }, 1, INT_MAX, V|E|D, "color_trc_type"},
+{"bt709", "BT.709", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_BT709 }, INT_MIN, INT_MAX, V|E|D, "color_trc_type"},
+{"unknown", "Unspecified", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_UNSPECIFIED }, INT_MIN, INT_MAX, V|E|D, "color_trc_type"},
+{"gamma22", "BT.470 M", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_GAMMA22 }, INT_MIN, INT_MAX, V|E|D, "color_trc_type"},
+{"gamma28", "BT.470 BG", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_GAMMA28 }, INT_MIN, INT_MAX, V|E|D, "color_trc_type"},
+{"smpte170m", "SMPTE 170 M", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_SMPTE170M }, INT_MIN, INT_MAX, V|E|D, "color_trc_type"},
+{"smpte240m", "SMPTE 240 M", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_SMPTE240M }, INT_MIN, INT_MAX, V|E|D, "color_trc_type"},
+{"linear", "Linear", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_LINEAR }, INT_MIN, INT_MAX, V|E|D, "color_trc_type"},
+{"log100", "Log", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_LOG }, INT_MIN, INT_MAX, V|E|D, "color_trc_type"},
+{"log316", "Log square root", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_LOG_SQRT }, INT_MIN, INT_MAX, V|E|D, "color_trc_type"},
+{"iec61966-2-4", "IEC 61966-2-4", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_IEC61966_2_4 }, INT_MIN, INT_MAX, V|E|D, "color_trc_type"},
+{"bt1361e", "BT.1361", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_BT1361_ECG }, INT_MIN, INT_MAX, V|E|D, "color_trc_type"},
+{"iec61966-2-1", "IEC 61966-2-1", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_IEC61966_2_1 }, INT_MIN, INT_MAX, V|E|D, "color_trc_type"},
+{"bt2020-10", "BT.2020 - 10 bit", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_BT2020_10 }, INT_MIN, INT_MAX, V|E|D, "color_trc_type"},
+{"bt2020-12", "BT.2020 - 12 bit", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_BT2020_12 }, INT_MIN, INT_MAX, V|E|D, "color_trc_type"},
+{"smpte2084", "SMPTE 2084", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_SMPTE2084 }, INT_MIN, INT_MAX, V|E|D, "color_trc_type"},
+{"smpte428", "SMPTE 428-1", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_SMPTE428 }, INT_MIN, INT_MAX, V|E|D, "color_trc_type"},
+{"arib-std-b67", "ARIB STD-B67", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_ARIB_STD_B67 }, INT_MIN, INT_MAX, V|E|D, "color_trc_type"},
+{"unspecified", "Unspecified", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_UNSPECIFIED }, INT_MIN, INT_MAX, V|E|D, "color_trc_type"},
+{"log", "Log", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_LOG }, INT_MIN, INT_MAX, V|E|D, "color_trc_type"},
+{"log_sqrt", "Log square root", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_LOG_SQRT }, INT_MIN, INT_MAX, V|E|D, "color_trc_type"},
+{"iec61966_2_4", "IEC 61966-2-4", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_IEC61966_2_4 }, INT_MIN, INT_MAX, V|E|D, "color_trc_type"},
+{"bt1361", "BT.1361", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_BT1361_ECG }, INT_MIN, INT_MAX, V|E|D, "color_trc_type"},
+{"iec61966_2_1", "IEC 61966-2-1", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_IEC61966_2_1 }, INT_MIN, INT_MAX, V|E|D, "color_trc_type"},
+{"bt2020_10bit", "BT.2020 - 10 bit", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_BT2020_10 }, INT_MIN, INT_MAX, V|E|D, "color_trc_type"},
+{"bt2020_12bit", "BT.2020 - 12 bit", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_BT2020_12 }, INT_MIN, INT_MAX, V|E|D, "color_trc_type"},
+{"smpte428_1", "SMPTE 428-1", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_TRC_SMPTE428 }, INT_MIN, INT_MAX, V|E|D, "color_trc_type"},
+{"colorspace", "color space", OFFSET(colorspace), AV_OPT_TYPE_INT, {.i64 = AVCOL_SPC_UNSPECIFIED }, 0, INT_MAX, V|E|D, "colorspace_type"},
+{"rgb", "RGB", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_SPC_RGB }, INT_MIN, INT_MAX, V|E|D, "colorspace_type"},
+{"bt709", "BT.709", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_SPC_BT709 }, INT_MIN, INT_MAX, V|E|D, "colorspace_type"},
+{"unknown", "Unspecified", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_SPC_UNSPECIFIED }, INT_MIN, INT_MAX, V|E|D, "colorspace_type"},
+{"fcc", "FCC", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_SPC_FCC }, INT_MIN, INT_MAX, V|E|D, "colorspace_type"},
+{"bt470bg", "BT.470 BG", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_SPC_BT470BG }, INT_MIN, INT_MAX, V|E|D, "colorspace_type"},
+{"smpte170m", "SMPTE 170 M", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_SPC_SMPTE170M }, INT_MIN, INT_MAX, V|E|D, "colorspace_type"},
+{"smpte240m", "SMPTE 240 M", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_SPC_SMPTE240M }, INT_MIN, INT_MAX, V|E|D, "colorspace_type"},
+{"ycgco", "YCGCO", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_SPC_YCGCO }, INT_MIN, INT_MAX, V|E|D, "colorspace_type"},
+{"bt2020nc", "BT.2020 NCL", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_SPC_BT2020_NCL }, INT_MIN, INT_MAX, V|E|D, "colorspace_type"},
+{"bt2020c", "BT.2020 CL", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_SPC_BT2020_CL }, INT_MIN, INT_MAX, V|E|D, "colorspace_type"},
+{"smpte2085", "SMPTE 2085", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_SPC_SMPTE2085 }, INT_MIN, INT_MAX, V|E|D, "colorspace_type"},
+{"unspecified", "Unspecified", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_SPC_UNSPECIFIED }, INT_MIN, INT_MAX, V|E|D, "colorspace_type"},
+{"ycocg", "YCGCO", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_SPC_YCGCO }, INT_MIN, INT_MAX, V|E|D, "colorspace_type"},
+{"bt2020_ncl", "BT.2020 NCL", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_SPC_BT2020_NCL }, INT_MIN, INT_MAX, V|E|D, "colorspace_type"},
+{"bt2020_cl", "BT.2020 CL", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_SPC_BT2020_CL }, INT_MIN, INT_MAX, V|E|D, "colorspace_type"},
+{"color_range", "color range", OFFSET(color_range), AV_OPT_TYPE_INT, {.i64 = AVCOL_RANGE_UNSPECIFIED }, 0, INT_MAX, V|E|D, "color_range_type"},
+{"unknown", "Unspecified", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_RANGE_UNSPECIFIED }, INT_MIN, INT_MAX, V|E|D, "color_range_type"},
+{"tv", "MPEG (219*2^(n-8))", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_RANGE_MPEG }, INT_MIN, INT_MAX, V|E|D, "color_range_type"},
+{"pc", "JPEG (2^n-1)", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_RANGE_JPEG }, INT_MIN, INT_MAX, V|E|D, "color_range_type"},
+{"unspecified", "Unspecified", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_RANGE_UNSPECIFIED }, INT_MIN, INT_MAX, V|E|D, "color_range_type"},
+{"mpeg", "MPEG (219*2^(n-8))", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_RANGE_MPEG }, INT_MIN, INT_MAX, V|E|D, "color_range_type"},
+{"jpeg", "JPEG (2^n-1)", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_RANGE_JPEG }, INT_MIN, INT_MAX, V|E|D, "color_range_type"},
+{"chroma_sample_location", "chroma sample location", OFFSET(chroma_sample_location), AV_OPT_TYPE_INT, {.i64 = AVCHROMA_LOC_UNSPECIFIED }, 0, INT_MAX, V|E|D, "chroma_sample_location_type"},
+{"unknown", "Unspecified", 0, AV_OPT_TYPE_CONST, {.i64 = AVCHROMA_LOC_UNSPECIFIED }, INT_MIN, INT_MAX, V|E|D, "chroma_sample_location_type"},
+{"left", "Left", 0, AV_OPT_TYPE_CONST, {.i64 = AVCHROMA_LOC_LEFT }, INT_MIN, INT_MAX, V|E|D, "chroma_sample_location_type"},
+{"center", "Center", 0, AV_OPT_TYPE_CONST, {.i64 = AVCHROMA_LOC_CENTER }, INT_MIN, INT_MAX, V|E|D, "chroma_sample_location_type"},
+{"topleft", "Top-left", 0, AV_OPT_TYPE_CONST, {.i64 = AVCHROMA_LOC_TOPLEFT }, INT_MIN, INT_MAX, V|E|D, "chroma_sample_location_type"},
+{"top", "Top", 0, AV_OPT_TYPE_CONST, {.i64 = AVCHROMA_LOC_TOP }, INT_MIN, INT_MAX, V|E|D, "chroma_sample_location_type"},
+{"bottomleft", "Bottom-left", 0, AV_OPT_TYPE_CONST, {.i64 = AVCHROMA_LOC_BOTTOMLEFT }, INT_MIN, INT_MAX, V|E|D, "chroma_sample_location_type"},
+{"bottom", "Bottom", 0, AV_OPT_TYPE_CONST, {.i64 = AVCHROMA_LOC_BOTTOM }, INT_MIN, INT_MAX, V|E|D, "chroma_sample_location_type"},
+{"unspecified", "Unspecified", 0, AV_OPT_TYPE_CONST, {.i64 = AVCHROMA_LOC_UNSPECIFIED }, INT_MIN, INT_MAX, V|E|D, "chroma_sample_location_type"},
+{"log_level_offset", "set the log level offset", OFFSET(log_level_offset), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX },
+{"slices", "set the number of slices, used in parallelized encoding", OFFSET(slices), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, V|E},
+{"thread_type", "select multithreading type", OFFSET(thread_type), AV_OPT_TYPE_FLAGS, {.i64 = FF_THREAD_SLICE|FF_THREAD_FRAME }, 0, INT_MAX, V|A|E|D, "thread_type"},
+{"slice", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_THREAD_SLICE }, INT_MIN, INT_MAX, V|E|D, "thread_type"},
+{"frame", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_THREAD_FRAME }, INT_MIN, INT_MAX, V|E|D, "thread_type"},
+{"audio_service_type", "audio service type", OFFSET(audio_service_type), AV_OPT_TYPE_INT, {.i64 = AV_AUDIO_SERVICE_TYPE_MAIN }, 0, AV_AUDIO_SERVICE_TYPE_NB-1, A|E, "audio_service_type"},
+{"ma", "Main Audio Service", 0, AV_OPT_TYPE_CONST, {.i64 = AV_AUDIO_SERVICE_TYPE_MAIN }, INT_MIN, INT_MAX, A|E, "audio_service_type"},
+{"ef", "Effects", 0, AV_OPT_TYPE_CONST, {.i64 = AV_AUDIO_SERVICE_TYPE_EFFECTS }, INT_MIN, INT_MAX, A|E, "audio_service_type"},
+{"vi", "Visually Impaired", 0, AV_OPT_TYPE_CONST, {.i64 = AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED }, INT_MIN, INT_MAX, A|E, "audio_service_type"},
+{"hi", "Hearing Impaired", 0, AV_OPT_TYPE_CONST, {.i64 = AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED }, INT_MIN, INT_MAX, A|E, "audio_service_type"},
+{"di", "Dialogue", 0, AV_OPT_TYPE_CONST, {.i64 = AV_AUDIO_SERVICE_TYPE_DIALOGUE }, INT_MIN, INT_MAX, A|E, "audio_service_type"},
+{"co", "Commentary", 0, AV_OPT_TYPE_CONST, {.i64 = AV_AUDIO_SERVICE_TYPE_COMMENTARY }, INT_MIN, INT_MAX, A|E, "audio_service_type"},
+{"em", "Emergency", 0, AV_OPT_TYPE_CONST, {.i64 = AV_AUDIO_SERVICE_TYPE_EMERGENCY }, INT_MIN, INT_MAX, A|E, "audio_service_type"},
+{"vo", "Voice Over", 0, AV_OPT_TYPE_CONST, {.i64 = AV_AUDIO_SERVICE_TYPE_VOICE_OVER }, INT_MIN, INT_MAX, A|E, "audio_service_type"},
+{"ka", "Karaoke", 0, AV_OPT_TYPE_CONST, {.i64 = AV_AUDIO_SERVICE_TYPE_KARAOKE }, INT_MIN, INT_MAX, A|E, "audio_service_type"},
+{"request_sample_fmt", "sample format audio decoders should prefer", OFFSET(request_sample_fmt), AV_OPT_TYPE_SAMPLE_FMT, {.i64=AV_SAMPLE_FMT_NONE}, -1, INT_MAX, A|D, "request_sample_fmt"},
+{"pkt_timebase", NULL, OFFSET(pkt_timebase), AV_OPT_TYPE_RATIONAL, {.dbl = 0 }, 0, INT_MAX, 0},
+{"sub_charenc", "set input text subtitles character encoding", OFFSET(sub_charenc), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, S|D},
+{"sub_charenc_mode", "set input text subtitles character encoding mode", OFFSET(sub_charenc_mode), AV_OPT_TYPE_FLAGS, {.i64 = FF_SUB_CHARENC_MODE_AUTOMATIC}, -1, INT_MAX, S|D, "sub_charenc_mode"},
+{"do_nothing", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_CHARENC_MODE_DO_NOTHING}, INT_MIN, INT_MAX, S|D, "sub_charenc_mode"},
+{"auto", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_CHARENC_MODE_AUTOMATIC}, INT_MIN, INT_MAX, S|D, "sub_charenc_mode"},
+{"pre_decoder", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_CHARENC_MODE_PRE_DECODER}, INT_MIN, INT_MAX, S|D, "sub_charenc_mode"},
+#if FF_API_ASS_TIMING
+{"sub_text_format", "set decoded text subtitle format", OFFSET(sub_text_format), AV_OPT_TYPE_INT, {.i64 = FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS}, 0, 1, S|D, "sub_text_format"},
+#else
+{"sub_text_format", "set decoded text subtitle format", OFFSET(sub_text_format), AV_OPT_TYPE_INT, {.i64 = FF_SUB_TEXT_FMT_ASS}, 0, 1, S|D, "sub_text_format"},
+#endif
+{"ass", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_TEXT_FMT_ASS}, INT_MIN, INT_MAX, S|D, "sub_text_format"},
+#if FF_API_ASS_TIMING
+{"ass_with_timings", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS}, INT_MIN, INT_MAX, S|D, "sub_text_format"},
+#endif
+{"refcounted_frames", NULL, OFFSET(refcounted_frames), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, A|V|D },
+#if FF_API_SIDEDATA_ONLY_PKT
+{"side_data_only_packets", NULL, OFFSET(side_data_only_packets), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, A|V|E },
+#endif
+{"apply_cropping", NULL, OFFSET(apply_cropping), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, V | D },
+{"skip_alpha", "Skip processing alpha", OFFSET(skip_alpha), AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1, V|D },
+{"field_order", "Field order", OFFSET(field_order), AV_OPT_TYPE_INT, {.i64 = AV_FIELD_UNKNOWN }, 0, 5, V|D|E, "field_order" },
+{"progressive", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AV_FIELD_PROGRESSIVE }, 0, 0, V|D|E, "field_order" },
+{"tt", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AV_FIELD_TT }, 0, 0, V|D|E, "field_order" },
+{"bb", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AV_FIELD_BB }, 0, 0, V|D|E, "field_order" },
+{"tb", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AV_FIELD_TB }, 0, 0, V|D|E, "field_order" },
+{"bt", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AV_FIELD_BT }, 0, 0, V|D|E, "field_order" },
+{"dump_separator", "set information dump field separator", OFFSET(dump_separator), AV_OPT_TYPE_STRING, {.str = NULL}, CHAR_MIN, CHAR_MAX, A|V|S|D|E},
+{"codec_whitelist", "List of decoders that are allowed to be used", OFFSET(codec_whitelist), AV_OPT_TYPE_STRING, { .str = NULL }, CHAR_MIN, CHAR_MAX, A|V|S|D },
+{"pixel_format", "set pixel format", OFFSET(pix_fmt), AV_OPT_TYPE_PIXEL_FMT, {.i64=AV_PIX_FMT_NONE}, -1, INT_MAX, 0 },
+{"video_size", "set video size", OFFSET(width), AV_OPT_TYPE_IMAGE_SIZE, {.str=NULL}, 0, INT_MAX, 0 },
+{"max_pixels", "Maximum number of pixels", OFFSET(max_pixels), AV_OPT_TYPE_INT64, {.i64 = INT_MAX }, 0, INT_MAX, A|V|S|D|E },
+{"hwaccel_flags", NULL, OFFSET(hwaccel_flags), AV_OPT_TYPE_FLAGS, {.i64 = AV_HWACCEL_FLAG_IGNORE_LEVEL }, 0, UINT_MAX, V|D, "hwaccel_flags"},
+{"ignore_level", "ignore level even if the codec level used is unknown or higher than the maximum supported level reported by the hardware driver", 0, AV_OPT_TYPE_CONST, { .i64 = AV_HWACCEL_FLAG_IGNORE_LEVEL }, INT_MIN, INT_MAX, V | D, "hwaccel_flags" },
+{"allow_high_depth", "allow to output YUV pixel formats with a different chroma sampling than 4:2:0 and/or other than 8 bits per component", 0, AV_OPT_TYPE_CONST, {.i64 = AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH }, INT_MIN, INT_MAX, V | D, "hwaccel_flags"},
+{"allow_profile_mismatch", "attempt to decode anyway if HW accelerated decoder's supported profiles do not exactly match the stream", 0, AV_OPT_TYPE_CONST, {.i64 = AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH }, INT_MIN, INT_MAX, V | D, "hwaccel_flags"},
+{NULL},
+};
+
+#undef A
+#undef V
+#undef S
+#undef E
+#undef D
+#undef DEFAULT
+#undef OFFSET
+
+#endif /* AVCODEC_OPTIONS_TABLE_H */
diff --git a/media/ffvpx/libavcodec/parser.c b/media/ffvpx/libavcodec/parser.c
index 30cfc55cbc..670680ea7c 100644
--- a/media/ffvpx/libavcodec/parser.c
+++ b/media/ffvpx/libavcodec/parser.c
@@ -20,6 +20,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <inttypes.h>
#include <stdint.h>
#include <string.h>
@@ -251,7 +252,7 @@ int ff_combine_frame(ParseContext *pc, int next,
const uint8_t **buf, int *buf_size)
{
if (pc->overread) {
- ff_dlog(NULL, "overread %d, state:%X next:%d index:%d o_index:%d\n",
+ ff_dlog(NULL, "overread %d, state:%"PRIX32" next:%d index:%d o_index:%d\n",
pc->overread, pc->state, next, pc->index, pc->overread_index);
ff_dlog(NULL, "%X %X %X %X\n",
(*buf)[0], (*buf)[1], (*buf)[2], (*buf)[3]);
@@ -284,6 +285,8 @@ int ff_combine_frame(ParseContext *pc, int next,
return -1;
}
+ av_assert0(next >= 0 || pc->buffer);
+
*buf_size =
pc->overread_index = pc->index + next;
@@ -314,7 +317,7 @@ int ff_combine_frame(ParseContext *pc, int next,
}
if (pc->overread) {
- ff_dlog(NULL, "overread %d, state:%X next:%d index:%d o_index:%d\n",
+ ff_dlog(NULL, "overread %d, state:%"PRIX32" next:%d index:%d o_index:%d\n",
pc->overread, pc->state, next, pc->index, pc->overread_index);
ff_dlog(NULL, "%X %X %X %X\n",
(*buf)[0], (*buf)[1], (*buf)[2], (*buf)[3]);
diff --git a/media/ffvpx/libavcodec/pixblockdsp.h b/media/ffvpx/libavcodec/pixblockdsp.h
index 79ed86c3a6..e036700ff0 100644
--- a/media/ffvpx/libavcodec/pixblockdsp.h
+++ b/media/ffvpx/libavcodec/pixblockdsp.h
@@ -21,16 +21,23 @@
#include <stdint.h>
+#include "config.h"
+
#include "avcodec.h"
typedef struct PixblockDSPContext {
- void (*get_pixels)(int16_t *block /* align 16 */,
+ void (*get_pixels)(int16_t *av_restrict block /* align 16 */,
const uint8_t *pixels /* align 8 */,
- ptrdiff_t line_size);
- void (*diff_pixels)(int16_t *block /* align 16 */,
+ ptrdiff_t stride);
+ void (*diff_pixels)(int16_t *av_restrict block /* align 16 */,
const uint8_t *s1 /* align 8 */,
const uint8_t *s2 /* align 8 */,
- int stride);
+ ptrdiff_t stride);
+ void (*diff_pixels_unaligned)(int16_t *av_restrict block /* align 16 */,
+ const uint8_t *s1,
+ const uint8_t *s2,
+ ptrdiff_t stride);
+
} PixblockDSPContext;
void ff_pixblockdsp_init(PixblockDSPContext *c, AVCodecContext *avctx);
diff --git a/media/ffvpx/libavcodec/profiles.c b/media/ffvpx/libavcodec/profiles.c
index da745e1399..30498efedf 100644
--- a/media/ffvpx/libavcodec/profiles.c
+++ b/media/ffvpx/libavcodec/profiles.c
@@ -46,6 +46,16 @@ const AVProfile ff_dca_profiles[] = {
{ FF_PROFILE_UNKNOWN },
};
+const AVProfile ff_dnxhd_profiles[] = {
+ { FF_PROFILE_DNXHD, "DNXHD"},
+ { FF_PROFILE_DNXHR_LB, "DNXHR LB"},
+ { FF_PROFILE_DNXHR_SQ, "DNXHR SQ"},
+ { FF_PROFILE_DNXHR_HQ, "DNXHR HQ" },
+ { FF_PROFILE_DNXHR_HQX, "DNXHR HQX"},
+ { FF_PROFILE_DNXHR_444, "DNXHR 444"},
+ { FF_PROFILE_UNKNOWN },
+};
+
const AVProfile ff_h264_profiles[] = {
{ FF_PROFILE_H264_BASELINE, "Baseline" },
{ FF_PROFILE_H264_CONSTRAINED_BASELINE, "Constrained Baseline" },
@@ -60,6 +70,8 @@ const AVProfile ff_h264_profiles[] = {
{ FF_PROFILE_H264_HIGH_444_PREDICTIVE, "High 4:4:4 Predictive" },
{ FF_PROFILE_H264_HIGH_444_INTRA, "High 4:4:4 Intra" },
{ FF_PROFILE_H264_CAVLC_444, "CAVLC 4:4:4" },
+ { FF_PROFILE_H264_MULTIVIEW_HIGH, "Multiview High" },
+ { FF_PROFILE_H264_STEREO_HIGH, "Stereo High" },
{ FF_PROFILE_UNKNOWN },
};
diff --git a/media/ffvpx/libavcodec/profiles.h b/media/ffvpx/libavcodec/profiles.h
index c86c683ab0..eb18b406af 100644
--- a/media/ffvpx/libavcodec/profiles.h
+++ b/media/ffvpx/libavcodec/profiles.h
@@ -23,6 +23,7 @@
extern const AVProfile ff_aac_profiles[];
extern const AVProfile ff_dca_profiles[];
+extern const AVProfile ff_dnxhd_profiles[];
extern const AVProfile ff_h264_profiles[];
extern const AVProfile ff_hevc_profiles[];
extern const AVProfile ff_jpeg2000_profiles[];
diff --git a/media/ffvpx/libavcodec/pthread_frame.c b/media/ffvpx/libavcodec/pthread_frame.c
index a10fcbfe71..2c702c7372 100644
--- a/media/ffvpx/libavcodec/pthread_frame.c
+++ b/media/ffvpx/libavcodec/pthread_frame.c
@@ -24,9 +24,11 @@
#include "config.h"
+#include <stdatomic.h>
#include <stdint.h>
#include "avcodec.h"
+#include "hwaccel.h"
#include "internal.h"
#include "pthread_internal.h"
#include "thread.h"
@@ -43,29 +45,28 @@
#include "libavutil/opt.h"
#include "libavutil/thread.h"
-#if defined(MOZ_TSAN)
-typedef _Atomic(int) atomic_int;
-#else
-typedef volatile int atomic_int;
-#endif
+enum {
+ ///< Set when the thread is awaiting a packet.
+ STATE_INPUT_READY,
+ ///< Set before the codec has called ff_thread_finish_setup().
+ STATE_SETTING_UP,
+ /**
+ * Set when the codec calls get_buffer().
+ * State is returned to STATE_SETTING_UP afterwards.
+ */
+ STATE_GET_BUFFER,
+ /**
+ * Set when the codec calls get_format().
+ * State is returned to STATE_SETTING_UP afterwards.
+ */
+ STATE_GET_FORMAT,
+ ///< Set after the codec has called ff_thread_finish_setup().
+ STATE_SETUP_FINISHED,
+};
/**
* Context used by codec threads and stored in their AVCodecInternal thread_ctx.
*/
-typedef enum {
- STATE_INPUT_READY, ///< Set when the thread is awaiting a packet.
- STATE_SETTING_UP, ///< Set before the codec has called ff_thread_finish_setup().
- STATE_GET_BUFFER, /**<
- * Set when the codec calls get_buffer().
- * State is returned to STATE_SETTING_UP afterwards.
- */
- STATE_GET_FORMAT, /**<
- * Set when the codec calls get_format().
- * State is returned to STATE_SETTING_UP afterwards.
- */
- STATE_SETUP_FINISHED ///< Set after the codec has called ff_thread_finish_setup().
-} State;
-
typedef struct PerThreadContext {
struct FrameThreadContext *parent;
@@ -103,6 +104,11 @@ typedef struct PerThreadContext {
enum AVPixelFormat result_format; ///< get_format() result
int die; ///< Set when the thread should exit.
+
+ int hwaccel_serializing;
+ int async_serializing;
+
+ atomic_int debug_threads; ///< Set if the FF_DEBUG_THREADS option is set.
} PerThreadContext;
/**
@@ -113,6 +119,14 @@ typedef struct FrameThreadContext {
PerThreadContext *prev_thread; ///< The last thread submit_packet() was called on.
pthread_mutex_t buffer_mutex; ///< Mutex used to protect get/release_buffer().
+ /**
+ * This lock is used for ensuring threads run in serial when hwaccel
+ * is used.
+ */
+ pthread_mutex_t hwaccel_mutex;
+ pthread_mutex_t async_mutex;
+ pthread_cond_t async_cond;
+ int async_lock;
int next_decoding; ///< The next context to submit a packet to.
int next_finished; ///< The next context to return output from.
@@ -126,6 +140,24 @@ typedef struct FrameThreadContext {
#define THREAD_SAFE_CALLBACKS(avctx) \
((avctx)->thread_safe_callbacks || (avctx)->get_buffer2 == avcodec_default_get_buffer2)
+static void async_lock(FrameThreadContext *fctx)
+{
+ pthread_mutex_lock(&fctx->async_mutex);
+ while (fctx->async_lock)
+ pthread_cond_wait(&fctx->async_cond, &fctx->async_mutex);
+ fctx->async_lock = 1;
+ pthread_mutex_unlock(&fctx->async_mutex);
+}
+
+static void async_unlock(FrameThreadContext *fctx)
+{
+ pthread_mutex_lock(&fctx->async_mutex);
+ av_assert0(fctx->async_lock);
+ fctx->async_lock = 0;
+ pthread_cond_broadcast(&fctx->async_cond);
+ pthread_mutex_unlock(&fctx->async_mutex);
+}
+
/**
* Codec worker thread.
*
@@ -141,14 +173,29 @@ static attribute_align_arg void *frame_worker_thread(void *arg)
pthread_mutex_lock(&p->mutex);
while (1) {
- while (p->state == STATE_INPUT_READY && !p->die)
- pthread_cond_wait(&p->input_cond, &p->mutex);
+ while (atomic_load(&p->state) == STATE_INPUT_READY && !p->die)
+ pthread_cond_wait(&p->input_cond, &p->mutex);
if (p->die) break;
if (!codec->update_thread_context && THREAD_SAFE_CALLBACKS(avctx))
ff_thread_finish_setup(avctx);
+ /* If a decoder supports hwaccel, then it must call ff_get_format().
+ * Since that call must happen before ff_thread_finish_setup(), the
+ * decoder is required to implement update_thread_context() and call
+ * ff_thread_finish_setup() manually. Therefore the above
+ * ff_thread_finish_setup() call did not happen and hwaccel_serializing
+ * cannot be true here. */
+ av_assert0(!p->hwaccel_serializing);
+
+ /* if the previous thread uses hwaccel then we take the lock to ensure
+ * the threads don't run concurrently */
+ if (avctx->hwaccel) {
+ pthread_mutex_lock(&p->parent->hwaccel_mutex);
+ p->hwaccel_serializing = 1;
+ }
+
av_frame_unref(p->frame);
p->got_frame = 0;
p->result = codec->decode(avctx, p->frame, &p->got_frame, &p->avpkt);
@@ -160,17 +207,23 @@ static attribute_align_arg void *frame_worker_thread(void *arg)
av_frame_unref(p->frame);
}
- if (p->state == STATE_SETTING_UP) ff_thread_finish_setup(avctx);
+ if (atomic_load(&p->state) == STATE_SETTING_UP)
+ ff_thread_finish_setup(avctx);
+
+ if (p->hwaccel_serializing) {
+ p->hwaccel_serializing = 0;
+ pthread_mutex_unlock(&p->parent->hwaccel_mutex);
+ }
+
+ if (p->async_serializing) {
+ p->async_serializing = 0;
+
+ async_unlock(p->parent);
+ }
pthread_mutex_lock(&p->progress_mutex);
-#if 0 //BUFREF-FIXME
- for (i = 0; i < MAX_BUFFERS; i++)
- if (p->progress_used[i] && (p->got_frame || p->result<0 || avctx->codec_id != AV_CODEC_ID_H264)) {
- p->progress[i][0] = INT_MAX;
- p->progress[i][1] = INT_MAX;
- }
-#endif
- p->state = STATE_INPUT_READY;
+
+ atomic_store(&p->state, STATE_INPUT_READY);
pthread_cond_broadcast(&p->progress_cond);
pthread_cond_signal(&p->output_cond);
@@ -193,12 +246,13 @@ static int update_context_from_thread(AVCodecContext *dst, AVCodecContext *src,
{
int err = 0;
- if (dst != src) {
+ if (dst != src && (for_user || !(av_codec_get_codec_descriptor(src)->props & AV_CODEC_PROP_INTRA_ONLY))) {
dst->time_base = src->time_base;
dst->framerate = src->framerate;
dst->width = src->width;
dst->height = src->height;
dst->pix_fmt = src->pix_fmt;
+ dst->sw_pix_fmt = src->sw_pix_fmt;
dst->coded_width = src->coded_width;
dst->coded_height = src->coded_height;
@@ -234,6 +288,19 @@ FF_ENABLE_DEPRECATION_WARNINGS
dst->sample_fmt = src->sample_fmt;
dst->channel_layout = src->channel_layout;
dst->internal->hwaccel_priv_data = src->internal->hwaccel_priv_data;
+
+ if (!!dst->hw_frames_ctx != !!src->hw_frames_ctx ||
+ (dst->hw_frames_ctx && dst->hw_frames_ctx->data != src->hw_frames_ctx->data)) {
+ av_buffer_unref(&dst->hw_frames_ctx);
+
+ if (src->hw_frames_ctx) {
+ dst->hw_frames_ctx = av_buffer_ref(src->hw_frames_ctx);
+ if (!dst->hw_frames_ctx)
+ return AVERROR(ENOMEM);
+ }
+ }
+
+ dst->hwaccel_flags = src->hwaccel_flags;
}
if (for_user) {
@@ -315,24 +382,35 @@ static void release_delayed_buffers(PerThreadContext *p)
}
}
-static int submit_packet(PerThreadContext *p, AVPacket *avpkt)
+static int submit_packet(PerThreadContext *p, AVCodecContext *user_avctx,
+ AVPacket *avpkt)
{
FrameThreadContext *fctx = p->parent;
PerThreadContext *prev_thread = fctx->prev_thread;
const AVCodec *codec = p->avctx->codec;
+ int ret;
if (!avpkt->size && !(codec->capabilities & AV_CODEC_CAP_DELAY))
return 0;
pthread_mutex_lock(&p->mutex);
+ ret = update_context_from_user(p->avctx, user_avctx);
+ if (ret) {
+ pthread_mutex_unlock(&p->mutex);
+ return ret;
+ }
+ atomic_store_explicit(&p->debug_threads,
+ (p->avctx->debug & FF_DEBUG_THREADS) != 0,
+ memory_order_relaxed);
+
release_delayed_buffers(p);
if (prev_thread) {
int err;
- if (prev_thread->state == STATE_SETTING_UP) {
+ if (atomic_load(&prev_thread->state) == STATE_SETTING_UP) {
pthread_mutex_lock(&prev_thread->progress_mutex);
- while (prev_thread->state == STATE_SETTING_UP)
+ while (atomic_load(&prev_thread->state) == STATE_SETTING_UP)
pthread_cond_wait(&prev_thread->progress_cond, &prev_thread->progress_mutex);
pthread_mutex_unlock(&prev_thread->progress_mutex);
}
@@ -345,9 +423,14 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt)
}
av_packet_unref(&p->avpkt);
- av_packet_ref(&p->avpkt, avpkt);
+ ret = av_packet_ref(&p->avpkt, avpkt);
+ if (ret < 0) {
+ pthread_mutex_unlock(&p->mutex);
+ av_log(p->avctx, AV_LOG_ERROR, "av_packet_ref() failed in submit_packet()\n");
+ return ret;
+ }
- p->state = STATE_SETTING_UP;
+ atomic_store(&p->state, STATE_SETTING_UP);
pthread_cond_signal(&p->input_cond);
pthread_mutex_unlock(&p->mutex);
@@ -360,14 +443,13 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt)
if (!p->avctx->thread_safe_callbacks && (
p->avctx->get_format != avcodec_default_get_format ||
p->avctx->get_buffer2 != avcodec_default_get_buffer2)) {
- while (p->state != STATE_SETUP_FINISHED && p->state != STATE_INPUT_READY) {
+ while (atomic_load(&p->state) != STATE_SETUP_FINISHED && atomic_load(&p->state) != STATE_INPUT_READY) {
int call_done = 1;
pthread_mutex_lock(&p->progress_mutex);
- while (p->state == STATE_SETTING_UP)
+ while (atomic_load(&p->state) == STATE_SETTING_UP)
pthread_cond_wait(&p->progress_cond, &p->progress_mutex);
- State p_state = (State)p->state;
- switch (p_state) {
+ switch (atomic_load_explicit(&p->state, memory_order_acquire)) {
case STATE_GET_BUFFER:
p->result = ff_get_buffer(p->avctx, p->requested_frame, p->requested_flags);
break;
@@ -379,7 +461,7 @@ static int submit_packet(PerThreadContext *p, AVPacket *avpkt)
break;
}
if (call_done) {
- p->state = STATE_SETTING_UP;
+ atomic_store(&p->state, STATE_SETTING_UP);
pthread_cond_signal(&p->progress_cond);
}
pthread_mutex_unlock(&p->progress_mutex);
@@ -401,15 +483,18 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
PerThreadContext *p;
int err;
+ /* release the async lock, permitting blocked hwaccel threads to
+ * go forward while we are in this function */
+ async_unlock(fctx);
+
/*
* Submit a packet to the next decoding thread.
*/
p = &fctx->threads[fctx->next_decoding];
- err = update_context_from_user(p->avctx, avctx);
- if (err) return err;
- err = submit_packet(p, avpkt);
- if (err) return err;
+ err = submit_packet(p, avctx, avpkt);
+ if (err)
+ goto finish;
/*
* If we're still receiving the initial packets, don't return a frame.
@@ -420,23 +505,25 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
if (fctx->delaying) {
*got_picture_ptr=0;
- if (avpkt->size)
- return avpkt->size;
+ if (avpkt->size) {
+ err = avpkt->size;
+ goto finish;
+ }
}
/*
* Return the next available frame from the oldest thread.
* If we're at the end of the stream, then we have to skip threads that
- * didn't output a frame, because we don't want to accidentally signal
- * EOF (avpkt->size == 0 && *got_picture_ptr == 0).
+ * didn't output a frame/error, because we don't want to accidentally signal
+ * EOF (avpkt->size == 0 && *got_picture_ptr == 0 && err >= 0).
*/
do {
p = &fctx->threads[finished++];
- if (p->state != STATE_INPUT_READY) {
+ if (atomic_load(&p->state) != STATE_INPUT_READY) {
pthread_mutex_lock(&p->progress_mutex);
- while (p->state != STATE_INPUT_READY)
+ while (atomic_load_explicit(&p->state, memory_order_relaxed) != STATE_INPUT_READY)
pthread_cond_wait(&p->output_cond, &p->progress_mutex);
pthread_mutex_unlock(&p->progress_mutex);
}
@@ -444,20 +531,19 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
av_frame_move_ref(picture, p->frame);
*got_picture_ptr = p->got_frame;
picture->pkt_dts = p->avpkt.dts;
-
- if (p->result < 0)
- err = p->result;
+ err = p->result;
/*
* A later call with avkpt->size == 0 may loop over all threads,
- * including this one, searching for a frame to return before being
+ * including this one, searching for a frame/error to return before being
* stopped by the "finished != fctx->next_finished" condition.
- * Make sure we don't mistakenly return the same frame again.
+ * Make sure we don't mistakenly return the same frame/error again.
*/
p->got_frame = 0;
+ p->result = 0;
if (finished >= avctx->thread_count) finished = 0;
- } while (!avpkt->size && !*got_picture_ptr && finished != fctx->next_finished);
+ } while (!avpkt->size && !*got_picture_ptr && err >= 0 && finished != fctx->next_finished);
update_context_from_thread(avctx, p->avctx, 1);
@@ -465,16 +551,12 @@ int ff_thread_decode_frame(AVCodecContext *avctx,
fctx->next_finished = finished;
- /*
- * When no frame was found while flushing, but an error occurred in
- * any thread, return it instead of 0.
- * Otherwise the error can get lost.
- */
- if (!avpkt->size && !*got_picture_ptr)
- return err;
-
/* return the size of the consumed packet if no error occurred */
- return (p->result >= 0) ? avpkt->size : p->result;
+ if (err >= 0)
+ err = avpkt->size;
+finish:
+ async_lock(fctx);
+ return err;
}
void ff_thread_report_progress(ThreadFrame *f, int n, int field)
@@ -482,15 +564,20 @@ void ff_thread_report_progress(ThreadFrame *f, int n, int field)
PerThreadContext *p;
atomic_int *progress = f->progress ? (atomic_int*)f->progress->data : NULL;
- if (!progress || progress[field] >= n) return;
+ if (!progress ||
+ atomic_load_explicit(&progress[field], memory_order_relaxed) >= n)
+ return;
- p = f->owner->internal->thread_ctx;
+ p = f->owner[field]->internal->thread_ctx;
- if (f->owner->debug&FF_DEBUG_THREADS)
- av_log(f->owner, AV_LOG_DEBUG, "%p finished %d field %d\n", progress, n, field);
+ if (atomic_load_explicit(&p->debug_threads, memory_order_relaxed))
+ av_log(f->owner[field], AV_LOG_DEBUG,
+ "%p finished %d field %d\n", progress, n, field);
pthread_mutex_lock(&p->progress_mutex);
- progress[field] = n;
+
+ atomic_store_explicit(&progress[field], n, memory_order_release);
+
pthread_cond_broadcast(&p->progress_cond);
pthread_mutex_unlock(&p->progress_mutex);
}
@@ -500,15 +587,18 @@ void ff_thread_await_progress(ThreadFrame *f, int n, int field)
PerThreadContext *p;
atomic_int *progress = f->progress ? (atomic_int*)f->progress->data : NULL;
- if (!progress || progress[field] >= n) return;
+ if (!progress ||
+ atomic_load_explicit(&progress[field], memory_order_acquire) >= n)
+ return;
- p = f->owner->internal->thread_ctx;
+ p = f->owner[field]->internal->thread_ctx;
- if (f->owner->debug&FF_DEBUG_THREADS)
- av_log(f->owner, AV_LOG_DEBUG, "thread awaiting %d field %d from %p\n", n, field, progress);
+ if (atomic_load_explicit(&p->debug_threads, memory_order_relaxed))
+ av_log(f->owner[field], AV_LOG_DEBUG,
+ "thread awaiting %d field %d from %p\n", n, field, progress);
pthread_mutex_lock(&p->progress_mutex);
- while (progress[field] < n)
+ while (atomic_load_explicit(&progress[field], memory_order_relaxed) < n)
pthread_cond_wait(&p->progress_cond, &p->progress_mutex);
pthread_mutex_unlock(&p->progress_mutex);
}
@@ -518,12 +608,26 @@ void ff_thread_finish_setup(AVCodecContext *avctx) {
if (!(avctx->active_thread_type&FF_THREAD_FRAME)) return;
- if(p->state == STATE_SETUP_FINISHED){
- av_log(avctx, AV_LOG_WARNING, "Multiple ff_thread_finish_setup() calls\n");
+ if (avctx->hwaccel && !p->hwaccel_serializing) {
+ pthread_mutex_lock(&p->parent->hwaccel_mutex);
+ p->hwaccel_serializing = 1;
+ }
+
+ /* this assumes that no hwaccel calls happen before ff_thread_finish_setup() */
+ if (avctx->hwaccel &&
+ !(avctx->hwaccel->caps_internal & HWACCEL_CAP_ASYNC_SAFE)) {
+ p->async_serializing = 1;
+
+ async_lock(p->parent);
}
pthread_mutex_lock(&p->progress_mutex);
- p->state = STATE_SETUP_FINISHED;
+ if(atomic_load(&p->state) == STATE_SETUP_FINISHED){
+ av_log(avctx, AV_LOG_WARNING, "Multiple ff_thread_finish_setup() calls\n");
+ }
+
+ atomic_store(&p->state, STATE_SETUP_FINISHED);
+
pthread_cond_broadcast(&p->progress_cond);
pthread_mutex_unlock(&p->progress_mutex);
}
@@ -533,17 +637,21 @@ static void park_frame_worker_threads(FrameThreadContext *fctx, int thread_count
{
int i;
+ async_unlock(fctx);
+
for (i = 0; i < thread_count; i++) {
PerThreadContext *p = &fctx->threads[i];
- if (p->state != STATE_INPUT_READY) {
+ if (atomic_load(&p->state) != STATE_INPUT_READY) {
pthread_mutex_lock(&p->progress_mutex);
- while (p->state != STATE_INPUT_READY)
+ while (atomic_load(&p->state) != STATE_INPUT_READY)
pthread_cond_wait(&p->output_cond, &p->progress_mutex);
pthread_mutex_unlock(&p->progress_mutex);
}
p->got_frame = 0;
}
+
+ async_lock(fctx);
}
void ff_frame_thread_free(AVCodecContext *avctx, int thread_count)
@@ -596,13 +704,20 @@ void ff_frame_thread_free(AVCodecContext *avctx, int thread_count)
av_freep(&p->avctx->slice_offset);
}
- if (p->avctx)
+ if (p->avctx) {
av_freep(&p->avctx->internal);
+ av_buffer_unref(&p->avctx->hw_frames_ctx);
+ }
+
av_freep(&p->avctx);
}
av_freep(&fctx->threads);
pthread_mutex_destroy(&fctx->buffer_mutex);
+ pthread_mutex_destroy(&fctx->hwaccel_mutex);
+ pthread_mutex_destroy(&fctx->async_mutex);
+ pthread_cond_destroy(&fctx->async_cond);
+
av_freep(&avctx->internal->thread_ctx);
if (avctx->priv_data && avctx->codec && avctx->codec->priv_class)
@@ -624,8 +739,10 @@ int ff_frame_thread_init(AVCodecContext *avctx)
if (!thread_count) {
int nb_cpus = av_cpu_count();
+#if FF_API_DEBUG_MV
if ((avctx->debug & (FF_DEBUG_VIS_QP | FF_DEBUG_VIS_MB_TYPE)) || avctx->debug_mv)
nb_cpus = 1;
+#endif
// use number of cores + 1 as thread count if there is more than one
if (nb_cpus > 1)
thread_count = avctx->thread_count = FFMIN(nb_cpus + 1, MAX_AUTO_THREADS);
@@ -649,6 +766,11 @@ int ff_frame_thread_init(AVCodecContext *avctx)
}
pthread_mutex_init(&fctx->buffer_mutex, NULL);
+ pthread_mutex_init(&fctx->hwaccel_mutex, NULL);
+ pthread_mutex_init(&fctx->async_mutex, NULL);
+ pthread_cond_init(&fctx->async_cond, NULL);
+
+ fctx->async_lock = 1;
fctx->delaying = 1;
for (i = 0; i < thread_count; i++) {
@@ -686,7 +808,7 @@ int ff_frame_thread_init(AVCodecContext *avctx)
}
*copy->internal = *src->internal;
copy->internal->thread_ctx = p;
- copy->internal->pkt = &p->avpkt;
+ copy->internal->last_pkt_props = &p->avpkt;
if (!i) {
src = copy;
@@ -710,6 +832,8 @@ int ff_frame_thread_init(AVCodecContext *avctx)
if (err) goto error;
+ atomic_init(&p->debug_threads, (copy->debug & FF_DEBUG_THREADS) != 0);
+
err = AVERROR(pthread_create(&p->thread, NULL, frame_worker_thread, p));
p->thread_init= !err;
if(!p->thread_init)
@@ -745,6 +869,7 @@ void ff_thread_flush(AVCodecContext *avctx)
// Make sure decode flush calls with size=0 won't return old frames
p->got_frame = 0;
av_frame_unref(p->frame);
+ p->result = 0;
release_delayed_buffers(p);
@@ -756,7 +881,7 @@ void ff_thread_flush(AVCodecContext *avctx)
int ff_thread_can_start_frame(AVCodecContext *avctx)
{
PerThreadContext *p = avctx->internal->thread_ctx;
- if ((avctx->active_thread_type&FF_THREAD_FRAME) && p->state != STATE_SETTING_UP &&
+ if ((avctx->active_thread_type&FF_THREAD_FRAME) && atomic_load(&p->state) != STATE_SETTING_UP &&
(avctx->codec->update_thread_context || !THREAD_SAFE_CALLBACKS(avctx))) {
return 0;
}
@@ -768,28 +893,29 @@ static int thread_get_buffer_internal(AVCodecContext *avctx, ThreadFrame *f, int
PerThreadContext *p = avctx->internal->thread_ctx;
int err;
- f->owner = avctx;
+ f->owner[0] = f->owner[1] = avctx;
ff_init_buffer_info(avctx, f->f);
if (!(avctx->active_thread_type & FF_THREAD_FRAME))
return ff_get_buffer(avctx, f->f, flags);
- if (p->state != STATE_SETTING_UP &&
+ if (atomic_load(&p->state) != STATE_SETTING_UP &&
(avctx->codec->update_thread_context || !THREAD_SAFE_CALLBACKS(avctx))) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() cannot be called after ff_thread_finish_setup()\n");
return -1;
}
if (avctx->internal->allocate_progress) {
- int *progress;
- f->progress = av_buffer_alloc(2 * sizeof(int));
+ atomic_int *progress;
+ f->progress = av_buffer_alloc(2 * sizeof(*progress));
if (!f->progress) {
return AVERROR(ENOMEM);
}
- progress = (int*)f->progress->data;
+ progress = (atomic_int*)f->progress->data;
- progress[0] = progress[1] = -1;
+ atomic_init(&progress[0], -1);
+ atomic_init(&progress[1], -1);
}
pthread_mutex_lock(&p->parent->buffer_mutex);
@@ -800,10 +926,10 @@ static int thread_get_buffer_internal(AVCodecContext *avctx, ThreadFrame *f, int
pthread_mutex_lock(&p->progress_mutex);
p->requested_frame = f->f;
p->requested_flags = flags;
- p->state = STATE_GET_BUFFER;
+ atomic_store_explicit(&p->state, STATE_GET_BUFFER, memory_order_release);
pthread_cond_broadcast(&p->progress_cond);
- while (p->state != STATE_SETTING_UP)
+ while (atomic_load(&p->state) != STATE_SETTING_UP)
pthread_cond_wait(&p->progress_cond, &p->progress_mutex);
err = p->result;
@@ -828,16 +954,16 @@ enum AVPixelFormat ff_thread_get_format(AVCodecContext *avctx, const enum AVPixe
if (!(avctx->active_thread_type & FF_THREAD_FRAME) || avctx->thread_safe_callbacks ||
avctx->get_format == avcodec_default_get_format)
return ff_get_format(avctx, fmt);
- if (p->state != STATE_SETTING_UP) {
+ if (atomic_load(&p->state) != STATE_SETTING_UP) {
av_log(avctx, AV_LOG_ERROR, "get_format() cannot be called after ff_thread_finish_setup()\n");
return -1;
}
pthread_mutex_lock(&p->progress_mutex);
p->available_formats = fmt;
- p->state = STATE_GET_FORMAT;
+ atomic_store(&p->state, STATE_GET_FORMAT);
pthread_cond_broadcast(&p->progress_cond);
- while (p->state != STATE_SETTING_UP)
+ while (atomic_load(&p->state) != STATE_SETTING_UP)
pthread_cond_wait(&p->progress_cond, &p->progress_mutex);
res = p->result_format;
@@ -871,7 +997,7 @@ void ff_thread_release_buffer(AVCodecContext *avctx, ThreadFrame *f)
av_log(avctx, AV_LOG_DEBUG, "thread_release_buffer called on pic %p\n", f);
av_buffer_unref(&f->progress);
- f->owner = NULL;
+ f->owner[0] = f->owner[1] = NULL;
if (can_direct_free) {
av_frame_unref(f->f);
diff --git a/media/ffvpx/libavcodec/pthread_slice.c b/media/ffvpx/libavcodec/pthread_slice.c
index 96a7643f6a..d659f9b0ba 100644
--- a/media/ffvpx/libavcodec/pthread_slice.c
+++ b/media/ffvpx/libavcodec/pthread_slice.c
@@ -34,26 +34,21 @@
#include "libavutil/cpu.h"
#include "libavutil/mem.h"
#include "libavutil/thread.h"
+#include "libavutil/slicethread.h"
typedef int (action_func)(AVCodecContext *c, void *arg);
typedef int (action_func2)(AVCodecContext *c, void *arg, int jobnr, int threadnr);
+typedef int (main_func)(AVCodecContext *c);
typedef struct SliceThreadContext {
- pthread_t *workers;
+ AVSliceThread *thread;
action_func *func;
action_func2 *func2;
+ main_func *mainfunc;
void *args;
int *rets;
- int job_count;
int job_size;
- pthread_cond_t last_job_cond;
- pthread_cond_t current_job_cond;
- pthread_mutex_t current_job_lock;
- unsigned current_execute;
- int current_job;
- int done;
-
int *entries;
int entries_count;
int thread_count;
@@ -61,43 +56,22 @@ typedef struct SliceThreadContext {
pthread_mutex_t *progress_mutex;
} SliceThreadContext;
-static void* attribute_align_arg worker(void *v)
-{
- AVCodecContext *avctx = v;
+static void main_function(void *priv) {
+ AVCodecContext *avctx = priv;
SliceThreadContext *c = avctx->internal->thread_ctx;
- unsigned last_execute = 0;
- int our_job = c->job_count;
- int thread_count = avctx->thread_count;
- int self_id;
-
- pthread_mutex_lock(&c->current_job_lock);
- self_id = c->current_job++;
- for (;;){
- int ret;
- while (our_job >= c->job_count) {
- if (c->current_job == thread_count + c->job_count)
- pthread_cond_signal(&c->last_job_cond);
-
- while (last_execute == c->current_execute && !c->done)
- pthread_cond_wait(&c->current_job_cond, &c->current_job_lock);
- last_execute = c->current_execute;
- our_job = self_id;
-
- if (c->done) {
- pthread_mutex_unlock(&c->current_job_lock);
- return NULL;
- }
- }
- pthread_mutex_unlock(&c->current_job_lock);
+ c->mainfunc(avctx);
+}
- ret = c->func ? c->func(avctx, (char*)c->args + our_job*c->job_size):
- c->func2(avctx, c->args, our_job, self_id);
- if (c->rets)
- c->rets[our_job%c->job_count] = ret;
+static void worker_func(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads)
+{
+ AVCodecContext *avctx = priv;
+ SliceThreadContext *c = avctx->internal->thread_ctx;
+ int ret;
- pthread_mutex_lock(&c->current_job_lock);
- our_job = c->current_job++;
- }
+ ret = c->func ? c->func(avctx, (char *)c->args + c->job_size * jobnr)
+ : c->func2(avctx, c->args, jobnr, threadnr);
+ if (c->rets)
+ c->rets[jobnr] = ret;
}
void ff_slice_thread_free(AVCodecContext *avctx)
@@ -105,40 +79,19 @@ void ff_slice_thread_free(AVCodecContext *avctx)
SliceThreadContext *c = avctx->internal->thread_ctx;
int i;
- pthread_mutex_lock(&c->current_job_lock);
- c->done = 1;
- pthread_cond_broadcast(&c->current_job_cond);
- for (i = 0; i < c->thread_count; i++)
- pthread_cond_broadcast(&c->progress_cond[i]);
- pthread_mutex_unlock(&c->current_job_lock);
-
- for (i=0; i<avctx->thread_count; i++)
- pthread_join(c->workers[i], NULL);
+ avpriv_slicethread_free(&c->thread);
for (i = 0; i < c->thread_count; i++) {
pthread_mutex_destroy(&c->progress_mutex[i]);
pthread_cond_destroy(&c->progress_cond[i]);
}
- pthread_mutex_destroy(&c->current_job_lock);
- pthread_cond_destroy(&c->current_job_cond);
- pthread_cond_destroy(&c->last_job_cond);
-
av_freep(&c->entries);
av_freep(&c->progress_mutex);
av_freep(&c->progress_cond);
-
- av_freep(&c->workers);
av_freep(&avctx->internal->thread_ctx);
}
-static av_always_inline void thread_park_workers(SliceThreadContext *c, int thread_count)
-{
- while (c->current_job != thread_count + c->job_count)
- pthread_cond_wait(&c->last_job_cond, &c->current_job_lock);
- pthread_mutex_unlock(&c->current_job_lock);
-}
-
static int thread_execute(AVCodecContext *avctx, action_func* func, void *arg, int *ret, int job_count, int job_size)
{
SliceThreadContext *c = avctx->internal->thread_ctx;
@@ -149,23 +102,12 @@ static int thread_execute(AVCodecContext *avctx, action_func* func, void *arg, i
if (job_count <= 0)
return 0;
- pthread_mutex_lock(&c->current_job_lock);
-
- c->current_job = avctx->thread_count;
- c->job_count = job_count;
c->job_size = job_size;
c->args = arg;
c->func = func;
- if (ret) {
- c->rets = ret;
- } else {
- c->rets = NULL;
- }
- c->current_execute++;
- pthread_cond_broadcast(&c->current_job_cond);
-
- thread_park_workers(c, avctx->thread_count);
+ c->rets = ret;
+ avpriv_slicethread_execute(c->thread, job_count, !!c->mainfunc );
return 0;
}
@@ -176,11 +118,19 @@ static int thread_execute2(AVCodecContext *avctx, action_func2* func2, void *arg
return thread_execute(avctx, NULL, arg, ret, job_count, 0);
}
+int ff_slice_thread_execute_with_mainfunc(AVCodecContext *avctx, action_func2* func2, main_func *mainfunc, void *arg, int *ret, int job_count)
+{
+ SliceThreadContext *c = avctx->internal->thread_ctx;
+ c->func2 = func2;
+ c->mainfunc = mainfunc;
+ return thread_execute(avctx, NULL, arg, ret, job_count, 0);
+}
+
int ff_slice_thread_init(AVCodecContext *avctx)
{
- int i;
SliceThreadContext *c;
int thread_count = avctx->thread_count;
+ static void (*mainfunc)(void *);
#if HAVE_W32THREADS
w32thread_init();
@@ -208,35 +158,17 @@ int ff_slice_thread_init(AVCodecContext *avctx)
return 0;
}
- c = av_mallocz(sizeof(SliceThreadContext));
- if (!c)
- return -1;
-
- c->workers = av_mallocz_array(thread_count, sizeof(pthread_t));
- if (!c->workers) {
- av_free(c);
- return -1;
- }
-
- avctx->internal->thread_ctx = c;
- c->current_job = 0;
- c->job_count = 0;
- c->job_size = 0;
- c->done = 0;
- pthread_cond_init(&c->current_job_cond, NULL);
- pthread_cond_init(&c->last_job_cond, NULL);
- pthread_mutex_init(&c->current_job_lock, NULL);
- pthread_mutex_lock(&c->current_job_lock);
- for (i=0; i<thread_count; i++) {
- if(pthread_create(&c->workers[i], NULL, worker, avctx)) {
- avctx->thread_count = i;
- pthread_mutex_unlock(&c->current_job_lock);
- ff_thread_free(avctx);
- return -1;
- }
+ avctx->internal->thread_ctx = c = av_mallocz(sizeof(*c));
+ mainfunc = avctx->codec->caps_internal & FF_CODEC_CAP_SLICE_THREAD_HAS_MF ? &main_function : NULL;
+ if (!c || (thread_count = avpriv_slicethread_create(&c->thread, avctx, worker_func, mainfunc, thread_count)) <= 1) {
+ if (c)
+ avpriv_slicethread_free(&c->thread);
+ av_freep(&avctx->internal->thread_ctx);
+ avctx->thread_count = 1;
+ avctx->active_thread_type = 0;
+ return 0;
}
-
- thread_park_workers(c, thread_count);
+ avctx->thread_count = thread_count;
avctx->execute = thread_execute;
avctx->execute2 = thread_execute2;
diff --git a/media/ffvpx/libavcodec/put_bits.h b/media/ffvpx/libavcodec/put_bits.h
index 68ed391195..1ceb1cc766 100644
--- a/media/ffvpx/libavcodec/put_bits.h
+++ b/media/ffvpx/libavcodec/put_bits.h
@@ -119,6 +119,18 @@ static inline void flush_put_bits(PutBitContext *s)
s->bit_buf = 0;
}
+static inline void flush_put_bits_le(PutBitContext *s)
+{
+ while (s->bit_left < 32) {
+ av_assert0(s->buf_ptr < s->buf_end);
+ *s->buf_ptr++ = s->bit_buf;
+ s->bit_buf >>= 8;
+ s->bit_left += 8;
+ }
+ s->bit_left = 32;
+ s->bit_buf = 0;
+}
+
#ifdef BITSTREAM_WRITER_LE
#define avpriv_align_put_bits align_put_bits_unsupported_here
#define avpriv_put_string ff_put_string_unsupported_here
@@ -197,6 +209,34 @@ static inline void put_bits(PutBitContext *s, int n, unsigned int value)
s->bit_left = bit_left;
}
+static inline void put_bits_le(PutBitContext *s, int n, unsigned int value)
+{
+ unsigned int bit_buf;
+ int bit_left;
+
+ av_assert2(n <= 31 && value < (1U << n));
+
+ bit_buf = s->bit_buf;
+ bit_left = s->bit_left;
+
+ bit_buf |= value << (32 - bit_left);
+ if (n >= bit_left) {
+ if (3 < s->buf_end - s->buf_ptr) {
+ AV_WL32(s->buf_ptr, bit_buf);
+ s->buf_ptr += 4;
+ } else {
+ av_log(NULL, AV_LOG_ERROR, "Internal error, put_bits buffer too small\n");
+ av_assert2(0);
+ }
+ bit_buf = value >> bit_left;
+ bit_left += 32;
+ }
+ bit_left -= n;
+
+ s->bit_buf = bit_buf;
+ s->bit_left = bit_left;
+}
+
static inline void put_sbits(PutBitContext *pb, int n, int32_t value)
{
av_assert2(n >= 0 && n <= 31);
@@ -209,15 +249,72 @@ static inline void put_sbits(PutBitContext *pb, int n, int32_t value)
*/
static void av_unused put_bits32(PutBitContext *s, uint32_t value)
{
- int lo = value & 0xffff;
- int hi = value >> 16;
+ unsigned int bit_buf;
+ int bit_left;
+
+ bit_buf = s->bit_buf;
+ bit_left = s->bit_left;
+
#ifdef BITSTREAM_WRITER_LE
- put_bits(s, 16, lo);
- put_bits(s, 16, hi);
+ bit_buf |= value << (32 - bit_left);
+ if (3 < s->buf_end - s->buf_ptr) {
+ AV_WL32(s->buf_ptr, bit_buf);
+ s->buf_ptr += 4;
+ } else {
+ av_log(NULL, AV_LOG_ERROR, "Internal error, put_bits buffer too small\n");
+ av_assert2(0);
+ }
+ bit_buf = (uint64_t)value >> bit_left;
#else
- put_bits(s, 16, hi);
- put_bits(s, 16, lo);
+ bit_buf = (uint64_t)bit_buf << bit_left;
+ bit_buf |= value >> (32 - bit_left);
+ if (3 < s->buf_end - s->buf_ptr) {
+ AV_WB32(s->buf_ptr, bit_buf);
+ s->buf_ptr += 4;
+ } else {
+ av_log(NULL, AV_LOG_ERROR, "Internal error, put_bits buffer too small\n");
+ av_assert2(0);
+ }
+ bit_buf = value;
#endif
+
+ s->bit_buf = bit_buf;
+ s->bit_left = bit_left;
+}
+
+/**
+ * Write up to 64 bits into a bitstream.
+ */
+static inline void put_bits64(PutBitContext *s, int n, uint64_t value)
+{
+ av_assert2((n == 64) || (n < 64 && value < (UINT64_C(1) << n)));
+
+ if (n < 32)
+ put_bits(s, n, value);
+ else if (n == 32)
+ put_bits32(s, value);
+ else if (n < 64) {
+ uint32_t lo = value & 0xffffffff;
+ uint32_t hi = value >> 32;
+#ifdef BITSTREAM_WRITER_LE
+ put_bits32(s, lo);
+ put_bits(s, n - 32, hi);
+#else
+ put_bits(s, n - 32, hi);
+ put_bits32(s, lo);
+#endif
+ } else {
+ uint32_t lo = value & 0xffffffff;
+ uint32_t hi = value >> 32;
+#ifdef BITSTREAM_WRITER_LE
+ put_bits32(s, lo);
+ put_bits32(s, hi);
+#else
+ put_bits32(s, hi);
+ put_bits32(s, lo);
+#endif
+
+ }
}
/**
diff --git a/media/ffvpx/libavcodec/ratecontrol.h b/media/ffvpx/libavcodec/ratecontrol.h
index c15f9e258e..2a7aaec644 100644
--- a/media/ffvpx/libavcodec/ratecontrol.h
+++ b/media/ffvpx/libavcodec/ratecontrol.h
@@ -96,8 +96,4 @@ void ff_rate_control_uninit(struct MpegEncContext *s);
int ff_vbv_update(struct MpegEncContext *s, int frame_size);
void ff_get_2pass_fcode(struct MpegEncContext *s);
-int ff_xvid_rate_control_init(struct MpegEncContext *s);
-void ff_xvid_rate_control_uninit(struct MpegEncContext *s);
-float ff_xvid_rate_estimate_qscale(struct MpegEncContext *s, int dry_run);
-
#endif /* AVCODEC_RATECONTROL_H */
diff --git a/media/ffvpx/libavcodec/raw.c b/media/ffvpx/libavcodec/raw.c
index f73a134a99..8da2a9735e 100644
--- a/media/ffvpx/libavcodec/raw.c
+++ b/media/ffvpx/libavcodec/raw.c
@@ -119,6 +119,12 @@ const PixelFormatTag ff_raw_pix_fmt_tags[] = {
{ AV_PIX_FMT_RGB48BE, MKTAG( 48, 'R', 'G', 'B') },
{ AV_PIX_FMT_BGR48LE, MKTAG('B', 'G', 'R', 48 ) },
{ AV_PIX_FMT_BGR48BE, MKTAG( 48, 'B', 'G', 'R') },
+ { AV_PIX_FMT_GRAY9LE, MKTAG('Y', '1', 0 , 9 ) },
+ { AV_PIX_FMT_GRAY9BE, MKTAG( 9 , 0 , '1', 'Y') },
+ { AV_PIX_FMT_GRAY10LE, MKTAG('Y', '1', 0 , 10 ) },
+ { AV_PIX_FMT_GRAY10BE, MKTAG(10 , 0 , '1', 'Y') },
+ { AV_PIX_FMT_GRAY12LE, MKTAG('Y', '1', 0 , 12 ) },
+ { AV_PIX_FMT_GRAY12BE, MKTAG(12 , 0 , '1', 'Y') },
{ AV_PIX_FMT_GRAY16LE, MKTAG('Y', '1', 0 , 16 ) },
{ AV_PIX_FMT_GRAY16BE, MKTAG(16 , 0 , '1', 'Y') },
{ AV_PIX_FMT_YUV420P9LE, MKTAG('Y', '3', 11 , 9 ) },
@@ -266,6 +272,14 @@ const PixelFormatTag ff_raw_pix_fmt_tags[] = {
{ AV_PIX_FMT_YUV422P10BE, MKTAG('I', '2', 'A', 'B') },
{ AV_PIX_FMT_YUV444P10LE, MKTAG('I', '4', 'A', 'L') },
{ AV_PIX_FMT_YUV444P10BE, MKTAG('I', '4', 'A', 'B') },
+ { AV_PIX_FMT_YUV420P12LE, MKTAG('I', '0', 'C', 'L') },
+ { AV_PIX_FMT_YUV420P12BE, MKTAG('I', '0', 'C', 'B') },
+ { AV_PIX_FMT_YUV422P12LE, MKTAG('I', '2', 'C', 'L') },
+ { AV_PIX_FMT_YUV422P12BE, MKTAG('I', '2', 'C', 'B') },
+ { AV_PIX_FMT_YUV444P12LE, MKTAG('I', '4', 'C', 'L') },
+ { AV_PIX_FMT_YUV444P12BE, MKTAG('I', '4', 'C', 'B') },
+ { AV_PIX_FMT_YUV420P16LE, MKTAG('I', '0', 'F', 'L') },
+ { AV_PIX_FMT_YUV420P16BE, MKTAG('I', '0', 'F', 'B') },
{ AV_PIX_FMT_YUV444P16LE, MKTAG('I', '4', 'F', 'L') },
{ AV_PIX_FMT_YUV444P16BE, MKTAG('I', '4', 'F', 'B') },
diff --git a/media/ffvpx/libavcodec/thread.h b/media/ffvpx/libavcodec/thread.h
index c848d7ae8b..318619316c 100644
--- a/media/ffvpx/libavcodec/thread.h
+++ b/media/ffvpx/libavcodec/thread.h
@@ -34,7 +34,7 @@
typedef struct ThreadFrame {
AVFrame *f;
- AVCodecContext *owner;
+ AVCodecContext *owner[2];
// progress->data is an array of 2 ints holding progress for top/bottom
// fields
AVBufferRef *progress;
@@ -133,8 +133,10 @@ void ff_thread_release_buffer(AVCodecContext *avctx, ThreadFrame *f);
int ff_thread_ref_frame(ThreadFrame *dst, ThreadFrame *src);
int ff_thread_init(AVCodecContext *s);
+int ff_slice_thread_execute_with_mainfunc(AVCodecContext *avctx,
+ int (*action_func2)(AVCodecContext *c, void *arg, int jobnr, int threadnr),
+ int (*main_func)(AVCodecContext *c), void *arg, int *ret, int job_count);
void ff_thread_free(AVCodecContext *s);
-
int ff_alloc_entries(AVCodecContext *avctx, int count);
void ff_reset_entries(AVCodecContext *avctx);
void ff_thread_report_progress2(AVCodecContext *avctx, int field, int thread, int n);
diff --git a/media/ffvpx/libavcodec/utils.c b/media/ffvpx/libavcodec/utils.c
index 87de15fc62..0c47e761f6 100644
--- a/media/ffvpx/libavcodec/utils.c
+++ b/media/ffvpx/libavcodec/utils.c
@@ -44,6 +44,7 @@
#include "libavutil/dict.h"
#include "libavutil/thread.h"
#include "avcodec.h"
+#include "decode.h"
#include "libavutil/opt.h"
#include "me_cmp.h"
#include "mpegvideo.h"
@@ -172,7 +173,7 @@ int av_codec_is_encoder(const AVCodec *codec)
int av_codec_is_decoder(const AVCodec *codec)
{
- return codec && (codec->decode || codec->send_packet);
+ return codec && (codec->decode || codec->receive_frame);
}
av_cold void avcodec_register(AVCodec *codec)
@@ -209,7 +210,7 @@ void avcodec_set_dimensions(AVCodecContext *s, int width, int height)
int ff_set_dimensions(AVCodecContext *s, int width, int height)
{
- int ret = av_image_check_size(width, height, 0, s);
+ int ret = av_image_check_size2(width, height, s->max_pixels, AV_PIX_FMT_NONE, 0, s);
if (ret < 0)
width = height = 0;
@@ -376,6 +377,10 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
w_align = 4;
h_align = 4;
}
+ if (s->codec_id == AV_CODEC_ID_INTERPLAY_VIDEO) {
+ w_align = 8;
+ h_align = 8;
+ }
break;
case AV_PIX_FMT_PAL8:
case AV_PIX_FMT_BGR8:
@@ -385,7 +390,8 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
w_align = 4;
h_align = 4;
}
- if (s->codec_id == AV_CODEC_ID_JV) {
+ if (s->codec_id == AV_CODEC_ID_JV ||
+ s->codec_id == AV_CODEC_ID_INTERPLAY_VIDEO) {
w_align = 8;
h_align = 8;
}
@@ -503,200 +509,6 @@ int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels,
return ret;
}
-static int update_frame_pool(AVCodecContext *avctx, AVFrame *frame)
-{
- FramePool *pool = avctx->internal->pool;
- int i, ret;
-
- switch (avctx->codec_type) {
- case AVMEDIA_TYPE_VIDEO: {
- uint8_t *data[4];
- int linesize[4];
- int size[4] = { 0 };
- int w = frame->width;
- int h = frame->height;
- int tmpsize, unaligned;
-
- if (pool->format == frame->format &&
- pool->width == frame->width && pool->height == frame->height)
- return 0;
-
- avcodec_align_dimensions2(avctx, &w, &h, pool->stride_align);
-
- do {
- // NOTE: do not align linesizes individually, this breaks e.g. assumptions
- // that linesize[0] == 2*linesize[1] in the MPEG-encoder for 4:2:2
- ret = av_image_fill_linesizes(linesize, avctx->pix_fmt, w);
- if (ret < 0)
- return ret;
- // increase alignment of w for next try (rhs gives the lowest bit set in w)
- w += w & ~(w - 1);
-
- unaligned = 0;
- for (i = 0; i < 4; i++)
- unaligned |= linesize[i] % pool->stride_align[i];
- } while (unaligned);
-
- tmpsize = av_image_fill_pointers(data, avctx->pix_fmt, h,
- NULL, linesize);
- if (tmpsize < 0)
- return -1;
-
- for (i = 0; i < 3 && data[i + 1]; i++)
- size[i] = data[i + 1] - data[i];
- size[i] = tmpsize - (data[i] - data[0]);
-
- for (i = 0; i < 4; i++) {
- av_buffer_pool_uninit(&pool->pools[i]);
- pool->linesize[i] = linesize[i];
- if (size[i]) {
- pool->pools[i] = av_buffer_pool_init(size[i] + 16 + STRIDE_ALIGN - 1,
- CONFIG_MEMORY_POISONING ?
- NULL :
- av_buffer_allocz);
- if (!pool->pools[i]) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
- }
- }
- pool->format = frame->format;
- pool->width = frame->width;
- pool->height = frame->height;
-
- break;
- }
- case AVMEDIA_TYPE_AUDIO: {
- int ch = av_frame_get_channels(frame); //av_get_channel_layout_nb_channels(frame->channel_layout);
- int planar = av_sample_fmt_is_planar(frame->format);
- int planes = planar ? ch : 1;
-
- if (pool->format == frame->format && pool->planes == planes &&
- pool->channels == ch && frame->nb_samples == pool->samples)
- return 0;
-
- av_buffer_pool_uninit(&pool->pools[0]);
- ret = av_samples_get_buffer_size(&pool->linesize[0], ch,
- frame->nb_samples, frame->format, 0);
- if (ret < 0)
- goto fail;
-
- pool->pools[0] = av_buffer_pool_init(pool->linesize[0], NULL);
- if (!pool->pools[0]) {
- ret = AVERROR(ENOMEM);
- goto fail;
- }
-
- pool->format = frame->format;
- pool->planes = planes;
- pool->channels = ch;
- pool->samples = frame->nb_samples;
- break;
- }
- default: av_assert0(0);
- }
- return 0;
-fail:
- for (i = 0; i < 4; i++)
- av_buffer_pool_uninit(&pool->pools[i]);
- pool->format = -1;
- pool->planes = pool->channels = pool->samples = 0;
- pool->width = pool->height = 0;
- return ret;
-}
-
-static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame)
-{
- FramePool *pool = avctx->internal->pool;
- int planes = pool->planes;
- int i;
-
- frame->linesize[0] = pool->linesize[0];
-
- if (planes > AV_NUM_DATA_POINTERS) {
- frame->extended_data = av_mallocz_array(planes, sizeof(*frame->extended_data));
- frame->nb_extended_buf = planes - AV_NUM_DATA_POINTERS;
- frame->extended_buf = av_mallocz_array(frame->nb_extended_buf,
- sizeof(*frame->extended_buf));
- if (!frame->extended_data || !frame->extended_buf) {
- av_freep(&frame->extended_data);
- av_freep(&frame->extended_buf);
- return AVERROR(ENOMEM);
- }
- } else {
- frame->extended_data = frame->data;
- av_assert0(frame->nb_extended_buf == 0);
- }
-
- for (i = 0; i < FFMIN(planes, AV_NUM_DATA_POINTERS); i++) {
- frame->buf[i] = av_buffer_pool_get(pool->pools[0]);
- if (!frame->buf[i])
- goto fail;
- frame->extended_data[i] = frame->data[i] = frame->buf[i]->data;
- }
- for (i = 0; i < frame->nb_extended_buf; i++) {
- frame->extended_buf[i] = av_buffer_pool_get(pool->pools[0]);
- if (!frame->extended_buf[i])
- goto fail;
- frame->extended_data[i + AV_NUM_DATA_POINTERS] = frame->extended_buf[i]->data;
- }
-
- if (avctx->debug & FF_DEBUG_BUFFERS)
- av_log(avctx, AV_LOG_DEBUG, "default_get_buffer called on frame %p", frame);
-
- return 0;
-fail:
- av_frame_unref(frame);
- return AVERROR(ENOMEM);
-}
-
-static int video_get_buffer(AVCodecContext *s, AVFrame *pic)
-{
- FramePool *pool = s->internal->pool;
- const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pic->format);
- int i;
-
- if (pic->data[0] || pic->data[1] || pic->data[2] || pic->data[3]) {
- av_log(s, AV_LOG_ERROR, "pic->data[*]!=NULL in avcodec_default_get_buffer\n");
- return -1;
- }
-
- if (!desc) {
- av_log(s, AV_LOG_ERROR,
- "Unable to get pixel format descriptor for format %s\n",
- av_get_pix_fmt_name(pic->format));
- return AVERROR(EINVAL);
- }
-
- memset(pic->data, 0, sizeof(pic->data));
- pic->extended_data = pic->data;
-
- for (i = 0; i < 4 && pool->pools[i]; i++) {
- pic->linesize[i] = pool->linesize[i];
-
- pic->buf[i] = av_buffer_pool_get(pool->pools[i]);
- if (!pic->buf[i])
- goto fail;
-
- pic->data[i] = pic->buf[i]->data;
- }
- for (; i < AV_NUM_DATA_POINTERS; i++) {
- pic->data[i] = NULL;
- pic->linesize[i] = 0;
- }
- if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
- desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL)
- avpriv_set_systematic_pal2((uint32_t *)pic->data[1], pic->format);
-
- if (s->debug & FF_DEBUG_BUFFERS)
- av_log(s, AV_LOG_DEBUG, "default_get_buffer called on pic %p\n", pic);
-
- return 0;
-fail:
- av_frame_unref(pic);
- return AVERROR(ENOMEM);
-}
-
void ff_color_frame(AVFrame *frame, const int c[4])
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
@@ -720,287 +532,6 @@ void ff_color_frame(AVFrame *frame, const int c[4])
}
}
-int avcodec_default_get_buffer2(AVCodecContext *avctx, AVFrame *frame, int flags)
-{
- int ret;
-
- if (avctx->hw_frames_ctx)
- return av_hwframe_get_buffer(avctx->hw_frames_ctx, frame, 0);
-
- if ((ret = update_frame_pool(avctx, frame)) < 0)
- return ret;
-
- switch (avctx->codec_type) {
- case AVMEDIA_TYPE_VIDEO:
- return video_get_buffer(avctx, frame);
- case AVMEDIA_TYPE_AUDIO:
- return audio_get_buffer(avctx, frame);
- default:
- return -1;
- }
-}
-
-static int add_metadata_from_side_data(AVPacket *avpkt, AVFrame *frame)
-{
- int size;
- const uint8_t *side_metadata;
-
- AVDictionary **frame_md = avpriv_frame_get_metadatap(frame);
-
- side_metadata = av_packet_get_side_data(avpkt,
- AV_PKT_DATA_STRINGS_METADATA, &size);
- return av_packet_unpack_dictionary(side_metadata, size, frame_md);
-}
-
-int ff_init_buffer_info(AVCodecContext *avctx, AVFrame *frame)
-{
- AVPacket *pkt = avctx->internal->pkt;
- int i;
- static const struct {
- enum AVPacketSideDataType packet;
- enum AVFrameSideDataType frame;
- } sd[] = {
- { AV_PKT_DATA_REPLAYGAIN , AV_FRAME_DATA_REPLAYGAIN },
- { AV_PKT_DATA_DISPLAYMATRIX, AV_FRAME_DATA_DISPLAYMATRIX },
- { AV_PKT_DATA_STEREO3D, AV_FRAME_DATA_STEREO3D },
- { AV_PKT_DATA_AUDIO_SERVICE_TYPE, AV_FRAME_DATA_AUDIO_SERVICE_TYPE },
- { AV_PKT_DATA_MASTERING_DISPLAY_METADATA, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA },
- };
-
- if (pkt) {
- frame->pts = pkt->pts;
-#if FF_API_PKT_PTS
-FF_DISABLE_DEPRECATION_WARNINGS
- frame->pkt_pts = pkt->pts;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
- av_frame_set_pkt_pos (frame, pkt->pos);
- av_frame_set_pkt_duration(frame, pkt->duration);
- av_frame_set_pkt_size (frame, pkt->size);
-
- for (i = 0; i < FF_ARRAY_ELEMS(sd); i++) {
- int size;
- uint8_t *packet_sd = av_packet_get_side_data(pkt, sd[i].packet, &size);
- if (packet_sd) {
- AVFrameSideData *frame_sd = av_frame_new_side_data(frame,
- sd[i].frame,
- size);
- if (!frame_sd)
- return AVERROR(ENOMEM);
-
- memcpy(frame_sd->data, packet_sd, size);
- }
- }
- add_metadata_from_side_data(pkt, frame);
-
- if (pkt->flags & AV_PKT_FLAG_DISCARD) {
- frame->flags |= AV_FRAME_FLAG_DISCARD;
- } else {
- frame->flags = (frame->flags & ~AV_FRAME_FLAG_DISCARD);
- }
- } else {
- frame->pts = AV_NOPTS_VALUE;
-#if FF_API_PKT_PTS
-FF_DISABLE_DEPRECATION_WARNINGS
- frame->pkt_pts = AV_NOPTS_VALUE;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
- av_frame_set_pkt_pos (frame, -1);
- av_frame_set_pkt_duration(frame, 0);
- av_frame_set_pkt_size (frame, -1);
- }
- frame->reordered_opaque = avctx->reordered_opaque;
-
- if (frame->color_primaries == AVCOL_PRI_UNSPECIFIED)
- frame->color_primaries = avctx->color_primaries;
- if (frame->color_trc == AVCOL_TRC_UNSPECIFIED)
- frame->color_trc = avctx->color_trc;
- if (av_frame_get_colorspace(frame) == AVCOL_SPC_UNSPECIFIED)
- av_frame_set_colorspace(frame, avctx->colorspace);
- if (av_frame_get_color_range(frame) == AVCOL_RANGE_UNSPECIFIED)
- av_frame_set_color_range(frame, avctx->color_range);
- if (frame->chroma_location == AVCHROMA_LOC_UNSPECIFIED)
- frame->chroma_location = avctx->chroma_sample_location;
-
- switch (avctx->codec->type) {
- case AVMEDIA_TYPE_VIDEO:
- frame->format = avctx->pix_fmt;
- if (!frame->sample_aspect_ratio.num)
- frame->sample_aspect_ratio = avctx->sample_aspect_ratio;
-
- if (frame->width && frame->height &&
- av_image_check_sar(frame->width, frame->height,
- frame->sample_aspect_ratio) < 0) {
- av_log(avctx, AV_LOG_WARNING, "ignoring invalid SAR: %u/%u\n",
- frame->sample_aspect_ratio.num,
- frame->sample_aspect_ratio.den);
- frame->sample_aspect_ratio = (AVRational){ 0, 1 };
- }
-
- break;
- case AVMEDIA_TYPE_AUDIO:
- if (!frame->sample_rate)
- frame->sample_rate = avctx->sample_rate;
- if (frame->format < 0)
- frame->format = avctx->sample_fmt;
- if (!frame->channel_layout) {
- if (avctx->channel_layout) {
- if (av_get_channel_layout_nb_channels(avctx->channel_layout) !=
- avctx->channels) {
- av_log(avctx, AV_LOG_ERROR, "Inconsistent channel "
- "configuration.\n");
- return AVERROR(EINVAL);
- }
-
- frame->channel_layout = avctx->channel_layout;
- } else {
- if (avctx->channels > FF_SANE_NB_CHANNELS) {
- av_log(avctx, AV_LOG_ERROR, "Too many channels: %d.\n",
- avctx->channels);
- return AVERROR(ENOSYS);
- }
- }
- }
- av_frame_set_channels(frame, avctx->channels);
- break;
- }
- return 0;
-}
-
-int ff_decode_frame_props(AVCodecContext *avctx, AVFrame *frame)
-{
- return ff_init_buffer_info(avctx, frame);
-}
-
-static void validate_avframe_allocation(AVCodecContext *avctx, AVFrame *frame)
-{
- if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
- int i;
- int num_planes = av_pix_fmt_count_planes(frame->format);
- const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
- int flags = desc ? desc->flags : 0;
- if (num_planes == 1 && (flags & AV_PIX_FMT_FLAG_PAL))
- num_planes = 2;
- for (i = 0; i < num_planes; i++) {
- av_assert0(frame->data[i]);
- }
- // For now do not enforce anything for palette of pseudopal formats
- if (num_planes == 1 && (flags & AV_PIX_FMT_FLAG_PSEUDOPAL))
- num_planes = 2;
- // For formats without data like hwaccel allow unused pointers to be non-NULL.
- for (i = num_planes; num_planes > 0 && i < FF_ARRAY_ELEMS(frame->data); i++) {
- if (frame->data[i])
- av_log(avctx, AV_LOG_ERROR, "Buffer returned by get_buffer2() did not zero unused plane pointers\n");
- frame->data[i] = NULL;
- }
- }
-}
-
-static int get_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags)
-{
- const AVHWAccel *hwaccel = avctx->hwaccel;
- int override_dimensions = 1;
- int ret;
-
- if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
- if ((ret = av_image_check_size(avctx->width, avctx->height, 0, avctx)) < 0 || avctx->pix_fmt<0) {
- av_log(avctx, AV_LOG_ERROR, "video_get_buffer: image parameters invalid\n");
- return AVERROR(EINVAL);
- }
-
- if (frame->width <= 0 || frame->height <= 0) {
- frame->width = FFMAX(avctx->width, AV_CEIL_RSHIFT(avctx->coded_width, avctx->lowres));
- frame->height = FFMAX(avctx->height, AV_CEIL_RSHIFT(avctx->coded_height, avctx->lowres));
- override_dimensions = 0;
- }
-
- if (frame->data[0] || frame->data[1] || frame->data[2] || frame->data[3]) {
- av_log(avctx, AV_LOG_ERROR, "pic->data[*]!=NULL in get_buffer_internal\n");
- return AVERROR(EINVAL);
- }
- }
- ret = ff_decode_frame_props(avctx, frame);
- if (ret < 0)
- return ret;
-
- if (hwaccel) {
- if (hwaccel->alloc_frame) {
- ret = hwaccel->alloc_frame(avctx, frame);
- goto end;
- }
- } else
- avctx->sw_pix_fmt = avctx->pix_fmt;
-
- ret = avctx->get_buffer2(avctx, frame, flags);
- if (ret >= 0)
- validate_avframe_allocation(avctx, frame);
-
-end:
- if (avctx->codec_type == AVMEDIA_TYPE_VIDEO && !override_dimensions) {
- frame->width = avctx->width;
- frame->height = avctx->height;
- }
-
- return ret;
-}
-
-int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags)
-{
- int ret = get_buffer_internal(avctx, frame, flags);
- if (ret < 0) {
- av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
- frame->width = frame->height = 0;
- }
- return ret;
-}
-
-static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame)
-{
- AVFrame *tmp;
- int ret;
-
- av_assert0(avctx->codec_type == AVMEDIA_TYPE_VIDEO);
-
- if (frame->data[0] && (frame->width != avctx->width || frame->height != avctx->height || frame->format != avctx->pix_fmt)) {
- av_log(avctx, AV_LOG_WARNING, "Picture changed from size:%dx%d fmt:%s to size:%dx%d fmt:%s in reget buffer()\n",
- frame->width, frame->height, av_get_pix_fmt_name(frame->format), avctx->width, avctx->height, av_get_pix_fmt_name(avctx->pix_fmt));
- av_frame_unref(frame);
- }
-
- ff_init_buffer_info(avctx, frame);
-
- if (!frame->data[0])
- return ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF);
-
- if (av_frame_is_writable(frame))
- return ff_decode_frame_props(avctx, frame);
-
- tmp = av_frame_alloc();
- if (!tmp)
- return AVERROR(ENOMEM);
-
- av_frame_move_ref(tmp, frame);
-
- ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF);
- if (ret < 0) {
- av_frame_free(&tmp);
- return ret;
- }
-
- av_frame_copy(frame, tmp);
- av_frame_free(&tmp);
-
- return 0;
-}
-
-int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame)
-{
- int ret = reget_buffer_internal(avctx, frame);
- if (ret < 0)
- av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n");
- return ret;
-}
-
int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2), void *arg, int *ret, int count, int size)
{
int i;
@@ -1038,145 +569,6 @@ enum AVPixelFormat avpriv_find_pix_fmt(const PixelFormatTag *tags,
return AV_PIX_FMT_NONE;
}
-static int is_hwaccel_pix_fmt(enum AVPixelFormat pix_fmt)
-{
- const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
- return desc->flags & AV_PIX_FMT_FLAG_HWACCEL;
-}
-
-enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat *fmt)
-{
- while (*fmt != AV_PIX_FMT_NONE && is_hwaccel_pix_fmt(*fmt))
- ++fmt;
- return fmt[0];
-}
-
-static AVHWAccel *find_hwaccel(enum AVCodecID codec_id,
- enum AVPixelFormat pix_fmt)
-{
- AVHWAccel *hwaccel = NULL;
-
- while ((hwaccel = av_hwaccel_next(hwaccel)))
- if (hwaccel->id == codec_id
- && hwaccel->pix_fmt == pix_fmt)
- return hwaccel;
- return NULL;
-}
-
-static int setup_hwaccel(AVCodecContext *avctx,
- const enum AVPixelFormat fmt,
- const char *name)
-{
- AVHWAccel *hwa = find_hwaccel(avctx->codec_id, fmt);
- int ret = 0;
-
- if (avctx->active_thread_type & FF_THREAD_FRAME) {
- av_log(avctx, AV_LOG_WARNING,
- "Hardware accelerated decoding with frame threading is known to be unstable and its use is discouraged.\n");
- }
-
- if (!hwa) {
- av_log(avctx, AV_LOG_ERROR,
- "Could not find an AVHWAccel for the pixel format: %s",
- name);
- return AVERROR(ENOENT);
- }
-
- if (hwa->capabilities & HWACCEL_CODEC_CAP_EXPERIMENTAL &&
- avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) {
- av_log(avctx, AV_LOG_WARNING, "Ignoring experimental hwaccel: %s\n",
- hwa->name);
- return AVERROR_PATCHWELCOME;
- }
-
- if (hwa->priv_data_size) {
- avctx->internal->hwaccel_priv_data = av_mallocz(hwa->priv_data_size);
- if (!avctx->internal->hwaccel_priv_data)
- return AVERROR(ENOMEM);
- }
-
- if (hwa->init) {
- ret = hwa->init(avctx);
- if (ret < 0) {
- av_freep(&avctx->internal->hwaccel_priv_data);
- return ret;
- }
- }
-
- avctx->hwaccel = hwa;
-
- return 0;
-}
-
-int ff_get_format(AVCodecContext *avctx, const enum AVPixelFormat *fmt)
-{
- const AVPixFmtDescriptor *desc;
- enum AVPixelFormat *choices;
- enum AVPixelFormat ret;
- unsigned n = 0;
-
- while (fmt[n] != AV_PIX_FMT_NONE)
- ++n;
-
- av_assert0(n >= 1);
- avctx->sw_pix_fmt = fmt[n - 1];
- av_assert2(!is_hwaccel_pix_fmt(avctx->sw_pix_fmt));
-
- choices = av_malloc_array(n + 1, sizeof(*choices));
- if (!choices)
- return AV_PIX_FMT_NONE;
-
- memcpy(choices, fmt, (n + 1) * sizeof(*choices));
-
- for (;;) {
- if (avctx->hwaccel && avctx->hwaccel->uninit)
- avctx->hwaccel->uninit(avctx);
- av_freep(&avctx->internal->hwaccel_priv_data);
- avctx->hwaccel = NULL;
-
- av_buffer_unref(&avctx->hw_frames_ctx);
-
- ret = avctx->get_format(avctx, choices);
-
- desc = av_pix_fmt_desc_get(ret);
- if (!desc) {
- ret = AV_PIX_FMT_NONE;
- break;
- }
-
- if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL))
- break;
-#if FF_API_CAP_VDPAU
- if (avctx->codec->capabilities&AV_CODEC_CAP_HWACCEL_VDPAU)
- break;
-#endif
-
- if (avctx->hw_frames_ctx) {
- AVHWFramesContext *hw_frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data;
- if (hw_frames_ctx->format != ret) {
- av_log(avctx, AV_LOG_ERROR, "Format returned from get_buffer() "
- "does not match the format of provided AVHWFramesContext\n");
- ret = AV_PIX_FMT_NONE;
- break;
- }
- }
-
- if (!setup_hwaccel(avctx, ret, desc->name))
- break;
-
- /* Remove failed hwaccel from choices */
- for (n = 0; choices[n] != ret; n++)
- av_assert0(choices[n] != AV_PIX_FMT_NONE);
-
- do
- choices[n] = choices[n + 1];
- while (choices[n++] != AV_PIX_FMT_NONE);
- }
-
- av_freep(&choices);
- return ret;
-}
-
MAKE_ACCESSORS(AVCodecContext, codec, AVRational, pkt_timebase)
MAKE_ACCESSORS(AVCodecContext, codec, const AVCodecDescriptor *, codec_descriptor)
MAKE_ACCESSORS(AVCodecContext, codec, int, lowres)
@@ -1197,12 +589,6 @@ int avpriv_codec_get_cap_skip_frame_fill_param(const AVCodec *codec){
return !!(codec->caps_internal & FF_CODEC_CAP_SKIP_FRAME_FILL_PARAM);
}
-static void get_subtitle_defaults(AVSubtitle *sub)
-{
- memset(sub, 0, sizeof(*sub));
- sub->pts = AV_NOPTS_VALUE;
-}
-
static int64_t get_bit_rate(AVCodecContext *ctx)
{
int64_t bit_rate;
@@ -1269,7 +655,7 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
if (ret < 0)
return ret;
- avctx->internal = av_mallocz(sizeof(AVCodecInternal));
+ avctx->internal = av_mallocz(sizeof(*avctx->internal));
if (!avctx->internal) {
ret = AVERROR(ENOMEM);
goto end;
@@ -1287,6 +673,12 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
goto free_and_end;
}
+ avctx->internal->compat_decode_frame = av_frame_alloc();
+ if (!avctx->internal->compat_decode_frame) {
+ ret = AVERROR(ENOMEM);
+ goto free_and_end;
+ }
+
avctx->internal->buffer_frame = av_frame_alloc();
if (!avctx->internal->buffer_frame) {
ret = AVERROR(ENOMEM);
@@ -1299,6 +691,20 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
goto free_and_end;
}
+ avctx->internal->ds.in_pkt = av_packet_alloc();
+ if (!avctx->internal->ds.in_pkt) {
+ ret = AVERROR(ENOMEM);
+ goto free_and_end;
+ }
+
+ avctx->internal->last_pkt_props = av_packet_alloc();
+ if (!avctx->internal->last_pkt_props) {
+ ret = AVERROR(ENOMEM);
+ goto free_and_end;
+ }
+
+ avctx->internal->skip_samples_multiplier = 1;
+
if (codec->priv_data_size > 0) {
if (!avctx->priv_data) {
avctx->priv_data = av_mallocz(codec->priv_data_size);
@@ -1337,8 +743,8 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, const AVCodec *code
}
if ((avctx->coded_width || avctx->coded_height || avctx->width || avctx->height)
- && ( av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx) < 0
- || av_image_check_size(avctx->width, avctx->height, 0, avctx) < 0)) {
+ && ( av_image_check_size2(avctx->coded_width, avctx->coded_height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx) < 0
+ || av_image_check_size2(avctx->width, avctx->height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx) < 0)) {
av_log(avctx, AV_LOG_WARNING, "Ignoring invalid width/height values\n");
ff_set_dimensions(avctx, 0, 0);
}
@@ -1561,11 +967,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
}
if ( (avctx->codec_type == AVMEDIA_TYPE_VIDEO || avctx->codec_type == AVMEDIA_TYPE_AUDIO)
&& avctx->bit_rate>0 && avctx->bit_rate<1000) {
- av_log(avctx, AV_LOG_WARNING, "Bitrate %"PRId64" is extremely low, maybe you mean %"PRId64"k\n", (int64_t)avctx->bit_rate, (int64_t)avctx->bit_rate);
+ av_log(avctx, AV_LOG_WARNING, "Bitrate %"PRId64" is extremely low, maybe you mean %"PRId64"k\n", avctx->bit_rate, avctx->bit_rate);
}
if (!avctx->rc_initial_buffer_occupancy)
- avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3 / 4;
+ avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3LL / 4;
if (avctx->ticks_per_frame && avctx->time_base.num &&
avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) {
@@ -1585,6 +991,17 @@ FF_ENABLE_DEPRECATION_WARNINGS
ret = AVERROR(EINVAL);
goto free_and_end;
}
+ if (avctx->sw_pix_fmt != AV_PIX_FMT_NONE &&
+ avctx->sw_pix_fmt != frames_ctx->sw_format) {
+ av_log(avctx, AV_LOG_ERROR,
+ "Mismatching AVCodecContext.sw_pix_fmt (%s) "
+ "and AVHWFramesContext.sw_format (%s)\n",
+ av_get_pix_fmt_name(avctx->sw_pix_fmt),
+ av_get_pix_fmt_name(frames_ctx->sw_format));
+ ret = AVERROR(EINVAL);
+ goto free_and_end;
+ }
+ avctx->sw_pix_fmt = frames_ctx->sw_format;
}
}
@@ -1709,9 +1126,14 @@ FF_ENABLE_DEPRECATION_WARNINGS
av_dict_free(&tmp);
av_freep(&avctx->priv_data);
if (avctx->internal) {
- av_packet_free(&avctx->internal->buffer_pkt);
- av_frame_free(&avctx->internal->buffer_frame);
av_frame_free(&avctx->internal->to_free);
+ av_frame_free(&avctx->internal->compat_decode_frame);
+ av_frame_free(&avctx->internal->buffer_frame);
+ av_packet_free(&avctx->internal->buffer_pkt);
+ av_packet_free(&avctx->internal->last_pkt_props);
+
+ av_packet_free(&avctx->internal->ds.in_pkt);
+
av_freep(&avctx->internal->pool);
}
av_freep(&avctx->internal);
@@ -1719,1032 +1141,6 @@ FF_ENABLE_DEPRECATION_WARNINGS
goto end;
}
-int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int64_t size, int64_t min_size)
-{
- if (avpkt->size < 0) {
- av_log(avctx, AV_LOG_ERROR, "Invalid negative user packet size %d\n", avpkt->size);
- return AVERROR(EINVAL);
- }
- if (size < 0 || size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE) {
- av_log(avctx, AV_LOG_ERROR, "Invalid minimum required packet size %"PRId64" (max allowed is %d)\n",
- size, INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE);
- return AVERROR(EINVAL);
- }
-
- if (avctx && 2*min_size < size) { // FIXME The factor needs to be finetuned
- av_assert0(!avpkt->data || avpkt->data != avctx->internal->byte_buffer);
- if (!avpkt->data || avpkt->size < size) {
- av_fast_padded_malloc(&avctx->internal->byte_buffer, &avctx->internal->byte_buffer_size, size);
- avpkt->data = avctx->internal->byte_buffer;
- avpkt->size = avctx->internal->byte_buffer_size;
- }
- }
-
- if (avpkt->data) {
- AVBufferRef *buf = avpkt->buf;
-
- if (avpkt->size < size) {
- av_log(avctx, AV_LOG_ERROR, "User packet is too small (%d < %"PRId64")\n", avpkt->size, size);
- return AVERROR(EINVAL);
- }
-
- av_init_packet(avpkt);
- avpkt->buf = buf;
- avpkt->size = size;
- return 0;
- } else {
- int ret = av_new_packet(avpkt, size);
- if (ret < 0)
- av_log(avctx, AV_LOG_ERROR, "Failed to allocate packet of size %"PRId64"\n", size);
- return ret;
- }
-}
-
-int ff_alloc_packet(AVPacket *avpkt, int size)
-{
- return ff_alloc_packet2(NULL, avpkt, size, 0);
-}
-
-/**
- * Pad last frame with silence.
- */
-static int pad_last_frame(AVCodecContext *s, AVFrame **dst, const AVFrame *src)
-{
- AVFrame *frame = NULL;
- int ret;
-
- if (!(frame = av_frame_alloc()))
- return AVERROR(ENOMEM);
-
- frame->format = src->format;
- frame->channel_layout = src->channel_layout;
- av_frame_set_channels(frame, av_frame_get_channels(src));
- frame->nb_samples = s->frame_size;
- ret = av_frame_get_buffer(frame, 32);
- if (ret < 0)
- goto fail;
-
- ret = av_frame_copy_props(frame, src);
- if (ret < 0)
- goto fail;
-
- if ((ret = av_samples_copy(frame->extended_data, src->extended_data, 0, 0,
- src->nb_samples, s->channels, s->sample_fmt)) < 0)
- goto fail;
- if ((ret = av_samples_set_silence(frame->extended_data, src->nb_samples,
- frame->nb_samples - src->nb_samples,
- s->channels, s->sample_fmt)) < 0)
- goto fail;
-
- *dst = frame;
-
- return 0;
-
-fail:
- av_frame_free(&frame);
- return ret;
-}
-
-int attribute_align_arg avcodec_encode_audio2(AVCodecContext *avctx,
- AVPacket *avpkt,
- const AVFrame *frame,
- int *got_packet_ptr)
-{
- AVFrame *extended_frame = NULL;
- AVFrame *padded_frame = NULL;
- int ret;
- AVPacket user_pkt = *avpkt;
- int needs_realloc = !user_pkt.data;
-
- *got_packet_ptr = 0;
-
- if (!avctx->codec->encode2) {
- av_log(avctx, AV_LOG_ERROR, "This encoder requires using the avcodec_send_frame() API.\n");
- return AVERROR(ENOSYS);
- }
-
- if (!(avctx->codec->capabilities & AV_CODEC_CAP_DELAY) && !frame) {
- av_packet_unref(avpkt);
- av_init_packet(avpkt);
- return 0;
- }
-
- /* ensure that extended_data is properly set */
- if (frame && !frame->extended_data) {
- if (av_sample_fmt_is_planar(avctx->sample_fmt) &&
- avctx->channels > AV_NUM_DATA_POINTERS) {
- av_log(avctx, AV_LOG_ERROR, "Encoding to a planar sample format, "
- "with more than %d channels, but extended_data is not set.\n",
- AV_NUM_DATA_POINTERS);
- return AVERROR(EINVAL);
- }
- av_log(avctx, AV_LOG_WARNING, "extended_data is not set.\n");
-
- extended_frame = av_frame_alloc();
- if (!extended_frame)
- return AVERROR(ENOMEM);
-
- memcpy(extended_frame, frame, sizeof(AVFrame));
- extended_frame->extended_data = extended_frame->data;
- frame = extended_frame;
- }
-
- /* extract audio service type metadata */
- if (frame) {
- AVFrameSideData *sd = av_frame_get_side_data(frame, AV_FRAME_DATA_AUDIO_SERVICE_TYPE);
- if (sd && sd->size >= sizeof(enum AVAudioServiceType))
- avctx->audio_service_type = *(enum AVAudioServiceType*)sd->data;
- }
-
- /* check for valid frame size */
- if (frame) {
- if (avctx->codec->capabilities & AV_CODEC_CAP_SMALL_LAST_FRAME) {
- if (frame->nb_samples > avctx->frame_size) {
- av_log(avctx, AV_LOG_ERROR, "more samples than frame size (avcodec_encode_audio2)\n");
- ret = AVERROR(EINVAL);
- goto end;
- }
- } else if (!(avctx->codec->capabilities & AV_CODEC_CAP_VARIABLE_FRAME_SIZE)) {
- if (frame->nb_samples < avctx->frame_size &&
- !avctx->internal->last_audio_frame) {
- ret = pad_last_frame(avctx, &padded_frame, frame);
- if (ret < 0)
- goto end;
-
- frame = padded_frame;
- avctx->internal->last_audio_frame = 1;
- }
-
- if (frame->nb_samples != avctx->frame_size) {
- av_log(avctx, AV_LOG_ERROR, "nb_samples (%d) != frame_size (%d) (avcodec_encode_audio2)\n", frame->nb_samples, avctx->frame_size);
- ret = AVERROR(EINVAL);
- goto end;
- }
- }
- }
-
- av_assert0(avctx->codec->encode2);
-
- ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr);
- if (!ret) {
- if (*got_packet_ptr) {
- if (!(avctx->codec->capabilities & AV_CODEC_CAP_DELAY)) {
- if (avpkt->pts == AV_NOPTS_VALUE)
- avpkt->pts = frame->pts;
- if (!avpkt->duration)
- avpkt->duration = ff_samples_to_time_base(avctx,
- frame->nb_samples);
- }
- avpkt->dts = avpkt->pts;
- } else {
- avpkt->size = 0;
- }
- }
- if (avpkt->data && avpkt->data == avctx->internal->byte_buffer) {
- needs_realloc = 0;
- if (user_pkt.data) {
- if (user_pkt.size >= avpkt->size) {
- memcpy(user_pkt.data, avpkt->data, avpkt->size);
- } else {
- av_log(avctx, AV_LOG_ERROR, "Provided packet is too small, needs to be %d\n", avpkt->size);
- avpkt->size = user_pkt.size;
- ret = -1;
- }
- avpkt->buf = user_pkt.buf;
- avpkt->data = user_pkt.data;
- } else {
- if (av_dup_packet(avpkt) < 0) {
- ret = AVERROR(ENOMEM);
- }
- }
- }
-
- if (!ret) {
- if (needs_realloc && avpkt->data) {
- ret = av_buffer_realloc(&avpkt->buf, avpkt->size + AV_INPUT_BUFFER_PADDING_SIZE);
- if (ret >= 0)
- avpkt->data = avpkt->buf->data;
- }
-
- avctx->frame_number++;
- }
-
- if (ret < 0 || !*got_packet_ptr) {
- av_packet_unref(avpkt);
- av_init_packet(avpkt);
- goto end;
- }
-
- /* NOTE: if we add any audio encoders which output non-keyframe packets,
- * this needs to be moved to the encoders, but for now we can do it
- * here to simplify things */
- avpkt->flags |= AV_PKT_FLAG_KEY;
-
-end:
- av_frame_free(&padded_frame);
- av_free(extended_frame);
-
-#if FF_API_AUDIOENC_DELAY
- avctx->delay = avctx->initial_padding;
-#endif
-
- return ret;
-}
-
-int attribute_align_arg avcodec_encode_video2(AVCodecContext *avctx,
- AVPacket *avpkt,
- const AVFrame *frame,
- int *got_packet_ptr)
-{
- int ret;
- AVPacket user_pkt = *avpkt;
- int needs_realloc = !user_pkt.data;
-
- *got_packet_ptr = 0;
-
- if (!avctx->codec->encode2) {
- av_log(avctx, AV_LOG_ERROR, "This encoder requires using the avcodec_send_frame() API.\n");
- return AVERROR(ENOSYS);
- }
-
- if(CONFIG_FRAME_THREAD_ENCODER &&
- avctx->internal->frame_thread_encoder && (avctx->active_thread_type&FF_THREAD_FRAME))
- return ff_thread_video_encode_frame(avctx, avpkt, frame, got_packet_ptr);
-
- if ((avctx->flags&AV_CODEC_FLAG_PASS1) && avctx->stats_out)
- avctx->stats_out[0] = '\0';
-
- if (!(avctx->codec->capabilities & AV_CODEC_CAP_DELAY) && !frame) {
- av_packet_unref(avpkt);
- av_init_packet(avpkt);
- avpkt->size = 0;
- return 0;
- }
-
- if (av_image_check_size(avctx->width, avctx->height, 0, avctx))
- return AVERROR(EINVAL);
-
- if (frame && frame->format == AV_PIX_FMT_NONE)
- av_log(avctx, AV_LOG_WARNING, "AVFrame.format is not set\n");
- if (frame && (frame->width == 0 || frame->height == 0))
- av_log(avctx, AV_LOG_WARNING, "AVFrame.width or height is not set\n");
-
- av_assert0(avctx->codec->encode2);
-
- ret = avctx->codec->encode2(avctx, avpkt, frame, got_packet_ptr);
- av_assert0(ret <= 0);
-
- emms_c();
-
- if (avpkt->data && avpkt->data == avctx->internal->byte_buffer) {
- needs_realloc = 0;
- if (user_pkt.data) {
- if (user_pkt.size >= avpkt->size) {
- memcpy(user_pkt.data, avpkt->data, avpkt->size);
- } else {
- av_log(avctx, AV_LOG_ERROR, "Provided packet is too small, needs to be %d\n", avpkt->size);
- avpkt->size = user_pkt.size;
- ret = -1;
- }
- avpkt->buf = user_pkt.buf;
- avpkt->data = user_pkt.data;
- } else {
- if (av_dup_packet(avpkt) < 0) {
- ret = AVERROR(ENOMEM);
- }
- }
- }
-
- if (!ret) {
- if (!*got_packet_ptr)
- avpkt->size = 0;
- else if (!(avctx->codec->capabilities & AV_CODEC_CAP_DELAY))
- avpkt->pts = avpkt->dts = frame->pts;
-
- if (needs_realloc && avpkt->data) {
- ret = av_buffer_realloc(&avpkt->buf, avpkt->size + AV_INPUT_BUFFER_PADDING_SIZE);
- if (ret >= 0)
- avpkt->data = avpkt->buf->data;
- }
-
- avctx->frame_number++;
- }
-
- if (ret < 0 || !*got_packet_ptr)
- av_packet_unref(avpkt);
-
- return ret;
-}
-
-int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
- const AVSubtitle *sub)
-{
- int ret;
- if (sub->start_display_time) {
- av_log(avctx, AV_LOG_ERROR, "start_display_time must be 0.\n");
- return -1;
- }
-
- ret = avctx->codec->encode_sub(avctx, buf, buf_size, sub);
- avctx->frame_number++;
- return ret;
-}
-
-/**
- * Attempt to guess proper monotonic timestamps for decoded video frames
- * which might have incorrect times. Input timestamps may wrap around, in
- * which case the output will as well.
- *
- * @param pts the pts field of the decoded AVPacket, as passed through
- * AVFrame.pts
- * @param dts the dts field of the decoded AVPacket
- * @return one of the input values, may be AV_NOPTS_VALUE
- */
-static int64_t guess_correct_pts(AVCodecContext *ctx,
- int64_t reordered_pts, int64_t dts)
-{
- int64_t pts = AV_NOPTS_VALUE;
-
- if (dts != AV_NOPTS_VALUE) {
- ctx->pts_correction_num_faulty_dts += dts <= ctx->pts_correction_last_dts;
- ctx->pts_correction_last_dts = dts;
- } else if (reordered_pts != AV_NOPTS_VALUE)
- ctx->pts_correction_last_dts = reordered_pts;
-
- if (reordered_pts != AV_NOPTS_VALUE) {
- ctx->pts_correction_num_faulty_pts += reordered_pts <= ctx->pts_correction_last_pts;
- ctx->pts_correction_last_pts = reordered_pts;
- } else if(dts != AV_NOPTS_VALUE)
- ctx->pts_correction_last_pts = dts;
-
- if ((ctx->pts_correction_num_faulty_pts<=ctx->pts_correction_num_faulty_dts || dts == AV_NOPTS_VALUE)
- && reordered_pts != AV_NOPTS_VALUE)
- pts = reordered_pts;
- else
- pts = dts;
-
- return pts;
-}
-
-static int apply_param_change(AVCodecContext *avctx, AVPacket *avpkt)
-{
- int size = 0, ret;
- const uint8_t *data;
- uint32_t flags;
- int64_t val;
-
- data = av_packet_get_side_data(avpkt, AV_PKT_DATA_PARAM_CHANGE, &size);
- if (!data)
- return 0;
-
- if (!(avctx->codec->capabilities & AV_CODEC_CAP_PARAM_CHANGE)) {
- av_log(avctx, AV_LOG_ERROR, "This decoder does not support parameter "
- "changes, but PARAM_CHANGE side data was sent to it.\n");
- ret = AVERROR(EINVAL);
- goto fail2;
- }
-
- if (size < 4)
- goto fail;
-
- flags = bytestream_get_le32(&data);
- size -= 4;
-
- if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) {
- if (size < 4)
- goto fail;
- val = bytestream_get_le32(&data);
- if (val <= 0 || val > INT_MAX) {
- av_log(avctx, AV_LOG_ERROR, "Invalid channel count");
- ret = AVERROR_INVALIDDATA;
- goto fail2;
- }
- avctx->channels = val;
- size -= 4;
- }
- if (flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) {
- if (size < 8)
- goto fail;
- avctx->channel_layout = bytestream_get_le64(&data);
- size -= 8;
- }
- if (flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) {
- if (size < 4)
- goto fail;
- val = bytestream_get_le32(&data);
- if (val <= 0 || val > INT_MAX) {
- av_log(avctx, AV_LOG_ERROR, "Invalid sample rate");
- ret = AVERROR_INVALIDDATA;
- goto fail2;
- }
- avctx->sample_rate = val;
- size -= 4;
- }
- if (flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS) {
- if (size < 8)
- goto fail;
- avctx->width = bytestream_get_le32(&data);
- avctx->height = bytestream_get_le32(&data);
- size -= 8;
- ret = ff_set_dimensions(avctx, avctx->width, avctx->height);
- if (ret < 0)
- goto fail2;
- }
-
- return 0;
-fail:
- av_log(avctx, AV_LOG_ERROR, "PARAM_CHANGE side data too small.\n");
- ret = AVERROR_INVALIDDATA;
-fail2:
- if (ret < 0) {
- av_log(avctx, AV_LOG_ERROR, "Error applying parameter changes.\n");
- if (avctx->err_recognition & AV_EF_EXPLODE)
- return ret;
- }
- return 0;
-}
-
-static int unrefcount_frame(AVCodecInternal *avci, AVFrame *frame)
-{
- int ret;
-
- /* move the original frame to our backup */
- av_frame_unref(avci->to_free);
- av_frame_move_ref(avci->to_free, frame);
-
- /* now copy everything except the AVBufferRefs back
- * note that we make a COPY of the side data, so calling av_frame_free() on
- * the caller's frame will work properly */
- ret = av_frame_copy_props(frame, avci->to_free);
- if (ret < 0)
- return ret;
-
- memcpy(frame->data, avci->to_free->data, sizeof(frame->data));
- memcpy(frame->linesize, avci->to_free->linesize, sizeof(frame->linesize));
- if (avci->to_free->extended_data != avci->to_free->data) {
- int planes = av_frame_get_channels(avci->to_free);
- int size = planes * sizeof(*frame->extended_data);
-
- if (!size) {
- av_frame_unref(frame);
- return AVERROR_BUG;
- }
-
- frame->extended_data = av_malloc(size);
- if (!frame->extended_data) {
- av_frame_unref(frame);
- return AVERROR(ENOMEM);
- }
- memcpy(frame->extended_data, avci->to_free->extended_data,
- size);
- } else
- frame->extended_data = frame->data;
-
- frame->format = avci->to_free->format;
- frame->width = avci->to_free->width;
- frame->height = avci->to_free->height;
- frame->channel_layout = avci->to_free->channel_layout;
- frame->nb_samples = avci->to_free->nb_samples;
- av_frame_set_channels(frame, av_frame_get_channels(avci->to_free));
-
- return 0;
-}
-
-int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture,
- int *got_picture_ptr,
- const AVPacket *avpkt)
-{
- AVCodecInternal *avci = avctx->internal;
- int ret;
- // copy to ensure we do not change avpkt
- AVPacket tmp = *avpkt;
-
- if (!avctx->codec)
- return AVERROR(EINVAL);
- if (avctx->codec->type != AVMEDIA_TYPE_VIDEO) {
- av_log(avctx, AV_LOG_ERROR, "Invalid media type for video\n");
- return AVERROR(EINVAL);
- }
-
- if (!avctx->codec->decode) {
- av_log(avctx, AV_LOG_ERROR, "This decoder requires using the avcodec_send_packet() API.\n");
- return AVERROR(ENOSYS);
- }
-
- *got_picture_ptr = 0;
- if ((avctx->coded_width || avctx->coded_height) && av_image_check_size(avctx->coded_width, avctx->coded_height, 0, avctx))
- return AVERROR(EINVAL);
-
- avctx->internal->pkt = avpkt;
- ret = apply_param_change(avctx, avpkt);
- if (ret < 0)
- return ret;
-
- av_frame_unref(picture);
-
- if ((avctx->codec->capabilities & AV_CODEC_CAP_DELAY) || avpkt->size ||
- (avctx->active_thread_type & FF_THREAD_FRAME)) {
- int did_split = av_packet_split_side_data(&tmp);
- ret = apply_param_change(avctx, &tmp);
- if (ret < 0)
- goto fail;
-
- avctx->internal->pkt = &tmp;
- if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)
- ret = ff_thread_decode_frame(avctx, picture, got_picture_ptr,
- &tmp);
- else {
- ret = avctx->codec->decode(avctx, picture, got_picture_ptr,
- &tmp);
- if (!(avctx->codec->caps_internal & FF_CODEC_CAP_SETS_PKT_DTS))
- picture->pkt_dts = avpkt->dts;
-
- if(!avctx->has_b_frames){
- av_frame_set_pkt_pos(picture, avpkt->pos);
- }
- //FIXME these should be under if(!avctx->has_b_frames)
- /* get_buffer is supposed to set frame parameters */
- if (!(avctx->codec->capabilities & AV_CODEC_CAP_DR1)) {
- if (!picture->sample_aspect_ratio.num) picture->sample_aspect_ratio = avctx->sample_aspect_ratio;
- if (!picture->width) picture->width = avctx->width;
- if (!picture->height) picture->height = avctx->height;
- if (picture->format == AV_PIX_FMT_NONE) picture->format = avctx->pix_fmt;
- }
- }
-
-fail:
- emms_c(); //needed to avoid an emms_c() call before every return;
-
- avctx->internal->pkt = NULL;
- if (did_split) {
- av_packet_free_side_data(&tmp);
- if(ret == tmp.size)
- ret = avpkt->size;
- }
- if (picture->flags & AV_FRAME_FLAG_DISCARD) {
- *got_picture_ptr = 0;
- }
- if (*got_picture_ptr) {
- if (!avctx->refcounted_frames) {
- int err = unrefcount_frame(avci, picture);
- if (err < 0)
- return err;
- }
-
- avctx->frame_number++;
- av_frame_set_best_effort_timestamp(picture,
- guess_correct_pts(avctx,
- picture->pts,
- picture->pkt_dts));
- } else
- av_frame_unref(picture);
- } else
- ret = 0;
-
- /* many decoders assign whole AVFrames, thus overwriting extended_data;
- * make sure it's set correctly */
- av_assert0(!picture->extended_data || picture->extended_data == picture->data);
-
-#if FF_API_AVCTX_TIMEBASE
- if (avctx->framerate.num > 0 && avctx->framerate.den > 0)
- avctx->time_base = av_inv_q(av_mul_q(avctx->framerate, (AVRational){avctx->ticks_per_frame, 1}));
-#endif
-
- return ret;
-}
-
-int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
- AVFrame *frame,
- int *got_frame_ptr,
- const AVPacket *avpkt)
-{
- AVCodecInternal *avci = avctx->internal;
- int ret = 0;
-
- *got_frame_ptr = 0;
-
- if (!avctx->codec)
- return AVERROR(EINVAL);
-
- if (!avctx->codec->decode) {
- av_log(avctx, AV_LOG_ERROR, "This decoder requires using the avcodec_send_packet() API.\n");
- return AVERROR(ENOSYS);
- }
-
- if (!avpkt->data && avpkt->size) {
- av_log(avctx, AV_LOG_ERROR, "invalid packet: NULL data, size != 0\n");
- return AVERROR(EINVAL);
- }
- if (avctx->codec->type != AVMEDIA_TYPE_AUDIO) {
- av_log(avctx, AV_LOG_ERROR, "Invalid media type for audio\n");
- return AVERROR(EINVAL);
- }
-
- av_frame_unref(frame);
-
- if ((avctx->codec->capabilities & AV_CODEC_CAP_DELAY) || avpkt->size || (avctx->active_thread_type & FF_THREAD_FRAME)) {
- uint8_t *side;
- int side_size;
- uint32_t discard_padding = 0;
- uint8_t skip_reason = 0;
- uint8_t discard_reason = 0;
- // copy to ensure we do not change avpkt
- AVPacket tmp = *avpkt;
- int did_split = av_packet_split_side_data(&tmp);
- ret = apply_param_change(avctx, &tmp);
- if (ret < 0)
- goto fail;
-
- avctx->internal->pkt = &tmp;
- if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)
- ret = ff_thread_decode_frame(avctx, frame, got_frame_ptr, &tmp);
- else {
- ret = avctx->codec->decode(avctx, frame, got_frame_ptr, &tmp);
- av_assert0(ret <= tmp.size);
- frame->pkt_dts = avpkt->dts;
- }
- if (ret >= 0 && *got_frame_ptr) {
- avctx->frame_number++;
- av_frame_set_best_effort_timestamp(frame,
- guess_correct_pts(avctx,
- frame->pts,
- frame->pkt_dts));
- if (frame->format == AV_SAMPLE_FMT_NONE)
- frame->format = avctx->sample_fmt;
- if (!frame->channel_layout)
- frame->channel_layout = avctx->channel_layout;
- if (!av_frame_get_channels(frame))
- av_frame_set_channels(frame, avctx->channels);
- if (!frame->sample_rate)
- frame->sample_rate = avctx->sample_rate;
- }
-
- side= av_packet_get_side_data(avctx->internal->pkt, AV_PKT_DATA_SKIP_SAMPLES, &side_size);
- if(side && side_size>=10) {
- avctx->internal->skip_samples = AV_RL32(side);
- discard_padding = AV_RL32(side + 4);
- av_log(avctx, AV_LOG_DEBUG, "skip %d / discard %d samples due to side data\n",
- avctx->internal->skip_samples, (int)discard_padding);
- skip_reason = AV_RL8(side + 8);
- discard_reason = AV_RL8(side + 9);
- }
-
- if ((frame->flags & AV_FRAME_FLAG_DISCARD) && *got_frame_ptr &&
- !(avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL)) {
- avctx->internal->skip_samples -= frame->nb_samples;
- *got_frame_ptr = 0;
- }
-
- if (avctx->internal->skip_samples > 0 && *got_frame_ptr &&
- !(avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL)) {
- if(frame->nb_samples <= avctx->internal->skip_samples){
- *got_frame_ptr = 0;
- avctx->internal->skip_samples -= frame->nb_samples;
- av_log(avctx, AV_LOG_DEBUG, "skip whole frame, skip left: %d\n",
- avctx->internal->skip_samples);
- } else {
- av_samples_copy(frame->extended_data, frame->extended_data, 0, avctx->internal->skip_samples,
- frame->nb_samples - avctx->internal->skip_samples, avctx->channels, frame->format);
- if(avctx->pkt_timebase.num && avctx->sample_rate) {
- int64_t diff_ts = av_rescale_q(avctx->internal->skip_samples,
- (AVRational){1, avctx->sample_rate},
- avctx->pkt_timebase);
- if(frame->pts!=AV_NOPTS_VALUE)
- frame->pts += diff_ts;
-#if FF_API_PKT_PTS
-FF_DISABLE_DEPRECATION_WARNINGS
- if(frame->pkt_pts!=AV_NOPTS_VALUE)
- frame->pkt_pts += diff_ts;
-FF_ENABLE_DEPRECATION_WARNINGS
-#endif
- if(frame->pkt_dts!=AV_NOPTS_VALUE)
- frame->pkt_dts += diff_ts;
- if (av_frame_get_pkt_duration(frame) >= diff_ts)
- av_frame_set_pkt_duration(frame, av_frame_get_pkt_duration(frame) - diff_ts);
- } else {
- av_log(avctx, AV_LOG_WARNING, "Could not update timestamps for skipped samples.\n");
- }
- av_log(avctx, AV_LOG_DEBUG, "skip %d/%d samples\n",
- avctx->internal->skip_samples, frame->nb_samples);
- frame->nb_samples -= avctx->internal->skip_samples;
- avctx->internal->skip_samples = 0;
- }
- }
-
- if (discard_padding > 0 && discard_padding <= frame->nb_samples && *got_frame_ptr &&
- !(avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL)) {
- if (discard_padding == frame->nb_samples) {
- *got_frame_ptr = 0;
- } else {
- if(avctx->pkt_timebase.num && avctx->sample_rate) {
- int64_t diff_ts = av_rescale_q(frame->nb_samples - discard_padding,
- (AVRational){1, avctx->sample_rate},
- avctx->pkt_timebase);
- av_frame_set_pkt_duration(frame, diff_ts);
- } else {
- av_log(avctx, AV_LOG_WARNING, "Could not update timestamps for discarded samples.\n");
- }
- av_log(avctx, AV_LOG_DEBUG, "discard %d/%d samples\n",
- (int)discard_padding, frame->nb_samples);
- frame->nb_samples -= discard_padding;
- }
- }
-
- if ((avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL) && *got_frame_ptr) {
- AVFrameSideData *fside = av_frame_new_side_data(frame, AV_FRAME_DATA_SKIP_SAMPLES, 10);
- if (fside) {
- AV_WL32(fside->data, avctx->internal->skip_samples);
- AV_WL32(fside->data + 4, discard_padding);
- AV_WL8(fside->data + 8, skip_reason);
- AV_WL8(fside->data + 9, discard_reason);
- avctx->internal->skip_samples = 0;
- }
- }
-fail:
- avctx->internal->pkt = NULL;
- if (did_split) {
- av_packet_free_side_data(&tmp);
- if(ret == tmp.size)
- ret = avpkt->size;
- }
-
- if (ret >= 0 && *got_frame_ptr) {
- if (!avctx->refcounted_frames) {
- int err = unrefcount_frame(avci, frame);
- if (err < 0)
- return err;
- }
- } else
- av_frame_unref(frame);
- }
-
- av_assert0(ret <= avpkt->size);
-
- if (!avci->showed_multi_packet_warning &&
- ret >= 0 && ret != avpkt->size && !(avctx->codec->capabilities & AV_CODEC_CAP_SUBFRAMES)) {
- av_log(avctx, AV_LOG_WARNING, "Multiple frames in a packet.\n");
- avci->showed_multi_packet_warning = 1;
- }
-
- return ret;
-}
-
-#define UTF8_MAX_BYTES 4 /* 5 and 6 bytes sequences should not be used */
-static int recode_subtitle(AVCodecContext *avctx,
- AVPacket *outpkt, const AVPacket *inpkt)
-{
-#if CONFIG_ICONV
- iconv_t cd = (iconv_t)-1;
- int ret = 0;
- char *inb, *outb;
- size_t inl, outl;
- AVPacket tmp;
-#endif
-
- if (avctx->sub_charenc_mode != FF_SUB_CHARENC_MODE_PRE_DECODER || inpkt->size == 0)
- return 0;
-
-#if CONFIG_ICONV
- cd = iconv_open("UTF-8", avctx->sub_charenc);
- av_assert0(cd != (iconv_t)-1);
-
- inb = inpkt->data;
- inl = inpkt->size;
-
- if (inl >= INT_MAX / UTF8_MAX_BYTES - AV_INPUT_BUFFER_PADDING_SIZE) {
- av_log(avctx, AV_LOG_ERROR, "Subtitles packet is too big for recoding\n");
- ret = AVERROR(ENOMEM);
- goto end;
- }
-
- ret = av_new_packet(&tmp, inl * UTF8_MAX_BYTES);
- if (ret < 0)
- goto end;
- outpkt->buf = tmp.buf;
- outpkt->data = tmp.data;
- outpkt->size = tmp.size;
- outb = outpkt->data;
- outl = outpkt->size;
-
- if (iconv(cd, &inb, &inl, &outb, &outl) == (size_t)-1 ||
- iconv(cd, NULL, NULL, &outb, &outl) == (size_t)-1 ||
- outl >= outpkt->size || inl != 0) {
- ret = FFMIN(AVERROR(errno), -1);
- av_log(avctx, AV_LOG_ERROR, "Unable to recode subtitle event \"%s\" "
- "from %s to UTF-8\n", inpkt->data, avctx->sub_charenc);
- av_packet_unref(&tmp);
- goto end;
- }
- outpkt->size -= outl;
- memset(outpkt->data + outpkt->size, 0, outl);
-
-end:
- if (cd != (iconv_t)-1)
- iconv_close(cd);
- return ret;
-#else
- av_log(avctx, AV_LOG_ERROR, "requesting subtitles recoding without iconv");
- return AVERROR(EINVAL);
-#endif
-}
-
-static int utf8_check(const uint8_t *str)
-{
- const uint8_t *byte;
- uint32_t codepoint, min;
-
- while (*str) {
- byte = str;
- GET_UTF8(codepoint, *(byte++), return 0;);
- min = byte - str == 1 ? 0 : byte - str == 2 ? 0x80 :
- 1 << (5 * (byte - str) - 4);
- if (codepoint < min || codepoint >= 0x110000 ||
- codepoint == 0xFFFE /* BOM */ ||
- codepoint >= 0xD800 && codepoint <= 0xDFFF /* surrogates */)
- return 0;
- str = byte;
- }
- return 1;
-}
-
-#if FF_API_ASS_TIMING
-static void insert_ts(AVBPrint *buf, int ts)
-{
- if (ts == -1) {
- av_bprintf(buf, "9:59:59.99,");
- } else {
- int h, m, s;
-
- h = ts/360000; ts -= 360000*h;
- m = ts/ 6000; ts -= 6000*m;
- s = ts/ 100; ts -= 100*s;
- av_bprintf(buf, "%d:%02d:%02d.%02d,", h, m, s, ts);
- }
-}
-
-static int convert_sub_to_old_ass_form(AVSubtitle *sub, const AVPacket *pkt, AVRational tb)
-{
- int i;
- AVBPrint buf;
-
- av_bprint_init(&buf, 0, AV_BPRINT_SIZE_UNLIMITED);
-
- for (i = 0; i < sub->num_rects; i++) {
- char *final_dialog;
- const char *dialog;
- AVSubtitleRect *rect = sub->rects[i];
- int ts_start, ts_duration = -1;
- long int layer;
-
- if (rect->type != SUBTITLE_ASS || !strncmp(rect->ass, "Dialogue: ", 10))
- continue;
-
- av_bprint_clear(&buf);
-
- /* skip ReadOrder */
- dialog = strchr(rect->ass, ',');
- if (!dialog)
- continue;
- dialog++;
-
- /* extract Layer or Marked */
- layer = strtol(dialog, (char**)&dialog, 10);
- if (*dialog != ',')
- continue;
- dialog++;
-
- /* rescale timing to ASS time base (ms) */
- ts_start = av_rescale_q(pkt->pts, tb, av_make_q(1, 100));
- if (pkt->duration != -1)
- ts_duration = av_rescale_q(pkt->duration, tb, av_make_q(1, 100));
- sub->end_display_time = FFMAX(sub->end_display_time, 10 * ts_duration);
-
- /* construct ASS (standalone file form with timestamps) string */
- av_bprintf(&buf, "Dialogue: %ld,", layer);
- insert_ts(&buf, ts_start);
- insert_ts(&buf, ts_duration == -1 ? -1 : ts_start + ts_duration);
- av_bprintf(&buf, "%s\r\n", dialog);
-
- final_dialog = av_strdup(buf.str);
- if (!av_bprint_is_complete(&buf) || !final_dialog) {
- av_freep(&final_dialog);
- av_bprint_finalize(&buf, NULL);
- return AVERROR(ENOMEM);
- }
- av_freep(&rect->ass);
- rect->ass = final_dialog;
- }
-
- av_bprint_finalize(&buf, NULL);
- return 0;
-}
-#endif
-
-int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub,
- int *got_sub_ptr,
- AVPacket *avpkt)
-{
- int i, ret = 0;
-
- if (!avpkt->data && avpkt->size) {
- av_log(avctx, AV_LOG_ERROR, "invalid packet: NULL data, size != 0\n");
- return AVERROR(EINVAL);
- }
- if (!avctx->codec)
- return AVERROR(EINVAL);
- if (avctx->codec->type != AVMEDIA_TYPE_SUBTITLE) {
- av_log(avctx, AV_LOG_ERROR, "Invalid media type for subtitles\n");
- return AVERROR(EINVAL);
- }
-
- *got_sub_ptr = 0;
- get_subtitle_defaults(sub);
-
- if ((avctx->codec->capabilities & AV_CODEC_CAP_DELAY) || avpkt->size) {
- AVPacket pkt_recoded;
- AVPacket tmp = *avpkt;
- int did_split = av_packet_split_side_data(&tmp);
- //apply_param_change(avctx, &tmp);
-
- if (did_split) {
- /* FFMIN() prevents overflow in case the packet wasn't allocated with
- * proper padding.
- * If the side data is smaller than the buffer padding size, the
- * remaining bytes should have already been filled with zeros by the
- * original packet allocation anyway. */
- memset(tmp.data + tmp.size, 0,
- FFMIN(avpkt->size - tmp.size, AV_INPUT_BUFFER_PADDING_SIZE));
- }
-
- pkt_recoded = tmp;
- ret = recode_subtitle(avctx, &pkt_recoded, &tmp);
- if (ret < 0) {
- *got_sub_ptr = 0;
- } else {
- avctx->internal->pkt = &pkt_recoded;
-
- if (avctx->pkt_timebase.num && avpkt->pts != AV_NOPTS_VALUE)
- sub->pts = av_rescale_q(avpkt->pts,
- avctx->pkt_timebase, AV_TIME_BASE_Q);
- ret = avctx->codec->decode(avctx, sub, got_sub_ptr, &pkt_recoded);
- av_assert1((ret >= 0) >= !!*got_sub_ptr &&
- !!*got_sub_ptr >= !!sub->num_rects);
-
-#if FF_API_ASS_TIMING
- if (avctx->sub_text_format == FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS
- && *got_sub_ptr && sub->num_rects) {
- const AVRational tb = avctx->pkt_timebase.num ? avctx->pkt_timebase
- : avctx->time_base;
- int err = convert_sub_to_old_ass_form(sub, avpkt, tb);
- if (err < 0)
- ret = err;
- }
-#endif
-
- if (sub->num_rects && !sub->end_display_time && avpkt->duration &&
- avctx->pkt_timebase.num) {
- AVRational ms = { 1, 1000 };
- sub->end_display_time = av_rescale_q(avpkt->duration,
- avctx->pkt_timebase, ms);
- }
-
- for (i = 0; i < sub->num_rects; i++) {
- if (sub->rects[i]->ass && !utf8_check(sub->rects[i]->ass)) {
- av_log(avctx, AV_LOG_ERROR,
- "Invalid UTF-8 in decoded subtitles text; "
- "maybe missing -sub_charenc option\n");
- avsubtitle_free(sub);
- return AVERROR_INVALIDDATA;
- }
- }
-
- if (tmp.data != pkt_recoded.data) { // did we recode?
- /* prevent from destroying side data from original packet */
- pkt_recoded.side_data = NULL;
- pkt_recoded.side_data_elems = 0;
-
- av_packet_unref(&pkt_recoded);
- }
- if (avctx->codec_descriptor->props & AV_CODEC_PROP_BITMAP_SUB)
- sub->format = 0;
- else if (avctx->codec_descriptor->props & AV_CODEC_PROP_TEXT_SUB)
- sub->format = 1;
- avctx->internal->pkt = NULL;
- }
-
- if (did_split) {
- av_packet_free_side_data(&tmp);
- if(ret == tmp.size)
- ret = avpkt->size;
- }
-
- if (*got_sub_ptr)
- avctx->frame_number++;
- }
-
- return ret;
-}
-
void avsubtitle_free(AVSubtitle *sub)
{
int i;
@@ -2761,263 +1157,7 @@ void avsubtitle_free(AVSubtitle *sub)
av_freep(&sub->rects);
- memset(sub, 0, sizeof(AVSubtitle));
-}
-
-static int do_decode(AVCodecContext *avctx, AVPacket *pkt)
-{
- int got_frame;
- int ret;
-
- av_assert0(!avctx->internal->buffer_frame->buf[0]);
-
- if (!pkt)
- pkt = avctx->internal->buffer_pkt;
-
- // This is the lesser evil. The field is for compatibility with legacy users
- // of the legacy API, and users using the new API should not be forced to
- // even know about this field.
- avctx->refcounted_frames = 1;
-
- // Some codecs (at least wma lossless) will crash when feeding drain packets
- // after EOF was signaled.
- if (avctx->internal->draining_done)
- return AVERROR_EOF;
-
- if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
- ret = avcodec_decode_video2(avctx, avctx->internal->buffer_frame,
- &got_frame, pkt);
- if (ret >= 0)
- ret = pkt->size;
- } else if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
- ret = avcodec_decode_audio4(avctx, avctx->internal->buffer_frame,
- &got_frame, pkt);
- } else {
- ret = AVERROR(EINVAL);
- }
-
- if (ret == AVERROR(EAGAIN))
- ret = pkt->size;
-
- if (ret < 0)
- return ret;
-
- if (avctx->internal->draining && !got_frame)
- avctx->internal->draining_done = 1;
-
- if (ret >= pkt->size) {
- av_packet_unref(avctx->internal->buffer_pkt);
- } else {
- int consumed = ret;
-
- if (pkt != avctx->internal->buffer_pkt) {
- av_packet_unref(avctx->internal->buffer_pkt);
- if ((ret = av_packet_ref(avctx->internal->buffer_pkt, pkt)) < 0)
- return ret;
- }
-
- avctx->internal->buffer_pkt->data += consumed;
- avctx->internal->buffer_pkt->size -= consumed;
- avctx->internal->buffer_pkt->pts = AV_NOPTS_VALUE;
- avctx->internal->buffer_pkt->dts = AV_NOPTS_VALUE;
- }
-
- if (got_frame)
- av_assert0(avctx->internal->buffer_frame->buf[0]);
-
- return 0;
-}
-
-int attribute_align_arg avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt)
-{
- int ret;
-
- if (!avcodec_is_open(avctx) || !av_codec_is_decoder(avctx->codec))
- return AVERROR(EINVAL);
-
- if (avctx->internal->draining)
- return AVERROR_EOF;
-
- if (avpkt && !avpkt->size && avpkt->data)
- return AVERROR(EINVAL);
-
- if (!avpkt || !avpkt->size) {
- avctx->internal->draining = 1;
- avpkt = NULL;
-
- if (!(avctx->codec->capabilities & AV_CODEC_CAP_DELAY))
- return 0;
- }
-
- if (avctx->codec->send_packet) {
- if (avpkt) {
- AVPacket tmp = *avpkt;
- int did_split = av_packet_split_side_data(&tmp);
- ret = apply_param_change(avctx, &tmp);
- if (ret >= 0)
- ret = avctx->codec->send_packet(avctx, &tmp);
- if (did_split)
- av_packet_free_side_data(&tmp);
- return ret;
- } else {
- return avctx->codec->send_packet(avctx, NULL);
- }
- }
-
- // Emulation via old API. Assume avpkt is likely not refcounted, while
- // decoder output is always refcounted, and avoid copying.
-
- if (avctx->internal->buffer_pkt->size || avctx->internal->buffer_frame->buf[0])
- return AVERROR(EAGAIN);
-
- // The goal is decoding the first frame of the packet without using memcpy,
- // because the common case is having only 1 frame per packet (especially
- // with video, but audio too). In other cases, it can't be avoided, unless
- // the user is feeding refcounted packets.
- return do_decode(avctx, (AVPacket *)avpkt);
-}
-
-int attribute_align_arg avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame)
-{
- int ret;
-
- av_frame_unref(frame);
-
- if (!avcodec_is_open(avctx) || !av_codec_is_decoder(avctx->codec))
- return AVERROR(EINVAL);
-
- if (avctx->codec->receive_frame) {
- if (avctx->internal->draining && !(avctx->codec->capabilities & AV_CODEC_CAP_DELAY))
- return AVERROR_EOF;
- ret = avctx->codec->receive_frame(avctx, frame);
- if (ret >= 0) {
- if (av_frame_get_best_effort_timestamp(frame) == AV_NOPTS_VALUE) {
- av_frame_set_best_effort_timestamp(frame,
- guess_correct_pts(avctx, frame->pts, frame->pkt_dts));
- }
- }
- return ret;
- }
-
- // Emulation via old API.
-
- if (!avctx->internal->buffer_frame->buf[0]) {
- if (!avctx->internal->buffer_pkt->size && !avctx->internal->draining)
- return AVERROR(EAGAIN);
-
- while (1) {
- if ((ret = do_decode(avctx, avctx->internal->buffer_pkt)) < 0) {
- av_packet_unref(avctx->internal->buffer_pkt);
- return ret;
- }
- // Some audio decoders may consume partial data without returning
- // a frame (fate-wmapro-2ch). There is no way to make the caller
- // call avcodec_receive_frame() again without returning a frame,
- // so try to decode more in these cases.
- if (avctx->internal->buffer_frame->buf[0] ||
- !avctx->internal->buffer_pkt->size)
- break;
- }
- }
-
- if (!avctx->internal->buffer_frame->buf[0])
- return avctx->internal->draining ? AVERROR_EOF : AVERROR(EAGAIN);
-
- av_frame_move_ref(frame, avctx->internal->buffer_frame);
- return 0;
-}
-
-static int do_encode(AVCodecContext *avctx, const AVFrame *frame, int *got_packet)
-{
- int ret;
- *got_packet = 0;
-
- av_packet_unref(avctx->internal->buffer_pkt);
- avctx->internal->buffer_pkt_valid = 0;
-
- if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) {
- ret = avcodec_encode_video2(avctx, avctx->internal->buffer_pkt,
- frame, got_packet);
- } else if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
- ret = avcodec_encode_audio2(avctx, avctx->internal->buffer_pkt,
- frame, got_packet);
- } else {
- ret = AVERROR(EINVAL);
- }
-
- if (ret >= 0 && *got_packet) {
- // Encoders must always return ref-counted buffers.
- // Side-data only packets have no data and can be not ref-counted.
- av_assert0(!avctx->internal->buffer_pkt->data || avctx->internal->buffer_pkt->buf);
- avctx->internal->buffer_pkt_valid = 1;
- ret = 0;
- } else {
- av_packet_unref(avctx->internal->buffer_pkt);
- }
-
- return ret;
-}
-
-int attribute_align_arg avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame)
-{
- if (!avcodec_is_open(avctx) || !av_codec_is_encoder(avctx->codec))
- return AVERROR(EINVAL);
-
- if (avctx->internal->draining)
- return AVERROR_EOF;
-
- if (!frame) {
- avctx->internal->draining = 1;
-
- if (!(avctx->codec->capabilities & AV_CODEC_CAP_DELAY))
- return 0;
- }
-
- if (avctx->codec->send_frame)
- return avctx->codec->send_frame(avctx, frame);
-
- // Emulation via old API. Do it here instead of avcodec_receive_packet, because:
- // 1. if the AVFrame is not refcounted, the copying will be much more
- // expensive than copying the packet data
- // 2. assume few users use non-refcounted AVPackets, so usually no copy is
- // needed
-
- if (avctx->internal->buffer_pkt_valid)
- return AVERROR(EAGAIN);
-
- return do_encode(avctx, frame, &(int){0});
-}
-
-int attribute_align_arg avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt)
-{
- av_packet_unref(avpkt);
-
- if (!avcodec_is_open(avctx) || !av_codec_is_encoder(avctx->codec))
- return AVERROR(EINVAL);
-
- if (avctx->codec->receive_packet) {
- if (avctx->internal->draining && !(avctx->codec->capabilities & AV_CODEC_CAP_DELAY))
- return AVERROR_EOF;
- return avctx->codec->receive_packet(avctx, avpkt);
- }
-
- // Emulation via old API.
-
- if (!avctx->internal->buffer_pkt_valid) {
- int got_packet;
- int ret;
- if (!avctx->internal->draining)
- return AVERROR(EAGAIN);
- ret = do_encode(avctx, NULL, &got_packet);
- if (ret < 0)
- return ret;
- if (ret >= 0 && !got_packet)
- return AVERROR_EOF;
- }
-
- av_packet_move_ref(avpkt, avctx->internal->buffer_pkt);
- avctx->internal->buffer_pkt_valid = 0;
- return 0;
+ memset(sub, 0, sizeof(*sub));
}
av_cold int avcodec_close(AVCodecContext *avctx)
@@ -3040,8 +1180,13 @@ av_cold int avcodec_close(AVCodecContext *avctx)
avctx->internal->byte_buffer_size = 0;
av_freep(&avctx->internal->byte_buffer);
av_frame_free(&avctx->internal->to_free);
+ av_frame_free(&avctx->internal->compat_decode_frame);
av_frame_free(&avctx->internal->buffer_frame);
av_packet_free(&avctx->internal->buffer_pkt);
+ av_packet_free(&avctx->internal->last_pkt_props);
+
+ av_packet_free(&avctx->internal->ds.in_pkt);
+
for (i = 0; i < FF_ARRAY_ELEMS(pool->pools); i++)
av_buffer_pool_uninit(&pool->pools[i]);
av_freep(&avctx->internal->pool);
@@ -3050,6 +1195,8 @@ av_cold int avcodec_close(AVCodecContext *avctx)
avctx->hwaccel->uninit(avctx);
av_freep(&avctx->internal->hwaccel_priv_data);
+ ff_decode_bsfs_uninit(avctx);
+
av_freep(&avctx->internal);
}
@@ -3059,6 +1206,7 @@ av_cold int avcodec_close(AVCodecContext *avctx)
avctx->nb_coded_side_data = 0;
av_buffer_unref(&avctx->hw_frames_ctx);
+ av_buffer_unref(&avctx->hw_device_ctx);
if (avctx->priv_data && avctx->codec && avctx->codec->priv_class)
av_opt_free(avctx->priv_data);
@@ -3215,12 +1363,9 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
", %d reference frame%s",
enc->refs, enc->refs > 1 ? "s" : "");
- if (enc->codec_tag) {
- char tag_buf[32];
- av_get_codec_tag_string(tag_buf, sizeof(tag_buf), enc->codec_tag);
- snprintf(buf + strlen(buf), buf_size - strlen(buf),
- " (%s / 0x%04X)", tag_buf, enc->codec_tag);
- }
+ if (enc->codec_tag)
+ snprintf(buf + strlen(buf), buf_size - strlen(buf), " (%s / 0x%04X)",
+ av_fourcc2str(enc->codec_tag), enc->codec_tag);
switch (enc->codec_type) {
case AVMEDIA_TYPE_VIDEO:
@@ -3377,7 +1522,7 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode)
", %"PRId64" kb/s", bitrate / 1000);
} else if (enc->rc_max_rate > 0) {
snprintf(buf + strlen(buf), buf_size - strlen(buf),
- ", max. %"PRId64" kb/s", (int64_t)enc->rc_max_rate / 1000);
+ ", max. %"PRId64" kb/s", enc->rc_max_rate / 1000);
}
}
@@ -3432,26 +1577,6 @@ const char *avcodec_license(void)
return LICENSE_PREFIX FFMPEG_LICENSE + sizeof(LICENSE_PREFIX) - 1;
}
-void avcodec_flush_buffers(AVCodecContext *avctx)
-{
- avctx->internal->draining = 0;
- avctx->internal->draining_done = 0;
- av_frame_unref(avctx->internal->buffer_frame);
- av_packet_unref(avctx->internal->buffer_pkt);
- avctx->internal->buffer_pkt_valid = 0;
-
- if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)
- ff_thread_flush(avctx);
- else if (avctx->codec->flush)
- avctx->codec->flush(avctx);
-
- avctx->pts_correction_last_pts =
- avctx->pts_correction_last_dts = INT64_MIN;
-
- if (!avctx->refcounted_frames)
- av_frame_unref(avctx->internal->to_free);
-}
-
int av_get_exact_bits_per_sample(enum AVCodecID codec_id)
{
switch (codec_id) {
@@ -3499,6 +1624,8 @@ int av_get_exact_bits_per_sample(enum AVCodecID codec_id)
case AV_CODEC_ID_PCM_U32LE:
case AV_CODEC_ID_PCM_F32BE:
case AV_CODEC_ID_PCM_F32LE:
+ case AV_CODEC_ID_PCM_F24LE:
+ case AV_CODEC_ID_PCM_F16LE:
return 32;
case AV_CODEC_ID_PCM_F64BE:
case AV_CODEC_ID_PCM_F64LE:
@@ -3595,6 +1722,9 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba,
if (id == AV_CODEC_ID_BINKAUDIO_DCT)
return (480 << (sr / 22050)) / ch;
}
+
+ if (id == AV_CODEC_ID_MP3)
+ return sr <= 24000 ? 576 : 1152;
}
if (ba > 0) {
@@ -3627,7 +1757,7 @@ static int get_audio_frame_duration(enum AVCodecID id, int sr, int ch, int ba,
if (bps > 0) {
/* calc from frame_bytes and bits_per_coded_sample */
- if (id == AV_CODEC_ID_ADPCM_G726)
+ if (id == AV_CODEC_ID_ADPCM_G726 || id == AV_CODEC_ID_ADPCM_G726LE)
return frame_bytes * 8 / bps;
}
@@ -3931,7 +2061,8 @@ int ff_thread_ref_frame(ThreadFrame *dst, ThreadFrame *src)
{
int ret;
- dst->owner = src->owner;
+ dst->owner[0] = src->owner[0];
+ dst->owner[1] = src->owner[1];
ret = av_frame_ref(dst->f, src->f);
if (ret < 0)
@@ -3941,7 +2072,7 @@ int ff_thread_ref_frame(ThreadFrame *dst, ThreadFrame *src)
if (src->progress &&
!(dst->progress = av_buffer_ref(src->progress))) {
- ff_thread_release_buffer(dst->owner, dst);
+ ff_thread_release_buffer(dst->owner[0], dst);
return AVERROR(ENOMEM);
}
@@ -3957,7 +2088,7 @@ enum AVPixelFormat ff_thread_get_format(AVCodecContext *avctx, const enum AVPixe
int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags)
{
- f->owner = avctx;
+ f->owner[0] = f->owner[1] = avctx;
return ff_get_buffer(avctx, f->f, flags);
}
@@ -4319,3 +2450,24 @@ int ff_alloc_a53_sei(const AVFrame *frame, size_t prefix_len,
return 0;
}
+
+int64_t ff_guess_coded_bitrate(AVCodecContext *avctx)
+{
+ AVRational framerate = avctx->framerate;
+ int bits_per_coded_sample = avctx->bits_per_coded_sample;
+ int64_t bitrate;
+
+ if (!(framerate.num && framerate.den))
+ framerate = av_inv_q(avctx->time_base);
+ if (!(framerate.num && framerate.den))
+ return 0;
+
+ if (!bits_per_coded_sample) {
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt);
+ bits_per_coded_sample = av_get_bits_per_pixel(desc);
+ }
+ bitrate = (int64_t)bits_per_coded_sample * avctx->width * avctx->height *
+ framerate.num / framerate.den;
+
+ return bitrate;
+}
diff --git a/media/ffvpx/libavcodec/version.h b/media/ffvpx/libavcodec/version.h
index ec8837a4e7..10d9ac4eb3 100644
--- a/media/ffvpx/libavcodec/version.h
+++ b/media/ffvpx/libavcodec/version.h
@@ -28,8 +28,8 @@
#include "libavutil/version.h"
#define LIBAVCODEC_VERSION_MAJOR 57
-#define LIBAVCODEC_VERSION_MINOR 64
-#define LIBAVCODEC_VERSION_MICRO 101
+#define LIBAVCODEC_VERSION_MINOR 107
+#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \
@@ -60,9 +60,6 @@
#ifndef FF_API_AVCODEC_RESAMPLE
#define FF_API_AVCODEC_RESAMPLE FF_API_AUDIO_CONVERT
#endif
-#ifndef FF_API_GETCHROMA
-#define FF_API_GETCHROMA (LIBAVCODEC_VERSION_MAJOR < 58)
-#endif
#ifndef FF_API_MISSING_SAMPLE
#define FF_API_MISSING_SAMPLE (LIBAVCODEC_VERSION_MAJOR < 58)
#endif
@@ -157,6 +154,9 @@
#ifndef FF_API_VAAPI_CONTEXT
#define FF_API_VAAPI_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 58)
#endif
+#ifndef FF_API_MERGE_SD
+#define FF_API_MERGE_SD (LIBAVCODEC_VERSION_MAJOR < 58)
+#endif
#ifndef FF_API_AVCTX_TIMEBASE
#define FF_API_AVCTX_TIMEBASE (LIBAVCODEC_VERSION_MAJOR < 59)
#endif
@@ -226,5 +226,18 @@
#ifndef FF_API_NVENC_OLD_NAME
#define FF_API_NVENC_OLD_NAME (LIBAVCODEC_VERSION_MAJOR < 59)
#endif
+#ifndef FF_API_STRUCT_VAAPI_CONTEXT
+#define FF_API_STRUCT_VAAPI_CONTEXT (LIBAVCODEC_VERSION_MAJOR < 59)
+#endif
+#ifndef FF_API_MERGE_SD_API
+#define FF_API_MERGE_SD_API (LIBAVCODEC_VERSION_MAJOR < 59)
+#endif
+#ifndef FF_API_TAG_STRING
+#define FF_API_TAG_STRING (LIBAVCODEC_VERSION_MAJOR < 59)
+#endif
+#ifndef FF_API_GETCHROMA
+#define FF_API_GETCHROMA (LIBAVCODEC_VERSION_MAJOR < 59)
+#endif
+
#endif /* AVCODEC_VERSION_H */
diff --git a/media/ffvpx/libavcodec/videodsp.c b/media/ffvpx/libavcodec/videodsp.c
index ba618a7bbc..ce9e9eb143 100644
--- a/media/ffvpx/libavcodec/videodsp.c
+++ b/media/ffvpx/libavcodec/videodsp.c
@@ -52,4 +52,6 @@ av_cold void ff_videodsp_init(VideoDSPContext *ctx, int bpc)
ff_videodsp_init_ppc(ctx, bpc);
if (ARCH_X86)
ff_videodsp_init_x86(ctx, bpc);
+ if (ARCH_MIPS)
+ ff_videodsp_init_mips(ctx, bpc);
}
diff --git a/media/ffvpx/libavcodec/videodsp.h b/media/ffvpx/libavcodec/videodsp.h
index fc01a31dca..c0545f22b0 100644
--- a/media/ffvpx/libavcodec/videodsp.h
+++ b/media/ffvpx/libavcodec/videodsp.h
@@ -83,5 +83,6 @@ void ff_videodsp_init_aarch64(VideoDSPContext *ctx, int bpc);
void ff_videodsp_init_arm(VideoDSPContext *ctx, int bpc);
void ff_videodsp_init_ppc(VideoDSPContext *ctx, int bpc);
void ff_videodsp_init_x86(VideoDSPContext *ctx, int bpc);
+void ff_videodsp_init_mips(VideoDSPContext *ctx, int bpc);
#endif /* AVCODEC_VIDEODSP_H */
diff --git a/media/ffvpx/libavcodec/vlc.h b/media/ffvpx/libavcodec/vlc.h
index 9e38f8c6b2..42ccddf3fc 100644
--- a/media/ffvpx/libavcodec/vlc.h
+++ b/media/ffvpx/libavcodec/vlc.h
@@ -54,12 +54,28 @@ void ff_free_vlc(VLC *vlc);
#define INIT_VLC_LE 2
#define INIT_VLC_USE_NEW_STATIC 4
-#define INIT_VLC_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size) \
+#define INIT_VLC_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, h, i, j, static_size) \
+ do { \
+ static VLC_TYPE table[static_size][2]; \
+ (vlc)->table = table; \
+ (vlc)->table_allocated = static_size; \
+ ff_init_vlc_sparse(vlc, bits, a, b, c, d, e, f, g, h, i, j, \
+ INIT_VLC_USE_NEW_STATIC); \
+ } while (0)
+
+#define INIT_LE_VLC_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, h, i, j, static_size) \
do { \
static VLC_TYPE table[static_size][2]; \
(vlc)->table = table; \
(vlc)->table_allocated = static_size; \
- init_vlc(vlc, bits, a, b, c, d, e, f, g, INIT_VLC_USE_NEW_STATIC); \
+ ff_init_vlc_sparse(vlc, bits, a, b, c, d, e, f, g, h, i, j, \
+ INIT_VLC_USE_NEW_STATIC | INIT_VLC_LE); \
} while (0)
+#define INIT_VLC_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size) \
+ INIT_VLC_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, NULL, 0, 0, static_size)
+
+#define INIT_LE_VLC_STATIC(vlc, bits, a, b, c, d, e, f, g, static_size) \
+ INIT_LE_VLC_SPARSE_STATIC(vlc, bits, a, b, c, d, e, f, g, NULL, 0, 0, static_size)
+
#endif /* AVCODEC_VLC_H */
diff --git a/media/ffvpx/libavcodec/vorbis_parser.h b/media/ffvpx/libavcodec/vorbis_parser.h
index 92050277ed..789932ac49 100644
--- a/media/ffvpx/libavcodec/vorbis_parser.h
+++ b/media/ffvpx/libavcodec/vorbis_parser.h
@@ -32,9 +32,6 @@ typedef struct AVVorbisParseContext AVVorbisParseContext;
/**
* Allocate and initialize the Vorbis parser using headers in the extradata.
- *
- * @param avctx codec context
- * @param s Vorbis parser context
*/
AVVorbisParseContext *av_vorbis_parse_init(const uint8_t *extradata,
int extradata_size);
diff --git a/media/ffvpx/libavcodec/vp3dsp.h b/media/ffvpx/libavcodec/vp3dsp.h
index b95adae79e..2fdad162ca 100644
--- a/media/ffvpx/libavcodec/vp3dsp.h
+++ b/media/ffvpx/libavcodec/vp3dsp.h
@@ -38,11 +38,11 @@ typedef struct VP3DSPContext {
const uint8_t *b,
ptrdiff_t stride, int h);
- void (*idct_put)(uint8_t *dest, int line_size, int16_t *block);
- void (*idct_add)(uint8_t *dest, int line_size, int16_t *block);
- void (*idct_dc_add)(uint8_t *dest, int line_size, int16_t *block);
- void (*v_loop_filter)(uint8_t *src, int stride, int *bounding_values);
- void (*h_loop_filter)(uint8_t *src, int stride, int *bounding_values);
+ void (*idct_put)(uint8_t *dest, ptrdiff_t stride, int16_t *block);
+ void (*idct_add)(uint8_t *dest, ptrdiff_t stride, int16_t *block);
+ void (*idct_dc_add)(uint8_t *dest, ptrdiff_t stride, int16_t *block);
+ void (*v_loop_filter)(uint8_t *src, ptrdiff_t stride, int *bounding_values);
+ void (*h_loop_filter)(uint8_t *src, ptrdiff_t stride, int *bounding_values);
} VP3DSPContext;
void ff_vp3dsp_init(VP3DSPContext *c, int flags);
diff --git a/media/ffvpx/libavcodec/vp56.h b/media/ffvpx/libavcodec/vp56.h
index 56c30919b7..b8dda9e73a 100644
--- a/media/ffvpx/libavcodec/vp56.h
+++ b/media/ffvpx/libavcodec/vp56.h
@@ -26,6 +26,7 @@
#ifndef AVCODEC_VP56_H
#define AVCODEC_VP56_H
+#include "avcodec.h"
#include "get_bits.h"
#include "hpeldsp.h"
#include "bytestream.h"
@@ -72,9 +73,9 @@ typedef struct VP56mv {
typedef void (*VP56ParseVectorAdjustment)(VP56Context *s,
VP56mv *vect);
typedef void (*VP56Filter)(VP56Context *s, uint8_t *dst, uint8_t *src,
- int offset1, int offset2, int stride,
+ int offset1, int offset2, ptrdiff_t stride,
VP56mv mv, int mask, int select, int luma);
-typedef void (*VP56ParseCoeff)(VP56Context *s);
+typedef int (*VP56ParseCoeff)(VP56Context *s);
typedef void (*VP56DefaultModelsInit)(VP56Context *s);
typedef void (*VP56ParseVectorModels)(VP56Context *s);
typedef int (*VP56ParseCoeffModels)(VP56Context *s);
@@ -179,7 +180,7 @@ struct vp56_context {
int flip; /* are we flipping ? */
int frbi; /* first row block index in MB */
int srbi; /* second row block index in MB */
- int stride[4]; /* stride for each plan */
+ ptrdiff_t stride[4]; /* stride for each plan */
const uint8_t *vp56_coord_div;
VP56ParseVectorAdjustment parse_vector_adjustment;
@@ -203,6 +204,9 @@ struct vp56_context {
VLC runv_vlc[2];
VLC ract_vlc[2][3][6];
unsigned int nb_null[2][2]; /* number of consecutive NULL DC/AC */
+
+ int have_undamaged_frame;
+ int discard_frame;
};
@@ -221,7 +225,7 @@ int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
*/
extern const uint8_t ff_vp56_norm_shift[256];
-void ff_vp56_init_range_decoder(VP56RangeCoder *c, const uint8_t *buf, int buf_size);
+int ff_vp56_init_range_decoder(VP56RangeCoder *c, const uint8_t *buf, int buf_size);
static av_always_inline unsigned int vp56_rac_renorm(VP56RangeCoder *c)
{
diff --git a/media/ffvpx/libavcodec/vp56dsp.h b/media/ffvpx/libavcodec/vp56dsp.h
index 7807baa4b1..e35e232ea3 100644
--- a/media/ffvpx/libavcodec/vp56dsp.h
+++ b/media/ffvpx/libavcodec/vp56dsp.h
@@ -21,22 +21,24 @@
#ifndef AVCODEC_VP56DSP_H
#define AVCODEC_VP56DSP_H
+#include <stddef.h>
#include <stdint.h>
-#include "avcodec.h"
typedef struct VP56DSPContext {
- void (*edge_filter_hor)(uint8_t *yuv, int stride, int t);
- void (*edge_filter_ver)(uint8_t *yuv, int stride, int t);
+ void (*edge_filter_hor)(uint8_t *yuv, ptrdiff_t stride, int t);
+ void (*edge_filter_ver)(uint8_t *yuv, ptrdiff_t stride, int t);
- void (*vp6_filter_diag4)(uint8_t *dst, uint8_t *src, int stride,
+ void (*vp6_filter_diag4)(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
const int16_t *h_weights,const int16_t *v_weights);
} VP56DSPContext;
-void ff_vp6_filter_diag4_c(uint8_t *dst, uint8_t *src, int stride,
+void ff_vp6_filter_diag4_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride,
const int16_t *h_weights, const int16_t *v_weights);
-void ff_vp56dsp_init(VP56DSPContext *s, enum AVCodecID codec);
-void ff_vp6dsp_init_arm(VP56DSPContext *s, enum AVCodecID codec);
-void ff_vp6dsp_init_x86(VP56DSPContext* c, enum AVCodecID codec);
+void ff_vp5dsp_init(VP56DSPContext *s);
+void ff_vp6dsp_init(VP56DSPContext *s);
+
+void ff_vp6dsp_init_arm(VP56DSPContext *s);
+void ff_vp6dsp_init_x86(VP56DSPContext *s);
#endif /* AVCODEC_VP56DSP_H */
diff --git a/media/ffvpx/libavcodec/vp56rac.c b/media/ffvpx/libavcodec/vp56rac.c
index 6061b7ee72..e70302bf85 100644
--- a/media/ffvpx/libavcodec/vp56rac.c
+++ b/media/ffvpx/libavcodec/vp56rac.c
@@ -37,11 +37,14 @@ const uint8_t ff_vp56_norm_shift[256]= {
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
};
-void ff_vp56_init_range_decoder(VP56RangeCoder *c, const uint8_t *buf, int buf_size)
+int ff_vp56_init_range_decoder(VP56RangeCoder *c, const uint8_t *buf, int buf_size)
{
c->high = 255;
c->bits = -16;
c->buffer = buf;
c->end = buf + buf_size;
+ if (buf_size < 1)
+ return AVERROR_INVALIDDATA;
c->code_word = bytestream_get_be24(&c->buffer);
+ return 0;
}
diff --git a/media/ffvpx/libavcodec/vp8.c b/media/ffvpx/libavcodec/vp8.c
index c1c3eb7072..7841a9d964 100644
--- a/media/ffvpx/libavcodec/vp8.c
+++ b/media/ffvpx/libavcodec/vp8.c
@@ -261,6 +261,7 @@ static int setup_partitions(VP8Context *s, const uint8_t *buf, int buf_size)
{
const uint8_t *sizes = buf;
int i;
+ int ret;
s->num_coeff_partitions = 1 << vp8_rac_get_uint(&s->c, 2);
@@ -274,13 +275,13 @@ static int setup_partitions(VP8Context *s, const uint8_t *buf, int buf_size)
if (buf_size - size < 0)
return -1;
- ff_vp56_init_range_decoder(&s->coeff_partition[i], buf, size);
+ ret = ff_vp56_init_range_decoder(&s->coeff_partition[i], buf, size);
+ if (ret < 0)
+ return ret;
buf += size;
buf_size -= size;
}
- ff_vp56_init_range_decoder(&s->coeff_partition[i], buf, buf_size);
-
- return 0;
+ return ff_vp56_init_range_decoder(&s->coeff_partition[i], buf, buf_size);
}
static void vp7_get_quants(VP8Context *s)
@@ -434,8 +435,8 @@ static void copy_chroma(AVFrame *dst, AVFrame *src, int width, int height)
}
}
-static void fade(uint8_t *dst, int dst_linesize,
- const uint8_t *src, int src_linesize,
+static void fade(uint8_t *dst, ptrdiff_t dst_linesize,
+ const uint8_t *src, ptrdiff_t src_linesize,
int width, int height,
int alpha, int beta)
{
@@ -518,7 +519,9 @@ static int vp7_decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_si
memcpy(s->put_pixels_tab, s->vp8dsp.put_vp8_epel_pixels_tab, sizeof(s->put_pixels_tab));
- ff_vp56_init_range_decoder(c, buf, part1_size);
+ ret = ff_vp56_init_range_decoder(c, buf, part1_size);
+ if (ret < 0)
+ return ret;
buf += part1_size;
buf_size -= part1_size;
@@ -570,7 +573,9 @@ static int vp7_decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_si
s->lf_delta.enabled = 0;
s->num_coeff_partitions = 1;
- ff_vp56_init_range_decoder(&s->coeff_partition[0], buf, buf_size);
+ ret = ff_vp56_init_range_decoder(&s->coeff_partition[0], buf, buf_size);
+ if (ret < 0)
+ return ret;
if (!s->macroblocks_base || /* first frame */
width != s->avctx->width || height != s->avctx->height ||
@@ -699,7 +704,9 @@ static int vp8_decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_si
memset(&s->lf_delta, 0, sizeof(s->lf_delta));
}
- ff_vp56_init_range_decoder(c, buf, header_size);
+ ret = ff_vp56_init_range_decoder(c, buf, header_size);
+ if (ret < 0)
+ return ret;
buf += header_size;
buf_size -= header_size;
@@ -765,7 +772,7 @@ static int vp8_decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_si
}
static av_always_inline
-void clamp_mv(VP8Context *s, VP56mv *dst, const VP56mv *src)
+void clamp_mv(VP8mvbounds *s, VP56mv *dst, const VP56mv *src)
{
dst->x = av_clip(src->x, av_clip(s->mv_min.x, INT16_MIN, INT16_MAX),
av_clip(s->mv_max.x, INT16_MIN, INT16_MAX));
@@ -1024,7 +1031,7 @@ void vp7_decode_mvs(VP8Context *s, VP8Macroblock *mb,
}
static av_always_inline
-void vp8_decode_mvs(VP8Context *s, VP8Macroblock *mb,
+void vp8_decode_mvs(VP8Context *s, VP8mvbounds *mv_bounds, VP8Macroblock *mb,
int mb_x, int mb_y, int layout)
{
VP8Macroblock *mb_edge[3] = { 0 /* top */,
@@ -1095,7 +1102,7 @@ void vp8_decode_mvs(VP8Context *s, VP8Macroblock *mb,
if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[CNT_NEAREST]][1])) {
if (vp56_rac_get_prob_branchy(c, vp8_mode_contexts[cnt[CNT_NEAR]][2])) {
/* Choose the best mv out of 0,0 and the nearest mv */
- clamp_mv(s, &mb->mv, &near_mv[CNT_ZERO + (cnt[CNT_NEAREST] >= cnt[CNT_ZERO])]);
+ clamp_mv(mv_bounds, &mb->mv, &near_mv[CNT_ZERO + (cnt[CNT_NEAREST] >= cnt[CNT_ZERO])]);
cnt[CNT_SPLITMV] = ((mb_edge[VP8_EDGE_LEFT]->mode == VP8_MVMODE_SPLIT) +
(mb_edge[VP8_EDGE_TOP]->mode == VP8_MVMODE_SPLIT)) * 2 +
(mb_edge[VP8_EDGE_TOPLEFT]->mode == VP8_MVMODE_SPLIT);
@@ -1109,11 +1116,11 @@ void vp8_decode_mvs(VP8Context *s, VP8Macroblock *mb,
mb->bmv[0] = mb->mv;
}
} else {
- clamp_mv(s, &mb->mv, &near_mv[CNT_NEAR]);
+ clamp_mv(mv_bounds, &mb->mv, &near_mv[CNT_NEAR]);
mb->bmv[0] = mb->mv;
}
} else {
- clamp_mv(s, &mb->mv, &near_mv[CNT_NEAREST]);
+ clamp_mv(mv_bounds, &mb->mv, &near_mv[CNT_NEAREST]);
mb->bmv[0] = mb->mv;
}
} else {
@@ -1159,14 +1166,15 @@ void decode_intra4x4_modes(VP8Context *s, VP56RangeCoder *c, VP8Macroblock *mb,
}
static av_always_inline
-void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y,
+void decode_mb_mode(VP8Context *s, VP8mvbounds *mv_bounds,
+ VP8Macroblock *mb, int mb_x, int mb_y,
uint8_t *segment, uint8_t *ref, int layout, int is_vp7)
{
VP56RangeCoder *c = &s->c;
- static const char *vp7_feature_name[] = { "q-index",
- "lf-delta",
- "partial-golden-update",
- "blit-pitch" };
+ static const char * const vp7_feature_name[] = { "q-index",
+ "lf-delta",
+ "partial-golden-update",
+ "blit-pitch" };
if (is_vp7) {
int i;
*segment = 0;
@@ -1223,7 +1231,7 @@ void decode_mb_mode(VP8Context *s, VP8Macroblock *mb, int mb_x, int mb_y,
if (is_vp7)
vp7_decode_mvs(s, mb, mb_x, mb_y, layout);
else
- vp8_decode_mvs(s, mb, mb_x, mb_y, layout);
+ vp8_decode_mvs(s, mv_bounds, mb, mb_x, mb_y, layout);
} else {
// intra MB, 16.1
mb->mode = vp8_rac_get_tree(c, vp8_pred16x16_tree_inter, s->prob->pred16x16);
@@ -1461,7 +1469,7 @@ void decode_mb_coeffs(VP8Context *s, VP8ThreadData *td, VP56RangeCoder *c,
static av_always_inline
void backup_mb_border(uint8_t *top_border, uint8_t *src_y,
uint8_t *src_cb, uint8_t *src_cr,
- int linesize, int uvlinesize, int simple)
+ ptrdiff_t linesize, ptrdiff_t uvlinesize, int simple)
{
AV_COPY128(top_border, src_y + 15 * linesize);
if (!simple) {
@@ -1472,7 +1480,7 @@ void backup_mb_border(uint8_t *top_border, uint8_t *src_y,
static av_always_inline
void xchg_mb_border(uint8_t *top_border, uint8_t *src_y, uint8_t *src_cb,
- uint8_t *src_cr, int linesize, int uvlinesize, int mb_x,
+ uint8_t *src_cr, ptrdiff_t linesize, ptrdiff_t uvlinesize, int mb_x,
int mb_y, int mb_width, int simple, int xchg)
{
uint8_t *top_border_m1 = top_border - 32; // for TL prediction
@@ -1625,7 +1633,8 @@ void intra_predict(VP8Context *s, VP8ThreadData *td, uint8_t *dst[3],
for (y = 0; y < 4; y++) {
uint8_t *topright = ptr + 4 - s->linesize;
for (x = 0; x < 4; x++) {
- int copy = 0, linesize = s->linesize;
+ int copy = 0;
+ ptrdiff_t linesize = s->linesize;
uint8_t *dst = ptr + 4 * x;
LOCAL_ALIGNED(4, uint8_t, copy_dst, [5 * 8]);
@@ -1731,7 +1740,7 @@ void vp8_mc_luma(VP8Context *s, VP8ThreadData *td, uint8_t *dst,
uint8_t *src = ref->f->data[0];
if (AV_RN32A(mv)) {
- int src_linesize = linesize;
+ ptrdiff_t src_linesize = linesize;
int mx = (mv->x * 2) & 7, mx_idx = subpel_idx[0][mx];
int my = (mv->y * 2) & 7, my_idx = subpel_idx[0][my];
@@ -2077,8 +2086,8 @@ void filter_mb(VP8Context *s, uint8_t *dst[3], VP8FilterStrength *f,
int filter_level = f->filter_level;
int inner_limit = f->inner_limit;
int inner_filter = f->inner_filter;
- int linesize = s->linesize;
- int uvlinesize = s->uvlinesize;
+ ptrdiff_t linesize = s->linesize;
+ ptrdiff_t uvlinesize = s->uvlinesize;
static const uint8_t hev_thresh_lut[2][64] = {
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -2164,7 +2173,7 @@ void filter_mb_simple(VP8Context *s, uint8_t *dst, VP8FilterStrength *f,
int filter_level = f->filter_level;
int inner_limit = f->inner_limit;
int inner_filter = f->inner_filter;
- int linesize = s->linesize;
+ ptrdiff_t linesize = s->linesize;
if (!filter_level)
return;
@@ -2197,8 +2206,8 @@ void vp78_decode_mv_mb_modes(AVCodecContext *avctx, VP8Frame *curframe,
VP8Context *s = avctx->priv_data;
int mb_x, mb_y;
- s->mv_min.y = -MARGIN;
- s->mv_max.y = ((s->mb_height - 1) << 6) + MARGIN;
+ s->mv_bounds.mv_min.y = -MARGIN;
+ s->mv_bounds.mv_max.y = ((s->mb_height - 1) << 6) + MARGIN;
for (mb_y = 0; mb_y < s->mb_height; mb_y++) {
VP8Macroblock *mb = s->macroblocks_base +
((s->mb_width + 1) * (mb_y + 1) + 1);
@@ -2206,20 +2215,20 @@ void vp78_decode_mv_mb_modes(AVCodecContext *avctx, VP8Frame *curframe,
AV_WN32A(s->intra4x4_pred_mode_left, DC_PRED * 0x01010101);
- s->mv_min.x = -MARGIN;
- s->mv_max.x = ((s->mb_width - 1) << 6) + MARGIN;
+ s->mv_bounds.mv_min.x = -MARGIN;
+ s->mv_bounds.mv_max.x = ((s->mb_width - 1) << 6) + MARGIN;
for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb_xy++, mb++) {
if (mb_y == 0)
AV_WN32A((mb - s->mb_width - 1)->intra4x4_pred_mode_top,
DC_PRED * 0x01010101);
- decode_mb_mode(s, mb, mb_x, mb_y, curframe->seg_map->data + mb_xy,
+ decode_mb_mode(s, &s->mv_bounds, mb, mb_x, mb_y, curframe->seg_map->data + mb_xy,
prev_frame && prev_frame->seg_map ?
prev_frame->seg_map->data + mb_xy : NULL, 1, is_vp7);
- s->mv_min.x -= 64;
- s->mv_max.x -= 64;
+ s->mv_bounds.mv_min.x -= 64;
+ s->mv_bounds.mv_max.x -= 64;
}
- s->mv_min.y -= 64;
- s->mv_max.y -= 64;
+ s->mv_bounds.mv_min.y -= 64;
+ s->mv_bounds.mv_max.y -= 64;
}
}
@@ -2239,15 +2248,15 @@ static void vp8_decode_mv_mb_modes(AVCodecContext *avctx, VP8Frame *cur_frame,
#define check_thread_pos(td, otd, mb_x_check, mb_y_check) \
do { \
int tmp = (mb_y_check << 16) | (mb_x_check & 0xFFFF); \
- if (otd->thread_mb_pos < tmp) { \
+ if (atomic_load(&otd->thread_mb_pos) < tmp) { \
pthread_mutex_lock(&otd->lock); \
- td->wait_mb_pos = tmp; \
+ atomic_store(&td->wait_mb_pos, tmp); \
do { \
- if (otd->thread_mb_pos >= tmp) \
+ if (atomic_load(&otd->thread_mb_pos) >= tmp) \
break; \
pthread_cond_wait(&otd->cond, &otd->lock); \
} while (1); \
- td->wait_mb_pos = INT_MAX; \
+ atomic_store(&td->wait_mb_pos, INT_MAX); \
pthread_mutex_unlock(&otd->lock); \
} \
} while (0)
@@ -2258,12 +2267,10 @@ static void vp8_decode_mv_mb_modes(AVCodecContext *avctx, VP8Frame *cur_frame,
int sliced_threading = (avctx->active_thread_type == FF_THREAD_SLICE) && \
(num_jobs > 1); \
int is_null = !next_td || !prev_td; \
- int pos_check = (is_null) ? 1 \
- : (next_td != td && \
- pos >= next_td->wait_mb_pos) || \
- (prev_td != td && \
- pos >= prev_td->wait_mb_pos); \
- td->thread_mb_pos = pos; \
+ int pos_check = (is_null) ? 1 : \
+ (next_td != td && pos >= atomic_load(&next_td->wait_mb_pos)) || \
+ (prev_td != td && pos >= atomic_load(&prev_td->wait_mb_pos)); \
+ atomic_store(&td->thread_mb_pos, pos); \
if (sliced_threading && pos_check) { \
pthread_mutex_lock(&td->lock); \
pthread_cond_broadcast(&td->cond); \
@@ -2275,12 +2282,12 @@ static void vp8_decode_mv_mb_modes(AVCodecContext *avctx, VP8Frame *cur_frame,
#define update_pos(td, mb_y, mb_x) while(0)
#endif
-static av_always_inline void decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata,
+static av_always_inline int decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata,
int jobnr, int threadnr, int is_vp7)
{
VP8Context *s = avctx->priv_data;
VP8ThreadData *prev_td, *next_td, *td = &s->thread_data[threadnr];
- int mb_y = td->thread_mb_pos >> 16;
+ int mb_y = atomic_load(&td->thread_mb_pos) >> 16;
int mb_x, mb_xy = mb_y * s->mb_width;
int num_jobs = s->num_jobs;
VP8Frame *curframe = s->curframe, *prev_frame = s->prev_frame;
@@ -2291,6 +2298,10 @@ static av_always_inline void decode_mb_row_no_filter(AVCodecContext *avctx, void
curframe->tf.f->data[1] + 8 * mb_y * s->uvlinesize,
curframe->tf.f->data[2] + 8 * mb_y * s->uvlinesize
};
+
+ if (c->end <= c->buffer && c->bits >= 0)
+ return AVERROR_INVALIDDATA;
+
if (mb_y == 0)
prev_td = td;
else
@@ -2315,10 +2326,12 @@ static av_always_inline void decode_mb_row_no_filter(AVCodecContext *avctx, void
if (!is_vp7 || mb_y == 0)
memset(td->left_nnz, 0, sizeof(td->left_nnz));
- s->mv_min.x = -MARGIN;
- s->mv_max.x = ((s->mb_width - 1) << 6) + MARGIN;
+ td->mv_bounds.mv_min.x = -MARGIN;
+ td->mv_bounds.mv_max.x = ((s->mb_width - 1) << 6) + MARGIN;
for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb_xy++, mb++) {
+ if (c->end <= c->buffer && c->bits >= 0)
+ return AVERROR_INVALIDDATA;
// Wait for previous thread to read mb_x+2, and reach mb_y-1.
if (prev_td != td) {
if (threadnr != 0) {
@@ -2338,7 +2351,7 @@ static av_always_inline void decode_mb_row_no_filter(AVCodecContext *avctx, void
dst[2] - dst[1], 2);
if (!s->mb_layout)
- decode_mb_mode(s, mb, mb_x, mb_y, curframe->seg_map->data + mb_xy,
+ decode_mb_mode(s, &td->mv_bounds, mb, mb_x, mb_y, curframe->seg_map->data + mb_xy,
prev_frame && prev_frame->seg_map ?
prev_frame->seg_map->data + mb_xy : NULL, 0, is_vp7);
@@ -2385,8 +2398,8 @@ static av_always_inline void decode_mb_row_no_filter(AVCodecContext *avctx, void
dst[0] += 16;
dst[1] += 8;
dst[2] += 8;
- s->mv_min.x -= 64;
- s->mv_max.x -= 64;
+ td->mv_bounds.mv_min.x -= 64;
+ td->mv_bounds.mv_max.x -= 64;
if (mb_x == s->mb_width + 1) {
update_pos(td, mb_y, s->mb_width + 3);
@@ -2394,18 +2407,19 @@ static av_always_inline void decode_mb_row_no_filter(AVCodecContext *avctx, void
update_pos(td, mb_y, mb_x);
}
}
+ return 0;
}
-static void vp7_decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata,
+static int vp7_decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata,
int jobnr, int threadnr)
{
- decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr, 1);
+ return decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr, 1);
}
-static void vp8_decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata,
+static int vp8_decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata,
int jobnr, int threadnr)
{
- decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr, 0);
+ return decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr, 0);
}
static av_always_inline void filter_mb_row(AVCodecContext *avctx, void *tdata,
@@ -2413,7 +2427,7 @@ static av_always_inline void filter_mb_row(AVCodecContext *avctx, void *tdata,
{
VP8Context *s = avctx->priv_data;
VP8ThreadData *td = &s->thread_data[threadnr];
- int mb_x, mb_y = td->thread_mb_pos >> 16, num_jobs = s->num_jobs;
+ int mb_x, mb_y = atomic_load(&td->thread_mb_pos) >> 16, num_jobs = s->num_jobs;
AVFrame *curframe = s->curframe->tf.f;
VP8Macroblock *mb;
VP8ThreadData *prev_td, *next_td;
@@ -2488,19 +2502,24 @@ int vp78_decode_mb_row_sliced(AVCodecContext *avctx, void *tdata, int jobnr,
VP8ThreadData *next_td = NULL, *prev_td = NULL;
VP8Frame *curframe = s->curframe;
int mb_y, num_jobs = s->num_jobs;
+ int ret;
td->thread_nr = threadnr;
+ td->mv_bounds.mv_min.y = -MARGIN - 64 * threadnr;
+ td->mv_bounds.mv_max.y = ((s->mb_height - 1) << 6) + MARGIN - 64 * threadnr;
for (mb_y = jobnr; mb_y < s->mb_height; mb_y += num_jobs) {
- if (mb_y >= s->mb_height)
- break;
- td->thread_mb_pos = mb_y << 16;
- s->decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr);
+ atomic_store(&td->thread_mb_pos, mb_y << 16);
+ ret = s->decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr);
+ if (ret < 0) {
+ update_pos(td, s->mb_height, INT_MAX & 0xFFFF);
+ return ret;
+ }
if (s->deblock_filter)
s->filter_mb_row(avctx, tdata, jobnr, threadnr);
update_pos(td, mb_y, INT_MAX & 0xFFFF);
- s->mv_min.y -= 64;
- s->mv_max.y -= 64;
+ td->mv_bounds.mv_min.y -= 64 * num_jobs;
+ td->mv_bounds.mv_max.y -= 64 * num_jobs;
if (avctx->active_thread_type == FF_THREAD_FRAME)
ff_thread_report_progress(&curframe->tf, mb_y, 0);
@@ -2531,6 +2550,8 @@ int vp78_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
enum AVDiscard skip_thresh;
VP8Frame *av_uninit(curframe), *prev_frame;
+ av_assert0(avctx->pix_fmt == AV_PIX_FMT_YUVA420P || avctx->pix_fmt == AV_PIX_FMT_YUV420P);
+
if (is_vp7)
ret = vp7_decode_frame_header(s, avpkt->data, avpkt->size);
else
@@ -2646,11 +2667,12 @@ int vp78_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
s->num_jobs = num_jobs;
s->curframe = curframe;
s->prev_frame = prev_frame;
- s->mv_min.y = -MARGIN;
- s->mv_max.y = ((s->mb_height - 1) << 6) + MARGIN;
+ s->mv_bounds.mv_min.y = -MARGIN;
+ s->mv_bounds.mv_max.y = ((s->mb_height - 1) << 6) + MARGIN;
for (i = 0; i < MAX_THREADS; i++) {
- s->thread_data[i].thread_mb_pos = 0;
- s->thread_data[i].wait_mb_pos = INT_MAX;
+ VP8ThreadData *td = &s->thread_data[i];
+ atomic_init(&td->thread_mb_pos, 0);
+ atomic_init(&td->wait_mb_pos, INT_MAX);
}
if (is_vp7)
avctx->execute2(avctx, vp7_decode_mb_row_sliced, s->thread_data, NULL,
diff --git a/media/ffvpx/libavcodec/vp8.h b/media/ffvpx/libavcodec/vp8.h
index 374e1388e2..8263997e3f 100644
--- a/media/ffvpx/libavcodec/vp8.h
+++ b/media/ffvpx/libavcodec/vp8.h
@@ -26,6 +26,8 @@
#ifndef AVCODEC_VP8_H
#define AVCODEC_VP8_H
+#include <stdatomic.h>
+
#include "libavutil/buffer.h"
#include "libavutil/thread.h"
@@ -91,6 +93,16 @@ typedef struct VP8Macroblock {
VP56mv bmv[16];
} VP8Macroblock;
+typedef struct VP8intmv {
+ int x;
+ int y;
+} VP8intmv;
+
+typedef struct VP8mvbounds {
+ VP8intmv mv_min;
+ VP8intmv mv_max;
+} VP8mvbounds;
+
typedef struct VP8ThreadData {
DECLARE_ALIGNED(16, int16_t, block)[6][4][16];
DECLARE_ALIGNED(16, int16_t, block_dc)[16];
@@ -114,12 +126,13 @@ typedef struct VP8ThreadData {
pthread_mutex_t lock;
pthread_cond_t cond;
#endif
- int thread_mb_pos; // (mb_y << 16) | (mb_x & 0xFFFF)
- int wait_mb_pos; // What the current thread is waiting on.
+ atomic_int thread_mb_pos; // (mb_y << 16) | (mb_x & 0xFFFF)
+ atomic_int wait_mb_pos; // What the current thread is waiting on.
#define EDGE_EMU_LINESIZE 32
DECLARE_ALIGNED(16, uint8_t, edge_emu_buffer)[21 * EDGE_EMU_LINESIZE];
VP8FilterStrength *filter_strength;
+ VP8mvbounds mv_bounds;
} VP8ThreadData;
typedef struct VP8Frame {
@@ -127,11 +140,6 @@ typedef struct VP8Frame {
AVBufferRef *seg_map;
} VP8Frame;
-typedef struct VP8intmv {
- int x;
- int y;
-} VP8intmv;
-
#define MAX_THREADS 8
typedef struct VP8Context {
VP8ThreadData *thread_data;
@@ -143,15 +151,14 @@ typedef struct VP8Context {
uint16_t mb_width; /* number of horizontal MB */
uint16_t mb_height; /* number of vertical MB */
- int linesize;
- int uvlinesize;
+ ptrdiff_t linesize;
+ ptrdiff_t uvlinesize;
uint8_t keyframe;
uint8_t deblock_filter;
uint8_t mbskip_enabled;
uint8_t profile;
- VP8intmv mv_min;
- VP8intmv mv_max;
+ VP8mvbounds mv_bounds;
int8_t sign_bias[4]; ///< one state [0, 1] per ref frame type
int ref_count[3];
@@ -275,7 +282,7 @@ typedef struct VP8Context {
*/
int mb_layout;
- void (*decode_mb_row_no_filter)(AVCodecContext *avctx, void *tdata, int jobnr, int threadnr);
+ int (*decode_mb_row_no_filter)(AVCodecContext *avctx, void *tdata, int jobnr, int threadnr);
void (*filter_mb_row)(AVCodecContext *avctx, void *tdata, int jobnr, int threadnr);
int vp7;
diff --git a/media/ffvpx/libavcodec/vp8_parser.c b/media/ffvpx/libavcodec/vp8_parser.c
index afc7f991e6..609f5077d1 100644
--- a/media/ffvpx/libavcodec/vp8_parser.c
+++ b/media/ffvpx/libavcodec/vp8_parser.c
@@ -1,6 +1,4 @@
/*
- * Copyright (C) 2008 Michael Niedermayer
- *
* This file is part of FFmpeg.
*
* FFmpeg is free software; you can redistribute it and/or
@@ -18,15 +16,56 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include "parser.h"
+#include "libavutil/intreadwrite.h"
+
+#include "avcodec.h"
static int parse(AVCodecParserContext *s,
AVCodecContext *avctx,
const uint8_t **poutbuf, int *poutbuf_size,
const uint8_t *buf, int buf_size)
{
- s->pict_type = (buf[0] & 0x01) ? AV_PICTURE_TYPE_P
- : AV_PICTURE_TYPE_I;
+ unsigned int frame_type;
+ unsigned int profile;
+
+ if (buf_size < 3)
+ return buf_size;
+
+ frame_type = buf[0] & 1;
+ profile = (buf[0] >> 1) & 7;
+ if (profile > 3) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid profile %u.\n", profile);
+ return buf_size;
+ }
+
+ avctx->profile = profile;
+ s->key_frame = frame_type == 0;
+ s->pict_type = frame_type ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I;
+ s->format = AV_PIX_FMT_YUV420P;
+ s->field_order = AV_FIELD_PROGRESSIVE;
+ s->picture_structure = AV_PICTURE_STRUCTURE_FRAME;
+
+ if (frame_type == 0) {
+ unsigned int sync_code;
+ unsigned int width, height;
+
+ if (buf_size < 10)
+ return buf_size;
+
+ sync_code = AV_RL24(buf + 3);
+ if (sync_code != 0x2a019d) {
+ av_log(avctx, AV_LOG_ERROR, "Invalid sync code %06x.\n", sync_code);
+ return buf_size;
+ }
+
+ width = AV_RL16(buf + 6) & 0x3fff;
+ height = AV_RL16(buf + 8) & 0x3fff;
+
+ s->width = width;
+ s->height = height;
+ s->coded_width = FFALIGN(width, 16);
+ s->coded_height = FFALIGN(height, 16);
+ }
*poutbuf = buf;
*poutbuf_size = buf_size;
diff --git a/media/ffvpx/libavcodec/vp8dsp.c b/media/ffvpx/libavcodec/vp8dsp.c
index 07bea69c78..fed5c67a90 100644
--- a/media/ffvpx/libavcodec/vp8dsp.c
+++ b/media/ffvpx/libavcodec/vp8dsp.c
@@ -53,7 +53,8 @@ static void name ## _idct_dc_add4y_c(uint8_t *dst, int16_t block[4][16], \
#if CONFIG_VP7_DECODER
static void vp7_luma_dc_wht_c(int16_t block[4][4][16], int16_t dc[16])
{
- int i, a1, b1, c1, d1;
+ int i;
+ unsigned a1, b1, c1, d1;
int16_t tmp[16];
for (i = 0; i < 4; i++) {
@@ -61,10 +62,10 @@ static void vp7_luma_dc_wht_c(int16_t block[4][4][16], int16_t dc[16])
b1 = (dc[i * 4 + 0] - dc[i * 4 + 2]) * 23170;
c1 = dc[i * 4 + 1] * 12540 - dc[i * 4 + 3] * 30274;
d1 = dc[i * 4 + 1] * 30274 + dc[i * 4 + 3] * 12540;
- tmp[i * 4 + 0] = (a1 + d1) >> 14;
- tmp[i * 4 + 3] = (a1 - d1) >> 14;
- tmp[i * 4 + 1] = (b1 + c1) >> 14;
- tmp[i * 4 + 2] = (b1 - c1) >> 14;
+ tmp[i * 4 + 0] = (int)(a1 + d1) >> 14;
+ tmp[i * 4 + 3] = (int)(a1 - d1) >> 14;
+ tmp[i * 4 + 1] = (int)(b1 + c1) >> 14;
+ tmp[i * 4 + 2] = (int)(b1 - c1) >> 14;
}
for (i = 0; i < 4; i++) {
@@ -73,10 +74,10 @@ static void vp7_luma_dc_wht_c(int16_t block[4][4][16], int16_t dc[16])
c1 = tmp[i + 4] * 12540 - tmp[i + 12] * 30274;
d1 = tmp[i + 4] * 30274 + tmp[i + 12] * 12540;
AV_ZERO64(dc + i * 4);
- block[0][i][0] = (a1 + d1 + 0x20000) >> 18;
- block[3][i][0] = (a1 - d1 + 0x20000) >> 18;
- block[1][i][0] = (b1 + c1 + 0x20000) >> 18;
- block[2][i][0] = (b1 - c1 + 0x20000) >> 18;
+ block[0][i][0] = (int)(a1 + d1 + 0x20000) >> 18;
+ block[3][i][0] = (int)(a1 - d1 + 0x20000) >> 18;
+ block[1][i][0] = (int)(b1 + c1 + 0x20000) >> 18;
+ block[2][i][0] = (int)(b1 - c1 + 0x20000) >> 18;
}
}
@@ -95,7 +96,8 @@ static void vp7_luma_dc_wht_dc_c(int16_t block[4][4][16], int16_t dc[16])
static void vp7_idct_add_c(uint8_t *dst, int16_t block[16], ptrdiff_t stride)
{
- int i, a1, b1, c1, d1;
+ int i;
+ unsigned a1, b1, c1, d1;
int16_t tmp[16];
for (i = 0; i < 4; i++) {
@@ -104,10 +106,10 @@ static void vp7_idct_add_c(uint8_t *dst, int16_t block[16], ptrdiff_t stride)
c1 = block[i * 4 + 1] * 12540 - block[i * 4 + 3] * 30274;
d1 = block[i * 4 + 1] * 30274 + block[i * 4 + 3] * 12540;
AV_ZERO64(block + i * 4);
- tmp[i * 4 + 0] = (a1 + d1) >> 14;
- tmp[i * 4 + 3] = (a1 - d1) >> 14;
- tmp[i * 4 + 1] = (b1 + c1) >> 14;
- tmp[i * 4 + 2] = (b1 - c1) >> 14;
+ tmp[i * 4 + 0] = (int)(a1 + d1) >> 14;
+ tmp[i * 4 + 3] = (int)(a1 - d1) >> 14;
+ tmp[i * 4 + 1] = (int)(b1 + c1) >> 14;
+ tmp[i * 4 + 2] = (int)(b1 - c1) >> 14;
}
for (i = 0; i < 4; i++) {
@@ -116,13 +118,13 @@ static void vp7_idct_add_c(uint8_t *dst, int16_t block[16], ptrdiff_t stride)
c1 = tmp[i + 4] * 12540 - tmp[i + 12] * 30274;
d1 = tmp[i + 4] * 30274 + tmp[i + 12] * 12540;
dst[0 * stride + i] = av_clip_uint8(dst[0 * stride + i] +
- ((a1 + d1 + 0x20000) >> 18));
+ ((int)(a1 + d1 + 0x20000) >> 18));
dst[3 * stride + i] = av_clip_uint8(dst[3 * stride + i] +
- ((a1 - d1 + 0x20000) >> 18));
+ ((int)(a1 - d1 + 0x20000) >> 18));
dst[1 * stride + i] = av_clip_uint8(dst[1 * stride + i] +
- ((b1 + c1 + 0x20000) >> 18));
+ ((int)(b1 + c1 + 0x20000) >> 18));
dst[2 * stride + i] = av_clip_uint8(dst[2 * stride + i] +
- ((b1 - c1 + 0x20000) >> 18));
+ ((int)(b1 - c1 + 0x20000) >> 18));
}
}
diff --git a/media/ffvpx/libavcodec/vp8dsp.h b/media/ffvpx/libavcodec/vp8dsp.h
index 0401c9221b..eaae4aed6d 100644
--- a/media/ffvpx/libavcodec/vp8dsp.h
+++ b/media/ffvpx/libavcodec/vp8dsp.h
@@ -70,12 +70,12 @@ typedef struct VP8DSPContext {
void (*vp8_h_loop_filter_simple)(uint8_t *dst, ptrdiff_t stride, int flim);
/**
- * first dimension: width>>3, height is assumed equal to width
+ * first dimension: 4-log2(width)
* second dimension: 0 if no vertical interpolation is needed;
* 1 4-tap vertical interpolation filter (my & 1)
* 2 6-tap vertical interpolation filter (!(my & 1))
* third dimension: same as second dimension, for horizontal interpolation
- * so something like put_vp8_epel_pixels_tab[width>>3][2*!!my-(my&1)][2*!!mx-(mx&1)](..., mx, my)
+ * so something like put_vp8_epel_pixels_tab[4-log2(width)][2*!!my-(my&1)][2*!!mx-(mx&1)](..., mx, my)
*/
vp8_mc_func put_vp8_epel_pixels_tab[3][3][3];
vp8_mc_func put_vp8_bilinear_pixels_tab[3][3][3];
diff --git a/media/ffvpx/libavcodec/vp9.c b/media/ffvpx/libavcodec/vp9.c
index 1aab6ba03c..f2cf194243 100644
--- a/media/ffvpx/libavcodec/vp9.c
+++ b/media/ffvpx/libavcodec/vp9.c
@@ -30,176 +30,97 @@
#include "vp56.h"
#include "vp9.h"
#include "vp9data.h"
-#include "vp9dsp.h"
+#include "vp9dec.h"
#include "libavutil/avassert.h"
#include "libavutil/pixdesc.h"
#define VP9_SYNCCODE 0x498342
-struct VP9Filter {
- uint8_t level[8 * 8];
- uint8_t /* bit=col */ mask[2 /* 0=y, 1=uv */][2 /* 0=col, 1=row */]
- [8 /* rows */][4 /* 0=16, 1=8, 2=4, 3=inner4 */];
-};
+#if HAVE_THREADS
+static void vp9_free_entries(AVCodecContext *avctx) {
+ VP9Context *s = avctx->priv_data;
-typedef struct VP9Block {
- uint8_t seg_id, intra, comp, ref[2], mode[4], uvmode, skip;
- enum FilterMode filter;
- VP56mv mv[4 /* b_idx */][2 /* ref */];
- enum BlockSize bs;
- enum TxfmMode tx, uvtx;
- enum BlockLevel bl;
- enum BlockPartition bp;
-} VP9Block;
-
-typedef struct VP9Context {
- VP9SharedContext s;
-
- VP9DSPContext dsp;
- VideoDSPContext vdsp;
- GetBitContext gb;
- VP56RangeCoder c;
- VP56RangeCoder *c_b;
- unsigned c_b_size;
- VP9Block *b_base, *b;
- int pass;
- int row, row7, col, col7;
- uint8_t *dst[3];
- ptrdiff_t y_stride, uv_stride;
-
- uint8_t ss_h, ss_v;
- uint8_t last_bpp, bpp, bpp_index, bytesperpixel;
- uint8_t last_keyframe;
- // sb_cols/rows, rows/cols and last_fmt are used for allocating all internal
- // arrays, and are thus per-thread. w/h and gf_fmt are synced between threads
- // and are therefore per-stream. pix_fmt represents the value in the header
- // of the currently processed frame.
- int w, h;
- enum AVPixelFormat pix_fmt, last_fmt, gf_fmt;
- unsigned sb_cols, sb_rows, rows, cols;
- ThreadFrame next_refs[8];
-
- struct {
- uint8_t lim_lut[64];
- uint8_t mblim_lut[64];
- } filter_lut;
- unsigned tile_row_start, tile_row_end, tile_col_start, tile_col_end;
- struct {
- prob_context p;
- uint8_t coef[4][2][2][6][6][3];
- } prob_ctx[4];
- struct {
- prob_context p;
- uint8_t coef[4][2][2][6][6][11];
- } prob;
- struct {
- unsigned y_mode[4][10];
- unsigned uv_mode[10][10];
- unsigned filter[4][3];
- unsigned mv_mode[7][4];
- unsigned intra[4][2];
- unsigned comp[5][2];
- unsigned single_ref[5][2][2];
- unsigned comp_ref[5][2];
- unsigned tx32p[2][4];
- unsigned tx16p[2][3];
- unsigned tx8p[2][2];
- unsigned skip[3][2];
- unsigned mv_joint[4];
- struct {
- unsigned sign[2];
- unsigned classes[11];
- unsigned class0[2];
- unsigned bits[10][2];
- unsigned class0_fp[2][4];
- unsigned fp[4];
- unsigned class0_hp[2];
- unsigned hp[2];
- } mv_comp[2];
- unsigned partition[4][4][4];
- unsigned coef[4][2][2][6][6][3];
- unsigned eob[4][2][2][6][6][2];
- } counts;
-
- // contextual (left/above) cache
- DECLARE_ALIGNED(16, uint8_t, left_y_nnz_ctx)[16];
- DECLARE_ALIGNED(16, uint8_t, left_mode_ctx)[16];
- DECLARE_ALIGNED(16, VP56mv, left_mv_ctx)[16][2];
- DECLARE_ALIGNED(16, uint8_t, left_uv_nnz_ctx)[2][16];
- DECLARE_ALIGNED(8, uint8_t, left_partition_ctx)[8];
- DECLARE_ALIGNED(8, uint8_t, left_skip_ctx)[8];
- DECLARE_ALIGNED(8, uint8_t, left_txfm_ctx)[8];
- DECLARE_ALIGNED(8, uint8_t, left_segpred_ctx)[8];
- DECLARE_ALIGNED(8, uint8_t, left_intra_ctx)[8];
- DECLARE_ALIGNED(8, uint8_t, left_comp_ctx)[8];
- DECLARE_ALIGNED(8, uint8_t, left_ref_ctx)[8];
- DECLARE_ALIGNED(8, uint8_t, left_filter_ctx)[8];
- uint8_t *above_partition_ctx;
- uint8_t *above_mode_ctx;
- // FIXME maybe merge some of the below in a flags field?
- uint8_t *above_y_nnz_ctx;
- uint8_t *above_uv_nnz_ctx[2];
- uint8_t *above_skip_ctx; // 1bit
- uint8_t *above_txfm_ctx; // 2bit
- uint8_t *above_segpred_ctx; // 1bit
- uint8_t *above_intra_ctx; // 1bit
- uint8_t *above_comp_ctx; // 1bit
- uint8_t *above_ref_ctx; // 2bit
- uint8_t *above_filter_ctx;
- VP56mv (*above_mv_ctx)[2];
-
- // whole-frame cache
- uint8_t *intra_pred_data[3];
- struct VP9Filter *lflvl;
- DECLARE_ALIGNED(32, uint8_t, edge_emu_buffer)[135 * 144 * 2];
-
- // block reconstruction intermediates
- int block_alloc_using_2pass;
- int16_t *block_base, *block, *uvblock_base[2], *uvblock[2];
- uint8_t *eob_base, *uveob_base[2], *eob, *uveob[2];
- struct { int x, y; } min_mv, max_mv;
- DECLARE_ALIGNED(32, uint8_t, tmp_y)[64 * 64 * 2];
- DECLARE_ALIGNED(32, uint8_t, tmp_uv)[2][64 * 64 * 2];
- uint16_t mvscale[3][2];
- uint8_t mvstep[3][2];
-} VP9Context;
-
-static const uint8_t bwh_tab[2][N_BS_SIZES][2] = {
- {
- { 16, 16 }, { 16, 8 }, { 8, 16 }, { 8, 8 }, { 8, 4 }, { 4, 8 },
- { 4, 4 }, { 4, 2 }, { 2, 4 }, { 2, 2 }, { 2, 1 }, { 1, 2 }, { 1, 1 },
- }, {
- { 8, 8 }, { 8, 4 }, { 4, 8 }, { 4, 4 }, { 4, 2 }, { 2, 4 },
- { 2, 2 }, { 2, 1 }, { 1, 2 }, { 1, 1 }, { 1, 1 }, { 1, 1 }, { 1, 1 },
+ if (avctx->active_thread_type & FF_THREAD_SLICE) {
+ pthread_mutex_destroy(&s->progress_mutex);
+ pthread_cond_destroy(&s->progress_cond);
+ av_freep(&s->entries);
}
-};
+}
+
+static int vp9_alloc_entries(AVCodecContext *avctx, int n) {
+ VP9Context *s = avctx->priv_data;
+ int i;
+
+ if (avctx->active_thread_type & FF_THREAD_SLICE) {
+ if (s->entries)
+ av_freep(&s->entries);
+
+ s->entries = av_malloc_array(n, sizeof(atomic_int));
+
+ if (!s->entries) {
+ av_freep(&s->entries);
+ return AVERROR(ENOMEM);
+ }
-static void vp9_unref_frame(AVCodecContext *ctx, VP9Frame *f)
+ for (i = 0; i < n; i++)
+ atomic_init(&s->entries[i], 0);
+
+ pthread_mutex_init(&s->progress_mutex, NULL);
+ pthread_cond_init(&s->progress_cond, NULL);
+ }
+ return 0;
+}
+
+static void vp9_report_tile_progress(VP9Context *s, int field, int n) {
+ pthread_mutex_lock(&s->progress_mutex);
+ atomic_fetch_add_explicit(&s->entries[field], n, memory_order_release);
+ pthread_cond_signal(&s->progress_cond);
+ pthread_mutex_unlock(&s->progress_mutex);
+}
+
+static void vp9_await_tile_progress(VP9Context *s, int field, int n) {
+ if (atomic_load_explicit(&s->entries[field], memory_order_acquire) >= n)
+ return;
+
+ pthread_mutex_lock(&s->progress_mutex);
+ while (atomic_load_explicit(&s->entries[field], memory_order_relaxed) != n)
+ pthread_cond_wait(&s->progress_cond, &s->progress_mutex);
+ pthread_mutex_unlock(&s->progress_mutex);
+}
+#else
+static void vp9_free_entries(AVCodecContext *avctx) {}
+static int vp9_alloc_entries(AVCodecContext *avctx, int n) { return 0; }
+#endif
+
+static void vp9_frame_unref(AVCodecContext *avctx, VP9Frame *f)
{
- ff_thread_release_buffer(ctx, &f->tf);
+ ff_thread_release_buffer(avctx, &f->tf);
av_buffer_unref(&f->extradata);
av_buffer_unref(&f->hwaccel_priv_buf);
f->segmentation_map = NULL;
f->hwaccel_picture_private = NULL;
}
-static int vp9_alloc_frame(AVCodecContext *ctx, VP9Frame *f)
+static int vp9_frame_alloc(AVCodecContext *avctx, VP9Frame *f)
{
- VP9Context *s = ctx->priv_data;
+ VP9Context *s = avctx->priv_data;
int ret, sz;
- if ((ret = ff_thread_get_buffer(ctx, &f->tf, AV_GET_BUFFER_FLAG_REF)) < 0)
+ ret = ff_thread_get_buffer(avctx, &f->tf, AV_GET_BUFFER_FLAG_REF);
+ if (ret < 0)
return ret;
+
sz = 64 * s->sb_cols * s->sb_rows;
- if (!(f->extradata = av_buffer_allocz(sz * (1 + sizeof(struct VP9mvrefPair))))) {
+ f->extradata = av_buffer_allocz(sz * (1 + sizeof(VP9mvrefPair)));
+ if (!f->extradata) {
goto fail;
}
f->segmentation_map = f->extradata->data;
- f->mv = (struct VP9mvrefPair *) (f->extradata->data + sz);
+ f->mv = (VP9mvrefPair *) (f->extradata->data + sz);
- if (ctx->hwaccel) {
- const AVHWAccel *hwaccel = ctx->hwaccel;
+ if (avctx->hwaccel) {
+ const AVHWAccel *hwaccel = avctx->hwaccel;
av_assert0(!f->hwaccel_picture_private);
if (hwaccel->frame_priv_data_size) {
f->hwaccel_priv_buf = av_buffer_allocz(hwaccel->frame_priv_data_size);
@@ -212,19 +133,21 @@ static int vp9_alloc_frame(AVCodecContext *ctx, VP9Frame *f)
return 0;
fail:
- vp9_unref_frame(ctx, f);
+ vp9_frame_unref(avctx, f);
return AVERROR(ENOMEM);
}
-static int vp9_ref_frame(AVCodecContext *ctx, VP9Frame *dst, VP9Frame *src)
+static int vp9_frame_ref(AVCodecContext *avctx, VP9Frame *dst, VP9Frame *src)
{
- int res;
+ int ret;
- if ((res = ff_thread_ref_frame(&dst->tf, &src->tf)) < 0) {
- return res;
- } else if (!(dst->extradata = av_buffer_ref(src->extradata))) {
+ ret = ff_thread_ref_frame(&dst->tf, &src->tf);
+ if (ret < 0)
+ return ret;
+
+ dst->extradata = av_buffer_ref(src->extradata);
+ if (!dst->extradata)
goto fail;
- }
dst->segmentation_map = src->segmentation_map;
dst->mv = src->mv;
@@ -240,44 +163,54 @@ static int vp9_ref_frame(AVCodecContext *ctx, VP9Frame *dst, VP9Frame *src)
return 0;
fail:
- vp9_unref_frame(ctx, dst);
+ vp9_frame_unref(avctx, dst);
return AVERROR(ENOMEM);
}
-static int update_size(AVCodecContext *ctx, int w, int h)
+static int update_size(AVCodecContext *avctx, int w, int h)
{
-#define HWACCEL_MAX (CONFIG_VP9_DXVA2_HWACCEL + CONFIG_VP9_D3D11VA_HWACCEL + CONFIG_VP9_VAAPI_HWACCEL)
+#define HWACCEL_MAX (CONFIG_VP9_DXVA2_HWACCEL + CONFIG_VP9_D3D11VA_HWACCEL * 2 + CONFIG_VP9_VAAPI_HWACCEL)
enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts;
- VP9Context *s = ctx->priv_data;
+ VP9Context *s = avctx->priv_data;
uint8_t *p;
- int bytesperpixel = s->bytesperpixel, res, cols, rows;
+ int bytesperpixel = s->bytesperpixel, ret, cols, rows;
+ int lflvl_len, i;
av_assert0(w > 0 && h > 0);
if (!(s->pix_fmt == s->gf_fmt && w == s->w && h == s->h)) {
- if ((res = ff_set_dimensions(ctx, w, h)) < 0)
- return res;
+ if ((ret = ff_set_dimensions(avctx, w, h)) < 0)
+ return ret;
- if (s->pix_fmt == AV_PIX_FMT_YUV420P) {
+ switch (s->pix_fmt) {
+ case AV_PIX_FMT_YUV420P:
#if CONFIG_VP9_DXVA2_HWACCEL
*fmtp++ = AV_PIX_FMT_DXVA2_VLD;
#endif
#if CONFIG_VP9_D3D11VA_HWACCEL
*fmtp++ = AV_PIX_FMT_D3D11VA_VLD;
+ *fmtp++ = AV_PIX_FMT_D3D11;
#endif
#if CONFIG_VP9_VAAPI_HWACCEL
*fmtp++ = AV_PIX_FMT_VAAPI;
#endif
+ break;
+ case AV_PIX_FMT_YUV420P10:
+ case AV_PIX_FMT_YUV420P12:
+#if CONFIG_VP9_VAAPI_HWACCEL
+ *fmtp++ = AV_PIX_FMT_VAAPI;
+#endif
+ break;
}
*fmtp++ = s->pix_fmt;
*fmtp = AV_PIX_FMT_NONE;
- res = ff_thread_get_format(ctx, pix_fmts);
- if (res < 0)
- return res;
+ ret = ff_thread_get_format(avctx, pix_fmts);
+ if (ret < 0)
+ return ret;
- ctx->pix_fmt = res;
+ avctx->pix_fmt = ret;
s->gf_fmt = s->pix_fmt;
s->w = w;
s->h = h;
@@ -294,13 +227,14 @@ static int update_size(AVCodecContext *ctx, int w, int h)
s->sb_rows = (h + 63) >> 6;
s->cols = (w + 7) >> 3;
s->rows = (h + 7) >> 3;
+ lflvl_len = avctx->active_thread_type == FF_THREAD_SLICE ? s->sb_rows : 1;
#define assign(var, type, n) var = (type) p; p += s->sb_cols * (n) * sizeof(*var)
av_freep(&s->intra_pred_data[0]);
// FIXME we slightly over-allocate here for subsampled chroma, but a little
// bit of padding shouldn't affect performance...
p = av_malloc(s->sb_cols * (128 + 192 * bytesperpixel +
- sizeof(*s->lflvl) + 16 * sizeof(*s->above_mv_ctx)));
+ lflvl_len * sizeof(*s->lflvl) + 16 * sizeof(*s->above_mv_ctx)));
if (!p)
return AVERROR(ENOMEM);
assign(s->intra_pred_data[0], uint8_t *, 64 * bytesperpixel);
@@ -319,65 +253,78 @@ static int update_size(AVCodecContext *ctx, int w, int h)
assign(s->above_comp_ctx, uint8_t *, 8);
assign(s->above_ref_ctx, uint8_t *, 8);
assign(s->above_filter_ctx, uint8_t *, 8);
- assign(s->lflvl, struct VP9Filter *, 1);
+ assign(s->lflvl, VP9Filter *, lflvl_len);
#undef assign
- // these will be re-allocated a little later
- av_freep(&s->b_base);
- av_freep(&s->block_base);
+ if (s->td) {
+ for (i = 0; i < s->active_tile_cols; i++) {
+ av_freep(&s->td[i].b_base);
+ av_freep(&s->td[i].block_base);
+ }
+ }
- if (s->bpp != s->last_bpp) {
- ff_vp9dsp_init(&s->dsp, s->bpp, ctx->flags & AV_CODEC_FLAG_BITEXACT);
- ff_videodsp_init(&s->vdsp, s->bpp);
- s->last_bpp = s->bpp;
+ if (s->s.h.bpp != s->last_bpp) {
+ ff_vp9dsp_init(&s->dsp, s->s.h.bpp, avctx->flags & AV_CODEC_FLAG_BITEXACT);
+ ff_videodsp_init(&s->vdsp, s->s.h.bpp);
+ s->last_bpp = s->s.h.bpp;
}
return 0;
}
-static int update_block_buffers(AVCodecContext *ctx)
+static int update_block_buffers(AVCodecContext *avctx)
{
- VP9Context *s = ctx->priv_data;
+ int i;
+ VP9Context *s = avctx->priv_data;
int chroma_blocks, chroma_eobs, bytesperpixel = s->bytesperpixel;
+ VP9TileData *td = &s->td[0];
- if (s->b_base && s->block_base && s->block_alloc_using_2pass == s->s.frames[CUR_FRAME].uses_2pass)
+ if (td->b_base && td->block_base && s->block_alloc_using_2pass == s->s.frames[CUR_FRAME].uses_2pass)
return 0;
- av_free(s->b_base);
- av_free(s->block_base);
+ av_free(td->b_base);
+ av_free(td->block_base);
chroma_blocks = 64 * 64 >> (s->ss_h + s->ss_v);
chroma_eobs = 16 * 16 >> (s->ss_h + s->ss_v);
if (s->s.frames[CUR_FRAME].uses_2pass) {
int sbs = s->sb_cols * s->sb_rows;
- s->b_base = av_malloc_array(s->cols * s->rows, sizeof(VP9Block));
- s->block_base = av_mallocz(((64 * 64 + 2 * chroma_blocks) * bytesperpixel * sizeof(int16_t) +
+ td->b_base = av_malloc_array(s->cols * s->rows, sizeof(VP9Block));
+ td->block_base = av_mallocz(((64 * 64 + 2 * chroma_blocks) * bytesperpixel * sizeof(int16_t) +
16 * 16 + 2 * chroma_eobs) * sbs);
- if (!s->b_base || !s->block_base)
+ if (!td->b_base || !td->block_base)
return AVERROR(ENOMEM);
- s->uvblock_base[0] = s->block_base + sbs * 64 * 64 * bytesperpixel;
- s->uvblock_base[1] = s->uvblock_base[0] + sbs * chroma_blocks * bytesperpixel;
- s->eob_base = (uint8_t *) (s->uvblock_base[1] + sbs * chroma_blocks * bytesperpixel);
- s->uveob_base[0] = s->eob_base + 16 * 16 * sbs;
- s->uveob_base[1] = s->uveob_base[0] + chroma_eobs * sbs;
+ td->uvblock_base[0] = td->block_base + sbs * 64 * 64 * bytesperpixel;
+ td->uvblock_base[1] = td->uvblock_base[0] + sbs * chroma_blocks * bytesperpixel;
+ td->eob_base = (uint8_t *) (td->uvblock_base[1] + sbs * chroma_blocks * bytesperpixel);
+ td->uveob_base[0] = td->eob_base + 16 * 16 * sbs;
+ td->uveob_base[1] = td->uveob_base[0] + chroma_eobs * sbs;
} else {
- s->b_base = av_malloc(sizeof(VP9Block));
- s->block_base = av_mallocz((64 * 64 + 2 * chroma_blocks) * bytesperpixel * sizeof(int16_t) +
- 16 * 16 + 2 * chroma_eobs);
- if (!s->b_base || !s->block_base)
- return AVERROR(ENOMEM);
- s->uvblock_base[0] = s->block_base + 64 * 64 * bytesperpixel;
- s->uvblock_base[1] = s->uvblock_base[0] + chroma_blocks * bytesperpixel;
- s->eob_base = (uint8_t *) (s->uvblock_base[1] + chroma_blocks * bytesperpixel);
- s->uveob_base[0] = s->eob_base + 16 * 16;
- s->uveob_base[1] = s->uveob_base[0] + chroma_eobs;
+ for (i = 1; i < s->active_tile_cols; i++) {
+ if (s->td[i].b_base && s->td[i].block_base) {
+ av_free(s->td[i].b_base);
+ av_free(s->td[i].block_base);
+ }
+ }
+ for (i = 0; i < s->active_tile_cols; i++) {
+ s->td[i].b_base = av_malloc(sizeof(VP9Block));
+ s->td[i].block_base = av_mallocz((64 * 64 + 2 * chroma_blocks) * bytesperpixel * sizeof(int16_t) +
+ 16 * 16 + 2 * chroma_eobs);
+ if (!s->td[i].b_base || !s->td[i].block_base)
+ return AVERROR(ENOMEM);
+ s->td[i].uvblock_base[0] = s->td[i].block_base + 64 * 64 * bytesperpixel;
+ s->td[i].uvblock_base[1] = s->td[i].uvblock_base[0] + chroma_blocks * bytesperpixel;
+ s->td[i].eob_base = (uint8_t *) (s->td[i].uvblock_base[1] + chroma_blocks * bytesperpixel);
+ s->td[i].uveob_base[0] = s->td[i].eob_base + 16 * 16;
+ s->td[i].uveob_base[1] = s->td[i].uveob_base[0] + chroma_eobs;
+ }
}
s->block_alloc_using_2pass = s->s.frames[CUR_FRAME].uses_2pass;
return 0;
}
-// for some reason the sign bit is at the end, not the start, of a bit sequence
+// The sign bit is at the end, not the start, of a bit sequence
static av_always_inline int get_sbits_inv(GetBitContext *gb, int n)
{
int v = get_bits(gb, n);
@@ -386,7 +333,11 @@ static av_always_inline int get_sbits_inv(GetBitContext *gb, int n)
static av_always_inline int inv_recenter_nonneg(int v, int m)
{
- return v > 2 * m ? v : v & 1 ? m - ((v + 1) >> 1) : m + (v >> 1);
+ if (v > 2 * m)
+ return v;
+ if (v & 1)
+ return m - ((v + 1) >> 1);
+ return m + (v >> 1);
}
// differential forward probability updates
@@ -417,13 +368,13 @@ static int update_prob(VP56RangeCoder *c, int p)
/* This code is trying to do a differential probability update. For a
* current probability A in the range [1, 255], the difference to a new
- * probability of any value can be expressed differentially as 1-A,255-A
+ * probability of any value can be expressed differentially as 1-A, 255-A
* where some part of this (absolute range) exists both in positive as
* well as the negative part, whereas another part only exists in one
* half. We're trying to code this shared part differentially, i.e.
* times two where the value of the lowest bit specifies the sign, and
* the single part is then coded on top of this. This absolute difference
- * then again has a value of [0,254], but a bigger value in this range
+ * then again has a value of [0, 254], but a bigger value in this range
* indicates that we're further away from the original value A, so we
* can code this as a VLC code, since higher values are increasingly
* unlikely. The first 20 values in inv_map_table[] allow 'cheap, rough'
@@ -448,34 +399,34 @@ static int update_prob(VP56RangeCoder *c, int p)
255 - inv_recenter_nonneg(inv_map_table[d], 255 - p);
}
-static int read_colorspace_details(AVCodecContext *ctx)
+static int read_colorspace_details(AVCodecContext *avctx)
{
static const enum AVColorSpace colorspaces[8] = {
AVCOL_SPC_UNSPECIFIED, AVCOL_SPC_BT470BG, AVCOL_SPC_BT709, AVCOL_SPC_SMPTE170M,
AVCOL_SPC_SMPTE240M, AVCOL_SPC_BT2020_NCL, AVCOL_SPC_RESERVED, AVCOL_SPC_RGB,
};
- VP9Context *s = ctx->priv_data;
- int bits = ctx->profile <= 1 ? 0 : 1 + get_bits1(&s->gb); // 0:8, 1:10, 2:12
+ VP9Context *s = avctx->priv_data;
+ int bits = avctx->profile <= 1 ? 0 : 1 + get_bits1(&s->gb); // 0:8, 1:10, 2:12
s->bpp_index = bits;
- s->bpp = 8 + bits * 2;
- s->bytesperpixel = (7 + s->bpp) >> 3;
- ctx->colorspace = colorspaces[get_bits(&s->gb, 3)];
- if (ctx->colorspace == AVCOL_SPC_RGB) { // RGB = profile 1
+ s->s.h.bpp = 8 + bits * 2;
+ s->bytesperpixel = (7 + s->s.h.bpp) >> 3;
+ avctx->colorspace = colorspaces[get_bits(&s->gb, 3)];
+ if (avctx->colorspace == AVCOL_SPC_RGB) { // RGB = profile 1
static const enum AVPixelFormat pix_fmt_rgb[3] = {
AV_PIX_FMT_GBRP, AV_PIX_FMT_GBRP10, AV_PIX_FMT_GBRP12
};
s->ss_h = s->ss_v = 0;
- ctx->color_range = AVCOL_RANGE_JPEG;
+ avctx->color_range = AVCOL_RANGE_JPEG;
s->pix_fmt = pix_fmt_rgb[bits];
- if (ctx->profile & 1) {
+ if (avctx->profile & 1) {
if (get_bits1(&s->gb)) {
- av_log(ctx, AV_LOG_ERROR, "Reserved bit set in RGB\n");
+ av_log(avctx, AV_LOG_ERROR, "Reserved bit set in RGB\n");
return AVERROR_INVALIDDATA;
}
} else {
- av_log(ctx, AV_LOG_ERROR, "RGB not supported in profile %d\n",
- ctx->profile);
+ av_log(avctx, AV_LOG_ERROR, "RGB not supported in profile %d\n",
+ avctx->profile);
return AVERROR_INVALIDDATA;
}
} else {
@@ -487,18 +438,18 @@ static int read_colorspace_details(AVCodecContext *ctx)
{ { AV_PIX_FMT_YUV444P12, AV_PIX_FMT_YUV422P12 },
{ AV_PIX_FMT_YUV440P12, AV_PIX_FMT_YUV420P12 } }
};
- ctx->color_range = get_bits1(&s->gb) ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
- if (ctx->profile & 1) {
+ avctx->color_range = get_bits1(&s->gb) ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG;
+ if (avctx->profile & 1) {
s->ss_h = get_bits1(&s->gb);
s->ss_v = get_bits1(&s->gb);
s->pix_fmt = pix_fmt_for_ss[bits][s->ss_v][s->ss_h];
if (s->pix_fmt == AV_PIX_FMT_YUV420P) {
- av_log(ctx, AV_LOG_ERROR, "YUV 4:2:0 not supported in profile %d\n",
- ctx->profile);
+ av_log(avctx, AV_LOG_ERROR, "YUV 4:2:0 not supported in profile %d\n",
+ avctx->profile);
return AVERROR_INVALIDDATA;
} else if (get_bits1(&s->gb)) {
- av_log(ctx, AV_LOG_ERROR, "Profile %d color details reserved bit set\n",
- ctx->profile);
+ av_log(avctx, AV_LOG_ERROR, "Profile %d color details reserved bit set\n",
+ avctx->profile);
return AVERROR_INVALIDDATA;
}
} else {
@@ -510,48 +461,51 @@ static int read_colorspace_details(AVCodecContext *ctx)
return 0;
}
-static int decode_frame_header(AVCodecContext *ctx,
+static int decode_frame_header(AVCodecContext *avctx,
const uint8_t *data, int size, int *ref)
{
- VP9Context *s = ctx->priv_data;
- int c, i, j, k, l, m, n, w, h, max, size2, res, sharp;
+ VP9Context *s = avctx->priv_data;
+ int c, i, j, k, l, m, n, w, h, max, size2, ret, sharp;
int last_invisible;
const uint8_t *data2;
/* general header */
- if ((res = init_get_bits8(&s->gb, data, size)) < 0) {
- av_log(ctx, AV_LOG_ERROR, "Failed to initialize bitstream reader\n");
- return res;
+ if ((ret = init_get_bits8(&s->gb, data, size)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Failed to initialize bitstream reader\n");
+ return ret;
}
if (get_bits(&s->gb, 2) != 0x2) { // frame marker
- av_log(ctx, AV_LOG_ERROR, "Invalid frame marker\n");
+ av_log(avctx, AV_LOG_ERROR, "Invalid frame marker\n");
return AVERROR_INVALIDDATA;
}
- ctx->profile = get_bits1(&s->gb);
- ctx->profile |= get_bits1(&s->gb) << 1;
- if (ctx->profile == 3) ctx->profile += get_bits1(&s->gb);
- if (ctx->profile > 3) {
- av_log(ctx, AV_LOG_ERROR, "Profile %d is not yet supported\n", ctx->profile);
+ avctx->profile = get_bits1(&s->gb);
+ avctx->profile |= get_bits1(&s->gb) << 1;
+ if (avctx->profile == 3) avctx->profile += get_bits1(&s->gb);
+ if (avctx->profile > 3) {
+ av_log(avctx, AV_LOG_ERROR, "Profile %d is not yet supported\n", avctx->profile);
return AVERROR_INVALIDDATA;
}
- s->s.h.profile = ctx->profile;
+ s->s.h.profile = avctx->profile;
if (get_bits1(&s->gb)) {
*ref = get_bits(&s->gb, 3);
return 0;
}
+
s->last_keyframe = s->s.h.keyframe;
- s->s.h.keyframe = !get_bits1(&s->gb);
- last_invisible = s->s.h.invisible;
- s->s.h.invisible = !get_bits1(&s->gb);
- s->s.h.errorres = get_bits1(&s->gb);
+ s->s.h.keyframe = !get_bits1(&s->gb);
+
+ last_invisible = s->s.h.invisible;
+ s->s.h.invisible = !get_bits1(&s->gb);
+ s->s.h.errorres = get_bits1(&s->gb);
s->s.h.use_last_frame_mvs = !s->s.h.errorres && !last_invisible;
+
if (s->s.h.keyframe) {
if (get_bits_long(&s->gb, 24) != VP9_SYNCCODE) { // synccode
- av_log(ctx, AV_LOG_ERROR, "Invalid sync code\n");
+ av_log(avctx, AV_LOG_ERROR, "Invalid sync code\n");
return AVERROR_INVALIDDATA;
}
- if ((res = read_colorspace_details(ctx)) < 0)
- return res;
+ if ((ret = read_colorspace_details(avctx)) < 0)
+ return ret;
// for profile 1, here follows the subsampling bits
s->s.h.refreshrefmask = 0xff;
w = get_bits(&s->gb, 16) + 1;
@@ -559,24 +513,24 @@ static int decode_frame_header(AVCodecContext *ctx,
if (get_bits1(&s->gb)) // display size
skip_bits(&s->gb, 32);
} else {
- s->s.h.intraonly = s->s.h.invisible ? get_bits1(&s->gb) : 0;
- s->s.h.resetctx = s->s.h.errorres ? 0 : get_bits(&s->gb, 2);
+ s->s.h.intraonly = s->s.h.invisible ? get_bits1(&s->gb) : 0;
+ s->s.h.resetctx = s->s.h.errorres ? 0 : get_bits(&s->gb, 2);
if (s->s.h.intraonly) {
if (get_bits_long(&s->gb, 24) != VP9_SYNCCODE) { // synccode
- av_log(ctx, AV_LOG_ERROR, "Invalid sync code\n");
+ av_log(avctx, AV_LOG_ERROR, "Invalid sync code\n");
return AVERROR_INVALIDDATA;
}
- if (ctx->profile >= 1) {
- if ((res = read_colorspace_details(ctx)) < 0)
- return res;
+ if (avctx->profile >= 1) {
+ if ((ret = read_colorspace_details(avctx)) < 0)
+ return ret;
} else {
s->ss_h = s->ss_v = 1;
- s->bpp = 8;
+ s->s.h.bpp = 8;
s->bpp_index = 0;
s->bytesperpixel = 1;
s->pix_fmt = AV_PIX_FMT_YUV420P;
- ctx->colorspace = AVCOL_SPC_BT470BG;
- ctx->color_range = AVCOL_RANGE_JPEG;
+ avctx->colorspace = AVCOL_SPC_BT470BG;
+ avctx->color_range = AVCOL_RANGE_MPEG;
}
s->s.h.refreshrefmask = get_bits(&s->gb, 8);
w = get_bits(&s->gb, 16) + 1;
@@ -594,7 +548,7 @@ static int decode_frame_header(AVCodecContext *ctx,
if (!s->s.refs[s->s.h.refidx[0]].f->buf[0] ||
!s->s.refs[s->s.h.refidx[1]].f->buf[0] ||
!s->s.refs[s->s.h.refidx[2]].f->buf[0]) {
- av_log(ctx, AV_LOG_ERROR, "Not all references are available\n");
+ av_log(avctx, AV_LOG_ERROR, "Not all references are available\n");
return AVERROR_INVALIDDATA;
}
if (get_bits1(&s->gb)) {
@@ -660,8 +614,20 @@ static int decode_frame_header(AVCodecContext *ctx,
sharp = get_bits(&s->gb, 3);
// if sharpness changed, reinit lim/mblim LUTs. if it didn't change, keep
// the old cache values since they are still valid
- if (s->s.h.filter.sharpness != sharp)
- memset(s->filter_lut.lim_lut, 0, sizeof(s->filter_lut.lim_lut));
+ if (s->s.h.filter.sharpness != sharp) {
+ for (i = 1; i <= 63; i++) {
+ int limit = i;
+
+ if (sharp > 0) {
+ limit >>= (sharp + 3) >> 2;
+ limit = FFMIN(limit, 9 - sharp);
+ }
+ limit = FFMAX(limit, 1);
+
+ s->filter_lut.lim_lut[i] = limit;
+ s->filter_lut.mblim_lut[i] = 2 * (i + 2) + limit;
+ }
+ }
s->s.h.filter.sharpness = sharp;
if ((s->s.h.lf_delta.enabled = get_bits1(&s->gb))) {
if ((s->s.h.lf_delta.updated = get_bits1(&s->gb))) {
@@ -682,7 +648,7 @@ static int decode_frame_header(AVCodecContext *ctx,
s->s.h.lossless = s->s.h.yac_qi == 0 && s->s.h.ydc_qdelta == 0 &&
s->s.h.uvdc_qdelta == 0 && s->s.h.uvac_qdelta == 0;
if (s->s.h.lossless)
- ctx->properties |= FF_CODEC_PROPERTY_LOSSLESS;
+ avctx->properties |= FF_CODEC_PROPERTY_LOSSLESS;
/* segmentation header info */
if ((s->s.h.segmentation.enabled = get_bits1(&s->gb))) {
@@ -690,11 +656,10 @@ static int decode_frame_header(AVCodecContext *ctx,
for (i = 0; i < 7; i++)
s->s.h.segmentation.prob[i] = get_bits1(&s->gb) ?
get_bits(&s->gb, 8) : 255;
- if ((s->s.h.segmentation.temporal = get_bits1(&s->gb))) {
+ if ((s->s.h.segmentation.temporal = get_bits1(&s->gb)))
for (i = 0; i < 3; i++)
s->s.h.segmentation.pred_prob[i] = get_bits1(&s->gb) ?
get_bits(&s->gb, 8) : 255;
- }
}
if (get_bits1(&s->gb)) {
@@ -728,10 +693,10 @@ static int decode_frame_header(AVCodecContext *ctx,
quvac = av_clip_uintp2(qyac + s->s.h.uvac_qdelta, 8);
qyac = av_clip_uintp2(qyac, 8);
- s->s.h.segmentation.feat[i].qmul[0][0] = vp9_dc_qlookup[s->bpp_index][qydc];
- s->s.h.segmentation.feat[i].qmul[0][1] = vp9_ac_qlookup[s->bpp_index][qyac];
- s->s.h.segmentation.feat[i].qmul[1][0] = vp9_dc_qlookup[s->bpp_index][quvdc];
- s->s.h.segmentation.feat[i].qmul[1][1] = vp9_ac_qlookup[s->bpp_index][quvac];
+ s->s.h.segmentation.feat[i].qmul[0][0] = ff_vp9_dc_qlookup[s->bpp_index][qydc];
+ s->s.h.segmentation.feat[i].qmul[0][1] = ff_vp9_ac_qlookup[s->bpp_index][qyac];
+ s->s.h.segmentation.feat[i].qmul[1][0] = ff_vp9_dc_qlookup[s->bpp_index][quvdc];
+ s->s.h.segmentation.feat[i].qmul[1][1] = ff_vp9_ac_qlookup[s->bpp_index][quvac];
sh = s->s.h.filter.level >= 32;
if (s->s.h.segmentation.enabled && s->s.h.segmentation.feat[i].lf_enabled) {
@@ -761,10 +726,10 @@ static int decode_frame_header(AVCodecContext *ctx,
}
/* tiling info */
- if ((res = update_size(ctx, w, h)) < 0) {
- av_log(ctx, AV_LOG_ERROR, "Failed to initialize decoder for %dx%d @ %d\n",
+ if ((ret = update_size(avctx, w, h)) < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Failed to initialize decoder for %dx%d @ %d\n",
w, h, s->pix_fmt);
- return res;
+ return ret;
}
for (s->s.h.tiling.log2_tile_cols = 0;
s->sb_cols > (64 << s->s.h.tiling.log2_tile_cols);
@@ -780,12 +745,36 @@ static int decode_frame_header(AVCodecContext *ctx,
s->s.h.tiling.log2_tile_rows = decode012(&s->gb);
s->s.h.tiling.tile_rows = 1 << s->s.h.tiling.log2_tile_rows;
if (s->s.h.tiling.tile_cols != (1 << s->s.h.tiling.log2_tile_cols)) {
+ int n_range_coders;
+ VP56RangeCoder *rc;
+
+ if (s->td) {
+ for (i = 0; i < s->active_tile_cols; i++) {
+ av_free(s->td[i].b_base);
+ av_free(s->td[i].block_base);
+ }
+ av_free(s->td);
+ }
+
s->s.h.tiling.tile_cols = 1 << s->s.h.tiling.log2_tile_cols;
- s->c_b = av_fast_realloc(s->c_b, &s->c_b_size,
- sizeof(VP56RangeCoder) * s->s.h.tiling.tile_cols);
- if (!s->c_b) {
- av_log(ctx, AV_LOG_ERROR, "Ran out of memory during range coder init\n");
+ vp9_free_entries(avctx);
+ s->active_tile_cols = avctx->active_thread_type == FF_THREAD_SLICE ?
+ s->s.h.tiling.tile_cols : 1;
+ vp9_alloc_entries(avctx, s->sb_rows);
+ if (avctx->active_thread_type == FF_THREAD_SLICE) {
+ n_range_coders = 4; // max_tile_rows
+ } else {
+ n_range_coders = s->s.h.tiling.tile_cols;
+ }
+ s->td = av_mallocz_array(s->active_tile_cols, sizeof(VP9TileData) +
+ n_range_coders * sizeof(VP56RangeCoder));
+ if (!s->td)
return AVERROR(ENOMEM);
+ rc = (VP56RangeCoder *) &s->td[s->active_tile_cols];
+ for (i = 0; i < s->active_tile_cols; i++) {
+ s->td[i].s = s;
+ s->td[i].c_b = rc;
+ rc += n_range_coders;
}
}
@@ -795,17 +784,17 @@ static int decode_frame_header(AVCodecContext *ctx,
AVFrame *ref = s->s.refs[s->s.h.refidx[i]].f;
int refw = ref->width, refh = ref->height;
- if (ref->format != ctx->pix_fmt) {
- av_log(ctx, AV_LOG_ERROR,
+ if (ref->format != avctx->pix_fmt) {
+ av_log(avctx, AV_LOG_ERROR,
"Ref pixfmt (%s) did not match current frame (%s)",
av_get_pix_fmt_name(ref->format),
- av_get_pix_fmt_name(ctx->pix_fmt));
+ av_get_pix_fmt_name(avctx->pix_fmt));
return AVERROR_INVALIDDATA;
} else if (refw == w && refh == h) {
s->mvscale[i][0] = s->mvscale[i][1] = 0;
} else {
if (w * 2 < refw || h * 2 < refh || w > 16 * refw || h > 16 * refh) {
- av_log(ctx, AV_LOG_ERROR,
+ av_log(avctx, AV_LOG_ERROR,
"Invalid ref frame dimensions %dx%d for frame size %dx%d\n",
refw, refh, w, h);
return AVERROR_INVALIDDATA;
@@ -820,19 +809,19 @@ static int decode_frame_header(AVCodecContext *ctx,
if (s->s.h.keyframe || s->s.h.errorres || (s->s.h.intraonly && s->s.h.resetctx == 3)) {
s->prob_ctx[0].p = s->prob_ctx[1].p = s->prob_ctx[2].p =
- s->prob_ctx[3].p = vp9_default_probs;
- memcpy(s->prob_ctx[0].coef, vp9_default_coef_probs,
- sizeof(vp9_default_coef_probs));
- memcpy(s->prob_ctx[1].coef, vp9_default_coef_probs,
- sizeof(vp9_default_coef_probs));
- memcpy(s->prob_ctx[2].coef, vp9_default_coef_probs,
- sizeof(vp9_default_coef_probs));
- memcpy(s->prob_ctx[3].coef, vp9_default_coef_probs,
- sizeof(vp9_default_coef_probs));
+ s->prob_ctx[3].p = ff_vp9_default_probs;
+ memcpy(s->prob_ctx[0].coef, ff_vp9_default_coef_probs,
+ sizeof(ff_vp9_default_coef_probs));
+ memcpy(s->prob_ctx[1].coef, ff_vp9_default_coef_probs,
+ sizeof(ff_vp9_default_coef_probs));
+ memcpy(s->prob_ctx[2].coef, ff_vp9_default_coef_probs,
+ sizeof(ff_vp9_default_coef_probs));
+ memcpy(s->prob_ctx[3].coef, ff_vp9_default_coef_probs,
+ sizeof(ff_vp9_default_coef_probs));
} else if (s->s.h.intraonly && s->s.h.resetctx == 2) {
- s->prob_ctx[c].p = vp9_default_probs;
- memcpy(s->prob_ctx[c].coef, vp9_default_coef_probs,
- sizeof(vp9_default_coef_probs));
+ s->prob_ctx[c].p = ff_vp9_default_probs;
+ memcpy(s->prob_ctx[c].coef, ff_vp9_default_coef_probs,
+ sizeof(ff_vp9_default_coef_probs));
}
// next 16 bits is size of the rest of the header (arith-coded)
@@ -841,24 +830,30 @@ static int decode_frame_header(AVCodecContext *ctx,
data2 = align_get_bits(&s->gb);
if (size2 > size - (data2 - data)) {
- av_log(ctx, AV_LOG_ERROR, "Invalid compressed header size\n");
+ av_log(avctx, AV_LOG_ERROR, "Invalid compressed header size\n");
return AVERROR_INVALIDDATA;
}
- ff_vp56_init_range_decoder(&s->c, data2, size2);
+ ret = ff_vp56_init_range_decoder(&s->c, data2, size2);
+ if (ret < 0)
+ return ret;
+
if (vp56_rac_get_prob_branchy(&s->c, 128)) { // marker bit
- av_log(ctx, AV_LOG_ERROR, "Marker bit was set\n");
+ av_log(avctx, AV_LOG_ERROR, "Marker bit was set\n");
return AVERROR_INVALIDDATA;
}
- if (s->s.h.keyframe || s->s.h.intraonly) {
- memset(s->counts.coef, 0, sizeof(s->counts.coef));
- memset(s->counts.eob, 0, sizeof(s->counts.eob));
- } else {
- memset(&s->counts, 0, sizeof(s->counts));
+ for (i = 0; i < s->active_tile_cols; i++) {
+ if (s->s.h.keyframe || s->s.h.intraonly) {
+ memset(s->td[i].counts.coef, 0, sizeof(s->td[0].counts.coef));
+ memset(s->td[i].counts.eob, 0, sizeof(s->td[0].counts.eob));
+ } else {
+ memset(&s->td[i].counts, 0, sizeof(s->td[0].counts));
+ }
}
- // FIXME is it faster to not copy here, but do it down in the fw updates
- // as explicit copies if the fw update is missing (and skip the copy upon
- // fw update)?
+
+ /* FIXME is it faster to not copy here, but do it down in the fw updates
+ * as explicit copies if the fw update is missing (and skip the copy upon
+ * fw update)? */
s->prob.p = s->prob_ctx[c].p;
// txfm updates
@@ -899,13 +894,12 @@ static int decode_frame_header(AVCodecContext *ctx,
if (m >= 3 && l == 0) // dc only has 3 pt
break;
for (n = 0; n < 3; n++) {
- if (vp56_rac_get_prob_branchy(&s->c, 252)) {
+ if (vp56_rac_get_prob_branchy(&s->c, 252))
p[n] = update_prob(&s->c, r[n]);
- } else {
+ else
p[n] = r[n];
- }
}
- p[3] = 0;
+ memcpy(&p[3], ff_vp9_model_pareto8[p[2]], 8);
}
} else {
for (j = 0; j < 2; j++)
@@ -917,7 +911,7 @@ static int decode_frame_header(AVCodecContext *ctx,
if (m > 3 && l == 0) // dc only has 3 pt
break;
memcpy(p, r, 3);
- p[3] = 0;
+ memcpy(&p[3], ff_vp9_model_pareto8[p[2]], 8);
}
}
if (s->s.h.txfmmode == i)
@@ -988,7 +982,8 @@ static int decode_frame_header(AVCodecContext *ctx,
for (k = 0; k < 3; k++)
if (vp56_rac_get_prob_branchy(&s->c, 252))
s->prob.p.partition[3 - i][j][k] =
- update_prob(&s->c, s->prob.p.partition[3 - i][j][k]);
+ update_prob(&s->c,
+ s->prob.p.partition[3 - i][j][k]);
// mv fields don't use the update_prob subexp model for some reason
for (i = 0; i < 3; i++)
@@ -997,7 +992,8 @@ static int decode_frame_header(AVCodecContext *ctx,
for (i = 0; i < 2; i++) {
if (vp56_rac_get_prob_branchy(&s->c, 252))
- s->prob.p.mv_comp[i].sign = (vp8_rac_get_uint(&s->c, 7) << 1) | 1;
+ s->prob.p.mv_comp[i].sign =
+ (vp8_rac_get_uint(&s->c, 7) << 1) | 1;
for (j = 0; j < 10; j++)
if (vp56_rac_get_prob_branchy(&s->c, 252))
@@ -1005,7 +1001,8 @@ static int decode_frame_header(AVCodecContext *ctx,
(vp8_rac_get_uint(&s->c, 7) << 1) | 1;
if (vp56_rac_get_prob_branchy(&s->c, 252))
- s->prob.p.mv_comp[i].class0 = (vp8_rac_get_uint(&s->c, 7) << 1) | 1;
+ s->prob.p.mv_comp[i].class0 =
+ (vp8_rac_get_uint(&s->c, 7) << 1) | 1;
for (j = 0; j < 10; j++)
if (vp56_rac_get_prob_branchy(&s->c, 252))
@@ -1042,2354 +1039,13 @@ static int decode_frame_header(AVCodecContext *ctx,
return (data2 - data) + size2;
}
-static av_always_inline void clamp_mv(VP56mv *dst, const VP56mv *src,
- VP9Context *s)
-{
- dst->x = av_clip(src->x, s->min_mv.x, s->max_mv.x);
- dst->y = av_clip(src->y, s->min_mv.y, s->max_mv.y);
-}
-
-static void find_ref_mvs(VP9Context *s,
- VP56mv *pmv, int ref, int z, int idx, int sb)
-{
- static const int8_t mv_ref_blk_off[N_BS_SIZES][8][2] = {
- [BS_64x64] = {{ 3, -1 }, { -1, 3 }, { 4, -1 }, { -1, 4 },
- { -1, -1 }, { 0, -1 }, { -1, 0 }, { 6, -1 }},
- [BS_64x32] = {{ 0, -1 }, { -1, 0 }, { 4, -1 }, { -1, 2 },
- { -1, -1 }, { 0, -3 }, { -3, 0 }, { 2, -1 }},
- [BS_32x64] = {{ -1, 0 }, { 0, -1 }, { -1, 4 }, { 2, -1 },
- { -1, -1 }, { -3, 0 }, { 0, -3 }, { -1, 2 }},
- [BS_32x32] = {{ 1, -1 }, { -1, 1 }, { 2, -1 }, { -1, 2 },
- { -1, -1 }, { 0, -3 }, { -3, 0 }, { -3, -3 }},
- [BS_32x16] = {{ 0, -1 }, { -1, 0 }, { 2, -1 }, { -1, -1 },
- { -1, 1 }, { 0, -3 }, { -3, 0 }, { -3, -3 }},
- [BS_16x32] = {{ -1, 0 }, { 0, -1 }, { -1, 2 }, { -1, -1 },
- { 1, -1 }, { -3, 0 }, { 0, -3 }, { -3, -3 }},
- [BS_16x16] = {{ 0, -1 }, { -1, 0 }, { 1, -1 }, { -1, 1 },
- { -1, -1 }, { 0, -3 }, { -3, 0 }, { -3, -3 }},
- [BS_16x8] = {{ 0, -1 }, { -1, 0 }, { 1, -1 }, { -1, -1 },
- { 0, -2 }, { -2, 0 }, { -2, -1 }, { -1, -2 }},
- [BS_8x16] = {{ -1, 0 }, { 0, -1 }, { -1, 1 }, { -1, -1 },
- { -2, 0 }, { 0, -2 }, { -1, -2 }, { -2, -1 }},
- [BS_8x8] = {{ 0, -1 }, { -1, 0 }, { -1, -1 }, { 0, -2 },
- { -2, 0 }, { -1, -2 }, { -2, -1 }, { -2, -2 }},
- [BS_8x4] = {{ 0, -1 }, { -1, 0 }, { -1, -1 }, { 0, -2 },
- { -2, 0 }, { -1, -2 }, { -2, -1 }, { -2, -2 }},
- [BS_4x8] = {{ 0, -1 }, { -1, 0 }, { -1, -1 }, { 0, -2 },
- { -2, 0 }, { -1, -2 }, { -2, -1 }, { -2, -2 }},
- [BS_4x4] = {{ 0, -1 }, { -1, 0 }, { -1, -1 }, { 0, -2 },
- { -2, 0 }, { -1, -2 }, { -2, -1 }, { -2, -2 }},
- };
- VP9Block *b = s->b;
- int row = s->row, col = s->col, row7 = s->row7;
- const int8_t (*p)[2] = mv_ref_blk_off[b->bs];
-#define INVALID_MV 0x80008000U
- uint32_t mem = INVALID_MV, mem_sub8x8 = INVALID_MV;
- int i;
-
-#define RETURN_DIRECT_MV(mv) \
- do { \
- uint32_t m = AV_RN32A(&mv); \
- if (!idx) { \
- AV_WN32A(pmv, m); \
- return; \
- } else if (mem == INVALID_MV) { \
- mem = m; \
- } else if (m != mem) { \
- AV_WN32A(pmv, m); \
- return; \
- } \
- } while (0)
-
- if (sb >= 0) {
- if (sb == 2 || sb == 1) {
- RETURN_DIRECT_MV(b->mv[0][z]);
- } else if (sb == 3) {
- RETURN_DIRECT_MV(b->mv[2][z]);
- RETURN_DIRECT_MV(b->mv[1][z]);
- RETURN_DIRECT_MV(b->mv[0][z]);
- }
-
-#define RETURN_MV(mv) \
- do { \
- if (sb > 0) { \
- VP56mv tmp; \
- uint32_t m; \
- av_assert2(idx == 1); \
- av_assert2(mem != INVALID_MV); \
- if (mem_sub8x8 == INVALID_MV) { \
- clamp_mv(&tmp, &mv, s); \
- m = AV_RN32A(&tmp); \
- if (m != mem) { \
- AV_WN32A(pmv, m); \
- return; \
- } \
- mem_sub8x8 = AV_RN32A(&mv); \
- } else if (mem_sub8x8 != AV_RN32A(&mv)) { \
- clamp_mv(&tmp, &mv, s); \
- m = AV_RN32A(&tmp); \
- if (m != mem) { \
- AV_WN32A(pmv, m); \
- } else { \
- /* BUG I'm pretty sure this isn't the intention */ \
- AV_WN32A(pmv, 0); \
- } \
- return; \
- } \
- } else { \
- uint32_t m = AV_RN32A(&mv); \
- if (!idx) { \
- clamp_mv(pmv, &mv, s); \
- return; \
- } else if (mem == INVALID_MV) { \
- mem = m; \
- } else if (m != mem) { \
- clamp_mv(pmv, &mv, s); \
- return; \
- } \
- } \
- } while (0)
-
- if (row > 0) {
- struct VP9mvrefPair *mv = &s->s.frames[CUR_FRAME].mv[(row - 1) * s->sb_cols * 8 + col];
- if (mv->ref[0] == ref) {
- RETURN_MV(s->above_mv_ctx[2 * col + (sb & 1)][0]);
- } else if (mv->ref[1] == ref) {
- RETURN_MV(s->above_mv_ctx[2 * col + (sb & 1)][1]);
- }
- }
- if (col > s->tile_col_start) {
- struct VP9mvrefPair *mv = &s->s.frames[CUR_FRAME].mv[row * s->sb_cols * 8 + col - 1];
- if (mv->ref[0] == ref) {
- RETURN_MV(s->left_mv_ctx[2 * row7 + (sb >> 1)][0]);
- } else if (mv->ref[1] == ref) {
- RETURN_MV(s->left_mv_ctx[2 * row7 + (sb >> 1)][1]);
- }
- }
- i = 2;
- } else {
- i = 0;
- }
-
- // previously coded MVs in this neighbourhood, using same reference frame
- for (; i < 8; i++) {
- int c = p[i][0] + col, r = p[i][1] + row;
-
- if (c >= s->tile_col_start && c < s->cols && r >= 0 && r < s->rows) {
- struct VP9mvrefPair *mv = &s->s.frames[CUR_FRAME].mv[r * s->sb_cols * 8 + c];
-
- if (mv->ref[0] == ref) {
- RETURN_MV(mv->mv[0]);
- } else if (mv->ref[1] == ref) {
- RETURN_MV(mv->mv[1]);
- }
- }
- }
-
- // MV at this position in previous frame, using same reference frame
- if (s->s.h.use_last_frame_mvs) {
- struct VP9mvrefPair *mv = &s->s.frames[REF_FRAME_MVPAIR].mv[row * s->sb_cols * 8 + col];
-
- if (!s->s.frames[REF_FRAME_MVPAIR].uses_2pass)
- ff_thread_await_progress(&s->s.frames[REF_FRAME_MVPAIR].tf, row >> 3, 0);
- if (mv->ref[0] == ref) {
- RETURN_MV(mv->mv[0]);
- } else if (mv->ref[1] == ref) {
- RETURN_MV(mv->mv[1]);
- }
- }
-
-#define RETURN_SCALE_MV(mv, scale) \
- do { \
- if (scale) { \
- VP56mv mv_temp = { -mv.x, -mv.y }; \
- RETURN_MV(mv_temp); \
- } else { \
- RETURN_MV(mv); \
- } \
- } while (0)
-
- // previously coded MVs in this neighbourhood, using different reference frame
- for (i = 0; i < 8; i++) {
- int c = p[i][0] + col, r = p[i][1] + row;
-
- if (c >= s->tile_col_start && c < s->cols && r >= 0 && r < s->rows) {
- struct VP9mvrefPair *mv = &s->s.frames[CUR_FRAME].mv[r * s->sb_cols * 8 + c];
-
- if (mv->ref[0] != ref && mv->ref[0] >= 0) {
- RETURN_SCALE_MV(mv->mv[0], s->s.h.signbias[mv->ref[0]] != s->s.h.signbias[ref]);
- }
- if (mv->ref[1] != ref && mv->ref[1] >= 0 &&
- // BUG - libvpx has this condition regardless of whether
- // we used the first ref MV and pre-scaling
- AV_RN32A(&mv->mv[0]) != AV_RN32A(&mv->mv[1])) {
- RETURN_SCALE_MV(mv->mv[1], s->s.h.signbias[mv->ref[1]] != s->s.h.signbias[ref]);
- }
- }
- }
-
- // MV at this position in previous frame, using different reference frame
- if (s->s.h.use_last_frame_mvs) {
- struct VP9mvrefPair *mv = &s->s.frames[REF_FRAME_MVPAIR].mv[row * s->sb_cols * 8 + col];
-
- // no need to await_progress, because we already did that above
- if (mv->ref[0] != ref && mv->ref[0] >= 0) {
- RETURN_SCALE_MV(mv->mv[0], s->s.h.signbias[mv->ref[0]] != s->s.h.signbias[ref]);
- }
- if (mv->ref[1] != ref && mv->ref[1] >= 0 &&
- // BUG - libvpx has this condition regardless of whether
- // we used the first ref MV and pre-scaling
- AV_RN32A(&mv->mv[0]) != AV_RN32A(&mv->mv[1])) {
- RETURN_SCALE_MV(mv->mv[1], s->s.h.signbias[mv->ref[1]] != s->s.h.signbias[ref]);
- }
- }
-
- AV_ZERO32(pmv);
- clamp_mv(pmv, pmv, s);
-#undef INVALID_MV
-#undef RETURN_MV
-#undef RETURN_SCALE_MV
-}
-
-static av_always_inline int read_mv_component(VP9Context *s, int idx, int hp)
-{
- int bit, sign = vp56_rac_get_prob(&s->c, s->prob.p.mv_comp[idx].sign);
- int n, c = vp8_rac_get_tree(&s->c, vp9_mv_class_tree,
- s->prob.p.mv_comp[idx].classes);
-
- s->counts.mv_comp[idx].sign[sign]++;
- s->counts.mv_comp[idx].classes[c]++;
- if (c) {
- int m;
-
- for (n = 0, m = 0; m < c; m++) {
- bit = vp56_rac_get_prob(&s->c, s->prob.p.mv_comp[idx].bits[m]);
- n |= bit << m;
- s->counts.mv_comp[idx].bits[m][bit]++;
- }
- n <<= 3;
- bit = vp8_rac_get_tree(&s->c, vp9_mv_fp_tree, s->prob.p.mv_comp[idx].fp);
- n |= bit << 1;
- s->counts.mv_comp[idx].fp[bit]++;
- if (hp) {
- bit = vp56_rac_get_prob(&s->c, s->prob.p.mv_comp[idx].hp);
- s->counts.mv_comp[idx].hp[bit]++;
- n |= bit;
- } else {
- n |= 1;
- // bug in libvpx - we count for bw entropy purposes even if the
- // bit wasn't coded
- s->counts.mv_comp[idx].hp[1]++;
- }
- n += 8 << c;
- } else {
- n = vp56_rac_get_prob(&s->c, s->prob.p.mv_comp[idx].class0);
- s->counts.mv_comp[idx].class0[n]++;
- bit = vp8_rac_get_tree(&s->c, vp9_mv_fp_tree,
- s->prob.p.mv_comp[idx].class0_fp[n]);
- s->counts.mv_comp[idx].class0_fp[n][bit]++;
- n = (n << 3) | (bit << 1);
- if (hp) {
- bit = vp56_rac_get_prob(&s->c, s->prob.p.mv_comp[idx].class0_hp);
- s->counts.mv_comp[idx].class0_hp[bit]++;
- n |= bit;
- } else {
- n |= 1;
- // bug in libvpx - we count for bw entropy purposes even if the
- // bit wasn't coded
- s->counts.mv_comp[idx].class0_hp[1]++;
- }
- }
-
- return sign ? -(n + 1) : (n + 1);
-}
-
-static void fill_mv(VP9Context *s,
- VP56mv *mv, int mode, int sb)
-{
- VP9Block *b = s->b;
-
- if (mode == ZEROMV) {
- AV_ZERO64(mv);
- } else {
- int hp;
-
- // FIXME cache this value and reuse for other subblocks
- find_ref_mvs(s, &mv[0], b->ref[0], 0, mode == NEARMV,
- mode == NEWMV ? -1 : sb);
- // FIXME maybe move this code into find_ref_mvs()
- if ((mode == NEWMV || sb == -1) &&
- !(hp = s->s.h.highprecisionmvs && abs(mv[0].x) < 64 && abs(mv[0].y) < 64)) {
- if (mv[0].y & 1) {
- if (mv[0].y < 0)
- mv[0].y++;
- else
- mv[0].y--;
- }
- if (mv[0].x & 1) {
- if (mv[0].x < 0)
- mv[0].x++;
- else
- mv[0].x--;
- }
- }
- if (mode == NEWMV) {
- enum MVJoint j = vp8_rac_get_tree(&s->c, vp9_mv_joint_tree,
- s->prob.p.mv_joint);
-
- s->counts.mv_joint[j]++;
- if (j >= MV_JOINT_V)
- mv[0].y += read_mv_component(s, 0, hp);
- if (j & 1)
- mv[0].x += read_mv_component(s, 1, hp);
- }
-
- if (b->comp) {
- // FIXME cache this value and reuse for other subblocks
- find_ref_mvs(s, &mv[1], b->ref[1], 1, mode == NEARMV,
- mode == NEWMV ? -1 : sb);
- if ((mode == NEWMV || sb == -1) &&
- !(hp = s->s.h.highprecisionmvs && abs(mv[1].x) < 64 && abs(mv[1].y) < 64)) {
- if (mv[1].y & 1) {
- if (mv[1].y < 0)
- mv[1].y++;
- else
- mv[1].y--;
- }
- if (mv[1].x & 1) {
- if (mv[1].x < 0)
- mv[1].x++;
- else
- mv[1].x--;
- }
- }
- if (mode == NEWMV) {
- enum MVJoint j = vp8_rac_get_tree(&s->c, vp9_mv_joint_tree,
- s->prob.p.mv_joint);
-
- s->counts.mv_joint[j]++;
- if (j >= MV_JOINT_V)
- mv[1].y += read_mv_component(s, 0, hp);
- if (j & 1)
- mv[1].x += read_mv_component(s, 1, hp);
- }
- }
- }
-}
-
-static av_always_inline void setctx_2d(uint8_t *ptr, int w, int h,
- ptrdiff_t stride, int v)
-{
- switch (w) {
- case 1:
- do {
- *ptr = v;
- ptr += stride;
- } while (--h);
- break;
- case 2: {
- int v16 = v * 0x0101;
- do {
- AV_WN16A(ptr, v16);
- ptr += stride;
- } while (--h);
- break;
- }
- case 4: {
- uint32_t v32 = v * 0x01010101;
- do {
- AV_WN32A(ptr, v32);
- ptr += stride;
- } while (--h);
- break;
- }
- case 8: {
-#if HAVE_FAST_64BIT
- uint64_t v64 = v * 0x0101010101010101ULL;
- do {
- AV_WN64A(ptr, v64);
- ptr += stride;
- } while (--h);
-#else
- uint32_t v32 = v * 0x01010101;
- do {
- AV_WN32A(ptr, v32);
- AV_WN32A(ptr + 4, v32);
- ptr += stride;
- } while (--h);
-#endif
- break;
- }
- }
-}
-
-static void decode_mode(AVCodecContext *ctx)
-{
- static const uint8_t left_ctx[N_BS_SIZES] = {
- 0x0, 0x8, 0x0, 0x8, 0xc, 0x8, 0xc, 0xe, 0xc, 0xe, 0xf, 0xe, 0xf
- };
- static const uint8_t above_ctx[N_BS_SIZES] = {
- 0x0, 0x0, 0x8, 0x8, 0x8, 0xc, 0xc, 0xc, 0xe, 0xe, 0xe, 0xf, 0xf
- };
- static const uint8_t max_tx_for_bl_bp[N_BS_SIZES] = {
- TX_32X32, TX_32X32, TX_32X32, TX_32X32, TX_16X16, TX_16X16,
- TX_16X16, TX_8X8, TX_8X8, TX_8X8, TX_4X4, TX_4X4, TX_4X4
- };
- VP9Context *s = ctx->priv_data;
- VP9Block *b = s->b;
- int row = s->row, col = s->col, row7 = s->row7;
- enum TxfmMode max_tx = max_tx_for_bl_bp[b->bs];
- int bw4 = bwh_tab[1][b->bs][0], w4 = FFMIN(s->cols - col, bw4);
- int bh4 = bwh_tab[1][b->bs][1], h4 = FFMIN(s->rows - row, bh4), y;
- int have_a = row > 0, have_l = col > s->tile_col_start;
- int vref, filter_id;
-
- if (!s->s.h.segmentation.enabled) {
- b->seg_id = 0;
- } else if (s->s.h.keyframe || s->s.h.intraonly) {
- b->seg_id = !s->s.h.segmentation.update_map ? 0 :
- vp8_rac_get_tree(&s->c, vp9_segmentation_tree, s->s.h.segmentation.prob);
- } else if (!s->s.h.segmentation.update_map ||
- (s->s.h.segmentation.temporal &&
- vp56_rac_get_prob_branchy(&s->c,
- s->s.h.segmentation.pred_prob[s->above_segpred_ctx[col] +
- s->left_segpred_ctx[row7]]))) {
- if (!s->s.h.errorres && s->s.frames[REF_FRAME_SEGMAP].segmentation_map) {
- int pred = 8, x;
- uint8_t *refsegmap = s->s.frames[REF_FRAME_SEGMAP].segmentation_map;
-
- if (!s->s.frames[REF_FRAME_SEGMAP].uses_2pass)
- ff_thread_await_progress(&s->s.frames[REF_FRAME_SEGMAP].tf, row >> 3, 0);
- for (y = 0; y < h4; y++) {
- int idx_base = (y + row) * 8 * s->sb_cols + col;
- for (x = 0; x < w4; x++)
- pred = FFMIN(pred, refsegmap[idx_base + x]);
- }
- av_assert1(pred < 8);
- b->seg_id = pred;
- } else {
- b->seg_id = 0;
- }
-
- memset(&s->above_segpred_ctx[col], 1, w4);
- memset(&s->left_segpred_ctx[row7], 1, h4);
- } else {
- b->seg_id = vp8_rac_get_tree(&s->c, vp9_segmentation_tree,
- s->s.h.segmentation.prob);
-
- memset(&s->above_segpred_ctx[col], 0, w4);
- memset(&s->left_segpred_ctx[row7], 0, h4);
- }
- if (s->s.h.segmentation.enabled &&
- (s->s.h.segmentation.update_map || s->s.h.keyframe || s->s.h.intraonly)) {
- setctx_2d(&s->s.frames[CUR_FRAME].segmentation_map[row * 8 * s->sb_cols + col],
- bw4, bh4, 8 * s->sb_cols, b->seg_id);
- }
-
- b->skip = s->s.h.segmentation.enabled &&
- s->s.h.segmentation.feat[b->seg_id].skip_enabled;
- if (!b->skip) {
- int c = s->left_skip_ctx[row7] + s->above_skip_ctx[col];
- b->skip = vp56_rac_get_prob(&s->c, s->prob.p.skip[c]);
- s->counts.skip[c][b->skip]++;
- }
-
- if (s->s.h.keyframe || s->s.h.intraonly) {
- b->intra = 1;
- } else if (s->s.h.segmentation.enabled && s->s.h.segmentation.feat[b->seg_id].ref_enabled) {
- b->intra = !s->s.h.segmentation.feat[b->seg_id].ref_val;
- } else {
- int c, bit;
-
- if (have_a && have_l) {
- c = s->above_intra_ctx[col] + s->left_intra_ctx[row7];
- c += (c == 2);
- } else {
- c = have_a ? 2 * s->above_intra_ctx[col] :
- have_l ? 2 * s->left_intra_ctx[row7] : 0;
- }
- bit = vp56_rac_get_prob(&s->c, s->prob.p.intra[c]);
- s->counts.intra[c][bit]++;
- b->intra = !bit;
- }
-
- if ((b->intra || !b->skip) && s->s.h.txfmmode == TX_SWITCHABLE) {
- int c;
- if (have_a) {
- if (have_l) {
- c = (s->above_skip_ctx[col] ? max_tx :
- s->above_txfm_ctx[col]) +
- (s->left_skip_ctx[row7] ? max_tx :
- s->left_txfm_ctx[row7]) > max_tx;
- } else {
- c = s->above_skip_ctx[col] ? 1 :
- (s->above_txfm_ctx[col] * 2 > max_tx);
- }
- } else if (have_l) {
- c = s->left_skip_ctx[row7] ? 1 :
- (s->left_txfm_ctx[row7] * 2 > max_tx);
- } else {
- c = 1;
- }
- switch (max_tx) {
- case TX_32X32:
- b->tx = vp56_rac_get_prob(&s->c, s->prob.p.tx32p[c][0]);
- if (b->tx) {
- b->tx += vp56_rac_get_prob(&s->c, s->prob.p.tx32p[c][1]);
- if (b->tx == 2)
- b->tx += vp56_rac_get_prob(&s->c, s->prob.p.tx32p[c][2]);
- }
- s->counts.tx32p[c][b->tx]++;
- break;
- case TX_16X16:
- b->tx = vp56_rac_get_prob(&s->c, s->prob.p.tx16p[c][0]);
- if (b->tx)
- b->tx += vp56_rac_get_prob(&s->c, s->prob.p.tx16p[c][1]);
- s->counts.tx16p[c][b->tx]++;
- break;
- case TX_8X8:
- b->tx = vp56_rac_get_prob(&s->c, s->prob.p.tx8p[c]);
- s->counts.tx8p[c][b->tx]++;
- break;
- case TX_4X4:
- b->tx = TX_4X4;
- break;
- }
- } else {
- b->tx = FFMIN(max_tx, s->s.h.txfmmode);
- }
-
- if (s->s.h.keyframe || s->s.h.intraonly) {
- uint8_t *a = &s->above_mode_ctx[col * 2];
- uint8_t *l = &s->left_mode_ctx[(row7) << 1];
-
- b->comp = 0;
- if (b->bs > BS_8x8) {
- // FIXME the memory storage intermediates here aren't really
- // necessary, they're just there to make the code slightly
- // simpler for now
- b->mode[0] = a[0] = vp8_rac_get_tree(&s->c, vp9_intramode_tree,
- vp9_default_kf_ymode_probs[a[0]][l[0]]);
- if (b->bs != BS_8x4) {
- b->mode[1] = vp8_rac_get_tree(&s->c, vp9_intramode_tree,
- vp9_default_kf_ymode_probs[a[1]][b->mode[0]]);
- l[0] = a[1] = b->mode[1];
- } else {
- l[0] = a[1] = b->mode[1] = b->mode[0];
- }
- if (b->bs != BS_4x8) {
- b->mode[2] = a[0] = vp8_rac_get_tree(&s->c, vp9_intramode_tree,
- vp9_default_kf_ymode_probs[a[0]][l[1]]);
- if (b->bs != BS_8x4) {
- b->mode[3] = vp8_rac_get_tree(&s->c, vp9_intramode_tree,
- vp9_default_kf_ymode_probs[a[1]][b->mode[2]]);
- l[1] = a[1] = b->mode[3];
- } else {
- l[1] = a[1] = b->mode[3] = b->mode[2];
- }
- } else {
- b->mode[2] = b->mode[0];
- l[1] = a[1] = b->mode[3] = b->mode[1];
- }
- } else {
- b->mode[0] = vp8_rac_get_tree(&s->c, vp9_intramode_tree,
- vp9_default_kf_ymode_probs[*a][*l]);
- b->mode[3] = b->mode[2] = b->mode[1] = b->mode[0];
- // FIXME this can probably be optimized
- memset(a, b->mode[0], bwh_tab[0][b->bs][0]);
- memset(l, b->mode[0], bwh_tab[0][b->bs][1]);
- }
- b->uvmode = vp8_rac_get_tree(&s->c, vp9_intramode_tree,
- vp9_default_kf_uvmode_probs[b->mode[3]]);
- } else if (b->intra) {
- b->comp = 0;
- if (b->bs > BS_8x8) {
- b->mode[0] = vp8_rac_get_tree(&s->c, vp9_intramode_tree,
- s->prob.p.y_mode[0]);
- s->counts.y_mode[0][b->mode[0]]++;
- if (b->bs != BS_8x4) {
- b->mode[1] = vp8_rac_get_tree(&s->c, vp9_intramode_tree,
- s->prob.p.y_mode[0]);
- s->counts.y_mode[0][b->mode[1]]++;
- } else {
- b->mode[1] = b->mode[0];
- }
- if (b->bs != BS_4x8) {
- b->mode[2] = vp8_rac_get_tree(&s->c, vp9_intramode_tree,
- s->prob.p.y_mode[0]);
- s->counts.y_mode[0][b->mode[2]]++;
- if (b->bs != BS_8x4) {
- b->mode[3] = vp8_rac_get_tree(&s->c, vp9_intramode_tree,
- s->prob.p.y_mode[0]);
- s->counts.y_mode[0][b->mode[3]]++;
- } else {
- b->mode[3] = b->mode[2];
- }
- } else {
- b->mode[2] = b->mode[0];
- b->mode[3] = b->mode[1];
- }
- } else {
- static const uint8_t size_group[10] = {
- 3, 3, 3, 3, 2, 2, 2, 1, 1, 1
- };
- int sz = size_group[b->bs];
-
- b->mode[0] = vp8_rac_get_tree(&s->c, vp9_intramode_tree,
- s->prob.p.y_mode[sz]);
- b->mode[1] = b->mode[2] = b->mode[3] = b->mode[0];
- s->counts.y_mode[sz][b->mode[3]]++;
- }
- b->uvmode = vp8_rac_get_tree(&s->c, vp9_intramode_tree,
- s->prob.p.uv_mode[b->mode[3]]);
- s->counts.uv_mode[b->mode[3]][b->uvmode]++;
- } else {
- static const uint8_t inter_mode_ctx_lut[14][14] = {
- { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
- { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
- { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
- { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
- { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
- { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
- { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
- { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
- { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
- { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
- { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2, 2, 1, 3 },
- { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2, 2, 1, 3 },
- { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 0, 3 },
- { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 3, 3, 4 },
- };
-
- if (s->s.h.segmentation.enabled && s->s.h.segmentation.feat[b->seg_id].ref_enabled) {
- av_assert2(s->s.h.segmentation.feat[b->seg_id].ref_val != 0);
- b->comp = 0;
- b->ref[0] = s->s.h.segmentation.feat[b->seg_id].ref_val - 1;
- } else {
- // read comp_pred flag
- if (s->s.h.comppredmode != PRED_SWITCHABLE) {
- b->comp = s->s.h.comppredmode == PRED_COMPREF;
- } else {
- int c;
-
- // FIXME add intra as ref=0xff (or -1) to make these easier?
- if (have_a) {
- if (have_l) {
- if (s->above_comp_ctx[col] && s->left_comp_ctx[row7]) {
- c = 4;
- } else if (s->above_comp_ctx[col]) {
- c = 2 + (s->left_intra_ctx[row7] ||
- s->left_ref_ctx[row7] == s->s.h.fixcompref);
- } else if (s->left_comp_ctx[row7]) {
- c = 2 + (s->above_intra_ctx[col] ||
- s->above_ref_ctx[col] == s->s.h.fixcompref);
- } else {
- c = (!s->above_intra_ctx[col] &&
- s->above_ref_ctx[col] == s->s.h.fixcompref) ^
- (!s->left_intra_ctx[row7] &&
- s->left_ref_ctx[row & 7] == s->s.h.fixcompref);
- }
- } else {
- c = s->above_comp_ctx[col] ? 3 :
- (!s->above_intra_ctx[col] && s->above_ref_ctx[col] == s->s.h.fixcompref);
- }
- } else if (have_l) {
- c = s->left_comp_ctx[row7] ? 3 :
- (!s->left_intra_ctx[row7] && s->left_ref_ctx[row7] == s->s.h.fixcompref);
- } else {
- c = 1;
- }
- b->comp = vp56_rac_get_prob(&s->c, s->prob.p.comp[c]);
- s->counts.comp[c][b->comp]++;
- }
-
- // read actual references
- // FIXME probably cache a few variables here to prevent repetitive
- // memory accesses below
- if (b->comp) /* two references */ {
- int fix_idx = s->s.h.signbias[s->s.h.fixcompref], var_idx = !fix_idx, c, bit;
-
- b->ref[fix_idx] = s->s.h.fixcompref;
- // FIXME can this codeblob be replaced by some sort of LUT?
- if (have_a) {
- if (have_l) {
- if (s->above_intra_ctx[col]) {
- if (s->left_intra_ctx[row7]) {
- c = 2;
- } else {
- c = 1 + 2 * (s->left_ref_ctx[row7] != s->s.h.varcompref[1]);
- }
- } else if (s->left_intra_ctx[row7]) {
- c = 1 + 2 * (s->above_ref_ctx[col] != s->s.h.varcompref[1]);
- } else {
- int refl = s->left_ref_ctx[row7], refa = s->above_ref_ctx[col];
-
- if (refl == refa && refa == s->s.h.varcompref[1]) {
- c = 0;
- } else if (!s->left_comp_ctx[row7] && !s->above_comp_ctx[col]) {
- if ((refa == s->s.h.fixcompref && refl == s->s.h.varcompref[0]) ||
- (refl == s->s.h.fixcompref && refa == s->s.h.varcompref[0])) {
- c = 4;
- } else {
- c = (refa == refl) ? 3 : 1;
- }
- } else if (!s->left_comp_ctx[row7]) {
- if (refa == s->s.h.varcompref[1] && refl != s->s.h.varcompref[1]) {
- c = 1;
- } else {
- c = (refl == s->s.h.varcompref[1] &&
- refa != s->s.h.varcompref[1]) ? 2 : 4;
- }
- } else if (!s->above_comp_ctx[col]) {
- if (refl == s->s.h.varcompref[1] && refa != s->s.h.varcompref[1]) {
- c = 1;
- } else {
- c = (refa == s->s.h.varcompref[1] &&
- refl != s->s.h.varcompref[1]) ? 2 : 4;
- }
- } else {
- c = (refl == refa) ? 4 : 2;
- }
- }
- } else {
- if (s->above_intra_ctx[col]) {
- c = 2;
- } else if (s->above_comp_ctx[col]) {
- c = 4 * (s->above_ref_ctx[col] != s->s.h.varcompref[1]);
- } else {
- c = 3 * (s->above_ref_ctx[col] != s->s.h.varcompref[1]);
- }
- }
- } else if (have_l) {
- if (s->left_intra_ctx[row7]) {
- c = 2;
- } else if (s->left_comp_ctx[row7]) {
- c = 4 * (s->left_ref_ctx[row7] != s->s.h.varcompref[1]);
- } else {
- c = 3 * (s->left_ref_ctx[row7] != s->s.h.varcompref[1]);
- }
- } else {
- c = 2;
- }
- bit = vp56_rac_get_prob(&s->c, s->prob.p.comp_ref[c]);
- b->ref[var_idx] = s->s.h.varcompref[bit];
- s->counts.comp_ref[c][bit]++;
- } else /* single reference */ {
- int bit, c;
-
- if (have_a && !s->above_intra_ctx[col]) {
- if (have_l && !s->left_intra_ctx[row7]) {
- if (s->left_comp_ctx[row7]) {
- if (s->above_comp_ctx[col]) {
- c = 1 + (!s->s.h.fixcompref || !s->left_ref_ctx[row7] ||
- !s->above_ref_ctx[col]);
- } else {
- c = (3 * !s->above_ref_ctx[col]) +
- (!s->s.h.fixcompref || !s->left_ref_ctx[row7]);
- }
- } else if (s->above_comp_ctx[col]) {
- c = (3 * !s->left_ref_ctx[row7]) +
- (!s->s.h.fixcompref || !s->above_ref_ctx[col]);
- } else {
- c = 2 * !s->left_ref_ctx[row7] + 2 * !s->above_ref_ctx[col];
- }
- } else if (s->above_intra_ctx[col]) {
- c = 2;
- } else if (s->above_comp_ctx[col]) {
- c = 1 + (!s->s.h.fixcompref || !s->above_ref_ctx[col]);
- } else {
- c = 4 * (!s->above_ref_ctx[col]);
- }
- } else if (have_l && !s->left_intra_ctx[row7]) {
- if (s->left_intra_ctx[row7]) {
- c = 2;
- } else if (s->left_comp_ctx[row7]) {
- c = 1 + (!s->s.h.fixcompref || !s->left_ref_ctx[row7]);
- } else {
- c = 4 * (!s->left_ref_ctx[row7]);
- }
- } else {
- c = 2;
- }
- bit = vp56_rac_get_prob(&s->c, s->prob.p.single_ref[c][0]);
- s->counts.single_ref[c][0][bit]++;
- if (!bit) {
- b->ref[0] = 0;
- } else {
- // FIXME can this codeblob be replaced by some sort of LUT?
- if (have_a) {
- if (have_l) {
- if (s->left_intra_ctx[row7]) {
- if (s->above_intra_ctx[col]) {
- c = 2;
- } else if (s->above_comp_ctx[col]) {
- c = 1 + 2 * (s->s.h.fixcompref == 1 ||
- s->above_ref_ctx[col] == 1);
- } else if (!s->above_ref_ctx[col]) {
- c = 3;
- } else {
- c = 4 * (s->above_ref_ctx[col] == 1);
- }
- } else if (s->above_intra_ctx[col]) {
- if (s->left_intra_ctx[row7]) {
- c = 2;
- } else if (s->left_comp_ctx[row7]) {
- c = 1 + 2 * (s->s.h.fixcompref == 1 ||
- s->left_ref_ctx[row7] == 1);
- } else if (!s->left_ref_ctx[row7]) {
- c = 3;
- } else {
- c = 4 * (s->left_ref_ctx[row7] == 1);
- }
- } else if (s->above_comp_ctx[col]) {
- if (s->left_comp_ctx[row7]) {
- if (s->left_ref_ctx[row7] == s->above_ref_ctx[col]) {
- c = 3 * (s->s.h.fixcompref == 1 ||
- s->left_ref_ctx[row7] == 1);
- } else {
- c = 2;
- }
- } else if (!s->left_ref_ctx[row7]) {
- c = 1 + 2 * (s->s.h.fixcompref == 1 ||
- s->above_ref_ctx[col] == 1);
- } else {
- c = 3 * (s->left_ref_ctx[row7] == 1) +
- (s->s.h.fixcompref == 1 || s->above_ref_ctx[col] == 1);
- }
- } else if (s->left_comp_ctx[row7]) {
- if (!s->above_ref_ctx[col]) {
- c = 1 + 2 * (s->s.h.fixcompref == 1 ||
- s->left_ref_ctx[row7] == 1);
- } else {
- c = 3 * (s->above_ref_ctx[col] == 1) +
- (s->s.h.fixcompref == 1 || s->left_ref_ctx[row7] == 1);
- }
- } else if (!s->above_ref_ctx[col]) {
- if (!s->left_ref_ctx[row7]) {
- c = 3;
- } else {
- c = 4 * (s->left_ref_ctx[row7] == 1);
- }
- } else if (!s->left_ref_ctx[row7]) {
- c = 4 * (s->above_ref_ctx[col] == 1);
- } else {
- c = 2 * (s->left_ref_ctx[row7] == 1) +
- 2 * (s->above_ref_ctx[col] == 1);
- }
- } else {
- if (s->above_intra_ctx[col] ||
- (!s->above_comp_ctx[col] && !s->above_ref_ctx[col])) {
- c = 2;
- } else if (s->above_comp_ctx[col]) {
- c = 3 * (s->s.h.fixcompref == 1 || s->above_ref_ctx[col] == 1);
- } else {
- c = 4 * (s->above_ref_ctx[col] == 1);
- }
- }
- } else if (have_l) {
- if (s->left_intra_ctx[row7] ||
- (!s->left_comp_ctx[row7] && !s->left_ref_ctx[row7])) {
- c = 2;
- } else if (s->left_comp_ctx[row7]) {
- c = 3 * (s->s.h.fixcompref == 1 || s->left_ref_ctx[row7] == 1);
- } else {
- c = 4 * (s->left_ref_ctx[row7] == 1);
- }
- } else {
- c = 2;
- }
- bit = vp56_rac_get_prob(&s->c, s->prob.p.single_ref[c][1]);
- s->counts.single_ref[c][1][bit]++;
- b->ref[0] = 1 + bit;
- }
- }
- }
-
- if (b->bs <= BS_8x8) {
- if (s->s.h.segmentation.enabled && s->s.h.segmentation.feat[b->seg_id].skip_enabled) {
- b->mode[0] = b->mode[1] = b->mode[2] = b->mode[3] = ZEROMV;
- } else {
- static const uint8_t off[10] = {
- 3, 0, 0, 1, 0, 0, 0, 0, 0, 0
- };
-
- // FIXME this needs to use the LUT tables from find_ref_mvs
- // because not all are -1,0/0,-1
- int c = inter_mode_ctx_lut[s->above_mode_ctx[col + off[b->bs]]]
- [s->left_mode_ctx[row7 + off[b->bs]]];
-
- b->mode[0] = vp8_rac_get_tree(&s->c, vp9_inter_mode_tree,
- s->prob.p.mv_mode[c]);
- b->mode[1] = b->mode[2] = b->mode[3] = b->mode[0];
- s->counts.mv_mode[c][b->mode[0] - 10]++;
- }
- }
-
- if (s->s.h.filtermode == FILTER_SWITCHABLE) {
- int c;
-
- if (have_a && s->above_mode_ctx[col] >= NEARESTMV) {
- if (have_l && s->left_mode_ctx[row7] >= NEARESTMV) {
- c = s->above_filter_ctx[col] == s->left_filter_ctx[row7] ?
- s->left_filter_ctx[row7] : 3;
- } else {
- c = s->above_filter_ctx[col];
- }
- } else if (have_l && s->left_mode_ctx[row7] >= NEARESTMV) {
- c = s->left_filter_ctx[row7];
- } else {
- c = 3;
- }
-
- filter_id = vp8_rac_get_tree(&s->c, vp9_filter_tree,
- s->prob.p.filter[c]);
- s->counts.filter[c][filter_id]++;
- b->filter = vp9_filter_lut[filter_id];
- } else {
- b->filter = s->s.h.filtermode;
- }
-
- if (b->bs > BS_8x8) {
- int c = inter_mode_ctx_lut[s->above_mode_ctx[col]][s->left_mode_ctx[row7]];
-
- b->mode[0] = vp8_rac_get_tree(&s->c, vp9_inter_mode_tree,
- s->prob.p.mv_mode[c]);
- s->counts.mv_mode[c][b->mode[0] - 10]++;
- fill_mv(s, b->mv[0], b->mode[0], 0);
-
- if (b->bs != BS_8x4) {
- b->mode[1] = vp8_rac_get_tree(&s->c, vp9_inter_mode_tree,
- s->prob.p.mv_mode[c]);
- s->counts.mv_mode[c][b->mode[1] - 10]++;
- fill_mv(s, b->mv[1], b->mode[1], 1);
- } else {
- b->mode[1] = b->mode[0];
- AV_COPY32(&b->mv[1][0], &b->mv[0][0]);
- AV_COPY32(&b->mv[1][1], &b->mv[0][1]);
- }
-
- if (b->bs != BS_4x8) {
- b->mode[2] = vp8_rac_get_tree(&s->c, vp9_inter_mode_tree,
- s->prob.p.mv_mode[c]);
- s->counts.mv_mode[c][b->mode[2] - 10]++;
- fill_mv(s, b->mv[2], b->mode[2], 2);
-
- if (b->bs != BS_8x4) {
- b->mode[3] = vp8_rac_get_tree(&s->c, vp9_inter_mode_tree,
- s->prob.p.mv_mode[c]);
- s->counts.mv_mode[c][b->mode[3] - 10]++;
- fill_mv(s, b->mv[3], b->mode[3], 3);
- } else {
- b->mode[3] = b->mode[2];
- AV_COPY32(&b->mv[3][0], &b->mv[2][0]);
- AV_COPY32(&b->mv[3][1], &b->mv[2][1]);
- }
- } else {
- b->mode[2] = b->mode[0];
- AV_COPY32(&b->mv[2][0], &b->mv[0][0]);
- AV_COPY32(&b->mv[2][1], &b->mv[0][1]);
- b->mode[3] = b->mode[1];
- AV_COPY32(&b->mv[3][0], &b->mv[1][0]);
- AV_COPY32(&b->mv[3][1], &b->mv[1][1]);
- }
- } else {
- fill_mv(s, b->mv[0], b->mode[0], -1);
- AV_COPY32(&b->mv[1][0], &b->mv[0][0]);
- AV_COPY32(&b->mv[2][0], &b->mv[0][0]);
- AV_COPY32(&b->mv[3][0], &b->mv[0][0]);
- AV_COPY32(&b->mv[1][1], &b->mv[0][1]);
- AV_COPY32(&b->mv[2][1], &b->mv[0][1]);
- AV_COPY32(&b->mv[3][1], &b->mv[0][1]);
- }
-
- vref = b->ref[b->comp ? s->s.h.signbias[s->s.h.varcompref[0]] : 0];
- }
-
-#if HAVE_FAST_64BIT
-#define SPLAT_CTX(var, val, n) \
- switch (n) { \
- case 1: var = val; break; \
- case 2: AV_WN16A(&var, val * 0x0101); break; \
- case 4: AV_WN32A(&var, val * 0x01010101); break; \
- case 8: AV_WN64A(&var, val * 0x0101010101010101ULL); break; \
- case 16: { \
- uint64_t v64 = val * 0x0101010101010101ULL; \
- AV_WN64A( &var, v64); \
- AV_WN64A(&((uint8_t *) &var)[8], v64); \
- break; \
- } \
- }
-#else
-#define SPLAT_CTX(var, val, n) \
- switch (n) { \
- case 1: var = val; break; \
- case 2: AV_WN16A(&var, val * 0x0101); break; \
- case 4: AV_WN32A(&var, val * 0x01010101); break; \
- case 8: { \
- uint32_t v32 = val * 0x01010101; \
- AV_WN32A( &var, v32); \
- AV_WN32A(&((uint8_t *) &var)[4], v32); \
- break; \
- } \
- case 16: { \
- uint32_t v32 = val * 0x01010101; \
- AV_WN32A( &var, v32); \
- AV_WN32A(&((uint8_t *) &var)[4], v32); \
- AV_WN32A(&((uint8_t *) &var)[8], v32); \
- AV_WN32A(&((uint8_t *) &var)[12], v32); \
- break; \
- } \
- }
-#endif
-
- switch (bwh_tab[1][b->bs][0]) {
-#define SET_CTXS(dir, off, n) \
- do { \
- SPLAT_CTX(s->dir##_skip_ctx[off], b->skip, n); \
- SPLAT_CTX(s->dir##_txfm_ctx[off], b->tx, n); \
- SPLAT_CTX(s->dir##_partition_ctx[off], dir##_ctx[b->bs], n); \
- if (!s->s.h.keyframe && !s->s.h.intraonly) { \
- SPLAT_CTX(s->dir##_intra_ctx[off], b->intra, n); \
- SPLAT_CTX(s->dir##_comp_ctx[off], b->comp, n); \
- SPLAT_CTX(s->dir##_mode_ctx[off], b->mode[3], n); \
- if (!b->intra) { \
- SPLAT_CTX(s->dir##_ref_ctx[off], vref, n); \
- if (s->s.h.filtermode == FILTER_SWITCHABLE) { \
- SPLAT_CTX(s->dir##_filter_ctx[off], filter_id, n); \
- } \
- } \
- } \
- } while (0)
- case 1: SET_CTXS(above, col, 1); break;
- case 2: SET_CTXS(above, col, 2); break;
- case 4: SET_CTXS(above, col, 4); break;
- case 8: SET_CTXS(above, col, 8); break;
- }
- switch (bwh_tab[1][b->bs][1]) {
- case 1: SET_CTXS(left, row7, 1); break;
- case 2: SET_CTXS(left, row7, 2); break;
- case 4: SET_CTXS(left, row7, 4); break;
- case 8: SET_CTXS(left, row7, 8); break;
- }
-#undef SPLAT_CTX
-#undef SET_CTXS
-
- if (!s->s.h.keyframe && !s->s.h.intraonly) {
- if (b->bs > BS_8x8) {
- int mv0 = AV_RN32A(&b->mv[3][0]), mv1 = AV_RN32A(&b->mv[3][1]);
-
- AV_COPY32(&s->left_mv_ctx[row7 * 2 + 0][0], &b->mv[1][0]);
- AV_COPY32(&s->left_mv_ctx[row7 * 2 + 0][1], &b->mv[1][1]);
- AV_WN32A(&s->left_mv_ctx[row7 * 2 + 1][0], mv0);
- AV_WN32A(&s->left_mv_ctx[row7 * 2 + 1][1], mv1);
- AV_COPY32(&s->above_mv_ctx[col * 2 + 0][0], &b->mv[2][0]);
- AV_COPY32(&s->above_mv_ctx[col * 2 + 0][1], &b->mv[2][1]);
- AV_WN32A(&s->above_mv_ctx[col * 2 + 1][0], mv0);
- AV_WN32A(&s->above_mv_ctx[col * 2 + 1][1], mv1);
- } else {
- int n, mv0 = AV_RN32A(&b->mv[3][0]), mv1 = AV_RN32A(&b->mv[3][1]);
-
- for (n = 0; n < w4 * 2; n++) {
- AV_WN32A(&s->above_mv_ctx[col * 2 + n][0], mv0);
- AV_WN32A(&s->above_mv_ctx[col * 2 + n][1], mv1);
- }
- for (n = 0; n < h4 * 2; n++) {
- AV_WN32A(&s->left_mv_ctx[row7 * 2 + n][0], mv0);
- AV_WN32A(&s->left_mv_ctx[row7 * 2 + n][1], mv1);
- }
- }
- }
-
- // FIXME kinda ugly
- for (y = 0; y < h4; y++) {
- int x, o = (row + y) * s->sb_cols * 8 + col;
- struct VP9mvrefPair *mv = &s->s.frames[CUR_FRAME].mv[o];
-
- if (b->intra) {
- for (x = 0; x < w4; x++) {
- mv[x].ref[0] =
- mv[x].ref[1] = -1;
- }
- } else if (b->comp) {
- for (x = 0; x < w4; x++) {
- mv[x].ref[0] = b->ref[0];
- mv[x].ref[1] = b->ref[1];
- AV_COPY32(&mv[x].mv[0], &b->mv[3][0]);
- AV_COPY32(&mv[x].mv[1], &b->mv[3][1]);
- }
- } else {
- for (x = 0; x < w4; x++) {
- mv[x].ref[0] = b->ref[0];
- mv[x].ref[1] = -1;
- AV_COPY32(&mv[x].mv[0], &b->mv[3][0]);
- }
- }
- }
-}
-
-// FIXME merge cnt/eob arguments?
-static av_always_inline int
-decode_coeffs_b_generic(VP56RangeCoder *c, int16_t *coef, int n_coeffs,
- int is_tx32x32, int is8bitsperpixel, int bpp, unsigned (*cnt)[6][3],
- unsigned (*eob)[6][2], uint8_t (*p)[6][11],
- int nnz, const int16_t *scan, const int16_t (*nb)[2],
- const int16_t *band_counts, const int16_t *qmul)
-{
- int i = 0, band = 0, band_left = band_counts[band];
- uint8_t *tp = p[0][nnz];
- uint8_t cache[1024];
-
- do {
- int val, rc;
-
- val = vp56_rac_get_prob_branchy(c, tp[0]); // eob
- eob[band][nnz][val]++;
- if (!val)
- break;
-
- skip_eob:
- if (!vp56_rac_get_prob_branchy(c, tp[1])) { // zero
- cnt[band][nnz][0]++;
- if (!--band_left)
- band_left = band_counts[++band];
- cache[scan[i]] = 0;
- nnz = (1 + cache[nb[i][0]] + cache[nb[i][1]]) >> 1;
- tp = p[band][nnz];
- if (++i == n_coeffs)
- break; //invalid input; blocks should end with EOB
- goto skip_eob;
- }
-
- rc = scan[i];
- if (!vp56_rac_get_prob_branchy(c, tp[2])) { // one
- cnt[band][nnz][1]++;
- val = 1;
- cache[rc] = 1;
- } else {
- // fill in p[3-10] (model fill) - only once per frame for each pos
- if (!tp[3])
- memcpy(&tp[3], vp9_model_pareto8[tp[2]], 8);
-
- cnt[band][nnz][2]++;
- if (!vp56_rac_get_prob_branchy(c, tp[3])) { // 2, 3, 4
- if (!vp56_rac_get_prob_branchy(c, tp[4])) {
- cache[rc] = val = 2;
- } else {
- val = 3 + vp56_rac_get_prob(c, tp[5]);
- cache[rc] = 3;
- }
- } else if (!vp56_rac_get_prob_branchy(c, tp[6])) { // cat1/2
- cache[rc] = 4;
- if (!vp56_rac_get_prob_branchy(c, tp[7])) {
- val = 5 + vp56_rac_get_prob(c, 159);
- } else {
- val = 7 + (vp56_rac_get_prob(c, 165) << 1);
- val += vp56_rac_get_prob(c, 145);
- }
- } else { // cat 3-6
- cache[rc] = 5;
- if (!vp56_rac_get_prob_branchy(c, tp[8])) {
- if (!vp56_rac_get_prob_branchy(c, tp[9])) {
- val = 11 + (vp56_rac_get_prob(c, 173) << 2);
- val += (vp56_rac_get_prob(c, 148) << 1);
- val += vp56_rac_get_prob(c, 140);
- } else {
- val = 19 + (vp56_rac_get_prob(c, 176) << 3);
- val += (vp56_rac_get_prob(c, 155) << 2);
- val += (vp56_rac_get_prob(c, 140) << 1);
- val += vp56_rac_get_prob(c, 135);
- }
- } else if (!vp56_rac_get_prob_branchy(c, tp[10])) {
- val = 35 + (vp56_rac_get_prob(c, 180) << 4);
- val += (vp56_rac_get_prob(c, 157) << 3);
- val += (vp56_rac_get_prob(c, 141) << 2);
- val += (vp56_rac_get_prob(c, 134) << 1);
- val += vp56_rac_get_prob(c, 130);
- } else {
- val = 67;
- if (!is8bitsperpixel) {
- if (bpp == 12) {
- val += vp56_rac_get_prob(c, 255) << 17;
- val += vp56_rac_get_prob(c, 255) << 16;
- }
- val += (vp56_rac_get_prob(c, 255) << 15);
- val += (vp56_rac_get_prob(c, 255) << 14);
- }
- val += (vp56_rac_get_prob(c, 254) << 13);
- val += (vp56_rac_get_prob(c, 254) << 12);
- val += (vp56_rac_get_prob(c, 254) << 11);
- val += (vp56_rac_get_prob(c, 252) << 10);
- val += (vp56_rac_get_prob(c, 249) << 9);
- val += (vp56_rac_get_prob(c, 243) << 8);
- val += (vp56_rac_get_prob(c, 230) << 7);
- val += (vp56_rac_get_prob(c, 196) << 6);
- val += (vp56_rac_get_prob(c, 177) << 5);
- val += (vp56_rac_get_prob(c, 153) << 4);
- val += (vp56_rac_get_prob(c, 140) << 3);
- val += (vp56_rac_get_prob(c, 133) << 2);
- val += (vp56_rac_get_prob(c, 130) << 1);
- val += vp56_rac_get_prob(c, 129);
- }
- }
- }
-#define STORE_COEF(c, i, v) do { \
- if (is8bitsperpixel) { \
- c[i] = v; \
- } else { \
- AV_WN32A(&c[i * 2], v); \
- } \
-} while (0)
- if (!--band_left)
- band_left = band_counts[++band];
- if (is_tx32x32)
- STORE_COEF(coef, rc, ((vp8_rac_get(c) ? -val : val) * qmul[!!i]) / 2);
- else
- STORE_COEF(coef, rc, (vp8_rac_get(c) ? -val : val) * qmul[!!i]);
- nnz = (1 + cache[nb[i][0]] + cache[nb[i][1]]) >> 1;
- tp = p[band][nnz];
- } while (++i < n_coeffs);
-
- return i;
-}
-
-static int decode_coeffs_b_8bpp(VP9Context *s, int16_t *coef, int n_coeffs,
- unsigned (*cnt)[6][3], unsigned (*eob)[6][2],
- uint8_t (*p)[6][11], int nnz, const int16_t *scan,
- const int16_t (*nb)[2], const int16_t *band_counts,
- const int16_t *qmul)
-{
- return decode_coeffs_b_generic(&s->c, coef, n_coeffs, 0, 1, 8, cnt, eob, p,
- nnz, scan, nb, band_counts, qmul);
-}
-
-static int decode_coeffs_b32_8bpp(VP9Context *s, int16_t *coef, int n_coeffs,
- unsigned (*cnt)[6][3], unsigned (*eob)[6][2],
- uint8_t (*p)[6][11], int nnz, const int16_t *scan,
- const int16_t (*nb)[2], const int16_t *band_counts,
- const int16_t *qmul)
-{
- return decode_coeffs_b_generic(&s->c, coef, n_coeffs, 1, 1, 8, cnt, eob, p,
- nnz, scan, nb, band_counts, qmul);
-}
-
-static int decode_coeffs_b_16bpp(VP9Context *s, int16_t *coef, int n_coeffs,
- unsigned (*cnt)[6][3], unsigned (*eob)[6][2],
- uint8_t (*p)[6][11], int nnz, const int16_t *scan,
- const int16_t (*nb)[2], const int16_t *band_counts,
- const int16_t *qmul)
-{
- return decode_coeffs_b_generic(&s->c, coef, n_coeffs, 0, 0, s->bpp, cnt, eob, p,
- nnz, scan, nb, band_counts, qmul);
-}
-
-static int decode_coeffs_b32_16bpp(VP9Context *s, int16_t *coef, int n_coeffs,
- unsigned (*cnt)[6][3], unsigned (*eob)[6][2],
- uint8_t (*p)[6][11], int nnz, const int16_t *scan,
- const int16_t (*nb)[2], const int16_t *band_counts,
- const int16_t *qmul)
-{
- return decode_coeffs_b_generic(&s->c, coef, n_coeffs, 1, 0, s->bpp, cnt, eob, p,
- nnz, scan, nb, band_counts, qmul);
-}
-
-static av_always_inline int decode_coeffs(AVCodecContext *ctx, int is8bitsperpixel)
-{
- VP9Context *s = ctx->priv_data;
- VP9Block *b = s->b;
- int row = s->row, col = s->col;
- uint8_t (*p)[6][11] = s->prob.coef[b->tx][0 /* y */][!b->intra];
- unsigned (*c)[6][3] = s->counts.coef[b->tx][0 /* y */][!b->intra];
- unsigned (*e)[6][2] = s->counts.eob[b->tx][0 /* y */][!b->intra];
- int w4 = bwh_tab[1][b->bs][0] << 1, h4 = bwh_tab[1][b->bs][1] << 1;
- int end_x = FFMIN(2 * (s->cols - col), w4);
- int end_y = FFMIN(2 * (s->rows - row), h4);
- int n, pl, x, y, res;
- int16_t (*qmul)[2] = s->s.h.segmentation.feat[b->seg_id].qmul;
- int tx = 4 * s->s.h.lossless + b->tx;
- const int16_t * const *yscans = vp9_scans[tx];
- const int16_t (* const *ynbs)[2] = vp9_scans_nb[tx];
- const int16_t *uvscan = vp9_scans[b->uvtx][DCT_DCT];
- const int16_t (*uvnb)[2] = vp9_scans_nb[b->uvtx][DCT_DCT];
- uint8_t *a = &s->above_y_nnz_ctx[col * 2];
- uint8_t *l = &s->left_y_nnz_ctx[(row & 7) << 1];
- static const int16_t band_counts[4][8] = {
- { 1, 2, 3, 4, 3, 16 - 13 },
- { 1, 2, 3, 4, 11, 64 - 21 },
- { 1, 2, 3, 4, 11, 256 - 21 },
- { 1, 2, 3, 4, 11, 1024 - 21 },
- };
- const int16_t *y_band_counts = band_counts[b->tx];
- const int16_t *uv_band_counts = band_counts[b->uvtx];
- int bytesperpixel = is8bitsperpixel ? 1 : 2;
- int total_coeff = 0;
-
-#define MERGE(la, end, step, rd) \
- for (n = 0; n < end; n += step) \
- la[n] = !!rd(&la[n])
-#define MERGE_CTX(step, rd) \
- do { \
- MERGE(l, end_y, step, rd); \
- MERGE(a, end_x, step, rd); \
- } while (0)
-
-#define DECODE_Y_COEF_LOOP(step, mode_index, v) \
- for (n = 0, y = 0; y < end_y; y += step) { \
- for (x = 0; x < end_x; x += step, n += step * step) { \
- enum TxfmType txtp = vp9_intra_txfm_type[b->mode[mode_index]]; \
- res = (is8bitsperpixel ? decode_coeffs_b##v##_8bpp : decode_coeffs_b##v##_16bpp) \
- (s, s->block + 16 * n * bytesperpixel, 16 * step * step, \
- c, e, p, a[x] + l[y], yscans[txtp], \
- ynbs[txtp], y_band_counts, qmul[0]); \
- a[x] = l[y] = !!res; \
- total_coeff |= !!res; \
- if (step >= 4) { \
- AV_WN16A(&s->eob[n], res); \
- } else { \
- s->eob[n] = res; \
- } \
- } \
- }
-
-#define SPLAT(la, end, step, cond) \
- if (step == 2) { \
- for (n = 1; n < end; n += step) \
- la[n] = la[n - 1]; \
- } else if (step == 4) { \
- if (cond) { \
- for (n = 0; n < end; n += step) \
- AV_WN32A(&la[n], la[n] * 0x01010101); \
- } else { \
- for (n = 0; n < end; n += step) \
- memset(&la[n + 1], la[n], FFMIN(end - n - 1, 3)); \
- } \
- } else /* step == 8 */ { \
- if (cond) { \
- if (HAVE_FAST_64BIT) { \
- for (n = 0; n < end; n += step) \
- AV_WN64A(&la[n], la[n] * 0x0101010101010101ULL); \
- } else { \
- for (n = 0; n < end; n += step) { \
- uint32_t v32 = la[n] * 0x01010101; \
- AV_WN32A(&la[n], v32); \
- AV_WN32A(&la[n + 4], v32); \
- } \
- } \
- } else { \
- for (n = 0; n < end; n += step) \
- memset(&la[n + 1], la[n], FFMIN(end - n - 1, 7)); \
- } \
- }
-#define SPLAT_CTX(step) \
- do { \
- SPLAT(a, end_x, step, end_x == w4); \
- SPLAT(l, end_y, step, end_y == h4); \
- } while (0)
-
- /* y tokens */
- switch (b->tx) {
- case TX_4X4:
- DECODE_Y_COEF_LOOP(1, b->bs > BS_8x8 ? n : 0,);
- break;
- case TX_8X8:
- MERGE_CTX(2, AV_RN16A);
- DECODE_Y_COEF_LOOP(2, 0,);
- SPLAT_CTX(2);
- break;
- case TX_16X16:
- MERGE_CTX(4, AV_RN32A);
- DECODE_Y_COEF_LOOP(4, 0,);
- SPLAT_CTX(4);
- break;
- case TX_32X32:
- MERGE_CTX(8, AV_RN64A);
- DECODE_Y_COEF_LOOP(8, 0, 32);
- SPLAT_CTX(8);
- break;
- }
-
-#define DECODE_UV_COEF_LOOP(step, v) \
- for (n = 0, y = 0; y < end_y; y += step) { \
- for (x = 0; x < end_x; x += step, n += step * step) { \
- res = (is8bitsperpixel ? decode_coeffs_b##v##_8bpp : decode_coeffs_b##v##_16bpp) \
- (s, s->uvblock[pl] + 16 * n * bytesperpixel, \
- 16 * step * step, c, e, p, a[x] + l[y], \
- uvscan, uvnb, uv_band_counts, qmul[1]); \
- a[x] = l[y] = !!res; \
- total_coeff |= !!res; \
- if (step >= 4) { \
- AV_WN16A(&s->uveob[pl][n], res); \
- } else { \
- s->uveob[pl][n] = res; \
- } \
- } \
- }
-
- p = s->prob.coef[b->uvtx][1 /* uv */][!b->intra];
- c = s->counts.coef[b->uvtx][1 /* uv */][!b->intra];
- e = s->counts.eob[b->uvtx][1 /* uv */][!b->intra];
- w4 >>= s->ss_h;
- end_x >>= s->ss_h;
- h4 >>= s->ss_v;
- end_y >>= s->ss_v;
- for (pl = 0; pl < 2; pl++) {
- a = &s->above_uv_nnz_ctx[pl][col << !s->ss_h];
- l = &s->left_uv_nnz_ctx[pl][(row & 7) << !s->ss_v];
- switch (b->uvtx) {
- case TX_4X4:
- DECODE_UV_COEF_LOOP(1,);
- break;
- case TX_8X8:
- MERGE_CTX(2, AV_RN16A);
- DECODE_UV_COEF_LOOP(2,);
- SPLAT_CTX(2);
- break;
- case TX_16X16:
- MERGE_CTX(4, AV_RN32A);
- DECODE_UV_COEF_LOOP(4,);
- SPLAT_CTX(4);
- break;
- case TX_32X32:
- MERGE_CTX(8, AV_RN64A);
- DECODE_UV_COEF_LOOP(8, 32);
- SPLAT_CTX(8);
- break;
- }
- }
-
- return total_coeff;
-}
-
-static int decode_coeffs_8bpp(AVCodecContext *ctx)
-{
- return decode_coeffs(ctx, 1);
-}
-
-static int decode_coeffs_16bpp(AVCodecContext *ctx)
-{
- return decode_coeffs(ctx, 0);
-}
-
-static av_always_inline int check_intra_mode(VP9Context *s, int mode, uint8_t **a,
- uint8_t *dst_edge, ptrdiff_t stride_edge,
- uint8_t *dst_inner, ptrdiff_t stride_inner,
- uint8_t *l, int col, int x, int w,
- int row, int y, enum TxfmMode tx,
- int p, int ss_h, int ss_v, int bytesperpixel)
-{
- int have_top = row > 0 || y > 0;
- int have_left = col > s->tile_col_start || x > 0;
- int have_right = x < w - 1;
- int bpp = s->bpp;
- static const uint8_t mode_conv[10][2 /* have_left */][2 /* have_top */] = {
- [VERT_PRED] = { { DC_127_PRED, VERT_PRED },
- { DC_127_PRED, VERT_PRED } },
- [HOR_PRED] = { { DC_129_PRED, DC_129_PRED },
- { HOR_PRED, HOR_PRED } },
- [DC_PRED] = { { DC_128_PRED, TOP_DC_PRED },
- { LEFT_DC_PRED, DC_PRED } },
- [DIAG_DOWN_LEFT_PRED] = { { DC_127_PRED, DIAG_DOWN_LEFT_PRED },
- { DC_127_PRED, DIAG_DOWN_LEFT_PRED } },
- [DIAG_DOWN_RIGHT_PRED] = { { DIAG_DOWN_RIGHT_PRED, DIAG_DOWN_RIGHT_PRED },
- { DIAG_DOWN_RIGHT_PRED, DIAG_DOWN_RIGHT_PRED } },
- [VERT_RIGHT_PRED] = { { VERT_RIGHT_PRED, VERT_RIGHT_PRED },
- { VERT_RIGHT_PRED, VERT_RIGHT_PRED } },
- [HOR_DOWN_PRED] = { { HOR_DOWN_PRED, HOR_DOWN_PRED },
- { HOR_DOWN_PRED, HOR_DOWN_PRED } },
- [VERT_LEFT_PRED] = { { DC_127_PRED, VERT_LEFT_PRED },
- { DC_127_PRED, VERT_LEFT_PRED } },
- [HOR_UP_PRED] = { { DC_129_PRED, DC_129_PRED },
- { HOR_UP_PRED, HOR_UP_PRED } },
- [TM_VP8_PRED] = { { DC_129_PRED, VERT_PRED },
- { HOR_PRED, TM_VP8_PRED } },
- };
- static const struct {
- uint8_t needs_left:1;
- uint8_t needs_top:1;
- uint8_t needs_topleft:1;
- uint8_t needs_topright:1;
- uint8_t invert_left:1;
- } edges[N_INTRA_PRED_MODES] = {
- [VERT_PRED] = { .needs_top = 1 },
- [HOR_PRED] = { .needs_left = 1 },
- [DC_PRED] = { .needs_top = 1, .needs_left = 1 },
- [DIAG_DOWN_LEFT_PRED] = { .needs_top = 1, .needs_topright = 1 },
- [DIAG_DOWN_RIGHT_PRED] = { .needs_left = 1, .needs_top = 1, .needs_topleft = 1 },
- [VERT_RIGHT_PRED] = { .needs_left = 1, .needs_top = 1, .needs_topleft = 1 },
- [HOR_DOWN_PRED] = { .needs_left = 1, .needs_top = 1, .needs_topleft = 1 },
- [VERT_LEFT_PRED] = { .needs_top = 1, .needs_topright = 1 },
- [HOR_UP_PRED] = { .needs_left = 1, .invert_left = 1 },
- [TM_VP8_PRED] = { .needs_left = 1, .needs_top = 1, .needs_topleft = 1 },
- [LEFT_DC_PRED] = { .needs_left = 1 },
- [TOP_DC_PRED] = { .needs_top = 1 },
- [DC_128_PRED] = { 0 },
- [DC_127_PRED] = { 0 },
- [DC_129_PRED] = { 0 }
- };
-
- av_assert2(mode >= 0 && mode < 10);
- mode = mode_conv[mode][have_left][have_top];
- if (edges[mode].needs_top) {
- uint8_t *top, *topleft;
- int n_px_need = 4 << tx, n_px_have = (((s->cols - col) << !ss_h) - x) * 4;
- int n_px_need_tr = 0;
-
- if (tx == TX_4X4 && edges[mode].needs_topright && have_right)
- n_px_need_tr = 4;
-
- // if top of sb64-row, use s->intra_pred_data[] instead of
- // dst[-stride] for intra prediction (it contains pre- instead of
- // post-loopfilter data)
- if (have_top) {
- top = !(row & 7) && !y ?
- s->intra_pred_data[p] + (col * (8 >> ss_h) + x * 4) * bytesperpixel :
- y == 0 ? &dst_edge[-stride_edge] : &dst_inner[-stride_inner];
- if (have_left)
- topleft = !(row & 7) && !y ?
- s->intra_pred_data[p] + (col * (8 >> ss_h) + x * 4) * bytesperpixel :
- y == 0 || x == 0 ? &dst_edge[-stride_edge] :
- &dst_inner[-stride_inner];
- }
-
- if (have_top &&
- (!edges[mode].needs_topleft || (have_left && top == topleft)) &&
- (tx != TX_4X4 || !edges[mode].needs_topright || have_right) &&
- n_px_need + n_px_need_tr <= n_px_have) {
- *a = top;
- } else {
- if (have_top) {
- if (n_px_need <= n_px_have) {
- memcpy(*a, top, n_px_need * bytesperpixel);
- } else {
-#define memset_bpp(c, i1, v, i2, num) do { \
- if (bytesperpixel == 1) { \
- memset(&(c)[(i1)], (v)[(i2)], (num)); \
- } else { \
- int n, val = AV_RN16A(&(v)[(i2) * 2]); \
- for (n = 0; n < (num); n++) { \
- AV_WN16A(&(c)[((i1) + n) * 2], val); \
- } \
- } \
-} while (0)
- memcpy(*a, top, n_px_have * bytesperpixel);
- memset_bpp(*a, n_px_have, (*a), n_px_have - 1, n_px_need - n_px_have);
- }
- } else {
-#define memset_val(c, val, num) do { \
- if (bytesperpixel == 1) { \
- memset((c), (val), (num)); \
- } else { \
- int n; \
- for (n = 0; n < (num); n++) { \
- AV_WN16A(&(c)[n * 2], (val)); \
- } \
- } \
-} while (0)
- memset_val(*a, (128 << (bpp - 8)) - 1, n_px_need);
- }
- if (edges[mode].needs_topleft) {
- if (have_left && have_top) {
-#define assign_bpp(c, i1, v, i2) do { \
- if (bytesperpixel == 1) { \
- (c)[(i1)] = (v)[(i2)]; \
- } else { \
- AV_COPY16(&(c)[(i1) * 2], &(v)[(i2) * 2]); \
- } \
-} while (0)
- assign_bpp(*a, -1, topleft, -1);
- } else {
-#define assign_val(c, i, v) do { \
- if (bytesperpixel == 1) { \
- (c)[(i)] = (v); \
- } else { \
- AV_WN16A(&(c)[(i) * 2], (v)); \
- } \
-} while (0)
- assign_val((*a), -1, (128 << (bpp - 8)) + (have_top ? +1 : -1));
- }
- }
- if (tx == TX_4X4 && edges[mode].needs_topright) {
- if (have_top && have_right &&
- n_px_need + n_px_need_tr <= n_px_have) {
- memcpy(&(*a)[4 * bytesperpixel], &top[4 * bytesperpixel], 4 * bytesperpixel);
- } else {
- memset_bpp(*a, 4, *a, 3, 4);
- }
- }
- }
- }
- if (edges[mode].needs_left) {
- if (have_left) {
- int n_px_need = 4 << tx, i, n_px_have = (((s->rows - row) << !ss_v) - y) * 4;
- uint8_t *dst = x == 0 ? dst_edge : dst_inner;
- ptrdiff_t stride = x == 0 ? stride_edge : stride_inner;
-
- if (edges[mode].invert_left) {
- if (n_px_need <= n_px_have) {
- for (i = 0; i < n_px_need; i++)
- assign_bpp(l, i, &dst[i * stride], -1);
- } else {
- for (i = 0; i < n_px_have; i++)
- assign_bpp(l, i, &dst[i * stride], -1);
- memset_bpp(l, n_px_have, l, n_px_have - 1, n_px_need - n_px_have);
- }
- } else {
- if (n_px_need <= n_px_have) {
- for (i = 0; i < n_px_need; i++)
- assign_bpp(l, n_px_need - 1 - i, &dst[i * stride], -1);
- } else {
- for (i = 0; i < n_px_have; i++)
- assign_bpp(l, n_px_need - 1 - i, &dst[i * stride], -1);
- memset_bpp(l, 0, l, n_px_need - n_px_have, n_px_need - n_px_have);
- }
- }
- } else {
- memset_val(l, (128 << (bpp - 8)) + 1, 4 << tx);
- }
- }
-
- return mode;
-}
-
-static av_always_inline void intra_recon(AVCodecContext *ctx, ptrdiff_t y_off,
- ptrdiff_t uv_off, int bytesperpixel)
-{
- VP9Context *s = ctx->priv_data;
- VP9Block *b = s->b;
- int row = s->row, col = s->col;
- int w4 = bwh_tab[1][b->bs][0] << 1, step1d = 1 << b->tx, n;
- int h4 = bwh_tab[1][b->bs][1] << 1, x, y, step = 1 << (b->tx * 2);
- int end_x = FFMIN(2 * (s->cols - col), w4);
- int end_y = FFMIN(2 * (s->rows - row), h4);
- int tx = 4 * s->s.h.lossless + b->tx, uvtx = b->uvtx + 4 * s->s.h.lossless;
- int uvstep1d = 1 << b->uvtx, p;
- uint8_t *dst = s->dst[0], *dst_r = s->s.frames[CUR_FRAME].tf.f->data[0] + y_off;
- LOCAL_ALIGNED_32(uint8_t, a_buf, [96]);
- LOCAL_ALIGNED_32(uint8_t, l, [64]);
-
- for (n = 0, y = 0; y < end_y; y += step1d) {
- uint8_t *ptr = dst, *ptr_r = dst_r;
- for (x = 0; x < end_x; x += step1d, ptr += 4 * step1d * bytesperpixel,
- ptr_r += 4 * step1d * bytesperpixel, n += step) {
- int mode = b->mode[b->bs > BS_8x8 && b->tx == TX_4X4 ?
- y * 2 + x : 0];
- uint8_t *a = &a_buf[32];
- enum TxfmType txtp = vp9_intra_txfm_type[mode];
- int eob = b->skip ? 0 : b->tx > TX_8X8 ? AV_RN16A(&s->eob[n]) : s->eob[n];
-
- mode = check_intra_mode(s, mode, &a, ptr_r,
- s->s.frames[CUR_FRAME].tf.f->linesize[0],
- ptr, s->y_stride, l,
- col, x, w4, row, y, b->tx, 0, 0, 0, bytesperpixel);
- s->dsp.intra_pred[b->tx][mode](ptr, s->y_stride, l, a);
- if (eob)
- s->dsp.itxfm_add[tx][txtp](ptr, s->y_stride,
- s->block + 16 * n * bytesperpixel, eob);
- }
- dst_r += 4 * step1d * s->s.frames[CUR_FRAME].tf.f->linesize[0];
- dst += 4 * step1d * s->y_stride;
- }
-
- // U/V
- w4 >>= s->ss_h;
- end_x >>= s->ss_h;
- end_y >>= s->ss_v;
- step = 1 << (b->uvtx * 2);
- for (p = 0; p < 2; p++) {
- dst = s->dst[1 + p];
- dst_r = s->s.frames[CUR_FRAME].tf.f->data[1 + p] + uv_off;
- for (n = 0, y = 0; y < end_y; y += uvstep1d) {
- uint8_t *ptr = dst, *ptr_r = dst_r;
- for (x = 0; x < end_x; x += uvstep1d, ptr += 4 * uvstep1d * bytesperpixel,
- ptr_r += 4 * uvstep1d * bytesperpixel, n += step) {
- int mode = b->uvmode;
- uint8_t *a = &a_buf[32];
- int eob = b->skip ? 0 : b->uvtx > TX_8X8 ? AV_RN16A(&s->uveob[p][n]) : s->uveob[p][n];
-
- mode = check_intra_mode(s, mode, &a, ptr_r,
- s->s.frames[CUR_FRAME].tf.f->linesize[1],
- ptr, s->uv_stride, l, col, x, w4, row, y,
- b->uvtx, p + 1, s->ss_h, s->ss_v, bytesperpixel);
- s->dsp.intra_pred[b->uvtx][mode](ptr, s->uv_stride, l, a);
- if (eob)
- s->dsp.itxfm_add[uvtx][DCT_DCT](ptr, s->uv_stride,
- s->uvblock[p] + 16 * n * bytesperpixel, eob);
- }
- dst_r += 4 * uvstep1d * s->s.frames[CUR_FRAME].tf.f->linesize[1];
- dst += 4 * uvstep1d * s->uv_stride;
- }
- }
-}
-
-static void intra_recon_8bpp(AVCodecContext *ctx, ptrdiff_t y_off, ptrdiff_t uv_off)
-{
- intra_recon(ctx, y_off, uv_off, 1);
-}
-
-static void intra_recon_16bpp(AVCodecContext *ctx, ptrdiff_t y_off, ptrdiff_t uv_off)
-{
- intra_recon(ctx, y_off, uv_off, 2);
-}
-
-static av_always_inline void mc_luma_unscaled(VP9Context *s, vp9_mc_func (*mc)[2],
- uint8_t *dst, ptrdiff_t dst_stride,
- const uint8_t *ref, ptrdiff_t ref_stride,
- ThreadFrame *ref_frame,
- ptrdiff_t y, ptrdiff_t x, const VP56mv *mv,
- int bw, int bh, int w, int h, int bytesperpixel)
-{
- int mx = mv->x, my = mv->y, th;
-
- y += my >> 3;
- x += mx >> 3;
- ref += y * ref_stride + x * bytesperpixel;
- mx &= 7;
- my &= 7;
- // FIXME bilinear filter only needs 0/1 pixels, not 3/4
- // we use +7 because the last 7 pixels of each sbrow can be changed in
- // the longest loopfilter of the next sbrow
- th = (y + bh + 4 * !!my + 7) >> 6;
- ff_thread_await_progress(ref_frame, FFMAX(th, 0), 0);
- if (x < !!mx * 3 || y < !!my * 3 ||
- x + !!mx * 4 > w - bw || y + !!my * 4 > h - bh) {
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer,
- ref - !!my * 3 * ref_stride - !!mx * 3 * bytesperpixel,
- 160, ref_stride,
- bw + !!mx * 7, bh + !!my * 7,
- x - !!mx * 3, y - !!my * 3, w, h);
- ref = s->edge_emu_buffer + !!my * 3 * 160 + !!mx * 3 * bytesperpixel;
- ref_stride = 160;
- }
- mc[!!mx][!!my](dst, dst_stride, ref, ref_stride, bh, mx << 1, my << 1);
-}
-
-static av_always_inline void mc_chroma_unscaled(VP9Context *s, vp9_mc_func (*mc)[2],
- uint8_t *dst_u, uint8_t *dst_v,
- ptrdiff_t dst_stride,
- const uint8_t *ref_u, ptrdiff_t src_stride_u,
- const uint8_t *ref_v, ptrdiff_t src_stride_v,
- ThreadFrame *ref_frame,
- ptrdiff_t y, ptrdiff_t x, const VP56mv *mv,
- int bw, int bh, int w, int h, int bytesperpixel)
-{
- int mx = mv->x * (1 << !s->ss_h), my = mv->y * (1 << !s->ss_v), th;
-
- y += my >> 4;
- x += mx >> 4;
- ref_u += y * src_stride_u + x * bytesperpixel;
- ref_v += y * src_stride_v + x * bytesperpixel;
- mx &= 15;
- my &= 15;
- // FIXME bilinear filter only needs 0/1 pixels, not 3/4
- // we use +7 because the last 7 pixels of each sbrow can be changed in
- // the longest loopfilter of the next sbrow
- th = (y + bh + 4 * !!my + 7) >> (6 - s->ss_v);
- ff_thread_await_progress(ref_frame, FFMAX(th, 0), 0);
- if (x < !!mx * 3 || y < !!my * 3 ||
- x + !!mx * 4 > w - bw || y + !!my * 4 > h - bh) {
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer,
- ref_u - !!my * 3 * src_stride_u - !!mx * 3 * bytesperpixel,
- 160, src_stride_u,
- bw + !!mx * 7, bh + !!my * 7,
- x - !!mx * 3, y - !!my * 3, w, h);
- ref_u = s->edge_emu_buffer + !!my * 3 * 160 + !!mx * 3 * bytesperpixel;
- mc[!!mx][!!my](dst_u, dst_stride, ref_u, 160, bh, mx, my);
-
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer,
- ref_v - !!my * 3 * src_stride_v - !!mx * 3 * bytesperpixel,
- 160, src_stride_v,
- bw + !!mx * 7, bh + !!my * 7,
- x - !!mx * 3, y - !!my * 3, w, h);
- ref_v = s->edge_emu_buffer + !!my * 3 * 160 + !!mx * 3 * bytesperpixel;
- mc[!!mx][!!my](dst_v, dst_stride, ref_v, 160, bh, mx, my);
- } else {
- mc[!!mx][!!my](dst_u, dst_stride, ref_u, src_stride_u, bh, mx, my);
- mc[!!mx][!!my](dst_v, dst_stride, ref_v, src_stride_v, bh, mx, my);
- }
-}
-
-#define mc_luma_dir(s, mc, dst, dst_ls, src, src_ls, tref, row, col, mv, \
- px, py, pw, ph, bw, bh, w, h, i) \
- mc_luma_unscaled(s, s->dsp.mc, dst, dst_ls, src, src_ls, tref, row, col, \
- mv, bw, bh, w, h, bytesperpixel)
-#define mc_chroma_dir(s, mc, dstu, dstv, dst_ls, srcu, srcu_ls, srcv, srcv_ls, tref, \
- row, col, mv, px, py, pw, ph, bw, bh, w, h, i) \
- mc_chroma_unscaled(s, s->dsp.mc, dstu, dstv, dst_ls, srcu, srcu_ls, srcv, srcv_ls, tref, \
- row, col, mv, bw, bh, w, h, bytesperpixel)
-#define SCALED 0
-#define FN(x) x##_8bpp
-#define BYTES_PER_PIXEL 1
-#include "vp9_mc_template.c"
-#undef FN
-#undef BYTES_PER_PIXEL
-#define FN(x) x##_16bpp
-#define BYTES_PER_PIXEL 2
-#include "vp9_mc_template.c"
-#undef mc_luma_dir
-#undef mc_chroma_dir
-#undef FN
-#undef BYTES_PER_PIXEL
-#undef SCALED
-
-static av_always_inline void mc_luma_scaled(VP9Context *s, vp9_scaled_mc_func smc,
- vp9_mc_func (*mc)[2],
- uint8_t *dst, ptrdiff_t dst_stride,
- const uint8_t *ref, ptrdiff_t ref_stride,
- ThreadFrame *ref_frame,
- ptrdiff_t y, ptrdiff_t x, const VP56mv *in_mv,
- int px, int py, int pw, int ph,
- int bw, int bh, int w, int h, int bytesperpixel,
- const uint16_t *scale, const uint8_t *step)
-{
- if (s->s.frames[CUR_FRAME].tf.f->width == ref_frame->f->width &&
- s->s.frames[CUR_FRAME].tf.f->height == ref_frame->f->height) {
- mc_luma_unscaled(s, mc, dst, dst_stride, ref, ref_stride, ref_frame,
- y, x, in_mv, bw, bh, w, h, bytesperpixel);
- } else {
-#define scale_mv(n, dim) (((int64_t)(n) * scale[dim]) >> 14)
- int mx, my;
- int refbw_m1, refbh_m1;
- int th;
- VP56mv mv;
-
- mv.x = av_clip(in_mv->x, -(x + pw - px + 4) * 8, (s->cols * 8 - x + px + 3) * 8);
- mv.y = av_clip(in_mv->y, -(y + ph - py + 4) * 8, (s->rows * 8 - y + py + 3) * 8);
- // BUG libvpx seems to scale the two components separately. This introduces
- // rounding errors but we have to reproduce them to be exactly compatible
- // with the output from libvpx...
- mx = scale_mv(mv.x * 2, 0) + scale_mv(x * 16, 0);
- my = scale_mv(mv.y * 2, 1) + scale_mv(y * 16, 1);
-
- y = my >> 4;
- x = mx >> 4;
- ref += y * ref_stride + x * bytesperpixel;
- mx &= 15;
- my &= 15;
- refbw_m1 = ((bw - 1) * step[0] + mx) >> 4;
- refbh_m1 = ((bh - 1) * step[1] + my) >> 4;
- // FIXME bilinear filter only needs 0/1 pixels, not 3/4
- // we use +7 because the last 7 pixels of each sbrow can be changed in
- // the longest loopfilter of the next sbrow
- th = (y + refbh_m1 + 4 + 7) >> 6;
- ff_thread_await_progress(ref_frame, FFMAX(th, 0), 0);
- if (x < 3 || y < 3 || x + 4 >= w - refbw_m1 || y + 4 >= h - refbh_m1) {
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer,
- ref - 3 * ref_stride - 3 * bytesperpixel,
- 288, ref_stride,
- refbw_m1 + 8, refbh_m1 + 8,
- x - 3, y - 3, w, h);
- ref = s->edge_emu_buffer + 3 * 288 + 3 * bytesperpixel;
- ref_stride = 288;
- }
- smc(dst, dst_stride, ref, ref_stride, bh, mx, my, step[0], step[1]);
- }
-}
-
-static av_always_inline void mc_chroma_scaled(VP9Context *s, vp9_scaled_mc_func smc,
- vp9_mc_func (*mc)[2],
- uint8_t *dst_u, uint8_t *dst_v,
- ptrdiff_t dst_stride,
- const uint8_t *ref_u, ptrdiff_t src_stride_u,
- const uint8_t *ref_v, ptrdiff_t src_stride_v,
- ThreadFrame *ref_frame,
- ptrdiff_t y, ptrdiff_t x, const VP56mv *in_mv,
- int px, int py, int pw, int ph,
- int bw, int bh, int w, int h, int bytesperpixel,
- const uint16_t *scale, const uint8_t *step)
-{
- if (s->s.frames[CUR_FRAME].tf.f->width == ref_frame->f->width &&
- s->s.frames[CUR_FRAME].tf.f->height == ref_frame->f->height) {
- mc_chroma_unscaled(s, mc, dst_u, dst_v, dst_stride, ref_u, src_stride_u,
- ref_v, src_stride_v, ref_frame,
- y, x, in_mv, bw, bh, w, h, bytesperpixel);
- } else {
- int mx, my;
- int refbw_m1, refbh_m1;
- int th;
- VP56mv mv;
-
- if (s->ss_h) {
- // BUG https://code.google.com/p/webm/issues/detail?id=820
- mv.x = av_clip(in_mv->x, -(x + pw - px + 4) * 16, (s->cols * 4 - x + px + 3) * 16);
- mx = scale_mv(mv.x, 0) + (scale_mv(x * 16, 0) & ~15) + (scale_mv(x * 32, 0) & 15);
- } else {
- mv.x = av_clip(in_mv->x, -(x + pw - px + 4) * 8, (s->cols * 8 - x + px + 3) * 8);
- mx = scale_mv(mv.x * 2, 0) + scale_mv(x * 16, 0);
- }
- if (s->ss_v) {
- // BUG https://code.google.com/p/webm/issues/detail?id=820
- mv.y = av_clip(in_mv->y, -(y + ph - py + 4) * 16, (s->rows * 4 - y + py + 3) * 16);
- my = scale_mv(mv.y, 1) + (scale_mv(y * 16, 1) & ~15) + (scale_mv(y * 32, 1) & 15);
- } else {
- mv.y = av_clip(in_mv->y, -(y + ph - py + 4) * 8, (s->rows * 8 - y + py + 3) * 8);
- my = scale_mv(mv.y * 2, 1) + scale_mv(y * 16, 1);
- }
-#undef scale_mv
- y = my >> 4;
- x = mx >> 4;
- ref_u += y * src_stride_u + x * bytesperpixel;
- ref_v += y * src_stride_v + x * bytesperpixel;
- mx &= 15;
- my &= 15;
- refbw_m1 = ((bw - 1) * step[0] + mx) >> 4;
- refbh_m1 = ((bh - 1) * step[1] + my) >> 4;
- // FIXME bilinear filter only needs 0/1 pixels, not 3/4
- // we use +7 because the last 7 pixels of each sbrow can be changed in
- // the longest loopfilter of the next sbrow
- th = (y + refbh_m1 + 4 + 7) >> (6 - s->ss_v);
- ff_thread_await_progress(ref_frame, FFMAX(th, 0), 0);
- if (x < 3 || y < 3 || x + 4 >= w - refbw_m1 || y + 4 >= h - refbh_m1) {
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer,
- ref_u - 3 * src_stride_u - 3 * bytesperpixel,
- 288, src_stride_u,
- refbw_m1 + 8, refbh_m1 + 8,
- x - 3, y - 3, w, h);
- ref_u = s->edge_emu_buffer + 3 * 288 + 3 * bytesperpixel;
- smc(dst_u, dst_stride, ref_u, 288, bh, mx, my, step[0], step[1]);
-
- s->vdsp.emulated_edge_mc(s->edge_emu_buffer,
- ref_v - 3 * src_stride_v - 3 * bytesperpixel,
- 288, src_stride_v,
- refbw_m1 + 8, refbh_m1 + 8,
- x - 3, y - 3, w, h);
- ref_v = s->edge_emu_buffer + 3 * 288 + 3 * bytesperpixel;
- smc(dst_v, dst_stride, ref_v, 288, bh, mx, my, step[0], step[1]);
- } else {
- smc(dst_u, dst_stride, ref_u, src_stride_u, bh, mx, my, step[0], step[1]);
- smc(dst_v, dst_stride, ref_v, src_stride_v, bh, mx, my, step[0], step[1]);
- }
- }
-}
-
-#define mc_luma_dir(s, mc, dst, dst_ls, src, src_ls, tref, row, col, mv, \
- px, py, pw, ph, bw, bh, w, h, i) \
- mc_luma_scaled(s, s->dsp.s##mc, s->dsp.mc, dst, dst_ls, src, src_ls, tref, row, col, \
- mv, px, py, pw, ph, bw, bh, w, h, bytesperpixel, \
- s->mvscale[b->ref[i]], s->mvstep[b->ref[i]])
-#define mc_chroma_dir(s, mc, dstu, dstv, dst_ls, srcu, srcu_ls, srcv, srcv_ls, tref, \
- row, col, mv, px, py, pw, ph, bw, bh, w, h, i) \
- mc_chroma_scaled(s, s->dsp.s##mc, s->dsp.mc, dstu, dstv, dst_ls, srcu, srcu_ls, srcv, srcv_ls, tref, \
- row, col, mv, px, py, pw, ph, bw, bh, w, h, bytesperpixel, \
- s->mvscale[b->ref[i]], s->mvstep[b->ref[i]])
-#define SCALED 1
-#define FN(x) x##_scaled_8bpp
-#define BYTES_PER_PIXEL 1
-#include "vp9_mc_template.c"
-#undef FN
-#undef BYTES_PER_PIXEL
-#define FN(x) x##_scaled_16bpp
-#define BYTES_PER_PIXEL 2
-#include "vp9_mc_template.c"
-#undef mc_luma_dir
-#undef mc_chroma_dir
-#undef FN
-#undef BYTES_PER_PIXEL
-#undef SCALED
-
-static av_always_inline void inter_recon(AVCodecContext *ctx, int bytesperpixel)
-{
- VP9Context *s = ctx->priv_data;
- VP9Block *b = s->b;
- int row = s->row, col = s->col;
-
- if (s->mvscale[b->ref[0]][0] || (b->comp && s->mvscale[b->ref[1]][0])) {
- if (bytesperpixel == 1) {
- inter_pred_scaled_8bpp(ctx);
- } else {
- inter_pred_scaled_16bpp(ctx);
- }
- } else {
- if (bytesperpixel == 1) {
- inter_pred_8bpp(ctx);
- } else {
- inter_pred_16bpp(ctx);
- }
- }
- if (!b->skip) {
- /* mostly copied intra_recon() */
-
- int w4 = bwh_tab[1][b->bs][0] << 1, step1d = 1 << b->tx, n;
- int h4 = bwh_tab[1][b->bs][1] << 1, x, y, step = 1 << (b->tx * 2);
- int end_x = FFMIN(2 * (s->cols - col), w4);
- int end_y = FFMIN(2 * (s->rows - row), h4);
- int tx = 4 * s->s.h.lossless + b->tx, uvtx = b->uvtx + 4 * s->s.h.lossless;
- int uvstep1d = 1 << b->uvtx, p;
- uint8_t *dst = s->dst[0];
-
- // y itxfm add
- for (n = 0, y = 0; y < end_y; y += step1d) {
- uint8_t *ptr = dst;
- for (x = 0; x < end_x; x += step1d,
- ptr += 4 * step1d * bytesperpixel, n += step) {
- int eob = b->tx > TX_8X8 ? AV_RN16A(&s->eob[n]) : s->eob[n];
-
- if (eob)
- s->dsp.itxfm_add[tx][DCT_DCT](ptr, s->y_stride,
- s->block + 16 * n * bytesperpixel, eob);
- }
- dst += 4 * s->y_stride * step1d;
- }
-
- // uv itxfm add
- end_x >>= s->ss_h;
- end_y >>= s->ss_v;
- step = 1 << (b->uvtx * 2);
- for (p = 0; p < 2; p++) {
- dst = s->dst[p + 1];
- for (n = 0, y = 0; y < end_y; y += uvstep1d) {
- uint8_t *ptr = dst;
- for (x = 0; x < end_x; x += uvstep1d,
- ptr += 4 * uvstep1d * bytesperpixel, n += step) {
- int eob = b->uvtx > TX_8X8 ? AV_RN16A(&s->uveob[p][n]) : s->uveob[p][n];
-
- if (eob)
- s->dsp.itxfm_add[uvtx][DCT_DCT](ptr, s->uv_stride,
- s->uvblock[p] + 16 * n * bytesperpixel, eob);
- }
- dst += 4 * uvstep1d * s->uv_stride;
- }
- }
- }
-}
-
-static void inter_recon_8bpp(AVCodecContext *ctx)
-{
- inter_recon(ctx, 1);
-}
-
-static void inter_recon_16bpp(AVCodecContext *ctx)
-{
- inter_recon(ctx, 2);
-}
-
-static av_always_inline void mask_edges(uint8_t (*mask)[8][4], int ss_h, int ss_v,
- int row_and_7, int col_and_7,
- int w, int h, int col_end, int row_end,
- enum TxfmMode tx, int skip_inter)
-{
- static const unsigned wide_filter_col_mask[2] = { 0x11, 0x01 };
- static const unsigned wide_filter_row_mask[2] = { 0x03, 0x07 };
-
- // FIXME I'm pretty sure all loops can be replaced by a single LUT if
- // we make VP9Filter.mask uint64_t (i.e. row/col all single variable)
- // and make the LUT 5-indexed (bl, bp, is_uv, tx and row/col), and then
- // use row_and_7/col_and_7 as shifts (1*col_and_7+8*row_and_7)
-
- // the intended behaviour of the vp9 loopfilter is to work on 8-pixel
- // edges. This means that for UV, we work on two subsampled blocks at
- // a time, and we only use the topleft block's mode information to set
- // things like block strength. Thus, for any block size smaller than
- // 16x16, ignore the odd portion of the block.
- if (tx == TX_4X4 && (ss_v | ss_h)) {
- if (h == ss_v) {
- if (row_and_7 & 1)
- return;
- if (!row_end)
- h += 1;
- }
- if (w == ss_h) {
- if (col_and_7 & 1)
- return;
- if (!col_end)
- w += 1;
- }
- }
-
- if (tx == TX_4X4 && !skip_inter) {
- int t = 1 << col_and_7, m_col = (t << w) - t, y;
- // on 32-px edges, use the 8-px wide loopfilter; else, use 4-px wide
- int m_row_8 = m_col & wide_filter_col_mask[ss_h], m_row_4 = m_col - m_row_8;
-
- for (y = row_and_7; y < h + row_and_7; y++) {
- int col_mask_id = 2 - !(y & wide_filter_row_mask[ss_v]);
-
- mask[0][y][1] |= m_row_8;
- mask[0][y][2] |= m_row_4;
- // for odd lines, if the odd col is not being filtered,
- // skip odd row also:
- // .---. <-- a
- // | |
- // |___| <-- b
- // ^ ^
- // c d
- //
- // if a/c are even row/col and b/d are odd, and d is skipped,
- // e.g. right edge of size-66x66.webm, then skip b also (bug)
- if ((ss_h & ss_v) && (col_end & 1) && (y & 1)) {
- mask[1][y][col_mask_id] |= (t << (w - 1)) - t;
- } else {
- mask[1][y][col_mask_id] |= m_col;
- }
- if (!ss_h)
- mask[0][y][3] |= m_col;
- if (!ss_v) {
- if (ss_h && (col_end & 1))
- mask[1][y][3] |= (t << (w - 1)) - t;
- else
- mask[1][y][3] |= m_col;
- }
- }
- } else {
- int y, t = 1 << col_and_7, m_col = (t << w) - t;
-
- if (!skip_inter) {
- int mask_id = (tx == TX_8X8);
- static const unsigned masks[4] = { 0xff, 0x55, 0x11, 0x01 };
- int l2 = tx + ss_h - 1, step1d;
- int m_row = m_col & masks[l2];
-
- // at odd UV col/row edges tx16/tx32 loopfilter edges, force
- // 8wd loopfilter to prevent going off the visible edge.
- if (ss_h && tx > TX_8X8 && (w ^ (w - 1)) == 1) {
- int m_row_16 = ((t << (w - 1)) - t) & masks[l2];
- int m_row_8 = m_row - m_row_16;
-
- for (y = row_and_7; y < h + row_and_7; y++) {
- mask[0][y][0] |= m_row_16;
- mask[0][y][1] |= m_row_8;
- }
- } else {
- for (y = row_and_7; y < h + row_and_7; y++)
- mask[0][y][mask_id] |= m_row;
- }
-
- l2 = tx + ss_v - 1;
- step1d = 1 << l2;
- if (ss_v && tx > TX_8X8 && (h ^ (h - 1)) == 1) {
- for (y = row_and_7; y < h + row_and_7 - 1; y += step1d)
- mask[1][y][0] |= m_col;
- if (y - row_and_7 == h - 1)
- mask[1][y][1] |= m_col;
- } else {
- for (y = row_and_7; y < h + row_and_7; y += step1d)
- mask[1][y][mask_id] |= m_col;
- }
- } else if (tx != TX_4X4) {
- int mask_id;
-
- mask_id = (tx == TX_8X8) || (h == ss_v);
- mask[1][row_and_7][mask_id] |= m_col;
- mask_id = (tx == TX_8X8) || (w == ss_h);
- for (y = row_and_7; y < h + row_and_7; y++)
- mask[0][y][mask_id] |= t;
- } else {
- int t8 = t & wide_filter_col_mask[ss_h], t4 = t - t8;
-
- for (y = row_and_7; y < h + row_and_7; y++) {
- mask[0][y][2] |= t4;
- mask[0][y][1] |= t8;
- }
- mask[1][row_and_7][2 - !(row_and_7 & wide_filter_row_mask[ss_v])] |= m_col;
- }
- }
-}
-
-static void decode_b(AVCodecContext *ctx, int row, int col,
- struct VP9Filter *lflvl, ptrdiff_t yoff, ptrdiff_t uvoff,
- enum BlockLevel bl, enum BlockPartition bp)
-{
- VP9Context *s = ctx->priv_data;
- VP9Block *b = s->b;
- enum BlockSize bs = bl * 3 + bp;
- int bytesperpixel = s->bytesperpixel;
- int w4 = bwh_tab[1][bs][0], h4 = bwh_tab[1][bs][1], lvl;
- int emu[2];
- AVFrame *f = s->s.frames[CUR_FRAME].tf.f;
-
- s->row = row;
- s->row7 = row & 7;
- s->col = col;
- s->col7 = col & 7;
- s->min_mv.x = -(128 + col * 64);
- s->min_mv.y = -(128 + row * 64);
- s->max_mv.x = 128 + (s->cols - col - w4) * 64;
- s->max_mv.y = 128 + (s->rows - row - h4) * 64;
- if (s->pass < 2) {
- b->bs = bs;
- b->bl = bl;
- b->bp = bp;
- decode_mode(ctx);
- b->uvtx = b->tx - ((s->ss_h && w4 * 2 == (1 << b->tx)) ||
- (s->ss_v && h4 * 2 == (1 << b->tx)));
-
- if (!b->skip) {
- int has_coeffs;
-
- if (bytesperpixel == 1) {
- has_coeffs = decode_coeffs_8bpp(ctx);
- } else {
- has_coeffs = decode_coeffs_16bpp(ctx);
- }
- if (!has_coeffs && b->bs <= BS_8x8 && !b->intra) {
- b->skip = 1;
- memset(&s->above_skip_ctx[col], 1, w4);
- memset(&s->left_skip_ctx[s->row7], 1, h4);
- }
- } else {
- int row7 = s->row7;
-
-#define SPLAT_ZERO_CTX(v, n) \
- switch (n) { \
- case 1: v = 0; break; \
- case 2: AV_ZERO16(&v); break; \
- case 4: AV_ZERO32(&v); break; \
- case 8: AV_ZERO64(&v); break; \
- case 16: AV_ZERO128(&v); break; \
- }
-#define SPLAT_ZERO_YUV(dir, var, off, n, dir2) \
- do { \
- SPLAT_ZERO_CTX(s->dir##_y_##var[off * 2], n * 2); \
- if (s->ss_##dir2) { \
- SPLAT_ZERO_CTX(s->dir##_uv_##var[0][off], n); \
- SPLAT_ZERO_CTX(s->dir##_uv_##var[1][off], n); \
- } else { \
- SPLAT_ZERO_CTX(s->dir##_uv_##var[0][off * 2], n * 2); \
- SPLAT_ZERO_CTX(s->dir##_uv_##var[1][off * 2], n * 2); \
- } \
- } while (0)
-
- switch (w4) {
- case 1: SPLAT_ZERO_YUV(above, nnz_ctx, col, 1, h); break;
- case 2: SPLAT_ZERO_YUV(above, nnz_ctx, col, 2, h); break;
- case 4: SPLAT_ZERO_YUV(above, nnz_ctx, col, 4, h); break;
- case 8: SPLAT_ZERO_YUV(above, nnz_ctx, col, 8, h); break;
- }
- switch (h4) {
- case 1: SPLAT_ZERO_YUV(left, nnz_ctx, row7, 1, v); break;
- case 2: SPLAT_ZERO_YUV(left, nnz_ctx, row7, 2, v); break;
- case 4: SPLAT_ZERO_YUV(left, nnz_ctx, row7, 4, v); break;
- case 8: SPLAT_ZERO_YUV(left, nnz_ctx, row7, 8, v); break;
- }
- }
-
- if (s->pass == 1) {
- s->b++;
- s->block += w4 * h4 * 64 * bytesperpixel;
- s->uvblock[0] += w4 * h4 * 64 * bytesperpixel >> (s->ss_h + s->ss_v);
- s->uvblock[1] += w4 * h4 * 64 * bytesperpixel >> (s->ss_h + s->ss_v);
- s->eob += 4 * w4 * h4;
- s->uveob[0] += 4 * w4 * h4 >> (s->ss_h + s->ss_v);
- s->uveob[1] += 4 * w4 * h4 >> (s->ss_h + s->ss_v);
-
- return;
- }
- }
-
- // emulated overhangs if the stride of the target buffer can't hold. This
- // makes it possible to support emu-edge and so on even if we have large block
- // overhangs
- emu[0] = (col + w4) * 8 * bytesperpixel > f->linesize[0] ||
- (row + h4) > s->rows;
- emu[1] = ((col + w4) * 8 >> s->ss_h) * bytesperpixel > f->linesize[1] ||
- (row + h4) > s->rows;
- if (emu[0]) {
- s->dst[0] = s->tmp_y;
- s->y_stride = 128;
- } else {
- s->dst[0] = f->data[0] + yoff;
- s->y_stride = f->linesize[0];
- }
- if (emu[1]) {
- s->dst[1] = s->tmp_uv[0];
- s->dst[2] = s->tmp_uv[1];
- s->uv_stride = 128;
- } else {
- s->dst[1] = f->data[1] + uvoff;
- s->dst[2] = f->data[2] + uvoff;
- s->uv_stride = f->linesize[1];
- }
- if (b->intra) {
- if (s->bpp > 8) {
- intra_recon_16bpp(ctx, yoff, uvoff);
- } else {
- intra_recon_8bpp(ctx, yoff, uvoff);
- }
- } else {
- if (s->bpp > 8) {
- inter_recon_16bpp(ctx);
- } else {
- inter_recon_8bpp(ctx);
- }
- }
- if (emu[0]) {
- int w = FFMIN(s->cols - col, w4) * 8, h = FFMIN(s->rows - row, h4) * 8, n, o = 0;
-
- for (n = 0; o < w; n++) {
- int bw = 64 >> n;
-
- av_assert2(n <= 4);
- if (w & bw) {
- s->dsp.mc[n][0][0][0][0](f->data[0] + yoff + o * bytesperpixel, f->linesize[0],
- s->tmp_y + o * bytesperpixel, 128, h, 0, 0);
- o += bw;
- }
- }
- }
- if (emu[1]) {
- int w = FFMIN(s->cols - col, w4) * 8 >> s->ss_h;
- int h = FFMIN(s->rows - row, h4) * 8 >> s->ss_v, n, o = 0;
-
- for (n = s->ss_h; o < w; n++) {
- int bw = 64 >> n;
-
- av_assert2(n <= 4);
- if (w & bw) {
- s->dsp.mc[n][0][0][0][0](f->data[1] + uvoff + o * bytesperpixel, f->linesize[1],
- s->tmp_uv[0] + o * bytesperpixel, 128, h, 0, 0);
- s->dsp.mc[n][0][0][0][0](f->data[2] + uvoff + o * bytesperpixel, f->linesize[2],
- s->tmp_uv[1] + o * bytesperpixel, 128, h, 0, 0);
- o += bw;
- }
- }
- }
-
- // pick filter level and find edges to apply filter to
- if (s->s.h.filter.level &&
- (lvl = s->s.h.segmentation.feat[b->seg_id].lflvl[b->intra ? 0 : b->ref[0] + 1]
- [b->mode[3] != ZEROMV]) > 0) {
- int x_end = FFMIN(s->cols - col, w4), y_end = FFMIN(s->rows - row, h4);
- int skip_inter = !b->intra && b->skip, col7 = s->col7, row7 = s->row7;
-
- setctx_2d(&lflvl->level[row7 * 8 + col7], w4, h4, 8, lvl);
- mask_edges(lflvl->mask[0], 0, 0, row7, col7, x_end, y_end, 0, 0, b->tx, skip_inter);
- if (s->ss_h || s->ss_v)
- mask_edges(lflvl->mask[1], s->ss_h, s->ss_v, row7, col7, x_end, y_end,
- s->cols & 1 && col + w4 >= s->cols ? s->cols & 7 : 0,
- s->rows & 1 && row + h4 >= s->rows ? s->rows & 7 : 0,
- b->uvtx, skip_inter);
-
- if (!s->filter_lut.lim_lut[lvl]) {
- int sharp = s->s.h.filter.sharpness;
- int limit = lvl;
-
- if (sharp > 0) {
- limit >>= (sharp + 3) >> 2;
- limit = FFMIN(limit, 9 - sharp);
- }
- limit = FFMAX(limit, 1);
-
- s->filter_lut.lim_lut[lvl] = limit;
- s->filter_lut.mblim_lut[lvl] = 2 * (lvl + 2) + limit;
- }
- }
-
- if (s->pass == 2) {
- s->b++;
- s->block += w4 * h4 * 64 * bytesperpixel;
- s->uvblock[0] += w4 * h4 * 64 * bytesperpixel >> (s->ss_v + s->ss_h);
- s->uvblock[1] += w4 * h4 * 64 * bytesperpixel >> (s->ss_v + s->ss_h);
- s->eob += 4 * w4 * h4;
- s->uveob[0] += 4 * w4 * h4 >> (s->ss_v + s->ss_h);
- s->uveob[1] += 4 * w4 * h4 >> (s->ss_v + s->ss_h);
- }
-}
-
-static void decode_sb(AVCodecContext *ctx, int row, int col, struct VP9Filter *lflvl,
+static void decode_sb(VP9TileData *td, int row, int col, VP9Filter *lflvl,
ptrdiff_t yoff, ptrdiff_t uvoff, enum BlockLevel bl)
{
- VP9Context *s = ctx->priv_data;
+ const VP9Context *s = td->s;
int c = ((s->above_partition_ctx[col] >> (3 - bl)) & 1) |
- (((s->left_partition_ctx[row & 0x7] >> (3 - bl)) & 1) << 1);
- const uint8_t *p = s->s.h.keyframe || s->s.h.intraonly ? vp9_default_kf_partition_probs[bl][c] :
+ (((td->left_partition_ctx[row & 0x7] >> (3 - bl)) & 1) << 1);
+ const uint8_t *p = s->s.h.keyframe || s->s.h.intraonly ? ff_vp9_default_kf_partition_probs[bl][c] :
s->prob.p.partition[bl][c];
enum BlockPartition bp;
ptrdiff_t hbs = 4 >> bl;
@@ -3398,75 +1054,75 @@ static void decode_sb(AVCodecContext *ctx, int row, int col, struct VP9Filter *l
int bytesperpixel = s->bytesperpixel;
if (bl == BL_8X8) {
- bp = vp8_rac_get_tree(&s->c, vp9_partition_tree, p);
- decode_b(ctx, row, col, lflvl, yoff, uvoff, bl, bp);
+ bp = vp8_rac_get_tree(td->c, ff_vp9_partition_tree, p);
+ ff_vp9_decode_block(td, row, col, lflvl, yoff, uvoff, bl, bp);
} else if (col + hbs < s->cols) { // FIXME why not <=?
if (row + hbs < s->rows) { // FIXME why not <=?
- bp = vp8_rac_get_tree(&s->c, vp9_partition_tree, p);
+ bp = vp8_rac_get_tree(td->c, ff_vp9_partition_tree, p);
switch (bp) {
case PARTITION_NONE:
- decode_b(ctx, row, col, lflvl, yoff, uvoff, bl, bp);
+ ff_vp9_decode_block(td, row, col, lflvl, yoff, uvoff, bl, bp);
break;
case PARTITION_H:
- decode_b(ctx, row, col, lflvl, yoff, uvoff, bl, bp);
+ ff_vp9_decode_block(td, row, col, lflvl, yoff, uvoff, bl, bp);
yoff += hbs * 8 * y_stride;
uvoff += hbs * 8 * uv_stride >> s->ss_v;
- decode_b(ctx, row + hbs, col, lflvl, yoff, uvoff, bl, bp);
+ ff_vp9_decode_block(td, row + hbs, col, lflvl, yoff, uvoff, bl, bp);
break;
case PARTITION_V:
- decode_b(ctx, row, col, lflvl, yoff, uvoff, bl, bp);
+ ff_vp9_decode_block(td, row, col, lflvl, yoff, uvoff, bl, bp);
yoff += hbs * 8 * bytesperpixel;
uvoff += hbs * 8 * bytesperpixel >> s->ss_h;
- decode_b(ctx, row, col + hbs, lflvl, yoff, uvoff, bl, bp);
+ ff_vp9_decode_block(td, row, col + hbs, lflvl, yoff, uvoff, bl, bp);
break;
case PARTITION_SPLIT:
- decode_sb(ctx, row, col, lflvl, yoff, uvoff, bl + 1);
- decode_sb(ctx, row, col + hbs, lflvl,
+ decode_sb(td, row, col, lflvl, yoff, uvoff, bl + 1);
+ decode_sb(td, row, col + hbs, lflvl,
yoff + 8 * hbs * bytesperpixel,
uvoff + (8 * hbs * bytesperpixel >> s->ss_h), bl + 1);
yoff += hbs * 8 * y_stride;
uvoff += hbs * 8 * uv_stride >> s->ss_v;
- decode_sb(ctx, row + hbs, col, lflvl, yoff, uvoff, bl + 1);
- decode_sb(ctx, row + hbs, col + hbs, lflvl,
+ decode_sb(td, row + hbs, col, lflvl, yoff, uvoff, bl + 1);
+ decode_sb(td, row + hbs, col + hbs, lflvl,
yoff + 8 * hbs * bytesperpixel,
uvoff + (8 * hbs * bytesperpixel >> s->ss_h), bl + 1);
break;
default:
av_assert0(0);
}
- } else if (vp56_rac_get_prob_branchy(&s->c, p[1])) {
+ } else if (vp56_rac_get_prob_branchy(td->c, p[1])) {
bp = PARTITION_SPLIT;
- decode_sb(ctx, row, col, lflvl, yoff, uvoff, bl + 1);
- decode_sb(ctx, row, col + hbs, lflvl,
+ decode_sb(td, row, col, lflvl, yoff, uvoff, bl + 1);
+ decode_sb(td, row, col + hbs, lflvl,
yoff + 8 * hbs * bytesperpixel,
uvoff + (8 * hbs * bytesperpixel >> s->ss_h), bl + 1);
} else {
bp = PARTITION_H;
- decode_b(ctx, row, col, lflvl, yoff, uvoff, bl, bp);
+ ff_vp9_decode_block(td, row, col, lflvl, yoff, uvoff, bl, bp);
}
} else if (row + hbs < s->rows) { // FIXME why not <=?
- if (vp56_rac_get_prob_branchy(&s->c, p[2])) {
+ if (vp56_rac_get_prob_branchy(td->c, p[2])) {
bp = PARTITION_SPLIT;
- decode_sb(ctx, row, col, lflvl, yoff, uvoff, bl + 1);
+ decode_sb(td, row, col, lflvl, yoff, uvoff, bl + 1);
yoff += hbs * 8 * y_stride;
uvoff += hbs * 8 * uv_stride >> s->ss_v;
- decode_sb(ctx, row + hbs, col, lflvl, yoff, uvoff, bl + 1);
+ decode_sb(td, row + hbs, col, lflvl, yoff, uvoff, bl + 1);
} else {
bp = PARTITION_V;
- decode_b(ctx, row, col, lflvl, yoff, uvoff, bl, bp);
+ ff_vp9_decode_block(td, row, col, lflvl, yoff, uvoff, bl, bp);
}
} else {
bp = PARTITION_SPLIT;
- decode_sb(ctx, row, col, lflvl, yoff, uvoff, bl + 1);
+ decode_sb(td, row, col, lflvl, yoff, uvoff, bl + 1);
}
- s->counts.partition[bl][c][bp]++;
+ td->counts.partition[bl][c][bp]++;
}
-static void decode_sb_mem(AVCodecContext *ctx, int row, int col, struct VP9Filter *lflvl,
+static void decode_sb_mem(VP9TileData *td, int row, int col, VP9Filter *lflvl,
ptrdiff_t yoff, ptrdiff_t uvoff, enum BlockLevel bl)
{
- VP9Context *s = ctx->priv_data;
- VP9Block *b = s->b;
+ const VP9Context *s = td->s;
+ VP9Block *b = td->b;
ptrdiff_t hbs = 4 >> bl;
AVFrame *f = s->s.frames[CUR_FRAME].tf.f;
ptrdiff_t y_stride = f->linesize[0], uv_stride = f->linesize[1];
@@ -3474,221 +1130,43 @@ static void decode_sb_mem(AVCodecContext *ctx, int row, int col, struct VP9Filte
if (bl == BL_8X8) {
av_assert2(b->bl == BL_8X8);
- decode_b(ctx, row, col, lflvl, yoff, uvoff, b->bl, b->bp);
- } else if (s->b->bl == bl) {
- decode_b(ctx, row, col, lflvl, yoff, uvoff, b->bl, b->bp);
+ ff_vp9_decode_block(td, row, col, lflvl, yoff, uvoff, b->bl, b->bp);
+ } else if (td->b->bl == bl) {
+ ff_vp9_decode_block(td, row, col, lflvl, yoff, uvoff, b->bl, b->bp);
if (b->bp == PARTITION_H && row + hbs < s->rows) {
yoff += hbs * 8 * y_stride;
uvoff += hbs * 8 * uv_stride >> s->ss_v;
- decode_b(ctx, row + hbs, col, lflvl, yoff, uvoff, b->bl, b->bp);
+ ff_vp9_decode_block(td, row + hbs, col, lflvl, yoff, uvoff, b->bl, b->bp);
} else if (b->bp == PARTITION_V && col + hbs < s->cols) {
yoff += hbs * 8 * bytesperpixel;
uvoff += hbs * 8 * bytesperpixel >> s->ss_h;
- decode_b(ctx, row, col + hbs, lflvl, yoff, uvoff, b->bl, b->bp);
+ ff_vp9_decode_block(td, row, col + hbs, lflvl, yoff, uvoff, b->bl, b->bp);
}
} else {
- decode_sb_mem(ctx, row, col, lflvl, yoff, uvoff, bl + 1);
+ decode_sb_mem(td, row, col, lflvl, yoff, uvoff, bl + 1);
if (col + hbs < s->cols) { // FIXME why not <=?
if (row + hbs < s->rows) {
- decode_sb_mem(ctx, row, col + hbs, lflvl, yoff + 8 * hbs * bytesperpixel,
+ decode_sb_mem(td, row, col + hbs, lflvl, yoff + 8 * hbs * bytesperpixel,
uvoff + (8 * hbs * bytesperpixel >> s->ss_h), bl + 1);
yoff += hbs * 8 * y_stride;
uvoff += hbs * 8 * uv_stride >> s->ss_v;
- decode_sb_mem(ctx, row + hbs, col, lflvl, yoff, uvoff, bl + 1);
- decode_sb_mem(ctx, row + hbs, col + hbs, lflvl,
+ decode_sb_mem(td, row + hbs, col, lflvl, yoff, uvoff, bl + 1);
+ decode_sb_mem(td, row + hbs, col + hbs, lflvl,
yoff + 8 * hbs * bytesperpixel,
uvoff + (8 * hbs * bytesperpixel >> s->ss_h), bl + 1);
} else {
yoff += hbs * 8 * bytesperpixel;
uvoff += hbs * 8 * bytesperpixel >> s->ss_h;
- decode_sb_mem(ctx, row, col + hbs, lflvl, yoff, uvoff, bl + 1);
+ decode_sb_mem(td, row, col + hbs, lflvl, yoff, uvoff, bl + 1);
}
} else if (row + hbs < s->rows) {
yoff += hbs * 8 * y_stride;
uvoff += hbs * 8 * uv_stride >> s->ss_v;
- decode_sb_mem(ctx, row + hbs, col, lflvl, yoff, uvoff, bl + 1);
+ decode_sb_mem(td, row + hbs, col, lflvl, yoff, uvoff, bl + 1);
}
}
}
-static av_always_inline void filter_plane_cols(VP9Context *s, int col, int ss_h, int ss_v,
- uint8_t *lvl, uint8_t (*mask)[4],
- uint8_t *dst, ptrdiff_t ls)
-{
- int y, x, bytesperpixel = s->bytesperpixel;
-
- // filter edges between columns (e.g. block1 | block2)
- for (y = 0; y < 8; y += 2 << ss_v, dst += 16 * ls, lvl += 16 << ss_v) {
- uint8_t *ptr = dst, *l = lvl, *hmask1 = mask[y], *hmask2 = mask[y + 1 + ss_v];
- unsigned hm1 = hmask1[0] | hmask1[1] | hmask1[2], hm13 = hmask1[3];
- unsigned hm2 = hmask2[1] | hmask2[2], hm23 = hmask2[3];
- unsigned hm = hm1 | hm2 | hm13 | hm23;
-
- for (x = 1; hm & ~(x - 1); x <<= 1, ptr += 8 * bytesperpixel >> ss_h) {
- if (col || x > 1) {
- if (hm1 & x) {
- int L = *l, H = L >> 4;
- int E = s->filter_lut.mblim_lut[L], I = s->filter_lut.lim_lut[L];
-
- if (hmask1[0] & x) {
- if (hmask2[0] & x) {
- av_assert2(l[8 << ss_v] == L);
- s->dsp.loop_filter_16[0](ptr, ls, E, I, H);
- } else {
- s->dsp.loop_filter_8[2][0](ptr, ls, E, I, H);
- }
- } else if (hm2 & x) {
- L = l[8 << ss_v];
- H |= (L >> 4) << 8;
- E |= s->filter_lut.mblim_lut[L] << 8;
- I |= s->filter_lut.lim_lut[L] << 8;
- s->dsp.loop_filter_mix2[!!(hmask1[1] & x)]
- [!!(hmask2[1] & x)]
- [0](ptr, ls, E, I, H);
- } else {
- s->dsp.loop_filter_8[!!(hmask1[1] & x)]
- [0](ptr, ls, E, I, H);
- }
- } else if (hm2 & x) {
- int L = l[8 << ss_v], H = L >> 4;
- int E = s->filter_lut.mblim_lut[L], I = s->filter_lut.lim_lut[L];
-
- s->dsp.loop_filter_8[!!(hmask2[1] & x)]
- [0](ptr + 8 * ls, ls, E, I, H);
- }
- }
- if (ss_h) {
- if (x & 0xAA)
- l += 2;
- } else {
- if (hm13 & x) {
- int L = *l, H = L >> 4;
- int E = s->filter_lut.mblim_lut[L], I = s->filter_lut.lim_lut[L];
-
- if (hm23 & x) {
- L = l[8 << ss_v];
- H |= (L >> 4) << 8;
- E |= s->filter_lut.mblim_lut[L] << 8;
- I |= s->filter_lut.lim_lut[L] << 8;
- s->dsp.loop_filter_mix2[0][0][0](ptr + 4 * bytesperpixel, ls, E, I, H);
- } else {
- s->dsp.loop_filter_8[0][0](ptr + 4 * bytesperpixel, ls, E, I, H);
- }
- } else if (hm23 & x) {
- int L = l[8 << ss_v], H = L >> 4;
- int E = s->filter_lut.mblim_lut[L], I = s->filter_lut.lim_lut[L];
-
- s->dsp.loop_filter_8[0][0](ptr + 8 * ls + 4 * bytesperpixel, ls, E, I, H);
- }
- l++;
- }
- }
- }
-}
-
-static av_always_inline void filter_plane_rows(VP9Context *s, int row, int ss_h, int ss_v,
- uint8_t *lvl, uint8_t (*mask)[4],
- uint8_t *dst, ptrdiff_t ls)
-{
- int y, x, bytesperpixel = s->bytesperpixel;
-
- // block1
- // filter edges between rows (e.g. ------)
- // block2
- for (y = 0; y < 8; y++, dst += 8 * ls >> ss_v) {
- uint8_t *ptr = dst, *l = lvl, *vmask = mask[y];
- unsigned vm = vmask[0] | vmask[1] | vmask[2], vm3 = vmask[3];
-
- for (x = 1; vm & ~(x - 1); x <<= (2 << ss_h), ptr += 16 * bytesperpixel, l += 2 << ss_h) {
- if (row || y) {
- if (vm & x) {
- int L = *l, H = L >> 4;
- int E = s->filter_lut.mblim_lut[L], I = s->filter_lut.lim_lut[L];
-
- if (vmask[0] & x) {
- if (vmask[0] & (x << (1 + ss_h))) {
- av_assert2(l[1 + ss_h] == L);
- s->dsp.loop_filter_16[1](ptr, ls, E, I, H);
- } else {
- s->dsp.loop_filter_8[2][1](ptr, ls, E, I, H);
- }
- } else if (vm & (x << (1 + ss_h))) {
- L = l[1 + ss_h];
- H |= (L >> 4) << 8;
- E |= s->filter_lut.mblim_lut[L] << 8;
- I |= s->filter_lut.lim_lut[L] << 8;
- s->dsp.loop_filter_mix2[!!(vmask[1] & x)]
- [!!(vmask[1] & (x << (1 + ss_h)))]
- [1](ptr, ls, E, I, H);
- } else {
- s->dsp.loop_filter_8[!!(vmask[1] & x)]
- [1](ptr, ls, E, I, H);
- }
- } else if (vm & (x << (1 + ss_h))) {
- int L = l[1 + ss_h], H = L >> 4;
- int E = s->filter_lut.mblim_lut[L], I = s->filter_lut.lim_lut[L];
-
- s->dsp.loop_filter_8[!!(vmask[1] & (x << (1 + ss_h)))]
- [1](ptr + 8 * bytesperpixel, ls, E, I, H);
- }
- }
- if (!ss_v) {
- if (vm3 & x) {
- int L = *l, H = L >> 4;
- int E = s->filter_lut.mblim_lut[L], I = s->filter_lut.lim_lut[L];
-
- if (vm3 & (x << (1 + ss_h))) {
- L = l[1 + ss_h];
- H |= (L >> 4) << 8;
- E |= s->filter_lut.mblim_lut[L] << 8;
- I |= s->filter_lut.lim_lut[L] << 8;
- s->dsp.loop_filter_mix2[0][0][1](ptr + ls * 4, ls, E, I, H);
- } else {
- s->dsp.loop_filter_8[0][1](ptr + ls * 4, ls, E, I, H);
- }
- } else if (vm3 & (x << (1 + ss_h))) {
- int L = l[1 + ss_h], H = L >> 4;
- int E = s->filter_lut.mblim_lut[L], I = s->filter_lut.lim_lut[L];
-
- s->dsp.loop_filter_8[0][1](ptr + ls * 4 + 8 * bytesperpixel, ls, E, I, H);
- }
- }
- }
- if (ss_v) {
- if (y & 1)
- lvl += 16;
- } else {
- lvl += 8;
- }
- }
-}
-
-static void loopfilter_sb(AVCodecContext *ctx, struct VP9Filter *lflvl,
- int row, int col, ptrdiff_t yoff, ptrdiff_t uvoff)
-{
- VP9Context *s = ctx->priv_data;
- AVFrame *f = s->s.frames[CUR_FRAME].tf.f;
- uint8_t *dst = f->data[0] + yoff;
- ptrdiff_t ls_y = f->linesize[0], ls_uv = f->linesize[1];
- uint8_t (*uv_masks)[8][4] = lflvl->mask[s->ss_h | s->ss_v];
- int p;
-
- // FIXME in how far can we interleave the v/h loopfilter calls? E.g.
- // if you think of them as acting on a 8x8 block max, we can interleave
- // each v/h within the single x loop, but that only works if we work on
- // 8 pixel blocks, and we won't always do that (we want at least 16px
- // to use SSE2 optimizations, perhaps 32 for AVX2)
-
- filter_plane_cols(s, col, 0, 0, lflvl->level, lflvl->mask[0][0], dst, ls_y);
- filter_plane_rows(s, row, 0, 0, lflvl->level, lflvl->mask[0][1], dst, ls_y);
-
- for (p = 0; p < 2; p++) {
- dst = f->data[1 + p] + uvoff;
- filter_plane_cols(s, col, s->ss_h, s->ss_v, lflvl->level, uv_masks[0], dst, ls_uv);
- filter_plane_rows(s, row, s->ss_h, s->ss_v, lflvl->level, uv_masks[1], dst, ls_uv);
- }
-}
-
static void set_tile_offset(int *start, int *end, int idx, int log2_n, int n)
{
int sb_start = ( idx * n) >> log2_n;
@@ -3697,300 +1175,302 @@ static void set_tile_offset(int *start, int *end, int idx, int log2_n, int n)
*end = FFMIN(sb_end, n) << 3;
}
-static av_always_inline void adapt_prob(uint8_t *p, unsigned ct0, unsigned ct1,
- int max_count, int update_factor)
+static void free_buffers(VP9Context *s)
{
- unsigned ct = ct0 + ct1, p2, p1;
-
- if (!ct)
- return;
-
- update_factor = FASTDIV(update_factor * FFMIN(ct, max_count), max_count);
- p1 = *p;
- p2 = ((((int64_t) ct0) << 8) + (ct >> 1)) / ct;
- p2 = av_clip(p2, 1, 255);
+ int i;
- // (p1 * (256 - update_factor) + p2 * update_factor + 128) >> 8
- *p = p1 + (((p2 - p1) * update_factor + 128) >> 8);
+ av_freep(&s->intra_pred_data[0]);
+ for (i = 0; i < s->active_tile_cols; i++) {
+ av_freep(&s->td[i].b_base);
+ av_freep(&s->td[i].block_base);
+ }
}
-static void adapt_probs(VP9Context *s)
+static av_cold int vp9_decode_free(AVCodecContext *avctx)
{
- int i, j, k, l, m;
- prob_context *p = &s->prob_ctx[s->s.h.framectxid].p;
- int uf = (s->s.h.keyframe || s->s.h.intraonly || !s->last_keyframe) ? 112 : 128;
-
- // coefficients
- for (i = 0; i < 4; i++)
- for (j = 0; j < 2; j++)
- for (k = 0; k < 2; k++)
- for (l = 0; l < 6; l++)
- for (m = 0; m < 6; m++) {
- uint8_t *pp = s->prob_ctx[s->s.h.framectxid].coef[i][j][k][l][m];
- unsigned *e = s->counts.eob[i][j][k][l][m];
- unsigned *c = s->counts.coef[i][j][k][l][m];
-
- if (l == 0 && m >= 3) // dc only has 3 pt
- break;
-
- adapt_prob(&pp[0], e[0], e[1], 24, uf);
- adapt_prob(&pp[1], c[0], c[1] + c[2], 24, uf);
- adapt_prob(&pp[2], c[1], c[2], 24, uf);
- }
+ VP9Context *s = avctx->priv_data;
+ int i;
- if (s->s.h.keyframe || s->s.h.intraonly) {
- memcpy(p->skip, s->prob.p.skip, sizeof(p->skip));
- memcpy(p->tx32p, s->prob.p.tx32p, sizeof(p->tx32p));
- memcpy(p->tx16p, s->prob.p.tx16p, sizeof(p->tx16p));
- memcpy(p->tx8p, s->prob.p.tx8p, sizeof(p->tx8p));
- return;
+ for (i = 0; i < 3; i++) {
+ if (s->s.frames[i].tf.f->buf[0])
+ vp9_frame_unref(avctx, &s->s.frames[i]);
+ av_frame_free(&s->s.frames[i].tf.f);
+ }
+ for (i = 0; i < 8; i++) {
+ if (s->s.refs[i].f->buf[0])
+ ff_thread_release_buffer(avctx, &s->s.refs[i]);
+ av_frame_free(&s->s.refs[i].f);
+ if (s->next_refs[i].f->buf[0])
+ ff_thread_release_buffer(avctx, &s->next_refs[i]);
+ av_frame_free(&s->next_refs[i].f);
}
- // skip flag
- for (i = 0; i < 3; i++)
- adapt_prob(&p->skip[i], s->counts.skip[i][0], s->counts.skip[i][1], 20, 128);
+ free_buffers(s);
+ vp9_free_entries(avctx);
+ av_freep(&s->td);
+ return 0;
+}
- // intra/inter flag
- for (i = 0; i < 4; i++)
- adapt_prob(&p->intra[i], s->counts.intra[i][0], s->counts.intra[i][1], 20, 128);
+static int decode_tiles(AVCodecContext *avctx,
+ const uint8_t *data, int size)
+{
+ VP9Context *s = avctx->priv_data;
+ VP9TileData *td = &s->td[0];
+ int row, col, tile_row, tile_col, ret;
+ int bytesperpixel;
+ int tile_row_start, tile_row_end, tile_col_start, tile_col_end;
+ AVFrame *f;
+ ptrdiff_t yoff, uvoff, ls_y, ls_uv;
- // comppred flag
- if (s->s.h.comppredmode == PRED_SWITCHABLE) {
- for (i = 0; i < 5; i++)
- adapt_prob(&p->comp[i], s->counts.comp[i][0], s->counts.comp[i][1], 20, 128);
- }
+ f = s->s.frames[CUR_FRAME].tf.f;
+ ls_y = f->linesize[0];
+ ls_uv =f->linesize[1];
+ bytesperpixel = s->bytesperpixel;
- // reference frames
- if (s->s.h.comppredmode != PRED_SINGLEREF) {
- for (i = 0; i < 5; i++)
- adapt_prob(&p->comp_ref[i], s->counts.comp_ref[i][0],
- s->counts.comp_ref[i][1], 20, 128);
- }
+ yoff = uvoff = 0;
+ for (tile_row = 0; tile_row < s->s.h.tiling.tile_rows; tile_row++) {
+ set_tile_offset(&tile_row_start, &tile_row_end,
+ tile_row, s->s.h.tiling.log2_tile_rows, s->sb_rows);
- if (s->s.h.comppredmode != PRED_COMPREF) {
- for (i = 0; i < 5; i++) {
- uint8_t *pp = p->single_ref[i];
- unsigned (*c)[2] = s->counts.single_ref[i];
+ for (tile_col = 0; tile_col < s->s.h.tiling.tile_cols; tile_col++) {
+ int64_t tile_size;
- adapt_prob(&pp[0], c[0][0], c[0][1], 20, 128);
- adapt_prob(&pp[1], c[1][0], c[1][1], 20, 128);
- }
- }
+ if (tile_col == s->s.h.tiling.tile_cols - 1 &&
+ tile_row == s->s.h.tiling.tile_rows - 1) {
+ tile_size = size;
+ } else {
+ tile_size = AV_RB32(data);
+ data += 4;
+ size -= 4;
+ }
+ if (tile_size > size) {
+ ff_thread_report_progress(&s->s.frames[CUR_FRAME].tf, INT_MAX, 0);
+ return AVERROR_INVALIDDATA;
+ }
+ ret = ff_vp56_init_range_decoder(&td->c_b[tile_col], data, tile_size);
+ if (ret < 0)
+ return ret;
+ if (vp56_rac_get_prob_branchy(&td->c_b[tile_col], 128)) { // marker bit
+ ff_thread_report_progress(&s->s.frames[CUR_FRAME].tf, INT_MAX, 0);
+ return AVERROR_INVALIDDATA;
+ }
+ data += tile_size;
+ size -= tile_size;
+ }
- // block partitioning
- for (i = 0; i < 4; i++)
- for (j = 0; j < 4; j++) {
- uint8_t *pp = p->partition[i][j];
- unsigned *c = s->counts.partition[i][j];
+ for (row = tile_row_start; row < tile_row_end;
+ row += 8, yoff += ls_y * 64, uvoff += ls_uv * 64 >> s->ss_v) {
+ VP9Filter *lflvl_ptr = s->lflvl;
+ ptrdiff_t yoff2 = yoff, uvoff2 = uvoff;
- adapt_prob(&pp[0], c[0], c[1] + c[2] + c[3], 20, 128);
- adapt_prob(&pp[1], c[1], c[2] + c[3], 20, 128);
- adapt_prob(&pp[2], c[2], c[3], 20, 128);
- }
+ for (tile_col = 0; tile_col < s->s.h.tiling.tile_cols; tile_col++) {
+ set_tile_offset(&tile_col_start, &tile_col_end,
+ tile_col, s->s.h.tiling.log2_tile_cols, s->sb_cols);
+ td->tile_col_start = tile_col_start;
+ if (s->pass != 2) {
+ memset(td->left_partition_ctx, 0, 8);
+ memset(td->left_skip_ctx, 0, 8);
+ if (s->s.h.keyframe || s->s.h.intraonly) {
+ memset(td->left_mode_ctx, DC_PRED, 16);
+ } else {
+ memset(td->left_mode_ctx, NEARESTMV, 8);
+ }
+ memset(td->left_y_nnz_ctx, 0, 16);
+ memset(td->left_uv_nnz_ctx, 0, 32);
+ memset(td->left_segpred_ctx, 0, 8);
- // tx size
- if (s->s.h.txfmmode == TX_SWITCHABLE) {
- for (i = 0; i < 2; i++) {
- unsigned *c16 = s->counts.tx16p[i], *c32 = s->counts.tx32p[i];
-
- adapt_prob(&p->tx8p[i], s->counts.tx8p[i][0], s->counts.tx8p[i][1], 20, 128);
- adapt_prob(&p->tx16p[i][0], c16[0], c16[1] + c16[2], 20, 128);
- adapt_prob(&p->tx16p[i][1], c16[1], c16[2], 20, 128);
- adapt_prob(&p->tx32p[i][0], c32[0], c32[1] + c32[2] + c32[3], 20, 128);
- adapt_prob(&p->tx32p[i][1], c32[1], c32[2] + c32[3], 20, 128);
- adapt_prob(&p->tx32p[i][2], c32[2], c32[3], 20, 128);
- }
- }
+ td->c = &td->c_b[tile_col];
+ }
- // interpolation filter
- if (s->s.h.filtermode == FILTER_SWITCHABLE) {
- for (i = 0; i < 4; i++) {
- uint8_t *pp = p->filter[i];
- unsigned *c = s->counts.filter[i];
+ for (col = tile_col_start;
+ col < tile_col_end;
+ col += 8, yoff2 += 64 * bytesperpixel,
+ uvoff2 += 64 * bytesperpixel >> s->ss_h, lflvl_ptr++) {
+ // FIXME integrate with lf code (i.e. zero after each
+ // use, similar to invtxfm coefficients, or similar)
+ if (s->pass != 1) {
+ memset(lflvl_ptr->mask, 0, sizeof(lflvl_ptr->mask));
+ }
- adapt_prob(&pp[0], c[0], c[1] + c[2], 20, 128);
- adapt_prob(&pp[1], c[1], c[2], 20, 128);
- }
- }
+ if (s->pass == 2) {
+ decode_sb_mem(td, row, col, lflvl_ptr,
+ yoff2, uvoff2, BL_64X64);
+ } else {
+ decode_sb(td, row, col, lflvl_ptr,
+ yoff2, uvoff2, BL_64X64);
+ }
+ }
+ }
- // inter modes
- for (i = 0; i < 7; i++) {
- uint8_t *pp = p->mv_mode[i];
- unsigned *c = s->counts.mv_mode[i];
+ if (s->pass == 1)
+ continue;
+
+ // backup pre-loopfilter reconstruction data for intra
+ // prediction of next row of sb64s
+ if (row + 8 < s->rows) {
+ memcpy(s->intra_pred_data[0],
+ f->data[0] + yoff + 63 * ls_y,
+ 8 * s->cols * bytesperpixel);
+ memcpy(s->intra_pred_data[1],
+ f->data[1] + uvoff + ((64 >> s->ss_v) - 1) * ls_uv,
+ 8 * s->cols * bytesperpixel >> s->ss_h);
+ memcpy(s->intra_pred_data[2],
+ f->data[2] + uvoff + ((64 >> s->ss_v) - 1) * ls_uv,
+ 8 * s->cols * bytesperpixel >> s->ss_h);
+ }
+
+ // loopfilter one row
+ if (s->s.h.filter.level) {
+ yoff2 = yoff;
+ uvoff2 = uvoff;
+ lflvl_ptr = s->lflvl;
+ for (col = 0; col < s->cols;
+ col += 8, yoff2 += 64 * bytesperpixel,
+ uvoff2 += 64 * bytesperpixel >> s->ss_h, lflvl_ptr++) {
+ ff_vp9_loopfilter_sb(avctx, lflvl_ptr, row, col,
+ yoff2, uvoff2);
+ }
+ }
- adapt_prob(&pp[0], c[2], c[1] + c[0] + c[3], 20, 128);
- adapt_prob(&pp[1], c[0], c[1] + c[3], 20, 128);
- adapt_prob(&pp[2], c[1], c[3], 20, 128);
+ // FIXME maybe we can make this more finegrained by running the
+ // loopfilter per-block instead of after each sbrow
+ // In fact that would also make intra pred left preparation easier?
+ ff_thread_report_progress(&s->s.frames[CUR_FRAME].tf, row >> 3, 0);
+ }
}
+ return 0;
+}
- // mv joints
- {
- uint8_t *pp = p->mv_joint;
- unsigned *c = s->counts.mv_joint;
+#if HAVE_THREADS
+static av_always_inline
+int decode_tiles_mt(AVCodecContext *avctx, void *tdata, int jobnr,
+ int threadnr)
+{
+ VP9Context *s = avctx->priv_data;
+ VP9TileData *td = &s->td[jobnr];
+ ptrdiff_t uvoff, yoff, ls_y, ls_uv;
+ int bytesperpixel = s->bytesperpixel, row, col, tile_row;
+ unsigned tile_cols_len;
+ int tile_row_start, tile_row_end, tile_col_start, tile_col_end;
+ VP9Filter *lflvl_ptr_base;
+ AVFrame *f;
- adapt_prob(&pp[0], c[0], c[1] + c[2] + c[3], 20, 128);
- adapt_prob(&pp[1], c[1], c[2] + c[3], 20, 128);
- adapt_prob(&pp[2], c[2], c[3], 20, 128);
- }
+ f = s->s.frames[CUR_FRAME].tf.f;
+ ls_y = f->linesize[0];
+ ls_uv =f->linesize[1];
- // mv components
- for (i = 0; i < 2; i++) {
- uint8_t *pp;
- unsigned *c, (*c2)[2], sum;
-
- adapt_prob(&p->mv_comp[i].sign, s->counts.mv_comp[i].sign[0],
- s->counts.mv_comp[i].sign[1], 20, 128);
-
- pp = p->mv_comp[i].classes;
- c = s->counts.mv_comp[i].classes;
- sum = c[1] + c[2] + c[3] + c[4] + c[5] + c[6] + c[7] + c[8] + c[9] + c[10];
- adapt_prob(&pp[0], c[0], sum, 20, 128);
- sum -= c[1];
- adapt_prob(&pp[1], c[1], sum, 20, 128);
- sum -= c[2] + c[3];
- adapt_prob(&pp[2], c[2] + c[3], sum, 20, 128);
- adapt_prob(&pp[3], c[2], c[3], 20, 128);
- sum -= c[4] + c[5];
- adapt_prob(&pp[4], c[4] + c[5], sum, 20, 128);
- adapt_prob(&pp[5], c[4], c[5], 20, 128);
- sum -= c[6];
- adapt_prob(&pp[6], c[6], sum, 20, 128);
- adapt_prob(&pp[7], c[7] + c[8], c[9] + c[10], 20, 128);
- adapt_prob(&pp[8], c[7], c[8], 20, 128);
- adapt_prob(&pp[9], c[9], c[10], 20, 128);
-
- adapt_prob(&p->mv_comp[i].class0, s->counts.mv_comp[i].class0[0],
- s->counts.mv_comp[i].class0[1], 20, 128);
- pp = p->mv_comp[i].bits;
- c2 = s->counts.mv_comp[i].bits;
- for (j = 0; j < 10; j++)
- adapt_prob(&pp[j], c2[j][0], c2[j][1], 20, 128);
-
- for (j = 0; j < 2; j++) {
- pp = p->mv_comp[i].class0_fp[j];
- c = s->counts.mv_comp[i].class0_fp[j];
- adapt_prob(&pp[0], c[0], c[1] + c[2] + c[3], 20, 128);
- adapt_prob(&pp[1], c[1], c[2] + c[3], 20, 128);
- adapt_prob(&pp[2], c[2], c[3], 20, 128);
- }
- pp = p->mv_comp[i].fp;
- c = s->counts.mv_comp[i].fp;
- adapt_prob(&pp[0], c[0], c[1] + c[2] + c[3], 20, 128);
- adapt_prob(&pp[1], c[1], c[2] + c[3], 20, 128);
- adapt_prob(&pp[2], c[2], c[3], 20, 128);
+ set_tile_offset(&tile_col_start, &tile_col_end,
+ jobnr, s->s.h.tiling.log2_tile_cols, s->sb_cols);
+ td->tile_col_start = tile_col_start;
+ uvoff = (64 * bytesperpixel >> s->ss_h)*(tile_col_start >> 3);
+ yoff = (64 * bytesperpixel)*(tile_col_start >> 3);
+ lflvl_ptr_base = s->lflvl+(tile_col_start >> 3);
+
+ for (tile_row = 0; tile_row < s->s.h.tiling.tile_rows; tile_row++) {
+ set_tile_offset(&tile_row_start, &tile_row_end,
+ tile_row, s->s.h.tiling.log2_tile_rows, s->sb_rows);
+
+ td->c = &td->c_b[tile_row];
+ for (row = tile_row_start; row < tile_row_end;
+ row += 8, yoff += ls_y * 64, uvoff += ls_uv * 64 >> s->ss_v) {
+ ptrdiff_t yoff2 = yoff, uvoff2 = uvoff;
+ VP9Filter *lflvl_ptr = lflvl_ptr_base+s->sb_cols*(row >> 3);
+
+ memset(td->left_partition_ctx, 0, 8);
+ memset(td->left_skip_ctx, 0, 8);
+ if (s->s.h.keyframe || s->s.h.intraonly) {
+ memset(td->left_mode_ctx, DC_PRED, 16);
+ } else {
+ memset(td->left_mode_ctx, NEARESTMV, 8);
+ }
+ memset(td->left_y_nnz_ctx, 0, 16);
+ memset(td->left_uv_nnz_ctx, 0, 32);
+ memset(td->left_segpred_ctx, 0, 8);
- if (s->s.h.highprecisionmvs) {
- adapt_prob(&p->mv_comp[i].class0_hp, s->counts.mv_comp[i].class0_hp[0],
- s->counts.mv_comp[i].class0_hp[1], 20, 128);
- adapt_prob(&p->mv_comp[i].hp, s->counts.mv_comp[i].hp[0],
- s->counts.mv_comp[i].hp[1], 20, 128);
- }
- }
+ for (col = tile_col_start;
+ col < tile_col_end;
+ col += 8, yoff2 += 64 * bytesperpixel,
+ uvoff2 += 64 * bytesperpixel >> s->ss_h, lflvl_ptr++) {
+ // FIXME integrate with lf code (i.e. zero after each
+ // use, similar to invtxfm coefficients, or similar)
+ memset(lflvl_ptr->mask, 0, sizeof(lflvl_ptr->mask));
+ decode_sb(td, row, col, lflvl_ptr,
+ yoff2, uvoff2, BL_64X64);
+ }
- // y intra modes
- for (i = 0; i < 4; i++) {
- uint8_t *pp = p->y_mode[i];
- unsigned *c = s->counts.y_mode[i], sum, s2;
-
- sum = c[0] + c[1] + c[3] + c[4] + c[5] + c[6] + c[7] + c[8] + c[9];
- adapt_prob(&pp[0], c[DC_PRED], sum, 20, 128);
- sum -= c[TM_VP8_PRED];
- adapt_prob(&pp[1], c[TM_VP8_PRED], sum, 20, 128);
- sum -= c[VERT_PRED];
- adapt_prob(&pp[2], c[VERT_PRED], sum, 20, 128);
- s2 = c[HOR_PRED] + c[DIAG_DOWN_RIGHT_PRED] + c[VERT_RIGHT_PRED];
- sum -= s2;
- adapt_prob(&pp[3], s2, sum, 20, 128);
- s2 -= c[HOR_PRED];
- adapt_prob(&pp[4], c[HOR_PRED], s2, 20, 128);
- adapt_prob(&pp[5], c[DIAG_DOWN_RIGHT_PRED], c[VERT_RIGHT_PRED], 20, 128);
- sum -= c[DIAG_DOWN_LEFT_PRED];
- adapt_prob(&pp[6], c[DIAG_DOWN_LEFT_PRED], sum, 20, 128);
- sum -= c[VERT_LEFT_PRED];
- adapt_prob(&pp[7], c[VERT_LEFT_PRED], sum, 20, 128);
- adapt_prob(&pp[8], c[HOR_DOWN_PRED], c[HOR_UP_PRED], 20, 128);
- }
+ // backup pre-loopfilter reconstruction data for intra
+ // prediction of next row of sb64s
+ tile_cols_len = tile_col_end - tile_col_start;
+ if (row + 8 < s->rows) {
+ memcpy(s->intra_pred_data[0] + (tile_col_start * 8 * bytesperpixel),
+ f->data[0] + yoff + 63 * ls_y,
+ 8 * tile_cols_len * bytesperpixel);
+ memcpy(s->intra_pred_data[1] + (tile_col_start * 8 * bytesperpixel >> s->ss_h),
+ f->data[1] + uvoff + ((64 >> s->ss_v) - 1) * ls_uv,
+ 8 * tile_cols_len * bytesperpixel >> s->ss_h);
+ memcpy(s->intra_pred_data[2] + (tile_col_start * 8 * bytesperpixel >> s->ss_h),
+ f->data[2] + uvoff + ((64 >> s->ss_v) - 1) * ls_uv,
+ 8 * tile_cols_len * bytesperpixel >> s->ss_h);
+ }
- // uv intra modes
- for (i = 0; i < 10; i++) {
- uint8_t *pp = p->uv_mode[i];
- unsigned *c = s->counts.uv_mode[i], sum, s2;
-
- sum = c[0] + c[1] + c[3] + c[4] + c[5] + c[6] + c[7] + c[8] + c[9];
- adapt_prob(&pp[0], c[DC_PRED], sum, 20, 128);
- sum -= c[TM_VP8_PRED];
- adapt_prob(&pp[1], c[TM_VP8_PRED], sum, 20, 128);
- sum -= c[VERT_PRED];
- adapt_prob(&pp[2], c[VERT_PRED], sum, 20, 128);
- s2 = c[HOR_PRED] + c[DIAG_DOWN_RIGHT_PRED] + c[VERT_RIGHT_PRED];
- sum -= s2;
- adapt_prob(&pp[3], s2, sum, 20, 128);
- s2 -= c[HOR_PRED];
- adapt_prob(&pp[4], c[HOR_PRED], s2, 20, 128);
- adapt_prob(&pp[5], c[DIAG_DOWN_RIGHT_PRED], c[VERT_RIGHT_PRED], 20, 128);
- sum -= c[DIAG_DOWN_LEFT_PRED];
- adapt_prob(&pp[6], c[DIAG_DOWN_LEFT_PRED], sum, 20, 128);
- sum -= c[VERT_LEFT_PRED];
- adapt_prob(&pp[7], c[VERT_LEFT_PRED], sum, 20, 128);
- adapt_prob(&pp[8], c[HOR_DOWN_PRED], c[HOR_UP_PRED], 20, 128);
+ vp9_report_tile_progress(s, row >> 3, 1);
+ }
}
+ return 0;
}
-static void free_buffers(VP9Context *s)
+static av_always_inline
+int loopfilter_proc(AVCodecContext *avctx)
{
- av_freep(&s->intra_pred_data[0]);
- av_freep(&s->b_base);
- av_freep(&s->block_base);
-}
+ VP9Context *s = avctx->priv_data;
+ ptrdiff_t uvoff, yoff, ls_y, ls_uv;
+ VP9Filter *lflvl_ptr;
+ int bytesperpixel = s->bytesperpixel, col, i;
+ AVFrame *f;
-static av_cold int vp9_decode_free(AVCodecContext *ctx)
-{
- VP9Context *s = ctx->priv_data;
- int i;
+ f = s->s.frames[CUR_FRAME].tf.f;
+ ls_y = f->linesize[0];
+ ls_uv =f->linesize[1];
- for (i = 0; i < 3; i++) {
- if (s->s.frames[i].tf.f->buf[0])
- vp9_unref_frame(ctx, &s->s.frames[i]);
- av_frame_free(&s->s.frames[i].tf.f);
- }
- for (i = 0; i < 8; i++) {
- if (s->s.refs[i].f->buf[0])
- ff_thread_release_buffer(ctx, &s->s.refs[i]);
- av_frame_free(&s->s.refs[i].f);
- if (s->next_refs[i].f->buf[0])
- ff_thread_release_buffer(ctx, &s->next_refs[i]);
- av_frame_free(&s->next_refs[i].f);
- }
- free_buffers(s);
- av_freep(&s->c_b);
- s->c_b_size = 0;
+ for (i = 0; i < s->sb_rows; i++) {
+ vp9_await_tile_progress(s, i, s->s.h.tiling.tile_cols);
+ if (s->s.h.filter.level) {
+ yoff = (ls_y * 64)*i;
+ uvoff = (ls_uv * 64 >> s->ss_v)*i;
+ lflvl_ptr = s->lflvl+s->sb_cols*i;
+ for (col = 0; col < s->cols;
+ col += 8, yoff += 64 * bytesperpixel,
+ uvoff += 64 * bytesperpixel >> s->ss_h, lflvl_ptr++) {
+ ff_vp9_loopfilter_sb(avctx, lflvl_ptr, i << 3, col,
+ yoff, uvoff);
+ }
+ }
+ }
return 0;
}
+#endif
-
-static int vp9_decode_frame(AVCodecContext *ctx, void *frame,
+static int vp9_decode_frame(AVCodecContext *avctx, void *frame,
int *got_frame, AVPacket *pkt)
{
const uint8_t *data = pkt->data;
int size = pkt->size;
- VP9Context *s = ctx->priv_data;
- int res, tile_row, tile_col, i, ref, row, col;
+ VP9Context *s = avctx->priv_data;
+ int ret, i, j, ref;
int retain_segmap_ref = s->s.frames[REF_FRAME_SEGMAP].segmentation_map &&
(!s->s.h.segmentation.enabled || !s->s.h.segmentation.update_map);
- ptrdiff_t yoff, uvoff, ls_y, ls_uv;
AVFrame *f;
- int bytesperpixel;
- if ((res = decode_frame_header(ctx, data, size, &ref)) < 0) {
- return res;
- } else if (res == 0) {
+ if ((ret = decode_frame_header(avctx, data, size, &ref)) < 0) {
+ return ret;
+ } else if (ret == 0) {
if (!s->s.refs[ref].f->buf[0]) {
- av_log(ctx, AV_LOG_ERROR, "Requested reference %d not available\n", ref);
+ av_log(avctx, AV_LOG_ERROR, "Requested reference %d not available\n", ref);
return AVERROR_INVALIDDATA;
}
- if ((res = av_frame_ref(frame, s->s.refs[ref].f)) < 0)
- return res;
+ if ((ret = av_frame_ref(frame, s->s.refs[ref].f)) < 0)
+ return ret;
((AVFrame *)frame)->pts = pkt->pts;
#if FF_API_PKT_PTS
FF_DISABLE_DEPRECATION_WARNINGS
@@ -4000,73 +1480,70 @@ FF_ENABLE_DEPRECATION_WARNINGS
((AVFrame *)frame)->pkt_dts = pkt->dts;
for (i = 0; i < 8; i++) {
if (s->next_refs[i].f->buf[0])
- ff_thread_release_buffer(ctx, &s->next_refs[i]);
+ ff_thread_release_buffer(avctx, &s->next_refs[i]);
if (s->s.refs[i].f->buf[0] &&
- (res = ff_thread_ref_frame(&s->next_refs[i], &s->s.refs[i])) < 0)
- return res;
+ (ret = ff_thread_ref_frame(&s->next_refs[i], &s->s.refs[i])) < 0)
+ return ret;
}
*got_frame = 1;
return pkt->size;
}
- data += res;
- size -= res;
+ data += ret;
+ size -= ret;
if (!retain_segmap_ref || s->s.h.keyframe || s->s.h.intraonly) {
if (s->s.frames[REF_FRAME_SEGMAP].tf.f->buf[0])
- vp9_unref_frame(ctx, &s->s.frames[REF_FRAME_SEGMAP]);
+ vp9_frame_unref(avctx, &s->s.frames[REF_FRAME_SEGMAP]);
if (!s->s.h.keyframe && !s->s.h.intraonly && !s->s.h.errorres && s->s.frames[CUR_FRAME].tf.f->buf[0] &&
- (res = vp9_ref_frame(ctx, &s->s.frames[REF_FRAME_SEGMAP], &s->s.frames[CUR_FRAME])) < 0)
- return res;
+ (ret = vp9_frame_ref(avctx, &s->s.frames[REF_FRAME_SEGMAP], &s->s.frames[CUR_FRAME])) < 0)
+ return ret;
}
if (s->s.frames[REF_FRAME_MVPAIR].tf.f->buf[0])
- vp9_unref_frame(ctx, &s->s.frames[REF_FRAME_MVPAIR]);
+ vp9_frame_unref(avctx, &s->s.frames[REF_FRAME_MVPAIR]);
if (!s->s.h.intraonly && !s->s.h.keyframe && !s->s.h.errorres && s->s.frames[CUR_FRAME].tf.f->buf[0] &&
- (res = vp9_ref_frame(ctx, &s->s.frames[REF_FRAME_MVPAIR], &s->s.frames[CUR_FRAME])) < 0)
- return res;
+ (ret = vp9_frame_ref(avctx, &s->s.frames[REF_FRAME_MVPAIR], &s->s.frames[CUR_FRAME])) < 0)
+ return ret;
if (s->s.frames[CUR_FRAME].tf.f->buf[0])
- vp9_unref_frame(ctx, &s->s.frames[CUR_FRAME]);
- if ((res = vp9_alloc_frame(ctx, &s->s.frames[CUR_FRAME])) < 0)
- return res;
+ vp9_frame_unref(avctx, &s->s.frames[CUR_FRAME]);
+ if ((ret = vp9_frame_alloc(avctx, &s->s.frames[CUR_FRAME])) < 0)
+ return ret;
f = s->s.frames[CUR_FRAME].tf.f;
f->key_frame = s->s.h.keyframe;
f->pict_type = (s->s.h.keyframe || s->s.h.intraonly) ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
- ls_y = f->linesize[0];
- ls_uv =f->linesize[1];
if (s->s.frames[REF_FRAME_SEGMAP].tf.f->buf[0] &&
(s->s.frames[REF_FRAME_MVPAIR].tf.f->width != s->s.frames[CUR_FRAME].tf.f->width ||
s->s.frames[REF_FRAME_MVPAIR].tf.f->height != s->s.frames[CUR_FRAME].tf.f->height)) {
- vp9_unref_frame(ctx, &s->s.frames[REF_FRAME_SEGMAP]);
+ vp9_frame_unref(avctx, &s->s.frames[REF_FRAME_SEGMAP]);
}
// ref frame setup
for (i = 0; i < 8; i++) {
if (s->next_refs[i].f->buf[0])
- ff_thread_release_buffer(ctx, &s->next_refs[i]);
+ ff_thread_release_buffer(avctx, &s->next_refs[i]);
if (s->s.h.refreshrefmask & (1 << i)) {
- res = ff_thread_ref_frame(&s->next_refs[i], &s->s.frames[CUR_FRAME].tf);
+ ret = ff_thread_ref_frame(&s->next_refs[i], &s->s.frames[CUR_FRAME].tf);
} else if (s->s.refs[i].f->buf[0]) {
- res = ff_thread_ref_frame(&s->next_refs[i], &s->s.refs[i]);
- }
- if (res < 0)
- return res;
- }
-
- if (ctx->hwaccel) {
- res = ctx->hwaccel->start_frame(ctx, NULL, 0);
- if (res < 0)
- return res;
- res = ctx->hwaccel->decode_slice(ctx, pkt->data, pkt->size);
- if (res < 0)
- return res;
- res = ctx->hwaccel->end_frame(ctx);
- if (res < 0)
- return res;
+ ret = ff_thread_ref_frame(&s->next_refs[i], &s->s.refs[i]);
+ }
+ if (ret < 0)
+ return ret;
+ }
+
+ if (avctx->hwaccel) {
+ ret = avctx->hwaccel->start_frame(avctx, NULL, 0);
+ if (ret < 0)
+ return ret;
+ ret = avctx->hwaccel->decode_slice(avctx, pkt->data, pkt->size);
+ if (ret < 0)
+ return ret;
+ ret = avctx->hwaccel->end_frame(avctx);
+ if (ret < 0)
+ return ret;
goto finish;
}
// main tile decode loop
- bytesperpixel = s->bytesperpixel;
memset(s->above_partition_ctx, 0, s->cols);
memset(s->above_skip_ctx, 0, s->cols);
if (s->s.h.keyframe || s->s.h.intraonly) {
@@ -4079,11 +1556,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
memset(s->above_uv_nnz_ctx[1], 0, s->sb_cols * 16 >> s->ss_h);
memset(s->above_segpred_ctx, 0, s->cols);
s->pass = s->s.frames[CUR_FRAME].uses_2pass =
- ctx->active_thread_type == FF_THREAD_FRAME && s->s.h.refreshctx && !s->s.h.parallelmode;
- if ((res = update_block_buffers(ctx)) < 0) {
- av_log(ctx, AV_LOG_ERROR,
+ avctx->active_thread_type == FF_THREAD_FRAME && s->s.h.refreshctx && !s->s.h.parallelmode;
+ if ((ret = update_block_buffers(avctx)) < 0) {
+ av_log(avctx, AV_LOG_ERROR,
"Failed to allocate block buffers\n");
- return res;
+ return ret;
}
if (s->s.h.refreshctx && s->s.h.parallelmode) {
int j, k, l, m;
@@ -4099,25 +1576,36 @@ FF_ENABLE_DEPRECATION_WARNINGS
break;
}
s->prob_ctx[s->s.h.framectxid].p = s->prob.p;
- ff_thread_finish_setup(ctx);
+ ff_thread_finish_setup(avctx);
} else if (!s->s.h.refreshctx) {
- ff_thread_finish_setup(ctx);
+ ff_thread_finish_setup(avctx);
+ }
+
+#if HAVE_THREADS
+ if (avctx->active_thread_type & FF_THREAD_SLICE) {
+ for (i = 0; i < s->sb_rows; i++)
+ atomic_store(&s->entries[i], 0);
}
+#endif
do {
- yoff = uvoff = 0;
- s->b = s->b_base;
- s->block = s->block_base;
- s->uvblock[0] = s->uvblock_base[0];
- s->uvblock[1] = s->uvblock_base[1];
- s->eob = s->eob_base;
- s->uveob[0] = s->uveob_base[0];
- s->uveob[1] = s->uveob_base[1];
-
- for (tile_row = 0; tile_row < s->s.h.tiling.tile_rows; tile_row++) {
- set_tile_offset(&s->tile_row_start, &s->tile_row_end,
- tile_row, s->s.h.tiling.log2_tile_rows, s->sb_rows);
- if (s->pass != 2) {
+ for (i = 0; i < s->active_tile_cols; i++) {
+ s->td[i].b = s->td[i].b_base;
+ s->td[i].block = s->td[i].block_base;
+ s->td[i].uvblock[0] = s->td[i].uvblock_base[0];
+ s->td[i].uvblock[1] = s->td[i].uvblock_base[1];
+ s->td[i].eob = s->td[i].eob_base;
+ s->td[i].uveob[0] = s->td[i].uveob_base[0];
+ s->td[i].uveob[1] = s->td[i].uveob_base[1];
+ }
+
+#if HAVE_THREADS
+ if (avctx->active_thread_type == FF_THREAD_SLICE) {
+ int tile_row, tile_col;
+
+ av_assert1(!s->pass);
+
+ for (tile_row = 0; tile_row < s->s.h.tiling.tile_rows; tile_row++) {
for (tile_col = 0; tile_col < s->s.h.tiling.tile_cols; tile_col++) {
int64_t tile_size;
@@ -4129,107 +1617,38 @@ FF_ENABLE_DEPRECATION_WARNINGS
data += 4;
size -= 4;
}
- if (tile_size > size) {
- ff_thread_report_progress(&s->s.frames[CUR_FRAME].tf, INT_MAX, 0);
+ if (tile_size > size)
return AVERROR_INVALIDDATA;
- }
- ff_vp56_init_range_decoder(&s->c_b[tile_col], data, tile_size);
- if (vp56_rac_get_prob_branchy(&s->c_b[tile_col], 128)) { // marker bit
- ff_thread_report_progress(&s->s.frames[CUR_FRAME].tf, INT_MAX, 0);
+ ret = ff_vp56_init_range_decoder(&s->td[tile_col].c_b[tile_row], data, tile_size);
+ if (ret < 0)
+ return ret;
+ if (vp56_rac_get_prob_branchy(&s->td[tile_col].c_b[tile_row], 128)) // marker bit
return AVERROR_INVALIDDATA;
- }
data += tile_size;
size -= tile_size;
}
}
- for (row = s->tile_row_start; row < s->tile_row_end;
- row += 8, yoff += ls_y * 64, uvoff += ls_uv * 64 >> s->ss_v) {
- struct VP9Filter *lflvl_ptr = s->lflvl;
- ptrdiff_t yoff2 = yoff, uvoff2 = uvoff;
-
- for (tile_col = 0; tile_col < s->s.h.tiling.tile_cols; tile_col++) {
- set_tile_offset(&s->tile_col_start, &s->tile_col_end,
- tile_col, s->s.h.tiling.log2_tile_cols, s->sb_cols);
-
- if (s->pass != 2) {
- memset(s->left_partition_ctx, 0, 8);
- memset(s->left_skip_ctx, 0, 8);
- if (s->s.h.keyframe || s->s.h.intraonly) {
- memset(s->left_mode_ctx, DC_PRED, 16);
- } else {
- memset(s->left_mode_ctx, NEARESTMV, 8);
- }
- memset(s->left_y_nnz_ctx, 0, 16);
- memset(s->left_uv_nnz_ctx, 0, 32);
- memset(s->left_segpred_ctx, 0, 8);
-
- memcpy(&s->c, &s->c_b[tile_col], sizeof(s->c));
- }
-
- for (col = s->tile_col_start;
- col < s->tile_col_end;
- col += 8, yoff2 += 64 * bytesperpixel,
- uvoff2 += 64 * bytesperpixel >> s->ss_h, lflvl_ptr++) {
- // FIXME integrate with lf code (i.e. zero after each
- // use, similar to invtxfm coefficients, or similar)
- if (s->pass != 1) {
- memset(lflvl_ptr->mask, 0, sizeof(lflvl_ptr->mask));
- }
-
- if (s->pass == 2) {
- decode_sb_mem(ctx, row, col, lflvl_ptr,
- yoff2, uvoff2, BL_64X64);
- } else {
- decode_sb(ctx, row, col, lflvl_ptr,
- yoff2, uvoff2, BL_64X64);
- }
- }
- if (s->pass != 2) {
- memcpy(&s->c_b[tile_col], &s->c, sizeof(s->c));
- }
- }
-
- if (s->pass == 1) {
- continue;
- }
-
- // backup pre-loopfilter reconstruction data for intra
- // prediction of next row of sb64s
- if (row + 8 < s->rows) {
- memcpy(s->intra_pred_data[0],
- f->data[0] + yoff + 63 * ls_y,
- 8 * s->cols * bytesperpixel);
- memcpy(s->intra_pred_data[1],
- f->data[1] + uvoff + ((64 >> s->ss_v) - 1) * ls_uv,
- 8 * s->cols * bytesperpixel >> s->ss_h);
- memcpy(s->intra_pred_data[2],
- f->data[2] + uvoff + ((64 >> s->ss_v) - 1) * ls_uv,
- 8 * s->cols * bytesperpixel >> s->ss_h);
- }
-
- // loopfilter one row
- if (s->s.h.filter.level) {
- yoff2 = yoff;
- uvoff2 = uvoff;
- lflvl_ptr = s->lflvl;
- for (col = 0; col < s->cols;
- col += 8, yoff2 += 64 * bytesperpixel,
- uvoff2 += 64 * bytesperpixel >> s->ss_h, lflvl_ptr++) {
- loopfilter_sb(ctx, lflvl_ptr, row, col, yoff2, uvoff2);
- }
- }
-
- // FIXME maybe we can make this more finegrained by running the
- // loopfilter per-block instead of after each sbrow
- // In fact that would also make intra pred left preparation easier?
- ff_thread_report_progress(&s->s.frames[CUR_FRAME].tf, row >> 3, 0);
+ ff_slice_thread_execute_with_mainfunc(avctx, decode_tiles_mt, loopfilter_proc, s->td, NULL, s->s.h.tiling.tile_cols);
+ } else
+#endif
+ {
+ ret = decode_tiles(avctx, data, size);
+ if (ret < 0) {
+ ff_thread_report_progress(&s->s.frames[CUR_FRAME].tf, INT_MAX, 0);
+ return ret;
}
}
+ // Sum all counts fields into td[0].counts for tile threading
+ if (avctx->active_thread_type == FF_THREAD_SLICE)
+ for (i = 1; i < s->s.h.tiling.tile_cols; i++)
+ for (j = 0; j < sizeof(s->td[i].counts) / sizeof(unsigned); j++)
+ ((unsigned *)&s->td[0].counts)[j] += ((unsigned *)&s->td[i].counts)[j];
+
if (s->pass < 2 && s->s.h.refreshctx && !s->s.h.parallelmode) {
- adapt_probs(s);
- ff_thread_finish_setup(ctx);
+ ff_vp9_adapt_probs(s);
+ ff_thread_finish_setup(avctx);
}
} while (s->pass++ == 1);
ff_thread_report_progress(&s->s.frames[CUR_FRAME].tf, INT_MAX, 0);
@@ -4238,42 +1657,42 @@ finish:
// ref frame setup
for (i = 0; i < 8; i++) {
if (s->s.refs[i].f->buf[0])
- ff_thread_release_buffer(ctx, &s->s.refs[i]);
+ ff_thread_release_buffer(avctx, &s->s.refs[i]);
if (s->next_refs[i].f->buf[0] &&
- (res = ff_thread_ref_frame(&s->s.refs[i], &s->next_refs[i])) < 0)
- return res;
+ (ret = ff_thread_ref_frame(&s->s.refs[i], &s->next_refs[i])) < 0)
+ return ret;
}
if (!s->s.h.invisible) {
- if ((res = av_frame_ref(frame, s->s.frames[CUR_FRAME].tf.f)) < 0)
- return res;
+ if ((ret = av_frame_ref(frame, s->s.frames[CUR_FRAME].tf.f)) < 0)
+ return ret;
*got_frame = 1;
}
return pkt->size;
}
-static void vp9_decode_flush(AVCodecContext *ctx)
+static void vp9_decode_flush(AVCodecContext *avctx)
{
- VP9Context *s = ctx->priv_data;
+ VP9Context *s = avctx->priv_data;
int i;
for (i = 0; i < 3; i++)
- vp9_unref_frame(ctx, &s->s.frames[i]);
+ vp9_frame_unref(avctx, &s->s.frames[i]);
for (i = 0; i < 8; i++)
- ff_thread_release_buffer(ctx, &s->s.refs[i]);
+ ff_thread_release_buffer(avctx, &s->s.refs[i]);
}
-static int init_frames(AVCodecContext *ctx)
+static int init_frames(AVCodecContext *avctx)
{
- VP9Context *s = ctx->priv_data;
+ VP9Context *s = avctx->priv_data;
int i;
for (i = 0; i < 3; i++) {
s->s.frames[i].tf.f = av_frame_alloc();
if (!s->s.frames[i].tf.f) {
- vp9_decode_free(ctx);
- av_log(ctx, AV_LOG_ERROR, "Failed to allocate frame buffer %d\n", i);
+ vp9_decode_free(avctx);
+ av_log(avctx, AV_LOG_ERROR, "Failed to allocate frame buffer %d\n", i);
return AVERROR(ENOMEM);
}
}
@@ -4281,8 +1700,8 @@ static int init_frames(AVCodecContext *ctx)
s->s.refs[i].f = av_frame_alloc();
s->next_refs[i].f = av_frame_alloc();
if (!s->s.refs[i].f || !s->next_refs[i].f) {
- vp9_decode_free(ctx);
- av_log(ctx, AV_LOG_ERROR, "Failed to allocate frame buffer %d\n", i);
+ vp9_decode_free(avctx);
+ av_log(avctx, AV_LOG_ERROR, "Failed to allocate frame buffer %d\n", i);
return AVERROR(ENOMEM);
}
}
@@ -4290,15 +1709,15 @@ static int init_frames(AVCodecContext *ctx)
return 0;
}
-static av_cold int vp9_decode_init(AVCodecContext *ctx)
+static av_cold int vp9_decode_init(AVCodecContext *avctx)
{
- VP9Context *s = ctx->priv_data;
+ VP9Context *s = avctx->priv_data;
- ctx->internal->allocate_progress = 1;
+ avctx->internal->allocate_progress = 1;
s->last_bpp = 0;
s->s.h.filter.sharpness = -1;
- return init_frames(ctx);
+ return init_frames(avctx);
}
#if HAVE_THREADS
@@ -4309,23 +1728,23 @@ static av_cold int vp9_decode_init_thread_copy(AVCodecContext *avctx)
static int vp9_decode_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
{
- int i, res;
+ int i, ret;
VP9Context *s = dst->priv_data, *ssrc = src->priv_data;
for (i = 0; i < 3; i++) {
if (s->s.frames[i].tf.f->buf[0])
- vp9_unref_frame(dst, &s->s.frames[i]);
+ vp9_frame_unref(dst, &s->s.frames[i]);
if (ssrc->s.frames[i].tf.f->buf[0]) {
- if ((res = vp9_ref_frame(dst, &s->s.frames[i], &ssrc->s.frames[i])) < 0)
- return res;
+ if ((ret = vp9_frame_ref(dst, &s->s.frames[i], &ssrc->s.frames[i])) < 0)
+ return ret;
}
}
for (i = 0; i < 8; i++) {
if (s->s.refs[i].f->buf[0])
ff_thread_release_buffer(dst, &s->s.refs[i]);
if (ssrc->next_refs[i].f->buf[0]) {
- if ((res = ff_thread_ref_frame(&s->s.refs[i], &ssrc->next_refs[i])) < 0)
- return res;
+ if ((ret = ff_thread_ref_frame(&s->s.refs[i], &ssrc->next_refs[i])) < 0)
+ return ret;
}
}
@@ -4341,7 +1760,7 @@ static int vp9_decode_update_thread_context(AVCodecContext *dst, const AVCodecCo
s->gf_fmt = ssrc->gf_fmt;
s->w = ssrc->w;
s->h = ssrc->h;
- s->bpp = ssrc->bpp;
+ s->s.h.bpp = ssrc->s.h.bpp;
s->bpp_index = ssrc->bpp_index;
s->pix_fmt = ssrc->pix_fmt;
memcpy(&s->prob_ctx, &ssrc->prob_ctx, sizeof(s->prob_ctx));
@@ -4362,7 +1781,8 @@ AVCodec ff_vp9_decoder = {
.init = vp9_decode_init,
.close = vp9_decode_free,
.decode = vp9_decode_frame,
- .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS,
+ .capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS | AV_CODEC_CAP_SLICE_THREADS,
+ .caps_internal = FF_CODEC_CAP_SLICE_THREAD_HAS_MF,
.flush = vp9_decode_flush,
.init_thread_copy = ONLY_IF_THREADS_ENABLED(vp9_decode_init_thread_copy),
.update_thread_context = ONLY_IF_THREADS_ENABLED(vp9_decode_update_thread_context),
diff --git a/media/ffvpx/libavcodec/vp9.h b/media/ffvpx/libavcodec/vp9.h
index df5bd4d85c..c8d07ad986 100644
--- a/media/ffvpx/libavcodec/vp9.h
+++ b/media/ffvpx/libavcodec/vp9.h
@@ -24,42 +24,6 @@
#ifndef AVCODEC_VP9_H
#define AVCODEC_VP9_H
-#include <stdint.h>
-
-#include "thread.h"
-#include "vp56.h"
-
-enum BlockLevel {
- BL_64X64,
- BL_32X32,
- BL_16X16,
- BL_8X8,
-};
-
-enum BlockPartition {
- PARTITION_NONE, // [ ] <-.
- PARTITION_H, // [-] |
- PARTITION_V, // [|] |
- PARTITION_SPLIT, // [+] --'
-};
-
-enum BlockSize {
- BS_64x64,
- BS_64x32,
- BS_32x64,
- BS_32x32,
- BS_32x16,
- BS_16x32,
- BS_16x16,
- BS_16x8,
- BS_8x16,
- BS_8x8,
- BS_8x4,
- BS_4x8,
- BS_4x4,
- N_BS_SIZES,
-};
-
enum TxfmMode {
TX_4X4,
TX_8X8,
@@ -97,115 +61,13 @@ enum IntraPredMode {
N_INTRA_PRED_MODES
};
-enum InterPredMode {
- NEARESTMV = 10,
- NEARMV = 11,
- ZEROMV = 12,
- NEWMV = 13,
-};
-
enum FilterMode {
FILTER_8TAP_SMOOTH,
FILTER_8TAP_REGULAR,
FILTER_8TAP_SHARP,
FILTER_BILINEAR,
- FILTER_SWITCHABLE,
+ N_FILTERS,
+ FILTER_SWITCHABLE = N_FILTERS,
};
-enum CompPredMode {
- PRED_SINGLEREF,
- PRED_COMPREF,
- PRED_SWITCHABLE,
-};
-
-struct VP9mvrefPair {
- VP56mv mv[2];
- int8_t ref[2];
-};
-
-typedef struct VP9Frame {
- ThreadFrame tf;
- AVBufferRef *extradata;
- uint8_t *segmentation_map;
- struct VP9mvrefPair *mv;
- int uses_2pass;
-
- AVBufferRef *hwaccel_priv_buf;
- void *hwaccel_picture_private;
-} VP9Frame;
-
-typedef struct VP9BitstreamHeader {
- // bitstream header
- uint8_t profile;
- uint8_t keyframe;
- uint8_t invisible;
- uint8_t errorres;
- uint8_t intraonly;
- uint8_t resetctx;
- uint8_t refreshrefmask;
- uint8_t highprecisionmvs;
- enum FilterMode filtermode;
- uint8_t allowcompinter;
- uint8_t refreshctx;
- uint8_t parallelmode;
- uint8_t framectxid;
- uint8_t use_last_frame_mvs;
- uint8_t refidx[3];
- uint8_t signbias[3];
- uint8_t fixcompref;
- uint8_t varcompref[2];
- struct {
- uint8_t level;
- int8_t sharpness;
- } filter;
- struct {
- uint8_t enabled;
- uint8_t updated;
- int8_t mode[2];
- int8_t ref[4];
- } lf_delta;
- uint8_t yac_qi;
- int8_t ydc_qdelta, uvdc_qdelta, uvac_qdelta;
- uint8_t lossless;
-#define MAX_SEGMENT 8
- struct {
- uint8_t enabled;
- uint8_t temporal;
- uint8_t absolute_vals;
- uint8_t update_map;
- uint8_t prob[7];
- uint8_t pred_prob[3];
- struct {
- uint8_t q_enabled;
- uint8_t lf_enabled;
- uint8_t ref_enabled;
- uint8_t skip_enabled;
- uint8_t ref_val;
- int16_t q_val;
- int8_t lf_val;
- int16_t qmul[2][2];
- uint8_t lflvl[4][2];
- } feat[MAX_SEGMENT];
- } segmentation;
- enum TxfmMode txfmmode;
- enum CompPredMode comppredmode;
- struct {
- unsigned log2_tile_cols, log2_tile_rows;
- unsigned tile_cols, tile_rows;
- } tiling;
-
- int uncompressed_header_size;
- int compressed_header_size;
-} VP9BitstreamHeader;
-
-typedef struct VP9SharedContext {
- VP9BitstreamHeader h;
-
- ThreadFrame refs[8];
-#define CUR_FRAME 0
-#define REF_FRAME_MVPAIR 1
-#define REF_FRAME_SEGMAP 2
- VP9Frame frames[3];
-} VP9SharedContext;
-
#endif /* AVCODEC_VP9_H */
diff --git a/media/ffvpx/libavcodec/vp9_mc_template.c b/media/ffvpx/libavcodec/vp9_mc_template.c
index 38d9a6da9f..31e692f362 100644
--- a/media/ffvpx/libavcodec/vp9_mc_template.c
+++ b/media/ffvpx/libavcodec/vp9_mc_template.c
@@ -27,19 +27,19 @@
(VP56mv) { .x = ROUNDED_DIV(a.x + b.x + c.x + d.x, 4), \
.y = ROUNDED_DIV(a.y + b.y + c.y + d.y, 4) }
-static void FN(inter_pred)(AVCodecContext *ctx)
+static void FN(inter_pred)(VP9TileData *td)
{
static const uint8_t bwlog_tab[2][N_BS_SIZES] = {
{ 0, 0, 1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4 },
{ 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 4, 4 },
};
- VP9Context *s = ctx->priv_data;
- VP9Block *b = s->b;
- int row = s->row, col = s->col;
+ VP9Context *s = td->s;
+ VP9Block *b = td->b;
+ int row = td->row, col = td->col;
ThreadFrame *tref1 = &s->s.refs[s->s.h.refidx[b->ref[0]]], *tref2;
AVFrame *ref1 = tref1->f, *ref2;
int w1 = ref1->width, h1 = ref1->height, w2, h2;
- ptrdiff_t ls_y = s->y_stride, ls_uv = s->uv_stride;
+ ptrdiff_t ls_y = td->y_stride, ls_uv = td->uv_stride;
int bytesperpixel = BYTES_PER_PIXEL;
if (b->comp) {
@@ -55,26 +55,26 @@ static void FN(inter_pred)(AVCodecContext *ctx)
#if SCALED == 0
if (b->bs == BS_8x4) {
- mc_luma_dir(s, mc[3][b->filter][0], s->dst[0], ls_y,
+ mc_luma_dir(td, mc[3][b->filter][0], td->dst[0], ls_y,
ref1->data[0], ref1->linesize[0], tref1,
row << 3, col << 3, &b->mv[0][0],,,,, 8, 4, w1, h1, 0);
- mc_luma_dir(s, mc[3][b->filter][0],
- s->dst[0] + 4 * ls_y, ls_y,
+ mc_luma_dir(td, mc[3][b->filter][0],
+ td->dst[0] + 4 * ls_y, ls_y,
ref1->data[0], ref1->linesize[0], tref1,
(row << 3) + 4, col << 3, &b->mv[2][0],,,,, 8, 4, w1, h1, 0);
w1 = (w1 + s->ss_h) >> s->ss_h;
if (s->ss_v) {
h1 = (h1 + 1) >> 1;
uvmv = ROUNDED_DIV_MVx2(b->mv[0][0], b->mv[2][0]);
- mc_chroma_dir(s, mc[3 + s->ss_h][b->filter][0],
- s->dst[1], s->dst[2], ls_uv,
+ mc_chroma_dir(td, mc[3 + s->ss_h][b->filter][0],
+ td->dst[1], td->dst[2], ls_uv,
ref1->data[1], ref1->linesize[1],
ref1->data[2], ref1->linesize[2], tref1,
row << 2, col << (3 - s->ss_h),
&uvmv,,,,, 8 >> s->ss_h, 4, w1, h1, 0);
} else {
- mc_chroma_dir(s, mc[3 + s->ss_h][b->filter][0],
- s->dst[1], s->dst[2], ls_uv,
+ mc_chroma_dir(td, mc[3 + s->ss_h][b->filter][0],
+ td->dst[1], td->dst[2], ls_uv,
ref1->data[1], ref1->linesize[1],
ref1->data[2], ref1->linesize[2], tref1,
row << 3, col << (3 - s->ss_h),
@@ -87,8 +87,8 @@ static void FN(inter_pred)(AVCodecContext *ctx)
} else {
uvmv = ROUNDED_DIV_MVx2(b->mv[0][0], b->mv[2][0]);
}
- mc_chroma_dir(s, mc[3 + s->ss_h][b->filter][0],
- s->dst[1] + 4 * ls_uv, s->dst[2] + 4 * ls_uv, ls_uv,
+ mc_chroma_dir(td, mc[3 + s->ss_h][b->filter][0],
+ td->dst[1] + 4 * ls_uv, td->dst[2] + 4 * ls_uv, ls_uv,
ref1->data[1], ref1->linesize[1],
ref1->data[2], ref1->linesize[2], tref1,
(row << 3) + 4, col << (3 - s->ss_h),
@@ -96,26 +96,26 @@ static void FN(inter_pred)(AVCodecContext *ctx)
}
if (b->comp) {
- mc_luma_dir(s, mc[3][b->filter][1], s->dst[0], ls_y,
+ mc_luma_dir(td, mc[3][b->filter][1], td->dst[0], ls_y,
ref2->data[0], ref2->linesize[0], tref2,
row << 3, col << 3, &b->mv[0][1],,,,, 8, 4, w2, h2, 1);
- mc_luma_dir(s, mc[3][b->filter][1],
- s->dst[0] + 4 * ls_y, ls_y,
+ mc_luma_dir(td, mc[3][b->filter][1],
+ td->dst[0] + 4 * ls_y, ls_y,
ref2->data[0], ref2->linesize[0], tref2,
(row << 3) + 4, col << 3, &b->mv[2][1],,,,, 8, 4, w2, h2, 1);
w2 = (w2 + s->ss_h) >> s->ss_h;
if (s->ss_v) {
h2 = (h2 + 1) >> 1;
uvmv = ROUNDED_DIV_MVx2(b->mv[0][1], b->mv[2][1]);
- mc_chroma_dir(s, mc[3 + s->ss_h][b->filter][1],
- s->dst[1], s->dst[2], ls_uv,
+ mc_chroma_dir(td, mc[3 + s->ss_h][b->filter][1],
+ td->dst[1], td->dst[2], ls_uv,
ref2->data[1], ref2->linesize[1],
ref2->data[2], ref2->linesize[2], tref2,
row << 2, col << (3 - s->ss_h),
&uvmv,,,,, 8 >> s->ss_h, 4, w2, h2, 1);
} else {
- mc_chroma_dir(s, mc[3 + s->ss_h][b->filter][1],
- s->dst[1], s->dst[2], ls_uv,
+ mc_chroma_dir(td, mc[3 + s->ss_h][b->filter][1],
+ td->dst[1], td->dst[2], ls_uv,
ref2->data[1], ref2->linesize[1],
ref2->data[2], ref2->linesize[2], tref2,
row << 3, col << (3 - s->ss_h),
@@ -128,8 +128,8 @@ static void FN(inter_pred)(AVCodecContext *ctx)
} else {
uvmv = ROUNDED_DIV_MVx2(b->mv[0][1], b->mv[2][1]);
}
- mc_chroma_dir(s, mc[3 + s->ss_h][b->filter][1],
- s->dst[1] + 4 * ls_uv, s->dst[2] + 4 * ls_uv, ls_uv,
+ mc_chroma_dir(td, mc[3 + s->ss_h][b->filter][1],
+ td->dst[1] + 4 * ls_uv, td->dst[2] + 4 * ls_uv, ls_uv,
ref2->data[1], ref2->linesize[1],
ref2->data[2], ref2->linesize[2], tref2,
(row << 3) + 4, col << (3 - s->ss_h),
@@ -137,32 +137,32 @@ static void FN(inter_pred)(AVCodecContext *ctx)
}
}
} else if (b->bs == BS_4x8) {
- mc_luma_dir(s, mc[4][b->filter][0], s->dst[0], ls_y,
+ mc_luma_dir(td, mc[4][b->filter][0], td->dst[0], ls_y,
ref1->data[0], ref1->linesize[0], tref1,
row << 3, col << 3, &b->mv[0][0],,,,, 4, 8, w1, h1, 0);
- mc_luma_dir(s, mc[4][b->filter][0], s->dst[0] + 4 * bytesperpixel, ls_y,
+ mc_luma_dir(td, mc[4][b->filter][0], td->dst[0] + 4 * bytesperpixel, ls_y,
ref1->data[0], ref1->linesize[0], tref1,
row << 3, (col << 3) + 4, &b->mv[1][0],,,,, 4, 8, w1, h1, 0);
h1 = (h1 + s->ss_v) >> s->ss_v;
if (s->ss_h) {
w1 = (w1 + 1) >> 1;
uvmv = ROUNDED_DIV_MVx2(b->mv[0][0], b->mv[1][0]);
- mc_chroma_dir(s, mc[4][b->filter][0],
- s->dst[1], s->dst[2], ls_uv,
+ mc_chroma_dir(td, mc[4][b->filter][0],
+ td->dst[1], td->dst[2], ls_uv,
ref1->data[1], ref1->linesize[1],
ref1->data[2], ref1->linesize[2], tref1,
row << (3 - s->ss_v), col << 2,
&uvmv,,,,, 4, 8 >> s->ss_v, w1, h1, 0);
} else {
- mc_chroma_dir(s, mc[4][b->filter][0],
- s->dst[1], s->dst[2], ls_uv,
+ mc_chroma_dir(td, mc[4][b->filter][0],
+ td->dst[1], td->dst[2], ls_uv,
ref1->data[1], ref1->linesize[1],
ref1->data[2], ref1->linesize[2], tref1,
row << (3 - s->ss_v), col << 3,
&b->mv[0][0],,,,, 4, 8 >> s->ss_v, w1, h1, 0);
- mc_chroma_dir(s, mc[4][b->filter][0],
- s->dst[1] + 4 * bytesperpixel,
- s->dst[2] + 4 * bytesperpixel, ls_uv,
+ mc_chroma_dir(td, mc[4][b->filter][0],
+ td->dst[1] + 4 * bytesperpixel,
+ td->dst[2] + 4 * bytesperpixel, ls_uv,
ref1->data[1], ref1->linesize[1],
ref1->data[2], ref1->linesize[2], tref1,
row << (3 - s->ss_v), (col << 3) + 4,
@@ -170,32 +170,32 @@ static void FN(inter_pred)(AVCodecContext *ctx)
}
if (b->comp) {
- mc_luma_dir(s, mc[4][b->filter][1], s->dst[0], ls_y,
+ mc_luma_dir(td, mc[4][b->filter][1], td->dst[0], ls_y,
ref2->data[0], ref2->linesize[0], tref2,
row << 3, col << 3, &b->mv[0][1],,,,, 4, 8, w2, h2, 1);
- mc_luma_dir(s, mc[4][b->filter][1], s->dst[0] + 4 * bytesperpixel, ls_y,
+ mc_luma_dir(td, mc[4][b->filter][1], td->dst[0] + 4 * bytesperpixel, ls_y,
ref2->data[0], ref2->linesize[0], tref2,
row << 3, (col << 3) + 4, &b->mv[1][1],,,,, 4, 8, w2, h2, 1);
h2 = (h2 + s->ss_v) >> s->ss_v;
if (s->ss_h) {
w2 = (w2 + 1) >> 1;
uvmv = ROUNDED_DIV_MVx2(b->mv[0][1], b->mv[1][1]);
- mc_chroma_dir(s, mc[4][b->filter][1],
- s->dst[1], s->dst[2], ls_uv,
+ mc_chroma_dir(td, mc[4][b->filter][1],
+ td->dst[1], td->dst[2], ls_uv,
ref2->data[1], ref2->linesize[1],
ref2->data[2], ref2->linesize[2], tref2,
row << (3 - s->ss_v), col << 2,
&uvmv,,,,, 4, 8 >> s->ss_v, w2, h2, 1);
} else {
- mc_chroma_dir(s, mc[4][b->filter][1],
- s->dst[1], s->dst[2], ls_uv,
+ mc_chroma_dir(td, mc[4][b->filter][1],
+ td->dst[1], td->dst[2], ls_uv,
ref2->data[1], ref2->linesize[1],
ref2->data[2], ref2->linesize[2], tref2,
row << (3 - s->ss_v), col << 3,
&b->mv[0][1],,,,, 4, 8 >> s->ss_v, w2, h2, 1);
- mc_chroma_dir(s, mc[4][b->filter][1],
- s->dst[1] + 4 * bytesperpixel,
- s->dst[2] + 4 * bytesperpixel, ls_uv,
+ mc_chroma_dir(td, mc[4][b->filter][1],
+ td->dst[1] + 4 * bytesperpixel,
+ td->dst[2] + 4 * bytesperpixel, ls_uv,
ref2->data[1], ref2->linesize[1],
ref2->data[2], ref2->linesize[2], tref2,
row << (3 - s->ss_v), (col << 3) + 4,
@@ -205,25 +205,27 @@ static void FN(inter_pred)(AVCodecContext *ctx)
} else
#endif
{
+#if SCALED == 0
av_assert2(b->bs == BS_4x4);
+#endif
// FIXME if two horizontally adjacent blocks have the same MV,
// do a w8 instead of a w4 call
- mc_luma_dir(s, mc[4][b->filter][0], s->dst[0], ls_y,
+ mc_luma_dir(td, mc[4][b->filter][0], td->dst[0], ls_y,
ref1->data[0], ref1->linesize[0], tref1,
row << 3, col << 3, &b->mv[0][0],
0, 0, 8, 8, 4, 4, w1, h1, 0);
- mc_luma_dir(s, mc[4][b->filter][0], s->dst[0] + 4 * bytesperpixel, ls_y,
+ mc_luma_dir(td, mc[4][b->filter][0], td->dst[0] + 4 * bytesperpixel, ls_y,
ref1->data[0], ref1->linesize[0], tref1,
row << 3, (col << 3) + 4, &b->mv[1][0],
4, 0, 8, 8, 4, 4, w1, h1, 0);
- mc_luma_dir(s, mc[4][b->filter][0],
- s->dst[0] + 4 * ls_y, ls_y,
+ mc_luma_dir(td, mc[4][b->filter][0],
+ td->dst[0] + 4 * ls_y, ls_y,
ref1->data[0], ref1->linesize[0], tref1,
(row << 3) + 4, col << 3, &b->mv[2][0],
0, 4, 8, 8, 4, 4, w1, h1, 0);
- mc_luma_dir(s, mc[4][b->filter][0],
- s->dst[0] + 4 * ls_y + 4 * bytesperpixel, ls_y,
+ mc_luma_dir(td, mc[4][b->filter][0],
+ td->dst[0] + 4 * ls_y + 4 * bytesperpixel, ls_y,
ref1->data[0], ref1->linesize[0], tref1,
(row << 3) + 4, (col << 3) + 4, &b->mv[3][0],
4, 4, 8, 8, 4, 4, w1, h1, 0);
@@ -233,24 +235,24 @@ static void FN(inter_pred)(AVCodecContext *ctx)
w1 = (w1 + 1) >> 1;
uvmv = ROUNDED_DIV_MVx4(b->mv[0][0], b->mv[1][0],
b->mv[2][0], b->mv[3][0]);
- mc_chroma_dir(s, mc[4][b->filter][0],
- s->dst[1], s->dst[2], ls_uv,
+ mc_chroma_dir(td, mc[4][b->filter][0],
+ td->dst[1], td->dst[2], ls_uv,
ref1->data[1], ref1->linesize[1],
ref1->data[2], ref1->linesize[2], tref1,
row << 2, col << 2,
&uvmv, 0, 0, 4, 4, 4, 4, w1, h1, 0);
} else {
uvmv = ROUNDED_DIV_MVx2(b->mv[0][0], b->mv[2][0]);
- mc_chroma_dir(s, mc[4][b->filter][0],
- s->dst[1], s->dst[2], ls_uv,
+ mc_chroma_dir(td, mc[4][b->filter][0],
+ td->dst[1], td->dst[2], ls_uv,
ref1->data[1], ref1->linesize[1],
ref1->data[2], ref1->linesize[2], tref1,
row << 2, col << 3,
&uvmv, 0, 0, 8, 4, 4, 4, w1, h1, 0);
uvmv = ROUNDED_DIV_MVx2(b->mv[1][0], b->mv[3][0]);
- mc_chroma_dir(s, mc[4][b->filter][0],
- s->dst[1] + 4 * bytesperpixel,
- s->dst[2] + 4 * bytesperpixel, ls_uv,
+ mc_chroma_dir(td, mc[4][b->filter][0],
+ td->dst[1] + 4 * bytesperpixel,
+ td->dst[2] + 4 * bytesperpixel, ls_uv,
ref1->data[1], ref1->linesize[1],
ref1->data[2], ref1->linesize[2], tref1,
row << 2, (col << 3) + 4,
@@ -260,8 +262,8 @@ static void FN(inter_pred)(AVCodecContext *ctx)
if (s->ss_h) {
w1 = (w1 + 1) >> 1;
uvmv = ROUNDED_DIV_MVx2(b->mv[0][0], b->mv[1][0]);
- mc_chroma_dir(s, mc[4][b->filter][0],
- s->dst[1], s->dst[2], ls_uv,
+ mc_chroma_dir(td, mc[4][b->filter][0],
+ td->dst[1], td->dst[2], ls_uv,
ref1->data[1], ref1->linesize[1],
ref1->data[2], ref1->linesize[2], tref1,
row << 3, col << 2,
@@ -270,35 +272,35 @@ static void FN(inter_pred)(AVCodecContext *ctx)
// bottom block
// https://code.google.com/p/webm/issues/detail?id=993
uvmv = ROUNDED_DIV_MVx2(b->mv[1][0], b->mv[2][0]);
- mc_chroma_dir(s, mc[4][b->filter][0],
- s->dst[1] + 4 * ls_uv, s->dst[2] + 4 * ls_uv, ls_uv,
+ mc_chroma_dir(td, mc[4][b->filter][0],
+ td->dst[1] + 4 * ls_uv, td->dst[2] + 4 * ls_uv, ls_uv,
ref1->data[1], ref1->linesize[1],
ref1->data[2], ref1->linesize[2], tref1,
(row << 3) + 4, col << 2,
&uvmv, 0, 4, 4, 8, 4, 4, w1, h1, 0);
} else {
- mc_chroma_dir(s, mc[4][b->filter][0],
- s->dst[1], s->dst[2], ls_uv,
+ mc_chroma_dir(td, mc[4][b->filter][0],
+ td->dst[1], td->dst[2], ls_uv,
ref1->data[1], ref1->linesize[1],
ref1->data[2], ref1->linesize[2], tref1,
row << 3, col << 3,
&b->mv[0][0], 0, 0, 8, 8, 4, 4, w1, h1, 0);
- mc_chroma_dir(s, mc[4][b->filter][0],
- s->dst[1] + 4 * bytesperpixel,
- s->dst[2] + 4 * bytesperpixel, ls_uv,
+ mc_chroma_dir(td, mc[4][b->filter][0],
+ td->dst[1] + 4 * bytesperpixel,
+ td->dst[2] + 4 * bytesperpixel, ls_uv,
ref1->data[1], ref1->linesize[1],
ref1->data[2], ref1->linesize[2], tref1,
row << 3, (col << 3) + 4,
&b->mv[1][0], 4, 0, 8, 8, 4, 4, w1, h1, 0);
- mc_chroma_dir(s, mc[4][b->filter][0],
- s->dst[1] + 4 * ls_uv, s->dst[2] + 4 * ls_uv, ls_uv,
+ mc_chroma_dir(td, mc[4][b->filter][0],
+ td->dst[1] + 4 * ls_uv, td->dst[2] + 4 * ls_uv, ls_uv,
ref1->data[1], ref1->linesize[1],
ref1->data[2], ref1->linesize[2], tref1,
(row << 3) + 4, col << 3,
&b->mv[2][0], 0, 4, 8, 8, 4, 4, w1, h1, 0);
- mc_chroma_dir(s, mc[4][b->filter][0],
- s->dst[1] + 4 * ls_uv + 4 * bytesperpixel,
- s->dst[2] + 4 * ls_uv + 4 * bytesperpixel, ls_uv,
+ mc_chroma_dir(td, mc[4][b->filter][0],
+ td->dst[1] + 4 * ls_uv + 4 * bytesperpixel,
+ td->dst[2] + 4 * ls_uv + 4 * bytesperpixel, ls_uv,
ref1->data[1], ref1->linesize[1],
ref1->data[2], ref1->linesize[2], tref1,
(row << 3) + 4, (col << 3) + 4,
@@ -307,18 +309,18 @@ static void FN(inter_pred)(AVCodecContext *ctx)
}
if (b->comp) {
- mc_luma_dir(s, mc[4][b->filter][1], s->dst[0], ls_y,
+ mc_luma_dir(td, mc[4][b->filter][1], td->dst[0], ls_y,
ref2->data[0], ref2->linesize[0], tref2,
row << 3, col << 3, &b->mv[0][1], 0, 0, 8, 8, 4, 4, w2, h2, 1);
- mc_luma_dir(s, mc[4][b->filter][1], s->dst[0] + 4 * bytesperpixel, ls_y,
+ mc_luma_dir(td, mc[4][b->filter][1], td->dst[0] + 4 * bytesperpixel, ls_y,
ref2->data[0], ref2->linesize[0], tref2,
row << 3, (col << 3) + 4, &b->mv[1][1], 4, 0, 8, 8, 4, 4, w2, h2, 1);
- mc_luma_dir(s, mc[4][b->filter][1],
- s->dst[0] + 4 * ls_y, ls_y,
+ mc_luma_dir(td, mc[4][b->filter][1],
+ td->dst[0] + 4 * ls_y, ls_y,
ref2->data[0], ref2->linesize[0], tref2,
(row << 3) + 4, col << 3, &b->mv[2][1], 0, 4, 8, 8, 4, 4, w2, h2, 1);
- mc_luma_dir(s, mc[4][b->filter][1],
- s->dst[0] + 4 * ls_y + 4 * bytesperpixel, ls_y,
+ mc_luma_dir(td, mc[4][b->filter][1],
+ td->dst[0] + 4 * ls_y + 4 * bytesperpixel, ls_y,
ref2->data[0], ref2->linesize[0], tref2,
(row << 3) + 4, (col << 3) + 4, &b->mv[3][1], 4, 4, 8, 8, 4, 4, w2, h2, 1);
if (s->ss_v) {
@@ -327,24 +329,24 @@ static void FN(inter_pred)(AVCodecContext *ctx)
w2 = (w2 + 1) >> 1;
uvmv = ROUNDED_DIV_MVx4(b->mv[0][1], b->mv[1][1],
b->mv[2][1], b->mv[3][1]);
- mc_chroma_dir(s, mc[4][b->filter][1],
- s->dst[1], s->dst[2], ls_uv,
+ mc_chroma_dir(td, mc[4][b->filter][1],
+ td->dst[1], td->dst[2], ls_uv,
ref2->data[1], ref2->linesize[1],
ref2->data[2], ref2->linesize[2], tref2,
row << 2, col << 2,
&uvmv, 0, 0, 4, 4, 4, 4, w2, h2, 1);
} else {
uvmv = ROUNDED_DIV_MVx2(b->mv[0][1], b->mv[2][1]);
- mc_chroma_dir(s, mc[4][b->filter][1],
- s->dst[1], s->dst[2], ls_uv,
+ mc_chroma_dir(td, mc[4][b->filter][1],
+ td->dst[1], td->dst[2], ls_uv,
ref2->data[1], ref2->linesize[1],
ref2->data[2], ref2->linesize[2], tref2,
row << 2, col << 3,
&uvmv, 0, 0, 8, 4, 4, 4, w2, h2, 1);
uvmv = ROUNDED_DIV_MVx2(b->mv[1][1], b->mv[3][1]);
- mc_chroma_dir(s, mc[4][b->filter][1],
- s->dst[1] + 4 * bytesperpixel,
- s->dst[2] + 4 * bytesperpixel, ls_uv,
+ mc_chroma_dir(td, mc[4][b->filter][1],
+ td->dst[1] + 4 * bytesperpixel,
+ td->dst[2] + 4 * bytesperpixel, ls_uv,
ref2->data[1], ref2->linesize[1],
ref2->data[2], ref2->linesize[2], tref2,
row << 2, (col << 3) + 4,
@@ -354,8 +356,8 @@ static void FN(inter_pred)(AVCodecContext *ctx)
if (s->ss_h) {
w2 = (w2 + 1) >> 1;
uvmv = ROUNDED_DIV_MVx2(b->mv[0][1], b->mv[1][1]);
- mc_chroma_dir(s, mc[4][b->filter][1],
- s->dst[1], s->dst[2], ls_uv,
+ mc_chroma_dir(td, mc[4][b->filter][1],
+ td->dst[1], td->dst[2], ls_uv,
ref2->data[1], ref2->linesize[1],
ref2->data[2], ref2->linesize[2], tref2,
row << 3, col << 2,
@@ -364,35 +366,35 @@ static void FN(inter_pred)(AVCodecContext *ctx)
// bottom block
// https://code.google.com/p/webm/issues/detail?id=993
uvmv = ROUNDED_DIV_MVx2(b->mv[1][1], b->mv[2][1]);
- mc_chroma_dir(s, mc[4][b->filter][1],
- s->dst[1] + 4 * ls_uv, s->dst[2] + 4 * ls_uv, ls_uv,
+ mc_chroma_dir(td, mc[4][b->filter][1],
+ td->dst[1] + 4 * ls_uv, td->dst[2] + 4 * ls_uv, ls_uv,
ref2->data[1], ref2->linesize[1],
ref2->data[2], ref2->linesize[2], tref2,
(row << 3) + 4, col << 2,
&uvmv, 0, 4, 4, 8, 4, 4, w2, h2, 1);
} else {
- mc_chroma_dir(s, mc[4][b->filter][1],
- s->dst[1], s->dst[2], ls_uv,
+ mc_chroma_dir(td, mc[4][b->filter][1],
+ td->dst[1], td->dst[2], ls_uv,
ref2->data[1], ref2->linesize[1],
ref2->data[2], ref2->linesize[2], tref2,
row << 3, col << 3,
&b->mv[0][1], 0, 0, 8, 8, 4, 4, w2, h2, 1);
- mc_chroma_dir(s, mc[4][b->filter][1],
- s->dst[1] + 4 * bytesperpixel,
- s->dst[2] + 4 * bytesperpixel, ls_uv,
+ mc_chroma_dir(td, mc[4][b->filter][1],
+ td->dst[1] + 4 * bytesperpixel,
+ td->dst[2] + 4 * bytesperpixel, ls_uv,
ref2->data[1], ref2->linesize[1],
ref2->data[2], ref2->linesize[2], tref2,
row << 3, (col << 3) + 4,
&b->mv[1][1], 4, 0, 8, 8, 4, 4, w2, h2, 1);
- mc_chroma_dir(s, mc[4][b->filter][1],
- s->dst[1] + 4 * ls_uv, s->dst[2] + 4 * ls_uv, ls_uv,
+ mc_chroma_dir(td, mc[4][b->filter][1],
+ td->dst[1] + 4 * ls_uv, td->dst[2] + 4 * ls_uv, ls_uv,
ref2->data[1], ref2->linesize[1],
ref2->data[2], ref2->linesize[2], tref2,
(row << 3) + 4, col << 3,
&b->mv[2][1], 0, 4, 8, 8, 4, 4, w2, h2, 1);
- mc_chroma_dir(s, mc[4][b->filter][1],
- s->dst[1] + 4 * ls_uv + 4 * bytesperpixel,
- s->dst[2] + 4 * ls_uv + 4 * bytesperpixel, ls_uv,
+ mc_chroma_dir(td, mc[4][b->filter][1],
+ td->dst[1] + 4 * ls_uv + 4 * bytesperpixel,
+ td->dst[2] + 4 * ls_uv + 4 * bytesperpixel, ls_uv,
ref2->data[1], ref2->linesize[1],
ref2->data[2], ref2->linesize[2], tref2,
(row << 3) + 4, (col << 3) + 4,
@@ -403,29 +405,31 @@ static void FN(inter_pred)(AVCodecContext *ctx)
}
} else {
int bwl = bwlog_tab[0][b->bs];
- int bw = bwh_tab[0][b->bs][0] * 4, bh = bwh_tab[0][b->bs][1] * 4;
- int uvbw = bwh_tab[s->ss_h][b->bs][0] * 4, uvbh = bwh_tab[s->ss_v][b->bs][1] * 4;
+ int bw = ff_vp9_bwh_tab[0][b->bs][0] * 4;
+ int bh = ff_vp9_bwh_tab[0][b->bs][1] * 4;
+ int uvbw = ff_vp9_bwh_tab[s->ss_h][b->bs][0] * 4;
+ int uvbh = ff_vp9_bwh_tab[s->ss_v][b->bs][1] * 4;
- mc_luma_dir(s, mc[bwl][b->filter][0], s->dst[0], ls_y,
+ mc_luma_dir(td, mc[bwl][b->filter][0], td->dst[0], ls_y,
ref1->data[0], ref1->linesize[0], tref1,
row << 3, col << 3, &b->mv[0][0], 0, 0, bw, bh, bw, bh, w1, h1, 0);
w1 = (w1 + s->ss_h) >> s->ss_h;
h1 = (h1 + s->ss_v) >> s->ss_v;
- mc_chroma_dir(s, mc[bwl + s->ss_h][b->filter][0],
- s->dst[1], s->dst[2], ls_uv,
+ mc_chroma_dir(td, mc[bwl + s->ss_h][b->filter][0],
+ td->dst[1], td->dst[2], ls_uv,
ref1->data[1], ref1->linesize[1],
ref1->data[2], ref1->linesize[2], tref1,
row << (3 - s->ss_v), col << (3 - s->ss_h),
&b->mv[0][0], 0, 0, uvbw, uvbh, uvbw, uvbh, w1, h1, 0);
if (b->comp) {
- mc_luma_dir(s, mc[bwl][b->filter][1], s->dst[0], ls_y,
+ mc_luma_dir(td, mc[bwl][b->filter][1], td->dst[0], ls_y,
ref2->data[0], ref2->linesize[0], tref2,
row << 3, col << 3, &b->mv[0][1], 0, 0, bw, bh, bw, bh, w2, h2, 1);
w2 = (w2 + s->ss_h) >> s->ss_h;
h2 = (h2 + s->ss_v) >> s->ss_v;
- mc_chroma_dir(s, mc[bwl + s->ss_h][b->filter][1],
- s->dst[1], s->dst[2], ls_uv,
+ mc_chroma_dir(td, mc[bwl + s->ss_h][b->filter][1],
+ td->dst[1], td->dst[2], ls_uv,
ref2->data[1], ref2->linesize[1],
ref2->data[2], ref2->linesize[2], tref2,
row << (3 - s->ss_v), col << (3 - s->ss_h),
diff --git a/media/ffvpx/libavcodec/vp9block.c b/media/ffvpx/libavcodec/vp9block.c
new file mode 100644
index 0000000000..1c3f7a7225
--- /dev/null
+++ b/media/ffvpx/libavcodec/vp9block.c
@@ -0,0 +1,1449 @@
+/*
+ * VP9 compatible video decoder
+ *
+ * Copyright (C) 2013 Ronald S. Bultje <rsbultje gmail com>
+ * Copyright (C) 2013 Clément Bœsch <u pkh me>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/avassert.h"
+
+#include "avcodec.h"
+#include "internal.h"
+#include "videodsp.h"
+#include "vp56.h"
+#include "vp9.h"
+#include "vp9data.h"
+#include "vp9dec.h"
+
+static av_always_inline void setctx_2d(uint8_t *ptr, int w, int h,
+ ptrdiff_t stride, int v)
+{
+ switch (w) {
+ case 1:
+ do {
+ *ptr = v;
+ ptr += stride;
+ } while (--h);
+ break;
+ case 2: {
+ int v16 = v * 0x0101;
+ do {
+ AV_WN16A(ptr, v16);
+ ptr += stride;
+ } while (--h);
+ break;
+ }
+ case 4: {
+ uint32_t v32 = v * 0x01010101;
+ do {
+ AV_WN32A(ptr, v32);
+ ptr += stride;
+ } while (--h);
+ break;
+ }
+ case 8: {
+#if HAVE_FAST_64BIT
+ uint64_t v64 = v * 0x0101010101010101ULL;
+ do {
+ AV_WN64A(ptr, v64);
+ ptr += stride;
+ } while (--h);
+#else
+ uint32_t v32 = v * 0x01010101;
+ do {
+ AV_WN32A(ptr, v32);
+ AV_WN32A(ptr + 4, v32);
+ ptr += stride;
+ } while (--h);
+#endif
+ break;
+ }
+ }
+}
+
+static void decode_mode(VP9TileData *td)
+{
+ static const uint8_t left_ctx[N_BS_SIZES] = {
+ 0x0, 0x8, 0x0, 0x8, 0xc, 0x8, 0xc, 0xe, 0xc, 0xe, 0xf, 0xe, 0xf
+ };
+ static const uint8_t above_ctx[N_BS_SIZES] = {
+ 0x0, 0x0, 0x8, 0x8, 0x8, 0xc, 0xc, 0xc, 0xe, 0xe, 0xe, 0xf, 0xf
+ };
+ static const uint8_t max_tx_for_bl_bp[N_BS_SIZES] = {
+ TX_32X32, TX_32X32, TX_32X32, TX_32X32, TX_16X16, TX_16X16,
+ TX_16X16, TX_8X8, TX_8X8, TX_8X8, TX_4X4, TX_4X4, TX_4X4
+ };
+ VP9Context *s = td->s;
+ VP9Block *b = td->b;
+ int row = td->row, col = td->col, row7 = td->row7;
+ enum TxfmMode max_tx = max_tx_for_bl_bp[b->bs];
+ int bw4 = ff_vp9_bwh_tab[1][b->bs][0], w4 = FFMIN(s->cols - col, bw4);
+ int bh4 = ff_vp9_bwh_tab[1][b->bs][1], h4 = FFMIN(s->rows - row, bh4), y;
+ int have_a = row > 0, have_l = col > td->tile_col_start;
+ int vref, filter_id;
+
+ if (!s->s.h.segmentation.enabled) {
+ b->seg_id = 0;
+ } else if (s->s.h.keyframe || s->s.h.intraonly) {
+ b->seg_id = !s->s.h.segmentation.update_map ? 0 :
+ vp8_rac_get_tree(td->c, ff_vp9_segmentation_tree, s->s.h.segmentation.prob);
+ } else if (!s->s.h.segmentation.update_map ||
+ (s->s.h.segmentation.temporal &&
+ vp56_rac_get_prob_branchy(td->c,
+ s->s.h.segmentation.pred_prob[s->above_segpred_ctx[col] +
+ td->left_segpred_ctx[row7]]))) {
+ if (!s->s.h.errorres && s->s.frames[REF_FRAME_SEGMAP].segmentation_map) {
+ int pred = 8, x;
+ uint8_t *refsegmap = s->s.frames[REF_FRAME_SEGMAP].segmentation_map;
+
+ if (!s->s.frames[REF_FRAME_SEGMAP].uses_2pass)
+ ff_thread_await_progress(&s->s.frames[REF_FRAME_SEGMAP].tf, row >> 3, 0);
+ for (y = 0; y < h4; y++) {
+ int idx_base = (y + row) * 8 * s->sb_cols + col;
+ for (x = 0; x < w4; x++)
+ pred = FFMIN(pred, refsegmap[idx_base + x]);
+ }
+ av_assert1(pred < 8);
+ b->seg_id = pred;
+ } else {
+ b->seg_id = 0;
+ }
+
+ memset(&s->above_segpred_ctx[col], 1, w4);
+ memset(&td->left_segpred_ctx[row7], 1, h4);
+ } else {
+ b->seg_id = vp8_rac_get_tree(td->c, ff_vp9_segmentation_tree,
+ s->s.h.segmentation.prob);
+
+ memset(&s->above_segpred_ctx[col], 0, w4);
+ memset(&td->left_segpred_ctx[row7], 0, h4);
+ }
+ if (s->s.h.segmentation.enabled &&
+ (s->s.h.segmentation.update_map || s->s.h.keyframe || s->s.h.intraonly)) {
+ setctx_2d(&s->s.frames[CUR_FRAME].segmentation_map[row * 8 * s->sb_cols + col],
+ bw4, bh4, 8 * s->sb_cols, b->seg_id);
+ }
+
+ b->skip = s->s.h.segmentation.enabled &&
+ s->s.h.segmentation.feat[b->seg_id].skip_enabled;
+ if (!b->skip) {
+ int c = td->left_skip_ctx[row7] + s->above_skip_ctx[col];
+ b->skip = vp56_rac_get_prob(td->c, s->prob.p.skip[c]);
+ td->counts.skip[c][b->skip]++;
+ }
+
+ if (s->s.h.keyframe || s->s.h.intraonly) {
+ b->intra = 1;
+ } else if (s->s.h.segmentation.enabled && s->s.h.segmentation.feat[b->seg_id].ref_enabled) {
+ b->intra = !s->s.h.segmentation.feat[b->seg_id].ref_val;
+ } else {
+ int c, bit;
+
+ if (have_a && have_l) {
+ c = s->above_intra_ctx[col] + td->left_intra_ctx[row7];
+ c += (c == 2);
+ } else {
+ c = have_a ? 2 * s->above_intra_ctx[col] :
+ have_l ? 2 * td->left_intra_ctx[row7] : 0;
+ }
+ bit = vp56_rac_get_prob(td->c, s->prob.p.intra[c]);
+ td->counts.intra[c][bit]++;
+ b->intra = !bit;
+ }
+
+ if ((b->intra || !b->skip) && s->s.h.txfmmode == TX_SWITCHABLE) {
+ int c;
+ if (have_a) {
+ if (have_l) {
+ c = (s->above_skip_ctx[col] ? max_tx :
+ s->above_txfm_ctx[col]) +
+ (td->left_skip_ctx[row7] ? max_tx :
+ td->left_txfm_ctx[row7]) > max_tx;
+ } else {
+ c = s->above_skip_ctx[col] ? 1 :
+ (s->above_txfm_ctx[col] * 2 > max_tx);
+ }
+ } else if (have_l) {
+ c = td->left_skip_ctx[row7] ? 1 :
+ (td->left_txfm_ctx[row7] * 2 > max_tx);
+ } else {
+ c = 1;
+ }
+ switch (max_tx) {
+ case TX_32X32:
+ b->tx = vp56_rac_get_prob(td->c, s->prob.p.tx32p[c][0]);
+ if (b->tx) {
+ b->tx += vp56_rac_get_prob(td->c, s->prob.p.tx32p[c][1]);
+ if (b->tx == 2)
+ b->tx += vp56_rac_get_prob(td->c, s->prob.p.tx32p[c][2]);
+ }
+ td->counts.tx32p[c][b->tx]++;
+ break;
+ case TX_16X16:
+ b->tx = vp56_rac_get_prob(td->c, s->prob.p.tx16p[c][0]);
+ if (b->tx)
+ b->tx += vp56_rac_get_prob(td->c, s->prob.p.tx16p[c][1]);
+ td->counts.tx16p[c][b->tx]++;
+ break;
+ case TX_8X8:
+ b->tx = vp56_rac_get_prob(td->c, s->prob.p.tx8p[c]);
+ td->counts.tx8p[c][b->tx]++;
+ break;
+ case TX_4X4:
+ b->tx = TX_4X4;
+ break;
+ }
+ } else {
+ b->tx = FFMIN(max_tx, s->s.h.txfmmode);
+ }
+
+ if (s->s.h.keyframe || s->s.h.intraonly) {
+ uint8_t *a = &s->above_mode_ctx[col * 2];
+ uint8_t *l = &td->left_mode_ctx[(row7) << 1];
+
+ b->comp = 0;
+ if (b->bs > BS_8x8) {
+ // FIXME the memory storage intermediates here aren't really
+ // necessary, they're just there to make the code slightly
+ // simpler for now
+ b->mode[0] =
+ a[0] = vp8_rac_get_tree(td->c, ff_vp9_intramode_tree,
+ ff_vp9_default_kf_ymode_probs[a[0]][l[0]]);
+ if (b->bs != BS_8x4) {
+ b->mode[1] = vp8_rac_get_tree(td->c, ff_vp9_intramode_tree,
+ ff_vp9_default_kf_ymode_probs[a[1]][b->mode[0]]);
+ l[0] =
+ a[1] = b->mode[1];
+ } else {
+ l[0] =
+ a[1] =
+ b->mode[1] = b->mode[0];
+ }
+ if (b->bs != BS_4x8) {
+ b->mode[2] =
+ a[0] = vp8_rac_get_tree(td->c, ff_vp9_intramode_tree,
+ ff_vp9_default_kf_ymode_probs[a[0]][l[1]]);
+ if (b->bs != BS_8x4) {
+ b->mode[3] = vp8_rac_get_tree(td->c, ff_vp9_intramode_tree,
+ ff_vp9_default_kf_ymode_probs[a[1]][b->mode[2]]);
+ l[1] =
+ a[1] = b->mode[3];
+ } else {
+ l[1] =
+ a[1] =
+ b->mode[3] = b->mode[2];
+ }
+ } else {
+ b->mode[2] = b->mode[0];
+ l[1] =
+ a[1] =
+ b->mode[3] = b->mode[1];
+ }
+ } else {
+ b->mode[0] = vp8_rac_get_tree(td->c, ff_vp9_intramode_tree,
+ ff_vp9_default_kf_ymode_probs[*a][*l]);
+ b->mode[3] =
+ b->mode[2] =
+ b->mode[1] = b->mode[0];
+ // FIXME this can probably be optimized
+ memset(a, b->mode[0], ff_vp9_bwh_tab[0][b->bs][0]);
+ memset(l, b->mode[0], ff_vp9_bwh_tab[0][b->bs][1]);
+ }
+ b->uvmode = vp8_rac_get_tree(td->c, ff_vp9_intramode_tree,
+ ff_vp9_default_kf_uvmode_probs[b->mode[3]]);
+ } else if (b->intra) {
+ b->comp = 0;
+ if (b->bs > BS_8x8) {
+ b->mode[0] = vp8_rac_get_tree(td->c, ff_vp9_intramode_tree,
+ s->prob.p.y_mode[0]);
+ td->counts.y_mode[0][b->mode[0]]++;
+ if (b->bs != BS_8x4) {
+ b->mode[1] = vp8_rac_get_tree(td->c, ff_vp9_intramode_tree,
+ s->prob.p.y_mode[0]);
+ td->counts.y_mode[0][b->mode[1]]++;
+ } else {
+ b->mode[1] = b->mode[0];
+ }
+ if (b->bs != BS_4x8) {
+ b->mode[2] = vp8_rac_get_tree(td->c, ff_vp9_intramode_tree,
+ s->prob.p.y_mode[0]);
+ td->counts.y_mode[0][b->mode[2]]++;
+ if (b->bs != BS_8x4) {
+ b->mode[3] = vp8_rac_get_tree(td->c, ff_vp9_intramode_tree,
+ s->prob.p.y_mode[0]);
+ td->counts.y_mode[0][b->mode[3]]++;
+ } else {
+ b->mode[3] = b->mode[2];
+ }
+ } else {
+ b->mode[2] = b->mode[0];
+ b->mode[3] = b->mode[1];
+ }
+ } else {
+ static const uint8_t size_group[10] = {
+ 3, 3, 3, 3, 2, 2, 2, 1, 1, 1
+ };
+ int sz = size_group[b->bs];
+
+ b->mode[0] = vp8_rac_get_tree(td->c, ff_vp9_intramode_tree,
+ s->prob.p.y_mode[sz]);
+ b->mode[1] =
+ b->mode[2] =
+ b->mode[3] = b->mode[0];
+ td->counts.y_mode[sz][b->mode[3]]++;
+ }
+ b->uvmode = vp8_rac_get_tree(td->c, ff_vp9_intramode_tree,
+ s->prob.p.uv_mode[b->mode[3]]);
+ td->counts.uv_mode[b->mode[3]][b->uvmode]++;
+ } else {
+ static const uint8_t inter_mode_ctx_lut[14][14] = {
+ { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
+ { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
+ { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
+ { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
+ { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
+ { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
+ { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
+ { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
+ { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
+ { 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5 },
+ { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2, 2, 1, 3 },
+ { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 2, 2, 1, 3 },
+ { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 1, 1, 0, 3 },
+ { 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3, 3, 3, 4 },
+ };
+
+ if (s->s.h.segmentation.enabled && s->s.h.segmentation.feat[b->seg_id].ref_enabled) {
+ av_assert2(s->s.h.segmentation.feat[b->seg_id].ref_val != 0);
+ b->comp = 0;
+ b->ref[0] = s->s.h.segmentation.feat[b->seg_id].ref_val - 1;
+ } else {
+ // read comp_pred flag
+ if (s->s.h.comppredmode != PRED_SWITCHABLE) {
+ b->comp = s->s.h.comppredmode == PRED_COMPREF;
+ } else {
+ int c;
+
+ // FIXME add intra as ref=0xff (or -1) to make these easier?
+ if (have_a) {
+ if (have_l) {
+ if (s->above_comp_ctx[col] && td->left_comp_ctx[row7]) {
+ c = 4;
+ } else if (s->above_comp_ctx[col]) {
+ c = 2 + (td->left_intra_ctx[row7] ||
+ td->left_ref_ctx[row7] == s->s.h.fixcompref);
+ } else if (td->left_comp_ctx[row7]) {
+ c = 2 + (s->above_intra_ctx[col] ||
+ s->above_ref_ctx[col] == s->s.h.fixcompref);
+ } else {
+ c = (!s->above_intra_ctx[col] &&
+ s->above_ref_ctx[col] == s->s.h.fixcompref) ^
+ (!td->left_intra_ctx[row7] &&
+ td->left_ref_ctx[row & 7] == s->s.h.fixcompref);
+ }
+ } else {
+ c = s->above_comp_ctx[col] ? 3 :
+ (!s->above_intra_ctx[col] && s->above_ref_ctx[col] == s->s.h.fixcompref);
+ }
+ } else if (have_l) {
+ c = td->left_comp_ctx[row7] ? 3 :
+ (!td->left_intra_ctx[row7] && td->left_ref_ctx[row7] == s->s.h.fixcompref);
+ } else {
+ c = 1;
+ }
+ b->comp = vp56_rac_get_prob(td->c, s->prob.p.comp[c]);
+ td->counts.comp[c][b->comp]++;
+ }
+
+ // read actual references
+ // FIXME probably cache a few variables here to prevent repetitive
+ // memory accesses below
+ if (b->comp) { /* two references */
+ int fix_idx = s->s.h.signbias[s->s.h.fixcompref], var_idx = !fix_idx, c, bit;
+
+ b->ref[fix_idx] = s->s.h.fixcompref;
+ // FIXME can this codeblob be replaced by some sort of LUT?
+ if (have_a) {
+ if (have_l) {
+ if (s->above_intra_ctx[col]) {
+ if (td->left_intra_ctx[row7]) {
+ c = 2;
+ } else {
+ c = 1 + 2 * (td->left_ref_ctx[row7] != s->s.h.varcompref[1]);
+ }
+ } else if (td->left_intra_ctx[row7]) {
+ c = 1 + 2 * (s->above_ref_ctx[col] != s->s.h.varcompref[1]);
+ } else {
+ int refl = td->left_ref_ctx[row7], refa = s->above_ref_ctx[col];
+
+ if (refl == refa && refa == s->s.h.varcompref[1]) {
+ c = 0;
+ } else if (!td->left_comp_ctx[row7] && !s->above_comp_ctx[col]) {
+ if ((refa == s->s.h.fixcompref && refl == s->s.h.varcompref[0]) ||
+ (refl == s->s.h.fixcompref && refa == s->s.h.varcompref[0])) {
+ c = 4;
+ } else {
+ c = (refa == refl) ? 3 : 1;
+ }
+ } else if (!td->left_comp_ctx[row7]) {
+ if (refa == s->s.h.varcompref[1] && refl != s->s.h.varcompref[1]) {
+ c = 1;
+ } else {
+ c = (refl == s->s.h.varcompref[1] &&
+ refa != s->s.h.varcompref[1]) ? 2 : 4;
+ }
+ } else if (!s->above_comp_ctx[col]) {
+ if (refl == s->s.h.varcompref[1] && refa != s->s.h.varcompref[1]) {
+ c = 1;
+ } else {
+ c = (refa == s->s.h.varcompref[1] &&
+ refl != s->s.h.varcompref[1]) ? 2 : 4;
+ }
+ } else {
+ c = (refl == refa) ? 4 : 2;
+ }
+ }
+ } else {
+ if (s->above_intra_ctx[col]) {
+ c = 2;
+ } else if (s->above_comp_ctx[col]) {
+ c = 4 * (s->above_ref_ctx[col] != s->s.h.varcompref[1]);
+ } else {
+ c = 3 * (s->above_ref_ctx[col] != s->s.h.varcompref[1]);
+ }
+ }
+ } else if (have_l) {
+ if (td->left_intra_ctx[row7]) {
+ c = 2;
+ } else if (td->left_comp_ctx[row7]) {
+ c = 4 * (td->left_ref_ctx[row7] != s->s.h.varcompref[1]);
+ } else {
+ c = 3 * (td->left_ref_ctx[row7] != s->s.h.varcompref[1]);
+ }
+ } else {
+ c = 2;
+ }
+ bit = vp56_rac_get_prob(td->c, s->prob.p.comp_ref[c]);
+ b->ref[var_idx] = s->s.h.varcompref[bit];
+ td->counts.comp_ref[c][bit]++;
+ } else /* single reference */ {
+ int bit, c;
+
+ if (have_a && !s->above_intra_ctx[col]) {
+ if (have_l && !td->left_intra_ctx[row7]) {
+ if (td->left_comp_ctx[row7]) {
+ if (s->above_comp_ctx[col]) {
+ c = 1 + (!s->s.h.fixcompref || !td->left_ref_ctx[row7] ||
+ !s->above_ref_ctx[col]);
+ } else {
+ c = (3 * !s->above_ref_ctx[col]) +
+ (!s->s.h.fixcompref || !td->left_ref_ctx[row7]);
+ }
+ } else if (s->above_comp_ctx[col]) {
+ c = (3 * !td->left_ref_ctx[row7]) +
+ (!s->s.h.fixcompref || !s->above_ref_ctx[col]);
+ } else {
+ c = 2 * !td->left_ref_ctx[row7] + 2 * !s->above_ref_ctx[col];
+ }
+ } else if (s->above_intra_ctx[col]) {
+ c = 2;
+ } else if (s->above_comp_ctx[col]) {
+ c = 1 + (!s->s.h.fixcompref || !s->above_ref_ctx[col]);
+ } else {
+ c = 4 * (!s->above_ref_ctx[col]);
+ }
+ } else if (have_l && !td->left_intra_ctx[row7]) {
+ if (td->left_intra_ctx[row7]) {
+ c = 2;
+ } else if (td->left_comp_ctx[row7]) {
+ c = 1 + (!s->s.h.fixcompref || !td->left_ref_ctx[row7]);
+ } else {
+ c = 4 * (!td->left_ref_ctx[row7]);
+ }
+ } else {
+ c = 2;
+ }
+ bit = vp56_rac_get_prob(td->c, s->prob.p.single_ref[c][0]);
+ td->counts.single_ref[c][0][bit]++;
+ if (!bit) {
+ b->ref[0] = 0;
+ } else {
+ // FIXME can this codeblob be replaced by some sort of LUT?
+ if (have_a) {
+ if (have_l) {
+ if (td->left_intra_ctx[row7]) {
+ if (s->above_intra_ctx[col]) {
+ c = 2;
+ } else if (s->above_comp_ctx[col]) {
+ c = 1 + 2 * (s->s.h.fixcompref == 1 ||
+ s->above_ref_ctx[col] == 1);
+ } else if (!s->above_ref_ctx[col]) {
+ c = 3;
+ } else {
+ c = 4 * (s->above_ref_ctx[col] == 1);
+ }
+ } else if (s->above_intra_ctx[col]) {
+ if (td->left_intra_ctx[row7]) {
+ c = 2;
+ } else if (td->left_comp_ctx[row7]) {
+ c = 1 + 2 * (s->s.h.fixcompref == 1 ||
+ td->left_ref_ctx[row7] == 1);
+ } else if (!td->left_ref_ctx[row7]) {
+ c = 3;
+ } else {
+ c = 4 * (td->left_ref_ctx[row7] == 1);
+ }
+ } else if (s->above_comp_ctx[col]) {
+ if (td->left_comp_ctx[row7]) {
+ if (td->left_ref_ctx[row7] == s->above_ref_ctx[col]) {
+ c = 3 * (s->s.h.fixcompref == 1 ||
+ td->left_ref_ctx[row7] == 1);
+ } else {
+ c = 2;
+ }
+ } else if (!td->left_ref_ctx[row7]) {
+ c = 1 + 2 * (s->s.h.fixcompref == 1 ||
+ s->above_ref_ctx[col] == 1);
+ } else {
+ c = 3 * (td->left_ref_ctx[row7] == 1) +
+ (s->s.h.fixcompref == 1 || s->above_ref_ctx[col] == 1);
+ }
+ } else if (td->left_comp_ctx[row7]) {
+ if (!s->above_ref_ctx[col]) {
+ c = 1 + 2 * (s->s.h.fixcompref == 1 ||
+ td->left_ref_ctx[row7] == 1);
+ } else {
+ c = 3 * (s->above_ref_ctx[col] == 1) +
+ (s->s.h.fixcompref == 1 || td->left_ref_ctx[row7] == 1);
+ }
+ } else if (!s->above_ref_ctx[col]) {
+ if (!td->left_ref_ctx[row7]) {
+ c = 3;
+ } else {
+ c = 4 * (td->left_ref_ctx[row7] == 1);
+ }
+ } else if (!td->left_ref_ctx[row7]) {
+ c = 4 * (s->above_ref_ctx[col] == 1);
+ } else {
+ c = 2 * (td->left_ref_ctx[row7] == 1) +
+ 2 * (s->above_ref_ctx[col] == 1);
+ }
+ } else {
+ if (s->above_intra_ctx[col] ||
+ (!s->above_comp_ctx[col] && !s->above_ref_ctx[col])) {
+ c = 2;
+ } else if (s->above_comp_ctx[col]) {
+ c = 3 * (s->s.h.fixcompref == 1 || s->above_ref_ctx[col] == 1);
+ } else {
+ c = 4 * (s->above_ref_ctx[col] == 1);
+ }
+ }
+ } else if (have_l) {
+ if (td->left_intra_ctx[row7] ||
+ (!td->left_comp_ctx[row7] && !td->left_ref_ctx[row7])) {
+ c = 2;
+ } else if (td->left_comp_ctx[row7]) {
+ c = 3 * (s->s.h.fixcompref == 1 || td->left_ref_ctx[row7] == 1);
+ } else {
+ c = 4 * (td->left_ref_ctx[row7] == 1);
+ }
+ } else {
+ c = 2;
+ }
+ bit = vp56_rac_get_prob(td->c, s->prob.p.single_ref[c][1]);
+ td->counts.single_ref[c][1][bit]++;
+ b->ref[0] = 1 + bit;
+ }
+ }
+ }
+
+ if (b->bs <= BS_8x8) {
+ if (s->s.h.segmentation.enabled && s->s.h.segmentation.feat[b->seg_id].skip_enabled) {
+ b->mode[0] =
+ b->mode[1] =
+ b->mode[2] =
+ b->mode[3] = ZEROMV;
+ } else {
+ static const uint8_t off[10] = {
+ 3, 0, 0, 1, 0, 0, 0, 0, 0, 0
+ };
+
+ // FIXME this needs to use the LUT tables from find_ref_mvs
+ // because not all are -1,0/0,-1
+ int c = inter_mode_ctx_lut[s->above_mode_ctx[col + off[b->bs]]]
+ [td->left_mode_ctx[row7 + off[b->bs]]];
+
+ b->mode[0] = vp8_rac_get_tree(td->c, ff_vp9_inter_mode_tree,
+ s->prob.p.mv_mode[c]);
+ b->mode[1] =
+ b->mode[2] =
+ b->mode[3] = b->mode[0];
+ td->counts.mv_mode[c][b->mode[0] - 10]++;
+ }
+ }
+
+ if (s->s.h.filtermode == FILTER_SWITCHABLE) {
+ int c;
+
+ if (have_a && s->above_mode_ctx[col] >= NEARESTMV) {
+ if (have_l && td->left_mode_ctx[row7] >= NEARESTMV) {
+ c = s->above_filter_ctx[col] == td->left_filter_ctx[row7] ?
+ td->left_filter_ctx[row7] : 3;
+ } else {
+ c = s->above_filter_ctx[col];
+ }
+ } else if (have_l && td->left_mode_ctx[row7] >= NEARESTMV) {
+ c = td->left_filter_ctx[row7];
+ } else {
+ c = 3;
+ }
+
+ filter_id = vp8_rac_get_tree(td->c, ff_vp9_filter_tree,
+ s->prob.p.filter[c]);
+ td->counts.filter[c][filter_id]++;
+ b->filter = ff_vp9_filter_lut[filter_id];
+ } else {
+ b->filter = s->s.h.filtermode;
+ }
+
+ if (b->bs > BS_8x8) {
+ int c = inter_mode_ctx_lut[s->above_mode_ctx[col]][td->left_mode_ctx[row7]];
+
+ b->mode[0] = vp8_rac_get_tree(td->c, ff_vp9_inter_mode_tree,
+ s->prob.p.mv_mode[c]);
+ td->counts.mv_mode[c][b->mode[0] - 10]++;
+ ff_vp9_fill_mv(td, b->mv[0], b->mode[0], 0);
+
+ if (b->bs != BS_8x4) {
+ b->mode[1] = vp8_rac_get_tree(td->c, ff_vp9_inter_mode_tree,
+ s->prob.p.mv_mode[c]);
+ td->counts.mv_mode[c][b->mode[1] - 10]++;
+ ff_vp9_fill_mv(td, b->mv[1], b->mode[1], 1);
+ } else {
+ b->mode[1] = b->mode[0];
+ AV_COPY32(&b->mv[1][0], &b->mv[0][0]);
+ AV_COPY32(&b->mv[1][1], &b->mv[0][1]);
+ }
+
+ if (b->bs != BS_4x8) {
+ b->mode[2] = vp8_rac_get_tree(td->c, ff_vp9_inter_mode_tree,
+ s->prob.p.mv_mode[c]);
+ td->counts.mv_mode[c][b->mode[2] - 10]++;
+ ff_vp9_fill_mv(td, b->mv[2], b->mode[2], 2);
+
+ if (b->bs != BS_8x4) {
+ b->mode[3] = vp8_rac_get_tree(td->c, ff_vp9_inter_mode_tree,
+ s->prob.p.mv_mode[c]);
+ td->counts.mv_mode[c][b->mode[3] - 10]++;
+ ff_vp9_fill_mv(td, b->mv[3], b->mode[3], 3);
+ } else {
+ b->mode[3] = b->mode[2];
+ AV_COPY32(&b->mv[3][0], &b->mv[2][0]);
+ AV_COPY32(&b->mv[3][1], &b->mv[2][1]);
+ }
+ } else {
+ b->mode[2] = b->mode[0];
+ AV_COPY32(&b->mv[2][0], &b->mv[0][0]);
+ AV_COPY32(&b->mv[2][1], &b->mv[0][1]);
+ b->mode[3] = b->mode[1];
+ AV_COPY32(&b->mv[3][0], &b->mv[1][0]);
+ AV_COPY32(&b->mv[3][1], &b->mv[1][1]);
+ }
+ } else {
+ ff_vp9_fill_mv(td, b->mv[0], b->mode[0], -1);
+ AV_COPY32(&b->mv[1][0], &b->mv[0][0]);
+ AV_COPY32(&b->mv[2][0], &b->mv[0][0]);
+ AV_COPY32(&b->mv[3][0], &b->mv[0][0]);
+ AV_COPY32(&b->mv[1][1], &b->mv[0][1]);
+ AV_COPY32(&b->mv[2][1], &b->mv[0][1]);
+ AV_COPY32(&b->mv[3][1], &b->mv[0][1]);
+ }
+
+ vref = b->ref[b->comp ? s->s.h.signbias[s->s.h.varcompref[0]] : 0];
+ }
+
+#if HAVE_FAST_64BIT
+#define SPLAT_CTX(var, val, n) \
+ switch (n) { \
+ case 1: var = val; break; \
+ case 2: AV_WN16A(&var, val * 0x0101); break; \
+ case 4: AV_WN32A(&var, val * 0x01010101); break; \
+ case 8: AV_WN64A(&var, val * 0x0101010101010101ULL); break; \
+ case 16: { \
+ uint64_t v64 = val * 0x0101010101010101ULL; \
+ AV_WN64A( &var, v64); \
+ AV_WN64A(&((uint8_t *) &var)[8], v64); \
+ break; \
+ } \
+ }
+#else
+#define SPLAT_CTX(var, val, n) \
+ switch (n) { \
+ case 1: var = val; break; \
+ case 2: AV_WN16A(&var, val * 0x0101); break; \
+ case 4: AV_WN32A(&var, val * 0x01010101); break; \
+ case 8: { \
+ uint32_t v32 = val * 0x01010101; \
+ AV_WN32A( &var, v32); \
+ AV_WN32A(&((uint8_t *) &var)[4], v32); \
+ break; \
+ } \
+ case 16: { \
+ uint32_t v32 = val * 0x01010101; \
+ AV_WN32A( &var, v32); \
+ AV_WN32A(&((uint8_t *) &var)[4], v32); \
+ AV_WN32A(&((uint8_t *) &var)[8], v32); \
+ AV_WN32A(&((uint8_t *) &var)[12], v32); \
+ break; \
+ } \
+ }
+#endif
+
+ switch (ff_vp9_bwh_tab[1][b->bs][0]) {
+#define SET_CTXS(perf, dir, off, n) \
+ do { \
+ SPLAT_CTX(perf->dir##_skip_ctx[off], b->skip, n); \
+ SPLAT_CTX(perf->dir##_txfm_ctx[off], b->tx, n); \
+ SPLAT_CTX(perf->dir##_partition_ctx[off], dir##_ctx[b->bs], n); \
+ if (!s->s.h.keyframe && !s->s.h.intraonly) { \
+ SPLAT_CTX(perf->dir##_intra_ctx[off], b->intra, n); \
+ SPLAT_CTX(perf->dir##_comp_ctx[off], b->comp, n); \
+ SPLAT_CTX(perf->dir##_mode_ctx[off], b->mode[3], n); \
+ if (!b->intra) { \
+ SPLAT_CTX(perf->dir##_ref_ctx[off], vref, n); \
+ if (s->s.h.filtermode == FILTER_SWITCHABLE) { \
+ SPLAT_CTX(perf->dir##_filter_ctx[off], filter_id, n); \
+ } \
+ } \
+ } \
+ } while (0)
+ case 1: SET_CTXS(s, above, col, 1); break;
+ case 2: SET_CTXS(s, above, col, 2); break;
+ case 4: SET_CTXS(s, above, col, 4); break;
+ case 8: SET_CTXS(s, above, col, 8); break;
+ }
+ switch (ff_vp9_bwh_tab[1][b->bs][1]) {
+ case 1: SET_CTXS(td, left, row7, 1); break;
+ case 2: SET_CTXS(td, left, row7, 2); break;
+ case 4: SET_CTXS(td, left, row7, 4); break;
+ case 8: SET_CTXS(td, left, row7, 8); break;
+ }
+#undef SPLAT_CTX
+#undef SET_CTXS
+
+ if (!s->s.h.keyframe && !s->s.h.intraonly) {
+ if (b->bs > BS_8x8) {
+ int mv0 = AV_RN32A(&b->mv[3][0]), mv1 = AV_RN32A(&b->mv[3][1]);
+
+ AV_COPY32(&td->left_mv_ctx[row7 * 2 + 0][0], &b->mv[1][0]);
+ AV_COPY32(&td->left_mv_ctx[row7 * 2 + 0][1], &b->mv[1][1]);
+ AV_WN32A(&td->left_mv_ctx[row7 * 2 + 1][0], mv0);
+ AV_WN32A(&td->left_mv_ctx[row7 * 2 + 1][1], mv1);
+ AV_COPY32(&s->above_mv_ctx[col * 2 + 0][0], &b->mv[2][0]);
+ AV_COPY32(&s->above_mv_ctx[col * 2 + 0][1], &b->mv[2][1]);
+ AV_WN32A(&s->above_mv_ctx[col * 2 + 1][0], mv0);
+ AV_WN32A(&s->above_mv_ctx[col * 2 + 1][1], mv1);
+ } else {
+ int n, mv0 = AV_RN32A(&b->mv[3][0]), mv1 = AV_RN32A(&b->mv[3][1]);
+
+ for (n = 0; n < w4 * 2; n++) {
+ AV_WN32A(&s->above_mv_ctx[col * 2 + n][0], mv0);
+ AV_WN32A(&s->above_mv_ctx[col * 2 + n][1], mv1);
+ }
+ for (n = 0; n < h4 * 2; n++) {
+ AV_WN32A(&td->left_mv_ctx[row7 * 2 + n][0], mv0);
+ AV_WN32A(&td->left_mv_ctx[row7 * 2 + n][1], mv1);
+ }
+ }
+ }
+
+ // FIXME kinda ugly
+ for (y = 0; y < h4; y++) {
+ int x, o = (row + y) * s->sb_cols * 8 + col;
+ VP9mvrefPair *mv = &s->s.frames[CUR_FRAME].mv[o];
+
+ if (b->intra) {
+ for (x = 0; x < w4; x++) {
+ mv[x].ref[0] =
+ mv[x].ref[1] = -1;
+ }
+ } else if (b->comp) {
+ for (x = 0; x < w4; x++) {
+ mv[x].ref[0] = b->ref[0];
+ mv[x].ref[1] = b->ref[1];
+ AV_COPY32(&mv[x].mv[0], &b->mv[3][0]);
+ AV_COPY32(&mv[x].mv[1], &b->mv[3][1]);
+ }
+ } else {
+ for (x = 0; x < w4; x++) {
+ mv[x].ref[0] = b->ref[0];
+ mv[x].ref[1] = -1;
+ AV_COPY32(&mv[x].mv[0], &b->mv[3][0]);
+ }
+ }
+ }
+}
+
+// FIXME merge cnt/eob arguments?
+static av_always_inline int
+decode_coeffs_b_generic(VP56RangeCoder *c, int16_t *coef, int n_coeffs,
+ int is_tx32x32, int is8bitsperpixel, int bpp, unsigned (*cnt)[6][3],
+ unsigned (*eob)[6][2], uint8_t (*p)[6][11],
+ int nnz, const int16_t *scan, const int16_t (*nb)[2],
+ const int16_t *band_counts, int16_t *qmul)
+{
+ int i = 0, band = 0, band_left = band_counts[band];
+ const uint8_t *tp = p[0][nnz];
+ uint8_t cache[1024];
+
+ do {
+ int val, rc;
+
+ val = vp56_rac_get_prob_branchy(c, tp[0]); // eob
+ eob[band][nnz][val]++;
+ if (!val)
+ break;
+
+skip_eob:
+ if (!vp56_rac_get_prob_branchy(c, tp[1])) { // zero
+ cnt[band][nnz][0]++;
+ if (!--band_left)
+ band_left = band_counts[++band];
+ cache[scan[i]] = 0;
+ nnz = (1 + cache[nb[i][0]] + cache[nb[i][1]]) >> 1;
+ tp = p[band][nnz];
+ if (++i == n_coeffs)
+ break; //invalid input; blocks should end with EOB
+ goto skip_eob;
+ }
+
+ rc = scan[i];
+ if (!vp56_rac_get_prob_branchy(c, tp[2])) { // one
+ cnt[band][nnz][1]++;
+ val = 1;
+ cache[rc] = 1;
+ } else {
+ cnt[band][nnz][2]++;
+ if (!vp56_rac_get_prob_branchy(c, tp[3])) { // 2, 3, 4
+ if (!vp56_rac_get_prob_branchy(c, tp[4])) {
+ cache[rc] = val = 2;
+ } else {
+ val = 3 + vp56_rac_get_prob(c, tp[5]);
+ cache[rc] = 3;
+ }
+ } else if (!vp56_rac_get_prob_branchy(c, tp[6])) { // cat1/2
+ cache[rc] = 4;
+ if (!vp56_rac_get_prob_branchy(c, tp[7])) {
+ val = vp56_rac_get_prob(c, 159) + 5;
+ } else {
+ val = (vp56_rac_get_prob(c, 165) << 1) + 7;
+ val += vp56_rac_get_prob(c, 145);
+ }
+ } else { // cat 3-6
+ cache[rc] = 5;
+ if (!vp56_rac_get_prob_branchy(c, tp[8])) {
+ if (!vp56_rac_get_prob_branchy(c, tp[9])) {
+ val = 11 + (vp56_rac_get_prob(c, 173) << 2);
+ val += (vp56_rac_get_prob(c, 148) << 1);
+ val += vp56_rac_get_prob(c, 140);
+ } else {
+ val = 19 + (vp56_rac_get_prob(c, 176) << 3);
+ val += (vp56_rac_get_prob(c, 155) << 2);
+ val += (vp56_rac_get_prob(c, 140) << 1);
+ val += vp56_rac_get_prob(c, 135);
+ }
+ } else if (!vp56_rac_get_prob_branchy(c, tp[10])) {
+ val = (vp56_rac_get_prob(c, 180) << 4) + 35;
+ val += (vp56_rac_get_prob(c, 157) << 3);
+ val += (vp56_rac_get_prob(c, 141) << 2);
+ val += (vp56_rac_get_prob(c, 134) << 1);
+ val += vp56_rac_get_prob(c, 130);
+ } else {
+ val = 67;
+ if (!is8bitsperpixel) {
+ if (bpp == 12) {
+ val += vp56_rac_get_prob(c, 255) << 17;
+ val += vp56_rac_get_prob(c, 255) << 16;
+ }
+ val += (vp56_rac_get_prob(c, 255) << 15);
+ val += (vp56_rac_get_prob(c, 255) << 14);
+ }
+ val += (vp56_rac_get_prob(c, 254) << 13);
+ val += (vp56_rac_get_prob(c, 254) << 12);
+ val += (vp56_rac_get_prob(c, 254) << 11);
+ val += (vp56_rac_get_prob(c, 252) << 10);
+ val += (vp56_rac_get_prob(c, 249) << 9);
+ val += (vp56_rac_get_prob(c, 243) << 8);
+ val += (vp56_rac_get_prob(c, 230) << 7);
+ val += (vp56_rac_get_prob(c, 196) << 6);
+ val += (vp56_rac_get_prob(c, 177) << 5);
+ val += (vp56_rac_get_prob(c, 153) << 4);
+ val += (vp56_rac_get_prob(c, 140) << 3);
+ val += (vp56_rac_get_prob(c, 133) << 2);
+ val += (vp56_rac_get_prob(c, 130) << 1);
+ val += vp56_rac_get_prob(c, 129);
+ }
+ }
+ }
+#define STORE_COEF(c, i, v) do { \
+ if (is8bitsperpixel) { \
+ c[i] = v; \
+ } else { \
+ AV_WN32A(&c[i * 2], v); \
+ } \
+} while (0)
+ if (!--band_left)
+ band_left = band_counts[++band];
+ if (is_tx32x32)
+ STORE_COEF(coef, rc, (int)((vp8_rac_get(c) ? -val : val) * (unsigned)qmul[!!i]) / 2);
+ else
+ STORE_COEF(coef, rc, (vp8_rac_get(c) ? -val : val) * (unsigned)qmul[!!i]);
+ nnz = (1 + cache[nb[i][0]] + cache[nb[i][1]]) >> 1;
+ tp = p[band][nnz];
+ } while (++i < n_coeffs);
+
+ return i;
+}
+
+static int decode_coeffs_b_8bpp(VP9TileData *td, int16_t *coef, int n_coeffs,
+ unsigned (*cnt)[6][3], unsigned (*eob)[6][2],
+ uint8_t (*p)[6][11], int nnz, const int16_t *scan,
+ const int16_t (*nb)[2], const int16_t *band_counts,
+ int16_t *qmul)
+{
+ return decode_coeffs_b_generic(td->c, coef, n_coeffs, 0, 1, 8, cnt, eob, p,
+ nnz, scan, nb, band_counts, qmul);
+}
+
+static int decode_coeffs_b32_8bpp(VP9TileData *td, int16_t *coef, int n_coeffs,
+ unsigned (*cnt)[6][3], unsigned (*eob)[6][2],
+ uint8_t (*p)[6][11], int nnz, const int16_t *scan,
+ const int16_t (*nb)[2], const int16_t *band_counts,
+ int16_t *qmul)
+{
+ return decode_coeffs_b_generic(td->c, coef, n_coeffs, 1, 1, 8, cnt, eob, p,
+ nnz, scan, nb, band_counts, qmul);
+}
+
+static int decode_coeffs_b_16bpp(VP9TileData *td, int16_t *coef, int n_coeffs,
+ unsigned (*cnt)[6][3], unsigned (*eob)[6][2],
+ uint8_t (*p)[6][11], int nnz, const int16_t *scan,
+ const int16_t (*nb)[2], const int16_t *band_counts,
+ int16_t *qmul)
+{
+ return decode_coeffs_b_generic(td->c, coef, n_coeffs, 0, 0, td->s->s.h.bpp, cnt, eob, p,
+ nnz, scan, nb, band_counts, qmul);
+}
+
+static int decode_coeffs_b32_16bpp(VP9TileData *td, int16_t *coef, int n_coeffs,
+ unsigned (*cnt)[6][3], unsigned (*eob)[6][2],
+ uint8_t (*p)[6][11], int nnz, const int16_t *scan,
+ const int16_t (*nb)[2], const int16_t *band_counts,
+ int16_t *qmul)
+{
+ return decode_coeffs_b_generic(td->c, coef, n_coeffs, 1, 0, td->s->s.h.bpp, cnt, eob, p,
+ nnz, scan, nb, band_counts, qmul);
+}
+
+static av_always_inline int decode_coeffs(VP9TileData *td, int is8bitsperpixel)
+{
+ VP9Context *s = td->s;
+ VP9Block *b = td->b;
+ int row = td->row, col = td->col;
+ uint8_t (*p)[6][11] = s->prob.coef[b->tx][0 /* y */][!b->intra];
+ unsigned (*c)[6][3] = td->counts.coef[b->tx][0 /* y */][!b->intra];
+ unsigned (*e)[6][2] = td->counts.eob[b->tx][0 /* y */][!b->intra];
+ int w4 = ff_vp9_bwh_tab[1][b->bs][0] << 1, h4 = ff_vp9_bwh_tab[1][b->bs][1] << 1;
+ int end_x = FFMIN(2 * (s->cols - col), w4);
+ int end_y = FFMIN(2 * (s->rows - row), h4);
+ int n, pl, x, y, ret;
+ int16_t (*qmul)[2] = s->s.h.segmentation.feat[b->seg_id].qmul;
+ int tx = 4 * s->s.h.lossless + b->tx;
+ const int16_t * const *yscans = ff_vp9_scans[tx];
+ const int16_t (* const * ynbs)[2] = ff_vp9_scans_nb[tx];
+ const int16_t *uvscan = ff_vp9_scans[b->uvtx][DCT_DCT];
+ const int16_t (*uvnb)[2] = ff_vp9_scans_nb[b->uvtx][DCT_DCT];
+ uint8_t *a = &s->above_y_nnz_ctx[col * 2];
+ uint8_t *l = &td->left_y_nnz_ctx[(row & 7) << 1];
+ static const int16_t band_counts[4][8] = {
+ { 1, 2, 3, 4, 3, 16 - 13 },
+ { 1, 2, 3, 4, 11, 64 - 21 },
+ { 1, 2, 3, 4, 11, 256 - 21 },
+ { 1, 2, 3, 4, 11, 1024 - 21 },
+ };
+ const int16_t *y_band_counts = band_counts[b->tx];
+ const int16_t *uv_band_counts = band_counts[b->uvtx];
+ int bytesperpixel = is8bitsperpixel ? 1 : 2;
+ int total_coeff = 0;
+
+#define MERGE(la, end, step, rd) \
+ for (n = 0; n < end; n += step) \
+ la[n] = !!rd(&la[n])
+#define MERGE_CTX(step, rd) \
+ do { \
+ MERGE(l, end_y, step, rd); \
+ MERGE(a, end_x, step, rd); \
+ } while (0)
+
+#define DECODE_Y_COEF_LOOP(step, mode_index, v) \
+ for (n = 0, y = 0; y < end_y; y += step) { \
+ for (x = 0; x < end_x; x += step, n += step * step) { \
+ enum TxfmType txtp = ff_vp9_intra_txfm_type[b->mode[mode_index]]; \
+ ret = (is8bitsperpixel ? decode_coeffs_b##v##_8bpp : decode_coeffs_b##v##_16bpp) \
+ (td, td->block + 16 * n * bytesperpixel, 16 * step * step, \
+ c, e, p, a[x] + l[y], yscans[txtp], \
+ ynbs[txtp], y_band_counts, qmul[0]); \
+ a[x] = l[y] = !!ret; \
+ total_coeff |= !!ret; \
+ if (step >= 4) { \
+ AV_WN16A(&td->eob[n], ret); \
+ } else { \
+ td->eob[n] = ret; \
+ } \
+ } \
+ }
+
+#define SPLAT(la, end, step, cond) \
+ if (step == 2) { \
+ for (n = 1; n < end; n += step) \
+ la[n] = la[n - 1]; \
+ } else if (step == 4) { \
+ if (cond) { \
+ for (n = 0; n < end; n += step) \
+ AV_WN32A(&la[n], la[n] * 0x01010101); \
+ } else { \
+ for (n = 0; n < end; n += step) \
+ memset(&la[n + 1], la[n], FFMIN(end - n - 1, 3)); \
+ } \
+ } else /* step == 8 */ { \
+ if (cond) { \
+ if (HAVE_FAST_64BIT) { \
+ for (n = 0; n < end; n += step) \
+ AV_WN64A(&la[n], la[n] * 0x0101010101010101ULL); \
+ } else { \
+ for (n = 0; n < end; n += step) { \
+ uint32_t v32 = la[n] * 0x01010101; \
+ AV_WN32A(&la[n], v32); \
+ AV_WN32A(&la[n + 4], v32); \
+ } \
+ } \
+ } else { \
+ for (n = 0; n < end; n += step) \
+ memset(&la[n + 1], la[n], FFMIN(end - n - 1, 7)); \
+ } \
+ }
+#define SPLAT_CTX(step) \
+ do { \
+ SPLAT(a, end_x, step, end_x == w4); \
+ SPLAT(l, end_y, step, end_y == h4); \
+ } while (0)
+
+ /* y tokens */
+ switch (b->tx) {
+ case TX_4X4:
+ DECODE_Y_COEF_LOOP(1, b->bs > BS_8x8 ? n : 0,);
+ break;
+ case TX_8X8:
+ MERGE_CTX(2, AV_RN16A);
+ DECODE_Y_COEF_LOOP(2, 0,);
+ SPLAT_CTX(2);
+ break;
+ case TX_16X16:
+ MERGE_CTX(4, AV_RN32A);
+ DECODE_Y_COEF_LOOP(4, 0,);
+ SPLAT_CTX(4);
+ break;
+ case TX_32X32:
+ MERGE_CTX(8, AV_RN64A);
+ DECODE_Y_COEF_LOOP(8, 0, 32);
+ SPLAT_CTX(8);
+ break;
+ }
+
+#define DECODE_UV_COEF_LOOP(step, v) \
+ for (n = 0, y = 0; y < end_y; y += step) { \
+ for (x = 0; x < end_x; x += step, n += step * step) { \
+ ret = (is8bitsperpixel ? decode_coeffs_b##v##_8bpp : decode_coeffs_b##v##_16bpp) \
+ (td, td->uvblock[pl] + 16 * n * bytesperpixel, \
+ 16 * step * step, c, e, p, a[x] + l[y], \
+ uvscan, uvnb, uv_band_counts, qmul[1]); \
+ a[x] = l[y] = !!ret; \
+ total_coeff |= !!ret; \
+ if (step >= 4) { \
+ AV_WN16A(&td->uveob[pl][n], ret); \
+ } else { \
+ td->uveob[pl][n] = ret; \
+ } \
+ } \
+ }
+
+ p = s->prob.coef[b->uvtx][1 /* uv */][!b->intra];
+ c = td->counts.coef[b->uvtx][1 /* uv */][!b->intra];
+ e = td->counts.eob[b->uvtx][1 /* uv */][!b->intra];
+ w4 >>= s->ss_h;
+ end_x >>= s->ss_h;
+ h4 >>= s->ss_v;
+ end_y >>= s->ss_v;
+ for (pl = 0; pl < 2; pl++) {
+ a = &s->above_uv_nnz_ctx[pl][col << !s->ss_h];
+ l = &td->left_uv_nnz_ctx[pl][(row & 7) << !s->ss_v];
+ switch (b->uvtx) {
+ case TX_4X4:
+ DECODE_UV_COEF_LOOP(1,);
+ break;
+ case TX_8X8:
+ MERGE_CTX(2, AV_RN16A);
+ DECODE_UV_COEF_LOOP(2,);
+ SPLAT_CTX(2);
+ break;
+ case TX_16X16:
+ MERGE_CTX(4, AV_RN32A);
+ DECODE_UV_COEF_LOOP(4,);
+ SPLAT_CTX(4);
+ break;
+ case TX_32X32:
+ MERGE_CTX(8, AV_RN64A);
+ DECODE_UV_COEF_LOOP(8, 32);
+ SPLAT_CTX(8);
+ break;
+ }
+ }
+
+ return total_coeff;
+}
+
+static int decode_coeffs_8bpp(VP9TileData *td)
+{
+ return decode_coeffs(td, 1);
+}
+
+static int decode_coeffs_16bpp(VP9TileData *td)
+{
+ return decode_coeffs(td, 0);
+}
+
+static av_always_inline void mask_edges(uint8_t (*mask)[8][4], int ss_h, int ss_v,
+ int row_and_7, int col_and_7,
+ int w, int h, int col_end, int row_end,
+ enum TxfmMode tx, int skip_inter)
+{
+ static const unsigned wide_filter_col_mask[2] = { 0x11, 0x01 };
+ static const unsigned wide_filter_row_mask[2] = { 0x03, 0x07 };
+
+ // FIXME I'm pretty sure all loops can be replaced by a single LUT if
+ // we make VP9Filter.mask uint64_t (i.e. row/col all single variable)
+ // and make the LUT 5-indexed (bl, bp, is_uv, tx and row/col), and then
+ // use row_and_7/col_and_7 as shifts (1*col_and_7+8*row_and_7)
+
+ // the intended behaviour of the vp9 loopfilter is to work on 8-pixel
+ // edges. This means that for UV, we work on two subsampled blocks at
+ // a time, and we only use the topleft block's mode information to set
+ // things like block strength. Thus, for any block size smaller than
+ // 16x16, ignore the odd portion of the block.
+ if (tx == TX_4X4 && (ss_v | ss_h)) {
+ if (h == ss_v) {
+ if (row_and_7 & 1)
+ return;
+ if (!row_end)
+ h += 1;
+ }
+ if (w == ss_h) {
+ if (col_and_7 & 1)
+ return;
+ if (!col_end)
+ w += 1;
+ }
+ }
+
+ if (tx == TX_4X4 && !skip_inter) {
+ int t = 1 << col_and_7, m_col = (t << w) - t, y;
+ // on 32-px edges, use the 8-px wide loopfilter; else, use 4-px wide
+ int m_row_8 = m_col & wide_filter_col_mask[ss_h], m_row_4 = m_col - m_row_8;
+
+ for (y = row_and_7; y < h + row_and_7; y++) {
+ int col_mask_id = 2 - !(y & wide_filter_row_mask[ss_v]);
+
+ mask[0][y][1] |= m_row_8;
+ mask[0][y][2] |= m_row_4;
+ // for odd lines, if the odd col is not being filtered,
+ // skip odd row also:
+ // .---. <-- a
+ // | |
+ // |___| <-- b
+ // ^ ^
+ // c d
+ //
+ // if a/c are even row/col and b/d are odd, and d is skipped,
+ // e.g. right edge of size-66x66.webm, then skip b also (bug)
+ if ((ss_h & ss_v) && (col_end & 1) && (y & 1)) {
+ mask[1][y][col_mask_id] |= (t << (w - 1)) - t;
+ } else {
+ mask[1][y][col_mask_id] |= m_col;
+ }
+ if (!ss_h)
+ mask[0][y][3] |= m_col;
+ if (!ss_v) {
+ if (ss_h && (col_end & 1))
+ mask[1][y][3] |= (t << (w - 1)) - t;
+ else
+ mask[1][y][3] |= m_col;
+ }
+ }
+ } else {
+ int y, t = 1 << col_and_7, m_col = (t << w) - t;
+
+ if (!skip_inter) {
+ int mask_id = (tx == TX_8X8);
+ int l2 = tx + ss_h - 1, step1d;
+ static const unsigned masks[4] = { 0xff, 0x55, 0x11, 0x01 };
+ int m_row = m_col & masks[l2];
+
+ // at odd UV col/row edges tx16/tx32 loopfilter edges, force
+ // 8wd loopfilter to prevent going off the visible edge.
+ if (ss_h && tx > TX_8X8 && (w ^ (w - 1)) == 1) {
+ int m_row_16 = ((t << (w - 1)) - t) & masks[l2];
+ int m_row_8 = m_row - m_row_16;
+
+ for (y = row_and_7; y < h + row_and_7; y++) {
+ mask[0][y][0] |= m_row_16;
+ mask[0][y][1] |= m_row_8;
+ }
+ } else {
+ for (y = row_and_7; y < h + row_and_7; y++)
+ mask[0][y][mask_id] |= m_row;
+ }
+
+ l2 = tx + ss_v - 1;
+ step1d = 1 << l2;
+ if (ss_v && tx > TX_8X8 && (h ^ (h - 1)) == 1) {
+ for (y = row_and_7; y < h + row_and_7 - 1; y += step1d)
+ mask[1][y][0] |= m_col;
+ if (y - row_and_7 == h - 1)
+ mask[1][y][1] |= m_col;
+ } else {
+ for (y = row_and_7; y < h + row_and_7; y += step1d)
+ mask[1][y][mask_id] |= m_col;
+ }
+ } else if (tx != TX_4X4) {
+ int mask_id;
+
+ mask_id = (tx == TX_8X8) || (h == ss_v);
+ mask[1][row_and_7][mask_id] |= m_col;
+ mask_id = (tx == TX_8X8) || (w == ss_h);
+ for (y = row_and_7; y < h + row_and_7; y++)
+ mask[0][y][mask_id] |= t;
+ } else {
+ int t8 = t & wide_filter_col_mask[ss_h], t4 = t - t8;
+
+ for (y = row_and_7; y < h + row_and_7; y++) {
+ mask[0][y][2] |= t4;
+ mask[0][y][1] |= t8;
+ }
+ mask[1][row_and_7][2 - !(row_and_7 & wide_filter_row_mask[ss_v])] |= m_col;
+ }
+ }
+}
+
+void ff_vp9_decode_block(VP9TileData *td, int row, int col,
+ VP9Filter *lflvl, ptrdiff_t yoff, ptrdiff_t uvoff,
+ enum BlockLevel bl, enum BlockPartition bp)
+{
+ VP9Context *s = td->s;
+ VP9Block *b = td->b;
+ enum BlockSize bs = bl * 3 + bp;
+ int bytesperpixel = s->bytesperpixel;
+ int w4 = ff_vp9_bwh_tab[1][bs][0], h4 = ff_vp9_bwh_tab[1][bs][1], lvl;
+ int emu[2];
+ AVFrame *f = s->s.frames[CUR_FRAME].tf.f;
+
+ td->row = row;
+ td->row7 = row & 7;
+ td->col = col;
+ td->col7 = col & 7;
+
+ td->min_mv.x = -(128 + col * 64);
+ td->min_mv.y = -(128 + row * 64);
+ td->max_mv.x = 128 + (s->cols - col - w4) * 64;
+ td->max_mv.y = 128 + (s->rows - row - h4) * 64;
+
+ if (s->pass < 2) {
+ b->bs = bs;
+ b->bl = bl;
+ b->bp = bp;
+ decode_mode(td);
+ b->uvtx = b->tx - ((s->ss_h && w4 * 2 == (1 << b->tx)) ||
+ (s->ss_v && h4 * 2 == (1 << b->tx)));
+
+ if (!b->skip) {
+ int has_coeffs;
+
+ if (bytesperpixel == 1) {
+ has_coeffs = decode_coeffs_8bpp(td);
+ } else {
+ has_coeffs = decode_coeffs_16bpp(td);
+ }
+ if (!has_coeffs && b->bs <= BS_8x8 && !b->intra) {
+ b->skip = 1;
+ memset(&s->above_skip_ctx[col], 1, w4);
+ memset(&td->left_skip_ctx[td->row7], 1, h4);
+ }
+ } else {
+ int row7 = td->row7;
+
+#define SPLAT_ZERO_CTX(v, n) \
+ switch (n) { \
+ case 1: v = 0; break; \
+ case 2: AV_ZERO16(&v); break; \
+ case 4: AV_ZERO32(&v); break; \
+ case 8: AV_ZERO64(&v); break; \
+ case 16: AV_ZERO128(&v); break; \
+ }
+#define SPLAT_ZERO_YUV(dir, var, off, n, dir2) \
+ do { \
+ SPLAT_ZERO_CTX(dir##_y_##var[off * 2], n * 2); \
+ if (s->ss_##dir2) { \
+ SPLAT_ZERO_CTX(dir##_uv_##var[0][off], n); \
+ SPLAT_ZERO_CTX(dir##_uv_##var[1][off], n); \
+ } else { \
+ SPLAT_ZERO_CTX(dir##_uv_##var[0][off * 2], n * 2); \
+ SPLAT_ZERO_CTX(dir##_uv_##var[1][off * 2], n * 2); \
+ } \
+ } while (0)
+
+ switch (w4) {
+ case 1: SPLAT_ZERO_YUV(s->above, nnz_ctx, col, 1, h); break;
+ case 2: SPLAT_ZERO_YUV(s->above, nnz_ctx, col, 2, h); break;
+ case 4: SPLAT_ZERO_YUV(s->above, nnz_ctx, col, 4, h); break;
+ case 8: SPLAT_ZERO_YUV(s->above, nnz_ctx, col, 8, h); break;
+ }
+ switch (h4) {
+ case 1: SPLAT_ZERO_YUV(td->left, nnz_ctx, row7, 1, v); break;
+ case 2: SPLAT_ZERO_YUV(td->left, nnz_ctx, row7, 2, v); break;
+ case 4: SPLAT_ZERO_YUV(td->left, nnz_ctx, row7, 4, v); break;
+ case 8: SPLAT_ZERO_YUV(td->left, nnz_ctx, row7, 8, v); break;
+ }
+ }
+
+ if (s->pass == 1) {
+ s->td[0].b++;
+ s->td[0].block += w4 * h4 * 64 * bytesperpixel;
+ s->td[0].uvblock[0] += w4 * h4 * 64 * bytesperpixel >> (s->ss_h + s->ss_v);
+ s->td[0].uvblock[1] += w4 * h4 * 64 * bytesperpixel >> (s->ss_h + s->ss_v);
+ s->td[0].eob += 4 * w4 * h4;
+ s->td[0].uveob[0] += 4 * w4 * h4 >> (s->ss_h + s->ss_v);
+ s->td[0].uveob[1] += 4 * w4 * h4 >> (s->ss_h + s->ss_v);
+
+ return;
+ }
+ }
+
+ // emulated overhangs if the stride of the target buffer can't hold. This
+ // makes it possible to support emu-edge and so on even if we have large block
+ // overhangs
+ emu[0] = (col + w4) * 8 * bytesperpixel > f->linesize[0] ||
+ (row + h4) > s->rows;
+ emu[1] = ((col + w4) * 8 >> s->ss_h) * bytesperpixel > f->linesize[1] ||
+ (row + h4) > s->rows;
+ if (emu[0]) {
+ td->dst[0] = td->tmp_y;
+ td->y_stride = 128;
+ } else {
+ td->dst[0] = f->data[0] + yoff;
+ td->y_stride = f->linesize[0];
+ }
+ if (emu[1]) {
+ td->dst[1] = td->tmp_uv[0];
+ td->dst[2] = td->tmp_uv[1];
+ td->uv_stride = 128;
+ } else {
+ td->dst[1] = f->data[1] + uvoff;
+ td->dst[2] = f->data[2] + uvoff;
+ td->uv_stride = f->linesize[1];
+ }
+ if (b->intra) {
+ if (s->s.h.bpp > 8) {
+ ff_vp9_intra_recon_16bpp(td, yoff, uvoff);
+ } else {
+ ff_vp9_intra_recon_8bpp(td, yoff, uvoff);
+ }
+ } else {
+ if (s->s.h.bpp > 8) {
+ ff_vp9_inter_recon_16bpp(td);
+ } else {
+ ff_vp9_inter_recon_8bpp(td);
+ }
+ }
+ if (emu[0]) {
+ int w = FFMIN(s->cols - col, w4) * 8, h = FFMIN(s->rows - row, h4) * 8, n, o = 0;
+
+ for (n = 0; o < w; n++) {
+ int bw = 64 >> n;
+
+ av_assert2(n <= 4);
+ if (w & bw) {
+ s->dsp.mc[n][0][0][0][0](f->data[0] + yoff + o * bytesperpixel, f->linesize[0],
+ td->tmp_y + o * bytesperpixel, 128, h, 0, 0);
+ o += bw;
+ }
+ }
+ }
+ if (emu[1]) {
+ int w = FFMIN(s->cols - col, w4) * 8 >> s->ss_h;
+ int h = FFMIN(s->rows - row, h4) * 8 >> s->ss_v, n, o = 0;
+
+ for (n = s->ss_h; o < w; n++) {
+ int bw = 64 >> n;
+
+ av_assert2(n <= 4);
+ if (w & bw) {
+ s->dsp.mc[n][0][0][0][0](f->data[1] + uvoff + o * bytesperpixel, f->linesize[1],
+ td->tmp_uv[0] + o * bytesperpixel, 128, h, 0, 0);
+ s->dsp.mc[n][0][0][0][0](f->data[2] + uvoff + o * bytesperpixel, f->linesize[2],
+ td->tmp_uv[1] + o * bytesperpixel, 128, h, 0, 0);
+ o += bw;
+ }
+ }
+ }
+
+ // pick filter level and find edges to apply filter to
+ if (s->s.h.filter.level &&
+ (lvl = s->s.h.segmentation.feat[b->seg_id].lflvl[b->intra ? 0 : b->ref[0] + 1]
+ [b->mode[3] != ZEROMV]) > 0) {
+ int x_end = FFMIN(s->cols - col, w4), y_end = FFMIN(s->rows - row, h4);
+ int skip_inter = !b->intra && b->skip, col7 = td->col7, row7 = td->row7;
+
+ setctx_2d(&lflvl->level[row7 * 8 + col7], w4, h4, 8, lvl);
+ mask_edges(lflvl->mask[0], 0, 0, row7, col7, x_end, y_end, 0, 0, b->tx, skip_inter);
+ if (s->ss_h || s->ss_v)
+ mask_edges(lflvl->mask[1], s->ss_h, s->ss_v, row7, col7, x_end, y_end,
+ s->cols & 1 && col + w4 >= s->cols ? s->cols & 7 : 0,
+ s->rows & 1 && row + h4 >= s->rows ? s->rows & 7 : 0,
+ b->uvtx, skip_inter);
+ }
+
+ if (s->pass == 2) {
+ s->td[0].b++;
+ s->td[0].block += w4 * h4 * 64 * bytesperpixel;
+ s->td[0].uvblock[0] += w4 * h4 * 64 * bytesperpixel >> (s->ss_v + s->ss_h);
+ s->td[0].uvblock[1] += w4 * h4 * 64 * bytesperpixel >> (s->ss_v + s->ss_h);
+ s->td[0].eob += 4 * w4 * h4;
+ s->td[0].uveob[0] += 4 * w4 * h4 >> (s->ss_v + s->ss_h);
+ s->td[0].uveob[1] += 4 * w4 * h4 >> (s->ss_v + s->ss_h);
+ }
+}
diff --git a/media/ffvpx/libavcodec/vp9data.c b/media/ffvpx/libavcodec/vp9data.c
new file mode 100644
index 0000000000..7af8a97b1e
--- /dev/null
+++ b/media/ffvpx/libavcodec/vp9data.c
@@ -0,0 +1,2247 @@
+/*
+ * Copyright (C) 2013 Ronald S. Bultje <rsbultje gmail com>
+ * Copyright (C) 2013 Clément Bœsch <u pkh me>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "vp9.h"
+#include "vp9data.h"
+
+const uint8_t ff_vp9_bwh_tab[2][N_BS_SIZES][2] = {
+ {
+ { 16, 16 }, { 16, 8 }, { 8, 16 }, { 8, 8 }, { 8, 4 }, { 4, 8 },
+ { 4, 4 }, { 4, 2 }, { 2, 4 }, { 2, 2 }, { 2, 1 }, { 1, 2 }, { 1, 1 },
+ }, {
+ { 8, 8 }, { 8, 4 }, { 4, 8 }, { 4, 4 }, { 4, 2 }, { 2, 4 },
+ { 2, 2 }, { 2, 1 }, { 1, 2 }, { 1, 1 }, { 1, 1 }, { 1, 1 }, { 1, 1 },
+ }
+};
+
+const int8_t ff_vp9_partition_tree[3][2] = {
+ { -PARTITION_NONE, 1 }, // '0'
+ { -PARTITION_H, 2 }, // '10'
+ { -PARTITION_V, -PARTITION_SPLIT }, // '110', '111'
+};
+
+const uint8_t ff_vp9_default_kf_partition_probs[4][4][3] = {
+ { /* 64x64 -> 32x32 */
+ { 174, 35, 49 } /* a/l both not split */,
+ { 68, 11, 27 } /* a split, l not split */,
+ { 57, 15, 9 } /* l split, a not split */,
+ { 12, 3, 3 } /* a/l both split */
+ }, { /* 32x32 -> 16x16 */
+ { 150, 40, 39 } /* a/l both not split */,
+ { 78, 12, 26 } /* a split, l not split */,
+ { 67, 33, 11 } /* l split, a not split */,
+ { 24, 7, 5 } /* a/l both split */,
+ }, { /* 16x16 -> 8x8 */
+ { 149, 53, 53 } /* a/l both not split */,
+ { 94, 20, 48 } /* a split, l not split */,
+ { 83, 53, 24 } /* l split, a not split */,
+ { 52, 18, 18 } /* a/l both split */,
+ }, { /* 8x8 -> 4x4 */
+ { 158, 97, 94 } /* a/l both not split */,
+ { 93, 24, 99 } /* a split, l not split */,
+ { 85, 119, 44 } /* l split, a not split */,
+ { 62, 59, 67 } /* a/l both split */,
+ },
+};
+
+const int8_t ff_vp9_segmentation_tree[7][2] = {
+ { 1, 2 },
+ { 3, 4 },
+ { 5, 6 },
+ { -0, -1 }, // '00x'
+ { -2, -3 }, // '01x'
+ { -4, -5 }, // '10x'
+ { -6, -7 }, // '11x'
+};
+
+const int8_t ff_vp9_intramode_tree[9][2] = {
+ { -DC_PRED, 1 }, // '0'
+ { -TM_VP8_PRED, 2 }, // '10'
+ { -VERT_PRED, 3 }, // '110'
+ { 4, 6 },
+ { -HOR_PRED, 5 }, // '11100'
+ { -DIAG_DOWN_RIGHT_PRED, -VERT_RIGHT_PRED }, // '11101x'
+ { -DIAG_DOWN_LEFT_PRED, 7 }, // '11110'
+ { -VERT_LEFT_PRED, 8 }, // '111110'
+ { -HOR_DOWN_PRED, -HOR_UP_PRED }, // '111111x'
+};
+
+const uint8_t ff_vp9_default_kf_ymode_probs[10][10][9] = {
+ { /* above = v */
+ { 43, 46, 168, 134, 107, 128, 69, 142, 92 } /* left = v */,
+ { 44, 29, 68, 159, 201, 177, 50, 57, 77 } /* left = h */,
+ { 63, 36, 126, 146, 123, 158, 60, 90, 96 } /* left = dc */,
+ { 58, 38, 76, 114, 97, 172, 78, 133, 92 } /* left = d45 */,
+ { 46, 41, 76, 140, 63, 184, 69, 112, 57 } /* left = d135 */,
+ { 38, 32, 85, 140, 46, 112, 54, 151, 133 } /* left = d117 */,
+ { 39, 27, 61, 131, 110, 175, 44, 75, 136 } /* left = d153 */,
+ { 47, 35, 80, 100, 74, 143, 64, 163, 74 } /* left = d63 */,
+ { 52, 30, 74, 113, 130, 175, 51, 64, 58 } /* left = d27 */,
+ { 36, 61, 116, 114, 128, 162, 80, 125, 82 } /* left = tm */
+ }, { /* above = h */
+ { 55, 44, 68, 166, 179, 192, 57, 57, 108 } /* left = v */,
+ { 42, 26, 11, 199, 241, 228, 23, 15, 85 } /* left = h */,
+ { 82, 26, 26, 171, 208, 204, 44, 32, 105 } /* left = dc */,
+ { 68, 42, 19, 131, 160, 199, 55, 52, 83 } /* left = d45 */,
+ { 58, 50, 25, 139, 115, 232, 39, 52, 118 } /* left = d135 */,
+ { 50, 35, 33, 153, 104, 162, 64, 59, 131 } /* left = d117 */,
+ { 44, 24, 16, 150, 177, 202, 33, 19, 156 } /* left = d153 */,
+ { 53, 49, 21, 110, 116, 168, 59, 80, 76 } /* left = d63 */,
+ { 55, 27, 12, 153, 203, 218, 26, 27, 49 } /* left = d27 */,
+ { 38, 72, 19, 168, 203, 212, 50, 50, 107 } /* left = tm */
+ }, { /* above = dc */
+ { 92, 45, 102, 136, 116, 180, 74, 90, 100 } /* left = v */,
+ { 73, 32, 19, 187, 222, 215, 46, 34, 100 } /* left = h */,
+ { 137, 30, 42, 148, 151, 207, 70, 52, 91 } /* left = dc */,
+ { 91, 30, 32, 116, 121, 186, 93, 86, 94 } /* left = d45 */,
+ { 72, 35, 36, 149, 68, 206, 68, 63, 105 } /* left = d135 */,
+ { 73, 31, 28, 138, 57, 124, 55, 122, 151 } /* left = d117 */,
+ { 67, 23, 21, 140, 126, 197, 40, 37, 171 } /* left = d153 */,
+ { 74, 32, 27, 107, 86, 160, 63, 134, 102 } /* left = d63 */,
+ { 86, 27, 28, 128, 154, 212, 45, 43, 53 } /* left = d27 */,
+ { 59, 67, 44, 140, 161, 202, 78, 67, 119 } /* left = tm */
+ }, { /* above = d45 */
+ { 59, 38, 83, 112, 103, 162, 98, 136, 90 } /* left = v */,
+ { 62, 30, 23, 158, 200, 207, 59, 57, 50 } /* left = h */,
+ { 103, 26, 36, 129, 132, 201, 83, 80, 93 } /* left = dc */,
+ { 67, 30, 29, 84, 86, 191, 102, 91, 59 } /* left = d45 */,
+ { 60, 32, 33, 112, 71, 220, 64, 89, 104 } /* left = d135 */,
+ { 53, 26, 34, 130, 56, 149, 84, 120, 103 } /* left = d117 */,
+ { 53, 21, 23, 133, 109, 210, 56, 77, 172 } /* left = d153 */,
+ { 61, 29, 29, 93, 97, 165, 83, 175, 162 } /* left = d63 */,
+ { 77, 19, 29, 112, 142, 228, 55, 66, 36 } /* left = d27 */,
+ { 47, 47, 43, 114, 137, 181, 100, 99, 95 } /* left = tm */
+ }, { /* above = d135 */
+ { 53, 40, 55, 139, 69, 183, 61, 80, 110 } /* left = v */,
+ { 40, 29, 19, 161, 180, 207, 43, 24, 91 } /* left = h */,
+ { 69, 23, 29, 128, 83, 199, 46, 44, 101 } /* left = dc */,
+ { 60, 34, 19, 105, 61, 198, 53, 64, 89 } /* left = d45 */,
+ { 52, 31, 22, 158, 40, 209, 58, 62, 89 } /* left = d135 */,
+ { 44, 31, 29, 147, 46, 158, 56, 102, 198 } /* left = d117 */,
+ { 35, 19, 12, 135, 87, 209, 41, 45, 167 } /* left = d153 */,
+ { 51, 38, 25, 113, 58, 164, 70, 93, 97 } /* left = d63 */,
+ { 55, 25, 21, 118, 95, 215, 38, 39, 66 } /* left = d27 */,
+ { 47, 54, 34, 146, 108, 203, 72, 103, 151 } /* left = tm */
+ }, { /* above = d117 */
+ { 46, 27, 80, 150, 55, 124, 55, 121, 135 } /* left = v */,
+ { 36, 23, 27, 165, 149, 166, 54, 64, 118 } /* left = h */,
+ { 64, 19, 37, 156, 66, 138, 49, 95, 133 } /* left = dc */,
+ { 53, 21, 36, 131, 63, 163, 60, 109, 81 } /* left = d45 */,
+ { 40, 26, 35, 154, 40, 185, 51, 97, 123 } /* left = d135 */,
+ { 35, 19, 34, 179, 19, 97, 48, 129, 124 } /* left = d117 */,
+ { 36, 20, 26, 136, 62, 164, 33, 77, 154 } /* left = d153 */,
+ { 45, 26, 28, 129, 45, 129, 49, 147, 123 } /* left = d63 */,
+ { 45, 18, 32, 130, 90, 157, 40, 79, 91 } /* left = d27 */,
+ { 38, 44, 51, 136, 74, 162, 57, 97, 121 } /* left = tm */
+ }, { /* above = d153 */
+ { 56, 39, 58, 133, 117, 173, 48, 53, 187 } /* left = v */,
+ { 35, 21, 12, 161, 212, 207, 20, 23, 145 } /* left = h */,
+ { 75, 17, 22, 136, 138, 185, 32, 34, 166 } /* left = dc */,
+ { 56, 29, 19, 117, 109, 181, 55, 68, 112 } /* left = d45 */,
+ { 47, 29, 17, 153, 64, 220, 59, 51, 114 } /* left = d135 */,
+ { 46, 16, 24, 136, 76, 147, 41, 64, 172 } /* left = d117 */,
+ { 34, 17, 11, 108, 152, 187, 13, 15, 209 } /* left = d153 */,
+ { 55, 30, 18, 122, 79, 179, 44, 88, 116 } /* left = d63 */,
+ { 51, 24, 14, 115, 133, 209, 32, 26, 104 } /* left = d27 */,
+ { 37, 49, 25, 129, 168, 164, 41, 54, 148 } /* left = tm */
+ }, { /* above = d63 */
+ { 48, 34, 86, 101, 92, 146, 78, 179, 134 } /* left = v */,
+ { 47, 22, 24, 138, 187, 178, 68, 69, 59 } /* left = h */,
+ { 78, 23, 39, 111, 117, 170, 74, 124, 94 } /* left = dc */,
+ { 56, 25, 33, 105, 112, 187, 95, 177, 129 } /* left = d45 */,
+ { 48, 31, 27, 114, 63, 183, 82, 116, 56 } /* left = d135 */,
+ { 43, 28, 37, 121, 63, 123, 61, 192, 169 } /* left = d117 */,
+ { 42, 17, 24, 109, 97, 177, 56, 76, 122 } /* left = d153 */,
+ { 46, 23, 32, 74, 86, 150, 67, 183, 88 } /* left = d63 */,
+ { 58, 18, 28, 105, 139, 182, 70, 92, 63 } /* left = d27 */,
+ { 36, 38, 48, 92, 122, 165, 88, 137, 91 } /* left = tm */
+ }, { /* above = d27 */
+ { 62, 44, 61, 123, 105, 189, 48, 57, 64 } /* left = v */,
+ { 47, 25, 17, 175, 222, 220, 24, 30, 86 } /* left = h */,
+ { 82, 22, 32, 127, 143, 213, 39, 41, 70 } /* left = dc */,
+ { 68, 36, 17, 106, 102, 206, 59, 74, 74 } /* left = d45 */,
+ { 57, 39, 23, 151, 68, 216, 55, 63, 58 } /* left = d135 */,
+ { 49, 30, 35, 141, 70, 168, 82, 40, 115 } /* left = d117 */,
+ { 51, 25, 15, 136, 129, 202, 38, 35, 139 } /* left = d153 */,
+ { 59, 39, 19, 114, 75, 180, 77, 104, 42 } /* left = d63 */,
+ { 68, 26, 16, 111, 141, 215, 29, 28, 28 } /* left = d27 */,
+ { 40, 61, 26, 126, 152, 206, 61, 59, 93 } /* left = tm */
+ }, { /* above = tm */
+ { 44, 78, 115, 132, 119, 173, 71, 112, 93 } /* left = v */,
+ { 39, 38, 21, 184, 227, 206, 42, 32, 64 } /* left = h */,
+ { 65, 70, 60, 155, 159, 199, 61, 60, 81 } /* left = dc */,
+ { 58, 47, 36, 124, 137, 193, 80, 82, 78 } /* left = d45 */,
+ { 49, 50, 35, 144, 95, 205, 63, 78, 59 } /* left = d135 */,
+ { 41, 53, 52, 148, 71, 142, 65, 128, 51 } /* left = d117 */,
+ { 40, 36, 28, 143, 143, 202, 40, 55, 137 } /* left = d153 */,
+ { 42, 44, 44, 104, 105, 164, 64, 130, 80 } /* left = d63 */,
+ { 52, 34, 29, 129, 183, 227, 42, 35, 43 } /* left = d27 */,
+ { 43, 81, 53, 140, 169, 204, 68, 84, 72 } /* left = tm */
+ }
+};
+
+const uint8_t ff_vp9_default_kf_uvmode_probs[10][9] = {
+ { 118, 15, 123, 148, 131, 101, 44, 93, 131 } /* y = v */,
+ { 113, 12, 23, 188, 226, 142, 26, 32, 125 } /* y = h */,
+ { 144, 11, 54, 157, 195, 130, 46, 58, 108 } /* y = dc */,
+ { 120, 11, 50, 123, 163, 135, 64, 77, 103 } /* y = d45 */,
+ { 113, 9, 36, 155, 111, 157, 32, 44, 161 } /* y = d135 */,
+ { 116, 9, 55, 176, 76, 96, 37, 61, 149 } /* y = d117 */,
+ { 115, 9, 28, 141, 161, 167, 21, 25, 193 } /* y = d153 */,
+ { 116, 12, 64, 120, 140, 125, 49, 115, 121 } /* y = d63 */,
+ { 120, 12, 32, 145, 195, 142, 32, 38, 86 } /* y = d27 */,
+ { 102, 19, 66, 162, 182, 122, 35, 59, 128 } /* y = tm */
+};
+
+const int8_t ff_vp9_inter_mode_tree[3][2] = {
+ { -ZEROMV, 1 }, // '0'
+ { -NEARESTMV, 2 }, // '10'
+ { -NEARMV, -NEWMV }, // '11x'
+};
+
+const int8_t ff_vp9_filter_tree[2][2] = {
+ { -0, 1 }, // '0'
+ { -1, -2 }, // '1x'
+};
+
+const enum FilterMode ff_vp9_filter_lut[3] = {
+ FILTER_8TAP_REGULAR,
+ FILTER_8TAP_SMOOTH,
+ FILTER_8TAP_SHARP,
+};
+
+const int16_t ff_vp9_dc_qlookup[3][256] = {
+ {
+ 4, 8, 8, 9, 10, 11, 12, 12,
+ 13, 14, 15, 16, 17, 18, 19, 19,
+ 20, 21, 22, 23, 24, 25, 26, 26,
+ 27, 28, 29, 30, 31, 32, 32, 33,
+ 34, 35, 36, 37, 38, 38, 39, 40,
+ 41, 42, 43, 43, 44, 45, 46, 47,
+ 48, 48, 49, 50, 51, 52, 53, 53,
+ 54, 55, 56, 57, 57, 58, 59, 60,
+ 61, 62, 62, 63, 64, 65, 66, 66,
+ 67, 68, 69, 70, 70, 71, 72, 73,
+ 74, 74, 75, 76, 77, 78, 78, 79,
+ 80, 81, 81, 82, 83, 84, 85, 85,
+ 87, 88, 90, 92, 93, 95, 96, 98,
+ 99, 101, 102, 104, 105, 107, 108, 110,
+ 111, 113, 114, 116, 117, 118, 120, 121,
+ 123, 125, 127, 129, 131, 134, 136, 138,
+ 140, 142, 144, 146, 148, 150, 152, 154,
+ 156, 158, 161, 164, 166, 169, 172, 174,
+ 177, 180, 182, 185, 187, 190, 192, 195,
+ 199, 202, 205, 208, 211, 214, 217, 220,
+ 223, 226, 230, 233, 237, 240, 243, 247,
+ 250, 253, 257, 261, 265, 269, 272, 276,
+ 280, 284, 288, 292, 296, 300, 304, 309,
+ 313, 317, 322, 326, 330, 335, 340, 344,
+ 349, 354, 359, 364, 369, 374, 379, 384,
+ 389, 395, 400, 406, 411, 417, 423, 429,
+ 435, 441, 447, 454, 461, 467, 475, 482,
+ 489, 497, 505, 513, 522, 530, 539, 549,
+ 559, 569, 579, 590, 602, 614, 626, 640,
+ 654, 668, 684, 700, 717, 736, 755, 775,
+ 796, 819, 843, 869, 896, 925, 955, 988,
+ 1022, 1058, 1098, 1139, 1184, 1232, 1282, 1336,
+ }, {
+ 4, 9, 10, 13, 15, 17, 20, 22,
+ 25, 28, 31, 34, 37, 40, 43, 47,
+ 50, 53, 57, 60, 64, 68, 71, 75,
+ 78, 82, 86, 90, 93, 97, 101, 105,
+ 109, 113, 116, 120, 124, 128, 132, 136,
+ 140, 143, 147, 151, 155, 159, 163, 166,
+ 170, 174, 178, 182, 185, 189, 193, 197,
+ 200, 204, 208, 212, 215, 219, 223, 226,
+ 230, 233, 237, 241, 244, 248, 251, 255,
+ 259, 262, 266, 269, 273, 276, 280, 283,
+ 287, 290, 293, 297, 300, 304, 307, 310,
+ 314, 317, 321, 324, 327, 331, 334, 337,
+ 343, 350, 356, 362, 369, 375, 381, 387,
+ 394, 400, 406, 412, 418, 424, 430, 436,
+ 442, 448, 454, 460, 466, 472, 478, 484,
+ 490, 499, 507, 516, 525, 533, 542, 550,
+ 559, 567, 576, 584, 592, 601, 609, 617,
+ 625, 634, 644, 655, 666, 676, 687, 698,
+ 708, 718, 729, 739, 749, 759, 770, 782,
+ 795, 807, 819, 831, 844, 856, 868, 880,
+ 891, 906, 920, 933, 947, 961, 975, 988,
+ 1001, 1015, 1030, 1045, 1061, 1076, 1090, 1105,
+ 1120, 1137, 1153, 1170, 1186, 1202, 1218, 1236,
+ 1253, 1271, 1288, 1306, 1323, 1342, 1361, 1379,
+ 1398, 1416, 1436, 1456, 1476, 1496, 1516, 1537,
+ 1559, 1580, 1601, 1624, 1647, 1670, 1692, 1717,
+ 1741, 1766, 1791, 1817, 1844, 1871, 1900, 1929,
+ 1958, 1990, 2021, 2054, 2088, 2123, 2159, 2197,
+ 2236, 2276, 2319, 2363, 2410, 2458, 2508, 2561,
+ 2616, 2675, 2737, 2802, 2871, 2944, 3020, 3102,
+ 3188, 3280, 3375, 3478, 3586, 3702, 3823, 3953,
+ 4089, 4236, 4394, 4559, 4737, 4929, 5130, 5347,
+ }, {
+ 4, 12, 18, 25, 33, 41, 50, 60,
+ 70, 80, 91, 103, 115, 127, 140, 153,
+ 166, 180, 194, 208, 222, 237, 251, 266,
+ 281, 296, 312, 327, 343, 358, 374, 390,
+ 405, 421, 437, 453, 469, 484, 500, 516,
+ 532, 548, 564, 580, 596, 611, 627, 643,
+ 659, 674, 690, 706, 721, 737, 752, 768,
+ 783, 798, 814, 829, 844, 859, 874, 889,
+ 904, 919, 934, 949, 964, 978, 993, 1008,
+ 1022, 1037, 1051, 1065, 1080, 1094, 1108, 1122,
+ 1136, 1151, 1165, 1179, 1192, 1206, 1220, 1234,
+ 1248, 1261, 1275, 1288, 1302, 1315, 1329, 1342,
+ 1368, 1393, 1419, 1444, 1469, 1494, 1519, 1544,
+ 1569, 1594, 1618, 1643, 1668, 1692, 1717, 1741,
+ 1765, 1789, 1814, 1838, 1862, 1885, 1909, 1933,
+ 1957, 1992, 2027, 2061, 2096, 2130, 2165, 2199,
+ 2233, 2267, 2300, 2334, 2367, 2400, 2434, 2467,
+ 2499, 2532, 2575, 2618, 2661, 2704, 2746, 2788,
+ 2830, 2872, 2913, 2954, 2995, 3036, 3076, 3127,
+ 3177, 3226, 3275, 3324, 3373, 3421, 3469, 3517,
+ 3565, 3621, 3677, 3733, 3788, 3843, 3897, 3951,
+ 4005, 4058, 4119, 4181, 4241, 4301, 4361, 4420,
+ 4479, 4546, 4612, 4677, 4742, 4807, 4871, 4942,
+ 5013, 5083, 5153, 5222, 5291, 5367, 5442, 5517,
+ 5591, 5665, 5745, 5825, 5905, 5984, 6063, 6149,
+ 6234, 6319, 6404, 6495, 6587, 6678, 6769, 6867,
+ 6966, 7064, 7163, 7269, 7376, 7483, 7599, 7715,
+ 7832, 7958, 8085, 8214, 8352, 8492, 8635, 8788,
+ 8945, 9104, 9275, 9450, 9639, 9832, 10031, 10245,
+ 10465, 10702, 10946, 11210, 11482, 11776, 12081, 12409,
+ 12750, 13118, 13501, 13913, 14343, 14807, 15290, 15812,
+ 16356, 16943, 17575, 18237, 18949, 19718, 20521, 21387,
+ }
+};
+
+const int16_t ff_vp9_ac_qlookup[3][256] = {
+ {
+ 4, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 18, 19, 20, 21, 22,
+ 23, 24, 25, 26, 27, 28, 29, 30,
+ 31, 32, 33, 34, 35, 36, 37, 38,
+ 39, 40, 41, 42, 43, 44, 45, 46,
+ 47, 48, 49, 50, 51, 52, 53, 54,
+ 55, 56, 57, 58, 59, 60, 61, 62,
+ 63, 64, 65, 66, 67, 68, 69, 70,
+ 71, 72, 73, 74, 75, 76, 77, 78,
+ 79, 80, 81, 82, 83, 84, 85, 86,
+ 87, 88, 89, 90, 91, 92, 93, 94,
+ 95, 96, 97, 98, 99, 100, 101, 102,
+ 104, 106, 108, 110, 112, 114, 116, 118,
+ 120, 122, 124, 126, 128, 130, 132, 134,
+ 136, 138, 140, 142, 144, 146, 148, 150,
+ 152, 155, 158, 161, 164, 167, 170, 173,
+ 176, 179, 182, 185, 188, 191, 194, 197,
+ 200, 203, 207, 211, 215, 219, 223, 227,
+ 231, 235, 239, 243, 247, 251, 255, 260,
+ 265, 270, 275, 280, 285, 290, 295, 300,
+ 305, 311, 317, 323, 329, 335, 341, 347,
+ 353, 359, 366, 373, 380, 387, 394, 401,
+ 408, 416, 424, 432, 440, 448, 456, 465,
+ 474, 483, 492, 501, 510, 520, 530, 540,
+ 550, 560, 571, 582, 593, 604, 615, 627,
+ 639, 651, 663, 676, 689, 702, 715, 729,
+ 743, 757, 771, 786, 801, 816, 832, 848,
+ 864, 881, 898, 915, 933, 951, 969, 988,
+ 1007, 1026, 1046, 1066, 1087, 1108, 1129, 1151,
+ 1173, 1196, 1219, 1243, 1267, 1292, 1317, 1343,
+ 1369, 1396, 1423, 1451, 1479, 1508, 1537, 1567,
+ 1597, 1628, 1660, 1692, 1725, 1759, 1793, 1828,
+ }, {
+ 4, 9, 11, 13, 16, 18, 21, 24,
+ 27, 30, 33, 37, 40, 44, 48, 51,
+ 55, 59, 63, 67, 71, 75, 79, 83,
+ 88, 92, 96, 100, 105, 109, 114, 118,
+ 122, 127, 131, 136, 140, 145, 149, 154,
+ 158, 163, 168, 172, 177, 181, 186, 190,
+ 195, 199, 204, 208, 213, 217, 222, 226,
+ 231, 235, 240, 244, 249, 253, 258, 262,
+ 267, 271, 275, 280, 284, 289, 293, 297,
+ 302, 306, 311, 315, 319, 324, 328, 332,
+ 337, 341, 345, 349, 354, 358, 362, 367,
+ 371, 375, 379, 384, 388, 392, 396, 401,
+ 409, 417, 425, 433, 441, 449, 458, 466,
+ 474, 482, 490, 498, 506, 514, 523, 531,
+ 539, 547, 555, 563, 571, 579, 588, 596,
+ 604, 616, 628, 640, 652, 664, 676, 688,
+ 700, 713, 725, 737, 749, 761, 773, 785,
+ 797, 809, 825, 841, 857, 873, 889, 905,
+ 922, 938, 954, 970, 986, 1002, 1018, 1038,
+ 1058, 1078, 1098, 1118, 1138, 1158, 1178, 1198,
+ 1218, 1242, 1266, 1290, 1314, 1338, 1362, 1386,
+ 1411, 1435, 1463, 1491, 1519, 1547, 1575, 1603,
+ 1631, 1663, 1695, 1727, 1759, 1791, 1823, 1859,
+ 1895, 1931, 1967, 2003, 2039, 2079, 2119, 2159,
+ 2199, 2239, 2283, 2327, 2371, 2415, 2459, 2507,
+ 2555, 2603, 2651, 2703, 2755, 2807, 2859, 2915,
+ 2971, 3027, 3083, 3143, 3203, 3263, 3327, 3391,
+ 3455, 3523, 3591, 3659, 3731, 3803, 3876, 3952,
+ 4028, 4104, 4184, 4264, 4348, 4432, 4516, 4604,
+ 4692, 4784, 4876, 4972, 5068, 5168, 5268, 5372,
+ 5476, 5584, 5692, 5804, 5916, 6032, 6148, 6268,
+ 6388, 6512, 6640, 6768, 6900, 7036, 7172, 7312,
+ }, {
+ 4, 13, 19, 27, 35, 44, 54, 64,
+ 75, 87, 99, 112, 126, 139, 154, 168,
+ 183, 199, 214, 230, 247, 263, 280, 297,
+ 314, 331, 349, 366, 384, 402, 420, 438,
+ 456, 475, 493, 511, 530, 548, 567, 586,
+ 604, 623, 642, 660, 679, 698, 716, 735,
+ 753, 772, 791, 809, 828, 846, 865, 884,
+ 902, 920, 939, 957, 976, 994, 1012, 1030,
+ 1049, 1067, 1085, 1103, 1121, 1139, 1157, 1175,
+ 1193, 1211, 1229, 1246, 1264, 1282, 1299, 1317,
+ 1335, 1352, 1370, 1387, 1405, 1422, 1440, 1457,
+ 1474, 1491, 1509, 1526, 1543, 1560, 1577, 1595,
+ 1627, 1660, 1693, 1725, 1758, 1791, 1824, 1856,
+ 1889, 1922, 1954, 1987, 2020, 2052, 2085, 2118,
+ 2150, 2183, 2216, 2248, 2281, 2313, 2346, 2378,
+ 2411, 2459, 2508, 2556, 2605, 2653, 2701, 2750,
+ 2798, 2847, 2895, 2943, 2992, 3040, 3088, 3137,
+ 3185, 3234, 3298, 3362, 3426, 3491, 3555, 3619,
+ 3684, 3748, 3812, 3876, 3941, 4005, 4069, 4149,
+ 4230, 4310, 4390, 4470, 4550, 4631, 4711, 4791,
+ 4871, 4967, 5064, 5160, 5256, 5352, 5448, 5544,
+ 5641, 5737, 5849, 5961, 6073, 6185, 6297, 6410,
+ 6522, 6650, 6778, 6906, 7034, 7162, 7290, 7435,
+ 7579, 7723, 7867, 8011, 8155, 8315, 8475, 8635,
+ 8795, 8956, 9132, 9308, 9484, 9660, 9836, 10028,
+ 10220, 10412, 10604, 10812, 11020, 11228, 11437, 11661,
+ 11885, 12109, 12333, 12573, 12813, 13053, 13309, 13565,
+ 13821, 14093, 14365, 14637, 14925, 15213, 15502, 15806,
+ 16110, 16414, 16734, 17054, 17390, 17726, 18062, 18414,
+ 18766, 19134, 19502, 19886, 20270, 20670, 21070, 21486,
+ 21902, 22334, 22766, 23214, 23662, 24126, 24590, 25070,
+ 25551, 26047, 26559, 27071, 27599, 28143, 28687, 29247,
+ }
+};
+
+const enum TxfmType ff_vp9_intra_txfm_type[14] = {
+ [VERT_PRED] = ADST_DCT,
+ [HOR_PRED] = DCT_ADST,
+ [DC_PRED] = DCT_DCT,
+ [DIAG_DOWN_LEFT_PRED] = DCT_DCT,
+ [DIAG_DOWN_RIGHT_PRED] = ADST_ADST,
+ [VERT_RIGHT_PRED] = ADST_DCT,
+ [HOR_DOWN_PRED] = DCT_ADST,
+ [VERT_LEFT_PRED] = ADST_DCT,
+ [HOR_UP_PRED] = DCT_ADST,
+ [TM_VP8_PRED] = ADST_ADST,
+ [NEARESTMV] = DCT_DCT,
+ [NEARMV] = DCT_DCT,
+ [ZEROMV] = DCT_DCT,
+ [NEWMV] = DCT_DCT,
+};
+
+const int16_t ff_vp9_default_scan_4x4[16] = {
+ 0, 1, 4, 5,
+ 2, 8, 3, 6,
+ 12, 9, 7, 10,
+ 13, 11, 14, 15,
+};
+
+const int16_t ff_vp9_col_scan_4x4[16] = {
+ 0, 1, 2, 4,
+ 3, 5, 6, 8,
+ 7, 9, 10, 12,
+ 13, 11, 14, 15,
+};
+
+const int16_t ff_vp9_row_scan_4x4[16] = {
+ 0, 4, 1, 8,
+ 5, 12, 9, 2,
+ 6, 13, 3, 10,
+ 7, 14, 11, 15,
+};
+
+const int16_t ff_vp9_default_scan_8x8[64] = {
+ 0, 1, 8, 2, 9, 16, 10, 3,
+ 17, 24, 18, 11, 4, 25, 32, 19,
+ 12, 26, 5, 33, 20, 27, 40, 13,
+ 34, 6, 41, 28, 21, 35, 42, 48,
+ 14, 7, 36, 29, 43, 56, 49, 22,
+ 15, 37, 50, 44, 57, 30, 23, 51,
+ 45, 58, 38, 31, 52, 59, 39, 46,
+ 53, 60, 47, 54, 61, 55, 62, 63,
+};
+
+const int16_t ff_vp9_col_scan_8x8[64] = {
+ 0, 1, 2, 8, 3, 9, 4, 10,
+ 16, 5, 11, 17, 12, 18, 6, 24,
+ 19, 13, 25, 7, 26, 20, 32, 14,
+ 27, 21, 33, 28, 34, 15, 22, 35,
+ 40, 29, 41, 36, 23, 30, 42, 37,
+ 48, 43, 31, 44, 49, 38, 50, 56,
+ 45, 39, 51, 57, 52, 46, 58, 53,
+ 59, 47, 60, 54, 61, 55, 62, 63,
+};
+
+const int16_t ff_vp9_row_scan_8x8[64] = {
+ 0, 8, 16, 1, 9, 24, 2, 17,
+ 32, 10, 25, 3, 40, 18, 11, 33,
+ 26, 19, 4, 48, 41, 34, 12, 27,
+ 56, 20, 5, 42, 35, 13, 49, 28,
+ 6, 21, 43, 36, 14, 50, 29, 57,
+ 7, 44, 22, 37, 51, 15, 58, 30,
+ 23, 45, 52, 38, 59, 31, 46, 53,
+ 39, 60, 47, 61, 54, 62, 55, 63,
+};
+
+const int16_t ff_vp9_default_scan_16x16[256] = {
+ 0, 1, 16, 2, 17, 32, 3, 18, 33, 48, 4, 34, 19, 49, 20, 5,
+ 35, 64, 50, 36, 65, 21, 6, 51, 80, 66, 37, 22, 52, 7, 81, 67,
+ 38, 82, 53, 23, 96, 68, 8, 83, 97, 54, 39, 69, 112, 24, 98, 84,
+ 70, 55, 9, 40, 85, 99, 113, 128, 25, 114, 100, 71, 86, 56, 10, 41,
+ 115, 101, 129, 116, 72, 87, 26, 130, 144, 102, 57, 11, 42, 117, 131, 145,
+ 88, 103, 27, 73, 132, 118, 146, 58, 160, 12, 43, 133, 147, 104, 89, 119,
+ 161, 74, 148, 134, 28, 162, 59, 13, 176, 120, 149, 90, 135, 105, 163, 44,
+ 75, 177, 164, 29, 150, 121, 136, 178, 165, 14, 106, 60, 91, 151, 45, 179,
+ 192, 137, 166, 122, 76, 180, 152, 30, 61, 15, 107, 167, 181, 193, 92, 208,
+ 46, 138, 123, 153, 194, 77, 168, 182, 31, 195, 209, 183, 108, 139, 62, 154,
+ 47, 196, 93, 169, 210, 197, 224, 124, 184, 211, 78, 109, 170, 155, 63, 198,
+ 212, 185, 225, 240, 140, 94, 199, 125, 79, 213, 226, 171, 186, 156, 214, 200,
+ 110, 227, 141, 95, 241, 215, 228, 201, 126, 242, 187, 172, 157, 229, 111, 216,
+ 243, 142, 202, 230, 127, 217, 244, 173, 188, 231, 158, 203, 143, 245, 218, 232,
+ 189, 246, 159, 174, 233, 247, 219, 204, 175, 190, 248, 234, 205, 220, 249, 191,
+ 235, 221, 250, 206, 222, 251, 236, 207, 237, 223, 252, 238, 253, 239, 254, 255,
+};
+
+const int16_t ff_vp9_col_scan_16x16[256] = {
+ 0, 1, 2, 3, 16, 4, 17, 5, 18, 6, 19, 32, 20, 7, 33, 21,
+ 34, 8, 35, 22, 48, 36, 9, 49, 23, 50, 37, 10, 38, 51, 24, 64,
+ 52, 11, 65, 39, 25, 53, 66, 54, 40, 67, 12, 80, 26, 68, 55, 81,
+ 41, 69, 13, 27, 82, 56, 70, 83, 42, 14, 84, 96, 71, 28, 57, 85,
+ 97, 15, 72, 98, 43, 86, 58, 99, 29, 87, 100, 112, 73, 44, 101, 59,
+ 30, 113, 88, 114, 74, 128, 102, 45, 31, 115, 60, 103, 89, 116, 75, 129,
+ 117, 46, 104, 90, 61, 130, 118, 131, 132, 105, 76, 47, 119, 144, 91, 62,
+ 133, 106, 145, 120, 146, 134, 77, 147, 121, 92, 135, 148, 63, 107, 136, 122,
+ 93, 149, 160, 78, 150, 137, 108, 161, 162, 151, 123, 79, 138, 163, 152, 94,
+ 164, 109, 165, 153, 124, 139, 176, 166, 95, 177, 167, 110, 154, 178, 125, 179,
+ 140, 168, 155, 111, 180, 192, 181, 169, 141, 126, 182, 193, 194, 156, 183, 170,
+ 195, 127, 142, 196, 184, 208, 197, 157, 171, 143, 185, 198, 209, 199, 210, 172,
+ 158, 186, 211, 224, 212, 200, 240, 159, 213, 225, 187, 201, 173, 226, 214, 215,
+ 227, 202, 228, 188, 241, 216, 174, 229, 242, 203, 243, 217, 230, 175, 189, 244,
+ 231, 204, 218, 232, 245, 219, 246, 190, 233, 205, 191, 247, 234, 248, 220, 206,
+ 249, 235, 221, 207, 250, 236, 222, 251, 223, 237, 238, 252, 239, 253, 254, 255,
+};
+
+const int16_t ff_vp9_row_scan_16x16[256] = {
+ 0, 16, 32, 1, 48, 17, 64, 33, 2, 80, 18, 49, 96, 34, 3, 65,
+ 19, 112, 50, 81, 35, 4, 128, 66, 20, 97, 51, 82, 5, 144, 36, 67,
+ 113, 98, 21, 52, 160, 83, 129, 37, 68, 6, 114, 176, 99, 53, 22, 84,
+ 145, 38, 69, 130, 7, 115, 192, 100, 54, 23, 85, 161, 146, 131, 39, 70,
+ 208, 116, 8, 101, 177, 55, 86, 24, 162, 147, 132, 71, 224, 117, 40, 102,
+ 9, 148, 56, 87, 193, 163, 240, 133, 178, 25, 118, 72, 41, 103, 164, 10,
+ 149, 88, 134, 209, 179, 57, 119, 194, 26, 73, 165, 150, 104, 42, 135, 11,
+ 180, 120, 89, 225, 195, 58, 27, 210, 151, 181, 166, 74, 43, 105, 12, 136,
+ 90, 59, 241, 121, 28, 196, 167, 211, 152, 44, 182, 137, 75, 13, 226, 106,
+ 122, 60, 197, 91, 168, 29, 183, 153, 14, 76, 212, 138, 45, 107, 15, 198,
+ 92, 227, 169, 30, 123, 154, 61, 242, 184, 213, 139, 46, 77, 31, 108, 170,
+ 199, 185, 124, 228, 93, 155, 214, 62, 140, 243, 78, 47, 200, 109, 186, 171,
+ 201, 94, 63, 215, 229, 156, 79, 125, 141, 110, 216, 187, 172, 244, 202, 230,
+ 217, 95, 157, 126, 245, 111, 142, 231, 188, 127, 158, 218, 173, 232, 246, 233,
+ 203, 143, 247, 174, 189, 159, 219, 204, 248, 234, 249, 175, 190, 220, 205, 250,
+ 235, 191, 221, 251, 236, 206, 252, 222, 207, 237, 223, 253, 238, 254, 239, 255,
+};
+
+const int16_t ff_vp9_default_scan_32x32[1024] = {
+ 0, 1, 32, 2, 33, 64, 3, 34, 65, 4, 96, 35, 66, 5, 36, 97, 67, 128, 98, 68, 37, 6, 129, 99, 7, 160, 69, 38, 130, 100, 161, 131,
+ 39, 70, 8, 101, 162, 132, 192, 71, 40, 9, 102, 163, 133, 193, 72, 224, 103, 41, 164, 10, 194, 134, 165, 73, 104, 135, 225, 42, 195, 11, 256, 166,
+ 226, 196, 74, 105, 136, 43, 12, 167, 197, 227, 257, 75, 106, 137, 228, 44, 198, 168, 258, 288, 13, 229, 76, 107, 199, 138, 259, 169, 289, 45, 230, 260,
+ 200, 108, 14, 170, 139, 320, 290, 77, 231, 261, 46, 201, 140, 291, 109, 232, 321, 262, 171, 78, 292, 15, 322, 202, 263, 352, 172, 293, 233, 141, 323, 110,
+ 47, 203, 264, 234, 294, 353, 324, 16, 79, 204, 265, 295, 325, 173, 354, 142, 235, 384, 48, 296, 111, 266, 355, 326, 80, 17, 205, 236, 174, 356, 385, 327,
+ 143, 297, 267, 357, 386, 112, 49, 328, 298, 206, 416, 237, 358, 387, 81, 175, 18, 329, 359, 388, 299, 330, 389, 113, 417, 238, 360, 50, 207, 418, 390, 331,
+ 19, 448, 361, 82, 419, 391, 239, 51, 362, 420, 114, 449, 480, 421, 83, 363, 450, 422, 512, 451, 423, 115, 452, 481, 453, 482, 454, 544, 483, 455, 513, 484,
+ 514, 485, 515, 486, 545, 576, 487, 546, 547, 608, 577, 578, 579, 609, 610, 611, 20, 144, 268, 392, 516, 640, 21, 52, 145, 176, 269, 300, 393, 424, 517, 548,
+ 641, 672, 22, 53, 84, 146, 177, 208, 270, 301, 332, 394, 425, 456, 518, 549, 580, 642, 673, 704, 23, 54, 85, 116, 147, 178, 209, 240, 271, 302, 333, 364,
+ 395, 426, 457, 488, 519, 550, 581, 612, 643, 674, 705, 736, 55, 86, 117, 179, 210, 241, 303, 334, 365, 427, 458, 489, 551, 582, 613, 675, 706, 737, 87, 118,
+ 211, 242, 335, 366, 459, 490, 583, 614, 707, 738, 119, 243, 367, 491, 615, 739, 24, 148, 272, 396, 520, 644, 768, 25, 56, 149, 180, 273, 304, 397, 428, 521,
+ 552, 645, 676, 769, 800, 26, 57, 88, 150, 181, 212, 274, 305, 336, 398, 429, 460, 522, 553, 584, 646, 677, 708, 770, 801, 832, 27, 58, 89, 120, 151, 182,
+ 213, 244, 275, 306, 337, 368, 399, 430, 461, 492, 523, 554, 585, 616, 647, 678, 709, 740, 771, 802, 833, 864, 59, 90, 121, 183, 214, 245, 307, 338, 369, 431,
+ 462, 493, 555, 586, 617, 679, 710, 741, 803, 834, 865, 91, 122, 215, 246, 339, 370, 463, 494, 587, 618, 711, 742, 835, 866, 123, 247, 371, 495, 619, 743, 867,
+ 28, 152, 276, 400, 524, 648, 772, 896, 29, 60, 153, 184, 277, 308, 401, 432, 525, 556, 649, 680, 773, 804, 897, 928, 30, 61, 92, 154, 185, 216, 278, 309,
+ 340, 402, 433, 464, 526, 557, 588, 650, 681, 712, 774, 805, 836, 898, 929, 960, 31, 62, 93, 124, 155, 186, 217, 248, 279, 310, 341, 372, 403, 434, 465, 496,
+ 527, 558, 589, 620, 651, 682, 713, 744, 775, 806, 837, 868, 899, 930, 961, 992, 63, 94, 125, 187, 218, 249, 311, 342, 373, 435, 466, 497, 559, 590, 621, 683,
+ 714, 745, 807, 838, 869, 931, 962, 993, 95, 126, 219, 250, 343, 374, 467, 498, 591, 622, 715, 746, 839, 870, 963, 994, 127, 251, 375, 499, 623, 747, 871, 995,
+ 156, 280, 404, 528, 652, 776, 900, 157, 188, 281, 312, 405, 436, 529, 560, 653, 684, 777, 808, 901, 932, 158, 189, 220, 282, 313, 344, 406, 437, 468, 530, 561,
+ 592, 654, 685, 716, 778, 809, 840, 902, 933, 964, 159, 190, 221, 252, 283, 314, 345, 376, 407, 438, 469, 500, 531, 562, 593, 624, 655, 686, 717, 748, 779, 810,
+ 841, 872, 903, 934, 965, 996, 191, 222, 253, 315, 346, 377, 439, 470, 501, 563, 594, 625, 687, 718, 749, 811, 842, 873, 935, 966, 997, 223, 254, 347, 378, 471,
+ 502, 595, 626, 719, 750, 843, 874, 967, 998, 255, 379, 503, 627, 751, 875, 999, 284, 408, 532, 656, 780, 904, 285, 316, 409, 440, 533, 564, 657, 688, 781, 812,
+ 905, 936, 286, 317, 348, 410, 441, 472, 534, 565, 596, 658, 689, 720, 782, 813, 844, 906, 937, 968, 287, 318, 349, 380, 411, 442, 473, 504, 535, 566, 597, 628,
+ 659, 690, 721, 752, 783, 814, 845, 876, 907, 938, 969, 1000, 319, 350, 381, 443, 474, 505, 567, 598, 629, 691, 722, 753, 815, 846, 877, 939, 970, 1001, 351, 382,
+ 475, 506, 599, 630, 723, 754, 847, 878, 971, 1002, 383, 507, 631, 755, 879, 1003, 412, 536, 660, 784, 908, 413, 444, 537, 568, 661, 692, 785, 816, 909, 940, 414,
+ 445, 476, 538, 569, 600, 662, 693, 724, 786, 817, 848, 910, 941, 972, 415, 446, 477, 508, 539, 570, 601, 632, 663, 694, 725, 756, 787, 818, 849, 880, 911, 942,
+ 973, 1004, 447, 478, 509, 571, 602, 633, 695, 726, 757, 819, 850, 881, 943, 974, 1005, 479, 510, 603, 634, 727, 758, 851, 882, 975, 1006, 511, 635, 759, 883, 1007,
+ 540, 664, 788, 912, 541, 572, 665, 696, 789, 820, 913, 944, 542, 573, 604, 666, 697, 728, 790, 821, 852, 914, 945, 976, 543, 574, 605, 636, 667, 698, 729, 760,
+ 791, 822, 853, 884, 915, 946, 977, 1008, 575, 606, 637, 699, 730, 761, 823, 854, 885, 947, 978, 1009, 607, 638, 731, 762, 855, 886, 979, 1010, 639, 763, 887, 1011,
+ 668, 792, 916, 669, 700, 793, 824, 917, 948, 670, 701, 732, 794, 825, 856, 918, 949, 980, 671, 702, 733, 764, 795, 826, 857, 888, 919, 950, 981, 1012, 703, 734,
+ 765, 827, 858, 889, 951, 982, 1013, 735, 766, 859, 890, 983, 1014, 767, 891, 1015, 796, 920, 797, 828, 921, 952, 798, 829, 860, 922, 953, 984, 799, 830, 861, 892,
+ 923, 954, 985, 1016, 831, 862, 893, 955, 986, 1017, 863, 894, 987, 1018, 895, 1019, 924, 925, 956, 926, 957, 988, 927, 958, 989, 1020, 959, 990, 1021, 991, 1022, 1023,
+};
+
+const int16_t * const ff_vp9_scans[5][4] = {
+ {
+ ff_vp9_default_scan_4x4, ff_vp9_col_scan_4x4,
+ ff_vp9_row_scan_4x4, ff_vp9_default_scan_4x4
+ }, {
+ ff_vp9_default_scan_8x8, ff_vp9_col_scan_8x8,
+ ff_vp9_row_scan_8x8, ff_vp9_default_scan_8x8
+ }, {
+ ff_vp9_default_scan_16x16, ff_vp9_col_scan_16x16,
+ ff_vp9_row_scan_16x16, ff_vp9_default_scan_16x16
+ }, {
+ ff_vp9_default_scan_32x32, ff_vp9_default_scan_32x32,
+ ff_vp9_default_scan_32x32, ff_vp9_default_scan_32x32
+ }, { // lossless
+ ff_vp9_default_scan_4x4, ff_vp9_default_scan_4x4,
+ ff_vp9_default_scan_4x4, ff_vp9_default_scan_4x4
+ }
+};
+
+const int16_t ff_vp9_default_scan_4x4_nb[16][2] = {
+ { 0, 0 }, { 0, 0 }, { 4, 1 }, { 1, 1 },
+ { 4, 4 }, { 2, 2 }, { 5, 2 }, { 8, 8 },
+ { 8, 5 }, { 6, 3 }, { 9, 6 }, { 12, 9 },
+ { 10, 7 }, { 13, 10 }, { 14, 11 }, { 0, 0 },
+};
+
+const int16_t ff_vp9_col_scan_4x4_nb[16][2] = {
+ { 0, 0 }, { 1, 1 }, { 0, 0 }, { 2, 2 },
+ { 4, 4 }, { 5, 5 }, { 4, 4 }, { 6, 6 },
+ { 8, 8 }, { 9, 9 }, { 8, 8 }, { 12, 12 },
+ { 10, 10 }, { 13, 13 }, { 14, 14 }, { 0, 0 },
+};
+
+const int16_t ff_vp9_row_scan_4x4_nb[16][2] = {
+ { 0, 0 }, { 0, 0 }, { 4, 4 }, { 1, 1 },
+ { 8, 8 }, { 5, 5 }, { 1, 1 }, { 2, 2 },
+ { 9, 9 }, { 2, 2 }, { 6, 6 }, { 3, 3 },
+ { 10, 10 }, { 7, 7 }, { 11, 11 }, { 0, 0 },
+};
+
+const int16_t ff_vp9_default_scan_8x8_nb[64][2] = {
+ { 0, 0 }, { 0, 0 }, { 1, 1 }, { 8, 1 },
+ { 8, 8 }, { 9, 2 }, { 2, 2 }, { 16, 9 },
+ { 16, 16 }, { 17, 10 }, { 10, 3 }, { 3, 3 },
+ { 24, 17 }, { 24, 24 }, { 18, 11 }, { 11, 4 },
+ { 25, 18 }, { 4, 4 }, { 32, 25 }, { 19, 12 },
+ { 26, 19 }, { 32, 32 }, { 12, 5 }, { 33, 26 },
+ { 5, 5 }, { 40, 33 }, { 27, 20 }, { 20, 13 },
+ { 34, 27 }, { 41, 34 }, { 40, 40 }, { 13, 6 },
+ { 6, 6 }, { 35, 28 }, { 28, 21 }, { 42, 35 },
+ { 48, 48 }, { 48, 41 }, { 21, 14 }, { 14, 7 },
+ { 36, 29 }, { 49, 42 }, { 43, 36 }, { 56, 49 },
+ { 29, 22 }, { 22, 15 }, { 50, 43 }, { 44, 37 },
+ { 57, 50 }, { 37, 30 }, { 30, 23 }, { 51, 44 },
+ { 58, 51 }, { 38, 31 }, { 45, 38 }, { 52, 45 },
+ { 59, 52 }, { 46, 39 }, { 53, 46 }, { 60, 53 },
+ { 54, 47 }, { 61, 54 }, { 62, 55 }, { 0, 0 },
+};
+
+const int16_t ff_vp9_col_scan_8x8_nb[64][2] = {
+ { 0, 0 }, { 1, 1 }, { 0, 0 }, { 2, 2 },
+ { 8, 8 }, { 3, 3 }, { 9, 9 }, { 8, 8 },
+ { 4, 4 }, { 10, 10 }, { 16, 16 }, { 11, 11 },
+ { 17, 17 }, { 5, 5 }, { 16, 16 }, { 18, 18 },
+ { 12, 12 }, { 24, 24 }, { 6, 6 }, { 25, 25 },
+ { 19, 19 }, { 24, 24 }, { 13, 13 }, { 26, 26 },
+ { 20, 20 }, { 32, 32 }, { 27, 27 }, { 33, 33 },
+ { 14, 14 }, { 21, 21 }, { 34, 34 }, { 32, 32 },
+ { 28, 28 }, { 40, 40 }, { 35, 35 }, { 22, 22 },
+ { 29, 29 }, { 41, 41 }, { 36, 36 }, { 40, 40 },
+ { 42, 42 }, { 30, 30 }, { 43, 43 }, { 48, 48 },
+ { 37, 37 }, { 49, 49 }, { 48, 48 }, { 44, 44 },
+ { 38, 38 }, { 50, 50 }, { 56, 56 }, { 51, 51 },
+ { 45, 45 }, { 57, 57 }, { 52, 52 }, { 58, 58 },
+ { 46, 46 }, { 59, 59 }, { 53, 53 }, { 60, 60 },
+ { 54, 54 }, { 61, 61 }, { 62, 62 }, { 0, 0 },
+};
+
+const int16_t ff_vp9_row_scan_8x8_nb[64][2] = {
+ { 0, 0 }, { 8, 8 }, { 0, 0 }, { 1, 1 },
+ { 16, 16 }, { 1, 1 }, { 9, 9 }, { 24, 24 },
+ { 2, 2 }, { 17, 17 }, { 2, 2 }, { 32, 32 },
+ { 10, 10 }, { 3, 3 }, { 25, 25 }, { 18, 18 },
+ { 11, 11 }, { 3, 3 }, { 40, 40 }, { 33, 33 },
+ { 26, 26 }, { 4, 4 }, { 19, 19 }, { 48, 48 },
+ { 12, 12 }, { 4, 4 }, { 34, 34 }, { 27, 27 },
+ { 5, 5 }, { 41, 41 }, { 20, 20 }, { 5, 5 },
+ { 13, 13 }, { 35, 35 }, { 28, 28 }, { 6, 6 },
+ { 42, 42 }, { 21, 21 }, { 49, 49 }, { 6, 6 },
+ { 36, 36 }, { 14, 14 }, { 29, 29 }, { 43, 43 },
+ { 7, 7 }, { 50, 50 }, { 22, 22 }, { 15, 15 },
+ { 37, 37 }, { 44, 44 }, { 30, 30 }, { 51, 51 },
+ { 23, 23 }, { 38, 38 }, { 45, 45 }, { 31, 31 },
+ { 52, 52 }, { 39, 39 }, { 53, 53 }, { 46, 46 },
+ { 54, 54 }, { 47, 47 }, { 55, 55 }, { 0, 0 },
+};
+
+const int16_t ff_vp9_default_scan_16x16_nb[256][2] = {
+ { 0, 0 }, { 0, 0 }, { 1, 1 }, { 16, 1 },
+ { 16, 16 }, { 2, 2 }, { 17, 2 }, { 32, 17 },
+ { 32, 32 }, { 3, 3 }, { 33, 18 }, { 18, 3 },
+ { 48, 33 }, { 19, 4 }, { 4, 4 }, { 34, 19 },
+ { 48, 48 }, { 49, 34 }, { 35, 20 }, { 64, 49 },
+ { 20, 5 }, { 5, 5 }, { 50, 35 }, { 64, 64 },
+ { 65, 50 }, { 36, 21 }, { 21, 6 }, { 51, 36 },
+ { 6, 6 }, { 80, 65 }, { 66, 51 }, { 37, 22 },
+ { 81, 66 }, { 52, 37 }, { 22, 7 }, { 80, 80 },
+ { 67, 52 }, { 7, 7 }, { 82, 67 }, { 96, 81 },
+ { 53, 38 }, { 38, 23 }, { 68, 53 }, { 96, 96 },
+ { 23, 8 }, { 97, 82 }, { 83, 68 }, { 69, 54 },
+ { 54, 39 }, { 8, 8 }, { 39, 24 }, { 84, 69 },
+ { 98, 83 }, { 112, 97 }, { 112, 112 }, { 24, 9 },
+ { 113, 98 }, { 99, 84 }, { 70, 55 }, { 85, 70 },
+ { 55, 40 }, { 9, 9 }, { 40, 25 }, { 114, 99 },
+ { 100, 85 }, { 128, 113 }, { 115, 100 }, { 71, 56 },
+ { 86, 71 }, { 25, 10 }, { 129, 114 }, { 128, 128 },
+ { 101, 86 }, { 56, 41 }, { 10, 10 }, { 41, 26 },
+ { 116, 101 }, { 130, 115 }, { 144, 129 }, { 87, 72 },
+ { 102, 87 }, { 26, 11 }, { 72, 57 }, { 131, 116 },
+ { 117, 102 }, { 145, 130 }, { 57, 42 }, { 144, 144 },
+ { 11, 11 }, { 42, 27 }, { 132, 117 }, { 146, 131 },
+ { 103, 88 }, { 88, 73 }, { 118, 103 }, { 160, 145 },
+ { 73, 58 }, { 147, 132 }, { 133, 118 }, { 27, 12 },
+ { 161, 146 }, { 58, 43 }, { 12, 12 }, { 160, 160 },
+ { 119, 104 }, { 148, 133 }, { 89, 74 }, { 134, 119 },
+ { 104, 89 }, { 162, 147 }, { 43, 28 }, { 74, 59 },
+ { 176, 161 }, { 163, 148 }, { 28, 13 }, { 149, 134 },
+ { 120, 105 }, { 135, 120 }, { 177, 162 }, { 164, 149 },
+ { 13, 13 }, { 105, 90 }, { 59, 44 }, { 90, 75 },
+ { 150, 135 }, { 44, 29 }, { 178, 163 }, { 176, 176 },
+ { 136, 121 }, { 165, 150 }, { 121, 106 }, { 75, 60 },
+ { 179, 164 }, { 151, 136 }, { 29, 14 }, { 60, 45 },
+ { 14, 14 }, { 106, 91 }, { 166, 151 }, { 180, 165 },
+ { 192, 177 }, { 91, 76 }, { 192, 192 }, { 45, 30 },
+ { 137, 122 }, { 122, 107 }, { 152, 137 }, { 193, 178 },
+ { 76, 61 }, { 167, 152 }, { 181, 166 }, { 30, 15 },
+ { 194, 179 }, { 208, 193 }, { 182, 167 }, { 107, 92 },
+ { 138, 123 }, { 61, 46 }, { 153, 138 }, { 46, 31 },
+ { 195, 180 }, { 92, 77 }, { 168, 153 }, { 209, 194 },
+ { 196, 181 }, { 208, 208 }, { 123, 108 }, { 183, 168 },
+ { 210, 195 }, { 77, 62 }, { 108, 93 }, { 169, 154 },
+ { 154, 139 }, { 62, 47 }, { 197, 182 }, { 211, 196 },
+ { 184, 169 }, { 224, 209 }, { 224, 224 }, { 139, 124 },
+ { 93, 78 }, { 198, 183 }, { 124, 109 }, { 78, 63 },
+ { 212, 197 }, { 225, 210 }, { 170, 155 }, { 185, 170 },
+ { 155, 140 }, { 213, 198 }, { 199, 184 }, { 109, 94 },
+ { 226, 211 }, { 140, 125 }, { 94, 79 }, { 240, 225 },
+ { 214, 199 }, { 227, 212 }, { 200, 185 }, { 125, 110 },
+ { 241, 226 }, { 186, 171 }, { 171, 156 }, { 156, 141 },
+ { 228, 213 }, { 110, 95 }, { 215, 200 }, { 242, 227 },
+ { 141, 126 }, { 201, 186 }, { 229, 214 }, { 126, 111 },
+ { 216, 201 }, { 243, 228 }, { 172, 157 }, { 187, 172 },
+ { 230, 215 }, { 157, 142 }, { 202, 187 }, { 142, 127 },
+ { 244, 229 }, { 217, 202 }, { 231, 216 }, { 188, 173 },
+ { 245, 230 }, { 158, 143 }, { 173, 158 }, { 232, 217 },
+ { 246, 231 }, { 218, 203 }, { 203, 188 }, { 174, 159 },
+ { 189, 174 }, { 247, 232 }, { 233, 218 }, { 204, 189 },
+ { 219, 204 }, { 248, 233 }, { 190, 175 }, { 234, 219 },
+ { 220, 205 }, { 249, 234 }, { 205, 190 }, { 221, 206 },
+ { 250, 235 }, { 235, 220 }, { 206, 191 }, { 236, 221 },
+ { 222, 207 }, { 251, 236 }, { 237, 222 }, { 252, 237 },
+ { 238, 223 }, { 253, 238 }, { 254, 239 }, { 0, 0 },
+};
+
+const int16_t ff_vp9_col_scan_16x16_nb[256][2] = {
+ { 0, 0 }, { 1, 1 }, { 2, 2 }, { 0, 0 },
+ { 3, 3 }, { 16, 16 }, { 4, 4 }, { 17, 17 },
+ { 5, 5 }, { 18, 18 }, { 16, 16 }, { 19, 19 },
+ { 6, 6 }, { 32, 32 }, { 20, 20 }, { 33, 33 },
+ { 7, 7 }, { 34, 34 }, { 21, 21 }, { 32, 32 },
+ { 35, 35 }, { 8, 8 }, { 48, 48 }, { 22, 22 },
+ { 49, 49 }, { 36, 36 }, { 9, 9 }, { 37, 37 },
+ { 50, 50 }, { 23, 23 }, { 48, 48 }, { 51, 51 },
+ { 10, 10 }, { 64, 64 }, { 38, 38 }, { 24, 24 },
+ { 52, 52 }, { 65, 65 }, { 53, 53 }, { 39, 39 },
+ { 66, 66 }, { 11, 11 }, { 64, 64 }, { 25, 25 },
+ { 67, 67 }, { 54, 54 }, { 80, 80 }, { 40, 40 },
+ { 68, 68 }, { 12, 12 }, { 26, 26 }, { 81, 81 },
+ { 55, 55 }, { 69, 69 }, { 82, 82 }, { 41, 41 },
+ { 13, 13 }, { 83, 83 }, { 80, 80 }, { 70, 70 },
+ { 27, 27 }, { 56, 56 }, { 84, 84 }, { 96, 96 },
+ { 14, 14 }, { 71, 71 }, { 97, 97 }, { 42, 42 },
+ { 85, 85 }, { 57, 57 }, { 98, 98 }, { 28, 28 },
+ { 86, 86 }, { 99, 99 }, { 96, 96 }, { 72, 72 },
+ { 43, 43 }, { 100, 100 }, { 58, 58 }, { 29, 29 },
+ { 112, 112 }, { 87, 87 }, { 113, 113 }, { 73, 73 },
+ { 112, 112 }, { 101, 101 }, { 44, 44 }, { 30, 30 },
+ { 114, 114 }, { 59, 59 }, { 102, 102 }, { 88, 88 },
+ { 115, 115 }, { 74, 74 }, { 128, 128 }, { 116, 116 },
+ { 45, 45 }, { 103, 103 }, { 89, 89 }, { 60, 60 },
+ { 129, 129 }, { 117, 117 }, { 130, 130 }, { 131, 131 },
+ { 104, 104 }, { 75, 75 }, { 46, 46 }, { 118, 118 },
+ { 128, 128 }, { 90, 90 }, { 61, 61 }, { 132, 132 },
+ { 105, 105 }, { 144, 144 }, { 119, 119 }, { 145, 145 },
+ { 133, 133 }, { 76, 76 }, { 146, 146 }, { 120, 120 },
+ { 91, 91 }, { 134, 134 }, { 147, 147 }, { 62, 62 },
+ { 106, 106 }, { 135, 135 }, { 121, 121 }, { 92, 92 },
+ { 148, 148 }, { 144, 144 }, { 77, 77 }, { 149, 149 },
+ { 136, 136 }, { 107, 107 }, { 160, 160 }, { 161, 161 },
+ { 150, 150 }, { 122, 122 }, { 78, 78 }, { 137, 137 },
+ { 162, 162 }, { 151, 151 }, { 93, 93 }, { 163, 163 },
+ { 108, 108 }, { 164, 164 }, { 152, 152 }, { 123, 123 },
+ { 138, 138 }, { 160, 160 }, { 165, 165 }, { 94, 94 },
+ { 176, 176 }, { 166, 166 }, { 109, 109 }, { 153, 153 },
+ { 177, 177 }, { 124, 124 }, { 178, 178 }, { 139, 139 },
+ { 167, 167 }, { 154, 154 }, { 110, 110 }, { 179, 179 },
+ { 176, 176 }, { 180, 180 }, { 168, 168 }, { 140, 140 },
+ { 125, 125 }, { 181, 181 }, { 192, 192 }, { 193, 193 },
+ { 155, 155 }, { 182, 182 }, { 169, 169 }, { 194, 194 },
+ { 126, 126 }, { 141, 141 }, { 195, 195 }, { 183, 183 },
+ { 192, 192 }, { 196, 196 }, { 156, 156 }, { 170, 170 },
+ { 142, 142 }, { 184, 184 }, { 197, 197 }, { 208, 208 },
+ { 198, 198 }, { 209, 209 }, { 171, 171 }, { 157, 157 },
+ { 185, 185 }, { 210, 210 }, { 208, 208 }, { 211, 211 },
+ { 199, 199 }, { 224, 224 }, { 158, 158 }, { 212, 212 },
+ { 224, 224 }, { 186, 186 }, { 200, 200 }, { 172, 172 },
+ { 225, 225 }, { 213, 213 }, { 214, 214 }, { 226, 226 },
+ { 201, 201 }, { 227, 227 }, { 187, 187 }, { 240, 240 },
+ { 215, 215 }, { 173, 173 }, { 228, 228 }, { 241, 241 },
+ { 202, 202 }, { 242, 242 }, { 216, 216 }, { 229, 229 },
+ { 174, 174 }, { 188, 188 }, { 243, 243 }, { 230, 230 },
+ { 203, 203 }, { 217, 217 }, { 231, 231 }, { 244, 244 },
+ { 218, 218 }, { 245, 245 }, { 189, 189 }, { 232, 232 },
+ { 204, 204 }, { 190, 190 }, { 246, 246 }, { 233, 233 },
+ { 247, 247 }, { 219, 219 }, { 205, 205 }, { 248, 248 },
+ { 234, 234 }, { 220, 220 }, { 206, 206 }, { 249, 249 },
+ { 235, 235 }, { 221, 221 }, { 250, 250 }, { 222, 222 },
+ { 236, 236 }, { 237, 237 }, { 251, 251 }, { 238, 238 },
+ { 252, 252 }, { 253, 253 }, { 254, 254 }, { 0, 0 },
+};
+
+const int16_t ff_vp9_row_scan_16x16_nb[256][2] = {
+ { 0, 0 }, { 16, 16 }, { 0, 0 }, { 32, 32 },
+ { 1, 1 }, { 48, 48 }, { 17, 17 }, { 1, 1 },
+ { 64, 64 }, { 2, 2 }, { 33, 33 }, { 80, 80 },
+ { 18, 18 }, { 2, 2 }, { 49, 49 }, { 3, 3 },
+ { 96, 96 }, { 34, 34 }, { 65, 65 }, { 19, 19 },
+ { 3, 3 }, { 112, 112 }, { 50, 50 }, { 4, 4 },
+ { 81, 81 }, { 35, 35 }, { 66, 66 }, { 4, 4 },
+ { 128, 128 }, { 20, 20 }, { 51, 51 }, { 97, 97 },
+ { 82, 82 }, { 5, 5 }, { 36, 36 }, { 144, 144 },
+ { 67, 67 }, { 113, 113 }, { 21, 21 }, { 52, 52 },
+ { 5, 5 }, { 98, 98 }, { 160, 160 }, { 83, 83 },
+ { 37, 37 }, { 6, 6 }, { 68, 68 }, { 129, 129 },
+ { 22, 22 }, { 53, 53 }, { 114, 114 }, { 6, 6 },
+ { 99, 99 }, { 176, 176 }, { 84, 84 }, { 38, 38 },
+ { 7, 7 }, { 69, 69 }, { 145, 145 }, { 130, 130 },
+ { 115, 115 }, { 23, 23 }, { 54, 54 }, { 192, 192 },
+ { 100, 100 }, { 7, 7 }, { 85, 85 }, { 161, 161 },
+ { 39, 39 }, { 70, 70 }, { 8, 8 }, { 146, 146 },
+ { 131, 131 }, { 116, 116 }, { 55, 55 }, { 208, 208 },
+ { 101, 101 }, { 24, 24 }, { 86, 86 }, { 8, 8 },
+ { 132, 132 }, { 40, 40 }, { 71, 71 }, { 177, 177 },
+ { 147, 147 }, { 224, 224 }, { 117, 117 }, { 162, 162 },
+ { 9, 9 }, { 102, 102 }, { 56, 56 }, { 25, 25 },
+ { 87, 87 }, { 148, 148 }, { 9, 9 }, { 133, 133 },
+ { 72, 72 }, { 118, 118 }, { 193, 193 }, { 163, 163 },
+ { 41, 41 }, { 103, 103 }, { 178, 178 }, { 10, 10 },
+ { 57, 57 }, { 149, 149 }, { 134, 134 }, { 88, 88 },
+ { 26, 26 }, { 119, 119 }, { 10, 10 }, { 164, 164 },
+ { 104, 104 }, { 73, 73 }, { 209, 209 }, { 179, 179 },
+ { 42, 42 }, { 11, 11 }, { 194, 194 }, { 135, 135 },
+ { 165, 165 }, { 150, 150 }, { 58, 58 }, { 27, 27 },
+ { 89, 89 }, { 11, 11 }, { 120, 120 }, { 74, 74 },
+ { 43, 43 }, { 225, 225 }, { 105, 105 }, { 12, 12 },
+ { 180, 180 }, { 151, 151 }, { 195, 195 }, { 136, 136 },
+ { 28, 28 }, { 166, 166 }, { 121, 121 }, { 59, 59 },
+ { 12, 12 }, { 210, 210 }, { 90, 90 }, { 106, 106 },
+ { 44, 44 }, { 181, 181 }, { 75, 75 }, { 152, 152 },
+ { 13, 13 }, { 167, 167 }, { 137, 137 }, { 13, 13 },
+ { 60, 60 }, { 196, 196 }, { 122, 122 }, { 29, 29 },
+ { 91, 91 }, { 14, 14 }, { 182, 182 }, { 76, 76 },
+ { 211, 211 }, { 153, 153 }, { 14, 14 }, { 107, 107 },
+ { 138, 138 }, { 45, 45 }, { 226, 226 }, { 168, 168 },
+ { 197, 197 }, { 123, 123 }, { 30, 30 }, { 61, 61 },
+ { 15, 15 }, { 92, 92 }, { 154, 154 }, { 183, 183 },
+ { 169, 169 }, { 108, 108 }, { 212, 212 }, { 77, 77 },
+ { 139, 139 }, { 198, 198 }, { 46, 46 }, { 124, 124 },
+ { 227, 227 }, { 62, 62 }, { 31, 31 }, { 184, 184 },
+ { 93, 93 }, { 170, 170 }, { 155, 155 }, { 185, 185 },
+ { 78, 78 }, { 47, 47 }, { 199, 199 }, { 213, 213 },
+ { 140, 140 }, { 63, 63 }, { 109, 109 }, { 125, 125 },
+ { 94, 94 }, { 200, 200 }, { 171, 171 }, { 156, 156 },
+ { 228, 228 }, { 186, 186 }, { 214, 214 }, { 201, 201 },
+ { 79, 79 }, { 141, 141 }, { 110, 110 }, { 229, 229 },
+ { 95, 95 }, { 126, 126 }, { 215, 215 }, { 172, 172 },
+ { 111, 111 }, { 142, 142 }, { 202, 202 }, { 157, 157 },
+ { 216, 216 }, { 230, 230 }, { 217, 217 }, { 187, 187 },
+ { 127, 127 }, { 231, 231 }, { 158, 158 }, { 173, 173 },
+ { 143, 143 }, { 203, 203 }, { 188, 188 }, { 232, 232 },
+ { 218, 218 }, { 233, 233 }, { 159, 159 }, { 174, 174 },
+ { 204, 204 }, { 189, 189 }, { 234, 234 }, { 219, 219 },
+ { 175, 175 }, { 205, 205 }, { 235, 235 }, { 220, 220 },
+ { 190, 190 }, { 236, 236 }, { 206, 206 }, { 191, 191 },
+ { 221, 221 }, { 207, 207 }, { 237, 237 }, { 222, 222 },
+ { 238, 238 }, { 223, 223 }, { 239, 239 }, { 0, 0 },
+};
+
+const int16_t ff_vp9_default_scan_32x32_nb[1024][2] = {
+ { 0, 0 }, { 0, 0 }, { 1, 1 }, { 32, 1 },
+ { 32, 32 }, { 2, 2 }, { 33, 2 }, { 64, 33 },
+ { 3, 3 }, { 64, 64 }, { 34, 3 }, { 65, 34 },
+ { 4, 4 }, { 35, 4 }, { 96, 65 }, { 66, 35 },
+ { 96, 96 }, { 97, 66 }, { 67, 36 }, { 36, 5 },
+ { 5, 5 }, { 128, 97 }, { 98, 67 }, { 6, 6 },
+ { 128, 128 }, { 68, 37 }, { 37, 6 }, { 129, 98 },
+ { 99, 68 }, { 160, 129 }, { 130, 99 }, { 38, 7 },
+ { 69, 38 }, { 7, 7 }, { 100, 69 }, { 161, 130 },
+ { 131, 100 }, { 160, 160 }, { 70, 39 }, { 39, 8 },
+ { 8, 8 }, { 101, 70 }, { 162, 131 }, { 132, 101 },
+ { 192, 161 }, { 71, 40 }, { 192, 192 }, { 102, 71 },
+ { 40, 9 }, { 163, 132 }, { 9, 9 }, { 193, 162 },
+ { 133, 102 }, { 164, 133 }, { 72, 41 }, { 103, 72 },
+ { 134, 103 }, { 224, 193 }, { 41, 10 }, { 194, 163 },
+ { 10, 10 }, { 224, 224 }, { 165, 134 }, { 225, 194 },
+ { 195, 164 }, { 73, 42 }, { 104, 73 }, { 135, 104 },
+ { 42, 11 }, { 11, 11 }, { 166, 135 }, { 196, 165 },
+ { 226, 195 }, { 256, 225 }, { 74, 43 }, { 105, 74 },
+ { 136, 105 }, { 227, 196 }, { 43, 12 }, { 197, 166 },
+ { 167, 136 }, { 257, 226 }, { 256, 256 }, { 12, 12 },
+ { 228, 197 }, { 75, 44 }, { 106, 75 }, { 198, 167 },
+ { 137, 106 }, { 258, 227 }, { 168, 137 }, { 288, 257 },
+ { 44, 13 }, { 229, 198 }, { 259, 228 }, { 199, 168 },
+ { 107, 76 }, { 13, 13 }, { 169, 138 }, { 138, 107 },
+ { 288, 288 }, { 289, 258 }, { 76, 45 }, { 230, 199 },
+ { 260, 229 }, { 45, 14 }, { 200, 169 }, { 139, 108 },
+ { 290, 259 }, { 108, 77 }, { 231, 200 }, { 320, 289 },
+ { 261, 230 }, { 170, 139 }, { 77, 46 }, { 291, 260 },
+ { 14, 14 }, { 321, 290 }, { 201, 170 }, { 262, 231 },
+ { 320, 320 }, { 171, 140 }, { 292, 261 }, { 232, 201 },
+ { 140, 109 }, { 322, 291 }, { 109, 78 }, { 46, 15 },
+ { 202, 171 }, { 263, 232 }, { 233, 202 }, { 293, 262 },
+ { 352, 321 }, { 323, 292 }, { 15, 15 }, { 78, 47 },
+ { 203, 172 }, { 264, 233 }, { 294, 263 }, { 324, 293 },
+ { 172, 141 }, { 353, 322 }, { 141, 110 }, { 234, 203 },
+ { 352, 352 }, { 47, 16 }, { 295, 264 }, { 110, 79 },
+ { 265, 234 }, { 354, 323 }, { 325, 294 }, { 79, 48 },
+ { 16, 16 }, { 204, 173 }, { 235, 204 }, { 173, 142 },
+ { 355, 324 }, { 384, 353 }, { 326, 295 }, { 142, 111 },
+ { 296, 265 }, { 266, 235 }, { 356, 325 }, { 385, 354 },
+ { 111, 80 }, { 48, 17 }, { 327, 296 }, { 297, 266 },
+ { 205, 174 }, { 384, 384 }, { 236, 205 }, { 357, 326 },
+ { 386, 355 }, { 80, 49 }, { 174, 143 }, { 17, 17 },
+ { 328, 297 }, { 358, 327 }, { 387, 356 }, { 298, 267 },
+ { 329, 298 }, { 388, 357 }, { 112, 81 }, { 416, 385 },
+ { 237, 206 }, { 359, 328 }, { 49, 18 }, { 206, 175 },
+ { 417, 386 }, { 389, 358 }, { 330, 299 }, { 18, 18 },
+ { 416, 416 }, { 360, 329 }, { 81, 50 }, { 418, 387 },
+ { 390, 359 }, { 238, 207 }, { 50, 19 }, { 361, 330 },
+ { 419, 388 }, { 113, 82 }, { 448, 417 }, { 448, 448 },
+ { 420, 389 }, { 82, 51 }, { 362, 331 }, { 449, 418 },
+ { 421, 390 }, { 480, 480 }, { 450, 419 }, { 422, 391 },
+ { 114, 83 }, { 451, 420 }, { 480, 449 }, { 452, 421 },
+ { 481, 450 }, { 453, 422 }, { 512, 512 }, { 482, 451 },
+ { 454, 423 }, { 512, 481 }, { 483, 452 }, { 513, 482 },
+ { 484, 453 }, { 514, 483 }, { 485, 454 }, { 544, 513 },
+ { 544, 544 }, { 486, 455 }, { 545, 514 }, { 546, 515 },
+ { 576, 576 }, { 576, 545 }, { 577, 546 }, { 578, 547 },
+ { 608, 577 }, { 609, 578 }, { 610, 579 }, { 19, 19 },
+ { 143, 112 }, { 267, 236 }, { 391, 360 }, { 515, 484 },
+ { 608, 608 }, { 20, 20 }, { 51, 20 }, { 144, 113 },
+ { 175, 144 }, { 268, 237 }, { 299, 268 }, { 392, 361 },
+ { 423, 392 }, { 516, 485 }, { 547, 516 }, { 640, 609 },
+ { 640, 640 }, { 21, 21 }, { 52, 21 }, { 83, 52 },
+ { 145, 114 }, { 176, 145 }, { 207, 176 }, { 269, 238 },
+ { 300, 269 }, { 331, 300 }, { 393, 362 }, { 424, 393 },
+ { 455, 424 }, { 517, 486 }, { 548, 517 }, { 579, 548 },
+ { 641, 610 }, { 672, 641 }, { 672, 672 }, { 22, 22 },
+ { 53, 22 }, { 84, 53 }, { 115, 84 }, { 146, 115 },
+ { 177, 146 }, { 208, 177 }, { 239, 208 }, { 270, 239 },
+ { 301, 270 }, { 332, 301 }, { 363, 332 }, { 394, 363 },
+ { 425, 394 }, { 456, 425 }, { 487, 456 }, { 518, 487 },
+ { 549, 518 }, { 580, 549 }, { 611, 580 }, { 642, 611 },
+ { 673, 642 }, { 704, 673 }, { 704, 704 }, { 54, 23 },
+ { 85, 54 }, { 116, 85 }, { 178, 147 }, { 209, 178 },
+ { 240, 209 }, { 302, 271 }, { 333, 302 }, { 364, 333 },
+ { 426, 395 }, { 457, 426 }, { 488, 457 }, { 550, 519 },
+ { 581, 550 }, { 612, 581 }, { 674, 643 }, { 705, 674 },
+ { 736, 705 }, { 86, 55 }, { 117, 86 }, { 210, 179 },
+ { 241, 210 }, { 334, 303 }, { 365, 334 }, { 458, 427 },
+ { 489, 458 }, { 582, 551 }, { 613, 582 }, { 706, 675 },
+ { 737, 706 }, { 118, 87 }, { 242, 211 }, { 366, 335 },
+ { 490, 459 }, { 614, 583 }, { 738, 707 }, { 23, 23 },
+ { 147, 116 }, { 271, 240 }, { 395, 364 }, { 519, 488 },
+ { 643, 612 }, { 736, 736 }, { 24, 24 }, { 55, 24 },
+ { 148, 117 }, { 179, 148 }, { 272, 241 }, { 303, 272 },
+ { 396, 365 }, { 427, 396 }, { 520, 489 }, { 551, 520 },
+ { 644, 613 }, { 675, 644 }, { 768, 737 }, { 768, 768 },
+ { 25, 25 }, { 56, 25 }, { 87, 56 }, { 149, 118 },
+ { 180, 149 }, { 211, 180 }, { 273, 242 }, { 304, 273 },
+ { 335, 304 }, { 397, 366 }, { 428, 397 }, { 459, 428 },
+ { 521, 490 }, { 552, 521 }, { 583, 552 }, { 645, 614 },
+ { 676, 645 }, { 707, 676 }, { 769, 738 }, { 800, 769 },
+ { 800, 800 }, { 26, 26 }, { 57, 26 }, { 88, 57 },
+ { 119, 88 }, { 150, 119 }, { 181, 150 }, { 212, 181 },
+ { 243, 212 }, { 274, 243 }, { 305, 274 }, { 336, 305 },
+ { 367, 336 }, { 398, 367 }, { 429, 398 }, { 460, 429 },
+ { 491, 460 }, { 522, 491 }, { 553, 522 }, { 584, 553 },
+ { 615, 584 }, { 646, 615 }, { 677, 646 }, { 708, 677 },
+ { 739, 708 }, { 770, 739 }, { 801, 770 }, { 832, 801 },
+ { 832, 832 }, { 58, 27 }, { 89, 58 }, { 120, 89 },
+ { 182, 151 }, { 213, 182 }, { 244, 213 }, { 306, 275 },
+ { 337, 306 }, { 368, 337 }, { 430, 399 }, { 461, 430 },
+ { 492, 461 }, { 554, 523 }, { 585, 554 }, { 616, 585 },
+ { 678, 647 }, { 709, 678 }, { 740, 709 }, { 802, 771 },
+ { 833, 802 }, { 864, 833 }, { 90, 59 }, { 121, 90 },
+ { 214, 183 }, { 245, 214 }, { 338, 307 }, { 369, 338 },
+ { 462, 431 }, { 493, 462 }, { 586, 555 }, { 617, 586 },
+ { 710, 679 }, { 741, 710 }, { 834, 803 }, { 865, 834 },
+ { 122, 91 }, { 246, 215 }, { 370, 339 }, { 494, 463 },
+ { 618, 587 }, { 742, 711 }, { 866, 835 }, { 27, 27 },
+ { 151, 120 }, { 275, 244 }, { 399, 368 }, { 523, 492 },
+ { 647, 616 }, { 771, 740 }, { 864, 864 }, { 28, 28 },
+ { 59, 28 }, { 152, 121 }, { 183, 152 }, { 276, 245 },
+ { 307, 276 }, { 400, 369 }, { 431, 400 }, { 524, 493 },
+ { 555, 524 }, { 648, 617 }, { 679, 648 }, { 772, 741 },
+ { 803, 772 }, { 896, 865 }, { 896, 896 }, { 29, 29 },
+ { 60, 29 }, { 91, 60 }, { 153, 122 }, { 184, 153 },
+ { 215, 184 }, { 277, 246 }, { 308, 277 }, { 339, 308 },
+ { 401, 370 }, { 432, 401 }, { 463, 432 }, { 525, 494 },
+ { 556, 525 }, { 587, 556 }, { 649, 618 }, { 680, 649 },
+ { 711, 680 }, { 773, 742 }, { 804, 773 }, { 835, 804 },
+ { 897, 866 }, { 928, 897 }, { 928, 928 }, { 30, 30 },
+ { 61, 30 }, { 92, 61 }, { 123, 92 }, { 154, 123 },
+ { 185, 154 }, { 216, 185 }, { 247, 216 }, { 278, 247 },
+ { 309, 278 }, { 340, 309 }, { 371, 340 }, { 402, 371 },
+ { 433, 402 }, { 464, 433 }, { 495, 464 }, { 526, 495 },
+ { 557, 526 }, { 588, 557 }, { 619, 588 }, { 650, 619 },
+ { 681, 650 }, { 712, 681 }, { 743, 712 }, { 774, 743 },
+ { 805, 774 }, { 836, 805 }, { 867, 836 }, { 898, 867 },
+ { 929, 898 }, { 960, 929 }, { 960, 960 }, { 62, 31 },
+ { 93, 62 }, { 124, 93 }, { 186, 155 }, { 217, 186 },
+ { 248, 217 }, { 310, 279 }, { 341, 310 }, { 372, 341 },
+ { 434, 403 }, { 465, 434 }, { 496, 465 }, { 558, 527 },
+ { 589, 558 }, { 620, 589 }, { 682, 651 }, { 713, 682 },
+ { 744, 713 }, { 806, 775 }, { 837, 806 }, { 868, 837 },
+ { 930, 899 }, { 961, 930 }, { 992, 961 }, { 94, 63 },
+ { 125, 94 }, { 218, 187 }, { 249, 218 }, { 342, 311 },
+ { 373, 342 }, { 466, 435 }, { 497, 466 }, { 590, 559 },
+ { 621, 590 }, { 714, 683 }, { 745, 714 }, { 838, 807 },
+ { 869, 838 }, { 962, 931 }, { 993, 962 }, { 126, 95 },
+ { 250, 219 }, { 374, 343 }, { 498, 467 }, { 622, 591 },
+ { 746, 715 }, { 870, 839 }, { 994, 963 }, { 155, 124 },
+ { 279, 248 }, { 403, 372 }, { 527, 496 }, { 651, 620 },
+ { 775, 744 }, { 899, 868 }, { 156, 125 }, { 187, 156 },
+ { 280, 249 }, { 311, 280 }, { 404, 373 }, { 435, 404 },
+ { 528, 497 }, { 559, 528 }, { 652, 621 }, { 683, 652 },
+ { 776, 745 }, { 807, 776 }, { 900, 869 }, { 931, 900 },
+ { 157, 126 }, { 188, 157 }, { 219, 188 }, { 281, 250 },
+ { 312, 281 }, { 343, 312 }, { 405, 374 }, { 436, 405 },
+ { 467, 436 }, { 529, 498 }, { 560, 529 }, { 591, 560 },
+ { 653, 622 }, { 684, 653 }, { 715, 684 }, { 777, 746 },
+ { 808, 777 }, { 839, 808 }, { 901, 870 }, { 932, 901 },
+ { 963, 932 }, { 158, 127 }, { 189, 158 }, { 220, 189 },
+ { 251, 220 }, { 282, 251 }, { 313, 282 }, { 344, 313 },
+ { 375, 344 }, { 406, 375 }, { 437, 406 }, { 468, 437 },
+ { 499, 468 }, { 530, 499 }, { 561, 530 }, { 592, 561 },
+ { 623, 592 }, { 654, 623 }, { 685, 654 }, { 716, 685 },
+ { 747, 716 }, { 778, 747 }, { 809, 778 }, { 840, 809 },
+ { 871, 840 }, { 902, 871 }, { 933, 902 }, { 964, 933 },
+ { 995, 964 }, { 190, 159 }, { 221, 190 }, { 252, 221 },
+ { 314, 283 }, { 345, 314 }, { 376, 345 }, { 438, 407 },
+ { 469, 438 }, { 500, 469 }, { 562, 531 }, { 593, 562 },
+ { 624, 593 }, { 686, 655 }, { 717, 686 }, { 748, 717 },
+ { 810, 779 }, { 841, 810 }, { 872, 841 }, { 934, 903 },
+ { 965, 934 }, { 996, 965 }, { 222, 191 }, { 253, 222 },
+ { 346, 315 }, { 377, 346 }, { 470, 439 }, { 501, 470 },
+ { 594, 563 }, { 625, 594 }, { 718, 687 }, { 749, 718 },
+ { 842, 811 }, { 873, 842 }, { 966, 935 }, { 997, 966 },
+ { 254, 223 }, { 378, 347 }, { 502, 471 }, { 626, 595 },
+ { 750, 719 }, { 874, 843 }, { 998, 967 }, { 283, 252 },
+ { 407, 376 }, { 531, 500 }, { 655, 624 }, { 779, 748 },
+ { 903, 872 }, { 284, 253 }, { 315, 284 }, { 408, 377 },
+ { 439, 408 }, { 532, 501 }, { 563, 532 }, { 656, 625 },
+ { 687, 656 }, { 780, 749 }, { 811, 780 }, { 904, 873 },
+ { 935, 904 }, { 285, 254 }, { 316, 285 }, { 347, 316 },
+ { 409, 378 }, { 440, 409 }, { 471, 440 }, { 533, 502 },
+ { 564, 533 }, { 595, 564 }, { 657, 626 }, { 688, 657 },
+ { 719, 688 }, { 781, 750 }, { 812, 781 }, { 843, 812 },
+ { 905, 874 }, { 936, 905 }, { 967, 936 }, { 286, 255 },
+ { 317, 286 }, { 348, 317 }, { 379, 348 }, { 410, 379 },
+ { 441, 410 }, { 472, 441 }, { 503, 472 }, { 534, 503 },
+ { 565, 534 }, { 596, 565 }, { 627, 596 }, { 658, 627 },
+ { 689, 658 }, { 720, 689 }, { 751, 720 }, { 782, 751 },
+ { 813, 782 }, { 844, 813 }, { 875, 844 }, { 906, 875 },
+ { 937, 906 }, { 968, 937 }, { 999, 968 }, { 318, 287 },
+ { 349, 318 }, { 380, 349 }, { 442, 411 }, { 473, 442 },
+ { 504, 473 }, { 566, 535 }, { 597, 566 }, { 628, 597 },
+ { 690, 659 }, { 721, 690 }, { 752, 721 }, { 814, 783 },
+ { 845, 814 }, { 876, 845 }, { 938, 907 }, { 969, 938 },
+ { 1000, 969 }, { 350, 319 }, { 381, 350 }, { 474, 443 },
+ { 505, 474 }, { 598, 567 }, { 629, 598 }, { 722, 691 },
+ { 753, 722 }, { 846, 815 }, { 877, 846 }, { 970, 939 },
+ { 1001, 970 }, { 382, 351 }, { 506, 475 }, { 630, 599 },
+ { 754, 723 }, { 878, 847 }, { 1002, 971 }, { 411, 380 },
+ { 535, 504 }, { 659, 628 }, { 783, 752 }, { 907, 876 },
+ { 412, 381 }, { 443, 412 }, { 536, 505 }, { 567, 536 },
+ { 660, 629 }, { 691, 660 }, { 784, 753 }, { 815, 784 },
+ { 908, 877 }, { 939, 908 }, { 413, 382 }, { 444, 413 },
+ { 475, 444 }, { 537, 506 }, { 568, 537 }, { 599, 568 },
+ { 661, 630 }, { 692, 661 }, { 723, 692 }, { 785, 754 },
+ { 816, 785 }, { 847, 816 }, { 909, 878 }, { 940, 909 },
+ { 971, 940 }, { 414, 383 }, { 445, 414 }, { 476, 445 },
+ { 507, 476 }, { 538, 507 }, { 569, 538 }, { 600, 569 },
+ { 631, 600 }, { 662, 631 }, { 693, 662 }, { 724, 693 },
+ { 755, 724 }, { 786, 755 }, { 817, 786 }, { 848, 817 },
+ { 879, 848 }, { 910, 879 }, { 941, 910 }, { 972, 941 },
+ { 1003, 972 }, { 446, 415 }, { 477, 446 }, { 508, 477 },
+ { 570, 539 }, { 601, 570 }, { 632, 601 }, { 694, 663 },
+ { 725, 694 }, { 756, 725 }, { 818, 787 }, { 849, 818 },
+ { 880, 849 }, { 942, 911 }, { 973, 942 }, { 1004, 973 },
+ { 478, 447 }, { 509, 478 }, { 602, 571 }, { 633, 602 },
+ { 726, 695 }, { 757, 726 }, { 850, 819 }, { 881, 850 },
+ { 974, 943 }, { 1005, 974 }, { 510, 479 }, { 634, 603 },
+ { 758, 727 }, { 882, 851 }, { 1006, 975 }, { 539, 508 },
+ { 663, 632 }, { 787, 756 }, { 911, 880 }, { 540, 509 },
+ { 571, 540 }, { 664, 633 }, { 695, 664 }, { 788, 757 },
+ { 819, 788 }, { 912, 881 }, { 943, 912 }, { 541, 510 },
+ { 572, 541 }, { 603, 572 }, { 665, 634 }, { 696, 665 },
+ { 727, 696 }, { 789, 758 }, { 820, 789 }, { 851, 820 },
+ { 913, 882 }, { 944, 913 }, { 975, 944 }, { 542, 511 },
+ { 573, 542 }, { 604, 573 }, { 635, 604 }, { 666, 635 },
+ { 697, 666 }, { 728, 697 }, { 759, 728 }, { 790, 759 },
+ { 821, 790 }, { 852, 821 }, { 883, 852 }, { 914, 883 },
+ { 945, 914 }, { 976, 945 }, { 1007, 976 }, { 574, 543 },
+ { 605, 574 }, { 636, 605 }, { 698, 667 }, { 729, 698 },
+ { 760, 729 }, { 822, 791 }, { 853, 822 }, { 884, 853 },
+ { 946, 915 }, { 977, 946 }, { 1008, 977 }, { 606, 575 },
+ { 637, 606 }, { 730, 699 }, { 761, 730 }, { 854, 823 },
+ { 885, 854 }, { 978, 947 }, { 1009, 978 }, { 638, 607 },
+ { 762, 731 }, { 886, 855 }, { 1010, 979 }, { 667, 636 },
+ { 791, 760 }, { 915, 884 }, { 668, 637 }, { 699, 668 },
+ { 792, 761 }, { 823, 792 }, { 916, 885 }, { 947, 916 },
+ { 669, 638 }, { 700, 669 }, { 731, 700 }, { 793, 762 },
+ { 824, 793 }, { 855, 824 }, { 917, 886 }, { 948, 917 },
+ { 979, 948 }, { 670, 639 }, { 701, 670 }, { 732, 701 },
+ { 763, 732 }, { 794, 763 }, { 825, 794 }, { 856, 825 },
+ { 887, 856 }, { 918, 887 }, { 949, 918 }, { 980, 949 },
+ { 1011, 980 }, { 702, 671 }, { 733, 702 }, { 764, 733 },
+ { 826, 795 }, { 857, 826 }, { 888, 857 }, { 950, 919 },
+ { 981, 950 }, { 1012, 981 }, { 734, 703 }, { 765, 734 },
+ { 858, 827 }, { 889, 858 }, { 982, 951 }, { 1013, 982 },
+ { 766, 735 }, { 890, 859 }, { 1014, 983 }, { 795, 764 },
+ { 919, 888 }, { 796, 765 }, { 827, 796 }, { 920, 889 },
+ { 951, 920 }, { 797, 766 }, { 828, 797 }, { 859, 828 },
+ { 921, 890 }, { 952, 921 }, { 983, 952 }, { 798, 767 },
+ { 829, 798 }, { 860, 829 }, { 891, 860 }, { 922, 891 },
+ { 953, 922 }, { 984, 953 }, { 1015, 984 }, { 830, 799 },
+ { 861, 830 }, { 892, 861 }, { 954, 923 }, { 985, 954 },
+ { 1016, 985 }, { 862, 831 }, { 893, 862 }, { 986, 955 },
+ { 1017, 986 }, { 894, 863 }, { 1018, 987 }, { 923, 892 },
+ { 924, 893 }, { 955, 924 }, { 925, 894 }, { 956, 925 },
+ { 987, 956 }, { 926, 895 }, { 957, 926 }, { 988, 957 },
+ { 1019, 988 }, { 958, 927 }, { 989, 958 }, { 1020, 989 },
+ { 990, 959 }, { 1021, 990 }, { 1022, 991 }, { 0, 0 },
+};
+
+const int16_t (* const ff_vp9_scans_nb[5][4])[2] = {
+ {
+ ff_vp9_default_scan_4x4_nb, ff_vp9_col_scan_4x4_nb,
+ ff_vp9_row_scan_4x4_nb, ff_vp9_default_scan_4x4_nb
+ }, {
+ ff_vp9_default_scan_8x8_nb, ff_vp9_col_scan_8x8_nb,
+ ff_vp9_row_scan_8x8_nb, ff_vp9_default_scan_8x8_nb
+ }, {
+ ff_vp9_default_scan_16x16_nb, ff_vp9_col_scan_16x16_nb,
+ ff_vp9_row_scan_16x16_nb, ff_vp9_default_scan_16x16_nb
+ }, {
+ ff_vp9_default_scan_32x32_nb, ff_vp9_default_scan_32x32_nb,
+ ff_vp9_default_scan_32x32_nb, ff_vp9_default_scan_32x32_nb
+ }, { // lossless
+ ff_vp9_default_scan_4x4_nb, ff_vp9_default_scan_4x4_nb,
+ ff_vp9_default_scan_4x4_nb, ff_vp9_default_scan_4x4_nb
+ }
+};
+
+const uint8_t ff_vp9_model_pareto8[256][8] = {
+ { 6, 86, 128, 11, 87, 42, 91, 52 },
+ { 3, 86, 128, 6, 86, 23, 88, 29 },
+ { 6, 86, 128, 11, 87, 42, 91, 52 },
+ { 9, 86, 129, 17, 88, 61, 94, 76 },
+ { 12, 86, 129, 22, 88, 77, 97, 93 },
+ { 15, 87, 129, 28, 89, 93, 100, 110 },
+ { 17, 87, 129, 33, 90, 105, 103, 123 },
+ { 20, 88, 130, 38, 91, 118, 106, 136 },
+ { 23, 88, 130, 43, 91, 128, 108, 146 },
+ { 26, 89, 131, 48, 92, 139, 111, 156 },
+ { 28, 89, 131, 53, 93, 147, 114, 163 },
+ { 31, 90, 131, 58, 94, 156, 117, 171 },
+ { 34, 90, 131, 62, 94, 163, 119, 177 },
+ { 37, 90, 132, 66, 95, 171, 122, 184 },
+ { 39, 90, 132, 70, 96, 177, 124, 189 },
+ { 42, 91, 132, 75, 97, 183, 127, 194 },
+ { 44, 91, 132, 79, 97, 188, 129, 198 },
+ { 47, 92, 133, 83, 98, 193, 132, 202 },
+ { 49, 92, 133, 86, 99, 197, 134, 205 },
+ { 52, 93, 133, 90, 100, 201, 137, 208 },
+ { 54, 93, 133, 94, 100, 204, 139, 211 },
+ { 57, 94, 134, 98, 101, 208, 142, 214 },
+ { 59, 94, 134, 101, 102, 211, 144, 216 },
+ { 62, 94, 135, 105, 103, 214, 146, 218 },
+ { 64, 94, 135, 108, 103, 216, 148, 220 },
+ { 66, 95, 135, 111, 104, 219, 151, 222 },
+ { 68, 95, 135, 114, 105, 221, 153, 223 },
+ { 71, 96, 136, 117, 106, 224, 155, 225 },
+ { 73, 96, 136, 120, 106, 225, 157, 226 },
+ { 76, 97, 136, 123, 107, 227, 159, 228 },
+ { 78, 97, 136, 126, 108, 229, 160, 229 },
+ { 80, 98, 137, 129, 109, 231, 162, 231 },
+ { 82, 98, 137, 131, 109, 232, 164, 232 },
+ { 84, 98, 138, 134, 110, 234, 166, 233 },
+ { 86, 98, 138, 137, 111, 235, 168, 234 },
+ { 89, 99, 138, 140, 112, 236, 170, 235 },
+ { 91, 99, 138, 142, 112, 237, 171, 235 },
+ { 93, 100, 139, 145, 113, 238, 173, 236 },
+ { 95, 100, 139, 147, 114, 239, 174, 237 },
+ { 97, 101, 140, 149, 115, 240, 176, 238 },
+ { 99, 101, 140, 151, 115, 241, 177, 238 },
+ { 101, 102, 140, 154, 116, 242, 179, 239 },
+ { 103, 102, 140, 156, 117, 242, 180, 239 },
+ { 105, 103, 141, 158, 118, 243, 182, 240 },
+ { 107, 103, 141, 160, 118, 243, 183, 240 },
+ { 109, 104, 141, 162, 119, 244, 185, 241 },
+ { 111, 104, 141, 164, 119, 244, 186, 241 },
+ { 113, 104, 142, 166, 120, 245, 187, 242 },
+ { 114, 104, 142, 168, 121, 245, 188, 242 },
+ { 116, 105, 143, 170, 122, 246, 190, 243 },
+ { 118, 105, 143, 171, 122, 246, 191, 243 },
+ { 120, 106, 143, 173, 123, 247, 192, 244 },
+ { 121, 106, 143, 175, 124, 247, 193, 244 },
+ { 123, 107, 144, 177, 125, 248, 195, 244 },
+ { 125, 107, 144, 178, 125, 248, 196, 244 },
+ { 127, 108, 145, 180, 126, 249, 197, 245 },
+ { 128, 108, 145, 181, 127, 249, 198, 245 },
+ { 130, 109, 145, 183, 128, 249, 199, 245 },
+ { 132, 109, 145, 184, 128, 249, 200, 245 },
+ { 134, 110, 146, 186, 129, 250, 201, 246 },
+ { 135, 110, 146, 187, 130, 250, 202, 246 },
+ { 137, 111, 147, 189, 131, 251, 203, 246 },
+ { 138, 111, 147, 190, 131, 251, 204, 246 },
+ { 140, 112, 147, 192, 132, 251, 205, 247 },
+ { 141, 112, 147, 193, 132, 251, 206, 247 },
+ { 143, 113, 148, 194, 133, 251, 207, 247 },
+ { 144, 113, 148, 195, 134, 251, 207, 247 },
+ { 146, 114, 149, 197, 135, 252, 208, 248 },
+ { 147, 114, 149, 198, 135, 252, 209, 248 },
+ { 149, 115, 149, 199, 136, 252, 210, 248 },
+ { 150, 115, 149, 200, 137, 252, 210, 248 },
+ { 152, 115, 150, 201, 138, 252, 211, 248 },
+ { 153, 115, 150, 202, 138, 252, 212, 248 },
+ { 155, 116, 151, 204, 139, 253, 213, 249 },
+ { 156, 116, 151, 205, 139, 253, 213, 249 },
+ { 158, 117, 151, 206, 140, 253, 214, 249 },
+ { 159, 117, 151, 207, 141, 253, 215, 249 },
+ { 161, 118, 152, 208, 142, 253, 216, 249 },
+ { 162, 118, 152, 209, 142, 253, 216, 249 },
+ { 163, 119, 153, 210, 143, 253, 217, 249 },
+ { 164, 119, 153, 211, 143, 253, 217, 249 },
+ { 166, 120, 153, 212, 144, 254, 218, 250 },
+ { 167, 120, 153, 212, 145, 254, 219, 250 },
+ { 168, 121, 154, 213, 146, 254, 220, 250 },
+ { 169, 121, 154, 214, 146, 254, 220, 250 },
+ { 171, 122, 155, 215, 147, 254, 221, 250 },
+ { 172, 122, 155, 216, 147, 254, 221, 250 },
+ { 173, 123, 155, 217, 148, 254, 222, 250 },
+ { 174, 123, 155, 217, 149, 254, 222, 250 },
+ { 176, 124, 156, 218, 150, 254, 223, 250 },
+ { 177, 124, 156, 219, 150, 254, 223, 250 },
+ { 178, 125, 157, 220, 151, 254, 224, 251 },
+ { 179, 125, 157, 220, 151, 254, 224, 251 },
+ { 180, 126, 157, 221, 152, 254, 225, 251 },
+ { 181, 126, 157, 221, 152, 254, 225, 251 },
+ { 183, 127, 158, 222, 153, 254, 226, 251 },
+ { 184, 127, 158, 223, 154, 254, 226, 251 },
+ { 185, 128, 159, 224, 155, 255, 227, 251 },
+ { 186, 128, 159, 224, 155, 255, 227, 251 },
+ { 187, 129, 160, 225, 156, 255, 228, 251 },
+ { 188, 130, 160, 225, 156, 255, 228, 251 },
+ { 189, 131, 160, 226, 157, 255, 228, 251 },
+ { 190, 131, 160, 226, 158, 255, 228, 251 },
+ { 191, 132, 161, 227, 159, 255, 229, 251 },
+ { 192, 132, 161, 227, 159, 255, 229, 251 },
+ { 193, 133, 162, 228, 160, 255, 230, 252 },
+ { 194, 133, 162, 229, 160, 255, 230, 252 },
+ { 195, 134, 163, 230, 161, 255, 231, 252 },
+ { 196, 134, 163, 230, 161, 255, 231, 252 },
+ { 197, 135, 163, 231, 162, 255, 231, 252 },
+ { 198, 135, 163, 231, 162, 255, 231, 252 },
+ { 199, 136, 164, 232, 163, 255, 232, 252 },
+ { 200, 136, 164, 232, 164, 255, 232, 252 },
+ { 201, 137, 165, 233, 165, 255, 233, 252 },
+ { 201, 137, 165, 233, 165, 255, 233, 252 },
+ { 202, 138, 166, 233, 166, 255, 233, 252 },
+ { 203, 138, 166, 233, 166, 255, 233, 252 },
+ { 204, 139, 166, 234, 167, 255, 234, 252 },
+ { 205, 139, 166, 234, 167, 255, 234, 252 },
+ { 206, 140, 167, 235, 168, 255, 235, 252 },
+ { 206, 140, 167, 235, 168, 255, 235, 252 },
+ { 207, 141, 168, 236, 169, 255, 235, 252 },
+ { 208, 141, 168, 236, 170, 255, 235, 252 },
+ { 209, 142, 169, 237, 171, 255, 236, 252 },
+ { 209, 143, 169, 237, 171, 255, 236, 252 },
+ { 210, 144, 169, 237, 172, 255, 236, 252 },
+ { 211, 144, 169, 237, 172, 255, 236, 252 },
+ { 212, 145, 170, 238, 173, 255, 237, 252 },
+ { 213, 145, 170, 238, 173, 255, 237, 252 },
+ { 214, 146, 171, 239, 174, 255, 237, 253 },
+ { 214, 146, 171, 239, 174, 255, 237, 253 },
+ { 215, 147, 172, 240, 175, 255, 238, 253 },
+ { 215, 147, 172, 240, 175, 255, 238, 253 },
+ { 216, 148, 173, 240, 176, 255, 238, 253 },
+ { 217, 148, 173, 240, 176, 255, 238, 253 },
+ { 218, 149, 173, 241, 177, 255, 239, 253 },
+ { 218, 149, 173, 241, 178, 255, 239, 253 },
+ { 219, 150, 174, 241, 179, 255, 239, 253 },
+ { 219, 151, 174, 241, 179, 255, 239, 253 },
+ { 220, 152, 175, 242, 180, 255, 240, 253 },
+ { 221, 152, 175, 242, 180, 255, 240, 253 },
+ { 222, 153, 176, 242, 181, 255, 240, 253 },
+ { 222, 153, 176, 242, 181, 255, 240, 253 },
+ { 223, 154, 177, 243, 182, 255, 240, 253 },
+ { 223, 154, 177, 243, 182, 255, 240, 253 },
+ { 224, 155, 178, 244, 183, 255, 241, 253 },
+ { 224, 155, 178, 244, 183, 255, 241, 253 },
+ { 225, 156, 178, 244, 184, 255, 241, 253 },
+ { 225, 157, 178, 244, 184, 255, 241, 253 },
+ { 226, 158, 179, 244, 185, 255, 242, 253 },
+ { 227, 158, 179, 244, 185, 255, 242, 253 },
+ { 228, 159, 180, 245, 186, 255, 242, 253 },
+ { 228, 159, 180, 245, 186, 255, 242, 253 },
+ { 229, 160, 181, 245, 187, 255, 242, 253 },
+ { 229, 160, 181, 245, 187, 255, 242, 253 },
+ { 230, 161, 182, 246, 188, 255, 243, 253 },
+ { 230, 162, 182, 246, 188, 255, 243, 253 },
+ { 231, 163, 183, 246, 189, 255, 243, 253 },
+ { 231, 163, 183, 246, 189, 255, 243, 253 },
+ { 232, 164, 184, 247, 190, 255, 243, 253 },
+ { 232, 164, 184, 247, 190, 255, 243, 253 },
+ { 233, 165, 185, 247, 191, 255, 244, 253 },
+ { 233, 165, 185, 247, 191, 255, 244, 253 },
+ { 234, 166, 185, 247, 192, 255, 244, 253 },
+ { 234, 167, 185, 247, 192, 255, 244, 253 },
+ { 235, 168, 186, 248, 193, 255, 244, 253 },
+ { 235, 168, 186, 248, 193, 255, 244, 253 },
+ { 236, 169, 187, 248, 194, 255, 244, 253 },
+ { 236, 169, 187, 248, 194, 255, 244, 253 },
+ { 236, 170, 188, 248, 195, 255, 245, 253 },
+ { 236, 170, 188, 248, 195, 255, 245, 253 },
+ { 237, 171, 189, 249, 196, 255, 245, 254 },
+ { 237, 172, 189, 249, 196, 255, 245, 254 },
+ { 238, 173, 190, 249, 197, 255, 245, 254 },
+ { 238, 173, 190, 249, 197, 255, 245, 254 },
+ { 239, 174, 191, 249, 198, 255, 245, 254 },
+ { 239, 174, 191, 249, 198, 255, 245, 254 },
+ { 240, 175, 192, 249, 199, 255, 246, 254 },
+ { 240, 176, 192, 249, 199, 255, 246, 254 },
+ { 240, 177, 193, 250, 200, 255, 246, 254 },
+ { 240, 177, 193, 250, 200, 255, 246, 254 },
+ { 241, 178, 194, 250, 201, 255, 246, 254 },
+ { 241, 178, 194, 250, 201, 255, 246, 254 },
+ { 242, 179, 195, 250, 202, 255, 246, 254 },
+ { 242, 180, 195, 250, 202, 255, 246, 254 },
+ { 242, 181, 196, 250, 203, 255, 247, 254 },
+ { 242, 181, 196, 250, 203, 255, 247, 254 },
+ { 243, 182, 197, 251, 204, 255, 247, 254 },
+ { 243, 183, 197, 251, 204, 255, 247, 254 },
+ { 244, 184, 198, 251, 205, 255, 247, 254 },
+ { 244, 184, 198, 251, 205, 255, 247, 254 },
+ { 244, 185, 199, 251, 206, 255, 247, 254 },
+ { 244, 185, 199, 251, 206, 255, 247, 254 },
+ { 245, 186, 200, 251, 207, 255, 247, 254 },
+ { 245, 187, 200, 251, 207, 255, 247, 254 },
+ { 246, 188, 201, 252, 207, 255, 248, 254 },
+ { 246, 188, 201, 252, 207, 255, 248, 254 },
+ { 246, 189, 202, 252, 208, 255, 248, 254 },
+ { 246, 190, 202, 252, 208, 255, 248, 254 },
+ { 247, 191, 203, 252, 209, 255, 248, 254 },
+ { 247, 191, 203, 252, 209, 255, 248, 254 },
+ { 247, 192, 204, 252, 210, 255, 248, 254 },
+ { 247, 193, 204, 252, 210, 255, 248, 254 },
+ { 248, 194, 205, 252, 211, 255, 248, 254 },
+ { 248, 194, 205, 252, 211, 255, 248, 254 },
+ { 248, 195, 206, 252, 212, 255, 249, 254 },
+ { 248, 196, 206, 252, 212, 255, 249, 254 },
+ { 249, 197, 207, 253, 213, 255, 249, 254 },
+ { 249, 197, 207, 253, 213, 255, 249, 254 },
+ { 249, 198, 208, 253, 214, 255, 249, 254 },
+ { 249, 199, 209, 253, 214, 255, 249, 254 },
+ { 250, 200, 210, 253, 215, 255, 249, 254 },
+ { 250, 200, 210, 253, 215, 255, 249, 254 },
+ { 250, 201, 211, 253, 215, 255, 249, 254 },
+ { 250, 202, 211, 253, 215, 255, 249, 254 },
+ { 250, 203, 212, 253, 216, 255, 249, 254 },
+ { 250, 203, 212, 253, 216, 255, 249, 254 },
+ { 251, 204, 213, 253, 217, 255, 250, 254 },
+ { 251, 205, 213, 253, 217, 255, 250, 254 },
+ { 251, 206, 214, 254, 218, 255, 250, 254 },
+ { 251, 206, 215, 254, 218, 255, 250, 254 },
+ { 252, 207, 216, 254, 219, 255, 250, 254 },
+ { 252, 208, 216, 254, 219, 255, 250, 254 },
+ { 252, 209, 217, 254, 220, 255, 250, 254 },
+ { 252, 210, 217, 254, 220, 255, 250, 254 },
+ { 252, 211, 218, 254, 221, 255, 250, 254 },
+ { 252, 212, 218, 254, 221, 255, 250, 254 },
+ { 253, 213, 219, 254, 222, 255, 250, 254 },
+ { 253, 213, 220, 254, 222, 255, 250, 254 },
+ { 253, 214, 221, 254, 223, 255, 250, 254 },
+ { 253, 215, 221, 254, 223, 255, 250, 254 },
+ { 253, 216, 222, 254, 224, 255, 251, 254 },
+ { 253, 217, 223, 254, 224, 255, 251, 254 },
+ { 253, 218, 224, 254, 225, 255, 251, 254 },
+ { 253, 219, 224, 254, 225, 255, 251, 254 },
+ { 254, 220, 225, 254, 225, 255, 251, 254 },
+ { 254, 221, 226, 254, 225, 255, 251, 254 },
+ { 254, 222, 227, 255, 226, 255, 251, 254 },
+ { 254, 223, 227, 255, 226, 255, 251, 254 },
+ { 254, 224, 228, 255, 227, 255, 251, 254 },
+ { 254, 225, 229, 255, 227, 255, 251, 254 },
+ { 254, 226, 230, 255, 228, 255, 251, 254 },
+ { 254, 227, 230, 255, 229, 255, 251, 254 },
+ { 255, 228, 231, 255, 230, 255, 251, 254 },
+ { 255, 229, 232, 255, 230, 255, 251, 254 },
+ { 255, 230, 233, 255, 231, 255, 252, 254 },
+ { 255, 231, 234, 255, 231, 255, 252, 254 },
+ { 255, 232, 235, 255, 232, 255, 252, 254 },
+ { 255, 233, 236, 255, 232, 255, 252, 254 },
+ { 255, 235, 237, 255, 233, 255, 252, 254 },
+ { 255, 236, 238, 255, 234, 255, 252, 254 },
+ { 255, 238, 240, 255, 235, 255, 252, 255 },
+ { 255, 239, 241, 255, 235, 255, 252, 254 },
+ { 255, 241, 243, 255, 236, 255, 252, 254 },
+ { 255, 243, 245, 255, 237, 255, 252, 254 },
+ { 255, 246, 247, 255, 239, 255, 253, 255 },
+};
+
+const ProbContext ff_vp9_default_probs = {
+ { /* y_mode */
+ { 65, 32, 18, 144, 162, 194, 41, 51, 98 } /* bsize < 8x8 */,
+ { 132, 68, 18, 165, 217, 196, 45, 40, 78 } /* bsize < 16x16 */,
+ { 173, 80, 19, 176, 240, 193, 64, 35, 46 } /* bsize < 32x32 */,
+ { 221, 135, 38, 194, 248, 121, 96, 85, 29 } /* bsize >= 32x32 */
+ }, { /* uv_mode */
+ { 48, 12, 154, 155, 139, 90, 34, 117, 119 } /* y = v */,
+ { 67, 6, 25, 204, 243, 158, 13, 21, 96 } /* y = h */,
+ { 120, 7, 76, 176, 208, 126, 28, 54, 103 } /* y = dc */,
+ { 97, 5, 44, 131, 176, 139, 48, 68, 97 } /* y = d45 */,
+ { 83, 5, 42, 156, 111, 152, 26, 49, 152 } /* y = d135 */,
+ { 80, 5, 58, 178, 74, 83, 33, 62, 145 } /* y = d117 */,
+ { 86, 5, 32, 154, 192, 168, 14, 22, 163 } /* y = d153 */,
+ { 77, 7, 64, 116, 132, 122, 37, 126, 120 } /* y = d63 */,
+ { 85, 5, 32, 156, 216, 148, 19, 29, 73 } /* y = d27 */,
+ { 101, 21, 107, 181, 192, 103, 19, 67, 125 } /* y = tm */
+ }, { /* filter */
+ { 235, 162, },
+ { 36, 255, },
+ { 34, 3, },
+ { 149, 144, },
+ }, { /* mv_mode */
+ { 2, 173, 34 }, // 0 = both zero mv
+ { 7, 145, 85 }, // 1 = one zero mv + one a predicted mv
+ { 7, 166, 63 }, // 2 = two predicted mvs
+ { 7, 94, 66 }, // 3 = one predicted/zero and one new mv
+ { 8, 64, 46 }, // 4 = two new mvs
+ { 17, 81, 31 }, // 5 = one intra neighbor + x
+ { 25, 29, 30 }, // 6 = two intra neighbors
+ }, { /* intra */
+ 9, 102, 187, 225
+ }, { /* comp */
+ 239, 183, 119, 96, 41
+ }, { /* single_ref */
+ { 33, 16 },
+ { 77, 74 },
+ { 142, 142 },
+ { 172, 170 },
+ { 238, 247 }
+ }, { /* comp_ref */
+ 50, 126, 123, 221, 226
+ }, { /* tx32p */
+ { 3, 136, 37, },
+ { 5, 52, 13, },
+ }, { /* tx16p */
+ { 20, 152, },
+ { 15, 101, },
+ }, { /* tx8p */
+ 100, 66
+ }, { /* skip */
+ 192, 128, 64
+ }, { /* mv_joint */
+ 32, 64, 96
+ }, {
+ { /* mv vertical component */
+ 128, /* sign */
+ { 224, 144, 192, 168, 192, 176, 192, 198, 198, 245 }, /* class */
+ 216, /* class0 */
+ { 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 }, /* bits */
+ { /* class0_fp */
+ { 128, 128, 64 },
+ { 96, 112, 64 }
+ },
+ { 64, 96, 64 }, /* fp */
+ 160, /* class0_hp bit */
+ 128, /* hp */
+ }, { /* mv horizontal component */
+ 128, /* sign */
+ { 216, 128, 176, 160, 176, 176, 192, 198, 198, 208 }, /* class */
+ 208, /* class0 */
+ { 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 }, /* bits */
+ { /* class0_fp */
+ { 128, 128, 64 },
+ { 96, 112, 64 }
+ },
+ { 64, 96, 64 }, /* fp */
+ 160, /* class0_hp bit */
+ 128, /* hp */
+ }
+ }, { /* partition */
+ { /* 64x64 -> 32x32 */
+ { 222, 34, 30 } /* a/l both not split */,
+ { 72, 16, 44 } /* a split, l not split */,
+ { 58, 32, 12 } /* l split, a not split */,
+ { 10, 7, 6 } /* a/l both split */,
+ }, { /* 32x32 -> 16x16 */
+ { 177, 58, 59 } /* a/l both not split */,
+ { 68, 26, 63 } /* a split, l not split */,
+ { 52, 79, 25 } /* l split, a not split */,
+ { 17, 14, 12 } /* a/l both split */,
+ }, { /* 16x16 -> 8x8 */
+ { 174, 73, 87 } /* a/l both not split */,
+ { 92, 41, 83 } /* a split, l not split */,
+ { 82, 99, 50 } /* l split, a not split */,
+ { 53, 39, 39 } /* a/l both split */,
+ }, { /* 8x8 -> 4x4 */
+ { 199, 122, 141 } /* a/l both not split */,
+ { 147, 63, 159 } /* a split, l not split */,
+ { 148, 133, 118 } /* l split, a not split */,
+ { 121, 104, 114 } /* a/l both split */,
+ }
+ },
+};
+
+const uint8_t ff_vp9_default_coef_probs[4][2][2][6][6][3] = {
+ { /* tx = 4x4 */
+ { /* block Type 0 */
+ { /* Intra */
+ { /* Coeff Band 0 */
+ { 195, 29, 183 },
+ { 84, 49, 136 },
+ { 8, 42, 71 }
+ }, { /* Coeff Band 1 */
+ { 31, 107, 169 },
+ { 35, 99, 159 },
+ { 17, 82, 140 },
+ { 8, 66, 114 },
+ { 2, 44, 76 },
+ { 1, 19, 32 }
+ }, { /* Coeff Band 2 */
+ { 40, 132, 201 },
+ { 29, 114, 187 },
+ { 13, 91, 157 },
+ { 7, 75, 127 },
+ { 3, 58, 95 },
+ { 1, 28, 47 }
+ }, { /* Coeff Band 3 */
+ { 69, 142, 221 },
+ { 42, 122, 201 },
+ { 15, 91, 159 },
+ { 6, 67, 121 },
+ { 1, 42, 77 },
+ { 1, 17, 31 }
+ }, { /* Coeff Band 4 */
+ { 102, 148, 228 },
+ { 67, 117, 204 },
+ { 17, 82, 154 },
+ { 6, 59, 114 },
+ { 2, 39, 75 },
+ { 1, 15, 29 }
+ }, { /* Coeff Band 5 */
+ { 156, 57, 233 },
+ { 119, 57, 212 },
+ { 58, 48, 163 },
+ { 29, 40, 124 },
+ { 12, 30, 81 },
+ { 3, 12, 31 }
+ }
+ }, { /* Inter */
+ { /* Coeff Band 0 */
+ { 191, 107, 226 },
+ { 124, 117, 204 },
+ { 25, 99, 155 }
+ }, { /* Coeff Band 1 */
+ { 29, 148, 210 },
+ { 37, 126, 194 },
+ { 8, 93, 157 },
+ { 2, 68, 118 },
+ { 1, 39, 69 },
+ { 1, 17, 33 }
+ }, { /* Coeff Band 2 */
+ { 41, 151, 213 },
+ { 27, 123, 193 },
+ { 3, 82, 144 },
+ { 1, 58, 105 },
+ { 1, 32, 60 },
+ { 1, 13, 26 }
+ }, { /* Coeff Band 3 */
+ { 59, 159, 220 },
+ { 23, 126, 198 },
+ { 4, 88, 151 },
+ { 1, 66, 114 },
+ { 1, 38, 71 },
+ { 1, 18, 34 }
+ }, { /* Coeff Band 4 */
+ { 114, 136, 232 },
+ { 51, 114, 207 },
+ { 11, 83, 155 },
+ { 3, 56, 105 },
+ { 1, 33, 65 },
+ { 1, 17, 34 }
+ }, { /* Coeff Band 5 */
+ { 149, 65, 234 },
+ { 121, 57, 215 },
+ { 61, 49, 166 },
+ { 28, 36, 114 },
+ { 12, 25, 76 },
+ { 3, 16, 42 }
+ }
+ }
+ }, { /* block Type 1 */
+ { /* Intra */
+ { /* Coeff Band 0 */
+ { 214, 49, 220 },
+ { 132, 63, 188 },
+ { 42, 65, 137 }
+ }, { /* Coeff Band 1 */
+ { 85, 137, 221 },
+ { 104, 131, 216 },
+ { 49, 111, 192 },
+ { 21, 87, 155 },
+ { 2, 49, 87 },
+ { 1, 16, 28 }
+ }, { /* Coeff Band 2 */
+ { 89, 163, 230 },
+ { 90, 137, 220 },
+ { 29, 100, 183 },
+ { 10, 70, 135 },
+ { 2, 42, 81 },
+ { 1, 17, 33 }
+ }, { /* Coeff Band 3 */
+ { 108, 167, 237 },
+ { 55, 133, 222 },
+ { 15, 97, 179 },
+ { 4, 72, 135 },
+ { 1, 45, 85 },
+ { 1, 19, 38 }
+ }, { /* Coeff Band 4 */
+ { 124, 146, 240 },
+ { 66, 124, 224 },
+ { 17, 88, 175 },
+ { 4, 58, 122 },
+ { 1, 36, 75 },
+ { 1, 18, 37 }
+ }, { /* Coeff Band 5 */
+ { 141, 79, 241 },
+ { 126, 70, 227 },
+ { 66, 58, 182 },
+ { 30, 44, 136 },
+ { 12, 34, 96 },
+ { 2, 20, 47 }
+ }
+ }, { /* Inter */
+ { /* Coeff Band 0 */
+ { 229, 99, 249 },
+ { 143, 111, 235 },
+ { 46, 109, 192 }
+ }, { /* Coeff Band 1 */
+ { 82, 158, 236 },
+ { 94, 146, 224 },
+ { 25, 117, 191 },
+ { 9, 87, 149 },
+ { 3, 56, 99 },
+ { 1, 33, 57 }
+ }, { /* Coeff Band 2 */
+ { 83, 167, 237 },
+ { 68, 145, 222 },
+ { 10, 103, 177 },
+ { 2, 72, 131 },
+ { 1, 41, 79 },
+ { 1, 20, 39 }
+ }, { /* Coeff Band 3 */
+ { 99, 167, 239 },
+ { 47, 141, 224 },
+ { 10, 104, 178 },
+ { 2, 73, 133 },
+ { 1, 44, 85 },
+ { 1, 22, 47 }
+ }, { /* Coeff Band 4 */
+ { 127, 145, 243 },
+ { 71, 129, 228 },
+ { 17, 93, 177 },
+ { 3, 61, 124 },
+ { 1, 41, 84 },
+ { 1, 21, 52 }
+ }, { /* Coeff Band 5 */
+ { 157, 78, 244 },
+ { 140, 72, 231 },
+ { 69, 58, 184 },
+ { 31, 44, 137 },
+ { 14, 38, 105 },
+ { 8, 23, 61 }
+ }
+ }
+ }
+ }, { /* tx = 8x8 */
+ { /* block Type 0 */
+ { /* Intra */
+ { /* Coeff Band 0 */
+ { 125, 34, 187 },
+ { 52, 41, 133 },
+ { 6, 31, 56 }
+ }, { /* Coeff Band 1 */
+ { 37, 109, 153 },
+ { 51, 102, 147 },
+ { 23, 87, 128 },
+ { 8, 67, 101 },
+ { 1, 41, 63 },
+ { 1, 19, 29 }
+ }, { /* Coeff Band 2 */
+ { 31, 154, 185 },
+ { 17, 127, 175 },
+ { 6, 96, 145 },
+ { 2, 73, 114 },
+ { 1, 51, 82 },
+ { 1, 28, 45 }
+ }, { /* Coeff Band 3 */
+ { 23, 163, 200 },
+ { 10, 131, 185 },
+ { 2, 93, 148 },
+ { 1, 67, 111 },
+ { 1, 41, 69 },
+ { 1, 14, 24 }
+ }, { /* Coeff Band 4 */
+ { 29, 176, 217 },
+ { 12, 145, 201 },
+ { 3, 101, 156 },
+ { 1, 69, 111 },
+ { 1, 39, 63 },
+ { 1, 14, 23 }
+ }, { /* Coeff Band 5 */
+ { 57, 192, 233 },
+ { 25, 154, 215 },
+ { 6, 109, 167 },
+ { 3, 78, 118 },
+ { 1, 48, 69 },
+ { 1, 21, 29 }
+ }
+ }, { /* Inter */
+ { /* Coeff Band 0 */
+ { 202, 105, 245 },
+ { 108, 106, 216 },
+ { 18, 90, 144 }
+ }, { /* Coeff Band 1 */
+ { 33, 172, 219 },
+ { 64, 149, 206 },
+ { 14, 117, 177 },
+ { 5, 90, 141 },
+ { 2, 61, 95 },
+ { 1, 37, 57 }
+ }, { /* Coeff Band 2 */
+ { 33, 179, 220 },
+ { 11, 140, 198 },
+ { 1, 89, 148 },
+ { 1, 60, 104 },
+ { 1, 33, 57 },
+ { 1, 12, 21 }
+ }, { /* Coeff Band 3 */
+ { 30, 181, 221 },
+ { 8, 141, 198 },
+ { 1, 87, 145 },
+ { 1, 58, 100 },
+ { 1, 31, 55 },
+ { 1, 12, 20 }
+ }, { /* Coeff Band 4 */
+ { 32, 186, 224 },
+ { 7, 142, 198 },
+ { 1, 86, 143 },
+ { 1, 58, 100 },
+ { 1, 31, 55 },
+ { 1, 12, 22 }
+ }, { /* Coeff Band 5 */
+ { 57, 192, 227 },
+ { 20, 143, 204 },
+ { 3, 96, 154 },
+ { 1, 68, 112 },
+ { 1, 42, 69 },
+ { 1, 19, 32 }
+ }
+ }
+ }, { /* block Type 1 */
+ { /* Intra */
+ { /* Coeff Band 0 */
+ { 212, 35, 215 },
+ { 113, 47, 169 },
+ { 29, 48, 105 }
+ }, { /* Coeff Band 1 */
+ { 74, 129, 203 },
+ { 106, 120, 203 },
+ { 49, 107, 178 },
+ { 19, 84, 144 },
+ { 4, 50, 84 },
+ { 1, 15, 25 }
+ }, { /* Coeff Band 2 */
+ { 71, 172, 217 },
+ { 44, 141, 209 },
+ { 15, 102, 173 },
+ { 6, 76, 133 },
+ { 2, 51, 89 },
+ { 1, 24, 42 }
+ }, { /* Coeff Band 3 */
+ { 64, 185, 231 },
+ { 31, 148, 216 },
+ { 8, 103, 175 },
+ { 3, 74, 131 },
+ { 1, 46, 81 },
+ { 1, 18, 30 }
+ }, { /* Coeff Band 4 */
+ { 65, 196, 235 },
+ { 25, 157, 221 },
+ { 5, 105, 174 },
+ { 1, 67, 120 },
+ { 1, 38, 69 },
+ { 1, 15, 30 }
+ }, { /* Coeff Band 5 */
+ { 65, 204, 238 },
+ { 30, 156, 224 },
+ { 7, 107, 177 },
+ { 2, 70, 124 },
+ { 1, 42, 73 },
+ { 1, 18, 34 }
+ }
+ }, { /* Inter */
+ { /* Coeff Band 0 */
+ { 225, 86, 251 },
+ { 144, 104, 235 },
+ { 42, 99, 181 }
+ }, { /* Coeff Band 1 */
+ { 85, 175, 239 },
+ { 112, 165, 229 },
+ { 29, 136, 200 },
+ { 12, 103, 162 },
+ { 6, 77, 123 },
+ { 2, 53, 84 }
+ }, { /* Coeff Band 2 */
+ { 75, 183, 239 },
+ { 30, 155, 221 },
+ { 3, 106, 171 },
+ { 1, 74, 128 },
+ { 1, 44, 76 },
+ { 1, 17, 28 }
+ }, { /* Coeff Band 3 */
+ { 73, 185, 240 },
+ { 27, 159, 222 },
+ { 2, 107, 172 },
+ { 1, 75, 127 },
+ { 1, 42, 73 },
+ { 1, 17, 29 }
+ }, { /* Coeff Band 4 */
+ { 62, 190, 238 },
+ { 21, 159, 222 },
+ { 2, 107, 172 },
+ { 1, 72, 122 },
+ { 1, 40, 71 },
+ { 1, 18, 32 }
+ }, { /* Coeff Band 5 */
+ { 61, 199, 240 },
+ { 27, 161, 226 },
+ { 4, 113, 180 },
+ { 1, 76, 129 },
+ { 1, 46, 80 },
+ { 1, 23, 41 }
+ }
+ }
+ }
+ }, { /* tx = 16x16 */
+ { /* block Type 0 */
+ { /* Intra */
+ { /* Coeff Band 0 */
+ { 7, 27, 153 },
+ { 5, 30, 95 },
+ { 1, 16, 30 }
+ }, { /* Coeff Band 1 */
+ { 50, 75, 127 },
+ { 57, 75, 124 },
+ { 27, 67, 108 },
+ { 10, 54, 86 },
+ { 1, 33, 52 },
+ { 1, 12, 18 }
+ }, { /* Coeff Band 2 */
+ { 43, 125, 151 },
+ { 26, 108, 148 },
+ { 7, 83, 122 },
+ { 2, 59, 89 },
+ { 1, 38, 60 },
+ { 1, 17, 27 }
+ }, { /* Coeff Band 3 */
+ { 23, 144, 163 },
+ { 13, 112, 154 },
+ { 2, 75, 117 },
+ { 1, 50, 81 },
+ { 1, 31, 51 },
+ { 1, 14, 23 }
+ }, { /* Coeff Band 4 */
+ { 18, 162, 185 },
+ { 6, 123, 171 },
+ { 1, 78, 125 },
+ { 1, 51, 86 },
+ { 1, 31, 54 },
+ { 1, 14, 23 }
+ }, { /* Coeff Band 5 */
+ { 15, 199, 227 },
+ { 3, 150, 204 },
+ { 1, 91, 146 },
+ { 1, 55, 95 },
+ { 1, 30, 53 },
+ { 1, 11, 20 }
+ }
+ }, { /* Inter */
+ { /* Coeff Band 0 */
+ { 19, 55, 240 },
+ { 19, 59, 196 },
+ { 3, 52, 105 }
+ }, { /* Coeff Band 1 */
+ { 41, 166, 207 },
+ { 104, 153, 199 },
+ { 31, 123, 181 },
+ { 14, 101, 152 },
+ { 5, 72, 106 },
+ { 1, 36, 52 }
+ }, { /* Coeff Band 2 */
+ { 35, 176, 211 },
+ { 12, 131, 190 },
+ { 2, 88, 144 },
+ { 1, 60, 101 },
+ { 1, 36, 60 },
+ { 1, 16, 28 }
+ }, { /* Coeff Band 3 */
+ { 28, 183, 213 },
+ { 8, 134, 191 },
+ { 1, 86, 142 },
+ { 1, 56, 96 },
+ { 1, 30, 53 },
+ { 1, 12, 20 }
+ }, { /* Coeff Band 4 */
+ { 20, 190, 215 },
+ { 4, 135, 192 },
+ { 1, 84, 139 },
+ { 1, 53, 91 },
+ { 1, 28, 49 },
+ { 1, 11, 20 }
+ }, { /* Coeff Band 5 */
+ { 13, 196, 216 },
+ { 2, 137, 192 },
+ { 1, 86, 143 },
+ { 1, 57, 99 },
+ { 1, 32, 56 },
+ { 1, 13, 24 }
+ }
+ }
+ }, { /* block Type 1 */
+ { /* Intra */
+ { /* Coeff Band 0 */
+ { 211, 29, 217 },
+ { 96, 47, 156 },
+ { 22, 43, 87 }
+ }, { /* Coeff Band 1 */
+ { 78, 120, 193 },
+ { 111, 116, 186 },
+ { 46, 102, 164 },
+ { 15, 80, 128 },
+ { 2, 49, 76 },
+ { 1, 18, 28 }
+ }, { /* Coeff Band 2 */
+ { 71, 161, 203 },
+ { 42, 132, 192 },
+ { 10, 98, 150 },
+ { 3, 69, 109 },
+ { 1, 44, 70 },
+ { 1, 18, 29 }
+ }, { /* Coeff Band 3 */
+ { 57, 186, 211 },
+ { 30, 140, 196 },
+ { 4, 93, 146 },
+ { 1, 62, 102 },
+ { 1, 38, 65 },
+ { 1, 16, 27 }
+ }, { /* Coeff Band 4 */
+ { 47, 199, 217 },
+ { 14, 145, 196 },
+ { 1, 88, 142 },
+ { 1, 57, 98 },
+ { 1, 36, 62 },
+ { 1, 15, 26 }
+ }, { /* Coeff Band 5 */
+ { 26, 219, 229 },
+ { 5, 155, 207 },
+ { 1, 94, 151 },
+ { 1, 60, 104 },
+ { 1, 36, 62 },
+ { 1, 16, 28 }
+ }
+ }, { /* Inter */
+ { /* Coeff Band 0 */
+ { 233, 29, 248 },
+ { 146, 47, 220 },
+ { 43, 52, 140 }
+ }, { /* Coeff Band 1 */
+ { 100, 163, 232 },
+ { 179, 161, 222 },
+ { 63, 142, 204 },
+ { 37, 113, 174 },
+ { 26, 89, 137 },
+ { 18, 68, 97 }
+ }, { /* Coeff Band 2 */
+ { 85, 181, 230 },
+ { 32, 146, 209 },
+ { 7, 100, 164 },
+ { 3, 71, 121 },
+ { 1, 45, 77 },
+ { 1, 18, 30 }
+ }, { /* Coeff Band 3 */
+ { 65, 187, 230 },
+ { 20, 148, 207 },
+ { 2, 97, 159 },
+ { 1, 68, 116 },
+ { 1, 40, 70 },
+ { 1, 14, 29 }
+ }, { /* Coeff Band 4 */
+ { 40, 194, 227 },
+ { 8, 147, 204 },
+ { 1, 94, 155 },
+ { 1, 65, 112 },
+ { 1, 39, 66 },
+ { 1, 14, 26 }
+ }, { /* Coeff Band 5 */
+ { 16, 208, 228 },
+ { 3, 151, 207 },
+ { 1, 98, 160 },
+ { 1, 67, 117 },
+ { 1, 41, 74 },
+ { 1, 17, 31 }
+ }
+ }
+ }
+ }, { /* tx = 32x32 */
+ { /* block Type 0 */
+ { /* Intra */
+ { /* Coeff Band 0 */
+ { 17, 38, 140 },
+ { 7, 34, 80 },
+ { 1, 17, 29 }
+ }, { /* Coeff Band 1 */
+ { 37, 75, 128 },
+ { 41, 76, 128 },
+ { 26, 66, 116 },
+ { 12, 52, 94 },
+ { 2, 32, 55 },
+ { 1, 10, 16 }
+ }, { /* Coeff Band 2 */
+ { 50, 127, 154 },
+ { 37, 109, 152 },
+ { 16, 82, 121 },
+ { 5, 59, 85 },
+ { 1, 35, 54 },
+ { 1, 13, 20 }
+ }, { /* Coeff Band 3 */
+ { 40, 142, 167 },
+ { 17, 110, 157 },
+ { 2, 71, 112 },
+ { 1, 44, 72 },
+ { 1, 27, 45 },
+ { 1, 11, 17 }
+ }, { /* Coeff Band 4 */
+ { 30, 175, 188 },
+ { 9, 124, 169 },
+ { 1, 74, 116 },
+ { 1, 48, 78 },
+ { 1, 30, 49 },
+ { 1, 11, 18 }
+ }, { /* Coeff Band 5 */
+ { 10, 222, 223 },
+ { 2, 150, 194 },
+ { 1, 83, 128 },
+ { 1, 48, 79 },
+ { 1, 27, 45 },
+ { 1, 11, 17 }
+ }
+ }, { /* Inter */
+ { /* Coeff Band 0 */
+ { 36, 41, 235 },
+ { 29, 36, 193 },
+ { 10, 27, 111 }
+ }, { /* Coeff Band 1 */
+ { 85, 165, 222 },
+ { 177, 162, 215 },
+ { 110, 135, 195 },
+ { 57, 113, 168 },
+ { 23, 83, 120 },
+ { 10, 49, 61 }
+ }, { /* Coeff Band 2 */
+ { 85, 190, 223 },
+ { 36, 139, 200 },
+ { 5, 90, 146 },
+ { 1, 60, 103 },
+ { 1, 38, 65 },
+ { 1, 18, 30 }
+ }, { /* Coeff Band 3 */
+ { 72, 202, 223 },
+ { 23, 141, 199 },
+ { 2, 86, 140 },
+ { 1, 56, 97 },
+ { 1, 36, 61 },
+ { 1, 16, 27 }
+ }, { /* Coeff Band 4 */
+ { 55, 218, 225 },
+ { 13, 145, 200 },
+ { 1, 86, 141 },
+ { 1, 57, 99 },
+ { 1, 35, 61 },
+ { 1, 13, 22 }
+ }, { /* Coeff Band 5 */
+ { 15, 235, 212 },
+ { 1, 132, 184 },
+ { 1, 84, 139 },
+ { 1, 57, 97 },
+ { 1, 34, 56 },
+ { 1, 14, 23 }
+ }
+ }
+ }, { /* block Type 1 */
+ { /* Intra */
+ { /* Coeff Band 0 */
+ { 181, 21, 201 },
+ { 61, 37, 123 },
+ { 10, 38, 71 }
+ }, { /* Coeff Band 1 */
+ { 47, 106, 172 },
+ { 95, 104, 173 },
+ { 42, 93, 159 },
+ { 18, 77, 131 },
+ { 4, 50, 81 },
+ { 1, 17, 23 }
+ }, { /* Coeff Band 2 */
+ { 62, 147, 199 },
+ { 44, 130, 189 },
+ { 28, 102, 154 },
+ { 18, 75, 115 },
+ { 2, 44, 65 },
+ { 1, 12, 19 }
+ }, { /* Coeff Band 3 */
+ { 55, 153, 210 },
+ { 24, 130, 194 },
+ { 3, 93, 146 },
+ { 1, 61, 97 },
+ { 1, 31, 50 },
+ { 1, 10, 16 }
+ }, { /* Coeff Band 4 */
+ { 49, 186, 223 },
+ { 17, 148, 204 },
+ { 1, 96, 142 },
+ { 1, 53, 83 },
+ { 1, 26, 44 },
+ { 1, 11, 17 }
+ }, { /* Coeff Band 5 */
+ { 13, 217, 212 },
+ { 2, 136, 180 },
+ { 1, 78, 124 },
+ { 1, 50, 83 },
+ { 1, 29, 49 },
+ { 1, 14, 23 }
+ }
+ }, { /* Inter */
+ { /* Coeff Band 0 */
+ { 197, 13, 247 },
+ { 82, 17, 222 },
+ { 25, 17, 162 }
+ }, { /* Coeff Band 1 */
+ { 126, 186, 247 },
+ { 234, 191, 243 },
+ { 176, 177, 234 },
+ { 104, 158, 220 },
+ { 66, 128, 186 },
+ { 55, 90, 137 }
+ }, { /* Coeff Band 2 */
+ { 111, 197, 242 },
+ { 46, 158, 219 },
+ { 9, 104, 171 },
+ { 2, 65, 125 },
+ { 1, 44, 80 },
+ { 1, 17, 91 }
+ }, { /* Coeff Band 3 */
+ { 104, 208, 245 },
+ { 39, 168, 224 },
+ { 3, 109, 162 },
+ { 1, 79, 124 },
+ { 1, 50, 102 },
+ { 1, 43, 102 }
+ }, { /* Coeff Band 4 */
+ { 84, 220, 246 },
+ { 31, 177, 231 },
+ { 2, 115, 180 },
+ { 1, 79, 134 },
+ { 1, 55, 77 },
+ { 1, 60, 79 }
+ }, { /* Coeff Band 5 */
+ { 43, 243, 240 },
+ { 8, 180, 217 },
+ { 1, 115, 166 },
+ { 1, 84, 121 },
+ { 1, 51, 67 },
+ { 1, 16, 6 }
+ }
+ }
+ }
+ }
+};
+
+const int8_t ff_vp9_mv_joint_tree[3][2] = {
+ { -MV_JOINT_ZERO, 1 }, // '0'
+ { -MV_JOINT_H, 2 }, // '10'
+ { -MV_JOINT_V, -MV_JOINT_HV }, // '11x'
+};
+
+const int8_t ff_vp9_mv_class_tree[10][2] = {
+ { -0, 1 }, // '0'
+ { -1, 2 }, // '10'
+ { 3, 4 },
+ { -2, -3 }, // '110x'
+ { 5, 6 },
+ { -4, -5 }, // '1110x'
+ { -6, 7 }, // '11110'
+ { 8, 9 },
+ { -7, -8 }, // '111110x'
+ { -9, -10 }, // '111111x'
+};
+
+const int8_t ff_vp9_mv_fp_tree[3][2] = {
+ { -0, 1 }, // '0'
+ { -1, 2 }, // '10'
+ { -2, -3 }, // '11x'
+};
diff --git a/media/ffvpx/libavcodec/vp9data.h b/media/ffvpx/libavcodec/vp9data.h
index cb12e7e946..086dbdec06 100644
--- a/media/ffvpx/libavcodec/vp9data.h
+++ b/media/ffvpx/libavcodec/vp9data.h
@@ -24,2254 +24,48 @@
#include <stdint.h>
-#include "vp9.h"
-
-static const int8_t vp9_partition_tree[3][2] = {
- { -PARTITION_NONE, 1 }, // '0'
- { -PARTITION_H, 2 }, // '10'
- { -PARTITION_V, -PARTITION_SPLIT }, // '110', '111'
-};
-
-static const uint8_t vp9_default_kf_partition_probs[4][4][3] = {
- { /* 64x64 -> 32x32 */
- { 174, 35, 49 } /* a/l both not split */,
- { 68, 11, 27 } /* a split, l not split */,
- { 57, 15, 9 } /* l split, a not split */,
- { 12, 3, 3 } /* a/l both split */
- }, { /* 32x32 -> 16x16 */
- { 150, 40, 39 } /* a/l both not split */,
- { 78, 12, 26 } /* a split, l not split */,
- { 67, 33, 11 } /* l split, a not split */,
- { 24, 7, 5 } /* a/l both split */,
- }, { /* 16x16 -> 8x8 */
- { 149, 53, 53 } /* a/l both not split */,
- { 94, 20, 48 } /* a split, l not split */,
- { 83, 53, 24 } /* l split, a not split */,
- { 52, 18, 18 } /* a/l both split */,
- }, { /* 8x8 -> 4x4 */
- { 158, 97, 94 } /* a/l both not split */,
- { 93, 24, 99 } /* a split, l not split */,
- { 85, 119, 44 } /* l split, a not split */,
- { 62, 59, 67 } /* a/l both split */,
- },
-};
-
-static const int8_t vp9_segmentation_tree[7][2] = {
- { 1, 2 },
- { 3, 4 },
- { 5, 6 },
- { -0, -1 }, // '00x'
- { -2, -3 }, // '01x'
- { -4, -5 }, // '10x'
- { -6, -7 }, // '11x'
-};
-
-static const int8_t vp9_intramode_tree[9][2] = {
- { -DC_PRED, 1 }, // '0'
- { -TM_VP8_PRED, 2 }, // '10'
- { -VERT_PRED, 3 }, // '110'
- { 4, 6 },
- { -HOR_PRED, 5 }, // '11100'
- { -DIAG_DOWN_RIGHT_PRED, -VERT_RIGHT_PRED }, // '11101x'
- { -DIAG_DOWN_LEFT_PRED, 7 }, // '11110'
- { -VERT_LEFT_PRED, 8 }, // '111110'
- { -HOR_DOWN_PRED, -HOR_UP_PRED }, // '111111x'
-};
-
-static const uint8_t vp9_default_kf_ymode_probs[10][10][9] = {
- { /* above = v */
- { 43, 46, 168, 134, 107, 128, 69, 142, 92 } /* left = v */,
- { 44, 29, 68, 159, 201, 177, 50, 57, 77 } /* left = h */,
- { 63, 36, 126, 146, 123, 158, 60, 90, 96 } /* left = dc */,
- { 58, 38, 76, 114, 97, 172, 78, 133, 92 } /* left = d45 */,
- { 46, 41, 76, 140, 63, 184, 69, 112, 57 } /* left = d135 */,
- { 38, 32, 85, 140, 46, 112, 54, 151, 133 } /* left = d117 */,
- { 39, 27, 61, 131, 110, 175, 44, 75, 136 } /* left = d153 */,
- { 47, 35, 80, 100, 74, 143, 64, 163, 74 } /* left = d63 */,
- { 52, 30, 74, 113, 130, 175, 51, 64, 58 } /* left = d27 */,
- { 36, 61, 116, 114, 128, 162, 80, 125, 82 } /* left = tm */
- }, { /* above = h */
- { 55, 44, 68, 166, 179, 192, 57, 57, 108 } /* left = v */,
- { 42, 26, 11, 199, 241, 228, 23, 15, 85 } /* left = h */,
- { 82, 26, 26, 171, 208, 204, 44, 32, 105 } /* left = dc */,
- { 68, 42, 19, 131, 160, 199, 55, 52, 83 } /* left = d45 */,
- { 58, 50, 25, 139, 115, 232, 39, 52, 118 } /* left = d135 */,
- { 50, 35, 33, 153, 104, 162, 64, 59, 131 } /* left = d117 */,
- { 44, 24, 16, 150, 177, 202, 33, 19, 156 } /* left = d153 */,
- { 53, 49, 21, 110, 116, 168, 59, 80, 76 } /* left = d63 */,
- { 55, 27, 12, 153, 203, 218, 26, 27, 49 } /* left = d27 */,
- { 38, 72, 19, 168, 203, 212, 50, 50, 107 } /* left = tm */
- }, { /* above = dc */
- { 92, 45, 102, 136, 116, 180, 74, 90, 100 } /* left = v */,
- { 73, 32, 19, 187, 222, 215, 46, 34, 100 } /* left = h */,
- { 137, 30, 42, 148, 151, 207, 70, 52, 91 } /* left = dc */,
- { 91, 30, 32, 116, 121, 186, 93, 86, 94 } /* left = d45 */,
- { 72, 35, 36, 149, 68, 206, 68, 63, 105 } /* left = d135 */,
- { 73, 31, 28, 138, 57, 124, 55, 122, 151 } /* left = d117 */,
- { 67, 23, 21, 140, 126, 197, 40, 37, 171 } /* left = d153 */,
- { 74, 32, 27, 107, 86, 160, 63, 134, 102 } /* left = d63 */,
- { 86, 27, 28, 128, 154, 212, 45, 43, 53 } /* left = d27 */,
- { 59, 67, 44, 140, 161, 202, 78, 67, 119 } /* left = tm */
- }, { /* above = d45 */
- { 59, 38, 83, 112, 103, 162, 98, 136, 90 } /* left = v */,
- { 62, 30, 23, 158, 200, 207, 59, 57, 50 } /* left = h */,
- { 103, 26, 36, 129, 132, 201, 83, 80, 93 } /* left = dc */,
- { 67, 30, 29, 84, 86, 191, 102, 91, 59 } /* left = d45 */,
- { 60, 32, 33, 112, 71, 220, 64, 89, 104 } /* left = d135 */,
- { 53, 26, 34, 130, 56, 149, 84, 120, 103 } /* left = d117 */,
- { 53, 21, 23, 133, 109, 210, 56, 77, 172 } /* left = d153 */,
- { 61, 29, 29, 93, 97, 165, 83, 175, 162 } /* left = d63 */,
- { 77, 19, 29, 112, 142, 228, 55, 66, 36 } /* left = d27 */,
- { 47, 47, 43, 114, 137, 181, 100, 99, 95 } /* left = tm */
- }, { /* above = d135 */
- { 53, 40, 55, 139, 69, 183, 61, 80, 110 } /* left = v */,
- { 40, 29, 19, 161, 180, 207, 43, 24, 91 } /* left = h */,
- { 69, 23, 29, 128, 83, 199, 46, 44, 101 } /* left = dc */,
- { 60, 34, 19, 105, 61, 198, 53, 64, 89 } /* left = d45 */,
- { 52, 31, 22, 158, 40, 209, 58, 62, 89 } /* left = d135 */,
- { 44, 31, 29, 147, 46, 158, 56, 102, 198 } /* left = d117 */,
- { 35, 19, 12, 135, 87, 209, 41, 45, 167 } /* left = d153 */,
- { 51, 38, 25, 113, 58, 164, 70, 93, 97 } /* left = d63 */,
- { 55, 25, 21, 118, 95, 215, 38, 39, 66 } /* left = d27 */,
- { 47, 54, 34, 146, 108, 203, 72, 103, 151 } /* left = tm */
- }, { /* above = d117 */
- { 46, 27, 80, 150, 55, 124, 55, 121, 135 } /* left = v */,
- { 36, 23, 27, 165, 149, 166, 54, 64, 118 } /* left = h */,
- { 64, 19, 37, 156, 66, 138, 49, 95, 133 } /* left = dc */,
- { 53, 21, 36, 131, 63, 163, 60, 109, 81 } /* left = d45 */,
- { 40, 26, 35, 154, 40, 185, 51, 97, 123 } /* left = d135 */,
- { 35, 19, 34, 179, 19, 97, 48, 129, 124 } /* left = d117 */,
- { 36, 20, 26, 136, 62, 164, 33, 77, 154 } /* left = d153 */,
- { 45, 26, 28, 129, 45, 129, 49, 147, 123 } /* left = d63 */,
- { 45, 18, 32, 130, 90, 157, 40, 79, 91 } /* left = d27 */,
- { 38, 44, 51, 136, 74, 162, 57, 97, 121 } /* left = tm */
- }, { /* above = d153 */
- { 56, 39, 58, 133, 117, 173, 48, 53, 187 } /* left = v */,
- { 35, 21, 12, 161, 212, 207, 20, 23, 145 } /* left = h */,
- { 75, 17, 22, 136, 138, 185, 32, 34, 166 } /* left = dc */,
- { 56, 29, 19, 117, 109, 181, 55, 68, 112 } /* left = d45 */,
- { 47, 29, 17, 153, 64, 220, 59, 51, 114 } /* left = d135 */,
- { 46, 16, 24, 136, 76, 147, 41, 64, 172 } /* left = d117 */,
- { 34, 17, 11, 108, 152, 187, 13, 15, 209 } /* left = d153 */,
- { 55, 30, 18, 122, 79, 179, 44, 88, 116 } /* left = d63 */,
- { 51, 24, 14, 115, 133, 209, 32, 26, 104 } /* left = d27 */,
- { 37, 49, 25, 129, 168, 164, 41, 54, 148 } /* left = tm */
- }, { /* above = d63 */
- { 48, 34, 86, 101, 92, 146, 78, 179, 134 } /* left = v */,
- { 47, 22, 24, 138, 187, 178, 68, 69, 59 } /* left = h */,
- { 78, 23, 39, 111, 117, 170, 74, 124, 94 } /* left = dc */,
- { 56, 25, 33, 105, 112, 187, 95, 177, 129 } /* left = d45 */,
- { 48, 31, 27, 114, 63, 183, 82, 116, 56 } /* left = d135 */,
- { 43, 28, 37, 121, 63, 123, 61, 192, 169 } /* left = d117 */,
- { 42, 17, 24, 109, 97, 177, 56, 76, 122 } /* left = d153 */,
- { 46, 23, 32, 74, 86, 150, 67, 183, 88 } /* left = d63 */,
- { 58, 18, 28, 105, 139, 182, 70, 92, 63 } /* left = d27 */,
- { 36, 38, 48, 92, 122, 165, 88, 137, 91 } /* left = tm */
- }, { /* above = d27 */
- { 62, 44, 61, 123, 105, 189, 48, 57, 64 } /* left = v */,
- { 47, 25, 17, 175, 222, 220, 24, 30, 86 } /* left = h */,
- { 82, 22, 32, 127, 143, 213, 39, 41, 70 } /* left = dc */,
- { 68, 36, 17, 106, 102, 206, 59, 74, 74 } /* left = d45 */,
- { 57, 39, 23, 151, 68, 216, 55, 63, 58 } /* left = d135 */,
- { 49, 30, 35, 141, 70, 168, 82, 40, 115 } /* left = d117 */,
- { 51, 25, 15, 136, 129, 202, 38, 35, 139 } /* left = d153 */,
- { 59, 39, 19, 114, 75, 180, 77, 104, 42 } /* left = d63 */,
- { 68, 26, 16, 111, 141, 215, 29, 28, 28 } /* left = d27 */,
- { 40, 61, 26, 126, 152, 206, 61, 59, 93 } /* left = tm */
- }, { /* above = tm */
- { 44, 78, 115, 132, 119, 173, 71, 112, 93 } /* left = v */,
- { 39, 38, 21, 184, 227, 206, 42, 32, 64 } /* left = h */,
- { 65, 70, 60, 155, 159, 199, 61, 60, 81 } /* left = dc */,
- { 58, 47, 36, 124, 137, 193, 80, 82, 78 } /* left = d45 */,
- { 49, 50, 35, 144, 95, 205, 63, 78, 59 } /* left = d135 */,
- { 41, 53, 52, 148, 71, 142, 65, 128, 51 } /* left = d117 */,
- { 40, 36, 28, 143, 143, 202, 40, 55, 137 } /* left = d153 */,
- { 42, 44, 44, 104, 105, 164, 64, 130, 80 } /* left = d63 */,
- { 52, 34, 29, 129, 183, 227, 42, 35, 43 } /* left = d27 */,
- { 43, 81, 53, 140, 169, 204, 68, 84, 72 } /* left = tm */
- }
-};
-
-static const uint8_t vp9_default_kf_uvmode_probs[10][9] = {
- { 118, 15, 123, 148, 131, 101, 44, 93, 131 } /* y = v */,
- { 113, 12, 23, 188, 226, 142, 26, 32, 125 } /* y = h */,
- { 144, 11, 54, 157, 195, 130, 46, 58, 108 } /* y = dc */,
- { 120, 11, 50, 123, 163, 135, 64, 77, 103 } /* y = d45 */,
- { 113, 9, 36, 155, 111, 157, 32, 44, 161 } /* y = d135 */,
- { 116, 9, 55, 176, 76, 96, 37, 61, 149 } /* y = d117 */,
- { 115, 9, 28, 141, 161, 167, 21, 25, 193 } /* y = d153 */,
- { 116, 12, 64, 120, 140, 125, 49, 115, 121 } /* y = d63 */,
- { 120, 12, 32, 145, 195, 142, 32, 38, 86 } /* y = d27 */,
- { 102, 19, 66, 162, 182, 122, 35, 59, 128 } /* y = tm */
-};
-
-static const int8_t vp9_inter_mode_tree[3][2] = {
- { -ZEROMV, 1 }, // '0'
- { -NEARESTMV, 2 }, // '10'
- { -NEARMV, -NEWMV }, // '11x'
-};
-
-static const int8_t vp9_filter_tree[2][2] = {
- { -0, 1 }, // '0'
- { -1, -2 }, // '1x'
-};
-
-static const enum FilterMode vp9_filter_lut[3] = {
- FILTER_8TAP_REGULAR,
- FILTER_8TAP_SMOOTH,
- FILTER_8TAP_SHARP,
-};
-
-static const int16_t vp9_dc_qlookup[3][256] = {
- {
- 4, 8, 8, 9, 10, 11, 12, 12,
- 13, 14, 15, 16, 17, 18, 19, 19,
- 20, 21, 22, 23, 24, 25, 26, 26,
- 27, 28, 29, 30, 31, 32, 32, 33,
- 34, 35, 36, 37, 38, 38, 39, 40,
- 41, 42, 43, 43, 44, 45, 46, 47,
- 48, 48, 49, 50, 51, 52, 53, 53,
- 54, 55, 56, 57, 57, 58, 59, 60,
- 61, 62, 62, 63, 64, 65, 66, 66,
- 67, 68, 69, 70, 70, 71, 72, 73,
- 74, 74, 75, 76, 77, 78, 78, 79,
- 80, 81, 81, 82, 83, 84, 85, 85,
- 87, 88, 90, 92, 93, 95, 96, 98,
- 99, 101, 102, 104, 105, 107, 108, 110,
- 111, 113, 114, 116, 117, 118, 120, 121,
- 123, 125, 127, 129, 131, 134, 136, 138,
- 140, 142, 144, 146, 148, 150, 152, 154,
- 156, 158, 161, 164, 166, 169, 172, 174,
- 177, 180, 182, 185, 187, 190, 192, 195,
- 199, 202, 205, 208, 211, 214, 217, 220,
- 223, 226, 230, 233, 237, 240, 243, 247,
- 250, 253, 257, 261, 265, 269, 272, 276,
- 280, 284, 288, 292, 296, 300, 304, 309,
- 313, 317, 322, 326, 330, 335, 340, 344,
- 349, 354, 359, 364, 369, 374, 379, 384,
- 389, 395, 400, 406, 411, 417, 423, 429,
- 435, 441, 447, 454, 461, 467, 475, 482,
- 489, 497, 505, 513, 522, 530, 539, 549,
- 559, 569, 579, 590, 602, 614, 626, 640,
- 654, 668, 684, 700, 717, 736, 755, 775,
- 796, 819, 843, 869, 896, 925, 955, 988,
- 1022, 1058, 1098, 1139, 1184, 1232, 1282, 1336,
- }, {
- 4, 9, 10, 13, 15, 17, 20, 22,
- 25, 28, 31, 34, 37, 40, 43, 47,
- 50, 53, 57, 60, 64, 68, 71, 75,
- 78, 82, 86, 90, 93, 97, 101, 105,
- 109, 113, 116, 120, 124, 128, 132, 136,
- 140, 143, 147, 151, 155, 159, 163, 166,
- 170, 174, 178, 182, 185, 189, 193, 197,
- 200, 204, 208, 212, 215, 219, 223, 226,
- 230, 233, 237, 241, 244, 248, 251, 255,
- 259, 262, 266, 269, 273, 276, 280, 283,
- 287, 290, 293, 297, 300, 304, 307, 310,
- 314, 317, 321, 324, 327, 331, 334, 337,
- 343, 350, 356, 362, 369, 375, 381, 387,
- 394, 400, 406, 412, 418, 424, 430, 436,
- 442, 448, 454, 460, 466, 472, 478, 484,
- 490, 499, 507, 516, 525, 533, 542, 550,
- 559, 567, 576, 584, 592, 601, 609, 617,
- 625, 634, 644, 655, 666, 676, 687, 698,
- 708, 718, 729, 739, 749, 759, 770, 782,
- 795, 807, 819, 831, 844, 856, 868, 880,
- 891, 906, 920, 933, 947, 961, 975, 988,
- 1001, 1015, 1030, 1045, 1061, 1076, 1090, 1105,
- 1120, 1137, 1153, 1170, 1186, 1202, 1218, 1236,
- 1253, 1271, 1288, 1306, 1323, 1342, 1361, 1379,
- 1398, 1416, 1436, 1456, 1476, 1496, 1516, 1537,
- 1559, 1580, 1601, 1624, 1647, 1670, 1692, 1717,
- 1741, 1766, 1791, 1817, 1844, 1871, 1900, 1929,
- 1958, 1990, 2021, 2054, 2088, 2123, 2159, 2197,
- 2236, 2276, 2319, 2363, 2410, 2458, 2508, 2561,
- 2616, 2675, 2737, 2802, 2871, 2944, 3020, 3102,
- 3188, 3280, 3375, 3478, 3586, 3702, 3823, 3953,
- 4089, 4236, 4394, 4559, 4737, 4929, 5130, 5347,
- }, {
- 4, 12, 18, 25, 33, 41, 50, 60,
- 70, 80, 91, 103, 115, 127, 140, 153,
- 166, 180, 194, 208, 222, 237, 251, 266,
- 281, 296, 312, 327, 343, 358, 374, 390,
- 405, 421, 437, 453, 469, 484, 500, 516,
- 532, 548, 564, 580, 596, 611, 627, 643,
- 659, 674, 690, 706, 721, 737, 752, 768,
- 783, 798, 814, 829, 844, 859, 874, 889,
- 904, 919, 934, 949, 964, 978, 993, 1008,
- 1022, 1037, 1051, 1065, 1080, 1094, 1108, 1122,
- 1136, 1151, 1165, 1179, 1192, 1206, 1220, 1234,
- 1248, 1261, 1275, 1288, 1302, 1315, 1329, 1342,
- 1368, 1393, 1419, 1444, 1469, 1494, 1519, 1544,
- 1569, 1594, 1618, 1643, 1668, 1692, 1717, 1741,
- 1765, 1789, 1814, 1838, 1862, 1885, 1909, 1933,
- 1957, 1992, 2027, 2061, 2096, 2130, 2165, 2199,
- 2233, 2267, 2300, 2334, 2367, 2400, 2434, 2467,
- 2499, 2532, 2575, 2618, 2661, 2704, 2746, 2788,
- 2830, 2872, 2913, 2954, 2995, 3036, 3076, 3127,
- 3177, 3226, 3275, 3324, 3373, 3421, 3469, 3517,
- 3565, 3621, 3677, 3733, 3788, 3843, 3897, 3951,
- 4005, 4058, 4119, 4181, 4241, 4301, 4361, 4420,
- 4479, 4546, 4612, 4677, 4742, 4807, 4871, 4942,
- 5013, 5083, 5153, 5222, 5291, 5367, 5442, 5517,
- 5591, 5665, 5745, 5825, 5905, 5984, 6063, 6149,
- 6234, 6319, 6404, 6495, 6587, 6678, 6769, 6867,
- 6966, 7064, 7163, 7269, 7376, 7483, 7599, 7715,
- 7832, 7958, 8085, 8214, 8352, 8492, 8635, 8788,
- 8945, 9104, 9275, 9450, 9639, 9832, 10031, 10245,
- 10465, 10702, 10946, 11210, 11482, 11776, 12081, 12409,
- 12750, 13118, 13501, 13913, 14343, 14807, 15290, 15812,
- 16356, 16943, 17575, 18237, 18949, 19718, 20521, 21387,
- }
-};
-
-static const int16_t vp9_ac_qlookup[3][256] = {
- {
- 4, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22,
- 23, 24, 25, 26, 27, 28, 29, 30,
- 31, 32, 33, 34, 35, 36, 37, 38,
- 39, 40, 41, 42, 43, 44, 45, 46,
- 47, 48, 49, 50, 51, 52, 53, 54,
- 55, 56, 57, 58, 59, 60, 61, 62,
- 63, 64, 65, 66, 67, 68, 69, 70,
- 71, 72, 73, 74, 75, 76, 77, 78,
- 79, 80, 81, 82, 83, 84, 85, 86,
- 87, 88, 89, 90, 91, 92, 93, 94,
- 95, 96, 97, 98, 99, 100, 101, 102,
- 104, 106, 108, 110, 112, 114, 116, 118,
- 120, 122, 124, 126, 128, 130, 132, 134,
- 136, 138, 140, 142, 144, 146, 148, 150,
- 152, 155, 158, 161, 164, 167, 170, 173,
- 176, 179, 182, 185, 188, 191, 194, 197,
- 200, 203, 207, 211, 215, 219, 223, 227,
- 231, 235, 239, 243, 247, 251, 255, 260,
- 265, 270, 275, 280, 285, 290, 295, 300,
- 305, 311, 317, 323, 329, 335, 341, 347,
- 353, 359, 366, 373, 380, 387, 394, 401,
- 408, 416, 424, 432, 440, 448, 456, 465,
- 474, 483, 492, 501, 510, 520, 530, 540,
- 550, 560, 571, 582, 593, 604, 615, 627,
- 639, 651, 663, 676, 689, 702, 715, 729,
- 743, 757, 771, 786, 801, 816, 832, 848,
- 864, 881, 898, 915, 933, 951, 969, 988,
- 1007, 1026, 1046, 1066, 1087, 1108, 1129, 1151,
- 1173, 1196, 1219, 1243, 1267, 1292, 1317, 1343,
- 1369, 1396, 1423, 1451, 1479, 1508, 1537, 1567,
- 1597, 1628, 1660, 1692, 1725, 1759, 1793, 1828,
- }, {
- 4, 9, 11, 13, 16, 18, 21, 24,
- 27, 30, 33, 37, 40, 44, 48, 51,
- 55, 59, 63, 67, 71, 75, 79, 83,
- 88, 92, 96, 100, 105, 109, 114, 118,
- 122, 127, 131, 136, 140, 145, 149, 154,
- 158, 163, 168, 172, 177, 181, 186, 190,
- 195, 199, 204, 208, 213, 217, 222, 226,
- 231, 235, 240, 244, 249, 253, 258, 262,
- 267, 271, 275, 280, 284, 289, 293, 297,
- 302, 306, 311, 315, 319, 324, 328, 332,
- 337, 341, 345, 349, 354, 358, 362, 367,
- 371, 375, 379, 384, 388, 392, 396, 401,
- 409, 417, 425, 433, 441, 449, 458, 466,
- 474, 482, 490, 498, 506, 514, 523, 531,
- 539, 547, 555, 563, 571, 579, 588, 596,
- 604, 616, 628, 640, 652, 664, 676, 688,
- 700, 713, 725, 737, 749, 761, 773, 785,
- 797, 809, 825, 841, 857, 873, 889, 905,
- 922, 938, 954, 970, 986, 1002, 1018, 1038,
- 1058, 1078, 1098, 1118, 1138, 1158, 1178, 1198,
- 1218, 1242, 1266, 1290, 1314, 1338, 1362, 1386,
- 1411, 1435, 1463, 1491, 1519, 1547, 1575, 1603,
- 1631, 1663, 1695, 1727, 1759, 1791, 1823, 1859,
- 1895, 1931, 1967, 2003, 2039, 2079, 2119, 2159,
- 2199, 2239, 2283, 2327, 2371, 2415, 2459, 2507,
- 2555, 2603, 2651, 2703, 2755, 2807, 2859, 2915,
- 2971, 3027, 3083, 3143, 3203, 3263, 3327, 3391,
- 3455, 3523, 3591, 3659, 3731, 3803, 3876, 3952,
- 4028, 4104, 4184, 4264, 4348, 4432, 4516, 4604,
- 4692, 4784, 4876, 4972, 5068, 5168, 5268, 5372,
- 5476, 5584, 5692, 5804, 5916, 6032, 6148, 6268,
- 6388, 6512, 6640, 6768, 6900, 7036, 7172, 7312,
- }, {
- 4, 13, 19, 27, 35, 44, 54, 64,
- 75, 87, 99, 112, 126, 139, 154, 168,
- 183, 199, 214, 230, 247, 263, 280, 297,
- 314, 331, 349, 366, 384, 402, 420, 438,
- 456, 475, 493, 511, 530, 548, 567, 586,
- 604, 623, 642, 660, 679, 698, 716, 735,
- 753, 772, 791, 809, 828, 846, 865, 884,
- 902, 920, 939, 957, 976, 994, 1012, 1030,
- 1049, 1067, 1085, 1103, 1121, 1139, 1157, 1175,
- 1193, 1211, 1229, 1246, 1264, 1282, 1299, 1317,
- 1335, 1352, 1370, 1387, 1405, 1422, 1440, 1457,
- 1474, 1491, 1509, 1526, 1543, 1560, 1577, 1595,
- 1627, 1660, 1693, 1725, 1758, 1791, 1824, 1856,
- 1889, 1922, 1954, 1987, 2020, 2052, 2085, 2118,
- 2150, 2183, 2216, 2248, 2281, 2313, 2346, 2378,
- 2411, 2459, 2508, 2556, 2605, 2653, 2701, 2750,
- 2798, 2847, 2895, 2943, 2992, 3040, 3088, 3137,
- 3185, 3234, 3298, 3362, 3426, 3491, 3555, 3619,
- 3684, 3748, 3812, 3876, 3941, 4005, 4069, 4149,
- 4230, 4310, 4390, 4470, 4550, 4631, 4711, 4791,
- 4871, 4967, 5064, 5160, 5256, 5352, 5448, 5544,
- 5641, 5737, 5849, 5961, 6073, 6185, 6297, 6410,
- 6522, 6650, 6778, 6906, 7034, 7162, 7290, 7435,
- 7579, 7723, 7867, 8011, 8155, 8315, 8475, 8635,
- 8795, 8956, 9132, 9308, 9484, 9660, 9836, 10028,
- 10220, 10412, 10604, 10812, 11020, 11228, 11437, 11661,
- 11885, 12109, 12333, 12573, 12813, 13053, 13309, 13565,
- 13821, 14093, 14365, 14637, 14925, 15213, 15502, 15806,
- 16110, 16414, 16734, 17054, 17390, 17726, 18062, 18414,
- 18766, 19134, 19502, 19886, 20270, 20670, 21070, 21486,
- 21902, 22334, 22766, 23214, 23662, 24126, 24590, 25070,
- 25551, 26047, 26559, 27071, 27599, 28143, 28687, 29247,
- }
-};
-
-static const enum TxfmType vp9_intra_txfm_type[14] = {
- [VERT_PRED] = ADST_DCT,
- [HOR_PRED] = DCT_ADST,
- [DC_PRED] = DCT_DCT,
- [DIAG_DOWN_LEFT_PRED] = DCT_DCT,
- [DIAG_DOWN_RIGHT_PRED] = ADST_ADST,
- [VERT_RIGHT_PRED] = ADST_DCT,
- [HOR_DOWN_PRED] = DCT_ADST,
- [VERT_LEFT_PRED] = ADST_DCT,
- [HOR_UP_PRED] = DCT_ADST,
- [TM_VP8_PRED] = ADST_ADST,
- [NEARESTMV] = DCT_DCT,
- [NEARMV] = DCT_DCT,
- [ZEROMV] = DCT_DCT,
- [NEWMV] = DCT_DCT,
-};
-
-static const int16_t vp9_default_scan_4x4[16] = {
- 0, 1, 4, 5,
- 2, 8, 3, 6,
- 12, 9, 7, 10,
- 13, 11, 14, 15,
-};
-
-static const int16_t vp9_col_scan_4x4[16] = {
- 0, 1, 2, 4,
- 3, 5, 6, 8,
- 7, 9, 10, 12,
- 13, 11, 14, 15,
-};
-
-static const int16_t vp9_row_scan_4x4[16] = {
- 0, 4, 1, 8,
- 5, 12, 9, 2,
- 6, 13, 3, 10,
- 7, 14, 11, 15,
-};
-
-static const int16_t vp9_default_scan_8x8[64] = {
- 0, 1, 8, 2, 9, 16, 10, 3,
- 17, 24, 18, 11, 4, 25, 32, 19,
- 12, 26, 5, 33, 20, 27, 40, 13,
- 34, 6, 41, 28, 21, 35, 42, 48,
- 14, 7, 36, 29, 43, 56, 49, 22,
- 15, 37, 50, 44, 57, 30, 23, 51,
- 45, 58, 38, 31, 52, 59, 39, 46,
- 53, 60, 47, 54, 61, 55, 62, 63,
-};
-
-static const int16_t vp9_col_scan_8x8[64] = {
- 0, 1, 2, 8, 3, 9, 4, 10,
- 16, 5, 11, 17, 12, 18, 6, 24,
- 19, 13, 25, 7, 26, 20, 32, 14,
- 27, 21, 33, 28, 34, 15, 22, 35,
- 40, 29, 41, 36, 23, 30, 42, 37,
- 48, 43, 31, 44, 49, 38, 50, 56,
- 45, 39, 51, 57, 52, 46, 58, 53,
- 59, 47, 60, 54, 61, 55, 62, 63,
-};
-
-static const int16_t vp9_row_scan_8x8[64] = {
- 0, 8, 16, 1, 9, 24, 2, 17,
- 32, 10, 25, 3, 40, 18, 11, 33,
- 26, 19, 4, 48, 41, 34, 12, 27,
- 56, 20, 5, 42, 35, 13, 49, 28,
- 6, 21, 43, 36, 14, 50, 29, 57,
- 7, 44, 22, 37, 51, 15, 58, 30,
- 23, 45, 52, 38, 59, 31, 46, 53,
- 39, 60, 47, 61, 54, 62, 55, 63,
-};
-
-static const int16_t vp9_default_scan_16x16[256] = {
- 0, 1, 16, 2, 17, 32, 3, 18, 33, 48, 4, 34, 19, 49, 20, 5,
- 35, 64, 50, 36, 65, 21, 6, 51, 80, 66, 37, 22, 52, 7, 81, 67,
- 38, 82, 53, 23, 96, 68, 8, 83, 97, 54, 39, 69, 112, 24, 98, 84,
- 70, 55, 9, 40, 85, 99, 113, 128, 25, 114, 100, 71, 86, 56, 10, 41,
- 115, 101, 129, 116, 72, 87, 26, 130, 144, 102, 57, 11, 42, 117, 131, 145,
- 88, 103, 27, 73, 132, 118, 146, 58, 160, 12, 43, 133, 147, 104, 89, 119,
- 161, 74, 148, 134, 28, 162, 59, 13, 176, 120, 149, 90, 135, 105, 163, 44,
- 75, 177, 164, 29, 150, 121, 136, 178, 165, 14, 106, 60, 91, 151, 45, 179,
- 192, 137, 166, 122, 76, 180, 152, 30, 61, 15, 107, 167, 181, 193, 92, 208,
- 46, 138, 123, 153, 194, 77, 168, 182, 31, 195, 209, 183, 108, 139, 62, 154,
- 47, 196, 93, 169, 210, 197, 224, 124, 184, 211, 78, 109, 170, 155, 63, 198,
- 212, 185, 225, 240, 140, 94, 199, 125, 79, 213, 226, 171, 186, 156, 214, 200,
- 110, 227, 141, 95, 241, 215, 228, 201, 126, 242, 187, 172, 157, 229, 111, 216,
- 243, 142, 202, 230, 127, 217, 244, 173, 188, 231, 158, 203, 143, 245, 218, 232,
- 189, 246, 159, 174, 233, 247, 219, 204, 175, 190, 248, 234, 205, 220, 249, 191,
- 235, 221, 250, 206, 222, 251, 236, 207, 237, 223, 252, 238, 253, 239, 254, 255,
-};
-
-static const int16_t vp9_col_scan_16x16[256] = {
- 0, 1, 2, 3, 16, 4, 17, 5, 18, 6, 19, 32, 20, 7, 33, 21,
- 34, 8, 35, 22, 48, 36, 9, 49, 23, 50, 37, 10, 38, 51, 24, 64,
- 52, 11, 65, 39, 25, 53, 66, 54, 40, 67, 12, 80, 26, 68, 55, 81,
- 41, 69, 13, 27, 82, 56, 70, 83, 42, 14, 84, 96, 71, 28, 57, 85,
- 97, 15, 72, 98, 43, 86, 58, 99, 29, 87, 100, 112, 73, 44, 101, 59,
- 30, 113, 88, 114, 74, 128, 102, 45, 31, 115, 60, 103, 89, 116, 75, 129,
- 117, 46, 104, 90, 61, 130, 118, 131, 132, 105, 76, 47, 119, 144, 91, 62,
- 133, 106, 145, 120, 146, 134, 77, 147, 121, 92, 135, 148, 63, 107, 136, 122,
- 93, 149, 160, 78, 150, 137, 108, 161, 162, 151, 123, 79, 138, 163, 152, 94,
- 164, 109, 165, 153, 124, 139, 176, 166, 95, 177, 167, 110, 154, 178, 125, 179,
- 140, 168, 155, 111, 180, 192, 181, 169, 141, 126, 182, 193, 194, 156, 183, 170,
- 195, 127, 142, 196, 184, 208, 197, 157, 171, 143, 185, 198, 209, 199, 210, 172,
- 158, 186, 211, 224, 212, 200, 240, 159, 213, 225, 187, 201, 173, 226, 214, 215,
- 227, 202, 228, 188, 241, 216, 174, 229, 242, 203, 243, 217, 230, 175, 189, 244,
- 231, 204, 218, 232, 245, 219, 246, 190, 233, 205, 191, 247, 234, 248, 220, 206,
- 249, 235, 221, 207, 250, 236, 222, 251, 223, 237, 238, 252, 239, 253, 254, 255,
-};
-
-static const int16_t vp9_row_scan_16x16[256] = {
- 0, 16, 32, 1, 48, 17, 64, 33, 2, 80, 18, 49, 96, 34, 3, 65,
- 19, 112, 50, 81, 35, 4, 128, 66, 20, 97, 51, 82, 5, 144, 36, 67,
- 113, 98, 21, 52, 160, 83, 129, 37, 68, 6, 114, 176, 99, 53, 22, 84,
- 145, 38, 69, 130, 7, 115, 192, 100, 54, 23, 85, 161, 146, 131, 39, 70,
- 208, 116, 8, 101, 177, 55, 86, 24, 162, 147, 132, 71, 224, 117, 40, 102,
- 9, 148, 56, 87, 193, 163, 240, 133, 178, 25, 118, 72, 41, 103, 164, 10,
- 149, 88, 134, 209, 179, 57, 119, 194, 26, 73, 165, 150, 104, 42, 135, 11,
- 180, 120, 89, 225, 195, 58, 27, 210, 151, 181, 166, 74, 43, 105, 12, 136,
- 90, 59, 241, 121, 28, 196, 167, 211, 152, 44, 182, 137, 75, 13, 226, 106,
- 122, 60, 197, 91, 168, 29, 183, 153, 14, 76, 212, 138, 45, 107, 15, 198,
- 92, 227, 169, 30, 123, 154, 61, 242, 184, 213, 139, 46, 77, 31, 108, 170,
- 199, 185, 124, 228, 93, 155, 214, 62, 140, 243, 78, 47, 200, 109, 186, 171,
- 201, 94, 63, 215, 229, 156, 79, 125, 141, 110, 216, 187, 172, 244, 202, 230,
- 217, 95, 157, 126, 245, 111, 142, 231, 188, 127, 158, 218, 173, 232, 246, 233,
- 203, 143, 247, 174, 189, 159, 219, 204, 248, 234, 249, 175, 190, 220, 205, 250,
- 235, 191, 221, 251, 236, 206, 252, 222, 207, 237, 223, 253, 238, 254, 239, 255,
-};
-
-static const int16_t vp9_default_scan_32x32[1024] = {
- 0, 1, 32, 2, 33, 64, 3, 34, 65, 4, 96, 35, 66, 5, 36, 97, 67, 128, 98, 68, 37, 6, 129, 99, 7, 160, 69, 38, 130, 100, 161, 131,
- 39, 70, 8, 101, 162, 132, 192, 71, 40, 9, 102, 163, 133, 193, 72, 224, 103, 41, 164, 10, 194, 134, 165, 73, 104, 135, 225, 42, 195, 11, 256, 166,
- 226, 196, 74, 105, 136, 43, 12, 167, 197, 227, 257, 75, 106, 137, 228, 44, 198, 168, 258, 288, 13, 229, 76, 107, 199, 138, 259, 169, 289, 45, 230, 260,
- 200, 108, 14, 170, 139, 320, 290, 77, 231, 261, 46, 201, 140, 291, 109, 232, 321, 262, 171, 78, 292, 15, 322, 202, 263, 352, 172, 293, 233, 141, 323, 110,
- 47, 203, 264, 234, 294, 353, 324, 16, 79, 204, 265, 295, 325, 173, 354, 142, 235, 384, 48, 296, 111, 266, 355, 326, 80, 17, 205, 236, 174, 356, 385, 327,
- 143, 297, 267, 357, 386, 112, 49, 328, 298, 206, 416, 237, 358, 387, 81, 175, 18, 329, 359, 388, 299, 330, 389, 113, 417, 238, 360, 50, 207, 418, 390, 331,
- 19, 448, 361, 82, 419, 391, 239, 51, 362, 420, 114, 449, 480, 421, 83, 363, 450, 422, 512, 451, 423, 115, 452, 481, 453, 482, 454, 544, 483, 455, 513, 484,
- 514, 485, 515, 486, 545, 576, 487, 546, 547, 608, 577, 578, 579, 609, 610, 611, 20, 144, 268, 392, 516, 640, 21, 52, 145, 176, 269, 300, 393, 424, 517, 548,
- 641, 672, 22, 53, 84, 146, 177, 208, 270, 301, 332, 394, 425, 456, 518, 549, 580, 642, 673, 704, 23, 54, 85, 116, 147, 178, 209, 240, 271, 302, 333, 364,
- 395, 426, 457, 488, 519, 550, 581, 612, 643, 674, 705, 736, 55, 86, 117, 179, 210, 241, 303, 334, 365, 427, 458, 489, 551, 582, 613, 675, 706, 737, 87, 118,
- 211, 242, 335, 366, 459, 490, 583, 614, 707, 738, 119, 243, 367, 491, 615, 739, 24, 148, 272, 396, 520, 644, 768, 25, 56, 149, 180, 273, 304, 397, 428, 521,
- 552, 645, 676, 769, 800, 26, 57, 88, 150, 181, 212, 274, 305, 336, 398, 429, 460, 522, 553, 584, 646, 677, 708, 770, 801, 832, 27, 58, 89, 120, 151, 182,
- 213, 244, 275, 306, 337, 368, 399, 430, 461, 492, 523, 554, 585, 616, 647, 678, 709, 740, 771, 802, 833, 864, 59, 90, 121, 183, 214, 245, 307, 338, 369, 431,
- 462, 493, 555, 586, 617, 679, 710, 741, 803, 834, 865, 91, 122, 215, 246, 339, 370, 463, 494, 587, 618, 711, 742, 835, 866, 123, 247, 371, 495, 619, 743, 867,
- 28, 152, 276, 400, 524, 648, 772, 896, 29, 60, 153, 184, 277, 308, 401, 432, 525, 556, 649, 680, 773, 804, 897, 928, 30, 61, 92, 154, 185, 216, 278, 309,
- 340, 402, 433, 464, 526, 557, 588, 650, 681, 712, 774, 805, 836, 898, 929, 960, 31, 62, 93, 124, 155, 186, 217, 248, 279, 310, 341, 372, 403, 434, 465, 496,
- 527, 558, 589, 620, 651, 682, 713, 744, 775, 806, 837, 868, 899, 930, 961, 992, 63, 94, 125, 187, 218, 249, 311, 342, 373, 435, 466, 497, 559, 590, 621, 683,
- 714, 745, 807, 838, 869, 931, 962, 993, 95, 126, 219, 250, 343, 374, 467, 498, 591, 622, 715, 746, 839, 870, 963, 994, 127, 251, 375, 499, 623, 747, 871, 995,
- 156, 280, 404, 528, 652, 776, 900, 157, 188, 281, 312, 405, 436, 529, 560, 653, 684, 777, 808, 901, 932, 158, 189, 220, 282, 313, 344, 406, 437, 468, 530, 561,
- 592, 654, 685, 716, 778, 809, 840, 902, 933, 964, 159, 190, 221, 252, 283, 314, 345, 376, 407, 438, 469, 500, 531, 562, 593, 624, 655, 686, 717, 748, 779, 810,
- 841, 872, 903, 934, 965, 996, 191, 222, 253, 315, 346, 377, 439, 470, 501, 563, 594, 625, 687, 718, 749, 811, 842, 873, 935, 966, 997, 223, 254, 347, 378, 471,
- 502, 595, 626, 719, 750, 843, 874, 967, 998, 255, 379, 503, 627, 751, 875, 999, 284, 408, 532, 656, 780, 904, 285, 316, 409, 440, 533, 564, 657, 688, 781, 812,
- 905, 936, 286, 317, 348, 410, 441, 472, 534, 565, 596, 658, 689, 720, 782, 813, 844, 906, 937, 968, 287, 318, 349, 380, 411, 442, 473, 504, 535, 566, 597, 628,
- 659, 690, 721, 752, 783, 814, 845, 876, 907, 938, 969, 1000, 319, 350, 381, 443, 474, 505, 567, 598, 629, 691, 722, 753, 815, 846, 877, 939, 970, 1001, 351, 382,
- 475, 506, 599, 630, 723, 754, 847, 878, 971, 1002, 383, 507, 631, 755, 879, 1003, 412, 536, 660, 784, 908, 413, 444, 537, 568, 661, 692, 785, 816, 909, 940, 414,
- 445, 476, 538, 569, 600, 662, 693, 724, 786, 817, 848, 910, 941, 972, 415, 446, 477, 508, 539, 570, 601, 632, 663, 694, 725, 756, 787, 818, 849, 880, 911, 942,
- 973, 1004, 447, 478, 509, 571, 602, 633, 695, 726, 757, 819, 850, 881, 943, 974, 1005, 479, 510, 603, 634, 727, 758, 851, 882, 975, 1006, 511, 635, 759, 883, 1007,
- 540, 664, 788, 912, 541, 572, 665, 696, 789, 820, 913, 944, 542, 573, 604, 666, 697, 728, 790, 821, 852, 914, 945, 976, 543, 574, 605, 636, 667, 698, 729, 760,
- 791, 822, 853, 884, 915, 946, 977, 1008, 575, 606, 637, 699, 730, 761, 823, 854, 885, 947, 978, 1009, 607, 638, 731, 762, 855, 886, 979, 1010, 639, 763, 887, 1011,
- 668, 792, 916, 669, 700, 793, 824, 917, 948, 670, 701, 732, 794, 825, 856, 918, 949, 980, 671, 702, 733, 764, 795, 826, 857, 888, 919, 950, 981, 1012, 703, 734,
- 765, 827, 858, 889, 951, 982, 1013, 735, 766, 859, 890, 983, 1014, 767, 891, 1015, 796, 920, 797, 828, 921, 952, 798, 829, 860, 922, 953, 984, 799, 830, 861, 892,
- 923, 954, 985, 1016, 831, 862, 893, 955, 986, 1017, 863, 894, 987, 1018, 895, 1019, 924, 925, 956, 926, 957, 988, 927, 958, 989, 1020, 959, 990, 1021, 991, 1022, 1023,
-};
-
-static const int16_t * const vp9_scans[5][4] = {
- {
- vp9_default_scan_4x4, vp9_col_scan_4x4,
- vp9_row_scan_4x4, vp9_default_scan_4x4
- }, {
- vp9_default_scan_8x8, vp9_col_scan_8x8,
- vp9_row_scan_8x8, vp9_default_scan_8x8
- }, {
- vp9_default_scan_16x16, vp9_col_scan_16x16,
- vp9_row_scan_16x16, vp9_default_scan_16x16
- }, {
- vp9_default_scan_32x32, vp9_default_scan_32x32,
- vp9_default_scan_32x32, vp9_default_scan_32x32
- }, { // lossless
- vp9_default_scan_4x4, vp9_default_scan_4x4,
- vp9_default_scan_4x4, vp9_default_scan_4x4
- }
-};
-
-static const int16_t vp9_default_scan_4x4_nb[16][2] = {
- { 0, 0 }, { 0, 0 }, { 4, 1 }, { 1, 1 },
- { 4, 4 }, { 2, 2 }, { 5, 2 }, { 8, 8 },
- { 8, 5 }, { 6, 3 }, { 9, 6 }, { 12, 9 },
- { 10, 7 }, { 13, 10 }, { 14, 11 }, { 0, 0 },
-};
-
-static const int16_t vp9_col_scan_4x4_nb[16][2] = {
- { 0, 0 }, { 1, 1 }, { 0, 0 }, { 2, 2 },
- { 4, 4 }, { 5, 5 }, { 4, 4 }, { 6, 6 },
- { 8, 8 }, { 9, 9 }, { 8, 8 }, { 12, 12 },
- { 10, 10 }, { 13, 13 }, { 14, 14 }, { 0, 0 },
-};
-
-static const int16_t vp9_row_scan_4x4_nb[16][2] = {
- { 0, 0 }, { 0, 0 }, { 4, 4 }, { 1, 1 },
- { 8, 8 }, { 5, 5 }, { 1, 1 }, { 2, 2 },
- { 9, 9 }, { 2, 2 }, { 6, 6 }, { 3, 3 },
- { 10, 10 }, { 7, 7 }, { 11, 11 }, { 0, 0 },
-};
-
-static const int16_t vp9_default_scan_8x8_nb[64][2] = {
- { 0, 0 }, { 0, 0 }, { 1, 1 }, { 8, 1 },
- { 8, 8 }, { 9, 2 }, { 2, 2 }, { 16, 9 },
- { 16, 16 }, { 17, 10 }, { 10, 3 }, { 3, 3 },
- { 24, 17 }, { 24, 24 }, { 18, 11 }, { 11, 4 },
- { 25, 18 }, { 4, 4 }, { 32, 25 }, { 19, 12 },
- { 26, 19 }, { 32, 32 }, { 12, 5 }, { 33, 26 },
- { 5, 5 }, { 40, 33 }, { 27, 20 }, { 20, 13 },
- { 34, 27 }, { 41, 34 }, { 40, 40 }, { 13, 6 },
- { 6, 6 }, { 35, 28 }, { 28, 21 }, { 42, 35 },
- { 48, 48 }, { 48, 41 }, { 21, 14 }, { 14, 7 },
- { 36, 29 }, { 49, 42 }, { 43, 36 }, { 56, 49 },
- { 29, 22 }, { 22, 15 }, { 50, 43 }, { 44, 37 },
- { 57, 50 }, { 37, 30 }, { 30, 23 }, { 51, 44 },
- { 58, 51 }, { 38, 31 }, { 45, 38 }, { 52, 45 },
- { 59, 52 }, { 46, 39 }, { 53, 46 }, { 60, 53 },
- { 54, 47 }, { 61, 54 }, { 62, 55 }, { 0, 0 },
-};
-
-static const int16_t vp9_col_scan_8x8_nb[64][2] = {
- { 0, 0 }, { 1, 1 }, { 0, 0 }, { 2, 2 },
- { 8, 8 }, { 3, 3 }, { 9, 9 }, { 8, 8 },
- { 4, 4 }, { 10, 10 }, { 16, 16 }, { 11, 11 },
- { 17, 17 }, { 5, 5 }, { 16, 16 }, { 18, 18 },
- { 12, 12 }, { 24, 24 }, { 6, 6 }, { 25, 25 },
- { 19, 19 }, { 24, 24 }, { 13, 13 }, { 26, 26 },
- { 20, 20 }, { 32, 32 }, { 27, 27 }, { 33, 33 },
- { 14, 14 }, { 21, 21 }, { 34, 34 }, { 32, 32 },
- { 28, 28 }, { 40, 40 }, { 35, 35 }, { 22, 22 },
- { 29, 29 }, { 41, 41 }, { 36, 36 }, { 40, 40 },
- { 42, 42 }, { 30, 30 }, { 43, 43 }, { 48, 48 },
- { 37, 37 }, { 49, 49 }, { 48, 48 }, { 44, 44 },
- { 38, 38 }, { 50, 50 }, { 56, 56 }, { 51, 51 },
- { 45, 45 }, { 57, 57 }, { 52, 52 }, { 58, 58 },
- { 46, 46 }, { 59, 59 }, { 53, 53 }, { 60, 60 },
- { 54, 54 }, { 61, 61 }, { 62, 62 }, { 0, 0 },
-};
-
-static const int16_t vp9_row_scan_8x8_nb[64][2] = {
- { 0, 0 }, { 8, 8 }, { 0, 0 }, { 1, 1 },
- { 16, 16 }, { 1, 1 }, { 9, 9 }, { 24, 24 },
- { 2, 2 }, { 17, 17 }, { 2, 2 }, { 32, 32 },
- { 10, 10 }, { 3, 3 }, { 25, 25 }, { 18, 18 },
- { 11, 11 }, { 3, 3 }, { 40, 40 }, { 33, 33 },
- { 26, 26 }, { 4, 4 }, { 19, 19 }, { 48, 48 },
- { 12, 12 }, { 4, 4 }, { 34, 34 }, { 27, 27 },
- { 5, 5 }, { 41, 41 }, { 20, 20 }, { 5, 5 },
- { 13, 13 }, { 35, 35 }, { 28, 28 }, { 6, 6 },
- { 42, 42 }, { 21, 21 }, { 49, 49 }, { 6, 6 },
- { 36, 36 }, { 14, 14 }, { 29, 29 }, { 43, 43 },
- { 7, 7 }, { 50, 50 }, { 22, 22 }, { 15, 15 },
- { 37, 37 }, { 44, 44 }, { 30, 30 }, { 51, 51 },
- { 23, 23 }, { 38, 38 }, { 45, 45 }, { 31, 31 },
- { 52, 52 }, { 39, 39 }, { 53, 53 }, { 46, 46 },
- { 54, 54 }, { 47, 47 }, { 55, 55 }, { 0, 0 },
-};
-
-static const int16_t vp9_default_scan_16x16_nb[256][2] = {
- { 0, 0 }, { 0, 0 }, { 1, 1 }, { 16, 1 },
- { 16, 16 }, { 2, 2 }, { 17, 2 }, { 32, 17 },
- { 32, 32 }, { 3, 3 }, { 33, 18 }, { 18, 3 },
- { 48, 33 }, { 19, 4 }, { 4, 4 }, { 34, 19 },
- { 48, 48 }, { 49, 34 }, { 35, 20 }, { 64, 49 },
- { 20, 5 }, { 5, 5 }, { 50, 35 }, { 64, 64 },
- { 65, 50 }, { 36, 21 }, { 21, 6 }, { 51, 36 },
- { 6, 6 }, { 80, 65 }, { 66, 51 }, { 37, 22 },
- { 81, 66 }, { 52, 37 }, { 22, 7 }, { 80, 80 },
- { 67, 52 }, { 7, 7 }, { 82, 67 }, { 96, 81 },
- { 53, 38 }, { 38, 23 }, { 68, 53 }, { 96, 96 },
- { 23, 8 }, { 97, 82 }, { 83, 68 }, { 69, 54 },
- { 54, 39 }, { 8, 8 }, { 39, 24 }, { 84, 69 },
- { 98, 83 }, { 112, 97 }, { 112, 112 }, { 24, 9 },
- { 113, 98 }, { 99, 84 }, { 70, 55 }, { 85, 70 },
- { 55, 40 }, { 9, 9 }, { 40, 25 }, { 114, 99 },
- { 100, 85 }, { 128, 113 }, { 115, 100 }, { 71, 56 },
- { 86, 71 }, { 25, 10 }, { 129, 114 }, { 128, 128 },
- { 101, 86 }, { 56, 41 }, { 10, 10 }, { 41, 26 },
- { 116, 101 }, { 130, 115 }, { 144, 129 }, { 87, 72 },
- { 102, 87 }, { 26, 11 }, { 72, 57 }, { 131, 116 },
- { 117, 102 }, { 145, 130 }, { 57, 42 }, { 144, 144 },
- { 11, 11 }, { 42, 27 }, { 132, 117 }, { 146, 131 },
- { 103, 88 }, { 88, 73 }, { 118, 103 }, { 160, 145 },
- { 73, 58 }, { 147, 132 }, { 133, 118 }, { 27, 12 },
- { 161, 146 }, { 58, 43 }, { 12, 12 }, { 160, 160 },
- { 119, 104 }, { 148, 133 }, { 89, 74 }, { 134, 119 },
- { 104, 89 }, { 162, 147 }, { 43, 28 }, { 74, 59 },
- { 176, 161 }, { 163, 148 }, { 28, 13 }, { 149, 134 },
- { 120, 105 }, { 135, 120 }, { 177, 162 }, { 164, 149 },
- { 13, 13 }, { 105, 90 }, { 59, 44 }, { 90, 75 },
- { 150, 135 }, { 44, 29 }, { 178, 163 }, { 176, 176 },
- { 136, 121 }, { 165, 150 }, { 121, 106 }, { 75, 60 },
- { 179, 164 }, { 151, 136 }, { 29, 14 }, { 60, 45 },
- { 14, 14 }, { 106, 91 }, { 166, 151 }, { 180, 165 },
- { 192, 177 }, { 91, 76 }, { 192, 192 }, { 45, 30 },
- { 137, 122 }, { 122, 107 }, { 152, 137 }, { 193, 178 },
- { 76, 61 }, { 167, 152 }, { 181, 166 }, { 30, 15 },
- { 194, 179 }, { 208, 193 }, { 182, 167 }, { 107, 92 },
- { 138, 123 }, { 61, 46 }, { 153, 138 }, { 46, 31 },
- { 195, 180 }, { 92, 77 }, { 168, 153 }, { 209, 194 },
- { 196, 181 }, { 208, 208 }, { 123, 108 }, { 183, 168 },
- { 210, 195 }, { 77, 62 }, { 108, 93 }, { 169, 154 },
- { 154, 139 }, { 62, 47 }, { 197, 182 }, { 211, 196 },
- { 184, 169 }, { 224, 209 }, { 224, 224 }, { 139, 124 },
- { 93, 78 }, { 198, 183 }, { 124, 109 }, { 78, 63 },
- { 212, 197 }, { 225, 210 }, { 170, 155 }, { 185, 170 },
- { 155, 140 }, { 213, 198 }, { 199, 184 }, { 109, 94 },
- { 226, 211 }, { 140, 125 }, { 94, 79 }, { 240, 225 },
- { 214, 199 }, { 227, 212 }, { 200, 185 }, { 125, 110 },
- { 241, 226 }, { 186, 171 }, { 171, 156 }, { 156, 141 },
- { 228, 213 }, { 110, 95 }, { 215, 200 }, { 242, 227 },
- { 141, 126 }, { 201, 186 }, { 229, 214 }, { 126, 111 },
- { 216, 201 }, { 243, 228 }, { 172, 157 }, { 187, 172 },
- { 230, 215 }, { 157, 142 }, { 202, 187 }, { 142, 127 },
- { 244, 229 }, { 217, 202 }, { 231, 216 }, { 188, 173 },
- { 245, 230 }, { 158, 143 }, { 173, 158 }, { 232, 217 },
- { 246, 231 }, { 218, 203 }, { 203, 188 }, { 174, 159 },
- { 189, 174 }, { 247, 232 }, { 233, 218 }, { 204, 189 },
- { 219, 204 }, { 248, 233 }, { 190, 175 }, { 234, 219 },
- { 220, 205 }, { 249, 234 }, { 205, 190 }, { 221, 206 },
- { 250, 235 }, { 235, 220 }, { 206, 191 }, { 236, 221 },
- { 222, 207 }, { 251, 236 }, { 237, 222 }, { 252, 237 },
- { 238, 223 }, { 253, 238 }, { 254, 239 }, { 0, 0 },
-};
-
-static const int16_t vp9_col_scan_16x16_nb[256][2] = {
- { 0, 0 }, { 1, 1 }, { 2, 2 }, { 0, 0 },
- { 3, 3 }, { 16, 16 }, { 4, 4 }, { 17, 17 },
- { 5, 5 }, { 18, 18 }, { 16, 16 }, { 19, 19 },
- { 6, 6 }, { 32, 32 }, { 20, 20 }, { 33, 33 },
- { 7, 7 }, { 34, 34 }, { 21, 21 }, { 32, 32 },
- { 35, 35 }, { 8, 8 }, { 48, 48 }, { 22, 22 },
- { 49, 49 }, { 36, 36 }, { 9, 9 }, { 37, 37 },
- { 50, 50 }, { 23, 23 }, { 48, 48 }, { 51, 51 },
- { 10, 10 }, { 64, 64 }, { 38, 38 }, { 24, 24 },
- { 52, 52 }, { 65, 65 }, { 53, 53 }, { 39, 39 },
- { 66, 66 }, { 11, 11 }, { 64, 64 }, { 25, 25 },
- { 67, 67 }, { 54, 54 }, { 80, 80 }, { 40, 40 },
- { 68, 68 }, { 12, 12 }, { 26, 26 }, { 81, 81 },
- { 55, 55 }, { 69, 69 }, { 82, 82 }, { 41, 41 },
- { 13, 13 }, { 83, 83 }, { 80, 80 }, { 70, 70 },
- { 27, 27 }, { 56, 56 }, { 84, 84 }, { 96, 96 },
- { 14, 14 }, { 71, 71 }, { 97, 97 }, { 42, 42 },
- { 85, 85 }, { 57, 57 }, { 98, 98 }, { 28, 28 },
- { 86, 86 }, { 99, 99 }, { 96, 96 }, { 72, 72 },
- { 43, 43 }, { 100, 100 }, { 58, 58 }, { 29, 29 },
- { 112, 112 }, { 87, 87 }, { 113, 113 }, { 73, 73 },
- { 112, 112 }, { 101, 101 }, { 44, 44 }, { 30, 30 },
- { 114, 114 }, { 59, 59 }, { 102, 102 }, { 88, 88 },
- { 115, 115 }, { 74, 74 }, { 128, 128 }, { 116, 116 },
- { 45, 45 }, { 103, 103 }, { 89, 89 }, { 60, 60 },
- { 129, 129 }, { 117, 117 }, { 130, 130 }, { 131, 131 },
- { 104, 104 }, { 75, 75 }, { 46, 46 }, { 118, 118 },
- { 128, 128 }, { 90, 90 }, { 61, 61 }, { 132, 132 },
- { 105, 105 }, { 144, 144 }, { 119, 119 }, { 145, 145 },
- { 133, 133 }, { 76, 76 }, { 146, 146 }, { 120, 120 },
- { 91, 91 }, { 134, 134 }, { 147, 147 }, { 62, 62 },
- { 106, 106 }, { 135, 135 }, { 121, 121 }, { 92, 92 },
- { 148, 148 }, { 144, 144 }, { 77, 77 }, { 149, 149 },
- { 136, 136 }, { 107, 107 }, { 160, 160 }, { 161, 161 },
- { 150, 150 }, { 122, 122 }, { 78, 78 }, { 137, 137 },
- { 162, 162 }, { 151, 151 }, { 93, 93 }, { 163, 163 },
- { 108, 108 }, { 164, 164 }, { 152, 152 }, { 123, 123 },
- { 138, 138 }, { 160, 160 }, { 165, 165 }, { 94, 94 },
- { 176, 176 }, { 166, 166 }, { 109, 109 }, { 153, 153 },
- { 177, 177 }, { 124, 124 }, { 178, 178 }, { 139, 139 },
- { 167, 167 }, { 154, 154 }, { 110, 110 }, { 179, 179 },
- { 176, 176 }, { 180, 180 }, { 168, 168 }, { 140, 140 },
- { 125, 125 }, { 181, 181 }, { 192, 192 }, { 193, 193 },
- { 155, 155 }, { 182, 182 }, { 169, 169 }, { 194, 194 },
- { 126, 126 }, { 141, 141 }, { 195, 195 }, { 183, 183 },
- { 192, 192 }, { 196, 196 }, { 156, 156 }, { 170, 170 },
- { 142, 142 }, { 184, 184 }, { 197, 197 }, { 208, 208 },
- { 198, 198 }, { 209, 209 }, { 171, 171 }, { 157, 157 },
- { 185, 185 }, { 210, 210 }, { 208, 208 }, { 211, 211 },
- { 199, 199 }, { 224, 224 }, { 158, 158 }, { 212, 212 },
- { 224, 224 }, { 186, 186 }, { 200, 200 }, { 172, 172 },
- { 225, 225 }, { 213, 213 }, { 214, 214 }, { 226, 226 },
- { 201, 201 }, { 227, 227 }, { 187, 187 }, { 240, 240 },
- { 215, 215 }, { 173, 173 }, { 228, 228 }, { 241, 241 },
- { 202, 202 }, { 242, 242 }, { 216, 216 }, { 229, 229 },
- { 174, 174 }, { 188, 188 }, { 243, 243 }, { 230, 230 },
- { 203, 203 }, { 217, 217 }, { 231, 231 }, { 244, 244 },
- { 218, 218 }, { 245, 245 }, { 189, 189 }, { 232, 232 },
- { 204, 204 }, { 190, 190 }, { 246, 246 }, { 233, 233 },
- { 247, 247 }, { 219, 219 }, { 205, 205 }, { 248, 248 },
- { 234, 234 }, { 220, 220 }, { 206, 206 }, { 249, 249 },
- { 235, 235 }, { 221, 221 }, { 250, 250 }, { 222, 222 },
- { 236, 236 }, { 237, 237 }, { 251, 251 }, { 238, 238 },
- { 252, 252 }, { 253, 253 }, { 254, 254 }, { 0, 0 },
-};
-
-static const int16_t vp9_row_scan_16x16_nb[256][2] = {
- { 0, 0 }, { 16, 16 }, { 0, 0 }, { 32, 32 },
- { 1, 1 }, { 48, 48 }, { 17, 17 }, { 1, 1 },
- { 64, 64 }, { 2, 2 }, { 33, 33 }, { 80, 80 },
- { 18, 18 }, { 2, 2 }, { 49, 49 }, { 3, 3 },
- { 96, 96 }, { 34, 34 }, { 65, 65 }, { 19, 19 },
- { 3, 3 }, { 112, 112 }, { 50, 50 }, { 4, 4 },
- { 81, 81 }, { 35, 35 }, { 66, 66 }, { 4, 4 },
- { 128, 128 }, { 20, 20 }, { 51, 51 }, { 97, 97 },
- { 82, 82 }, { 5, 5 }, { 36, 36 }, { 144, 144 },
- { 67, 67 }, { 113, 113 }, { 21, 21 }, { 52, 52 },
- { 5, 5 }, { 98, 98 }, { 160, 160 }, { 83, 83 },
- { 37, 37 }, { 6, 6 }, { 68, 68 }, { 129, 129 },
- { 22, 22 }, { 53, 53 }, { 114, 114 }, { 6, 6 },
- { 99, 99 }, { 176, 176 }, { 84, 84 }, { 38, 38 },
- { 7, 7 }, { 69, 69 }, { 145, 145 }, { 130, 130 },
- { 115, 115 }, { 23, 23 }, { 54, 54 }, { 192, 192 },
- { 100, 100 }, { 7, 7 }, { 85, 85 }, { 161, 161 },
- { 39, 39 }, { 70, 70 }, { 8, 8 }, { 146, 146 },
- { 131, 131 }, { 116, 116 }, { 55, 55 }, { 208, 208 },
- { 101, 101 }, { 24, 24 }, { 86, 86 }, { 8, 8 },
- { 132, 132 }, { 40, 40 }, { 71, 71 }, { 177, 177 },
- { 147, 147 }, { 224, 224 }, { 117, 117 }, { 162, 162 },
- { 9, 9 }, { 102, 102 }, { 56, 56 }, { 25, 25 },
- { 87, 87 }, { 148, 148 }, { 9, 9 }, { 133, 133 },
- { 72, 72 }, { 118, 118 }, { 193, 193 }, { 163, 163 },
- { 41, 41 }, { 103, 103 }, { 178, 178 }, { 10, 10 },
- { 57, 57 }, { 149, 149 }, { 134, 134 }, { 88, 88 },
- { 26, 26 }, { 119, 119 }, { 10, 10 }, { 164, 164 },
- { 104, 104 }, { 73, 73 }, { 209, 209 }, { 179, 179 },
- { 42, 42 }, { 11, 11 }, { 194, 194 }, { 135, 135 },
- { 165, 165 }, { 150, 150 }, { 58, 58 }, { 27, 27 },
- { 89, 89 }, { 11, 11 }, { 120, 120 }, { 74, 74 },
- { 43, 43 }, { 225, 225 }, { 105, 105 }, { 12, 12 },
- { 180, 180 }, { 151, 151 }, { 195, 195 }, { 136, 136 },
- { 28, 28 }, { 166, 166 }, { 121, 121 }, { 59, 59 },
- { 12, 12 }, { 210, 210 }, { 90, 90 }, { 106, 106 },
- { 44, 44 }, { 181, 181 }, { 75, 75 }, { 152, 152 },
- { 13, 13 }, { 167, 167 }, { 137, 137 }, { 13, 13 },
- { 60, 60 }, { 196, 196 }, { 122, 122 }, { 29, 29 },
- { 91, 91 }, { 14, 14 }, { 182, 182 }, { 76, 76 },
- { 211, 211 }, { 153, 153 }, { 14, 14 }, { 107, 107 },
- { 138, 138 }, { 45, 45 }, { 226, 226 }, { 168, 168 },
- { 197, 197 }, { 123, 123 }, { 30, 30 }, { 61, 61 },
- { 15, 15 }, { 92, 92 }, { 154, 154 }, { 183, 183 },
- { 169, 169 }, { 108, 108 }, { 212, 212 }, { 77, 77 },
- { 139, 139 }, { 198, 198 }, { 46, 46 }, { 124, 124 },
- { 227, 227 }, { 62, 62 }, { 31, 31 }, { 184, 184 },
- { 93, 93 }, { 170, 170 }, { 155, 155 }, { 185, 185 },
- { 78, 78 }, { 47, 47 }, { 199, 199 }, { 213, 213 },
- { 140, 140 }, { 63, 63 }, { 109, 109 }, { 125, 125 },
- { 94, 94 }, { 200, 200 }, { 171, 171 }, { 156, 156 },
- { 228, 228 }, { 186, 186 }, { 214, 214 }, { 201, 201 },
- { 79, 79 }, { 141, 141 }, { 110, 110 }, { 229, 229 },
- { 95, 95 }, { 126, 126 }, { 215, 215 }, { 172, 172 },
- { 111, 111 }, { 142, 142 }, { 202, 202 }, { 157, 157 },
- { 216, 216 }, { 230, 230 }, { 217, 217 }, { 187, 187 },
- { 127, 127 }, { 231, 231 }, { 158, 158 }, { 173, 173 },
- { 143, 143 }, { 203, 203 }, { 188, 188 }, { 232, 232 },
- { 218, 218 }, { 233, 233 }, { 159, 159 }, { 174, 174 },
- { 204, 204 }, { 189, 189 }, { 234, 234 }, { 219, 219 },
- { 175, 175 }, { 205, 205 }, { 235, 235 }, { 220, 220 },
- { 190, 190 }, { 236, 236 }, { 206, 206 }, { 191, 191 },
- { 221, 221 }, { 207, 207 }, { 237, 237 }, { 222, 222 },
- { 238, 238 }, { 223, 223 }, { 239, 239 }, { 0, 0 },
-};
-
-static const int16_t vp9_default_scan_32x32_nb[1024][2] = {
- { 0, 0 }, { 0, 0 }, { 1, 1 }, { 32, 1 },
- { 32, 32 }, { 2, 2 }, { 33, 2 }, { 64, 33 },
- { 3, 3 }, { 64, 64 }, { 34, 3 }, { 65, 34 },
- { 4, 4 }, { 35, 4 }, { 96, 65 }, { 66, 35 },
- { 96, 96 }, { 97, 66 }, { 67, 36 }, { 36, 5 },
- { 5, 5 }, { 128, 97 }, { 98, 67 }, { 6, 6 },
- { 128, 128 }, { 68, 37 }, { 37, 6 }, { 129, 98 },
- { 99, 68 }, { 160, 129 }, { 130, 99 }, { 38, 7 },
- { 69, 38 }, { 7, 7 }, { 100, 69 }, { 161, 130 },
- { 131, 100 }, { 160, 160 }, { 70, 39 }, { 39, 8 },
- { 8, 8 }, { 101, 70 }, { 162, 131 }, { 132, 101 },
- { 192, 161 }, { 71, 40 }, { 192, 192 }, { 102, 71 },
- { 40, 9 }, { 163, 132 }, { 9, 9 }, { 193, 162 },
- { 133, 102 }, { 164, 133 }, { 72, 41 }, { 103, 72 },
- { 134, 103 }, { 224, 193 }, { 41, 10 }, { 194, 163 },
- { 10, 10 }, { 224, 224 }, { 165, 134 }, { 225, 194 },
- { 195, 164 }, { 73, 42 }, { 104, 73 }, { 135, 104 },
- { 42, 11 }, { 11, 11 }, { 166, 135 }, { 196, 165 },
- { 226, 195 }, { 256, 225 }, { 74, 43 }, { 105, 74 },
- { 136, 105 }, { 227, 196 }, { 43, 12 }, { 197, 166 },
- { 167, 136 }, { 257, 226 }, { 256, 256 }, { 12, 12 },
- { 228, 197 }, { 75, 44 }, { 106, 75 }, { 198, 167 },
- { 137, 106 }, { 258, 227 }, { 168, 137 }, { 288, 257 },
- { 44, 13 }, { 229, 198 }, { 259, 228 }, { 199, 168 },
- { 107, 76 }, { 13, 13 }, { 169, 138 }, { 138, 107 },
- { 288, 288 }, { 289, 258 }, { 76, 45 }, { 230, 199 },
- { 260, 229 }, { 45, 14 }, { 200, 169 }, { 139, 108 },
- { 290, 259 }, { 108, 77 }, { 231, 200 }, { 320, 289 },
- { 261, 230 }, { 170, 139 }, { 77, 46 }, { 291, 260 },
- { 14, 14 }, { 321, 290 }, { 201, 170 }, { 262, 231 },
- { 320, 320 }, { 171, 140 }, { 292, 261 }, { 232, 201 },
- { 140, 109 }, { 322, 291 }, { 109, 78 }, { 46, 15 },
- { 202, 171 }, { 263, 232 }, { 233, 202 }, { 293, 262 },
- { 352, 321 }, { 323, 292 }, { 15, 15 }, { 78, 47 },
- { 203, 172 }, { 264, 233 }, { 294, 263 }, { 324, 293 },
- { 172, 141 }, { 353, 322 }, { 141, 110 }, { 234, 203 },
- { 352, 352 }, { 47, 16 }, { 295, 264 }, { 110, 79 },
- { 265, 234 }, { 354, 323 }, { 325, 294 }, { 79, 48 },
- { 16, 16 }, { 204, 173 }, { 235, 204 }, { 173, 142 },
- { 355, 324 }, { 384, 353 }, { 326, 295 }, { 142, 111 },
- { 296, 265 }, { 266, 235 }, { 356, 325 }, { 385, 354 },
- { 111, 80 }, { 48, 17 }, { 327, 296 }, { 297, 266 },
- { 205, 174 }, { 384, 384 }, { 236, 205 }, { 357, 326 },
- { 386, 355 }, { 80, 49 }, { 174, 143 }, { 17, 17 },
- { 328, 297 }, { 358, 327 }, { 387, 356 }, { 298, 267 },
- { 329, 298 }, { 388, 357 }, { 112, 81 }, { 416, 385 },
- { 237, 206 }, { 359, 328 }, { 49, 18 }, { 206, 175 },
- { 417, 386 }, { 389, 358 }, { 330, 299 }, { 18, 18 },
- { 416, 416 }, { 360, 329 }, { 81, 50 }, { 418, 387 },
- { 390, 359 }, { 238, 207 }, { 50, 19 }, { 361, 330 },
- { 419, 388 }, { 113, 82 }, { 448, 417 }, { 448, 448 },
- { 420, 389 }, { 82, 51 }, { 362, 331 }, { 449, 418 },
- { 421, 390 }, { 480, 480 }, { 450, 419 }, { 422, 391 },
- { 114, 83 }, { 451, 420 }, { 480, 449 }, { 452, 421 },
- { 481, 450 }, { 453, 422 }, { 512, 512 }, { 482, 451 },
- { 454, 423 }, { 512, 481 }, { 483, 452 }, { 513, 482 },
- { 484, 453 }, { 514, 483 }, { 485, 454 }, { 544, 513 },
- { 544, 544 }, { 486, 455 }, { 545, 514 }, { 546, 515 },
- { 576, 576 }, { 576, 545 }, { 577, 546 }, { 578, 547 },
- { 608, 577 }, { 609, 578 }, { 610, 579 }, { 19, 19 },
- { 143, 112 }, { 267, 236 }, { 391, 360 }, { 515, 484 },
- { 608, 608 }, { 20, 20 }, { 51, 20 }, { 144, 113 },
- { 175, 144 }, { 268, 237 }, { 299, 268 }, { 392, 361 },
- { 423, 392 }, { 516, 485 }, { 547, 516 }, { 640, 609 },
- { 640, 640 }, { 21, 21 }, { 52, 21 }, { 83, 52 },
- { 145, 114 }, { 176, 145 }, { 207, 176 }, { 269, 238 },
- { 300, 269 }, { 331, 300 }, { 393, 362 }, { 424, 393 },
- { 455, 424 }, { 517, 486 }, { 548, 517 }, { 579, 548 },
- { 641, 610 }, { 672, 641 }, { 672, 672 }, { 22, 22 },
- { 53, 22 }, { 84, 53 }, { 115, 84 }, { 146, 115 },
- { 177, 146 }, { 208, 177 }, { 239, 208 }, { 270, 239 },
- { 301, 270 }, { 332, 301 }, { 363, 332 }, { 394, 363 },
- { 425, 394 }, { 456, 425 }, { 487, 456 }, { 518, 487 },
- { 549, 518 }, { 580, 549 }, { 611, 580 }, { 642, 611 },
- { 673, 642 }, { 704, 673 }, { 704, 704 }, { 54, 23 },
- { 85, 54 }, { 116, 85 }, { 178, 147 }, { 209, 178 },
- { 240, 209 }, { 302, 271 }, { 333, 302 }, { 364, 333 },
- { 426, 395 }, { 457, 426 }, { 488, 457 }, { 550, 519 },
- { 581, 550 }, { 612, 581 }, { 674, 643 }, { 705, 674 },
- { 736, 705 }, { 86, 55 }, { 117, 86 }, { 210, 179 },
- { 241, 210 }, { 334, 303 }, { 365, 334 }, { 458, 427 },
- { 489, 458 }, { 582, 551 }, { 613, 582 }, { 706, 675 },
- { 737, 706 }, { 118, 87 }, { 242, 211 }, { 366, 335 },
- { 490, 459 }, { 614, 583 }, { 738, 707 }, { 23, 23 },
- { 147, 116 }, { 271, 240 }, { 395, 364 }, { 519, 488 },
- { 643, 612 }, { 736, 736 }, { 24, 24 }, { 55, 24 },
- { 148, 117 }, { 179, 148 }, { 272, 241 }, { 303, 272 },
- { 396, 365 }, { 427, 396 }, { 520, 489 }, { 551, 520 },
- { 644, 613 }, { 675, 644 }, { 768, 737 }, { 768, 768 },
- { 25, 25 }, { 56, 25 }, { 87, 56 }, { 149, 118 },
- { 180, 149 }, { 211, 180 }, { 273, 242 }, { 304, 273 },
- { 335, 304 }, { 397, 366 }, { 428, 397 }, { 459, 428 },
- { 521, 490 }, { 552, 521 }, { 583, 552 }, { 645, 614 },
- { 676, 645 }, { 707, 676 }, { 769, 738 }, { 800, 769 },
- { 800, 800 }, { 26, 26 }, { 57, 26 }, { 88, 57 },
- { 119, 88 }, { 150, 119 }, { 181, 150 }, { 212, 181 },
- { 243, 212 }, { 274, 243 }, { 305, 274 }, { 336, 305 },
- { 367, 336 }, { 398, 367 }, { 429, 398 }, { 460, 429 },
- { 491, 460 }, { 522, 491 }, { 553, 522 }, { 584, 553 },
- { 615, 584 }, { 646, 615 }, { 677, 646 }, { 708, 677 },
- { 739, 708 }, { 770, 739 }, { 801, 770 }, { 832, 801 },
- { 832, 832 }, { 58, 27 }, { 89, 58 }, { 120, 89 },
- { 182, 151 }, { 213, 182 }, { 244, 213 }, { 306, 275 },
- { 337, 306 }, { 368, 337 }, { 430, 399 }, { 461, 430 },
- { 492, 461 }, { 554, 523 }, { 585, 554 }, { 616, 585 },
- { 678, 647 }, { 709, 678 }, { 740, 709 }, { 802, 771 },
- { 833, 802 }, { 864, 833 }, { 90, 59 }, { 121, 90 },
- { 214, 183 }, { 245, 214 }, { 338, 307 }, { 369, 338 },
- { 462, 431 }, { 493, 462 }, { 586, 555 }, { 617, 586 },
- { 710, 679 }, { 741, 710 }, { 834, 803 }, { 865, 834 },
- { 122, 91 }, { 246, 215 }, { 370, 339 }, { 494, 463 },
- { 618, 587 }, { 742, 711 }, { 866, 835 }, { 27, 27 },
- { 151, 120 }, { 275, 244 }, { 399, 368 }, { 523, 492 },
- { 647, 616 }, { 771, 740 }, { 864, 864 }, { 28, 28 },
- { 59, 28 }, { 152, 121 }, { 183, 152 }, { 276, 245 },
- { 307, 276 }, { 400, 369 }, { 431, 400 }, { 524, 493 },
- { 555, 524 }, { 648, 617 }, { 679, 648 }, { 772, 741 },
- { 803, 772 }, { 896, 865 }, { 896, 896 }, { 29, 29 },
- { 60, 29 }, { 91, 60 }, { 153, 122 }, { 184, 153 },
- { 215, 184 }, { 277, 246 }, { 308, 277 }, { 339, 308 },
- { 401, 370 }, { 432, 401 }, { 463, 432 }, { 525, 494 },
- { 556, 525 }, { 587, 556 }, { 649, 618 }, { 680, 649 },
- { 711, 680 }, { 773, 742 }, { 804, 773 }, { 835, 804 },
- { 897, 866 }, { 928, 897 }, { 928, 928 }, { 30, 30 },
- { 61, 30 }, { 92, 61 }, { 123, 92 }, { 154, 123 },
- { 185, 154 }, { 216, 185 }, { 247, 216 }, { 278, 247 },
- { 309, 278 }, { 340, 309 }, { 371, 340 }, { 402, 371 },
- { 433, 402 }, { 464, 433 }, { 495, 464 }, { 526, 495 },
- { 557, 526 }, { 588, 557 }, { 619, 588 }, { 650, 619 },
- { 681, 650 }, { 712, 681 }, { 743, 712 }, { 774, 743 },
- { 805, 774 }, { 836, 805 }, { 867, 836 }, { 898, 867 },
- { 929, 898 }, { 960, 929 }, { 960, 960 }, { 62, 31 },
- { 93, 62 }, { 124, 93 }, { 186, 155 }, { 217, 186 },
- { 248, 217 }, { 310, 279 }, { 341, 310 }, { 372, 341 },
- { 434, 403 }, { 465, 434 }, { 496, 465 }, { 558, 527 },
- { 589, 558 }, { 620, 589 }, { 682, 651 }, { 713, 682 },
- { 744, 713 }, { 806, 775 }, { 837, 806 }, { 868, 837 },
- { 930, 899 }, { 961, 930 }, { 992, 961 }, { 94, 63 },
- { 125, 94 }, { 218, 187 }, { 249, 218 }, { 342, 311 },
- { 373, 342 }, { 466, 435 }, { 497, 466 }, { 590, 559 },
- { 621, 590 }, { 714, 683 }, { 745, 714 }, { 838, 807 },
- { 869, 838 }, { 962, 931 }, { 993, 962 }, { 126, 95 },
- { 250, 219 }, { 374, 343 }, { 498, 467 }, { 622, 591 },
- { 746, 715 }, { 870, 839 }, { 994, 963 }, { 155, 124 },
- { 279, 248 }, { 403, 372 }, { 527, 496 }, { 651, 620 },
- { 775, 744 }, { 899, 868 }, { 156, 125 }, { 187, 156 },
- { 280, 249 }, { 311, 280 }, { 404, 373 }, { 435, 404 },
- { 528, 497 }, { 559, 528 }, { 652, 621 }, { 683, 652 },
- { 776, 745 }, { 807, 776 }, { 900, 869 }, { 931, 900 },
- { 157, 126 }, { 188, 157 }, { 219, 188 }, { 281, 250 },
- { 312, 281 }, { 343, 312 }, { 405, 374 }, { 436, 405 },
- { 467, 436 }, { 529, 498 }, { 560, 529 }, { 591, 560 },
- { 653, 622 }, { 684, 653 }, { 715, 684 }, { 777, 746 },
- { 808, 777 }, { 839, 808 }, { 901, 870 }, { 932, 901 },
- { 963, 932 }, { 158, 127 }, { 189, 158 }, { 220, 189 },
- { 251, 220 }, { 282, 251 }, { 313, 282 }, { 344, 313 },
- { 375, 344 }, { 406, 375 }, { 437, 406 }, { 468, 437 },
- { 499, 468 }, { 530, 499 }, { 561, 530 }, { 592, 561 },
- { 623, 592 }, { 654, 623 }, { 685, 654 }, { 716, 685 },
- { 747, 716 }, { 778, 747 }, { 809, 778 }, { 840, 809 },
- { 871, 840 }, { 902, 871 }, { 933, 902 }, { 964, 933 },
- { 995, 964 }, { 190, 159 }, { 221, 190 }, { 252, 221 },
- { 314, 283 }, { 345, 314 }, { 376, 345 }, { 438, 407 },
- { 469, 438 }, { 500, 469 }, { 562, 531 }, { 593, 562 },
- { 624, 593 }, { 686, 655 }, { 717, 686 }, { 748, 717 },
- { 810, 779 }, { 841, 810 }, { 872, 841 }, { 934, 903 },
- { 965, 934 }, { 996, 965 }, { 222, 191 }, { 253, 222 },
- { 346, 315 }, { 377, 346 }, { 470, 439 }, { 501, 470 },
- { 594, 563 }, { 625, 594 }, { 718, 687 }, { 749, 718 },
- { 842, 811 }, { 873, 842 }, { 966, 935 }, { 997, 966 },
- { 254, 223 }, { 378, 347 }, { 502, 471 }, { 626, 595 },
- { 750, 719 }, { 874, 843 }, { 998, 967 }, { 283, 252 },
- { 407, 376 }, { 531, 500 }, { 655, 624 }, { 779, 748 },
- { 903, 872 }, { 284, 253 }, { 315, 284 }, { 408, 377 },
- { 439, 408 }, { 532, 501 }, { 563, 532 }, { 656, 625 },
- { 687, 656 }, { 780, 749 }, { 811, 780 }, { 904, 873 },
- { 935, 904 }, { 285, 254 }, { 316, 285 }, { 347, 316 },
- { 409, 378 }, { 440, 409 }, { 471, 440 }, { 533, 502 },
- { 564, 533 }, { 595, 564 }, { 657, 626 }, { 688, 657 },
- { 719, 688 }, { 781, 750 }, { 812, 781 }, { 843, 812 },
- { 905, 874 }, { 936, 905 }, { 967, 936 }, { 286, 255 },
- { 317, 286 }, { 348, 317 }, { 379, 348 }, { 410, 379 },
- { 441, 410 }, { 472, 441 }, { 503, 472 }, { 534, 503 },
- { 565, 534 }, { 596, 565 }, { 627, 596 }, { 658, 627 },
- { 689, 658 }, { 720, 689 }, { 751, 720 }, { 782, 751 },
- { 813, 782 }, { 844, 813 }, { 875, 844 }, { 906, 875 },
- { 937, 906 }, { 968, 937 }, { 999, 968 }, { 318, 287 },
- { 349, 318 }, { 380, 349 }, { 442, 411 }, { 473, 442 },
- { 504, 473 }, { 566, 535 }, { 597, 566 }, { 628, 597 },
- { 690, 659 }, { 721, 690 }, { 752, 721 }, { 814, 783 },
- { 845, 814 }, { 876, 845 }, { 938, 907 }, { 969, 938 },
- { 1000, 969 }, { 350, 319 }, { 381, 350 }, { 474, 443 },
- { 505, 474 }, { 598, 567 }, { 629, 598 }, { 722, 691 },
- { 753, 722 }, { 846, 815 }, { 877, 846 }, { 970, 939 },
- { 1001, 970 }, { 382, 351 }, { 506, 475 }, { 630, 599 },
- { 754, 723 }, { 878, 847 }, { 1002, 971 }, { 411, 380 },
- { 535, 504 }, { 659, 628 }, { 783, 752 }, { 907, 876 },
- { 412, 381 }, { 443, 412 }, { 536, 505 }, { 567, 536 },
- { 660, 629 }, { 691, 660 }, { 784, 753 }, { 815, 784 },
- { 908, 877 }, { 939, 908 }, { 413, 382 }, { 444, 413 },
- { 475, 444 }, { 537, 506 }, { 568, 537 }, { 599, 568 },
- { 661, 630 }, { 692, 661 }, { 723, 692 }, { 785, 754 },
- { 816, 785 }, { 847, 816 }, { 909, 878 }, { 940, 909 },
- { 971, 940 }, { 414, 383 }, { 445, 414 }, { 476, 445 },
- { 507, 476 }, { 538, 507 }, { 569, 538 }, { 600, 569 },
- { 631, 600 }, { 662, 631 }, { 693, 662 }, { 724, 693 },
- { 755, 724 }, { 786, 755 }, { 817, 786 }, { 848, 817 },
- { 879, 848 }, { 910, 879 }, { 941, 910 }, { 972, 941 },
- { 1003, 972 }, { 446, 415 }, { 477, 446 }, { 508, 477 },
- { 570, 539 }, { 601, 570 }, { 632, 601 }, { 694, 663 },
- { 725, 694 }, { 756, 725 }, { 818, 787 }, { 849, 818 },
- { 880, 849 }, { 942, 911 }, { 973, 942 }, { 1004, 973 },
- { 478, 447 }, { 509, 478 }, { 602, 571 }, { 633, 602 },
- { 726, 695 }, { 757, 726 }, { 850, 819 }, { 881, 850 },
- { 974, 943 }, { 1005, 974 }, { 510, 479 }, { 634, 603 },
- { 758, 727 }, { 882, 851 }, { 1006, 975 }, { 539, 508 },
- { 663, 632 }, { 787, 756 }, { 911, 880 }, { 540, 509 },
- { 571, 540 }, { 664, 633 }, { 695, 664 }, { 788, 757 },
- { 819, 788 }, { 912, 881 }, { 943, 912 }, { 541, 510 },
- { 572, 541 }, { 603, 572 }, { 665, 634 }, { 696, 665 },
- { 727, 696 }, { 789, 758 }, { 820, 789 }, { 851, 820 },
- { 913, 882 }, { 944, 913 }, { 975, 944 }, { 542, 511 },
- { 573, 542 }, { 604, 573 }, { 635, 604 }, { 666, 635 },
- { 697, 666 }, { 728, 697 }, { 759, 728 }, { 790, 759 },
- { 821, 790 }, { 852, 821 }, { 883, 852 }, { 914, 883 },
- { 945, 914 }, { 976, 945 }, { 1007, 976 }, { 574, 543 },
- { 605, 574 }, { 636, 605 }, { 698, 667 }, { 729, 698 },
- { 760, 729 }, { 822, 791 }, { 853, 822 }, { 884, 853 },
- { 946, 915 }, { 977, 946 }, { 1008, 977 }, { 606, 575 },
- { 637, 606 }, { 730, 699 }, { 761, 730 }, { 854, 823 },
- { 885, 854 }, { 978, 947 }, { 1009, 978 }, { 638, 607 },
- { 762, 731 }, { 886, 855 }, { 1010, 979 }, { 667, 636 },
- { 791, 760 }, { 915, 884 }, { 668, 637 }, { 699, 668 },
- { 792, 761 }, { 823, 792 }, { 916, 885 }, { 947, 916 },
- { 669, 638 }, { 700, 669 }, { 731, 700 }, { 793, 762 },
- { 824, 793 }, { 855, 824 }, { 917, 886 }, { 948, 917 },
- { 979, 948 }, { 670, 639 }, { 701, 670 }, { 732, 701 },
- { 763, 732 }, { 794, 763 }, { 825, 794 }, { 856, 825 },
- { 887, 856 }, { 918, 887 }, { 949, 918 }, { 980, 949 },
- { 1011, 980 }, { 702, 671 }, { 733, 702 }, { 764, 733 },
- { 826, 795 }, { 857, 826 }, { 888, 857 }, { 950, 919 },
- { 981, 950 }, { 1012, 981 }, { 734, 703 }, { 765, 734 },
- { 858, 827 }, { 889, 858 }, { 982, 951 }, { 1013, 982 },
- { 766, 735 }, { 890, 859 }, { 1014, 983 }, { 795, 764 },
- { 919, 888 }, { 796, 765 }, { 827, 796 }, { 920, 889 },
- { 951, 920 }, { 797, 766 }, { 828, 797 }, { 859, 828 },
- { 921, 890 }, { 952, 921 }, { 983, 952 }, { 798, 767 },
- { 829, 798 }, { 860, 829 }, { 891, 860 }, { 922, 891 },
- { 953, 922 }, { 984, 953 }, { 1015, 984 }, { 830, 799 },
- { 861, 830 }, { 892, 861 }, { 954, 923 }, { 985, 954 },
- { 1016, 985 }, { 862, 831 }, { 893, 862 }, { 986, 955 },
- { 1017, 986 }, { 894, 863 }, { 1018, 987 }, { 923, 892 },
- { 924, 893 }, { 955, 924 }, { 925, 894 }, { 956, 925 },
- { 987, 956 }, { 926, 895 }, { 957, 926 }, { 988, 957 },
- { 1019, 988 }, { 958, 927 }, { 989, 958 }, { 1020, 989 },
- { 990, 959 }, { 1021, 990 }, { 1022, 991 }, { 0, 0 },
-};
-
-static const int16_t (* const vp9_scans_nb[5][4])[2] = {
- {
- vp9_default_scan_4x4_nb, vp9_col_scan_4x4_nb,
- vp9_row_scan_4x4_nb, vp9_default_scan_4x4_nb
- }, {
- vp9_default_scan_8x8_nb, vp9_col_scan_8x8_nb,
- vp9_row_scan_8x8_nb, vp9_default_scan_8x8_nb
- }, {
- vp9_default_scan_16x16_nb, vp9_col_scan_16x16_nb,
- vp9_row_scan_16x16_nb, vp9_default_scan_16x16_nb
- }, {
- vp9_default_scan_32x32_nb, vp9_default_scan_32x32_nb,
- vp9_default_scan_32x32_nb, vp9_default_scan_32x32_nb
- }, { // lossless
- vp9_default_scan_4x4_nb, vp9_default_scan_4x4_nb,
- vp9_default_scan_4x4_nb, vp9_default_scan_4x4_nb
- }
-};
-
-static const uint8_t vp9_model_pareto8[256][8] = {
- { 6, 86, 128, 11, 87, 42, 91, 52 },
- { 3, 86, 128, 6, 86, 23, 88, 29 },
- { 6, 86, 128, 11, 87, 42, 91, 52 },
- { 9, 86, 129, 17, 88, 61, 94, 76 },
- { 12, 86, 129, 22, 88, 77, 97, 93 },
- { 15, 87, 129, 28, 89, 93, 100, 110 },
- { 17, 87, 129, 33, 90, 105, 103, 123 },
- { 20, 88, 130, 38, 91, 118, 106, 136 },
- { 23, 88, 130, 43, 91, 128, 108, 146 },
- { 26, 89, 131, 48, 92, 139, 111, 156 },
- { 28, 89, 131, 53, 93, 147, 114, 163 },
- { 31, 90, 131, 58, 94, 156, 117, 171 },
- { 34, 90, 131, 62, 94, 163, 119, 177 },
- { 37, 90, 132, 66, 95, 171, 122, 184 },
- { 39, 90, 132, 70, 96, 177, 124, 189 },
- { 42, 91, 132, 75, 97, 183, 127, 194 },
- { 44, 91, 132, 79, 97, 188, 129, 198 },
- { 47, 92, 133, 83, 98, 193, 132, 202 },
- { 49, 92, 133, 86, 99, 197, 134, 205 },
- { 52, 93, 133, 90, 100, 201, 137, 208 },
- { 54, 93, 133, 94, 100, 204, 139, 211 },
- { 57, 94, 134, 98, 101, 208, 142, 214 },
- { 59, 94, 134, 101, 102, 211, 144, 216 },
- { 62, 94, 135, 105, 103, 214, 146, 218 },
- { 64, 94, 135, 108, 103, 216, 148, 220 },
- { 66, 95, 135, 111, 104, 219, 151, 222 },
- { 68, 95, 135, 114, 105, 221, 153, 223 },
- { 71, 96, 136, 117, 106, 224, 155, 225 },
- { 73, 96, 136, 120, 106, 225, 157, 226 },
- { 76, 97, 136, 123, 107, 227, 159, 228 },
- { 78, 97, 136, 126, 108, 229, 160, 229 },
- { 80, 98, 137, 129, 109, 231, 162, 231 },
- { 82, 98, 137, 131, 109, 232, 164, 232 },
- { 84, 98, 138, 134, 110, 234, 166, 233 },
- { 86, 98, 138, 137, 111, 235, 168, 234 },
- { 89, 99, 138, 140, 112, 236, 170, 235 },
- { 91, 99, 138, 142, 112, 237, 171, 235 },
- { 93, 100, 139, 145, 113, 238, 173, 236 },
- { 95, 100, 139, 147, 114, 239, 174, 237 },
- { 97, 101, 140, 149, 115, 240, 176, 238 },
- { 99, 101, 140, 151, 115, 241, 177, 238 },
- { 101, 102, 140, 154, 116, 242, 179, 239 },
- { 103, 102, 140, 156, 117, 242, 180, 239 },
- { 105, 103, 141, 158, 118, 243, 182, 240 },
- { 107, 103, 141, 160, 118, 243, 183, 240 },
- { 109, 104, 141, 162, 119, 244, 185, 241 },
- { 111, 104, 141, 164, 119, 244, 186, 241 },
- { 113, 104, 142, 166, 120, 245, 187, 242 },
- { 114, 104, 142, 168, 121, 245, 188, 242 },
- { 116, 105, 143, 170, 122, 246, 190, 243 },
- { 118, 105, 143, 171, 122, 246, 191, 243 },
- { 120, 106, 143, 173, 123, 247, 192, 244 },
- { 121, 106, 143, 175, 124, 247, 193, 244 },
- { 123, 107, 144, 177, 125, 248, 195, 244 },
- { 125, 107, 144, 178, 125, 248, 196, 244 },
- { 127, 108, 145, 180, 126, 249, 197, 245 },
- { 128, 108, 145, 181, 127, 249, 198, 245 },
- { 130, 109, 145, 183, 128, 249, 199, 245 },
- { 132, 109, 145, 184, 128, 249, 200, 245 },
- { 134, 110, 146, 186, 129, 250, 201, 246 },
- { 135, 110, 146, 187, 130, 250, 202, 246 },
- { 137, 111, 147, 189, 131, 251, 203, 246 },
- { 138, 111, 147, 190, 131, 251, 204, 246 },
- { 140, 112, 147, 192, 132, 251, 205, 247 },
- { 141, 112, 147, 193, 132, 251, 206, 247 },
- { 143, 113, 148, 194, 133, 251, 207, 247 },
- { 144, 113, 148, 195, 134, 251, 207, 247 },
- { 146, 114, 149, 197, 135, 252, 208, 248 },
- { 147, 114, 149, 198, 135, 252, 209, 248 },
- { 149, 115, 149, 199, 136, 252, 210, 248 },
- { 150, 115, 149, 200, 137, 252, 210, 248 },
- { 152, 115, 150, 201, 138, 252, 211, 248 },
- { 153, 115, 150, 202, 138, 252, 212, 248 },
- { 155, 116, 151, 204, 139, 253, 213, 249 },
- { 156, 116, 151, 205, 139, 253, 213, 249 },
- { 158, 117, 151, 206, 140, 253, 214, 249 },
- { 159, 117, 151, 207, 141, 253, 215, 249 },
- { 161, 118, 152, 208, 142, 253, 216, 249 },
- { 162, 118, 152, 209, 142, 253, 216, 249 },
- { 163, 119, 153, 210, 143, 253, 217, 249 },
- { 164, 119, 153, 211, 143, 253, 217, 249 },
- { 166, 120, 153, 212, 144, 254, 218, 250 },
- { 167, 120, 153, 212, 145, 254, 219, 250 },
- { 168, 121, 154, 213, 146, 254, 220, 250 },
- { 169, 121, 154, 214, 146, 254, 220, 250 },
- { 171, 122, 155, 215, 147, 254, 221, 250 },
- { 172, 122, 155, 216, 147, 254, 221, 250 },
- { 173, 123, 155, 217, 148, 254, 222, 250 },
- { 174, 123, 155, 217, 149, 254, 222, 250 },
- { 176, 124, 156, 218, 150, 254, 223, 250 },
- { 177, 124, 156, 219, 150, 254, 223, 250 },
- { 178, 125, 157, 220, 151, 254, 224, 251 },
- { 179, 125, 157, 220, 151, 254, 224, 251 },
- { 180, 126, 157, 221, 152, 254, 225, 251 },
- { 181, 126, 157, 221, 152, 254, 225, 251 },
- { 183, 127, 158, 222, 153, 254, 226, 251 },
- { 184, 127, 158, 223, 154, 254, 226, 251 },
- { 185, 128, 159, 224, 155, 255, 227, 251 },
- { 186, 128, 159, 224, 155, 255, 227, 251 },
- { 187, 129, 160, 225, 156, 255, 228, 251 },
- { 188, 130, 160, 225, 156, 255, 228, 251 },
- { 189, 131, 160, 226, 157, 255, 228, 251 },
- { 190, 131, 160, 226, 158, 255, 228, 251 },
- { 191, 132, 161, 227, 159, 255, 229, 251 },
- { 192, 132, 161, 227, 159, 255, 229, 251 },
- { 193, 133, 162, 228, 160, 255, 230, 252 },
- { 194, 133, 162, 229, 160, 255, 230, 252 },
- { 195, 134, 163, 230, 161, 255, 231, 252 },
- { 196, 134, 163, 230, 161, 255, 231, 252 },
- { 197, 135, 163, 231, 162, 255, 231, 252 },
- { 198, 135, 163, 231, 162, 255, 231, 252 },
- { 199, 136, 164, 232, 163, 255, 232, 252 },
- { 200, 136, 164, 232, 164, 255, 232, 252 },
- { 201, 137, 165, 233, 165, 255, 233, 252 },
- { 201, 137, 165, 233, 165, 255, 233, 252 },
- { 202, 138, 166, 233, 166, 255, 233, 252 },
- { 203, 138, 166, 233, 166, 255, 233, 252 },
- { 204, 139, 166, 234, 167, 255, 234, 252 },
- { 205, 139, 166, 234, 167, 255, 234, 252 },
- { 206, 140, 167, 235, 168, 255, 235, 252 },
- { 206, 140, 167, 235, 168, 255, 235, 252 },
- { 207, 141, 168, 236, 169, 255, 235, 252 },
- { 208, 141, 168, 236, 170, 255, 235, 252 },
- { 209, 142, 169, 237, 171, 255, 236, 252 },
- { 209, 143, 169, 237, 171, 255, 236, 252 },
- { 210, 144, 169, 237, 172, 255, 236, 252 },
- { 211, 144, 169, 237, 172, 255, 236, 252 },
- { 212, 145, 170, 238, 173, 255, 237, 252 },
- { 213, 145, 170, 238, 173, 255, 237, 252 },
- { 214, 146, 171, 239, 174, 255, 237, 253 },
- { 214, 146, 171, 239, 174, 255, 237, 253 },
- { 215, 147, 172, 240, 175, 255, 238, 253 },
- { 215, 147, 172, 240, 175, 255, 238, 253 },
- { 216, 148, 173, 240, 176, 255, 238, 253 },
- { 217, 148, 173, 240, 176, 255, 238, 253 },
- { 218, 149, 173, 241, 177, 255, 239, 253 },
- { 218, 149, 173, 241, 178, 255, 239, 253 },
- { 219, 150, 174, 241, 179, 255, 239, 253 },
- { 219, 151, 174, 241, 179, 255, 239, 253 },
- { 220, 152, 175, 242, 180, 255, 240, 253 },
- { 221, 152, 175, 242, 180, 255, 240, 253 },
- { 222, 153, 176, 242, 181, 255, 240, 253 },
- { 222, 153, 176, 242, 181, 255, 240, 253 },
- { 223, 154, 177, 243, 182, 255, 240, 253 },
- { 223, 154, 177, 243, 182, 255, 240, 253 },
- { 224, 155, 178, 244, 183, 255, 241, 253 },
- { 224, 155, 178, 244, 183, 255, 241, 253 },
- { 225, 156, 178, 244, 184, 255, 241, 253 },
- { 225, 157, 178, 244, 184, 255, 241, 253 },
- { 226, 158, 179, 244, 185, 255, 242, 253 },
- { 227, 158, 179, 244, 185, 255, 242, 253 },
- { 228, 159, 180, 245, 186, 255, 242, 253 },
- { 228, 159, 180, 245, 186, 255, 242, 253 },
- { 229, 160, 181, 245, 187, 255, 242, 253 },
- { 229, 160, 181, 245, 187, 255, 242, 253 },
- { 230, 161, 182, 246, 188, 255, 243, 253 },
- { 230, 162, 182, 246, 188, 255, 243, 253 },
- { 231, 163, 183, 246, 189, 255, 243, 253 },
- { 231, 163, 183, 246, 189, 255, 243, 253 },
- { 232, 164, 184, 247, 190, 255, 243, 253 },
- { 232, 164, 184, 247, 190, 255, 243, 253 },
- { 233, 165, 185, 247, 191, 255, 244, 253 },
- { 233, 165, 185, 247, 191, 255, 244, 253 },
- { 234, 166, 185, 247, 192, 255, 244, 253 },
- { 234, 167, 185, 247, 192, 255, 244, 253 },
- { 235, 168, 186, 248, 193, 255, 244, 253 },
- { 235, 168, 186, 248, 193, 255, 244, 253 },
- { 236, 169, 187, 248, 194, 255, 244, 253 },
- { 236, 169, 187, 248, 194, 255, 244, 253 },
- { 236, 170, 188, 248, 195, 255, 245, 253 },
- { 236, 170, 188, 248, 195, 255, 245, 253 },
- { 237, 171, 189, 249, 196, 255, 245, 254 },
- { 237, 172, 189, 249, 196, 255, 245, 254 },
- { 238, 173, 190, 249, 197, 255, 245, 254 },
- { 238, 173, 190, 249, 197, 255, 245, 254 },
- { 239, 174, 191, 249, 198, 255, 245, 254 },
- { 239, 174, 191, 249, 198, 255, 245, 254 },
- { 240, 175, 192, 249, 199, 255, 246, 254 },
- { 240, 176, 192, 249, 199, 255, 246, 254 },
- { 240, 177, 193, 250, 200, 255, 246, 254 },
- { 240, 177, 193, 250, 200, 255, 246, 254 },
- { 241, 178, 194, 250, 201, 255, 246, 254 },
- { 241, 178, 194, 250, 201, 255, 246, 254 },
- { 242, 179, 195, 250, 202, 255, 246, 254 },
- { 242, 180, 195, 250, 202, 255, 246, 254 },
- { 242, 181, 196, 250, 203, 255, 247, 254 },
- { 242, 181, 196, 250, 203, 255, 247, 254 },
- { 243, 182, 197, 251, 204, 255, 247, 254 },
- { 243, 183, 197, 251, 204, 255, 247, 254 },
- { 244, 184, 198, 251, 205, 255, 247, 254 },
- { 244, 184, 198, 251, 205, 255, 247, 254 },
- { 244, 185, 199, 251, 206, 255, 247, 254 },
- { 244, 185, 199, 251, 206, 255, 247, 254 },
- { 245, 186, 200, 251, 207, 255, 247, 254 },
- { 245, 187, 200, 251, 207, 255, 247, 254 },
- { 246, 188, 201, 252, 207, 255, 248, 254 },
- { 246, 188, 201, 252, 207, 255, 248, 254 },
- { 246, 189, 202, 252, 208, 255, 248, 254 },
- { 246, 190, 202, 252, 208, 255, 248, 254 },
- { 247, 191, 203, 252, 209, 255, 248, 254 },
- { 247, 191, 203, 252, 209, 255, 248, 254 },
- { 247, 192, 204, 252, 210, 255, 248, 254 },
- { 247, 193, 204, 252, 210, 255, 248, 254 },
- { 248, 194, 205, 252, 211, 255, 248, 254 },
- { 248, 194, 205, 252, 211, 255, 248, 254 },
- { 248, 195, 206, 252, 212, 255, 249, 254 },
- { 248, 196, 206, 252, 212, 255, 249, 254 },
- { 249, 197, 207, 253, 213, 255, 249, 254 },
- { 249, 197, 207, 253, 213, 255, 249, 254 },
- { 249, 198, 208, 253, 214, 255, 249, 254 },
- { 249, 199, 209, 253, 214, 255, 249, 254 },
- { 250, 200, 210, 253, 215, 255, 249, 254 },
- { 250, 200, 210, 253, 215, 255, 249, 254 },
- { 250, 201, 211, 253, 215, 255, 249, 254 },
- { 250, 202, 211, 253, 215, 255, 249, 254 },
- { 250, 203, 212, 253, 216, 255, 249, 254 },
- { 250, 203, 212, 253, 216, 255, 249, 254 },
- { 251, 204, 213, 253, 217, 255, 250, 254 },
- { 251, 205, 213, 253, 217, 255, 250, 254 },
- { 251, 206, 214, 254, 218, 255, 250, 254 },
- { 251, 206, 215, 254, 218, 255, 250, 254 },
- { 252, 207, 216, 254, 219, 255, 250, 254 },
- { 252, 208, 216, 254, 219, 255, 250, 254 },
- { 252, 209, 217, 254, 220, 255, 250, 254 },
- { 252, 210, 217, 254, 220, 255, 250, 254 },
- { 252, 211, 218, 254, 221, 255, 250, 254 },
- { 252, 212, 218, 254, 221, 255, 250, 254 },
- { 253, 213, 219, 254, 222, 255, 250, 254 },
- { 253, 213, 220, 254, 222, 255, 250, 254 },
- { 253, 214, 221, 254, 223, 255, 250, 254 },
- { 253, 215, 221, 254, 223, 255, 250, 254 },
- { 253, 216, 222, 254, 224, 255, 251, 254 },
- { 253, 217, 223, 254, 224, 255, 251, 254 },
- { 253, 218, 224, 254, 225, 255, 251, 254 },
- { 253, 219, 224, 254, 225, 255, 251, 254 },
- { 254, 220, 225, 254, 225, 255, 251, 254 },
- { 254, 221, 226, 254, 225, 255, 251, 254 },
- { 254, 222, 227, 255, 226, 255, 251, 254 },
- { 254, 223, 227, 255, 226, 255, 251, 254 },
- { 254, 224, 228, 255, 227, 255, 251, 254 },
- { 254, 225, 229, 255, 227, 255, 251, 254 },
- { 254, 226, 230, 255, 228, 255, 251, 254 },
- { 254, 227, 230, 255, 229, 255, 251, 254 },
- { 255, 228, 231, 255, 230, 255, 251, 254 },
- { 255, 229, 232, 255, 230, 255, 251, 254 },
- { 255, 230, 233, 255, 231, 255, 252, 254 },
- { 255, 231, 234, 255, 231, 255, 252, 254 },
- { 255, 232, 235, 255, 232, 255, 252, 254 },
- { 255, 233, 236, 255, 232, 255, 252, 254 },
- { 255, 235, 237, 255, 233, 255, 252, 254 },
- { 255, 236, 238, 255, 234, 255, 252, 254 },
- { 255, 238, 240, 255, 235, 255, 252, 255 },
- { 255, 239, 241, 255, 235, 255, 252, 254 },
- { 255, 241, 243, 255, 236, 255, 252, 254 },
- { 255, 243, 245, 255, 237, 255, 252, 254 },
- { 255, 246, 247, 255, 239, 255, 253, 255 },
-};
-
-typedef struct {
- uint8_t y_mode[4][9];
- uint8_t uv_mode[10][9];
- uint8_t filter[4][2];
- uint8_t mv_mode[7][3];
- uint8_t intra[4];
- uint8_t comp[5];
- uint8_t single_ref[5][2];
- uint8_t comp_ref[5];
- uint8_t tx32p[2][3];
- uint8_t tx16p[2][2];
- uint8_t tx8p[2];
- uint8_t skip[3];
- uint8_t mv_joint[3];
- struct {
- uint8_t sign;
- uint8_t classes[10];
- uint8_t class0;
- uint8_t bits[10];
- uint8_t class0_fp[2][3];
- uint8_t fp[3];
- uint8_t class0_hp;
- uint8_t hp;
- } mv_comp[2];
- uint8_t partition[4][4][3];
-} prob_context;
-
-static const prob_context vp9_default_probs = {
- { /* y_mode */
- { 65, 32, 18, 144, 162, 194, 41, 51, 98 } /* bsize < 8x8 */,
- { 132, 68, 18, 165, 217, 196, 45, 40, 78 } /* bsize < 16x16 */,
- { 173, 80, 19, 176, 240, 193, 64, 35, 46 } /* bsize < 32x32 */,
- { 221, 135, 38, 194, 248, 121, 96, 85, 29 } /* bsize >= 32x32 */
- }, { /* uv_mode */
- { 48, 12, 154, 155, 139, 90, 34, 117, 119 } /* y = v */,
- { 67, 6, 25, 204, 243, 158, 13, 21, 96 } /* y = h */,
- { 120, 7, 76, 176, 208, 126, 28, 54, 103 } /* y = dc */,
- { 97, 5, 44, 131, 176, 139, 48, 68, 97 } /* y = d45 */,
- { 83, 5, 42, 156, 111, 152, 26, 49, 152 } /* y = d135 */,
- { 80, 5, 58, 178, 74, 83, 33, 62, 145 } /* y = d117 */,
- { 86, 5, 32, 154, 192, 168, 14, 22, 163 } /* y = d153 */,
- { 77, 7, 64, 116, 132, 122, 37, 126, 120 } /* y = d63 */,
- { 85, 5, 32, 156, 216, 148, 19, 29, 73 } /* y = d27 */,
- { 101, 21, 107, 181, 192, 103, 19, 67, 125 } /* y = tm */
- }, { /* filter */
- { 235, 162, },
- { 36, 255, },
- { 34, 3, },
- { 149, 144, },
- }, { /* mv_mode */
- { 2, 173, 34}, // 0 = both zero mv
- { 7, 145, 85}, // 1 = one zero mv + one a predicted mv
- { 7, 166, 63}, // 2 = two predicted mvs
- { 7, 94, 66}, // 3 = one predicted/zero and one new mv
- { 8, 64, 46}, // 4 = two new mvs
- { 17, 81, 31}, // 5 = one intra neighbour + x
- { 25, 29, 30}, // 6 = two intra neighbours
- }, { /* intra */
- 9, 102, 187, 225
- }, { /* comp */
- 239, 183, 119, 96, 41
- }, { /* single_ref */
- { 33, 16 },
- { 77, 74 },
- { 142, 142 },
- { 172, 170 },
- { 238, 247 }
- }, { /* comp_ref */
- 50, 126, 123, 221, 226
- }, { /* tx32p */
- { 3, 136, 37, },
- { 5, 52, 13, },
- }, { /* tx16p */
- { 20, 152, },
- { 15, 101, },
- }, { /* tx8p */
- 100, 66
- }, { /* skip */
- 192, 128, 64
- }, { /* mv_joint */
- 32, 64, 96
- }, {
- { /* mv vertical component */
- 128, /* sign */
- { 224, 144, 192, 168, 192, 176, 192, 198, 198, 245 }, /* class */
- 216, /* class0 */
- { 136, 140, 148, 160, 176, 192, 224, 234, 234, 240}, /* bits */
- { /* class0_fp */
- { 128, 128, 64 },
- { 96, 112, 64 }
- },
- { 64, 96, 64 }, /* fp */
- 160, /* class0_hp bit */
- 128, /* hp */
- }, { /* mv horizontal component */
- 128, /* sign */
- { 216, 128, 176, 160, 176, 176, 192, 198, 198, 208 }, /* class */
- 208, /* class0 */
- { 136, 140, 148, 160, 176, 192, 224, 234, 234, 240 }, /* bits */
- { /* class0_fp */
- { 128, 128, 64 },
- { 96, 112, 64 }
- },
- { 64, 96, 64 }, /* fp */
- 160, /* class0_hp bit */
- 128, /* hp */
- }
- }, { /* partition */
- { /* 64x64 -> 32x32 */
- { 222, 34, 30 } /* a/l both not split */,
- { 72, 16, 44 } /* a split, l not split */,
- { 58, 32, 12 } /* l split, a not split */,
- { 10, 7, 6 } /* a/l both split */,
- }, { /* 32x32 -> 16x16 */
- { 177, 58, 59 } /* a/l both not split */,
- { 68, 26, 63 } /* a split, l not split */,
- { 52, 79, 25 } /* l split, a not split */,
- { 17, 14, 12 } /* a/l both split */,
- }, { /* 16x16 -> 8x8 */
- { 174, 73, 87 } /* a/l both not split */,
- { 92, 41, 83 } /* a split, l not split */,
- { 82, 99, 50 } /* l split, a not split */,
- { 53, 39, 39 } /* a/l both split */,
- }, { /* 8x8 -> 4x4 */
- { 199, 122, 141 } /* a/l both not split */,
- { 147, 63, 159 } /* a split, l not split */,
- { 148, 133, 118 } /* l split, a not split */,
- { 121, 104, 114 } /* a/l both split */,
- }
- },
-};
-
-static const uint8_t vp9_default_coef_probs[4][2][2][6][6][3] = {
- { /* tx = 4x4 */
- { /* block Type 0 */
- { /* Intra */
- { /* Coeff Band 0 */
- { 195, 29, 183 },
- { 84, 49, 136 },
- { 8, 42, 71 }
- }, { /* Coeff Band 1 */
- { 31, 107, 169 },
- { 35, 99, 159 },
- { 17, 82, 140 },
- { 8, 66, 114 },
- { 2, 44, 76 },
- { 1, 19, 32 }
- }, { /* Coeff Band 2 */
- { 40, 132, 201 },
- { 29, 114, 187 },
- { 13, 91, 157 },
- { 7, 75, 127 },
- { 3, 58, 95 },
- { 1, 28, 47 }
- }, { /* Coeff Band 3 */
- { 69, 142, 221 },
- { 42, 122, 201 },
- { 15, 91, 159 },
- { 6, 67, 121 },
- { 1, 42, 77 },
- { 1, 17, 31 }
- }, { /* Coeff Band 4 */
- { 102, 148, 228 },
- { 67, 117, 204 },
- { 17, 82, 154 },
- { 6, 59, 114 },
- { 2, 39, 75 },
- { 1, 15, 29 }
- }, { /* Coeff Band 5 */
- { 156, 57, 233 },
- { 119, 57, 212 },
- { 58, 48, 163 },
- { 29, 40, 124 },
- { 12, 30, 81 },
- { 3, 12, 31 }
- }
- }, { /* Inter */
- { /* Coeff Band 0 */
- { 191, 107, 226 },
- { 124, 117, 204 },
- { 25, 99, 155 }
- }, { /* Coeff Band 1 */
- { 29, 148, 210 },
- { 37, 126, 194 },
- { 8, 93, 157 },
- { 2, 68, 118 },
- { 1, 39, 69 },
- { 1, 17, 33 }
- }, { /* Coeff Band 2 */
- { 41, 151, 213 },
- { 27, 123, 193 },
- { 3, 82, 144 },
- { 1, 58, 105 },
- { 1, 32, 60 },
- { 1, 13, 26 }
- }, { /* Coeff Band 3 */
- { 59, 159, 220 },
- { 23, 126, 198 },
- { 4, 88, 151 },
- { 1, 66, 114 },
- { 1, 38, 71 },
- { 1, 18, 34 }
- }, { /* Coeff Band 4 */
- { 114, 136, 232 },
- { 51, 114, 207 },
- { 11, 83, 155 },
- { 3, 56, 105 },
- { 1, 33, 65 },
- { 1, 17, 34 }
- }, { /* Coeff Band 5 */
- { 149, 65, 234 },
- { 121, 57, 215 },
- { 61, 49, 166 },
- { 28, 36, 114 },
- { 12, 25, 76 },
- { 3, 16, 42 }
- }
- }
- }, { /* block Type 1 */
- { /* Intra */
- { /* Coeff Band 0 */
- { 214, 49, 220 },
- { 132, 63, 188 },
- { 42, 65, 137 }
- }, { /* Coeff Band 1 */
- { 85, 137, 221 },
- { 104, 131, 216 },
- { 49, 111, 192 },
- { 21, 87, 155 },
- { 2, 49, 87 },
- { 1, 16, 28 }
- }, { /* Coeff Band 2 */
- { 89, 163, 230 },
- { 90, 137, 220 },
- { 29, 100, 183 },
- { 10, 70, 135 },
- { 2, 42, 81 },
- { 1, 17, 33 }
- }, { /* Coeff Band 3 */
- { 108, 167, 237 },
- { 55, 133, 222 },
- { 15, 97, 179 },
- { 4, 72, 135 },
- { 1, 45, 85 },
- { 1, 19, 38 }
- }, { /* Coeff Band 4 */
- { 124, 146, 240 },
- { 66, 124, 224 },
- { 17, 88, 175 },
- { 4, 58, 122 },
- { 1, 36, 75 },
- { 1, 18, 37 }
- }, { /* Coeff Band 5 */
- { 141, 79, 241 },
- { 126, 70, 227 },
- { 66, 58, 182 },
- { 30, 44, 136 },
- { 12, 34, 96 },
- { 2, 20, 47 }
- }
- }, { /* Inter */
- { /* Coeff Band 0 */
- { 229, 99, 249 },
- { 143, 111, 235 },
- { 46, 109, 192 }
- }, { /* Coeff Band 1 */
- { 82, 158, 236 },
- { 94, 146, 224 },
- { 25, 117, 191 },
- { 9, 87, 149 },
- { 3, 56, 99 },
- { 1, 33, 57 }
- }, { /* Coeff Band 2 */
- { 83, 167, 237 },
- { 68, 145, 222 },
- { 10, 103, 177 },
- { 2, 72, 131 },
- { 1, 41, 79 },
- { 1, 20, 39 }
- }, { /* Coeff Band 3 */
- { 99, 167, 239 },
- { 47, 141, 224 },
- { 10, 104, 178 },
- { 2, 73, 133 },
- { 1, 44, 85 },
- { 1, 22, 47 }
- }, { /* Coeff Band 4 */
- { 127, 145, 243 },
- { 71, 129, 228 },
- { 17, 93, 177 },
- { 3, 61, 124 },
- { 1, 41, 84 },
- { 1, 21, 52 }
- }, { /* Coeff Band 5 */
- { 157, 78, 244 },
- { 140, 72, 231 },
- { 69, 58, 184 },
- { 31, 44, 137 },
- { 14, 38, 105 },
- { 8, 23, 61 }
- }
- }
- }
- }, { /* tx = 8x8 */
- { /* block Type 0 */
- { /* Intra */
- { /* Coeff Band 0 */
- { 125, 34, 187 },
- { 52, 41, 133 },
- { 6, 31, 56 }
- }, { /* Coeff Band 1 */
- { 37, 109, 153 },
- { 51, 102, 147 },
- { 23, 87, 128 },
- { 8, 67, 101 },
- { 1, 41, 63 },
- { 1, 19, 29 }
- }, { /* Coeff Band 2 */
- { 31, 154, 185 },
- { 17, 127, 175 },
- { 6, 96, 145 },
- { 2, 73, 114 },
- { 1, 51, 82 },
- { 1, 28, 45 }
- }, { /* Coeff Band 3 */
- { 23, 163, 200 },
- { 10, 131, 185 },
- { 2, 93, 148 },
- { 1, 67, 111 },
- { 1, 41, 69 },
- { 1, 14, 24 }
- }, { /* Coeff Band 4 */
- { 29, 176, 217 },
- { 12, 145, 201 },
- { 3, 101, 156 },
- { 1, 69, 111 },
- { 1, 39, 63 },
- { 1, 14, 23 }
- }, { /* Coeff Band 5 */
- { 57, 192, 233 },
- { 25, 154, 215 },
- { 6, 109, 167 },
- { 3, 78, 118 },
- { 1, 48, 69 },
- { 1, 21, 29 }
- }
- }, { /* Inter */
- { /* Coeff Band 0 */
- { 202, 105, 245 },
- { 108, 106, 216 },
- { 18, 90, 144 }
- }, { /* Coeff Band 1 */
- { 33, 172, 219 },
- { 64, 149, 206 },
- { 14, 117, 177 },
- { 5, 90, 141 },
- { 2, 61, 95 },
- { 1, 37, 57 }
- }, { /* Coeff Band 2 */
- { 33, 179, 220 },
- { 11, 140, 198 },
- { 1, 89, 148 },
- { 1, 60, 104 },
- { 1, 33, 57 },
- { 1, 12, 21 }
- }, { /* Coeff Band 3 */
- { 30, 181, 221 },
- { 8, 141, 198 },
- { 1, 87, 145 },
- { 1, 58, 100 },
- { 1, 31, 55 },
- { 1, 12, 20 }
- }, { /* Coeff Band 4 */
- { 32, 186, 224 },
- { 7, 142, 198 },
- { 1, 86, 143 },
- { 1, 58, 100 },
- { 1, 31, 55 },
- { 1, 12, 22 }
- }, { /* Coeff Band 5 */
- { 57, 192, 227 },
- { 20, 143, 204 },
- { 3, 96, 154 },
- { 1, 68, 112 },
- { 1, 42, 69 },
- { 1, 19, 32 }
- }
- }
- }, { /* block Type 1 */
- { /* Intra */
- { /* Coeff Band 0 */
- { 212, 35, 215 },
- { 113, 47, 169 },
- { 29, 48, 105 }
- }, { /* Coeff Band 1 */
- { 74, 129, 203 },
- { 106, 120, 203 },
- { 49, 107, 178 },
- { 19, 84, 144 },
- { 4, 50, 84 },
- { 1, 15, 25 }
- }, { /* Coeff Band 2 */
- { 71, 172, 217 },
- { 44, 141, 209 },
- { 15, 102, 173 },
- { 6, 76, 133 },
- { 2, 51, 89 },
- { 1, 24, 42 }
- }, { /* Coeff Band 3 */
- { 64, 185, 231 },
- { 31, 148, 216 },
- { 8, 103, 175 },
- { 3, 74, 131 },
- { 1, 46, 81 },
- { 1, 18, 30 }
- }, { /* Coeff Band 4 */
- { 65, 196, 235 },
- { 25, 157, 221 },
- { 5, 105, 174 },
- { 1, 67, 120 },
- { 1, 38, 69 },
- { 1, 15, 30 }
- }, { /* Coeff Band 5 */
- { 65, 204, 238 },
- { 30, 156, 224 },
- { 7, 107, 177 },
- { 2, 70, 124 },
- { 1, 42, 73 },
- { 1, 18, 34 }
- }
- }, { /* Inter */
- { /* Coeff Band 0 */
- { 225, 86, 251 },
- { 144, 104, 235 },
- { 42, 99, 181 }
- }, { /* Coeff Band 1 */
- { 85, 175, 239 },
- { 112, 165, 229 },
- { 29, 136, 200 },
- { 12, 103, 162 },
- { 6, 77, 123 },
- { 2, 53, 84 }
- }, { /* Coeff Band 2 */
- { 75, 183, 239 },
- { 30, 155, 221 },
- { 3, 106, 171 },
- { 1, 74, 128 },
- { 1, 44, 76 },
- { 1, 17, 28 }
- }, { /* Coeff Band 3 */
- { 73, 185, 240 },
- { 27, 159, 222 },
- { 2, 107, 172 },
- { 1, 75, 127 },
- { 1, 42, 73 },
- { 1, 17, 29 }
- }, { /* Coeff Band 4 */
- { 62, 190, 238 },
- { 21, 159, 222 },
- { 2, 107, 172 },
- { 1, 72, 122 },
- { 1, 40, 71 },
- { 1, 18, 32 }
- }, { /* Coeff Band 5 */
- { 61, 199, 240 },
- { 27, 161, 226 },
- { 4, 113, 180 },
- { 1, 76, 129 },
- { 1, 46, 80 },
- { 1, 23, 41 }
- }
- }
- }
- }, { /* tx = 16x16 */
- { /* block Type 0 */
- { /* Intra */
- { /* Coeff Band 0 */
- { 7, 27, 153 },
- { 5, 30, 95 },
- { 1, 16, 30 }
- }, { /* Coeff Band 1 */
- { 50, 75, 127 },
- { 57, 75, 124 },
- { 27, 67, 108 },
- { 10, 54, 86 },
- { 1, 33, 52 },
- { 1, 12, 18 }
- }, { /* Coeff Band 2 */
- { 43, 125, 151 },
- { 26, 108, 148 },
- { 7, 83, 122 },
- { 2, 59, 89 },
- { 1, 38, 60 },
- { 1, 17, 27 }
- }, { /* Coeff Band 3 */
- { 23, 144, 163 },
- { 13, 112, 154 },
- { 2, 75, 117 },
- { 1, 50, 81 },
- { 1, 31, 51 },
- { 1, 14, 23 }
- }, { /* Coeff Band 4 */
- { 18, 162, 185 },
- { 6, 123, 171 },
- { 1, 78, 125 },
- { 1, 51, 86 },
- { 1, 31, 54 },
- { 1, 14, 23 }
- }, { /* Coeff Band 5 */
- { 15, 199, 227 },
- { 3, 150, 204 },
- { 1, 91, 146 },
- { 1, 55, 95 },
- { 1, 30, 53 },
- { 1, 11, 20 }
- }
- }, { /* Inter */
- { /* Coeff Band 0 */
- { 19, 55, 240 },
- { 19, 59, 196 },
- { 3, 52, 105 }
- }, { /* Coeff Band 1 */
- { 41, 166, 207 },
- { 104, 153, 199 },
- { 31, 123, 181 },
- { 14, 101, 152 },
- { 5, 72, 106 },
- { 1, 36, 52 }
- }, { /* Coeff Band 2 */
- { 35, 176, 211 },
- { 12, 131, 190 },
- { 2, 88, 144 },
- { 1, 60, 101 },
- { 1, 36, 60 },
- { 1, 16, 28 }
- }, { /* Coeff Band 3 */
- { 28, 183, 213 },
- { 8, 134, 191 },
- { 1, 86, 142 },
- { 1, 56, 96 },
- { 1, 30, 53 },
- { 1, 12, 20 }
- }, { /* Coeff Band 4 */
- { 20, 190, 215 },
- { 4, 135, 192 },
- { 1, 84, 139 },
- { 1, 53, 91 },
- { 1, 28, 49 },
- { 1, 11, 20 }
- }, { /* Coeff Band 5 */
- { 13, 196, 216 },
- { 2, 137, 192 },
- { 1, 86, 143 },
- { 1, 57, 99 },
- { 1, 32, 56 },
- { 1, 13, 24 }
- }
- }
- }, { /* block Type 1 */
- { /* Intra */
- { /* Coeff Band 0 */
- { 211, 29, 217 },
- { 96, 47, 156 },
- { 22, 43, 87 }
- }, { /* Coeff Band 1 */
- { 78, 120, 193 },
- { 111, 116, 186 },
- { 46, 102, 164 },
- { 15, 80, 128 },
- { 2, 49, 76 },
- { 1, 18, 28 }
- }, { /* Coeff Band 2 */
- { 71, 161, 203 },
- { 42, 132, 192 },
- { 10, 98, 150 },
- { 3, 69, 109 },
- { 1, 44, 70 },
- { 1, 18, 29 }
- }, { /* Coeff Band 3 */
- { 57, 186, 211 },
- { 30, 140, 196 },
- { 4, 93, 146 },
- { 1, 62, 102 },
- { 1, 38, 65 },
- { 1, 16, 27 }
- }, { /* Coeff Band 4 */
- { 47, 199, 217 },
- { 14, 145, 196 },
- { 1, 88, 142 },
- { 1, 57, 98 },
- { 1, 36, 62 },
- { 1, 15, 26 }
- }, { /* Coeff Band 5 */
- { 26, 219, 229 },
- { 5, 155, 207 },
- { 1, 94, 151 },
- { 1, 60, 104 },
- { 1, 36, 62 },
- { 1, 16, 28 }
- }
- }, { /* Inter */
- { /* Coeff Band 0 */
- { 233, 29, 248 },
- { 146, 47, 220 },
- { 43, 52, 140 }
- }, { /* Coeff Band 1 */
- { 100, 163, 232 },
- { 179, 161, 222 },
- { 63, 142, 204 },
- { 37, 113, 174 },
- { 26, 89, 137 },
- { 18, 68, 97 }
- }, { /* Coeff Band 2 */
- { 85, 181, 230 },
- { 32, 146, 209 },
- { 7, 100, 164 },
- { 3, 71, 121 },
- { 1, 45, 77 },
- { 1, 18, 30 }
- }, { /* Coeff Band 3 */
- { 65, 187, 230 },
- { 20, 148, 207 },
- { 2, 97, 159 },
- { 1, 68, 116 },
- { 1, 40, 70 },
- { 1, 14, 29 }
- }, { /* Coeff Band 4 */
- { 40, 194, 227 },
- { 8, 147, 204 },
- { 1, 94, 155 },
- { 1, 65, 112 },
- { 1, 39, 66 },
- { 1, 14, 26 }
- }, { /* Coeff Band 5 */
- { 16, 208, 228 },
- { 3, 151, 207 },
- { 1, 98, 160 },
- { 1, 67, 117 },
- { 1, 41, 74 },
- { 1, 17, 31 }
- }
- }
- }
- }, { /* tx = 32x32 */
- { /* block Type 0 */
- { /* Intra */
- { /* Coeff Band 0 */
- { 17, 38, 140 },
- { 7, 34, 80 },
- { 1, 17, 29 }
- }, { /* Coeff Band 1 */
- { 37, 75, 128 },
- { 41, 76, 128 },
- { 26, 66, 116 },
- { 12, 52, 94 },
- { 2, 32, 55 },
- { 1, 10, 16 }
- }, { /* Coeff Band 2 */
- { 50, 127, 154 },
- { 37, 109, 152 },
- { 16, 82, 121 },
- { 5, 59, 85 },
- { 1, 35, 54 },
- { 1, 13, 20 }
- }, { /* Coeff Band 3 */
- { 40, 142, 167 },
- { 17, 110, 157 },
- { 2, 71, 112 },
- { 1, 44, 72 },
- { 1, 27, 45 },
- { 1, 11, 17 }
- }, { /* Coeff Band 4 */
- { 30, 175, 188 },
- { 9, 124, 169 },
- { 1, 74, 116 },
- { 1, 48, 78 },
- { 1, 30, 49 },
- { 1, 11, 18 }
- }, { /* Coeff Band 5 */
- { 10, 222, 223 },
- { 2, 150, 194 },
- { 1, 83, 128 },
- { 1, 48, 79 },
- { 1, 27, 45 },
- { 1, 11, 17 }
- }
- }, { /* Inter */
- { /* Coeff Band 0 */
- { 36, 41, 235 },
- { 29, 36, 193 },
- { 10, 27, 111 }
- }, { /* Coeff Band 1 */
- { 85, 165, 222 },
- { 177, 162, 215 },
- { 110, 135, 195 },
- { 57, 113, 168 },
- { 23, 83, 120 },
- { 10, 49, 61 }
- }, { /* Coeff Band 2 */
- { 85, 190, 223 },
- { 36, 139, 200 },
- { 5, 90, 146 },
- { 1, 60, 103 },
- { 1, 38, 65 },
- { 1, 18, 30 }
- }, { /* Coeff Band 3 */
- { 72, 202, 223 },
- { 23, 141, 199 },
- { 2, 86, 140 },
- { 1, 56, 97 },
- { 1, 36, 61 },
- { 1, 16, 27 }
- }, { /* Coeff Band 4 */
- { 55, 218, 225 },
- { 13, 145, 200 },
- { 1, 86, 141 },
- { 1, 57, 99 },
- { 1, 35, 61 },
- { 1, 13, 22 }
- }, { /* Coeff Band 5 */
- { 15, 235, 212 },
- { 1, 132, 184 },
- { 1, 84, 139 },
- { 1, 57, 97 },
- { 1, 34, 56 },
- { 1, 14, 23 }
- }
- }
- }, { /* block Type 1 */
- { /* Intra */
- { /* Coeff Band 0 */
- { 181, 21, 201 },
- { 61, 37, 123 },
- { 10, 38, 71 }
- }, { /* Coeff Band 1 */
- { 47, 106, 172 },
- { 95, 104, 173 },
- { 42, 93, 159 },
- { 18, 77, 131 },
- { 4, 50, 81 },
- { 1, 17, 23 }
- }, { /* Coeff Band 2 */
- { 62, 147, 199 },
- { 44, 130, 189 },
- { 28, 102, 154 },
- { 18, 75, 115 },
- { 2, 44, 65 },
- { 1, 12, 19 }
- }, { /* Coeff Band 3 */
- { 55, 153, 210 },
- { 24, 130, 194 },
- { 3, 93, 146 },
- { 1, 61, 97 },
- { 1, 31, 50 },
- { 1, 10, 16 }
- }, { /* Coeff Band 4 */
- { 49, 186, 223 },
- { 17, 148, 204 },
- { 1, 96, 142 },
- { 1, 53, 83 },
- { 1, 26, 44 },
- { 1, 11, 17 }
- }, { /* Coeff Band 5 */
- { 13, 217, 212 },
- { 2, 136, 180 },
- { 1, 78, 124 },
- { 1, 50, 83 },
- { 1, 29, 49 },
- { 1, 14, 23 }
- }
- }, { /* Inter */
- { /* Coeff Band 0 */
- { 197, 13, 247 },
- { 82, 17, 222 },
- { 25, 17, 162 }
- }, { /* Coeff Band 1 */
- { 126, 186, 247 },
- { 234, 191, 243 },
- { 176, 177, 234 },
- { 104, 158, 220 },
- { 66, 128, 186 },
- { 55, 90, 137 }
- }, { /* Coeff Band 2 */
- { 111, 197, 242 },
- { 46, 158, 219 },
- { 9, 104, 171 },
- { 2, 65, 125 },
- { 1, 44, 80 },
- { 1, 17, 91 }
- }, { /* Coeff Band 3 */
- { 104, 208, 245 },
- { 39, 168, 224 },
- { 3, 109, 162 },
- { 1, 79, 124 },
- { 1, 50, 102 },
- { 1, 43, 102 }
- }, { /* Coeff Band 4 */
- { 84, 220, 246 },
- { 31, 177, 231 },
- { 2, 115, 180 },
- { 1, 79, 134 },
- { 1, 55, 77 },
- { 1, 60, 79 }
- }, { /* Coeff Band 5 */
- { 43, 243, 240 },
- { 8, 180, 217 },
- { 1, 115, 166 },
- { 1, 84, 121 },
- { 1, 51, 67 },
- { 1, 16, 6 }
- }
- }
- }
- }
-};
-
-enum MVJoint {
- MV_JOINT_ZERO,
- MV_JOINT_H,
- MV_JOINT_V,
- MV_JOINT_HV,
-};
-
-static const int8_t vp9_mv_joint_tree[3][2] = {
- { -MV_JOINT_ZERO, 1 }, // '0'
- { -MV_JOINT_H, 2 }, // '10'
- { -MV_JOINT_V, -MV_JOINT_HV }, // '11x'
-};
-
-static const int8_t vp9_mv_class_tree[10][2] = {
- { -0, 1 }, // '0'
- { -1, 2 }, // '10'
- { 3, 4 },
- { -2, -3 }, // '110x'
- { 5, 6 },
- { -4, -5 }, // '1110x'
- { -6, 7 }, // '11110'
- { 8, 9 },
- { -7, -8 }, // '111110x'
- { -9, -10 }, // '111111x'
-};
-
-static const int8_t vp9_mv_fp_tree[3][2] = {
- { -0, 1 }, // '0'
- { -1, 2 }, // '10'
- { -2, -3 }, // '11x'
-};
+#include "vp9dec.h"
+
+extern const uint8_t ff_vp9_bwh_tab[2][N_BS_SIZES][2];
+extern const int8_t ff_vp9_partition_tree[3][2];
+extern const uint8_t ff_vp9_default_kf_partition_probs[4][4][3];
+extern const int8_t ff_vp9_segmentation_tree[7][2];
+extern const int8_t ff_vp9_intramode_tree[9][2];
+extern const uint8_t ff_vp9_default_kf_ymode_probs[10][10][9];
+extern const uint8_t ff_vp9_default_kf_uvmode_probs[10][9];
+extern const int8_t ff_vp9_inter_mode_tree[3][2];
+extern const int8_t ff_vp9_filter_tree[2][2];
+extern const enum FilterMode ff_vp9_filter_lut[3];
+extern const int16_t ff_vp9_dc_qlookup[3][256];
+extern const int16_t ff_vp9_ac_qlookup[3][256];
+extern const enum TxfmType ff_vp9_intra_txfm_type[14];
+extern const int16_t ff_vp9_default_scan_4x4[16];
+extern const int16_t ff_vp9_col_scan_4x4[16];
+extern const int16_t ff_vp9_row_scan_4x4[16];
+extern const int16_t ff_vp9_default_scan_8x8[64];
+extern const int16_t ff_vp9_col_scan_8x8[64];
+extern const int16_t ff_vp9_row_scan_8x8[64];
+extern const int16_t ff_vp9_default_scan_16x16[256];
+extern const int16_t ff_vp9_col_scan_16x16[256];
+extern const int16_t ff_vp9_row_scan_16x16[256];
+extern const int16_t ff_vp9_default_scan_32x32[1024];
+extern const int16_t * const ff_vp9_scans[5][4];
+extern const int16_t ff_vp9_default_scan_4x4_nb[16][2];
+extern const int16_t ff_vp9_col_scan_4x4_nb[16][2];
+extern const int16_t ff_vp9_row_scan_4x4_nb[16][2];
+extern const int16_t ff_vp9_default_scan_8x8_nb[64][2];
+extern const int16_t ff_vp9_col_scan_8x8_nb[64][2];
+extern const int16_t ff_vp9_row_scan_8x8_nb[64][2];
+extern const int16_t ff_vp9_default_scan_16x16_nb[256][2];
+extern const int16_t ff_vp9_col_scan_16x16_nb[256][2];
+extern const int16_t ff_vp9_row_scan_16x16_nb[256][2];
+extern const int16_t ff_vp9_default_scan_32x32_nb[1024][2];
+extern const int16_t (* const ff_vp9_scans_nb[5][4])[2];
+extern const uint8_t ff_vp9_model_pareto8[256][8];
+extern const ProbContext ff_vp9_default_probs;
+extern const uint8_t ff_vp9_default_coef_probs[4][2][2][6][6][3];
+extern const int8_t ff_vp9_mv_joint_tree[3][2];
+extern const int8_t ff_vp9_mv_class_tree[10][2];
+extern const int8_t ff_vp9_mv_fp_tree[3][2];
#endif /* AVCODEC_VP9DATA_H */
diff --git a/media/ffvpx/libavcodec/vp9dec.h b/media/ffvpx/libavcodec/vp9dec.h
new file mode 100644
index 0000000000..66573edc79
--- /dev/null
+++ b/media/ffvpx/libavcodec/vp9dec.h
@@ -0,0 +1,240 @@
+/*
+ * VP9 compatible video decoder
+ *
+ * Copyright (C) 2013 Ronald S. Bultje <rsbultje gmail com>
+ * Copyright (C) 2013 Clément Bœsch <u pkh me>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_VP9DEC_H
+#define AVCODEC_VP9DEC_H
+
+#include <stddef.h>
+#include <stdint.h>
+#include <stdatomic.h>
+
+#include "libavutil/buffer.h"
+#include "libavutil/thread.h"
+#include "libavutil/internal.h"
+
+#include "vp9.h"
+#include "vp9dsp.h"
+#include "vp9shared.h"
+
+enum MVJoint {
+ MV_JOINT_ZERO,
+ MV_JOINT_H,
+ MV_JOINT_V,
+ MV_JOINT_HV,
+};
+
+typedef struct ProbContext {
+ uint8_t y_mode[4][9];
+ uint8_t uv_mode[10][9];
+ uint8_t filter[4][2];
+ uint8_t mv_mode[7][3];
+ uint8_t intra[4];
+ uint8_t comp[5];
+ uint8_t single_ref[5][2];
+ uint8_t comp_ref[5];
+ uint8_t tx32p[2][3];
+ uint8_t tx16p[2][2];
+ uint8_t tx8p[2];
+ uint8_t skip[3];
+ uint8_t mv_joint[3];
+ struct {
+ uint8_t sign;
+ uint8_t classes[10];
+ uint8_t class0;
+ uint8_t bits[10];
+ uint8_t class0_fp[2][3];
+ uint8_t fp[3];
+ uint8_t class0_hp;
+ uint8_t hp;
+ } mv_comp[2];
+ uint8_t partition[4][4][3];
+} ProbContext;
+
+typedef struct VP9Filter {
+ uint8_t level[8 * 8];
+ uint8_t /* bit=col */ mask[2 /* 0=y, 1=uv */][2 /* 0=col, 1=row */]
+ [8 /* rows */][4 /* 0=16, 1=8, 2=4, 3=inner4 */];
+} VP9Filter;
+
+typedef struct VP9Block {
+ uint8_t seg_id, intra, comp, ref[2], mode[4], uvmode, skip;
+ enum FilterMode filter;
+ VP56mv mv[4 /* b_idx */][2 /* ref */];
+ enum BlockSize bs;
+ enum TxfmMode tx, uvtx;
+ enum BlockLevel bl;
+ enum BlockPartition bp;
+} VP9Block;
+
+typedef struct VP9TileData VP9TileData;
+
+typedef struct VP9Context {
+ VP9SharedContext s;
+ VP9TileData *td;
+
+ VP9DSPContext dsp;
+ VideoDSPContext vdsp;
+ GetBitContext gb;
+ VP56RangeCoder c;
+ int pass, active_tile_cols;
+
+#if HAVE_THREADS
+ pthread_mutex_t progress_mutex;
+ pthread_cond_t progress_cond;
+ atomic_int *entries;
+#endif
+
+ uint8_t ss_h, ss_v;
+ uint8_t last_bpp, bpp_index, bytesperpixel;
+ uint8_t last_keyframe;
+ // sb_cols/rows, rows/cols and last_fmt are used for allocating all internal
+ // arrays, and are thus per-thread. w/h and gf_fmt are synced between threads
+ // and are therefore per-stream. pix_fmt represents the value in the header
+ // of the currently processed frame.
+ int w, h;
+ enum AVPixelFormat pix_fmt, last_fmt, gf_fmt;
+ unsigned sb_cols, sb_rows, rows, cols;
+ ThreadFrame next_refs[8];
+
+ struct {
+ uint8_t lim_lut[64];
+ uint8_t mblim_lut[64];
+ } filter_lut;
+ struct {
+ ProbContext p;
+ uint8_t coef[4][2][2][6][6][3];
+ } prob_ctx[4];
+ struct {
+ ProbContext p;
+ uint8_t coef[4][2][2][6][6][11];
+ } prob;
+
+ // contextual (above) cache
+ uint8_t *above_partition_ctx;
+ uint8_t *above_mode_ctx;
+ // FIXME maybe merge some of the below in a flags field?
+ uint8_t *above_y_nnz_ctx;
+ uint8_t *above_uv_nnz_ctx[2];
+ uint8_t *above_skip_ctx; // 1bit
+ uint8_t *above_txfm_ctx; // 2bit
+ uint8_t *above_segpred_ctx; // 1bit
+ uint8_t *above_intra_ctx; // 1bit
+ uint8_t *above_comp_ctx; // 1bit
+ uint8_t *above_ref_ctx; // 2bit
+ uint8_t *above_filter_ctx;
+ VP56mv (*above_mv_ctx)[2];
+
+ // whole-frame cache
+ uint8_t *intra_pred_data[3];
+ VP9Filter *lflvl;
+
+ // block reconstruction intermediates
+ int block_alloc_using_2pass;
+ uint16_t mvscale[3][2];
+ uint8_t mvstep[3][2];
+} VP9Context;
+
+struct VP9TileData {
+ //VP9Context should be const, but because of the threading API(generates
+ //a lot of warnings) it's not.
+ VP9Context *s;
+ VP56RangeCoder *c_b;
+ VP56RangeCoder *c;
+ int row, row7, col, col7;
+ uint8_t *dst[3];
+ ptrdiff_t y_stride, uv_stride;
+ VP9Block *b_base, *b;
+ unsigned tile_col_start;
+
+ struct {
+ unsigned y_mode[4][10];
+ unsigned uv_mode[10][10];
+ unsigned filter[4][3];
+ unsigned mv_mode[7][4];
+ unsigned intra[4][2];
+ unsigned comp[5][2];
+ unsigned single_ref[5][2][2];
+ unsigned comp_ref[5][2];
+ unsigned tx32p[2][4];
+ unsigned tx16p[2][3];
+ unsigned tx8p[2][2];
+ unsigned skip[3][2];
+ unsigned mv_joint[4];
+ struct {
+ unsigned sign[2];
+ unsigned classes[11];
+ unsigned class0[2];
+ unsigned bits[10][2];
+ unsigned class0_fp[2][4];
+ unsigned fp[4];
+ unsigned class0_hp[2];
+ unsigned hp[2];
+ } mv_comp[2];
+ unsigned partition[4][4][4];
+ unsigned coef[4][2][2][6][6][3];
+ unsigned eob[4][2][2][6][6][2];
+ } counts;
+
+ // whole-frame cache
+ DECLARE_ALIGNED(32, uint8_t, edge_emu_buffer)[135 * 144 * 2];
+
+ // contextual (left) cache
+ DECLARE_ALIGNED(16, uint8_t, left_y_nnz_ctx)[16];
+ DECLARE_ALIGNED(16, uint8_t, left_mode_ctx)[16];
+ DECLARE_ALIGNED(16, VP56mv, left_mv_ctx)[16][2];
+ DECLARE_ALIGNED(16, uint8_t, left_uv_nnz_ctx)[2][16];
+ DECLARE_ALIGNED(8, uint8_t, left_partition_ctx)[8];
+ DECLARE_ALIGNED(8, uint8_t, left_skip_ctx)[8];
+ DECLARE_ALIGNED(8, uint8_t, left_txfm_ctx)[8];
+ DECLARE_ALIGNED(8, uint8_t, left_segpred_ctx)[8];
+ DECLARE_ALIGNED(8, uint8_t, left_intra_ctx)[8];
+ DECLARE_ALIGNED(8, uint8_t, left_comp_ctx)[8];
+ DECLARE_ALIGNED(8, uint8_t, left_ref_ctx)[8];
+ DECLARE_ALIGNED(8, uint8_t, left_filter_ctx)[8];
+ // block reconstruction intermediates
+ DECLARE_ALIGNED(32, uint8_t, tmp_y)[64 * 64 * 2];
+ DECLARE_ALIGNED(32, uint8_t, tmp_uv)[2][64 * 64 * 2];
+ struct { int x, y; } min_mv, max_mv;
+ int16_t *block_base, *block, *uvblock_base[2], *uvblock[2];
+ uint8_t *eob_base, *uveob_base[2], *eob, *uveob[2];
+};
+
+void ff_vp9_fill_mv(VP9TileData *td, VP56mv *mv, int mode, int sb);
+
+void ff_vp9_adapt_probs(VP9Context *s);
+
+void ff_vp9_decode_block(VP9TileData *td, int row, int col,
+ VP9Filter *lflvl, ptrdiff_t yoff, ptrdiff_t uvoff,
+ enum BlockLevel bl, enum BlockPartition bp);
+
+void ff_vp9_loopfilter_sb(AVCodecContext *avctx, VP9Filter *lflvl,
+ int row, int col, ptrdiff_t yoff, ptrdiff_t uvoff);
+
+void ff_vp9_intra_recon_8bpp(VP9TileData *td,
+ ptrdiff_t y_off, ptrdiff_t uv_off);
+void ff_vp9_intra_recon_16bpp(VP9TileData *td,
+ ptrdiff_t y_off, ptrdiff_t uv_off);
+void ff_vp9_inter_recon_8bpp(VP9TileData *td);
+void ff_vp9_inter_recon_16bpp(VP9TileData *td);
+
+#endif /* AVCODEC_VP9DEC_H */
diff --git a/media/ffvpx/libavcodec/vp9dsp.c b/media/ffvpx/libavcodec/vp9dsp.c
index 54e77e267b..f6d73f73cd 100644
--- a/media/ffvpx/libavcodec/vp9dsp.c
+++ b/media/ffvpx/libavcodec/vp9dsp.c
@@ -25,6 +25,62 @@
#include "libavutil/common.h"
#include "vp9dsp.h"
+const DECLARE_ALIGNED(16, int16_t, ff_vp9_subpel_filters)[3][16][8] = {
+ [FILTER_8TAP_REGULAR] = {
+ { 0, 0, 0, 128, 0, 0, 0, 0 },
+ { 0, 1, -5, 126, 8, -3, 1, 0 },
+ { -1, 3, -10, 122, 18, -6, 2, 0 },
+ { -1, 4, -13, 118, 27, -9, 3, -1 },
+ { -1, 4, -16, 112, 37, -11, 4, -1 },
+ { -1, 5, -18, 105, 48, -14, 4, -1 },
+ { -1, 5, -19, 97, 58, -16, 5, -1 },
+ { -1, 6, -19, 88, 68, -18, 5, -1 },
+ { -1, 6, -19, 78, 78, -19, 6, -1 },
+ { -1, 5, -18, 68, 88, -19, 6, -1 },
+ { -1, 5, -16, 58, 97, -19, 5, -1 },
+ { -1, 4, -14, 48, 105, -18, 5, -1 },
+ { -1, 4, -11, 37, 112, -16, 4, -1 },
+ { -1, 3, -9, 27, 118, -13, 4, -1 },
+ { 0, 2, -6, 18, 122, -10, 3, -1 },
+ { 0, 1, -3, 8, 126, -5, 1, 0 },
+ }, [FILTER_8TAP_SHARP] = {
+ { 0, 0, 0, 128, 0, 0, 0, 0 },
+ { -1, 3, -7, 127, 8, -3, 1, 0 },
+ { -2, 5, -13, 125, 17, -6, 3, -1 },
+ { -3, 7, -17, 121, 27, -10, 5, -2 },
+ { -4, 9, -20, 115, 37, -13, 6, -2 },
+ { -4, 10, -23, 108, 48, -16, 8, -3 },
+ { -4, 10, -24, 100, 59, -19, 9, -3 },
+ { -4, 11, -24, 90, 70, -21, 10, -4 },
+ { -4, 11, -23, 80, 80, -23, 11, -4 },
+ { -4, 10, -21, 70, 90, -24, 11, -4 },
+ { -3, 9, -19, 59, 100, -24, 10, -4 },
+ { -3, 8, -16, 48, 108, -23, 10, -4 },
+ { -2, 6, -13, 37, 115, -20, 9, -4 },
+ { -2, 5, -10, 27, 121, -17, 7, -3 },
+ { -1, 3, -6, 17, 125, -13, 5, -2 },
+ { 0, 1, -3, 8, 127, -7, 3, -1 },
+ }, [FILTER_8TAP_SMOOTH] = {
+ { 0, 0, 0, 128, 0, 0, 0, 0 },
+ { -3, -1, 32, 64, 38, 1, -3, 0 },
+ { -2, -2, 29, 63, 41, 2, -3, 0 },
+ { -2, -2, 26, 63, 43, 4, -4, 0 },
+ { -2, -3, 24, 62, 46, 5, -4, 0 },
+ { -2, -3, 21, 60, 49, 7, -4, 0 },
+ { -1, -4, 18, 59, 51, 9, -4, 0 },
+ { -1, -4, 16, 57, 53, 12, -4, -1 },
+ { -1, -4, 14, 55, 55, 14, -4, -1 },
+ { -1, -4, 12, 53, 57, 16, -4, -1 },
+ { 0, -4, 9, 51, 59, 18, -4, -1 },
+ { 0, -4, 7, 49, 60, 21, -3, -2 },
+ { 0, -4, 5, 46, 62, 24, -3, -2 },
+ { 0, -4, 4, 43, 63, 26, -2, -2 },
+ { 0, -3, 2, 41, 63, 29, -2, -2 },
+ { 0, -3, 1, 38, 64, 32, -1, -3 },
+ }
+};
+
+
av_cold void ff_vp9dsp_init(VP9DSPContext *dsp, int bpp, int bitexact)
{
if (bpp == 8) {
@@ -36,6 +92,8 @@ av_cold void ff_vp9dsp_init(VP9DSPContext *dsp, int bpp, int bitexact)
ff_vp9dsp_init_12(dsp);
}
+ if (ARCH_AARCH64) ff_vp9dsp_init_aarch64(dsp, bpp);
+ if (ARCH_ARM) ff_vp9dsp_init_arm(dsp, bpp);
if (ARCH_X86) ff_vp9dsp_init_x86(dsp, bpp, bitexact);
if (ARCH_MIPS) ff_vp9dsp_init_mips(dsp, bpp);
}
diff --git a/media/ffvpx/libavcodec/vp9dsp.h b/media/ffvpx/libavcodec/vp9dsp.h
index 733f5bfc4d..e2256316a8 100644
--- a/media/ffvpx/libavcodec/vp9dsp.h
+++ b/media/ffvpx/libavcodec/vp9dsp.h
@@ -27,7 +27,7 @@
#include <stddef.h>
#include <stdint.h>
-#include "vp9.h"
+#include "libavcodec/vp9.h"
typedef void (*vp9_mc_func)(uint8_t *dst, ptrdiff_t dst_stride,
const uint8_t *ref, ptrdiff_t ref_stride,
@@ -111,21 +111,25 @@ typedef struct VP9DSPContext {
*
* dst/stride are aligned by hsize
*/
- vp9_mc_func mc[5][4][2][2][2];
+ vp9_mc_func mc[5][N_FILTERS][2][2][2];
/*
* for scalable MC, first 3 dimensions identical to above, the other two
* don't exist since it changes per stepsize.
*/
- vp9_scaled_mc_func smc[5][4][2];
+ vp9_scaled_mc_func smc[5][N_FILTERS][2];
} VP9DSPContext;
+extern const int16_t ff_vp9_subpel_filters[3][16][8];
+
void ff_vp9dsp_init(VP9DSPContext *dsp, int bpp, int bitexact);
void ff_vp9dsp_init_8(VP9DSPContext *dsp);
void ff_vp9dsp_init_10(VP9DSPContext *dsp);
void ff_vp9dsp_init_12(VP9DSPContext *dsp);
+void ff_vp9dsp_init_aarch64(VP9DSPContext *dsp, int bpp);
+void ff_vp9dsp_init_arm(VP9DSPContext *dsp, int bpp);
void ff_vp9dsp_init_x86(VP9DSPContext *dsp, int bpp, int bitexact);
void ff_vp9dsp_init_mips(VP9DSPContext *dsp, int bpp);
diff --git a/media/ffvpx/libavcodec/vp9dsp_template.c b/media/ffvpx/libavcodec/vp9dsp_template.c
index 4d810fec3a..bb54561a60 100644
--- a/media/ffvpx/libavcodec/vp9dsp_template.c
+++ b/media/ffvpx/libavcodec/vp9dsp_template.c
@@ -1991,61 +1991,6 @@ copy_avg_fn(4)
#endif /* BIT_DEPTH != 12 */
-static const int16_t vp9_subpel_filters[3][16][8] = {
- [FILTER_8TAP_REGULAR] = {
- { 0, 0, 0, 128, 0, 0, 0, 0 },
- { 0, 1, -5, 126, 8, -3, 1, 0 },
- { -1, 3, -10, 122, 18, -6, 2, 0 },
- { -1, 4, -13, 118, 27, -9, 3, -1 },
- { -1, 4, -16, 112, 37, -11, 4, -1 },
- { -1, 5, -18, 105, 48, -14, 4, -1 },
- { -1, 5, -19, 97, 58, -16, 5, -1 },
- { -1, 6, -19, 88, 68, -18, 5, -1 },
- { -1, 6, -19, 78, 78, -19, 6, -1 },
- { -1, 5, -18, 68, 88, -19, 6, -1 },
- { -1, 5, -16, 58, 97, -19, 5, -1 },
- { -1, 4, -14, 48, 105, -18, 5, -1 },
- { -1, 4, -11, 37, 112, -16, 4, -1 },
- { -1, 3, -9, 27, 118, -13, 4, -1 },
- { 0, 2, -6, 18, 122, -10, 3, -1 },
- { 0, 1, -3, 8, 126, -5, 1, 0 },
- }, [FILTER_8TAP_SHARP] = {
- { 0, 0, 0, 128, 0, 0, 0, 0 },
- { -1, 3, -7, 127, 8, -3, 1, 0 },
- { -2, 5, -13, 125, 17, -6, 3, -1 },
- { -3, 7, -17, 121, 27, -10, 5, -2 },
- { -4, 9, -20, 115, 37, -13, 6, -2 },
- { -4, 10, -23, 108, 48, -16, 8, -3 },
- { -4, 10, -24, 100, 59, -19, 9, -3 },
- { -4, 11, -24, 90, 70, -21, 10, -4 },
- { -4, 11, -23, 80, 80, -23, 11, -4 },
- { -4, 10, -21, 70, 90, -24, 11, -4 },
- { -3, 9, -19, 59, 100, -24, 10, -4 },
- { -3, 8, -16, 48, 108, -23, 10, -4 },
- { -2, 6, -13, 37, 115, -20, 9, -4 },
- { -2, 5, -10, 27, 121, -17, 7, -3 },
- { -1, 3, -6, 17, 125, -13, 5, -2 },
- { 0, 1, -3, 8, 127, -7, 3, -1 },
- }, [FILTER_8TAP_SMOOTH] = {
- { 0, 0, 0, 128, 0, 0, 0, 0 },
- { -3, -1, 32, 64, 38, 1, -3, 0 },
- { -2, -2, 29, 63, 41, 2, -3, 0 },
- { -2, -2, 26, 63, 43, 4, -4, 0 },
- { -2, -3, 24, 62, 46, 5, -4, 0 },
- { -2, -3, 21, 60, 49, 7, -4, 0 },
- { -1, -4, 18, 59, 51, 9, -4, 0 },
- { -1, -4, 16, 57, 53, 12, -4, -1 },
- { -1, -4, 14, 55, 55, 14, -4, -1 },
- { -1, -4, 12, 53, 57, 16, -4, -1 },
- { 0, -4, 9, 51, 59, 18, -4, -1 },
- { 0, -4, 7, 49, 60, 21, -3, -2 },
- { 0, -4, 5, 46, 62, 24, -3, -2 },
- { 0, -4, 4, 43, 63, 26, -2, -2 },
- { 0, -3, 2, 41, 63, 29, -2, -2 },
- { 0, -3, 1, 38, 64, 32, -1, -3 },
- }
-};
-
#define FILTER_8TAP(src, x, F, stride) \
av_clip_pixel((F[0] * src[x + -3 * stride] + \
F[1] * src[x + -2 * stride] + \
@@ -2155,7 +2100,7 @@ static void avg##_8tap_##type##_##sz##dir##_c(uint8_t *dst, ptrdiff_t dst_stride
int h, int mx, int my) \
{ \
avg##_8tap_1d_##dir##_c(dst, dst_stride, src, src_stride, sz, h, \
- vp9_subpel_filters[type_idx][dir_m]); \
+ ff_vp9_subpel_filters[type_idx][dir_m]); \
}
#define filter_fn_2d(sz, type, type_idx, avg) \
@@ -2164,8 +2109,8 @@ static void avg##_8tap_##type##_##sz##hv_c(uint8_t *dst, ptrdiff_t dst_stride, \
int h, int mx, int my) \
{ \
avg##_8tap_2d_hv_c(dst, dst_stride, src, src_stride, sz, h, \
- vp9_subpel_filters[type_idx][mx], \
- vp9_subpel_filters[type_idx][my]); \
+ ff_vp9_subpel_filters[type_idx][mx], \
+ ff_vp9_subpel_filters[type_idx][my]); \
}
#if BIT_DEPTH != 12
@@ -2454,7 +2399,7 @@ static void avg##_scaled_##type##_##sz##_c(uint8_t *dst, ptrdiff_t dst_stride, \
int h, int mx, int my, int dx, int dy) \
{ \
avg##_scaled_8tap_c(dst, dst_stride, src, src_stride, sz, h, mx, my, dx, dy, \
- vp9_subpel_filters[type_idx]); \
+ ff_vp9_subpel_filters[type_idx]); \
}
#if BIT_DEPTH != 12
diff --git a/media/ffvpx/libavcodec/vp9lpf.c b/media/ffvpx/libavcodec/vp9lpf.c
new file mode 100644
index 0000000000..414cede852
--- /dev/null
+++ b/media/ffvpx/libavcodec/vp9lpf.c
@@ -0,0 +1,202 @@
+/*
+ * VP9 compatible video decoder
+ *
+ * Copyright (C) 2013 Ronald S. Bultje <rsbultje gmail com>
+ * Copyright (C) 2013 Clément Bœsch <u pkh me>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "vp9dec.h"
+
+static av_always_inline void filter_plane_cols(VP9Context *s, int col, int ss_h, int ss_v,
+ uint8_t *lvl, uint8_t (*mask)[4],
+ uint8_t *dst, ptrdiff_t ls)
+{
+ int y, x, bytesperpixel = s->bytesperpixel;
+
+ // filter edges between columns (e.g. block1 | block2)
+ for (y = 0; y < 8; y += 2 << ss_v, dst += 16 * ls, lvl += 16 << ss_v) {
+ uint8_t *ptr = dst, *l = lvl, *hmask1 = mask[y], *hmask2 = mask[y + 1 + ss_v];
+ unsigned hm1 = hmask1[0] | hmask1[1] | hmask1[2], hm13 = hmask1[3];
+ unsigned hm2 = hmask2[1] | hmask2[2], hm23 = hmask2[3];
+ unsigned hm = hm1 | hm2 | hm13 | hm23;
+
+ for (x = 1; hm & ~(x - 1); x <<= 1, ptr += 8 * bytesperpixel >> ss_h) {
+ if (col || x > 1) {
+ if (hm1 & x) {
+ int L = *l, H = L >> 4;
+ int E = s->filter_lut.mblim_lut[L], I = s->filter_lut.lim_lut[L];
+
+ if (hmask1[0] & x) {
+ if (hmask2[0] & x) {
+ av_assert2(l[8 << ss_v] == L);
+ s->dsp.loop_filter_16[0](ptr, ls, E, I, H);
+ } else {
+ s->dsp.loop_filter_8[2][0](ptr, ls, E, I, H);
+ }
+ } else if (hm2 & x) {
+ L = l[8 << ss_v];
+ H |= (L >> 4) << 8;
+ E |= s->filter_lut.mblim_lut[L] << 8;
+ I |= s->filter_lut.lim_lut[L] << 8;
+ s->dsp.loop_filter_mix2[!!(hmask1[1] & x)]
+ [!!(hmask2[1] & x)]
+ [0](ptr, ls, E, I, H);
+ } else {
+ s->dsp.loop_filter_8[!!(hmask1[1] & x)]
+ [0](ptr, ls, E, I, H);
+ }
+ } else if (hm2 & x) {
+ int L = l[8 << ss_v], H = L >> 4;
+ int E = s->filter_lut.mblim_lut[L], I = s->filter_lut.lim_lut[L];
+
+ s->dsp.loop_filter_8[!!(hmask2[1] & x)]
+ [0](ptr + 8 * ls, ls, E, I, H);
+ }
+ }
+ if (ss_h) {
+ if (x & 0xAA)
+ l += 2;
+ } else {
+ if (hm13 & x) {
+ int L = *l, H = L >> 4;
+ int E = s->filter_lut.mblim_lut[L], I = s->filter_lut.lim_lut[L];
+
+ if (hm23 & x) {
+ L = l[8 << ss_v];
+ H |= (L >> 4) << 8;
+ E |= s->filter_lut.mblim_lut[L] << 8;
+ I |= s->filter_lut.lim_lut[L] << 8;
+ s->dsp.loop_filter_mix2[0][0][0](ptr + 4 * bytesperpixel, ls, E, I, H);
+ } else {
+ s->dsp.loop_filter_8[0][0](ptr + 4 * bytesperpixel, ls, E, I, H);
+ }
+ } else if (hm23 & x) {
+ int L = l[8 << ss_v], H = L >> 4;
+ int E = s->filter_lut.mblim_lut[L], I = s->filter_lut.lim_lut[L];
+
+ s->dsp.loop_filter_8[0][0](ptr + 8 * ls + 4 * bytesperpixel, ls, E, I, H);
+ }
+ l++;
+ }
+ }
+ }
+}
+
+static av_always_inline void filter_plane_rows(VP9Context *s, int row, int ss_h, int ss_v,
+ uint8_t *lvl, uint8_t (*mask)[4],
+ uint8_t *dst, ptrdiff_t ls)
+{
+ int y, x, bytesperpixel = s->bytesperpixel;
+
+ // block1
+ // filter edges between rows (e.g. ------)
+ // block2
+ for (y = 0; y < 8; y++, dst += 8 * ls >> ss_v) {
+ uint8_t *ptr = dst, *l = lvl, *vmask = mask[y];
+ unsigned vm = vmask[0] | vmask[1] | vmask[2], vm3 = vmask[3];
+
+ for (x = 1; vm & ~(x - 1); x <<= (2 << ss_h), ptr += 16 * bytesperpixel, l += 2 << ss_h) {
+ if (row || y) {
+ if (vm & x) {
+ int L = *l, H = L >> 4;
+ int E = s->filter_lut.mblim_lut[L], I = s->filter_lut.lim_lut[L];
+
+ if (vmask[0] & x) {
+ if (vmask[0] & (x << (1 + ss_h))) {
+ av_assert2(l[1 + ss_h] == L);
+ s->dsp.loop_filter_16[1](ptr, ls, E, I, H);
+ } else {
+ s->dsp.loop_filter_8[2][1](ptr, ls, E, I, H);
+ }
+ } else if (vm & (x << (1 + ss_h))) {
+ L = l[1 + ss_h];
+ H |= (L >> 4) << 8;
+ E |= s->filter_lut.mblim_lut[L] << 8;
+ I |= s->filter_lut.lim_lut[L] << 8;
+ s->dsp.loop_filter_mix2[!!(vmask[1] & x)]
+ [!!(vmask[1] & (x << (1 + ss_h)))]
+ [1](ptr, ls, E, I, H);
+ } else {
+ s->dsp.loop_filter_8[!!(vmask[1] & x)]
+ [1](ptr, ls, E, I, H);
+ }
+ } else if (vm & (x << (1 + ss_h))) {
+ int L = l[1 + ss_h], H = L >> 4;
+ int E = s->filter_lut.mblim_lut[L], I = s->filter_lut.lim_lut[L];
+
+ s->dsp.loop_filter_8[!!(vmask[1] & (x << (1 + ss_h)))]
+ [1](ptr + 8 * bytesperpixel, ls, E, I, H);
+ }
+ }
+ if (!ss_v) {
+ if (vm3 & x) {
+ int L = *l, H = L >> 4;
+ int E = s->filter_lut.mblim_lut[L], I = s->filter_lut.lim_lut[L];
+
+ if (vm3 & (x << (1 + ss_h))) {
+ L = l[1 + ss_h];
+ H |= (L >> 4) << 8;
+ E |= s->filter_lut.mblim_lut[L] << 8;
+ I |= s->filter_lut.lim_lut[L] << 8;
+ s->dsp.loop_filter_mix2[0][0][1](ptr + ls * 4, ls, E, I, H);
+ } else {
+ s->dsp.loop_filter_8[0][1](ptr + ls * 4, ls, E, I, H);
+ }
+ } else if (vm3 & (x << (1 + ss_h))) {
+ int L = l[1 + ss_h], H = L >> 4;
+ int E = s->filter_lut.mblim_lut[L], I = s->filter_lut.lim_lut[L];
+
+ s->dsp.loop_filter_8[0][1](ptr + ls * 4 + 8 * bytesperpixel, ls, E, I, H);
+ }
+ }
+ }
+ if (ss_v) {
+ if (y & 1)
+ lvl += 16;
+ } else {
+ lvl += 8;
+ }
+ }
+}
+
+void ff_vp9_loopfilter_sb(AVCodecContext *avctx, VP9Filter *lflvl,
+ int row, int col, ptrdiff_t yoff, ptrdiff_t uvoff)
+{
+ VP9Context *s = avctx->priv_data;
+ AVFrame *f = s->s.frames[CUR_FRAME].tf.f;
+ uint8_t *dst = f->data[0] + yoff;
+ ptrdiff_t ls_y = f->linesize[0], ls_uv = f->linesize[1];
+ uint8_t (*uv_masks)[8][4] = lflvl->mask[s->ss_h | s->ss_v];
+ int p;
+
+ /* FIXME: In how far can we interleave the v/h loopfilter calls? E.g.
+ * if you think of them as acting on a 8x8 block max, we can interleave
+ * each v/h within the single x loop, but that only works if we work on
+ * 8 pixel blocks, and we won't always do that (we want at least 16px
+ * to use SSE2 optimizations, perhaps 32 for AVX2) */
+
+ filter_plane_cols(s, col, 0, 0, lflvl->level, lflvl->mask[0][0], dst, ls_y);
+ filter_plane_rows(s, row, 0, 0, lflvl->level, lflvl->mask[0][1], dst, ls_y);
+
+ for (p = 0; p < 2; p++) {
+ dst = f->data[1 + p] + uvoff;
+ filter_plane_cols(s, col, s->ss_h, s->ss_v, lflvl->level, uv_masks[0], dst, ls_uv);
+ filter_plane_rows(s, row, s->ss_h, s->ss_v, lflvl->level, uv_masks[1], dst, ls_uv);
+ }
+}
diff --git a/media/ffvpx/libavcodec/vp9mvs.c b/media/ffvpx/libavcodec/vp9mvs.c
new file mode 100644
index 0000000000..88db1c341c
--- /dev/null
+++ b/media/ffvpx/libavcodec/vp9mvs.c
@@ -0,0 +1,364 @@
+/*
+ * VP9 compatible video decoder
+ *
+ * Copyright (C) 2013 Ronald S. Bultje <rsbultje gmail com>
+ * Copyright (C) 2013 Clément Bœsch <u pkh me>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "internal.h"
+#include "vp56.h"
+#include "vp9.h"
+#include "vp9data.h"
+#include "vp9dec.h"
+
+static av_always_inline void clamp_mv(VP56mv *dst, const VP56mv *src,
+ VP9TileData *td)
+{
+ dst->x = av_clip(src->x, td->min_mv.x, td->max_mv.x);
+ dst->y = av_clip(src->y, td->min_mv.y, td->max_mv.y);
+}
+
+static void find_ref_mvs(VP9TileData *td,
+ VP56mv *pmv, int ref, int z, int idx, int sb)
+{
+ static const int8_t mv_ref_blk_off[N_BS_SIZES][8][2] = {
+ [BS_64x64] = { { 3, -1 }, { -1, 3 }, { 4, -1 }, { -1, 4 },
+ { -1, -1 }, { 0, -1 }, { -1, 0 }, { 6, -1 } },
+ [BS_64x32] = { { 0, -1 }, { -1, 0 }, { 4, -1 }, { -1, 2 },
+ { -1, -1 }, { 0, -3 }, { -3, 0 }, { 2, -1 } },
+ [BS_32x64] = { { -1, 0 }, { 0, -1 }, { -1, 4 }, { 2, -1 },
+ { -1, -1 }, { -3, 0 }, { 0, -3 }, { -1, 2 } },
+ [BS_32x32] = { { 1, -1 }, { -1, 1 }, { 2, -1 }, { -1, 2 },
+ { -1, -1 }, { 0, -3 }, { -3, 0 }, { -3, -3 } },
+ [BS_32x16] = { { 0, -1 }, { -1, 0 }, { 2, -1 }, { -1, -1 },
+ { -1, 1 }, { 0, -3 }, { -3, 0 }, { -3, -3 } },
+ [BS_16x32] = { { -1, 0 }, { 0, -1 }, { -1, 2 }, { -1, -1 },
+ { 1, -1 }, { -3, 0 }, { 0, -3 }, { -3, -3 } },
+ [BS_16x16] = { { 0, -1 }, { -1, 0 }, { 1, -1 }, { -1, 1 },
+ { -1, -1 }, { 0, -3 }, { -3, 0 }, { -3, -3 } },
+ [BS_16x8] = { { 0, -1 }, { -1, 0 }, { 1, -1 }, { -1, -1 },
+ { 0, -2 }, { -2, 0 }, { -2, -1 }, { -1, -2 } },
+ [BS_8x16] = { { -1, 0 }, { 0, -1 }, { -1, 1 }, { -1, -1 },
+ { -2, 0 }, { 0, -2 }, { -1, -2 }, { -2, -1 } },
+ [BS_8x8] = { { 0, -1 }, { -1, 0 }, { -1, -1 }, { 0, -2 },
+ { -2, 0 }, { -1, -2 }, { -2, -1 }, { -2, -2 } },
+ [BS_8x4] = { { 0, -1 }, { -1, 0 }, { -1, -1 }, { 0, -2 },
+ { -2, 0 }, { -1, -2 }, { -2, -1 }, { -2, -2 } },
+ [BS_4x8] = { { 0, -1 }, { -1, 0 }, { -1, -1 }, { 0, -2 },
+ { -2, 0 }, { -1, -2 }, { -2, -1 }, { -2, -2 } },
+ [BS_4x4] = { { 0, -1 }, { -1, 0 }, { -1, -1 }, { 0, -2 },
+ { -2, 0 }, { -1, -2 }, { -2, -1 }, { -2, -2 } },
+ };
+ VP9Context *s = td->s;
+ VP9Block *b = td->b;
+ int row = td->row, col = td->col, row7 = td->row7;
+ const int8_t (*p)[2] = mv_ref_blk_off[b->bs];
+#define INVALID_MV 0x80008000U
+ uint32_t mem = INVALID_MV, mem_sub8x8 = INVALID_MV;
+ int i;
+
+#define RETURN_DIRECT_MV(mv) \
+ do { \
+ uint32_t m = AV_RN32A(&mv); \
+ if (!idx) { \
+ AV_WN32A(pmv, m); \
+ return; \
+ } else if (mem == INVALID_MV) { \
+ mem = m; \
+ } else if (m != mem) { \
+ AV_WN32A(pmv, m); \
+ return; \
+ } \
+ } while (0)
+
+ if (sb >= 0) {
+ if (sb == 2 || sb == 1) {
+ RETURN_DIRECT_MV(b->mv[0][z]);
+ } else if (sb == 3) {
+ RETURN_DIRECT_MV(b->mv[2][z]);
+ RETURN_DIRECT_MV(b->mv[1][z]);
+ RETURN_DIRECT_MV(b->mv[0][z]);
+ }
+
+#define RETURN_MV(mv) \
+ do { \
+ if (sb > 0) { \
+ VP56mv tmp; \
+ uint32_t m; \
+ av_assert2(idx == 1); \
+ av_assert2(mem != INVALID_MV); \
+ if (mem_sub8x8 == INVALID_MV) { \
+ clamp_mv(&tmp, &mv, td); \
+ m = AV_RN32A(&tmp); \
+ if (m != mem) { \
+ AV_WN32A(pmv, m); \
+ return; \
+ } \
+ mem_sub8x8 = AV_RN32A(&mv); \
+ } else if (mem_sub8x8 != AV_RN32A(&mv)) { \
+ clamp_mv(&tmp, &mv, td); \
+ m = AV_RN32A(&tmp); \
+ if (m != mem) { \
+ AV_WN32A(pmv, m); \
+ } else { \
+ /* BUG I'm pretty sure this isn't the intention */ \
+ AV_WN32A(pmv, 0); \
+ } \
+ return; \
+ } \
+ } else { \
+ uint32_t m = AV_RN32A(&mv); \
+ if (!idx) { \
+ clamp_mv(pmv, &mv, td); \
+ return; \
+ } else if (mem == INVALID_MV) { \
+ mem = m; \
+ } else if (m != mem) { \
+ clamp_mv(pmv, &mv, td); \
+ return; \
+ } \
+ } \
+ } while (0)
+
+ if (row > 0) {
+ VP9mvrefPair *mv = &s->s.frames[CUR_FRAME].mv[(row - 1) * s->sb_cols * 8 + col];
+ if (mv->ref[0] == ref)
+ RETURN_MV(s->above_mv_ctx[2 * col + (sb & 1)][0]);
+ else if (mv->ref[1] == ref)
+ RETURN_MV(s->above_mv_ctx[2 * col + (sb & 1)][1]);
+ }
+ if (col > td->tile_col_start) {
+ VP9mvrefPair *mv = &s->s.frames[CUR_FRAME].mv[row * s->sb_cols * 8 + col - 1];
+ if (mv->ref[0] == ref)
+ RETURN_MV(td->left_mv_ctx[2 * row7 + (sb >> 1)][0]);
+ else if (mv->ref[1] == ref)
+ RETURN_MV(td->left_mv_ctx[2 * row7 + (sb >> 1)][1]);
+ }
+ i = 2;
+ } else {
+ i = 0;
+ }
+
+ // previously coded MVs in this neighborhood, using same reference frame
+ for (; i < 8; i++) {
+ int c = p[i][0] + col, r = p[i][1] + row;
+
+ if (c >= td->tile_col_start && c < s->cols &&
+ r >= 0 && r < s->rows) {
+ VP9mvrefPair *mv = &s->s.frames[CUR_FRAME].mv[r * s->sb_cols * 8 + c];
+
+ if (mv->ref[0] == ref)
+ RETURN_MV(mv->mv[0]);
+ else if (mv->ref[1] == ref)
+ RETURN_MV(mv->mv[1]);
+ }
+ }
+
+ // MV at this position in previous frame, using same reference frame
+ if (s->s.h.use_last_frame_mvs) {
+ VP9mvrefPair *mv = &s->s.frames[REF_FRAME_MVPAIR].mv[row * s->sb_cols * 8 + col];
+
+ if (!s->s.frames[REF_FRAME_MVPAIR].uses_2pass)
+ ff_thread_await_progress(&s->s.frames[REF_FRAME_MVPAIR].tf, row >> 3, 0);
+ if (mv->ref[0] == ref)
+ RETURN_MV(mv->mv[0]);
+ else if (mv->ref[1] == ref)
+ RETURN_MV(mv->mv[1]);
+ }
+
+#define RETURN_SCALE_MV(mv, scale) \
+ do { \
+ if (scale) { \
+ VP56mv mv_temp = { -mv.x, -mv.y }; \
+ RETURN_MV(mv_temp); \
+ } else { \
+ RETURN_MV(mv); \
+ } \
+ } while (0)
+
+ // previously coded MVs in this neighborhood, using different reference frame
+ for (i = 0; i < 8; i++) {
+ int c = p[i][0] + col, r = p[i][1] + row;
+
+ if (c >= td->tile_col_start && c < s->cols && r >= 0 && r < s->rows) {
+ VP9mvrefPair *mv = &s->s.frames[CUR_FRAME].mv[r * s->sb_cols * 8 + c];
+
+ if (mv->ref[0] != ref && mv->ref[0] >= 0)
+ RETURN_SCALE_MV(mv->mv[0],
+ s->s.h.signbias[mv->ref[0]] != s->s.h.signbias[ref]);
+ if (mv->ref[1] != ref && mv->ref[1] >= 0 &&
+ // BUG - libvpx has this condition regardless of whether
+ // we used the first ref MV and pre-scaling
+ AV_RN32A(&mv->mv[0]) != AV_RN32A(&mv->mv[1])) {
+ RETURN_SCALE_MV(mv->mv[1], s->s.h.signbias[mv->ref[1]] != s->s.h.signbias[ref]);
+ }
+ }
+ }
+
+ // MV at this position in previous frame, using different reference frame
+ if (s->s.h.use_last_frame_mvs) {
+ VP9mvrefPair *mv = &s->s.frames[REF_FRAME_MVPAIR].mv[row * s->sb_cols * 8 + col];
+
+ // no need to await_progress, because we already did that above
+ if (mv->ref[0] != ref && mv->ref[0] >= 0)
+ RETURN_SCALE_MV(mv->mv[0], s->s.h.signbias[mv->ref[0]] != s->s.h.signbias[ref]);
+ if (mv->ref[1] != ref && mv->ref[1] >= 0 &&
+ // BUG - libvpx has this condition regardless of whether
+ // we used the first ref MV and pre-scaling
+ AV_RN32A(&mv->mv[0]) != AV_RN32A(&mv->mv[1])) {
+ RETURN_SCALE_MV(mv->mv[1], s->s.h.signbias[mv->ref[1]] != s->s.h.signbias[ref]);
+ }
+ }
+
+ AV_ZERO32(pmv);
+ clamp_mv(pmv, pmv, td);
+#undef INVALID_MV
+#undef RETURN_MV
+#undef RETURN_SCALE_MV
+}
+
+static av_always_inline int read_mv_component(VP9TileData *td, int idx, int hp)
+{
+ VP9Context *s = td->s;
+ int bit, sign = vp56_rac_get_prob(td->c, s->prob.p.mv_comp[idx].sign);
+ int n, c = vp8_rac_get_tree(td->c, ff_vp9_mv_class_tree,
+ s->prob.p.mv_comp[idx].classes);
+
+ td->counts.mv_comp[idx].sign[sign]++;
+ td->counts.mv_comp[idx].classes[c]++;
+ if (c) {
+ int m;
+
+ for (n = 0, m = 0; m < c; m++) {
+ bit = vp56_rac_get_prob(td->c, s->prob.p.mv_comp[idx].bits[m]);
+ n |= bit << m;
+ td->counts.mv_comp[idx].bits[m][bit]++;
+ }
+ n <<= 3;
+ bit = vp8_rac_get_tree(td->c, ff_vp9_mv_fp_tree,
+ s->prob.p.mv_comp[idx].fp);
+ n |= bit << 1;
+ td->counts.mv_comp[idx].fp[bit]++;
+ if (hp) {
+ bit = vp56_rac_get_prob(td->c, s->prob.p.mv_comp[idx].hp);
+ td->counts.mv_comp[idx].hp[bit]++;
+ n |= bit;
+ } else {
+ n |= 1;
+ // bug in libvpx - we count for bw entropy purposes even if the
+ // bit wasn't coded
+ td->counts.mv_comp[idx].hp[1]++;
+ }
+ n += 8 << c;
+ } else {
+ n = vp56_rac_get_prob(td->c, s->prob.p.mv_comp[idx].class0);
+ td->counts.mv_comp[idx].class0[n]++;
+ bit = vp8_rac_get_tree(td->c, ff_vp9_mv_fp_tree,
+ s->prob.p.mv_comp[idx].class0_fp[n]);
+ td->counts.mv_comp[idx].class0_fp[n][bit]++;
+ n = (n << 3) | (bit << 1);
+ if (hp) {
+ bit = vp56_rac_get_prob(td->c, s->prob.p.mv_comp[idx].class0_hp);
+ td->counts.mv_comp[idx].class0_hp[bit]++;
+ n |= bit;
+ } else {
+ n |= 1;
+ // bug in libvpx - we count for bw entropy purposes even if the
+ // bit wasn't coded
+ td->counts.mv_comp[idx].class0_hp[1]++;
+ }
+ }
+
+ return sign ? -(n + 1) : (n + 1);
+}
+
+void ff_vp9_fill_mv(VP9TileData *td, VP56mv *mv, int mode, int sb)
+{
+ VP9Context *s = td->s;
+ VP9Block *b = td->b;
+
+ if (mode == ZEROMV) {
+ AV_ZERO64(mv);
+ } else {
+ int hp;
+
+ // FIXME cache this value and reuse for other subblocks
+ find_ref_mvs(td, &mv[0], b->ref[0], 0, mode == NEARMV,
+ mode == NEWMV ? -1 : sb);
+ // FIXME maybe move this code into find_ref_mvs()
+ if ((mode == NEWMV || sb == -1) &&
+ !(hp = s->s.h.highprecisionmvs &&
+ abs(mv[0].x) < 64 && abs(mv[0].y) < 64)) {
+ if (mv[0].y & 1) {
+ if (mv[0].y < 0)
+ mv[0].y++;
+ else
+ mv[0].y--;
+ }
+ if (mv[0].x & 1) {
+ if (mv[0].x < 0)
+ mv[0].x++;
+ else
+ mv[0].x--;
+ }
+ }
+ if (mode == NEWMV) {
+ enum MVJoint j = vp8_rac_get_tree(td->c, ff_vp9_mv_joint_tree,
+ s->prob.p.mv_joint);
+
+ td->counts.mv_joint[j]++;
+ if (j >= MV_JOINT_V)
+ mv[0].y += read_mv_component(td, 0, hp);
+ if (j & 1)
+ mv[0].x += read_mv_component(td, 1, hp);
+ }
+
+ if (b->comp) {
+ // FIXME cache this value and reuse for other subblocks
+ find_ref_mvs(td, &mv[1], b->ref[1], 1, mode == NEARMV,
+ mode == NEWMV ? -1 : sb);
+ if ((mode == NEWMV || sb == -1) &&
+ !(hp = s->s.h.highprecisionmvs &&
+ abs(mv[1].x) < 64 && abs(mv[1].y) < 64)) {
+ if (mv[1].y & 1) {
+ if (mv[1].y < 0)
+ mv[1].y++;
+ else
+ mv[1].y--;
+ }
+ if (mv[1].x & 1) {
+ if (mv[1].x < 0)
+ mv[1].x++;
+ else
+ mv[1].x--;
+ }
+ }
+ if (mode == NEWMV) {
+ enum MVJoint j = vp8_rac_get_tree(td->c, ff_vp9_mv_joint_tree,
+ s->prob.p.mv_joint);
+
+ td->counts.mv_joint[j]++;
+ if (j >= MV_JOINT_V)
+ mv[1].y += read_mv_component(td, 0, hp);
+ if (j & 1)
+ mv[1].x += read_mv_component(td, 1, hp);
+ }
+ }
+ }
+}
diff --git a/media/ffvpx/libavcodec/vp9prob.c b/media/ffvpx/libavcodec/vp9prob.c
new file mode 100644
index 0000000000..fb295b482d
--- /dev/null
+++ b/media/ffvpx/libavcodec/vp9prob.c
@@ -0,0 +1,274 @@
+/*
+ * VP9 compatible video decoder
+ *
+ * Copyright (C) 2013 Ronald S. Bultje <rsbultje gmail com>
+ * Copyright (C) 2013 Clément Bœsch <u pkh me>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "vp56.h"
+#include "vp9.h"
+#include "vp9data.h"
+#include "vp9dec.h"
+
+static av_always_inline void adapt_prob(uint8_t *p, unsigned ct0, unsigned ct1,
+ int max_count, int update_factor)
+{
+ unsigned ct = ct0 + ct1, p2, p1;
+
+ if (!ct)
+ return;
+
+ update_factor = FASTDIV(update_factor * FFMIN(ct, max_count), max_count);
+ p1 = *p;
+ p2 = ((((int64_t) ct0) << 8) + (ct >> 1)) / ct;
+ p2 = av_clip(p2, 1, 255);
+
+ // (p1 * (256 - update_factor) + p2 * update_factor + 128) >> 8
+ *p = p1 + (((p2 - p1) * update_factor + 128) >> 8);
+}
+
+void ff_vp9_adapt_probs(VP9Context *s)
+{
+ int i, j, k, l, m;
+ ProbContext *p = &s->prob_ctx[s->s.h.framectxid].p;
+ int uf = (s->s.h.keyframe || s->s.h.intraonly || !s->last_keyframe) ? 112 : 128;
+
+ // coefficients
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 2; j++)
+ for (k = 0; k < 2; k++)
+ for (l = 0; l < 6; l++)
+ for (m = 0; m < 6; m++) {
+ uint8_t *pp = s->prob_ctx[s->s.h.framectxid].coef[i][j][k][l][m];
+ unsigned *e = s->td[0].counts.eob[i][j][k][l][m];
+ unsigned *c = s->td[0].counts.coef[i][j][k][l][m];
+
+ if (l == 0 && m >= 3) // dc only has 3 pt
+ break;
+
+ adapt_prob(&pp[0], e[0], e[1], 24, uf);
+ adapt_prob(&pp[1], c[0], c[1] + c[2], 24, uf);
+ adapt_prob(&pp[2], c[1], c[2], 24, uf);
+ }
+
+ if (s->s.h.keyframe || s->s.h.intraonly) {
+ memcpy(p->skip, s->prob.p.skip, sizeof(p->skip));
+ memcpy(p->tx32p, s->prob.p.tx32p, sizeof(p->tx32p));
+ memcpy(p->tx16p, s->prob.p.tx16p, sizeof(p->tx16p));
+ memcpy(p->tx8p, s->prob.p.tx8p, sizeof(p->tx8p));
+ return;
+ }
+
+ // skip flag
+ for (i = 0; i < 3; i++)
+ adapt_prob(&p->skip[i], s->td[0].counts.skip[i][0],
+ s->td[0].counts.skip[i][1], 20, 128);
+
+ // intra/inter flag
+ for (i = 0; i < 4; i++)
+ adapt_prob(&p->intra[i], s->td[0].counts.intra[i][0],
+ s->td[0].counts.intra[i][1], 20, 128);
+
+ // comppred flag
+ if (s->s.h.comppredmode == PRED_SWITCHABLE) {
+ for (i = 0; i < 5; i++)
+ adapt_prob(&p->comp[i], s->td[0].counts.comp[i][0],
+ s->td[0].counts.comp[i][1], 20, 128);
+ }
+
+ // reference frames
+ if (s->s.h.comppredmode != PRED_SINGLEREF) {
+ for (i = 0; i < 5; i++)
+ adapt_prob(&p->comp_ref[i], s->td[0].counts.comp_ref[i][0],
+ s->td[0].counts.comp_ref[i][1], 20, 128);
+ }
+
+ if (s->s.h.comppredmode != PRED_COMPREF) {
+ for (i = 0; i < 5; i++) {
+ uint8_t *pp = p->single_ref[i];
+ unsigned (*c)[2] = s->td[0].counts.single_ref[i];
+
+ adapt_prob(&pp[0], c[0][0], c[0][1], 20, 128);
+ adapt_prob(&pp[1], c[1][0], c[1][1], 20, 128);
+ }
+ }
+
+ // block partitioning
+ for (i = 0; i < 4; i++)
+ for (j = 0; j < 4; j++) {
+ uint8_t *pp = p->partition[i][j];
+ unsigned *c = s->td[0].counts.partition[i][j];
+
+ adapt_prob(&pp[0], c[0], c[1] + c[2] + c[3], 20, 128);
+ adapt_prob(&pp[1], c[1], c[2] + c[3], 20, 128);
+ adapt_prob(&pp[2], c[2], c[3], 20, 128);
+ }
+
+ // tx size
+ if (s->s.h.txfmmode == TX_SWITCHABLE) {
+ for (i = 0; i < 2; i++) {
+ unsigned *c16 = s->td[0].counts.tx16p[i], *c32 = s->td[0].counts.tx32p[i];
+
+ adapt_prob(&p->tx8p[i], s->td[0].counts.tx8p[i][0],
+ s->td[0].counts.tx8p[i][1], 20, 128);
+ adapt_prob(&p->tx16p[i][0], c16[0], c16[1] + c16[2], 20, 128);
+ adapt_prob(&p->tx16p[i][1], c16[1], c16[2], 20, 128);
+ adapt_prob(&p->tx32p[i][0], c32[0], c32[1] + c32[2] + c32[3], 20, 128);
+ adapt_prob(&p->tx32p[i][1], c32[1], c32[2] + c32[3], 20, 128);
+ adapt_prob(&p->tx32p[i][2], c32[2], c32[3], 20, 128);
+ }
+ }
+
+ // interpolation filter
+ if (s->s.h.filtermode == FILTER_SWITCHABLE) {
+ for (i = 0; i < 4; i++) {
+ uint8_t *pp = p->filter[i];
+ unsigned *c = s->td[0].counts.filter[i];
+
+ adapt_prob(&pp[0], c[0], c[1] + c[2], 20, 128);
+ adapt_prob(&pp[1], c[1], c[2], 20, 128);
+ }
+ }
+
+ // inter modes
+ for (i = 0; i < 7; i++) {
+ uint8_t *pp = p->mv_mode[i];
+ unsigned *c = s->td[0].counts.mv_mode[i];
+
+ adapt_prob(&pp[0], c[2], c[1] + c[0] + c[3], 20, 128);
+ adapt_prob(&pp[1], c[0], c[1] + c[3], 20, 128);
+ adapt_prob(&pp[2], c[1], c[3], 20, 128);
+ }
+
+ // mv joints
+ {
+ uint8_t *pp = p->mv_joint;
+ unsigned *c = s->td[0].counts.mv_joint;
+
+ adapt_prob(&pp[0], c[0], c[1] + c[2] + c[3], 20, 128);
+ adapt_prob(&pp[1], c[1], c[2] + c[3], 20, 128);
+ adapt_prob(&pp[2], c[2], c[3], 20, 128);
+ }
+
+ // mv components
+ for (i = 0; i < 2; i++) {
+ uint8_t *pp;
+ unsigned *c, (*c2)[2], sum;
+
+ adapt_prob(&p->mv_comp[i].sign, s->td[0].counts.mv_comp[i].sign[0],
+ s->td[0].counts.mv_comp[i].sign[1], 20, 128);
+
+ pp = p->mv_comp[i].classes;
+ c = s->td[0].counts.mv_comp[i].classes;
+ sum = c[1] + c[2] + c[3] + c[4] + c[5] +
+ c[6] + c[7] + c[8] + c[9] + c[10];
+ adapt_prob(&pp[0], c[0], sum, 20, 128);
+ sum -= c[1];
+ adapt_prob(&pp[1], c[1], sum, 20, 128);
+ sum -= c[2] + c[3];
+ adapt_prob(&pp[2], c[2] + c[3], sum, 20, 128);
+ adapt_prob(&pp[3], c[2], c[3], 20, 128);
+ sum -= c[4] + c[5];
+ adapt_prob(&pp[4], c[4] + c[5], sum, 20, 128);
+ adapt_prob(&pp[5], c[4], c[5], 20, 128);
+ sum -= c[6];
+ adapt_prob(&pp[6], c[6], sum, 20, 128);
+ adapt_prob(&pp[7], c[7] + c[8], c[9] + c[10], 20, 128);
+ adapt_prob(&pp[8], c[7], c[8], 20, 128);
+ adapt_prob(&pp[9], c[9], c[10], 20, 128);
+
+ adapt_prob(&p->mv_comp[i].class0, s->td[0].counts.mv_comp[i].class0[0],
+ s->td[0].counts.mv_comp[i].class0[1], 20, 128);
+ pp = p->mv_comp[i].bits;
+ c2 = s->td[0].counts.mv_comp[i].bits;
+ for (j = 0; j < 10; j++)
+ adapt_prob(&pp[j], c2[j][0], c2[j][1], 20, 128);
+
+ for (j = 0; j < 2; j++) {
+ pp = p->mv_comp[i].class0_fp[j];
+ c = s->td[0].counts.mv_comp[i].class0_fp[j];
+ adapt_prob(&pp[0], c[0], c[1] + c[2] + c[3], 20, 128);
+ adapt_prob(&pp[1], c[1], c[2] + c[3], 20, 128);
+ adapt_prob(&pp[2], c[2], c[3], 20, 128);
+ }
+ pp = p->mv_comp[i].fp;
+ c = s->td[0].counts.mv_comp[i].fp;
+ adapt_prob(&pp[0], c[0], c[1] + c[2] + c[3], 20, 128);
+ adapt_prob(&pp[1], c[1], c[2] + c[3], 20, 128);
+ adapt_prob(&pp[2], c[2], c[3], 20, 128);
+
+ if (s->s.h.highprecisionmvs) {
+ adapt_prob(&p->mv_comp[i].class0_hp,
+ s->td[0].counts.mv_comp[i].class0_hp[0],
+ s->td[0].counts.mv_comp[i].class0_hp[1], 20, 128);
+ adapt_prob(&p->mv_comp[i].hp, s->td[0].counts.mv_comp[i].hp[0],
+ s->td[0].counts.mv_comp[i].hp[1], 20, 128);
+ }
+ }
+
+ // y intra modes
+ for (i = 0; i < 4; i++) {
+ uint8_t *pp = p->y_mode[i];
+ unsigned *c = s->td[0].counts.y_mode[i], sum, s2;
+
+ sum = c[0] + c[1] + c[3] + c[4] + c[5] + c[6] + c[7] + c[8] + c[9];
+ adapt_prob(&pp[0], c[DC_PRED], sum, 20, 128);
+ sum -= c[TM_VP8_PRED];
+ adapt_prob(&pp[1], c[TM_VP8_PRED], sum, 20, 128);
+ sum -= c[VERT_PRED];
+ adapt_prob(&pp[2], c[VERT_PRED], sum, 20, 128);
+ s2 = c[HOR_PRED] + c[DIAG_DOWN_RIGHT_PRED] + c[VERT_RIGHT_PRED];
+ sum -= s2;
+ adapt_prob(&pp[3], s2, sum, 20, 128);
+ s2 -= c[HOR_PRED];
+ adapt_prob(&pp[4], c[HOR_PRED], s2, 20, 128);
+ adapt_prob(&pp[5], c[DIAG_DOWN_RIGHT_PRED], c[VERT_RIGHT_PRED],
+ 20, 128);
+ sum -= c[DIAG_DOWN_LEFT_PRED];
+ adapt_prob(&pp[6], c[DIAG_DOWN_LEFT_PRED], sum, 20, 128);
+ sum -= c[VERT_LEFT_PRED];
+ adapt_prob(&pp[7], c[VERT_LEFT_PRED], sum, 20, 128);
+ adapt_prob(&pp[8], c[HOR_DOWN_PRED], c[HOR_UP_PRED], 20, 128);
+ }
+
+ // uv intra modes
+ for (i = 0; i < 10; i++) {
+ uint8_t *pp = p->uv_mode[i];
+ unsigned *c = s->td[0].counts.uv_mode[i], sum, s2;
+
+ sum = c[0] + c[1] + c[3] + c[4] + c[5] + c[6] + c[7] + c[8] + c[9];
+ adapt_prob(&pp[0], c[DC_PRED], sum, 20, 128);
+ sum -= c[TM_VP8_PRED];
+ adapt_prob(&pp[1], c[TM_VP8_PRED], sum, 20, 128);
+ sum -= c[VERT_PRED];
+ adapt_prob(&pp[2], c[VERT_PRED], sum, 20, 128);
+ s2 = c[HOR_PRED] + c[DIAG_DOWN_RIGHT_PRED] + c[VERT_RIGHT_PRED];
+ sum -= s2;
+ adapt_prob(&pp[3], s2, sum, 20, 128);
+ s2 -= c[HOR_PRED];
+ adapt_prob(&pp[4], c[HOR_PRED], s2, 20, 128);
+ adapt_prob(&pp[5], c[DIAG_DOWN_RIGHT_PRED], c[VERT_RIGHT_PRED],
+ 20, 128);
+ sum -= c[DIAG_DOWN_LEFT_PRED];
+ adapt_prob(&pp[6], c[DIAG_DOWN_LEFT_PRED], sum, 20, 128);
+ sum -= c[VERT_LEFT_PRED];
+ adapt_prob(&pp[7], c[VERT_LEFT_PRED], sum, 20, 128);
+ adapt_prob(&pp[8], c[HOR_DOWN_PRED], c[HOR_UP_PRED], 20, 128);
+ }
+}
diff --git a/media/ffvpx/libavcodec/vp9recon.c b/media/ffvpx/libavcodec/vp9recon.c
new file mode 100644
index 0000000000..49bb04e1f4
--- /dev/null
+++ b/media/ffvpx/libavcodec/vp9recon.c
@@ -0,0 +1,644 @@
+/*
+ * VP9 compatible video decoder
+ *
+ * Copyright (C) 2013 Ronald S. Bultje <rsbultje gmail com>
+ * Copyright (C) 2013 Clément Bœsch <u pkh me>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/avassert.h"
+
+#include "avcodec.h"
+#include "internal.h"
+#include "videodsp.h"
+#include "vp9data.h"
+#include "vp9dec.h"
+
+static av_always_inline int check_intra_mode(VP9TileData *td, int mode, uint8_t **a,
+ uint8_t *dst_edge, ptrdiff_t stride_edge,
+ uint8_t *dst_inner, ptrdiff_t stride_inner,
+ uint8_t *l, int col, int x, int w,
+ int row, int y, enum TxfmMode tx,
+ int p, int ss_h, int ss_v, int bytesperpixel)
+{
+ VP9Context *s = td->s;
+ int have_top = row > 0 || y > 0;
+ int have_left = col > td->tile_col_start || x > 0;
+ int have_right = x < w - 1;
+ int bpp = s->s.h.bpp;
+ static const uint8_t mode_conv[10][2 /* have_left */][2 /* have_top */] = {
+ [VERT_PRED] = { { DC_127_PRED, VERT_PRED },
+ { DC_127_PRED, VERT_PRED } },
+ [HOR_PRED] = { { DC_129_PRED, DC_129_PRED },
+ { HOR_PRED, HOR_PRED } },
+ [DC_PRED] = { { DC_128_PRED, TOP_DC_PRED },
+ { LEFT_DC_PRED, DC_PRED } },
+ [DIAG_DOWN_LEFT_PRED] = { { DC_127_PRED, DIAG_DOWN_LEFT_PRED },
+ { DC_127_PRED, DIAG_DOWN_LEFT_PRED } },
+ [DIAG_DOWN_RIGHT_PRED] = { { DIAG_DOWN_RIGHT_PRED, DIAG_DOWN_RIGHT_PRED },
+ { DIAG_DOWN_RIGHT_PRED, DIAG_DOWN_RIGHT_PRED } },
+ [VERT_RIGHT_PRED] = { { VERT_RIGHT_PRED, VERT_RIGHT_PRED },
+ { VERT_RIGHT_PRED, VERT_RIGHT_PRED } },
+ [HOR_DOWN_PRED] = { { HOR_DOWN_PRED, HOR_DOWN_PRED },
+ { HOR_DOWN_PRED, HOR_DOWN_PRED } },
+ [VERT_LEFT_PRED] = { { DC_127_PRED, VERT_LEFT_PRED },
+ { DC_127_PRED, VERT_LEFT_PRED } },
+ [HOR_UP_PRED] = { { DC_129_PRED, DC_129_PRED },
+ { HOR_UP_PRED, HOR_UP_PRED } },
+ [TM_VP8_PRED] = { { DC_129_PRED, VERT_PRED },
+ { HOR_PRED, TM_VP8_PRED } },
+ };
+ static const struct {
+ uint8_t needs_left:1;
+ uint8_t needs_top:1;
+ uint8_t needs_topleft:1;
+ uint8_t needs_topright:1;
+ uint8_t invert_left:1;
+ } edges[N_INTRA_PRED_MODES] = {
+ [VERT_PRED] = { .needs_top = 1 },
+ [HOR_PRED] = { .needs_left = 1 },
+ [DC_PRED] = { .needs_top = 1, .needs_left = 1 },
+ [DIAG_DOWN_LEFT_PRED] = { .needs_top = 1, .needs_topright = 1 },
+ [DIAG_DOWN_RIGHT_PRED] = { .needs_left = 1, .needs_top = 1,
+ .needs_topleft = 1 },
+ [VERT_RIGHT_PRED] = { .needs_left = 1, .needs_top = 1,
+ .needs_topleft = 1 },
+ [HOR_DOWN_PRED] = { .needs_left = 1, .needs_top = 1,
+ .needs_topleft = 1 },
+ [VERT_LEFT_PRED] = { .needs_top = 1, .needs_topright = 1 },
+ [HOR_UP_PRED] = { .needs_left = 1, .invert_left = 1 },
+ [TM_VP8_PRED] = { .needs_left = 1, .needs_top = 1,
+ .needs_topleft = 1 },
+ [LEFT_DC_PRED] = { .needs_left = 1 },
+ [TOP_DC_PRED] = { .needs_top = 1 },
+ [DC_128_PRED] = { 0 },
+ [DC_127_PRED] = { 0 },
+ [DC_129_PRED] = { 0 }
+ };
+
+ av_assert2(mode >= 0 && mode < 10);
+ mode = mode_conv[mode][have_left][have_top];
+ if (edges[mode].needs_top) {
+ uint8_t *top, *topleft;
+ int n_px_need = 4 << tx, n_px_have = (((s->cols - col) << !ss_h) - x) * 4;
+ int n_px_need_tr = 0;
+
+ if (tx == TX_4X4 && edges[mode].needs_topright && have_right)
+ n_px_need_tr = 4;
+
+ // if top of sb64-row, use s->intra_pred_data[] instead of
+ // dst[-stride] for intra prediction (it contains pre- instead of
+ // post-loopfilter data)
+ if (have_top) {
+ top = !(row & 7) && !y ?
+ s->intra_pred_data[p] + (col * (8 >> ss_h) + x * 4) * bytesperpixel :
+ y == 0 ? &dst_edge[-stride_edge] : &dst_inner[-stride_inner];
+ if (have_left)
+ topleft = !(row & 7) && !y ?
+ s->intra_pred_data[p] + (col * (8 >> ss_h) + x * 4) * bytesperpixel :
+ y == 0 || x == 0 ? &dst_edge[-stride_edge] :
+ &dst_inner[-stride_inner];
+ }
+
+ if (have_top &&
+ (!edges[mode].needs_topleft || (have_left && top == topleft)) &&
+ (tx != TX_4X4 || !edges[mode].needs_topright || have_right) &&
+ n_px_need + n_px_need_tr <= n_px_have) {
+ *a = top;
+ } else {
+ if (have_top) {
+ if (n_px_need <= n_px_have) {
+ memcpy(*a, top, n_px_need * bytesperpixel);
+ } else {
+#define memset_bpp(c, i1, v, i2, num) do { \
+ if (bytesperpixel == 1) { \
+ memset(&(c)[(i1)], (v)[(i2)], (num)); \
+ } else { \
+ int n, val = AV_RN16A(&(v)[(i2) * 2]); \
+ for (n = 0; n < (num); n++) { \
+ AV_WN16A(&(c)[((i1) + n) * 2], val); \
+ } \
+ } \
+} while (0)
+ memcpy(*a, top, n_px_have * bytesperpixel);
+ memset_bpp(*a, n_px_have, (*a), n_px_have - 1, n_px_need - n_px_have);
+ }
+ } else {
+#define memset_val(c, val, num) do { \
+ if (bytesperpixel == 1) { \
+ memset((c), (val), (num)); \
+ } else { \
+ int n; \
+ for (n = 0; n < (num); n++) { \
+ AV_WN16A(&(c)[n * 2], (val)); \
+ } \
+ } \
+} while (0)
+ memset_val(*a, (128 << (bpp - 8)) - 1, n_px_need);
+ }
+ if (edges[mode].needs_topleft) {
+ if (have_left && have_top) {
+#define assign_bpp(c, i1, v, i2) do { \
+ if (bytesperpixel == 1) { \
+ (c)[(i1)] = (v)[(i2)]; \
+ } else { \
+ AV_COPY16(&(c)[(i1) * 2], &(v)[(i2) * 2]); \
+ } \
+} while (0)
+ assign_bpp(*a, -1, topleft, -1);
+ } else {
+#define assign_val(c, i, v) do { \
+ if (bytesperpixel == 1) { \
+ (c)[(i)] = (v); \
+ } else { \
+ AV_WN16A(&(c)[(i) * 2], (v)); \
+ } \
+} while (0)
+ assign_val((*a), -1, (128 << (bpp - 8)) + (have_top ? +1 : -1));
+ }
+ }
+ if (tx == TX_4X4 && edges[mode].needs_topright) {
+ if (have_top && have_right &&
+ n_px_need + n_px_need_tr <= n_px_have) {
+ memcpy(&(*a)[4 * bytesperpixel], &top[4 * bytesperpixel], 4 * bytesperpixel);
+ } else {
+ memset_bpp(*a, 4, *a, 3, 4);
+ }
+ }
+ }
+ }
+ if (edges[mode].needs_left) {
+ if (have_left) {
+ int n_px_need = 4 << tx, i, n_px_have = (((s->rows - row) << !ss_v) - y) * 4;
+ uint8_t *dst = x == 0 ? dst_edge : dst_inner;
+ ptrdiff_t stride = x == 0 ? stride_edge : stride_inner;
+
+ if (edges[mode].invert_left) {
+ if (n_px_need <= n_px_have) {
+ for (i = 0; i < n_px_need; i++)
+ assign_bpp(l, i, &dst[i * stride], -1);
+ } else {
+ for (i = 0; i < n_px_have; i++)
+ assign_bpp(l, i, &dst[i * stride], -1);
+ memset_bpp(l, n_px_have, l, n_px_have - 1, n_px_need - n_px_have);
+ }
+ } else {
+ if (n_px_need <= n_px_have) {
+ for (i = 0; i < n_px_need; i++)
+ assign_bpp(l, n_px_need - 1 - i, &dst[i * stride], -1);
+ } else {
+ for (i = 0; i < n_px_have; i++)
+ assign_bpp(l, n_px_need - 1 - i, &dst[i * stride], -1);
+ memset_bpp(l, 0, l, n_px_need - n_px_have, n_px_need - n_px_have);
+ }
+ }
+ } else {
+ memset_val(l, (128 << (bpp - 8)) + 1, 4 << tx);
+ }
+ }
+
+ return mode;
+}
+
+static av_always_inline void intra_recon(VP9TileData *td, ptrdiff_t y_off,
+ ptrdiff_t uv_off, int bytesperpixel)
+{
+ VP9Context *s = td->s;
+ VP9Block *b = td->b;
+ int row = td->row, col = td->col;
+ int w4 = ff_vp9_bwh_tab[1][b->bs][0] << 1, step1d = 1 << b->tx, n;
+ int h4 = ff_vp9_bwh_tab[1][b->bs][1] << 1, x, y, step = 1 << (b->tx * 2);
+ int end_x = FFMIN(2 * (s->cols - col), w4);
+ int end_y = FFMIN(2 * (s->rows - row), h4);
+ int tx = 4 * s->s.h.lossless + b->tx, uvtx = b->uvtx + 4 * s->s.h.lossless;
+ int uvstep1d = 1 << b->uvtx, p;
+ uint8_t *dst = td->dst[0], *dst_r = s->s.frames[CUR_FRAME].tf.f->data[0] + y_off;
+ LOCAL_ALIGNED_32(uint8_t, a_buf, [96]);
+ LOCAL_ALIGNED_32(uint8_t, l, [64]);
+
+ for (n = 0, y = 0; y < end_y; y += step1d) {
+ uint8_t *ptr = dst, *ptr_r = dst_r;
+ for (x = 0; x < end_x; x += step1d, ptr += 4 * step1d * bytesperpixel,
+ ptr_r += 4 * step1d * bytesperpixel, n += step) {
+ int mode = b->mode[b->bs > BS_8x8 && b->tx == TX_4X4 ?
+ y * 2 + x : 0];
+ uint8_t *a = &a_buf[32];
+ enum TxfmType txtp = ff_vp9_intra_txfm_type[mode];
+ int eob = b->skip ? 0 : b->tx > TX_8X8 ? AV_RN16A(&td->eob[n]) : td->eob[n];
+
+ mode = check_intra_mode(td, mode, &a, ptr_r,
+ s->s.frames[CUR_FRAME].tf.f->linesize[0],
+ ptr, td->y_stride, l,
+ col, x, w4, row, y, b->tx, 0, 0, 0, bytesperpixel);
+ s->dsp.intra_pred[b->tx][mode](ptr, td->y_stride, l, a);
+ if (eob)
+ s->dsp.itxfm_add[tx][txtp](ptr, td->y_stride,
+ td->block + 16 * n * bytesperpixel, eob);
+ }
+ dst_r += 4 * step1d * s->s.frames[CUR_FRAME].tf.f->linesize[0];
+ dst += 4 * step1d * td->y_stride;
+ }
+
+ // U/V
+ w4 >>= s->ss_h;
+ end_x >>= s->ss_h;
+ end_y >>= s->ss_v;
+ step = 1 << (b->uvtx * 2);
+ for (p = 0; p < 2; p++) {
+ dst = td->dst[1 + p];
+ dst_r = s->s.frames[CUR_FRAME].tf.f->data[1 + p] + uv_off;
+ for (n = 0, y = 0; y < end_y; y += uvstep1d) {
+ uint8_t *ptr = dst, *ptr_r = dst_r;
+ for (x = 0; x < end_x; x += uvstep1d, ptr += 4 * uvstep1d * bytesperpixel,
+ ptr_r += 4 * uvstep1d * bytesperpixel, n += step) {
+ int mode = b->uvmode;
+ uint8_t *a = &a_buf[32];
+ int eob = b->skip ? 0 : b->uvtx > TX_8X8 ? AV_RN16A(&td->uveob[p][n]) : td->uveob[p][n];
+
+ mode = check_intra_mode(td, mode, &a, ptr_r,
+ s->s.frames[CUR_FRAME].tf.f->linesize[1],
+ ptr, td->uv_stride, l, col, x, w4, row, y,
+ b->uvtx, p + 1, s->ss_h, s->ss_v, bytesperpixel);
+ s->dsp.intra_pred[b->uvtx][mode](ptr, td->uv_stride, l, a);
+ if (eob)
+ s->dsp.itxfm_add[uvtx][DCT_DCT](ptr, td->uv_stride,
+ td->uvblock[p] + 16 * n * bytesperpixel, eob);
+ }
+ dst_r += 4 * uvstep1d * s->s.frames[CUR_FRAME].tf.f->linesize[1];
+ dst += 4 * uvstep1d * td->uv_stride;
+ }
+ }
+}
+
+void ff_vp9_intra_recon_8bpp(VP9TileData *td, ptrdiff_t y_off, ptrdiff_t uv_off)
+{
+ intra_recon(td, y_off, uv_off, 1);
+}
+
+void ff_vp9_intra_recon_16bpp(VP9TileData *td, ptrdiff_t y_off, ptrdiff_t uv_off)
+{
+ intra_recon(td, y_off, uv_off, 2);
+}
+
+static av_always_inline void mc_luma_unscaled(VP9TileData *td, vp9_mc_func (*mc)[2],
+ uint8_t *dst, ptrdiff_t dst_stride,
+ const uint8_t *ref, ptrdiff_t ref_stride,
+ ThreadFrame *ref_frame,
+ ptrdiff_t y, ptrdiff_t x, const VP56mv *mv,
+ int bw, int bh, int w, int h, int bytesperpixel)
+{
+ VP9Context *s = td->s;
+ int mx = mv->x, my = mv->y, th;
+
+ y += my >> 3;
+ x += mx >> 3;
+ ref += y * ref_stride + x * bytesperpixel;
+ mx &= 7;
+ my &= 7;
+ // FIXME bilinear filter only needs 0/1 pixels, not 3/4
+ // we use +7 because the last 7 pixels of each sbrow can be changed in
+ // the longest loopfilter of the next sbrow
+ th = (y + bh + 4 * !!my + 7) >> 6;
+ ff_thread_await_progress(ref_frame, FFMAX(th, 0), 0);
+ // The arm/aarch64 _hv filters read one more row than what actually is
+ // needed, so switch to emulated edge one pixel sooner vertically
+ // (!!my * 5) than horizontally (!!mx * 4).
+ if (x < !!mx * 3 || y < !!my * 3 ||
+ x + !!mx * 4 > w - bw || y + !!my * 5 > h - bh) {
+ s->vdsp.emulated_edge_mc(td->edge_emu_buffer,
+ ref - !!my * 3 * ref_stride - !!mx * 3 * bytesperpixel,
+ 160, ref_stride,
+ bw + !!mx * 7, bh + !!my * 7,
+ x - !!mx * 3, y - !!my * 3, w, h);
+ ref = td->edge_emu_buffer + !!my * 3 * 160 + !!mx * 3 * bytesperpixel;
+ ref_stride = 160;
+ }
+ mc[!!mx][!!my](dst, dst_stride, ref, ref_stride, bh, mx << 1, my << 1);
+}
+
+static av_always_inline void mc_chroma_unscaled(VP9TileData *td, vp9_mc_func (*mc)[2],
+ uint8_t *dst_u, uint8_t *dst_v,
+ ptrdiff_t dst_stride,
+ const uint8_t *ref_u, ptrdiff_t src_stride_u,
+ const uint8_t *ref_v, ptrdiff_t src_stride_v,
+ ThreadFrame *ref_frame,
+ ptrdiff_t y, ptrdiff_t x, const VP56mv *mv,
+ int bw, int bh, int w, int h, int bytesperpixel)
+{
+ VP9Context *s = td->s;
+ int mx = mv->x * (1 << !s->ss_h), my = mv->y * (1 << !s->ss_v), th;
+
+ y += my >> 4;
+ x += mx >> 4;
+ ref_u += y * src_stride_u + x * bytesperpixel;
+ ref_v += y * src_stride_v + x * bytesperpixel;
+ mx &= 15;
+ my &= 15;
+ // FIXME bilinear filter only needs 0/1 pixels, not 3/4
+ // we use +7 because the last 7 pixels of each sbrow can be changed in
+ // the longest loopfilter of the next sbrow
+ th = (y + bh + 4 * !!my + 7) >> (6 - s->ss_v);
+ ff_thread_await_progress(ref_frame, FFMAX(th, 0), 0);
+ // The arm/aarch64 _hv filters read one more row than what actually is
+ // needed, so switch to emulated edge one pixel sooner vertically
+ // (!!my * 5) than horizontally (!!mx * 4).
+ if (x < !!mx * 3 || y < !!my * 3 ||
+ x + !!mx * 4 > w - bw || y + !!my * 5 > h - bh) {
+ s->vdsp.emulated_edge_mc(td->edge_emu_buffer,
+ ref_u - !!my * 3 * src_stride_u - !!mx * 3 * bytesperpixel,
+ 160, src_stride_u,
+ bw + !!mx * 7, bh + !!my * 7,
+ x - !!mx * 3, y - !!my * 3, w, h);
+ ref_u = td->edge_emu_buffer + !!my * 3 * 160 + !!mx * 3 * bytesperpixel;
+ mc[!!mx][!!my](dst_u, dst_stride, ref_u, 160, bh, mx, my);
+
+ s->vdsp.emulated_edge_mc(td->edge_emu_buffer,
+ ref_v - !!my * 3 * src_stride_v - !!mx * 3 * bytesperpixel,
+ 160, src_stride_v,
+ bw + !!mx * 7, bh + !!my * 7,
+ x - !!mx * 3, y - !!my * 3, w, h);
+ ref_v = td->edge_emu_buffer + !!my * 3 * 160 + !!mx * 3 * bytesperpixel;
+ mc[!!mx][!!my](dst_v, dst_stride, ref_v, 160, bh, mx, my);
+ } else {
+ mc[!!mx][!!my](dst_u, dst_stride, ref_u, src_stride_u, bh, mx, my);
+ mc[!!mx][!!my](dst_v, dst_stride, ref_v, src_stride_v, bh, mx, my);
+ }
+}
+
+#define mc_luma_dir(td, mc, dst, dst_ls, src, src_ls, tref, row, col, mv, \
+ px, py, pw, ph, bw, bh, w, h, i) \
+ mc_luma_unscaled(td, s->dsp.mc, dst, dst_ls, src, src_ls, tref, row, col, \
+ mv, bw, bh, w, h, bytesperpixel)
+#define mc_chroma_dir(td, mc, dstu, dstv, dst_ls, srcu, srcu_ls, srcv, srcv_ls, tref, \
+ row, col, mv, px, py, pw, ph, bw, bh, w, h, i) \
+ mc_chroma_unscaled(td, s->dsp.mc, dstu, dstv, dst_ls, srcu, srcu_ls, srcv, srcv_ls, tref, \
+ row, col, mv, bw, bh, w, h, bytesperpixel)
+#define SCALED 0
+#define FN(x) x##_8bpp
+#define BYTES_PER_PIXEL 1
+#include "vp9_mc_template.c"
+#undef FN
+#undef BYTES_PER_PIXEL
+#define FN(x) x##_16bpp
+#define BYTES_PER_PIXEL 2
+#include "vp9_mc_template.c"
+#undef mc_luma_dir
+#undef mc_chroma_dir
+#undef FN
+#undef BYTES_PER_PIXEL
+#undef SCALED
+
+static av_always_inline void mc_luma_scaled(VP9TileData *td, vp9_scaled_mc_func smc,
+ vp9_mc_func (*mc)[2],
+ uint8_t *dst, ptrdiff_t dst_stride,
+ const uint8_t *ref, ptrdiff_t ref_stride,
+ ThreadFrame *ref_frame,
+ ptrdiff_t y, ptrdiff_t x, const VP56mv *in_mv,
+ int px, int py, int pw, int ph,
+ int bw, int bh, int w, int h, int bytesperpixel,
+ const uint16_t *scale, const uint8_t *step)
+{
+ VP9Context *s = td->s;
+ if (s->s.frames[CUR_FRAME].tf.f->width == ref_frame->f->width &&
+ s->s.frames[CUR_FRAME].tf.f->height == ref_frame->f->height) {
+ mc_luma_unscaled(td, mc, dst, dst_stride, ref, ref_stride, ref_frame,
+ y, x, in_mv, bw, bh, w, h, bytesperpixel);
+ } else {
+#define scale_mv(n, dim) (((int64_t)(n) * scale[dim]) >> 14)
+ int mx, my;
+ int refbw_m1, refbh_m1;
+ int th;
+ VP56mv mv;
+
+ mv.x = av_clip(in_mv->x, -(x + pw - px + 4) * 8, (s->cols * 8 - x + px + 3) * 8);
+ mv.y = av_clip(in_mv->y, -(y + ph - py + 4) * 8, (s->rows * 8 - y + py + 3) * 8);
+ // BUG libvpx seems to scale the two components separately. This introduces
+ // rounding errors but we have to reproduce them to be exactly compatible
+ // with the output from libvpx...
+ mx = scale_mv(mv.x * 2, 0) + scale_mv(x * 16, 0);
+ my = scale_mv(mv.y * 2, 1) + scale_mv(y * 16, 1);
+
+ y = my >> 4;
+ x = mx >> 4;
+ ref += y * ref_stride + x * bytesperpixel;
+ mx &= 15;
+ my &= 15;
+ refbw_m1 = ((bw - 1) * step[0] + mx) >> 4;
+ refbh_m1 = ((bh - 1) * step[1] + my) >> 4;
+ // FIXME bilinear filter only needs 0/1 pixels, not 3/4
+ // we use +7 because the last 7 pixels of each sbrow can be changed in
+ // the longest loopfilter of the next sbrow
+ th = (y + refbh_m1 + 4 + 7) >> 6;
+ ff_thread_await_progress(ref_frame, FFMAX(th, 0), 0);
+ // The arm/aarch64 _hv filters read one more row than what actually is
+ // needed, so switch to emulated edge one pixel sooner vertically
+ // (y + 5 >= h - refbh_m1) than horizontally (x + 4 >= w - refbw_m1).
+ if (x < 3 || y < 3 || x + 4 >= w - refbw_m1 || y + 5 >= h - refbh_m1) {
+ s->vdsp.emulated_edge_mc(td->edge_emu_buffer,
+ ref - 3 * ref_stride - 3 * bytesperpixel,
+ 288, ref_stride,
+ refbw_m1 + 8, refbh_m1 + 8,
+ x - 3, y - 3, w, h);
+ ref = td->edge_emu_buffer + 3 * 288 + 3 * bytesperpixel;
+ ref_stride = 288;
+ }
+ smc(dst, dst_stride, ref, ref_stride, bh, mx, my, step[0], step[1]);
+ }
+}
+
+static av_always_inline void mc_chroma_scaled(VP9TileData *td, vp9_scaled_mc_func smc,
+ vp9_mc_func (*mc)[2],
+ uint8_t *dst_u, uint8_t *dst_v,
+ ptrdiff_t dst_stride,
+ const uint8_t *ref_u, ptrdiff_t src_stride_u,
+ const uint8_t *ref_v, ptrdiff_t src_stride_v,
+ ThreadFrame *ref_frame,
+ ptrdiff_t y, ptrdiff_t x, const VP56mv *in_mv,
+ int px, int py, int pw, int ph,
+ int bw, int bh, int w, int h, int bytesperpixel,
+ const uint16_t *scale, const uint8_t *step)
+{
+ VP9Context *s = td->s;
+ if (s->s.frames[CUR_FRAME].tf.f->width == ref_frame->f->width &&
+ s->s.frames[CUR_FRAME].tf.f->height == ref_frame->f->height) {
+ mc_chroma_unscaled(td, mc, dst_u, dst_v, dst_stride, ref_u, src_stride_u,
+ ref_v, src_stride_v, ref_frame,
+ y, x, in_mv, bw, bh, w, h, bytesperpixel);
+ } else {
+ int mx, my;
+ int refbw_m1, refbh_m1;
+ int th;
+ VP56mv mv;
+
+ if (s->ss_h) {
+ // BUG https://code.google.com/p/webm/issues/detail?id=820
+ mv.x = av_clip(in_mv->x, -(x + pw - px + 4) * 16, (s->cols * 4 - x + px + 3) * 16);
+ mx = scale_mv(mv.x, 0) + (scale_mv(x * 16, 0) & ~15) + (scale_mv(x * 32, 0) & 15);
+ } else {
+ mv.x = av_clip(in_mv->x, -(x + pw - px + 4) * 8, (s->cols * 8 - x + px + 3) * 8);
+ mx = scale_mv(mv.x * 2, 0) + scale_mv(x * 16, 0);
+ }
+ if (s->ss_v) {
+ // BUG https://code.google.com/p/webm/issues/detail?id=820
+ mv.y = av_clip(in_mv->y, -(y + ph - py + 4) * 16, (s->rows * 4 - y + py + 3) * 16);
+ my = scale_mv(mv.y, 1) + (scale_mv(y * 16, 1) & ~15) + (scale_mv(y * 32, 1) & 15);
+ } else {
+ mv.y = av_clip(in_mv->y, -(y + ph - py + 4) * 8, (s->rows * 8 - y + py + 3) * 8);
+ my = scale_mv(mv.y * 2, 1) + scale_mv(y * 16, 1);
+ }
+#undef scale_mv
+ y = my >> 4;
+ x = mx >> 4;
+ ref_u += y * src_stride_u + x * bytesperpixel;
+ ref_v += y * src_stride_v + x * bytesperpixel;
+ mx &= 15;
+ my &= 15;
+ refbw_m1 = ((bw - 1) * step[0] + mx) >> 4;
+ refbh_m1 = ((bh - 1) * step[1] + my) >> 4;
+ // FIXME bilinear filter only needs 0/1 pixels, not 3/4
+ // we use +7 because the last 7 pixels of each sbrow can be changed in
+ // the longest loopfilter of the next sbrow
+ th = (y + refbh_m1 + 4 + 7) >> (6 - s->ss_v);
+ ff_thread_await_progress(ref_frame, FFMAX(th, 0), 0);
+ // The arm/aarch64 _hv filters read one more row than what actually is
+ // needed, so switch to emulated edge one pixel sooner vertically
+ // (y + 5 >= h - refbh_m1) than horizontally (x + 4 >= w - refbw_m1).
+ if (x < 3 || y < 3 || x + 4 >= w - refbw_m1 || y + 5 >= h - refbh_m1) {
+ s->vdsp.emulated_edge_mc(td->edge_emu_buffer,
+ ref_u - 3 * src_stride_u - 3 * bytesperpixel,
+ 288, src_stride_u,
+ refbw_m1 + 8, refbh_m1 + 8,
+ x - 3, y - 3, w, h);
+ ref_u = td->edge_emu_buffer + 3 * 288 + 3 * bytesperpixel;
+ smc(dst_u, dst_stride, ref_u, 288, bh, mx, my, step[0], step[1]);
+
+ s->vdsp.emulated_edge_mc(td->edge_emu_buffer,
+ ref_v - 3 * src_stride_v - 3 * bytesperpixel,
+ 288, src_stride_v,
+ refbw_m1 + 8, refbh_m1 + 8,
+ x - 3, y - 3, w, h);
+ ref_v = td->edge_emu_buffer + 3 * 288 + 3 * bytesperpixel;
+ smc(dst_v, dst_stride, ref_v, 288, bh, mx, my, step[0], step[1]);
+ } else {
+ smc(dst_u, dst_stride, ref_u, src_stride_u, bh, mx, my, step[0], step[1]);
+ smc(dst_v, dst_stride, ref_v, src_stride_v, bh, mx, my, step[0], step[1]);
+ }
+ }
+}
+
+#define mc_luma_dir(td, mc, dst, dst_ls, src, src_ls, tref, row, col, mv, \
+ px, py, pw, ph, bw, bh, w, h, i) \
+ mc_luma_scaled(td, s->dsp.s##mc, s->dsp.mc, dst, dst_ls, src, src_ls, tref, row, col, \
+ mv, px, py, pw, ph, bw, bh, w, h, bytesperpixel, \
+ s->mvscale[b->ref[i]], s->mvstep[b->ref[i]])
+#define mc_chroma_dir(td, mc, dstu, dstv, dst_ls, srcu, srcu_ls, srcv, srcv_ls, tref, \
+ row, col, mv, px, py, pw, ph, bw, bh, w, h, i) \
+ mc_chroma_scaled(td, s->dsp.s##mc, s->dsp.mc, dstu, dstv, dst_ls, srcu, srcu_ls, srcv, srcv_ls, tref, \
+ row, col, mv, px, py, pw, ph, bw, bh, w, h, bytesperpixel, \
+ s->mvscale[b->ref[i]], s->mvstep[b->ref[i]])
+#define SCALED 1
+#define FN(x) x##_scaled_8bpp
+#define BYTES_PER_PIXEL 1
+#include "vp9_mc_template.c"
+#undef FN
+#undef BYTES_PER_PIXEL
+#define FN(x) x##_scaled_16bpp
+#define BYTES_PER_PIXEL 2
+#include "vp9_mc_template.c"
+#undef mc_luma_dir
+#undef mc_chroma_dir
+#undef FN
+#undef BYTES_PER_PIXEL
+#undef SCALED
+
+static av_always_inline void inter_recon(VP9TileData *td, int bytesperpixel)
+{
+ VP9Context *s = td->s;
+ VP9Block *b = td->b;
+ int row = td->row, col = td->col;
+
+ if (s->mvscale[b->ref[0]][0] || (b->comp && s->mvscale[b->ref[1]][0])) {
+ if (bytesperpixel == 1) {
+ inter_pred_scaled_8bpp(td);
+ } else {
+ inter_pred_scaled_16bpp(td);
+ }
+ } else {
+ if (bytesperpixel == 1) {
+ inter_pred_8bpp(td);
+ } else {
+ inter_pred_16bpp(td);
+ }
+ }
+
+ if (!b->skip) {
+ /* mostly copied intra_recon() */
+
+ int w4 = ff_vp9_bwh_tab[1][b->bs][0] << 1, step1d = 1 << b->tx, n;
+ int h4 = ff_vp9_bwh_tab[1][b->bs][1] << 1, x, y, step = 1 << (b->tx * 2);
+ int end_x = FFMIN(2 * (s->cols - col), w4);
+ int end_y = FFMIN(2 * (s->rows - row), h4);
+ int tx = 4 * s->s.h.lossless + b->tx, uvtx = b->uvtx + 4 * s->s.h.lossless;
+ int uvstep1d = 1 << b->uvtx, p;
+ uint8_t *dst = td->dst[0];
+
+ // y itxfm add
+ for (n = 0, y = 0; y < end_y; y += step1d) {
+ uint8_t *ptr = dst;
+ for (x = 0; x < end_x; x += step1d,
+ ptr += 4 * step1d * bytesperpixel, n += step) {
+ int eob = b->tx > TX_8X8 ? AV_RN16A(&td->eob[n]) : td->eob[n];
+
+ if (eob)
+ s->dsp.itxfm_add[tx][DCT_DCT](ptr, td->y_stride,
+ td->block + 16 * n * bytesperpixel, eob);
+ }
+ dst += 4 * td->y_stride * step1d;
+ }
+
+ // uv itxfm add
+ end_x >>= s->ss_h;
+ end_y >>= s->ss_v;
+ step = 1 << (b->uvtx * 2);
+ for (p = 0; p < 2; p++) {
+ dst = td->dst[p + 1];
+ for (n = 0, y = 0; y < end_y; y += uvstep1d) {
+ uint8_t *ptr = dst;
+ for (x = 0; x < end_x; x += uvstep1d,
+ ptr += 4 * uvstep1d * bytesperpixel, n += step) {
+ int eob = b->uvtx > TX_8X8 ? AV_RN16A(&td->uveob[p][n]) : td->uveob[p][n];
+
+ if (eob)
+ s->dsp.itxfm_add[uvtx][DCT_DCT](ptr, td->uv_stride,
+ td->uvblock[p] + 16 * n * bytesperpixel, eob);
+ }
+ dst += 4 * uvstep1d * td->uv_stride;
+ }
+ }
+ }
+}
+
+void ff_vp9_inter_recon_8bpp(VP9TileData *td)
+{
+ inter_recon(td, 1);
+}
+
+void ff_vp9_inter_recon_16bpp(VP9TileData *td)
+{
+ inter_recon(td, 2);
+}
diff --git a/media/ffvpx/libavcodec/vp9shared.h b/media/ffvpx/libavcodec/vp9shared.h
new file mode 100644
index 0000000000..54726df742
--- /dev/null
+++ b/media/ffvpx/libavcodec/vp9shared.h
@@ -0,0 +1,169 @@
+/*
+ * VP9 compatible video decoder
+ *
+ * Copyright (C) 2013 Ronald S. Bultje <rsbultje gmail com>
+ * Copyright (C) 2013 Clément Bœsch <u pkh me>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_VP9SHARED_H
+#define AVCODEC_VP9SHARED_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "vp9.h"
+#include "thread.h"
+#include "vp56.h"
+
+enum BlockPartition {
+ PARTITION_NONE, // [ ] <-.
+ PARTITION_H, // [-] |
+ PARTITION_V, // [|] |
+ PARTITION_SPLIT, // [+] --'
+};
+
+enum InterPredMode {
+ NEARESTMV = 10,
+ NEARMV = 11,
+ ZEROMV = 12,
+ NEWMV = 13,
+};
+
+enum CompPredMode {
+ PRED_SINGLEREF,
+ PRED_COMPREF,
+ PRED_SWITCHABLE,
+};
+
+typedef struct VP9mvrefPair {
+ VP56mv mv[2];
+ int8_t ref[2];
+} VP9mvrefPair;
+
+typedef struct VP9Frame {
+ ThreadFrame tf;
+ AVBufferRef *extradata;
+ uint8_t *segmentation_map;
+ VP9mvrefPair *mv;
+ int uses_2pass;
+
+ AVBufferRef *hwaccel_priv_buf;
+ void *hwaccel_picture_private;
+} VP9Frame;
+
+enum BlockLevel {
+ BL_64X64,
+ BL_32X32,
+ BL_16X16,
+ BL_8X8,
+};
+
+enum BlockSize {
+ BS_64x64,
+ BS_64x32,
+ BS_32x64,
+ BS_32x32,
+ BS_32x16,
+ BS_16x32,
+ BS_16x16,
+ BS_16x8,
+ BS_8x16,
+ BS_8x8,
+ BS_8x4,
+ BS_4x8,
+ BS_4x4,
+ N_BS_SIZES,
+};
+
+typedef struct VP9BitstreamHeader {
+ // bitstream header
+ uint8_t profile;
+ uint8_t bpp;
+ uint8_t keyframe;
+ uint8_t invisible;
+ uint8_t errorres;
+ uint8_t intraonly;
+ uint8_t resetctx;
+ uint8_t refreshrefmask;
+ uint8_t highprecisionmvs;
+ enum FilterMode filtermode;
+ uint8_t allowcompinter;
+ uint8_t refreshctx;
+ uint8_t parallelmode;
+ uint8_t framectxid;
+ uint8_t use_last_frame_mvs;
+ uint8_t refidx[3];
+ uint8_t signbias[3];
+ uint8_t fixcompref;
+ uint8_t varcompref[2];
+ struct {
+ uint8_t level;
+ int8_t sharpness;
+ } filter;
+ struct {
+ uint8_t enabled;
+ uint8_t updated;
+ int8_t mode[2];
+ int8_t ref[4];
+ } lf_delta;
+ uint8_t yac_qi;
+ int8_t ydc_qdelta, uvdc_qdelta, uvac_qdelta;
+ uint8_t lossless;
+#define MAX_SEGMENT 8
+ struct {
+ uint8_t enabled;
+ uint8_t temporal;
+ uint8_t absolute_vals;
+ uint8_t update_map;
+ uint8_t prob[7];
+ uint8_t pred_prob[3];
+ struct {
+ uint8_t q_enabled;
+ uint8_t lf_enabled;
+ uint8_t ref_enabled;
+ uint8_t skip_enabled;
+ uint8_t ref_val;
+ int16_t q_val;
+ int8_t lf_val;
+ int16_t qmul[2][2];
+ uint8_t lflvl[4][2];
+ } feat[MAX_SEGMENT];
+ } segmentation;
+ enum TxfmMode txfmmode;
+ enum CompPredMode comppredmode;
+ struct {
+ unsigned log2_tile_cols, log2_tile_rows;
+ unsigned tile_cols, tile_rows;
+ } tiling;
+
+ int uncompressed_header_size;
+ int compressed_header_size;
+} VP9BitstreamHeader;
+
+typedef struct VP9SharedContext {
+ VP9BitstreamHeader h;
+
+ ThreadFrame refs[8];
+#define CUR_FRAME 0
+#define REF_FRAME_MVPAIR 1
+#define REF_FRAME_SEGMAP 2
+ VP9Frame frames[3];
+} VP9SharedContext;
+
+#endif /* AVCODEC_VP9SHARED_H */
diff --git a/media/ffvpx/libavcodec/x86/constants.h b/media/ffvpx/libavcodec/x86/constants.h
index b82aef9a47..bbb0ef844a 100644
--- a/media/ffvpx/libavcodec/x86/constants.h
+++ b/media/ffvpx/libavcodec/x86/constants.h
@@ -43,6 +43,7 @@ extern const xmm_reg ff_pw_64;
extern const uint64_t ff_pw_96;
extern const uint64_t ff_pw_128;
extern const ymm_reg ff_pw_255;
+extern const ymm_reg ff_pw_256;
extern const ymm_reg ff_pw_512;
extern const ymm_reg ff_pw_1023;
extern const ymm_reg ff_pw_1024;
diff --git a/media/ffvpx/libavcodec/x86/flacdsp_init.c b/media/ffvpx/libavcodec/x86/flacdsp_init.c
index e28c5c9322..1971f81b8d 100644
--- a/media/ffvpx/libavcodec/x86/flacdsp_init.c
+++ b/media/ffvpx/libavcodec/x86/flacdsp_init.c
@@ -53,7 +53,7 @@ DECORRELATE_FUNCS(32, avx);
av_cold void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int channels,
int bps)
{
-#if HAVE_YASM
+#if HAVE_X86ASM
int cpu_flags = av_get_cpu_flags();
#if CONFIG_FLAC_DECODER
@@ -111,5 +111,5 @@ av_cold void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int
c->lpc16_encode = ff_flac_enc_lpc_16_sse4;
}
#endif
-#endif /* HAVE_YASM */
+#endif /* HAVE_X86ASM */
}
diff --git a/media/ffvpx/libavcodec/x86/h264_i386.h b/media/ffvpx/libavcodec/x86/h264_i386.h
deleted file mode 100644
index 19cd128381..0000000000
--- a/media/ffvpx/libavcodec/x86/h264_i386.h
+++ /dev/null
@@ -1,212 +0,0 @@
-/*
- * H.26L/H.264/AVC/JVT/14496-10/... encoder/decoder
- * Copyright (c) 2003 Michael Niedermayer <michaelni@gmx.at>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * H.264 / AVC / MPEG-4 part10 codec.
- * non-MMX i386-specific optimizations for H.264
- * @author Michael Niedermayer <michaelni@gmx.at>
- */
-
-#ifndef AVCODEC_X86_H264_I386_H
-#define AVCODEC_X86_H264_I386_H
-
-#include <stddef.h>
-
-#include "libavcodec/cabac.h"
-#include "cabac.h"
-
-#if HAVE_INLINE_ASM
-
-#if ARCH_X86_64
-#define REG64 "r"
-#else
-#define REG64 "m"
-#endif
-
-//FIXME use some macros to avoid duplicating get_cabac (cannot be done yet
-//as that would make optimization work hard)
-#if HAVE_7REGS && !BROKEN_COMPILER
-#define decode_significance decode_significance_x86
-static int decode_significance_x86(CABACContext *c, int max_coeff,
- uint8_t *significant_coeff_ctx_base,
- int *index, x86_reg last_off){
- void *end= significant_coeff_ctx_base + max_coeff - 1;
- int minusstart= -(intptr_t)significant_coeff_ctx_base;
- int minusindex= 4-(intptr_t)index;
- int bit;
- x86_reg coeff_count;
-
-#ifdef BROKEN_RELOCATIONS
- void *tables;
-
- __asm__ volatile(
- "lea "MANGLE(ff_h264_cabac_tables)", %0 \n\t"
- : "=&r"(tables)
- : NAMED_CONSTRAINTS_ARRAY(ff_h264_cabac_tables)
- );
-#endif
-
- __asm__ volatile(
- "3: \n\t"
-
- BRANCHLESS_GET_CABAC("%4", "%q4", "(%1)", "%3", "%w3",
- "%5", "%q5", "%k0", "%b0",
- "%c11(%6)", "%c12(%6)",
- AV_STRINGIFY(H264_NORM_SHIFT_OFFSET),
- AV_STRINGIFY(H264_LPS_RANGE_OFFSET),
- AV_STRINGIFY(H264_MLPS_STATE_OFFSET),
- "%13")
-
- "test $1, %4 \n\t"
- " jz 4f \n\t"
- "add %10, %1 \n\t"
-
- BRANCHLESS_GET_CABAC("%4", "%q4", "(%1)", "%3", "%w3",
- "%5", "%q5", "%k0", "%b0",
- "%c11(%6)", "%c12(%6)",
- AV_STRINGIFY(H264_NORM_SHIFT_OFFSET),
- AV_STRINGIFY(H264_LPS_RANGE_OFFSET),
- AV_STRINGIFY(H264_MLPS_STATE_OFFSET),
- "%13")
-
- "sub %10, %1 \n\t"
- "mov %2, %0 \n\t"
- "movl %7, %%ecx \n\t"
- "add %1, %%"FF_REG_c" \n\t"
- "movl %%ecx, (%0) \n\t"
-
- "test $1, %4 \n\t"
- " jnz 5f \n\t"
-
- "add"FF_OPSIZE" $4, %2 \n\t"
-
- "4: \n\t"
- "add $1, %1 \n\t"
- "cmp %8, %1 \n\t"
- " jb 3b \n\t"
- "mov %2, %0 \n\t"
- "movl %7, %%ecx \n\t"
- "add %1, %%"FF_REG_c" \n\t"
- "movl %%ecx, (%0) \n\t"
- "5: \n\t"
- "add %9, %k0 \n\t"
- "shr $2, %k0 \n\t"
- : "=&q"(coeff_count), "+r"(significant_coeff_ctx_base), "+m"(index),
- "+&r"(c->low), "=&r"(bit), "+&r"(c->range)
- : "r"(c), "m"(minusstart), "m"(end), "m"(minusindex), "m"(last_off),
- "i"(offsetof(CABACContext, bytestream)),
- "i"(offsetof(CABACContext, bytestream_end))
- TABLES_ARG
- : "%"FF_REG_c, "memory"
- );
- return coeff_count;
-}
-
-#define decode_significance_8x8 decode_significance_8x8_x86
-static int decode_significance_8x8_x86(CABACContext *c,
- uint8_t *significant_coeff_ctx_base,
- int *index, uint8_t *last_coeff_ctx_base, const uint8_t *sig_off){
- int minusindex= 4-(intptr_t)index;
- int bit;
- x86_reg coeff_count;
- x86_reg last=0;
- x86_reg state;
-
-#ifdef BROKEN_RELOCATIONS
- void *tables;
-
- __asm__ volatile(
- "lea "MANGLE(ff_h264_cabac_tables)", %0 \n\t"
- : "=&r"(tables)
- : NAMED_CONSTRAINTS_ARRAY(ff_h264_cabac_tables)
- );
-#endif
-
- __asm__ volatile(
- "mov %1, %6 \n\t"
- "3: \n\t"
-
- "mov %10, %0 \n\t"
- "movzb (%0, %6), %6 \n\t"
- "add %9, %6 \n\t"
-
- BRANCHLESS_GET_CABAC("%4", "%q4", "(%6)", "%3", "%w3",
- "%5", "%q5", "%k0", "%b0",
- "%c12(%7)", "%c13(%7)",
- AV_STRINGIFY(H264_NORM_SHIFT_OFFSET),
- AV_STRINGIFY(H264_LPS_RANGE_OFFSET),
- AV_STRINGIFY(H264_MLPS_STATE_OFFSET),
- "%15")
-
- "mov %1, %6 \n\t"
- "test $1, %4 \n\t"
- " jz 4f \n\t"
-
-#ifdef BROKEN_RELOCATIONS
- "movzb %c14(%15, %q6), %6\n\t"
-#else
- "movzb "MANGLE(ff_h264_cabac_tables)"+%c14(%6), %6\n\t"
-#endif
- "add %11, %6 \n\t"
-
- BRANCHLESS_GET_CABAC("%4", "%q4", "(%6)", "%3", "%w3",
- "%5", "%q5", "%k0", "%b0",
- "%c12(%7)", "%c13(%7)",
- AV_STRINGIFY(H264_NORM_SHIFT_OFFSET),
- AV_STRINGIFY(H264_LPS_RANGE_OFFSET),
- AV_STRINGIFY(H264_MLPS_STATE_OFFSET),
- "%15")
-
- "mov %2, %0 \n\t"
- "mov %1, %6 \n\t"
- "mov %k6, (%0) \n\t"
-
- "test $1, %4 \n\t"
- " jnz 5f \n\t"
-
- "add"FF_OPSIZE" $4, %2 \n\t"
-
- "4: \n\t"
- "add $1, %6 \n\t"
- "mov %6, %1 \n\t"
- "cmp $63, %6 \n\t"
- " jb 3b \n\t"
- "mov %2, %0 \n\t"
- "mov %k6, (%0) \n\t"
- "5: \n\t"
- "addl %8, %k0 \n\t"
- "shr $2, %k0 \n\t"
- : "=&q"(coeff_count), "+"REG64(last), "+"REG64(index), "+&r"(c->low),
- "=&r"(bit), "+&r"(c->range), "=&r"(state)
- : "r"(c), "m"(minusindex), "m"(significant_coeff_ctx_base),
- REG64(sig_off), REG64(last_coeff_ctx_base),
- "i"(offsetof(CABACContext, bytestream)),
- "i"(offsetof(CABACContext, bytestream_end)),
- "i"(H264_LAST_COEFF_FLAG_OFFSET_8x8_OFFSET) TABLES_ARG
- : "%"FF_REG_c, "memory"
- );
- return coeff_count;
-}
-#endif /* HAVE_7REGS && BROKEN_COMPILER */
-
-#endif /* HAVE_INLINE_ASM */
-#endif /* AVCODEC_X86_H264_I386_H */
diff --git a/media/ffvpx/libavcodec/x86/h264_intrapred.asm b/media/ffvpx/libavcodec/x86/h264_intrapred.asm
index c88d91b49e..f3aa3172f0 100644
--- a/media/ffvpx/libavcodec/x86/h264_intrapred.asm
+++ b/media/ffvpx/libavcodec/x86/h264_intrapred.asm
@@ -49,7 +49,7 @@ cextern pw_17
cextern pw_32
;-----------------------------------------------------------------------------
-; void ff_pred16x16_vertical_8(uint8_t *src, int stride)
+; void ff_pred16x16_vertical_8(uint8_t *src, ptrdiff_t stride)
;-----------------------------------------------------------------------------
INIT_MMX mmx
@@ -85,7 +85,7 @@ cglobal pred16x16_vertical_8, 2,3
REP_RET
;-----------------------------------------------------------------------------
-; void ff_pred16x16_horizontal_8(uint8_t *src, int stride)
+; void ff_pred16x16_horizontal_8(uint8_t *src, ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED16x16_H 0
@@ -126,7 +126,7 @@ INIT_XMM ssse3
PRED16x16_H
;-----------------------------------------------------------------------------
-; void ff_pred16x16_dc_8(uint8_t *src, int stride)
+; void ff_pred16x16_dc_8(uint8_t *src, ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED16x16_DC 0
@@ -188,7 +188,7 @@ INIT_XMM ssse3
PRED16x16_DC
;-----------------------------------------------------------------------------
-; void ff_pred16x16_tm_vp8_8(uint8_t *src, int stride)
+; void ff_pred16x16_tm_vp8_8(uint8_t *src, ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED16x16_TM 0
@@ -268,8 +268,45 @@ cglobal pred16x16_tm_vp8_8, 2,6,6
jg .loop
REP_RET
+%if HAVE_AVX2_EXTERNAL
+INIT_YMM avx2
+cglobal pred16x16_tm_vp8_8, 2, 4, 5, dst, stride, stride3, iteration
+ sub dstq, strideq
+ pmovzxbw m0, [dstq]
+ vpbroadcastb xm1, [r0-1]
+ pmovzxbw m1, xm1
+ psubw m0, m1
+ mov iterationd, 4
+ lea stride3q, [strideq*3]
+.loop:
+ vpbroadcastb xm1, [dstq+strideq*1-1]
+ vpbroadcastb xm2, [dstq+strideq*2-1]
+ vpbroadcastb xm3, [dstq+stride3q-1]
+ vpbroadcastb xm4, [dstq+strideq*4-1]
+ pmovzxbw m1, xm1
+ pmovzxbw m2, xm2
+ pmovzxbw m3, xm3
+ pmovzxbw m4, xm4
+ paddw m1, m0
+ paddw m2, m0
+ paddw m3, m0
+ paddw m4, m0
+ vpackuswb m1, m1, m2
+ vpackuswb m3, m3, m4
+ vpermq m1, m1, q3120
+ vpermq m3, m3, q3120
+ movdqa [dstq+strideq*1], xm1
+ vextracti128 [dstq+strideq*2], m1, 1
+ movdqa [dstq+stride3q*1], xm3
+ vextracti128 [dstq+strideq*4], m3, 1
+ lea dstq, [dstq+strideq*4]
+ dec iterationd
+ jg .loop
+ REP_RET
+%endif
+
;-----------------------------------------------------------------------------
-; void ff_pred16x16_plane_*_8(uint8_t *src, int stride)
+; void ff_pred16x16_plane_*_8(uint8_t *src, ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro H264_PRED16x16_PLANE 1
@@ -550,7 +587,7 @@ H264_PRED16x16_PLANE rv40
H264_PRED16x16_PLANE svq3
;-----------------------------------------------------------------------------
-; void ff_pred8x8_plane_8(uint8_t *src, int stride)
+; void ff_pred8x8_plane_8(uint8_t *src, ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro H264_PRED8x8_PLANE 0
@@ -724,7 +761,7 @@ INIT_XMM ssse3
H264_PRED8x8_PLANE
;-----------------------------------------------------------------------------
-; void ff_pred8x8_vertical_8(uint8_t *src, int stride)
+; void ff_pred8x8_vertical_8(uint8_t *src, ptrdiff_t stride)
;-----------------------------------------------------------------------------
INIT_MMX mmx
@@ -741,7 +778,7 @@ cglobal pred8x8_vertical_8, 2,2
RET
;-----------------------------------------------------------------------------
-; void ff_pred8x8_horizontal_8(uint8_t *src, int stride)
+; void ff_pred8x8_horizontal_8(uint8_t *src, ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED8x8_H 0
@@ -769,7 +806,7 @@ INIT_MMX ssse3
PRED8x8_H
;-----------------------------------------------------------------------------
-; void ff_pred8x8_top_dc_8_mmxext(uint8_t *src, int stride)
+; void ff_pred8x8_top_dc_8_mmxext(uint8_t *src, ptrdiff_t stride)
;-----------------------------------------------------------------------------
INIT_MMX mmxext
cglobal pred8x8_top_dc_8, 2,5
@@ -803,7 +840,7 @@ cglobal pred8x8_top_dc_8, 2,5
RET
;-----------------------------------------------------------------------------
-; void ff_pred8x8_dc_8_mmxext(uint8_t *src, int stride)
+; void ff_pred8x8_dc_8_mmxext(uint8_t *src, ptrdiff_t stride)
;-----------------------------------------------------------------------------
INIT_MMX mmxext
@@ -864,7 +901,7 @@ cglobal pred8x8_dc_8, 2,5
RET
;-----------------------------------------------------------------------------
-; void ff_pred8x8_dc_rv40_8(uint8_t *src, int stride)
+; void ff_pred8x8_dc_rv40_8(uint8_t *src, ptrdiff_t stride)
;-----------------------------------------------------------------------------
INIT_MMX mmxext
@@ -901,7 +938,7 @@ cglobal pred8x8_dc_rv40_8, 2,7
REP_RET
;-----------------------------------------------------------------------------
-; void ff_pred8x8_tm_vp8_8(uint8_t *src, int stride)
+; void ff_pred8x8_tm_vp8_8(uint8_t *src, ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED8x8_TM 0
@@ -1014,7 +1051,7 @@ cglobal pred8x8_tm_vp8_8, 2,3,6
;-----------------------------------------------------------------------------
; void ff_pred8x8l_top_dc_8(uint8_t *src, int has_topleft, int has_topright,
-; int stride)
+; ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED8x8L_TOP_DC 0
cglobal pred8x8l_top_dc_8, 4,4
@@ -1070,7 +1107,7 @@ PRED8x8L_TOP_DC
;-----------------------------------------------------------------------------
; void ff_pred8x8l_dc_8(uint8_t *src, int has_topleft, int has_topright,
-; int stride)
+; ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED8x8L_DC 0
@@ -1174,7 +1211,7 @@ PRED8x8L_DC
;-----------------------------------------------------------------------------
; void ff_pred8x8l_horizontal_8(uint8_t *src, int has_topleft,
-; int has_topright, int stride)
+; int has_topright, ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED8x8L_HORIZONTAL 0
@@ -1246,7 +1283,7 @@ PRED8x8L_HORIZONTAL
;-----------------------------------------------------------------------------
; void ff_pred8x8l_vertical_8(uint8_t *src, int has_topleft, int has_topright,
-; int stride)
+; ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED8x8L_VERTICAL 0
@@ -1297,7 +1334,7 @@ PRED8x8L_VERTICAL
;-----------------------------------------------------------------------------
; void ff_pred8x8l_down_left_8(uint8_t *src, int has_topleft,
-; int has_topright, int stride)
+; int has_topright, ptrdiff_t stride)
;-----------------------------------------------------------------------------
INIT_MMX mmxext
@@ -1498,7 +1535,7 @@ PRED8x8L_DOWN_LEFT
;-----------------------------------------------------------------------------
; void ff_pred8x8l_down_right_8_mmxext(uint8_t *src, int has_topleft,
-; int has_topright, int stride)
+; int has_topright, ptrdiff_t stride)
;-----------------------------------------------------------------------------
INIT_MMX mmxext
@@ -1750,7 +1787,7 @@ PRED8x8L_DOWN_RIGHT
;-----------------------------------------------------------------------------
; void ff_pred8x8l_vertical_right_8(uint8_t *src, int has_topleft,
-; int has_topright, int stride)
+; int has_topright, ptrdiff_t stride)
;-----------------------------------------------------------------------------
INIT_MMX mmxext
@@ -1978,7 +2015,7 @@ PRED8x8L_VERTICAL_RIGHT
;-----------------------------------------------------------------------------
; void ff_pred8x8l_vertical_left_8(uint8_t *src, int has_topleft,
-; int has_topright, int stride)
+; int has_topright, ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED8x8L_VERTICAL_LEFT 0
@@ -2068,7 +2105,7 @@ PRED8x8L_VERTICAL_LEFT
;-----------------------------------------------------------------------------
; void ff_pred8x8l_horizontal_up_8(uint8_t *src, int has_topleft,
-; int has_topright, int stride)
+; int has_topright, ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED8x8L_HORIZONTAL_UP 0
@@ -2156,7 +2193,7 @@ PRED8x8L_HORIZONTAL_UP
;-----------------------------------------------------------------------------
; void ff_pred8x8l_horizontal_down_8(uint8_t *src, int has_topleft,
-; int has_topright, int stride)
+; int has_topright, ptrdiff_t stride)
;-----------------------------------------------------------------------------
INIT_MMX mmxext
@@ -2404,7 +2441,8 @@ INIT_MMX ssse3
PRED8x8L_HORIZONTAL_DOWN
;-------------------------------------------------------------------------------
-; void ff_pred4x4_dc_8_mmxext(uint8_t *src, const uint8_t *topright, int stride)
+; void ff_pred4x4_dc_8_mmxext(uint8_t *src, const uint8_t *topright,
+; ptrdiff_t stride)
;-------------------------------------------------------------------------------
INIT_MMX mmxext
@@ -2435,7 +2473,7 @@ cglobal pred4x4_dc_8, 3,5
;-----------------------------------------------------------------------------
; void ff_pred4x4_tm_vp8_8_mmxext(uint8_t *src, const uint8_t *topright,
-; int stride)
+; ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED4x4_TM 0
@@ -2514,7 +2552,7 @@ cglobal pred4x4_tm_vp8_8, 3,3
;-----------------------------------------------------------------------------
; void ff_pred4x4_vertical_vp8_8_mmxext(uint8_t *src, const uint8_t *topright,
-; int stride)
+; ptrdiff_t stride)
;-----------------------------------------------------------------------------
INIT_MMX mmxext
@@ -2535,7 +2573,7 @@ cglobal pred4x4_vertical_vp8_8, 3,3
;-----------------------------------------------------------------------------
; void ff_pred4x4_down_left_8_mmxext(uint8_t *src, const uint8_t *topright,
-; int stride)
+; ptrdiff_t stride)
;-----------------------------------------------------------------------------
INIT_MMX mmxext
cglobal pred4x4_down_left_8, 3,3
@@ -2562,7 +2600,7 @@ cglobal pred4x4_down_left_8, 3,3
;------------------------------------------------------------------------------
; void ff_pred4x4_vertical_left_8_mmxext(uint8_t *src, const uint8_t *topright,
-; int stride)
+; ptrdiff_t stride)
;------------------------------------------------------------------------------
INIT_MMX mmxext
@@ -2588,7 +2626,7 @@ cglobal pred4x4_vertical_left_8, 3,3
;------------------------------------------------------------------------------
; void ff_pred4x4_horizontal_up_8_mmxext(uint8_t *src, const uint8_t *topright,
-; int stride)
+; ptrdiff_t stride)
;------------------------------------------------------------------------------
INIT_MMX mmxext
@@ -2622,7 +2660,8 @@ cglobal pred4x4_horizontal_up_8, 3,3
;------------------------------------------------------------------------------
; void ff_pred4x4_horizontal_down_8_mmxext(uint8_t *src,
-; const uint8_t *topright, int stride)
+; const uint8_t *topright,
+; ptrdiff_t stride)
;------------------------------------------------------------------------------
INIT_MMX mmxext
@@ -2658,7 +2697,8 @@ cglobal pred4x4_horizontal_down_8, 3,3
;-----------------------------------------------------------------------------
; void ff_pred4x4_vertical_right_8_mmxext(uint8_t *src,
-; const uint8_t *topright, int stride)
+; const uint8_t *topright,
+; ptrdiff_t stride)
;-----------------------------------------------------------------------------
INIT_MMX mmxext
@@ -2689,7 +2729,7 @@ cglobal pred4x4_vertical_right_8, 3,3
;-----------------------------------------------------------------------------
; void ff_pred4x4_down_right_8_mmxext(uint8_t *src, const uint8_t *topright,
-; int stride)
+; ptrdiff_t stride)
;-----------------------------------------------------------------------------
INIT_MMX mmxext
diff --git a/media/ffvpx/libavcodec/x86/h264_intrapred_10bit.asm b/media/ffvpx/libavcodec/x86/h264_intrapred_10bit.asm
index 9e40cfe24b..629e0a72e3 100644
--- a/media/ffvpx/libavcodec/x86/h264_intrapred_10bit.asm
+++ b/media/ffvpx/libavcodec/x86/h264_intrapred_10bit.asm
@@ -51,7 +51,8 @@ SECTION .text
%endmacro
;-----------------------------------------------------------------------------
-; void ff_pred4x4_down_right(pixel *src, const pixel *topright, int stride)
+; void ff_pred4x4_down_right_10(pixel *src, const pixel *topright,
+; ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED4x4_DR 0
cglobal pred4x4_down_right_10, 3, 3
@@ -89,7 +90,8 @@ PRED4x4_DR
%endif
;------------------------------------------------------------------------------
-; void ff_pred4x4_vertical_right(pixel *src, const pixel *topright, int stride)
+; void ff_pred4x4_vertical_right_10(pixel *src, const pixel *topright,
+; ptrdiff_t stride)
;------------------------------------------------------------------------------
%macro PRED4x4_VR 0
cglobal pred4x4_vertical_right_10, 3, 3, 6
@@ -128,7 +130,8 @@ PRED4x4_VR
%endif
;-------------------------------------------------------------------------------
-; void ff_pred4x4_horizontal_down(pixel *src, const pixel *topright, int stride)
+; void ff_pred4x4_horizontal_down_10(pixel *src, const pixel *topright,
+; ptrdiff_t stride)
;-------------------------------------------------------------------------------
%macro PRED4x4_HD 0
cglobal pred4x4_horizontal_down_10, 3, 3
@@ -170,7 +173,7 @@ PRED4x4_HD
%endif
;-----------------------------------------------------------------------------
-; void ff_pred4x4_dc(pixel *src, const pixel *topright, int stride)
+; void ff_pred4x4_dc_10(pixel *src, const pixel *topright, ptrdiff_t stride)
;-----------------------------------------------------------------------------
INIT_MMX mmxext
@@ -195,7 +198,8 @@ cglobal pred4x4_dc_10, 3, 3
RET
;-----------------------------------------------------------------------------
-; void ff_pred4x4_down_left(pixel *src, const pixel *topright, int stride)
+; void ff_pred4x4_down_left_10(pixel *src, const pixel *topright,
+; ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED4x4_DL 0
cglobal pred4x4_down_left_10, 3, 3
@@ -225,7 +229,8 @@ PRED4x4_DL
%endif
;-----------------------------------------------------------------------------
-; void ff_pred4x4_vertical_left(pixel *src, const pixel *topright, int stride)
+; void ff_pred4x4_vertical_left_10(pixel *src, const pixel *topright,
+; ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED4x4_VL 0
cglobal pred4x4_vertical_left_10, 3, 3
@@ -254,7 +259,8 @@ PRED4x4_VL
%endif
;-----------------------------------------------------------------------------
-; void ff_pred4x4_horizontal_up(pixel *src, const pixel *topright, int stride)
+; void ff_pred4x4_horizontal_up_10(pixel *src, const pixel *topright,
+; ptrdiff_t stride)
;-----------------------------------------------------------------------------
INIT_MMX mmxext
cglobal pred4x4_horizontal_up_10, 3, 3
@@ -288,7 +294,7 @@ cglobal pred4x4_horizontal_up_10, 3, 3
;-----------------------------------------------------------------------------
-; void ff_pred8x8_vertical(pixel *src, int stride)
+; void ff_pred8x8_vertical_10(pixel *src, ptrdiff_t stride)
;-----------------------------------------------------------------------------
INIT_XMM sse2
cglobal pred8x8_vertical_10, 2, 2
@@ -304,7 +310,7 @@ cglobal pred8x8_vertical_10, 2, 2
RET
;-----------------------------------------------------------------------------
-; void ff_pred8x8_horizontal(pixel *src, int stride)
+; void ff_pred8x8_horizontal_10(pixel *src, ptrdiff_t stride)
;-----------------------------------------------------------------------------
INIT_XMM sse2
cglobal pred8x8_horizontal_10, 2, 3
@@ -324,7 +330,7 @@ cglobal pred8x8_horizontal_10, 2, 3
REP_RET
;-----------------------------------------------------------------------------
-; void ff_predict_8x8_dc(pixel *src, int stride)
+; void ff_predict_8x8_dc_10(pixel *src, ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro MOV8 2-3
; sort of a hack, but it works
@@ -411,7 +417,7 @@ INIT_XMM sse2
PRED8x8_DC pshuflw
;-----------------------------------------------------------------------------
-; void ff_pred8x8_top_dc(pixel *src, int stride)
+; void ff_pred8x8_top_dc_10(pixel *src, ptrdiff_t stride)
;-----------------------------------------------------------------------------
INIT_XMM sse2
cglobal pred8x8_top_dc_10, 2, 4
@@ -438,7 +444,7 @@ cglobal pred8x8_top_dc_10, 2, 4
RET
;-----------------------------------------------------------------------------
-; void ff_pred8x8_plane(pixel *src, int stride)
+; void ff_pred8x8_plane_10(pixel *src, ptrdiff_t stride)
;-----------------------------------------------------------------------------
INIT_XMM sse2
cglobal pred8x8_plane_10, 2, 7, 7
@@ -501,8 +507,8 @@ cglobal pred8x8_plane_10, 2, 7, 7
;-----------------------------------------------------------------------------
-; void ff_pred8x8l_128_dc(pixel *src, int has_topleft, int has_topright,
-; int stride)
+; void ff_pred8x8l_128_dc_10(pixel *src, int has_topleft, int has_topright,
+; ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED8x8L_128_DC 0
cglobal pred8x8l_128_dc_10, 4, 4
@@ -526,8 +532,8 @@ INIT_XMM sse2
PRED8x8L_128_DC
;-----------------------------------------------------------------------------
-; void ff_pred8x8l_top_dc(pixel *src, int has_topleft, int has_topright,
-; int stride)
+; void ff_pred8x8l_top_dc_10(pixel *src, int has_topleft, int has_topright,
+; ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED8x8L_TOP_DC 0
cglobal pred8x8l_top_dc_10, 4, 4, 6
@@ -566,7 +572,8 @@ PRED8x8L_TOP_DC
%endif
;-------------------------------------------------------------------------------
-; void ff_pred8x8l_dc(pixel *src, int has_topleft, int has_topright, int stride)
+; void ff_pred8x8l_dc_10(pixel *src, int has_topleft, int has_topright,
+; ptrdiff_t stride)
;-------------------------------------------------------------------------------
;TODO: see if scalar is faster
%macro PRED8x8L_DC 0
@@ -625,8 +632,8 @@ PRED8x8L_DC
%endif
;-----------------------------------------------------------------------------
-; void ff_pred8x8l_vertical(pixel *src, int has_topleft, int has_topright,
-; int stride)
+; void ff_pred8x8l_vertical_10(pixel *src, int has_topleft, int has_topright,
+; ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED8x8L_VERTICAL 0
cglobal pred8x8l_vertical_10, 4, 4, 6
@@ -661,8 +668,8 @@ PRED8x8L_VERTICAL
%endif
;-----------------------------------------------------------------------------
-; void ff_pred8x8l_horizontal(uint8_t *src, int has_topleft, int has_topright,
-; int stride)
+; void ff_pred8x8l_horizontal_10(uint8_t *src, int has_topleft,
+; int has_topright, ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED8x8L_HORIZONTAL 0
cglobal pred8x8l_horizontal_10, 4, 4, 5
@@ -718,8 +725,8 @@ PRED8x8L_HORIZONTAL
%endif
;-----------------------------------------------------------------------------
-; void ff_pred8x8l_down_left(pixel *src, int has_topleft, int has_topright,
-; int stride)
+; void ff_pred8x8l_down_left_10(pixel *src, int has_topleft, int has_topright,
+; ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED8x8L_DOWN_LEFT 0
cglobal pred8x8l_down_left_10, 4, 4, 7
@@ -787,8 +794,8 @@ PRED8x8L_DOWN_LEFT
%endif
;-----------------------------------------------------------------------------
-; void ff_pred8x8l_down_right(pixel *src, int has_topleft, int has_topright,
-; int stride)
+; void ff_pred8x8l_down_right_10(pixel *src, int has_topleft,
+; int has_topright, ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED8x8L_DOWN_RIGHT 0
; standard forbids this when has_topleft is false
@@ -862,8 +869,8 @@ PRED8x8L_DOWN_RIGHT
%endif
;-----------------------------------------------------------------------------
-; void ff_pred8x8l_vertical_right(pixel *src, int has_topleft,
-; int has_topright, int stride)
+; void ff_pred8x8l_vertical_right_10(pixel *src, int has_topleft,
+; int has_topright, ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED8x8L_VERTICAL_RIGHT 0
; likewise with 8x8l_down_right
@@ -933,8 +940,8 @@ PRED8x8L_VERTICAL_RIGHT
%endif
;-----------------------------------------------------------------------------
-; void ff_pred8x8l_horizontal_up(pixel *src, int has_topleft,
-; int has_topright, int stride)
+; void ff_pred8x8l_horizontal_up_10(pixel *src, int has_topleft,
+; int has_topright, ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED8x8L_HORIZONTAL_UP 0
cglobal pred8x8l_horizontal_up_10, 4, 4, 6
@@ -996,7 +1003,7 @@ PRED8x8L_HORIZONTAL_UP
;-----------------------------------------------------------------------------
-; void ff_pred16x16_vertical(pixel *src, int stride)
+; void ff_pred16x16_vertical_10(pixel *src, ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro MOV16 3-5
mova [%1+ 0], %2
@@ -1032,7 +1039,7 @@ INIT_XMM sse2
PRED16x16_VERTICAL
;-----------------------------------------------------------------------------
-; void ff_pred16x16_horizontal(pixel *src, int stride)
+; void ff_pred16x16_horizontal_10(pixel *src, ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED16x16_HORIZONTAL 0
cglobal pred16x16_horizontal_10, 2, 3
@@ -1056,7 +1063,7 @@ INIT_XMM sse2
PRED16x16_HORIZONTAL
;-----------------------------------------------------------------------------
-; void ff_pred16x16_dc(pixel *src, int stride)
+; void ff_pred16x16_dc_10(pixel *src, ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED16x16_DC 0
cglobal pred16x16_dc_10, 2, 6
@@ -1102,7 +1109,7 @@ INIT_XMM sse2
PRED16x16_DC
;-----------------------------------------------------------------------------
-; void ff_pred16x16_top_dc(pixel *src, int stride)
+; void ff_pred16x16_top_dc_10(pixel *src, ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED16x16_TOP_DC 0
cglobal pred16x16_top_dc_10, 2, 3
@@ -1134,7 +1141,7 @@ INIT_XMM sse2
PRED16x16_TOP_DC
;-----------------------------------------------------------------------------
-; void ff_pred16x16_left_dc(pixel *src, int stride)
+; void ff_pred16x16_left_dc_10(pixel *src, ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED16x16_LEFT_DC 0
cglobal pred16x16_left_dc_10, 2, 6
@@ -1171,7 +1178,7 @@ INIT_XMM sse2
PRED16x16_LEFT_DC
;-----------------------------------------------------------------------------
-; void ff_pred16x16_128_dc(pixel *src, int stride)
+; void ff_pred16x16_128_dc_10(pixel *src, ptrdiff_t stride)
;-----------------------------------------------------------------------------
%macro PRED16x16_128_DC 0
cglobal pred16x16_128_dc_10, 2,3
diff --git a/media/ffvpx/libavcodec/x86/h264_intrapred_init.c b/media/ffvpx/libavcodec/x86/h264_intrapred_init.c
index 528b92e497..bdd5125d68 100644
--- a/media/ffvpx/libavcodec/x86/h264_intrapred_init.c
+++ b/media/ffvpx/libavcodec/x86/h264_intrapred_init.c
@@ -127,6 +127,7 @@ PRED16x16(plane_svq3, 8, ssse3)
PRED16x16(tm_vp8, 8, mmx)
PRED16x16(tm_vp8, 8, mmxext)
PRED16x16(tm_vp8, 8, sse2)
+PRED16x16(tm_vp8, 8, avx2)
PRED8x8(top_dc, 8, mmxext)
PRED8x8(dc_rv40, 8, mmxext)
@@ -323,6 +324,12 @@ av_cold void ff_h264_pred_init_x86(H264PredContext *h, int codec_id,
}
}
}
+
+ if(EXTERNAL_AVX2(cpu_flags)){
+ if (codec_id == AV_CODEC_ID_VP8) {
+ h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_8_avx2;
+ }
+ }
} else if (bit_depth == 10) {
if (EXTERNAL_MMXEXT(cpu_flags)) {
h->pred4x4[DC_PRED ] = ff_pred4x4_dc_10_mmxext;
diff --git a/media/ffvpx/libavcodec/x86/videodsp.asm b/media/ffvpx/libavcodec/x86/videodsp.asm
index a807d3b888..e237860700 100644
--- a/media/ffvpx/libavcodec/x86/videodsp.asm
+++ b/media/ffvpx/libavcodec/x86/videodsp.asm
@@ -114,7 +114,7 @@ cglobal emu_edge_hvar, 5, 6, 1, dst, dst_stride, start_x, n_words, h, w
.x_loop: ; do {
movu [dstq+wq*2], m0 ; write($reg, $mmsize)
add wq, mmsize/2 ; w -= $mmsize/2
- cmp wq, -mmsize/2 ; } while (w > $mmsize/2)
+ cmp wq, -(mmsize/2) ; } while (w > $mmsize/2)
jl .x_loop
movu [dstq-mmsize], m0 ; write($reg, $mmsize)
add dstq, dst_strideq ; dst += dst_stride
diff --git a/media/ffvpx/libavcodec/x86/videodsp_init.c b/media/ffvpx/libavcodec/x86/videodsp_init.c
index 26e072bb12..eeebb41547 100644
--- a/media/ffvpx/libavcodec/x86/videodsp_init.c
+++ b/media/ffvpx/libavcodec/x86/videodsp_init.c
@@ -29,7 +29,7 @@
#include "libavutil/x86/cpu.h"
#include "libavcodec/videodsp.h"
-#if HAVE_YASM
+#if HAVE_X86ASM
typedef void emu_edge_vfix_func(uint8_t *dst, x86_reg dst_stride,
const uint8_t *src, x86_reg src_stride,
x86_reg start_y, x86_reg end_y, x86_reg bh);
@@ -271,14 +271,14 @@ static av_noinline void emulated_edge_mc_avx2(uint8_t *buf, const uint8_t *src,
hfixtbl_avx2, &ff_emu_edge_hvar_avx2);
}
#endif /* HAVE_AVX2_EXTERNAL */
-#endif /* HAVE_YASM */
+#endif /* HAVE_X86ASM */
void ff_prefetch_mmxext(uint8_t *buf, ptrdiff_t stride, int h);
void ff_prefetch_3dnow(uint8_t *buf, ptrdiff_t stride, int h);
av_cold void ff_videodsp_init_x86(VideoDSPContext *ctx, int bpc)
{
-#if HAVE_YASM
+#if HAVE_X86ASM
int cpu_flags = av_get_cpu_flags();
#if ARCH_X86_32
@@ -305,5 +305,5 @@ av_cold void ff_videodsp_init_x86(VideoDSPContext *ctx, int bpc)
ctx->emulated_edge_mc = emulated_edge_mc_avx2;
}
#endif
-#endif /* HAVE_YASM */
+#endif /* HAVE_X86ASM */
}
diff --git a/media/ffvpx/libavcodec/x86/vp8dsp.asm b/media/ffvpx/libavcodec/x86/vp8dsp.asm
index 538b3f4a9b..e303b80293 100644
--- a/media/ffvpx/libavcodec/x86/vp8dsp.asm
+++ b/media/ffvpx/libavcodec/x86/vp8dsp.asm
@@ -156,8 +156,8 @@ SECTION .text
;-------------------------------------------------------------------------------
; subpel MC functions:
;
-; void ff_put_vp8_epel<size>_h<htap>v<vtap>_<opt>(uint8_t *dst, int deststride,
-; uint8_t *src, int srcstride,
+; void ff_put_vp8_epel<size>_h<htap>v<vtap>_<opt>(uint8_t *dst, ptrdiff_t deststride,
+; uint8_t *src, ptrdiff_t srcstride,
; int height, int mx, int my);
;-------------------------------------------------------------------------------
@@ -884,7 +884,7 @@ cglobal put_vp8_pixels16, 5, 5, 2, dst, dststride, src, srcstride, height
REP_RET
;-----------------------------------------------------------------------------
-; void ff_vp8_idct_dc_add_<opt>(uint8_t *dst, int16_t block[16], int stride);
+; void ff_vp8_idct_dc_add_<opt>(uint8_t *dst, int16_t block[16], ptrdiff_t stride);
;-----------------------------------------------------------------------------
%macro ADD_DC 4
@@ -906,6 +906,7 @@ cglobal put_vp8_pixels16, 5, 5, 2, dst, dststride, src, srcstride, height
%4 [dst2q+strideq+%3], m5
%endmacro
+%if ARCH_X86_32
INIT_MMX mmx
cglobal vp8_idct_dc_add, 3, 3, 0, dst, block, stride
; load data
@@ -929,8 +930,9 @@ cglobal vp8_idct_dc_add, 3, 3, 0, dst, block, stride
lea dst2q, [dst1q+strideq*2]
ADD_DC m0, m1, 0, movh
RET
+%endif
-INIT_XMM sse4
+%macro VP8_IDCT_DC_ADD 0
cglobal vp8_idct_dc_add, 3, 3, 6, dst, block, stride
; load data
movd m0, [blockq]
@@ -956,13 +958,28 @@ cglobal vp8_idct_dc_add, 3, 3, 6, dst, block, stride
paddw m4, m0
packuswb m2, m4
movd [dst1q], m2
+%if cpuflag(sse4)
pextrd [dst1q+strideq], m2, 1
pextrd [dst2q], m2, 2
pextrd [dst2q+strideq], m2, 3
+%else
+ psrldq m2, 4
+ movd [dst1q+strideq], m2
+ psrldq m2, 4
+ movd [dst2q], m2
+ psrldq m2, 4
+ movd [dst2q+strideq], m2
+%endif
RET
+%endmacro
+
+INIT_XMM sse2
+VP8_IDCT_DC_ADD
+INIT_XMM sse4
+VP8_IDCT_DC_ADD
;-----------------------------------------------------------------------------
-; void ff_vp8_idct_dc_add4y_<opt>(uint8_t *dst, int16_t block[4][16], int stride);
+; void ff_vp8_idct_dc_add4y_<opt>(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride);
;-----------------------------------------------------------------------------
%if ARCH_X86_32
@@ -1035,7 +1052,7 @@ cglobal vp8_idct_dc_add4y, 3, 3, 6, dst, block, stride
RET
;-----------------------------------------------------------------------------
-; void ff_vp8_idct_dc_add4uv_<opt>(uint8_t *dst, int16_t block[4][16], int stride);
+; void ff_vp8_idct_dc_add4uv_<opt>(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride);
;-----------------------------------------------------------------------------
INIT_MMX mmx
@@ -1077,7 +1094,7 @@ cglobal vp8_idct_dc_add4uv, 3, 3, 0, dst, block, stride
RET
;-----------------------------------------------------------------------------
-; void ff_vp8_idct_add_<opt>(uint8_t *dst, int16_t block[16], int stride);
+; void ff_vp8_idct_add_<opt>(uint8_t *dst, int16_t block[16], ptrdiff_t stride);
;-----------------------------------------------------------------------------
; calculate %1=mul_35468(%1)-mul_20091(%2); %2=mul_20091(%1)+mul_35468(%2)
diff --git a/media/ffvpx/libavcodec/x86/vp8dsp_init.c b/media/ffvpx/libavcodec/x86/vp8dsp_init.c
index 897d5a0e77..397b2518cb 100644
--- a/media/ffvpx/libavcodec/x86/vp8dsp_init.c
+++ b/media/ffvpx/libavcodec/x86/vp8dsp_init.c
@@ -26,7 +26,7 @@
#include "libavutil/x86/cpu.h"
#include "libavcodec/vp8dsp.h"
-#if HAVE_YASM
+#if HAVE_X86ASM
/*
* MC functions
@@ -233,6 +233,8 @@ HVBILIN(ssse3, 8, 16, 16)
void ff_vp8_idct_dc_add_mmx(uint8_t *dst, int16_t block[16],
ptrdiff_t stride);
+void ff_vp8_idct_dc_add_sse2(uint8_t *dst, int16_t block[16],
+ ptrdiff_t stride);
void ff_vp8_idct_dc_add_sse4(uint8_t *dst, int16_t block[16],
ptrdiff_t stride);
void ff_vp8_idct_dc_add4y_mmx(uint8_t *dst, int16_t block[4][16],
@@ -288,7 +290,7 @@ DECLARE_LOOP_FILTER(sse2)
DECLARE_LOOP_FILTER(ssse3)
DECLARE_LOOP_FILTER(sse4)
-#endif /* HAVE_YASM */
+#endif /* HAVE_X86ASM */
#define VP8_LUMA_MC_FUNC(IDX, SIZE, OPT) \
c->put_vp8_epel_pixels_tab[IDX][0][2] = ff_put_vp8_epel ## SIZE ## _h6_ ## OPT; \
@@ -316,7 +318,7 @@ DECLARE_LOOP_FILTER(sse4)
av_cold void ff_vp78dsp_init_x86(VP8DSPContext *c)
{
-#if HAVE_YASM
+#if HAVE_X86ASM
int cpu_flags = av_get_cpu_flags();
if (EXTERNAL_MMX(cpu_flags)) {
@@ -346,7 +348,7 @@ av_cold void ff_vp78dsp_init_x86(VP8DSPContext *c)
c->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_sse;
}
- if (HAVE_SSE2_EXTERNAL && cpu_flags & (AV_CPU_FLAG_SSE2 | AV_CPU_FLAG_SSE2SLOW)) {
+ if (EXTERNAL_SSE2(cpu_flags) || EXTERNAL_SSE2_SLOW(cpu_flags)) {
VP8_LUMA_MC_FUNC(0, 16, sse2);
VP8_MC_FUNC(1, 8, sse2);
VP8_BILINEAR_MC_FUNC(0, 16, sse2);
@@ -361,18 +363,18 @@ av_cold void ff_vp78dsp_init_x86(VP8DSPContext *c)
VP8_BILINEAR_MC_FUNC(1, 8, ssse3);
VP8_BILINEAR_MC_FUNC(2, 4, ssse3);
}
-#endif /* HAVE_YASM */
+#endif /* HAVE_X86ASM */
}
av_cold void ff_vp8dsp_init_x86(VP8DSPContext *c)
{
-#if HAVE_YASM
+#if HAVE_X86ASM
int cpu_flags = av_get_cpu_flags();
if (EXTERNAL_MMX(cpu_flags)) {
- c->vp8_idct_dc_add = ff_vp8_idct_dc_add_mmx;
c->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_mmx;
#if ARCH_X86_32
+ c->vp8_idct_dc_add = ff_vp8_idct_dc_add_mmx;
c->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_mmx;
c->vp8_idct_add = ff_vp8_idct_add_mmx;
c->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_mmx;
@@ -416,7 +418,7 @@ av_cold void ff_vp8dsp_init_x86(VP8DSPContext *c)
c->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_sse;
}
- if (HAVE_SSE2_EXTERNAL && cpu_flags & (AV_CPU_FLAG_SSE2 | AV_CPU_FLAG_SSE2SLOW)) {
+ if (EXTERNAL_SSE2(cpu_flags) || EXTERNAL_SSE2_SLOW(cpu_flags)) {
c->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter_simple_sse2;
c->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16y_inner_sse2;
@@ -427,6 +429,7 @@ av_cold void ff_vp8dsp_init_x86(VP8DSPContext *c)
}
if (EXTERNAL_SSE2(cpu_flags)) {
+ c->vp8_idct_dc_add = ff_vp8_idct_dc_add_sse2;
c->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_sse2;
c->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter_simple_sse2;
@@ -460,5 +463,5 @@ av_cold void ff_vp8dsp_init_x86(VP8DSPContext *c)
c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16y_mbedge_sse4;
c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_sse4;
}
-#endif /* HAVE_YASM */
+#endif /* HAVE_X86ASM */
}
diff --git a/media/ffvpx/libavcodec/x86/vp8dsp_loopfilter.asm b/media/ffvpx/libavcodec/x86/vp8dsp_loopfilter.asm
index 98bb6696a0..caeb405267 100644
--- a/media/ffvpx/libavcodec/x86/vp8dsp_loopfilter.asm
+++ b/media/ffvpx/libavcodec/x86/vp8dsp_loopfilter.asm
@@ -43,7 +43,7 @@ cextern pb_80
SECTION .text
;-----------------------------------------------------------------------------
-; void ff_vp8_h/v_loop_filter_simple_<opt>(uint8_t *dst, int stride, int flim);
+; void ff_vp8_h/v_loop_filter_simple_<opt>(uint8_t *dst, ptrdiff_t stride, int flim);
;-----------------------------------------------------------------------------
; macro called with 7 mm register indexes as argument, and 4 regular registers
@@ -429,7 +429,7 @@ INIT_XMM sse4
SIMPLE_LOOPFILTER h, 5
;-----------------------------------------------------------------------------
-; void ff_vp8_h/v_loop_filter<size>_inner_<opt>(uint8_t *dst, [uint8_t *v,] int stride,
+; void ff_vp8_h/v_loop_filter<size>_inner_<opt>(uint8_t *dst, [uint8_t *v,] ptrdiff_t stride,
; int flimE, int flimI, int hev_thr);
;-----------------------------------------------------------------------------
@@ -921,7 +921,7 @@ INNER_LOOPFILTER v, 8
INNER_LOOPFILTER h, 8
;-----------------------------------------------------------------------------
-; void ff_vp8_h/v_loop_filter<size>_mbedge_<opt>(uint8_t *dst, [uint8_t *v,] int stride,
+; void ff_vp8_h/v_loop_filter<size>_mbedge_<opt>(uint8_t *dst, [uint8_t *v,] ptrdiff_t stride,
; int flimE, int flimI, int hev_thr);
;-----------------------------------------------------------------------------
diff --git a/media/ffvpx/libavcodec/x86/vp9dsp_init.c b/media/ffvpx/libavcodec/x86/vp9dsp_init.c
index cc781a009b..837cce8508 100644
--- a/media/ffvpx/libavcodec/x86/vp9dsp_init.c
+++ b/media/ffvpx/libavcodec/x86/vp9dsp_init.c
@@ -27,7 +27,7 @@
#include "libavcodec/vp9dsp.h"
#include "libavcodec/x86/vp9dsp_init.h"
-#if HAVE_YASM
+#if HAVE_X86ASM
decl_fpel_func(put, 4, , mmx);
decl_fpel_func(put, 8, , mmx);
@@ -114,7 +114,7 @@ itxfm_func(idct, idct, 32, sse2);
itxfm_func(idct, idct, 32, ssse3);
itxfm_func(idct, idct, 32, avx);
itxfm_func(iwht, iwht, 4, mmx);
-itxfm_func(idct, idct, 16, avx2);
+itxfm_funcs(16, avx2);
itxfm_func(idct, idct, 32, avx2);
#undef itxfm_func
@@ -212,11 +212,11 @@ ipred_func(32, tm, avx2);
#undef ipred_dir_tm_funcs
#undef ipred_dc_funcs
-#endif /* HAVE_YASM */
+#endif /* HAVE_X86ASM */
av_cold void ff_vp9dsp_init_x86(VP9DSPContext *dsp, int bpp, int bitexact)
{
-#if HAVE_YASM
+#if HAVE_X86ASM
int cpu_flags;
if (bpp == 10) {
@@ -391,6 +391,12 @@ av_cold void ff_vp9dsp_init_x86(VP9DSPContext *dsp, int bpp, int bitexact)
if (ARCH_X86_64) {
#if ARCH_X86_64 && HAVE_AVX2_EXTERNAL
dsp->itxfm_add[TX_16X16][DCT_DCT] = ff_vp9_idct_idct_16x16_add_avx2;
+ dsp->itxfm_add[TX_16X16][ADST_DCT] = ff_vp9_idct_iadst_16x16_add_avx2;
+ dsp->itxfm_add[TX_16X16][DCT_ADST] = ff_vp9_iadst_idct_16x16_add_avx2;
+ dsp->itxfm_add[TX_16X16][ADST_ADST] = ff_vp9_iadst_iadst_16x16_add_avx2;
+ dsp->itxfm_add[TX_32X32][ADST_ADST] =
+ dsp->itxfm_add[TX_32X32][ADST_DCT] =
+ dsp->itxfm_add[TX_32X32][DCT_ADST] =
dsp->itxfm_add[TX_32X32][DCT_DCT] = ff_vp9_idct_idct_32x32_add_avx2;
init_subpel3_32_64(0, put, 8, avx2);
init_subpel3_32_64(1, avg, 8, avx2);
@@ -406,5 +412,5 @@ av_cold void ff_vp9dsp_init_x86(VP9DSPContext *dsp, int bpp, int bitexact)
#undef init_subpel2
#undef init_subpel3
-#endif /* HAVE_YASM */
+#endif /* HAVE_X86ASM */
}
diff --git a/media/ffvpx/libavcodec/x86/vp9dsp_init_16bpp.c b/media/ffvpx/libavcodec/x86/vp9dsp_init_16bpp.c
index eb67499c96..60d10a12a3 100644
--- a/media/ffvpx/libavcodec/x86/vp9dsp_init_16bpp.c
+++ b/media/ffvpx/libavcodec/x86/vp9dsp_init_16bpp.c
@@ -27,7 +27,7 @@
#include "libavcodec/vp9dsp.h"
#include "libavcodec/x86/vp9dsp_init.h"
-#if HAVE_YASM
+#if HAVE_X86ASM
decl_fpel_func(put, 8, , mmx);
decl_fpel_func(avg, 8, _16, mmxext);
@@ -51,6 +51,10 @@ decl_ipred_fns(h, 16, mmxext, sse2);
decl_ipred_fns(dc, 16, mmxext, sse2);
decl_ipred_fns(dc_top, 16, mmxext, sse2);
decl_ipred_fns(dc_left, 16, mmxext, sse2);
+decl_ipred_fn(dl, 16, 16, avx2);
+decl_ipred_fn(dl, 32, 16, avx2);
+decl_ipred_fn(dr, 16, 16, avx2);
+decl_ipred_fn(dr, 32, 16, avx2);
#define decl_ipred_dir_funcs(type) \
decl_ipred_fns(type, 16, sse2, sse2); \
@@ -63,11 +67,11 @@ decl_ipred_dir_funcs(vl);
decl_ipred_dir_funcs(vr);
decl_ipred_dir_funcs(hu);
decl_ipred_dir_funcs(hd);
-#endif /* HAVE_YASM */
+#endif /* HAVE_X86ASM */
av_cold void ff_vp9dsp_init_16bpp_x86(VP9DSPContext *dsp)
{
-#if HAVE_YASM
+#if HAVE_X86ASM
int cpu_flags = av_get_cpu_flags();
if (EXTERNAL_MMX(cpu_flags)) {
@@ -133,7 +137,13 @@ av_cold void ff_vp9dsp_init_16bpp_x86(VP9DSPContext *dsp)
init_fpel_func(2, 1, 32, avg, _16, avx2);
init_fpel_func(1, 1, 64, avg, _16, avx2);
init_fpel_func(0, 1, 128, avg, _16, avx2);
+ init_ipred_func(dl, DIAG_DOWN_LEFT, 16, 16, avx2);
+ init_ipred_func(dl, DIAG_DOWN_LEFT, 32, 16, avx2);
+ init_ipred_func(dr, DIAG_DOWN_RIGHT, 16, 16, avx2);
+#if ARCH_X86_64
+ init_ipred_func(dr, DIAG_DOWN_RIGHT, 32, 16, avx2);
+#endif
}
-#endif /* HAVE_YASM */
+#endif /* HAVE_X86ASM */
}
diff --git a/media/ffvpx/libavcodec/x86/vp9dsp_init_16bpp_template.c b/media/ffvpx/libavcodec/x86/vp9dsp_init_16bpp_template.c
index 4840b2844e..b56afc7f50 100644
--- a/media/ffvpx/libavcodec/x86/vp9dsp_init_16bpp_template.c
+++ b/media/ffvpx/libavcodec/x86/vp9dsp_init_16bpp_template.c
@@ -27,7 +27,7 @@
#include "libavcodec/vp9dsp.h"
#include "libavcodec/x86/vp9dsp_init.h"
-#if HAVE_YASM
+#if HAVE_X86ASM
extern const int16_t ff_filters_16bpp[3][15][4][16];
@@ -137,11 +137,11 @@ decl_itxfm_func(iadst, iadst, 4, BPC, sse2);
decl_itxfm_funcs(8, BPC, sse2);
decl_itxfm_funcs(16, BPC, sse2);
decl_itxfm_func(idct, idct, 32, BPC, sse2);
-#endif /* HAVE_YASM */
+#endif /* HAVE_X86ASM */
av_cold void INIT_FUNC(VP9DSPContext *dsp, int bitexact)
{
-#if HAVE_YASM
+#if HAVE_X86ASM
int cpu_flags = av_get_cpu_flags();
#define init_lpf_8_func(idx1, idx2, dir, wd, bpp, opt) \
@@ -234,7 +234,7 @@ av_cold void INIT_FUNC(VP9DSPContext *dsp, int bitexact)
#endif
}
-#endif /* HAVE_YASM */
+#endif /* HAVE_X86ASM */
ff_vp9dsp_init_16bpp_x86(dsp);
}
diff --git a/media/ffvpx/libavcodec/x86/vp9intrapred_16bpp.asm b/media/ffvpx/libavcodec/x86/vp9intrapred_16bpp.asm
index c0ac16d3eb..32b698243a 100644
--- a/media/ffvpx/libavcodec/x86/vp9intrapred_16bpp.asm
+++ b/media/ffvpx/libavcodec/x86/vp9intrapred_16bpp.asm
@@ -847,6 +847,108 @@ DL_FUNCS
INIT_XMM avx
DL_FUNCS
+%if HAVE_AVX2_EXTERNAL
+INIT_YMM avx2
+cglobal vp9_ipred_dl_16x16_16, 2, 4, 5, dst, stride, l, a
+ movifnidn aq, amp
+ mova m0, [aq] ; abcdefghijklmnop
+ vpbroadcastw xm1, [aq+30] ; pppppppp
+ vperm2i128 m2, m0, m1, q0201 ; ijklmnoppppppppp
+ vpalignr m3, m2, m0, 2 ; bcdefghijklmnopp
+ vpalignr m4, m2, m0, 4 ; cdefghijklmnoppp
+ LOWPASS 0, 3, 4 ; BCDEFGHIJKLMNOPp
+ vperm2i128 m2, m0, m1, q0201 ; JKLMNOPppppppppp
+ DEFINE_ARGS dst, stride, stride3, cnt
+ mov cntd, 2
+ lea stride3q, [strideq*3]
+
+.loop:
+ mova [dstq+strideq*0], m0
+ vpalignr m3, m2, m0, 2
+ vpalignr m4, m2, m0, 4
+ mova [dstq+strideq*1], m3
+ mova [dstq+strideq*2], m4
+ vpalignr m3, m2, m0, 6
+ vpalignr m4, m2, m0, 8
+ mova [dstq+stride3q ], m3
+ lea dstq, [dstq+strideq*4]
+ mova [dstq+strideq*0], m4
+ vpalignr m3, m2, m0, 10
+ vpalignr m4, m2, m0, 12
+ mova [dstq+strideq*1], m3
+ mova [dstq+strideq*2], m4
+ vpalignr m3, m2, m0, 14
+ mova [dstq+stride3q ], m3
+ lea dstq, [dstq+strideq*4]
+ mova m0, m2
+ vperm2i128 m2, m2, m2, q0101 ; pppppppppppppppp
+ dec cntd
+ jg .loop
+ RET
+
+cglobal vp9_ipred_dl_32x32_16, 2, 6, 7, dst, stride, l, a
+ movifnidn aq, amp
+ mova m0, [aq+mmsize*0+ 0] ; abcdefghijklmnop
+ mova m1, [aq+mmsize*1+ 0] ; qrstuvwxyz012345
+ vpbroadcastw xm4, [aq+mmsize*1+30] ; 55555555
+ vperm2i128 m5, m0, m1, q0201 ; ijklmnopqrstuvwx
+ vpalignr m2, m5, m0, 2 ; bcdefghijklmnopq
+ vpalignr m3, m5, m0, 4 ; cdefghijklmnopqr
+ LOWPASS 0, 2, 3 ; BCDEFGHIJKLMNOPQ
+ vperm2i128 m5, m1, m4, q0201 ; yz01234555555555
+ vpalignr m2, m5, m1, 2 ; rstuvwxyz0123455
+ vpalignr m3, m5, m1, 4 ; stuvwxyz01234555
+ LOWPASS 1, 2, 3 ; RSTUVWXYZ......5
+ vperm2i128 m2, m1, m4, q0201 ; Z......555555555
+ vperm2i128 m5, m0, m1, q0201 ; JKLMNOPQRSTUVWXY
+ DEFINE_ARGS dst, stride, stride3, cnt
+ lea stride3q, [strideq*3]
+ mov cntd, 4
+
+.loop:
+ mova [dstq+strideq*0 + 0], m0
+ mova [dstq+strideq*0 +32], m1
+ vpalignr m3, m5, m0, 2
+ vpalignr m4, m2, m1, 2
+ mova [dstq+strideq*1 + 0], m3
+ mova [dstq+strideq*1 +32], m4
+ vpalignr m3, m5, m0, 4
+ vpalignr m4, m2, m1, 4
+ mova [dstq+strideq*2 + 0], m3
+ mova [dstq+strideq*2 +32], m4
+ vpalignr m3, m5, m0, 6
+ vpalignr m4, m2, m1, 6
+ mova [dstq+stride3q*1+ 0], m3
+ mova [dstq+stride3q*1+32], m4
+ lea dstq, [dstq+strideq*4]
+ vpalignr m3, m5, m0, 8
+ vpalignr m4, m2, m1, 8
+ mova [dstq+strideq*0 + 0], m3
+ mova [dstq+strideq*0 +32], m4
+ vpalignr m3, m5, m0, 10
+ vpalignr m4, m2, m1, 10
+ mova [dstq+strideq*1 + 0], m3
+ mova [dstq+strideq*1 +32], m4
+ vpalignr m3, m5, m0, 12
+ vpalignr m4, m2, m1, 12
+ mova [dstq+strideq*2+ 0], m3
+ mova [dstq+strideq*2+32], m4
+ vpalignr m3, m5, m0, 14
+ vpalignr m4, m2, m1, 14
+ mova [dstq+stride3q+ 0], m3
+ mova [dstq+stride3q+ 32], m4
+ vpalignr m3, m5, m0, 16
+ vpalignr m4, m2, m1, 16
+ vperm2i128 m5, m3, m4, q0201
+ vperm2i128 m2, m4, m4, q0101
+ mova m0, m3
+ mova m1, m4
+ lea dstq, [dstq+strideq*4]
+ dec cntd
+ jg .loop
+ RET
+%endif
+
%macro DR_FUNCS 1 ; stack_mem_for_32x32_32bit_function
cglobal vp9_ipred_dr_4x4_16, 4, 4, 3, dst, stride, l, a
movh m0, [lq] ; wxyz....
@@ -1068,6 +1170,161 @@ DR_FUNCS 2
INIT_XMM avx
DR_FUNCS 2
+%if HAVE_AVX2_EXTERNAL
+INIT_YMM avx2
+cglobal vp9_ipred_dr_16x16_16, 4, 5, 6, dst, stride, l, a
+ mova m0, [lq] ; klmnopqrstuvwxyz
+ movu m1, [aq-2] ; *abcdefghijklmno
+ mova m2, [aq] ; abcdefghijklmnop
+ vperm2i128 m4, m2, m2, q2001 ; ijklmnop........
+ vpalignr m5, m4, m2, 2 ; bcdefghijklmnop.
+ vperm2i128 m3, m0, m1, q0201 ; stuvwxyz*abcdefg
+ LOWPASS 1, 2, 5 ; ABCDEFGHIJKLMNO.
+ vpalignr m4, m3, m0, 2 ; lmnopqrstuvwxyz*
+ vpalignr m5, m3, m0, 4 ; mnopqrstuvwxyz*a
+ LOWPASS 0, 4, 5 ; LMNOPQRSTUVWXYZ#
+ vperm2i128 m5, m0, m1, q0201 ; TUVWXYZ#ABCDEFGH
+ DEFINE_ARGS dst, stride, stride3, stride5, dst3
+ lea dst3q, [dstq+strideq*4]
+ lea stride3q, [strideq*3]
+ lea stride5q, [stride3q+strideq*2]
+
+ vpalignr m3, m5, m0, 2
+ vpalignr m4, m1, m5, 2
+ mova [dst3q+stride5q*2], m3 ; 14
+ mova [ dstq+stride3q*2], m4 ; 6
+ vpalignr m3, m5, m0, 4
+ vpalignr m4, m1, m5, 4
+ sub dst3q, strideq
+ mova [dst3q+stride5q*2], m3 ; 13
+ mova [dst3q+strideq*2 ], m4 ; 5
+ mova [dst3q+stride3q*4], m0 ; 15
+ vpalignr m3, m5, m0, 6
+ vpalignr m4, m1, m5, 6
+ mova [dstq+stride3q*4], m3 ; 12
+ mova [dst3q+strideq*1], m4 ; 4
+ vpalignr m3, m5, m0, 8
+ vpalignr m4, m1, m5, 8
+ mova [dst3q+strideq*8], m3 ; 11
+ mova [dst3q+strideq*0], m4 ; 3
+ vpalignr m3, m5, m0, 10
+ vpalignr m4, m1, m5, 10
+ mova [dstq+stride5q*2], m3 ; 10
+ mova [dstq+strideq*2 ], m4 ; 2
+ vpalignr m3, m5, m0, 12
+ vpalignr m4, m1, m5, 12
+ mova [dst3q+stride3q*2], m3 ; 9
+ mova [dstq+strideq*1 ], m4 ; 1
+ vpalignr m3, m5, m0, 14
+ vpalignr m4, m1, m5, 14
+ mova [dstq+strideq*8], m3 ; 8
+ mova [dstq+strideq*0], m4 ; 0
+ mova [dst3q+strideq*4], m5 ; 7
+ RET
+
+%if ARCH_X86_64
+cglobal vp9_ipred_dr_32x32_16, 4, 7, 10, dst, stride, l, a
+ mova m0, [lq+mmsize*0+0] ; l[0-15]
+ mova m1, [lq+mmsize*1+0] ; l[16-31]
+ movu m2, [aq+mmsize*0-2] ; *abcdefghijklmno
+ mova m3, [aq+mmsize*0+0] ; abcdefghijklmnop
+ mova m4, [aq+mmsize*1+0] ; qrstuvwxyz012345
+ vperm2i128 m5, m0, m1, q0201 ; lmnopqrstuvwxyz0
+ vpalignr m6, m5, m0, 2 ; mnopqrstuvwxyz01
+ vpalignr m7, m5, m0, 4 ; nopqrstuvwxyz012
+ LOWPASS 0, 6, 7 ; L[0-15]
+ vperm2i128 m7, m1, m2, q0201 ; stuvwxyz*abcdefg
+ vpalignr m5, m7, m1, 2 ; lmnopqrstuvwxyz*
+ vpalignr m6, m7, m1, 4 ; mnopqrstuvwxyz*a
+ LOWPASS 1, 5, 6 ; L[16-31]#
+ vperm2i128 m5, m3, m4, q0201 ; ijklmnopqrstuvwx
+ vpalignr m6, m5, m3, 2 ; bcdefghijklmnopq
+ LOWPASS 2, 3, 6 ; A[0-15]
+ movu m3, [aq+mmsize*1-2] ; pqrstuvwxyz01234
+ vperm2i128 m6, m4, m4, q2001 ; yz012345........
+ vpalignr m7, m6, m4, 2 ; rstuvwxyz012345.
+ LOWPASS 3, 4, 7 ; A[16-31].
+ vperm2i128 m4, m1, m2, q0201 ; TUVWXYZ#ABCDEFGH
+ vperm2i128 m5, m0, m1, q0201 ; L[7-15]L[16-23]
+ vperm2i128 m8, m2, m3, q0201 ; IJKLMNOPQRSTUVWX
+ DEFINE_ARGS dst8, stride, stride3, stride7, stride5, dst24, cnt
+ lea stride3q, [strideq*3]
+ lea stride5q, [stride3q+strideq*2]
+ lea stride7q, [strideq*4+stride3q]
+ lea dst24q, [dst8q+stride3q*8]
+ lea dst8q, [dst8q+strideq*8]
+ mov cntd, 2
+
+.loop:
+ mova [dst24q+stride7q+0 ], m0 ; 31 23 15 7
+ mova [dst24q+stride7q+32], m1
+ mova [dst8q+stride7q+0], m1
+ mova [dst8q+stride7q+32], m2
+ vpalignr m6, m4, m1, 2
+ vpalignr m7, m5, m0, 2
+ vpalignr m9, m8, m2, 2
+ mova [dst24q+stride3q*2+0], m7 ; 30 22 14 6
+ mova [dst24q+stride3q*2+32], m6
+ mova [dst8q+stride3q*2+0], m6
+ mova [dst8q+stride3q*2+32], m9
+ vpalignr m6, m4, m1, 4
+ vpalignr m7, m5, m0, 4
+ vpalignr m9, m8, m2, 4
+ mova [dst24q+stride5q+0], m7 ; 29 21 13 5
+ mova [dst24q+stride5q+32], m6
+ mova [dst8q+stride5q+0], m6
+ mova [dst8q+stride5q+32], m9
+ vpalignr m6, m4, m1, 6
+ vpalignr m7, m5, m0, 6
+ vpalignr m9, m8, m2, 6
+ mova [dst24q+strideq*4+0 ], m7 ; 28 20 12 4
+ mova [dst24q+strideq*4+32], m6
+ mova [dst8q+strideq*4+0], m6
+ mova [dst8q+strideq*4+32], m9
+ vpalignr m6, m4, m1, 8
+ vpalignr m7, m5, m0, 8
+ vpalignr m9, m8, m2, 8
+ mova [dst24q+stride3q+0 ], m7 ; 27 19 11 3
+ mova [dst24q+stride3q+32], m6
+ mova [dst8q+stride3q+0], m6
+ mova [dst8q+stride3q+32], m9
+ vpalignr m6, m4, m1, 10
+ vpalignr m7, m5, m0, 10
+ vpalignr m9, m8, m2, 10
+ mova [dst24q+strideq*2+0 ], m7 ; 26 18 10 2
+ mova [dst24q+strideq*2+32], m6
+ mova [dst8q+strideq*2+0], m6
+ mova [dst8q+strideq*2+32], m9
+ vpalignr m6, m4, m1, 12
+ vpalignr m7, m5, m0, 12
+ vpalignr m9, m8, m2, 12
+ mova [dst24q+strideq+0 ], m7 ; 25 17 9 1
+ mova [dst24q+strideq+32], m6
+ mova [dst8q+strideq+0], m6
+ mova [dst8q+strideq+32], m9
+ vpalignr m6, m4, m1, 14
+ vpalignr m7, m5, m0, 14
+ vpalignr m9, m8, m2, 14
+ mova [dst24q+strideq*0+0 ], m7 ; 24 16 8 0
+ mova [dst24q+strideq*0+32], m6
+ mova [dst8q+strideq*0+0], m6
+ mova [dst8q+strideq*0+32], m9
+ mova m0, m5
+ mova m5, m1
+ mova m1, m4
+ mova m4, m2
+ mova m2, m8
+ mova m8, m3
+ sub dst24q, stride7q
+ sub dst24q, strideq
+ sub dst8q, stride7q
+ sub dst8q, strideq
+ dec cntd
+ jg .loop
+ RET
+%endif
+%endif
+
%macro VL_FUNCS 1 ; stack_mem_for_32x32_32bit_function
cglobal vp9_ipred_vl_4x4_16, 2, 4, 3, dst, stride, l, a
movifnidn aq, amp
diff --git a/media/ffvpx/libavcodec/x86/vp9itxfm.asm b/media/ffvpx/libavcodec/x86/vp9itxfm.asm
index 57d6d353bd..2c63fe514a 100644
--- a/media/ffvpx/libavcodec/x86/vp9itxfm.asm
+++ b/media/ffvpx/libavcodec/x86/vp9itxfm.asm
@@ -1581,33 +1581,30 @@ cglobal vp9_idct_idct_16x16_add, 4, 4, 16, dst, stride, block, eob
VP9_IDCT16_YMM_1D
mova [blockq+224], m7
- mova [blockq+480], m15
- pxor m15, m15
; store
- VP9_IDCT8_WRITEx2 0, 1, 6, 7, 15, [pw_512], 6
+ VP9_IDCT8_WRITEx2 0, 1, 6, 7, unused, [pw_512], 6
lea dstq, [dstq+2*strideq]
- VP9_IDCT8_WRITEx2 2, 3, 6, 7, 15, [pw_512], 6
+ VP9_IDCT8_WRITEx2 2, 3, 6, 7, unused, [pw_512], 6
lea dstq, [dstq+2*strideq]
- VP9_IDCT8_WRITEx2 4, 5, 6, 7, 15, [pw_512], 6
+ VP9_IDCT8_WRITEx2 4, 5, 6, 7, unused, [pw_512], 6
lea dstq, [dstq+2*strideq]
mova m6, [blockq+192]
mova m7, [blockq+224]
- SWAP 0, 15
- mova m15, [blockq+480]
- VP9_IDCT8_WRITEx2 6, 7, 1, 2, 0, [pw_512], 6
+ VP9_IDCT8_WRITEx2 6, 7, 1, 2, unused, [pw_512], 6
lea dstq, [dstq+2*strideq]
- VP9_IDCT8_WRITEx2 8, 9, 1, 2, 0, [pw_512], 6
+ VP9_IDCT8_WRITEx2 8, 9, 1, 2, unused, [pw_512], 6
lea dstq, [dstq+2*strideq]
- VP9_IDCT8_WRITEx2 10, 11, 1, 2, 0, [pw_512], 6
+ VP9_IDCT8_WRITEx2 10, 11, 1, 2, unused, [pw_512], 6
lea dstq, [dstq+2*strideq]
- VP9_IDCT8_WRITEx2 12, 13, 1, 2, 0, [pw_512], 6
+ VP9_IDCT8_WRITEx2 12, 13, 1, 2, unused, [pw_512], 6
lea dstq, [dstq+2*strideq]
- VP9_IDCT8_WRITEx2 14, 15, 1, 2, 0, [pw_512], 6
+ VP9_IDCT8_WRITEx2 14, 15, 1, 2, unused, [pw_512], 6
lea dstq, [dstq+2*strideq]
; at the end of the loop, m0 should still be zero
; use that to zero out block coefficients
+ pxor m0, m0
ZERO_BLOCK blockq, 32, 16, m0
RET
%endif
@@ -1987,6 +1984,173 @@ IADST16_FN idct, IDCT16, iadst, IADST16, avx
IADST16_FN iadst, IADST16, idct, IDCT16, avx
IADST16_FN iadst, IADST16, iadst, IADST16, avx
+; in: data in m[0-15] except m0/m4, which are in [blockq+0] and [blockq+128]
+; out: m[0-15] except m6, which is in [blockq+192]
+; uses blockq as scratch space
+%macro VP9_IADST16_YMM_1D 0
+ mova [blockq+ 32], m3
+ mova [blockq+ 64], m7
+ mova [blockq+ 96], m8
+
+ ; first half of round 1
+ VP9_UNPACK_MULSUB_2D_4X 9, 6, 0, 3, 13160, 9760 ; m9/x=t7[d], m6/x=t6[d]
+ VP9_UNPACK_MULSUB_2D_4X 1, 14, 4, 7, 2404, 16207 ; m1/x=t15[d], m14/x=t14[d]
+ VP9_RND_SH_SUMSUB_BA 14, 6, 7, 3, 8, [pd_8192] ; m14=t6[w], m6=t14[w]
+ VP9_RND_SH_SUMSUB_BA 1, 9, 4, 0, 8, [pd_8192] ; m1=t7[w], m9=t15[w]
+
+ VP9_UNPACK_MULSUB_2D_4X 13, 2, 4, 7, 15893, 3981 ; m13/x=t3[d], m2/x=t2[d]
+ VP9_UNPACK_MULSUB_2D_4X 5, 10, 0, 3, 8423, 14053 ; m5/x=t11[d], m10/x=t10[d]
+ VP9_RND_SH_SUMSUB_BA 10, 2, 3, 7, 8, [pd_8192] ; m10=t2[w], m2=t10[w]
+ VP9_RND_SH_SUMSUB_BA 5, 13, 0, 4, 8, [pd_8192] ; m5=t3[w], m13=t11[w]
+
+ ; half of round 2 t8-15
+ VP9_UNPACK_MULSUB_2D_4X 2, 13, 4, 7, 9102, 13623 ; m2/x=t11[d], m13/x=t10[d]
+ VP9_UNPACK_MULSUB_2D_4X 9, 6, 3, 0, 13623, 9102 ; m9/x=t14[d], m6/x=t15[d]
+ VP9_RND_SH_SUMSUB_BA 9, 13, 3, 7, 8, [pd_8192] ; m9=t10[w], m13=t14[w]
+ VP9_RND_SH_SUMSUB_BA 6, 2, 0, 4, 8, [pd_8192] ; m6=t11[w], m2=t15[w]
+
+ SUMSUB_BA w, 14, 10, 8 ; m14=t2, m10=t6
+ SUMSUB_BA w, 1, 5, 8 ; m1=t3, m5=t7
+
+ mova m0, [blockq+ 0]
+ mova m4, [blockq+128]
+ mova m3, [blockq+ 32]
+ mova m7, [blockq+ 64]
+ mova m8, [blockq+ 96]
+ mova [blockq+ 0], m1
+ mova [blockq+128], m14
+ mova [blockq+ 32], m6
+ mova [blockq+ 64], m9
+ mova [blockq+ 96], m10
+
+ ; second half of round 1
+ VP9_UNPACK_MULSUB_2D_4X 15, 0, 1, 9, 16364, 804 ; m15/x=t1[d], m0/x=t0[d]
+ VP9_UNPACK_MULSUB_2D_4X 7, 8, 10, 6, 11003, 12140 ; m7/x=t9[d], m8/x=t8[d]
+ VP9_RND_SH_SUMSUB_BA 8, 0, 6, 9, 14, [pd_8192] ; m8=t0[w], m0=t8[w]
+ VP9_RND_SH_SUMSUB_BA 7, 15, 10, 1, 14, [pd_8192] ; m7=t1[w], m15=t9[w]
+
+ VP9_UNPACK_MULSUB_2D_4X 11, 4, 10, 6, 14811, 7005 ; m11/x=t5[d], m4/x=t4[d]
+ VP9_UNPACK_MULSUB_2D_4X 3, 12, 1, 9, 5520, 15426 ; m3/x=t13[d], m12/x=t12[d]
+ VP9_RND_SH_SUMSUB_BA 12, 4, 9, 6, 14, [pd_8192] ; m12=t4[w], m4=t12[w]
+ VP9_RND_SH_SUMSUB_BA 3, 11, 1, 10, 14, [pd_8192] ; m3=t5[w], m11=t13[w]
+
+ ; second half of round 2 t8-15
+ VP9_UNPACK_MULSUB_2D_4X 0, 15, 6, 10, 16069, 3196 ; m15/x=t8[d], m0/x=t9[d]
+ VP9_UNPACK_MULSUB_2D_4X 11, 4, 9, 1, 3196, 16069 ; m11/x=t12[d], m4/x=t13[d]
+ VP9_RND_SH_SUMSUB_BA 11, 15, 9, 10, 14, [pd_8192] ; m11=t8[w], m15=t12[w]
+ VP9_RND_SH_SUMSUB_BA 4, 0, 1, 6, 14, [pd_8192] ; m4=t9[w], m0=t13[w]
+
+ SUMSUB_BA w, 12, 8, 14 ; m12=t0, m8=t4
+ SUMSUB_BA w, 3, 7, 14 ; m3=t1, m7=t5
+
+ mova m10, [blockq+ 96]
+ mova [blockq+ 96], m12
+
+ ; round 3
+ VP9_UNPACK_MULSUB_2D_4X 15, 0, 9, 12, 15137, 6270 ; m15/x=t13[d], m0/x=t12[d]
+ VP9_UNPACK_MULSUB_2D_4X 2, 13, 1, 6, 6270, 15137 ; m2/x=t14[d], m13/x=t15[d]
+ VP9_RND_SH_SUMSUB_BA 2, 0, 1, 12, 14, [pd_8192] ; m2=out2[w], m0=t14a[w]
+ VP9_RND_SH_SUMSUB_BA 13, 15, 6, 9, 14, [pd_8192]
+ PSIGNW m13, [pw_m1] ; m13=out13[w], m15=t15a[w]
+
+ VP9_UNPACK_MULSUB_2D_4X 8, 7, 12, 9, 15137, 6270 ; m8/x=t5[d], m7/x=t4[d]
+ VP9_UNPACK_MULSUB_2D_4X 5, 10, 1, 6, 6270, 15137 ; m5/x=t6[d], m10/x=t7[d]
+ VP9_RND_SH_SUMSUB_BA 5, 7, 1, 9, 14, [pd_8192]
+ PSIGNW m5, [pw_m1] ; m5=out3[w], m7=t6[w]
+ VP9_RND_SH_SUMSUB_BA 10, 8, 6, 12, 14, [pd_8192] ; m10=out12[w], m8=t7[w]
+
+ mova m1, [blockq+ 0]
+ mova m14, [blockq+128]
+ mova m6, [blockq+ 32]
+ mova m9, [blockq+ 64]
+ mova m12, [blockq+ 96]
+ mova [blockq+ 0], m10
+ mova [blockq+128], m5
+
+ SUMSUB_BA w, 14, 12, 5 ; m14=out0, m12=t2a
+ SUMSUB_BA w, 1, 3, 5
+ PSIGNW m1, [pw_m1] ; m1=out15, m3=t3a
+
+ SUMSUB_BA w, 9, 11, 5
+ PSIGNW m9, [pw_m1] ; m9=out1, m11=t10
+ SUMSUB_BA w, 6, 4, 5 ; m6=out14, m4=t11
+
+ VP9_UNPACK_MULSUB_2W_4X 4, 11, 11585, 11585, [pd_8192], 5, 10 ; m4=out9, m11=out6
+ mova m5, [blockq+128]
+ mova [blockq+192], m11
+ PSIGNW m15, [pw_m1]
+ VP9_UNPACK_MULSUB_2W_4X 15, 0, 11585, 11585, [pd_8192], 10, 11 ; m15=out5, m0=out10
+
+ PSIGNW m3, [pw_m1]
+ VP9_UNPACK_MULSUB_2W_4X 3, 12, 11585, 11585, [pd_8192], 10, 11 ; m3=out7,m12=out8
+ VP9_UNPACK_MULSUB_2W_4X 8, 7, 11585, 11585, [pd_8192], 10, 11 ; m8=out11,m7=out4
+
+ mova m10, [blockq+ 0]
+
+ SWAP 0, 14, 6, 11, 8, 12, 10
+ SWAP 1, 9, 15, 4, 7, 3, 5
+ SWAP 5, 9, 15
+%endmacro
+
+%if ARCH_X86_64 && HAVE_AVX2_EXTERNAL
+%macro IADST16_YMM_FN 4
+INIT_YMM avx2
+cglobal vp9_%1_%3_16x16_add, 4, 4, 16, dst, stride, block, eob
+ mova m1, [blockq+ 32]
+ mova m2, [blockq+ 64]
+ mova m3, [blockq+ 96]
+ mova m5, [blockq+160]
+ mova m6, [blockq+192]
+ mova m7, [blockq+224]
+ mova m8, [blockq+256]
+ mova m9, [blockq+288]
+ mova m10, [blockq+320]
+ mova m11, [blockq+352]
+ mova m12, [blockq+384]
+ mova m13, [blockq+416]
+ mova m14, [blockq+448]
+ mova m15, [blockq+480]
+
+ VP9_%2_YMM_1D
+ TRANSPOSE16x16W 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, \
+ [blockq+192], [blockq+128], 1
+ mova [blockq+ 0], m0
+ VP9_%4_YMM_1D
+
+ mova [blockq+224], m7
+
+ ; store
+ VP9_IDCT8_WRITEx2 0, 1, 6, 7, unused, [pw_512], 6
+ lea dstq, [dstq+2*strideq]
+ VP9_IDCT8_WRITEx2 2, 3, 6, 7, unused, [pw_512], 6
+ lea dstq, [dstq+2*strideq]
+ VP9_IDCT8_WRITEx2 4, 5, 6, 7, unused, [pw_512], 6
+ lea dstq, [dstq+2*strideq]
+ mova m6, [blockq+192]
+ mova m7, [blockq+224]
+ VP9_IDCT8_WRITEx2 6, 7, 1, 2, unused, [pw_512], 6
+ lea dstq, [dstq+2*strideq]
+ VP9_IDCT8_WRITEx2 8, 9, 1, 2, unused, [pw_512], 6
+ lea dstq, [dstq+2*strideq]
+ VP9_IDCT8_WRITEx2 10, 11, 1, 2, unused, [pw_512], 6
+ lea dstq, [dstq+2*strideq]
+ VP9_IDCT8_WRITEx2 12, 13, 1, 2, unused, [pw_512], 6
+ lea dstq, [dstq+2*strideq]
+ VP9_IDCT8_WRITEx2 14, 15, 1, 2, unused, [pw_512], 6
+ lea dstq, [dstq+2*strideq]
+
+ ; at the end of the loop, m0 should still be zero
+ ; use that to zero out block coefficients
+ pxor m0, m0
+ ZERO_BLOCK blockq, 32, 16, m0
+ RET
+%endmacro
+
+IADST16_YMM_FN idct, IDCT16, iadst, IADST16
+IADST16_YMM_FN iadst, IADST16, idct, IDCT16
+IADST16_YMM_FN iadst, IADST16, iadst, IADST16
+%endif
+
;---------------------------------------------------------------------------------------------
; void vp9_idct_idct_32x32_add_<opt>(uint8_t *dst, ptrdiff_t stride, int16_t *block, int eob);
;---------------------------------------------------------------------------------------------
diff --git a/media/ffvpx/libavcodec/x86/vp9mc.asm b/media/ffvpx/libavcodec/x86/vp9mc.asm
index 9152ba541b..f64161b2c2 100644
--- a/media/ffvpx/libavcodec/x86/vp9mc.asm
+++ b/media/ffvpx/libavcodec/x86/vp9mc.asm
@@ -1,5 +1,5 @@
;******************************************************************************
-;* VP9 MC SIMD optimizations
+;* VP9 motion compensation SIMD optimizations
;*
;* Copyright (c) 2013 Ronald S. Bultje <rsbultje gmail com>
;*
@@ -440,9 +440,8 @@ cglobal vp9_%1_8tap_1d_v_ %+ %%px %+ _8, 4, 7, 11, dst, dstride, src, sstride, f
mova m10, [filteryq+96]
%endif
.loop:
- ; FIXME maybe reuse loads from previous rows, or just
- ; more generally unroll this to prevent multiple loads of
- ; the same data?
+ ; FIXME maybe reuse loads from previous rows, or just more generally
+ ; unroll this to prevent multiple loads of the same data?
movh m0, [srcq]
movh m1, [srcq+sstrideq]
movh m2, [srcq+sstrideq*2]
diff --git a/media/ffvpx/libavutil/atomic_gcc.h b/media/ffvpx/libavutil/atomic_gcc.h
index 5f9fc49ba0..2bb43c3cea 100644
--- a/media/ffvpx/libavutil/atomic_gcc.h
+++ b/media/ffvpx/libavutil/atomic_gcc.h
@@ -28,40 +28,27 @@
#define avpriv_atomic_int_get atomic_int_get_gcc
static inline int atomic_int_get_gcc(volatile int *ptr)
{
-#if HAVE_ATOMIC_COMPARE_EXCHANGE
- return __atomic_load_n(ptr, __ATOMIC_SEQ_CST);
-#else
__sync_synchronize();
return *ptr;
-#endif
}
#define avpriv_atomic_int_set atomic_int_set_gcc
static inline void atomic_int_set_gcc(volatile int *ptr, int val)
{
-#if HAVE_ATOMIC_COMPARE_EXCHANGE
- __atomic_store_n(ptr, val, __ATOMIC_SEQ_CST);
-#else
*ptr = val;
__sync_synchronize();
-#endif
}
#define avpriv_atomic_int_add_and_fetch atomic_int_add_and_fetch_gcc
static inline int atomic_int_add_and_fetch_gcc(volatile int *ptr, int inc)
{
-#if HAVE_ATOMIC_COMPARE_EXCHANGE
- return __atomic_add_fetch(ptr, inc, __ATOMIC_SEQ_CST);
-#else
return __sync_add_and_fetch(ptr, inc);
-#endif
}
#define avpriv_atomic_ptr_cas atomic_ptr_cas_gcc
static inline void *atomic_ptr_cas_gcc(void * volatile *ptr,
void *oldval, void *newval)
{
-#if HAVE_SYNC_VAL_COMPARE_AND_SWAP
#ifdef __ARMCC_VERSION
// armcc will throw an error if ptr is not an integer type
volatile uintptr_t *tmp = (volatile uintptr_t*)ptr;
@@ -69,10 +56,6 @@ static inline void *atomic_ptr_cas_gcc(void * volatile *ptr,
#else
return __sync_val_compare_and_swap(ptr, oldval, newval);
#endif
-#else
- __atomic_compare_exchange_n(ptr, &oldval, newval, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
- return oldval;
-#endif
}
#endif /* AVUTIL_ATOMIC_GCC_H */
diff --git a/media/ffvpx/libavutil/atomic_suncc.h b/media/ffvpx/libavutil/atomic_suncc.h
deleted file mode 100644
index a75a37b47e..0000000000
--- a/media/ffvpx/libavutil/atomic_suncc.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_ATOMIC_SUNCC_H
-#define AVUTIL_ATOMIC_SUNCC_H
-
-#include <atomic.h>
-#include <mbarrier.h>
-
-#include "atomic.h"
-
-#define avpriv_atomic_int_get atomic_int_get_suncc
-static inline int atomic_int_get_suncc(volatile int *ptr)
-{
- __machine_rw_barrier();
- return *ptr;
-}
-
-#define avpriv_atomic_int_set atomic_int_set_suncc
-static inline void atomic_int_set_suncc(volatile int *ptr, int val)
-{
- *ptr = val;
- __machine_rw_barrier();
-}
-
-#define avpriv_atomic_int_add_and_fetch atomic_int_add_and_fetch_suncc
-static inline int atomic_int_add_and_fetch_suncc(volatile int *ptr, int inc)
-{
- return atomic_add_int_nv(ptr, inc);
-}
-
-#define avpriv_atomic_ptr_cas atomic_ptr_cas_suncc
-static inline void *atomic_ptr_cas_suncc(void * volatile *ptr,
- void *oldval, void *newval)
-{
- return atomic_cas_ptr(ptr, oldval, newval);
-}
-
-#endif /* AVUTIL_ATOMIC_SUNCC_H */
diff --git a/media/ffvpx/libavutil/attributes.h b/media/ffvpx/libavutil/attributes.h
index 5c6b9deecb..54d1901116 100644
--- a/media/ffvpx/libavutil/attributes.h
+++ b/media/ffvpx/libavutil/attributes.h
@@ -121,8 +121,7 @@
#endif
#endif
-
-#if defined(__GNUC__)
+#if defined(__GNUC__) || defined(__clang__)
# define av_unused __attribute__((unused))
#else
# define av_unused
@@ -133,7 +132,7 @@
* away. This is useful for variables accessed only from inline
* assembler without the compiler being aware.
*/
-#if AV_GCC_VERSION_AT_LEAST(3,1)
+#if AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__)
# define av_used __attribute__((used))
#else
# define av_used
diff --git a/media/ffvpx/libavutil/avconfig.h b/media/ffvpx/libavutil/avconfig.h
index 2ec333d158..f10aa6186b 100644
--- a/media/ffvpx/libavutil/avconfig.h
+++ b/media/ffvpx/libavutil/avconfig.h
@@ -3,5 +3,4 @@
#define AVUTIL_AVCONFIG_H
#define AV_HAVE_BIGENDIAN 0
#define AV_HAVE_FAST_UNALIGNED 1
-#define AV_HAVE_INCOMPATIBLE_FORK_ABI 0
#endif /* AVUTIL_AVCONFIG_H */
diff --git a/media/ffvpx/libavutil/avstring.c b/media/ffvpx/libavutil/avstring.c
index 1787a1ef54..f03dd25141 100644
--- a/media/ffvpx/libavutil/avstring.c
+++ b/media/ffvpx/libavutil/avstring.c
@@ -231,6 +231,29 @@ int av_strncasecmp(const char *a, const char *b, size_t n)
return c1 - c2;
}
+char *av_strireplace(const char *str, const char *from, const char *to)
+{
+ char *ret = NULL;
+ const char *pstr2, *pstr = str;
+ size_t tolen = strlen(to), fromlen = strlen(from);
+ AVBPrint pbuf;
+
+ av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED);
+ while ((pstr2 = av_stristr(pstr, from))) {
+ av_bprint_append_data(&pbuf, pstr, pstr2 - pstr);
+ pstr = pstr2 + fromlen;
+ av_bprint_append_data(&pbuf, to, tolen);
+ }
+ av_bprint_append_data(&pbuf, pstr, strlen(pstr));
+ if (!av_bprint_is_complete(&pbuf)) {
+ av_bprint_finalize(&pbuf, NULL);
+ } else {
+ av_bprint_finalize(&pbuf, &ret);
+ }
+
+ return ret;
+}
+
const char *av_basename(const char *path)
{
char *p = strrchr(path, '/');
diff --git a/media/ffvpx/libavutil/avstring.h b/media/ffvpx/libavutil/avstring.h
index dd2876990f..04d2695640 100644
--- a/media/ffvpx/libavutil/avstring.h
+++ b/media/ffvpx/libavutil/avstring.h
@@ -266,6 +266,11 @@ int av_strcasecmp(const char *a, const char *b);
*/
int av_strncasecmp(const char *a, const char *b, size_t n);
+/**
+ * Locale-independent strings replace.
+ * @note This means only ASCII-range characters are replace
+ */
+char *av_strireplace(const char *str, const char *from, const char *to);
/**
* Thread safe basename.
diff --git a/media/ffvpx/libavutil/avutil.h b/media/ffvpx/libavutil/avutil.h
index 29dd830bf5..4d633156d1 100644
--- a/media/ffvpx/libavutil/avutil.h
+++ b/media/ffvpx/libavutil/avutil.h
@@ -118,6 +118,12 @@
*
* @}
*
+ * @defgroup lavu_video Video related
+ *
+ * @{
+ *
+ * @}
+ *
* @defgroup lavu_audio Audio related
*
* @{
@@ -337,6 +343,20 @@ FILE *av_fopen_utf8(const char *path, const char *mode);
*/
AVRational av_get_time_base_q(void);
+#define AV_FOURCC_MAX_STRING_SIZE 32
+
+#define av_fourcc2str(fourcc) av_fourcc_make_string((char[AV_FOURCC_MAX_STRING_SIZE]){0}, fourcc)
+
+/**
+ * Fill the provided buffer with a string containing a FourCC (four-character
+ * code) representation.
+ *
+ * @param buf a buffer with size in bytes of at least AV_FOURCC_MAX_STRING_SIZE
+ * @param fourcc the fourcc to represent
+ * @return the buffer in input
+ */
+char *av_fourcc_make_string(char *buf, uint32_t fourcc);
+
/**
* @}
* @}
diff --git a/media/ffvpx/libavutil/avutil.symbols b/media/ffvpx/libavutil/avutil.symbols
index 81cf6a8ef3..ba68dc33c4 100644
--- a/media/ffvpx/libavutil/avutil.symbols
+++ b/media/ffvpx/libavutil/avutil.symbols
@@ -57,9 +57,6 @@ av_dict_parse_string
av_dict_set
av_dict_set_int
av_dirname
-av_display_matrix_flip
-av_display_rotation_get
-av_display_rotation_set
av_div_q
av_dynarray2_add
av_dynarray_add
@@ -88,7 +85,9 @@ av_find_best_pix_fmt_of_2
av_find_info_tag
av_find_nearest_q_idx
av_force_cpu_flags
+av_fourcc_make_string
av_frame_alloc
+av_frame_apply_cropping
av_frame_clone
av_frame_copy
av_frame_copy_props
@@ -166,6 +165,7 @@ av_hwframe_get_buffer
av_image_alloc
av_image_check_sar
av_image_check_size
+av_image_check_size2
av_image_copy
av_image_copy_plane
av_image_copy_to_buffer
@@ -332,5 +332,8 @@ avutil_configuration
avutil_license
avutil_version
#ifdef XP_WIN
-avpriv_emms_yasm
+avpriv_emms_asm
#endif
+avpriv_slicethread_create
+avpriv_slicethread_execute
+avpriv_slicethread_free
diff --git a/media/ffvpx/libavutil/buffer.c b/media/ffvpx/libavutil/buffer.c
index 694e116a3c..8d1aa5fa84 100644
--- a/media/ffvpx/libavutil/buffer.c
+++ b/media/ffvpx/libavutil/buffer.c
@@ -16,10 +16,10 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <stdatomic.h>
#include <stdint.h>
#include <string.h>
-#include "atomic.h"
#include "buffer_internal.h"
#include "common.h"
#include "mem.h"
@@ -40,7 +40,8 @@ AVBufferRef *av_buffer_create(uint8_t *data, int size,
buf->size = size;
buf->free = free ? free : av_buffer_default_free;
buf->opaque = opaque;
- buf->refcount = 1;
+
+ atomic_init(&buf->refcount, 1);
if (flags & AV_BUFFER_FLAG_READONLY)
buf->flags |= BUFFER_FLAG_READONLY;
@@ -98,7 +99,7 @@ AVBufferRef *av_buffer_ref(AVBufferRef *buf)
*ret = *buf;
- avpriv_atomic_int_add_and_fetch(&buf->buffer->refcount, 1);
+ atomic_fetch_add_explicit(&buf->buffer->refcount, 1, memory_order_relaxed);
return ret;
}
@@ -115,7 +116,7 @@ static void buffer_replace(AVBufferRef **dst, AVBufferRef **src)
} else
av_freep(dst);
- if (!avpriv_atomic_int_add_and_fetch(&b->refcount, -1)) {
+ if (atomic_fetch_add_explicit(&b->refcount, -1, memory_order_acq_rel) == 1) {
b->free(b->opaque, b->data);
av_freep(&b);
}
@@ -134,7 +135,7 @@ int av_buffer_is_writable(const AVBufferRef *buf)
if (buf->buffer->flags & AV_BUFFER_FLAG_READONLY)
return 0;
- return avpriv_atomic_int_get(&buf->buffer->refcount) == 1;
+ return atomic_load(&buf->buffer->refcount) == 1;
}
void *av_buffer_get_opaque(const AVBufferRef *buf)
@@ -144,7 +145,7 @@ void *av_buffer_get_opaque(const AVBufferRef *buf)
int av_buffer_get_ref_count(const AVBufferRef *buf)
{
- return buf->buffer->refcount;
+ return atomic_load(&buf->buffer->refcount);
}
int av_buffer_make_writable(AVBufferRef **pbuf)
@@ -191,7 +192,7 @@ int av_buffer_realloc(AVBufferRef **pbuf, int size)
return 0;
if (!(buf->buffer->flags & BUFFER_FLAG_REALLOCATABLE) ||
- !av_buffer_is_writable(buf)) {
+ !av_buffer_is_writable(buf) || buf->data != buf->buffer->data) {
/* cannot realloc, allocate a new reallocable buffer and copy data */
AVBufferRef *new = NULL;
@@ -229,7 +230,7 @@ AVBufferPool *av_buffer_pool_init2(int size, void *opaque,
pool->alloc2 = alloc;
pool->pool_free = pool_free;
- avpriv_atomic_int_set(&pool->refcount, 1);
+ atomic_init(&pool->refcount, 1);
return pool;
}
@@ -245,7 +246,7 @@ AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size))
pool->size = size;
pool->alloc = alloc ? alloc : av_buffer_alloc;
- avpriv_atomic_int_set(&pool->refcount, 1);
+ atomic_init(&pool->refcount, 1);
return pool;
}
@@ -280,48 +281,10 @@ void av_buffer_pool_uninit(AVBufferPool **ppool)
pool = *ppool;
*ppool = NULL;
- if (!avpriv_atomic_int_add_and_fetch(&pool->refcount, -1))
+ if (atomic_fetch_add_explicit(&pool->refcount, -1, memory_order_acq_rel) == 1)
buffer_pool_free(pool);
}
-#if USE_ATOMICS
-/* remove the whole buffer list from the pool and return it */
-static BufferPoolEntry *get_pool(AVBufferPool *pool)
-{
- BufferPoolEntry *cur = *(void * volatile *)&pool->pool, *last = NULL;
-
- while (cur != last) {
- last = cur;
- cur = avpriv_atomic_ptr_cas((void * volatile *)&pool->pool, last, NULL);
- if (!cur)
- return NULL;
- }
-
- return cur;
-}
-
-static void add_to_pool(BufferPoolEntry *buf)
-{
- AVBufferPool *pool;
- BufferPoolEntry *cur, *end = buf;
-
- if (!buf)
- return;
- pool = buf->pool;
-
- while (end->next)
- end = end->next;
-
- while (avpriv_atomic_ptr_cas((void * volatile *)&pool->pool, NULL, buf)) {
- /* pool is not empty, retrieve it and append it to our list */
- cur = get_pool(pool);
- end->next = cur;
- while (end->next)
- end = end->next;
- }
-}
-#endif
-
static void pool_release_buffer(void *opaque, uint8_t *data)
{
BufferPoolEntry *buf = opaque;
@@ -330,16 +293,12 @@ static void pool_release_buffer(void *opaque, uint8_t *data)
if(CONFIG_MEMORY_POISONING)
memset(buf->data, FF_MEMORY_POISON, pool->size);
-#if USE_ATOMICS
- add_to_pool(buf);
-#else
ff_mutex_lock(&pool->mutex);
buf->next = pool->pool;
pool->pool = buf;
ff_mutex_unlock(&pool->mutex);
-#endif
- if (!avpriv_atomic_int_add_and_fetch(&pool->refcount, -1))
+ if (atomic_fetch_add_explicit(&pool->refcount, -1, memory_order_acq_rel) == 1)
buffer_pool_free(pool);
}
@@ -369,11 +328,6 @@ static AVBufferRef *pool_alloc_buffer(AVBufferPool *pool)
ret->buffer->opaque = buf;
ret->buffer->free = pool_release_buffer;
-#if USE_ATOMICS
- avpriv_atomic_int_add_and_fetch(&pool->refcount, 1);
- avpriv_atomic_int_add_and_fetch(&pool->nb_allocated, 1);
-#endif
-
return ret;
}
@@ -382,29 +336,6 @@ AVBufferRef *av_buffer_pool_get(AVBufferPool *pool)
AVBufferRef *ret;
BufferPoolEntry *buf;
-#if USE_ATOMICS
- /* check whether the pool is empty */
- buf = get_pool(pool);
- if (!buf && pool->refcount <= pool->nb_allocated) {
- av_log(NULL, AV_LOG_DEBUG, "Pool race dectected, spining to avoid overallocation and eventual OOM\n");
- while (!buf && avpriv_atomic_int_get(&pool->refcount) <= avpriv_atomic_int_get(&pool->nb_allocated))
- buf = get_pool(pool);
- }
-
- if (!buf)
- return pool_alloc_buffer(pool);
-
- /* keep the first entry, return the rest of the list to the pool */
- add_to_pool(buf->next);
- buf->next = NULL;
-
- ret = av_buffer_create(buf->data, pool->size, pool_release_buffer,
- buf, 0);
- if (!ret) {
- add_to_pool(buf);
- return NULL;
- }
-#else
ff_mutex_lock(&pool->mutex);
buf = pool->pool;
if (buf) {
@@ -418,10 +349,9 @@ AVBufferRef *av_buffer_pool_get(AVBufferPool *pool)
ret = pool_alloc_buffer(pool);
}
ff_mutex_unlock(&pool->mutex);
-#endif
if (ret)
- avpriv_atomic_int_add_and_fetch(&pool->refcount, 1);
+ atomic_fetch_add_explicit(&pool->refcount, 1, memory_order_relaxed);
return ret;
}
diff --git a/media/ffvpx/libavutil/buffer.h b/media/ffvpx/libavutil/buffer.h
index 0c0ce12cf2..73b6bd0b14 100644
--- a/media/ffvpx/libavutil/buffer.h
+++ b/media/ffvpx/libavutil/buffer.h
@@ -256,9 +256,10 @@ AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size));
* @param alloc a function that will be used to allocate new buffers when the
* pool is empty.
* @param pool_free a function that will be called immediately before the pool
- * is freed. I.e. after av_buffer_pool_can_uninit() is called
- * by the pool and all the frames are returned to the pool and
- * freed. It is intended to uninitialize the user opaque data.
+ * is freed. I.e. after av_buffer_pool_uninit() is called
+ * by the caller and all the frames are returned to the pool
+ * and freed. It is intended to uninitialize the user opaque
+ * data.
* @return newly created buffer pool on success, NULL on error.
*/
AVBufferPool *av_buffer_pool_init2(int size, void *opaque,
diff --git a/media/ffvpx/libavutil/buffer_internal.h b/media/ffvpx/libavutil/buffer_internal.h
index 29ce8a643c..54b67047e5 100644
--- a/media/ffvpx/libavutil/buffer_internal.h
+++ b/media/ffvpx/libavutil/buffer_internal.h
@@ -19,6 +19,7 @@
#ifndef AVUTIL_BUFFER_INTERNAL_H
#define AVUTIL_BUFFER_INTERNAL_H
+#include <stdatomic.h>
#include <stdint.h>
#include "buffer.h"
@@ -40,7 +41,7 @@ struct AVBuffer {
/**
* number of existing AVBufferRef instances referring to this buffer
*/
- volatile int refcount;
+ atomic_uint refcount;
/**
* a callback for freeing the data
@@ -85,9 +86,7 @@ struct AVBufferPool {
* buffers have been released, then it's safe to free the pool and all
* the buffers in it.
*/
- volatile int refcount;
-
- volatile int nb_allocated;
+ atomic_uint refcount;
int size;
void *opaque;
diff --git a/media/ffvpx/libavutil/channel_layout.c b/media/ffvpx/libavutil/channel_layout.c
index 26c87c96a8..3bd5ee29b7 100644
--- a/media/ffvpx/libavutil/channel_layout.c
+++ b/media/ffvpx/libavutil/channel_layout.c
@@ -152,6 +152,28 @@ uint64_t av_get_channel_layout(const char *name)
return layout;
}
+int av_get_extended_channel_layout(const char *name, uint64_t* channel_layout, int* nb_channels)
+{
+ int nb = 0;
+ char *end;
+ uint64_t layout = av_get_channel_layout(name);
+
+ if (layout) {
+ *channel_layout = layout;
+ *nb_channels = av_get_channel_layout_nb_channels(layout);
+ return 0;
+ }
+
+ nb = strtol(name, &end, 10);
+ if (!errno && *end == 'C' && *(end + 1) == '\0' && nb > 0 && nb < 64) {
+ *channel_layout = 0;
+ *nb_channels = nb;
+ return 0;
+ }
+
+ return AVERROR(EINVAL);
+}
+
void av_bprint_channel_layout(struct AVBPrint *bp,
int nb_channels, uint64_t channel_layout)
{
diff --git a/media/ffvpx/libavutil/channel_layout.h b/media/ffvpx/libavutil/channel_layout.h
index ec7effead1..50bb8f03c5 100644
--- a/media/ffvpx/libavutil/channel_layout.h
+++ b/media/ffvpx/libavutil/channel_layout.h
@@ -131,22 +131,31 @@ enum AVMatrixEncoding {
* 5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix);
* - the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC,
* SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR);
- * - a number of channels, in decimal, optionally followed by 'c', yielding
+ * - a number of channels, in decimal, followed by 'c', yielding
* the default channel layout for that number of channels (@see
* av_get_default_channel_layout);
* - a channel layout mask, in hexadecimal starting with "0x" (see the
* AV_CH_* macros).
*
- * @warning Starting from the next major bump the trailing character
- * 'c' to specify a number of channels will be required, while a
- * channel layout mask could also be specified as a decimal number
- * (if and only if not followed by "c").
- *
* Example: "stereo+FC" = "2c+FC" = "2c+1c" = "0x7"
*/
uint64_t av_get_channel_layout(const char *name);
/**
+ * Return a channel layout and the number of channels based on the specified name.
+ *
+ * This function is similar to (@see av_get_channel_layout), but can also parse
+ * unknown channel layout specifications.
+ *
+ * @param[in] name channel layout specification string
+ * @param[out] channel_layout parsed channel layout (0 if unknown)
+ * @param[out] nb_channels number of channels
+ *
+ * @return 0 on success, AVERROR(EINVAL) if the parsing fails.
+ */
+int av_get_extended_channel_layout(const char *name, uint64_t* channel_layout, int* nb_channels);
+
+/**
* Return a description of a channel layout.
* If nb_channels is <= 0, it is guessed from the channel_layout.
*
diff --git a/media/ffvpx/libavutil/cpu.c b/media/ffvpx/libavutil/cpu.c
index f5785fc13f..c8401b8258 100644
--- a/media/ffvpx/libavutil/cpu.c
+++ b/media/ffvpx/libavutil/cpu.c
@@ -16,8 +16,11 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include <stddef.h>
#include <stdint.h>
+#include <stdatomic.h>
+#include "attributes.h"
#include "cpu.h"
#include "cpu_internal.h"
#include "config.h"
@@ -44,10 +47,24 @@
#include <unistd.h>
#endif
-static int flags, checked;
+static atomic_int cpu_flags = ATOMIC_VAR_INIT(-1);
+
+static int get_cpu_flags(void)
+{
+ if (ARCH_AARCH64)
+ return ff_get_cpu_flags_aarch64();
+ if (ARCH_ARM)
+ return ff_get_cpu_flags_arm();
+ if (ARCH_PPC)
+ return ff_get_cpu_flags_ppc();
+ if (ARCH_X86)
+ return ff_get_cpu_flags_x86();
+ return 0;
+}
void av_force_cpu_flags(int arg){
- if ( (arg & ( AV_CPU_FLAG_3DNOW |
+ if (ARCH_X86 &&
+ (arg & ( AV_CPU_FLAG_3DNOW |
AV_CPU_FLAG_3DNOWEXT |
AV_CPU_FLAG_MMXEXT |
AV_CPU_FLAG_SSE |
@@ -69,33 +86,23 @@ void av_force_cpu_flags(int arg){
arg |= AV_CPU_FLAG_MMX;
}
- flags = arg;
- checked = arg != -1;
+ atomic_store_explicit(&cpu_flags, arg, memory_order_relaxed);
}
int av_get_cpu_flags(void)
{
- if (checked)
- return flags;
-
- if (ARCH_AARCH64)
- flags = ff_get_cpu_flags_aarch64();
- if (ARCH_ARM)
- flags = ff_get_cpu_flags_arm();
- if (ARCH_PPC)
- flags = ff_get_cpu_flags_ppc();
- if (ARCH_X86)
- flags = ff_get_cpu_flags_x86();
-
- checked = 1;
+ int flags = atomic_load_explicit(&cpu_flags, memory_order_relaxed);
+ if (flags == -1) {
+ flags = get_cpu_flags();
+ atomic_store_explicit(&cpu_flags, flags, memory_order_relaxed);
+ }
return flags;
}
void av_set_cpu_flags_mask(int mask)
{
- checked = 0;
- flags = av_get_cpu_flags() & mask;
- checked = 1;
+ atomic_store_explicit(&cpu_flags, get_cpu_flags() & mask,
+ memory_order_relaxed);
}
int av_parse_cpu_flags(const char *s)
@@ -294,3 +301,17 @@ int av_cpu_count(void)
return nb_cpus;
}
+
+size_t av_cpu_max_align(void)
+{
+ if (ARCH_AARCH64)
+ return ff_get_cpu_max_align_aarch64();
+ if (ARCH_ARM)
+ return ff_get_cpu_max_align_arm();
+ if (ARCH_PPC)
+ return ff_get_cpu_max_align_ppc();
+ if (ARCH_X86)
+ return ff_get_cpu_max_align_x86();
+
+ return 8;
+}
diff --git a/media/ffvpx/libavutil/cpu.h b/media/ffvpx/libavutil/cpu.h
index 4bff16714a..9e5d40affe 100644
--- a/media/ffvpx/libavutil/cpu.h
+++ b/media/ffvpx/libavutil/cpu.h
@@ -21,6 +21,8 @@
#ifndef AVUTIL_CPU_H
#define AVUTIL_CPU_H
+#include <stddef.h>
+
#include "attributes.h"
#define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */
@@ -39,6 +41,7 @@
#define AV_CPU_FLAG_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster
///< than regular MMX/SSE (e.g. Core1)
#define AV_CPU_FLAG_SSSE3 0x0080 ///< Conroe SSSE3 functions
+#define AV_CPU_FLAG_SSSE3SLOW 0x4000000 ///< SSSE3 supported, but usually not faster
#define AV_CPU_FLAG_ATOM 0x10000000 ///< Atom processor, some SSSE3 instructions are slower
#define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions
#define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions
@@ -85,8 +88,6 @@ void av_force_cpu_flags(int flags);
* Set a mask on flags returned by av_get_cpu_flags().
* This function is mainly useful for testing.
* Please use av_force_cpu_flags() and av_get_cpu_flags() instead which are more flexible
- *
- * @warning this function is not thread safe.
*/
attribute_deprecated void av_set_cpu_flags_mask(int mask);
@@ -114,4 +115,15 @@ int av_parse_cpu_caps(unsigned *flags, const char *s);
*/
int av_cpu_count(void);
+/**
+ * Get the maximum data alignment that may be required by FFmpeg.
+ *
+ * Note that this is affected by the build configuration and the CPU flags mask,
+ * so e.g. if the CPU supports AVX, but libavutil has been built with
+ * --disable-avx or the AV_CPU_FLAG_AVX flag has been disabled through
+ * av_set_cpu_flags_mask(), then this function will behave as if AVX is not
+ * present.
+ */
+size_t av_cpu_max_align(void);
+
#endif /* AVUTIL_CPU_H */
diff --git a/media/ffvpx/libavutil/cpu_internal.h b/media/ffvpx/libavutil/cpu_internal.h
index 6c352abe1b..b8bf1e5396 100644
--- a/media/ffvpx/libavutil/cpu_internal.h
+++ b/media/ffvpx/libavutil/cpu_internal.h
@@ -44,4 +44,9 @@ int ff_get_cpu_flags_arm(void);
int ff_get_cpu_flags_ppc(void);
int ff_get_cpu_flags_x86(void);
+size_t ff_get_cpu_max_align_aarch64(void);
+size_t ff_get_cpu_max_align_arm(void);
+size_t ff_get_cpu_max_align_ppc(void);
+size_t ff_get_cpu_max_align_x86(void);
+
#endif /* AVUTIL_CPU_INTERNAL_H */
diff --git a/media/ffvpx/libavutil/display.c b/media/ffvpx/libavutil/display.c
deleted file mode 100644
index a0076e067b..0000000000
--- a/media/ffvpx/libavutil/display.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2014 Vittorio Giovara <vittorio.giovara@gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <stdint.h>
-#include <string.h>
-#include <math.h>
-
-#include "display.h"
-#include "mathematics.h"
-
-// fixed point to double
-#define CONV_FP(x) ((double) (x)) / (1 << 16)
-
-// double to fixed point
-#define CONV_DB(x) (int32_t) ((x) * (1 << 16))
-
-double av_display_rotation_get(const int32_t matrix[9])
-{
- double rotation, scale[2];
-
- scale[0] = hypot(CONV_FP(matrix[0]), CONV_FP(matrix[3]));
- scale[1] = hypot(CONV_FP(matrix[1]), CONV_FP(matrix[4]));
-
- if (scale[0] == 0.0 || scale[1] == 0.0)
- return NAN;
-
- rotation = atan2(CONV_FP(matrix[1]) / scale[1],
- CONV_FP(matrix[0]) / scale[0]) * 180 / M_PI;
-
- return -rotation;
-}
-
-void av_display_rotation_set(int32_t matrix[9], double angle)
-{
- double radians = -angle * M_PI / 180.0f;
- double c = cos(radians);
- double s = sin(radians);
-
- memset(matrix, 0, 9 * sizeof(int32_t));
-
- matrix[0] = CONV_DB(c);
- matrix[1] = CONV_DB(-s);
- matrix[3] = CONV_DB(s);
- matrix[4] = CONV_DB(c);
- matrix[8] = 1 << 30;
-}
-
-void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip)
-{
- int i;
- const int flip[] = { 1 - 2 * (!!hflip), 1 - 2 * (!!vflip), 1 };
-
- if (hflip || vflip)
- for (i = 0; i < 9; i++)
- matrix[i] *= flip[i % 3];
-}
diff --git a/media/ffvpx/libavutil/display.h b/media/ffvpx/libavutil/display.h
deleted file mode 100644
index 39c15ee6b8..0000000000
--- a/media/ffvpx/libavutil/display.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright (c) 2014 Vittorio Giovara <vittorio.giovara@gmail.com>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_DISPLAY_H
-#define AVUTIL_DISPLAY_H
-
-#include <stdint.h>
-#include "common.h"
-
-/**
- * The display transformation matrix specifies an affine transformation that
- * should be applied to video frames for correct presentation. It is compatible
- * with the matrices stored in the ISO/IEC 14496-12 container format.
- *
- * The data is a 3x3 matrix represented as a 9-element array:
- *
- * | a b u |
- * (a, b, u, c, d, v, x, y, w) -> | c d v |
- * | x y w |
- *
- * All numbers are stored in native endianness, as 16.16 fixed-point values,
- * except for u, v and w, which are stored as 2.30 fixed-point values.
- *
- * The transformation maps a point (p, q) in the source (pre-transformation)
- * frame to the point (p', q') in the destination (post-transformation) frame as
- * follows:
- * | a b u |
- * (p, q, 1) . | c d v | = z * (p', q', 1)
- * | x y w |
- *
- * The transformation can also be more explicitly written in components as
- * follows:
- * p' = (a * p + c * q + x) / z;
- * q' = (b * p + d * q + y) / z;
- * z = u * p + v * q + w
- */
-
-/**
- * Extract the rotation component of the transformation matrix.
- *
- * @param matrix the transformation matrix
- * @return the angle (in degrees) by which the transformation rotates the frame
- * counterclockwise. The angle will be in range [-180.0, 180.0],
- * or NaN if the matrix is singular.
- *
- * @note floating point numbers are inherently inexact, so callers are
- * recommended to round the return value to nearest integer before use.
- */
-double av_display_rotation_get(const int32_t matrix[9]);
-
-/**
- * Initialize a transformation matrix describing a pure counterclockwise
- * rotation by the specified angle (in degrees).
- *
- * @param matrix an allocated transformation matrix (will be fully overwritten
- * by this function)
- * @param angle rotation angle in degrees.
- */
-void av_display_rotation_set(int32_t matrix[9], double angle);
-
-/**
- * Flip the input matrix horizontally and/or vertically.
- *
- * @param matrix an allocated transformation matrix
- * @param hflip whether the matrix should be flipped horizontally
- * @param vflip whether the matrix should be flipped vertically
- */
-void av_display_matrix_flip(int32_t matrix[9], int hflip, int vflip);
-
-#endif /* AVUTIL_DISPLAY_H */
diff --git a/media/ffvpx/libavutil/dummy_funcs.c b/media/ffvpx/libavutil/dummy_funcs.c
index 2ea84a1407..3a2381074b 100644
--- a/media/ffvpx/libavutil/dummy_funcs.c
+++ b/media/ffvpx/libavutil/dummy_funcs.c
@@ -5,7 +5,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "avutil.h"
-#include "opt.h"
// cpu_internal.c
int ff_get_cpu_flags_aarch64(void) { return 0; }
@@ -19,65 +18,9 @@ void ff_float_dsp_init_arm(AVFloatDSPContext *fdsp) {}
void ff_float_dsp_init_ppc(AVFloatDSPContext *fdsp, int strict) {}
void ff_float_dsp_init_mips(AVFloatDSPContext *fdsp) {}
-// opt.c
-int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags) { return 0; }
-void av_opt_set_defaults(void *s) {}
-void av_opt_set_defaults2(void *s, int mask, int flags) {}
-int av_set_options_string(void *ctx, const char *opts,
- const char *key_val_sep, const char *pairs_sep) { return 0; }
-int av_opt_set_from_string(void *ctx, const char *opts,
- const char *const *shorthand,
- const char *key_val_sep, const char *pairs_sep) { return 0; }
-void av_opt_free(void *obj) {}
-int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name) { return 0; }
-int av_opt_set_dict(void *obj, struct AVDictionary **options) { return 0; }
-int av_opt_set_dict2(void *obj, struct AVDictionary **options, int search_flags) { return 0; }
-int av_opt_get_key_value(const char **ropts,
- const char *key_val_sep, const char *pairs_sep,
- unsigned flags,
- char **rkey, char **rval) { return 0; }
-int av_opt_eval_flags (void *obj, const AVOption *o, const char *val, int *flags_out) { return 0; }
-int av_opt_eval_int (void *obj, const AVOption *o, const char *val, int *int_out) { return 0; }
-int av_opt_eval_int64 (void *obj, const AVOption *o, const char *val, int64_t *int64_out) { return 0; }
-int av_opt_eval_float (void *obj, const AVOption *o, const char *val, float *float_out) { return 0; }
-int av_opt_eval_double(void *obj, const AVOption *o, const char *val, double *double_out) { return 0; }
-int av_opt_eval_q (void *obj, const AVOption *o, const char *val, AVRational *q_out) { return 0; }
-const AVOption *av_opt_find(void *obj, const char *name, const char *unit,
- int opt_flags, int search_flags) { return 0; }
-const AVOption *av_opt_find2(void *obj, const char *name, const char *unit,
- int opt_flags, int search_flags, void **target_obj) { return 0; }
-const AVOption *av_opt_next(const void *obj, const AVOption *prev) { return 0; }
-void *av_opt_child_next(void *obj, void *prev) { return 0; }
-const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev) { return 0; }
-int av_opt_set (void *obj, const char *name, const char *val, int search_flags) { return 0; }
-int av_opt_set_int (void *obj, const char *name, int64_t val, int search_flags) { return 0; }
-int av_opt_set_double (void *obj, const char *name, double val, int search_flags) { return 0; }
-int av_opt_set_q (void *obj, const char *name, AVRational val, int search_flags) { return 0; }
-int av_opt_set_bin (void *obj, const char *name, const uint8_t *val, int size, int search_flags) { return 0; }
-int av_opt_set_image_size(void *obj, const char *name, int w, int h, int search_flags) { return 0; }
-int av_opt_set_pixel_fmt (void *obj, const char *name, enum AVPixelFormat fmt, int search_flags) { return 0; }
-int av_opt_set_sample_fmt(void *obj, const char *name, enum AVSampleFormat fmt, int search_flags) { return 0; }
-int av_opt_set_video_rate(void *obj, const char *name, AVRational val, int search_flags) { return 0; }
-int av_opt_set_channel_layout(void *obj, const char *name, int64_t ch_layout, int search_flags) { return 0; }
-int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val, int search_flags) { return 0; }
-int av_opt_get (void *obj, const char *name, int search_flags, uint8_t **out_val) { return 0; }
-int av_opt_get_int (void *obj, const char *name, int search_flags, int64_t *out_val) { return 0; }
-int av_opt_get_double (void *obj, const char *name, int search_flags, double *out_val) { return 0; }
-int av_opt_get_q (void *obj, const char *name, int search_flags, AVRational *out_val) { return 0; }
-int av_opt_get_image_size(void *obj, const char *name, int search_flags, int *w_out, int *h_out) { return 0; }
-int av_opt_get_pixel_fmt (void *obj, const char *name, int search_flags, enum AVPixelFormat *out_fmt) { return 0; }
-int av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AVSampleFormat *out_fmt) { return 0; }
-int av_opt_get_video_rate(void *obj, const char *name, int search_flags, AVRational *out_val) { return 0; }
-int av_opt_get_channel_layout(void *obj, const char *name, int search_flags, int64_t *ch_layout) { return 0; }
-int av_opt_get_dict_val(void *obj, const char *name, int search_flags, AVDictionary **out_val) { return 0; }
-void *av_opt_ptr(const AVClass *avclass, void *obj, const char *name) { return 0; }
-void av_opt_freep_ranges(AVOptionRanges **ranges) {}
-int av_opt_query_ranges(AVOptionRanges **b, void *obj, const char *key, int flags) { return 0; }
-int av_opt_copy(void *dest, const void *src) { return 0; }
-int av_opt_query_ranges_default(AVOptionRanges **b, void *obj, const char *key, int flags) { return 0; }
-int av_opt_is_set_to_default(void *obj, const AVOption *o) { return 0; }
-int av_opt_is_set_to_default_by_name(void *obj, const char *name, int search_flags) { return 0; }
-int av_opt_serialize(void *obj, int opt_flags, int flags, char **buffer,
- const char key_val_sep, const char pairs_sep) { return 0; }
-
int av_hwframe_get_buffer(struct AVBufferRef* hwframe_ref, struct AVFrame* frame, int flags) { return 0; }
+
+// cpu.c
+size_t ff_get_cpu_max_align_aarch64() { return 0; }
+size_t ff_get_cpu_max_align_arm() { return 0; }
+size_t ff_get_cpu_max_align_ppc() { return 0; }
diff --git a/media/ffvpx/libavutil/eval.c b/media/ffvpx/libavutil/eval.c
index fc12885c27..e5948793bd 100644
--- a/media/ffvpx/libavutil/eval.c
+++ b/media/ffvpx/libavutil/eval.c
@@ -38,6 +38,7 @@
#include "fftime.h"
#include "avstring.h"
#include "timer.h"
+#include "reverse.h"
typedef struct Parser {
const AVClass *class;
@@ -152,9 +153,9 @@ struct AVExpr {
e_squish, e_gauss, e_ld, e_isnan, e_isinf,
e_mod, e_max, e_min, e_eq, e_gt, e_gte, e_lte, e_lt,
e_pow, e_mul, e_div, e_add,
- e_last, e_st, e_while, e_taylor, e_root, e_floor, e_ceil, e_trunc,
+ e_last, e_st, e_while, e_taylor, e_root, e_floor, e_ceil, e_trunc, e_round,
e_sqrt, e_not, e_random, e_hypot, e_gcd,
- e_if, e_ifnot, e_print, e_bitand, e_bitor, e_between, e_clip
+ e_if, e_ifnot, e_print, e_bitand, e_bitor, e_between, e_clip, e_atan2, e_lerp,
} type;
double value; // is sign in other types
union {
@@ -188,6 +189,7 @@ static double eval_expr(Parser *p, AVExpr *e)
case e_floor: return e->value * floor(eval_expr(p, e->param[0]));
case e_ceil : return e->value * ceil (eval_expr(p, e->param[0]));
case e_trunc: return e->value * trunc(eval_expr(p, e->param[0]));
+ case e_round: return e->value * round(eval_expr(p, e->param[0]));
case e_sqrt: return e->value * sqrt (eval_expr(p, e->param[0]));
case e_not: return e->value * (eval_expr(p, e->param[0]) == 0);
case e_if: return e->value * (eval_expr(p, e->param[0]) ? eval_expr(p, e->param[1]) :
@@ -206,6 +208,12 @@ static double eval_expr(Parser *p, AVExpr *e)
return e->value * (d >= eval_expr(p, e->param[1]) &&
d <= eval_expr(p, e->param[2]));
}
+ case e_lerp: {
+ double v0 = eval_expr(p, e->param[0]);
+ double v1 = eval_expr(p, e->param[1]);
+ double f = eval_expr(p, e->param[2]);
+ return v0 + (v1 - v0) * f;
+ }
case e_print: {
double x = eval_expr(p, e->param[0]);
int level = e->param[1] ? av_clip(eval_expr(p, e->param[1]), INT_MIN, INT_MAX) : AV_LOG_INFO;
@@ -305,6 +313,7 @@ static double eval_expr(Parser *p, AVExpr *e)
case e_last:return e->value * d2;
case e_st : return e->value * (p->var[av_clip(d, 0, VARS-1)]= d2);
case e_hypot:return e->value * hypot(d, d2);
+ case e_atan2:return e->value * atan2(d, d2);
case e_bitand: return isnan(d) || isnan(d2) ? NAN : e->value * ((long int)d & (long int)d2);
case e_bitor: return isnan(d) || isnan(d2) ? NAN : e->value * ((long int)d | (long int)d2);
}
@@ -438,6 +447,7 @@ static int parse_primary(AVExpr **e, Parser *p)
else if (strmatch(next, "floor" )) d->type = e_floor;
else if (strmatch(next, "ceil" )) d->type = e_ceil;
else if (strmatch(next, "trunc" )) d->type = e_trunc;
+ else if (strmatch(next, "round" )) d->type = e_round;
else if (strmatch(next, "sqrt" )) d->type = e_sqrt;
else if (strmatch(next, "not" )) d->type = e_not;
else if (strmatch(next, "pow" )) d->type = e_pow;
@@ -451,6 +461,8 @@ static int parse_primary(AVExpr **e, Parser *p)
else if (strmatch(next, "bitor" )) d->type = e_bitor;
else if (strmatch(next, "between"))d->type = e_between;
else if (strmatch(next, "clip" )) d->type = e_clip;
+ else if (strmatch(next, "atan2" )) d->type = e_atan2;
+ else if (strmatch(next, "lerp" )) d->type = e_lerp;
else {
for (i=0; p->func1_names && p->func1_names[i]; i++) {
if (strmatch(next, p->func1_names[i])) {
@@ -634,6 +646,7 @@ static int verify_expr(AVExpr *e)
case e_floor:
case e_ceil:
case e_trunc:
+ case e_round:
case e_sqrt:
case e_not:
case e_random:
@@ -648,6 +661,7 @@ static int verify_expr(AVExpr *e)
&& (!e->param[2] || verify_expr(e->param[2]));
case e_between:
case e_clip:
+ case e_lerp:
return verify_expr(e->param[0]) &&
verify_expr(e->param[1]) &&
verify_expr(e->param[2]);
diff --git a/media/ffvpx/libavutil/ffversion.h b/media/ffvpx/libavutil/ffversion.h
index cbeaf627bd..3da2a6bf14 100644
--- a/media/ffvpx/libavutil/ffversion.h
+++ b/media/ffvpx/libavutil/ffversion.h
@@ -1,5 +1,5 @@
/* Automatically generated by version.sh, do not manually edit! */
#ifndef AVUTIL_FFVERSION_H
#define AVUTIL_FFVERSION_H
-#define FFMPEG_VERSION "n3.1.1-6-g86f9228"
+#define FFMPEG_VERSION "n3.4.2"
#endif /* AVUTIL_FFVERSION_H */
diff --git a/media/ffvpx/libavutil/float_dsp.c b/media/ffvpx/libavutil/float_dsp.c
index c85daffc6a..1d4911d815 100644
--- a/media/ffvpx/libavutil/float_dsp.c
+++ b/media/ffvpx/libavutil/float_dsp.c
@@ -40,6 +40,14 @@ static void vector_fmac_scalar_c(float *dst, const float *src, float mul,
dst[i] += src[i] * mul;
}
+static void vector_dmac_scalar_c(double *dst, const double *src, double mul,
+ int len)
+{
+ int i;
+ for (i = 0; i < len; i++)
+ dst[i] += src[i] * mul;
+}
+
static void vector_fmul_scalar_c(float *dst, const float *src, float mul,
int len)
{
@@ -125,6 +133,7 @@ av_cold AVFloatDSPContext *avpriv_float_dsp_alloc(int bit_exact)
fdsp->vector_fmul = vector_fmul_c;
fdsp->vector_fmac_scalar = vector_fmac_scalar_c;
fdsp->vector_fmul_scalar = vector_fmul_scalar_c;
+ fdsp->vector_dmac_scalar = vector_dmac_scalar_c;
fdsp->vector_dmul_scalar = vector_dmul_scalar_c;
fdsp->vector_fmul_window = vector_fmul_window_c;
fdsp->vector_fmul_add = vector_fmul_add_c;
diff --git a/media/ffvpx/libavutil/float_dsp.h b/media/ffvpx/libavutil/float_dsp.h
index d1be38f947..2c24d93471 100644
--- a/media/ffvpx/libavutil/float_dsp.h
+++ b/media/ffvpx/libavutil/float_dsp.h
@@ -55,6 +55,22 @@ typedef struct AVFloatDSPContext {
int len);
/**
+ * Multiply a vector of doubles by a scalar double and add to
+ * destination vector. Source and destination vectors must
+ * overlap exactly or not at all.
+ *
+ * @param dst result vector
+ * constraints: 32-byte aligned
+ * @param src input vector
+ * constraints: 32-byte aligned
+ * @param mul scalar value
+ * @param len length of vector
+ * constraints: multiple of 16
+ */
+ void (*vector_dmac_scalar)(double *dst, const double *src, double mul,
+ int len);
+
+ /**
* Multiply a vector of floats by a scalar float. Source and
* destination vectors must overlap exactly or not at all.
*
diff --git a/media/ffvpx/libavutil/frame.c b/media/ffvpx/libavutil/frame.c
index 53e6174223..d5fd2932e3 100644
--- a/media/ffvpx/libavutil/frame.c
+++ b/media/ffvpx/libavutil/frame.c
@@ -26,6 +26,11 @@
#include "mem.h"
#include "samplefmt.h"
+
+static AVFrameSideData *frame_new_side_data(AVFrame *frame,
+ enum AVFrameSideDataType type,
+ AVBufferRef *buf);
+
MAKE_ACCESSORS(AVFrame, frame, int64_t, best_effort_timestamp)
MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_duration)
MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_pos)
@@ -176,6 +181,9 @@ static int get_video_buffer(AVFrame *frame, int align)
return ret;
if (!frame->linesize[0]) {
+ if (align <= 0)
+ align = 32; /* STRIDE_ALIGN. Should be av_cpu_max_align() */
+
for(i=1; i<=align; i+=i) {
ret = av_image_fill_linesizes(frame->linesize, frame->format,
FFALIGN(frame->width, i));
@@ -292,6 +300,10 @@ static int frame_copy_props(AVFrame *dst, const AVFrame *src, int force_copy)
dst->key_frame = src->key_frame;
dst->pict_type = src->pict_type;
dst->sample_aspect_ratio = src->sample_aspect_ratio;
+ dst->crop_top = src->crop_top;
+ dst->crop_bottom = src->crop_bottom;
+ dst->crop_left = src->crop_left;
+ dst->crop_right = src->crop_right;
dst->pts = src->pts;
dst->repeat_pict = src->repeat_pict;
dst->interlaced_frame = src->interlaced_frame;
@@ -344,18 +356,11 @@ FF_ENABLE_DEPRECATION_WARNINGS
}
memcpy(sd_dst->data, sd_src->data, sd_src->size);
} else {
- sd_dst = av_frame_new_side_data(dst, sd_src->type, 0);
+ sd_dst = frame_new_side_data(dst, sd_src->type, av_buffer_ref(sd_src->buf));
if (!sd_dst) {
wipe_side_data(dst);
return AVERROR(ENOMEM);
}
- sd_dst->buf = av_buffer_ref(sd_src->buf);
- if (!sd_dst->buf) {
- wipe_side_data(dst);
- return AVERROR(ENOMEM);
- }
- sd_dst->data = sd_dst->buf->data;
- sd_dst->size = sd_dst->buf->size;
}
av_dict_copy(&sd_dst->metadata, sd_src->metadata, 0);
}
@@ -377,6 +382,13 @@ FF_DISABLE_DEPRECATION_WARNINGS
FF_ENABLE_DEPRECATION_WARNINGS
#endif
+ av_buffer_unref(&dst->opaque_ref);
+ if (src->opaque_ref) {
+ dst->opaque_ref = av_buffer_ref(src->opaque_ref);
+ if (!dst->opaque_ref)
+ return AVERROR(ENOMEM);
+ }
+
return 0;
}
@@ -511,6 +523,8 @@ void av_frame_unref(AVFrame *frame)
av_buffer_unref(&frame->hw_frames_ctx);
+ av_buffer_unref(&frame->opaque_ref);
+
get_frame_defaults(frame);
}
@@ -622,40 +636,47 @@ AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane)
return NULL;
}
-AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
- enum AVFrameSideDataType type,
- int size)
+static AVFrameSideData *frame_new_side_data(AVFrame *frame,
+ enum AVFrameSideDataType type,
+ AVBufferRef *buf)
{
AVFrameSideData *ret, **tmp;
- if (frame->nb_side_data > INT_MAX / sizeof(*frame->side_data) - 1)
+ if (!buf)
return NULL;
+ if (frame->nb_side_data > INT_MAX / sizeof(*frame->side_data) - 1)
+ goto fail;
+
tmp = av_realloc(frame->side_data,
(frame->nb_side_data + 1) * sizeof(*frame->side_data));
if (!tmp)
- return NULL;
+ goto fail;
frame->side_data = tmp;
ret = av_mallocz(sizeof(*ret));
if (!ret)
- return NULL;
+ goto fail;
- if (size > 0) {
- ret->buf = av_buffer_alloc(size);
- if (!ret->buf) {
- av_freep(&ret);
- return NULL;
- }
-
- ret->data = ret->buf->data;
- ret->size = size;
- }
+ ret->buf = buf;
+ ret->data = ret->buf->data;
+ ret->size = buf->size;
ret->type = type;
frame->side_data[frame->nb_side_data++] = ret;
return ret;
+fail:
+ av_buffer_unref(&buf);
+ return NULL;
+}
+
+AVFrameSideData *av_frame_new_side_data(AVFrame *frame,
+ enum AVFrameSideDataType type,
+ int size)
+{
+
+ return frame_new_side_data(frame, type, av_buffer_alloc(size));
}
AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
@@ -723,7 +744,7 @@ int av_frame_copy(AVFrame *dst, const AVFrame *src)
if (dst->width > 0 && dst->height > 0)
return frame_copy_video(dst, src);
- else if (dst->nb_samples > 0 && dst->channel_layout)
+ else if (dst->nb_samples > 0 && dst->channels > 0)
return frame_copy_audio(dst, src);
return AVERROR(EINVAL);
@@ -758,7 +779,109 @@ const char *av_frame_side_data_name(enum AVFrameSideDataType type)
case AV_FRAME_DATA_SKIP_SAMPLES: return "Skip samples";
case AV_FRAME_DATA_AUDIO_SERVICE_TYPE: return "Audio service type";
case AV_FRAME_DATA_MASTERING_DISPLAY_METADATA: return "Mastering display metadata";
+ case AV_FRAME_DATA_CONTENT_LIGHT_LEVEL: return "Content light level metadata";
case AV_FRAME_DATA_GOP_TIMECODE: return "GOP timecode";
+ case AV_FRAME_DATA_ICC_PROFILE: return "ICC profile";
}
return NULL;
}
+
+static int calc_cropping_offsets(size_t offsets[4], const AVFrame *frame,
+ const AVPixFmtDescriptor *desc)
+{
+ int i, j;
+
+ for (i = 0; frame->data[i]; i++) {
+ const AVComponentDescriptor *comp = NULL;
+ int shift_x = (i == 1 || i == 2) ? desc->log2_chroma_w : 0;
+ int shift_y = (i == 1 || i == 2) ? desc->log2_chroma_h : 0;
+
+ if (desc->flags & (AV_PIX_FMT_FLAG_PAL | AV_PIX_FMT_FLAG_PSEUDOPAL) && i == 1) {
+ offsets[i] = 0;
+ break;
+ }
+
+ /* find any component descriptor for this plane */
+ for (j = 0; j < desc->nb_components; j++) {
+ if (desc->comp[j].plane == i) {
+ comp = &desc->comp[j];
+ break;
+ }
+ }
+ if (!comp)
+ return AVERROR_BUG;
+
+ offsets[i] = (frame->crop_top >> shift_y) * frame->linesize[i] +
+ (frame->crop_left >> shift_x) * comp->step;
+ }
+
+ return 0;
+}
+
+int av_frame_apply_cropping(AVFrame *frame, int flags)
+{
+ const AVPixFmtDescriptor *desc;
+ size_t offsets[4];
+ int i;
+
+ if (!(frame->width > 0 && frame->height > 0))
+ return AVERROR(EINVAL);
+
+ if (frame->crop_left >= INT_MAX - frame->crop_right ||
+ frame->crop_top >= INT_MAX - frame->crop_bottom ||
+ (frame->crop_left + frame->crop_right) >= frame->width ||
+ (frame->crop_top + frame->crop_bottom) >= frame->height)
+ return AVERROR(ERANGE);
+
+ desc = av_pix_fmt_desc_get(frame->format);
+ if (!desc)
+ return AVERROR_BUG;
+
+ /* Apply just the right/bottom cropping for hwaccel formats. Bitstream
+ * formats cannot be easily handled here either (and corresponding decoders
+ * should not export any cropping anyway), so do the same for those as well.
+ * */
+ if (desc->flags & (AV_PIX_FMT_FLAG_BITSTREAM | AV_PIX_FMT_FLAG_HWACCEL)) {
+ frame->width -= frame->crop_right;
+ frame->height -= frame->crop_bottom;
+ frame->crop_right = 0;
+ frame->crop_bottom = 0;
+ return 0;
+ }
+
+ /* calculate the offsets for each plane */
+ calc_cropping_offsets(offsets, frame, desc);
+
+ /* adjust the offsets to avoid breaking alignment */
+ if (!(flags & AV_FRAME_CROP_UNALIGNED)) {
+ int log2_crop_align = frame->crop_left ? ff_ctz(frame->crop_left) : INT_MAX;
+ int min_log2_align = INT_MAX;
+
+ for (i = 0; frame->data[i]; i++) {
+ int log2_align = offsets[i] ? ff_ctz(offsets[i]) : INT_MAX;
+ min_log2_align = FFMIN(log2_align, min_log2_align);
+ }
+
+ /* we assume, and it should always be true, that the data alignment is
+ * related to the cropping alignment by a constant power-of-2 factor */
+ if (log2_crop_align < min_log2_align)
+ return AVERROR_BUG;
+
+ if (min_log2_align < 5) {
+ frame->crop_left &= ~((1 << (5 + log2_crop_align - min_log2_align)) - 1);
+ calc_cropping_offsets(offsets, frame, desc);
+ }
+ }
+
+ for (i = 0; frame->data[i]; i++)
+ frame->data[i] += offsets[i];
+
+ frame->width -= (frame->crop_left + frame->crop_right);
+ frame->height -= (frame->crop_top + frame->crop_bottom);
+ frame->crop_left = 0;
+ frame->crop_right = 0;
+ frame->crop_top = 0;
+ frame->crop_bottom = 0;
+
+ return 0;
+}
diff --git a/media/ffvpx/libavutil/frame.h b/media/ffvpx/libavutil/frame.h
index 8e51361e29..abe4f4fd17 100644
--- a/media/ffvpx/libavutil/frame.h
+++ b/media/ffvpx/libavutil/frame.h
@@ -25,6 +25,7 @@
#ifndef AVUTIL_FRAME_H
#define AVUTIL_FRAME_H
+#include <stddef.h>
#include <stdint.h>
#include "avutil.h"
@@ -120,7 +121,26 @@ enum AVFrameSideDataType {
* The GOP timecode in 25 bit timecode format. Data format is 64-bit integer.
* This is set on the first frame of a GOP that has a temporal reference of 0.
*/
- AV_FRAME_DATA_GOP_TIMECODE
+ AV_FRAME_DATA_GOP_TIMECODE,
+
+ /**
+ * The data represents the AVSphericalMapping structure defined in
+ * libavutil/spherical.h.
+ */
+ AV_FRAME_DATA_SPHERICAL,
+
+ /**
+ * Content light level (based on CTA-861.3). This payload contains data in
+ * the form of the AVContentLightMetadata struct.
+ */
+ AV_FRAME_DATA_CONTENT_LIGHT_LEVEL,
+
+ /**
+ * The data contains an ICC profile as an opaque octet buffer following the
+ * format described by ISO 15076-1 with an optional name defined in the
+ * metadata key entry "name".
+ */
+ AV_FRAME_DATA_ICC_PROFILE,
};
enum AVActiveFormatDescription {
@@ -173,9 +193,6 @@ typedef struct AVFrameSideData {
*
* sizeof(AVFrame) is not a part of the public ABI, so new fields may be added
* to the end with a minor bump.
- * Similarly fields that are marked as to be only accessed by
- * av_opt_ptr() can be reordered. This allows 2 forks to add fields
- * without breaking compatibility with each other.
*
* Fields can be accessed through AVOptions, the name string used, matches the
* C structure field name for fields accessible through AVOptions. The AVClass
@@ -231,9 +248,18 @@ typedef struct AVFrame {
uint8_t **extended_data;
/**
- * width and height of the video frame
+ * @name Video dimensions
+ * Video frames only. The coded dimensions (in pixels) of the video frame,
+ * i.e. the size of the rectangle that contains some well-defined values.
+ *
+ * @note The part of the frame intended for display/presentation is further
+ * restricted by the @ref cropping "Cropping rectangle".
+ * @{
*/
int width, height;
+ /**
+ * @}
+ */
/**
* number of audio samples (per channel) described by this frame
@@ -414,8 +440,6 @@ typedef struct AVFrame {
/**
* MPEG vs JPEG YUV range.
- * It must be accessed using av_frame_get_color_range() and
- * av_frame_set_color_range().
* - encoding: Set by user
* - decoding: Set by libavcodec
*/
@@ -427,8 +451,6 @@ typedef struct AVFrame {
/**
* YUV colorspace type.
- * It must be accessed using av_frame_get_colorspace() and
- * av_frame_set_colorspace().
* - encoding: Set by user
* - decoding: Set by libavcodec
*/
@@ -438,8 +460,6 @@ typedef struct AVFrame {
/**
* frame timestamp estimated using various heuristics, in stream time base
- * Code outside libavutil should access this field using:
- * av_frame_get_best_effort_timestamp(frame)
* - encoding: unused
* - decoding: set by libavcodec, read by user.
*/
@@ -447,8 +467,6 @@ typedef struct AVFrame {
/**
* reordered pos from the last AVPacket that has been input into the decoder
- * Code outside libavutil should access this field using:
- * av_frame_get_pkt_pos(frame)
* - encoding: unused
* - decoding: Read by user.
*/
@@ -457,8 +475,6 @@ typedef struct AVFrame {
/**
* duration of the corresponding packet, expressed in
* AVStream->time_base units, 0 if unknown.
- * Code outside libavutil should access this field using:
- * av_frame_get_pkt_duration(frame)
* - encoding: unused
* - decoding: Read by user.
*/
@@ -466,8 +482,6 @@ typedef struct AVFrame {
/**
* metadata.
- * Code outside libavutil should access this field using:
- * av_frame_get_metadata(frame)
* - encoding: Set by user.
* - decoding: Set by libavcodec.
*/
@@ -477,8 +491,6 @@ typedef struct AVFrame {
* decode error flags of the frame, set to a combination of
* FF_DECODE_ERROR_xxx flags if the decoder produced a frame, but there
* were errors during the decoding.
- * Code outside libavutil should access this field using:
- * av_frame_get_decode_error_flags(frame)
* - encoding: unused
* - decoding: set by libavcodec, read by user.
*/
@@ -488,8 +500,6 @@ typedef struct AVFrame {
/**
* number of audio channels, only used for audio.
- * Code outside libavutil should access this field using:
- * av_frame_get_channels(frame)
* - encoding: unused
* - decoding: Read by user.
*/
@@ -497,8 +507,7 @@ typedef struct AVFrame {
/**
* size of the corresponding packet containing the compressed
- * frame. It must be accessed using av_frame_get_pkt_size() and
- * av_frame_set_pkt_size().
+ * frame.
* It is set to a negative value if unknown.
* - encoding: unused
* - decoding: set by libavcodec, read by user.
@@ -508,13 +517,11 @@ typedef struct AVFrame {
#if FF_API_FRAME_QP
/**
* QP table
- * Not to be accessed directly from outside libavutil
*/
attribute_deprecated
int8_t *qscale_table;
/**
* QP store stride
- * Not to be accessed directly from outside libavutil
*/
attribute_deprecated
int qstride;
@@ -522,9 +529,6 @@ typedef struct AVFrame {
attribute_deprecated
int qscale_type;
- /**
- * Not to be accessed directly from outside libavutil
- */
AVBufferRef *qp_table_buf;
#endif
/**
@@ -532,12 +536,38 @@ typedef struct AVFrame {
* AVHWFramesContext describing the frame.
*/
AVBufferRef *hw_frames_ctx;
+
+ /**
+ * AVBufferRef for free use by the API user. FFmpeg will never check the
+ * contents of the buffer ref. FFmpeg calls av_buffer_unref() on it when
+ * the frame is unreferenced. av_frame_copy_props() calls create a new
+ * reference with av_buffer_ref() for the target frame's opaque_ref field.
+ *
+ * This is unrelated to the opaque field, although it serves a similar
+ * purpose.
+ */
+ AVBufferRef *opaque_ref;
+
+ /**
+ * @anchor cropping
+ * @name Cropping
+ * Video frames only. The number of pixels to discard from the the
+ * top/bottom/left/right border of the frame to obtain the sub-rectangle of
+ * the frame intended for presentation.
+ * @{
+ */
+ size_t crop_top;
+ size_t crop_bottom;
+ size_t crop_left;
+ size_t crop_right;
+ /**
+ * @}
+ */
} AVFrame;
/**
- * Accessors for some AVFrame fields.
- * The position of these field in the structure is not part of the ABI,
- * they should not be accessed directly outside libavutil.
+ * Accessors for some AVFrame fields. These used to be provided for ABI
+ * compatibility, and do not need to be used anymore.
*/
int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame);
void av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val);
@@ -651,7 +681,9 @@ void av_frame_move_ref(AVFrame *dst, AVFrame *src);
* cases.
*
* @param frame frame in which to store the new buffers.
- * @param align required buffer size alignment
+ * @param align Required buffer size alignment. If equal to 0, alignment will be
+ * chosen automatically for the current CPU. It is highly
+ * recommended to pass 0 here unless you know what you are doing.
*
* @return 0 on success, a negative AVERROR on error.
*/
@@ -743,6 +775,40 @@ AVFrameSideData *av_frame_get_side_data(const AVFrame *frame,
*/
void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type);
+
+/**
+ * Flags for frame cropping.
+ */
+enum {
+ /**
+ * Apply the maximum possible cropping, even if it requires setting the
+ * AVFrame.data[] entries to unaligned pointers. Passing unaligned data
+ * to FFmpeg API is generally not allowed, and causes undefined behavior
+ * (such as crashes). You can pass unaligned data only to FFmpeg APIs that
+ * are explicitly documented to accept it. Use this flag only if you
+ * absolutely know what you are doing.
+ */
+ AV_FRAME_CROP_UNALIGNED = 1 << 0,
+};
+
+/**
+ * Crop the given video AVFrame according to its crop_left/crop_top/crop_right/
+ * crop_bottom fields. If cropping is successful, the function will adjust the
+ * data pointers and the width/height fields, and set the crop fields to 0.
+ *
+ * In all cases, the cropping boundaries will be rounded to the inherent
+ * alignment of the pixel format. In some cases, such as for opaque hwaccel
+ * formats, the left/top cropping is ignored. The crop fields are set to 0 even
+ * if the cropping was rounded or ignored.
+ *
+ * @param frame the frame which should be cropped
+ * @param flags Some combination of AV_FRAME_CROP_* flags, or 0.
+ *
+ * @return >= 0 on success, a negative AVERROR on error. If the cropping fields
+ * were invalid, AVERROR(ERANGE) is returned, and nothing is changed.
+ */
+int av_frame_apply_cropping(AVFrame *frame, int flags);
+
/**
* @return a string identifying the side data type
*/
diff --git a/media/ffvpx/libavutil/hwcontext.h b/media/ffvpx/libavutil/hwcontext.h
index 5e2af092a4..03334e20e0 100644
--- a/media/ffvpx/libavutil/hwcontext.h
+++ b/media/ffvpx/libavutil/hwcontext.h
@@ -30,6 +30,10 @@ enum AVHWDeviceType {
AV_HWDEVICE_TYPE_VAAPI,
AV_HWDEVICE_TYPE_DXVA2,
AV_HWDEVICE_TYPE_QSV,
+ AV_HWDEVICE_TYPE_VIDEOTOOLBOX,
+ AV_HWDEVICE_TYPE_NONE,
+ AV_HWDEVICE_TYPE_D3D11VA,
+ AV_HWDEVICE_TYPE_DRM,
};
typedef struct AVHWDeviceInternal AVHWDeviceInternal;
@@ -223,10 +227,36 @@ typedef struct AVHWFramesContext {
} AVHWFramesContext;
/**
- * Allocate an AVHWDeviceContext for a given pixel format.
+ * Look up an AVHWDeviceType by name.
*
- * @param format a hwaccel pixel format (AV_PIX_FMT_FLAG_HWACCEL must be set
- * on the corresponding format descriptor)
+ * @param name String name of the device type (case-insensitive).
+ * @return The type from enum AVHWDeviceType, or AV_HWDEVICE_TYPE_NONE if
+ * not found.
+ */
+enum AVHWDeviceType av_hwdevice_find_type_by_name(const char *name);
+
+/** Get the string name of an AVHWDeviceType.
+ *
+ * @param type Type from enum AVHWDeviceType.
+ * @return Pointer to a static string containing the name, or NULL if the type
+ * is not valid.
+ */
+const char *av_hwdevice_get_type_name(enum AVHWDeviceType type);
+
+/**
+ * Iterate over supported device types.
+ *
+ * @param type AV_HWDEVICE_TYPE_NONE initially, then the previous type
+ * returned by this function in subsequent iterations.
+ * @return The next usable device type from enum AVHWDeviceType, or
+ * AV_HWDEVICE_TYPE_NONE if there are no more.
+ */
+enum AVHWDeviceType av_hwdevice_iterate_types(enum AVHWDeviceType prev);
+
+/**
+ * Allocate an AVHWDeviceContext for a given hardware type.
+ *
+ * @param type the type of the hardware device to allocate.
* @return a reference to the newly created AVHWDeviceContext on success or NULL
* on failure.
*/
@@ -271,6 +301,32 @@ int av_hwdevice_ctx_create(AVBufferRef **device_ctx, enum AVHWDeviceType type,
const char *device, AVDictionary *opts, int flags);
/**
+ * Create a new device of the specified type from an existing device.
+ *
+ * If the source device is a device of the target type or was originally
+ * derived from such a device (possibly through one or more intermediate
+ * devices of other types), then this will return a reference to the
+ * existing device of the same type as is requested.
+ *
+ * Otherwise, it will attempt to derive a new device from the given source
+ * device. If direct derivation to the new type is not implemented, it will
+ * attempt the same derivation from each ancestor of the source device in
+ * turn looking for an implemented derivation method.
+ *
+ * @param dst_ctx On success, a reference to the newly-created
+ * AVHWDeviceContext.
+ * @param type The type of the new device to create.
+ * @param src_ctx A reference to an existing AVHWDeviceContext which will be
+ * used to create the new device.
+ * @param flags Currently unused; should be set to zero.
+ * @return Zero on success, a negative AVERROR code on failure.
+ */
+int av_hwdevice_ctx_create_derived(AVBufferRef **dst_ctx,
+ enum AVHWDeviceType type,
+ AVBufferRef *src_ctx, int flags);
+
+
+/**
* Allocate an AVHWFramesContext tied to a given device context.
*
* @param device_ctx a reference to a AVHWDeviceContext. This function will make
@@ -318,6 +374,14 @@ int av_hwframe_get_buffer(AVBufferRef *hwframe_ctx, AVFrame *frame, int flags);
* If dst->format is set, then this format will be used, otherwise (when
* dst->format is AV_PIX_FMT_NONE) the first acceptable format will be chosen.
*
+ * The two frames must have matching allocated dimensions (i.e. equal to
+ * AVHWFramesContext.width/height), since not all device types support
+ * transferring a sub-rectangle of the whole surface. The display dimensions
+ * (i.e. AVFrame.width/height) may be smaller than the allocated dimensions, but
+ * also have to be equal for both frames. When the display dimensions are
+ * smaller than the allocated dimensions, the content of the padding in the
+ * destination frame is unspecified.
+ *
* @param dst the destination frame. dst is not touched on failure.
* @param src the source frame.
* @param flags currently unused, should be set to zero
@@ -410,7 +474,7 @@ void *av_hwdevice_hwconfig_alloc(AVBufferRef *device_ctx);
* configuration is provided, returns the maximum possible capabilities
* of the device.
*
- * @param device_ctx a reference to the associated AVHWDeviceContext.
+ * @param ref a reference to the associated AVHWDeviceContext.
* @param hwconfig a filled HW-specific configuration structure, or NULL
* to return the maximum possible capabilities of the device.
* @return AVHWFramesConstraints structure describing the constraints
@@ -426,4 +490,93 @@ AVHWFramesConstraints *av_hwdevice_get_hwframe_constraints(AVBufferRef *ref,
*/
void av_hwframe_constraints_free(AVHWFramesConstraints **constraints);
+
+/**
+ * Flags to apply to frame mappings.
+ */
+enum {
+ /**
+ * The mapping must be readable.
+ */
+ AV_HWFRAME_MAP_READ = 1 << 0,
+ /**
+ * The mapping must be writeable.
+ */
+ AV_HWFRAME_MAP_WRITE = 1 << 1,
+ /**
+ * The mapped frame will be overwritten completely in subsequent
+ * operations, so the current frame data need not be loaded. Any values
+ * which are not overwritten are unspecified.
+ */
+ AV_HWFRAME_MAP_OVERWRITE = 1 << 2,
+ /**
+ * The mapping must be direct. That is, there must not be any copying in
+ * the map or unmap steps. Note that performance of direct mappings may
+ * be much lower than normal memory.
+ */
+ AV_HWFRAME_MAP_DIRECT = 1 << 3,
+};
+
+/**
+ * Map a hardware frame.
+ *
+ * This has a number of different possible effects, depending on the format
+ * and origin of the src and dst frames. On input, src should be a usable
+ * frame with valid buffers and dst should be blank (typically as just created
+ * by av_frame_alloc()). src should have an associated hwframe context, and
+ * dst may optionally have a format and associated hwframe context.
+ *
+ * If src was created by mapping a frame from the hwframe context of dst,
+ * then this function undoes the mapping - dst is replaced by a reference to
+ * the frame that src was originally mapped from.
+ *
+ * If both src and dst have an associated hwframe context, then this function
+ * attempts to map the src frame from its hardware context to that of dst and
+ * then fill dst with appropriate data to be usable there. This will only be
+ * possible if the hwframe contexts and associated devices are compatible -
+ * given compatible devices, av_hwframe_ctx_create_derived() can be used to
+ * create a hwframe context for dst in which mapping should be possible.
+ *
+ * If src has a hwframe context but dst does not, then the src frame is
+ * mapped to normal memory and should thereafter be usable as a normal frame.
+ * If the format is set on dst, then the mapping will attempt to create dst
+ * with that format and fail if it is not possible. If format is unset (is
+ * AV_PIX_FMT_NONE) then dst will be mapped with whatever the most appropriate
+ * format to use is (probably the sw_format of the src hwframe context).
+ *
+ * A return value of AVERROR(ENOSYS) indicates that the mapping is not
+ * possible with the given arguments and hwframe setup, while other return
+ * values indicate that it failed somehow.
+ *
+ * @param dst Destination frame, to contain the mapping.
+ * @param src Source frame, to be mapped.
+ * @param flags Some combination of AV_HWFRAME_MAP_* flags.
+ * @return Zero on success, negative AVERROR code on failure.
+ */
+int av_hwframe_map(AVFrame *dst, const AVFrame *src, int flags);
+
+
+/**
+ * Create and initialise an AVHWFramesContext as a mapping of another existing
+ * AVHWFramesContext on a different device.
+ *
+ * av_hwframe_ctx_init() should not be called after this.
+ *
+ * @param derived_frame_ctx On success, a reference to the newly created
+ * AVHWFramesContext.
+ * @param derived_device_ctx A reference to the device to create the new
+ * AVHWFramesContext on.
+ * @param source_frame_ctx A reference to an existing AVHWFramesContext
+ * which will be mapped to the derived context.
+ * @param flags Some combination of AV_HWFRAME_MAP_* flags, defining the
+ * mapping parameters to apply to frames which are allocated
+ * in the derived device.
+ * @return Zero on success, negative AVERROR code on failure.
+ */
+int av_hwframe_ctx_create_derived(AVBufferRef **derived_frame_ctx,
+ enum AVPixelFormat format,
+ AVBufferRef *derived_device_ctx,
+ AVBufferRef *source_frame_ctx,
+ int flags);
+
#endif /* AVUTIL_HWCONTEXT_H */
diff --git a/media/ffvpx/libavutil/imgutils.c b/media/ffvpx/libavutil/imgutils.c
index 37808e53d0..5005178804 100644
--- a/media/ffvpx/libavutil/imgutils.c
+++ b/media/ffvpx/libavutil/imgutils.c
@@ -24,6 +24,7 @@
#include "avassert.h"
#include "common.h"
#include "imgutils.h"
+#include "imgutils_internal.h"
#include "internal.h"
#include "intreadwrite.h"
#include "log.h"
@@ -248,19 +249,38 @@ static const AVClass imgutils_class = {
.parent_log_context_offset = offsetof(ImgUtils, log_ctx),
};
-int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
+int av_image_check_size2(unsigned int w, unsigned int h, int64_t max_pixels, enum AVPixelFormat pix_fmt, int log_offset, void *log_ctx)
{
ImgUtils imgutils = {
.class = &imgutils_class,
.log_offset = log_offset,
.log_ctx = log_ctx,
};
+ int64_t stride = av_image_get_linesize(pix_fmt, w, 0);
+ if (stride <= 0)
+ stride = 8LL*w;
+ stride += 128*8;
- if ((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/8)
- return 0;
+ if ((int)w<=0 || (int)h<=0 || stride >= INT_MAX || stride*(uint64_t)(h+128) >= INT_MAX) {
+ av_log(&imgutils, AV_LOG_ERROR, "Picture size %ux%u is invalid\n", w, h);
+ return AVERROR(EINVAL);
+ }
- av_log(&imgutils, AV_LOG_ERROR, "Picture size %ux%u is invalid\n", w, h);
- return AVERROR(EINVAL);
+ if (max_pixels < INT64_MAX) {
+ if (w*(int64_t)h > max_pixels) {
+ av_log(&imgutils, AV_LOG_ERROR,
+ "Picture size %ux%u exceeds specified max pixel count %"PRId64", see the documentation if you wish to increase it\n",
+ w, h, max_pixels);
+ return AVERROR(EINVAL);
+ }
+ }
+
+ return 0;
+}
+
+int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx)
+{
+ return av_image_check_size2(w, h, INT64_MAX, AV_PIX_FMT_NONE, log_offset, log_ctx);
}
int av_image_check_sar(unsigned int w, unsigned int h, AVRational sar)
@@ -284,9 +304,9 @@ int av_image_check_sar(unsigned int w, unsigned int h, AVRational sar)
return AVERROR(EINVAL);
}
-void av_image_copy_plane(uint8_t *dst, int dst_linesize,
- const uint8_t *src, int src_linesize,
- int bytewidth, int height)
+static void image_copy_plane(uint8_t *dst, ptrdiff_t dst_linesize,
+ const uint8_t *src, ptrdiff_t src_linesize,
+ ptrdiff_t bytewidth, int height)
{
if (!dst || !src)
return;
@@ -299,9 +319,33 @@ void av_image_copy_plane(uint8_t *dst, int dst_linesize,
}
}
-void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
- const uint8_t *src_data[4], const int src_linesizes[4],
- enum AVPixelFormat pix_fmt, int width, int height)
+static void image_copy_plane_uc_from(uint8_t *dst, ptrdiff_t dst_linesize,
+ const uint8_t *src, ptrdiff_t src_linesize,
+ ptrdiff_t bytewidth, int height)
+{
+ int ret = -1;
+
+#if ARCH_X86
+ ret = ff_image_copy_plane_uc_from_x86(dst, dst_linesize, src, src_linesize,
+ bytewidth, height);
+#endif
+
+ if (ret < 0)
+ image_copy_plane(dst, dst_linesize, src, src_linesize, bytewidth, height);
+}
+
+void av_image_copy_plane(uint8_t *dst, int dst_linesize,
+ const uint8_t *src, int src_linesize,
+ int bytewidth, int height)
+{
+ image_copy_plane(dst, dst_linesize, src, src_linesize, bytewidth, height);
+}
+
+static void image_copy(uint8_t *dst_data[4], const ptrdiff_t dst_linesizes[4],
+ const uint8_t *src_data[4], const ptrdiff_t src_linesizes[4],
+ enum AVPixelFormat pix_fmt, int width, int height,
+ void (*copy_plane)(uint8_t *, ptrdiff_t, const uint8_t *,
+ ptrdiff_t, ptrdiff_t, int))
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
@@ -310,9 +354,9 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
if (desc->flags & AV_PIX_FMT_FLAG_PAL ||
desc->flags & AV_PIX_FMT_FLAG_PSEUDOPAL) {
- av_image_copy_plane(dst_data[0], dst_linesizes[0],
- src_data[0], src_linesizes[0],
- width, height);
+ copy_plane(dst_data[0], dst_linesizes[0],
+ src_data[0], src_linesizes[0],
+ width, height);
/* copy the palette */
memcpy(dst_data[1], src_data[1], 4*256);
} else {
@@ -323,7 +367,7 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
for (i = 0; i < planes_nb; i++) {
int h = height;
- int bwidth = av_image_get_linesize(pix_fmt, width, i);
+ ptrdiff_t bwidth = av_image_get_linesize(pix_fmt, width, i);
if (bwidth < 0) {
av_log(NULL, AV_LOG_ERROR, "av_image_get_linesize failed\n");
return;
@@ -331,13 +375,37 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
if (i == 1 || i == 2) {
h = AV_CEIL_RSHIFT(height, desc->log2_chroma_h);
}
- av_image_copy_plane(dst_data[i], dst_linesizes[i],
- src_data[i], src_linesizes[i],
- bwidth, h);
+ copy_plane(dst_data[i], dst_linesizes[i],
+ src_data[i], src_linesizes[i],
+ bwidth, h);
}
}
}
+void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
+ const uint8_t *src_data[4], const int src_linesizes[4],
+ enum AVPixelFormat pix_fmt, int width, int height)
+{
+ ptrdiff_t dst_linesizes1[4], src_linesizes1[4];
+ int i;
+
+ for (i = 0; i < 4; i++) {
+ dst_linesizes1[i] = dst_linesizes[i];
+ src_linesizes1[i] = src_linesizes[i];
+ }
+
+ image_copy(dst_data, dst_linesizes1, src_data, src_linesizes1, pix_fmt,
+ width, height, image_copy_plane);
+}
+
+void av_image_copy_uc_from(uint8_t *dst_data[4], const ptrdiff_t dst_linesizes[4],
+ const uint8_t *src_data[4], const ptrdiff_t src_linesizes[4],
+ enum AVPixelFormat pix_fmt, int width, int height)
+{
+ image_copy(dst_data, dst_linesizes, src_data, src_linesizes, pix_fmt,
+ width, height, image_copy_plane_uc_from);
+}
+
int av_image_fill_arrays(uint8_t *dst_data[4], int dst_linesize[4],
const uint8_t *src, enum AVPixelFormat pix_fmt,
int width, int height, int align)
@@ -423,3 +491,170 @@ int av_image_copy_to_buffer(uint8_t *dst, int dst_size,
return size;
}
+
+// Fill dst[0..dst_size] with the bytes in clear[0..clear_size]. The clear
+// bytes are repeated until dst_size is reached. If dst_size is unaligned (i.e.
+// dst_size%clear_size!=0), the remaining data will be filled with the beginning
+// of the clear data only.
+static void memset_bytes(uint8_t *dst, size_t dst_size, uint8_t *clear,
+ size_t clear_size)
+{
+ size_t pos = 0;
+ int same = 1;
+ int i;
+
+ if (!clear_size)
+ return;
+
+ // Reduce to memset() if possible.
+ for (i = 0; i < clear_size; i++) {
+ if (clear[i] != clear[0]) {
+ same = 0;
+ break;
+ }
+ }
+ if (same)
+ clear_size = 1;
+
+ if (clear_size == 1) {
+ memset(dst, clear[0], dst_size);
+ dst_size = 0;
+ } else if (clear_size == 2) {
+ uint16_t val = AV_RN16(clear);
+ for (; dst_size >= 2; dst_size -= 2) {
+ AV_WN16(dst, val);
+ dst += 2;
+ }
+ } else if (clear_size == 4) {
+ uint32_t val = AV_RN32(clear);
+ for (; dst_size >= 4; dst_size -= 4) {
+ AV_WN32(dst, val);
+ dst += 4;
+ }
+ } else if (clear_size == 8) {
+ uint32_t val = AV_RN64(clear);
+ for (; dst_size >= 8; dst_size -= 8) {
+ AV_WN64(dst, val);
+ dst += 8;
+ }
+ }
+
+ for (; dst_size; dst_size--)
+ *dst++ = clear[pos++ % clear_size];
+}
+
+// Maximum size in bytes of a plane element (usually a pixel, or multiple pixels
+// if it's a subsampled packed format).
+#define MAX_BLOCK_SIZE 32
+
+int av_image_fill_black(uint8_t *dst_data[4], const ptrdiff_t dst_linesize[4],
+ enum AVPixelFormat pix_fmt, enum AVColorRange range,
+ int width, int height)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(pix_fmt);
+ int nb_planes = av_pix_fmt_count_planes(pix_fmt);
+ // A pixel or a group of pixels on each plane, with a value that represents black.
+ // Consider e.g. AV_PIX_FMT_UYVY422 for non-trivial cases.
+ uint8_t clear_block[4][MAX_BLOCK_SIZE] = {{0}}; // clear padding with 0
+ int clear_block_size[4] = {0};
+ ptrdiff_t plane_line_bytes[4] = {0};
+ int rgb, limited;
+ int plane, c;
+
+ if (!desc || nb_planes < 1 || nb_planes > 4 || desc->flags & AV_PIX_FMT_FLAG_HWACCEL)
+ return AVERROR(EINVAL);
+
+ rgb = !!(desc->flags & AV_PIX_FMT_FLAG_RGB);
+ limited = !rgb && range != AVCOL_RANGE_JPEG;
+
+ if (desc->flags & AV_PIX_FMT_FLAG_BITSTREAM) {
+ ptrdiff_t bytewidth = av_image_get_linesize(pix_fmt, width, 0);
+ uint8_t *data;
+ int mono = pix_fmt == AV_PIX_FMT_MONOWHITE || pix_fmt == AV_PIX_FMT_MONOBLACK;
+ int fill = pix_fmt == AV_PIX_FMT_MONOWHITE ? 0xFF : 0;
+ if (nb_planes != 1 || !(rgb || mono) || bytewidth < 1)
+ return AVERROR(EINVAL);
+
+ if (!dst_data)
+ return 0;
+
+ data = dst_data[0];
+
+ // (Bitstream + alpha will be handled incorrectly - it'll remain transparent.)
+ for (;height > 0; height--) {
+ memset(data, fill, bytewidth);
+ data += dst_linesize[0];
+ }
+ return 0;
+ }
+
+ for (c = 0; c < desc->nb_components; c++) {
+ const AVComponentDescriptor comp = desc->comp[c];
+
+ // We try to operate on entire non-subsampled pixel groups (for
+ // AV_PIX_FMT_UYVY422 this would mean two consecutive pixels).
+ clear_block_size[comp.plane] = FFMAX(clear_block_size[comp.plane], comp.step);
+
+ if (clear_block_size[comp.plane] > MAX_BLOCK_SIZE)
+ return AVERROR(EINVAL);
+ }
+
+ // Create a byte array for clearing 1 pixel (sometimes several pixels).
+ for (c = 0; c < desc->nb_components; c++) {
+ const AVComponentDescriptor comp = desc->comp[c];
+ // (Multiple pixels happen e.g. with AV_PIX_FMT_UYVY422.)
+ int w = clear_block_size[comp.plane] / comp.step;
+ uint8_t *c_data[4];
+ const int c_linesize[4] = {0};
+ uint16_t src_array[MAX_BLOCK_SIZE];
+ uint16_t src = 0;
+ int x;
+
+ if (comp.depth > 16)
+ return AVERROR(EINVAL);
+ if (!rgb && comp.depth < 8)
+ return AVERROR(EINVAL);
+ if (w < 1)
+ return AVERROR(EINVAL);
+
+ if (c == 0 && limited) {
+ src = 16 << (comp.depth - 8);
+ } else if ((c == 1 || c == 2) && !rgb) {
+ src = 128 << (comp.depth - 8);
+ } else if (c == 3) {
+ // (Assume even limited YUV uses full range alpha.)
+ src = (1 << comp.depth) - 1;
+ }
+
+ for (x = 0; x < w; x++)
+ src_array[x] = src;
+
+ for (x = 0; x < 4; x++)
+ c_data[x] = &clear_block[x][0];
+
+ av_write_image_line(src_array, c_data, c_linesize, desc, 0, 0, c, w);
+ }
+
+ for (plane = 0; plane < nb_planes; plane++) {
+ plane_line_bytes[plane] = av_image_get_linesize(pix_fmt, width, plane);
+ if (plane_line_bytes[plane] < 0)
+ return AVERROR(EINVAL);
+ }
+
+ if (!dst_data)
+ return 0;
+
+ for (plane = 0; plane < nb_planes; plane++) {
+ size_t bytewidth = plane_line_bytes[plane];
+ uint8_t *data = dst_data[plane];
+ int chroma_div = plane == 1 || plane == 2 ? desc->log2_chroma_h : 0;
+ int plane_h = ((height + ( 1 << chroma_div) - 1)) >> chroma_div;
+
+ for (; plane_h > 0; plane_h--) {
+ memset_bytes(data, bytewidth, &clear_block[plane][0], clear_block_size[plane]);
+ data += dst_linesize[plane];
+ }
+ }
+
+ return 0;
+}
diff --git a/media/ffvpx/libavutil/imgutils.h b/media/ffvpx/libavutil/imgutils.h
index 23282a38fa..5b790ecf0a 100644
--- a/media/ffvpx/libavutil/imgutils.h
+++ b/media/ffvpx/libavutil/imgutils.h
@@ -121,6 +121,24 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
enum AVPixelFormat pix_fmt, int width, int height);
/**
+ * Copy image data located in uncacheable (e.g. GPU mapped) memory. Where
+ * available, this function will use special functionality for reading from such
+ * memory, which may result in greatly improved performance compared to plain
+ * av_image_copy().
+ *
+ * The data pointers and the linesizes must be aligned to the maximum required
+ * by the CPU architecture.
+ *
+ * @note The linesize parameters have the type ptrdiff_t here, while they are
+ * int for av_image_copy().
+ * @note On x86, the linesizes currently need to be aligned to the cacheline
+ * size (i.e. 64) to get improved performance.
+ */
+void av_image_copy_uc_from(uint8_t *dst_data[4], const ptrdiff_t dst_linesizes[4],
+ const uint8_t *src_data[4], const ptrdiff_t src_linesizes[4],
+ enum AVPixelFormat pix_fmt, int width, int height);
+
+/**
* Setup the data pointers and linesizes based on the specified image
* parameters and the provided array.
*
@@ -137,7 +155,7 @@ void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4],
* one call, use av_image_alloc().
*
* @param dst_data data pointers to be filled in
- * @param dst_linesizes linesizes for the image in dst_data to be filled in
+ * @param dst_linesize linesizes for the image in dst_data to be filled in
* @param src buffer which will contain or contains the actual image data, can be NULL
* @param pix_fmt the pixel format of the image
* @param width the width of the image in pixels
@@ -154,7 +172,11 @@ int av_image_fill_arrays(uint8_t *dst_data[4], int dst_linesize[4],
* Return the size in bytes of the amount of data required to store an
* image with the given parameters.
*
- * @param[in] align the assumed linesize alignment
+ * @param pix_fmt the pixel format of the image
+ * @param width the width of the image in pixels
+ * @param height the height of the image in pixels
+ * @param align the assumed linesize alignment
+ * @return the buffer size in bytes, a negative error code in case of failure
*/
int av_image_get_buffer_size(enum AVPixelFormat pix_fmt, int width, int height, int align);
@@ -167,7 +189,7 @@ int av_image_get_buffer_size(enum AVPixelFormat pix_fmt, int width, int height,
* @param dst a buffer into which picture data will be copied
* @param dst_size the size in bytes of dst
* @param src_data pointers containing the source image data
- * @param src_linesizes linesizes for the image in src_data
+ * @param src_linesize linesizes for the image in src_data
* @param pix_fmt the pixel format of the source image
* @param width the width of the source image in pixels
* @param height the height of the source image in pixels
@@ -192,6 +214,21 @@ int av_image_copy_to_buffer(uint8_t *dst, int dst_size,
int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx);
/**
+ * Check if the given dimension of an image is valid, meaning that all
+ * bytes of a plane of an image with the specified pix_fmt can be addressed
+ * with a signed int.
+ *
+ * @param w the width of the picture
+ * @param h the height of the picture
+ * @param max_pixels the maximum number of pixels the user wants to accept
+ * @param pix_fmt the pixel format, can be AV_PIX_FMT_NONE if unknown.
+ * @param log_offset the offset to sum to the log level for logging with log_ctx
+ * @param log_ctx the parent logging context, it may be NULL
+ * @return >= 0 if valid, a negative error code otherwise
+ */
+int av_image_check_size2(unsigned int w, unsigned int h, int64_t max_pixels, enum AVPixelFormat pix_fmt, int log_offset, void *log_ctx);
+
+/**
* Check if the given sample aspect ratio of an image is valid.
*
* It is considered invalid if the denominator is 0 or if applying the ratio
@@ -206,6 +243,33 @@ int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *lo
int av_image_check_sar(unsigned int w, unsigned int h, AVRational sar);
/**
+ * Overwrite the image data with black. This is suitable for filling a
+ * sub-rectangle of an image, meaning the padding between the right most pixel
+ * and the left most pixel on the next line will not be overwritten. For some
+ * formats, the image size might be rounded up due to inherent alignment.
+ *
+ * If the pixel format has alpha, the alpha is cleared to opaque.
+ *
+ * This can return an error if the pixel format is not supported. Normally, all
+ * non-hwaccel pixel formats should be supported.
+ *
+ * Passing NULL for dst_data is allowed. Then the function returns whether the
+ * operation would have succeeded. (It can return an error if the pix_fmt is
+ * not supported.)
+ *
+ * @param dst_data data pointers to destination image
+ * @param dst_linesize linesizes for the destination image
+ * @param pix_fmt the pixel format of the image
+ * @param range the color range of the image (important for colorspaces such as YUV)
+ * @param width the width of the image in pixels
+ * @param height the height of the image in pixels
+ * @return 0 if the image data was cleared, a negative AVERROR code otherwise
+ */
+int av_image_fill_black(uint8_t *dst_data[4], const ptrdiff_t dst_linesize[4],
+ enum AVPixelFormat pix_fmt, enum AVColorRange range,
+ int width, int height);
+
+/**
* @}
*/
diff --git a/media/ffvpx/libavutil/imgutils_internal.h b/media/ffvpx/libavutil/imgutils_internal.h
new file mode 100644
index 0000000000..d515858413
--- /dev/null
+++ b/media/ffvpx/libavutil/imgutils_internal.h
@@ -0,0 +1,30 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_IMGUTILS_INTERNAL_H
+#define AVUTIL_IMGUTILS_INTERNAL_H
+
+#include <stddef.h>
+#include <stdint.h>
+
+int ff_image_copy_plane_uc_from_x86(uint8_t *dst, ptrdiff_t dst_linesize,
+ const uint8_t *src, ptrdiff_t src_linesize,
+ ptrdiff_t bytewidth, int height);
+
+
+#endif /* AVUTIL_IMGUTILS_INTERNAL_H */
diff --git a/media/ffvpx/libavutil/internal.h b/media/ffvpx/libavutil/internal.h
index e995af97e4..a2d73e3cc6 100644
--- a/media/ffvpx/libavutil/internal.h
+++ b/media/ffvpx/libavutil/internal.h
@@ -30,6 +30,9 @@
# define NDEBUG
#endif
+// This can be enabled to allow detection of additional integer overflows with ubsan
+//#define CHECKED
+
#include <limits.h>
#include <stdint.h>
#include <stddef.h>
@@ -258,6 +261,16 @@ void avpriv_request_sample(void *avc,
# define ff_dlog(ctx, ...) do { if (0) av_log(ctx, AV_LOG_DEBUG, __VA_ARGS__); } while (0)
#endif
+// For debuging we use signed operations so overflows can be detected (by ubsan)
+// For production we use unsigned so there are no undefined operations
+#ifdef CHECKED
+#define SUINT int
+#define SUINT32 int32_t
+#else
+#define SUINT unsigned
+#define SUINT32 uint32_t
+#endif
+
/**
* Clip and convert a double value into the long long amin-amax range.
* This function is needed because conversion of floating point to integers when
@@ -340,6 +353,4 @@ void ff_check_pixfmt_descriptors(void);
*/
int avpriv_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t timestamp);
-extern const uint8_t ff_reverse[256];
-
#endif /* AVUTIL_INTERNAL_H */
diff --git a/media/ffvpx/libavutil/intreadwrite.h b/media/ffvpx/libavutil/intreadwrite.h
index 51fbe30a23..d54d4b91d6 100644
--- a/media/ffvpx/libavutil/intreadwrite.h
+++ b/media/ffvpx/libavutil/intreadwrite.h
@@ -229,6 +229,11 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
# define AV_RN(s, p) (*((const __unaligned uint##s##_t*)(p)))
# define AV_WN(s, p, v) (*((__unaligned uint##s##_t*)(p)) = (v))
+#elif defined(_MSC_VER) && (defined(_M_ARM) || defined(_M_X64)) && AV_HAVE_FAST_UNALIGNED
+
+# define AV_RN(s, p) (*((const __unaligned uint##s##_t*)(p)))
+# define AV_WN(s, p, v) (*((__unaligned uint##s##_t*)(p)) = (v))
+
#elif AV_HAVE_FAST_UNALIGNED
# define AV_RN(s, p) (((const av_alias##s*)(p))->u##s)
@@ -242,8 +247,8 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
((const uint8_t*)(x))[1])
#endif
#ifndef AV_WB16
-# define AV_WB16(p, darg) do { \
- unsigned d = (darg); \
+# define AV_WB16(p, val) do { \
+ uint16_t d = (val); \
((uint8_t*)(p))[1] = (d); \
((uint8_t*)(p))[0] = (d)>>8; \
} while(0)
@@ -255,8 +260,8 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
((const uint8_t*)(x))[0])
#endif
#ifndef AV_WL16
-# define AV_WL16(p, darg) do { \
- unsigned d = (darg); \
+# define AV_WL16(p, val) do { \
+ uint16_t d = (val); \
((uint8_t*)(p))[0] = (d); \
((uint8_t*)(p))[1] = (d)>>8; \
} while(0)
@@ -270,8 +275,8 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
((const uint8_t*)(x))[3])
#endif
#ifndef AV_WB32
-# define AV_WB32(p, darg) do { \
- unsigned d = (darg); \
+# define AV_WB32(p, val) do { \
+ uint32_t d = (val); \
((uint8_t*)(p))[3] = (d); \
((uint8_t*)(p))[2] = (d)>>8; \
((uint8_t*)(p))[1] = (d)>>16; \
@@ -287,8 +292,8 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
((const uint8_t*)(x))[0])
#endif
#ifndef AV_WL32
-# define AV_WL32(p, darg) do { \
- unsigned d = (darg); \
+# define AV_WL32(p, val) do { \
+ uint32_t d = (val); \
((uint8_t*)(p))[0] = (d); \
((uint8_t*)(p))[1] = (d)>>8; \
((uint8_t*)(p))[2] = (d)>>16; \
@@ -308,8 +313,8 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
(uint64_t)((const uint8_t*)(x))[7])
#endif
#ifndef AV_WB64
-# define AV_WB64(p, darg) do { \
- uint64_t d = (darg); \
+# define AV_WB64(p, val) do { \
+ uint64_t d = (val); \
((uint8_t*)(p))[7] = (d); \
((uint8_t*)(p))[6] = (d)>>8; \
((uint8_t*)(p))[5] = (d)>>16; \
@@ -333,8 +338,8 @@ union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias;
(uint64_t)((const uint8_t*)(x))[0])
#endif
#ifndef AV_WL64
-# define AV_WL64(p, darg) do { \
- uint64_t d = (darg); \
+# define AV_WL64(p, val) do { \
+ uint64_t d = (val); \
((uint8_t*)(p))[0] = (d); \
((uint8_t*)(p))[1] = (d)>>8; \
((uint8_t*)(p))[2] = (d)>>16; \
diff --git a/media/ffvpx/libavutil/log.c b/media/ffvpx/libavutil/log.c
index 44c11cb091..be806202ff 100644
--- a/media/ffvpx/libavutil/log.c
+++ b/media/ffvpx/libavutil/log.c
@@ -168,19 +168,19 @@ static void colored_fputs(int level, int tint, const char *str)
#else
if (local_use_color == 1) {
fprintf(stderr,
- "\033[%d;3%dm%s\033[0m",
+ "\033[%"PRIu32";3%"PRIu32"m%s\033[0m",
(color[level] >> 4) & 15,
color[level] & 15,
str);
} else if (tint && use_color == 256) {
fprintf(stderr,
- "\033[48;5;%dm\033[38;5;%dm%s\033[0m",
+ "\033[48;5;%"PRIu32"m\033[38;5;%dm%s\033[0m",
(color[level] >> 16) & 0xff,
tint,
str);
} else if (local_use_color == 256) {
fprintf(stderr,
- "\033[48;5;%dm\033[38;5;%dm%s\033[0m",
+ "\033[48;5;%"PRIu32"m\033[38;5;%"PRIu32"m%s\033[0m",
(color[level] >> 16) & 0xff,
(color[level] >> 8) & 0xff,
str);
diff --git a/media/ffvpx/libavutil/lzo.c b/media/ffvpx/libavutil/lzo.c
deleted file mode 100644
index 1ae076e335..0000000000
--- a/media/ffvpx/libavutil/lzo.c
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * LZO 1x decompression
- * Copyright (c) 2006 Reimar Doeffinger
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include <string.h>
-
-#include "avutil.h"
-#include "avassert.h"
-#include "common.h"
-#include "intreadwrite.h"
-#include "lzo.h"
-
-/// Define if we may write up to 12 bytes beyond the output buffer.
-#define OUTBUF_PADDED 1
-/// Define if we may read up to 8 bytes beyond the input buffer.
-#define INBUF_PADDED 1
-
-typedef struct LZOContext {
- const uint8_t *in, *in_end;
- uint8_t *out_start, *out, *out_end;
- int error;
-} LZOContext;
-
-/**
- * @brief Reads one byte from the input buffer, avoiding an overrun.
- * @return byte read
- */
-static inline int get_byte(LZOContext *c)
-{
- if (c->in < c->in_end)
- return *c->in++;
- c->error |= AV_LZO_INPUT_DEPLETED;
- return 1;
-}
-
-#ifdef INBUF_PADDED
-#define GETB(c) (*(c).in++)
-#else
-#define GETB(c) get_byte(&(c))
-#endif
-
-/**
- * @brief Decodes a length value in the coding used by lzo.
- * @param x previous byte value
- * @param mask bits used from x
- * @return decoded length value
- */
-static inline int get_len(LZOContext *c, int x, int mask)
-{
- int cnt = x & mask;
- if (!cnt) {
- while (!(x = get_byte(c))) {
- if (cnt >= INT_MAX - 1000) {
- c->error |= AV_LZO_ERROR;
- break;
- }
- cnt += 255;
- }
- cnt += mask + x;
- }
- return cnt;
-}
-
-/**
- * @brief Copies bytes from input to output buffer with checking.
- * @param cnt number of bytes to copy, must be >= 0
- */
-static inline void copy(LZOContext *c, int cnt)
-{
- register const uint8_t *src = c->in;
- register uint8_t *dst = c->out;
- av_assert0(cnt >= 0);
- if (cnt > c->in_end - src) {
- cnt = FFMAX(c->in_end - src, 0);
- c->error |= AV_LZO_INPUT_DEPLETED;
- }
- if (cnt > c->out_end - dst) {
- cnt = FFMAX(c->out_end - dst, 0);
- c->error |= AV_LZO_OUTPUT_FULL;
- }
-#if defined(INBUF_PADDED) && defined(OUTBUF_PADDED)
- AV_COPY32U(dst, src);
- src += 4;
- dst += 4;
- cnt -= 4;
- if (cnt > 0)
-#endif
- memcpy(dst, src, cnt);
- c->in = src + cnt;
- c->out = dst + cnt;
-}
-
-/**
- * @brief Copies previously decoded bytes to current position.
- * @param back how many bytes back we start, must be > 0
- * @param cnt number of bytes to copy, must be > 0
- *
- * cnt > back is valid, this will copy the bytes we just copied,
- * thus creating a repeating pattern with a period length of back.
- */
-static inline void copy_backptr(LZOContext *c, int back, int cnt)
-{
- register uint8_t *dst = c->out;
- av_assert0(cnt > 0);
- if (dst - c->out_start < back) {
- c->error |= AV_LZO_INVALID_BACKPTR;
- return;
- }
- if (cnt > c->out_end - dst) {
- cnt = FFMAX(c->out_end - dst, 0);
- c->error |= AV_LZO_OUTPUT_FULL;
- }
- av_memcpy_backptr(dst, back, cnt);
- c->out = dst + cnt;
-}
-
-int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen)
-{
- int state = 0;
- int x;
- LZOContext c;
- if (*outlen <= 0 || *inlen <= 0) {
- int res = 0;
- if (*outlen <= 0)
- res |= AV_LZO_OUTPUT_FULL;
- if (*inlen <= 0)
- res |= AV_LZO_INPUT_DEPLETED;
- return res;
- }
- c.in = in;
- c.in_end = (const uint8_t *)in + *inlen;
- c.out = c.out_start = out;
- c.out_end = (uint8_t *)out + *outlen;
- c.error = 0;
- x = GETB(c);
- if (x > 17) {
- copy(&c, x - 17);
- x = GETB(c);
- if (x < 16)
- c.error |= AV_LZO_ERROR;
- }
- if (c.in > c.in_end)
- c.error |= AV_LZO_INPUT_DEPLETED;
- while (!c.error) {
- int cnt, back;
- if (x > 15) {
- if (x > 63) {
- cnt = (x >> 5) - 1;
- back = (GETB(c) << 3) + ((x >> 2) & 7) + 1;
- } else if (x > 31) {
- cnt = get_len(&c, x, 31);
- x = GETB(c);
- back = (GETB(c) << 6) + (x >> 2) + 1;
- } else {
- cnt = get_len(&c, x, 7);
- back = (1 << 14) + ((x & 8) << 11);
- x = GETB(c);
- back += (GETB(c) << 6) + (x >> 2);
- if (back == (1 << 14)) {
- if (cnt != 1)
- c.error |= AV_LZO_ERROR;
- break;
- }
- }
- } else if (!state) {
- cnt = get_len(&c, x, 15);
- copy(&c, cnt + 3);
- x = GETB(c);
- if (x > 15)
- continue;
- cnt = 1;
- back = (1 << 11) + (GETB(c) << 2) + (x >> 2) + 1;
- } else {
- cnt = 0;
- back = (GETB(c) << 2) + (x >> 2) + 1;
- }
- copy_backptr(&c, back, cnt + 2);
- state =
- cnt = x & 3;
- copy(&c, cnt);
- x = GETB(c);
- }
- *inlen = c.in_end - c.in;
- if (c.in > c.in_end)
- *inlen = 0;
- *outlen = c.out_end - c.out;
- return c.error;
-}
diff --git a/media/ffvpx/libavutil/lzo.h b/media/ffvpx/libavutil/lzo.h
deleted file mode 100644
index c03403992d..0000000000
--- a/media/ffvpx/libavutil/lzo.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * LZO 1x decompression
- * copyright (c) 2006 Reimar Doeffinger
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_LZO_H
-#define AVUTIL_LZO_H
-
-/**
- * @defgroup lavu_lzo LZO
- * @ingroup lavu_crypto
- *
- * @{
- */
-
-#include <stdint.h>
-
-/** @name Error flags returned by av_lzo1x_decode
- * @{ */
-/// end of the input buffer reached before decoding finished
-#define AV_LZO_INPUT_DEPLETED 1
-/// decoded data did not fit into output buffer
-#define AV_LZO_OUTPUT_FULL 2
-/// a reference to previously decoded data was wrong
-#define AV_LZO_INVALID_BACKPTR 4
-/// a non-specific error in the compressed bitstream
-#define AV_LZO_ERROR 8
-/** @} */
-
-#define AV_LZO_INPUT_PADDING 8
-#define AV_LZO_OUTPUT_PADDING 12
-
-/**
- * @brief Decodes LZO 1x compressed data.
- * @param out output buffer
- * @param outlen size of output buffer, number of bytes left are returned here
- * @param in input buffer
- * @param inlen size of input buffer, number of bytes left are returned here
- * @return 0 on success, otherwise a combination of the error flags above
- *
- * Make sure all buffers are appropriately padded, in must provide
- * AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes.
- */
-int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen);
-
-/**
- * @}
- */
-
-#endif /* AVUTIL_LZO_H */
diff --git a/media/ffvpx/libavutil/mathematics.c b/media/ffvpx/libavutil/mathematics.c
index 20ff37f5e9..1bf044cdf1 100644
--- a/media/ffvpx/libavutil/mathematics.c
+++ b/media/ffvpx/libavutil/mathematics.c
@@ -115,15 +115,15 @@ int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd)
if (t1 > INT64_MAX)
return INT64_MIN;
return t1;
- }
#else
+ /* reference code doing (a*b + r) / c, requires libavutil/integer.h */
AVInteger ai;
ai = av_mul_i(av_int2i(a), av_int2i(b));
ai = av_add_i(ai, av_int2i(r));
return av_i2int(av_div_i(ai, av_int2i(c)));
- }
#endif
+ }
}
int64_t av_rescale(int64_t a, int64_t b, int64_t c)
diff --git a/media/ffvpx/libavutil/mem.c b/media/ffvpx/libavutil/mem.c
index 1a8fc21e98..36740f1154 100644
--- a/media/ffvpx/libavutil/mem.c
+++ b/media/ffvpx/libavutil/mem.c
@@ -77,22 +77,12 @@ void av_max_alloc(size_t max){
void *av_malloc(size_t size)
{
void *ptr = NULL;
-#if CONFIG_MEMALIGN_HACK
- long diff;
-#endif
/* let's disallow possibly ambiguous cases */
if (size > (max_alloc_size - 32))
return NULL;
-#if CONFIG_MEMALIGN_HACK
- ptr = malloc(size + ALIGN);
- if (!ptr)
- return ptr;
- diff = ((~(long)ptr)&(ALIGN - 1)) + 1;
- ptr = (char *)ptr + diff;
- ((char *)ptr)[-1] = diff;
-#elif HAVE_POSIX_MEMALIGN
+#if HAVE_POSIX_MEMALIGN
if (size) //OS X on SDK 10.6 has a broken posix_memalign implementation
if (posix_memalign(&ptr, ALIGN, size))
ptr = NULL;
@@ -144,25 +134,11 @@ void *av_malloc(size_t size)
void *av_realloc(void *ptr, size_t size)
{
-#if CONFIG_MEMALIGN_HACK
- int diff;
-#endif
-
/* let's disallow possibly ambiguous cases */
if (size > (max_alloc_size - 32))
return NULL;
-#if CONFIG_MEMALIGN_HACK
- //FIXME this isn't aligned correctly, though it probably isn't needed
- if (!ptr)
- return av_malloc(size);
- diff = ((char *)ptr)[-1];
- av_assert0(diff>0 && diff<=ALIGN);
- ptr = realloc((char *)ptr - diff, size + diff);
- if (ptr)
- ptr = (char *)ptr + diff;
- return ptr;
-#elif HAVE_ALIGNED_MALLOC
+#if HAVE_ALIGNED_MALLOC
return _aligned_realloc(ptr, size + !size, ALIGN);
#else
return realloc(ptr, size + !size);
@@ -227,13 +203,7 @@ int av_reallocp_array(void *ptr, size_t nmemb, size_t size)
void av_free(void *ptr)
{
-#if CONFIG_MEMALIGN_HACK
- if (ptr) {
- int v= ((char *)ptr)[-1];
- av_assert0(v>0 && v<=ALIGN);
- free((char *)ptr - v);
- }
-#elif HAVE_ALIGNED_MALLOC
+#if HAVE_ALIGNED_MALLOC
_aligned_free(ptr);
#else
free(ptr);
diff --git a/media/ffvpx/libavutil/mem.h b/media/ffvpx/libavutil/mem.h
index f9d8884788..527cd03191 100644
--- a/media/ffvpx/libavutil/mem.h
+++ b/media/ffvpx/libavutil/mem.h
@@ -97,7 +97,10 @@
#define DECLARE_ASM_CONST(n,t,v) \
AV_PRAGMA(DATA_ALIGN(v,n)) \
static const t __attribute__((aligned(n))) v
-#elif defined(__GNUC__)
+#elif defined(__DJGPP__)
+ #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (FFMIN(n, 16)))) v
+ #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (FFMIN(n, 16)))) v
+#elif defined(__GNUC__) || defined(__clang__)
#define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v
#define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (n))) v
#elif defined(_MSC_VER)
diff --git a/media/ffvpx/libavutil/motion_vector.h b/media/ffvpx/libavutil/motion_vector.h
deleted file mode 100644
index ec29556388..0000000000
--- a/media/ffvpx/libavutil/motion_vector.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_MOTION_VECTOR_H
-#define AVUTIL_MOTION_VECTOR_H
-
-#include <stdint.h>
-
-typedef struct AVMotionVector {
- /**
- * Where the current macroblock comes from; negative value when it comes
- * from the past, positive value when it comes from the future.
- * XXX: set exact relative ref frame reference instead of a +/- 1 "direction".
- */
- int32_t source;
- /**
- * Width and height of the block.
- */
- uint8_t w, h;
- /**
- * Absolute source position. Can be outside the frame area.
- */
- int16_t src_x, src_y;
- /**
- * Absolute destination position. Can be outside the frame area.
- */
- int16_t dst_x, dst_y;
- /**
- * Extra flag information.
- * Currently unused.
- */
- uint64_t flags;
- /**
- * Motion vector
- * src_x = dst_x + motion_x / motion_scale
- * src_y = dst_y + motion_y / motion_scale
- */
- int32_t motion_x, motion_y;
- uint16_t motion_scale;
-} AVMotionVector;
-
-#endif /* AVUTIL_MOTION_VECTOR_H */
diff --git a/media/ffvpx/libavutil/moz.build b/media/ffvpx/libavutil/moz.build
index edc0888b16..201b62fedb 100644
--- a/media/ffvpx/libavutil/moz.build
+++ b/media/ffvpx/libavutil/moz.build
@@ -22,7 +22,6 @@ SOURCES += [
'cpu.c',
'crc.c',
'dict.c',
- 'display.c',
'dummy_funcs.c',
'error.c',
'eval.c',
@@ -38,12 +37,14 @@ SOURCES += [
'log2_tab.c',
'mathematics.c',
'mem.c',
+ 'opt.c',
'parseutils.c',
'pixdesc.c',
'pixelutils.c',
'rational.c',
'reverse.c',
'samplefmt.c',
+ 'slicethread.c',
'threadmessage.c',
'time.c',
'timecode.c',
diff --git a/media/ffvpx/libavutil/opt.c b/media/ffvpx/libavutil/opt.c
new file mode 100644
index 0000000000..df88663e3f
--- /dev/null
+++ b/media/ffvpx/libavutil/opt.c
@@ -0,0 +1,2025 @@
+/*
+ * AVOptions
+ * Copyright (c) 2005 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * AVOptions
+ * @author Michael Niedermayer <michaelni@gmx.at>
+ */
+
+#include "avutil.h"
+#include "avassert.h"
+#include "avstring.h"
+#include "channel_layout.h"
+#include "common.h"
+#include "dict.h"
+#include "eval.h"
+#include "log.h"
+#include "parseutils.h"
+#include "pixdesc.h"
+#include "mathematics.h"
+#include "opt.h"
+#include "samplefmt.h"
+#include "bprint.h"
+
+#include <float.h>
+
+const AVOption *av_opt_next(const void *obj, const AVOption *last)
+{
+ const AVClass *class;
+ if (!obj)
+ return NULL;
+ class = *(const AVClass**)obj;
+ if (!last && class && class->option && class->option[0].name)
+ return class->option;
+ if (last && last[1].name)
+ return ++last;
+ return NULL;
+}
+
+static int read_number(const AVOption *o, const void *dst, double *num, int *den, int64_t *intnum)
+{
+ switch (o->type) {
+ case AV_OPT_TYPE_FLAGS:
+ *intnum = *(unsigned int*)dst;
+ return 0;
+ case AV_OPT_TYPE_PIXEL_FMT:
+ *intnum = *(enum AVPixelFormat *)dst;
+ return 0;
+ case AV_OPT_TYPE_SAMPLE_FMT:
+ *intnum = *(enum AVSampleFormat *)dst;
+ return 0;
+ case AV_OPT_TYPE_BOOL:
+ case AV_OPT_TYPE_INT:
+ *intnum = *(int *)dst;
+ return 0;
+ case AV_OPT_TYPE_CHANNEL_LAYOUT:
+ case AV_OPT_TYPE_DURATION:
+ case AV_OPT_TYPE_INT64:
+ case AV_OPT_TYPE_UINT64:
+ *intnum = *(int64_t *)dst;
+ return 0;
+ case AV_OPT_TYPE_FLOAT:
+ *num = *(float *)dst;
+ return 0;
+ case AV_OPT_TYPE_DOUBLE:
+ *num = *(double *)dst;
+ return 0;
+ case AV_OPT_TYPE_RATIONAL:
+ *intnum = ((AVRational *)dst)->num;
+ *den = ((AVRational *)dst)->den;
+ return 0;
+ case AV_OPT_TYPE_CONST:
+ *num = o->default_val.dbl;
+ return 0;
+ }
+ return AVERROR(EINVAL);
+}
+
+static int write_number(void *obj, const AVOption *o, void *dst, double num, int den, int64_t intnum)
+{
+ if (o->type != AV_OPT_TYPE_FLAGS &&
+ (!den || o->max * den < num * intnum || o->min * den > num * intnum)) {
+ num = den ? num * intnum / den : (num && intnum ? INFINITY : NAN);
+ av_log(obj, AV_LOG_ERROR, "Value %f for parameter '%s' out of range [%g - %g]\n",
+ num, o->name, o->min, o->max);
+ return AVERROR(ERANGE);
+ }
+ if (o->type == AV_OPT_TYPE_FLAGS) {
+ double d = num*intnum/den;
+ if (d < -1.5 || d > 0xFFFFFFFF+0.5 || (llrint(d*256) & 255)) {
+ av_log(obj, AV_LOG_ERROR,
+ "Value %f for parameter '%s' is not a valid set of 32bit integer flags\n",
+ num*intnum/den, o->name);
+ return AVERROR(ERANGE);
+ }
+ }
+
+ switch (o->type) {
+ case AV_OPT_TYPE_PIXEL_FMT:
+ *(enum AVPixelFormat *)dst = llrint(num / den) * intnum;
+ break;
+ case AV_OPT_TYPE_SAMPLE_FMT:
+ *(enum AVSampleFormat *)dst = llrint(num / den) * intnum;
+ break;
+ case AV_OPT_TYPE_BOOL:
+ case AV_OPT_TYPE_FLAGS:
+ case AV_OPT_TYPE_INT:
+ *(int *)dst = llrint(num / den) * intnum;
+ break;
+ case AV_OPT_TYPE_DURATION:
+ case AV_OPT_TYPE_CHANNEL_LAYOUT:
+ case AV_OPT_TYPE_INT64:{
+ double d = num / den;
+ if (intnum == 1 && d == (double)INT64_MAX) {
+ *(int64_t *)dst = INT64_MAX;
+ } else
+ *(int64_t *)dst = llrint(d) * intnum;
+ break;}
+ case AV_OPT_TYPE_UINT64:{
+ double d = num / den;
+ // We must special case uint64_t here as llrint() does not support values
+ // outside the int64_t range and there is no portable function which does
+ // "INT64_MAX + 1ULL" is used as it is representable exactly as IEEE double
+ // while INT64_MAX is not
+ if (intnum == 1 && d == (double)UINT64_MAX) {
+ *(uint64_t *)dst = UINT64_MAX;
+ } else if (d > INT64_MAX + 1ULL) {
+ *(uint64_t *)dst = (llrint(d - (INT64_MAX + 1ULL)) + (INT64_MAX + 1ULL))*intnum;
+ } else {
+ *(uint64_t *)dst = llrint(d) * intnum;
+ }
+ break;}
+ case AV_OPT_TYPE_FLOAT:
+ *(float *)dst = num * intnum / den;
+ break;
+ case AV_OPT_TYPE_DOUBLE:
+ *(double *)dst = num * intnum / den;
+ break;
+ case AV_OPT_TYPE_RATIONAL:
+ case AV_OPT_TYPE_VIDEO_RATE:
+ if ((int) num == num)
+ *(AVRational *)dst = (AVRational) { num *intnum, den };
+ else
+ *(AVRational *)dst = av_d2q(num * intnum / den, 1 << 24);
+ break;
+ default:
+ return AVERROR(EINVAL);
+ }
+ return 0;
+}
+
+static int hexchar2int(char c) {
+ if (c >= '0' && c <= '9')
+ return c - '0';
+ if (c >= 'a' && c <= 'f')
+ return c - 'a' + 10;
+ if (c >= 'A' && c <= 'F')
+ return c - 'A' + 10;
+ return -1;
+}
+
+static int set_string_binary(void *obj, const AVOption *o, const char *val, uint8_t **dst)
+{
+ int *lendst = (int *)(dst + 1);
+ uint8_t *bin, *ptr;
+ int len;
+
+ av_freep(dst);
+ *lendst = 0;
+
+ if (!val || !(len = strlen(val)))
+ return 0;
+
+ if (len & 1)
+ return AVERROR(EINVAL);
+ len /= 2;
+
+ ptr = bin = av_malloc(len);
+ if (!ptr)
+ return AVERROR(ENOMEM);
+ while (*val) {
+ int a = hexchar2int(*val++);
+ int b = hexchar2int(*val++);
+ if (a < 0 || b < 0) {
+ av_free(bin);
+ return AVERROR(EINVAL);
+ }
+ *ptr++ = (a << 4) | b;
+ }
+ *dst = bin;
+ *lendst = len;
+
+ return 0;
+}
+
+static int set_string(void *obj, const AVOption *o, const char *val, uint8_t **dst)
+{
+ av_freep(dst);
+ *dst = av_strdup(val);
+ return *dst ? 0 : AVERROR(ENOMEM);
+}
+
+#define DEFAULT_NUMVAL(opt) ((opt->type == AV_OPT_TYPE_INT64 || \
+ opt->type == AV_OPT_TYPE_UINT64 || \
+ opt->type == AV_OPT_TYPE_CONST || \
+ opt->type == AV_OPT_TYPE_FLAGS || \
+ opt->type == AV_OPT_TYPE_INT) \
+ ? opt->default_val.i64 \
+ : opt->default_val.dbl)
+
+static int set_string_number(void *obj, void *target_obj, const AVOption *o, const char *val, void *dst)
+{
+ int ret = 0;
+ int num, den;
+ char c;
+
+ if (sscanf(val, "%d%*1[:/]%d%c", &num, &den, &c) == 2) {
+ if ((ret = write_number(obj, o, dst, 1, den, num)) >= 0)
+ return ret;
+ ret = 0;
+ }
+
+ for (;;) {
+ int i = 0;
+ char buf[256];
+ int cmd = 0;
+ double d;
+ int64_t intnum = 1;
+
+ if (o->type == AV_OPT_TYPE_FLAGS) {
+ if (*val == '+' || *val == '-')
+ cmd = *(val++);
+ for (; i < sizeof(buf) - 1 && val[i] && val[i] != '+' && val[i] != '-'; i++)
+ buf[i] = val[i];
+ buf[i] = 0;
+ }
+
+ {
+ const AVOption *o_named = av_opt_find(target_obj, i ? buf : val, o->unit, 0, 0);
+ int res;
+ int ci = 0;
+ double const_values[64];
+ const char * const_names[64];
+ if (o_named && o_named->type == AV_OPT_TYPE_CONST)
+ d = DEFAULT_NUMVAL(o_named);
+ else {
+ if (o->unit) {
+ for (o_named = NULL; o_named = av_opt_next(target_obj, o_named); ) {
+ if (o_named->type == AV_OPT_TYPE_CONST &&
+ o_named->unit &&
+ !strcmp(o_named->unit, o->unit)) {
+ if (ci + 6 >= FF_ARRAY_ELEMS(const_values)) {
+ av_log(obj, AV_LOG_ERROR, "const_values array too small for %s\n", o->unit);
+ return AVERROR_PATCHWELCOME;
+ }
+ const_names [ci ] = o_named->name;
+ const_values[ci++] = DEFAULT_NUMVAL(o_named);
+ }
+ }
+ }
+ const_names [ci ] = "default";
+ const_values[ci++] = DEFAULT_NUMVAL(o);
+ const_names [ci ] = "max";
+ const_values[ci++] = o->max;
+ const_names [ci ] = "min";
+ const_values[ci++] = o->min;
+ const_names [ci ] = "none";
+ const_values[ci++] = 0;
+ const_names [ci ] = "all";
+ const_values[ci++] = ~0;
+ const_names [ci] = NULL;
+ const_values[ci] = 0;
+
+ res = av_expr_parse_and_eval(&d, i ? buf : val, const_names,
+ const_values, NULL, NULL, NULL, NULL, NULL, 0, obj);
+ if (res < 0) {
+ av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\"\n", val);
+ return res;
+ }
+ }
+ }
+ if (o->type == AV_OPT_TYPE_FLAGS) {
+ read_number(o, dst, NULL, NULL, &intnum);
+ if (cmd == '+')
+ d = intnum | (int64_t)d;
+ else if (cmd == '-')
+ d = intnum &~(int64_t)d;
+ }
+
+ if ((ret = write_number(obj, o, dst, d, 1, 1)) < 0)
+ return ret;
+ val += i;
+ if (!i || !*val)
+ return 0;
+ }
+}
+
+static int set_string_image_size(void *obj, const AVOption *o, const char *val, int *dst)
+{
+ int ret;
+
+ if (!val || !strcmp(val, "none")) {
+ dst[0] =
+ dst[1] = 0;
+ return 0;
+ }
+ ret = av_parse_video_size(dst, dst + 1, val);
+ if (ret < 0)
+ av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as image size\n", val);
+ return ret;
+}
+
+static int set_string_video_rate(void *obj, const AVOption *o, const char *val, AVRational *dst)
+{
+ int ret;
+ if (!val) {
+ ret = AVERROR(EINVAL);
+ } else {
+ ret = av_parse_video_rate(dst, val);
+ }
+ if (ret < 0)
+ av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as video rate\n", val);
+ return ret;
+}
+
+static int set_string_color(void *obj, const AVOption *o, const char *val, uint8_t *dst)
+{
+ int ret;
+
+ if (!val) {
+ return 0;
+ } else {
+ ret = av_parse_color(dst, val, -1, obj);
+ if (ret < 0)
+ av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as color\n", val);
+ return ret;
+ }
+ return 0;
+}
+
+static const char *get_bool_name(int val)
+{
+ if (val < 0)
+ return "auto";
+ return val ? "true" : "false";
+}
+
+static int set_string_bool(void *obj, const AVOption *o, const char *val, int *dst)
+{
+ int n;
+
+ if (!val)
+ return 0;
+
+ if (!strcmp(val, "auto")) {
+ n = -1;
+ } else if (av_match_name(val, "true,y,yes,enable,enabled,on")) {
+ n = 1;
+ } else if (av_match_name(val, "false,n,no,disable,disabled,off")) {
+ n = 0;
+ } else {
+ char *end = NULL;
+ n = strtol(val, &end, 10);
+ if (val + strlen(val) != end)
+ goto fail;
+ }
+
+ if (n < o->min || n > o->max)
+ goto fail;
+
+ *dst = n;
+ return 0;
+
+fail:
+ av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as boolean\n", val);
+ return AVERROR(EINVAL);
+}
+
+static int set_string_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst,
+ int fmt_nb, int ((*get_fmt)(const char *)), const char *desc)
+{
+ int fmt, min, max;
+
+ if (!val || !strcmp(val, "none")) {
+ fmt = -1;
+ } else {
+ fmt = get_fmt(val);
+ if (fmt == -1) {
+ char *tail;
+ fmt = strtol(val, &tail, 0);
+ if (*tail || (unsigned)fmt >= fmt_nb) {
+ av_log(obj, AV_LOG_ERROR,
+ "Unable to parse option value \"%s\" as %s\n", val, desc);
+ return AVERROR(EINVAL);
+ }
+ }
+ }
+
+ min = FFMAX(o->min, -1);
+ max = FFMIN(o->max, fmt_nb-1);
+
+ // hack for compatibility with old ffmpeg
+ if(min == 0 && max == 0) {
+ min = -1;
+ max = fmt_nb-1;
+ }
+
+ if (fmt < min || fmt > max) {
+ av_log(obj, AV_LOG_ERROR,
+ "Value %d for parameter '%s' out of %s format range [%d - %d]\n",
+ fmt, o->name, desc, min, max);
+ return AVERROR(ERANGE);
+ }
+
+ *(int *)dst = fmt;
+ return 0;
+}
+
+static int set_string_pixel_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst)
+{
+ return set_string_fmt(obj, o, val, dst,
+ AV_PIX_FMT_NB, av_get_pix_fmt, "pixel format");
+}
+
+static int set_string_sample_fmt(void *obj, const AVOption *o, const char *val, uint8_t *dst)
+{
+ return set_string_fmt(obj, o, val, dst,
+ AV_SAMPLE_FMT_NB, av_get_sample_fmt, "sample format");
+}
+
+int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
+{
+ int ret = 0;
+ void *dst, *target_obj;
+ const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
+ if (!o || !target_obj)
+ return AVERROR_OPTION_NOT_FOUND;
+ if (!val && (o->type != AV_OPT_TYPE_STRING &&
+ o->type != AV_OPT_TYPE_PIXEL_FMT && o->type != AV_OPT_TYPE_SAMPLE_FMT &&
+ o->type != AV_OPT_TYPE_IMAGE_SIZE && o->type != AV_OPT_TYPE_VIDEO_RATE &&
+ o->type != AV_OPT_TYPE_DURATION && o->type != AV_OPT_TYPE_COLOR &&
+ o->type != AV_OPT_TYPE_CHANNEL_LAYOUT && o->type != AV_OPT_TYPE_BOOL))
+ return AVERROR(EINVAL);
+
+ if (o->flags & AV_OPT_FLAG_READONLY)
+ return AVERROR(EINVAL);
+
+ dst = ((uint8_t *)target_obj) + o->offset;
+ switch (o->type) {
+ case AV_OPT_TYPE_BOOL:
+ return set_string_bool(obj, o, val, dst);
+ case AV_OPT_TYPE_STRING:
+ return set_string(obj, o, val, dst);
+ case AV_OPT_TYPE_BINARY:
+ return set_string_binary(obj, o, val, dst);
+ case AV_OPT_TYPE_FLAGS:
+ case AV_OPT_TYPE_INT:
+ case AV_OPT_TYPE_INT64:
+ case AV_OPT_TYPE_UINT64:
+ case AV_OPT_TYPE_FLOAT:
+ case AV_OPT_TYPE_DOUBLE:
+ case AV_OPT_TYPE_RATIONAL:
+ return set_string_number(obj, target_obj, o, val, dst);
+ case AV_OPT_TYPE_IMAGE_SIZE:
+ return set_string_image_size(obj, o, val, dst);
+ case AV_OPT_TYPE_VIDEO_RATE: {
+ AVRational tmp;
+ ret = set_string_video_rate(obj, o, val, &tmp);
+ if (ret < 0)
+ return ret;
+ return write_number(obj, o, dst, 1, tmp.den, tmp.num);
+ }
+ case AV_OPT_TYPE_PIXEL_FMT:
+ return set_string_pixel_fmt(obj, o, val, dst);
+ case AV_OPT_TYPE_SAMPLE_FMT:
+ return set_string_sample_fmt(obj, o, val, dst);
+ case AV_OPT_TYPE_DURATION:
+ if (!val) {
+ *(int64_t *)dst = 0;
+ return 0;
+ } else {
+ if ((ret = av_parse_time(dst, val, 1)) < 0)
+ av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as duration\n", val);
+ return ret;
+ }
+ break;
+ case AV_OPT_TYPE_COLOR:
+ return set_string_color(obj, o, val, dst);
+ case AV_OPT_TYPE_CHANNEL_LAYOUT:
+ if (!val || !strcmp(val, "none")) {
+ *(int64_t *)dst = 0;
+ } else {
+ int64_t cl = av_get_channel_layout(val);
+ if (!cl) {
+ av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as channel layout\n", val);
+ ret = AVERROR(EINVAL);
+ }
+ *(int64_t *)dst = cl;
+ return ret;
+ }
+ break;
+ }
+
+ av_log(obj, AV_LOG_ERROR, "Invalid option type.\n");
+ return AVERROR(EINVAL);
+}
+
+#define OPT_EVAL_NUMBER(name, opttype, vartype) \
+int av_opt_eval_ ## name(void *obj, const AVOption *o, \
+ const char *val, vartype *name ## _out) \
+{ \
+ if (!o || o->type != opttype || o->flags & AV_OPT_FLAG_READONLY) \
+ return AVERROR(EINVAL); \
+ return set_string_number(obj, obj, o, val, name ## _out); \
+}
+
+OPT_EVAL_NUMBER(flags, AV_OPT_TYPE_FLAGS, int)
+OPT_EVAL_NUMBER(int, AV_OPT_TYPE_INT, int)
+OPT_EVAL_NUMBER(int64, AV_OPT_TYPE_INT64, int64_t)
+OPT_EVAL_NUMBER(float, AV_OPT_TYPE_FLOAT, float)
+OPT_EVAL_NUMBER(double, AV_OPT_TYPE_DOUBLE, double)
+OPT_EVAL_NUMBER(q, AV_OPT_TYPE_RATIONAL, AVRational)
+
+static int set_number(void *obj, const char *name, double num, int den, int64_t intnum,
+ int search_flags)
+{
+ void *dst, *target_obj;
+ const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
+
+ if (!o || !target_obj)
+ return AVERROR_OPTION_NOT_FOUND;
+
+ if (o->flags & AV_OPT_FLAG_READONLY)
+ return AVERROR(EINVAL);
+
+ dst = ((uint8_t *)target_obj) + o->offset;
+ return write_number(obj, o, dst, num, den, intnum);
+}
+
+int av_opt_set_int(void *obj, const char *name, int64_t val, int search_flags)
+{
+ return set_number(obj, name, 1, 1, val, search_flags);
+}
+
+int av_opt_set_double(void *obj, const char *name, double val, int search_flags)
+{
+ return set_number(obj, name, val, 1, 1, search_flags);
+}
+
+int av_opt_set_q(void *obj, const char *name, AVRational val, int search_flags)
+{
+ return set_number(obj, name, val.num, val.den, 1, search_flags);
+}
+
+int av_opt_set_bin(void *obj, const char *name, const uint8_t *val, int len, int search_flags)
+{
+ void *target_obj;
+ const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
+ uint8_t *ptr;
+ uint8_t **dst;
+ int *lendst;
+
+ if (!o || !target_obj)
+ return AVERROR_OPTION_NOT_FOUND;
+
+ if (o->type != AV_OPT_TYPE_BINARY || o->flags & AV_OPT_FLAG_READONLY)
+ return AVERROR(EINVAL);
+
+ ptr = len ? av_malloc(len) : NULL;
+ if (len && !ptr)
+ return AVERROR(ENOMEM);
+
+ dst = (uint8_t **)(((uint8_t *)target_obj) + o->offset);
+ lendst = (int *)(dst + 1);
+
+ av_free(*dst);
+ *dst = ptr;
+ *lendst = len;
+ if (len)
+ memcpy(ptr, val, len);
+
+ return 0;
+}
+
+int av_opt_set_image_size(void *obj, const char *name, int w, int h, int search_flags)
+{
+ void *target_obj;
+ const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
+
+ if (!o || !target_obj)
+ return AVERROR_OPTION_NOT_FOUND;
+ if (o->type != AV_OPT_TYPE_IMAGE_SIZE) {
+ av_log(obj, AV_LOG_ERROR,
+ "The value set by option '%s' is not an image size.\n", o->name);
+ return AVERROR(EINVAL);
+ }
+ if (w<0 || h<0) {
+ av_log(obj, AV_LOG_ERROR,
+ "Invalid negative size value %dx%d for size '%s'\n", w, h, o->name);
+ return AVERROR(EINVAL);
+ }
+ *(int *)(((uint8_t *)target_obj) + o->offset) = w;
+ *(int *)(((uint8_t *)target_obj+sizeof(int)) + o->offset) = h;
+ return 0;
+}
+
+int av_opt_set_video_rate(void *obj, const char *name, AVRational val, int search_flags)
+{
+ void *target_obj;
+ const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
+
+ if (!o || !target_obj)
+ return AVERROR_OPTION_NOT_FOUND;
+ if (o->type != AV_OPT_TYPE_VIDEO_RATE) {
+ av_log(obj, AV_LOG_ERROR,
+ "The value set by option '%s' is not a video rate.\n", o->name);
+ return AVERROR(EINVAL);
+ }
+ if (val.num <= 0 || val.den <= 0)
+ return AVERROR(EINVAL);
+ return set_number(obj, name, val.num, val.den, 1, search_flags);
+}
+
+static int set_format(void *obj, const char *name, int fmt, int search_flags,
+ enum AVOptionType type, const char *desc, int nb_fmts)
+{
+ void *target_obj;
+ const AVOption *o = av_opt_find2(obj, name, NULL, 0,
+ search_flags, &target_obj);
+ int min, max;
+
+ if (!o || !target_obj)
+ return AVERROR_OPTION_NOT_FOUND;
+ if (o->type != type) {
+ av_log(obj, AV_LOG_ERROR,
+ "The value set by option '%s' is not a %s format", name, desc);
+ return AVERROR(EINVAL);
+ }
+
+ min = FFMAX(o->min, -1);
+ max = FFMIN(o->max, nb_fmts-1);
+
+ if (fmt < min || fmt > max) {
+ av_log(obj, AV_LOG_ERROR,
+ "Value %d for parameter '%s' out of %s format range [%d - %d]\n",
+ fmt, name, desc, min, max);
+ return AVERROR(ERANGE);
+ }
+ *(int *)(((uint8_t *)target_obj) + o->offset) = fmt;
+ return 0;
+}
+
+int av_opt_set_pixel_fmt(void *obj, const char *name, enum AVPixelFormat fmt, int search_flags)
+{
+ return set_format(obj, name, fmt, search_flags, AV_OPT_TYPE_PIXEL_FMT, "pixel", AV_PIX_FMT_NB);
+}
+
+int av_opt_set_sample_fmt(void *obj, const char *name, enum AVSampleFormat fmt, int search_flags)
+{
+ return set_format(obj, name, fmt, search_flags, AV_OPT_TYPE_SAMPLE_FMT, "sample", AV_SAMPLE_FMT_NB);
+}
+
+int av_opt_set_channel_layout(void *obj, const char *name, int64_t cl, int search_flags)
+{
+ void *target_obj;
+ const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
+
+ if (!o || !target_obj)
+ return AVERROR_OPTION_NOT_FOUND;
+ if (o->type != AV_OPT_TYPE_CHANNEL_LAYOUT) {
+ av_log(obj, AV_LOG_ERROR,
+ "The value set by option '%s' is not a channel layout.\n", o->name);
+ return AVERROR(EINVAL);
+ }
+ *(int64_t *)(((uint8_t *)target_obj) + o->offset) = cl;
+ return 0;
+}
+
+int av_opt_set_dict_val(void *obj, const char *name, const AVDictionary *val,
+ int search_flags)
+{
+ void *target_obj;
+ AVDictionary **dst;
+ const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
+
+ if (!o || !target_obj)
+ return AVERROR_OPTION_NOT_FOUND;
+ if (o->flags & AV_OPT_FLAG_READONLY)
+ return AVERROR(EINVAL);
+
+ dst = (AVDictionary **)(((uint8_t *)target_obj) + o->offset);
+ av_dict_free(dst);
+ av_dict_copy(dst, val, 0);
+
+ return 0;
+}
+
+static void format_duration(char *buf, size_t size, int64_t d)
+{
+ char *e;
+
+ av_assert0(size >= 25);
+ if (d < 0 && d != INT64_MIN) {
+ *(buf++) = '-';
+ size--;
+ d = -d;
+ }
+ if (d == INT64_MAX)
+ snprintf(buf, size, "INT64_MAX");
+ else if (d == INT64_MIN)
+ snprintf(buf, size, "INT64_MIN");
+ else if (d > (int64_t)3600*1000000)
+ snprintf(buf, size, "%"PRId64":%02d:%02d.%06d", d / 3600000000,
+ (int)((d / 60000000) % 60),
+ (int)((d / 1000000) % 60),
+ (int)(d % 1000000));
+ else if (d > 60*1000000)
+ snprintf(buf, size, "%d:%02d.%06d",
+ (int)(d / 60000000),
+ (int)((d / 1000000) % 60),
+ (int)(d % 1000000));
+ else
+ snprintf(buf, size, "%d.%06d",
+ (int)(d / 1000000),
+ (int)(d % 1000000));
+ e = buf + strlen(buf);
+ while (e > buf && e[-1] == '0')
+ *(--e) = 0;
+ if (e > buf && e[-1] == '.')
+ *(--e) = 0;
+}
+
+int av_opt_get(void *obj, const char *name, int search_flags, uint8_t **out_val)
+{
+ void *dst, *target_obj;
+ const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
+ uint8_t *bin, buf[128];
+ int len, i, ret;
+ int64_t i64;
+
+ if (!o || !target_obj || (o->offset<=0 && o->type != AV_OPT_TYPE_CONST))
+ return AVERROR_OPTION_NOT_FOUND;
+
+ dst = (uint8_t *)target_obj + o->offset;
+
+ buf[0] = 0;
+ switch (o->type) {
+ case AV_OPT_TYPE_BOOL:
+ ret = snprintf(buf, sizeof(buf), "%s", (char *)av_x_if_null(get_bool_name(*(int *)dst), "invalid"));
+ break;
+ case AV_OPT_TYPE_FLAGS:
+ ret = snprintf(buf, sizeof(buf), "0x%08X", *(int *)dst);
+ break;
+ case AV_OPT_TYPE_INT:
+ ret = snprintf(buf, sizeof(buf), "%d", *(int *)dst);
+ break;
+ case AV_OPT_TYPE_INT64:
+ ret = snprintf(buf, sizeof(buf), "%"PRId64, *(int64_t *)dst);
+ break;
+ case AV_OPT_TYPE_UINT64:
+ ret = snprintf(buf, sizeof(buf), "%"PRIu64, *(uint64_t *)dst);
+ break;
+ case AV_OPT_TYPE_FLOAT:
+ ret = snprintf(buf, sizeof(buf), "%f", *(float *)dst);
+ break;
+ case AV_OPT_TYPE_DOUBLE:
+ ret = snprintf(buf, sizeof(buf), "%f", *(double *)dst);
+ break;
+ case AV_OPT_TYPE_VIDEO_RATE:
+ case AV_OPT_TYPE_RATIONAL:
+ ret = snprintf(buf, sizeof(buf), "%d/%d", ((AVRational *)dst)->num, ((AVRational *)dst)->den);
+ break;
+ case AV_OPT_TYPE_CONST:
+ ret = snprintf(buf, sizeof(buf), "%f", o->default_val.dbl);
+ break;
+ case AV_OPT_TYPE_STRING:
+ if (*(uint8_t **)dst) {
+ *out_val = av_strdup(*(uint8_t **)dst);
+ } else if (search_flags & AV_OPT_ALLOW_NULL) {
+ *out_val = NULL;
+ return 0;
+ } else {
+ *out_val = av_strdup("");
+ }
+ return *out_val ? 0 : AVERROR(ENOMEM);
+ case AV_OPT_TYPE_BINARY:
+ if (!*(uint8_t **)dst && (search_flags & AV_OPT_ALLOW_NULL)) {
+ *out_val = NULL;
+ return 0;
+ }
+ len = *(int *)(((uint8_t *)dst) + sizeof(uint8_t *));
+ if ((uint64_t)len * 2 + 1 > INT_MAX)
+ return AVERROR(EINVAL);
+ if (!(*out_val = av_malloc(len * 2 + 1)))
+ return AVERROR(ENOMEM);
+ if (!len) {
+ *out_val[0] = '\0';
+ return 0;
+ }
+ bin = *(uint8_t **)dst;
+ for (i = 0; i < len; i++)
+ snprintf(*out_val + i * 2, 3, "%02X", bin[i]);
+ return 0;
+ case AV_OPT_TYPE_IMAGE_SIZE:
+ ret = snprintf(buf, sizeof(buf), "%dx%d", ((int *)dst)[0], ((int *)dst)[1]);
+ break;
+ case AV_OPT_TYPE_PIXEL_FMT:
+ ret = snprintf(buf, sizeof(buf), "%s", (char *)av_x_if_null(av_get_pix_fmt_name(*(enum AVPixelFormat *)dst), "none"));
+ break;
+ case AV_OPT_TYPE_SAMPLE_FMT:
+ ret = snprintf(buf, sizeof(buf), "%s", (char *)av_x_if_null(av_get_sample_fmt_name(*(enum AVSampleFormat *)dst), "none"));
+ break;
+ case AV_OPT_TYPE_DURATION:
+ i64 = *(int64_t *)dst;
+ format_duration(buf, sizeof(buf), i64);
+ ret = strlen(buf); // no overflow possible, checked by an assert
+ break;
+ case AV_OPT_TYPE_COLOR:
+ ret = snprintf(buf, sizeof(buf), "0x%02x%02x%02x%02x",
+ (int)((uint8_t *)dst)[0], (int)((uint8_t *)dst)[1],
+ (int)((uint8_t *)dst)[2], (int)((uint8_t *)dst)[3]);
+ break;
+ case AV_OPT_TYPE_CHANNEL_LAYOUT:
+ i64 = *(int64_t *)dst;
+ ret = snprintf(buf, sizeof(buf), "0x%"PRIx64, i64);
+ break;
+ default:
+ return AVERROR(EINVAL);
+ }
+
+ if (ret >= sizeof(buf))
+ return AVERROR(EINVAL);
+ *out_val = av_strdup(buf);
+ return *out_val ? 0 : AVERROR(ENOMEM);
+}
+
+static int get_number(void *obj, const char *name, const AVOption **o_out, double *num, int *den, int64_t *intnum,
+ int search_flags)
+{
+ void *dst, *target_obj;
+ const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
+ if (!o || !target_obj)
+ goto error;
+
+ dst = ((uint8_t *)target_obj) + o->offset;
+
+ if (o_out) *o_out= o;
+
+ return read_number(o, dst, num, den, intnum);
+
+error:
+ *den =
+ *intnum = 0;
+ return -1;
+}
+
+int av_opt_get_int(void *obj, const char *name, int search_flags, int64_t *out_val)
+{
+ int64_t intnum = 1;
+ double num = 1;
+ int ret, den = 1;
+
+ if ((ret = get_number(obj, name, NULL, &num, &den, &intnum, search_flags)) < 0)
+ return ret;
+ *out_val = num * intnum / den;
+ return 0;
+}
+
+int av_opt_get_double(void *obj, const char *name, int search_flags, double *out_val)
+{
+ int64_t intnum = 1;
+ double num = 1;
+ int ret, den = 1;
+
+ if ((ret = get_number(obj, name, NULL, &num, &den, &intnum, search_flags)) < 0)
+ return ret;
+ *out_val = num * intnum / den;
+ return 0;
+}
+
+int av_opt_get_q(void *obj, const char *name, int search_flags, AVRational *out_val)
+{
+ int64_t intnum = 1;
+ double num = 1;
+ int ret, den = 1;
+
+ if ((ret = get_number(obj, name, NULL, &num, &den, &intnum, search_flags)) < 0)
+ return ret;
+
+ if (num == 1.0 && (int)intnum == intnum)
+ *out_val = (AVRational){intnum, den};
+ else
+ *out_val = av_d2q(num*intnum/den, 1<<24);
+ return 0;
+}
+
+int av_opt_get_image_size(void *obj, const char *name, int search_flags, int *w_out, int *h_out)
+{
+ void *dst, *target_obj;
+ const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
+ if (!o || !target_obj)
+ return AVERROR_OPTION_NOT_FOUND;
+ if (o->type != AV_OPT_TYPE_IMAGE_SIZE) {
+ av_log(obj, AV_LOG_ERROR,
+ "The value for option '%s' is not an image size.\n", name);
+ return AVERROR(EINVAL);
+ }
+
+ dst = ((uint8_t*)target_obj) + o->offset;
+ if (w_out) *w_out = *(int *)dst;
+ if (h_out) *h_out = *((int *)dst+1);
+ return 0;
+}
+
+int av_opt_get_video_rate(void *obj, const char *name, int search_flags, AVRational *out_val)
+{
+ int64_t intnum = 1;
+ double num = 1;
+ int ret, den = 1;
+
+ if ((ret = get_number(obj, name, NULL, &num, &den, &intnum, search_flags)) < 0)
+ return ret;
+
+ if (num == 1.0 && (int)intnum == intnum)
+ *out_val = (AVRational) { intnum, den };
+ else
+ *out_val = av_d2q(num * intnum / den, 1 << 24);
+ return 0;
+}
+
+static int get_format(void *obj, const char *name, int search_flags, int *out_fmt,
+ enum AVOptionType type, const char *desc)
+{
+ void *dst, *target_obj;
+ const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
+ if (!o || !target_obj)
+ return AVERROR_OPTION_NOT_FOUND;
+ if (o->type != type) {
+ av_log(obj, AV_LOG_ERROR,
+ "The value for option '%s' is not a %s format.\n", desc, name);
+ return AVERROR(EINVAL);
+ }
+
+ dst = ((uint8_t*)target_obj) + o->offset;
+ *out_fmt = *(int *)dst;
+ return 0;
+}
+
+int av_opt_get_pixel_fmt(void *obj, const char *name, int search_flags, enum AVPixelFormat *out_fmt)
+{
+ return get_format(obj, name, search_flags, out_fmt, AV_OPT_TYPE_PIXEL_FMT, "pixel");
+}
+
+int av_opt_get_sample_fmt(void *obj, const char *name, int search_flags, enum AVSampleFormat *out_fmt)
+{
+ return get_format(obj, name, search_flags, out_fmt, AV_OPT_TYPE_SAMPLE_FMT, "sample");
+}
+
+int av_opt_get_channel_layout(void *obj, const char *name, int search_flags, int64_t *cl)
+{
+ void *dst, *target_obj;
+ const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
+ if (!o || !target_obj)
+ return AVERROR_OPTION_NOT_FOUND;
+ if (o->type != AV_OPT_TYPE_CHANNEL_LAYOUT) {
+ av_log(obj, AV_LOG_ERROR,
+ "The value for option '%s' is not a channel layout.\n", name);
+ return AVERROR(EINVAL);
+ }
+
+ dst = ((uint8_t*)target_obj) + o->offset;
+ *cl = *(int64_t *)dst;
+ return 0;
+}
+
+int av_opt_get_dict_val(void *obj, const char *name, int search_flags, AVDictionary **out_val)
+{
+ void *target_obj;
+ AVDictionary *src;
+ const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
+
+ if (!o || !target_obj)
+ return AVERROR_OPTION_NOT_FOUND;
+ if (o->type != AV_OPT_TYPE_DICT)
+ return AVERROR(EINVAL);
+
+ src = *(AVDictionary **)(((uint8_t *)target_obj) + o->offset);
+ av_dict_copy(out_val, src, 0);
+
+ return 0;
+}
+
+int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name)
+{
+ const AVOption *field = av_opt_find(obj, field_name, NULL, 0, 0);
+ const AVOption *flag = av_opt_find(obj, flag_name,
+ field ? field->unit : NULL, 0, 0);
+ int64_t res;
+
+ if (!field || !flag || flag->type != AV_OPT_TYPE_CONST ||
+ av_opt_get_int(obj, field_name, 0, &res) < 0)
+ return 0;
+ return res & flag->default_val.i64;
+}
+
+static void log_value(void *av_log_obj, int level, double d)
+{
+ if (d == INT_MAX) {
+ av_log(av_log_obj, level, "INT_MAX");
+ } else if (d == INT_MIN) {
+ av_log(av_log_obj, level, "INT_MIN");
+ } else if (d == UINT32_MAX) {
+ av_log(av_log_obj, level, "UINT32_MAX");
+ } else if (d == (double)INT64_MAX) {
+ av_log(av_log_obj, level, "I64_MAX");
+ } else if (d == INT64_MIN) {
+ av_log(av_log_obj, level, "I64_MIN");
+ } else if (d == FLT_MAX) {
+ av_log(av_log_obj, level, "FLT_MAX");
+ } else if (d == FLT_MIN) {
+ av_log(av_log_obj, level, "FLT_MIN");
+ } else if (d == -FLT_MAX) {
+ av_log(av_log_obj, level, "-FLT_MAX");
+ } else if (d == -FLT_MIN) {
+ av_log(av_log_obj, level, "-FLT_MIN");
+ } else if (d == DBL_MAX) {
+ av_log(av_log_obj, level, "DBL_MAX");
+ } else if (d == DBL_MIN) {
+ av_log(av_log_obj, level, "DBL_MIN");
+ } else if (d == -DBL_MAX) {
+ av_log(av_log_obj, level, "-DBL_MAX");
+ } else if (d == -DBL_MIN) {
+ av_log(av_log_obj, level, "-DBL_MIN");
+ } else {
+ av_log(av_log_obj, level, "%g", d);
+ }
+}
+
+static const char *get_opt_const_name(void *obj, const char *unit, int64_t value)
+{
+ const AVOption *opt = NULL;
+
+ if (!unit)
+ return NULL;
+ while ((opt = av_opt_next(obj, opt)))
+ if (opt->type == AV_OPT_TYPE_CONST && !strcmp(opt->unit, unit) &&
+ opt->default_val.i64 == value)
+ return opt->name;
+ return NULL;
+}
+
+static char *get_opt_flags_string(void *obj, const char *unit, int64_t value)
+{
+ const AVOption *opt = NULL;
+ char flags[512];
+
+ flags[0] = 0;
+ if (!unit)
+ return NULL;
+ while ((opt = av_opt_next(obj, opt))) {
+ if (opt->type == AV_OPT_TYPE_CONST && !strcmp(opt->unit, unit) &&
+ opt->default_val.i64 & value) {
+ if (flags[0])
+ av_strlcatf(flags, sizeof(flags), "+");
+ av_strlcatf(flags, sizeof(flags), "%s", opt->name);
+ }
+ }
+ if (flags[0])
+ return av_strdup(flags);
+ return NULL;
+}
+
+static void opt_list(void *obj, void *av_log_obj, const char *unit,
+ int req_flags, int rej_flags)
+{
+ const AVOption *opt = NULL;
+ AVOptionRanges *r;
+ int i;
+
+ while ((opt = av_opt_next(obj, opt))) {
+ if (!(opt->flags & req_flags) || (opt->flags & rej_flags))
+ continue;
+
+ /* Don't print CONST's on level one.
+ * Don't print anything but CONST's on level two.
+ * Only print items from the requested unit.
+ */
+ if (!unit && opt->type == AV_OPT_TYPE_CONST)
+ continue;
+ else if (unit && opt->type != AV_OPT_TYPE_CONST)
+ continue;
+ else if (unit && opt->type == AV_OPT_TYPE_CONST && strcmp(unit, opt->unit))
+ continue;
+ else if (unit && opt->type == AV_OPT_TYPE_CONST)
+ av_log(av_log_obj, AV_LOG_INFO, " %-15s ", opt->name);
+ else
+ av_log(av_log_obj, AV_LOG_INFO, " %s%-17s ",
+ (opt->flags & AV_OPT_FLAG_FILTERING_PARAM) ? "" : "-",
+ opt->name);
+
+ switch (opt->type) {
+ case AV_OPT_TYPE_FLAGS:
+ av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<flags>");
+ break;
+ case AV_OPT_TYPE_INT:
+ av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<int>");
+ break;
+ case AV_OPT_TYPE_INT64:
+ av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<int64>");
+ break;
+ case AV_OPT_TYPE_UINT64:
+ av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<uint64>");
+ break;
+ case AV_OPT_TYPE_DOUBLE:
+ av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<double>");
+ break;
+ case AV_OPT_TYPE_FLOAT:
+ av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<float>");
+ break;
+ case AV_OPT_TYPE_STRING:
+ av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<string>");
+ break;
+ case AV_OPT_TYPE_RATIONAL:
+ av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<rational>");
+ break;
+ case AV_OPT_TYPE_BINARY:
+ av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<binary>");
+ break;
+ case AV_OPT_TYPE_IMAGE_SIZE:
+ av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<image_size>");
+ break;
+ case AV_OPT_TYPE_VIDEO_RATE:
+ av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<video_rate>");
+ break;
+ case AV_OPT_TYPE_PIXEL_FMT:
+ av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<pix_fmt>");
+ break;
+ case AV_OPT_TYPE_SAMPLE_FMT:
+ av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<sample_fmt>");
+ break;
+ case AV_OPT_TYPE_DURATION:
+ av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<duration>");
+ break;
+ case AV_OPT_TYPE_COLOR:
+ av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<color>");
+ break;
+ case AV_OPT_TYPE_CHANNEL_LAYOUT:
+ av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<channel_layout>");
+ break;
+ case AV_OPT_TYPE_BOOL:
+ av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "<boolean>");
+ break;
+ case AV_OPT_TYPE_CONST:
+ default:
+ av_log(av_log_obj, AV_LOG_INFO, "%-12s ", "");
+ break;
+ }
+ av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_ENCODING_PARAM) ? 'E' : '.');
+ av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_DECODING_PARAM) ? 'D' : '.');
+ av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_FILTERING_PARAM)? 'F' : '.');
+ av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_VIDEO_PARAM ) ? 'V' : '.');
+ av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_AUDIO_PARAM ) ? 'A' : '.');
+ av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_SUBTITLE_PARAM) ? 'S' : '.');
+ av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_EXPORT) ? 'X' : '.');
+ av_log(av_log_obj, AV_LOG_INFO, "%c", (opt->flags & AV_OPT_FLAG_READONLY) ? 'R' : '.');
+
+ if (opt->help)
+ av_log(av_log_obj, AV_LOG_INFO, " %s", opt->help);
+
+ if (av_opt_query_ranges(&r, obj, opt->name, AV_OPT_SEARCH_FAKE_OBJ) >= 0) {
+ switch (opt->type) {
+ case AV_OPT_TYPE_INT:
+ case AV_OPT_TYPE_INT64:
+ case AV_OPT_TYPE_UINT64:
+ case AV_OPT_TYPE_DOUBLE:
+ case AV_OPT_TYPE_FLOAT:
+ case AV_OPT_TYPE_RATIONAL:
+ for (i = 0; i < r->nb_ranges; i++) {
+ av_log(av_log_obj, AV_LOG_INFO, " (from ");
+ log_value(av_log_obj, AV_LOG_INFO, r->range[i]->value_min);
+ av_log(av_log_obj, AV_LOG_INFO, " to ");
+ log_value(av_log_obj, AV_LOG_INFO, r->range[i]->value_max);
+ av_log(av_log_obj, AV_LOG_INFO, ")");
+ }
+ break;
+ }
+ av_opt_freep_ranges(&r);
+ }
+
+ if (opt->type != AV_OPT_TYPE_CONST &&
+ opt->type != AV_OPT_TYPE_BINARY &&
+ !((opt->type == AV_OPT_TYPE_COLOR ||
+ opt->type == AV_OPT_TYPE_IMAGE_SIZE ||
+ opt->type == AV_OPT_TYPE_STRING ||
+ opt->type == AV_OPT_TYPE_VIDEO_RATE) &&
+ !opt->default_val.str)) {
+ av_log(av_log_obj, AV_LOG_INFO, " (default ");
+ switch (opt->type) {
+ case AV_OPT_TYPE_BOOL:
+ av_log(av_log_obj, AV_LOG_INFO, "%s", (char *)av_x_if_null(get_bool_name(opt->default_val.i64), "invalid"));
+ break;
+ case AV_OPT_TYPE_FLAGS: {
+ char *def_flags = get_opt_flags_string(obj, opt->unit, opt->default_val.i64);
+ if (def_flags) {
+ av_log(av_log_obj, AV_LOG_INFO, "%s", def_flags);
+ av_freep(&def_flags);
+ } else {
+ av_log(av_log_obj, AV_LOG_INFO, "%"PRIX64, opt->default_val.i64);
+ }
+ break;
+ }
+ case AV_OPT_TYPE_DURATION: {
+ char buf[25];
+ format_duration(buf, sizeof(buf), opt->default_val.i64);
+ av_log(av_log_obj, AV_LOG_INFO, "%s", buf);
+ break;
+ }
+ case AV_OPT_TYPE_INT:
+ case AV_OPT_TYPE_UINT64:
+ case AV_OPT_TYPE_INT64: {
+ const char *def_const = get_opt_const_name(obj, opt->unit, opt->default_val.i64);
+ if (def_const)
+ av_log(av_log_obj, AV_LOG_INFO, "%s", def_const);
+ else
+ log_value(av_log_obj, AV_LOG_INFO, opt->default_val.i64);
+ break;
+ }
+ case AV_OPT_TYPE_DOUBLE:
+ case AV_OPT_TYPE_FLOAT:
+ log_value(av_log_obj, AV_LOG_INFO, opt->default_val.dbl);
+ break;
+ case AV_OPT_TYPE_RATIONAL: {
+ AVRational q = av_d2q(opt->default_val.dbl, INT_MAX);
+ av_log(av_log_obj, AV_LOG_INFO, "%d/%d", q.num, q.den); }
+ break;
+ case AV_OPT_TYPE_PIXEL_FMT:
+ av_log(av_log_obj, AV_LOG_INFO, "%s", (char *)av_x_if_null(av_get_pix_fmt_name(opt->default_val.i64), "none"));
+ break;
+ case AV_OPT_TYPE_SAMPLE_FMT:
+ av_log(av_log_obj, AV_LOG_INFO, "%s", (char *)av_x_if_null(av_get_sample_fmt_name(opt->default_val.i64), "none"));
+ break;
+ case AV_OPT_TYPE_COLOR:
+ case AV_OPT_TYPE_IMAGE_SIZE:
+ case AV_OPT_TYPE_STRING:
+ case AV_OPT_TYPE_VIDEO_RATE:
+ av_log(av_log_obj, AV_LOG_INFO, "\"%s\"", opt->default_val.str);
+ break;
+ case AV_OPT_TYPE_CHANNEL_LAYOUT:
+ av_log(av_log_obj, AV_LOG_INFO, "0x%"PRIx64, opt->default_val.i64);
+ break;
+ }
+ av_log(av_log_obj, AV_LOG_INFO, ")");
+ }
+
+ av_log(av_log_obj, AV_LOG_INFO, "\n");
+ if (opt->unit && opt->type != AV_OPT_TYPE_CONST)
+ opt_list(obj, av_log_obj, opt->unit, req_flags, rej_flags);
+ }
+}
+
+int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags)
+{
+ if (!obj)
+ return -1;
+
+ av_log(av_log_obj, AV_LOG_INFO, "%s AVOptions:\n", (*(AVClass **)obj)->class_name);
+
+ opt_list(obj, av_log_obj, NULL, req_flags, rej_flags);
+
+ return 0;
+}
+
+void av_opt_set_defaults(void *s)
+{
+ av_opt_set_defaults2(s, 0, 0);
+}
+
+void av_opt_set_defaults2(void *s, int mask, int flags)
+{
+ const AVOption *opt = NULL;
+ while ((opt = av_opt_next(s, opt))) {
+ void *dst = ((uint8_t*)s) + opt->offset;
+
+ if ((opt->flags & mask) != flags)
+ continue;
+
+ if (opt->flags & AV_OPT_FLAG_READONLY)
+ continue;
+
+ switch (opt->type) {
+ case AV_OPT_TYPE_CONST:
+ /* Nothing to be done here */
+ break;
+ case AV_OPT_TYPE_BOOL:
+ case AV_OPT_TYPE_FLAGS:
+ case AV_OPT_TYPE_INT:
+ case AV_OPT_TYPE_INT64:
+ case AV_OPT_TYPE_UINT64:
+ case AV_OPT_TYPE_DURATION:
+ case AV_OPT_TYPE_CHANNEL_LAYOUT:
+ case AV_OPT_TYPE_PIXEL_FMT:
+ case AV_OPT_TYPE_SAMPLE_FMT:
+ write_number(s, opt, dst, 1, 1, opt->default_val.i64);
+ break;
+ case AV_OPT_TYPE_DOUBLE:
+ case AV_OPT_TYPE_FLOAT: {
+ double val;
+ val = opt->default_val.dbl;
+ write_number(s, opt, dst, val, 1, 1);
+ }
+ break;
+ case AV_OPT_TYPE_RATIONAL: {
+ AVRational val;
+ val = av_d2q(opt->default_val.dbl, INT_MAX);
+ write_number(s, opt, dst, 1, val.den, val.num);
+ }
+ break;
+ case AV_OPT_TYPE_COLOR:
+ set_string_color(s, opt, opt->default_val.str, dst);
+ break;
+ case AV_OPT_TYPE_STRING:
+ set_string(s, opt, opt->default_val.str, dst);
+ break;
+ case AV_OPT_TYPE_IMAGE_SIZE:
+ set_string_image_size(s, opt, opt->default_val.str, dst);
+ break;
+ case AV_OPT_TYPE_VIDEO_RATE:
+ set_string_video_rate(s, opt, opt->default_val.str, dst);
+ break;
+ case AV_OPT_TYPE_BINARY:
+ set_string_binary(s, opt, opt->default_val.str, dst);
+ break;
+ case AV_OPT_TYPE_DICT:
+ /* Cannot set defaults for these types */
+ break;
+ default:
+ av_log(s, AV_LOG_DEBUG, "AVOption type %d of option %s not implemented yet\n",
+ opt->type, opt->name);
+ }
+ }
+}
+
+/**
+ * Store the value in the field in ctx that is named like key.
+ * ctx must be an AVClass context, storing is done using AVOptions.
+ *
+ * @param buf the string to parse, buf will be updated to point at the
+ * separator just after the parsed key/value pair
+ * @param key_val_sep a 0-terminated list of characters used to
+ * separate key from value
+ * @param pairs_sep a 0-terminated list of characters used to separate
+ * two pairs from each other
+ * @return 0 if the key/value pair has been successfully parsed and
+ * set, or a negative value corresponding to an AVERROR code in case
+ * of error:
+ * AVERROR(EINVAL) if the key/value pair cannot be parsed,
+ * the error code issued by av_opt_set() if the key/value pair
+ * cannot be set
+ */
+static int parse_key_value_pair(void *ctx, const char **buf,
+ const char *key_val_sep, const char *pairs_sep)
+{
+ char *key = av_get_token(buf, key_val_sep);
+ char *val;
+ int ret;
+
+ if (!key)
+ return AVERROR(ENOMEM);
+
+ if (*key && strspn(*buf, key_val_sep)) {
+ (*buf)++;
+ val = av_get_token(buf, pairs_sep);
+ if (!val) {
+ av_freep(&key);
+ return AVERROR(ENOMEM);
+ }
+ } else {
+ av_log(ctx, AV_LOG_ERROR, "Missing key or no key/value separator found after key '%s'\n", key);
+ av_free(key);
+ return AVERROR(EINVAL);
+ }
+
+ av_log(ctx, AV_LOG_DEBUG, "Setting entry with key '%s' to value '%s'\n", key, val);
+
+ ret = av_opt_set(ctx, key, val, AV_OPT_SEARCH_CHILDREN);
+ if (ret == AVERROR_OPTION_NOT_FOUND)
+ av_log(ctx, AV_LOG_ERROR, "Key '%s' not found.\n", key);
+
+ av_free(key);
+ av_free(val);
+ return ret;
+}
+
+int av_set_options_string(void *ctx, const char *opts,
+ const char *key_val_sep, const char *pairs_sep)
+{
+ int ret, count = 0;
+
+ if (!opts)
+ return 0;
+
+ while (*opts) {
+ if ((ret = parse_key_value_pair(ctx, &opts, key_val_sep, pairs_sep)) < 0)
+ return ret;
+ count++;
+
+ if (*opts)
+ opts++;
+ }
+
+ return count;
+}
+
+#define WHITESPACES " \n\t\r"
+
+static int is_key_char(char c)
+{
+ return (unsigned)((c | 32) - 'a') < 26 ||
+ (unsigned)(c - '0') < 10 ||
+ c == '-' || c == '_' || c == '/' || c == '.';
+}
+
+/**
+ * Read a key from a string.
+ *
+ * The key consists of is_key_char characters and must be terminated by a
+ * character from the delim string; spaces are ignored.
+ *
+ * @return 0 for success (even with ellipsis), <0 for failure
+ */
+static int get_key(const char **ropts, const char *delim, char **rkey)
+{
+ const char *opts = *ropts;
+ const char *key_start, *key_end;
+
+ key_start = opts += strspn(opts, WHITESPACES);
+ while (is_key_char(*opts))
+ opts++;
+ key_end = opts;
+ opts += strspn(opts, WHITESPACES);
+ if (!*opts || !strchr(delim, *opts))
+ return AVERROR(EINVAL);
+ opts++;
+ if (!(*rkey = av_malloc(key_end - key_start + 1)))
+ return AVERROR(ENOMEM);
+ memcpy(*rkey, key_start, key_end - key_start);
+ (*rkey)[key_end - key_start] = 0;
+ *ropts = opts;
+ return 0;
+}
+
+int av_opt_get_key_value(const char **ropts,
+ const char *key_val_sep, const char *pairs_sep,
+ unsigned flags,
+ char **rkey, char **rval)
+{
+ int ret;
+ char *key = NULL, *val;
+ const char *opts = *ropts;
+
+ if ((ret = get_key(&opts, key_val_sep, &key)) < 0 &&
+ !(flags & AV_OPT_FLAG_IMPLICIT_KEY))
+ return AVERROR(EINVAL);
+ if (!(val = av_get_token(&opts, pairs_sep))) {
+ av_free(key);
+ return AVERROR(ENOMEM);
+ }
+ *ropts = opts;
+ *rkey = key;
+ *rval = val;
+ return 0;
+}
+
+int av_opt_set_from_string(void *ctx, const char *opts,
+ const char *const *shorthand,
+ const char *key_val_sep, const char *pairs_sep)
+{
+ int ret, count = 0;
+ const char *dummy_shorthand = NULL;
+ char *av_uninit(parsed_key), *av_uninit(value);
+ const char *key;
+
+ if (!opts)
+ return 0;
+ if (!shorthand)
+ shorthand = &dummy_shorthand;
+
+ while (*opts) {
+ ret = av_opt_get_key_value(&opts, key_val_sep, pairs_sep,
+ *shorthand ? AV_OPT_FLAG_IMPLICIT_KEY : 0,
+ &parsed_key, &value);
+ if (ret < 0) {
+ if (ret == AVERROR(EINVAL))
+ av_log(ctx, AV_LOG_ERROR, "No option name near '%s'\n", opts);
+ else
+ av_log(ctx, AV_LOG_ERROR, "Unable to parse '%s': %s\n", opts,
+ av_err2str(ret));
+ return ret;
+ }
+ if (*opts)
+ opts++;
+ if (parsed_key) {
+ key = parsed_key;
+ while (*shorthand) /* discard all remaining shorthand */
+ shorthand++;
+ } else {
+ key = *(shorthand++);
+ }
+
+ av_log(ctx, AV_LOG_DEBUG, "Setting '%s' to value '%s'\n", key, value);
+ if ((ret = av_opt_set(ctx, key, value, 0)) < 0) {
+ if (ret == AVERROR_OPTION_NOT_FOUND)
+ av_log(ctx, AV_LOG_ERROR, "Option '%s' not found\n", key);
+ av_free(value);
+ av_free(parsed_key);
+ return ret;
+ }
+
+ av_free(value);
+ av_free(parsed_key);
+ count++;
+ }
+ return count;
+}
+
+void av_opt_free(void *obj)
+{
+ const AVOption *o = NULL;
+ while ((o = av_opt_next(obj, o))) {
+ switch (o->type) {
+ case AV_OPT_TYPE_STRING:
+ case AV_OPT_TYPE_BINARY:
+ av_freep((uint8_t *)obj + o->offset);
+ break;
+
+ case AV_OPT_TYPE_DICT:
+ av_dict_free((AVDictionary **)(((uint8_t *)obj) + o->offset));
+ break;
+
+ default:
+ break;
+ }
+ }
+}
+
+int av_opt_set_dict2(void *obj, AVDictionary **options, int search_flags)
+{
+ AVDictionaryEntry *t = NULL;
+ AVDictionary *tmp = NULL;
+ int ret = 0;
+
+ if (!options)
+ return 0;
+
+ while ((t = av_dict_get(*options, "", t, AV_DICT_IGNORE_SUFFIX))) {
+ ret = av_opt_set(obj, t->key, t->value, search_flags);
+ if (ret == AVERROR_OPTION_NOT_FOUND)
+ ret = av_dict_set(&tmp, t->key, t->value, 0);
+ if (ret < 0) {
+ av_log(obj, AV_LOG_ERROR, "Error setting option %s to value %s.\n", t->key, t->value);
+ av_dict_free(&tmp);
+ return ret;
+ }
+ ret = 0;
+ }
+ av_dict_free(options);
+ *options = tmp;
+ return ret;
+}
+
+int av_opt_set_dict(void *obj, AVDictionary **options)
+{
+ return av_opt_set_dict2(obj, options, 0);
+}
+
+const AVOption *av_opt_find(void *obj, const char *name, const char *unit,
+ int opt_flags, int search_flags)
+{
+ return av_opt_find2(obj, name, unit, opt_flags, search_flags, NULL);
+}
+
+const AVOption *av_opt_find2(void *obj, const char *name, const char *unit,
+ int opt_flags, int search_flags, void **target_obj)
+{
+ const AVClass *c;
+ const AVOption *o = NULL;
+
+ if(!obj)
+ return NULL;
+
+ c= *(AVClass**)obj;
+
+ if (!c)
+ return NULL;
+
+ if (search_flags & AV_OPT_SEARCH_CHILDREN) {
+ if (search_flags & AV_OPT_SEARCH_FAKE_OBJ) {
+ const AVClass *child = NULL;
+ while (child = av_opt_child_class_next(c, child))
+ if (o = av_opt_find2(&child, name, unit, opt_flags, search_flags, NULL))
+ return o;
+ } else {
+ void *child = NULL;
+ while (child = av_opt_child_next(obj, child))
+ if (o = av_opt_find2(child, name, unit, opt_flags, search_flags, target_obj))
+ return o;
+ }
+ }
+
+ while (o = av_opt_next(obj, o)) {
+ if (!strcmp(o->name, name) && (o->flags & opt_flags) == opt_flags &&
+ ((!unit && o->type != AV_OPT_TYPE_CONST) ||
+ (unit && o->type == AV_OPT_TYPE_CONST && o->unit && !strcmp(o->unit, unit)))) {
+ if (target_obj) {
+ if (!(search_flags & AV_OPT_SEARCH_FAKE_OBJ))
+ *target_obj = obj;
+ else
+ *target_obj = NULL;
+ }
+ return o;
+ }
+ }
+ return NULL;
+}
+
+void *av_opt_child_next(void *obj, void *prev)
+{
+ const AVClass *c = *(AVClass **)obj;
+ if (c->child_next)
+ return c->child_next(obj, prev);
+ return NULL;
+}
+
+const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev)
+{
+ if (parent->child_class_next)
+ return parent->child_class_next(prev);
+ return NULL;
+}
+
+void *av_opt_ptr(const AVClass *class, void *obj, const char *name)
+{
+ const AVOption *opt= av_opt_find2(&class, name, NULL, 0, AV_OPT_SEARCH_FAKE_OBJ, NULL);
+ if(!opt)
+ return NULL;
+ return (uint8_t*)obj + opt->offset;
+}
+
+static int opt_size(enum AVOptionType type)
+{
+ switch(type) {
+ case AV_OPT_TYPE_BOOL:
+ case AV_OPT_TYPE_INT:
+ case AV_OPT_TYPE_FLAGS:
+ return sizeof(int);
+ case AV_OPT_TYPE_DURATION:
+ case AV_OPT_TYPE_CHANNEL_LAYOUT:
+ case AV_OPT_TYPE_INT64:
+ case AV_OPT_TYPE_UINT64:
+ return sizeof(int64_t);
+ case AV_OPT_TYPE_DOUBLE:
+ return sizeof(double);
+ case AV_OPT_TYPE_FLOAT:
+ return sizeof(float);
+ case AV_OPT_TYPE_STRING:
+ return sizeof(uint8_t*);
+ case AV_OPT_TYPE_VIDEO_RATE:
+ case AV_OPT_TYPE_RATIONAL:
+ return sizeof(AVRational);
+ case AV_OPT_TYPE_BINARY:
+ return sizeof(uint8_t*) + sizeof(int);
+ case AV_OPT_TYPE_IMAGE_SIZE:
+ return sizeof(int[2]);
+ case AV_OPT_TYPE_PIXEL_FMT:
+ return sizeof(enum AVPixelFormat);
+ case AV_OPT_TYPE_SAMPLE_FMT:
+ return sizeof(enum AVSampleFormat);
+ case AV_OPT_TYPE_COLOR:
+ return 4;
+ }
+ return AVERROR(EINVAL);
+}
+
+int av_opt_copy(void *dst, const void *src)
+{
+ const AVOption *o = NULL;
+ const AVClass *c;
+ int ret = 0;
+
+ if (!src)
+ return AVERROR(EINVAL);
+
+ c = *(AVClass **)src;
+ if (!c || c != *(AVClass **)dst)
+ return AVERROR(EINVAL);
+
+ while ((o = av_opt_next(src, o))) {
+ void *field_dst = (uint8_t *)dst + o->offset;
+ void *field_src = (uint8_t *)src + o->offset;
+ uint8_t **field_dst8 = (uint8_t **)field_dst;
+ uint8_t **field_src8 = (uint8_t **)field_src;
+
+ if (o->type == AV_OPT_TYPE_STRING) {
+ if (*field_dst8 != *field_src8)
+ av_freep(field_dst8);
+ *field_dst8 = av_strdup(*field_src8);
+ if (*field_src8 && !*field_dst8)
+ ret = AVERROR(ENOMEM);
+ } else if (o->type == AV_OPT_TYPE_BINARY) {
+ int len = *(int *)(field_src8 + 1);
+ if (*field_dst8 != *field_src8)
+ av_freep(field_dst8);
+ *field_dst8 = av_memdup(*field_src8, len);
+ if (len && !*field_dst8) {
+ ret = AVERROR(ENOMEM);
+ len = 0;
+ }
+ *(int *)(field_dst8 + 1) = len;
+ } else if (o->type == AV_OPT_TYPE_CONST) {
+ // do nothing
+ } else if (o->type == AV_OPT_TYPE_DICT) {
+ AVDictionary **sdict = (AVDictionary **) field_src;
+ AVDictionary **ddict = (AVDictionary **) field_dst;
+ if (*sdict != *ddict)
+ av_dict_free(ddict);
+ *ddict = NULL;
+ av_dict_copy(ddict, *sdict, 0);
+ if (av_dict_count(*sdict) != av_dict_count(*ddict))
+ ret = AVERROR(ENOMEM);
+ } else {
+ int size = opt_size(o->type);
+ if (size < 0)
+ ret = size;
+ else
+ memcpy(field_dst, field_src, size);
+ }
+ }
+ return ret;
+}
+
+int av_opt_query_ranges(AVOptionRanges **ranges_arg, void *obj, const char *key, int flags)
+{
+ int ret;
+ const AVClass *c = *(AVClass**)obj;
+ int (*callback)(AVOptionRanges **, void *obj, const char *key, int flags) = NULL;
+
+ if (c->version > (52 << 16 | 11 << 8))
+ callback = c->query_ranges;
+
+ if (!callback)
+ callback = av_opt_query_ranges_default;
+
+ ret = callback(ranges_arg, obj, key, flags);
+ if (ret >= 0) {
+ if (!(flags & AV_OPT_MULTI_COMPONENT_RANGE))
+ ret = 1;
+ (*ranges_arg)->nb_components = ret;
+ }
+ return ret;
+}
+
+int av_opt_query_ranges_default(AVOptionRanges **ranges_arg, void *obj, const char *key, int flags)
+{
+ AVOptionRanges *ranges = av_mallocz(sizeof(*ranges));
+ AVOptionRange **range_array = av_mallocz(sizeof(void*));
+ AVOptionRange *range = av_mallocz(sizeof(*range));
+ const AVOption *field = av_opt_find(obj, key, NULL, 0, flags);
+ int ret;
+
+ *ranges_arg = NULL;
+
+ if (!ranges || !range || !range_array || !field) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+
+ ranges->range = range_array;
+ ranges->range[0] = range;
+ ranges->nb_ranges = 1;
+ ranges->nb_components = 1;
+ range->is_range = 1;
+ range->value_min = field->min;
+ range->value_max = field->max;
+
+ switch (field->type) {
+ case AV_OPT_TYPE_BOOL:
+ case AV_OPT_TYPE_INT:
+ case AV_OPT_TYPE_INT64:
+ case AV_OPT_TYPE_UINT64:
+ case AV_OPT_TYPE_PIXEL_FMT:
+ case AV_OPT_TYPE_SAMPLE_FMT:
+ case AV_OPT_TYPE_FLOAT:
+ case AV_OPT_TYPE_DOUBLE:
+ case AV_OPT_TYPE_DURATION:
+ case AV_OPT_TYPE_COLOR:
+ case AV_OPT_TYPE_CHANNEL_LAYOUT:
+ break;
+ case AV_OPT_TYPE_STRING:
+ range->component_min = 0;
+ range->component_max = 0x10FFFF; // max unicode value
+ range->value_min = -1;
+ range->value_max = INT_MAX;
+ break;
+ case AV_OPT_TYPE_RATIONAL:
+ range->component_min = INT_MIN;
+ range->component_max = INT_MAX;
+ break;
+ case AV_OPT_TYPE_IMAGE_SIZE:
+ range->component_min = 0;
+ range->component_max = INT_MAX/128/8;
+ range->value_min = 0;
+ range->value_max = INT_MAX/8;
+ break;
+ case AV_OPT_TYPE_VIDEO_RATE:
+ range->component_min = 1;
+ range->component_max = INT_MAX;
+ range->value_min = 1;
+ range->value_max = INT_MAX;
+ break;
+ default:
+ ret = AVERROR(ENOSYS);
+ goto fail;
+ }
+
+ *ranges_arg = ranges;
+ return 1;
+fail:
+ av_free(ranges);
+ av_free(range);
+ av_free(range_array);
+ return ret;
+}
+
+void av_opt_freep_ranges(AVOptionRanges **rangesp)
+{
+ int i;
+ AVOptionRanges *ranges = *rangesp;
+
+ if (!ranges)
+ return;
+
+ for (i = 0; i < ranges->nb_ranges * ranges->nb_components; i++) {
+ AVOptionRange *range = ranges->range[i];
+ if (range) {
+ av_freep(&range->str);
+ av_freep(&ranges->range[i]);
+ }
+ }
+ av_freep(&ranges->range);
+ av_freep(rangesp);
+}
+
+int av_opt_is_set_to_default(void *obj, const AVOption *o)
+{
+ int64_t i64;
+ double d, d2;
+ float f;
+ AVRational q;
+ int ret, w, h;
+ char *str;
+ void *dst;
+
+ if (!o || !obj)
+ return AVERROR(EINVAL);
+
+ dst = ((uint8_t*)obj) + o->offset;
+
+ switch (o->type) {
+ case AV_OPT_TYPE_CONST:
+ return 1;
+ case AV_OPT_TYPE_BOOL:
+ case AV_OPT_TYPE_FLAGS:
+ case AV_OPT_TYPE_PIXEL_FMT:
+ case AV_OPT_TYPE_SAMPLE_FMT:
+ case AV_OPT_TYPE_INT:
+ case AV_OPT_TYPE_CHANNEL_LAYOUT:
+ case AV_OPT_TYPE_DURATION:
+ case AV_OPT_TYPE_INT64:
+ case AV_OPT_TYPE_UINT64:
+ read_number(o, dst, NULL, NULL, &i64);
+ return o->default_val.i64 == i64;
+ case AV_OPT_TYPE_STRING:
+ str = *(char **)dst;
+ if (str == o->default_val.str) //2 NULLs
+ return 1;
+ if (!str || !o->default_val.str) //1 NULL
+ return 0;
+ return !strcmp(str, o->default_val.str);
+ case AV_OPT_TYPE_DOUBLE:
+ read_number(o, dst, &d, NULL, NULL);
+ return o->default_val.dbl == d;
+ case AV_OPT_TYPE_FLOAT:
+ read_number(o, dst, &d, NULL, NULL);
+ f = o->default_val.dbl;
+ d2 = f;
+ return d2 == d;
+ case AV_OPT_TYPE_RATIONAL:
+ q = av_d2q(o->default_val.dbl, INT_MAX);
+ return !av_cmp_q(*(AVRational*)dst, q);
+ case AV_OPT_TYPE_BINARY: {
+ struct {
+ uint8_t *data;
+ int size;
+ } tmp = {0};
+ int opt_size = *(int *)((void **)dst + 1);
+ void *opt_ptr = *(void **)dst;
+ if (!opt_size && (!o->default_val.str || !strlen(o->default_val.str)))
+ return 1;
+ if (!opt_size || !o->default_val.str || !strlen(o->default_val.str ))
+ return 0;
+ if (opt_size != strlen(o->default_val.str) / 2)
+ return 0;
+ ret = set_string_binary(NULL, NULL, o->default_val.str, &tmp.data);
+ if (!ret)
+ ret = !memcmp(opt_ptr, tmp.data, tmp.size);
+ av_free(tmp.data);
+ return ret;
+ }
+ case AV_OPT_TYPE_DICT:
+ /* Binary and dict have not default support yet. Any pointer is not default. */
+ return !!(*(void **)dst);
+ case AV_OPT_TYPE_IMAGE_SIZE:
+ if (!o->default_val.str || !strcmp(o->default_val.str, "none"))
+ w = h = 0;
+ else if ((ret = av_parse_video_size(&w, &h, o->default_val.str)) < 0)
+ return ret;
+ return (w == *(int *)dst) && (h == *((int *)dst+1));
+ case AV_OPT_TYPE_VIDEO_RATE:
+ q = (AVRational){0, 0};
+ if (o->default_val.str) {
+ if ((ret = av_parse_video_rate(&q, o->default_val.str)) < 0)
+ return ret;
+ }
+ return !av_cmp_q(*(AVRational*)dst, q);
+ case AV_OPT_TYPE_COLOR: {
+ uint8_t color[4] = {0, 0, 0, 0};
+ if (o->default_val.str) {
+ if ((ret = av_parse_color(color, o->default_val.str, -1, NULL)) < 0)
+ return ret;
+ }
+ return !memcmp(color, dst, sizeof(color));
+ }
+ default:
+ av_log(obj, AV_LOG_WARNING, "Not supported option type: %d, option name: %s\n", o->type, o->name);
+ break;
+ }
+ return AVERROR_PATCHWELCOME;
+}
+
+int av_opt_is_set_to_default_by_name(void *obj, const char *name, int search_flags)
+{
+ const AVOption *o;
+ void *target;
+ if (!obj)
+ return AVERROR(EINVAL);
+ o = av_opt_find2(obj, name, NULL, 0, search_flags, &target);
+ if (!o)
+ return AVERROR_OPTION_NOT_FOUND;
+ return av_opt_is_set_to_default(target, o);
+}
+
+int av_opt_serialize(void *obj, int opt_flags, int flags, char **buffer,
+ const char key_val_sep, const char pairs_sep)
+{
+ const AVOption *o = NULL;
+ uint8_t *buf;
+ AVBPrint bprint;
+ int ret, cnt = 0;
+ const char special_chars[] = {pairs_sep, key_val_sep, '\0'};
+
+ if (pairs_sep == '\0' || key_val_sep == '\0' || pairs_sep == key_val_sep ||
+ pairs_sep == '\\' || key_val_sep == '\\') {
+ av_log(obj, AV_LOG_ERROR, "Invalid separator(s) found.");
+ return AVERROR(EINVAL);
+ }
+
+ if (!obj || !buffer)
+ return AVERROR(EINVAL);
+
+ *buffer = NULL;
+ av_bprint_init(&bprint, 64, AV_BPRINT_SIZE_UNLIMITED);
+
+ while (o = av_opt_next(obj, o)) {
+ if (o->type == AV_OPT_TYPE_CONST)
+ continue;
+ if ((flags & AV_OPT_SERIALIZE_OPT_FLAGS_EXACT) && o->flags != opt_flags)
+ continue;
+ else if (((o->flags & opt_flags) != opt_flags))
+ continue;
+ if (flags & AV_OPT_SERIALIZE_SKIP_DEFAULTS && av_opt_is_set_to_default(obj, o) > 0)
+ continue;
+ if ((ret = av_opt_get(obj, o->name, 0, &buf)) < 0) {
+ av_bprint_finalize(&bprint, NULL);
+ return ret;
+ }
+ if (buf) {
+ if (cnt++)
+ av_bprint_append_data(&bprint, &pairs_sep, 1);
+ av_bprint_escape(&bprint, o->name, special_chars, AV_ESCAPE_MODE_BACKSLASH, 0);
+ av_bprint_append_data(&bprint, &key_val_sep, 1);
+ av_bprint_escape(&bprint, buf, special_chars, AV_ESCAPE_MODE_BACKSLASH, 0);
+ av_freep(&buf);
+ }
+ }
+ av_bprint_finalize(&bprint, buffer);
+ return 0;
+}
diff --git a/media/ffvpx/libavutil/opt.h b/media/ffvpx/libavutil/opt.h
index 9430b989e9..0d893795de 100644
--- a/media/ffvpx/libavutil/opt.h
+++ b/media/ffvpx/libavutil/opt.h
@@ -228,6 +228,7 @@ enum AVOptionType{
AV_OPT_TYPE_RATIONAL,
AV_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length
AV_OPT_TYPE_DICT,
+ AV_OPT_TYPE_UINT64,
AV_OPT_TYPE_CONST = 128,
AV_OPT_TYPE_IMAGE_SIZE = MKBETAG('S','I','Z','E'), ///< offset must point to two consecutive integers
AV_OPT_TYPE_PIXEL_FMT = MKBETAG('P','F','M','T'),
diff --git a/media/ffvpx/libavutil/parseutils.c b/media/ffvpx/libavutil/parseutils.c
index a2464cfc6e..be4ea1ee15 100644
--- a/media/ffvpx/libavutil/parseutils.c
+++ b/media/ffvpx/libavutil/parseutils.c
@@ -140,6 +140,11 @@ static const VideoRateAbbr video_rate_abbrs[]= {
{ "ntsc-film", { 24000, 1001 } },
};
+static const char *months[12] = {
+ "january", "february", "march", "april", "may", "june", "july", "august",
+ "september", "october", "november", "december"
+};
+
int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str)
{
int i;
@@ -466,6 +471,21 @@ static int date_get_num(const char **pp,
return val;
}
+static int date_get_month(const char **pp) {
+ int i = 0;
+ for (; i < 12; i++) {
+ if (!av_strncasecmp(*pp, months[i], 3)) {
+ const char *mo_full = months[i] + 3;
+ int len = strlen(mo_full);
+ *pp += 3;
+ if (len > 0 && !av_strncasecmp(*pp, mo_full, len))
+ *pp += len;
+ return i;
+ }
+ }
+ return -1;
+}
+
char *av_small_strptime(const char *p, const char *fmt, struct tm *dt)
{
int c, val;
@@ -525,6 +545,14 @@ char *av_small_strptime(const char *p, const char *fmt, struct tm *dt)
if (!p)
return NULL;
break;
+ case 'b':
+ case 'B':
+ case 'h':
+ val = date_get_month(&p);
+ if (val == -1)
+ return NULL;
+ dt->tm_mon = val;
+ break;
case '%':
if (*p++ != '%')
return NULL;
diff --git a/media/ffvpx/libavutil/pixdesc.c b/media/ffvpx/libavutil/pixdesc.c
index b715fce15d..2cfab89c03 100644
--- a/media/ffvpx/libavutil/pixdesc.c
+++ b/media/ffvpx/libavutil/pixdesc.c
@@ -560,6 +560,69 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
},
.flags = AV_PIX_FMT_FLAG_RGB,
},
+ [AV_PIX_FMT_GRAY9BE] = {
+ .name = "gray9be",
+ .nb_components = 1,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
+ },
+ .flags = AV_PIX_FMT_FLAG_BE,
+ .alias = "y9be",
+ },
+ [AV_PIX_FMT_GRAY9LE] = {
+ .name = "gray9le",
+ .nb_components = 1,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 2, 0, 0, 9, 1, 8, 1 }, /* Y */
+ },
+ .alias = "y9le",
+ },
+ [AV_PIX_FMT_GRAY10BE] = {
+ .name = "gray10be",
+ .nb_components = 1,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
+ },
+ .flags = AV_PIX_FMT_FLAG_BE,
+ .alias = "y10be",
+ },
+ [AV_PIX_FMT_GRAY10LE] = {
+ .name = "gray10le",
+ .nb_components = 1,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 2, 0, 0, 10, 1, 9, 1 }, /* Y */
+ },
+ .alias = "y10le",
+ },
+ [AV_PIX_FMT_GRAY12BE] = {
+ .name = "gray12be",
+ .nb_components = 1,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
+ },
+ .flags = AV_PIX_FMT_FLAG_BE,
+ .alias = "y12be",
+ },
+ [AV_PIX_FMT_GRAY12LE] = {
+ .name = "gray12le",
+ .nb_components = 1,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 0, 2, 0, 0, 12, 1, 11, 1 }, /* Y */
+ },
+ .alias = "y12le",
+ },
[AV_PIX_FMT_GRAY16BE] = {
.name = "gray16be",
.nb_components = 1,
@@ -1873,62 +1936,62 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
[AV_PIX_FMT_BAYER_BGGR8] = {
.name = "bayer_bggr8",
BAYER8_DESC_COMMON
- .flags = AV_PIX_FMT_FLAG_RGB,
+ .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
},
[AV_PIX_FMT_BAYER_BGGR16LE] = {
.name = "bayer_bggr16le",
BAYER16_DESC_COMMON
- .flags = AV_PIX_FMT_FLAG_RGB,
+ .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
},
[AV_PIX_FMT_BAYER_BGGR16BE] = {
.name = "bayer_bggr16be",
BAYER16_DESC_COMMON
- .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
},
[AV_PIX_FMT_BAYER_RGGB8] = {
.name = "bayer_rggb8",
BAYER8_DESC_COMMON
- .flags = AV_PIX_FMT_FLAG_RGB,
+ .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
},
[AV_PIX_FMT_BAYER_RGGB16LE] = {
.name = "bayer_rggb16le",
BAYER16_DESC_COMMON
- .flags = AV_PIX_FMT_FLAG_RGB,
+ .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
},
[AV_PIX_FMT_BAYER_RGGB16BE] = {
.name = "bayer_rggb16be",
BAYER16_DESC_COMMON
- .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
},
[AV_PIX_FMT_BAYER_GBRG8] = {
.name = "bayer_gbrg8",
BAYER8_DESC_COMMON
- .flags = AV_PIX_FMT_FLAG_RGB,
+ .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
},
[AV_PIX_FMT_BAYER_GBRG16LE] = {
.name = "bayer_gbrg16le",
BAYER16_DESC_COMMON
- .flags = AV_PIX_FMT_FLAG_RGB,
+ .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
},
[AV_PIX_FMT_BAYER_GBRG16BE] = {
.name = "bayer_gbrg16be",
BAYER16_DESC_COMMON
- .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
},
[AV_PIX_FMT_BAYER_GRBG8] = {
.name = "bayer_grbg8",
BAYER8_DESC_COMMON
- .flags = AV_PIX_FMT_FLAG_RGB,
+ .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
},
[AV_PIX_FMT_BAYER_GRBG16LE] = {
.name = "bayer_grbg16le",
BAYER16_DESC_COMMON
- .flags = AV_PIX_FMT_FLAG_RGB,
+ .flags = AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
},
[AV_PIX_FMT_BAYER_GRBG16BE] = {
.name = "bayer_grbg16be",
BAYER16_DESC_COMMON
- .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB,
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_BAYER,
},
[AV_PIX_FMT_NV16] = {
.name = "nv16",
@@ -2036,6 +2099,30 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
},
.flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
},
+ [AV_PIX_FMT_P016LE] = {
+ .name = "p016le",
+ .nb_components = 3,
+ .log2_chroma_w = 1,
+ .log2_chroma_h = 1,
+ .comp = {
+ { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
+ { 1, 4, 0, 0, 16, 3, 15, 1 }, /* U */
+ { 1, 4, 2, 0, 16, 3, 15, 3 }, /* V */
+ },
+ .flags = AV_PIX_FMT_FLAG_PLANAR,
+ },
+ [AV_PIX_FMT_P016BE] = {
+ .name = "p016be",
+ .nb_components = 3,
+ .log2_chroma_w = 1,
+ .log2_chroma_h = 1,
+ .comp = {
+ { 0, 2, 0, 0, 16, 1, 15, 1 }, /* Y */
+ { 1, 4, 0, 0, 16, 3, 15, 1 }, /* U */
+ { 1, 4, 2, 0, 16, 3, 15, 3 }, /* V */
+ },
+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_BE,
+ },
[AV_PIX_FMT_GBRAP12LE] = {
.name = "gbrap12le",
.nb_components = 4,
@@ -2092,18 +2179,80 @@ static const AVPixFmtDescriptor av_pix_fmt_descriptors[AV_PIX_FMT_NB] = {
.flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA,
},
+ [AV_PIX_FMT_D3D11] = {
+ .name = "d3d11",
+ .flags = AV_PIX_FMT_FLAG_HWACCEL,
+ },
+ [AV_PIX_FMT_GBRPF32BE] = {
+ .name = "gbrpf32be",
+ .nb_components = 3,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 2, 4, 0, 0, 32, 3, 31, 1 }, /* R */
+ { 0, 4, 0, 0, 32, 3, 31, 1 }, /* G */
+ { 1, 4, 0, 0, 32, 3, 31, 1 }, /* B */
+ },
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
+ AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT,
+ },
+ [AV_PIX_FMT_GBRPF32LE] = {
+ .name = "gbrpf32le",
+ .nb_components = 3,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 2, 4, 0, 0, 32, 3, 31, 1 }, /* R */
+ { 0, 4, 0, 0, 32, 3, 31, 1 }, /* G */
+ { 1, 4, 0, 0, 32, 3, 31, 1 }, /* B */
+ },
+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_FLOAT | AV_PIX_FMT_FLAG_RGB,
+ },
+ [AV_PIX_FMT_GBRAPF32BE] = {
+ .name = "gbrapf32be",
+ .nb_components = 4,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 2, 4, 0, 0, 32, 3, 31, 1 }, /* R */
+ { 0, 4, 0, 0, 32, 3, 31, 1 }, /* G */
+ { 1, 4, 0, 0, 32, 3, 31, 1 }, /* B */
+ { 3, 4, 0, 0, 32, 3, 31, 1 }, /* A */
+ },
+ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR |
+ AV_PIX_FMT_FLAG_ALPHA | AV_PIX_FMT_FLAG_RGB |
+ AV_PIX_FMT_FLAG_FLOAT,
+ },
+ [AV_PIX_FMT_GBRAPF32LE] = {
+ .name = "gbrapf32le",
+ .nb_components = 4,
+ .log2_chroma_w = 0,
+ .log2_chroma_h = 0,
+ .comp = {
+ { 2, 4, 0, 0, 32, 3, 31, 1 }, /* R */
+ { 0, 4, 0, 0, 32, 3, 31, 1 }, /* G */
+ { 1, 4, 0, 0, 32, 3, 31, 1 }, /* B */
+ { 3, 4, 0, 0, 32, 3, 31, 1 }, /* A */
+ },
+ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA |
+ AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT,
+ },
+ [AV_PIX_FMT_DRM_PRIME] = {
+ .name = "drm_prime",
+ .flags = AV_PIX_FMT_FLAG_HWACCEL,
+ },
};
#if FF_API_PLUS1_MINUS1
FF_ENABLE_DEPRECATION_WARNINGS
#endif
-static const char *color_range_names[] = {
+static const char * const color_range_names[] = {
[AVCOL_RANGE_UNSPECIFIED] = "unknown",
[AVCOL_RANGE_MPEG] = "tv",
[AVCOL_RANGE_JPEG] = "pc",
};
-static const char *color_primaries_names[AVCOL_PRI_NB] = {
+static const char * const color_primaries_names[AVCOL_PRI_NB] = {
[AVCOL_PRI_RESERVED0] = "reserved",
[AVCOL_PRI_BT709] = "bt709",
[AVCOL_PRI_UNSPECIFIED] = "unknown",
@@ -2114,12 +2263,13 @@ static const char *color_primaries_names[AVCOL_PRI_NB] = {
[AVCOL_PRI_SMPTE240M] = "smpte240m",
[AVCOL_PRI_FILM] = "film",
[AVCOL_PRI_BT2020] = "bt2020",
- [AVCOL_PRI_SMPTEST428_1] = "smpte428-1",
+ [AVCOL_PRI_SMPTE428] = "smpte428",
[AVCOL_PRI_SMPTE431] = "smpte431",
[AVCOL_PRI_SMPTE432] = "smpte432",
+ [AVCOL_PRI_JEDEC_P22] = "jedec-p22",
};
-static const char *color_transfer_names[] = {
+static const char * const color_transfer_names[] = {
[AVCOL_TRC_RESERVED0] = "reserved",
[AVCOL_TRC_BT709] = "bt709",
[AVCOL_TRC_UNSPECIFIED] = "unknown",
@@ -2135,13 +2285,13 @@ static const char *color_transfer_names[] = {
[AVCOL_TRC_BT1361_ECG] = "bt1361e",
[AVCOL_TRC_IEC61966_2_1] = "iec61966-2-1",
[AVCOL_TRC_BT2020_10] = "bt2020-10",
- [AVCOL_TRC_BT2020_12] = "bt2020-20",
- [AVCOL_TRC_SMPTEST2084] = "smpte2084",
- [AVCOL_TRC_SMPTEST428_1] = "smpte428-1",
+ [AVCOL_TRC_BT2020_12] = "bt2020-12",
+ [AVCOL_TRC_SMPTE2084] = "smpte2084",
+ [AVCOL_TRC_SMPTE428] = "smpte428",
[AVCOL_TRC_ARIB_STD_B67] = "arib-std-b67",
};
-static const char *color_space_names[] = {
+static const char * const color_space_names[] = {
[AVCOL_SPC_RGB] = "gbr",
[AVCOL_SPC_BT709] = "bt709",
[AVCOL_SPC_UNSPECIFIED] = "unknown",
@@ -2150,13 +2300,16 @@ static const char *color_space_names[] = {
[AVCOL_SPC_BT470BG] = "bt470bg",
[AVCOL_SPC_SMPTE170M] = "smpte170m",
[AVCOL_SPC_SMPTE240M] = "smpte240m",
- [AVCOL_SPC_YCOCG] = "ycgco",
+ [AVCOL_SPC_YCGCO] = "ycgco",
[AVCOL_SPC_BT2020_NCL] = "bt2020nc",
[AVCOL_SPC_BT2020_CL] = "bt2020c",
[AVCOL_SPC_SMPTE2085] = "smpte2085",
+ [AVCOL_SPC_CHROMA_DERIVED_NCL] = "chroma-derived-nc",
+ [AVCOL_SPC_CHROMA_DERIVED_CL] = "chroma-derived-c",
+ [AVCOL_SPC_ICTCP] = "ictcp",
};
-static const char *chroma_location_names[] = {
+static const char * const chroma_location_names[] = {
[AVCHROMA_LOC_UNSPECIFIED] = "unspecified",
[AVCHROMA_LOC_LEFT] = "left",
[AVCHROMA_LOC_CENTER] = "center",
@@ -2349,7 +2502,7 @@ void ff_check_pixfmt_descriptors(void){
} else {
av_assert0(8*c->step >= c->depth);
}
- if (!strncmp(d->name, "bayer_", 6))
+ if (d->flags & AV_PIX_FMT_FLAG_BAYER)
continue;
av_read_image_line(tmp, (void*)data, linesize, d, 0, 0, j, 2, 0);
av_assert0(tmp[0] == 0 && tmp[1] == 0);
@@ -2440,8 +2593,16 @@ static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt,
int ret, loss, i, nb_components;
int score = INT_MAX - 1;
- if (dst_pix_fmt >= AV_PIX_FMT_NB || dst_pix_fmt <= AV_PIX_FMT_NONE)
- return ~0;
+ if (!src_desc || !dst_desc)
+ return -4;
+
+ if ((src_desc->flags & AV_PIX_FMT_FLAG_HWACCEL) ||
+ (dst_desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) {
+ if (dst_pix_fmt == src_pix_fmt)
+ return -1;
+ else
+ return -2;
+ }
/* compute loss */
*lossp = loss = 0;
@@ -2450,9 +2611,9 @@ static int get_pix_fmt_score(enum AVPixelFormat dst_pix_fmt,
return INT_MAX;
if ((ret = get_pix_fmt_depth(&src_min_depth, &src_max_depth, src_pix_fmt)) < 0)
- return ret;
+ return -3;
if ((ret = get_pix_fmt_depth(&dst_min_depth, &dst_max_depth, dst_pix_fmt)) < 0)
- return ret;
+ return -3;
src_color = get_color_type(src_desc);
dst_color = get_color_type(dst_desc);
@@ -2554,21 +2715,27 @@ enum AVPixelFormat av_find_best_pix_fmt_of_2(enum AVPixelFormat dst_pix_fmt1, en
const AVPixFmtDescriptor *desc2 = av_pix_fmt_desc_get(dst_pix_fmt2);
int score1, score2;
- loss_mask= loss_ptr?~*loss_ptr:~0; /* use loss mask if provided */
- if(!has_alpha)
- loss_mask &= ~FF_LOSS_ALPHA;
+ if (!desc1) {
+ dst_pix_fmt = dst_pix_fmt2;
+ } else if (!desc2) {
+ dst_pix_fmt = dst_pix_fmt1;
+ } else {
+ loss_mask= loss_ptr?~*loss_ptr:~0; /* use loss mask if provided */
+ if(!has_alpha)
+ loss_mask &= ~FF_LOSS_ALPHA;
- score1 = get_pix_fmt_score(dst_pix_fmt1, src_pix_fmt, &loss1, loss_mask);
- score2 = get_pix_fmt_score(dst_pix_fmt2, src_pix_fmt, &loss2, loss_mask);
+ score1 = get_pix_fmt_score(dst_pix_fmt1, src_pix_fmt, &loss1, loss_mask);
+ score2 = get_pix_fmt_score(dst_pix_fmt2, src_pix_fmt, &loss2, loss_mask);
- if (score1 == score2) {
- if(av_get_padded_bits_per_pixel(desc2) != av_get_padded_bits_per_pixel(desc1)) {
- dst_pix_fmt = av_get_padded_bits_per_pixel(desc2) < av_get_padded_bits_per_pixel(desc1) ? dst_pix_fmt2 : dst_pix_fmt1;
+ if (score1 == score2) {
+ if(av_get_padded_bits_per_pixel(desc2) != av_get_padded_bits_per_pixel(desc1)) {
+ dst_pix_fmt = av_get_padded_bits_per_pixel(desc2) < av_get_padded_bits_per_pixel(desc1) ? dst_pix_fmt2 : dst_pix_fmt1;
+ } else {
+ dst_pix_fmt = desc2->nb_components < desc1->nb_components ? dst_pix_fmt2 : dst_pix_fmt1;
+ }
} else {
- dst_pix_fmt = desc2->nb_components < desc1->nb_components ? dst_pix_fmt2 : dst_pix_fmt1;
+ dst_pix_fmt = score1 < score2 ? dst_pix_fmt2 : dst_pix_fmt1;
}
- } else {
- dst_pix_fmt = score1 < score2 ? dst_pix_fmt2 : dst_pix_fmt1;
}
if (loss_ptr)
@@ -2582,26 +2749,91 @@ const char *av_color_range_name(enum AVColorRange range)
color_range_names[range] : NULL;
}
+int av_color_range_from_name(const char *name)
+{
+ int i;
+
+ for (i = 0; i < FF_ARRAY_ELEMS(color_range_names); i++) {
+ size_t len = strlen(color_range_names[i]);
+ if (!strncmp(color_range_names[i], name, len))
+ return i;
+ }
+
+ return AVERROR(EINVAL);
+}
+
const char *av_color_primaries_name(enum AVColorPrimaries primaries)
{
return (unsigned) primaries < AVCOL_PRI_NB ?
color_primaries_names[primaries] : NULL;
}
+int av_color_primaries_from_name(const char *name)
+{
+ int i;
+
+ for (i = 0; i < FF_ARRAY_ELEMS(color_primaries_names); i++) {
+ size_t len = strlen(color_primaries_names[i]);
+ if (!strncmp(color_primaries_names[i], name, len))
+ return i;
+ }
+
+ return AVERROR(EINVAL);
+}
+
const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer)
{
return (unsigned) transfer < AVCOL_TRC_NB ?
color_transfer_names[transfer] : NULL;
}
+int av_color_transfer_from_name(const char *name)
+{
+ int i;
+
+ for (i = 0; i < FF_ARRAY_ELEMS(color_transfer_names); i++) {
+ size_t len = strlen(color_transfer_names[i]);
+ if (!strncmp(color_transfer_names[i], name, len))
+ return i;
+ }
+
+ return AVERROR(EINVAL);
+}
+
const char *av_color_space_name(enum AVColorSpace space)
{
return (unsigned) space < AVCOL_SPC_NB ?
color_space_names[space] : NULL;
}
+int av_color_space_from_name(const char *name)
+{
+ int i;
+
+ for (i = 0; i < FF_ARRAY_ELEMS(color_space_names); i++) {
+ size_t len = strlen(color_space_names[i]);
+ if (!strncmp(color_space_names[i], name, len))
+ return i;
+ }
+
+ return AVERROR(EINVAL);
+}
+
const char *av_chroma_location_name(enum AVChromaLocation location)
{
return (unsigned) location < AVCHROMA_LOC_NB ?
chroma_location_names[location] : NULL;
}
+
+int av_chroma_location_from_name(const char *name)
+{
+ int i;
+
+ for (i = 0; i < FF_ARRAY_ELEMS(chroma_location_names); i++) {
+ size_t len = strlen(chroma_location_names[i]);
+ if (!strncmp(chroma_location_names[i], name, len))
+ return i;
+ }
+
+ return AVERROR(EINVAL);
+}
diff --git a/media/ffvpx/libavutil/pixdesc.h b/media/ffvpx/libavutil/pixdesc.h
index a8ad588913..fc3737c4ad 100644
--- a/media/ffvpx/libavutil/pixdesc.h
+++ b/media/ffvpx/libavutil/pixdesc.h
@@ -173,6 +173,17 @@ typedef struct AVPixFmtDescriptor {
#define AV_PIX_FMT_FLAG_ALPHA (1 << 7)
/**
+ * The pixel format is following a Bayer pattern
+ */
+#define AV_PIX_FMT_FLAG_BAYER (1 << 8)
+
+/**
+ * The pixel format contains IEEE-754 floating point values. Precision (double,
+ * single, or half) should be determined by the pixel size (64, 32, or 16 bits).
+ */
+#define AV_PIX_FMT_FLAG_FLOAT (1 << 9)
+
+/**
* Return the number of bits per pixel used by the pixel format
* described by pixdesc. Note that this is not the same as the number
* of bits per sample.
@@ -240,26 +251,51 @@ int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt);
const char *av_color_range_name(enum AVColorRange range);
/**
+ * @return the AVColorRange value for name or an AVError if not found.
+ */
+int av_color_range_from_name(const char *name);
+
+/**
* @return the name for provided color primaries or NULL if unknown.
*/
const char *av_color_primaries_name(enum AVColorPrimaries primaries);
/**
+ * @return the AVColorPrimaries value for name or an AVError if not found.
+ */
+int av_color_primaries_from_name(const char *name);
+
+/**
* @return the name for provided color transfer or NULL if unknown.
*/
const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer);
/**
+ * @return the AVColorTransferCharacteristic value for name or an AVError if not found.
+ */
+int av_color_transfer_from_name(const char *name);
+
+/**
* @return the name for provided color space or NULL if unknown.
*/
const char *av_color_space_name(enum AVColorSpace space);
/**
+ * @return the AVColorSpace value for name or an AVError if not found.
+ */
+int av_color_space_from_name(const char *name);
+
+/**
* @return the name for provided chroma location or NULL if unknown.
*/
const char *av_chroma_location_name(enum AVChromaLocation location);
/**
+ * @return the AVChromaLocation value for name or an AVError if not found.
+ */
+int av_chroma_location_from_name(const char *name);
+
+/**
* Return the pixel format corresponding to name.
*
* If there is no pixel format with name name, then looks for a
diff --git a/media/ffvpx/libavutil/pixfmt.h b/media/ffvpx/libavutil/pixfmt.h
index 7a3f68be7e..24889c8e52 100644
--- a/media/ffvpx/libavutil/pixfmt.h
+++ b/media/ffvpx/libavutil/pixfmt.h
@@ -240,7 +240,7 @@ enum AVPixelFormat {
*/
AV_PIX_FMT_MMAL,
- AV_PIX_FMT_D3D11VA_VLD, ///< HW decoding through Direct3D11, Picture.data[3] contains a ID3D11VideoDecoderOutputView pointer
+ AV_PIX_FMT_D3D11VA_VLD, ///< HW decoding through Direct3D11 via old API, Picture.data[3] contains a ID3D11VideoDecoderOutputView pointer
/**
* HW acceleration through CUDA. data[i] contain CUdeviceptr pointers
@@ -306,6 +306,41 @@ enum AVPixelFormat {
AV_PIX_FMT_MEDIACODEC, ///< hardware decoding through MediaCodec
+ AV_PIX_FMT_GRAY12BE, ///< Y , 12bpp, big-endian
+ AV_PIX_FMT_GRAY12LE, ///< Y , 12bpp, little-endian
+ AV_PIX_FMT_GRAY10BE, ///< Y , 10bpp, big-endian
+ AV_PIX_FMT_GRAY10LE, ///< Y , 10bpp, little-endian
+
+ AV_PIX_FMT_P016LE, ///< like NV12, with 16bpp per component, little-endian
+ AV_PIX_FMT_P016BE, ///< like NV12, with 16bpp per component, big-endian
+
+ /**
+ * Hardware surfaces for Direct3D11.
+ *
+ * This is preferred over the legacy AV_PIX_FMT_D3D11VA_VLD. The new D3D11
+ * hwaccel API and filtering support AV_PIX_FMT_D3D11 only.
+ *
+ * data[0] contains a ID3D11Texture2D pointer, and data[1] contains the
+ * texture array index of the frame as intptr_t if the ID3D11Texture2D is
+ * an array texture (or always 0 if it's a normal texture).
+ */
+ AV_PIX_FMT_D3D11,
+
+ AV_PIX_FMT_GRAY9BE, ///< Y , 9bpp, big-endian
+ AV_PIX_FMT_GRAY9LE, ///< Y , 9bpp, little-endian
+
+ AV_PIX_FMT_GBRPF32BE, ///< IEEE-754 single precision planar GBR 4:4:4, 96bpp, big-endian
+ AV_PIX_FMT_GBRPF32LE, ///< IEEE-754 single precision planar GBR 4:4:4, 96bpp, little-endian
+ AV_PIX_FMT_GBRAPF32BE, ///< IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, big-endian
+ AV_PIX_FMT_GBRAPF32LE, ///< IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, little-endian
+
+ /**
+ * DRM-managed buffers exposed through PRIME buffer sharing.
+ *
+ * data[0] points to an AVDRMFrameDescriptor.
+ */
+ AV_PIX_FMT_DRM_PRIME,
+
AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions
};
@@ -322,6 +357,9 @@ enum AVPixelFormat {
#define AV_PIX_FMT_0RGB32 AV_PIX_FMT_NE(0RGB, BGR0)
#define AV_PIX_FMT_0BGR32 AV_PIX_FMT_NE(0BGR, RGB0)
+#define AV_PIX_FMT_GRAY9 AV_PIX_FMT_NE(GRAY9BE, GRAY9LE)
+#define AV_PIX_FMT_GRAY10 AV_PIX_FMT_NE(GRAY10BE, GRAY10LE)
+#define AV_PIX_FMT_GRAY12 AV_PIX_FMT_NE(GRAY12BE, GRAY12LE)
#define AV_PIX_FMT_GRAY16 AV_PIX_FMT_NE(GRAY16BE, GRAY16LE)
#define AV_PIX_FMT_YA16 AV_PIX_FMT_NE(YA16BE, YA16LE)
#define AV_PIX_FMT_RGB48 AV_PIX_FMT_NE(RGB48BE, RGB48LE)
@@ -367,6 +405,8 @@ enum AVPixelFormat {
#define AV_PIX_FMT_BAYER_GBRG16 AV_PIX_FMT_NE(BAYER_GBRG16BE, BAYER_GBRG16LE)
#define AV_PIX_FMT_BAYER_GRBG16 AV_PIX_FMT_NE(BAYER_GRBG16BE, BAYER_GRBG16LE)
+#define AV_PIX_FMT_GBRPF32 AV_PIX_FMT_NE(GBRPF32BE, GBRPF32LE)
+#define AV_PIX_FMT_GBRAPF32 AV_PIX_FMT_NE(GBRAPF32BE, GBRAPF32LE)
#define AV_PIX_FMT_YUVA420P9 AV_PIX_FMT_NE(YUVA420P9BE , YUVA420P9LE)
#define AV_PIX_FMT_YUVA422P9 AV_PIX_FMT_NE(YUVA422P9BE , YUVA422P9LE)
@@ -382,9 +422,11 @@ enum AVPixelFormat {
#define AV_PIX_FMT_NV20 AV_PIX_FMT_NE(NV20BE, NV20LE)
#define AV_PIX_FMT_AYUV64 AV_PIX_FMT_NE(AYUV64BE, AYUV64LE)
#define AV_PIX_FMT_P010 AV_PIX_FMT_NE(P010BE, P010LE)
+#define AV_PIX_FMT_P016 AV_PIX_FMT_NE(P016BE, P016LE)
/**
* Chromaticity coordinates of the source primaries.
+ * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.1.
*/
enum AVColorPrimaries {
AVCOL_PRI_RESERVED0 = 0,
@@ -398,14 +440,17 @@ enum AVColorPrimaries {
AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above
AVCOL_PRI_FILM = 8, ///< colour filters using Illuminant C
AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020
- AVCOL_PRI_SMPTEST428_1 = 10, ///< SMPTE ST 428-1 (CIE 1931 XYZ)
- AVCOL_PRI_SMPTE431 = 11, ///< SMPTE ST 431-2 (2011)
- AVCOL_PRI_SMPTE432 = 12, ///< SMPTE ST 432-1 D65 (2010)
+ AVCOL_PRI_SMPTE428 = 10, ///< SMPTE ST 428-1 (CIE 1931 XYZ)
+ AVCOL_PRI_SMPTEST428_1 = AVCOL_PRI_SMPTE428,
+ AVCOL_PRI_SMPTE431 = 11, ///< SMPTE ST 431-2 (2011) / DCI P3
+ AVCOL_PRI_SMPTE432 = 12, ///< SMPTE ST 432-1 (2010) / P3 D65 / Display P3
+ AVCOL_PRI_JEDEC_P22 = 22, ///< JEDEC P22 phosphors
AVCOL_PRI_NB ///< Not part of ABI
};
/**
* Color Transfer Characteristic.
+ * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.2.
*/
enum AVColorTransferCharacteristic {
AVCOL_TRC_RESERVED0 = 0,
@@ -424,14 +469,17 @@ enum AVColorTransferCharacteristic {
AVCOL_TRC_IEC61966_2_1 = 13, ///< IEC 61966-2-1 (sRGB or sYCC)
AVCOL_TRC_BT2020_10 = 14, ///< ITU-R BT2020 for 10-bit system
AVCOL_TRC_BT2020_12 = 15, ///< ITU-R BT2020 for 12-bit system
- AVCOL_TRC_SMPTEST2084 = 16, ///< SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems
- AVCOL_TRC_SMPTEST428_1 = 17, ///< SMPTE ST 428-1
+ AVCOL_TRC_SMPTE2084 = 16, ///< SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems
+ AVCOL_TRC_SMPTEST2084 = AVCOL_TRC_SMPTE2084,
+ AVCOL_TRC_SMPTE428 = 17, ///< SMPTE ST 428-1
+ AVCOL_TRC_SMPTEST428_1 = AVCOL_TRC_SMPTE428,
AVCOL_TRC_ARIB_STD_B67 = 18, ///< ARIB STD-B67, known as "Hybrid log-gamma"
AVCOL_TRC_NB ///< Not part of ABI
};
/**
* YUV colorspace type.
+ * These values match the ones defined by ISO/IEC 23001-8_2013 § 7.3.
*/
enum AVColorSpace {
AVCOL_SPC_RGB = 0, ///< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB)
@@ -442,14 +490,16 @@ enum AVColorSpace {
AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601
AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC
AVCOL_SPC_SMPTE240M = 7, ///< functionally identical to above
- AVCOL_SPC_YCOCG = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
+ AVCOL_SPC_YCGCO = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16
+ AVCOL_SPC_YCOCG = AVCOL_SPC_YCGCO,
AVCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system
AVCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system
AVCOL_SPC_SMPTE2085 = 11, ///< SMPTE 2085, Y'D'zD'x
+ AVCOL_SPC_CHROMA_DERIVED_NCL = 12, ///< Chromaticity-derived non-constant luminance system
+ AVCOL_SPC_CHROMA_DERIVED_CL = 13, ///< Chromaticity-derived constant luminance system
+ AVCOL_SPC_ICTCP = 14, ///< ITU-R BT.2100-0, ICtCp
AVCOL_SPC_NB ///< Not part of ABI
};
-#define AVCOL_SPC_YCGCO AVCOL_SPC_YCOCG
-
/**
* MPEG vs JPEG YUV range.
diff --git a/media/ffvpx/libavutil/reverse.h b/media/ffvpx/libavutil/reverse.h
new file mode 100644
index 0000000000..4eb6123932
--- /dev/null
+++ b/media/ffvpx/libavutil/reverse.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2002-2004 Michael Niedermayer <michaelni@gmx.at>
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_REVERSE_H
+#define AVUTIL_REVERSE_H
+
+#include <stdint.h>
+
+extern const uint8_t ff_reverse[256];
+
+#endif /* AVUTIL_REVERSE_H */
diff --git a/media/ffvpx/libavutil/slicethread.c b/media/ffvpx/libavutil/slicethread.c
new file mode 100644
index 0000000000..c43f87a2aa
--- /dev/null
+++ b/media/ffvpx/libavutil/slicethread.c
@@ -0,0 +1,259 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdatomic.h>
+#include "slicethread.h"
+#include "mem.h"
+#include "thread.h"
+#include "avassert.h"
+
+#if HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS2THREADS
+
+typedef struct WorkerContext {
+ AVSliceThread *ctx;
+ pthread_mutex_t mutex;
+ pthread_cond_t cond;
+ pthread_t thread;
+ int done;
+} WorkerContext;
+
+struct AVSliceThread {
+ WorkerContext *workers;
+ int nb_threads;
+ int nb_active_threads;
+ int nb_jobs;
+
+ atomic_uint first_job;
+ atomic_uint current_job;
+ pthread_mutex_t done_mutex;
+ pthread_cond_t done_cond;
+ int done;
+ int finished;
+
+ void *priv;
+ void (*worker_func)(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads);
+ void (*main_func)(void *priv);
+};
+
+static int run_jobs(AVSliceThread *ctx)
+{
+ unsigned nb_jobs = ctx->nb_jobs;
+ unsigned nb_active_threads = ctx->nb_active_threads;
+ unsigned first_job = atomic_fetch_add_explicit(&ctx->first_job, 1, memory_order_acq_rel);
+ unsigned current_job = first_job;
+
+ do {
+ ctx->worker_func(ctx->priv, current_job, first_job, nb_jobs, nb_active_threads);
+ } while ((current_job = atomic_fetch_add_explicit(&ctx->current_job, 1, memory_order_acq_rel)) < nb_jobs);
+
+ return current_job == nb_jobs + nb_active_threads - 1;
+}
+
+static void *attribute_align_arg thread_worker(void *v)
+{
+ WorkerContext *w = v;
+ AVSliceThread *ctx = w->ctx;
+
+ pthread_mutex_lock(&w->mutex);
+ pthread_cond_signal(&w->cond);
+
+ while (1) {
+ w->done = 1;
+ while (w->done)
+ pthread_cond_wait(&w->cond, &w->mutex);
+
+ if (ctx->finished) {
+ pthread_mutex_unlock(&w->mutex);
+ return NULL;
+ }
+
+ if (run_jobs(ctx)) {
+ pthread_mutex_lock(&ctx->done_mutex);
+ ctx->done = 1;
+ pthread_cond_signal(&ctx->done_cond);
+ pthread_mutex_unlock(&ctx->done_mutex);
+ }
+ }
+}
+
+int avpriv_slicethread_create(AVSliceThread **pctx, void *priv,
+ void (*worker_func)(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads),
+ void (*main_func)(void *priv),
+ int nb_threads)
+{
+ AVSliceThread *ctx;
+ int nb_workers, i;
+
+#if HAVE_W32THREADS
+ w32thread_init();
+#endif
+
+ av_assert0(nb_threads >= 0);
+ if (!nb_threads) {
+ int nb_cpus = av_cpu_count();
+ if (nb_cpus > 1)
+ nb_threads = nb_cpus + 1;
+ else
+ nb_threads = 1;
+ }
+
+ nb_workers = nb_threads;
+ if (!main_func)
+ nb_workers--;
+
+ *pctx = ctx = av_mallocz(sizeof(*ctx));
+ if (!ctx)
+ return AVERROR(ENOMEM);
+
+ if (nb_workers && !(ctx->workers = av_calloc(nb_workers, sizeof(*ctx->workers)))) {
+ av_freep(pctx);
+ return AVERROR(ENOMEM);
+ }
+
+ ctx->priv = priv;
+ ctx->worker_func = worker_func;
+ ctx->main_func = main_func;
+ ctx->nb_threads = nb_threads;
+ ctx->nb_active_threads = 0;
+ ctx->nb_jobs = 0;
+ ctx->finished = 0;
+
+ atomic_init(&ctx->first_job, 0);
+ atomic_init(&ctx->current_job, 0);
+ pthread_mutex_init(&ctx->done_mutex, NULL);
+ pthread_cond_init(&ctx->done_cond, NULL);
+ ctx->done = 0;
+
+ for (i = 0; i < nb_workers; i++) {
+ WorkerContext *w = &ctx->workers[i];
+ int ret;
+ w->ctx = ctx;
+ pthread_mutex_init(&w->mutex, NULL);
+ pthread_cond_init(&w->cond, NULL);
+ pthread_mutex_lock(&w->mutex);
+ w->done = 0;
+
+ if (ret = pthread_create(&w->thread, NULL, thread_worker, w)) {
+ ctx->nb_threads = main_func ? i : i + 1;
+ pthread_mutex_unlock(&w->mutex);
+ pthread_cond_destroy(&w->cond);
+ pthread_mutex_destroy(&w->mutex);
+ avpriv_slicethread_free(pctx);
+ return AVERROR(ret);
+ }
+
+ while (!w->done)
+ pthread_cond_wait(&w->cond, &w->mutex);
+ pthread_mutex_unlock(&w->mutex);
+ }
+
+ return nb_threads;
+}
+
+void avpriv_slicethread_execute(AVSliceThread *ctx, int nb_jobs, int execute_main)
+{
+ int nb_workers, i, is_last = 0;
+
+ av_assert0(nb_jobs > 0);
+ ctx->nb_jobs = nb_jobs;
+ ctx->nb_active_threads = FFMIN(nb_jobs, ctx->nb_threads);
+ atomic_store_explicit(&ctx->first_job, 0, memory_order_relaxed);
+ atomic_store_explicit(&ctx->current_job, ctx->nb_active_threads, memory_order_relaxed);
+ nb_workers = ctx->nb_active_threads;
+ if (!ctx->main_func || !execute_main)
+ nb_workers--;
+
+ for (i = 0; i < nb_workers; i++) {
+ WorkerContext *w = &ctx->workers[i];
+ pthread_mutex_lock(&w->mutex);
+ w->done = 0;
+ pthread_cond_signal(&w->cond);
+ pthread_mutex_unlock(&w->mutex);
+ }
+
+ if (ctx->main_func && execute_main)
+ ctx->main_func(ctx->priv);
+ else
+ is_last = run_jobs(ctx);
+
+ if (!is_last) {
+ pthread_mutex_lock(&ctx->done_mutex);
+ while (!ctx->done)
+ pthread_cond_wait(&ctx->done_cond, &ctx->done_mutex);
+ ctx->done = 0;
+ pthread_mutex_unlock(&ctx->done_mutex);
+ }
+}
+
+void avpriv_slicethread_free(AVSliceThread **pctx)
+{
+ AVSliceThread *ctx;
+ int nb_workers, i;
+
+ if (!pctx || !*pctx)
+ return;
+
+ ctx = *pctx;
+ nb_workers = ctx->nb_threads;
+ if (!ctx->main_func)
+ nb_workers--;
+
+ ctx->finished = 1;
+ for (i = 0; i < nb_workers; i++) {
+ WorkerContext *w = &ctx->workers[i];
+ pthread_mutex_lock(&w->mutex);
+ w->done = 0;
+ pthread_cond_signal(&w->cond);
+ pthread_mutex_unlock(&w->mutex);
+ }
+
+ for (i = 0; i < nb_workers; i++) {
+ WorkerContext *w = &ctx->workers[i];
+ pthread_join(w->thread, NULL);
+ pthread_cond_destroy(&w->cond);
+ pthread_mutex_destroy(&w->mutex);
+ }
+
+ pthread_cond_destroy(&ctx->done_cond);
+ pthread_mutex_destroy(&ctx->done_mutex);
+ av_freep(&ctx->workers);
+ av_freep(pctx);
+}
+
+#else /* HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS32THREADS */
+
+int avpriv_slicethread_create(AVSliceThread **pctx, void *priv,
+ void (*worker_func)(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads),
+ void (*main_func)(void *priv),
+ int nb_threads)
+{
+ *pctx = NULL;
+ return AVERROR(EINVAL);
+}
+
+void avpriv_slicethread_execute(AVSliceThread *ctx, int nb_jobs, int execute_main)
+{
+ av_assert0(0);
+}
+
+void avpriv_slicethread_free(AVSliceThread **pctx)
+{
+ av_assert0(!pctx || !*pctx);
+}
+
+#endif /* HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS32THREADS */
diff --git a/media/ffvpx/libavutil/slicethread.h b/media/ffvpx/libavutil/slicethread.h
new file mode 100644
index 0000000000..f6f6f302c4
--- /dev/null
+++ b/media/ffvpx/libavutil/slicethread.h
@@ -0,0 +1,52 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVUTIL_SLICETHREAD_H
+#define AVUTIL_SLICETHREAD_H
+
+typedef struct AVSliceThread AVSliceThread;
+
+/**
+ * Create slice threading context.
+ * @param pctx slice threading context returned here
+ * @param priv private pointer to be passed to callback function
+ * @param worker_func callback function to be executed
+ * @param main_func special callback function, called from main thread, may be NULL
+ * @param nb_threads number of threads, 0 for automatic, must be >= 0
+ * @return return number of threads or negative AVERROR on failure
+ */
+int avpriv_slicethread_create(AVSliceThread **pctx, void *priv,
+ void (*worker_func)(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads),
+ void (*main_func)(void *priv),
+ int nb_threads);
+
+/**
+ * Execute slice threading.
+ * @param ctx slice threading context
+ * @param nb_jobs number of jobs, must be > 0
+ * @param execute_main also execute main_func
+ */
+void avpriv_slicethread_execute(AVSliceThread *ctx, int nb_jobs, int execute_main);
+
+/**
+ * Destroy slice threading context.
+ * @param pctx pointer to context
+ */
+void avpriv_slicethread_free(AVSliceThread **pctx);
+
+#endif
diff --git a/media/ffvpx/libavutil/thread.h b/media/ffvpx/libavutil/thread.h
index 32ddf40365..f108e20052 100644
--- a/media/ffvpx/libavutil/thread.h
+++ b/media/ffvpx/libavutil/thread.h
@@ -26,8 +26,6 @@
#if HAVE_PTHREADS || HAVE_W32THREADS || HAVE_OS2THREADS
-#define USE_ATOMICS 0
-
#if HAVE_PTHREADS
#include <pthread.h>
@@ -38,8 +36,11 @@
#define ASSERT_PTHREAD_NORET(func, ...) do { \
int ret = func(__VA_ARGS__); \
if (ret) { \
+ char errbuf[AV_ERROR_MAX_STRING_SIZE] = ""; \
av_log(NULL, AV_LOG_FATAL, AV_STRINGIFY(func) \
- " failed with error: %s\n", av_err2str(AVERROR(ret))); \
+ " failed with error: %s\n", \
+ av_make_error_string(errbuf, AV_ERROR_MAX_STRING_SIZE, \
+ AVERROR(ret))); \
abort(); \
} \
} while (0)
@@ -146,8 +147,6 @@ static inline int strict_pthread_once(pthread_once_t *once_control, void (*init_
#else
-#define USE_ATOMICS 1
-
#define AVMutex char
#define ff_mutex_init(mutex, attr) (0)
diff --git a/media/ffvpx/libavutil/threadmessage.c b/media/ffvpx/libavutil/threadmessage.c
index 7c5cd2463c..872e9392b1 100644
--- a/media/ffvpx/libavutil/threadmessage.c
+++ b/media/ffvpx/libavutil/threadmessage.c
@@ -69,7 +69,7 @@ int av_thread_message_queue_alloc(AVThreadMessageQueue **mq,
pthread_cond_destroy(&rmq->cond_recv);
pthread_mutex_destroy(&rmq->lock);
av_free(rmq);
- return AVERROR(ret);
+ return AVERROR(ENOMEM);
}
rmq->elsize = elsize;
*mq = rmq;
diff --git a/media/ffvpx/libavutil/time.c b/media/ffvpx/libavutil/time.c
index 69419e6f38..80d1faf264 100644
--- a/media/ffvpx/libavutil/time.c
+++ b/media/ffvpx/libavutil/time.c
@@ -56,17 +56,25 @@ int64_t av_gettime(void)
int64_t av_gettime_relative(void)
{
#if HAVE_CLOCK_GETTIME && defined(CLOCK_MONOTONIC)
- struct timespec ts;
- clock_gettime(CLOCK_MONOTONIC, &ts);
- return (int64_t)ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
-#else
- return av_gettime() + 42 * 60 * 60 * INT64_C(1000000);
+#ifdef __APPLE__
+ if (clock_gettime)
+#endif
+ {
+ struct timespec ts;
+ clock_gettime(CLOCK_MONOTONIC, &ts);
+ return (int64_t)ts.tv_sec * 1000000 + ts.tv_nsec / 1000;
+ }
#endif
+ return av_gettime() + 42 * 60 * 60 * INT64_C(1000000);
}
int av_gettime_relative_is_monotonic(void)
{
#if HAVE_CLOCK_GETTIME && defined(CLOCK_MONOTONIC)
+#ifdef __APPLE__
+ if (!clock_gettime)
+ return 0;
+#endif
return 1;
#else
return 0;
diff --git a/media/ffvpx/libavutil/timecode.c b/media/ffvpx/libavutil/timecode.c
index fa92df1ef9..c0c67c8478 100644
--- a/media/ffvpx/libavutil/timecode.c
+++ b/media/ffvpx/libavutil/timecode.c
@@ -129,7 +129,8 @@ char *av_timecode_make_smpte_tc_string(char *buf, uint32_t tcsmpte, int prevent_
char *av_timecode_make_mpeg_tc_string(char *buf, uint32_t tc25bit)
{
- snprintf(buf, AV_TIMECODE_STR_SIZE, "%02u:%02u:%02u%c%02u",
+ snprintf(buf, AV_TIMECODE_STR_SIZE,
+ "%02"PRIu32":%02"PRIu32":%02"PRIu32"%c%02"PRIu32,
tc25bit>>19 & 0x1f, // 5-bit hours
tc25bit>>13 & 0x3f, // 6-bit minutes
tc25bit>>6 & 0x3f, // 6-bit seconds
diff --git a/media/ffvpx/libavutil/timecode.h b/media/ffvpx/libavutil/timecode.h
index 56e3975fd8..37c1361bc2 100644
--- a/media/ffvpx/libavutil/timecode.h
+++ b/media/ffvpx/libavutil/timecode.h
@@ -30,7 +30,7 @@
#include <stdint.h>
#include "rational.h"
-#define AV_TIMECODE_STR_SIZE 16
+#define AV_TIMECODE_STR_SIZE 23
enum AVTimecodeFlag {
AV_TIMECODE_FLAG_DROPFRAME = 1<<0, ///< timecode is drop frame
diff --git a/media/ffvpx/libavutil/timer.h b/media/ffvpx/libavutil/timer.h
index ed3b047870..f7ab455df2 100644
--- a/media/ffvpx/libavutil/timer.h
+++ b/media/ffvpx/libavutil/timer.h
@@ -26,12 +26,22 @@
#ifndef AVUTIL_TIMER_H
#define AVUTIL_TIMER_H
+#include "config.h"
+
+#if CONFIG_LINUX_PERF
+# ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+# endif
+# include <unistd.h> // read(3)
+# include <sys/ioctl.h>
+# include <asm/unistd.h>
+# include <linux/perf_event.h>
+#endif
+
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
-#include "config.h"
-
#if HAVE_MACH_MACH_TIME_H
#include <mach/mach_time.h>
#endif
@@ -60,23 +70,17 @@
# define FF_TIMER_UNITS "UNITS"
#endif
-#ifdef AV_READ_TIME
-#define START_TIMER \
- uint64_t tend; \
- uint64_t tstart = AV_READ_TIME(); \
-
-#define STOP_TIMER(id) \
- tend = AV_READ_TIME(); \
+#define TIMER_REPORT(id, tdiff) \
{ \
static uint64_t tsum = 0; \
static int tcount = 0; \
static int tskip_count = 0; \
static int thistogram[32] = {0}; \
- thistogram[av_log2(tend - tstart)]++; \
- if (tcount < 2 || \
- tend - tstart < 8 * tsum / tcount || \
- tend - tstart < 2000) { \
- tsum+= tend - tstart; \
+ thistogram[av_log2(tdiff)]++; \
+ if (tcount < 2 || \
+ (tdiff) < 8 * tsum / tcount || \
+ (tdiff) < 2000) { \
+ tsum += (tdiff); \
tcount++; \
} else \
tskip_count++; \
@@ -90,6 +94,45 @@
av_log(NULL, AV_LOG_ERROR, "\n"); \
} \
}
+
+#if CONFIG_LINUX_PERF
+
+#define START_TIMER \
+ static int linux_perf_fd; \
+ uint64_t tperf; \
+ if (!linux_perf_fd) { \
+ struct perf_event_attr attr = { \
+ .type = PERF_TYPE_HARDWARE, \
+ .size = sizeof(struct perf_event_attr), \
+ .config = PERF_COUNT_HW_CPU_CYCLES, \
+ .disabled = 1, \
+ .exclude_kernel = 1, \
+ .exclude_hv = 1, \
+ }; \
+ linux_perf_fd = syscall(__NR_perf_event_open, &attr, \
+ 0, -1, -1, 0); \
+ } \
+ if (linux_perf_fd == -1) { \
+ av_log(NULL, AV_LOG_ERROR, "perf_event_open failed: %s\n", \
+ av_err2str(AVERROR(errno))); \
+ } else { \
+ ioctl(linux_perf_fd, PERF_EVENT_IOC_RESET, 0); \
+ ioctl(linux_perf_fd, PERF_EVENT_IOC_ENABLE, 0); \
+ }
+
+#define STOP_TIMER(id) \
+ ioctl(linux_perf_fd, PERF_EVENT_IOC_DISABLE, 0); \
+ read(linux_perf_fd, &tperf, sizeof(tperf)); \
+ TIMER_REPORT(id, tperf)
+
+#elif defined(AV_READ_TIME)
+#define START_TIMER \
+ uint64_t tend; \
+ uint64_t tstart = AV_READ_TIME(); \
+
+#define STOP_TIMER(id) \
+ tend = AV_READ_TIME(); \
+ TIMER_REPORT(id, tend - tstart)
#else
#define START_TIMER
#define STOP_TIMER(id) { }
diff --git a/media/ffvpx/libavutil/utils.c b/media/ffvpx/libavutil/utils.c
index 36e4dd5fdb..2c170db2e1 100644
--- a/media/ffvpx/libavutil/utils.c
+++ b/media/ffvpx/libavutil/utils.c
@@ -121,6 +121,29 @@ unsigned av_int_list_length_for_size(unsigned elsize,
return i;
}
+char *av_fourcc_make_string(char *buf, uint32_t fourcc)
+{
+ int i;
+ char *orig_buf = buf;
+ size_t buf_size = AV_FOURCC_MAX_STRING_SIZE;
+
+ for (i = 0; i < 4; i++) {
+ const int c = fourcc & 0xff;
+ const int print_chr = (c >= '0' && c <= '9') ||
+ (c >= 'a' && c <= 'z') ||
+ (c >= 'A' && c <= 'Z') ||
+ (c && strchr(". -_", c));
+ const int len = snprintf(buf, buf_size, print_chr ? "%c" : "[%d]", c);
+ if (len < 0)
+ break;
+ buf += len;
+ buf_size = buf_size > len ? buf_size - len : 0;
+ fourcc >>= 8;
+ }
+
+ return orig_buf;
+}
+
AVRational av_get_time_base_q(void)
{
return (AVRational){1, AV_TIME_BASE};
@@ -129,7 +152,7 @@ AVRational av_get_time_base_q(void)
void av_assert0_fpu(void) {
#if HAVE_MMX_INLINE
uint16_t state[14];
- __asm volatile (
+ __asm__ volatile (
"fstenv %0 \n\t"
: "+m" (state)
:
diff --git a/media/ffvpx/libavutil/version.h b/media/ffvpx/libavutil/version.h
index bdd310f855..f594dc0691 100644
--- a/media/ffvpx/libavutil/version.h
+++ b/media/ffvpx/libavutil/version.h
@@ -78,8 +78,9 @@
* @{
*/
+
#define LIBAVUTIL_VERSION_MAJOR 55
-#define LIBAVUTIL_VERSION_MINOR 34
+#define LIBAVUTIL_VERSION_MINOR 78
#define LIBAVUTIL_VERSION_MICRO 100
#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
@@ -135,6 +136,9 @@
#ifndef FF_API_PKT_PTS
#define FF_API_PKT_PTS (LIBAVUTIL_VERSION_MAJOR < 56)
#endif
+#ifndef FF_API_CRYPTO_SIZE_T
+#define FF_API_CRYPTO_SIZE_T (LIBAVUTIL_VERSION_MAJOR < 56)
+#endif
/**
diff --git a/media/ffvpx/libavutil/wchar_filename.h b/media/ffvpx/libavutil/wchar_filename.h
deleted file mode 100644
index 2ade321bed..0000000000
--- a/media/ffvpx/libavutil/wchar_filename.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef AVUTIL_WCHAR_FILENAME_H
-#define AVUTIL_WCHAR_FILENAME_H
-
-#if defined(_WIN32) && !defined(__MINGW32CE__)
-#include <windows.h>
-#include "mem.h"
-
-av_warn_unused_result
-static inline int utf8towchar(const char *filename_utf8, wchar_t **filename_w)
-{
- int num_chars;
- num_chars = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filename_utf8, -1, NULL, 0);
- if (num_chars <= 0) {
- *filename_w = NULL;
- return 0;
- }
- *filename_w = (wchar_t *)av_mallocz_array(num_chars, sizeof(wchar_t));
- if (!*filename_w) {
- errno = ENOMEM;
- return -1;
- }
- MultiByteToWideChar(CP_UTF8, 0, filename_utf8, -1, *filename_w, num_chars);
- return 0;
-}
-#endif
-
-#endif /* AVUTIL_WCHAR_FILENAME_H */
diff --git a/media/ffvpx/libavutil/x86/cpu.c b/media/ffvpx/libavutil/x86/cpu.c
index f3a49c6772..f33088c8c7 100644
--- a/media/ffvpx/libavutil/x86/cpu.c
+++ b/media/ffvpx/libavutil/x86/cpu.c
@@ -28,7 +28,7 @@
#include "libavutil/cpu.h"
#include "libavutil/cpu_internal.h"
-#if HAVE_YASM
+#if HAVE_X86ASM
#define cpuid(index, eax, ebx, ecx, edx) \
ff_cpu_cpuid(index, &eax, &ebx, &ecx, &edx)
@@ -66,7 +66,7 @@
#define cpuid_test() 1
-#elif HAVE_YASM
+#elif HAVE_X86ASM
#define cpuid_test ff_cpu_cpuid_test
@@ -221,9 +221,42 @@ int ff_get_cpu_flags_x86(void)
* functions on the Atom. */
if (family == 6 && model == 28)
rval |= AV_CPU_FLAG_ATOM;
+
+ /* Conroe has a slow shuffle unit. Check the model number to ensure not
+ * to include crippled low-end Penryns and Nehalems that lack SSE4. */
+ if ((rval & AV_CPU_FLAG_SSSE3) && !(rval & AV_CPU_FLAG_SSE4) &&
+ family == 6 && model < 23)
+ rval |= AV_CPU_FLAG_SSSE3SLOW;
}
#endif /* cpuid */
return rval;
}
+
+size_t ff_get_cpu_max_align_x86(void)
+{
+ int flags = av_get_cpu_flags();
+
+ if (flags & (AV_CPU_FLAG_AVX2 |
+ AV_CPU_FLAG_AVX |
+ AV_CPU_FLAG_XOP |
+ AV_CPU_FLAG_FMA4 |
+ AV_CPU_FLAG_FMA3 |
+ AV_CPU_FLAG_AVXSLOW))
+ return 32;
+ if (flags & (AV_CPU_FLAG_AESNI |
+ AV_CPU_FLAG_SSE42 |
+ AV_CPU_FLAG_SSE4 |
+ AV_CPU_FLAG_SSSE3 |
+ AV_CPU_FLAG_SSE3 |
+ AV_CPU_FLAG_SSE2 |
+ AV_CPU_FLAG_SSE |
+ AV_CPU_FLAG_ATOM |
+ AV_CPU_FLAG_SSSE3SLOW |
+ AV_CPU_FLAG_SSE3SLOW |
+ AV_CPU_FLAG_SSE2SLOW))
+ return 16;
+
+ return 8;
+}
diff --git a/media/ffvpx/libavutil/x86/cpu.h b/media/ffvpx/libavutil/x86/cpu.h
index f171037f1c..309b8e746c 100644
--- a/media/ffvpx/libavutil/x86/cpu.h
+++ b/media/ffvpx/libavutil/x86/cpu.h
@@ -38,6 +38,8 @@
#define X86_SSE3_FAST(flags) CPUEXT_FAST(flags, SSE3)
#define X86_SSE3_SLOW(flags) CPUEXT_SLOW(flags, SSE3)
#define X86_SSSE3(flags) CPUEXT(flags, SSSE3)
+#define X86_SSSE3_FAST(flags) CPUEXT_FAST(flags, SSSE3)
+#define X86_SSSE3_SLOW(flags) CPUEXT_SLOW(flags, SSSE3)
#define X86_SSE4(flags) CPUEXT(flags, SSE4)
#define X86_SSE42(flags) CPUEXT(flags, SSE42)
#define X86_AVX(flags) CPUEXT(flags, AVX)
@@ -61,6 +63,8 @@
#define EXTERNAL_SSE3_FAST(flags) CPUEXT_SUFFIX_FAST(flags, _EXTERNAL, SSE3)
#define EXTERNAL_SSE3_SLOW(flags) CPUEXT_SUFFIX_SLOW(flags, _EXTERNAL, SSE3)
#define EXTERNAL_SSSE3(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSSE3)
+#define EXTERNAL_SSSE3_FAST(flags) CPUEXT_SUFFIX_FAST(flags, _EXTERNAL, SSSE3)
+#define EXTERNAL_SSSE3_SLOW(flags) CPUEXT_SUFFIX_SLOW(flags, _EXTERNAL, SSSE3)
#define EXTERNAL_SSE4(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSE4)
#define EXTERNAL_SSE42(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSE42)
#define EXTERNAL_AVX(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AVX)
@@ -88,6 +92,8 @@
#define INLINE_SSE3_FAST(flags) CPUEXT_SUFFIX_FAST(flags, _INLINE, SSE3)
#define INLINE_SSE3_SLOW(flags) CPUEXT_SUFFIX_SLOW(flags, _INLINE, SSE3)
#define INLINE_SSSE3(flags) CPUEXT_SUFFIX(flags, _INLINE, SSSE3)
+#define INLINE_SSSE3_FAST(flags) CPUEXT_SUFFIX_FAST(flags, _INLINE, SSSE3)
+#define INLINE_SSSE3_SLOW(flags) CPUEXT_SUFFIX_SLOW(flags, _INLINE, SSSE3)
#define INLINE_SSE4(flags) CPUEXT_SUFFIX(flags, _INLINE, SSE4)
#define INLINE_SSE42(flags) CPUEXT_SUFFIX(flags, _INLINE, SSE42)
#define INLINE_AVX(flags) CPUEXT_SUFFIX(flags, _INLINE, AVX)
diff --git a/media/ffvpx/libavutil/x86/emms.asm b/media/ffvpx/libavutil/x86/emms.asm
index 0aad34af3f..8611762d73 100644
--- a/media/ffvpx/libavutil/x86/emms.asm
+++ b/media/ffvpx/libavutil/x86/emms.asm
@@ -23,8 +23,8 @@
SECTION .text
;-----------------------------------------------------------------------------
-; void avpriv_emms_yasm(void)
+; void avpriv_emms_asm(void)
;-----------------------------------------------------------------------------
-cvisible emms_yasm, 0, 0
+cvisible emms_asm, 0, 0
emms
RET
diff --git a/media/ffvpx/libavutil/x86/emms.h b/media/ffvpx/libavutil/x86/emms.h
index 42c18e2953..c21e34b451 100644
--- a/media/ffvpx/libavutil/x86/emms.h
+++ b/media/ffvpx/libavutil/x86/emms.h
@@ -23,7 +23,7 @@
#include "libavutil/attributes.h"
#include "libavutil/cpu.h"
-void avpriv_emms_yasm(void);
+void avpriv_emms_asm(void);
#if HAVE_MMX_INLINE
# define emms_c emms_c
@@ -49,7 +49,7 @@ static av_always_inline void emms_c(void)
# include <mmintrin.h>
# define emms_c _mm_empty
#elif HAVE_MMX_EXTERNAL
-# define emms_c avpriv_emms_yasm
+# define emms_c avpriv_emms_asm
#endif /* HAVE_MMX_INLINE */
#endif /* AVUTIL_X86_EMMS_H */
diff --git a/media/ffvpx/libavutil/x86/float_dsp.asm b/media/ffvpx/libavutil/x86/float_dsp.asm
index 021ff03c87..06d2d2cfd1 100644
--- a/media/ffvpx/libavutil/x86/float_dsp.asm
+++ b/media/ffvpx/libavutil/x86/float_dsp.asm
@@ -22,6 +22,9 @@
%include "x86util.asm"
+SECTION_RODATA 32
+pd_reverse: dd 7, 6, 5, 4, 3, 2, 1, 0
+
SECTION .text
;-----------------------------------------------------------------------------
@@ -149,6 +152,69 @@ INIT_XMM sse
VECTOR_FMUL_SCALAR
;------------------------------------------------------------------------------
+; void ff_vector_dmac_scalar(double *dst, const double *src, double mul,
+; int len)
+;------------------------------------------------------------------------------
+
+%macro VECTOR_DMAC_SCALAR 0
+%if ARCH_X86_32
+cglobal vector_dmac_scalar, 2,4,5, dst, src, mul, len, lenaddr
+ mov lenq, lenaddrm
+ VBROADCASTSD m0, mulm
+%else
+%if UNIX64
+cglobal vector_dmac_scalar, 3,3,5, dst, src, len
+%else
+cglobal vector_dmac_scalar, 4,4,5, dst, src, mul, len
+ SWAP 0, 2
+%endif
+ movlhps xm0, xm0
+%if cpuflag(avx)
+ vinsertf128 m0, m0, xm0, 1
+%endif
+%endif
+ lea lenq, [lend*8-mmsize*4]
+.loop:
+%if cpuflag(fma3)
+ movaps m1, [dstq+lenq]
+ movaps m2, [dstq+lenq+1*mmsize]
+ movaps m3, [dstq+lenq+2*mmsize]
+ movaps m4, [dstq+lenq+3*mmsize]
+ fmaddpd m1, m0, [srcq+lenq], m1
+ fmaddpd m2, m0, [srcq+lenq+1*mmsize], m2
+ fmaddpd m3, m0, [srcq+lenq+2*mmsize], m3
+ fmaddpd m4, m0, [srcq+lenq+3*mmsize], m4
+%else ; cpuflag
+ mulpd m1, m0, [srcq+lenq]
+ mulpd m2, m0, [srcq+lenq+1*mmsize]
+ mulpd m3, m0, [srcq+lenq+2*mmsize]
+ mulpd m4, m0, [srcq+lenq+3*mmsize]
+ addpd m1, m1, [dstq+lenq]
+ addpd m2, m2, [dstq+lenq+1*mmsize]
+ addpd m3, m3, [dstq+lenq+2*mmsize]
+ addpd m4, m4, [dstq+lenq+3*mmsize]
+%endif ; cpuflag
+ movaps [dstq+lenq], m1
+ movaps [dstq+lenq+1*mmsize], m2
+ movaps [dstq+lenq+2*mmsize], m3
+ movaps [dstq+lenq+3*mmsize], m4
+ sub lenq, mmsize*4
+ jge .loop
+ REP_RET
+%endmacro
+
+INIT_XMM sse2
+VECTOR_DMAC_SCALAR
+%if HAVE_AVX_EXTERNAL
+INIT_YMM avx
+VECTOR_DMAC_SCALAR
+%endif
+%if HAVE_FMA3_EXTERNAL
+INIT_YMM fma3
+VECTOR_DMAC_SCALAR
+%endif
+
+;------------------------------------------------------------------------------
; void ff_vector_dmul_scalar(double *dst, const double *src, double mul,
; int len)
;------------------------------------------------------------------------------
@@ -177,8 +243,8 @@ cglobal vector_dmul_scalar, 4,4,3, dst, src, mul, len
.loop:
mulpd m1, m0, [srcq+lenq ]
mulpd m2, m0, [srcq+lenq+mmsize]
- mova [dstq+lenq ], m1
- mova [dstq+lenq+mmsize], m2
+ movaps [dstq+lenq ], m1
+ movaps [dstq+lenq+mmsize], m2
sub lenq, 2*mmsize
jge .loop
REP_RET
@@ -296,10 +362,16 @@ VECTOR_FMUL_ADD
;-----------------------------------------------------------------------------
%macro VECTOR_FMUL_REVERSE 0
cglobal vector_fmul_reverse, 4,4,2, dst, src0, src1, len
+%if cpuflag(avx2)
+ movaps m2, [pd_reverse]
+%endif
lea lenq, [lend*4 - 2*mmsize]
ALIGN 16
.loop:
-%if cpuflag(avx)
+%if cpuflag(avx2)
+ vpermps m0, m2, [src1q]
+ vpermps m1, m2, [src1q+mmsize]
+%elif cpuflag(avx)
vmovaps xmm0, [src1q + 16]
vinsertf128 m0, m0, [src1q], 1
vshufps m0, m0, m0, q0123
@@ -314,8 +386,8 @@ ALIGN 16
%endif
mulps m0, m0, [src0q + lenq + mmsize]
mulps m1, m1, [src0q + lenq]
- mova [dstq + lenq + mmsize], m0
- mova [dstq + lenq], m1
+ movaps [dstq + lenq + mmsize], m0
+ movaps [dstq + lenq], m1
add src1q, 2*mmsize
sub lenq, 2*mmsize
jge .loop
@@ -328,6 +400,10 @@ VECTOR_FMUL_REVERSE
INIT_YMM avx
VECTOR_FMUL_REVERSE
%endif
+%if HAVE_AVX2_EXTERNAL
+INIT_YMM avx2
+VECTOR_FMUL_REVERSE
+%endif
; float scalarproduct_float_sse(const float *v1, const float *v2, int len)
INIT_XMM sse
diff --git a/media/ffvpx/libavutil/x86/float_dsp_init.c b/media/ffvpx/libavutil/x86/float_dsp_init.c
index c836a78e1b..122087a196 100644
--- a/media/ffvpx/libavutil/x86/float_dsp_init.c
+++ b/media/ffvpx/libavutil/x86/float_dsp_init.c
@@ -39,6 +39,13 @@ void ff_vector_fmac_scalar_fma3(float *dst, const float *src, float mul,
void ff_vector_fmul_scalar_sse(float *dst, const float *src, float mul,
int len);
+void ff_vector_dmac_scalar_sse2(double *dst, const double *src, double mul,
+ int len);
+void ff_vector_dmac_scalar_avx(double *dst, const double *src, double mul,
+ int len);
+void ff_vector_dmac_scalar_fma3(double *dst, const double *src, double mul,
+ int len);
+
void ff_vector_dmul_scalar_sse2(double *dst, const double *src,
double mul, int len);
void ff_vector_dmul_scalar_avx(double *dst, const double *src,
@@ -60,10 +67,12 @@ void ff_vector_fmul_reverse_sse(float *dst, const float *src0,
const float *src1, int len);
void ff_vector_fmul_reverse_avx(float *dst, const float *src0,
const float *src1, int len);
+void ff_vector_fmul_reverse_avx2(float *dst, const float *src0,
+ const float *src1, int len);
float ff_scalarproduct_float_sse(const float *v1, const float *v2, int order);
-void ff_butterflies_float_sse(float *src0, float *src1, int len);
+void ff_butterflies_float_sse(float *av_restrict src0, float *av_restrict src1, int len);
av_cold void ff_float_dsp_init_x86(AVFloatDSPContext *fdsp)
{
@@ -83,17 +92,23 @@ av_cold void ff_float_dsp_init_x86(AVFloatDSPContext *fdsp)
fdsp->butterflies_float = ff_butterflies_float_sse;
}
if (EXTERNAL_SSE2(cpu_flags)) {
+ fdsp->vector_dmac_scalar = ff_vector_dmac_scalar_sse2;
fdsp->vector_dmul_scalar = ff_vector_dmul_scalar_sse2;
}
if (EXTERNAL_AVX_FAST(cpu_flags)) {
fdsp->vector_fmul = ff_vector_fmul_avx;
fdsp->vector_fmac_scalar = ff_vector_fmac_scalar_avx;
fdsp->vector_dmul_scalar = ff_vector_dmul_scalar_avx;
+ fdsp->vector_dmac_scalar = ff_vector_dmac_scalar_avx;
fdsp->vector_fmul_add = ff_vector_fmul_add_avx;
fdsp->vector_fmul_reverse = ff_vector_fmul_reverse_avx;
}
+ if (EXTERNAL_AVX2_FAST(cpu_flags)) {
+ fdsp->vector_fmul_reverse = ff_vector_fmul_reverse_avx2;
+ }
if (EXTERNAL_FMA3_FAST(cpu_flags)) {
fdsp->vector_fmac_scalar = ff_vector_fmac_scalar_fma3;
fdsp->vector_fmul_add = ff_vector_fmul_add_fma3;
+ fdsp->vector_dmac_scalar = ff_vector_dmac_scalar_fma3;
}
}
diff --git a/media/ffvpx/libavutil/x86/imgutils.asm b/media/ffvpx/libavutil/x86/imgutils.asm
new file mode 100644
index 0000000000..3cca56cdca
--- /dev/null
+++ b/media/ffvpx/libavutil/x86/imgutils.asm
@@ -0,0 +1,53 @@
+;*****************************************************************************
+;* Copyright 2016 Anton Khirnov
+;*
+;* This file is part of FFmpeg.
+;*
+;* FFmpeg is free software; you can redistribute it and/or
+;* modify it under the terms of the GNU Lesser General Public
+;* License as published by the Free Software Foundation; either
+;* version 2.1 of the License, or (at your option) any later version.
+;*
+;* FFmpeg is distributed in the hope that it will be useful,
+;* but WITHOUT ANY WARRANTY; without even the implied warranty of
+;* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+;* Lesser General Public License for more details.
+;*
+;* You should have received a copy of the GNU Lesser General Public
+;* License along with FFmpeg; if not, write to the Free Software
+;* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+;******************************************************************************
+
+%include "libavutil/x86/x86util.asm"
+
+SECTION .text
+
+INIT_XMM sse4
+cglobal image_copy_plane_uc_from, 6, 7, 4, dst, dst_linesize, src, src_linesize, bw, height, rowpos
+ add dstq, bwq
+ add srcq, bwq
+ neg bwq
+
+.row_start:
+ mov rowposq, bwq
+
+.loop:
+ movntdqa m0, [srcq + rowposq + 0 * mmsize]
+ movntdqa m1, [srcq + rowposq + 1 * mmsize]
+ movntdqa m2, [srcq + rowposq + 2 * mmsize]
+ movntdqa m3, [srcq + rowposq + 3 * mmsize]
+
+ mova [dstq + rowposq + 0 * mmsize], m0
+ mova [dstq + rowposq + 1 * mmsize], m1
+ mova [dstq + rowposq + 2 * mmsize], m2
+ mova [dstq + rowposq + 3 * mmsize], m3
+
+ add rowposq, 4 * mmsize
+ jnz .loop
+
+ add srcq, src_linesizeq
+ add dstq, dst_linesizeq
+ dec heightd
+ jnz .row_start
+
+ RET
diff --git a/media/ffvpx/libavutil/x86/imgutils_init.c b/media/ffvpx/libavutil/x86/imgutils_init.c
new file mode 100644
index 0000000000..4ea398205e
--- /dev/null
+++ b/media/ffvpx/libavutil/x86/imgutils_init.c
@@ -0,0 +1,49 @@
+/*
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include "libavutil/cpu.h"
+#include "libavutil/error.h"
+#include "libavutil/imgutils.h"
+#include "libavutil/imgutils_internal.h"
+#include "libavutil/internal.h"
+
+#include "cpu.h"
+
+void ff_image_copy_plane_uc_from_sse4(uint8_t *dst, ptrdiff_t dst_linesize,
+ const uint8_t *src, ptrdiff_t src_linesize,
+ ptrdiff_t bytewidth, int height);
+
+int ff_image_copy_plane_uc_from_x86(uint8_t *dst, ptrdiff_t dst_linesize,
+ const uint8_t *src, ptrdiff_t src_linesize,
+ ptrdiff_t bytewidth, int height)
+{
+ int cpu_flags = av_get_cpu_flags();
+ ptrdiff_t bw_aligned = FFALIGN(bytewidth, 64);
+
+ if (EXTERNAL_SSE4(cpu_flags) &&
+ bw_aligned <= dst_linesize && bw_aligned <= src_linesize)
+ ff_image_copy_plane_uc_from_sse4(dst, dst_linesize, src, src_linesize,
+ bw_aligned, height);
+ else
+ return AVERROR(ENOSYS);
+
+ return 0;
+}
diff --git a/media/ffvpx/libavutil/x86/moz.build b/media/ffvpx/libavutil/x86/moz.build
index 1d1a6ca677..b56ed75ead 100644
--- a/media/ffvpx/libavutil/x86/moz.build
+++ b/media/ffvpx/libavutil/x86/moz.build
@@ -12,6 +12,8 @@ SOURCES += [
'fixed_dsp_init.c',
'float_dsp.asm',
'float_dsp_init.c',
+ 'imgutils.asm',
+ 'imgutils_init.c',
'lls.asm',
'lls_init.c'
]
diff --git a/media/ffvpx/libavutil/x86/x86inc.asm b/media/ffvpx/libavutil/x86/x86inc.asm
index b2e9c60195..6a054a3e09 100644
--- a/media/ffvpx/libavutil/x86/x86inc.asm
+++ b/media/ffvpx/libavutil/x86/x86inc.asm
@@ -1,7 +1,7 @@
;*****************************************************************************
;* x86inc.asm: x264asm abstraction layer
;*****************************************************************************
-;* Copyright (C) 2005-2016 x264 project
+;* Copyright (C) 2005-2017 x264 project
;*
;* Authors: Loren Merritt <lorenm@u.washington.edu>
;* Anton Mitrofanov <BugMaster@narod.ru>
@@ -87,7 +87,9 @@
; keep supporting OS/2.
%macro SECTION_RODATA 0-1 16
%ifidn __OUTPUT_FORMAT__,aout
- section .text
+ SECTION .text
+ %elifidn __OUTPUT_FORMAT__,coff
+ SECTION .text
%else
SECTION .rodata align=%1
%endif
@@ -385,7 +387,14 @@ DECLARE_REG_TMP_SIZE 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14
%ifnum %1
%if %1 != 0 && required_stack_alignment > STACK_ALIGNMENT
%if %1 > 0
+ ; Reserve an additional register for storing the original stack pointer, but avoid using
+ ; eax/rax for this purpose since it can potentially get overwritten as a return value.
%assign regs_used (regs_used + 1)
+ %if ARCH_X86_64 && regs_used == 7
+ %assign regs_used 8
+ %elif ARCH_X86_64 == 0 && regs_used == 1
+ %assign regs_used 2
+ %endif
%endif
%if ARCH_X86_64 && regs_used < 5 + UNIX64 * 3
; Ensure that we don't clobber any registers containing arguments. For UNIX64 we also preserve r6 (rax)
@@ -419,10 +428,10 @@ DECLARE_REG 7, rdi, 64
DECLARE_REG 8, rsi, 72
DECLARE_REG 9, rbx, 80
DECLARE_REG 10, rbp, 88
-DECLARE_REG 11, R12, 96
-DECLARE_REG 12, R13, 104
-DECLARE_REG 13, R14, 112
-DECLARE_REG 14, R15, 120
+DECLARE_REG 11, R14, 96
+DECLARE_REG 12, R15, 104
+DECLARE_REG 13, R12, 112
+DECLARE_REG 14, R13, 120
%macro PROLOGUE 2-5+ 0 ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
%assign num_args %1
@@ -468,41 +477,42 @@ DECLARE_REG 14, R15, 120
WIN64_PUSH_XMM
%endmacro
-%macro WIN64_RESTORE_XMM_INTERNAL 1
+%macro WIN64_RESTORE_XMM_INTERNAL 0
%assign %%pad_size 0
%if xmm_regs_used > 8
%assign %%i xmm_regs_used
%rep xmm_regs_used-8
%assign %%i %%i-1
- movaps xmm %+ %%i, [%1 + (%%i-8)*16 + stack_size + 32]
+ movaps xmm %+ %%i, [rsp + (%%i-8)*16 + stack_size + 32]
%endrep
%endif
%if stack_size_padded > 0
%if stack_size > 0 && required_stack_alignment > STACK_ALIGNMENT
mov rsp, rstkm
%else
- add %1, stack_size_padded
+ add rsp, stack_size_padded
%assign %%pad_size stack_size_padded
%endif
%endif
%if xmm_regs_used > 7
- movaps xmm7, [%1 + stack_offset - %%pad_size + 24]
+ movaps xmm7, [rsp + stack_offset - %%pad_size + 24]
%endif
%if xmm_regs_used > 6
- movaps xmm6, [%1 + stack_offset - %%pad_size + 8]
+ movaps xmm6, [rsp + stack_offset - %%pad_size + 8]
%endif
%endmacro
-%macro WIN64_RESTORE_XMM 1
- WIN64_RESTORE_XMM_INTERNAL %1
+%macro WIN64_RESTORE_XMM 0
+ WIN64_RESTORE_XMM_INTERNAL
%assign stack_offset (stack_offset-stack_size_padded)
+ %assign stack_size_padded 0
%assign xmm_regs_used 0
%endmacro
%define has_epilogue regs_used > 7 || xmm_regs_used > 6 || mmsize == 32 || stack_size > 0
%macro RET 0
- WIN64_RESTORE_XMM_INTERNAL rsp
+ WIN64_RESTORE_XMM_INTERNAL
POP_IF_USED 14, 13, 12, 11, 10, 9, 8, 7
%if mmsize == 32
vzeroupper
@@ -523,10 +533,10 @@ DECLARE_REG 7, R10, 16
DECLARE_REG 8, R11, 24
DECLARE_REG 9, rbx, 32
DECLARE_REG 10, rbp, 40
-DECLARE_REG 11, R12, 48
-DECLARE_REG 12, R13, 56
-DECLARE_REG 13, R14, 64
-DECLARE_REG 14, R15, 72
+DECLARE_REG 11, R14, 48
+DECLARE_REG 12, R15, 56
+DECLARE_REG 13, R12, 64
+DECLARE_REG 14, R13, 72
%macro PROLOGUE 2-5+ ; #args, #regs, #xmm_regs, [stack_size,] arg_names...
%assign num_args %1
@@ -618,7 +628,7 @@ DECLARE_ARG 7, 8, 9, 10, 11, 12, 13, 14
%if WIN64 == 0
%macro WIN64_SPILL_XMM 1
%endmacro
- %macro WIN64_RESTORE_XMM 1
+ %macro WIN64_RESTORE_XMM 0
%endmacro
%macro WIN64_PUSH_XMM 0
%endmacro
@@ -629,7 +639,7 @@ DECLARE_ARG 7, 8, 9, 10, 11, 12, 13, 14
; We can automatically detect "follows a branch", but not a branch target.
; (SSSE3 is a sufficient condition to know that your cpu doesn't have this problem.)
%macro REP_RET 0
- %if has_epilogue
+ %if has_epilogue || cpuflag(ssse3)
RET
%else
rep ret
@@ -780,25 +790,25 @@ BRANCH_INSTR jz, je, jnz, jne, jl, jle, jnl, jnle, jg, jge, jng, jnge, ja, jae,
%assign cpuflags_sse (1<<4) | cpuflags_mmx2
%assign cpuflags_sse2 (1<<5) | cpuflags_sse
%assign cpuflags_sse2slow (1<<6) | cpuflags_sse2
-%assign cpuflags_sse3 (1<<7) | cpuflags_sse2
-%assign cpuflags_ssse3 (1<<8) | cpuflags_sse3
-%assign cpuflags_sse4 (1<<9) | cpuflags_ssse3
-%assign cpuflags_sse42 (1<<10)| cpuflags_sse4
-%assign cpuflags_avx (1<<11)| cpuflags_sse42
-%assign cpuflags_xop (1<<12)| cpuflags_avx
-%assign cpuflags_fma4 (1<<13)| cpuflags_avx
-%assign cpuflags_fma3 (1<<14)| cpuflags_avx
-%assign cpuflags_avx2 (1<<15)| cpuflags_fma3
-
-%assign cpuflags_cache32 (1<<16)
-%assign cpuflags_cache64 (1<<17)
-%assign cpuflags_slowctz (1<<18)
-%assign cpuflags_lzcnt (1<<19)
-%assign cpuflags_aligned (1<<20) ; not a cpu feature, but a function variant
-%assign cpuflags_atom (1<<21)
-%assign cpuflags_bmi1 (1<<22)|cpuflags_lzcnt
-%assign cpuflags_bmi2 (1<<23)|cpuflags_bmi1
-%assign cpuflags_aesni (1<<24)|cpuflags_sse42
+%assign cpuflags_lzcnt (1<<7) | cpuflags_sse2
+%assign cpuflags_sse3 (1<<8) | cpuflags_sse2
+%assign cpuflags_ssse3 (1<<9) | cpuflags_sse3
+%assign cpuflags_sse4 (1<<10)| cpuflags_ssse3
+%assign cpuflags_sse42 (1<<11)| cpuflags_sse4
+%assign cpuflags_aesni (1<<12)| cpuflags_sse42
+%assign cpuflags_avx (1<<13)| cpuflags_sse42
+%assign cpuflags_xop (1<<14)| cpuflags_avx
+%assign cpuflags_fma4 (1<<15)| cpuflags_avx
+%assign cpuflags_fma3 (1<<16)| cpuflags_avx
+%assign cpuflags_bmi1 (1<<17)| cpuflags_avx|cpuflags_lzcnt
+%assign cpuflags_bmi2 (1<<18)| cpuflags_bmi1
+%assign cpuflags_avx2 (1<<19)| cpuflags_fma3|cpuflags_bmi2
+
+%assign cpuflags_cache32 (1<<20)
+%assign cpuflags_cache64 (1<<21)
+%assign cpuflags_slowctz (1<<22)
+%assign cpuflags_aligned (1<<23) ; not a cpu feature, but a function variant
+%assign cpuflags_atom (1<<24)
; Returns a boolean value expressing whether or not the specified cpuflag is enabled.
%define cpuflag(x) (((((cpuflags & (cpuflags_ %+ x)) ^ (cpuflags_ %+ x)) - 1) >> 31) & 1)
@@ -1030,7 +1040,11 @@ INIT_XMM
; Append cpuflags to the callee's name iff the appended name is known and the plain name isn't
%macro call 1
- call_internal %1 %+ SUFFIX, %1
+ %ifid %1
+ call_internal %1 %+ SUFFIX, %1
+ %else
+ call %1
+ %endif
%endmacro
%macro call_internal 2
%xdefine %%i %2
diff --git a/media/ffvpx/libavutil/x86/x86util.asm b/media/ffvpx/libavutil/x86/x86util.asm
index 44ed750ae5..e1220dfc1a 100644
--- a/media/ffvpx/libavutil/x86/x86util.asm
+++ b/media/ffvpx/libavutil/x86/x86util.asm
@@ -29,6 +29,21 @@
%include "libavutil/x86/x86inc.asm"
+; expands to [base],...,[base+7*stride]
+%define PASS8ROWS(base, base3, stride, stride3) \
+ [base], [base + stride], [base + 2*stride], [base3], \
+ [base3 + stride], [base3 + 2*stride], [base3 + stride3], [base3 + stride*4]
+
+; Interleave low src0 with low src1 and store in src0,
+; interleave high src0 with high src1 and store in src1.
+; %1 - types
+; %2 - index of the register with src0
+; %3 - index of the register with src1
+; %4 - index of the register for intermediate results
+; example for %1 - wd: input: src0: x0 x1 x2 x3 z0 z1 z2 z3
+; src1: y0 y1 y2 y3 q0 q1 q2 q3
+; output: src0: x0 y0 x1 y1 x2 y2 x3 y3
+; src1: z0 q0 z1 q1 z2 q2 z3 q3
%macro SBUTTERFLY 4
%ifidn %1, dqqq
vperm2i128 m%4, m%2, m%3, q0301
@@ -56,6 +71,12 @@
SWAP %1, %3, %2
%endmacro
+%macro SBUTTERFLYPD 3
+ movlhps m%3, m%1, m%2
+ movhlps m%2, m%2, m%1
+ SWAP %1, %3
+%endmacro
+
%macro TRANSPOSE4x4B 5
SBUTTERFLY bw, %1, %2, %5
SBUTTERFLY bw, %3, %4, %5
@@ -102,12 +123,9 @@
%macro TRANSPOSE4x4PS 5
SBUTTERFLYPS %1, %2, %5
SBUTTERFLYPS %3, %4, %5
- movlhps m%5, m%1, m%3
- movhlps m%3, m%1
- SWAP %5, %1
- movlhps m%5, m%2, m%4
- movhlps m%4, m%2
- SWAP %5, %2, %3
+ SBUTTERFLYPD %1, %3, %5
+ SBUTTERFLYPD %2, %4, %5
+ SWAP %2, %3
%endmacro
%macro TRANSPOSE8x4D 9-11
@@ -260,6 +278,21 @@
SWAP %12, %15
%endmacro
+%macro TRANSPOSE_8X8B 8
+ %if mmsize == 8
+ %error "This macro does not support mmsize == 8"
+ %endif
+ punpcklbw m%1, m%2
+ punpcklbw m%3, m%4
+ punpcklbw m%5, m%6
+ punpcklbw m%7, m%8
+ TRANSPOSE4x4W %1, %3, %5, %7, %2
+ MOVHL m%2, m%1
+ MOVHL m%4, m%3
+ MOVHL m%6, m%5
+ MOVHL m%8, m%7
+%endmacro
+
; PABSW macro assumes %1 != %2, while ABS1/2 macros work in-place
%macro PABSW 2
%if cpuflag(ssse3)
@@ -799,12 +832,25 @@
pmaxsd %1, %2
%endmacro
-%macro VBROADCASTSS 2 ; dst xmm/ymm, src m32
-%if cpuflag(avx)
- vbroadcastss %1, %2
-%else ; sse
- movss %1, %2
- shufps %1, %1, 0
+%macro VBROADCASTSS 2 ; dst xmm/ymm, src m32/xmm
+%if cpuflag(avx2)
+ vbroadcastss %1, %2
+%elif cpuflag(avx)
+ %ifnum sizeof%2 ; avx1 register
+ shufps xmm%1, xmm%2, xmm%2, q0000
+ %if sizeof%1 >= 32 ; mmsize>=32
+ vinsertf128 %1, %1, xmm%1, 1
+ %endif
+ %else ; avx1 memory
+ vbroadcastss %1, %2
+ %endif
+%else
+ %ifnum sizeof%2 ; sse register
+ shufps %1, %2, %2, q0000
+ %else ; sse memory
+ movss %1, %2
+ shufps %1, %1, 0
+ %endif
%endif
%endmacro
@@ -819,6 +865,21 @@
%endif
%endmacro
+%macro VPBROADCASTD 2 ; dst xmm/ymm, src m32/xmm
+%if cpuflag(avx2)
+ vpbroadcastd %1, %2
+%elif cpuflag(avx) && sizeof%1 >= 32
+ %error vpbroadcastd not possible with ymm on avx1. try vbroadcastss
+%else
+ %ifnum sizeof%2 ; sse2 register
+ pshufd %1, %2, q0000
+ %else ; sse memory
+ movd %1, %2
+ pshufd %1, %1, 0
+ %endif
+%endif
+%endmacro
+
%macro SHUFFLE_MASK_W 8
%rep 8
%if %1>=0x80
@@ -871,3 +932,79 @@
psrlq %1, 8*(%2)
%endif
%endmacro
+
+%macro MOVHL 2 ; dst, src
+%ifidn %1, %2
+ punpckhqdq %1, %2
+%elif cpuflag(avx)
+ punpckhqdq %1, %2, %2
+%elif cpuflag(sse4)
+ pshufd %1, %2, q3232 ; pshufd is slow on some older CPUs, so only use it on more modern ones
+%else
+ movhlps %1, %2 ; may cause an int/float domain transition and has a dependency on dst
+%endif
+%endmacro
+
+; Horizontal Sum of Packed Single precision floats
+; The resulting sum is in all elements.
+%macro HSUMPS 2 ; dst/src, tmp
+%if cpuflag(avx)
+ %if sizeof%1>=32 ; avx
+ vperm2f128 %2, %1, %1, (0)*16+(1)
+ addps %1, %2
+ %endif
+ shufps %2, %1, %1, q1032
+ addps %1, %2
+ shufps %2, %1, %1, q0321
+ addps %1, %2
+%else ; this form is a bit faster than the short avx-like emulation.
+ movaps %2, %1
+ shufps %1, %1, q1032
+ addps %1, %2
+ movaps %2, %1
+ shufps %1, %1, q0321
+ addps %1, %2
+ ; all %1 members should be equal for as long as float a+b==b+a
+%endif
+%endmacro
+
+; Emulate blendvps if not available
+;
+; src_b is destroyed when using emulation with logical operands
+; SSE41 blendv instruction is hard coded to use xmm0 as mask
+%macro BLENDVPS 3 ; dst/src_a, src_b, mask
+%if cpuflag(avx)
+ blendvps %1, %1, %2, %3
+%elif cpuflag(sse4)
+ %ifnidn %3,xmm0
+ %error sse41 blendvps uses xmm0 as default 3d operand, you used %3
+ %endif
+ blendvps %1, %2, %3
+%else
+ xorps %2, %1
+ andps %2, %3
+ xorps %1, %2
+%endif
+%endmacro
+
+; Emulate pblendvb if not available
+;
+; src_b is destroyed when using emulation with logical operands
+; SSE41 blendv instruction is hard coded to use xmm0 as mask
+%macro PBLENDVB 3 ; dst/src_a, src_b, mask
+%if cpuflag(avx)
+ %if cpuflag(avx) && notcpuflag(avx2) && sizeof%1 >= 32
+ %error pblendb not possible with ymm on avx1, try blendvps.
+ %endif
+ pblendvb %1, %1, %2, %3
+%elif cpuflag(sse4)
+ %ifnidn %3,xmm0
+ %error sse41 pblendvd uses xmm0 as default 3d operand, you used %3
+ %endif
+ pblendvb %1, %2, %3
+%else
+ pxor %2, %1
+ pand %2, %3
+ pxor %1, %2
+%endif
+%endmacro
diff --git a/media/ffvpx/libavutil_visibility.h b/media/ffvpx/libavutil_visibility.h
index a5cce0844a..706aacdf32 100644
--- a/media/ffvpx/libavutil_visibility.h
+++ b/media/ffvpx/libavutil_visibility.h
@@ -9,6 +9,15 @@
#ifndef MOZILLA_AVUTIL_VISIBILITY_H
#define MOZILLA_AVUTIL_VISIBILITY_H
+// We need to preemptively include <stdlib.h> before anyone[1] has a chance
+// to include <limits.h>. We do this to avoid a Linux clang build error, in
+// -ffreestanding mode, which happens when limits.h defines MB_LEN_MAX to some
+// value that is different from what stdlib.h expects. If we include stdlib.h
+// before limits.h, then they don't get a chance to interact badly.
+//
+// [1] (e.g. libavutil/common.h, which is indirectly included by log.h below.)
+#include <stdlib.h>
+
#pragma GCC visibility push(default)
#include "libavutil/cpu.h"
diff --git a/media/libtremor/lib/tremor_codebook.c b/media/libtremor/lib/tremor_codebook.c
index f8b7983841..1e1ae8a916 100644
--- a/media/libtremor/lib/tremor_codebook.c
+++ b/media/libtremor/lib/tremor_codebook.c
@@ -258,7 +258,7 @@ long vorbis_book_decodevs_add(codebook *book,ogg_int32_t *a,
t[i] = book->valuelist+entry[i]*book->dim;
}
for(i=0,o=0;i<book->dim;i++,o+=step)
- for (j=0;j<step;j++)
+ for (j=0;o+j<n && j<step;j++)
a[o+j]+=t[j][i]>>shift;
}else{
for (i = 0; i < step; i++) {
@@ -267,7 +267,7 @@ long vorbis_book_decodevs_add(codebook *book,ogg_int32_t *a,
t[i] = book->valuelist+entry[i]*book->dim;
}
for(i=0,o=0;i<book->dim;i++,o+=step)
- for (j=0;j<step;j++)
+ for (j=0;o+j<n && j<step;j++)
a[o+j]+=t[j][i]<<-shift;
}
}
@@ -287,7 +287,7 @@ long vorbis_book_decodev_add(codebook *book,ogg_int32_t *a,
entry = decode_packed_entry_number(book,b);
if(entry==-1)return(-1);
t = book->valuelist+entry*book->dim;
- for (j=0;j<book->dim;)
+ for (j=0;i<n && j<book->dim;)
a[i++]+=t[j++]>>shift;
}
}else{
@@ -295,7 +295,7 @@ long vorbis_book_decodev_add(codebook *book,ogg_int32_t *a,
entry = decode_packed_entry_number(book,b);
if(entry==-1)return(-1);
t = book->valuelist+entry*book->dim;
- for (j=0;j<book->dim;)
+ for (j=0;i<n && j<book->dim;)
a[i++]+=t[j++]<<-shift;
}
}
@@ -352,15 +352,15 @@ long vorbis_book_decodevv_add(codebook *book,ogg_int32_t **a,\
long i,j,entry;
int chptr=0;
int shift=point-book->binarypoint;
-
+ int m=offset+n;
if(shift>=0){
- for(i=offset;i<offset+n;){
+ for(i=offset;i<m;){
entry = decode_packed_entry_number(book,b);
if(entry==-1)return(-1);
{
const ogg_int32_t *t = book->valuelist+entry*book->dim;
- for (j=0;j<book->dim;j++){
+ for (j=0;i<m && j<book->dim;j++){
a[chptr++][i]+=t[j]>>shift;
if(chptr==ch){
chptr=0;
@@ -371,12 +371,12 @@ long vorbis_book_decodevv_add(codebook *book,ogg_int32_t **a,\
}
}else{
- for(i=offset;i<offset+n;){
+ for(i=offset;i<m;){
entry = decode_packed_entry_number(book,b);
if(entry==-1)return(-1);
{
const ogg_int32_t *t = book->valuelist+entry*book->dim;
- for (j=0;j<book->dim;j++){
+ for (j=0;i<m && j<book->dim;j++){
a[chptr++][i]+=t[j]<<-shift;
if(chptr==ch){
chptr=0;
diff --git a/media/libvorbis/lib/vorbis_codebook.c b/media/libvorbis/lib/vorbis_codebook.c
index 72f8a17a35..49b7b09b27 100644
--- a/media/libvorbis/lib/vorbis_codebook.c
+++ b/media/libvorbis/lib/vorbis_codebook.c
@@ -387,7 +387,7 @@ long vorbis_book_decodevs_add(codebook *book,float *a,oggpack_buffer *b,int n){
t[i] = book->valuelist+entry[i]*book->dim;
}
for(i=0,o=0;i<book->dim;i++,o+=step)
- for (j=0;j<step;j++)
+ for (j=0;o+j<n && j<step;j++)
a[o+j]+=t[j][i];
}
return(0);
@@ -399,41 +399,12 @@ long vorbis_book_decodev_add(codebook *book,float *a,oggpack_buffer *b,int n){
int i,j,entry;
float *t;
- if(book->dim>8){
- for(i=0;i<n;){
- entry = decode_packed_entry_number(book,b);
- if(entry==-1)return(-1);
- t = book->valuelist+entry*book->dim;
- for (j=0;j<book->dim;)
- a[i++]+=t[j++];
- }
- }else{
- for(i=0;i<n;){
- entry = decode_packed_entry_number(book,b);
- if(entry==-1)return(-1);
- t = book->valuelist+entry*book->dim;
- j=0;
- switch((int)book->dim){
- case 8:
- a[i++]+=t[j++];
- case 7:
- a[i++]+=t[j++];
- case 6:
- a[i++]+=t[j++];
- case 5:
- a[i++]+=t[j++];
- case 4:
- a[i++]+=t[j++];
- case 3:
- a[i++]+=t[j++];
- case 2:
- a[i++]+=t[j++];
- case 1:
- a[i++]+=t[j++];
- case 0:
- break;
- }
- }
+ for(i=0;i<n;){
+ entry = decode_packed_entry_number(book,b);
+ if(entry==-1)return(-1);
+ t = book->valuelist+entry*book->dim;
+ for(j=0;i<n && j<book->dim;)
+ a[i++]+=t[j++];
}
}
return(0);
@@ -471,12 +442,13 @@ long vorbis_book_decodevv_add(codebook *book,float **a,long offset,int ch,
long i,j,entry;
int chptr=0;
if(book->used_entries>0){
- for(i=offset/ch;i<(offset+n)/ch;){
+ int m=(offset+n)/ch;
+ for(i=offset/ch;i<m;){
entry = decode_packed_entry_number(book,b);
if(entry==-1)return(-1);
{
const float *t = book->valuelist+entry*book->dim;
- for (j=0;j<book->dim;j++){
+ for (j=0;i<m && j<book->dim;j++){
a[chptr++][i]+=t[j];
if(chptr==ch){
chptr=0;
diff --git a/media/libvpx/vp9/encoder/x86/vp9_quantize_ssse3_x86_64.asm b/media/libvpx/vp9/encoder/x86/vp9_quantize_ssse3_x86_64.asm
index 449d52b22e..3ad4b00dca 100644
--- a/media/libvpx/vp9/encoder/x86/vp9_quantize_ssse3_x86_64.asm
+++ b/media/libvpx/vp9/encoder/x86/vp9_quantize_ssse3_x86_64.asm
@@ -369,7 +369,7 @@ cglobal quantize_%1, 0, %2, 15, coeff, ncoeff, skip, zbin, round, quant, \
pshuflw m7, m8, 0x1
pmaxsw m8, m7
pextrw r6, m8, 0
- mov [r2], r6
+ mov [r2], r6w
RET
; skip-block, i.e. just write all zeroes
diff --git a/media/libvpx/vpx/src/vpx_encoder.c b/media/libvpx/vpx/src/vpx_encoder.c
index cd10c411ce..88b1da4819 100644
--- a/media/libvpx/vpx/src/vpx_encoder.c
+++ b/media/libvpx/vpx/src/vpx_encoder.c
@@ -13,8 +13,11 @@
* \brief Provides the high level interface to wrap encoder algorithms.
*
*/
+#include <assert.h>
#include <limits.h>
+#include <stdlib.h>
#include <string.h>
+#include "vp8/common/blockd.h"
#include "vpx_config.h"
#include "vpx/internal/vpx_codec_internal.h"
@@ -89,6 +92,8 @@ vpx_codec_err_t vpx_codec_enc_init_multi_ver(vpx_codec_ctx_t *ctx,
int i;
void *mem_loc = NULL;
+ if (iface->enc.mr_get_mem_loc == NULL) return VPX_CODEC_INCAPABLE;
+
if (!(res = iface->enc.mr_get_mem_loc(cfg, &mem_loc))) {
for (i = 0; i < num_enc; i++) {
vpx_codec_priv_enc_mr_cfg_t mr_cfg;
@@ -98,28 +103,29 @@ vpx_codec_err_t vpx_codec_enc_init_multi_ver(vpx_codec_ctx_t *ctx,
dsf->den > dsf->num) {
res = VPX_CODEC_INVALID_PARAM;
break;
+ } else {
+
+ mr_cfg.mr_low_res_mode_info = mem_loc;
+ mr_cfg.mr_total_resolutions = num_enc;
+ mr_cfg.mr_encoder_id = num_enc - 1 - i;
+ mr_cfg.mr_down_sampling_factor.num = dsf->num;
+ mr_cfg.mr_down_sampling_factor.den = dsf->den;
+
+ /* Force Key-frame synchronization. Namely, encoder at higher
+ * resolution always use the same frame_type chosen by the
+ * lowest-resolution encoder.
+ */
+ if (mr_cfg.mr_encoder_id)
+ cfg->kf_mode = VPX_KF_DISABLED;
+
+ ctx->iface = iface;
+ ctx->name = iface->name;
+ ctx->priv = NULL;
+ ctx->init_flags = flags;
+ ctx->config.enc = cfg;
+ res = ctx->iface->init(ctx, &mr_cfg);
}
- mr_cfg.mr_low_res_mode_info = mem_loc;
- mr_cfg.mr_total_resolutions = num_enc;
- mr_cfg.mr_encoder_id = num_enc - 1 - i;
- mr_cfg.mr_down_sampling_factor.num = dsf->num;
- mr_cfg.mr_down_sampling_factor.den = dsf->den;
-
- /* Force Key-frame synchronization. Namely, encoder at higher
- * resolution always use the same frame_type chosen by the
- * lowest-resolution encoder.
- */
- if (mr_cfg.mr_encoder_id)
- cfg->kf_mode = VPX_KF_DISABLED;
-
- ctx->iface = iface;
- ctx->name = iface->name;
- ctx->priv = NULL;
- ctx->init_flags = flags;
- ctx->config.enc = cfg;
- res = ctx->iface->init(ctx, &mr_cfg);
-
if (res) {
const char *error_detail =
ctx->priv ? ctx->priv->err_detail : NULL;
@@ -134,11 +140,14 @@ vpx_codec_err_t vpx_codec_enc_init_multi_ver(vpx_codec_ctx_t *ctx,
vpx_codec_destroy(ctx);
i--;
}
+#if CONFIG_MULTI_RES_ENCODING
+ assert(mem_loc);
+ free(((LOWER_RES_FRAME_INFO *)mem_loc)->mb_info);
+ free(mem_loc);
+#endif
+ return SAVE_STATUS(ctx, res);
}
- if (res)
- break;
-
ctx++;
cfg++;
dsf++;
diff --git a/media/webrtc/signaling/src/jsep/JsepTrack.cpp b/media/webrtc/signaling/src/jsep/JsepTrack.cpp
index 1b045d8ec7..cf5df96bf0 100644
--- a/media/webrtc/signaling/src/jsep/JsepTrack.cpp
+++ b/media/webrtc/signaling/src/jsep/JsepTrack.cpp
@@ -410,21 +410,26 @@ JsepTrack::NegotiateCodecs(
// TODO(bug 814227): Remove this once we're ready to put multiple codecs in an
// answer. For now, remove all but the first codec unless the red codec
- // exists, and then we include the others per RFC 5109, section 14.2.
- // Note: now allows keeping the telephone-event codec, if it appears, as the
- // last codec in the list.
+ // exists, in which case we include the others per RFC 5109, section 14.2.
if (!codecs->empty() && !red) {
- int newSize = dtmf ? 2 : 1;
- for (size_t i = 1; i < codecs->size(); ++i) {
- if (!dtmf || dtmf != (*codecs)[i]) {
- delete (*codecs)[i];
- (*codecs)[i] = nullptr;
+ std::vector<JsepCodecDescription*> codecsToKeep;
+
+ bool foundPreferredCodec = false;
+ for (auto codec: *codecs) {
+ if (codec == dtmf) {
+ codecsToKeep.push_back(codec);
+ // TODO: keep ulpfec when we enable it in Bug 875922
+ // } else if (codec == ulpfec) {
+ // codecsToKeep.push_back(codec);
+ } else if (!foundPreferredCodec) {
+ codecsToKeep.insert(codecsToKeep.begin(), codec);
+ foundPreferredCodec = true;
+ } else {
+ delete codec;
}
}
- if (dtmf) {
- (*codecs)[newSize-1] = dtmf;
- }
- codecs->resize(newSize);
+
+ *codecs = codecsToKeep;
}
}
diff --git a/memory/build/jemalloc_config.cpp b/memory/build/jemalloc_config.cpp
index 441fd8a2b9..0b734d804f 100644
--- a/memory/build/jemalloc_config.cpp
+++ b/memory/build/jemalloc_config.cpp
@@ -2,161 +2,7 @@
* 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/. */
-#ifdef MOZ_JEMALLOC4
-
-#define MOZ_JEMALLOC_IMPL
-
-/* mozmemory_wrap.h needs to be included before MFBT headers */
-#include "mozmemory_wrap.h"
-#include <mozilla/Assertions.h>
-#include "mozilla/Types.h"
-
-#if defined(MOZ_SYSTEM_JEMALLOC)
-#include MALLOC_H
-#else
-#define DLLEXPORT
-#include "jemalloc/jemalloc.h"
-#endif
-
-#ifdef XP_WIN
-#include <windows.h>
-#endif
-#ifdef XP_DARWIN
-#include <sys/mman.h>
-#endif
-
-/* Override some jemalloc defaults */
-#ifdef DEBUG
-#define MOZ_MALLOC_BUILD_OPTIONS ",junk:true"
-#else
-#define MOZ_MALLOC_BUILD_OPTIONS ",junk:free"
-#endif
-
-#define MOZ_MALLOC_OPTIONS "narenas:1,tcache:false"
-MFBT_DATA const char* je_(malloc_conf) =
- MOZ_MALLOC_OPTIONS MOZ_MALLOC_BUILD_OPTIONS;
-
-#ifdef ANDROID
-#include <android/log.h>
-
-static void
-_je_malloc_message(void* cbopaque, const char* s)
-{
- __android_log_print(ANDROID_LOG_INFO, "GeckoJemalloc", "%s", s);
-}
-
-void (*je_(malloc_message))(void*, const char* s) = _je_malloc_message;
-#endif
-
-/* Jemalloc supports hooks that are called on chunk
- * allocate/deallocate/commit/decommit/purge/etc.
- *
- * We currently only hook commit, decommit and purge. We do this to tweak
- * the way chunks are handled so that RSS stays lower than it normally
- * would with the default jemalloc uses.
- * This somewhat matches the behavior of mozjemalloc, except it doesn't
- * rely on a double purge on mac, instead purging directly. (Yes, this
- * means we can get rid of jemalloc_purge_freed_pages at some point)
- *
- * The default for jemalloc is to do the following:
- * - commit, decommit: nothing
- * - purge: MEM_RESET on Windows, MADV_FREE on Mac/BSD, MADV_DONTNEED on Linux
- *
- * The hooks we setup do the following:
- * on Windows:
- * - commit: MEM_COMMIT
- * - decommit: MEM_DECOMMIT
- * on Mac:
- * - purge: mmap new anonymous memory on top of the chunk
- *
- * We only set the above hooks, others are left with the default.
- */
-#if defined(XP_WIN) || defined(XP_DARWIN)
-class JemallocInit {
-public:
- JemallocInit()
- {
- chunk_hooks_t hooks;
- size_t hooks_len;
- unsigned narenas;
- size_t mib[3];
- size_t size;
-
- size = sizeof(narenas);
- je_(mallctl)("arenas.narenas", &narenas, &size, nullptr, 0);
-
- size = sizeof(mib) / sizeof(mib[0]);
- je_(mallctlnametomib)("arena.0.chunk_hooks", mib, &size);
-
- /* Set the hooks on all the existing arenas. */
- for (unsigned arena = 0; arena < narenas; arena++) {
- mib[1] = arena;
- hooks_len = sizeof(hooks);
- je_(mallctlbymib)(mib, size, &hooks, &hooks_len, nullptr, 0);
-
-#ifdef XP_WIN
- hooks.commit = CommitHook;
- hooks.decommit = DecommitHook;
-#endif
-#ifdef XP_DARWIN
- hooks.purge = PurgeHook;
-#endif
-
- je_(mallctlbymib)(mib, size, nullptr, nullptr, &hooks, hooks_len);
- }
- }
-
-private:
-#ifdef XP_WIN
- static bool
- CommitHook(void* chunk, size_t size, size_t offset, size_t length,
- unsigned arena_ind)
- {
- void* addr = reinterpret_cast<void*>(
- reinterpret_cast<uintptr_t>(chunk) + static_cast<uintptr_t>(offset));
-
- if (!VirtualAlloc(addr, length, MEM_COMMIT, PAGE_READWRITE))
- return true;
-
- return false;
- }
-
- static bool
- DecommitHook(void* chunk, size_t size, size_t offset, size_t length,
- unsigned arena_ind)
- {
- void* addr = reinterpret_cast<void*>(
- reinterpret_cast<uintptr_t>(chunk) + static_cast<uintptr_t>(offset));
-
- if (!VirtualFree(addr, length, MEM_DECOMMIT))
- MOZ_CRASH();
-
- return false;
- }
-#endif
-
-#ifdef XP_DARWIN
- static bool
- PurgeHook(void* chunk, size_t size, size_t offset, size_t length,
- unsigned arena_ind)
- {
- void* addr = reinterpret_cast<void*>(
- reinterpret_cast<uintptr_t>(chunk) + static_cast<uintptr_t>(offset));
-
- void* new_addr = mmap(addr, length, PROT_READ | PROT_WRITE,
- MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0);
- return (new_addr != addr);
- }
-#endif
-};
-
-/* For the static constructor from the class above */
-JemallocInit gJemallocInit;
-#endif
-
-#else
#include <mozilla/Assertions.h>
-#endif /* MOZ_JEMALLOC4 */
/* Provide an abort function for use in jemalloc code */
extern "C" void moz_abort() {
diff --git a/memory/build/moz.build b/memory/build/moz.build
index 8d80561b1d..f4fd828780 100644
--- a/memory/build/moz.build
+++ b/memory/build/moz.build
@@ -24,16 +24,6 @@ SOURCES += [
'mozmemory_wrap.c',
]
-if CONFIG['MOZ_JEMALLOC4']:
- SOURCES += [
- 'mozjemalloc_compat.c',
- ]
- LOCAL_INCLUDES += ['!../jemalloc/src/include']
- if CONFIG['_MSC_VER']:
- LOCAL_INCLUDES += ['/memory/jemalloc/src/include/msvc_compat']
- if not CONFIG['HAVE_INTTYPES_H']:
- LOCAL_INCLUDES += ['/memory/jemalloc/src/include/msvc_compat/C99']
-
if CONFIG['MOZ_REPLACE_MALLOC']:
SOURCES += [
'replace_malloc.c',
@@ -46,10 +36,6 @@ if CONFIG['MOZ_GLUE_IN_PROGRAM']:
DIST_INSTALL = True
# Keep jemalloc separated when mozglue is statically linked
-if CONFIG['MOZ_MEMORY'] and (CONFIG['OS_TARGET'] in ('WINNT', 'Darwin', 'Android') or
- CONFIG['MOZ_SYSTEM_JEMALLOC']):
+if CONFIG['MOZ_MEMORY'] and CONFIG['OS_TARGET'] in ('WINNT', 'Darwin', 'Android'):
FINAL_LIBRARY = 'mozglue'
-if CONFIG['MOZ_REPLACE_MALLOC'] and CONFIG['OS_TARGET'] == 'Darwin':
- # The zone allocator for OSX needs some jemalloc internal functions
- LOCAL_INCLUDES += ['/memory/jemalloc/src/include']
diff --git a/memory/build/mozjemalloc_compat.c b/memory/build/mozjemalloc_compat.c
deleted file mode 100644
index 6591892c13..0000000000
--- a/memory/build/mozjemalloc_compat.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef MOZ_JEMALLOC4
-# error Should only compile this file when building with jemalloc 3
-#endif
-
-#define MOZ_JEMALLOC_IMPL
-
-#include "mozmemory_wrap.h"
-#include "jemalloc_types.h"
-#include "mozilla/Types.h"
-
-#include <stdbool.h>
-
-#if defined(MOZ_SYSTEM_JEMALLOC)
-# include MALLOC_H
-#else
-# include "jemalloc/jemalloc.h"
-#endif
-
-/*
- * CTL_* macros are from memory/jemalloc/src/src/stats.c with changes:
- * - drop `t' argument to avoid redundancy in calculating type size
- * - require `i' argument for arena number explicitly
- */
-
-#define CTL_GET(n, v) do { \
- size_t sz = sizeof(v); \
- je_(mallctl)(n, &v, &sz, NULL, 0); \
-} while (0)
-
-#define CTL_I_GET(n, v, i) do { \
- size_t mib[6]; \
- size_t miblen = sizeof(mib) / sizeof(mib[0]); \
- size_t sz = sizeof(v); \
- je_(mallctlnametomib)(n, mib, &miblen); \
- mib[2] = i; \
- je_(mallctlbymib)(mib, miblen, &v, &sz, NULL, 0); \
-} while (0)
-
-#define CTL_IJ_GET(n, v, i, j) do { \
- size_t mib[6]; \
- size_t miblen = sizeof(mib) / sizeof(mib[0]); \
- size_t sz = sizeof(v); \
- je_(mallctlnametomib)(n, mib, &miblen); \
- mib[2] = i; \
- mib[4] = j; \
- je_(mallctlbymib)(mib, miblen, &v, &sz, NULL, 0); \
-} while (0)
-
-/*
- * VARIABLE_ARRAY is copied from
- * memory/jemalloc/src/include/jemalloc/internal/jemalloc_internal.h.in
- */
-#if __STDC_VERSION__ < 199901L
-# ifdef _MSC_VER
-# include <malloc.h>
-# define alloca _alloca
-# else
-# ifdef HAVE_ALLOCA_H
-# include <alloca.h>
-# else
-# include <stdlib.h>
-# endif
-# endif
-# define VARIABLE_ARRAY(type, name, count) \
- type *name = alloca(sizeof(type) * (count))
-#else
-# define VARIABLE_ARRAY(type, name, count) type name[(count)]
-#endif
-
-MOZ_MEMORY_API size_t
-malloc_good_size_impl(size_t size)
-{
- /* je_nallocx crashes when given a size of 0. As
- * malloc_usable_size(malloc(0)) and malloc_usable_size(malloc(1))
- * return the same value, use a size of 1. */
- if (size == 0)
- size = 1;
- return je_(nallocx)(size, 0);
-}
-
-static void
-compute_bin_unused_and_bookkeeping(jemalloc_stats_t *stats, unsigned int narenas)
-{
- size_t bin_unused = 0;
-
- uint32_t nregs; // number of regions per run in the j-th bin
- size_t reg_size; // size of regions served by the j-th bin
- size_t curruns; // number of runs belonging to a bin
- size_t curregs; // number of allocated regions in a bin
-
- unsigned int nbins; // number of bins per arena
- unsigned int i, j;
-
- size_t stats_metadata;
- size_t stats_ametadata = 0; // total internal allocations in all arenas
-
- // narenas also counts uninitialized arenas, and initialized arenas
- // are not guaranteed to be adjacent
- VARIABLE_ARRAY(bool, initialized, narenas);
- size_t isz = sizeof(initialized) / sizeof(initialized[0]);
-
- je_(mallctl)("arenas.initialized", initialized, &isz, NULL, 0);
- CTL_GET("arenas.nbins", nbins);
-
- for (j = 0; j < nbins; j++) {
- CTL_I_GET("arenas.bin.0.nregs", nregs, j);
- CTL_I_GET("arenas.bin.0.size", reg_size, j);
-
- for (i = 0; i < narenas; i++) {
- if (!initialized[i]) {
- continue;
- }
-
- CTL_IJ_GET("stats.arenas.0.bins.0.curruns", curruns, i, j);
- CTL_IJ_GET("stats.arenas.0.bins.0.curregs", curregs, i, j);
-
- bin_unused += (nregs * curruns - curregs) * reg_size;
- }
- }
-
- CTL_GET("stats.metadata", stats_metadata);
-
- /* get the summation for all arenas, i == narenas */
- CTL_I_GET("stats.arenas.0.metadata.allocated", stats_ametadata, narenas);
-
- stats->bookkeeping = stats_metadata - stats_ametadata;
- stats->bin_unused = bin_unused;
-}
-
-MOZ_JEMALLOC_API void
-jemalloc_stats_impl(jemalloc_stats_t *stats)
-{
- unsigned narenas;
- size_t active, allocated, mapped, page, pdirty;
- size_t lg_chunk;
-
- // Refresh jemalloc's stats by updating its epoch, see ctl_refresh in
- // src/ctl.c
- uint64_t epoch = 0;
- size_t esz = sizeof(epoch);
- je_(mallctl)("epoch", &epoch, &esz, &epoch, esz);
-
- CTL_GET("arenas.narenas", narenas);
- CTL_GET("arenas.page", page);
- CTL_GET("stats.active", active);
- CTL_GET("stats.allocated", allocated);
- CTL_GET("stats.mapped", mapped);
- CTL_GET("opt.lg_chunk", lg_chunk);
-
- /* get the summation for all arenas, i == narenas */
- CTL_I_GET("stats.arenas.0.pdirty", pdirty, narenas);
-
- stats->chunksize = (size_t) 1 << lg_chunk;
- stats->mapped = mapped;
- stats->allocated = allocated;
- stats->waste = active - allocated;
- stats->page_cache = pdirty * page;
- compute_bin_unused_and_bookkeeping(stats, narenas);
- stats->waste -= stats->bin_unused;
-}
-
-MOZ_JEMALLOC_API void
-jemalloc_purge_freed_pages_impl()
-{
-}
-
-MOZ_JEMALLOC_API void
-jemalloc_free_dirty_pages_impl()
-{
- unsigned narenas;
- size_t mib[3];
- size_t miblen = sizeof(mib) / sizeof(mib[0]);
-
- CTL_GET("arenas.narenas", narenas);
- je_(mallctlnametomib)("arena.0.purge", mib, &miblen);
- mib[1] = narenas;
- je_(mallctlbymib)(mib, miblen, NULL, NULL, NULL, 0);
-}
diff --git a/memory/build/mozmemory_wrap.h b/memory/build/mozmemory_wrap.h
index 066d57782d..5d718e75ee 100644
--- a/memory/build/mozmemory_wrap.h
+++ b/memory/build/mozmemory_wrap.h
@@ -36,8 +36,7 @@
* - jemalloc_stats
* - jemalloc_purge_freed_pages
* - jemalloc_free_dirty_pages
- * (these functions are native to mozjemalloc, and have compatibility
- * implementations for jemalloc3)
+ * (these functions are native to mozjemalloc)
*
* These functions are all exported as part of libmozglue (see
* $(topsrcdir)/mozglue/build/Makefile.in), with a few implementation
@@ -87,21 +86,16 @@
* char* strdup_impl(const char *)
* That implementation would call malloc by using "malloc_impl".
*
- * While mozjemalloc uses these "_impl" suffixed helpers, jemalloc3, being
- * third-party code, doesn't, but instead has an elaborate way to mangle
- * individual functions. See under "Run jemalloc configure script" in
- * $(topsrcdir)/configure.in.
- *
*
* When building with replace-malloc support, the above still holds, but
* the malloc implementation and jemalloc specific functions are the
* replace-malloc functions from replace_malloc.c.
*
- * The actual jemalloc/mozjemalloc implementation is prefixed with "je_".
+ * The actual mozjemalloc implementation is prefixed with "je_".
*
* Thus, when MOZ_REPLACE_MALLOC is defined, the "_impl" suffixed macros
- * expand to "je_" prefixed function when building mozjemalloc or
- * jemalloc3/mozjemalloc_compat, where MOZ_JEMALLOC_IMPL is defined.
+ * expand to "je_" prefixed function when building mozjemalloc, where
+ * MOZ_JEMALLOC_IMPL is defined.
*
* In other cases, the "_impl" suffixed macros follow the original scheme,
* except on Windows and MacOSX, where they would expand to "je_" prefixed
@@ -125,43 +119,31 @@
#include "mozilla/Types.h"
-#if !defined(MOZ_SYSTEM_JEMALLOC)
-# ifdef MOZ_MEMORY_IMPL
-# if defined(MOZ_JEMALLOC_IMPL) && defined(MOZ_REPLACE_MALLOC) && !defined(MOZ_REPLACE_JEMALLOC)
-# define mozmem_malloc_impl(a) je_ ## a
-# define mozmem_jemalloc_impl(a) je_ ## a
-# else
-# define MOZ_JEMALLOC_API MFBT_API
-# ifdef MOZ_REPLACE_JEMALLOC
-# define MOZ_MEMORY_API MFBT_API
-# define mozmem_malloc_impl(a) replace_ ## a
-# define mozmem_jemalloc_impl(a) replace_ ## a
-# elif (defined(XP_WIN) || defined(XP_DARWIN))
-# if defined(MOZ_REPLACE_MALLOC)
-# define mozmem_malloc_impl(a) a ## _impl
-# else
-# define mozmem_malloc_impl(a) je_ ## a
-# endif
+#ifdef MOZ_MEMORY_IMPL
+# if defined(MOZ_JEMALLOC_IMPL) && defined(MOZ_REPLACE_MALLOC)
+# define mozmem_malloc_impl(a) je_ ## a
+# define mozmem_jemalloc_impl(a) je_ ## a
+# else
+# define MOZ_JEMALLOC_API MFBT_API
+# if (defined(XP_WIN) || defined(XP_DARWIN))
+# if defined(MOZ_REPLACE_MALLOC)
+# define mozmem_malloc_impl(a) a ## _impl
# else
-# define MOZ_MEMORY_API MFBT_API
-# if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
-# define MOZ_WRAP_NEW_DELETE
-# endif
+# define mozmem_malloc_impl(a) je_ ## a
+# endif
+# else
+# define MOZ_MEMORY_API MFBT_API
+# if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK)
+# define MOZ_WRAP_NEW_DELETE
# endif
-# endif
-# ifdef XP_WIN
-# define mozmem_dup_impl(a) wrap_ ## a
# endif
# endif
-
-/* All other jemalloc3 functions are prefixed with "je_", except when
- * building against an unprefixed system jemalloc library */
-# define je_(a) je_ ## a
-#else /* defined(MOZ_SYSTEM_JEMALLOC) */
-# define je_(a) a
+# ifdef XP_WIN
+# define mozmem_dup_impl(a) wrap_ ## a
+# endif
#endif
-#if !defined(MOZ_MEMORY_IMPL) || defined(MOZ_SYSTEM_JEMALLOC)
+#if !defined(MOZ_MEMORY_IMPL)
# define MOZ_MEMORY_API MFBT_API
# define MOZ_JEMALLOC_API MFBT_API
#endif
diff --git a/memory/build/replace_malloc.c b/memory/build/replace_malloc.c
index 88dfde33c4..f4c7eb8788 100644
--- a/memory/build/replace_malloc.c
+++ b/memory/build/replace_malloc.c
@@ -10,10 +10,6 @@
# error Should not compile this file when replace-malloc is disabled
#endif
-#ifdef MOZ_SYSTEM_JEMALLOC
-# error Should not compile this file when we want to use native jemalloc
-#endif
-
#include "mozmemory_wrap.h"
/* Declare all je_* functions */
@@ -513,6 +509,12 @@ register_zone(void)
*/
malloc_zone_t *purgeable_zone = malloc_default_purgeable_zone();
+ // There is a problem related to the above with the system nano zone, which
+ // is hard to work around from here, and that is instead worked around by
+ // disabling the nano zone through an environment variable
+ // (MallocNanoZone=0). In Firefox, we do that through
+ // browser/app/macbuild/Contents/Info.plist.in.
+
/* Register the custom zone. At this point it won't be the default. */
malloc_zone_register(&zone);
diff --git a/memory/jemalloc/README.mozilla b/memory/jemalloc/README.mozilla
deleted file mode 100644
index 0bbbca4683..0000000000
--- a/memory/jemalloc/README.mozilla
+++ /dev/null
@@ -1,9 +0,0 @@
-This is a copy of the jemalloc source code. It is intended to be left pristine.
-Modifications to this code without coordinating with upstream are unacceptable,
-and will be reverted. Integration modifications should be made in memory/build
-whenever possible.
-
-The canonical repository for this source code is git://canonware.com/jemalloc.git.
-The information about the upstream repository and revision lives in upstream.info.
-In order to update the code, you can run the update.sh script located in
-the same directory.
diff --git a/memory/jemalloc/helper/git b/memory/jemalloc/helper/git
deleted file mode 100755
index 9afdb6778e..0000000000
--- a/memory/jemalloc/helper/git
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/sh
-
-# jemalloc's configure runs git to determine the version. But when building
-# from a gecko git clone, the git commands it uses is going to pick gecko's
-# information, not jemalloc's, which is useless. So pretend we don't have git
-# at all. That will make jemalloc's configure pick the in-tree VERSION file.
-
-exit 1
diff --git a/memory/jemalloc/moz.build b/memory/jemalloc/moz.build
deleted file mode 100644
index b7e2b661f9..0000000000
--- a/memory/jemalloc/moz.build
+++ /dev/null
@@ -1,81 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-UNIFIED_SOURCES += [
- 'src/src/arena.c',
- 'src/src/atomic.c',
- 'src/src/base.c',
- 'src/src/bitmap.c',
- 'src/src/chunk.c',
- 'src/src/chunk_dss.c',
- 'src/src/chunk_mmap.c',
- 'src/src/ckh.c',
- 'src/src/extent.c',
- 'src/src/hash.c',
- 'src/src/huge.c',
- 'src/src/jemalloc.c',
- 'src/src/mb.c',
- 'src/src/mutex.c',
- 'src/src/nstime.c',
- 'src/src/pages.c',
- 'src/src/prng.c',
- 'src/src/prof.c',
- 'src/src/quarantine.c',
- 'src/src/rtree.c',
- 'src/src/spin.c',
- 'src/src/stats.c',
- 'src/src/tcache.c',
- 'src/src/ticker.c',
- 'src/src/tsd.c',
- 'src/src/util.c',
- 'src/src/witness.c',
-]
-
-SOURCES += [
- # This file cannot be built in unified mode because of symbol clash on arena_purge.
- 'src/src/ctl.c',
-]
-
-# Only OSX needs the zone allocation implementation,
-# but only if replace-malloc is not enabled.
-if CONFIG['OS_TARGET'] == 'Darwin' and not CONFIG['MOZ_REPLACE_MALLOC']:
- UNIFIED_SOURCES += [
- 'src/src/zone.c',
- ]
-
-if CONFIG['MOZ_JEMALLOC4']:
- FINAL_LIBRARY = 'memory'
-else:
- FINAL_LIBRARY = 'replace_jemalloc'
-
-if CONFIG['MOZ_GLUE_IN_PROGRAM']:
- SDK_LIBRARY = True
- DIST_INSTALL = True
-
-if CONFIG['_MSC_VER']:
- DEFINES['DLLEXPORT'] = True
- LOCAL_INCLUDES += ['src/include/msvc_compat']
- if not CONFIG['HAVE_INTTYPES_H']:
- LOCAL_INCLUDES += ['src/include/msvc_compat/C99']
-
-if CONFIG['OS_TARGET'] == 'Linux':
- # For mremap
- DEFINES['_GNU_SOURCE'] = True
-
-if CONFIG['GNU_CC']:
- CFLAGS += ['-std=gnu99']
-
-DEFINES['abort'] = 'moz_abort'
-
-LOCAL_INCLUDES += [
- '!src/include',
- 'src/include',
-]
-
-# We allow warnings for third-party code that can be updated from upstream.
-ALLOW_COMPILER_WARNINGS = True
-
-OS_LIBS += CONFIG['REALTIME_LIBS']
diff --git a/memory/jemalloc/src/.appveyor.yml b/memory/jemalloc/src/.appveyor.yml
deleted file mode 100644
index ddd5c57117..0000000000
--- a/memory/jemalloc/src/.appveyor.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-version: '{build}'
-
-environment:
- matrix:
- - MSYSTEM: MINGW64
- CPU: x86_64
- MSVC: amd64
- - MSYSTEM: MINGW32
- CPU: i686
- MSVC: x86
- - MSYSTEM: MINGW64
- CPU: x86_64
- - MSYSTEM: MINGW32
- CPU: i686
-
-install:
- - set PATH=c:\msys64\%MSYSTEM%\bin;c:\msys64\usr\bin;%PATH%
- - if defined MSVC call "c:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %MSVC%
- - if defined MSVC pacman --noconfirm -Rsc mingw-w64-%CPU%-gcc gcc
- - pacman --noconfirm -Suy mingw-w64-%CPU%-make
-
-build_script:
- - bash -c "autoconf"
- - bash -c "./configure"
- - mingw32-make -j3
- - file lib/jemalloc.dll
- - mingw32-make -j3 tests
- - mingw32-make -k check
diff --git a/memory/jemalloc/src/.travis.yml b/memory/jemalloc/src/.travis.yml
deleted file mode 100644
index 1fed4f8e6d..0000000000
--- a/memory/jemalloc/src/.travis.yml
+++ /dev/null
@@ -1,29 +0,0 @@
-language: c
-
-matrix:
- include:
- - os: linux
- compiler: gcc
- - os: linux
- compiler: gcc
- env:
- - EXTRA_FLAGS=-m32
- addons:
- apt:
- packages:
- - gcc-multilib
- - os: osx
- compiler: clang
- - os: osx
- compiler: clang
- env:
- - EXTRA_FLAGS=-m32
-
-before_script:
- - autoconf
- - ./configure${EXTRA_FLAGS:+ CC="$CC $EXTRA_FLAGS"}
- - make -j3
- - make -j3 tests
-
-script:
- - make check
diff --git a/memory/jemalloc/src/COPYING b/memory/jemalloc/src/COPYING
deleted file mode 100644
index 104b1f8b01..0000000000
--- a/memory/jemalloc/src/COPYING
+++ /dev/null
@@ -1,27 +0,0 @@
-Unless otherwise specified, files in the jemalloc source distribution are
-subject to the following license:
---------------------------------------------------------------------------------
-Copyright (C) 2002-2016 Jason Evans <jasone@canonware.com>.
-All rights reserved.
-Copyright (C) 2007-2012 Mozilla Foundation. All rights reserved.
-Copyright (C) 2009-2016 Facebook, Inc. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-1. Redistributions of source code must retain the above copyright notice(s),
- this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright notice(s),
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY EXPRESS
-OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
-EVENT SHALL THE COPYRIGHT HOLDER(S) BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
---------------------------------------------------------------------------------
diff --git a/memory/jemalloc/src/ChangeLog b/memory/jemalloc/src/ChangeLog
deleted file mode 100644
index 587685d029..0000000000
--- a/memory/jemalloc/src/ChangeLog
+++ /dev/null
@@ -1,981 +0,0 @@
-Following are change highlights associated with official releases. Important
-bug fixes are all mentioned, but some internal enhancements are omitted here for
-brevity. Much more detail can be found in the git revision history:
-
- https://github.com/jemalloc/jemalloc
-
-* 4.3.1 (November 7, 2016)
-
- Bug fixes:
- - Fix a severe virtual memory leak. This regression was first released in
- 4.3.0. (@interwq, @jasone)
- - Refactor atomic and prng APIs to restore support for 32-bit platforms that
- use pre-C11 toolchains, e.g. FreeBSD's mips. (@jasone)
-
-* 4.3.0 (November 4, 2016)
-
- This is the first release that passes the test suite for multiple Windows
- configurations, thanks in large part to @glandium setting up continuous
- integration via AppVeyor (and Travis CI for Linux and OS X).
-
- New features:
- - Add "J" (JSON) support to malloc_stats_print(). (@jasone)
- - Add Cray compiler support. (@ronawho)
-
- Optimizations:
- - Add/use adaptive spinning for bootstrapping and radix tree node
- initialization. (@jasone)
-
- Bug fixes:
- - Fix large allocation to search starting in the optimal size class heap,
- which can substantially reduce virtual memory churn and fragmentation. This
- regression was first released in 4.0.0. (@mjp41, @jasone)
- - Fix stats.arenas.<i>.nthreads accounting. (@interwq)
- - Fix and simplify decay-based purging. (@jasone)
- - Make DSS (sbrk(2)-related) operations lockless, which resolves potential
- deadlocks during thread exit. (@jasone)
- - Fix over-sized allocation of radix tree leaf nodes. (@mjp41, @ogaun,
- @jasone)
- - Fix over-sized allocation of arena_t (plus associated stats) data
- structures. (@jasone, @interwq)
- - Fix EXTRA_CFLAGS to not affect configuration. (@jasone)
- - Fix a Valgrind integration bug. (@ronawho)
- - Disallow 0x5a junk filling when running in Valgrind. (@jasone)
- - Fix a file descriptor leak on Linux. This regression was first released in
- 4.2.0. (@vsarunas, @jasone)
- - Fix static linking of jemalloc with glibc. (@djwatson)
- - Use syscall(2) rather than {open,read,close}(2) during boot on Linux. This
- works around other libraries' system call wrappers performing reentrant
- allocation. (@kspinka, @Whissi, @jasone)
- - Fix OS X default zone replacement to work with OS X 10.12. (@glandium,
- @jasone)
- - Fix cached memory management to avoid needless commit/decommit operations
- during purging, which resolves permanent virtual memory map fragmentation
- issues on Windows. (@mjp41, @jasone)
- - Fix TSD fetches to avoid (recursive) allocation. This is relevant to
- non-TLS and Windows configurations. (@jasone)
- - Fix malloc_conf overriding to work on Windows. (@jasone)
- - Forcibly disable lazy-lock on Windows (was forcibly *enabled*). (@jasone)
-
-* 4.2.1 (June 8, 2016)
-
- Bug fixes:
- - Fix bootstrapping issues for configurations that require allocation during
- tsd initialization (e.g. --disable-tls). (@cferris1000, @jasone)
- - Fix gettimeofday() version of nstime_update(). (@ronawho)
- - Fix Valgrind regressions in calloc() and chunk_alloc_wrapper(). (@ronawho)
- - Fix potential VM map fragmentation regression. (@jasone)
- - Fix opt_zero-triggered in-place huge reallocation zeroing. (@jasone)
- - Fix heap profiling context leaks in reallocation edge cases. (@jasone)
-
-* 4.2.0 (May 12, 2016)
-
- New features:
- - Add the arena.<i>.reset mallctl, which makes it possible to discard all of
- an arena's allocations in a single operation. (@jasone)
- - Add the stats.retained and stats.arenas.<i>.retained statistics. (@jasone)
- - Add the --with-version configure option. (@jasone)
- - Support --with-lg-page values larger than actual page size. (@jasone)
-
- Optimizations:
- - Use pairing heaps rather than red-black trees for various hot data
- structures. (@djwatson, @jasone)
- - Streamline fast paths of rtree operations. (@jasone)
- - Optimize the fast paths of calloc() and [m,d,sd]allocx(). (@jasone)
- - Decommit unused virtual memory if the OS does not overcommit. (@jasone)
- - Specify MAP_NORESERVE on Linux if [heuristic] overcommit is active, in order
- to avoid unfortunate interactions during fork(2). (@jasone)
-
- Bug fixes:
- - Fix chunk accounting related to triggering gdump profiles. (@jasone)
- - Link against librt for clock_gettime(2) if glibc < 2.17. (@jasone)
- - Scale leak report summary according to sampling probability. (@jasone)
-
-* 4.1.1 (May 3, 2016)
-
- This bugfix release resolves a variety of mostly minor issues, though the
- bitmap fix is critical for 64-bit Windows.
-
- Bug fixes:
- - Fix the linear scan version of bitmap_sfu() to shift by the proper amount
- even when sizeof(long) is not the same as sizeof(void *), as on 64-bit
- Windows. (@jasone)
- - Fix hashing functions to avoid unaligned memory accesses (and resulting
- crashes). This is relevant at least to some ARM-based platforms.
- (@rkmisra)
- - Fix fork()-related lock rank ordering reversals. These reversals were
- unlikely to cause deadlocks in practice except when heap profiling was
- enabled and active. (@jasone)
- - Fix various chunk leaks in OOM code paths. (@jasone)
- - Fix malloc_stats_print() to print opt.narenas correctly. (@jasone)
- - Fix MSVC-specific build/test issues. (@rustyx, @yuslepukhin)
- - Fix a variety of test failures that were due to test fragility rather than
- core bugs. (@jasone)
-
-* 4.1.0 (February 28, 2016)
-
- This release is primarily about optimizations, but it also incorporates a lot
- of portability-motivated refactoring and enhancements. Many people worked on
- this release, to an extent that even with the omission here of minor changes
- (see git revision history), and of the people who reported and diagnosed
- issues, so much of the work was contributed that starting with this release,
- changes are annotated with author credits to help reflect the collaborative
- effort involved.
-
- New features:
- - Implement decay-based unused dirty page purging, a major optimization with
- mallctl API impact. This is an alternative to the existing ratio-based
- unused dirty page purging, and is intended to eventually become the sole
- purging mechanism. New mallctls:
- + opt.purge
- + opt.decay_time
- + arena.<i>.decay
- + arena.<i>.decay_time
- + arenas.decay_time
- + stats.arenas.<i>.decay_time
- (@jasone, @cevans87)
- - Add --with-malloc-conf, which makes it possible to embed a default
- options string during configuration. This was motivated by the desire to
- specify --with-malloc-conf=purge:decay , since the default must remain
- purge:ratio until the 5.0.0 release. (@jasone)
- - Add MS Visual Studio 2015 support. (@rustyx, @yuslepukhin)
- - Make *allocx() size class overflow behavior defined. The maximum
- size class is now less than PTRDIFF_MAX to protect applications against
- numerical overflow, and all allocation functions are guaranteed to indicate
- errors rather than potentially crashing if the request size exceeds the
- maximum size class. (@jasone)
- - jeprof:
- + Add raw heap profile support. (@jasone)
- + Add --retain and --exclude for backtrace symbol filtering. (@jasone)
-
- Optimizations:
- - Optimize the fast path to combine various bootstrapping and configuration
- checks and execute more streamlined code in the common case. (@interwq)
- - Use linear scan for small bitmaps (used for small object tracking). In
- addition to speeding up bitmap operations on 64-bit systems, this reduces
- allocator metadata overhead by approximately 0.2%. (@djwatson)
- - Separate arena_avail trees, which substantially speeds up run tree
- operations. (@djwatson)
- - Use memoization (boot-time-computed table) for run quantization. Separate
- arena_avail trees reduced the importance of this optimization. (@jasone)
- - Attempt mmap-based in-place huge reallocation. This can dramatically speed
- up incremental huge reallocation. (@jasone)
-
- Incompatible changes:
- - Make opt.narenas unsigned rather than size_t. (@jasone)
-
- Bug fixes:
- - Fix stats.cactive accounting regression. (@rustyx, @jasone)
- - Handle unaligned keys in hash(). This caused problems for some ARM systems.
- (@jasone, @cferris1000)
- - Refactor arenas array. In addition to fixing a fork-related deadlock, this
- makes arena lookups faster and simpler. (@jasone)
- - Move retained memory allocation out of the default chunk allocation
- function, to a location that gets executed even if the application installs
- a custom chunk allocation function. This resolves a virtual memory leak.
- (@buchgr)
- - Fix a potential tsd cleanup leak. (@cferris1000, @jasone)
- - Fix run quantization. In practice this bug had no impact unless
- applications requested memory with alignment exceeding one page.
- (@jasone, @djwatson)
- - Fix LinuxThreads-specific bootstrapping deadlock. (Cosmin Paraschiv)
- - jeprof:
- + Don't discard curl options if timeout is not defined. (@djwatson)
- + Detect failed profile fetches. (@djwatson)
- - Fix stats.arenas.<i>.{dss,lg_dirty_mult,decay_time,pactive,pdirty} for
- --disable-stats case. (@jasone)
-
-* 4.0.4 (October 24, 2015)
-
- This bugfix release fixes another xallocx() regression. No other regressions
- have come to light in over a month, so this is likely a good starting point
- for people who prefer to wait for "dot one" releases with all the major issues
- shaken out.
-
- Bug fixes:
- - Fix xallocx(..., MALLOCX_ZERO to zero the last full trailing page of large
- allocations that have been randomly assigned an offset of 0 when
- --enable-cache-oblivious configure option is enabled.
-
-* 4.0.3 (September 24, 2015)
-
- This bugfix release continues the trend of xallocx() and heap profiling fixes.
-
- Bug fixes:
- - Fix xallocx(..., MALLOCX_ZERO) to zero all trailing bytes of large
- allocations when --enable-cache-oblivious configure option is enabled.
- - Fix xallocx(..., MALLOCX_ZERO) to zero trailing bytes of huge allocations
- when resizing from/to a size class that is not a multiple of the chunk size.
- - Fix prof_tctx_dump_iter() to filter out nodes that were created after heap
- profile dumping started.
- - Work around a potentially bad thread-specific data initialization
- interaction with NPTL (glibc's pthreads implementation).
-
-* 4.0.2 (September 21, 2015)
-
- This bugfix release addresses a few bugs specific to heap profiling.
-
- Bug fixes:
- - Fix ixallocx_prof_sample() to never modify nor create sampled small
- allocations. xallocx() is in general incapable of moving small allocations,
- so this fix removes buggy code without loss of generality.
- - Fix irallocx_prof_sample() to always allocate large regions, even when
- alignment is non-zero.
- - Fix prof_alloc_rollback() to read tdata from thread-specific data rather
- than dereferencing a potentially invalid tctx.
-
-* 4.0.1 (September 15, 2015)
-
- This is a bugfix release that is somewhat high risk due to the amount of
- refactoring required to address deep xallocx() problems. As a side effect of
- these fixes, xallocx() now tries harder to partially fulfill requests for
- optional extra space. Note that a couple of minor heap profiling
- optimizations are included, but these are better thought of as performance
- fixes that were integral to disovering most of the other bugs.
-
- Optimizations:
- - Avoid a chunk metadata read in arena_prof_tctx_set(), since it is in the
- fast path when heap profiling is enabled. Additionally, split a special
- case out into arena_prof_tctx_reset(), which also avoids chunk metadata
- reads.
- - Optimize irallocx_prof() to optimistically update the sampler state. The
- prior implementation appears to have been a holdover from when
- rallocx()/xallocx() functionality was combined as rallocm().
-
- Bug fixes:
- - Fix TLS configuration such that it is enabled by default for platforms on
- which it works correctly.
- - Fix arenas_cache_cleanup() and arena_get_hard() to handle
- allocation/deallocation within the application's thread-specific data
- cleanup functions even after arenas_cache is torn down.
- - Fix xallocx() bugs related to size+extra exceeding HUGE_MAXCLASS.
- - Fix chunk purge hook calls for in-place huge shrinking reallocation to
- specify the old chunk size rather than the new chunk size. This bug caused
- no correctness issues for the default chunk purge function, but was
- visible to custom functions set via the "arena.<i>.chunk_hooks" mallctl.
- - Fix heap profiling bugs:
- + Fix heap profiling to distinguish among otherwise identical sample sites
- with interposed resets (triggered via the "prof.reset" mallctl). This bug
- could cause data structure corruption that would most likely result in a
- segfault.
- + Fix irealloc_prof() to prof_alloc_rollback() on OOM.
- + Make one call to prof_active_get_unlocked() per allocation event, and use
- the result throughout the relevant functions that handle an allocation
- event. Also add a missing check in prof_realloc(). These fixes protect
- allocation events against concurrent prof_active changes.
- + Fix ixallocx_prof() to pass usize_max and zero to ixallocx_prof_sample()
- in the correct order.
- + Fix prof_realloc() to call prof_free_sampled_object() after calling
- prof_malloc_sample_object(). Prior to this fix, if tctx and old_tctx were
- the same, the tctx could have been prematurely destroyed.
- - Fix portability bugs:
- + Don't bitshift by negative amounts when encoding/decoding run sizes in
- chunk header maps. This affected systems with page sizes greater than 8
- KiB.
- + Rename index_t to szind_t to avoid an existing type on Solaris.
- + Add JEMALLOC_CXX_THROW to the memalign() function prototype, in order to
- match glibc and avoid compilation errors when including both
- jemalloc/jemalloc.h and malloc.h in C++ code.
- + Don't assume that /bin/sh is appropriate when running size_classes.sh
- during configuration.
- + Consider __sparcv9 a synonym for __sparc64__ when defining LG_QUANTUM.
- + Link tests to librt if it contains clock_gettime(2).
-
-* 4.0.0 (August 17, 2015)
-
- This version contains many speed and space optimizations, both minor and
- major. The major themes are generalization, unification, and simplification.
- Although many of these optimizations cause no visible behavior change, their
- cumulative effect is substantial.
-
- New features:
- - Normalize size class spacing to be consistent across the complete size
- range. By default there are four size classes per size doubling, but this
- is now configurable via the --with-lg-size-class-group option. Also add the
- --with-lg-page, --with-lg-page-sizes, --with-lg-quantum, and
- --with-lg-tiny-min options, which can be used to tweak page and size class
- settings. Impacts:
- + Worst case performance for incrementally growing/shrinking reallocation
- is improved because there are far fewer size classes, and therefore
- copying happens less often.
- + Internal fragmentation is limited to 20% for all but the smallest size
- classes (those less than four times the quantum). (1B + 4 KiB)
- and (1B + 4 MiB) previously suffered nearly 50% internal fragmentation.
- + Chunk fragmentation tends to be lower because there are fewer distinct run
- sizes to pack.
- - Add support for explicit tcaches. The "tcache.create", "tcache.flush", and
- "tcache.destroy" mallctls control tcache lifetime and flushing, and the
- MALLOCX_TCACHE(tc) and MALLOCX_TCACHE_NONE flags to the *allocx() API
- control which tcache is used for each operation.
- - Implement per thread heap profiling, as well as the ability to
- enable/disable heap profiling on a per thread basis. Add the "prof.reset",
- "prof.lg_sample", "thread.prof.name", "thread.prof.active",
- "opt.prof_thread_active_init", "prof.thread_active_init", and
- "thread.prof.active" mallctls.
- - Add support for per arena application-specified chunk allocators, configured
- via the "arena.<i>.chunk_hooks" mallctl.
- - Refactor huge allocation to be managed by arenas, so that arenas now
- function as general purpose independent allocators. This is important in
- the context of user-specified chunk allocators, aside from the scalability
- benefits. Related new statistics:
- + The "stats.arenas.<i>.huge.allocated", "stats.arenas.<i>.huge.nmalloc",
- "stats.arenas.<i>.huge.ndalloc", and "stats.arenas.<i>.huge.nrequests"
- mallctls provide high level per arena huge allocation statistics.
- + The "arenas.nhchunks", "arenas.hchunk.<i>.size",
- "stats.arenas.<i>.hchunks.<j>.nmalloc",
- "stats.arenas.<i>.hchunks.<j>.ndalloc",
- "stats.arenas.<i>.hchunks.<j>.nrequests", and
- "stats.arenas.<i>.hchunks.<j>.curhchunks" mallctls provide per size class
- statistics.
- - Add the 'util' column to malloc_stats_print() output, which reports the
- proportion of available regions that are currently in use for each small
- size class.
- - Add "alloc" and "free" modes for for junk filling (see the "opt.junk"
- mallctl), so that it is possible to separately enable junk filling for
- allocation versus deallocation.
- - Add the jemalloc-config script, which provides information about how
- jemalloc was configured, and how to integrate it into application builds.
- - Add metadata statistics, which are accessible via the "stats.metadata",
- "stats.arenas.<i>.metadata.mapped", and
- "stats.arenas.<i>.metadata.allocated" mallctls.
- - Add the "stats.resident" mallctl, which reports the upper limit of
- physically resident memory mapped by the allocator.
- - Add per arena control over unused dirty page purging, via the
- "arenas.lg_dirty_mult", "arena.<i>.lg_dirty_mult", and
- "stats.arenas.<i>.lg_dirty_mult" mallctls.
- - Add the "prof.gdump" mallctl, which makes it possible to toggle the gdump
- feature on/off during program execution.
- - Add sdallocx(), which implements sized deallocation. The primary
- optimization over dallocx() is the removal of a metadata read, which often
- suffers an L1 cache miss.
- - Add missing header includes in jemalloc/jemalloc.h, so that applications
- only have to #include <jemalloc/jemalloc.h>.
- - Add support for additional platforms:
- + Bitrig
- + Cygwin
- + DragonFlyBSD
- + iOS
- + OpenBSD
- + OpenRISC/or1k
-
- Optimizations:
- - Maintain dirty runs in per arena LRUs rather than in per arena trees of
- dirty-run-containing chunks. In practice this change significantly reduces
- dirty page purging volume.
- - Integrate whole chunks into the unused dirty page purging machinery. This
- reduces the cost of repeated huge allocation/deallocation, because it
- effectively introduces a cache of chunks.
- - Split the arena chunk map into two separate arrays, in order to increase
- cache locality for the frequently accessed bits.
- - Move small run metadata out of runs, into arena chunk headers. This reduces
- run fragmentation, smaller runs reduce external fragmentation for small size
- classes, and packed (less uniformly aligned) metadata layout improves CPU
- cache set distribution.
- - Randomly distribute large allocation base pointer alignment relative to page
- boundaries in order to more uniformly utilize CPU cache sets. This can be
- disabled via the --disable-cache-oblivious configure option, and queried via
- the "config.cache_oblivious" mallctl.
- - Micro-optimize the fast paths for the public API functions.
- - Refactor thread-specific data to reside in a single structure. This assures
- that only a single TLS read is necessary per call into the public API.
- - Implement in-place huge allocation growing and shrinking.
- - Refactor rtree (radix tree for chunk lookups) to be lock-free, and make
- additional optimizations that reduce maximum lookup depth to one or two
- levels. This resolves what was a concurrency bottleneck for per arena huge
- allocation, because a global data structure is critical for determining
- which arenas own which huge allocations.
-
- Incompatible changes:
- - Replace --enable-cc-silence with --disable-cc-silence to suppress spurious
- warnings by default.
- - Assure that the constness of malloc_usable_size()'s return type matches that
- of the system implementation.
- - Change the heap profile dump format to support per thread heap profiling,
- rename pprof to jeprof, and enhance it with the --thread=<n> option. As a
- result, the bundled jeprof must now be used rather than the upstream
- (gperftools) pprof.
- - Disable "opt.prof_final" by default, in order to avoid atexit(3), which can
- internally deadlock on some platforms.
- - Change the "arenas.nlruns" mallctl type from size_t to unsigned.
- - Replace the "stats.arenas.<i>.bins.<j>.allocated" mallctl with
- "stats.arenas.<i>.bins.<j>.curregs".
- - Ignore MALLOC_CONF in set{uid,gid,cap} binaries.
- - Ignore MALLOCX_ARENA(a) in dallocx(), in favor of using the
- MALLOCX_TCACHE(tc) and MALLOCX_TCACHE_NONE flags to control tcache usage.
-
- Removed features:
- - Remove the *allocm() API, which is superseded by the *allocx() API.
- - Remove the --enable-dss options, and make dss non-optional on all platforms
- which support sbrk(2).
- - Remove the "arenas.purge" mallctl, which was obsoleted by the
- "arena.<i>.purge" mallctl in 3.1.0.
- - Remove the unnecessary "opt.valgrind" mallctl; jemalloc automatically
- detects whether it is running inside Valgrind.
- - Remove the "stats.huge.allocated", "stats.huge.nmalloc", and
- "stats.huge.ndalloc" mallctls.
- - Remove the --enable-mremap option.
- - Remove the "stats.chunks.current", "stats.chunks.total", and
- "stats.chunks.high" mallctls.
-
- Bug fixes:
- - Fix the cactive statistic to decrease (rather than increase) when active
- memory decreases. This regression was first released in 3.5.0.
- - Fix OOM handling in memalign() and valloc(). A variant of this bug existed
- in all releases since 2.0.0, which introduced these functions.
- - Fix an OOM-related regression in arena_tcache_fill_small(), which could
- cause cache corruption on OOM. This regression was present in all releases
- from 2.2.0 through 3.6.0.
- - Fix size class overflow handling for malloc(), posix_memalign(), memalign(),
- calloc(), and realloc() when profiling is enabled.
- - Fix the "arena.<i>.dss" mallctl to return an error if "primary" or
- "secondary" precedence is specified, but sbrk(2) is not supported.
- - Fix fallback lg_floor() implementations to handle extremely large inputs.
- - Ensure the default purgeable zone is after the default zone on OS X.
- - Fix latent bugs in atomic_*().
- - Fix the "arena.<i>.dss" mallctl to handle read-only calls.
- - Fix tls_model configuration to enable the initial-exec model when possible.
- - Mark malloc_conf as a weak symbol so that the application can override it.
- - Correctly detect glibc's adaptive pthread mutexes.
- - Fix the --without-export configure option.
-
-* 3.6.0 (March 31, 2014)
-
- This version contains a critical bug fix for a regression present in 3.5.0 and
- 3.5.1.
-
- Bug fixes:
- - Fix a regression in arena_chunk_alloc() that caused crashes during
- small/large allocation if chunk allocation failed. In the absence of this
- bug, chunk allocation failure would result in allocation failure, e.g. NULL
- return from malloc(). This regression was introduced in 3.5.0.
- - Fix backtracing for gcc intrinsics-based backtracing by specifying
- -fno-omit-frame-pointer to gcc. Note that the application (and all the
- libraries it links to) must also be compiled with this option for
- backtracing to be reliable.
- - Use dss allocation precedence for huge allocations as well as small/large
- allocations.
- - Fix test assertion failure message formatting. This bug did not manifest on
- x86_64 systems because of implementation subtleties in va_list.
- - Fix inconsequential test failures for hash and SFMT code.
-
- New features:
- - Support heap profiling on FreeBSD. This feature depends on the proc
- filesystem being mounted during heap profile dumping.
-
-* 3.5.1 (February 25, 2014)
-
- This version primarily addresses minor bugs in test code.
-
- Bug fixes:
- - Configure Solaris/Illumos to use MADV_FREE.
- - Fix junk filling for mremap(2)-based huge reallocation. This is only
- relevant if configuring with the --enable-mremap option specified.
- - Avoid compilation failure if 'restrict' C99 keyword is not supported by the
- compiler.
- - Add a configure test for SSE2 rather than assuming it is usable on i686
- systems. This fixes test compilation errors, especially on 32-bit Linux
- systems.
- - Fix mallctl argument size mismatches (size_t vs. uint64_t) in the stats unit
- test.
- - Fix/remove flawed alignment-related overflow tests.
- - Prevent compiler optimizations that could change backtraces in the
- prof_accum unit test.
-
-* 3.5.0 (January 22, 2014)
-
- This version focuses on refactoring and automated testing, though it also
- includes some non-trivial heap profiling optimizations not mentioned below.
-
- New features:
- - Add the *allocx() API, which is a successor to the experimental *allocm()
- API. The *allocx() functions are slightly simpler to use because they have
- fewer parameters, they directly return the results of primary interest, and
- mallocx()/rallocx() avoid the strict aliasing pitfall that
- allocm()/rallocm() share with posix_memalign(). Note that *allocm() is
- slated for removal in the next non-bugfix release.
- - Add support for LinuxThreads.
-
- Bug fixes:
- - Unless heap profiling is enabled, disable floating point code and don't link
- with libm. This, in combination with e.g. EXTRA_CFLAGS=-mno-sse on x64
- systems, makes it possible to completely disable floating point register
- use. Some versions of glibc neglect to save/restore caller-saved floating
- point registers during dynamic lazy symbol loading, and the symbol loading
- code uses whatever malloc the application happens to have linked/loaded
- with, the result being potential floating point register corruption.
- - Report ENOMEM rather than EINVAL if an OOM occurs during heap profiling
- backtrace creation in imemalign(). This bug impacted posix_memalign() and
- aligned_alloc().
- - Fix a file descriptor leak in a prof_dump_maps() error path.
- - Fix prof_dump() to close the dump file descriptor for all relevant error
- paths.
- - Fix rallocm() to use the arena specified by the ALLOCM_ARENA(s) flag for
- allocation, not just deallocation.
- - Fix a data race for large allocation stats counters.
- - Fix a potential infinite loop during thread exit. This bug occurred on
- Solaris, and could affect other platforms with similar pthreads TSD
- implementations.
- - Don't junk-fill reallocations unless usable size changes. This fixes a
- violation of the *allocx()/*allocm() semantics.
- - Fix growing large reallocation to junk fill new space.
- - Fix huge deallocation to junk fill when munmap is disabled.
- - Change the default private namespace prefix from empty to je_, and change
- --with-private-namespace-prefix so that it prepends an additional prefix
- rather than replacing je_. This reduces the likelihood of applications
- which statically link jemalloc experiencing symbol name collisions.
- - Add missing private namespace mangling (relevant when
- --with-private-namespace is specified).
- - Add and use JEMALLOC_INLINE_C so that static inline functions are marked as
- static even for debug builds.
- - Add a missing mutex unlock in a malloc_init_hard() error path. In practice
- this error path is never executed.
- - Fix numerous bugs in malloc_strotumax() error handling/reporting. These
- bugs had no impact except for malformed inputs.
- - Fix numerous bugs in malloc_snprintf(). These bugs were not exercised by
- existing calls, so they had no impact.
-
-* 3.4.1 (October 20, 2013)
-
- Bug fixes:
- - Fix a race in the "arenas.extend" mallctl that could cause memory corruption
- of internal data structures and subsequent crashes.
- - Fix Valgrind integration flaws that caused Valgrind warnings about reads of
- uninitialized memory in:
- + arena chunk headers
- + internal zero-initialized data structures (relevant to tcache and prof
- code)
- - Preserve errno during the first allocation. A readlink(2) call during
- initialization fails unless /etc/malloc.conf exists, so errno was typically
- set during the first allocation prior to this fix.
- - Fix compilation warnings reported by gcc 4.8.1.
-
-* 3.4.0 (June 2, 2013)
-
- This version is essentially a small bugfix release, but the addition of
- aarch64 support requires that the minor version be incremented.
-
- Bug fixes:
- - Fix race-triggered deadlocks in chunk_record(). These deadlocks were
- typically triggered by multiple threads concurrently deallocating huge
- objects.
-
- New features:
- - Add support for the aarch64 architecture.
-
-* 3.3.1 (March 6, 2013)
-
- This version fixes bugs that are typically encountered only when utilizing
- custom run-time options.
-
- Bug fixes:
- - Fix a locking order bug that could cause deadlock during fork if heap
- profiling were enabled.
- - Fix a chunk recycling bug that could cause the allocator to lose track of
- whether a chunk was zeroed. On FreeBSD, NetBSD, and OS X, it could cause
- corruption if allocating via sbrk(2) (unlikely unless running with the
- "dss:primary" option specified). This was completely harmless on Linux
- unless using mlockall(2) (and unlikely even then, unless the
- --disable-munmap configure option or the "dss:primary" option was
- specified). This regression was introduced in 3.1.0 by the
- mlockall(2)/madvise(2) interaction fix.
- - Fix TLS-related memory corruption that could occur during thread exit if the
- thread never allocated memory. Only the quarantine and prof facilities were
- susceptible.
- - Fix two quarantine bugs:
- + Internal reallocation of the quarantined object array leaked the old
- array.
- + Reallocation failure for internal reallocation of the quarantined object
- array (very unlikely) resulted in memory corruption.
- - Fix Valgrind integration to annotate all internally allocated memory in a
- way that keeps Valgrind happy about internal data structure access.
- - Fix building for s390 systems.
-
-* 3.3.0 (January 23, 2013)
-
- This version includes a few minor performance improvements in addition to the
- listed new features and bug fixes.
-
- New features:
- - Add clipping support to lg_chunk option processing.
- - Add the --enable-ivsalloc option.
- - Add the --without-export option.
- - Add the --disable-zone-allocator option.
-
- Bug fixes:
- - Fix "arenas.extend" mallctl to output the number of arenas.
- - Fix chunk_recycle() to unconditionally inform Valgrind that returned memory
- is undefined.
- - Fix build break on FreeBSD related to alloca.h.
-
-* 3.2.0 (November 9, 2012)
-
- In addition to a couple of bug fixes, this version modifies page run
- allocation and dirty page purging algorithms in order to better control
- page-level virtual memory fragmentation.
-
- Incompatible changes:
- - Change the "opt.lg_dirty_mult" default from 5 to 3 (32:1 to 8:1).
-
- Bug fixes:
- - Fix dss/mmap allocation precedence code to use recyclable mmap memory only
- after primary dss allocation fails.
- - Fix deadlock in the "arenas.purge" mallctl. This regression was introduced
- in 3.1.0 by the addition of the "arena.<i>.purge" mallctl.
-
-* 3.1.0 (October 16, 2012)
-
- New features:
- - Auto-detect whether running inside Valgrind, thus removing the need to
- manually specify MALLOC_CONF=valgrind:true.
- - Add the "arenas.extend" mallctl, which allows applications to create
- manually managed arenas.
- - Add the ALLOCM_ARENA() flag for {,r,d}allocm().
- - Add the "opt.dss", "arena.<i>.dss", and "stats.arenas.<i>.dss" mallctls,
- which provide control over dss/mmap precedence.
- - Add the "arena.<i>.purge" mallctl, which obsoletes "arenas.purge".
- - Define LG_QUANTUM for hppa.
-
- Incompatible changes:
- - Disable tcache by default if running inside Valgrind, in order to avoid
- making unallocated objects appear reachable to Valgrind.
- - Drop const from malloc_usable_size() argument on Linux.
-
- Bug fixes:
- - Fix heap profiling crash if sampled object is freed via realloc(p, 0).
- - Remove const from __*_hook variable declarations, so that glibc can modify
- them during process forking.
- - Fix mlockall(2)/madvise(2) interaction.
- - Fix fork(2)-related deadlocks.
- - Fix error return value for "thread.tcache.enabled" mallctl.
-
-* 3.0.0 (May 11, 2012)
-
- Although this version adds some major new features, the primary focus is on
- internal code cleanup that facilitates maintainability and portability, most
- of which is not reflected in the ChangeLog. This is the first release to
- incorporate substantial contributions from numerous other developers, and the
- result is a more broadly useful allocator (see the git revision history for
- contribution details). Note that the license has been unified, thanks to
- Facebook granting a license under the same terms as the other copyright
- holders (see COPYING).
-
- New features:
- - Implement Valgrind support, redzones, and quarantine.
- - Add support for additional platforms:
- + FreeBSD
- + Mac OS X Lion
- + MinGW
- + Windows (no support yet for replacing the system malloc)
- - Add support for additional architectures:
- + MIPS
- + SH4
- + Tilera
- - Add support for cross compiling.
- - Add nallocm(), which rounds a request size up to the nearest size class
- without actually allocating.
- - Implement aligned_alloc() (blame C11).
- - Add the "thread.tcache.enabled" mallctl.
- - Add the "opt.prof_final" mallctl.
- - Update pprof (from gperftools 2.0).
- - Add the --with-mangling option.
- - Add the --disable-experimental option.
- - Add the --disable-munmap option, and make it the default on Linux.
- - Add the --enable-mremap option, which disables use of mremap(2) by default.
-
- Incompatible changes:
- - Enable stats by default.
- - Enable fill by default.
- - Disable lazy locking by default.
- - Rename the "tcache.flush" mallctl to "thread.tcache.flush".
- - Rename the "arenas.pagesize" mallctl to "arenas.page".
- - Change the "opt.lg_prof_sample" default from 0 to 19 (1 B to 512 KiB).
- - Change the "opt.prof_accum" default from true to false.
-
- Removed features:
- - Remove the swap feature, including the "config.swap", "swap.avail",
- "swap.prezeroed", "swap.nfds", and "swap.fds" mallctls.
- - Remove highruns statistics, including the
- "stats.arenas.<i>.bins.<j>.highruns" and
- "stats.arenas.<i>.lruns.<j>.highruns" mallctls.
- - As part of small size class refactoring, remove the "opt.lg_[qc]space_max",
- "arenas.cacheline", "arenas.subpage", "arenas.[tqcs]space_{min,max}", and
- "arenas.[tqcs]bins" mallctls.
- - Remove the "arenas.chunksize" mallctl.
- - Remove the "opt.lg_prof_tcmax" option.
- - Remove the "opt.lg_prof_bt_max" option.
- - Remove the "opt.lg_tcache_gc_sweep" option.
- - Remove the --disable-tiny option, including the "config.tiny" mallctl.
- - Remove the --enable-dynamic-page-shift configure option.
- - Remove the --enable-sysv configure option.
-
- Bug fixes:
- - Fix a statistics-related bug in the "thread.arena" mallctl that could cause
- invalid statistics and crashes.
- - Work around TLS deallocation via free() on Linux. This bug could cause
- write-after-free memory corruption.
- - Fix a potential deadlock that could occur during interval- and
- growth-triggered heap profile dumps.
- - Fix large calloc() zeroing bugs due to dropping chunk map unzeroed flags.
- - Fix chunk_alloc_dss() to stop claiming memory is zeroed. This bug could
- cause memory corruption and crashes with --enable-dss specified.
- - Fix fork-related bugs that could cause deadlock in children between fork
- and exec.
- - Fix malloc_stats_print() to honor 'b' and 'l' in the opts parameter.
- - Fix realloc(p, 0) to act like free(p).
- - Do not enforce minimum alignment in memalign().
- - Check for NULL pointer in malloc_usable_size().
- - Fix an off-by-one heap profile statistics bug that could be observed in
- interval- and growth-triggered heap profiles.
- - Fix the "epoch" mallctl to update cached stats even if the passed in epoch
- is 0.
- - Fix bin->runcur management to fix a layout policy bug. This bug did not
- affect correctness.
- - Fix a bug in choose_arena_hard() that potentially caused more arenas to be
- initialized than necessary.
- - Add missing "opt.lg_tcache_max" mallctl implementation.
- - Use glibc allocator hooks to make mixed allocator usage less likely.
- - Fix build issues for --disable-tcache.
- - Don't mangle pthread_create() when --with-private-namespace is specified.
-
-* 2.2.5 (November 14, 2011)
-
- Bug fixes:
- - Fix huge_ralloc() race when using mremap(2). This is a serious bug that
- could cause memory corruption and/or crashes.
- - Fix huge_ralloc() to maintain chunk statistics.
- - Fix malloc_stats_print(..., "a") output.
-
-* 2.2.4 (November 5, 2011)
-
- Bug fixes:
- - Initialize arenas_tsd before using it. This bug existed for 2.2.[0-3], as
- well as for --disable-tls builds in earlier releases.
- - Do not assume a 4 KiB page size in test/rallocm.c.
-
-* 2.2.3 (August 31, 2011)
-
- This version fixes numerous bugs related to heap profiling.
-
- Bug fixes:
- - Fix a prof-related race condition. This bug could cause memory corruption,
- but only occurred in non-default configurations (prof_accum:false).
- - Fix off-by-one backtracing issues (make sure that prof_alloc_prep() is
- excluded from backtraces).
- - Fix a prof-related bug in realloc() (only triggered by OOM errors).
- - Fix prof-related bugs in allocm() and rallocm().
- - Fix prof_tdata_cleanup() for --disable-tls builds.
- - Fix a relative include path, to fix objdir builds.
-
-* 2.2.2 (July 30, 2011)
-
- Bug fixes:
- - Fix a build error for --disable-tcache.
- - Fix assertions in arena_purge() (for real this time).
- - Add the --with-private-namespace option. This is a workaround for symbol
- conflicts that can inadvertently arise when using static libraries.
-
-* 2.2.1 (March 30, 2011)
-
- Bug fixes:
- - Implement atomic operations for x86/x64. This fixes compilation failures
- for versions of gcc that are still in wide use.
- - Fix an assertion in arena_purge().
-
-* 2.2.0 (March 22, 2011)
-
- This version incorporates several improvements to algorithms and data
- structures that tend to reduce fragmentation and increase speed.
-
- New features:
- - Add the "stats.cactive" mallctl.
- - Update pprof (from google-perftools 1.7).
- - Improve backtracing-related configuration logic, and add the
- --disable-prof-libgcc option.
-
- Bug fixes:
- - Change default symbol visibility from "internal", to "hidden", which
- decreases the overhead of library-internal function calls.
- - Fix symbol visibility so that it is also set on OS X.
- - Fix a build dependency regression caused by the introduction of the .pic.o
- suffix for PIC object files.
- - Add missing checks for mutex initialization failures.
- - Don't use libgcc-based backtracing except on x64, where it is known to work.
- - Fix deadlocks on OS X that were due to memory allocation in
- pthread_mutex_lock().
- - Heap profiling-specific fixes:
- + Fix memory corruption due to integer overflow in small region index
- computation, when using a small enough sample interval that profiling
- context pointers are stored in small run headers.
- + Fix a bootstrap ordering bug that only occurred with TLS disabled.
- + Fix a rallocm() rsize bug.
- + Fix error detection bugs for aligned memory allocation.
-
-* 2.1.3 (March 14, 2011)
-
- Bug fixes:
- - Fix a cpp logic regression (due to the "thread.{de,}allocatedp" mallctl fix
- for OS X in 2.1.2).
- - Fix a "thread.arena" mallctl bug.
- - Fix a thread cache stats merging bug.
-
-* 2.1.2 (March 2, 2011)
-
- Bug fixes:
- - Fix "thread.{de,}allocatedp" mallctl for OS X.
- - Add missing jemalloc.a to build system.
-
-* 2.1.1 (January 31, 2011)
-
- Bug fixes:
- - Fix aligned huge reallocation (affected allocm()).
- - Fix the ALLOCM_LG_ALIGN macro definition.
- - Fix a heap dumping deadlock.
- - Fix a "thread.arena" mallctl bug.
-
-* 2.1.0 (December 3, 2010)
-
- This version incorporates some optimizations that can't quite be considered
- bug fixes.
-
- New features:
- - Use Linux's mremap(2) for huge object reallocation when possible.
- - Avoid locking in mallctl*() when possible.
- - Add the "thread.[de]allocatedp" mallctl's.
- - Convert the manual page source from roff to DocBook, and generate both roff
- and HTML manuals.
-
- Bug fixes:
- - Fix a crash due to incorrect bootstrap ordering. This only impacted
- --enable-debug --enable-dss configurations.
- - Fix a minor statistics bug for mallctl("swap.avail", ...).
-
-* 2.0.1 (October 29, 2010)
-
- Bug fixes:
- - Fix a race condition in heap profiling that could cause undefined behavior
- if "opt.prof_accum" were disabled.
- - Add missing mutex unlocks for some OOM error paths in the heap profiling
- code.
- - Fix a compilation error for non-C99 builds.
-
-* 2.0.0 (October 24, 2010)
-
- This version focuses on the experimental *allocm() API, and on improved
- run-time configuration/introspection. Nonetheless, numerous performance
- improvements are also included.
-
- New features:
- - Implement the experimental {,r,s,d}allocm() API, which provides a superset
- of the functionality available via malloc(), calloc(), posix_memalign(),
- realloc(), malloc_usable_size(), and free(). These functions can be used to
- allocate/reallocate aligned zeroed memory, ask for optional extra memory
- during reallocation, prevent object movement during reallocation, etc.
- - Replace JEMALLOC_OPTIONS/JEMALLOC_PROF_PREFIX with MALLOC_CONF, which is
- more human-readable, and more flexible. For example:
- JEMALLOC_OPTIONS=AJP
- is now:
- MALLOC_CONF=abort:true,fill:true,stats_print:true
- - Port to Apple OS X. Sponsored by Mozilla.
- - Make it possible for the application to control thread-->arena mappings via
- the "thread.arena" mallctl.
- - Add compile-time support for all TLS-related functionality via pthreads TSD.
- This is mainly of interest for OS X, which does not support TLS, but has a
- TSD implementation with similar performance.
- - Override memalign() and valloc() if they are provided by the system.
- - Add the "arenas.purge" mallctl, which can be used to synchronously purge all
- dirty unused pages.
- - Make cumulative heap profiling data optional, so that it is possible to
- limit the amount of memory consumed by heap profiling data structures.
- - Add per thread allocation counters that can be accessed via the
- "thread.allocated" and "thread.deallocated" mallctls.
-
- Incompatible changes:
- - Remove JEMALLOC_OPTIONS and malloc_options (see MALLOC_CONF above).
- - Increase default backtrace depth from 4 to 128 for heap profiling.
- - Disable interval-based profile dumps by default.
-
- Bug fixes:
- - Remove bad assertions in fork handler functions. These assertions could
- cause aborts for some combinations of configure settings.
- - Fix strerror_r() usage to deal with non-standard semantics in GNU libc.
- - Fix leak context reporting. This bug tended to cause the number of contexts
- to be underreported (though the reported number of objects and bytes were
- correct).
- - Fix a realloc() bug for large in-place growing reallocation. This bug could
- cause memory corruption, but it was hard to trigger.
- - Fix an allocation bug for small allocations that could be triggered if
- multiple threads raced to create a new run of backing pages.
- - Enhance the heap profiler to trigger samples based on usable size, rather
- than request size.
- - Fix a heap profiling bug due to sometimes losing track of requested object
- size for sampled objects.
-
-* 1.0.3 (August 12, 2010)
-
- Bug fixes:
- - Fix the libunwind-based implementation of stack backtracing (used for heap
- profiling). This bug could cause zero-length backtraces to be reported.
- - Add a missing mutex unlock in library initialization code. If multiple
- threads raced to initialize malloc, some of them could end up permanently
- blocked.
-
-* 1.0.2 (May 11, 2010)
-
- Bug fixes:
- - Fix junk filling of large objects, which could cause memory corruption.
- - Add MAP_NORESERVE support for chunk mapping, because otherwise virtual
- memory limits could cause swap file configuration to fail. Contributed by
- Jordan DeLong.
-
-* 1.0.1 (April 14, 2010)
-
- Bug fixes:
- - Fix compilation when --enable-fill is specified.
- - Fix threads-related profiling bugs that affected accuracy and caused memory
- to be leaked during thread exit.
- - Fix dirty page purging race conditions that could cause crashes.
- - Fix crash in tcache flushing code during thread destruction.
-
-* 1.0.0 (April 11, 2010)
-
- This release focuses on speed and run-time introspection. Numerous
- algorithmic improvements make this release substantially faster than its
- predecessors.
-
- New features:
- - Implement autoconf-based configuration system.
- - Add mallctl*(), for the purposes of introspection and run-time
- configuration.
- - Make it possible for the application to manually flush a thread's cache, via
- the "tcache.flush" mallctl.
- - Base maximum dirty page count on proportion of active memory.
- - Compute various additional run-time statistics, including per size class
- statistics for large objects.
- - Expose malloc_stats_print(), which can be called repeatedly by the
- application.
- - Simplify the malloc_message() signature to only take one string argument,
- and incorporate an opaque data pointer argument for use by the application
- in combination with malloc_stats_print().
- - Add support for allocation backed by one or more swap files, and allow the
- application to disable over-commit if swap files are in use.
- - Implement allocation profiling and leak checking.
-
- Removed features:
- - Remove the dynamic arena rebalancing code, since thread-specific caching
- reduces its utility.
-
- Bug fixes:
- - Modify chunk allocation to work when address space layout randomization
- (ASLR) is in use.
- - Fix thread cleanup bugs related to TLS destruction.
- - Handle 0-size allocation requests in posix_memalign().
- - Fix a chunk leak. The leaked chunks were never touched, so this impacted
- virtual memory usage, but not physical memory usage.
-
-* linux_2008082[78]a (August 27/28, 2008)
-
- These snapshot releases are the simple result of incorporating Linux-specific
- support into the FreeBSD malloc sources.
-
---------------------------------------------------------------------------------
-vim:filetype=text:textwidth=80
diff --git a/memory/jemalloc/src/INSTALL b/memory/jemalloc/src/INSTALL
deleted file mode 100644
index 6878716535..0000000000
--- a/memory/jemalloc/src/INSTALL
+++ /dev/null
@@ -1,414 +0,0 @@
-Building and installing a packaged release of jemalloc can be as simple as
-typing the following while in the root directory of the source tree:
-
- ./configure
- make
- make install
-
-If building from unpackaged developer sources, the simplest command sequence
-that might work is:
-
- ./autogen.sh
- make dist
- make
- make install
-
-Note that documentation is not built by the default target because doing so
-would create a dependency on xsltproc in packaged releases, hence the
-requirement to either run 'make dist' or avoid installing docs via the various
-install_* targets documented below.
-
-=== Advanced configuration =====================================================
-
-The 'configure' script supports numerous options that allow control of which
-functionality is enabled, where jemalloc is installed, etc. Optionally, pass
-any of the following arguments (not a definitive list) to 'configure':
-
---help
- Print a definitive list of options.
-
---prefix=<install-root-dir>
- Set the base directory in which to install. For example:
-
- ./configure --prefix=/usr/local
-
- will cause files to be installed into /usr/local/include, /usr/local/lib,
- and /usr/local/man.
-
---with-version=<major>.<minor>.<bugfix>-<nrev>-g<gid>
- Use the specified version string rather than trying to generate one (if in
- a git repository) or use existing the VERSION file (if present).
-
---with-rpath=<colon-separated-rpath>
- Embed one or more library paths, so that libjemalloc can find the libraries
- it is linked to. This works only on ELF-based systems.
-
---with-mangling=<map>
- Mangle public symbols specified in <map> which is a comma-separated list of
- name:mangled pairs.
-
- For example, to use ld's --wrap option as an alternative method for
- overriding libc's malloc implementation, specify something like:
-
- --with-mangling=malloc:__wrap_malloc,free:__wrap_free[...]
-
- Note that mangling happens prior to application of the prefix specified by
- --with-jemalloc-prefix, and mangled symbols are then ignored when applying
- the prefix.
-
---with-jemalloc-prefix=<prefix>
- Prefix all public APIs with <prefix>. For example, if <prefix> is
- "prefix_", API changes like the following occur:
-
- malloc() --> prefix_malloc()
- malloc_conf --> prefix_malloc_conf
- /etc/malloc.conf --> /etc/prefix_malloc.conf
- MALLOC_CONF --> PREFIX_MALLOC_CONF
-
- This makes it possible to use jemalloc at the same time as the system
- allocator, or even to use multiple copies of jemalloc simultaneously.
-
- By default, the prefix is "", except on OS X, where it is "je_". On OS X,
- jemalloc overlays the default malloc zone, but makes no attempt to actually
- replace the "malloc", "calloc", etc. symbols.
-
---without-export
- Don't export public APIs. This can be useful when building jemalloc as a
- static library, or to avoid exporting public APIs when using the zone
- allocator on OSX.
-
---with-private-namespace=<prefix>
- Prefix all library-private APIs with <prefix>je_. For shared libraries,
- symbol visibility mechanisms prevent these symbols from being exported, but
- for static libraries, naming collisions are a real possibility. By
- default, <prefix> is empty, which results in a symbol prefix of je_ .
-
---with-install-suffix=<suffix>
- Append <suffix> to the base name of all installed files, such that multiple
- versions of jemalloc can coexist in the same installation directory. For
- example, libjemalloc.so.0 becomes libjemalloc<suffix>.so.0.
-
---with-malloc-conf=<malloc_conf>
- Embed <malloc_conf> as a run-time options string that is processed prior to
- the malloc_conf global variable, the /etc/malloc.conf symlink, and the
- MALLOC_CONF environment variable. For example, to change the default chunk
- size to 256 KiB:
-
- --with-malloc-conf=lg_chunk:18
-
---disable-cc-silence
- Disable code that silences non-useful compiler warnings. This is mainly
- useful during development when auditing the set of warnings that are being
- silenced.
-
---enable-debug
- Enable assertions and validation code. This incurs a substantial
- performance hit, but is very useful during application development.
- Implies --enable-ivsalloc.
-
---enable-code-coverage
- Enable code coverage support, for use during jemalloc test development.
- Additional testing targets are available if this option is enabled:
-
- coverage
- coverage_unit
- coverage_integration
- coverage_stress
-
- These targets do not clear code coverage results from previous runs, and
- there are interactions between the various coverage targets, so it is
- usually advisable to run 'make clean' between repeated code coverage runs.
-
---disable-stats
- Disable statistics gathering functionality. See the "opt.stats_print"
- option documentation for usage details.
-
---enable-ivsalloc
- Enable validation code, which verifies that pointers reside within
- jemalloc-owned chunks before dereferencing them. This incurs a minor
- performance hit.
-
---enable-prof
- Enable heap profiling and leak detection functionality. See the "opt.prof"
- option documentation for usage details. When enabled, there are several
- approaches to backtracing, and the configure script chooses the first one
- in the following list that appears to function correctly:
-
- + libunwind (requires --enable-prof-libunwind)
- + libgcc (unless --disable-prof-libgcc)
- + gcc intrinsics (unless --disable-prof-gcc)
-
---enable-prof-libunwind
- Use the libunwind library (http://www.nongnu.org/libunwind/) for stack
- backtracing.
-
---disable-prof-libgcc
- Disable the use of libgcc's backtracing functionality.
-
---disable-prof-gcc
- Disable the use of gcc intrinsics for backtracing.
-
---with-static-libunwind=<libunwind.a>
- Statically link against the specified libunwind.a rather than dynamically
- linking with -lunwind.
-
---disable-tcache
- Disable thread-specific caches for small objects. Objects are cached and
- released in bulk, thus reducing the total number of mutex operations. See
- the "opt.tcache" option for usage details.
-
---disable-munmap
- Disable virtual memory deallocation via munmap(2); instead keep track of
- the virtual memory for later use. munmap() is disabled by default (i.e.
- --disable-munmap is implied) on Linux, which has a quirk in its virtual
- memory allocation algorithm that causes semi-permanent VM map holes under
- normal jemalloc operation.
-
---disable-fill
- Disable support for junk/zero filling of memory, quarantine, and redzones.
- See the "opt.junk", "opt.zero", "opt.quarantine", and "opt.redzone" option
- documentation for usage details.
-
---disable-valgrind
- Disable support for Valgrind.
-
---disable-zone-allocator
- Disable zone allocator for Darwin. This means jemalloc won't be hooked as
- the default allocator on OSX/iOS.
-
---enable-utrace
- Enable utrace(2)-based allocation tracing. This feature is not broadly
- portable (FreeBSD has it, but Linux and OS X do not).
-
---enable-xmalloc
- Enable support for optional immediate termination due to out-of-memory
- errors, as is commonly implemented by "xmalloc" wrapper function for malloc.
- See the "opt.xmalloc" option documentation for usage details.
-
---enable-lazy-lock
- Enable code that wraps pthread_create() to detect when an application
- switches from single-threaded to multi-threaded mode, so that it can avoid
- mutex locking/unlocking operations while in single-threaded mode. In
- practice, this feature usually has little impact on performance unless
- thread-specific caching is disabled.
-
---disable-tls
- Disable thread-local storage (TLS), which allows for fast access to
- thread-local variables via the __thread keyword. If TLS is available,
- jemalloc uses it for several purposes.
-
---disable-cache-oblivious
- Disable cache-oblivious large allocation alignment for large allocation
- requests with no alignment constraints. If this feature is disabled, all
- large allocations are page-aligned as an implementation artifact, which can
- severely harm CPU cache utilization. However, the cache-oblivious layout
- comes at the cost of one extra page per large allocation, which in the
- most extreme case increases physical memory usage for the 16 KiB size class
- to 20 KiB.
-
---with-xslroot=<path>
- Specify where to find DocBook XSL stylesheets when building the
- documentation.
-
---with-lg-page=<lg-page>
- Specify the base 2 log of the system page size. This option is only useful
- when cross compiling, since the configure script automatically determines
- the host's page size by default.
-
---with-lg-page-sizes=<lg-page-sizes>
- Specify the comma-separated base 2 logs of the page sizes to support. This
- option may be useful when cross-compiling in combination with
- --with-lg-page, but its primary use case is for integration with FreeBSD's
- libc, wherein jemalloc is embedded.
-
---with-lg-size-class-group=<lg-size-class-group>
- Specify the base 2 log of how many size classes to use for each doubling in
- size. By default jemalloc uses <lg-size-class-group>=2, which results in
- e.g. the following size classes:
-
- [...], 64,
- 80, 96, 112, 128,
- 160, [...]
-
- <lg-size-class-group>=3 results in e.g. the following size classes:
-
- [...], 64,
- 72, 80, 88, 96, 104, 112, 120, 128,
- 144, [...]
-
- The minimal <lg-size-class-group>=0 causes jemalloc to only provide size
- classes that are powers of 2:
-
- [...],
- 64,
- 128,
- 256,
- [...]
-
- An implementation detail currently limits the total number of small size
- classes to 255, and a compilation error will result if the
- <lg-size-class-group> you specify cannot be supported. The limit is
- roughly <lg-size-class-group>=4, depending on page size.
-
---with-lg-quantum=<lg-quantum>
- Specify the base 2 log of the minimum allocation alignment. jemalloc needs
- to know the minimum alignment that meets the following C standard
- requirement (quoted from the April 12, 2011 draft of the C11 standard):
-
- The pointer returned if the allocation succeeds is suitably aligned so
- that it may be assigned to a pointer to any type of object with a
- fundamental alignment requirement and then used to access such an object
- or an array of such objects in the space allocated [...]
-
- This setting is architecture-specific, and although jemalloc includes known
- safe values for the most commonly used modern architectures, there is a
- wrinkle related to GNU libc (glibc) that may impact your choice of
- <lg-quantum>. On most modern architectures, this mandates 16-byte alignment
- (<lg-quantum>=4), but the glibc developers chose not to meet this
- requirement for performance reasons. An old discussion can be found at
- https://sourceware.org/bugzilla/show_bug.cgi?id=206 . Unlike glibc,
- jemalloc does follow the C standard by default (caveat: jemalloc
- technically cheats if --with-lg-tiny-min is smaller than
- --with-lg-quantum), but the fact that Linux systems already work around
- this allocator noncompliance means that it is generally safe in practice to
- let jemalloc's minimum alignment follow glibc's lead. If you specify
- --with-lg-quantum=3 during configuration, jemalloc will provide additional
- size classes that are not 16-byte-aligned (24, 40, and 56, assuming
- --with-lg-size-class-group=2).
-
---with-lg-tiny-min=<lg-tiny-min>
- Specify the base 2 log of the minimum tiny size class to support. Tiny
- size classes are powers of 2 less than the quantum, and are only
- incorporated if <lg-tiny-min> is less than <lg-quantum> (see
- --with-lg-quantum). Tiny size classes technically violate the C standard
- requirement for minimum alignment, and crashes could conceivably result if
- the compiler were to generate instructions that made alignment assumptions,
- both because illegal instruction traps could result, and because accesses
- could straddle page boundaries and cause segmentation faults due to
- accessing unmapped addresses.
-
- The default of <lg-tiny-min>=3 works well in practice even on architectures
- that technically require 16-byte alignment, probably for the same reason
- --with-lg-quantum=3 works. Smaller tiny size classes can, and will, cause
- crashes (see https://bugzilla.mozilla.org/show_bug.cgi?id=691003 for an
- example).
-
- This option is rarely useful, and is mainly provided as documentation of a
- subtle implementation detail. If you do use this option, specify a
- value in [3, ..., <lg-quantum>].
-
-The following environment variables (not a definitive list) impact configure's
-behavior:
-
-CFLAGS="?"
- Pass these flags to the compiler. You probably shouldn't define this unless
- you know what you are doing. (Use EXTRA_CFLAGS instead.)
-
-EXTRA_CFLAGS="?"
- Append these flags to CFLAGS. This makes it possible to add flags such as
- -Werror, while allowing the configure script to determine what other flags
- are appropriate for the specified configuration.
-
- The configure script specifically checks whether an optimization flag (-O*)
- is specified in EXTRA_CFLAGS, and refrains from specifying an optimization
- level if it finds that one has already been specified.
-
-CPPFLAGS="?"
- Pass these flags to the C preprocessor. Note that CFLAGS is not passed to
- 'cpp' when 'configure' is looking for include files, so you must use
- CPPFLAGS instead if you need to help 'configure' find header files.
-
-LD_LIBRARY_PATH="?"
- 'ld' uses this colon-separated list to find libraries.
-
-LDFLAGS="?"
- Pass these flags when linking.
-
-PATH="?"
- 'configure' uses this to find programs.
-
-=== Advanced compilation =======================================================
-
-To build only parts of jemalloc, use the following targets:
-
- build_lib_shared
- build_lib_static
- build_lib
- build_doc_html
- build_doc_man
- build_doc
-
-To install only parts of jemalloc, use the following targets:
-
- install_bin
- install_include
- install_lib_shared
- install_lib_static
- install_lib
- install_doc_html
- install_doc_man
- install_doc
-
-To clean up build results to varying degrees, use the following make targets:
-
- clean
- distclean
- relclean
-
-=== Advanced installation ======================================================
-
-Optionally, define make variables when invoking make, including (not
-exclusively):
-
-INCLUDEDIR="?"
- Use this as the installation prefix for header files.
-
-LIBDIR="?"
- Use this as the installation prefix for libraries.
-
-MANDIR="?"
- Use this as the installation prefix for man pages.
-
-DESTDIR="?"
- Prepend DESTDIR to INCLUDEDIR, LIBDIR, DATADIR, and MANDIR. This is useful
- when installing to a different path than was specified via --prefix.
-
-CC="?"
- Use this to invoke the C compiler.
-
-CFLAGS="?"
- Pass these flags to the compiler.
-
-CPPFLAGS="?"
- Pass these flags to the C preprocessor.
-
-LDFLAGS="?"
- Pass these flags when linking.
-
-PATH="?"
- Use this to search for programs used during configuration and building.
-
-=== Development ================================================================
-
-If you intend to make non-trivial changes to jemalloc, use the 'autogen.sh'
-script rather than 'configure'. This re-generates 'configure', enables
-configuration dependency rules, and enables re-generation of automatically
-generated source files.
-
-The build system supports using an object directory separate from the source
-tree. For example, you can create an 'obj' directory, and from within that
-directory, issue configuration and build commands:
-
- autoconf
- mkdir obj
- cd obj
- ../configure --enable-autogen
- make
-
-=== Documentation ==============================================================
-
-The manual page is generated in both html and roff formats. Any web browser
-can be used to view the html manual. The roff manual page can be formatted
-prior to installation via the following command:
-
- nroff -man -t doc/jemalloc.3
diff --git a/memory/jemalloc/src/Makefile.in b/memory/jemalloc/src/Makefile.in
deleted file mode 100644
index d13c7f1085..0000000000
--- a/memory/jemalloc/src/Makefile.in
+++ /dev/null
@@ -1,506 +0,0 @@
-# Clear out all vpaths, then set just one (default vpath) for the main build
-# directory.
-vpath
-vpath % .
-
-# Clear the default suffixes, so that built-in rules are not used.
-.SUFFIXES :
-
-SHELL := /bin/sh
-
-CC := @CC@
-
-# Configuration parameters.
-DESTDIR =
-BINDIR := $(DESTDIR)@BINDIR@
-INCLUDEDIR := $(DESTDIR)@INCLUDEDIR@
-LIBDIR := $(DESTDIR)@LIBDIR@
-DATADIR := $(DESTDIR)@DATADIR@
-MANDIR := $(DESTDIR)@MANDIR@
-srcroot := @srcroot@
-objroot := @objroot@
-abs_srcroot := @abs_srcroot@
-abs_objroot := @abs_objroot@
-
-# Build parameters.
-CPPFLAGS := @CPPFLAGS@ -I$(srcroot)include -I$(objroot)include
-EXTRA_CFLAGS := @EXTRA_CFLAGS@
-CFLAGS := @CFLAGS@ $(EXTRA_CFLAGS)
-LDFLAGS := @LDFLAGS@
-EXTRA_LDFLAGS := @EXTRA_LDFLAGS@
-LIBS := @LIBS@
-RPATH_EXTRA := @RPATH_EXTRA@
-SO := @so@
-IMPORTLIB := @importlib@
-O := @o@
-A := @a@
-EXE := @exe@
-LIBPREFIX := @libprefix@
-REV := @rev@
-install_suffix := @install_suffix@
-ABI := @abi@
-XSLTPROC := @XSLTPROC@
-AUTOCONF := @AUTOCONF@
-_RPATH = @RPATH@
-RPATH = $(if $(1),$(call _RPATH,$(1)))
-cfghdrs_in := $(addprefix $(srcroot),@cfghdrs_in@)
-cfghdrs_out := @cfghdrs_out@
-cfgoutputs_in := $(addprefix $(srcroot),@cfgoutputs_in@)
-cfgoutputs_out := @cfgoutputs_out@
-enable_autogen := @enable_autogen@
-enable_code_coverage := @enable_code_coverage@
-enable_prof := @enable_prof@
-enable_valgrind := @enable_valgrind@
-enable_zone_allocator := @enable_zone_allocator@
-MALLOC_CONF := @JEMALLOC_CPREFIX@MALLOC_CONF
-link_whole_archive := @link_whole_archive@
-DSO_LDFLAGS = @DSO_LDFLAGS@
-SOREV = @SOREV@
-PIC_CFLAGS = @PIC_CFLAGS@
-CTARGET = @CTARGET@
-LDTARGET = @LDTARGET@
-TEST_LD_MODE = @TEST_LD_MODE@
-MKLIB = @MKLIB@
-AR = @AR@
-ARFLAGS = @ARFLAGS@
-CC_MM = @CC_MM@
-LM := @LM@
-INSTALL = @INSTALL@
-
-ifeq (macho, $(ABI))
-TEST_LIBRARY_PATH := DYLD_FALLBACK_LIBRARY_PATH="$(objroot)lib"
-else
-ifeq (pecoff, $(ABI))
-TEST_LIBRARY_PATH := PATH="$(PATH):$(objroot)lib"
-else
-TEST_LIBRARY_PATH :=
-endif
-endif
-
-LIBJEMALLOC := $(LIBPREFIX)jemalloc$(install_suffix)
-
-# Lists of files.
-BINS := $(objroot)bin/jemalloc-config $(objroot)bin/jemalloc.sh $(objroot)bin/jeprof
-C_HDRS := $(objroot)include/jemalloc/jemalloc$(install_suffix).h
-C_SRCS := $(srcroot)src/jemalloc.c \
- $(srcroot)src/arena.c \
- $(srcroot)src/atomic.c \
- $(srcroot)src/base.c \
- $(srcroot)src/bitmap.c \
- $(srcroot)src/chunk.c \
- $(srcroot)src/chunk_dss.c \
- $(srcroot)src/chunk_mmap.c \
- $(srcroot)src/ckh.c \
- $(srcroot)src/ctl.c \
- $(srcroot)src/extent.c \
- $(srcroot)src/hash.c \
- $(srcroot)src/huge.c \
- $(srcroot)src/mb.c \
- $(srcroot)src/mutex.c \
- $(srcroot)src/nstime.c \
- $(srcroot)src/pages.c \
- $(srcroot)src/prng.c \
- $(srcroot)src/prof.c \
- $(srcroot)src/quarantine.c \
- $(srcroot)src/rtree.c \
- $(srcroot)src/stats.c \
- $(srcroot)src/spin.c \
- $(srcroot)src/tcache.c \
- $(srcroot)src/ticker.c \
- $(srcroot)src/tsd.c \
- $(srcroot)src/util.c \
- $(srcroot)src/witness.c
-ifeq ($(enable_valgrind), 1)
-C_SRCS += $(srcroot)src/valgrind.c
-endif
-ifeq ($(enable_zone_allocator), 1)
-C_SRCS += $(srcroot)src/zone.c
-endif
-ifeq ($(IMPORTLIB),$(SO))
-STATIC_LIBS := $(objroot)lib/$(LIBJEMALLOC).$(A)
-endif
-ifdef PIC_CFLAGS
-STATIC_LIBS += $(objroot)lib/$(LIBJEMALLOC)_pic.$(A)
-else
-STATIC_LIBS += $(objroot)lib/$(LIBJEMALLOC)_s.$(A)
-endif
-DSOS := $(objroot)lib/$(LIBJEMALLOC).$(SOREV)
-ifneq ($(SOREV),$(SO))
-DSOS += $(objroot)lib/$(LIBJEMALLOC).$(SO)
-endif
-ifeq (1, $(link_whole_archive))
-LJEMALLOC := -Wl,--whole-archive -L$(objroot)lib -l$(LIBJEMALLOC) -Wl,--no-whole-archive
-else
-LJEMALLOC := $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB)
-endif
-PC := $(objroot)jemalloc.pc
-MAN3 := $(objroot)doc/jemalloc$(install_suffix).3
-DOCS_XML := $(objroot)doc/jemalloc$(install_suffix).xml
-DOCS_HTML := $(DOCS_XML:$(objroot)%.xml=$(objroot)%.html)
-DOCS_MAN3 := $(DOCS_XML:$(objroot)%.xml=$(objroot)%.3)
-DOCS := $(DOCS_HTML) $(DOCS_MAN3)
-C_TESTLIB_SRCS := $(srcroot)test/src/btalloc.c $(srcroot)test/src/btalloc_0.c \
- $(srcroot)test/src/btalloc_1.c $(srcroot)test/src/math.c \
- $(srcroot)test/src/mtx.c $(srcroot)test/src/mq.c \
- $(srcroot)test/src/SFMT.c $(srcroot)test/src/test.c \
- $(srcroot)test/src/thd.c $(srcroot)test/src/timer.c
-ifeq (1, $(link_whole_archive))
-C_UTIL_INTEGRATION_SRCS :=
-else
-C_UTIL_INTEGRATION_SRCS := $(srcroot)src/nstime.c $(srcroot)src/util.c
-endif
-TESTS_UNIT := \
- $(srcroot)test/unit/a0.c \
- $(srcroot)test/unit/arena_reset.c \
- $(srcroot)test/unit/atomic.c \
- $(srcroot)test/unit/bitmap.c \
- $(srcroot)test/unit/ckh.c \
- $(srcroot)test/unit/decay.c \
- $(srcroot)test/unit/fork.c \
- $(srcroot)test/unit/hash.c \
- $(srcroot)test/unit/junk.c \
- $(srcroot)test/unit/junk_alloc.c \
- $(srcroot)test/unit/junk_free.c \
- $(srcroot)test/unit/lg_chunk.c \
- $(srcroot)test/unit/mallctl.c \
- $(srcroot)test/unit/math.c \
- $(srcroot)test/unit/mq.c \
- $(srcroot)test/unit/mtx.c \
- $(srcroot)test/unit/ph.c \
- $(srcroot)test/unit/prng.c \
- $(srcroot)test/unit/prof_accum.c \
- $(srcroot)test/unit/prof_active.c \
- $(srcroot)test/unit/prof_gdump.c \
- $(srcroot)test/unit/prof_idump.c \
- $(srcroot)test/unit/prof_reset.c \
- $(srcroot)test/unit/prof_thread_name.c \
- $(srcroot)test/unit/ql.c \
- $(srcroot)test/unit/qr.c \
- $(srcroot)test/unit/quarantine.c \
- $(srcroot)test/unit/rb.c \
- $(srcroot)test/unit/rtree.c \
- $(srcroot)test/unit/run_quantize.c \
- $(srcroot)test/unit/SFMT.c \
- $(srcroot)test/unit/size_classes.c \
- $(srcroot)test/unit/smoothstep.c \
- $(srcroot)test/unit/stats.c \
- $(srcroot)test/unit/ticker.c \
- $(srcroot)test/unit/nstime.c \
- $(srcroot)test/unit/tsd.c \
- $(srcroot)test/unit/util.c \
- $(srcroot)test/unit/witness.c \
- $(srcroot)test/unit/zero.c
-TESTS_INTEGRATION := $(srcroot)test/integration/aligned_alloc.c \
- $(srcroot)test/integration/allocated.c \
- $(srcroot)test/integration/sdallocx.c \
- $(srcroot)test/integration/mallocx.c \
- $(srcroot)test/integration/MALLOCX_ARENA.c \
- $(srcroot)test/integration/overflow.c \
- $(srcroot)test/integration/posix_memalign.c \
- $(srcroot)test/integration/rallocx.c \
- $(srcroot)test/integration/thread_arena.c \
- $(srcroot)test/integration/thread_tcache_enabled.c \
- $(srcroot)test/integration/xallocx.c \
- $(srcroot)test/integration/chunk.c
-TESTS_STRESS := $(srcroot)test/stress/microbench.c
-TESTS := $(TESTS_UNIT) $(TESTS_INTEGRATION) $(TESTS_STRESS)
-
-C_OBJS := $(C_SRCS:$(srcroot)%.c=$(objroot)%.$(O))
-C_PIC_OBJS := $(C_SRCS:$(srcroot)%.c=$(objroot)%.pic.$(O))
-C_JET_OBJS := $(C_SRCS:$(srcroot)%.c=$(objroot)%.jet.$(O))
-C_TESTLIB_UNIT_OBJS := $(C_TESTLIB_SRCS:$(srcroot)%.c=$(objroot)%.unit.$(O))
-C_TESTLIB_INTEGRATION_OBJS := $(C_TESTLIB_SRCS:$(srcroot)%.c=$(objroot)%.integration.$(O))
-C_UTIL_INTEGRATION_OBJS := $(C_UTIL_INTEGRATION_SRCS:$(srcroot)%.c=$(objroot)%.integration.$(O))
-C_TESTLIB_STRESS_OBJS := $(C_TESTLIB_SRCS:$(srcroot)%.c=$(objroot)%.stress.$(O))
-C_TESTLIB_OBJS := $(C_TESTLIB_UNIT_OBJS) $(C_TESTLIB_INTEGRATION_OBJS) $(C_UTIL_INTEGRATION_OBJS) $(C_TESTLIB_STRESS_OBJS)
-
-TESTS_UNIT_OBJS := $(TESTS_UNIT:$(srcroot)%.c=$(objroot)%.$(O))
-TESTS_INTEGRATION_OBJS := $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%.$(O))
-TESTS_STRESS_OBJS := $(TESTS_STRESS:$(srcroot)%.c=$(objroot)%.$(O))
-TESTS_OBJS := $(TESTS_UNIT_OBJS) $(TESTS_INTEGRATION_OBJS) $(TESTS_STRESS_OBJS)
-
-.PHONY: all dist build_doc_html build_doc_man build_doc
-.PHONY: install_bin install_include install_lib
-.PHONY: install_doc_html install_doc_man install_doc install
-.PHONY: tests check clean distclean relclean
-
-.SECONDARY : $(TESTS_OBJS)
-
-# Default target.
-all: build_lib
-
-dist: build_doc
-
-$(objroot)doc/%.html : $(objroot)doc/%.xml $(srcroot)doc/stylesheet.xsl $(objroot)doc/html.xsl
- $(XSLTPROC) -o $@ $(objroot)doc/html.xsl $<
-
-$(objroot)doc/%.3 : $(objroot)doc/%.xml $(srcroot)doc/stylesheet.xsl $(objroot)doc/manpages.xsl
- $(XSLTPROC) -o $@ $(objroot)doc/manpages.xsl $<
-
-build_doc_html: $(DOCS_HTML)
-build_doc_man: $(DOCS_MAN3)
-build_doc: $(DOCS)
-
-#
-# Include generated dependency files.
-#
-ifdef CC_MM
--include $(C_OBJS:%.$(O)=%.d)
--include $(C_PIC_OBJS:%.$(O)=%.d)
--include $(C_JET_OBJS:%.$(O)=%.d)
--include $(C_TESTLIB_OBJS:%.$(O)=%.d)
--include $(TESTS_OBJS:%.$(O)=%.d)
-endif
-
-$(C_OBJS): $(objroot)src/%.$(O): $(srcroot)src/%.c
-$(C_PIC_OBJS): $(objroot)src/%.pic.$(O): $(srcroot)src/%.c
-$(C_PIC_OBJS): CFLAGS += $(PIC_CFLAGS)
-$(C_JET_OBJS): $(objroot)src/%.jet.$(O): $(srcroot)src/%.c
-$(C_JET_OBJS): CFLAGS += -DJEMALLOC_JET
-$(C_TESTLIB_UNIT_OBJS): $(objroot)test/src/%.unit.$(O): $(srcroot)test/src/%.c
-$(C_TESTLIB_UNIT_OBJS): CPPFLAGS += -DJEMALLOC_UNIT_TEST
-$(C_TESTLIB_INTEGRATION_OBJS): $(objroot)test/src/%.integration.$(O): $(srcroot)test/src/%.c
-$(C_TESTLIB_INTEGRATION_OBJS): CPPFLAGS += -DJEMALLOC_INTEGRATION_TEST
-$(C_UTIL_INTEGRATION_OBJS): $(objroot)src/%.integration.$(O): $(srcroot)src/%.c
-$(C_TESTLIB_STRESS_OBJS): $(objroot)test/src/%.stress.$(O): $(srcroot)test/src/%.c
-$(C_TESTLIB_STRESS_OBJS): CPPFLAGS += -DJEMALLOC_STRESS_TEST -DJEMALLOC_STRESS_TESTLIB
-$(C_TESTLIB_OBJS): CPPFLAGS += -I$(srcroot)test/include -I$(objroot)test/include
-$(TESTS_UNIT_OBJS): CPPFLAGS += -DJEMALLOC_UNIT_TEST
-$(TESTS_INTEGRATION_OBJS): CPPFLAGS += -DJEMALLOC_INTEGRATION_TEST
-$(TESTS_STRESS_OBJS): CPPFLAGS += -DJEMALLOC_STRESS_TEST
-$(TESTS_OBJS): $(objroot)test/%.$(O): $(srcroot)test/%.c
-$(TESTS_OBJS): CPPFLAGS += -I$(srcroot)test/include -I$(objroot)test/include
-ifneq ($(IMPORTLIB),$(SO))
-$(C_OBJS) $(C_JET_OBJS): CPPFLAGS += -DDLLEXPORT
-endif
-
-ifndef CC_MM
-# Dependencies.
-HEADER_DIRS = $(srcroot)include/jemalloc/internal \
- $(objroot)include/jemalloc $(objroot)include/jemalloc/internal
-HEADERS = $(wildcard $(foreach dir,$(HEADER_DIRS),$(dir)/*.h))
-$(C_OBJS) $(C_PIC_OBJS) $(C_JET_OBJS) $(C_TESTLIB_OBJS) $(TESTS_OBJS): $(HEADERS)
-$(TESTS_OBJS): $(objroot)test/include/test/jemalloc_test.h
-endif
-
-$(C_OBJS) $(C_PIC_OBJS) $(C_JET_OBJS) $(C_TESTLIB_OBJS) $(TESTS_OBJS): %.$(O):
- @mkdir -p $(@D)
- $(CC) $(CFLAGS) -c $(CPPFLAGS) $(CTARGET) $<
-ifdef CC_MM
- @$(CC) -MM $(CPPFLAGS) -MT $@ -o $(@:%.$(O)=%.d) $<
-endif
-
-ifneq ($(SOREV),$(SO))
-%.$(SO) : %.$(SOREV)
- @mkdir -p $(@D)
- ln -sf $(<F) $@
-endif
-
-$(objroot)lib/$(LIBJEMALLOC).$(SOREV) : $(if $(PIC_CFLAGS),$(C_PIC_OBJS),$(C_OBJS))
- @mkdir -p $(@D)
- $(CC) $(DSO_LDFLAGS) $(call RPATH,$(RPATH_EXTRA)) $(LDTARGET) $+ $(LDFLAGS) $(LIBS) $(EXTRA_LDFLAGS)
-
-$(objroot)lib/$(LIBJEMALLOC)_pic.$(A) : $(C_PIC_OBJS)
-$(objroot)lib/$(LIBJEMALLOC).$(A) : $(C_OBJS)
-$(objroot)lib/$(LIBJEMALLOC)_s.$(A) : $(C_OBJS)
-
-$(STATIC_LIBS):
- @mkdir -p $(@D)
- $(AR) $(ARFLAGS)@AROUT@ $+
-
-$(objroot)test/unit/%$(EXE): $(objroot)test/unit/%.$(O) $(TESTS_UNIT_LINK_OBJS) $(C_JET_OBJS) $(C_TESTLIB_UNIT_OBJS)
- @mkdir -p $(@D)
- $(CC) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(LDFLAGS) $(filter-out -lm,$(LIBS)) $(LM) $(EXTRA_LDFLAGS)
-
-$(objroot)test/integration/%$(EXE): $(objroot)test/integration/%.$(O) $(C_TESTLIB_INTEGRATION_OBJS) $(C_UTIL_INTEGRATION_OBJS) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB)
- @mkdir -p $(@D)
- $(CC) $(TEST_LD_MODE) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(LJEMALLOC) $(LDFLAGS) $(filter-out -lm,$(filter -lrt -lpthread,$(LIBS))) $(LM) $(EXTRA_LDFLAGS)
-
-$(objroot)test/stress/%$(EXE): $(objroot)test/stress/%.$(O) $(C_JET_OBJS) $(C_TESTLIB_STRESS_OBJS) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB)
- @mkdir -p $(@D)
- $(CC) $(TEST_LD_MODE) $(LDTARGET) $(filter %.$(O),$^) $(call RPATH,$(objroot)lib) $(objroot)lib/$(LIBJEMALLOC).$(IMPORTLIB) $(LDFLAGS) $(filter-out -lm,$(LIBS)) $(LM) $(EXTRA_LDFLAGS)
-
-build_lib_shared: $(DSOS)
-build_lib_static: $(STATIC_LIBS)
-build_lib: build_lib_shared build_lib_static
-
-install_bin:
- $(INSTALL) -d $(BINDIR)
- @for b in $(BINS); do \
- echo "$(INSTALL) -m 755 $$b $(BINDIR)"; \
- $(INSTALL) -m 755 $$b $(BINDIR); \
-done
-
-install_include:
- $(INSTALL) -d $(INCLUDEDIR)/jemalloc
- @for h in $(C_HDRS); do \
- echo "$(INSTALL) -m 644 $$h $(INCLUDEDIR)/jemalloc"; \
- $(INSTALL) -m 644 $$h $(INCLUDEDIR)/jemalloc; \
-done
-
-install_lib_shared: $(DSOS)
- $(INSTALL) -d $(LIBDIR)
- $(INSTALL) -m 755 $(objroot)lib/$(LIBJEMALLOC).$(SOREV) $(LIBDIR)
-ifneq ($(SOREV),$(SO))
- ln -sf $(LIBJEMALLOC).$(SOREV) $(LIBDIR)/$(LIBJEMALLOC).$(SO)
-endif
-
-install_lib_static: $(STATIC_LIBS)
- $(INSTALL) -d $(LIBDIR)
- @for l in $(STATIC_LIBS); do \
- echo "$(INSTALL) -m 755 $$l $(LIBDIR)"; \
- $(INSTALL) -m 755 $$l $(LIBDIR); \
-done
-
-install_lib_pc: $(PC)
- $(INSTALL) -d $(LIBDIR)/pkgconfig
- @for l in $(PC); do \
- echo "$(INSTALL) -m 644 $$l $(LIBDIR)/pkgconfig"; \
- $(INSTALL) -m 644 $$l $(LIBDIR)/pkgconfig; \
-done
-
-install_lib: install_lib_shared install_lib_static install_lib_pc
-
-install_doc_html:
- $(INSTALL) -d $(DATADIR)/doc/jemalloc$(install_suffix)
- @for d in $(DOCS_HTML); do \
- echo "$(INSTALL) -m 644 $$d $(DATADIR)/doc/jemalloc$(install_suffix)"; \
- $(INSTALL) -m 644 $$d $(DATADIR)/doc/jemalloc$(install_suffix); \
-done
-
-install_doc_man:
- $(INSTALL) -d $(MANDIR)/man3
- @for d in $(DOCS_MAN3); do \
- echo "$(INSTALL) -m 644 $$d $(MANDIR)/man3"; \
- $(INSTALL) -m 644 $$d $(MANDIR)/man3; \
-done
-
-install_doc: install_doc_html install_doc_man
-
-install: install_bin install_include install_lib install_doc
-
-tests_unit: $(TESTS_UNIT:$(srcroot)%.c=$(objroot)%$(EXE))
-tests_integration: $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%$(EXE))
-tests_stress: $(TESTS_STRESS:$(srcroot)%.c=$(objroot)%$(EXE))
-tests: tests_unit tests_integration tests_stress
-
-check_unit_dir:
- @mkdir -p $(objroot)test/unit
-check_integration_dir:
- @mkdir -p $(objroot)test/integration
-stress_dir:
- @mkdir -p $(objroot)test/stress
-check_dir: check_unit_dir check_integration_dir
-
-check_unit: tests_unit check_unit_dir
- $(MALLOC_CONF)="purge:ratio" $(SHELL) $(objroot)test/test.sh $(TESTS_UNIT:$(srcroot)%.c=$(objroot)%)
- $(MALLOC_CONF)="purge:decay" $(SHELL) $(objroot)test/test.sh $(TESTS_UNIT:$(srcroot)%.c=$(objroot)%)
-check_integration_prof: tests_integration check_integration_dir
-ifeq ($(enable_prof), 1)
- $(MALLOC_CONF)="prof:true" $(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%)
- $(MALLOC_CONF)="prof:true,prof_active:false" $(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%)
-endif
-check_integration_decay: tests_integration check_integration_dir
- $(MALLOC_CONF)="purge:decay,decay_time:-1" $(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%)
- $(MALLOC_CONF)="purge:decay,decay_time:0" $(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%)
- $(MALLOC_CONF)="purge:decay" $(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%)
-check_integration: tests_integration check_integration_dir
- $(SHELL) $(objroot)test/test.sh $(TESTS_INTEGRATION:$(srcroot)%.c=$(objroot)%)
-stress: tests_stress stress_dir
- $(SHELL) $(objroot)test/test.sh $(TESTS_STRESS:$(srcroot)%.c=$(objroot)%)
-check: check_unit check_integration check_integration_decay check_integration_prof
-
-ifeq ($(enable_code_coverage), 1)
-coverage_unit: check_unit
- $(SHELL) $(srcroot)coverage.sh $(srcroot)src jet $(C_JET_OBJS)
- $(SHELL) $(srcroot)coverage.sh $(srcroot)test/src unit $(C_TESTLIB_UNIT_OBJS)
- $(SHELL) $(srcroot)coverage.sh $(srcroot)test/unit unit $(TESTS_UNIT_OBJS)
-
-coverage_integration: check_integration
- $(SHELL) $(srcroot)coverage.sh $(srcroot)src pic $(C_PIC_OBJS)
- $(SHELL) $(srcroot)coverage.sh $(srcroot)src integration $(C_UTIL_INTEGRATION_OBJS)
- $(SHELL) $(srcroot)coverage.sh $(srcroot)test/src integration $(C_TESTLIB_INTEGRATION_OBJS)
- $(SHELL) $(srcroot)coverage.sh $(srcroot)test/integration integration $(TESTS_INTEGRATION_OBJS)
-
-coverage_stress: stress
- $(SHELL) $(srcroot)coverage.sh $(srcroot)src pic $(C_PIC_OBJS)
- $(SHELL) $(srcroot)coverage.sh $(srcroot)src jet $(C_JET_OBJS)
- $(SHELL) $(srcroot)coverage.sh $(srcroot)test/src stress $(C_TESTLIB_STRESS_OBJS)
- $(SHELL) $(srcroot)coverage.sh $(srcroot)test/stress stress $(TESTS_STRESS_OBJS)
-
-coverage: check
- $(SHELL) $(srcroot)coverage.sh $(srcroot)src pic $(C_PIC_OBJS)
- $(SHELL) $(srcroot)coverage.sh $(srcroot)src jet $(C_JET_OBJS)
- $(SHELL) $(srcroot)coverage.sh $(srcroot)src integration $(C_UTIL_INTEGRATION_OBJS)
- $(SHELL) $(srcroot)coverage.sh $(srcroot)test/src unit $(C_TESTLIB_UNIT_OBJS)
- $(SHELL) $(srcroot)coverage.sh $(srcroot)test/src integration $(C_TESTLIB_INTEGRATION_OBJS)
- $(SHELL) $(srcroot)coverage.sh $(srcroot)test/src stress $(C_TESTLIB_STRESS_OBJS)
- $(SHELL) $(srcroot)coverage.sh $(srcroot)test/unit unit $(TESTS_UNIT_OBJS) $(TESTS_UNIT_AUX_OBJS)
- $(SHELL) $(srcroot)coverage.sh $(srcroot)test/integration integration $(TESTS_INTEGRATION_OBJS)
- $(SHELL) $(srcroot)coverage.sh $(srcroot)test/stress integration $(TESTS_STRESS_OBJS)
-endif
-
-clean:
- rm -f $(C_OBJS)
- rm -f $(C_PIC_OBJS)
- rm -f $(C_JET_OBJS)
- rm -f $(C_TESTLIB_OBJS)
- rm -f $(C_OBJS:%.$(O)=%.d)
- rm -f $(C_OBJS:%.$(O)=%.gcda)
- rm -f $(C_OBJS:%.$(O)=%.gcno)
- rm -f $(C_PIC_OBJS:%.$(O)=%.d)
- rm -f $(C_PIC_OBJS:%.$(O)=%.gcda)
- rm -f $(C_PIC_OBJS:%.$(O)=%.gcno)
- rm -f $(C_JET_OBJS:%.$(O)=%.d)
- rm -f $(C_JET_OBJS:%.$(O)=%.gcda)
- rm -f $(C_JET_OBJS:%.$(O)=%.gcno)
- rm -f $(C_TESTLIB_OBJS:%.$(O)=%.d)
- rm -f $(C_TESTLIB_OBJS:%.$(O)=%.gcda)
- rm -f $(C_TESTLIB_OBJS:%.$(O)=%.gcno)
- rm -f $(TESTS_OBJS:%.$(O)=%$(EXE))
- rm -f $(TESTS_OBJS)
- rm -f $(TESTS_OBJS:%.$(O)=%.d)
- rm -f $(TESTS_OBJS:%.$(O)=%.gcda)
- rm -f $(TESTS_OBJS:%.$(O)=%.gcno)
- rm -f $(TESTS_OBJS:%.$(O)=%.out)
- rm -f $(DSOS) $(STATIC_LIBS)
- rm -f $(objroot)*.gcov.*
-
-distclean: clean
- rm -f $(objroot)bin/jemalloc-config
- rm -f $(objroot)bin/jemalloc.sh
- rm -f $(objroot)bin/jeprof
- rm -f $(objroot)config.log
- rm -f $(objroot)config.status
- rm -f $(objroot)config.stamp
- rm -f $(cfghdrs_out)
- rm -f $(cfgoutputs_out)
-
-relclean: distclean
- rm -f $(objroot)configure
- rm -f $(objroot)VERSION
- rm -f $(DOCS_HTML)
- rm -f $(DOCS_MAN3)
-
-#===============================================================================
-# Re-configuration rules.
-
-ifeq ($(enable_autogen), 1)
-$(srcroot)configure : $(srcroot)configure.ac
- cd ./$(srcroot) && $(AUTOCONF)
-
-$(objroot)config.status : $(srcroot)configure
- ./$(objroot)config.status --recheck
-
-$(srcroot)config.stamp.in : $(srcroot)configure.ac
- echo stamp > $(srcroot)config.stamp.in
-
-$(objroot)config.stamp : $(cfgoutputs_in) $(cfghdrs_in) $(srcroot)configure
- ./$(objroot)config.status
- @touch $@
-
-# There must be some action in order for make to re-read Makefile when it is
-# out of date.
-$(cfgoutputs_out) $(cfghdrs_out) : $(objroot)config.stamp
- @true
-endif
diff --git a/memory/jemalloc/src/README b/memory/jemalloc/src/README
deleted file mode 100644
index 5ff24a9ef0..0000000000
--- a/memory/jemalloc/src/README
+++ /dev/null
@@ -1,20 +0,0 @@
-jemalloc is a general purpose malloc(3) implementation that emphasizes
-fragmentation avoidance and scalable concurrency support. jemalloc first came
-into use as the FreeBSD libc allocator in 2005, and since then it has found its
-way into numerous applications that rely on its predictable behavior. In 2010
-jemalloc development efforts broadened to include developer support features
-such as heap profiling, Valgrind integration, and extensive monitoring/tuning
-hooks. Modern jemalloc releases continue to be integrated back into FreeBSD,
-and therefore versatility remains critical. Ongoing development efforts trend
-toward making jemalloc among the best allocators for a broad range of demanding
-applications, and eliminating/mitigating weaknesses that have practical
-repercussions for real world applications.
-
-The COPYING file contains copyright and licensing information.
-
-The INSTALL file contains information on how to configure, build, and install
-jemalloc.
-
-The ChangeLog file contains a brief summary of changes for each release.
-
-URL: http://jemalloc.net/
diff --git a/memory/jemalloc/src/VERSION b/memory/jemalloc/src/VERSION
deleted file mode 100644
index c108ecb84a..0000000000
--- a/memory/jemalloc/src/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-4.3.1-0-g0110fa8451af905affd77c3bea0d545fee2251b2
diff --git a/memory/jemalloc/src/autogen.sh b/memory/jemalloc/src/autogen.sh
deleted file mode 100755
index 75f32da687..0000000000
--- a/memory/jemalloc/src/autogen.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-for i in autoconf; do
- echo "$i"
- $i
- if [ $? -ne 0 ]; then
- echo "Error $? in $i"
- exit 1
- fi
-done
-
-echo "./configure --enable-autogen $@"
-./configure --enable-autogen $@
-if [ $? -ne 0 ]; then
- echo "Error $? in ./configure"
- exit 1
-fi
diff --git a/memory/jemalloc/src/bin/jemalloc-config.in b/memory/jemalloc/src/bin/jemalloc-config.in
deleted file mode 100644
index b016c8d331..0000000000
--- a/memory/jemalloc/src/bin/jemalloc-config.in
+++ /dev/null
@@ -1,79 +0,0 @@
-#!/bin/sh
-
-usage() {
- cat <<EOF
-Usage:
- @BINDIR@/jemalloc-config <option>
-Options:
- --help | -h : Print usage.
- --version : Print jemalloc version.
- --revision : Print shared library revision number.
- --config : Print configure options used to build jemalloc.
- --prefix : Print installation directory prefix.
- --bindir : Print binary installation directory.
- --datadir : Print data installation directory.
- --includedir : Print include installation directory.
- --libdir : Print library installation directory.
- --mandir : Print manual page installation directory.
- --cc : Print compiler used to build jemalloc.
- --cflags : Print compiler flags used to build jemalloc.
- --cppflags : Print preprocessor flags used to build jemalloc.
- --ldflags : Print library flags used to build jemalloc.
- --libs : Print libraries jemalloc was linked against.
-EOF
-}
-
-prefix="@prefix@"
-exec_prefix="@exec_prefix@"
-
-case "$1" in
---help | -h)
- usage
- exit 0
- ;;
---version)
- echo "@jemalloc_version@"
- ;;
---revision)
- echo "@rev@"
- ;;
---config)
- echo "@CONFIG@"
- ;;
---prefix)
- echo "@PREFIX@"
- ;;
---bindir)
- echo "@BINDIR@"
- ;;
---datadir)
- echo "@DATADIR@"
- ;;
---includedir)
- echo "@INCLUDEDIR@"
- ;;
---libdir)
- echo "@LIBDIR@"
- ;;
---mandir)
- echo "@MANDIR@"
- ;;
---cc)
- echo "@CC@"
- ;;
---cflags)
- echo "@CFLAGS@"
- ;;
---cppflags)
- echo "@CPPFLAGS@"
- ;;
---ldflags)
- echo "@LDFLAGS@ @EXTRA_LDFLAGS@"
- ;;
---libs)
- echo "@LIBS@"
- ;;
-*)
- usage
- exit 1
-esac
diff --git a/memory/jemalloc/src/bin/jemalloc.sh.in b/memory/jemalloc/src/bin/jemalloc.sh.in
deleted file mode 100644
index cdf3673759..0000000000
--- a/memory/jemalloc/src/bin/jemalloc.sh.in
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-
-@LD_PRELOAD_VAR@=${libdir}/libjemalloc.@SOREV@
-export @LD_PRELOAD_VAR@
-exec "$@"
diff --git a/memory/jemalloc/src/bin/jeprof.in b/memory/jemalloc/src/bin/jeprof.in
deleted file mode 100644
index 42087fcec2..0000000000
--- a/memory/jemalloc/src/bin/jeprof.in
+++ /dev/null
@@ -1,5611 +0,0 @@
-#! /usr/bin/env perl
-
-# Copyright (c) 1998-2007, Google Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions are
-# met:
-#
-# * Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# * Redistributions in binary form must reproduce the above
-# copyright notice, this list of conditions and the following disclaimer
-# in the documentation and/or other materials provided with the
-# distribution.
-# * Neither the name of Google Inc. nor the names of its
-# contributors may be used to endorse or promote products derived from
-# this software without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-# ---
-# Program for printing the profile generated by common/profiler.cc,
-# or by the heap profiler (common/debugallocation.cc)
-#
-# The profile contains a sequence of entries of the form:
-# <count> <stack trace>
-# This program parses the profile, and generates user-readable
-# output.
-#
-# Examples:
-#
-# % tools/jeprof "program" "profile"
-# Enters "interactive" mode
-#
-# % tools/jeprof --text "program" "profile"
-# Generates one line per procedure
-#
-# % tools/jeprof --gv "program" "profile"
-# Generates annotated call-graph and displays via "gv"
-#
-# % tools/jeprof --gv --focus=Mutex "program" "profile"
-# Restrict to code paths that involve an entry that matches "Mutex"
-#
-# % tools/jeprof --gv --focus=Mutex --ignore=string "program" "profile"
-# Restrict to code paths that involve an entry that matches "Mutex"
-# and does not match "string"
-#
-# % tools/jeprof --list=IBF_CheckDocid "program" "profile"
-# Generates disassembly listing of all routines with at least one
-# sample that match the --list=<regexp> pattern. The listing is
-# annotated with the flat and cumulative sample counts at each line.
-#
-# % tools/jeprof --disasm=IBF_CheckDocid "program" "profile"
-# Generates disassembly listing of all routines with at least one
-# sample that match the --disasm=<regexp> pattern. The listing is
-# annotated with the flat and cumulative sample counts at each PC value.
-#
-# TODO: Use color to indicate files?
-
-use strict;
-use warnings;
-use Getopt::Long;
-
-my $JEPROF_VERSION = "@jemalloc_version@";
-my $PPROF_VERSION = "2.0";
-
-# These are the object tools we use which can come from a
-# user-specified location using --tools, from the JEPROF_TOOLS
-# environment variable, or from the environment.
-my %obj_tool_map = (
- "objdump" => "objdump",
- "nm" => "nm",
- "addr2line" => "addr2line",
- "c++filt" => "c++filt",
- ## ConfigureObjTools may add architecture-specific entries:
- #"nm_pdb" => "nm-pdb", # for reading windows (PDB-format) executables
- #"addr2line_pdb" => "addr2line-pdb", # ditto
- #"otool" => "otool", # equivalent of objdump on OS X
-);
-# NOTE: these are lists, so you can put in commandline flags if you want.
-my @DOT = ("dot"); # leave non-absolute, since it may be in /usr/local
-my @GV = ("gv");
-my @EVINCE = ("evince"); # could also be xpdf or perhaps acroread
-my @KCACHEGRIND = ("kcachegrind");
-my @PS2PDF = ("ps2pdf");
-# These are used for dynamic profiles
-my @URL_FETCHER = ("curl", "-s", "--fail");
-
-# These are the web pages that servers need to support for dynamic profiles
-my $HEAP_PAGE = "/pprof/heap";
-my $PROFILE_PAGE = "/pprof/profile"; # must support cgi-param "?seconds=#"
-my $PMUPROFILE_PAGE = "/pprof/pmuprofile(?:\\?.*)?"; # must support cgi-param
- # ?seconds=#&event=x&period=n
-my $GROWTH_PAGE = "/pprof/growth";
-my $CONTENTION_PAGE = "/pprof/contention";
-my $WALL_PAGE = "/pprof/wall(?:\\?.*)?"; # accepts options like namefilter
-my $FILTEREDPROFILE_PAGE = "/pprof/filteredprofile(?:\\?.*)?";
-my $CENSUSPROFILE_PAGE = "/pprof/censusprofile(?:\\?.*)?"; # must support cgi-param
- # "?seconds=#",
- # "?tags_regexp=#" and
- # "?type=#".
-my $SYMBOL_PAGE = "/pprof/symbol"; # must support symbol lookup via POST
-my $PROGRAM_NAME_PAGE = "/pprof/cmdline";
-
-# These are the web pages that can be named on the command line.
-# All the alternatives must begin with /.
-my $PROFILES = "($HEAP_PAGE|$PROFILE_PAGE|$PMUPROFILE_PAGE|" .
- "$GROWTH_PAGE|$CONTENTION_PAGE|$WALL_PAGE|" .
- "$FILTEREDPROFILE_PAGE|$CENSUSPROFILE_PAGE)";
-
-# default binary name
-my $UNKNOWN_BINARY = "(unknown)";
-
-# There is a pervasive dependency on the length (in hex characters,
-# i.e., nibbles) of an address, distinguishing between 32-bit and
-# 64-bit profiles. To err on the safe size, default to 64-bit here:
-my $address_length = 16;
-
-my $dev_null = "/dev/null";
-if (! -e $dev_null && $^O =~ /MSWin/) { # $^O is the OS perl was built for
- $dev_null = "nul";
-}
-
-# A list of paths to search for shared object files
-my @prefix_list = ();
-
-# Special routine name that should not have any symbols.
-# Used as separator to parse "addr2line -i" output.
-my $sep_symbol = '_fini';
-my $sep_address = undef;
-
-##### Argument parsing #####
-
-sub usage_string {
- return <<EOF;
-Usage:
-jeprof [options] <program> <profiles>
- <profiles> is a space separated list of profile names.
-jeprof [options] <symbolized-profiles>
- <symbolized-profiles> is a list of profile files where each file contains
- the necessary symbol mappings as well as profile data (likely generated
- with --raw).
-jeprof [options] <profile>
- <profile> is a remote form. Symbols are obtained from host:port$SYMBOL_PAGE
-
- Each name can be:
- /path/to/profile - a path to a profile file
- host:port[/<service>] - a location of a service to get profile from
-
- The /<service> can be $HEAP_PAGE, $PROFILE_PAGE, /pprof/pmuprofile,
- $GROWTH_PAGE, $CONTENTION_PAGE, /pprof/wall,
- $CENSUSPROFILE_PAGE, or /pprof/filteredprofile.
- For instance:
- jeprof http://myserver.com:80$HEAP_PAGE
- If /<service> is omitted, the service defaults to $PROFILE_PAGE (cpu profiling).
-jeprof --symbols <program>
- Maps addresses to symbol names. In this mode, stdin should be a
- list of library mappings, in the same format as is found in the heap-
- and cpu-profile files (this loosely matches that of /proc/self/maps
- on linux), followed by a list of hex addresses to map, one per line.
-
- For more help with querying remote servers, including how to add the
- necessary server-side support code, see this filename (or one like it):
-
- /usr/doc/gperftools-$PPROF_VERSION/pprof_remote_servers.html
-
-Options:
- --cum Sort by cumulative data
- --base=<base> Subtract <base> from <profile> before display
- --interactive Run in interactive mode (interactive "help" gives help) [default]
- --seconds=<n> Length of time for dynamic profiles [default=30 secs]
- --add_lib=<file> Read additional symbols and line info from the given library
- --lib_prefix=<dir> Comma separated list of library path prefixes
-
-Reporting Granularity:
- --addresses Report at address level
- --lines Report at source line level
- --functions Report at function level [default]
- --files Report at source file level
-
-Output type:
- --text Generate text report
- --callgrind Generate callgrind format to stdout
- --gv Generate Postscript and display
- --evince Generate PDF and display
- --web Generate SVG and display
- --list=<regexp> Generate source listing of matching routines
- --disasm=<regexp> Generate disassembly of matching routines
- --symbols Print demangled symbol names found at given addresses
- --dot Generate DOT file to stdout
- --ps Generate Postcript to stdout
- --pdf Generate PDF to stdout
- --svg Generate SVG to stdout
- --gif Generate GIF to stdout
- --raw Generate symbolized jeprof data (useful with remote fetch)
-
-Heap-Profile Options:
- --inuse_space Display in-use (mega)bytes [default]
- --inuse_objects Display in-use objects
- --alloc_space Display allocated (mega)bytes
- --alloc_objects Display allocated objects
- --show_bytes Display space in bytes
- --drop_negative Ignore negative differences
-
-Contention-profile options:
- --total_delay Display total delay at each region [default]
- --contentions Display number of delays at each region
- --mean_delay Display mean delay at each region
-
-Call-graph Options:
- --nodecount=<n> Show at most so many nodes [default=80]
- --nodefraction=<f> Hide nodes below <f>*total [default=.005]
- --edgefraction=<f> Hide edges below <f>*total [default=.001]
- --maxdegree=<n> Max incoming/outgoing edges per node [default=8]
- --focus=<regexp> Focus on backtraces with nodes matching <regexp>
- --thread=<n> Show profile for thread <n>
- --ignore=<regexp> Ignore backtraces with nodes matching <regexp>
- --scale=<n> Set GV scaling [default=0]
- --heapcheck Make nodes with non-0 object counts
- (i.e. direct leak generators) more visible
- --retain=<regexp> Retain only nodes that match <regexp>
- --exclude=<regexp> Exclude all nodes that match <regexp>
-
-Miscellaneous:
- --tools=<prefix or binary:fullpath>[,...] \$PATH for object tool pathnames
- --test Run unit tests
- --help This message
- --version Version information
-
-Environment Variables:
- JEPROF_TMPDIR Profiles directory. Defaults to \$HOME/jeprof
- JEPROF_TOOLS Prefix for object tools pathnames
-
-Examples:
-
-jeprof /bin/ls ls.prof
- Enters "interactive" mode
-jeprof --text /bin/ls ls.prof
- Outputs one line per procedure
-jeprof --web /bin/ls ls.prof
- Displays annotated call-graph in web browser
-jeprof --gv /bin/ls ls.prof
- Displays annotated call-graph via 'gv'
-jeprof --gv --focus=Mutex /bin/ls ls.prof
- Restricts to code paths including a .*Mutex.* entry
-jeprof --gv --focus=Mutex --ignore=string /bin/ls ls.prof
- Code paths including Mutex but not string
-jeprof --list=getdir /bin/ls ls.prof
- (Per-line) annotated source listing for getdir()
-jeprof --disasm=getdir /bin/ls ls.prof
- (Per-PC) annotated disassembly for getdir()
-
-jeprof http://localhost:1234/
- Enters "interactive" mode
-jeprof --text localhost:1234
- Outputs one line per procedure for localhost:1234
-jeprof --raw localhost:1234 > ./local.raw
-jeprof --text ./local.raw
- Fetches a remote profile for later analysis and then
- analyzes it in text mode.
-EOF
-}
-
-sub version_string {
- return <<EOF
-jeprof (part of jemalloc $JEPROF_VERSION)
-based on pprof (part of gperftools $PPROF_VERSION)
-
-Copyright 1998-2007 Google Inc.
-
-This is BSD licensed software; see the source for copying conditions
-and license information.
-There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
-PARTICULAR PURPOSE.
-EOF
-}
-
-sub usage {
- my $msg = shift;
- print STDERR "$msg\n\n";
- print STDERR usage_string();
- print STDERR "\nFATAL ERROR: $msg\n"; # just as a reminder
- exit(1);
-}
-
-sub Init() {
- # Setup tmp-file name and handler to clean it up.
- # We do this in the very beginning so that we can use
- # error() and cleanup() function anytime here after.
- $main::tmpfile_sym = "/tmp/jeprof$$.sym";
- $main::tmpfile_ps = "/tmp/jeprof$$";
- $main::next_tmpfile = 0;
- $SIG{'INT'} = \&sighandler;
-
- # Cache from filename/linenumber to source code
- $main::source_cache = ();
-
- $main::opt_help = 0;
- $main::opt_version = 0;
-
- $main::opt_cum = 0;
- $main::opt_base = '';
- $main::opt_addresses = 0;
- $main::opt_lines = 0;
- $main::opt_functions = 0;
- $main::opt_files = 0;
- $main::opt_lib_prefix = "";
-
- $main::opt_text = 0;
- $main::opt_callgrind = 0;
- $main::opt_list = "";
- $main::opt_disasm = "";
- $main::opt_symbols = 0;
- $main::opt_gv = 0;
- $main::opt_evince = 0;
- $main::opt_web = 0;
- $main::opt_dot = 0;
- $main::opt_ps = 0;
- $main::opt_pdf = 0;
- $main::opt_gif = 0;
- $main::opt_svg = 0;
- $main::opt_raw = 0;
-
- $main::opt_nodecount = 80;
- $main::opt_nodefraction = 0.005;
- $main::opt_edgefraction = 0.001;
- $main::opt_maxdegree = 8;
- $main::opt_focus = '';
- $main::opt_thread = undef;
- $main::opt_ignore = '';
- $main::opt_scale = 0;
- $main::opt_heapcheck = 0;
- $main::opt_retain = '';
- $main::opt_exclude = '';
- $main::opt_seconds = 30;
- $main::opt_lib = "";
-
- $main::opt_inuse_space = 0;
- $main::opt_inuse_objects = 0;
- $main::opt_alloc_space = 0;
- $main::opt_alloc_objects = 0;
- $main::opt_show_bytes = 0;
- $main::opt_drop_negative = 0;
- $main::opt_interactive = 0;
-
- $main::opt_total_delay = 0;
- $main::opt_contentions = 0;
- $main::opt_mean_delay = 0;
-
- $main::opt_tools = "";
- $main::opt_debug = 0;
- $main::opt_test = 0;
-
- # These are undocumented flags used only by unittests.
- $main::opt_test_stride = 0;
-
- # Are we using $SYMBOL_PAGE?
- $main::use_symbol_page = 0;
-
- # Files returned by TempName.
- %main::tempnames = ();
-
- # Type of profile we are dealing with
- # Supported types:
- # cpu
- # heap
- # growth
- # contention
- $main::profile_type = ''; # Empty type means "unknown"
-
- GetOptions("help!" => \$main::opt_help,
- "version!" => \$main::opt_version,
- "cum!" => \$main::opt_cum,
- "base=s" => \$main::opt_base,
- "seconds=i" => \$main::opt_seconds,
- "add_lib=s" => \$main::opt_lib,
- "lib_prefix=s" => \$main::opt_lib_prefix,
- "functions!" => \$main::opt_functions,
- "lines!" => \$main::opt_lines,
- "addresses!" => \$main::opt_addresses,
- "files!" => \$main::opt_files,
- "text!" => \$main::opt_text,
- "callgrind!" => \$main::opt_callgrind,
- "list=s" => \$main::opt_list,
- "disasm=s" => \$main::opt_disasm,
- "symbols!" => \$main::opt_symbols,
- "gv!" => \$main::opt_gv,
- "evince!" => \$main::opt_evince,
- "web!" => \$main::opt_web,
- "dot!" => \$main::opt_dot,
- "ps!" => \$main::opt_ps,
- "pdf!" => \$main::opt_pdf,
- "svg!" => \$main::opt_svg,
- "gif!" => \$main::opt_gif,
- "raw!" => \$main::opt_raw,
- "interactive!" => \$main::opt_interactive,
- "nodecount=i" => \$main::opt_nodecount,
- "nodefraction=f" => \$main::opt_nodefraction,
- "edgefraction=f" => \$main::opt_edgefraction,
- "maxdegree=i" => \$main::opt_maxdegree,
- "focus=s" => \$main::opt_focus,
- "thread=s" => \$main::opt_thread,
- "ignore=s" => \$main::opt_ignore,
- "scale=i" => \$main::opt_scale,
- "heapcheck" => \$main::opt_heapcheck,
- "retain=s" => \$main::opt_retain,
- "exclude=s" => \$main::opt_exclude,
- "inuse_space!" => \$main::opt_inuse_space,
- "inuse_objects!" => \$main::opt_inuse_objects,
- "alloc_space!" => \$main::opt_alloc_space,
- "alloc_objects!" => \$main::opt_alloc_objects,
- "show_bytes!" => \$main::opt_show_bytes,
- "drop_negative!" => \$main::opt_drop_negative,
- "total_delay!" => \$main::opt_total_delay,
- "contentions!" => \$main::opt_contentions,
- "mean_delay!" => \$main::opt_mean_delay,
- "tools=s" => \$main::opt_tools,
- "test!" => \$main::opt_test,
- "debug!" => \$main::opt_debug,
- # Undocumented flags used only by unittests:
- "test_stride=i" => \$main::opt_test_stride,
- ) || usage("Invalid option(s)");
-
- # Deal with the standard --help and --version
- if ($main::opt_help) {
- print usage_string();
- exit(0);
- }
-
- if ($main::opt_version) {
- print version_string();
- exit(0);
- }
-
- # Disassembly/listing/symbols mode requires address-level info
- if ($main::opt_disasm || $main::opt_list || $main::opt_symbols) {
- $main::opt_functions = 0;
- $main::opt_lines = 0;
- $main::opt_addresses = 1;
- $main::opt_files = 0;
- }
-
- # Check heap-profiling flags
- if ($main::opt_inuse_space +
- $main::opt_inuse_objects +
- $main::opt_alloc_space +
- $main::opt_alloc_objects > 1) {
- usage("Specify at most on of --inuse/--alloc options");
- }
-
- # Check output granularities
- my $grains =
- $main::opt_functions +
- $main::opt_lines +
- $main::opt_addresses +
- $main::opt_files +
- 0;
- if ($grains > 1) {
- usage("Only specify one output granularity option");
- }
- if ($grains == 0) {
- $main::opt_functions = 1;
- }
-
- # Check output modes
- my $modes =
- $main::opt_text +
- $main::opt_callgrind +
- ($main::opt_list eq '' ? 0 : 1) +
- ($main::opt_disasm eq '' ? 0 : 1) +
- ($main::opt_symbols == 0 ? 0 : 1) +
- $main::opt_gv +
- $main::opt_evince +
- $main::opt_web +
- $main::opt_dot +
- $main::opt_ps +
- $main::opt_pdf +
- $main::opt_svg +
- $main::opt_gif +
- $main::opt_raw +
- $main::opt_interactive +
- 0;
- if ($modes > 1) {
- usage("Only specify one output mode");
- }
- if ($modes == 0) {
- if (-t STDOUT) { # If STDOUT is a tty, activate interactive mode
- $main::opt_interactive = 1;
- } else {
- $main::opt_text = 1;
- }
- }
-
- if ($main::opt_test) {
- RunUnitTests();
- # Should not return
- exit(1);
- }
-
- # Binary name and profile arguments list
- $main::prog = "";
- @main::pfile_args = ();
-
- # Remote profiling without a binary (using $SYMBOL_PAGE instead)
- if (@ARGV > 0) {
- if (IsProfileURL($ARGV[0])) {
- $main::use_symbol_page = 1;
- } elsif (IsSymbolizedProfileFile($ARGV[0])) {
- $main::use_symbolized_profile = 1;
- $main::prog = $UNKNOWN_BINARY; # will be set later from the profile file
- }
- }
-
- if ($main::use_symbol_page || $main::use_symbolized_profile) {
- # We don't need a binary!
- my %disabled = ('--lines' => $main::opt_lines,
- '--disasm' => $main::opt_disasm);
- for my $option (keys %disabled) {
- usage("$option cannot be used without a binary") if $disabled{$option};
- }
- # Set $main::prog later...
- scalar(@ARGV) || usage("Did not specify profile file");
- } elsif ($main::opt_symbols) {
- # --symbols needs a binary-name (to run nm on, etc) but not profiles
- $main::prog = shift(@ARGV) || usage("Did not specify program");
- } else {
- $main::prog = shift(@ARGV) || usage("Did not specify program");
- scalar(@ARGV) || usage("Did not specify profile file");
- }
-
- # Parse profile file/location arguments
- foreach my $farg (@ARGV) {
- if ($farg =~ m/(.*)\@([0-9]+)(|\/.*)$/ ) {
- my $machine = $1;
- my $num_machines = $2;
- my $path = $3;
- for (my $i = 0; $i < $num_machines; $i++) {
- unshift(@main::pfile_args, "$i.$machine$path");
- }
- } else {
- unshift(@main::pfile_args, $farg);
- }
- }
-
- if ($main::use_symbol_page) {
- unless (IsProfileURL($main::pfile_args[0])) {
- error("The first profile should be a remote form to use $SYMBOL_PAGE\n");
- }
- CheckSymbolPage();
- $main::prog = FetchProgramName();
- } elsif (!$main::use_symbolized_profile) { # may not need objtools!
- ConfigureObjTools($main::prog)
- }
-
- # Break the opt_lib_prefix into the prefix_list array
- @prefix_list = split (',', $main::opt_lib_prefix);
-
- # Remove trailing / from the prefixes, in the list to prevent
- # searching things like /my/path//lib/mylib.so
- foreach (@prefix_list) {
- s|/+$||;
- }
-}
-
-sub FilterAndPrint {
- my ($profile, $symbols, $libs, $thread) = @_;
-
- # Get total data in profile
- my $total = TotalProfile($profile);
-
- # Remove uniniteresting stack items
- $profile = RemoveUninterestingFrames($symbols, $profile);
-
- # Focus?
- if ($main::opt_focus ne '') {
- $profile = FocusProfile($symbols, $profile, $main::opt_focus);
- }
-
- # Ignore?
- if ($main::opt_ignore ne '') {
- $profile = IgnoreProfile($symbols, $profile, $main::opt_ignore);
- }
-
- my $calls = ExtractCalls($symbols, $profile);
-
- # Reduce profiles to required output granularity, and also clean
- # each stack trace so a given entry exists at most once.
- my $reduced = ReduceProfile($symbols, $profile);
-
- # Get derived profiles
- my $flat = FlatProfile($reduced);
- my $cumulative = CumulativeProfile($reduced);
-
- # Print
- if (!$main::opt_interactive) {
- if ($main::opt_disasm) {
- PrintDisassembly($libs, $flat, $cumulative, $main::opt_disasm);
- } elsif ($main::opt_list) {
- PrintListing($total, $libs, $flat, $cumulative, $main::opt_list, 0);
- } elsif ($main::opt_text) {
- # Make sure the output is empty when have nothing to report
- # (only matters when --heapcheck is given but we must be
- # compatible with old branches that did not pass --heapcheck always):
- if ($total != 0) {
- printf("Total%s: %s %s\n",
- (defined($thread) ? " (t$thread)" : ""),
- Unparse($total), Units());
- }
- PrintText($symbols, $flat, $cumulative, -1);
- } elsif ($main::opt_raw) {
- PrintSymbolizedProfile($symbols, $profile, $main::prog);
- } elsif ($main::opt_callgrind) {
- PrintCallgrind($calls);
- } else {
- if (PrintDot($main::prog, $symbols, $profile, $flat, $cumulative, $total)) {
- if ($main::opt_gv) {
- RunGV(TempName($main::next_tmpfile, "ps"), "");
- } elsif ($main::opt_evince) {
- RunEvince(TempName($main::next_tmpfile, "pdf"), "");
- } elsif ($main::opt_web) {
- my $tmp = TempName($main::next_tmpfile, "svg");
- RunWeb($tmp);
- # The command we run might hand the file name off
- # to an already running browser instance and then exit.
- # Normally, we'd remove $tmp on exit (right now),
- # but fork a child to remove $tmp a little later, so that the
- # browser has time to load it first.
- delete $main::tempnames{$tmp};
- if (fork() == 0) {
- sleep 5;
- unlink($tmp);
- exit(0);
- }
- }
- } else {
- cleanup();
- exit(1);
- }
- }
- } else {
- InteractiveMode($profile, $symbols, $libs, $total);
- }
-}
-
-sub Main() {
- Init();
- $main::collected_profile = undef;
- @main::profile_files = ();
- $main::op_time = time();
-
- # Printing symbols is special and requires a lot less info that most.
- if ($main::opt_symbols) {
- PrintSymbols(*STDIN); # Get /proc/maps and symbols output from stdin
- return;
- }
-
- # Fetch all profile data
- FetchDynamicProfiles();
-
- # this will hold symbols that we read from the profile files
- my $symbol_map = {};
-
- # Read one profile, pick the last item on the list
- my $data = ReadProfile($main::prog, pop(@main::profile_files));
- my $profile = $data->{profile};
- my $pcs = $data->{pcs};
- my $libs = $data->{libs}; # Info about main program and shared libraries
- $symbol_map = MergeSymbols($symbol_map, $data->{symbols});
-
- # Add additional profiles, if available.
- if (scalar(@main::profile_files) > 0) {
- foreach my $pname (@main::profile_files) {
- my $data2 = ReadProfile($main::prog, $pname);
- $profile = AddProfile($profile, $data2->{profile});
- $pcs = AddPcs($pcs, $data2->{pcs});
- $symbol_map = MergeSymbols($symbol_map, $data2->{symbols});
- }
- }
-
- # Subtract base from profile, if specified
- if ($main::opt_base ne '') {
- my $base = ReadProfile($main::prog, $main::opt_base);
- $profile = SubtractProfile($profile, $base->{profile});
- $pcs = AddPcs($pcs, $base->{pcs});
- $symbol_map = MergeSymbols($symbol_map, $base->{symbols});
- }
-
- # Collect symbols
- my $symbols;
- if ($main::use_symbolized_profile) {
- $symbols = FetchSymbols($pcs, $symbol_map);
- } elsif ($main::use_symbol_page) {
- $symbols = FetchSymbols($pcs);
- } else {
- # TODO(csilvers): $libs uses the /proc/self/maps data from profile1,
- # which may differ from the data from subsequent profiles, especially
- # if they were run on different machines. Use appropriate libs for
- # each pc somehow.
- $symbols = ExtractSymbols($libs, $pcs);
- }
-
- if (!defined($main::opt_thread)) {
- FilterAndPrint($profile, $symbols, $libs);
- }
- if (defined($data->{threads})) {
- foreach my $thread (sort { $a <=> $b } keys(%{$data->{threads}})) {
- if (defined($main::opt_thread) &&
- ($main::opt_thread eq '*' || $main::opt_thread == $thread)) {
- my $thread_profile = $data->{threads}{$thread};
- FilterAndPrint($thread_profile, $symbols, $libs, $thread);
- }
- }
- }
-
- cleanup();
- exit(0);
-}
-
-##### Entry Point #####
-
-Main();
-
-# Temporary code to detect if we're running on a Goobuntu system.
-# These systems don't have the right stuff installed for the special
-# Readline libraries to work, so as a temporary workaround, we default
-# to using the normal stdio code, rather than the fancier readline-based
-# code
-sub ReadlineMightFail {
- if (-e '/lib/libtermcap.so.2') {
- return 0; # libtermcap exists, so readline should be okay
- } else {
- return 1;
- }
-}
-
-sub RunGV {
- my $fname = shift;
- my $bg = shift; # "" or " &" if we should run in background
- if (!system(ShellEscape(@GV, "--version") . " >$dev_null 2>&1")) {
- # Options using double dash are supported by this gv version.
- # Also, turn on noantialias to better handle bug in gv for
- # postscript files with large dimensions.
- # TODO: Maybe we should not pass the --noantialias flag
- # if the gv version is known to work properly without the flag.
- system(ShellEscape(@GV, "--scale=$main::opt_scale", "--noantialias", $fname)
- . $bg);
- } else {
- # Old gv version - only supports options that use single dash.
- print STDERR ShellEscape(@GV, "-scale", $main::opt_scale) . "\n";
- system(ShellEscape(@GV, "-scale", "$main::opt_scale", $fname) . $bg);
- }
-}
-
-sub RunEvince {
- my $fname = shift;
- my $bg = shift; # "" or " &" if we should run in background
- system(ShellEscape(@EVINCE, $fname) . $bg);
-}
-
-sub RunWeb {
- my $fname = shift;
- print STDERR "Loading web page file:///$fname\n";
-
- if (`uname` =~ /Darwin/) {
- # OS X: open will use standard preference for SVG files.
- system("/usr/bin/open", $fname);
- return;
- }
-
- # Some kind of Unix; try generic symlinks, then specific browsers.
- # (Stop once we find one.)
- # Works best if the browser is already running.
- my @alt = (
- "/etc/alternatives/gnome-www-browser",
- "/etc/alternatives/x-www-browser",
- "google-chrome",
- "firefox",
- );
- foreach my $b (@alt) {
- if (system($b, $fname) == 0) {
- return;
- }
- }
-
- print STDERR "Could not load web browser.\n";
-}
-
-sub RunKcachegrind {
- my $fname = shift;
- my $bg = shift; # "" or " &" if we should run in background
- print STDERR "Starting '@KCACHEGRIND " . $fname . $bg . "'\n";
- system(ShellEscape(@KCACHEGRIND, $fname) . $bg);
-}
-
-
-##### Interactive helper routines #####
-
-sub InteractiveMode {
- $| = 1; # Make output unbuffered for interactive mode
- my ($orig_profile, $symbols, $libs, $total) = @_;
-
- print STDERR "Welcome to jeprof! For help, type 'help'.\n";
-
- # Use ReadLine if it's installed and input comes from a console.
- if ( -t STDIN &&
- !ReadlineMightFail() &&
- defined(eval {require Term::ReadLine}) ) {
- my $term = new Term::ReadLine 'jeprof';
- while ( defined ($_ = $term->readline('(jeprof) '))) {
- $term->addhistory($_) if /\S/;
- if (!InteractiveCommand($orig_profile, $symbols, $libs, $total, $_)) {
- last; # exit when we get an interactive command to quit
- }
- }
- } else { # don't have readline
- while (1) {
- print STDERR "(jeprof) ";
- $_ = <STDIN>;
- last if ! defined $_ ;
- s/\r//g; # turn windows-looking lines into unix-looking lines
-
- # Save some flags that might be reset by InteractiveCommand()
- my $save_opt_lines = $main::opt_lines;
-
- if (!InteractiveCommand($orig_profile, $symbols, $libs, $total, $_)) {
- last; # exit when we get an interactive command to quit
- }
-
- # Restore flags
- $main::opt_lines = $save_opt_lines;
- }
- }
-}
-
-# Takes two args: orig profile, and command to run.
-# Returns 1 if we should keep going, or 0 if we were asked to quit
-sub InteractiveCommand {
- my($orig_profile, $symbols, $libs, $total, $command) = @_;
- $_ = $command; # just to make future m//'s easier
- if (!defined($_)) {
- print STDERR "\n";
- return 0;
- }
- if (m/^\s*quit/) {
- return 0;
- }
- if (m/^\s*help/) {
- InteractiveHelpMessage();
- return 1;
- }
- # Clear all the mode options -- mode is controlled by "$command"
- $main::opt_text = 0;
- $main::opt_callgrind = 0;
- $main::opt_disasm = 0;
- $main::opt_list = 0;
- $main::opt_gv = 0;
- $main::opt_evince = 0;
- $main::opt_cum = 0;
-
- if (m/^\s*(text|top)(\d*)\s*(.*)/) {
- $main::opt_text = 1;
-
- my $line_limit = ($2 ne "") ? int($2) : 10;
-
- my $routine;
- my $ignore;
- ($routine, $ignore) = ParseInteractiveArgs($3);
-
- my $profile = ProcessProfile($total, $orig_profile, $symbols, "", $ignore);
- my $reduced = ReduceProfile($symbols, $profile);
-
- # Get derived profiles
- my $flat = FlatProfile($reduced);
- my $cumulative = CumulativeProfile($reduced);
-
- PrintText($symbols, $flat, $cumulative, $line_limit);
- return 1;
- }
- if (m/^\s*callgrind\s*([^ \n]*)/) {
- $main::opt_callgrind = 1;
-
- # Get derived profiles
- my $calls = ExtractCalls($symbols, $orig_profile);
- my $filename = $1;
- if ( $1 eq '' ) {
- $filename = TempName($main::next_tmpfile, "callgrind");
- }
- PrintCallgrind($calls, $filename);
- if ( $1 eq '' ) {
- RunKcachegrind($filename, " & ");
- $main::next_tmpfile++;
- }
-
- return 1;
- }
- if (m/^\s*(web)?list\s*(.+)/) {
- my $html = (defined($1) && ($1 eq "web"));
- $main::opt_list = 1;
-
- my $routine;
- my $ignore;
- ($routine, $ignore) = ParseInteractiveArgs($2);
-
- my $profile = ProcessProfile($total, $orig_profile, $symbols, "", $ignore);
- my $reduced = ReduceProfile($symbols, $profile);
-
- # Get derived profiles
- my $flat = FlatProfile($reduced);
- my $cumulative = CumulativeProfile($reduced);
-
- PrintListing($total, $libs, $flat, $cumulative, $routine, $html);
- return 1;
- }
- if (m/^\s*disasm\s*(.+)/) {
- $main::opt_disasm = 1;
-
- my $routine;
- my $ignore;
- ($routine, $ignore) = ParseInteractiveArgs($1);
-
- # Process current profile to account for various settings
- my $profile = ProcessProfile($total, $orig_profile, $symbols, "", $ignore);
- my $reduced = ReduceProfile($symbols, $profile);
-
- # Get derived profiles
- my $flat = FlatProfile($reduced);
- my $cumulative = CumulativeProfile($reduced);
-
- PrintDisassembly($libs, $flat, $cumulative, $routine);
- return 1;
- }
- if (m/^\s*(gv|web|evince)\s*(.*)/) {
- $main::opt_gv = 0;
- $main::opt_evince = 0;
- $main::opt_web = 0;
- if ($1 eq "gv") {
- $main::opt_gv = 1;
- } elsif ($1 eq "evince") {
- $main::opt_evince = 1;
- } elsif ($1 eq "web") {
- $main::opt_web = 1;
- }
-
- my $focus;
- my $ignore;
- ($focus, $ignore) = ParseInteractiveArgs($2);
-
- # Process current profile to account for various settings
- my $profile = ProcessProfile($total, $orig_profile, $symbols,
- $focus, $ignore);
- my $reduced = ReduceProfile($symbols, $profile);
-
- # Get derived profiles
- my $flat = FlatProfile($reduced);
- my $cumulative = CumulativeProfile($reduced);
-
- if (PrintDot($main::prog, $symbols, $profile, $flat, $cumulative, $total)) {
- if ($main::opt_gv) {
- RunGV(TempName($main::next_tmpfile, "ps"), " &");
- } elsif ($main::opt_evince) {
- RunEvince(TempName($main::next_tmpfile, "pdf"), " &");
- } elsif ($main::opt_web) {
- RunWeb(TempName($main::next_tmpfile, "svg"));
- }
- $main::next_tmpfile++;
- }
- return 1;
- }
- if (m/^\s*$/) {
- return 1;
- }
- print STDERR "Unknown command: try 'help'.\n";
- return 1;
-}
-
-
-sub ProcessProfile {
- my $total_count = shift;
- my $orig_profile = shift;
- my $symbols = shift;
- my $focus = shift;
- my $ignore = shift;
-
- # Process current profile to account for various settings
- my $profile = $orig_profile;
- printf("Total: %s %s\n", Unparse($total_count), Units());
- if ($focus ne '') {
- $profile = FocusProfile($symbols, $profile, $focus);
- my $focus_count = TotalProfile($profile);
- printf("After focusing on '%s': %s %s of %s (%0.1f%%)\n",
- $focus,
- Unparse($focus_count), Units(),
- Unparse($total_count), ($focus_count*100.0) / $total_count);
- }
- if ($ignore ne '') {
- $profile = IgnoreProfile($symbols, $profile, $ignore);
- my $ignore_count = TotalProfile($profile);
- printf("After ignoring '%s': %s %s of %s (%0.1f%%)\n",
- $ignore,
- Unparse($ignore_count), Units(),
- Unparse($total_count),
- ($ignore_count*100.0) / $total_count);
- }
-
- return $profile;
-}
-
-sub InteractiveHelpMessage {
- print STDERR <<ENDOFHELP;
-Interactive jeprof mode
-
-Commands:
- gv
- gv [focus] [-ignore1] [-ignore2]
- Show graphical hierarchical display of current profile. Without
- any arguments, shows all samples in the profile. With the optional
- "focus" argument, restricts the samples shown to just those where
- the "focus" regular expression matches a routine name on the stack
- trace.
-
- web
- web [focus] [-ignore1] [-ignore2]
- Like GV, but displays profile in your web browser instead of using
- Ghostview. Works best if your web browser is already running.
- To change the browser that gets used:
- On Linux, set the /etc/alternatives/gnome-www-browser symlink.
- On OS X, change the Finder association for SVG files.
-
- list [routine_regexp] [-ignore1] [-ignore2]
- Show source listing of routines whose names match "routine_regexp"
-
- weblist [routine_regexp] [-ignore1] [-ignore2]
- Displays a source listing of routines whose names match "routine_regexp"
- in a web browser. You can click on source lines to view the
- corresponding disassembly.
-
- top [--cum] [-ignore1] [-ignore2]
- top20 [--cum] [-ignore1] [-ignore2]
- top37 [--cum] [-ignore1] [-ignore2]
- Show top lines ordered by flat profile count, or cumulative count
- if --cum is specified. If a number is present after 'top', the
- top K routines will be shown (defaults to showing the top 10)
-
- disasm [routine_regexp] [-ignore1] [-ignore2]
- Show disassembly of routines whose names match "routine_regexp",
- annotated with sample counts.
-
- callgrind
- callgrind [filename]
- Generates callgrind file. If no filename is given, kcachegrind is called.
-
- help - This listing
- quit or ^D - End jeprof
-
-For commands that accept optional -ignore tags, samples where any routine in
-the stack trace matches the regular expression in any of the -ignore
-parameters will be ignored.
-
-Further pprof details are available at this location (or one similar):
-
- /usr/doc/gperftools-$PPROF_VERSION/cpu_profiler.html
- /usr/doc/gperftools-$PPROF_VERSION/heap_profiler.html
-
-ENDOFHELP
-}
-sub ParseInteractiveArgs {
- my $args = shift;
- my $focus = "";
- my $ignore = "";
- my @x = split(/ +/, $args);
- foreach $a (@x) {
- if ($a =~ m/^(--|-)lines$/) {
- $main::opt_lines = 1;
- } elsif ($a =~ m/^(--|-)cum$/) {
- $main::opt_cum = 1;
- } elsif ($a =~ m/^-(.*)/) {
- $ignore .= (($ignore ne "") ? "|" : "" ) . $1;
- } else {
- $focus .= (($focus ne "") ? "|" : "" ) . $a;
- }
- }
- if ($ignore ne "") {
- print STDERR "Ignoring samples in call stacks that match '$ignore'\n";
- }
- return ($focus, $ignore);
-}
-
-##### Output code #####
-
-sub TempName {
- my $fnum = shift;
- my $ext = shift;
- my $file = "$main::tmpfile_ps.$fnum.$ext";
- $main::tempnames{$file} = 1;
- return $file;
-}
-
-# Print profile data in packed binary format (64-bit) to standard out
-sub PrintProfileData {
- my $profile = shift;
-
- # print header (64-bit style)
- # (zero) (header-size) (version) (sample-period) (zero)
- print pack('L*', 0, 0, 3, 0, 0, 0, 1, 0, 0, 0);
-
- foreach my $k (keys(%{$profile})) {
- my $count = $profile->{$k};
- my @addrs = split(/\n/, $k);
- if ($#addrs >= 0) {
- my $depth = $#addrs + 1;
- # int(foo / 2**32) is the only reliable way to get rid of bottom
- # 32 bits on both 32- and 64-bit systems.
- print pack('L*', $count & 0xFFFFFFFF, int($count / 2**32));
- print pack('L*', $depth & 0xFFFFFFFF, int($depth / 2**32));
-
- foreach my $full_addr (@addrs) {
- my $addr = $full_addr;
- $addr =~ s/0x0*//; # strip off leading 0x, zeroes
- if (length($addr) > 16) {
- print STDERR "Invalid address in profile: $full_addr\n";
- next;
- }
- my $low_addr = substr($addr, -8); # get last 8 hex chars
- my $high_addr = substr($addr, -16, 8); # get up to 8 more hex chars
- print pack('L*', hex('0x' . $low_addr), hex('0x' . $high_addr));
- }
- }
- }
-}
-
-# Print symbols and profile data
-sub PrintSymbolizedProfile {
- my $symbols = shift;
- my $profile = shift;
- my $prog = shift;
-
- $SYMBOL_PAGE =~ m,[^/]+$,; # matches everything after the last slash
- my $symbol_marker = $&;
-
- print '--- ', $symbol_marker, "\n";
- if (defined($prog)) {
- print 'binary=', $prog, "\n";
- }
- while (my ($pc, $name) = each(%{$symbols})) {
- my $sep = ' ';
- print '0x', $pc;
- # We have a list of function names, which include the inlined
- # calls. They are separated (and terminated) by --, which is
- # illegal in function names.
- for (my $j = 2; $j <= $#{$name}; $j += 3) {
- print $sep, $name->[$j];
- $sep = '--';
- }
- print "\n";
- }
- print '---', "\n";
-
- my $profile_marker;
- if ($main::profile_type eq 'heap') {
- $HEAP_PAGE =~ m,[^/]+$,; # matches everything after the last slash
- $profile_marker = $&;
- } elsif ($main::profile_type eq 'growth') {
- $GROWTH_PAGE =~ m,[^/]+$,; # matches everything after the last slash
- $profile_marker = $&;
- } elsif ($main::profile_type eq 'contention') {
- $CONTENTION_PAGE =~ m,[^/]+$,; # matches everything after the last slash
- $profile_marker = $&;
- } else { # elsif ($main::profile_type eq 'cpu')
- $PROFILE_PAGE =~ m,[^/]+$,; # matches everything after the last slash
- $profile_marker = $&;
- }
-
- print '--- ', $profile_marker, "\n";
- if (defined($main::collected_profile)) {
- # if used with remote fetch, simply dump the collected profile to output.
- open(SRC, "<$main::collected_profile");
- while (<SRC>) {
- print $_;
- }
- close(SRC);
- } else {
- # --raw/http: For everything to work correctly for non-remote profiles, we
- # would need to extend PrintProfileData() to handle all possible profile
- # types, re-enable the code that is currently disabled in ReadCPUProfile()
- # and FixCallerAddresses(), and remove the remote profile dumping code in
- # the block above.
- die "--raw/http: jeprof can only dump remote profiles for --raw\n";
- # dump a cpu-format profile to standard out
- PrintProfileData($profile);
- }
-}
-
-# Print text output
-sub PrintText {
- my $symbols = shift;
- my $flat = shift;
- my $cumulative = shift;
- my $line_limit = shift;
-
- my $total = TotalProfile($flat);
-
- # Which profile to sort by?
- my $s = $main::opt_cum ? $cumulative : $flat;
-
- my $running_sum = 0;
- my $lines = 0;
- foreach my $k (sort { GetEntry($s, $b) <=> GetEntry($s, $a) || $a cmp $b }
- keys(%{$cumulative})) {
- my $f = GetEntry($flat, $k);
- my $c = GetEntry($cumulative, $k);
- $running_sum += $f;
-
- my $sym = $k;
- if (exists($symbols->{$k})) {
- $sym = $symbols->{$k}->[0] . " " . $symbols->{$k}->[1];
- if ($main::opt_addresses) {
- $sym = $k . " " . $sym;
- }
- }
-
- if ($f != 0 || $c != 0) {
- printf("%8s %6s %6s %8s %6s %s\n",
- Unparse($f),
- Percent($f, $total),
- Percent($running_sum, $total),
- Unparse($c),
- Percent($c, $total),
- $sym);
- }
- $lines++;
- last if ($line_limit >= 0 && $lines >= $line_limit);
- }
-}
-
-# Callgrind format has a compression for repeated function and file
-# names. You show the name the first time, and just use its number
-# subsequently. This can cut down the file to about a third or a
-# quarter of its uncompressed size. $key and $val are the key/value
-# pair that would normally be printed by callgrind; $map is a map from
-# value to number.
-sub CompressedCGName {
- my($key, $val, $map) = @_;
- my $idx = $map->{$val};
- # For very short keys, providing an index hurts rather than helps.
- if (length($val) <= 3) {
- return "$key=$val\n";
- } elsif (defined($idx)) {
- return "$key=($idx)\n";
- } else {
- # scalar(keys $map) gives the number of items in the map.
- $idx = scalar(keys(%{$map})) + 1;
- $map->{$val} = $idx;
- return "$key=($idx) $val\n";
- }
-}
-
-# Print the call graph in a way that's suiteable for callgrind.
-sub PrintCallgrind {
- my $calls = shift;
- my $filename;
- my %filename_to_index_map;
- my %fnname_to_index_map;
-
- if ($main::opt_interactive) {
- $filename = shift;
- print STDERR "Writing callgrind file to '$filename'.\n"
- } else {
- $filename = "&STDOUT";
- }
- open(CG, ">$filename");
- printf CG ("events: Hits\n\n");
- foreach my $call ( map { $_->[0] }
- sort { $a->[1] cmp $b ->[1] ||
- $a->[2] <=> $b->[2] }
- map { /([^:]+):(\d+):([^ ]+)( -> ([^:]+):(\d+):(.+))?/;
- [$_, $1, $2] }
- keys %$calls ) {
- my $count = int($calls->{$call});
- $call =~ /([^:]+):(\d+):([^ ]+)( -> ([^:]+):(\d+):(.+))?/;
- my ( $caller_file, $caller_line, $caller_function,
- $callee_file, $callee_line, $callee_function ) =
- ( $1, $2, $3, $5, $6, $7 );
-
- # TODO(csilvers): for better compression, collect all the
- # caller/callee_files and functions first, before printing
- # anything, and only compress those referenced more than once.
- printf CG CompressedCGName("fl", $caller_file, \%filename_to_index_map);
- printf CG CompressedCGName("fn", $caller_function, \%fnname_to_index_map);
- if (defined $6) {
- printf CG CompressedCGName("cfl", $callee_file, \%filename_to_index_map);
- printf CG CompressedCGName("cfn", $callee_function, \%fnname_to_index_map);
- printf CG ("calls=$count $callee_line\n");
- }
- printf CG ("$caller_line $count\n\n");
- }
-}
-
-# Print disassembly for all all routines that match $main::opt_disasm
-sub PrintDisassembly {
- my $libs = shift;
- my $flat = shift;
- my $cumulative = shift;
- my $disasm_opts = shift;
-
- my $total = TotalProfile($flat);
-
- foreach my $lib (@{$libs}) {
- my $symbol_table = GetProcedureBoundaries($lib->[0], $disasm_opts);
- my $offset = AddressSub($lib->[1], $lib->[3]);
- foreach my $routine (sort ByName keys(%{$symbol_table})) {
- my $start_addr = $symbol_table->{$routine}->[0];
- my $end_addr = $symbol_table->{$routine}->[1];
- # See if there are any samples in this routine
- my $length = hex(AddressSub($end_addr, $start_addr));
- my $addr = AddressAdd($start_addr, $offset);
- for (my $i = 0; $i < $length; $i++) {
- if (defined($cumulative->{$addr})) {
- PrintDisassembledFunction($lib->[0], $offset,
- $routine, $flat, $cumulative,
- $start_addr, $end_addr, $total);
- last;
- }
- $addr = AddressInc($addr);
- }
- }
- }
-}
-
-# Return reference to array of tuples of the form:
-# [start_address, filename, linenumber, instruction, limit_address]
-# E.g.,
-# ["0x806c43d", "/foo/bar.cc", 131, "ret", "0x806c440"]
-sub Disassemble {
- my $prog = shift;
- my $offset = shift;
- my $start_addr = shift;
- my $end_addr = shift;
-
- my $objdump = $obj_tool_map{"objdump"};
- my $cmd = ShellEscape($objdump, "-C", "-d", "-l", "--no-show-raw-insn",
- "--start-address=0x$start_addr",
- "--stop-address=0x$end_addr", $prog);
- open(OBJDUMP, "$cmd |") || error("$cmd: $!\n");
- my @result = ();
- my $filename = "";
- my $linenumber = -1;
- my $last = ["", "", "", ""];
- while (<OBJDUMP>) {
- s/\r//g; # turn windows-looking lines into unix-looking lines
- chop;
- if (m|\s*([^:\s]+):(\d+)\s*$|) {
- # Location line of the form:
- # <filename>:<linenumber>
- $filename = $1;
- $linenumber = $2;
- } elsif (m/^ +([0-9a-f]+):\s*(.*)/) {
- # Disassembly line -- zero-extend address to full length
- my $addr = HexExtend($1);
- my $k = AddressAdd($addr, $offset);
- $last->[4] = $k; # Store ending address for previous instruction
- $last = [$k, $filename, $linenumber, $2, $end_addr];
- push(@result, $last);
- }
- }
- close(OBJDUMP);
- return @result;
-}
-
-# The input file should contain lines of the form /proc/maps-like
-# output (same format as expected from the profiles) or that looks
-# like hex addresses (like "0xDEADBEEF"). We will parse all
-# /proc/maps output, and for all the hex addresses, we will output
-# "short" symbol names, one per line, in the same order as the input.
-sub PrintSymbols {
- my $maps_and_symbols_file = shift;
-
- # ParseLibraries expects pcs to be in a set. Fine by us...
- my @pclist = (); # pcs in sorted order
- my $pcs = {};
- my $map = "";
- foreach my $line (<$maps_and_symbols_file>) {
- $line =~ s/\r//g; # turn windows-looking lines into unix-looking lines
- if ($line =~ /\b(0x[0-9a-f]+)\b/i) {
- push(@pclist, HexExtend($1));
- $pcs->{$pclist[-1]} = 1;
- } else {
- $map .= $line;
- }
- }
-
- my $libs = ParseLibraries($main::prog, $map, $pcs);
- my $symbols = ExtractSymbols($libs, $pcs);
-
- foreach my $pc (@pclist) {
- # ->[0] is the shortname, ->[2] is the full name
- print(($symbols->{$pc}->[0] || "??") . "\n");
- }
-}
-
-
-# For sorting functions by name
-sub ByName {
- return ShortFunctionName($a) cmp ShortFunctionName($b);
-}
-
-# Print source-listing for all all routines that match $list_opts
-sub PrintListing {
- my $total = shift;
- my $libs = shift;
- my $flat = shift;
- my $cumulative = shift;
- my $list_opts = shift;
- my $html = shift;
-
- my $output = \*STDOUT;
- my $fname = "";
-
- if ($html) {
- # Arrange to write the output to a temporary file
- $fname = TempName($main::next_tmpfile, "html");
- $main::next_tmpfile++;
- if (!open(TEMP, ">$fname")) {
- print STDERR "$fname: $!\n";
- return;
- }
- $output = \*TEMP;
- print $output HtmlListingHeader();
- printf $output ("<div class=\"legend\">%s<br>Total: %s %s</div>\n",
- $main::prog, Unparse($total), Units());
- }
-
- my $listed = 0;
- foreach my $lib (@{$libs}) {
- my $symbol_table = GetProcedureBoundaries($lib->[0], $list_opts);
- my $offset = AddressSub($lib->[1], $lib->[3]);
- foreach my $routine (sort ByName keys(%{$symbol_table})) {
- # Print if there are any samples in this routine
- my $start_addr = $symbol_table->{$routine}->[0];
- my $end_addr = $symbol_table->{$routine}->[1];
- my $length = hex(AddressSub($end_addr, $start_addr));
- my $addr = AddressAdd($start_addr, $offset);
- for (my $i = 0; $i < $length; $i++) {
- if (defined($cumulative->{$addr})) {
- $listed += PrintSource(
- $lib->[0], $offset,
- $routine, $flat, $cumulative,
- $start_addr, $end_addr,
- $html,
- $output);
- last;
- }
- $addr = AddressInc($addr);
- }
- }
- }
-
- if ($html) {
- if ($listed > 0) {
- print $output HtmlListingFooter();
- close($output);
- RunWeb($fname);
- } else {
- close($output);
- unlink($fname);
- }
- }
-}
-
-sub HtmlListingHeader {
- return <<'EOF';
-<DOCTYPE html>
-<html>
-<head>
-<title>Pprof listing</title>
-<style type="text/css">
-body {
- font-family: sans-serif;
-}
-h1 {
- font-size: 1.5em;
- margin-bottom: 4px;
-}
-.legend {
- font-size: 1.25em;
-}
-.line {
- color: #aaaaaa;
-}
-.nop {
- color: #aaaaaa;
-}
-.unimportant {
- color: #cccccc;
-}
-.disasmloc {
- color: #000000;
-}
-.deadsrc {
- cursor: pointer;
-}
-.deadsrc:hover {
- background-color: #eeeeee;
-}
-.livesrc {
- color: #0000ff;
- cursor: pointer;
-}
-.livesrc:hover {
- background-color: #eeeeee;
-}
-.asm {
- color: #008800;
- display: none;
-}
-</style>
-<script type="text/javascript">
-function jeprof_toggle_asm(e) {
- var target;
- if (!e) e = window.event;
- if (e.target) target = e.target;
- else if (e.srcElement) target = e.srcElement;
-
- if (target) {
- var asm = target.nextSibling;
- if (asm && asm.className == "asm") {
- asm.style.display = (asm.style.display == "block" ? "" : "block");
- e.preventDefault();
- return false;
- }
- }
-}
-</script>
-</head>
-<body>
-EOF
-}
-
-sub HtmlListingFooter {
- return <<'EOF';
-</body>
-</html>
-EOF
-}
-
-sub HtmlEscape {
- my $text = shift;
- $text =~ s/&/&amp;/g;
- $text =~ s/</&lt;/g;
- $text =~ s/>/&gt;/g;
- return $text;
-}
-
-# Returns the indentation of the line, if it has any non-whitespace
-# characters. Otherwise, returns -1.
-sub Indentation {
- my $line = shift;
- if (m/^(\s*)\S/) {
- return length($1);
- } else {
- return -1;
- }
-}
-
-# If the symbol table contains inlining info, Disassemble() may tag an
-# instruction with a location inside an inlined function. But for
-# source listings, we prefer to use the location in the function we
-# are listing. So use MapToSymbols() to fetch full location
-# information for each instruction and then pick out the first
-# location from a location list (location list contains callers before
-# callees in case of inlining).
-#
-# After this routine has run, each entry in $instructions contains:
-# [0] start address
-# [1] filename for function we are listing
-# [2] line number for function we are listing
-# [3] disassembly
-# [4] limit address
-# [5] most specific filename (may be different from [1] due to inlining)
-# [6] most specific line number (may be different from [2] due to inlining)
-sub GetTopLevelLineNumbers {
- my ($lib, $offset, $instructions) = @_;
- my $pcs = [];
- for (my $i = 0; $i <= $#{$instructions}; $i++) {
- push(@{$pcs}, $instructions->[$i]->[0]);
- }
- my $symbols = {};
- MapToSymbols($lib, $offset, $pcs, $symbols);
- for (my $i = 0; $i <= $#{$instructions}; $i++) {
- my $e = $instructions->[$i];
- push(@{$e}, $e->[1]);
- push(@{$e}, $e->[2]);
- my $addr = $e->[0];
- my $sym = $symbols->{$addr};
- if (defined($sym)) {
- if ($#{$sym} >= 2 && $sym->[1] =~ m/^(.*):(\d+)$/) {
- $e->[1] = $1; # File name
- $e->[2] = $2; # Line number
- }
- }
- }
-}
-
-# Print source-listing for one routine
-sub PrintSource {
- my $prog = shift;
- my $offset = shift;
- my $routine = shift;
- my $flat = shift;
- my $cumulative = shift;
- my $start_addr = shift;
- my $end_addr = shift;
- my $html = shift;
- my $output = shift;
-
- # Disassemble all instructions (just to get line numbers)
- my @instructions = Disassemble($prog, $offset, $start_addr, $end_addr);
- GetTopLevelLineNumbers($prog, $offset, \@instructions);
-
- # Hack 1: assume that the first source file encountered in the
- # disassembly contains the routine
- my $filename = undef;
- for (my $i = 0; $i <= $#instructions; $i++) {
- if ($instructions[$i]->[2] >= 0) {
- $filename = $instructions[$i]->[1];
- last;
- }
- }
- if (!defined($filename)) {
- print STDERR "no filename found in $routine\n";
- return 0;
- }
-
- # Hack 2: assume that the largest line number from $filename is the
- # end of the procedure. This is typically safe since if P1 contains
- # an inlined call to P2, then P2 usually occurs earlier in the
- # source file. If this does not work, we might have to compute a
- # density profile or just print all regions we find.
- my $lastline = 0;
- for (my $i = 0; $i <= $#instructions; $i++) {
- my $f = $instructions[$i]->[1];
- my $l = $instructions[$i]->[2];
- if (($f eq $filename) && ($l > $lastline)) {
- $lastline = $l;
- }
- }
-
- # Hack 3: assume the first source location from "filename" is the start of
- # the source code.
- my $firstline = 1;
- for (my $i = 0; $i <= $#instructions; $i++) {
- if ($instructions[$i]->[1] eq $filename) {
- $firstline = $instructions[$i]->[2];
- last;
- }
- }
-
- # Hack 4: Extend last line forward until its indentation is less than
- # the indentation we saw on $firstline
- my $oldlastline = $lastline;
- {
- if (!open(FILE, "<$filename")) {
- print STDERR "$filename: $!\n";
- return 0;
- }
- my $l = 0;
- my $first_indentation = -1;
- while (<FILE>) {
- s/\r//g; # turn windows-looking lines into unix-looking lines
- $l++;
- my $indent = Indentation($_);
- if ($l >= $firstline) {
- if ($first_indentation < 0 && $indent >= 0) {
- $first_indentation = $indent;
- last if ($first_indentation == 0);
- }
- }
- if ($l >= $lastline && $indent >= 0) {
- if ($indent >= $first_indentation) {
- $lastline = $l+1;
- } else {
- last;
- }
- }
- }
- close(FILE);
- }
-
- # Assign all samples to the range $firstline,$lastline,
- # Hack 4: If an instruction does not occur in the range, its samples
- # are moved to the next instruction that occurs in the range.
- my $samples1 = {}; # Map from line number to flat count
- my $samples2 = {}; # Map from line number to cumulative count
- my $running1 = 0; # Unassigned flat counts
- my $running2 = 0; # Unassigned cumulative counts
- my $total1 = 0; # Total flat counts
- my $total2 = 0; # Total cumulative counts
- my %disasm = (); # Map from line number to disassembly
- my $running_disasm = ""; # Unassigned disassembly
- my $skip_marker = "---\n";
- if ($html) {
- $skip_marker = "";
- for (my $l = $firstline; $l <= $lastline; $l++) {
- $disasm{$l} = "";
- }
- }
- my $last_dis_filename = '';
- my $last_dis_linenum = -1;
- my $last_touched_line = -1; # To detect gaps in disassembly for a line
- foreach my $e (@instructions) {
- # Add up counts for all address that fall inside this instruction
- my $c1 = 0;
- my $c2 = 0;
- for (my $a = $e->[0]; $a lt $e->[4]; $a = AddressInc($a)) {
- $c1 += GetEntry($flat, $a);
- $c2 += GetEntry($cumulative, $a);
- }
-
- if ($html) {
- my $dis = sprintf(" %6s %6s \t\t%8s: %s ",
- HtmlPrintNumber($c1),
- HtmlPrintNumber($c2),
- UnparseAddress($offset, $e->[0]),
- CleanDisassembly($e->[3]));
-
- # Append the most specific source line associated with this instruction
- if (length($dis) < 80) { $dis .= (' ' x (80 - length($dis))) };
- $dis = HtmlEscape($dis);
- my $f = $e->[5];
- my $l = $e->[6];
- if ($f ne $last_dis_filename) {
- $dis .= sprintf("<span class=disasmloc>%s:%d</span>",
- HtmlEscape(CleanFileName($f)), $l);
- } elsif ($l ne $last_dis_linenum) {
- # De-emphasize the unchanged file name portion
- $dis .= sprintf("<span class=unimportant>%s</span>" .
- "<span class=disasmloc>:%d</span>",
- HtmlEscape(CleanFileName($f)), $l);
- } else {
- # De-emphasize the entire location
- $dis .= sprintf("<span class=unimportant>%s:%d</span>",
- HtmlEscape(CleanFileName($f)), $l);
- }
- $last_dis_filename = $f;
- $last_dis_linenum = $l;
- $running_disasm .= $dis;
- $running_disasm .= "\n";
- }
-
- $running1 += $c1;
- $running2 += $c2;
- $total1 += $c1;
- $total2 += $c2;
- my $file = $e->[1];
- my $line = $e->[2];
- if (($file eq $filename) &&
- ($line >= $firstline) &&
- ($line <= $lastline)) {
- # Assign all accumulated samples to this line
- AddEntry($samples1, $line, $running1);
- AddEntry($samples2, $line, $running2);
- $running1 = 0;
- $running2 = 0;
- if ($html) {
- if ($line != $last_touched_line && $disasm{$line} ne '') {
- $disasm{$line} .= "\n";
- }
- $disasm{$line} .= $running_disasm;
- $running_disasm = '';
- $last_touched_line = $line;
- }
- }
- }
-
- # Assign any leftover samples to $lastline
- AddEntry($samples1, $lastline, $running1);
- AddEntry($samples2, $lastline, $running2);
- if ($html) {
- if ($lastline != $last_touched_line && $disasm{$lastline} ne '') {
- $disasm{$lastline} .= "\n";
- }
- $disasm{$lastline} .= $running_disasm;
- }
-
- if ($html) {
- printf $output (
- "<h1>%s</h1>%s\n<pre onClick=\"jeprof_toggle_asm()\">\n" .
- "Total:%6s %6s (flat / cumulative %s)\n",
- HtmlEscape(ShortFunctionName($routine)),
- HtmlEscape(CleanFileName($filename)),
- Unparse($total1),
- Unparse($total2),
- Units());
- } else {
- printf $output (
- "ROUTINE ====================== %s in %s\n" .
- "%6s %6s Total %s (flat / cumulative)\n",
- ShortFunctionName($routine),
- CleanFileName($filename),
- Unparse($total1),
- Unparse($total2),
- Units());
- }
- if (!open(FILE, "<$filename")) {
- print STDERR "$filename: $!\n";
- return 0;
- }
- my $l = 0;
- while (<FILE>) {
- s/\r//g; # turn windows-looking lines into unix-looking lines
- $l++;
- if ($l >= $firstline - 5 &&
- (($l <= $oldlastline + 5) || ($l <= $lastline))) {
- chop;
- my $text = $_;
- if ($l == $firstline) { print $output $skip_marker; }
- my $n1 = GetEntry($samples1, $l);
- my $n2 = GetEntry($samples2, $l);
- if ($html) {
- # Emit a span that has one of the following classes:
- # livesrc -- has samples
- # deadsrc -- has disassembly, but with no samples
- # nop -- has no matching disasembly
- # Also emit an optional span containing disassembly.
- my $dis = $disasm{$l};
- my $asm = "";
- if (defined($dis) && $dis ne '') {
- $asm = "<span class=\"asm\">" . $dis . "</span>";
- }
- my $source_class = (($n1 + $n2 > 0)
- ? "livesrc"
- : (($asm ne "") ? "deadsrc" : "nop"));
- printf $output (
- "<span class=\"line\">%5d</span> " .
- "<span class=\"%s\">%6s %6s %s</span>%s\n",
- $l, $source_class,
- HtmlPrintNumber($n1),
- HtmlPrintNumber($n2),
- HtmlEscape($text),
- $asm);
- } else {
- printf $output(
- "%6s %6s %4d: %s\n",
- UnparseAlt($n1),
- UnparseAlt($n2),
- $l,
- $text);
- }
- if ($l == $lastline) { print $output $skip_marker; }
- };
- }
- close(FILE);
- if ($html) {
- print $output "</pre>\n";
- }
- return 1;
-}
-
-# Return the source line for the specified file/linenumber.
-# Returns undef if not found.
-sub SourceLine {
- my $file = shift;
- my $line = shift;
-
- # Look in cache
- if (!defined($main::source_cache{$file})) {
- if (100 < scalar keys(%main::source_cache)) {
- # Clear the cache when it gets too big
- $main::source_cache = ();
- }
-
- # Read all lines from the file
- if (!open(FILE, "<$file")) {
- print STDERR "$file: $!\n";
- $main::source_cache{$file} = []; # Cache the negative result
- return undef;
- }
- my $lines = [];
- push(@{$lines}, ""); # So we can use 1-based line numbers as indices
- while (<FILE>) {
- push(@{$lines}, $_);
- }
- close(FILE);
-
- # Save the lines in the cache
- $main::source_cache{$file} = $lines;
- }
-
- my $lines = $main::source_cache{$file};
- if (($line < 0) || ($line > $#{$lines})) {
- return undef;
- } else {
- return $lines->[$line];
- }
-}
-
-# Print disassembly for one routine with interspersed source if available
-sub PrintDisassembledFunction {
- my $prog = shift;
- my $offset = shift;
- my $routine = shift;
- my $flat = shift;
- my $cumulative = shift;
- my $start_addr = shift;
- my $end_addr = shift;
- my $total = shift;
-
- # Disassemble all instructions
- my @instructions = Disassemble($prog, $offset, $start_addr, $end_addr);
-
- # Make array of counts per instruction
- my @flat_count = ();
- my @cum_count = ();
- my $flat_total = 0;
- my $cum_total = 0;
- foreach my $e (@instructions) {
- # Add up counts for all address that fall inside this instruction
- my $c1 = 0;
- my $c2 = 0;
- for (my $a = $e->[0]; $a lt $e->[4]; $a = AddressInc($a)) {
- $c1 += GetEntry($flat, $a);
- $c2 += GetEntry($cumulative, $a);
- }
- push(@flat_count, $c1);
- push(@cum_count, $c2);
- $flat_total += $c1;
- $cum_total += $c2;
- }
-
- # Print header with total counts
- printf("ROUTINE ====================== %s\n" .
- "%6s %6s %s (flat, cumulative) %.1f%% of total\n",
- ShortFunctionName($routine),
- Unparse($flat_total),
- Unparse($cum_total),
- Units(),
- ($cum_total * 100.0) / $total);
-
- # Process instructions in order
- my $current_file = "";
- for (my $i = 0; $i <= $#instructions; ) {
- my $e = $instructions[$i];
-
- # Print the new file name whenever we switch files
- if ($e->[1] ne $current_file) {
- $current_file = $e->[1];
- my $fname = $current_file;
- $fname =~ s|^\./||; # Trim leading "./"
-
- # Shorten long file names
- if (length($fname) >= 58) {
- $fname = "..." . substr($fname, -55);
- }
- printf("-------------------- %s\n", $fname);
- }
-
- # TODO: Compute range of lines to print together to deal with
- # small reorderings.
- my $first_line = $e->[2];
- my $last_line = $first_line;
- my %flat_sum = ();
- my %cum_sum = ();
- for (my $l = $first_line; $l <= $last_line; $l++) {
- $flat_sum{$l} = 0;
- $cum_sum{$l} = 0;
- }
-
- # Find run of instructions for this range of source lines
- my $first_inst = $i;
- while (($i <= $#instructions) &&
- ($instructions[$i]->[2] >= $first_line) &&
- ($instructions[$i]->[2] <= $last_line)) {
- $e = $instructions[$i];
- $flat_sum{$e->[2]} += $flat_count[$i];
- $cum_sum{$e->[2]} += $cum_count[$i];
- $i++;
- }
- my $last_inst = $i - 1;
-
- # Print source lines
- for (my $l = $first_line; $l <= $last_line; $l++) {
- my $line = SourceLine($current_file, $l);
- if (!defined($line)) {
- $line = "?\n";
- next;
- } else {
- $line =~ s/^\s+//;
- }
- printf("%6s %6s %5d: %s",
- UnparseAlt($flat_sum{$l}),
- UnparseAlt($cum_sum{$l}),
- $l,
- $line);
- }
-
- # Print disassembly
- for (my $x = $first_inst; $x <= $last_inst; $x++) {
- my $e = $instructions[$x];
- printf("%6s %6s %8s: %6s\n",
- UnparseAlt($flat_count[$x]),
- UnparseAlt($cum_count[$x]),
- UnparseAddress($offset, $e->[0]),
- CleanDisassembly($e->[3]));
- }
- }
-}
-
-# Print DOT graph
-sub PrintDot {
- my $prog = shift;
- my $symbols = shift;
- my $raw = shift;
- my $flat = shift;
- my $cumulative = shift;
- my $overall_total = shift;
-
- # Get total
- my $local_total = TotalProfile($flat);
- my $nodelimit = int($main::opt_nodefraction * $local_total);
- my $edgelimit = int($main::opt_edgefraction * $local_total);
- my $nodecount = $main::opt_nodecount;
-
- # Find nodes to include
- my @list = (sort { abs(GetEntry($cumulative, $b)) <=>
- abs(GetEntry($cumulative, $a))
- || $a cmp $b }
- keys(%{$cumulative}));
- my $last = $nodecount - 1;
- if ($last > $#list) {
- $last = $#list;
- }
- while (($last >= 0) &&
- (abs(GetEntry($cumulative, $list[$last])) <= $nodelimit)) {
- $last--;
- }
- if ($last < 0) {
- print STDERR "No nodes to print\n";
- return 0;
- }
-
- if ($nodelimit > 0 || $edgelimit > 0) {
- printf STDERR ("Dropping nodes with <= %s %s; edges with <= %s abs(%s)\n",
- Unparse($nodelimit), Units(),
- Unparse($edgelimit), Units());
- }
-
- # Open DOT output file
- my $output;
- my $escaped_dot = ShellEscape(@DOT);
- my $escaped_ps2pdf = ShellEscape(@PS2PDF);
- if ($main::opt_gv) {
- my $escaped_outfile = ShellEscape(TempName($main::next_tmpfile, "ps"));
- $output = "| $escaped_dot -Tps2 >$escaped_outfile";
- } elsif ($main::opt_evince) {
- my $escaped_outfile = ShellEscape(TempName($main::next_tmpfile, "pdf"));
- $output = "| $escaped_dot -Tps2 | $escaped_ps2pdf - $escaped_outfile";
- } elsif ($main::opt_ps) {
- $output = "| $escaped_dot -Tps2";
- } elsif ($main::opt_pdf) {
- $output = "| $escaped_dot -Tps2 | $escaped_ps2pdf - -";
- } elsif ($main::opt_web || $main::opt_svg) {
- # We need to post-process the SVG, so write to a temporary file always.
- my $escaped_outfile = ShellEscape(TempName($main::next_tmpfile, "svg"));
- $output = "| $escaped_dot -Tsvg >$escaped_outfile";
- } elsif ($main::opt_gif) {
- $output = "| $escaped_dot -Tgif";
- } else {
- $output = ">&STDOUT";
- }
- open(DOT, $output) || error("$output: $!\n");
-
- # Title
- printf DOT ("digraph \"%s; %s %s\" {\n",
- $prog,
- Unparse($overall_total),
- Units());
- if ($main::opt_pdf) {
- # The output is more printable if we set the page size for dot.
- printf DOT ("size=\"8,11\"\n");
- }
- printf DOT ("node [width=0.375,height=0.25];\n");
-
- # Print legend
- printf DOT ("Legend [shape=box,fontsize=24,shape=plaintext," .
- "label=\"%s\\l%s\\l%s\\l%s\\l%s\\l\"];\n",
- $prog,
- sprintf("Total %s: %s", Units(), Unparse($overall_total)),
- sprintf("Focusing on: %s", Unparse($local_total)),
- sprintf("Dropped nodes with <= %s abs(%s)",
- Unparse($nodelimit), Units()),
- sprintf("Dropped edges with <= %s %s",
- Unparse($edgelimit), Units())
- );
-
- # Print nodes
- my %node = ();
- my $nextnode = 1;
- foreach my $a (@list[0..$last]) {
- # Pick font size
- my $f = GetEntry($flat, $a);
- my $c = GetEntry($cumulative, $a);
-
- my $fs = 8;
- if ($local_total > 0) {
- $fs = 8 + (50.0 * sqrt(abs($f * 1.0 / $local_total)));
- }
-
- $node{$a} = $nextnode++;
- my $sym = $a;
- $sym =~ s/\s+/\\n/g;
- $sym =~ s/::/\\n/g;
-
- # Extra cumulative info to print for non-leaves
- my $extra = "";
- if ($f != $c) {
- $extra = sprintf("\\rof %s (%s)",
- Unparse($c),
- Percent($c, $local_total));
- }
- my $style = "";
- if ($main::opt_heapcheck) {
- if ($f > 0) {
- # make leak-causing nodes more visible (add a background)
- $style = ",style=filled,fillcolor=gray"
- } elsif ($f < 0) {
- # make anti-leak-causing nodes (which almost never occur)
- # stand out as well (triple border)
- $style = ",peripheries=3"
- }
- }
-
- printf DOT ("N%d [label=\"%s\\n%s (%s)%s\\r" .
- "\",shape=box,fontsize=%.1f%s];\n",
- $node{$a},
- $sym,
- Unparse($f),
- Percent($f, $local_total),
- $extra,
- $fs,
- $style,
- );
- }
-
- # Get edges and counts per edge
- my %edge = ();
- my $n;
- my $fullname_to_shortname_map = {};
- FillFullnameToShortnameMap($symbols, $fullname_to_shortname_map);
- foreach my $k (keys(%{$raw})) {
- # TODO: omit low %age edges
- $n = $raw->{$k};
- my @translated = TranslateStack($symbols, $fullname_to_shortname_map, $k);
- for (my $i = 1; $i <= $#translated; $i++) {
- my $src = $translated[$i];
- my $dst = $translated[$i-1];
- #next if ($src eq $dst); # Avoid self-edges?
- if (exists($node{$src}) && exists($node{$dst})) {
- my $edge_label = "$src\001$dst";
- if (!exists($edge{$edge_label})) {
- $edge{$edge_label} = 0;
- }
- $edge{$edge_label} += $n;
- }
- }
- }
-
- # Print edges (process in order of decreasing counts)
- my %indegree = (); # Number of incoming edges added per node so far
- my %outdegree = (); # Number of outgoing edges added per node so far
- foreach my $e (sort { $edge{$b} <=> $edge{$a} } keys(%edge)) {
- my @x = split(/\001/, $e);
- $n = $edge{$e};
-
- # Initialize degree of kept incoming and outgoing edges if necessary
- my $src = $x[0];
- my $dst = $x[1];
- if (!exists($outdegree{$src})) { $outdegree{$src} = 0; }
- if (!exists($indegree{$dst})) { $indegree{$dst} = 0; }
-
- my $keep;
- if ($indegree{$dst} == 0) {
- # Keep edge if needed for reachability
- $keep = 1;
- } elsif (abs($n) <= $edgelimit) {
- # Drop if we are below --edgefraction
- $keep = 0;
- } elsif ($outdegree{$src} >= $main::opt_maxdegree ||
- $indegree{$dst} >= $main::opt_maxdegree) {
- # Keep limited number of in/out edges per node
- $keep = 0;
- } else {
- $keep = 1;
- }
-
- if ($keep) {
- $outdegree{$src}++;
- $indegree{$dst}++;
-
- # Compute line width based on edge count
- my $fraction = abs($local_total ? (3 * ($n / $local_total)) : 0);
- if ($fraction > 1) { $fraction = 1; }
- my $w = $fraction * 2;
- if ($w < 1 && ($main::opt_web || $main::opt_svg)) {
- # SVG output treats line widths < 1 poorly.
- $w = 1;
- }
-
- # Dot sometimes segfaults if given edge weights that are too large, so
- # we cap the weights at a large value
- my $edgeweight = abs($n) ** 0.7;
- if ($edgeweight > 100000) { $edgeweight = 100000; }
- $edgeweight = int($edgeweight);
-
- my $style = sprintf("setlinewidth(%f)", $w);
- if ($x[1] =~ m/\(inline\)/) {
- $style .= ",dashed";
- }
-
- # Use a slightly squashed function of the edge count as the weight
- printf DOT ("N%s -> N%s [label=%s, weight=%d, style=\"%s\"];\n",
- $node{$x[0]},
- $node{$x[1]},
- Unparse($n),
- $edgeweight,
- $style);
- }
- }
-
- print DOT ("}\n");
- close(DOT);
-
- if ($main::opt_web || $main::opt_svg) {
- # Rewrite SVG to be more usable inside web browser.
- RewriteSvg(TempName($main::next_tmpfile, "svg"));
- }
-
- return 1;
-}
-
-sub RewriteSvg {
- my $svgfile = shift;
-
- open(SVG, $svgfile) || die "open temp svg: $!";
- my @svg = <SVG>;
- close(SVG);
- unlink $svgfile;
- my $svg = join('', @svg);
-
- # Dot's SVG output is
- #
- # <svg width="___" height="___"
- # viewBox="___" xmlns=...>
- # <g id="graph0" transform="...">
- # ...
- # </g>
- # </svg>
- #
- # Change it to
- #
- # <svg width="100%" height="100%"
- # xmlns=...>
- # $svg_javascript
- # <g id="viewport" transform="translate(0,0)">
- # <g id="graph0" transform="...">
- # ...
- # </g>
- # </g>
- # </svg>
-
- # Fix width, height; drop viewBox.
- $svg =~ s/(?s)<svg width="[^"]+" height="[^"]+"(.*?)viewBox="[^"]+"/<svg width="100%" height="100%"$1/;
-
- # Insert script, viewport <g> above first <g>
- my $svg_javascript = SvgJavascript();
- my $viewport = "<g id=\"viewport\" transform=\"translate(0,0)\">\n";
- $svg =~ s/<g id="graph\d"/$svg_javascript$viewport$&/;
-
- # Insert final </g> above </svg>.
- $svg =~ s/(.*)(<\/svg>)/$1<\/g>$2/;
- $svg =~ s/<g id="graph\d"(.*?)/<g id="viewport"$1/;
-
- if ($main::opt_svg) {
- # --svg: write to standard output.
- print $svg;
- } else {
- # Write back to temporary file.
- open(SVG, ">$svgfile") || die "open $svgfile: $!";
- print SVG $svg;
- close(SVG);
- }
-}
-
-sub SvgJavascript {
- return <<'EOF';
-<script type="text/ecmascript"><![CDATA[
-// SVGPan
-// http://www.cyberz.org/blog/2009/12/08/svgpan-a-javascript-svg-panzoomdrag-library/
-// Local modification: if(true || ...) below to force panning, never moving.
-
-/**
- * SVGPan library 1.2
- * ====================
- *
- * Given an unique existing element with id "viewport", including the
- * the library into any SVG adds the following capabilities:
- *
- * - Mouse panning
- * - Mouse zooming (using the wheel)
- * - Object dargging
- *
- * Known issues:
- *
- * - Zooming (while panning) on Safari has still some issues
- *
- * Releases:
- *
- * 1.2, Sat Mar 20 08:42:50 GMT 2010, Zeng Xiaohui
- * Fixed a bug with browser mouse handler interaction
- *
- * 1.1, Wed Feb 3 17:39:33 GMT 2010, Zeng Xiaohui
- * Updated the zoom code to support the mouse wheel on Safari/Chrome
- *
- * 1.0, Andrea Leofreddi
- * First release
- *
- * This code is licensed under the following BSD license:
- *
- * Copyright 2009-2010 Andrea Leofreddi <a.leofreddi@itcharm.com>. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY Andrea Leofreddi ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL Andrea Leofreddi OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those of the
- * authors and should not be interpreted as representing official policies, either expressed
- * or implied, of Andrea Leofreddi.
- */
-
-var root = document.documentElement;
-
-var state = 'none', stateTarget, stateOrigin, stateTf;
-
-setupHandlers(root);
-
-/**
- * Register handlers
- */
-function setupHandlers(root){
- setAttributes(root, {
- "onmouseup" : "add(evt)",
- "onmousedown" : "handleMouseDown(evt)",
- "onmousemove" : "handleMouseMove(evt)",
- "onmouseup" : "handleMouseUp(evt)",
- //"onmouseout" : "handleMouseUp(evt)", // Decomment this to stop the pan functionality when dragging out of the SVG element
- });
-
- if(navigator.userAgent.toLowerCase().indexOf('webkit') >= 0)
- window.addEventListener('mousewheel', handleMouseWheel, false); // Chrome/Safari
- else
- window.addEventListener('DOMMouseScroll', handleMouseWheel, false); // Others
-
- var g = svgDoc.getElementById("svg");
- g.width = "100%";
- g.height = "100%";
-}
-
-/**
- * Instance an SVGPoint object with given event coordinates.
- */
-function getEventPoint(evt) {
- var p = root.createSVGPoint();
-
- p.x = evt.clientX;
- p.y = evt.clientY;
-
- return p;
-}
-
-/**
- * Sets the current transform matrix of an element.
- */
-function setCTM(element, matrix) {
- var s = "matrix(" + matrix.a + "," + matrix.b + "," + matrix.c + "," + matrix.d + "," + matrix.e + "," + matrix.f + ")";
-
- element.setAttribute("transform", s);
-}
-
-/**
- * Dumps a matrix to a string (useful for debug).
- */
-function dumpMatrix(matrix) {
- var s = "[ " + matrix.a + ", " + matrix.c + ", " + matrix.e + "\n " + matrix.b + ", " + matrix.d + ", " + matrix.f + "\n 0, 0, 1 ]";
-
- return s;
-}
-
-/**
- * Sets attributes of an element.
- */
-function setAttributes(element, attributes){
- for (i in attributes)
- element.setAttributeNS(null, i, attributes[i]);
-}
-
-/**
- * Handle mouse move event.
- */
-function handleMouseWheel(evt) {
- if(evt.preventDefault)
- evt.preventDefault();
-
- evt.returnValue = false;
-
- var svgDoc = evt.target.ownerDocument;
-
- var delta;
-
- if(evt.wheelDelta)
- delta = evt.wheelDelta / 3600; // Chrome/Safari
- else
- delta = evt.detail / -90; // Mozilla
-
- var z = 1 + delta; // Zoom factor: 0.9/1.1
-
- var g = svgDoc.getElementById("viewport");
-
- var p = getEventPoint(evt);
-
- p = p.matrixTransform(g.getCTM().inverse());
-
- // Compute new scale matrix in current mouse position
- var k = root.createSVGMatrix().translate(p.x, p.y).scale(z).translate(-p.x, -p.y);
-
- setCTM(g, g.getCTM().multiply(k));
-
- stateTf = stateTf.multiply(k.inverse());
-}
-
-/**
- * Handle mouse move event.
- */
-function handleMouseMove(evt) {
- if(evt.preventDefault)
- evt.preventDefault();
-
- evt.returnValue = false;
-
- var svgDoc = evt.target.ownerDocument;
-
- var g = svgDoc.getElementById("viewport");
-
- if(state == 'pan') {
- // Pan mode
- var p = getEventPoint(evt).matrixTransform(stateTf);
-
- setCTM(g, stateTf.inverse().translate(p.x - stateOrigin.x, p.y - stateOrigin.y));
- } else if(state == 'move') {
- // Move mode
- var p = getEventPoint(evt).matrixTransform(g.getCTM().inverse());
-
- setCTM(stateTarget, root.createSVGMatrix().translate(p.x - stateOrigin.x, p.y - stateOrigin.y).multiply(g.getCTM().inverse()).multiply(stateTarget.getCTM()));
-
- stateOrigin = p;
- }
-}
-
-/**
- * Handle click event.
- */
-function handleMouseDown(evt) {
- if(evt.preventDefault)
- evt.preventDefault();
-
- evt.returnValue = false;
-
- var svgDoc = evt.target.ownerDocument;
-
- var g = svgDoc.getElementById("viewport");
-
- if(true || evt.target.tagName == "svg") {
- // Pan mode
- state = 'pan';
-
- stateTf = g.getCTM().inverse();
-
- stateOrigin = getEventPoint(evt).matrixTransform(stateTf);
- } else {
- // Move mode
- state = 'move';
-
- stateTarget = evt.target;
-
- stateTf = g.getCTM().inverse();
-
- stateOrigin = getEventPoint(evt).matrixTransform(stateTf);
- }
-}
-
-/**
- * Handle mouse button release event.
- */
-function handleMouseUp(evt) {
- if(evt.preventDefault)
- evt.preventDefault();
-
- evt.returnValue = false;
-
- var svgDoc = evt.target.ownerDocument;
-
- if(state == 'pan' || state == 'move') {
- // Quit pan mode
- state = '';
- }
-}
-
-]]></script>
-EOF
-}
-
-# Provides a map from fullname to shortname for cases where the
-# shortname is ambiguous. The symlist has both the fullname and
-# shortname for all symbols, which is usually fine, but sometimes --
-# such as overloaded functions -- two different fullnames can map to
-# the same shortname. In that case, we use the address of the
-# function to disambiguate the two. This function fills in a map that
-# maps fullnames to modified shortnames in such cases. If a fullname
-# is not present in the map, the 'normal' shortname provided by the
-# symlist is the appropriate one to use.
-sub FillFullnameToShortnameMap {
- my $symbols = shift;
- my $fullname_to_shortname_map = shift;
- my $shortnames_seen_once = {};
- my $shortnames_seen_more_than_once = {};
-
- foreach my $symlist (values(%{$symbols})) {
- # TODO(csilvers): deal with inlined symbols too.
- my $shortname = $symlist->[0];
- my $fullname = $symlist->[2];
- if ($fullname !~ /<[0-9a-fA-F]+>$/) { # fullname doesn't end in an address
- next; # the only collisions we care about are when addresses differ
- }
- if (defined($shortnames_seen_once->{$shortname}) &&
- $shortnames_seen_once->{$shortname} ne $fullname) {
- $shortnames_seen_more_than_once->{$shortname} = 1;
- } else {
- $shortnames_seen_once->{$shortname} = $fullname;
- }
- }
-
- foreach my $symlist (values(%{$symbols})) {
- my $shortname = $symlist->[0];
- my $fullname = $symlist->[2];
- # TODO(csilvers): take in a list of addresses we care about, and only
- # store in the map if $symlist->[1] is in that list. Saves space.
- next if defined($fullname_to_shortname_map->{$fullname});
- if (defined($shortnames_seen_more_than_once->{$shortname})) {
- if ($fullname =~ /<0*([^>]*)>$/) { # fullname has address at end of it
- $fullname_to_shortname_map->{$fullname} = "$shortname\@$1";
- }
- }
- }
-}
-
-# Return a small number that identifies the argument.
-# Multiple calls with the same argument will return the same number.
-# Calls with different arguments will return different numbers.
-sub ShortIdFor {
- my $key = shift;
- my $id = $main::uniqueid{$key};
- if (!defined($id)) {
- $id = keys(%main::uniqueid) + 1;
- $main::uniqueid{$key} = $id;
- }
- return $id;
-}
-
-# Translate a stack of addresses into a stack of symbols
-sub TranslateStack {
- my $symbols = shift;
- my $fullname_to_shortname_map = shift;
- my $k = shift;
-
- my @addrs = split(/\n/, $k);
- my @result = ();
- for (my $i = 0; $i <= $#addrs; $i++) {
- my $a = $addrs[$i];
-
- # Skip large addresses since they sometimes show up as fake entries on RH9
- if (length($a) > 8 && $a gt "7fffffffffffffff") {
- next;
- }
-
- if ($main::opt_disasm || $main::opt_list) {
- # We want just the address for the key
- push(@result, $a);
- next;
- }
-
- my $symlist = $symbols->{$a};
- if (!defined($symlist)) {
- $symlist = [$a, "", $a];
- }
-
- # We can have a sequence of symbols for a particular entry
- # (more than one symbol in the case of inlining). Callers
- # come before callees in symlist, so walk backwards since
- # the translated stack should contain callees before callers.
- for (my $j = $#{$symlist}; $j >= 2; $j -= 3) {
- my $func = $symlist->[$j-2];
- my $fileline = $symlist->[$j-1];
- my $fullfunc = $symlist->[$j];
- if (defined($fullname_to_shortname_map->{$fullfunc})) {
- $func = $fullname_to_shortname_map->{$fullfunc};
- }
- if ($j > 2) {
- $func = "$func (inline)";
- }
-
- # Do not merge nodes corresponding to Callback::Run since that
- # causes confusing cycles in dot display. Instead, we synthesize
- # a unique name for this frame per caller.
- if ($func =~ m/Callback.*::Run$/) {
- my $caller = ($i > 0) ? $addrs[$i-1] : 0;
- $func = "Run#" . ShortIdFor($caller);
- }
-
- if ($main::opt_addresses) {
- push(@result, "$a $func $fileline");
- } elsif ($main::opt_lines) {
- if ($func eq '??' && $fileline eq '??:0') {
- push(@result, "$a");
- } else {
- push(@result, "$func $fileline");
- }
- } elsif ($main::opt_functions) {
- if ($func eq '??') {
- push(@result, "$a");
- } else {
- push(@result, $func);
- }
- } elsif ($main::opt_files) {
- if ($fileline eq '??:0' || $fileline eq '') {
- push(@result, "$a");
- } else {
- my $f = $fileline;
- $f =~ s/:\d+$//;
- push(@result, $f);
- }
- } else {
- push(@result, $a);
- last; # Do not print inlined info
- }
- }
- }
-
- # print join(",", @addrs), " => ", join(",", @result), "\n";
- return @result;
-}
-
-# Generate percent string for a number and a total
-sub Percent {
- my $num = shift;
- my $tot = shift;
- if ($tot != 0) {
- return sprintf("%.1f%%", $num * 100.0 / $tot);
- } else {
- return ($num == 0) ? "nan" : (($num > 0) ? "+inf" : "-inf");
- }
-}
-
-# Generate pretty-printed form of number
-sub Unparse {
- my $num = shift;
- if ($main::profile_type eq 'heap' || $main::profile_type eq 'growth') {
- if ($main::opt_inuse_objects || $main::opt_alloc_objects) {
- return sprintf("%d", $num);
- } else {
- if ($main::opt_show_bytes) {
- return sprintf("%d", $num);
- } else {
- return sprintf("%.1f", $num / 1048576.0);
- }
- }
- } elsif ($main::profile_type eq 'contention' && !$main::opt_contentions) {
- return sprintf("%.3f", $num / 1e9); # Convert nanoseconds to seconds
- } else {
- return sprintf("%d", $num);
- }
-}
-
-# Alternate pretty-printed form: 0 maps to "."
-sub UnparseAlt {
- my $num = shift;
- if ($num == 0) {
- return ".";
- } else {
- return Unparse($num);
- }
-}
-
-# Alternate pretty-printed form: 0 maps to ""
-sub HtmlPrintNumber {
- my $num = shift;
- if ($num == 0) {
- return "";
- } else {
- return Unparse($num);
- }
-}
-
-# Return output units
-sub Units {
- if ($main::profile_type eq 'heap' || $main::profile_type eq 'growth') {
- if ($main::opt_inuse_objects || $main::opt_alloc_objects) {
- return "objects";
- } else {
- if ($main::opt_show_bytes) {
- return "B";
- } else {
- return "MB";
- }
- }
- } elsif ($main::profile_type eq 'contention' && !$main::opt_contentions) {
- return "seconds";
- } else {
- return "samples";
- }
-}
-
-##### Profile manipulation code #####
-
-# Generate flattened profile:
-# If count is charged to stack [a,b,c,d], in generated profile,
-# it will be charged to [a]
-sub FlatProfile {
- my $profile = shift;
- my $result = {};
- foreach my $k (keys(%{$profile})) {
- my $count = $profile->{$k};
- my @addrs = split(/\n/, $k);
- if ($#addrs >= 0) {
- AddEntry($result, $addrs[0], $count);
- }
- }
- return $result;
-}
-
-# Generate cumulative profile:
-# If count is charged to stack [a,b,c,d], in generated profile,
-# it will be charged to [a], [b], [c], [d]
-sub CumulativeProfile {
- my $profile = shift;
- my $result = {};
- foreach my $k (keys(%{$profile})) {
- my $count = $profile->{$k};
- my @addrs = split(/\n/, $k);
- foreach my $a (@addrs) {
- AddEntry($result, $a, $count);
- }
- }
- return $result;
-}
-
-# If the second-youngest PC on the stack is always the same, returns
-# that pc. Otherwise, returns undef.
-sub IsSecondPcAlwaysTheSame {
- my $profile = shift;
-
- my $second_pc = undef;
- foreach my $k (keys(%{$profile})) {
- my @addrs = split(/\n/, $k);
- if ($#addrs < 1) {
- return undef;
- }
- if (not defined $second_pc) {
- $second_pc = $addrs[1];
- } else {
- if ($second_pc ne $addrs[1]) {
- return undef;
- }
- }
- }
- return $second_pc;
-}
-
-sub ExtractSymbolLocation {
- my $symbols = shift;
- my $address = shift;
- # 'addr2line' outputs "??:0" for unknown locations; we do the
- # same to be consistent.
- my $location = "??:0:unknown";
- if (exists $symbols->{$address}) {
- my $file = $symbols->{$address}->[1];
- if ($file eq "?") {
- $file = "??:0"
- }
- $location = $file . ":" . $symbols->{$address}->[0];
- }
- return $location;
-}
-
-# Extracts a graph of calls.
-sub ExtractCalls {
- my $symbols = shift;
- my $profile = shift;
-
- my $calls = {};
- while( my ($stack_trace, $count) = each %$profile ) {
- my @address = split(/\n/, $stack_trace);
- my $destination = ExtractSymbolLocation($symbols, $address[0]);
- AddEntry($calls, $destination, $count);
- for (my $i = 1; $i <= $#address; $i++) {
- my $source = ExtractSymbolLocation($symbols, $address[$i]);
- my $call = "$source -> $destination";
- AddEntry($calls, $call, $count);
- $destination = $source;
- }
- }
-
- return $calls;
-}
-
-sub FilterFrames {
- my $symbols = shift;
- my $profile = shift;
-
- if ($main::opt_retain eq '' && $main::opt_exclude eq '') {
- return $profile;
- }
-
- my $result = {};
- foreach my $k (keys(%{$profile})) {
- my $count = $profile->{$k};
- my @addrs = split(/\n/, $k);
- my @path = ();
- foreach my $a (@addrs) {
- my $sym;
- if (exists($symbols->{$a})) {
- $sym = $symbols->{$a}->[0];
- } else {
- $sym = $a;
- }
- if ($main::opt_retain ne '' && $sym !~ m/$main::opt_retain/) {
- next;
- }
- if ($main::opt_exclude ne '' && $sym =~ m/$main::opt_exclude/) {
- next;
- }
- push(@path, $a);
- }
- if (scalar(@path) > 0) {
- my $reduced_path = join("\n", @path);
- AddEntry($result, $reduced_path, $count);
- }
- }
-
- return $result;
-}
-
-sub RemoveUninterestingFrames {
- my $symbols = shift;
- my $profile = shift;
-
- # List of function names to skip
- my %skip = ();
- my $skip_regexp = 'NOMATCH';
- if ($main::profile_type eq 'heap' || $main::profile_type eq 'growth') {
- foreach my $name ('calloc',
- 'cfree',
- 'malloc',
- 'free',
- 'memalign',
- 'posix_memalign',
- 'aligned_alloc',
- 'pvalloc',
- 'valloc',
- 'realloc',
- 'mallocx', # jemalloc
- 'rallocx', # jemalloc
- 'xallocx', # jemalloc
- 'dallocx', # jemalloc
- 'sdallocx', # jemalloc
- 'tc_calloc',
- 'tc_cfree',
- 'tc_malloc',
- 'tc_free',
- 'tc_memalign',
- 'tc_posix_memalign',
- 'tc_pvalloc',
- 'tc_valloc',
- 'tc_realloc',
- 'tc_new',
- 'tc_delete',
- 'tc_newarray',
- 'tc_deletearray',
- 'tc_new_nothrow',
- 'tc_newarray_nothrow',
- 'do_malloc',
- '::do_malloc', # new name -- got moved to an unnamed ns
- '::do_malloc_or_cpp_alloc',
- 'DoSampledAllocation',
- 'simple_alloc::allocate',
- '__malloc_alloc_template::allocate',
- '__builtin_delete',
- '__builtin_new',
- '__builtin_vec_delete',
- '__builtin_vec_new',
- 'operator new',
- 'operator new[]',
- # The entry to our memory-allocation routines on OS X
- 'malloc_zone_malloc',
- 'malloc_zone_calloc',
- 'malloc_zone_valloc',
- 'malloc_zone_realloc',
- 'malloc_zone_memalign',
- 'malloc_zone_free',
- # These mark the beginning/end of our custom sections
- '__start_google_malloc',
- '__stop_google_malloc',
- '__start_malloc_hook',
- '__stop_malloc_hook') {
- $skip{$name} = 1;
- $skip{"_" . $name} = 1; # Mach (OS X) adds a _ prefix to everything
- }
- # TODO: Remove TCMalloc once everything has been
- # moved into the tcmalloc:: namespace and we have flushed
- # old code out of the system.
- $skip_regexp = "TCMalloc|^tcmalloc::";
- } elsif ($main::profile_type eq 'contention') {
- foreach my $vname ('base::RecordLockProfileData',
- 'base::SubmitMutexProfileData',
- 'base::SubmitSpinLockProfileData',
- 'Mutex::Unlock',
- 'Mutex::UnlockSlow',
- 'Mutex::ReaderUnlock',
- 'MutexLock::~MutexLock',
- 'SpinLock::Unlock',
- 'SpinLock::SlowUnlock',
- 'SpinLockHolder::~SpinLockHolder') {
- $skip{$vname} = 1;
- }
- } elsif ($main::profile_type eq 'cpu') {
- # Drop signal handlers used for CPU profile collection
- # TODO(dpeng): this should not be necessary; it's taken
- # care of by the general 2nd-pc mechanism below.
- foreach my $name ('ProfileData::Add', # historical
- 'ProfileData::prof_handler', # historical
- 'CpuProfiler::prof_handler',
- '__FRAME_END__',
- '__pthread_sighandler',
- '__restore') {
- $skip{$name} = 1;
- }
- } else {
- # Nothing skipped for unknown types
- }
-
- if ($main::profile_type eq 'cpu') {
- # If all the second-youngest program counters are the same,
- # this STRONGLY suggests that it is an artifact of measurement,
- # i.e., stack frames pushed by the CPU profiler signal handler.
- # Hence, we delete them.
- # (The topmost PC is read from the signal structure, not from
- # the stack, so it does not get involved.)
- while (my $second_pc = IsSecondPcAlwaysTheSame($profile)) {
- my $result = {};
- my $func = '';
- if (exists($symbols->{$second_pc})) {
- $second_pc = $symbols->{$second_pc}->[0];
- }
- print STDERR "Removing $second_pc from all stack traces.\n";
- foreach my $k (keys(%{$profile})) {
- my $count = $profile->{$k};
- my @addrs = split(/\n/, $k);
- splice @addrs, 1, 1;
- my $reduced_path = join("\n", @addrs);
- AddEntry($result, $reduced_path, $count);
- }
- $profile = $result;
- }
- }
-
- my $result = {};
- foreach my $k (keys(%{$profile})) {
- my $count = $profile->{$k};
- my @addrs = split(/\n/, $k);
- my @path = ();
- foreach my $a (@addrs) {
- if (exists($symbols->{$a})) {
- my $func = $symbols->{$a}->[0];
- if ($skip{$func} || ($func =~ m/$skip_regexp/)) {
- # Throw away the portion of the backtrace seen so far, under the
- # assumption that previous frames were for functions internal to the
- # allocator.
- @path = ();
- next;
- }
- }
- push(@path, $a);
- }
- my $reduced_path = join("\n", @path);
- AddEntry($result, $reduced_path, $count);
- }
-
- $result = FilterFrames($symbols, $result);
-
- return $result;
-}
-
-# Reduce profile to granularity given by user
-sub ReduceProfile {
- my $symbols = shift;
- my $profile = shift;
- my $result = {};
- my $fullname_to_shortname_map = {};
- FillFullnameToShortnameMap($symbols, $fullname_to_shortname_map);
- foreach my $k (keys(%{$profile})) {
- my $count = $profile->{$k};
- my @translated = TranslateStack($symbols, $fullname_to_shortname_map, $k);
- my @path = ();
- my %seen = ();
- $seen{''} = 1; # So that empty keys are skipped
- foreach my $e (@translated) {
- # To avoid double-counting due to recursion, skip a stack-trace
- # entry if it has already been seen
- if (!$seen{$e}) {
- $seen{$e} = 1;
- push(@path, $e);
- }
- }
- my $reduced_path = join("\n", @path);
- AddEntry($result, $reduced_path, $count);
- }
- return $result;
-}
-
-# Does the specified symbol array match the regexp?
-sub SymbolMatches {
- my $sym = shift;
- my $re = shift;
- if (defined($sym)) {
- for (my $i = 0; $i < $#{$sym}; $i += 3) {
- if ($sym->[$i] =~ m/$re/ || $sym->[$i+1] =~ m/$re/) {
- return 1;
- }
- }
- }
- return 0;
-}
-
-# Focus only on paths involving specified regexps
-sub FocusProfile {
- my $symbols = shift;
- my $profile = shift;
- my $focus = shift;
- my $result = {};
- foreach my $k (keys(%{$profile})) {
- my $count = $profile->{$k};
- my @addrs = split(/\n/, $k);
- foreach my $a (@addrs) {
- # Reply if it matches either the address/shortname/fileline
- if (($a =~ m/$focus/) || SymbolMatches($symbols->{$a}, $focus)) {
- AddEntry($result, $k, $count);
- last;
- }
- }
- }
- return $result;
-}
-
-# Focus only on paths not involving specified regexps
-sub IgnoreProfile {
- my $symbols = shift;
- my $profile = shift;
- my $ignore = shift;
- my $result = {};
- foreach my $k (keys(%{$profile})) {
- my $count = $profile->{$k};
- my @addrs = split(/\n/, $k);
- my $matched = 0;
- foreach my $a (@addrs) {
- # Reply if it matches either the address/shortname/fileline
- if (($a =~ m/$ignore/) || SymbolMatches($symbols->{$a}, $ignore)) {
- $matched = 1;
- last;
- }
- }
- if (!$matched) {
- AddEntry($result, $k, $count);
- }
- }
- return $result;
-}
-
-# Get total count in profile
-sub TotalProfile {
- my $profile = shift;
- my $result = 0;
- foreach my $k (keys(%{$profile})) {
- $result += $profile->{$k};
- }
- return $result;
-}
-
-# Add A to B
-sub AddProfile {
- my $A = shift;
- my $B = shift;
-
- my $R = {};
- # add all keys in A
- foreach my $k (keys(%{$A})) {
- my $v = $A->{$k};
- AddEntry($R, $k, $v);
- }
- # add all keys in B
- foreach my $k (keys(%{$B})) {
- my $v = $B->{$k};
- AddEntry($R, $k, $v);
- }
- return $R;
-}
-
-# Merges symbol maps
-sub MergeSymbols {
- my $A = shift;
- my $B = shift;
-
- my $R = {};
- foreach my $k (keys(%{$A})) {
- $R->{$k} = $A->{$k};
- }
- if (defined($B)) {
- foreach my $k (keys(%{$B})) {
- $R->{$k} = $B->{$k};
- }
- }
- return $R;
-}
-
-
-# Add A to B
-sub AddPcs {
- my $A = shift;
- my $B = shift;
-
- my $R = {};
- # add all keys in A
- foreach my $k (keys(%{$A})) {
- $R->{$k} = 1
- }
- # add all keys in B
- foreach my $k (keys(%{$B})) {
- $R->{$k} = 1
- }
- return $R;
-}
-
-# Subtract B from A
-sub SubtractProfile {
- my $A = shift;
- my $B = shift;
-
- my $R = {};
- foreach my $k (keys(%{$A})) {
- my $v = $A->{$k} - GetEntry($B, $k);
- if ($v < 0 && $main::opt_drop_negative) {
- $v = 0;
- }
- AddEntry($R, $k, $v);
- }
- if (!$main::opt_drop_negative) {
- # Take care of when subtracted profile has more entries
- foreach my $k (keys(%{$B})) {
- if (!exists($A->{$k})) {
- AddEntry($R, $k, 0 - $B->{$k});
- }
- }
- }
- return $R;
-}
-
-# Get entry from profile; zero if not present
-sub GetEntry {
- my $profile = shift;
- my $k = shift;
- if (exists($profile->{$k})) {
- return $profile->{$k};
- } else {
- return 0;
- }
-}
-
-# Add entry to specified profile
-sub AddEntry {
- my $profile = shift;
- my $k = shift;
- my $n = shift;
- if (!exists($profile->{$k})) {
- $profile->{$k} = 0;
- }
- $profile->{$k} += $n;
-}
-
-# Add a stack of entries to specified profile, and add them to the $pcs
-# list.
-sub AddEntries {
- my $profile = shift;
- my $pcs = shift;
- my $stack = shift;
- my $count = shift;
- my @k = ();
-
- foreach my $e (split(/\s+/, $stack)) {
- my $pc = HexExtend($e);
- $pcs->{$pc} = 1;
- push @k, $pc;
- }
- AddEntry($profile, (join "\n", @k), $count);
-}
-
-##### Code to profile a server dynamically #####
-
-sub CheckSymbolPage {
- my $url = SymbolPageURL();
- my $command = ShellEscape(@URL_FETCHER, $url);
- open(SYMBOL, "$command |") or error($command);
- my $line = <SYMBOL>;
- $line =~ s/\r//g; # turn windows-looking lines into unix-looking lines
- close(SYMBOL);
- unless (defined($line)) {
- error("$url doesn't exist\n");
- }
-
- if ($line =~ /^num_symbols:\s+(\d+)$/) {
- if ($1 == 0) {
- error("Stripped binary. No symbols available.\n");
- }
- } else {
- error("Failed to get the number of symbols from $url\n");
- }
-}
-
-sub IsProfileURL {
- my $profile_name = shift;
- if (-f $profile_name) {
- printf STDERR "Using local file $profile_name.\n";
- return 0;
- }
- return 1;
-}
-
-sub ParseProfileURL {
- my $profile_name = shift;
-
- if (!defined($profile_name) || $profile_name eq "") {
- return ();
- }
-
- # Split profile URL - matches all non-empty strings, so no test.
- $profile_name =~ m,^(https?://)?([^/]+)(.*?)(/|$PROFILES)?$,;
-
- my $proto = $1 || "http://";
- my $hostport = $2;
- my $prefix = $3;
- my $profile = $4 || "/";
-
- my $host = $hostport;
- $host =~ s/:.*//;
-
- my $baseurl = "$proto$hostport$prefix";
- return ($host, $baseurl, $profile);
-}
-
-# We fetch symbols from the first profile argument.
-sub SymbolPageURL {
- my ($host, $baseURL, $path) = ParseProfileURL($main::pfile_args[0]);
- return "$baseURL$SYMBOL_PAGE";
-}
-
-sub FetchProgramName() {
- my ($host, $baseURL, $path) = ParseProfileURL($main::pfile_args[0]);
- my $url = "$baseURL$PROGRAM_NAME_PAGE";
- my $command_line = ShellEscape(@URL_FETCHER, $url);
- open(CMDLINE, "$command_line |") or error($command_line);
- my $cmdline = <CMDLINE>;
- $cmdline =~ s/\r//g; # turn windows-looking lines into unix-looking lines
- close(CMDLINE);
- error("Failed to get program name from $url\n") unless defined($cmdline);
- $cmdline =~ s/\x00.+//; # Remove argv[1] and latters.
- $cmdline =~ s!\n!!g; # Remove LFs.
- return $cmdline;
-}
-
-# Gee, curl's -L (--location) option isn't reliable at least
-# with its 7.12.3 version. Curl will forget to post data if
-# there is a redirection. This function is a workaround for
-# curl. Redirection happens on borg hosts.
-sub ResolveRedirectionForCurl {
- my $url = shift;
- my $command_line = ShellEscape(@URL_FETCHER, "--head", $url);
- open(CMDLINE, "$command_line |") or error($command_line);
- while (<CMDLINE>) {
- s/\r//g; # turn windows-looking lines into unix-looking lines
- if (/^Location: (.*)/) {
- $url = $1;
- }
- }
- close(CMDLINE);
- return $url;
-}
-
-# Add a timeout flat to URL_FETCHER. Returns a new list.
-sub AddFetchTimeout {
- my $timeout = shift;
- my @fetcher = @_;
- if (defined($timeout)) {
- if (join(" ", @fetcher) =~ m/\bcurl -s/) {
- push(@fetcher, "--max-time", sprintf("%d", $timeout));
- } elsif (join(" ", @fetcher) =~ m/\brpcget\b/) {
- push(@fetcher, sprintf("--deadline=%d", $timeout));
- }
- }
- return @fetcher;
-}
-
-# Reads a symbol map from the file handle name given as $1, returning
-# the resulting symbol map. Also processes variables relating to symbols.
-# Currently, the only variable processed is 'binary=<value>' which updates
-# $main::prog to have the correct program name.
-sub ReadSymbols {
- my $in = shift;
- my $map = {};
- while (<$in>) {
- s/\r//g; # turn windows-looking lines into unix-looking lines
- # Removes all the leading zeroes from the symbols, see comment below.
- if (m/^0x0*([0-9a-f]+)\s+(.+)/) {
- $map->{$1} = $2;
- } elsif (m/^---/) {
- last;
- } elsif (m/^([a-z][^=]*)=(.*)$/ ) {
- my ($variable, $value) = ($1, $2);
- for ($variable, $value) {
- s/^\s+//;
- s/\s+$//;
- }
- if ($variable eq "binary") {
- if ($main::prog ne $UNKNOWN_BINARY && $main::prog ne $value) {
- printf STDERR ("Warning: Mismatched binary name '%s', using '%s'.\n",
- $main::prog, $value);
- }
- $main::prog = $value;
- } else {
- printf STDERR ("Ignoring unknown variable in symbols list: " .
- "'%s' = '%s'\n", $variable, $value);
- }
- }
- }
- return $map;
-}
-
-sub URLEncode {
- my $str = shift;
- $str =~ s/([^A-Za-z0-9\-_.!~*'()])/ sprintf "%%%02x", ord $1 /eg;
- return $str;
-}
-
-sub AppendSymbolFilterParams {
- my $url = shift;
- my @params = ();
- if ($main::opt_retain ne '') {
- push(@params, sprintf("retain=%s", URLEncode($main::opt_retain)));
- }
- if ($main::opt_exclude ne '') {
- push(@params, sprintf("exclude=%s", URLEncode($main::opt_exclude)));
- }
- if (scalar @params > 0) {
- $url = sprintf("%s?%s", $url, join("&", @params));
- }
- return $url;
-}
-
-# Fetches and processes symbols to prepare them for use in the profile output
-# code. If the optional 'symbol_map' arg is not given, fetches symbols from
-# $SYMBOL_PAGE for all PC values found in profile. Otherwise, the raw symbols
-# are assumed to have already been fetched into 'symbol_map' and are simply
-# extracted and processed.
-sub FetchSymbols {
- my $pcset = shift;
- my $symbol_map = shift;
-
- my %seen = ();
- my @pcs = grep { !$seen{$_}++ } keys(%$pcset); # uniq
-
- if (!defined($symbol_map)) {
- my $post_data = join("+", sort((map {"0x" . "$_"} @pcs)));
-
- open(POSTFILE, ">$main::tmpfile_sym");
- print POSTFILE $post_data;
- close(POSTFILE);
-
- my $url = SymbolPageURL();
-
- my $command_line;
- if (join(" ", @URL_FETCHER) =~ m/\bcurl -s/) {
- $url = ResolveRedirectionForCurl($url);
- $url = AppendSymbolFilterParams($url);
- $command_line = ShellEscape(@URL_FETCHER, "-d", "\@$main::tmpfile_sym",
- $url);
- } else {
- $url = AppendSymbolFilterParams($url);
- $command_line = (ShellEscape(@URL_FETCHER, "--post", $url)
- . " < " . ShellEscape($main::tmpfile_sym));
- }
- # We use c++filt in case $SYMBOL_PAGE gives us mangled symbols.
- my $escaped_cppfilt = ShellEscape($obj_tool_map{"c++filt"});
- open(SYMBOL, "$command_line | $escaped_cppfilt |") or error($command_line);
- $symbol_map = ReadSymbols(*SYMBOL{IO});
- close(SYMBOL);
- }
-
- my $symbols = {};
- foreach my $pc (@pcs) {
- my $fullname;
- # For 64 bits binaries, symbols are extracted with 8 leading zeroes.
- # Then /symbol reads the long symbols in as uint64, and outputs
- # the result with a "0x%08llx" format which get rid of the zeroes.
- # By removing all the leading zeroes in both $pc and the symbols from
- # /symbol, the symbols match and are retrievable from the map.
- my $shortpc = $pc;
- $shortpc =~ s/^0*//;
- # Each line may have a list of names, which includes the function
- # and also other functions it has inlined. They are separated (in
- # PrintSymbolizedProfile), by --, which is illegal in function names.
- my $fullnames;
- if (defined($symbol_map->{$shortpc})) {
- $fullnames = $symbol_map->{$shortpc};
- } else {
- $fullnames = "0x" . $pc; # Just use addresses
- }
- my $sym = [];
- $symbols->{$pc} = $sym;
- foreach my $fullname (split("--", $fullnames)) {
- my $name = ShortFunctionName($fullname);
- push(@{$sym}, $name, "?", $fullname);
- }
- }
- return $symbols;
-}
-
-sub BaseName {
- my $file_name = shift;
- $file_name =~ s!^.*/!!; # Remove directory name
- return $file_name;
-}
-
-sub MakeProfileBaseName {
- my ($binary_name, $profile_name) = @_;
- my ($host, $baseURL, $path) = ParseProfileURL($profile_name);
- my $binary_shortname = BaseName($binary_name);
- return sprintf("%s.%s.%s",
- $binary_shortname, $main::op_time, $host);
-}
-
-sub FetchDynamicProfile {
- my $binary_name = shift;
- my $profile_name = shift;
- my $fetch_name_only = shift;
- my $encourage_patience = shift;
-
- if (!IsProfileURL($profile_name)) {
- return $profile_name;
- } else {
- my ($host, $baseURL, $path) = ParseProfileURL($profile_name);
- if ($path eq "" || $path eq "/") {
- # Missing type specifier defaults to cpu-profile
- $path = $PROFILE_PAGE;
- }
-
- my $profile_file = MakeProfileBaseName($binary_name, $profile_name);
-
- my $url = "$baseURL$path";
- my $fetch_timeout = undef;
- if ($path =~ m/$PROFILE_PAGE|$PMUPROFILE_PAGE/) {
- if ($path =~ m/[?]/) {
- $url .= "&";
- } else {
- $url .= "?";
- }
- $url .= sprintf("seconds=%d", $main::opt_seconds);
- $fetch_timeout = $main::opt_seconds * 1.01 + 60;
- # Set $profile_type for consumption by PrintSymbolizedProfile.
- $main::profile_type = 'cpu';
- } else {
- # For non-CPU profiles, we add a type-extension to
- # the target profile file name.
- my $suffix = $path;
- $suffix =~ s,/,.,g;
- $profile_file .= $suffix;
- # Set $profile_type for consumption by PrintSymbolizedProfile.
- if ($path =~ m/$HEAP_PAGE/) {
- $main::profile_type = 'heap';
- } elsif ($path =~ m/$GROWTH_PAGE/) {
- $main::profile_type = 'growth';
- } elsif ($path =~ m/$CONTENTION_PAGE/) {
- $main::profile_type = 'contention';
- }
- }
-
- my $profile_dir = $ENV{"JEPROF_TMPDIR"} || ($ENV{HOME} . "/jeprof");
- if (! -d $profile_dir) {
- mkdir($profile_dir)
- || die("Unable to create profile directory $profile_dir: $!\n");
- }
- my $tmp_profile = "$profile_dir/.tmp.$profile_file";
- my $real_profile = "$profile_dir/$profile_file";
-
- if ($fetch_name_only > 0) {
- return $real_profile;
- }
-
- my @fetcher = AddFetchTimeout($fetch_timeout, @URL_FETCHER);
- my $cmd = ShellEscape(@fetcher, $url) . " > " . ShellEscape($tmp_profile);
- if ($path =~ m/$PROFILE_PAGE|$PMUPROFILE_PAGE|$CENSUSPROFILE_PAGE/){
- print STDERR "Gathering CPU profile from $url for $main::opt_seconds seconds to\n ${real_profile}\n";
- if ($encourage_patience) {
- print STDERR "Be patient...\n";
- }
- } else {
- print STDERR "Fetching $path profile from $url to\n ${real_profile}\n";
- }
-
- (system($cmd) == 0) || error("Failed to get profile: $cmd: $!\n");
- (system("mv", $tmp_profile, $real_profile) == 0) || error("Unable to rename profile\n");
- print STDERR "Wrote profile to $real_profile\n";
- $main::collected_profile = $real_profile;
- return $main::collected_profile;
- }
-}
-
-# Collect profiles in parallel
-sub FetchDynamicProfiles {
- my $items = scalar(@main::pfile_args);
- my $levels = log($items) / log(2);
-
- if ($items == 1) {
- $main::profile_files[0] = FetchDynamicProfile($main::prog, $main::pfile_args[0], 0, 1);
- } else {
- # math rounding issues
- if ((2 ** $levels) < $items) {
- $levels++;
- }
- my $count = scalar(@main::pfile_args);
- for (my $i = 0; $i < $count; $i++) {
- $main::profile_files[$i] = FetchDynamicProfile($main::prog, $main::pfile_args[$i], 1, 0);
- }
- print STDERR "Fetching $count profiles, Be patient...\n";
- FetchDynamicProfilesRecurse($levels, 0, 0);
- $main::collected_profile = join(" \\\n ", @main::profile_files);
- }
-}
-
-# Recursively fork a process to get enough processes
-# collecting profiles
-sub FetchDynamicProfilesRecurse {
- my $maxlevel = shift;
- my $level = shift;
- my $position = shift;
-
- if (my $pid = fork()) {
- $position = 0 | ($position << 1);
- TryCollectProfile($maxlevel, $level, $position);
- wait;
- } else {
- $position = 1 | ($position << 1);
- TryCollectProfile($maxlevel, $level, $position);
- cleanup();
- exit(0);
- }
-}
-
-# Collect a single profile
-sub TryCollectProfile {
- my $maxlevel = shift;
- my $level = shift;
- my $position = shift;
-
- if ($level >= ($maxlevel - 1)) {
- if ($position < scalar(@main::pfile_args)) {
- FetchDynamicProfile($main::prog, $main::pfile_args[$position], 0, 0);
- }
- } else {
- FetchDynamicProfilesRecurse($maxlevel, $level+1, $position);
- }
-}
-
-##### Parsing code #####
-
-# Provide a small streaming-read module to handle very large
-# cpu-profile files. Stream in chunks along a sliding window.
-# Provides an interface to get one 'slot', correctly handling
-# endian-ness differences. A slot is one 32-bit or 64-bit word
-# (depending on the input profile). We tell endianness and bit-size
-# for the profile by looking at the first 8 bytes: in cpu profiles,
-# the second slot is always 3 (we'll accept anything that's not 0).
-BEGIN {
- package CpuProfileStream;
-
- sub new {
- my ($class, $file, $fname) = @_;
- my $self = { file => $file,
- base => 0,
- stride => 512 * 1024, # must be a multiple of bitsize/8
- slots => [],
- unpack_code => "", # N for big-endian, V for little
- perl_is_64bit => 1, # matters if profile is 64-bit
- };
- bless $self, $class;
- # Let unittests adjust the stride
- if ($main::opt_test_stride > 0) {
- $self->{stride} = $main::opt_test_stride;
- }
- # Read the first two slots to figure out bitsize and endianness.
- my $slots = $self->{slots};
- my $str;
- read($self->{file}, $str, 8);
- # Set the global $address_length based on what we see here.
- # 8 is 32-bit (8 hexadecimal chars); 16 is 64-bit (16 hexadecimal chars).
- $address_length = ($str eq (chr(0)x8)) ? 16 : 8;
- if ($address_length == 8) {
- if (substr($str, 6, 2) eq chr(0)x2) {
- $self->{unpack_code} = 'V'; # Little-endian.
- } elsif (substr($str, 4, 2) eq chr(0)x2) {
- $self->{unpack_code} = 'N'; # Big-endian
- } else {
- ::error("$fname: header size >= 2**16\n");
- }
- @$slots = unpack($self->{unpack_code} . "*", $str);
- } else {
- # If we're a 64-bit profile, check if we're a 64-bit-capable
- # perl. Otherwise, each slot will be represented as a float
- # instead of an int64, losing precision and making all the
- # 64-bit addresses wrong. We won't complain yet, but will
- # later if we ever see a value that doesn't fit in 32 bits.
- my $has_q = 0;
- eval { $has_q = pack("Q", "1") ? 1 : 1; };
- if (!$has_q) {
- $self->{perl_is_64bit} = 0;
- }
- read($self->{file}, $str, 8);
- if (substr($str, 4, 4) eq chr(0)x4) {
- # We'd love to use 'Q', but it's a) not universal, b) not endian-proof.
- $self->{unpack_code} = 'V'; # Little-endian.
- } elsif (substr($str, 0, 4) eq chr(0)x4) {
- $self->{unpack_code} = 'N'; # Big-endian
- } else {
- ::error("$fname: header size >= 2**32\n");
- }
- my @pair = unpack($self->{unpack_code} . "*", $str);
- # Since we know one of the pair is 0, it's fine to just add them.
- @$slots = (0, $pair[0] + $pair[1]);
- }
- return $self;
- }
-
- # Load more data when we access slots->get(X) which is not yet in memory.
- sub overflow {
- my ($self) = @_;
- my $slots = $self->{slots};
- $self->{base} += $#$slots + 1; # skip over data we're replacing
- my $str;
- read($self->{file}, $str, $self->{stride});
- if ($address_length == 8) { # the 32-bit case
- # This is the easy case: unpack provides 32-bit unpacking primitives.
- @$slots = unpack($self->{unpack_code} . "*", $str);
- } else {
- # We need to unpack 32 bits at a time and combine.
- my @b32_values = unpack($self->{unpack_code} . "*", $str);
- my @b64_values = ();
- for (my $i = 0; $i < $#b32_values; $i += 2) {
- # TODO(csilvers): if this is a 32-bit perl, the math below
- # could end up in a too-large int, which perl will promote
- # to a double, losing necessary precision. Deal with that.
- # Right now, we just die.
- my ($lo, $hi) = ($b32_values[$i], $b32_values[$i+1]);
- if ($self->{unpack_code} eq 'N') { # big-endian
- ($lo, $hi) = ($hi, $lo);
- }
- my $value = $lo + $hi * (2**32);
- if (!$self->{perl_is_64bit} && # check value is exactly represented
- (($value % (2**32)) != $lo || int($value / (2**32)) != $hi)) {
- ::error("Need a 64-bit perl to process this 64-bit profile.\n");
- }
- push(@b64_values, $value);
- }
- @$slots = @b64_values;
- }
- }
-
- # Access the i-th long in the file (logically), or -1 at EOF.
- sub get {
- my ($self, $idx) = @_;
- my $slots = $self->{slots};
- while ($#$slots >= 0) {
- if ($idx < $self->{base}) {
- # The only time we expect a reference to $slots[$i - something]
- # after referencing $slots[$i] is reading the very first header.
- # Since $stride > |header|, that shouldn't cause any lookback
- # errors. And everything after the header is sequential.
- print STDERR "Unexpected look-back reading CPU profile";
- return -1; # shrug, don't know what better to return
- } elsif ($idx > $self->{base} + $#$slots) {
- $self->overflow();
- } else {
- return $slots->[$idx - $self->{base}];
- }
- }
- # If we get here, $slots is [], which means we've reached EOF
- return -1; # unique since slots is supposed to hold unsigned numbers
- }
-}
-
-# Reads the top, 'header' section of a profile, and returns the last
-# line of the header, commonly called a 'header line'. The header
-# section of a profile consists of zero or more 'command' lines that
-# are instructions to jeprof, which jeprof executes when reading the
-# header. All 'command' lines start with a %. After the command
-# lines is the 'header line', which is a profile-specific line that
-# indicates what type of profile it is, and perhaps other global
-# information about the profile. For instance, here's a header line
-# for a heap profile:
-# heap profile: 53: 38236 [ 5525: 1284029] @ heapprofile
-# For historical reasons, the CPU profile does not contain a text-
-# readable header line. If the profile looks like a CPU profile,
-# this function returns "". If no header line could be found, this
-# function returns undef.
-#
-# The following commands are recognized:
-# %warn -- emit the rest of this line to stderr, prefixed by 'WARNING:'
-#
-# The input file should be in binmode.
-sub ReadProfileHeader {
- local *PROFILE = shift;
- my $firstchar = "";
- my $line = "";
- read(PROFILE, $firstchar, 1);
- seek(PROFILE, -1, 1); # unread the firstchar
- if ($firstchar !~ /[[:print:]]/) { # is not a text character
- return "";
- }
- while (defined($line = <PROFILE>)) {
- $line =~ s/\r//g; # turn windows-looking lines into unix-looking lines
- if ($line =~ /^%warn\s+(.*)/) { # 'warn' command
- # Note this matches both '%warn blah\n' and '%warn\n'.
- print STDERR "WARNING: $1\n"; # print the rest of the line
- } elsif ($line =~ /^%/) {
- print STDERR "Ignoring unknown command from profile header: $line";
- } else {
- # End of commands, must be the header line.
- return $line;
- }
- }
- return undef; # got to EOF without seeing a header line
-}
-
-sub IsSymbolizedProfileFile {
- my $file_name = shift;
- if (!(-e $file_name) || !(-r $file_name)) {
- return 0;
- }
- # Check if the file contains a symbol-section marker.
- open(TFILE, "<$file_name");
- binmode TFILE;
- my $firstline = ReadProfileHeader(*TFILE);
- close(TFILE);
- if (!$firstline) {
- return 0;
- }
- $SYMBOL_PAGE =~ m,[^/]+$,; # matches everything after the last slash
- my $symbol_marker = $&;
- return $firstline =~ /^--- *$symbol_marker/;
-}
-
-# Parse profile generated by common/profiler.cc and return a reference
-# to a map:
-# $result->{version} Version number of profile file
-# $result->{period} Sampling period (in microseconds)
-# $result->{profile} Profile object
-# $result->{threads} Map of thread IDs to profile objects
-# $result->{map} Memory map info from profile
-# $result->{pcs} Hash of all PC values seen, key is hex address
-sub ReadProfile {
- my $prog = shift;
- my $fname = shift;
- my $result; # return value
-
- $CONTENTION_PAGE =~ m,[^/]+$,; # matches everything after the last slash
- my $contention_marker = $&;
- $GROWTH_PAGE =~ m,[^/]+$,; # matches everything after the last slash
- my $growth_marker = $&;
- $SYMBOL_PAGE =~ m,[^/]+$,; # matches everything after the last slash
- my $symbol_marker = $&;
- $PROFILE_PAGE =~ m,[^/]+$,; # matches everything after the last slash
- my $profile_marker = $&;
- $HEAP_PAGE =~ m,[^/]+$,; # matches everything after the last slash
- my $heap_marker = $&;
-
- # Look at first line to see if it is a heap or a CPU profile.
- # CPU profile may start with no header at all, and just binary data
- # (starting with \0\0\0\0) -- in that case, don't try to read the
- # whole firstline, since it may be gigabytes(!) of data.
- open(PROFILE, "<$fname") || error("$fname: $!\n");
- binmode PROFILE; # New perls do UTF-8 processing
- my $header = ReadProfileHeader(*PROFILE);
- if (!defined($header)) { # means "at EOF"
- error("Profile is empty.\n");
- }
-
- my $symbols;
- if ($header =~ m/^--- *$symbol_marker/o) {
- # Verify that the user asked for a symbolized profile
- if (!$main::use_symbolized_profile) {
- # we have both a binary and symbolized profiles, abort
- error("FATAL ERROR: Symbolized profile\n $fname\ncannot be used with " .
- "a binary arg. Try again without passing\n $prog\n");
- }
- # Read the symbol section of the symbolized profile file.
- $symbols = ReadSymbols(*PROFILE{IO});
- # Read the next line to get the header for the remaining profile.
- $header = ReadProfileHeader(*PROFILE) || "";
- }
-
- if ($header =~ m/^--- *($heap_marker|$growth_marker)/o) {
- # Skip "--- ..." line for profile types that have their own headers.
- $header = ReadProfileHeader(*PROFILE) || "";
- }
-
- $main::profile_type = '';
-
- if ($header =~ m/^heap profile:.*$growth_marker/o) {
- $main::profile_type = 'growth';
- $result = ReadHeapProfile($prog, *PROFILE, $header);
- } elsif ($header =~ m/^heap profile:/) {
- $main::profile_type = 'heap';
- $result = ReadHeapProfile($prog, *PROFILE, $header);
- } elsif ($header =~ m/^heap/) {
- $main::profile_type = 'heap';
- $result = ReadThreadedHeapProfile($prog, $fname, $header);
- } elsif ($header =~ m/^--- *$contention_marker/o) {
- $main::profile_type = 'contention';
- $result = ReadSynchProfile($prog, *PROFILE);
- } elsif ($header =~ m/^--- *Stacks:/) {
- print STDERR
- "Old format contention profile: mistakenly reports " .
- "condition variable signals as lock contentions.\n";
- $main::profile_type = 'contention';
- $result = ReadSynchProfile($prog, *PROFILE);
- } elsif ($header =~ m/^--- *$profile_marker/) {
- # the binary cpu profile data starts immediately after this line
- $main::profile_type = 'cpu';
- $result = ReadCPUProfile($prog, $fname, *PROFILE);
- } else {
- if (defined($symbols)) {
- # a symbolized profile contains a format we don't recognize, bail out
- error("$fname: Cannot recognize profile section after symbols.\n");
- }
- # no ascii header present -- must be a CPU profile
- $main::profile_type = 'cpu';
- $result = ReadCPUProfile($prog, $fname, *PROFILE);
- }
-
- close(PROFILE);
-
- # if we got symbols along with the profile, return those as well
- if (defined($symbols)) {
- $result->{symbols} = $symbols;
- }
-
- return $result;
-}
-
-# Subtract one from caller pc so we map back to call instr.
-# However, don't do this if we're reading a symbolized profile
-# file, in which case the subtract-one was done when the file
-# was written.
-#
-# We apply the same logic to all readers, though ReadCPUProfile uses an
-# independent implementation.
-sub FixCallerAddresses {
- my $stack = shift;
- # --raw/http: Always subtract one from pc's, because PrintSymbolizedProfile()
- # dumps unadjusted profiles.
- {
- $stack =~ /(\s)/;
- my $delimiter = $1;
- my @addrs = split(' ', $stack);
- my @fixedaddrs;
- $#fixedaddrs = $#addrs;
- if ($#addrs >= 0) {
- $fixedaddrs[0] = $addrs[0];
- }
- for (my $i = 1; $i <= $#addrs; $i++) {
- $fixedaddrs[$i] = AddressSub($addrs[$i], "0x1");
- }
- return join $delimiter, @fixedaddrs;
- }
-}
-
-# CPU profile reader
-sub ReadCPUProfile {
- my $prog = shift;
- my $fname = shift; # just used for logging
- local *PROFILE = shift;
- my $version;
- my $period;
- my $i;
- my $profile = {};
- my $pcs = {};
-
- # Parse string into array of slots.
- my $slots = CpuProfileStream->new(*PROFILE, $fname);
-
- # Read header. The current header version is a 5-element structure
- # containing:
- # 0: header count (always 0)
- # 1: header "words" (after this one: 3)
- # 2: format version (0)
- # 3: sampling period (usec)
- # 4: unused padding (always 0)
- if ($slots->get(0) != 0 ) {
- error("$fname: not a profile file, or old format profile file\n");
- }
- $i = 2 + $slots->get(1);
- $version = $slots->get(2);
- $period = $slots->get(3);
- # Do some sanity checking on these header values.
- if ($version > (2**32) || $period > (2**32) || $i > (2**32) || $i < 5) {
- error("$fname: not a profile file, or corrupted profile file\n");
- }
-
- # Parse profile
- while ($slots->get($i) != -1) {
- my $n = $slots->get($i++);
- my $d = $slots->get($i++);
- if ($d > (2**16)) { # TODO(csilvers): what's a reasonable max-stack-depth?
- my $addr = sprintf("0%o", $i * ($address_length == 8 ? 4 : 8));
- print STDERR "At index $i (address $addr):\n";
- error("$fname: stack trace depth >= 2**32\n");
- }
- if ($slots->get($i) == 0) {
- # End of profile data marker
- $i += $d;
- last;
- }
-
- # Make key out of the stack entries
- my @k = ();
- for (my $j = 0; $j < $d; $j++) {
- my $pc = $slots->get($i+$j);
- # Subtract one from caller pc so we map back to call instr.
- $pc--;
- $pc = sprintf("%0*x", $address_length, $pc);
- $pcs->{$pc} = 1;
- push @k, $pc;
- }
-
- AddEntry($profile, (join "\n", @k), $n);
- $i += $d;
- }
-
- # Parse map
- my $map = '';
- seek(PROFILE, $i * 4, 0);
- read(PROFILE, $map, (stat PROFILE)[7]);
-
- my $r = {};
- $r->{version} = $version;
- $r->{period} = $period;
- $r->{profile} = $profile;
- $r->{libs} = ParseLibraries($prog, $map, $pcs);
- $r->{pcs} = $pcs;
-
- return $r;
-}
-
-sub HeapProfileIndex {
- my $index = 1;
- if ($main::opt_inuse_space) {
- $index = 1;
- } elsif ($main::opt_inuse_objects) {
- $index = 0;
- } elsif ($main::opt_alloc_space) {
- $index = 3;
- } elsif ($main::opt_alloc_objects) {
- $index = 2;
- }
- return $index;
-}
-
-sub ReadMappedLibraries {
- my $fh = shift;
- my $map = "";
- # Read the /proc/self/maps data
- while (<$fh>) {
- s/\r//g; # turn windows-looking lines into unix-looking lines
- $map .= $_;
- }
- return $map;
-}
-
-sub ReadMemoryMap {
- my $fh = shift;
- my $map = "";
- # Read /proc/self/maps data as formatted by DumpAddressMap()
- my $buildvar = "";
- while (<PROFILE>) {
- s/\r//g; # turn windows-looking lines into unix-looking lines
- # Parse "build=<dir>" specification if supplied
- if (m/^\s*build=(.*)\n/) {
- $buildvar = $1;
- }
-
- # Expand "$build" variable if available
- $_ =~ s/\$build\b/$buildvar/g;
-
- $map .= $_;
- }
- return $map;
-}
-
-sub AdjustSamples {
- my ($sample_adjustment, $sampling_algorithm, $n1, $s1, $n2, $s2) = @_;
- if ($sample_adjustment) {
- if ($sampling_algorithm == 2) {
- # Remote-heap version 2
- # The sampling frequency is the rate of a Poisson process.
- # This means that the probability of sampling an allocation of
- # size X with sampling rate Y is 1 - exp(-X/Y)
- if ($n1 != 0) {
- my $ratio = (($s1*1.0)/$n1)/($sample_adjustment);
- my $scale_factor = 1/(1 - exp(-$ratio));
- $n1 *= $scale_factor;
- $s1 *= $scale_factor;
- }
- if ($n2 != 0) {
- my $ratio = (($s2*1.0)/$n2)/($sample_adjustment);
- my $scale_factor = 1/(1 - exp(-$ratio));
- $n2 *= $scale_factor;
- $s2 *= $scale_factor;
- }
- } else {
- # Remote-heap version 1
- my $ratio;
- $ratio = (($s1*1.0)/$n1)/($sample_adjustment);
- if ($ratio < 1) {
- $n1 /= $ratio;
- $s1 /= $ratio;
- }
- $ratio = (($s2*1.0)/$n2)/($sample_adjustment);
- if ($ratio < 1) {
- $n2 /= $ratio;
- $s2 /= $ratio;
- }
- }
- }
- return ($n1, $s1, $n2, $s2);
-}
-
-sub ReadHeapProfile {
- my $prog = shift;
- local *PROFILE = shift;
- my $header = shift;
-
- my $index = HeapProfileIndex();
-
- # Find the type of this profile. The header line looks like:
- # heap profile: 1246: 8800744 [ 1246: 8800744] @ <heap-url>/266053
- # There are two pairs <count: size>, the first inuse objects/space, and the
- # second allocated objects/space. This is followed optionally by a profile
- # type, and if that is present, optionally by a sampling frequency.
- # For remote heap profiles (v1):
- # The interpretation of the sampling frequency is that the profiler, for
- # each sample, calculates a uniformly distributed random integer less than
- # the given value, and records the next sample after that many bytes have
- # been allocated. Therefore, the expected sample interval is half of the
- # given frequency. By default, if not specified, the expected sample
- # interval is 128KB. Only remote-heap-page profiles are adjusted for
- # sample size.
- # For remote heap profiles (v2):
- # The sampling frequency is the rate of a Poisson process. This means that
- # the probability of sampling an allocation of size X with sampling rate Y
- # is 1 - exp(-X/Y)
- # For version 2, a typical header line might look like this:
- # heap profile: 1922: 127792360 [ 1922: 127792360] @ <heap-url>_v2/524288
- # the trailing number (524288) is the sampling rate. (Version 1 showed
- # double the 'rate' here)
- my $sampling_algorithm = 0;
- my $sample_adjustment = 0;
- chomp($header);
- my $type = "unknown";
- if ($header =~ m"^heap profile:\s*(\d+):\s+(\d+)\s+\[\s*(\d+):\s+(\d+)\](\s*@\s*([^/]*)(/(\d+))?)?") {
- if (defined($6) && ($6 ne '')) {
- $type = $6;
- my $sample_period = $8;
- # $type is "heapprofile" for profiles generated by the
- # heap-profiler, and either "heap" or "heap_v2" for profiles
- # generated by sampling directly within tcmalloc. It can also
- # be "growth" for heap-growth profiles. The first is typically
- # found for profiles generated locally, and the others for
- # remote profiles.
- if (($type eq "heapprofile") || ($type !~ /heap/) ) {
- # No need to adjust for the sampling rate with heap-profiler-derived data
- $sampling_algorithm = 0;
- } elsif ($type =~ /_v2/) {
- $sampling_algorithm = 2; # version 2 sampling
- if (defined($sample_period) && ($sample_period ne '')) {
- $sample_adjustment = int($sample_period);
- }
- } else {
- $sampling_algorithm = 1; # version 1 sampling
- if (defined($sample_period) && ($sample_period ne '')) {
- $sample_adjustment = int($sample_period)/2;
- }
- }
- } else {
- # We detect whether or not this is a remote-heap profile by checking
- # that the total-allocated stats ($n2,$s2) are exactly the
- # same as the in-use stats ($n1,$s1). It is remotely conceivable
- # that a non-remote-heap profile may pass this check, but it is hard
- # to imagine how that could happen.
- # In this case it's so old it's guaranteed to be remote-heap version 1.
- my ($n1, $s1, $n2, $s2) = ($1, $2, $3, $4);
- if (($n1 == $n2) && ($s1 == $s2)) {
- # This is likely to be a remote-heap based sample profile
- $sampling_algorithm = 1;
- }
- }
- }
-
- if ($sampling_algorithm > 0) {
- # For remote-heap generated profiles, adjust the counts and sizes to
- # account for the sample rate (we sample once every 128KB by default).
- if ($sample_adjustment == 0) {
- # Turn on profile adjustment.
- $sample_adjustment = 128*1024;
- print STDERR "Adjusting heap profiles for 1-in-128KB sampling rate\n";
- } else {
- printf STDERR ("Adjusting heap profiles for 1-in-%d sampling rate\n",
- $sample_adjustment);
- }
- if ($sampling_algorithm > 1) {
- # We don't bother printing anything for the original version (version 1)
- printf STDERR "Heap version $sampling_algorithm\n";
- }
- }
-
- my $profile = {};
- my $pcs = {};
- my $map = "";
-
- while (<PROFILE>) {
- s/\r//g; # turn windows-looking lines into unix-looking lines
- if (/^MAPPED_LIBRARIES:/) {
- $map .= ReadMappedLibraries(*PROFILE);
- last;
- }
-
- if (/^--- Memory map:/) {
- $map .= ReadMemoryMap(*PROFILE);
- last;
- }
-
- # Read entry of the form:
- # <count1>: <bytes1> [<count2>: <bytes2>] @ a1 a2 a3 ... an
- s/^\s*//;
- s/\s*$//;
- if (m/^\s*(\d+):\s+(\d+)\s+\[\s*(\d+):\s+(\d+)\]\s+@\s+(.*)$/) {
- my $stack = $5;
- my ($n1, $s1, $n2, $s2) = ($1, $2, $3, $4);
- my @counts = AdjustSamples($sample_adjustment, $sampling_algorithm,
- $n1, $s1, $n2, $s2);
- AddEntries($profile, $pcs, FixCallerAddresses($stack), $counts[$index]);
- }
- }
-
- my $r = {};
- $r->{version} = "heap";
- $r->{period} = 1;
- $r->{profile} = $profile;
- $r->{libs} = ParseLibraries($prog, $map, $pcs);
- $r->{pcs} = $pcs;
- return $r;
-}
-
-sub ReadThreadedHeapProfile {
- my ($prog, $fname, $header) = @_;
-
- my $index = HeapProfileIndex();
- my $sampling_algorithm = 0;
- my $sample_adjustment = 0;
- chomp($header);
- my $type = "unknown";
- # Assuming a very specific type of header for now.
- if ($header =~ m"^heap_v2/(\d+)") {
- $type = "_v2";
- $sampling_algorithm = 2;
- $sample_adjustment = int($1);
- }
- if ($type ne "_v2" || !defined($sample_adjustment)) {
- die "Threaded heap profiles require v2 sampling with a sample rate\n";
- }
-
- my $profile = {};
- my $thread_profiles = {};
- my $pcs = {};
- my $map = "";
- my $stack = "";
-
- while (<PROFILE>) {
- s/\r//g;
- if (/^MAPPED_LIBRARIES:/) {
- $map .= ReadMappedLibraries(*PROFILE);
- last;
- }
-
- if (/^--- Memory map:/) {
- $map .= ReadMemoryMap(*PROFILE);
- last;
- }
-
- # Read entry of the form:
- # @ a1 a2 ... an
- # t*: <count1>: <bytes1> [<count2>: <bytes2>]
- # t1: <count1>: <bytes1> [<count2>: <bytes2>]
- # ...
- # tn: <count1>: <bytes1> [<count2>: <bytes2>]
- s/^\s*//;
- s/\s*$//;
- if (m/^@\s+(.*)$/) {
- $stack = $1;
- } elsif (m/^\s*(t(\*|\d+)):\s+(\d+):\s+(\d+)\s+\[\s*(\d+):\s+(\d+)\]$/) {
- if ($stack eq "") {
- # Still in the header, so this is just a per-thread summary.
- next;
- }
- my $thread = $2;
- my ($n1, $s1, $n2, $s2) = ($3, $4, $5, $6);
- my @counts = AdjustSamples($sample_adjustment, $sampling_algorithm,
- $n1, $s1, $n2, $s2);
- if ($thread eq "*") {
- AddEntries($profile, $pcs, FixCallerAddresses($stack), $counts[$index]);
- } else {
- if (!exists($thread_profiles->{$thread})) {
- $thread_profiles->{$thread} = {};
- }
- AddEntries($thread_profiles->{$thread}, $pcs,
- FixCallerAddresses($stack), $counts[$index]);
- }
- }
- }
-
- my $r = {};
- $r->{version} = "heap";
- $r->{period} = 1;
- $r->{profile} = $profile;
- $r->{threads} = $thread_profiles;
- $r->{libs} = ParseLibraries($prog, $map, $pcs);
- $r->{pcs} = $pcs;
- return $r;
-}
-
-sub ReadSynchProfile {
- my $prog = shift;
- local *PROFILE = shift;
- my $header = shift;
-
- my $map = '';
- my $profile = {};
- my $pcs = {};
- my $sampling_period = 1;
- my $cyclespernanosec = 2.8; # Default assumption for old binaries
- my $seen_clockrate = 0;
- my $line;
-
- my $index = 0;
- if ($main::opt_total_delay) {
- $index = 0;
- } elsif ($main::opt_contentions) {
- $index = 1;
- } elsif ($main::opt_mean_delay) {
- $index = 2;
- }
-
- while ( $line = <PROFILE> ) {
- $line =~ s/\r//g; # turn windows-looking lines into unix-looking lines
- if ( $line =~ /^\s*(\d+)\s+(\d+) \@\s*(.*?)\s*$/ ) {
- my ($cycles, $count, $stack) = ($1, $2, $3);
-
- # Convert cycles to nanoseconds
- $cycles /= $cyclespernanosec;
-
- # Adjust for sampling done by application
- $cycles *= $sampling_period;
- $count *= $sampling_period;
-
- my @values = ($cycles, $count, $cycles / $count);
- AddEntries($profile, $pcs, FixCallerAddresses($stack), $values[$index]);
-
- } elsif ( $line =~ /^(slow release).*thread \d+ \@\s*(.*?)\s*$/ ||
- $line =~ /^\s*(\d+) \@\s*(.*?)\s*$/ ) {
- my ($cycles, $stack) = ($1, $2);
- if ($cycles !~ /^\d+$/) {
- next;
- }
-
- # Convert cycles to nanoseconds
- $cycles /= $cyclespernanosec;
-
- # Adjust for sampling done by application
- $cycles *= $sampling_period;
-
- AddEntries($profile, $pcs, FixCallerAddresses($stack), $cycles);
-
- } elsif ( $line =~ m/^([a-z][^=]*)=(.*)$/ ) {
- my ($variable, $value) = ($1,$2);
- for ($variable, $value) {
- s/^\s+//;
- s/\s+$//;
- }
- if ($variable eq "cycles/second") {
- $cyclespernanosec = $value / 1e9;
- $seen_clockrate = 1;
- } elsif ($variable eq "sampling period") {
- $sampling_period = $value;
- } elsif ($variable eq "ms since reset") {
- # Currently nothing is done with this value in jeprof
- # So we just silently ignore it for now
- } elsif ($variable eq "discarded samples") {
- # Currently nothing is done with this value in jeprof
- # So we just silently ignore it for now
- } else {
- printf STDERR ("Ignoring unnknown variable in /contention output: " .
- "'%s' = '%s'\n",$variable,$value);
- }
- } else {
- # Memory map entry
- $map .= $line;
- }
- }
-
- if (!$seen_clockrate) {
- printf STDERR ("No cycles/second entry in profile; Guessing %.1f GHz\n",
- $cyclespernanosec);
- }
-
- my $r = {};
- $r->{version} = 0;
- $r->{period} = $sampling_period;
- $r->{profile} = $profile;
- $r->{libs} = ParseLibraries($prog, $map, $pcs);
- $r->{pcs} = $pcs;
- return $r;
-}
-
-# Given a hex value in the form "0x1abcd" or "1abcd", return either
-# "0001abcd" or "000000000001abcd", depending on the current (global)
-# address length.
-sub HexExtend {
- my $addr = shift;
-
- $addr =~ s/^(0x)?0*//;
- my $zeros_needed = $address_length - length($addr);
- if ($zeros_needed < 0) {
- printf STDERR "Warning: address $addr is longer than address length $address_length\n";
- return $addr;
- }
- return ("0" x $zeros_needed) . $addr;
-}
-
-##### Symbol extraction #####
-
-# Aggressively search the lib_prefix values for the given library
-# If all else fails, just return the name of the library unmodified.
-# If the lib_prefix is "/my/path,/other/path" and $file is "/lib/dir/mylib.so"
-# it will search the following locations in this order, until it finds a file:
-# /my/path/lib/dir/mylib.so
-# /other/path/lib/dir/mylib.so
-# /my/path/dir/mylib.so
-# /other/path/dir/mylib.so
-# /my/path/mylib.so
-# /other/path/mylib.so
-# /lib/dir/mylib.so (returned as last resort)
-sub FindLibrary {
- my $file = shift;
- my $suffix = $file;
-
- # Search for the library as described above
- do {
- foreach my $prefix (@prefix_list) {
- my $fullpath = $prefix . $suffix;
- if (-e $fullpath) {
- return $fullpath;
- }
- }
- } while ($suffix =~ s|^/[^/]+/|/|);
- return $file;
-}
-
-# Return path to library with debugging symbols.
-# For libc libraries, the copy in /usr/lib/debug contains debugging symbols
-sub DebuggingLibrary {
- my $file = shift;
- if ($file =~ m|^/|) {
- if (-f "/usr/lib/debug$file") {
- return "/usr/lib/debug$file";
- } elsif (-f "/usr/lib/debug$file.debug") {
- return "/usr/lib/debug$file.debug";
- }
- }
- return undef;
-}
-
-# Parse text section header of a library using objdump
-sub ParseTextSectionHeaderFromObjdump {
- my $lib = shift;
-
- my $size = undef;
- my $vma;
- my $file_offset;
- # Get objdump output from the library file to figure out how to
- # map between mapped addresses and addresses in the library.
- my $cmd = ShellEscape($obj_tool_map{"objdump"}, "-h", $lib);
- open(OBJDUMP, "$cmd |") || error("$cmd: $!\n");
- while (<OBJDUMP>) {
- s/\r//g; # turn windows-looking lines into unix-looking lines
- # Idx Name Size VMA LMA File off Algn
- # 10 .text 00104b2c 420156f0 420156f0 000156f0 2**4
- # For 64-bit objects, VMA and LMA will be 16 hex digits, size and file
- # offset may still be 8. But AddressSub below will still handle that.
- my @x = split;
- if (($#x >= 6) && ($x[1] eq '.text')) {
- $size = $x[2];
- $vma = $x[3];
- $file_offset = $x[5];
- last;
- }
- }
- close(OBJDUMP);
-
- if (!defined($size)) {
- return undef;
- }
-
- my $r = {};
- $r->{size} = $size;
- $r->{vma} = $vma;
- $r->{file_offset} = $file_offset;
-
- return $r;
-}
-
-# Parse text section header of a library using otool (on OS X)
-sub ParseTextSectionHeaderFromOtool {
- my $lib = shift;
-
- my $size = undef;
- my $vma = undef;
- my $file_offset = undef;
- # Get otool output from the library file to figure out how to
- # map between mapped addresses and addresses in the library.
- my $command = ShellEscape($obj_tool_map{"otool"}, "-l", $lib);
- open(OTOOL, "$command |") || error("$command: $!\n");
- my $cmd = "";
- my $sectname = "";
- my $segname = "";
- foreach my $line (<OTOOL>) {
- $line =~ s/\r//g; # turn windows-looking lines into unix-looking lines
- # Load command <#>
- # cmd LC_SEGMENT
- # [...]
- # Section
- # sectname __text
- # segname __TEXT
- # addr 0x000009f8
- # size 0x00018b9e
- # offset 2552
- # align 2^2 (4)
- # We will need to strip off the leading 0x from the hex addresses,
- # and convert the offset into hex.
- if ($line =~ /Load command/) {
- $cmd = "";
- $sectname = "";
- $segname = "";
- } elsif ($line =~ /Section/) {
- $sectname = "";
- $segname = "";
- } elsif ($line =~ /cmd (\w+)/) {
- $cmd = $1;
- } elsif ($line =~ /sectname (\w+)/) {
- $sectname = $1;
- } elsif ($line =~ /segname (\w+)/) {
- $segname = $1;
- } elsif (!(($cmd eq "LC_SEGMENT" || $cmd eq "LC_SEGMENT_64") &&
- $sectname eq "__text" &&
- $segname eq "__TEXT")) {
- next;
- } elsif ($line =~ /\baddr 0x([0-9a-fA-F]+)/) {
- $vma = $1;
- } elsif ($line =~ /\bsize 0x([0-9a-fA-F]+)/) {
- $size = $1;
- } elsif ($line =~ /\boffset ([0-9]+)/) {
- $file_offset = sprintf("%016x", $1);
- }
- if (defined($vma) && defined($size) && defined($file_offset)) {
- last;
- }
- }
- close(OTOOL);
-
- if (!defined($vma) || !defined($size) || !defined($file_offset)) {
- return undef;
- }
-
- my $r = {};
- $r->{size} = $size;
- $r->{vma} = $vma;
- $r->{file_offset} = $file_offset;
-
- return $r;
-}
-
-sub ParseTextSectionHeader {
- # obj_tool_map("otool") is only defined if we're in a Mach-O environment
- if (defined($obj_tool_map{"otool"})) {
- my $r = ParseTextSectionHeaderFromOtool(@_);
- if (defined($r)){
- return $r;
- }
- }
- # If otool doesn't work, or we don't have it, fall back to objdump
- return ParseTextSectionHeaderFromObjdump(@_);
-}
-
-# Split /proc/pid/maps dump into a list of libraries
-sub ParseLibraries {
- return if $main::use_symbol_page; # We don't need libraries info.
- my $prog = shift;
- my $map = shift;
- my $pcs = shift;
-
- my $result = [];
- my $h = "[a-f0-9]+";
- my $zero_offset = HexExtend("0");
-
- my $buildvar = "";
- foreach my $l (split("\n", $map)) {
- if ($l =~ m/^\s*build=(.*)$/) {
- $buildvar = $1;
- }
-
- my $start;
- my $finish;
- my $offset;
- my $lib;
- if ($l =~ /^($h)-($h)\s+..x.\s+($h)\s+\S+:\S+\s+\d+\s+(\S+\.(so|dll|dylib|bundle)((\.\d+)+\w*(\.\d+){0,3})?)$/i) {
- # Full line from /proc/self/maps. Example:
- # 40000000-40015000 r-xp 00000000 03:01 12845071 /lib/ld-2.3.2.so
- $start = HexExtend($1);
- $finish = HexExtend($2);
- $offset = HexExtend($3);
- $lib = $4;
- $lib =~ s|\\|/|g; # turn windows-style paths into unix-style paths
- } elsif ($l =~ /^\s*($h)-($h):\s*(\S+\.so(\.\d+)*)/) {
- # Cooked line from DumpAddressMap. Example:
- # 40000000-40015000: /lib/ld-2.3.2.so
- $start = HexExtend($1);
- $finish = HexExtend($2);
- $offset = $zero_offset;
- $lib = $3;
- }
- # FreeBSD 10.0 virtual memory map /proc/curproc/map as defined in
- # function procfs_doprocmap (sys/fs/procfs/procfs_map.c)
- #
- # Example:
- # 0x800600000 0x80061a000 26 0 0xfffff800035a0000 r-x 75 33 0x1004 COW NC vnode /libexec/ld-elf.s
- # o.1 NCH -1
- elsif ($l =~ /^(0x$h)\s(0x$h)\s\d+\s\d+\s0x$h\sr-x\s\d+\s\d+\s0x\d+\s(COW|NCO)\s(NC|NNC)\svnode\s(\S+\.so(\.\d+)*)/) {
- $start = HexExtend($1);
- $finish = HexExtend($2);
- $offset = $zero_offset;
- $lib = FindLibrary($5);
-
- } else {
- next;
- }
-
- # Expand "$build" variable if available
- $lib =~ s/\$build\b/$buildvar/g;
-
- $lib = FindLibrary($lib);
-
- # Check for pre-relocated libraries, which use pre-relocated symbol tables
- # and thus require adjusting the offset that we'll use to translate
- # VM addresses into symbol table addresses.
- # Only do this if we're not going to fetch the symbol table from a
- # debugging copy of the library.
- if (!DebuggingLibrary($lib)) {
- my $text = ParseTextSectionHeader($lib);
- if (defined($text)) {
- my $vma_offset = AddressSub($text->{vma}, $text->{file_offset});
- $offset = AddressAdd($offset, $vma_offset);
- }
- }
-
- if($main::opt_debug) { printf STDERR "$start:$finish ($offset) $lib\n"; }
- push(@{$result}, [$lib, $start, $finish, $offset]);
- }
-
- # Append special entry for additional library (not relocated)
- if ($main::opt_lib ne "") {
- my $text = ParseTextSectionHeader($main::opt_lib);
- if (defined($text)) {
- my $start = $text->{vma};
- my $finish = AddressAdd($start, $text->{size});
-
- push(@{$result}, [$main::opt_lib, $start, $finish, $start]);
- }
- }
-
- # Append special entry for the main program. This covers
- # 0..max_pc_value_seen, so that we assume pc values not found in one
- # of the library ranges will be treated as coming from the main
- # program binary.
- my $min_pc = HexExtend("0");
- my $max_pc = $min_pc; # find the maximal PC value in any sample
- foreach my $pc (keys(%{$pcs})) {
- if (HexExtend($pc) gt $max_pc) { $max_pc = HexExtend($pc); }
- }
- push(@{$result}, [$prog, $min_pc, $max_pc, $zero_offset]);
-
- return $result;
-}
-
-# Add two hex addresses of length $address_length.
-# Run jeprof --test for unit test if this is changed.
-sub AddressAdd {
- my $addr1 = shift;
- my $addr2 = shift;
- my $sum;
-
- if ($address_length == 8) {
- # Perl doesn't cope with wraparound arithmetic, so do it explicitly:
- $sum = (hex($addr1)+hex($addr2)) % (0x10000000 * 16);
- return sprintf("%08x", $sum);
-
- } else {
- # Do the addition in 7-nibble chunks to trivialize carry handling.
-
- if ($main::opt_debug and $main::opt_test) {
- print STDERR "AddressAdd $addr1 + $addr2 = ";
- }
-
- my $a1 = substr($addr1,-7);
- $addr1 = substr($addr1,0,-7);
- my $a2 = substr($addr2,-7);
- $addr2 = substr($addr2,0,-7);
- $sum = hex($a1) + hex($a2);
- my $c = 0;
- if ($sum > 0xfffffff) {
- $c = 1;
- $sum -= 0x10000000;
- }
- my $r = sprintf("%07x", $sum);
-
- $a1 = substr($addr1,-7);
- $addr1 = substr($addr1,0,-7);
- $a2 = substr($addr2,-7);
- $addr2 = substr($addr2,0,-7);
- $sum = hex($a1) + hex($a2) + $c;
- $c = 0;
- if ($sum > 0xfffffff) {
- $c = 1;
- $sum -= 0x10000000;
- }
- $r = sprintf("%07x", $sum) . $r;
-
- $sum = hex($addr1) + hex($addr2) + $c;
- if ($sum > 0xff) { $sum -= 0x100; }
- $r = sprintf("%02x", $sum) . $r;
-
- if ($main::opt_debug and $main::opt_test) { print STDERR "$r\n"; }
-
- return $r;
- }
-}
-
-
-# Subtract two hex addresses of length $address_length.
-# Run jeprof --test for unit test if this is changed.
-sub AddressSub {
- my $addr1 = shift;
- my $addr2 = shift;
- my $diff;
-
- if ($address_length == 8) {
- # Perl doesn't cope with wraparound arithmetic, so do it explicitly:
- $diff = (hex($addr1)-hex($addr2)) % (0x10000000 * 16);
- return sprintf("%08x", $diff);
-
- } else {
- # Do the addition in 7-nibble chunks to trivialize borrow handling.
- # if ($main::opt_debug) { print STDERR "AddressSub $addr1 - $addr2 = "; }
-
- my $a1 = hex(substr($addr1,-7));
- $addr1 = substr($addr1,0,-7);
- my $a2 = hex(substr($addr2,-7));
- $addr2 = substr($addr2,0,-7);
- my $b = 0;
- if ($a2 > $a1) {
- $b = 1;
- $a1 += 0x10000000;
- }
- $diff = $a1 - $a2;
- my $r = sprintf("%07x", $diff);
-
- $a1 = hex(substr($addr1,-7));
- $addr1 = substr($addr1,0,-7);
- $a2 = hex(substr($addr2,-7)) + $b;
- $addr2 = substr($addr2,0,-7);
- $b = 0;
- if ($a2 > $a1) {
- $b = 1;
- $a1 += 0x10000000;
- }
- $diff = $a1 - $a2;
- $r = sprintf("%07x", $diff) . $r;
-
- $a1 = hex($addr1);
- $a2 = hex($addr2) + $b;
- if ($a2 > $a1) { $a1 += 0x100; }
- $diff = $a1 - $a2;
- $r = sprintf("%02x", $diff) . $r;
-
- # if ($main::opt_debug) { print STDERR "$r\n"; }
-
- return $r;
- }
-}
-
-# Increment a hex addresses of length $address_length.
-# Run jeprof --test for unit test if this is changed.
-sub AddressInc {
- my $addr = shift;
- my $sum;
-
- if ($address_length == 8) {
- # Perl doesn't cope with wraparound arithmetic, so do it explicitly:
- $sum = (hex($addr)+1) % (0x10000000 * 16);
- return sprintf("%08x", $sum);
-
- } else {
- # Do the addition in 7-nibble chunks to trivialize carry handling.
- # We are always doing this to step through the addresses in a function,
- # and will almost never overflow the first chunk, so we check for this
- # case and exit early.
-
- # if ($main::opt_debug) { print STDERR "AddressInc $addr1 = "; }
-
- my $a1 = substr($addr,-7);
- $addr = substr($addr,0,-7);
- $sum = hex($a1) + 1;
- my $r = sprintf("%07x", $sum);
- if ($sum <= 0xfffffff) {
- $r = $addr . $r;
- # if ($main::opt_debug) { print STDERR "$r\n"; }
- return HexExtend($r);
- } else {
- $r = "0000000";
- }
-
- $a1 = substr($addr,-7);
- $addr = substr($addr,0,-7);
- $sum = hex($a1) + 1;
- $r = sprintf("%07x", $sum) . $r;
- if ($sum <= 0xfffffff) {
- $r = $addr . $r;
- # if ($main::opt_debug) { print STDERR "$r\n"; }
- return HexExtend($r);
- } else {
- $r = "00000000000000";
- }
-
- $sum = hex($addr) + 1;
- if ($sum > 0xff) { $sum -= 0x100; }
- $r = sprintf("%02x", $sum) . $r;
-
- # if ($main::opt_debug) { print STDERR "$r\n"; }
- return $r;
- }
-}
-
-# Extract symbols for all PC values found in profile
-sub ExtractSymbols {
- my $libs = shift;
- my $pcset = shift;
-
- my $symbols = {};
-
- # Map each PC value to the containing library. To make this faster,
- # we sort libraries by their starting pc value (highest first), and
- # advance through the libraries as we advance the pc. Sometimes the
- # addresses of libraries may overlap with the addresses of the main
- # binary, so to make sure the libraries 'win', we iterate over the
- # libraries in reverse order (which assumes the binary doesn't start
- # in the middle of a library, which seems a fair assumption).
- my @pcs = (sort { $a cmp $b } keys(%{$pcset})); # pcset is 0-extended strings
- foreach my $lib (sort {$b->[1] cmp $a->[1]} @{$libs}) {
- my $libname = $lib->[0];
- my $start = $lib->[1];
- my $finish = $lib->[2];
- my $offset = $lib->[3];
-
- # Use debug library if it exists
- my $debug_libname = DebuggingLibrary($libname);
- if ($debug_libname) {
- $libname = $debug_libname;
- }
-
- # Get list of pcs that belong in this library.
- my $contained = [];
- my ($start_pc_index, $finish_pc_index);
- # Find smallest finish_pc_index such that $finish < $pc[$finish_pc_index].
- for ($finish_pc_index = $#pcs + 1; $finish_pc_index > 0;
- $finish_pc_index--) {
- last if $pcs[$finish_pc_index - 1] le $finish;
- }
- # Find smallest start_pc_index such that $start <= $pc[$start_pc_index].
- for ($start_pc_index = $finish_pc_index; $start_pc_index > 0;
- $start_pc_index--) {
- last if $pcs[$start_pc_index - 1] lt $start;
- }
- # This keeps PC values higher than $pc[$finish_pc_index] in @pcs,
- # in case there are overlaps in libraries and the main binary.
- @{$contained} = splice(@pcs, $start_pc_index,
- $finish_pc_index - $start_pc_index);
- # Map to symbols
- MapToSymbols($libname, AddressSub($start, $offset), $contained, $symbols);
- }
-
- return $symbols;
-}
-
-# Map list of PC values to symbols for a given image
-sub MapToSymbols {
- my $image = shift;
- my $offset = shift;
- my $pclist = shift;
- my $symbols = shift;
-
- my $debug = 0;
-
- # Ignore empty binaries
- if ($#{$pclist} < 0) { return; }
-
- # Figure out the addr2line command to use
- my $addr2line = $obj_tool_map{"addr2line"};
- my $cmd = ShellEscape($addr2line, "-f", "-C", "-e", $image);
- if (exists $obj_tool_map{"addr2line_pdb"}) {
- $addr2line = $obj_tool_map{"addr2line_pdb"};
- $cmd = ShellEscape($addr2line, "--demangle", "-f", "-C", "-e", $image);
- }
-
- # If "addr2line" isn't installed on the system at all, just use
- # nm to get what info we can (function names, but not line numbers).
- if (system(ShellEscape($addr2line, "--help") . " >$dev_null 2>&1") != 0) {
- MapSymbolsWithNM($image, $offset, $pclist, $symbols);
- return;
- }
-
- # "addr2line -i" can produce a variable number of lines per input
- # address, with no separator that allows us to tell when data for
- # the next address starts. So we find the address for a special
- # symbol (_fini) and interleave this address between all real
- # addresses passed to addr2line. The name of this special symbol
- # can then be used as a separator.
- $sep_address = undef; # May be filled in by MapSymbolsWithNM()
- my $nm_symbols = {};
- MapSymbolsWithNM($image, $offset, $pclist, $nm_symbols);
- if (defined($sep_address)) {
- # Only add " -i" to addr2line if the binary supports it.
- # addr2line --help returns 0, but not if it sees an unknown flag first.
- if (system("$cmd -i --help >$dev_null 2>&1") == 0) {
- $cmd .= " -i";
- } else {
- $sep_address = undef; # no need for sep_address if we don't support -i
- }
- }
-
- # Make file with all PC values with intervening 'sep_address' so
- # that we can reliably detect the end of inlined function list
- open(ADDRESSES, ">$main::tmpfile_sym") || error("$main::tmpfile_sym: $!\n");
- if ($debug) { print("---- $image ---\n"); }
- for (my $i = 0; $i <= $#{$pclist}; $i++) {
- # addr2line always reads hex addresses, and does not need '0x' prefix.
- if ($debug) { printf STDERR ("%s\n", $pclist->[$i]); }
- printf ADDRESSES ("%s\n", AddressSub($pclist->[$i], $offset));
- if (defined($sep_address)) {
- printf ADDRESSES ("%s\n", $sep_address);
- }
- }
- close(ADDRESSES);
- if ($debug) {
- print("----\n");
- system("cat", $main::tmpfile_sym);
- print("----\n");
- system("$cmd < " . ShellEscape($main::tmpfile_sym));
- print("----\n");
- }
-
- open(SYMBOLS, "$cmd <" . ShellEscape($main::tmpfile_sym) . " |")
- || error("$cmd: $!\n");
- my $count = 0; # Index in pclist
- while (<SYMBOLS>) {
- # Read fullfunction and filelineinfo from next pair of lines
- s/\r?\n$//g;
- my $fullfunction = $_;
- $_ = <SYMBOLS>;
- s/\r?\n$//g;
- my $filelinenum = $_;
-
- if (defined($sep_address) && $fullfunction eq $sep_symbol) {
- # Terminating marker for data for this address
- $count++;
- next;
- }
-
- $filelinenum =~ s|\\|/|g; # turn windows-style paths into unix-style paths
-
- my $pcstr = $pclist->[$count];
- my $function = ShortFunctionName($fullfunction);
- my $nms = $nm_symbols->{$pcstr};
- if (defined($nms)) {
- if ($fullfunction eq '??') {
- # nm found a symbol for us.
- $function = $nms->[0];
- $fullfunction = $nms->[2];
- } else {
- # MapSymbolsWithNM tags each routine with its starting address,
- # useful in case the image has multiple occurrences of this
- # routine. (It uses a syntax that resembles template paramters,
- # that are automatically stripped out by ShortFunctionName().)
- # addr2line does not provide the same information. So we check
- # if nm disambiguated our symbol, and if so take the annotated
- # (nm) version of the routine-name. TODO(csilvers): this won't
- # catch overloaded, inlined symbols, which nm doesn't see.
- # Better would be to do a check similar to nm's, in this fn.
- if ($nms->[2] =~ m/^\Q$function\E/) { # sanity check it's the right fn
- $function = $nms->[0];
- $fullfunction = $nms->[2];
- }
- }
- }
-
- # Prepend to accumulated symbols for pcstr
- # (so that caller comes before callee)
- my $sym = $symbols->{$pcstr};
- if (!defined($sym)) {
- $sym = [];
- $symbols->{$pcstr} = $sym;
- }
- unshift(@{$sym}, $function, $filelinenum, $fullfunction);
- if ($debug) { printf STDERR ("%s => [%s]\n", $pcstr, join(" ", @{$sym})); }
- if (!defined($sep_address)) {
- # Inlining is off, so this entry ends immediately
- $count++;
- }
- }
- close(SYMBOLS);
-}
-
-# Use nm to map the list of referenced PCs to symbols. Return true iff we
-# are able to read procedure information via nm.
-sub MapSymbolsWithNM {
- my $image = shift;
- my $offset = shift;
- my $pclist = shift;
- my $symbols = shift;
-
- # Get nm output sorted by increasing address
- my $symbol_table = GetProcedureBoundaries($image, ".");
- if (!%{$symbol_table}) {
- return 0;
- }
- # Start addresses are already the right length (8 or 16 hex digits).
- my @names = sort { $symbol_table->{$a}->[0] cmp $symbol_table->{$b}->[0] }
- keys(%{$symbol_table});
-
- if ($#names < 0) {
- # No symbols: just use addresses
- foreach my $pc (@{$pclist}) {
- my $pcstr = "0x" . $pc;
- $symbols->{$pc} = [$pcstr, "?", $pcstr];
- }
- return 0;
- }
-
- # Sort addresses so we can do a join against nm output
- my $index = 0;
- my $fullname = $names[0];
- my $name = ShortFunctionName($fullname);
- foreach my $pc (sort { $a cmp $b } @{$pclist}) {
- # Adjust for mapped offset
- my $mpc = AddressSub($pc, $offset);
- while (($index < $#names) && ($mpc ge $symbol_table->{$fullname}->[1])){
- $index++;
- $fullname = $names[$index];
- $name = ShortFunctionName($fullname);
- }
- if ($mpc lt $symbol_table->{$fullname}->[1]) {
- $symbols->{$pc} = [$name, "?", $fullname];
- } else {
- my $pcstr = "0x" . $pc;
- $symbols->{$pc} = [$pcstr, "?", $pcstr];
- }
- }
- return 1;
-}
-
-sub ShortFunctionName {
- my $function = shift;
- while ($function =~ s/\([^()]*\)(\s*const)?//g) { } # Argument types
- while ($function =~ s/<[^<>]*>//g) { } # Remove template arguments
- $function =~ s/^.*\s+(\w+::)/$1/; # Remove leading type
- return $function;
-}
-
-# Trim overly long symbols found in disassembler output
-sub CleanDisassembly {
- my $d = shift;
- while ($d =~ s/\([^()%]*\)(\s*const)?//g) { } # Argument types, not (%rax)
- while ($d =~ s/(\w+)<[^<>]*>/$1/g) { } # Remove template arguments
- return $d;
-}
-
-# Clean file name for display
-sub CleanFileName {
- my ($f) = @_;
- $f =~ s|^/proc/self/cwd/||;
- $f =~ s|^\./||;
- return $f;
-}
-
-# Make address relative to section and clean up for display
-sub UnparseAddress {
- my ($offset, $address) = @_;
- $address = AddressSub($address, $offset);
- $address =~ s/^0x//;
- $address =~ s/^0*//;
- return $address;
-}
-
-##### Miscellaneous #####
-
-# Find the right versions of the above object tools to use. The
-# argument is the program file being analyzed, and should be an ELF
-# 32-bit or ELF 64-bit executable file. The location of the tools
-# is determined by considering the following options in this order:
-# 1) --tools option, if set
-# 2) JEPROF_TOOLS environment variable, if set
-# 3) the environment
-sub ConfigureObjTools {
- my $prog_file = shift;
-
- # Check for the existence of $prog_file because /usr/bin/file does not
- # predictably return error status in prod.
- (-e $prog_file) || error("$prog_file does not exist.\n");
-
- my $file_type = undef;
- if (-e "/usr/bin/file") {
- # Follow symlinks (at least for systems where "file" supports that).
- my $escaped_prog_file = ShellEscape($prog_file);
- $file_type = `/usr/bin/file -L $escaped_prog_file 2>$dev_null ||
- /usr/bin/file $escaped_prog_file`;
- } elsif ($^O == "MSWin32") {
- $file_type = "MS Windows";
- } else {
- print STDERR "WARNING: Can't determine the file type of $prog_file";
- }
-
- if ($file_type =~ /64-bit/) {
- # Change $address_length to 16 if the program file is ELF 64-bit.
- # We can't detect this from many (most?) heap or lock contention
- # profiles, since the actual addresses referenced are generally in low
- # memory even for 64-bit programs.
- $address_length = 16;
- }
-
- if ($file_type =~ /MS Windows/) {
- # For windows, we provide a version of nm and addr2line as part of
- # the opensource release, which is capable of parsing
- # Windows-style PDB executables. It should live in the path, or
- # in the same directory as jeprof.
- $obj_tool_map{"nm_pdb"} = "nm-pdb";
- $obj_tool_map{"addr2line_pdb"} = "addr2line-pdb";
- }
-
- if ($file_type =~ /Mach-O/) {
- # OS X uses otool to examine Mach-O files, rather than objdump.
- $obj_tool_map{"otool"} = "otool";
- $obj_tool_map{"addr2line"} = "false"; # no addr2line
- $obj_tool_map{"objdump"} = "false"; # no objdump
- }
-
- # Go fill in %obj_tool_map with the pathnames to use:
- foreach my $tool (keys %obj_tool_map) {
- $obj_tool_map{$tool} = ConfigureTool($obj_tool_map{$tool});
- }
-}
-
-# Returns the path of a caller-specified object tool. If --tools or
-# JEPROF_TOOLS are specified, then returns the full path to the tool
-# with that prefix. Otherwise, returns the path unmodified (which
-# means we will look for it on PATH).
-sub ConfigureTool {
- my $tool = shift;
- my $path;
-
- # --tools (or $JEPROF_TOOLS) is a comma separated list, where each
- # item is either a) a pathname prefix, or b) a map of the form
- # <tool>:<path>. First we look for an entry of type (b) for our
- # tool. If one is found, we use it. Otherwise, we consider all the
- # pathname prefixes in turn, until one yields an existing file. If
- # none does, we use a default path.
- my $tools = $main::opt_tools || $ENV{"JEPROF_TOOLS"} || "";
- if ($tools =~ m/(,|^)\Q$tool\E:([^,]*)/) {
- $path = $2;
- # TODO(csilvers): sanity-check that $path exists? Hard if it's relative.
- } elsif ($tools ne '') {
- foreach my $prefix (split(',', $tools)) {
- next if ($prefix =~ /:/); # ignore "tool:fullpath" entries in the list
- if (-x $prefix . $tool) {
- $path = $prefix . $tool;
- last;
- }
- }
- if (!$path) {
- error("No '$tool' found with prefix specified by " .
- "--tools (or \$JEPROF_TOOLS) '$tools'\n");
- }
- } else {
- # ... otherwise use the version that exists in the same directory as
- # jeprof. If there's nothing there, use $PATH.
- $0 =~ m,[^/]*$,; # this is everything after the last slash
- my $dirname = $`; # this is everything up to and including the last slash
- if (-x "$dirname$tool") {
- $path = "$dirname$tool";
- } else {
- $path = $tool;
- }
- }
- if ($main::opt_debug) { print STDERR "Using '$path' for '$tool'.\n"; }
- return $path;
-}
-
-sub ShellEscape {
- my @escaped_words = ();
- foreach my $word (@_) {
- my $escaped_word = $word;
- if ($word =~ m![^a-zA-Z0-9/.,_=-]!) { # check for anything not in whitelist
- $escaped_word =~ s/'/'\\''/;
- $escaped_word = "'$escaped_word'";
- }
- push(@escaped_words, $escaped_word);
- }
- return join(" ", @escaped_words);
-}
-
-sub cleanup {
- unlink($main::tmpfile_sym);
- unlink(keys %main::tempnames);
-
- # We leave any collected profiles in $HOME/jeprof in case the user wants
- # to look at them later. We print a message informing them of this.
- if ((scalar(@main::profile_files) > 0) &&
- defined($main::collected_profile)) {
- if (scalar(@main::profile_files) == 1) {
- print STDERR "Dynamically gathered profile is in $main::collected_profile\n";
- }
- print STDERR "If you want to investigate this profile further, you can do:\n";
- print STDERR "\n";
- print STDERR " jeprof \\\n";
- print STDERR " $main::prog \\\n";
- print STDERR " $main::collected_profile\n";
- print STDERR "\n";
- }
-}
-
-sub sighandler {
- cleanup();
- exit(1);
-}
-
-sub error {
- my $msg = shift;
- print STDERR $msg;
- cleanup();
- exit(1);
-}
-
-
-# Run $nm_command and get all the resulting procedure boundaries whose
-# names match "$regexp" and returns them in a hashtable mapping from
-# procedure name to a two-element vector of [start address, end address]
-sub GetProcedureBoundariesViaNm {
- my $escaped_nm_command = shift; # shell-escaped
- my $regexp = shift;
-
- my $symbol_table = {};
- open(NM, "$escaped_nm_command |") || error("$escaped_nm_command: $!\n");
- my $last_start = "0";
- my $routine = "";
- while (<NM>) {
- s/\r//g; # turn windows-looking lines into unix-looking lines
- if (m/^\s*([0-9a-f]+) (.) (..*)/) {
- my $start_val = $1;
- my $type = $2;
- my $this_routine = $3;
-
- # It's possible for two symbols to share the same address, if
- # one is a zero-length variable (like __start_google_malloc) or
- # one symbol is a weak alias to another (like __libc_malloc).
- # In such cases, we want to ignore all values except for the
- # actual symbol, which in nm-speak has type "T". The logic
- # below does this, though it's a bit tricky: what happens when
- # we have a series of lines with the same address, is the first
- # one gets queued up to be processed. However, it won't
- # *actually* be processed until later, when we read a line with
- # a different address. That means that as long as we're reading
- # lines with the same address, we have a chance to replace that
- # item in the queue, which we do whenever we see a 'T' entry --
- # that is, a line with type 'T'. If we never see a 'T' entry,
- # we'll just go ahead and process the first entry (which never
- # got touched in the queue), and ignore the others.
- if ($start_val eq $last_start && $type =~ /t/i) {
- # We are the 'T' symbol at this address, replace previous symbol.
- $routine = $this_routine;
- next;
- } elsif ($start_val eq $last_start) {
- # We're not the 'T' symbol at this address, so ignore us.
- next;
- }
-
- if ($this_routine eq $sep_symbol) {
- $sep_address = HexExtend($start_val);
- }
-
- # Tag this routine with the starting address in case the image
- # has multiple occurrences of this routine. We use a syntax
- # that resembles template parameters that are automatically
- # stripped out by ShortFunctionName()
- $this_routine .= "<$start_val>";
-
- if (defined($routine) && $routine =~ m/$regexp/) {
- $symbol_table->{$routine} = [HexExtend($last_start),
- HexExtend($start_val)];
- }
- $last_start = $start_val;
- $routine = $this_routine;
- } elsif (m/^Loaded image name: (.+)/) {
- # The win32 nm workalike emits information about the binary it is using.
- if ($main::opt_debug) { print STDERR "Using Image $1\n"; }
- } elsif (m/^PDB file name: (.+)/) {
- # The win32 nm workalike emits information about the pdb it is using.
- if ($main::opt_debug) { print STDERR "Using PDB $1\n"; }
- }
- }
- close(NM);
- # Handle the last line in the nm output. Unfortunately, we don't know
- # how big this last symbol is, because we don't know how big the file
- # is. For now, we just give it a size of 0.
- # TODO(csilvers): do better here.
- if (defined($routine) && $routine =~ m/$regexp/) {
- $symbol_table->{$routine} = [HexExtend($last_start),
- HexExtend($last_start)];
- }
- return $symbol_table;
-}
-
-# Gets the procedure boundaries for all routines in "$image" whose names
-# match "$regexp" and returns them in a hashtable mapping from procedure
-# name to a two-element vector of [start address, end address].
-# Will return an empty map if nm is not installed or not working properly.
-sub GetProcedureBoundaries {
- my $image = shift;
- my $regexp = shift;
-
- # If $image doesn't start with /, then put ./ in front of it. This works
- # around an obnoxious bug in our probing of nm -f behavior.
- # "nm -f $image" is supposed to fail on GNU nm, but if:
- #
- # a. $image starts with [BbSsPp] (for example, bin/foo/bar), AND
- # b. you have a.out in your current directory (a not uncommon occurence)
- #
- # then "nm -f $image" succeeds because -f only looks at the first letter of
- # the argument, which looks valid because it's [BbSsPp], and then since
- # there's no image provided, it looks for a.out and finds it.
- #
- # This regex makes sure that $image starts with . or /, forcing the -f
- # parsing to fail since . and / are not valid formats.
- $image =~ s#^[^/]#./$&#;
-
- # For libc libraries, the copy in /usr/lib/debug contains debugging symbols
- my $debugging = DebuggingLibrary($image);
- if ($debugging) {
- $image = $debugging;
- }
-
- my $nm = $obj_tool_map{"nm"};
- my $cppfilt = $obj_tool_map{"c++filt"};
-
- # nm can fail for two reasons: 1) $image isn't a debug library; 2) nm
- # binary doesn't support --demangle. In addition, for OS X we need
- # to use the -f flag to get 'flat' nm output (otherwise we don't sort
- # properly and get incorrect results). Unfortunately, GNU nm uses -f
- # in an incompatible way. So first we test whether our nm supports
- # --demangle and -f.
- my $demangle_flag = "";
- my $cppfilt_flag = "";
- my $to_devnull = ">$dev_null 2>&1";
- if (system(ShellEscape($nm, "--demangle", "image") . $to_devnull) == 0) {
- # In this mode, we do "nm --demangle <foo>"
- $demangle_flag = "--demangle";
- $cppfilt_flag = "";
- } elsif (system(ShellEscape($cppfilt, $image) . $to_devnull) == 0) {
- # In this mode, we do "nm <foo> | c++filt"
- $cppfilt_flag = " | " . ShellEscape($cppfilt);
- };
- my $flatten_flag = "";
- if (system(ShellEscape($nm, "-f", $image) . $to_devnull) == 0) {
- $flatten_flag = "-f";
- }
-
- # Finally, in the case $imagie isn't a debug library, we try again with
- # -D to at least get *exported* symbols. If we can't use --demangle,
- # we use c++filt instead, if it exists on this system.
- my @nm_commands = (ShellEscape($nm, "-n", $flatten_flag, $demangle_flag,
- $image) . " 2>$dev_null $cppfilt_flag",
- ShellEscape($nm, "-D", "-n", $flatten_flag, $demangle_flag,
- $image) . " 2>$dev_null $cppfilt_flag",
- # 6nm is for Go binaries
- ShellEscape("6nm", "$image") . " 2>$dev_null | sort",
- );
-
- # If the executable is an MS Windows PDB-format executable, we'll
- # have set up obj_tool_map("nm_pdb"). In this case, we actually
- # want to use both unix nm and windows-specific nm_pdb, since
- # PDB-format executables can apparently include dwarf .o files.
- if (exists $obj_tool_map{"nm_pdb"}) {
- push(@nm_commands,
- ShellEscape($obj_tool_map{"nm_pdb"}, "--demangle", $image)
- . " 2>$dev_null");
- }
-
- foreach my $nm_command (@nm_commands) {
- my $symbol_table = GetProcedureBoundariesViaNm($nm_command, $regexp);
- return $symbol_table if (%{$symbol_table});
- }
- my $symbol_table = {};
- return $symbol_table;
-}
-
-
-# The test vectors for AddressAdd/Sub/Inc are 8-16-nibble hex strings.
-# To make them more readable, we add underscores at interesting places.
-# This routine removes the underscores, producing the canonical representation
-# used by jeprof to represent addresses, particularly in the tested routines.
-sub CanonicalHex {
- my $arg = shift;
- return join '', (split '_',$arg);
-}
-
-
-# Unit test for AddressAdd:
-sub AddressAddUnitTest {
- my $test_data_8 = shift;
- my $test_data_16 = shift;
- my $error_count = 0;
- my $fail_count = 0;
- my $pass_count = 0;
- # print STDERR "AddressAddUnitTest: ", 1+$#{$test_data_8}, " tests\n";
-
- # First a few 8-nibble addresses. Note that this implementation uses
- # plain old arithmetic, so a quick sanity check along with verifying what
- # happens to overflow (we want it to wrap):
- $address_length = 8;
- foreach my $row (@{$test_data_8}) {
- if ($main::opt_debug and $main::opt_test) { print STDERR "@{$row}\n"; }
- my $sum = AddressAdd ($row->[0], $row->[1]);
- if ($sum ne $row->[2]) {
- printf STDERR "ERROR: %s != %s + %s = %s\n", $sum,
- $row->[0], $row->[1], $row->[2];
- ++$fail_count;
- } else {
- ++$pass_count;
- }
- }
- printf STDERR "AddressAdd 32-bit tests: %d passes, %d failures\n",
- $pass_count, $fail_count;
- $error_count = $fail_count;
- $fail_count = 0;
- $pass_count = 0;
-
- # Now 16-nibble addresses.
- $address_length = 16;
- foreach my $row (@{$test_data_16}) {
- if ($main::opt_debug and $main::opt_test) { print STDERR "@{$row}\n"; }
- my $sum = AddressAdd (CanonicalHex($row->[0]), CanonicalHex($row->[1]));
- my $expected = join '', (split '_',$row->[2]);
- if ($sum ne CanonicalHex($row->[2])) {
- printf STDERR "ERROR: %s != %s + %s = %s\n", $sum,
- $row->[0], $row->[1], $row->[2];
- ++$fail_count;
- } else {
- ++$pass_count;
- }
- }
- printf STDERR "AddressAdd 64-bit tests: %d passes, %d failures\n",
- $pass_count, $fail_count;
- $error_count += $fail_count;
-
- return $error_count;
-}
-
-
-# Unit test for AddressSub:
-sub AddressSubUnitTest {
- my $test_data_8 = shift;
- my $test_data_16 = shift;
- my $error_count = 0;
- my $fail_count = 0;
- my $pass_count = 0;
- # print STDERR "AddressSubUnitTest: ", 1+$#{$test_data_8}, " tests\n";
-
- # First a few 8-nibble addresses. Note that this implementation uses
- # plain old arithmetic, so a quick sanity check along with verifying what
- # happens to overflow (we want it to wrap):
- $address_length = 8;
- foreach my $row (@{$test_data_8}) {
- if ($main::opt_debug and $main::opt_test) { print STDERR "@{$row}\n"; }
- my $sum = AddressSub ($row->[0], $row->[1]);
- if ($sum ne $row->[3]) {
- printf STDERR "ERROR: %s != %s - %s = %s\n", $sum,
- $row->[0], $row->[1], $row->[3];
- ++$fail_count;
- } else {
- ++$pass_count;
- }
- }
- printf STDERR "AddressSub 32-bit tests: %d passes, %d failures\n",
- $pass_count, $fail_count;
- $error_count = $fail_count;
- $fail_count = 0;
- $pass_count = 0;
-
- # Now 16-nibble addresses.
- $address_length = 16;
- foreach my $row (@{$test_data_16}) {
- if ($main::opt_debug and $main::opt_test) { print STDERR "@{$row}\n"; }
- my $sum = AddressSub (CanonicalHex($row->[0]), CanonicalHex($row->[1]));
- if ($sum ne CanonicalHex($row->[3])) {
- printf STDERR "ERROR: %s != %s - %s = %s\n", $sum,
- $row->[0], $row->[1], $row->[3];
- ++$fail_count;
- } else {
- ++$pass_count;
- }
- }
- printf STDERR "AddressSub 64-bit tests: %d passes, %d failures\n",
- $pass_count, $fail_count;
- $error_count += $fail_count;
-
- return $error_count;
-}
-
-
-# Unit test for AddressInc:
-sub AddressIncUnitTest {
- my $test_data_8 = shift;
- my $test_data_16 = shift;
- my $error_count = 0;
- my $fail_count = 0;
- my $pass_count = 0;
- # print STDERR "AddressIncUnitTest: ", 1+$#{$test_data_8}, " tests\n";
-
- # First a few 8-nibble addresses. Note that this implementation uses
- # plain old arithmetic, so a quick sanity check along with verifying what
- # happens to overflow (we want it to wrap):
- $address_length = 8;
- foreach my $row (@{$test_data_8}) {
- if ($main::opt_debug and $main::opt_test) { print STDERR "@{$row}\n"; }
- my $sum = AddressInc ($row->[0]);
- if ($sum ne $row->[4]) {
- printf STDERR "ERROR: %s != %s + 1 = %s\n", $sum,
- $row->[0], $row->[4];
- ++$fail_count;
- } else {
- ++$pass_count;
- }
- }
- printf STDERR "AddressInc 32-bit tests: %d passes, %d failures\n",
- $pass_count, $fail_count;
- $error_count = $fail_count;
- $fail_count = 0;
- $pass_count = 0;
-
- # Now 16-nibble addresses.
- $address_length = 16;
- foreach my $row (@{$test_data_16}) {
- if ($main::opt_debug and $main::opt_test) { print STDERR "@{$row}\n"; }
- my $sum = AddressInc (CanonicalHex($row->[0]));
- if ($sum ne CanonicalHex($row->[4])) {
- printf STDERR "ERROR: %s != %s + 1 = %s\n", $sum,
- $row->[0], $row->[4];
- ++$fail_count;
- } else {
- ++$pass_count;
- }
- }
- printf STDERR "AddressInc 64-bit tests: %d passes, %d failures\n",
- $pass_count, $fail_count;
- $error_count += $fail_count;
-
- return $error_count;
-}
-
-
-# Driver for unit tests.
-# Currently just the address add/subtract/increment routines for 64-bit.
-sub RunUnitTests {
- my $error_count = 0;
-
- # This is a list of tuples [a, b, a+b, a-b, a+1]
- my $unit_test_data_8 = [
- [qw(aaaaaaaa 50505050 fafafafa 5a5a5a5a aaaaaaab)],
- [qw(50505050 aaaaaaaa fafafafa a5a5a5a6 50505051)],
- [qw(ffffffff aaaaaaaa aaaaaaa9 55555555 00000000)],
- [qw(00000001 ffffffff 00000000 00000002 00000002)],
- [qw(00000001 fffffff0 fffffff1 00000011 00000002)],
- ];
- my $unit_test_data_16 = [
- # The implementation handles data in 7-nibble chunks, so those are the
- # interesting boundaries.
- [qw(aaaaaaaa 50505050
- 00_000000f_afafafa 00_0000005_a5a5a5a 00_000000a_aaaaaab)],
- [qw(50505050 aaaaaaaa
- 00_000000f_afafafa ff_ffffffa_5a5a5a6 00_0000005_0505051)],
- [qw(ffffffff aaaaaaaa
- 00_000001a_aaaaaa9 00_0000005_5555555 00_0000010_0000000)],
- [qw(00000001 ffffffff
- 00_0000010_0000000 ff_ffffff0_0000002 00_0000000_0000002)],
- [qw(00000001 fffffff0
- 00_000000f_ffffff1 ff_ffffff0_0000011 00_0000000_0000002)],
-
- [qw(00_a00000a_aaaaaaa 50505050
- 00_a00000f_afafafa 00_a000005_a5a5a5a 00_a00000a_aaaaaab)],
- [qw(0f_fff0005_0505050 aaaaaaaa
- 0f_fff000f_afafafa 0f_ffefffa_5a5a5a6 0f_fff0005_0505051)],
- [qw(00_000000f_fffffff 01_800000a_aaaaaaa
- 01_800001a_aaaaaa9 fe_8000005_5555555 00_0000010_0000000)],
- [qw(00_0000000_0000001 ff_fffffff_fffffff
- 00_0000000_0000000 00_0000000_0000002 00_0000000_0000002)],
- [qw(00_0000000_0000001 ff_fffffff_ffffff0
- ff_fffffff_ffffff1 00_0000000_0000011 00_0000000_0000002)],
- ];
-
- $error_count += AddressAddUnitTest($unit_test_data_8, $unit_test_data_16);
- $error_count += AddressSubUnitTest($unit_test_data_8, $unit_test_data_16);
- $error_count += AddressIncUnitTest($unit_test_data_8, $unit_test_data_16);
- if ($error_count > 0) {
- print STDERR $error_count, " errors: FAILED\n";
- } else {
- print STDERR "PASS\n";
- }
- exit ($error_count);
-}
diff --git a/memory/jemalloc/src/build-aux/config.guess b/memory/jemalloc/src/build-aux/config.guess
deleted file mode 100755
index 1f5c50c0d1..0000000000
--- a/memory/jemalloc/src/build-aux/config.guess
+++ /dev/null
@@ -1,1420 +0,0 @@
-#! /bin/sh
-# Attempt to guess a canonical system name.
-# Copyright 1992-2014 Free Software Foundation, Inc.
-
-timestamp='2014-03-23'
-
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that
-# program. This Exception is an additional permission under section 7
-# of the GNU General Public License, version 3 ("GPLv3").
-#
-# Originally written by Per Bothner.
-#
-# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
-#
-# Please send patches with a ChangeLog entry to config-patches@gnu.org.
-
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION]
-
-Output the configuration name of the system \`$me' is run on.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.guess ($timestamp)
-
-Originally written by Per Bothner.
-Copyright 1992-2014 Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit ;;
- --version | -v )
- echo "$version" ; exit ;;
- --help | --h* | -h )
- echo "$usage"; exit ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help" >&2
- exit 1 ;;
- * )
- break ;;
- esac
-done
-
-if test $# != 0; then
- echo "$me: too many arguments$help" >&2
- exit 1
-fi
-
-trap 'exit 1' 1 2 15
-
-# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
-# compiler to aid in system detection is discouraged as it requires
-# temporary files to be created and, as you can see below, it is a
-# headache to deal with in a portable fashion.
-
-# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
-# use `HOST_CC' if defined, but it is deprecated.
-
-# Portable tmp directory creation inspired by the Autoconf team.
-
-set_cc_for_build='
-trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
-: ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
-dummy=$tmp/dummy ;
-tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
-case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,) echo "int x;" > $dummy.c ;
- for c in cc gcc c89 c99 ; do
- if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
- CC_FOR_BUILD="$c"; break ;
- fi ;
- done ;
- if test x"$CC_FOR_BUILD" = x ; then
- CC_FOR_BUILD=no_compiler_found ;
- fi
- ;;
- ,,*) CC_FOR_BUILD=$CC ;;
- ,*,*) CC_FOR_BUILD=$HOST_CC ;;
-esac ; set_cc_for_build= ;'
-
-# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 1994-08-24)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
- PATH=$PATH:/.attbin ; export PATH
-fi
-
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-
-case "${UNAME_SYSTEM}" in
-Linux|GNU|GNU/*)
- # If the system lacks a compiler, then just pick glibc.
- # We could probably try harder.
- LIBC=gnu
-
- eval $set_cc_for_build
- cat <<-EOF > $dummy.c
- #include <features.h>
- #if defined(__UCLIBC__)
- LIBC=uclibc
- #elif defined(__dietlibc__)
- LIBC=dietlibc
- #else
- LIBC=gnu
- #endif
- EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
- ;;
-esac
-
-# Note: order is significant - the case branches are not exclusive.
-
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
- *:NetBSD:*:*)
- # NetBSD (nbsd) targets should (where applicable) match one or
- # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
- # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
- # switched to ELF, *-*-netbsd* would select the old
- # object file format. This provides both forward
- # compatibility and a consistent mechanism for selecting the
- # object file format.
- #
- # Note: NetBSD doesn't particularly care about the vendor
- # portion of the name. We always set it to "unknown".
- sysctl="sysctl -n hw.machine_arch"
- UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
- /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
- case "${UNAME_MACHINE_ARCH}" in
- armeb) machine=armeb-unknown ;;
- arm*) machine=arm-unknown ;;
- sh3el) machine=shl-unknown ;;
- sh3eb) machine=sh-unknown ;;
- sh5el) machine=sh5le-unknown ;;
- *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
- esac
- # The Operating System including object format, if it has switched
- # to ELF recently, or will in the future.
- case "${UNAME_MACHINE_ARCH}" in
- arm*|i386|m68k|ns32k|sh3*|sparc|vax)
- eval $set_cc_for_build
- if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep -q __ELF__
- then
- # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
- # Return netbsd for either. FIX?
- os=netbsd
- else
- os=netbsdelf
- fi
- ;;
- *)
- os=netbsd
- ;;
- esac
- # The OS release
- # Debian GNU/NetBSD machines have a different userland, and
- # thus, need a distinct triplet. However, they do not need
- # kernel version information, so it can be replaced with a
- # suitable tag, in the style of linux-gnu.
- case "${UNAME_VERSION}" in
- Debian*)
- release='-gnu'
- ;;
- *)
- release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
- ;;
- esac
- # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
- # contains redundant information, the shorter form:
- # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
- echo "${machine}-${os}${release}"
- exit ;;
- *:Bitrig:*:*)
- UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
- exit ;;
- *:OpenBSD:*:*)
- UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
- exit ;;
- *:ekkoBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
- exit ;;
- *:SolidBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE}
- exit ;;
- macppc:MirBSD:*:*)
- echo powerpc-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
- *:MirBSD:*:*)
- echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
- exit ;;
- alpha:OSF1:*:*)
- case $UNAME_RELEASE in
- *4.0)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
- ;;
- *5.*)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
- ;;
- esac
- # According to Compaq, /usr/sbin/psrinfo has been available on
- # OSF/1 and Tru64 systems produced since 1995. I hope that
- # covers most systems running today. This code pipes the CPU
- # types through head -n 1, so we only detect the type of CPU 0.
- ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1`
- case "$ALPHA_CPU_TYPE" in
- "EV4 (21064)")
- UNAME_MACHINE="alpha" ;;
- "EV4.5 (21064)")
- UNAME_MACHINE="alpha" ;;
- "LCA4 (21066/21068)")
- UNAME_MACHINE="alpha" ;;
- "EV5 (21164)")
- UNAME_MACHINE="alphaev5" ;;
- "EV5.6 (21164A)")
- UNAME_MACHINE="alphaev56" ;;
- "EV5.6 (21164PC)")
- UNAME_MACHINE="alphapca56" ;;
- "EV5.7 (21164PC)")
- UNAME_MACHINE="alphapca57" ;;
- "EV6 (21264)")
- UNAME_MACHINE="alphaev6" ;;
- "EV6.7 (21264A)")
- UNAME_MACHINE="alphaev67" ;;
- "EV6.8CB (21264C)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.8AL (21264B)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.8CX (21264D)")
- UNAME_MACHINE="alphaev68" ;;
- "EV6.9A (21264/EV69A)")
- UNAME_MACHINE="alphaev69" ;;
- "EV7 (21364)")
- UNAME_MACHINE="alphaev7" ;;
- "EV7.9 (21364A)")
- UNAME_MACHINE="alphaev79" ;;
- esac
- # A Pn.n version is a patched version.
- # A Vn.n version is a released version.
- # A Tn.n version is a released field test version.
- # A Xn.n version is an unreleased experimental baselevel.
- # 1.2 uses "1.2" for uname -r.
- echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
- exitcode=$?
- trap '' 0
- exit $exitcode ;;
- Alpha\ *:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # Should we change UNAME_MACHINE based on the output of uname instead
- # of the specific Alpha model?
- echo alpha-pc-interix
- exit ;;
- 21064:Windows_NT:50:3)
- echo alpha-dec-winnt3.5
- exit ;;
- Amiga*:UNIX_System_V:4.0:*)
- echo m68k-unknown-sysv4
- exit ;;
- *:[Aa]miga[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-amigaos
- exit ;;
- *:[Mm]orph[Oo][Ss]:*:*)
- echo ${UNAME_MACHINE}-unknown-morphos
- exit ;;
- *:OS/390:*:*)
- echo i370-ibm-openedition
- exit ;;
- *:z/VM:*:*)
- echo s390-ibm-zvmoe
- exit ;;
- *:OS400:*:*)
- echo powerpc-ibm-os400
- exit ;;
- arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
- echo arm-acorn-riscix${UNAME_RELEASE}
- exit ;;
- arm*:riscos:*:*|arm*:RISCOS:*:*)
- echo arm-unknown-riscos
- exit ;;
- SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
- echo hppa1.1-hitachi-hiuxmpp
- exit ;;
- Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
- # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
- if test "`(/bin/universe) 2>/dev/null`" = att ; then
- echo pyramid-pyramid-sysv3
- else
- echo pyramid-pyramid-bsd
- fi
- exit ;;
- NILE*:*:*:dcosx)
- echo pyramid-pyramid-svr4
- exit ;;
- DRS?6000:unix:4.0:6*)
- echo sparc-icl-nx6
- exit ;;
- DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
- case `/usr/bin/uname -p` in
- sparc) echo sparc-icl-nx7; exit ;;
- esac ;;
- s390x:SunOS:*:*)
- echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4H:SunOS:5.*:*)
- echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
- echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
- echo i386-pc-auroraux${UNAME_RELEASE}
- exit ;;
- i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
- eval $set_cc_for_build
- SUN_ARCH="i386"
- # If there is a compiler, see if it is configured for 64-bit objects.
- # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
- # This test works for both compilers.
- if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
- if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- SUN_ARCH="x86_64"
- fi
- fi
- echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:6*:*)
- # According to config.sub, this is the proper way to canonicalize
- # SunOS6. Hard to guess exactly what SunOS6 will be like, but
- # it's likely to be more like Solaris than SunOS4.
- echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- sun4*:SunOS:*:*)
- case "`/usr/bin/arch -k`" in
- Series*|S4*)
- UNAME_RELEASE=`uname -v`
- ;;
- esac
- # Japanese Language versions have a version number like `4.1.3-JL'.
- echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
- exit ;;
- sun3*:SunOS:*:*)
- echo m68k-sun-sunos${UNAME_RELEASE}
- exit ;;
- sun*:*:4.2BSD:*)
- UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
- test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
- case "`/bin/arch`" in
- sun3)
- echo m68k-sun-sunos${UNAME_RELEASE}
- ;;
- sun4)
- echo sparc-sun-sunos${UNAME_RELEASE}
- ;;
- esac
- exit ;;
- aushp:SunOS:*:*)
- echo sparc-auspex-sunos${UNAME_RELEASE}
- exit ;;
- # The situation for MiNT is a little confusing. The machine name
- # can be virtually everything (everything which is not
- # "atarist" or "atariste" at least should have a processor
- # > m68000). The system name ranges from "MiNT" over "FreeMiNT"
- # to the lowercase version "mint" (or "freemint"). Finally
- # the system name "TOS" denotes a system which is actually not
- # MiNT. But MiNT is downward compatible to TOS, so this should
- # be no problem.
- atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
- milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
- echo m68k-milan-mint${UNAME_RELEASE}
- exit ;;
- hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
- echo m68k-hades-mint${UNAME_RELEASE}
- exit ;;
- *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
- echo m68k-unknown-mint${UNAME_RELEASE}
- exit ;;
- m68k:machten:*:*)
- echo m68k-apple-machten${UNAME_RELEASE}
- exit ;;
- powerpc:machten:*:*)
- echo powerpc-apple-machten${UNAME_RELEASE}
- exit ;;
- RISC*:Mach:*:*)
- echo mips-dec-mach_bsd4.3
- exit ;;
- RISC*:ULTRIX:*:*)
- echo mips-dec-ultrix${UNAME_RELEASE}
- exit ;;
- VAX*:ULTRIX*:*:*)
- echo vax-dec-ultrix${UNAME_RELEASE}
- exit ;;
- 2020:CLIX:*:* | 2430:CLIX:*:*)
- echo clipper-intergraph-clix${UNAME_RELEASE}
- exit ;;
- mips:*:*:UMIPS | mips:*:*:RISCos)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-#ifdef __cplusplus
-#include <stdio.h> /* for printf() prototype */
- int main (int argc, char *argv[]) {
-#else
- int main (argc, argv) int argc; char *argv[]; {
-#endif
- #if defined (host_mips) && defined (MIPSEB)
- #if defined (SYSTYPE_SYSV)
- printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_SVR4)
- printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
- #endif
- #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
- printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
- #endif
- #endif
- exit (-1);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c &&
- dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
- SYSTEM_NAME=`$dummy $dummyarg` &&
- { echo "$SYSTEM_NAME"; exit; }
- echo mips-mips-riscos${UNAME_RELEASE}
- exit ;;
- Motorola:PowerMAX_OS:*:*)
- echo powerpc-motorola-powermax
- exit ;;
- Motorola:*:4.3:PL8-*)
- echo powerpc-harris-powermax
- exit ;;
- Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
- echo powerpc-harris-powermax
- exit ;;
- Night_Hawk:Power_UNIX:*:*)
- echo powerpc-harris-powerunix
- exit ;;
- m88k:CX/UX:7*:*)
- echo m88k-harris-cxux7
- exit ;;
- m88k:*:4*:R4*)
- echo m88k-motorola-sysv4
- exit ;;
- m88k:*:3*:R3*)
- echo m88k-motorola-sysv3
- exit ;;
- AViiON:dgux:*:*)
- # DG/UX returns AViiON for all architectures
- UNAME_PROCESSOR=`/usr/bin/uname -p`
- if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
- then
- if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
- [ ${TARGET_BINARY_INTERFACE}x = x ]
- then
- echo m88k-dg-dgux${UNAME_RELEASE}
- else
- echo m88k-dg-dguxbcs${UNAME_RELEASE}
- fi
- else
- echo i586-dg-dgux${UNAME_RELEASE}
- fi
- exit ;;
- M88*:DolphinOS:*:*) # DolphinOS (SVR3)
- echo m88k-dolphin-sysv3
- exit ;;
- M88*:*:R3*:*)
- # Delta 88k system running SVR3
- echo m88k-motorola-sysv3
- exit ;;
- XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
- echo m88k-tektronix-sysv3
- exit ;;
- Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
- echo m68k-tektronix-bsd
- exit ;;
- *:IRIX*:*:*)
- echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
- exit ;;
- ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
- echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id
- exit ;; # Note that: echo "'`uname -s`'" gives 'AIX '
- i*86:AIX:*:*)
- echo i386-ibm-aix
- exit ;;
- ia64:AIX:*:*)
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
- exit ;;
- *:AIX:2:3)
- if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <sys/systemcfg.h>
-
- main()
- {
- if (!__power_pc())
- exit(1);
- puts("powerpc-ibm-aix3.2.5");
- exit(0);
- }
-EOF
- if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
- then
- echo "$SYSTEM_NAME"
- else
- echo rs6000-ibm-aix3.2.5
- fi
- elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
- echo rs6000-ibm-aix3.2.4
- else
- echo rs6000-ibm-aix3.2
- fi
- exit ;;
- *:AIX:*:[4567])
- IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
- if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
- IBM_ARCH=rs6000
- else
- IBM_ARCH=powerpc
- fi
- if [ -x /usr/bin/oslevel ] ; then
- IBM_REV=`/usr/bin/oslevel`
- else
- IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
- fi
- echo ${IBM_ARCH}-ibm-aix${IBM_REV}
- exit ;;
- *:AIX:*:*)
- echo rs6000-ibm-aix
- exit ;;
- ibmrt:4.4BSD:*|romp-ibm:BSD:*)
- echo romp-ibm-bsd4.4
- exit ;;
- ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and
- echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to
- exit ;; # report: romp-ibm BSD 4.3
- *:BOSX:*:*)
- echo rs6000-bull-bosx
- exit ;;
- DPX/2?00:B.O.S.:*:*)
- echo m68k-bull-sysv3
- exit ;;
- 9000/[34]??:4.3bsd:1.*:*)
- echo m68k-hp-bsd
- exit ;;
- hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
- echo m68k-hp-bsd4.4
- exit ;;
- 9000/[34678]??:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- case "${UNAME_MACHINE}" in
- 9000/31? ) HP_ARCH=m68000 ;;
- 9000/[34]?? ) HP_ARCH=m68k ;;
- 9000/[678][0-9][0-9])
- if [ -x /usr/bin/getconf ]; then
- sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
- sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
- case "${sc_cpu_version}" in
- 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
- 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
- 532) # CPU_PA_RISC2_0
- case "${sc_kernel_bits}" in
- 32) HP_ARCH="hppa2.0n" ;;
- 64) HP_ARCH="hppa2.0w" ;;
- '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
- esac ;;
- esac
- fi
- if [ "${HP_ARCH}" = "" ]; then
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
-
- #define _HPUX_SOURCE
- #include <stdlib.h>
- #include <unistd.h>
-
- int main ()
- {
- #if defined(_SC_KERNEL_BITS)
- long bits = sysconf(_SC_KERNEL_BITS);
- #endif
- long cpu = sysconf (_SC_CPU_VERSION);
-
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
- case CPU_PA_RISC2_0:
- #if defined(_SC_KERNEL_BITS)
- switch (bits)
- {
- case 64: puts ("hppa2.0w"); break;
- case 32: puts ("hppa2.0n"); break;
- default: puts ("hppa2.0"); break;
- } break;
- #else /* !defined(_SC_KERNEL_BITS) */
- puts ("hppa2.0"); break;
- #endif
- default: puts ("hppa1.0"); break;
- }
- exit (0);
- }
-EOF
- (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
- test -z "$HP_ARCH" && HP_ARCH=hppa
- fi ;;
- esac
- if [ ${HP_ARCH} = "hppa2.0w" ]
- then
- eval $set_cc_for_build
-
- # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
- # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler
- # generating 64-bit code. GNU and HP use different nomenclature:
- #
- # $ CC_FOR_BUILD=cc ./config.guess
- # => hppa2.0w-hp-hpux11.23
- # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
- # => hppa64-hp-hpux11.23
-
- if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
- grep -q __LP64__
- then
- HP_ARCH="hppa2.0w"
- else
- HP_ARCH="hppa64"
- fi
- fi
- echo ${HP_ARCH}-hp-hpux${HPUX_REV}
- exit ;;
- ia64:HP-UX:*:*)
- HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
- echo ia64-hp-hpux${HPUX_REV}
- exit ;;
- 3050*:HI-UX:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <unistd.h>
- int
- main ()
- {
- long cpu = sysconf (_SC_CPU_VERSION);
- /* The order matters, because CPU_IS_HP_MC68K erroneously returns
- true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct
- results, however. */
- if (CPU_IS_PA_RISC (cpu))
- {
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
- case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
- default: puts ("hppa-hitachi-hiuxwe2"); break;
- }
- }
- else if (CPU_IS_HP_MC68K (cpu))
- puts ("m68k-hitachi-hiuxwe2");
- else puts ("unknown-hitachi-hiuxwe2");
- exit (0);
- }
-EOF
- $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
- { echo "$SYSTEM_NAME"; exit; }
- echo unknown-hitachi-hiuxwe2
- exit ;;
- 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
- echo hppa1.1-hp-bsd
- exit ;;
- 9000/8??:4.3bsd:*:*)
- echo hppa1.0-hp-bsd
- exit ;;
- *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
- echo hppa1.0-hp-mpeix
- exit ;;
- hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
- echo hppa1.1-hp-osf
- exit ;;
- hp8??:OSF1:*:*)
- echo hppa1.0-hp-osf
- exit ;;
- i*86:OSF1:*:*)
- if [ -x /usr/sbin/sysversion ] ; then
- echo ${UNAME_MACHINE}-unknown-osf1mk
- else
- echo ${UNAME_MACHINE}-unknown-osf1
- fi
- exit ;;
- parisc*:Lites*:*:*)
- echo hppa1.1-hp-lites
- exit ;;
- C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
- echo c1-convex-bsd
- exit ;;
- C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
- if getsysinfo -f scalar_acc
- then echo c32-convex-bsd
- else echo c2-convex-bsd
- fi
- exit ;;
- C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
- echo c34-convex-bsd
- exit ;;
- C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
- echo c38-convex-bsd
- exit ;;
- C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
- echo c4-convex-bsd
- exit ;;
- CRAY*Y-MP:*:*:*)
- echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*[A-Z]90:*:*:*)
- echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
- | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
- -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
- -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*TS:*:*:*)
- echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*T3E:*:*:*)
- echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- CRAY*SV1:*:*:*)
- echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- *:UNICOS/mp:*:*)
- echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
- exit ;;
- F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
- FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
- 5000:UNIX_System_V:4.*:*)
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
- echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
- i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
- echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
- exit ;;
- sparc*:BSD/OS:*:*)
- echo sparc-unknown-bsdi${UNAME_RELEASE}
- exit ;;
- *:BSD/OS:*:*)
- echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
- exit ;;
- *:FreeBSD:*:*)
- UNAME_PROCESSOR=`/usr/bin/uname -p`
- case ${UNAME_PROCESSOR} in
- amd64)
- echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
- *)
- echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
- esac
- exit ;;
- i*:CYGWIN*:*)
- echo ${UNAME_MACHINE}-pc-cygwin
- exit ;;
- *:MINGW64*:*)
- echo ${UNAME_MACHINE}-pc-mingw64
- exit ;;
- *:MINGW*:*)
- echo ${UNAME_MACHINE}-pc-mingw32
- exit ;;
- *:MSYS*:*)
- echo ${UNAME_MACHINE}-pc-msys
- exit ;;
- i*:windows32*:*)
- # uname -m includes "-pc" on this system.
- echo ${UNAME_MACHINE}-mingw32
- exit ;;
- i*:PW*:*)
- echo ${UNAME_MACHINE}-pc-pw32
- exit ;;
- *:Interix*:*)
- case ${UNAME_MACHINE} in
- x86)
- echo i586-pc-interix${UNAME_RELEASE}
- exit ;;
- authenticamd | genuineintel | EM64T)
- echo x86_64-unknown-interix${UNAME_RELEASE}
- exit ;;
- IA64)
- echo ia64-unknown-interix${UNAME_RELEASE}
- exit ;;
- esac ;;
- [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
- echo i${UNAME_MACHINE}-pc-mks
- exit ;;
- 8664:Windows_NT:*)
- echo x86_64-pc-mks
- exit ;;
- i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
- # How do we know it's Interix rather than the generic POSIX subsystem?
- # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
- # UNAME_MACHINE based on the output of uname instead of i386?
- echo i586-pc-interix
- exit ;;
- i*:UWIN*:*)
- echo ${UNAME_MACHINE}-pc-uwin
- exit ;;
- amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*)
- echo x86_64-unknown-cygwin
- exit ;;
- p*:CYGWIN*:*)
- echo powerpcle-unknown-cygwin
- exit ;;
- prep*:SunOS:5.*:*)
- echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
- *:GNU:*:*)
- # the GNU system
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
- exit ;;
- *:GNU/*:*:*)
- # other systems with GNU libc and userland
- echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
- exit ;;
- i*86:Minix:*:*)
- echo ${UNAME_MACHINE}-pc-minix
- exit ;;
- aarch64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- aarch64_be:Linux:*:*)
- UNAME_MACHINE=aarch64_be
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- alpha:Linux:*:*)
- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
- EV5) UNAME_MACHINE=alphaev5 ;;
- EV56) UNAME_MACHINE=alphaev56 ;;
- PCA56) UNAME_MACHINE=alphapca56 ;;
- PCA57) UNAME_MACHINE=alphapca56 ;;
- EV6) UNAME_MACHINE=alphaev6 ;;
- EV67) UNAME_MACHINE=alphaev67 ;;
- EV68*) UNAME_MACHINE=alphaev68 ;;
- esac
- objdump --private-headers /bin/sh | grep -q ld.so.1
- if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- arc:Linux:*:* | arceb:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- arm*:Linux:*:*)
- eval $set_cc_for_build
- if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep -q __ARM_EABI__
- then
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- else
- if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep -q __ARM_PCS_VFP
- then
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
- else
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
- fi
- fi
- exit ;;
- avr32*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- cris:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-${LIBC}
- exit ;;
- crisv32:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-${LIBC}
- exit ;;
- frv:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- hexagon:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- i*86:Linux:*:*)
- echo ${UNAME_MACHINE}-pc-linux-${LIBC}
- exit ;;
- ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- m32r*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- mips:Linux:*:* | mips64:Linux:*:*)
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #undef CPU
- #undef ${UNAME_MACHINE}
- #undef ${UNAME_MACHINE}el
- #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=${UNAME_MACHINE}el
- #else
- #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=${UNAME_MACHINE}
- #else
- CPU=
- #endif
- #endif
-EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
- ;;
- openrisc*:Linux:*:*)
- echo or1k-unknown-linux-${LIBC}
- exit ;;
- or32:Linux:*:* | or1k*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- padre:Linux:*:*)
- echo sparc-unknown-linux-${LIBC}
- exit ;;
- parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-${LIBC}
- exit ;;
- parisc:Linux:*:* | hppa:Linux:*:*)
- # Look for CPU level
- case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
- PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
- PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
- *) echo hppa-unknown-linux-${LIBC} ;;
- esac
- exit ;;
- ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-${LIBC}
- exit ;;
- ppc:Linux:*:*)
- echo powerpc-unknown-linux-${LIBC}
- exit ;;
- ppc64le:Linux:*:*)
- echo powerpc64le-unknown-linux-${LIBC}
- exit ;;
- ppcle:Linux:*:*)
- echo powerpcle-unknown-linux-${LIBC}
- exit ;;
- s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
- exit ;;
- sh64*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- sparc:Linux:*:* | sparc64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- tile*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- vax:Linux:*:*)
- echo ${UNAME_MACHINE}-dec-linux-${LIBC}
- exit ;;
- x86_64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- xtensa*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- i*86:DYNIX/ptx:4*:*)
- # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
- # earlier versions are messed up and put the nodename in both
- # sysname and nodename.
- echo i386-sequent-sysv4
- exit ;;
- i*86:UNIX_SV:4.2MP:2.*)
- # Unixware is an offshoot of SVR4, but it has its own version
- # number series starting with 2...
- # I am not positive that other SVR4 systems won't match this,
- # I just have to hope. -- rms.
- # Use sysv4.2uw... so that sysv4* matches it.
- echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
- exit ;;
- i*86:OS/2:*:*)
- # If we were able to find `uname', then EMX Unix compatibility
- # is probably installed.
- echo ${UNAME_MACHINE}-pc-os2-emx
- exit ;;
- i*86:XTS-300:*:STOP)
- echo ${UNAME_MACHINE}-unknown-stop
- exit ;;
- i*86:atheos:*:*)
- echo ${UNAME_MACHINE}-unknown-atheos
- exit ;;
- i*86:syllable:*:*)
- echo ${UNAME_MACHINE}-pc-syllable
- exit ;;
- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
- echo i386-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- i*86:*DOS:*:*)
- echo ${UNAME_MACHINE}-pc-msdosdjgpp
- exit ;;
- i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
- UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
- if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
- echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
- else
- echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
- fi
- exit ;;
- i*86:*:5:[678]*)
- # UnixWare 7.x, OpenUNIX and OpenServer 6.
- case `/bin/uname -X | grep "^Machine"` in
- *486*) UNAME_MACHINE=i486 ;;
- *Pentium) UNAME_MACHINE=i586 ;;
- *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
- esac
- echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
- exit ;;
- i*86:*:3.2:*)
- if test -f /usr/options/cb.name; then
- UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
- echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
- elif /bin/uname -X 2>/dev/null >/dev/null ; then
- UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
- (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
- (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
- && UNAME_MACHINE=i586
- (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
- && UNAME_MACHINE=i686
- (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
- && UNAME_MACHINE=i686
- echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
- else
- echo ${UNAME_MACHINE}-pc-sysv32
- fi
- exit ;;
- pc:*:*:*)
- # Left here for compatibility:
- # uname -m prints for DJGPP always 'pc', but it prints nothing about
- # the processor, so we play safe by assuming i586.
- # Note: whatever this is, it MUST be the same as what config.sub
- # prints for the "djgpp" host, or else GDB configury will decide that
- # this is a cross-build.
- echo i586-pc-msdosdjgpp
- exit ;;
- Intel:Mach:3*:*)
- echo i386-pc-mach3
- exit ;;
- paragon:*:*:*)
- echo i860-intel-osf1
- exit ;;
- i860:*:4.*:*) # i860-SVR4
- if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
- echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
- else # Add other i860-SVR4 vendors below as they are discovered.
- echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4
- fi
- exit ;;
- mini*:CTIX:SYS*5:*)
- # "miniframe"
- echo m68010-convergent-sysv
- exit ;;
- mc68k:UNIX:SYSTEM5:3.51m)
- echo m68k-convergent-sysv
- exit ;;
- M680?0:D-NIX:5.3:*)
- echo m68k-diab-dnix
- exit ;;
- M68*:*:R3V[5678]*:*)
- test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
- 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
- OS_REL=''
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
- 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4; exit; } ;;
- NCR*:*:4.2:* | MPRAS*:*:4.2:*)
- OS_REL='.3'
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
- m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
- echo m68k-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- mc68030:UNIX_System_V:4.*:*)
- echo m68k-atari-sysv4
- exit ;;
- TSUNAMI:LynxOS:2.*:*)
- echo sparc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- rs6000:LynxOS:2.*:*)
- echo rs6000-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
- echo powerpc-unknown-lynxos${UNAME_RELEASE}
- exit ;;
- SM[BE]S:UNIX_SV:*:*)
- echo mips-dde-sysv${UNAME_RELEASE}
- exit ;;
- RM*:ReliantUNIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
- RM*:SINIX-*:*:*)
- echo mips-sni-sysv4
- exit ;;
- *:SINIX-*:*:*)
- if uname -p 2>/dev/null >/dev/null ; then
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- echo ${UNAME_MACHINE}-sni-sysv4
- else
- echo ns32k-sni-sysv
- fi
- exit ;;
- PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit ;;
- *:UNIX_System_V:4*:FTX*)
- # From Gerald Hewes <hewes@openmarket.com>.
- # How about differentiating between stratus architectures? -djm
- echo hppa1.1-stratus-sysv4
- exit ;;
- *:*:*:FTX*)
- # From seanf@swdc.stratus.com.
- echo i860-stratus-sysv4
- exit ;;
- i*86:VOS:*:*)
- # From Paul.Green@stratus.com.
- echo ${UNAME_MACHINE}-stratus-vos
- exit ;;
- *:VOS:*:*)
- # From Paul.Green@stratus.com.
- echo hppa1.1-stratus-vos
- exit ;;
- mc68*:A/UX:*:*)
- echo m68k-apple-aux${UNAME_RELEASE}
- exit ;;
- news*:NEWS-OS:6*:*)
- echo mips-sony-newsos6
- exit ;;
- R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
- if [ -d /usr/nec ]; then
- echo mips-nec-sysv${UNAME_RELEASE}
- else
- echo mips-unknown-sysv${UNAME_RELEASE}
- fi
- exit ;;
- BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
- echo powerpc-be-beos
- exit ;;
- BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only.
- echo powerpc-apple-beos
- exit ;;
- BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
- echo i586-pc-beos
- exit ;;
- BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
- echo i586-pc-haiku
- exit ;;
- x86_64:Haiku:*:*)
- echo x86_64-unknown-haiku
- exit ;;
- SX-4:SUPER-UX:*:*)
- echo sx4-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-5:SUPER-UX:*:*)
- echo sx5-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-6:SUPER-UX:*:*)
- echo sx6-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-7:SUPER-UX:*:*)
- echo sx7-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-8:SUPER-UX:*:*)
- echo sx8-nec-superux${UNAME_RELEASE}
- exit ;;
- SX-8R:SUPER-UX:*:*)
- echo sx8r-nec-superux${UNAME_RELEASE}
- exit ;;
- Power*:Rhapsody:*:*)
- echo powerpc-apple-rhapsody${UNAME_RELEASE}
- exit ;;
- *:Rhapsody:*:*)
- echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
- exit ;;
- *:Darwin:*:*)
- UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- eval $set_cc_for_build
- if test "$UNAME_PROCESSOR" = unknown ; then
- UNAME_PROCESSOR=powerpc
- fi
- if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
- if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
- if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- case $UNAME_PROCESSOR in
- i386) UNAME_PROCESSOR=x86_64 ;;
- powerpc) UNAME_PROCESSOR=powerpc64 ;;
- esac
- fi
- fi
- elif test "$UNAME_PROCESSOR" = i386 ; then
- # Avoid executing cc on OS X 10.9, as it ships with a stub
- # that puts up a graphical alert prompting to install
- # developer tools. Any system running Mac OS X 10.7 or
- # later (Darwin 11 and later) is required to have a 64-bit
- # processor. This is not true of the ARM version of Darwin
- # that Apple uses in portable devices.
- UNAME_PROCESSOR=x86_64
- fi
- echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
- exit ;;
- *:procnto*:*:* | *:QNX:[0123456789]*:*)
- UNAME_PROCESSOR=`uname -p`
- if test "$UNAME_PROCESSOR" = "x86"; then
- UNAME_PROCESSOR=i386
- UNAME_MACHINE=pc
- fi
- echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
- exit ;;
- *:QNX:*:4*)
- echo i386-pc-qnx
- exit ;;
- NEO-?:NONSTOP_KERNEL:*:*)
- echo neo-tandem-nsk${UNAME_RELEASE}
- exit ;;
- NSE-*:NONSTOP_KERNEL:*:*)
- echo nse-tandem-nsk${UNAME_RELEASE}
- exit ;;
- NSR-?:NONSTOP_KERNEL:*:*)
- echo nsr-tandem-nsk${UNAME_RELEASE}
- exit ;;
- *:NonStop-UX:*:*)
- echo mips-compaq-nonstopux
- exit ;;
- BS2000:POSIX*:*:*)
- echo bs2000-siemens-sysv
- exit ;;
- DS/*:UNIX_System_V:*:*)
- echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
- exit ;;
- *:Plan9:*:*)
- # "uname -m" is not consistent, so use $cputype instead. 386
- # is converted to i386 for consistency with other x86
- # operating systems.
- if test "$cputype" = "386"; then
- UNAME_MACHINE=i386
- else
- UNAME_MACHINE="$cputype"
- fi
- echo ${UNAME_MACHINE}-unknown-plan9
- exit ;;
- *:TOPS-10:*:*)
- echo pdp10-unknown-tops10
- exit ;;
- *:TENEX:*:*)
- echo pdp10-unknown-tenex
- exit ;;
- KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
- echo pdp10-dec-tops20
- exit ;;
- XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
- echo pdp10-xkl-tops20
- exit ;;
- *:TOPS-20:*:*)
- echo pdp10-unknown-tops20
- exit ;;
- *:ITS:*:*)
- echo pdp10-unknown-its
- exit ;;
- SEI:*:*:SEIUX)
- echo mips-sei-seiux${UNAME_RELEASE}
- exit ;;
- *:DragonFly:*:*)
- echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
- exit ;;
- *:*VMS:*:*)
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
- case "${UNAME_MACHINE}" in
- A*) echo alpha-dec-vms ; exit ;;
- I*) echo ia64-dec-vms ; exit ;;
- V*) echo vax-dec-vms ; exit ;;
- esac ;;
- *:XENIX:*:SysV)
- echo i386-pc-xenix
- exit ;;
- i*86:skyos:*:*)
- echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
- exit ;;
- i*86:rdos:*:*)
- echo ${UNAME_MACHINE}-pc-rdos
- exit ;;
- i*86:AROS:*:*)
- echo ${UNAME_MACHINE}-pc-aros
- exit ;;
- x86_64:VMkernel:*:*)
- echo ${UNAME_MACHINE}-unknown-esx
- exit ;;
-esac
-
-cat >&2 <<EOF
-$0: unable to guess system type
-
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
-
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
-and
- http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
-
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
-
-config.guess timestamp = $timestamp
-
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
-/bin/uname -X = `(/bin/uname -X) 2>/dev/null`
-
-hostinfo = `(hostinfo) 2>/dev/null`
-/bin/universe = `(/bin/universe) 2>/dev/null`
-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null`
-/bin/arch = `(/bin/arch) 2>/dev/null`
-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
-
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
-EOF
-
-exit 1
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/memory/jemalloc/src/build-aux/config.sub b/memory/jemalloc/src/build-aux/config.sub
deleted file mode 100755
index 0ccff77068..0000000000
--- a/memory/jemalloc/src/build-aux/config.sub
+++ /dev/null
@@ -1,1797 +0,0 @@
-#! /bin/sh
-# Configuration validation subroutine script.
-# Copyright 1992-2014 Free Software Foundation, Inc.
-
-timestamp='2014-05-01'
-
-# This file is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that
-# program. This Exception is an additional permission under section 7
-# of the GNU General Public License, version 3 ("GPLv3").
-
-
-# Please send patches with a ChangeLog entry to config-patches@gnu.org.
-#
-# Configuration subroutine to validate and canonicalize a configuration type.
-# Supply the specified configuration type as an argument.
-# If it is invalid, we print an error message on stderr and exit with code 1.
-# Otherwise, we print the canonical config type on stdout and succeed.
-
-# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
-
-# This file is supposed to be the same for all GNU packages
-# and recognize all the CPU types, system types and aliases
-# that are meaningful with *any* GNU software.
-# Each package is responsible for reporting which valid configurations
-# it does not support. The user should be able to distinguish
-# a failure to support a valid configuration from a meaningless
-# configuration.
-
-# The goal of this file is to map all the various variations of a given
-# machine specification into a single specification in the form:
-# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or in some cases, the newer four-part form:
-# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# It is wrong to echo any other type of specification.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
- $0 [OPTION] ALIAS
-
-Canonicalize a configuration name.
-
-Operation modes:
- -h, --help print this help, then exit
- -t, --time-stamp print date of last modification, then exit
- -v, --version print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.sub ($timestamp)
-
-Copyright 1992-2014 Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions. There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
- case $1 in
- --time-stamp | --time* | -t )
- echo "$timestamp" ; exit ;;
- --version | -v )
- echo "$version" ; exit ;;
- --help | --h* | -h )
- echo "$usage"; exit ;;
- -- ) # Stop option processing
- shift; break ;;
- - ) # Use stdin as input.
- break ;;
- -* )
- echo "$me: invalid option $1$help"
- exit 1 ;;
-
- *local*)
- # First pass through any local machine types.
- echo $1
- exit ;;
-
- * )
- break ;;
- esac
-done
-
-case $# in
- 0) echo "$me: missing argument$help" >&2
- exit 1;;
- 1) ;;
- *) echo "$me: too many arguments$help" >&2
- exit 1;;
-esac
-
-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
-# Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
-case $maybe_os in
- nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
- linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
- knetbsd*-gnu* | netbsd*-gnu* | \
- kopensolaris*-gnu* | \
- storm-chaos* | os2-emx* | rtmk-nova*)
- os=-$maybe_os
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
- ;;
- android-linux)
- os=-linux-android
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
- ;;
- *)
- basic_machine=`echo $1 | sed 's/-[^-]*$//'`
- if [ $basic_machine != $1 ]
- then os=`echo $1 | sed 's/.*-/-/'`
- else os=; fi
- ;;
-esac
-
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work. We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
- -sun*os*)
- # Prevent following clause from handling this invalid input.
- ;;
- -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
- -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
- -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
- -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
- -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
- -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis | -knuth | -cray | -microblaze*)
- os=
- basic_machine=$1
- ;;
- -bluegene*)
- os=-cnk
- ;;
- -sim | -cisco | -oki | -wec | -winbond)
- os=
- basic_machine=$1
- ;;
- -scout)
- ;;
- -wrs)
- os=-vxworks
- basic_machine=$1
- ;;
- -chorusos*)
- os=-chorusos
- basic_machine=$1
- ;;
- -chorusrdb)
- os=-chorusrdb
- basic_machine=$1
- ;;
- -hiux*)
- os=-hiuxwe2
- ;;
- -sco6)
- os=-sco5v6
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco5)
- os=-sco3.2v5
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco4)
- os=-sco3.2v4
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2.[4-9]*)
- os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco3.2v[4-9]*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco5v6*)
- # Don't forget version if it is 3.2v4 or newer.
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -sco*)
- os=-sco3.2v2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -udk*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -isc)
- os=-isc2.2
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -clix*)
- basic_machine=clipper-intergraph
- ;;
- -isc*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
- ;;
- -lynx*178)
- os=-lynxos178
- ;;
- -lynx*5)
- os=-lynxos5
- ;;
- -lynx*)
- os=-lynxos
- ;;
- -ptx*)
- basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
- ;;
- -windowsnt*)
- os=`echo $os | sed -e 's/windowsnt/winnt/'`
- ;;
- -psos*)
- os=-psos
- ;;
- -mint | -mint[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
-esac
-
-# Decode aliases for certain CPU-COMPANY combinations.
-case $basic_machine in
- # Recognize the basic CPU types without company name.
- # Some are omitted here because they have special meanings below.
- 1750a | 580 \
- | a29k \
- | aarch64 | aarch64_be \
- | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
- | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
- | am33_2.0 \
- | arc | arceb \
- | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
- | avr | avr32 \
- | be32 | be64 \
- | bfin \
- | c4x | c8051 | clipper \
- | d10v | d30v | dlx | dsp16xx \
- | epiphany \
- | fido | fr30 | frv \
- | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
- | hexagon \
- | i370 | i860 | i960 | ia64 \
- | ip2k | iq2000 \
- | k1om \
- | le32 | le64 \
- | lm32 \
- | m32c | m32r | m32rle | m68000 | m68k | m88k \
- | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
- | mips | mipsbe | mipseb | mipsel | mipsle \
- | mips16 \
- | mips64 | mips64el \
- | mips64octeon | mips64octeonel \
- | mips64orion | mips64orionel \
- | mips64r5900 | mips64r5900el \
- | mips64vr | mips64vrel \
- | mips64vr4100 | mips64vr4100el \
- | mips64vr4300 | mips64vr4300el \
- | mips64vr5000 | mips64vr5000el \
- | mips64vr5900 | mips64vr5900el \
- | mipsisa32 | mipsisa32el \
- | mipsisa32r2 | mipsisa32r2el \
- | mipsisa32r6 | mipsisa32r6el \
- | mipsisa64 | mipsisa64el \
- | mipsisa64r2 | mipsisa64r2el \
- | mipsisa64r6 | mipsisa64r6el \
- | mipsisa64sb1 | mipsisa64sb1el \
- | mipsisa64sr71k | mipsisa64sr71kel \
- | mipsr5900 | mipsr5900el \
- | mipstx39 | mipstx39el \
- | mn10200 | mn10300 \
- | moxie \
- | mt \
- | msp430 \
- | nds32 | nds32le | nds32be \
- | nios | nios2 | nios2eb | nios2el \
- | ns16k | ns32k \
- | open8 | or1k | or1knd | or32 \
- | pdp10 | pdp11 | pj | pjl \
- | powerpc | powerpc64 | powerpc64le | powerpcle \
- | pyramid \
- | rl78 | rx \
- | score \
- | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
- | sh64 | sh64le \
- | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
- | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
- | spu \
- | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
- | ubicom32 \
- | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
- | we32k \
- | x86 | xc16x | xstormy16 | xtensa \
- | z8k | z80)
- basic_machine=$basic_machine-unknown
- ;;
- c54x)
- basic_machine=tic54x-unknown
- ;;
- c55x)
- basic_machine=tic55x-unknown
- ;;
- c6x)
- basic_machine=tic6x-unknown
- ;;
- m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
- basic_machine=$basic_machine-unknown
- os=-none
- ;;
- m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
- ;;
- ms1)
- basic_machine=mt-unknown
- ;;
-
- strongarm | thumb | xscale)
- basic_machine=arm-unknown
- ;;
- xgate)
- basic_machine=$basic_machine-unknown
- os=-none
- ;;
- xscaleeb)
- basic_machine=armeb-unknown
- ;;
-
- xscaleel)
- basic_machine=armel-unknown
- ;;
-
- # We use `pc' rather than `unknown'
- # because (1) that's what they normally are, and
- # (2) the word "unknown" tends to confuse beginning users.
- i*86 | x86_64)
- basic_machine=$basic_machine-pc
- ;;
- # Object if more than one company name word.
- *-*-*)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
- # Recognize the basic CPU types with company name.
- 580-* \
- | a29k-* \
- | aarch64-* | aarch64_be-* \
- | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
- | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
- | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
- | avr-* | avr32-* \
- | be32-* | be64-* \
- | bfin-* | bs2000-* \
- | c[123]* | c30-* | [cjt]90-* | c4x-* \
- | c8051-* | clipper-* | craynv-* | cydra-* \
- | d10v-* | d30v-* | dlx-* \
- | elxsi-* \
- | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
- | h8300-* | h8500-* \
- | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
- | hexagon-* \
- | i*86-* | i860-* | i960-* | ia64-* \
- | ip2k-* | iq2000-* \
- | k1om-* \
- | le32-* | le64-* \
- | lm32-* \
- | m32c-* | m32r-* | m32rle-* \
- | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
- | microblaze-* | microblazeel-* \
- | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
- | mips16-* \
- | mips64-* | mips64el-* \
- | mips64octeon-* | mips64octeonel-* \
- | mips64orion-* | mips64orionel-* \
- | mips64r5900-* | mips64r5900el-* \
- | mips64vr-* | mips64vrel-* \
- | mips64vr4100-* | mips64vr4100el-* \
- | mips64vr4300-* | mips64vr4300el-* \
- | mips64vr5000-* | mips64vr5000el-* \
- | mips64vr5900-* | mips64vr5900el-* \
- | mipsisa32-* | mipsisa32el-* \
- | mipsisa32r2-* | mipsisa32r2el-* \
- | mipsisa32r6-* | mipsisa32r6el-* \
- | mipsisa64-* | mipsisa64el-* \
- | mipsisa64r2-* | mipsisa64r2el-* \
- | mipsisa64r6-* | mipsisa64r6el-* \
- | mipsisa64sb1-* | mipsisa64sb1el-* \
- | mipsisa64sr71k-* | mipsisa64sr71kel-* \
- | mipsr5900-* | mipsr5900el-* \
- | mipstx39-* | mipstx39el-* \
- | mmix-* \
- | mt-* \
- | msp430-* \
- | nds32-* | nds32le-* | nds32be-* \
- | nios-* | nios2-* | nios2eb-* | nios2el-* \
- | none-* | np1-* | ns16k-* | ns32k-* \
- | open8-* \
- | or1k*-* \
- | orion-* \
- | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
- | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
- | pyramid-* \
- | rl78-* | romp-* | rs6000-* | rx-* \
- | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
- | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
- | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
- | sparclite-* \
- | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
- | tahoe-* \
- | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
- | tile*-* \
- | tron-* \
- | ubicom32-* \
- | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
- | vax-* \
- | we32k-* \
- | x86-* | x86_64-* | xc16x-* | xps100-* \
- | xstormy16-* | xtensa*-* \
- | ymp-* \
- | z8k-* | z80-*)
- ;;
- # Recognize the basic CPU types without company name, with glob match.
- xtensa*)
- basic_machine=$basic_machine-unknown
- ;;
- # Recognize the various machine names and aliases which stand
- # for a CPU type and a company and sometimes even an OS.
- 386bsd)
- basic_machine=i386-unknown
- os=-bsd
- ;;
- 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
- basic_machine=m68000-att
- ;;
- 3b*)
- basic_machine=we32k-att
- ;;
- a29khif)
- basic_machine=a29k-amd
- os=-udi
- ;;
- abacus)
- basic_machine=abacus-unknown
- ;;
- adobe68k)
- basic_machine=m68010-adobe
- os=-scout
- ;;
- alliant | fx80)
- basic_machine=fx80-alliant
- ;;
- altos | altos3068)
- basic_machine=m68k-altos
- ;;
- am29k)
- basic_machine=a29k-none
- os=-bsd
- ;;
- amd64)
- basic_machine=x86_64-pc
- ;;
- amd64-*)
- basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- amdahl)
- basic_machine=580-amdahl
- os=-sysv
- ;;
- amiga | amiga-*)
- basic_machine=m68k-unknown
- ;;
- amigaos | amigados)
- basic_machine=m68k-unknown
- os=-amigaos
- ;;
- amigaunix | amix)
- basic_machine=m68k-unknown
- os=-sysv4
- ;;
- apollo68)
- basic_machine=m68k-apollo
- os=-sysv
- ;;
- apollo68bsd)
- basic_machine=m68k-apollo
- os=-bsd
- ;;
- aros)
- basic_machine=i386-pc
- os=-aros
- ;;
- aux)
- basic_machine=m68k-apple
- os=-aux
- ;;
- balance)
- basic_machine=ns32k-sequent
- os=-dynix
- ;;
- blackfin)
- basic_machine=bfin-unknown
- os=-linux
- ;;
- blackfin-*)
- basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- bluegene*)
- basic_machine=powerpc-ibm
- os=-cnk
- ;;
- c54x-*)
- basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c55x-*)
- basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c6x-*)
- basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c90)
- basic_machine=c90-cray
- os=-unicos
- ;;
- cegcc)
- basic_machine=arm-unknown
- os=-cegcc
- ;;
- convex-c1)
- basic_machine=c1-convex
- os=-bsd
- ;;
- convex-c2)
- basic_machine=c2-convex
- os=-bsd
- ;;
- convex-c32)
- basic_machine=c32-convex
- os=-bsd
- ;;
- convex-c34)
- basic_machine=c34-convex
- os=-bsd
- ;;
- convex-c38)
- basic_machine=c38-convex
- os=-bsd
- ;;
- cray | j90)
- basic_machine=j90-cray
- os=-unicos
- ;;
- craynv)
- basic_machine=craynv-cray
- os=-unicosmp
- ;;
- cr16 | cr16-*)
- basic_machine=cr16-unknown
- os=-elf
- ;;
- crds | unos)
- basic_machine=m68k-crds
- ;;
- crisv32 | crisv32-* | etraxfs*)
- basic_machine=crisv32-axis
- ;;
- cris | cris-* | etrax*)
- basic_machine=cris-axis
- ;;
- crx)
- basic_machine=crx-unknown
- os=-elf
- ;;
- da30 | da30-*)
- basic_machine=m68k-da30
- ;;
- decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
- basic_machine=mips-dec
- ;;
- decsystem10* | dec10*)
- basic_machine=pdp10-dec
- os=-tops10
- ;;
- decsystem20* | dec20*)
- basic_machine=pdp10-dec
- os=-tops20
- ;;
- delta | 3300 | motorola-3300 | motorola-delta \
- | 3300-motorola | delta-motorola)
- basic_machine=m68k-motorola
- ;;
- delta88)
- basic_machine=m88k-motorola
- os=-sysv3
- ;;
- dicos)
- basic_machine=i686-pc
- os=-dicos
- ;;
- djgpp)
- basic_machine=i586-pc
- os=-msdosdjgpp
- ;;
- dpx20 | dpx20-*)
- basic_machine=rs6000-bull
- os=-bosx
- ;;
- dpx2* | dpx2*-bull)
- basic_machine=m68k-bull
- os=-sysv3
- ;;
- ebmon29k)
- basic_machine=a29k-amd
- os=-ebmon
- ;;
- elxsi)
- basic_machine=elxsi-elxsi
- os=-bsd
- ;;
- encore | umax | mmax)
- basic_machine=ns32k-encore
- ;;
- es1800 | OSE68k | ose68k | ose | OSE)
- basic_machine=m68k-ericsson
- os=-ose
- ;;
- fx2800)
- basic_machine=i860-alliant
- ;;
- genix)
- basic_machine=ns32k-ns
- ;;
- gmicro)
- basic_machine=tron-gmicro
- os=-sysv
- ;;
- go32)
- basic_machine=i386-pc
- os=-go32
- ;;
- h3050r* | hiux*)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- h8300hms)
- basic_machine=h8300-hitachi
- os=-hms
- ;;
- h8300xray)
- basic_machine=h8300-hitachi
- os=-xray
- ;;
- h8500hms)
- basic_machine=h8500-hitachi
- os=-hms
- ;;
- harris)
- basic_machine=m88k-harris
- os=-sysv3
- ;;
- hp300-*)
- basic_machine=m68k-hp
- ;;
- hp300bsd)
- basic_machine=m68k-hp
- os=-bsd
- ;;
- hp300hpux)
- basic_machine=m68k-hp
- os=-hpux
- ;;
- hp3k9[0-9][0-9] | hp9[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k2[0-9][0-9] | hp9k31[0-9])
- basic_machine=m68000-hp
- ;;
- hp9k3[2-9][0-9])
- basic_machine=m68k-hp
- ;;
- hp9k6[0-9][0-9] | hp6[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hp9k7[0-79][0-9] | hp7[0-79][0-9])
- basic_machine=hppa1.1-hp
- ;;
- hp9k78[0-9] | hp78[0-9])
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
- # FIXME: really hppa2.0-hp
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][13679] | hp8[0-9][13679])
- basic_machine=hppa1.1-hp
- ;;
- hp9k8[0-9][0-9] | hp8[0-9][0-9])
- basic_machine=hppa1.0-hp
- ;;
- hppa-next)
- os=-nextstep3
- ;;
- hppaosf)
- basic_machine=hppa1.1-hp
- os=-osf
- ;;
- hppro)
- basic_machine=hppa1.1-hp
- os=-proelf
- ;;
- i370-ibm* | ibm*)
- basic_machine=i370-ibm
- ;;
- i*86v32)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv32
- ;;
- i*86v4*)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv4
- ;;
- i*86v)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-sysv
- ;;
- i*86sol2)
- basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
- os=-solaris2
- ;;
- i386mach)
- basic_machine=i386-mach
- os=-mach
- ;;
- i386-vsta | vsta)
- basic_machine=i386-unknown
- os=-vsta
- ;;
- iris | iris4d)
- basic_machine=mips-sgi
- case $os in
- -irix*)
- ;;
- *)
- os=-irix4
- ;;
- esac
- ;;
- isi68 | isi)
- basic_machine=m68k-isi
- os=-sysv
- ;;
- m68knommu)
- basic_machine=m68k-unknown
- os=-linux
- ;;
- m68knommu-*)
- basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- m88k-omron*)
- basic_machine=m88k-omron
- ;;
- magnum | m3230)
- basic_machine=mips-mips
- os=-sysv
- ;;
- merlin)
- basic_machine=ns32k-utek
- os=-sysv
- ;;
- microblaze*)
- basic_machine=microblaze-xilinx
- ;;
- mingw64)
- basic_machine=x86_64-pc
- os=-mingw64
- ;;
- mingw32)
- basic_machine=i686-pc
- os=-mingw32
- ;;
- mingw32ce)
- basic_machine=arm-unknown
- os=-mingw32ce
- ;;
- miniframe)
- basic_machine=m68000-convergent
- ;;
- *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
- basic_machine=m68k-atari
- os=-mint
- ;;
- mips3*-*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
- ;;
- mips3*)
- basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
- ;;
- monitor)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- morphos)
- basic_machine=powerpc-unknown
- os=-morphos
- ;;
- msdos)
- basic_machine=i386-pc
- os=-msdos
- ;;
- ms1-*)
- basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
- ;;
- msys)
- basic_machine=i686-pc
- os=-msys
- ;;
- mvs)
- basic_machine=i370-ibm
- os=-mvs
- ;;
- nacl)
- basic_machine=le32-unknown
- os=-nacl
- ;;
- ncr3000)
- basic_machine=i486-ncr
- os=-sysv4
- ;;
- netbsd386)
- basic_machine=i386-unknown
- os=-netbsd
- ;;
- netwinder)
- basic_machine=armv4l-rebel
- os=-linux
- ;;
- news | news700 | news800 | news900)
- basic_machine=m68k-sony
- os=-newsos
- ;;
- news1000)
- basic_machine=m68030-sony
- os=-newsos
- ;;
- news-3600 | risc-news)
- basic_machine=mips-sony
- os=-newsos
- ;;
- necv70)
- basic_machine=v70-nec
- os=-sysv
- ;;
- next | m*-next )
- basic_machine=m68k-next
- case $os in
- -nextstep* )
- ;;
- -ns2*)
- os=-nextstep2
- ;;
- *)
- os=-nextstep3
- ;;
- esac
- ;;
- nh3000)
- basic_machine=m68k-harris
- os=-cxux
- ;;
- nh[45]000)
- basic_machine=m88k-harris
- os=-cxux
- ;;
- nindy960)
- basic_machine=i960-intel
- os=-nindy
- ;;
- mon960)
- basic_machine=i960-intel
- os=-mon960
- ;;
- nonstopux)
- basic_machine=mips-compaq
- os=-nonstopux
- ;;
- np1)
- basic_machine=np1-gould
- ;;
- neo-tandem)
- basic_machine=neo-tandem
- ;;
- nse-tandem)
- basic_machine=nse-tandem
- ;;
- nsr-tandem)
- basic_machine=nsr-tandem
- ;;
- op50n-* | op60c-*)
- basic_machine=hppa1.1-oki
- os=-proelf
- ;;
- openrisc | openrisc-*)
- basic_machine=or32-unknown
- ;;
- os400)
- basic_machine=powerpc-ibm
- os=-os400
- ;;
- OSE68000 | ose68000)
- basic_machine=m68000-ericsson
- os=-ose
- ;;
- os68k)
- basic_machine=m68k-none
- os=-os68k
- ;;
- pa-hitachi)
- basic_machine=hppa1.1-hitachi
- os=-hiuxwe2
- ;;
- paragon)
- basic_machine=i860-intel
- os=-osf
- ;;
- parisc)
- basic_machine=hppa-unknown
- os=-linux
- ;;
- parisc-*)
- basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'`
- os=-linux
- ;;
- pbd)
- basic_machine=sparc-tti
- ;;
- pbb)
- basic_machine=m68k-tti
- ;;
- pc532 | pc532-*)
- basic_machine=ns32k-pc532
- ;;
- pc98)
- basic_machine=i386-pc
- ;;
- pc98-*)
- basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentium | p5 | k5 | k6 | nexgen | viac3)
- basic_machine=i586-pc
- ;;
- pentiumpro | p6 | 6x86 | athlon | athlon_*)
- basic_machine=i686-pc
- ;;
- pentiumii | pentium2 | pentiumiii | pentium3)
- basic_machine=i686-pc
- ;;
- pentium4)
- basic_machine=i786-pc
- ;;
- pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
- basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumpro-* | p6-* | 6x86-* | athlon-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
- basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pentium4-*)
- basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- pn)
- basic_machine=pn-gould
- ;;
- power) basic_machine=power-ibm
- ;;
- ppc | ppcbe) basic_machine=powerpc-unknown
- ;;
- ppc-* | ppcbe-*)
- basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppcle | powerpclittle | ppc-le | powerpc-little)
- basic_machine=powerpcle-unknown
- ;;
- ppcle-* | powerpclittle-*)
- basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64) basic_machine=powerpc64-unknown
- ;;
- ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ppc64le | powerpc64little | ppc64-le | powerpc64-little)
- basic_machine=powerpc64le-unknown
- ;;
- ppc64le-* | powerpc64little-*)
- basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- ps2)
- basic_machine=i386-ibm
- ;;
- pw32)
- basic_machine=i586-unknown
- os=-pw32
- ;;
- rdos | rdos64)
- basic_machine=x86_64-pc
- os=-rdos
- ;;
- rdos32)
- basic_machine=i386-pc
- os=-rdos
- ;;
- rom68k)
- basic_machine=m68k-rom68k
- os=-coff
- ;;
- rm[46]00)
- basic_machine=mips-siemens
- ;;
- rtpc | rtpc-*)
- basic_machine=romp-ibm
- ;;
- s390 | s390-*)
- basic_machine=s390-ibm
- ;;
- s390x | s390x-*)
- basic_machine=s390x-ibm
- ;;
- sa29200)
- basic_machine=a29k-amd
- os=-udi
- ;;
- sb1)
- basic_machine=mipsisa64sb1-unknown
- ;;
- sb1el)
- basic_machine=mipsisa64sb1el-unknown
- ;;
- sde)
- basic_machine=mipsisa32-sde
- os=-elf
- ;;
- sei)
- basic_machine=mips-sei
- os=-seiux
- ;;
- sequent)
- basic_machine=i386-sequent
- ;;
- sh)
- basic_machine=sh-hitachi
- os=-hms
- ;;
- sh5el)
- basic_machine=sh5le-unknown
- ;;
- sh64)
- basic_machine=sh64-unknown
- ;;
- sparclite-wrs | simso-wrs)
- basic_machine=sparclite-wrs
- os=-vxworks
- ;;
- sps7)
- basic_machine=m68k-bull
- os=-sysv2
- ;;
- spur)
- basic_machine=spur-unknown
- ;;
- st2000)
- basic_machine=m68k-tandem
- ;;
- stratus)
- basic_machine=i860-stratus
- os=-sysv4
- ;;
- strongarm-* | thumb-*)
- basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- sun2)
- basic_machine=m68000-sun
- ;;
- sun2os3)
- basic_machine=m68000-sun
- os=-sunos3
- ;;
- sun2os4)
- basic_machine=m68000-sun
- os=-sunos4
- ;;
- sun3os3)
- basic_machine=m68k-sun
- os=-sunos3
- ;;
- sun3os4)
- basic_machine=m68k-sun
- os=-sunos4
- ;;
- sun4os3)
- basic_machine=sparc-sun
- os=-sunos3
- ;;
- sun4os4)
- basic_machine=sparc-sun
- os=-sunos4
- ;;
- sun4sol2)
- basic_machine=sparc-sun
- os=-solaris2
- ;;
- sun3 | sun3-*)
- basic_machine=m68k-sun
- ;;
- sun4)
- basic_machine=sparc-sun
- ;;
- sun386 | sun386i | roadrunner)
- basic_machine=i386-sun
- ;;
- sv1)
- basic_machine=sv1-cray
- os=-unicos
- ;;
- symmetry)
- basic_machine=i386-sequent
- os=-dynix
- ;;
- t3e)
- basic_machine=alphaev5-cray
- os=-unicos
- ;;
- t90)
- basic_machine=t90-cray
- os=-unicos
- ;;
- tile*)
- basic_machine=$basic_machine-unknown
- os=-linux-gnu
- ;;
- tx39)
- basic_machine=mipstx39-unknown
- ;;
- tx39el)
- basic_machine=mipstx39el-unknown
- ;;
- toad1)
- basic_machine=pdp10-xkl
- os=-tops20
- ;;
- tower | tower-32)
- basic_machine=m68k-ncr
- ;;
- tpf)
- basic_machine=s390x-ibm
- os=-tpf
- ;;
- udi29k)
- basic_machine=a29k-amd
- os=-udi
- ;;
- ultra3)
- basic_machine=a29k-nyu
- os=-sym1
- ;;
- v810 | necv810)
- basic_machine=v810-nec
- os=-none
- ;;
- vaxv)
- basic_machine=vax-dec
- os=-sysv
- ;;
- vms)
- basic_machine=vax-dec
- os=-vms
- ;;
- vpp*|vx|vx-*)
- basic_machine=f301-fujitsu
- ;;
- vxworks960)
- basic_machine=i960-wrs
- os=-vxworks
- ;;
- vxworks68)
- basic_machine=m68k-wrs
- os=-vxworks
- ;;
- vxworks29k)
- basic_machine=a29k-wrs
- os=-vxworks
- ;;
- w65*)
- basic_machine=w65-wdc
- os=-none
- ;;
- w89k-*)
- basic_machine=hppa1.1-winbond
- os=-proelf
- ;;
- xbox)
- basic_machine=i686-pc
- os=-mingw32
- ;;
- xps | xps100)
- basic_machine=xps100-honeywell
- ;;
- xscale-* | xscalee[bl]-*)
- basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
- ;;
- ymp)
- basic_machine=ymp-cray
- os=-unicos
- ;;
- z8k-*-coff)
- basic_machine=z8k-unknown
- os=-sim
- ;;
- z80-*-coff)
- basic_machine=z80-unknown
- os=-sim
- ;;
- none)
- basic_machine=none-none
- os=-none
- ;;
-
-# Here we handle the default manufacturer of certain CPU types. It is in
-# some cases the only manufacturer, in others, it is the most popular.
- w89k)
- basic_machine=hppa1.1-winbond
- ;;
- op50n)
- basic_machine=hppa1.1-oki
- ;;
- op60c)
- basic_machine=hppa1.1-oki
- ;;
- romp)
- basic_machine=romp-ibm
- ;;
- mmix)
- basic_machine=mmix-knuth
- ;;
- rs6000)
- basic_machine=rs6000-ibm
- ;;
- vax)
- basic_machine=vax-dec
- ;;
- pdp10)
- # there are many clones, so DEC is not a safe bet
- basic_machine=pdp10-unknown
- ;;
- pdp11)
- basic_machine=pdp11-dec
- ;;
- we32k)
- basic_machine=we32k-att
- ;;
- sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
- basic_machine=sh-unknown
- ;;
- sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
- basic_machine=sparc-sun
- ;;
- cydra)
- basic_machine=cydra-cydrome
- ;;
- orion)
- basic_machine=orion-highlevel
- ;;
- orion105)
- basic_machine=clipper-highlevel
- ;;
- mac | mpw | mac-mpw)
- basic_machine=m68k-apple
- ;;
- pmac | pmac-mpw)
- basic_machine=powerpc-apple
- ;;
- *-unknown)
- # Make sure to match an already-canonicalized machine name.
- ;;
- *)
- echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
- exit 1
- ;;
-esac
-
-# Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
- *-digital*)
- basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
- ;;
- *-commodore*)
- basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
- ;;
- *)
- ;;
-esac
-
-# Decode manufacturer-specific aliases for certain operating systems.
-
-if [ x"$os" != x"" ]
-then
-case $os in
- # First match some system type aliases
- # that might get confused with valid system types.
- # -solaris* is a basic system type, with this one exception.
- -auroraux)
- os=-auroraux
- ;;
- -solaris1 | -solaris1.*)
- os=`echo $os | sed -e 's|solaris1|sunos4|'`
- ;;
- -solaris)
- os=-solaris2
- ;;
- -svr4*)
- os=-sysv4
- ;;
- -unixware*)
- os=-sysv4.2uw
- ;;
- -gnu/linux*)
- os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
- ;;
- # First accept the basic system types.
- # The portable systems comes first.
- # Each alternative MUST END IN A *, to match a version number.
- # -sysv* is not here because it comes later, after sysvr4.
- -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
- | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
- | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
- | -sym* | -kopensolaris* | -plan9* \
- | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
- | -aos* | -aros* \
- | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
- | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
- | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
- | -bitrig* | -openbsd* | -solidbsd* \
- | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
- | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
- | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
- | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
- | -chorusos* | -chorusrdb* | -cegcc* \
- | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
- | -linux-newlib* | -linux-musl* | -linux-uclibc* \
- | -uxpv* | -beos* | -mpeix* | -udk* \
- | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
- | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
- | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
- | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
- | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
- | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
- | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
- # Remember, each alternative MUST END IN *, to match a version number.
- ;;
- -qnx*)
- case $basic_machine in
- x86-* | i*86-*)
- ;;
- *)
- os=-nto$os
- ;;
- esac
- ;;
- -nto-qnx*)
- ;;
- -nto*)
- os=`echo $os | sed -e 's|nto|nto-qnx|'`
- ;;
- -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
- | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
- | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
- ;;
- -mac*)
- os=`echo $os | sed -e 's|mac|macos|'`
- ;;
- # Apple iOS
- -ios*)
- ;;
- -linux-dietlibc)
- os=-linux-dietlibc
- ;;
- -linux*)
- os=`echo $os | sed -e 's|linux|linux-gnu|'`
- ;;
- -sunos5*)
- os=`echo $os | sed -e 's|sunos5|solaris2|'`
- ;;
- -sunos6*)
- os=`echo $os | sed -e 's|sunos6|solaris3|'`
- ;;
- -opened*)
- os=-openedition
- ;;
- -os400*)
- os=-os400
- ;;
- -wince*)
- os=-wince
- ;;
- -osfrose*)
- os=-osfrose
- ;;
- -osf*)
- os=-osf
- ;;
- -utek*)
- os=-bsd
- ;;
- -dynix*)
- os=-bsd
- ;;
- -acis*)
- os=-aos
- ;;
- -atheos*)
- os=-atheos
- ;;
- -syllable*)
- os=-syllable
- ;;
- -386bsd)
- os=-bsd
- ;;
- -ctix* | -uts*)
- os=-sysv
- ;;
- -nova*)
- os=-rtmk-nova
- ;;
- -ns2 )
- os=-nextstep2
- ;;
- -nsk*)
- os=-nsk
- ;;
- # Preserve the version number of sinix5.
- -sinix5.*)
- os=`echo $os | sed -e 's|sinix|sysv|'`
- ;;
- -sinix*)
- os=-sysv4
- ;;
- -tpf*)
- os=-tpf
- ;;
- -triton*)
- os=-sysv3
- ;;
- -oss*)
- os=-sysv3
- ;;
- -svr4)
- os=-sysv4
- ;;
- -svr3)
- os=-sysv3
- ;;
- -sysvr4)
- os=-sysv4
- ;;
- # This must come after -sysvr4.
- -sysv*)
- ;;
- -ose*)
- os=-ose
- ;;
- -es1800*)
- os=-ose
- ;;
- -xenix)
- os=-xenix
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- os=-mint
- ;;
- -aros*)
- os=-aros
- ;;
- -zvmoe)
- os=-zvmoe
- ;;
- -dicos*)
- os=-dicos
- ;;
- -nacl*)
- ;;
- -none)
- ;;
- *)
- # Get rid of the `-' at the beginning of $os.
- os=`echo $os | sed 's/[^-]*-//'`
- echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
- exit 1
- ;;
-esac
-else
-
-# Here we handle the default operating systems that come with various machines.
-# The value should be what the vendor currently ships out the door with their
-# machine or put another way, the most popular os provided with the machine.
-
-# Note that if you're going to try to match "-MANUFACTURER" here (say,
-# "-sun"), then you have to tell the case statement up towards the top
-# that MANUFACTURER isn't an operating system. Otherwise, code above
-# will signal an error saying that MANUFACTURER isn't an operating
-# system, and we'll never get to this point.
-
-case $basic_machine in
- score-*)
- os=-elf
- ;;
- spu-*)
- os=-elf
- ;;
- *-acorn)
- os=-riscix1.2
- ;;
- arm*-rebel)
- os=-linux
- ;;
- arm*-semi)
- os=-aout
- ;;
- c4x-* | tic4x-*)
- os=-coff
- ;;
- c8051-*)
- os=-elf
- ;;
- hexagon-*)
- os=-elf
- ;;
- tic54x-*)
- os=-coff
- ;;
- tic55x-*)
- os=-coff
- ;;
- tic6x-*)
- os=-coff
- ;;
- # This must come before the *-dec entry.
- pdp10-*)
- os=-tops20
- ;;
- pdp11-*)
- os=-none
- ;;
- *-dec | vax-*)
- os=-ultrix4.2
- ;;
- m68*-apollo)
- os=-domain
- ;;
- i386-sun)
- os=-sunos4.0.2
- ;;
- m68000-sun)
- os=-sunos3
- ;;
- m68*-cisco)
- os=-aout
- ;;
- mep-*)
- os=-elf
- ;;
- mips*-cisco)
- os=-elf
- ;;
- mips*-*)
- os=-elf
- ;;
- or32-*)
- os=-coff
- ;;
- *-tti) # must be before sparc entry or we get the wrong os.
- os=-sysv3
- ;;
- sparc-* | *-sun)
- os=-sunos4.1.1
- ;;
- *-be)
- os=-beos
- ;;
- *-haiku)
- os=-haiku
- ;;
- *-ibm)
- os=-aix
- ;;
- *-knuth)
- os=-mmixware
- ;;
- *-wec)
- os=-proelf
- ;;
- *-winbond)
- os=-proelf
- ;;
- *-oki)
- os=-proelf
- ;;
- *-hp)
- os=-hpux
- ;;
- *-hitachi)
- os=-hiux
- ;;
- i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
- os=-sysv
- ;;
- *-cbm)
- os=-amigaos
- ;;
- *-dg)
- os=-dgux
- ;;
- *-dolphin)
- os=-sysv3
- ;;
- m68k-ccur)
- os=-rtu
- ;;
- m88k-omron*)
- os=-luna
- ;;
- *-next )
- os=-nextstep
- ;;
- *-sequent)
- os=-ptx
- ;;
- *-crds)
- os=-unos
- ;;
- *-ns)
- os=-genix
- ;;
- i370-*)
- os=-mvs
- ;;
- *-next)
- os=-nextstep3
- ;;
- *-gould)
- os=-sysv
- ;;
- *-highlevel)
- os=-bsd
- ;;
- *-encore)
- os=-bsd
- ;;
- *-sgi)
- os=-irix
- ;;
- *-siemens)
- os=-sysv4
- ;;
- *-masscomp)
- os=-rtu
- ;;
- f30[01]-fujitsu | f700-fujitsu)
- os=-uxpv
- ;;
- *-rom68k)
- os=-coff
- ;;
- *-*bug)
- os=-coff
- ;;
- *-apple)
- os=-macos
- ;;
- *-atari*)
- os=-mint
- ;;
- *)
- os=-none
- ;;
-esac
-fi
-
-# Here we handle the case where we know the os, and the CPU type, but not the
-# manufacturer. We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
- *-unknown)
- case $os in
- -riscix*)
- vendor=acorn
- ;;
- -sunos*)
- vendor=sun
- ;;
- -cnk*|-aix*)
- vendor=ibm
- ;;
- -beos*)
- vendor=be
- ;;
- -hpux*)
- vendor=hp
- ;;
- -mpeix*)
- vendor=hp
- ;;
- -hiux*)
- vendor=hitachi
- ;;
- -unos*)
- vendor=crds
- ;;
- -dgux*)
- vendor=dg
- ;;
- -luna*)
- vendor=omron
- ;;
- -genix*)
- vendor=ns
- ;;
- -mvs* | -opened*)
- vendor=ibm
- ;;
- -os400*)
- vendor=ibm
- ;;
- -ptx*)
- vendor=sequent
- ;;
- -tpf*)
- vendor=ibm
- ;;
- -vxsim* | -vxworks* | -windiss*)
- vendor=wrs
- ;;
- -aux*)
- vendor=apple
- ;;
- -hms*)
- vendor=hitachi
- ;;
- -mpw* | -macos*)
- vendor=apple
- ;;
- -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
- vendor=atari
- ;;
- -vos*)
- vendor=stratus
- ;;
- esac
- basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
- ;;
-esac
-
-echo $basic_machine$os
-exit
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/memory/jemalloc/src/build-aux/install-sh b/memory/jemalloc/src/build-aux/install-sh
deleted file mode 100755
index ebc66913e9..0000000000
--- a/memory/jemalloc/src/build-aux/install-sh
+++ /dev/null
@@ -1,250 +0,0 @@
-#! /bin/sh
-#
-# install - install a program, script, or datafile
-# This comes from X11R5 (mit/util/scripts/install.sh).
-#
-# Copyright 1991 by the Massachusetts Institute of Technology
-#
-# Permission to use, copy, modify, distribute, and sell this software and its
-# documentation for any purpose is hereby granted without fee, provided that
-# the above copyright notice appear in all copies and that both that
-# copyright notice and this permission notice appear in supporting
-# documentation, and that the name of M.I.T. not be used in advertising or
-# publicity pertaining to distribution of the software without specific,
-# written prior permission. M.I.T. makes no representations about the
-# suitability of this software for any purpose. It is provided "as is"
-# without express or implied warranty.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch. It can only install one file at a time, a restriction
-# shared with many OS's install programs.
-
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-transformbasename=""
-transform_arg=""
-instcmd="$mvprog"
-chmodcmd="$chmodprog 0755"
-chowncmd=""
-chgrpcmd=""
-stripcmd=""
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=""
-dst=""
-dir_arg=""
-
-while [ x"$1" != x ]; do
- case $1 in
- -c) instcmd="$cpprog"
- shift
- continue;;
-
- -d) dir_arg=true
- shift
- continue;;
-
- -m) chmodcmd="$chmodprog $2"
- shift
- shift
- continue;;
-
- -o) chowncmd="$chownprog $2"
- shift
- shift
- continue;;
-
- -g) chgrpcmd="$chgrpprog $2"
- shift
- shift
- continue;;
-
- -s) stripcmd="$stripprog"
- shift
- continue;;
-
- -t=*) transformarg=`echo $1 | sed 's/-t=//'`
- shift
- continue;;
-
- -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
- shift
- continue;;
-
- *) if [ x"$src" = x ]
- then
- src=$1
- else
- # this colon is to work around a 386BSD /bin/sh bug
- :
- dst=$1
- fi
- shift
- continue;;
- esac
-done
-
-if [ x"$src" = x ]
-then
- echo "install: no input file specified"
- exit 1
-else
- true
-fi
-
-if [ x"$dir_arg" != x ]; then
- dst=$src
- src=""
-
- if [ -d $dst ]; then
- instcmd=:
- else
- instcmd=mkdir
- fi
-else
-
-# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
-# might cause directories to be created, which would be especially bad
-# if $src (and thus $dsttmp) contains '*'.
-
- if [ -f $src -o -d $src ]
- then
- true
- else
- echo "install: $src does not exist"
- exit 1
- fi
-
- if [ x"$dst" = x ]
- then
- echo "install: no destination specified"
- exit 1
- else
- true
- fi
-
-# If destination is a directory, append the input filename; if your system
-# does not like double slashes in filenames, you may need to add some logic
-
- if [ -d $dst ]
- then
- dst="$dst"/`basename $src`
- else
- true
- fi
-fi
-
-## this sed command emulates the dirname command
-dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
-
-# Make sure that the destination directory exists.
-# this part is taken from Noah Friedman's mkinstalldirs script
-
-# Skip lots of stat calls in the usual case.
-if [ ! -d "$dstdir" ]; then
-defaultIFS='
-'
-IFS="${IFS-${defaultIFS}}"
-
-oIFS="${IFS}"
-# Some sh's can't handle IFS=/ for some reason.
-IFS='%'
-set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
-IFS="${oIFS}"
-
-pathcomp=''
-
-while [ $# -ne 0 ] ; do
- pathcomp="${pathcomp}${1}"
- shift
-
- if [ ! -d "${pathcomp}" ] ;
- then
- $mkdirprog "${pathcomp}"
- else
- true
- fi
-
- pathcomp="${pathcomp}/"
-done
-fi
-
-if [ x"$dir_arg" != x ]
-then
- $doit $instcmd $dst &&
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
-else
-
-# If we're going to rename the final executable, determine the name now.
-
- if [ x"$transformarg" = x ]
- then
- dstfile=`basename $dst`
- else
- dstfile=`basename $dst $transformbasename |
- sed $transformarg`$transformbasename
- fi
-
-# don't allow the sed command to completely eliminate the filename
-
- if [ x"$dstfile" = x ]
- then
- dstfile=`basename $dst`
- else
- true
- fi
-
-# Make a temp file name in the proper directory.
-
- dsttmp=$dstdir/#inst.$$#
-
-# Move or copy the file name to the temp name
-
- $doit $instcmd $src $dsttmp &&
-
- trap "rm -f ${dsttmp}" 0 &&
-
-# and set any options; do chmod last to preserve setuid bits
-
-# If any of these fail, we abort the whole thing. If we want to
-# ignore errors from any of these, just make sure not to ignore
-# errors from the above "$doit $instcmd $src $dsttmp" command.
-
- if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
- if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
- if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
- if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
-
-# Now rename the file to the real destination.
-
- $doit $rmcmd -f $dstdir/$dstfile &&
- $doit $mvcmd $dsttmp $dstdir/$dstfile
-
-fi &&
-
-
-exit 0
diff --git a/memory/jemalloc/src/configure b/memory/jemalloc/src/configure
deleted file mode 100755
index 2ad9b5a87a..0000000000
--- a/memory/jemalloc/src/configure
+++ /dev/null
@@ -1,10773 +0,0 @@
-#! /bin/sh
-# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69.
-#
-#
-# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
-#
-#
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-## -------------------- ##
-## M4sh Initialization. ##
-## -------------------- ##
-
-# Be more Bourne compatible
-DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
- emulate sh
- NULLCMD=:
- # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in #(
- *posix*) :
- set -o posix ;; #(
- *) :
- ;;
-esac
-fi
-
-
-as_nl='
-'
-export as_nl
-# Printing a long string crashes Solaris 7 /usr/bin/printf.
-as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-# Prefer a ksh shell builtin over an external printf program on Solaris,
-# but without wasting forks for bash or zsh.
-if test -z "$BASH_VERSION$ZSH_VERSION" \
- && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
- as_echo='print -r --'
- as_echo_n='print -rn --'
-elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
- as_echo='printf %s\n'
- as_echo_n='printf %s'
-else
- if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
- as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
- as_echo_n='/usr/ucb/echo -n'
- else
- as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
- as_echo_n_body='eval
- arg=$1;
- case $arg in #(
- *"$as_nl"*)
- expr "X$arg" : "X\\(.*\\)$as_nl";
- arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
- esac;
- expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
- '
- export as_echo_n_body
- as_echo_n='sh -c $as_echo_n_body as_echo'
- fi
- export as_echo_body
- as_echo='sh -c $as_echo_body as_echo'
-fi
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- PATH_SEPARATOR=:
- (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
- (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
- PATH_SEPARATOR=';'
- }
-fi
-
-
-# IFS
-# We need space, tab and new line, in precisely that order. Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-IFS=" "" $as_nl"
-
-# Find who we are. Look in the path if we contain no directory separator.
-as_myself=
-case $0 in #((
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
- done
-IFS=$as_save_IFS
-
- ;;
-esac
-# We did not find ourselves, most probably we were run as `sh COMMAND'
-# in which case we are not to be found in the path.
-if test "x$as_myself" = x; then
- as_myself=$0
-fi
-if test ! -f "$as_myself"; then
- $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
- exit 1
-fi
-
-# Unset variables that we do not need and which cause bugs (e.g. in
-# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
-# suppresses any "Segmentation fault" message there. '((' could
-# trigger a bug in pdksh 5.2.14.
-for as_var in BASH_ENV ENV MAIL MAILPATH
-do eval test x\${$as_var+set} = xset \
- && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
-done
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-LC_ALL=C
-export LC_ALL
-LANGUAGE=C
-export LANGUAGE
-
-# CDPATH.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-# Use a proper internal environment variable to ensure we don't fall
- # into an infinite loop, continuously re-executing ourselves.
- if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
- _as_can_reexec=no; export _as_can_reexec;
- # We cannot yet assume a decent shell, so we have to provide a
-# neutralization value for shells without unset; and this also
-# works around shells that cannot unset nonexistent variables.
-# Preserve -v and -x to the replacement shell.
-BASH_ENV=/dev/null
-ENV=/dev/null
-(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
-case $- in # ((((
- *v*x* | *x*v* ) as_opts=-vx ;;
- *v* ) as_opts=-v ;;
- *x* ) as_opts=-x ;;
- * ) as_opts= ;;
-esac
-exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
-# Admittedly, this is quite paranoid, since all the known shells bail
-# out after a failed `exec'.
-$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
-as_fn_exit 255
- fi
- # We don't want this to propagate to other subprocesses.
- { _as_can_reexec=; unset _as_can_reexec;}
-if test "x$CONFIG_SHELL" = x; then
- as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
- emulate sh
- NULLCMD=:
- # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '\${1+\"\$@\"}'='\"\$@\"'
- setopt NO_GLOB_SUBST
-else
- case \`(set -o) 2>/dev/null\` in #(
- *posix*) :
- set -o posix ;; #(
- *) :
- ;;
-esac
-fi
-"
- as_required="as_fn_return () { (exit \$1); }
-as_fn_success () { as_fn_return 0; }
-as_fn_failure () { as_fn_return 1; }
-as_fn_ret_success () { return 0; }
-as_fn_ret_failure () { return 1; }
-
-exitcode=0
-as_fn_success || { exitcode=1; echo as_fn_success failed.; }
-as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
-as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
-as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
-if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
-
-else
- exitcode=1; echo positional parameters were not saved.
-fi
-test x\$exitcode = x0 || exit 1
-test -x / || exit 1"
- as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
- as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
- eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
- test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
-test \$(( 1 + 1 )) = 2 || exit 1"
- if (eval "$as_required") 2>/dev/null; then :
- as_have_required=yes
-else
- as_have_required=no
-fi
- if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
-
-else
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-as_found=false
-for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- as_found=:
- case $as_dir in #(
- /*)
- for as_base in sh bash ksh sh5; do
- # Try only shells that exist, to save several forks.
- as_shell=$as_dir/$as_base
- if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
- { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
- CONFIG_SHELL=$as_shell as_have_required=yes
- if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
- break 2
-fi
-fi
- done;;
- esac
- as_found=false
-done
-$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
- { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
- CONFIG_SHELL=$SHELL as_have_required=yes
-fi; }
-IFS=$as_save_IFS
-
-
- if test "x$CONFIG_SHELL" != x; then :
- export CONFIG_SHELL
- # We cannot yet assume a decent shell, so we have to provide a
-# neutralization value for shells without unset; and this also
-# works around shells that cannot unset nonexistent variables.
-# Preserve -v and -x to the replacement shell.
-BASH_ENV=/dev/null
-ENV=/dev/null
-(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
-case $- in # ((((
- *v*x* | *x*v* ) as_opts=-vx ;;
- *v* ) as_opts=-v ;;
- *x* ) as_opts=-x ;;
- * ) as_opts= ;;
-esac
-exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
-# Admittedly, this is quite paranoid, since all the known shells bail
-# out after a failed `exec'.
-$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
-exit 255
-fi
-
- if test x$as_have_required = xno; then :
- $as_echo "$0: This script requires a shell more modern than all"
- $as_echo "$0: the shells that I found on your system."
- if test x${ZSH_VERSION+set} = xset ; then
- $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
- $as_echo "$0: be upgraded to zsh 4.3.4 or later."
- else
- $as_echo "$0: Please tell bug-autoconf@gnu.org about your system,
-$0: including any error possibly output before this
-$0: message. Then install a modern shell, or manually run
-$0: the script under such a shell if you do have one."
- fi
- exit 1
-fi
-fi
-fi
-SHELL=${CONFIG_SHELL-/bin/sh}
-export SHELL
-# Unset more variables known to interfere with behavior of common tools.
-CLICOLOR_FORCE= GREP_OPTIONS=
-unset CLICOLOR_FORCE GREP_OPTIONS
-
-## --------------------- ##
-## M4sh Shell Functions. ##
-## --------------------- ##
-# as_fn_unset VAR
-# ---------------
-# Portably unset VAR.
-as_fn_unset ()
-{
- { eval $1=; unset $1;}
-}
-as_unset=as_fn_unset
-
-# as_fn_set_status STATUS
-# -----------------------
-# Set $? to STATUS, without forking.
-as_fn_set_status ()
-{
- return $1
-} # as_fn_set_status
-
-# as_fn_exit STATUS
-# -----------------
-# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
-as_fn_exit ()
-{
- set +e
- as_fn_set_status $1
- exit $1
-} # as_fn_exit
-
-# as_fn_mkdir_p
-# -------------
-# Create "$as_dir" as a directory, including parents if necessary.
-as_fn_mkdir_p ()
-{
-
- case $as_dir in #(
- -*) as_dir=./$as_dir;;
- esac
- test -d "$as_dir" || eval $as_mkdir_p || {
- as_dirs=
- while :; do
- case $as_dir in #(
- *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
- *) as_qdir=$as_dir;;
- esac
- as_dirs="'$as_qdir' $as_dirs"
- as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- test -d "$as_dir" && break
- done
- test -z "$as_dirs" || eval "mkdir $as_dirs"
- } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
-
-
-} # as_fn_mkdir_p
-
-# as_fn_executable_p FILE
-# -----------------------
-# Test if FILE is an executable regular file.
-as_fn_executable_p ()
-{
- test -f "$1" && test -x "$1"
-} # as_fn_executable_p
-# as_fn_append VAR VALUE
-# ----------------------
-# Append the text in VALUE to the end of the definition contained in VAR. Take
-# advantage of any shell optimizations that allow amortized linear growth over
-# repeated appends, instead of the typical quadratic growth present in naive
-# implementations.
-if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
- eval 'as_fn_append ()
- {
- eval $1+=\$2
- }'
-else
- as_fn_append ()
- {
- eval $1=\$$1\$2
- }
-fi # as_fn_append
-
-# as_fn_arith ARG...
-# ------------------
-# Perform arithmetic evaluation on the ARGs, and store the result in the
-# global $as_val. Take advantage of shells that can avoid forks. The arguments
-# must be portable across $(()) and expr.
-if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
- eval 'as_fn_arith ()
- {
- as_val=$(( $* ))
- }'
-else
- as_fn_arith ()
- {
- as_val=`expr "$@" || test $? -eq 1`
- }
-fi # as_fn_arith
-
-
-# as_fn_error STATUS ERROR [LINENO LOG_FD]
-# ----------------------------------------
-# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
-# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
-# script with STATUS, using 1 if that was 0.
-as_fn_error ()
-{
- as_status=$1; test $as_status -eq 0 && as_status=1
- if test "$4"; then
- as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
- fi
- $as_echo "$as_me: error: $2" >&2
- as_fn_exit $as_status
-} # as_fn_error
-
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
- as_basename=basename
-else
- as_basename=false
-fi
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
- as_dirname=dirname
-else
- as_dirname=false
-fi
-
-as_me=`$as_basename -- "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{
- s//\1/
- q
- }
- /^X\/\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\/\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
-
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-
- as_lineno_1=$LINENO as_lineno_1a=$LINENO
- as_lineno_2=$LINENO as_lineno_2a=$LINENO
- eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
- test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
- # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
- sed -n '
- p
- /[$]LINENO/=
- ' <$as_myself |
- sed '
- s/[$]LINENO.*/&-/
- t lineno
- b
- :lineno
- N
- :loop
- s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
- t loop
- s/-\n.*//
- ' >$as_me.lineno &&
- chmod +x "$as_me.lineno" ||
- { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
-
- # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
- # already done that, so ensure we don't try to do so again and fall
- # in an infinite loop. This has already happened in practice.
- _as_can_reexec=no; export _as_can_reexec
- # Don't try to exec as it changes $[0], causing all sort of problems
- # (the dirname of $[0] is not the place where we might find the
- # original and so on. Autoconf is especially sensitive to this).
- . "./$as_me.lineno"
- # Exit status is that of the last command.
- exit
-}
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in #(((((
--n*)
- case `echo 'xy\c'` in
- *c*) ECHO_T=' ';; # ECHO_T is single tab character.
- xy) ECHO_C='\c';;
- *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
- ECHO_T=' ';;
- esac;;
-*)
- ECHO_N='-n';;
-esac
-
-rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
- rm -f conf$$.dir/conf$$.file
-else
- rm -f conf$$.dir
- mkdir conf$$.dir 2>/dev/null
-fi
-if (echo >conf$$.file) 2>/dev/null; then
- if ln -s conf$$.file conf$$ 2>/dev/null; then
- as_ln_s='ln -s'
- # ... but there are two gotchas:
- # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
- # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -pR'.
- ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
- as_ln_s='cp -pR'
- elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
- else
- as_ln_s='cp -pR'
- fi
-else
- as_ln_s='cp -pR'
-fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
-
-if mkdir -p . 2>/dev/null; then
- as_mkdir_p='mkdir -p "$as_dir"'
-else
- test -d ./-p && rmdir ./-p
- as_mkdir_p=false
-fi
-
-as_test_x='test -x'
-as_executable_p=as_fn_executable_p
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-test -n "$DJDIR" || exec 7<&0 </dev/null
-exec 6>&1
-
-# Name of the host.
-# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
-# so uname gets run too.
-ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
-
-#
-# Initializations.
-#
-ac_default_prefix=/usr/local
-ac_clean_files=
-ac_config_libobj_dir=.
-LIBOBJS=
-cross_compiling=no
-subdirs=
-MFLAGS=
-MAKEFLAGS=
-
-# Identity of this package.
-PACKAGE_NAME=
-PACKAGE_TARNAME=
-PACKAGE_VERSION=
-PACKAGE_STRING=
-PACKAGE_BUGREPORT=
-PACKAGE_URL=
-
-ac_unique_file="Makefile.in"
-# Factoring default headers for most tests.
-ac_includes_default="\
-#include <stdio.h>
-#ifdef HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#ifdef STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#else
-# ifdef HAVE_STDLIB_H
-# include <stdlib.h>
-# endif
-#endif
-#ifdef HAVE_STRING_H
-# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
-# include <memory.h>
-# endif
-# include <string.h>
-#endif
-#ifdef HAVE_STRINGS_H
-# include <strings.h>
-#endif
-#ifdef HAVE_INTTYPES_H
-# include <inttypes.h>
-#endif
-#ifdef HAVE_STDINT_H
-# include <stdint.h>
-#endif
-#ifdef HAVE_UNISTD_H
-# include <unistd.h>
-#endif"
-
-ac_subst_vars='LTLIBOBJS
-LIBOBJS
-cfgoutputs_out
-cfgoutputs_in
-cfghdrs_out
-cfghdrs_in
-enable_zone_allocator
-enable_tls
-enable_lazy_lock
-jemalloc_version_gid
-jemalloc_version_nrev
-jemalloc_version_bugfix
-jemalloc_version_minor
-jemalloc_version_major
-jemalloc_version
-enable_cache_oblivious
-enable_xmalloc
-enable_valgrind
-enable_utrace
-enable_fill
-enable_munmap
-enable_tcache
-enable_prof
-enable_stats
-enable_debug
-je_
-install_suffix
-private_namespace
-JEMALLOC_CPREFIX
-enable_code_coverage
-AUTOCONF
-LD
-RANLIB
-INSTALL_DATA
-INSTALL_SCRIPT
-INSTALL_PROGRAM
-enable_autogen
-RPATH_EXTRA
-LM
-CC_MM
-AROUT
-ARFLAGS
-MKLIB
-TEST_LD_MODE
-LDTARGET
-CTARGET
-PIC_CFLAGS
-SOREV
-EXTRA_LDFLAGS
-DSO_LDFLAGS
-link_whole_archive
-libprefix
-exe
-a
-o
-importlib
-so
-LD_PRELOAD_VAR
-RPATH
-abi
-AR
-host_os
-host_vendor
-host_cpu
-host
-build_os
-build_vendor
-build_cpu
-build
-EGREP
-GREP
-CPP
-EXTRA_CFLAGS
-OBJEXT
-EXEEXT
-ac_ct_CC
-CPPFLAGS
-LDFLAGS
-CFLAGS
-CC
-XSLROOT
-XSLTPROC
-MANDIR
-DATADIR
-LIBDIR
-INCLUDEDIR
-BINDIR
-PREFIX
-abs_objroot
-objroot
-abs_srcroot
-srcroot
-rev
-CONFIG
-target_alias
-host_alias
-build_alias
-LIBS
-ECHO_T
-ECHO_N
-ECHO_C
-DEFS
-mandir
-localedir
-libdir
-psdir
-pdfdir
-dvidir
-htmldir
-infodir
-docdir
-oldincludedir
-includedir
-runstatedir
-localstatedir
-sharedstatedir
-sysconfdir
-datadir
-datarootdir
-libexecdir
-sbindir
-bindir
-program_transform_name
-prefix
-exec_prefix
-PACKAGE_URL
-PACKAGE_BUGREPORT
-PACKAGE_STRING
-PACKAGE_VERSION
-PACKAGE_TARNAME
-PACKAGE_NAME
-PATH_SEPARATOR
-SHELL'
-ac_subst_files=''
-ac_user_opts='
-enable_option_checking
-with_xslroot
-with_rpath
-enable_autogen
-enable_code_coverage
-with_mangling
-with_jemalloc_prefix
-with_export
-with_private_namespace
-with_install_suffix
-with_malloc_conf
-enable_cc_silence
-enable_debug
-enable_ivsalloc
-enable_stats
-enable_prof
-enable_prof_libunwind
-with_static_libunwind
-enable_prof_libgcc
-enable_prof_gcc
-enable_tcache
-enable_munmap
-enable_fill
-enable_utrace
-enable_valgrind
-enable_xmalloc
-enable_cache_oblivious
-with_lg_tiny_min
-with_lg_quantum
-with_lg_page
-with_lg_page_sizes
-with_lg_size_class_group
-with_version
-enable_lazy_lock
-enable_tls
-enable_zone_allocator
-'
- ac_precious_vars='build_alias
-host_alias
-target_alias
-CC
-CFLAGS
-LDFLAGS
-LIBS
-CPPFLAGS
-CPP'
-
-
-# Initialize some variables set by options.
-ac_init_help=
-ac_init_version=false
-ac_unrecognized_opts=
-ac_unrecognized_sep=
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-cache_file=/dev/null
-exec_prefix=NONE
-no_create=
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-verbose=
-x_includes=NONE
-x_libraries=NONE
-
-# Installation directory options.
-# These are left unexpanded so users can "make install exec_prefix=/foo"
-# and all the variables that are supposed to be based on exec_prefix
-# by default will actually change.
-# Use braces instead of parens because sh, perl, etc. also accept them.
-# (The list follows the same order as the GNU Coding Standards.)
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datarootdir='${prefix}/share'
-datadir='${datarootdir}'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-runstatedir='${localstatedir}/run'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-docdir='${datarootdir}/doc/${PACKAGE}'
-infodir='${datarootdir}/info'
-htmldir='${docdir}'
-dvidir='${docdir}'
-pdfdir='${docdir}'
-psdir='${docdir}'
-libdir='${exec_prefix}/lib'
-localedir='${datarootdir}/locale'
-mandir='${datarootdir}/man'
-
-ac_prev=
-ac_dashdash=
-for ac_option
-do
- # If the previous option needs an argument, assign it.
- if test -n "$ac_prev"; then
- eval $ac_prev=\$ac_option
- ac_prev=
- continue
- fi
-
- case $ac_option in
- *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
- *=) ac_optarg= ;;
- *) ac_optarg=yes ;;
- esac
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case $ac_dashdash$ac_option in
- --)
- ac_dashdash=yes ;;
-
- -bindir | --bindir | --bindi | --bind | --bin | --bi)
- ac_prev=bindir ;;
- -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
- bindir=$ac_optarg ;;
-
- -build | --build | --buil | --bui | --bu)
- ac_prev=build_alias ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build_alias=$ac_optarg ;;
-
- -cache-file | --cache-file | --cache-fil | --cache-fi \
- | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
- ac_prev=cache_file ;;
- -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
- | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
- cache_file=$ac_optarg ;;
-
- --config-cache | -C)
- cache_file=config.cache ;;
-
- -datadir | --datadir | --datadi | --datad)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=*)
- datadir=$ac_optarg ;;
-
- -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
- | --dataroo | --dataro | --datar)
- ac_prev=datarootdir ;;
- -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
- | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
- datarootdir=$ac_optarg ;;
-
- -disable-* | --disable-*)
- ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- as_fn_error $? "invalid feature name: $ac_useropt"
- ac_useropt_orig=$ac_useropt
- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
- case $ac_user_opts in
- *"
-"enable_$ac_useropt"
-"*) ;;
- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
- ac_unrecognized_sep=', ';;
- esac
- eval enable_$ac_useropt=no ;;
-
- -docdir | --docdir | --docdi | --doc | --do)
- ac_prev=docdir ;;
- -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
- docdir=$ac_optarg ;;
-
- -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
- ac_prev=dvidir ;;
- -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
- dvidir=$ac_optarg ;;
-
- -enable-* | --enable-*)
- ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- as_fn_error $? "invalid feature name: $ac_useropt"
- ac_useropt_orig=$ac_useropt
- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
- case $ac_user_opts in
- *"
-"enable_$ac_useropt"
-"*) ;;
- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
- ac_unrecognized_sep=', ';;
- esac
- eval enable_$ac_useropt=\$ac_optarg ;;
-
- -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
- | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
- | --exec | --exe | --ex)
- ac_prev=exec_prefix ;;
- -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
- | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
- | --exec=* | --exe=* | --ex=*)
- exec_prefix=$ac_optarg ;;
-
- -gas | --gas | --ga | --g)
- # Obsolete; use --with-gas.
- with_gas=yes ;;
-
- -help | --help | --hel | --he | -h)
- ac_init_help=long ;;
- -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
- ac_init_help=recursive ;;
- -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
- ac_init_help=short ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host_alias ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host_alias=$ac_optarg ;;
-
- -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
- ac_prev=htmldir ;;
- -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
- | --ht=*)
- htmldir=$ac_optarg ;;
-
- -includedir | --includedir | --includedi | --included | --include \
- | --includ | --inclu | --incl | --inc)
- ac_prev=includedir ;;
- -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
- | --includ=* | --inclu=* | --incl=* | --inc=*)
- includedir=$ac_optarg ;;
-
- -infodir | --infodir | --infodi | --infod | --info | --inf)
- ac_prev=infodir ;;
- -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
- infodir=$ac_optarg ;;
-
- -libdir | --libdir | --libdi | --libd)
- ac_prev=libdir ;;
- -libdir=* | --libdir=* | --libdi=* | --libd=*)
- libdir=$ac_optarg ;;
-
- -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
- | --libexe | --libex | --libe)
- ac_prev=libexecdir ;;
- -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
- | --libexe=* | --libex=* | --libe=*)
- libexecdir=$ac_optarg ;;
-
- -localedir | --localedir | --localedi | --localed | --locale)
- ac_prev=localedir ;;
- -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
- localedir=$ac_optarg ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst | --locals)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
- localstatedir=$ac_optarg ;;
-
- -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
- ac_prev=mandir ;;
- -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
- mandir=$ac_optarg ;;
-
- -nfp | --nfp | --nf)
- # Obsolete; use --without-fp.
- with_fp=no ;;
-
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c | -n)
- no_create=yes ;;
-
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
- no_recursion=yes ;;
-
- -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
- | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
- | --oldin | --oldi | --old | --ol | --o)
- ac_prev=oldincludedir ;;
- -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
- | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
- | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
- oldincludedir=$ac_optarg ;;
-
- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
- ac_prev=prefix ;;
- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix=$ac_optarg ;;
-
- -program-prefix | --program-prefix | --program-prefi | --program-pref \
- | --program-pre | --program-pr | --program-p)
- ac_prev=program_prefix ;;
- -program-prefix=* | --program-prefix=* | --program-prefi=* \
- | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
- program_prefix=$ac_optarg ;;
-
- -program-suffix | --program-suffix | --program-suffi | --program-suff \
- | --program-suf | --program-su | --program-s)
- ac_prev=program_suffix ;;
- -program-suffix=* | --program-suffix=* | --program-suffi=* \
- | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
- program_suffix=$ac_optarg ;;
-
- -program-transform-name | --program-transform-name \
- | --program-transform-nam | --program-transform-na \
- | --program-transform-n | --program-transform- \
- | --program-transform | --program-transfor \
- | --program-transfo | --program-transf \
- | --program-trans | --program-tran \
- | --progr-tra | --program-tr | --program-t)
- ac_prev=program_transform_name ;;
- -program-transform-name=* | --program-transform-name=* \
- | --program-transform-nam=* | --program-transform-na=* \
- | --program-transform-n=* | --program-transform-=* \
- | --program-transform=* | --program-transfor=* \
- | --program-transfo=* | --program-transf=* \
- | --program-trans=* | --program-tran=* \
- | --progr-tra=* | --program-tr=* | --program-t=*)
- program_transform_name=$ac_optarg ;;
-
- -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
- ac_prev=pdfdir ;;
- -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
- pdfdir=$ac_optarg ;;
-
- -psdir | --psdir | --psdi | --psd | --ps)
- ac_prev=psdir ;;
- -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
- psdir=$ac_optarg ;;
-
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- silent=yes ;;
-
- -runstatedir | --runstatedir | --runstatedi | --runstated \
- | --runstate | --runstat | --runsta | --runst | --runs \
- | --run | --ru | --r)
- ac_prev=runstatedir ;;
- -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
- | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
- | --run=* | --ru=* | --r=*)
- runstatedir=$ac_optarg ;;
-
- -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
- ac_prev=sbindir ;;
- -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
- | --sbi=* | --sb=*)
- sbindir=$ac_optarg ;;
-
- -sharedstatedir | --sharedstatedir | --sharedstatedi \
- | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
- | --sharedst | --shareds | --shared | --share | --shar \
- | --sha | --sh)
- ac_prev=sharedstatedir ;;
- -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
- | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
- | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
- | --sha=* | --sh=*)
- sharedstatedir=$ac_optarg ;;
-
- -site | --site | --sit)
- ac_prev=site ;;
- -site=* | --site=* | --sit=*)
- site=$ac_optarg ;;
-
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- srcdir=$ac_optarg ;;
-
- -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
- | --syscon | --sysco | --sysc | --sys | --sy)
- ac_prev=sysconfdir ;;
- -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
- | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
- sysconfdir=$ac_optarg ;;
-
- -target | --target | --targe | --targ | --tar | --ta | --t)
- ac_prev=target_alias ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target_alias=$ac_optarg ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers | -V)
- ac_init_version=: ;;
-
- -with-* | --with-*)
- ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- as_fn_error $? "invalid package name: $ac_useropt"
- ac_useropt_orig=$ac_useropt
- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
- case $ac_user_opts in
- *"
-"with_$ac_useropt"
-"*) ;;
- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
- ac_unrecognized_sep=', ';;
- esac
- eval with_$ac_useropt=\$ac_optarg ;;
-
- -without-* | --without-*)
- ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
- # Reject names that are not valid shell variable names.
- expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- as_fn_error $? "invalid package name: $ac_useropt"
- ac_useropt_orig=$ac_useropt
- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
- case $ac_user_opts in
- *"
-"with_$ac_useropt"
-"*) ;;
- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
- ac_unrecognized_sep=', ';;
- esac
- eval with_$ac_useropt=no ;;
-
- --x)
- # Obsolete; use --with-x.
- with_x=yes ;;
-
- -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
- | --x-incl | --x-inc | --x-in | --x-i)
- ac_prev=x_includes ;;
- -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
- | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
- x_includes=$ac_optarg ;;
-
- -x-libraries | --x-libraries | --x-librarie | --x-librari \
- | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
- ac_prev=x_libraries ;;
- -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
- | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
- x_libraries=$ac_optarg ;;
-
- -*) as_fn_error $? "unrecognized option: \`$ac_option'
-Try \`$0 --help' for more information"
- ;;
-
- *=*)
- ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
- # Reject names that are not valid shell variable names.
- case $ac_envvar in #(
- '' | [0-9]* | *[!_$as_cr_alnum]* )
- as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
- esac
- eval $ac_envvar=\$ac_optarg
- export $ac_envvar ;;
-
- *)
- # FIXME: should be removed in autoconf 3.0.
- $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
- expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
- $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
- : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- ac_option=--`echo $ac_prev | sed 's/_/-/g'`
- as_fn_error $? "missing argument to $ac_option"
-fi
-
-if test -n "$ac_unrecognized_opts"; then
- case $enable_option_checking in
- no) ;;
- fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
- *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
- esac
-fi
-
-# Check all directory arguments for consistency.
-for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
- datadir sysconfdir sharedstatedir localstatedir includedir \
- oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
- libdir localedir mandir runstatedir
-do
- eval ac_val=\$$ac_var
- # Remove trailing slashes.
- case $ac_val in
- */ )
- ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
- eval $ac_var=\$ac_val;;
- esac
- # Be sure to have absolute directory names.
- case $ac_val in
- [\\/$]* | ?:[\\/]* ) continue;;
- NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
- esac
- as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
-done
-
-# There might be people who depend on the old broken behavior: `$host'
-# used to hold the argument of --host etc.
-# FIXME: To remove some day.
-build=$build_alias
-host=$host_alias
-target=$target_alias
-
-# FIXME: To remove some day.
-if test "x$host_alias" != x; then
- if test "x$build_alias" = x; then
- cross_compiling=maybe
- elif test "x$build_alias" != "x$host_alias"; then
- cross_compiling=yes
- fi
-fi
-
-ac_tool_prefix=
-test -n "$host_alias" && ac_tool_prefix=$host_alias-
-
-test "$silent" = yes && exec 6>/dev/null
-
-
-ac_pwd=`pwd` && test -n "$ac_pwd" &&
-ac_ls_di=`ls -di .` &&
-ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
- as_fn_error $? "working directory cannot be determined"
-test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
- as_fn_error $? "pwd does not report name of working directory"
-
-
-# Find the source files, if location was not specified.
-if test -z "$srcdir"; then
- ac_srcdir_defaulted=yes
- # Try the directory containing this script, then the parent directory.
- ac_confdir=`$as_dirname -- "$as_myself" ||
-$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_myself" : 'X\(//\)[^/]' \| \
- X"$as_myself" : 'X\(//\)$' \| \
- X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_myself" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- srcdir=$ac_confdir
- if test ! -r "$srcdir/$ac_unique_file"; then
- srcdir=..
- fi
-else
- ac_srcdir_defaulted=no
-fi
-if test ! -r "$srcdir/$ac_unique_file"; then
- test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
- as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
-fi
-ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
-ac_abs_confdir=`(
- cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
- pwd)`
-# When building in place, set srcdir=.
-if test "$ac_abs_confdir" = "$ac_pwd"; then
- srcdir=.
-fi
-# Remove unnecessary trailing slashes from srcdir.
-# Double slashes in file names in object file debugging info
-# mess up M-x gdb in Emacs.
-case $srcdir in
-*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
-esac
-for ac_var in $ac_precious_vars; do
- eval ac_env_${ac_var}_set=\${${ac_var}+set}
- eval ac_env_${ac_var}_value=\$${ac_var}
- eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
- eval ac_cv_env_${ac_var}_value=\$${ac_var}
-done
-
-#
-# Report the --help message.
-#
-if test "$ac_init_help" = "long"; then
- # Omit some internal or obsolete options to make the list less imposing.
- # This message is too long to be a string in the A/UX 3.1 sh.
- cat <<_ACEOF
-\`configure' configures this package to adapt to many kinds of systems.
-
-Usage: $0 [OPTION]... [VAR=VALUE]...
-
-To assign environment variables (e.g., CC, CFLAGS...), specify them as
-VAR=VALUE. See below for descriptions of some of the useful variables.
-
-Defaults for the options are specified in brackets.
-
-Configuration:
- -h, --help display this help and exit
- --help=short display options specific to this package
- --help=recursive display the short help of all the included packages
- -V, --version display version information and exit
- -q, --quiet, --silent do not print \`checking ...' messages
- --cache-file=FILE cache test results in FILE [disabled]
- -C, --config-cache alias for \`--cache-file=config.cache'
- -n, --no-create do not create output files
- --srcdir=DIR find the sources in DIR [configure dir or \`..']
-
-Installation directories:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [PREFIX]
-
-By default, \`make install' will install all the files in
-\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
-an installation prefix other than \`$ac_default_prefix' using \`--prefix',
-for instance \`--prefix=\$HOME'.
-
-For better control, use the options below.
-
-Fine tuning of the installation directories:
- --bindir=DIR user executables [EPREFIX/bin]
- --sbindir=DIR system admin executables [EPREFIX/sbin]
- --libexecdir=DIR program executables [EPREFIX/libexec]
- --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data [PREFIX/var]
- --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
- --libdir=DIR object code libraries [EPREFIX/lib]
- --includedir=DIR C header files [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc [/usr/include]
- --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
- --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
- --infodir=DIR info documentation [DATAROOTDIR/info]
- --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
- --mandir=DIR man documentation [DATAROOTDIR/man]
- --docdir=DIR documentation root [DATAROOTDIR/doc/PACKAGE]
- --htmldir=DIR html documentation [DOCDIR]
- --dvidir=DIR dvi documentation [DOCDIR]
- --pdfdir=DIR pdf documentation [DOCDIR]
- --psdir=DIR ps documentation [DOCDIR]
-_ACEOF
-
- cat <<\_ACEOF
-
-System types:
- --build=BUILD configure for building on BUILD [guessed]
- --host=HOST cross-compile to build programs to run on HOST [BUILD]
-_ACEOF
-fi
-
-if test -n "$ac_init_help"; then
-
- cat <<\_ACEOF
-
-Optional Features:
- --disable-option-checking ignore unrecognized --enable/--with options
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --enable-autogen Automatically regenerate configure output
- --enable-code-coverage Enable code coverage
- --disable-cc-silence Do not silence irrelevant compiler warnings
- --enable-debug Build debugging code (implies --enable-ivsalloc)
- --enable-ivsalloc Validate pointers passed through the public API
- --disable-stats Disable statistics calculation/reporting
- --enable-prof Enable allocation profiling
- --enable-prof-libunwind Use libunwind for backtracing
- --disable-prof-libgcc Do not use libgcc for backtracing
- --disable-prof-gcc Do not use gcc intrinsics for backtracing
- --disable-tcache Disable per thread caches
- --disable-munmap Disable VM deallocation via munmap(2)
- --disable-fill Disable support for junk/zero filling, quarantine,
- and redzones
- --enable-utrace Enable utrace(2)-based tracing
- --disable-valgrind Disable support for Valgrind
- --enable-xmalloc Support xmalloc option
- --disable-cache-oblivious
- Disable support for cache-oblivious allocation
- alignment
- --enable-lazy-lock Enable lazy locking (only lock when multi-threaded)
- --disable-tls Disable thread-local storage (__thread keyword)
- --disable-zone-allocator
- Disable zone allocator for Darwin
-
-Optional Packages:
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --with-xslroot=<path> XSL stylesheet root path
- --with-rpath=<rpath> Colon-separated rpath (ELF systems only)
- --with-mangling=<map> Mangle symbols in <map>
- --with-jemalloc-prefix=<prefix>
- Prefix to prepend to all public APIs
- --without-export disable exporting jemalloc public APIs
- --with-private-namespace=<prefix>
- Prefix to prepend to all library-private APIs
- --with-install-suffix=<suffix>
- Suffix to append to all installed files
- --with-malloc-conf=<malloc_conf>
- config.malloc_conf options string
- --with-static-libunwind=<libunwind.a>
- Path to static libunwind library; use rather than
- dynamically linking
- --with-lg-tiny-min=<lg-tiny-min>
- Base 2 log of minimum tiny size class to support
- --with-lg-quantum=<lg-quantum>
- Base 2 log of minimum allocation alignment
- --with-lg-page=<lg-page>
- Base 2 log of system page size
- --with-lg-page-sizes=<lg-page-sizes>
- Base 2 logs of system page sizes to support
- --with-lg-size-class-group=<lg-size-class-group>
- Base 2 log of size classes per doubling
- --with-version=<major>.<minor>.<bugfix>-<nrev>-g<gid>
- Version string
-
-Some influential environment variables:
- CC C compiler command
- CFLAGS C compiler flags
- LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
- nonstandard directory <lib dir>
- LIBS libraries to pass to the linker, e.g. -l<library>
- CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
- you have headers in a nonstandard directory <include dir>
- CPP C preprocessor
-
-Use these variables to override the choices made by `configure' or to help
-it to find libraries and programs with nonstandard names/locations.
-
-Report bugs to the package provider.
-_ACEOF
-ac_status=$?
-fi
-
-if test "$ac_init_help" = "recursive"; then
- # If there are subdirs, report their specific --help.
- for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
- test -d "$ac_dir" ||
- { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
- continue
- ac_builddir=.
-
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
- ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
- # A ".." for each directory in $ac_dir_suffix.
- ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
- case $ac_top_builddir_sub in
- "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
- *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
- esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
-
-case $srcdir in
- .) # We are building in place.
- ac_srcdir=.
- ac_top_srcdir=$ac_top_builddir_sub
- ac_abs_top_srcdir=$ac_pwd ;;
- [\\/]* | ?:[\\/]* ) # Absolute name.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir
- ac_abs_top_srcdir=$srcdir ;;
- *) # Relative name.
- ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_build_prefix$srcdir
- ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
-esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
-
- cd "$ac_dir" || { ac_status=$?; continue; }
- # Check for guested configure.
- if test -f "$ac_srcdir/configure.gnu"; then
- echo &&
- $SHELL "$ac_srcdir/configure.gnu" --help=recursive
- elif test -f "$ac_srcdir/configure"; then
- echo &&
- $SHELL "$ac_srcdir/configure" --help=recursive
- else
- $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
- fi || ac_status=$?
- cd "$ac_pwd" || { ac_status=$?; break; }
- done
-fi
-
-test -n "$ac_init_help" && exit $ac_status
-if $ac_init_version; then
- cat <<\_ACEOF
-configure
-generated by GNU Autoconf 2.69
-
-Copyright (C) 2012 Free Software Foundation, Inc.
-This configure script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it.
-_ACEOF
- exit
-fi
-
-## ------------------------ ##
-## Autoconf initialization. ##
-## ------------------------ ##
-
-# ac_fn_c_try_compile LINENO
-# --------------------------
-# Try to compile conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_compile ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- rm -f conftest.$ac_objext
- if { { ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_compile") 2>conftest.err
- ac_status=$?
- if test -s conftest.err; then
- grep -v '^ *+' conftest.err >conftest.er1
- cat conftest.er1 >&5
- mv -f conftest.er1 conftest.err
- fi
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then :
- ac_retval=0
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_retval=1
-fi
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
- as_fn_set_status $ac_retval
-
-} # ac_fn_c_try_compile
-
-# ac_fn_c_try_cpp LINENO
-# ----------------------
-# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_cpp ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- if { { ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
- ac_status=$?
- if test -s conftest.err; then
- grep -v '^ *+' conftest.err >conftest.er1
- cat conftest.er1 >&5
- mv -f conftest.er1 conftest.err
- fi
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } > conftest.i && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then :
- ac_retval=0
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_retval=1
-fi
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
- as_fn_set_status $ac_retval
-
-} # ac_fn_c_try_cpp
-
-# ac_fn_c_try_run LINENO
-# ----------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
-# that executables *can* be run.
-ac_fn_c_try_run ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- if { { ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
- { { case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :
- ac_retval=0
-else
- $as_echo "$as_me: program exited with status $ac_status" >&5
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_retval=$ac_status
-fi
- rm -rf conftest.dSYM conftest_ipa8_conftest.oo
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
- as_fn_set_status $ac_retval
-
-} # ac_fn_c_try_run
-
-# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
-# -------------------------------------------------------
-# Tests whether HEADER exists and can be compiled using the include files in
-# INCLUDES, setting the cache variable VAR accordingly.
-ac_fn_c_check_header_compile ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-#include <$2>
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- eval "$3=yes"
-else
- eval "$3=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_header_compile
-
-# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
-# --------------------------------------------
-# Tries to find the compile-time value of EXPR in a program that includes
-# INCLUDES, setting VAR accordingly. Returns whether the value could be
-# computed
-ac_fn_c_compute_int ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- if test "$cross_compiling" = yes; then
- # Depending upon the size, compute the lo and hi bounds.
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) >= 0)];
-test_array [0] = 0;
-return test_array [0];
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_lo=0 ac_mid=0
- while :; do
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0;
-return test_array [0];
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_hi=$ac_mid; break
-else
- as_fn_arith $ac_mid + 1 && ac_lo=$as_val
- if test $ac_lo -le $ac_mid; then
- ac_lo= ac_hi=
- break
- fi
- as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) < 0)];
-test_array [0] = 0;
-return test_array [0];
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_hi=-1 ac_mid=-1
- while :; do
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) >= $ac_mid)];
-test_array [0] = 0;
-return test_array [0];
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_lo=$ac_mid; break
-else
- as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
- if test $ac_mid -le $ac_hi; then
- ac_lo= ac_hi=
- break
- fi
- as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- ac_lo= ac_hi=
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
- as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0;
-return test_array [0];
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_hi=$ac_mid
-else
- as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in #((
-?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
-'') ac_retval=1 ;;
-esac
- else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-static long int longval () { return $2; }
-static unsigned long int ulongval () { return $2; }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
- FILE *f = fopen ("conftest.val", "w");
- if (! f)
- return 1;
- if (($2) < 0)
- {
- long int i = longval ();
- if (i != ($2))
- return 1;
- fprintf (f, "%ld", i);
- }
- else
- {
- unsigned long int i = ulongval ();
- if (i != ($2))
- return 1;
- fprintf (f, "%lu", i);
- }
- /* Do not output a trailing newline, as this causes \r\n confusion
- on some platforms. */
- return ferror (f) || fclose (f) != 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
- echo >>conftest.val; read $3 <conftest.val; ac_retval=0
-else
- ac_retval=1
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-rm -f conftest.val
-
- fi
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
- as_fn_set_status $ac_retval
-
-} # ac_fn_c_compute_int
-
-# ac_fn_c_try_link LINENO
-# -----------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_link ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- rm -f conftest.$ac_objext conftest$ac_exeext
- if { { ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_link") 2>conftest.err
- ac_status=$?
- if test -s conftest.err; then
- grep -v '^ *+' conftest.err >conftest.er1
- cat conftest.er1 >&5
- mv -f conftest.er1 conftest.err
- fi
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext && {
- test "$cross_compiling" = yes ||
- test -x conftest$ac_exeext
- }; then :
- ac_retval=0
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_retval=1
-fi
- # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
- # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
- # interfere with the next link command; also delete a directory that is
- # left behind by Apple's compiler. We do this before executing the actions.
- rm -rf conftest.dSYM conftest_ipa8_conftest.oo
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
- as_fn_set_status $ac_retval
-
-} # ac_fn_c_try_link
-
-# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
-# -------------------------------------------------------
-# Tests whether HEADER exists, giving a warning if it cannot be compiled using
-# the include files in INCLUDES and setting the cache variable VAR
-# accordingly.
-ac_fn_c_check_header_mongrel ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- if eval \${$3+:} false; then :
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
- $as_echo_n "(cached) " >&6
-fi
-eval ac_res=\$$3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
-$as_echo_n "checking $2 usability... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-#include <$2>
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_header_compiler=yes
-else
- ac_header_compiler=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
-$as_echo_n "checking $2 presence... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <$2>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
- ac_header_preproc=yes
-else
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
- yes:no: )
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
- ;;
- no:yes:* )
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
- ;;
-esac
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- eval "$3=\$ac_header_compiler"
-fi
-eval ac_res=\$$3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-fi
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_header_mongrel
-
-# ac_fn_c_check_func LINENO FUNC VAR
-# ----------------------------------
-# Tests whether FUNC exists, setting the cache variable VAR accordingly
-ac_fn_c_check_func ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $2 innocuous_$2
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $2 (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $2
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $2 ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$2 || defined __stub___$2
-choke me
-#endif
-
-int
-main ()
-{
-return $2 ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- eval "$3=yes"
-else
- eval "$3=no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-eval ac_res=\$$3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_func
-
-# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
-# -------------------------------------------
-# Tests whether TYPE exists after having included INCLUDES, setting cache
-# variable VAR accordingly.
-ac_fn_c_check_type ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- eval "$3=no"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-if (sizeof ($2))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-if (sizeof (($2)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-else
- eval "$3=yes"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_type
-cat >config.log <<_ACEOF
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-
-It was created by $as_me, which was
-generated by GNU Autoconf 2.69. Invocation command line was
-
- $ $0 $@
-
-_ACEOF
-exec 5>>config.log
-{
-cat <<_ASUNAME
-## --------- ##
-## Platform. ##
-## --------- ##
-
-hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
-/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
-
-/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
-/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
-/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
-/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
-/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
-
-_ASUNAME
-
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- $as_echo "PATH: $as_dir"
- done
-IFS=$as_save_IFS
-
-} >&5
-
-cat >&5 <<_ACEOF
-
-
-## ----------- ##
-## Core tests. ##
-## ----------- ##
-
-_ACEOF
-
-
-# Keep a trace of the command line.
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Strip out --silent because we don't want to record it for future runs.
-# Also quote any args containing shell meta-characters.
-# Make two passes to allow for proper duplicate-argument suppression.
-ac_configure_args=
-ac_configure_args0=
-ac_configure_args1=
-ac_must_keep_next=false
-for ac_pass in 1 2
-do
- for ac_arg
- do
- case $ac_arg in
- -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- continue ;;
- *\'*)
- ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
- esac
- case $ac_pass in
- 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
- 2)
- as_fn_append ac_configure_args1 " '$ac_arg'"
- if test $ac_must_keep_next = true; then
- ac_must_keep_next=false # Got value, back to normal.
- else
- case $ac_arg in
- *=* | --config-cache | -C | -disable-* | --disable-* \
- | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
- | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
- | -with-* | --with-* | -without-* | --without-* | --x)
- case "$ac_configure_args0 " in
- "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
- esac
- ;;
- -* ) ac_must_keep_next=true ;;
- esac
- fi
- as_fn_append ac_configure_args " '$ac_arg'"
- ;;
- esac
- done
-done
-{ ac_configure_args0=; unset ac_configure_args0;}
-{ ac_configure_args1=; unset ac_configure_args1;}
-
-# When interrupted or exit'd, cleanup temporary files, and complete
-# config.log. We remove comments because anyway the quotes in there
-# would cause problems or look ugly.
-# WARNING: Use '\'' to represent an apostrophe within the trap.
-# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
-trap 'exit_status=$?
- # Save into config.log some information that might help in debugging.
- {
- echo
-
- $as_echo "## ---------------- ##
-## Cache variables. ##
-## ---------------- ##"
- echo
- # The following way of writing the cache mishandles newlines in values,
-(
- for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
- eval ac_val=\$$ac_var
- case $ac_val in #(
- *${as_nl}*)
- case $ac_var in #(
- *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
-$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
- esac
- case $ac_var in #(
- _ | IFS | as_nl) ;; #(
- BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
- *) { eval $ac_var=; unset $ac_var;} ;;
- esac ;;
- esac
- done
- (set) 2>&1 |
- case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
- *${as_nl}ac_space=\ *)
- sed -n \
- "s/'\''/'\''\\\\'\'''\''/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
- ;; #(
- *)
- sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
- ;;
- esac |
- sort
-)
- echo
-
- $as_echo "## ----------------- ##
-## Output variables. ##
-## ----------------- ##"
- echo
- for ac_var in $ac_subst_vars
- do
- eval ac_val=\$$ac_var
- case $ac_val in
- *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
- esac
- $as_echo "$ac_var='\''$ac_val'\''"
- done | sort
- echo
-
- if test -n "$ac_subst_files"; then
- $as_echo "## ------------------- ##
-## File substitutions. ##
-## ------------------- ##"
- echo
- for ac_var in $ac_subst_files
- do
- eval ac_val=\$$ac_var
- case $ac_val in
- *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
- esac
- $as_echo "$ac_var='\''$ac_val'\''"
- done | sort
- echo
- fi
-
- if test -s confdefs.h; then
- $as_echo "## ----------- ##
-## confdefs.h. ##
-## ----------- ##"
- echo
- cat confdefs.h
- echo
- fi
- test "$ac_signal" != 0 &&
- $as_echo "$as_me: caught signal $ac_signal"
- $as_echo "$as_me: exit $exit_status"
- } >&5
- rm -f core *.core core.conftest.* &&
- rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
- exit $exit_status
-' 0
-for ac_signal in 1 2 13 15; do
- trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
-done
-ac_signal=0
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -f -r conftest* confdefs.h
-
-$as_echo "/* confdefs.h */" > confdefs.h
-
-# Predefined preprocessor variables.
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_NAME "$PACKAGE_NAME"
-_ACEOF
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
-_ACEOF
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_VERSION "$PACKAGE_VERSION"
-_ACEOF
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_STRING "$PACKAGE_STRING"
-_ACEOF
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
-_ACEOF
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_URL "$PACKAGE_URL"
-_ACEOF
-
-
-# Let the site file select an alternate cache file if it wants to.
-# Prefer an explicitly selected file to automatically selected ones.
-ac_site_file1=NONE
-ac_site_file2=NONE
-if test -n "$CONFIG_SITE"; then
- # We do not want a PATH search for config.site.
- case $CONFIG_SITE in #((
- -*) ac_site_file1=./$CONFIG_SITE;;
- */*) ac_site_file1=$CONFIG_SITE;;
- *) ac_site_file1=./$CONFIG_SITE;;
- esac
-elif test "x$prefix" != xNONE; then
- ac_site_file1=$prefix/share/config.site
- ac_site_file2=$prefix/etc/config.site
-else
- ac_site_file1=$ac_default_prefix/share/config.site
- ac_site_file2=$ac_default_prefix/etc/config.site
-fi
-for ac_site_file in "$ac_site_file1" "$ac_site_file2"
-do
- test "x$ac_site_file" = xNONE && continue
- if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
-$as_echo "$as_me: loading site script $ac_site_file" >&6;}
- sed 's/^/| /' "$ac_site_file" >&5
- . "$ac_site_file" \
- || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "failed to load site script $ac_site_file
-See \`config.log' for more details" "$LINENO" 5; }
- fi
-done
-
-if test -r "$cache_file"; then
- # Some versions of bash will fail to source /dev/null (special files
- # actually), so we avoid doing that. DJGPP emulates it as a regular file.
- if test /dev/null != "$cache_file" && test -f "$cache_file"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
-$as_echo "$as_me: loading cache $cache_file" >&6;}
- case $cache_file in
- [\\/]* | ?:[\\/]* ) . "$cache_file";;
- *) . "./$cache_file";;
- esac
- fi
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
-$as_echo "$as_me: creating cache $cache_file" >&6;}
- >$cache_file
-fi
-
-# Check that the precious variables saved in the cache have kept the same
-# value.
-ac_cache_corrupted=false
-for ac_var in $ac_precious_vars; do
- eval ac_old_set=\$ac_cv_env_${ac_var}_set
- eval ac_new_set=\$ac_env_${ac_var}_set
- eval ac_old_val=\$ac_cv_env_${ac_var}_value
- eval ac_new_val=\$ac_env_${ac_var}_value
- case $ac_old_set,$ac_new_set in
- set,)
- { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
- ac_cache_corrupted=: ;;
- ,set)
- { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
-$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
- ac_cache_corrupted=: ;;
- ,);;
- *)
- if test "x$ac_old_val" != "x$ac_new_val"; then
- # differences in whitespace do not lead to failure.
- ac_old_val_w=`echo x $ac_old_val`
- ac_new_val_w=`echo x $ac_new_val`
- if test "$ac_old_val_w" != "$ac_new_val_w"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
-$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
- ac_cache_corrupted=:
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
-$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
- eval $ac_var=\$ac_old_val
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
-$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
-$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
- fi;;
- esac
- # Pass precious variables to config.status.
- if test "$ac_new_set" = set; then
- case $ac_new_val in
- *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
- *) ac_arg=$ac_var=$ac_new_val ;;
- esac
- case " $ac_configure_args " in
- *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
- *) as_fn_append ac_configure_args " '$ac_arg'" ;;
- esac
- fi
-done
-if $ac_cache_corrupted; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
-$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
- as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
-fi
-## -------------------- ##
-## Main body of script. ##
-## -------------------- ##
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-ac_aux_dir=
-for ac_dir in build-aux "$srcdir"/build-aux; do
- if test -f "$ac_dir/install-sh"; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install-sh -c"
- break
- elif test -f "$ac_dir/install.sh"; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/install.sh -c"
- break
- elif test -f "$ac_dir/shtool"; then
- ac_aux_dir=$ac_dir
- ac_install_sh="$ac_aux_dir/shtool install -c"
- break
- fi
-done
-if test -z "$ac_aux_dir"; then
- as_fn_error $? "cannot find install-sh, install.sh, or shtool in build-aux \"$srcdir\"/build-aux" "$LINENO" 5
-fi
-
-# These three variables are undocumented and unsupported,
-# and are intended to be withdrawn in a future Autoconf release.
-# They can cause serious problems if a builder's source tree is in a directory
-# whose full name contains unusual characters.
-ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
-ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
-ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
-
-
-
-
-
-
-
-
-
-CONFIG=`echo ${ac_configure_args} | sed -e 's#'"'"'\([^ ]*\)'"'"'#\1#g'`
-
-
-rev=2
-
-
-srcroot=$srcdir
-if test "x${srcroot}" = "x." ; then
- srcroot=""
-else
- srcroot="${srcroot}/"
-fi
-
-abs_srcroot="`cd \"${srcdir}\"; pwd`/"
-
-
-objroot=""
-
-abs_objroot="`pwd`/"
-
-
-if test "x$prefix" = "xNONE" ; then
- prefix="/usr/local"
-fi
-if test "x$exec_prefix" = "xNONE" ; then
- exec_prefix=$prefix
-fi
-PREFIX=$prefix
-
-BINDIR=`eval echo $bindir`
-BINDIR=`eval echo $BINDIR`
-
-INCLUDEDIR=`eval echo $includedir`
-INCLUDEDIR=`eval echo $INCLUDEDIR`
-
-LIBDIR=`eval echo $libdir`
-LIBDIR=`eval echo $LIBDIR`
-
-DATADIR=`eval echo $datadir`
-DATADIR=`eval echo $DATADIR`
-
-MANDIR=`eval echo $mandir`
-MANDIR=`eval echo $MANDIR`
-
-
-# Extract the first word of "xsltproc", so it can be a program name with args.
-set dummy xsltproc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_XSLTPROC+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- case $XSLTPROC in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_XSLTPROC="$XSLTPROC" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_XSLTPROC="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- test -z "$ac_cv_path_XSLTPROC" && ac_cv_path_XSLTPROC="false"
- ;;
-esac
-fi
-XSLTPROC=$ac_cv_path_XSLTPROC
-if test -n "$XSLTPROC"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XSLTPROC" >&5
-$as_echo "$XSLTPROC" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-if test -d "/usr/share/xml/docbook/stylesheet/docbook-xsl" ; then
- DEFAULT_XSLROOT="/usr/share/xml/docbook/stylesheet/docbook-xsl"
-elif test -d "/usr/share/sgml/docbook/xsl-stylesheets" ; then
- DEFAULT_XSLROOT="/usr/share/sgml/docbook/xsl-stylesheets"
-else
- DEFAULT_XSLROOT=""
-fi
-
-# Check whether --with-xslroot was given.
-if test "${with_xslroot+set}" = set; then :
- withval=$with_xslroot;
-if test "x$with_xslroot" = "xno" ; then
- XSLROOT="${DEFAULT_XSLROOT}"
-else
- XSLROOT="${with_xslroot}"
-fi
-
-else
- XSLROOT="${DEFAULT_XSLROOT}"
-
-fi
-
-
-
-CFLAGS=$CFLAGS
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_CC="${ac_tool_prefix}gcc"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_CC"; then
- ac_ct_CC=$CC
- # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CC+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_CC="gcc"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_ct_CC" = x; then
- CC=""
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- CC=$ac_ct_CC
- fi
-else
- CC="$ac_cv_prog_CC"
-fi
-
-if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_CC="${ac_tool_prefix}cc"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- fi
-fi
-if test -z "$CC"; then
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- ac_prog_rejected=no
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-if test $ac_prog_rejected = yes; then
- # We found a bogon in the path, so make sure we never use it.
- set dummy $ac_cv_prog_CC
- shift
- if test $# != 0; then
- # We chose a different compiler from the bogus one.
- # However, it has the same basename, so the bogon will be chosen
- # first if we set CC to just the basename; use the full file name.
- shift
- ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
- fi
-fi
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$CC"; then
- if test -n "$ac_tool_prefix"; then
- for ac_prog in cl.exe
- do
- # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- test -n "$CC" && break
- done
-fi
-if test -z "$CC"; then
- ac_ct_CC=$CC
- for ac_prog in cl.exe
-do
- # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CC+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_CC"; then
- ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_CC="$ac_prog"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- test -n "$ac_ct_CC" && break
-done
-
- if test "x$ac_ct_CC" = x; then
- CC=""
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- CC=$ac_ct_CC
- fi
-fi
-
-fi
-
-
-test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "no acceptable C compiler found in \$PATH
-See \`config.log' for more details" "$LINENO" 5; }
-
-# Provide some information about the compiler.
-$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
-set X $ac_compile
-ac_compiler=$2
-for ac_option in --version -v -V -qversion; do
- { { ac_try="$ac_compiler $ac_option >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_compiler $ac_option >&5") 2>conftest.err
- ac_status=$?
- if test -s conftest.err; then
- sed '10a\
-... rest of stderr output deleted ...
- 10q' conftest.err >conftest.er1
- cat conftest.er1 >&5
- fi
- rm -f conftest.er1 conftest.err
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }
-done
-
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
-# Try to create an executable without -o first, disregard a.out.
-# It will help us diagnose broken compilers, and finding out an intuition
-# of exeext.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
-$as_echo_n "checking whether the C compiler works... " >&6; }
-ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-
-# The possible output files:
-ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
-
-ac_rmfiles=
-for ac_file in $ac_files
-do
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
- * ) ac_rmfiles="$ac_rmfiles $ac_file";;
- esac
-done
-rm -f $ac_rmfiles
-
-if { { ac_try="$ac_link_default"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_link_default") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then :
- # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
-# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
-# in a Makefile. We should not override ac_cv_exeext if it was cached,
-# so that the user can short-circuit this test for compilers unknown to
-# Autoconf.
-for ac_file in $ac_files ''
-do
- test -f "$ac_file" || continue
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
- ;;
- [ab].out )
- # We found the default executable, but exeext='' is most
- # certainly right.
- break;;
- *.* )
- if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
- then :; else
- ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- fi
- # We set ac_cv_exeext here because the later test for it is not
- # safe: cross compilers may not add the suffix if given an `-o'
- # argument, so we may need to know it at that point already.
- # Even if this section looks crufty: it has the advantage of
- # actually working.
- break;;
- * )
- break;;
- esac
-done
-test "$ac_cv_exeext" = no && ac_cv_exeext=
-
-else
- ac_file=''
-fi
-if test -z "$ac_file"; then :
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-$as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "C compiler cannot create executables
-See \`config.log' for more details" "$LINENO" 5; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
-$as_echo_n "checking for C compiler default output file name... " >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
-$as_echo "$ac_file" >&6; }
-ac_exeext=$ac_cv_exeext
-
-rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
-ac_clean_files=$ac_clean_files_save
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
-$as_echo_n "checking for suffix of executables... " >&6; }
-if { { ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then :
- # If both `conftest.exe' and `conftest' are `present' (well, observable)
-# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
-# work properly (i.e., refer to `conftest.exe'), while it won't with
-# `rm'.
-for ac_file in conftest.exe conftest conftest.*; do
- test -f "$ac_file" || continue
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
- *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
- break;;
- * ) break;;
- esac
-done
-else
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details" "$LINENO" 5; }
-fi
-rm -f conftest conftest$ac_cv_exeext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
-$as_echo "$ac_cv_exeext" >&6; }
-
-rm -f conftest.$ac_ext
-EXEEXT=$ac_cv_exeext
-ac_exeext=$EXEEXT
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <stdio.h>
-int
-main ()
-{
-FILE *f = fopen ("conftest.out", "w");
- return ferror (f) || fclose (f) != 0;
-
- ;
- return 0;
-}
-_ACEOF
-ac_clean_files="$ac_clean_files conftest.out"
-# Check that the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
-$as_echo_n "checking whether we are cross compiling... " >&6; }
-if test "$cross_compiling" != yes; then
- { { ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }
- if { ac_try='./conftest$ac_cv_exeext'
- { { case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then
- cross_compiling=no
- else
- if test "$cross_compiling" = maybe; then
- cross_compiling=yes
- else
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details" "$LINENO" 5; }
- fi
- fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
-$as_echo "$cross_compiling" >&6; }
-
-rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
-ac_clean_files=$ac_clean_files_save
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
-$as_echo_n "checking for suffix of object files... " >&6; }
-if ${ac_cv_objext+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.o conftest.obj
-if { { ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_compile") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then :
- for ac_file in conftest.o conftest.obj conftest.*; do
- test -f "$ac_file" || continue;
- case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
- *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
- break;;
- esac
-done
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot compute suffix of object files: cannot compile
-See \`config.log' for more details" "$LINENO" 5; }
-fi
-rm -f conftest.$ac_cv_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
-$as_echo "$ac_cv_objext" >&6; }
-OBJEXT=$ac_cv_objext
-ac_objext=$OBJEXT
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
-$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if ${ac_cv_c_compiler_gnu+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-#ifndef __GNUC__
- choke me
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_compiler_gnu=yes
-else
- ac_compiler_gnu=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_c_compiler_gnu=$ac_compiler_gnu
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
-$as_echo "$ac_cv_c_compiler_gnu" >&6; }
-if test $ac_compiler_gnu = yes; then
- GCC=yes
-else
- GCC=
-fi
-ac_test_CFLAGS=${CFLAGS+set}
-ac_save_CFLAGS=$CFLAGS
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
-$as_echo_n "checking whether $CC accepts -g... " >&6; }
-if ${ac_cv_prog_cc_g+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_save_c_werror_flag=$ac_c_werror_flag
- ac_c_werror_flag=yes
- ac_cv_prog_cc_g=no
- CFLAGS="-g"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv_prog_cc_g=yes
-else
- CFLAGS=""
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-else
- ac_c_werror_flag=$ac_save_c_werror_flag
- CFLAGS="-g"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv_prog_cc_g=yes
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- ac_c_werror_flag=$ac_save_c_werror_flag
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
-$as_echo "$ac_cv_prog_cc_g" >&6; }
-if test "$ac_test_CFLAGS" = set; then
- CFLAGS=$ac_save_CFLAGS
-elif test $ac_cv_prog_cc_g = yes; then
- if test "$GCC" = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-g"
- fi
-else
- if test "$GCC" = yes; then
- CFLAGS="-O2"
- else
- CFLAGS=
- fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
-$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if ${ac_cv_prog_cc_c89+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_cv_prog_cc_c89=no
-ac_save_CC=$CC
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <stdarg.h>
-#include <stdio.h>
-struct stat;
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
- char **p;
- int i;
-{
- return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
- char *s;
- va_list v;
- va_start (v,p);
- s = g (p, va_arg (v,int));
- va_end (v);
- return s;
-}
-
-/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
- function prototypes and stuff, but not '\xHH' hex character constants.
- These don't provoke an error unfortunately, instead are silently treated
- as 'x'. The following induces an error, until -std is added to get
- proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
- array size at least. It's necessary to write '\x00'==0 to get something
- that's true only with -std. */
-int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-
-/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
- inside strings and character constants. */
-#define FOO(x) 'x'
-int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
-
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
- ;
- return 0;
-}
-_ACEOF
-for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
- -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
- CC="$ac_save_CC $ac_arg"
- if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv_prog_cc_c89=$ac_arg
-fi
-rm -f core conftest.err conftest.$ac_objext
- test "x$ac_cv_prog_cc_c89" != "xno" && break
-done
-rm -f conftest.$ac_ext
-CC=$ac_save_CC
-
-fi
-# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_c89" in
- x)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
-$as_echo "none needed" >&6; } ;;
- xno)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
-$as_echo "unsupported" >&6; } ;;
- *)
- CC="$CC $ac_cv_prog_cc_c89"
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
-$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
-esac
-if test "x$ac_cv_prog_cc_c89" != xno; then :
-
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-if test "x$GCC" != "xyes" ; then
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler is MSVC" >&5
-$as_echo_n "checking whether compiler is MSVC... " >&6; }
-if ${je_cv_msvc+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-
-#ifndef _MSC_VER
- int fail-1;
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_msvc=yes
-else
- je_cv_msvc=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_msvc" >&5
-$as_echo "$je_cv_msvc" >&6; }
-fi
-
-je_cv_cray_prgenv_wrapper=""
-if test "x${PE_ENV}" != "x" ; then
- case "${CC}" in
- CC|cc)
- je_cv_cray_prgenv_wrapper="yes"
- ;;
- *)
- ;;
- esac
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler is cray" >&5
-$as_echo_n "checking whether compiler is cray... " >&6; }
-if ${je_cv_cray+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-
-#ifndef _CRAYC
- int fail-1;
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cray=yes
-else
- je_cv_cray=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_cray" >&5
-$as_echo "$je_cv_cray" >&6; }
-
-if test "x${je_cv_cray}" = "xyes" ; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cray compiler version is 8.4" >&5
-$as_echo_n "checking whether cray compiler version is 8.4... " >&6; }
-if ${je_cv_cray_84+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-
-#if !(_RELEASE_MAJOR == 8 && _RELEASE_MINOR == 4)
- int fail-1;
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cray_84=yes
-else
- je_cv_cray_84=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_cray_84" >&5
-$as_echo "$je_cv_cray_84" >&6; }
-fi
-
-if test "x$CFLAGS" = "x" ; then
- no_CFLAGS="yes"
- if test "x$GCC" = "xyes" ; then
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -std=gnu11" >&5
-$as_echo_n "checking whether compiler supports -std=gnu11... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-std=gnu11"
-else
- CFLAGS="${CFLAGS} -std=gnu11"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-std=gnu11
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
- if test "x$je_cv_cflags_appended" = "x-std=gnu11" ; then
- cat >>confdefs.h <<_ACEOF
-#define JEMALLOC_HAS_RESTRICT 1
-_ACEOF
-
- else
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -std=gnu99" >&5
-$as_echo_n "checking whether compiler supports -std=gnu99... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-std=gnu99"
-else
- CFLAGS="${CFLAGS} -std=gnu99"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-std=gnu99
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
- if test "x$je_cv_cflags_appended" = "x-std=gnu99" ; then
- cat >>confdefs.h <<_ACEOF
-#define JEMALLOC_HAS_RESTRICT 1
-_ACEOF
-
- fi
- fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -Wall" >&5
-$as_echo_n "checking whether compiler supports -Wall... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-Wall"
-else
- CFLAGS="${CFLAGS} -Wall"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-Wall
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -Werror=declaration-after-statement" >&5
-$as_echo_n "checking whether compiler supports -Werror=declaration-after-statement... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-Werror=declaration-after-statement"
-else
- CFLAGS="${CFLAGS} -Werror=declaration-after-statement"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-Werror=declaration-after-statement
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -Wshorten-64-to-32" >&5
-$as_echo_n "checking whether compiler supports -Wshorten-64-to-32... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-Wshorten-64-to-32"
-else
- CFLAGS="${CFLAGS} -Wshorten-64-to-32"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-Wshorten-64-to-32
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -Wsign-compare" >&5
-$as_echo_n "checking whether compiler supports -Wsign-compare... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-Wsign-compare"
-else
- CFLAGS="${CFLAGS} -Wsign-compare"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-Wsign-compare
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -pipe" >&5
-$as_echo_n "checking whether compiler supports -pipe... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-pipe"
-else
- CFLAGS="${CFLAGS} -pipe"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-pipe
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -g3" >&5
-$as_echo_n "checking whether compiler supports -g3... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-g3"
-else
- CFLAGS="${CFLAGS} -g3"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-g3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
- elif test "x$je_cv_msvc" = "xyes" ; then
- CC="$CC -nologo"
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -Zi" >&5
-$as_echo_n "checking whether compiler supports -Zi... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-Zi"
-else
- CFLAGS="${CFLAGS} -Zi"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-Zi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -MT" >&5
-$as_echo_n "checking whether compiler supports -MT... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-MT"
-else
- CFLAGS="${CFLAGS} -MT"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-MT
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -W3" >&5
-$as_echo_n "checking whether compiler supports -W3... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-W3"
-else
- CFLAGS="${CFLAGS} -W3"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-W3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -FS" >&5
-$as_echo_n "checking whether compiler supports -FS... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-FS"
-else
- CFLAGS="${CFLAGS} -FS"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-FS
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
- CPPFLAGS="$CPPFLAGS -I${srcdir}/include/msvc_compat"
- fi
- if test "x$je_cv_cray" = "xyes" ; then
- if test "x$je_cv_cray_84" = "xyes" ; then
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -hipa2" >&5
-$as_echo_n "checking whether compiler supports -hipa2... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-hipa2"
-else
- CFLAGS="${CFLAGS} -hipa2"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-hipa2
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -hnognu" >&5
-$as_echo_n "checking whether compiler supports -hnognu... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-hnognu"
-else
- CFLAGS="${CFLAGS} -hnognu"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-hnognu
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
- fi
- if test "x$enable_cc_silence" != "xno" ; then
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -hnomessage=128" >&5
-$as_echo_n "checking whether compiler supports -hnomessage=128... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-hnomessage=128"
-else
- CFLAGS="${CFLAGS} -hnomessage=128"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-hnomessage=128
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -hnomessage=1357" >&5
-$as_echo_n "checking whether compiler supports -hnomessage=1357... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-hnomessage=1357"
-else
- CFLAGS="${CFLAGS} -hnomessage=1357"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-hnomessage=1357
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
- fi
- fi
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
-$as_echo_n "checking how to run the C preprocessor... " >&6; }
-# On Suns, sometimes $CPP names a directory.
-if test -n "$CPP" && test -d "$CPP"; then
- CPP=
-fi
-if test -z "$CPP"; then
- if ${ac_cv_prog_CPP+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- # Double quotes because CPP needs to be expanded
- for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
- do
- ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-
-else
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether nonexistent headers
- # can be detected and how.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
- # Broken: success on invalid input.
-continue
-else
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
- break
-fi
-
- done
- ac_cv_prog_CPP=$CPP
-
-fi
- CPP=$ac_cv_prog_CPP
-else
- ac_cv_prog_CPP=$CPP
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
-$as_echo "$CPP" >&6; }
-ac_preproc_ok=false
-for ac_c_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-
-else
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
- # OK, works on sane cases. Now check whether nonexistent headers
- # can be detected and how.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
- # Broken: success on invalid input.
-continue
-else
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
-
-else
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5; }
-fi
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
-$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if ${ac_cv_path_GREP+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -z "$GREP"; then
- ac_path_GREP_found=false
- # Loop through the user's path and test for each of PROGNAME-LIST
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_prog in grep ggrep; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
- as_fn_executable_p "$ac_path_GREP" || continue
-# Check for GNU ac_path_GREP and select it if it is found.
- # Check for GNU $ac_path_GREP
-case `"$ac_path_GREP" --version 2>&1` in
-*GNU*)
- ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
-*)
- ac_count=0
- $as_echo_n 0123456789 >"conftest.in"
- while :
- do
- cat "conftest.in" "conftest.in" >"conftest.tmp"
- mv "conftest.tmp" "conftest.in"
- cp "conftest.in" "conftest.nl"
- $as_echo 'GREP' >> "conftest.nl"
- "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- as_fn_arith $ac_count + 1 && ac_count=$as_val
- if test $ac_count -gt ${ac_path_GREP_max-0}; then
- # Best one so far, save it but keep looking for a better one
- ac_cv_path_GREP="$ac_path_GREP"
- ac_path_GREP_max=$ac_count
- fi
- # 10*(2^10) chars as input seems more than enough
- test $ac_count -gt 10 && break
- done
- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
- $ac_path_GREP_found && break 3
- done
- done
- done
-IFS=$as_save_IFS
- if test -z "$ac_cv_path_GREP"; then
- as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
- fi
-else
- ac_cv_path_GREP=$GREP
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
-$as_echo "$ac_cv_path_GREP" >&6; }
- GREP="$ac_cv_path_GREP"
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
-$as_echo_n "checking for egrep... " >&6; }
-if ${ac_cv_path_EGREP+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
- then ac_cv_path_EGREP="$GREP -E"
- else
- if test -z "$EGREP"; then
- ac_path_EGREP_found=false
- # Loop through the user's path and test for each of PROGNAME-LIST
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_prog in egrep; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
- as_fn_executable_p "$ac_path_EGREP" || continue
-# Check for GNU ac_path_EGREP and select it if it is found.
- # Check for GNU $ac_path_EGREP
-case `"$ac_path_EGREP" --version 2>&1` in
-*GNU*)
- ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
-*)
- ac_count=0
- $as_echo_n 0123456789 >"conftest.in"
- while :
- do
- cat "conftest.in" "conftest.in" >"conftest.tmp"
- mv "conftest.tmp" "conftest.in"
- cp "conftest.in" "conftest.nl"
- $as_echo 'EGREP' >> "conftest.nl"
- "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- as_fn_arith $ac_count + 1 && ac_count=$as_val
- if test $ac_count -gt ${ac_path_EGREP_max-0}; then
- # Best one so far, save it but keep looking for a better one
- ac_cv_path_EGREP="$ac_path_EGREP"
- ac_path_EGREP_max=$ac_count
- fi
- # 10*(2^10) chars as input seems more than enough
- test $ac_count -gt 10 && break
- done
- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
- $ac_path_EGREP_found && break 3
- done
- done
- done
-IFS=$as_save_IFS
- if test -z "$ac_cv_path_EGREP"; then
- as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
- fi
-else
- ac_cv_path_EGREP=$EGREP
-fi
-
- fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
-$as_echo "$ac_cv_path_EGREP" >&6; }
- EGREP="$ac_cv_path_EGREP"
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
-$as_echo_n "checking for ANSI C header files... " >&6; }
-if ${ac_cv_header_stdc+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv_header_stdc=yes
-else
- ac_cv_header_stdc=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "memchr" >/dev/null 2>&1; then :
-
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "free" >/dev/null 2>&1; then :
-
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
- if test "$cross_compiling" = yes; then :
- :
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
- (('a' <= (c) && (c) <= 'i') \
- || ('j' <= (c) && (c) <= 'r') \
- || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
- int i;
- for (i = 0; i < 256; i++)
- if (XOR (islower (i), ISLOWER (i))
- || toupper (i) != TOUPPER (i))
- return 2;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-
-else
- ac_cv_header_stdc=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
-$as_echo "$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
-
-$as_echo "#define STDC_HEADERS 1" >>confdefs.h
-
-fi
-
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
- inttypes.h stdint.h unistd.h
-do :
- as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
-"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
-$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
-if ${ac_cv_c_bigendian+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_cv_c_bigendian=unknown
- # See if we're dealing with a universal compiler.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#ifndef __APPLE_CC__
- not a universal capable compiler
- #endif
- typedef int dummy;
-
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
- # Check for potential -arch flags. It is not universal unless
- # there are at least two -arch flags with different values.
- ac_arch=
- ac_prev=
- for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do
- if test -n "$ac_prev"; then
- case $ac_word in
- i?86 | x86_64 | ppc | ppc64)
- if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then
- ac_arch=$ac_word
- else
- ac_cv_c_bigendian=universal
- break
- fi
- ;;
- esac
- ac_prev=
- elif test "x$ac_word" = "x-arch"; then
- ac_prev=arch
- fi
- done
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- if test $ac_cv_c_bigendian = unknown; then
- # See if sys/param.h defines the BYTE_ORDER macro.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <sys/types.h>
- #include <sys/param.h>
-
-int
-main ()
-{
-#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
- && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
- && LITTLE_ENDIAN)
- bogus endian macros
- #endif
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- # It does; now see whether it defined to BIG_ENDIAN or not.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <sys/types.h>
- #include <sys/param.h>
-
-int
-main ()
-{
-#if BYTE_ORDER != BIG_ENDIAN
- not big endian
- #endif
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv_c_bigendian=yes
-else
- ac_cv_c_bigendian=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- fi
- if test $ac_cv_c_bigendian = unknown; then
- # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <limits.h>
-
-int
-main ()
-{
-#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
- bogus endian macros
- #endif
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- # It does; now see whether it defined to _BIG_ENDIAN or not.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <limits.h>
-
-int
-main ()
-{
-#ifndef _BIG_ENDIAN
- not big endian
- #endif
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv_c_bigendian=yes
-else
- ac_cv_c_bigendian=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- fi
- if test $ac_cv_c_bigendian = unknown; then
- # Compile a test program.
- if test "$cross_compiling" = yes; then :
- # Try to guess by grepping values from an object file.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-short int ascii_mm[] =
- { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
- short int ascii_ii[] =
- { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
- int use_ascii (int i) {
- return ascii_mm[i] + ascii_ii[i];
- }
- short int ebcdic_ii[] =
- { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
- short int ebcdic_mm[] =
- { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
- int use_ebcdic (int i) {
- return ebcdic_mm[i] + ebcdic_ii[i];
- }
- extern int foo;
-
-int
-main ()
-{
-return use_ascii (foo) == use_ebcdic (foo);
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
- ac_cv_c_bigendian=yes
- fi
- if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
- if test "$ac_cv_c_bigendian" = unknown; then
- ac_cv_c_bigendian=no
- else
- # finding both strings is unlikely to happen, but who knows?
- ac_cv_c_bigendian=unknown
- fi
- fi
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$ac_includes_default
-int
-main ()
-{
-
- /* Are we little or big endian? From Harbison&Steele. */
- union
- {
- long int l;
- char c[sizeof (long int)];
- } u;
- u.l = 1;
- return u.c[sizeof (long int) - 1] == 1;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
- ac_cv_c_bigendian=no
-else
- ac_cv_c_bigendian=yes
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
- fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5
-$as_echo "$ac_cv_c_bigendian" >&6; }
- case $ac_cv_c_bigendian in #(
- yes)
- ac_cv_big_endian=1;; #(
- no)
- ac_cv_big_endian=0 ;; #(
- universal)
-
-$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
-
- ;; #(
- *)
- as_fn_error $? "unknown endianness
- presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
- esac
-
-if test "x${ac_cv_big_endian}" = "x1" ; then
- cat >>confdefs.h <<_ACEOF
-#define JEMALLOC_BIG_ENDIAN
-_ACEOF
-
-fi
-
-if test "x${je_cv_msvc}" = "xyes" -a "x${ac_cv_header_inttypes_h}" = "xno"; then
- CPPFLAGS="$CPPFLAGS -I${srcdir}/include/msvc_compat/C99"
-fi
-
-if test "x${je_cv_msvc}" = "xyes" ; then
- LG_SIZEOF_PTR=LG_SIZEOF_PTR_WIN
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Using a predefined value for sizeof(void *): 4 for 32-bit, 8 for 64-bit" >&5
-$as_echo "Using a predefined value for sizeof(void *): 4 for 32-bit, 8 for 64-bit" >&6; }
-else
- # The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5
-$as_echo_n "checking size of void *... " >&6; }
-if ${ac_cv_sizeof_void_p+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then :
-
-else
- if test "$ac_cv_type_void_p" = yes; then
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (void *)
-See \`config.log' for more details" "$LINENO" 5; }
- else
- ac_cv_sizeof_void_p=0
- fi
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5
-$as_echo "$ac_cv_sizeof_void_p" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
-_ACEOF
-
-
- if test "x${ac_cv_sizeof_void_p}" = "x8" ; then
- LG_SIZEOF_PTR=3
- elif test "x${ac_cv_sizeof_void_p}" = "x4" ; then
- LG_SIZEOF_PTR=2
- else
- as_fn_error $? "Unsupported pointer size: ${ac_cv_sizeof_void_p}" "$LINENO" 5
- fi
-fi
-cat >>confdefs.h <<_ACEOF
-#define LG_SIZEOF_PTR $LG_SIZEOF_PTR
-_ACEOF
-
-
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of int" >&5
-$as_echo_n "checking size of int... " >&6; }
-if ${ac_cv_sizeof_int+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (int))" "ac_cv_sizeof_int" "$ac_includes_default"; then :
-
-else
- if test "$ac_cv_type_int" = yes; then
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (int)
-See \`config.log' for more details" "$LINENO" 5; }
- else
- ac_cv_sizeof_int=0
- fi
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_int" >&5
-$as_echo "$ac_cv_sizeof_int" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_INT $ac_cv_sizeof_int
-_ACEOF
-
-
-if test "x${ac_cv_sizeof_int}" = "x8" ; then
- LG_SIZEOF_INT=3
-elif test "x${ac_cv_sizeof_int}" = "x4" ; then
- LG_SIZEOF_INT=2
-else
- as_fn_error $? "Unsupported int size: ${ac_cv_sizeof_int}" "$LINENO" 5
-fi
-cat >>confdefs.h <<_ACEOF
-#define LG_SIZEOF_INT $LG_SIZEOF_INT
-_ACEOF
-
-
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long" >&5
-$as_echo_n "checking size of long... " >&6; }
-if ${ac_cv_sizeof_long+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long))" "ac_cv_sizeof_long" "$ac_includes_default"; then :
-
-else
- if test "$ac_cv_type_long" = yes; then
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (long)
-See \`config.log' for more details" "$LINENO" 5; }
- else
- ac_cv_sizeof_long=0
- fi
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long" >&5
-$as_echo "$ac_cv_sizeof_long" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG $ac_cv_sizeof_long
-_ACEOF
-
-
-if test "x${ac_cv_sizeof_long}" = "x8" ; then
- LG_SIZEOF_LONG=3
-elif test "x${ac_cv_sizeof_long}" = "x4" ; then
- LG_SIZEOF_LONG=2
-else
- as_fn_error $? "Unsupported long size: ${ac_cv_sizeof_long}" "$LINENO" 5
-fi
-cat >>confdefs.h <<_ACEOF
-#define LG_SIZEOF_LONG $LG_SIZEOF_LONG
-_ACEOF
-
-
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long long" >&5
-$as_echo_n "checking size of long long... " >&6; }
-if ${ac_cv_sizeof_long_long+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long long))" "ac_cv_sizeof_long_long" "$ac_includes_default"; then :
-
-else
- if test "$ac_cv_type_long_long" = yes; then
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (long long)
-See \`config.log' for more details" "$LINENO" 5; }
- else
- ac_cv_sizeof_long_long=0
- fi
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_long" >&5
-$as_echo "$ac_cv_sizeof_long_long" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
-_ACEOF
-
-
-if test "x${ac_cv_sizeof_long_long}" = "x8" ; then
- LG_SIZEOF_LONG_LONG=3
-elif test "x${ac_cv_sizeof_long_long}" = "x4" ; then
- LG_SIZEOF_LONG_LONG=2
-else
- as_fn_error $? "Unsupported long long size: ${ac_cv_sizeof_long_long}" "$LINENO" 5
-fi
-cat >>confdefs.h <<_ACEOF
-#define LG_SIZEOF_LONG_LONG $LG_SIZEOF_LONG_LONG
-_ACEOF
-
-
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of intmax_t" >&5
-$as_echo_n "checking size of intmax_t... " >&6; }
-if ${ac_cv_sizeof_intmax_t+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (intmax_t))" "ac_cv_sizeof_intmax_t" "$ac_includes_default"; then :
-
-else
- if test "$ac_cv_type_intmax_t" = yes; then
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (intmax_t)
-See \`config.log' for more details" "$LINENO" 5; }
- else
- ac_cv_sizeof_intmax_t=0
- fi
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_intmax_t" >&5
-$as_echo "$ac_cv_sizeof_intmax_t" >&6; }
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_INTMAX_T $ac_cv_sizeof_intmax_t
-_ACEOF
-
-
-if test "x${ac_cv_sizeof_intmax_t}" = "x16" ; then
- LG_SIZEOF_INTMAX_T=4
-elif test "x${ac_cv_sizeof_intmax_t}" = "x8" ; then
- LG_SIZEOF_INTMAX_T=3
-elif test "x${ac_cv_sizeof_intmax_t}" = "x4" ; then
- LG_SIZEOF_INTMAX_T=2
-else
- as_fn_error $? "Unsupported intmax_t size: ${ac_cv_sizeof_intmax_t}" "$LINENO" 5
-fi
-cat >>confdefs.h <<_ACEOF
-#define LG_SIZEOF_INTMAX_T $LG_SIZEOF_INTMAX_T
-_ACEOF
-
-
-# Make sure we can run config.sub.
-$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
- as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
-$as_echo_n "checking build system type... " >&6; }
-if ${ac_cv_build+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_build_alias=$build_alias
-test "x$ac_build_alias" = x &&
- ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
-test "x$ac_build_alias" = x &&
- as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
-ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
- as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
-$as_echo "$ac_cv_build" >&6; }
-case $ac_cv_build in
-*-*-*) ;;
-*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
-esac
-build=$ac_cv_build
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_build
-shift
-build_cpu=$1
-build_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-build_os=$*
-IFS=$ac_save_IFS
-case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
-$as_echo_n "checking host system type... " >&6; }
-if ${ac_cv_host+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test "x$host_alias" = x; then
- ac_cv_host=$ac_cv_build
-else
- ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
- as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
-$as_echo "$ac_cv_host" >&6; }
-case $ac_cv_host in
-*-*-*) ;;
-*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
-esac
-host=$ac_cv_host
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_host
-shift
-host_cpu=$1
-host_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-host_os=$*
-IFS=$ac_save_IFS
-case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
-
-
-CPU_SPINWAIT=""
-case "${host_cpu}" in
- i686|x86_64)
- if test "x${je_cv_msvc}" = "xyes" ; then
- if ${je_cv_pause_msvc+:} false; then :
- $as_echo_n "(cached) " >&6
-else
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pause instruction MSVC is compilable" >&5
-$as_echo_n "checking whether pause instruction MSVC is compilable... " >&6; }
-if ${je_cv_pause_msvc+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-_mm_pause(); return 0;
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_pause_msvc=yes
-else
- je_cv_pause_msvc=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_pause_msvc" >&5
-$as_echo "$je_cv_pause_msvc" >&6; }
-
-fi
-
- if test "x${je_cv_pause_msvc}" = "xyes" ; then
- CPU_SPINWAIT='_mm_pause()'
- fi
- else
- if ${je_cv_pause+:} false; then :
- $as_echo_n "(cached) " >&6
-else
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pause instruction is compilable" >&5
-$as_echo_n "checking whether pause instruction is compilable... " >&6; }
-if ${je_cv_pause+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-__asm__ volatile("pause"); return 0;
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_pause=yes
-else
- je_cv_pause=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_pause" >&5
-$as_echo "$je_cv_pause" >&6; }
-
-fi
-
- if test "x${je_cv_pause}" = "xyes" ; then
- CPU_SPINWAIT='__asm__ volatile("pause")'
- fi
- fi
- ;;
- powerpc)
- cat >>confdefs.h <<_ACEOF
-#define HAVE_ALTIVEC
-_ACEOF
-
- ;;
- *)
- ;;
-esac
-cat >>confdefs.h <<_ACEOF
-#define CPU_SPINWAIT $CPU_SPINWAIT
-_ACEOF
-
-
-LD_PRELOAD_VAR="LD_PRELOAD"
-so="so"
-importlib="${so}"
-o="$ac_objext"
-a="a"
-exe="$ac_exeext"
-libprefix="lib"
-link_whole_archive="0"
-DSO_LDFLAGS='-shared -Wl,-soname,$(@F)'
-RPATH='-Wl,-rpath,$(1)'
-SOREV="${so}.${rev}"
-PIC_CFLAGS='-fPIC -DPIC'
-CTARGET='-o $@'
-LDTARGET='-o $@'
-TEST_LD_MODE=
-EXTRA_LDFLAGS=
-ARFLAGS='crus'
-AROUT=' $@'
-CC_MM=1
-
-if test "x$je_cv_cray_prgenv_wrapper" = "xyes" ; then
- TEST_LD_MODE='-dynamic'
-fi
-
-if test "x${je_cv_cray}" = "xyes" ; then
- CC_MM=
-fi
-
-
-
-
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ar; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_AR+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$AR"; then
- ac_cv_prog_AR="$AR" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_AR="${ac_tool_prefix}ar"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-AR=$ac_cv_prog_AR
-if test -n "$AR"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
-$as_echo "$AR" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_AR"; then
- ac_ct_AR=$AR
- # Extract the first word of "ar", so it can be a program name with args.
-set dummy ar; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_AR+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_AR"; then
- ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_AR="ar"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_AR=$ac_cv_prog_ac_ct_AR
-if test -n "$ac_ct_AR"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
-$as_echo "$ac_ct_AR" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_ct_AR" = x; then
- AR=":"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- AR=$ac_ct_AR
- fi
-else
- AR="$ac_cv_prog_AR"
-fi
-
-
-CFLAGS="$CFLAGS"
-default_munmap="1"
-maps_coalesce="1"
-case "${host}" in
- *-*-darwin* | *-*-ios*)
- abi="macho"
- $as_echo "#define JEMALLOC_PURGE_MADVISE_FREE " >>confdefs.h
-
- RPATH=""
- LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES"
- so="dylib"
- importlib="${so}"
- force_tls="0"
- DSO_LDFLAGS='-shared -Wl,-install_name,$(LIBDIR)/$(@F)'
- SOREV="${rev}.${so}"
- sbrk_deprecated="1"
- ;;
- *-*-freebsd*)
- abi="elf"
- $as_echo "#define JEMALLOC_SYSCTL_VM_OVERCOMMIT " >>confdefs.h
-
- $as_echo "#define JEMALLOC_PURGE_MADVISE_FREE " >>confdefs.h
-
- force_lazy_lock="1"
- ;;
- *-*-dragonfly*)
- abi="elf"
- $as_echo "#define JEMALLOC_PURGE_MADVISE_FREE " >>confdefs.h
-
- ;;
- *-*-openbsd*)
- abi="elf"
- $as_echo "#define JEMALLOC_PURGE_MADVISE_FREE " >>confdefs.h
-
- force_tls="0"
- ;;
- *-*-bitrig*)
- abi="elf"
- $as_echo "#define JEMALLOC_PURGE_MADVISE_FREE " >>confdefs.h
-
- ;;
- *-*-linux*)
- CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
- abi="elf"
- $as_echo "#define JEMALLOC_HAS_ALLOCA_H 1" >>confdefs.h
-
- $as_echo "#define JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY " >>confdefs.h
-
- $as_echo "#define JEMALLOC_PURGE_MADVISE_DONTNEED " >>confdefs.h
-
- $as_echo "#define JEMALLOC_THREADED_INIT " >>confdefs.h
-
- $as_echo "#define JEMALLOC_USE_CXX_THROW " >>confdefs.h
-
- default_munmap="0"
- ;;
- *-*-netbsd*)
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking ABI" >&5
-$as_echo_n "checking ABI... " >&6; }
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#ifdef __ELF__
-/* ELF */
-#else
-#error aout
-#endif
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- abi="elf"
-else
- abi="aout"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $abi" >&5
-$as_echo "$abi" >&6; }
- $as_echo "#define JEMALLOC_PURGE_MADVISE_FREE " >>confdefs.h
-
- ;;
- *-*-solaris2*)
- abi="elf"
- $as_echo "#define JEMALLOC_PURGE_MADVISE_FREE " >>confdefs.h
-
- RPATH='-Wl,-R,$(1)'
- CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
- LIBS="$LIBS -lposix4 -lsocket -lnsl"
- ;;
- *-ibm-aix*)
- if "$LG_SIZEOF_PTR" = "8"; then
- LD_PRELOAD_VAR="LDR_PRELOAD64"
- else
- LD_PRELOAD_VAR="LDR_PRELOAD"
- fi
- abi="xcoff"
- ;;
- *-*-mingw* | *-*-cygwin*)
- abi="pecoff"
- force_tls="0"
- maps_coalesce="0"
- RPATH=""
- so="dll"
- if test "x$je_cv_msvc" = "xyes" ; then
- importlib="lib"
- DSO_LDFLAGS="-LD"
- EXTRA_LDFLAGS="-link -DEBUG"
- CTARGET='-Fo$@'
- LDTARGET='-Fe$@'
- AR='lib'
- ARFLAGS='-nologo -out:'
- AROUT='$@'
- CC_MM=
- else
- importlib="${so}"
- DSO_LDFLAGS="-shared"
- link_whole_archive="1"
- fi
- a="lib"
- libprefix=""
- SOREV="${so}"
- PIC_CFLAGS=""
- ;;
- *)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Unsupported operating system: ${host}" >&5
-$as_echo "Unsupported operating system: ${host}" >&6; }
- abi="elf"
- ;;
-esac
-
-JEMALLOC_USABLE_SIZE_CONST=const
-for ac_header in malloc.h
-do :
- ac_fn_c_check_header_mongrel "$LINENO" "malloc.h" "ac_cv_header_malloc_h" "$ac_includes_default"
-if test "x$ac_cv_header_malloc_h" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_MALLOC_H 1
-_ACEOF
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether malloc_usable_size definition can use const argument" >&5
-$as_echo_n "checking whether malloc_usable_size definition can use const argument... " >&6; }
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <malloc.h>
- #include <stddef.h>
- size_t malloc_usable_size(const void *ptr);
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-else
-
- JEMALLOC_USABLE_SIZE_CONST=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-fi
-
-done
-
-cat >>confdefs.h <<_ACEOF
-#define JEMALLOC_USABLE_SIZE_CONST $JEMALLOC_USABLE_SIZE_CONST
-_ACEOF
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing log" >&5
-$as_echo_n "checking for library containing log... " >&6; }
-if ${ac_cv_search_log+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char log ();
-int
-main ()
-{
-return log ();
- ;
- return 0;
-}
-_ACEOF
-for ac_lib in '' m; do
- if test -z "$ac_lib"; then
- ac_res="none required"
- else
- ac_res=-l$ac_lib
- LIBS="-l$ac_lib $ac_func_search_save_LIBS"
- fi
- if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_search_log=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext
- if ${ac_cv_search_log+:} false; then :
- break
-fi
-done
-if ${ac_cv_search_log+:} false; then :
-
-else
- ac_cv_search_log=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_log" >&5
-$as_echo "$ac_cv_search_log" >&6; }
-ac_res=$ac_cv_search_log
-if test "$ac_res" != no; then :
- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-else
- as_fn_error $? "Missing math functions" "$LINENO" 5
-fi
-
-if test "x$ac_cv_search_log" != "xnone required" ; then
- LM="$ac_cv_search_log"
-else
- LM=
-fi
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether __attribute__ syntax is compilable" >&5
-$as_echo_n "checking whether __attribute__ syntax is compilable... " >&6; }
-if ${je_cv_attribute+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-static __attribute__((unused)) void foo(void){}
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_attribute=yes
-else
- je_cv_attribute=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_attribute" >&5
-$as_echo "$je_cv_attribute" >&6; }
-
-if test "x${je_cv_attribute}" = "xyes" ; then
- $as_echo "#define JEMALLOC_HAVE_ATTR " >>confdefs.h
-
- if test "x${GCC}" = "xyes" -a "x${abi}" = "xelf"; then
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -fvisibility=hidden" >&5
-$as_echo_n "checking whether compiler supports -fvisibility=hidden... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-fvisibility=hidden"
-else
- CFLAGS="${CFLAGS} -fvisibility=hidden"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-fvisibility=hidden
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
- fi
-fi
-SAVED_CFLAGS="${CFLAGS}"
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -Werror" >&5
-$as_echo_n "checking whether compiler supports -Werror... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-Werror"
-else
- CFLAGS="${CFLAGS} -Werror"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-Werror
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -herror_on_warning" >&5
-$as_echo_n "checking whether compiler supports -herror_on_warning... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-herror_on_warning"
-else
- CFLAGS="${CFLAGS} -herror_on_warning"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-herror_on_warning
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether tls_model attribute is compilable" >&5
-$as_echo_n "checking whether tls_model attribute is compilable... " >&6; }
-if ${je_cv_tls_model+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-static __thread int
- __attribute__((tls_model("initial-exec"), unused)) foo;
- foo = 0;
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_tls_model=yes
-else
- je_cv_tls_model=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_tls_model" >&5
-$as_echo "$je_cv_tls_model" >&6; }
-
-CFLAGS="${SAVED_CFLAGS}"
-if test "x${je_cv_tls_model}" = "xyes" ; then
- $as_echo "#define JEMALLOC_TLS_MODEL __attribute__((tls_model(\"initial-exec\")))" >>confdefs.h
-
-else
- $as_echo "#define JEMALLOC_TLS_MODEL " >>confdefs.h
-
-fi
-SAVED_CFLAGS="${CFLAGS}"
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -Werror" >&5
-$as_echo_n "checking whether compiler supports -Werror... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-Werror"
-else
- CFLAGS="${CFLAGS} -Werror"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-Werror
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -herror_on_warning" >&5
-$as_echo_n "checking whether compiler supports -herror_on_warning... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-herror_on_warning"
-else
- CFLAGS="${CFLAGS} -herror_on_warning"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-herror_on_warning
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether alloc_size attribute is compilable" >&5
-$as_echo_n "checking whether alloc_size attribute is compilable... " >&6; }
-if ${je_cv_alloc_size+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <stdlib.h>
-int
-main ()
-{
-void *foo(size_t size) __attribute__((alloc_size(1)));
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_alloc_size=yes
-else
- je_cv_alloc_size=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_alloc_size" >&5
-$as_echo "$je_cv_alloc_size" >&6; }
-
-CFLAGS="${SAVED_CFLAGS}"
-if test "x${je_cv_alloc_size}" = "xyes" ; then
- $as_echo "#define JEMALLOC_HAVE_ATTR_ALLOC_SIZE " >>confdefs.h
-
-fi
-SAVED_CFLAGS="${CFLAGS}"
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -Werror" >&5
-$as_echo_n "checking whether compiler supports -Werror... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-Werror"
-else
- CFLAGS="${CFLAGS} -Werror"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-Werror
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -herror_on_warning" >&5
-$as_echo_n "checking whether compiler supports -herror_on_warning... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-herror_on_warning"
-else
- CFLAGS="${CFLAGS} -herror_on_warning"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-herror_on_warning
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether format(gnu_printf, ...) attribute is compilable" >&5
-$as_echo_n "checking whether format(gnu_printf, ...) attribute is compilable... " >&6; }
-if ${je_cv_format_gnu_printf+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <stdlib.h>
-int
-main ()
-{
-void *foo(const char *format, ...) __attribute__((format(gnu_printf, 1, 2)));
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_format_gnu_printf=yes
-else
- je_cv_format_gnu_printf=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_format_gnu_printf" >&5
-$as_echo "$je_cv_format_gnu_printf" >&6; }
-
-CFLAGS="${SAVED_CFLAGS}"
-if test "x${je_cv_format_gnu_printf}" = "xyes" ; then
- $as_echo "#define JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF " >>confdefs.h
-
-fi
-SAVED_CFLAGS="${CFLAGS}"
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -Werror" >&5
-$as_echo_n "checking whether compiler supports -Werror... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-Werror"
-else
- CFLAGS="${CFLAGS} -Werror"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-Werror
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -herror_on_warning" >&5
-$as_echo_n "checking whether compiler supports -herror_on_warning... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-herror_on_warning"
-else
- CFLAGS="${CFLAGS} -herror_on_warning"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-herror_on_warning
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether format(printf, ...) attribute is compilable" >&5
-$as_echo_n "checking whether format(printf, ...) attribute is compilable... " >&6; }
-if ${je_cv_format_printf+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <stdlib.h>
-int
-main ()
-{
-void *foo(const char *format, ...) __attribute__((format(printf, 1, 2)));
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_format_printf=yes
-else
- je_cv_format_printf=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_format_printf" >&5
-$as_echo "$je_cv_format_printf" >&6; }
-
-CFLAGS="${SAVED_CFLAGS}"
-if test "x${je_cv_format_printf}" = "xyes" ; then
- $as_echo "#define JEMALLOC_HAVE_ATTR_FORMAT_PRINTF " >>confdefs.h
-
-fi
-
-
-# Check whether --with-rpath was given.
-if test "${with_rpath+set}" = set; then :
- withval=$with_rpath; if test "x$with_rpath" = "xno" ; then
- RPATH_EXTRA=
-else
- RPATH_EXTRA="`echo $with_rpath | tr \":\" \" \"`"
-fi
-else
- RPATH_EXTRA=
-
-fi
-
-
-
-# Check whether --enable-autogen was given.
-if test "${enable_autogen+set}" = set; then :
- enableval=$enable_autogen; if test "x$enable_autogen" = "xno" ; then
- enable_autogen="0"
-else
- enable_autogen="1"
-fi
-
-else
- enable_autogen="0"
-
-fi
-
-
-
-# Find a good install program. We prefer a C program (faster),
-# so one script is as good as another. But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AmigaOS /C/install, which installs bootblocks on floppy discs
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# OS/2's system install, which has a completely different semantic
-# ./install, which can be erroneously created by make from ./install.sh.
-# Reject install programs that cannot install multiple files.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
-$as_echo_n "checking for a BSD-compatible install... " >&6; }
-if test -z "$INSTALL"; then
-if ${ac_cv_path_install+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- # Account for people who put trailing slashes in PATH elements.
-case $as_dir/ in #((
- ./ | .// | /[cC]/* | \
- /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
- ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
- /usr/ucb/* ) ;;
- *)
- # OSF1 and SCO ODT 3.0 have their own names for install.
- # Don't use installbsd from OSF since it installs stuff as root
- # by default.
- for ac_prog in ginstall scoinst install; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
- if test $ac_prog = install &&
- grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
- # AIX install. It has an incompatible calling convention.
- :
- elif test $ac_prog = install &&
- grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
- # program-specific install script used by HP pwplus--don't use.
- :
- else
- rm -rf conftest.one conftest.two conftest.dir
- echo one > conftest.one
- echo two > conftest.two
- mkdir conftest.dir
- if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
- test -s conftest.one && test -s conftest.two &&
- test -s conftest.dir/conftest.one &&
- test -s conftest.dir/conftest.two
- then
- ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
- break 3
- fi
- fi
- fi
- done
- done
- ;;
-esac
-
- done
-IFS=$as_save_IFS
-
-rm -rf conftest.one conftest.two conftest.dir
-
-fi
- if test "${ac_cv_path_install+set}" = set; then
- INSTALL=$ac_cv_path_install
- else
- # As a last resort, use the slow shell script. Don't cache a
- # value for INSTALL within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the value is a relative name.
- INSTALL=$ac_install_sh
- fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
-$as_echo "$INSTALL" >&6; }
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_RANLIB+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-RANLIB=$ac_cv_prog_RANLIB
-if test -n "$RANLIB"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
-$as_echo "$RANLIB" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_RANLIB"; then
- ac_ct_RANLIB=$RANLIB
- # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_RANLIB"; then
- ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_RANLIB="ranlib"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
-if test -n "$ac_ct_RANLIB"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
-$as_echo "$ac_ct_RANLIB" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_ct_RANLIB" = x; then
- RANLIB=":"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- RANLIB=$ac_ct_RANLIB
- fi
-else
- RANLIB="$ac_cv_prog_RANLIB"
-fi
-
-# Extract the first word of "ld", so it can be a program name with args.
-set dummy ld; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_LD+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- case $LD in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_LD="$LD" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_LD="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- test -z "$ac_cv_path_LD" && ac_cv_path_LD="false"
- ;;
-esac
-fi
-LD=$ac_cv_path_LD
-if test -n "$LD"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
-$as_echo "$LD" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-# Extract the first word of "autoconf", so it can be a program name with args.
-set dummy autoconf; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_AUTOCONF+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- case $AUTOCONF in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_AUTOCONF="$AUTOCONF" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_AUTOCONF="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- test -z "$ac_cv_path_AUTOCONF" && ac_cv_path_AUTOCONF="false"
- ;;
-esac
-fi
-AUTOCONF=$ac_cv_path_AUTOCONF
-if test -n "$AUTOCONF"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AUTOCONF" >&5
-$as_echo "$AUTOCONF" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-
-public_syms="malloc_conf malloc_message malloc calloc posix_memalign aligned_alloc realloc free mallocx rallocx xallocx sallocx dallocx sdallocx nallocx mallctl mallctlnametomib mallctlbymib malloc_stats_print malloc_usable_size"
-
-ac_fn_c_check_func "$LINENO" "memalign" "ac_cv_func_memalign"
-if test "x$ac_cv_func_memalign" = xyes; then :
- $as_echo "#define JEMALLOC_OVERRIDE_MEMALIGN " >>confdefs.h
-
- public_syms="${public_syms} memalign"
-fi
-
-ac_fn_c_check_func "$LINENO" "valloc" "ac_cv_func_valloc"
-if test "x$ac_cv_func_valloc" = xyes; then :
- $as_echo "#define JEMALLOC_OVERRIDE_VALLOC " >>confdefs.h
-
- public_syms="${public_syms} valloc"
-fi
-
-
-GCOV_FLAGS=
-# Check whether --enable-code-coverage was given.
-if test "${enable_code_coverage+set}" = set; then :
- enableval=$enable_code_coverage; if test "x$enable_code_coverage" = "xno" ; then
- enable_code_coverage="0"
-else
- enable_code_coverage="1"
-fi
-
-else
- enable_code_coverage="0"
-
-fi
-
-if test "x$enable_code_coverage" = "x1" ; then
- deoptimize="no"
- echo "$CFLAGS $EXTRA_CFLAGS" | grep '\-O' >/dev/null || deoptimize="yes"
- if test "x${deoptimize}" = "xyes" ; then
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -O0" >&5
-$as_echo_n "checking whether compiler supports -O0... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-O0"
-else
- CFLAGS="${CFLAGS} -O0"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-O0
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
- fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -fprofile-arcs -ftest-coverage" >&5
-$as_echo_n "checking whether compiler supports -fprofile-arcs -ftest-coverage... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-fprofile-arcs -ftest-coverage"
-else
- CFLAGS="${CFLAGS} -fprofile-arcs -ftest-coverage"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-fprofile-arcs -ftest-coverage
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
- EXTRA_LDFLAGS="$EXTRA_LDFLAGS -fprofile-arcs -ftest-coverage"
- $as_echo "#define JEMALLOC_CODE_COVERAGE " >>confdefs.h
-
-fi
-
-
-
-# Check whether --with-mangling was given.
-if test "${with_mangling+set}" = set; then :
- withval=$with_mangling; mangling_map="$with_mangling"
-else
- mangling_map=""
-fi
-
-
-
-# Check whether --with-jemalloc_prefix was given.
-if test "${with_jemalloc_prefix+set}" = set; then :
- withval=$with_jemalloc_prefix; JEMALLOC_PREFIX="$with_jemalloc_prefix"
-else
- if test "x$abi" != "xmacho" -a "x$abi" != "xpecoff"; then
- JEMALLOC_PREFIX=""
-else
- JEMALLOC_PREFIX="je_"
-fi
-
-fi
-
-if test "x$JEMALLOC_PREFIX" != "x" ; then
- JEMALLOC_CPREFIX=`echo ${JEMALLOC_PREFIX} | tr "a-z" "A-Z"`
- cat >>confdefs.h <<_ACEOF
-#define JEMALLOC_PREFIX "$JEMALLOC_PREFIX"
-_ACEOF
-
- cat >>confdefs.h <<_ACEOF
-#define JEMALLOC_CPREFIX "$JEMALLOC_CPREFIX"
-_ACEOF
-
-fi
-
-
-
-# Check whether --with-export was given.
-if test "${with_export+set}" = set; then :
- withval=$with_export; if test "x$with_export" = "xno"; then
- $as_echo "#define JEMALLOC_EXPORT /**/" >>confdefs.h
-
-fi
-
-fi
-
-
-
-# Check whether --with-private_namespace was given.
-if test "${with_private_namespace+set}" = set; then :
- withval=$with_private_namespace; JEMALLOC_PRIVATE_NAMESPACE="${with_private_namespace}je_"
-else
- JEMALLOC_PRIVATE_NAMESPACE="je_"
-
-fi
-
-cat >>confdefs.h <<_ACEOF
-#define JEMALLOC_PRIVATE_NAMESPACE $JEMALLOC_PRIVATE_NAMESPACE
-_ACEOF
-
-private_namespace="$JEMALLOC_PRIVATE_NAMESPACE"
-
-
-
-# Check whether --with-install_suffix was given.
-if test "${with_install_suffix+set}" = set; then :
- withval=$with_install_suffix; INSTALL_SUFFIX="$with_install_suffix"
-else
- INSTALL_SUFFIX=
-
-fi
-
-install_suffix="$INSTALL_SUFFIX"
-
-
-
-# Check whether --with-malloc_conf was given.
-if test "${with_malloc_conf+set}" = set; then :
- withval=$with_malloc_conf; JEMALLOC_CONFIG_MALLOC_CONF="$with_malloc_conf"
-else
- JEMALLOC_CONFIG_MALLOC_CONF=""
-
-fi
-
-config_malloc_conf="$JEMALLOC_CONFIG_MALLOC_CONF"
-cat >>confdefs.h <<_ACEOF
-#define JEMALLOC_CONFIG_MALLOC_CONF "$config_malloc_conf"
-_ACEOF
-
-
-je_="je_"
-
-
-cfgoutputs_in="Makefile.in"
-cfgoutputs_in="${cfgoutputs_in} jemalloc.pc.in"
-cfgoutputs_in="${cfgoutputs_in} doc/html.xsl.in"
-cfgoutputs_in="${cfgoutputs_in} doc/manpages.xsl.in"
-cfgoutputs_in="${cfgoutputs_in} doc/jemalloc.xml.in"
-cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_macros.h.in"
-cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_protos.h.in"
-cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_typedefs.h.in"
-cfgoutputs_in="${cfgoutputs_in} include/jemalloc/internal/jemalloc_internal.h.in"
-cfgoutputs_in="${cfgoutputs_in} test/test.sh.in"
-cfgoutputs_in="${cfgoutputs_in} test/include/test/jemalloc_test.h.in"
-
-cfgoutputs_out="Makefile"
-cfgoutputs_out="${cfgoutputs_out} jemalloc.pc"
-cfgoutputs_out="${cfgoutputs_out} doc/html.xsl"
-cfgoutputs_out="${cfgoutputs_out} doc/manpages.xsl"
-cfgoutputs_out="${cfgoutputs_out} doc/jemalloc.xml"
-cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_macros.h"
-cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_protos.h"
-cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_typedefs.h"
-cfgoutputs_out="${cfgoutputs_out} include/jemalloc/internal/jemalloc_internal.h"
-cfgoutputs_out="${cfgoutputs_out} test/test.sh"
-cfgoutputs_out="${cfgoutputs_out} test/include/test/jemalloc_test.h"
-
-cfgoutputs_tup="Makefile"
-cfgoutputs_tup="${cfgoutputs_tup} jemalloc.pc:jemalloc.pc.in"
-cfgoutputs_tup="${cfgoutputs_tup} doc/html.xsl:doc/html.xsl.in"
-cfgoutputs_tup="${cfgoutputs_tup} doc/manpages.xsl:doc/manpages.xsl.in"
-cfgoutputs_tup="${cfgoutputs_tup} doc/jemalloc.xml:doc/jemalloc.xml.in"
-cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_macros.h:include/jemalloc/jemalloc_macros.h.in"
-cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_protos.h:include/jemalloc/jemalloc_protos.h.in"
-cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_typedefs.h:include/jemalloc/jemalloc_typedefs.h.in"
-cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/internal/jemalloc_internal.h"
-cfgoutputs_tup="${cfgoutputs_tup} test/test.sh:test/test.sh.in"
-cfgoutputs_tup="${cfgoutputs_tup} test/include/test/jemalloc_test.h:test/include/test/jemalloc_test.h.in"
-
-cfghdrs_in="include/jemalloc/jemalloc_defs.h.in"
-cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/jemalloc_internal_defs.h.in"
-cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_namespace.sh"
-cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_unnamespace.sh"
-cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_symbols.txt"
-cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_namespace.sh"
-cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_unnamespace.sh"
-cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/size_classes.sh"
-cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_rename.sh"
-cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_mangle.sh"
-cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc.sh"
-cfghdrs_in="${cfghdrs_in} test/include/test/jemalloc_test_defs.h.in"
-
-cfghdrs_out="include/jemalloc/jemalloc_defs.h"
-cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc${install_suffix}.h"
-cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_namespace.h"
-cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_unnamespace.h"
-cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_symbols.txt"
-cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_namespace.h"
-cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_unnamespace.h"
-cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/size_classes.h"
-cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_protos_jet.h"
-cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_rename.h"
-cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle.h"
-cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle_jet.h"
-cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/jemalloc_internal_defs.h"
-cfghdrs_out="${cfghdrs_out} test/include/test/jemalloc_test_defs.h"
-
-cfghdrs_tup="include/jemalloc/jemalloc_defs.h:include/jemalloc/jemalloc_defs.h.in"
-cfghdrs_tup="${cfghdrs_tup} include/jemalloc/internal/jemalloc_internal_defs.h:include/jemalloc/internal/jemalloc_internal_defs.h.in"
-cfghdrs_tup="${cfghdrs_tup} test/include/test/jemalloc_test_defs.h:test/include/test/jemalloc_test_defs.h.in"
-
-# Check whether --enable-cc-silence was given.
-if test "${enable_cc_silence+set}" = set; then :
- enableval=$enable_cc_silence; if test "x$enable_cc_silence" = "xno" ; then
- enable_cc_silence="0"
-else
- enable_cc_silence="1"
-fi
-
-else
- enable_cc_silence="1"
-
-fi
-
-if test "x$enable_cc_silence" = "x1" ; then
- $as_echo "#define JEMALLOC_CC_SILENCE " >>confdefs.h
-
-fi
-
-# Check whether --enable-debug was given.
-if test "${enable_debug+set}" = set; then :
- enableval=$enable_debug; if test "x$enable_debug" = "xno" ; then
- enable_debug="0"
-else
- enable_debug="1"
-fi
-
-else
- enable_debug="0"
-
-fi
-
-if test "x$enable_debug" = "x1" ; then
- $as_echo "#define JEMALLOC_DEBUG " >>confdefs.h
-
-fi
-if test "x$enable_debug" = "x1" ; then
- $as_echo "#define JEMALLOC_DEBUG " >>confdefs.h
-
- enable_ivsalloc="1"
-fi
-
-
-# Check whether --enable-ivsalloc was given.
-if test "${enable_ivsalloc+set}" = set; then :
- enableval=$enable_ivsalloc; if test "x$enable_ivsalloc" = "xno" ; then
- enable_ivsalloc="0"
-else
- enable_ivsalloc="1"
-fi
-
-else
- enable_ivsalloc="0"
-
-fi
-
-if test "x$enable_ivsalloc" = "x1" ; then
- $as_echo "#define JEMALLOC_IVSALLOC " >>confdefs.h
-
-fi
-
-if test "x$enable_debug" = "x0" -a "x$no_CFLAGS" = "xyes" ; then
- optimize="no"
- echo "$CFLAGS $EXTRA_CFLAGS" | grep '\-O' >/dev/null || optimize="yes"
- if test "x${optimize}" = "xyes" ; then
- if test "x$GCC" = "xyes" ; then
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -O3" >&5
-$as_echo_n "checking whether compiler supports -O3... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-O3"
-else
- CFLAGS="${CFLAGS} -O3"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-O3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -funroll-loops" >&5
-$as_echo_n "checking whether compiler supports -funroll-loops... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-funroll-loops"
-else
- CFLAGS="${CFLAGS} -funroll-loops"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-funroll-loops
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
- elif test "x$je_cv_msvc" = "xyes" ; then
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -O2" >&5
-$as_echo_n "checking whether compiler supports -O2... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-O2"
-else
- CFLAGS="${CFLAGS} -O2"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-O2
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
- else
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -O" >&5
-$as_echo_n "checking whether compiler supports -O... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-O"
-else
- CFLAGS="${CFLAGS} -O"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-O
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
- fi
- fi
-fi
-
-# Check whether --enable-stats was given.
-if test "${enable_stats+set}" = set; then :
- enableval=$enable_stats; if test "x$enable_stats" = "xno" ; then
- enable_stats="0"
-else
- enable_stats="1"
-fi
-
-else
- enable_stats="1"
-
-fi
-
-if test "x$enable_stats" = "x1" ; then
- $as_echo "#define JEMALLOC_STATS " >>confdefs.h
-
-fi
-
-
-# Check whether --enable-prof was given.
-if test "${enable_prof+set}" = set; then :
- enableval=$enable_prof; if test "x$enable_prof" = "xno" ; then
- enable_prof="0"
-else
- enable_prof="1"
-fi
-
-else
- enable_prof="0"
-
-fi
-
-if test "x$enable_prof" = "x1" ; then
- backtrace_method=""
-else
- backtrace_method="N/A"
-fi
-
-# Check whether --enable-prof-libunwind was given.
-if test "${enable_prof_libunwind+set}" = set; then :
- enableval=$enable_prof_libunwind; if test "x$enable_prof_libunwind" = "xno" ; then
- enable_prof_libunwind="0"
-else
- enable_prof_libunwind="1"
-fi
-
-else
- enable_prof_libunwind="0"
-
-fi
-
-
-# Check whether --with-static_libunwind was given.
-if test "${with_static_libunwind+set}" = set; then :
- withval=$with_static_libunwind; if test "x$with_static_libunwind" = "xno" ; then
- LUNWIND="-lunwind"
-else
- if test ! -f "$with_static_libunwind" ; then
- as_fn_error $? "Static libunwind not found: $with_static_libunwind" "$LINENO" 5
- fi
- LUNWIND="$with_static_libunwind"
-fi
-else
- LUNWIND="-lunwind"
-
-fi
-
-if test "x$backtrace_method" = "x" -a "x$enable_prof_libunwind" = "x1" ; then
- for ac_header in libunwind.h
-do :
- ac_fn_c_check_header_mongrel "$LINENO" "libunwind.h" "ac_cv_header_libunwind_h" "$ac_includes_default"
-if test "x$ac_cv_header_libunwind_h" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBUNWIND_H 1
-_ACEOF
-
-else
- enable_prof_libunwind="0"
-fi
-
-done
-
- if test "x$LUNWIND" = "x-lunwind" ; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for unw_backtrace in -lunwind" >&5
-$as_echo_n "checking for unw_backtrace in -lunwind... " >&6; }
-if ${ac_cv_lib_unwind_unw_backtrace+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lunwind $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char unw_backtrace ();
-int
-main ()
-{
-return unw_backtrace ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_unwind_unw_backtrace=yes
-else
- ac_cv_lib_unwind_unw_backtrace=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_unwind_unw_backtrace" >&5
-$as_echo "$ac_cv_lib_unwind_unw_backtrace" >&6; }
-if test "x$ac_cv_lib_unwind_unw_backtrace" = xyes; then :
- LIBS="$LIBS $LUNWIND"
-else
- enable_prof_libunwind="0"
-fi
-
- else
- LIBS="$LIBS $LUNWIND"
- fi
- if test "x${enable_prof_libunwind}" = "x1" ; then
- backtrace_method="libunwind"
- $as_echo "#define JEMALLOC_PROF_LIBUNWIND " >>confdefs.h
-
- fi
-fi
-
-# Check whether --enable-prof-libgcc was given.
-if test "${enable_prof_libgcc+set}" = set; then :
- enableval=$enable_prof_libgcc; if test "x$enable_prof_libgcc" = "xno" ; then
- enable_prof_libgcc="0"
-else
- enable_prof_libgcc="1"
-fi
-
-else
- enable_prof_libgcc="1"
-
-fi
-
-if test "x$backtrace_method" = "x" -a "x$enable_prof_libgcc" = "x1" \
- -a "x$GCC" = "xyes" ; then
- for ac_header in unwind.h
-do :
- ac_fn_c_check_header_mongrel "$LINENO" "unwind.h" "ac_cv_header_unwind_h" "$ac_includes_default"
-if test "x$ac_cv_header_unwind_h" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_UNWIND_H 1
-_ACEOF
-
-else
- enable_prof_libgcc="0"
-fi
-
-done
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _Unwind_Backtrace in -lgcc" >&5
-$as_echo_n "checking for _Unwind_Backtrace in -lgcc... " >&6; }
-if ${ac_cv_lib_gcc__Unwind_Backtrace+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lgcc $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char _Unwind_Backtrace ();
-int
-main ()
-{
-return _Unwind_Backtrace ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_gcc__Unwind_Backtrace=yes
-else
- ac_cv_lib_gcc__Unwind_Backtrace=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gcc__Unwind_Backtrace" >&5
-$as_echo "$ac_cv_lib_gcc__Unwind_Backtrace" >&6; }
-if test "x$ac_cv_lib_gcc__Unwind_Backtrace" = xyes; then :
- LIBS="$LIBS -lgcc"
-else
- enable_prof_libgcc="0"
-fi
-
- if test "x${enable_prof_libgcc}" = "x1" ; then
- backtrace_method="libgcc"
- $as_echo "#define JEMALLOC_PROF_LIBGCC " >>confdefs.h
-
- fi
-else
- enable_prof_libgcc="0"
-fi
-
-# Check whether --enable-prof-gcc was given.
-if test "${enable_prof_gcc+set}" = set; then :
- enableval=$enable_prof_gcc; if test "x$enable_prof_gcc" = "xno" ; then
- enable_prof_gcc="0"
-else
- enable_prof_gcc="1"
-fi
-
-else
- enable_prof_gcc="1"
-
-fi
-
-if test "x$backtrace_method" = "x" -a "x$enable_prof_gcc" = "x1" \
- -a "x$GCC" = "xyes" ; then
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -fno-omit-frame-pointer" >&5
-$as_echo_n "checking whether compiler supports -fno-omit-frame-pointer... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-fno-omit-frame-pointer"
-else
- CFLAGS="${CFLAGS} -fno-omit-frame-pointer"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-fno-omit-frame-pointer
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
- backtrace_method="gcc intrinsics"
- $as_echo "#define JEMALLOC_PROF_GCC " >>confdefs.h
-
-else
- enable_prof_gcc="0"
-fi
-
-if test "x$backtrace_method" = "x" ; then
- backtrace_method="none (disabling profiling)"
- enable_prof="0"
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking configured backtracing method" >&5
-$as_echo_n "checking configured backtracing method... " >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $backtrace_method" >&5
-$as_echo "$backtrace_method" >&6; }
-if test "x$enable_prof" = "x1" ; then
- if test "x$LM" != "x" ; then
- LIBS="$LIBS $LM"
- fi
-
- $as_echo "#define JEMALLOC_PROF " >>confdefs.h
-
-fi
-
-
-# Check whether --enable-tcache was given.
-if test "${enable_tcache+set}" = set; then :
- enableval=$enable_tcache; if test "x$enable_tcache" = "xno" ; then
- enable_tcache="0"
-else
- enable_tcache="1"
-fi
-
-else
- enable_tcache="1"
-
-fi
-
-if test "x$enable_tcache" = "x1" ; then
- $as_echo "#define JEMALLOC_TCACHE " >>confdefs.h
-
-fi
-
-
-if test "x${maps_coalesce}" = "x1" ; then
- $as_echo "#define JEMALLOC_MAPS_COALESCE " >>confdefs.h
-
-fi
-
-# Check whether --enable-munmap was given.
-if test "${enable_munmap+set}" = set; then :
- enableval=$enable_munmap; if test "x$enable_munmap" = "xno" ; then
- enable_munmap="0"
-else
- enable_munmap="1"
-fi
-
-else
- enable_munmap="${default_munmap}"
-
-fi
-
-if test "x$enable_munmap" = "x1" ; then
- $as_echo "#define JEMALLOC_MUNMAP " >>confdefs.h
-
-fi
-
-
-have_dss="1"
-ac_fn_c_check_func "$LINENO" "sbrk" "ac_cv_func_sbrk"
-if test "x$ac_cv_func_sbrk" = xyes; then :
- have_sbrk="1"
-else
- have_sbrk="0"
-fi
-
-if test "x$have_sbrk" = "x1" ; then
- if test "x$sbrk_deprecated" = "x1" ; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Disabling dss allocation because sbrk is deprecated" >&5
-$as_echo "Disabling dss allocation because sbrk is deprecated" >&6; }
- have_dss="0"
- fi
-else
- have_dss="0"
-fi
-
-if test "x$have_dss" = "x1" ; then
- $as_echo "#define JEMALLOC_DSS " >>confdefs.h
-
-fi
-
-# Check whether --enable-fill was given.
-if test "${enable_fill+set}" = set; then :
- enableval=$enable_fill; if test "x$enable_fill" = "xno" ; then
- enable_fill="0"
-else
- enable_fill="1"
-fi
-
-else
- enable_fill="1"
-
-fi
-
-if test "x$enable_fill" = "x1" ; then
- $as_echo "#define JEMALLOC_FILL " >>confdefs.h
-
-fi
-
-
-# Check whether --enable-utrace was given.
-if test "${enable_utrace+set}" = set; then :
- enableval=$enable_utrace; if test "x$enable_utrace" = "xno" ; then
- enable_utrace="0"
-else
- enable_utrace="1"
-fi
-
-else
- enable_utrace="0"
-
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether utrace(2) is compilable" >&5
-$as_echo_n "checking whether utrace(2) is compilable... " >&6; }
-if ${je_cv_utrace+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/uio.h>
-#include <sys/ktrace.h>
-
-int
-main ()
-{
-
- utrace((void *)0, 0);
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_utrace=yes
-else
- je_cv_utrace=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_utrace" >&5
-$as_echo "$je_cv_utrace" >&6; }
-
-if test "x${je_cv_utrace}" = "xno" ; then
- enable_utrace="0"
-fi
-if test "x$enable_utrace" = "x1" ; then
- $as_echo "#define JEMALLOC_UTRACE " >>confdefs.h
-
-fi
-
-
-# Check whether --enable-valgrind was given.
-if test "${enable_valgrind+set}" = set; then :
- enableval=$enable_valgrind; if test "x$enable_valgrind" = "xno" ; then
- enable_valgrind="0"
-else
- enable_valgrind="1"
-fi
-
-else
- enable_valgrind="1"
-
-fi
-
-if test "x$enable_valgrind" = "x1" ; then
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether valgrind is compilable" >&5
-$as_echo_n "checking whether valgrind is compilable... " >&6; }
-if ${je_cv_valgrind+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-#include <valgrind/valgrind.h>
-#include <valgrind/memcheck.h>
-
-#if !defined(VALGRIND_RESIZEINPLACE_BLOCK)
-# error "Incompatible Valgrind version"
-#endif
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_valgrind=yes
-else
- je_cv_valgrind=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_valgrind" >&5
-$as_echo "$je_cv_valgrind" >&6; }
-
- if test "x${je_cv_valgrind}" = "xno" ; then
- enable_valgrind="0"
- fi
- if test "x$enable_valgrind" = "x1" ; then
- $as_echo "#define JEMALLOC_VALGRIND " >>confdefs.h
-
- fi
-fi
-
-
-# Check whether --enable-xmalloc was given.
-if test "${enable_xmalloc+set}" = set; then :
- enableval=$enable_xmalloc; if test "x$enable_xmalloc" = "xno" ; then
- enable_xmalloc="0"
-else
- enable_xmalloc="1"
-fi
-
-else
- enable_xmalloc="0"
-
-fi
-
-if test "x$enable_xmalloc" = "x1" ; then
- $as_echo "#define JEMALLOC_XMALLOC " >>confdefs.h
-
-fi
-
-
-# Check whether --enable-cache-oblivious was given.
-if test "${enable_cache_oblivious+set}" = set; then :
- enableval=$enable_cache_oblivious; if test "x$enable_cache_oblivious" = "xno" ; then
- enable_cache_oblivious="0"
-else
- enable_cache_oblivious="1"
-fi
-
-else
- enable_cache_oblivious="1"
-
-fi
-
-if test "x$enable_cache_oblivious" = "x1" ; then
- $as_echo "#define JEMALLOC_CACHE_OBLIVIOUS " >>confdefs.h
-
-fi
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program using __builtin_unreachable is compilable" >&5
-$as_echo_n "checking whether a program using __builtin_unreachable is compilable... " >&6; }
-if ${je_cv_gcc_builtin_unreachable+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-void foo (void) {
- __builtin_unreachable();
-}
-
-int
-main ()
-{
-
- {
- foo();
- }
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_gcc_builtin_unreachable=yes
-else
- je_cv_gcc_builtin_unreachable=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_gcc_builtin_unreachable" >&5
-$as_echo "$je_cv_gcc_builtin_unreachable" >&6; }
-
-if test "x${je_cv_gcc_builtin_unreachable}" = "xyes" ; then
- $as_echo "#define JEMALLOC_INTERNAL_UNREACHABLE __builtin_unreachable" >>confdefs.h
-
-else
- $as_echo "#define JEMALLOC_INTERNAL_UNREACHABLE abort" >>confdefs.h
-
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program using __builtin_ffsl is compilable" >&5
-$as_echo_n "checking whether a program using __builtin_ffsl is compilable... " >&6; }
-if ${je_cv_gcc_builtin_ffsl+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-#include <stdio.h>
-#include <strings.h>
-#include <string.h>
-
-int
-main ()
-{
-
- {
- int rv = __builtin_ffsl(0x08);
- printf("%d\n", rv);
- }
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_gcc_builtin_ffsl=yes
-else
- je_cv_gcc_builtin_ffsl=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_gcc_builtin_ffsl" >&5
-$as_echo "$je_cv_gcc_builtin_ffsl" >&6; }
-
-if test "x${je_cv_gcc_builtin_ffsl}" = "xyes" ; then
- $as_echo "#define JEMALLOC_INTERNAL_FFSLL __builtin_ffsll" >>confdefs.h
-
- $as_echo "#define JEMALLOC_INTERNAL_FFSL __builtin_ffsl" >>confdefs.h
-
- $as_echo "#define JEMALLOC_INTERNAL_FFS __builtin_ffs" >>confdefs.h
-
-else
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program using ffsl is compilable" >&5
-$as_echo_n "checking whether a program using ffsl is compilable... " >&6; }
-if ${je_cv_function_ffsl+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
- #include <stdio.h>
- #include <strings.h>
- #include <string.h>
-
-int
-main ()
-{
-
- {
- int rv = ffsl(0x08);
- printf("%d\n", rv);
- }
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_function_ffsl=yes
-else
- je_cv_function_ffsl=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_function_ffsl" >&5
-$as_echo "$je_cv_function_ffsl" >&6; }
-
- if test "x${je_cv_function_ffsl}" = "xyes" ; then
- $as_echo "#define JEMALLOC_INTERNAL_FFSLL ffsll" >>confdefs.h
-
- $as_echo "#define JEMALLOC_INTERNAL_FFSL ffsl" >>confdefs.h
-
- $as_echo "#define JEMALLOC_INTERNAL_FFS ffs" >>confdefs.h
-
- else
- as_fn_error $? "Cannot build without ffsl(3) or __builtin_ffsl()" "$LINENO" 5
- fi
-fi
-
-
-# Check whether --with-lg_tiny_min was given.
-if test "${with_lg_tiny_min+set}" = set; then :
- withval=$with_lg_tiny_min; LG_TINY_MIN="$with_lg_tiny_min"
-else
- LG_TINY_MIN="3"
-fi
-
-cat >>confdefs.h <<_ACEOF
-#define LG_TINY_MIN $LG_TINY_MIN
-_ACEOF
-
-
-
-# Check whether --with-lg_quantum was given.
-if test "${with_lg_quantum+set}" = set; then :
- withval=$with_lg_quantum; LG_QUANTA="$with_lg_quantum"
-else
- LG_QUANTA="3 4"
-fi
-
-if test "x$with_lg_quantum" != "x" ; then
- cat >>confdefs.h <<_ACEOF
-#define LG_QUANTUM $with_lg_quantum
-_ACEOF
-
-fi
-
-
-# Check whether --with-lg_page was given.
-if test "${with_lg_page+set}" = set; then :
- withval=$with_lg_page; LG_PAGE="$with_lg_page"
-else
- LG_PAGE="detect"
-fi
-
-if test "x$LG_PAGE" = "xdetect"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking LG_PAGE" >&5
-$as_echo_n "checking LG_PAGE... " >&6; }
-if ${je_cv_lg_page+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test "$cross_compiling" = yes; then :
- je_cv_lg_page=12
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-#include <strings.h>
-#ifdef _WIN32
-#include <windows.h>
-#else
-#include <unistd.h>
-#endif
-#include <stdio.h>
-
-int
-main ()
-{
-
- int result;
- FILE *f;
-
-#ifdef _WIN32
- SYSTEM_INFO si;
- GetSystemInfo(&si);
- result = si.dwPageSize;
-#else
- result = sysconf(_SC_PAGESIZE);
-#endif
- if (result == -1) {
- return 1;
- }
- result = JEMALLOC_INTERNAL_FFSL(result) - 1;
-
- f = fopen("conftest.out", "w");
- if (f == NULL) {
- return 1;
- }
- fprintf(f, "%d", result);
- fclose(f);
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
- je_cv_lg_page=`cat conftest.out`
-else
- je_cv_lg_page=undefined
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_lg_page" >&5
-$as_echo "$je_cv_lg_page" >&6; }
-fi
-if test "x${je_cv_lg_page}" != "x" ; then
- LG_PAGE="${je_cv_lg_page}"
-fi
-if test "x${LG_PAGE}" != "xundefined" ; then
- cat >>confdefs.h <<_ACEOF
-#define LG_PAGE $LG_PAGE
-_ACEOF
-
-else
- as_fn_error $? "cannot determine value for LG_PAGE" "$LINENO" 5
-fi
-
-
-# Check whether --with-lg_page_sizes was given.
-if test "${with_lg_page_sizes+set}" = set; then :
- withval=$with_lg_page_sizes; LG_PAGE_SIZES="$with_lg_page_sizes"
-else
- LG_PAGE_SIZES="$LG_PAGE"
-fi
-
-
-
-# Check whether --with-lg_size_class_group was given.
-if test "${with_lg_size_class_group+set}" = set; then :
- withval=$with_lg_size_class_group; LG_SIZE_CLASS_GROUP="$with_lg_size_class_group"
-else
- LG_SIZE_CLASS_GROUP="2"
-fi
-
-
-
-
-# Check whether --with-version was given.
-if test "${with_version+set}" = set; then :
- withval=$with_version;
- echo "${with_version}" | grep '^[0-9]\+\.[0-9]\+\.[0-9]\+-[0-9]\+-g[0-9a-f]\+$' 2>&1 1>/dev/null
- if test $? -ne 0 ; then
- as_fn_error $? "${with_version} does not match <major>.<minor>.<bugfix>-<nrev>-g<gid>" "$LINENO" 5
- fi
- echo "$with_version" > "${objroot}VERSION"
-
-else
-
- if test "x`test ! \"${srcroot}\" && cd \"${srcroot}\"; git rev-parse --is-inside-work-tree 2>/dev/null`" = "xtrue" ; then
- for pattern in '[0-9].[0-9].[0-9]' '[0-9].[0-9].[0-9][0-9]' \
- '[0-9].[0-9][0-9].[0-9]' '[0-9].[0-9][0-9].[0-9][0-9]' \
- '[0-9][0-9].[0-9].[0-9]' '[0-9][0-9].[0-9].[0-9][0-9]' \
- '[0-9][0-9].[0-9][0-9].[0-9]' \
- '[0-9][0-9].[0-9][0-9].[0-9][0-9]'; do
- (test ! "${srcroot}" && cd "${srcroot}"; git describe --long --abbrev=40 --match="${pattern}") > "${objroot}VERSION.tmp" 2>/dev/null
- if test $? -eq 0 ; then
- mv "${objroot}VERSION.tmp" "${objroot}VERSION"
- break
- fi
- done
- fi
- rm -f "${objroot}VERSION.tmp"
-
-fi
-
-
-if test ! -e "${objroot}VERSION" ; then
- if test ! -e "${srcroot}VERSION" ; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Missing VERSION file, and unable to generate it; creating bogus VERSION" >&5
-$as_echo "Missing VERSION file, and unable to generate it; creating bogus VERSION" >&6; }
- echo "0.0.0-0-g0000000000000000000000000000000000000000" > "${objroot}VERSION"
- else
- cp ${srcroot}VERSION ${objroot}VERSION
- fi
-fi
-jemalloc_version=`cat "${objroot}VERSION"`
-jemalloc_version_major=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print $1}'`
-jemalloc_version_minor=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print $2}'`
-jemalloc_version_bugfix=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print $3}'`
-jemalloc_version_nrev=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print $4}'`
-jemalloc_version_gid=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print $5}'`
-
-
-
-
-
-
-
-
-if test "x$abi" != "xpecoff" ; then
- for ac_header in pthread.h
-do :
- ac_fn_c_check_header_mongrel "$LINENO" "pthread.h" "ac_cv_header_pthread_h" "$ac_includes_default"
-if test "x$ac_cv_header_pthread_h" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_PTHREAD_H 1
-_ACEOF
-
-else
- as_fn_error $? "pthread.h is missing" "$LINENO" 5
-fi
-
-done
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5
-$as_echo_n "checking for pthread_create in -lpthread... " >&6; }
-if ${ac_cv_lib_pthread_pthread_create+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lpthread $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char pthread_create ();
-int
-main ()
-{
-return pthread_create ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_pthread_pthread_create=yes
-else
- ac_cv_lib_pthread_pthread_create=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5
-$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; }
-if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then :
- LIBS="$LIBS -lpthread"
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing pthread_create" >&5
-$as_echo_n "checking for library containing pthread_create... " >&6; }
-if ${ac_cv_search_pthread_create+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char pthread_create ();
-int
-main ()
-{
-return pthread_create ();
- ;
- return 0;
-}
-_ACEOF
-for ac_lib in '' ; do
- if test -z "$ac_lib"; then
- ac_res="none required"
- else
- ac_res=-l$ac_lib
- LIBS="-l$ac_lib $ac_func_search_save_LIBS"
- fi
- if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_search_pthread_create=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext
- if ${ac_cv_search_pthread_create+:} false; then :
- break
-fi
-done
-if ${ac_cv_search_pthread_create+:} false; then :
-
-else
- ac_cv_search_pthread_create=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_pthread_create" >&5
-$as_echo "$ac_cv_search_pthread_create" >&6; }
-ac_res=$ac_cv_search_pthread_create
-if test "$ac_res" != no; then :
- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-else
- as_fn_error $? "libpthread is missing" "$LINENO" 5
-fi
-
-fi
-
-fi
-
-CPPFLAGS="$CPPFLAGS -D_REENTRANT"
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5
-$as_echo_n "checking for library containing clock_gettime... " >&6; }
-if ${ac_cv_search_clock_gettime+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char clock_gettime ();
-int
-main ()
-{
-return clock_gettime ();
- ;
- return 0;
-}
-_ACEOF
-for ac_lib in '' rt; do
- if test -z "$ac_lib"; then
- ac_res="none required"
- else
- ac_res=-l$ac_lib
- LIBS="-l$ac_lib $ac_func_search_save_LIBS"
- fi
- if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_search_clock_gettime=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext
- if ${ac_cv_search_clock_gettime+:} false; then :
- break
-fi
-done
-if ${ac_cv_search_clock_gettime+:} false; then :
-
-else
- ac_cv_search_clock_gettime=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5
-$as_echo "$ac_cv_search_clock_gettime" >&6; }
-ac_res=$ac_cv_search_clock_gettime
-if test "$ac_res" != no; then :
- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-fi
-
-
-if test "x$je_cv_cray_prgenv_wrapper" = "xyes" ; then
- if test "$ac_cv_search_clock_gettime" != "-lrt"; then
- SAVED_CFLAGS="${CFLAGS}"
-
- unset ac_cv_search_clock_gettime
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -dynamic" >&5
-$as_echo_n "checking whether compiler supports -dynamic... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-dynamic"
-else
- CFLAGS="${CFLAGS} -dynamic"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-dynamic
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5
-$as_echo_n "checking for library containing clock_gettime... " >&6; }
-if ${ac_cv_search_clock_gettime+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char clock_gettime ();
-int
-main ()
-{
-return clock_gettime ();
- ;
- return 0;
-}
-_ACEOF
-for ac_lib in '' rt; do
- if test -z "$ac_lib"; then
- ac_res="none required"
- else
- ac_res=-l$ac_lib
- LIBS="-l$ac_lib $ac_func_search_save_LIBS"
- fi
- if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_search_clock_gettime=$ac_res
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext
- if ${ac_cv_search_clock_gettime+:} false; then :
- break
-fi
-done
-if ${ac_cv_search_clock_gettime+:} false; then :
-
-else
- ac_cv_search_clock_gettime=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5
-$as_echo "$ac_cv_search_clock_gettime" >&6; }
-ac_res=$ac_cv_search_clock_gettime
-if test "$ac_res" != no; then :
- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-fi
-
-
- CFLAGS="${SAVED_CFLAGS}"
- fi
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is compilable" >&5
-$as_echo_n "checking whether clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is compilable... " >&6; }
-if ${je_cv_clock_monotonic_coarse+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-#include <time.h>
-
-int
-main ()
-{
-
- struct timespec ts;
-
- clock_gettime(CLOCK_MONOTONIC_COARSE, &ts);
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_clock_monotonic_coarse=yes
-else
- je_cv_clock_monotonic_coarse=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_clock_monotonic_coarse" >&5
-$as_echo "$je_cv_clock_monotonic_coarse" >&6; }
-
-if test "x${je_cv_clock_monotonic_coarse}" = "xyes" ; then
- $as_echo "#define JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE 1" >>confdefs.h
-
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether clock_gettime(CLOCK_MONOTONIC, ...) is compilable" >&5
-$as_echo_n "checking whether clock_gettime(CLOCK_MONOTONIC, ...) is compilable... " >&6; }
-if ${je_cv_clock_monotonic+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-#include <unistd.h>
-#include <time.h>
-
-int
-main ()
-{
-
- struct timespec ts;
-
- clock_gettime(CLOCK_MONOTONIC, &ts);
-#if !defined(_POSIX_MONOTONIC_CLOCK) || _POSIX_MONOTONIC_CLOCK < 0
-# error _POSIX_MONOTONIC_CLOCK missing/invalid
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_clock_monotonic=yes
-else
- je_cv_clock_monotonic=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_clock_monotonic" >&5
-$as_echo "$je_cv_clock_monotonic" >&6; }
-
-if test "x${je_cv_clock_monotonic}" = "xyes" ; then
- $as_echo "#define JEMALLOC_HAVE_CLOCK_MONOTONIC 1" >>confdefs.h
-
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mach_absolute_time() is compilable" >&5
-$as_echo_n "checking whether mach_absolute_time() is compilable... " >&6; }
-if ${je_cv_mach_absolute_time+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-#include <mach/mach_time.h>
-
-int
-main ()
-{
-
- mach_absolute_time();
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_mach_absolute_time=yes
-else
- je_cv_mach_absolute_time=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_mach_absolute_time" >&5
-$as_echo "$je_cv_mach_absolute_time" >&6; }
-
-if test "x${je_cv_mach_absolute_time}" = "xyes" ; then
- $as_echo "#define JEMALLOC_HAVE_MACH_ABSOLUTE_TIME 1" >>confdefs.h
-
-fi
-
-SAVED_CFLAGS="${CFLAGS}"
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler supports -Werror" >&5
-$as_echo_n "checking whether compiler supports -Werror... " >&6; }
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="-Werror"
-else
- CFLAGS="${CFLAGS} -Werror"
-fi
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-
-int
-main ()
-{
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- je_cv_cflags_appended=-Werror
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- je_cv_cflags_appended=
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- CFLAGS="${TCFLAGS}"
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether syscall(2) is compilable" >&5
-$as_echo_n "checking whether syscall(2) is compilable... " >&6; }
-if ${je_cv_syscall+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-#include <sys/syscall.h>
-#include <unistd.h>
-
-int
-main ()
-{
-
- syscall(SYS_write, 2, "hello", 5);
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_syscall=yes
-else
- je_cv_syscall=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_syscall" >&5
-$as_echo "$je_cv_syscall" >&6; }
-
-CFLAGS="${SAVED_CFLAGS}"
-if test "x$je_cv_syscall" = "xyes" ; then
- $as_echo "#define JEMALLOC_HAVE_SYSCALL " >>confdefs.h
-
-fi
-
-ac_fn_c_check_func "$LINENO" "secure_getenv" "ac_cv_func_secure_getenv"
-if test "x$ac_cv_func_secure_getenv" = xyes; then :
- have_secure_getenv="1"
-else
- have_secure_getenv="0"
-
-fi
-
-if test "x$have_secure_getenv" = "x1" ; then
- $as_echo "#define JEMALLOC_HAVE_SECURE_GETENV " >>confdefs.h
-
-fi
-
-ac_fn_c_check_func "$LINENO" "issetugid" "ac_cv_func_issetugid"
-if test "x$ac_cv_func_issetugid" = xyes; then :
- have_issetugid="1"
-else
- have_issetugid="0"
-
-fi
-
-if test "x$have_issetugid" = "x1" ; then
- $as_echo "#define JEMALLOC_HAVE_ISSETUGID " >>confdefs.h
-
-fi
-
-ac_fn_c_check_func "$LINENO" "_malloc_thread_cleanup" "ac_cv_func__malloc_thread_cleanup"
-if test "x$ac_cv_func__malloc_thread_cleanup" = xyes; then :
- have__malloc_thread_cleanup="1"
-else
- have__malloc_thread_cleanup="0"
-
-fi
-
-if test "x$have__malloc_thread_cleanup" = "x1" ; then
- $as_echo "#define JEMALLOC_MALLOC_THREAD_CLEANUP " >>confdefs.h
-
- force_tls="1"
-fi
-
-ac_fn_c_check_func "$LINENO" "_pthread_mutex_init_calloc_cb" "ac_cv_func__pthread_mutex_init_calloc_cb"
-if test "x$ac_cv_func__pthread_mutex_init_calloc_cb" = xyes; then :
- have__pthread_mutex_init_calloc_cb="1"
-else
- have__pthread_mutex_init_calloc_cb="0"
-
-fi
-
-if test "x$have__pthread_mutex_init_calloc_cb" = "x1" ; then
- $as_echo "#define JEMALLOC_MUTEX_INIT_CB 1" >>confdefs.h
-
-fi
-
-# Check whether --enable-lazy_lock was given.
-if test "${enable_lazy_lock+set}" = set; then :
- enableval=$enable_lazy_lock; if test "x$enable_lazy_lock" = "xno" ; then
- enable_lazy_lock="0"
-else
- enable_lazy_lock="1"
-fi
-
-else
- enable_lazy_lock=""
-
-fi
-
-if test "x${enable_lazy_lock}" = "x" ; then
- if test "x${force_lazy_lock}" = "x1" ; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Forcing lazy-lock to avoid allocator/threading bootstrap issues" >&5
-$as_echo "Forcing lazy-lock to avoid allocator/threading bootstrap issues" >&6; }
- enable_lazy_lock="1"
- else
- enable_lazy_lock="0"
- fi
-fi
-if test "x${enable_lazy_lock}" = "x1" -a "x${abi}" = "xpecoff" ; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Forcing no lazy-lock because thread creation monitoring is unimplemented" >&5
-$as_echo "Forcing no lazy-lock because thread creation monitoring is unimplemented" >&6; }
- enable_lazy_lock="0"
-fi
-if test "x$enable_lazy_lock" = "x1" ; then
- if test "x$abi" != "xpecoff" ; then
- for ac_header in dlfcn.h
-do :
- ac_fn_c_check_header_mongrel "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default"
-if test "x$ac_cv_header_dlfcn_h" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_DLFCN_H 1
-_ACEOF
-
-else
- as_fn_error $? "dlfcn.h is missing" "$LINENO" 5
-fi
-
-done
-
- ac_fn_c_check_func "$LINENO" "dlsym" "ac_cv_func_dlsym"
-if test "x$ac_cv_func_dlsym" = xyes; then :
-
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlsym in -ldl" >&5
-$as_echo_n "checking for dlsym in -ldl... " >&6; }
-if ${ac_cv_lib_dl_dlsym+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-ldl $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char dlsym ();
-int
-main ()
-{
-return dlsym ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_dl_dlsym=yes
-else
- ac_cv_lib_dl_dlsym=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlsym" >&5
-$as_echo "$ac_cv_lib_dl_dlsym" >&6; }
-if test "x$ac_cv_lib_dl_dlsym" = xyes; then :
- LIBS="$LIBS -ldl"
-else
- as_fn_error $? "libdl is missing" "$LINENO" 5
-fi
-
-
-fi
-
- fi
- $as_echo "#define JEMALLOC_LAZY_LOCK " >>confdefs.h
-
-fi
-
-
-# Check whether --enable-tls was given.
-if test "${enable_tls+set}" = set; then :
- enableval=$enable_tls; if test "x$enable_tls" = "xno" ; then
- enable_tls="0"
-else
- enable_tls="1"
-fi
-
-else
- enable_tls=""
-
-fi
-
-if test "x${enable_tls}" = "x" ; then
- if test "x${force_tls}" = "x1" ; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Forcing TLS to avoid allocator/threading bootstrap issues" >&5
-$as_echo "Forcing TLS to avoid allocator/threading bootstrap issues" >&6; }
- enable_tls="1"
- elif test "x${force_tls}" = "x0" ; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: Forcing no TLS to avoid allocator/threading bootstrap issues" >&5
-$as_echo "Forcing no TLS to avoid allocator/threading bootstrap issues" >&6; }
- enable_tls="0"
- else
- enable_tls="1"
- fi
-fi
-if test "x${enable_tls}" = "x1" ; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for TLS" >&5
-$as_echo_n "checking for TLS... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
- __thread int x;
-
-int
-main ()
-{
-
- x = 42;
-
- return 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- enable_tls="0"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- enable_tls="0"
-fi
-
-if test "x${enable_tls}" = "x1" ; then
- if test "x${force_tls}" = "x0" ; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: TLS enabled despite being marked unusable on this platform" >&5
-$as_echo "$as_me: WARNING: TLS enabled despite being marked unusable on this platform" >&2;}
- fi
- cat >>confdefs.h <<_ACEOF
-#define JEMALLOC_TLS
-_ACEOF
-
-elif test "x${force_tls}" = "x1" ; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: TLS disabled despite being marked critical on this platform" >&5
-$as_echo "$as_me: WARNING: TLS disabled despite being marked critical on this platform" >&2;}
-fi
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C11 atomics is compilable" >&5
-$as_echo_n "checking whether C11 atomics is compilable... " >&6; }
-if ${je_cv_c11atomics+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-#include <stdint.h>
-#if (__STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_ATOMICS__)
-#include <stdatomic.h>
-#else
-#error Atomics not available
-#endif
-
-int
-main ()
-{
-
- uint64_t *p = (uint64_t *)0;
- uint64_t x = 1;
- volatile atomic_uint_least64_t *a = (volatile atomic_uint_least64_t *)p;
- uint64_t r = atomic_fetch_add(a, x) + x;
- return (r == 0);
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_c11atomics=yes
-else
- je_cv_c11atomics=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_c11atomics" >&5
-$as_echo "$je_cv_c11atomics" >&6; }
-
-if test "x${je_cv_c11atomics}" = "xyes" ; then
- $as_echo "#define JEMALLOC_C11ATOMICS 1" >>confdefs.h
-
-fi
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether atomic(9) is compilable" >&5
-$as_echo_n "checking whether atomic(9) is compilable... " >&6; }
-if ${je_cv_atomic9+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-#include <sys/types.h>
-#include <machine/atomic.h>
-#include <inttypes.h>
-
-int
-main ()
-{
-
- {
- uint32_t x32 = 0;
- volatile uint32_t *x32p = &x32;
- atomic_fetchadd_32(x32p, 1);
- }
- {
- unsigned long xlong = 0;
- volatile unsigned long *xlongp = &xlong;
- atomic_fetchadd_long(xlongp, 1);
- }
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_atomic9=yes
-else
- je_cv_atomic9=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_atomic9" >&5
-$as_echo "$je_cv_atomic9" >&6; }
-
-if test "x${je_cv_atomic9}" = "xyes" ; then
- $as_echo "#define JEMALLOC_ATOMIC9 1" >>confdefs.h
-
-fi
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Darwin OSAtomic*() is compilable" >&5
-$as_echo_n "checking whether Darwin OSAtomic*() is compilable... " >&6; }
-if ${je_cv_osatomic+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-#include <libkern/OSAtomic.h>
-#include <inttypes.h>
-
-int
-main ()
-{
-
- {
- int32_t x32 = 0;
- volatile int32_t *x32p = &x32;
- OSAtomicAdd32(1, x32p);
- }
- {
- int64_t x64 = 0;
- volatile int64_t *x64p = &x64;
- OSAtomicAdd64(1, x64p);
- }
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_osatomic=yes
-else
- je_cv_osatomic=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_osatomic" >&5
-$as_echo "$je_cv_osatomic" >&6; }
-
-if test "x${je_cv_osatomic}" = "xyes" ; then
- $as_echo "#define JEMALLOC_OSATOMIC " >>confdefs.h
-
-fi
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether madvise(2) is compilable" >&5
-$as_echo_n "checking whether madvise(2) is compilable... " >&6; }
-if ${je_cv_madvise+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-#include <sys/mman.h>
-
-int
-main ()
-{
-
- {
- madvise((void *)0, 0, 0);
- }
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_madvise=yes
-else
- je_cv_madvise=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_madvise" >&5
-$as_echo "$je_cv_madvise" >&6; }
-
-if test "x${je_cv_madvise}" = "xyes" ; then
- $as_echo "#define JEMALLOC_HAVE_MADVISE " >>confdefs.h
-
-fi
-
-
-
-
-if test "x${je_cv_atomic9}" != "xyes" -a "x${je_cv_osatomic}" != "xyes" ; then
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to force 32-bit __sync_{add,sub}_and_fetch()" >&5
-$as_echo_n "checking whether to force 32-bit __sync_{add,sub}_and_fetch()... " >&6; }
-if ${je_cv_sync_compare_and_swap_4+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
- #include <stdint.h>
-
-int
-main ()
-{
-
- #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4
- {
- uint32_t x32 = 0;
- __sync_add_and_fetch(&x32, 42);
- __sync_sub_and_fetch(&x32, 1);
- }
- #else
- #error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 is defined, no need to force
- #endif
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_sync_compare_and_swap_4=yes
-else
- je_cv_sync_compare_and_swap_4=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_sync_compare_and_swap_4" >&5
-$as_echo "$je_cv_sync_compare_and_swap_4" >&6; }
-
- if test "x${je_cv_sync_compare_and_swap_4}" = "xyes" ; then
- $as_echo "#define JE_FORCE_SYNC_COMPARE_AND_SWAP_4 " >>confdefs.h
-
- fi
-
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to force 64-bit __sync_{add,sub}_and_fetch()" >&5
-$as_echo_n "checking whether to force 64-bit __sync_{add,sub}_and_fetch()... " >&6; }
-if ${je_cv_sync_compare_and_swap_8+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
- #include <stdint.h>
-
-int
-main ()
-{
-
- #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8
- {
- uint64_t x64 = 0;
- __sync_add_and_fetch(&x64, 42);
- __sync_sub_and_fetch(&x64, 1);
- }
- #else
- #error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 is defined, no need to force
- #endif
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_sync_compare_and_swap_8=yes
-else
- je_cv_sync_compare_and_swap_8=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_sync_compare_and_swap_8" >&5
-$as_echo "$je_cv_sync_compare_and_swap_8" >&6; }
-
- if test "x${je_cv_sync_compare_and_swap_8}" = "xyes" ; then
- $as_echo "#define JE_FORCE_SYNC_COMPARE_AND_SWAP_8 " >>confdefs.h
-
- fi
-
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_clz" >&5
-$as_echo_n "checking for __builtin_clz... " >&6; }
-if ${je_cv_builtin_clz+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- {
- unsigned x = 0;
- int y = __builtin_clz(x);
- }
- {
- unsigned long x = 0;
- int y = __builtin_clzl(x);
- }
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_builtin_clz=yes
-else
- je_cv_builtin_clz=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_builtin_clz" >&5
-$as_echo "$je_cv_builtin_clz" >&6; }
-
-if test "x${je_cv_builtin_clz}" = "xyes" ; then
- $as_echo "#define JEMALLOC_HAVE_BUILTIN_CLZ " >>confdefs.h
-
-fi
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Darwin os_unfair_lock_*() is compilable" >&5
-$as_echo_n "checking whether Darwin os_unfair_lock_*() is compilable... " >&6; }
-if ${je_cv_os_unfair_lock+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-#include <os/lock.h>
-
-int
-main ()
-{
-
- os_unfair_lock lock = OS_UNFAIR_LOCK_INIT;
- os_unfair_lock_lock(&lock);
- os_unfair_lock_unlock(&lock);
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_os_unfair_lock=yes
-else
- je_cv_os_unfair_lock=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_os_unfair_lock" >&5
-$as_echo "$je_cv_os_unfair_lock" >&6; }
-
-if test "x${je_cv_os_unfair_lock}" = "xyes" ; then
- $as_echo "#define JEMALLOC_OS_UNFAIR_LOCK " >>confdefs.h
-
-fi
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether Darwin OSSpin*() is compilable" >&5
-$as_echo_n "checking whether Darwin OSSpin*() is compilable... " >&6; }
-if ${je_cv_osspin+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-#include <libkern/OSAtomic.h>
-#include <inttypes.h>
-
-int
-main ()
-{
-
- OSSpinLock lock = 0;
- OSSpinLockLock(&lock);
- OSSpinLockUnlock(&lock);
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_osspin=yes
-else
- je_cv_osspin=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_osspin" >&5
-$as_echo "$je_cv_osspin" >&6; }
-
-if test "x${je_cv_osspin}" = "xyes" ; then
- $as_echo "#define JEMALLOC_OSSPIN " >>confdefs.h
-
-fi
-
-
-# Check whether --enable-zone-allocator was given.
-if test "${enable_zone_allocator+set}" = set; then :
- enableval=$enable_zone_allocator; if test "x$enable_zone_allocator" = "xno" ; then
- enable_zone_allocator="0"
-else
- enable_zone_allocator="1"
-fi
-
-else
- if test "x${abi}" = "xmacho"; then
- enable_zone_allocator="1"
-fi
-
-
-fi
-
-
-
-if test "x${enable_zone_allocator}" = "x1" ; then
- if test "x${abi}" != "xmacho"; then
- as_fn_error $? "--enable-zone-allocator is only supported on Darwin" "$LINENO" 5
- fi
- $as_echo "#define JEMALLOC_ZONE " >>confdefs.h
-
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking malloc zone version" >&5
-$as_echo_n "checking malloc zone version... " >&6; }
-
-
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <malloc/malloc.h>
-int
-main ()
-{
-static int foo[sizeof(malloc_zone_t) == sizeof(void *) * 14 ? 1 : -1]
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- JEMALLOC_ZONE_VERSION=3
-else
-
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <malloc/malloc.h>
-int
-main ()
-{
-static int foo[sizeof(malloc_zone_t) == sizeof(void *) * 15 ? 1 : -1]
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- JEMALLOC_ZONE_VERSION=5
-else
-
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <malloc/malloc.h>
-int
-main ()
-{
-static int foo[sizeof(malloc_zone_t) == sizeof(void *) * 16 ? 1 : -1]
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <malloc/malloc.h>
-int
-main ()
-{
-static int foo[sizeof(malloc_introspection_t) == sizeof(void *) * 9 ? 1 : -1]
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- JEMALLOC_ZONE_VERSION=6
-else
-
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <malloc/malloc.h>
-int
-main ()
-{
-static int foo[sizeof(malloc_introspection_t) == sizeof(void *) * 13 ? 1 : -1]
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- JEMALLOC_ZONE_VERSION=7
-else
- JEMALLOC_ZONE_VERSION=
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
-
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <malloc/malloc.h>
-int
-main ()
-{
-static int foo[sizeof(malloc_zone_t) == sizeof(void *) * 17 ? 1 : -1]
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- JEMALLOC_ZONE_VERSION=8
-else
-
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <malloc/malloc.h>
-int
-main ()
-{
-static int foo[sizeof(malloc_zone_t) > sizeof(void *) * 17 ? 1 : -1]
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- JEMALLOC_ZONE_VERSION=9
-else
- JEMALLOC_ZONE_VERSION=
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- if test "x${JEMALLOC_ZONE_VERSION}" = "x"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
-$as_echo "unsupported" >&6; }
- as_fn_error $? "Unsupported malloc zone version" "$LINENO" 5
- fi
- if test "${JEMALLOC_ZONE_VERSION}" = 9; then
- JEMALLOC_ZONE_VERSION=8
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: > 8" >&5
-$as_echo "> 8" >&6; }
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $JEMALLOC_ZONE_VERSION" >&5
-$as_echo "$JEMALLOC_ZONE_VERSION" >&6; }
- fi
- cat >>confdefs.h <<_ACEOF
-#define JEMALLOC_ZONE_VERSION $JEMALLOC_ZONE_VERSION
-_ACEOF
-
-fi
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether glibc malloc hook is compilable" >&5
-$as_echo_n "checking whether glibc malloc hook is compilable... " >&6; }
-if ${je_cv_glibc_malloc_hook+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-#include <stddef.h>
-
-extern void (* __free_hook)(void *ptr);
-extern void *(* __malloc_hook)(size_t size);
-extern void *(* __realloc_hook)(void *ptr, size_t size);
-
-int
-main ()
-{
-
- void *ptr = 0L;
- if (__malloc_hook) ptr = __malloc_hook(1);
- if (__realloc_hook) ptr = __realloc_hook(ptr, 2);
- if (__free_hook && ptr) __free_hook(ptr);
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_glibc_malloc_hook=yes
-else
- je_cv_glibc_malloc_hook=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_glibc_malloc_hook" >&5
-$as_echo "$je_cv_glibc_malloc_hook" >&6; }
-
-if test "x${je_cv_glibc_malloc_hook}" = "xyes" ; then
- $as_echo "#define JEMALLOC_GLIBC_MALLOC_HOOK " >>confdefs.h
-
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether glibc memalign hook is compilable" >&5
-$as_echo_n "checking whether glibc memalign hook is compilable... " >&6; }
-if ${je_cv_glibc_memalign_hook+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-#include <stddef.h>
-
-extern void *(* __memalign_hook)(size_t alignment, size_t size);
-
-int
-main ()
-{
-
- void *ptr = 0L;
- if (__memalign_hook) ptr = __memalign_hook(16, 7);
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_glibc_memalign_hook=yes
-else
- je_cv_glibc_memalign_hook=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_glibc_memalign_hook" >&5
-$as_echo "$je_cv_glibc_memalign_hook" >&6; }
-
-if test "x${je_cv_glibc_memalign_hook}" = "xyes" ; then
- $as_echo "#define JEMALLOC_GLIBC_MEMALIGN_HOOK " >>confdefs.h
-
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether pthreads adaptive mutexes is compilable" >&5
-$as_echo_n "checking whether pthreads adaptive mutexes is compilable... " >&6; }
-if ${je_cv_pthread_mutex_adaptive_np+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-#include <pthread.h>
-
-int
-main ()
-{
-
- pthread_mutexattr_t attr;
- pthread_mutexattr_init(&attr);
- pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP);
- pthread_mutexattr_destroy(&attr);
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- je_cv_pthread_mutex_adaptive_np=yes
-else
- je_cv_pthread_mutex_adaptive_np=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $je_cv_pthread_mutex_adaptive_np" >&5
-$as_echo "$je_cv_pthread_mutex_adaptive_np" >&6; }
-
-if test "x${je_cv_pthread_mutex_adaptive_np}" = "xyes" ; then
- $as_echo "#define JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP " >>confdefs.h
-
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
-$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
-if ${ac_cv_header_stdbool_h+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
- #include <stdbool.h>
- #ifndef bool
- "error: bool is not defined"
- #endif
- #ifndef false
- "error: false is not defined"
- #endif
- #if false
- "error: false is not 0"
- #endif
- #ifndef true
- "error: true is not defined"
- #endif
- #if true != 1
- "error: true is not 1"
- #endif
- #ifndef __bool_true_false_are_defined
- "error: __bool_true_false_are_defined is not defined"
- #endif
-
- struct s { _Bool s: 1; _Bool t; } s;
-
- char a[true == 1 ? 1 : -1];
- char b[false == 0 ? 1 : -1];
- char c[__bool_true_false_are_defined == 1 ? 1 : -1];
- char d[(bool) 0.5 == true ? 1 : -1];
- /* See body of main program for 'e'. */
- char f[(_Bool) 0.0 == false ? 1 : -1];
- char g[true];
- char h[sizeof (_Bool)];
- char i[sizeof s.t];
- enum { j = false, k = true, l = false * true, m = true * 256 };
- /* The following fails for
- HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
- _Bool n[m];
- char o[sizeof n == m * sizeof n[0] ? 1 : -1];
- char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
- /* Catch a bug in an HP-UX C compiler. See
- http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
- http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
- */
- _Bool q = true;
- _Bool *pq = &q;
-
-int
-main ()
-{
-
- bool e = &s;
- *pq |= q;
- *pq |= ! q;
- /* Refer to every declared value, to avoid compiler optimizations. */
- return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
- + !m + !n + !o + !p + !q + !pq);
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv_header_stdbool_h=yes
-else
- ac_cv_header_stdbool_h=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
-$as_echo "$ac_cv_header_stdbool_h" >&6; }
- ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
-if test "x$ac_cv_type__Bool" = xyes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE__BOOL 1
-_ACEOF
-
-
-fi
-
-
-if test $ac_cv_header_stdbool_h = yes; then
-
-$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
-
-fi
-
-
-
-ac_config_commands="$ac_config_commands include/jemalloc/internal/private_namespace.h"
-
-ac_config_commands="$ac_config_commands include/jemalloc/internal/private_unnamespace.h"
-
-ac_config_commands="$ac_config_commands include/jemalloc/internal/public_symbols.txt"
-
-ac_config_commands="$ac_config_commands include/jemalloc/internal/public_namespace.h"
-
-ac_config_commands="$ac_config_commands include/jemalloc/internal/public_unnamespace.h"
-
-ac_config_commands="$ac_config_commands include/jemalloc/internal/size_classes.h"
-
-ac_config_commands="$ac_config_commands include/jemalloc/jemalloc_protos_jet.h"
-
-ac_config_commands="$ac_config_commands include/jemalloc/jemalloc_rename.h"
-
-ac_config_commands="$ac_config_commands include/jemalloc/jemalloc_mangle.h"
-
-ac_config_commands="$ac_config_commands include/jemalloc/jemalloc_mangle_jet.h"
-
-ac_config_commands="$ac_config_commands include/jemalloc/jemalloc.h"
-
-
-
-
-ac_config_headers="$ac_config_headers $cfghdrs_tup"
-
-
-
-ac_config_files="$ac_config_files $cfgoutputs_tup config.stamp bin/jemalloc-config bin/jemalloc.sh bin/jeprof"
-
-
-
-cat >confcache <<\_ACEOF
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs, see configure's option --config-cache.
-# It is not useful on other systems. If it contains results you don't
-# want to keep, you may remove or edit it.
-#
-# config.status only pays attention to the cache file if you give it
-# the --recheck option to rerun configure.
-#
-# `ac_cv_env_foo' variables (set or unset) will be overridden when
-# loading this file, other *unset* `ac_cv_foo' will be assigned the
-# following values.
-
-_ACEOF
-
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, we kill variables containing newlines.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-(
- for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
- eval ac_val=\$$ac_var
- case $ac_val in #(
- *${as_nl}*)
- case $ac_var in #(
- *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
-$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
- esac
- case $ac_var in #(
- _ | IFS | as_nl) ;; #(
- BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
- *) { eval $ac_var=; unset $ac_var;} ;;
- esac ;;
- esac
- done
-
- (set) 2>&1 |
- case $as_nl`(ac_space=' '; set) 2>&1` in #(
- *${as_nl}ac_space=\ *)
- # `set' does not quote correctly, so add quotes: double-quote
- # substitution turns \\\\ into \\, and sed turns \\ into \.
- sed -n \
- "s/'/'\\\\''/g;
- s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
- ;; #(
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
- ;;
- esac |
- sort
-) |
- sed '
- /^ac_cv_env_/b end
- t clear
- :clear
- s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
- t end
- s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
- :end' >>confcache
-if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
- if test -w "$cache_file"; then
- if test "x$cache_file" != "x/dev/null"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
-$as_echo "$as_me: updating cache $cache_file" >&6;}
- if test ! -f "$cache_file" || test -h "$cache_file"; then
- cat confcache >"$cache_file"
- else
- case $cache_file in #(
- */* | ?:*)
- mv -f confcache "$cache_file"$$ &&
- mv -f "$cache_file"$$ "$cache_file" ;; #(
- *)
- mv -f confcache "$cache_file" ;;
- esac
- fi
- fi
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
-$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
- fi
-fi
-rm -f confcache
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-DEFS=-DHAVE_CONFIG_H
-
-ac_libobjs=
-ac_ltlibobjs=
-U=
-for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
- # 1. Remove the extension, and $U if already installed.
- ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
- ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
- # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
- # will be set to the directory where LIBOBJS objects are built.
- as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
- as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
-done
-LIBOBJS=$ac_libobjs
-
-LTLIBOBJS=$ac_ltlibobjs
-
-
-
-
-: "${CONFIG_STATUS=./config.status}"
-ac_write_fail=0
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
-$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
-as_write_fail=0
-cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
-#! $SHELL
-# Generated by $as_me.
-# Run this file to recreate the current configuration.
-# Compiler output produced by configure, useful for debugging
-# configure, is in config.log if it exists.
-
-debug=false
-ac_cs_recheck=false
-ac_cs_silent=false
-
-SHELL=\${CONFIG_SHELL-$SHELL}
-export SHELL
-_ASEOF
-cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
-## -------------------- ##
-## M4sh Initialization. ##
-## -------------------- ##
-
-# Be more Bourne compatible
-DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
- emulate sh
- NULLCMD=:
- # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '${1+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in #(
- *posix*) :
- set -o posix ;; #(
- *) :
- ;;
-esac
-fi
-
-
-as_nl='
-'
-export as_nl
-# Printing a long string crashes Solaris 7 /usr/bin/printf.
-as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-# Prefer a ksh shell builtin over an external printf program on Solaris,
-# but without wasting forks for bash or zsh.
-if test -z "$BASH_VERSION$ZSH_VERSION" \
- && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
- as_echo='print -r --'
- as_echo_n='print -rn --'
-elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
- as_echo='printf %s\n'
- as_echo_n='printf %s'
-else
- if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
- as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
- as_echo_n='/usr/ucb/echo -n'
- else
- as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
- as_echo_n_body='eval
- arg=$1;
- case $arg in #(
- *"$as_nl"*)
- expr "X$arg" : "X\\(.*\\)$as_nl";
- arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
- esac;
- expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
- '
- export as_echo_n_body
- as_echo_n='sh -c $as_echo_n_body as_echo'
- fi
- export as_echo_body
- as_echo='sh -c $as_echo_body as_echo'
-fi
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
- PATH_SEPARATOR=:
- (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
- (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
- PATH_SEPARATOR=';'
- }
-fi
-
-
-# IFS
-# We need space, tab and new line, in precisely that order. Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-IFS=" "" $as_nl"
-
-# Find who we are. Look in the path if we contain no directory separator.
-as_myself=
-case $0 in #((
- *[\\/]* ) as_myself=$0 ;;
- *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
- done
-IFS=$as_save_IFS
-
- ;;
-esac
-# We did not find ourselves, most probably we were run as `sh COMMAND'
-# in which case we are not to be found in the path.
-if test "x$as_myself" = x; then
- as_myself=$0
-fi
-if test ! -f "$as_myself"; then
- $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
- exit 1
-fi
-
-# Unset variables that we do not need and which cause bugs (e.g. in
-# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
-# suppresses any "Segmentation fault" message there. '((' could
-# trigger a bug in pdksh 5.2.14.
-for as_var in BASH_ENV ENV MAIL MAILPATH
-do eval test x\${$as_var+set} = xset \
- && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
-done
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-LC_ALL=C
-export LC_ALL
-LANGUAGE=C
-export LANGUAGE
-
-# CDPATH.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-
-# as_fn_error STATUS ERROR [LINENO LOG_FD]
-# ----------------------------------------
-# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
-# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
-# script with STATUS, using 1 if that was 0.
-as_fn_error ()
-{
- as_status=$1; test $as_status -eq 0 && as_status=1
- if test "$4"; then
- as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
- fi
- $as_echo "$as_me: error: $2" >&2
- as_fn_exit $as_status
-} # as_fn_error
-
-
-# as_fn_set_status STATUS
-# -----------------------
-# Set $? to STATUS, without forking.
-as_fn_set_status ()
-{
- return $1
-} # as_fn_set_status
-
-# as_fn_exit STATUS
-# -----------------
-# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
-as_fn_exit ()
-{
- set +e
- as_fn_set_status $1
- exit $1
-} # as_fn_exit
-
-# as_fn_unset VAR
-# ---------------
-# Portably unset VAR.
-as_fn_unset ()
-{
- { eval $1=; unset $1;}
-}
-as_unset=as_fn_unset
-# as_fn_append VAR VALUE
-# ----------------------
-# Append the text in VALUE to the end of the definition contained in VAR. Take
-# advantage of any shell optimizations that allow amortized linear growth over
-# repeated appends, instead of the typical quadratic growth present in naive
-# implementations.
-if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
- eval 'as_fn_append ()
- {
- eval $1+=\$2
- }'
-else
- as_fn_append ()
- {
- eval $1=\$$1\$2
- }
-fi # as_fn_append
-
-# as_fn_arith ARG...
-# ------------------
-# Perform arithmetic evaluation on the ARGs, and store the result in the
-# global $as_val. Take advantage of shells that can avoid forks. The arguments
-# must be portable across $(()) and expr.
-if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
- eval 'as_fn_arith ()
- {
- as_val=$(( $* ))
- }'
-else
- as_fn_arith ()
- {
- as_val=`expr "$@" || test $? -eq 1`
- }
-fi # as_fn_arith
-
-
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
- as_basename=basename
-else
- as_basename=false
-fi
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
- as_dirname=dirname
-else
- as_dirname=false
-fi
-
-as_me=`$as_basename -- "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{
- s//\1/
- q
- }
- /^X\/\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\/\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
-
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in #(((((
--n*)
- case `echo 'xy\c'` in
- *c*) ECHO_T=' ';; # ECHO_T is single tab character.
- xy) ECHO_C='\c';;
- *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
- ECHO_T=' ';;
- esac;;
-*)
- ECHO_N='-n';;
-esac
-
-rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
- rm -f conf$$.dir/conf$$.file
-else
- rm -f conf$$.dir
- mkdir conf$$.dir 2>/dev/null
-fi
-if (echo >conf$$.file) 2>/dev/null; then
- if ln -s conf$$.file conf$$ 2>/dev/null; then
- as_ln_s='ln -s'
- # ... but there are two gotchas:
- # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
- # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -pR'.
- ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
- as_ln_s='cp -pR'
- elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
- else
- as_ln_s='cp -pR'
- fi
-else
- as_ln_s='cp -pR'
-fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
-
-
-# as_fn_mkdir_p
-# -------------
-# Create "$as_dir" as a directory, including parents if necessary.
-as_fn_mkdir_p ()
-{
-
- case $as_dir in #(
- -*) as_dir=./$as_dir;;
- esac
- test -d "$as_dir" || eval $as_mkdir_p || {
- as_dirs=
- while :; do
- case $as_dir in #(
- *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
- *) as_qdir=$as_dir;;
- esac
- as_dirs="'$as_qdir' $as_dirs"
- as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- test -d "$as_dir" && break
- done
- test -z "$as_dirs" || eval "mkdir $as_dirs"
- } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
-
-
-} # as_fn_mkdir_p
-if mkdir -p . 2>/dev/null; then
- as_mkdir_p='mkdir -p "$as_dir"'
-else
- test -d ./-p && rmdir ./-p
- as_mkdir_p=false
-fi
-
-
-# as_fn_executable_p FILE
-# -----------------------
-# Test if FILE is an executable regular file.
-as_fn_executable_p ()
-{
- test -f "$1" && test -x "$1"
-} # as_fn_executable_p
-as_test_x='test -x'
-as_executable_p=as_fn_executable_p
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-exec 6>&1
-## ----------------------------------- ##
-## Main body of $CONFIG_STATUS script. ##
-## ----------------------------------- ##
-_ASEOF
-test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-# Save the log message, to keep $0 and so on meaningful, and to
-# report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling.
-ac_log="
-This file was extended by $as_me, which was
-generated by GNU Autoconf 2.69. Invocation command line was
-
- CONFIG_FILES = $CONFIG_FILES
- CONFIG_HEADERS = $CONFIG_HEADERS
- CONFIG_LINKS = $CONFIG_LINKS
- CONFIG_COMMANDS = $CONFIG_COMMANDS
- $ $0 $@
-
-on `(hostname || uname -n) 2>/dev/null | sed 1q`
-"
-
-_ACEOF
-
-case $ac_config_files in *"
-"*) set x $ac_config_files; shift; ac_config_files=$*;;
-esac
-
-case $ac_config_headers in *"
-"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
-esac
-
-
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
-
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-ac_cs_usage="\
-\`$as_me' instantiates files and other configuration actions
-from templates according to the current configuration. Unless the files
-and actions are specified as TAGs, all are instantiated by default.
-
-Usage: $0 [OPTION]... [TAG]...
-
- -h, --help print this help, then exit
- -V, --version print version number and configuration settings, then exit
- --config print configuration, then exit
- -q, --quiet, --silent
- do not print progress messages
- -d, --debug don't remove temporary files
- --recheck update $as_me by reconfiguring in the same conditions
- --file=FILE[:TEMPLATE]
- instantiate the configuration file FILE
- --header=FILE[:TEMPLATE]
- instantiate the configuration header FILE
-
-Configuration files:
-$config_files
-
-Configuration headers:
-$config_headers
-
-Configuration commands:
-$config_commands
-
-Report bugs to the package provider."
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
-ac_cs_version="\\
-config.status
-configured by $0, generated by GNU Autoconf 2.69,
- with options \\"\$ac_cs_config\\"
-
-Copyright (C) 2012 Free Software Foundation, Inc.
-This config.status script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it."
-
-ac_pwd='$ac_pwd'
-srcdir='$srcdir'
-INSTALL='$INSTALL'
-test -n "\$AWK" || AWK=awk
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-# The default lists apply if the user does not specify any file.
-ac_need_defaults=:
-while test $# != 0
-do
- case $1 in
- --*=?*)
- ac_option=`expr "X$1" : 'X\([^=]*\)='`
- ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
- ac_shift=:
- ;;
- --*=)
- ac_option=`expr "X$1" : 'X\([^=]*\)='`
- ac_optarg=
- ac_shift=:
- ;;
- *)
- ac_option=$1
- ac_optarg=$2
- ac_shift=shift
- ;;
- esac
-
- case $ac_option in
- # Handling of the options.
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- ac_cs_recheck=: ;;
- --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
- $as_echo "$ac_cs_version"; exit ;;
- --config | --confi | --conf | --con | --co | --c )
- $as_echo "$ac_cs_config"; exit ;;
- --debug | --debu | --deb | --de | --d | -d )
- debug=: ;;
- --file | --fil | --fi | --f )
- $ac_shift
- case $ac_optarg in
- *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
- '') as_fn_error $? "missing file argument" ;;
- esac
- as_fn_append CONFIG_FILES " '$ac_optarg'"
- ac_need_defaults=false;;
- --header | --heade | --head | --hea )
- $ac_shift
- case $ac_optarg in
- *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
- esac
- as_fn_append CONFIG_HEADERS " '$ac_optarg'"
- ac_need_defaults=false;;
- --he | --h)
- # Conflict between --help and --header
- as_fn_error $? "ambiguous option: \`$1'
-Try \`$0 --help' for more information.";;
- --help | --hel | -h )
- $as_echo "$ac_cs_usage"; exit ;;
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil | --si | --s)
- ac_cs_silent=: ;;
-
- # This is an error.
- -*) as_fn_error $? "unrecognized option: \`$1'
-Try \`$0 --help' for more information." ;;
-
- *) as_fn_append ac_config_targets " $1"
- ac_need_defaults=false ;;
-
- esac
- shift
-done
-
-ac_configure_extra_args=
-
-if $ac_cs_silent; then
- exec 6>/dev/null
- ac_configure_extra_args="$ac_configure_extra_args --silent"
-fi
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-if \$ac_cs_recheck; then
- set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
- shift
- \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
- CONFIG_SHELL='$SHELL'
- export CONFIG_SHELL
- exec "\$@"
-fi
-
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-exec 5>>config.log
-{
- echo
- sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
- $as_echo "$ac_log"
-} >&5
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-#
-# INIT-COMMANDS
-#
-
- srcdir="${srcdir}"
- objroot="${objroot}"
-
-
- srcdir="${srcdir}"
- objroot="${objroot}"
-
-
- srcdir="${srcdir}"
- objroot="${objroot}"
- mangling_map="${mangling_map}"
- public_syms="${public_syms}"
- JEMALLOC_PREFIX="${JEMALLOC_PREFIX}"
-
-
- srcdir="${srcdir}"
- objroot="${objroot}"
-
-
- srcdir="${srcdir}"
- objroot="${objroot}"
-
-
- SHELL="${SHELL}"
- srcdir="${srcdir}"
- objroot="${objroot}"
- LG_QUANTA="${LG_QUANTA}"
- LG_TINY_MIN=${LG_TINY_MIN}
- LG_PAGE_SIZES="${LG_PAGE_SIZES}"
- LG_SIZE_CLASS_GROUP=${LG_SIZE_CLASS_GROUP}
-
-
- srcdir="${srcdir}"
- objroot="${objroot}"
-
-
- srcdir="${srcdir}"
- objroot="${objroot}"
-
-
- srcdir="${srcdir}"
- objroot="${objroot}"
-
-
- srcdir="${srcdir}"
- objroot="${objroot}"
-
-
- srcdir="${srcdir}"
- objroot="${objroot}"
- install_suffix="${install_suffix}"
-
-
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-
-# Handling of arguments.
-for ac_config_target in $ac_config_targets
-do
- case $ac_config_target in
- "include/jemalloc/internal/private_namespace.h") CONFIG_COMMANDS="$CONFIG_COMMANDS include/jemalloc/internal/private_namespace.h" ;;
- "include/jemalloc/internal/private_unnamespace.h") CONFIG_COMMANDS="$CONFIG_COMMANDS include/jemalloc/internal/private_unnamespace.h" ;;
- "include/jemalloc/internal/public_symbols.txt") CONFIG_COMMANDS="$CONFIG_COMMANDS include/jemalloc/internal/public_symbols.txt" ;;
- "include/jemalloc/internal/public_namespace.h") CONFIG_COMMANDS="$CONFIG_COMMANDS include/jemalloc/internal/public_namespace.h" ;;
- "include/jemalloc/internal/public_unnamespace.h") CONFIG_COMMANDS="$CONFIG_COMMANDS include/jemalloc/internal/public_unnamespace.h" ;;
- "include/jemalloc/internal/size_classes.h") CONFIG_COMMANDS="$CONFIG_COMMANDS include/jemalloc/internal/size_classes.h" ;;
- "include/jemalloc/jemalloc_protos_jet.h") CONFIG_COMMANDS="$CONFIG_COMMANDS include/jemalloc/jemalloc_protos_jet.h" ;;
- "include/jemalloc/jemalloc_rename.h") CONFIG_COMMANDS="$CONFIG_COMMANDS include/jemalloc/jemalloc_rename.h" ;;
- "include/jemalloc/jemalloc_mangle.h") CONFIG_COMMANDS="$CONFIG_COMMANDS include/jemalloc/jemalloc_mangle.h" ;;
- "include/jemalloc/jemalloc_mangle_jet.h") CONFIG_COMMANDS="$CONFIG_COMMANDS include/jemalloc/jemalloc_mangle_jet.h" ;;
- "include/jemalloc/jemalloc.h") CONFIG_COMMANDS="$CONFIG_COMMANDS include/jemalloc/jemalloc.h" ;;
- "$cfghdrs_tup") CONFIG_HEADERS="$CONFIG_HEADERS $cfghdrs_tup" ;;
- "$cfgoutputs_tup") CONFIG_FILES="$CONFIG_FILES $cfgoutputs_tup" ;;
- "config.stamp") CONFIG_FILES="$CONFIG_FILES config.stamp" ;;
- "bin/jemalloc-config") CONFIG_FILES="$CONFIG_FILES bin/jemalloc-config" ;;
- "bin/jemalloc.sh") CONFIG_FILES="$CONFIG_FILES bin/jemalloc.sh" ;;
- "bin/jeprof") CONFIG_FILES="$CONFIG_FILES bin/jeprof" ;;
-
- *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
- esac
-done
-
-
-# If the user did not use the arguments to specify the items to instantiate,
-# then the envvar interface is used. Set only those that are not.
-# We use the long form for the default assignment because of an extremely
-# bizarre bug on SunOS 4.1.3.
-if $ac_need_defaults; then
- test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
- test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
- test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
-fi
-
-# Have a temporary directory for convenience. Make it in the build tree
-# simply because there is no reason against having it here, and in addition,
-# creating and moving files from /tmp can sometimes cause problems.
-# Hook for its removal unless debugging.
-# Note that there is a small window in which the directory will not be cleaned:
-# after its creation but before its name has been assigned to `$tmp'.
-$debug ||
-{
- tmp= ac_tmp=
- trap 'exit_status=$?
- : "${ac_tmp:=$tmp}"
- { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
-' 0
- trap 'as_fn_exit 1' 1 2 13 15
-}
-# Create a (secure) tmp directory for tmp files.
-
-{
- tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
- test -d "$tmp"
-} ||
-{
- tmp=./conf$$-$RANDOM
- (umask 077 && mkdir "$tmp")
-} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
-ac_tmp=$tmp
-
-# Set up the scripts for CONFIG_FILES section.
-# No need to generate them if there are no CONFIG_FILES.
-# This happens for instance with `./config.status config.h'.
-if test -n "$CONFIG_FILES"; then
-
-
-ac_cr=`echo X | tr X '\015'`
-# On cygwin, bash can eat \r inside `` if the user requested igncr.
-# But we know of no other shell where ac_cr would be empty at this
-# point, so we can use a bashism as a fallback.
-if test "x$ac_cr" = x; then
- eval ac_cr=\$\'\\r\'
-fi
-ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
-if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
- ac_cs_awk_cr='\\r'
-else
- ac_cs_awk_cr=$ac_cr
-fi
-
-echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
-_ACEOF
-
-
-{
- echo "cat >conf$$subs.awk <<_ACEOF" &&
- echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
- echo "_ACEOF"
-} >conf$$subs.sh ||
- as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
-ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
-ac_delim='%!_!# '
-for ac_last_try in false false false false false :; do
- . ./conf$$subs.sh ||
- as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
-
- ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
- if test $ac_delim_n = $ac_delim_num; then
- break
- elif $ac_last_try; then
- as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
- else
- ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
- fi
-done
-rm -f conf$$subs.sh
-
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
-_ACEOF
-sed -n '
-h
-s/^/S["/; s/!.*/"]=/
-p
-g
-s/^[^!]*!//
-:repl
-t repl
-s/'"$ac_delim"'$//
-t delim
-:nl
-h
-s/\(.\{148\}\)..*/\1/
-t more1
-s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
-p
-n
-b repl
-:more1
-s/["\\]/\\&/g; s/^/"/; s/$/"\\/
-p
-g
-s/.\{148\}//
-t nl
-:delim
-h
-s/\(.\{148\}\)..*/\1/
-t more2
-s/["\\]/\\&/g; s/^/"/; s/$/"/
-p
-b
-:more2
-s/["\\]/\\&/g; s/^/"/; s/$/"\\/
-p
-g
-s/.\{148\}//
-t delim
-' <conf$$subs.awk | sed '
-/^[^""]/{
- N
- s/\n//
-}
-' >>$CONFIG_STATUS || ac_write_fail=1
-rm -f conf$$subs.awk
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-_ACAWK
-cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
- for (key in S) S_is_set[key] = 1
- FS = ""
-
-}
-{
- line = $ 0
- nfields = split(line, field, "@")
- substed = 0
- len = length(field[1])
- for (i = 2; i < nfields; i++) {
- key = field[i]
- keylen = length(key)
- if (S_is_set[key]) {
- value = S[key]
- line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
- len += length(value) + length(field[++i])
- substed = 1
- } else
- len += 1 + keylen
- }
-
- print line
-}
-
-_ACAWK
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
- sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
-else
- cat
-fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
- || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
-_ACEOF
-
-# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
-# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
-# trailing colons and then remove the whole line if VPATH becomes empty
-# (actually we leave an empty line to preserve line numbers).
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
-h
-s///
-s/^/:/
-s/[ ]*$/:/
-s/:\$(srcdir):/:/g
-s/:\${srcdir}:/:/g
-s/:@srcdir@:/:/g
-s/^:*//
-s/:*$//
-x
-s/\(=[ ]*\).*/\1/
-G
-s/\n//
-s/^[^=]*=[ ]*$//
-}'
-fi
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-fi # test -n "$CONFIG_FILES"
-
-# Set up the scripts for CONFIG_HEADERS section.
-# No need to generate them if there are no CONFIG_HEADERS.
-# This happens for instance with `./config.status Makefile'.
-if test -n "$CONFIG_HEADERS"; then
-cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
-BEGIN {
-_ACEOF
-
-# Transform confdefs.h into an awk script `defines.awk', embedded as
-# here-document in config.status, that substitutes the proper values into
-# config.h.in to produce config.h.
-
-# Create a delimiter string that does not exist in confdefs.h, to ease
-# handling of long lines.
-ac_delim='%!_!# '
-for ac_last_try in false false :; do
- ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
- if test -z "$ac_tt"; then
- break
- elif $ac_last_try; then
- as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
- else
- ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
- fi
-done
-
-# For the awk script, D is an array of macro values keyed by name,
-# likewise P contains macro parameters if any. Preserve backslash
-# newline sequences.
-
-ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
-sed -n '
-s/.\{148\}/&'"$ac_delim"'/g
-t rset
-:rset
-s/^[ ]*#[ ]*define[ ][ ]*/ /
-t def
-d
-:def
-s/\\$//
-t bsnl
-s/["\\]/\\&/g
-s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
-D["\1"]=" \3"/p
-s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
-d
-:bsnl
-s/["\\]/\\&/g
-s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
-D["\1"]=" \3\\\\\\n"\\/p
-t cont
-s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
-t cont
-d
-:cont
-n
-s/.\{148\}/&'"$ac_delim"'/g
-t clear
-:clear
-s/\\$//
-t bsnlc
-s/["\\]/\\&/g; s/^/"/; s/$/"/p
-d
-:bsnlc
-s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
-b cont
-' <confdefs.h | sed '
-s/'"$ac_delim"'/"\\\
-"/g' >>$CONFIG_STATUS || ac_write_fail=1
-
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
- for (key in D) D_is_set[key] = 1
- FS = ""
-}
-/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
- line = \$ 0
- split(line, arg, " ")
- if (arg[1] == "#") {
- defundef = arg[2]
- mac1 = arg[3]
- } else {
- defundef = substr(arg[1], 2)
- mac1 = arg[2]
- }
- split(mac1, mac2, "(") #)
- macro = mac2[1]
- prefix = substr(line, 1, index(line, defundef) - 1)
- if (D_is_set[macro]) {
- # Preserve the white space surrounding the "#".
- print prefix "define", macro P[macro] D[macro]
- next
- } else {
- # Replace #undef with comments. This is necessary, for example,
- # in the case of _POSIX_SOURCE, which is predefined and required
- # on some systems where configure will not decide to define it.
- if (defundef == "undef") {
- print "/*", prefix defundef, macro, "*/"
- next
- }
- }
-}
-{ print }
-_ACAWK
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
- as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
-fi # test -n "$CONFIG_HEADERS"
-
-
-eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS"
-shift
-for ac_tag
-do
- case $ac_tag in
- :[FHLC]) ac_mode=$ac_tag; continue;;
- esac
- case $ac_mode$ac_tag in
- :[FHL]*:*);;
- :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
- :[FH]-) ac_tag=-:-;;
- :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
- esac
- ac_save_IFS=$IFS
- IFS=:
- set x $ac_tag
- IFS=$ac_save_IFS
- shift
- ac_file=$1
- shift
-
- case $ac_mode in
- :L) ac_source=$1;;
- :[FH])
- ac_file_inputs=
- for ac_f
- do
- case $ac_f in
- -) ac_f="$ac_tmp/stdin";;
- *) # Look for the file first in the build tree, then in the source tree
- # (if the path is not absolute). The absolute path cannot be DOS-style,
- # because $ac_f cannot contain `:'.
- test -f "$ac_f" ||
- case $ac_f in
- [\\/$]*) false;;
- *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
- esac ||
- as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
- esac
- case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
- as_fn_append ac_file_inputs " '$ac_f'"
- done
-
- # Let's still pretend it is `configure' which instantiates (i.e., don't
- # use $as_me), people would be surprised to read:
- # /* config.h. Generated by config.status. */
- configure_input='Generated from '`
- $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
- `' by configure.'
- if test x"$ac_file" != x-; then
- configure_input="$ac_file. $configure_input"
- { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
-$as_echo "$as_me: creating $ac_file" >&6;}
- fi
- # Neutralize special characters interpreted by sed in replacement strings.
- case $configure_input in #(
- *\&* | *\|* | *\\* )
- ac_sed_conf_input=`$as_echo "$configure_input" |
- sed 's/[\\\\&|]/\\\\&/g'`;; #(
- *) ac_sed_conf_input=$configure_input;;
- esac
-
- case $ac_tag in
- *:-:* | *:-) cat >"$ac_tmp/stdin" \
- || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
- esac
- ;;
- esac
-
- ac_dir=`$as_dirname -- "$ac_file" ||
-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$ac_file" : 'X\(//\)[^/]' \| \
- X"$ac_file" : 'X\(//\)$' \| \
- X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$ac_file" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- as_dir="$ac_dir"; as_fn_mkdir_p
- ac_builddir=.
-
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
- ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
- # A ".." for each directory in $ac_dir_suffix.
- ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
- case $ac_top_builddir_sub in
- "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
- *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
- esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
-
-case $srcdir in
- .) # We are building in place.
- ac_srcdir=.
- ac_top_srcdir=$ac_top_builddir_sub
- ac_abs_top_srcdir=$ac_pwd ;;
- [\\/]* | ?:[\\/]* ) # Absolute name.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir
- ac_abs_top_srcdir=$srcdir ;;
- *) # Relative name.
- ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_build_prefix$srcdir
- ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
-esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
-
-
- case $ac_mode in
- :F)
- #
- # CONFIG_FILE
- #
-
- case $INSTALL in
- [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
- *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
- esac
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-# If the template does not know about datarootdir, expand it.
-# FIXME: This hack should be removed a few years after 2.60.
-ac_datarootdir_hack=; ac_datarootdir_seen=
-ac_sed_dataroot='
-/datarootdir/ {
- p
- q
-}
-/@datadir@/p
-/@docdir@/p
-/@infodir@/p
-/@localedir@/p
-/@mandir@/p'
-case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
-*datarootdir*) ac_datarootdir_seen=yes;;
-*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
-$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
- ac_datarootdir_hack='
- s&@datadir@&$datadir&g
- s&@docdir@&$docdir&g
- s&@infodir@&$infodir&g
- s&@localedir@&$localedir&g
- s&@mandir@&$mandir&g
- s&\\\${datarootdir}&$datarootdir&g' ;;
-esac
-_ACEOF
-
-# Neutralize VPATH when `$srcdir' = `.'.
-# Shell code in configure.ac might set extrasub.
-# FIXME: do we really want to maintain this feature?
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-ac_sed_extra="$ac_vpsub
-$extrasub
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-:t
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s|@configure_input@|$ac_sed_conf_input|;t t
-s&@top_builddir@&$ac_top_builddir_sub&;t t
-s&@top_build_prefix@&$ac_top_build_prefix&;t t
-s&@srcdir@&$ac_srcdir&;t t
-s&@abs_srcdir@&$ac_abs_srcdir&;t t
-s&@top_srcdir@&$ac_top_srcdir&;t t
-s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
-s&@builddir@&$ac_builddir&;t t
-s&@abs_builddir@&$ac_abs_builddir&;t t
-s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
-s&@INSTALL@&$ac_INSTALL&;t t
-$ac_datarootdir_hack
-"
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
- >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
-
-test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
- { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
- { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
- "$ac_tmp/out"`; test -z "$ac_out"; } &&
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined. Please make sure it is defined" >&5
-$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined. Please make sure it is defined" >&2;}
-
- rm -f "$ac_tmp/stdin"
- case $ac_file in
- -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
- *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
- esac \
- || as_fn_error $? "could not create $ac_file" "$LINENO" 5
- ;;
- :H)
- #
- # CONFIG_HEADER
- #
- if test x"$ac_file" != x-; then
- {
- $as_echo "/* $configure_input */" \
- && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
- } >"$ac_tmp/config.h" \
- || as_fn_error $? "could not create $ac_file" "$LINENO" 5
- if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
-$as_echo "$as_me: $ac_file is unchanged" >&6;}
- else
- rm -f "$ac_file"
- mv "$ac_tmp/config.h" "$ac_file" \
- || as_fn_error $? "could not create $ac_file" "$LINENO" 5
- fi
- else
- $as_echo "/* $configure_input */" \
- && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
- || as_fn_error $? "could not create -" "$LINENO" 5
- fi
- ;;
-
- :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
-$as_echo "$as_me: executing $ac_file commands" >&6;}
- ;;
- esac
-
-
- case $ac_file$ac_mode in
- "include/jemalloc/internal/private_namespace.h":C)
- mkdir -p "${objroot}include/jemalloc/internal"
- "${srcdir}/include/jemalloc/internal/private_namespace.sh" "${srcdir}/include/jemalloc/internal/private_symbols.txt" > "${objroot}include/jemalloc/internal/private_namespace.h"
- ;;
- "include/jemalloc/internal/private_unnamespace.h":C)
- mkdir -p "${objroot}include/jemalloc/internal"
- "${srcdir}/include/jemalloc/internal/private_unnamespace.sh" "${srcdir}/include/jemalloc/internal/private_symbols.txt" > "${objroot}include/jemalloc/internal/private_unnamespace.h"
- ;;
- "include/jemalloc/internal/public_symbols.txt":C)
- f="${objroot}include/jemalloc/internal/public_symbols.txt"
- mkdir -p "${objroot}include/jemalloc/internal"
- cp /dev/null "${f}"
- for nm in `echo ${mangling_map} |tr ',' ' '` ; do
- n=`echo ${nm} |tr ':' ' ' |awk '{print $1}'`
- m=`echo ${nm} |tr ':' ' ' |awk '{print $2}'`
- echo "${n}:${m}" >> "${f}"
- public_syms=`for sym in ${public_syms}; do echo "${sym}"; done |grep -v "^${n}\$" |tr '\n' ' '`
- done
- for sym in ${public_syms} ; do
- n="${sym}"
- m="${JEMALLOC_PREFIX}${sym}"
- echo "${n}:${m}" >> "${f}"
- done
- ;;
- "include/jemalloc/internal/public_namespace.h":C)
- mkdir -p "${objroot}include/jemalloc/internal"
- "${srcdir}/include/jemalloc/internal/public_namespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_namespace.h"
- ;;
- "include/jemalloc/internal/public_unnamespace.h":C)
- mkdir -p "${objroot}include/jemalloc/internal"
- "${srcdir}/include/jemalloc/internal/public_unnamespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_unnamespace.h"
- ;;
- "include/jemalloc/internal/size_classes.h":C)
- mkdir -p "${objroot}include/jemalloc/internal"
- "${SHELL}" "${srcdir}/include/jemalloc/internal/size_classes.sh" "${LG_QUANTA}" ${LG_TINY_MIN} "${LG_PAGE_SIZES}" ${LG_SIZE_CLASS_GROUP} > "${objroot}include/jemalloc/internal/size_classes.h"
- ;;
- "include/jemalloc/jemalloc_protos_jet.h":C)
- mkdir -p "${objroot}include/jemalloc"
- cat "${srcdir}/include/jemalloc/jemalloc_protos.h.in" | sed -e 's/@je_@/jet_/g' > "${objroot}include/jemalloc/jemalloc_protos_jet.h"
- ;;
- "include/jemalloc/jemalloc_rename.h":C)
- mkdir -p "${objroot}include/jemalloc"
- "${srcdir}/include/jemalloc/jemalloc_rename.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/jemalloc_rename.h"
- ;;
- "include/jemalloc/jemalloc_mangle.h":C)
- mkdir -p "${objroot}include/jemalloc"
- "${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" je_ > "${objroot}include/jemalloc/jemalloc_mangle.h"
- ;;
- "include/jemalloc/jemalloc_mangle_jet.h":C)
- mkdir -p "${objroot}include/jemalloc"
- "${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" jet_ > "${objroot}include/jemalloc/jemalloc_mangle_jet.h"
- ;;
- "include/jemalloc/jemalloc.h":C)
- mkdir -p "${objroot}include/jemalloc"
- "${srcdir}/include/jemalloc/jemalloc.sh" "${objroot}" > "${objroot}include/jemalloc/jemalloc${install_suffix}.h"
- ;;
-
- esac
-done # for ac_tag
-
-
-as_fn_exit 0
-_ACEOF
-ac_clean_files=$ac_clean_files_save
-
-test $ac_write_fail = 0 ||
- as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
-
-
-# configure is writing to config.log, and then calls config.status.
-# config.status does its own redirection, appending to config.log.
-# Unfortunately, on DOS this fails, as config.log is still kept open
-# by configure, so config.status won't be able to write to it; its
-# output is simply discarded. So we exec the FD to /dev/null,
-# effectively closing config.log, so it can be properly (re)opened and
-# appended to by config.status. When coming back to configure, we
-# need to make the FD available again.
-if test "$no_create" != yes; then
- ac_cs_success=:
- ac_config_status_args=
- test "$silent" = yes &&
- ac_config_status_args="$ac_config_status_args --quiet"
- exec 5>/dev/null
- $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
- exec 5>>config.log
- # Use ||, not &&, to avoid exiting from the if with $? = 1, which
- # would make configure fail if this is the last instruction.
- $ac_cs_success || as_fn_exit 1
-fi
-if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
-$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ===============================================================================" >&5
-$as_echo "===============================================================================" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: jemalloc version : ${jemalloc_version}" >&5
-$as_echo "jemalloc version : ${jemalloc_version}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: library revision : ${rev}" >&5
-$as_echo "library revision : ${rev}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5
-$as_echo "" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: CONFIG : ${CONFIG}" >&5
-$as_echo "CONFIG : ${CONFIG}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: CC : ${CC}" >&5
-$as_echo "CC : ${CC}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: CFLAGS : ${CFLAGS}" >&5
-$as_echo "CFLAGS : ${CFLAGS}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: EXTRA_CFLAGS : ${EXTRA_CFLAGS}" >&5
-$as_echo "EXTRA_CFLAGS : ${EXTRA_CFLAGS}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: CPPFLAGS : ${CPPFLAGS}" >&5
-$as_echo "CPPFLAGS : ${CPPFLAGS}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: LDFLAGS : ${LDFLAGS}" >&5
-$as_echo "LDFLAGS : ${LDFLAGS}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: EXTRA_LDFLAGS : ${EXTRA_LDFLAGS}" >&5
-$as_echo "EXTRA_LDFLAGS : ${EXTRA_LDFLAGS}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: LIBS : ${LIBS}" >&5
-$as_echo "LIBS : ${LIBS}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: RPATH_EXTRA : ${RPATH_EXTRA}" >&5
-$as_echo "RPATH_EXTRA : ${RPATH_EXTRA}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5
-$as_echo "" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: XSLTPROC : ${XSLTPROC}" >&5
-$as_echo "XSLTPROC : ${XSLTPROC}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: XSLROOT : ${XSLROOT}" >&5
-$as_echo "XSLROOT : ${XSLROOT}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5
-$as_echo "" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: PREFIX : ${PREFIX}" >&5
-$as_echo "PREFIX : ${PREFIX}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: BINDIR : ${BINDIR}" >&5
-$as_echo "BINDIR : ${BINDIR}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: DATADIR : ${DATADIR}" >&5
-$as_echo "DATADIR : ${DATADIR}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: INCLUDEDIR : ${INCLUDEDIR}" >&5
-$as_echo "INCLUDEDIR : ${INCLUDEDIR}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: LIBDIR : ${LIBDIR}" >&5
-$as_echo "LIBDIR : ${LIBDIR}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: MANDIR : ${MANDIR}" >&5
-$as_echo "MANDIR : ${MANDIR}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5
-$as_echo "" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: srcroot : ${srcroot}" >&5
-$as_echo "srcroot : ${srcroot}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: abs_srcroot : ${abs_srcroot}" >&5
-$as_echo "abs_srcroot : ${abs_srcroot}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: objroot : ${objroot}" >&5
-$as_echo "objroot : ${objroot}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: abs_objroot : ${abs_objroot}" >&5
-$as_echo "abs_objroot : ${abs_objroot}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5
-$as_echo "" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: JEMALLOC_PREFIX : ${JEMALLOC_PREFIX}" >&5
-$as_echo "JEMALLOC_PREFIX : ${JEMALLOC_PREFIX}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: JEMALLOC_PRIVATE_NAMESPACE" >&5
-$as_echo "JEMALLOC_PRIVATE_NAMESPACE" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: : ${JEMALLOC_PRIVATE_NAMESPACE}" >&5
-$as_echo " : ${JEMALLOC_PRIVATE_NAMESPACE}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: install_suffix : ${install_suffix}" >&5
-$as_echo "install_suffix : ${install_suffix}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: malloc_conf : ${config_malloc_conf}" >&5
-$as_echo "malloc_conf : ${config_malloc_conf}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: autogen : ${enable_autogen}" >&5
-$as_echo "autogen : ${enable_autogen}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: cc-silence : ${enable_cc_silence}" >&5
-$as_echo "cc-silence : ${enable_cc_silence}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: debug : ${enable_debug}" >&5
-$as_echo "debug : ${enable_debug}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: code-coverage : ${enable_code_coverage}" >&5
-$as_echo "code-coverage : ${enable_code_coverage}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: stats : ${enable_stats}" >&5
-$as_echo "stats : ${enable_stats}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: prof : ${enable_prof}" >&5
-$as_echo "prof : ${enable_prof}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: prof-libunwind : ${enable_prof_libunwind}" >&5
-$as_echo "prof-libunwind : ${enable_prof_libunwind}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: prof-libgcc : ${enable_prof_libgcc}" >&5
-$as_echo "prof-libgcc : ${enable_prof_libgcc}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: prof-gcc : ${enable_prof_gcc}" >&5
-$as_echo "prof-gcc : ${enable_prof_gcc}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: tcache : ${enable_tcache}" >&5
-$as_echo "tcache : ${enable_tcache}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: fill : ${enable_fill}" >&5
-$as_echo "fill : ${enable_fill}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: utrace : ${enable_utrace}" >&5
-$as_echo "utrace : ${enable_utrace}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: valgrind : ${enable_valgrind}" >&5
-$as_echo "valgrind : ${enable_valgrind}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: xmalloc : ${enable_xmalloc}" >&5
-$as_echo "xmalloc : ${enable_xmalloc}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: munmap : ${enable_munmap}" >&5
-$as_echo "munmap : ${enable_munmap}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: lazy_lock : ${enable_lazy_lock}" >&5
-$as_echo "lazy_lock : ${enable_lazy_lock}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: tls : ${enable_tls}" >&5
-$as_echo "tls : ${enable_tls}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: cache-oblivious : ${enable_cache_oblivious}" >&5
-$as_echo "cache-oblivious : ${enable_cache_oblivious}" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: ===============================================================================" >&5
-$as_echo "===============================================================================" >&6; }
diff --git a/memory/jemalloc/src/configure.ac b/memory/jemalloc/src/configure.ac
deleted file mode 100644
index 104fd994d8..0000000000
--- a/memory/jemalloc/src/configure.ac
+++ /dev/null
@@ -1,1970 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-AC_INIT([Makefile.in])
-
-AC_CONFIG_AUX_DIR([build-aux])
-
-dnl ============================================================================
-dnl Custom macro definitions.
-
-dnl JE_CFLAGS_APPEND(cflag)
-AC_DEFUN([JE_CFLAGS_APPEND],
-[
-AC_MSG_CHECKING([whether compiler supports $1])
-TCFLAGS="${CFLAGS}"
-if test "x${CFLAGS}" = "x" ; then
- CFLAGS="$1"
-else
- CFLAGS="${CFLAGS} $1"
-fi
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
-[[
-]], [[
- return 0;
-]])],
- [je_cv_cflags_appended=$1]
- AC_MSG_RESULT([yes]),
- [je_cv_cflags_appended=]
- AC_MSG_RESULT([no])
- [CFLAGS="${TCFLAGS}"]
-)
-])
-
-dnl JE_COMPILABLE(label, hcode, mcode, rvar)
-dnl
-dnl Use AC_LINK_IFELSE() rather than AC_COMPILE_IFELSE() so that linker errors
-dnl cause failure.
-AC_DEFUN([JE_COMPILABLE],
-[
-AC_CACHE_CHECK([whether $1 is compilable],
- [$4],
- [AC_LINK_IFELSE([AC_LANG_PROGRAM([$2],
- [$3])],
- [$4=yes],
- [$4=no])])
-])
-
-dnl ============================================================================
-
-CONFIG=`echo ${ac_configure_args} | sed -e 's#'"'"'\([^ ]*\)'"'"'#\1#g'`
-AC_SUBST([CONFIG])
-
-dnl Library revision.
-rev=2
-AC_SUBST([rev])
-
-srcroot=$srcdir
-if test "x${srcroot}" = "x." ; then
- srcroot=""
-else
- srcroot="${srcroot}/"
-fi
-AC_SUBST([srcroot])
-abs_srcroot="`cd \"${srcdir}\"; pwd`/"
-AC_SUBST([abs_srcroot])
-
-objroot=""
-AC_SUBST([objroot])
-abs_objroot="`pwd`/"
-AC_SUBST([abs_objroot])
-
-dnl Munge install path variables.
-if test "x$prefix" = "xNONE" ; then
- prefix="/usr/local"
-fi
-if test "x$exec_prefix" = "xNONE" ; then
- exec_prefix=$prefix
-fi
-PREFIX=$prefix
-AC_SUBST([PREFIX])
-BINDIR=`eval echo $bindir`
-BINDIR=`eval echo $BINDIR`
-AC_SUBST([BINDIR])
-INCLUDEDIR=`eval echo $includedir`
-INCLUDEDIR=`eval echo $INCLUDEDIR`
-AC_SUBST([INCLUDEDIR])
-LIBDIR=`eval echo $libdir`
-LIBDIR=`eval echo $LIBDIR`
-AC_SUBST([LIBDIR])
-DATADIR=`eval echo $datadir`
-DATADIR=`eval echo $DATADIR`
-AC_SUBST([DATADIR])
-MANDIR=`eval echo $mandir`
-MANDIR=`eval echo $MANDIR`
-AC_SUBST([MANDIR])
-
-dnl Support for building documentation.
-AC_PATH_PROG([XSLTPROC], [xsltproc], [false], [$PATH])
-if test -d "/usr/share/xml/docbook/stylesheet/docbook-xsl" ; then
- DEFAULT_XSLROOT="/usr/share/xml/docbook/stylesheet/docbook-xsl"
-elif test -d "/usr/share/sgml/docbook/xsl-stylesheets" ; then
- DEFAULT_XSLROOT="/usr/share/sgml/docbook/xsl-stylesheets"
-else
- dnl Documentation building will fail if this default gets used.
- DEFAULT_XSLROOT=""
-fi
-AC_ARG_WITH([xslroot],
- [AS_HELP_STRING([--with-xslroot=<path>], [XSL stylesheet root path])], [
-if test "x$with_xslroot" = "xno" ; then
- XSLROOT="${DEFAULT_XSLROOT}"
-else
- XSLROOT="${with_xslroot}"
-fi
-],
- XSLROOT="${DEFAULT_XSLROOT}"
-)
-AC_SUBST([XSLROOT])
-
-dnl If CFLAGS isn't defined, set CFLAGS to something reasonable. Otherwise,
-dnl just prevent autoconf from molesting CFLAGS.
-CFLAGS=$CFLAGS
-AC_PROG_CC
-
-if test "x$GCC" != "xyes" ; then
- AC_CACHE_CHECK([whether compiler is MSVC],
- [je_cv_msvc],
- [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
- [
-#ifndef _MSC_VER
- int fail[-1];
-#endif
-])],
- [je_cv_msvc=yes],
- [je_cv_msvc=no])])
-fi
-
-dnl check if a cray prgenv wrapper compiler is being used
-je_cv_cray_prgenv_wrapper=""
-if test "x${PE_ENV}" != "x" ; then
- case "${CC}" in
- CC|cc)
- je_cv_cray_prgenv_wrapper="yes"
- ;;
- *)
- ;;
- esac
-fi
-
-AC_CACHE_CHECK([whether compiler is cray],
- [je_cv_cray],
- [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
- [
-#ifndef _CRAYC
- int fail[-1];
-#endif
-])],
- [je_cv_cray=yes],
- [je_cv_cray=no])])
-
-if test "x${je_cv_cray}" = "xyes" ; then
- AC_CACHE_CHECK([whether cray compiler version is 8.4],
- [je_cv_cray_84],
- [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],
- [
-#if !(_RELEASE_MAJOR == 8 && _RELEASE_MINOR == 4)
- int fail[-1];
-#endif
-])],
- [je_cv_cray_84=yes],
- [je_cv_cray_84=no])])
-fi
-
-if test "x$CFLAGS" = "x" ; then
- no_CFLAGS="yes"
- if test "x$GCC" = "xyes" ; then
-dnl JE_CFLAGS_APPEND([-std=gnu99])
- JE_CFLAGS_APPEND([-std=gnu11])
- if test "x$je_cv_cflags_appended" = "x-std=gnu11" ; then
- AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT])
- else
- JE_CFLAGS_APPEND([-std=gnu99])
- if test "x$je_cv_cflags_appended" = "x-std=gnu99" ; then
- AC_DEFINE_UNQUOTED([JEMALLOC_HAS_RESTRICT])
- fi
- fi
- JE_CFLAGS_APPEND([-Wall])
- JE_CFLAGS_APPEND([-Werror=declaration-after-statement])
- JE_CFLAGS_APPEND([-Wshorten-64-to-32])
- JE_CFLAGS_APPEND([-Wsign-compare])
- JE_CFLAGS_APPEND([-pipe])
- JE_CFLAGS_APPEND([-g3])
- elif test "x$je_cv_msvc" = "xyes" ; then
- CC="$CC -nologo"
- JE_CFLAGS_APPEND([-Zi])
- JE_CFLAGS_APPEND([-MT])
- JE_CFLAGS_APPEND([-W3])
- JE_CFLAGS_APPEND([-FS])
- CPPFLAGS="$CPPFLAGS -I${srcdir}/include/msvc_compat"
- fi
- if test "x$je_cv_cray" = "xyes" ; then
- dnl cray compiler 8.4 has an inlining bug
- if test "x$je_cv_cray_84" = "xyes" ; then
- JE_CFLAGS_APPEND([-hipa2])
- JE_CFLAGS_APPEND([-hnognu])
- fi
- if test "x$enable_cc_silence" != "xno" ; then
- dnl ignore unreachable code warning
- JE_CFLAGS_APPEND([-hnomessage=128])
- dnl ignore redefinition of "malloc", "free", etc warning
- JE_CFLAGS_APPEND([-hnomessage=1357])
- fi
- fi
-fi
-AC_SUBST([EXTRA_CFLAGS])
-AC_PROG_CPP
-
-AC_C_BIGENDIAN([ac_cv_big_endian=1], [ac_cv_big_endian=0])
-if test "x${ac_cv_big_endian}" = "x1" ; then
- AC_DEFINE_UNQUOTED([JEMALLOC_BIG_ENDIAN], [ ])
-fi
-
-if test "x${je_cv_msvc}" = "xyes" -a "x${ac_cv_header_inttypes_h}" = "xno"; then
- CPPFLAGS="$CPPFLAGS -I${srcdir}/include/msvc_compat/C99"
-fi
-
-if test "x${je_cv_msvc}" = "xyes" ; then
- LG_SIZEOF_PTR=LG_SIZEOF_PTR_WIN
- AC_MSG_RESULT([Using a predefined value for sizeof(void *): 4 for 32-bit, 8 for 64-bit])
-else
- AC_CHECK_SIZEOF([void *])
- if test "x${ac_cv_sizeof_void_p}" = "x8" ; then
- LG_SIZEOF_PTR=3
- elif test "x${ac_cv_sizeof_void_p}" = "x4" ; then
- LG_SIZEOF_PTR=2
- else
- AC_MSG_ERROR([Unsupported pointer size: ${ac_cv_sizeof_void_p}])
- fi
-fi
-AC_DEFINE_UNQUOTED([LG_SIZEOF_PTR], [$LG_SIZEOF_PTR])
-
-AC_CHECK_SIZEOF([int])
-if test "x${ac_cv_sizeof_int}" = "x8" ; then
- LG_SIZEOF_INT=3
-elif test "x${ac_cv_sizeof_int}" = "x4" ; then
- LG_SIZEOF_INT=2
-else
- AC_MSG_ERROR([Unsupported int size: ${ac_cv_sizeof_int}])
-fi
-AC_DEFINE_UNQUOTED([LG_SIZEOF_INT], [$LG_SIZEOF_INT])
-
-AC_CHECK_SIZEOF([long])
-if test "x${ac_cv_sizeof_long}" = "x8" ; then
- LG_SIZEOF_LONG=3
-elif test "x${ac_cv_sizeof_long}" = "x4" ; then
- LG_SIZEOF_LONG=2
-else
- AC_MSG_ERROR([Unsupported long size: ${ac_cv_sizeof_long}])
-fi
-AC_DEFINE_UNQUOTED([LG_SIZEOF_LONG], [$LG_SIZEOF_LONG])
-
-AC_CHECK_SIZEOF([long long])
-if test "x${ac_cv_sizeof_long_long}" = "x8" ; then
- LG_SIZEOF_LONG_LONG=3
-elif test "x${ac_cv_sizeof_long_long}" = "x4" ; then
- LG_SIZEOF_LONG_LONG=2
-else
- AC_MSG_ERROR([Unsupported long long size: ${ac_cv_sizeof_long_long}])
-fi
-AC_DEFINE_UNQUOTED([LG_SIZEOF_LONG_LONG], [$LG_SIZEOF_LONG_LONG])
-
-AC_CHECK_SIZEOF([intmax_t])
-if test "x${ac_cv_sizeof_intmax_t}" = "x16" ; then
- LG_SIZEOF_INTMAX_T=4
-elif test "x${ac_cv_sizeof_intmax_t}" = "x8" ; then
- LG_SIZEOF_INTMAX_T=3
-elif test "x${ac_cv_sizeof_intmax_t}" = "x4" ; then
- LG_SIZEOF_INTMAX_T=2
-else
- AC_MSG_ERROR([Unsupported intmax_t size: ${ac_cv_sizeof_intmax_t}])
-fi
-AC_DEFINE_UNQUOTED([LG_SIZEOF_INTMAX_T], [$LG_SIZEOF_INTMAX_T])
-
-AC_CANONICAL_HOST
-dnl CPU-specific settings.
-CPU_SPINWAIT=""
-case "${host_cpu}" in
- i686|x86_64)
- if test "x${je_cv_msvc}" = "xyes" ; then
- AC_CACHE_VAL([je_cv_pause_msvc],
- [JE_COMPILABLE([pause instruction MSVC], [],
- [[_mm_pause(); return 0;]],
- [je_cv_pause_msvc])])
- if test "x${je_cv_pause_msvc}" = "xyes" ; then
- CPU_SPINWAIT='_mm_pause()'
- fi
- else
- AC_CACHE_VAL([je_cv_pause],
- [JE_COMPILABLE([pause instruction], [],
- [[__asm__ volatile("pause"); return 0;]],
- [je_cv_pause])])
- if test "x${je_cv_pause}" = "xyes" ; then
- CPU_SPINWAIT='__asm__ volatile("pause")'
- fi
- fi
- ;;
- powerpc)
- AC_DEFINE_UNQUOTED([HAVE_ALTIVEC], [ ])
- ;;
- *)
- ;;
-esac
-AC_DEFINE_UNQUOTED([CPU_SPINWAIT], [$CPU_SPINWAIT])
-
-LD_PRELOAD_VAR="LD_PRELOAD"
-so="so"
-importlib="${so}"
-o="$ac_objext"
-a="a"
-exe="$ac_exeext"
-libprefix="lib"
-link_whole_archive="0"
-DSO_LDFLAGS='-shared -Wl,-soname,$(@F)'
-RPATH='-Wl,-rpath,$(1)'
-SOREV="${so}.${rev}"
-PIC_CFLAGS='-fPIC -DPIC'
-CTARGET='-o $@'
-LDTARGET='-o $@'
-TEST_LD_MODE=
-EXTRA_LDFLAGS=
-ARFLAGS='crus'
-AROUT=' $@'
-CC_MM=1
-
-if test "x$je_cv_cray_prgenv_wrapper" = "xyes" ; then
- TEST_LD_MODE='-dynamic'
-fi
-
-if test "x${je_cv_cray}" = "xyes" ; then
- CC_MM=
-fi
-
-AN_MAKEVAR([AR], [AC_PROG_AR])
-AN_PROGRAM([ar], [AC_PROG_AR])
-AC_DEFUN([AC_PROG_AR], [AC_CHECK_TOOL(AR, ar, :)])
-AC_PROG_AR
-
-dnl Platform-specific settings. abi and RPATH can probably be determined
-dnl programmatically, but doing so is error-prone, which makes it generally
-dnl not worth the trouble.
-dnl
-dnl Define cpp macros in CPPFLAGS, rather than doing AC_DEFINE(macro), since the
-dnl definitions need to be seen before any headers are included, which is a pain
-dnl to make happen otherwise.
-CFLAGS="$CFLAGS"
-default_munmap="1"
-maps_coalesce="1"
-case "${host}" in
- *-*-darwin* | *-*-ios*)
- abi="macho"
- AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
- RPATH=""
- LD_PRELOAD_VAR="DYLD_INSERT_LIBRARIES"
- so="dylib"
- importlib="${so}"
- force_tls="0"
- DSO_LDFLAGS='-shared -Wl,-install_name,$(LIBDIR)/$(@F)'
- SOREV="${rev}.${so}"
- sbrk_deprecated="1"
- ;;
- *-*-freebsd*)
- abi="elf"
- AC_DEFINE([JEMALLOC_SYSCTL_VM_OVERCOMMIT], [ ])
- AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
- force_lazy_lock="1"
- ;;
- *-*-dragonfly*)
- abi="elf"
- AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
- ;;
- *-*-openbsd*)
- abi="elf"
- AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
- force_tls="0"
- ;;
- *-*-bitrig*)
- abi="elf"
- AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
- ;;
- *-*-linux*)
- dnl syscall(2) and secure_getenv(3) are exposed by _GNU_SOURCE.
- CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE"
- abi="elf"
- AC_DEFINE([JEMALLOC_HAS_ALLOCA_H])
- AC_DEFINE([JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY], [ ])
- AC_DEFINE([JEMALLOC_PURGE_MADVISE_DONTNEED], [ ])
- AC_DEFINE([JEMALLOC_THREADED_INIT], [ ])
- AC_DEFINE([JEMALLOC_USE_CXX_THROW], [ ])
- default_munmap="0"
- ;;
- *-*-netbsd*)
- AC_MSG_CHECKING([ABI])
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
-[[#ifdef __ELF__
-/* ELF */
-#else
-#error aout
-#endif
-]])],
- [abi="elf"],
- [abi="aout"])
- AC_MSG_RESULT([$abi])
- AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
- ;;
- *-*-solaris2*)
- abi="elf"
- AC_DEFINE([JEMALLOC_PURGE_MADVISE_FREE], [ ])
- RPATH='-Wl,-R,$(1)'
- dnl Solaris needs this for sigwait().
- CPPFLAGS="$CPPFLAGS -D_POSIX_PTHREAD_SEMANTICS"
- LIBS="$LIBS -lposix4 -lsocket -lnsl"
- ;;
- *-ibm-aix*)
- if "$LG_SIZEOF_PTR" = "8"; then
- dnl 64bit AIX
- LD_PRELOAD_VAR="LDR_PRELOAD64"
- else
- dnl 32bit AIX
- LD_PRELOAD_VAR="LDR_PRELOAD"
- fi
- abi="xcoff"
- ;;
- *-*-mingw* | *-*-cygwin*)
- abi="pecoff"
- force_tls="0"
- maps_coalesce="0"
- RPATH=""
- so="dll"
- if test "x$je_cv_msvc" = "xyes" ; then
- importlib="lib"
- DSO_LDFLAGS="-LD"
- EXTRA_LDFLAGS="-link -DEBUG"
- CTARGET='-Fo$@'
- LDTARGET='-Fe$@'
- AR='lib'
- ARFLAGS='-nologo -out:'
- AROUT='$@'
- CC_MM=
- else
- importlib="${so}"
- DSO_LDFLAGS="-shared"
- link_whole_archive="1"
- fi
- a="lib"
- libprefix=""
- SOREV="${so}"
- PIC_CFLAGS=""
- ;;
- *)
- AC_MSG_RESULT([Unsupported operating system: ${host}])
- abi="elf"
- ;;
-esac
-
-JEMALLOC_USABLE_SIZE_CONST=const
-AC_CHECK_HEADERS([malloc.h], [
- AC_MSG_CHECKING([whether malloc_usable_size definition can use const argument])
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
- [#include <malloc.h>
- #include <stddef.h>
- size_t malloc_usable_size(const void *ptr);
- ],
- [])],[
- AC_MSG_RESULT([yes])
- ],[
- JEMALLOC_USABLE_SIZE_CONST=
- AC_MSG_RESULT([no])
- ])
-])
-AC_DEFINE_UNQUOTED([JEMALLOC_USABLE_SIZE_CONST], [$JEMALLOC_USABLE_SIZE_CONST])
-AC_SUBST([abi])
-AC_SUBST([RPATH])
-AC_SUBST([LD_PRELOAD_VAR])
-AC_SUBST([so])
-AC_SUBST([importlib])
-AC_SUBST([o])
-AC_SUBST([a])
-AC_SUBST([exe])
-AC_SUBST([libprefix])
-AC_SUBST([link_whole_archive])
-AC_SUBST([DSO_LDFLAGS])
-AC_SUBST([EXTRA_LDFLAGS])
-AC_SUBST([SOREV])
-AC_SUBST([PIC_CFLAGS])
-AC_SUBST([CTARGET])
-AC_SUBST([LDTARGET])
-AC_SUBST([TEST_LD_MODE])
-AC_SUBST([MKLIB])
-AC_SUBST([ARFLAGS])
-AC_SUBST([AROUT])
-AC_SUBST([CC_MM])
-
-dnl Determine whether libm must be linked to use e.g. log(3).
-AC_SEARCH_LIBS([log], [m], , [AC_MSG_ERROR([Missing math functions])])
-if test "x$ac_cv_search_log" != "xnone required" ; then
- LM="$ac_cv_search_log"
-else
- LM=
-fi
-AC_SUBST(LM)
-
-JE_COMPILABLE([__attribute__ syntax],
- [static __attribute__((unused)) void foo(void){}],
- [],
- [je_cv_attribute])
-if test "x${je_cv_attribute}" = "xyes" ; then
- AC_DEFINE([JEMALLOC_HAVE_ATTR], [ ])
- if test "x${GCC}" = "xyes" -a "x${abi}" = "xelf"; then
- JE_CFLAGS_APPEND([-fvisibility=hidden])
- fi
-fi
-dnl Check for tls_model attribute support (clang 3.0 still lacks support).
-SAVED_CFLAGS="${CFLAGS}"
-JE_CFLAGS_APPEND([-Werror])
-JE_CFLAGS_APPEND([-herror_on_warning])
-JE_COMPILABLE([tls_model attribute], [],
- [static __thread int
- __attribute__((tls_model("initial-exec"), unused)) foo;
- foo = 0;],
- [je_cv_tls_model])
-CFLAGS="${SAVED_CFLAGS}"
-if test "x${je_cv_tls_model}" = "xyes" ; then
- AC_DEFINE([JEMALLOC_TLS_MODEL],
- [__attribute__((tls_model("initial-exec")))])
-else
- AC_DEFINE([JEMALLOC_TLS_MODEL], [ ])
-fi
-dnl Check for alloc_size attribute support.
-SAVED_CFLAGS="${CFLAGS}"
-JE_CFLAGS_APPEND([-Werror])
-JE_CFLAGS_APPEND([-herror_on_warning])
-JE_COMPILABLE([alloc_size attribute], [#include <stdlib.h>],
- [void *foo(size_t size) __attribute__((alloc_size(1)));],
- [je_cv_alloc_size])
-CFLAGS="${SAVED_CFLAGS}"
-if test "x${je_cv_alloc_size}" = "xyes" ; then
- AC_DEFINE([JEMALLOC_HAVE_ATTR_ALLOC_SIZE], [ ])
-fi
-dnl Check for format(gnu_printf, ...) attribute support.
-SAVED_CFLAGS="${CFLAGS}"
-JE_CFLAGS_APPEND([-Werror])
-JE_CFLAGS_APPEND([-herror_on_warning])
-JE_COMPILABLE([format(gnu_printf, ...) attribute], [#include <stdlib.h>],
- [void *foo(const char *format, ...) __attribute__((format(gnu_printf, 1, 2)));],
- [je_cv_format_gnu_printf])
-CFLAGS="${SAVED_CFLAGS}"
-if test "x${je_cv_format_gnu_printf}" = "xyes" ; then
- AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF], [ ])
-fi
-dnl Check for format(printf, ...) attribute support.
-SAVED_CFLAGS="${CFLAGS}"
-JE_CFLAGS_APPEND([-Werror])
-JE_CFLAGS_APPEND([-herror_on_warning])
-JE_COMPILABLE([format(printf, ...) attribute], [#include <stdlib.h>],
- [void *foo(const char *format, ...) __attribute__((format(printf, 1, 2)));],
- [je_cv_format_printf])
-CFLAGS="${SAVED_CFLAGS}"
-if test "x${je_cv_format_printf}" = "xyes" ; then
- AC_DEFINE([JEMALLOC_HAVE_ATTR_FORMAT_PRINTF], [ ])
-fi
-
-dnl Support optional additions to rpath.
-AC_ARG_WITH([rpath],
- [AS_HELP_STRING([--with-rpath=<rpath>], [Colon-separated rpath (ELF systems only)])],
-if test "x$with_rpath" = "xno" ; then
- RPATH_EXTRA=
-else
- RPATH_EXTRA="`echo $with_rpath | tr \":\" \" \"`"
-fi,
- RPATH_EXTRA=
-)
-AC_SUBST([RPATH_EXTRA])
-
-dnl Disable rules that do automatic regeneration of configure output by default.
-AC_ARG_ENABLE([autogen],
- [AS_HELP_STRING([--enable-autogen], [Automatically regenerate configure output])],
-if test "x$enable_autogen" = "xno" ; then
- enable_autogen="0"
-else
- enable_autogen="1"
-fi
-,
-enable_autogen="0"
-)
-AC_SUBST([enable_autogen])
-
-AC_PROG_INSTALL
-AC_PROG_RANLIB
-AC_PATH_PROG([LD], [ld], [false], [$PATH])
-AC_PATH_PROG([AUTOCONF], [autoconf], [false], [$PATH])
-
-public_syms="malloc_conf malloc_message malloc calloc posix_memalign aligned_alloc realloc free mallocx rallocx xallocx sallocx dallocx sdallocx nallocx mallctl mallctlnametomib mallctlbymib malloc_stats_print malloc_usable_size"
-
-dnl Check for allocator-related functions that should be wrapped.
-AC_CHECK_FUNC([memalign],
- [AC_DEFINE([JEMALLOC_OVERRIDE_MEMALIGN], [ ])
- public_syms="${public_syms} memalign"])
-AC_CHECK_FUNC([valloc],
- [AC_DEFINE([JEMALLOC_OVERRIDE_VALLOC], [ ])
- public_syms="${public_syms} valloc"])
-
-dnl Do not compute test code coverage by default.
-GCOV_FLAGS=
-AC_ARG_ENABLE([code-coverage],
- [AS_HELP_STRING([--enable-code-coverage],
- [Enable code coverage])],
-[if test "x$enable_code_coverage" = "xno" ; then
- enable_code_coverage="0"
-else
- enable_code_coverage="1"
-fi
-],
-[enable_code_coverage="0"]
-)
-if test "x$enable_code_coverage" = "x1" ; then
- deoptimize="no"
- echo "$CFLAGS $EXTRA_CFLAGS" | grep '\-O' >/dev/null || deoptimize="yes"
- if test "x${deoptimize}" = "xyes" ; then
- JE_CFLAGS_APPEND([-O0])
- fi
- JE_CFLAGS_APPEND([-fprofile-arcs -ftest-coverage])
- EXTRA_LDFLAGS="$EXTRA_LDFLAGS -fprofile-arcs -ftest-coverage"
- AC_DEFINE([JEMALLOC_CODE_COVERAGE], [ ])
-fi
-AC_SUBST([enable_code_coverage])
-
-dnl Perform no name mangling by default.
-AC_ARG_WITH([mangling],
- [AS_HELP_STRING([--with-mangling=<map>], [Mangle symbols in <map>])],
- [mangling_map="$with_mangling"], [mangling_map=""])
-
-dnl Do not prefix public APIs by default.
-AC_ARG_WITH([jemalloc_prefix],
- [AS_HELP_STRING([--with-jemalloc-prefix=<prefix>], [Prefix to prepend to all public APIs])],
- [JEMALLOC_PREFIX="$with_jemalloc_prefix"],
- [if test "x$abi" != "xmacho" -a "x$abi" != "xpecoff"; then
- JEMALLOC_PREFIX=""
-else
- JEMALLOC_PREFIX="je_"
-fi]
-)
-if test "x$JEMALLOC_PREFIX" != "x" ; then
- JEMALLOC_CPREFIX=`echo ${JEMALLOC_PREFIX} | tr "a-z" "A-Z"`
- AC_DEFINE_UNQUOTED([JEMALLOC_PREFIX], ["$JEMALLOC_PREFIX"])
- AC_DEFINE_UNQUOTED([JEMALLOC_CPREFIX], ["$JEMALLOC_CPREFIX"])
-fi
-AC_SUBST([JEMALLOC_CPREFIX])
-
-AC_ARG_WITH([export],
- [AS_HELP_STRING([--without-export], [disable exporting jemalloc public APIs])],
- [if test "x$with_export" = "xno"; then
- AC_DEFINE([JEMALLOC_EXPORT],[])
-fi]
-)
-
-dnl Mangle library-private APIs.
-AC_ARG_WITH([private_namespace],
- [AS_HELP_STRING([--with-private-namespace=<prefix>], [Prefix to prepend to all library-private APIs])],
- [JEMALLOC_PRIVATE_NAMESPACE="${with_private_namespace}je_"],
- [JEMALLOC_PRIVATE_NAMESPACE="je_"]
-)
-AC_DEFINE_UNQUOTED([JEMALLOC_PRIVATE_NAMESPACE], [$JEMALLOC_PRIVATE_NAMESPACE])
-private_namespace="$JEMALLOC_PRIVATE_NAMESPACE"
-AC_SUBST([private_namespace])
-
-dnl Do not add suffix to installed files by default.
-AC_ARG_WITH([install_suffix],
- [AS_HELP_STRING([--with-install-suffix=<suffix>], [Suffix to append to all installed files])],
- [INSTALL_SUFFIX="$with_install_suffix"],
- [INSTALL_SUFFIX=]
-)
-install_suffix="$INSTALL_SUFFIX"
-AC_SUBST([install_suffix])
-
-dnl Specify default malloc_conf.
-AC_ARG_WITH([malloc_conf],
- [AS_HELP_STRING([--with-malloc-conf=<malloc_conf>], [config.malloc_conf options string])],
- [JEMALLOC_CONFIG_MALLOC_CONF="$with_malloc_conf"],
- [JEMALLOC_CONFIG_MALLOC_CONF=""]
-)
-config_malloc_conf="$JEMALLOC_CONFIG_MALLOC_CONF"
-AC_DEFINE_UNQUOTED([JEMALLOC_CONFIG_MALLOC_CONF], ["$config_malloc_conf"])
-
-dnl Substitute @je_@ in jemalloc_protos.h.in, primarily to make generation of
-dnl jemalloc_protos_jet.h easy.
-je_="je_"
-AC_SUBST([je_])
-
-cfgoutputs_in="Makefile.in"
-cfgoutputs_in="${cfgoutputs_in} jemalloc.pc.in"
-cfgoutputs_in="${cfgoutputs_in} doc/html.xsl.in"
-cfgoutputs_in="${cfgoutputs_in} doc/manpages.xsl.in"
-cfgoutputs_in="${cfgoutputs_in} doc/jemalloc.xml.in"
-cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_macros.h.in"
-cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_protos.h.in"
-cfgoutputs_in="${cfgoutputs_in} include/jemalloc/jemalloc_typedefs.h.in"
-cfgoutputs_in="${cfgoutputs_in} include/jemalloc/internal/jemalloc_internal.h.in"
-cfgoutputs_in="${cfgoutputs_in} test/test.sh.in"
-cfgoutputs_in="${cfgoutputs_in} test/include/test/jemalloc_test.h.in"
-
-cfgoutputs_out="Makefile"
-cfgoutputs_out="${cfgoutputs_out} jemalloc.pc"
-cfgoutputs_out="${cfgoutputs_out} doc/html.xsl"
-cfgoutputs_out="${cfgoutputs_out} doc/manpages.xsl"
-cfgoutputs_out="${cfgoutputs_out} doc/jemalloc.xml"
-cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_macros.h"
-cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_protos.h"
-cfgoutputs_out="${cfgoutputs_out} include/jemalloc/jemalloc_typedefs.h"
-cfgoutputs_out="${cfgoutputs_out} include/jemalloc/internal/jemalloc_internal.h"
-cfgoutputs_out="${cfgoutputs_out} test/test.sh"
-cfgoutputs_out="${cfgoutputs_out} test/include/test/jemalloc_test.h"
-
-cfgoutputs_tup="Makefile"
-cfgoutputs_tup="${cfgoutputs_tup} jemalloc.pc:jemalloc.pc.in"
-cfgoutputs_tup="${cfgoutputs_tup} doc/html.xsl:doc/html.xsl.in"
-cfgoutputs_tup="${cfgoutputs_tup} doc/manpages.xsl:doc/manpages.xsl.in"
-cfgoutputs_tup="${cfgoutputs_tup} doc/jemalloc.xml:doc/jemalloc.xml.in"
-cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_macros.h:include/jemalloc/jemalloc_macros.h.in"
-cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_protos.h:include/jemalloc/jemalloc_protos.h.in"
-cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/jemalloc_typedefs.h:include/jemalloc/jemalloc_typedefs.h.in"
-cfgoutputs_tup="${cfgoutputs_tup} include/jemalloc/internal/jemalloc_internal.h"
-cfgoutputs_tup="${cfgoutputs_tup} test/test.sh:test/test.sh.in"
-cfgoutputs_tup="${cfgoutputs_tup} test/include/test/jemalloc_test.h:test/include/test/jemalloc_test.h.in"
-
-cfghdrs_in="include/jemalloc/jemalloc_defs.h.in"
-cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/jemalloc_internal_defs.h.in"
-cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_namespace.sh"
-cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_unnamespace.sh"
-cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/private_symbols.txt"
-cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_namespace.sh"
-cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/public_unnamespace.sh"
-cfghdrs_in="${cfghdrs_in} include/jemalloc/internal/size_classes.sh"
-cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_rename.sh"
-cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc_mangle.sh"
-cfghdrs_in="${cfghdrs_in} include/jemalloc/jemalloc.sh"
-cfghdrs_in="${cfghdrs_in} test/include/test/jemalloc_test_defs.h.in"
-
-cfghdrs_out="include/jemalloc/jemalloc_defs.h"
-cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc${install_suffix}.h"
-cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_namespace.h"
-cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/private_unnamespace.h"
-cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_symbols.txt"
-cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_namespace.h"
-cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/public_unnamespace.h"
-cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/size_classes.h"
-cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_protos_jet.h"
-cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_rename.h"
-cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle.h"
-cfghdrs_out="${cfghdrs_out} include/jemalloc/jemalloc_mangle_jet.h"
-cfghdrs_out="${cfghdrs_out} include/jemalloc/internal/jemalloc_internal_defs.h"
-cfghdrs_out="${cfghdrs_out} test/include/test/jemalloc_test_defs.h"
-
-cfghdrs_tup="include/jemalloc/jemalloc_defs.h:include/jemalloc/jemalloc_defs.h.in"
-cfghdrs_tup="${cfghdrs_tup} include/jemalloc/internal/jemalloc_internal_defs.h:include/jemalloc/internal/jemalloc_internal_defs.h.in"
-cfghdrs_tup="${cfghdrs_tup} test/include/test/jemalloc_test_defs.h:test/include/test/jemalloc_test_defs.h.in"
-
-dnl Silence irrelevant compiler warnings by default.
-AC_ARG_ENABLE([cc-silence],
- [AS_HELP_STRING([--disable-cc-silence],
- [Do not silence irrelevant compiler warnings])],
-[if test "x$enable_cc_silence" = "xno" ; then
- enable_cc_silence="0"
-else
- enable_cc_silence="1"
-fi
-],
-[enable_cc_silence="1"]
-)
-if test "x$enable_cc_silence" = "x1" ; then
- AC_DEFINE([JEMALLOC_CC_SILENCE], [ ])
-fi
-
-dnl Do not compile with debugging by default.
-AC_ARG_ENABLE([debug],
- [AS_HELP_STRING([--enable-debug],
- [Build debugging code (implies --enable-ivsalloc)])],
-[if test "x$enable_debug" = "xno" ; then
- enable_debug="0"
-else
- enable_debug="1"
-fi
-],
-[enable_debug="0"]
-)
-if test "x$enable_debug" = "x1" ; then
- AC_DEFINE([JEMALLOC_DEBUG], [ ])
-fi
-if test "x$enable_debug" = "x1" ; then
- AC_DEFINE([JEMALLOC_DEBUG], [ ])
- enable_ivsalloc="1"
-fi
-AC_SUBST([enable_debug])
-
-dnl Do not validate pointers by default.
-AC_ARG_ENABLE([ivsalloc],
- [AS_HELP_STRING([--enable-ivsalloc],
- [Validate pointers passed through the public API])],
-[if test "x$enable_ivsalloc" = "xno" ; then
- enable_ivsalloc="0"
-else
- enable_ivsalloc="1"
-fi
-],
-[enable_ivsalloc="0"]
-)
-if test "x$enable_ivsalloc" = "x1" ; then
- AC_DEFINE([JEMALLOC_IVSALLOC], [ ])
-fi
-
-dnl Only optimize if not debugging.
-if test "x$enable_debug" = "x0" -a "x$no_CFLAGS" = "xyes" ; then
- dnl Make sure that an optimization flag was not specified in EXTRA_CFLAGS.
- optimize="no"
- echo "$CFLAGS $EXTRA_CFLAGS" | grep '\-O' >/dev/null || optimize="yes"
- if test "x${optimize}" = "xyes" ; then
- if test "x$GCC" = "xyes" ; then
- JE_CFLAGS_APPEND([-O3])
- JE_CFLAGS_APPEND([-funroll-loops])
- elif test "x$je_cv_msvc" = "xyes" ; then
- JE_CFLAGS_APPEND([-O2])
- else
- JE_CFLAGS_APPEND([-O])
- fi
- fi
-fi
-
-dnl Enable statistics calculation by default.
-AC_ARG_ENABLE([stats],
- [AS_HELP_STRING([--disable-stats],
- [Disable statistics calculation/reporting])],
-[if test "x$enable_stats" = "xno" ; then
- enable_stats="0"
-else
- enable_stats="1"
-fi
-],
-[enable_stats="1"]
-)
-if test "x$enable_stats" = "x1" ; then
- AC_DEFINE([JEMALLOC_STATS], [ ])
-fi
-AC_SUBST([enable_stats])
-
-dnl Do not enable profiling by default.
-AC_ARG_ENABLE([prof],
- [AS_HELP_STRING([--enable-prof], [Enable allocation profiling])],
-[if test "x$enable_prof" = "xno" ; then
- enable_prof="0"
-else
- enable_prof="1"
-fi
-],
-[enable_prof="0"]
-)
-if test "x$enable_prof" = "x1" ; then
- backtrace_method=""
-else
- backtrace_method="N/A"
-fi
-
-AC_ARG_ENABLE([prof-libunwind],
- [AS_HELP_STRING([--enable-prof-libunwind], [Use libunwind for backtracing])],
-[if test "x$enable_prof_libunwind" = "xno" ; then
- enable_prof_libunwind="0"
-else
- enable_prof_libunwind="1"
-fi
-],
-[enable_prof_libunwind="0"]
-)
-AC_ARG_WITH([static_libunwind],
- [AS_HELP_STRING([--with-static-libunwind=<libunwind.a>],
- [Path to static libunwind library; use rather than dynamically linking])],
-if test "x$with_static_libunwind" = "xno" ; then
- LUNWIND="-lunwind"
-else
- if test ! -f "$with_static_libunwind" ; then
- AC_MSG_ERROR([Static libunwind not found: $with_static_libunwind])
- fi
- LUNWIND="$with_static_libunwind"
-fi,
- LUNWIND="-lunwind"
-)
-if test "x$backtrace_method" = "x" -a "x$enable_prof_libunwind" = "x1" ; then
- AC_CHECK_HEADERS([libunwind.h], , [enable_prof_libunwind="0"])
- if test "x$LUNWIND" = "x-lunwind" ; then
- AC_CHECK_LIB([unwind], [unw_backtrace], [LIBS="$LIBS $LUNWIND"],
- [enable_prof_libunwind="0"])
- else
- LIBS="$LIBS $LUNWIND"
- fi
- if test "x${enable_prof_libunwind}" = "x1" ; then
- backtrace_method="libunwind"
- AC_DEFINE([JEMALLOC_PROF_LIBUNWIND], [ ])
- fi
-fi
-
-AC_ARG_ENABLE([prof-libgcc],
- [AS_HELP_STRING([--disable-prof-libgcc],
- [Do not use libgcc for backtracing])],
-[if test "x$enable_prof_libgcc" = "xno" ; then
- enable_prof_libgcc="0"
-else
- enable_prof_libgcc="1"
-fi
-],
-[enable_prof_libgcc="1"]
-)
-if test "x$backtrace_method" = "x" -a "x$enable_prof_libgcc" = "x1" \
- -a "x$GCC" = "xyes" ; then
- AC_CHECK_HEADERS([unwind.h], , [enable_prof_libgcc="0"])
- AC_CHECK_LIB([gcc], [_Unwind_Backtrace], [LIBS="$LIBS -lgcc"], [enable_prof_libgcc="0"])
- if test "x${enable_prof_libgcc}" = "x1" ; then
- backtrace_method="libgcc"
- AC_DEFINE([JEMALLOC_PROF_LIBGCC], [ ])
- fi
-else
- enable_prof_libgcc="0"
-fi
-
-AC_ARG_ENABLE([prof-gcc],
- [AS_HELP_STRING([--disable-prof-gcc],
- [Do not use gcc intrinsics for backtracing])],
-[if test "x$enable_prof_gcc" = "xno" ; then
- enable_prof_gcc="0"
-else
- enable_prof_gcc="1"
-fi
-],
-[enable_prof_gcc="1"]
-)
-if test "x$backtrace_method" = "x" -a "x$enable_prof_gcc" = "x1" \
- -a "x$GCC" = "xyes" ; then
- JE_CFLAGS_APPEND([-fno-omit-frame-pointer])
- backtrace_method="gcc intrinsics"
- AC_DEFINE([JEMALLOC_PROF_GCC], [ ])
-else
- enable_prof_gcc="0"
-fi
-
-if test "x$backtrace_method" = "x" ; then
- backtrace_method="none (disabling profiling)"
- enable_prof="0"
-fi
-AC_MSG_CHECKING([configured backtracing method])
-AC_MSG_RESULT([$backtrace_method])
-if test "x$enable_prof" = "x1" ; then
- dnl Heap profiling uses the log(3) function.
- if test "x$LM" != "x" ; then
- LIBS="$LIBS $LM"
- fi
-
- AC_DEFINE([JEMALLOC_PROF], [ ])
-fi
-AC_SUBST([enable_prof])
-
-dnl Enable thread-specific caching by default.
-AC_ARG_ENABLE([tcache],
- [AS_HELP_STRING([--disable-tcache], [Disable per thread caches])],
-[if test "x$enable_tcache" = "xno" ; then
- enable_tcache="0"
-else
- enable_tcache="1"
-fi
-],
-[enable_tcache="1"]
-)
-if test "x$enable_tcache" = "x1" ; then
- AC_DEFINE([JEMALLOC_TCACHE], [ ])
-fi
-AC_SUBST([enable_tcache])
-
-dnl Indicate whether adjacent virtual memory mappings automatically coalesce
-dnl (and fragment on demand).
-if test "x${maps_coalesce}" = "x1" ; then
- AC_DEFINE([JEMALLOC_MAPS_COALESCE], [ ])
-fi
-
-dnl Enable VM deallocation via munmap() by default.
-AC_ARG_ENABLE([munmap],
- [AS_HELP_STRING([--disable-munmap], [Disable VM deallocation via munmap(2)])],
-[if test "x$enable_munmap" = "xno" ; then
- enable_munmap="0"
-else
- enable_munmap="1"
-fi
-],
-[enable_munmap="${default_munmap}"]
-)
-if test "x$enable_munmap" = "x1" ; then
- AC_DEFINE([JEMALLOC_MUNMAP], [ ])
-fi
-AC_SUBST([enable_munmap])
-
-dnl Enable allocation from DSS if supported by the OS.
-have_dss="1"
-dnl Check whether the BSD/SUSv1 sbrk() exists. If not, disable DSS support.
-AC_CHECK_FUNC([sbrk], [have_sbrk="1"], [have_sbrk="0"])
-if test "x$have_sbrk" = "x1" ; then
- if test "x$sbrk_deprecated" = "x1" ; then
- AC_MSG_RESULT([Disabling dss allocation because sbrk is deprecated])
- have_dss="0"
- fi
-else
- have_dss="0"
-fi
-
-if test "x$have_dss" = "x1" ; then
- AC_DEFINE([JEMALLOC_DSS], [ ])
-fi
-
-dnl Support the junk/zero filling option by default.
-AC_ARG_ENABLE([fill],
- [AS_HELP_STRING([--disable-fill],
- [Disable support for junk/zero filling, quarantine, and redzones])],
-[if test "x$enable_fill" = "xno" ; then
- enable_fill="0"
-else
- enable_fill="1"
-fi
-],
-[enable_fill="1"]
-)
-if test "x$enable_fill" = "x1" ; then
- AC_DEFINE([JEMALLOC_FILL], [ ])
-fi
-AC_SUBST([enable_fill])
-
-dnl Disable utrace(2)-based tracing by default.
-AC_ARG_ENABLE([utrace],
- [AS_HELP_STRING([--enable-utrace], [Enable utrace(2)-based tracing])],
-[if test "x$enable_utrace" = "xno" ; then
- enable_utrace="0"
-else
- enable_utrace="1"
-fi
-],
-[enable_utrace="0"]
-)
-JE_COMPILABLE([utrace(2)], [
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/time.h>
-#include <sys/uio.h>
-#include <sys/ktrace.h>
-], [
- utrace((void *)0, 0);
-], [je_cv_utrace])
-if test "x${je_cv_utrace}" = "xno" ; then
- enable_utrace="0"
-fi
-if test "x$enable_utrace" = "x1" ; then
- AC_DEFINE([JEMALLOC_UTRACE], [ ])
-fi
-AC_SUBST([enable_utrace])
-
-dnl Support Valgrind by default.
-AC_ARG_ENABLE([valgrind],
- [AS_HELP_STRING([--disable-valgrind], [Disable support for Valgrind])],
-[if test "x$enable_valgrind" = "xno" ; then
- enable_valgrind="0"
-else
- enable_valgrind="1"
-fi
-],
-[enable_valgrind="1"]
-)
-if test "x$enable_valgrind" = "x1" ; then
- JE_COMPILABLE([valgrind], [
-#include <valgrind/valgrind.h>
-#include <valgrind/memcheck.h>
-
-#if !defined(VALGRIND_RESIZEINPLACE_BLOCK)
-# error "Incompatible Valgrind version"
-#endif
-], [], [je_cv_valgrind])
- if test "x${je_cv_valgrind}" = "xno" ; then
- enable_valgrind="0"
- fi
- if test "x$enable_valgrind" = "x1" ; then
- AC_DEFINE([JEMALLOC_VALGRIND], [ ])
- fi
-fi
-AC_SUBST([enable_valgrind])
-
-dnl Do not support the xmalloc option by default.
-AC_ARG_ENABLE([xmalloc],
- [AS_HELP_STRING([--enable-xmalloc], [Support xmalloc option])],
-[if test "x$enable_xmalloc" = "xno" ; then
- enable_xmalloc="0"
-else
- enable_xmalloc="1"
-fi
-],
-[enable_xmalloc="0"]
-)
-if test "x$enable_xmalloc" = "x1" ; then
- AC_DEFINE([JEMALLOC_XMALLOC], [ ])
-fi
-AC_SUBST([enable_xmalloc])
-
-dnl Support cache-oblivious allocation alignment by default.
-AC_ARG_ENABLE([cache-oblivious],
- [AS_HELP_STRING([--disable-cache-oblivious],
- [Disable support for cache-oblivious allocation alignment])],
-[if test "x$enable_cache_oblivious" = "xno" ; then
- enable_cache_oblivious="0"
-else
- enable_cache_oblivious="1"
-fi
-],
-[enable_cache_oblivious="1"]
-)
-if test "x$enable_cache_oblivious" = "x1" ; then
- AC_DEFINE([JEMALLOC_CACHE_OBLIVIOUS], [ ])
-fi
-AC_SUBST([enable_cache_oblivious])
-
-
-
-JE_COMPILABLE([a program using __builtin_unreachable], [
-void foo (void) {
- __builtin_unreachable();
-}
-], [
- {
- foo();
- }
-], [je_cv_gcc_builtin_unreachable])
-if test "x${je_cv_gcc_builtin_unreachable}" = "xyes" ; then
- AC_DEFINE([JEMALLOC_INTERNAL_UNREACHABLE], [__builtin_unreachable])
-else
- AC_DEFINE([JEMALLOC_INTERNAL_UNREACHABLE], [abort])
-fi
-
-dnl ============================================================================
-dnl Check for __builtin_ffsl(), then ffsl(3), and fail if neither are found.
-dnl One of those two functions should (theoretically) exist on all platforms
-dnl that jemalloc currently has a chance of functioning on without modification.
-dnl We additionally assume ffs[ll]() or __builtin_ffs[ll]() are defined if
-dnl ffsl() or __builtin_ffsl() are defined, respectively.
-JE_COMPILABLE([a program using __builtin_ffsl], [
-#include <stdio.h>
-#include <strings.h>
-#include <string.h>
-], [
- {
- int rv = __builtin_ffsl(0x08);
- printf("%d\n", rv);
- }
-], [je_cv_gcc_builtin_ffsl])
-if test "x${je_cv_gcc_builtin_ffsl}" = "xyes" ; then
- AC_DEFINE([JEMALLOC_INTERNAL_FFSLL], [__builtin_ffsll])
- AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [__builtin_ffsl])
- AC_DEFINE([JEMALLOC_INTERNAL_FFS], [__builtin_ffs])
-else
- JE_COMPILABLE([a program using ffsl], [
- #include <stdio.h>
- #include <strings.h>
- #include <string.h>
- ], [
- {
- int rv = ffsl(0x08);
- printf("%d\n", rv);
- }
- ], [je_cv_function_ffsl])
- if test "x${je_cv_function_ffsl}" = "xyes" ; then
- AC_DEFINE([JEMALLOC_INTERNAL_FFSLL], [ffsll])
- AC_DEFINE([JEMALLOC_INTERNAL_FFSL], [ffsl])
- AC_DEFINE([JEMALLOC_INTERNAL_FFS], [ffs])
- else
- AC_MSG_ERROR([Cannot build without ffsl(3) or __builtin_ffsl()])
- fi
-fi
-
-AC_ARG_WITH([lg_tiny_min],
- [AS_HELP_STRING([--with-lg-tiny-min=<lg-tiny-min>],
- [Base 2 log of minimum tiny size class to support])],
- [LG_TINY_MIN="$with_lg_tiny_min"],
- [LG_TINY_MIN="3"])
-AC_DEFINE_UNQUOTED([LG_TINY_MIN], [$LG_TINY_MIN])
-
-AC_ARG_WITH([lg_quantum],
- [AS_HELP_STRING([--with-lg-quantum=<lg-quantum>],
- [Base 2 log of minimum allocation alignment])],
- [LG_QUANTA="$with_lg_quantum"],
- [LG_QUANTA="3 4"])
-if test "x$with_lg_quantum" != "x" ; then
- AC_DEFINE_UNQUOTED([LG_QUANTUM], [$with_lg_quantum])
-fi
-
-AC_ARG_WITH([lg_page],
- [AS_HELP_STRING([--with-lg-page=<lg-page>], [Base 2 log of system page size])],
- [LG_PAGE="$with_lg_page"], [LG_PAGE="detect"])
-if test "x$LG_PAGE" = "xdetect"; then
- AC_CACHE_CHECK([LG_PAGE],
- [je_cv_lg_page],
- AC_RUN_IFELSE([AC_LANG_PROGRAM(
-[[
-#include <strings.h>
-#ifdef _WIN32
-#include <windows.h>
-#else
-#include <unistd.h>
-#endif
-#include <stdio.h>
-]],
-[[
- int result;
- FILE *f;
-
-#ifdef _WIN32
- SYSTEM_INFO si;
- GetSystemInfo(&si);
- result = si.dwPageSize;
-#else
- result = sysconf(_SC_PAGESIZE);
-#endif
- if (result == -1) {
- return 1;
- }
- result = JEMALLOC_INTERNAL_FFSL(result) - 1;
-
- f = fopen("conftest.out", "w");
- if (f == NULL) {
- return 1;
- }
- fprintf(f, "%d", result);
- fclose(f);
-
- return 0;
-]])],
- [je_cv_lg_page=`cat conftest.out`],
- [je_cv_lg_page=undefined],
- [je_cv_lg_page=12]))
-fi
-if test "x${je_cv_lg_page}" != "x" ; then
- LG_PAGE="${je_cv_lg_page}"
-fi
-if test "x${LG_PAGE}" != "xundefined" ; then
- AC_DEFINE_UNQUOTED([LG_PAGE], [$LG_PAGE])
-else
- AC_MSG_ERROR([cannot determine value for LG_PAGE])
-fi
-
-AC_ARG_WITH([lg_page_sizes],
- [AS_HELP_STRING([--with-lg-page-sizes=<lg-page-sizes>],
- [Base 2 logs of system page sizes to support])],
- [LG_PAGE_SIZES="$with_lg_page_sizes"], [LG_PAGE_SIZES="$LG_PAGE"])
-
-AC_ARG_WITH([lg_size_class_group],
- [AS_HELP_STRING([--with-lg-size-class-group=<lg-size-class-group>],
- [Base 2 log of size classes per doubling])],
- [LG_SIZE_CLASS_GROUP="$with_lg_size_class_group"],
- [LG_SIZE_CLASS_GROUP="2"])
-
-dnl ============================================================================
-dnl jemalloc configuration.
-dnl
-
-AC_ARG_WITH([version],
- [AS_HELP_STRING([--with-version=<major>.<minor>.<bugfix>-<nrev>-g<gid>],
- [Version string])],
- [
- echo "${with_version}" | grep ['^[0-9]\+\.[0-9]\+\.[0-9]\+-[0-9]\+-g[0-9a-f]\+$'] 2>&1 1>/dev/null
- if test $? -ne 0 ; then
- AC_MSG_ERROR([${with_version} does not match <major>.<minor>.<bugfix>-<nrev>-g<gid>])
- fi
- echo "$with_version" > "${objroot}VERSION"
- ], [
- dnl Set VERSION if source directory is inside a git repository.
- if test "x`test ! \"${srcroot}\" && cd \"${srcroot}\"; git rev-parse --is-inside-work-tree 2>/dev/null`" = "xtrue" ; then
- dnl Pattern globs aren't powerful enough to match both single- and
- dnl double-digit version numbers, so iterate over patterns to support up
- dnl to version 99.99.99 without any accidental matches.
- for pattern in ['[0-9].[0-9].[0-9]' '[0-9].[0-9].[0-9][0-9]' \
- '[0-9].[0-9][0-9].[0-9]' '[0-9].[0-9][0-9].[0-9][0-9]' \
- '[0-9][0-9].[0-9].[0-9]' '[0-9][0-9].[0-9].[0-9][0-9]' \
- '[0-9][0-9].[0-9][0-9].[0-9]' \
- '[0-9][0-9].[0-9][0-9].[0-9][0-9]']; do
- (test ! "${srcroot}" && cd "${srcroot}"; git describe --long --abbrev=40 --match="${pattern}") > "${objroot}VERSION.tmp" 2>/dev/null
- if test $? -eq 0 ; then
- mv "${objroot}VERSION.tmp" "${objroot}VERSION"
- break
- fi
- done
- fi
- rm -f "${objroot}VERSION.tmp"
- ])
-
-if test ! -e "${objroot}VERSION" ; then
- if test ! -e "${srcroot}VERSION" ; then
- AC_MSG_RESULT(
- [Missing VERSION file, and unable to generate it; creating bogus VERSION])
- echo "0.0.0-0-g0000000000000000000000000000000000000000" > "${objroot}VERSION"
- else
- cp ${srcroot}VERSION ${objroot}VERSION
- fi
-fi
-jemalloc_version=`cat "${objroot}VERSION"`
-jemalloc_version_major=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]1}'`
-jemalloc_version_minor=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]2}'`
-jemalloc_version_bugfix=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]3}'`
-jemalloc_version_nrev=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]4}'`
-jemalloc_version_gid=`echo ${jemalloc_version} | tr ".g-" " " | awk '{print [$]5}'`
-AC_SUBST([jemalloc_version])
-AC_SUBST([jemalloc_version_major])
-AC_SUBST([jemalloc_version_minor])
-AC_SUBST([jemalloc_version_bugfix])
-AC_SUBST([jemalloc_version_nrev])
-AC_SUBST([jemalloc_version_gid])
-
-dnl ============================================================================
-dnl Configure pthreads.
-
-if test "x$abi" != "xpecoff" ; then
- AC_CHECK_HEADERS([pthread.h], , [AC_MSG_ERROR([pthread.h is missing])])
- dnl Some systems may embed pthreads functionality in libc; check for libpthread
- dnl first, but try libc too before failing.
- AC_CHECK_LIB([pthread], [pthread_create], [LIBS="$LIBS -lpthread"],
- [AC_SEARCH_LIBS([pthread_create], , ,
- AC_MSG_ERROR([libpthread is missing]))])
-fi
-
-CPPFLAGS="$CPPFLAGS -D_REENTRANT"
-
-dnl Check whether clock_gettime(2) is in libc or librt.
-AC_SEARCH_LIBS([clock_gettime], [rt])
-
-dnl Cray wrapper compiler often adds `-lrt` when using `-static`. Check with
-dnl `-dynamic` as well in case a user tries to dynamically link in jemalloc
-if test "x$je_cv_cray_prgenv_wrapper" = "xyes" ; then
- if test "$ac_cv_search_clock_gettime" != "-lrt"; then
- SAVED_CFLAGS="${CFLAGS}"
-
- unset ac_cv_search_clock_gettime
- JE_CFLAGS_APPEND([-dynamic])
- AC_SEARCH_LIBS([clock_gettime], [rt])
-
- CFLAGS="${SAVED_CFLAGS}"
- fi
-fi
-
-dnl check for CLOCK_MONOTONIC_COARSE (Linux-specific).
-JE_COMPILABLE([clock_gettime(CLOCK_MONOTONIC_COARSE, ...)], [
-#include <time.h>
-], [
- struct timespec ts;
-
- clock_gettime(CLOCK_MONOTONIC_COARSE, &ts);
-], [je_cv_clock_monotonic_coarse])
-if test "x${je_cv_clock_monotonic_coarse}" = "xyes" ; then
- AC_DEFINE([JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE])
-fi
-
-dnl check for CLOCK_MONOTONIC.
-JE_COMPILABLE([clock_gettime(CLOCK_MONOTONIC, ...)], [
-#include <unistd.h>
-#include <time.h>
-], [
- struct timespec ts;
-
- clock_gettime(CLOCK_MONOTONIC, &ts);
-#if !defined(_POSIX_MONOTONIC_CLOCK) || _POSIX_MONOTONIC_CLOCK < 0
-# error _POSIX_MONOTONIC_CLOCK missing/invalid
-#endif
-], [je_cv_clock_monotonic])
-if test "x${je_cv_clock_monotonic}" = "xyes" ; then
- AC_DEFINE([JEMALLOC_HAVE_CLOCK_MONOTONIC])
-fi
-
-dnl Check for mach_absolute_time().
-JE_COMPILABLE([mach_absolute_time()], [
-#include <mach/mach_time.h>
-], [
- mach_absolute_time();
-], [je_cv_mach_absolute_time])
-if test "x${je_cv_mach_absolute_time}" = "xyes" ; then
- AC_DEFINE([JEMALLOC_HAVE_MACH_ABSOLUTE_TIME])
-fi
-
-dnl Check if syscall(2) is usable. Treat warnings as errors, so that e.g. OS X
-dnl 10.12's deprecation warning prevents use.
-SAVED_CFLAGS="${CFLAGS}"
-JE_CFLAGS_APPEND([-Werror])
-JE_COMPILABLE([syscall(2)], [
-#include <sys/syscall.h>
-#include <unistd.h>
-], [
- syscall(SYS_write, 2, "hello", 5);
-],
- [je_cv_syscall])
-CFLAGS="${SAVED_CFLAGS}"
-if test "x$je_cv_syscall" = "xyes" ; then
- AC_DEFINE([JEMALLOC_HAVE_SYSCALL], [ ])
-fi
-
-dnl Check if the GNU-specific secure_getenv function exists.
-AC_CHECK_FUNC([secure_getenv],
- [have_secure_getenv="1"],
- [have_secure_getenv="0"]
- )
-if test "x$have_secure_getenv" = "x1" ; then
- AC_DEFINE([JEMALLOC_HAVE_SECURE_GETENV], [ ])
-fi
-
-dnl Check if the Solaris/BSD issetugid function exists.
-AC_CHECK_FUNC([issetugid],
- [have_issetugid="1"],
- [have_issetugid="0"]
- )
-if test "x$have_issetugid" = "x1" ; then
- AC_DEFINE([JEMALLOC_HAVE_ISSETUGID], [ ])
-fi
-
-dnl Check whether the BSD-specific _malloc_thread_cleanup() exists. If so, use
-dnl it rather than pthreads TSD cleanup functions to support cleanup during
-dnl thread exit, in order to avoid pthreads library recursion during
-dnl bootstrapping.
-AC_CHECK_FUNC([_malloc_thread_cleanup],
- [have__malloc_thread_cleanup="1"],
- [have__malloc_thread_cleanup="0"]
- )
-if test "x$have__malloc_thread_cleanup" = "x1" ; then
- AC_DEFINE([JEMALLOC_MALLOC_THREAD_CLEANUP], [ ])
- force_tls="1"
-fi
-
-dnl Check whether the BSD-specific _pthread_mutex_init_calloc_cb() exists. If
-dnl so, mutex initialization causes allocation, and we need to implement this
-dnl callback function in order to prevent recursive allocation.
-AC_CHECK_FUNC([_pthread_mutex_init_calloc_cb],
- [have__pthread_mutex_init_calloc_cb="1"],
- [have__pthread_mutex_init_calloc_cb="0"]
- )
-if test "x$have__pthread_mutex_init_calloc_cb" = "x1" ; then
- AC_DEFINE([JEMALLOC_MUTEX_INIT_CB])
-fi
-
-dnl Disable lazy locking by default.
-AC_ARG_ENABLE([lazy_lock],
- [AS_HELP_STRING([--enable-lazy-lock],
- [Enable lazy locking (only lock when multi-threaded)])],
-[if test "x$enable_lazy_lock" = "xno" ; then
- enable_lazy_lock="0"
-else
- enable_lazy_lock="1"
-fi
-],
-[enable_lazy_lock=""]
-)
-if test "x${enable_lazy_lock}" = "x" ; then
- if test "x${force_lazy_lock}" = "x1" ; then
- AC_MSG_RESULT([Forcing lazy-lock to avoid allocator/threading bootstrap issues])
- enable_lazy_lock="1"
- else
- enable_lazy_lock="0"
- fi
-fi
-if test "x${enable_lazy_lock}" = "x1" -a "x${abi}" = "xpecoff" ; then
- AC_MSG_RESULT([Forcing no lazy-lock because thread creation monitoring is unimplemented])
- enable_lazy_lock="0"
-fi
-if test "x$enable_lazy_lock" = "x1" ; then
- if test "x$abi" != "xpecoff" ; then
- AC_CHECK_HEADERS([dlfcn.h], , [AC_MSG_ERROR([dlfcn.h is missing])])
- AC_CHECK_FUNC([dlsym], [],
- [AC_CHECK_LIB([dl], [dlsym], [LIBS="$LIBS -ldl"],
- [AC_MSG_ERROR([libdl is missing])])
- ])
- fi
- AC_DEFINE([JEMALLOC_LAZY_LOCK], [ ])
-fi
-AC_SUBST([enable_lazy_lock])
-
-AC_ARG_ENABLE([tls],
- [AS_HELP_STRING([--disable-tls], [Disable thread-local storage (__thread keyword)])],
-if test "x$enable_tls" = "xno" ; then
- enable_tls="0"
-else
- enable_tls="1"
-fi
-,
-enable_tls=""
-)
-if test "x${enable_tls}" = "x" ; then
- if test "x${force_tls}" = "x1" ; then
- AC_MSG_RESULT([Forcing TLS to avoid allocator/threading bootstrap issues])
- enable_tls="1"
- elif test "x${force_tls}" = "x0" ; then
- AC_MSG_RESULT([Forcing no TLS to avoid allocator/threading bootstrap issues])
- enable_tls="0"
- else
- enable_tls="1"
- fi
-fi
-if test "x${enable_tls}" = "x1" ; then
-AC_MSG_CHECKING([for TLS])
-AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
-[[
- __thread int x;
-]], [[
- x = 42;
-
- return 0;
-]])],
- AC_MSG_RESULT([yes]),
- AC_MSG_RESULT([no])
- enable_tls="0")
-else
- enable_tls="0"
-fi
-AC_SUBST([enable_tls])
-if test "x${enable_tls}" = "x1" ; then
- if test "x${force_tls}" = "x0" ; then
- AC_MSG_WARN([TLS enabled despite being marked unusable on this platform])
- fi
- AC_DEFINE_UNQUOTED([JEMALLOC_TLS], [ ])
-elif test "x${force_tls}" = "x1" ; then
- AC_MSG_WARN([TLS disabled despite being marked critical on this platform])
-fi
-
-dnl ============================================================================
-dnl Check for C11 atomics.
-
-JE_COMPILABLE([C11 atomics], [
-#include <stdint.h>
-#if (__STDC_VERSION__ >= 201112L) && !defined(__STDC_NO_ATOMICS__)
-#include <stdatomic.h>
-#else
-#error Atomics not available
-#endif
-], [
- uint64_t *p = (uint64_t *)0;
- uint64_t x = 1;
- volatile atomic_uint_least64_t *a = (volatile atomic_uint_least64_t *)p;
- uint64_t r = atomic_fetch_add(a, x) + x;
- return (r == 0);
-], [je_cv_c11atomics])
-if test "x${je_cv_c11atomics}" = "xyes" ; then
- AC_DEFINE([JEMALLOC_C11ATOMICS])
-fi
-
-dnl ============================================================================
-dnl Check for atomic(9) operations as provided on FreeBSD.
-
-JE_COMPILABLE([atomic(9)], [
-#include <sys/types.h>
-#include <machine/atomic.h>
-#include <inttypes.h>
-], [
- {
- uint32_t x32 = 0;
- volatile uint32_t *x32p = &x32;
- atomic_fetchadd_32(x32p, 1);
- }
- {
- unsigned long xlong = 0;
- volatile unsigned long *xlongp = &xlong;
- atomic_fetchadd_long(xlongp, 1);
- }
-], [je_cv_atomic9])
-if test "x${je_cv_atomic9}" = "xyes" ; then
- AC_DEFINE([JEMALLOC_ATOMIC9])
-fi
-
-dnl ============================================================================
-dnl Check for atomic(3) operations as provided on Darwin.
-
-JE_COMPILABLE([Darwin OSAtomic*()], [
-#include <libkern/OSAtomic.h>
-#include <inttypes.h>
-], [
- {
- int32_t x32 = 0;
- volatile int32_t *x32p = &x32;
- OSAtomicAdd32(1, x32p);
- }
- {
- int64_t x64 = 0;
- volatile int64_t *x64p = &x64;
- OSAtomicAdd64(1, x64p);
- }
-], [je_cv_osatomic])
-if test "x${je_cv_osatomic}" = "xyes" ; then
- AC_DEFINE([JEMALLOC_OSATOMIC], [ ])
-fi
-
-dnl ============================================================================
-dnl Check for madvise(2).
-
-JE_COMPILABLE([madvise(2)], [
-#include <sys/mman.h>
-], [
- {
- madvise((void *)0, 0, 0);
- }
-], [je_cv_madvise])
-if test "x${je_cv_madvise}" = "xyes" ; then
- AC_DEFINE([JEMALLOC_HAVE_MADVISE], [ ])
-fi
-
-dnl ============================================================================
-dnl Check whether __sync_{add,sub}_and_fetch() are available despite
-dnl __GCC_HAVE_SYNC_COMPARE_AND_SWAP_n macros being undefined.
-
-AC_DEFUN([JE_SYNC_COMPARE_AND_SWAP_CHECK],[
- AC_CACHE_CHECK([whether to force $1-bit __sync_{add,sub}_and_fetch()],
- [je_cv_sync_compare_and_swap_$2],
- [AC_LINK_IFELSE([AC_LANG_PROGRAM([
- #include <stdint.h>
- ],
- [
- #ifndef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2
- {
- uint$1_t x$1 = 0;
- __sync_add_and_fetch(&x$1, 42);
- __sync_sub_and_fetch(&x$1, 1);
- }
- #else
- #error __GCC_HAVE_SYNC_COMPARE_AND_SWAP_$2 is defined, no need to force
- #endif
- ])],
- [je_cv_sync_compare_and_swap_$2=yes],
- [je_cv_sync_compare_and_swap_$2=no])])
-
- if test "x${je_cv_sync_compare_and_swap_$2}" = "xyes" ; then
- AC_DEFINE([JE_FORCE_SYNC_COMPARE_AND_SWAP_$2], [ ])
- fi
-])
-
-if test "x${je_cv_atomic9}" != "xyes" -a "x${je_cv_osatomic}" != "xyes" ; then
- JE_SYNC_COMPARE_AND_SWAP_CHECK(32, 4)
- JE_SYNC_COMPARE_AND_SWAP_CHECK(64, 8)
-fi
-
-dnl ============================================================================
-dnl Check for __builtin_clz() and __builtin_clzl().
-
-AC_CACHE_CHECK([for __builtin_clz],
- [je_cv_builtin_clz],
- [AC_LINK_IFELSE([AC_LANG_PROGRAM([],
- [
- {
- unsigned x = 0;
- int y = __builtin_clz(x);
- }
- {
- unsigned long x = 0;
- int y = __builtin_clzl(x);
- }
- ])],
- [je_cv_builtin_clz=yes],
- [je_cv_builtin_clz=no])])
-
-if test "x${je_cv_builtin_clz}" = "xyes" ; then
- AC_DEFINE([JEMALLOC_HAVE_BUILTIN_CLZ], [ ])
-fi
-
-dnl ============================================================================
-dnl Check for os_unfair_lock operations as provided on Darwin.
-
-JE_COMPILABLE([Darwin os_unfair_lock_*()], [
-#include <os/lock.h>
-], [
- os_unfair_lock lock = OS_UNFAIR_LOCK_INIT;
- os_unfair_lock_lock(&lock);
- os_unfair_lock_unlock(&lock);
-], [je_cv_os_unfair_lock])
-if test "x${je_cv_os_unfair_lock}" = "xyes" ; then
- AC_DEFINE([JEMALLOC_OS_UNFAIR_LOCK], [ ])
-fi
-
-dnl ============================================================================
-dnl Check for spinlock(3) operations as provided on Darwin.
-
-JE_COMPILABLE([Darwin OSSpin*()], [
-#include <libkern/OSAtomic.h>
-#include <inttypes.h>
-], [
- OSSpinLock lock = 0;
- OSSpinLockLock(&lock);
- OSSpinLockUnlock(&lock);
-], [je_cv_osspin])
-if test "x${je_cv_osspin}" = "xyes" ; then
- AC_DEFINE([JEMALLOC_OSSPIN], [ ])
-fi
-
-dnl ============================================================================
-dnl Darwin-related configuration.
-
-AC_ARG_ENABLE([zone-allocator],
- [AS_HELP_STRING([--disable-zone-allocator],
- [Disable zone allocator for Darwin])],
-[if test "x$enable_zone_allocator" = "xno" ; then
- enable_zone_allocator="0"
-else
- enable_zone_allocator="1"
-fi
-],
-[if test "x${abi}" = "xmacho"; then
- enable_zone_allocator="1"
-fi
-]
-)
-AC_SUBST([enable_zone_allocator])
-
-if test "x${enable_zone_allocator}" = "x1" ; then
- if test "x${abi}" != "xmacho"; then
- AC_MSG_ERROR([--enable-zone-allocator is only supported on Darwin])
- fi
- AC_DEFINE([JEMALLOC_ZONE], [ ])
-
- dnl The szone version jumped from 3 to 6 between the OS X 10.5.x and 10.6
- dnl releases. malloc_zone_t and malloc_introspection_t have new fields in
- dnl 10.6, which is the only source-level indication of the change.
- AC_MSG_CHECKING([malloc zone version])
- AC_DEFUN([JE_ZONE_PROGRAM],
- [AC_LANG_PROGRAM(
- [#include <malloc/malloc.h>],
- [static int foo[[sizeof($1) $2 sizeof(void *) * $3 ? 1 : -1]]]
- )])
-
- AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,14)],[JEMALLOC_ZONE_VERSION=3],[
- AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,15)],[JEMALLOC_ZONE_VERSION=5],[
- AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,16)],[
- AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_introspection_t,==,9)],[JEMALLOC_ZONE_VERSION=6],[
- AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_introspection_t,==,13)],[JEMALLOC_ZONE_VERSION=7],[JEMALLOC_ZONE_VERSION=]
- )])],[
- AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,==,17)],[JEMALLOC_ZONE_VERSION=8],[
- AC_COMPILE_IFELSE([JE_ZONE_PROGRAM(malloc_zone_t,>,17)],[JEMALLOC_ZONE_VERSION=9],[JEMALLOC_ZONE_VERSION=]
- )])])])])
- if test "x${JEMALLOC_ZONE_VERSION}" = "x"; then
- AC_MSG_RESULT([unsupported])
- AC_MSG_ERROR([Unsupported malloc zone version])
- fi
- if test "${JEMALLOC_ZONE_VERSION}" = 9; then
- JEMALLOC_ZONE_VERSION=8
- AC_MSG_RESULT([> 8])
- else
- AC_MSG_RESULT([$JEMALLOC_ZONE_VERSION])
- fi
- AC_DEFINE_UNQUOTED(JEMALLOC_ZONE_VERSION, [$JEMALLOC_ZONE_VERSION])
-fi
-
-dnl ============================================================================
-dnl Check for glibc malloc hooks
-
-JE_COMPILABLE([glibc malloc hook], [
-#include <stddef.h>
-
-extern void (* __free_hook)(void *ptr);
-extern void *(* __malloc_hook)(size_t size);
-extern void *(* __realloc_hook)(void *ptr, size_t size);
-], [
- void *ptr = 0L;
- if (__malloc_hook) ptr = __malloc_hook(1);
- if (__realloc_hook) ptr = __realloc_hook(ptr, 2);
- if (__free_hook && ptr) __free_hook(ptr);
-], [je_cv_glibc_malloc_hook])
-if test "x${je_cv_glibc_malloc_hook}" = "xyes" ; then
- AC_DEFINE([JEMALLOC_GLIBC_MALLOC_HOOK], [ ])
-fi
-
-JE_COMPILABLE([glibc memalign hook], [
-#include <stddef.h>
-
-extern void *(* __memalign_hook)(size_t alignment, size_t size);
-], [
- void *ptr = 0L;
- if (__memalign_hook) ptr = __memalign_hook(16, 7);
-], [je_cv_glibc_memalign_hook])
-if test "x${je_cv_glibc_memalign_hook}" = "xyes" ; then
- AC_DEFINE([JEMALLOC_GLIBC_MEMALIGN_HOOK], [ ])
-fi
-
-JE_COMPILABLE([pthreads adaptive mutexes], [
-#include <pthread.h>
-], [
- pthread_mutexattr_t attr;
- pthread_mutexattr_init(&attr);
- pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_ADAPTIVE_NP);
- pthread_mutexattr_destroy(&attr);
-], [je_cv_pthread_mutex_adaptive_np])
-if test "x${je_cv_pthread_mutex_adaptive_np}" = "xyes" ; then
- AC_DEFINE([JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP], [ ])
-fi
-
-dnl ============================================================================
-dnl Check for typedefs, structures, and compiler characteristics.
-AC_HEADER_STDBOOL
-
-dnl ============================================================================
-dnl Define commands that generate output files.
-
-AC_CONFIG_COMMANDS([include/jemalloc/internal/private_namespace.h], [
- mkdir -p "${objroot}include/jemalloc/internal"
- "${srcdir}/include/jemalloc/internal/private_namespace.sh" "${srcdir}/include/jemalloc/internal/private_symbols.txt" > "${objroot}include/jemalloc/internal/private_namespace.h"
-], [
- srcdir="${srcdir}"
- objroot="${objroot}"
-])
-AC_CONFIG_COMMANDS([include/jemalloc/internal/private_unnamespace.h], [
- mkdir -p "${objroot}include/jemalloc/internal"
- "${srcdir}/include/jemalloc/internal/private_unnamespace.sh" "${srcdir}/include/jemalloc/internal/private_symbols.txt" > "${objroot}include/jemalloc/internal/private_unnamespace.h"
-], [
- srcdir="${srcdir}"
- objroot="${objroot}"
-])
-AC_CONFIG_COMMANDS([include/jemalloc/internal/public_symbols.txt], [
- f="${objroot}include/jemalloc/internal/public_symbols.txt"
- mkdir -p "${objroot}include/jemalloc/internal"
- cp /dev/null "${f}"
- for nm in `echo ${mangling_map} |tr ',' ' '` ; do
- n=`echo ${nm} |tr ':' ' ' |awk '{print $[]1}'`
- m=`echo ${nm} |tr ':' ' ' |awk '{print $[]2}'`
- echo "${n}:${m}" >> "${f}"
- dnl Remove name from public_syms so that it isn't redefined later.
- public_syms=`for sym in ${public_syms}; do echo "${sym}"; done |grep -v "^${n}\$" |tr '\n' ' '`
- done
- for sym in ${public_syms} ; do
- n="${sym}"
- m="${JEMALLOC_PREFIX}${sym}"
- echo "${n}:${m}" >> "${f}"
- done
-], [
- srcdir="${srcdir}"
- objroot="${objroot}"
- mangling_map="${mangling_map}"
- public_syms="${public_syms}"
- JEMALLOC_PREFIX="${JEMALLOC_PREFIX}"
-])
-AC_CONFIG_COMMANDS([include/jemalloc/internal/public_namespace.h], [
- mkdir -p "${objroot}include/jemalloc/internal"
- "${srcdir}/include/jemalloc/internal/public_namespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_namespace.h"
-], [
- srcdir="${srcdir}"
- objroot="${objroot}"
-])
-AC_CONFIG_COMMANDS([include/jemalloc/internal/public_unnamespace.h], [
- mkdir -p "${objroot}include/jemalloc/internal"
- "${srcdir}/include/jemalloc/internal/public_unnamespace.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/internal/public_unnamespace.h"
-], [
- srcdir="${srcdir}"
- objroot="${objroot}"
-])
-AC_CONFIG_COMMANDS([include/jemalloc/internal/size_classes.h], [
- mkdir -p "${objroot}include/jemalloc/internal"
- "${SHELL}" "${srcdir}/include/jemalloc/internal/size_classes.sh" "${LG_QUANTA}" ${LG_TINY_MIN} "${LG_PAGE_SIZES}" ${LG_SIZE_CLASS_GROUP} > "${objroot}include/jemalloc/internal/size_classes.h"
-], [
- SHELL="${SHELL}"
- srcdir="${srcdir}"
- objroot="${objroot}"
- LG_QUANTA="${LG_QUANTA}"
- LG_TINY_MIN=${LG_TINY_MIN}
- LG_PAGE_SIZES="${LG_PAGE_SIZES}"
- LG_SIZE_CLASS_GROUP=${LG_SIZE_CLASS_GROUP}
-])
-AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_protos_jet.h], [
- mkdir -p "${objroot}include/jemalloc"
- cat "${srcdir}/include/jemalloc/jemalloc_protos.h.in" | sed -e 's/@je_@/jet_/g' > "${objroot}include/jemalloc/jemalloc_protos_jet.h"
-], [
- srcdir="${srcdir}"
- objroot="${objroot}"
-])
-AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_rename.h], [
- mkdir -p "${objroot}include/jemalloc"
- "${srcdir}/include/jemalloc/jemalloc_rename.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" > "${objroot}include/jemalloc/jemalloc_rename.h"
-], [
- srcdir="${srcdir}"
- objroot="${objroot}"
-])
-AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_mangle.h], [
- mkdir -p "${objroot}include/jemalloc"
- "${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" je_ > "${objroot}include/jemalloc/jemalloc_mangle.h"
-], [
- srcdir="${srcdir}"
- objroot="${objroot}"
-])
-AC_CONFIG_COMMANDS([include/jemalloc/jemalloc_mangle_jet.h], [
- mkdir -p "${objroot}include/jemalloc"
- "${srcdir}/include/jemalloc/jemalloc_mangle.sh" "${objroot}include/jemalloc/internal/public_symbols.txt" jet_ > "${objroot}include/jemalloc/jemalloc_mangle_jet.h"
-], [
- srcdir="${srcdir}"
- objroot="${objroot}"
-])
-AC_CONFIG_COMMANDS([include/jemalloc/jemalloc.h], [
- mkdir -p "${objroot}include/jemalloc"
- "${srcdir}/include/jemalloc/jemalloc.sh" "${objroot}" > "${objroot}include/jemalloc/jemalloc${install_suffix}.h"
-], [
- srcdir="${srcdir}"
- objroot="${objroot}"
- install_suffix="${install_suffix}"
-])
-
-dnl Process .in files.
-AC_SUBST([cfghdrs_in])
-AC_SUBST([cfghdrs_out])
-AC_CONFIG_HEADERS([$cfghdrs_tup])
-
-dnl ============================================================================
-dnl Generate outputs.
-
-AC_CONFIG_FILES([$cfgoutputs_tup config.stamp bin/jemalloc-config bin/jemalloc.sh bin/jeprof])
-AC_SUBST([cfgoutputs_in])
-AC_SUBST([cfgoutputs_out])
-AC_OUTPUT
-
-dnl ============================================================================
-dnl Print out the results of configuration.
-AC_MSG_RESULT([===============================================================================])
-AC_MSG_RESULT([jemalloc version : ${jemalloc_version}])
-AC_MSG_RESULT([library revision : ${rev}])
-AC_MSG_RESULT([])
-AC_MSG_RESULT([CONFIG : ${CONFIG}])
-AC_MSG_RESULT([CC : ${CC}])
-AC_MSG_RESULT([CFLAGS : ${CFLAGS}])
-AC_MSG_RESULT([EXTRA_CFLAGS : ${EXTRA_CFLAGS}])
-AC_MSG_RESULT([CPPFLAGS : ${CPPFLAGS}])
-AC_MSG_RESULT([LDFLAGS : ${LDFLAGS}])
-AC_MSG_RESULT([EXTRA_LDFLAGS : ${EXTRA_LDFLAGS}])
-AC_MSG_RESULT([LIBS : ${LIBS}])
-AC_MSG_RESULT([RPATH_EXTRA : ${RPATH_EXTRA}])
-AC_MSG_RESULT([])
-AC_MSG_RESULT([XSLTPROC : ${XSLTPROC}])
-AC_MSG_RESULT([XSLROOT : ${XSLROOT}])
-AC_MSG_RESULT([])
-AC_MSG_RESULT([PREFIX : ${PREFIX}])
-AC_MSG_RESULT([BINDIR : ${BINDIR}])
-AC_MSG_RESULT([DATADIR : ${DATADIR}])
-AC_MSG_RESULT([INCLUDEDIR : ${INCLUDEDIR}])
-AC_MSG_RESULT([LIBDIR : ${LIBDIR}])
-AC_MSG_RESULT([MANDIR : ${MANDIR}])
-AC_MSG_RESULT([])
-AC_MSG_RESULT([srcroot : ${srcroot}])
-AC_MSG_RESULT([abs_srcroot : ${abs_srcroot}])
-AC_MSG_RESULT([objroot : ${objroot}])
-AC_MSG_RESULT([abs_objroot : ${abs_objroot}])
-AC_MSG_RESULT([])
-AC_MSG_RESULT([JEMALLOC_PREFIX : ${JEMALLOC_PREFIX}])
-AC_MSG_RESULT([JEMALLOC_PRIVATE_NAMESPACE])
-AC_MSG_RESULT([ : ${JEMALLOC_PRIVATE_NAMESPACE}])
-AC_MSG_RESULT([install_suffix : ${install_suffix}])
-AC_MSG_RESULT([malloc_conf : ${config_malloc_conf}])
-AC_MSG_RESULT([autogen : ${enable_autogen}])
-AC_MSG_RESULT([cc-silence : ${enable_cc_silence}])
-AC_MSG_RESULT([debug : ${enable_debug}])
-AC_MSG_RESULT([code-coverage : ${enable_code_coverage}])
-AC_MSG_RESULT([stats : ${enable_stats}])
-AC_MSG_RESULT([prof : ${enable_prof}])
-AC_MSG_RESULT([prof-libunwind : ${enable_prof_libunwind}])
-AC_MSG_RESULT([prof-libgcc : ${enable_prof_libgcc}])
-AC_MSG_RESULT([prof-gcc : ${enable_prof_gcc}])
-AC_MSG_RESULT([tcache : ${enable_tcache}])
-AC_MSG_RESULT([fill : ${enable_fill}])
-AC_MSG_RESULT([utrace : ${enable_utrace}])
-AC_MSG_RESULT([valgrind : ${enable_valgrind}])
-AC_MSG_RESULT([xmalloc : ${enable_xmalloc}])
-AC_MSG_RESULT([munmap : ${enable_munmap}])
-AC_MSG_RESULT([lazy_lock : ${enable_lazy_lock}])
-AC_MSG_RESULT([tls : ${enable_tls}])
-AC_MSG_RESULT([cache-oblivious : ${enable_cache_oblivious}])
-AC_MSG_RESULT([===============================================================================])
diff --git a/memory/jemalloc/src/coverage.sh b/memory/jemalloc/src/coverage.sh
deleted file mode 100755
index 6d1362a8c1..0000000000
--- a/memory/jemalloc/src/coverage.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/sh
-
-set -e
-
-objdir=$1
-suffix=$2
-shift 2
-objs=$@
-
-gcov -b -p -f -o "${objdir}" ${objs}
-
-# Move gcov outputs so that subsequent gcov invocations won't clobber results
-# for the same sources with different compilation flags.
-for f in `find . -maxdepth 1 -type f -name '*.gcov'` ; do
- mv "${f}" "${f}.${suffix}"
-done
diff --git a/memory/jemalloc/src/doc/html.xsl.in b/memory/jemalloc/src/doc/html.xsl.in
deleted file mode 100644
index ec4fa6552b..0000000000
--- a/memory/jemalloc/src/doc/html.xsl.in
+++ /dev/null
@@ -1,5 +0,0 @@
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
- <xsl:import href="@XSLROOT@/html/docbook.xsl"/>
- <xsl:import href="@abs_srcroot@doc/stylesheet.xsl"/>
- <xsl:output method="xml" encoding="utf-8"/>
-</xsl:stylesheet>
diff --git a/memory/jemalloc/src/doc/jemalloc.xml.in b/memory/jemalloc/src/doc/jemalloc.xml.in
deleted file mode 100644
index 3d2e721d39..0000000000
--- a/memory/jemalloc/src/doc/jemalloc.xml.in
+++ /dev/null
@@ -1,2966 +0,0 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<?xml-stylesheet type="text/xsl"
- href="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"?>
-<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
- "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
-]>
-
-<refentry>
- <refentryinfo>
- <title>User Manual</title>
- <productname>jemalloc</productname>
- <releaseinfo role="version">@jemalloc_version@</releaseinfo>
- <authorgroup>
- <author>
- <firstname>Jason</firstname>
- <surname>Evans</surname>
- <personblurb>Author</personblurb>
- </author>
- </authorgroup>
- </refentryinfo>
- <refmeta>
- <refentrytitle>JEMALLOC</refentrytitle>
- <manvolnum>3</manvolnum>
- </refmeta>
- <refnamediv>
- <refdescriptor>jemalloc</refdescriptor>
- <refname>jemalloc</refname>
- <!-- Each refname causes a man page file to be created. Only if this were
- the system malloc(3) implementation would these files be appropriate.
- <refname>malloc</refname>
- <refname>calloc</refname>
- <refname>posix_memalign</refname>
- <refname>aligned_alloc</refname>
- <refname>realloc</refname>
- <refname>free</refname>
- <refname>mallocx</refname>
- <refname>rallocx</refname>
- <refname>xallocx</refname>
- <refname>sallocx</refname>
- <refname>dallocx</refname>
- <refname>sdallocx</refname>
- <refname>nallocx</refname>
- <refname>mallctl</refname>
- <refname>mallctlnametomib</refname>
- <refname>mallctlbymib</refname>
- <refname>malloc_stats_print</refname>
- <refname>malloc_usable_size</refname>
- -->
- <refpurpose>general purpose memory allocation functions</refpurpose>
- </refnamediv>
- <refsect1 id="library">
- <title>LIBRARY</title>
- <para>This manual describes jemalloc @jemalloc_version@. More information
- can be found at the <ulink
- url="http://jemalloc.net/">jemalloc website</ulink>.</para>
- </refsect1>
- <refsynopsisdiv>
- <title>SYNOPSIS</title>
- <funcsynopsis>
- <funcsynopsisinfo>#include &lt;<filename class="headerfile">jemalloc/jemalloc.h</filename>&gt;</funcsynopsisinfo>
- <refsect2>
- <title>Standard API</title>
- <funcprototype>
- <funcdef>void *<function>malloc</function></funcdef>
- <paramdef>size_t <parameter>size</parameter></paramdef>
- </funcprototype>
- <funcprototype>
- <funcdef>void *<function>calloc</function></funcdef>
- <paramdef>size_t <parameter>number</parameter></paramdef>
- <paramdef>size_t <parameter>size</parameter></paramdef>
- </funcprototype>
- <funcprototype>
- <funcdef>int <function>posix_memalign</function></funcdef>
- <paramdef>void **<parameter>ptr</parameter></paramdef>
- <paramdef>size_t <parameter>alignment</parameter></paramdef>
- <paramdef>size_t <parameter>size</parameter></paramdef>
- </funcprototype>
- <funcprototype>
- <funcdef>void *<function>aligned_alloc</function></funcdef>
- <paramdef>size_t <parameter>alignment</parameter></paramdef>
- <paramdef>size_t <parameter>size</parameter></paramdef>
- </funcprototype>
- <funcprototype>
- <funcdef>void *<function>realloc</function></funcdef>
- <paramdef>void *<parameter>ptr</parameter></paramdef>
- <paramdef>size_t <parameter>size</parameter></paramdef>
- </funcprototype>
- <funcprototype>
- <funcdef>void <function>free</function></funcdef>
- <paramdef>void *<parameter>ptr</parameter></paramdef>
- </funcprototype>
- </refsect2>
- <refsect2>
- <title>Non-standard API</title>
- <funcprototype>
- <funcdef>void *<function>mallocx</function></funcdef>
- <paramdef>size_t <parameter>size</parameter></paramdef>
- <paramdef>int <parameter>flags</parameter></paramdef>
- </funcprototype>
- <funcprototype>
- <funcdef>void *<function>rallocx</function></funcdef>
- <paramdef>void *<parameter>ptr</parameter></paramdef>
- <paramdef>size_t <parameter>size</parameter></paramdef>
- <paramdef>int <parameter>flags</parameter></paramdef>
- </funcprototype>
- <funcprototype>
- <funcdef>size_t <function>xallocx</function></funcdef>
- <paramdef>void *<parameter>ptr</parameter></paramdef>
- <paramdef>size_t <parameter>size</parameter></paramdef>
- <paramdef>size_t <parameter>extra</parameter></paramdef>
- <paramdef>int <parameter>flags</parameter></paramdef>
- </funcprototype>
- <funcprototype>
- <funcdef>size_t <function>sallocx</function></funcdef>
- <paramdef>void *<parameter>ptr</parameter></paramdef>
- <paramdef>int <parameter>flags</parameter></paramdef>
- </funcprototype>
- <funcprototype>
- <funcdef>void <function>dallocx</function></funcdef>
- <paramdef>void *<parameter>ptr</parameter></paramdef>
- <paramdef>int <parameter>flags</parameter></paramdef>
- </funcprototype>
- <funcprototype>
- <funcdef>void <function>sdallocx</function></funcdef>
- <paramdef>void *<parameter>ptr</parameter></paramdef>
- <paramdef>size_t <parameter>size</parameter></paramdef>
- <paramdef>int <parameter>flags</parameter></paramdef>
- </funcprototype>
- <funcprototype>
- <funcdef>size_t <function>nallocx</function></funcdef>
- <paramdef>size_t <parameter>size</parameter></paramdef>
- <paramdef>int <parameter>flags</parameter></paramdef>
- </funcprototype>
- <funcprototype>
- <funcdef>int <function>mallctl</function></funcdef>
- <paramdef>const char *<parameter>name</parameter></paramdef>
- <paramdef>void *<parameter>oldp</parameter></paramdef>
- <paramdef>size_t *<parameter>oldlenp</parameter></paramdef>
- <paramdef>void *<parameter>newp</parameter></paramdef>
- <paramdef>size_t <parameter>newlen</parameter></paramdef>
- </funcprototype>
- <funcprototype>
- <funcdef>int <function>mallctlnametomib</function></funcdef>
- <paramdef>const char *<parameter>name</parameter></paramdef>
- <paramdef>size_t *<parameter>mibp</parameter></paramdef>
- <paramdef>size_t *<parameter>miblenp</parameter></paramdef>
- </funcprototype>
- <funcprototype>
- <funcdef>int <function>mallctlbymib</function></funcdef>
- <paramdef>const size_t *<parameter>mib</parameter></paramdef>
- <paramdef>size_t <parameter>miblen</parameter></paramdef>
- <paramdef>void *<parameter>oldp</parameter></paramdef>
- <paramdef>size_t *<parameter>oldlenp</parameter></paramdef>
- <paramdef>void *<parameter>newp</parameter></paramdef>
- <paramdef>size_t <parameter>newlen</parameter></paramdef>
- </funcprototype>
- <funcprototype>
- <funcdef>void <function>malloc_stats_print</function></funcdef>
- <paramdef>void <parameter>(*write_cb)</parameter>
- <funcparams>void *, const char *</funcparams>
- </paramdef>
- <paramdef>void *<parameter>cbopaque</parameter></paramdef>
- <paramdef>const char *<parameter>opts</parameter></paramdef>
- </funcprototype>
- <funcprototype>
- <funcdef>size_t <function>malloc_usable_size</function></funcdef>
- <paramdef>const void *<parameter>ptr</parameter></paramdef>
- </funcprototype>
- <funcprototype>
- <funcdef>void <function>(*malloc_message)</function></funcdef>
- <paramdef>void *<parameter>cbopaque</parameter></paramdef>
- <paramdef>const char *<parameter>s</parameter></paramdef>
- </funcprototype>
- <para><type>const char *</type><varname>malloc_conf</varname>;</para>
- </refsect2>
- </funcsynopsis>
- </refsynopsisdiv>
- <refsect1 id="description">
- <title>DESCRIPTION</title>
- <refsect2>
- <title>Standard API</title>
-
- <para>The <function>malloc()</function> function allocates
- <parameter>size</parameter> bytes of uninitialized memory. The allocated
- space is suitably aligned (after possible pointer coercion) for storage
- of any type of object.</para>
-
- <para>The <function>calloc()</function> function allocates
- space for <parameter>number</parameter> objects, each
- <parameter>size</parameter> bytes in length. The result is identical to
- calling <function>malloc()</function> with an argument of
- <parameter>number</parameter> * <parameter>size</parameter>, with the
- exception that the allocated memory is explicitly initialized to zero
- bytes.</para>
-
- <para>The <function>posix_memalign()</function> function
- allocates <parameter>size</parameter> bytes of memory such that the
- allocation's base address is a multiple of
- <parameter>alignment</parameter>, and returns the allocation in the value
- pointed to by <parameter>ptr</parameter>. The requested
- <parameter>alignment</parameter> must be a power of 2 at least as large as
- <code language="C">sizeof(<type>void *</type>)</code>.</para>
-
- <para>The <function>aligned_alloc()</function> function
- allocates <parameter>size</parameter> bytes of memory such that the
- allocation's base address is a multiple of
- <parameter>alignment</parameter>. The requested
- <parameter>alignment</parameter> must be a power of 2. Behavior is
- undefined if <parameter>size</parameter> is not an integral multiple of
- <parameter>alignment</parameter>.</para>
-
- <para>The <function>realloc()</function> function changes the
- size of the previously allocated memory referenced by
- <parameter>ptr</parameter> to <parameter>size</parameter> bytes. The
- contents of the memory are unchanged up to the lesser of the new and old
- sizes. If the new size is larger, the contents of the newly allocated
- portion of the memory are undefined. Upon success, the memory referenced
- by <parameter>ptr</parameter> is freed and a pointer to the newly
- allocated memory is returned. Note that
- <function>realloc()</function> may move the memory allocation,
- resulting in a different return value than <parameter>ptr</parameter>.
- If <parameter>ptr</parameter> is <constant>NULL</constant>, the
- <function>realloc()</function> function behaves identically to
- <function>malloc()</function> for the specified size.</para>
-
- <para>The <function>free()</function> function causes the
- allocated memory referenced by <parameter>ptr</parameter> to be made
- available for future allocations. If <parameter>ptr</parameter> is
- <constant>NULL</constant>, no action occurs.</para>
- </refsect2>
- <refsect2>
- <title>Non-standard API</title>
- <para>The <function>mallocx()</function>,
- <function>rallocx()</function>,
- <function>xallocx()</function>,
- <function>sallocx()</function>,
- <function>dallocx()</function>,
- <function>sdallocx()</function>, and
- <function>nallocx()</function> functions all have a
- <parameter>flags</parameter> argument that can be used to specify
- options. The functions only check the options that are contextually
- relevant. Use bitwise or (<code language="C">|</code>) operations to
- specify one or more of the following:
- <variablelist>
- <varlistentry id="MALLOCX_LG_ALIGN">
- <term><constant>MALLOCX_LG_ALIGN(<parameter>la</parameter>)
- </constant></term>
-
- <listitem><para>Align the memory allocation to start at an address
- that is a multiple of <code language="C">(1 &lt;&lt;
- <parameter>la</parameter>)</code>. This macro does not validate
- that <parameter>la</parameter> is within the valid
- range.</para></listitem>
- </varlistentry>
- <varlistentry id="MALLOCX_ALIGN">
- <term><constant>MALLOCX_ALIGN(<parameter>a</parameter>)
- </constant></term>
-
- <listitem><para>Align the memory allocation to start at an address
- that is a multiple of <parameter>a</parameter>, where
- <parameter>a</parameter> is a power of two. This macro does not
- validate that <parameter>a</parameter> is a power of 2.
- </para></listitem>
- </varlistentry>
- <varlistentry id="MALLOCX_ZERO">
- <term><constant>MALLOCX_ZERO</constant></term>
-
- <listitem><para>Initialize newly allocated memory to contain zero
- bytes. In the growing reallocation case, the real size prior to
- reallocation defines the boundary between untouched bytes and those
- that are initialized to contain zero bytes. If this macro is
- absent, newly allocated memory is uninitialized.</para></listitem>
- </varlistentry>
- <varlistentry id="MALLOCX_TCACHE">
- <term><constant>MALLOCX_TCACHE(<parameter>tc</parameter>)
- </constant></term>
-
- <listitem><para>Use the thread-specific cache (tcache) specified by
- the identifier <parameter>tc</parameter>, which must have been
- acquired via the <link
- linkend="tcache.create"><mallctl>tcache.create</mallctl></link>
- mallctl. This macro does not validate that
- <parameter>tc</parameter> specifies a valid
- identifier.</para></listitem>
- </varlistentry>
- <varlistentry id="MALLOC_TCACHE_NONE">
- <term><constant>MALLOCX_TCACHE_NONE</constant></term>
-
- <listitem><para>Do not use a thread-specific cache (tcache). Unless
- <constant>MALLOCX_TCACHE(<parameter>tc</parameter>)</constant> or
- <constant>MALLOCX_TCACHE_NONE</constant> is specified, an
- automatically managed tcache will be used under many circumstances.
- This macro cannot be used in the same <parameter>flags</parameter>
- argument as
- <constant>MALLOCX_TCACHE(<parameter>tc</parameter>)</constant>.</para></listitem>
- </varlistentry>
- <varlistentry id="MALLOCX_ARENA">
- <term><constant>MALLOCX_ARENA(<parameter>a</parameter>)
- </constant></term>
-
- <listitem><para>Use the arena specified by the index
- <parameter>a</parameter>. This macro has no effect for regions that
- were allocated via an arena other than the one specified. This
- macro does not validate that <parameter>a</parameter> specifies an
- arena index in the valid range.</para></listitem>
- </varlistentry>
- </variablelist>
- </para>
-
- <para>The <function>mallocx()</function> function allocates at
- least <parameter>size</parameter> bytes of memory, and returns a pointer
- to the base address of the allocation. Behavior is undefined if
- <parameter>size</parameter> is <constant>0</constant>.</para>
-
- <para>The <function>rallocx()</function> function resizes the
- allocation at <parameter>ptr</parameter> to be at least
- <parameter>size</parameter> bytes, and returns a pointer to the base
- address of the resulting allocation, which may or may not have moved from
- its original location. Behavior is undefined if
- <parameter>size</parameter> is <constant>0</constant>.</para>
-
- <para>The <function>xallocx()</function> function resizes the
- allocation at <parameter>ptr</parameter> in place to be at least
- <parameter>size</parameter> bytes, and returns the real size of the
- allocation. If <parameter>extra</parameter> is non-zero, an attempt is
- made to resize the allocation to be at least <code
- language="C">(<parameter>size</parameter> +
- <parameter>extra</parameter>)</code> bytes, though inability to allocate
- the extra byte(s) will not by itself result in failure to resize.
- Behavior is undefined if <parameter>size</parameter> is
- <constant>0</constant>, or if <code
- language="C">(<parameter>size</parameter> + <parameter>extra</parameter>
- &gt; <constant>SIZE_T_MAX</constant>)</code>.</para>
-
- <para>The <function>sallocx()</function> function returns the
- real size of the allocation at <parameter>ptr</parameter>.</para>
-
- <para>The <function>dallocx()</function> function causes the
- memory referenced by <parameter>ptr</parameter> to be made available for
- future allocations.</para>
-
- <para>The <function>sdallocx()</function> function is an
- extension of <function>dallocx()</function> with a
- <parameter>size</parameter> parameter to allow the caller to pass in the
- allocation size as an optimization. The minimum valid input size is the
- original requested size of the allocation, and the maximum valid input
- size is the corresponding value returned by
- <function>nallocx()</function> or
- <function>sallocx()</function>.</para>
-
- <para>The <function>nallocx()</function> function allocates no
- memory, but it performs the same size computation as the
- <function>mallocx()</function> function, and returns the real
- size of the allocation that would result from the equivalent
- <function>mallocx()</function> function call, or
- <constant>0</constant> if the inputs exceed the maximum supported size
- class and/or alignment. Behavior is undefined if
- <parameter>size</parameter> is <constant>0</constant>.</para>
-
- <para>The <function>mallctl()</function> function provides a
- general interface for introspecting the memory allocator, as well as
- setting modifiable parameters and triggering actions. The
- period-separated <parameter>name</parameter> argument specifies a
- location in a tree-structured namespace; see the <xref
- linkend="mallctl_namespace" xrefstyle="template:%t"/> section for
- documentation on the tree contents. To read a value, pass a pointer via
- <parameter>oldp</parameter> to adequate space to contain the value, and a
- pointer to its length via <parameter>oldlenp</parameter>; otherwise pass
- <constant>NULL</constant> and <constant>NULL</constant>. Similarly, to
- write a value, pass a pointer to the value via
- <parameter>newp</parameter>, and its length via
- <parameter>newlen</parameter>; otherwise pass <constant>NULL</constant>
- and <constant>0</constant>.</para>
-
- <para>The <function>mallctlnametomib()</function> function
- provides a way to avoid repeated name lookups for applications that
- repeatedly query the same portion of the namespace, by translating a name
- to a <quote>Management Information Base</quote> (MIB) that can be passed
- repeatedly to <function>mallctlbymib()</function>. Upon
- successful return from <function>mallctlnametomib()</function>,
- <parameter>mibp</parameter> contains an array of
- <parameter>*miblenp</parameter> integers, where
- <parameter>*miblenp</parameter> is the lesser of the number of components
- in <parameter>name</parameter> and the input value of
- <parameter>*miblenp</parameter>. Thus it is possible to pass a
- <parameter>*miblenp</parameter> that is smaller than the number of
- period-separated name components, which results in a partial MIB that can
- be used as the basis for constructing a complete MIB. For name
- components that are integers (e.g. the 2 in
- <link
- linkend="arenas.bin.i.size"><mallctl>arenas.bin.2.size</mallctl></link>),
- the corresponding MIB component will always be that integer. Therefore,
- it is legitimate to construct code like the following: <programlisting
- language="C"><![CDATA[
-unsigned nbins, i;
-size_t mib[4];
-size_t len, miblen;
-
-len = sizeof(nbins);
-mallctl("arenas.nbins", &nbins, &len, NULL, 0);
-
-miblen = 4;
-mallctlnametomib("arenas.bin.0.size", mib, &miblen);
-for (i = 0; i < nbins; i++) {
- size_t bin_size;
-
- mib[2] = i;
- len = sizeof(bin_size);
- mallctlbymib(mib, miblen, &bin_size, &len, NULL, 0);
- /* Do something with bin_size... */
-}]]></programlisting></para>
-
- <para>The <function>malloc_stats_print()</function> function writes
- summary statistics via the <parameter>write_cb</parameter> callback
- function pointer and <parameter>cbopaque</parameter> data passed to
- <parameter>write_cb</parameter>, or <function>malloc_message()</function>
- if <parameter>write_cb</parameter> is <constant>NULL</constant>. The
- statistics are presented in human-readable form unless <quote>J</quote> is
- specified as a character within the <parameter>opts</parameter> string, in
- which case the statistics are presented in <ulink
- url="http://www.json.org/">JSON format</ulink>. This function can be
- called repeatedly. General information that never changes during
- execution can be omitted by specifying <quote>g</quote> as a character
- within the <parameter>opts</parameter> string. Note that
- <function>malloc_message()</function> uses the
- <function>mallctl*()</function> functions internally, so inconsistent
- statistics can be reported if multiple threads use these functions
- simultaneously. If <option>--enable-stats</option> is specified during
- configuration, <quote>m</quote> and <quote>a</quote> can be specified to
- omit merged arena and per arena statistics, respectively;
- <quote>b</quote>, <quote>l</quote>, and <quote>h</quote> can be specified
- to omit per size class statistics for bins, large objects, and huge
- objects, respectively. Unrecognized characters are silently ignored.
- Note that thread caching may prevent some statistics from being completely
- up to date, since extra locking would be required to merge counters that
- track thread cache operations.</para>
-
- <para>The <function>malloc_usable_size()</function> function
- returns the usable size of the allocation pointed to by
- <parameter>ptr</parameter>. The return value may be larger than the size
- that was requested during allocation. The
- <function>malloc_usable_size()</function> function is not a
- mechanism for in-place <function>realloc()</function>; rather
- it is provided solely as a tool for introspection purposes. Any
- discrepancy between the requested allocation size and the size reported
- by <function>malloc_usable_size()</function> should not be
- depended on, since such behavior is entirely implementation-dependent.
- </para>
- </refsect2>
- </refsect1>
- <refsect1 id="tuning">
- <title>TUNING</title>
- <para>Once, when the first call is made to one of the memory allocation
- routines, the allocator initializes its internals based in part on various
- options that can be specified at compile- or run-time.</para>
-
- <para>The string specified via <option>--with-malloc-conf</option>, the
- string pointed to by the global variable <varname>malloc_conf</varname>, the
- <quote>name</quote> of the file referenced by the symbolic link named
- <filename class="symlink">/etc/malloc.conf</filename>, and the value of the
- environment variable <envar>MALLOC_CONF</envar>, will be interpreted, in
- that order, from left to right as options. Note that
- <varname>malloc_conf</varname> may be read before
- <function>main()</function> is entered, so the declaration of
- <varname>malloc_conf</varname> should specify an initializer that contains
- the final value to be read by jemalloc. <option>--with-malloc-conf</option>
- and <varname>malloc_conf</varname> are compile-time mechanisms, whereas
- <filename class="symlink">/etc/malloc.conf</filename> and
- <envar>MALLOC_CONF</envar> can be safely set any time prior to program
- invocation.</para>
-
- <para>An options string is a comma-separated list of option:value pairs.
- There is one key corresponding to each <link
- linkend="opt.abort"><mallctl>opt.*</mallctl></link> mallctl (see the <xref
- linkend="mallctl_namespace" xrefstyle="template:%t"/> section for options
- documentation). For example, <literal>abort:true,narenas:1</literal> sets
- the <link linkend="opt.abort"><mallctl>opt.abort</mallctl></link> and <link
- linkend="opt.narenas"><mallctl>opt.narenas</mallctl></link> options. Some
- options have boolean values (true/false), others have integer values (base
- 8, 10, or 16, depending on prefix), and yet others have raw string
- values.</para>
- </refsect1>
- <refsect1 id="implementation_notes">
- <title>IMPLEMENTATION NOTES</title>
- <para>Traditionally, allocators have used
- <citerefentry><refentrytitle>sbrk</refentrytitle>
- <manvolnum>2</manvolnum></citerefentry> to obtain memory, which is
- suboptimal for several reasons, including race conditions, increased
- fragmentation, and artificial limitations on maximum usable memory. If
- <citerefentry><refentrytitle>sbrk</refentrytitle>
- <manvolnum>2</manvolnum></citerefentry> is supported by the operating
- system, this allocator uses both
- <citerefentry><refentrytitle>mmap</refentrytitle>
- <manvolnum>2</manvolnum></citerefentry> and
- <citerefentry><refentrytitle>sbrk</refentrytitle>
- <manvolnum>2</manvolnum></citerefentry>, in that order of preference;
- otherwise only <citerefentry><refentrytitle>mmap</refentrytitle>
- <manvolnum>2</manvolnum></citerefentry> is used.</para>
-
- <para>This allocator uses multiple arenas in order to reduce lock
- contention for threaded programs on multi-processor systems. This works
- well with regard to threading scalability, but incurs some costs. There is
- a small fixed per-arena overhead, and additionally, arenas manage memory
- completely independently of each other, which means a small fixed increase
- in overall memory fragmentation. These overheads are not generally an
- issue, given the number of arenas normally used. Note that using
- substantially more arenas than the default is not likely to improve
- performance, mainly due to reduced cache performance. However, it may make
- sense to reduce the number of arenas if an application does not make much
- use of the allocation functions.</para>
-
- <para>In addition to multiple arenas, unless
- <option>--disable-tcache</option> is specified during configuration, this
- allocator supports thread-specific caching for small and large objects, in
- order to make it possible to completely avoid synchronization for most
- allocation requests. Such caching allows very fast allocation in the
- common case, but it increases memory usage and fragmentation, since a
- bounded number of objects can remain allocated in each thread cache.</para>
-
- <para>Memory is conceptually broken into equal-sized chunks, where the chunk
- size is a power of two that is greater than the page size. Chunks are
- always aligned to multiples of the chunk size. This alignment makes it
- possible to find metadata for user objects very quickly. User objects are
- broken into three categories according to size: small, large, and huge.
- Multiple small and large objects can reside within a single chunk, whereas
- huge objects each have one or more chunks backing them. Each chunk that
- contains small and/or large objects tracks its contents as runs of
- contiguous pages (unused, backing a set of small objects, or backing one
- large object). The combination of chunk alignment and chunk page maps makes
- it possible to determine all metadata regarding small and large allocations
- in constant time.</para>
-
- <para>Small objects are managed in groups by page runs. Each run maintains
- a bitmap to track which regions are in use. Allocation requests that are no
- more than half the quantum (8 or 16, depending on architecture) are rounded
- up to the nearest power of two that is at least <code
- language="C">sizeof(<type>double</type>)</code>. All other object size
- classes are multiples of the quantum, spaced such that there are four size
- classes for each doubling in size, which limits internal fragmentation to
- approximately 20% for all but the smallest size classes. Small size classes
- are smaller than four times the page size, large size classes are smaller
- than the chunk size (see the <link
- linkend="opt.lg_chunk"><mallctl>opt.lg_chunk</mallctl></link> option), and
- huge size classes extend from the chunk size up to the largest size class
- that does not exceed <constant>PTRDIFF_MAX</constant>.</para>
-
- <para>Allocations are packed tightly together, which can be an issue for
- multi-threaded applications. If you need to assure that allocations do not
- suffer from cacheline sharing, round your allocation requests up to the
- nearest multiple of the cacheline size, or specify cacheline alignment when
- allocating.</para>
-
- <para>The <function>realloc()</function>,
- <function>rallocx()</function>, and
- <function>xallocx()</function> functions may resize allocations
- without moving them under limited circumstances. Unlike the
- <function>*allocx()</function> API, the standard API does not
- officially round up the usable size of an allocation to the nearest size
- class, so technically it is necessary to call
- <function>realloc()</function> to grow e.g. a 9-byte allocation to
- 16 bytes, or shrink a 16-byte allocation to 9 bytes. Growth and shrinkage
- trivially succeeds in place as long as the pre-size and post-size both round
- up to the same size class. No other API guarantees are made regarding
- in-place resizing, but the current implementation also tries to resize large
- and huge allocations in place, as long as the pre-size and post-size are
- both large or both huge. In such cases shrinkage always succeeds for large
- size classes, but for huge size classes the chunk allocator must support
- splitting (see <link
- linkend="arena.i.chunk_hooks"><mallctl>arena.&lt;i&gt;.chunk_hooks</mallctl></link>).
- Growth only succeeds if the trailing memory is currently available, and
- additionally for huge size classes the chunk allocator must support
- merging.</para>
-
- <para>Assuming 2 MiB chunks, 4 KiB pages, and a 16-byte quantum on a
- 64-bit system, the size classes in each category are as shown in <xref
- linkend="size_classes" xrefstyle="template:Table %n"/>.</para>
-
- <table xml:id="size_classes" frame="all">
- <title>Size classes</title>
- <tgroup cols="3" colsep="1" rowsep="1">
- <colspec colname="c1" align="left"/>
- <colspec colname="c2" align="right"/>
- <colspec colname="c3" align="left"/>
- <thead>
- <row>
- <entry>Category</entry>
- <entry>Spacing</entry>
- <entry>Size</entry>
- </row>
- </thead>
- <tbody>
- <row>
- <entry morerows="8">Small</entry>
- <entry>lg</entry>
- <entry>[8]</entry>
- </row>
- <row>
- <entry>16</entry>
- <entry>[16, 32, 48, 64, 80, 96, 112, 128]</entry>
- </row>
- <row>
- <entry>32</entry>
- <entry>[160, 192, 224, 256]</entry>
- </row>
- <row>
- <entry>64</entry>
- <entry>[320, 384, 448, 512]</entry>
- </row>
- <row>
- <entry>128</entry>
- <entry>[640, 768, 896, 1024]</entry>
- </row>
- <row>
- <entry>256</entry>
- <entry>[1280, 1536, 1792, 2048]</entry>
- </row>
- <row>
- <entry>512</entry>
- <entry>[2560, 3072, 3584, 4096]</entry>
- </row>
- <row>
- <entry>1 KiB</entry>
- <entry>[5 KiB, 6 KiB, 7 KiB, 8 KiB]</entry>
- </row>
- <row>
- <entry>2 KiB</entry>
- <entry>[10 KiB, 12 KiB, 14 KiB]</entry>
- </row>
- <row>
- <entry morerows="7">Large</entry>
- <entry>2 KiB</entry>
- <entry>[16 KiB]</entry>
- </row>
- <row>
- <entry>4 KiB</entry>
- <entry>[20 KiB, 24 KiB, 28 KiB, 32 KiB]</entry>
- </row>
- <row>
- <entry>8 KiB</entry>
- <entry>[40 KiB, 48 KiB, 54 KiB, 64 KiB]</entry>
- </row>
- <row>
- <entry>16 KiB</entry>
- <entry>[80 KiB, 96 KiB, 112 KiB, 128 KiB]</entry>
- </row>
- <row>
- <entry>32 KiB</entry>
- <entry>[160 KiB, 192 KiB, 224 KiB, 256 KiB]</entry>
- </row>
- <row>
- <entry>64 KiB</entry>
- <entry>[320 KiB, 384 KiB, 448 KiB, 512 KiB]</entry>
- </row>
- <row>
- <entry>128 KiB</entry>
- <entry>[640 KiB, 768 KiB, 896 KiB, 1 MiB]</entry>
- </row>
- <row>
- <entry>256 KiB</entry>
- <entry>[1280 KiB, 1536 KiB, 1792 KiB]</entry>
- </row>
- <row>
- <entry morerows="8">Huge</entry>
- <entry>256 KiB</entry>
- <entry>[2 MiB]</entry>
- </row>
- <row>
- <entry>512 KiB</entry>
- <entry>[2560 KiB, 3 MiB, 3584 KiB, 4 MiB]</entry>
- </row>
- <row>
- <entry>1 MiB</entry>
- <entry>[5 MiB, 6 MiB, 7 MiB, 8 MiB]</entry>
- </row>
- <row>
- <entry>2 MiB</entry>
- <entry>[10 MiB, 12 MiB, 14 MiB, 16 MiB]</entry>
- </row>
- <row>
- <entry>4 MiB</entry>
- <entry>[20 MiB, 24 MiB, 28 MiB, 32 MiB]</entry>
- </row>
- <row>
- <entry>8 MiB</entry>
- <entry>[40 MiB, 48 MiB, 56 MiB, 64 MiB]</entry>
- </row>
- <row>
- <entry>...</entry>
- <entry>...</entry>
- </row>
- <row>
- <entry>512 PiB</entry>
- <entry>[2560 PiB, 3 EiB, 3584 PiB, 4 EiB]</entry>
- </row>
- <row>
- <entry>1 EiB</entry>
- <entry>[5 EiB, 6 EiB, 7 EiB]</entry>
- </row>
- </tbody>
- </tgroup>
- </table>
- </refsect1>
- <refsect1 id="mallctl_namespace">
- <title>MALLCTL NAMESPACE</title>
- <para>The following names are defined in the namespace accessible via the
- <function>mallctl*()</function> functions. Value types are
- specified in parentheses, their readable/writable statuses are encoded as
- <literal>rw</literal>, <literal>r-</literal>, <literal>-w</literal>, or
- <literal>--</literal>, and required build configuration flags follow, if
- any. A name element encoded as <literal>&lt;i&gt;</literal> or
- <literal>&lt;j&gt;</literal> indicates an integer component, where the
- integer varies from 0 to some upper value that must be determined via
- introspection. In the case of <mallctl>stats.arenas.&lt;i&gt;.*</mallctl>,
- <literal>&lt;i&gt;</literal> equal to <link
- linkend="arenas.narenas"><mallctl>arenas.narenas</mallctl></link> can be
- used to access the summation of statistics from all arenas. Take special
- note of the <link linkend="epoch"><mallctl>epoch</mallctl></link> mallctl,
- which controls refreshing of cached dynamic statistics.</para>
-
- <variablelist>
- <varlistentry id="version">
- <term>
- <mallctl>version</mallctl>
- (<type>const char *</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>Return the jemalloc version string.</para></listitem>
- </varlistentry>
-
- <varlistentry id="epoch">
- <term>
- <mallctl>epoch</mallctl>
- (<type>uint64_t</type>)
- <literal>rw</literal>
- </term>
- <listitem><para>If a value is passed in, refresh the data from which
- the <function>mallctl*()</function> functions report values,
- and increment the epoch. Return the current epoch. This is useful for
- detecting whether another thread caused a refresh.</para></listitem>
- </varlistentry>
-
- <varlistentry id="config.cache_oblivious">
- <term>
- <mallctl>config.cache_oblivious</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- </term>
- <listitem><para><option>--enable-cache-oblivious</option> was specified
- during build configuration.</para></listitem>
- </varlistentry>
-
- <varlistentry id="config.debug">
- <term>
- <mallctl>config.debug</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- </term>
- <listitem><para><option>--enable-debug</option> was specified during
- build configuration.</para></listitem>
- </varlistentry>
-
- <varlistentry id="config.fill">
- <term>
- <mallctl>config.fill</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- </term>
- <listitem><para><option>--enable-fill</option> was specified during
- build configuration.</para></listitem>
- </varlistentry>
-
- <varlistentry id="config.lazy_lock">
- <term>
- <mallctl>config.lazy_lock</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- </term>
- <listitem><para><option>--enable-lazy-lock</option> was specified
- during build configuration.</para></listitem>
- </varlistentry>
-
- <varlistentry id="config.malloc_conf">
- <term>
- <mallctl>config.malloc_conf</mallctl>
- (<type>const char *</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>Embedded configure-time-specified run-time options
- string, empty unless <option>--with-malloc-conf</option> was specified
- during build configuration.</para></listitem>
- </varlistentry>
-
- <varlistentry id="config.munmap">
- <term>
- <mallctl>config.munmap</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- </term>
- <listitem><para><option>--enable-munmap</option> was specified during
- build configuration.</para></listitem>
- </varlistentry>
-
- <varlistentry id="config.prof">
- <term>
- <mallctl>config.prof</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- </term>
- <listitem><para><option>--enable-prof</option> was specified during
- build configuration.</para></listitem>
- </varlistentry>
-
- <varlistentry id="config.prof_libgcc">
- <term>
- <mallctl>config.prof_libgcc</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- </term>
- <listitem><para><option>--disable-prof-libgcc</option> was not
- specified during build configuration.</para></listitem>
- </varlistentry>
-
- <varlistentry id="config.prof_libunwind">
- <term>
- <mallctl>config.prof_libunwind</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- </term>
- <listitem><para><option>--enable-prof-libunwind</option> was specified
- during build configuration.</para></listitem>
- </varlistentry>
-
- <varlistentry id="config.stats">
- <term>
- <mallctl>config.stats</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- </term>
- <listitem><para><option>--enable-stats</option> was specified during
- build configuration.</para></listitem>
- </varlistentry>
-
- <varlistentry id="config.tcache">
- <term>
- <mallctl>config.tcache</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- </term>
- <listitem><para><option>--disable-tcache</option> was not specified
- during build configuration.</para></listitem>
- </varlistentry>
-
- <varlistentry id="config.tls">
- <term>
- <mallctl>config.tls</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- </term>
- <listitem><para><option>--disable-tls</option> was not specified during
- build configuration.</para></listitem>
- </varlistentry>
-
- <varlistentry id="config.utrace">
- <term>
- <mallctl>config.utrace</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- </term>
- <listitem><para><option>--enable-utrace</option> was specified during
- build configuration.</para></listitem>
- </varlistentry>
-
- <varlistentry id="config.valgrind">
- <term>
- <mallctl>config.valgrind</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- </term>
- <listitem><para><option>--enable-valgrind</option> was specified during
- build configuration.</para></listitem>
- </varlistentry>
-
- <varlistentry id="config.xmalloc">
- <term>
- <mallctl>config.xmalloc</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- </term>
- <listitem><para><option>--enable-xmalloc</option> was specified during
- build configuration.</para></listitem>
- </varlistentry>
-
- <varlistentry id="opt.abort">
- <term>
- <mallctl>opt.abort</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>Abort-on-warning enabled/disabled. If true, most
- warnings are fatal. The process will call
- <citerefentry><refentrytitle>abort</refentrytitle>
- <manvolnum>3</manvolnum></citerefentry> in these cases. This option is
- disabled by default unless <option>--enable-debug</option> is
- specified during configuration, in which case it is enabled by default.
- </para></listitem>
- </varlistentry>
-
- <varlistentry id="opt.dss">
- <term>
- <mallctl>opt.dss</mallctl>
- (<type>const char *</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>dss (<citerefentry><refentrytitle>sbrk</refentrytitle>
- <manvolnum>2</manvolnum></citerefentry>) allocation precedence as
- related to <citerefentry><refentrytitle>mmap</refentrytitle>
- <manvolnum>2</manvolnum></citerefentry> allocation. The following
- settings are supported if
- <citerefentry><refentrytitle>sbrk</refentrytitle>
- <manvolnum>2</manvolnum></citerefentry> is supported by the operating
- system: <quote>disabled</quote>, <quote>primary</quote>, and
- <quote>secondary</quote>; otherwise only <quote>disabled</quote> is
- supported. The default is <quote>secondary</quote> if
- <citerefentry><refentrytitle>sbrk</refentrytitle>
- <manvolnum>2</manvolnum></citerefentry> is supported by the operating
- system; <quote>disabled</quote> otherwise.
- </para></listitem>
- </varlistentry>
-
- <varlistentry id="opt.lg_chunk">
- <term>
- <mallctl>opt.lg_chunk</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>Virtual memory chunk size (log base 2). If a chunk
- size outside the supported size range is specified, the size is
- silently clipped to the minimum/maximum supported size. The default
- chunk size is 2 MiB (2^21).
- </para></listitem>
- </varlistentry>
-
- <varlistentry id="opt.narenas">
- <term>
- <mallctl>opt.narenas</mallctl>
- (<type>unsigned</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>Maximum number of arenas to use for automatic
- multiplexing of threads and arenas. The default is four times the
- number of CPUs, or one if there is a single CPU.</para></listitem>
- </varlistentry>
-
- <varlistentry id="opt.purge">
- <term>
- <mallctl>opt.purge</mallctl>
- (<type>const char *</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>Purge mode is &ldquo;ratio&rdquo; (default) or
- &ldquo;decay&rdquo;. See <link
- linkend="opt.lg_dirty_mult"><mallctl>opt.lg_dirty_mult</mallctl></link>
- for details of the ratio mode. See <link
- linkend="opt.decay_time"><mallctl>opt.decay_time</mallctl></link> for
- details of the decay mode.</para></listitem>
- </varlistentry>
-
- <varlistentry id="opt.lg_dirty_mult">
- <term>
- <mallctl>opt.lg_dirty_mult</mallctl>
- (<type>ssize_t</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>Per-arena minimum ratio (log base 2) of active to dirty
- pages. Some dirty unused pages may be allowed to accumulate, within
- the limit set by the ratio (or one chunk worth of dirty pages,
- whichever is greater), before informing the kernel about some of those
- pages via <citerefentry><refentrytitle>madvise</refentrytitle>
- <manvolnum>2</manvolnum></citerefentry> or a similar system call. This
- provides the kernel with sufficient information to recycle dirty pages
- if physical memory becomes scarce and the pages remain unused. The
- default minimum ratio is 8:1 (2^3:1); an option value of -1 will
- disable dirty page purging. See <link
- linkend="arenas.lg_dirty_mult"><mallctl>arenas.lg_dirty_mult</mallctl></link>
- and <link
- linkend="arena.i.lg_dirty_mult"><mallctl>arena.&lt;i&gt;.lg_dirty_mult</mallctl></link>
- for related dynamic control options.</para></listitem>
- </varlistentry>
-
- <varlistentry id="opt.decay_time">
- <term>
- <mallctl>opt.decay_time</mallctl>
- (<type>ssize_t</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>Approximate time in seconds from the creation of a set
- of unused dirty pages until an equivalent set of unused dirty pages is
- purged and/or reused. The pages are incrementally purged according to a
- sigmoidal decay curve that starts and ends with zero purge rate. A
- decay time of 0 causes all unused dirty pages to be purged immediately
- upon creation. A decay time of -1 disables purging. The default decay
- time is 10 seconds. See <link
- linkend="arenas.decay_time"><mallctl>arenas.decay_time</mallctl></link>
- and <link
- linkend="arena.i.decay_time"><mallctl>arena.&lt;i&gt;.decay_time</mallctl></link>
- for related dynamic control options.
- </para></listitem>
- </varlistentry>
-
- <varlistentry id="opt.stats_print">
- <term>
- <mallctl>opt.stats_print</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>Enable/disable statistics printing at exit. If
- enabled, the <function>malloc_stats_print()</function>
- function is called at program exit via an
- <citerefentry><refentrytitle>atexit</refentrytitle>
- <manvolnum>3</manvolnum></citerefentry> function. If
- <option>--enable-stats</option> is specified during configuration, this
- has the potential to cause deadlock for a multi-threaded process that
- exits while one or more threads are executing in the memory allocation
- functions. Furthermore, <function>atexit()</function> may
- allocate memory during application initialization and then deadlock
- internally when jemalloc in turn calls
- <function>atexit()</function>, so this option is not
- universally usable (though the application can register its own
- <function>atexit()</function> function with equivalent
- functionality). Therefore, this option should only be used with care;
- it is primarily intended as a performance tuning aid during application
- development. This option is disabled by default.</para></listitem>
- </varlistentry>
-
- <varlistentry id="opt.junk">
- <term>
- <mallctl>opt.junk</mallctl>
- (<type>const char *</type>)
- <literal>r-</literal>
- [<option>--enable-fill</option>]
- </term>
- <listitem><para>Junk filling. If set to <quote>alloc</quote>, each byte
- of uninitialized allocated memory will be initialized to
- <literal>0xa5</literal>. If set to <quote>free</quote>, all deallocated
- memory will be initialized to <literal>0x5a</literal>. If set to
- <quote>true</quote>, both allocated and deallocated memory will be
- initialized, and if set to <quote>false</quote>, junk filling be
- disabled entirely. This is intended for debugging and will impact
- performance negatively. This option is <quote>false</quote> by default
- unless <option>--enable-debug</option> is specified during
- configuration, in which case it is <quote>true</quote> by default unless
- running inside <ulink
- url="http://valgrind.org/">Valgrind</ulink>.</para></listitem>
- </varlistentry>
-
- <varlistentry id="opt.quarantine">
- <term>
- <mallctl>opt.quarantine</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- [<option>--enable-fill</option>]
- </term>
- <listitem><para>Per thread quarantine size in bytes. If non-zero, each
- thread maintains a FIFO object quarantine that stores up to the
- specified number of bytes of memory. The quarantined memory is not
- freed until it is released from quarantine, though it is immediately
- junk-filled if the <link
- linkend="opt.junk"><mallctl>opt.junk</mallctl></link> option is
- enabled. This feature is of particular use in combination with <ulink
- url="http://valgrind.org/">Valgrind</ulink>, which can detect attempts
- to access quarantined objects. This is intended for debugging and will
- impact performance negatively. The default quarantine size is 0 unless
- running inside Valgrind, in which case the default is 16
- MiB.</para></listitem>
- </varlistentry>
-
- <varlistentry id="opt.redzone">
- <term>
- <mallctl>opt.redzone</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- [<option>--enable-fill</option>]
- </term>
- <listitem><para>Redzones enabled/disabled. If enabled, small
- allocations have redzones before and after them. Furthermore, if the
- <link linkend="opt.junk"><mallctl>opt.junk</mallctl></link> option is
- enabled, the redzones are checked for corruption during deallocation.
- However, the primary intended purpose of this feature is to be used in
- combination with <ulink url="http://valgrind.org/">Valgrind</ulink>,
- which needs redzones in order to do effective buffer overflow/underflow
- detection. This option is intended for debugging and will impact
- performance negatively. This option is disabled by
- default unless running inside Valgrind.</para></listitem>
- </varlistentry>
-
- <varlistentry id="opt.zero">
- <term>
- <mallctl>opt.zero</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- [<option>--enable-fill</option>]
- </term>
- <listitem><para>Zero filling enabled/disabled. If enabled, each byte
- of uninitialized allocated memory will be initialized to 0. Note that
- this initialization only happens once for each byte, so
- <function>realloc()</function> and
- <function>rallocx()</function> calls do not zero memory that
- was previously allocated. This is intended for debugging and will
- impact performance negatively. This option is disabled by default.
- </para></listitem>
- </varlistentry>
-
- <varlistentry id="opt.utrace">
- <term>
- <mallctl>opt.utrace</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- [<option>--enable-utrace</option>]
- </term>
- <listitem><para>Allocation tracing based on
- <citerefentry><refentrytitle>utrace</refentrytitle>
- <manvolnum>2</manvolnum></citerefentry> enabled/disabled. This option
- is disabled by default.</para></listitem>
- </varlistentry>
-
- <varlistentry id="opt.xmalloc">
- <term>
- <mallctl>opt.xmalloc</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- [<option>--enable-xmalloc</option>]
- </term>
- <listitem><para>Abort-on-out-of-memory enabled/disabled. If enabled,
- rather than returning failure for any allocation function, display a
- diagnostic message on <constant>STDERR_FILENO</constant> and cause the
- program to drop core (using
- <citerefentry><refentrytitle>abort</refentrytitle>
- <manvolnum>3</manvolnum></citerefentry>). If an application is
- designed to depend on this behavior, set the option at compile time by
- including the following in the source code:
- <programlisting language="C"><![CDATA[
-malloc_conf = "xmalloc:true";]]></programlisting>
- This option is disabled by default.</para></listitem>
- </varlistentry>
-
- <varlistentry id="opt.tcache">
- <term>
- <mallctl>opt.tcache</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- [<option>--enable-tcache</option>]
- </term>
- <listitem><para>Thread-specific caching (tcache) enabled/disabled. When
- there are multiple threads, each thread uses a tcache for objects up to
- a certain size. Thread-specific caching allows many allocations to be
- satisfied without performing any thread synchronization, at the cost of
- increased memory use. See the <link
- linkend="opt.lg_tcache_max"><mallctl>opt.lg_tcache_max</mallctl></link>
- option for related tuning information. This option is enabled by
- default unless running inside <ulink
- url="http://valgrind.org/">Valgrind</ulink>, in which case it is
- forcefully disabled.</para></listitem>
- </varlistentry>
-
- <varlistentry id="opt.lg_tcache_max">
- <term>
- <mallctl>opt.lg_tcache_max</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- [<option>--enable-tcache</option>]
- </term>
- <listitem><para>Maximum size class (log base 2) to cache in the
- thread-specific cache (tcache). At a minimum, all small size classes
- are cached, and at a maximum all large size classes are cached. The
- default maximum is 32 KiB (2^15).</para></listitem>
- </varlistentry>
-
- <varlistentry id="opt.prof">
- <term>
- <mallctl>opt.prof</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- [<option>--enable-prof</option>]
- </term>
- <listitem><para>Memory profiling enabled/disabled. If enabled, profile
- memory allocation activity. See the <link
- linkend="opt.prof_active"><mallctl>opt.prof_active</mallctl></link>
- option for on-the-fly activation/deactivation. See the <link
- linkend="opt.lg_prof_sample"><mallctl>opt.lg_prof_sample</mallctl></link>
- option for probabilistic sampling control. See the <link
- linkend="opt.prof_accum"><mallctl>opt.prof_accum</mallctl></link>
- option for control of cumulative sample reporting. See the <link
- linkend="opt.lg_prof_interval"><mallctl>opt.lg_prof_interval</mallctl></link>
- option for information on interval-triggered profile dumping, the <link
- linkend="opt.prof_gdump"><mallctl>opt.prof_gdump</mallctl></link>
- option for information on high-water-triggered profile dumping, and the
- <link linkend="opt.prof_final"><mallctl>opt.prof_final</mallctl></link>
- option for final profile dumping. Profile output is compatible with
- the <command>jeprof</command> command, which is based on the
- <command>pprof</command> that is developed as part of the <ulink
- url="http://code.google.com/p/gperftools/">gperftools
- package</ulink>. See <link linkend="heap_profile_format">HEAP PROFILE
- FORMAT</link> for heap profile format documentation.</para></listitem>
- </varlistentry>
-
- <varlistentry id="opt.prof_prefix">
- <term>
- <mallctl>opt.prof_prefix</mallctl>
- (<type>const char *</type>)
- <literal>r-</literal>
- [<option>--enable-prof</option>]
- </term>
- <listitem><para>Filename prefix for profile dumps. If the prefix is
- set to the empty string, no automatic dumps will occur; this is
- primarily useful for disabling the automatic final heap dump (which
- also disables leak reporting, if enabled). The default prefix is
- <filename>jeprof</filename>.</para></listitem>
- </varlistentry>
-
- <varlistentry id="opt.prof_active">
- <term>
- <mallctl>opt.prof_active</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- [<option>--enable-prof</option>]
- </term>
- <listitem><para>Profiling activated/deactivated. This is a secondary
- control mechanism that makes it possible to start the application with
- profiling enabled (see the <link
- linkend="opt.prof"><mallctl>opt.prof</mallctl></link> option) but
- inactive, then toggle profiling at any time during program execution
- with the <link
- linkend="prof.active"><mallctl>prof.active</mallctl></link> mallctl.
- This option is enabled by default.</para></listitem>
- </varlistentry>
-
- <varlistentry id="opt.prof_thread_active_init">
- <term>
- <mallctl>opt.prof_thread_active_init</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- [<option>--enable-prof</option>]
- </term>
- <listitem><para>Initial setting for <link
- linkend="thread.prof.active"><mallctl>thread.prof.active</mallctl></link>
- in newly created threads. The initial setting for newly created threads
- can also be changed during execution via the <link
- linkend="prof.thread_active_init"><mallctl>prof.thread_active_init</mallctl></link>
- mallctl. This option is enabled by default.</para></listitem>
- </varlistentry>
-
- <varlistentry id="opt.lg_prof_sample">
- <term>
- <mallctl>opt.lg_prof_sample</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- [<option>--enable-prof</option>]
- </term>
- <listitem><para>Average interval (log base 2) between allocation
- samples, as measured in bytes of allocation activity. Increasing the
- sampling interval decreases profile fidelity, but also decreases the
- computational overhead. The default sample interval is 512 KiB (2^19
- B).</para></listitem>
- </varlistentry>
-
- <varlistentry id="opt.prof_accum">
- <term>
- <mallctl>opt.prof_accum</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- [<option>--enable-prof</option>]
- </term>
- <listitem><para>Reporting of cumulative object/byte counts in profile
- dumps enabled/disabled. If this option is enabled, every unique
- backtrace must be stored for the duration of execution. Depending on
- the application, this can impose a large memory overhead, and the
- cumulative counts are not always of interest. This option is disabled
- by default.</para></listitem>
- </varlistentry>
-
- <varlistentry id="opt.lg_prof_interval">
- <term>
- <mallctl>opt.lg_prof_interval</mallctl>
- (<type>ssize_t</type>)
- <literal>r-</literal>
- [<option>--enable-prof</option>]
- </term>
- <listitem><para>Average interval (log base 2) between memory profile
- dumps, as measured in bytes of allocation activity. The actual
- interval between dumps may be sporadic because decentralized allocation
- counters are used to avoid synchronization bottlenecks. Profiles are
- dumped to files named according to the pattern
- <filename>&lt;prefix&gt;.&lt;pid&gt;.&lt;seq&gt;.i&lt;iseq&gt;.heap</filename>,
- where <literal>&lt;prefix&gt;</literal> is controlled by the
- <link
- linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link>
- option. By default, interval-triggered profile dumping is disabled
- (encoded as -1).
- </para></listitem>
- </varlistentry>
-
- <varlistentry id="opt.prof_gdump">
- <term>
- <mallctl>opt.prof_gdump</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- [<option>--enable-prof</option>]
- </term>
- <listitem><para>Set the initial state of <link
- linkend="prof.gdump"><mallctl>prof.gdump</mallctl></link>, which when
- enabled triggers a memory profile dump every time the total virtual
- memory exceeds the previous maximum. This option is disabled by
- default.</para></listitem>
- </varlistentry>
-
- <varlistentry id="opt.prof_final">
- <term>
- <mallctl>opt.prof_final</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- [<option>--enable-prof</option>]
- </term>
- <listitem><para>Use an
- <citerefentry><refentrytitle>atexit</refentrytitle>
- <manvolnum>3</manvolnum></citerefentry> function to dump final memory
- usage to a file named according to the pattern
- <filename>&lt;prefix&gt;.&lt;pid&gt;.&lt;seq&gt;.f.heap</filename>,
- where <literal>&lt;prefix&gt;</literal> is controlled by the <link
- linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link>
- option. Note that <function>atexit()</function> may allocate
- memory during application initialization and then deadlock internally
- when jemalloc in turn calls <function>atexit()</function>, so
- this option is not universally usable (though the application can
- register its own <function>atexit()</function> function with
- equivalent functionality). This option is disabled by
- default.</para></listitem>
- </varlistentry>
-
- <varlistentry id="opt.prof_leak">
- <term>
- <mallctl>opt.prof_leak</mallctl>
- (<type>bool</type>)
- <literal>r-</literal>
- [<option>--enable-prof</option>]
- </term>
- <listitem><para>Leak reporting enabled/disabled. If enabled, use an
- <citerefentry><refentrytitle>atexit</refentrytitle>
- <manvolnum>3</manvolnum></citerefentry> function to report memory leaks
- detected by allocation sampling. See the
- <link linkend="opt.prof"><mallctl>opt.prof</mallctl></link> option for
- information on analyzing heap profile output. This option is disabled
- by default.</para></listitem>
- </varlistentry>
-
- <varlistentry id="thread.arena">
- <term>
- <mallctl>thread.arena</mallctl>
- (<type>unsigned</type>)
- <literal>rw</literal>
- </term>
- <listitem><para>Get or set the arena associated with the calling
- thread. If the specified arena was not initialized beforehand (see the
- <link
- linkend="arenas.initialized"><mallctl>arenas.initialized</mallctl></link>
- mallctl), it will be automatically initialized as a side effect of
- calling this interface.</para></listitem>
- </varlistentry>
-
- <varlistentry id="thread.allocated">
- <term>
- <mallctl>thread.allocated</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Get the total number of bytes ever allocated by the
- calling thread. This counter has the potential to wrap around; it is
- up to the application to appropriately interpret the counter in such
- cases.</para></listitem>
- </varlistentry>
-
- <varlistentry id="thread.allocatedp">
- <term>
- <mallctl>thread.allocatedp</mallctl>
- (<type>uint64_t *</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Get a pointer to the the value that is returned by the
- <link
- linkend="thread.allocated"><mallctl>thread.allocated</mallctl></link>
- mallctl. This is useful for avoiding the overhead of repeated
- <function>mallctl*()</function> calls.</para></listitem>
- </varlistentry>
-
- <varlistentry id="thread.deallocated">
- <term>
- <mallctl>thread.deallocated</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Get the total number of bytes ever deallocated by the
- calling thread. This counter has the potential to wrap around; it is
- up to the application to appropriately interpret the counter in such
- cases.</para></listitem>
- </varlistentry>
-
- <varlistentry id="thread.deallocatedp">
- <term>
- <mallctl>thread.deallocatedp</mallctl>
- (<type>uint64_t *</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Get a pointer to the the value that is returned by the
- <link
- linkend="thread.deallocated"><mallctl>thread.deallocated</mallctl></link>
- mallctl. This is useful for avoiding the overhead of repeated
- <function>mallctl*()</function> calls.</para></listitem>
- </varlistentry>
-
- <varlistentry id="thread.tcache.enabled">
- <term>
- <mallctl>thread.tcache.enabled</mallctl>
- (<type>bool</type>)
- <literal>rw</literal>
- [<option>--enable-tcache</option>]
- </term>
- <listitem><para>Enable/disable calling thread's tcache. The tcache is
- implicitly flushed as a side effect of becoming
- disabled (see <link
- linkend="thread.tcache.flush"><mallctl>thread.tcache.flush</mallctl></link>).
- </para></listitem>
- </varlistentry>
-
- <varlistentry id="thread.tcache.flush">
- <term>
- <mallctl>thread.tcache.flush</mallctl>
- (<type>void</type>)
- <literal>--</literal>
- [<option>--enable-tcache</option>]
- </term>
- <listitem><para>Flush calling thread's thread-specific cache (tcache).
- This interface releases all cached objects and internal data structures
- associated with the calling thread's tcache. Ordinarily, this interface
- need not be called, since automatic periodic incremental garbage
- collection occurs, and the thread cache is automatically discarded when
- a thread exits. However, garbage collection is triggered by allocation
- activity, so it is possible for a thread that stops
- allocating/deallocating to retain its cache indefinitely, in which case
- the developer may find manual flushing useful.</para></listitem>
- </varlistentry>
-
- <varlistentry id="thread.prof.name">
- <term>
- <mallctl>thread.prof.name</mallctl>
- (<type>const char *</type>)
- <literal>r-</literal> or
- <literal>-w</literal>
- [<option>--enable-prof</option>]
- </term>
- <listitem><para>Get/set the descriptive name associated with the calling
- thread in memory profile dumps. An internal copy of the name string is
- created, so the input string need not be maintained after this interface
- completes execution. The output string of this interface should be
- copied for non-ephemeral uses, because multiple implementation details
- can cause asynchronous string deallocation. Furthermore, each
- invocation of this interface can only read or write; simultaneous
- read/write is not supported due to string lifetime limitations. The
- name string must be nil-terminated and comprised only of characters in
- the sets recognized
- by <citerefentry><refentrytitle>isgraph</refentrytitle>
- <manvolnum>3</manvolnum></citerefentry> and
- <citerefentry><refentrytitle>isblank</refentrytitle>
- <manvolnum>3</manvolnum></citerefentry>.</para></listitem>
- </varlistentry>
-
- <varlistentry id="thread.prof.active">
- <term>
- <mallctl>thread.prof.active</mallctl>
- (<type>bool</type>)
- <literal>rw</literal>
- [<option>--enable-prof</option>]
- </term>
- <listitem><para>Control whether sampling is currently active for the
- calling thread. This is an activation mechanism in addition to <link
- linkend="prof.active"><mallctl>prof.active</mallctl></link>; both must
- be active for the calling thread to sample. This flag is enabled by
- default.</para></listitem>
- </varlistentry>
-
- <varlistentry id="tcache.create">
- <term>
- <mallctl>tcache.create</mallctl>
- (<type>unsigned</type>)
- <literal>r-</literal>
- [<option>--enable-tcache</option>]
- </term>
- <listitem><para>Create an explicit thread-specific cache (tcache) and
- return an identifier that can be passed to the <link
- linkend="MALLOCX_TCACHE"><constant>MALLOCX_TCACHE(<parameter>tc</parameter>)</constant></link>
- macro to explicitly use the specified cache rather than the
- automatically managed one that is used by default. Each explicit cache
- can be used by only one thread at a time; the application must assure
- that this constraint holds.
- </para></listitem>
- </varlistentry>
-
- <varlistentry id="tcache.flush">
- <term>
- <mallctl>tcache.flush</mallctl>
- (<type>unsigned</type>)
- <literal>-w</literal>
- [<option>--enable-tcache</option>]
- </term>
- <listitem><para>Flush the specified thread-specific cache (tcache). The
- same considerations apply to this interface as to <link
- linkend="thread.tcache.flush"><mallctl>thread.tcache.flush</mallctl></link>,
- except that the tcache will never be automatically discarded.
- </para></listitem>
- </varlistentry>
-
- <varlistentry id="tcache.destroy">
- <term>
- <mallctl>tcache.destroy</mallctl>
- (<type>unsigned</type>)
- <literal>-w</literal>
- [<option>--enable-tcache</option>]
- </term>
- <listitem><para>Flush the specified thread-specific cache (tcache) and
- make the identifier available for use during a future tcache creation.
- </para></listitem>
- </varlistentry>
-
- <varlistentry id="arena.i.purge">
- <term>
- <mallctl>arena.&lt;i&gt;.purge</mallctl>
- (<type>void</type>)
- <literal>--</literal>
- </term>
- <listitem><para>Purge all unused dirty pages for arena &lt;i&gt;, or for
- all arenas if &lt;i&gt; equals <link
- linkend="arenas.narenas"><mallctl>arenas.narenas</mallctl></link>.
- </para></listitem>
- </varlistentry>
-
- <varlistentry id="arena.i.decay">
- <term>
- <mallctl>arena.&lt;i&gt;.decay</mallctl>
- (<type>void</type>)
- <literal>--</literal>
- </term>
- <listitem><para>Trigger decay-based purging of unused dirty pages for
- arena &lt;i&gt;, or for all arenas if &lt;i&gt; equals <link
- linkend="arenas.narenas"><mallctl>arenas.narenas</mallctl></link>.
- The proportion of unused dirty pages to be purged depends on the current
- time; see <link
- linkend="opt.decay_time"><mallctl>opt.decay_time</mallctl></link> for
- details.</para></listitem>
- </varlistentry>
-
- <varlistentry id="arena.i.reset">
- <term>
- <mallctl>arena.&lt;i&gt;.reset</mallctl>
- (<type>void</type>)
- <literal>--</literal>
- </term>
- <listitem><para>Discard all of the arena's extant allocations. This
- interface can only be used with arenas created via <link
- linkend="arenas.extend"><mallctl>arenas.extend</mallctl></link>. None
- of the arena's discarded/cached allocations may accessed afterward. As
- part of this requirement, all thread caches which were used to
- allocate/deallocate in conjunction with the arena must be flushed
- beforehand. This interface cannot be used if running inside Valgrind,
- nor if the <link linkend="opt.quarantine">quarantine</link> size is
- non-zero.</para></listitem>
- </varlistentry>
-
- <varlistentry id="arena.i.dss">
- <term>
- <mallctl>arena.&lt;i&gt;.dss</mallctl>
- (<type>const char *</type>)
- <literal>rw</literal>
- </term>
- <listitem><para>Set the precedence of dss allocation as related to mmap
- allocation for arena &lt;i&gt;, or for all arenas if &lt;i&gt; equals
- <link
- linkend="arenas.narenas"><mallctl>arenas.narenas</mallctl></link>. See
- <link linkend="opt.dss"><mallctl>opt.dss</mallctl></link> for supported
- settings.</para></listitem>
- </varlistentry>
-
- <varlistentry id="arena.i.lg_dirty_mult">
- <term>
- <mallctl>arena.&lt;i&gt;.lg_dirty_mult</mallctl>
- (<type>ssize_t</type>)
- <literal>rw</literal>
- </term>
- <listitem><para>Current per-arena minimum ratio (log base 2) of active
- to dirty pages for arena &lt;i&gt;. Each time this interface is set and
- the ratio is increased, pages are synchronously purged as necessary to
- impose the new ratio. See <link
- linkend="opt.lg_dirty_mult"><mallctl>opt.lg_dirty_mult</mallctl></link>
- for additional information.</para></listitem>
- </varlistentry>
-
- <varlistentry id="arena.i.decay_time">
- <term>
- <mallctl>arena.&lt;i&gt;.decay_time</mallctl>
- (<type>ssize_t</type>)
- <literal>rw</literal>
- </term>
- <listitem><para>Current per-arena approximate time in seconds from the
- creation of a set of unused dirty pages until an equivalent set of
- unused dirty pages is purged and/or reused. Each time this interface is
- set, all currently unused dirty pages are considered to have fully
- decayed, which causes immediate purging of all unused dirty pages unless
- the decay time is set to -1 (i.e. purging disabled). See <link
- linkend="opt.decay_time"><mallctl>opt.decay_time</mallctl></link> for
- additional information.</para></listitem>
- </varlistentry>
-
- <varlistentry id="arena.i.chunk_hooks">
- <term>
- <mallctl>arena.&lt;i&gt;.chunk_hooks</mallctl>
- (<type>chunk_hooks_t</type>)
- <literal>rw</literal>
- </term>
- <listitem><para>Get or set the chunk management hook functions for arena
- &lt;i&gt;. The functions must be capable of operating on all extant
- chunks associated with arena &lt;i&gt;, usually by passing unknown
- chunks to the replaced functions. In practice, it is feasible to
- control allocation for arenas created via <link
- linkend="arenas.extend"><mallctl>arenas.extend</mallctl></link> such
- that all chunks originate from an application-supplied chunk allocator
- (by setting custom chunk hook functions just after arena creation), but
- the automatically created arenas may have already created chunks prior
- to the application having an opportunity to take over chunk
- allocation.</para>
-
- <programlisting language="C"><![CDATA[
-typedef struct {
- chunk_alloc_t *alloc;
- chunk_dalloc_t *dalloc;
- chunk_commit_t *commit;
- chunk_decommit_t *decommit;
- chunk_purge_t *purge;
- chunk_split_t *split;
- chunk_merge_t *merge;
-} chunk_hooks_t;]]></programlisting>
- <para>The <type>chunk_hooks_t</type> structure comprises function
- pointers which are described individually below. jemalloc uses these
- functions to manage chunk lifetime, which starts off with allocation of
- mapped committed memory, in the simplest case followed by deallocation.
- However, there are performance and platform reasons to retain chunks for
- later reuse. Cleanup attempts cascade from deallocation to decommit to
- purging, which gives the chunk management functions opportunities to
- reject the most permanent cleanup operations in favor of less permanent
- (and often less costly) operations. The chunk splitting and merging
- operations can also be opted out of, but this is mainly intended to
- support platforms on which virtual memory mappings provided by the
- operating system kernel do not automatically coalesce and split, e.g.
- Windows.</para>
-
- <funcsynopsis><funcprototype>
- <funcdef>typedef void *<function>(chunk_alloc_t)</function></funcdef>
- <paramdef>void *<parameter>chunk</parameter></paramdef>
- <paramdef>size_t <parameter>size</parameter></paramdef>
- <paramdef>size_t <parameter>alignment</parameter></paramdef>
- <paramdef>bool *<parameter>zero</parameter></paramdef>
- <paramdef>bool *<parameter>commit</parameter></paramdef>
- <paramdef>unsigned <parameter>arena_ind</parameter></paramdef>
- </funcprototype></funcsynopsis>
- <literallayout></literallayout>
- <para>A chunk allocation function conforms to the
- <type>chunk_alloc_t</type> type and upon success returns a pointer to
- <parameter>size</parameter> bytes of mapped memory on behalf of arena
- <parameter>arena_ind</parameter> such that the chunk's base address is a
- multiple of <parameter>alignment</parameter>, as well as setting
- <parameter>*zero</parameter> to indicate whether the chunk is zeroed and
- <parameter>*commit</parameter> to indicate whether the chunk is
- committed. Upon error the function returns <constant>NULL</constant>
- and leaves <parameter>*zero</parameter> and
- <parameter>*commit</parameter> unmodified. The
- <parameter>size</parameter> parameter is always a multiple of the chunk
- size. The <parameter>alignment</parameter> parameter is always a power
- of two at least as large as the chunk size. Zeroing is mandatory if
- <parameter>*zero</parameter> is true upon function entry. Committing is
- mandatory if <parameter>*commit</parameter> is true upon function entry.
- If <parameter>chunk</parameter> is not <constant>NULL</constant>, the
- returned pointer must be <parameter>chunk</parameter> on success or
- <constant>NULL</constant> on error. Committed memory may be committed
- in absolute terms as on a system that does not overcommit, or in
- implicit terms as on a system that overcommits and satisfies physical
- memory needs on demand via soft page faults. Note that replacing the
- default chunk allocation function makes the arena's <link
- linkend="arena.i.dss"><mallctl>arena.&lt;i&gt;.dss</mallctl></link>
- setting irrelevant.</para>
-
- <funcsynopsis><funcprototype>
- <funcdef>typedef bool <function>(chunk_dalloc_t)</function></funcdef>
- <paramdef>void *<parameter>chunk</parameter></paramdef>
- <paramdef>size_t <parameter>size</parameter></paramdef>
- <paramdef>bool <parameter>committed</parameter></paramdef>
- <paramdef>unsigned <parameter>arena_ind</parameter></paramdef>
- </funcprototype></funcsynopsis>
- <literallayout></literallayout>
- <para>
- A chunk deallocation function conforms to the
- <type>chunk_dalloc_t</type> type and deallocates a
- <parameter>chunk</parameter> of given <parameter>size</parameter> with
- <parameter>committed</parameter>/decommited memory as indicated, on
- behalf of arena <parameter>arena_ind</parameter>, returning false upon
- success. If the function returns true, this indicates opt-out from
- deallocation; the virtual memory mapping associated with the chunk
- remains mapped, in the same commit state, and available for future use,
- in which case it will be automatically retained for later reuse.</para>
-
- <funcsynopsis><funcprototype>
- <funcdef>typedef bool <function>(chunk_commit_t)</function></funcdef>
- <paramdef>void *<parameter>chunk</parameter></paramdef>
- <paramdef>size_t <parameter>size</parameter></paramdef>
- <paramdef>size_t <parameter>offset</parameter></paramdef>
- <paramdef>size_t <parameter>length</parameter></paramdef>
- <paramdef>unsigned <parameter>arena_ind</parameter></paramdef>
- </funcprototype></funcsynopsis>
- <literallayout></literallayout>
- <para>A chunk commit function conforms to the
- <type>chunk_commit_t</type> type and commits zeroed physical memory to
- back pages within a <parameter>chunk</parameter> of given
- <parameter>size</parameter> at <parameter>offset</parameter> bytes,
- extending for <parameter>length</parameter> on behalf of arena
- <parameter>arena_ind</parameter>, returning false upon success.
- Committed memory may be committed in absolute terms as on a system that
- does not overcommit, or in implicit terms as on a system that
- overcommits and satisfies physical memory needs on demand via soft page
- faults. If the function returns true, this indicates insufficient
- physical memory to satisfy the request.</para>
-
- <funcsynopsis><funcprototype>
- <funcdef>typedef bool <function>(chunk_decommit_t)</function></funcdef>
- <paramdef>void *<parameter>chunk</parameter></paramdef>
- <paramdef>size_t <parameter>size</parameter></paramdef>
- <paramdef>size_t <parameter>offset</parameter></paramdef>
- <paramdef>size_t <parameter>length</parameter></paramdef>
- <paramdef>unsigned <parameter>arena_ind</parameter></paramdef>
- </funcprototype></funcsynopsis>
- <literallayout></literallayout>
- <para>A chunk decommit function conforms to the
- <type>chunk_decommit_t</type> type and decommits any physical memory
- that is backing pages within a <parameter>chunk</parameter> of given
- <parameter>size</parameter> at <parameter>offset</parameter> bytes,
- extending for <parameter>length</parameter> on behalf of arena
- <parameter>arena_ind</parameter>, returning false upon success, in which
- case the pages will be committed via the chunk commit function before
- being reused. If the function returns true, this indicates opt-out from
- decommit; the memory remains committed and available for future use, in
- which case it will be automatically retained for later reuse.</para>
-
- <funcsynopsis><funcprototype>
- <funcdef>typedef bool <function>(chunk_purge_t)</function></funcdef>
- <paramdef>void *<parameter>chunk</parameter></paramdef>
- <paramdef>size_t<parameter>size</parameter></paramdef>
- <paramdef>size_t <parameter>offset</parameter></paramdef>
- <paramdef>size_t <parameter>length</parameter></paramdef>
- <paramdef>unsigned <parameter>arena_ind</parameter></paramdef>
- </funcprototype></funcsynopsis>
- <literallayout></literallayout>
- <para>A chunk purge function conforms to the <type>chunk_purge_t</type>
- type and optionally discards physical pages within the virtual memory
- mapping associated with <parameter>chunk</parameter> of given
- <parameter>size</parameter> at <parameter>offset</parameter> bytes,
- extending for <parameter>length</parameter> on behalf of arena
- <parameter>arena_ind</parameter>, returning false if pages within the
- purged virtual memory range will be zero-filled the next time they are
- accessed.</para>
-
- <funcsynopsis><funcprototype>
- <funcdef>typedef bool <function>(chunk_split_t)</function></funcdef>
- <paramdef>void *<parameter>chunk</parameter></paramdef>
- <paramdef>size_t <parameter>size</parameter></paramdef>
- <paramdef>size_t <parameter>size_a</parameter></paramdef>
- <paramdef>size_t <parameter>size_b</parameter></paramdef>
- <paramdef>bool <parameter>committed</parameter></paramdef>
- <paramdef>unsigned <parameter>arena_ind</parameter></paramdef>
- </funcprototype></funcsynopsis>
- <literallayout></literallayout>
- <para>A chunk split function conforms to the <type>chunk_split_t</type>
- type and optionally splits <parameter>chunk</parameter> of given
- <parameter>size</parameter> into two adjacent chunks, the first of
- <parameter>size_a</parameter> bytes, and the second of
- <parameter>size_b</parameter> bytes, operating on
- <parameter>committed</parameter>/decommitted memory as indicated, on
- behalf of arena <parameter>arena_ind</parameter>, returning false upon
- success. If the function returns true, this indicates that the chunk
- remains unsplit and therefore should continue to be operated on as a
- whole.</para>
-
- <funcsynopsis><funcprototype>
- <funcdef>typedef bool <function>(chunk_merge_t)</function></funcdef>
- <paramdef>void *<parameter>chunk_a</parameter></paramdef>
- <paramdef>size_t <parameter>size_a</parameter></paramdef>
- <paramdef>void *<parameter>chunk_b</parameter></paramdef>
- <paramdef>size_t <parameter>size_b</parameter></paramdef>
- <paramdef>bool <parameter>committed</parameter></paramdef>
- <paramdef>unsigned <parameter>arena_ind</parameter></paramdef>
- </funcprototype></funcsynopsis>
- <literallayout></literallayout>
- <para>A chunk merge function conforms to the <type>chunk_merge_t</type>
- type and optionally merges adjacent chunks,
- <parameter>chunk_a</parameter> of given <parameter>size_a</parameter>
- and <parameter>chunk_b</parameter> of given
- <parameter>size_b</parameter> into one contiguous chunk, operating on
- <parameter>committed</parameter>/decommitted memory as indicated, on
- behalf of arena <parameter>arena_ind</parameter>, returning false upon
- success. If the function returns true, this indicates that the chunks
- remain distinct mappings and therefore should continue to be operated on
- independently.</para>
- </listitem>
- </varlistentry>
-
- <varlistentry id="arenas.narenas">
- <term>
- <mallctl>arenas.narenas</mallctl>
- (<type>unsigned</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>Current limit on number of arenas.</para></listitem>
- </varlistentry>
-
- <varlistentry id="arenas.initialized">
- <term>
- <mallctl>arenas.initialized</mallctl>
- (<type>bool *</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>An array of <link
- linkend="arenas.narenas"><mallctl>arenas.narenas</mallctl></link>
- booleans. Each boolean indicates whether the corresponding arena is
- initialized.</para></listitem>
- </varlistentry>
-
- <varlistentry id="arenas.lg_dirty_mult">
- <term>
- <mallctl>arenas.lg_dirty_mult</mallctl>
- (<type>ssize_t</type>)
- <literal>rw</literal>
- </term>
- <listitem><para>Current default per-arena minimum ratio (log base 2) of
- active to dirty pages, used to initialize <link
- linkend="arena.i.lg_dirty_mult"><mallctl>arena.&lt;i&gt;.lg_dirty_mult</mallctl></link>
- during arena creation. See <link
- linkend="opt.lg_dirty_mult"><mallctl>opt.lg_dirty_mult</mallctl></link>
- for additional information.</para></listitem>
- </varlistentry>
-
- <varlistentry id="arenas.decay_time">
- <term>
- <mallctl>arenas.decay_time</mallctl>
- (<type>ssize_t</type>)
- <literal>rw</literal>
- </term>
- <listitem><para>Current default per-arena approximate time in seconds
- from the creation of a set of unused dirty pages until an equivalent set
- of unused dirty pages is purged and/or reused, used to initialize <link
- linkend="arena.i.decay_time"><mallctl>arena.&lt;i&gt;.decay_time</mallctl></link>
- during arena creation. See <link
- linkend="opt.decay_time"><mallctl>opt.decay_time</mallctl></link> for
- additional information.</para></listitem>
- </varlistentry>
-
- <varlistentry id="arenas.quantum">
- <term>
- <mallctl>arenas.quantum</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>Quantum size.</para></listitem>
- </varlistentry>
-
- <varlistentry id="arenas.page">
- <term>
- <mallctl>arenas.page</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>Page size.</para></listitem>
- </varlistentry>
-
- <varlistentry id="arenas.tcache_max">
- <term>
- <mallctl>arenas.tcache_max</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- [<option>--enable-tcache</option>]
- </term>
- <listitem><para>Maximum thread-cached size class.</para></listitem>
- </varlistentry>
-
- <varlistentry id="arenas.nbins">
- <term>
- <mallctl>arenas.nbins</mallctl>
- (<type>unsigned</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>Number of bin size classes.</para></listitem>
- </varlistentry>
-
- <varlistentry id="arenas.nhbins">
- <term>
- <mallctl>arenas.nhbins</mallctl>
- (<type>unsigned</type>)
- <literal>r-</literal>
- [<option>--enable-tcache</option>]
- </term>
- <listitem><para>Total number of thread cache bin size
- classes.</para></listitem>
- </varlistentry>
-
- <varlistentry id="arenas.bin.i.size">
- <term>
- <mallctl>arenas.bin.&lt;i&gt;.size</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>Maximum size supported by size class.</para></listitem>
- </varlistentry>
-
- <varlistentry id="arenas.bin.i.nregs">
- <term>
- <mallctl>arenas.bin.&lt;i&gt;.nregs</mallctl>
- (<type>uint32_t</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>Number of regions per page run.</para></listitem>
- </varlistentry>
-
- <varlistentry id="arenas.bin.i.run_size">
- <term>
- <mallctl>arenas.bin.&lt;i&gt;.run_size</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>Number of bytes per page run.</para></listitem>
- </varlistentry>
-
- <varlistentry id="arenas.nlruns">
- <term>
- <mallctl>arenas.nlruns</mallctl>
- (<type>unsigned</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>Total number of large size classes.</para></listitem>
- </varlistentry>
-
- <varlistentry id="arenas.lrun.i.size">
- <term>
- <mallctl>arenas.lrun.&lt;i&gt;.size</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>Maximum size supported by this large size
- class.</para></listitem>
- </varlistentry>
-
- <varlistentry id="arenas.nhchunks">
- <term>
- <mallctl>arenas.nhchunks</mallctl>
- (<type>unsigned</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>Total number of huge size classes.</para></listitem>
- </varlistentry>
-
- <varlistentry id="arenas.hchunk.i.size">
- <term>
- <mallctl>arenas.hchunk.&lt;i&gt;.size</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>Maximum size supported by this huge size
- class.</para></listitem>
- </varlistentry>
-
- <varlistentry id="arenas.extend">
- <term>
- <mallctl>arenas.extend</mallctl>
- (<type>unsigned</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>Extend the array of arenas by appending a new arena,
- and returning the new arena index.</para></listitem>
- </varlistentry>
-
- <varlistentry id="prof.thread_active_init">
- <term>
- <mallctl>prof.thread_active_init</mallctl>
- (<type>bool</type>)
- <literal>rw</literal>
- [<option>--enable-prof</option>]
- </term>
- <listitem><para>Control the initial setting for <link
- linkend="thread.prof.active"><mallctl>thread.prof.active</mallctl></link>
- in newly created threads. See the <link
- linkend="opt.prof_thread_active_init"><mallctl>opt.prof_thread_active_init</mallctl></link>
- option for additional information.</para></listitem>
- </varlistentry>
-
- <varlistentry id="prof.active">
- <term>
- <mallctl>prof.active</mallctl>
- (<type>bool</type>)
- <literal>rw</literal>
- [<option>--enable-prof</option>]
- </term>
- <listitem><para>Control whether sampling is currently active. See the
- <link
- linkend="opt.prof_active"><mallctl>opt.prof_active</mallctl></link>
- option for additional information, as well as the interrelated <link
- linkend="thread.prof.active"><mallctl>thread.prof.active</mallctl></link>
- mallctl.</para></listitem>
- </varlistentry>
-
- <varlistentry id="prof.dump">
- <term>
- <mallctl>prof.dump</mallctl>
- (<type>const char *</type>)
- <literal>-w</literal>
- [<option>--enable-prof</option>]
- </term>
- <listitem><para>Dump a memory profile to the specified file, or if NULL
- is specified, to a file according to the pattern
- <filename>&lt;prefix&gt;.&lt;pid&gt;.&lt;seq&gt;.m&lt;mseq&gt;.heap</filename>,
- where <literal>&lt;prefix&gt;</literal> is controlled by the
- <link
- linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link>
- option.</para></listitem>
- </varlistentry>
-
- <varlistentry id="prof.gdump">
- <term>
- <mallctl>prof.gdump</mallctl>
- (<type>bool</type>)
- <literal>rw</literal>
- [<option>--enable-prof</option>]
- </term>
- <listitem><para>When enabled, trigger a memory profile dump every time
- the total virtual memory exceeds the previous maximum. Profiles are
- dumped to files named according to the pattern
- <filename>&lt;prefix&gt;.&lt;pid&gt;.&lt;seq&gt;.u&lt;useq&gt;.heap</filename>,
- where <literal>&lt;prefix&gt;</literal> is controlled by the <link
- linkend="opt.prof_prefix"><mallctl>opt.prof_prefix</mallctl></link>
- option.</para></listitem>
- </varlistentry>
-
- <varlistentry id="prof.reset">
- <term>
- <mallctl>prof.reset</mallctl>
- (<type>size_t</type>)
- <literal>-w</literal>
- [<option>--enable-prof</option>]
- </term>
- <listitem><para>Reset all memory profile statistics, and optionally
- update the sample rate (see <link
- linkend="opt.lg_prof_sample"><mallctl>opt.lg_prof_sample</mallctl></link>
- and <link
- linkend="prof.lg_sample"><mallctl>prof.lg_sample</mallctl></link>).
- </para></listitem>
- </varlistentry>
-
- <varlistentry id="prof.lg_sample">
- <term>
- <mallctl>prof.lg_sample</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- [<option>--enable-prof</option>]
- </term>
- <listitem><para>Get the current sample rate (see <link
- linkend="opt.lg_prof_sample"><mallctl>opt.lg_prof_sample</mallctl></link>).
- </para></listitem>
- </varlistentry>
-
- <varlistentry id="prof.interval">
- <term>
- <mallctl>prof.interval</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-prof</option>]
- </term>
- <listitem><para>Average number of bytes allocated between
- interval-based profile dumps. See the
- <link
- linkend="opt.lg_prof_interval"><mallctl>opt.lg_prof_interval</mallctl></link>
- option for additional information.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.cactive">
- <term>
- <mallctl>stats.cactive</mallctl>
- (<type>size_t *</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Pointer to a counter that contains an approximate count
- of the current number of bytes in active pages. The estimate may be
- high, but never low, because each arena rounds up when computing its
- contribution to the counter. Note that the <link
- linkend="epoch"><mallctl>epoch</mallctl></link> mallctl has no bearing
- on this counter. Furthermore, counter consistency is maintained via
- atomic operations, so it is necessary to use an atomic operation in
- order to guarantee a consistent read when dereferencing the pointer.
- </para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.allocated">
- <term>
- <mallctl>stats.allocated</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Total number of bytes allocated by the
- application.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.active">
- <term>
- <mallctl>stats.active</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Total number of bytes in active pages allocated by the
- application. This is a multiple of the page size, and greater than or
- equal to <link
- linkend="stats.allocated"><mallctl>stats.allocated</mallctl></link>.
- This does not include <link linkend="stats.arenas.i.pdirty">
- <mallctl>stats.arenas.&lt;i&gt;.pdirty</mallctl></link>, nor pages
- entirely devoted to allocator metadata.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.metadata">
- <term>
- <mallctl>stats.metadata</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Total number of bytes dedicated to metadata, which
- comprise base allocations used for bootstrap-sensitive internal
- allocator data structures, arena chunk headers (see <link
- linkend="stats.arenas.i.metadata.mapped"><mallctl>stats.arenas.&lt;i&gt;.metadata.mapped</mallctl></link>),
- and internal allocations (see <link
- linkend="stats.arenas.i.metadata.allocated"><mallctl>stats.arenas.&lt;i&gt;.metadata.allocated</mallctl></link>).</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.resident">
- <term>
- <mallctl>stats.resident</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Maximum number of bytes in physically resident data
- pages mapped by the allocator, comprising all pages dedicated to
- allocator metadata, pages backing active allocations, and unused dirty
- pages. This is a maximum rather than precise because pages may not
- actually be physically resident if they correspond to demand-zeroed
- virtual memory that has not yet been touched. This is a multiple of the
- page size, and is larger than <link
- linkend="stats.active"><mallctl>stats.active</mallctl></link>.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.mapped">
- <term>
- <mallctl>stats.mapped</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Total number of bytes in active chunks mapped by the
- allocator. This is a multiple of the chunk size, and is larger than
- <link linkend="stats.active"><mallctl>stats.active</mallctl></link>.
- This does not include inactive chunks, even those that contain unused
- dirty pages, which means that there is no strict ordering between this
- and <link
- linkend="stats.resident"><mallctl>stats.resident</mallctl></link>.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.retained">
- <term>
- <mallctl>stats.retained</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Total number of bytes in virtual memory mappings that
- were retained rather than being returned to the operating system via
- e.g. <citerefentry><refentrytitle>munmap</refentrytitle>
- <manvolnum>2</manvolnum></citerefentry>. Retained virtual memory is
- typically untouched, decommitted, or purged, so it has no strongly
- associated physical memory (see <link
- linkend="arena.i.chunk_hooks">chunk hooks</link> for details). Retained
- memory is excluded from mapped memory statistics, e.g. <link
- linkend="stats.mapped"><mallctl>stats.mapped</mallctl></link>.
- </para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.dss">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.dss</mallctl>
- (<type>const char *</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>dss (<citerefentry><refentrytitle>sbrk</refentrytitle>
- <manvolnum>2</manvolnum></citerefentry>) allocation precedence as
- related to <citerefentry><refentrytitle>mmap</refentrytitle>
- <manvolnum>2</manvolnum></citerefentry> allocation. See <link
- linkend="opt.dss"><mallctl>opt.dss</mallctl></link> for details.
- </para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.lg_dirty_mult">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.lg_dirty_mult</mallctl>
- (<type>ssize_t</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>Minimum ratio (log base 2) of active to dirty pages.
- See <link
- linkend="opt.lg_dirty_mult"><mallctl>opt.lg_dirty_mult</mallctl></link>
- for details.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.decay_time">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.decay_time</mallctl>
- (<type>ssize_t</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>Approximate time in seconds from the creation of a set
- of unused dirty pages until an equivalent set of unused dirty pages is
- purged and/or reused. See <link
- linkend="opt.decay_time"><mallctl>opt.decay_time</mallctl></link>
- for details.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.nthreads">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.nthreads</mallctl>
- (<type>unsigned</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>Number of threads currently assigned to
- arena.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.pactive">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.pactive</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>Number of pages in active runs.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.pdirty">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.pdirty</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- </term>
- <listitem><para>Number of pages within unused runs that are potentially
- dirty, and for which <function>madvise<parameter>...</parameter>
- <parameter><constant>MADV_DONTNEED</constant></parameter></function> or
- similar has not been called.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.mapped">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.mapped</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Number of mapped bytes.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.retained">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.retained</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Number of retained bytes. See <link
- linkend="stats.retained"><mallctl>stats.retained</mallctl></link> for
- details.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.metadata.mapped">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.metadata.mapped</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Number of mapped bytes in arena chunk headers, which
- track the states of the non-metadata pages.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.metadata.allocated">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.metadata.allocated</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Number of bytes dedicated to internal allocations.
- Internal allocations differ from application-originated allocations in
- that they are for internal use, and that they are omitted from heap
- profiles. This statistic is reported separately from <link
- linkend="stats.metadata"><mallctl>stats.metadata</mallctl></link> and
- <link
- linkend="stats.arenas.i.metadata.mapped"><mallctl>stats.arenas.&lt;i&gt;.metadata.mapped</mallctl></link>
- because it overlaps with e.g. the <link
- linkend="stats.allocated"><mallctl>stats.allocated</mallctl></link> and
- <link linkend="stats.active"><mallctl>stats.active</mallctl></link>
- statistics, whereas the other metadata statistics do
- not.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.npurge">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.npurge</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Number of dirty page purge sweeps performed.
- </para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.nmadvise">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.nmadvise</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Number of <function>madvise<parameter>...</parameter>
- <parameter><constant>MADV_DONTNEED</constant></parameter></function> or
- similar calls made to purge dirty pages.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.purged">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.purged</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Number of pages purged.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.small.allocated">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.small.allocated</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Number of bytes currently allocated by small objects.
- </para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.small.nmalloc">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.small.nmalloc</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Cumulative number of allocation requests served by
- small bins.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.small.ndalloc">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.small.ndalloc</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Cumulative number of small objects returned to bins.
- </para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.small.nrequests">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.small.nrequests</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Cumulative number of small allocation requests.
- </para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.large.allocated">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.large.allocated</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Number of bytes currently allocated by large objects.
- </para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.large.nmalloc">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.large.nmalloc</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Cumulative number of large allocation requests served
- directly by the arena.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.large.ndalloc">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.large.ndalloc</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Cumulative number of large deallocation requests served
- directly by the arena.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.large.nrequests">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.large.nrequests</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Cumulative number of large allocation requests.
- </para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.huge.allocated">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.huge.allocated</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Number of bytes currently allocated by huge objects.
- </para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.huge.nmalloc">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.huge.nmalloc</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Cumulative number of huge allocation requests served
- directly by the arena.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.huge.ndalloc">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.huge.ndalloc</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Cumulative number of huge deallocation requests served
- directly by the arena.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.huge.nrequests">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.huge.nrequests</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Cumulative number of huge allocation requests.
- </para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.bins.j.nmalloc">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.nmalloc</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Cumulative number of allocations served by bin.
- </para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.bins.j.ndalloc">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.ndalloc</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Cumulative number of allocations returned to bin.
- </para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.bins.j.nrequests">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.nrequests</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Cumulative number of allocation
- requests.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.bins.j.curregs">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.curregs</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Current number of regions for this size
- class.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.bins.j.nfills">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.nfills</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option> <option>--enable-tcache</option>]
- </term>
- <listitem><para>Cumulative number of tcache fills.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.bins.j.nflushes">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.nflushes</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option> <option>--enable-tcache</option>]
- </term>
- <listitem><para>Cumulative number of tcache flushes.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.bins.j.nruns">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.nruns</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Cumulative number of runs created.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.bins.j.nreruns">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.nreruns</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Cumulative number of times the current run from which
- to allocate changed.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.bins.j.curruns">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.bins.&lt;j&gt;.curruns</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Current number of runs.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.lruns.j.nmalloc">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.lruns.&lt;j&gt;.nmalloc</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Cumulative number of allocation requests for this size
- class served directly by the arena.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.lruns.j.ndalloc">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.lruns.&lt;j&gt;.ndalloc</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Cumulative number of deallocation requests for this
- size class served directly by the arena.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.lruns.j.nrequests">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.lruns.&lt;j&gt;.nrequests</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Cumulative number of allocation requests for this size
- class.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.lruns.j.curruns">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.lruns.&lt;j&gt;.curruns</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Current number of runs for this size class.
- </para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.hchunks.j.nmalloc">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.hchunks.&lt;j&gt;.nmalloc</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Cumulative number of allocation requests for this size
- class served directly by the arena.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.hchunks.j.ndalloc">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.hchunks.&lt;j&gt;.ndalloc</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Cumulative number of deallocation requests for this
- size class served directly by the arena.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.hchunks.j.nrequests">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.hchunks.&lt;j&gt;.nrequests</mallctl>
- (<type>uint64_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Cumulative number of allocation requests for this size
- class.</para></listitem>
- </varlistentry>
-
- <varlistentry id="stats.arenas.i.hchunks.j.curhchunks">
- <term>
- <mallctl>stats.arenas.&lt;i&gt;.hchunks.&lt;j&gt;.curhchunks</mallctl>
- (<type>size_t</type>)
- <literal>r-</literal>
- [<option>--enable-stats</option>]
- </term>
- <listitem><para>Current number of huge allocations for this size class.
- </para></listitem>
- </varlistentry>
- </variablelist>
- </refsect1>
- <refsect1 id="heap_profile_format">
- <title>HEAP PROFILE FORMAT</title>
- <para>Although the heap profiling functionality was originally designed to
- be compatible with the
- <command>pprof</command> command that is developed as part of the <ulink
- url="http://code.google.com/p/gperftools/">gperftools
- package</ulink>, the addition of per thread heap profiling functionality
- required a different heap profile format. The <command>jeprof</command>
- command is derived from <command>pprof</command>, with enhancements to
- support the heap profile format described here.</para>
-
- <para>In the following hypothetical heap profile, <constant>[...]</constant>
- indicates elision for the sake of compactness. <programlisting><![CDATA[
-heap_v2/524288
- t*: 28106: 56637512 [0: 0]
- [...]
- t3: 352: 16777344 [0: 0]
- [...]
- t99: 17754: 29341640 [0: 0]
- [...]
-@ 0x5f86da8 0x5f5a1dc [...] 0x29e4d4e 0xa200316 0xabb2988 [...]
- t*: 13: 6688 [0: 0]
- t3: 12: 6496 [0: ]
- t99: 1: 192 [0: 0]
-[...]
-
-MAPPED_LIBRARIES:
-[...]]]></programlisting> The following matches the above heap profile, but most
-tokens are replaced with <constant>&lt;description&gt;</constant> to indicate
-descriptions of the corresponding fields. <programlisting><![CDATA[
-<heap_profile_format_version>/<mean_sample_interval>
- <aggregate>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
- [...]
- <thread_3_aggregate>: <curobjs>: <curbytes>[<cumobjs>: <cumbytes>]
- [...]
- <thread_99_aggregate>: <curobjs>: <curbytes>[<cumobjs>: <cumbytes>]
- [...]
-@ <top_frame> <frame> [...] <frame> <frame> <frame> [...]
- <backtrace_aggregate>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
- <backtrace_thread_3>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
- <backtrace_thread_99>: <curobjs>: <curbytes> [<cumobjs>: <cumbytes>]
-[...]
-
-MAPPED_LIBRARIES:
-</proc/<pid>/maps>]]></programlisting></para>
- </refsect1>
-
- <refsect1 id="debugging_malloc_problems">
- <title>DEBUGGING MALLOC PROBLEMS</title>
- <para>When debugging, it is a good idea to configure/build jemalloc with
- the <option>--enable-debug</option> and <option>--enable-fill</option>
- options, and recompile the program with suitable options and symbols for
- debugger support. When so configured, jemalloc incorporates a wide variety
- of run-time assertions that catch application errors such as double-free,
- write-after-free, etc.</para>
-
- <para>Programs often accidentally depend on <quote>uninitialized</quote>
- memory actually being filled with zero bytes. Junk filling
- (see the <link linkend="opt.junk"><mallctl>opt.junk</mallctl></link>
- option) tends to expose such bugs in the form of obviously incorrect
- results and/or coredumps. Conversely, zero
- filling (see the <link
- linkend="opt.zero"><mallctl>opt.zero</mallctl></link> option) eliminates
- the symptoms of such bugs. Between these two options, it is usually
- possible to quickly detect, diagnose, and eliminate such bugs.</para>
-
- <para>This implementation does not provide much detail about the problems
- it detects, because the performance impact for storing such information
- would be prohibitive. However, jemalloc does integrate with the most
- excellent <ulink url="http://valgrind.org/">Valgrind</ulink> tool if the
- <option>--enable-valgrind</option> configuration option is enabled.</para>
- </refsect1>
- <refsect1 id="diagnostic_messages">
- <title>DIAGNOSTIC MESSAGES</title>
- <para>If any of the memory allocation/deallocation functions detect an
- error or warning condition, a message will be printed to file descriptor
- <constant>STDERR_FILENO</constant>. Errors will result in the process
- dumping core. If the <link
- linkend="opt.abort"><mallctl>opt.abort</mallctl></link> option is set, most
- warnings are treated as errors.</para>
-
- <para>The <varname>malloc_message</varname> variable allows the programmer
- to override the function which emits the text strings forming the errors
- and warnings if for some reason the <constant>STDERR_FILENO</constant> file
- descriptor is not suitable for this.
- <function>malloc_message()</function> takes the
- <parameter>cbopaque</parameter> pointer argument that is
- <constant>NULL</constant> unless overridden by the arguments in a call to
- <function>malloc_stats_print()</function>, followed by a string
- pointer. Please note that doing anything which tries to allocate memory in
- this function is likely to result in a crash or deadlock.</para>
-
- <para>All messages are prefixed by
- <quote><computeroutput>&lt;jemalloc&gt;: </computeroutput></quote>.</para>
- </refsect1>
- <refsect1 id="return_values">
- <title>RETURN VALUES</title>
- <refsect2>
- <title>Standard API</title>
- <para>The <function>malloc()</function> and
- <function>calloc()</function> functions return a pointer to the
- allocated memory if successful; otherwise a <constant>NULL</constant>
- pointer is returned and <varname>errno</varname> is set to
- <errorname>ENOMEM</errorname>.</para>
-
- <para>The <function>posix_memalign()</function> function
- returns the value 0 if successful; otherwise it returns an error value.
- The <function>posix_memalign()</function> function will fail
- if:
- <variablelist>
- <varlistentry>
- <term><errorname>EINVAL</errorname></term>
-
- <listitem><para>The <parameter>alignment</parameter> parameter is
- not a power of 2 at least as large as
- <code language="C">sizeof(<type>void *</type>)</code>.
- </para></listitem>
- </varlistentry>
- <varlistentry>
- <term><errorname>ENOMEM</errorname></term>
-
- <listitem><para>Memory allocation error.</para></listitem>
- </varlistentry>
- </variablelist>
- </para>
-
- <para>The <function>aligned_alloc()</function> function returns
- a pointer to the allocated memory if successful; otherwise a
- <constant>NULL</constant> pointer is returned and
- <varname>errno</varname> is set. The
- <function>aligned_alloc()</function> function will fail if:
- <variablelist>
- <varlistentry>
- <term><errorname>EINVAL</errorname></term>
-
- <listitem><para>The <parameter>alignment</parameter> parameter is
- not a power of 2.
- </para></listitem>
- </varlistentry>
- <varlistentry>
- <term><errorname>ENOMEM</errorname></term>
-
- <listitem><para>Memory allocation error.</para></listitem>
- </varlistentry>
- </variablelist>
- </para>
-
- <para>The <function>realloc()</function> function returns a
- pointer, possibly identical to <parameter>ptr</parameter>, to the
- allocated memory if successful; otherwise a <constant>NULL</constant>
- pointer is returned, and <varname>errno</varname> is set to
- <errorname>ENOMEM</errorname> if the error was the result of an
- allocation failure. The <function>realloc()</function>
- function always leaves the original buffer intact when an error occurs.
- </para>
-
- <para>The <function>free()</function> function returns no
- value.</para>
- </refsect2>
- <refsect2>
- <title>Non-standard API</title>
- <para>The <function>mallocx()</function> and
- <function>rallocx()</function> functions return a pointer to
- the allocated memory if successful; otherwise a <constant>NULL</constant>
- pointer is returned to indicate insufficient contiguous memory was
- available to service the allocation request. </para>
-
- <para>The <function>xallocx()</function> function returns the
- real size of the resulting resized allocation pointed to by
- <parameter>ptr</parameter>, which is a value less than
- <parameter>size</parameter> if the allocation could not be adequately
- grown in place. </para>
-
- <para>The <function>sallocx()</function> function returns the
- real size of the allocation pointed to by <parameter>ptr</parameter>.
- </para>
-
- <para>The <function>nallocx()</function> returns the real size
- that would result from a successful equivalent
- <function>mallocx()</function> function call, or zero if
- insufficient memory is available to perform the size computation. </para>
-
- <para>The <function>mallctl()</function>,
- <function>mallctlnametomib()</function>, and
- <function>mallctlbymib()</function> functions return 0 on
- success; otherwise they return an error value. The functions will fail
- if:
- <variablelist>
- <varlistentry>
- <term><errorname>EINVAL</errorname></term>
-
- <listitem><para><parameter>newp</parameter> is not
- <constant>NULL</constant>, and <parameter>newlen</parameter> is too
- large or too small. Alternatively, <parameter>*oldlenp</parameter>
- is too large or too small; in this case as much data as possible
- are read despite the error.</para></listitem>
- </varlistentry>
- <varlistentry>
- <term><errorname>ENOENT</errorname></term>
-
- <listitem><para><parameter>name</parameter> or
- <parameter>mib</parameter> specifies an unknown/invalid
- value.</para></listitem>
- </varlistentry>
- <varlistentry>
- <term><errorname>EPERM</errorname></term>
-
- <listitem><para>Attempt to read or write void value, or attempt to
- write read-only value.</para></listitem>
- </varlistentry>
- <varlistentry>
- <term><errorname>EAGAIN</errorname></term>
-
- <listitem><para>A memory allocation failure
- occurred.</para></listitem>
- </varlistentry>
- <varlistentry>
- <term><errorname>EFAULT</errorname></term>
-
- <listitem><para>An interface with side effects failed in some way
- not directly related to <function>mallctl*()</function>
- read/write processing.</para></listitem>
- </varlistentry>
- </variablelist>
- </para>
-
- <para>The <function>malloc_usable_size()</function> function
- returns the usable size of the allocation pointed to by
- <parameter>ptr</parameter>. </para>
- </refsect2>
- </refsect1>
- <refsect1 id="environment">
- <title>ENVIRONMENT</title>
- <para>The following environment variable affects the execution of the
- allocation functions:
- <variablelist>
- <varlistentry>
- <term><envar>MALLOC_CONF</envar></term>
-
- <listitem><para>If the environment variable
- <envar>MALLOC_CONF</envar> is set, the characters it contains
- will be interpreted as options.</para></listitem>
- </varlistentry>
- </variablelist>
- </para>
- </refsect1>
- <refsect1 id="examples">
- <title>EXAMPLES</title>
- <para>To dump core whenever a problem occurs:
- <screen>ln -s 'abort:true' /etc/malloc.conf</screen>
- </para>
- <para>To specify in the source a chunk size that is 16 MiB:
- <programlisting language="C"><![CDATA[
-malloc_conf = "lg_chunk:24";]]></programlisting></para>
- </refsect1>
- <refsect1 id="see_also">
- <title>SEE ALSO</title>
- <para><citerefentry><refentrytitle>madvise</refentrytitle>
- <manvolnum>2</manvolnum></citerefentry>,
- <citerefentry><refentrytitle>mmap</refentrytitle>
- <manvolnum>2</manvolnum></citerefentry>,
- <citerefentry><refentrytitle>sbrk</refentrytitle>
- <manvolnum>2</manvolnum></citerefentry>,
- <citerefentry><refentrytitle>utrace</refentrytitle>
- <manvolnum>2</manvolnum></citerefentry>,
- <citerefentry><refentrytitle>alloca</refentrytitle>
- <manvolnum>3</manvolnum></citerefentry>,
- <citerefentry><refentrytitle>atexit</refentrytitle>
- <manvolnum>3</manvolnum></citerefentry>,
- <citerefentry><refentrytitle>getpagesize</refentrytitle>
- <manvolnum>3</manvolnum></citerefentry></para>
- </refsect1>
- <refsect1 id="standards">
- <title>STANDARDS</title>
- <para>The <function>malloc()</function>,
- <function>calloc()</function>,
- <function>realloc()</function>, and
- <function>free()</function> functions conform to ISO/IEC
- 9899:1990 (<quote>ISO C90</quote>).</para>
-
- <para>The <function>posix_memalign()</function> function conforms
- to IEEE Std 1003.1-2001 (<quote>POSIX.1</quote>).</para>
- </refsect1>
-</refentry>
diff --git a/memory/jemalloc/src/doc/manpages.xsl.in b/memory/jemalloc/src/doc/manpages.xsl.in
deleted file mode 100644
index 88b2626b95..0000000000
--- a/memory/jemalloc/src/doc/manpages.xsl.in
+++ /dev/null
@@ -1,4 +0,0 @@
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
- <xsl:import href="@XSLROOT@/manpages/docbook.xsl"/>
- <xsl:import href="@abs_srcroot@doc/stylesheet.xsl"/>
-</xsl:stylesheet>
diff --git a/memory/jemalloc/src/doc/stylesheet.xsl b/memory/jemalloc/src/doc/stylesheet.xsl
deleted file mode 100644
index 619365d825..0000000000
--- a/memory/jemalloc/src/doc/stylesheet.xsl
+++ /dev/null
@@ -1,10 +0,0 @@
-<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
- <xsl:param name="funcsynopsis.style">ansi</xsl:param>
- <xsl:param name="function.parens" select="0"/>
- <xsl:template match="function">
- <xsl:call-template name="inline.monoseq"/>
- </xsl:template>
- <xsl:template match="mallctl">
- <quote><xsl:call-template name="inline.monoseq"/></quote>
- </xsl:template>
-</xsl:stylesheet>
diff --git a/memory/jemalloc/src/include/jemalloc/internal/arena.h b/memory/jemalloc/src/include/jemalloc/internal/arena.h
deleted file mode 100644
index f39ce54b5c..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/arena.h
+++ /dev/null
@@ -1,1516 +0,0 @@
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-#define LARGE_MINCLASS (ZU(1) << LG_LARGE_MINCLASS)
-
-/* Maximum number of regions in one run. */
-#define LG_RUN_MAXREGS (LG_PAGE - LG_TINY_MIN)
-#define RUN_MAXREGS (1U << LG_RUN_MAXREGS)
-
-/*
- * Minimum redzone size. Redzones may be larger than this if necessary to
- * preserve region alignment.
- */
-#define REDZONE_MINSIZE 16
-
-/*
- * The minimum ratio of active:dirty pages per arena is computed as:
- *
- * (nactive >> lg_dirty_mult) >= ndirty
- *
- * So, supposing that lg_dirty_mult is 3, there can be no less than 8 times as
- * many active pages as dirty pages.
- */
-#define LG_DIRTY_MULT_DEFAULT 3
-
-typedef enum {
- purge_mode_ratio = 0,
- purge_mode_decay = 1,
-
- purge_mode_limit = 2
-} purge_mode_t;
-#define PURGE_DEFAULT purge_mode_ratio
-/* Default decay time in seconds. */
-#define DECAY_TIME_DEFAULT 10
-/* Number of event ticks between time checks. */
-#define DECAY_NTICKS_PER_UPDATE 1000
-
-typedef struct arena_runs_dirty_link_s arena_runs_dirty_link_t;
-typedef struct arena_avail_links_s arena_avail_links_t;
-typedef struct arena_run_s arena_run_t;
-typedef struct arena_chunk_map_bits_s arena_chunk_map_bits_t;
-typedef struct arena_chunk_map_misc_s arena_chunk_map_misc_t;
-typedef struct arena_chunk_s arena_chunk_t;
-typedef struct arena_bin_info_s arena_bin_info_t;
-typedef struct arena_decay_s arena_decay_t;
-typedef struct arena_bin_s arena_bin_t;
-typedef struct arena_s arena_t;
-typedef struct arena_tdata_s arena_tdata_t;
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-#ifdef JEMALLOC_ARENA_STRUCTS_A
-struct arena_run_s {
- /* Index of bin this run is associated with. */
- szind_t binind;
-
- /* Number of free regions in run. */
- unsigned nfree;
-
- /* Per region allocated/deallocated bitmap. */
- bitmap_t bitmap[BITMAP_GROUPS_MAX];
-};
-
-/* Each element of the chunk map corresponds to one page within the chunk. */
-struct arena_chunk_map_bits_s {
- /*
- * Run address (or size) and various flags are stored together. The bit
- * layout looks like (assuming 32-bit system):
- *
- * ???????? ???????? ???nnnnn nnndumla
- *
- * ? : Unallocated: Run address for first/last pages, unset for internal
- * pages.
- * Small: Run page offset.
- * Large: Run page count for first page, unset for trailing pages.
- * n : binind for small size class, BININD_INVALID for large size class.
- * d : dirty?
- * u : unzeroed?
- * m : decommitted?
- * l : large?
- * a : allocated?
- *
- * Following are example bit patterns for the three types of runs.
- *
- * p : run page offset
- * s : run size
- * n : binind for size class; large objects set these to BININD_INVALID
- * x : don't care
- * - : 0
- * + : 1
- * [DUMLA] : bit set
- * [dumla] : bit unset
- *
- * Unallocated (clean):
- * ssssssss ssssssss sss+++++ +++dum-a
- * xxxxxxxx xxxxxxxx xxxxxxxx xxx-Uxxx
- * ssssssss ssssssss sss+++++ +++dUm-a
- *
- * Unallocated (dirty):
- * ssssssss ssssssss sss+++++ +++D-m-a
- * xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx
- * ssssssss ssssssss sss+++++ +++D-m-a
- *
- * Small:
- * pppppppp pppppppp pppnnnnn nnnd---A
- * pppppppp pppppppp pppnnnnn nnn----A
- * pppppppp pppppppp pppnnnnn nnnd---A
- *
- * Large:
- * ssssssss ssssssss sss+++++ +++D--LA
- * xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx
- * -------- -------- ---+++++ +++D--LA
- *
- * Large (sampled, size <= LARGE_MINCLASS):
- * ssssssss ssssssss sssnnnnn nnnD--LA
- * xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx
- * -------- -------- ---+++++ +++D--LA
- *
- * Large (not sampled, size == LARGE_MINCLASS):
- * ssssssss ssssssss sss+++++ +++D--LA
- * xxxxxxxx xxxxxxxx xxxxxxxx xxxxxxxx
- * -------- -------- ---+++++ +++D--LA
- */
- size_t bits;
-#define CHUNK_MAP_ALLOCATED ((size_t)0x01U)
-#define CHUNK_MAP_LARGE ((size_t)0x02U)
-#define CHUNK_MAP_STATE_MASK ((size_t)0x3U)
-
-#define CHUNK_MAP_DECOMMITTED ((size_t)0x04U)
-#define CHUNK_MAP_UNZEROED ((size_t)0x08U)
-#define CHUNK_MAP_DIRTY ((size_t)0x10U)
-#define CHUNK_MAP_FLAGS_MASK ((size_t)0x1cU)
-
-#define CHUNK_MAP_BININD_SHIFT 5
-#define BININD_INVALID ((size_t)0xffU)
-#define CHUNK_MAP_BININD_MASK (BININD_INVALID << CHUNK_MAP_BININD_SHIFT)
-#define CHUNK_MAP_BININD_INVALID CHUNK_MAP_BININD_MASK
-
-#define CHUNK_MAP_RUNIND_SHIFT (CHUNK_MAP_BININD_SHIFT + 8)
-#define CHUNK_MAP_SIZE_SHIFT (CHUNK_MAP_RUNIND_SHIFT - LG_PAGE)
-#define CHUNK_MAP_SIZE_MASK \
- (~(CHUNK_MAP_BININD_MASK | CHUNK_MAP_FLAGS_MASK | CHUNK_MAP_STATE_MASK))
-};
-
-struct arena_runs_dirty_link_s {
- qr(arena_runs_dirty_link_t) rd_link;
-};
-
-/*
- * Each arena_chunk_map_misc_t corresponds to one page within the chunk, just
- * like arena_chunk_map_bits_t. Two separate arrays are stored within each
- * chunk header in order to improve cache locality.
- */
-struct arena_chunk_map_misc_s {
- /*
- * Linkage for run heaps. There are two disjoint uses:
- *
- * 1) arena_t's runs_avail heaps.
- * 2) arena_run_t conceptually uses this linkage for in-use non-full
- * runs, rather than directly embedding linkage.
- */
- phn(arena_chunk_map_misc_t) ph_link;
-
- union {
- /* Linkage for list of dirty runs. */
- arena_runs_dirty_link_t rd;
-
- /* Profile counters, used for large object runs. */
- union {
- void *prof_tctx_pun;
- prof_tctx_t *prof_tctx;
- };
-
- /* Small region run metadata. */
- arena_run_t run;
- };
-};
-typedef ph(arena_chunk_map_misc_t) arena_run_heap_t;
-#endif /* JEMALLOC_ARENA_STRUCTS_A */
-
-#ifdef JEMALLOC_ARENA_STRUCTS_B
-/* Arena chunk header. */
-struct arena_chunk_s {
- /*
- * A pointer to the arena that owns the chunk is stored within the node.
- * This field as a whole is used by chunks_rtree to support both
- * ivsalloc() and core-based debugging.
- */
- extent_node_t node;
-
- /*
- * Map of pages within chunk that keeps track of free/large/small. The
- * first map_bias entries are omitted, since the chunk header does not
- * need to be tracked in the map. This omission saves a header page
- * for common chunk sizes (e.g. 4 MiB).
- */
- arena_chunk_map_bits_t map_bits[1]; /* Dynamically sized. */
-};
-
-/*
- * Read-only information associated with each element of arena_t's bins array
- * is stored separately, partly to reduce memory usage (only one copy, rather
- * than one per arena), but mainly to avoid false cacheline sharing.
- *
- * Each run has the following layout:
- *
- * /--------------------\
- * | pad? |
- * |--------------------|
- * | redzone |
- * reg0_offset | region 0 |
- * | redzone |
- * |--------------------| \
- * | redzone | |
- * | region 1 | > reg_interval
- * | redzone | /
- * |--------------------|
- * | ... |
- * | ... |
- * | ... |
- * |--------------------|
- * | redzone |
- * | region nregs-1 |
- * | redzone |
- * |--------------------|
- * | alignment pad? |
- * \--------------------/
- *
- * reg_interval has at least the same minimum alignment as reg_size; this
- * preserves the alignment constraint that sa2u() depends on. Alignment pad is
- * either 0 or redzone_size; it is present only if needed to align reg0_offset.
- */
-struct arena_bin_info_s {
- /* Size of regions in a run for this bin's size class. */
- size_t reg_size;
-
- /* Redzone size. */
- size_t redzone_size;
-
- /* Interval between regions (reg_size + (redzone_size << 1)). */
- size_t reg_interval;
-
- /* Total size of a run for this bin's size class. */
- size_t run_size;
-
- /* Total number of regions in a run for this bin's size class. */
- uint32_t nregs;
-
- /*
- * Metadata used to manipulate bitmaps for runs associated with this
- * bin.
- */
- bitmap_info_t bitmap_info;
-
- /* Offset of first region in a run for this bin's size class. */
- uint32_t reg0_offset;
-};
-
-struct arena_decay_s {
- /*
- * Approximate time in seconds from the creation of a set of unused
- * dirty pages until an equivalent set of unused dirty pages is purged
- * and/or reused.
- */
- ssize_t time;
- /* time / SMOOTHSTEP_NSTEPS. */
- nstime_t interval;
- /*
- * Time at which the current decay interval logically started. We do
- * not actually advance to a new epoch until sometime after it starts
- * because of scheduling and computation delays, and it is even possible
- * to completely skip epochs. In all cases, during epoch advancement we
- * merge all relevant activity into the most recently recorded epoch.
- */
- nstime_t epoch;
- /* Deadline randomness generator. */
- uint64_t jitter_state;
- /*
- * Deadline for current epoch. This is the sum of interval and per
- * epoch jitter which is a uniform random variable in [0..interval).
- * Epochs always advance by precise multiples of interval, but we
- * randomize the deadline to reduce the likelihood of arenas purging in
- * lockstep.
- */
- nstime_t deadline;
- /*
- * Number of dirty pages at beginning of current epoch. During epoch
- * advancement we use the delta between arena->decay.ndirty and
- * arena->ndirty to determine how many dirty pages, if any, were
- * generated.
- */
- size_t ndirty;
- /*
- * Trailing log of how many unused dirty pages were generated during
- * each of the past SMOOTHSTEP_NSTEPS decay epochs, where the last
- * element is the most recent epoch. Corresponding epoch times are
- * relative to epoch.
- */
- size_t backlog[SMOOTHSTEP_NSTEPS];
-};
-
-struct arena_bin_s {
- /*
- * All operations on runcur, runs, and stats require that lock be
- * locked. Run allocation/deallocation are protected by the arena lock,
- * which may be acquired while holding one or more bin locks, but not
- * vise versa.
- */
- malloc_mutex_t lock;
-
- /*
- * Current run being used to service allocations of this bin's size
- * class.
- */
- arena_run_t *runcur;
-
- /*
- * Heap of non-full runs. This heap is used when looking for an
- * existing run when runcur is no longer usable. We choose the
- * non-full run that is lowest in memory; this policy tends to keep
- * objects packed well, and it can also help reduce the number of
- * almost-empty chunks.
- */
- arena_run_heap_t runs;
-
- /* Bin statistics. */
- malloc_bin_stats_t stats;
-};
-
-struct arena_s {
- /* This arena's index within the arenas array. */
- unsigned ind;
-
- /*
- * Number of threads currently assigned to this arena, synchronized via
- * atomic operations. Each thread has two distinct assignments, one for
- * application-serving allocation, and the other for internal metadata
- * allocation. Internal metadata must not be allocated from arenas
- * created via the arenas.extend mallctl, because the arena.<i>.reset
- * mallctl indiscriminately discards all allocations for the affected
- * arena.
- *
- * 0: Application allocation.
- * 1: Internal metadata allocation.
- */
- unsigned nthreads[2];
-
- /*
- * There are three classes of arena operations from a locking
- * perspective:
- * 1) Thread assignment (modifies nthreads) is synchronized via atomics.
- * 2) Bin-related operations are protected by bin locks.
- * 3) Chunk- and run-related operations are protected by this mutex.
- */
- malloc_mutex_t lock;
-
- arena_stats_t stats;
- /*
- * List of tcaches for extant threads associated with this arena.
- * Stats from these are merged incrementally, and at exit if
- * opt_stats_print is enabled.
- */
- ql_head(tcache_t) tcache_ql;
-
- uint64_t prof_accumbytes;
-
- /*
- * PRNG state for cache index randomization of large allocation base
- * pointers.
- */
- size_t offset_state;
-
- dss_prec_t dss_prec;
-
-
- /* Extant arena chunks. */
- ql_head(extent_node_t) achunks;
-
- /*
- * In order to avoid rapid chunk allocation/deallocation when an arena
- * oscillates right on the cusp of needing a new chunk, cache the most
- * recently freed chunk. The spare is left in the arena's chunk trees
- * until it is deleted.
- *
- * There is one spare chunk per arena, rather than one spare total, in
- * order to avoid interactions between multiple threads that could make
- * a single spare inadequate.
- */
- arena_chunk_t *spare;
-
- /* Minimum ratio (log base 2) of nactive:ndirty. */
- ssize_t lg_dirty_mult;
-
- /* True if a thread is currently executing arena_purge_to_limit(). */
- bool purging;
-
- /* Number of pages in active runs and huge regions. */
- size_t nactive;
-
- /*
- * Current count of pages within unused runs that are potentially
- * dirty, and for which madvise(... MADV_DONTNEED) has not been called.
- * By tracking this, we can institute a limit on how much dirty unused
- * memory is mapped for each arena.
- */
- size_t ndirty;
-
- /*
- * Unused dirty memory this arena manages. Dirty memory is conceptually
- * tracked as an arbitrarily interleaved LRU of dirty runs and cached
- * chunks, but the list linkage is actually semi-duplicated in order to
- * avoid extra arena_chunk_map_misc_t space overhead.
- *
- * LRU-----------------------------------------------------------MRU
- *
- * /-- arena ---\
- * | |
- * | |
- * |------------| /- chunk -\
- * ...->|chunks_cache|<--------------------------->| /----\ |<--...
- * |------------| | |node| |
- * | | | | | |
- * | | /- run -\ /- run -\ | | | |
- * | | | | | | | | | |
- * | | | | | | | | | |
- * |------------| |-------| |-------| | |----| |
- * ...->|runs_dirty |<-->|rd |<-->|rd |<---->|rd |<----...
- * |------------| |-------| |-------| | |----| |
- * | | | | | | | | | |
- * | | | | | | | \----/ |
- * | | \-------/ \-------/ | |
- * | | | |
- * | | | |
- * \------------/ \---------/
- */
- arena_runs_dirty_link_t runs_dirty;
- extent_node_t chunks_cache;
-
- /* Decay-based purging state. */
- arena_decay_t decay;
-
- /* Extant huge allocations. */
- ql_head(extent_node_t) huge;
- /* Synchronizes all huge allocation/update/deallocation. */
- malloc_mutex_t huge_mtx;
-
- /*
- * Trees of chunks that were previously allocated (trees differ only in
- * node ordering). These are used when allocating chunks, in an attempt
- * to re-use address space. Depending on function, different tree
- * orderings are needed, which is why there are two trees with the same
- * contents.
- */
- extent_tree_t chunks_szad_cached;
- extent_tree_t chunks_ad_cached;
- extent_tree_t chunks_szad_retained;
- extent_tree_t chunks_ad_retained;
-
- malloc_mutex_t chunks_mtx;
- /* Cache of nodes that were allocated via base_alloc(). */
- ql_head(extent_node_t) node_cache;
- malloc_mutex_t node_cache_mtx;
-
- /* User-configurable chunk hook functions. */
- chunk_hooks_t chunk_hooks;
-
- /* bins is used to store trees of free regions. */
- arena_bin_t bins[NBINS];
-
- /*
- * Size-segregated address-ordered heaps of this arena's available runs,
- * used for first-best-fit run allocation. Runs are quantized, i.e.
- * they reside in the last heap which corresponds to a size class less
- * than or equal to the run size.
- */
- arena_run_heap_t runs_avail[NPSIZES];
-};
-
-/* Used in conjunction with tsd for fast arena-related context lookup. */
-struct arena_tdata_s {
- ticker_t decay_ticker;
-};
-#endif /* JEMALLOC_ARENA_STRUCTS_B */
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-static const size_t large_pad =
-#ifdef JEMALLOC_CACHE_OBLIVIOUS
- PAGE
-#else
- 0
-#endif
- ;
-
-extern purge_mode_t opt_purge;
-extern const char *purge_mode_names[];
-extern ssize_t opt_lg_dirty_mult;
-extern ssize_t opt_decay_time;
-
-extern arena_bin_info_t arena_bin_info[NBINS];
-
-extern size_t map_bias; /* Number of arena chunk header pages. */
-extern size_t map_misc_offset;
-extern size_t arena_maxrun; /* Max run size for arenas. */
-extern size_t large_maxclass; /* Max large size class. */
-extern unsigned nlclasses; /* Number of large size classes. */
-extern unsigned nhclasses; /* Number of huge size classes. */
-
-#ifdef JEMALLOC_JET
-typedef size_t (run_quantize_t)(size_t);
-extern run_quantize_t *run_quantize_floor;
-extern run_quantize_t *run_quantize_ceil;
-#endif
-void arena_chunk_cache_maybe_insert(arena_t *arena, extent_node_t *node,
- bool cache);
-void arena_chunk_cache_maybe_remove(arena_t *arena, extent_node_t *node,
- bool cache);
-extent_node_t *arena_node_alloc(tsdn_t *tsdn, arena_t *arena);
-void arena_node_dalloc(tsdn_t *tsdn, arena_t *arena, extent_node_t *node);
-void *arena_chunk_alloc_huge(tsdn_t *tsdn, arena_t *arena, size_t usize,
- size_t alignment, bool *zero);
-void arena_chunk_dalloc_huge(tsdn_t *tsdn, arena_t *arena, void *chunk,
- size_t usize);
-void arena_chunk_ralloc_huge_similar(tsdn_t *tsdn, arena_t *arena,
- void *chunk, size_t oldsize, size_t usize);
-void arena_chunk_ralloc_huge_shrink(tsdn_t *tsdn, arena_t *arena,
- void *chunk, size_t oldsize, size_t usize);
-bool arena_chunk_ralloc_huge_expand(tsdn_t *tsdn, arena_t *arena,
- void *chunk, size_t oldsize, size_t usize, bool *zero);
-ssize_t arena_lg_dirty_mult_get(tsdn_t *tsdn, arena_t *arena);
-bool arena_lg_dirty_mult_set(tsdn_t *tsdn, arena_t *arena,
- ssize_t lg_dirty_mult);
-ssize_t arena_decay_time_get(tsdn_t *tsdn, arena_t *arena);
-bool arena_decay_time_set(tsdn_t *tsdn, arena_t *arena, ssize_t decay_time);
-void arena_purge(tsdn_t *tsdn, arena_t *arena, bool all);
-void arena_maybe_purge(tsdn_t *tsdn, arena_t *arena);
-void arena_reset(tsd_t *tsd, arena_t *arena);
-void arena_tcache_fill_small(tsdn_t *tsdn, arena_t *arena,
- tcache_bin_t *tbin, szind_t binind, uint64_t prof_accumbytes);
-void arena_alloc_junk_small(void *ptr, arena_bin_info_t *bin_info,
- bool zero);
-#ifdef JEMALLOC_JET
-typedef void (arena_redzone_corruption_t)(void *, size_t, bool, size_t,
- uint8_t);
-extern arena_redzone_corruption_t *arena_redzone_corruption;
-typedef void (arena_dalloc_junk_small_t)(void *, arena_bin_info_t *);
-extern arena_dalloc_junk_small_t *arena_dalloc_junk_small;
-#else
-void arena_dalloc_junk_small(void *ptr, arena_bin_info_t *bin_info);
-#endif
-void arena_quarantine_junk_small(void *ptr, size_t usize);
-void *arena_malloc_large(tsdn_t *tsdn, arena_t *arena, szind_t ind,
- bool zero);
-void *arena_malloc_hard(tsdn_t *tsdn, arena_t *arena, size_t size,
- szind_t ind, bool zero);
-void *arena_palloc(tsdn_t *tsdn, arena_t *arena, size_t usize,
- size_t alignment, bool zero, tcache_t *tcache);
-void arena_prof_promoted(tsdn_t *tsdn, const void *ptr, size_t size);
-void arena_dalloc_bin_junked_locked(tsdn_t *tsdn, arena_t *arena,
- arena_chunk_t *chunk, void *ptr, arena_chunk_map_bits_t *bitselm);
-void arena_dalloc_bin(tsdn_t *tsdn, arena_t *arena, arena_chunk_t *chunk,
- void *ptr, size_t pageind, arena_chunk_map_bits_t *bitselm);
-void arena_dalloc_small(tsdn_t *tsdn, arena_t *arena, arena_chunk_t *chunk,
- void *ptr, size_t pageind);
-#ifdef JEMALLOC_JET
-typedef void (arena_dalloc_junk_large_t)(void *, size_t);
-extern arena_dalloc_junk_large_t *arena_dalloc_junk_large;
-#else
-void arena_dalloc_junk_large(void *ptr, size_t usize);
-#endif
-void arena_dalloc_large_junked_locked(tsdn_t *tsdn, arena_t *arena,
- arena_chunk_t *chunk, void *ptr);
-void arena_dalloc_large(tsdn_t *tsdn, arena_t *arena, arena_chunk_t *chunk,
- void *ptr);
-#ifdef JEMALLOC_JET
-typedef void (arena_ralloc_junk_large_t)(void *, size_t, size_t);
-extern arena_ralloc_junk_large_t *arena_ralloc_junk_large;
-#endif
-bool arena_ralloc_no_move(tsdn_t *tsdn, void *ptr, size_t oldsize,
- size_t size, size_t extra, bool zero);
-void *arena_ralloc(tsd_t *tsd, arena_t *arena, void *ptr, size_t oldsize,
- size_t size, size_t alignment, bool zero, tcache_t *tcache);
-dss_prec_t arena_dss_prec_get(tsdn_t *tsdn, arena_t *arena);
-bool arena_dss_prec_set(tsdn_t *tsdn, arena_t *arena, dss_prec_t dss_prec);
-ssize_t arena_lg_dirty_mult_default_get(void);
-bool arena_lg_dirty_mult_default_set(ssize_t lg_dirty_mult);
-ssize_t arena_decay_time_default_get(void);
-bool arena_decay_time_default_set(ssize_t decay_time);
-void arena_basic_stats_merge(tsdn_t *tsdn, arena_t *arena,
- unsigned *nthreads, const char **dss, ssize_t *lg_dirty_mult,
- ssize_t *decay_time, size_t *nactive, size_t *ndirty);
-void arena_stats_merge(tsdn_t *tsdn, arena_t *arena, unsigned *nthreads,
- const char **dss, ssize_t *lg_dirty_mult, ssize_t *decay_time,
- size_t *nactive, size_t *ndirty, arena_stats_t *astats,
- malloc_bin_stats_t *bstats, malloc_large_stats_t *lstats,
- malloc_huge_stats_t *hstats);
-unsigned arena_nthreads_get(arena_t *arena, bool internal);
-void arena_nthreads_inc(arena_t *arena, bool internal);
-void arena_nthreads_dec(arena_t *arena, bool internal);
-arena_t *arena_new(tsdn_t *tsdn, unsigned ind);
-void arena_boot(void);
-void arena_prefork0(tsdn_t *tsdn, arena_t *arena);
-void arena_prefork1(tsdn_t *tsdn, arena_t *arena);
-void arena_prefork2(tsdn_t *tsdn, arena_t *arena);
-void arena_prefork3(tsdn_t *tsdn, arena_t *arena);
-void arena_postfork_parent(tsdn_t *tsdn, arena_t *arena);
-void arena_postfork_child(tsdn_t *tsdn, arena_t *arena);
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-#ifndef JEMALLOC_ENABLE_INLINE
-arena_chunk_map_bits_t *arena_bitselm_get_mutable(arena_chunk_t *chunk,
- size_t pageind);
-const arena_chunk_map_bits_t *arena_bitselm_get_const(
- const arena_chunk_t *chunk, size_t pageind);
-arena_chunk_map_misc_t *arena_miscelm_get_mutable(arena_chunk_t *chunk,
- size_t pageind);
-const arena_chunk_map_misc_t *arena_miscelm_get_const(
- const arena_chunk_t *chunk, size_t pageind);
-size_t arena_miscelm_to_pageind(const arena_chunk_map_misc_t *miscelm);
-void *arena_miscelm_to_rpages(const arena_chunk_map_misc_t *miscelm);
-arena_chunk_map_misc_t *arena_rd_to_miscelm(arena_runs_dirty_link_t *rd);
-arena_chunk_map_misc_t *arena_run_to_miscelm(arena_run_t *run);
-size_t *arena_mapbitsp_get_mutable(arena_chunk_t *chunk, size_t pageind);
-const size_t *arena_mapbitsp_get_const(const arena_chunk_t *chunk,
- size_t pageind);
-size_t arena_mapbitsp_read(const size_t *mapbitsp);
-size_t arena_mapbits_get(const arena_chunk_t *chunk, size_t pageind);
-size_t arena_mapbits_size_decode(size_t mapbits);
-size_t arena_mapbits_unallocated_size_get(const arena_chunk_t *chunk,
- size_t pageind);
-size_t arena_mapbits_large_size_get(const arena_chunk_t *chunk,
- size_t pageind);
-size_t arena_mapbits_small_runind_get(const arena_chunk_t *chunk,
- size_t pageind);
-szind_t arena_mapbits_binind_get(const arena_chunk_t *chunk, size_t pageind);
-size_t arena_mapbits_dirty_get(const arena_chunk_t *chunk, size_t pageind);
-size_t arena_mapbits_unzeroed_get(const arena_chunk_t *chunk, size_t pageind);
-size_t arena_mapbits_decommitted_get(const arena_chunk_t *chunk,
- size_t pageind);
-size_t arena_mapbits_large_get(const arena_chunk_t *chunk, size_t pageind);
-size_t arena_mapbits_allocated_get(const arena_chunk_t *chunk, size_t pageind);
-void arena_mapbitsp_write(size_t *mapbitsp, size_t mapbits);
-size_t arena_mapbits_size_encode(size_t size);
-void arena_mapbits_unallocated_set(arena_chunk_t *chunk, size_t pageind,
- size_t size, size_t flags);
-void arena_mapbits_unallocated_size_set(arena_chunk_t *chunk, size_t pageind,
- size_t size);
-void arena_mapbits_internal_set(arena_chunk_t *chunk, size_t pageind,
- size_t flags);
-void arena_mapbits_large_set(arena_chunk_t *chunk, size_t pageind,
- size_t size, size_t flags);
-void arena_mapbits_large_binind_set(arena_chunk_t *chunk, size_t pageind,
- szind_t binind);
-void arena_mapbits_small_set(arena_chunk_t *chunk, size_t pageind,
- size_t runind, szind_t binind, size_t flags);
-void arena_metadata_allocated_add(arena_t *arena, size_t size);
-void arena_metadata_allocated_sub(arena_t *arena, size_t size);
-size_t arena_metadata_allocated_get(arena_t *arena);
-bool arena_prof_accum_impl(arena_t *arena, uint64_t accumbytes);
-bool arena_prof_accum_locked(arena_t *arena, uint64_t accumbytes);
-bool arena_prof_accum(tsdn_t *tsdn, arena_t *arena, uint64_t accumbytes);
-szind_t arena_ptr_small_binind_get(const void *ptr, size_t mapbits);
-szind_t arena_bin_index(arena_t *arena, arena_bin_t *bin);
-size_t arena_run_regind(arena_run_t *run, arena_bin_info_t *bin_info,
- const void *ptr);
-prof_tctx_t *arena_prof_tctx_get(tsdn_t *tsdn, const void *ptr);
-void arena_prof_tctx_set(tsdn_t *tsdn, const void *ptr, size_t usize,
- prof_tctx_t *tctx);
-void arena_prof_tctx_reset(tsdn_t *tsdn, const void *ptr, size_t usize,
- const void *old_ptr, prof_tctx_t *old_tctx);
-void arena_decay_ticks(tsdn_t *tsdn, arena_t *arena, unsigned nticks);
-void arena_decay_tick(tsdn_t *tsdn, arena_t *arena);
-void *arena_malloc(tsdn_t *tsdn, arena_t *arena, size_t size, szind_t ind,
- bool zero, tcache_t *tcache, bool slow_path);
-arena_t *arena_aalloc(const void *ptr);
-size_t arena_salloc(tsdn_t *tsdn, const void *ptr, bool demote);
-void arena_dalloc(tsdn_t *tsdn, void *ptr, tcache_t *tcache, bool slow_path);
-void arena_sdalloc(tsdn_t *tsdn, void *ptr, size_t size, tcache_t *tcache,
- bool slow_path);
-#endif
-
-#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_ARENA_C_))
-# ifdef JEMALLOC_ARENA_INLINE_A
-JEMALLOC_ALWAYS_INLINE arena_chunk_map_bits_t *
-arena_bitselm_get_mutable(arena_chunk_t *chunk, size_t pageind)
-{
-
- assert(pageind >= map_bias);
- assert(pageind < chunk_npages);
-
- return (&chunk->map_bits[pageind-map_bias]);
-}
-
-JEMALLOC_ALWAYS_INLINE const arena_chunk_map_bits_t *
-arena_bitselm_get_const(const arena_chunk_t *chunk, size_t pageind)
-{
-
- return (arena_bitselm_get_mutable((arena_chunk_t *)chunk, pageind));
-}
-
-JEMALLOC_ALWAYS_INLINE arena_chunk_map_misc_t *
-arena_miscelm_get_mutable(arena_chunk_t *chunk, size_t pageind)
-{
-
- assert(pageind >= map_bias);
- assert(pageind < chunk_npages);
-
- return ((arena_chunk_map_misc_t *)((uintptr_t)chunk +
- (uintptr_t)map_misc_offset) + pageind-map_bias);
-}
-
-JEMALLOC_ALWAYS_INLINE const arena_chunk_map_misc_t *
-arena_miscelm_get_const(const arena_chunk_t *chunk, size_t pageind)
-{
-
- return (arena_miscelm_get_mutable((arena_chunk_t *)chunk, pageind));
-}
-
-JEMALLOC_ALWAYS_INLINE size_t
-arena_miscelm_to_pageind(const arena_chunk_map_misc_t *miscelm)
-{
- arena_chunk_t *chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(miscelm);
- size_t pageind = ((uintptr_t)miscelm - ((uintptr_t)chunk +
- map_misc_offset)) / sizeof(arena_chunk_map_misc_t) + map_bias;
-
- assert(pageind >= map_bias);
- assert(pageind < chunk_npages);
-
- return (pageind);
-}
-
-JEMALLOC_ALWAYS_INLINE void *
-arena_miscelm_to_rpages(const arena_chunk_map_misc_t *miscelm)
-{
- arena_chunk_t *chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(miscelm);
- size_t pageind = arena_miscelm_to_pageind(miscelm);
-
- return ((void *)((uintptr_t)chunk + (pageind << LG_PAGE)));
-}
-
-JEMALLOC_ALWAYS_INLINE arena_chunk_map_misc_t *
-arena_rd_to_miscelm(arena_runs_dirty_link_t *rd)
-{
- arena_chunk_map_misc_t *miscelm = (arena_chunk_map_misc_t
- *)((uintptr_t)rd - offsetof(arena_chunk_map_misc_t, rd));
-
- assert(arena_miscelm_to_pageind(miscelm) >= map_bias);
- assert(arena_miscelm_to_pageind(miscelm) < chunk_npages);
-
- return (miscelm);
-}
-
-JEMALLOC_ALWAYS_INLINE arena_chunk_map_misc_t *
-arena_run_to_miscelm(arena_run_t *run)
-{
- arena_chunk_map_misc_t *miscelm = (arena_chunk_map_misc_t
- *)((uintptr_t)run - offsetof(arena_chunk_map_misc_t, run));
-
- assert(arena_miscelm_to_pageind(miscelm) >= map_bias);
- assert(arena_miscelm_to_pageind(miscelm) < chunk_npages);
-
- return (miscelm);
-}
-
-JEMALLOC_ALWAYS_INLINE size_t *
-arena_mapbitsp_get_mutable(arena_chunk_t *chunk, size_t pageind)
-{
-
- return (&arena_bitselm_get_mutable(chunk, pageind)->bits);
-}
-
-JEMALLOC_ALWAYS_INLINE const size_t *
-arena_mapbitsp_get_const(const arena_chunk_t *chunk, size_t pageind)
-{
-
- return (arena_mapbitsp_get_mutable((arena_chunk_t *)chunk, pageind));
-}
-
-JEMALLOC_ALWAYS_INLINE size_t
-arena_mapbitsp_read(const size_t *mapbitsp)
-{
-
- return (*mapbitsp);
-}
-
-JEMALLOC_ALWAYS_INLINE size_t
-arena_mapbits_get(const arena_chunk_t *chunk, size_t pageind)
-{
-
- return (arena_mapbitsp_read(arena_mapbitsp_get_const(chunk, pageind)));
-}
-
-JEMALLOC_ALWAYS_INLINE size_t
-arena_mapbits_size_decode(size_t mapbits)
-{
- size_t size;
-
-#if CHUNK_MAP_SIZE_SHIFT > 0
- size = (mapbits & CHUNK_MAP_SIZE_MASK) >> CHUNK_MAP_SIZE_SHIFT;
-#elif CHUNK_MAP_SIZE_SHIFT == 0
- size = mapbits & CHUNK_MAP_SIZE_MASK;
-#else
- size = (mapbits & CHUNK_MAP_SIZE_MASK) << -CHUNK_MAP_SIZE_SHIFT;
-#endif
-
- return (size);
-}
-
-JEMALLOC_ALWAYS_INLINE size_t
-arena_mapbits_unallocated_size_get(const arena_chunk_t *chunk, size_t pageind)
-{
- size_t mapbits;
-
- mapbits = arena_mapbits_get(chunk, pageind);
- assert((mapbits & (CHUNK_MAP_LARGE|CHUNK_MAP_ALLOCATED)) == 0);
- return (arena_mapbits_size_decode(mapbits));
-}
-
-JEMALLOC_ALWAYS_INLINE size_t
-arena_mapbits_large_size_get(const arena_chunk_t *chunk, size_t pageind)
-{
- size_t mapbits;
-
- mapbits = arena_mapbits_get(chunk, pageind);
- assert((mapbits & (CHUNK_MAP_LARGE|CHUNK_MAP_ALLOCATED)) ==
- (CHUNK_MAP_LARGE|CHUNK_MAP_ALLOCATED));
- return (arena_mapbits_size_decode(mapbits));
-}
-
-JEMALLOC_ALWAYS_INLINE size_t
-arena_mapbits_small_runind_get(const arena_chunk_t *chunk, size_t pageind)
-{
- size_t mapbits;
-
- mapbits = arena_mapbits_get(chunk, pageind);
- assert((mapbits & (CHUNK_MAP_LARGE|CHUNK_MAP_ALLOCATED)) ==
- CHUNK_MAP_ALLOCATED);
- return (mapbits >> CHUNK_MAP_RUNIND_SHIFT);
-}
-
-JEMALLOC_ALWAYS_INLINE szind_t
-arena_mapbits_binind_get(const arena_chunk_t *chunk, size_t pageind)
-{
- size_t mapbits;
- szind_t binind;
-
- mapbits = arena_mapbits_get(chunk, pageind);
- binind = (mapbits & CHUNK_MAP_BININD_MASK) >> CHUNK_MAP_BININD_SHIFT;
- assert(binind < NBINS || binind == BININD_INVALID);
- return (binind);
-}
-
-JEMALLOC_ALWAYS_INLINE size_t
-arena_mapbits_dirty_get(const arena_chunk_t *chunk, size_t pageind)
-{
- size_t mapbits;
-
- mapbits = arena_mapbits_get(chunk, pageind);
- assert((mapbits & CHUNK_MAP_DECOMMITTED) == 0 || (mapbits &
- (CHUNK_MAP_DIRTY|CHUNK_MAP_UNZEROED)) == 0);
- return (mapbits & CHUNK_MAP_DIRTY);
-}
-
-JEMALLOC_ALWAYS_INLINE size_t
-arena_mapbits_unzeroed_get(const arena_chunk_t *chunk, size_t pageind)
-{
- size_t mapbits;
-
- mapbits = arena_mapbits_get(chunk, pageind);
- assert((mapbits & CHUNK_MAP_DECOMMITTED) == 0 || (mapbits &
- (CHUNK_MAP_DIRTY|CHUNK_MAP_UNZEROED)) == 0);
- return (mapbits & CHUNK_MAP_UNZEROED);
-}
-
-JEMALLOC_ALWAYS_INLINE size_t
-arena_mapbits_decommitted_get(const arena_chunk_t *chunk, size_t pageind)
-{
- size_t mapbits;
-
- mapbits = arena_mapbits_get(chunk, pageind);
- assert((mapbits & CHUNK_MAP_DECOMMITTED) == 0 || (mapbits &
- (CHUNK_MAP_DIRTY|CHUNK_MAP_UNZEROED)) == 0);
- return (mapbits & CHUNK_MAP_DECOMMITTED);
-}
-
-JEMALLOC_ALWAYS_INLINE size_t
-arena_mapbits_large_get(const arena_chunk_t *chunk, size_t pageind)
-{
- size_t mapbits;
-
- mapbits = arena_mapbits_get(chunk, pageind);
- return (mapbits & CHUNK_MAP_LARGE);
-}
-
-JEMALLOC_ALWAYS_INLINE size_t
-arena_mapbits_allocated_get(const arena_chunk_t *chunk, size_t pageind)
-{
- size_t mapbits;
-
- mapbits = arena_mapbits_get(chunk, pageind);
- return (mapbits & CHUNK_MAP_ALLOCATED);
-}
-
-JEMALLOC_ALWAYS_INLINE void
-arena_mapbitsp_write(size_t *mapbitsp, size_t mapbits)
-{
-
- *mapbitsp = mapbits;
-}
-
-JEMALLOC_ALWAYS_INLINE size_t
-arena_mapbits_size_encode(size_t size)
-{
- size_t mapbits;
-
-#if CHUNK_MAP_SIZE_SHIFT > 0
- mapbits = size << CHUNK_MAP_SIZE_SHIFT;
-#elif CHUNK_MAP_SIZE_SHIFT == 0
- mapbits = size;
-#else
- mapbits = size >> -CHUNK_MAP_SIZE_SHIFT;
-#endif
-
- assert((mapbits & ~CHUNK_MAP_SIZE_MASK) == 0);
- return (mapbits);
-}
-
-JEMALLOC_ALWAYS_INLINE void
-arena_mapbits_unallocated_set(arena_chunk_t *chunk, size_t pageind, size_t size,
- size_t flags)
-{
- size_t *mapbitsp = arena_mapbitsp_get_mutable(chunk, pageind);
-
- assert((size & PAGE_MASK) == 0);
- assert((flags & CHUNK_MAP_FLAGS_MASK) == flags);
- assert((flags & CHUNK_MAP_DECOMMITTED) == 0 || (flags &
- (CHUNK_MAP_DIRTY|CHUNK_MAP_UNZEROED)) == 0);
- arena_mapbitsp_write(mapbitsp, arena_mapbits_size_encode(size) |
- CHUNK_MAP_BININD_INVALID | flags);
-}
-
-JEMALLOC_ALWAYS_INLINE void
-arena_mapbits_unallocated_size_set(arena_chunk_t *chunk, size_t pageind,
- size_t size)
-{
- size_t *mapbitsp = arena_mapbitsp_get_mutable(chunk, pageind);
- size_t mapbits = arena_mapbitsp_read(mapbitsp);
-
- assert((size & PAGE_MASK) == 0);
- assert((mapbits & (CHUNK_MAP_LARGE|CHUNK_MAP_ALLOCATED)) == 0);
- arena_mapbitsp_write(mapbitsp, arena_mapbits_size_encode(size) |
- (mapbits & ~CHUNK_MAP_SIZE_MASK));
-}
-
-JEMALLOC_ALWAYS_INLINE void
-arena_mapbits_internal_set(arena_chunk_t *chunk, size_t pageind, size_t flags)
-{
- size_t *mapbitsp = arena_mapbitsp_get_mutable(chunk, pageind);
-
- assert((flags & CHUNK_MAP_UNZEROED) == flags);
- arena_mapbitsp_write(mapbitsp, flags);
-}
-
-JEMALLOC_ALWAYS_INLINE void
-arena_mapbits_large_set(arena_chunk_t *chunk, size_t pageind, size_t size,
- size_t flags)
-{
- size_t *mapbitsp = arena_mapbitsp_get_mutable(chunk, pageind);
-
- assert((size & PAGE_MASK) == 0);
- assert((flags & CHUNK_MAP_FLAGS_MASK) == flags);
- assert((flags & CHUNK_MAP_DECOMMITTED) == 0 || (flags &
- (CHUNK_MAP_DIRTY|CHUNK_MAP_UNZEROED)) == 0);
- arena_mapbitsp_write(mapbitsp, arena_mapbits_size_encode(size) |
- CHUNK_MAP_BININD_INVALID | flags | CHUNK_MAP_LARGE |
- CHUNK_MAP_ALLOCATED);
-}
-
-JEMALLOC_ALWAYS_INLINE void
-arena_mapbits_large_binind_set(arena_chunk_t *chunk, size_t pageind,
- szind_t binind)
-{
- size_t *mapbitsp = arena_mapbitsp_get_mutable(chunk, pageind);
- size_t mapbits = arena_mapbitsp_read(mapbitsp);
-
- assert(binind <= BININD_INVALID);
- assert(arena_mapbits_large_size_get(chunk, pageind) == LARGE_MINCLASS +
- large_pad);
- arena_mapbitsp_write(mapbitsp, (mapbits & ~CHUNK_MAP_BININD_MASK) |
- (binind << CHUNK_MAP_BININD_SHIFT));
-}
-
-JEMALLOC_ALWAYS_INLINE void
-arena_mapbits_small_set(arena_chunk_t *chunk, size_t pageind, size_t runind,
- szind_t binind, size_t flags)
-{
- size_t *mapbitsp = arena_mapbitsp_get_mutable(chunk, pageind);
-
- assert(binind < BININD_INVALID);
- assert(pageind - runind >= map_bias);
- assert((flags & CHUNK_MAP_UNZEROED) == flags);
- arena_mapbitsp_write(mapbitsp, (runind << CHUNK_MAP_RUNIND_SHIFT) |
- (binind << CHUNK_MAP_BININD_SHIFT) | flags | CHUNK_MAP_ALLOCATED);
-}
-
-JEMALLOC_INLINE void
-arena_metadata_allocated_add(arena_t *arena, size_t size)
-{
-
- atomic_add_z(&arena->stats.metadata_allocated, size);
-}
-
-JEMALLOC_INLINE void
-arena_metadata_allocated_sub(arena_t *arena, size_t size)
-{
-
- atomic_sub_z(&arena->stats.metadata_allocated, size);
-}
-
-JEMALLOC_INLINE size_t
-arena_metadata_allocated_get(arena_t *arena)
-{
-
- return (atomic_read_z(&arena->stats.metadata_allocated));
-}
-
-JEMALLOC_INLINE bool
-arena_prof_accum_impl(arena_t *arena, uint64_t accumbytes)
-{
-
- cassert(config_prof);
- assert(prof_interval != 0);
-
- arena->prof_accumbytes += accumbytes;
- if (arena->prof_accumbytes >= prof_interval) {
- arena->prof_accumbytes -= prof_interval;
- return (true);
- }
- return (false);
-}
-
-JEMALLOC_INLINE bool
-arena_prof_accum_locked(arena_t *arena, uint64_t accumbytes)
-{
-
- cassert(config_prof);
-
- if (likely(prof_interval == 0))
- return (false);
- return (arena_prof_accum_impl(arena, accumbytes));
-}
-
-JEMALLOC_INLINE bool
-arena_prof_accum(tsdn_t *tsdn, arena_t *arena, uint64_t accumbytes)
-{
-
- cassert(config_prof);
-
- if (likely(prof_interval == 0))
- return (false);
-
- {
- bool ret;
-
- malloc_mutex_lock(tsdn, &arena->lock);
- ret = arena_prof_accum_impl(arena, accumbytes);
- malloc_mutex_unlock(tsdn, &arena->lock);
- return (ret);
- }
-}
-
-JEMALLOC_ALWAYS_INLINE szind_t
-arena_ptr_small_binind_get(const void *ptr, size_t mapbits)
-{
- szind_t binind;
-
- binind = (mapbits & CHUNK_MAP_BININD_MASK) >> CHUNK_MAP_BININD_SHIFT;
-
- if (config_debug) {
- arena_chunk_t *chunk;
- arena_t *arena;
- size_t pageind;
- size_t actual_mapbits;
- size_t rpages_ind;
- const arena_run_t *run;
- arena_bin_t *bin;
- szind_t run_binind, actual_binind;
- arena_bin_info_t *bin_info;
- const arena_chunk_map_misc_t *miscelm;
- const void *rpages;
-
- assert(binind != BININD_INVALID);
- assert(binind < NBINS);
- chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr);
- arena = extent_node_arena_get(&chunk->node);
- pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> LG_PAGE;
- actual_mapbits = arena_mapbits_get(chunk, pageind);
- assert(mapbits == actual_mapbits);
- assert(arena_mapbits_large_get(chunk, pageind) == 0);
- assert(arena_mapbits_allocated_get(chunk, pageind) != 0);
- rpages_ind = pageind - arena_mapbits_small_runind_get(chunk,
- pageind);
- miscelm = arena_miscelm_get_const(chunk, rpages_ind);
- run = &miscelm->run;
- run_binind = run->binind;
- bin = &arena->bins[run_binind];
- actual_binind = (szind_t)(bin - arena->bins);
- assert(run_binind == actual_binind);
- bin_info = &arena_bin_info[actual_binind];
- rpages = arena_miscelm_to_rpages(miscelm);
- assert(((uintptr_t)ptr - ((uintptr_t)rpages +
- (uintptr_t)bin_info->reg0_offset)) % bin_info->reg_interval
- == 0);
- }
-
- return (binind);
-}
-# endif /* JEMALLOC_ARENA_INLINE_A */
-
-# ifdef JEMALLOC_ARENA_INLINE_B
-JEMALLOC_INLINE szind_t
-arena_bin_index(arena_t *arena, arena_bin_t *bin)
-{
- szind_t binind = (szind_t)(bin - arena->bins);
- assert(binind < NBINS);
- return (binind);
-}
-
-JEMALLOC_INLINE size_t
-arena_run_regind(arena_run_t *run, arena_bin_info_t *bin_info, const void *ptr)
-{
- size_t diff, interval, shift, regind;
- arena_chunk_map_misc_t *miscelm = arena_run_to_miscelm(run);
- void *rpages = arena_miscelm_to_rpages(miscelm);
-
- /*
- * Freeing a pointer lower than region zero can cause assertion
- * failure.
- */
- assert((uintptr_t)ptr >= (uintptr_t)rpages +
- (uintptr_t)bin_info->reg0_offset);
-
- /*
- * Avoid doing division with a variable divisor if possible. Using
- * actual division here can reduce allocator throughput by over 20%!
- */
- diff = (size_t)((uintptr_t)ptr - (uintptr_t)rpages -
- bin_info->reg0_offset);
-
- /* Rescale (factor powers of 2 out of the numerator and denominator). */
- interval = bin_info->reg_interval;
- shift = ffs_zu(interval) - 1;
- diff >>= shift;
- interval >>= shift;
-
- if (interval == 1) {
- /* The divisor was a power of 2. */
- regind = diff;
- } else {
- /*
- * To divide by a number D that is not a power of two we
- * multiply by (2^21 / D) and then right shift by 21 positions.
- *
- * X / D
- *
- * becomes
- *
- * (X * interval_invs[D - 3]) >> SIZE_INV_SHIFT
- *
- * We can omit the first three elements, because we never
- * divide by 0, and 1 and 2 are both powers of two, which are
- * handled above.
- */
-#define SIZE_INV_SHIFT ((sizeof(size_t) << 3) - LG_RUN_MAXREGS)
-#define SIZE_INV(s) (((ZU(1) << SIZE_INV_SHIFT) / (s)) + 1)
- static const size_t interval_invs[] = {
- SIZE_INV(3),
- SIZE_INV(4), SIZE_INV(5), SIZE_INV(6), SIZE_INV(7),
- SIZE_INV(8), SIZE_INV(9), SIZE_INV(10), SIZE_INV(11),
- SIZE_INV(12), SIZE_INV(13), SIZE_INV(14), SIZE_INV(15),
- SIZE_INV(16), SIZE_INV(17), SIZE_INV(18), SIZE_INV(19),
- SIZE_INV(20), SIZE_INV(21), SIZE_INV(22), SIZE_INV(23),
- SIZE_INV(24), SIZE_INV(25), SIZE_INV(26), SIZE_INV(27),
- SIZE_INV(28), SIZE_INV(29), SIZE_INV(30), SIZE_INV(31)
- };
-
- if (likely(interval <= ((sizeof(interval_invs) / sizeof(size_t))
- + 2))) {
- regind = (diff * interval_invs[interval - 3]) >>
- SIZE_INV_SHIFT;
- } else
- regind = diff / interval;
-#undef SIZE_INV
-#undef SIZE_INV_SHIFT
- }
- assert(diff == regind * interval);
- assert(regind < bin_info->nregs);
-
- return (regind);
-}
-
-JEMALLOC_INLINE prof_tctx_t *
-arena_prof_tctx_get(tsdn_t *tsdn, const void *ptr)
-{
- prof_tctx_t *ret;
- arena_chunk_t *chunk;
-
- cassert(config_prof);
- assert(ptr != NULL);
-
- chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr);
- if (likely(chunk != ptr)) {
- size_t pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> LG_PAGE;
- size_t mapbits = arena_mapbits_get(chunk, pageind);
- assert((mapbits & CHUNK_MAP_ALLOCATED) != 0);
- if (likely((mapbits & CHUNK_MAP_LARGE) == 0))
- ret = (prof_tctx_t *)(uintptr_t)1U;
- else {
- arena_chunk_map_misc_t *elm =
- arena_miscelm_get_mutable(chunk, pageind);
- ret = atomic_read_p(&elm->prof_tctx_pun);
- }
- } else
- ret = huge_prof_tctx_get(tsdn, ptr);
-
- return (ret);
-}
-
-JEMALLOC_INLINE void
-arena_prof_tctx_set(tsdn_t *tsdn, const void *ptr, size_t usize,
- prof_tctx_t *tctx)
-{
- arena_chunk_t *chunk;
-
- cassert(config_prof);
- assert(ptr != NULL);
-
- chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr);
- if (likely(chunk != ptr)) {
- size_t pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> LG_PAGE;
-
- assert(arena_mapbits_allocated_get(chunk, pageind) != 0);
-
- if (unlikely(usize > SMALL_MAXCLASS || (uintptr_t)tctx >
- (uintptr_t)1U)) {
- arena_chunk_map_misc_t *elm;
-
- assert(arena_mapbits_large_get(chunk, pageind) != 0);
-
- elm = arena_miscelm_get_mutable(chunk, pageind);
- atomic_write_p(&elm->prof_tctx_pun, tctx);
- } else {
- /*
- * tctx must always be initialized for large runs.
- * Assert that the surrounding conditional logic is
- * equivalent to checking whether ptr refers to a large
- * run.
- */
- assert(arena_mapbits_large_get(chunk, pageind) == 0);
- }
- } else
- huge_prof_tctx_set(tsdn, ptr, tctx);
-}
-
-JEMALLOC_INLINE void
-arena_prof_tctx_reset(tsdn_t *tsdn, const void *ptr, size_t usize,
- const void *old_ptr, prof_tctx_t *old_tctx)
-{
-
- cassert(config_prof);
- assert(ptr != NULL);
-
- if (unlikely(usize > SMALL_MAXCLASS || (ptr == old_ptr &&
- (uintptr_t)old_tctx > (uintptr_t)1U))) {
- arena_chunk_t *chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr);
- if (likely(chunk != ptr)) {
- size_t pageind;
- arena_chunk_map_misc_t *elm;
-
- pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >>
- LG_PAGE;
- assert(arena_mapbits_allocated_get(chunk, pageind) !=
- 0);
- assert(arena_mapbits_large_get(chunk, pageind) != 0);
-
- elm = arena_miscelm_get_mutable(chunk, pageind);
- atomic_write_p(&elm->prof_tctx_pun,
- (prof_tctx_t *)(uintptr_t)1U);
- } else
- huge_prof_tctx_reset(tsdn, ptr);
- }
-}
-
-JEMALLOC_ALWAYS_INLINE void
-arena_decay_ticks(tsdn_t *tsdn, arena_t *arena, unsigned nticks)
-{
- tsd_t *tsd;
- ticker_t *decay_ticker;
-
- if (unlikely(tsdn_null(tsdn)))
- return;
- tsd = tsdn_tsd(tsdn);
- decay_ticker = decay_ticker_get(tsd, arena->ind);
- if (unlikely(decay_ticker == NULL))
- return;
- if (unlikely(ticker_ticks(decay_ticker, nticks)))
- arena_purge(tsdn, arena, false);
-}
-
-JEMALLOC_ALWAYS_INLINE void
-arena_decay_tick(tsdn_t *tsdn, arena_t *arena)
-{
-
- arena_decay_ticks(tsdn, arena, 1);
-}
-
-JEMALLOC_ALWAYS_INLINE void *
-arena_malloc(tsdn_t *tsdn, arena_t *arena, size_t size, szind_t ind, bool zero,
- tcache_t *tcache, bool slow_path)
-{
-
- assert(!tsdn_null(tsdn) || tcache == NULL);
- assert(size != 0);
-
- if (likely(tcache != NULL)) {
- if (likely(size <= SMALL_MAXCLASS)) {
- return (tcache_alloc_small(tsdn_tsd(tsdn), arena,
- tcache, size, ind, zero, slow_path));
- }
- if (likely(size <= tcache_maxclass)) {
- return (tcache_alloc_large(tsdn_tsd(tsdn), arena,
- tcache, size, ind, zero, slow_path));
- }
- /* (size > tcache_maxclass) case falls through. */
- assert(size > tcache_maxclass);
- }
-
- return (arena_malloc_hard(tsdn, arena, size, ind, zero));
-}
-
-JEMALLOC_ALWAYS_INLINE arena_t *
-arena_aalloc(const void *ptr)
-{
- arena_chunk_t *chunk;
-
- chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr);
- if (likely(chunk != ptr))
- return (extent_node_arena_get(&chunk->node));
- else
- return (huge_aalloc(ptr));
-}
-
-/* Return the size of the allocation pointed to by ptr. */
-JEMALLOC_ALWAYS_INLINE size_t
-arena_salloc(tsdn_t *tsdn, const void *ptr, bool demote)
-{
- size_t ret;
- arena_chunk_t *chunk;
- size_t pageind;
- szind_t binind;
-
- assert(ptr != NULL);
-
- chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr);
- if (likely(chunk != ptr)) {
- pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> LG_PAGE;
- assert(arena_mapbits_allocated_get(chunk, pageind) != 0);
- binind = arena_mapbits_binind_get(chunk, pageind);
- if (unlikely(binind == BININD_INVALID || (config_prof && !demote
- && arena_mapbits_large_get(chunk, pageind) != 0))) {
- /*
- * Large allocation. In the common case (demote), and
- * as this is an inline function, most callers will only
- * end up looking at binind to determine that ptr is a
- * small allocation.
- */
- assert(config_cache_oblivious || ((uintptr_t)ptr &
- PAGE_MASK) == 0);
- ret = arena_mapbits_large_size_get(chunk, pageind) -
- large_pad;
- assert(ret != 0);
- assert(pageind + ((ret+large_pad)>>LG_PAGE) <=
- chunk_npages);
- assert(arena_mapbits_dirty_get(chunk, pageind) ==
- arena_mapbits_dirty_get(chunk,
- pageind+((ret+large_pad)>>LG_PAGE)-1));
- } else {
- /*
- * Small allocation (possibly promoted to a large
- * object).
- */
- assert(arena_mapbits_large_get(chunk, pageind) != 0 ||
- arena_ptr_small_binind_get(ptr,
- arena_mapbits_get(chunk, pageind)) == binind);
- ret = index2size(binind);
- }
- } else
- ret = huge_salloc(tsdn, ptr);
-
- return (ret);
-}
-
-JEMALLOC_ALWAYS_INLINE void
-arena_dalloc(tsdn_t *tsdn, void *ptr, tcache_t *tcache, bool slow_path)
-{
- arena_chunk_t *chunk;
- size_t pageind, mapbits;
-
- assert(!tsdn_null(tsdn) || tcache == NULL);
- assert(ptr != NULL);
-
- chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr);
- if (likely(chunk != ptr)) {
- pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> LG_PAGE;
- mapbits = arena_mapbits_get(chunk, pageind);
- assert(arena_mapbits_allocated_get(chunk, pageind) != 0);
- if (likely((mapbits & CHUNK_MAP_LARGE) == 0)) {
- /* Small allocation. */
- if (likely(tcache != NULL)) {
- szind_t binind = arena_ptr_small_binind_get(ptr,
- mapbits);
- tcache_dalloc_small(tsdn_tsd(tsdn), tcache, ptr,
- binind, slow_path);
- } else {
- arena_dalloc_small(tsdn,
- extent_node_arena_get(&chunk->node), chunk,
- ptr, pageind);
- }
- } else {
- size_t size = arena_mapbits_large_size_get(chunk,
- pageind);
-
- assert(config_cache_oblivious || ((uintptr_t)ptr &
- PAGE_MASK) == 0);
-
- if (likely(tcache != NULL) && size - large_pad <=
- tcache_maxclass) {
- tcache_dalloc_large(tsdn_tsd(tsdn), tcache, ptr,
- size - large_pad, slow_path);
- } else {
- arena_dalloc_large(tsdn,
- extent_node_arena_get(&chunk->node), chunk,
- ptr);
- }
- }
- } else
- huge_dalloc(tsdn, ptr);
-}
-
-JEMALLOC_ALWAYS_INLINE void
-arena_sdalloc(tsdn_t *tsdn, void *ptr, size_t size, tcache_t *tcache,
- bool slow_path)
-{
- arena_chunk_t *chunk;
-
- assert(!tsdn_null(tsdn) || tcache == NULL);
-
- chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr);
- if (likely(chunk != ptr)) {
- if (config_prof && opt_prof) {
- size_t pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >>
- LG_PAGE;
- assert(arena_mapbits_allocated_get(chunk, pageind) !=
- 0);
- if (arena_mapbits_large_get(chunk, pageind) != 0) {
- /*
- * Make sure to use promoted size, not request
- * size.
- */
- size = arena_mapbits_large_size_get(chunk,
- pageind) - large_pad;
- }
- }
- assert(s2u(size) == s2u(arena_salloc(tsdn, ptr, false)));
-
- if (likely(size <= SMALL_MAXCLASS)) {
- /* Small allocation. */
- if (likely(tcache != NULL)) {
- szind_t binind = size2index(size);
- tcache_dalloc_small(tsdn_tsd(tsdn), tcache, ptr,
- binind, slow_path);
- } else {
- size_t pageind = ((uintptr_t)ptr -
- (uintptr_t)chunk) >> LG_PAGE;
- arena_dalloc_small(tsdn,
- extent_node_arena_get(&chunk->node), chunk,
- ptr, pageind);
- }
- } else {
- assert(config_cache_oblivious || ((uintptr_t)ptr &
- PAGE_MASK) == 0);
-
- if (likely(tcache != NULL) && size <= tcache_maxclass) {
- tcache_dalloc_large(tsdn_tsd(tsdn), tcache, ptr,
- size, slow_path);
- } else {
- arena_dalloc_large(tsdn,
- extent_node_arena_get(&chunk->node), chunk,
- ptr);
- }
- }
- } else
- huge_dalloc(tsdn, ptr);
-}
-# endif /* JEMALLOC_ARENA_INLINE_B */
-#endif
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
diff --git a/memory/jemalloc/src/include/jemalloc/internal/assert.h b/memory/jemalloc/src/include/jemalloc/internal/assert.h
deleted file mode 100644
index 6f8f7eb931..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/assert.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Define a custom assert() in order to reduce the chances of deadlock during
- * assertion failure.
- */
-#ifndef assert
-#define assert(e) do { \
- if (unlikely(config_debug && !(e))) { \
- malloc_printf( \
- "<jemalloc>: %s:%d: Failed assertion: \"%s\"\n", \
- __FILE__, __LINE__, #e); \
- abort(); \
- } \
-} while (0)
-#endif
-
-#ifndef not_reached
-#define not_reached() do { \
- if (config_debug) { \
- malloc_printf( \
- "<jemalloc>: %s:%d: Unreachable code reached\n", \
- __FILE__, __LINE__); \
- abort(); \
- } \
- unreachable(); \
-} while (0)
-#endif
-
-#ifndef not_implemented
-#define not_implemented() do { \
- if (config_debug) { \
- malloc_printf("<jemalloc>: %s:%d: Not implemented\n", \
- __FILE__, __LINE__); \
- abort(); \
- } \
-} while (0)
-#endif
-
-#ifndef assert_not_implemented
-#define assert_not_implemented(e) do { \
- if (unlikely(config_debug && !(e))) \
- not_implemented(); \
-} while (0)
-#endif
-
-
diff --git a/memory/jemalloc/src/include/jemalloc/internal/atomic.h b/memory/jemalloc/src/include/jemalloc/internal/atomic.h
deleted file mode 100644
index 3f15ea1499..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/atomic.h
+++ /dev/null
@@ -1,651 +0,0 @@
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-#define atomic_read_uint64(p) atomic_add_uint64(p, 0)
-#define atomic_read_uint32(p) atomic_add_uint32(p, 0)
-#define atomic_read_p(p) atomic_add_p(p, NULL)
-#define atomic_read_z(p) atomic_add_z(p, 0)
-#define atomic_read_u(p) atomic_add_u(p, 0)
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-/*
- * All arithmetic functions return the arithmetic result of the atomic
- * operation. Some atomic operation APIs return the value prior to mutation, in
- * which case the following functions must redundantly compute the result so
- * that it can be returned. These functions are normally inlined, so the extra
- * operations can be optimized away if the return values aren't used by the
- * callers.
- *
- * <t> atomic_read_<t>(<t> *p) { return (*p); }
- * <t> atomic_add_<t>(<t> *p, <t> x) { return (*p += x); }
- * <t> atomic_sub_<t>(<t> *p, <t> x) { return (*p -= x); }
- * bool atomic_cas_<t>(<t> *p, <t> c, <t> s)
- * {
- * if (*p != c)
- * return (true);
- * *p = s;
- * return (false);
- * }
- * void atomic_write_<t>(<t> *p, <t> x) { *p = x; }
- */
-
-#ifndef JEMALLOC_ENABLE_INLINE
-uint64_t atomic_add_uint64(uint64_t *p, uint64_t x);
-uint64_t atomic_sub_uint64(uint64_t *p, uint64_t x);
-bool atomic_cas_uint64(uint64_t *p, uint64_t c, uint64_t s);
-void atomic_write_uint64(uint64_t *p, uint64_t x);
-uint32_t atomic_add_uint32(uint32_t *p, uint32_t x);
-uint32_t atomic_sub_uint32(uint32_t *p, uint32_t x);
-bool atomic_cas_uint32(uint32_t *p, uint32_t c, uint32_t s);
-void atomic_write_uint32(uint32_t *p, uint32_t x);
-void *atomic_add_p(void **p, void *x);
-void *atomic_sub_p(void **p, void *x);
-bool atomic_cas_p(void **p, void *c, void *s);
-void atomic_write_p(void **p, const void *x);
-size_t atomic_add_z(size_t *p, size_t x);
-size_t atomic_sub_z(size_t *p, size_t x);
-bool atomic_cas_z(size_t *p, size_t c, size_t s);
-void atomic_write_z(size_t *p, size_t x);
-unsigned atomic_add_u(unsigned *p, unsigned x);
-unsigned atomic_sub_u(unsigned *p, unsigned x);
-bool atomic_cas_u(unsigned *p, unsigned c, unsigned s);
-void atomic_write_u(unsigned *p, unsigned x);
-#endif
-
-#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_ATOMIC_C_))
-/******************************************************************************/
-/* 64-bit operations. */
-#if (LG_SIZEOF_PTR == 3 || LG_SIZEOF_INT == 3)
-# if (defined(__amd64__) || defined(__x86_64__))
-JEMALLOC_INLINE uint64_t
-atomic_add_uint64(uint64_t *p, uint64_t x)
-{
- uint64_t t = x;
-
- asm volatile (
- "lock; xaddq %0, %1;"
- : "+r" (t), "=m" (*p) /* Outputs. */
- : "m" (*p) /* Inputs. */
- );
-
- return (t + x);
-}
-
-JEMALLOC_INLINE uint64_t
-atomic_sub_uint64(uint64_t *p, uint64_t x)
-{
- uint64_t t;
-
- x = (uint64_t)(-(int64_t)x);
- t = x;
- asm volatile (
- "lock; xaddq %0, %1;"
- : "+r" (t), "=m" (*p) /* Outputs. */
- : "m" (*p) /* Inputs. */
- );
-
- return (t + x);
-}
-
-JEMALLOC_INLINE bool
-atomic_cas_uint64(uint64_t *p, uint64_t c, uint64_t s)
-{
- uint8_t success;
-
- asm volatile (
- "lock; cmpxchgq %4, %0;"
- "sete %1;"
- : "=m" (*p), "=a" (success) /* Outputs. */
- : "m" (*p), "a" (c), "r" (s) /* Inputs. */
- : "memory" /* Clobbers. */
- );
-
- return (!(bool)success);
-}
-
-JEMALLOC_INLINE void
-atomic_write_uint64(uint64_t *p, uint64_t x)
-{
-
- asm volatile (
- "xchgq %1, %0;" /* Lock is implied by xchgq. */
- : "=m" (*p), "+r" (x) /* Outputs. */
- : "m" (*p) /* Inputs. */
- : "memory" /* Clobbers. */
- );
-}
-# elif (defined(JEMALLOC_C11ATOMICS))
-JEMALLOC_INLINE uint64_t
-atomic_add_uint64(uint64_t *p, uint64_t x)
-{
- volatile atomic_uint_least64_t *a = (volatile atomic_uint_least64_t *)p;
- return (atomic_fetch_add(a, x) + x);
-}
-
-JEMALLOC_INLINE uint64_t
-atomic_sub_uint64(uint64_t *p, uint64_t x)
-{
- volatile atomic_uint_least64_t *a = (volatile atomic_uint_least64_t *)p;
- return (atomic_fetch_sub(a, x) - x);
-}
-
-JEMALLOC_INLINE bool
-atomic_cas_uint64(uint64_t *p, uint64_t c, uint64_t s)
-{
- volatile atomic_uint_least64_t *a = (volatile atomic_uint_least64_t *)p;
- return (!atomic_compare_exchange_strong(a, &c, s));
-}
-
-JEMALLOC_INLINE void
-atomic_write_uint64(uint64_t *p, uint64_t x)
-{
- volatile atomic_uint_least64_t *a = (volatile atomic_uint_least64_t *)p;
- atomic_store(a, x);
-}
-# elif (defined(JEMALLOC_ATOMIC9))
-JEMALLOC_INLINE uint64_t
-atomic_add_uint64(uint64_t *p, uint64_t x)
-{
-
- /*
- * atomic_fetchadd_64() doesn't exist, but we only ever use this
- * function on LP64 systems, so atomic_fetchadd_long() will do.
- */
- assert(sizeof(uint64_t) == sizeof(unsigned long));
-
- return (atomic_fetchadd_long(p, (unsigned long)x) + x);
-}
-
-JEMALLOC_INLINE uint64_t
-atomic_sub_uint64(uint64_t *p, uint64_t x)
-{
-
- assert(sizeof(uint64_t) == sizeof(unsigned long));
-
- return (atomic_fetchadd_long(p, (unsigned long)(-(long)x)) - x);
-}
-
-JEMALLOC_INLINE bool
-atomic_cas_uint64(uint64_t *p, uint64_t c, uint64_t s)
-{
-
- assert(sizeof(uint64_t) == sizeof(unsigned long));
-
- return (!atomic_cmpset_long(p, (unsigned long)c, (unsigned long)s));
-}
-
-JEMALLOC_INLINE void
-atomic_write_uint64(uint64_t *p, uint64_t x)
-{
-
- assert(sizeof(uint64_t) == sizeof(unsigned long));
-
- atomic_store_rel_long(p, x);
-}
-# elif (defined(JEMALLOC_OSATOMIC))
-JEMALLOC_INLINE uint64_t
-atomic_add_uint64(uint64_t *p, uint64_t x)
-{
-
- return (OSAtomicAdd64((int64_t)x, (int64_t *)p));
-}
-
-JEMALLOC_INLINE uint64_t
-atomic_sub_uint64(uint64_t *p, uint64_t x)
-{
-
- return (OSAtomicAdd64(-((int64_t)x), (int64_t *)p));
-}
-
-JEMALLOC_INLINE bool
-atomic_cas_uint64(uint64_t *p, uint64_t c, uint64_t s)
-{
-
- return (!OSAtomicCompareAndSwap64(c, s, (int64_t *)p));
-}
-
-JEMALLOC_INLINE void
-atomic_write_uint64(uint64_t *p, uint64_t x)
-{
- uint64_t o;
-
- /*The documented OSAtomic*() API does not expose an atomic exchange. */
- do {
- o = atomic_read_uint64(p);
- } while (atomic_cas_uint64(p, o, x));
-}
-# elif (defined(_MSC_VER))
-JEMALLOC_INLINE uint64_t
-atomic_add_uint64(uint64_t *p, uint64_t x)
-{
-
- return (InterlockedExchangeAdd64(p, x) + x);
-}
-
-JEMALLOC_INLINE uint64_t
-atomic_sub_uint64(uint64_t *p, uint64_t x)
-{
-
- return (InterlockedExchangeAdd64(p, -((int64_t)x)) - x);
-}
-
-JEMALLOC_INLINE bool
-atomic_cas_uint64(uint64_t *p, uint64_t c, uint64_t s)
-{
- uint64_t o;
-
- o = InterlockedCompareExchange64(p, s, c);
- return (o != c);
-}
-
-JEMALLOC_INLINE void
-atomic_write_uint64(uint64_t *p, uint64_t x)
-{
-
- InterlockedExchange64(p, x);
-}
-# elif (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8) || \
- defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_8))
-JEMALLOC_INLINE uint64_t
-atomic_add_uint64(uint64_t *p, uint64_t x)
-{
-
- return (__sync_add_and_fetch(p, x));
-}
-
-JEMALLOC_INLINE uint64_t
-atomic_sub_uint64(uint64_t *p, uint64_t x)
-{
-
- return (__sync_sub_and_fetch(p, x));
-}
-
-JEMALLOC_INLINE bool
-atomic_cas_uint64(uint64_t *p, uint64_t c, uint64_t s)
-{
-
- return (!__sync_bool_compare_and_swap(p, c, s));
-}
-
-JEMALLOC_INLINE void
-atomic_write_uint64(uint64_t *p, uint64_t x)
-{
-
- __sync_lock_test_and_set(p, x);
-}
-# else
-# error "Missing implementation for 64-bit atomic operations"
-# endif
-#endif
-
-/******************************************************************************/
-/* 32-bit operations. */
-#if (defined(__i386__) || defined(__amd64__) || defined(__x86_64__))
-JEMALLOC_INLINE uint32_t
-atomic_add_uint32(uint32_t *p, uint32_t x)
-{
- uint32_t t = x;
-
- asm volatile (
- "lock; xaddl %0, %1;"
- : "+r" (t), "=m" (*p) /* Outputs. */
- : "m" (*p) /* Inputs. */
- );
-
- return (t + x);
-}
-
-JEMALLOC_INLINE uint32_t
-atomic_sub_uint32(uint32_t *p, uint32_t x)
-{
- uint32_t t;
-
- x = (uint32_t)(-(int32_t)x);
- t = x;
- asm volatile (
- "lock; xaddl %0, %1;"
- : "+r" (t), "=m" (*p) /* Outputs. */
- : "m" (*p) /* Inputs. */
- );
-
- return (t + x);
-}
-
-JEMALLOC_INLINE bool
-atomic_cas_uint32(uint32_t *p, uint32_t c, uint32_t s)
-{
- uint8_t success;
-
- asm volatile (
- "lock; cmpxchgl %4, %0;"
- "sete %1;"
- : "=m" (*p), "=a" (success) /* Outputs. */
- : "m" (*p), "a" (c), "r" (s) /* Inputs. */
- : "memory"
- );
-
- return (!(bool)success);
-}
-
-JEMALLOC_INLINE void
-atomic_write_uint32(uint32_t *p, uint32_t x)
-{
-
- asm volatile (
- "xchgl %1, %0;" /* Lock is implied by xchgl. */
- : "=m" (*p), "+r" (x) /* Outputs. */
- : "m" (*p) /* Inputs. */
- : "memory" /* Clobbers. */
- );
-}
-# elif (defined(JEMALLOC_C11ATOMICS))
-JEMALLOC_INLINE uint32_t
-atomic_add_uint32(uint32_t *p, uint32_t x)
-{
- volatile atomic_uint_least32_t *a = (volatile atomic_uint_least32_t *)p;
- return (atomic_fetch_add(a, x) + x);
-}
-
-JEMALLOC_INLINE uint32_t
-atomic_sub_uint32(uint32_t *p, uint32_t x)
-{
- volatile atomic_uint_least32_t *a = (volatile atomic_uint_least32_t *)p;
- return (atomic_fetch_sub(a, x) - x);
-}
-
-JEMALLOC_INLINE bool
-atomic_cas_uint32(uint32_t *p, uint32_t c, uint32_t s)
-{
- volatile atomic_uint_least32_t *a = (volatile atomic_uint_least32_t *)p;
- return (!atomic_compare_exchange_strong(a, &c, s));
-}
-
-JEMALLOC_INLINE void
-atomic_write_uint32(uint32_t *p, uint32_t x)
-{
- volatile atomic_uint_least32_t *a = (volatile atomic_uint_least32_t *)p;
- atomic_store(a, x);
-}
-#elif (defined(JEMALLOC_ATOMIC9))
-JEMALLOC_INLINE uint32_t
-atomic_add_uint32(uint32_t *p, uint32_t x)
-{
-
- return (atomic_fetchadd_32(p, x) + x);
-}
-
-JEMALLOC_INLINE uint32_t
-atomic_sub_uint32(uint32_t *p, uint32_t x)
-{
-
- return (atomic_fetchadd_32(p, (uint32_t)(-(int32_t)x)) - x);
-}
-
-JEMALLOC_INLINE bool
-atomic_cas_uint32(uint32_t *p, uint32_t c, uint32_t s)
-{
-
- return (!atomic_cmpset_32(p, c, s));
-}
-
-JEMALLOC_INLINE void
-atomic_write_uint32(uint32_t *p, uint32_t x)
-{
-
- atomic_store_rel_32(p, x);
-}
-#elif (defined(JEMALLOC_OSATOMIC))
-JEMALLOC_INLINE uint32_t
-atomic_add_uint32(uint32_t *p, uint32_t x)
-{
-
- return (OSAtomicAdd32((int32_t)x, (int32_t *)p));
-}
-
-JEMALLOC_INLINE uint32_t
-atomic_sub_uint32(uint32_t *p, uint32_t x)
-{
-
- return (OSAtomicAdd32(-((int32_t)x), (int32_t *)p));
-}
-
-JEMALLOC_INLINE bool
-atomic_cas_uint32(uint32_t *p, uint32_t c, uint32_t s)
-{
-
- return (!OSAtomicCompareAndSwap32(c, s, (int32_t *)p));
-}
-
-JEMALLOC_INLINE void
-atomic_write_uint32(uint32_t *p, uint32_t x)
-{
- uint32_t o;
-
- /*The documented OSAtomic*() API does not expose an atomic exchange. */
- do {
- o = atomic_read_uint32(p);
- } while (atomic_cas_uint32(p, o, x));
-}
-#elif (defined(_MSC_VER))
-JEMALLOC_INLINE uint32_t
-atomic_add_uint32(uint32_t *p, uint32_t x)
-{
-
- return (InterlockedExchangeAdd(p, x) + x);
-}
-
-JEMALLOC_INLINE uint32_t
-atomic_sub_uint32(uint32_t *p, uint32_t x)
-{
-
- return (InterlockedExchangeAdd(p, -((int32_t)x)) - x);
-}
-
-JEMALLOC_INLINE bool
-atomic_cas_uint32(uint32_t *p, uint32_t c, uint32_t s)
-{
- uint32_t o;
-
- o = InterlockedCompareExchange(p, s, c);
- return (o != c);
-}
-
-JEMALLOC_INLINE void
-atomic_write_uint32(uint32_t *p, uint32_t x)
-{
-
- InterlockedExchange(p, x);
-}
-#elif (defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) || \
- defined(JE_FORCE_SYNC_COMPARE_AND_SWAP_4))
-JEMALLOC_INLINE uint32_t
-atomic_add_uint32(uint32_t *p, uint32_t x)
-{
-
- return (__sync_add_and_fetch(p, x));
-}
-
-JEMALLOC_INLINE uint32_t
-atomic_sub_uint32(uint32_t *p, uint32_t x)
-{
-
- return (__sync_sub_and_fetch(p, x));
-}
-
-JEMALLOC_INLINE bool
-atomic_cas_uint32(uint32_t *p, uint32_t c, uint32_t s)
-{
-
- return (!__sync_bool_compare_and_swap(p, c, s));
-}
-
-JEMALLOC_INLINE void
-atomic_write_uint32(uint32_t *p, uint32_t x)
-{
-
- __sync_lock_test_and_set(p, x);
-}
-#else
-# error "Missing implementation for 32-bit atomic operations"
-#endif
-
-/******************************************************************************/
-/* Pointer operations. */
-JEMALLOC_INLINE void *
-atomic_add_p(void **p, void *x)
-{
-
-#if (LG_SIZEOF_PTR == 3)
- return ((void *)atomic_add_uint64((uint64_t *)p, (uint64_t)x));
-#elif (LG_SIZEOF_PTR == 2)
- return ((void *)atomic_add_uint32((uint32_t *)p, (uint32_t)x));
-#endif
-}
-
-JEMALLOC_INLINE void *
-atomic_sub_p(void **p, void *x)
-{
-
-#if (LG_SIZEOF_PTR == 3)
- return ((void *)atomic_add_uint64((uint64_t *)p,
- (uint64_t)-((int64_t)x)));
-#elif (LG_SIZEOF_PTR == 2)
- return ((void *)atomic_add_uint32((uint32_t *)p,
- (uint32_t)-((int32_t)x)));
-#endif
-}
-
-JEMALLOC_INLINE bool
-atomic_cas_p(void **p, void *c, void *s)
-{
-
-#if (LG_SIZEOF_PTR == 3)
- return (atomic_cas_uint64((uint64_t *)p, (uint64_t)c, (uint64_t)s));
-#elif (LG_SIZEOF_PTR == 2)
- return (atomic_cas_uint32((uint32_t *)p, (uint32_t)c, (uint32_t)s));
-#endif
-}
-
-JEMALLOC_INLINE void
-atomic_write_p(void **p, const void *x)
-{
-
-#if (LG_SIZEOF_PTR == 3)
- atomic_write_uint64((uint64_t *)p, (uint64_t)x);
-#elif (LG_SIZEOF_PTR == 2)
- atomic_write_uint32((uint32_t *)p, (uint32_t)x);
-#endif
-}
-
-/******************************************************************************/
-/* size_t operations. */
-JEMALLOC_INLINE size_t
-atomic_add_z(size_t *p, size_t x)
-{
-
-#if (LG_SIZEOF_PTR == 3)
- return ((size_t)atomic_add_uint64((uint64_t *)p, (uint64_t)x));
-#elif (LG_SIZEOF_PTR == 2)
- return ((size_t)atomic_add_uint32((uint32_t *)p, (uint32_t)x));
-#endif
-}
-
-JEMALLOC_INLINE size_t
-atomic_sub_z(size_t *p, size_t x)
-{
-
-#if (LG_SIZEOF_PTR == 3)
- return ((size_t)atomic_add_uint64((uint64_t *)p,
- (uint64_t)-((int64_t)x)));
-#elif (LG_SIZEOF_PTR == 2)
- return ((size_t)atomic_add_uint32((uint32_t *)p,
- (uint32_t)-((int32_t)x)));
-#endif
-}
-
-JEMALLOC_INLINE bool
-atomic_cas_z(size_t *p, size_t c, size_t s)
-{
-
-#if (LG_SIZEOF_PTR == 3)
- return (atomic_cas_uint64((uint64_t *)p, (uint64_t)c, (uint64_t)s));
-#elif (LG_SIZEOF_PTR == 2)
- return (atomic_cas_uint32((uint32_t *)p, (uint32_t)c, (uint32_t)s));
-#endif
-}
-
-JEMALLOC_INLINE void
-atomic_write_z(size_t *p, size_t x)
-{
-
-#if (LG_SIZEOF_PTR == 3)
- atomic_write_uint64((uint64_t *)p, (uint64_t)x);
-#elif (LG_SIZEOF_PTR == 2)
- atomic_write_uint32((uint32_t *)p, (uint32_t)x);
-#endif
-}
-
-/******************************************************************************/
-/* unsigned operations. */
-JEMALLOC_INLINE unsigned
-atomic_add_u(unsigned *p, unsigned x)
-{
-
-#if (LG_SIZEOF_INT == 3)
- return ((unsigned)atomic_add_uint64((uint64_t *)p, (uint64_t)x));
-#elif (LG_SIZEOF_INT == 2)
- return ((unsigned)atomic_add_uint32((uint32_t *)p, (uint32_t)x));
-#endif
-}
-
-JEMALLOC_INLINE unsigned
-atomic_sub_u(unsigned *p, unsigned x)
-{
-
-#if (LG_SIZEOF_INT == 3)
- return ((unsigned)atomic_add_uint64((uint64_t *)p,
- (uint64_t)-((int64_t)x)));
-#elif (LG_SIZEOF_INT == 2)
- return ((unsigned)atomic_add_uint32((uint32_t *)p,
- (uint32_t)-((int32_t)x)));
-#endif
-}
-
-JEMALLOC_INLINE bool
-atomic_cas_u(unsigned *p, unsigned c, unsigned s)
-{
-
-#if (LG_SIZEOF_INT == 3)
- return (atomic_cas_uint64((uint64_t *)p, (uint64_t)c, (uint64_t)s));
-#elif (LG_SIZEOF_INT == 2)
- return (atomic_cas_uint32((uint32_t *)p, (uint32_t)c, (uint32_t)s));
-#endif
-}
-
-JEMALLOC_INLINE void
-atomic_write_u(unsigned *p, unsigned x)
-{
-
-#if (LG_SIZEOF_INT == 3)
- atomic_write_uint64((uint64_t *)p, (uint64_t)x);
-#elif (LG_SIZEOF_INT == 2)
- atomic_write_uint32((uint32_t *)p, (uint32_t)x);
-#endif
-}
-
-/******************************************************************************/
-#endif
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
diff --git a/memory/jemalloc/src/include/jemalloc/internal/base.h b/memory/jemalloc/src/include/jemalloc/internal/base.h
deleted file mode 100644
index d6b81e162e..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/base.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-void *base_alloc(tsdn_t *tsdn, size_t size);
-void base_stats_get(tsdn_t *tsdn, size_t *allocated, size_t *resident,
- size_t *mapped);
-bool base_boot(void);
-void base_prefork(tsdn_t *tsdn);
-void base_postfork_parent(tsdn_t *tsdn);
-void base_postfork_child(tsdn_t *tsdn);
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
diff --git a/memory/jemalloc/src/include/jemalloc/internal/bitmap.h b/memory/jemalloc/src/include/jemalloc/internal/bitmap.h
deleted file mode 100644
index 36f38b59c3..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/bitmap.h
+++ /dev/null
@@ -1,274 +0,0 @@
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-/* Maximum bitmap bit count is 2^LG_BITMAP_MAXBITS. */
-#define LG_BITMAP_MAXBITS LG_RUN_MAXREGS
-#define BITMAP_MAXBITS (ZU(1) << LG_BITMAP_MAXBITS)
-
-typedef struct bitmap_level_s bitmap_level_t;
-typedef struct bitmap_info_s bitmap_info_t;
-typedef unsigned long bitmap_t;
-#define LG_SIZEOF_BITMAP LG_SIZEOF_LONG
-
-/* Number of bits per group. */
-#define LG_BITMAP_GROUP_NBITS (LG_SIZEOF_BITMAP + 3)
-#define BITMAP_GROUP_NBITS (ZU(1) << LG_BITMAP_GROUP_NBITS)
-#define BITMAP_GROUP_NBITS_MASK (BITMAP_GROUP_NBITS-1)
-
-/*
- * Do some analysis on how big the bitmap is before we use a tree. For a brute
- * force linear search, if we would have to call ffs_lu() more than 2^3 times,
- * use a tree instead.
- */
-#if LG_BITMAP_MAXBITS - LG_BITMAP_GROUP_NBITS > 3
-# define USE_TREE
-#endif
-
-/* Number of groups required to store a given number of bits. */
-#define BITMAP_BITS2GROUPS(nbits) \
- ((nbits + BITMAP_GROUP_NBITS_MASK) >> LG_BITMAP_GROUP_NBITS)
-
-/*
- * Number of groups required at a particular level for a given number of bits.
- */
-#define BITMAP_GROUPS_L0(nbits) \
- BITMAP_BITS2GROUPS(nbits)
-#define BITMAP_GROUPS_L1(nbits) \
- BITMAP_BITS2GROUPS(BITMAP_BITS2GROUPS(nbits))
-#define BITMAP_GROUPS_L2(nbits) \
- BITMAP_BITS2GROUPS(BITMAP_BITS2GROUPS(BITMAP_BITS2GROUPS((nbits))))
-#define BITMAP_GROUPS_L3(nbits) \
- BITMAP_BITS2GROUPS(BITMAP_BITS2GROUPS(BITMAP_BITS2GROUPS( \
- BITMAP_BITS2GROUPS((nbits)))))
-
-/*
- * Assuming the number of levels, number of groups required for a given number
- * of bits.
- */
-#define BITMAP_GROUPS_1_LEVEL(nbits) \
- BITMAP_GROUPS_L0(nbits)
-#define BITMAP_GROUPS_2_LEVEL(nbits) \
- (BITMAP_GROUPS_1_LEVEL(nbits) + BITMAP_GROUPS_L1(nbits))
-#define BITMAP_GROUPS_3_LEVEL(nbits) \
- (BITMAP_GROUPS_2_LEVEL(nbits) + BITMAP_GROUPS_L2(nbits))
-#define BITMAP_GROUPS_4_LEVEL(nbits) \
- (BITMAP_GROUPS_3_LEVEL(nbits) + BITMAP_GROUPS_L3(nbits))
-
-/*
- * Maximum number of groups required to support LG_BITMAP_MAXBITS.
- */
-#ifdef USE_TREE
-
-#if LG_BITMAP_MAXBITS <= LG_BITMAP_GROUP_NBITS
-# define BITMAP_GROUPS_MAX BITMAP_GROUPS_1_LEVEL(BITMAP_MAXBITS)
-#elif LG_BITMAP_MAXBITS <= LG_BITMAP_GROUP_NBITS * 2
-# define BITMAP_GROUPS_MAX BITMAP_GROUPS_2_LEVEL(BITMAP_MAXBITS)
-#elif LG_BITMAP_MAXBITS <= LG_BITMAP_GROUP_NBITS * 3
-# define BITMAP_GROUPS_MAX BITMAP_GROUPS_3_LEVEL(BITMAP_MAXBITS)
-#elif LG_BITMAP_MAXBITS <= LG_BITMAP_GROUP_NBITS * 4
-# define BITMAP_GROUPS_MAX BITMAP_GROUPS_4_LEVEL(BITMAP_MAXBITS)
-#else
-# error "Unsupported bitmap size"
-#endif
-
-/* Maximum number of levels possible. */
-#define BITMAP_MAX_LEVELS \
- (LG_BITMAP_MAXBITS / LG_SIZEOF_BITMAP) \
- + !!(LG_BITMAP_MAXBITS % LG_SIZEOF_BITMAP)
-
-#else /* USE_TREE */
-
-#define BITMAP_GROUPS_MAX BITMAP_BITS2GROUPS(BITMAP_MAXBITS)
-
-#endif /* USE_TREE */
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-struct bitmap_level_s {
- /* Offset of this level's groups within the array of groups. */
- size_t group_offset;
-};
-
-struct bitmap_info_s {
- /* Logical number of bits in bitmap (stored at bottom level). */
- size_t nbits;
-
-#ifdef USE_TREE
- /* Number of levels necessary for nbits. */
- unsigned nlevels;
-
- /*
- * Only the first (nlevels+1) elements are used, and levels are ordered
- * bottom to top (e.g. the bottom level is stored in levels[0]).
- */
- bitmap_level_t levels[BITMAP_MAX_LEVELS+1];
-#else /* USE_TREE */
- /* Number of groups necessary for nbits. */
- size_t ngroups;
-#endif /* USE_TREE */
-};
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-void bitmap_info_init(bitmap_info_t *binfo, size_t nbits);
-void bitmap_init(bitmap_t *bitmap, const bitmap_info_t *binfo);
-size_t bitmap_size(const bitmap_info_t *binfo);
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-#ifndef JEMALLOC_ENABLE_INLINE
-bool bitmap_full(bitmap_t *bitmap, const bitmap_info_t *binfo);
-bool bitmap_get(bitmap_t *bitmap, const bitmap_info_t *binfo, size_t bit);
-void bitmap_set(bitmap_t *bitmap, const bitmap_info_t *binfo, size_t bit);
-size_t bitmap_sfu(bitmap_t *bitmap, const bitmap_info_t *binfo);
-void bitmap_unset(bitmap_t *bitmap, const bitmap_info_t *binfo, size_t bit);
-#endif
-
-#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_BITMAP_C_))
-JEMALLOC_INLINE bool
-bitmap_full(bitmap_t *bitmap, const bitmap_info_t *binfo)
-{
-#ifdef USE_TREE
- size_t rgoff = binfo->levels[binfo->nlevels].group_offset - 1;
- bitmap_t rg = bitmap[rgoff];
- /* The bitmap is full iff the root group is 0. */
- return (rg == 0);
-#else
- size_t i;
-
- for (i = 0; i < binfo->ngroups; i++) {
- if (bitmap[i] != 0)
- return (false);
- }
- return (true);
-#endif
-}
-
-JEMALLOC_INLINE bool
-bitmap_get(bitmap_t *bitmap, const bitmap_info_t *binfo, size_t bit)
-{
- size_t goff;
- bitmap_t g;
-
- assert(bit < binfo->nbits);
- goff = bit >> LG_BITMAP_GROUP_NBITS;
- g = bitmap[goff];
- return (!(g & (ZU(1) << (bit & BITMAP_GROUP_NBITS_MASK))));
-}
-
-JEMALLOC_INLINE void
-bitmap_set(bitmap_t *bitmap, const bitmap_info_t *binfo, size_t bit)
-{
- size_t goff;
- bitmap_t *gp;
- bitmap_t g;
-
- assert(bit < binfo->nbits);
- assert(!bitmap_get(bitmap, binfo, bit));
- goff = bit >> LG_BITMAP_GROUP_NBITS;
- gp = &bitmap[goff];
- g = *gp;
- assert(g & (ZU(1) << (bit & BITMAP_GROUP_NBITS_MASK)));
- g ^= ZU(1) << (bit & BITMAP_GROUP_NBITS_MASK);
- *gp = g;
- assert(bitmap_get(bitmap, binfo, bit));
-#ifdef USE_TREE
- /* Propagate group state transitions up the tree. */
- if (g == 0) {
- unsigned i;
- for (i = 1; i < binfo->nlevels; i++) {
- bit = goff;
- goff = bit >> LG_BITMAP_GROUP_NBITS;
- gp = &bitmap[binfo->levels[i].group_offset + goff];
- g = *gp;
- assert(g & (ZU(1) << (bit & BITMAP_GROUP_NBITS_MASK)));
- g ^= ZU(1) << (bit & BITMAP_GROUP_NBITS_MASK);
- *gp = g;
- if (g != 0)
- break;
- }
- }
-#endif
-}
-
-/* sfu: set first unset. */
-JEMALLOC_INLINE size_t
-bitmap_sfu(bitmap_t *bitmap, const bitmap_info_t *binfo)
-{
- size_t bit;
- bitmap_t g;
- unsigned i;
-
- assert(!bitmap_full(bitmap, binfo));
-
-#ifdef USE_TREE
- i = binfo->nlevels - 1;
- g = bitmap[binfo->levels[i].group_offset];
- bit = ffs_lu(g) - 1;
- while (i > 0) {
- i--;
- g = bitmap[binfo->levels[i].group_offset + bit];
- bit = (bit << LG_BITMAP_GROUP_NBITS) + (ffs_lu(g) - 1);
- }
-#else
- i = 0;
- g = bitmap[0];
- while ((bit = ffs_lu(g)) == 0) {
- i++;
- g = bitmap[i];
- }
- bit = (i << LG_BITMAP_GROUP_NBITS) + (bit - 1);
-#endif
- bitmap_set(bitmap, binfo, bit);
- return (bit);
-}
-
-JEMALLOC_INLINE void
-bitmap_unset(bitmap_t *bitmap, const bitmap_info_t *binfo, size_t bit)
-{
- size_t goff;
- bitmap_t *gp;
- bitmap_t g;
- UNUSED bool propagate;
-
- assert(bit < binfo->nbits);
- assert(bitmap_get(bitmap, binfo, bit));
- goff = bit >> LG_BITMAP_GROUP_NBITS;
- gp = &bitmap[goff];
- g = *gp;
- propagate = (g == 0);
- assert((g & (ZU(1) << (bit & BITMAP_GROUP_NBITS_MASK))) == 0);
- g ^= ZU(1) << (bit & BITMAP_GROUP_NBITS_MASK);
- *gp = g;
- assert(!bitmap_get(bitmap, binfo, bit));
-#ifdef USE_TREE
- /* Propagate group state transitions up the tree. */
- if (propagate) {
- unsigned i;
- for (i = 1; i < binfo->nlevels; i++) {
- bit = goff;
- goff = bit >> LG_BITMAP_GROUP_NBITS;
- gp = &bitmap[binfo->levels[i].group_offset + goff];
- g = *gp;
- propagate = (g == 0);
- assert((g & (ZU(1) << (bit & BITMAP_GROUP_NBITS_MASK)))
- == 0);
- g ^= ZU(1) << (bit & BITMAP_GROUP_NBITS_MASK);
- *gp = g;
- if (!propagate)
- break;
- }
- }
-#endif /* USE_TREE */
-}
-
-#endif
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
diff --git a/memory/jemalloc/src/include/jemalloc/internal/chunk.h b/memory/jemalloc/src/include/jemalloc/internal/chunk.h
deleted file mode 100644
index 38c9a012da..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/chunk.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-/*
- * Size and alignment of memory chunks that are allocated by the OS's virtual
- * memory system.
- */
-#define LG_CHUNK_DEFAULT 21
-
-/* Return the chunk address for allocation address a. */
-#define CHUNK_ADDR2BASE(a) \
- ((void *)((uintptr_t)(a) & ~chunksize_mask))
-
-/* Return the chunk offset of address a. */
-#define CHUNK_ADDR2OFFSET(a) \
- ((size_t)((uintptr_t)(a) & chunksize_mask))
-
-/* Return the smallest chunk multiple that is >= s. */
-#define CHUNK_CEILING(s) \
- (((s) + chunksize_mask) & ~chunksize_mask)
-
-#define CHUNK_HOOKS_INITIALIZER { \
- NULL, \
- NULL, \
- NULL, \
- NULL, \
- NULL, \
- NULL, \
- NULL \
-}
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-extern size_t opt_lg_chunk;
-extern const char *opt_dss;
-
-extern rtree_t chunks_rtree;
-
-extern size_t chunksize;
-extern size_t chunksize_mask; /* (chunksize - 1). */
-extern size_t chunk_npages;
-
-extern const chunk_hooks_t chunk_hooks_default;
-
-chunk_hooks_t chunk_hooks_get(tsdn_t *tsdn, arena_t *arena);
-chunk_hooks_t chunk_hooks_set(tsdn_t *tsdn, arena_t *arena,
- const chunk_hooks_t *chunk_hooks);
-
-bool chunk_register(tsdn_t *tsdn, const void *chunk,
- const extent_node_t *node);
-void chunk_deregister(const void *chunk, const extent_node_t *node);
-void *chunk_alloc_base(size_t size);
-void *chunk_alloc_cache(tsdn_t *tsdn, arena_t *arena,
- chunk_hooks_t *chunk_hooks, void *new_addr, size_t size, size_t alignment,
- bool *zero, bool *commit, bool dalloc_node);
-void *chunk_alloc_wrapper(tsdn_t *tsdn, arena_t *arena,
- chunk_hooks_t *chunk_hooks, void *new_addr, size_t size, size_t alignment,
- bool *zero, bool *commit);
-void chunk_dalloc_cache(tsdn_t *tsdn, arena_t *arena,
- chunk_hooks_t *chunk_hooks, void *chunk, size_t size, bool committed);
-void chunk_dalloc_wrapper(tsdn_t *tsdn, arena_t *arena,
- chunk_hooks_t *chunk_hooks, void *chunk, size_t size, bool zeroed,
- bool committed);
-bool chunk_purge_wrapper(tsdn_t *tsdn, arena_t *arena,
- chunk_hooks_t *chunk_hooks, void *chunk, size_t size, size_t offset,
- size_t length);
-bool chunk_boot(void);
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-#ifndef JEMALLOC_ENABLE_INLINE
-extent_node_t *chunk_lookup(const void *chunk, bool dependent);
-#endif
-
-#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_CHUNK_C_))
-JEMALLOC_INLINE extent_node_t *
-chunk_lookup(const void *ptr, bool dependent)
-{
-
- return (rtree_get(&chunks_rtree, (uintptr_t)ptr, dependent));
-}
-#endif
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
-
-#include "jemalloc/internal/chunk_dss.h"
-#include "jemalloc/internal/chunk_mmap.h"
diff --git a/memory/jemalloc/src/include/jemalloc/internal/chunk_dss.h b/memory/jemalloc/src/include/jemalloc/internal/chunk_dss.h
deleted file mode 100644
index da8511ba06..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/chunk_dss.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-typedef enum {
- dss_prec_disabled = 0,
- dss_prec_primary = 1,
- dss_prec_secondary = 2,
-
- dss_prec_limit = 3
-} dss_prec_t;
-#define DSS_PREC_DEFAULT dss_prec_secondary
-#define DSS_DEFAULT "secondary"
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-extern const char *dss_prec_names[];
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-dss_prec_t chunk_dss_prec_get(void);
-bool chunk_dss_prec_set(dss_prec_t dss_prec);
-void *chunk_alloc_dss(tsdn_t *tsdn, arena_t *arena, void *new_addr,
- size_t size, size_t alignment, bool *zero, bool *commit);
-bool chunk_in_dss(void *chunk);
-bool chunk_dss_mergeable(void *chunk_a, void *chunk_b);
-void chunk_dss_boot(void);
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
diff --git a/memory/jemalloc/src/include/jemalloc/internal/chunk_mmap.h b/memory/jemalloc/src/include/jemalloc/internal/chunk_mmap.h
deleted file mode 100644
index 6f2d0ac2ed..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/chunk_mmap.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-void *chunk_alloc_mmap(void *new_addr, size_t size, size_t alignment,
- bool *zero, bool *commit);
-bool chunk_dalloc_mmap(void *chunk, size_t size);
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
diff --git a/memory/jemalloc/src/include/jemalloc/internal/ckh.h b/memory/jemalloc/src/include/jemalloc/internal/ckh.h
deleted file mode 100644
index f75ad90b73..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/ckh.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-typedef struct ckh_s ckh_t;
-typedef struct ckhc_s ckhc_t;
-
-/* Typedefs to allow easy function pointer passing. */
-typedef void ckh_hash_t (const void *, size_t[2]);
-typedef bool ckh_keycomp_t (const void *, const void *);
-
-/* Maintain counters used to get an idea of performance. */
-/* #define CKH_COUNT */
-/* Print counter values in ckh_delete() (requires CKH_COUNT). */
-/* #define CKH_VERBOSE */
-
-/*
- * There are 2^LG_CKH_BUCKET_CELLS cells in each hash table bucket. Try to fit
- * one bucket per L1 cache line.
- */
-#define LG_CKH_BUCKET_CELLS (LG_CACHELINE - LG_SIZEOF_PTR - 1)
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-/* Hash table cell. */
-struct ckhc_s {
- const void *key;
- const void *data;
-};
-
-struct ckh_s {
-#ifdef CKH_COUNT
- /* Counters used to get an idea of performance. */
- uint64_t ngrows;
- uint64_t nshrinks;
- uint64_t nshrinkfails;
- uint64_t ninserts;
- uint64_t nrelocs;
-#endif
-
- /* Used for pseudo-random number generation. */
- uint64_t prng_state;
-
- /* Total number of items. */
- size_t count;
-
- /*
- * Minimum and current number of hash table buckets. There are
- * 2^LG_CKH_BUCKET_CELLS cells per bucket.
- */
- unsigned lg_minbuckets;
- unsigned lg_curbuckets;
-
- /* Hash and comparison functions. */
- ckh_hash_t *hash;
- ckh_keycomp_t *keycomp;
-
- /* Hash table with 2^lg_curbuckets buckets. */
- ckhc_t *tab;
-};
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-bool ckh_new(tsd_t *tsd, ckh_t *ckh, size_t minitems, ckh_hash_t *hash,
- ckh_keycomp_t *keycomp);
-void ckh_delete(tsd_t *tsd, ckh_t *ckh);
-size_t ckh_count(ckh_t *ckh);
-bool ckh_iter(ckh_t *ckh, size_t *tabind, void **key, void **data);
-bool ckh_insert(tsd_t *tsd, ckh_t *ckh, const void *key, const void *data);
-bool ckh_remove(tsd_t *tsd, ckh_t *ckh, const void *searchkey, void **key,
- void **data);
-bool ckh_search(ckh_t *ckh, const void *searchkey, void **key, void **data);
-void ckh_string_hash(const void *key, size_t r_hash[2]);
-bool ckh_string_keycomp(const void *k1, const void *k2);
-void ckh_pointer_hash(const void *key, size_t r_hash[2]);
-bool ckh_pointer_keycomp(const void *k1, const void *k2);
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
diff --git a/memory/jemalloc/src/include/jemalloc/internal/ctl.h b/memory/jemalloc/src/include/jemalloc/internal/ctl.h
deleted file mode 100644
index af0f6d7c5d..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/ctl.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-typedef struct ctl_node_s ctl_node_t;
-typedef struct ctl_named_node_s ctl_named_node_t;
-typedef struct ctl_indexed_node_s ctl_indexed_node_t;
-typedef struct ctl_arena_stats_s ctl_arena_stats_t;
-typedef struct ctl_stats_s ctl_stats_t;
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-struct ctl_node_s {
- bool named;
-};
-
-struct ctl_named_node_s {
- struct ctl_node_s node;
- const char *name;
- /* If (nchildren == 0), this is a terminal node. */
- unsigned nchildren;
- const ctl_node_t *children;
- int (*ctl)(tsd_t *, const size_t *, size_t, void *,
- size_t *, void *, size_t);
-};
-
-struct ctl_indexed_node_s {
- struct ctl_node_s node;
- const ctl_named_node_t *(*index)(tsdn_t *, const size_t *, size_t,
- size_t);
-};
-
-struct ctl_arena_stats_s {
- bool initialized;
- unsigned nthreads;
- const char *dss;
- ssize_t lg_dirty_mult;
- ssize_t decay_time;
- size_t pactive;
- size_t pdirty;
-
- /* The remainder are only populated if config_stats is true. */
-
- arena_stats_t astats;
-
- /* Aggregate stats for small size classes, based on bin stats. */
- size_t allocated_small;
- uint64_t nmalloc_small;
- uint64_t ndalloc_small;
- uint64_t nrequests_small;
-
- malloc_bin_stats_t bstats[NBINS];
- malloc_large_stats_t *lstats; /* nlclasses elements. */
- malloc_huge_stats_t *hstats; /* nhclasses elements. */
-};
-
-struct ctl_stats_s {
- size_t allocated;
- size_t active;
- size_t metadata;
- size_t resident;
- size_t mapped;
- size_t retained;
- unsigned narenas;
- ctl_arena_stats_t *arenas; /* (narenas + 1) elements. */
-};
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-int ctl_byname(tsd_t *tsd, const char *name, void *oldp, size_t *oldlenp,
- void *newp, size_t newlen);
-int ctl_nametomib(tsdn_t *tsdn, const char *name, size_t *mibp,
- size_t *miblenp);
-
-int ctl_bymib(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
- size_t *oldlenp, void *newp, size_t newlen);
-bool ctl_boot(void);
-void ctl_prefork(tsdn_t *tsdn);
-void ctl_postfork_parent(tsdn_t *tsdn);
-void ctl_postfork_child(tsdn_t *tsdn);
-
-#define xmallctl(name, oldp, oldlenp, newp, newlen) do { \
- if (je_mallctl(name, oldp, oldlenp, newp, newlen) \
- != 0) { \
- malloc_printf( \
- "<jemalloc>: Failure in xmallctl(\"%s\", ...)\n", \
- name); \
- abort(); \
- } \
-} while (0)
-
-#define xmallctlnametomib(name, mibp, miblenp) do { \
- if (je_mallctlnametomib(name, mibp, miblenp) != 0) { \
- malloc_printf("<jemalloc>: Failure in " \
- "xmallctlnametomib(\"%s\", ...)\n", name); \
- abort(); \
- } \
-} while (0)
-
-#define xmallctlbymib(mib, miblen, oldp, oldlenp, newp, newlen) do { \
- if (je_mallctlbymib(mib, miblen, oldp, oldlenp, newp, \
- newlen) != 0) { \
- malloc_write( \
- "<jemalloc>: Failure in xmallctlbymib()\n"); \
- abort(); \
- } \
-} while (0)
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
-
diff --git a/memory/jemalloc/src/include/jemalloc/internal/extent.h b/memory/jemalloc/src/include/jemalloc/internal/extent.h
deleted file mode 100644
index 49d76a57f5..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/extent.h
+++ /dev/null
@@ -1,239 +0,0 @@
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-typedef struct extent_node_s extent_node_t;
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-/* Tree of extents. Use accessor functions for en_* fields. */
-struct extent_node_s {
- /* Arena from which this extent came, if any. */
- arena_t *en_arena;
-
- /* Pointer to the extent that this tree node is responsible for. */
- void *en_addr;
-
- /* Total region size. */
- size_t en_size;
-
- /*
- * The zeroed flag is used by chunk recycling code to track whether
- * memory is zero-filled.
- */
- bool en_zeroed;
-
- /*
- * True if physical memory is committed to the extent, whether
- * explicitly or implicitly as on a system that overcommits and
- * satisfies physical memory needs on demand via soft page faults.
- */
- bool en_committed;
-
- /*
- * The achunk flag is used to validate that huge allocation lookups
- * don't return arena chunks.
- */
- bool en_achunk;
-
- /* Profile counters, used for huge objects. */
- prof_tctx_t *en_prof_tctx;
-
- /* Linkage for arena's runs_dirty and chunks_cache rings. */
- arena_runs_dirty_link_t rd;
- qr(extent_node_t) cc_link;
-
- union {
- /* Linkage for the size/address-ordered tree. */
- rb_node(extent_node_t) szad_link;
-
- /* Linkage for arena's achunks, huge, and node_cache lists. */
- ql_elm(extent_node_t) ql_link;
- };
-
- /* Linkage for the address-ordered tree. */
- rb_node(extent_node_t) ad_link;
-};
-typedef rb_tree(extent_node_t) extent_tree_t;
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-rb_proto(, extent_tree_szad_, extent_tree_t, extent_node_t)
-
-rb_proto(, extent_tree_ad_, extent_tree_t, extent_node_t)
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-#ifndef JEMALLOC_ENABLE_INLINE
-arena_t *extent_node_arena_get(const extent_node_t *node);
-void *extent_node_addr_get(const extent_node_t *node);
-size_t extent_node_size_get(const extent_node_t *node);
-bool extent_node_zeroed_get(const extent_node_t *node);
-bool extent_node_committed_get(const extent_node_t *node);
-bool extent_node_achunk_get(const extent_node_t *node);
-prof_tctx_t *extent_node_prof_tctx_get(const extent_node_t *node);
-void extent_node_arena_set(extent_node_t *node, arena_t *arena);
-void extent_node_addr_set(extent_node_t *node, void *addr);
-void extent_node_size_set(extent_node_t *node, size_t size);
-void extent_node_zeroed_set(extent_node_t *node, bool zeroed);
-void extent_node_committed_set(extent_node_t *node, bool committed);
-void extent_node_achunk_set(extent_node_t *node, bool achunk);
-void extent_node_prof_tctx_set(extent_node_t *node, prof_tctx_t *tctx);
-void extent_node_init(extent_node_t *node, arena_t *arena, void *addr,
- size_t size, bool zeroed, bool committed);
-void extent_node_dirty_linkage_init(extent_node_t *node);
-void extent_node_dirty_insert(extent_node_t *node,
- arena_runs_dirty_link_t *runs_dirty, extent_node_t *chunks_dirty);
-void extent_node_dirty_remove(extent_node_t *node);
-#endif
-
-#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_EXTENT_C_))
-JEMALLOC_INLINE arena_t *
-extent_node_arena_get(const extent_node_t *node)
-{
-
- return (node->en_arena);
-}
-
-JEMALLOC_INLINE void *
-extent_node_addr_get(const extent_node_t *node)
-{
-
- return (node->en_addr);
-}
-
-JEMALLOC_INLINE size_t
-extent_node_size_get(const extent_node_t *node)
-{
-
- return (node->en_size);
-}
-
-JEMALLOC_INLINE bool
-extent_node_zeroed_get(const extent_node_t *node)
-{
-
- return (node->en_zeroed);
-}
-
-JEMALLOC_INLINE bool
-extent_node_committed_get(const extent_node_t *node)
-{
-
- assert(!node->en_achunk);
- return (node->en_committed);
-}
-
-JEMALLOC_INLINE bool
-extent_node_achunk_get(const extent_node_t *node)
-{
-
- return (node->en_achunk);
-}
-
-JEMALLOC_INLINE prof_tctx_t *
-extent_node_prof_tctx_get(const extent_node_t *node)
-{
-
- return (node->en_prof_tctx);
-}
-
-JEMALLOC_INLINE void
-extent_node_arena_set(extent_node_t *node, arena_t *arena)
-{
-
- node->en_arena = arena;
-}
-
-JEMALLOC_INLINE void
-extent_node_addr_set(extent_node_t *node, void *addr)
-{
-
- node->en_addr = addr;
-}
-
-JEMALLOC_INLINE void
-extent_node_size_set(extent_node_t *node, size_t size)
-{
-
- node->en_size = size;
-}
-
-JEMALLOC_INLINE void
-extent_node_zeroed_set(extent_node_t *node, bool zeroed)
-{
-
- node->en_zeroed = zeroed;
-}
-
-JEMALLOC_INLINE void
-extent_node_committed_set(extent_node_t *node, bool committed)
-{
-
- node->en_committed = committed;
-}
-
-JEMALLOC_INLINE void
-extent_node_achunk_set(extent_node_t *node, bool achunk)
-{
-
- node->en_achunk = achunk;
-}
-
-JEMALLOC_INLINE void
-extent_node_prof_tctx_set(extent_node_t *node, prof_tctx_t *tctx)
-{
-
- node->en_prof_tctx = tctx;
-}
-
-JEMALLOC_INLINE void
-extent_node_init(extent_node_t *node, arena_t *arena, void *addr, size_t size,
- bool zeroed, bool committed)
-{
-
- extent_node_arena_set(node, arena);
- extent_node_addr_set(node, addr);
- extent_node_size_set(node, size);
- extent_node_zeroed_set(node, zeroed);
- extent_node_committed_set(node, committed);
- extent_node_achunk_set(node, false);
- if (config_prof)
- extent_node_prof_tctx_set(node, NULL);
-}
-
-JEMALLOC_INLINE void
-extent_node_dirty_linkage_init(extent_node_t *node)
-{
-
- qr_new(&node->rd, rd_link);
- qr_new(node, cc_link);
-}
-
-JEMALLOC_INLINE void
-extent_node_dirty_insert(extent_node_t *node,
- arena_runs_dirty_link_t *runs_dirty, extent_node_t *chunks_dirty)
-{
-
- qr_meld(runs_dirty, &node->rd, rd_link);
- qr_meld(chunks_dirty, node, cc_link);
-}
-
-JEMALLOC_INLINE void
-extent_node_dirty_remove(extent_node_t *node)
-{
-
- qr_remove(&node->rd, rd_link);
- qr_remove(node, cc_link);
-}
-
-#endif
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
-
diff --git a/memory/jemalloc/src/include/jemalloc/internal/hash.h b/memory/jemalloc/src/include/jemalloc/internal/hash.h
deleted file mode 100644
index 1ff2d9a05f..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/hash.h
+++ /dev/null
@@ -1,357 +0,0 @@
-/*
- * The following hash function is based on MurmurHash3, placed into the public
- * domain by Austin Appleby. See https://github.com/aappleby/smhasher for
- * details.
- */
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-#ifndef JEMALLOC_ENABLE_INLINE
-uint32_t hash_x86_32(const void *key, int len, uint32_t seed);
-void hash_x86_128(const void *key, const int len, uint32_t seed,
- uint64_t r_out[2]);
-void hash_x64_128(const void *key, const int len, const uint32_t seed,
- uint64_t r_out[2]);
-void hash(const void *key, size_t len, const uint32_t seed,
- size_t r_hash[2]);
-#endif
-
-#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_HASH_C_))
-/******************************************************************************/
-/* Internal implementation. */
-JEMALLOC_INLINE uint32_t
-hash_rotl_32(uint32_t x, int8_t r)
-{
-
- return ((x << r) | (x >> (32 - r)));
-}
-
-JEMALLOC_INLINE uint64_t
-hash_rotl_64(uint64_t x, int8_t r)
-{
-
- return ((x << r) | (x >> (64 - r)));
-}
-
-JEMALLOC_INLINE uint32_t
-hash_get_block_32(const uint32_t *p, int i)
-{
-
- /* Handle unaligned read. */
- if (unlikely((uintptr_t)p & (sizeof(uint32_t)-1)) != 0) {
- uint32_t ret;
-
- memcpy(&ret, (uint8_t *)(p + i), sizeof(uint32_t));
- return (ret);
- }
-
- return (p[i]);
-}
-
-JEMALLOC_INLINE uint64_t
-hash_get_block_64(const uint64_t *p, int i)
-{
-
- /* Handle unaligned read. */
- if (unlikely((uintptr_t)p & (sizeof(uint64_t)-1)) != 0) {
- uint64_t ret;
-
- memcpy(&ret, (uint8_t *)(p + i), sizeof(uint64_t));
- return (ret);
- }
-
- return (p[i]);
-}
-
-JEMALLOC_INLINE uint32_t
-hash_fmix_32(uint32_t h)
-{
-
- h ^= h >> 16;
- h *= 0x85ebca6b;
- h ^= h >> 13;
- h *= 0xc2b2ae35;
- h ^= h >> 16;
-
- return (h);
-}
-
-JEMALLOC_INLINE uint64_t
-hash_fmix_64(uint64_t k)
-{
-
- k ^= k >> 33;
- k *= KQU(0xff51afd7ed558ccd);
- k ^= k >> 33;
- k *= KQU(0xc4ceb9fe1a85ec53);
- k ^= k >> 33;
-
- return (k);
-}
-
-JEMALLOC_INLINE uint32_t
-hash_x86_32(const void *key, int len, uint32_t seed)
-{
- const uint8_t *data = (const uint8_t *) key;
- const int nblocks = len / 4;
-
- uint32_t h1 = seed;
-
- const uint32_t c1 = 0xcc9e2d51;
- const uint32_t c2 = 0x1b873593;
-
- /* body */
- {
- const uint32_t *blocks = (const uint32_t *) (data + nblocks*4);
- int i;
-
- for (i = -nblocks; i; i++) {
- uint32_t k1 = hash_get_block_32(blocks, i);
-
- k1 *= c1;
- k1 = hash_rotl_32(k1, 15);
- k1 *= c2;
-
- h1 ^= k1;
- h1 = hash_rotl_32(h1, 13);
- h1 = h1*5 + 0xe6546b64;
- }
- }
-
- /* tail */
- {
- const uint8_t *tail = (const uint8_t *) (data + nblocks*4);
-
- uint32_t k1 = 0;
-
- switch (len & 3) {
- case 3: k1 ^= tail[2] << 16;
- case 2: k1 ^= tail[1] << 8;
- case 1: k1 ^= tail[0]; k1 *= c1; k1 = hash_rotl_32(k1, 15);
- k1 *= c2; h1 ^= k1;
- }
- }
-
- /* finalization */
- h1 ^= len;
-
- h1 = hash_fmix_32(h1);
-
- return (h1);
-}
-
-UNUSED JEMALLOC_INLINE void
-hash_x86_128(const void *key, const int len, uint32_t seed,
- uint64_t r_out[2])
-{
- const uint8_t * data = (const uint8_t *) key;
- const int nblocks = len / 16;
-
- uint32_t h1 = seed;
- uint32_t h2 = seed;
- uint32_t h3 = seed;
- uint32_t h4 = seed;
-
- const uint32_t c1 = 0x239b961b;
- const uint32_t c2 = 0xab0e9789;
- const uint32_t c3 = 0x38b34ae5;
- const uint32_t c4 = 0xa1e38b93;
-
- /* body */
- {
- const uint32_t *blocks = (const uint32_t *) (data + nblocks*16);
- int i;
-
- for (i = -nblocks; i; i++) {
- uint32_t k1 = hash_get_block_32(blocks, i*4 + 0);
- uint32_t k2 = hash_get_block_32(blocks, i*4 + 1);
- uint32_t k3 = hash_get_block_32(blocks, i*4 + 2);
- uint32_t k4 = hash_get_block_32(blocks, i*4 + 3);
-
- k1 *= c1; k1 = hash_rotl_32(k1, 15); k1 *= c2; h1 ^= k1;
-
- h1 = hash_rotl_32(h1, 19); h1 += h2;
- h1 = h1*5 + 0x561ccd1b;
-
- k2 *= c2; k2 = hash_rotl_32(k2, 16); k2 *= c3; h2 ^= k2;
-
- h2 = hash_rotl_32(h2, 17); h2 += h3;
- h2 = h2*5 + 0x0bcaa747;
-
- k3 *= c3; k3 = hash_rotl_32(k3, 17); k3 *= c4; h3 ^= k3;
-
- h3 = hash_rotl_32(h3, 15); h3 += h4;
- h3 = h3*5 + 0x96cd1c35;
-
- k4 *= c4; k4 = hash_rotl_32(k4, 18); k4 *= c1; h4 ^= k4;
-
- h4 = hash_rotl_32(h4, 13); h4 += h1;
- h4 = h4*5 + 0x32ac3b17;
- }
- }
-
- /* tail */
- {
- const uint8_t *tail = (const uint8_t *) (data + nblocks*16);
- uint32_t k1 = 0;
- uint32_t k2 = 0;
- uint32_t k3 = 0;
- uint32_t k4 = 0;
-
- switch (len & 15) {
- case 15: k4 ^= tail[14] << 16;
- case 14: k4 ^= tail[13] << 8;
- case 13: k4 ^= tail[12] << 0;
- k4 *= c4; k4 = hash_rotl_32(k4, 18); k4 *= c1; h4 ^= k4;
-
- case 12: k3 ^= tail[11] << 24;
- case 11: k3 ^= tail[10] << 16;
- case 10: k3 ^= tail[ 9] << 8;
- case 9: k3 ^= tail[ 8] << 0;
- k3 *= c3; k3 = hash_rotl_32(k3, 17); k3 *= c4; h3 ^= k3;
-
- case 8: k2 ^= tail[ 7] << 24;
- case 7: k2 ^= tail[ 6] << 16;
- case 6: k2 ^= tail[ 5] << 8;
- case 5: k2 ^= tail[ 4] << 0;
- k2 *= c2; k2 = hash_rotl_32(k2, 16); k2 *= c3; h2 ^= k2;
-
- case 4: k1 ^= tail[ 3] << 24;
- case 3: k1 ^= tail[ 2] << 16;
- case 2: k1 ^= tail[ 1] << 8;
- case 1: k1 ^= tail[ 0] << 0;
- k1 *= c1; k1 = hash_rotl_32(k1, 15); k1 *= c2; h1 ^= k1;
- }
- }
-
- /* finalization */
- h1 ^= len; h2 ^= len; h3 ^= len; h4 ^= len;
-
- h1 += h2; h1 += h3; h1 += h4;
- h2 += h1; h3 += h1; h4 += h1;
-
- h1 = hash_fmix_32(h1);
- h2 = hash_fmix_32(h2);
- h3 = hash_fmix_32(h3);
- h4 = hash_fmix_32(h4);
-
- h1 += h2; h1 += h3; h1 += h4;
- h2 += h1; h3 += h1; h4 += h1;
-
- r_out[0] = (((uint64_t) h2) << 32) | h1;
- r_out[1] = (((uint64_t) h4) << 32) | h3;
-}
-
-UNUSED JEMALLOC_INLINE void
-hash_x64_128(const void *key, const int len, const uint32_t seed,
- uint64_t r_out[2])
-{
- const uint8_t *data = (const uint8_t *) key;
- const int nblocks = len / 16;
-
- uint64_t h1 = seed;
- uint64_t h2 = seed;
-
- const uint64_t c1 = KQU(0x87c37b91114253d5);
- const uint64_t c2 = KQU(0x4cf5ad432745937f);
-
- /* body */
- {
- const uint64_t *blocks = (const uint64_t *) (data);
- int i;
-
- for (i = 0; i < nblocks; i++) {
- uint64_t k1 = hash_get_block_64(blocks, i*2 + 0);
- uint64_t k2 = hash_get_block_64(blocks, i*2 + 1);
-
- k1 *= c1; k1 = hash_rotl_64(k1, 31); k1 *= c2; h1 ^= k1;
-
- h1 = hash_rotl_64(h1, 27); h1 += h2;
- h1 = h1*5 + 0x52dce729;
-
- k2 *= c2; k2 = hash_rotl_64(k2, 33); k2 *= c1; h2 ^= k2;
-
- h2 = hash_rotl_64(h2, 31); h2 += h1;
- h2 = h2*5 + 0x38495ab5;
- }
- }
-
- /* tail */
- {
- const uint8_t *tail = (const uint8_t*)(data + nblocks*16);
- uint64_t k1 = 0;
- uint64_t k2 = 0;
-
- switch (len & 15) {
- case 15: k2 ^= ((uint64_t)(tail[14])) << 48;
- case 14: k2 ^= ((uint64_t)(tail[13])) << 40;
- case 13: k2 ^= ((uint64_t)(tail[12])) << 32;
- case 12: k2 ^= ((uint64_t)(tail[11])) << 24;
- case 11: k2 ^= ((uint64_t)(tail[10])) << 16;
- case 10: k2 ^= ((uint64_t)(tail[ 9])) << 8;
- case 9: k2 ^= ((uint64_t)(tail[ 8])) << 0;
- k2 *= c2; k2 = hash_rotl_64(k2, 33); k2 *= c1; h2 ^= k2;
-
- case 8: k1 ^= ((uint64_t)(tail[ 7])) << 56;
- case 7: k1 ^= ((uint64_t)(tail[ 6])) << 48;
- case 6: k1 ^= ((uint64_t)(tail[ 5])) << 40;
- case 5: k1 ^= ((uint64_t)(tail[ 4])) << 32;
- case 4: k1 ^= ((uint64_t)(tail[ 3])) << 24;
- case 3: k1 ^= ((uint64_t)(tail[ 2])) << 16;
- case 2: k1 ^= ((uint64_t)(tail[ 1])) << 8;
- case 1: k1 ^= ((uint64_t)(tail[ 0])) << 0;
- k1 *= c1; k1 = hash_rotl_64(k1, 31); k1 *= c2; h1 ^= k1;
- }
- }
-
- /* finalization */
- h1 ^= len; h2 ^= len;
-
- h1 += h2;
- h2 += h1;
-
- h1 = hash_fmix_64(h1);
- h2 = hash_fmix_64(h2);
-
- h1 += h2;
- h2 += h1;
-
- r_out[0] = h1;
- r_out[1] = h2;
-}
-
-/******************************************************************************/
-/* API. */
-JEMALLOC_INLINE void
-hash(const void *key, size_t len, const uint32_t seed, size_t r_hash[2])
-{
-
- assert(len <= INT_MAX); /* Unfortunate implementation limitation. */
-
-#if (LG_SIZEOF_PTR == 3 && !defined(JEMALLOC_BIG_ENDIAN))
- hash_x64_128(key, (int)len, seed, (uint64_t *)r_hash);
-#else
- {
- uint64_t hashes[2];
- hash_x86_128(key, (int)len, seed, hashes);
- r_hash[0] = (size_t)hashes[0];
- r_hash[1] = (size_t)hashes[1];
- }
-#endif
-}
-#endif
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
diff --git a/memory/jemalloc/src/include/jemalloc/internal/huge.h b/memory/jemalloc/src/include/jemalloc/internal/huge.h
deleted file mode 100644
index 22184d9bbd..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/huge.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-void *huge_malloc(tsdn_t *tsdn, arena_t *arena, size_t usize, bool zero);
-void *huge_palloc(tsdn_t *tsdn, arena_t *arena, size_t usize,
- size_t alignment, bool zero);
-bool huge_ralloc_no_move(tsdn_t *tsdn, void *ptr, size_t oldsize,
- size_t usize_min, size_t usize_max, bool zero);
-void *huge_ralloc(tsd_t *tsd, arena_t *arena, void *ptr, size_t oldsize,
- size_t usize, size_t alignment, bool zero, tcache_t *tcache);
-#ifdef JEMALLOC_JET
-typedef void (huge_dalloc_junk_t)(void *, size_t);
-extern huge_dalloc_junk_t *huge_dalloc_junk;
-#endif
-void huge_dalloc(tsdn_t *tsdn, void *ptr);
-arena_t *huge_aalloc(const void *ptr);
-size_t huge_salloc(tsdn_t *tsdn, const void *ptr);
-prof_tctx_t *huge_prof_tctx_get(tsdn_t *tsdn, const void *ptr);
-void huge_prof_tctx_set(tsdn_t *tsdn, const void *ptr, prof_tctx_t *tctx);
-void huge_prof_tctx_reset(tsdn_t *tsdn, const void *ptr);
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
diff --git a/memory/jemalloc/src/include/jemalloc/internal/jemalloc_internal.h.in b/memory/jemalloc/src/include/jemalloc/internal/jemalloc_internal.h.in
deleted file mode 100644
index fdc8fef9d4..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/jemalloc_internal.h.in
+++ /dev/null
@@ -1,1288 +0,0 @@
-#ifndef JEMALLOC_INTERNAL_H
-#define JEMALLOC_INTERNAL_H
-
-#include "jemalloc_internal_defs.h"
-#include "jemalloc/internal/jemalloc_internal_decls.h"
-
-#ifdef JEMALLOC_UTRACE
-#include <sys/ktrace.h>
-#endif
-
-#define JEMALLOC_NO_DEMANGLE
-#ifdef JEMALLOC_JET
-# define JEMALLOC_N(n) jet_##n
-# include "jemalloc/internal/public_namespace.h"
-# define JEMALLOC_NO_RENAME
-# include "../jemalloc@install_suffix@.h"
-# undef JEMALLOC_NO_RENAME
-#else
-# define JEMALLOC_N(n) @private_namespace@##n
-# include "../jemalloc@install_suffix@.h"
-#endif
-#include "jemalloc/internal/private_namespace.h"
-
-static const bool config_debug =
-#ifdef JEMALLOC_DEBUG
- true
-#else
- false
-#endif
- ;
-static const bool have_dss =
-#ifdef JEMALLOC_DSS
- true
-#else
- false
-#endif
- ;
-static const bool config_fill =
-#ifdef JEMALLOC_FILL
- true
-#else
- false
-#endif
- ;
-static const bool config_lazy_lock =
-#ifdef JEMALLOC_LAZY_LOCK
- true
-#else
- false
-#endif
- ;
-static const char * const config_malloc_conf = JEMALLOC_CONFIG_MALLOC_CONF;
-static const bool config_prof =
-#ifdef JEMALLOC_PROF
- true
-#else
- false
-#endif
- ;
-static const bool config_prof_libgcc =
-#ifdef JEMALLOC_PROF_LIBGCC
- true
-#else
- false
-#endif
- ;
-static const bool config_prof_libunwind =
-#ifdef JEMALLOC_PROF_LIBUNWIND
- true
-#else
- false
-#endif
- ;
-static const bool maps_coalesce =
-#ifdef JEMALLOC_MAPS_COALESCE
- true
-#else
- false
-#endif
- ;
-static const bool config_munmap =
-#ifdef JEMALLOC_MUNMAP
- true
-#else
- false
-#endif
- ;
-static const bool config_stats =
-#ifdef JEMALLOC_STATS
- true
-#else
- false
-#endif
- ;
-static const bool config_tcache =
-#ifdef JEMALLOC_TCACHE
- true
-#else
- false
-#endif
- ;
-static const bool config_tls =
-#ifdef JEMALLOC_TLS
- true
-#else
- false
-#endif
- ;
-static const bool config_utrace =
-#ifdef JEMALLOC_UTRACE
- true
-#else
- false
-#endif
- ;
-static const bool config_valgrind =
-#ifdef JEMALLOC_VALGRIND
- true
-#else
- false
-#endif
- ;
-static const bool config_xmalloc =
-#ifdef JEMALLOC_XMALLOC
- true
-#else
- false
-#endif
- ;
-static const bool config_ivsalloc =
-#ifdef JEMALLOC_IVSALLOC
- true
-#else
- false
-#endif
- ;
-static const bool config_cache_oblivious =
-#ifdef JEMALLOC_CACHE_OBLIVIOUS
- true
-#else
- false
-#endif
- ;
-
-#ifdef JEMALLOC_C11ATOMICS
-#include <stdatomic.h>
-#endif
-
-#ifdef JEMALLOC_ATOMIC9
-#include <machine/atomic.h>
-#endif
-
-#if (defined(JEMALLOC_OSATOMIC) || defined(JEMALLOC_OSSPIN))
-#include <libkern/OSAtomic.h>
-#endif
-
-#ifdef JEMALLOC_ZONE
-#include <mach/mach_error.h>
-#include <mach/mach_init.h>
-#include <mach/vm_map.h>
-#include <malloc/malloc.h>
-#endif
-
-#include "jemalloc/internal/ph.h"
-#ifndef __PGI
-#define RB_COMPACT
-#endif
-#include "jemalloc/internal/rb.h"
-#include "jemalloc/internal/qr.h"
-#include "jemalloc/internal/ql.h"
-
-/*
- * jemalloc can conceptually be broken into components (arena, tcache, etc.),
- * but there are circular dependencies that cannot be broken without
- * substantial performance degradation. In order to reduce the effect on
- * visual code flow, read the header files in multiple passes, with one of the
- * following cpp variables defined during each pass:
- *
- * JEMALLOC_H_TYPES : Preprocessor-defined constants and psuedo-opaque data
- * types.
- * JEMALLOC_H_STRUCTS : Data structures.
- * JEMALLOC_H_EXTERNS : Extern data declarations and function prototypes.
- * JEMALLOC_H_INLINES : Inline functions.
- */
-/******************************************************************************/
-#define JEMALLOC_H_TYPES
-
-#include "jemalloc/internal/jemalloc_internal_macros.h"
-
-/* Page size index type. */
-typedef unsigned pszind_t;
-
-/* Size class index type. */
-typedef unsigned szind_t;
-
-/*
- * Flags bits:
- *
- * a: arena
- * t: tcache
- * 0: unused
- * z: zero
- * n: alignment
- *
- * aaaaaaaa aaaatttt tttttttt 0znnnnnn
- */
-#define MALLOCX_ARENA_MASK ((int)~0xfffff)
-#define MALLOCX_ARENA_MAX 0xffe
-#define MALLOCX_TCACHE_MASK ((int)~0xfff000ffU)
-#define MALLOCX_TCACHE_MAX 0xffd
-#define MALLOCX_LG_ALIGN_MASK ((int)0x3f)
-/* Use MALLOCX_ALIGN_GET() if alignment may not be specified in flags. */
-#define MALLOCX_ALIGN_GET_SPECIFIED(flags) \
- (ZU(1) << (flags & MALLOCX_LG_ALIGN_MASK))
-#define MALLOCX_ALIGN_GET(flags) \
- (MALLOCX_ALIGN_GET_SPECIFIED(flags) & (SIZE_T_MAX-1))
-#define MALLOCX_ZERO_GET(flags) \
- ((bool)(flags & MALLOCX_ZERO))
-
-#define MALLOCX_TCACHE_GET(flags) \
- (((unsigned)((flags & MALLOCX_TCACHE_MASK) >> 8)) - 2)
-#define MALLOCX_ARENA_GET(flags) \
- (((unsigned)(((unsigned)flags) >> 20)) - 1)
-
-/* Smallest size class to support. */
-#define TINY_MIN (1U << LG_TINY_MIN)
-
-/*
- * Minimum allocation alignment is 2^LG_QUANTUM bytes (ignoring tiny size
- * classes).
- */
-#ifndef LG_QUANTUM
-# if (defined(__i386__) || defined(_M_IX86))
-# define LG_QUANTUM 4
-# endif
-# ifdef __ia64__
-# define LG_QUANTUM 4
-# endif
-# ifdef __alpha__
-# define LG_QUANTUM 4
-# endif
-# if (defined(__sparc64__) || defined(__sparcv9) || defined(__sparc_v9__))
-# define LG_QUANTUM 4
-# endif
-# if (defined(__amd64__) || defined(__x86_64__) || defined(_M_X64))
-# define LG_QUANTUM 4
-# endif
-# ifdef __arm__
-# define LG_QUANTUM 3
-# endif
-# ifdef __aarch64__
-# define LG_QUANTUM 4
-# endif
-# ifdef __hppa__
-# define LG_QUANTUM 4
-# endif
-# ifdef __mips__
-# define LG_QUANTUM 3
-# endif
-# ifdef __or1k__
-# define LG_QUANTUM 3
-# endif
-# ifdef __powerpc__
-# define LG_QUANTUM 4
-# endif
-# ifdef __riscv__
-# define LG_QUANTUM 4
-# endif
-# ifdef __s390__
-# define LG_QUANTUM 4
-# endif
-# ifdef __SH4__
-# define LG_QUANTUM 4
-# endif
-# ifdef __tile__
-# define LG_QUANTUM 4
-# endif
-# ifdef __le32__
-# define LG_QUANTUM 4
-# endif
-# ifndef LG_QUANTUM
-# error "Unknown minimum alignment for architecture; specify via "
- "--with-lg-quantum"
-# endif
-#endif
-
-#define QUANTUM ((size_t)(1U << LG_QUANTUM))
-#define QUANTUM_MASK (QUANTUM - 1)
-
-/* Return the smallest quantum multiple that is >= a. */
-#define QUANTUM_CEILING(a) \
- (((a) + QUANTUM_MASK) & ~QUANTUM_MASK)
-
-#define LONG ((size_t)(1U << LG_SIZEOF_LONG))
-#define LONG_MASK (LONG - 1)
-
-/* Return the smallest long multiple that is >= a. */
-#define LONG_CEILING(a) \
- (((a) + LONG_MASK) & ~LONG_MASK)
-
-#define SIZEOF_PTR (1U << LG_SIZEOF_PTR)
-#define PTR_MASK (SIZEOF_PTR - 1)
-
-/* Return the smallest (void *) multiple that is >= a. */
-#define PTR_CEILING(a) \
- (((a) + PTR_MASK) & ~PTR_MASK)
-
-/*
- * Maximum size of L1 cache line. This is used to avoid cache line aliasing.
- * In addition, this controls the spacing of cacheline-spaced size classes.
- *
- * CACHELINE cannot be based on LG_CACHELINE because __declspec(align()) can
- * only handle raw constants.
- */
-#define LG_CACHELINE 6
-#define CACHELINE 64
-#define CACHELINE_MASK (CACHELINE - 1)
-
-/* Return the smallest cacheline multiple that is >= s. */
-#define CACHELINE_CEILING(s) \
- (((s) + CACHELINE_MASK) & ~CACHELINE_MASK)
-
-/* Page size. LG_PAGE is determined by the configure script. */
-#ifdef PAGE_MASK
-# undef PAGE_MASK
-#endif
-#define PAGE ((size_t)(1U << LG_PAGE))
-#define PAGE_MASK ((size_t)(PAGE - 1))
-
-/* Return the page base address for the page containing address a. */
-#define PAGE_ADDR2BASE(a) \
- ((void *)((uintptr_t)(a) & ~PAGE_MASK))
-
-/* Return the smallest pagesize multiple that is >= s. */
-#define PAGE_CEILING(s) \
- (((s) + PAGE_MASK) & ~PAGE_MASK)
-
-/* Return the nearest aligned address at or below a. */
-#define ALIGNMENT_ADDR2BASE(a, alignment) \
- ((void *)((uintptr_t)(a) & (-(alignment))))
-
-/* Return the offset between a and the nearest aligned address at or below a. */
-#define ALIGNMENT_ADDR2OFFSET(a, alignment) \
- ((size_t)((uintptr_t)(a) & (alignment - 1)))
-
-/* Return the smallest alignment multiple that is >= s. */
-#define ALIGNMENT_CEILING(s, alignment) \
- (((s) + (alignment - 1)) & (-(alignment)))
-
-/* Declare a variable-length array. */
-#if __STDC_VERSION__ < 199901L
-# ifdef _MSC_VER
-# include <malloc.h>
-# define alloca _alloca
-# else
-# ifdef JEMALLOC_HAS_ALLOCA_H
-# include <alloca.h>
-# else
-# include <stdlib.h>
-# endif
-# endif
-# define VARIABLE_ARRAY(type, name, count) \
- type *name = alloca(sizeof(type) * (count))
-#else
-# define VARIABLE_ARRAY(type, name, count) type name[(count)]
-#endif
-
-#include "jemalloc/internal/nstime.h"
-#include "jemalloc/internal/valgrind.h"
-#include "jemalloc/internal/util.h"
-#include "jemalloc/internal/atomic.h"
-#include "jemalloc/internal/spin.h"
-#include "jemalloc/internal/prng.h"
-#include "jemalloc/internal/ticker.h"
-#include "jemalloc/internal/ckh.h"
-#include "jemalloc/internal/size_classes.h"
-#include "jemalloc/internal/smoothstep.h"
-#include "jemalloc/internal/stats.h"
-#include "jemalloc/internal/ctl.h"
-#include "jemalloc/internal/witness.h"
-#include "jemalloc/internal/mutex.h"
-#include "jemalloc/internal/tsd.h"
-#include "jemalloc/internal/mb.h"
-#include "jemalloc/internal/extent.h"
-#include "jemalloc/internal/arena.h"
-#include "jemalloc/internal/bitmap.h"
-#include "jemalloc/internal/base.h"
-#include "jemalloc/internal/rtree.h"
-#include "jemalloc/internal/pages.h"
-#include "jemalloc/internal/chunk.h"
-#include "jemalloc/internal/huge.h"
-#include "jemalloc/internal/tcache.h"
-#include "jemalloc/internal/hash.h"
-#include "jemalloc/internal/quarantine.h"
-#include "jemalloc/internal/prof.h"
-
-#undef JEMALLOC_H_TYPES
-/******************************************************************************/
-#define JEMALLOC_H_STRUCTS
-
-#include "jemalloc/internal/nstime.h"
-#include "jemalloc/internal/valgrind.h"
-#include "jemalloc/internal/util.h"
-#include "jemalloc/internal/atomic.h"
-#include "jemalloc/internal/spin.h"
-#include "jemalloc/internal/prng.h"
-#include "jemalloc/internal/ticker.h"
-#include "jemalloc/internal/ckh.h"
-#include "jemalloc/internal/size_classes.h"
-#include "jemalloc/internal/smoothstep.h"
-#include "jemalloc/internal/stats.h"
-#include "jemalloc/internal/ctl.h"
-#include "jemalloc/internal/witness.h"
-#include "jemalloc/internal/mutex.h"
-#include "jemalloc/internal/mb.h"
-#include "jemalloc/internal/bitmap.h"
-#define JEMALLOC_ARENA_STRUCTS_A
-#include "jemalloc/internal/arena.h"
-#undef JEMALLOC_ARENA_STRUCTS_A
-#include "jemalloc/internal/extent.h"
-#define JEMALLOC_ARENA_STRUCTS_B
-#include "jemalloc/internal/arena.h"
-#undef JEMALLOC_ARENA_STRUCTS_B
-#include "jemalloc/internal/base.h"
-#include "jemalloc/internal/rtree.h"
-#include "jemalloc/internal/pages.h"
-#include "jemalloc/internal/chunk.h"
-#include "jemalloc/internal/huge.h"
-#include "jemalloc/internal/tcache.h"
-#include "jemalloc/internal/hash.h"
-#include "jemalloc/internal/quarantine.h"
-#include "jemalloc/internal/prof.h"
-
-#include "jemalloc/internal/tsd.h"
-
-#undef JEMALLOC_H_STRUCTS
-/******************************************************************************/
-#define JEMALLOC_H_EXTERNS
-
-extern bool opt_abort;
-extern const char *opt_junk;
-extern bool opt_junk_alloc;
-extern bool opt_junk_free;
-extern size_t opt_quarantine;
-extern bool opt_redzone;
-extern bool opt_utrace;
-extern bool opt_xmalloc;
-extern bool opt_zero;
-extern unsigned opt_narenas;
-
-extern bool in_valgrind;
-
-/* Number of CPUs. */
-extern unsigned ncpus;
-
-/* Number of arenas used for automatic multiplexing of threads and arenas. */
-extern unsigned narenas_auto;
-
-/*
- * Arenas that are used to service external requests. Not all elements of the
- * arenas array are necessarily used; arenas are created lazily as needed.
- */
-extern arena_t **arenas;
-
-/*
- * pind2sz_tab encodes the same information as could be computed by
- * pind2sz_compute().
- */
-extern size_t const pind2sz_tab[NPSIZES];
-/*
- * index2size_tab encodes the same information as could be computed (at
- * unacceptable cost in some code paths) by index2size_compute().
- */
-extern size_t const index2size_tab[NSIZES];
-/*
- * size2index_tab is a compact lookup table that rounds request sizes up to
- * size classes. In order to reduce cache footprint, the table is compressed,
- * and all accesses are via size2index().
- */
-extern uint8_t const size2index_tab[];
-
-arena_t *a0get(void);
-void *a0malloc(size_t size);
-void a0dalloc(void *ptr);
-void *bootstrap_malloc(size_t size);
-void *bootstrap_calloc(size_t num, size_t size);
-void bootstrap_free(void *ptr);
-unsigned narenas_total_get(void);
-arena_t *arena_init(tsdn_t *tsdn, unsigned ind);
-arena_tdata_t *arena_tdata_get_hard(tsd_t *tsd, unsigned ind);
-arena_t *arena_choose_hard(tsd_t *tsd, bool internal);
-void arena_migrate(tsd_t *tsd, unsigned oldind, unsigned newind);
-void thread_allocated_cleanup(tsd_t *tsd);
-void thread_deallocated_cleanup(tsd_t *tsd);
-void iarena_cleanup(tsd_t *tsd);
-void arena_cleanup(tsd_t *tsd);
-void arenas_tdata_cleanup(tsd_t *tsd);
-void narenas_tdata_cleanup(tsd_t *tsd);
-void arenas_tdata_bypass_cleanup(tsd_t *tsd);
-void jemalloc_prefork(void);
-void jemalloc_postfork_parent(void);
-void jemalloc_postfork_child(void);
-
-#include "jemalloc/internal/nstime.h"
-#include "jemalloc/internal/valgrind.h"
-#include "jemalloc/internal/util.h"
-#include "jemalloc/internal/atomic.h"
-#include "jemalloc/internal/spin.h"
-#include "jemalloc/internal/prng.h"
-#include "jemalloc/internal/ticker.h"
-#include "jemalloc/internal/ckh.h"
-#include "jemalloc/internal/size_classes.h"
-#include "jemalloc/internal/smoothstep.h"
-#include "jemalloc/internal/stats.h"
-#include "jemalloc/internal/ctl.h"
-#include "jemalloc/internal/witness.h"
-#include "jemalloc/internal/mutex.h"
-#include "jemalloc/internal/mb.h"
-#include "jemalloc/internal/bitmap.h"
-#include "jemalloc/internal/extent.h"
-#include "jemalloc/internal/arena.h"
-#include "jemalloc/internal/base.h"
-#include "jemalloc/internal/rtree.h"
-#include "jemalloc/internal/pages.h"
-#include "jemalloc/internal/chunk.h"
-#include "jemalloc/internal/huge.h"
-#include "jemalloc/internal/tcache.h"
-#include "jemalloc/internal/hash.h"
-#include "jemalloc/internal/quarantine.h"
-#include "jemalloc/internal/prof.h"
-#include "jemalloc/internal/tsd.h"
-
-#undef JEMALLOC_H_EXTERNS
-/******************************************************************************/
-#define JEMALLOC_H_INLINES
-
-#include "jemalloc/internal/nstime.h"
-#include "jemalloc/internal/valgrind.h"
-#include "jemalloc/internal/util.h"
-#include "jemalloc/internal/atomic.h"
-#include "jemalloc/internal/spin.h"
-#include "jemalloc/internal/prng.h"
-#include "jemalloc/internal/ticker.h"
-#include "jemalloc/internal/ckh.h"
-#include "jemalloc/internal/size_classes.h"
-#include "jemalloc/internal/smoothstep.h"
-#include "jemalloc/internal/stats.h"
-#include "jemalloc/internal/ctl.h"
-#include "jemalloc/internal/tsd.h"
-#include "jemalloc/internal/witness.h"
-#include "jemalloc/internal/mutex.h"
-#include "jemalloc/internal/mb.h"
-#include "jemalloc/internal/extent.h"
-#include "jemalloc/internal/base.h"
-#include "jemalloc/internal/rtree.h"
-#include "jemalloc/internal/pages.h"
-#include "jemalloc/internal/chunk.h"
-#include "jemalloc/internal/huge.h"
-
-#ifndef JEMALLOC_ENABLE_INLINE
-pszind_t psz2ind(size_t psz);
-size_t pind2sz_compute(pszind_t pind);
-size_t pind2sz_lookup(pszind_t pind);
-size_t pind2sz(pszind_t pind);
-size_t psz2u(size_t psz);
-szind_t size2index_compute(size_t size);
-szind_t size2index_lookup(size_t size);
-szind_t size2index(size_t size);
-size_t index2size_compute(szind_t index);
-size_t index2size_lookup(szind_t index);
-size_t index2size(szind_t index);
-size_t s2u_compute(size_t size);
-size_t s2u_lookup(size_t size);
-size_t s2u(size_t size);
-size_t sa2u(size_t size, size_t alignment);
-arena_t *arena_choose_impl(tsd_t *tsd, arena_t *arena, bool internal);
-arena_t *arena_choose(tsd_t *tsd, arena_t *arena);
-arena_t *arena_ichoose(tsd_t *tsd, arena_t *arena);
-arena_tdata_t *arena_tdata_get(tsd_t *tsd, unsigned ind,
- bool refresh_if_missing);
-arena_t *arena_get(tsdn_t *tsdn, unsigned ind, bool init_if_missing);
-ticker_t *decay_ticker_get(tsd_t *tsd, unsigned ind);
-#endif
-
-#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_C_))
-JEMALLOC_INLINE pszind_t
-psz2ind(size_t psz)
-{
-
- if (unlikely(psz > HUGE_MAXCLASS))
- return (NPSIZES);
- {
- pszind_t x = lg_floor((psz<<1)-1);
- pszind_t shift = (x < LG_SIZE_CLASS_GROUP + LG_PAGE) ? 0 : x -
- (LG_SIZE_CLASS_GROUP + LG_PAGE);
- pszind_t grp = shift << LG_SIZE_CLASS_GROUP;
-
- pszind_t lg_delta = (x < LG_SIZE_CLASS_GROUP + LG_PAGE + 1) ?
- LG_PAGE : x - LG_SIZE_CLASS_GROUP - 1;
-
- size_t delta_inverse_mask = ZI(-1) << lg_delta;
- pszind_t mod = ((((psz-1) & delta_inverse_mask) >> lg_delta)) &
- ((ZU(1) << LG_SIZE_CLASS_GROUP) - 1);
-
- pszind_t ind = grp + mod;
- return (ind);
- }
-}
-
-JEMALLOC_INLINE size_t
-pind2sz_compute(pszind_t pind)
-{
-
- {
- size_t grp = pind >> LG_SIZE_CLASS_GROUP;
- size_t mod = pind & ((ZU(1) << LG_SIZE_CLASS_GROUP) - 1);
-
- size_t grp_size_mask = ~((!!grp)-1);
- size_t grp_size = ((ZU(1) << (LG_PAGE +
- (LG_SIZE_CLASS_GROUP-1))) << grp) & grp_size_mask;
-
- size_t shift = (grp == 0) ? 1 : grp;
- size_t lg_delta = shift + (LG_PAGE-1);
- size_t mod_size = (mod+1) << lg_delta;
-
- size_t sz = grp_size + mod_size;
- return (sz);
- }
-}
-
-JEMALLOC_INLINE size_t
-pind2sz_lookup(pszind_t pind)
-{
- size_t ret = (size_t)pind2sz_tab[pind];
- assert(ret == pind2sz_compute(pind));
- return (ret);
-}
-
-JEMALLOC_INLINE size_t
-pind2sz(pszind_t pind)
-{
-
- assert(pind < NPSIZES);
- return (pind2sz_lookup(pind));
-}
-
-JEMALLOC_INLINE size_t
-psz2u(size_t psz)
-{
-
- if (unlikely(psz > HUGE_MAXCLASS))
- return (0);
- {
- size_t x = lg_floor((psz<<1)-1);
- size_t lg_delta = (x < LG_SIZE_CLASS_GROUP + LG_PAGE + 1) ?
- LG_PAGE : x - LG_SIZE_CLASS_GROUP - 1;
- size_t delta = ZU(1) << lg_delta;
- size_t delta_mask = delta - 1;
- size_t usize = (psz + delta_mask) & ~delta_mask;
- return (usize);
- }
-}
-
-JEMALLOC_INLINE szind_t
-size2index_compute(size_t size)
-{
-
- if (unlikely(size > HUGE_MAXCLASS))
- return (NSIZES);
-#if (NTBINS != 0)
- if (size <= (ZU(1) << LG_TINY_MAXCLASS)) {
- szind_t lg_tmin = LG_TINY_MAXCLASS - NTBINS + 1;
- szind_t lg_ceil = lg_floor(pow2_ceil_zu(size));
- return (lg_ceil < lg_tmin ? 0 : lg_ceil - lg_tmin);
- }
-#endif
- {
- szind_t x = lg_floor((size<<1)-1);
- szind_t shift = (x < LG_SIZE_CLASS_GROUP + LG_QUANTUM) ? 0 :
- x - (LG_SIZE_CLASS_GROUP + LG_QUANTUM);
- szind_t grp = shift << LG_SIZE_CLASS_GROUP;
-
- szind_t lg_delta = (x < LG_SIZE_CLASS_GROUP + LG_QUANTUM + 1)
- ? LG_QUANTUM : x - LG_SIZE_CLASS_GROUP - 1;
-
- size_t delta_inverse_mask = ZI(-1) << lg_delta;
- szind_t mod = ((((size-1) & delta_inverse_mask) >> lg_delta)) &
- ((ZU(1) << LG_SIZE_CLASS_GROUP) - 1);
-
- szind_t index = NTBINS + grp + mod;
- return (index);
- }
-}
-
-JEMALLOC_ALWAYS_INLINE szind_t
-size2index_lookup(size_t size)
-{
-
- assert(size <= LOOKUP_MAXCLASS);
- {
- szind_t ret = (size2index_tab[(size-1) >> LG_TINY_MIN]);
- assert(ret == size2index_compute(size));
- return (ret);
- }
-}
-
-JEMALLOC_ALWAYS_INLINE szind_t
-size2index(size_t size)
-{
-
- assert(size > 0);
- if (likely(size <= LOOKUP_MAXCLASS))
- return (size2index_lookup(size));
- return (size2index_compute(size));
-}
-
-JEMALLOC_INLINE size_t
-index2size_compute(szind_t index)
-{
-
-#if (NTBINS > 0)
- if (index < NTBINS)
- return (ZU(1) << (LG_TINY_MAXCLASS - NTBINS + 1 + index));
-#endif
- {
- size_t reduced_index = index - NTBINS;
- size_t grp = reduced_index >> LG_SIZE_CLASS_GROUP;
- size_t mod = reduced_index & ((ZU(1) << LG_SIZE_CLASS_GROUP) -
- 1);
-
- size_t grp_size_mask = ~((!!grp)-1);
- size_t grp_size = ((ZU(1) << (LG_QUANTUM +
- (LG_SIZE_CLASS_GROUP-1))) << grp) & grp_size_mask;
-
- size_t shift = (grp == 0) ? 1 : grp;
- size_t lg_delta = shift + (LG_QUANTUM-1);
- size_t mod_size = (mod+1) << lg_delta;
-
- size_t usize = grp_size + mod_size;
- return (usize);
- }
-}
-
-JEMALLOC_ALWAYS_INLINE size_t
-index2size_lookup(szind_t index)
-{
- size_t ret = (size_t)index2size_tab[index];
- assert(ret == index2size_compute(index));
- return (ret);
-}
-
-JEMALLOC_ALWAYS_INLINE size_t
-index2size(szind_t index)
-{
-
- assert(index < NSIZES);
- return (index2size_lookup(index));
-}
-
-JEMALLOC_ALWAYS_INLINE size_t
-s2u_compute(size_t size)
-{
-
- if (unlikely(size > HUGE_MAXCLASS))
- return (0);
-#if (NTBINS > 0)
- if (size <= (ZU(1) << LG_TINY_MAXCLASS)) {
- size_t lg_tmin = LG_TINY_MAXCLASS - NTBINS + 1;
- size_t lg_ceil = lg_floor(pow2_ceil_zu(size));
- return (lg_ceil < lg_tmin ? (ZU(1) << lg_tmin) :
- (ZU(1) << lg_ceil));
- }
-#endif
- {
- size_t x = lg_floor((size<<1)-1);
- size_t lg_delta = (x < LG_SIZE_CLASS_GROUP + LG_QUANTUM + 1)
- ? LG_QUANTUM : x - LG_SIZE_CLASS_GROUP - 1;
- size_t delta = ZU(1) << lg_delta;
- size_t delta_mask = delta - 1;
- size_t usize = (size + delta_mask) & ~delta_mask;
- return (usize);
- }
-}
-
-JEMALLOC_ALWAYS_INLINE size_t
-s2u_lookup(size_t size)
-{
- size_t ret = index2size_lookup(size2index_lookup(size));
-
- assert(ret == s2u_compute(size));
- return (ret);
-}
-
-/*
- * Compute usable size that would result from allocating an object with the
- * specified size.
- */
-JEMALLOC_ALWAYS_INLINE size_t
-s2u(size_t size)
-{
-
- assert(size > 0);
- if (likely(size <= LOOKUP_MAXCLASS))
- return (s2u_lookup(size));
- return (s2u_compute(size));
-}
-
-/*
- * Compute usable size that would result from allocating an object with the
- * specified size and alignment.
- */
-JEMALLOC_ALWAYS_INLINE size_t
-sa2u(size_t size, size_t alignment)
-{
- size_t usize;
-
- assert(alignment != 0 && ((alignment - 1) & alignment) == 0);
-
- /* Try for a small size class. */
- if (size <= SMALL_MAXCLASS && alignment < PAGE) {
- /*
- * Round size up to the nearest multiple of alignment.
- *
- * This done, we can take advantage of the fact that for each
- * small size class, every object is aligned at the smallest
- * power of two that is non-zero in the base two representation
- * of the size. For example:
- *
- * Size | Base 2 | Minimum alignment
- * -----+----------+------------------
- * 96 | 1100000 | 32
- * 144 | 10100000 | 32
- * 192 | 11000000 | 64
- */
- usize = s2u(ALIGNMENT_CEILING(size, alignment));
- if (usize < LARGE_MINCLASS)
- return (usize);
- }
-
- /* Try for a large size class. */
- if (likely(size <= large_maxclass) && likely(alignment < chunksize)) {
- /*
- * We can't achieve subpage alignment, so round up alignment
- * to the minimum that can actually be supported.
- */
- alignment = PAGE_CEILING(alignment);
-
- /* Make sure result is a large size class. */
- usize = (size <= LARGE_MINCLASS) ? LARGE_MINCLASS : s2u(size);
-
- /*
- * Calculate the size of the over-size run that arena_palloc()
- * would need to allocate in order to guarantee the alignment.
- */
- if (usize + large_pad + alignment - PAGE <= arena_maxrun)
- return (usize);
- }
-
- /* Huge size class. Beware of overflow. */
-
- if (unlikely(alignment > HUGE_MAXCLASS))
- return (0);
-
- /*
- * We can't achieve subchunk alignment, so round up alignment to the
- * minimum that can actually be supported.
- */
- alignment = CHUNK_CEILING(alignment);
-
- /* Make sure result is a huge size class. */
- if (size <= chunksize)
- usize = chunksize;
- else {
- usize = s2u(size);
- if (usize < size) {
- /* size_t overflow. */
- return (0);
- }
- }
-
- /*
- * Calculate the multi-chunk mapping that huge_palloc() would need in
- * order to guarantee the alignment.
- */
- if (usize + alignment - PAGE < usize) {
- /* size_t overflow. */
- return (0);
- }
- return (usize);
-}
-
-/* Choose an arena based on a per-thread value. */
-JEMALLOC_INLINE arena_t *
-arena_choose_impl(tsd_t *tsd, arena_t *arena, bool internal)
-{
- arena_t *ret;
-
- if (arena != NULL)
- return (arena);
-
- ret = internal ? tsd_iarena_get(tsd) : tsd_arena_get(tsd);
- if (unlikely(ret == NULL))
- ret = arena_choose_hard(tsd, internal);
-
- return (ret);
-}
-
-JEMALLOC_INLINE arena_t *
-arena_choose(tsd_t *tsd, arena_t *arena)
-{
-
- return (arena_choose_impl(tsd, arena, false));
-}
-
-JEMALLOC_INLINE arena_t *
-arena_ichoose(tsd_t *tsd, arena_t *arena)
-{
-
- return (arena_choose_impl(tsd, arena, true));
-}
-
-JEMALLOC_INLINE arena_tdata_t *
-arena_tdata_get(tsd_t *tsd, unsigned ind, bool refresh_if_missing)
-{
- arena_tdata_t *tdata;
- arena_tdata_t *arenas_tdata = tsd_arenas_tdata_get(tsd);
-
- if (unlikely(arenas_tdata == NULL)) {
- /* arenas_tdata hasn't been initialized yet. */
- return (arena_tdata_get_hard(tsd, ind));
- }
- if (unlikely(ind >= tsd_narenas_tdata_get(tsd))) {
- /*
- * ind is invalid, cache is old (too small), or tdata to be
- * initialized.
- */
- return (refresh_if_missing ? arena_tdata_get_hard(tsd, ind) :
- NULL);
- }
-
- tdata = &arenas_tdata[ind];
- if (likely(tdata != NULL) || !refresh_if_missing)
- return (tdata);
- return (arena_tdata_get_hard(tsd, ind));
-}
-
-JEMALLOC_INLINE arena_t *
-arena_get(tsdn_t *tsdn, unsigned ind, bool init_if_missing)
-{
- arena_t *ret;
-
- assert(ind <= MALLOCX_ARENA_MAX);
-
- ret = arenas[ind];
- if (unlikely(ret == NULL)) {
- ret = atomic_read_p((void *)&arenas[ind]);
- if (init_if_missing && unlikely(ret == NULL))
- ret = arena_init(tsdn, ind);
- }
- return (ret);
-}
-
-JEMALLOC_INLINE ticker_t *
-decay_ticker_get(tsd_t *tsd, unsigned ind)
-{
- arena_tdata_t *tdata;
-
- tdata = arena_tdata_get(tsd, ind, true);
- if (unlikely(tdata == NULL))
- return (NULL);
- return (&tdata->decay_ticker);
-}
-#endif
-
-#include "jemalloc/internal/bitmap.h"
-/*
- * Include portions of arena.h interleaved with tcache.h in order to resolve
- * circular dependencies.
- */
-#define JEMALLOC_ARENA_INLINE_A
-#include "jemalloc/internal/arena.h"
-#undef JEMALLOC_ARENA_INLINE_A
-#include "jemalloc/internal/tcache.h"
-#define JEMALLOC_ARENA_INLINE_B
-#include "jemalloc/internal/arena.h"
-#undef JEMALLOC_ARENA_INLINE_B
-#include "jemalloc/internal/hash.h"
-#include "jemalloc/internal/quarantine.h"
-
-#ifndef JEMALLOC_ENABLE_INLINE
-arena_t *iaalloc(const void *ptr);
-size_t isalloc(tsdn_t *tsdn, const void *ptr, bool demote);
-void *iallocztm(tsdn_t *tsdn, size_t size, szind_t ind, bool zero,
- tcache_t *tcache, bool is_metadata, arena_t *arena, bool slow_path);
-void *ialloc(tsd_t *tsd, size_t size, szind_t ind, bool zero,
- bool slow_path);
-void *ipallocztm(tsdn_t *tsdn, size_t usize, size_t alignment, bool zero,
- tcache_t *tcache, bool is_metadata, arena_t *arena);
-void *ipalloct(tsdn_t *tsdn, size_t usize, size_t alignment, bool zero,
- tcache_t *tcache, arena_t *arena);
-void *ipalloc(tsd_t *tsd, size_t usize, size_t alignment, bool zero);
-size_t ivsalloc(tsdn_t *tsdn, const void *ptr, bool demote);
-size_t u2rz(size_t usize);
-size_t p2rz(tsdn_t *tsdn, const void *ptr);
-void idalloctm(tsdn_t *tsdn, void *ptr, tcache_t *tcache, bool is_metadata,
- bool slow_path);
-void idalloc(tsd_t *tsd, void *ptr);
-void iqalloc(tsd_t *tsd, void *ptr, tcache_t *tcache, bool slow_path);
-void isdalloct(tsdn_t *tsdn, void *ptr, size_t size, tcache_t *tcache,
- bool slow_path);
-void isqalloc(tsd_t *tsd, void *ptr, size_t size, tcache_t *tcache,
- bool slow_path);
-void *iralloct_realign(tsd_t *tsd, void *ptr, size_t oldsize, size_t size,
- size_t extra, size_t alignment, bool zero, tcache_t *tcache,
- arena_t *arena);
-void *iralloct(tsd_t *tsd, void *ptr, size_t oldsize, size_t size,
- size_t alignment, bool zero, tcache_t *tcache, arena_t *arena);
-void *iralloc(tsd_t *tsd, void *ptr, size_t oldsize, size_t size,
- size_t alignment, bool zero);
-bool ixalloc(tsdn_t *tsdn, void *ptr, size_t oldsize, size_t size,
- size_t extra, size_t alignment, bool zero);
-#endif
-
-#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_C_))
-JEMALLOC_ALWAYS_INLINE arena_t *
-iaalloc(const void *ptr)
-{
-
- assert(ptr != NULL);
-
- return (arena_aalloc(ptr));
-}
-
-/*
- * Typical usage:
- * tsdn_t *tsdn = [...]
- * void *ptr = [...]
- * size_t sz = isalloc(tsdn, ptr, config_prof);
- */
-JEMALLOC_ALWAYS_INLINE size_t
-isalloc(tsdn_t *tsdn, const void *ptr, bool demote)
-{
-
- assert(ptr != NULL);
- /* Demotion only makes sense if config_prof is true. */
- assert(config_prof || !demote);
-
- return (arena_salloc(tsdn, ptr, demote));
-}
-
-JEMALLOC_ALWAYS_INLINE void *
-iallocztm(tsdn_t *tsdn, size_t size, szind_t ind, bool zero, tcache_t *tcache,
- bool is_metadata, arena_t *arena, bool slow_path)
-{
- void *ret;
-
- assert(size != 0);
- assert(!is_metadata || tcache == NULL);
- assert(!is_metadata || arena == NULL || arena->ind < narenas_auto);
-
- ret = arena_malloc(tsdn, arena, size, ind, zero, tcache, slow_path);
- if (config_stats && is_metadata && likely(ret != NULL)) {
- arena_metadata_allocated_add(iaalloc(ret),
- isalloc(tsdn, ret, config_prof));
- }
- return (ret);
-}
-
-JEMALLOC_ALWAYS_INLINE void *
-ialloc(tsd_t *tsd, size_t size, szind_t ind, bool zero, bool slow_path)
-{
-
- return (iallocztm(tsd_tsdn(tsd), size, ind, zero, tcache_get(tsd, true),
- false, NULL, slow_path));
-}
-
-JEMALLOC_ALWAYS_INLINE void *
-ipallocztm(tsdn_t *tsdn, size_t usize, size_t alignment, bool zero,
- tcache_t *tcache, bool is_metadata, arena_t *arena)
-{
- void *ret;
-
- assert(usize != 0);
- assert(usize == sa2u(usize, alignment));
- assert(!is_metadata || tcache == NULL);
- assert(!is_metadata || arena == NULL || arena->ind < narenas_auto);
-
- ret = arena_palloc(tsdn, arena, usize, alignment, zero, tcache);
- assert(ALIGNMENT_ADDR2BASE(ret, alignment) == ret);
- if (config_stats && is_metadata && likely(ret != NULL)) {
- arena_metadata_allocated_add(iaalloc(ret), isalloc(tsdn, ret,
- config_prof));
- }
- return (ret);
-}
-
-JEMALLOC_ALWAYS_INLINE void *
-ipalloct(tsdn_t *tsdn, size_t usize, size_t alignment, bool zero,
- tcache_t *tcache, arena_t *arena)
-{
-
- return (ipallocztm(tsdn, usize, alignment, zero, tcache, false, arena));
-}
-
-JEMALLOC_ALWAYS_INLINE void *
-ipalloc(tsd_t *tsd, size_t usize, size_t alignment, bool zero)
-{
-
- return (ipallocztm(tsd_tsdn(tsd), usize, alignment, zero,
- tcache_get(tsd, true), false, NULL));
-}
-
-JEMALLOC_ALWAYS_INLINE size_t
-ivsalloc(tsdn_t *tsdn, const void *ptr, bool demote)
-{
- extent_node_t *node;
-
- /* Return 0 if ptr is not within a chunk managed by jemalloc. */
- node = chunk_lookup(ptr, false);
- if (node == NULL)
- return (0);
- /* Only arena chunks should be looked up via interior pointers. */
- assert(extent_node_addr_get(node) == ptr ||
- extent_node_achunk_get(node));
-
- return (isalloc(tsdn, ptr, demote));
-}
-
-JEMALLOC_INLINE size_t
-u2rz(size_t usize)
-{
- size_t ret;
-
- if (usize <= SMALL_MAXCLASS) {
- szind_t binind = size2index(usize);
- ret = arena_bin_info[binind].redzone_size;
- } else
- ret = 0;
-
- return (ret);
-}
-
-JEMALLOC_INLINE size_t
-p2rz(tsdn_t *tsdn, const void *ptr)
-{
- size_t usize = isalloc(tsdn, ptr, false);
-
- return (u2rz(usize));
-}
-
-JEMALLOC_ALWAYS_INLINE void
-idalloctm(tsdn_t *tsdn, void *ptr, tcache_t *tcache, bool is_metadata,
- bool slow_path)
-{
-
- assert(ptr != NULL);
- assert(!is_metadata || tcache == NULL);
- assert(!is_metadata || iaalloc(ptr)->ind < narenas_auto);
- if (config_stats && is_metadata) {
- arena_metadata_allocated_sub(iaalloc(ptr), isalloc(tsdn, ptr,
- config_prof));
- }
-
- arena_dalloc(tsdn, ptr, tcache, slow_path);
-}
-
-JEMALLOC_ALWAYS_INLINE void
-idalloc(tsd_t *tsd, void *ptr)
-{
-
- idalloctm(tsd_tsdn(tsd), ptr, tcache_get(tsd, false), false, true);
-}
-
-JEMALLOC_ALWAYS_INLINE void
-iqalloc(tsd_t *tsd, void *ptr, tcache_t *tcache, bool slow_path)
-{
-
- if (slow_path && config_fill && unlikely(opt_quarantine))
- quarantine(tsd, ptr);
- else
- idalloctm(tsd_tsdn(tsd), ptr, tcache, false, slow_path);
-}
-
-JEMALLOC_ALWAYS_INLINE void
-isdalloct(tsdn_t *tsdn, void *ptr, size_t size, tcache_t *tcache,
- bool slow_path)
-{
-
- arena_sdalloc(tsdn, ptr, size, tcache, slow_path);
-}
-
-JEMALLOC_ALWAYS_INLINE void
-isqalloc(tsd_t *tsd, void *ptr, size_t size, tcache_t *tcache, bool slow_path)
-{
-
- if (slow_path && config_fill && unlikely(opt_quarantine))
- quarantine(tsd, ptr);
- else
- isdalloct(tsd_tsdn(tsd), ptr, size, tcache, slow_path);
-}
-
-JEMALLOC_ALWAYS_INLINE void *
-iralloct_realign(tsd_t *tsd, void *ptr, size_t oldsize, size_t size,
- size_t extra, size_t alignment, bool zero, tcache_t *tcache, arena_t *arena)
-{
- void *p;
- size_t usize, copysize;
-
- usize = sa2u(size + extra, alignment);
- if (unlikely(usize == 0 || usize > HUGE_MAXCLASS))
- return (NULL);
- p = ipalloct(tsd_tsdn(tsd), usize, alignment, zero, tcache, arena);
- if (p == NULL) {
- if (extra == 0)
- return (NULL);
- /* Try again, without extra this time. */
- usize = sa2u(size, alignment);
- if (unlikely(usize == 0 || usize > HUGE_MAXCLASS))
- return (NULL);
- p = ipalloct(tsd_tsdn(tsd), usize, alignment, zero, tcache,
- arena);
- if (p == NULL)
- return (NULL);
- }
- /*
- * Copy at most size bytes (not size+extra), since the caller has no
- * expectation that the extra bytes will be reliably preserved.
- */
- copysize = (size < oldsize) ? size : oldsize;
- memcpy(p, ptr, copysize);
- isqalloc(tsd, ptr, oldsize, tcache, true);
- return (p);
-}
-
-JEMALLOC_ALWAYS_INLINE void *
-iralloct(tsd_t *tsd, void *ptr, size_t oldsize, size_t size, size_t alignment,
- bool zero, tcache_t *tcache, arena_t *arena)
-{
-
- assert(ptr != NULL);
- assert(size != 0);
-
- if (alignment != 0 && ((uintptr_t)ptr & ((uintptr_t)alignment-1))
- != 0) {
- /*
- * Existing object alignment is inadequate; allocate new space
- * and copy.
- */
- return (iralloct_realign(tsd, ptr, oldsize, size, 0, alignment,
- zero, tcache, arena));
- }
-
- return (arena_ralloc(tsd, arena, ptr, oldsize, size, alignment, zero,
- tcache));
-}
-
-JEMALLOC_ALWAYS_INLINE void *
-iralloc(tsd_t *tsd, void *ptr, size_t oldsize, size_t size, size_t alignment,
- bool zero)
-{
-
- return (iralloct(tsd, ptr, oldsize, size, alignment, zero,
- tcache_get(tsd, true), NULL));
-}
-
-JEMALLOC_ALWAYS_INLINE bool
-ixalloc(tsdn_t *tsdn, void *ptr, size_t oldsize, size_t size, size_t extra,
- size_t alignment, bool zero)
-{
-
- assert(ptr != NULL);
- assert(size != 0);
-
- if (alignment != 0 && ((uintptr_t)ptr & ((uintptr_t)alignment-1))
- != 0) {
- /* Existing object alignment is inadequate. */
- return (true);
- }
-
- return (arena_ralloc_no_move(tsdn, ptr, oldsize, size, extra, zero));
-}
-#endif
-
-#include "jemalloc/internal/prof.h"
-
-#undef JEMALLOC_H_INLINES
-/******************************************************************************/
-#endif /* JEMALLOC_INTERNAL_H */
diff --git a/memory/jemalloc/src/include/jemalloc/internal/jemalloc_internal_decls.h b/memory/jemalloc/src/include/jemalloc/internal/jemalloc_internal_decls.h
deleted file mode 100644
index c907d91096..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/jemalloc_internal_decls.h
+++ /dev/null
@@ -1,75 +0,0 @@
-#ifndef JEMALLOC_INTERNAL_DECLS_H
-#define JEMALLOC_INTERNAL_DECLS_H
-
-#include <math.h>
-#ifdef _WIN32
-# include <windows.h>
-# include "msvc_compat/windows_extra.h"
-
-#else
-# include <sys/param.h>
-# include <sys/mman.h>
-# if !defined(__pnacl__) && !defined(__native_client__)
-# include <sys/syscall.h>
-# if !defined(SYS_write) && defined(__NR_write)
-# define SYS_write __NR_write
-# endif
-# include <sys/uio.h>
-# endif
-# include <pthread.h>
-# ifdef JEMALLOC_OS_UNFAIR_LOCK
-# include <os/lock.h>
-# endif
-# ifdef JEMALLOC_GLIBC_MALLOC_HOOK
-# include <sched.h>
-# endif
-# include <errno.h>
-# include <sys/time.h>
-# include <time.h>
-# ifdef JEMALLOC_HAVE_MACH_ABSOLUTE_TIME
-# include <mach/mach_time.h>
-# endif
-#endif
-#include <sys/types.h>
-
-#include <limits.h>
-#ifndef SIZE_T_MAX
-# define SIZE_T_MAX SIZE_MAX
-#endif
-#include <stdarg.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdint.h>
-#include <stddef.h>
-#ifndef offsetof
-# define offsetof(type, member) ((size_t)&(((type *)NULL)->member))
-#endif
-#include <string.h>
-#include <strings.h>
-#include <ctype.h>
-#ifdef _MSC_VER
-# include <io.h>
-typedef intptr_t ssize_t;
-# define PATH_MAX 1024
-# define STDERR_FILENO 2
-# define __func__ __FUNCTION__
-# ifdef JEMALLOC_HAS_RESTRICT
-# define restrict __restrict
-# endif
-/* Disable warnings about deprecated system functions. */
-# pragma warning(disable: 4996)
-#if _MSC_VER < 1800
-static int
-isblank(int c)
-{
-
- return (c == '\t' || c == ' ');
-}
-#endif
-#else
-# include <unistd.h>
-#endif
-#include <fcntl.h>
-
-#endif /* JEMALLOC_INTERNAL_H */
diff --git a/memory/jemalloc/src/include/jemalloc/internal/jemalloc_internal_defs.h.in b/memory/jemalloc/src/include/jemalloc/internal/jemalloc_internal_defs.h.in
deleted file mode 100644
index 9b3dca5044..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/jemalloc_internal_defs.h.in
+++ /dev/null
@@ -1,307 +0,0 @@
-#ifndef JEMALLOC_INTERNAL_DEFS_H_
-#define JEMALLOC_INTERNAL_DEFS_H_
-/*
- * If JEMALLOC_PREFIX is defined via --with-jemalloc-prefix, it will cause all
- * public APIs to be prefixed. This makes it possible, with some care, to use
- * multiple allocators simultaneously.
- */
-#undef JEMALLOC_PREFIX
-#undef JEMALLOC_CPREFIX
-
-/*
- * JEMALLOC_PRIVATE_NAMESPACE is used as a prefix for all library-private APIs.
- * For shared libraries, symbol visibility mechanisms prevent these symbols
- * from being exported, but for static libraries, naming collisions are a real
- * possibility.
- */
-#undef JEMALLOC_PRIVATE_NAMESPACE
-
-/*
- * Hyper-threaded CPUs may need a special instruction inside spin loops in
- * order to yield to another virtual CPU.
- */
-#undef CPU_SPINWAIT
-
-/* Defined if C11 atomics are available. */
-#undef JEMALLOC_C11ATOMICS
-
-/* Defined if the equivalent of FreeBSD's atomic(9) functions are available. */
-#undef JEMALLOC_ATOMIC9
-
-/*
- * Defined if OSAtomic*() functions are available, as provided by Darwin, and
- * documented in the atomic(3) manual page.
- */
-#undef JEMALLOC_OSATOMIC
-
-/*
- * Defined if __sync_add_and_fetch(uint32_t *, uint32_t) and
- * __sync_sub_and_fetch(uint32_t *, uint32_t) are available, despite
- * __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4 not being defined (which means the
- * functions are defined in libgcc instead of being inlines).
- */
-#undef JE_FORCE_SYNC_COMPARE_AND_SWAP_4
-
-/*
- * Defined if __sync_add_and_fetch(uint64_t *, uint64_t) and
- * __sync_sub_and_fetch(uint64_t *, uint64_t) are available, despite
- * __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 not being defined (which means the
- * functions are defined in libgcc instead of being inlines).
- */
-#undef JE_FORCE_SYNC_COMPARE_AND_SWAP_8
-
-/*
- * Defined if __builtin_clz() and __builtin_clzl() are available.
- */
-#undef JEMALLOC_HAVE_BUILTIN_CLZ
-
-/*
- * Defined if madvise(2) is available.
- */
-#undef JEMALLOC_HAVE_MADVISE
-
-/*
- * Defined if os_unfair_lock_*() functions are available, as provided by Darwin.
- */
-#undef JEMALLOC_OS_UNFAIR_LOCK
-
-/*
- * Defined if OSSpin*() functions are available, as provided by Darwin, and
- * documented in the spinlock(3) manual page.
- */
-#undef JEMALLOC_OSSPIN
-
-/* Defined if syscall(2) is available. */
-#undef JEMALLOC_HAVE_SYSCALL
-
-/*
- * Defined if secure_getenv(3) is available.
- */
-#undef JEMALLOC_HAVE_SECURE_GETENV
-
-/*
- * Defined if issetugid(2) is available.
- */
-#undef JEMALLOC_HAVE_ISSETUGID
-
-/*
- * Defined if clock_gettime(CLOCK_MONOTONIC_COARSE, ...) is available.
- */
-#undef JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE
-
-/*
- * Defined if clock_gettime(CLOCK_MONOTONIC, ...) is available.
- */
-#undef JEMALLOC_HAVE_CLOCK_MONOTONIC
-
-/*
- * Defined if mach_absolute_time() is available.
- */
-#undef JEMALLOC_HAVE_MACH_ABSOLUTE_TIME
-
-/*
- * Defined if _malloc_thread_cleanup() exists. At least in the case of
- * FreeBSD, pthread_key_create() allocates, which if used during malloc
- * bootstrapping will cause recursion into the pthreads library. Therefore, if
- * _malloc_thread_cleanup() exists, use it as the basis for thread cleanup in
- * malloc_tsd.
- */
-#undef JEMALLOC_MALLOC_THREAD_CLEANUP
-
-/*
- * Defined if threaded initialization is known to be safe on this platform.
- * Among other things, it must be possible to initialize a mutex without
- * triggering allocation in order for threaded allocation to be safe.
- */
-#undef JEMALLOC_THREADED_INIT
-
-/*
- * Defined if the pthreads implementation defines
- * _pthread_mutex_init_calloc_cb(), in which case the function is used in order
- * to avoid recursive allocation during mutex initialization.
- */
-#undef JEMALLOC_MUTEX_INIT_CB
-
-/* Non-empty if the tls_model attribute is supported. */
-#undef JEMALLOC_TLS_MODEL
-
-/* JEMALLOC_CC_SILENCE enables code that silences unuseful compiler warnings. */
-#undef JEMALLOC_CC_SILENCE
-
-/* JEMALLOC_CODE_COVERAGE enables test code coverage analysis. */
-#undef JEMALLOC_CODE_COVERAGE
-
-/*
- * JEMALLOC_DEBUG enables assertions and other sanity checks, and disables
- * inline functions.
- */
-#undef JEMALLOC_DEBUG
-
-/* JEMALLOC_STATS enables statistics calculation. */
-#undef JEMALLOC_STATS
-
-/* JEMALLOC_PROF enables allocation profiling. */
-#undef JEMALLOC_PROF
-
-/* Use libunwind for profile backtracing if defined. */
-#undef JEMALLOC_PROF_LIBUNWIND
-
-/* Use libgcc for profile backtracing if defined. */
-#undef JEMALLOC_PROF_LIBGCC
-
-/* Use gcc intrinsics for profile backtracing if defined. */
-#undef JEMALLOC_PROF_GCC
-
-/*
- * JEMALLOC_TCACHE enables a thread-specific caching layer for small objects.
- * This makes it possible to allocate/deallocate objects without any locking
- * when the cache is in the steady state.
- */
-#undef JEMALLOC_TCACHE
-
-/*
- * JEMALLOC_DSS enables use of sbrk(2) to allocate chunks from the data storage
- * segment (DSS).
- */
-#undef JEMALLOC_DSS
-
-/* Support memory filling (junk/zero/quarantine/redzone). */
-#undef JEMALLOC_FILL
-
-/* Support utrace(2)-based tracing. */
-#undef JEMALLOC_UTRACE
-
-/* Support Valgrind. */
-#undef JEMALLOC_VALGRIND
-
-/* Support optional abort() on OOM. */
-#undef JEMALLOC_XMALLOC
-
-/* Support lazy locking (avoid locking unless a second thread is launched). */
-#undef JEMALLOC_LAZY_LOCK
-
-/* Minimum size class to support is 2^LG_TINY_MIN bytes. */
-#undef LG_TINY_MIN
-
-/*
- * Minimum allocation alignment is 2^LG_QUANTUM bytes (ignoring tiny size
- * classes).
- */
-#undef LG_QUANTUM
-
-/* One page is 2^LG_PAGE bytes. */
-#undef LG_PAGE
-
-/*
- * If defined, adjacent virtual memory mappings with identical attributes
- * automatically coalesce, and they fragment when changes are made to subranges.
- * This is the normal order of things for mmap()/munmap(), but on Windows
- * VirtualAlloc()/VirtualFree() operations must be precisely matched, i.e.
- * mappings do *not* coalesce/fragment.
- */
-#undef JEMALLOC_MAPS_COALESCE
-
-/*
- * If defined, use munmap() to unmap freed chunks, rather than storing them for
- * later reuse. This is disabled by default on Linux because common sequences
- * of mmap()/munmap() calls will cause virtual memory map holes.
- */
-#undef JEMALLOC_MUNMAP
-
-/* TLS is used to map arenas and magazine caches to threads. */
-#undef JEMALLOC_TLS
-
-/*
- * Used to mark unreachable code to quiet "end of non-void" compiler warnings.
- * Don't use this directly; instead use unreachable() from util.h
- */
-#undef JEMALLOC_INTERNAL_UNREACHABLE
-
-/*
- * ffs*() functions to use for bitmapping. Don't use these directly; instead,
- * use ffs_*() from util.h.
- */
-#undef JEMALLOC_INTERNAL_FFSLL
-#undef JEMALLOC_INTERNAL_FFSL
-#undef JEMALLOC_INTERNAL_FFS
-
-/*
- * JEMALLOC_IVSALLOC enables ivsalloc(), which verifies that pointers reside
- * within jemalloc-owned chunks before dereferencing them.
- */
-#undef JEMALLOC_IVSALLOC
-
-/*
- * If defined, explicitly attempt to more uniformly distribute large allocation
- * pointer alignments across all cache indices.
- */
-#undef JEMALLOC_CACHE_OBLIVIOUS
-
-/*
- * Darwin (OS X) uses zones to work around Mach-O symbol override shortcomings.
- */
-#undef JEMALLOC_ZONE
-#undef JEMALLOC_ZONE_VERSION
-
-/*
- * Methods for determining whether the OS overcommits.
- * JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY: Linux's
- * /proc/sys/vm.overcommit_memory file.
- * JEMALLOC_SYSCTL_VM_OVERCOMMIT: FreeBSD's vm.overcommit sysctl.
- */
-#undef JEMALLOC_SYSCTL_VM_OVERCOMMIT
-#undef JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY
-
-/*
- * Methods for purging unused pages differ between operating systems.
- *
- * madvise(..., MADV_DONTNEED) : On Linux, this immediately discards pages,
- * such that new pages will be demand-zeroed if
- * the address region is later touched.
- * madvise(..., MADV_FREE) : On FreeBSD and Darwin, this marks pages as being
- * unused, such that they will be discarded rather
- * than swapped out.
- */
-#undef JEMALLOC_PURGE_MADVISE_DONTNEED
-#undef JEMALLOC_PURGE_MADVISE_FREE
-
-/* Define if operating system has alloca.h header. */
-#undef JEMALLOC_HAS_ALLOCA_H
-
-/* C99 restrict keyword supported. */
-#undef JEMALLOC_HAS_RESTRICT
-
-/* For use by hash code. */
-#undef JEMALLOC_BIG_ENDIAN
-
-/* sizeof(int) == 2^LG_SIZEOF_INT. */
-#undef LG_SIZEOF_INT
-
-/* sizeof(long) == 2^LG_SIZEOF_LONG. */
-#undef LG_SIZEOF_LONG
-
-/* sizeof(long long) == 2^LG_SIZEOF_LONG_LONG. */
-#undef LG_SIZEOF_LONG_LONG
-
-/* sizeof(intmax_t) == 2^LG_SIZEOF_INTMAX_T. */
-#undef LG_SIZEOF_INTMAX_T
-
-/* glibc malloc hooks (__malloc_hook, __realloc_hook, __free_hook). */
-#undef JEMALLOC_GLIBC_MALLOC_HOOK
-
-/* glibc memalign hook. */
-#undef JEMALLOC_GLIBC_MEMALIGN_HOOK
-
-/* Adaptive mutex support in pthreads. */
-#undef JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP
-
-/*
- * If defined, jemalloc symbols are not exported (doesn't work when
- * JEMALLOC_PREFIX is not defined).
- */
-#undef JEMALLOC_EXPORT
-
-/* config.malloc_conf options string. */
-#undef JEMALLOC_CONFIG_MALLOC_CONF
-
-#endif /* JEMALLOC_INTERNAL_DEFS_H_ */
diff --git a/memory/jemalloc/src/include/jemalloc/internal/jemalloc_internal_macros.h b/memory/jemalloc/src/include/jemalloc/internal/jemalloc_internal_macros.h
deleted file mode 100644
index a08ba772ea..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/jemalloc_internal_macros.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * JEMALLOC_ALWAYS_INLINE and JEMALLOC_INLINE are used within header files for
- * functions that are static inline functions if inlining is enabled, and
- * single-definition library-private functions if inlining is disabled.
- *
- * JEMALLOC_ALWAYS_INLINE_C and JEMALLOC_INLINE_C are for use in .c files, in
- * which case the denoted functions are always static, regardless of whether
- * inlining is enabled.
- */
-#if defined(JEMALLOC_DEBUG) || defined(JEMALLOC_CODE_COVERAGE)
- /* Disable inlining to make debugging/profiling easier. */
-# define JEMALLOC_ALWAYS_INLINE
-# define JEMALLOC_ALWAYS_INLINE_C static
-# define JEMALLOC_INLINE
-# define JEMALLOC_INLINE_C static
-# define inline
-#else
-# define JEMALLOC_ENABLE_INLINE
-# ifdef JEMALLOC_HAVE_ATTR
-# define JEMALLOC_ALWAYS_INLINE \
- static inline JEMALLOC_ATTR(unused) JEMALLOC_ATTR(always_inline)
-# define JEMALLOC_ALWAYS_INLINE_C \
- static inline JEMALLOC_ATTR(always_inline)
-# else
-# define JEMALLOC_ALWAYS_INLINE static inline
-# define JEMALLOC_ALWAYS_INLINE_C static inline
-# endif
-# define JEMALLOC_INLINE static inline
-# define JEMALLOC_INLINE_C static inline
-# ifdef _MSC_VER
-# define inline _inline
-# endif
-#endif
-
-#ifdef JEMALLOC_CC_SILENCE
-# define UNUSED JEMALLOC_ATTR(unused)
-#else
-# define UNUSED
-#endif
-
-#define ZU(z) ((size_t)z)
-#define ZI(z) ((ssize_t)z)
-#define QU(q) ((uint64_t)q)
-#define QI(q) ((int64_t)q)
-
-#define KZU(z) ZU(z##ULL)
-#define KZI(z) ZI(z##LL)
-#define KQU(q) QU(q##ULL)
-#define KQI(q) QI(q##LL)
-
-#ifndef __DECONST
-# define __DECONST(type, var) ((type)(uintptr_t)(const void *)(var))
-#endif
-
-#ifndef JEMALLOC_HAS_RESTRICT
-# define restrict
-#endif
diff --git a/memory/jemalloc/src/include/jemalloc/internal/mb.h b/memory/jemalloc/src/include/jemalloc/internal/mb.h
deleted file mode 100644
index 5384728fd5..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/mb.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-#ifndef JEMALLOC_ENABLE_INLINE
-void mb_write(void);
-#endif
-
-#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_MB_C_))
-#ifdef __i386__
-/*
- * According to the Intel Architecture Software Developer's Manual, current
- * processors execute instructions in order from the perspective of other
- * processors in a multiprocessor system, but 1) Intel reserves the right to
- * change that, and 2) the compiler's optimizer could re-order instructions if
- * there weren't some form of barrier. Therefore, even if running on an
- * architecture that does not need memory barriers (everything through at least
- * i686), an "optimizer barrier" is necessary.
- */
-JEMALLOC_INLINE void
-mb_write(void)
-{
-
-# if 0
- /* This is a true memory barrier. */
- asm volatile ("pusha;"
- "xor %%eax,%%eax;"
- "cpuid;"
- "popa;"
- : /* Outputs. */
- : /* Inputs. */
- : "memory" /* Clobbers. */
- );
-# else
- /*
- * This is hopefully enough to keep the compiler from reordering
- * instructions around this one.
- */
- asm volatile ("nop;"
- : /* Outputs. */
- : /* Inputs. */
- : "memory" /* Clobbers. */
- );
-# endif
-}
-#elif (defined(__amd64__) || defined(__x86_64__))
-JEMALLOC_INLINE void
-mb_write(void)
-{
-
- asm volatile ("sfence"
- : /* Outputs. */
- : /* Inputs. */
- : "memory" /* Clobbers. */
- );
-}
-#elif defined(__powerpc__)
-JEMALLOC_INLINE void
-mb_write(void)
-{
-
- asm volatile ("eieio"
- : /* Outputs. */
- : /* Inputs. */
- : "memory" /* Clobbers. */
- );
-}
-#elif defined(__sparc64__)
-JEMALLOC_INLINE void
-mb_write(void)
-{
-
- asm volatile ("membar #StoreStore"
- : /* Outputs. */
- : /* Inputs. */
- : "memory" /* Clobbers. */
- );
-}
-#elif defined(__tile__)
-JEMALLOC_INLINE void
-mb_write(void)
-{
-
- __sync_synchronize();
-}
-#else
-/*
- * This is much slower than a simple memory barrier, but the semantics of mutex
- * unlock make this work.
- */
-JEMALLOC_INLINE void
-mb_write(void)
-{
- malloc_mutex_t mtx;
-
- malloc_mutex_init(&mtx, "mb", WITNESS_RANK_OMIT);
- malloc_mutex_lock(TSDN_NULL, &mtx);
- malloc_mutex_unlock(TSDN_NULL, &mtx);
-}
-#endif
-#endif
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
diff --git a/memory/jemalloc/src/include/jemalloc/internal/mutex.h b/memory/jemalloc/src/include/jemalloc/internal/mutex.h
deleted file mode 100644
index b442d2d4ef..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/mutex.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-typedef struct malloc_mutex_s malloc_mutex_t;
-
-#ifdef _WIN32
-# define MALLOC_MUTEX_INITIALIZER
-#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
-# define MALLOC_MUTEX_INITIALIZER \
- {OS_UNFAIR_LOCK_INIT, WITNESS_INITIALIZER(WITNESS_RANK_OMIT)}
-#elif (defined(JEMALLOC_OSSPIN))
-# define MALLOC_MUTEX_INITIALIZER {0, WITNESS_INITIALIZER(WITNESS_RANK_OMIT)}
-#elif (defined(JEMALLOC_MUTEX_INIT_CB))
-# define MALLOC_MUTEX_INITIALIZER \
- {PTHREAD_MUTEX_INITIALIZER, NULL, WITNESS_INITIALIZER(WITNESS_RANK_OMIT)}
-#else
-# if (defined(JEMALLOC_HAVE_PTHREAD_MUTEX_ADAPTIVE_NP) && \
- defined(PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP))
-# define MALLOC_MUTEX_TYPE PTHREAD_MUTEX_ADAPTIVE_NP
-# define MALLOC_MUTEX_INITIALIZER \
- {PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP, \
- WITNESS_INITIALIZER(WITNESS_RANK_OMIT)}
-# else
-# define MALLOC_MUTEX_TYPE PTHREAD_MUTEX_DEFAULT
-# define MALLOC_MUTEX_INITIALIZER \
- {PTHREAD_MUTEX_INITIALIZER, WITNESS_INITIALIZER(WITNESS_RANK_OMIT)}
-# endif
-#endif
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-struct malloc_mutex_s {
-#ifdef _WIN32
-# if _WIN32_WINNT >= 0x0600
- SRWLOCK lock;
-# else
- CRITICAL_SECTION lock;
-# endif
-#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
- os_unfair_lock lock;
-#elif (defined(JEMALLOC_OSSPIN))
- OSSpinLock lock;
-#elif (defined(JEMALLOC_MUTEX_INIT_CB))
- pthread_mutex_t lock;
- malloc_mutex_t *postponed_next;
-#else
- pthread_mutex_t lock;
-#endif
- witness_t witness;
-};
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-#ifdef JEMALLOC_LAZY_LOCK
-extern bool isthreaded;
-#else
-# undef isthreaded /* Undo private_namespace.h definition. */
-# define isthreaded true
-#endif
-
-bool malloc_mutex_init(malloc_mutex_t *mutex, const char *name,
- witness_rank_t rank);
-void malloc_mutex_prefork(tsdn_t *tsdn, malloc_mutex_t *mutex);
-void malloc_mutex_postfork_parent(tsdn_t *tsdn, malloc_mutex_t *mutex);
-void malloc_mutex_postfork_child(tsdn_t *tsdn, malloc_mutex_t *mutex);
-bool malloc_mutex_boot(void);
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-#ifndef JEMALLOC_ENABLE_INLINE
-void malloc_mutex_lock(tsdn_t *tsdn, malloc_mutex_t *mutex);
-void malloc_mutex_unlock(tsdn_t *tsdn, malloc_mutex_t *mutex);
-void malloc_mutex_assert_owner(tsdn_t *tsdn, malloc_mutex_t *mutex);
-void malloc_mutex_assert_not_owner(tsdn_t *tsdn, malloc_mutex_t *mutex);
-#endif
-
-#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_MUTEX_C_))
-JEMALLOC_INLINE void
-malloc_mutex_lock(tsdn_t *tsdn, malloc_mutex_t *mutex)
-{
-
- if (isthreaded) {
- witness_assert_not_owner(tsdn, &mutex->witness);
-#ifdef _WIN32
-# if _WIN32_WINNT >= 0x0600
- AcquireSRWLockExclusive(&mutex->lock);
-# else
- EnterCriticalSection(&mutex->lock);
-# endif
-#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
- os_unfair_lock_lock(&mutex->lock);
-#elif (defined(JEMALLOC_OSSPIN))
- OSSpinLockLock(&mutex->lock);
-#else
- pthread_mutex_lock(&mutex->lock);
-#endif
- witness_lock(tsdn, &mutex->witness);
- }
-}
-
-JEMALLOC_INLINE void
-malloc_mutex_unlock(tsdn_t *tsdn, malloc_mutex_t *mutex)
-{
-
- if (isthreaded) {
- witness_unlock(tsdn, &mutex->witness);
-#ifdef _WIN32
-# if _WIN32_WINNT >= 0x0600
- ReleaseSRWLockExclusive(&mutex->lock);
-# else
- LeaveCriticalSection(&mutex->lock);
-# endif
-#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
- os_unfair_lock_unlock(&mutex->lock);
-#elif (defined(JEMALLOC_OSSPIN))
- OSSpinLockUnlock(&mutex->lock);
-#else
- pthread_mutex_unlock(&mutex->lock);
-#endif
- }
-}
-
-JEMALLOC_INLINE void
-malloc_mutex_assert_owner(tsdn_t *tsdn, malloc_mutex_t *mutex)
-{
-
- if (isthreaded)
- witness_assert_owner(tsdn, &mutex->witness);
-}
-
-JEMALLOC_INLINE void
-malloc_mutex_assert_not_owner(tsdn_t *tsdn, malloc_mutex_t *mutex)
-{
-
- if (isthreaded)
- witness_assert_not_owner(tsdn, &mutex->witness);
-}
-#endif
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
diff --git a/memory/jemalloc/src/include/jemalloc/internal/nstime.h b/memory/jemalloc/src/include/jemalloc/internal/nstime.h
deleted file mode 100644
index 93b27dc80a..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/nstime.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-typedef struct nstime_s nstime_t;
-
-/* Maximum supported number of seconds (~584 years). */
-#define NSTIME_SEC_MAX KQU(18446744072)
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-struct nstime_s {
- uint64_t ns;
-};
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-void nstime_init(nstime_t *time, uint64_t ns);
-void nstime_init2(nstime_t *time, uint64_t sec, uint64_t nsec);
-uint64_t nstime_ns(const nstime_t *time);
-uint64_t nstime_sec(const nstime_t *time);
-uint64_t nstime_nsec(const nstime_t *time);
-void nstime_copy(nstime_t *time, const nstime_t *source);
-int nstime_compare(const nstime_t *a, const nstime_t *b);
-void nstime_add(nstime_t *time, const nstime_t *addend);
-void nstime_subtract(nstime_t *time, const nstime_t *subtrahend);
-void nstime_imultiply(nstime_t *time, uint64_t multiplier);
-void nstime_idivide(nstime_t *time, uint64_t divisor);
-uint64_t nstime_divide(const nstime_t *time, const nstime_t *divisor);
-#ifdef JEMALLOC_JET
-typedef bool (nstime_monotonic_t)(void);
-extern nstime_monotonic_t *nstime_monotonic;
-typedef bool (nstime_update_t)(nstime_t *);
-extern nstime_update_t *nstime_update;
-#else
-bool nstime_monotonic(void);
-bool nstime_update(nstime_t *time);
-#endif
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
diff --git a/memory/jemalloc/src/include/jemalloc/internal/pages.h b/memory/jemalloc/src/include/jemalloc/internal/pages.h
deleted file mode 100644
index e21effd14f..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/pages.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-void *pages_map(void *addr, size_t size, bool *commit);
-void pages_unmap(void *addr, size_t size);
-void *pages_trim(void *addr, size_t alloc_size, size_t leadsize,
- size_t size, bool *commit);
-bool pages_commit(void *addr, size_t size);
-bool pages_decommit(void *addr, size_t size);
-bool pages_purge(void *addr, size_t size);
-void pages_boot(void);
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
-
diff --git a/memory/jemalloc/src/include/jemalloc/internal/ph.h b/memory/jemalloc/src/include/jemalloc/internal/ph.h
deleted file mode 100644
index 4f91c333fd..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/ph.h
+++ /dev/null
@@ -1,345 +0,0 @@
-/*
- * A Pairing Heap implementation.
- *
- * "The Pairing Heap: A New Form of Self-Adjusting Heap"
- * https://www.cs.cmu.edu/~sleator/papers/pairing-heaps.pdf
- *
- * With auxiliary twopass list, described in a follow on paper.
- *
- * "Pairing Heaps: Experiments and Analysis"
- * http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.106.2988&rep=rep1&type=pdf
- *
- *******************************************************************************
- */
-
-#ifndef PH_H_
-#define PH_H_
-
-/* Node structure. */
-#define phn(a_type) \
-struct { \
- a_type *phn_prev; \
- a_type *phn_next; \
- a_type *phn_lchild; \
-}
-
-/* Root structure. */
-#define ph(a_type) \
-struct { \
- a_type *ph_root; \
-}
-
-/* Internal utility macros. */
-#define phn_lchild_get(a_type, a_field, a_phn) \
- (a_phn->a_field.phn_lchild)
-#define phn_lchild_set(a_type, a_field, a_phn, a_lchild) do { \
- a_phn->a_field.phn_lchild = a_lchild; \
-} while (0)
-
-#define phn_next_get(a_type, a_field, a_phn) \
- (a_phn->a_field.phn_next)
-#define phn_prev_set(a_type, a_field, a_phn, a_prev) do { \
- a_phn->a_field.phn_prev = a_prev; \
-} while (0)
-
-#define phn_prev_get(a_type, a_field, a_phn) \
- (a_phn->a_field.phn_prev)
-#define phn_next_set(a_type, a_field, a_phn, a_next) do { \
- a_phn->a_field.phn_next = a_next; \
-} while (0)
-
-#define phn_merge_ordered(a_type, a_field, a_phn0, a_phn1, a_cmp) do { \
- a_type *phn0child; \
- \
- assert(a_phn0 != NULL); \
- assert(a_phn1 != NULL); \
- assert(a_cmp(a_phn0, a_phn1) <= 0); \
- \
- phn_prev_set(a_type, a_field, a_phn1, a_phn0); \
- phn0child = phn_lchild_get(a_type, a_field, a_phn0); \
- phn_next_set(a_type, a_field, a_phn1, phn0child); \
- if (phn0child != NULL) \
- phn_prev_set(a_type, a_field, phn0child, a_phn1); \
- phn_lchild_set(a_type, a_field, a_phn0, a_phn1); \
-} while (0)
-
-#define phn_merge(a_type, a_field, a_phn0, a_phn1, a_cmp, r_phn) do { \
- if (a_phn0 == NULL) \
- r_phn = a_phn1; \
- else if (a_phn1 == NULL) \
- r_phn = a_phn0; \
- else if (a_cmp(a_phn0, a_phn1) < 0) { \
- phn_merge_ordered(a_type, a_field, a_phn0, a_phn1, \
- a_cmp); \
- r_phn = a_phn0; \
- } else { \
- phn_merge_ordered(a_type, a_field, a_phn1, a_phn0, \
- a_cmp); \
- r_phn = a_phn1; \
- } \
-} while (0)
-
-#define ph_merge_siblings(a_type, a_field, a_phn, a_cmp, r_phn) do { \
- a_type *head = NULL; \
- a_type *tail = NULL; \
- a_type *phn0 = a_phn; \
- a_type *phn1 = phn_next_get(a_type, a_field, phn0); \
- \
- /* \
- * Multipass merge, wherein the first two elements of a FIFO \
- * are repeatedly merged, and each result is appended to the \
- * singly linked FIFO, until the FIFO contains only a single \
- * element. We start with a sibling list but no reference to \
- * its tail, so we do a single pass over the sibling list to \
- * populate the FIFO. \
- */ \
- if (phn1 != NULL) { \
- a_type *phnrest = phn_next_get(a_type, a_field, phn1); \
- if (phnrest != NULL) \
- phn_prev_set(a_type, a_field, phnrest, NULL); \
- phn_prev_set(a_type, a_field, phn0, NULL); \
- phn_next_set(a_type, a_field, phn0, NULL); \
- phn_prev_set(a_type, a_field, phn1, NULL); \
- phn_next_set(a_type, a_field, phn1, NULL); \
- phn_merge(a_type, a_field, phn0, phn1, a_cmp, phn0); \
- head = tail = phn0; \
- phn0 = phnrest; \
- while (phn0 != NULL) { \
- phn1 = phn_next_get(a_type, a_field, phn0); \
- if (phn1 != NULL) { \
- phnrest = phn_next_get(a_type, a_field, \
- phn1); \
- if (phnrest != NULL) { \
- phn_prev_set(a_type, a_field, \
- phnrest, NULL); \
- } \
- phn_prev_set(a_type, a_field, phn0, \
- NULL); \
- phn_next_set(a_type, a_field, phn0, \
- NULL); \
- phn_prev_set(a_type, a_field, phn1, \
- NULL); \
- phn_next_set(a_type, a_field, phn1, \
- NULL); \
- phn_merge(a_type, a_field, phn0, phn1, \
- a_cmp, phn0); \
- phn_next_set(a_type, a_field, tail, \
- phn0); \
- tail = phn0; \
- phn0 = phnrest; \
- } else { \
- phn_next_set(a_type, a_field, tail, \
- phn0); \
- tail = phn0; \
- phn0 = NULL; \
- } \
- } \
- phn0 = head; \
- phn1 = phn_next_get(a_type, a_field, phn0); \
- if (phn1 != NULL) { \
- while (true) { \
- head = phn_next_get(a_type, a_field, \
- phn1); \
- assert(phn_prev_get(a_type, a_field, \
- phn0) == NULL); \
- phn_next_set(a_type, a_field, phn0, \
- NULL); \
- assert(phn_prev_get(a_type, a_field, \
- phn1) == NULL); \
- phn_next_set(a_type, a_field, phn1, \
- NULL); \
- phn_merge(a_type, a_field, phn0, phn1, \
- a_cmp, phn0); \
- if (head == NULL) \
- break; \
- phn_next_set(a_type, a_field, tail, \
- phn0); \
- tail = phn0; \
- phn0 = head; \
- phn1 = phn_next_get(a_type, a_field, \
- phn0); \
- } \
- } \
- } \
- r_phn = phn0; \
-} while (0)
-
-#define ph_merge_aux(a_type, a_field, a_ph, a_cmp) do { \
- a_type *phn = phn_next_get(a_type, a_field, a_ph->ph_root); \
- if (phn != NULL) { \
- phn_prev_set(a_type, a_field, a_ph->ph_root, NULL); \
- phn_next_set(a_type, a_field, a_ph->ph_root, NULL); \
- phn_prev_set(a_type, a_field, phn, NULL); \
- ph_merge_siblings(a_type, a_field, phn, a_cmp, phn); \
- assert(phn_next_get(a_type, a_field, phn) == NULL); \
- phn_merge(a_type, a_field, a_ph->ph_root, phn, a_cmp, \
- a_ph->ph_root); \
- } \
-} while (0)
-
-#define ph_merge_children(a_type, a_field, a_phn, a_cmp, r_phn) do { \
- a_type *lchild = phn_lchild_get(a_type, a_field, a_phn); \
- if (lchild == NULL) \
- r_phn = NULL; \
- else { \
- ph_merge_siblings(a_type, a_field, lchild, a_cmp, \
- r_phn); \
- } \
-} while (0)
-
-/*
- * The ph_proto() macro generates function prototypes that correspond to the
- * functions generated by an equivalently parameterized call to ph_gen().
- */
-#define ph_proto(a_attr, a_prefix, a_ph_type, a_type) \
-a_attr void a_prefix##new(a_ph_type *ph); \
-a_attr bool a_prefix##empty(a_ph_type *ph); \
-a_attr a_type *a_prefix##first(a_ph_type *ph); \
-a_attr void a_prefix##insert(a_ph_type *ph, a_type *phn); \
-a_attr a_type *a_prefix##remove_first(a_ph_type *ph); \
-a_attr void a_prefix##remove(a_ph_type *ph, a_type *phn);
-
-/*
- * The ph_gen() macro generates a type-specific pairing heap implementation,
- * based on the above cpp macros.
- */
-#define ph_gen(a_attr, a_prefix, a_ph_type, a_type, a_field, a_cmp) \
-a_attr void \
-a_prefix##new(a_ph_type *ph) \
-{ \
- \
- memset(ph, 0, sizeof(ph(a_type))); \
-} \
-a_attr bool \
-a_prefix##empty(a_ph_type *ph) \
-{ \
- \
- return (ph->ph_root == NULL); \
-} \
-a_attr a_type * \
-a_prefix##first(a_ph_type *ph) \
-{ \
- \
- if (ph->ph_root == NULL) \
- return (NULL); \
- ph_merge_aux(a_type, a_field, ph, a_cmp); \
- return (ph->ph_root); \
-} \
-a_attr void \
-a_prefix##insert(a_ph_type *ph, a_type *phn) \
-{ \
- \
- memset(&phn->a_field, 0, sizeof(phn(a_type))); \
- \
- /* \
- * Treat the root as an aux list during insertion, and lazily \
- * merge during a_prefix##remove_first(). For elements that \
- * are inserted, then removed via a_prefix##remove() before the \
- * aux list is ever processed, this makes insert/remove \
- * constant-time, whereas eager merging would make insert \
- * O(log n). \
- */ \
- if (ph->ph_root == NULL) \
- ph->ph_root = phn; \
- else { \
- phn_next_set(a_type, a_field, phn, phn_next_get(a_type, \
- a_field, ph->ph_root)); \
- if (phn_next_get(a_type, a_field, ph->ph_root) != \
- NULL) { \
- phn_prev_set(a_type, a_field, \
- phn_next_get(a_type, a_field, ph->ph_root), \
- phn); \
- } \
- phn_prev_set(a_type, a_field, phn, ph->ph_root); \
- phn_next_set(a_type, a_field, ph->ph_root, phn); \
- } \
-} \
-a_attr a_type * \
-a_prefix##remove_first(a_ph_type *ph) \
-{ \
- a_type *ret; \
- \
- if (ph->ph_root == NULL) \
- return (NULL); \
- ph_merge_aux(a_type, a_field, ph, a_cmp); \
- \
- ret = ph->ph_root; \
- \
- ph_merge_children(a_type, a_field, ph->ph_root, a_cmp, \
- ph->ph_root); \
- \
- return (ret); \
-} \
-a_attr void \
-a_prefix##remove(a_ph_type *ph, a_type *phn) \
-{ \
- a_type *replace, *parent; \
- \
- /* \
- * We can delete from aux list without merging it, but we need \
- * to merge if we are dealing with the root node. \
- */ \
- if (ph->ph_root == phn) { \
- ph_merge_aux(a_type, a_field, ph, a_cmp); \
- if (ph->ph_root == phn) { \
- ph_merge_children(a_type, a_field, ph->ph_root, \
- a_cmp, ph->ph_root); \
- return; \
- } \
- } \
- \
- /* Get parent (if phn is leftmost child) before mutating. */ \
- if ((parent = phn_prev_get(a_type, a_field, phn)) != NULL) { \
- if (phn_lchild_get(a_type, a_field, parent) != phn) \
- parent = NULL; \
- } \
- /* Find a possible replacement node, and link to parent. */ \
- ph_merge_children(a_type, a_field, phn, a_cmp, replace); \
- /* Set next/prev for sibling linked list. */ \
- if (replace != NULL) { \
- if (parent != NULL) { \
- phn_prev_set(a_type, a_field, replace, parent); \
- phn_lchild_set(a_type, a_field, parent, \
- replace); \
- } else { \
- phn_prev_set(a_type, a_field, replace, \
- phn_prev_get(a_type, a_field, phn)); \
- if (phn_prev_get(a_type, a_field, phn) != \
- NULL) { \
- phn_next_set(a_type, a_field, \
- phn_prev_get(a_type, a_field, phn), \
- replace); \
- } \
- } \
- phn_next_set(a_type, a_field, replace, \
- phn_next_get(a_type, a_field, phn)); \
- if (phn_next_get(a_type, a_field, phn) != NULL) { \
- phn_prev_set(a_type, a_field, \
- phn_next_get(a_type, a_field, phn), \
- replace); \
- } \
- } else { \
- if (parent != NULL) { \
- a_type *next = phn_next_get(a_type, a_field, \
- phn); \
- phn_lchild_set(a_type, a_field, parent, next); \
- if (next != NULL) { \
- phn_prev_set(a_type, a_field, next, \
- parent); \
- } \
- } else { \
- assert(phn_prev_get(a_type, a_field, phn) != \
- NULL); \
- phn_next_set(a_type, a_field, \
- phn_prev_get(a_type, a_field, phn), \
- phn_next_get(a_type, a_field, phn)); \
- } \
- if (phn_next_get(a_type, a_field, phn) != NULL) { \
- phn_prev_set(a_type, a_field, \
- phn_next_get(a_type, a_field, phn), \
- phn_prev_get(a_type, a_field, phn)); \
- } \
- } \
-}
-
-#endif /* PH_H_ */
diff --git a/memory/jemalloc/src/include/jemalloc/internal/private_namespace.sh b/memory/jemalloc/src/include/jemalloc/internal/private_namespace.sh
deleted file mode 100755
index cd25eb3061..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/private_namespace.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-for symbol in `cat $1` ; do
- echo "#define ${symbol} JEMALLOC_N(${symbol})"
-done
diff --git a/memory/jemalloc/src/include/jemalloc/internal/private_symbols.txt b/memory/jemalloc/src/include/jemalloc/internal/private_symbols.txt
deleted file mode 100644
index 87c8c9b710..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/private_symbols.txt
+++ /dev/null
@@ -1,626 +0,0 @@
-a0dalloc
-a0get
-a0malloc
-arena_aalloc
-arena_alloc_junk_small
-arena_basic_stats_merge
-arena_bin_index
-arena_bin_info
-arena_bitselm_get_const
-arena_bitselm_get_mutable
-arena_boot
-arena_choose
-arena_choose_hard
-arena_choose_impl
-arena_chunk_alloc_huge
-arena_chunk_cache_maybe_insert
-arena_chunk_cache_maybe_remove
-arena_chunk_dalloc_huge
-arena_chunk_ralloc_huge_expand
-arena_chunk_ralloc_huge_shrink
-arena_chunk_ralloc_huge_similar
-arena_cleanup
-arena_dalloc
-arena_dalloc_bin
-arena_dalloc_bin_junked_locked
-arena_dalloc_junk_large
-arena_dalloc_junk_small
-arena_dalloc_large
-arena_dalloc_large_junked_locked
-arena_dalloc_small
-arena_decay_tick
-arena_decay_ticks
-arena_decay_time_default_get
-arena_decay_time_default_set
-arena_decay_time_get
-arena_decay_time_set
-arena_dss_prec_get
-arena_dss_prec_set
-arena_get
-arena_ichoose
-arena_init
-arena_lg_dirty_mult_default_get
-arena_lg_dirty_mult_default_set
-arena_lg_dirty_mult_get
-arena_lg_dirty_mult_set
-arena_malloc
-arena_malloc_hard
-arena_malloc_large
-arena_mapbits_allocated_get
-arena_mapbits_binind_get
-arena_mapbits_decommitted_get
-arena_mapbits_dirty_get
-arena_mapbits_get
-arena_mapbits_internal_set
-arena_mapbits_large_binind_set
-arena_mapbits_large_get
-arena_mapbits_large_set
-arena_mapbits_large_size_get
-arena_mapbits_size_decode
-arena_mapbits_size_encode
-arena_mapbits_small_runind_get
-arena_mapbits_small_set
-arena_mapbits_unallocated_set
-arena_mapbits_unallocated_size_get
-arena_mapbits_unallocated_size_set
-arena_mapbits_unzeroed_get
-arena_mapbitsp_get_const
-arena_mapbitsp_get_mutable
-arena_mapbitsp_read
-arena_mapbitsp_write
-arena_maxrun
-arena_maybe_purge
-arena_metadata_allocated_add
-arena_metadata_allocated_get
-arena_metadata_allocated_sub
-arena_migrate
-arena_miscelm_get_const
-arena_miscelm_get_mutable
-arena_miscelm_to_pageind
-arena_miscelm_to_rpages
-arena_new
-arena_node_alloc
-arena_node_dalloc
-arena_nthreads_dec
-arena_nthreads_get
-arena_nthreads_inc
-arena_palloc
-arena_postfork_child
-arena_postfork_parent
-arena_prefork0
-arena_prefork1
-arena_prefork2
-arena_prefork3
-arena_prof_accum
-arena_prof_accum_impl
-arena_prof_accum_locked
-arena_prof_promoted
-arena_prof_tctx_get
-arena_prof_tctx_reset
-arena_prof_tctx_set
-arena_ptr_small_binind_get
-arena_purge
-arena_quarantine_junk_small
-arena_ralloc
-arena_ralloc_junk_large
-arena_ralloc_no_move
-arena_rd_to_miscelm
-arena_redzone_corruption
-arena_reset
-arena_run_regind
-arena_run_to_miscelm
-arena_salloc
-arena_sdalloc
-arena_stats_merge
-arena_tcache_fill_small
-arena_tdata_get
-arena_tdata_get_hard
-arenas
-arenas_tdata_bypass_cleanup
-arenas_tdata_cleanup
-atomic_add_p
-atomic_add_u
-atomic_add_uint32
-atomic_add_uint64
-atomic_add_z
-atomic_cas_p
-atomic_cas_u
-atomic_cas_uint32
-atomic_cas_uint64
-atomic_cas_z
-atomic_sub_p
-atomic_sub_u
-atomic_sub_uint32
-atomic_sub_uint64
-atomic_sub_z
-atomic_write_p
-atomic_write_u
-atomic_write_uint32
-atomic_write_uint64
-atomic_write_z
-base_alloc
-base_boot
-base_postfork_child
-base_postfork_parent
-base_prefork
-base_stats_get
-bitmap_full
-bitmap_get
-bitmap_info_init
-bitmap_init
-bitmap_set
-bitmap_sfu
-bitmap_size
-bitmap_unset
-bootstrap_calloc
-bootstrap_free
-bootstrap_malloc
-bt_init
-buferror
-chunk_alloc_base
-chunk_alloc_cache
-chunk_alloc_dss
-chunk_alloc_mmap
-chunk_alloc_wrapper
-chunk_boot
-chunk_dalloc_cache
-chunk_dalloc_mmap
-chunk_dalloc_wrapper
-chunk_deregister
-chunk_dss_boot
-chunk_dss_mergeable
-chunk_dss_prec_get
-chunk_dss_prec_set
-chunk_hooks_default
-chunk_hooks_get
-chunk_hooks_set
-chunk_in_dss
-chunk_lookup
-chunk_npages
-chunk_purge_wrapper
-chunk_register
-chunks_rtree
-chunksize
-chunksize_mask
-ckh_count
-ckh_delete
-ckh_insert
-ckh_iter
-ckh_new
-ckh_pointer_hash
-ckh_pointer_keycomp
-ckh_remove
-ckh_search
-ckh_string_hash
-ckh_string_keycomp
-ctl_boot
-ctl_bymib
-ctl_byname
-ctl_nametomib
-ctl_postfork_child
-ctl_postfork_parent
-ctl_prefork
-decay_ticker_get
-dss_prec_names
-extent_node_achunk_get
-extent_node_achunk_set
-extent_node_addr_get
-extent_node_addr_set
-extent_node_arena_get
-extent_node_arena_set
-extent_node_committed_get
-extent_node_committed_set
-extent_node_dirty_insert
-extent_node_dirty_linkage_init
-extent_node_dirty_remove
-extent_node_init
-extent_node_prof_tctx_get
-extent_node_prof_tctx_set
-extent_node_size_get
-extent_node_size_set
-extent_node_zeroed_get
-extent_node_zeroed_set
-extent_tree_ad_destroy
-extent_tree_ad_destroy_recurse
-extent_tree_ad_empty
-extent_tree_ad_first
-extent_tree_ad_insert
-extent_tree_ad_iter
-extent_tree_ad_iter_recurse
-extent_tree_ad_iter_start
-extent_tree_ad_last
-extent_tree_ad_new
-extent_tree_ad_next
-extent_tree_ad_nsearch
-extent_tree_ad_prev
-extent_tree_ad_psearch
-extent_tree_ad_remove
-extent_tree_ad_reverse_iter
-extent_tree_ad_reverse_iter_recurse
-extent_tree_ad_reverse_iter_start
-extent_tree_ad_search
-extent_tree_szad_destroy
-extent_tree_szad_destroy_recurse
-extent_tree_szad_empty
-extent_tree_szad_first
-extent_tree_szad_insert
-extent_tree_szad_iter
-extent_tree_szad_iter_recurse
-extent_tree_szad_iter_start
-extent_tree_szad_last
-extent_tree_szad_new
-extent_tree_szad_next
-extent_tree_szad_nsearch
-extent_tree_szad_prev
-extent_tree_szad_psearch
-extent_tree_szad_remove
-extent_tree_szad_reverse_iter
-extent_tree_szad_reverse_iter_recurse
-extent_tree_szad_reverse_iter_start
-extent_tree_szad_search
-ffs_llu
-ffs_lu
-ffs_u
-ffs_u32
-ffs_u64
-ffs_zu
-get_errno
-hash
-hash_fmix_32
-hash_fmix_64
-hash_get_block_32
-hash_get_block_64
-hash_rotl_32
-hash_rotl_64
-hash_x64_128
-hash_x86_128
-hash_x86_32
-huge_aalloc
-huge_dalloc
-huge_dalloc_junk
-huge_malloc
-huge_palloc
-huge_prof_tctx_get
-huge_prof_tctx_reset
-huge_prof_tctx_set
-huge_ralloc
-huge_ralloc_no_move
-huge_salloc
-iaalloc
-ialloc
-iallocztm
-iarena_cleanup
-idalloc
-idalloctm
-in_valgrind
-index2size
-index2size_compute
-index2size_lookup
-index2size_tab
-ipalloc
-ipalloct
-ipallocztm
-iqalloc
-iralloc
-iralloct
-iralloct_realign
-isalloc
-isdalloct
-isqalloc
-isthreaded
-ivsalloc
-ixalloc
-jemalloc_postfork_child
-jemalloc_postfork_parent
-jemalloc_prefork
-large_maxclass
-lg_floor
-lg_prof_sample
-malloc_cprintf
-malloc_mutex_assert_not_owner
-malloc_mutex_assert_owner
-malloc_mutex_boot
-malloc_mutex_init
-malloc_mutex_lock
-malloc_mutex_postfork_child
-malloc_mutex_postfork_parent
-malloc_mutex_prefork
-malloc_mutex_unlock
-malloc_printf
-malloc_snprintf
-malloc_strtoumax
-malloc_tsd_boot0
-malloc_tsd_boot1
-malloc_tsd_cleanup_register
-malloc_tsd_dalloc
-malloc_tsd_malloc
-malloc_tsd_no_cleanup
-malloc_vcprintf
-malloc_vsnprintf
-malloc_write
-map_bias
-map_misc_offset
-mb_write
-narenas_auto
-narenas_tdata_cleanup
-narenas_total_get
-ncpus
-nhbins
-nhclasses
-nlclasses
-nstime_add
-nstime_compare
-nstime_copy
-nstime_divide
-nstime_idivide
-nstime_imultiply
-nstime_init
-nstime_init2
-nstime_monotonic
-nstime_ns
-nstime_nsec
-nstime_sec
-nstime_subtract
-nstime_update
-opt_abort
-opt_decay_time
-opt_dss
-opt_junk
-opt_junk_alloc
-opt_junk_free
-opt_lg_chunk
-opt_lg_dirty_mult
-opt_lg_prof_interval
-opt_lg_prof_sample
-opt_lg_tcache_max
-opt_narenas
-opt_prof
-opt_prof_accum
-opt_prof_active
-opt_prof_final
-opt_prof_gdump
-opt_prof_leak
-opt_prof_prefix
-opt_prof_thread_active_init
-opt_purge
-opt_quarantine
-opt_redzone
-opt_stats_print
-opt_tcache
-opt_utrace
-opt_xmalloc
-opt_zero
-p2rz
-pages_boot
-pages_commit
-pages_decommit
-pages_map
-pages_purge
-pages_trim
-pages_unmap
-pind2sz
-pind2sz_compute
-pind2sz_lookup
-pind2sz_tab
-pow2_ceil_u32
-pow2_ceil_u64
-pow2_ceil_zu
-prng_lg_range_u32
-prng_lg_range_u64
-prng_lg_range_zu
-prng_range_u32
-prng_range_u64
-prng_range_zu
-prng_state_next_u32
-prng_state_next_u64
-prng_state_next_zu
-prof_active
-prof_active_get
-prof_active_get_unlocked
-prof_active_set
-prof_alloc_prep
-prof_alloc_rollback
-prof_backtrace
-prof_boot0
-prof_boot1
-prof_boot2
-prof_bt_count
-prof_dump_header
-prof_dump_open
-prof_free
-prof_free_sampled_object
-prof_gdump
-prof_gdump_get
-prof_gdump_get_unlocked
-prof_gdump_set
-prof_gdump_val
-prof_idump
-prof_interval
-prof_lookup
-prof_malloc
-prof_malloc_sample_object
-prof_mdump
-prof_postfork_child
-prof_postfork_parent
-prof_prefork0
-prof_prefork1
-prof_realloc
-prof_reset
-prof_sample_accum_update
-prof_sample_threshold_update
-prof_tctx_get
-prof_tctx_reset
-prof_tctx_set
-prof_tdata_cleanup
-prof_tdata_count
-prof_tdata_get
-prof_tdata_init
-prof_tdata_reinit
-prof_thread_active_get
-prof_thread_active_init_get
-prof_thread_active_init_set
-prof_thread_active_set
-prof_thread_name_get
-prof_thread_name_set
-psz2ind
-psz2u
-purge_mode_names
-quarantine
-quarantine_alloc_hook
-quarantine_alloc_hook_work
-quarantine_cleanup
-rtree_child_read
-rtree_child_read_hard
-rtree_child_tryread
-rtree_delete
-rtree_get
-rtree_new
-rtree_node_valid
-rtree_set
-rtree_start_level
-rtree_subkey
-rtree_subtree_read
-rtree_subtree_read_hard
-rtree_subtree_tryread
-rtree_val_read
-rtree_val_write
-run_quantize_ceil
-run_quantize_floor
-s2u
-s2u_compute
-s2u_lookup
-sa2u
-set_errno
-size2index
-size2index_compute
-size2index_lookup
-size2index_tab
-spin_adaptive
-spin_init
-stats_cactive
-stats_cactive_add
-stats_cactive_get
-stats_cactive_sub
-stats_print
-tcache_alloc_easy
-tcache_alloc_large
-tcache_alloc_small
-tcache_alloc_small_hard
-tcache_arena_reassociate
-tcache_bin_flush_large
-tcache_bin_flush_small
-tcache_bin_info
-tcache_boot
-tcache_cleanup
-tcache_create
-tcache_dalloc_large
-tcache_dalloc_small
-tcache_enabled_cleanup
-tcache_enabled_get
-tcache_enabled_set
-tcache_event
-tcache_event_hard
-tcache_flush
-tcache_get
-tcache_get_hard
-tcache_maxclass
-tcache_salloc
-tcache_stats_merge
-tcaches
-tcaches_create
-tcaches_destroy
-tcaches_flush
-tcaches_get
-thread_allocated_cleanup
-thread_deallocated_cleanup
-ticker_copy
-ticker_init
-ticker_read
-ticker_tick
-ticker_ticks
-tsd_arena_get
-tsd_arena_set
-tsd_arenap_get
-tsd_arenas_tdata_bypass_get
-tsd_arenas_tdata_bypass_set
-tsd_arenas_tdata_bypassp_get
-tsd_arenas_tdata_get
-tsd_arenas_tdata_set
-tsd_arenas_tdatap_get
-tsd_boot
-tsd_boot0
-tsd_boot1
-tsd_booted
-tsd_booted_get
-tsd_cleanup
-tsd_cleanup_wrapper
-tsd_fetch
-tsd_fetch_impl
-tsd_get
-tsd_get_allocates
-tsd_iarena_get
-tsd_iarena_set
-tsd_iarenap_get
-tsd_initialized
-tsd_init_check_recursion
-tsd_init_finish
-tsd_init_head
-tsd_narenas_tdata_get
-tsd_narenas_tdata_set
-tsd_narenas_tdatap_get
-tsd_wrapper_get
-tsd_wrapper_set
-tsd_nominal
-tsd_prof_tdata_get
-tsd_prof_tdata_set
-tsd_prof_tdatap_get
-tsd_quarantine_get
-tsd_quarantine_set
-tsd_quarantinep_get
-tsd_set
-tsd_tcache_enabled_get
-tsd_tcache_enabled_set
-tsd_tcache_enabledp_get
-tsd_tcache_get
-tsd_tcache_set
-tsd_tcachep_get
-tsd_thread_allocated_get
-tsd_thread_allocated_set
-tsd_thread_allocatedp_get
-tsd_thread_deallocated_get
-tsd_thread_deallocated_set
-tsd_thread_deallocatedp_get
-tsd_tls
-tsd_tsd
-tsd_tsdn
-tsd_witness_fork_get
-tsd_witness_fork_set
-tsd_witness_forkp_get
-tsd_witnesses_get
-tsd_witnesses_set
-tsd_witnessesp_get
-tsdn_fetch
-tsdn_null
-tsdn_tsd
-u2rz
-valgrind_freelike_block
-valgrind_make_mem_defined
-valgrind_make_mem_noaccess
-valgrind_make_mem_undefined
-witness_assert_lockless
-witness_assert_not_owner
-witness_assert_owner
-witness_fork_cleanup
-witness_init
-witness_lock
-witness_lock_error
-witness_lockless_error
-witness_not_owner_error
-witness_owner
-witness_owner_error
-witness_postfork_child
-witness_postfork_parent
-witness_prefork
-witness_unlock
-witnesses_cleanup
-zone_register
diff --git a/memory/jemalloc/src/include/jemalloc/internal/private_unnamespace.sh b/memory/jemalloc/src/include/jemalloc/internal/private_unnamespace.sh
deleted file mode 100755
index 23fed8e803..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/private_unnamespace.sh
+++ /dev/null
@@ -1,5 +0,0 @@
-#!/bin/sh
-
-for symbol in `cat $1` ; do
- echo "#undef ${symbol}"
-done
diff --git a/memory/jemalloc/src/include/jemalloc/internal/prng.h b/memory/jemalloc/src/include/jemalloc/internal/prng.h
deleted file mode 100644
index c2bda19c6b..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/prng.h
+++ /dev/null
@@ -1,207 +0,0 @@
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-/*
- * Simple linear congruential pseudo-random number generator:
- *
- * prng(y) = (a*x + c) % m
- *
- * where the following constants ensure maximal period:
- *
- * a == Odd number (relatively prime to 2^n), and (a-1) is a multiple of 4.
- * c == Odd number (relatively prime to 2^n).
- * m == 2^32
- *
- * See Knuth's TAOCP 3rd Ed., Vol. 2, pg. 17 for details on these constraints.
- *
- * This choice of m has the disadvantage that the quality of the bits is
- * proportional to bit position. For example, the lowest bit has a cycle of 2,
- * the next has a cycle of 4, etc. For this reason, we prefer to use the upper
- * bits.
- */
-
-#define PRNG_A_32 UINT32_C(1103515241)
-#define PRNG_C_32 UINT32_C(12347)
-
-#define PRNG_A_64 UINT64_C(6364136223846793005)
-#define PRNG_C_64 UINT64_C(1442695040888963407)
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-#ifndef JEMALLOC_ENABLE_INLINE
-uint32_t prng_state_next_u32(uint32_t state);
-uint64_t prng_state_next_u64(uint64_t state);
-size_t prng_state_next_zu(size_t state);
-
-uint32_t prng_lg_range_u32(uint32_t *state, unsigned lg_range,
- bool atomic);
-uint64_t prng_lg_range_u64(uint64_t *state, unsigned lg_range);
-size_t prng_lg_range_zu(size_t *state, unsigned lg_range, bool atomic);
-
-uint32_t prng_range_u32(uint32_t *state, uint32_t range, bool atomic);
-uint64_t prng_range_u64(uint64_t *state, uint64_t range);
-size_t prng_range_zu(size_t *state, size_t range, bool atomic);
-#endif
-
-#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_PRNG_C_))
-JEMALLOC_ALWAYS_INLINE uint32_t
-prng_state_next_u32(uint32_t state)
-{
-
- return ((state * PRNG_A_32) + PRNG_C_32);
-}
-
-JEMALLOC_ALWAYS_INLINE uint64_t
-prng_state_next_u64(uint64_t state)
-{
-
- return ((state * PRNG_A_64) + PRNG_C_64);
-}
-
-JEMALLOC_ALWAYS_INLINE size_t
-prng_state_next_zu(size_t state)
-{
-
-#if LG_SIZEOF_PTR == 2
- return ((state * PRNG_A_32) + PRNG_C_32);
-#elif LG_SIZEOF_PTR == 3
- return ((state * PRNG_A_64) + PRNG_C_64);
-#else
-#error Unsupported pointer size
-#endif
-}
-
-JEMALLOC_ALWAYS_INLINE uint32_t
-prng_lg_range_u32(uint32_t *state, unsigned lg_range, bool atomic)
-{
- uint32_t ret, state1;
-
- assert(lg_range > 0);
- assert(lg_range <= 32);
-
- if (atomic) {
- uint32_t state0;
-
- do {
- state0 = atomic_read_uint32(state);
- state1 = prng_state_next_u32(state0);
- } while (atomic_cas_uint32(state, state0, state1));
- } else {
- state1 = prng_state_next_u32(*state);
- *state = state1;
- }
- ret = state1 >> (32 - lg_range);
-
- return (ret);
-}
-
-/* 64-bit atomic operations cannot be supported on all relevant platforms. */
-JEMALLOC_ALWAYS_INLINE uint64_t
-prng_lg_range_u64(uint64_t *state, unsigned lg_range)
-{
- uint64_t ret, state1;
-
- assert(lg_range > 0);
- assert(lg_range <= 64);
-
- state1 = prng_state_next_u64(*state);
- *state = state1;
- ret = state1 >> (64 - lg_range);
-
- return (ret);
-}
-
-JEMALLOC_ALWAYS_INLINE size_t
-prng_lg_range_zu(size_t *state, unsigned lg_range, bool atomic)
-{
- size_t ret, state1;
-
- assert(lg_range > 0);
- assert(lg_range <= ZU(1) << (3 + LG_SIZEOF_PTR));
-
- if (atomic) {
- size_t state0;
-
- do {
- state0 = atomic_read_z(state);
- state1 = prng_state_next_zu(state0);
- } while (atomic_cas_z(state, state0, state1));
- } else {
- state1 = prng_state_next_zu(*state);
- *state = state1;
- }
- ret = state1 >> ((ZU(1) << (3 + LG_SIZEOF_PTR)) - lg_range);
-
- return (ret);
-}
-
-JEMALLOC_ALWAYS_INLINE uint32_t
-prng_range_u32(uint32_t *state, uint32_t range, bool atomic)
-{
- uint32_t ret;
- unsigned lg_range;
-
- assert(range > 1);
-
- /* Compute the ceiling of lg(range). */
- lg_range = ffs_u32(pow2_ceil_u32(range)) - 1;
-
- /* Generate a result in [0..range) via repeated trial. */
- do {
- ret = prng_lg_range_u32(state, lg_range, atomic);
- } while (ret >= range);
-
- return (ret);
-}
-
-JEMALLOC_ALWAYS_INLINE uint64_t
-prng_range_u64(uint64_t *state, uint64_t range)
-{
- uint64_t ret;
- unsigned lg_range;
-
- assert(range > 1);
-
- /* Compute the ceiling of lg(range). */
- lg_range = ffs_u64(pow2_ceil_u64(range)) - 1;
-
- /* Generate a result in [0..range) via repeated trial. */
- do {
- ret = prng_lg_range_u64(state, lg_range);
- } while (ret >= range);
-
- return (ret);
-}
-
-JEMALLOC_ALWAYS_INLINE size_t
-prng_range_zu(size_t *state, size_t range, bool atomic)
-{
- size_t ret;
- unsigned lg_range;
-
- assert(range > 1);
-
- /* Compute the ceiling of lg(range). */
- lg_range = ffs_u64(pow2_ceil_u64(range)) - 1;
-
- /* Generate a result in [0..range) via repeated trial. */
- do {
- ret = prng_lg_range_zu(state, lg_range, atomic);
- } while (ret >= range);
-
- return (ret);
-}
-#endif
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
diff --git a/memory/jemalloc/src/include/jemalloc/internal/prof.h b/memory/jemalloc/src/include/jemalloc/internal/prof.h
deleted file mode 100644
index 8293b71edc..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/prof.h
+++ /dev/null
@@ -1,547 +0,0 @@
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-typedef struct prof_bt_s prof_bt_t;
-typedef struct prof_cnt_s prof_cnt_t;
-typedef struct prof_tctx_s prof_tctx_t;
-typedef struct prof_gctx_s prof_gctx_t;
-typedef struct prof_tdata_s prof_tdata_t;
-
-/* Option defaults. */
-#ifdef JEMALLOC_PROF
-# define PROF_PREFIX_DEFAULT "jeprof"
-#else
-# define PROF_PREFIX_DEFAULT ""
-#endif
-#define LG_PROF_SAMPLE_DEFAULT 19
-#define LG_PROF_INTERVAL_DEFAULT -1
-
-/*
- * Hard limit on stack backtrace depth. The version of prof_backtrace() that
- * is based on __builtin_return_address() necessarily has a hard-coded number
- * of backtrace frame handlers, and should be kept in sync with this setting.
- */
-#define PROF_BT_MAX 128
-
-/* Initial hash table size. */
-#define PROF_CKH_MINITEMS 64
-
-/* Size of memory buffer to use when writing dump files. */
-#define PROF_DUMP_BUFSIZE 65536
-
-/* Size of stack-allocated buffer used by prof_printf(). */
-#define PROF_PRINTF_BUFSIZE 128
-
-/*
- * Number of mutexes shared among all gctx's. No space is allocated for these
- * unless profiling is enabled, so it's okay to over-provision.
- */
-#define PROF_NCTX_LOCKS 1024
-
-/*
- * Number of mutexes shared among all tdata's. No space is allocated for these
- * unless profiling is enabled, so it's okay to over-provision.
- */
-#define PROF_NTDATA_LOCKS 256
-
-/*
- * prof_tdata pointers close to NULL are used to encode state information that
- * is used for cleaning up during thread shutdown.
- */
-#define PROF_TDATA_STATE_REINCARNATED ((prof_tdata_t *)(uintptr_t)1)
-#define PROF_TDATA_STATE_PURGATORY ((prof_tdata_t *)(uintptr_t)2)
-#define PROF_TDATA_STATE_MAX PROF_TDATA_STATE_PURGATORY
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-struct prof_bt_s {
- /* Backtrace, stored as len program counters. */
- void **vec;
- unsigned len;
-};
-
-#ifdef JEMALLOC_PROF_LIBGCC
-/* Data structure passed to libgcc _Unwind_Backtrace() callback functions. */
-typedef struct {
- prof_bt_t *bt;
- unsigned max;
-} prof_unwind_data_t;
-#endif
-
-struct prof_cnt_s {
- /* Profiling counters. */
- uint64_t curobjs;
- uint64_t curbytes;
- uint64_t accumobjs;
- uint64_t accumbytes;
-};
-
-typedef enum {
- prof_tctx_state_initializing,
- prof_tctx_state_nominal,
- prof_tctx_state_dumping,
- prof_tctx_state_purgatory /* Dumper must finish destroying. */
-} prof_tctx_state_t;
-
-struct prof_tctx_s {
- /* Thread data for thread that performed the allocation. */
- prof_tdata_t *tdata;
-
- /*
- * Copy of tdata->thr_{uid,discrim}, necessary because tdata may be
- * defunct during teardown.
- */
- uint64_t thr_uid;
- uint64_t thr_discrim;
-
- /* Profiling counters, protected by tdata->lock. */
- prof_cnt_t cnts;
-
- /* Associated global context. */
- prof_gctx_t *gctx;
-
- /*
- * UID that distinguishes multiple tctx's created by the same thread,
- * but coexisting in gctx->tctxs. There are two ways that such
- * coexistence can occur:
- * - A dumper thread can cause a tctx to be retained in the purgatory
- * state.
- * - Although a single "producer" thread must create all tctx's which
- * share the same thr_uid, multiple "consumers" can each concurrently
- * execute portions of prof_tctx_destroy(). prof_tctx_destroy() only
- * gets called once each time cnts.cur{objs,bytes} drop to 0, but this
- * threshold can be hit again before the first consumer finishes
- * executing prof_tctx_destroy().
- */
- uint64_t tctx_uid;
-
- /* Linkage into gctx's tctxs. */
- rb_node(prof_tctx_t) tctx_link;
-
- /*
- * True during prof_alloc_prep()..prof_malloc_sample_object(), prevents
- * sample vs destroy race.
- */
- bool prepared;
-
- /* Current dump-related state, protected by gctx->lock. */
- prof_tctx_state_t state;
-
- /*
- * Copy of cnts snapshotted during early dump phase, protected by
- * dump_mtx.
- */
- prof_cnt_t dump_cnts;
-};
-typedef rb_tree(prof_tctx_t) prof_tctx_tree_t;
-
-struct prof_gctx_s {
- /* Protects nlimbo, cnt_summed, and tctxs. */
- malloc_mutex_t *lock;
-
- /*
- * Number of threads that currently cause this gctx to be in a state of
- * limbo due to one of:
- * - Initializing this gctx.
- * - Initializing per thread counters associated with this gctx.
- * - Preparing to destroy this gctx.
- * - Dumping a heap profile that includes this gctx.
- * nlimbo must be 1 (single destroyer) in order to safely destroy the
- * gctx.
- */
- unsigned nlimbo;
-
- /*
- * Tree of profile counters, one for each thread that has allocated in
- * this context.
- */
- prof_tctx_tree_t tctxs;
-
- /* Linkage for tree of contexts to be dumped. */
- rb_node(prof_gctx_t) dump_link;
-
- /* Temporary storage for summation during dump. */
- prof_cnt_t cnt_summed;
-
- /* Associated backtrace. */
- prof_bt_t bt;
-
- /* Backtrace vector, variable size, referred to by bt. */
- void *vec[1];
-};
-typedef rb_tree(prof_gctx_t) prof_gctx_tree_t;
-
-struct prof_tdata_s {
- malloc_mutex_t *lock;
-
- /* Monotonically increasing unique thread identifier. */
- uint64_t thr_uid;
-
- /*
- * Monotonically increasing discriminator among tdata structures
- * associated with the same thr_uid.
- */
- uint64_t thr_discrim;
-
- /* Included in heap profile dumps if non-NULL. */
- char *thread_name;
-
- bool attached;
- bool expired;
-
- rb_node(prof_tdata_t) tdata_link;
-
- /*
- * Counter used to initialize prof_tctx_t's tctx_uid. No locking is
- * necessary when incrementing this field, because only one thread ever
- * does so.
- */
- uint64_t tctx_uid_next;
-
- /*
- * Hash of (prof_bt_t *)-->(prof_tctx_t *). Each thread tracks
- * backtraces for which it has non-zero allocation/deallocation counters
- * associated with thread-specific prof_tctx_t objects. Other threads
- * may write to prof_tctx_t contents when freeing associated objects.
- */
- ckh_t bt2tctx;
-
- /* Sampling state. */
- uint64_t prng_state;
- uint64_t bytes_until_sample;
-
- /* State used to avoid dumping while operating on prof internals. */
- bool enq;
- bool enq_idump;
- bool enq_gdump;
-
- /*
- * Set to true during an early dump phase for tdata's which are
- * currently being dumped. New threads' tdata's have this initialized
- * to false so that they aren't accidentally included in later dump
- * phases.
- */
- bool dumping;
-
- /*
- * True if profiling is active for this tdata's thread
- * (thread.prof.active mallctl).
- */
- bool active;
-
- /* Temporary storage for summation during dump. */
- prof_cnt_t cnt_summed;
-
- /* Backtrace vector, used for calls to prof_backtrace(). */
- void *vec[PROF_BT_MAX];
-};
-typedef rb_tree(prof_tdata_t) prof_tdata_tree_t;
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-extern bool opt_prof;
-extern bool opt_prof_active;
-extern bool opt_prof_thread_active_init;
-extern size_t opt_lg_prof_sample; /* Mean bytes between samples. */
-extern ssize_t opt_lg_prof_interval; /* lg(prof_interval). */
-extern bool opt_prof_gdump; /* High-water memory dumping. */
-extern bool opt_prof_final; /* Final profile dumping. */
-extern bool opt_prof_leak; /* Dump leak summary at exit. */
-extern bool opt_prof_accum; /* Report cumulative bytes. */
-extern char opt_prof_prefix[
- /* Minimize memory bloat for non-prof builds. */
-#ifdef JEMALLOC_PROF
- PATH_MAX +
-#endif
- 1];
-
-/* Accessed via prof_active_[gs]et{_unlocked,}(). */
-extern bool prof_active;
-
-/* Accessed via prof_gdump_[gs]et{_unlocked,}(). */
-extern bool prof_gdump_val;
-
-/*
- * Profile dump interval, measured in bytes allocated. Each arena triggers a
- * profile dump when it reaches this threshold. The effect is that the
- * interval between profile dumps averages prof_interval, though the actual
- * interval between dumps will tend to be sporadic, and the interval will be a
- * maximum of approximately (prof_interval * narenas).
- */
-extern uint64_t prof_interval;
-
-/*
- * Initialized as opt_lg_prof_sample, and potentially modified during profiling
- * resets.
- */
-extern size_t lg_prof_sample;
-
-void prof_alloc_rollback(tsd_t *tsd, prof_tctx_t *tctx, bool updated);
-void prof_malloc_sample_object(tsdn_t *tsdn, const void *ptr, size_t usize,
- prof_tctx_t *tctx);
-void prof_free_sampled_object(tsd_t *tsd, size_t usize, prof_tctx_t *tctx);
-void bt_init(prof_bt_t *bt, void **vec);
-void prof_backtrace(prof_bt_t *bt);
-prof_tctx_t *prof_lookup(tsd_t *tsd, prof_bt_t *bt);
-#ifdef JEMALLOC_JET
-size_t prof_tdata_count(void);
-size_t prof_bt_count(void);
-const prof_cnt_t *prof_cnt_all(void);
-typedef int (prof_dump_open_t)(bool, const char *);
-extern prof_dump_open_t *prof_dump_open;
-typedef bool (prof_dump_header_t)(tsdn_t *, bool, const prof_cnt_t *);
-extern prof_dump_header_t *prof_dump_header;
-#endif
-void prof_idump(tsdn_t *tsdn);
-bool prof_mdump(tsd_t *tsd, const char *filename);
-void prof_gdump(tsdn_t *tsdn);
-prof_tdata_t *prof_tdata_init(tsd_t *tsd);
-prof_tdata_t *prof_tdata_reinit(tsd_t *tsd, prof_tdata_t *tdata);
-void prof_reset(tsd_t *tsd, size_t lg_sample);
-void prof_tdata_cleanup(tsd_t *tsd);
-bool prof_active_get(tsdn_t *tsdn);
-bool prof_active_set(tsdn_t *tsdn, bool active);
-const char *prof_thread_name_get(tsd_t *tsd);
-int prof_thread_name_set(tsd_t *tsd, const char *thread_name);
-bool prof_thread_active_get(tsd_t *tsd);
-bool prof_thread_active_set(tsd_t *tsd, bool active);
-bool prof_thread_active_init_get(tsdn_t *tsdn);
-bool prof_thread_active_init_set(tsdn_t *tsdn, bool active_init);
-bool prof_gdump_get(tsdn_t *tsdn);
-bool prof_gdump_set(tsdn_t *tsdn, bool active);
-void prof_boot0(void);
-void prof_boot1(void);
-bool prof_boot2(tsd_t *tsd);
-void prof_prefork0(tsdn_t *tsdn);
-void prof_prefork1(tsdn_t *tsdn);
-void prof_postfork_parent(tsdn_t *tsdn);
-void prof_postfork_child(tsdn_t *tsdn);
-void prof_sample_threshold_update(prof_tdata_t *tdata);
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-#ifndef JEMALLOC_ENABLE_INLINE
-bool prof_active_get_unlocked(void);
-bool prof_gdump_get_unlocked(void);
-prof_tdata_t *prof_tdata_get(tsd_t *tsd, bool create);
-prof_tctx_t *prof_tctx_get(tsdn_t *tsdn, const void *ptr);
-void prof_tctx_set(tsdn_t *tsdn, const void *ptr, size_t usize,
- prof_tctx_t *tctx);
-void prof_tctx_reset(tsdn_t *tsdn, const void *ptr, size_t usize,
- const void *old_ptr, prof_tctx_t *tctx);
-bool prof_sample_accum_update(tsd_t *tsd, size_t usize, bool commit,
- prof_tdata_t **tdata_out);
-prof_tctx_t *prof_alloc_prep(tsd_t *tsd, size_t usize, bool prof_active,
- bool update);
-void prof_malloc(tsdn_t *tsdn, const void *ptr, size_t usize,
- prof_tctx_t *tctx);
-void prof_realloc(tsd_t *tsd, const void *ptr, size_t usize,
- prof_tctx_t *tctx, bool prof_active, bool updated, const void *old_ptr,
- size_t old_usize, prof_tctx_t *old_tctx);
-void prof_free(tsd_t *tsd, const void *ptr, size_t usize);
-#endif
-
-#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_PROF_C_))
-JEMALLOC_ALWAYS_INLINE bool
-prof_active_get_unlocked(void)
-{
-
- /*
- * Even if opt_prof is true, sampling can be temporarily disabled by
- * setting prof_active to false. No locking is used when reading
- * prof_active in the fast path, so there are no guarantees regarding
- * how long it will take for all threads to notice state changes.
- */
- return (prof_active);
-}
-
-JEMALLOC_ALWAYS_INLINE bool
-prof_gdump_get_unlocked(void)
-{
-
- /*
- * No locking is used when reading prof_gdump_val in the fast path, so
- * there are no guarantees regarding how long it will take for all
- * threads to notice state changes.
- */
- return (prof_gdump_val);
-}
-
-JEMALLOC_ALWAYS_INLINE prof_tdata_t *
-prof_tdata_get(tsd_t *tsd, bool create)
-{
- prof_tdata_t *tdata;
-
- cassert(config_prof);
-
- tdata = tsd_prof_tdata_get(tsd);
- if (create) {
- if (unlikely(tdata == NULL)) {
- if (tsd_nominal(tsd)) {
- tdata = prof_tdata_init(tsd);
- tsd_prof_tdata_set(tsd, tdata);
- }
- } else if (unlikely(tdata->expired)) {
- tdata = prof_tdata_reinit(tsd, tdata);
- tsd_prof_tdata_set(tsd, tdata);
- }
- assert(tdata == NULL || tdata->attached);
- }
-
- return (tdata);
-}
-
-JEMALLOC_ALWAYS_INLINE prof_tctx_t *
-prof_tctx_get(tsdn_t *tsdn, const void *ptr)
-{
-
- cassert(config_prof);
- assert(ptr != NULL);
-
- return (arena_prof_tctx_get(tsdn, ptr));
-}
-
-JEMALLOC_ALWAYS_INLINE void
-prof_tctx_set(tsdn_t *tsdn, const void *ptr, size_t usize, prof_tctx_t *tctx)
-{
-
- cassert(config_prof);
- assert(ptr != NULL);
-
- arena_prof_tctx_set(tsdn, ptr, usize, tctx);
-}
-
-JEMALLOC_ALWAYS_INLINE void
-prof_tctx_reset(tsdn_t *tsdn, const void *ptr, size_t usize, const void *old_ptr,
- prof_tctx_t *old_tctx)
-{
-
- cassert(config_prof);
- assert(ptr != NULL);
-
- arena_prof_tctx_reset(tsdn, ptr, usize, old_ptr, old_tctx);
-}
-
-JEMALLOC_ALWAYS_INLINE bool
-prof_sample_accum_update(tsd_t *tsd, size_t usize, bool update,
- prof_tdata_t **tdata_out)
-{
- prof_tdata_t *tdata;
-
- cassert(config_prof);
-
- tdata = prof_tdata_get(tsd, true);
- if (unlikely((uintptr_t)tdata <= (uintptr_t)PROF_TDATA_STATE_MAX))
- tdata = NULL;
-
- if (tdata_out != NULL)
- *tdata_out = tdata;
-
- if (unlikely(tdata == NULL))
- return (true);
-
- if (likely(tdata->bytes_until_sample >= usize)) {
- if (update)
- tdata->bytes_until_sample -= usize;
- return (true);
- } else {
- /* Compute new sample threshold. */
- if (update)
- prof_sample_threshold_update(tdata);
- return (!tdata->active);
- }
-}
-
-JEMALLOC_ALWAYS_INLINE prof_tctx_t *
-prof_alloc_prep(tsd_t *tsd, size_t usize, bool prof_active, bool update)
-{
- prof_tctx_t *ret;
- prof_tdata_t *tdata;
- prof_bt_t bt;
-
- assert(usize == s2u(usize));
-
- if (!prof_active || likely(prof_sample_accum_update(tsd, usize, update,
- &tdata)))
- ret = (prof_tctx_t *)(uintptr_t)1U;
- else {
- bt_init(&bt, tdata->vec);
- prof_backtrace(&bt);
- ret = prof_lookup(tsd, &bt);
- }
-
- return (ret);
-}
-
-JEMALLOC_ALWAYS_INLINE void
-prof_malloc(tsdn_t *tsdn, const void *ptr, size_t usize, prof_tctx_t *tctx)
-{
-
- cassert(config_prof);
- assert(ptr != NULL);
- assert(usize == isalloc(tsdn, ptr, true));
-
- if (unlikely((uintptr_t)tctx > (uintptr_t)1U))
- prof_malloc_sample_object(tsdn, ptr, usize, tctx);
- else
- prof_tctx_set(tsdn, ptr, usize, (prof_tctx_t *)(uintptr_t)1U);
-}
-
-JEMALLOC_ALWAYS_INLINE void
-prof_realloc(tsd_t *tsd, const void *ptr, size_t usize, prof_tctx_t *tctx,
- bool prof_active, bool updated, const void *old_ptr, size_t old_usize,
- prof_tctx_t *old_tctx)
-{
- bool sampled, old_sampled;
-
- cassert(config_prof);
- assert(ptr != NULL || (uintptr_t)tctx <= (uintptr_t)1U);
-
- if (prof_active && !updated && ptr != NULL) {
- assert(usize == isalloc(tsd_tsdn(tsd), ptr, true));
- if (prof_sample_accum_update(tsd, usize, true, NULL)) {
- /*
- * Don't sample. The usize passed to prof_alloc_prep()
- * was larger than what actually got allocated, so a
- * backtrace was captured for this allocation, even
- * though its actual usize was insufficient to cross the
- * sample threshold.
- */
- prof_alloc_rollback(tsd, tctx, true);
- tctx = (prof_tctx_t *)(uintptr_t)1U;
- }
- }
-
- sampled = ((uintptr_t)tctx > (uintptr_t)1U);
- old_sampled = ((uintptr_t)old_tctx > (uintptr_t)1U);
-
- if (unlikely(sampled))
- prof_malloc_sample_object(tsd_tsdn(tsd), ptr, usize, tctx);
- else
- prof_tctx_reset(tsd_tsdn(tsd), ptr, usize, old_ptr, old_tctx);
-
- if (unlikely(old_sampled))
- prof_free_sampled_object(tsd, old_usize, old_tctx);
-}
-
-JEMALLOC_ALWAYS_INLINE void
-prof_free(tsd_t *tsd, const void *ptr, size_t usize)
-{
- prof_tctx_t *tctx = prof_tctx_get(tsd_tsdn(tsd), ptr);
-
- cassert(config_prof);
- assert(usize == isalloc(tsd_tsdn(tsd), ptr, true));
-
- if (unlikely((uintptr_t)tctx > (uintptr_t)1U))
- prof_free_sampled_object(tsd, usize, tctx);
-}
-#endif
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
diff --git a/memory/jemalloc/src/include/jemalloc/internal/public_namespace.sh b/memory/jemalloc/src/include/jemalloc/internal/public_namespace.sh
deleted file mode 100755
index 362109f712..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/public_namespace.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-for nm in `cat $1` ; do
- n=`echo ${nm} |tr ':' ' ' |awk '{print $1}'`
- echo "#define je_${n} JEMALLOC_N(${n})"
-done
diff --git a/memory/jemalloc/src/include/jemalloc/internal/public_unnamespace.sh b/memory/jemalloc/src/include/jemalloc/internal/public_unnamespace.sh
deleted file mode 100755
index 4239d17754..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/public_unnamespace.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-for nm in `cat $1` ; do
- n=`echo ${nm} |tr ':' ' ' |awk '{print $1}'`
- echo "#undef je_${n}"
-done
diff --git a/memory/jemalloc/src/include/jemalloc/internal/ql.h b/memory/jemalloc/src/include/jemalloc/internal/ql.h
deleted file mode 100644
index 1834bb8557..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/ql.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* List definitions. */
-#define ql_head(a_type) \
-struct { \
- a_type *qlh_first; \
-}
-
-#define ql_head_initializer(a_head) {NULL}
-
-#define ql_elm(a_type) qr(a_type)
-
-/* List functions. */
-#define ql_new(a_head) do { \
- (a_head)->qlh_first = NULL; \
-} while (0)
-
-#define ql_elm_new(a_elm, a_field) qr_new((a_elm), a_field)
-
-#define ql_first(a_head) ((a_head)->qlh_first)
-
-#define ql_last(a_head, a_field) \
- ((ql_first(a_head) != NULL) \
- ? qr_prev(ql_first(a_head), a_field) : NULL)
-
-#define ql_next(a_head, a_elm, a_field) \
- ((ql_last(a_head, a_field) != (a_elm)) \
- ? qr_next((a_elm), a_field) : NULL)
-
-#define ql_prev(a_head, a_elm, a_field) \
- ((ql_first(a_head) != (a_elm)) ? qr_prev((a_elm), a_field) \
- : NULL)
-
-#define ql_before_insert(a_head, a_qlelm, a_elm, a_field) do { \
- qr_before_insert((a_qlelm), (a_elm), a_field); \
- if (ql_first(a_head) == (a_qlelm)) { \
- ql_first(a_head) = (a_elm); \
- } \
-} while (0)
-
-#define ql_after_insert(a_qlelm, a_elm, a_field) \
- qr_after_insert((a_qlelm), (a_elm), a_field)
-
-#define ql_head_insert(a_head, a_elm, a_field) do { \
- if (ql_first(a_head) != NULL) { \
- qr_before_insert(ql_first(a_head), (a_elm), a_field); \
- } \
- ql_first(a_head) = (a_elm); \
-} while (0)
-
-#define ql_tail_insert(a_head, a_elm, a_field) do { \
- if (ql_first(a_head) != NULL) { \
- qr_before_insert(ql_first(a_head), (a_elm), a_field); \
- } \
- ql_first(a_head) = qr_next((a_elm), a_field); \
-} while (0)
-
-#define ql_remove(a_head, a_elm, a_field) do { \
- if (ql_first(a_head) == (a_elm)) { \
- ql_first(a_head) = qr_next(ql_first(a_head), a_field); \
- } \
- if (ql_first(a_head) != (a_elm)) { \
- qr_remove((a_elm), a_field); \
- } else { \
- ql_first(a_head) = NULL; \
- } \
-} while (0)
-
-#define ql_head_remove(a_head, a_type, a_field) do { \
- a_type *t = ql_first(a_head); \
- ql_remove((a_head), t, a_field); \
-} while (0)
-
-#define ql_tail_remove(a_head, a_type, a_field) do { \
- a_type *t = ql_last(a_head, a_field); \
- ql_remove((a_head), t, a_field); \
-} while (0)
-
-#define ql_foreach(a_var, a_head, a_field) \
- qr_foreach((a_var), ql_first(a_head), a_field)
-
-#define ql_reverse_foreach(a_var, a_head, a_field) \
- qr_reverse_foreach((a_var), ql_first(a_head), a_field)
diff --git a/memory/jemalloc/src/include/jemalloc/internal/qr.h b/memory/jemalloc/src/include/jemalloc/internal/qr.h
deleted file mode 100644
index 0fbaec25e7..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/qr.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Ring definitions. */
-#define qr(a_type) \
-struct { \
- a_type *qre_next; \
- a_type *qre_prev; \
-}
-
-/* Ring functions. */
-#define qr_new(a_qr, a_field) do { \
- (a_qr)->a_field.qre_next = (a_qr); \
- (a_qr)->a_field.qre_prev = (a_qr); \
-} while (0)
-
-#define qr_next(a_qr, a_field) ((a_qr)->a_field.qre_next)
-
-#define qr_prev(a_qr, a_field) ((a_qr)->a_field.qre_prev)
-
-#define qr_before_insert(a_qrelm, a_qr, a_field) do { \
- (a_qr)->a_field.qre_prev = (a_qrelm)->a_field.qre_prev; \
- (a_qr)->a_field.qre_next = (a_qrelm); \
- (a_qr)->a_field.qre_prev->a_field.qre_next = (a_qr); \
- (a_qrelm)->a_field.qre_prev = (a_qr); \
-} while (0)
-
-#define qr_after_insert(a_qrelm, a_qr, a_field) \
- do \
- { \
- (a_qr)->a_field.qre_next = (a_qrelm)->a_field.qre_next; \
- (a_qr)->a_field.qre_prev = (a_qrelm); \
- (a_qr)->a_field.qre_next->a_field.qre_prev = (a_qr); \
- (a_qrelm)->a_field.qre_next = (a_qr); \
- } while (0)
-
-#define qr_meld(a_qr_a, a_qr_b, a_field) do { \
- void *t; \
- (a_qr_a)->a_field.qre_prev->a_field.qre_next = (a_qr_b); \
- (a_qr_b)->a_field.qre_prev->a_field.qre_next = (a_qr_a); \
- t = (a_qr_a)->a_field.qre_prev; \
- (a_qr_a)->a_field.qre_prev = (a_qr_b)->a_field.qre_prev; \
- (a_qr_b)->a_field.qre_prev = t; \
-} while (0)
-
-/*
- * qr_meld() and qr_split() are functionally equivalent, so there's no need to
- * have two copies of the code.
- */
-#define qr_split(a_qr_a, a_qr_b, a_field) \
- qr_meld((a_qr_a), (a_qr_b), a_field)
-
-#define qr_remove(a_qr, a_field) do { \
- (a_qr)->a_field.qre_prev->a_field.qre_next \
- = (a_qr)->a_field.qre_next; \
- (a_qr)->a_field.qre_next->a_field.qre_prev \
- = (a_qr)->a_field.qre_prev; \
- (a_qr)->a_field.qre_next = (a_qr); \
- (a_qr)->a_field.qre_prev = (a_qr); \
-} while (0)
-
-#define qr_foreach(var, a_qr, a_field) \
- for ((var) = (a_qr); \
- (var) != NULL; \
- (var) = (((var)->a_field.qre_next != (a_qr)) \
- ? (var)->a_field.qre_next : NULL))
-
-#define qr_reverse_foreach(var, a_qr, a_field) \
- for ((var) = ((a_qr) != NULL) ? qr_prev(a_qr, a_field) : NULL; \
- (var) != NULL; \
- (var) = (((var) != (a_qr)) \
- ? (var)->a_field.qre_prev : NULL))
diff --git a/memory/jemalloc/src/include/jemalloc/internal/quarantine.h b/memory/jemalloc/src/include/jemalloc/internal/quarantine.h
deleted file mode 100644
index ae607399f6..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/quarantine.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-typedef struct quarantine_obj_s quarantine_obj_t;
-typedef struct quarantine_s quarantine_t;
-
-/* Default per thread quarantine size if valgrind is enabled. */
-#define JEMALLOC_VALGRIND_QUARANTINE_DEFAULT (ZU(1) << 24)
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-struct quarantine_obj_s {
- void *ptr;
- size_t usize;
-};
-
-struct quarantine_s {
- size_t curbytes;
- size_t curobjs;
- size_t first;
-#define LG_MAXOBJS_INIT 10
- size_t lg_maxobjs;
- quarantine_obj_t objs[1]; /* Dynamically sized ring buffer. */
-};
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-void quarantine_alloc_hook_work(tsd_t *tsd);
-void quarantine(tsd_t *tsd, void *ptr);
-void quarantine_cleanup(tsd_t *tsd);
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-#ifndef JEMALLOC_ENABLE_INLINE
-void quarantine_alloc_hook(void);
-#endif
-
-#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_QUARANTINE_C_))
-JEMALLOC_ALWAYS_INLINE void
-quarantine_alloc_hook(void)
-{
- tsd_t *tsd;
-
- assert(config_fill && opt_quarantine);
-
- tsd = tsd_fetch();
- if (tsd_quarantine_get(tsd) == NULL)
- quarantine_alloc_hook_work(tsd);
-}
-#endif
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
-
diff --git a/memory/jemalloc/src/include/jemalloc/internal/rb.h b/memory/jemalloc/src/include/jemalloc/internal/rb.h
deleted file mode 100644
index 3770342f80..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/rb.h
+++ /dev/null
@@ -1,1003 +0,0 @@
-/*-
- *******************************************************************************
- *
- * cpp macro implementation of left-leaning 2-3 red-black trees. Parent
- * pointers are not used, and color bits are stored in the least significant
- * bit of right-child pointers (if RB_COMPACT is defined), thus making node
- * linkage as compact as is possible for red-black trees.
- *
- * Usage:
- *
- * #include <stdint.h>
- * #include <stdbool.h>
- * #define NDEBUG // (Optional, see assert(3).)
- * #include <assert.h>
- * #define RB_COMPACT // (Optional, embed color bits in right-child pointers.)
- * #include <rb.h>
- * ...
- *
- *******************************************************************************
- */
-
-#ifndef RB_H_
-#define RB_H_
-
-#ifdef RB_COMPACT
-/* Node structure. */
-#define rb_node(a_type) \
-struct { \
- a_type *rbn_left; \
- a_type *rbn_right_red; \
-}
-#else
-#define rb_node(a_type) \
-struct { \
- a_type *rbn_left; \
- a_type *rbn_right; \
- bool rbn_red; \
-}
-#endif
-
-/* Root structure. */
-#define rb_tree(a_type) \
-struct { \
- a_type *rbt_root; \
-}
-
-/* Left accessors. */
-#define rbtn_left_get(a_type, a_field, a_node) \
- ((a_node)->a_field.rbn_left)
-#define rbtn_left_set(a_type, a_field, a_node, a_left) do { \
- (a_node)->a_field.rbn_left = a_left; \
-} while (0)
-
-#ifdef RB_COMPACT
-/* Right accessors. */
-#define rbtn_right_get(a_type, a_field, a_node) \
- ((a_type *) (((intptr_t) (a_node)->a_field.rbn_right_red) \
- & ((ssize_t)-2)))
-#define rbtn_right_set(a_type, a_field, a_node, a_right) do { \
- (a_node)->a_field.rbn_right_red = (a_type *) (((uintptr_t) a_right) \
- | (((uintptr_t) (a_node)->a_field.rbn_right_red) & ((size_t)1))); \
-} while (0)
-
-/* Color accessors. */
-#define rbtn_red_get(a_type, a_field, a_node) \
- ((bool) (((uintptr_t) (a_node)->a_field.rbn_right_red) \
- & ((size_t)1)))
-#define rbtn_color_set(a_type, a_field, a_node, a_red) do { \
- (a_node)->a_field.rbn_right_red = (a_type *) ((((intptr_t) \
- (a_node)->a_field.rbn_right_red) & ((ssize_t)-2)) \
- | ((ssize_t)a_red)); \
-} while (0)
-#define rbtn_red_set(a_type, a_field, a_node) do { \
- (a_node)->a_field.rbn_right_red = (a_type *) (((uintptr_t) \
- (a_node)->a_field.rbn_right_red) | ((size_t)1)); \
-} while (0)
-#define rbtn_black_set(a_type, a_field, a_node) do { \
- (a_node)->a_field.rbn_right_red = (a_type *) (((intptr_t) \
- (a_node)->a_field.rbn_right_red) & ((ssize_t)-2)); \
-} while (0)
-
-/* Node initializer. */
-#define rbt_node_new(a_type, a_field, a_rbt, a_node) do { \
- /* Bookkeeping bit cannot be used by node pointer. */ \
- assert(((uintptr_t)(a_node) & 0x1) == 0); \
- rbtn_left_set(a_type, a_field, (a_node), NULL); \
- rbtn_right_set(a_type, a_field, (a_node), NULL); \
- rbtn_red_set(a_type, a_field, (a_node)); \
-} while (0)
-#else
-/* Right accessors. */
-#define rbtn_right_get(a_type, a_field, a_node) \
- ((a_node)->a_field.rbn_right)
-#define rbtn_right_set(a_type, a_field, a_node, a_right) do { \
- (a_node)->a_field.rbn_right = a_right; \
-} while (0)
-
-/* Color accessors. */
-#define rbtn_red_get(a_type, a_field, a_node) \
- ((a_node)->a_field.rbn_red)
-#define rbtn_color_set(a_type, a_field, a_node, a_red) do { \
- (a_node)->a_field.rbn_red = (a_red); \
-} while (0)
-#define rbtn_red_set(a_type, a_field, a_node) do { \
- (a_node)->a_field.rbn_red = true; \
-} while (0)
-#define rbtn_black_set(a_type, a_field, a_node) do { \
- (a_node)->a_field.rbn_red = false; \
-} while (0)
-
-/* Node initializer. */
-#define rbt_node_new(a_type, a_field, a_rbt, a_node) do { \
- rbtn_left_set(a_type, a_field, (a_node), NULL); \
- rbtn_right_set(a_type, a_field, (a_node), NULL); \
- rbtn_red_set(a_type, a_field, (a_node)); \
-} while (0)
-#endif
-
-/* Tree initializer. */
-#define rb_new(a_type, a_field, a_rbt) do { \
- (a_rbt)->rbt_root = NULL; \
-} while (0)
-
-/* Internal utility macros. */
-#define rbtn_first(a_type, a_field, a_rbt, a_root, r_node) do { \
- (r_node) = (a_root); \
- if ((r_node) != NULL) { \
- for (; \
- rbtn_left_get(a_type, a_field, (r_node)) != NULL; \
- (r_node) = rbtn_left_get(a_type, a_field, (r_node))) { \
- } \
- } \
-} while (0)
-
-#define rbtn_last(a_type, a_field, a_rbt, a_root, r_node) do { \
- (r_node) = (a_root); \
- if ((r_node) != NULL) { \
- for (; rbtn_right_get(a_type, a_field, (r_node)) != NULL; \
- (r_node) = rbtn_right_get(a_type, a_field, (r_node))) { \
- } \
- } \
-} while (0)
-
-#define rbtn_rotate_left(a_type, a_field, a_node, r_node) do { \
- (r_node) = rbtn_right_get(a_type, a_field, (a_node)); \
- rbtn_right_set(a_type, a_field, (a_node), \
- rbtn_left_get(a_type, a_field, (r_node))); \
- rbtn_left_set(a_type, a_field, (r_node), (a_node)); \
-} while (0)
-
-#define rbtn_rotate_right(a_type, a_field, a_node, r_node) do { \
- (r_node) = rbtn_left_get(a_type, a_field, (a_node)); \
- rbtn_left_set(a_type, a_field, (a_node), \
- rbtn_right_get(a_type, a_field, (r_node))); \
- rbtn_right_set(a_type, a_field, (r_node), (a_node)); \
-} while (0)
-
-/*
- * The rb_proto() macro generates function prototypes that correspond to the
- * functions generated by an equivalently parameterized call to rb_gen().
- */
-
-#define rb_proto(a_attr, a_prefix, a_rbt_type, a_type) \
-a_attr void \
-a_prefix##new(a_rbt_type *rbtree); \
-a_attr bool \
-a_prefix##empty(a_rbt_type *rbtree); \
-a_attr a_type * \
-a_prefix##first(a_rbt_type *rbtree); \
-a_attr a_type * \
-a_prefix##last(a_rbt_type *rbtree); \
-a_attr a_type * \
-a_prefix##next(a_rbt_type *rbtree, a_type *node); \
-a_attr a_type * \
-a_prefix##prev(a_rbt_type *rbtree, a_type *node); \
-a_attr a_type * \
-a_prefix##search(a_rbt_type *rbtree, const a_type *key); \
-a_attr a_type * \
-a_prefix##nsearch(a_rbt_type *rbtree, const a_type *key); \
-a_attr a_type * \
-a_prefix##psearch(a_rbt_type *rbtree, const a_type *key); \
-a_attr void \
-a_prefix##insert(a_rbt_type *rbtree, a_type *node); \
-a_attr void \
-a_prefix##remove(a_rbt_type *rbtree, a_type *node); \
-a_attr a_type * \
-a_prefix##iter(a_rbt_type *rbtree, a_type *start, a_type *(*cb)( \
- a_rbt_type *, a_type *, void *), void *arg); \
-a_attr a_type * \
-a_prefix##reverse_iter(a_rbt_type *rbtree, a_type *start, \
- a_type *(*cb)(a_rbt_type *, a_type *, void *), void *arg); \
-a_attr void \
-a_prefix##destroy(a_rbt_type *rbtree, void (*cb)(a_type *, void *), \
- void *arg);
-
-/*
- * The rb_gen() macro generates a type-specific red-black tree implementation,
- * based on the above cpp macros.
- *
- * Arguments:
- *
- * a_attr : Function attribute for generated functions (ex: static).
- * a_prefix : Prefix for generated functions (ex: ex_).
- * a_rb_type : Type for red-black tree data structure (ex: ex_t).
- * a_type : Type for red-black tree node data structure (ex: ex_node_t).
- * a_field : Name of red-black tree node linkage (ex: ex_link).
- * a_cmp : Node comparison function name, with the following prototype:
- * int (a_cmp *)(a_type *a_node, a_type *a_other);
- * ^^^^^^
- * or a_key
- * Interpretation of comparison function return values:
- * -1 : a_node < a_other
- * 0 : a_node == a_other
- * 1 : a_node > a_other
- * In all cases, the a_node or a_key macro argument is the first
- * argument to the comparison function, which makes it possible
- * to write comparison functions that treat the first argument
- * specially.
- *
- * Assuming the following setup:
- *
- * typedef struct ex_node_s ex_node_t;
- * struct ex_node_s {
- * rb_node(ex_node_t) ex_link;
- * };
- * typedef rb_tree(ex_node_t) ex_t;
- * rb_gen(static, ex_, ex_t, ex_node_t, ex_link, ex_cmp)
- *
- * The following API is generated:
- *
- * static void
- * ex_new(ex_t *tree);
- * Description: Initialize a red-black tree structure.
- * Args:
- * tree: Pointer to an uninitialized red-black tree object.
- *
- * static bool
- * ex_empty(ex_t *tree);
- * Description: Determine whether tree is empty.
- * Args:
- * tree: Pointer to an initialized red-black tree object.
- * Ret: True if tree is empty, false otherwise.
- *
- * static ex_node_t *
- * ex_first(ex_t *tree);
- * static ex_node_t *
- * ex_last(ex_t *tree);
- * Description: Get the first/last node in tree.
- * Args:
- * tree: Pointer to an initialized red-black tree object.
- * Ret: First/last node in tree, or NULL if tree is empty.
- *
- * static ex_node_t *
- * ex_next(ex_t *tree, ex_node_t *node);
- * static ex_node_t *
- * ex_prev(ex_t *tree, ex_node_t *node);
- * Description: Get node's successor/predecessor.
- * Args:
- * tree: Pointer to an initialized red-black tree object.
- * node: A node in tree.
- * Ret: node's successor/predecessor in tree, or NULL if node is
- * last/first.
- *
- * static ex_node_t *
- * ex_search(ex_t *tree, const ex_node_t *key);
- * Description: Search for node that matches key.
- * Args:
- * tree: Pointer to an initialized red-black tree object.
- * key : Search key.
- * Ret: Node in tree that matches key, or NULL if no match.
- *
- * static ex_node_t *
- * ex_nsearch(ex_t *tree, const ex_node_t *key);
- * static ex_node_t *
- * ex_psearch(ex_t *tree, const ex_node_t *key);
- * Description: Search for node that matches key. If no match is found,
- * return what would be key's successor/predecessor, were
- * key in tree.
- * Args:
- * tree: Pointer to an initialized red-black tree object.
- * key : Search key.
- * Ret: Node in tree that matches key, or if no match, hypothetical node's
- * successor/predecessor (NULL if no successor/predecessor).
- *
- * static void
- * ex_insert(ex_t *tree, ex_node_t *node);
- * Description: Insert node into tree.
- * Args:
- * tree: Pointer to an initialized red-black tree object.
- * node: Node to be inserted into tree.
- *
- * static void
- * ex_remove(ex_t *tree, ex_node_t *node);
- * Description: Remove node from tree.
- * Args:
- * tree: Pointer to an initialized red-black tree object.
- * node: Node in tree to be removed.
- *
- * static ex_node_t *
- * ex_iter(ex_t *tree, ex_node_t *start, ex_node_t *(*cb)(ex_t *,
- * ex_node_t *, void *), void *arg);
- * static ex_node_t *
- * ex_reverse_iter(ex_t *tree, ex_node_t *start, ex_node *(*cb)(ex_t *,
- * ex_node_t *, void *), void *arg);
- * Description: Iterate forward/backward over tree, starting at node. If
- * tree is modified, iteration must be immediately
- * terminated by the callback function that causes the
- * modification.
- * Args:
- * tree : Pointer to an initialized red-black tree object.
- * start: Node at which to start iteration, or NULL to start at
- * first/last node.
- * cb : Callback function, which is called for each node during
- * iteration. Under normal circumstances the callback function
- * should return NULL, which causes iteration to continue. If a
- * callback function returns non-NULL, iteration is immediately
- * terminated and the non-NULL return value is returned by the
- * iterator. This is useful for re-starting iteration after
- * modifying tree.
- * arg : Opaque pointer passed to cb().
- * Ret: NULL if iteration completed, or the non-NULL callback return value
- * that caused termination of the iteration.
- *
- * static void
- * ex_destroy(ex_t *tree, void (*cb)(ex_node_t *, void *), void *arg);
- * Description: Iterate over the tree with post-order traversal, remove
- * each node, and run the callback if non-null. This is
- * used for destroying a tree without paying the cost to
- * rebalance it. The tree must not be otherwise altered
- * during traversal.
- * Args:
- * tree: Pointer to an initialized red-black tree object.
- * cb : Callback function, which, if non-null, is called for each node
- * during iteration. There is no way to stop iteration once it
- * has begun.
- * arg : Opaque pointer passed to cb().
- */
-#define rb_gen(a_attr, a_prefix, a_rbt_type, a_type, a_field, a_cmp) \
-a_attr void \
-a_prefix##new(a_rbt_type *rbtree) { \
- rb_new(a_type, a_field, rbtree); \
-} \
-a_attr bool \
-a_prefix##empty(a_rbt_type *rbtree) { \
- return (rbtree->rbt_root == NULL); \
-} \
-a_attr a_type * \
-a_prefix##first(a_rbt_type *rbtree) { \
- a_type *ret; \
- rbtn_first(a_type, a_field, rbtree, rbtree->rbt_root, ret); \
- return (ret); \
-} \
-a_attr a_type * \
-a_prefix##last(a_rbt_type *rbtree) { \
- a_type *ret; \
- rbtn_last(a_type, a_field, rbtree, rbtree->rbt_root, ret); \
- return (ret); \
-} \
-a_attr a_type * \
-a_prefix##next(a_rbt_type *rbtree, a_type *node) { \
- a_type *ret; \
- if (rbtn_right_get(a_type, a_field, node) != NULL) { \
- rbtn_first(a_type, a_field, rbtree, rbtn_right_get(a_type, \
- a_field, node), ret); \
- } else { \
- a_type *tnode = rbtree->rbt_root; \
- assert(tnode != NULL); \
- ret = NULL; \
- while (true) { \
- int cmp = (a_cmp)(node, tnode); \
- if (cmp < 0) { \
- ret = tnode; \
- tnode = rbtn_left_get(a_type, a_field, tnode); \
- } else if (cmp > 0) { \
- tnode = rbtn_right_get(a_type, a_field, tnode); \
- } else { \
- break; \
- } \
- assert(tnode != NULL); \
- } \
- } \
- return (ret); \
-} \
-a_attr a_type * \
-a_prefix##prev(a_rbt_type *rbtree, a_type *node) { \
- a_type *ret; \
- if (rbtn_left_get(a_type, a_field, node) != NULL) { \
- rbtn_last(a_type, a_field, rbtree, rbtn_left_get(a_type, \
- a_field, node), ret); \
- } else { \
- a_type *tnode = rbtree->rbt_root; \
- assert(tnode != NULL); \
- ret = NULL; \
- while (true) { \
- int cmp = (a_cmp)(node, tnode); \
- if (cmp < 0) { \
- tnode = rbtn_left_get(a_type, a_field, tnode); \
- } else if (cmp > 0) { \
- ret = tnode; \
- tnode = rbtn_right_get(a_type, a_field, tnode); \
- } else { \
- break; \
- } \
- assert(tnode != NULL); \
- } \
- } \
- return (ret); \
-} \
-a_attr a_type * \
-a_prefix##search(a_rbt_type *rbtree, const a_type *key) { \
- a_type *ret; \
- int cmp; \
- ret = rbtree->rbt_root; \
- while (ret != NULL \
- && (cmp = (a_cmp)(key, ret)) != 0) { \
- if (cmp < 0) { \
- ret = rbtn_left_get(a_type, a_field, ret); \
- } else { \
- ret = rbtn_right_get(a_type, a_field, ret); \
- } \
- } \
- return (ret); \
-} \
-a_attr a_type * \
-a_prefix##nsearch(a_rbt_type *rbtree, const a_type *key) { \
- a_type *ret; \
- a_type *tnode = rbtree->rbt_root; \
- ret = NULL; \
- while (tnode != NULL) { \
- int cmp = (a_cmp)(key, tnode); \
- if (cmp < 0) { \
- ret = tnode; \
- tnode = rbtn_left_get(a_type, a_field, tnode); \
- } else if (cmp > 0) { \
- tnode = rbtn_right_get(a_type, a_field, tnode); \
- } else { \
- ret = tnode; \
- break; \
- } \
- } \
- return (ret); \
-} \
-a_attr a_type * \
-a_prefix##psearch(a_rbt_type *rbtree, const a_type *key) { \
- a_type *ret; \
- a_type *tnode = rbtree->rbt_root; \
- ret = NULL; \
- while (tnode != NULL) { \
- int cmp = (a_cmp)(key, tnode); \
- if (cmp < 0) { \
- tnode = rbtn_left_get(a_type, a_field, tnode); \
- } else if (cmp > 0) { \
- ret = tnode; \
- tnode = rbtn_right_get(a_type, a_field, tnode); \
- } else { \
- ret = tnode; \
- break; \
- } \
- } \
- return (ret); \
-} \
-a_attr void \
-a_prefix##insert(a_rbt_type *rbtree, a_type *node) { \
- struct { \
- a_type *node; \
- int cmp; \
- } path[sizeof(void *) << 4], *pathp; \
- rbt_node_new(a_type, a_field, rbtree, node); \
- /* Wind. */ \
- path->node = rbtree->rbt_root; \
- for (pathp = path; pathp->node != NULL; pathp++) { \
- int cmp = pathp->cmp = a_cmp(node, pathp->node); \
- assert(cmp != 0); \
- if (cmp < 0) { \
- pathp[1].node = rbtn_left_get(a_type, a_field, \
- pathp->node); \
- } else { \
- pathp[1].node = rbtn_right_get(a_type, a_field, \
- pathp->node); \
- } \
- } \
- pathp->node = node; \
- /* Unwind. */ \
- for (pathp--; (uintptr_t)pathp >= (uintptr_t)path; pathp--) { \
- a_type *cnode = pathp->node; \
- if (pathp->cmp < 0) { \
- a_type *left = pathp[1].node; \
- rbtn_left_set(a_type, a_field, cnode, left); \
- if (rbtn_red_get(a_type, a_field, left)) { \
- a_type *leftleft = rbtn_left_get(a_type, a_field, left);\
- if (leftleft != NULL && rbtn_red_get(a_type, a_field, \
- leftleft)) { \
- /* Fix up 4-node. */ \
- a_type *tnode; \
- rbtn_black_set(a_type, a_field, leftleft); \
- rbtn_rotate_right(a_type, a_field, cnode, tnode); \
- cnode = tnode; \
- } \
- } else { \
- return; \
- } \
- } else { \
- a_type *right = pathp[1].node; \
- rbtn_right_set(a_type, a_field, cnode, right); \
- if (rbtn_red_get(a_type, a_field, right)) { \
- a_type *left = rbtn_left_get(a_type, a_field, cnode); \
- if (left != NULL && rbtn_red_get(a_type, a_field, \
- left)) { \
- /* Split 4-node. */ \
- rbtn_black_set(a_type, a_field, left); \
- rbtn_black_set(a_type, a_field, right); \
- rbtn_red_set(a_type, a_field, cnode); \
- } else { \
- /* Lean left. */ \
- a_type *tnode; \
- bool tred = rbtn_red_get(a_type, a_field, cnode); \
- rbtn_rotate_left(a_type, a_field, cnode, tnode); \
- rbtn_color_set(a_type, a_field, tnode, tred); \
- rbtn_red_set(a_type, a_field, cnode); \
- cnode = tnode; \
- } \
- } else { \
- return; \
- } \
- } \
- pathp->node = cnode; \
- } \
- /* Set root, and make it black. */ \
- rbtree->rbt_root = path->node; \
- rbtn_black_set(a_type, a_field, rbtree->rbt_root); \
-} \
-a_attr void \
-a_prefix##remove(a_rbt_type *rbtree, a_type *node) { \
- struct { \
- a_type *node; \
- int cmp; \
- } *pathp, *nodep, path[sizeof(void *) << 4]; \
- /* Wind. */ \
- nodep = NULL; /* Silence compiler warning. */ \
- path->node = rbtree->rbt_root; \
- for (pathp = path; pathp->node != NULL; pathp++) { \
- int cmp = pathp->cmp = a_cmp(node, pathp->node); \
- if (cmp < 0) { \
- pathp[1].node = rbtn_left_get(a_type, a_field, \
- pathp->node); \
- } else { \
- pathp[1].node = rbtn_right_get(a_type, a_field, \
- pathp->node); \
- if (cmp == 0) { \
- /* Find node's successor, in preparation for swap. */ \
- pathp->cmp = 1; \
- nodep = pathp; \
- for (pathp++; pathp->node != NULL; \
- pathp++) { \
- pathp->cmp = -1; \
- pathp[1].node = rbtn_left_get(a_type, a_field, \
- pathp->node); \
- } \
- break; \
- } \
- } \
- } \
- assert(nodep->node == node); \
- pathp--; \
- if (pathp->node != node) { \
- /* Swap node with its successor. */ \
- bool tred = rbtn_red_get(a_type, a_field, pathp->node); \
- rbtn_color_set(a_type, a_field, pathp->node, \
- rbtn_red_get(a_type, a_field, node)); \
- rbtn_left_set(a_type, a_field, pathp->node, \
- rbtn_left_get(a_type, a_field, node)); \
- /* If node's successor is its right child, the following code */\
- /* will do the wrong thing for the right child pointer. */\
- /* However, it doesn't matter, because the pointer will be */\
- /* properly set when the successor is pruned. */\
- rbtn_right_set(a_type, a_field, pathp->node, \
- rbtn_right_get(a_type, a_field, node)); \
- rbtn_color_set(a_type, a_field, node, tred); \
- /* The pruned leaf node's child pointers are never accessed */\
- /* again, so don't bother setting them to nil. */\
- nodep->node = pathp->node; \
- pathp->node = node; \
- if (nodep == path) { \
- rbtree->rbt_root = nodep->node; \
- } else { \
- if (nodep[-1].cmp < 0) { \
- rbtn_left_set(a_type, a_field, nodep[-1].node, \
- nodep->node); \
- } else { \
- rbtn_right_set(a_type, a_field, nodep[-1].node, \
- nodep->node); \
- } \
- } \
- } else { \
- a_type *left = rbtn_left_get(a_type, a_field, node); \
- if (left != NULL) { \
- /* node has no successor, but it has a left child. */\
- /* Splice node out, without losing the left child. */\
- assert(!rbtn_red_get(a_type, a_field, node)); \
- assert(rbtn_red_get(a_type, a_field, left)); \
- rbtn_black_set(a_type, a_field, left); \
- if (pathp == path) { \
- rbtree->rbt_root = left; \
- } else { \
- if (pathp[-1].cmp < 0) { \
- rbtn_left_set(a_type, a_field, pathp[-1].node, \
- left); \
- } else { \
- rbtn_right_set(a_type, a_field, pathp[-1].node, \
- left); \
- } \
- } \
- return; \
- } else if (pathp == path) { \
- /* The tree only contained one node. */ \
- rbtree->rbt_root = NULL; \
- return; \
- } \
- } \
- if (rbtn_red_get(a_type, a_field, pathp->node)) { \
- /* Prune red node, which requires no fixup. */ \
- assert(pathp[-1].cmp < 0); \
- rbtn_left_set(a_type, a_field, pathp[-1].node, NULL); \
- return; \
- } \
- /* The node to be pruned is black, so unwind until balance is */\
- /* restored. */\
- pathp->node = NULL; \
- for (pathp--; (uintptr_t)pathp >= (uintptr_t)path; pathp--) { \
- assert(pathp->cmp != 0); \
- if (pathp->cmp < 0) { \
- rbtn_left_set(a_type, a_field, pathp->node, \
- pathp[1].node); \
- if (rbtn_red_get(a_type, a_field, pathp->node)) { \
- a_type *right = rbtn_right_get(a_type, a_field, \
- pathp->node); \
- a_type *rightleft = rbtn_left_get(a_type, a_field, \
- right); \
- a_type *tnode; \
- if (rightleft != NULL && rbtn_red_get(a_type, a_field, \
- rightleft)) { \
- /* In the following diagrams, ||, //, and \\ */\
- /* indicate the path to the removed node. */\
- /* */\
- /* || */\
- /* pathp(r) */\
- /* // \ */\
- /* (b) (b) */\
- /* / */\
- /* (r) */\
- /* */\
- rbtn_black_set(a_type, a_field, pathp->node); \
- rbtn_rotate_right(a_type, a_field, right, tnode); \
- rbtn_right_set(a_type, a_field, pathp->node, tnode);\
- rbtn_rotate_left(a_type, a_field, pathp->node, \
- tnode); \
- } else { \
- /* || */\
- /* pathp(r) */\
- /* // \ */\
- /* (b) (b) */\
- /* / */\
- /* (b) */\
- /* */\
- rbtn_rotate_left(a_type, a_field, pathp->node, \
- tnode); \
- } \
- /* Balance restored, but rotation modified subtree */\
- /* root. */\
- assert((uintptr_t)pathp > (uintptr_t)path); \
- if (pathp[-1].cmp < 0) { \
- rbtn_left_set(a_type, a_field, pathp[-1].node, \
- tnode); \
- } else { \
- rbtn_right_set(a_type, a_field, pathp[-1].node, \
- tnode); \
- } \
- return; \
- } else { \
- a_type *right = rbtn_right_get(a_type, a_field, \
- pathp->node); \
- a_type *rightleft = rbtn_left_get(a_type, a_field, \
- right); \
- if (rightleft != NULL && rbtn_red_get(a_type, a_field, \
- rightleft)) { \
- /* || */\
- /* pathp(b) */\
- /* // \ */\
- /* (b) (b) */\
- /* / */\
- /* (r) */\
- a_type *tnode; \
- rbtn_black_set(a_type, a_field, rightleft); \
- rbtn_rotate_right(a_type, a_field, right, tnode); \
- rbtn_right_set(a_type, a_field, pathp->node, tnode);\
- rbtn_rotate_left(a_type, a_field, pathp->node, \
- tnode); \
- /* Balance restored, but rotation modified */\
- /* subtree root, which may actually be the tree */\
- /* root. */\
- if (pathp == path) { \
- /* Set root. */ \
- rbtree->rbt_root = tnode; \
- } else { \
- if (pathp[-1].cmp < 0) { \
- rbtn_left_set(a_type, a_field, \
- pathp[-1].node, tnode); \
- } else { \
- rbtn_right_set(a_type, a_field, \
- pathp[-1].node, tnode); \
- } \
- } \
- return; \
- } else { \
- /* || */\
- /* pathp(b) */\
- /* // \ */\
- /* (b) (b) */\
- /* / */\
- /* (b) */\
- a_type *tnode; \
- rbtn_red_set(a_type, a_field, pathp->node); \
- rbtn_rotate_left(a_type, a_field, pathp->node, \
- tnode); \
- pathp->node = tnode; \
- } \
- } \
- } else { \
- a_type *left; \
- rbtn_right_set(a_type, a_field, pathp->node, \
- pathp[1].node); \
- left = rbtn_left_get(a_type, a_field, pathp->node); \
- if (rbtn_red_get(a_type, a_field, left)) { \
- a_type *tnode; \
- a_type *leftright = rbtn_right_get(a_type, a_field, \
- left); \
- a_type *leftrightleft = rbtn_left_get(a_type, a_field, \
- leftright); \
- if (leftrightleft != NULL && rbtn_red_get(a_type, \
- a_field, leftrightleft)) { \
- /* || */\
- /* pathp(b) */\
- /* / \\ */\
- /* (r) (b) */\
- /* \ */\
- /* (b) */\
- /* / */\
- /* (r) */\
- a_type *unode; \
- rbtn_black_set(a_type, a_field, leftrightleft); \
- rbtn_rotate_right(a_type, a_field, pathp->node, \
- unode); \
- rbtn_rotate_right(a_type, a_field, pathp->node, \
- tnode); \
- rbtn_right_set(a_type, a_field, unode, tnode); \
- rbtn_rotate_left(a_type, a_field, unode, tnode); \
- } else { \
- /* || */\
- /* pathp(b) */\
- /* / \\ */\
- /* (r) (b) */\
- /* \ */\
- /* (b) */\
- /* / */\
- /* (b) */\
- assert(leftright != NULL); \
- rbtn_red_set(a_type, a_field, leftright); \
- rbtn_rotate_right(a_type, a_field, pathp->node, \
- tnode); \
- rbtn_black_set(a_type, a_field, tnode); \
- } \
- /* Balance restored, but rotation modified subtree */\
- /* root, which may actually be the tree root. */\
- if (pathp == path) { \
- /* Set root. */ \
- rbtree->rbt_root = tnode; \
- } else { \
- if (pathp[-1].cmp < 0) { \
- rbtn_left_set(a_type, a_field, pathp[-1].node, \
- tnode); \
- } else { \
- rbtn_right_set(a_type, a_field, pathp[-1].node, \
- tnode); \
- } \
- } \
- return; \
- } else if (rbtn_red_get(a_type, a_field, pathp->node)) { \
- a_type *leftleft = rbtn_left_get(a_type, a_field, left);\
- if (leftleft != NULL && rbtn_red_get(a_type, a_field, \
- leftleft)) { \
- /* || */\
- /* pathp(r) */\
- /* / \\ */\
- /* (b) (b) */\
- /* / */\
- /* (r) */\
- a_type *tnode; \
- rbtn_black_set(a_type, a_field, pathp->node); \
- rbtn_red_set(a_type, a_field, left); \
- rbtn_black_set(a_type, a_field, leftleft); \
- rbtn_rotate_right(a_type, a_field, pathp->node, \
- tnode); \
- /* Balance restored, but rotation modified */\
- /* subtree root. */\
- assert((uintptr_t)pathp > (uintptr_t)path); \
- if (pathp[-1].cmp < 0) { \
- rbtn_left_set(a_type, a_field, pathp[-1].node, \
- tnode); \
- } else { \
- rbtn_right_set(a_type, a_field, pathp[-1].node, \
- tnode); \
- } \
- return; \
- } else { \
- /* || */\
- /* pathp(r) */\
- /* / \\ */\
- /* (b) (b) */\
- /* / */\
- /* (b) */\
- rbtn_red_set(a_type, a_field, left); \
- rbtn_black_set(a_type, a_field, pathp->node); \
- /* Balance restored. */ \
- return; \
- } \
- } else { \
- a_type *leftleft = rbtn_left_get(a_type, a_field, left);\
- if (leftleft != NULL && rbtn_red_get(a_type, a_field, \
- leftleft)) { \
- /* || */\
- /* pathp(b) */\
- /* / \\ */\
- /* (b) (b) */\
- /* / */\
- /* (r) */\
- a_type *tnode; \
- rbtn_black_set(a_type, a_field, leftleft); \
- rbtn_rotate_right(a_type, a_field, pathp->node, \
- tnode); \
- /* Balance restored, but rotation modified */\
- /* subtree root, which may actually be the tree */\
- /* root. */\
- if (pathp == path) { \
- /* Set root. */ \
- rbtree->rbt_root = tnode; \
- } else { \
- if (pathp[-1].cmp < 0) { \
- rbtn_left_set(a_type, a_field, \
- pathp[-1].node, tnode); \
- } else { \
- rbtn_right_set(a_type, a_field, \
- pathp[-1].node, tnode); \
- } \
- } \
- return; \
- } else { \
- /* || */\
- /* pathp(b) */\
- /* / \\ */\
- /* (b) (b) */\
- /* / */\
- /* (b) */\
- rbtn_red_set(a_type, a_field, left); \
- } \
- } \
- } \
- } \
- /* Set root. */ \
- rbtree->rbt_root = path->node; \
- assert(!rbtn_red_get(a_type, a_field, rbtree->rbt_root)); \
-} \
-a_attr a_type * \
-a_prefix##iter_recurse(a_rbt_type *rbtree, a_type *node, \
- a_type *(*cb)(a_rbt_type *, a_type *, void *), void *arg) { \
- if (node == NULL) { \
- return (NULL); \
- } else { \
- a_type *ret; \
- if ((ret = a_prefix##iter_recurse(rbtree, rbtn_left_get(a_type, \
- a_field, node), cb, arg)) != NULL || (ret = cb(rbtree, node, \
- arg)) != NULL) { \
- return (ret); \
- } \
- return (a_prefix##iter_recurse(rbtree, rbtn_right_get(a_type, \
- a_field, node), cb, arg)); \
- } \
-} \
-a_attr a_type * \
-a_prefix##iter_start(a_rbt_type *rbtree, a_type *start, a_type *node, \
- a_type *(*cb)(a_rbt_type *, a_type *, void *), void *arg) { \
- int cmp = a_cmp(start, node); \
- if (cmp < 0) { \
- a_type *ret; \
- if ((ret = a_prefix##iter_start(rbtree, start, \
- rbtn_left_get(a_type, a_field, node), cb, arg)) != NULL || \
- (ret = cb(rbtree, node, arg)) != NULL) { \
- return (ret); \
- } \
- return (a_prefix##iter_recurse(rbtree, rbtn_right_get(a_type, \
- a_field, node), cb, arg)); \
- } else if (cmp > 0) { \
- return (a_prefix##iter_start(rbtree, start, \
- rbtn_right_get(a_type, a_field, node), cb, arg)); \
- } else { \
- a_type *ret; \
- if ((ret = cb(rbtree, node, arg)) != NULL) { \
- return (ret); \
- } \
- return (a_prefix##iter_recurse(rbtree, rbtn_right_get(a_type, \
- a_field, node), cb, arg)); \
- } \
-} \
-a_attr a_type * \
-a_prefix##iter(a_rbt_type *rbtree, a_type *start, a_type *(*cb)( \
- a_rbt_type *, a_type *, void *), void *arg) { \
- a_type *ret; \
- if (start != NULL) { \
- ret = a_prefix##iter_start(rbtree, start, rbtree->rbt_root, \
- cb, arg); \
- } else { \
- ret = a_prefix##iter_recurse(rbtree, rbtree->rbt_root, cb, arg);\
- } \
- return (ret); \
-} \
-a_attr a_type * \
-a_prefix##reverse_iter_recurse(a_rbt_type *rbtree, a_type *node, \
- a_type *(*cb)(a_rbt_type *, a_type *, void *), void *arg) { \
- if (node == NULL) { \
- return (NULL); \
- } else { \
- a_type *ret; \
- if ((ret = a_prefix##reverse_iter_recurse(rbtree, \
- rbtn_right_get(a_type, a_field, node), cb, arg)) != NULL || \
- (ret = cb(rbtree, node, arg)) != NULL) { \
- return (ret); \
- } \
- return (a_prefix##reverse_iter_recurse(rbtree, \
- rbtn_left_get(a_type, a_field, node), cb, arg)); \
- } \
-} \
-a_attr a_type * \
-a_prefix##reverse_iter_start(a_rbt_type *rbtree, a_type *start, \
- a_type *node, a_type *(*cb)(a_rbt_type *, a_type *, void *), \
- void *arg) { \
- int cmp = a_cmp(start, node); \
- if (cmp > 0) { \
- a_type *ret; \
- if ((ret = a_prefix##reverse_iter_start(rbtree, start, \
- rbtn_right_get(a_type, a_field, node), cb, arg)) != NULL || \
- (ret = cb(rbtree, node, arg)) != NULL) { \
- return (ret); \
- } \
- return (a_prefix##reverse_iter_recurse(rbtree, \
- rbtn_left_get(a_type, a_field, node), cb, arg)); \
- } else if (cmp < 0) { \
- return (a_prefix##reverse_iter_start(rbtree, start, \
- rbtn_left_get(a_type, a_field, node), cb, arg)); \
- } else { \
- a_type *ret; \
- if ((ret = cb(rbtree, node, arg)) != NULL) { \
- return (ret); \
- } \
- return (a_prefix##reverse_iter_recurse(rbtree, \
- rbtn_left_get(a_type, a_field, node), cb, arg)); \
- } \
-} \
-a_attr a_type * \
-a_prefix##reverse_iter(a_rbt_type *rbtree, a_type *start, \
- a_type *(*cb)(a_rbt_type *, a_type *, void *), void *arg) { \
- a_type *ret; \
- if (start != NULL) { \
- ret = a_prefix##reverse_iter_start(rbtree, start, \
- rbtree->rbt_root, cb, arg); \
- } else { \
- ret = a_prefix##reverse_iter_recurse(rbtree, rbtree->rbt_root, \
- cb, arg); \
- } \
- return (ret); \
-} \
-a_attr void \
-a_prefix##destroy_recurse(a_rbt_type *rbtree, a_type *node, void (*cb)( \
- a_type *, void *), void *arg) { \
- if (node == NULL) { \
- return; \
- } \
- a_prefix##destroy_recurse(rbtree, rbtn_left_get(a_type, a_field, \
- node), cb, arg); \
- rbtn_left_set(a_type, a_field, (node), NULL); \
- a_prefix##destroy_recurse(rbtree, rbtn_right_get(a_type, a_field, \
- node), cb, arg); \
- rbtn_right_set(a_type, a_field, (node), NULL); \
- if (cb) { \
- cb(node, arg); \
- } \
-} \
-a_attr void \
-a_prefix##destroy(a_rbt_type *rbtree, void (*cb)(a_type *, void *), \
- void *arg) { \
- a_prefix##destroy_recurse(rbtree, rbtree->rbt_root, cb, arg); \
- rbtree->rbt_root = NULL; \
-}
-
-#endif /* RB_H_ */
diff --git a/memory/jemalloc/src/include/jemalloc/internal/rtree.h b/memory/jemalloc/src/include/jemalloc/internal/rtree.h
deleted file mode 100644
index 8d0c584daf..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/rtree.h
+++ /dev/null
@@ -1,366 +0,0 @@
-/*
- * This radix tree implementation is tailored to the singular purpose of
- * associating metadata with chunks that are currently owned by jemalloc.
- *
- *******************************************************************************
- */
-#ifdef JEMALLOC_H_TYPES
-
-typedef struct rtree_node_elm_s rtree_node_elm_t;
-typedef struct rtree_level_s rtree_level_t;
-typedef struct rtree_s rtree_t;
-
-/*
- * RTREE_BITS_PER_LEVEL must be a power of two that is no larger than the
- * machine address width.
- */
-#define LG_RTREE_BITS_PER_LEVEL 4
-#define RTREE_BITS_PER_LEVEL (1U << LG_RTREE_BITS_PER_LEVEL)
-/* Maximum rtree height. */
-#define RTREE_HEIGHT_MAX \
- ((1U << (LG_SIZEOF_PTR+3)) / RTREE_BITS_PER_LEVEL)
-
-/* Used for two-stage lock-free node initialization. */
-#define RTREE_NODE_INITIALIZING ((rtree_node_elm_t *)0x1)
-
-/*
- * The node allocation callback function's argument is the number of contiguous
- * rtree_node_elm_t structures to allocate, and the resulting memory must be
- * zeroed.
- */
-typedef rtree_node_elm_t *(rtree_node_alloc_t)(size_t);
-typedef void (rtree_node_dalloc_t)(rtree_node_elm_t *);
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-struct rtree_node_elm_s {
- union {
- void *pun;
- rtree_node_elm_t *child;
- extent_node_t *val;
- };
-};
-
-struct rtree_level_s {
- /*
- * A non-NULL subtree points to a subtree rooted along the hypothetical
- * path to the leaf node corresponding to key 0. Depending on what keys
- * have been used to store to the tree, an arbitrary combination of
- * subtree pointers may remain NULL.
- *
- * Suppose keys comprise 48 bits, and LG_RTREE_BITS_PER_LEVEL is 4.
- * This results in a 3-level tree, and the leftmost leaf can be directly
- * accessed via subtrees[2], the subtree prefixed by 0x0000 (excluding
- * 0x00000000) can be accessed via subtrees[1], and the remainder of the
- * tree can be accessed via subtrees[0].
- *
- * levels[0] : [<unused> | 0x0001******** | 0x0002******** | ...]
- *
- * levels[1] : [<unused> | 0x00000001**** | 0x00000002**** | ... ]
- *
- * levels[2] : [val(0x000000000000) | val(0x000000000001) | ...]
- *
- * This has practical implications on x64, which currently uses only the
- * lower 47 bits of virtual address space in userland, thus leaving
- * subtrees[0] unused and avoiding a level of tree traversal.
- */
- union {
- void *subtree_pun;
- rtree_node_elm_t *subtree;
- };
- /* Number of key bits distinguished by this level. */
- unsigned bits;
- /*
- * Cumulative number of key bits distinguished by traversing to
- * corresponding tree level.
- */
- unsigned cumbits;
-};
-
-struct rtree_s {
- rtree_node_alloc_t *alloc;
- rtree_node_dalloc_t *dalloc;
- unsigned height;
- /*
- * Precomputed table used to convert from the number of leading 0 key
- * bits to which subtree level to start at.
- */
- unsigned start_level[RTREE_HEIGHT_MAX];
- rtree_level_t levels[RTREE_HEIGHT_MAX];
-};
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-bool rtree_new(rtree_t *rtree, unsigned bits, rtree_node_alloc_t *alloc,
- rtree_node_dalloc_t *dalloc);
-void rtree_delete(rtree_t *rtree);
-rtree_node_elm_t *rtree_subtree_read_hard(rtree_t *rtree,
- unsigned level);
-rtree_node_elm_t *rtree_child_read_hard(rtree_t *rtree,
- rtree_node_elm_t *elm, unsigned level);
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-#ifndef JEMALLOC_ENABLE_INLINE
-unsigned rtree_start_level(rtree_t *rtree, uintptr_t key);
-uintptr_t rtree_subkey(rtree_t *rtree, uintptr_t key, unsigned level);
-
-bool rtree_node_valid(rtree_node_elm_t *node);
-rtree_node_elm_t *rtree_child_tryread(rtree_node_elm_t *elm,
- bool dependent);
-rtree_node_elm_t *rtree_child_read(rtree_t *rtree, rtree_node_elm_t *elm,
- unsigned level, bool dependent);
-extent_node_t *rtree_val_read(rtree_t *rtree, rtree_node_elm_t *elm,
- bool dependent);
-void rtree_val_write(rtree_t *rtree, rtree_node_elm_t *elm,
- const extent_node_t *val);
-rtree_node_elm_t *rtree_subtree_tryread(rtree_t *rtree, unsigned level,
- bool dependent);
-rtree_node_elm_t *rtree_subtree_read(rtree_t *rtree, unsigned level,
- bool dependent);
-
-extent_node_t *rtree_get(rtree_t *rtree, uintptr_t key, bool dependent);
-bool rtree_set(rtree_t *rtree, uintptr_t key, const extent_node_t *val);
-#endif
-
-#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_RTREE_C_))
-JEMALLOC_ALWAYS_INLINE unsigned
-rtree_start_level(rtree_t *rtree, uintptr_t key)
-{
- unsigned start_level;
-
- if (unlikely(key == 0))
- return (rtree->height - 1);
-
- start_level = rtree->start_level[lg_floor(key) >>
- LG_RTREE_BITS_PER_LEVEL];
- assert(start_level < rtree->height);
- return (start_level);
-}
-
-JEMALLOC_ALWAYS_INLINE uintptr_t
-rtree_subkey(rtree_t *rtree, uintptr_t key, unsigned level)
-{
-
- return ((key >> ((ZU(1) << (LG_SIZEOF_PTR+3)) -
- rtree->levels[level].cumbits)) & ((ZU(1) <<
- rtree->levels[level].bits) - 1));
-}
-
-JEMALLOC_ALWAYS_INLINE bool
-rtree_node_valid(rtree_node_elm_t *node)
-{
-
- return ((uintptr_t)node > (uintptr_t)RTREE_NODE_INITIALIZING);
-}
-
-JEMALLOC_ALWAYS_INLINE rtree_node_elm_t *
-rtree_child_tryread(rtree_node_elm_t *elm, bool dependent)
-{
- rtree_node_elm_t *child;
-
- /* Double-checked read (first read may be stale. */
- child = elm->child;
- if (!dependent && !rtree_node_valid(child))
- child = atomic_read_p(&elm->pun);
- assert(!dependent || child != NULL);
- return (child);
-}
-
-JEMALLOC_ALWAYS_INLINE rtree_node_elm_t *
-rtree_child_read(rtree_t *rtree, rtree_node_elm_t *elm, unsigned level,
- bool dependent)
-{
- rtree_node_elm_t *child;
-
- child = rtree_child_tryread(elm, dependent);
- if (!dependent && unlikely(!rtree_node_valid(child)))
- child = rtree_child_read_hard(rtree, elm, level);
- assert(!dependent || child != NULL);
- return (child);
-}
-
-JEMALLOC_ALWAYS_INLINE extent_node_t *
-rtree_val_read(rtree_t *rtree, rtree_node_elm_t *elm, bool dependent)
-{
-
- if (dependent) {
- /*
- * Reading a val on behalf of a pointer to a valid allocation is
- * guaranteed to be a clean read even without synchronization,
- * because the rtree update became visible in memory before the
- * pointer came into existence.
- */
- return (elm->val);
- } else {
- /*
- * An arbitrary read, e.g. on behalf of ivsalloc(), may not be
- * dependent on a previous rtree write, which means a stale read
- * could result if synchronization were omitted here.
- */
- return (atomic_read_p(&elm->pun));
- }
-}
-
-JEMALLOC_INLINE void
-rtree_val_write(rtree_t *rtree, rtree_node_elm_t *elm, const extent_node_t *val)
-{
-
- atomic_write_p(&elm->pun, val);
-}
-
-JEMALLOC_ALWAYS_INLINE rtree_node_elm_t *
-rtree_subtree_tryread(rtree_t *rtree, unsigned level, bool dependent)
-{
- rtree_node_elm_t *subtree;
-
- /* Double-checked read (first read may be stale. */
- subtree = rtree->levels[level].subtree;
- if (!dependent && unlikely(!rtree_node_valid(subtree)))
- subtree = atomic_read_p(&rtree->levels[level].subtree_pun);
- assert(!dependent || subtree != NULL);
- return (subtree);
-}
-
-JEMALLOC_ALWAYS_INLINE rtree_node_elm_t *
-rtree_subtree_read(rtree_t *rtree, unsigned level, bool dependent)
-{
- rtree_node_elm_t *subtree;
-
- subtree = rtree_subtree_tryread(rtree, level, dependent);
- if (!dependent && unlikely(!rtree_node_valid(subtree)))
- subtree = rtree_subtree_read_hard(rtree, level);
- assert(!dependent || subtree != NULL);
- return (subtree);
-}
-
-JEMALLOC_ALWAYS_INLINE extent_node_t *
-rtree_get(rtree_t *rtree, uintptr_t key, bool dependent)
-{
- uintptr_t subkey;
- unsigned start_level;
- rtree_node_elm_t *node;
-
- start_level = rtree_start_level(rtree, key);
-
- node = rtree_subtree_tryread(rtree, start_level, dependent);
-#define RTREE_GET_BIAS (RTREE_HEIGHT_MAX - rtree->height)
- switch (start_level + RTREE_GET_BIAS) {
-#define RTREE_GET_SUBTREE(level) \
- case level: \
- assert(level < (RTREE_HEIGHT_MAX-1)); \
- if (!dependent && unlikely(!rtree_node_valid(node))) \
- return (NULL); \
- subkey = rtree_subkey(rtree, key, level - \
- RTREE_GET_BIAS); \
- node = rtree_child_tryread(&node[subkey], dependent); \
- /* Fall through. */
-#define RTREE_GET_LEAF(level) \
- case level: \
- assert(level == (RTREE_HEIGHT_MAX-1)); \
- if (!dependent && unlikely(!rtree_node_valid(node))) \
- return (NULL); \
- subkey = rtree_subkey(rtree, key, level - \
- RTREE_GET_BIAS); \
- /* \
- * node is a leaf, so it contains values rather than \
- * child pointers. \
- */ \
- return (rtree_val_read(rtree, &node[subkey], \
- dependent));
-#if RTREE_HEIGHT_MAX > 1
- RTREE_GET_SUBTREE(0)
-#endif
-#if RTREE_HEIGHT_MAX > 2
- RTREE_GET_SUBTREE(1)
-#endif
-#if RTREE_HEIGHT_MAX > 3
- RTREE_GET_SUBTREE(2)
-#endif
-#if RTREE_HEIGHT_MAX > 4
- RTREE_GET_SUBTREE(3)
-#endif
-#if RTREE_HEIGHT_MAX > 5
- RTREE_GET_SUBTREE(4)
-#endif
-#if RTREE_HEIGHT_MAX > 6
- RTREE_GET_SUBTREE(5)
-#endif
-#if RTREE_HEIGHT_MAX > 7
- RTREE_GET_SUBTREE(6)
-#endif
-#if RTREE_HEIGHT_MAX > 8
- RTREE_GET_SUBTREE(7)
-#endif
-#if RTREE_HEIGHT_MAX > 9
- RTREE_GET_SUBTREE(8)
-#endif
-#if RTREE_HEIGHT_MAX > 10
- RTREE_GET_SUBTREE(9)
-#endif
-#if RTREE_HEIGHT_MAX > 11
- RTREE_GET_SUBTREE(10)
-#endif
-#if RTREE_HEIGHT_MAX > 12
- RTREE_GET_SUBTREE(11)
-#endif
-#if RTREE_HEIGHT_MAX > 13
- RTREE_GET_SUBTREE(12)
-#endif
-#if RTREE_HEIGHT_MAX > 14
- RTREE_GET_SUBTREE(13)
-#endif
-#if RTREE_HEIGHT_MAX > 15
- RTREE_GET_SUBTREE(14)
-#endif
-#if RTREE_HEIGHT_MAX > 16
-# error Unsupported RTREE_HEIGHT_MAX
-#endif
- RTREE_GET_LEAF(RTREE_HEIGHT_MAX-1)
-#undef RTREE_GET_SUBTREE
-#undef RTREE_GET_LEAF
- default: not_reached();
- }
-#undef RTREE_GET_BIAS
- not_reached();
-}
-
-JEMALLOC_INLINE bool
-rtree_set(rtree_t *rtree, uintptr_t key, const extent_node_t *val)
-{
- uintptr_t subkey;
- unsigned i, start_level;
- rtree_node_elm_t *node, *child;
-
- start_level = rtree_start_level(rtree, key);
-
- node = rtree_subtree_read(rtree, start_level, false);
- if (node == NULL)
- return (true);
- for (i = start_level; /**/; i++, node = child) {
- subkey = rtree_subkey(rtree, key, i);
- if (i == rtree->height - 1) {
- /*
- * node is a leaf, so it contains values rather than
- * child pointers.
- */
- rtree_val_write(rtree, &node[subkey], val);
- return (false);
- }
- assert(i + 1 < rtree->height);
- child = rtree_child_read(rtree, &node[subkey], i, false);
- if (child == NULL)
- return (true);
- }
- not_reached();
-}
-#endif
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
diff --git a/memory/jemalloc/src/include/jemalloc/internal/size_classes.sh b/memory/jemalloc/src/include/jemalloc/internal/size_classes.sh
deleted file mode 100755
index f6fbce4ef5..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/size_classes.sh
+++ /dev/null
@@ -1,318 +0,0 @@
-#!/bin/sh
-#
-# Usage: size_classes.sh <lg_qarr> <lg_tmin> <lg_parr> <lg_g>
-
-# The following limits are chosen such that they cover all supported platforms.
-
-# Pointer sizes.
-lg_zarr="2 3"
-
-# Quanta.
-lg_qarr=$1
-
-# The range of tiny size classes is [2^lg_tmin..2^(lg_q-1)].
-lg_tmin=$2
-
-# Maximum lookup size.
-lg_kmax=12
-
-# Page sizes.
-lg_parr=`echo $3 | tr ',' ' '`
-
-# Size class group size (number of size classes for each size doubling).
-lg_g=$4
-
-pow2() {
- e=$1
- pow2_result=1
- while [ ${e} -gt 0 ] ; do
- pow2_result=$((${pow2_result} + ${pow2_result}))
- e=$((${e} - 1))
- done
-}
-
-lg() {
- x=$1
- lg_result=0
- while [ ${x} -gt 1 ] ; do
- lg_result=$((${lg_result} + 1))
- x=$((${x} / 2))
- done
-}
-
-size_class() {
- index=$1
- lg_grp=$2
- lg_delta=$3
- ndelta=$4
- lg_p=$5
- lg_kmax=$6
-
- if [ ${lg_delta} -ge ${lg_p} ] ; then
- psz="yes"
- else
- pow2 ${lg_p}; p=${pow2_result}
- pow2 ${lg_grp}; grp=${pow2_result}
- pow2 ${lg_delta}; delta=${pow2_result}
- sz=$((${grp} + ${delta} * ${ndelta}))
- npgs=$((${sz} / ${p}))
- if [ ${sz} -eq $((${npgs} * ${p})) ] ; then
- psz="yes"
- else
- psz="no"
- fi
- fi
-
- lg ${ndelta}; lg_ndelta=${lg_result}; pow2 ${lg_ndelta}
- if [ ${pow2_result} -lt ${ndelta} ] ; then
- rem="yes"
- else
- rem="no"
- fi
-
- lg_size=${lg_grp}
- if [ $((${lg_delta} + ${lg_ndelta})) -eq ${lg_grp} ] ; then
- lg_size=$((${lg_grp} + 1))
- else
- lg_size=${lg_grp}
- rem="yes"
- fi
-
- if [ ${lg_size} -lt $((${lg_p} + ${lg_g})) ] ; then
- bin="yes"
- else
- bin="no"
- fi
- if [ ${lg_size} -lt ${lg_kmax} \
- -o ${lg_size} -eq ${lg_kmax} -a ${rem} = "no" ] ; then
- lg_delta_lookup=${lg_delta}
- else
- lg_delta_lookup="no"
- fi
- printf ' SC(%3d, %6d, %8d, %6d, %3s, %3s, %2s) \\\n' ${index} ${lg_grp} ${lg_delta} ${ndelta} ${psz} ${bin} ${lg_delta_lookup}
- # Defined upon return:
- # - psz ("yes" or "no")
- # - bin ("yes" or "no")
- # - lg_delta_lookup (${lg_delta} or "no")
-}
-
-sep_line() {
- echo " \\"
-}
-
-size_classes() {
- lg_z=$1
- lg_q=$2
- lg_t=$3
- lg_p=$4
- lg_g=$5
-
- pow2 $((${lg_z} + 3)); ptr_bits=${pow2_result}
- pow2 ${lg_g}; g=${pow2_result}
-
- echo "#define SIZE_CLASSES \\"
- echo " /* index, lg_grp, lg_delta, ndelta, psz, bin, lg_delta_lookup */ \\"
-
- ntbins=0
- nlbins=0
- lg_tiny_maxclass='"NA"'
- nbins=0
- npsizes=0
-
- # Tiny size classes.
- ndelta=0
- index=0
- lg_grp=${lg_t}
- lg_delta=${lg_grp}
- while [ ${lg_grp} -lt ${lg_q} ] ; do
- size_class ${index} ${lg_grp} ${lg_delta} ${ndelta} ${lg_p} ${lg_kmax}
- if [ ${lg_delta_lookup} != "no" ] ; then
- nlbins=$((${index} + 1))
- fi
- if [ ${psz} = "yes" ] ; then
- npsizes=$((${npsizes} + 1))
- fi
- if [ ${bin} != "no" ] ; then
- nbins=$((${index} + 1))
- fi
- ntbins=$((${ntbins} + 1))
- lg_tiny_maxclass=${lg_grp} # Final written value is correct.
- index=$((${index} + 1))
- lg_delta=${lg_grp}
- lg_grp=$((${lg_grp} + 1))
- done
-
- # First non-tiny group.
- if [ ${ntbins} -gt 0 ] ; then
- sep_line
- # The first size class has an unusual encoding, because the size has to be
- # split between grp and delta*ndelta.
- lg_grp=$((${lg_grp} - 1))
- ndelta=1
- size_class ${index} ${lg_grp} ${lg_delta} ${ndelta} ${lg_p} ${lg_kmax}
- index=$((${index} + 1))
- lg_grp=$((${lg_grp} + 1))
- lg_delta=$((${lg_delta} + 1))
- if [ ${psz} = "yes" ] ; then
- npsizes=$((${npsizes} + 1))
- fi
- fi
- while [ ${ndelta} -lt ${g} ] ; do
- size_class ${index} ${lg_grp} ${lg_delta} ${ndelta} ${lg_p} ${lg_kmax}
- index=$((${index} + 1))
- ndelta=$((${ndelta} + 1))
- if [ ${psz} = "yes" ] ; then
- npsizes=$((${npsizes} + 1))
- fi
- done
-
- # All remaining groups.
- lg_grp=$((${lg_grp} + ${lg_g}))
- while [ ${lg_grp} -lt $((${ptr_bits} - 1)) ] ; do
- sep_line
- ndelta=1
- if [ ${lg_grp} -eq $((${ptr_bits} - 2)) ] ; then
- ndelta_limit=$((${g} - 1))
- else
- ndelta_limit=${g}
- fi
- while [ ${ndelta} -le ${ndelta_limit} ] ; do
- size_class ${index} ${lg_grp} ${lg_delta} ${ndelta} ${lg_p} ${lg_kmax}
- if [ ${lg_delta_lookup} != "no" ] ; then
- nlbins=$((${index} + 1))
- # Final written value is correct:
- lookup_maxclass="((((size_t)1) << ${lg_grp}) + (((size_t)${ndelta}) << ${lg_delta}))"
- fi
- if [ ${psz} = "yes" ] ; then
- npsizes=$((${npsizes} + 1))
- fi
- if [ ${bin} != "no" ] ; then
- nbins=$((${index} + 1))
- # Final written value is correct:
- small_maxclass="((((size_t)1) << ${lg_grp}) + (((size_t)${ndelta}) << ${lg_delta}))"
- if [ ${lg_g} -gt 0 ] ; then
- lg_large_minclass=$((${lg_grp} + 1))
- else
- lg_large_minclass=$((${lg_grp} + 2))
- fi
- fi
- # Final written value is correct:
- huge_maxclass="((((size_t)1) << ${lg_grp}) + (((size_t)${ndelta}) << ${lg_delta}))"
- index=$((${index} + 1))
- ndelta=$((${ndelta} + 1))
- done
- lg_grp=$((${lg_grp} + 1))
- lg_delta=$((${lg_delta} + 1))
- done
- echo
- nsizes=${index}
-
- # Defined upon completion:
- # - ntbins
- # - nlbins
- # - nbins
- # - nsizes
- # - npsizes
- # - lg_tiny_maxclass
- # - lookup_maxclass
- # - small_maxclass
- # - lg_large_minclass
- # - huge_maxclass
-}
-
-cat <<EOF
-/* This file was automatically generated by size_classes.sh. */
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-/*
- * This header requires LG_SIZEOF_PTR, LG_TINY_MIN, LG_QUANTUM, and LG_PAGE to
- * be defined prior to inclusion, and it in turn defines:
- *
- * LG_SIZE_CLASS_GROUP: Lg of size class count for each size doubling.
- * SIZE_CLASSES: Complete table of SC(index, lg_grp, lg_delta, ndelta, psz,
- * bin, lg_delta_lookup) tuples.
- * index: Size class index.
- * lg_grp: Lg group base size (no deltas added).
- * lg_delta: Lg delta to previous size class.
- * ndelta: Delta multiplier. size == 1<<lg_grp + ndelta<<lg_delta
- * psz: 'yes' if a multiple of the page size, 'no' otherwise.
- * bin: 'yes' if a small bin size class, 'no' otherwise.
- * lg_delta_lookup: Same as lg_delta if a lookup table size class, 'no'
- * otherwise.
- * NTBINS: Number of tiny bins.
- * NLBINS: Number of bins supported by the lookup table.
- * NBINS: Number of small size class bins.
- * NSIZES: Number of size classes.
- * NPSIZES: Number of size classes that are a multiple of (1U << LG_PAGE).
- * LG_TINY_MAXCLASS: Lg of maximum tiny size class.
- * LOOKUP_MAXCLASS: Maximum size class included in lookup table.
- * SMALL_MAXCLASS: Maximum small size class.
- * LG_LARGE_MINCLASS: Lg of minimum large size class.
- * HUGE_MAXCLASS: Maximum (huge) size class.
- */
-
-#define LG_SIZE_CLASS_GROUP ${lg_g}
-
-EOF
-
-for lg_z in ${lg_zarr} ; do
- for lg_q in ${lg_qarr} ; do
- lg_t=${lg_tmin}
- while [ ${lg_t} -le ${lg_q} ] ; do
- # Iterate through page sizes and compute how many bins there are.
- for lg_p in ${lg_parr} ; do
- echo "#if (LG_SIZEOF_PTR == ${lg_z} && LG_TINY_MIN == ${lg_t} && LG_QUANTUM == ${lg_q} && LG_PAGE == ${lg_p})"
- size_classes ${lg_z} ${lg_q} ${lg_t} ${lg_p} ${lg_g}
- echo "#define SIZE_CLASSES_DEFINED"
- echo "#define NTBINS ${ntbins}"
- echo "#define NLBINS ${nlbins}"
- echo "#define NBINS ${nbins}"
- echo "#define NSIZES ${nsizes}"
- echo "#define NPSIZES ${npsizes}"
- echo "#define LG_TINY_MAXCLASS ${lg_tiny_maxclass}"
- echo "#define LOOKUP_MAXCLASS ${lookup_maxclass}"
- echo "#define SMALL_MAXCLASS ${small_maxclass}"
- echo "#define LG_LARGE_MINCLASS ${lg_large_minclass}"
- echo "#define HUGE_MAXCLASS ${huge_maxclass}"
- echo "#endif"
- echo
- done
- lg_t=$((${lg_t} + 1))
- done
- done
-done
-
-cat <<EOF
-#ifndef SIZE_CLASSES_DEFINED
-# error "No size class definitions match configuration"
-#endif
-#undef SIZE_CLASSES_DEFINED
-/*
- * The size2index_tab lookup table uses uint8_t to encode each bin index, so we
- * cannot support more than 256 small size classes. Further constrain NBINS to
- * 255 since all small size classes, plus a "not small" size class must be
- * stored in 8 bits of arena_chunk_map_bits_t's bits field.
- */
-#if (NBINS > 255)
-# error "Too many small size classes"
-#endif
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
-EOF
diff --git a/memory/jemalloc/src/include/jemalloc/internal/smoothstep.h b/memory/jemalloc/src/include/jemalloc/internal/smoothstep.h
deleted file mode 100644
index c5333ccad3..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/smoothstep.h
+++ /dev/null
@@ -1,246 +0,0 @@
-/*
- * This file was generated by the following command:
- * sh smoothstep.sh smoother 200 24 3 15
- */
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-/*
- * This header defines a precomputed table based on the smoothstep family of
- * sigmoidal curves (https://en.wikipedia.org/wiki/Smoothstep) that grow from 0
- * to 1 in 0 <= x <= 1. The table is stored as integer fixed point values so
- * that floating point math can be avoided.
- *
- * 3 2
- * smoothstep(x) = -2x + 3x
- *
- * 5 4 3
- * smootherstep(x) = 6x - 15x + 10x
- *
- * 7 6 5 4
- * smootheststep(x) = -20x + 70x - 84x + 35x
- */
-
-#define SMOOTHSTEP_VARIANT "smoother"
-#define SMOOTHSTEP_NSTEPS 200
-#define SMOOTHSTEP_BFP 24
-#define SMOOTHSTEP \
- /* STEP(step, h, x, y) */ \
- STEP( 1, UINT64_C(0x0000000000000014), 0.005, 0.000001240643750) \
- STEP( 2, UINT64_C(0x00000000000000a5), 0.010, 0.000009850600000) \
- STEP( 3, UINT64_C(0x0000000000000229), 0.015, 0.000032995181250) \
- STEP( 4, UINT64_C(0x0000000000000516), 0.020, 0.000077619200000) \
- STEP( 5, UINT64_C(0x00000000000009dc), 0.025, 0.000150449218750) \
- STEP( 6, UINT64_C(0x00000000000010e8), 0.030, 0.000257995800000) \
- STEP( 7, UINT64_C(0x0000000000001aa4), 0.035, 0.000406555756250) \
- STEP( 8, UINT64_C(0x0000000000002777), 0.040, 0.000602214400000) \
- STEP( 9, UINT64_C(0x00000000000037c2), 0.045, 0.000850847793750) \
- STEP( 10, UINT64_C(0x0000000000004be6), 0.050, 0.001158125000000) \
- STEP( 11, UINT64_C(0x000000000000643c), 0.055, 0.001529510331250) \
- STEP( 12, UINT64_C(0x000000000000811f), 0.060, 0.001970265600000) \
- STEP( 13, UINT64_C(0x000000000000a2e2), 0.065, 0.002485452368750) \
- STEP( 14, UINT64_C(0x000000000000c9d8), 0.070, 0.003079934200000) \
- STEP( 15, UINT64_C(0x000000000000f64f), 0.075, 0.003758378906250) \
- STEP( 16, UINT64_C(0x0000000000012891), 0.080, 0.004525260800000) \
- STEP( 17, UINT64_C(0x00000000000160e7), 0.085, 0.005384862943750) \
- STEP( 18, UINT64_C(0x0000000000019f95), 0.090, 0.006341279400000) \
- STEP( 19, UINT64_C(0x000000000001e4dc), 0.095, 0.007398417481250) \
- STEP( 20, UINT64_C(0x00000000000230fc), 0.100, 0.008560000000000) \
- STEP( 21, UINT64_C(0x0000000000028430), 0.105, 0.009829567518750) \
- STEP( 22, UINT64_C(0x000000000002deb0), 0.110, 0.011210480600000) \
- STEP( 23, UINT64_C(0x00000000000340b1), 0.115, 0.012705922056250) \
- STEP( 24, UINT64_C(0x000000000003aa67), 0.120, 0.014318899200000) \
- STEP( 25, UINT64_C(0x0000000000041c00), 0.125, 0.016052246093750) \
- STEP( 26, UINT64_C(0x00000000000495a8), 0.130, 0.017908625800000) \
- STEP( 27, UINT64_C(0x000000000005178b), 0.135, 0.019890532631250) \
- STEP( 28, UINT64_C(0x000000000005a1cf), 0.140, 0.022000294400000) \
- STEP( 29, UINT64_C(0x0000000000063498), 0.145, 0.024240074668750) \
- STEP( 30, UINT64_C(0x000000000006d009), 0.150, 0.026611875000000) \
- STEP( 31, UINT64_C(0x000000000007743f), 0.155, 0.029117537206250) \
- STEP( 32, UINT64_C(0x0000000000082157), 0.160, 0.031758745600000) \
- STEP( 33, UINT64_C(0x000000000008d76b), 0.165, 0.034537029243750) \
- STEP( 34, UINT64_C(0x0000000000099691), 0.170, 0.037453764200000) \
- STEP( 35, UINT64_C(0x00000000000a5edf), 0.175, 0.040510175781250) \
- STEP( 36, UINT64_C(0x00000000000b3067), 0.180, 0.043707340800000) \
- STEP( 37, UINT64_C(0x00000000000c0b38), 0.185, 0.047046189818750) \
- STEP( 38, UINT64_C(0x00000000000cef5e), 0.190, 0.050527509400000) \
- STEP( 39, UINT64_C(0x00000000000ddce6), 0.195, 0.054151944356250) \
- STEP( 40, UINT64_C(0x00000000000ed3d8), 0.200, 0.057920000000000) \
- STEP( 41, UINT64_C(0x00000000000fd439), 0.205, 0.061832044393750) \
- STEP( 42, UINT64_C(0x000000000010de0e), 0.210, 0.065888310600000) \
- STEP( 43, UINT64_C(0x000000000011f158), 0.215, 0.070088898931250) \
- STEP( 44, UINT64_C(0x0000000000130e17), 0.220, 0.074433779200000) \
- STEP( 45, UINT64_C(0x0000000000143448), 0.225, 0.078922792968750) \
- STEP( 46, UINT64_C(0x00000000001563e7), 0.230, 0.083555655800000) \
- STEP( 47, UINT64_C(0x0000000000169cec), 0.235, 0.088331959506250) \
- STEP( 48, UINT64_C(0x000000000017df4f), 0.240, 0.093251174400000) \
- STEP( 49, UINT64_C(0x0000000000192b04), 0.245, 0.098312651543750) \
- STEP( 50, UINT64_C(0x00000000001a8000), 0.250, 0.103515625000000) \
- STEP( 51, UINT64_C(0x00000000001bde32), 0.255, 0.108859214081250) \
- STEP( 52, UINT64_C(0x00000000001d458b), 0.260, 0.114342425600000) \
- STEP( 53, UINT64_C(0x00000000001eb5f8), 0.265, 0.119964156118750) \
- STEP( 54, UINT64_C(0x0000000000202f65), 0.270, 0.125723194200000) \
- STEP( 55, UINT64_C(0x000000000021b1bb), 0.275, 0.131618222656250) \
- STEP( 56, UINT64_C(0x0000000000233ce3), 0.280, 0.137647820800000) \
- STEP( 57, UINT64_C(0x000000000024d0c3), 0.285, 0.143810466693750) \
- STEP( 58, UINT64_C(0x0000000000266d40), 0.290, 0.150104539400000) \
- STEP( 59, UINT64_C(0x000000000028123d), 0.295, 0.156528321231250) \
- STEP( 60, UINT64_C(0x000000000029bf9c), 0.300, 0.163080000000000) \
- STEP( 61, UINT64_C(0x00000000002b753d), 0.305, 0.169757671268750) \
- STEP( 62, UINT64_C(0x00000000002d32fe), 0.310, 0.176559340600000) \
- STEP( 63, UINT64_C(0x00000000002ef8bc), 0.315, 0.183482925806250) \
- STEP( 64, UINT64_C(0x000000000030c654), 0.320, 0.190526259200000) \
- STEP( 65, UINT64_C(0x0000000000329b9f), 0.325, 0.197687089843750) \
- STEP( 66, UINT64_C(0x0000000000347875), 0.330, 0.204963085800000) \
- STEP( 67, UINT64_C(0x0000000000365cb0), 0.335, 0.212351836381250) \
- STEP( 68, UINT64_C(0x0000000000384825), 0.340, 0.219850854400000) \
- STEP( 69, UINT64_C(0x00000000003a3aa8), 0.345, 0.227457578418750) \
- STEP( 70, UINT64_C(0x00000000003c340f), 0.350, 0.235169375000000) \
- STEP( 71, UINT64_C(0x00000000003e342b), 0.355, 0.242983540956250) \
- STEP( 72, UINT64_C(0x0000000000403ace), 0.360, 0.250897305600000) \
- STEP( 73, UINT64_C(0x00000000004247c8), 0.365, 0.258907832993750) \
- STEP( 74, UINT64_C(0x0000000000445ae9), 0.370, 0.267012224200000) \
- STEP( 75, UINT64_C(0x0000000000467400), 0.375, 0.275207519531250) \
- STEP( 76, UINT64_C(0x00000000004892d8), 0.380, 0.283490700800000) \
- STEP( 77, UINT64_C(0x00000000004ab740), 0.385, 0.291858693568750) \
- STEP( 78, UINT64_C(0x00000000004ce102), 0.390, 0.300308369400000) \
- STEP( 79, UINT64_C(0x00000000004f0fe9), 0.395, 0.308836548106250) \
- STEP( 80, UINT64_C(0x00000000005143bf), 0.400, 0.317440000000000) \
- STEP( 81, UINT64_C(0x0000000000537c4d), 0.405, 0.326115448143750) \
- STEP( 82, UINT64_C(0x000000000055b95b), 0.410, 0.334859570600000) \
- STEP( 83, UINT64_C(0x000000000057fab1), 0.415, 0.343669002681250) \
- STEP( 84, UINT64_C(0x00000000005a4015), 0.420, 0.352540339200000) \
- STEP( 85, UINT64_C(0x00000000005c894e), 0.425, 0.361470136718750) \
- STEP( 86, UINT64_C(0x00000000005ed622), 0.430, 0.370454915800000) \
- STEP( 87, UINT64_C(0x0000000000612655), 0.435, 0.379491163256250) \
- STEP( 88, UINT64_C(0x00000000006379ac), 0.440, 0.388575334400000) \
- STEP( 89, UINT64_C(0x000000000065cfeb), 0.445, 0.397703855293750) \
- STEP( 90, UINT64_C(0x00000000006828d6), 0.450, 0.406873125000000) \
- STEP( 91, UINT64_C(0x00000000006a842f), 0.455, 0.416079517831250) \
- STEP( 92, UINT64_C(0x00000000006ce1bb), 0.460, 0.425319385600000) \
- STEP( 93, UINT64_C(0x00000000006f413a), 0.465, 0.434589059868750) \
- STEP( 94, UINT64_C(0x000000000071a270), 0.470, 0.443884854200000) \
- STEP( 95, UINT64_C(0x000000000074051d), 0.475, 0.453203066406250) \
- STEP( 96, UINT64_C(0x0000000000766905), 0.480, 0.462539980800000) \
- STEP( 97, UINT64_C(0x000000000078cde7), 0.485, 0.471891870443750) \
- STEP( 98, UINT64_C(0x00000000007b3387), 0.490, 0.481254999400000) \
- STEP( 99, UINT64_C(0x00000000007d99a4), 0.495, 0.490625624981250) \
- STEP( 100, UINT64_C(0x0000000000800000), 0.500, 0.500000000000000) \
- STEP( 101, UINT64_C(0x000000000082665b), 0.505, 0.509374375018750) \
- STEP( 102, UINT64_C(0x000000000084cc78), 0.510, 0.518745000600000) \
- STEP( 103, UINT64_C(0x0000000000873218), 0.515, 0.528108129556250) \
- STEP( 104, UINT64_C(0x00000000008996fa), 0.520, 0.537460019200000) \
- STEP( 105, UINT64_C(0x00000000008bfae2), 0.525, 0.546796933593750) \
- STEP( 106, UINT64_C(0x00000000008e5d8f), 0.530, 0.556115145800000) \
- STEP( 107, UINT64_C(0x000000000090bec5), 0.535, 0.565410940131250) \
- STEP( 108, UINT64_C(0x0000000000931e44), 0.540, 0.574680614400000) \
- STEP( 109, UINT64_C(0x0000000000957bd0), 0.545, 0.583920482168750) \
- STEP( 110, UINT64_C(0x000000000097d729), 0.550, 0.593126875000000) \
- STEP( 111, UINT64_C(0x00000000009a3014), 0.555, 0.602296144706250) \
- STEP( 112, UINT64_C(0x00000000009c8653), 0.560, 0.611424665600000) \
- STEP( 113, UINT64_C(0x00000000009ed9aa), 0.565, 0.620508836743750) \
- STEP( 114, UINT64_C(0x0000000000a129dd), 0.570, 0.629545084200000) \
- STEP( 115, UINT64_C(0x0000000000a376b1), 0.575, 0.638529863281250) \
- STEP( 116, UINT64_C(0x0000000000a5bfea), 0.580, 0.647459660800000) \
- STEP( 117, UINT64_C(0x0000000000a8054e), 0.585, 0.656330997318750) \
- STEP( 118, UINT64_C(0x0000000000aa46a4), 0.590, 0.665140429400000) \
- STEP( 119, UINT64_C(0x0000000000ac83b2), 0.595, 0.673884551856250) \
- STEP( 120, UINT64_C(0x0000000000aebc40), 0.600, 0.682560000000000) \
- STEP( 121, UINT64_C(0x0000000000b0f016), 0.605, 0.691163451893750) \
- STEP( 122, UINT64_C(0x0000000000b31efd), 0.610, 0.699691630600000) \
- STEP( 123, UINT64_C(0x0000000000b548bf), 0.615, 0.708141306431250) \
- STEP( 124, UINT64_C(0x0000000000b76d27), 0.620, 0.716509299200000) \
- STEP( 125, UINT64_C(0x0000000000b98c00), 0.625, 0.724792480468750) \
- STEP( 126, UINT64_C(0x0000000000bba516), 0.630, 0.732987775800000) \
- STEP( 127, UINT64_C(0x0000000000bdb837), 0.635, 0.741092167006250) \
- STEP( 128, UINT64_C(0x0000000000bfc531), 0.640, 0.749102694400000) \
- STEP( 129, UINT64_C(0x0000000000c1cbd4), 0.645, 0.757016459043750) \
- STEP( 130, UINT64_C(0x0000000000c3cbf0), 0.650, 0.764830625000000) \
- STEP( 131, UINT64_C(0x0000000000c5c557), 0.655, 0.772542421581250) \
- STEP( 132, UINT64_C(0x0000000000c7b7da), 0.660, 0.780149145600000) \
- STEP( 133, UINT64_C(0x0000000000c9a34f), 0.665, 0.787648163618750) \
- STEP( 134, UINT64_C(0x0000000000cb878a), 0.670, 0.795036914200000) \
- STEP( 135, UINT64_C(0x0000000000cd6460), 0.675, 0.802312910156250) \
- STEP( 136, UINT64_C(0x0000000000cf39ab), 0.680, 0.809473740800000) \
- STEP( 137, UINT64_C(0x0000000000d10743), 0.685, 0.816517074193750) \
- STEP( 138, UINT64_C(0x0000000000d2cd01), 0.690, 0.823440659400000) \
- STEP( 139, UINT64_C(0x0000000000d48ac2), 0.695, 0.830242328731250) \
- STEP( 140, UINT64_C(0x0000000000d64063), 0.700, 0.836920000000000) \
- STEP( 141, UINT64_C(0x0000000000d7edc2), 0.705, 0.843471678768750) \
- STEP( 142, UINT64_C(0x0000000000d992bf), 0.710, 0.849895460600000) \
- STEP( 143, UINT64_C(0x0000000000db2f3c), 0.715, 0.856189533306250) \
- STEP( 144, UINT64_C(0x0000000000dcc31c), 0.720, 0.862352179200000) \
- STEP( 145, UINT64_C(0x0000000000de4e44), 0.725, 0.868381777343750) \
- STEP( 146, UINT64_C(0x0000000000dfd09a), 0.730, 0.874276805800000) \
- STEP( 147, UINT64_C(0x0000000000e14a07), 0.735, 0.880035843881250) \
- STEP( 148, UINT64_C(0x0000000000e2ba74), 0.740, 0.885657574400000) \
- STEP( 149, UINT64_C(0x0000000000e421cd), 0.745, 0.891140785918750) \
- STEP( 150, UINT64_C(0x0000000000e58000), 0.750, 0.896484375000000) \
- STEP( 151, UINT64_C(0x0000000000e6d4fb), 0.755, 0.901687348456250) \
- STEP( 152, UINT64_C(0x0000000000e820b0), 0.760, 0.906748825600000) \
- STEP( 153, UINT64_C(0x0000000000e96313), 0.765, 0.911668040493750) \
- STEP( 154, UINT64_C(0x0000000000ea9c18), 0.770, 0.916444344200000) \
- STEP( 155, UINT64_C(0x0000000000ebcbb7), 0.775, 0.921077207031250) \
- STEP( 156, UINT64_C(0x0000000000ecf1e8), 0.780, 0.925566220800000) \
- STEP( 157, UINT64_C(0x0000000000ee0ea7), 0.785, 0.929911101068750) \
- STEP( 158, UINT64_C(0x0000000000ef21f1), 0.790, 0.934111689400000) \
- STEP( 159, UINT64_C(0x0000000000f02bc6), 0.795, 0.938167955606250) \
- STEP( 160, UINT64_C(0x0000000000f12c27), 0.800, 0.942080000000000) \
- STEP( 161, UINT64_C(0x0000000000f22319), 0.805, 0.945848055643750) \
- STEP( 162, UINT64_C(0x0000000000f310a1), 0.810, 0.949472490600000) \
- STEP( 163, UINT64_C(0x0000000000f3f4c7), 0.815, 0.952953810181250) \
- STEP( 164, UINT64_C(0x0000000000f4cf98), 0.820, 0.956292659200000) \
- STEP( 165, UINT64_C(0x0000000000f5a120), 0.825, 0.959489824218750) \
- STEP( 166, UINT64_C(0x0000000000f6696e), 0.830, 0.962546235800000) \
- STEP( 167, UINT64_C(0x0000000000f72894), 0.835, 0.965462970756250) \
- STEP( 168, UINT64_C(0x0000000000f7dea8), 0.840, 0.968241254400000) \
- STEP( 169, UINT64_C(0x0000000000f88bc0), 0.845, 0.970882462793750) \
- STEP( 170, UINT64_C(0x0000000000f92ff6), 0.850, 0.973388125000000) \
- STEP( 171, UINT64_C(0x0000000000f9cb67), 0.855, 0.975759925331250) \
- STEP( 172, UINT64_C(0x0000000000fa5e30), 0.860, 0.977999705600000) \
- STEP( 173, UINT64_C(0x0000000000fae874), 0.865, 0.980109467368750) \
- STEP( 174, UINT64_C(0x0000000000fb6a57), 0.870, 0.982091374200000) \
- STEP( 175, UINT64_C(0x0000000000fbe400), 0.875, 0.983947753906250) \
- STEP( 176, UINT64_C(0x0000000000fc5598), 0.880, 0.985681100800000) \
- STEP( 177, UINT64_C(0x0000000000fcbf4e), 0.885, 0.987294077943750) \
- STEP( 178, UINT64_C(0x0000000000fd214f), 0.890, 0.988789519400000) \
- STEP( 179, UINT64_C(0x0000000000fd7bcf), 0.895, 0.990170432481250) \
- STEP( 180, UINT64_C(0x0000000000fdcf03), 0.900, 0.991440000000000) \
- STEP( 181, UINT64_C(0x0000000000fe1b23), 0.905, 0.992601582518750) \
- STEP( 182, UINT64_C(0x0000000000fe606a), 0.910, 0.993658720600000) \
- STEP( 183, UINT64_C(0x0000000000fe9f18), 0.915, 0.994615137056250) \
- STEP( 184, UINT64_C(0x0000000000fed76e), 0.920, 0.995474739200000) \
- STEP( 185, UINT64_C(0x0000000000ff09b0), 0.925, 0.996241621093750) \
- STEP( 186, UINT64_C(0x0000000000ff3627), 0.930, 0.996920065800000) \
- STEP( 187, UINT64_C(0x0000000000ff5d1d), 0.935, 0.997514547631250) \
- STEP( 188, UINT64_C(0x0000000000ff7ee0), 0.940, 0.998029734400000) \
- STEP( 189, UINT64_C(0x0000000000ff9bc3), 0.945, 0.998470489668750) \
- STEP( 190, UINT64_C(0x0000000000ffb419), 0.950, 0.998841875000000) \
- STEP( 191, UINT64_C(0x0000000000ffc83d), 0.955, 0.999149152206250) \
- STEP( 192, UINT64_C(0x0000000000ffd888), 0.960, 0.999397785600000) \
- STEP( 193, UINT64_C(0x0000000000ffe55b), 0.965, 0.999593444243750) \
- STEP( 194, UINT64_C(0x0000000000ffef17), 0.970, 0.999742004200000) \
- STEP( 195, UINT64_C(0x0000000000fff623), 0.975, 0.999849550781250) \
- STEP( 196, UINT64_C(0x0000000000fffae9), 0.980, 0.999922380800000) \
- STEP( 197, UINT64_C(0x0000000000fffdd6), 0.985, 0.999967004818750) \
- STEP( 198, UINT64_C(0x0000000000ffff5a), 0.990, 0.999990149400000) \
- STEP( 199, UINT64_C(0x0000000000ffffeb), 0.995, 0.999998759356250) \
- STEP( 200, UINT64_C(0x0000000001000000), 1.000, 1.000000000000000) \
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
diff --git a/memory/jemalloc/src/include/jemalloc/internal/smoothstep.sh b/memory/jemalloc/src/include/jemalloc/internal/smoothstep.sh
deleted file mode 100755
index 8124693f71..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/smoothstep.sh
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/bin/sh
-#
-# Generate a discrete lookup table for a sigmoid function in the smoothstep
-# family (https://en.wikipedia.org/wiki/Smoothstep), where the lookup table
-# entries correspond to x in [1/nsteps, 2/nsteps, ..., nsteps/nsteps]. Encode
-# the entries using a binary fixed point representation.
-#
-# Usage: smoothstep.sh <variant> <nsteps> <bfp> <xprec> <yprec>
-#
-# <variant> is in {smooth, smoother, smoothest}.
-# <nsteps> must be greater than zero.
-# <bfp> must be in [0..62]; reasonable values are roughly [10..30].
-# <xprec> is x decimal precision.
-# <yprec> is y decimal precision.
-
-#set -x
-
-cmd="sh smoothstep.sh $*"
-variant=$1
-nsteps=$2
-bfp=$3
-xprec=$4
-yprec=$5
-
-case "${variant}" in
- smooth)
- ;;
- smoother)
- ;;
- smoothest)
- ;;
- *)
- echo "Unsupported variant"
- exit 1
- ;;
-esac
-
-smooth() {
- step=$1
- y=`echo ${yprec} k ${step} ${nsteps} / sx _2 lx 3 ^ '*' 3 lx 2 ^ '*' + p | dc | tr -d '\\\\\n' | sed -e 's#^\.#0.#g'`
- h=`echo ${yprec} k 2 ${bfp} ^ ${y} '*' p | dc | tr -d '\\\\\n' | sed -e 's#^\.#0.#g' | tr '.' ' ' | awk '{print $1}' `
-}
-
-smoother() {
- step=$1
- y=`echo ${yprec} k ${step} ${nsteps} / sx 6 lx 5 ^ '*' _15 lx 4 ^ '*' + 10 lx 3 ^ '*' + p | dc | tr -d '\\\\\n' | sed -e 's#^\.#0.#g'`
- h=`echo ${yprec} k 2 ${bfp} ^ ${y} '*' p | dc | tr -d '\\\\\n' | sed -e 's#^\.#0.#g' | tr '.' ' ' | awk '{print $1}' `
-}
-
-smoothest() {
- step=$1
- y=`echo ${yprec} k ${step} ${nsteps} / sx _20 lx 7 ^ '*' 70 lx 6 ^ '*' + _84 lx 5 ^ '*' + 35 lx 4 ^ '*' + p | dc | tr -d '\\\\\n' | sed -e 's#^\.#0.#g'`
- h=`echo ${yprec} k 2 ${bfp} ^ ${y} '*' p | dc | tr -d '\\\\\n' | sed -e 's#^\.#0.#g' | tr '.' ' ' | awk '{print $1}' `
-}
-
-cat <<EOF
-/*
- * This file was generated by the following command:
- * $cmd
- */
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-/*
- * This header defines a precomputed table based on the smoothstep family of
- * sigmoidal curves (https://en.wikipedia.org/wiki/Smoothstep) that grow from 0
- * to 1 in 0 <= x <= 1. The table is stored as integer fixed point values so
- * that floating point math can be avoided.
- *
- * 3 2
- * smoothstep(x) = -2x + 3x
- *
- * 5 4 3
- * smootherstep(x) = 6x - 15x + 10x
- *
- * 7 6 5 4
- * smootheststep(x) = -20x + 70x - 84x + 35x
- */
-
-#define SMOOTHSTEP_VARIANT "${variant}"
-#define SMOOTHSTEP_NSTEPS ${nsteps}
-#define SMOOTHSTEP_BFP ${bfp}
-#define SMOOTHSTEP \\
- /* STEP(step, h, x, y) */ \\
-EOF
-
-s=1
-while [ $s -le $nsteps ] ; do
- $variant ${s}
- x=`echo ${xprec} k ${s} ${nsteps} / p | dc | tr -d '\\\\\n' | sed -e 's#^\.#0.#g'`
- printf ' STEP(%4d, UINT64_C(0x%016x), %s, %s) \\\n' ${s} ${h} ${x} ${y}
-
- s=$((s+1))
-done
-echo
-
-cat <<EOF
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
-EOF
diff --git a/memory/jemalloc/src/include/jemalloc/internal/spin.h b/memory/jemalloc/src/include/jemalloc/internal/spin.h
deleted file mode 100644
index 9ef5ceb924..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/spin.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-typedef struct spin_s spin_t;
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-struct spin_s {
- unsigned iteration;
-};
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-#ifndef JEMALLOC_ENABLE_INLINE
-void spin_init(spin_t *spin);
-void spin_adaptive(spin_t *spin);
-#endif
-
-#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_SPIN_C_))
-JEMALLOC_INLINE void
-spin_init(spin_t *spin)
-{
-
- spin->iteration = 0;
-}
-
-JEMALLOC_INLINE void
-spin_adaptive(spin_t *spin)
-{
- volatile uint64_t i;
-
- for (i = 0; i < (KQU(1) << spin->iteration); i++)
- CPU_SPINWAIT;
-
- if (spin->iteration < 63)
- spin->iteration++;
-}
-
-#endif
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
-
diff --git a/memory/jemalloc/src/include/jemalloc/internal/stats.h b/memory/jemalloc/src/include/jemalloc/internal/stats.h
deleted file mode 100644
index b62181783e..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/stats.h
+++ /dev/null
@@ -1,201 +0,0 @@
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-typedef struct tcache_bin_stats_s tcache_bin_stats_t;
-typedef struct malloc_bin_stats_s malloc_bin_stats_t;
-typedef struct malloc_large_stats_s malloc_large_stats_t;
-typedef struct malloc_huge_stats_s malloc_huge_stats_t;
-typedef struct arena_stats_s arena_stats_t;
-typedef struct chunk_stats_s chunk_stats_t;
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-struct tcache_bin_stats_s {
- /*
- * Number of allocation requests that corresponded to the size of this
- * bin.
- */
- uint64_t nrequests;
-};
-
-struct malloc_bin_stats_s {
- /*
- * Total number of allocation/deallocation requests served directly by
- * the bin. Note that tcache may allocate an object, then recycle it
- * many times, resulting many increments to nrequests, but only one
- * each to nmalloc and ndalloc.
- */
- uint64_t nmalloc;
- uint64_t ndalloc;
-
- /*
- * Number of allocation requests that correspond to the size of this
- * bin. This includes requests served by tcache, though tcache only
- * periodically merges into this counter.
- */
- uint64_t nrequests;
-
- /*
- * Current number of regions of this size class, including regions
- * currently cached by tcache.
- */
- size_t curregs;
-
- /* Number of tcache fills from this bin. */
- uint64_t nfills;
-
- /* Number of tcache flushes to this bin. */
- uint64_t nflushes;
-
- /* Total number of runs created for this bin's size class. */
- uint64_t nruns;
-
- /*
- * Total number of runs reused by extracting them from the runs tree for
- * this bin's size class.
- */
- uint64_t reruns;
-
- /* Current number of runs in this bin. */
- size_t curruns;
-};
-
-struct malloc_large_stats_s {
- /*
- * Total number of allocation/deallocation requests served directly by
- * the arena. Note that tcache may allocate an object, then recycle it
- * many times, resulting many increments to nrequests, but only one
- * each to nmalloc and ndalloc.
- */
- uint64_t nmalloc;
- uint64_t ndalloc;
-
- /*
- * Number of allocation requests that correspond to this size class.
- * This includes requests served by tcache, though tcache only
- * periodically merges into this counter.
- */
- uint64_t nrequests;
-
- /*
- * Current number of runs of this size class, including runs currently
- * cached by tcache.
- */
- size_t curruns;
-};
-
-struct malloc_huge_stats_s {
- /*
- * Total number of allocation/deallocation requests served directly by
- * the arena.
- */
- uint64_t nmalloc;
- uint64_t ndalloc;
-
- /* Current number of (multi-)chunk allocations of this size class. */
- size_t curhchunks;
-};
-
-struct arena_stats_s {
- /* Number of bytes currently mapped. */
- size_t mapped;
-
- /*
- * Number of bytes currently retained as a side effect of munmap() being
- * disabled/bypassed. Retained bytes are technically mapped (though
- * always decommitted or purged), but they are excluded from the mapped
- * statistic (above).
- */
- size_t retained;
-
- /*
- * Total number of purge sweeps, total number of madvise calls made,
- * and total pages purged in order to keep dirty unused memory under
- * control.
- */
- uint64_t npurge;
- uint64_t nmadvise;
- uint64_t purged;
-
- /*
- * Number of bytes currently mapped purely for metadata purposes, and
- * number of bytes currently allocated for internal metadata.
- */
- size_t metadata_mapped;
- size_t metadata_allocated; /* Protected via atomic_*_z(). */
-
- /* Per-size-category statistics. */
- size_t allocated_large;
- uint64_t nmalloc_large;
- uint64_t ndalloc_large;
- uint64_t nrequests_large;
-
- size_t allocated_huge;
- uint64_t nmalloc_huge;
- uint64_t ndalloc_huge;
-
- /* One element for each large size class. */
- malloc_large_stats_t *lstats;
-
- /* One element for each huge size class. */
- malloc_huge_stats_t *hstats;
-};
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-extern bool opt_stats_print;
-
-extern size_t stats_cactive;
-
-void stats_print(void (*write)(void *, const char *), void *cbopaque,
- const char *opts);
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-#ifndef JEMALLOC_ENABLE_INLINE
-size_t stats_cactive_get(void);
-void stats_cactive_add(size_t size);
-void stats_cactive_sub(size_t size);
-#endif
-
-#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_STATS_C_))
-JEMALLOC_INLINE size_t
-stats_cactive_get(void)
-{
-
- return (atomic_read_z(&stats_cactive));
-}
-
-JEMALLOC_INLINE void
-stats_cactive_add(size_t size)
-{
- UNUSED size_t cactive;
-
- assert(size > 0);
- assert((size & chunksize_mask) == 0);
-
- cactive = atomic_add_z(&stats_cactive, size);
- assert(cactive - size < cactive);
-}
-
-JEMALLOC_INLINE void
-stats_cactive_sub(size_t size)
-{
- UNUSED size_t cactive;
-
- assert(size > 0);
- assert((size & chunksize_mask) == 0);
-
- cactive = atomic_sub_z(&stats_cactive, size);
- assert(cactive + size > cactive);
-}
-#endif
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
diff --git a/memory/jemalloc/src/include/jemalloc/internal/tcache.h b/memory/jemalloc/src/include/jemalloc/internal/tcache.h
deleted file mode 100644
index 01ba062dea..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/tcache.h
+++ /dev/null
@@ -1,469 +0,0 @@
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-typedef struct tcache_bin_info_s tcache_bin_info_t;
-typedef struct tcache_bin_s tcache_bin_t;
-typedef struct tcache_s tcache_t;
-typedef struct tcaches_s tcaches_t;
-
-/*
- * tcache pointers close to NULL are used to encode state information that is
- * used for two purposes: preventing thread caching on a per thread basis and
- * cleaning up during thread shutdown.
- */
-#define TCACHE_STATE_DISABLED ((tcache_t *)(uintptr_t)1)
-#define TCACHE_STATE_REINCARNATED ((tcache_t *)(uintptr_t)2)
-#define TCACHE_STATE_PURGATORY ((tcache_t *)(uintptr_t)3)
-#define TCACHE_STATE_MAX TCACHE_STATE_PURGATORY
-
-/*
- * Absolute minimum number of cache slots for each small bin.
- */
-#define TCACHE_NSLOTS_SMALL_MIN 20
-
-/*
- * Absolute maximum number of cache slots for each small bin in the thread
- * cache. This is an additional constraint beyond that imposed as: twice the
- * number of regions per run for this size class.
- *
- * This constant must be an even number.
- */
-#define TCACHE_NSLOTS_SMALL_MAX 200
-
-/* Number of cache slots for large size classes. */
-#define TCACHE_NSLOTS_LARGE 20
-
-/* (1U << opt_lg_tcache_max) is used to compute tcache_maxclass. */
-#define LG_TCACHE_MAXCLASS_DEFAULT 15
-
-/*
- * TCACHE_GC_SWEEP is the approximate number of allocation events between
- * full GC sweeps. Integer rounding may cause the actual number to be
- * slightly higher, since GC is performed incrementally.
- */
-#define TCACHE_GC_SWEEP 8192
-
-/* Number of tcache allocation/deallocation events between incremental GCs. */
-#define TCACHE_GC_INCR \
- ((TCACHE_GC_SWEEP / NBINS) + ((TCACHE_GC_SWEEP / NBINS == 0) ? 0 : 1))
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-typedef enum {
- tcache_enabled_false = 0, /* Enable cast to/from bool. */
- tcache_enabled_true = 1,
- tcache_enabled_default = 2
-} tcache_enabled_t;
-
-/*
- * Read-only information associated with each element of tcache_t's tbins array
- * is stored separately, mainly to reduce memory usage.
- */
-struct tcache_bin_info_s {
- unsigned ncached_max; /* Upper limit on ncached. */
-};
-
-struct tcache_bin_s {
- tcache_bin_stats_t tstats;
- int low_water; /* Min # cached since last GC. */
- unsigned lg_fill_div; /* Fill (ncached_max >> lg_fill_div). */
- unsigned ncached; /* # of cached objects. */
- /*
- * To make use of adjacent cacheline prefetch, the items in the avail
- * stack goes to higher address for newer allocations. avail points
- * just above the available space, which means that
- * avail[-ncached, ... -1] are available items and the lowest item will
- * be allocated first.
- */
- void **avail; /* Stack of available objects. */
-};
-
-struct tcache_s {
- ql_elm(tcache_t) link; /* Used for aggregating stats. */
- uint64_t prof_accumbytes;/* Cleared after arena_prof_accum(). */
- ticker_t gc_ticker; /* Drives incremental GC. */
- szind_t next_gc_bin; /* Next bin to GC. */
- tcache_bin_t tbins[1]; /* Dynamically sized. */
- /*
- * The pointer stacks associated with tbins follow as a contiguous
- * array. During tcache initialization, the avail pointer in each
- * element of tbins is initialized to point to the proper offset within
- * this array.
- */
-};
-
-/* Linkage for list of available (previously used) explicit tcache IDs. */
-struct tcaches_s {
- union {
- tcache_t *tcache;
- tcaches_t *next;
- };
-};
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-extern bool opt_tcache;
-extern ssize_t opt_lg_tcache_max;
-
-extern tcache_bin_info_t *tcache_bin_info;
-
-/*
- * Number of tcache bins. There are NBINS small-object bins, plus 0 or more
- * large-object bins.
- */
-extern unsigned nhbins;
-
-/* Maximum cached size class. */
-extern size_t tcache_maxclass;
-
-/*
- * Explicit tcaches, managed via the tcache.{create,flush,destroy} mallctls and
- * usable via the MALLOCX_TCACHE() flag. The automatic per thread tcaches are
- * completely disjoint from this data structure. tcaches starts off as a sparse
- * array, so it has no physical memory footprint until individual pages are
- * touched. This allows the entire array to be allocated the first time an
- * explicit tcache is created without a disproportionate impact on memory usage.
- */
-extern tcaches_t *tcaches;
-
-size_t tcache_salloc(tsdn_t *tsdn, const void *ptr);
-void tcache_event_hard(tsd_t *tsd, tcache_t *tcache);
-void *tcache_alloc_small_hard(tsdn_t *tsdn, arena_t *arena, tcache_t *tcache,
- tcache_bin_t *tbin, szind_t binind, bool *tcache_success);
-void tcache_bin_flush_small(tsd_t *tsd, tcache_t *tcache, tcache_bin_t *tbin,
- szind_t binind, unsigned rem);
-void tcache_bin_flush_large(tsd_t *tsd, tcache_bin_t *tbin, szind_t binind,
- unsigned rem, tcache_t *tcache);
-void tcache_arena_reassociate(tsdn_t *tsdn, tcache_t *tcache,
- arena_t *oldarena, arena_t *newarena);
-tcache_t *tcache_get_hard(tsd_t *tsd);
-tcache_t *tcache_create(tsdn_t *tsdn, arena_t *arena);
-void tcache_cleanup(tsd_t *tsd);
-void tcache_enabled_cleanup(tsd_t *tsd);
-void tcache_stats_merge(tsdn_t *tsdn, tcache_t *tcache, arena_t *arena);
-bool tcaches_create(tsd_t *tsd, unsigned *r_ind);
-void tcaches_flush(tsd_t *tsd, unsigned ind);
-void tcaches_destroy(tsd_t *tsd, unsigned ind);
-bool tcache_boot(tsdn_t *tsdn);
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-#ifndef JEMALLOC_ENABLE_INLINE
-void tcache_event(tsd_t *tsd, tcache_t *tcache);
-void tcache_flush(void);
-bool tcache_enabled_get(void);
-tcache_t *tcache_get(tsd_t *tsd, bool create);
-void tcache_enabled_set(bool enabled);
-void *tcache_alloc_easy(tcache_bin_t *tbin, bool *tcache_success);
-void *tcache_alloc_small(tsd_t *tsd, arena_t *arena, tcache_t *tcache,
- size_t size, szind_t ind, bool zero, bool slow_path);
-void *tcache_alloc_large(tsd_t *tsd, arena_t *arena, tcache_t *tcache,
- size_t size, szind_t ind, bool zero, bool slow_path);
-void tcache_dalloc_small(tsd_t *tsd, tcache_t *tcache, void *ptr,
- szind_t binind, bool slow_path);
-void tcache_dalloc_large(tsd_t *tsd, tcache_t *tcache, void *ptr,
- size_t size, bool slow_path);
-tcache_t *tcaches_get(tsd_t *tsd, unsigned ind);
-#endif
-
-#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_TCACHE_C_))
-JEMALLOC_INLINE void
-tcache_flush(void)
-{
- tsd_t *tsd;
-
- cassert(config_tcache);
-
- tsd = tsd_fetch();
- tcache_cleanup(tsd);
-}
-
-JEMALLOC_INLINE bool
-tcache_enabled_get(void)
-{
- tsd_t *tsd;
- tcache_enabled_t tcache_enabled;
-
- cassert(config_tcache);
-
- tsd = tsd_fetch();
- tcache_enabled = tsd_tcache_enabled_get(tsd);
- if (tcache_enabled == tcache_enabled_default) {
- tcache_enabled = (tcache_enabled_t)opt_tcache;
- tsd_tcache_enabled_set(tsd, tcache_enabled);
- }
-
- return ((bool)tcache_enabled);
-}
-
-JEMALLOC_INLINE void
-tcache_enabled_set(bool enabled)
-{
- tsd_t *tsd;
- tcache_enabled_t tcache_enabled;
-
- cassert(config_tcache);
-
- tsd = tsd_fetch();
-
- tcache_enabled = (tcache_enabled_t)enabled;
- tsd_tcache_enabled_set(tsd, tcache_enabled);
-
- if (!enabled)
- tcache_cleanup(tsd);
-}
-
-JEMALLOC_ALWAYS_INLINE tcache_t *
-tcache_get(tsd_t *tsd, bool create)
-{
- tcache_t *tcache;
-
- if (!config_tcache)
- return (NULL);
-
- tcache = tsd_tcache_get(tsd);
- if (!create)
- return (tcache);
- if (unlikely(tcache == NULL) && tsd_nominal(tsd)) {
- tcache = tcache_get_hard(tsd);
- tsd_tcache_set(tsd, tcache);
- }
-
- return (tcache);
-}
-
-JEMALLOC_ALWAYS_INLINE void
-tcache_event(tsd_t *tsd, tcache_t *tcache)
-{
-
- if (TCACHE_GC_INCR == 0)
- return;
-
- if (unlikely(ticker_tick(&tcache->gc_ticker)))
- tcache_event_hard(tsd, tcache);
-}
-
-JEMALLOC_ALWAYS_INLINE void *
-tcache_alloc_easy(tcache_bin_t *tbin, bool *tcache_success)
-{
- void *ret;
-
- if (unlikely(tbin->ncached == 0)) {
- tbin->low_water = -1;
- *tcache_success = false;
- return (NULL);
- }
- /*
- * tcache_success (instead of ret) should be checked upon the return of
- * this function. We avoid checking (ret == NULL) because there is
- * never a null stored on the avail stack (which is unknown to the
- * compiler), and eagerly checking ret would cause pipeline stall
- * (waiting for the cacheline).
- */
- *tcache_success = true;
- ret = *(tbin->avail - tbin->ncached);
- tbin->ncached--;
-
- if (unlikely((int)tbin->ncached < tbin->low_water))
- tbin->low_water = tbin->ncached;
-
- return (ret);
-}
-
-JEMALLOC_ALWAYS_INLINE void *
-tcache_alloc_small(tsd_t *tsd, arena_t *arena, tcache_t *tcache, size_t size,
- szind_t binind, bool zero, bool slow_path)
-{
- void *ret;
- tcache_bin_t *tbin;
- bool tcache_success;
- size_t usize JEMALLOC_CC_SILENCE_INIT(0);
-
- assert(binind < NBINS);
- tbin = &tcache->tbins[binind];
- ret = tcache_alloc_easy(tbin, &tcache_success);
- assert(tcache_success == (ret != NULL));
- if (unlikely(!tcache_success)) {
- bool tcache_hard_success;
- arena = arena_choose(tsd, arena);
- if (unlikely(arena == NULL))
- return (NULL);
-
- ret = tcache_alloc_small_hard(tsd_tsdn(tsd), arena, tcache,
- tbin, binind, &tcache_hard_success);
- if (tcache_hard_success == false)
- return (NULL);
- }
-
- assert(ret);
- /*
- * Only compute usize if required. The checks in the following if
- * statement are all static.
- */
- if (config_prof || (slow_path && config_fill) || unlikely(zero)) {
- usize = index2size(binind);
- assert(tcache_salloc(tsd_tsdn(tsd), ret) == usize);
- }
-
- if (likely(!zero)) {
- if (slow_path && config_fill) {
- if (unlikely(opt_junk_alloc)) {
- arena_alloc_junk_small(ret,
- &arena_bin_info[binind], false);
- } else if (unlikely(opt_zero))
- memset(ret, 0, usize);
- }
- } else {
- if (slow_path && config_fill && unlikely(opt_junk_alloc)) {
- arena_alloc_junk_small(ret, &arena_bin_info[binind],
- true);
- }
- memset(ret, 0, usize);
- }
-
- if (config_stats)
- tbin->tstats.nrequests++;
- if (config_prof)
- tcache->prof_accumbytes += usize;
- tcache_event(tsd, tcache);
- return (ret);
-}
-
-JEMALLOC_ALWAYS_INLINE void *
-tcache_alloc_large(tsd_t *tsd, arena_t *arena, tcache_t *tcache, size_t size,
- szind_t binind, bool zero, bool slow_path)
-{
- void *ret;
- tcache_bin_t *tbin;
- bool tcache_success;
-
- assert(binind < nhbins);
- tbin = &tcache->tbins[binind];
- ret = tcache_alloc_easy(tbin, &tcache_success);
- assert(tcache_success == (ret != NULL));
- if (unlikely(!tcache_success)) {
- /*
- * Only allocate one large object at a time, because it's quite
- * expensive to create one and not use it.
- */
- arena = arena_choose(tsd, arena);
- if (unlikely(arena == NULL))
- return (NULL);
-
- ret = arena_malloc_large(tsd_tsdn(tsd), arena, binind, zero);
- if (ret == NULL)
- return (NULL);
- } else {
- size_t usize JEMALLOC_CC_SILENCE_INIT(0);
-
- /* Only compute usize on demand */
- if (config_prof || (slow_path && config_fill) ||
- unlikely(zero)) {
- usize = index2size(binind);
- assert(usize <= tcache_maxclass);
- }
-
- if (config_prof && usize == LARGE_MINCLASS) {
- arena_chunk_t *chunk =
- (arena_chunk_t *)CHUNK_ADDR2BASE(ret);
- size_t pageind = (((uintptr_t)ret - (uintptr_t)chunk) >>
- LG_PAGE);
- arena_mapbits_large_binind_set(chunk, pageind,
- BININD_INVALID);
- }
- if (likely(!zero)) {
- if (slow_path && config_fill) {
- if (unlikely(opt_junk_alloc)) {
- memset(ret, JEMALLOC_ALLOC_JUNK,
- usize);
- } else if (unlikely(opt_zero))
- memset(ret, 0, usize);
- }
- } else
- memset(ret, 0, usize);
-
- if (config_stats)
- tbin->tstats.nrequests++;
- if (config_prof)
- tcache->prof_accumbytes += usize;
- }
-
- tcache_event(tsd, tcache);
- return (ret);
-}
-
-JEMALLOC_ALWAYS_INLINE void
-tcache_dalloc_small(tsd_t *tsd, tcache_t *tcache, void *ptr, szind_t binind,
- bool slow_path)
-{
- tcache_bin_t *tbin;
- tcache_bin_info_t *tbin_info;
-
- assert(tcache_salloc(tsd_tsdn(tsd), ptr) <= SMALL_MAXCLASS);
-
- if (slow_path && config_fill && unlikely(opt_junk_free))
- arena_dalloc_junk_small(ptr, &arena_bin_info[binind]);
-
- tbin = &tcache->tbins[binind];
- tbin_info = &tcache_bin_info[binind];
- if (unlikely(tbin->ncached == tbin_info->ncached_max)) {
- tcache_bin_flush_small(tsd, tcache, tbin, binind,
- (tbin_info->ncached_max >> 1));
- }
- assert(tbin->ncached < tbin_info->ncached_max);
- tbin->ncached++;
- *(tbin->avail - tbin->ncached) = ptr;
-
- tcache_event(tsd, tcache);
-}
-
-JEMALLOC_ALWAYS_INLINE void
-tcache_dalloc_large(tsd_t *tsd, tcache_t *tcache, void *ptr, size_t size,
- bool slow_path)
-{
- szind_t binind;
- tcache_bin_t *tbin;
- tcache_bin_info_t *tbin_info;
-
- assert((size & PAGE_MASK) == 0);
- assert(tcache_salloc(tsd_tsdn(tsd), ptr) > SMALL_MAXCLASS);
- assert(tcache_salloc(tsd_tsdn(tsd), ptr) <= tcache_maxclass);
-
- binind = size2index(size);
-
- if (slow_path && config_fill && unlikely(opt_junk_free))
- arena_dalloc_junk_large(ptr, size);
-
- tbin = &tcache->tbins[binind];
- tbin_info = &tcache_bin_info[binind];
- if (unlikely(tbin->ncached == tbin_info->ncached_max)) {
- tcache_bin_flush_large(tsd, tbin, binind,
- (tbin_info->ncached_max >> 1), tcache);
- }
- assert(tbin->ncached < tbin_info->ncached_max);
- tbin->ncached++;
- *(tbin->avail - tbin->ncached) = ptr;
-
- tcache_event(tsd, tcache);
-}
-
-JEMALLOC_ALWAYS_INLINE tcache_t *
-tcaches_get(tsd_t *tsd, unsigned ind)
-{
- tcaches_t *elm = &tcaches[ind];
- if (unlikely(elm->tcache == NULL)) {
- elm->tcache = tcache_create(tsd_tsdn(tsd), arena_choose(tsd,
- NULL));
- }
- return (elm->tcache);
-}
-#endif
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
diff --git a/memory/jemalloc/src/include/jemalloc/internal/ticker.h b/memory/jemalloc/src/include/jemalloc/internal/ticker.h
deleted file mode 100644
index 4696e56d25..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/ticker.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-typedef struct ticker_s ticker_t;
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-struct ticker_s {
- int32_t tick;
- int32_t nticks;
-};
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-#ifndef JEMALLOC_ENABLE_INLINE
-void ticker_init(ticker_t *ticker, int32_t nticks);
-void ticker_copy(ticker_t *ticker, const ticker_t *other);
-int32_t ticker_read(const ticker_t *ticker);
-bool ticker_ticks(ticker_t *ticker, int32_t nticks);
-bool ticker_tick(ticker_t *ticker);
-#endif
-
-#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_TICKER_C_))
-JEMALLOC_INLINE void
-ticker_init(ticker_t *ticker, int32_t nticks)
-{
-
- ticker->tick = nticks;
- ticker->nticks = nticks;
-}
-
-JEMALLOC_INLINE void
-ticker_copy(ticker_t *ticker, const ticker_t *other)
-{
-
- *ticker = *other;
-}
-
-JEMALLOC_INLINE int32_t
-ticker_read(const ticker_t *ticker)
-{
-
- return (ticker->tick);
-}
-
-JEMALLOC_INLINE bool
-ticker_ticks(ticker_t *ticker, int32_t nticks)
-{
-
- if (unlikely(ticker->tick < nticks)) {
- ticker->tick = ticker->nticks;
- return (true);
- }
- ticker->tick -= nticks;
- return(false);
-}
-
-JEMALLOC_INLINE bool
-ticker_tick(ticker_t *ticker)
-{
-
- return (ticker_ticks(ticker, 1));
-}
-#endif
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
diff --git a/memory/jemalloc/src/include/jemalloc/internal/tsd.h b/memory/jemalloc/src/include/jemalloc/internal/tsd.h
deleted file mode 100644
index 9055acafd2..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/tsd.h
+++ /dev/null
@@ -1,787 +0,0 @@
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-/* Maximum number of malloc_tsd users with cleanup functions. */
-#define MALLOC_TSD_CLEANUPS_MAX 2
-
-typedef bool (*malloc_tsd_cleanup_t)(void);
-
-#if (!defined(JEMALLOC_MALLOC_THREAD_CLEANUP) && !defined(JEMALLOC_TLS) && \
- !defined(_WIN32))
-typedef struct tsd_init_block_s tsd_init_block_t;
-typedef struct tsd_init_head_s tsd_init_head_t;
-#endif
-
-typedef struct tsd_s tsd_t;
-typedef struct tsdn_s tsdn_t;
-
-#define TSDN_NULL ((tsdn_t *)0)
-
-typedef enum {
- tsd_state_uninitialized,
- tsd_state_nominal,
- tsd_state_purgatory,
- tsd_state_reincarnated
-} tsd_state_t;
-
-/*
- * TLS/TSD-agnostic macro-based implementation of thread-specific data. There
- * are five macros that support (at least) three use cases: file-private,
- * library-private, and library-private inlined. Following is an example
- * library-private tsd variable:
- *
- * In example.h:
- * typedef struct {
- * int x;
- * int y;
- * } example_t;
- * #define EX_INITIALIZER JEMALLOC_CONCAT({0, 0})
- * malloc_tsd_types(example_, example_t)
- * malloc_tsd_protos(, example_, example_t)
- * malloc_tsd_externs(example_, example_t)
- * In example.c:
- * malloc_tsd_data(, example_, example_t, EX_INITIALIZER)
- * malloc_tsd_funcs(, example_, example_t, EX_INITIALIZER,
- * example_tsd_cleanup)
- *
- * The result is a set of generated functions, e.g.:
- *
- * bool example_tsd_boot(void) {...}
- * bool example_tsd_booted_get(void) {...}
- * example_t *example_tsd_get(bool init) {...}
- * void example_tsd_set(example_t *val) {...}
- *
- * Note that all of the functions deal in terms of (a_type *) rather than
- * (a_type) so that it is possible to support non-pointer types (unlike
- * pthreads TSD). example_tsd_cleanup() is passed an (a_type *) pointer that is
- * cast to (void *). This means that the cleanup function needs to cast the
- * function argument to (a_type *), then dereference the resulting pointer to
- * access fields, e.g.
- *
- * void
- * example_tsd_cleanup(void *arg)
- * {
- * example_t *example = (example_t *)arg;
- *
- * example->x = 42;
- * [...]
- * if ([want the cleanup function to be called again])
- * example_tsd_set(example);
- * }
- *
- * If example_tsd_set() is called within example_tsd_cleanup(), it will be
- * called again. This is similar to how pthreads TSD destruction works, except
- * that pthreads only calls the cleanup function again if the value was set to
- * non-NULL.
- */
-
-/* malloc_tsd_types(). */
-#ifdef JEMALLOC_MALLOC_THREAD_CLEANUP
-#define malloc_tsd_types(a_name, a_type)
-#elif (defined(JEMALLOC_TLS))
-#define malloc_tsd_types(a_name, a_type)
-#elif (defined(_WIN32))
-#define malloc_tsd_types(a_name, a_type) \
-typedef struct { \
- bool initialized; \
- a_type val; \
-} a_name##tsd_wrapper_t;
-#else
-#define malloc_tsd_types(a_name, a_type) \
-typedef struct { \
- bool initialized; \
- a_type val; \
-} a_name##tsd_wrapper_t;
-#endif
-
-/* malloc_tsd_protos(). */
-#define malloc_tsd_protos(a_attr, a_name, a_type) \
-a_attr bool \
-a_name##tsd_boot0(void); \
-a_attr void \
-a_name##tsd_boot1(void); \
-a_attr bool \
-a_name##tsd_boot(void); \
-a_attr bool \
-a_name##tsd_booted_get(void); \
-a_attr a_type * \
-a_name##tsd_get(bool init); \
-a_attr void \
-a_name##tsd_set(a_type *val);
-
-/* malloc_tsd_externs(). */
-#ifdef JEMALLOC_MALLOC_THREAD_CLEANUP
-#define malloc_tsd_externs(a_name, a_type) \
-extern __thread a_type a_name##tsd_tls; \
-extern __thread bool a_name##tsd_initialized; \
-extern bool a_name##tsd_booted;
-#elif (defined(JEMALLOC_TLS))
-#define malloc_tsd_externs(a_name, a_type) \
-extern __thread a_type a_name##tsd_tls; \
-extern pthread_key_t a_name##tsd_tsd; \
-extern bool a_name##tsd_booted;
-#elif (defined(_WIN32))
-#define malloc_tsd_externs(a_name, a_type) \
-extern DWORD a_name##tsd_tsd; \
-extern a_name##tsd_wrapper_t a_name##tsd_boot_wrapper; \
-extern bool a_name##tsd_booted;
-#else
-#define malloc_tsd_externs(a_name, a_type) \
-extern pthread_key_t a_name##tsd_tsd; \
-extern tsd_init_head_t a_name##tsd_init_head; \
-extern a_name##tsd_wrapper_t a_name##tsd_boot_wrapper; \
-extern bool a_name##tsd_booted;
-#endif
-
-/* malloc_tsd_data(). */
-#ifdef JEMALLOC_MALLOC_THREAD_CLEANUP
-#define malloc_tsd_data(a_attr, a_name, a_type, a_initializer) \
-a_attr __thread a_type JEMALLOC_TLS_MODEL \
- a_name##tsd_tls = a_initializer; \
-a_attr __thread bool JEMALLOC_TLS_MODEL \
- a_name##tsd_initialized = false; \
-a_attr bool a_name##tsd_booted = false;
-#elif (defined(JEMALLOC_TLS))
-#define malloc_tsd_data(a_attr, a_name, a_type, a_initializer) \
-a_attr __thread a_type JEMALLOC_TLS_MODEL \
- a_name##tsd_tls = a_initializer; \
-a_attr pthread_key_t a_name##tsd_tsd; \
-a_attr bool a_name##tsd_booted = false;
-#elif (defined(_WIN32))
-#define malloc_tsd_data(a_attr, a_name, a_type, a_initializer) \
-a_attr DWORD a_name##tsd_tsd; \
-a_attr a_name##tsd_wrapper_t a_name##tsd_boot_wrapper = { \
- false, \
- a_initializer \
-}; \
-a_attr bool a_name##tsd_booted = false;
-#else
-#define malloc_tsd_data(a_attr, a_name, a_type, a_initializer) \
-a_attr pthread_key_t a_name##tsd_tsd; \
-a_attr tsd_init_head_t a_name##tsd_init_head = { \
- ql_head_initializer(blocks), \
- MALLOC_MUTEX_INITIALIZER \
-}; \
-a_attr a_name##tsd_wrapper_t a_name##tsd_boot_wrapper = { \
- false, \
- a_initializer \
-}; \
-a_attr bool a_name##tsd_booted = false;
-#endif
-
-/* malloc_tsd_funcs(). */
-#ifdef JEMALLOC_MALLOC_THREAD_CLEANUP
-#define malloc_tsd_funcs(a_attr, a_name, a_type, a_initializer, \
- a_cleanup) \
-/* Initialization/cleanup. */ \
-a_attr bool \
-a_name##tsd_cleanup_wrapper(void) \
-{ \
- \
- if (a_name##tsd_initialized) { \
- a_name##tsd_initialized = false; \
- a_cleanup(&a_name##tsd_tls); \
- } \
- return (a_name##tsd_initialized); \
-} \
-a_attr bool \
-a_name##tsd_boot0(void) \
-{ \
- \
- if (a_cleanup != malloc_tsd_no_cleanup) { \
- malloc_tsd_cleanup_register( \
- &a_name##tsd_cleanup_wrapper); \
- } \
- a_name##tsd_booted = true; \
- return (false); \
-} \
-a_attr void \
-a_name##tsd_boot1(void) \
-{ \
- \
- /* Do nothing. */ \
-} \
-a_attr bool \
-a_name##tsd_boot(void) \
-{ \
- \
- return (a_name##tsd_boot0()); \
-} \
-a_attr bool \
-a_name##tsd_booted_get(void) \
-{ \
- \
- return (a_name##tsd_booted); \
-} \
-a_attr bool \
-a_name##tsd_get_allocates(void) \
-{ \
- \
- return (false); \
-} \
-/* Get/set. */ \
-a_attr a_type * \
-a_name##tsd_get(bool init) \
-{ \
- \
- assert(a_name##tsd_booted); \
- return (&a_name##tsd_tls); \
-} \
-a_attr void \
-a_name##tsd_set(a_type *val) \
-{ \
- \
- assert(a_name##tsd_booted); \
- a_name##tsd_tls = (*val); \
- if (a_cleanup != malloc_tsd_no_cleanup) \
- a_name##tsd_initialized = true; \
-}
-#elif (defined(JEMALLOC_TLS))
-#define malloc_tsd_funcs(a_attr, a_name, a_type, a_initializer, \
- a_cleanup) \
-/* Initialization/cleanup. */ \
-a_attr bool \
-a_name##tsd_boot0(void) \
-{ \
- \
- if (a_cleanup != malloc_tsd_no_cleanup) { \
- if (pthread_key_create(&a_name##tsd_tsd, a_cleanup) != \
- 0) \
- return (true); \
- } \
- a_name##tsd_booted = true; \
- return (false); \
-} \
-a_attr void \
-a_name##tsd_boot1(void) \
-{ \
- \
- /* Do nothing. */ \
-} \
-a_attr bool \
-a_name##tsd_boot(void) \
-{ \
- \
- return (a_name##tsd_boot0()); \
-} \
-a_attr bool \
-a_name##tsd_booted_get(void) \
-{ \
- \
- return (a_name##tsd_booted); \
-} \
-a_attr bool \
-a_name##tsd_get_allocates(void) \
-{ \
- \
- return (false); \
-} \
-/* Get/set. */ \
-a_attr a_type * \
-a_name##tsd_get(bool init) \
-{ \
- \
- assert(a_name##tsd_booted); \
- return (&a_name##tsd_tls); \
-} \
-a_attr void \
-a_name##tsd_set(a_type *val) \
-{ \
- \
- assert(a_name##tsd_booted); \
- a_name##tsd_tls = (*val); \
- if (a_cleanup != malloc_tsd_no_cleanup) { \
- if (pthread_setspecific(a_name##tsd_tsd, \
- (void *)(&a_name##tsd_tls))) { \
- malloc_write("<jemalloc>: Error" \
- " setting TSD for "#a_name"\n"); \
- if (opt_abort) \
- abort(); \
- } \
- } \
-}
-#elif (defined(_WIN32))
-#define malloc_tsd_funcs(a_attr, a_name, a_type, a_initializer, \
- a_cleanup) \
-/* Initialization/cleanup. */ \
-a_attr bool \
-a_name##tsd_cleanup_wrapper(void) \
-{ \
- DWORD error = GetLastError(); \
- a_name##tsd_wrapper_t *wrapper = (a_name##tsd_wrapper_t *) \
- TlsGetValue(a_name##tsd_tsd); \
- SetLastError(error); \
- \
- if (wrapper == NULL) \
- return (false); \
- if (a_cleanup != malloc_tsd_no_cleanup && \
- wrapper->initialized) { \
- wrapper->initialized = false; \
- a_cleanup(&wrapper->val); \
- if (wrapper->initialized) { \
- /* Trigger another cleanup round. */ \
- return (true); \
- } \
- } \
- malloc_tsd_dalloc(wrapper); \
- return (false); \
-} \
-a_attr void \
-a_name##tsd_wrapper_set(a_name##tsd_wrapper_t *wrapper) \
-{ \
- \
- if (!TlsSetValue(a_name##tsd_tsd, (void *)wrapper)) { \
- malloc_write("<jemalloc>: Error setting" \
- " TSD for "#a_name"\n"); \
- abort(); \
- } \
-} \
-a_attr a_name##tsd_wrapper_t * \
-a_name##tsd_wrapper_get(bool init) \
-{ \
- DWORD error = GetLastError(); \
- a_name##tsd_wrapper_t *wrapper = (a_name##tsd_wrapper_t *) \
- TlsGetValue(a_name##tsd_tsd); \
- SetLastError(error); \
- \
- if (init && unlikely(wrapper == NULL)) { \
- wrapper = (a_name##tsd_wrapper_t *) \
- malloc_tsd_malloc(sizeof(a_name##tsd_wrapper_t)); \
- if (wrapper == NULL) { \
- malloc_write("<jemalloc>: Error allocating" \
- " TSD for "#a_name"\n"); \
- abort(); \
- } else { \
- wrapper->initialized = false; \
- wrapper->val = a_initializer; \
- } \
- a_name##tsd_wrapper_set(wrapper); \
- } \
- return (wrapper); \
-} \
-a_attr bool \
-a_name##tsd_boot0(void) \
-{ \
- \
- a_name##tsd_tsd = TlsAlloc(); \
- if (a_name##tsd_tsd == TLS_OUT_OF_INDEXES) \
- return (true); \
- if (a_cleanup != malloc_tsd_no_cleanup) { \
- malloc_tsd_cleanup_register( \
- &a_name##tsd_cleanup_wrapper); \
- } \
- a_name##tsd_wrapper_set(&a_name##tsd_boot_wrapper); \
- a_name##tsd_booted = true; \
- return (false); \
-} \
-a_attr void \
-a_name##tsd_boot1(void) \
-{ \
- a_name##tsd_wrapper_t *wrapper; \
- wrapper = (a_name##tsd_wrapper_t *) \
- malloc_tsd_malloc(sizeof(a_name##tsd_wrapper_t)); \
- if (wrapper == NULL) { \
- malloc_write("<jemalloc>: Error allocating" \
- " TSD for "#a_name"\n"); \
- abort(); \
- } \
- memcpy(wrapper, &a_name##tsd_boot_wrapper, \
- sizeof(a_name##tsd_wrapper_t)); \
- a_name##tsd_wrapper_set(wrapper); \
-} \
-a_attr bool \
-a_name##tsd_boot(void) \
-{ \
- \
- if (a_name##tsd_boot0()) \
- return (true); \
- a_name##tsd_boot1(); \
- return (false); \
-} \
-a_attr bool \
-a_name##tsd_booted_get(void) \
-{ \
- \
- return (a_name##tsd_booted); \
-} \
-a_attr bool \
-a_name##tsd_get_allocates(void) \
-{ \
- \
- return (true); \
-} \
-/* Get/set. */ \
-a_attr a_type * \
-a_name##tsd_get(bool init) \
-{ \
- a_name##tsd_wrapper_t *wrapper; \
- \
- assert(a_name##tsd_booted); \
- wrapper = a_name##tsd_wrapper_get(init); \
- if (a_name##tsd_get_allocates() && !init && wrapper == NULL) \
- return (NULL); \
- return (&wrapper->val); \
-} \
-a_attr void \
-a_name##tsd_set(a_type *val) \
-{ \
- a_name##tsd_wrapper_t *wrapper; \
- \
- assert(a_name##tsd_booted); \
- wrapper = a_name##tsd_wrapper_get(true); \
- wrapper->val = *(val); \
- if (a_cleanup != malloc_tsd_no_cleanup) \
- wrapper->initialized = true; \
-}
-#else
-#define malloc_tsd_funcs(a_attr, a_name, a_type, a_initializer, \
- a_cleanup) \
-/* Initialization/cleanup. */ \
-a_attr void \
-a_name##tsd_cleanup_wrapper(void *arg) \
-{ \
- a_name##tsd_wrapper_t *wrapper = (a_name##tsd_wrapper_t *)arg; \
- \
- if (a_cleanup != malloc_tsd_no_cleanup && \
- wrapper->initialized) { \
- wrapper->initialized = false; \
- a_cleanup(&wrapper->val); \
- if (wrapper->initialized) { \
- /* Trigger another cleanup round. */ \
- if (pthread_setspecific(a_name##tsd_tsd, \
- (void *)wrapper)) { \
- malloc_write("<jemalloc>: Error" \
- " setting TSD for "#a_name"\n"); \
- if (opt_abort) \
- abort(); \
- } \
- return; \
- } \
- } \
- malloc_tsd_dalloc(wrapper); \
-} \
-a_attr void \
-a_name##tsd_wrapper_set(a_name##tsd_wrapper_t *wrapper) \
-{ \
- \
- if (pthread_setspecific(a_name##tsd_tsd, \
- (void *)wrapper)) { \
- malloc_write("<jemalloc>: Error setting" \
- " TSD for "#a_name"\n"); \
- abort(); \
- } \
-} \
-a_attr a_name##tsd_wrapper_t * \
-a_name##tsd_wrapper_get(bool init) \
-{ \
- a_name##tsd_wrapper_t *wrapper = (a_name##tsd_wrapper_t *) \
- pthread_getspecific(a_name##tsd_tsd); \
- \
- if (init && unlikely(wrapper == NULL)) { \
- tsd_init_block_t block; \
- wrapper = tsd_init_check_recursion( \
- &a_name##tsd_init_head, &block); \
- if (wrapper) \
- return (wrapper); \
- wrapper = (a_name##tsd_wrapper_t *) \
- malloc_tsd_malloc(sizeof(a_name##tsd_wrapper_t)); \
- block.data = wrapper; \
- if (wrapper == NULL) { \
- malloc_write("<jemalloc>: Error allocating" \
- " TSD for "#a_name"\n"); \
- abort(); \
- } else { \
- wrapper->initialized = false; \
- wrapper->val = a_initializer; \
- } \
- a_name##tsd_wrapper_set(wrapper); \
- tsd_init_finish(&a_name##tsd_init_head, &block); \
- } \
- return (wrapper); \
-} \
-a_attr bool \
-a_name##tsd_boot0(void) \
-{ \
- \
- if (pthread_key_create(&a_name##tsd_tsd, \
- a_name##tsd_cleanup_wrapper) != 0) \
- return (true); \
- a_name##tsd_wrapper_set(&a_name##tsd_boot_wrapper); \
- a_name##tsd_booted = true; \
- return (false); \
-} \
-a_attr void \
-a_name##tsd_boot1(void) \
-{ \
- a_name##tsd_wrapper_t *wrapper; \
- wrapper = (a_name##tsd_wrapper_t *) \
- malloc_tsd_malloc(sizeof(a_name##tsd_wrapper_t)); \
- if (wrapper == NULL) { \
- malloc_write("<jemalloc>: Error allocating" \
- " TSD for "#a_name"\n"); \
- abort(); \
- } \
- memcpy(wrapper, &a_name##tsd_boot_wrapper, \
- sizeof(a_name##tsd_wrapper_t)); \
- a_name##tsd_wrapper_set(wrapper); \
-} \
-a_attr bool \
-a_name##tsd_boot(void) \
-{ \
- \
- if (a_name##tsd_boot0()) \
- return (true); \
- a_name##tsd_boot1(); \
- return (false); \
-} \
-a_attr bool \
-a_name##tsd_booted_get(void) \
-{ \
- \
- return (a_name##tsd_booted); \
-} \
-a_attr bool \
-a_name##tsd_get_allocates(void) \
-{ \
- \
- return (true); \
-} \
-/* Get/set. */ \
-a_attr a_type * \
-a_name##tsd_get(bool init) \
-{ \
- a_name##tsd_wrapper_t *wrapper; \
- \
- assert(a_name##tsd_booted); \
- wrapper = a_name##tsd_wrapper_get(init); \
- if (a_name##tsd_get_allocates() && !init && wrapper == NULL) \
- return (NULL); \
- return (&wrapper->val); \
-} \
-a_attr void \
-a_name##tsd_set(a_type *val) \
-{ \
- a_name##tsd_wrapper_t *wrapper; \
- \
- assert(a_name##tsd_booted); \
- wrapper = a_name##tsd_wrapper_get(true); \
- wrapper->val = *(val); \
- if (a_cleanup != malloc_tsd_no_cleanup) \
- wrapper->initialized = true; \
-}
-#endif
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-#if (!defined(JEMALLOC_MALLOC_THREAD_CLEANUP) && !defined(JEMALLOC_TLS) && \
- !defined(_WIN32))
-struct tsd_init_block_s {
- ql_elm(tsd_init_block_t) link;
- pthread_t thread;
- void *data;
-};
-struct tsd_init_head_s {
- ql_head(tsd_init_block_t) blocks;
- malloc_mutex_t lock;
-};
-#endif
-
-#define MALLOC_TSD \
-/* O(name, type) */ \
- O(tcache, tcache_t *) \
- O(thread_allocated, uint64_t) \
- O(thread_deallocated, uint64_t) \
- O(prof_tdata, prof_tdata_t *) \
- O(iarena, arena_t *) \
- O(arena, arena_t *) \
- O(arenas_tdata, arena_tdata_t *) \
- O(narenas_tdata, unsigned) \
- O(arenas_tdata_bypass, bool) \
- O(tcache_enabled, tcache_enabled_t) \
- O(quarantine, quarantine_t *) \
- O(witnesses, witness_list_t) \
- O(witness_fork, bool) \
-
-#define TSD_INITIALIZER { \
- tsd_state_uninitialized, \
- NULL, \
- 0, \
- 0, \
- NULL, \
- NULL, \
- NULL, \
- NULL, \
- 0, \
- false, \
- tcache_enabled_default, \
- NULL, \
- ql_head_initializer(witnesses), \
- false \
-}
-
-struct tsd_s {
- tsd_state_t state;
-#define O(n, t) \
- t n;
-MALLOC_TSD
-#undef O
-};
-
-/*
- * Wrapper around tsd_t that makes it possible to avoid implicit conversion
- * between tsd_t and tsdn_t, where tsdn_t is "nullable" and has to be
- * explicitly converted to tsd_t, which is non-nullable.
- */
-struct tsdn_s {
- tsd_t tsd;
-};
-
-static const tsd_t tsd_initializer = TSD_INITIALIZER;
-
-malloc_tsd_types(, tsd_t)
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-void *malloc_tsd_malloc(size_t size);
-void malloc_tsd_dalloc(void *wrapper);
-void malloc_tsd_no_cleanup(void *arg);
-void malloc_tsd_cleanup_register(bool (*f)(void));
-tsd_t *malloc_tsd_boot0(void);
-void malloc_tsd_boot1(void);
-#if (!defined(JEMALLOC_MALLOC_THREAD_CLEANUP) && !defined(JEMALLOC_TLS) && \
- !defined(_WIN32))
-void *tsd_init_check_recursion(tsd_init_head_t *head,
- tsd_init_block_t *block);
-void tsd_init_finish(tsd_init_head_t *head, tsd_init_block_t *block);
-#endif
-void tsd_cleanup(void *arg);
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-#ifndef JEMALLOC_ENABLE_INLINE
-malloc_tsd_protos(JEMALLOC_ATTR(unused), , tsd_t)
-
-tsd_t *tsd_fetch_impl(bool init);
-tsd_t *tsd_fetch(void);
-tsdn_t *tsd_tsdn(tsd_t *tsd);
-bool tsd_nominal(tsd_t *tsd);
-#define O(n, t) \
-t *tsd_##n##p_get(tsd_t *tsd); \
-t tsd_##n##_get(tsd_t *tsd); \
-void tsd_##n##_set(tsd_t *tsd, t n);
-MALLOC_TSD
-#undef O
-tsdn_t *tsdn_fetch(void);
-bool tsdn_null(const tsdn_t *tsdn);
-tsd_t *tsdn_tsd(tsdn_t *tsdn);
-#endif
-
-#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_TSD_C_))
-malloc_tsd_externs(, tsd_t)
-malloc_tsd_funcs(JEMALLOC_ALWAYS_INLINE, , tsd_t, tsd_initializer, tsd_cleanup)
-
-JEMALLOC_ALWAYS_INLINE tsd_t *
-tsd_fetch_impl(bool init)
-{
- tsd_t *tsd = tsd_get(init);
-
- if (!init && tsd_get_allocates() && tsd == NULL)
- return (NULL);
- assert(tsd != NULL);
-
- if (unlikely(tsd->state != tsd_state_nominal)) {
- if (tsd->state == tsd_state_uninitialized) {
- tsd->state = tsd_state_nominal;
- /* Trigger cleanup handler registration. */
- tsd_set(tsd);
- } else if (tsd->state == tsd_state_purgatory) {
- tsd->state = tsd_state_reincarnated;
- tsd_set(tsd);
- } else
- assert(tsd->state == tsd_state_reincarnated);
- }
-
- return (tsd);
-}
-
-JEMALLOC_ALWAYS_INLINE tsd_t *
-tsd_fetch(void)
-{
-
- return (tsd_fetch_impl(true));
-}
-
-JEMALLOC_ALWAYS_INLINE tsdn_t *
-tsd_tsdn(tsd_t *tsd)
-{
-
- return ((tsdn_t *)tsd);
-}
-
-JEMALLOC_INLINE bool
-tsd_nominal(tsd_t *tsd)
-{
-
- return (tsd->state == tsd_state_nominal);
-}
-
-#define O(n, t) \
-JEMALLOC_ALWAYS_INLINE t * \
-tsd_##n##p_get(tsd_t *tsd) \
-{ \
- \
- return (&tsd->n); \
-} \
- \
-JEMALLOC_ALWAYS_INLINE t \
-tsd_##n##_get(tsd_t *tsd) \
-{ \
- \
- return (*tsd_##n##p_get(tsd)); \
-} \
- \
-JEMALLOC_ALWAYS_INLINE void \
-tsd_##n##_set(tsd_t *tsd, t n) \
-{ \
- \
- assert(tsd->state == tsd_state_nominal); \
- tsd->n = n; \
-}
-MALLOC_TSD
-#undef O
-
-JEMALLOC_ALWAYS_INLINE tsdn_t *
-tsdn_fetch(void)
-{
-
- if (!tsd_booted_get())
- return (NULL);
-
- return (tsd_tsdn(tsd_fetch_impl(false)));
-}
-
-JEMALLOC_ALWAYS_INLINE bool
-tsdn_null(const tsdn_t *tsdn)
-{
-
- return (tsdn == NULL);
-}
-
-JEMALLOC_ALWAYS_INLINE tsd_t *
-tsdn_tsd(tsdn_t *tsdn)
-{
-
- assert(!tsdn_null(tsdn));
-
- return (&tsdn->tsd);
-}
-#endif
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
diff --git a/memory/jemalloc/src/include/jemalloc/internal/util.h b/memory/jemalloc/src/include/jemalloc/internal/util.h
deleted file mode 100644
index aee00d6d9a..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/util.h
+++ /dev/null
@@ -1,338 +0,0 @@
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-#ifdef _WIN32
-# ifdef _WIN64
-# define FMT64_PREFIX "ll"
-# define FMTPTR_PREFIX "ll"
-# else
-# define FMT64_PREFIX "ll"
-# define FMTPTR_PREFIX ""
-# endif
-# define FMTd32 "d"
-# define FMTu32 "u"
-# define FMTx32 "x"
-# define FMTd64 FMT64_PREFIX "d"
-# define FMTu64 FMT64_PREFIX "u"
-# define FMTx64 FMT64_PREFIX "x"
-# define FMTdPTR FMTPTR_PREFIX "d"
-# define FMTuPTR FMTPTR_PREFIX "u"
-# define FMTxPTR FMTPTR_PREFIX "x"
-#else
-# include <inttypes.h>
-# define FMTd32 PRId32
-# define FMTu32 PRIu32
-# define FMTx32 PRIx32
-# define FMTd64 PRId64
-# define FMTu64 PRIu64
-# define FMTx64 PRIx64
-# define FMTdPTR PRIdPTR
-# define FMTuPTR PRIuPTR
-# define FMTxPTR PRIxPTR
-#endif
-
-/* Size of stack-allocated buffer passed to buferror(). */
-#define BUFERROR_BUF 64
-
-/*
- * Size of stack-allocated buffer used by malloc_{,v,vc}printf(). This must be
- * large enough for all possible uses within jemalloc.
- */
-#define MALLOC_PRINTF_BUFSIZE 4096
-
-/* Junk fill patterns. */
-#define JEMALLOC_ALLOC_JUNK ((uint8_t)0xa5)
-#define JEMALLOC_FREE_JUNK ((uint8_t)0x5a)
-
-/*
- * Wrap a cpp argument that contains commas such that it isn't broken up into
- * multiple arguments.
- */
-#define JEMALLOC_ARG_CONCAT(...) __VA_ARGS__
-
-/*
- * Silence compiler warnings due to uninitialized values. This is used
- * wherever the compiler fails to recognize that the variable is never used
- * uninitialized.
- */
-#ifdef JEMALLOC_CC_SILENCE
-# define JEMALLOC_CC_SILENCE_INIT(v) = v
-#else
-# define JEMALLOC_CC_SILENCE_INIT(v)
-#endif
-
-#ifdef __GNUC__
-# define likely(x) __builtin_expect(!!(x), 1)
-# define unlikely(x) __builtin_expect(!!(x), 0)
-#else
-# define likely(x) !!(x)
-# define unlikely(x) !!(x)
-#endif
-
-#if !defined(JEMALLOC_INTERNAL_UNREACHABLE)
-# error JEMALLOC_INTERNAL_UNREACHABLE should have been defined by configure
-#endif
-
-#define unreachable() JEMALLOC_INTERNAL_UNREACHABLE()
-
-#include "jemalloc/internal/assert.h"
-
-/* Use to assert a particular configuration, e.g., cassert(config_debug). */
-#define cassert(c) do { \
- if (unlikely(!(c))) \
- not_reached(); \
-} while (0)
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-int buferror(int err, char *buf, size_t buflen);
-uintmax_t malloc_strtoumax(const char *restrict nptr,
- char **restrict endptr, int base);
-void malloc_write(const char *s);
-
-/*
- * malloc_vsnprintf() supports a subset of snprintf(3) that avoids floating
- * point math.
- */
-size_t malloc_vsnprintf(char *str, size_t size, const char *format,
- va_list ap);
-size_t malloc_snprintf(char *str, size_t size, const char *format, ...)
- JEMALLOC_FORMAT_PRINTF(3, 4);
-void malloc_vcprintf(void (*write_cb)(void *, const char *), void *cbopaque,
- const char *format, va_list ap);
-void malloc_cprintf(void (*write)(void *, const char *), void *cbopaque,
- const char *format, ...) JEMALLOC_FORMAT_PRINTF(3, 4);
-void malloc_printf(const char *format, ...) JEMALLOC_FORMAT_PRINTF(1, 2);
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-#ifndef JEMALLOC_ENABLE_INLINE
-unsigned ffs_llu(unsigned long long bitmap);
-unsigned ffs_lu(unsigned long bitmap);
-unsigned ffs_u(unsigned bitmap);
-unsigned ffs_zu(size_t bitmap);
-unsigned ffs_u64(uint64_t bitmap);
-unsigned ffs_u32(uint32_t bitmap);
-uint64_t pow2_ceil_u64(uint64_t x);
-uint32_t pow2_ceil_u32(uint32_t x);
-size_t pow2_ceil_zu(size_t x);
-unsigned lg_floor(size_t x);
-void set_errno(int errnum);
-int get_errno(void);
-#endif
-
-#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_UTIL_C_))
-
-/* Sanity check. */
-#if !defined(JEMALLOC_INTERNAL_FFSLL) || !defined(JEMALLOC_INTERNAL_FFSL) \
- || !defined(JEMALLOC_INTERNAL_FFS)
-# error JEMALLOC_INTERNAL_FFS{,L,LL} should have been defined by configure
-#endif
-
-JEMALLOC_ALWAYS_INLINE unsigned
-ffs_llu(unsigned long long bitmap)
-{
-
- return (JEMALLOC_INTERNAL_FFSLL(bitmap));
-}
-
-JEMALLOC_ALWAYS_INLINE unsigned
-ffs_lu(unsigned long bitmap)
-{
-
- return (JEMALLOC_INTERNAL_FFSL(bitmap));
-}
-
-JEMALLOC_ALWAYS_INLINE unsigned
-ffs_u(unsigned bitmap)
-{
-
- return (JEMALLOC_INTERNAL_FFS(bitmap));
-}
-
-JEMALLOC_ALWAYS_INLINE unsigned
-ffs_zu(size_t bitmap)
-{
-
-#if LG_SIZEOF_PTR == LG_SIZEOF_INT
- return (ffs_u(bitmap));
-#elif LG_SIZEOF_PTR == LG_SIZEOF_LONG
- return (ffs_lu(bitmap));
-#elif LG_SIZEOF_PTR == LG_SIZEOF_LONG_LONG
- return (ffs_llu(bitmap));
-#else
-#error No implementation for size_t ffs()
-#endif
-}
-
-JEMALLOC_ALWAYS_INLINE unsigned
-ffs_u64(uint64_t bitmap)
-{
-
-#if LG_SIZEOF_LONG == 3
- return (ffs_lu(bitmap));
-#elif LG_SIZEOF_LONG_LONG == 3
- return (ffs_llu(bitmap));
-#else
-#error No implementation for 64-bit ffs()
-#endif
-}
-
-JEMALLOC_ALWAYS_INLINE unsigned
-ffs_u32(uint32_t bitmap)
-{
-
-#if LG_SIZEOF_INT == 2
- return (ffs_u(bitmap));
-#else
-#error No implementation for 32-bit ffs()
-#endif
- return (ffs_u(bitmap));
-}
-
-JEMALLOC_INLINE uint64_t
-pow2_ceil_u64(uint64_t x)
-{
-
- x--;
- x |= x >> 1;
- x |= x >> 2;
- x |= x >> 4;
- x |= x >> 8;
- x |= x >> 16;
- x |= x >> 32;
- x++;
- return (x);
-}
-
-JEMALLOC_INLINE uint32_t
-pow2_ceil_u32(uint32_t x)
-{
-
- x--;
- x |= x >> 1;
- x |= x >> 2;
- x |= x >> 4;
- x |= x >> 8;
- x |= x >> 16;
- x++;
- return (x);
-}
-
-/* Compute the smallest power of 2 that is >= x. */
-JEMALLOC_INLINE size_t
-pow2_ceil_zu(size_t x)
-{
-
-#if (LG_SIZEOF_PTR == 3)
- return (pow2_ceil_u64(x));
-#else
- return (pow2_ceil_u32(x));
-#endif
-}
-
-#if (defined(__i386__) || defined(__amd64__) || defined(__x86_64__))
-JEMALLOC_INLINE unsigned
-lg_floor(size_t x)
-{
- size_t ret;
-
- assert(x != 0);
-
- asm ("bsr %1, %0"
- : "=r"(ret) // Outputs.
- : "r"(x) // Inputs.
- );
- assert(ret < UINT_MAX);
- return ((unsigned)ret);
-}
-#elif (defined(_MSC_VER))
-JEMALLOC_INLINE unsigned
-lg_floor(size_t x)
-{
- unsigned long ret;
-
- assert(x != 0);
-
-#if (LG_SIZEOF_PTR == 3)
- _BitScanReverse64(&ret, x);
-#elif (LG_SIZEOF_PTR == 2)
- _BitScanReverse(&ret, x);
-#else
-# error "Unsupported type size for lg_floor()"
-#endif
- assert(ret < UINT_MAX);
- return ((unsigned)ret);
-}
-#elif (defined(JEMALLOC_HAVE_BUILTIN_CLZ))
-JEMALLOC_INLINE unsigned
-lg_floor(size_t x)
-{
-
- assert(x != 0);
-
-#if (LG_SIZEOF_PTR == LG_SIZEOF_INT)
- return (((8 << LG_SIZEOF_PTR) - 1) - __builtin_clz(x));
-#elif (LG_SIZEOF_PTR == LG_SIZEOF_LONG)
- return (((8 << LG_SIZEOF_PTR) - 1) - __builtin_clzl(x));
-#else
-# error "Unsupported type size for lg_floor()"
-#endif
-}
-#else
-JEMALLOC_INLINE unsigned
-lg_floor(size_t x)
-{
-
- assert(x != 0);
-
- x |= (x >> 1);
- x |= (x >> 2);
- x |= (x >> 4);
- x |= (x >> 8);
- x |= (x >> 16);
-#if (LG_SIZEOF_PTR == 3)
- x |= (x >> 32);
-#endif
- if (x == SIZE_T_MAX)
- return ((8 << LG_SIZEOF_PTR) - 1);
- x++;
- return (ffs_zu(x) - 2);
-}
-#endif
-
-/* Set error code. */
-JEMALLOC_INLINE void
-set_errno(int errnum)
-{
-
-#ifdef _WIN32
- SetLastError(errnum);
-#else
- errno = errnum;
-#endif
-}
-
-/* Get last error code. */
-JEMALLOC_INLINE int
-get_errno(void)
-{
-
-#ifdef _WIN32
- return (GetLastError());
-#else
- return (errno);
-#endif
-}
-#endif
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
diff --git a/memory/jemalloc/src/include/jemalloc/internal/valgrind.h b/memory/jemalloc/src/include/jemalloc/internal/valgrind.h
deleted file mode 100644
index 1a8680828a..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/valgrind.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-#ifdef JEMALLOC_VALGRIND
-#include <valgrind/valgrind.h>
-
-/*
- * The size that is reported to Valgrind must be consistent through a chain of
- * malloc..realloc..realloc calls. Request size isn't recorded anywhere in
- * jemalloc, so it is critical that all callers of these macros provide usize
- * rather than request size. As a result, buffer overflow detection is
- * technically weakened for the standard API, though it is generally accepted
- * practice to consider any extra bytes reported by malloc_usable_size() as
- * usable space.
- */
-#define JEMALLOC_VALGRIND_MAKE_MEM_NOACCESS(ptr, usize) do { \
- if (unlikely(in_valgrind)) \
- valgrind_make_mem_noaccess(ptr, usize); \
-} while (0)
-#define JEMALLOC_VALGRIND_MAKE_MEM_UNDEFINED(ptr, usize) do { \
- if (unlikely(in_valgrind)) \
- valgrind_make_mem_undefined(ptr, usize); \
-} while (0)
-#define JEMALLOC_VALGRIND_MAKE_MEM_DEFINED(ptr, usize) do { \
- if (unlikely(in_valgrind)) \
- valgrind_make_mem_defined(ptr, usize); \
-} while (0)
-/*
- * The VALGRIND_MALLOCLIKE_BLOCK() and VALGRIND_RESIZEINPLACE_BLOCK() macro
- * calls must be embedded in macros rather than in functions so that when
- * Valgrind reports errors, there are no extra stack frames in the backtraces.
- */
-#define JEMALLOC_VALGRIND_MALLOC(cond, tsdn, ptr, usize, zero) do { \
- if (unlikely(in_valgrind && cond)) { \
- VALGRIND_MALLOCLIKE_BLOCK(ptr, usize, p2rz(tsdn, ptr), \
- zero); \
- } \
-} while (0)
-#define JEMALLOC_VALGRIND_REALLOC(maybe_moved, tsdn, ptr, usize, \
- ptr_maybe_null, old_ptr, old_usize, old_rzsize, old_ptr_maybe_null, \
- zero) do { \
- if (unlikely(in_valgrind)) { \
- size_t rzsize = p2rz(tsdn, ptr); \
- \
- if (!maybe_moved || ptr == old_ptr) { \
- VALGRIND_RESIZEINPLACE_BLOCK(ptr, old_usize, \
- usize, rzsize); \
- if (zero && old_usize < usize) { \
- valgrind_make_mem_defined( \
- (void *)((uintptr_t)ptr + \
- old_usize), usize - old_usize); \
- } \
- } else { \
- if (!old_ptr_maybe_null || old_ptr != NULL) { \
- valgrind_freelike_block(old_ptr, \
- old_rzsize); \
- } \
- if (!ptr_maybe_null || ptr != NULL) { \
- size_t copy_size = (old_usize < usize) \
- ? old_usize : usize; \
- size_t tail_size = usize - copy_size; \
- VALGRIND_MALLOCLIKE_BLOCK(ptr, usize, \
- rzsize, false); \
- if (copy_size > 0) { \
- valgrind_make_mem_defined(ptr, \
- copy_size); \
- } \
- if (zero && tail_size > 0) { \
- valgrind_make_mem_defined( \
- (void *)((uintptr_t)ptr + \
- copy_size), tail_size); \
- } \
- } \
- } \
- } \
-} while (0)
-#define JEMALLOC_VALGRIND_FREE(ptr, rzsize) do { \
- if (unlikely(in_valgrind)) \
- valgrind_freelike_block(ptr, rzsize); \
-} while (0)
-#else
-#define RUNNING_ON_VALGRIND ((unsigned)0)
-#define JEMALLOC_VALGRIND_MAKE_MEM_NOACCESS(ptr, usize) do {} while (0)
-#define JEMALLOC_VALGRIND_MAKE_MEM_UNDEFINED(ptr, usize) do {} while (0)
-#define JEMALLOC_VALGRIND_MAKE_MEM_DEFINED(ptr, usize) do {} while (0)
-#define JEMALLOC_VALGRIND_MALLOC(cond, tsdn, ptr, usize, zero) do {} while (0)
-#define JEMALLOC_VALGRIND_REALLOC(maybe_moved, tsdn, ptr, usize, \
- ptr_maybe_null, old_ptr, old_usize, old_rzsize, old_ptr_maybe_null, \
- zero) do {} while (0)
-#define JEMALLOC_VALGRIND_FREE(ptr, rzsize) do {} while (0)
-#endif
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-#ifdef JEMALLOC_VALGRIND
-void valgrind_make_mem_noaccess(void *ptr, size_t usize);
-void valgrind_make_mem_undefined(void *ptr, size_t usize);
-void valgrind_make_mem_defined(void *ptr, size_t usize);
-void valgrind_freelike_block(void *ptr, size_t usize);
-#endif
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
-
diff --git a/memory/jemalloc/src/include/jemalloc/internal/witness.h b/memory/jemalloc/src/include/jemalloc/internal/witness.h
deleted file mode 100644
index cdf15d797d..0000000000
--- a/memory/jemalloc/src/include/jemalloc/internal/witness.h
+++ /dev/null
@@ -1,266 +0,0 @@
-/******************************************************************************/
-#ifdef JEMALLOC_H_TYPES
-
-typedef struct witness_s witness_t;
-typedef unsigned witness_rank_t;
-typedef ql_head(witness_t) witness_list_t;
-typedef int witness_comp_t (const witness_t *, const witness_t *);
-
-/*
- * Lock ranks. Witnesses with rank WITNESS_RANK_OMIT are completely ignored by
- * the witness machinery.
- */
-#define WITNESS_RANK_OMIT 0U
-
-#define WITNESS_RANK_INIT 1U
-#define WITNESS_RANK_CTL 1U
-#define WITNESS_RANK_ARENAS 2U
-
-#define WITNESS_RANK_PROF_DUMP 3U
-#define WITNESS_RANK_PROF_BT2GCTX 4U
-#define WITNESS_RANK_PROF_TDATAS 5U
-#define WITNESS_RANK_PROF_TDATA 6U
-#define WITNESS_RANK_PROF_GCTX 7U
-
-#define WITNESS_RANK_ARENA 8U
-#define WITNESS_RANK_ARENA_CHUNKS 9U
-#define WITNESS_RANK_ARENA_NODE_CACHE 10
-
-#define WITNESS_RANK_BASE 11U
-
-#define WITNESS_RANK_LEAF 0xffffffffU
-#define WITNESS_RANK_ARENA_BIN WITNESS_RANK_LEAF
-#define WITNESS_RANK_ARENA_HUGE WITNESS_RANK_LEAF
-#define WITNESS_RANK_DSS WITNESS_RANK_LEAF
-#define WITNESS_RANK_PROF_ACTIVE WITNESS_RANK_LEAF
-#define WITNESS_RANK_PROF_DUMP_SEQ WITNESS_RANK_LEAF
-#define WITNESS_RANK_PROF_GDUMP WITNESS_RANK_LEAF
-#define WITNESS_RANK_PROF_NEXT_THR_UID WITNESS_RANK_LEAF
-#define WITNESS_RANK_PROF_THREAD_ACTIVE_INIT WITNESS_RANK_LEAF
-
-#define WITNESS_INITIALIZER(rank) {"initializer", rank, NULL, {NULL, NULL}}
-
-#endif /* JEMALLOC_H_TYPES */
-/******************************************************************************/
-#ifdef JEMALLOC_H_STRUCTS
-
-struct witness_s {
- /* Name, used for printing lock order reversal messages. */
- const char *name;
-
- /*
- * Witness rank, where 0 is lowest and UINT_MAX is highest. Witnesses
- * must be acquired in order of increasing rank.
- */
- witness_rank_t rank;
-
- /*
- * If two witnesses are of equal rank and they have the samp comp
- * function pointer, it is called as a last attempt to differentiate
- * between witnesses of equal rank.
- */
- witness_comp_t *comp;
-
- /* Linkage for thread's currently owned locks. */
- ql_elm(witness_t) link;
-};
-
-#endif /* JEMALLOC_H_STRUCTS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_EXTERNS
-
-void witness_init(witness_t *witness, const char *name, witness_rank_t rank,
- witness_comp_t *comp);
-#ifdef JEMALLOC_JET
-typedef void (witness_lock_error_t)(const witness_list_t *, const witness_t *);
-extern witness_lock_error_t *witness_lock_error;
-#else
-void witness_lock_error(const witness_list_t *witnesses,
- const witness_t *witness);
-#endif
-#ifdef JEMALLOC_JET
-typedef void (witness_owner_error_t)(const witness_t *);
-extern witness_owner_error_t *witness_owner_error;
-#else
-void witness_owner_error(const witness_t *witness);
-#endif
-#ifdef JEMALLOC_JET
-typedef void (witness_not_owner_error_t)(const witness_t *);
-extern witness_not_owner_error_t *witness_not_owner_error;
-#else
-void witness_not_owner_error(const witness_t *witness);
-#endif
-#ifdef JEMALLOC_JET
-typedef void (witness_lockless_error_t)(const witness_list_t *);
-extern witness_lockless_error_t *witness_lockless_error;
-#else
-void witness_lockless_error(const witness_list_t *witnesses);
-#endif
-
-void witnesses_cleanup(tsd_t *tsd);
-void witness_fork_cleanup(tsd_t *tsd);
-void witness_prefork(tsd_t *tsd);
-void witness_postfork_parent(tsd_t *tsd);
-void witness_postfork_child(tsd_t *tsd);
-
-#endif /* JEMALLOC_H_EXTERNS */
-/******************************************************************************/
-#ifdef JEMALLOC_H_INLINES
-
-#ifndef JEMALLOC_ENABLE_INLINE
-bool witness_owner(tsd_t *tsd, const witness_t *witness);
-void witness_assert_owner(tsdn_t *tsdn, const witness_t *witness);
-void witness_assert_not_owner(tsdn_t *tsdn, const witness_t *witness);
-void witness_assert_lockless(tsdn_t *tsdn);
-void witness_lock(tsdn_t *tsdn, witness_t *witness);
-void witness_unlock(tsdn_t *tsdn, witness_t *witness);
-#endif
-
-#if (defined(JEMALLOC_ENABLE_INLINE) || defined(JEMALLOC_MUTEX_C_))
-JEMALLOC_INLINE bool
-witness_owner(tsd_t *tsd, const witness_t *witness)
-{
- witness_list_t *witnesses;
- witness_t *w;
-
- witnesses = tsd_witnessesp_get(tsd);
- ql_foreach(w, witnesses, link) {
- if (w == witness)
- return (true);
- }
-
- return (false);
-}
-
-JEMALLOC_INLINE void
-witness_assert_owner(tsdn_t *tsdn, const witness_t *witness)
-{
- tsd_t *tsd;
-
- if (!config_debug)
- return;
-
- if (tsdn_null(tsdn))
- return;
- tsd = tsdn_tsd(tsdn);
- if (witness->rank == WITNESS_RANK_OMIT)
- return;
-
- if (witness_owner(tsd, witness))
- return;
- witness_owner_error(witness);
-}
-
-JEMALLOC_INLINE void
-witness_assert_not_owner(tsdn_t *tsdn, const witness_t *witness)
-{
- tsd_t *tsd;
- witness_list_t *witnesses;
- witness_t *w;
-
- if (!config_debug)
- return;
-
- if (tsdn_null(tsdn))
- return;
- tsd = tsdn_tsd(tsdn);
- if (witness->rank == WITNESS_RANK_OMIT)
- return;
-
- witnesses = tsd_witnessesp_get(tsd);
- ql_foreach(w, witnesses, link) {
- if (w == witness)
- witness_not_owner_error(witness);
- }
-}
-
-JEMALLOC_INLINE void
-witness_assert_lockless(tsdn_t *tsdn)
-{
- tsd_t *tsd;
- witness_list_t *witnesses;
- witness_t *w;
-
- if (!config_debug)
- return;
-
- if (tsdn_null(tsdn))
- return;
- tsd = tsdn_tsd(tsdn);
-
- witnesses = tsd_witnessesp_get(tsd);
- w = ql_last(witnesses, link);
- if (w != NULL)
- witness_lockless_error(witnesses);
-}
-
-JEMALLOC_INLINE void
-witness_lock(tsdn_t *tsdn, witness_t *witness)
-{
- tsd_t *tsd;
- witness_list_t *witnesses;
- witness_t *w;
-
- if (!config_debug)
- return;
-
- if (tsdn_null(tsdn))
- return;
- tsd = tsdn_tsd(tsdn);
- if (witness->rank == WITNESS_RANK_OMIT)
- return;
-
- witness_assert_not_owner(tsdn, witness);
-
- witnesses = tsd_witnessesp_get(tsd);
- w = ql_last(witnesses, link);
- if (w == NULL) {
- /* No other locks; do nothing. */
- } else if (tsd_witness_fork_get(tsd) && w->rank <= witness->rank) {
- /* Forking, and relaxed ranking satisfied. */
- } else if (w->rank > witness->rank) {
- /* Not forking, rank order reversal. */
- witness_lock_error(witnesses, witness);
- } else if (w->rank == witness->rank && (w->comp == NULL || w->comp !=
- witness->comp || w->comp(w, witness) > 0)) {
- /*
- * Missing/incompatible comparison function, or comparison
- * function indicates rank order reversal.
- */
- witness_lock_error(witnesses, witness);
- }
-
- ql_elm_new(witness, link);
- ql_tail_insert(witnesses, witness, link);
-}
-
-JEMALLOC_INLINE void
-witness_unlock(tsdn_t *tsdn, witness_t *witness)
-{
- tsd_t *tsd;
- witness_list_t *witnesses;
-
- if (!config_debug)
- return;
-
- if (tsdn_null(tsdn))
- return;
- tsd = tsdn_tsd(tsdn);
- if (witness->rank == WITNESS_RANK_OMIT)
- return;
-
- /*
- * Check whether owner before removal, rather than relying on
- * witness_assert_owner() to abort, so that unit tests can test this
- * function's failure mode without causing undefined behavior.
- */
- if (witness_owner(tsd, witness)) {
- witnesses = tsd_witnessesp_get(tsd);
- ql_remove(witnesses, witness, link);
- } else
- witness_assert_owner(tsdn, witness);
-}
-#endif
-
-#endif /* JEMALLOC_H_INLINES */
-/******************************************************************************/
diff --git a/memory/jemalloc/src/include/jemalloc/jemalloc.sh b/memory/jemalloc/src/include/jemalloc/jemalloc.sh
deleted file mode 100755
index c085814f20..0000000000
--- a/memory/jemalloc/src/include/jemalloc/jemalloc.sh
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/bin/sh
-
-objroot=$1
-
-cat <<EOF
-#ifndef JEMALLOC_H_
-#define JEMALLOC_H_
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-EOF
-
-for hdr in jemalloc_defs.h jemalloc_rename.h jemalloc_macros.h \
- jemalloc_protos.h jemalloc_typedefs.h jemalloc_mangle.h ; do
- cat "${objroot}include/jemalloc/${hdr}" \
- | grep -v 'Generated from .* by configure\.' \
- | sed -e 's/^#define /#define /g' \
- | sed -e 's/ $//g'
- echo
-done
-
-cat <<EOF
-#ifdef __cplusplus
-}
-#endif
-#endif /* JEMALLOC_H_ */
-EOF
diff --git a/memory/jemalloc/src/include/jemalloc/jemalloc_defs.h.in b/memory/jemalloc/src/include/jemalloc/jemalloc_defs.h.in
deleted file mode 100644
index 6d89435c29..0000000000
--- a/memory/jemalloc/src/include/jemalloc/jemalloc_defs.h.in
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Defined if __attribute__((...)) syntax is supported. */
-#undef JEMALLOC_HAVE_ATTR
-
-/* Defined if alloc_size attribute is supported. */
-#undef JEMALLOC_HAVE_ATTR_ALLOC_SIZE
-
-/* Defined if format(gnu_printf, ...) attribute is supported. */
-#undef JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF
-
-/* Defined if format(printf, ...) attribute is supported. */
-#undef JEMALLOC_HAVE_ATTR_FORMAT_PRINTF
-
-/*
- * Define overrides for non-standard allocator-related functions if they are
- * present on the system.
- */
-#undef JEMALLOC_OVERRIDE_MEMALIGN
-#undef JEMALLOC_OVERRIDE_VALLOC
-
-/*
- * At least Linux omits the "const" in:
- *
- * size_t malloc_usable_size(const void *ptr);
- *
- * Match the operating system's prototype.
- */
-#undef JEMALLOC_USABLE_SIZE_CONST
-
-/*
- * If defined, specify throw() for the public function prototypes when compiling
- * with C++. The only justification for this is to match the prototypes that
- * glibc defines.
- */
-#undef JEMALLOC_USE_CXX_THROW
-
-#ifdef _MSC_VER
-# ifdef _WIN64
-# define LG_SIZEOF_PTR_WIN 3
-# else
-# define LG_SIZEOF_PTR_WIN 2
-# endif
-#endif
-
-/* sizeof(void *) == 2^LG_SIZEOF_PTR. */
-#undef LG_SIZEOF_PTR
diff --git a/memory/jemalloc/src/include/jemalloc/jemalloc_macros.h.in b/memory/jemalloc/src/include/jemalloc/jemalloc_macros.h.in
deleted file mode 100644
index 129240ed9d..0000000000
--- a/memory/jemalloc/src/include/jemalloc/jemalloc_macros.h.in
+++ /dev/null
@@ -1,103 +0,0 @@
-#include <stdlib.h>
-#include <stdbool.h>
-#include <stdint.h>
-#include <limits.h>
-#include <strings.h>
-
-#define JEMALLOC_VERSION "@jemalloc_version@"
-#define JEMALLOC_VERSION_MAJOR @jemalloc_version_major@
-#define JEMALLOC_VERSION_MINOR @jemalloc_version_minor@
-#define JEMALLOC_VERSION_BUGFIX @jemalloc_version_bugfix@
-#define JEMALLOC_VERSION_NREV @jemalloc_version_nrev@
-#define JEMALLOC_VERSION_GID "@jemalloc_version_gid@"
-
-# define MALLOCX_LG_ALIGN(la) ((int)(la))
-# if LG_SIZEOF_PTR == 2
-# define MALLOCX_ALIGN(a) ((int)(ffs((int)(a))-1))
-# else
-# define MALLOCX_ALIGN(a) \
- ((int)(((size_t)(a) < (size_t)INT_MAX) ? ffs((int)(a))-1 : \
- ffs((int)(((size_t)(a))>>32))+31))
-# endif
-# define MALLOCX_ZERO ((int)0x40)
-/*
- * Bias tcache index bits so that 0 encodes "automatic tcache management", and 1
- * encodes MALLOCX_TCACHE_NONE.
- */
-# define MALLOCX_TCACHE(tc) ((int)(((tc)+2) << 8))
-# define MALLOCX_TCACHE_NONE MALLOCX_TCACHE(-1)
-/*
- * Bias arena index bits so that 0 encodes "use an automatically chosen arena".
- */
-# define MALLOCX_ARENA(a) ((((int)(a))+1) << 20)
-
-#if defined(__cplusplus) && defined(JEMALLOC_USE_CXX_THROW)
-# define JEMALLOC_CXX_THROW throw()
-#else
-# define JEMALLOC_CXX_THROW
-#endif
-
-#if _MSC_VER
-# define JEMALLOC_ATTR(s)
-# define JEMALLOC_ALIGNED(s) __declspec(align(s))
-# define JEMALLOC_ALLOC_SIZE(s)
-# define JEMALLOC_ALLOC_SIZE2(s1, s2)
-# ifndef JEMALLOC_EXPORT
-# ifdef DLLEXPORT
-# define JEMALLOC_EXPORT __declspec(dllexport)
-# else
-# define JEMALLOC_EXPORT __declspec(dllimport)
-# endif
-# endif
-# define JEMALLOC_FORMAT_PRINTF(s, i)
-# define JEMALLOC_NOINLINE __declspec(noinline)
-# ifdef __cplusplus
-# define JEMALLOC_NOTHROW __declspec(nothrow)
-# else
-# define JEMALLOC_NOTHROW
-# endif
-# define JEMALLOC_SECTION(s) __declspec(allocate(s))
-# define JEMALLOC_RESTRICT_RETURN __declspec(restrict)
-# if _MSC_VER >= 1900 && !defined(__EDG__)
-# define JEMALLOC_ALLOCATOR __declspec(allocator)
-# else
-# define JEMALLOC_ALLOCATOR
-# endif
-#elif defined(JEMALLOC_HAVE_ATTR)
-# define JEMALLOC_ATTR(s) __attribute__((s))
-# define JEMALLOC_ALIGNED(s) JEMALLOC_ATTR(aligned(s))
-# ifdef JEMALLOC_HAVE_ATTR_ALLOC_SIZE
-# define JEMALLOC_ALLOC_SIZE(s) JEMALLOC_ATTR(alloc_size(s))
-# define JEMALLOC_ALLOC_SIZE2(s1, s2) JEMALLOC_ATTR(alloc_size(s1, s2))
-# else
-# define JEMALLOC_ALLOC_SIZE(s)
-# define JEMALLOC_ALLOC_SIZE2(s1, s2)
-# endif
-# ifndef JEMALLOC_EXPORT
-# define JEMALLOC_EXPORT JEMALLOC_ATTR(visibility("default"))
-# endif
-# ifdef JEMALLOC_HAVE_ATTR_FORMAT_GNU_PRINTF
-# define JEMALLOC_FORMAT_PRINTF(s, i) JEMALLOC_ATTR(format(gnu_printf, s, i))
-# elif defined(JEMALLOC_HAVE_ATTR_FORMAT_PRINTF)
-# define JEMALLOC_FORMAT_PRINTF(s, i) JEMALLOC_ATTR(format(printf, s, i))
-# else
-# define JEMALLOC_FORMAT_PRINTF(s, i)
-# endif
-# define JEMALLOC_NOINLINE JEMALLOC_ATTR(noinline)
-# define JEMALLOC_NOTHROW JEMALLOC_ATTR(nothrow)
-# define JEMALLOC_SECTION(s) JEMALLOC_ATTR(section(s))
-# define JEMALLOC_RESTRICT_RETURN
-# define JEMALLOC_ALLOCATOR
-#else
-# define JEMALLOC_ATTR(s)
-# define JEMALLOC_ALIGNED(s)
-# define JEMALLOC_ALLOC_SIZE(s)
-# define JEMALLOC_ALLOC_SIZE2(s1, s2)
-# define JEMALLOC_EXPORT
-# define JEMALLOC_FORMAT_PRINTF(s, i)
-# define JEMALLOC_NOINLINE
-# define JEMALLOC_NOTHROW
-# define JEMALLOC_SECTION(s)
-# define JEMALLOC_RESTRICT_RETURN
-# define JEMALLOC_ALLOCATOR
-#endif
diff --git a/memory/jemalloc/src/include/jemalloc/jemalloc_mangle.sh b/memory/jemalloc/src/include/jemalloc/jemalloc_mangle.sh
deleted file mode 100755
index df328b78da..0000000000
--- a/memory/jemalloc/src/include/jemalloc/jemalloc_mangle.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/sh
-
-public_symbols_txt=$1
-symbol_prefix=$2
-
-cat <<EOF
-/*
- * By default application code must explicitly refer to mangled symbol names,
- * so that it is possible to use jemalloc in conjunction with another allocator
- * in the same application. Define JEMALLOC_MANGLE in order to cause automatic
- * name mangling that matches the API prefixing that happened as a result of
- * --with-mangling and/or --with-jemalloc-prefix configuration settings.
- */
-#ifdef JEMALLOC_MANGLE
-# ifndef JEMALLOC_NO_DEMANGLE
-# define JEMALLOC_NO_DEMANGLE
-# endif
-EOF
-
-for nm in `cat ${public_symbols_txt}` ; do
- n=`echo ${nm} |tr ':' ' ' |awk '{print $1}'`
- echo "# define ${n} ${symbol_prefix}${n}"
-done
-
-cat <<EOF
-#endif
-
-/*
- * The ${symbol_prefix}* macros can be used as stable alternative names for the
- * public jemalloc API if JEMALLOC_NO_DEMANGLE is defined. This is primarily
- * meant for use in jemalloc itself, but it can be used by application code to
- * provide isolation from the name mangling specified via --with-mangling
- * and/or --with-jemalloc-prefix.
- */
-#ifndef JEMALLOC_NO_DEMANGLE
-EOF
-
-for nm in `cat ${public_symbols_txt}` ; do
- n=`echo ${nm} |tr ':' ' ' |awk '{print $1}'`
- echo "# undef ${symbol_prefix}${n}"
-done
-
-cat <<EOF
-#endif
-EOF
diff --git a/memory/jemalloc/src/include/jemalloc/jemalloc_protos.h.in b/memory/jemalloc/src/include/jemalloc/jemalloc_protos.h.in
deleted file mode 100644
index a78414b196..0000000000
--- a/memory/jemalloc/src/include/jemalloc/jemalloc_protos.h.in
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * The @je_@ prefix on the following public symbol declarations is an artifact
- * of namespace management, and should be omitted in application code unless
- * JEMALLOC_NO_DEMANGLE is defined (see jemalloc_mangle@install_suffix@.h).
- */
-extern JEMALLOC_EXPORT const char *@je_@malloc_conf;
-extern JEMALLOC_EXPORT void (*@je_@malloc_message)(void *cbopaque,
- const char *s);
-
-JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
- void JEMALLOC_NOTHROW *@je_@malloc(size_t size)
- JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc) JEMALLOC_ALLOC_SIZE(1);
-JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
- void JEMALLOC_NOTHROW *@je_@calloc(size_t num, size_t size)
- JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc) JEMALLOC_ALLOC_SIZE2(1, 2);
-JEMALLOC_EXPORT int JEMALLOC_NOTHROW @je_@posix_memalign(void **memptr,
- size_t alignment, size_t size) JEMALLOC_CXX_THROW JEMALLOC_ATTR(nonnull(1));
-JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
- void JEMALLOC_NOTHROW *@je_@aligned_alloc(size_t alignment,
- size_t size) JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc)
- JEMALLOC_ALLOC_SIZE(2);
-JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
- void JEMALLOC_NOTHROW *@je_@realloc(void *ptr, size_t size)
- JEMALLOC_CXX_THROW JEMALLOC_ALLOC_SIZE(2);
-JEMALLOC_EXPORT void JEMALLOC_NOTHROW @je_@free(void *ptr)
- JEMALLOC_CXX_THROW;
-
-JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
- void JEMALLOC_NOTHROW *@je_@mallocx(size_t size, int flags)
- JEMALLOC_ATTR(malloc) JEMALLOC_ALLOC_SIZE(1);
-JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
- void JEMALLOC_NOTHROW *@je_@rallocx(void *ptr, size_t size,
- int flags) JEMALLOC_ALLOC_SIZE(2);
-JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW @je_@xallocx(void *ptr, size_t size,
- size_t extra, int flags);
-JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW @je_@sallocx(const void *ptr,
- int flags) JEMALLOC_ATTR(pure);
-JEMALLOC_EXPORT void JEMALLOC_NOTHROW @je_@dallocx(void *ptr, int flags);
-JEMALLOC_EXPORT void JEMALLOC_NOTHROW @je_@sdallocx(void *ptr, size_t size,
- int flags);
-JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW @je_@nallocx(size_t size, int flags)
- JEMALLOC_ATTR(pure);
-
-JEMALLOC_EXPORT int JEMALLOC_NOTHROW @je_@mallctl(const char *name,
- void *oldp, size_t *oldlenp, void *newp, size_t newlen);
-JEMALLOC_EXPORT int JEMALLOC_NOTHROW @je_@mallctlnametomib(const char *name,
- size_t *mibp, size_t *miblenp);
-JEMALLOC_EXPORT int JEMALLOC_NOTHROW @je_@mallctlbymib(const size_t *mib,
- size_t miblen, void *oldp, size_t *oldlenp, void *newp, size_t newlen);
-JEMALLOC_EXPORT void JEMALLOC_NOTHROW @je_@malloc_stats_print(
- void (*write_cb)(void *, const char *), void *@je_@cbopaque,
- const char *opts);
-JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW @je_@malloc_usable_size(
- JEMALLOC_USABLE_SIZE_CONST void *ptr) JEMALLOC_CXX_THROW;
-
-#ifdef JEMALLOC_OVERRIDE_MEMALIGN
-JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
- void JEMALLOC_NOTHROW *@je_@memalign(size_t alignment, size_t size)
- JEMALLOC_CXX_THROW JEMALLOC_ATTR(malloc);
-#endif
-
-#ifdef JEMALLOC_OVERRIDE_VALLOC
-JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
- void JEMALLOC_NOTHROW *@je_@valloc(size_t size) JEMALLOC_CXX_THROW
- JEMALLOC_ATTR(malloc);
-#endif
diff --git a/memory/jemalloc/src/include/jemalloc/jemalloc_rename.sh b/memory/jemalloc/src/include/jemalloc/jemalloc_rename.sh
deleted file mode 100755
index f94389120e..0000000000
--- a/memory/jemalloc/src/include/jemalloc/jemalloc_rename.sh
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/sh
-
-public_symbols_txt=$1
-
-cat <<EOF
-/*
- * Name mangling for public symbols is controlled by --with-mangling and
- * --with-jemalloc-prefix. With default settings the je_ prefix is stripped by
- * these macro definitions.
- */
-#ifndef JEMALLOC_NO_RENAME
-EOF
-
-for nm in `cat ${public_symbols_txt}` ; do
- n=`echo ${nm} |tr ':' ' ' |awk '{print $1}'`
- m=`echo ${nm} |tr ':' ' ' |awk '{print $2}'`
- echo "# define je_${n} ${m}"
-done
-
-cat <<EOF
-#endif
-EOF
diff --git a/memory/jemalloc/src/include/jemalloc/jemalloc_typedefs.h.in b/memory/jemalloc/src/include/jemalloc/jemalloc_typedefs.h.in
deleted file mode 100644
index fa7b350adc..0000000000
--- a/memory/jemalloc/src/include/jemalloc/jemalloc_typedefs.h.in
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * void *
- * chunk_alloc(void *new_addr, size_t size, size_t alignment, bool *zero,
- * bool *commit, unsigned arena_ind);
- */
-typedef void *(chunk_alloc_t)(void *, size_t, size_t, bool *, bool *, unsigned);
-
-/*
- * bool
- * chunk_dalloc(void *chunk, size_t size, bool committed, unsigned arena_ind);
- */
-typedef bool (chunk_dalloc_t)(void *, size_t, bool, unsigned);
-
-/*
- * bool
- * chunk_commit(void *chunk, size_t size, size_t offset, size_t length,
- * unsigned arena_ind);
- */
-typedef bool (chunk_commit_t)(void *, size_t, size_t, size_t, unsigned);
-
-/*
- * bool
- * chunk_decommit(void *chunk, size_t size, size_t offset, size_t length,
- * unsigned arena_ind);
- */
-typedef bool (chunk_decommit_t)(void *, size_t, size_t, size_t, unsigned);
-
-/*
- * bool
- * chunk_purge(void *chunk, size_t size, size_t offset, size_t length,
- * unsigned arena_ind);
- */
-typedef bool (chunk_purge_t)(void *, size_t, size_t, size_t, unsigned);
-
-/*
- * bool
- * chunk_split(void *chunk, size_t size, size_t size_a, size_t size_b,
- * bool committed, unsigned arena_ind);
- */
-typedef bool (chunk_split_t)(void *, size_t, size_t, size_t, bool, unsigned);
-
-/*
- * bool
- * chunk_merge(void *chunk_a, size_t size_a, void *chunk_b, size_t size_b,
- * bool committed, unsigned arena_ind);
- */
-typedef bool (chunk_merge_t)(void *, size_t, void *, size_t, bool, unsigned);
-
-typedef struct {
- chunk_alloc_t *alloc;
- chunk_dalloc_t *dalloc;
- chunk_commit_t *commit;
- chunk_decommit_t *decommit;
- chunk_purge_t *purge;
- chunk_split_t *split;
- chunk_merge_t *merge;
-} chunk_hooks_t;
diff --git a/memory/jemalloc/src/include/msvc_compat/C99/stdbool.h b/memory/jemalloc/src/include/msvc_compat/C99/stdbool.h
deleted file mode 100644
index d92160ebc7..0000000000
--- a/memory/jemalloc/src/include/msvc_compat/C99/stdbool.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef stdbool_h
-#define stdbool_h
-
-#include <wtypes.h>
-
-/* MSVC doesn't define _Bool or bool in C, but does have BOOL */
-/* Note this doesn't pass autoconf's test because (bool) 0.5 != true */
-/* Clang-cl uses MSVC headers, so needs msvc_compat, but has _Bool as
- * a built-in type. */
-#ifndef __clang__
-typedef BOOL _Bool;
-#endif
-
-#define bool _Bool
-#define true 1
-#define false 0
-
-#define __bool_true_false_are_defined 1
-
-#endif /* stdbool_h */
diff --git a/memory/jemalloc/src/include/msvc_compat/C99/stdint.h b/memory/jemalloc/src/include/msvc_compat/C99/stdint.h
deleted file mode 100644
index d02608a597..0000000000
--- a/memory/jemalloc/src/include/msvc_compat/C99/stdint.h
+++ /dev/null
@@ -1,247 +0,0 @@
-// ISO C9x compliant stdint.h for Microsoft Visual Studio
-// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124
-//
-// Copyright (c) 2006-2008 Alexander Chemeris
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// 1. Redistributions of source code must retain the above copyright notice,
-// this list of conditions and the following disclaimer.
-//
-// 2. Redistributions in binary form must reproduce the above copyright
-// notice, this list of conditions and the following disclaimer in the
-// documentation and/or other materials provided with the distribution.
-//
-// 3. The name of the author may be used to endorse or promote products
-// derived from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
-// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
-// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-//
-///////////////////////////////////////////////////////////////////////////////
-
-#ifndef _MSC_VER // [
-#error "Use this header only with Microsoft Visual C++ compilers!"
-#endif // _MSC_VER ]
-
-#ifndef _MSC_STDINT_H_ // [
-#define _MSC_STDINT_H_
-
-#if _MSC_VER > 1000
-#pragma once
-#endif
-
-#include <limits.h>
-
-// For Visual Studio 6 in C++ mode and for many Visual Studio versions when
-// compiling for ARM we should wrap <wchar.h> include with 'extern "C++" {}'
-// or compiler give many errors like this:
-// error C2733: second C linkage of overloaded function 'wmemchr' not allowed
-#ifdef __cplusplus
-extern "C" {
-#endif
-# include <wchar.h>
-#ifdef __cplusplus
-}
-#endif
-
-// Define _W64 macros to mark types changing their size, like intptr_t.
-#ifndef _W64
-# if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300
-# define _W64 __w64
-# else
-# define _W64
-# endif
-#endif
-
-
-// 7.18.1 Integer types
-
-// 7.18.1.1 Exact-width integer types
-
-// Visual Studio 6 and Embedded Visual C++ 4 doesn't
-// realize that, e.g. char has the same size as __int8
-// so we give up on __intX for them.
-#if (_MSC_VER < 1300)
- typedef signed char int8_t;
- typedef signed short int16_t;
- typedef signed int int32_t;
- typedef unsigned char uint8_t;
- typedef unsigned short uint16_t;
- typedef unsigned int uint32_t;
-#else
- typedef signed __int8 int8_t;
- typedef signed __int16 int16_t;
- typedef signed __int32 int32_t;
- typedef unsigned __int8 uint8_t;
- typedef unsigned __int16 uint16_t;
- typedef unsigned __int32 uint32_t;
-#endif
-typedef signed __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-
-
-// 7.18.1.2 Minimum-width integer types
-typedef int8_t int_least8_t;
-typedef int16_t int_least16_t;
-typedef int32_t int_least32_t;
-typedef int64_t int_least64_t;
-typedef uint8_t uint_least8_t;
-typedef uint16_t uint_least16_t;
-typedef uint32_t uint_least32_t;
-typedef uint64_t uint_least64_t;
-
-// 7.18.1.3 Fastest minimum-width integer types
-typedef int8_t int_fast8_t;
-typedef int16_t int_fast16_t;
-typedef int32_t int_fast32_t;
-typedef int64_t int_fast64_t;
-typedef uint8_t uint_fast8_t;
-typedef uint16_t uint_fast16_t;
-typedef uint32_t uint_fast32_t;
-typedef uint64_t uint_fast64_t;
-
-// 7.18.1.4 Integer types capable of holding object pointers
-#ifdef _WIN64 // [
- typedef signed __int64 intptr_t;
- typedef unsigned __int64 uintptr_t;
-#else // _WIN64 ][
- typedef _W64 signed int intptr_t;
- typedef _W64 unsigned int uintptr_t;
-#endif // _WIN64 ]
-
-// 7.18.1.5 Greatest-width integer types
-typedef int64_t intmax_t;
-typedef uint64_t uintmax_t;
-
-
-// 7.18.2 Limits of specified-width integer types
-
-#if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259
-
-// 7.18.2.1 Limits of exact-width integer types
-#define INT8_MIN ((int8_t)_I8_MIN)
-#define INT8_MAX _I8_MAX
-#define INT16_MIN ((int16_t)_I16_MIN)
-#define INT16_MAX _I16_MAX
-#define INT32_MIN ((int32_t)_I32_MIN)
-#define INT32_MAX _I32_MAX
-#define INT64_MIN ((int64_t)_I64_MIN)
-#define INT64_MAX _I64_MAX
-#define UINT8_MAX _UI8_MAX
-#define UINT16_MAX _UI16_MAX
-#define UINT32_MAX _UI32_MAX
-#define UINT64_MAX _UI64_MAX
-
-// 7.18.2.2 Limits of minimum-width integer types
-#define INT_LEAST8_MIN INT8_MIN
-#define INT_LEAST8_MAX INT8_MAX
-#define INT_LEAST16_MIN INT16_MIN
-#define INT_LEAST16_MAX INT16_MAX
-#define INT_LEAST32_MIN INT32_MIN
-#define INT_LEAST32_MAX INT32_MAX
-#define INT_LEAST64_MIN INT64_MIN
-#define INT_LEAST64_MAX INT64_MAX
-#define UINT_LEAST8_MAX UINT8_MAX
-#define UINT_LEAST16_MAX UINT16_MAX
-#define UINT_LEAST32_MAX UINT32_MAX
-#define UINT_LEAST64_MAX UINT64_MAX
-
-// 7.18.2.3 Limits of fastest minimum-width integer types
-#define INT_FAST8_MIN INT8_MIN
-#define INT_FAST8_MAX INT8_MAX
-#define INT_FAST16_MIN INT16_MIN
-#define INT_FAST16_MAX INT16_MAX
-#define INT_FAST32_MIN INT32_MIN
-#define INT_FAST32_MAX INT32_MAX
-#define INT_FAST64_MIN INT64_MIN
-#define INT_FAST64_MAX INT64_MAX
-#define UINT_FAST8_MAX UINT8_MAX
-#define UINT_FAST16_MAX UINT16_MAX
-#define UINT_FAST32_MAX UINT32_MAX
-#define UINT_FAST64_MAX UINT64_MAX
-
-// 7.18.2.4 Limits of integer types capable of holding object pointers
-#ifdef _WIN64 // [
-# define INTPTR_MIN INT64_MIN
-# define INTPTR_MAX INT64_MAX
-# define UINTPTR_MAX UINT64_MAX
-#else // _WIN64 ][
-# define INTPTR_MIN INT32_MIN
-# define INTPTR_MAX INT32_MAX
-# define UINTPTR_MAX UINT32_MAX
-#endif // _WIN64 ]
-
-// 7.18.2.5 Limits of greatest-width integer types
-#define INTMAX_MIN INT64_MIN
-#define INTMAX_MAX INT64_MAX
-#define UINTMAX_MAX UINT64_MAX
-
-// 7.18.3 Limits of other integer types
-
-#ifdef _WIN64 // [
-# define PTRDIFF_MIN _I64_MIN
-# define PTRDIFF_MAX _I64_MAX
-#else // _WIN64 ][
-# define PTRDIFF_MIN _I32_MIN
-# define PTRDIFF_MAX _I32_MAX
-#endif // _WIN64 ]
-
-#define SIG_ATOMIC_MIN INT_MIN
-#define SIG_ATOMIC_MAX INT_MAX
-
-#ifndef SIZE_MAX // [
-# ifdef _WIN64 // [
-# define SIZE_MAX _UI64_MAX
-# else // _WIN64 ][
-# define SIZE_MAX _UI32_MAX
-# endif // _WIN64 ]
-#endif // SIZE_MAX ]
-
-// WCHAR_MIN and WCHAR_MAX are also defined in <wchar.h>
-#ifndef WCHAR_MIN // [
-# define WCHAR_MIN 0
-#endif // WCHAR_MIN ]
-#ifndef WCHAR_MAX // [
-# define WCHAR_MAX _UI16_MAX
-#endif // WCHAR_MAX ]
-
-#define WINT_MIN 0
-#define WINT_MAX _UI16_MAX
-
-#endif // __STDC_LIMIT_MACROS ]
-
-
-// 7.18.4 Limits of other integer types
-
-#if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260
-
-// 7.18.4.1 Macros for minimum-width integer constants
-
-#define INT8_C(val) val##i8
-#define INT16_C(val) val##i16
-#define INT32_C(val) val##i32
-#define INT64_C(val) val##i64
-
-#define UINT8_C(val) val##ui8
-#define UINT16_C(val) val##ui16
-#define UINT32_C(val) val##ui32
-#define UINT64_C(val) val##ui64
-
-// 7.18.4.2 Macros for greatest-width integer constants
-#define INTMAX_C INT64_C
-#define UINTMAX_C UINT64_C
-
-#endif // __STDC_CONSTANT_MACROS ]
-
-
-#endif // _MSC_STDINT_H_ ]
diff --git a/memory/jemalloc/src/include/msvc_compat/strings.h b/memory/jemalloc/src/include/msvc_compat/strings.h
deleted file mode 100644
index a3ee250639..0000000000
--- a/memory/jemalloc/src/include/msvc_compat/strings.h
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef strings_h
-#define strings_h
-
-/* MSVC doesn't define ffs/ffsl. This dummy strings.h header is provided
- * for both */
-#ifdef _MSC_VER
-# include <intrin.h>
-# pragma intrinsic(_BitScanForward)
-static __forceinline int ffsl(long x)
-{
- unsigned long i;
-
- if (_BitScanForward(&i, x))
- return (i + 1);
- return (0);
-}
-
-static __forceinline int ffs(int x)
-{
-
- return (ffsl(x));
-}
-
-# ifdef _M_X64
-# pragma intrinsic(_BitScanForward64)
-# endif
-
-static __forceinline int ffsll(unsigned __int64 x)
-{
- unsigned long i;
-#ifdef _M_X64
- if (_BitScanForward64(&i, x))
- return (i + 1);
- return (0);
-#else
-// Fallback for 32-bit build where 64-bit version not available
-// assuming little endian
- union {
- unsigned __int64 ll;
- unsigned long l[2];
- } s;
-
- s.ll = x;
-
- if (_BitScanForward(&i, s.l[0]))
- return (i + 1);
- else if(_BitScanForward(&i, s.l[1]))
- return (i + 33);
- return (0);
-#endif
-}
-
-#else
-# define ffsll(x) __builtin_ffsll(x)
-# define ffsl(x) __builtin_ffsl(x)
-# define ffs(x) __builtin_ffs(x)
-#endif
-
-#endif /* strings_h */
diff --git a/memory/jemalloc/src/include/msvc_compat/windows_extra.h b/memory/jemalloc/src/include/msvc_compat/windows_extra.h
deleted file mode 100644
index 3008faa371..0000000000
--- a/memory/jemalloc/src/include/msvc_compat/windows_extra.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef MSVC_COMPAT_WINDOWS_EXTRA_H
-#define MSVC_COMPAT_WINDOWS_EXTRA_H
-
-#include <errno.h>
-
-#endif /* MSVC_COMPAT_WINDOWS_EXTRA_H */
diff --git a/memory/jemalloc/src/jemalloc.pc.in b/memory/jemalloc/src/jemalloc.pc.in
deleted file mode 100644
index a318e8dd3f..0000000000
--- a/memory/jemalloc/src/jemalloc.pc.in
+++ /dev/null
@@ -1,12 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-install_suffix=@install_suffix@
-
-Name: jemalloc
-Description: A general purpose malloc(3) implementation that emphasizes fragmentation avoidance and scalable concurrency support.
-URL: http://jemalloc.net/
-Version: @jemalloc_version@
-Cflags: -I${includedir}
-Libs: -L${libdir} -ljemalloc${install_suffix}
diff --git a/memory/jemalloc/src/msvc/ReadMe.txt b/memory/jemalloc/src/msvc/ReadMe.txt
deleted file mode 100644
index 77d567da0f..0000000000
--- a/memory/jemalloc/src/msvc/ReadMe.txt
+++ /dev/null
@@ -1,24 +0,0 @@
-
-How to build jemalloc for Windows
-=================================
-
-1. Install Cygwin with at least the following packages:
- * autoconf
- * autogen
- * gawk
- * grep
- * sed
-
-2. Install Visual Studio 2015 with Visual C++
-
-3. Add Cygwin\bin to the PATH environment variable
-
-4. Open "VS2015 x86 Native Tools Command Prompt"
- (note: x86/x64 doesn't matter at this point)
-
-5. Generate header files:
- sh -c "CC=cl ./autogen.sh"
-
-6. Now the project can be opened and built in Visual Studio:
- msvc\jemalloc_vc2015.sln
-
diff --git a/memory/jemalloc/src/msvc/jemalloc_vc2015.sln b/memory/jemalloc/src/msvc/jemalloc_vc2015.sln
deleted file mode 100644
index aedd5e5ea1..0000000000
--- a/memory/jemalloc/src/msvc/jemalloc_vc2015.sln
+++ /dev/null
@@ -1,63 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.24720.0
-MinimumVisualStudioVersion = 10.0.40219.1
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{70A99006-6DE9-472B-8F83-4CEE6C616DF3}"
- ProjectSection(SolutionItems) = preProject
- ReadMe.txt = ReadMe.txt
- EndProjectSection
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "jemalloc", "projects\vc2015\jemalloc\jemalloc.vcxproj", "{8D6BB292-9E1C-413D-9F98-4864BDC1514A}"
-EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "test_threads", "projects\vc2015\test_threads\test_threads.vcxproj", "{09028CFD-4EB7-491D-869C-0708DB97ED44}"
-EndProject
-Global
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|x64 = Debug|x64
- Debug|x86 = Debug|x86
- Debug-static|x64 = Debug-static|x64
- Debug-static|x86 = Debug-static|x86
- Release|x64 = Release|x64
- Release|x86 = Release|x86
- Release-static|x64 = Release-static|x64
- Release-static|x86 = Release-static|x86
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Debug|x64.ActiveCfg = Debug|x64
- {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Debug|x64.Build.0 = Debug|x64
- {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Debug|x86.ActiveCfg = Debug|Win32
- {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Debug|x86.Build.0 = Debug|Win32
- {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Debug-static|x64.ActiveCfg = Debug-static|x64
- {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Debug-static|x64.Build.0 = Debug-static|x64
- {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Debug-static|x86.ActiveCfg = Debug-static|Win32
- {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Debug-static|x86.Build.0 = Debug-static|Win32
- {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Release|x64.ActiveCfg = Release|x64
- {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Release|x64.Build.0 = Release|x64
- {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Release|x86.ActiveCfg = Release|Win32
- {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Release|x86.Build.0 = Release|Win32
- {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Release-static|x64.ActiveCfg = Release-static|x64
- {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Release-static|x64.Build.0 = Release-static|x64
- {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Release-static|x86.ActiveCfg = Release-static|Win32
- {8D6BB292-9E1C-413D-9F98-4864BDC1514A}.Release-static|x86.Build.0 = Release-static|Win32
- {09028CFD-4EB7-491D-869C-0708DB97ED44}.Debug|x64.ActiveCfg = Debug|x64
- {09028CFD-4EB7-491D-869C-0708DB97ED44}.Debug|x64.Build.0 = Debug|x64
- {09028CFD-4EB7-491D-869C-0708DB97ED44}.Debug|x86.ActiveCfg = Debug|Win32
- {09028CFD-4EB7-491D-869C-0708DB97ED44}.Debug|x86.Build.0 = Debug|Win32
- {09028CFD-4EB7-491D-869C-0708DB97ED44}.Debug-static|x64.ActiveCfg = Debug-static|x64
- {09028CFD-4EB7-491D-869C-0708DB97ED44}.Debug-static|x64.Build.0 = Debug-static|x64
- {09028CFD-4EB7-491D-869C-0708DB97ED44}.Debug-static|x86.ActiveCfg = Debug-static|Win32
- {09028CFD-4EB7-491D-869C-0708DB97ED44}.Debug-static|x86.Build.0 = Debug-static|Win32
- {09028CFD-4EB7-491D-869C-0708DB97ED44}.Release|x64.ActiveCfg = Release|x64
- {09028CFD-4EB7-491D-869C-0708DB97ED44}.Release|x64.Build.0 = Release|x64
- {09028CFD-4EB7-491D-869C-0708DB97ED44}.Release|x86.ActiveCfg = Release|Win32
- {09028CFD-4EB7-491D-869C-0708DB97ED44}.Release|x86.Build.0 = Release|Win32
- {09028CFD-4EB7-491D-869C-0708DB97ED44}.Release-static|x64.ActiveCfg = Release-static|x64
- {09028CFD-4EB7-491D-869C-0708DB97ED44}.Release-static|x64.Build.0 = Release-static|x64
- {09028CFD-4EB7-491D-869C-0708DB97ED44}.Release-static|x86.ActiveCfg = Release-static|Win32
- {09028CFD-4EB7-491D-869C-0708DB97ED44}.Release-static|x86.Build.0 = Release-static|Win32
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
diff --git a/memory/jemalloc/src/msvc/projects/vc2015/jemalloc/jemalloc.vcxproj b/memory/jemalloc/src/msvc/projects/vc2015/jemalloc/jemalloc.vcxproj
deleted file mode 100644
index 8342ab3ab5..0000000000
--- a/memory/jemalloc/src/msvc/projects/vc2015/jemalloc/jemalloc.vcxproj
+++ /dev/null
@@ -1,402 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug-static|Win32">
- <Configuration>Debug-static</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug-static|x64">
- <Configuration>Debug-static</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release-static|Win32">
- <Configuration>Release-static</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release-static|x64">
- <Configuration>Release-static</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\arena.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\assert.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\atomic.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\base.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\bitmap.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\chunk.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\chunk_dss.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\chunk_mmap.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\ckh.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\ctl.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\extent.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\hash.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\huge.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\jemalloc_internal.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\jemalloc_internal_decls.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\jemalloc_internal_defs.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\jemalloc_internal_macros.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\mb.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\mutex.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\nstime.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\pages.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\ph.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\private_namespace.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\private_unnamespace.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\prng.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\prof.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\public_namespace.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\public_unnamespace.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\ql.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\qr.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\quarantine.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\rb.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\rtree.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\size_classes.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\smoothstep.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\spin.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\stats.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\tcache.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\ticker.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\tsd.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\util.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\witness.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\jemalloc.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\jemalloc_defs.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\jemalloc_macros.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\jemalloc_mangle.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\jemalloc_protos.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\jemalloc_protos_jet.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\jemalloc_rename.h" />
- <ClInclude Include="..\..\..\..\include\jemalloc\jemalloc_typedefs.h" />
- <ClInclude Include="..\..\..\..\include\msvc_compat\C99\stdbool.h" />
- <ClInclude Include="..\..\..\..\include\msvc_compat\C99\stdint.h" />
- <ClInclude Include="..\..\..\..\include\msvc_compat\strings.h" />
- <ClInclude Include="..\..\..\..\include\msvc_compat\windows_extra.h" />
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\..\..\..\src\arena.c" />
- <ClCompile Include="..\..\..\..\src\atomic.c" />
- <ClCompile Include="..\..\..\..\src\base.c" />
- <ClCompile Include="..\..\..\..\src\bitmap.c" />
- <ClCompile Include="..\..\..\..\src\chunk.c" />
- <ClCompile Include="..\..\..\..\src\chunk_dss.c" />
- <ClCompile Include="..\..\..\..\src\chunk_mmap.c" />
- <ClCompile Include="..\..\..\..\src\ckh.c" />
- <ClCompile Include="..\..\..\..\src\ctl.c" />
- <ClCompile Include="..\..\..\..\src\extent.c" />
- <ClCompile Include="..\..\..\..\src\hash.c" />
- <ClCompile Include="..\..\..\..\src\huge.c" />
- <ClCompile Include="..\..\..\..\src\jemalloc.c" />
- <ClCompile Include="..\..\..\..\src\mb.c" />
- <ClCompile Include="..\..\..\..\src\mutex.c" />
- <ClCompile Include="..\..\..\..\src\nstime.c" />
- <ClCompile Include="..\..\..\..\src\pages.c" />
- <ClCompile Include="..\..\..\..\src\prng.c" />
- <ClCompile Include="..\..\..\..\src\prof.c" />
- <ClCompile Include="..\..\..\..\src\quarantine.c" />
- <ClCompile Include="..\..\..\..\src\rtree.c" />
- <ClCompile Include="..\..\..\..\src\spin.c" />
- <ClCompile Include="..\..\..\..\src\stats.c" />
- <ClCompile Include="..\..\..\..\src\tcache.c" />
- <ClCompile Include="..\..\..\..\src\ticker.c" />
- <ClCompile Include="..\..\..\..\src\tsd.c" />
- <ClCompile Include="..\..\..\..\src\util.c" />
- <ClCompile Include="..\..\..\..\src\witness.c" />
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{8D6BB292-9E1C-413D-9F98-4864BDC1514A}</ProjectGuid>
- <Keyword>Win32Proj</Keyword>
- <RootNamespace>jemalloc</RootNamespace>
- <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v140</PlatformToolset>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-static|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v140</PlatformToolset>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v140</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-static|Win32'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v140</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v140</PlatformToolset>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-static|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v140</PlatformToolset>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v140</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-static|x64'" Label="Configuration">
- <ConfigurationType>StaticLibrary</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v140</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="Shared">
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-static|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release-static|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-static|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release-static|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir>$(Platform)\$(Configuration)\</IntDir>
- <TargetName>$(ProjectName)d</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-static|Win32'">
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir>$(Platform)\$(Configuration)\</IntDir>
- <TargetName>$(ProjectName)-$(PlatformToolset)-$(Configuration)</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir>$(Platform)\$(Configuration)\</IntDir>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-static|Win32'">
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir>$(Platform)\$(Configuration)\</IntDir>
- <TargetName>$(ProjectName)-$(PlatformToolset)-$(Configuration)</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir>$(Platform)\$(Configuration)\</IntDir>
- <TargetName>$(ProjectName)d</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-static|x64'">
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir>$(Platform)\$(Configuration)\</IntDir>
- <TargetName>$(ProjectName)-vc$(PlatformToolsetVersion)-$(Configuration)</TargetName>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir>$(Platform)\$(Configuration)\</IntDir>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-static|x64'">
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir>$(Platform)\$(Configuration)\</IntDir>
- <TargetName>$(ProjectName)-vc$(PlatformToolsetVersion)-$(Configuration)</TargetName>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>_REENTRANT;_WINDLL;DLLEXPORT;JEMALLOC_DEBUG;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\include\msvc_compat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <DisableSpecificWarnings>4090;4146;4267;4334</DisableSpecificWarnings>
- <ProgramDataBaseFileName>$(OutputPath)$(TargetName).pdb</ProgramDataBaseFileName>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-static|Win32'">
- <ClCompile>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>JEMALLOC_DEBUG;_REENTRANT;JEMALLOC_EXPORT=;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\include\msvc_compat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <DisableSpecificWarnings>4090;4146;4267;4334</DisableSpecificWarnings>
- <ProgramDataBaseFileName>$(OutputPath)$(TargetName).pdb</ProgramDataBaseFileName>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>_REENTRANT;_WINDLL;DLLEXPORT;JEMALLOC_DEBUG;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\include\msvc_compat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <DisableSpecificWarnings>4090;4146;4267;4334</DisableSpecificWarnings>
- <ProgramDataBaseFileName>$(OutputPath)$(TargetName).pdb</ProgramDataBaseFileName>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-static|x64'">
- <ClCompile>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>JEMALLOC_DEBUG;_REENTRANT;JEMALLOC_EXPORT=;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\include\msvc_compat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- <DisableSpecificWarnings>4090;4146;4267;4334</DisableSpecificWarnings>
- <DebugInformationFormat>OldStyle</DebugInformationFormat>
- <MinimalRebuild>false</MinimalRebuild>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>_REENTRANT;_WINDLL;DLLEXPORT;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\include\msvc_compat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <DisableSpecificWarnings>4090;4146;4267;4334</DisableSpecificWarnings>
- <ProgramDataBaseFileName>$(OutputPath)$(TargetName).pdb</ProgramDataBaseFileName>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-static|Win32'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>_REENTRANT;JEMALLOC_EXPORT=;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\include\msvc_compat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <DisableSpecificWarnings>4090;4146;4267;4334</DisableSpecificWarnings>
- <ProgramDataBaseFileName>$(OutputPath)$(TargetName).pdb</ProgramDataBaseFileName>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\include\msvc_compat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <PreprocessorDefinitions>_REENTRANT;_WINDLL;DLLEXPORT;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <DisableSpecificWarnings>4090;4146;4267;4334</DisableSpecificWarnings>
- <ProgramDataBaseFileName>$(OutputPath)$(TargetName).pdb</ProgramDataBaseFileName>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-static|x64'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>_REENTRANT;JEMALLOC_EXPORT=;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\..\..\include;..\..\..\..\include\msvc_compat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- <DisableSpecificWarnings>4090;4146;4267;4334</DisableSpecificWarnings>
- <DebugInformationFormat>OldStyle</DebugInformationFormat>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- </Link>
- </ItemDefinitionGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/memory/jemalloc/src/msvc/projects/vc2015/jemalloc/jemalloc.vcxproj.filters b/memory/jemalloc/src/msvc/projects/vc2015/jemalloc/jemalloc.vcxproj.filters
deleted file mode 100644
index 37f0f02ae0..0000000000
--- a/memory/jemalloc/src/msvc/projects/vc2015/jemalloc/jemalloc.vcxproj.filters
+++ /dev/null
@@ -1,272 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- <Filter Include="Header Files\internal">
- <UniqueIdentifier>{5697dfa3-16cf-4932-b428-6e0ec6e9f98e}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files\msvc_compat">
- <UniqueIdentifier>{0cbd2ca6-42a7-4f82-8517-d7e7a14fd986}</UniqueIdentifier>
- </Filter>
- <Filter Include="Header Files\msvc_compat\C99">
- <UniqueIdentifier>{0abe6f30-49b5-46dd-8aca-6e33363fa52c}</UniqueIdentifier>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\..\..\..\include\jemalloc\jemalloc.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\jemalloc_defs.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\jemalloc_macros.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\jemalloc_mangle.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\jemalloc_protos.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\jemalloc_protos_jet.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\jemalloc_rename.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\jemalloc_typedefs.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\arena.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\assert.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\atomic.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\base.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\bitmap.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\chunk.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\chunk_dss.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\chunk_mmap.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\ckh.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\ctl.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\extent.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\hash.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\huge.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\jemalloc_internal.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\jemalloc_internal_decls.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\jemalloc_internal_defs.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\jemalloc_internal_macros.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\mb.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\mutex.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\nstime.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\pages.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\ph.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\private_namespace.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\private_unnamespace.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\prng.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\prof.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\public_namespace.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\public_unnamespace.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\ql.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\qr.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\quarantine.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\rb.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\rtree.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\size_classes.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\smoothstep.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\spin.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\stats.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\tcache.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\ticker.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\tsd.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\util.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\jemalloc\internal\witness.h">
- <Filter>Header Files\internal</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\msvc_compat\strings.h">
- <Filter>Header Files\msvc_compat</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\msvc_compat\windows_extra.h">
- <Filter>Header Files\msvc_compat</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\msvc_compat\C99\stdbool.h">
- <Filter>Header Files\msvc_compat\C99</Filter>
- </ClInclude>
- <ClInclude Include="..\..\..\..\include\msvc_compat\C99\stdint.h">
- <Filter>Header Files\msvc_compat\C99</Filter>
- </ClInclude>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="..\..\..\..\src\arena.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\..\src\atomic.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\..\src\base.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\..\src\bitmap.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\..\src\chunk.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\..\src\chunk_dss.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\..\src\chunk_mmap.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\..\src\ckh.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\..\src\ctl.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\..\src\extent.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\..\src\hash.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\..\src\huge.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\..\src\jemalloc.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\..\src\mb.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\..\src\mutex.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\..\src\nstime.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\..\src\pages.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\..\src\prng.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\..\src\prof.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\..\src\quarantine.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\..\src\rtree.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\..\src\spin.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\..\src\stats.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\..\src\tcache.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\..\src\ticker.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\..\src\tsd.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\..\src\util.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="..\..\..\..\src\witness.c">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
-</Project>
diff --git a/memory/jemalloc/src/msvc/projects/vc2015/test_threads/test_threads.cpp b/memory/jemalloc/src/msvc/projects/vc2015/test_threads/test_threads.cpp
deleted file mode 100644
index c8cb7d66a7..0000000000
--- a/memory/jemalloc/src/msvc/projects/vc2015/test_threads/test_threads.cpp
+++ /dev/null
@@ -1,89 +0,0 @@
-// jemalloc C++ threaded test
-// Author: Rustam Abdullaev
-// Public Domain
-
-#include <atomic>
-#include <functional>
-#include <future>
-#include <random>
-#include <thread>
-#include <vector>
-#include <stdio.h>
-#include <jemalloc/jemalloc.h>
-
-using std::vector;
-using std::thread;
-using std::uniform_int_distribution;
-using std::minstd_rand;
-
-int test_threads()
-{
- je_malloc_conf = "narenas:3";
- int narenas = 0;
- size_t sz = sizeof(narenas);
- je_mallctl("opt.narenas", &narenas, &sz, NULL, 0);
- if (narenas != 3) {
- printf("Error: unexpected number of arenas: %d\n", narenas);
- return 1;
- }
- static const int sizes[] = { 7, 16, 32, 60, 91, 100, 120, 144, 169, 199, 255, 400, 670, 900, 917, 1025, 3333, 5190, 13131, 49192, 99999, 123123, 255265, 2333111 };
- static const int numSizes = (int)(sizeof(sizes) / sizeof(sizes[0]));
- vector<thread> workers;
- static const int numThreads = narenas + 1, numAllocsMax = 25, numIter1 = 50, numIter2 = 50;
- je_malloc_stats_print(NULL, NULL, NULL);
- size_t allocated1;
- size_t sz1 = sizeof(allocated1);
- je_mallctl("stats.active", &allocated1, &sz1, NULL, 0);
- printf("\nPress Enter to start threads...\n");
- getchar();
- printf("Starting %d threads x %d x %d iterations...\n", numThreads, numIter1, numIter2);
- for (int i = 0; i < numThreads; i++) {
- workers.emplace_back([tid=i]() {
- uniform_int_distribution<int> sizeDist(0, numSizes - 1);
- minstd_rand rnd(tid * 17);
- uint8_t* ptrs[numAllocsMax];
- int ptrsz[numAllocsMax];
- for (int i = 0; i < numIter1; ++i) {
- thread t([&]() {
- for (int i = 0; i < numIter2; ++i) {
- const int numAllocs = numAllocsMax - sizeDist(rnd);
- for (int j = 0; j < numAllocs; j += 64) {
- const int x = sizeDist(rnd);
- const int sz = sizes[x];
- ptrsz[j] = sz;
- ptrs[j] = (uint8_t*)je_malloc(sz);
- if (!ptrs[j]) {
- printf("Unable to allocate %d bytes in thread %d, iter %d, alloc %d. %d\n", sz, tid, i, j, x);
- exit(1);
- }
- for (int k = 0; k < sz; k++)
- ptrs[j][k] = tid + k;
- }
- for (int j = 0; j < numAllocs; j += 64) {
- for (int k = 0, sz = ptrsz[j]; k < sz; k++)
- if (ptrs[j][k] != (uint8_t)(tid + k)) {
- printf("Memory error in thread %d, iter %d, alloc %d @ %d : %02X!=%02X\n", tid, i, j, k, ptrs[j][k], (uint8_t)(tid + k));
- exit(1);
- }
- je_free(ptrs[j]);
- }
- }
- });
- t.join();
- }
- });
- }
- for (thread& t : workers) {
- t.join();
- }
- je_malloc_stats_print(NULL, NULL, NULL);
- size_t allocated2;
- je_mallctl("stats.active", &allocated2, &sz1, NULL, 0);
- size_t leaked = allocated2 - allocated1;
- printf("\nDone. Leaked: %zd bytes\n", leaked);
- bool failed = leaked > 65536; // in case C++ runtime allocated something (e.g. iostream locale or facet)
- printf("\nTest %s!\n", (failed ? "FAILED" : "successful"));
- printf("\nPress Enter to continue...\n");
- getchar();
- return failed ? 1 : 0;
-}
diff --git a/memory/jemalloc/src/msvc/projects/vc2015/test_threads/test_threads.h b/memory/jemalloc/src/msvc/projects/vc2015/test_threads/test_threads.h
deleted file mode 100644
index 64d0cdb33a..0000000000
--- a/memory/jemalloc/src/msvc/projects/vc2015/test_threads/test_threads.h
+++ /dev/null
@@ -1,3 +0,0 @@
-#pragma once
-
-int test_threads();
diff --git a/memory/jemalloc/src/msvc/projects/vc2015/test_threads/test_threads.vcxproj b/memory/jemalloc/src/msvc/projects/vc2015/test_threads/test_threads.vcxproj
deleted file mode 100644
index f5e9898f29..0000000000
--- a/memory/jemalloc/src/msvc/projects/vc2015/test_threads/test_threads.vcxproj
+++ /dev/null
@@ -1,327 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug-static|Win32">
- <Configuration>Debug-static</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug-static|x64">
- <Configuration>Debug-static</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release-static|Win32">
- <Configuration>Release-static</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release-static|x64">
- <Configuration>Release-static</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{09028CFD-4EB7-491D-869C-0708DB97ED44}</ProjectGuid>
- <Keyword>Win32Proj</Keyword>
- <RootNamespace>test_threads</RootNamespace>
- <WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v140</PlatformToolset>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-static|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v140</PlatformToolset>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v140</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-static|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v140</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v140</PlatformToolset>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-static|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v140</PlatformToolset>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v140</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-static|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v140</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>MultiByte</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="Shared">
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-static|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release-static|Win32'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug-static|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release-static|x64'" Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir>$(Platform)\$(Configuration)\</IntDir>
- <LinkIncremental>true</LinkIncremental>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-static|Win32'">
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir>$(Platform)\$(Configuration)\</IntDir>
- <LinkIncremental>true</LinkIncremental>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <LinkIncremental>true</LinkIncremental>
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-static|x64'">
- <LinkIncremental>true</LinkIncremental>
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir>$(Platform)\$(Configuration)\</IntDir>
- <LinkIncremental>false</LinkIncremental>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-static|Win32'">
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir>$(Platform)\$(Configuration)\</IntDir>
- <LinkIncremental>false</LinkIncremental>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir>$(Platform)\$(Configuration)\</IntDir>
- <LinkIncremental>false</LinkIncremental>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-static|x64'">
- <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
- <IntDir>$(Platform)\$(Configuration)\</IntDir>
- <LinkIncremental>false</LinkIncremental>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\..\..\test\include;..\..\..\..\include;..\..\..\..\include\msvc_compat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration)</AdditionalLibraryDirectories>
- <AdditionalDependencies>jemallocd.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-static|Win32'">
- <ClCompile>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>JEMALLOC_EXPORT=;JEMALLOC_STATIC;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\..\..\test\include;..\..\..\..\include;..\..\..\..\include\msvc_compat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration)</AdditionalLibraryDirectories>
- <AdditionalDependencies>jemalloc-$(PlatformToolset)-$(Configuration).lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\..\..\test\include;..\..\..\..\include;..\..\..\..\include\msvc_compat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalDependencies>jemallocd.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration)</AdditionalLibraryDirectories>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug-static|x64'">
- <ClCompile>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- <PreprocessorDefinitions>JEMALLOC_EXPORT=;JEMALLOC_STATIC;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\..\..\test\include;..\..\..\..\include;..\..\..\..\include\msvc_compat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalDependencies>jemalloc-vc$(PlatformToolsetVersion)-$(Configuration).lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- <AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration)</AdditionalLibraryDirectories>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\..\..\test\include;..\..\..\..\include;..\..\..\..\include\msvc_compat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration)</AdditionalLibraryDirectories>
- <AdditionalDependencies>jemalloc.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-static|Win32'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>JEMALLOC_EXPORT=;JEMALLOC_STATIC;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\..\..\test\include;..\..\..\..\include;..\..\..\..\include\msvc_compat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration)</AdditionalLibraryDirectories>
- <AdditionalDependencies>jemalloc-$(PlatformToolset)-$(Configuration).lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\..\..\test\include;..\..\..\..\include;..\..\..\..\include\msvc_compat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration)</AdditionalLibraryDirectories>
- <AdditionalDependencies>jemalloc.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release-static|x64'">
- <ClCompile>
- <WarningLevel>Level3</WarningLevel>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>JEMALLOC_EXPORT=;JEMALLOC_STATIC;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\..\..\test\include;..\..\..\..\include;..\..\..\..\include\msvc_compat;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <AdditionalLibraryDirectories>$(SolutionDir)$(Platform)\$(Configuration)</AdditionalLibraryDirectories>
- <AdditionalDependencies>jemalloc-vc$(PlatformToolsetVersion)-$(Configuration).lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="test_threads.cpp" />
- <ClCompile Include="test_threads_main.cpp" />
- </ItemGroup>
- <ItemGroup>
- <ProjectReference Include="..\jemalloc\jemalloc.vcxproj">
- <Project>{8d6bb292-9e1c-413d-9f98-4864bdc1514a}</Project>
- </ProjectReference>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="test_threads.h" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project> \ No newline at end of file
diff --git a/memory/jemalloc/src/msvc/projects/vc2015/test_threads/test_threads.vcxproj.filters b/memory/jemalloc/src/msvc/projects/vc2015/test_threads/test_threads.vcxproj.filters
deleted file mode 100644
index 4c23340738..0000000000
--- a/memory/jemalloc/src/msvc/projects/vc2015/test_threads/test_threads.vcxproj.filters
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup>
- <Filter Include="Source Files">
- <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
- <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
- </Filter>
- <Filter Include="Header Files">
- <UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
- <Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
- </Filter>
- </ItemGroup>
- <ItemGroup>
- <ClCompile Include="test_threads.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- <ClCompile Include="test_threads_main.cpp">
- <Filter>Source Files</Filter>
- </ClCompile>
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="test_threads.h">
- <Filter>Header Files</Filter>
- </ClInclude>
- </ItemGroup>
-</Project> \ No newline at end of file
diff --git a/memory/jemalloc/src/msvc/projects/vc2015/test_threads/test_threads_main.cpp b/memory/jemalloc/src/msvc/projects/vc2015/test_threads/test_threads_main.cpp
deleted file mode 100644
index ffd96e6abd..0000000000
--- a/memory/jemalloc/src/msvc/projects/vc2015/test_threads/test_threads_main.cpp
+++ /dev/null
@@ -1,12 +0,0 @@
-#include "test_threads.h"
-#include <future>
-#include <functional>
-#include <chrono>
-
-using namespace std::chrono_literals;
-
-int main(int argc, char** argv)
-{
- int rc = test_threads();
- return rc;
-}
diff --git a/memory/jemalloc/src/src/arena.c b/memory/jemalloc/src/src/arena.c
deleted file mode 100644
index e196b13378..0000000000
--- a/memory/jemalloc/src/src/arena.c
+++ /dev/null
@@ -1,3781 +0,0 @@
-#define JEMALLOC_ARENA_C_
-#include "jemalloc/internal/jemalloc_internal.h"
-
-/******************************************************************************/
-/* Data. */
-
-purge_mode_t opt_purge = PURGE_DEFAULT;
-const char *purge_mode_names[] = {
- "ratio",
- "decay",
- "N/A"
-};
-ssize_t opt_lg_dirty_mult = LG_DIRTY_MULT_DEFAULT;
-static ssize_t lg_dirty_mult_default;
-ssize_t opt_decay_time = DECAY_TIME_DEFAULT;
-static ssize_t decay_time_default;
-
-arena_bin_info_t arena_bin_info[NBINS];
-
-size_t map_bias;
-size_t map_misc_offset;
-size_t arena_maxrun; /* Max run size for arenas. */
-size_t large_maxclass; /* Max large size class. */
-unsigned nlclasses; /* Number of large size classes. */
-unsigned nhclasses; /* Number of huge size classes. */
-
-/******************************************************************************/
-/*
- * Function prototypes for static functions that are referenced prior to
- * definition.
- */
-
-static void arena_chunk_dalloc(tsdn_t *tsdn, arena_t *arena,
- arena_chunk_t *chunk);
-static void arena_purge_to_limit(tsdn_t *tsdn, arena_t *arena,
- size_t ndirty_limit);
-static void arena_run_dalloc(tsdn_t *tsdn, arena_t *arena, arena_run_t *run,
- bool dirty, bool cleaned, bool decommitted);
-static void arena_dalloc_bin_run(tsdn_t *tsdn, arena_t *arena,
- arena_chunk_t *chunk, arena_run_t *run, arena_bin_t *bin);
-static void arena_bin_lower_run(arena_t *arena, arena_chunk_t *chunk,
- arena_run_t *run, arena_bin_t *bin);
-
-/******************************************************************************/
-
-JEMALLOC_INLINE_C size_t
-arena_miscelm_size_get(const arena_chunk_map_misc_t *miscelm)
-{
- arena_chunk_t *chunk;
- size_t pageind, mapbits;
-
- chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(miscelm);
- pageind = arena_miscelm_to_pageind(miscelm);
- mapbits = arena_mapbits_get(chunk, pageind);
- return (arena_mapbits_size_decode(mapbits));
-}
-
-JEMALLOC_INLINE_C int
-arena_run_addr_comp(const arena_chunk_map_misc_t *a,
- const arena_chunk_map_misc_t *b)
-{
- uintptr_t a_miscelm = (uintptr_t)a;
- uintptr_t b_miscelm = (uintptr_t)b;
-
- assert(a != NULL);
- assert(b != NULL);
-
- return ((a_miscelm > b_miscelm) - (a_miscelm < b_miscelm));
-}
-
-/* Generate pairing heap functions. */
-ph_gen(static UNUSED, arena_run_heap_, arena_run_heap_t, arena_chunk_map_misc_t,
- ph_link, arena_run_addr_comp)
-
-#ifdef JEMALLOC_JET
-#undef run_quantize_floor
-#define run_quantize_floor JEMALLOC_N(n_run_quantize_floor)
-#endif
-static size_t
-run_quantize_floor(size_t size)
-{
- size_t ret;
- pszind_t pind;
-
- assert(size > 0);
- assert(size <= HUGE_MAXCLASS);
- assert((size & PAGE_MASK) == 0);
-
- assert(size != 0);
- assert(size == PAGE_CEILING(size));
-
- pind = psz2ind(size - large_pad + 1);
- if (pind == 0) {
- /*
- * Avoid underflow. This short-circuit would also do the right
- * thing for all sizes in the range for which there are
- * PAGE-spaced size classes, but it's simplest to just handle
- * the one case that would cause erroneous results.
- */
- return (size);
- }
- ret = pind2sz(pind - 1) + large_pad;
- assert(ret <= size);
- return (ret);
-}
-#ifdef JEMALLOC_JET
-#undef run_quantize_floor
-#define run_quantize_floor JEMALLOC_N(run_quantize_floor)
-run_quantize_t *run_quantize_floor = JEMALLOC_N(n_run_quantize_floor);
-#endif
-
-#ifdef JEMALLOC_JET
-#undef run_quantize_ceil
-#define run_quantize_ceil JEMALLOC_N(n_run_quantize_ceil)
-#endif
-static size_t
-run_quantize_ceil(size_t size)
-{
- size_t ret;
-
- assert(size > 0);
- assert(size <= HUGE_MAXCLASS);
- assert((size & PAGE_MASK) == 0);
-
- ret = run_quantize_floor(size);
- if (ret < size) {
- /*
- * Skip a quantization that may have an adequately large run,
- * because under-sized runs may be mixed in. This only happens
- * when an unusual size is requested, i.e. for aligned
- * allocation, and is just one of several places where linear
- * search would potentially find sufficiently aligned available
- * memory somewhere lower.
- */
- ret = pind2sz(psz2ind(ret - large_pad + 1)) + large_pad;
- }
- return (ret);
-}
-#ifdef JEMALLOC_JET
-#undef run_quantize_ceil
-#define run_quantize_ceil JEMALLOC_N(run_quantize_ceil)
-run_quantize_t *run_quantize_ceil = JEMALLOC_N(n_run_quantize_ceil);
-#endif
-
-static void
-arena_avail_insert(arena_t *arena, arena_chunk_t *chunk, size_t pageind,
- size_t npages)
-{
- pszind_t pind = psz2ind(run_quantize_floor(arena_miscelm_size_get(
- arena_miscelm_get_const(chunk, pageind))));
- assert(npages == (arena_mapbits_unallocated_size_get(chunk, pageind) >>
- LG_PAGE));
- assert((npages << LG_PAGE) < chunksize);
- assert(pind2sz(pind) <= chunksize);
- arena_run_heap_insert(&arena->runs_avail[pind],
- arena_miscelm_get_mutable(chunk, pageind));
-}
-
-static void
-arena_avail_remove(arena_t *arena, arena_chunk_t *chunk, size_t pageind,
- size_t npages)
-{
- pszind_t pind = psz2ind(run_quantize_floor(arena_miscelm_size_get(
- arena_miscelm_get_const(chunk, pageind))));
- assert(npages == (arena_mapbits_unallocated_size_get(chunk, pageind) >>
- LG_PAGE));
- assert((npages << LG_PAGE) < chunksize);
- assert(pind2sz(pind) <= chunksize);
- arena_run_heap_remove(&arena->runs_avail[pind],
- arena_miscelm_get_mutable(chunk, pageind));
-}
-
-static void
-arena_run_dirty_insert(arena_t *arena, arena_chunk_t *chunk, size_t pageind,
- size_t npages)
-{
- arena_chunk_map_misc_t *miscelm = arena_miscelm_get_mutable(chunk,
- pageind);
-
- assert(npages == (arena_mapbits_unallocated_size_get(chunk, pageind) >>
- LG_PAGE));
- assert(arena_mapbits_dirty_get(chunk, pageind) == CHUNK_MAP_DIRTY);
- assert(arena_mapbits_dirty_get(chunk, pageind+npages-1) ==
- CHUNK_MAP_DIRTY);
-
- qr_new(&miscelm->rd, rd_link);
- qr_meld(&arena->runs_dirty, &miscelm->rd, rd_link);
- arena->ndirty += npages;
-}
-
-static void
-arena_run_dirty_remove(arena_t *arena, arena_chunk_t *chunk, size_t pageind,
- size_t npages)
-{
- arena_chunk_map_misc_t *miscelm = arena_miscelm_get_mutable(chunk,
- pageind);
-
- assert(npages == (arena_mapbits_unallocated_size_get(chunk, pageind) >>
- LG_PAGE));
- assert(arena_mapbits_dirty_get(chunk, pageind) == CHUNK_MAP_DIRTY);
- assert(arena_mapbits_dirty_get(chunk, pageind+npages-1) ==
- CHUNK_MAP_DIRTY);
-
- qr_remove(&miscelm->rd, rd_link);
- assert(arena->ndirty >= npages);
- arena->ndirty -= npages;
-}
-
-static size_t
-arena_chunk_dirty_npages(const extent_node_t *node)
-{
-
- return (extent_node_size_get(node) >> LG_PAGE);
-}
-
-void
-arena_chunk_cache_maybe_insert(arena_t *arena, extent_node_t *node, bool cache)
-{
-
- if (cache) {
- extent_node_dirty_linkage_init(node);
- extent_node_dirty_insert(node, &arena->runs_dirty,
- &arena->chunks_cache);
- arena->ndirty += arena_chunk_dirty_npages(node);
- }
-}
-
-void
-arena_chunk_cache_maybe_remove(arena_t *arena, extent_node_t *node, bool dirty)
-{
-
- if (dirty) {
- extent_node_dirty_remove(node);
- assert(arena->ndirty >= arena_chunk_dirty_npages(node));
- arena->ndirty -= arena_chunk_dirty_npages(node);
- }
-}
-
-JEMALLOC_INLINE_C void *
-arena_run_reg_alloc(arena_run_t *run, arena_bin_info_t *bin_info)
-{
- void *ret;
- size_t regind;
- arena_chunk_map_misc_t *miscelm;
- void *rpages;
-
- assert(run->nfree > 0);
- assert(!bitmap_full(run->bitmap, &bin_info->bitmap_info));
-
- regind = (unsigned)bitmap_sfu(run->bitmap, &bin_info->bitmap_info);
- miscelm = arena_run_to_miscelm(run);
- rpages = arena_miscelm_to_rpages(miscelm);
- ret = (void *)((uintptr_t)rpages + (uintptr_t)bin_info->reg0_offset +
- (uintptr_t)(bin_info->reg_interval * regind));
- run->nfree--;
- return (ret);
-}
-
-JEMALLOC_INLINE_C void
-arena_run_reg_dalloc(arena_run_t *run, void *ptr)
-{
- arena_chunk_t *chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(run);
- size_t pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> LG_PAGE;
- size_t mapbits = arena_mapbits_get(chunk, pageind);
- szind_t binind = arena_ptr_small_binind_get(ptr, mapbits);
- arena_bin_info_t *bin_info = &arena_bin_info[binind];
- size_t regind = arena_run_regind(run, bin_info, ptr);
-
- assert(run->nfree < bin_info->nregs);
- /* Freeing an interior pointer can cause assertion failure. */
- assert(((uintptr_t)ptr -
- ((uintptr_t)arena_miscelm_to_rpages(arena_run_to_miscelm(run)) +
- (uintptr_t)bin_info->reg0_offset)) %
- (uintptr_t)bin_info->reg_interval == 0);
- assert((uintptr_t)ptr >=
- (uintptr_t)arena_miscelm_to_rpages(arena_run_to_miscelm(run)) +
- (uintptr_t)bin_info->reg0_offset);
- /* Freeing an unallocated pointer can cause assertion failure. */
- assert(bitmap_get(run->bitmap, &bin_info->bitmap_info, regind));
-
- bitmap_unset(run->bitmap, &bin_info->bitmap_info, regind);
- run->nfree++;
-}
-
-JEMALLOC_INLINE_C void
-arena_run_zero(arena_chunk_t *chunk, size_t run_ind, size_t npages)
-{
-
- JEMALLOC_VALGRIND_MAKE_MEM_UNDEFINED((void *)((uintptr_t)chunk +
- (run_ind << LG_PAGE)), (npages << LG_PAGE));
- memset((void *)((uintptr_t)chunk + (run_ind << LG_PAGE)), 0,
- (npages << LG_PAGE));
-}
-
-JEMALLOC_INLINE_C void
-arena_run_page_mark_zeroed(arena_chunk_t *chunk, size_t run_ind)
-{
-
- JEMALLOC_VALGRIND_MAKE_MEM_DEFINED((void *)((uintptr_t)chunk + (run_ind
- << LG_PAGE)), PAGE);
-}
-
-JEMALLOC_INLINE_C void
-arena_run_page_validate_zeroed(arena_chunk_t *chunk, size_t run_ind)
-{
- size_t i;
- UNUSED size_t *p = (size_t *)((uintptr_t)chunk + (run_ind << LG_PAGE));
-
- arena_run_page_mark_zeroed(chunk, run_ind);
- for (i = 0; i < PAGE / sizeof(size_t); i++)
- assert(p[i] == 0);
-}
-
-static void
-arena_nactive_add(arena_t *arena, size_t add_pages)
-{
-
- if (config_stats) {
- size_t cactive_add = CHUNK_CEILING((arena->nactive +
- add_pages) << LG_PAGE) - CHUNK_CEILING(arena->nactive <<
- LG_PAGE);
- if (cactive_add != 0)
- stats_cactive_add(cactive_add);
- }
- arena->nactive += add_pages;
-}
-
-static void
-arena_nactive_sub(arena_t *arena, size_t sub_pages)
-{
-
- if (config_stats) {
- size_t cactive_sub = CHUNK_CEILING(arena->nactive << LG_PAGE) -
- CHUNK_CEILING((arena->nactive - sub_pages) << LG_PAGE);
- if (cactive_sub != 0)
- stats_cactive_sub(cactive_sub);
- }
- arena->nactive -= sub_pages;
-}
-
-static void
-arena_run_split_remove(arena_t *arena, arena_chunk_t *chunk, size_t run_ind,
- size_t flag_dirty, size_t flag_decommitted, size_t need_pages)
-{
- size_t total_pages, rem_pages;
-
- assert(flag_dirty == 0 || flag_decommitted == 0);
-
- total_pages = arena_mapbits_unallocated_size_get(chunk, run_ind) >>
- LG_PAGE;
- assert(arena_mapbits_dirty_get(chunk, run_ind+total_pages-1) ==
- flag_dirty);
- assert(need_pages <= total_pages);
- rem_pages = total_pages - need_pages;
-
- arena_avail_remove(arena, chunk, run_ind, total_pages);
- if (flag_dirty != 0)
- arena_run_dirty_remove(arena, chunk, run_ind, total_pages);
- arena_nactive_add(arena, need_pages);
-
- /* Keep track of trailing unused pages for later use. */
- if (rem_pages > 0) {
- size_t flags = flag_dirty | flag_decommitted;
- size_t flag_unzeroed_mask = (flags == 0) ? CHUNK_MAP_UNZEROED :
- 0;
-
- arena_mapbits_unallocated_set(chunk, run_ind+need_pages,
- (rem_pages << LG_PAGE), flags |
- (arena_mapbits_unzeroed_get(chunk, run_ind+need_pages) &
- flag_unzeroed_mask));
- arena_mapbits_unallocated_set(chunk, run_ind+total_pages-1,
- (rem_pages << LG_PAGE), flags |
- (arena_mapbits_unzeroed_get(chunk, run_ind+total_pages-1) &
- flag_unzeroed_mask));
- if (flag_dirty != 0) {
- arena_run_dirty_insert(arena, chunk, run_ind+need_pages,
- rem_pages);
- }
- arena_avail_insert(arena, chunk, run_ind+need_pages, rem_pages);
- }
-}
-
-static bool
-arena_run_split_large_helper(arena_t *arena, arena_run_t *run, size_t size,
- bool remove, bool zero)
-{
- arena_chunk_t *chunk;
- arena_chunk_map_misc_t *miscelm;
- size_t flag_dirty, flag_decommitted, run_ind, need_pages;
- size_t flag_unzeroed_mask;
-
- chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(run);
- miscelm = arena_run_to_miscelm(run);
- run_ind = arena_miscelm_to_pageind(miscelm);
- flag_dirty = arena_mapbits_dirty_get(chunk, run_ind);
- flag_decommitted = arena_mapbits_decommitted_get(chunk, run_ind);
- need_pages = (size >> LG_PAGE);
- assert(need_pages > 0);
-
- if (flag_decommitted != 0 && arena->chunk_hooks.commit(chunk, chunksize,
- run_ind << LG_PAGE, size, arena->ind))
- return (true);
-
- if (remove) {
- arena_run_split_remove(arena, chunk, run_ind, flag_dirty,
- flag_decommitted, need_pages);
- }
-
- if (zero) {
- if (flag_decommitted != 0) {
- /* The run is untouched, and therefore zeroed. */
- JEMALLOC_VALGRIND_MAKE_MEM_DEFINED((void
- *)((uintptr_t)chunk + (run_ind << LG_PAGE)),
- (need_pages << LG_PAGE));
- } else if (flag_dirty != 0) {
- /* The run is dirty, so all pages must be zeroed. */
- arena_run_zero(chunk, run_ind, need_pages);
- } else {
- /*
- * The run is clean, so some pages may be zeroed (i.e.
- * never before touched).
- */
- size_t i;
- for (i = 0; i < need_pages; i++) {
- if (arena_mapbits_unzeroed_get(chunk, run_ind+i)
- != 0)
- arena_run_zero(chunk, run_ind+i, 1);
- else if (config_debug) {
- arena_run_page_validate_zeroed(chunk,
- run_ind+i);
- } else {
- arena_run_page_mark_zeroed(chunk,
- run_ind+i);
- }
- }
- }
- } else {
- JEMALLOC_VALGRIND_MAKE_MEM_UNDEFINED((void *)((uintptr_t)chunk +
- (run_ind << LG_PAGE)), (need_pages << LG_PAGE));
- }
-
- /*
- * Set the last element first, in case the run only contains one page
- * (i.e. both statements set the same element).
- */
- flag_unzeroed_mask = (flag_dirty | flag_decommitted) == 0 ?
- CHUNK_MAP_UNZEROED : 0;
- arena_mapbits_large_set(chunk, run_ind+need_pages-1, 0, flag_dirty |
- (flag_unzeroed_mask & arena_mapbits_unzeroed_get(chunk,
- run_ind+need_pages-1)));
- arena_mapbits_large_set(chunk, run_ind, size, flag_dirty |
- (flag_unzeroed_mask & arena_mapbits_unzeroed_get(chunk, run_ind)));
- return (false);
-}
-
-static bool
-arena_run_split_large(arena_t *arena, arena_run_t *run, size_t size, bool zero)
-{
-
- return (arena_run_split_large_helper(arena, run, size, true, zero));
-}
-
-static bool
-arena_run_init_large(arena_t *arena, arena_run_t *run, size_t size, bool zero)
-{
-
- return (arena_run_split_large_helper(arena, run, size, false, zero));
-}
-
-static bool
-arena_run_split_small(arena_t *arena, arena_run_t *run, size_t size,
- szind_t binind)
-{
- arena_chunk_t *chunk;
- arena_chunk_map_misc_t *miscelm;
- size_t flag_dirty, flag_decommitted, run_ind, need_pages, i;
-
- assert(binind != BININD_INVALID);
-
- chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(run);
- miscelm = arena_run_to_miscelm(run);
- run_ind = arena_miscelm_to_pageind(miscelm);
- flag_dirty = arena_mapbits_dirty_get(chunk, run_ind);
- flag_decommitted = arena_mapbits_decommitted_get(chunk, run_ind);
- need_pages = (size >> LG_PAGE);
- assert(need_pages > 0);
-
- if (flag_decommitted != 0 && arena->chunk_hooks.commit(chunk, chunksize,
- run_ind << LG_PAGE, size, arena->ind))
- return (true);
-
- arena_run_split_remove(arena, chunk, run_ind, flag_dirty,
- flag_decommitted, need_pages);
-
- for (i = 0; i < need_pages; i++) {
- size_t flag_unzeroed = arena_mapbits_unzeroed_get(chunk,
- run_ind+i);
- arena_mapbits_small_set(chunk, run_ind+i, i, binind,
- flag_unzeroed);
- if (config_debug && flag_dirty == 0 && flag_unzeroed == 0)
- arena_run_page_validate_zeroed(chunk, run_ind+i);
- }
- JEMALLOC_VALGRIND_MAKE_MEM_UNDEFINED((void *)((uintptr_t)chunk +
- (run_ind << LG_PAGE)), (need_pages << LG_PAGE));
- return (false);
-}
-
-static arena_chunk_t *
-arena_chunk_init_spare(arena_t *arena)
-{
- arena_chunk_t *chunk;
-
- assert(arena->spare != NULL);
-
- chunk = arena->spare;
- arena->spare = NULL;
-
- assert(arena_mapbits_allocated_get(chunk, map_bias) == 0);
- assert(arena_mapbits_allocated_get(chunk, chunk_npages-1) == 0);
- assert(arena_mapbits_unallocated_size_get(chunk, map_bias) ==
- arena_maxrun);
- assert(arena_mapbits_unallocated_size_get(chunk, chunk_npages-1) ==
- arena_maxrun);
- assert(arena_mapbits_dirty_get(chunk, map_bias) ==
- arena_mapbits_dirty_get(chunk, chunk_npages-1));
-
- return (chunk);
-}
-
-static bool
-arena_chunk_register(tsdn_t *tsdn, arena_t *arena, arena_chunk_t *chunk,
- bool zero)
-{
-
- /*
- * The extent node notion of "committed" doesn't directly apply to
- * arena chunks. Arbitrarily mark them as committed. The commit state
- * of runs is tracked individually, and upon chunk deallocation the
- * entire chunk is in a consistent commit state.
- */
- extent_node_init(&chunk->node, arena, chunk, chunksize, zero, true);
- extent_node_achunk_set(&chunk->node, true);
- return (chunk_register(tsdn, chunk, &chunk->node));
-}
-
-static arena_chunk_t *
-arena_chunk_alloc_internal_hard(tsdn_t *tsdn, arena_t *arena,
- chunk_hooks_t *chunk_hooks, bool *zero, bool *commit)
-{
- arena_chunk_t *chunk;
-
- malloc_mutex_unlock(tsdn, &arena->lock);
-
- chunk = (arena_chunk_t *)chunk_alloc_wrapper(tsdn, arena, chunk_hooks,
- NULL, chunksize, chunksize, zero, commit);
- if (chunk != NULL && !*commit) {
- /* Commit header. */
- if (chunk_hooks->commit(chunk, chunksize, 0, map_bias <<
- LG_PAGE, arena->ind)) {
- chunk_dalloc_wrapper(tsdn, arena, chunk_hooks,
- (void *)chunk, chunksize, *zero, *commit);
- chunk = NULL;
- }
- }
- if (chunk != NULL && arena_chunk_register(tsdn, arena, chunk, *zero)) {
- if (!*commit) {
- /* Undo commit of header. */
- chunk_hooks->decommit(chunk, chunksize, 0, map_bias <<
- LG_PAGE, arena->ind);
- }
- chunk_dalloc_wrapper(tsdn, arena, chunk_hooks, (void *)chunk,
- chunksize, *zero, *commit);
- chunk = NULL;
- }
-
- malloc_mutex_lock(tsdn, &arena->lock);
- return (chunk);
-}
-
-static arena_chunk_t *
-arena_chunk_alloc_internal(tsdn_t *tsdn, arena_t *arena, bool *zero,
- bool *commit)
-{
- arena_chunk_t *chunk;
- chunk_hooks_t chunk_hooks = CHUNK_HOOKS_INITIALIZER;
-
- chunk = chunk_alloc_cache(tsdn, arena, &chunk_hooks, NULL, chunksize,
- chunksize, zero, commit, true);
- if (chunk != NULL) {
- if (arena_chunk_register(tsdn, arena, chunk, *zero)) {
- chunk_dalloc_cache(tsdn, arena, &chunk_hooks, chunk,
- chunksize, true);
- return (NULL);
- }
- }
- if (chunk == NULL) {
- chunk = arena_chunk_alloc_internal_hard(tsdn, arena,
- &chunk_hooks, zero, commit);
- }
-
- if (config_stats && chunk != NULL) {
- arena->stats.mapped += chunksize;
- arena->stats.metadata_mapped += (map_bias << LG_PAGE);
- }
-
- return (chunk);
-}
-
-static arena_chunk_t *
-arena_chunk_init_hard(tsdn_t *tsdn, arena_t *arena)
-{
- arena_chunk_t *chunk;
- bool zero, commit;
- size_t flag_unzeroed, flag_decommitted, i;
-
- assert(arena->spare == NULL);
-
- zero = false;
- commit = false;
- chunk = arena_chunk_alloc_internal(tsdn, arena, &zero, &commit);
- if (chunk == NULL)
- return (NULL);
-
- /*
- * Initialize the map to contain one maximal free untouched run. Mark
- * the pages as zeroed if arena_chunk_alloc_internal() returned a zeroed
- * or decommitted chunk.
- */
- flag_unzeroed = (zero || !commit) ? 0 : CHUNK_MAP_UNZEROED;
- flag_decommitted = commit ? 0 : CHUNK_MAP_DECOMMITTED;
- arena_mapbits_unallocated_set(chunk, map_bias, arena_maxrun,
- flag_unzeroed | flag_decommitted);
- /*
- * There is no need to initialize the internal page map entries unless
- * the chunk is not zeroed.
- */
- if (!zero) {
- JEMALLOC_VALGRIND_MAKE_MEM_UNDEFINED(
- (void *)arena_bitselm_get_const(chunk, map_bias+1),
- (size_t)((uintptr_t)arena_bitselm_get_const(chunk,
- chunk_npages-1) -
- (uintptr_t)arena_bitselm_get_const(chunk, map_bias+1)));
- for (i = map_bias+1; i < chunk_npages-1; i++)
- arena_mapbits_internal_set(chunk, i, flag_unzeroed);
- } else {
- JEMALLOC_VALGRIND_MAKE_MEM_DEFINED((void
- *)arena_bitselm_get_const(chunk, map_bias+1),
- (size_t)((uintptr_t)arena_bitselm_get_const(chunk,
- chunk_npages-1) -
- (uintptr_t)arena_bitselm_get_const(chunk, map_bias+1)));
- if (config_debug) {
- for (i = map_bias+1; i < chunk_npages-1; i++) {
- assert(arena_mapbits_unzeroed_get(chunk, i) ==
- flag_unzeroed);
- }
- }
- }
- arena_mapbits_unallocated_set(chunk, chunk_npages-1, arena_maxrun,
- flag_unzeroed);
-
- return (chunk);
-}
-
-static arena_chunk_t *
-arena_chunk_alloc(tsdn_t *tsdn, arena_t *arena)
-{
- arena_chunk_t *chunk;
-
- if (arena->spare != NULL)
- chunk = arena_chunk_init_spare(arena);
- else {
- chunk = arena_chunk_init_hard(tsdn, arena);
- if (chunk == NULL)
- return (NULL);
- }
-
- ql_elm_new(&chunk->node, ql_link);
- ql_tail_insert(&arena->achunks, &chunk->node, ql_link);
- arena_avail_insert(arena, chunk, map_bias, chunk_npages-map_bias);
-
- return (chunk);
-}
-
-static void
-arena_chunk_discard(tsdn_t *tsdn, arena_t *arena, arena_chunk_t *chunk)
-{
- bool committed;
- chunk_hooks_t chunk_hooks = CHUNK_HOOKS_INITIALIZER;
-
- chunk_deregister(chunk, &chunk->node);
-
- committed = (arena_mapbits_decommitted_get(chunk, map_bias) == 0);
- if (!committed) {
- /*
- * Decommit the header. Mark the chunk as decommitted even if
- * header decommit fails, since treating a partially committed
- * chunk as committed has a high potential for causing later
- * access of decommitted memory.
- */
- chunk_hooks = chunk_hooks_get(tsdn, arena);
- chunk_hooks.decommit(chunk, chunksize, 0, map_bias << LG_PAGE,
- arena->ind);
- }
-
- chunk_dalloc_cache(tsdn, arena, &chunk_hooks, (void *)chunk, chunksize,
- committed);
-
- if (config_stats) {
- arena->stats.mapped -= chunksize;
- arena->stats.metadata_mapped -= (map_bias << LG_PAGE);
- }
-}
-
-static void
-arena_spare_discard(tsdn_t *tsdn, arena_t *arena, arena_chunk_t *spare)
-{
-
- assert(arena->spare != spare);
-
- if (arena_mapbits_dirty_get(spare, map_bias) != 0) {
- arena_run_dirty_remove(arena, spare, map_bias,
- chunk_npages-map_bias);
- }
-
- arena_chunk_discard(tsdn, arena, spare);
-}
-
-static void
-arena_chunk_dalloc(tsdn_t *tsdn, arena_t *arena, arena_chunk_t *chunk)
-{
- arena_chunk_t *spare;
-
- assert(arena_mapbits_allocated_get(chunk, map_bias) == 0);
- assert(arena_mapbits_allocated_get(chunk, chunk_npages-1) == 0);
- assert(arena_mapbits_unallocated_size_get(chunk, map_bias) ==
- arena_maxrun);
- assert(arena_mapbits_unallocated_size_get(chunk, chunk_npages-1) ==
- arena_maxrun);
- assert(arena_mapbits_dirty_get(chunk, map_bias) ==
- arena_mapbits_dirty_get(chunk, chunk_npages-1));
- assert(arena_mapbits_decommitted_get(chunk, map_bias) ==
- arena_mapbits_decommitted_get(chunk, chunk_npages-1));
-
- /* Remove run from runs_avail, so that the arena does not use it. */
- arena_avail_remove(arena, chunk, map_bias, chunk_npages-map_bias);
-
- ql_remove(&arena->achunks, &chunk->node, ql_link);
- spare = arena->spare;
- arena->spare = chunk;
- if (spare != NULL)
- arena_spare_discard(tsdn, arena, spare);
-}
-
-static void
-arena_huge_malloc_stats_update(arena_t *arena, size_t usize)
-{
- szind_t index = size2index(usize) - nlclasses - NBINS;
-
- cassert(config_stats);
-
- arena->stats.nmalloc_huge++;
- arena->stats.allocated_huge += usize;
- arena->stats.hstats[index].nmalloc++;
- arena->stats.hstats[index].curhchunks++;
-}
-
-static void
-arena_huge_malloc_stats_update_undo(arena_t *arena, size_t usize)
-{
- szind_t index = size2index(usize) - nlclasses - NBINS;
-
- cassert(config_stats);
-
- arena->stats.nmalloc_huge--;
- arena->stats.allocated_huge -= usize;
- arena->stats.hstats[index].nmalloc--;
- arena->stats.hstats[index].curhchunks--;
-}
-
-static void
-arena_huge_dalloc_stats_update(arena_t *arena, size_t usize)
-{
- szind_t index = size2index(usize) - nlclasses - NBINS;
-
- cassert(config_stats);
-
- arena->stats.ndalloc_huge++;
- arena->stats.allocated_huge -= usize;
- arena->stats.hstats[index].ndalloc++;
- arena->stats.hstats[index].curhchunks--;
-}
-
-static void
-arena_huge_reset_stats_cancel(arena_t *arena, size_t usize)
-{
- szind_t index = size2index(usize) - nlclasses - NBINS;
-
- cassert(config_stats);
-
- arena->stats.ndalloc_huge++;
- arena->stats.hstats[index].ndalloc--;
-}
-
-static void
-arena_huge_dalloc_stats_update_undo(arena_t *arena, size_t usize)
-{
- szind_t index = size2index(usize) - nlclasses - NBINS;
-
- cassert(config_stats);
-
- arena->stats.ndalloc_huge--;
- arena->stats.allocated_huge += usize;
- arena->stats.hstats[index].ndalloc--;
- arena->stats.hstats[index].curhchunks++;
-}
-
-static void
-arena_huge_ralloc_stats_update(arena_t *arena, size_t oldsize, size_t usize)
-{
-
- arena_huge_dalloc_stats_update(arena, oldsize);
- arena_huge_malloc_stats_update(arena, usize);
-}
-
-static void
-arena_huge_ralloc_stats_update_undo(arena_t *arena, size_t oldsize,
- size_t usize)
-{
-
- arena_huge_dalloc_stats_update_undo(arena, oldsize);
- arena_huge_malloc_stats_update_undo(arena, usize);
-}
-
-extent_node_t *
-arena_node_alloc(tsdn_t *tsdn, arena_t *arena)
-{
- extent_node_t *node;
-
- malloc_mutex_lock(tsdn, &arena->node_cache_mtx);
- node = ql_last(&arena->node_cache, ql_link);
- if (node == NULL) {
- malloc_mutex_unlock(tsdn, &arena->node_cache_mtx);
- return (base_alloc(tsdn, sizeof(extent_node_t)));
- }
- ql_tail_remove(&arena->node_cache, extent_node_t, ql_link);
- malloc_mutex_unlock(tsdn, &arena->node_cache_mtx);
- return (node);
-}
-
-void
-arena_node_dalloc(tsdn_t *tsdn, arena_t *arena, extent_node_t *node)
-{
-
- malloc_mutex_lock(tsdn, &arena->node_cache_mtx);
- ql_elm_new(node, ql_link);
- ql_tail_insert(&arena->node_cache, node, ql_link);
- malloc_mutex_unlock(tsdn, &arena->node_cache_mtx);
-}
-
-static void *
-arena_chunk_alloc_huge_hard(tsdn_t *tsdn, arena_t *arena,
- chunk_hooks_t *chunk_hooks, size_t usize, size_t alignment, bool *zero,
- size_t csize)
-{
- void *ret;
- bool commit = true;
-
- ret = chunk_alloc_wrapper(tsdn, arena, chunk_hooks, NULL, csize,
- alignment, zero, &commit);
- if (ret == NULL) {
- /* Revert optimistic stats updates. */
- malloc_mutex_lock(tsdn, &arena->lock);
- if (config_stats) {
- arena_huge_malloc_stats_update_undo(arena, usize);
- arena->stats.mapped -= usize;
- }
- arena_nactive_sub(arena, usize >> LG_PAGE);
- malloc_mutex_unlock(tsdn, &arena->lock);
- }
-
- return (ret);
-}
-
-void *
-arena_chunk_alloc_huge(tsdn_t *tsdn, arena_t *arena, size_t usize,
- size_t alignment, bool *zero)
-{
- void *ret;
- chunk_hooks_t chunk_hooks = CHUNK_HOOKS_INITIALIZER;
- size_t csize = CHUNK_CEILING(usize);
- bool commit = true;
-
- malloc_mutex_lock(tsdn, &arena->lock);
-
- /* Optimistically update stats. */
- if (config_stats) {
- arena_huge_malloc_stats_update(arena, usize);
- arena->stats.mapped += usize;
- }
- arena_nactive_add(arena, usize >> LG_PAGE);
-
- ret = chunk_alloc_cache(tsdn, arena, &chunk_hooks, NULL, csize,
- alignment, zero, &commit, true);
- malloc_mutex_unlock(tsdn, &arena->lock);
- if (ret == NULL) {
- ret = arena_chunk_alloc_huge_hard(tsdn, arena, &chunk_hooks,
- usize, alignment, zero, csize);
- }
-
- return (ret);
-}
-
-void
-arena_chunk_dalloc_huge(tsdn_t *tsdn, arena_t *arena, void *chunk, size_t usize)
-{
- chunk_hooks_t chunk_hooks = CHUNK_HOOKS_INITIALIZER;
- size_t csize;
-
- csize = CHUNK_CEILING(usize);
- malloc_mutex_lock(tsdn, &arena->lock);
- if (config_stats) {
- arena_huge_dalloc_stats_update(arena, usize);
- arena->stats.mapped -= usize;
- }
- arena_nactive_sub(arena, usize >> LG_PAGE);
-
- chunk_dalloc_cache(tsdn, arena, &chunk_hooks, chunk, csize, true);
- malloc_mutex_unlock(tsdn, &arena->lock);
-}
-
-void
-arena_chunk_ralloc_huge_similar(tsdn_t *tsdn, arena_t *arena, void *chunk,
- size_t oldsize, size_t usize)
-{
-
- assert(CHUNK_CEILING(oldsize) == CHUNK_CEILING(usize));
- assert(oldsize != usize);
-
- malloc_mutex_lock(tsdn, &arena->lock);
- if (config_stats)
- arena_huge_ralloc_stats_update(arena, oldsize, usize);
- if (oldsize < usize)
- arena_nactive_add(arena, (usize - oldsize) >> LG_PAGE);
- else
- arena_nactive_sub(arena, (oldsize - usize) >> LG_PAGE);
- malloc_mutex_unlock(tsdn, &arena->lock);
-}
-
-void
-arena_chunk_ralloc_huge_shrink(tsdn_t *tsdn, arena_t *arena, void *chunk,
- size_t oldsize, size_t usize)
-{
- size_t udiff = oldsize - usize;
- size_t cdiff = CHUNK_CEILING(oldsize) - CHUNK_CEILING(usize);
-
- malloc_mutex_lock(tsdn, &arena->lock);
- if (config_stats) {
- arena_huge_ralloc_stats_update(arena, oldsize, usize);
- if (cdiff != 0)
- arena->stats.mapped -= cdiff;
- }
- arena_nactive_sub(arena, udiff >> LG_PAGE);
-
- if (cdiff != 0) {
- chunk_hooks_t chunk_hooks = CHUNK_HOOKS_INITIALIZER;
- void *nchunk = (void *)((uintptr_t)chunk +
- CHUNK_CEILING(usize));
-
- chunk_dalloc_cache(tsdn, arena, &chunk_hooks, nchunk, cdiff,
- true);
- }
- malloc_mutex_unlock(tsdn, &arena->lock);
-}
-
-static bool
-arena_chunk_ralloc_huge_expand_hard(tsdn_t *tsdn, arena_t *arena,
- chunk_hooks_t *chunk_hooks, void *chunk, size_t oldsize, size_t usize,
- bool *zero, void *nchunk, size_t udiff, size_t cdiff)
-{
- bool err;
- bool commit = true;
-
- err = (chunk_alloc_wrapper(tsdn, arena, chunk_hooks, nchunk, cdiff,
- chunksize, zero, &commit) == NULL);
- if (err) {
- /* Revert optimistic stats updates. */
- malloc_mutex_lock(tsdn, &arena->lock);
- if (config_stats) {
- arena_huge_ralloc_stats_update_undo(arena, oldsize,
- usize);
- arena->stats.mapped -= cdiff;
- }
- arena_nactive_sub(arena, udiff >> LG_PAGE);
- malloc_mutex_unlock(tsdn, &arena->lock);
- } else if (chunk_hooks->merge(chunk, CHUNK_CEILING(oldsize), nchunk,
- cdiff, true, arena->ind)) {
- chunk_dalloc_wrapper(tsdn, arena, chunk_hooks, nchunk, cdiff,
- *zero, true);
- err = true;
- }
- return (err);
-}
-
-bool
-arena_chunk_ralloc_huge_expand(tsdn_t *tsdn, arena_t *arena, void *chunk,
- size_t oldsize, size_t usize, bool *zero)
-{
- bool err;
- chunk_hooks_t chunk_hooks = chunk_hooks_get(tsdn, arena);
- void *nchunk = (void *)((uintptr_t)chunk + CHUNK_CEILING(oldsize));
- size_t udiff = usize - oldsize;
- size_t cdiff = CHUNK_CEILING(usize) - CHUNK_CEILING(oldsize);
- bool commit = true;
-
- malloc_mutex_lock(tsdn, &arena->lock);
-
- /* Optimistically update stats. */
- if (config_stats) {
- arena_huge_ralloc_stats_update(arena, oldsize, usize);
- arena->stats.mapped += cdiff;
- }
- arena_nactive_add(arena, udiff >> LG_PAGE);
-
- err = (chunk_alloc_cache(tsdn, arena, &chunk_hooks, nchunk, cdiff,
- chunksize, zero, &commit, true) == NULL);
- malloc_mutex_unlock(tsdn, &arena->lock);
- if (err) {
- err = arena_chunk_ralloc_huge_expand_hard(tsdn, arena,
- &chunk_hooks, chunk, oldsize, usize, zero, nchunk, udiff,
- cdiff);
- } else if (chunk_hooks.merge(chunk, CHUNK_CEILING(oldsize), nchunk,
- cdiff, true, arena->ind)) {
- chunk_dalloc_wrapper(tsdn, arena, &chunk_hooks, nchunk, cdiff,
- *zero, true);
- err = true;
- }
-
- return (err);
-}
-
-/*
- * Do first-best-fit run selection, i.e. select the lowest run that best fits.
- * Run sizes are indexed, so not all candidate runs are necessarily exactly the
- * same size.
- */
-static arena_run_t *
-arena_run_first_best_fit(arena_t *arena, size_t size)
-{
- pszind_t pind, i;
-
- pind = psz2ind(run_quantize_ceil(size));
-
- for (i = pind; pind2sz(i) <= chunksize; i++) {
- arena_chunk_map_misc_t *miscelm = arena_run_heap_first(
- &arena->runs_avail[i]);
- if (miscelm != NULL)
- return (&miscelm->run);
- }
-
- return (NULL);
-}
-
-static arena_run_t *
-arena_run_alloc_large_helper(arena_t *arena, size_t size, bool zero)
-{
- arena_run_t *run = arena_run_first_best_fit(arena, size);
- if (run != NULL) {
- if (arena_run_split_large(arena, run, size, zero))
- run = NULL;
- }
- return (run);
-}
-
-static arena_run_t *
-arena_run_alloc_large(tsdn_t *tsdn, arena_t *arena, size_t size, bool zero)
-{
- arena_chunk_t *chunk;
- arena_run_t *run;
-
- assert(size <= arena_maxrun);
- assert(size == PAGE_CEILING(size));
-
- /* Search the arena's chunks for the lowest best fit. */
- run = arena_run_alloc_large_helper(arena, size, zero);
- if (run != NULL)
- return (run);
-
- /*
- * No usable runs. Create a new chunk from which to allocate the run.
- */
- chunk = arena_chunk_alloc(tsdn, arena);
- if (chunk != NULL) {
- run = &arena_miscelm_get_mutable(chunk, map_bias)->run;
- if (arena_run_split_large(arena, run, size, zero))
- run = NULL;
- return (run);
- }
-
- /*
- * arena_chunk_alloc() failed, but another thread may have made
- * sufficient memory available while this one dropped arena->lock in
- * arena_chunk_alloc(), so search one more time.
- */
- return (arena_run_alloc_large_helper(arena, size, zero));
-}
-
-static arena_run_t *
-arena_run_alloc_small_helper(arena_t *arena, size_t size, szind_t binind)
-{
- arena_run_t *run = arena_run_first_best_fit(arena, size);
- if (run != NULL) {
- if (arena_run_split_small(arena, run, size, binind))
- run = NULL;
- }
- return (run);
-}
-
-static arena_run_t *
-arena_run_alloc_small(tsdn_t *tsdn, arena_t *arena, size_t size, szind_t binind)
-{
- arena_chunk_t *chunk;
- arena_run_t *run;
-
- assert(size <= arena_maxrun);
- assert(size == PAGE_CEILING(size));
- assert(binind != BININD_INVALID);
-
- /* Search the arena's chunks for the lowest best fit. */
- run = arena_run_alloc_small_helper(arena, size, binind);
- if (run != NULL)
- return (run);
-
- /*
- * No usable runs. Create a new chunk from which to allocate the run.
- */
- chunk = arena_chunk_alloc(tsdn, arena);
- if (chunk != NULL) {
- run = &arena_miscelm_get_mutable(chunk, map_bias)->run;
- if (arena_run_split_small(arena, run, size, binind))
- run = NULL;
- return (run);
- }
-
- /*
- * arena_chunk_alloc() failed, but another thread may have made
- * sufficient memory available while this one dropped arena->lock in
- * arena_chunk_alloc(), so search one more time.
- */
- return (arena_run_alloc_small_helper(arena, size, binind));
-}
-
-static bool
-arena_lg_dirty_mult_valid(ssize_t lg_dirty_mult)
-{
-
- return (lg_dirty_mult >= -1 && lg_dirty_mult < (ssize_t)(sizeof(size_t)
- << 3));
-}
-
-ssize_t
-arena_lg_dirty_mult_get(tsdn_t *tsdn, arena_t *arena)
-{
- ssize_t lg_dirty_mult;
-
- malloc_mutex_lock(tsdn, &arena->lock);
- lg_dirty_mult = arena->lg_dirty_mult;
- malloc_mutex_unlock(tsdn, &arena->lock);
-
- return (lg_dirty_mult);
-}
-
-bool
-arena_lg_dirty_mult_set(tsdn_t *tsdn, arena_t *arena, ssize_t lg_dirty_mult)
-{
-
- if (!arena_lg_dirty_mult_valid(lg_dirty_mult))
- return (true);
-
- malloc_mutex_lock(tsdn, &arena->lock);
- arena->lg_dirty_mult = lg_dirty_mult;
- arena_maybe_purge(tsdn, arena);
- malloc_mutex_unlock(tsdn, &arena->lock);
-
- return (false);
-}
-
-static void
-arena_decay_deadline_init(arena_t *arena)
-{
-
- assert(opt_purge == purge_mode_decay);
-
- /*
- * Generate a new deadline that is uniformly random within the next
- * epoch after the current one.
- */
- nstime_copy(&arena->decay.deadline, &arena->decay.epoch);
- nstime_add(&arena->decay.deadline, &arena->decay.interval);
- if (arena->decay.time > 0) {
- nstime_t jitter;
-
- nstime_init(&jitter, prng_range_u64(&arena->decay.jitter_state,
- nstime_ns(&arena->decay.interval)));
- nstime_add(&arena->decay.deadline, &jitter);
- }
-}
-
-static bool
-arena_decay_deadline_reached(const arena_t *arena, const nstime_t *time)
-{
-
- assert(opt_purge == purge_mode_decay);
-
- return (nstime_compare(&arena->decay.deadline, time) <= 0);
-}
-
-static size_t
-arena_decay_backlog_npages_limit(const arena_t *arena)
-{
- static const uint64_t h_steps[] = {
-#define STEP(step, h, x, y) \
- h,
- SMOOTHSTEP
-#undef STEP
- };
- uint64_t sum;
- size_t npages_limit_backlog;
- unsigned i;
-
- assert(opt_purge == purge_mode_decay);
-
- /*
- * For each element of decay_backlog, multiply by the corresponding
- * fixed-point smoothstep decay factor. Sum the products, then divide
- * to round down to the nearest whole number of pages.
- */
- sum = 0;
- for (i = 0; i < SMOOTHSTEP_NSTEPS; i++)
- sum += arena->decay.backlog[i] * h_steps[i];
- npages_limit_backlog = (size_t)(sum >> SMOOTHSTEP_BFP);
-
- return (npages_limit_backlog);
-}
-
-static void
-arena_decay_backlog_update_last(arena_t *arena)
-{
- size_t ndirty_delta = (arena->ndirty > arena->decay.ndirty) ?
- arena->ndirty - arena->decay.ndirty : 0;
- arena->decay.backlog[SMOOTHSTEP_NSTEPS-1] = ndirty_delta;
-}
-
-static void
-arena_decay_backlog_update(arena_t *arena, uint64_t nadvance_u64)
-{
-
- if (nadvance_u64 >= SMOOTHSTEP_NSTEPS) {
- memset(arena->decay.backlog, 0, (SMOOTHSTEP_NSTEPS-1) *
- sizeof(size_t));
- } else {
- size_t nadvance_z = (size_t)nadvance_u64;
-
- assert((uint64_t)nadvance_z == nadvance_u64);
-
- memmove(arena->decay.backlog, &arena->decay.backlog[nadvance_z],
- (SMOOTHSTEP_NSTEPS - nadvance_z) * sizeof(size_t));
- if (nadvance_z > 1) {
- memset(&arena->decay.backlog[SMOOTHSTEP_NSTEPS -
- nadvance_z], 0, (nadvance_z-1) * sizeof(size_t));
- }
- }
-
- arena_decay_backlog_update_last(arena);
-}
-
-static void
-arena_decay_epoch_advance_helper(arena_t *arena, const nstime_t *time)
-{
- uint64_t nadvance_u64;
- nstime_t delta;
-
- assert(opt_purge == purge_mode_decay);
- assert(arena_decay_deadline_reached(arena, time));
-
- nstime_copy(&delta, time);
- nstime_subtract(&delta, &arena->decay.epoch);
- nadvance_u64 = nstime_divide(&delta, &arena->decay.interval);
- assert(nadvance_u64 > 0);
-
- /* Add nadvance_u64 decay intervals to epoch. */
- nstime_copy(&delta, &arena->decay.interval);
- nstime_imultiply(&delta, nadvance_u64);
- nstime_add(&arena->decay.epoch, &delta);
-
- /* Set a new deadline. */
- arena_decay_deadline_init(arena);
-
- /* Update the backlog. */
- arena_decay_backlog_update(arena, nadvance_u64);
-}
-
-static void
-arena_decay_epoch_advance_purge(tsdn_t *tsdn, arena_t *arena)
-{
- size_t ndirty_limit = arena_decay_backlog_npages_limit(arena);
-
- if (arena->ndirty > ndirty_limit)
- arena_purge_to_limit(tsdn, arena, ndirty_limit);
- arena->decay.ndirty = arena->ndirty;
-}
-
-static void
-arena_decay_epoch_advance(tsdn_t *tsdn, arena_t *arena, const nstime_t *time)
-{
-
- arena_decay_epoch_advance_helper(arena, time);
- arena_decay_epoch_advance_purge(tsdn, arena);
-}
-
-static void
-arena_decay_init(arena_t *arena, ssize_t decay_time)
-{
-
- arena->decay.time = decay_time;
- if (decay_time > 0) {
- nstime_init2(&arena->decay.interval, decay_time, 0);
- nstime_idivide(&arena->decay.interval, SMOOTHSTEP_NSTEPS);
- }
-
- nstime_init(&arena->decay.epoch, 0);
- nstime_update(&arena->decay.epoch);
- arena->decay.jitter_state = (uint64_t)(uintptr_t)arena;
- arena_decay_deadline_init(arena);
- arena->decay.ndirty = arena->ndirty;
- memset(arena->decay.backlog, 0, SMOOTHSTEP_NSTEPS * sizeof(size_t));
-}
-
-static bool
-arena_decay_time_valid(ssize_t decay_time)
-{
-
- if (decay_time < -1)
- return (false);
- if (decay_time == -1 || (uint64_t)decay_time <= NSTIME_SEC_MAX)
- return (true);
- return (false);
-}
-
-ssize_t
-arena_decay_time_get(tsdn_t *tsdn, arena_t *arena)
-{
- ssize_t decay_time;
-
- malloc_mutex_lock(tsdn, &arena->lock);
- decay_time = arena->decay.time;
- malloc_mutex_unlock(tsdn, &arena->lock);
-
- return (decay_time);
-}
-
-bool
-arena_decay_time_set(tsdn_t *tsdn, arena_t *arena, ssize_t decay_time)
-{
-
- if (!arena_decay_time_valid(decay_time))
- return (true);
-
- malloc_mutex_lock(tsdn, &arena->lock);
- /*
- * Restart decay backlog from scratch, which may cause many dirty pages
- * to be immediately purged. It would conceptually be possible to map
- * the old backlog onto the new backlog, but there is no justification
- * for such complexity since decay_time changes are intended to be
- * infrequent, either between the {-1, 0, >0} states, or a one-time
- * arbitrary change during initial arena configuration.
- */
- arena_decay_init(arena, decay_time);
- arena_maybe_purge(tsdn, arena);
- malloc_mutex_unlock(tsdn, &arena->lock);
-
- return (false);
-}
-
-static void
-arena_maybe_purge_ratio(tsdn_t *tsdn, arena_t *arena)
-{
-
- assert(opt_purge == purge_mode_ratio);
-
- /* Don't purge if the option is disabled. */
- if (arena->lg_dirty_mult < 0)
- return;
-
- /*
- * Iterate, since preventing recursive purging could otherwise leave too
- * many dirty pages.
- */
- while (true) {
- size_t threshold = (arena->nactive >> arena->lg_dirty_mult);
- if (threshold < chunk_npages)
- threshold = chunk_npages;
- /*
- * Don't purge unless the number of purgeable pages exceeds the
- * threshold.
- */
- if (arena->ndirty <= threshold)
- return;
- arena_purge_to_limit(tsdn, arena, threshold);
- }
-}
-
-static void
-arena_maybe_purge_decay(tsdn_t *tsdn, arena_t *arena)
-{
- nstime_t time;
-
- assert(opt_purge == purge_mode_decay);
-
- /* Purge all or nothing if the option is disabled. */
- if (arena->decay.time <= 0) {
- if (arena->decay.time == 0)
- arena_purge_to_limit(tsdn, arena, 0);
- return;
- }
-
- nstime_init(&time, 0);
- nstime_update(&time);
- if (unlikely(!nstime_monotonic() && nstime_compare(&arena->decay.epoch,
- &time) > 0)) {
- /*
- * Time went backwards. Move the epoch back in time and
- * generate a new deadline, with the expectation that time
- * typically flows forward for long enough periods of time that
- * epochs complete. Unfortunately, this strategy is susceptible
- * to clock jitter triggering premature epoch advances, but
- * clock jitter estimation and compensation isn't feasible here
- * because calls into this code are event-driven.
- */
- nstime_copy(&arena->decay.epoch, &time);
- arena_decay_deadline_init(arena);
- } else {
- /* Verify that time does not go backwards. */
- assert(nstime_compare(&arena->decay.epoch, &time) <= 0);
- }
-
- /*
- * If the deadline has been reached, advance to the current epoch and
- * purge to the new limit if necessary. Note that dirty pages created
- * during the current epoch are not subject to purge until a future
- * epoch, so as a result purging only happens during epoch advances.
- */
- if (arena_decay_deadline_reached(arena, &time))
- arena_decay_epoch_advance(tsdn, arena, &time);
-}
-
-void
-arena_maybe_purge(tsdn_t *tsdn, arena_t *arena)
-{
-
- /* Don't recursively purge. */
- if (arena->purging)
- return;
-
- if (opt_purge == purge_mode_ratio)
- arena_maybe_purge_ratio(tsdn, arena);
- else
- arena_maybe_purge_decay(tsdn, arena);
-}
-
-static size_t
-arena_dirty_count(arena_t *arena)
-{
- size_t ndirty = 0;
- arena_runs_dirty_link_t *rdelm;
- extent_node_t *chunkselm;
-
- for (rdelm = qr_next(&arena->runs_dirty, rd_link),
- chunkselm = qr_next(&arena->chunks_cache, cc_link);
- rdelm != &arena->runs_dirty; rdelm = qr_next(rdelm, rd_link)) {
- size_t npages;
-
- if (rdelm == &chunkselm->rd) {
- npages = extent_node_size_get(chunkselm) >> LG_PAGE;
- chunkselm = qr_next(chunkselm, cc_link);
- } else {
- arena_chunk_t *chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(
- rdelm);
- arena_chunk_map_misc_t *miscelm =
- arena_rd_to_miscelm(rdelm);
- size_t pageind = arena_miscelm_to_pageind(miscelm);
- assert(arena_mapbits_allocated_get(chunk, pageind) ==
- 0);
- assert(arena_mapbits_large_get(chunk, pageind) == 0);
- assert(arena_mapbits_dirty_get(chunk, pageind) != 0);
- npages = arena_mapbits_unallocated_size_get(chunk,
- pageind) >> LG_PAGE;
- }
- ndirty += npages;
- }
-
- return (ndirty);
-}
-
-static size_t
-arena_stash_dirty(tsdn_t *tsdn, arena_t *arena, chunk_hooks_t *chunk_hooks,
- size_t ndirty_limit, arena_runs_dirty_link_t *purge_runs_sentinel,
- extent_node_t *purge_chunks_sentinel)
-{
- arena_runs_dirty_link_t *rdelm, *rdelm_next;
- extent_node_t *chunkselm;
- size_t nstashed = 0;
-
- /* Stash runs/chunks according to ndirty_limit. */
- for (rdelm = qr_next(&arena->runs_dirty, rd_link),
- chunkselm = qr_next(&arena->chunks_cache, cc_link);
- rdelm != &arena->runs_dirty; rdelm = rdelm_next) {
- size_t npages;
- rdelm_next = qr_next(rdelm, rd_link);
-
- if (rdelm == &chunkselm->rd) {
- extent_node_t *chunkselm_next;
- bool zero, commit;
- UNUSED void *chunk;
-
- npages = extent_node_size_get(chunkselm) >> LG_PAGE;
- if (opt_purge == purge_mode_decay && arena->ndirty -
- (nstashed + npages) < ndirty_limit)
- break;
-
- chunkselm_next = qr_next(chunkselm, cc_link);
- /*
- * Allocate. chunkselm remains valid due to the
- * dalloc_node=false argument to chunk_alloc_cache().
- */
- zero = false;
- commit = false;
- chunk = chunk_alloc_cache(tsdn, arena, chunk_hooks,
- extent_node_addr_get(chunkselm),
- extent_node_size_get(chunkselm), chunksize, &zero,
- &commit, false);
- assert(chunk == extent_node_addr_get(chunkselm));
- assert(zero == extent_node_zeroed_get(chunkselm));
- extent_node_dirty_insert(chunkselm, purge_runs_sentinel,
- purge_chunks_sentinel);
- assert(npages == (extent_node_size_get(chunkselm) >>
- LG_PAGE));
- chunkselm = chunkselm_next;
- } else {
- arena_chunk_t *chunk =
- (arena_chunk_t *)CHUNK_ADDR2BASE(rdelm);
- arena_chunk_map_misc_t *miscelm =
- arena_rd_to_miscelm(rdelm);
- size_t pageind = arena_miscelm_to_pageind(miscelm);
- arena_run_t *run = &miscelm->run;
- size_t run_size =
- arena_mapbits_unallocated_size_get(chunk, pageind);
-
- npages = run_size >> LG_PAGE;
- if (opt_purge == purge_mode_decay && arena->ndirty -
- (nstashed + npages) < ndirty_limit)
- break;
-
- assert(pageind + npages <= chunk_npages);
- assert(arena_mapbits_dirty_get(chunk, pageind) ==
- arena_mapbits_dirty_get(chunk, pageind+npages-1));
-
- /*
- * If purging the spare chunk's run, make it available
- * prior to allocation.
- */
- if (chunk == arena->spare)
- arena_chunk_alloc(tsdn, arena);
-
- /* Temporarily allocate the free dirty run. */
- arena_run_split_large(arena, run, run_size, false);
- /* Stash. */
- if (false)
- qr_new(rdelm, rd_link); /* Redundant. */
- else {
- assert(qr_next(rdelm, rd_link) == rdelm);
- assert(qr_prev(rdelm, rd_link) == rdelm);
- }
- qr_meld(purge_runs_sentinel, rdelm, rd_link);
- }
-
- nstashed += npages;
- if (opt_purge == purge_mode_ratio && arena->ndirty - nstashed <=
- ndirty_limit)
- break;
- }
-
- return (nstashed);
-}
-
-static size_t
-arena_purge_stashed(tsdn_t *tsdn, arena_t *arena, chunk_hooks_t *chunk_hooks,
- arena_runs_dirty_link_t *purge_runs_sentinel,
- extent_node_t *purge_chunks_sentinel)
-{
- size_t npurged, nmadvise;
- arena_runs_dirty_link_t *rdelm;
- extent_node_t *chunkselm;
-
- if (config_stats)
- nmadvise = 0;
- npurged = 0;
-
- malloc_mutex_unlock(tsdn, &arena->lock);
- for (rdelm = qr_next(purge_runs_sentinel, rd_link),
- chunkselm = qr_next(purge_chunks_sentinel, cc_link);
- rdelm != purge_runs_sentinel; rdelm = qr_next(rdelm, rd_link)) {
- size_t npages;
-
- if (rdelm == &chunkselm->rd) {
- /*
- * Don't actually purge the chunk here because 1)
- * chunkselm is embedded in the chunk and must remain
- * valid, and 2) we deallocate the chunk in
- * arena_unstash_purged(), where it is destroyed,
- * decommitted, or purged, depending on chunk
- * deallocation policy.
- */
- size_t size = extent_node_size_get(chunkselm);
- npages = size >> LG_PAGE;
- chunkselm = qr_next(chunkselm, cc_link);
- } else {
- size_t pageind, run_size, flag_unzeroed, flags, i;
- bool decommitted;
- arena_chunk_t *chunk =
- (arena_chunk_t *)CHUNK_ADDR2BASE(rdelm);
- arena_chunk_map_misc_t *miscelm =
- arena_rd_to_miscelm(rdelm);
- pageind = arena_miscelm_to_pageind(miscelm);
- run_size = arena_mapbits_large_size_get(chunk, pageind);
- npages = run_size >> LG_PAGE;
-
- assert(pageind + npages <= chunk_npages);
- assert(!arena_mapbits_decommitted_get(chunk, pageind));
- assert(!arena_mapbits_decommitted_get(chunk,
- pageind+npages-1));
- decommitted = !chunk_hooks->decommit(chunk, chunksize,
- pageind << LG_PAGE, npages << LG_PAGE, arena->ind);
- if (decommitted) {
- flag_unzeroed = 0;
- flags = CHUNK_MAP_DECOMMITTED;
- } else {
- flag_unzeroed = chunk_purge_wrapper(tsdn, arena,
- chunk_hooks, chunk, chunksize, pageind <<
- LG_PAGE, run_size) ? CHUNK_MAP_UNZEROED : 0;
- flags = flag_unzeroed;
- }
- arena_mapbits_large_set(chunk, pageind+npages-1, 0,
- flags);
- arena_mapbits_large_set(chunk, pageind, run_size,
- flags);
-
- /*
- * Set the unzeroed flag for internal pages, now that
- * chunk_purge_wrapper() has returned whether the pages
- * were zeroed as a side effect of purging. This chunk
- * map modification is safe even though the arena mutex
- * isn't currently owned by this thread, because the run
- * is marked as allocated, thus protecting it from being
- * modified by any other thread. As long as these
- * writes don't perturb the first and last elements'
- * CHUNK_MAP_ALLOCATED bits, behavior is well defined.
- */
- for (i = 1; i < npages-1; i++) {
- arena_mapbits_internal_set(chunk, pageind+i,
- flag_unzeroed);
- }
- }
-
- npurged += npages;
- if (config_stats)
- nmadvise++;
- }
- malloc_mutex_lock(tsdn, &arena->lock);
-
- if (config_stats) {
- arena->stats.nmadvise += nmadvise;
- arena->stats.purged += npurged;
- }
-
- return (npurged);
-}
-
-static void
-arena_unstash_purged(tsdn_t *tsdn, arena_t *arena, chunk_hooks_t *chunk_hooks,
- arena_runs_dirty_link_t *purge_runs_sentinel,
- extent_node_t *purge_chunks_sentinel)
-{
- arena_runs_dirty_link_t *rdelm, *rdelm_next;
- extent_node_t *chunkselm;
-
- /* Deallocate chunks/runs. */
- for (rdelm = qr_next(purge_runs_sentinel, rd_link),
- chunkselm = qr_next(purge_chunks_sentinel, cc_link);
- rdelm != purge_runs_sentinel; rdelm = rdelm_next) {
- rdelm_next = qr_next(rdelm, rd_link);
- if (rdelm == &chunkselm->rd) {
- extent_node_t *chunkselm_next = qr_next(chunkselm,
- cc_link);
- void *addr = extent_node_addr_get(chunkselm);
- size_t size = extent_node_size_get(chunkselm);
- bool zeroed = extent_node_zeroed_get(chunkselm);
- bool committed = extent_node_committed_get(chunkselm);
- extent_node_dirty_remove(chunkselm);
- arena_node_dalloc(tsdn, arena, chunkselm);
- chunkselm = chunkselm_next;
- chunk_dalloc_wrapper(tsdn, arena, chunk_hooks, addr,
- size, zeroed, committed);
- } else {
- arena_chunk_t *chunk =
- (arena_chunk_t *)CHUNK_ADDR2BASE(rdelm);
- arena_chunk_map_misc_t *miscelm =
- arena_rd_to_miscelm(rdelm);
- size_t pageind = arena_miscelm_to_pageind(miscelm);
- bool decommitted = (arena_mapbits_decommitted_get(chunk,
- pageind) != 0);
- arena_run_t *run = &miscelm->run;
- qr_remove(rdelm, rd_link);
- arena_run_dalloc(tsdn, arena, run, false, true,
- decommitted);
- }
- }
-}
-
-/*
- * NB: ndirty_limit is interpreted differently depending on opt_purge:
- * - purge_mode_ratio: Purge as few dirty run/chunks as possible to reach the
- * desired state:
- * (arena->ndirty <= ndirty_limit)
- * - purge_mode_decay: Purge as many dirty runs/chunks as possible without
- * violating the invariant:
- * (arena->ndirty >= ndirty_limit)
- */
-static void
-arena_purge_to_limit(tsdn_t *tsdn, arena_t *arena, size_t ndirty_limit)
-{
- chunk_hooks_t chunk_hooks = chunk_hooks_get(tsdn, arena);
- size_t npurge, npurged;
- arena_runs_dirty_link_t purge_runs_sentinel;
- extent_node_t purge_chunks_sentinel;
-
- arena->purging = true;
-
- /*
- * Calls to arena_dirty_count() are disabled even for debug builds
- * because overhead grows nonlinearly as memory usage increases.
- */
- if (false && config_debug) {
- size_t ndirty = arena_dirty_count(arena);
- assert(ndirty == arena->ndirty);
- }
- assert(opt_purge != purge_mode_ratio || (arena->nactive >>
- arena->lg_dirty_mult) < arena->ndirty || ndirty_limit == 0);
-
- qr_new(&purge_runs_sentinel, rd_link);
- extent_node_dirty_linkage_init(&purge_chunks_sentinel);
-
- npurge = arena_stash_dirty(tsdn, arena, &chunk_hooks, ndirty_limit,
- &purge_runs_sentinel, &purge_chunks_sentinel);
- if (npurge == 0)
- goto label_return;
- npurged = arena_purge_stashed(tsdn, arena, &chunk_hooks,
- &purge_runs_sentinel, &purge_chunks_sentinel);
- assert(npurged == npurge);
- arena_unstash_purged(tsdn, arena, &chunk_hooks, &purge_runs_sentinel,
- &purge_chunks_sentinel);
-
- if (config_stats)
- arena->stats.npurge++;
-
-label_return:
- arena->purging = false;
-}
-
-void
-arena_purge(tsdn_t *tsdn, arena_t *arena, bool all)
-{
-
- malloc_mutex_lock(tsdn, &arena->lock);
- if (all)
- arena_purge_to_limit(tsdn, arena, 0);
- else
- arena_maybe_purge(tsdn, arena);
- malloc_mutex_unlock(tsdn, &arena->lock);
-}
-
-static void
-arena_achunk_prof_reset(tsd_t *tsd, arena_t *arena, arena_chunk_t *chunk)
-{
- size_t pageind, npages;
-
- cassert(config_prof);
- assert(opt_prof);
-
- /*
- * Iterate over the allocated runs and remove profiled allocations from
- * the sample set.
- */
- for (pageind = map_bias; pageind < chunk_npages; pageind += npages) {
- if (arena_mapbits_allocated_get(chunk, pageind) != 0) {
- if (arena_mapbits_large_get(chunk, pageind) != 0) {
- void *ptr = (void *)((uintptr_t)chunk + (pageind
- << LG_PAGE));
- size_t usize = isalloc(tsd_tsdn(tsd), ptr,
- config_prof);
-
- prof_free(tsd, ptr, usize);
- npages = arena_mapbits_large_size_get(chunk,
- pageind) >> LG_PAGE;
- } else {
- /* Skip small run. */
- size_t binind = arena_mapbits_binind_get(chunk,
- pageind);
- arena_bin_info_t *bin_info =
- &arena_bin_info[binind];
- npages = bin_info->run_size >> LG_PAGE;
- }
- } else {
- /* Skip unallocated run. */
- npages = arena_mapbits_unallocated_size_get(chunk,
- pageind) >> LG_PAGE;
- }
- assert(pageind + npages <= chunk_npages);
- }
-}
-
-void
-arena_reset(tsd_t *tsd, arena_t *arena)
-{
- unsigned i;
- extent_node_t *node;
-
- /*
- * Locking in this function is unintuitive. The caller guarantees that
- * no concurrent operations are happening in this arena, but there are
- * still reasons that some locking is necessary:
- *
- * - Some of the functions in the transitive closure of calls assume
- * appropriate locks are held, and in some cases these locks are
- * temporarily dropped to avoid lock order reversal or deadlock due to
- * reentry.
- * - mallctl("epoch", ...) may concurrently refresh stats. While
- * strictly speaking this is a "concurrent operation", disallowing
- * stats refreshes would impose an inconvenient burden.
- */
-
- /* Remove large allocations from prof sample set. */
- if (config_prof && opt_prof) {
- ql_foreach(node, &arena->achunks, ql_link) {
- arena_achunk_prof_reset(tsd, arena,
- extent_node_addr_get(node));
- }
- }
-
- /* Reset curruns for large size classes. */
- if (config_stats) {
- for (i = 0; i < nlclasses; i++)
- arena->stats.lstats[i].curruns = 0;
- }
-
- /* Huge allocations. */
- malloc_mutex_lock(tsd_tsdn(tsd), &arena->huge_mtx);
- for (node = ql_last(&arena->huge, ql_link); node != NULL; node =
- ql_last(&arena->huge, ql_link)) {
- void *ptr = extent_node_addr_get(node);
- size_t usize;
-
- malloc_mutex_unlock(tsd_tsdn(tsd), &arena->huge_mtx);
- if (config_stats || (config_prof && opt_prof))
- usize = isalloc(tsd_tsdn(tsd), ptr, config_prof);
- /* Remove huge allocation from prof sample set. */
- if (config_prof && opt_prof)
- prof_free(tsd, ptr, usize);
- huge_dalloc(tsd_tsdn(tsd), ptr);
- malloc_mutex_lock(tsd_tsdn(tsd), &arena->huge_mtx);
- /* Cancel out unwanted effects on stats. */
- if (config_stats)
- arena_huge_reset_stats_cancel(arena, usize);
- }
- malloc_mutex_unlock(tsd_tsdn(tsd), &arena->huge_mtx);
-
- malloc_mutex_lock(tsd_tsdn(tsd), &arena->lock);
-
- /* Bins. */
- for (i = 0; i < NBINS; i++) {
- arena_bin_t *bin = &arena->bins[i];
- malloc_mutex_lock(tsd_tsdn(tsd), &bin->lock);
- bin->runcur = NULL;
- arena_run_heap_new(&bin->runs);
- if (config_stats) {
- bin->stats.curregs = 0;
- bin->stats.curruns = 0;
- }
- malloc_mutex_unlock(tsd_tsdn(tsd), &bin->lock);
- }
-
- /*
- * Re-initialize runs_dirty such that the chunks_cache and runs_dirty
- * chains directly correspond.
- */
- qr_new(&arena->runs_dirty, rd_link);
- for (node = qr_next(&arena->chunks_cache, cc_link);
- node != &arena->chunks_cache; node = qr_next(node, cc_link)) {
- qr_new(&node->rd, rd_link);
- qr_meld(&arena->runs_dirty, &node->rd, rd_link);
- }
-
- /* Arena chunks. */
- for (node = ql_last(&arena->achunks, ql_link); node != NULL; node =
- ql_last(&arena->achunks, ql_link)) {
- ql_remove(&arena->achunks, node, ql_link);
- arena_chunk_discard(tsd_tsdn(tsd), arena,
- extent_node_addr_get(node));
- }
-
- /* Spare. */
- if (arena->spare != NULL) {
- arena_chunk_discard(tsd_tsdn(tsd), arena, arena->spare);
- arena->spare = NULL;
- }
-
- assert(!arena->purging);
- arena->nactive = 0;
-
- for (i = 0; i < NPSIZES; i++)
- arena_run_heap_new(&arena->runs_avail[i]);
-
- malloc_mutex_unlock(tsd_tsdn(tsd), &arena->lock);
-}
-
-static void
-arena_run_coalesce(arena_t *arena, arena_chunk_t *chunk, size_t *p_size,
- size_t *p_run_ind, size_t *p_run_pages, size_t flag_dirty,
- size_t flag_decommitted)
-{
- size_t size = *p_size;
- size_t run_ind = *p_run_ind;
- size_t run_pages = *p_run_pages;
-
- /* Try to coalesce forward. */
- if (run_ind + run_pages < chunk_npages &&
- arena_mapbits_allocated_get(chunk, run_ind+run_pages) == 0 &&
- arena_mapbits_dirty_get(chunk, run_ind+run_pages) == flag_dirty &&
- arena_mapbits_decommitted_get(chunk, run_ind+run_pages) ==
- flag_decommitted) {
- size_t nrun_size = arena_mapbits_unallocated_size_get(chunk,
- run_ind+run_pages);
- size_t nrun_pages = nrun_size >> LG_PAGE;
-
- /*
- * Remove successor from runs_avail; the coalesced run is
- * inserted later.
- */
- assert(arena_mapbits_unallocated_size_get(chunk,
- run_ind+run_pages+nrun_pages-1) == nrun_size);
- assert(arena_mapbits_dirty_get(chunk,
- run_ind+run_pages+nrun_pages-1) == flag_dirty);
- assert(arena_mapbits_decommitted_get(chunk,
- run_ind+run_pages+nrun_pages-1) == flag_decommitted);
- arena_avail_remove(arena, chunk, run_ind+run_pages, nrun_pages);
-
- /*
- * If the successor is dirty, remove it from the set of dirty
- * pages.
- */
- if (flag_dirty != 0) {
- arena_run_dirty_remove(arena, chunk, run_ind+run_pages,
- nrun_pages);
- }
-
- size += nrun_size;
- run_pages += nrun_pages;
-
- arena_mapbits_unallocated_size_set(chunk, run_ind, size);
- arena_mapbits_unallocated_size_set(chunk, run_ind+run_pages-1,
- size);
- }
-
- /* Try to coalesce backward. */
- if (run_ind > map_bias && arena_mapbits_allocated_get(chunk,
- run_ind-1) == 0 && arena_mapbits_dirty_get(chunk, run_ind-1) ==
- flag_dirty && arena_mapbits_decommitted_get(chunk, run_ind-1) ==
- flag_decommitted) {
- size_t prun_size = arena_mapbits_unallocated_size_get(chunk,
- run_ind-1);
- size_t prun_pages = prun_size >> LG_PAGE;
-
- run_ind -= prun_pages;
-
- /*
- * Remove predecessor from runs_avail; the coalesced run is
- * inserted later.
- */
- assert(arena_mapbits_unallocated_size_get(chunk, run_ind) ==
- prun_size);
- assert(arena_mapbits_dirty_get(chunk, run_ind) == flag_dirty);
- assert(arena_mapbits_decommitted_get(chunk, run_ind) ==
- flag_decommitted);
- arena_avail_remove(arena, chunk, run_ind, prun_pages);
-
- /*
- * If the predecessor is dirty, remove it from the set of dirty
- * pages.
- */
- if (flag_dirty != 0) {
- arena_run_dirty_remove(arena, chunk, run_ind,
- prun_pages);
- }
-
- size += prun_size;
- run_pages += prun_pages;
-
- arena_mapbits_unallocated_size_set(chunk, run_ind, size);
- arena_mapbits_unallocated_size_set(chunk, run_ind+run_pages-1,
- size);
- }
-
- *p_size = size;
- *p_run_ind = run_ind;
- *p_run_pages = run_pages;
-}
-
-static size_t
-arena_run_size_get(arena_t *arena, arena_chunk_t *chunk, arena_run_t *run,
- size_t run_ind)
-{
- size_t size;
-
- assert(run_ind >= map_bias);
- assert(run_ind < chunk_npages);
-
- if (arena_mapbits_large_get(chunk, run_ind) != 0) {
- size = arena_mapbits_large_size_get(chunk, run_ind);
- assert(size == PAGE || arena_mapbits_large_size_get(chunk,
- run_ind+(size>>LG_PAGE)-1) == 0);
- } else {
- arena_bin_info_t *bin_info = &arena_bin_info[run->binind];
- size = bin_info->run_size;
- }
-
- return (size);
-}
-
-static void
-arena_run_dalloc(tsdn_t *tsdn, arena_t *arena, arena_run_t *run, bool dirty,
- bool cleaned, bool decommitted)
-{
- arena_chunk_t *chunk;
- arena_chunk_map_misc_t *miscelm;
- size_t size, run_ind, run_pages, flag_dirty, flag_decommitted;
-
- chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(run);
- miscelm = arena_run_to_miscelm(run);
- run_ind = arena_miscelm_to_pageind(miscelm);
- assert(run_ind >= map_bias);
- assert(run_ind < chunk_npages);
- size = arena_run_size_get(arena, chunk, run, run_ind);
- run_pages = (size >> LG_PAGE);
- arena_nactive_sub(arena, run_pages);
-
- /*
- * The run is dirty if the caller claims to have dirtied it, as well as
- * if it was already dirty before being allocated and the caller
- * doesn't claim to have cleaned it.
- */
- assert(arena_mapbits_dirty_get(chunk, run_ind) ==
- arena_mapbits_dirty_get(chunk, run_ind+run_pages-1));
- if (!cleaned && !decommitted && arena_mapbits_dirty_get(chunk, run_ind)
- != 0)
- dirty = true;
- flag_dirty = dirty ? CHUNK_MAP_DIRTY : 0;
- flag_decommitted = decommitted ? CHUNK_MAP_DECOMMITTED : 0;
-
- /* Mark pages as unallocated in the chunk map. */
- if (dirty || decommitted) {
- size_t flags = flag_dirty | flag_decommitted;
- arena_mapbits_unallocated_set(chunk, run_ind, size, flags);
- arena_mapbits_unallocated_set(chunk, run_ind+run_pages-1, size,
- flags);
- } else {
- arena_mapbits_unallocated_set(chunk, run_ind, size,
- arena_mapbits_unzeroed_get(chunk, run_ind));
- arena_mapbits_unallocated_set(chunk, run_ind+run_pages-1, size,
- arena_mapbits_unzeroed_get(chunk, run_ind+run_pages-1));
- }
-
- arena_run_coalesce(arena, chunk, &size, &run_ind, &run_pages,
- flag_dirty, flag_decommitted);
-
- /* Insert into runs_avail, now that coalescing is complete. */
- assert(arena_mapbits_unallocated_size_get(chunk, run_ind) ==
- arena_mapbits_unallocated_size_get(chunk, run_ind+run_pages-1));
- assert(arena_mapbits_dirty_get(chunk, run_ind) ==
- arena_mapbits_dirty_get(chunk, run_ind+run_pages-1));
- assert(arena_mapbits_decommitted_get(chunk, run_ind) ==
- arena_mapbits_decommitted_get(chunk, run_ind+run_pages-1));
- arena_avail_insert(arena, chunk, run_ind, run_pages);
-
- if (dirty)
- arena_run_dirty_insert(arena, chunk, run_ind, run_pages);
-
- /* Deallocate chunk if it is now completely unused. */
- if (size == arena_maxrun) {
- assert(run_ind == map_bias);
- assert(run_pages == (arena_maxrun >> LG_PAGE));
- arena_chunk_dalloc(tsdn, arena, chunk);
- }
-
- /*
- * It is okay to do dirty page processing here even if the chunk was
- * deallocated above, since in that case it is the spare. Waiting
- * until after possible chunk deallocation to do dirty processing
- * allows for an old spare to be fully deallocated, thus decreasing the
- * chances of spuriously crossing the dirty page purging threshold.
- */
- if (dirty)
- arena_maybe_purge(tsdn, arena);
-}
-
-static void
-arena_run_trim_head(tsdn_t *tsdn, arena_t *arena, arena_chunk_t *chunk,
- arena_run_t *run, size_t oldsize, size_t newsize)
-{
- arena_chunk_map_misc_t *miscelm = arena_run_to_miscelm(run);
- size_t pageind = arena_miscelm_to_pageind(miscelm);
- size_t head_npages = (oldsize - newsize) >> LG_PAGE;
- size_t flag_dirty = arena_mapbits_dirty_get(chunk, pageind);
- size_t flag_decommitted = arena_mapbits_decommitted_get(chunk, pageind);
- size_t flag_unzeroed_mask = (flag_dirty | flag_decommitted) == 0 ?
- CHUNK_MAP_UNZEROED : 0;
-
- assert(oldsize > newsize);
-
- /*
- * Update the chunk map so that arena_run_dalloc() can treat the
- * leading run as separately allocated. Set the last element of each
- * run first, in case of single-page runs.
- */
- assert(arena_mapbits_large_size_get(chunk, pageind) == oldsize);
- arena_mapbits_large_set(chunk, pageind+head_npages-1, 0, flag_dirty |
- (flag_unzeroed_mask & arena_mapbits_unzeroed_get(chunk,
- pageind+head_npages-1)));
- arena_mapbits_large_set(chunk, pageind, oldsize-newsize, flag_dirty |
- (flag_unzeroed_mask & arena_mapbits_unzeroed_get(chunk, pageind)));
-
- if (config_debug) {
- UNUSED size_t tail_npages = newsize >> LG_PAGE;
- assert(arena_mapbits_large_size_get(chunk,
- pageind+head_npages+tail_npages-1) == 0);
- assert(arena_mapbits_dirty_get(chunk,
- pageind+head_npages+tail_npages-1) == flag_dirty);
- }
- arena_mapbits_large_set(chunk, pageind+head_npages, newsize,
- flag_dirty | (flag_unzeroed_mask & arena_mapbits_unzeroed_get(chunk,
- pageind+head_npages)));
-
- arena_run_dalloc(tsdn, arena, run, false, false, (flag_decommitted !=
- 0));
-}
-
-static void
-arena_run_trim_tail(tsdn_t *tsdn, arena_t *arena, arena_chunk_t *chunk,
- arena_run_t *run, size_t oldsize, size_t newsize, bool dirty)
-{
- arena_chunk_map_misc_t *miscelm = arena_run_to_miscelm(run);
- size_t pageind = arena_miscelm_to_pageind(miscelm);
- size_t head_npages = newsize >> LG_PAGE;
- size_t flag_dirty = arena_mapbits_dirty_get(chunk, pageind);
- size_t flag_decommitted = arena_mapbits_decommitted_get(chunk, pageind);
- size_t flag_unzeroed_mask = (flag_dirty | flag_decommitted) == 0 ?
- CHUNK_MAP_UNZEROED : 0;
- arena_chunk_map_misc_t *tail_miscelm;
- arena_run_t *tail_run;
-
- assert(oldsize > newsize);
-
- /*
- * Update the chunk map so that arena_run_dalloc() can treat the
- * trailing run as separately allocated. Set the last element of each
- * run first, in case of single-page runs.
- */
- assert(arena_mapbits_large_size_get(chunk, pageind) == oldsize);
- arena_mapbits_large_set(chunk, pageind+head_npages-1, 0, flag_dirty |
- (flag_unzeroed_mask & arena_mapbits_unzeroed_get(chunk,
- pageind+head_npages-1)));
- arena_mapbits_large_set(chunk, pageind, newsize, flag_dirty |
- (flag_unzeroed_mask & arena_mapbits_unzeroed_get(chunk, pageind)));
-
- if (config_debug) {
- UNUSED size_t tail_npages = (oldsize - newsize) >> LG_PAGE;
- assert(arena_mapbits_large_size_get(chunk,
- pageind+head_npages+tail_npages-1) == 0);
- assert(arena_mapbits_dirty_get(chunk,
- pageind+head_npages+tail_npages-1) == flag_dirty);
- }
- arena_mapbits_large_set(chunk, pageind+head_npages, oldsize-newsize,
- flag_dirty | (flag_unzeroed_mask & arena_mapbits_unzeroed_get(chunk,
- pageind+head_npages)));
-
- tail_miscelm = arena_miscelm_get_mutable(chunk, pageind + head_npages);
- tail_run = &tail_miscelm->run;
- arena_run_dalloc(tsdn, arena, tail_run, dirty, false, (flag_decommitted
- != 0));
-}
-
-static void
-arena_bin_runs_insert(arena_bin_t *bin, arena_run_t *run)
-{
- arena_chunk_map_misc_t *miscelm = arena_run_to_miscelm(run);
-
- arena_run_heap_insert(&bin->runs, miscelm);
-}
-
-static arena_run_t *
-arena_bin_nonfull_run_tryget(arena_bin_t *bin)
-{
- arena_chunk_map_misc_t *miscelm;
-
- miscelm = arena_run_heap_remove_first(&bin->runs);
- if (miscelm == NULL)
- return (NULL);
- if (config_stats)
- bin->stats.reruns++;
-
- return (&miscelm->run);
-}
-
-static arena_run_t *
-arena_bin_nonfull_run_get(tsdn_t *tsdn, arena_t *arena, arena_bin_t *bin)
-{
- arena_run_t *run;
- szind_t binind;
- arena_bin_info_t *bin_info;
-
- /* Look for a usable run. */
- run = arena_bin_nonfull_run_tryget(bin);
- if (run != NULL)
- return (run);
- /* No existing runs have any space available. */
-
- binind = arena_bin_index(arena, bin);
- bin_info = &arena_bin_info[binind];
-
- /* Allocate a new run. */
- malloc_mutex_unlock(tsdn, &bin->lock);
- /******************************/
- malloc_mutex_lock(tsdn, &arena->lock);
- run = arena_run_alloc_small(tsdn, arena, bin_info->run_size, binind);
- if (run != NULL) {
- /* Initialize run internals. */
- run->binind = binind;
- run->nfree = bin_info->nregs;
- bitmap_init(run->bitmap, &bin_info->bitmap_info);
- }
- malloc_mutex_unlock(tsdn, &arena->lock);
- /********************************/
- malloc_mutex_lock(tsdn, &bin->lock);
- if (run != NULL) {
- if (config_stats) {
- bin->stats.nruns++;
- bin->stats.curruns++;
- }
- return (run);
- }
-
- /*
- * arena_run_alloc_small() failed, but another thread may have made
- * sufficient memory available while this one dropped bin->lock above,
- * so search one more time.
- */
- run = arena_bin_nonfull_run_tryget(bin);
- if (run != NULL)
- return (run);
-
- return (NULL);
-}
-
-/* Re-fill bin->runcur, then call arena_run_reg_alloc(). */
-static void *
-arena_bin_malloc_hard(tsdn_t *tsdn, arena_t *arena, arena_bin_t *bin)
-{
- szind_t binind;
- arena_bin_info_t *bin_info;
- arena_run_t *run;
-
- binind = arena_bin_index(arena, bin);
- bin_info = &arena_bin_info[binind];
- bin->runcur = NULL;
- run = arena_bin_nonfull_run_get(tsdn, arena, bin);
- if (bin->runcur != NULL && bin->runcur->nfree > 0) {
- /*
- * Another thread updated runcur while this one ran without the
- * bin lock in arena_bin_nonfull_run_get().
- */
- void *ret;
- assert(bin->runcur->nfree > 0);
- ret = arena_run_reg_alloc(bin->runcur, bin_info);
- if (run != NULL) {
- arena_chunk_t *chunk;
-
- /*
- * arena_run_alloc_small() may have allocated run, or
- * it may have pulled run from the bin's run tree.
- * Therefore it is unsafe to make any assumptions about
- * how run has previously been used, and
- * arena_bin_lower_run() must be called, as if a region
- * were just deallocated from the run.
- */
- chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(run);
- if (run->nfree == bin_info->nregs) {
- arena_dalloc_bin_run(tsdn, arena, chunk, run,
- bin);
- } else
- arena_bin_lower_run(arena, chunk, run, bin);
- }
- return (ret);
- }
-
- if (run == NULL)
- return (NULL);
-
- bin->runcur = run;
-
- assert(bin->runcur->nfree > 0);
-
- return (arena_run_reg_alloc(bin->runcur, bin_info));
-}
-
-void
-arena_tcache_fill_small(tsdn_t *tsdn, arena_t *arena, tcache_bin_t *tbin,
- szind_t binind, uint64_t prof_accumbytes)
-{
- unsigned i, nfill;
- arena_bin_t *bin;
-
- assert(tbin->ncached == 0);
-
- if (config_prof && arena_prof_accum(tsdn, arena, prof_accumbytes))
- prof_idump(tsdn);
- bin = &arena->bins[binind];
- malloc_mutex_lock(tsdn, &bin->lock);
- for (i = 0, nfill = (tcache_bin_info[binind].ncached_max >>
- tbin->lg_fill_div); i < nfill; i++) {
- arena_run_t *run;
- void *ptr;
- if ((run = bin->runcur) != NULL && run->nfree > 0)
- ptr = arena_run_reg_alloc(run, &arena_bin_info[binind]);
- else
- ptr = arena_bin_malloc_hard(tsdn, arena, bin);
- if (ptr == NULL) {
- /*
- * OOM. tbin->avail isn't yet filled down to its first
- * element, so the successful allocations (if any) must
- * be moved just before tbin->avail before bailing out.
- */
- if (i > 0) {
- memmove(tbin->avail - i, tbin->avail - nfill,
- i * sizeof(void *));
- }
- break;
- }
- if (config_fill && unlikely(opt_junk_alloc)) {
- arena_alloc_junk_small(ptr, &arena_bin_info[binind],
- true);
- }
- /* Insert such that low regions get used first. */
- *(tbin->avail - nfill + i) = ptr;
- }
- if (config_stats) {
- bin->stats.nmalloc += i;
- bin->stats.nrequests += tbin->tstats.nrequests;
- bin->stats.curregs += i;
- bin->stats.nfills++;
- tbin->tstats.nrequests = 0;
- }
- malloc_mutex_unlock(tsdn, &bin->lock);
- tbin->ncached = i;
- arena_decay_tick(tsdn, arena);
-}
-
-void
-arena_alloc_junk_small(void *ptr, arena_bin_info_t *bin_info, bool zero)
-{
-
- size_t redzone_size = bin_info->redzone_size;
-
- if (zero) {
- memset((void *)((uintptr_t)ptr - redzone_size),
- JEMALLOC_ALLOC_JUNK, redzone_size);
- memset((void *)((uintptr_t)ptr + bin_info->reg_size),
- JEMALLOC_ALLOC_JUNK, redzone_size);
- } else {
- memset((void *)((uintptr_t)ptr - redzone_size),
- JEMALLOC_ALLOC_JUNK, bin_info->reg_interval);
- }
-}
-
-#ifdef JEMALLOC_JET
-#undef arena_redzone_corruption
-#define arena_redzone_corruption JEMALLOC_N(n_arena_redzone_corruption)
-#endif
-static void
-arena_redzone_corruption(void *ptr, size_t usize, bool after,
- size_t offset, uint8_t byte)
-{
-
- malloc_printf("<jemalloc>: Corrupt redzone %zu byte%s %s %p "
- "(size %zu), byte=%#x\n", offset, (offset == 1) ? "" : "s",
- after ? "after" : "before", ptr, usize, byte);
-}
-#ifdef JEMALLOC_JET
-#undef arena_redzone_corruption
-#define arena_redzone_corruption JEMALLOC_N(arena_redzone_corruption)
-arena_redzone_corruption_t *arena_redzone_corruption =
- JEMALLOC_N(n_arena_redzone_corruption);
-#endif
-
-static void
-arena_redzones_validate(void *ptr, arena_bin_info_t *bin_info, bool reset)
-{
- bool error = false;
-
- if (opt_junk_alloc) {
- size_t size = bin_info->reg_size;
- size_t redzone_size = bin_info->redzone_size;
- size_t i;
-
- for (i = 1; i <= redzone_size; i++) {
- uint8_t *byte = (uint8_t *)((uintptr_t)ptr - i);
- if (*byte != JEMALLOC_ALLOC_JUNK) {
- error = true;
- arena_redzone_corruption(ptr, size, false, i,
- *byte);
- if (reset)
- *byte = JEMALLOC_ALLOC_JUNK;
- }
- }
- for (i = 0; i < redzone_size; i++) {
- uint8_t *byte = (uint8_t *)((uintptr_t)ptr + size + i);
- if (*byte != JEMALLOC_ALLOC_JUNK) {
- error = true;
- arena_redzone_corruption(ptr, size, true, i,
- *byte);
- if (reset)
- *byte = JEMALLOC_ALLOC_JUNK;
- }
- }
- }
-
- if (opt_abort && error)
- abort();
-}
-
-#ifdef JEMALLOC_JET
-#undef arena_dalloc_junk_small
-#define arena_dalloc_junk_small JEMALLOC_N(n_arena_dalloc_junk_small)
-#endif
-void
-arena_dalloc_junk_small(void *ptr, arena_bin_info_t *bin_info)
-{
- size_t redzone_size = bin_info->redzone_size;
-
- arena_redzones_validate(ptr, bin_info, false);
- memset((void *)((uintptr_t)ptr - redzone_size), JEMALLOC_FREE_JUNK,
- bin_info->reg_interval);
-}
-#ifdef JEMALLOC_JET
-#undef arena_dalloc_junk_small
-#define arena_dalloc_junk_small JEMALLOC_N(arena_dalloc_junk_small)
-arena_dalloc_junk_small_t *arena_dalloc_junk_small =
- JEMALLOC_N(n_arena_dalloc_junk_small);
-#endif
-
-void
-arena_quarantine_junk_small(void *ptr, size_t usize)
-{
- szind_t binind;
- arena_bin_info_t *bin_info;
- cassert(config_fill);
- assert(opt_junk_free);
- assert(opt_quarantine);
- assert(usize <= SMALL_MAXCLASS);
-
- binind = size2index(usize);
- bin_info = &arena_bin_info[binind];
- arena_redzones_validate(ptr, bin_info, true);
-}
-
-static void *
-arena_malloc_small(tsdn_t *tsdn, arena_t *arena, szind_t binind, bool zero)
-{
- void *ret;
- arena_bin_t *bin;
- size_t usize;
- arena_run_t *run;
-
- assert(binind < NBINS);
- bin = &arena->bins[binind];
- usize = index2size(binind);
-
- malloc_mutex_lock(tsdn, &bin->lock);
- if ((run = bin->runcur) != NULL && run->nfree > 0)
- ret = arena_run_reg_alloc(run, &arena_bin_info[binind]);
- else
- ret = arena_bin_malloc_hard(tsdn, arena, bin);
-
- if (ret == NULL) {
- malloc_mutex_unlock(tsdn, &bin->lock);
- return (NULL);
- }
-
- if (config_stats) {
- bin->stats.nmalloc++;
- bin->stats.nrequests++;
- bin->stats.curregs++;
- }
- malloc_mutex_unlock(tsdn, &bin->lock);
- if (config_prof && !isthreaded && arena_prof_accum(tsdn, arena, usize))
- prof_idump(tsdn);
-
- if (!zero) {
- if (config_fill) {
- if (unlikely(opt_junk_alloc)) {
- arena_alloc_junk_small(ret,
- &arena_bin_info[binind], false);
- } else if (unlikely(opt_zero))
- memset(ret, 0, usize);
- }
- JEMALLOC_VALGRIND_MAKE_MEM_UNDEFINED(ret, usize);
- } else {
- if (config_fill && unlikely(opt_junk_alloc)) {
- arena_alloc_junk_small(ret, &arena_bin_info[binind],
- true);
- }
- JEMALLOC_VALGRIND_MAKE_MEM_UNDEFINED(ret, usize);
- memset(ret, 0, usize);
- }
-
- arena_decay_tick(tsdn, arena);
- return (ret);
-}
-
-void *
-arena_malloc_large(tsdn_t *tsdn, arena_t *arena, szind_t binind, bool zero)
-{
- void *ret;
- size_t usize;
- uintptr_t random_offset;
- arena_run_t *run;
- arena_chunk_map_misc_t *miscelm;
- UNUSED bool idump JEMALLOC_CC_SILENCE_INIT(false);
-
- /* Large allocation. */
- usize = index2size(binind);
- malloc_mutex_lock(tsdn, &arena->lock);
- if (config_cache_oblivious) {
- uint64_t r;
-
- /*
- * Compute a uniformly distributed offset within the first page
- * that is a multiple of the cacheline size, e.g. [0 .. 63) * 64
- * for 4 KiB pages and 64-byte cachelines.
- */
- r = prng_lg_range_zu(&arena->offset_state, LG_PAGE -
- LG_CACHELINE, false);
- random_offset = ((uintptr_t)r) << LG_CACHELINE;
- } else
- random_offset = 0;
- run = arena_run_alloc_large(tsdn, arena, usize + large_pad, zero);
- if (run == NULL) {
- malloc_mutex_unlock(tsdn, &arena->lock);
- return (NULL);
- }
- miscelm = arena_run_to_miscelm(run);
- ret = (void *)((uintptr_t)arena_miscelm_to_rpages(miscelm) +
- random_offset);
- if (config_stats) {
- szind_t index = binind - NBINS;
-
- arena->stats.nmalloc_large++;
- arena->stats.nrequests_large++;
- arena->stats.allocated_large += usize;
- arena->stats.lstats[index].nmalloc++;
- arena->stats.lstats[index].nrequests++;
- arena->stats.lstats[index].curruns++;
- }
- if (config_prof)
- idump = arena_prof_accum_locked(arena, usize);
- malloc_mutex_unlock(tsdn, &arena->lock);
- if (config_prof && idump)
- prof_idump(tsdn);
-
- if (!zero) {
- if (config_fill) {
- if (unlikely(opt_junk_alloc))
- memset(ret, JEMALLOC_ALLOC_JUNK, usize);
- else if (unlikely(opt_zero))
- memset(ret, 0, usize);
- }
- }
-
- arena_decay_tick(tsdn, arena);
- return (ret);
-}
-
-void *
-arena_malloc_hard(tsdn_t *tsdn, arena_t *arena, size_t size, szind_t ind,
- bool zero)
-{
-
- assert(!tsdn_null(tsdn) || arena != NULL);
-
- if (likely(!tsdn_null(tsdn)))
- arena = arena_choose(tsdn_tsd(tsdn), arena);
- if (unlikely(arena == NULL))
- return (NULL);
-
- if (likely(size <= SMALL_MAXCLASS))
- return (arena_malloc_small(tsdn, arena, ind, zero));
- if (likely(size <= large_maxclass))
- return (arena_malloc_large(tsdn, arena, ind, zero));
- return (huge_malloc(tsdn, arena, index2size(ind), zero));
-}
-
-/* Only handles large allocations that require more than page alignment. */
-static void *
-arena_palloc_large(tsdn_t *tsdn, arena_t *arena, size_t usize, size_t alignment,
- bool zero)
-{
- void *ret;
- size_t alloc_size, leadsize, trailsize;
- arena_run_t *run;
- arena_chunk_t *chunk;
- arena_chunk_map_misc_t *miscelm;
- void *rpages;
-
- assert(!tsdn_null(tsdn) || arena != NULL);
- assert(usize == PAGE_CEILING(usize));
-
- if (likely(!tsdn_null(tsdn)))
- arena = arena_choose(tsdn_tsd(tsdn), arena);
- if (unlikely(arena == NULL))
- return (NULL);
-
- alignment = PAGE_CEILING(alignment);
- alloc_size = usize + large_pad + alignment - PAGE;
-
- malloc_mutex_lock(tsdn, &arena->lock);
- run = arena_run_alloc_large(tsdn, arena, alloc_size, false);
- if (run == NULL) {
- malloc_mutex_unlock(tsdn, &arena->lock);
- return (NULL);
- }
- chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(run);
- miscelm = arena_run_to_miscelm(run);
- rpages = arena_miscelm_to_rpages(miscelm);
-
- leadsize = ALIGNMENT_CEILING((uintptr_t)rpages, alignment) -
- (uintptr_t)rpages;
- assert(alloc_size >= leadsize + usize);
- trailsize = alloc_size - leadsize - usize - large_pad;
- if (leadsize != 0) {
- arena_chunk_map_misc_t *head_miscelm = miscelm;
- arena_run_t *head_run = run;
-
- miscelm = arena_miscelm_get_mutable(chunk,
- arena_miscelm_to_pageind(head_miscelm) + (leadsize >>
- LG_PAGE));
- run = &miscelm->run;
-
- arena_run_trim_head(tsdn, arena, chunk, head_run, alloc_size,
- alloc_size - leadsize);
- }
- if (trailsize != 0) {
- arena_run_trim_tail(tsdn, arena, chunk, run, usize + large_pad +
- trailsize, usize + large_pad, false);
- }
- if (arena_run_init_large(arena, run, usize + large_pad, zero)) {
- size_t run_ind =
- arena_miscelm_to_pageind(arena_run_to_miscelm(run));
- bool dirty = (arena_mapbits_dirty_get(chunk, run_ind) != 0);
- bool decommitted = (arena_mapbits_decommitted_get(chunk,
- run_ind) != 0);
-
- assert(decommitted); /* Cause of OOM. */
- arena_run_dalloc(tsdn, arena, run, dirty, false, decommitted);
- malloc_mutex_unlock(tsdn, &arena->lock);
- return (NULL);
- }
- ret = arena_miscelm_to_rpages(miscelm);
-
- if (config_stats) {
- szind_t index = size2index(usize) - NBINS;
-
- arena->stats.nmalloc_large++;
- arena->stats.nrequests_large++;
- arena->stats.allocated_large += usize;
- arena->stats.lstats[index].nmalloc++;
- arena->stats.lstats[index].nrequests++;
- arena->stats.lstats[index].curruns++;
- }
- malloc_mutex_unlock(tsdn, &arena->lock);
-
- if (config_fill && !zero) {
- if (unlikely(opt_junk_alloc))
- memset(ret, JEMALLOC_ALLOC_JUNK, usize);
- else if (unlikely(opt_zero))
- memset(ret, 0, usize);
- }
- arena_decay_tick(tsdn, arena);
- return (ret);
-}
-
-void *
-arena_palloc(tsdn_t *tsdn, arena_t *arena, size_t usize, size_t alignment,
- bool zero, tcache_t *tcache)
-{
- void *ret;
-
- if (usize <= SMALL_MAXCLASS && (alignment < PAGE || (alignment == PAGE
- && (usize & PAGE_MASK) == 0))) {
- /* Small; alignment doesn't require special run placement. */
- ret = arena_malloc(tsdn, arena, usize, size2index(usize), zero,
- tcache, true);
- } else if (usize <= large_maxclass && alignment <= PAGE) {
- /*
- * Large; alignment doesn't require special run placement.
- * However, the cached pointer may be at a random offset from
- * the base of the run, so do some bit manipulation to retrieve
- * the base.
- */
- ret = arena_malloc(tsdn, arena, usize, size2index(usize), zero,
- tcache, true);
- if (config_cache_oblivious)
- ret = (void *)((uintptr_t)ret & ~PAGE_MASK);
- } else {
- if (likely(usize <= large_maxclass)) {
- ret = arena_palloc_large(tsdn, arena, usize, alignment,
- zero);
- } else if (likely(alignment <= chunksize))
- ret = huge_malloc(tsdn, arena, usize, zero);
- else {
- ret = huge_palloc(tsdn, arena, usize, alignment, zero);
- }
- }
- return (ret);
-}
-
-void
-arena_prof_promoted(tsdn_t *tsdn, const void *ptr, size_t size)
-{
- arena_chunk_t *chunk;
- size_t pageind;
- szind_t binind;
-
- cassert(config_prof);
- assert(ptr != NULL);
- assert(CHUNK_ADDR2BASE(ptr) != ptr);
- assert(isalloc(tsdn, ptr, false) == LARGE_MINCLASS);
- assert(isalloc(tsdn, ptr, true) == LARGE_MINCLASS);
- assert(size <= SMALL_MAXCLASS);
-
- chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr);
- pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> LG_PAGE;
- binind = size2index(size);
- assert(binind < NBINS);
- arena_mapbits_large_binind_set(chunk, pageind, binind);
-
- assert(isalloc(tsdn, ptr, false) == LARGE_MINCLASS);
- assert(isalloc(tsdn, ptr, true) == size);
-}
-
-static void
-arena_dissociate_bin_run(arena_chunk_t *chunk, arena_run_t *run,
- arena_bin_t *bin)
-{
-
- /* Dissociate run from bin. */
- if (run == bin->runcur)
- bin->runcur = NULL;
- else {
- szind_t binind = arena_bin_index(extent_node_arena_get(
- &chunk->node), bin);
- arena_bin_info_t *bin_info = &arena_bin_info[binind];
-
- /*
- * The following block's conditional is necessary because if the
- * run only contains one region, then it never gets inserted
- * into the non-full runs tree.
- */
- if (bin_info->nregs != 1) {
- arena_chunk_map_misc_t *miscelm =
- arena_run_to_miscelm(run);
-
- arena_run_heap_remove(&bin->runs, miscelm);
- }
- }
-}
-
-static void
-arena_dalloc_bin_run(tsdn_t *tsdn, arena_t *arena, arena_chunk_t *chunk,
- arena_run_t *run, arena_bin_t *bin)
-{
-
- assert(run != bin->runcur);
-
- malloc_mutex_unlock(tsdn, &bin->lock);
- /******************************/
- malloc_mutex_lock(tsdn, &arena->lock);
- arena_run_dalloc(tsdn, arena, run, true, false, false);
- malloc_mutex_unlock(tsdn, &arena->lock);
- /****************************/
- malloc_mutex_lock(tsdn, &bin->lock);
- if (config_stats)
- bin->stats.curruns--;
-}
-
-static void
-arena_bin_lower_run(arena_t *arena, arena_chunk_t *chunk, arena_run_t *run,
- arena_bin_t *bin)
-{
-
- /*
- * Make sure that if bin->runcur is non-NULL, it refers to the lowest
- * non-full run. It is okay to NULL runcur out rather than proactively
- * keeping it pointing at the lowest non-full run.
- */
- if ((uintptr_t)run < (uintptr_t)bin->runcur) {
- /* Switch runcur. */
- if (bin->runcur->nfree > 0)
- arena_bin_runs_insert(bin, bin->runcur);
- bin->runcur = run;
- if (config_stats)
- bin->stats.reruns++;
- } else
- arena_bin_runs_insert(bin, run);
-}
-
-static void
-arena_dalloc_bin_locked_impl(tsdn_t *tsdn, arena_t *arena, arena_chunk_t *chunk,
- void *ptr, arena_chunk_map_bits_t *bitselm, bool junked)
-{
- size_t pageind, rpages_ind;
- arena_run_t *run;
- arena_bin_t *bin;
- arena_bin_info_t *bin_info;
- szind_t binind;
-
- pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> LG_PAGE;
- rpages_ind = pageind - arena_mapbits_small_runind_get(chunk, pageind);
- run = &arena_miscelm_get_mutable(chunk, rpages_ind)->run;
- binind = run->binind;
- bin = &arena->bins[binind];
- bin_info = &arena_bin_info[binind];
-
- if (!junked && config_fill && unlikely(opt_junk_free))
- arena_dalloc_junk_small(ptr, bin_info);
-
- arena_run_reg_dalloc(run, ptr);
- if (run->nfree == bin_info->nregs) {
- arena_dissociate_bin_run(chunk, run, bin);
- arena_dalloc_bin_run(tsdn, arena, chunk, run, bin);
- } else if (run->nfree == 1 && run != bin->runcur)
- arena_bin_lower_run(arena, chunk, run, bin);
-
- if (config_stats) {
- bin->stats.ndalloc++;
- bin->stats.curregs--;
- }
-}
-
-void
-arena_dalloc_bin_junked_locked(tsdn_t *tsdn, arena_t *arena,
- arena_chunk_t *chunk, void *ptr, arena_chunk_map_bits_t *bitselm)
-{
-
- arena_dalloc_bin_locked_impl(tsdn, arena, chunk, ptr, bitselm, true);
-}
-
-void
-arena_dalloc_bin(tsdn_t *tsdn, arena_t *arena, arena_chunk_t *chunk, void *ptr,
- size_t pageind, arena_chunk_map_bits_t *bitselm)
-{
- arena_run_t *run;
- arena_bin_t *bin;
- size_t rpages_ind;
-
- rpages_ind = pageind - arena_mapbits_small_runind_get(chunk, pageind);
- run = &arena_miscelm_get_mutable(chunk, rpages_ind)->run;
- bin = &arena->bins[run->binind];
- malloc_mutex_lock(tsdn, &bin->lock);
- arena_dalloc_bin_locked_impl(tsdn, arena, chunk, ptr, bitselm, false);
- malloc_mutex_unlock(tsdn, &bin->lock);
-}
-
-void
-arena_dalloc_small(tsdn_t *tsdn, arena_t *arena, arena_chunk_t *chunk,
- void *ptr, size_t pageind)
-{
- arena_chunk_map_bits_t *bitselm;
-
- if (config_debug) {
- /* arena_ptr_small_binind_get() does extra sanity checking. */
- assert(arena_ptr_small_binind_get(ptr, arena_mapbits_get(chunk,
- pageind)) != BININD_INVALID);
- }
- bitselm = arena_bitselm_get_mutable(chunk, pageind);
- arena_dalloc_bin(tsdn, arena, chunk, ptr, pageind, bitselm);
- arena_decay_tick(tsdn, arena);
-}
-
-#ifdef JEMALLOC_JET
-#undef arena_dalloc_junk_large
-#define arena_dalloc_junk_large JEMALLOC_N(n_arena_dalloc_junk_large)
-#endif
-void
-arena_dalloc_junk_large(void *ptr, size_t usize)
-{
-
- if (config_fill && unlikely(opt_junk_free))
- memset(ptr, JEMALLOC_FREE_JUNK, usize);
-}
-#ifdef JEMALLOC_JET
-#undef arena_dalloc_junk_large
-#define arena_dalloc_junk_large JEMALLOC_N(arena_dalloc_junk_large)
-arena_dalloc_junk_large_t *arena_dalloc_junk_large =
- JEMALLOC_N(n_arena_dalloc_junk_large);
-#endif
-
-static void
-arena_dalloc_large_locked_impl(tsdn_t *tsdn, arena_t *arena,
- arena_chunk_t *chunk, void *ptr, bool junked)
-{
- size_t pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> LG_PAGE;
- arena_chunk_map_misc_t *miscelm = arena_miscelm_get_mutable(chunk,
- pageind);
- arena_run_t *run = &miscelm->run;
-
- if (config_fill || config_stats) {
- size_t usize = arena_mapbits_large_size_get(chunk, pageind) -
- large_pad;
-
- if (!junked)
- arena_dalloc_junk_large(ptr, usize);
- if (config_stats) {
- szind_t index = size2index(usize) - NBINS;
-
- arena->stats.ndalloc_large++;
- arena->stats.allocated_large -= usize;
- arena->stats.lstats[index].ndalloc++;
- arena->stats.lstats[index].curruns--;
- }
- }
-
- arena_run_dalloc(tsdn, arena, run, true, false, false);
-}
-
-void
-arena_dalloc_large_junked_locked(tsdn_t *tsdn, arena_t *arena,
- arena_chunk_t *chunk, void *ptr)
-{
-
- arena_dalloc_large_locked_impl(tsdn, arena, chunk, ptr, true);
-}
-
-void
-arena_dalloc_large(tsdn_t *tsdn, arena_t *arena, arena_chunk_t *chunk,
- void *ptr)
-{
-
- malloc_mutex_lock(tsdn, &arena->lock);
- arena_dalloc_large_locked_impl(tsdn, arena, chunk, ptr, false);
- malloc_mutex_unlock(tsdn, &arena->lock);
- arena_decay_tick(tsdn, arena);
-}
-
-static void
-arena_ralloc_large_shrink(tsdn_t *tsdn, arena_t *arena, arena_chunk_t *chunk,
- void *ptr, size_t oldsize, size_t size)
-{
- size_t pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> LG_PAGE;
- arena_chunk_map_misc_t *miscelm = arena_miscelm_get_mutable(chunk,
- pageind);
- arena_run_t *run = &miscelm->run;
-
- assert(size < oldsize);
-
- /*
- * Shrink the run, and make trailing pages available for other
- * allocations.
- */
- malloc_mutex_lock(tsdn, &arena->lock);
- arena_run_trim_tail(tsdn, arena, chunk, run, oldsize + large_pad, size +
- large_pad, true);
- if (config_stats) {
- szind_t oldindex = size2index(oldsize) - NBINS;
- szind_t index = size2index(size) - NBINS;
-
- arena->stats.ndalloc_large++;
- arena->stats.allocated_large -= oldsize;
- arena->stats.lstats[oldindex].ndalloc++;
- arena->stats.lstats[oldindex].curruns--;
-
- arena->stats.nmalloc_large++;
- arena->stats.nrequests_large++;
- arena->stats.allocated_large += size;
- arena->stats.lstats[index].nmalloc++;
- arena->stats.lstats[index].nrequests++;
- arena->stats.lstats[index].curruns++;
- }
- malloc_mutex_unlock(tsdn, &arena->lock);
-}
-
-static bool
-arena_ralloc_large_grow(tsdn_t *tsdn, arena_t *arena, arena_chunk_t *chunk,
- void *ptr, size_t oldsize, size_t usize_min, size_t usize_max, bool zero)
-{
- size_t pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> LG_PAGE;
- size_t npages = (oldsize + large_pad) >> LG_PAGE;
- size_t followsize;
-
- assert(oldsize == arena_mapbits_large_size_get(chunk, pageind) -
- large_pad);
-
- /* Try to extend the run. */
- malloc_mutex_lock(tsdn, &arena->lock);
- if (pageind+npages >= chunk_npages || arena_mapbits_allocated_get(chunk,
- pageind+npages) != 0)
- goto label_fail;
- followsize = arena_mapbits_unallocated_size_get(chunk, pageind+npages);
- if (oldsize + followsize >= usize_min) {
- /*
- * The next run is available and sufficiently large. Split the
- * following run, then merge the first part with the existing
- * allocation.
- */
- arena_run_t *run;
- size_t usize, splitsize, size, flag_dirty, flag_unzeroed_mask;
-
- usize = usize_max;
- while (oldsize + followsize < usize)
- usize = index2size(size2index(usize)-1);
- assert(usize >= usize_min);
- assert(usize >= oldsize);
- splitsize = usize - oldsize;
- if (splitsize == 0)
- goto label_fail;
-
- run = &arena_miscelm_get_mutable(chunk, pageind+npages)->run;
- if (arena_run_split_large(arena, run, splitsize, zero))
- goto label_fail;
-
- if (config_cache_oblivious && zero) {
- /*
- * Zero the trailing bytes of the original allocation's
- * last page, since they are in an indeterminate state.
- * There will always be trailing bytes, because ptr's
- * offset from the beginning of the run is a multiple of
- * CACHELINE in [0 .. PAGE).
- */
- void *zbase = (void *)((uintptr_t)ptr + oldsize);
- void *zpast = PAGE_ADDR2BASE((void *)((uintptr_t)zbase +
- PAGE));
- size_t nzero = (uintptr_t)zpast - (uintptr_t)zbase;
- assert(nzero > 0);
- memset(zbase, 0, nzero);
- }
-
- size = oldsize + splitsize;
- npages = (size + large_pad) >> LG_PAGE;
-
- /*
- * Mark the extended run as dirty if either portion of the run
- * was dirty before allocation. This is rather pedantic,
- * because there's not actually any sequence of events that
- * could cause the resulting run to be passed to
- * arena_run_dalloc() with the dirty argument set to false
- * (which is when dirty flag consistency would really matter).
- */
- flag_dirty = arena_mapbits_dirty_get(chunk, pageind) |
- arena_mapbits_dirty_get(chunk, pageind+npages-1);
- flag_unzeroed_mask = flag_dirty == 0 ? CHUNK_MAP_UNZEROED : 0;
- arena_mapbits_large_set(chunk, pageind, size + large_pad,
- flag_dirty | (flag_unzeroed_mask &
- arena_mapbits_unzeroed_get(chunk, pageind)));
- arena_mapbits_large_set(chunk, pageind+npages-1, 0, flag_dirty |
- (flag_unzeroed_mask & arena_mapbits_unzeroed_get(chunk,
- pageind+npages-1)));
-
- if (config_stats) {
- szind_t oldindex = size2index(oldsize) - NBINS;
- szind_t index = size2index(size) - NBINS;
-
- arena->stats.ndalloc_large++;
- arena->stats.allocated_large -= oldsize;
- arena->stats.lstats[oldindex].ndalloc++;
- arena->stats.lstats[oldindex].curruns--;
-
- arena->stats.nmalloc_large++;
- arena->stats.nrequests_large++;
- arena->stats.allocated_large += size;
- arena->stats.lstats[index].nmalloc++;
- arena->stats.lstats[index].nrequests++;
- arena->stats.lstats[index].curruns++;
- }
- malloc_mutex_unlock(tsdn, &arena->lock);
- return (false);
- }
-label_fail:
- malloc_mutex_unlock(tsdn, &arena->lock);
- return (true);
-}
-
-#ifdef JEMALLOC_JET
-#undef arena_ralloc_junk_large
-#define arena_ralloc_junk_large JEMALLOC_N(n_arena_ralloc_junk_large)
-#endif
-static void
-arena_ralloc_junk_large(void *ptr, size_t old_usize, size_t usize)
-{
-
- if (config_fill && unlikely(opt_junk_free)) {
- memset((void *)((uintptr_t)ptr + usize), JEMALLOC_FREE_JUNK,
- old_usize - usize);
- }
-}
-#ifdef JEMALLOC_JET
-#undef arena_ralloc_junk_large
-#define arena_ralloc_junk_large JEMALLOC_N(arena_ralloc_junk_large)
-arena_ralloc_junk_large_t *arena_ralloc_junk_large =
- JEMALLOC_N(n_arena_ralloc_junk_large);
-#endif
-
-/*
- * Try to resize a large allocation, in order to avoid copying. This will
- * always fail if growing an object, and the following run is already in use.
- */
-static bool
-arena_ralloc_large(tsdn_t *tsdn, void *ptr, size_t oldsize, size_t usize_min,
- size_t usize_max, bool zero)
-{
- arena_chunk_t *chunk;
- arena_t *arena;
-
- if (oldsize == usize_max) {
- /* Current size class is compatible and maximal. */
- return (false);
- }
-
- chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr);
- arena = extent_node_arena_get(&chunk->node);
-
- if (oldsize < usize_max) {
- bool ret = arena_ralloc_large_grow(tsdn, arena, chunk, ptr,
- oldsize, usize_min, usize_max, zero);
- if (config_fill && !ret && !zero) {
- if (unlikely(opt_junk_alloc)) {
- memset((void *)((uintptr_t)ptr + oldsize),
- JEMALLOC_ALLOC_JUNK,
- isalloc(tsdn, ptr, config_prof) - oldsize);
- } else if (unlikely(opt_zero)) {
- memset((void *)((uintptr_t)ptr + oldsize), 0,
- isalloc(tsdn, ptr, config_prof) - oldsize);
- }
- }
- return (ret);
- }
-
- assert(oldsize > usize_max);
- /* Fill before shrinking in order avoid a race. */
- arena_ralloc_junk_large(ptr, oldsize, usize_max);
- arena_ralloc_large_shrink(tsdn, arena, chunk, ptr, oldsize, usize_max);
- return (false);
-}
-
-bool
-arena_ralloc_no_move(tsdn_t *tsdn, void *ptr, size_t oldsize, size_t size,
- size_t extra, bool zero)
-{
- size_t usize_min, usize_max;
-
- /* Calls with non-zero extra had to clamp extra. */
- assert(extra == 0 || size + extra <= HUGE_MAXCLASS);
-
- if (unlikely(size > HUGE_MAXCLASS))
- return (true);
-
- usize_min = s2u(size);
- usize_max = s2u(size + extra);
- if (likely(oldsize <= large_maxclass && usize_min <= large_maxclass)) {
- arena_chunk_t *chunk;
-
- /*
- * Avoid moving the allocation if the size class can be left the
- * same.
- */
- if (oldsize <= SMALL_MAXCLASS) {
- assert(arena_bin_info[size2index(oldsize)].reg_size ==
- oldsize);
- if ((usize_max > SMALL_MAXCLASS ||
- size2index(usize_max) != size2index(oldsize)) &&
- (size > oldsize || usize_max < oldsize))
- return (true);
- } else {
- if (usize_max <= SMALL_MAXCLASS)
- return (true);
- if (arena_ralloc_large(tsdn, ptr, oldsize, usize_min,
- usize_max, zero))
- return (true);
- }
-
- chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr);
- arena_decay_tick(tsdn, extent_node_arena_get(&chunk->node));
- return (false);
- } else {
- return (huge_ralloc_no_move(tsdn, ptr, oldsize, usize_min,
- usize_max, zero));
- }
-}
-
-static void *
-arena_ralloc_move_helper(tsdn_t *tsdn, arena_t *arena, size_t usize,
- size_t alignment, bool zero, tcache_t *tcache)
-{
-
- if (alignment == 0)
- return (arena_malloc(tsdn, arena, usize, size2index(usize),
- zero, tcache, true));
- usize = sa2u(usize, alignment);
- if (unlikely(usize == 0 || usize > HUGE_MAXCLASS))
- return (NULL);
- return (ipalloct(tsdn, usize, alignment, zero, tcache, arena));
-}
-
-void *
-arena_ralloc(tsd_t *tsd, arena_t *arena, void *ptr, size_t oldsize, size_t size,
- size_t alignment, bool zero, tcache_t *tcache)
-{
- void *ret;
- size_t usize;
-
- usize = s2u(size);
- if (unlikely(usize == 0 || size > HUGE_MAXCLASS))
- return (NULL);
-
- if (likely(usize <= large_maxclass)) {
- size_t copysize;
-
- /* Try to avoid moving the allocation. */
- if (!arena_ralloc_no_move(tsd_tsdn(tsd), ptr, oldsize, usize, 0,
- zero))
- return (ptr);
-
- /*
- * size and oldsize are different enough that we need to move
- * the object. In that case, fall back to allocating new space
- * and copying.
- */
- ret = arena_ralloc_move_helper(tsd_tsdn(tsd), arena, usize,
- alignment, zero, tcache);
- if (ret == NULL)
- return (NULL);
-
- /*
- * Junk/zero-filling were already done by
- * ipalloc()/arena_malloc().
- */
-
- copysize = (usize < oldsize) ? usize : oldsize;
- JEMALLOC_VALGRIND_MAKE_MEM_UNDEFINED(ret, copysize);
- memcpy(ret, ptr, copysize);
- isqalloc(tsd, ptr, oldsize, tcache, true);
- } else {
- ret = huge_ralloc(tsd, arena, ptr, oldsize, usize, alignment,
- zero, tcache);
- }
- return (ret);
-}
-
-dss_prec_t
-arena_dss_prec_get(tsdn_t *tsdn, arena_t *arena)
-{
- dss_prec_t ret;
-
- malloc_mutex_lock(tsdn, &arena->lock);
- ret = arena->dss_prec;
- malloc_mutex_unlock(tsdn, &arena->lock);
- return (ret);
-}
-
-bool
-arena_dss_prec_set(tsdn_t *tsdn, arena_t *arena, dss_prec_t dss_prec)
-{
-
- if (!have_dss)
- return (dss_prec != dss_prec_disabled);
- malloc_mutex_lock(tsdn, &arena->lock);
- arena->dss_prec = dss_prec;
- malloc_mutex_unlock(tsdn, &arena->lock);
- return (false);
-}
-
-ssize_t
-arena_lg_dirty_mult_default_get(void)
-{
-
- return ((ssize_t)atomic_read_z((size_t *)&lg_dirty_mult_default));
-}
-
-bool
-arena_lg_dirty_mult_default_set(ssize_t lg_dirty_mult)
-{
-
- if (opt_purge != purge_mode_ratio)
- return (true);
- if (!arena_lg_dirty_mult_valid(lg_dirty_mult))
- return (true);
- atomic_write_z((size_t *)&lg_dirty_mult_default, (size_t)lg_dirty_mult);
- return (false);
-}
-
-ssize_t
-arena_decay_time_default_get(void)
-{
-
- return ((ssize_t)atomic_read_z((size_t *)&decay_time_default));
-}
-
-bool
-arena_decay_time_default_set(ssize_t decay_time)
-{
-
- if (opt_purge != purge_mode_decay)
- return (true);
- if (!arena_decay_time_valid(decay_time))
- return (true);
- atomic_write_z((size_t *)&decay_time_default, (size_t)decay_time);
- return (false);
-}
-
-static void
-arena_basic_stats_merge_locked(arena_t *arena, unsigned *nthreads,
- const char **dss, ssize_t *lg_dirty_mult, ssize_t *decay_time,
- size_t *nactive, size_t *ndirty)
-{
-
- *nthreads += arena_nthreads_get(arena, false);
- *dss = dss_prec_names[arena->dss_prec];
- *lg_dirty_mult = arena->lg_dirty_mult;
- *decay_time = arena->decay.time;
- *nactive += arena->nactive;
- *ndirty += arena->ndirty;
-}
-
-void
-arena_basic_stats_merge(tsdn_t *tsdn, arena_t *arena, unsigned *nthreads,
- const char **dss, ssize_t *lg_dirty_mult, ssize_t *decay_time,
- size_t *nactive, size_t *ndirty)
-{
-
- malloc_mutex_lock(tsdn, &arena->lock);
- arena_basic_stats_merge_locked(arena, nthreads, dss, lg_dirty_mult,
- decay_time, nactive, ndirty);
- malloc_mutex_unlock(tsdn, &arena->lock);
-}
-
-void
-arena_stats_merge(tsdn_t *tsdn, arena_t *arena, unsigned *nthreads,
- const char **dss, ssize_t *lg_dirty_mult, ssize_t *decay_time,
- size_t *nactive, size_t *ndirty, arena_stats_t *astats,
- malloc_bin_stats_t *bstats, malloc_large_stats_t *lstats,
- malloc_huge_stats_t *hstats)
-{
- unsigned i;
-
- cassert(config_stats);
-
- malloc_mutex_lock(tsdn, &arena->lock);
- arena_basic_stats_merge_locked(arena, nthreads, dss, lg_dirty_mult,
- decay_time, nactive, ndirty);
-
- astats->mapped += arena->stats.mapped;
- astats->retained += arena->stats.retained;
- astats->npurge += arena->stats.npurge;
- astats->nmadvise += arena->stats.nmadvise;
- astats->purged += arena->stats.purged;
- astats->metadata_mapped += arena->stats.metadata_mapped;
- astats->metadata_allocated += arena_metadata_allocated_get(arena);
- astats->allocated_large += arena->stats.allocated_large;
- astats->nmalloc_large += arena->stats.nmalloc_large;
- astats->ndalloc_large += arena->stats.ndalloc_large;
- astats->nrequests_large += arena->stats.nrequests_large;
- astats->allocated_huge += arena->stats.allocated_huge;
- astats->nmalloc_huge += arena->stats.nmalloc_huge;
- astats->ndalloc_huge += arena->stats.ndalloc_huge;
-
- for (i = 0; i < nlclasses; i++) {
- lstats[i].nmalloc += arena->stats.lstats[i].nmalloc;
- lstats[i].ndalloc += arena->stats.lstats[i].ndalloc;
- lstats[i].nrequests += arena->stats.lstats[i].nrequests;
- lstats[i].curruns += arena->stats.lstats[i].curruns;
- }
-
- for (i = 0; i < nhclasses; i++) {
- hstats[i].nmalloc += arena->stats.hstats[i].nmalloc;
- hstats[i].ndalloc += arena->stats.hstats[i].ndalloc;
- hstats[i].curhchunks += arena->stats.hstats[i].curhchunks;
- }
- malloc_mutex_unlock(tsdn, &arena->lock);
-
- for (i = 0; i < NBINS; i++) {
- arena_bin_t *bin = &arena->bins[i];
-
- malloc_mutex_lock(tsdn, &bin->lock);
- bstats[i].nmalloc += bin->stats.nmalloc;
- bstats[i].ndalloc += bin->stats.ndalloc;
- bstats[i].nrequests += bin->stats.nrequests;
- bstats[i].curregs += bin->stats.curregs;
- if (config_tcache) {
- bstats[i].nfills += bin->stats.nfills;
- bstats[i].nflushes += bin->stats.nflushes;
- }
- bstats[i].nruns += bin->stats.nruns;
- bstats[i].reruns += bin->stats.reruns;
- bstats[i].curruns += bin->stats.curruns;
- malloc_mutex_unlock(tsdn, &bin->lock);
- }
-}
-
-unsigned
-arena_nthreads_get(arena_t *arena, bool internal)
-{
-
- return (atomic_read_u(&arena->nthreads[internal]));
-}
-
-void
-arena_nthreads_inc(arena_t *arena, bool internal)
-{
-
- atomic_add_u(&arena->nthreads[internal], 1);
-}
-
-void
-arena_nthreads_dec(arena_t *arena, bool internal)
-{
-
- atomic_sub_u(&arena->nthreads[internal], 1);
-}
-
-arena_t *
-arena_new(tsdn_t *tsdn, unsigned ind)
-{
- arena_t *arena;
- unsigned i;
-
- /*
- * Allocate arena, arena->lstats, and arena->hstats contiguously, mainly
- * because there is no way to clean up if base_alloc() OOMs.
- */
- if (config_stats) {
- arena = (arena_t *)base_alloc(tsdn,
- CACHELINE_CEILING(sizeof(arena_t)) +
- QUANTUM_CEILING((nlclasses * sizeof(malloc_large_stats_t)))
- + (nhclasses * sizeof(malloc_huge_stats_t)));
- } else
- arena = (arena_t *)base_alloc(tsdn, sizeof(arena_t));
- if (arena == NULL)
- return (NULL);
-
- arena->ind = ind;
- arena->nthreads[0] = arena->nthreads[1] = 0;
- if (malloc_mutex_init(&arena->lock, "arena", WITNESS_RANK_ARENA))
- return (NULL);
-
- if (config_stats) {
- memset(&arena->stats, 0, sizeof(arena_stats_t));
- arena->stats.lstats = (malloc_large_stats_t *)((uintptr_t)arena
- + CACHELINE_CEILING(sizeof(arena_t)));
- memset(arena->stats.lstats, 0, nlclasses *
- sizeof(malloc_large_stats_t));
- arena->stats.hstats = (malloc_huge_stats_t *)((uintptr_t)arena
- + CACHELINE_CEILING(sizeof(arena_t)) +
- QUANTUM_CEILING(nlclasses * sizeof(malloc_large_stats_t)));
- memset(arena->stats.hstats, 0, nhclasses *
- sizeof(malloc_huge_stats_t));
- if (config_tcache)
- ql_new(&arena->tcache_ql);
- }
-
- if (config_prof)
- arena->prof_accumbytes = 0;
-
- if (config_cache_oblivious) {
- /*
- * A nondeterministic seed based on the address of arena reduces
- * the likelihood of lockstep non-uniform cache index
- * utilization among identical concurrent processes, but at the
- * cost of test repeatability. For debug builds, instead use a
- * deterministic seed.
- */
- arena->offset_state = config_debug ? ind :
- (size_t)(uintptr_t)arena;
- }
-
- arena->dss_prec = chunk_dss_prec_get();
-
- ql_new(&arena->achunks);
-
- arena->spare = NULL;
-
- arena->lg_dirty_mult = arena_lg_dirty_mult_default_get();
- arena->purging = false;
- arena->nactive = 0;
- arena->ndirty = 0;
-
- for (i = 0; i < NPSIZES; i++)
- arena_run_heap_new(&arena->runs_avail[i]);
-
- qr_new(&arena->runs_dirty, rd_link);
- qr_new(&arena->chunks_cache, cc_link);
-
- if (opt_purge == purge_mode_decay)
- arena_decay_init(arena, arena_decay_time_default_get());
-
- ql_new(&arena->huge);
- if (malloc_mutex_init(&arena->huge_mtx, "arena_huge",
- WITNESS_RANK_ARENA_HUGE))
- return (NULL);
-
- extent_tree_szad_new(&arena->chunks_szad_cached);
- extent_tree_ad_new(&arena->chunks_ad_cached);
- extent_tree_szad_new(&arena->chunks_szad_retained);
- extent_tree_ad_new(&arena->chunks_ad_retained);
- if (malloc_mutex_init(&arena->chunks_mtx, "arena_chunks",
- WITNESS_RANK_ARENA_CHUNKS))
- return (NULL);
- ql_new(&arena->node_cache);
- if (malloc_mutex_init(&arena->node_cache_mtx, "arena_node_cache",
- WITNESS_RANK_ARENA_NODE_CACHE))
- return (NULL);
-
- arena->chunk_hooks = chunk_hooks_default;
-
- /* Initialize bins. */
- for (i = 0; i < NBINS; i++) {
- arena_bin_t *bin = &arena->bins[i];
- if (malloc_mutex_init(&bin->lock, "arena_bin",
- WITNESS_RANK_ARENA_BIN))
- return (NULL);
- bin->runcur = NULL;
- arena_run_heap_new(&bin->runs);
- if (config_stats)
- memset(&bin->stats, 0, sizeof(malloc_bin_stats_t));
- }
-
- return (arena);
-}
-
-/*
- * Calculate bin_info->run_size such that it meets the following constraints:
- *
- * *) bin_info->run_size <= arena_maxrun
- * *) bin_info->nregs <= RUN_MAXREGS
- *
- * bin_info->nregs and bin_info->reg0_offset are also calculated here, since
- * these settings are all interdependent.
- */
-static void
-bin_info_run_size_calc(arena_bin_info_t *bin_info)
-{
- size_t pad_size;
- size_t try_run_size, perfect_run_size, actual_run_size;
- uint32_t try_nregs, perfect_nregs, actual_nregs;
-
- /*
- * Determine redzone size based on minimum alignment and minimum
- * redzone size. Add padding to the end of the run if it is needed to
- * align the regions. The padding allows each redzone to be half the
- * minimum alignment; without the padding, each redzone would have to
- * be twice as large in order to maintain alignment.
- */
- if (config_fill && unlikely(opt_redzone)) {
- size_t align_min = ZU(1) << (ffs_zu(bin_info->reg_size) - 1);
- if (align_min <= REDZONE_MINSIZE) {
- bin_info->redzone_size = REDZONE_MINSIZE;
- pad_size = 0;
- } else {
- bin_info->redzone_size = align_min >> 1;
- pad_size = bin_info->redzone_size;
- }
- } else {
- bin_info->redzone_size = 0;
- pad_size = 0;
- }
- bin_info->reg_interval = bin_info->reg_size +
- (bin_info->redzone_size << 1);
-
- /*
- * Compute run size under ideal conditions (no redzones, no limit on run
- * size).
- */
- try_run_size = PAGE;
- try_nregs = (uint32_t)(try_run_size / bin_info->reg_size);
- do {
- perfect_run_size = try_run_size;
- perfect_nregs = try_nregs;
-
- try_run_size += PAGE;
- try_nregs = (uint32_t)(try_run_size / bin_info->reg_size);
- } while (perfect_run_size != perfect_nregs * bin_info->reg_size);
- assert(perfect_nregs <= RUN_MAXREGS);
-
- actual_run_size = perfect_run_size;
- actual_nregs = (uint32_t)((actual_run_size - pad_size) /
- bin_info->reg_interval);
-
- /*
- * Redzones can require enough padding that not even a single region can
- * fit within the number of pages that would normally be dedicated to a
- * run for this size class. Increase the run size until at least one
- * region fits.
- */
- while (actual_nregs == 0) {
- assert(config_fill && unlikely(opt_redzone));
-
- actual_run_size += PAGE;
- actual_nregs = (uint32_t)((actual_run_size - pad_size) /
- bin_info->reg_interval);
- }
-
- /*
- * Make sure that the run will fit within an arena chunk.
- */
- while (actual_run_size > arena_maxrun) {
- actual_run_size -= PAGE;
- actual_nregs = (uint32_t)((actual_run_size - pad_size) /
- bin_info->reg_interval);
- }
- assert(actual_nregs > 0);
- assert(actual_run_size == s2u(actual_run_size));
-
- /* Copy final settings. */
- bin_info->run_size = actual_run_size;
- bin_info->nregs = actual_nregs;
- bin_info->reg0_offset = (uint32_t)(actual_run_size - (actual_nregs *
- bin_info->reg_interval) - pad_size + bin_info->redzone_size);
-
- assert(bin_info->reg0_offset - bin_info->redzone_size + (bin_info->nregs
- * bin_info->reg_interval) + pad_size == bin_info->run_size);
-}
-
-static void
-bin_info_init(void)
-{
- arena_bin_info_t *bin_info;
-
-#define BIN_INFO_INIT_bin_yes(index, size) \
- bin_info = &arena_bin_info[index]; \
- bin_info->reg_size = size; \
- bin_info_run_size_calc(bin_info); \
- bitmap_info_init(&bin_info->bitmap_info, bin_info->nregs);
-#define BIN_INFO_INIT_bin_no(index, size)
-#define SC(index, lg_grp, lg_delta, ndelta, psz, bin, lg_delta_lookup) \
- BIN_INFO_INIT_bin_##bin(index, (ZU(1)<<lg_grp) + (ZU(ndelta)<<lg_delta))
- SIZE_CLASSES
-#undef BIN_INFO_INIT_bin_yes
-#undef BIN_INFO_INIT_bin_no
-#undef SC
-}
-
-void
-arena_boot(void)
-{
- unsigned i;
-
- arena_lg_dirty_mult_default_set(opt_lg_dirty_mult);
- arena_decay_time_default_set(opt_decay_time);
-
- /*
- * Compute the header size such that it is large enough to contain the
- * page map. The page map is biased to omit entries for the header
- * itself, so some iteration is necessary to compute the map bias.
- *
- * 1) Compute safe header_size and map_bias values that include enough
- * space for an unbiased page map.
- * 2) Refine map_bias based on (1) to omit the header pages in the page
- * map. The resulting map_bias may be one too small.
- * 3) Refine map_bias based on (2). The result will be >= the result
- * from (2), and will always be correct.
- */
- map_bias = 0;
- for (i = 0; i < 3; i++) {
- size_t header_size = offsetof(arena_chunk_t, map_bits) +
- ((sizeof(arena_chunk_map_bits_t) +
- sizeof(arena_chunk_map_misc_t)) * (chunk_npages-map_bias));
- map_bias = (header_size + PAGE_MASK) >> LG_PAGE;
- }
- assert(map_bias > 0);
-
- map_misc_offset = offsetof(arena_chunk_t, map_bits) +
- sizeof(arena_chunk_map_bits_t) * (chunk_npages-map_bias);
-
- arena_maxrun = chunksize - (map_bias << LG_PAGE);
- assert(arena_maxrun > 0);
- large_maxclass = index2size(size2index(chunksize)-1);
- if (large_maxclass > arena_maxrun) {
- /*
- * For small chunk sizes it's possible for there to be fewer
- * non-header pages available than are necessary to serve the
- * size classes just below chunksize.
- */
- large_maxclass = arena_maxrun;
- }
- assert(large_maxclass > 0);
- nlclasses = size2index(large_maxclass) - size2index(SMALL_MAXCLASS);
- nhclasses = NSIZES - nlclasses - NBINS;
-
- bin_info_init();
-}
-
-void
-arena_prefork0(tsdn_t *tsdn, arena_t *arena)
-{
-
- malloc_mutex_prefork(tsdn, &arena->lock);
-}
-
-void
-arena_prefork1(tsdn_t *tsdn, arena_t *arena)
-{
-
- malloc_mutex_prefork(tsdn, &arena->chunks_mtx);
-}
-
-void
-arena_prefork2(tsdn_t *tsdn, arena_t *arena)
-{
-
- malloc_mutex_prefork(tsdn, &arena->node_cache_mtx);
-}
-
-void
-arena_prefork3(tsdn_t *tsdn, arena_t *arena)
-{
- unsigned i;
-
- for (i = 0; i < NBINS; i++)
- malloc_mutex_prefork(tsdn, &arena->bins[i].lock);
- malloc_mutex_prefork(tsdn, &arena->huge_mtx);
-}
-
-void
-arena_postfork_parent(tsdn_t *tsdn, arena_t *arena)
-{
- unsigned i;
-
- malloc_mutex_postfork_parent(tsdn, &arena->huge_mtx);
- for (i = 0; i < NBINS; i++)
- malloc_mutex_postfork_parent(tsdn, &arena->bins[i].lock);
- malloc_mutex_postfork_parent(tsdn, &arena->node_cache_mtx);
- malloc_mutex_postfork_parent(tsdn, &arena->chunks_mtx);
- malloc_mutex_postfork_parent(tsdn, &arena->lock);
-}
-
-void
-arena_postfork_child(tsdn_t *tsdn, arena_t *arena)
-{
- unsigned i;
-
- malloc_mutex_postfork_child(tsdn, &arena->huge_mtx);
- for (i = 0; i < NBINS; i++)
- malloc_mutex_postfork_child(tsdn, &arena->bins[i].lock);
- malloc_mutex_postfork_child(tsdn, &arena->node_cache_mtx);
- malloc_mutex_postfork_child(tsdn, &arena->chunks_mtx);
- malloc_mutex_postfork_child(tsdn, &arena->lock);
-}
diff --git a/memory/jemalloc/src/src/atomic.c b/memory/jemalloc/src/src/atomic.c
deleted file mode 100644
index 77ee313113..0000000000
--- a/memory/jemalloc/src/src/atomic.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define JEMALLOC_ATOMIC_C_
-#include "jemalloc/internal/jemalloc_internal.h"
diff --git a/memory/jemalloc/src/src/base.c b/memory/jemalloc/src/src/base.c
deleted file mode 100644
index 81b0801fde..0000000000
--- a/memory/jemalloc/src/src/base.c
+++ /dev/null
@@ -1,177 +0,0 @@
-#define JEMALLOC_BASE_C_
-#include "jemalloc/internal/jemalloc_internal.h"
-
-/******************************************************************************/
-/* Data. */
-
-static malloc_mutex_t base_mtx;
-static extent_tree_t base_avail_szad;
-static extent_node_t *base_nodes;
-static size_t base_allocated;
-static size_t base_resident;
-static size_t base_mapped;
-
-/******************************************************************************/
-
-static extent_node_t *
-base_node_try_alloc(tsdn_t *tsdn)
-{
- extent_node_t *node;
-
- malloc_mutex_assert_owner(tsdn, &base_mtx);
-
- if (base_nodes == NULL)
- return (NULL);
- node = base_nodes;
- base_nodes = *(extent_node_t **)node;
- JEMALLOC_VALGRIND_MAKE_MEM_UNDEFINED(node, sizeof(extent_node_t));
- return (node);
-}
-
-static void
-base_node_dalloc(tsdn_t *tsdn, extent_node_t *node)
-{
-
- malloc_mutex_assert_owner(tsdn, &base_mtx);
-
- JEMALLOC_VALGRIND_MAKE_MEM_UNDEFINED(node, sizeof(extent_node_t));
- *(extent_node_t **)node = base_nodes;
- base_nodes = node;
-}
-
-static extent_node_t *
-base_chunk_alloc(tsdn_t *tsdn, size_t minsize)
-{
- extent_node_t *node;
- size_t csize, nsize;
- void *addr;
-
- malloc_mutex_assert_owner(tsdn, &base_mtx);
- assert(minsize != 0);
- node = base_node_try_alloc(tsdn);
- /* Allocate enough space to also carve a node out if necessary. */
- nsize = (node == NULL) ? CACHELINE_CEILING(sizeof(extent_node_t)) : 0;
- csize = CHUNK_CEILING(minsize + nsize);
- addr = chunk_alloc_base(csize);
- if (addr == NULL) {
- if (node != NULL)
- base_node_dalloc(tsdn, node);
- return (NULL);
- }
- base_mapped += csize;
- if (node == NULL) {
- node = (extent_node_t *)addr;
- addr = (void *)((uintptr_t)addr + nsize);
- csize -= nsize;
- if (config_stats) {
- base_allocated += nsize;
- base_resident += PAGE_CEILING(nsize);
- }
- }
- extent_node_init(node, NULL, addr, csize, true, true);
- return (node);
-}
-
-/*
- * base_alloc() guarantees demand-zeroed memory, in order to make multi-page
- * sparse data structures such as radix tree nodes efficient with respect to
- * physical memory usage.
- */
-void *
-base_alloc(tsdn_t *tsdn, size_t size)
-{
- void *ret;
- size_t csize, usize;
- extent_node_t *node;
- extent_node_t key;
-
- /*
- * Round size up to nearest multiple of the cacheline size, so that
- * there is no chance of false cache line sharing.
- */
- csize = CACHELINE_CEILING(size);
-
- usize = s2u(csize);
- extent_node_init(&key, NULL, NULL, usize, false, false);
- malloc_mutex_lock(tsdn, &base_mtx);
- node = extent_tree_szad_nsearch(&base_avail_szad, &key);
- if (node != NULL) {
- /* Use existing space. */
- extent_tree_szad_remove(&base_avail_szad, node);
- } else {
- /* Try to allocate more space. */
- node = base_chunk_alloc(tsdn, csize);
- }
- if (node == NULL) {
- ret = NULL;
- goto label_return;
- }
-
- ret = extent_node_addr_get(node);
- if (extent_node_size_get(node) > csize) {
- extent_node_addr_set(node, (void *)((uintptr_t)ret + csize));
- extent_node_size_set(node, extent_node_size_get(node) - csize);
- extent_tree_szad_insert(&base_avail_szad, node);
- } else
- base_node_dalloc(tsdn, node);
- if (config_stats) {
- base_allocated += csize;
- /*
- * Add one PAGE to base_resident for every page boundary that is
- * crossed by the new allocation.
- */
- base_resident += PAGE_CEILING((uintptr_t)ret + csize) -
- PAGE_CEILING((uintptr_t)ret);
- }
- JEMALLOC_VALGRIND_MAKE_MEM_DEFINED(ret, csize);
-label_return:
- malloc_mutex_unlock(tsdn, &base_mtx);
- return (ret);
-}
-
-void
-base_stats_get(tsdn_t *tsdn, size_t *allocated, size_t *resident,
- size_t *mapped)
-{
-
- malloc_mutex_lock(tsdn, &base_mtx);
- assert(base_allocated <= base_resident);
- assert(base_resident <= base_mapped);
- *allocated = base_allocated;
- *resident = base_resident;
- *mapped = base_mapped;
- malloc_mutex_unlock(tsdn, &base_mtx);
-}
-
-bool
-base_boot(void)
-{
-
- if (malloc_mutex_init(&base_mtx, "base", WITNESS_RANK_BASE))
- return (true);
- extent_tree_szad_new(&base_avail_szad);
- base_nodes = NULL;
-
- return (false);
-}
-
-void
-base_prefork(tsdn_t *tsdn)
-{
-
- malloc_mutex_prefork(tsdn, &base_mtx);
-}
-
-void
-base_postfork_parent(tsdn_t *tsdn)
-{
-
- malloc_mutex_postfork_parent(tsdn, &base_mtx);
-}
-
-void
-base_postfork_child(tsdn_t *tsdn)
-{
-
- malloc_mutex_postfork_child(tsdn, &base_mtx);
-}
diff --git a/memory/jemalloc/src/src/bitmap.c b/memory/jemalloc/src/src/bitmap.c
deleted file mode 100644
index ac0f3b3819..0000000000
--- a/memory/jemalloc/src/src/bitmap.c
+++ /dev/null
@@ -1,111 +0,0 @@
-#define JEMALLOC_BITMAP_C_
-#include "jemalloc/internal/jemalloc_internal.h"
-
-/******************************************************************************/
-
-#ifdef USE_TREE
-
-void
-bitmap_info_init(bitmap_info_t *binfo, size_t nbits)
-{
- unsigned i;
- size_t group_count;
-
- assert(nbits > 0);
- assert(nbits <= (ZU(1) << LG_BITMAP_MAXBITS));
-
- /*
- * Compute the number of groups necessary to store nbits bits, and
- * progressively work upward through the levels until reaching a level
- * that requires only one group.
- */
- binfo->levels[0].group_offset = 0;
- group_count = BITMAP_BITS2GROUPS(nbits);
- for (i = 1; group_count > 1; i++) {
- assert(i < BITMAP_MAX_LEVELS);
- binfo->levels[i].group_offset = binfo->levels[i-1].group_offset
- + group_count;
- group_count = BITMAP_BITS2GROUPS(group_count);
- }
- binfo->levels[i].group_offset = binfo->levels[i-1].group_offset
- + group_count;
- assert(binfo->levels[i].group_offset <= BITMAP_GROUPS_MAX);
- binfo->nlevels = i;
- binfo->nbits = nbits;
-}
-
-static size_t
-bitmap_info_ngroups(const bitmap_info_t *binfo)
-{
-
- return (binfo->levels[binfo->nlevels].group_offset);
-}
-
-void
-bitmap_init(bitmap_t *bitmap, const bitmap_info_t *binfo)
-{
- size_t extra;
- unsigned i;
-
- /*
- * Bits are actually inverted with regard to the external bitmap
- * interface, so the bitmap starts out with all 1 bits, except for
- * trailing unused bits (if any). Note that each group uses bit 0 to
- * correspond to the first logical bit in the group, so extra bits
- * are the most significant bits of the last group.
- */
- memset(bitmap, 0xffU, bitmap_size(binfo));
- extra = (BITMAP_GROUP_NBITS - (binfo->nbits & BITMAP_GROUP_NBITS_MASK))
- & BITMAP_GROUP_NBITS_MASK;
- if (extra != 0)
- bitmap[binfo->levels[1].group_offset - 1] >>= extra;
- for (i = 1; i < binfo->nlevels; i++) {
- size_t group_count = binfo->levels[i].group_offset -
- binfo->levels[i-1].group_offset;
- extra = (BITMAP_GROUP_NBITS - (group_count &
- BITMAP_GROUP_NBITS_MASK)) & BITMAP_GROUP_NBITS_MASK;
- if (extra != 0)
- bitmap[binfo->levels[i+1].group_offset - 1] >>= extra;
- }
-}
-
-#else /* USE_TREE */
-
-void
-bitmap_info_init(bitmap_info_t *binfo, size_t nbits)
-{
-
- assert(nbits > 0);
- assert(nbits <= (ZU(1) << LG_BITMAP_MAXBITS));
-
- binfo->ngroups = BITMAP_BITS2GROUPS(nbits);
- binfo->nbits = nbits;
-}
-
-static size_t
-bitmap_info_ngroups(const bitmap_info_t *binfo)
-{
-
- return (binfo->ngroups);
-}
-
-void
-bitmap_init(bitmap_t *bitmap, const bitmap_info_t *binfo)
-{
- size_t extra;
-
- memset(bitmap, 0xffU, bitmap_size(binfo));
- extra = (BITMAP_GROUP_NBITS - (binfo->nbits & BITMAP_GROUP_NBITS_MASK))
- & BITMAP_GROUP_NBITS_MASK;
- if (extra != 0)
- bitmap[binfo->ngroups - 1] >>= extra;
-}
-
-#endif /* USE_TREE */
-
-size_t
-bitmap_size(const bitmap_info_t *binfo)
-{
-
- return (bitmap_info_ngroups(binfo) << LG_SIZEOF_BITMAP);
-}
diff --git a/memory/jemalloc/src/src/chunk.c b/memory/jemalloc/src/src/chunk.c
deleted file mode 100644
index 07e26f77c9..0000000000
--- a/memory/jemalloc/src/src/chunk.c
+++ /dev/null
@@ -1,783 +0,0 @@
-#define JEMALLOC_CHUNK_C_
-#include "jemalloc/internal/jemalloc_internal.h"
-
-/******************************************************************************/
-/* Data. */
-
-const char *opt_dss = DSS_DEFAULT;
-size_t opt_lg_chunk = 0;
-
-/* Used exclusively for gdump triggering. */
-static size_t curchunks;
-static size_t highchunks;
-
-rtree_t chunks_rtree;
-
-/* Various chunk-related settings. */
-size_t chunksize;
-size_t chunksize_mask; /* (chunksize - 1). */
-size_t chunk_npages;
-
-static void *chunk_alloc_default(void *new_addr, size_t size,
- size_t alignment, bool *zero, bool *commit, unsigned arena_ind);
-static bool chunk_dalloc_default(void *chunk, size_t size, bool committed,
- unsigned arena_ind);
-static bool chunk_commit_default(void *chunk, size_t size, size_t offset,
- size_t length, unsigned arena_ind);
-static bool chunk_decommit_default(void *chunk, size_t size, size_t offset,
- size_t length, unsigned arena_ind);
-static bool chunk_purge_default(void *chunk, size_t size, size_t offset,
- size_t length, unsigned arena_ind);
-static bool chunk_split_default(void *chunk, size_t size, size_t size_a,
- size_t size_b, bool committed, unsigned arena_ind);
-static bool chunk_merge_default(void *chunk_a, size_t size_a, void *chunk_b,
- size_t size_b, bool committed, unsigned arena_ind);
-
-const chunk_hooks_t chunk_hooks_default = {
- chunk_alloc_default,
- chunk_dalloc_default,
- chunk_commit_default,
- chunk_decommit_default,
- chunk_purge_default,
- chunk_split_default,
- chunk_merge_default
-};
-
-/******************************************************************************/
-/*
- * Function prototypes for static functions that are referenced prior to
- * definition.
- */
-
-static void chunk_record(tsdn_t *tsdn, arena_t *arena,
- chunk_hooks_t *chunk_hooks, extent_tree_t *chunks_szad,
- extent_tree_t *chunks_ad, bool cache, void *chunk, size_t size, bool zeroed,
- bool committed);
-
-/******************************************************************************/
-
-static chunk_hooks_t
-chunk_hooks_get_locked(arena_t *arena)
-{
-
- return (arena->chunk_hooks);
-}
-
-chunk_hooks_t
-chunk_hooks_get(tsdn_t *tsdn, arena_t *arena)
-{
- chunk_hooks_t chunk_hooks;
-
- malloc_mutex_lock(tsdn, &arena->chunks_mtx);
- chunk_hooks = chunk_hooks_get_locked(arena);
- malloc_mutex_unlock(tsdn, &arena->chunks_mtx);
-
- return (chunk_hooks);
-}
-
-chunk_hooks_t
-chunk_hooks_set(tsdn_t *tsdn, arena_t *arena, const chunk_hooks_t *chunk_hooks)
-{
- chunk_hooks_t old_chunk_hooks;
-
- malloc_mutex_lock(tsdn, &arena->chunks_mtx);
- old_chunk_hooks = arena->chunk_hooks;
- /*
- * Copy each field atomically so that it is impossible for readers to
- * see partially updated pointers. There are places where readers only
- * need one hook function pointer (therefore no need to copy the
- * entirety of arena->chunk_hooks), and stale reads do not affect
- * correctness, so they perform unlocked reads.
- */
-#define ATOMIC_COPY_HOOK(n) do { \
- union { \
- chunk_##n##_t **n; \
- void **v; \
- } u; \
- u.n = &arena->chunk_hooks.n; \
- atomic_write_p(u.v, chunk_hooks->n); \
-} while (0)
- ATOMIC_COPY_HOOK(alloc);
- ATOMIC_COPY_HOOK(dalloc);
- ATOMIC_COPY_HOOK(commit);
- ATOMIC_COPY_HOOK(decommit);
- ATOMIC_COPY_HOOK(purge);
- ATOMIC_COPY_HOOK(split);
- ATOMIC_COPY_HOOK(merge);
-#undef ATOMIC_COPY_HOOK
- malloc_mutex_unlock(tsdn, &arena->chunks_mtx);
-
- return (old_chunk_hooks);
-}
-
-static void
-chunk_hooks_assure_initialized_impl(tsdn_t *tsdn, arena_t *arena,
- chunk_hooks_t *chunk_hooks, bool locked)
-{
- static const chunk_hooks_t uninitialized_hooks =
- CHUNK_HOOKS_INITIALIZER;
-
- if (memcmp(chunk_hooks, &uninitialized_hooks, sizeof(chunk_hooks_t)) ==
- 0) {
- *chunk_hooks = locked ? chunk_hooks_get_locked(arena) :
- chunk_hooks_get(tsdn, arena);
- }
-}
-
-static void
-chunk_hooks_assure_initialized_locked(tsdn_t *tsdn, arena_t *arena,
- chunk_hooks_t *chunk_hooks)
-{
-
- chunk_hooks_assure_initialized_impl(tsdn, arena, chunk_hooks, true);
-}
-
-static void
-chunk_hooks_assure_initialized(tsdn_t *tsdn, arena_t *arena,
- chunk_hooks_t *chunk_hooks)
-{
-
- chunk_hooks_assure_initialized_impl(tsdn, arena, chunk_hooks, false);
-}
-
-bool
-chunk_register(tsdn_t *tsdn, const void *chunk, const extent_node_t *node)
-{
-
- assert(extent_node_addr_get(node) == chunk);
-
- if (rtree_set(&chunks_rtree, (uintptr_t)chunk, node))
- return (true);
- if (config_prof && opt_prof) {
- size_t size = extent_node_size_get(node);
- size_t nadd = (size == 0) ? 1 : size / chunksize;
- size_t cur = atomic_add_z(&curchunks, nadd);
- size_t high = atomic_read_z(&highchunks);
- while (cur > high && atomic_cas_z(&highchunks, high, cur)) {
- /*
- * Don't refresh cur, because it may have decreased
- * since this thread lost the highchunks update race.
- */
- high = atomic_read_z(&highchunks);
- }
- if (cur > high && prof_gdump_get_unlocked())
- prof_gdump(tsdn);
- }
-
- return (false);
-}
-
-void
-chunk_deregister(const void *chunk, const extent_node_t *node)
-{
- bool err;
-
- err = rtree_set(&chunks_rtree, (uintptr_t)chunk, NULL);
- assert(!err);
- if (config_prof && opt_prof) {
- size_t size = extent_node_size_get(node);
- size_t nsub = (size == 0) ? 1 : size / chunksize;
- assert(atomic_read_z(&curchunks) >= nsub);
- atomic_sub_z(&curchunks, nsub);
- }
-}
-
-/*
- * Do first-best-fit chunk selection, i.e. select the lowest chunk that best
- * fits.
- */
-static extent_node_t *
-chunk_first_best_fit(arena_t *arena, extent_tree_t *chunks_szad,
- extent_tree_t *chunks_ad, size_t size)
-{
- extent_node_t key;
-
- assert(size == CHUNK_CEILING(size));
-
- extent_node_init(&key, arena, NULL, size, false, false);
- return (extent_tree_szad_nsearch(chunks_szad, &key));
-}
-
-static void *
-chunk_recycle(tsdn_t *tsdn, arena_t *arena, chunk_hooks_t *chunk_hooks,
- extent_tree_t *chunks_szad, extent_tree_t *chunks_ad, bool cache,
- void *new_addr, size_t size, size_t alignment, bool *zero, bool *commit,
- bool dalloc_node)
-{
- void *ret;
- extent_node_t *node;
- size_t alloc_size, leadsize, trailsize;
- bool zeroed, committed;
-
- assert(new_addr == NULL || alignment == chunksize);
- /*
- * Cached chunks use the node linkage embedded in their headers, in
- * which case dalloc_node is true, and new_addr is non-NULL because
- * we're operating on a specific chunk.
- */
- assert(dalloc_node || new_addr != NULL);
-
- alloc_size = CHUNK_CEILING(s2u(size + alignment - chunksize));
- /* Beware size_t wrap-around. */
- if (alloc_size < size)
- return (NULL);
- malloc_mutex_lock(tsdn, &arena->chunks_mtx);
- chunk_hooks_assure_initialized_locked(tsdn, arena, chunk_hooks);
- if (new_addr != NULL) {
- extent_node_t key;
- extent_node_init(&key, arena, new_addr, alloc_size, false,
- false);
- node = extent_tree_ad_search(chunks_ad, &key);
- } else {
- node = chunk_first_best_fit(arena, chunks_szad, chunks_ad,
- alloc_size);
- }
- if (node == NULL || (new_addr != NULL && extent_node_size_get(node) <
- size)) {
- malloc_mutex_unlock(tsdn, &arena->chunks_mtx);
- return (NULL);
- }
- leadsize = ALIGNMENT_CEILING((uintptr_t)extent_node_addr_get(node),
- alignment) - (uintptr_t)extent_node_addr_get(node);
- assert(new_addr == NULL || leadsize == 0);
- assert(extent_node_size_get(node) >= leadsize + size);
- trailsize = extent_node_size_get(node) - leadsize - size;
- ret = (void *)((uintptr_t)extent_node_addr_get(node) + leadsize);
- zeroed = extent_node_zeroed_get(node);
- if (zeroed)
- *zero = true;
- committed = extent_node_committed_get(node);
- if (committed)
- *commit = true;
- /* Split the lead. */
- if (leadsize != 0 &&
- chunk_hooks->split(extent_node_addr_get(node),
- extent_node_size_get(node), leadsize, size, false, arena->ind)) {
- malloc_mutex_unlock(tsdn, &arena->chunks_mtx);
- return (NULL);
- }
- /* Remove node from the tree. */
- extent_tree_szad_remove(chunks_szad, node);
- extent_tree_ad_remove(chunks_ad, node);
- arena_chunk_cache_maybe_remove(arena, node, cache);
- if (leadsize != 0) {
- /* Insert the leading space as a smaller chunk. */
- extent_node_size_set(node, leadsize);
- extent_tree_szad_insert(chunks_szad, node);
- extent_tree_ad_insert(chunks_ad, node);
- arena_chunk_cache_maybe_insert(arena, node, cache);
- node = NULL;
- }
- if (trailsize != 0) {
- /* Split the trail. */
- if (chunk_hooks->split(ret, size + trailsize, size,
- trailsize, false, arena->ind)) {
- if (dalloc_node && node != NULL)
- arena_node_dalloc(tsdn, arena, node);
- malloc_mutex_unlock(tsdn, &arena->chunks_mtx);
- chunk_record(tsdn, arena, chunk_hooks, chunks_szad,
- chunks_ad, cache, ret, size + trailsize, zeroed,
- committed);
- return (NULL);
- }
- /* Insert the trailing space as a smaller chunk. */
- if (node == NULL) {
- node = arena_node_alloc(tsdn, arena);
- if (node == NULL) {
- malloc_mutex_unlock(tsdn, &arena->chunks_mtx);
- chunk_record(tsdn, arena, chunk_hooks,
- chunks_szad, chunks_ad, cache, ret, size +
- trailsize, zeroed, committed);
- return (NULL);
- }
- }
- extent_node_init(node, arena, (void *)((uintptr_t)(ret) + size),
- trailsize, zeroed, committed);
- extent_tree_szad_insert(chunks_szad, node);
- extent_tree_ad_insert(chunks_ad, node);
- arena_chunk_cache_maybe_insert(arena, node, cache);
- node = NULL;
- }
- if (!committed && chunk_hooks->commit(ret, size, 0, size, arena->ind)) {
- malloc_mutex_unlock(tsdn, &arena->chunks_mtx);
- chunk_record(tsdn, arena, chunk_hooks, chunks_szad, chunks_ad,
- cache, ret, size, zeroed, committed);
- return (NULL);
- }
- malloc_mutex_unlock(tsdn, &arena->chunks_mtx);
-
- assert(dalloc_node || node != NULL);
- if (dalloc_node && node != NULL)
- arena_node_dalloc(tsdn, arena, node);
- if (*zero) {
- if (!zeroed)
- memset(ret, 0, size);
- else if (config_debug) {
- size_t i;
- size_t *p = (size_t *)(uintptr_t)ret;
-
- for (i = 0; i < size / sizeof(size_t); i++)
- assert(p[i] == 0);
- }
- if (config_valgrind)
- JEMALLOC_VALGRIND_MAKE_MEM_DEFINED(ret, size);
- }
- return (ret);
-}
-
-/*
- * If the caller specifies (!*zero), it is still possible to receive zeroed
- * memory, in which case *zero is toggled to true. arena_chunk_alloc() takes
- * advantage of this to avoid demanding zeroed chunks, but taking advantage of
- * them if they are returned.
- */
-static void *
-chunk_alloc_core(tsdn_t *tsdn, arena_t *arena, void *new_addr, size_t size,
- size_t alignment, bool *zero, bool *commit, dss_prec_t dss_prec)
-{
- void *ret;
-
- assert(size != 0);
- assert((size & chunksize_mask) == 0);
- assert(alignment != 0);
- assert((alignment & chunksize_mask) == 0);
-
- /* "primary" dss. */
- if (have_dss && dss_prec == dss_prec_primary && (ret =
- chunk_alloc_dss(tsdn, arena, new_addr, size, alignment, zero,
- commit)) != NULL)
- return (ret);
- /* mmap. */
- if ((ret = chunk_alloc_mmap(new_addr, size, alignment, zero, commit)) !=
- NULL)
- return (ret);
- /* "secondary" dss. */
- if (have_dss && dss_prec == dss_prec_secondary && (ret =
- chunk_alloc_dss(tsdn, arena, new_addr, size, alignment, zero,
- commit)) != NULL)
- return (ret);
-
- /* All strategies for allocation failed. */
- return (NULL);
-}
-
-void *
-chunk_alloc_base(size_t size)
-{
- void *ret;
- bool zero, commit;
-
- /*
- * Directly call chunk_alloc_mmap() rather than chunk_alloc_core()
- * because it's critical that chunk_alloc_base() return untouched
- * demand-zeroed virtual memory.
- */
- zero = true;
- commit = true;
- ret = chunk_alloc_mmap(NULL, size, chunksize, &zero, &commit);
- if (ret == NULL)
- return (NULL);
- if (config_valgrind)
- JEMALLOC_VALGRIND_MAKE_MEM_UNDEFINED(ret, size);
-
- return (ret);
-}
-
-void *
-chunk_alloc_cache(tsdn_t *tsdn, arena_t *arena, chunk_hooks_t *chunk_hooks,
- void *new_addr, size_t size, size_t alignment, bool *zero, bool *commit,
- bool dalloc_node)
-{
- void *ret;
-
- assert(size != 0);
- assert((size & chunksize_mask) == 0);
- assert(alignment != 0);
- assert((alignment & chunksize_mask) == 0);
-
- ret = chunk_recycle(tsdn, arena, chunk_hooks,
- &arena->chunks_szad_cached, &arena->chunks_ad_cached, true,
- new_addr, size, alignment, zero, commit, dalloc_node);
- if (ret == NULL)
- return (NULL);
- if (config_valgrind)
- JEMALLOC_VALGRIND_MAKE_MEM_UNDEFINED(ret, size);
- return (ret);
-}
-
-static arena_t *
-chunk_arena_get(tsdn_t *tsdn, unsigned arena_ind)
-{
- arena_t *arena;
-
- arena = arena_get(tsdn, arena_ind, false);
- /*
- * The arena we're allocating on behalf of must have been initialized
- * already.
- */
- assert(arena != NULL);
- return (arena);
-}
-
-static void *
-chunk_alloc_default_impl(tsdn_t *tsdn, arena_t *arena, void *new_addr,
- size_t size, size_t alignment, bool *zero, bool *commit)
-{
- void *ret;
-
- ret = chunk_alloc_core(tsdn, arena, new_addr, size, alignment, zero,
- commit, arena->dss_prec);
- if (ret == NULL)
- return (NULL);
- if (config_valgrind)
- JEMALLOC_VALGRIND_MAKE_MEM_UNDEFINED(ret, size);
-
- return (ret);
-}
-
-static void *
-chunk_alloc_default(void *new_addr, size_t size, size_t alignment, bool *zero,
- bool *commit, unsigned arena_ind)
-{
- tsdn_t *tsdn;
- arena_t *arena;
-
- tsdn = tsdn_fetch();
- arena = chunk_arena_get(tsdn, arena_ind);
-
- return (chunk_alloc_default_impl(tsdn, arena, new_addr, size, alignment,
- zero, commit));
-}
-
-static void *
-chunk_alloc_retained(tsdn_t *tsdn, arena_t *arena, chunk_hooks_t *chunk_hooks,
- void *new_addr, size_t size, size_t alignment, bool *zero, bool *commit)
-{
- void *ret;
-
- assert(size != 0);
- assert((size & chunksize_mask) == 0);
- assert(alignment != 0);
- assert((alignment & chunksize_mask) == 0);
-
- ret = chunk_recycle(tsdn, arena, chunk_hooks,
- &arena->chunks_szad_retained, &arena->chunks_ad_retained, false,
- new_addr, size, alignment, zero, commit, true);
-
- if (config_stats && ret != NULL)
- arena->stats.retained -= size;
-
- return (ret);
-}
-
-void *
-chunk_alloc_wrapper(tsdn_t *tsdn, arena_t *arena, chunk_hooks_t *chunk_hooks,
- void *new_addr, size_t size, size_t alignment, bool *zero, bool *commit)
-{
- void *ret;
-
- chunk_hooks_assure_initialized(tsdn, arena, chunk_hooks);
-
- ret = chunk_alloc_retained(tsdn, arena, chunk_hooks, new_addr, size,
- alignment, zero, commit);
- if (ret == NULL) {
- if (chunk_hooks->alloc == chunk_alloc_default) {
- /* Call directly to propagate tsdn. */
- ret = chunk_alloc_default_impl(tsdn, arena, new_addr,
- size, alignment, zero, commit);
- } else {
- ret = chunk_hooks->alloc(new_addr, size, alignment,
- zero, commit, arena->ind);
- }
-
- if (ret == NULL)
- return (NULL);
-
- if (config_valgrind && chunk_hooks->alloc !=
- chunk_alloc_default)
- JEMALLOC_VALGRIND_MAKE_MEM_UNDEFINED(ret, chunksize);
- }
-
- return (ret);
-}
-
-static void
-chunk_record(tsdn_t *tsdn, arena_t *arena, chunk_hooks_t *chunk_hooks,
- extent_tree_t *chunks_szad, extent_tree_t *chunks_ad, bool cache,
- void *chunk, size_t size, bool zeroed, bool committed)
-{
- bool unzeroed;
- extent_node_t *node, *prev;
- extent_node_t key;
-
- assert(!cache || !zeroed);
- unzeroed = cache || !zeroed;
- JEMALLOC_VALGRIND_MAKE_MEM_NOACCESS(chunk, size);
-
- malloc_mutex_lock(tsdn, &arena->chunks_mtx);
- chunk_hooks_assure_initialized_locked(tsdn, arena, chunk_hooks);
- extent_node_init(&key, arena, (void *)((uintptr_t)chunk + size), 0,
- false, false);
- node = extent_tree_ad_nsearch(chunks_ad, &key);
- /* Try to coalesce forward. */
- if (node != NULL && extent_node_addr_get(node) ==
- extent_node_addr_get(&key) && extent_node_committed_get(node) ==
- committed && !chunk_hooks->merge(chunk, size,
- extent_node_addr_get(node), extent_node_size_get(node), false,
- arena->ind)) {
- /*
- * Coalesce chunk with the following address range. This does
- * not change the position within chunks_ad, so only
- * remove/insert from/into chunks_szad.
- */
- extent_tree_szad_remove(chunks_szad, node);
- arena_chunk_cache_maybe_remove(arena, node, cache);
- extent_node_addr_set(node, chunk);
- extent_node_size_set(node, size + extent_node_size_get(node));
- extent_node_zeroed_set(node, extent_node_zeroed_get(node) &&
- !unzeroed);
- extent_tree_szad_insert(chunks_szad, node);
- arena_chunk_cache_maybe_insert(arena, node, cache);
- } else {
- /* Coalescing forward failed, so insert a new node. */
- node = arena_node_alloc(tsdn, arena);
- if (node == NULL) {
- /*
- * Node allocation failed, which is an exceedingly
- * unlikely failure. Leak chunk after making sure its
- * pages have already been purged, so that this is only
- * a virtual memory leak.
- */
- if (cache) {
- chunk_purge_wrapper(tsdn, arena, chunk_hooks,
- chunk, size, 0, size);
- }
- goto label_return;
- }
- extent_node_init(node, arena, chunk, size, !unzeroed,
- committed);
- extent_tree_ad_insert(chunks_ad, node);
- extent_tree_szad_insert(chunks_szad, node);
- arena_chunk_cache_maybe_insert(arena, node, cache);
- }
-
- /* Try to coalesce backward. */
- prev = extent_tree_ad_prev(chunks_ad, node);
- if (prev != NULL && (void *)((uintptr_t)extent_node_addr_get(prev) +
- extent_node_size_get(prev)) == chunk &&
- extent_node_committed_get(prev) == committed &&
- !chunk_hooks->merge(extent_node_addr_get(prev),
- extent_node_size_get(prev), chunk, size, false, arena->ind)) {
- /*
- * Coalesce chunk with the previous address range. This does
- * not change the position within chunks_ad, so only
- * remove/insert node from/into chunks_szad.
- */
- extent_tree_szad_remove(chunks_szad, prev);
- extent_tree_ad_remove(chunks_ad, prev);
- arena_chunk_cache_maybe_remove(arena, prev, cache);
- extent_tree_szad_remove(chunks_szad, node);
- arena_chunk_cache_maybe_remove(arena, node, cache);
- extent_node_addr_set(node, extent_node_addr_get(prev));
- extent_node_size_set(node, extent_node_size_get(prev) +
- extent_node_size_get(node));
- extent_node_zeroed_set(node, extent_node_zeroed_get(prev) &&
- extent_node_zeroed_get(node));
- extent_tree_szad_insert(chunks_szad, node);
- arena_chunk_cache_maybe_insert(arena, node, cache);
-
- arena_node_dalloc(tsdn, arena, prev);
- }
-
-label_return:
- malloc_mutex_unlock(tsdn, &arena->chunks_mtx);
-}
-
-void
-chunk_dalloc_cache(tsdn_t *tsdn, arena_t *arena, chunk_hooks_t *chunk_hooks,
- void *chunk, size_t size, bool committed)
-{
-
- assert(chunk != NULL);
- assert(CHUNK_ADDR2BASE(chunk) == chunk);
- assert(size != 0);
- assert((size & chunksize_mask) == 0);
-
- chunk_record(tsdn, arena, chunk_hooks, &arena->chunks_szad_cached,
- &arena->chunks_ad_cached, true, chunk, size, false, committed);
- arena_maybe_purge(tsdn, arena);
-}
-
-static bool
-chunk_dalloc_default_impl(void *chunk, size_t size)
-{
-
- if (!have_dss || !chunk_in_dss(chunk))
- return (chunk_dalloc_mmap(chunk, size));
- return (true);
-}
-
-static bool
-chunk_dalloc_default(void *chunk, size_t size, bool committed,
- unsigned arena_ind)
-{
-
- return (chunk_dalloc_default_impl(chunk, size));
-}
-
-void
-chunk_dalloc_wrapper(tsdn_t *tsdn, arena_t *arena, chunk_hooks_t *chunk_hooks,
- void *chunk, size_t size, bool zeroed, bool committed)
-{
- bool err;
-
- assert(chunk != NULL);
- assert(CHUNK_ADDR2BASE(chunk) == chunk);
- assert(size != 0);
- assert((size & chunksize_mask) == 0);
-
- chunk_hooks_assure_initialized(tsdn, arena, chunk_hooks);
- /* Try to deallocate. */
- if (chunk_hooks->dalloc == chunk_dalloc_default) {
- /* Call directly to propagate tsdn. */
- err = chunk_dalloc_default_impl(chunk, size);
- } else
- err = chunk_hooks->dalloc(chunk, size, committed, arena->ind);
-
- if (!err)
- return;
- /* Try to decommit; purge if that fails. */
- if (committed) {
- committed = chunk_hooks->decommit(chunk, size, 0, size,
- arena->ind);
- }
- zeroed = !committed || !chunk_hooks->purge(chunk, size, 0, size,
- arena->ind);
- chunk_record(tsdn, arena, chunk_hooks, &arena->chunks_szad_retained,
- &arena->chunks_ad_retained, false, chunk, size, zeroed, committed);
-
- if (config_stats)
- arena->stats.retained += size;
-}
-
-static bool
-chunk_commit_default(void *chunk, size_t size, size_t offset, size_t length,
- unsigned arena_ind)
-{
-
- return (pages_commit((void *)((uintptr_t)chunk + (uintptr_t)offset),
- length));
-}
-
-static bool
-chunk_decommit_default(void *chunk, size_t size, size_t offset, size_t length,
- unsigned arena_ind)
-{
-
- return (pages_decommit((void *)((uintptr_t)chunk + (uintptr_t)offset),
- length));
-}
-
-static bool
-chunk_purge_default(void *chunk, size_t size, size_t offset, size_t length,
- unsigned arena_ind)
-{
-
- assert(chunk != NULL);
- assert(CHUNK_ADDR2BASE(chunk) == chunk);
- assert((offset & PAGE_MASK) == 0);
- assert(length != 0);
- assert((length & PAGE_MASK) == 0);
-
- return (pages_purge((void *)((uintptr_t)chunk + (uintptr_t)offset),
- length));
-}
-
-bool
-chunk_purge_wrapper(tsdn_t *tsdn, arena_t *arena, chunk_hooks_t *chunk_hooks,
- void *chunk, size_t size, size_t offset, size_t length)
-{
-
- chunk_hooks_assure_initialized(tsdn, arena, chunk_hooks);
- return (chunk_hooks->purge(chunk, size, offset, length, arena->ind));
-}
-
-static bool
-chunk_split_default(void *chunk, size_t size, size_t size_a, size_t size_b,
- bool committed, unsigned arena_ind)
-{
-
- if (!maps_coalesce)
- return (true);
- return (false);
-}
-
-static bool
-chunk_merge_default_impl(void *chunk_a, void *chunk_b)
-{
-
- if (!maps_coalesce)
- return (true);
- if (have_dss && !chunk_dss_mergeable(chunk_a, chunk_b))
- return (true);
-
- return (false);
-}
-
-static bool
-chunk_merge_default(void *chunk_a, size_t size_a, void *chunk_b, size_t size_b,
- bool committed, unsigned arena_ind)
-{
-
- return (chunk_merge_default_impl(chunk_a, chunk_b));
-}
-
-static rtree_node_elm_t *
-chunks_rtree_node_alloc(size_t nelms)
-{
-
- return ((rtree_node_elm_t *)base_alloc(TSDN_NULL, nelms *
- sizeof(rtree_node_elm_t)));
-}
-
-bool
-chunk_boot(void)
-{
-#ifdef _WIN32
- SYSTEM_INFO info;
- GetSystemInfo(&info);
-
- /*
- * Verify actual page size is equal to or an integral multiple of
- * configured page size.
- */
- if (info.dwPageSize & ((1U << LG_PAGE) - 1))
- return (true);
-
- /*
- * Configure chunksize (if not set) to match granularity (usually 64K),
- * so pages_map will always take fast path.
- */
- if (!opt_lg_chunk) {
- opt_lg_chunk = ffs_u((unsigned)info.dwAllocationGranularity)
- - 1;
- }
-#else
- if (!opt_lg_chunk)
- opt_lg_chunk = LG_CHUNK_DEFAULT;
-#endif
-
- /* Set variables according to the value of opt_lg_chunk. */
- chunksize = (ZU(1) << opt_lg_chunk);
- assert(chunksize >= PAGE);
- chunksize_mask = chunksize - 1;
- chunk_npages = (chunksize >> LG_PAGE);
-
- if (have_dss)
- chunk_dss_boot();
- if (rtree_new(&chunks_rtree, (unsigned)((ZU(1) << (LG_SIZEOF_PTR+3)) -
- opt_lg_chunk), chunks_rtree_node_alloc, NULL))
- return (true);
-
- return (false);
-}
diff --git a/memory/jemalloc/src/src/chunk_dss.c b/memory/jemalloc/src/src/chunk_dss.c
deleted file mode 100644
index 85a13548f4..0000000000
--- a/memory/jemalloc/src/src/chunk_dss.c
+++ /dev/null
@@ -1,237 +0,0 @@
-#define JEMALLOC_CHUNK_DSS_C_
-#include "jemalloc/internal/jemalloc_internal.h"
-/******************************************************************************/
-/* Data. */
-
-const char *dss_prec_names[] = {
- "disabled",
- "primary",
- "secondary",
- "N/A"
-};
-
-/*
- * Current dss precedence default, used when creating new arenas. NB: This is
- * stored as unsigned rather than dss_prec_t because in principle there's no
- * guarantee that sizeof(dss_prec_t) is the same as sizeof(unsigned), and we use
- * atomic operations to synchronize the setting.
- */
-static unsigned dss_prec_default = (unsigned)DSS_PREC_DEFAULT;
-
-/* Base address of the DSS. */
-static void *dss_base;
-/* Atomic boolean indicating whether the DSS is exhausted. */
-static unsigned dss_exhausted;
-/* Atomic current upper limit on DSS addresses. */
-static void *dss_max;
-
-/******************************************************************************/
-
-static void *
-chunk_dss_sbrk(intptr_t increment)
-{
-
-#ifdef JEMALLOC_DSS
- return (sbrk(increment));
-#else
- not_implemented();
- return (NULL);
-#endif
-}
-
-dss_prec_t
-chunk_dss_prec_get(void)
-{
- dss_prec_t ret;
-
- if (!have_dss)
- return (dss_prec_disabled);
- ret = (dss_prec_t)atomic_read_u(&dss_prec_default);
- return (ret);
-}
-
-bool
-chunk_dss_prec_set(dss_prec_t dss_prec)
-{
-
- if (!have_dss)
- return (dss_prec != dss_prec_disabled);
- atomic_write_u(&dss_prec_default, (unsigned)dss_prec);
- return (false);
-}
-
-static void *
-chunk_dss_max_update(void *new_addr)
-{
- void *max_cur;
- spin_t spinner;
-
- /*
- * Get the current end of the DSS as max_cur and assure that dss_max is
- * up to date.
- */
- spin_init(&spinner);
- while (true) {
- void *max_prev = atomic_read_p(&dss_max);
-
- max_cur = chunk_dss_sbrk(0);
- if ((uintptr_t)max_prev > (uintptr_t)max_cur) {
- /*
- * Another thread optimistically updated dss_max. Wait
- * for it to finish.
- */
- spin_adaptive(&spinner);
- continue;
- }
- if (!atomic_cas_p(&dss_max, max_prev, max_cur))
- break;
- }
- /* Fixed new_addr can only be supported if it is at the edge of DSS. */
- if (new_addr != NULL && max_cur != new_addr)
- return (NULL);
-
- return (max_cur);
-}
-
-void *
-chunk_alloc_dss(tsdn_t *tsdn, arena_t *arena, void *new_addr, size_t size,
- size_t alignment, bool *zero, bool *commit)
-{
- cassert(have_dss);
- assert(size > 0 && (size & chunksize_mask) == 0);
- assert(alignment > 0 && (alignment & chunksize_mask) == 0);
-
- /*
- * sbrk() uses a signed increment argument, so take care not to
- * interpret a huge allocation request as a negative increment.
- */
- if ((intptr_t)size < 0)
- return (NULL);
-
- if (!atomic_read_u(&dss_exhausted)) {
- /*
- * The loop is necessary to recover from races with other
- * threads that are using the DSS for something other than
- * malloc.
- */
- while (true) {
- void *ret, *cpad, *max_cur, *dss_next, *dss_prev;
- size_t gap_size, cpad_size;
- intptr_t incr;
-
- max_cur = chunk_dss_max_update(new_addr);
- if (max_cur == NULL)
- goto label_oom;
-
- /*
- * Calculate how much padding is necessary to
- * chunk-align the end of the DSS.
- */
- gap_size = (chunksize - CHUNK_ADDR2OFFSET(dss_max)) &
- chunksize_mask;
- /*
- * Compute how much chunk-aligned pad space (if any) is
- * necessary to satisfy alignment. This space can be
- * recycled for later use.
- */
- cpad = (void *)((uintptr_t)dss_max + gap_size);
- ret = (void *)ALIGNMENT_CEILING((uintptr_t)dss_max,
- alignment);
- cpad_size = (uintptr_t)ret - (uintptr_t)cpad;
- dss_next = (void *)((uintptr_t)ret + size);
- if ((uintptr_t)ret < (uintptr_t)dss_max ||
- (uintptr_t)dss_next < (uintptr_t)dss_max)
- goto label_oom; /* Wrap-around. */
- incr = gap_size + cpad_size + size;
-
- /*
- * Optimistically update dss_max, and roll back below if
- * sbrk() fails. No other thread will try to extend the
- * DSS while dss_max is greater than the current DSS
- * max reported by sbrk(0).
- */
- if (atomic_cas_p(&dss_max, max_cur, dss_next))
- continue;
-
- /* Try to allocate. */
- dss_prev = chunk_dss_sbrk(incr);
- if (dss_prev == max_cur) {
- /* Success. */
- if (cpad_size != 0) {
- chunk_hooks_t chunk_hooks =
- CHUNK_HOOKS_INITIALIZER;
- chunk_dalloc_wrapper(tsdn, arena,
- &chunk_hooks, cpad, cpad_size,
- false, true);
- }
- if (*zero) {
- JEMALLOC_VALGRIND_MAKE_MEM_UNDEFINED(
- ret, size);
- memset(ret, 0, size);
- }
- if (!*commit)
- *commit = pages_decommit(ret, size);
- return (ret);
- }
-
- /*
- * Failure, whether due to OOM or a race with a raw
- * sbrk() call from outside the allocator. Try to roll
- * back optimistic dss_max update; if rollback fails,
- * it's due to another caller of this function having
- * succeeded since this invocation started, in which
- * case rollback is not necessary.
- */
- atomic_cas_p(&dss_max, dss_next, max_cur);
- if (dss_prev == (void *)-1) {
- /* OOM. */
- atomic_write_u(&dss_exhausted, (unsigned)true);
- goto label_oom;
- }
- }
- }
-label_oom:
- return (NULL);
-}
-
-static bool
-chunk_in_dss_helper(void *chunk, void *max)
-{
-
- return ((uintptr_t)chunk >= (uintptr_t)dss_base && (uintptr_t)chunk <
- (uintptr_t)max);
-}
-
-bool
-chunk_in_dss(void *chunk)
-{
-
- cassert(have_dss);
-
- return (chunk_in_dss_helper(chunk, atomic_read_p(&dss_max)));
-}
-
-bool
-chunk_dss_mergeable(void *chunk_a, void *chunk_b)
-{
- void *max;
-
- cassert(have_dss);
-
- max = atomic_read_p(&dss_max);
- return (chunk_in_dss_helper(chunk_a, max) ==
- chunk_in_dss_helper(chunk_b, max));
-}
-
-void
-chunk_dss_boot(void)
-{
-
- cassert(have_dss);
-
- dss_base = chunk_dss_sbrk(0);
- dss_exhausted = (unsigned)(dss_base == (void *)-1);
- dss_max = dss_base;
-}
-
-/******************************************************************************/
diff --git a/memory/jemalloc/src/src/chunk_mmap.c b/memory/jemalloc/src/src/chunk_mmap.c
deleted file mode 100644
index 73fc497afb..0000000000
--- a/memory/jemalloc/src/src/chunk_mmap.c
+++ /dev/null
@@ -1,78 +0,0 @@
-#define JEMALLOC_CHUNK_MMAP_C_
-#include "jemalloc/internal/jemalloc_internal.h"
-
-/******************************************************************************/
-
-static void *
-chunk_alloc_mmap_slow(size_t size, size_t alignment, bool *zero, bool *commit)
-{
- void *ret;
- size_t alloc_size;
-
- alloc_size = size + alignment - PAGE;
- /* Beware size_t wrap-around. */
- if (alloc_size < size)
- return (NULL);
- do {
- void *pages;
- size_t leadsize;
- pages = pages_map(NULL, alloc_size, commit);
- if (pages == NULL)
- return (NULL);
- leadsize = ALIGNMENT_CEILING((uintptr_t)pages, alignment) -
- (uintptr_t)pages;
- ret = pages_trim(pages, alloc_size, leadsize, size, commit);
- } while (ret == NULL);
-
- assert(ret != NULL);
- *zero = true;
- return (ret);
-}
-
-void *
-chunk_alloc_mmap(void *new_addr, size_t size, size_t alignment, bool *zero,
- bool *commit)
-{
- void *ret;
- size_t offset;
-
- /*
- * Ideally, there would be a way to specify alignment to mmap() (like
- * NetBSD has), but in the absence of such a feature, we have to work
- * hard to efficiently create aligned mappings. The reliable, but
- * slow method is to create a mapping that is over-sized, then trim the
- * excess. However, that always results in one or two calls to
- * pages_unmap().
- *
- * Optimistically try mapping precisely the right amount before falling
- * back to the slow method, with the expectation that the optimistic
- * approach works most of the time.
- */
-
- assert(alignment != 0);
- assert((alignment & chunksize_mask) == 0);
-
- ret = pages_map(new_addr, size, commit);
- if (ret == NULL || ret == new_addr)
- return (ret);
- assert(new_addr == NULL);
- offset = ALIGNMENT_ADDR2OFFSET(ret, alignment);
- if (offset != 0) {
- pages_unmap(ret, size);
- return (chunk_alloc_mmap_slow(size, alignment, zero, commit));
- }
-
- assert(ret != NULL);
- *zero = true;
- return (ret);
-}
-
-bool
-chunk_dalloc_mmap(void *chunk, size_t size)
-{
-
- if (config_munmap)
- pages_unmap(chunk, size);
-
- return (!config_munmap);
-}
diff --git a/memory/jemalloc/src/src/ckh.c b/memory/jemalloc/src/src/ckh.c
deleted file mode 100644
index 159bd8ae16..0000000000
--- a/memory/jemalloc/src/src/ckh.c
+++ /dev/null
@@ -1,569 +0,0 @@
-/*
- *******************************************************************************
- * Implementation of (2^1+,2) cuckoo hashing, where 2^1+ indicates that each
- * hash bucket contains 2^n cells, for n >= 1, and 2 indicates that two hash
- * functions are employed. The original cuckoo hashing algorithm was described
- * in:
- *
- * Pagh, R., F.F. Rodler (2004) Cuckoo Hashing. Journal of Algorithms
- * 51(2):122-144.
- *
- * Generalization of cuckoo hashing was discussed in:
- *
- * Erlingsson, U., M. Manasse, F. McSherry (2006) A cool and practical
- * alternative to traditional hash tables. In Proceedings of the 7th
- * Workshop on Distributed Data and Structures (WDAS'06), Santa Clara, CA,
- * January 2006.
- *
- * This implementation uses precisely two hash functions because that is the
- * fewest that can work, and supporting multiple hashes is an implementation
- * burden. Here is a reproduction of Figure 1 from Erlingsson et al. (2006)
- * that shows approximate expected maximum load factors for various
- * configurations:
- *
- * | #cells/bucket |
- * #hashes | 1 | 2 | 4 | 8 |
- * --------+-------+-------+-------+-------+
- * 1 | 0.006 | 0.006 | 0.03 | 0.12 |
- * 2 | 0.49 | 0.86 |>0.93< |>0.96< |
- * 3 | 0.91 | 0.97 | 0.98 | 0.999 |
- * 4 | 0.97 | 0.99 | 0.999 | |
- *
- * The number of cells per bucket is chosen such that a bucket fits in one cache
- * line. So, on 32- and 64-bit systems, we use (8,2) and (4,2) cuckoo hashing,
- * respectively.
- *
- ******************************************************************************/
-#define JEMALLOC_CKH_C_
-#include "jemalloc/internal/jemalloc_internal.h"
-
-/******************************************************************************/
-/* Function prototypes for non-inline static functions. */
-
-static bool ckh_grow(tsd_t *tsd, ckh_t *ckh);
-static void ckh_shrink(tsd_t *tsd, ckh_t *ckh);
-
-/******************************************************************************/
-
-/*
- * Search bucket for key and return the cell number if found; SIZE_T_MAX
- * otherwise.
- */
-JEMALLOC_INLINE_C size_t
-ckh_bucket_search(ckh_t *ckh, size_t bucket, const void *key)
-{
- ckhc_t *cell;
- unsigned i;
-
- for (i = 0; i < (ZU(1) << LG_CKH_BUCKET_CELLS); i++) {
- cell = &ckh->tab[(bucket << LG_CKH_BUCKET_CELLS) + i];
- if (cell->key != NULL && ckh->keycomp(key, cell->key))
- return ((bucket << LG_CKH_BUCKET_CELLS) + i);
- }
-
- return (SIZE_T_MAX);
-}
-
-/*
- * Search table for key and return cell number if found; SIZE_T_MAX otherwise.
- */
-JEMALLOC_INLINE_C size_t
-ckh_isearch(ckh_t *ckh, const void *key)
-{
- size_t hashes[2], bucket, cell;
-
- assert(ckh != NULL);
-
- ckh->hash(key, hashes);
-
- /* Search primary bucket. */
- bucket = hashes[0] & ((ZU(1) << ckh->lg_curbuckets) - 1);
- cell = ckh_bucket_search(ckh, bucket, key);
- if (cell != SIZE_T_MAX)
- return (cell);
-
- /* Search secondary bucket. */
- bucket = hashes[1] & ((ZU(1) << ckh->lg_curbuckets) - 1);
- cell = ckh_bucket_search(ckh, bucket, key);
- return (cell);
-}
-
-JEMALLOC_INLINE_C bool
-ckh_try_bucket_insert(ckh_t *ckh, size_t bucket, const void *key,
- const void *data)
-{
- ckhc_t *cell;
- unsigned offset, i;
-
- /*
- * Cycle through the cells in the bucket, starting at a random position.
- * The randomness avoids worst-case search overhead as buckets fill up.
- */
- offset = (unsigned)prng_lg_range_u64(&ckh->prng_state,
- LG_CKH_BUCKET_CELLS);
- for (i = 0; i < (ZU(1) << LG_CKH_BUCKET_CELLS); i++) {
- cell = &ckh->tab[(bucket << LG_CKH_BUCKET_CELLS) +
- ((i + offset) & ((ZU(1) << LG_CKH_BUCKET_CELLS) - 1))];
- if (cell->key == NULL) {
- cell->key = key;
- cell->data = data;
- ckh->count++;
- return (false);
- }
- }
-
- return (true);
-}
-
-/*
- * No space is available in bucket. Randomly evict an item, then try to find an
- * alternate location for that item. Iteratively repeat this
- * eviction/relocation procedure until either success or detection of an
- * eviction/relocation bucket cycle.
- */
-JEMALLOC_INLINE_C bool
-ckh_evict_reloc_insert(ckh_t *ckh, size_t argbucket, void const **argkey,
- void const **argdata)
-{
- const void *key, *data, *tkey, *tdata;
- ckhc_t *cell;
- size_t hashes[2], bucket, tbucket;
- unsigned i;
-
- bucket = argbucket;
- key = *argkey;
- data = *argdata;
- while (true) {
- /*
- * Choose a random item within the bucket to evict. This is
- * critical to correct function, because without (eventually)
- * evicting all items within a bucket during iteration, it
- * would be possible to get stuck in an infinite loop if there
- * were an item for which both hashes indicated the same
- * bucket.
- */
- i = (unsigned)prng_lg_range_u64(&ckh->prng_state,
- LG_CKH_BUCKET_CELLS);
- cell = &ckh->tab[(bucket << LG_CKH_BUCKET_CELLS) + i];
- assert(cell->key != NULL);
-
- /* Swap cell->{key,data} and {key,data} (evict). */
- tkey = cell->key; tdata = cell->data;
- cell->key = key; cell->data = data;
- key = tkey; data = tdata;
-
-#ifdef CKH_COUNT
- ckh->nrelocs++;
-#endif
-
- /* Find the alternate bucket for the evicted item. */
- ckh->hash(key, hashes);
- tbucket = hashes[1] & ((ZU(1) << ckh->lg_curbuckets) - 1);
- if (tbucket == bucket) {
- tbucket = hashes[0] & ((ZU(1) << ckh->lg_curbuckets)
- - 1);
- /*
- * It may be that (tbucket == bucket) still, if the
- * item's hashes both indicate this bucket. However,
- * we are guaranteed to eventually escape this bucket
- * during iteration, assuming pseudo-random item
- * selection (true randomness would make infinite
- * looping a remote possibility). The reason we can
- * never get trapped forever is that there are two
- * cases:
- *
- * 1) This bucket == argbucket, so we will quickly
- * detect an eviction cycle and terminate.
- * 2) An item was evicted to this bucket from another,
- * which means that at least one item in this bucket
- * has hashes that indicate distinct buckets.
- */
- }
- /* Check for a cycle. */
- if (tbucket == argbucket) {
- *argkey = key;
- *argdata = data;
- return (true);
- }
-
- bucket = tbucket;
- if (!ckh_try_bucket_insert(ckh, bucket, key, data))
- return (false);
- }
-}
-
-JEMALLOC_INLINE_C bool
-ckh_try_insert(ckh_t *ckh, void const**argkey, void const**argdata)
-{
- size_t hashes[2], bucket;
- const void *key = *argkey;
- const void *data = *argdata;
-
- ckh->hash(key, hashes);
-
- /* Try to insert in primary bucket. */
- bucket = hashes[0] & ((ZU(1) << ckh->lg_curbuckets) - 1);
- if (!ckh_try_bucket_insert(ckh, bucket, key, data))
- return (false);
-
- /* Try to insert in secondary bucket. */
- bucket = hashes[1] & ((ZU(1) << ckh->lg_curbuckets) - 1);
- if (!ckh_try_bucket_insert(ckh, bucket, key, data))
- return (false);
-
- /*
- * Try to find a place for this item via iterative eviction/relocation.
- */
- return (ckh_evict_reloc_insert(ckh, bucket, argkey, argdata));
-}
-
-/*
- * Try to rebuild the hash table from scratch by inserting all items from the
- * old table into the new.
- */
-JEMALLOC_INLINE_C bool
-ckh_rebuild(ckh_t *ckh, ckhc_t *aTab)
-{
- size_t count, i, nins;
- const void *key, *data;
-
- count = ckh->count;
- ckh->count = 0;
- for (i = nins = 0; nins < count; i++) {
- if (aTab[i].key != NULL) {
- key = aTab[i].key;
- data = aTab[i].data;
- if (ckh_try_insert(ckh, &key, &data)) {
- ckh->count = count;
- return (true);
- }
- nins++;
- }
- }
-
- return (false);
-}
-
-static bool
-ckh_grow(tsd_t *tsd, ckh_t *ckh)
-{
- bool ret;
- ckhc_t *tab, *ttab;
- unsigned lg_prevbuckets, lg_curcells;
-
-#ifdef CKH_COUNT
- ckh->ngrows++;
-#endif
-
- /*
- * It is possible (though unlikely, given well behaved hashes) that the
- * table will have to be doubled more than once in order to create a
- * usable table.
- */
- lg_prevbuckets = ckh->lg_curbuckets;
- lg_curcells = ckh->lg_curbuckets + LG_CKH_BUCKET_CELLS;
- while (true) {
- size_t usize;
-
- lg_curcells++;
- usize = sa2u(sizeof(ckhc_t) << lg_curcells, CACHELINE);
- if (unlikely(usize == 0 || usize > HUGE_MAXCLASS)) {
- ret = true;
- goto label_return;
- }
- tab = (ckhc_t *)ipallocztm(tsd_tsdn(tsd), usize, CACHELINE,
- true, NULL, true, arena_ichoose(tsd, NULL));
- if (tab == NULL) {
- ret = true;
- goto label_return;
- }
- /* Swap in new table. */
- ttab = ckh->tab;
- ckh->tab = tab;
- tab = ttab;
- ckh->lg_curbuckets = lg_curcells - LG_CKH_BUCKET_CELLS;
-
- if (!ckh_rebuild(ckh, tab)) {
- idalloctm(tsd_tsdn(tsd), tab, NULL, true, true);
- break;
- }
-
- /* Rebuilding failed, so back out partially rebuilt table. */
- idalloctm(tsd_tsdn(tsd), ckh->tab, NULL, true, true);
- ckh->tab = tab;
- ckh->lg_curbuckets = lg_prevbuckets;
- }
-
- ret = false;
-label_return:
- return (ret);
-}
-
-static void
-ckh_shrink(tsd_t *tsd, ckh_t *ckh)
-{
- ckhc_t *tab, *ttab;
- size_t usize;
- unsigned lg_prevbuckets, lg_curcells;
-
- /*
- * It is possible (though unlikely, given well behaved hashes) that the
- * table rebuild will fail.
- */
- lg_prevbuckets = ckh->lg_curbuckets;
- lg_curcells = ckh->lg_curbuckets + LG_CKH_BUCKET_CELLS - 1;
- usize = sa2u(sizeof(ckhc_t) << lg_curcells, CACHELINE);
- if (unlikely(usize == 0 || usize > HUGE_MAXCLASS))
- return;
- tab = (ckhc_t *)ipallocztm(tsd_tsdn(tsd), usize, CACHELINE, true, NULL,
- true, arena_ichoose(tsd, NULL));
- if (tab == NULL) {
- /*
- * An OOM error isn't worth propagating, since it doesn't
- * prevent this or future operations from proceeding.
- */
- return;
- }
- /* Swap in new table. */
- ttab = ckh->tab;
- ckh->tab = tab;
- tab = ttab;
- ckh->lg_curbuckets = lg_curcells - LG_CKH_BUCKET_CELLS;
-
- if (!ckh_rebuild(ckh, tab)) {
- idalloctm(tsd_tsdn(tsd), tab, NULL, true, true);
-#ifdef CKH_COUNT
- ckh->nshrinks++;
-#endif
- return;
- }
-
- /* Rebuilding failed, so back out partially rebuilt table. */
- idalloctm(tsd_tsdn(tsd), ckh->tab, NULL, true, true);
- ckh->tab = tab;
- ckh->lg_curbuckets = lg_prevbuckets;
-#ifdef CKH_COUNT
- ckh->nshrinkfails++;
-#endif
-}
-
-bool
-ckh_new(tsd_t *tsd, ckh_t *ckh, size_t minitems, ckh_hash_t *hash,
- ckh_keycomp_t *keycomp)
-{
- bool ret;
- size_t mincells, usize;
- unsigned lg_mincells;
-
- assert(minitems > 0);
- assert(hash != NULL);
- assert(keycomp != NULL);
-
-#ifdef CKH_COUNT
- ckh->ngrows = 0;
- ckh->nshrinks = 0;
- ckh->nshrinkfails = 0;
- ckh->ninserts = 0;
- ckh->nrelocs = 0;
-#endif
- ckh->prng_state = 42; /* Value doesn't really matter. */
- ckh->count = 0;
-
- /*
- * Find the minimum power of 2 that is large enough to fit minitems
- * entries. We are using (2+,2) cuckoo hashing, which has an expected
- * maximum load factor of at least ~0.86, so 0.75 is a conservative load
- * factor that will typically allow mincells items to fit without ever
- * growing the table.
- */
- assert(LG_CKH_BUCKET_CELLS > 0);
- mincells = ((minitems + (3 - (minitems % 3))) / 3) << 2;
- for (lg_mincells = LG_CKH_BUCKET_CELLS;
- (ZU(1) << lg_mincells) < mincells;
- lg_mincells++)
- ; /* Do nothing. */
- ckh->lg_minbuckets = lg_mincells - LG_CKH_BUCKET_CELLS;
- ckh->lg_curbuckets = lg_mincells - LG_CKH_BUCKET_CELLS;
- ckh->hash = hash;
- ckh->keycomp = keycomp;
-
- usize = sa2u(sizeof(ckhc_t) << lg_mincells, CACHELINE);
- if (unlikely(usize == 0 || usize > HUGE_MAXCLASS)) {
- ret = true;
- goto label_return;
- }
- ckh->tab = (ckhc_t *)ipallocztm(tsd_tsdn(tsd), usize, CACHELINE, true,
- NULL, true, arena_ichoose(tsd, NULL));
- if (ckh->tab == NULL) {
- ret = true;
- goto label_return;
- }
-
- ret = false;
-label_return:
- return (ret);
-}
-
-void
-ckh_delete(tsd_t *tsd, ckh_t *ckh)
-{
-
- assert(ckh != NULL);
-
-#ifdef CKH_VERBOSE
- malloc_printf(
- "%s(%p): ngrows: %"FMTu64", nshrinks: %"FMTu64","
- " nshrinkfails: %"FMTu64", ninserts: %"FMTu64","
- " nrelocs: %"FMTu64"\n", __func__, ckh,
- (unsigned long long)ckh->ngrows,
- (unsigned long long)ckh->nshrinks,
- (unsigned long long)ckh->nshrinkfails,
- (unsigned long long)ckh->ninserts,
- (unsigned long long)ckh->nrelocs);
-#endif
-
- idalloctm(tsd_tsdn(tsd), ckh->tab, NULL, true, true);
- if (config_debug)
- memset(ckh, JEMALLOC_FREE_JUNK, sizeof(ckh_t));
-}
-
-size_t
-ckh_count(ckh_t *ckh)
-{
-
- assert(ckh != NULL);
-
- return (ckh->count);
-}
-
-bool
-ckh_iter(ckh_t *ckh, size_t *tabind, void **key, void **data)
-{
- size_t i, ncells;
-
- for (i = *tabind, ncells = (ZU(1) << (ckh->lg_curbuckets +
- LG_CKH_BUCKET_CELLS)); i < ncells; i++) {
- if (ckh->tab[i].key != NULL) {
- if (key != NULL)
- *key = (void *)ckh->tab[i].key;
- if (data != NULL)
- *data = (void *)ckh->tab[i].data;
- *tabind = i + 1;
- return (false);
- }
- }
-
- return (true);
-}
-
-bool
-ckh_insert(tsd_t *tsd, ckh_t *ckh, const void *key, const void *data)
-{
- bool ret;
-
- assert(ckh != NULL);
- assert(ckh_search(ckh, key, NULL, NULL));
-
-#ifdef CKH_COUNT
- ckh->ninserts++;
-#endif
-
- while (ckh_try_insert(ckh, &key, &data)) {
- if (ckh_grow(tsd, ckh)) {
- ret = true;
- goto label_return;
- }
- }
-
- ret = false;
-label_return:
- return (ret);
-}
-
-bool
-ckh_remove(tsd_t *tsd, ckh_t *ckh, const void *searchkey, void **key,
- void **data)
-{
- size_t cell;
-
- assert(ckh != NULL);
-
- cell = ckh_isearch(ckh, searchkey);
- if (cell != SIZE_T_MAX) {
- if (key != NULL)
- *key = (void *)ckh->tab[cell].key;
- if (data != NULL)
- *data = (void *)ckh->tab[cell].data;
- ckh->tab[cell].key = NULL;
- ckh->tab[cell].data = NULL; /* Not necessary. */
-
- ckh->count--;
- /* Try to halve the table if it is less than 1/4 full. */
- if (ckh->count < (ZU(1) << (ckh->lg_curbuckets
- + LG_CKH_BUCKET_CELLS - 2)) && ckh->lg_curbuckets
- > ckh->lg_minbuckets) {
- /* Ignore error due to OOM. */
- ckh_shrink(tsd, ckh);
- }
-
- return (false);
- }
-
- return (true);
-}
-
-bool
-ckh_search(ckh_t *ckh, const void *searchkey, void **key, void **data)
-{
- size_t cell;
-
- assert(ckh != NULL);
-
- cell = ckh_isearch(ckh, searchkey);
- if (cell != SIZE_T_MAX) {
- if (key != NULL)
- *key = (void *)ckh->tab[cell].key;
- if (data != NULL)
- *data = (void *)ckh->tab[cell].data;
- return (false);
- }
-
- return (true);
-}
-
-void
-ckh_string_hash(const void *key, size_t r_hash[2])
-{
-
- hash(key, strlen((const char *)key), 0x94122f33U, r_hash);
-}
-
-bool
-ckh_string_keycomp(const void *k1, const void *k2)
-{
-
- assert(k1 != NULL);
- assert(k2 != NULL);
-
- return (strcmp((char *)k1, (char *)k2) ? false : true);
-}
-
-void
-ckh_pointer_hash(const void *key, size_t r_hash[2])
-{
- union {
- const void *v;
- size_t i;
- } u;
-
- assert(sizeof(u.v) == sizeof(u.i));
- u.v = key;
- hash(&u.i, sizeof(u.i), 0xd983396eU, r_hash);
-}
-
-bool
-ckh_pointer_keycomp(const void *k1, const void *k2)
-{
-
- return ((k1 == k2) ? true : false);
-}
diff --git a/memory/jemalloc/src/src/ctl.c b/memory/jemalloc/src/src/ctl.c
deleted file mode 100644
index bc78b20558..0000000000
--- a/memory/jemalloc/src/src/ctl.c
+++ /dev/null
@@ -1,2254 +0,0 @@
-#define JEMALLOC_CTL_C_
-#include "jemalloc/internal/jemalloc_internal.h"
-
-/******************************************************************************/
-/* Data. */
-
-/*
- * ctl_mtx protects the following:
- * - ctl_stats.*
- */
-static malloc_mutex_t ctl_mtx;
-static bool ctl_initialized;
-static uint64_t ctl_epoch;
-static ctl_stats_t ctl_stats;
-
-/******************************************************************************/
-/* Helpers for named and indexed nodes. */
-
-JEMALLOC_INLINE_C const ctl_named_node_t *
-ctl_named_node(const ctl_node_t *node)
-{
-
- return ((node->named) ? (const ctl_named_node_t *)node : NULL);
-}
-
-JEMALLOC_INLINE_C const ctl_named_node_t *
-ctl_named_children(const ctl_named_node_t *node, size_t index)
-{
- const ctl_named_node_t *children = ctl_named_node(node->children);
-
- return (children ? &children[index] : NULL);
-}
-
-JEMALLOC_INLINE_C const ctl_indexed_node_t *
-ctl_indexed_node(const ctl_node_t *node)
-{
-
- return (!node->named ? (const ctl_indexed_node_t *)node : NULL);
-}
-
-/******************************************************************************/
-/* Function prototypes for non-inline static functions. */
-
-#define CTL_PROTO(n) \
-static int n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, \
- void *oldp, size_t *oldlenp, void *newp, size_t newlen);
-
-#define INDEX_PROTO(n) \
-static const ctl_named_node_t *n##_index(tsdn_t *tsdn, \
- const size_t *mib, size_t miblen, size_t i);
-
-static bool ctl_arena_init(ctl_arena_stats_t *astats);
-static void ctl_arena_clear(ctl_arena_stats_t *astats);
-static void ctl_arena_stats_amerge(tsdn_t *tsdn, ctl_arena_stats_t *cstats,
- arena_t *arena);
-static void ctl_arena_stats_smerge(ctl_arena_stats_t *sstats,
- ctl_arena_stats_t *astats);
-static void ctl_arena_refresh(tsdn_t *tsdn, arena_t *arena, unsigned i);
-static bool ctl_grow(tsdn_t *tsdn);
-static void ctl_refresh(tsdn_t *tsdn);
-static bool ctl_init(tsdn_t *tsdn);
-static int ctl_lookup(tsdn_t *tsdn, const char *name,
- ctl_node_t const **nodesp, size_t *mibp, size_t *depthp);
-
-CTL_PROTO(version)
-CTL_PROTO(epoch)
-CTL_PROTO(thread_tcache_enabled)
-CTL_PROTO(thread_tcache_flush)
-CTL_PROTO(thread_prof_name)
-CTL_PROTO(thread_prof_active)
-CTL_PROTO(thread_arena)
-CTL_PROTO(thread_allocated)
-CTL_PROTO(thread_allocatedp)
-CTL_PROTO(thread_deallocated)
-CTL_PROTO(thread_deallocatedp)
-CTL_PROTO(config_cache_oblivious)
-CTL_PROTO(config_debug)
-CTL_PROTO(config_fill)
-CTL_PROTO(config_lazy_lock)
-CTL_PROTO(config_malloc_conf)
-CTL_PROTO(config_munmap)
-CTL_PROTO(config_prof)
-CTL_PROTO(config_prof_libgcc)
-CTL_PROTO(config_prof_libunwind)
-CTL_PROTO(config_stats)
-CTL_PROTO(config_tcache)
-CTL_PROTO(config_tls)
-CTL_PROTO(config_utrace)
-CTL_PROTO(config_valgrind)
-CTL_PROTO(config_xmalloc)
-CTL_PROTO(opt_abort)
-CTL_PROTO(opt_dss)
-CTL_PROTO(opt_lg_chunk)
-CTL_PROTO(opt_narenas)
-CTL_PROTO(opt_purge)
-CTL_PROTO(opt_lg_dirty_mult)
-CTL_PROTO(opt_decay_time)
-CTL_PROTO(opt_stats_print)
-CTL_PROTO(opt_junk)
-CTL_PROTO(opt_zero)
-CTL_PROTO(opt_quarantine)
-CTL_PROTO(opt_redzone)
-CTL_PROTO(opt_utrace)
-CTL_PROTO(opt_xmalloc)
-CTL_PROTO(opt_tcache)
-CTL_PROTO(opt_lg_tcache_max)
-CTL_PROTO(opt_prof)
-CTL_PROTO(opt_prof_prefix)
-CTL_PROTO(opt_prof_active)
-CTL_PROTO(opt_prof_thread_active_init)
-CTL_PROTO(opt_lg_prof_sample)
-CTL_PROTO(opt_lg_prof_interval)
-CTL_PROTO(opt_prof_gdump)
-CTL_PROTO(opt_prof_final)
-CTL_PROTO(opt_prof_leak)
-CTL_PROTO(opt_prof_accum)
-CTL_PROTO(tcache_create)
-CTL_PROTO(tcache_flush)
-CTL_PROTO(tcache_destroy)
-static void arena_i_purge(tsdn_t *tsdn, unsigned arena_ind, bool all);
-CTL_PROTO(arena_i_purge)
-CTL_PROTO(arena_i_decay)
-CTL_PROTO(arena_i_reset)
-CTL_PROTO(arena_i_dss)
-CTL_PROTO(arena_i_lg_dirty_mult)
-CTL_PROTO(arena_i_decay_time)
-CTL_PROTO(arena_i_chunk_hooks)
-INDEX_PROTO(arena_i)
-CTL_PROTO(arenas_bin_i_size)
-CTL_PROTO(arenas_bin_i_nregs)
-CTL_PROTO(arenas_bin_i_run_size)
-INDEX_PROTO(arenas_bin_i)
-CTL_PROTO(arenas_lrun_i_size)
-INDEX_PROTO(arenas_lrun_i)
-CTL_PROTO(arenas_hchunk_i_size)
-INDEX_PROTO(arenas_hchunk_i)
-CTL_PROTO(arenas_narenas)
-CTL_PROTO(arenas_initialized)
-CTL_PROTO(arenas_lg_dirty_mult)
-CTL_PROTO(arenas_decay_time)
-CTL_PROTO(arenas_quantum)
-CTL_PROTO(arenas_page)
-CTL_PROTO(arenas_tcache_max)
-CTL_PROTO(arenas_nbins)
-CTL_PROTO(arenas_nhbins)
-CTL_PROTO(arenas_nlruns)
-CTL_PROTO(arenas_nhchunks)
-CTL_PROTO(arenas_extend)
-CTL_PROTO(prof_thread_active_init)
-CTL_PROTO(prof_active)
-CTL_PROTO(prof_dump)
-CTL_PROTO(prof_gdump)
-CTL_PROTO(prof_reset)
-CTL_PROTO(prof_interval)
-CTL_PROTO(lg_prof_sample)
-CTL_PROTO(stats_arenas_i_small_allocated)
-CTL_PROTO(stats_arenas_i_small_nmalloc)
-CTL_PROTO(stats_arenas_i_small_ndalloc)
-CTL_PROTO(stats_arenas_i_small_nrequests)
-CTL_PROTO(stats_arenas_i_large_allocated)
-CTL_PROTO(stats_arenas_i_large_nmalloc)
-CTL_PROTO(stats_arenas_i_large_ndalloc)
-CTL_PROTO(stats_arenas_i_large_nrequests)
-CTL_PROTO(stats_arenas_i_huge_allocated)
-CTL_PROTO(stats_arenas_i_huge_nmalloc)
-CTL_PROTO(stats_arenas_i_huge_ndalloc)
-CTL_PROTO(stats_arenas_i_huge_nrequests)
-CTL_PROTO(stats_arenas_i_bins_j_nmalloc)
-CTL_PROTO(stats_arenas_i_bins_j_ndalloc)
-CTL_PROTO(stats_arenas_i_bins_j_nrequests)
-CTL_PROTO(stats_arenas_i_bins_j_curregs)
-CTL_PROTO(stats_arenas_i_bins_j_nfills)
-CTL_PROTO(stats_arenas_i_bins_j_nflushes)
-CTL_PROTO(stats_arenas_i_bins_j_nruns)
-CTL_PROTO(stats_arenas_i_bins_j_nreruns)
-CTL_PROTO(stats_arenas_i_bins_j_curruns)
-INDEX_PROTO(stats_arenas_i_bins_j)
-CTL_PROTO(stats_arenas_i_lruns_j_nmalloc)
-CTL_PROTO(stats_arenas_i_lruns_j_ndalloc)
-CTL_PROTO(stats_arenas_i_lruns_j_nrequests)
-CTL_PROTO(stats_arenas_i_lruns_j_curruns)
-INDEX_PROTO(stats_arenas_i_lruns_j)
-CTL_PROTO(stats_arenas_i_hchunks_j_nmalloc)
-CTL_PROTO(stats_arenas_i_hchunks_j_ndalloc)
-CTL_PROTO(stats_arenas_i_hchunks_j_nrequests)
-CTL_PROTO(stats_arenas_i_hchunks_j_curhchunks)
-INDEX_PROTO(stats_arenas_i_hchunks_j)
-CTL_PROTO(stats_arenas_i_nthreads)
-CTL_PROTO(stats_arenas_i_dss)
-CTL_PROTO(stats_arenas_i_lg_dirty_mult)
-CTL_PROTO(stats_arenas_i_decay_time)
-CTL_PROTO(stats_arenas_i_pactive)
-CTL_PROTO(stats_arenas_i_pdirty)
-CTL_PROTO(stats_arenas_i_mapped)
-CTL_PROTO(stats_arenas_i_retained)
-CTL_PROTO(stats_arenas_i_npurge)
-CTL_PROTO(stats_arenas_i_nmadvise)
-CTL_PROTO(stats_arenas_i_purged)
-CTL_PROTO(stats_arenas_i_metadata_mapped)
-CTL_PROTO(stats_arenas_i_metadata_allocated)
-INDEX_PROTO(stats_arenas_i)
-CTL_PROTO(stats_cactive)
-CTL_PROTO(stats_allocated)
-CTL_PROTO(stats_active)
-CTL_PROTO(stats_metadata)
-CTL_PROTO(stats_resident)
-CTL_PROTO(stats_mapped)
-CTL_PROTO(stats_retained)
-
-/******************************************************************************/
-/* mallctl tree. */
-
-/* Maximum tree depth. */
-#define CTL_MAX_DEPTH 6
-
-#define NAME(n) {true}, n
-#define CHILD(t, c) \
- sizeof(c##_node) / sizeof(ctl_##t##_node_t), \
- (ctl_node_t *)c##_node, \
- NULL
-#define CTL(c) 0, NULL, c##_ctl
-
-/*
- * Only handles internal indexed nodes, since there are currently no external
- * ones.
- */
-#define INDEX(i) {false}, i##_index
-
-static const ctl_named_node_t thread_tcache_node[] = {
- {NAME("enabled"), CTL(thread_tcache_enabled)},
- {NAME("flush"), CTL(thread_tcache_flush)}
-};
-
-static const ctl_named_node_t thread_prof_node[] = {
- {NAME("name"), CTL(thread_prof_name)},
- {NAME("active"), CTL(thread_prof_active)}
-};
-
-static const ctl_named_node_t thread_node[] = {
- {NAME("arena"), CTL(thread_arena)},
- {NAME("allocated"), CTL(thread_allocated)},
- {NAME("allocatedp"), CTL(thread_allocatedp)},
- {NAME("deallocated"), CTL(thread_deallocated)},
- {NAME("deallocatedp"), CTL(thread_deallocatedp)},
- {NAME("tcache"), CHILD(named, thread_tcache)},
- {NAME("prof"), CHILD(named, thread_prof)}
-};
-
-static const ctl_named_node_t config_node[] = {
- {NAME("cache_oblivious"), CTL(config_cache_oblivious)},
- {NAME("debug"), CTL(config_debug)},
- {NAME("fill"), CTL(config_fill)},
- {NAME("lazy_lock"), CTL(config_lazy_lock)},
- {NAME("malloc_conf"), CTL(config_malloc_conf)},
- {NAME("munmap"), CTL(config_munmap)},
- {NAME("prof"), CTL(config_prof)},
- {NAME("prof_libgcc"), CTL(config_prof_libgcc)},
- {NAME("prof_libunwind"), CTL(config_prof_libunwind)},
- {NAME("stats"), CTL(config_stats)},
- {NAME("tcache"), CTL(config_tcache)},
- {NAME("tls"), CTL(config_tls)},
- {NAME("utrace"), CTL(config_utrace)},
- {NAME("valgrind"), CTL(config_valgrind)},
- {NAME("xmalloc"), CTL(config_xmalloc)}
-};
-
-static const ctl_named_node_t opt_node[] = {
- {NAME("abort"), CTL(opt_abort)},
- {NAME("dss"), CTL(opt_dss)},
- {NAME("lg_chunk"), CTL(opt_lg_chunk)},
- {NAME("narenas"), CTL(opt_narenas)},
- {NAME("purge"), CTL(opt_purge)},
- {NAME("lg_dirty_mult"), CTL(opt_lg_dirty_mult)},
- {NAME("decay_time"), CTL(opt_decay_time)},
- {NAME("stats_print"), CTL(opt_stats_print)},
- {NAME("junk"), CTL(opt_junk)},
- {NAME("zero"), CTL(opt_zero)},
- {NAME("quarantine"), CTL(opt_quarantine)},
- {NAME("redzone"), CTL(opt_redzone)},
- {NAME("utrace"), CTL(opt_utrace)},
- {NAME("xmalloc"), CTL(opt_xmalloc)},
- {NAME("tcache"), CTL(opt_tcache)},
- {NAME("lg_tcache_max"), CTL(opt_lg_tcache_max)},
- {NAME("prof"), CTL(opt_prof)},
- {NAME("prof_prefix"), CTL(opt_prof_prefix)},
- {NAME("prof_active"), CTL(opt_prof_active)},
- {NAME("prof_thread_active_init"), CTL(opt_prof_thread_active_init)},
- {NAME("lg_prof_sample"), CTL(opt_lg_prof_sample)},
- {NAME("lg_prof_interval"), CTL(opt_lg_prof_interval)},
- {NAME("prof_gdump"), CTL(opt_prof_gdump)},
- {NAME("prof_final"), CTL(opt_prof_final)},
- {NAME("prof_leak"), CTL(opt_prof_leak)},
- {NAME("prof_accum"), CTL(opt_prof_accum)}
-};
-
-static const ctl_named_node_t tcache_node[] = {
- {NAME("create"), CTL(tcache_create)},
- {NAME("flush"), CTL(tcache_flush)},
- {NAME("destroy"), CTL(tcache_destroy)}
-};
-
-static const ctl_named_node_t arena_i_node[] = {
- {NAME("purge"), CTL(arena_i_purge)},
- {NAME("decay"), CTL(arena_i_decay)},
- {NAME("reset"), CTL(arena_i_reset)},
- {NAME("dss"), CTL(arena_i_dss)},
- {NAME("lg_dirty_mult"), CTL(arena_i_lg_dirty_mult)},
- {NAME("decay_time"), CTL(arena_i_decay_time)},
- {NAME("chunk_hooks"), CTL(arena_i_chunk_hooks)}
-};
-static const ctl_named_node_t super_arena_i_node[] = {
- {NAME(""), CHILD(named, arena_i)}
-};
-
-static const ctl_indexed_node_t arena_node[] = {
- {INDEX(arena_i)}
-};
-
-static const ctl_named_node_t arenas_bin_i_node[] = {
- {NAME("size"), CTL(arenas_bin_i_size)},
- {NAME("nregs"), CTL(arenas_bin_i_nregs)},
- {NAME("run_size"), CTL(arenas_bin_i_run_size)}
-};
-static const ctl_named_node_t super_arenas_bin_i_node[] = {
- {NAME(""), CHILD(named, arenas_bin_i)}
-};
-
-static const ctl_indexed_node_t arenas_bin_node[] = {
- {INDEX(arenas_bin_i)}
-};
-
-static const ctl_named_node_t arenas_lrun_i_node[] = {
- {NAME("size"), CTL(arenas_lrun_i_size)}
-};
-static const ctl_named_node_t super_arenas_lrun_i_node[] = {
- {NAME(""), CHILD(named, arenas_lrun_i)}
-};
-
-static const ctl_indexed_node_t arenas_lrun_node[] = {
- {INDEX(arenas_lrun_i)}
-};
-
-static const ctl_named_node_t arenas_hchunk_i_node[] = {
- {NAME("size"), CTL(arenas_hchunk_i_size)}
-};
-static const ctl_named_node_t super_arenas_hchunk_i_node[] = {
- {NAME(""), CHILD(named, arenas_hchunk_i)}
-};
-
-static const ctl_indexed_node_t arenas_hchunk_node[] = {
- {INDEX(arenas_hchunk_i)}
-};
-
-static const ctl_named_node_t arenas_node[] = {
- {NAME("narenas"), CTL(arenas_narenas)},
- {NAME("initialized"), CTL(arenas_initialized)},
- {NAME("lg_dirty_mult"), CTL(arenas_lg_dirty_mult)},
- {NAME("decay_time"), CTL(arenas_decay_time)},
- {NAME("quantum"), CTL(arenas_quantum)},
- {NAME("page"), CTL(arenas_page)},
- {NAME("tcache_max"), CTL(arenas_tcache_max)},
- {NAME("nbins"), CTL(arenas_nbins)},
- {NAME("nhbins"), CTL(arenas_nhbins)},
- {NAME("bin"), CHILD(indexed, arenas_bin)},
- {NAME("nlruns"), CTL(arenas_nlruns)},
- {NAME("lrun"), CHILD(indexed, arenas_lrun)},
- {NAME("nhchunks"), CTL(arenas_nhchunks)},
- {NAME("hchunk"), CHILD(indexed, arenas_hchunk)},
- {NAME("extend"), CTL(arenas_extend)}
-};
-
-static const ctl_named_node_t prof_node[] = {
- {NAME("thread_active_init"), CTL(prof_thread_active_init)},
- {NAME("active"), CTL(prof_active)},
- {NAME("dump"), CTL(prof_dump)},
- {NAME("gdump"), CTL(prof_gdump)},
- {NAME("reset"), CTL(prof_reset)},
- {NAME("interval"), CTL(prof_interval)},
- {NAME("lg_sample"), CTL(lg_prof_sample)}
-};
-
-static const ctl_named_node_t stats_arenas_i_metadata_node[] = {
- {NAME("mapped"), CTL(stats_arenas_i_metadata_mapped)},
- {NAME("allocated"), CTL(stats_arenas_i_metadata_allocated)}
-};
-
-static const ctl_named_node_t stats_arenas_i_small_node[] = {
- {NAME("allocated"), CTL(stats_arenas_i_small_allocated)},
- {NAME("nmalloc"), CTL(stats_arenas_i_small_nmalloc)},
- {NAME("ndalloc"), CTL(stats_arenas_i_small_ndalloc)},
- {NAME("nrequests"), CTL(stats_arenas_i_small_nrequests)}
-};
-
-static const ctl_named_node_t stats_arenas_i_large_node[] = {
- {NAME("allocated"), CTL(stats_arenas_i_large_allocated)},
- {NAME("nmalloc"), CTL(stats_arenas_i_large_nmalloc)},
- {NAME("ndalloc"), CTL(stats_arenas_i_large_ndalloc)},
- {NAME("nrequests"), CTL(stats_arenas_i_large_nrequests)}
-};
-
-static const ctl_named_node_t stats_arenas_i_huge_node[] = {
- {NAME("allocated"), CTL(stats_arenas_i_huge_allocated)},
- {NAME("nmalloc"), CTL(stats_arenas_i_huge_nmalloc)},
- {NAME("ndalloc"), CTL(stats_arenas_i_huge_ndalloc)},
- {NAME("nrequests"), CTL(stats_arenas_i_huge_nrequests)}
-};
-
-static const ctl_named_node_t stats_arenas_i_bins_j_node[] = {
- {NAME("nmalloc"), CTL(stats_arenas_i_bins_j_nmalloc)},
- {NAME("ndalloc"), CTL(stats_arenas_i_bins_j_ndalloc)},
- {NAME("nrequests"), CTL(stats_arenas_i_bins_j_nrequests)},
- {NAME("curregs"), CTL(stats_arenas_i_bins_j_curregs)},
- {NAME("nfills"), CTL(stats_arenas_i_bins_j_nfills)},
- {NAME("nflushes"), CTL(stats_arenas_i_bins_j_nflushes)},
- {NAME("nruns"), CTL(stats_arenas_i_bins_j_nruns)},
- {NAME("nreruns"), CTL(stats_arenas_i_bins_j_nreruns)},
- {NAME("curruns"), CTL(stats_arenas_i_bins_j_curruns)}
-};
-static const ctl_named_node_t super_stats_arenas_i_bins_j_node[] = {
- {NAME(""), CHILD(named, stats_arenas_i_bins_j)}
-};
-
-static const ctl_indexed_node_t stats_arenas_i_bins_node[] = {
- {INDEX(stats_arenas_i_bins_j)}
-};
-
-static const ctl_named_node_t stats_arenas_i_lruns_j_node[] = {
- {NAME("nmalloc"), CTL(stats_arenas_i_lruns_j_nmalloc)},
- {NAME("ndalloc"), CTL(stats_arenas_i_lruns_j_ndalloc)},
- {NAME("nrequests"), CTL(stats_arenas_i_lruns_j_nrequests)},
- {NAME("curruns"), CTL(stats_arenas_i_lruns_j_curruns)}
-};
-static const ctl_named_node_t super_stats_arenas_i_lruns_j_node[] = {
- {NAME(""), CHILD(named, stats_arenas_i_lruns_j)}
-};
-
-static const ctl_indexed_node_t stats_arenas_i_lruns_node[] = {
- {INDEX(stats_arenas_i_lruns_j)}
-};
-
-static const ctl_named_node_t stats_arenas_i_hchunks_j_node[] = {
- {NAME("nmalloc"), CTL(stats_arenas_i_hchunks_j_nmalloc)},
- {NAME("ndalloc"), CTL(stats_arenas_i_hchunks_j_ndalloc)},
- {NAME("nrequests"), CTL(stats_arenas_i_hchunks_j_nrequests)},
- {NAME("curhchunks"), CTL(stats_arenas_i_hchunks_j_curhchunks)}
-};
-static const ctl_named_node_t super_stats_arenas_i_hchunks_j_node[] = {
- {NAME(""), CHILD(named, stats_arenas_i_hchunks_j)}
-};
-
-static const ctl_indexed_node_t stats_arenas_i_hchunks_node[] = {
- {INDEX(stats_arenas_i_hchunks_j)}
-};
-
-static const ctl_named_node_t stats_arenas_i_node[] = {
- {NAME("nthreads"), CTL(stats_arenas_i_nthreads)},
- {NAME("dss"), CTL(stats_arenas_i_dss)},
- {NAME("lg_dirty_mult"), CTL(stats_arenas_i_lg_dirty_mult)},
- {NAME("decay_time"), CTL(stats_arenas_i_decay_time)},
- {NAME("pactive"), CTL(stats_arenas_i_pactive)},
- {NAME("pdirty"), CTL(stats_arenas_i_pdirty)},
- {NAME("mapped"), CTL(stats_arenas_i_mapped)},
- {NAME("retained"), CTL(stats_arenas_i_retained)},
- {NAME("npurge"), CTL(stats_arenas_i_npurge)},
- {NAME("nmadvise"), CTL(stats_arenas_i_nmadvise)},
- {NAME("purged"), CTL(stats_arenas_i_purged)},
- {NAME("metadata"), CHILD(named, stats_arenas_i_metadata)},
- {NAME("small"), CHILD(named, stats_arenas_i_small)},
- {NAME("large"), CHILD(named, stats_arenas_i_large)},
- {NAME("huge"), CHILD(named, stats_arenas_i_huge)},
- {NAME("bins"), CHILD(indexed, stats_arenas_i_bins)},
- {NAME("lruns"), CHILD(indexed, stats_arenas_i_lruns)},
- {NAME("hchunks"), CHILD(indexed, stats_arenas_i_hchunks)}
-};
-static const ctl_named_node_t super_stats_arenas_i_node[] = {
- {NAME(""), CHILD(named, stats_arenas_i)}
-};
-
-static const ctl_indexed_node_t stats_arenas_node[] = {
- {INDEX(stats_arenas_i)}
-};
-
-static const ctl_named_node_t stats_node[] = {
- {NAME("cactive"), CTL(stats_cactive)},
- {NAME("allocated"), CTL(stats_allocated)},
- {NAME("active"), CTL(stats_active)},
- {NAME("metadata"), CTL(stats_metadata)},
- {NAME("resident"), CTL(stats_resident)},
- {NAME("mapped"), CTL(stats_mapped)},
- {NAME("retained"), CTL(stats_retained)},
- {NAME("arenas"), CHILD(indexed, stats_arenas)}
-};
-
-static const ctl_named_node_t root_node[] = {
- {NAME("version"), CTL(version)},
- {NAME("epoch"), CTL(epoch)},
- {NAME("thread"), CHILD(named, thread)},
- {NAME("config"), CHILD(named, config)},
- {NAME("opt"), CHILD(named, opt)},
- {NAME("tcache"), CHILD(named, tcache)},
- {NAME("arena"), CHILD(indexed, arena)},
- {NAME("arenas"), CHILD(named, arenas)},
- {NAME("prof"), CHILD(named, prof)},
- {NAME("stats"), CHILD(named, stats)}
-};
-static const ctl_named_node_t super_root_node[] = {
- {NAME(""), CHILD(named, root)}
-};
-
-#undef NAME
-#undef CHILD
-#undef CTL
-#undef INDEX
-
-/******************************************************************************/
-
-static bool
-ctl_arena_init(ctl_arena_stats_t *astats)
-{
-
- if (astats->lstats == NULL) {
- astats->lstats = (malloc_large_stats_t *)a0malloc(nlclasses *
- sizeof(malloc_large_stats_t));
- if (astats->lstats == NULL)
- return (true);
- }
-
- if (astats->hstats == NULL) {
- astats->hstats = (malloc_huge_stats_t *)a0malloc(nhclasses *
- sizeof(malloc_huge_stats_t));
- if (astats->hstats == NULL)
- return (true);
- }
-
- return (false);
-}
-
-static void
-ctl_arena_clear(ctl_arena_stats_t *astats)
-{
-
- astats->nthreads = 0;
- astats->dss = dss_prec_names[dss_prec_limit];
- astats->lg_dirty_mult = -1;
- astats->decay_time = -1;
- astats->pactive = 0;
- astats->pdirty = 0;
- if (config_stats) {
- memset(&astats->astats, 0, sizeof(arena_stats_t));
- astats->allocated_small = 0;
- astats->nmalloc_small = 0;
- astats->ndalloc_small = 0;
- astats->nrequests_small = 0;
- memset(astats->bstats, 0, NBINS * sizeof(malloc_bin_stats_t));
- memset(astats->lstats, 0, nlclasses *
- sizeof(malloc_large_stats_t));
- memset(astats->hstats, 0, nhclasses *
- sizeof(malloc_huge_stats_t));
- }
-}
-
-static void
-ctl_arena_stats_amerge(tsdn_t *tsdn, ctl_arena_stats_t *cstats, arena_t *arena)
-{
- unsigned i;
-
- if (config_stats) {
- arena_stats_merge(tsdn, arena, &cstats->nthreads, &cstats->dss,
- &cstats->lg_dirty_mult, &cstats->decay_time,
- &cstats->pactive, &cstats->pdirty, &cstats->astats,
- cstats->bstats, cstats->lstats, cstats->hstats);
-
- for (i = 0; i < NBINS; i++) {
- cstats->allocated_small += cstats->bstats[i].curregs *
- index2size(i);
- cstats->nmalloc_small += cstats->bstats[i].nmalloc;
- cstats->ndalloc_small += cstats->bstats[i].ndalloc;
- cstats->nrequests_small += cstats->bstats[i].nrequests;
- }
- } else {
- arena_basic_stats_merge(tsdn, arena, &cstats->nthreads,
- &cstats->dss, &cstats->lg_dirty_mult, &cstats->decay_time,
- &cstats->pactive, &cstats->pdirty);
- }
-}
-
-static void
-ctl_arena_stats_smerge(ctl_arena_stats_t *sstats, ctl_arena_stats_t *astats)
-{
- unsigned i;
-
- sstats->nthreads += astats->nthreads;
- sstats->pactive += astats->pactive;
- sstats->pdirty += astats->pdirty;
-
- if (config_stats) {
- sstats->astats.mapped += astats->astats.mapped;
- sstats->astats.retained += astats->astats.retained;
- sstats->astats.npurge += astats->astats.npurge;
- sstats->astats.nmadvise += astats->astats.nmadvise;
- sstats->astats.purged += astats->astats.purged;
-
- sstats->astats.metadata_mapped +=
- astats->astats.metadata_mapped;
- sstats->astats.metadata_allocated +=
- astats->astats.metadata_allocated;
-
- sstats->allocated_small += astats->allocated_small;
- sstats->nmalloc_small += astats->nmalloc_small;
- sstats->ndalloc_small += astats->ndalloc_small;
- sstats->nrequests_small += astats->nrequests_small;
-
- sstats->astats.allocated_large +=
- astats->astats.allocated_large;
- sstats->astats.nmalloc_large += astats->astats.nmalloc_large;
- sstats->astats.ndalloc_large += astats->astats.ndalloc_large;
- sstats->astats.nrequests_large +=
- astats->astats.nrequests_large;
-
- sstats->astats.allocated_huge += astats->astats.allocated_huge;
- sstats->astats.nmalloc_huge += astats->astats.nmalloc_huge;
- sstats->astats.ndalloc_huge += astats->astats.ndalloc_huge;
-
- for (i = 0; i < NBINS; i++) {
- sstats->bstats[i].nmalloc += astats->bstats[i].nmalloc;
- sstats->bstats[i].ndalloc += astats->bstats[i].ndalloc;
- sstats->bstats[i].nrequests +=
- astats->bstats[i].nrequests;
- sstats->bstats[i].curregs += astats->bstats[i].curregs;
- if (config_tcache) {
- sstats->bstats[i].nfills +=
- astats->bstats[i].nfills;
- sstats->bstats[i].nflushes +=
- astats->bstats[i].nflushes;
- }
- sstats->bstats[i].nruns += astats->bstats[i].nruns;
- sstats->bstats[i].reruns += astats->bstats[i].reruns;
- sstats->bstats[i].curruns += astats->bstats[i].curruns;
- }
-
- for (i = 0; i < nlclasses; i++) {
- sstats->lstats[i].nmalloc += astats->lstats[i].nmalloc;
- sstats->lstats[i].ndalloc += astats->lstats[i].ndalloc;
- sstats->lstats[i].nrequests +=
- astats->lstats[i].nrequests;
- sstats->lstats[i].curruns += astats->lstats[i].curruns;
- }
-
- for (i = 0; i < nhclasses; i++) {
- sstats->hstats[i].nmalloc += astats->hstats[i].nmalloc;
- sstats->hstats[i].ndalloc += astats->hstats[i].ndalloc;
- sstats->hstats[i].curhchunks +=
- astats->hstats[i].curhchunks;
- }
- }
-}
-
-static void
-ctl_arena_refresh(tsdn_t *tsdn, arena_t *arena, unsigned i)
-{
- ctl_arena_stats_t *astats = &ctl_stats.arenas[i];
- ctl_arena_stats_t *sstats = &ctl_stats.arenas[ctl_stats.narenas];
-
- ctl_arena_clear(astats);
- ctl_arena_stats_amerge(tsdn, astats, arena);
- /* Merge into sum stats as well. */
- ctl_arena_stats_smerge(sstats, astats);
-}
-
-static bool
-ctl_grow(tsdn_t *tsdn)
-{
- ctl_arena_stats_t *astats;
-
- /* Initialize new arena. */
- if (arena_init(tsdn, ctl_stats.narenas) == NULL)
- return (true);
-
- /* Allocate extended arena stats. */
- astats = (ctl_arena_stats_t *)a0malloc((ctl_stats.narenas + 2) *
- sizeof(ctl_arena_stats_t));
- if (astats == NULL)
- return (true);
-
- /* Initialize the new astats element. */
- memcpy(astats, ctl_stats.arenas, (ctl_stats.narenas + 1) *
- sizeof(ctl_arena_stats_t));
- memset(&astats[ctl_stats.narenas + 1], 0, sizeof(ctl_arena_stats_t));
- if (ctl_arena_init(&astats[ctl_stats.narenas + 1])) {
- a0dalloc(astats);
- return (true);
- }
- /* Swap merged stats to their new location. */
- {
- ctl_arena_stats_t tstats;
- memcpy(&tstats, &astats[ctl_stats.narenas],
- sizeof(ctl_arena_stats_t));
- memcpy(&astats[ctl_stats.narenas],
- &astats[ctl_stats.narenas + 1], sizeof(ctl_arena_stats_t));
- memcpy(&astats[ctl_stats.narenas + 1], &tstats,
- sizeof(ctl_arena_stats_t));
- }
- a0dalloc(ctl_stats.arenas);
- ctl_stats.arenas = astats;
- ctl_stats.narenas++;
-
- return (false);
-}
-
-static void
-ctl_refresh(tsdn_t *tsdn)
-{
- unsigned i;
- VARIABLE_ARRAY(arena_t *, tarenas, ctl_stats.narenas);
-
- /*
- * Clear sum stats, since they will be merged into by
- * ctl_arena_refresh().
- */
- ctl_arena_clear(&ctl_stats.arenas[ctl_stats.narenas]);
-
- for (i = 0; i < ctl_stats.narenas; i++)
- tarenas[i] = arena_get(tsdn, i, false);
-
- for (i = 0; i < ctl_stats.narenas; i++) {
- bool initialized = (tarenas[i] != NULL);
-
- ctl_stats.arenas[i].initialized = initialized;
- if (initialized)
- ctl_arena_refresh(tsdn, tarenas[i], i);
- }
-
- if (config_stats) {
- size_t base_allocated, base_resident, base_mapped;
- base_stats_get(tsdn, &base_allocated, &base_resident,
- &base_mapped);
- ctl_stats.allocated =
- ctl_stats.arenas[ctl_stats.narenas].allocated_small +
- ctl_stats.arenas[ctl_stats.narenas].astats.allocated_large +
- ctl_stats.arenas[ctl_stats.narenas].astats.allocated_huge;
- ctl_stats.active =
- (ctl_stats.arenas[ctl_stats.narenas].pactive << LG_PAGE);
- ctl_stats.metadata = base_allocated +
- ctl_stats.arenas[ctl_stats.narenas].astats.metadata_mapped +
- ctl_stats.arenas[ctl_stats.narenas].astats
- .metadata_allocated;
- ctl_stats.resident = base_resident +
- ctl_stats.arenas[ctl_stats.narenas].astats.metadata_mapped +
- ((ctl_stats.arenas[ctl_stats.narenas].pactive +
- ctl_stats.arenas[ctl_stats.narenas].pdirty) << LG_PAGE);
- ctl_stats.mapped = base_mapped +
- ctl_stats.arenas[ctl_stats.narenas].astats.mapped;
- ctl_stats.retained =
- ctl_stats.arenas[ctl_stats.narenas].astats.retained;
- }
-
- ctl_epoch++;
-}
-
-static bool
-ctl_init(tsdn_t *tsdn)
-{
- bool ret;
-
- malloc_mutex_lock(tsdn, &ctl_mtx);
- if (!ctl_initialized) {
- /*
- * Allocate space for one extra arena stats element, which
- * contains summed stats across all arenas.
- */
- ctl_stats.narenas = narenas_total_get();
- ctl_stats.arenas = (ctl_arena_stats_t *)a0malloc(
- (ctl_stats.narenas + 1) * sizeof(ctl_arena_stats_t));
- if (ctl_stats.arenas == NULL) {
- ret = true;
- goto label_return;
- }
- memset(ctl_stats.arenas, 0, (ctl_stats.narenas + 1) *
- sizeof(ctl_arena_stats_t));
-
- /*
- * Initialize all stats structures, regardless of whether they
- * ever get used. Lazy initialization would allow errors to
- * cause inconsistent state to be viewable by the application.
- */
- if (config_stats) {
- unsigned i;
- for (i = 0; i <= ctl_stats.narenas; i++) {
- if (ctl_arena_init(&ctl_stats.arenas[i])) {
- unsigned j;
- for (j = 0; j < i; j++) {
- a0dalloc(
- ctl_stats.arenas[j].lstats);
- a0dalloc(
- ctl_stats.arenas[j].hstats);
- }
- a0dalloc(ctl_stats.arenas);
- ctl_stats.arenas = NULL;
- ret = true;
- goto label_return;
- }
- }
- }
- ctl_stats.arenas[ctl_stats.narenas].initialized = true;
-
- ctl_epoch = 0;
- ctl_refresh(tsdn);
- ctl_initialized = true;
- }
-
- ret = false;
-label_return:
- malloc_mutex_unlock(tsdn, &ctl_mtx);
- return (ret);
-}
-
-static int
-ctl_lookup(tsdn_t *tsdn, const char *name, ctl_node_t const **nodesp,
- size_t *mibp, size_t *depthp)
-{
- int ret;
- const char *elm, *tdot, *dot;
- size_t elen, i, j;
- const ctl_named_node_t *node;
-
- elm = name;
- /* Equivalent to strchrnul(). */
- dot = ((tdot = strchr(elm, '.')) != NULL) ? tdot : strchr(elm, '\0');
- elen = (size_t)((uintptr_t)dot - (uintptr_t)elm);
- if (elen == 0) {
- ret = ENOENT;
- goto label_return;
- }
- node = super_root_node;
- for (i = 0; i < *depthp; i++) {
- assert(node);
- assert(node->nchildren > 0);
- if (ctl_named_node(node->children) != NULL) {
- const ctl_named_node_t *pnode = node;
-
- /* Children are named. */
- for (j = 0; j < node->nchildren; j++) {
- const ctl_named_node_t *child =
- ctl_named_children(node, j);
- if (strlen(child->name) == elen &&
- strncmp(elm, child->name, elen) == 0) {
- node = child;
- if (nodesp != NULL)
- nodesp[i] =
- (const ctl_node_t *)node;
- mibp[i] = j;
- break;
- }
- }
- if (node == pnode) {
- ret = ENOENT;
- goto label_return;
- }
- } else {
- uintmax_t index;
- const ctl_indexed_node_t *inode;
-
- /* Children are indexed. */
- index = malloc_strtoumax(elm, NULL, 10);
- if (index == UINTMAX_MAX || index > SIZE_T_MAX) {
- ret = ENOENT;
- goto label_return;
- }
-
- inode = ctl_indexed_node(node->children);
- node = inode->index(tsdn, mibp, *depthp, (size_t)index);
- if (node == NULL) {
- ret = ENOENT;
- goto label_return;
- }
-
- if (nodesp != NULL)
- nodesp[i] = (const ctl_node_t *)node;
- mibp[i] = (size_t)index;
- }
-
- if (node->ctl != NULL) {
- /* Terminal node. */
- if (*dot != '\0') {
- /*
- * The name contains more elements than are
- * in this path through the tree.
- */
- ret = ENOENT;
- goto label_return;
- }
- /* Complete lookup successful. */
- *depthp = i + 1;
- break;
- }
-
- /* Update elm. */
- if (*dot == '\0') {
- /* No more elements. */
- ret = ENOENT;
- goto label_return;
- }
- elm = &dot[1];
- dot = ((tdot = strchr(elm, '.')) != NULL) ? tdot :
- strchr(elm, '\0');
- elen = (size_t)((uintptr_t)dot - (uintptr_t)elm);
- }
-
- ret = 0;
-label_return:
- return (ret);
-}
-
-int
-ctl_byname(tsd_t *tsd, const char *name, void *oldp, size_t *oldlenp,
- void *newp, size_t newlen)
-{
- int ret;
- size_t depth;
- ctl_node_t const *nodes[CTL_MAX_DEPTH];
- size_t mib[CTL_MAX_DEPTH];
- const ctl_named_node_t *node;
-
- if (!ctl_initialized && ctl_init(tsd_tsdn(tsd))) {
- ret = EAGAIN;
- goto label_return;
- }
-
- depth = CTL_MAX_DEPTH;
- ret = ctl_lookup(tsd_tsdn(tsd), name, nodes, mib, &depth);
- if (ret != 0)
- goto label_return;
-
- node = ctl_named_node(nodes[depth-1]);
- if (node != NULL && node->ctl)
- ret = node->ctl(tsd, mib, depth, oldp, oldlenp, newp, newlen);
- else {
- /* The name refers to a partial path through the ctl tree. */
- ret = ENOENT;
- }
-
-label_return:
- return(ret);
-}
-
-int
-ctl_nametomib(tsdn_t *tsdn, const char *name, size_t *mibp, size_t *miblenp)
-{
- int ret;
-
- if (!ctl_initialized && ctl_init(tsdn)) {
- ret = EAGAIN;
- goto label_return;
- }
-
- ret = ctl_lookup(tsdn, name, NULL, mibp, miblenp);
-label_return:
- return(ret);
-}
-
-int
-ctl_bymib(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
- size_t *oldlenp, void *newp, size_t newlen)
-{
- int ret;
- const ctl_named_node_t *node;
- size_t i;
-
- if (!ctl_initialized && ctl_init(tsd_tsdn(tsd))) {
- ret = EAGAIN;
- goto label_return;
- }
-
- /* Iterate down the tree. */
- node = super_root_node;
- for (i = 0; i < miblen; i++) {
- assert(node);
- assert(node->nchildren > 0);
- if (ctl_named_node(node->children) != NULL) {
- /* Children are named. */
- if (node->nchildren <= (unsigned)mib[i]) {
- ret = ENOENT;
- goto label_return;
- }
- node = ctl_named_children(node, mib[i]);
- } else {
- const ctl_indexed_node_t *inode;
-
- /* Indexed element. */
- inode = ctl_indexed_node(node->children);
- node = inode->index(tsd_tsdn(tsd), mib, miblen, mib[i]);
- if (node == NULL) {
- ret = ENOENT;
- goto label_return;
- }
- }
- }
-
- /* Call the ctl function. */
- if (node && node->ctl)
- ret = node->ctl(tsd, mib, miblen, oldp, oldlenp, newp, newlen);
- else {
- /* Partial MIB. */
- ret = ENOENT;
- }
-
-label_return:
- return(ret);
-}
-
-bool
-ctl_boot(void)
-{
-
- if (malloc_mutex_init(&ctl_mtx, "ctl", WITNESS_RANK_CTL))
- return (true);
-
- ctl_initialized = false;
-
- return (false);
-}
-
-void
-ctl_prefork(tsdn_t *tsdn)
-{
-
- malloc_mutex_prefork(tsdn, &ctl_mtx);
-}
-
-void
-ctl_postfork_parent(tsdn_t *tsdn)
-{
-
- malloc_mutex_postfork_parent(tsdn, &ctl_mtx);
-}
-
-void
-ctl_postfork_child(tsdn_t *tsdn)
-{
-
- malloc_mutex_postfork_child(tsdn, &ctl_mtx);
-}
-
-/******************************************************************************/
-/* *_ctl() functions. */
-
-#define READONLY() do { \
- if (newp != NULL || newlen != 0) { \
- ret = EPERM; \
- goto label_return; \
- } \
-} while (0)
-
-#define WRITEONLY() do { \
- if (oldp != NULL || oldlenp != NULL) { \
- ret = EPERM; \
- goto label_return; \
- } \
-} while (0)
-
-#define READ_XOR_WRITE() do { \
- if ((oldp != NULL && oldlenp != NULL) && (newp != NULL || \
- newlen != 0)) { \
- ret = EPERM; \
- goto label_return; \
- } \
-} while (0)
-
-#define READ(v, t) do { \
- if (oldp != NULL && oldlenp != NULL) { \
- if (*oldlenp != sizeof(t)) { \
- size_t copylen = (sizeof(t) <= *oldlenp) \
- ? sizeof(t) : *oldlenp; \
- memcpy(oldp, (void *)&(v), copylen); \
- ret = EINVAL; \
- goto label_return; \
- } \
- *(t *)oldp = (v); \
- } \
-} while (0)
-
-#define WRITE(v, t) do { \
- if (newp != NULL) { \
- if (newlen != sizeof(t)) { \
- ret = EINVAL; \
- goto label_return; \
- } \
- (v) = *(t *)newp; \
- } \
-} while (0)
-
-/*
- * There's a lot of code duplication in the following macros due to limitations
- * in how nested cpp macros are expanded.
- */
-#define CTL_RO_CLGEN(c, l, n, v, t) \
-static int \
-n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp, \
- size_t *oldlenp, void *newp, size_t newlen) \
-{ \
- int ret; \
- t oldval; \
- \
- if (!(c)) \
- return (ENOENT); \
- if (l) \
- malloc_mutex_lock(tsd_tsdn(tsd), &ctl_mtx); \
- READONLY(); \
- oldval = (v); \
- READ(oldval, t); \
- \
- ret = 0; \
-label_return: \
- if (l) \
- malloc_mutex_unlock(tsd_tsdn(tsd), &ctl_mtx); \
- return (ret); \
-}
-
-#define CTL_RO_CGEN(c, n, v, t) \
-static int \
-n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp, \
- size_t *oldlenp, void *newp, size_t newlen) \
-{ \
- int ret; \
- t oldval; \
- \
- if (!(c)) \
- return (ENOENT); \
- malloc_mutex_lock(tsd_tsdn(tsd), &ctl_mtx); \
- READONLY(); \
- oldval = (v); \
- READ(oldval, t); \
- \
- ret = 0; \
-label_return: \
- malloc_mutex_unlock(tsd_tsdn(tsd), &ctl_mtx); \
- return (ret); \
-}
-
-#define CTL_RO_GEN(n, v, t) \
-static int \
-n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp, \
- size_t *oldlenp, void *newp, size_t newlen) \
-{ \
- int ret; \
- t oldval; \
- \
- malloc_mutex_lock(tsd_tsdn(tsd), &ctl_mtx); \
- READONLY(); \
- oldval = (v); \
- READ(oldval, t); \
- \
- ret = 0; \
-label_return: \
- malloc_mutex_unlock(tsd_tsdn(tsd), &ctl_mtx); \
- return (ret); \
-}
-
-/*
- * ctl_mtx is not acquired, under the assumption that no pertinent data will
- * mutate during the call.
- */
-#define CTL_RO_NL_CGEN(c, n, v, t) \
-static int \
-n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp, \
- size_t *oldlenp, void *newp, size_t newlen) \
-{ \
- int ret; \
- t oldval; \
- \
- if (!(c)) \
- return (ENOENT); \
- READONLY(); \
- oldval = (v); \
- READ(oldval, t); \
- \
- ret = 0; \
-label_return: \
- return (ret); \
-}
-
-#define CTL_RO_NL_GEN(n, v, t) \
-static int \
-n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp, \
- size_t *oldlenp, void *newp, size_t newlen) \
-{ \
- int ret; \
- t oldval; \
- \
- READONLY(); \
- oldval = (v); \
- READ(oldval, t); \
- \
- ret = 0; \
-label_return: \
- return (ret); \
-}
-
-#define CTL_TSD_RO_NL_CGEN(c, n, m, t) \
-static int \
-n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp, \
- size_t *oldlenp, void *newp, size_t newlen) \
-{ \
- int ret; \
- t oldval; \
- \
- if (!(c)) \
- return (ENOENT); \
- READONLY(); \
- oldval = (m(tsd)); \
- READ(oldval, t); \
- \
- ret = 0; \
-label_return: \
- return (ret); \
-}
-
-#define CTL_RO_CONFIG_GEN(n, t) \
-static int \
-n##_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp, \
- size_t *oldlenp, void *newp, size_t newlen) \
-{ \
- int ret; \
- t oldval; \
- \
- READONLY(); \
- oldval = n; \
- READ(oldval, t); \
- \
- ret = 0; \
-label_return: \
- return (ret); \
-}
-
-/******************************************************************************/
-
-CTL_RO_NL_GEN(version, JEMALLOC_VERSION, const char *)
-
-static int
-epoch_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
- size_t *oldlenp, void *newp, size_t newlen)
-{
- int ret;
- UNUSED uint64_t newval;
-
- malloc_mutex_lock(tsd_tsdn(tsd), &ctl_mtx);
- WRITE(newval, uint64_t);
- if (newp != NULL)
- ctl_refresh(tsd_tsdn(tsd));
- READ(ctl_epoch, uint64_t);
-
- ret = 0;
-label_return:
- malloc_mutex_unlock(tsd_tsdn(tsd), &ctl_mtx);
- return (ret);
-}
-
-/******************************************************************************/
-
-CTL_RO_CONFIG_GEN(config_cache_oblivious, bool)
-CTL_RO_CONFIG_GEN(config_debug, bool)
-CTL_RO_CONFIG_GEN(config_fill, bool)
-CTL_RO_CONFIG_GEN(config_lazy_lock, bool)
-CTL_RO_CONFIG_GEN(config_malloc_conf, const char *)
-CTL_RO_CONFIG_GEN(config_munmap, bool)
-CTL_RO_CONFIG_GEN(config_prof, bool)
-CTL_RO_CONFIG_GEN(config_prof_libgcc, bool)
-CTL_RO_CONFIG_GEN(config_prof_libunwind, bool)
-CTL_RO_CONFIG_GEN(config_stats, bool)
-CTL_RO_CONFIG_GEN(config_tcache, bool)
-CTL_RO_CONFIG_GEN(config_tls, bool)
-CTL_RO_CONFIG_GEN(config_utrace, bool)
-CTL_RO_CONFIG_GEN(config_valgrind, bool)
-CTL_RO_CONFIG_GEN(config_xmalloc, bool)
-
-/******************************************************************************/
-
-CTL_RO_NL_GEN(opt_abort, opt_abort, bool)
-CTL_RO_NL_GEN(opt_dss, opt_dss, const char *)
-CTL_RO_NL_GEN(opt_lg_chunk, opt_lg_chunk, size_t)
-CTL_RO_NL_GEN(opt_narenas, opt_narenas, unsigned)
-CTL_RO_NL_GEN(opt_purge, purge_mode_names[opt_purge], const char *)
-CTL_RO_NL_GEN(opt_lg_dirty_mult, opt_lg_dirty_mult, ssize_t)
-CTL_RO_NL_GEN(opt_decay_time, opt_decay_time, ssize_t)
-CTL_RO_NL_GEN(opt_stats_print, opt_stats_print, bool)
-CTL_RO_NL_CGEN(config_fill, opt_junk, opt_junk, const char *)
-CTL_RO_NL_CGEN(config_fill, opt_quarantine, opt_quarantine, size_t)
-CTL_RO_NL_CGEN(config_fill, opt_redzone, opt_redzone, bool)
-CTL_RO_NL_CGEN(config_fill, opt_zero, opt_zero, bool)
-CTL_RO_NL_CGEN(config_utrace, opt_utrace, opt_utrace, bool)
-CTL_RO_NL_CGEN(config_xmalloc, opt_xmalloc, opt_xmalloc, bool)
-CTL_RO_NL_CGEN(config_tcache, opt_tcache, opt_tcache, bool)
-CTL_RO_NL_CGEN(config_tcache, opt_lg_tcache_max, opt_lg_tcache_max, ssize_t)
-CTL_RO_NL_CGEN(config_prof, opt_prof, opt_prof, bool)
-CTL_RO_NL_CGEN(config_prof, opt_prof_prefix, opt_prof_prefix, const char *)
-CTL_RO_NL_CGEN(config_prof, opt_prof_active, opt_prof_active, bool)
-CTL_RO_NL_CGEN(config_prof, opt_prof_thread_active_init,
- opt_prof_thread_active_init, bool)
-CTL_RO_NL_CGEN(config_prof, opt_lg_prof_sample, opt_lg_prof_sample, size_t)
-CTL_RO_NL_CGEN(config_prof, opt_prof_accum, opt_prof_accum, bool)
-CTL_RO_NL_CGEN(config_prof, opt_lg_prof_interval, opt_lg_prof_interval, ssize_t)
-CTL_RO_NL_CGEN(config_prof, opt_prof_gdump, opt_prof_gdump, bool)
-CTL_RO_NL_CGEN(config_prof, opt_prof_final, opt_prof_final, bool)
-CTL_RO_NL_CGEN(config_prof, opt_prof_leak, opt_prof_leak, bool)
-
-/******************************************************************************/
-
-static int
-thread_arena_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
- size_t *oldlenp, void *newp, size_t newlen)
-{
- int ret;
- arena_t *oldarena;
- unsigned newind, oldind;
-
- oldarena = arena_choose(tsd, NULL);
- if (oldarena == NULL)
- return (EAGAIN);
-
- malloc_mutex_lock(tsd_tsdn(tsd), &ctl_mtx);
- newind = oldind = oldarena->ind;
- WRITE(newind, unsigned);
- READ(oldind, unsigned);
- if (newind != oldind) {
- arena_t *newarena;
-
- if (newind >= ctl_stats.narenas) {
- /* New arena index is out of range. */
- ret = EFAULT;
- goto label_return;
- }
-
- /* Initialize arena if necessary. */
- newarena = arena_get(tsd_tsdn(tsd), newind, true);
- if (newarena == NULL) {
- ret = EAGAIN;
- goto label_return;
- }
- /* Set new arena/tcache associations. */
- arena_migrate(tsd, oldind, newind);
- if (config_tcache) {
- tcache_t *tcache = tsd_tcache_get(tsd);
- if (tcache != NULL) {
- tcache_arena_reassociate(tsd_tsdn(tsd), tcache,
- oldarena, newarena);
- }
- }
- }
-
- ret = 0;
-label_return:
- malloc_mutex_unlock(tsd_tsdn(tsd), &ctl_mtx);
- return (ret);
-}
-
-CTL_TSD_RO_NL_CGEN(config_stats, thread_allocated, tsd_thread_allocated_get,
- uint64_t)
-CTL_TSD_RO_NL_CGEN(config_stats, thread_allocatedp, tsd_thread_allocatedp_get,
- uint64_t *)
-CTL_TSD_RO_NL_CGEN(config_stats, thread_deallocated, tsd_thread_deallocated_get,
- uint64_t)
-CTL_TSD_RO_NL_CGEN(config_stats, thread_deallocatedp,
- tsd_thread_deallocatedp_get, uint64_t *)
-
-static int
-thread_tcache_enabled_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
- void *oldp, size_t *oldlenp, void *newp, size_t newlen)
-{
- int ret;
- bool oldval;
-
- if (!config_tcache)
- return (ENOENT);
-
- oldval = tcache_enabled_get();
- if (newp != NULL) {
- if (newlen != sizeof(bool)) {
- ret = EINVAL;
- goto label_return;
- }
- tcache_enabled_set(*(bool *)newp);
- }
- READ(oldval, bool);
-
- ret = 0;
-label_return:
- return (ret);
-}
-
-static int
-thread_tcache_flush_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
- void *oldp, size_t *oldlenp, void *newp, size_t newlen)
-{
- int ret;
-
- if (!config_tcache)
- return (ENOENT);
-
- READONLY();
- WRITEONLY();
-
- tcache_flush();
-
- ret = 0;
-label_return:
- return (ret);
-}
-
-static int
-thread_prof_name_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
- size_t *oldlenp, void *newp, size_t newlen)
-{
- int ret;
-
- if (!config_prof)
- return (ENOENT);
-
- READ_XOR_WRITE();
-
- if (newp != NULL) {
- if (newlen != sizeof(const char *)) {
- ret = EINVAL;
- goto label_return;
- }
-
- if ((ret = prof_thread_name_set(tsd, *(const char **)newp)) !=
- 0)
- goto label_return;
- } else {
- const char *oldname = prof_thread_name_get(tsd);
- READ(oldname, const char *);
- }
-
- ret = 0;
-label_return:
- return (ret);
-}
-
-static int
-thread_prof_active_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
- size_t *oldlenp, void *newp, size_t newlen)
-{
- int ret;
- bool oldval;
-
- if (!config_prof)
- return (ENOENT);
-
- oldval = prof_thread_active_get(tsd);
- if (newp != NULL) {
- if (newlen != sizeof(bool)) {
- ret = EINVAL;
- goto label_return;
- }
- if (prof_thread_active_set(tsd, *(bool *)newp)) {
- ret = EAGAIN;
- goto label_return;
- }
- }
- READ(oldval, bool);
-
- ret = 0;
-label_return:
- return (ret);
-}
-
-/******************************************************************************/
-
-static int
-tcache_create_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
- size_t *oldlenp, void *newp, size_t newlen)
-{
- int ret;
- unsigned tcache_ind;
-
- if (!config_tcache)
- return (ENOENT);
-
- malloc_mutex_lock(tsd_tsdn(tsd), &ctl_mtx);
- READONLY();
- if (tcaches_create(tsd, &tcache_ind)) {
- ret = EFAULT;
- goto label_return;
- }
- READ(tcache_ind, unsigned);
-
- ret = 0;
-label_return:
- malloc_mutex_unlock(tsd_tsdn(tsd), &ctl_mtx);
- return (ret);
-}
-
-static int
-tcache_flush_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
- size_t *oldlenp, void *newp, size_t newlen)
-{
- int ret;
- unsigned tcache_ind;
-
- if (!config_tcache)
- return (ENOENT);
-
- WRITEONLY();
- tcache_ind = UINT_MAX;
- WRITE(tcache_ind, unsigned);
- if (tcache_ind == UINT_MAX) {
- ret = EFAULT;
- goto label_return;
- }
- tcaches_flush(tsd, tcache_ind);
-
- ret = 0;
-label_return:
- return (ret);
-}
-
-static int
-tcache_destroy_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
- size_t *oldlenp, void *newp, size_t newlen)
-{
- int ret;
- unsigned tcache_ind;
-
- if (!config_tcache)
- return (ENOENT);
-
- WRITEONLY();
- tcache_ind = UINT_MAX;
- WRITE(tcache_ind, unsigned);
- if (tcache_ind == UINT_MAX) {
- ret = EFAULT;
- goto label_return;
- }
- tcaches_destroy(tsd, tcache_ind);
-
- ret = 0;
-label_return:
- return (ret);
-}
-
-/******************************************************************************/
-
-static void
-arena_i_purge(tsdn_t *tsdn, unsigned arena_ind, bool all)
-{
-
- malloc_mutex_lock(tsdn, &ctl_mtx);
- {
- unsigned narenas = ctl_stats.narenas;
-
- if (arena_ind == narenas) {
- unsigned i;
- VARIABLE_ARRAY(arena_t *, tarenas, narenas);
-
- for (i = 0; i < narenas; i++)
- tarenas[i] = arena_get(tsdn, i, false);
-
- /*
- * No further need to hold ctl_mtx, since narenas and
- * tarenas contain everything needed below.
- */
- malloc_mutex_unlock(tsdn, &ctl_mtx);
-
- for (i = 0; i < narenas; i++) {
- if (tarenas[i] != NULL)
- arena_purge(tsdn, tarenas[i], all);
- }
- } else {
- arena_t *tarena;
-
- assert(arena_ind < narenas);
-
- tarena = arena_get(tsdn, arena_ind, false);
-
- /* No further need to hold ctl_mtx. */
- malloc_mutex_unlock(tsdn, &ctl_mtx);
-
- if (tarena != NULL)
- arena_purge(tsdn, tarena, all);
- }
- }
-}
-
-static int
-arena_i_purge_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
- size_t *oldlenp, void *newp, size_t newlen)
-{
- int ret;
-
- READONLY();
- WRITEONLY();
- arena_i_purge(tsd_tsdn(tsd), (unsigned)mib[1], true);
-
- ret = 0;
-label_return:
- return (ret);
-}
-
-static int
-arena_i_decay_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
- size_t *oldlenp, void *newp, size_t newlen)
-{
- int ret;
-
- READONLY();
- WRITEONLY();
- arena_i_purge(tsd_tsdn(tsd), (unsigned)mib[1], false);
-
- ret = 0;
-label_return:
- return (ret);
-}
-
-static int
-arena_i_reset_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
- size_t *oldlenp, void *newp, size_t newlen)
-{
- int ret;
- unsigned arena_ind;
- arena_t *arena;
-
- READONLY();
- WRITEONLY();
-
- if ((config_valgrind && unlikely(in_valgrind)) || (config_fill &&
- unlikely(opt_quarantine))) {
- ret = EFAULT;
- goto label_return;
- }
-
- arena_ind = (unsigned)mib[1];
- if (config_debug) {
- malloc_mutex_lock(tsd_tsdn(tsd), &ctl_mtx);
- assert(arena_ind < ctl_stats.narenas);
- malloc_mutex_unlock(tsd_tsdn(tsd), &ctl_mtx);
- }
- assert(arena_ind >= opt_narenas);
-
- arena = arena_get(tsd_tsdn(tsd), arena_ind, false);
-
- arena_reset(tsd, arena);
-
- ret = 0;
-label_return:
- return (ret);
-}
-
-static int
-arena_i_dss_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
- size_t *oldlenp, void *newp, size_t newlen)
-{
- int ret;
- const char *dss = NULL;
- unsigned arena_ind = (unsigned)mib[1];
- dss_prec_t dss_prec_old = dss_prec_limit;
- dss_prec_t dss_prec = dss_prec_limit;
-
- malloc_mutex_lock(tsd_tsdn(tsd), &ctl_mtx);
- WRITE(dss, const char *);
- if (dss != NULL) {
- int i;
- bool match = false;
-
- for (i = 0; i < dss_prec_limit; i++) {
- if (strcmp(dss_prec_names[i], dss) == 0) {
- dss_prec = i;
- match = true;
- break;
- }
- }
-
- if (!match) {
- ret = EINVAL;
- goto label_return;
- }
- }
-
- if (arena_ind < ctl_stats.narenas) {
- arena_t *arena = arena_get(tsd_tsdn(tsd), arena_ind, false);
- if (arena == NULL || (dss_prec != dss_prec_limit &&
- arena_dss_prec_set(tsd_tsdn(tsd), arena, dss_prec))) {
- ret = EFAULT;
- goto label_return;
- }
- dss_prec_old = arena_dss_prec_get(tsd_tsdn(tsd), arena);
- } else {
- if (dss_prec != dss_prec_limit &&
- chunk_dss_prec_set(dss_prec)) {
- ret = EFAULT;
- goto label_return;
- }
- dss_prec_old = chunk_dss_prec_get();
- }
-
- dss = dss_prec_names[dss_prec_old];
- READ(dss, const char *);
-
- ret = 0;
-label_return:
- malloc_mutex_unlock(tsd_tsdn(tsd), &ctl_mtx);
- return (ret);
-}
-
-static int
-arena_i_lg_dirty_mult_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
- void *oldp, size_t *oldlenp, void *newp, size_t newlen)
-{
- int ret;
- unsigned arena_ind = (unsigned)mib[1];
- arena_t *arena;
-
- arena = arena_get(tsd_tsdn(tsd), arena_ind, false);
- if (arena == NULL) {
- ret = EFAULT;
- goto label_return;
- }
-
- if (oldp != NULL && oldlenp != NULL) {
- size_t oldval = arena_lg_dirty_mult_get(tsd_tsdn(tsd), arena);
- READ(oldval, ssize_t);
- }
- if (newp != NULL) {
- if (newlen != sizeof(ssize_t)) {
- ret = EINVAL;
- goto label_return;
- }
- if (arena_lg_dirty_mult_set(tsd_tsdn(tsd), arena,
- *(ssize_t *)newp)) {
- ret = EFAULT;
- goto label_return;
- }
- }
-
- ret = 0;
-label_return:
- return (ret);
-}
-
-static int
-arena_i_decay_time_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
- size_t *oldlenp, void *newp, size_t newlen)
-{
- int ret;
- unsigned arena_ind = (unsigned)mib[1];
- arena_t *arena;
-
- arena = arena_get(tsd_tsdn(tsd), arena_ind, false);
- if (arena == NULL) {
- ret = EFAULT;
- goto label_return;
- }
-
- if (oldp != NULL && oldlenp != NULL) {
- size_t oldval = arena_decay_time_get(tsd_tsdn(tsd), arena);
- READ(oldval, ssize_t);
- }
- if (newp != NULL) {
- if (newlen != sizeof(ssize_t)) {
- ret = EINVAL;
- goto label_return;
- }
- if (arena_decay_time_set(tsd_tsdn(tsd), arena,
- *(ssize_t *)newp)) {
- ret = EFAULT;
- goto label_return;
- }
- }
-
- ret = 0;
-label_return:
- return (ret);
-}
-
-static int
-arena_i_chunk_hooks_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
- void *oldp, size_t *oldlenp, void *newp, size_t newlen)
-{
- int ret;
- unsigned arena_ind = (unsigned)mib[1];
- arena_t *arena;
-
- malloc_mutex_lock(tsd_tsdn(tsd), &ctl_mtx);
- if (arena_ind < narenas_total_get() && (arena =
- arena_get(tsd_tsdn(tsd), arena_ind, false)) != NULL) {
- if (newp != NULL) {
- chunk_hooks_t old_chunk_hooks, new_chunk_hooks;
- WRITE(new_chunk_hooks, chunk_hooks_t);
- old_chunk_hooks = chunk_hooks_set(tsd_tsdn(tsd), arena,
- &new_chunk_hooks);
- READ(old_chunk_hooks, chunk_hooks_t);
- } else {
- chunk_hooks_t old_chunk_hooks =
- chunk_hooks_get(tsd_tsdn(tsd), arena);
- READ(old_chunk_hooks, chunk_hooks_t);
- }
- } else {
- ret = EFAULT;
- goto label_return;
- }
- ret = 0;
-label_return:
- malloc_mutex_unlock(tsd_tsdn(tsd), &ctl_mtx);
- return (ret);
-}
-
-static const ctl_named_node_t *
-arena_i_index(tsdn_t *tsdn, const size_t *mib, size_t miblen, size_t i)
-{
- const ctl_named_node_t *ret;
-
- malloc_mutex_lock(tsdn, &ctl_mtx);
- if (i > ctl_stats.narenas) {
- ret = NULL;
- goto label_return;
- }
-
- ret = super_arena_i_node;
-label_return:
- malloc_mutex_unlock(tsdn, &ctl_mtx);
- return (ret);
-}
-
-/******************************************************************************/
-
-static int
-arenas_narenas_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
- size_t *oldlenp, void *newp, size_t newlen)
-{
- int ret;
- unsigned narenas;
-
- malloc_mutex_lock(tsd_tsdn(tsd), &ctl_mtx);
- READONLY();
- if (*oldlenp != sizeof(unsigned)) {
- ret = EINVAL;
- goto label_return;
- }
- narenas = ctl_stats.narenas;
- READ(narenas, unsigned);
-
- ret = 0;
-label_return:
- malloc_mutex_unlock(tsd_tsdn(tsd), &ctl_mtx);
- return (ret);
-}
-
-static int
-arenas_initialized_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
- size_t *oldlenp, void *newp, size_t newlen)
-{
- int ret;
- unsigned nread, i;
-
- malloc_mutex_lock(tsd_tsdn(tsd), &ctl_mtx);
- READONLY();
- if (*oldlenp != ctl_stats.narenas * sizeof(bool)) {
- ret = EINVAL;
- nread = (*oldlenp < ctl_stats.narenas * sizeof(bool))
- ? (unsigned)(*oldlenp / sizeof(bool)) : ctl_stats.narenas;
- } else {
- ret = 0;
- nread = ctl_stats.narenas;
- }
-
- for (i = 0; i < nread; i++)
- ((bool *)oldp)[i] = ctl_stats.arenas[i].initialized;
-
-label_return:
- malloc_mutex_unlock(tsd_tsdn(tsd), &ctl_mtx);
- return (ret);
-}
-
-static int
-arenas_lg_dirty_mult_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
- void *oldp, size_t *oldlenp, void *newp, size_t newlen)
-{
- int ret;
-
- if (oldp != NULL && oldlenp != NULL) {
- size_t oldval = arena_lg_dirty_mult_default_get();
- READ(oldval, ssize_t);
- }
- if (newp != NULL) {
- if (newlen != sizeof(ssize_t)) {
- ret = EINVAL;
- goto label_return;
- }
- if (arena_lg_dirty_mult_default_set(*(ssize_t *)newp)) {
- ret = EFAULT;
- goto label_return;
- }
- }
-
- ret = 0;
-label_return:
- return (ret);
-}
-
-static int
-arenas_decay_time_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
- size_t *oldlenp, void *newp, size_t newlen)
-{
- int ret;
-
- if (oldp != NULL && oldlenp != NULL) {
- size_t oldval = arena_decay_time_default_get();
- READ(oldval, ssize_t);
- }
- if (newp != NULL) {
- if (newlen != sizeof(ssize_t)) {
- ret = EINVAL;
- goto label_return;
- }
- if (arena_decay_time_default_set(*(ssize_t *)newp)) {
- ret = EFAULT;
- goto label_return;
- }
- }
-
- ret = 0;
-label_return:
- return (ret);
-}
-
-CTL_RO_NL_GEN(arenas_quantum, QUANTUM, size_t)
-CTL_RO_NL_GEN(arenas_page, PAGE, size_t)
-CTL_RO_NL_CGEN(config_tcache, arenas_tcache_max, tcache_maxclass, size_t)
-CTL_RO_NL_GEN(arenas_nbins, NBINS, unsigned)
-CTL_RO_NL_CGEN(config_tcache, arenas_nhbins, nhbins, unsigned)
-CTL_RO_NL_GEN(arenas_bin_i_size, arena_bin_info[mib[2]].reg_size, size_t)
-CTL_RO_NL_GEN(arenas_bin_i_nregs, arena_bin_info[mib[2]].nregs, uint32_t)
-CTL_RO_NL_GEN(arenas_bin_i_run_size, arena_bin_info[mib[2]].run_size, size_t)
-static const ctl_named_node_t *
-arenas_bin_i_index(tsdn_t *tsdn, const size_t *mib, size_t miblen, size_t i)
-{
-
- if (i > NBINS)
- return (NULL);
- return (super_arenas_bin_i_node);
-}
-
-CTL_RO_NL_GEN(arenas_nlruns, nlclasses, unsigned)
-CTL_RO_NL_GEN(arenas_lrun_i_size, index2size(NBINS+(szind_t)mib[2]), size_t)
-static const ctl_named_node_t *
-arenas_lrun_i_index(tsdn_t *tsdn, const size_t *mib, size_t miblen, size_t i)
-{
-
- if (i > nlclasses)
- return (NULL);
- return (super_arenas_lrun_i_node);
-}
-
-CTL_RO_NL_GEN(arenas_nhchunks, nhclasses, unsigned)
-CTL_RO_NL_GEN(arenas_hchunk_i_size, index2size(NBINS+nlclasses+(szind_t)mib[2]),
- size_t)
-static const ctl_named_node_t *
-arenas_hchunk_i_index(tsdn_t *tsdn, const size_t *mib, size_t miblen, size_t i)
-{
-
- if (i > nhclasses)
- return (NULL);
- return (super_arenas_hchunk_i_node);
-}
-
-static int
-arenas_extend_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
- size_t *oldlenp, void *newp, size_t newlen)
-{
- int ret;
- unsigned narenas;
-
- malloc_mutex_lock(tsd_tsdn(tsd), &ctl_mtx);
- READONLY();
- if (ctl_grow(tsd_tsdn(tsd))) {
- ret = EAGAIN;
- goto label_return;
- }
- narenas = ctl_stats.narenas - 1;
- READ(narenas, unsigned);
-
- ret = 0;
-label_return:
- malloc_mutex_unlock(tsd_tsdn(tsd), &ctl_mtx);
- return (ret);
-}
-
-/******************************************************************************/
-
-static int
-prof_thread_active_init_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
- void *oldp, size_t *oldlenp, void *newp, size_t newlen)
-{
- int ret;
- bool oldval;
-
- if (!config_prof)
- return (ENOENT);
-
- if (newp != NULL) {
- if (newlen != sizeof(bool)) {
- ret = EINVAL;
- goto label_return;
- }
- oldval = prof_thread_active_init_set(tsd_tsdn(tsd),
- *(bool *)newp);
- } else
- oldval = prof_thread_active_init_get(tsd_tsdn(tsd));
- READ(oldval, bool);
-
- ret = 0;
-label_return:
- return (ret);
-}
-
-static int
-prof_active_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
- size_t *oldlenp, void *newp, size_t newlen)
-{
- int ret;
- bool oldval;
-
- if (!config_prof)
- return (ENOENT);
-
- if (newp != NULL) {
- if (newlen != sizeof(bool)) {
- ret = EINVAL;
- goto label_return;
- }
- oldval = prof_active_set(tsd_tsdn(tsd), *(bool *)newp);
- } else
- oldval = prof_active_get(tsd_tsdn(tsd));
- READ(oldval, bool);
-
- ret = 0;
-label_return:
- return (ret);
-}
-
-static int
-prof_dump_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
- size_t *oldlenp, void *newp, size_t newlen)
-{
- int ret;
- const char *filename = NULL;
-
- if (!config_prof)
- return (ENOENT);
-
- WRITEONLY();
- WRITE(filename, const char *);
-
- if (prof_mdump(tsd, filename)) {
- ret = EFAULT;
- goto label_return;
- }
-
- ret = 0;
-label_return:
- return (ret);
-}
-
-static int
-prof_gdump_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
- size_t *oldlenp, void *newp, size_t newlen)
-{
- int ret;
- bool oldval;
-
- if (!config_prof)
- return (ENOENT);
-
- if (newp != NULL) {
- if (newlen != sizeof(bool)) {
- ret = EINVAL;
- goto label_return;
- }
- oldval = prof_gdump_set(tsd_tsdn(tsd), *(bool *)newp);
- } else
- oldval = prof_gdump_get(tsd_tsdn(tsd));
- READ(oldval, bool);
-
- ret = 0;
-label_return:
- return (ret);
-}
-
-static int
-prof_reset_ctl(tsd_t *tsd, const size_t *mib, size_t miblen, void *oldp,
- size_t *oldlenp, void *newp, size_t newlen)
-{
- int ret;
- size_t lg_sample = lg_prof_sample;
-
- if (!config_prof)
- return (ENOENT);
-
- WRITEONLY();
- WRITE(lg_sample, size_t);
- if (lg_sample >= (sizeof(uint64_t) << 3))
- lg_sample = (sizeof(uint64_t) << 3) - 1;
-
- prof_reset(tsd, lg_sample);
-
- ret = 0;
-label_return:
- return (ret);
-}
-
-CTL_RO_NL_CGEN(config_prof, prof_interval, prof_interval, uint64_t)
-CTL_RO_NL_CGEN(config_prof, lg_prof_sample, lg_prof_sample, size_t)
-
-/******************************************************************************/
-
-CTL_RO_CGEN(config_stats, stats_cactive, &stats_cactive, size_t *)
-CTL_RO_CGEN(config_stats, stats_allocated, ctl_stats.allocated, size_t)
-CTL_RO_CGEN(config_stats, stats_active, ctl_stats.active, size_t)
-CTL_RO_CGEN(config_stats, stats_metadata, ctl_stats.metadata, size_t)
-CTL_RO_CGEN(config_stats, stats_resident, ctl_stats.resident, size_t)
-CTL_RO_CGEN(config_stats, stats_mapped, ctl_stats.mapped, size_t)
-CTL_RO_CGEN(config_stats, stats_retained, ctl_stats.retained, size_t)
-
-CTL_RO_GEN(stats_arenas_i_dss, ctl_stats.arenas[mib[2]].dss, const char *)
-CTL_RO_GEN(stats_arenas_i_lg_dirty_mult, ctl_stats.arenas[mib[2]].lg_dirty_mult,
- ssize_t)
-CTL_RO_GEN(stats_arenas_i_decay_time, ctl_stats.arenas[mib[2]].decay_time,
- ssize_t)
-CTL_RO_GEN(stats_arenas_i_nthreads, ctl_stats.arenas[mib[2]].nthreads, unsigned)
-CTL_RO_GEN(stats_arenas_i_pactive, ctl_stats.arenas[mib[2]].pactive, size_t)
-CTL_RO_GEN(stats_arenas_i_pdirty, ctl_stats.arenas[mib[2]].pdirty, size_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_mapped,
- ctl_stats.arenas[mib[2]].astats.mapped, size_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_retained,
- ctl_stats.arenas[mib[2]].astats.retained, size_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_npurge,
- ctl_stats.arenas[mib[2]].astats.npurge, uint64_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_nmadvise,
- ctl_stats.arenas[mib[2]].astats.nmadvise, uint64_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_purged,
- ctl_stats.arenas[mib[2]].astats.purged, uint64_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_metadata_mapped,
- ctl_stats.arenas[mib[2]].astats.metadata_mapped, size_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_metadata_allocated,
- ctl_stats.arenas[mib[2]].astats.metadata_allocated, size_t)
-
-CTL_RO_CGEN(config_stats, stats_arenas_i_small_allocated,
- ctl_stats.arenas[mib[2]].allocated_small, size_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_small_nmalloc,
- ctl_stats.arenas[mib[2]].nmalloc_small, uint64_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_small_ndalloc,
- ctl_stats.arenas[mib[2]].ndalloc_small, uint64_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_small_nrequests,
- ctl_stats.arenas[mib[2]].nrequests_small, uint64_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_large_allocated,
- ctl_stats.arenas[mib[2]].astats.allocated_large, size_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_large_nmalloc,
- ctl_stats.arenas[mib[2]].astats.nmalloc_large, uint64_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_large_ndalloc,
- ctl_stats.arenas[mib[2]].astats.ndalloc_large, uint64_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_large_nrequests,
- ctl_stats.arenas[mib[2]].astats.nrequests_large, uint64_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_huge_allocated,
- ctl_stats.arenas[mib[2]].astats.allocated_huge, size_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_huge_nmalloc,
- ctl_stats.arenas[mib[2]].astats.nmalloc_huge, uint64_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_huge_ndalloc,
- ctl_stats.arenas[mib[2]].astats.ndalloc_huge, uint64_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_huge_nrequests,
- ctl_stats.arenas[mib[2]].astats.nmalloc_huge, uint64_t) /* Intentional. */
-
-CTL_RO_CGEN(config_stats, stats_arenas_i_bins_j_nmalloc,
- ctl_stats.arenas[mib[2]].bstats[mib[4]].nmalloc, uint64_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_bins_j_ndalloc,
- ctl_stats.arenas[mib[2]].bstats[mib[4]].ndalloc, uint64_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_bins_j_nrequests,
- ctl_stats.arenas[mib[2]].bstats[mib[4]].nrequests, uint64_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_bins_j_curregs,
- ctl_stats.arenas[mib[2]].bstats[mib[4]].curregs, size_t)
-CTL_RO_CGEN(config_stats && config_tcache, stats_arenas_i_bins_j_nfills,
- ctl_stats.arenas[mib[2]].bstats[mib[4]].nfills, uint64_t)
-CTL_RO_CGEN(config_stats && config_tcache, stats_arenas_i_bins_j_nflushes,
- ctl_stats.arenas[mib[2]].bstats[mib[4]].nflushes, uint64_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_bins_j_nruns,
- ctl_stats.arenas[mib[2]].bstats[mib[4]].nruns, uint64_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_bins_j_nreruns,
- ctl_stats.arenas[mib[2]].bstats[mib[4]].reruns, uint64_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_bins_j_curruns,
- ctl_stats.arenas[mib[2]].bstats[mib[4]].curruns, size_t)
-
-static const ctl_named_node_t *
-stats_arenas_i_bins_j_index(tsdn_t *tsdn, const size_t *mib, size_t miblen,
- size_t j)
-{
-
- if (j > NBINS)
- return (NULL);
- return (super_stats_arenas_i_bins_j_node);
-}
-
-CTL_RO_CGEN(config_stats, stats_arenas_i_lruns_j_nmalloc,
- ctl_stats.arenas[mib[2]].lstats[mib[4]].nmalloc, uint64_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_lruns_j_ndalloc,
- ctl_stats.arenas[mib[2]].lstats[mib[4]].ndalloc, uint64_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_lruns_j_nrequests,
- ctl_stats.arenas[mib[2]].lstats[mib[4]].nrequests, uint64_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_lruns_j_curruns,
- ctl_stats.arenas[mib[2]].lstats[mib[4]].curruns, size_t)
-
-static const ctl_named_node_t *
-stats_arenas_i_lruns_j_index(tsdn_t *tsdn, const size_t *mib, size_t miblen,
- size_t j)
-{
-
- if (j > nlclasses)
- return (NULL);
- return (super_stats_arenas_i_lruns_j_node);
-}
-
-CTL_RO_CGEN(config_stats, stats_arenas_i_hchunks_j_nmalloc,
- ctl_stats.arenas[mib[2]].hstats[mib[4]].nmalloc, uint64_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_hchunks_j_ndalloc,
- ctl_stats.arenas[mib[2]].hstats[mib[4]].ndalloc, uint64_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_hchunks_j_nrequests,
- ctl_stats.arenas[mib[2]].hstats[mib[4]].nmalloc, /* Intentional. */
- uint64_t)
-CTL_RO_CGEN(config_stats, stats_arenas_i_hchunks_j_curhchunks,
- ctl_stats.arenas[mib[2]].hstats[mib[4]].curhchunks, size_t)
-
-static const ctl_named_node_t *
-stats_arenas_i_hchunks_j_index(tsdn_t *tsdn, const size_t *mib, size_t miblen,
- size_t j)
-{
-
- if (j > nhclasses)
- return (NULL);
- return (super_stats_arenas_i_hchunks_j_node);
-}
-
-static const ctl_named_node_t *
-stats_arenas_i_index(tsdn_t *tsdn, const size_t *mib, size_t miblen, size_t i)
-{
- const ctl_named_node_t * ret;
-
- malloc_mutex_lock(tsdn, &ctl_mtx);
- if (i > ctl_stats.narenas || !ctl_stats.arenas[i].initialized) {
- ret = NULL;
- goto label_return;
- }
-
- ret = super_stats_arenas_i_node;
-label_return:
- malloc_mutex_unlock(tsdn, &ctl_mtx);
- return (ret);
-}
diff --git a/memory/jemalloc/src/src/extent.c b/memory/jemalloc/src/src/extent.c
deleted file mode 100644
index 9f5146e5ff..0000000000
--- a/memory/jemalloc/src/src/extent.c
+++ /dev/null
@@ -1,53 +0,0 @@
-#define JEMALLOC_EXTENT_C_
-#include "jemalloc/internal/jemalloc_internal.h"
-
-/******************************************************************************/
-
-JEMALLOC_INLINE_C size_t
-extent_quantize(size_t size)
-{
-
- /*
- * Round down to the nearest chunk size that can actually be requested
- * during normal huge allocation.
- */
- return (index2size(size2index(size + 1) - 1));
-}
-
-JEMALLOC_INLINE_C int
-extent_szad_comp(const extent_node_t *a, const extent_node_t *b)
-{
- int ret;
- size_t a_qsize = extent_quantize(extent_node_size_get(a));
- size_t b_qsize = extent_quantize(extent_node_size_get(b));
-
- /*
- * Compare based on quantized size rather than size, in order to sort
- * equally useful extents only by address.
- */
- ret = (a_qsize > b_qsize) - (a_qsize < b_qsize);
- if (ret == 0) {
- uintptr_t a_addr = (uintptr_t)extent_node_addr_get(a);
- uintptr_t b_addr = (uintptr_t)extent_node_addr_get(b);
-
- ret = (a_addr > b_addr) - (a_addr < b_addr);
- }
-
- return (ret);
-}
-
-/* Generate red-black tree functions. */
-rb_gen(, extent_tree_szad_, extent_tree_t, extent_node_t, szad_link,
- extent_szad_comp)
-
-JEMALLOC_INLINE_C int
-extent_ad_comp(const extent_node_t *a, const extent_node_t *b)
-{
- uintptr_t a_addr = (uintptr_t)extent_node_addr_get(a);
- uintptr_t b_addr = (uintptr_t)extent_node_addr_get(b);
-
- return ((a_addr > b_addr) - (a_addr < b_addr));
-}
-
-/* Generate red-black tree functions. */
-rb_gen(, extent_tree_ad_, extent_tree_t, extent_node_t, ad_link, extent_ad_comp)
diff --git a/memory/jemalloc/src/src/hash.c b/memory/jemalloc/src/src/hash.c
deleted file mode 100644
index cfa4da0275..0000000000
--- a/memory/jemalloc/src/src/hash.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define JEMALLOC_HASH_C_
-#include "jemalloc/internal/jemalloc_internal.h"
diff --git a/memory/jemalloc/src/src/huge.c b/memory/jemalloc/src/src/huge.c
deleted file mode 100644
index 62e6932b7f..0000000000
--- a/memory/jemalloc/src/src/huge.c
+++ /dev/null
@@ -1,473 +0,0 @@
-#define JEMALLOC_HUGE_C_
-#include "jemalloc/internal/jemalloc_internal.h"
-
-/******************************************************************************/
-
-static extent_node_t *
-huge_node_get(const void *ptr)
-{
- extent_node_t *node;
-
- node = chunk_lookup(ptr, true);
- assert(!extent_node_achunk_get(node));
-
- return (node);
-}
-
-static bool
-huge_node_set(tsdn_t *tsdn, const void *ptr, extent_node_t *node)
-{
-
- assert(extent_node_addr_get(node) == ptr);
- assert(!extent_node_achunk_get(node));
- return (chunk_register(tsdn, ptr, node));
-}
-
-static void
-huge_node_reset(tsdn_t *tsdn, const void *ptr, extent_node_t *node)
-{
- bool err;
-
- err = huge_node_set(tsdn, ptr, node);
- assert(!err);
-}
-
-static void
-huge_node_unset(const void *ptr, const extent_node_t *node)
-{
-
- chunk_deregister(ptr, node);
-}
-
-void *
-huge_malloc(tsdn_t *tsdn, arena_t *arena, size_t usize, bool zero)
-{
-
- assert(usize == s2u(usize));
-
- return (huge_palloc(tsdn, arena, usize, chunksize, zero));
-}
-
-void *
-huge_palloc(tsdn_t *tsdn, arena_t *arena, size_t usize, size_t alignment,
- bool zero)
-{
- void *ret;
- size_t ausize;
- arena_t *iarena;
- extent_node_t *node;
- bool is_zeroed;
-
- /* Allocate one or more contiguous chunks for this request. */
-
- assert(!tsdn_null(tsdn) || arena != NULL);
-
- ausize = sa2u(usize, alignment);
- if (unlikely(ausize == 0 || ausize > HUGE_MAXCLASS))
- return (NULL);
- assert(ausize >= chunksize);
-
- /* Allocate an extent node with which to track the chunk. */
- iarena = (!tsdn_null(tsdn)) ? arena_ichoose(tsdn_tsd(tsdn), NULL) : a0get();
- node = ipallocztm(tsdn, CACHELINE_CEILING(sizeof(extent_node_t)),
- CACHELINE, false, NULL, true, iarena);
- if (node == NULL)
- return (NULL);
-
- /*
- * Copy zero into is_zeroed and pass the copy to chunk_alloc(), so that
- * it is possible to make correct junk/zero fill decisions below.
- */
- is_zeroed = zero;
- if (likely(!tsdn_null(tsdn)))
- arena = arena_choose(tsdn_tsd(tsdn), arena);
- if (unlikely(arena == NULL) || (ret = arena_chunk_alloc_huge(tsdn,
- arena, usize, alignment, &is_zeroed)) == NULL) {
- idalloctm(tsdn, node, NULL, true, true);
- return (NULL);
- }
-
- extent_node_init(node, arena, ret, usize, is_zeroed, true);
-
- if (huge_node_set(tsdn, ret, node)) {
- arena_chunk_dalloc_huge(tsdn, arena, ret, usize);
- idalloctm(tsdn, node, NULL, true, true);
- return (NULL);
- }
-
- /* Insert node into huge. */
- malloc_mutex_lock(tsdn, &arena->huge_mtx);
- ql_elm_new(node, ql_link);
- ql_tail_insert(&arena->huge, node, ql_link);
- malloc_mutex_unlock(tsdn, &arena->huge_mtx);
-
- if (zero || (config_fill && unlikely(opt_zero))) {
- if (!is_zeroed)
- memset(ret, 0, usize);
- } else if (config_fill && unlikely(opt_junk_alloc))
- memset(ret, JEMALLOC_ALLOC_JUNK, usize);
-
- arena_decay_tick(tsdn, arena);
- return (ret);
-}
-
-#ifdef JEMALLOC_JET
-#undef huge_dalloc_junk
-#define huge_dalloc_junk JEMALLOC_N(huge_dalloc_junk_impl)
-#endif
-static void
-huge_dalloc_junk(void *ptr, size_t usize)
-{
-
- if (config_fill && have_dss && unlikely(opt_junk_free)) {
- /*
- * Only bother junk filling if the chunk isn't about to be
- * unmapped.
- */
- if (!config_munmap || (have_dss && chunk_in_dss(ptr)))
- memset(ptr, JEMALLOC_FREE_JUNK, usize);
- }
-}
-#ifdef JEMALLOC_JET
-#undef huge_dalloc_junk
-#define huge_dalloc_junk JEMALLOC_N(huge_dalloc_junk)
-huge_dalloc_junk_t *huge_dalloc_junk = JEMALLOC_N(huge_dalloc_junk_impl);
-#endif
-
-static void
-huge_ralloc_no_move_similar(tsdn_t *tsdn, void *ptr, size_t oldsize,
- size_t usize_min, size_t usize_max, bool zero)
-{
- size_t usize, usize_next;
- extent_node_t *node;
- arena_t *arena;
- chunk_hooks_t chunk_hooks = CHUNK_HOOKS_INITIALIZER;
- bool pre_zeroed, post_zeroed;
-
- /* Increase usize to incorporate extra. */
- for (usize = usize_min; usize < usize_max && (usize_next = s2u(usize+1))
- <= oldsize; usize = usize_next)
- ; /* Do nothing. */
-
- if (oldsize == usize)
- return;
-
- node = huge_node_get(ptr);
- arena = extent_node_arena_get(node);
- pre_zeroed = extent_node_zeroed_get(node);
-
- /* Fill if necessary (shrinking). */
- if (oldsize > usize) {
- size_t sdiff = oldsize - usize;
- if (config_fill && unlikely(opt_junk_free)) {
- memset((void *)((uintptr_t)ptr + usize),
- JEMALLOC_FREE_JUNK, sdiff);
- post_zeroed = false;
- } else {
- post_zeroed = !chunk_purge_wrapper(tsdn, arena,
- &chunk_hooks, ptr, CHUNK_CEILING(oldsize), usize,
- sdiff);
- }
- } else
- post_zeroed = pre_zeroed;
-
- malloc_mutex_lock(tsdn, &arena->huge_mtx);
- /* Update the size of the huge allocation. */
- huge_node_unset(ptr, node);
- assert(extent_node_size_get(node) != usize);
- extent_node_size_set(node, usize);
- huge_node_reset(tsdn, ptr, node);
- /* Update zeroed. */
- extent_node_zeroed_set(node, post_zeroed);
- malloc_mutex_unlock(tsdn, &arena->huge_mtx);
-
- arena_chunk_ralloc_huge_similar(tsdn, arena, ptr, oldsize, usize);
-
- /* Fill if necessary (growing). */
- if (oldsize < usize) {
- if (zero || (config_fill && unlikely(opt_zero))) {
- if (!pre_zeroed) {
- memset((void *)((uintptr_t)ptr + oldsize), 0,
- usize - oldsize);
- }
- } else if (config_fill && unlikely(opt_junk_alloc)) {
- memset((void *)((uintptr_t)ptr + oldsize),
- JEMALLOC_ALLOC_JUNK, usize - oldsize);
- }
- }
-}
-
-static bool
-huge_ralloc_no_move_shrink(tsdn_t *tsdn, void *ptr, size_t oldsize,
- size_t usize)
-{
- extent_node_t *node;
- arena_t *arena;
- chunk_hooks_t chunk_hooks;
- size_t cdiff;
- bool pre_zeroed, post_zeroed;
-
- node = huge_node_get(ptr);
- arena = extent_node_arena_get(node);
- pre_zeroed = extent_node_zeroed_get(node);
- chunk_hooks = chunk_hooks_get(tsdn, arena);
-
- assert(oldsize > usize);
-
- /* Split excess chunks. */
- cdiff = CHUNK_CEILING(oldsize) - CHUNK_CEILING(usize);
- if (cdiff != 0 && chunk_hooks.split(ptr, CHUNK_CEILING(oldsize),
- CHUNK_CEILING(usize), cdiff, true, arena->ind))
- return (true);
-
- if (oldsize > usize) {
- size_t sdiff = oldsize - usize;
- if (config_fill && unlikely(opt_junk_free)) {
- huge_dalloc_junk((void *)((uintptr_t)ptr + usize),
- sdiff);
- post_zeroed = false;
- } else {
- post_zeroed = !chunk_purge_wrapper(tsdn, arena,
- &chunk_hooks, CHUNK_ADDR2BASE((uintptr_t)ptr +
- usize), CHUNK_CEILING(oldsize),
- CHUNK_ADDR2OFFSET((uintptr_t)ptr + usize), sdiff);
- }
- } else
- post_zeroed = pre_zeroed;
-
- malloc_mutex_lock(tsdn, &arena->huge_mtx);
- /* Update the size of the huge allocation. */
- huge_node_unset(ptr, node);
- extent_node_size_set(node, usize);
- huge_node_reset(tsdn, ptr, node);
- /* Update zeroed. */
- extent_node_zeroed_set(node, post_zeroed);
- malloc_mutex_unlock(tsdn, &arena->huge_mtx);
-
- /* Zap the excess chunks. */
- arena_chunk_ralloc_huge_shrink(tsdn, arena, ptr, oldsize, usize);
-
- return (false);
-}
-
-static bool
-huge_ralloc_no_move_expand(tsdn_t *tsdn, void *ptr, size_t oldsize,
- size_t usize, bool zero) {
- extent_node_t *node;
- arena_t *arena;
- bool is_zeroed_subchunk, is_zeroed_chunk;
-
- node = huge_node_get(ptr);
- arena = extent_node_arena_get(node);
- malloc_mutex_lock(tsdn, &arena->huge_mtx);
- is_zeroed_subchunk = extent_node_zeroed_get(node);
- malloc_mutex_unlock(tsdn, &arena->huge_mtx);
-
- /*
- * Use is_zeroed_chunk to detect whether the trailing memory is zeroed,
- * update extent's zeroed field, and zero as necessary.
- */
- is_zeroed_chunk = false;
- if (arena_chunk_ralloc_huge_expand(tsdn, arena, ptr, oldsize, usize,
- &is_zeroed_chunk))
- return (true);
-
- malloc_mutex_lock(tsdn, &arena->huge_mtx);
- huge_node_unset(ptr, node);
- extent_node_size_set(node, usize);
- extent_node_zeroed_set(node, extent_node_zeroed_get(node) &&
- is_zeroed_chunk);
- huge_node_reset(tsdn, ptr, node);
- malloc_mutex_unlock(tsdn, &arena->huge_mtx);
-
- if (zero || (config_fill && unlikely(opt_zero))) {
- if (!is_zeroed_subchunk) {
- memset((void *)((uintptr_t)ptr + oldsize), 0,
- CHUNK_CEILING(oldsize) - oldsize);
- }
- if (!is_zeroed_chunk) {
- memset((void *)((uintptr_t)ptr +
- CHUNK_CEILING(oldsize)), 0, usize -
- CHUNK_CEILING(oldsize));
- }
- } else if (config_fill && unlikely(opt_junk_alloc)) {
- memset((void *)((uintptr_t)ptr + oldsize), JEMALLOC_ALLOC_JUNK,
- usize - oldsize);
- }
-
- return (false);
-}
-
-bool
-huge_ralloc_no_move(tsdn_t *tsdn, void *ptr, size_t oldsize, size_t usize_min,
- size_t usize_max, bool zero)
-{
-
- assert(s2u(oldsize) == oldsize);
- /* The following should have been caught by callers. */
- assert(usize_min > 0 && usize_max <= HUGE_MAXCLASS);
-
- /* Both allocations must be huge to avoid a move. */
- if (oldsize < chunksize || usize_max < chunksize)
- return (true);
-
- if (CHUNK_CEILING(usize_max) > CHUNK_CEILING(oldsize)) {
- /* Attempt to expand the allocation in-place. */
- if (!huge_ralloc_no_move_expand(tsdn, ptr, oldsize, usize_max,
- zero)) {
- arena_decay_tick(tsdn, huge_aalloc(ptr));
- return (false);
- }
- /* Try again, this time with usize_min. */
- if (usize_min < usize_max && CHUNK_CEILING(usize_min) >
- CHUNK_CEILING(oldsize) && huge_ralloc_no_move_expand(tsdn,
- ptr, oldsize, usize_min, zero)) {
- arena_decay_tick(tsdn, huge_aalloc(ptr));
- return (false);
- }
- }
-
- /*
- * Avoid moving the allocation if the existing chunk size accommodates
- * the new size.
- */
- if (CHUNK_CEILING(oldsize) >= CHUNK_CEILING(usize_min)
- && CHUNK_CEILING(oldsize) <= CHUNK_CEILING(usize_max)) {
- huge_ralloc_no_move_similar(tsdn, ptr, oldsize, usize_min,
- usize_max, zero);
- arena_decay_tick(tsdn, huge_aalloc(ptr));
- return (false);
- }
-
- /* Attempt to shrink the allocation in-place. */
- if (CHUNK_CEILING(oldsize) > CHUNK_CEILING(usize_max)) {
- if (!huge_ralloc_no_move_shrink(tsdn, ptr, oldsize,
- usize_max)) {
- arena_decay_tick(tsdn, huge_aalloc(ptr));
- return (false);
- }
- }
- return (true);
-}
-
-static void *
-huge_ralloc_move_helper(tsdn_t *tsdn, arena_t *arena, size_t usize,
- size_t alignment, bool zero)
-{
-
- if (alignment <= chunksize)
- return (huge_malloc(tsdn, arena, usize, zero));
- return (huge_palloc(tsdn, arena, usize, alignment, zero));
-}
-
-void *
-huge_ralloc(tsd_t *tsd, arena_t *arena, void *ptr, size_t oldsize,
- size_t usize, size_t alignment, bool zero, tcache_t *tcache)
-{
- void *ret;
- size_t copysize;
-
- /* The following should have been caught by callers. */
- assert(usize > 0 && usize <= HUGE_MAXCLASS);
-
- /* Try to avoid moving the allocation. */
- if (!huge_ralloc_no_move(tsd_tsdn(tsd), ptr, oldsize, usize, usize,
- zero))
- return (ptr);
-
- /*
- * usize and oldsize are different enough that we need to use a
- * different size class. In that case, fall back to allocating new
- * space and copying.
- */
- ret = huge_ralloc_move_helper(tsd_tsdn(tsd), arena, usize, alignment,
- zero);
- if (ret == NULL)
- return (NULL);
-
- copysize = (usize < oldsize) ? usize : oldsize;
- memcpy(ret, ptr, copysize);
- isqalloc(tsd, ptr, oldsize, tcache, true);
- return (ret);
-}
-
-void
-huge_dalloc(tsdn_t *tsdn, void *ptr)
-{
- extent_node_t *node;
- arena_t *arena;
-
- node = huge_node_get(ptr);
- arena = extent_node_arena_get(node);
- huge_node_unset(ptr, node);
- malloc_mutex_lock(tsdn, &arena->huge_mtx);
- ql_remove(&arena->huge, node, ql_link);
- malloc_mutex_unlock(tsdn, &arena->huge_mtx);
-
- huge_dalloc_junk(extent_node_addr_get(node),
- extent_node_size_get(node));
- arena_chunk_dalloc_huge(tsdn, extent_node_arena_get(node),
- extent_node_addr_get(node), extent_node_size_get(node));
- idalloctm(tsdn, node, NULL, true, true);
-
- arena_decay_tick(tsdn, arena);
-}
-
-arena_t *
-huge_aalloc(const void *ptr)
-{
-
- return (extent_node_arena_get(huge_node_get(ptr)));
-}
-
-size_t
-huge_salloc(tsdn_t *tsdn, const void *ptr)
-{
- size_t size;
- extent_node_t *node;
- arena_t *arena;
-
- node = huge_node_get(ptr);
- arena = extent_node_arena_get(node);
- malloc_mutex_lock(tsdn, &arena->huge_mtx);
- size = extent_node_size_get(node);
- malloc_mutex_unlock(tsdn, &arena->huge_mtx);
-
- return (size);
-}
-
-prof_tctx_t *
-huge_prof_tctx_get(tsdn_t *tsdn, const void *ptr)
-{
- prof_tctx_t *tctx;
- extent_node_t *node;
- arena_t *arena;
-
- node = huge_node_get(ptr);
- arena = extent_node_arena_get(node);
- malloc_mutex_lock(tsdn, &arena->huge_mtx);
- tctx = extent_node_prof_tctx_get(node);
- malloc_mutex_unlock(tsdn, &arena->huge_mtx);
-
- return (tctx);
-}
-
-void
-huge_prof_tctx_set(tsdn_t *tsdn, const void *ptr, prof_tctx_t *tctx)
-{
- extent_node_t *node;
- arena_t *arena;
-
- node = huge_node_get(ptr);
- arena = extent_node_arena_get(node);
- malloc_mutex_lock(tsdn, &arena->huge_mtx);
- extent_node_prof_tctx_set(node, tctx);
- malloc_mutex_unlock(tsdn, &arena->huge_mtx);
-}
-
-void
-huge_prof_tctx_reset(tsdn_t *tsdn, const void *ptr)
-{
-
- huge_prof_tctx_set(tsdn, ptr, (prof_tctx_t *)(uintptr_t)1U);
-}
diff --git a/memory/jemalloc/src/src/jemalloc.c b/memory/jemalloc/src/src/jemalloc.c
deleted file mode 100644
index 38650ff062..0000000000
--- a/memory/jemalloc/src/src/jemalloc.c
+++ /dev/null
@@ -1,2897 +0,0 @@
-#define JEMALLOC_C_
-#include "jemalloc/internal/jemalloc_internal.h"
-
-/******************************************************************************/
-/* Data. */
-
-/* Runtime configuration options. */
-const char *je_malloc_conf
-#ifndef _WIN32
- JEMALLOC_ATTR(weak)
-#endif
- ;
-bool opt_abort =
-#ifdef JEMALLOC_DEBUG
- true
-#else
- false
-#endif
- ;
-const char *opt_junk =
-#if (defined(JEMALLOC_DEBUG) && defined(JEMALLOC_FILL))
- "true"
-#else
- "false"
-#endif
- ;
-bool opt_junk_alloc =
-#if (defined(JEMALLOC_DEBUG) && defined(JEMALLOC_FILL))
- true
-#else
- false
-#endif
- ;
-bool opt_junk_free =
-#if (defined(JEMALLOC_DEBUG) && defined(JEMALLOC_FILL))
- true
-#else
- false
-#endif
- ;
-
-size_t opt_quarantine = ZU(0);
-bool opt_redzone = false;
-bool opt_utrace = false;
-bool opt_xmalloc = false;
-bool opt_zero = false;
-unsigned opt_narenas = 0;
-
-/* Initialized to true if the process is running inside Valgrind. */
-bool in_valgrind;
-
-unsigned ncpus;
-
-/* Protects arenas initialization. */
-static malloc_mutex_t arenas_lock;
-/*
- * Arenas that are used to service external requests. Not all elements of the
- * arenas array are necessarily used; arenas are created lazily as needed.
- *
- * arenas[0..narenas_auto) are used for automatic multiplexing of threads and
- * arenas. arenas[narenas_auto..narenas_total) are only used if the application
- * takes some action to create them and allocate from them.
- */
-arena_t **arenas;
-static unsigned narenas_total; /* Use narenas_total_*(). */
-static arena_t *a0; /* arenas[0]; read-only after initialization. */
-unsigned narenas_auto; /* Read-only after initialization. */
-
-typedef enum {
- malloc_init_uninitialized = 3,
- malloc_init_a0_initialized = 2,
- malloc_init_recursible = 1,
- malloc_init_initialized = 0 /* Common case --> jnz. */
-} malloc_init_t;
-static malloc_init_t malloc_init_state = malloc_init_uninitialized;
-
-/* False should be the common case. Set to true to trigger initialization. */
-static bool malloc_slow = true;
-
-/* When malloc_slow is true, set the corresponding bits for sanity check. */
-enum {
- flag_opt_junk_alloc = (1U),
- flag_opt_junk_free = (1U << 1),
- flag_opt_quarantine = (1U << 2),
- flag_opt_zero = (1U << 3),
- flag_opt_utrace = (1U << 4),
- flag_in_valgrind = (1U << 5),
- flag_opt_xmalloc = (1U << 6)
-};
-static uint8_t malloc_slow_flags;
-
-JEMALLOC_ALIGNED(CACHELINE)
-const size_t pind2sz_tab[NPSIZES] = {
-#define PSZ_yes(lg_grp, ndelta, lg_delta) \
- (((ZU(1)<<lg_grp) + (ZU(ndelta)<<lg_delta))),
-#define PSZ_no(lg_grp, ndelta, lg_delta)
-#define SC(index, lg_grp, lg_delta, ndelta, psz, bin, lg_delta_lookup) \
- PSZ_##psz(lg_grp, ndelta, lg_delta)
- SIZE_CLASSES
-#undef PSZ_yes
-#undef PSZ_no
-#undef SC
-};
-
-JEMALLOC_ALIGNED(CACHELINE)
-const size_t index2size_tab[NSIZES] = {
-#define SC(index, lg_grp, lg_delta, ndelta, psz, bin, lg_delta_lookup) \
- ((ZU(1)<<lg_grp) + (ZU(ndelta)<<lg_delta)),
- SIZE_CLASSES
-#undef SC
-};
-
-JEMALLOC_ALIGNED(CACHELINE)
-const uint8_t size2index_tab[] = {
-#if LG_TINY_MIN == 0
-#warning "Dangerous LG_TINY_MIN"
-#define S2B_0(i) i,
-#elif LG_TINY_MIN == 1
-#warning "Dangerous LG_TINY_MIN"
-#define S2B_1(i) i,
-#elif LG_TINY_MIN == 2
-#warning "Dangerous LG_TINY_MIN"
-#define S2B_2(i) i,
-#elif LG_TINY_MIN == 3
-#define S2B_3(i) i,
-#elif LG_TINY_MIN == 4
-#define S2B_4(i) i,
-#elif LG_TINY_MIN == 5
-#define S2B_5(i) i,
-#elif LG_TINY_MIN == 6
-#define S2B_6(i) i,
-#elif LG_TINY_MIN == 7
-#define S2B_7(i) i,
-#elif LG_TINY_MIN == 8
-#define S2B_8(i) i,
-#elif LG_TINY_MIN == 9
-#define S2B_9(i) i,
-#elif LG_TINY_MIN == 10
-#define S2B_10(i) i,
-#elif LG_TINY_MIN == 11
-#define S2B_11(i) i,
-#else
-#error "Unsupported LG_TINY_MIN"
-#endif
-#if LG_TINY_MIN < 1
-#define S2B_1(i) S2B_0(i) S2B_0(i)
-#endif
-#if LG_TINY_MIN < 2
-#define S2B_2(i) S2B_1(i) S2B_1(i)
-#endif
-#if LG_TINY_MIN < 3
-#define S2B_3(i) S2B_2(i) S2B_2(i)
-#endif
-#if LG_TINY_MIN < 4
-#define S2B_4(i) S2B_3(i) S2B_3(i)
-#endif
-#if LG_TINY_MIN < 5
-#define S2B_5(i) S2B_4(i) S2B_4(i)
-#endif
-#if LG_TINY_MIN < 6
-#define S2B_6(i) S2B_5(i) S2B_5(i)
-#endif
-#if LG_TINY_MIN < 7
-#define S2B_7(i) S2B_6(i) S2B_6(i)
-#endif
-#if LG_TINY_MIN < 8
-#define S2B_8(i) S2B_7(i) S2B_7(i)
-#endif
-#if LG_TINY_MIN < 9
-#define S2B_9(i) S2B_8(i) S2B_8(i)
-#endif
-#if LG_TINY_MIN < 10
-#define S2B_10(i) S2B_9(i) S2B_9(i)
-#endif
-#if LG_TINY_MIN < 11
-#define S2B_11(i) S2B_10(i) S2B_10(i)
-#endif
-#define S2B_no(i)
-#define SC(index, lg_grp, lg_delta, ndelta, psz, bin, lg_delta_lookup) \
- S2B_##lg_delta_lookup(index)
- SIZE_CLASSES
-#undef S2B_3
-#undef S2B_4
-#undef S2B_5
-#undef S2B_6
-#undef S2B_7
-#undef S2B_8
-#undef S2B_9
-#undef S2B_10
-#undef S2B_11
-#undef S2B_no
-#undef SC
-};
-
-#ifdef JEMALLOC_THREADED_INIT
-/* Used to let the initializing thread recursively allocate. */
-# define NO_INITIALIZER ((unsigned long)0)
-# define INITIALIZER pthread_self()
-# define IS_INITIALIZER (malloc_initializer == pthread_self())
-static pthread_t malloc_initializer = NO_INITIALIZER;
-#else
-# define NO_INITIALIZER false
-# define INITIALIZER true
-# define IS_INITIALIZER malloc_initializer
-static bool malloc_initializer = NO_INITIALIZER;
-#endif
-
-/* Used to avoid initialization races. */
-#ifdef _WIN32
-#if _WIN32_WINNT >= 0x0600
-static malloc_mutex_t init_lock = SRWLOCK_INIT;
-#else
-static malloc_mutex_t init_lock;
-static bool init_lock_initialized = false;
-
-JEMALLOC_ATTR(constructor)
-static void WINAPI
-_init_init_lock(void)
-{
-
- /* If another constructor in the same binary is using mallctl to
- * e.g. setup chunk hooks, it may end up running before this one,
- * and malloc_init_hard will crash trying to lock the uninitialized
- * lock. So we force an initialization of the lock in
- * malloc_init_hard as well. We don't try to care about atomicity
- * of the accessed to the init_lock_initialized boolean, since it
- * really only matters early in the process creation, before any
- * separate thread normally starts doing anything. */
- if (!init_lock_initialized)
- malloc_mutex_init(&init_lock, "init", WITNESS_RANK_INIT);
- init_lock_initialized = true;
-}
-
-#ifdef _MSC_VER
-# pragma section(".CRT$XCU", read)
-JEMALLOC_SECTION(".CRT$XCU") JEMALLOC_ATTR(used)
-static const void (WINAPI *init_init_lock)(void) = _init_init_lock;
-#endif
-#endif
-#else
-static malloc_mutex_t init_lock = MALLOC_MUTEX_INITIALIZER;
-#endif
-
-typedef struct {
- void *p; /* Input pointer (as in realloc(p, s)). */
- size_t s; /* Request size. */
- void *r; /* Result pointer. */
-} malloc_utrace_t;
-
-#ifdef JEMALLOC_UTRACE
-# define UTRACE(a, b, c) do { \
- if (unlikely(opt_utrace)) { \
- int utrace_serrno = errno; \
- malloc_utrace_t ut; \
- ut.p = (a); \
- ut.s = (b); \
- ut.r = (c); \
- utrace(&ut, sizeof(ut)); \
- errno = utrace_serrno; \
- } \
-} while (0)
-#else
-# define UTRACE(a, b, c)
-#endif
-
-/******************************************************************************/
-/*
- * Function prototypes for static functions that are referenced prior to
- * definition.
- */
-
-static bool malloc_init_hard_a0(void);
-static bool malloc_init_hard(void);
-
-/******************************************************************************/
-/*
- * Begin miscellaneous support functions.
- */
-
-JEMALLOC_ALWAYS_INLINE_C bool
-malloc_initialized(void)
-{
-
- return (malloc_init_state == malloc_init_initialized);
-}
-
-JEMALLOC_ALWAYS_INLINE_C void
-malloc_thread_init(void)
-{
-
- /*
- * TSD initialization can't be safely done as a side effect of
- * deallocation, because it is possible for a thread to do nothing but
- * deallocate its TLS data via free(), in which case writing to TLS
- * would cause write-after-free memory corruption. The quarantine
- * facility *only* gets used as a side effect of deallocation, so make
- * a best effort attempt at initializing its TSD by hooking all
- * allocation events.
- */
- if (config_fill && unlikely(opt_quarantine))
- quarantine_alloc_hook();
-}
-
-JEMALLOC_ALWAYS_INLINE_C bool
-malloc_init_a0(void)
-{
-
- if (unlikely(malloc_init_state == malloc_init_uninitialized))
- return (malloc_init_hard_a0());
- return (false);
-}
-
-JEMALLOC_ALWAYS_INLINE_C bool
-malloc_init(void)
-{
-
- if (unlikely(!malloc_initialized()) && malloc_init_hard())
- return (true);
- malloc_thread_init();
-
- return (false);
-}
-
-/*
- * The a0*() functions are used instead of i{d,}alloc() in situations that
- * cannot tolerate TLS variable access.
- */
-
-static void *
-a0ialloc(size_t size, bool zero, bool is_metadata)
-{
-
- if (unlikely(malloc_init_a0()))
- return (NULL);
-
- return (iallocztm(TSDN_NULL, size, size2index(size), zero, NULL,
- is_metadata, arena_get(TSDN_NULL, 0, true), true));
-}
-
-static void
-a0idalloc(void *ptr, bool is_metadata)
-{
-
- idalloctm(TSDN_NULL, ptr, false, is_metadata, true);
-}
-
-arena_t *
-a0get(void)
-{
-
- return (a0);
-}
-
-void *
-a0malloc(size_t size)
-{
-
- return (a0ialloc(size, false, true));
-}
-
-void
-a0dalloc(void *ptr)
-{
-
- a0idalloc(ptr, true);
-}
-
-/*
- * FreeBSD's libc uses the bootstrap_*() functions in bootstrap-senstive
- * situations that cannot tolerate TLS variable access (TLS allocation and very
- * early internal data structure initialization).
- */
-
-void *
-bootstrap_malloc(size_t size)
-{
-
- if (unlikely(size == 0))
- size = 1;
-
- return (a0ialloc(size, false, false));
-}
-
-void *
-bootstrap_calloc(size_t num, size_t size)
-{
- size_t num_size;
-
- num_size = num * size;
- if (unlikely(num_size == 0)) {
- assert(num == 0 || size == 0);
- num_size = 1;
- }
-
- return (a0ialloc(num_size, true, false));
-}
-
-void
-bootstrap_free(void *ptr)
-{
-
- if (unlikely(ptr == NULL))
- return;
-
- a0idalloc(ptr, false);
-}
-
-static void
-arena_set(unsigned ind, arena_t *arena)
-{
-
- atomic_write_p((void **)&arenas[ind], arena);
-}
-
-static void
-narenas_total_set(unsigned narenas)
-{
-
- atomic_write_u(&narenas_total, narenas);
-}
-
-static void
-narenas_total_inc(void)
-{
-
- atomic_add_u(&narenas_total, 1);
-}
-
-unsigned
-narenas_total_get(void)
-{
-
- return (atomic_read_u(&narenas_total));
-}
-
-/* Create a new arena and insert it into the arenas array at index ind. */
-static arena_t *
-arena_init_locked(tsdn_t *tsdn, unsigned ind)
-{
- arena_t *arena;
-
- assert(ind <= narenas_total_get());
- if (ind > MALLOCX_ARENA_MAX)
- return (NULL);
- if (ind == narenas_total_get())
- narenas_total_inc();
-
- /*
- * Another thread may have already initialized arenas[ind] if it's an
- * auto arena.
- */
- arena = arena_get(tsdn, ind, false);
- if (arena != NULL) {
- assert(ind < narenas_auto);
- return (arena);
- }
-
- /* Actually initialize the arena. */
- arena = arena_new(tsdn, ind);
- arena_set(ind, arena);
- return (arena);
-}
-
-arena_t *
-arena_init(tsdn_t *tsdn, unsigned ind)
-{
- arena_t *arena;
-
- malloc_mutex_lock(tsdn, &arenas_lock);
- arena = arena_init_locked(tsdn, ind);
- malloc_mutex_unlock(tsdn, &arenas_lock);
- return (arena);
-}
-
-static void
-arena_bind(tsd_t *tsd, unsigned ind, bool internal)
-{
- arena_t *arena;
-
- if (!tsd_nominal(tsd))
- return;
-
- arena = arena_get(tsd_tsdn(tsd), ind, false);
- arena_nthreads_inc(arena, internal);
-
- if (internal)
- tsd_iarena_set(tsd, arena);
- else
- tsd_arena_set(tsd, arena);
-}
-
-void
-arena_migrate(tsd_t *tsd, unsigned oldind, unsigned newind)
-{
- arena_t *oldarena, *newarena;
-
- oldarena = arena_get(tsd_tsdn(tsd), oldind, false);
- newarena = arena_get(tsd_tsdn(tsd), newind, false);
- arena_nthreads_dec(oldarena, false);
- arena_nthreads_inc(newarena, false);
- tsd_arena_set(tsd, newarena);
-}
-
-static void
-arena_unbind(tsd_t *tsd, unsigned ind, bool internal)
-{
- arena_t *arena;
-
- arena = arena_get(tsd_tsdn(tsd), ind, false);
- arena_nthreads_dec(arena, internal);
- if (internal)
- tsd_iarena_set(tsd, NULL);
- else
- tsd_arena_set(tsd, NULL);
-}
-
-arena_tdata_t *
-arena_tdata_get_hard(tsd_t *tsd, unsigned ind)
-{
- arena_tdata_t *tdata, *arenas_tdata_old;
- arena_tdata_t *arenas_tdata = tsd_arenas_tdata_get(tsd);
- unsigned narenas_tdata_old, i;
- unsigned narenas_tdata = tsd_narenas_tdata_get(tsd);
- unsigned narenas_actual = narenas_total_get();
-
- /*
- * Dissociate old tdata array (and set up for deallocation upon return)
- * if it's too small.
- */
- if (arenas_tdata != NULL && narenas_tdata < narenas_actual) {
- arenas_tdata_old = arenas_tdata;
- narenas_tdata_old = narenas_tdata;
- arenas_tdata = NULL;
- narenas_tdata = 0;
- tsd_arenas_tdata_set(tsd, arenas_tdata);
- tsd_narenas_tdata_set(tsd, narenas_tdata);
- } else {
- arenas_tdata_old = NULL;
- narenas_tdata_old = 0;
- }
-
- /* Allocate tdata array if it's missing. */
- if (arenas_tdata == NULL) {
- bool *arenas_tdata_bypassp = tsd_arenas_tdata_bypassp_get(tsd);
- narenas_tdata = (ind < narenas_actual) ? narenas_actual : ind+1;
-
- if (tsd_nominal(tsd) && !*arenas_tdata_bypassp) {
- *arenas_tdata_bypassp = true;
- arenas_tdata = (arena_tdata_t *)a0malloc(
- sizeof(arena_tdata_t) * narenas_tdata);
- *arenas_tdata_bypassp = false;
- }
- if (arenas_tdata == NULL) {
- tdata = NULL;
- goto label_return;
- }
- assert(tsd_nominal(tsd) && !*arenas_tdata_bypassp);
- tsd_arenas_tdata_set(tsd, arenas_tdata);
- tsd_narenas_tdata_set(tsd, narenas_tdata);
- }
-
- /*
- * Copy to tdata array. It's possible that the actual number of arenas
- * has increased since narenas_total_get() was called above, but that
- * causes no correctness issues unless two threads concurrently execute
- * the arenas.extend mallctl, which we trust mallctl synchronization to
- * prevent.
- */
-
- /* Copy/initialize tickers. */
- for (i = 0; i < narenas_actual; i++) {
- if (i < narenas_tdata_old) {
- ticker_copy(&arenas_tdata[i].decay_ticker,
- &arenas_tdata_old[i].decay_ticker);
- } else {
- ticker_init(&arenas_tdata[i].decay_ticker,
- DECAY_NTICKS_PER_UPDATE);
- }
- }
- if (narenas_tdata > narenas_actual) {
- memset(&arenas_tdata[narenas_actual], 0, sizeof(arena_tdata_t)
- * (narenas_tdata - narenas_actual));
- }
-
- /* Read the refreshed tdata array. */
- tdata = &arenas_tdata[ind];
-label_return:
- if (arenas_tdata_old != NULL)
- a0dalloc(arenas_tdata_old);
- return (tdata);
-}
-
-/* Slow path, called only by arena_choose(). */
-arena_t *
-arena_choose_hard(tsd_t *tsd, bool internal)
-{
- arena_t *ret JEMALLOC_CC_SILENCE_INIT(NULL);
-
- if (narenas_auto > 1) {
- unsigned i, j, choose[2], first_null;
-
- /*
- * Determine binding for both non-internal and internal
- * allocation.
- *
- * choose[0]: For application allocation.
- * choose[1]: For internal metadata allocation.
- */
-
- for (j = 0; j < 2; j++)
- choose[j] = 0;
-
- first_null = narenas_auto;
- malloc_mutex_lock(tsd_tsdn(tsd), &arenas_lock);
- assert(arena_get(tsd_tsdn(tsd), 0, false) != NULL);
- for (i = 1; i < narenas_auto; i++) {
- if (arena_get(tsd_tsdn(tsd), i, false) != NULL) {
- /*
- * Choose the first arena that has the lowest
- * number of threads assigned to it.
- */
- for (j = 0; j < 2; j++) {
- if (arena_nthreads_get(arena_get(
- tsd_tsdn(tsd), i, false), !!j) <
- arena_nthreads_get(arena_get(
- tsd_tsdn(tsd), choose[j], false),
- !!j))
- choose[j] = i;
- }
- } else if (first_null == narenas_auto) {
- /*
- * Record the index of the first uninitialized
- * arena, in case all extant arenas are in use.
- *
- * NB: It is possible for there to be
- * discontinuities in terms of initialized
- * versus uninitialized arenas, due to the
- * "thread.arena" mallctl.
- */
- first_null = i;
- }
- }
-
- for (j = 0; j < 2; j++) {
- if (arena_nthreads_get(arena_get(tsd_tsdn(tsd),
- choose[j], false), !!j) == 0 || first_null ==
- narenas_auto) {
- /*
- * Use an unloaded arena, or the least loaded
- * arena if all arenas are already initialized.
- */
- if (!!j == internal) {
- ret = arena_get(tsd_tsdn(tsd),
- choose[j], false);
- }
- } else {
- arena_t *arena;
-
- /* Initialize a new arena. */
- choose[j] = first_null;
- arena = arena_init_locked(tsd_tsdn(tsd),
- choose[j]);
- if (arena == NULL) {
- malloc_mutex_unlock(tsd_tsdn(tsd),
- &arenas_lock);
- return (NULL);
- }
- if (!!j == internal)
- ret = arena;
- }
- arena_bind(tsd, choose[j], !!j);
- }
- malloc_mutex_unlock(tsd_tsdn(tsd), &arenas_lock);
- } else {
- ret = arena_get(tsd_tsdn(tsd), 0, false);
- arena_bind(tsd, 0, false);
- arena_bind(tsd, 0, true);
- }
-
- return (ret);
-}
-
-void
-thread_allocated_cleanup(tsd_t *tsd)
-{
-
- /* Do nothing. */
-}
-
-void
-thread_deallocated_cleanup(tsd_t *tsd)
-{
-
- /* Do nothing. */
-}
-
-void
-iarena_cleanup(tsd_t *tsd)
-{
- arena_t *iarena;
-
- iarena = tsd_iarena_get(tsd);
- if (iarena != NULL)
- arena_unbind(tsd, iarena->ind, true);
-}
-
-void
-arena_cleanup(tsd_t *tsd)
-{
- arena_t *arena;
-
- arena = tsd_arena_get(tsd);
- if (arena != NULL)
- arena_unbind(tsd, arena->ind, false);
-}
-
-void
-arenas_tdata_cleanup(tsd_t *tsd)
-{
- arena_tdata_t *arenas_tdata;
-
- /* Prevent tsd->arenas_tdata from being (re)created. */
- *tsd_arenas_tdata_bypassp_get(tsd) = true;
-
- arenas_tdata = tsd_arenas_tdata_get(tsd);
- if (arenas_tdata != NULL) {
- tsd_arenas_tdata_set(tsd, NULL);
- a0dalloc(arenas_tdata);
- }
-}
-
-void
-narenas_tdata_cleanup(tsd_t *tsd)
-{
-
- /* Do nothing. */
-}
-
-void
-arenas_tdata_bypass_cleanup(tsd_t *tsd)
-{
-
- /* Do nothing. */
-}
-
-static void
-stats_print_atexit(void)
-{
-
- if (config_tcache && config_stats) {
- tsdn_t *tsdn;
- unsigned narenas, i;
-
- tsdn = tsdn_fetch();
-
- /*
- * Merge stats from extant threads. This is racy, since
- * individual threads do not lock when recording tcache stats
- * events. As a consequence, the final stats may be slightly
- * out of date by the time they are reported, if other threads
- * continue to allocate.
- */
- for (i = 0, narenas = narenas_total_get(); i < narenas; i++) {
- arena_t *arena = arena_get(tsdn, i, false);
- if (arena != NULL) {
- tcache_t *tcache;
-
- /*
- * tcache_stats_merge() locks bins, so if any
- * code is introduced that acquires both arena
- * and bin locks in the opposite order,
- * deadlocks may result.
- */
- malloc_mutex_lock(tsdn, &arena->lock);
- ql_foreach(tcache, &arena->tcache_ql, link) {
- tcache_stats_merge(tsdn, tcache, arena);
- }
- malloc_mutex_unlock(tsdn, &arena->lock);
- }
- }
- }
- je_malloc_stats_print(NULL, NULL, NULL);
-}
-
-/*
- * End miscellaneous support functions.
- */
-/******************************************************************************/
-/*
- * Begin initialization functions.
- */
-
-#ifndef JEMALLOC_HAVE_SECURE_GETENV
-static char *
-secure_getenv(const char *name)
-{
-
-# ifdef JEMALLOC_HAVE_ISSETUGID
- if (issetugid() != 0)
- return (NULL);
-# endif
- return (getenv(name));
-}
-#endif
-
-static unsigned
-malloc_ncpus(void)
-{
- long result;
-
-#ifdef _WIN32
- SYSTEM_INFO si;
- GetSystemInfo(&si);
- result = si.dwNumberOfProcessors;
-#elif defined(JEMALLOC_GLIBC_MALLOC_HOOK) && defined(CPU_COUNT)
- /*
- * glibc >= 2.6 has the CPU_COUNT macro.
- *
- * glibc's sysconf() uses isspace(). glibc allocates for the first time
- * *before* setting up the isspace tables. Therefore we need a
- * different method to get the number of CPUs.
- */
- {
- cpu_set_t set;
-
- pthread_getaffinity_np(pthread_self(), sizeof(set), &set);
- result = CPU_COUNT(&set);
- }
-#else
- result = sysconf(_SC_NPROCESSORS_ONLN);
-#endif
- return ((result == -1) ? 1 : (unsigned)result);
-}
-
-static bool
-malloc_conf_next(char const **opts_p, char const **k_p, size_t *klen_p,
- char const **v_p, size_t *vlen_p)
-{
- bool accept;
- const char *opts = *opts_p;
-
- *k_p = opts;
-
- for (accept = false; !accept;) {
- switch (*opts) {
- case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
- case 'G': case 'H': case 'I': case 'J': case 'K': case 'L':
- case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R':
- case 'S': case 'T': case 'U': case 'V': case 'W': case 'X':
- case 'Y': case 'Z':
- case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
- case 'g': case 'h': case 'i': case 'j': case 'k': case 'l':
- case 'm': case 'n': case 'o': case 'p': case 'q': case 'r':
- case 's': case 't': case 'u': case 'v': case 'w': case 'x':
- case 'y': case 'z':
- case '0': case '1': case '2': case '3': case '4': case '5':
- case '6': case '7': case '8': case '9':
- case '_':
- opts++;
- break;
- case ':':
- opts++;
- *klen_p = (uintptr_t)opts - 1 - (uintptr_t)*k_p;
- *v_p = opts;
- accept = true;
- break;
- case '\0':
- if (opts != *opts_p) {
- malloc_write("<jemalloc>: Conf string ends "
- "with key\n");
- }
- return (true);
- default:
- malloc_write("<jemalloc>: Malformed conf string\n");
- return (true);
- }
- }
-
- for (accept = false; !accept;) {
- switch (*opts) {
- case ',':
- opts++;
- /*
- * Look ahead one character here, because the next time
- * this function is called, it will assume that end of
- * input has been cleanly reached if no input remains,
- * but we have optimistically already consumed the
- * comma if one exists.
- */
- if (*opts == '\0') {
- malloc_write("<jemalloc>: Conf string ends "
- "with comma\n");
- }
- *vlen_p = (uintptr_t)opts - 1 - (uintptr_t)*v_p;
- accept = true;
- break;
- case '\0':
- *vlen_p = (uintptr_t)opts - (uintptr_t)*v_p;
- accept = true;
- break;
- default:
- opts++;
- break;
- }
- }
-
- *opts_p = opts;
- return (false);
-}
-
-static void
-malloc_conf_error(const char *msg, const char *k, size_t klen, const char *v,
- size_t vlen)
-{
-
- malloc_printf("<jemalloc>: %s: %.*s:%.*s\n", msg, (int)klen, k,
- (int)vlen, v);
-}
-
-static void
-malloc_slow_flag_init(void)
-{
- /*
- * Combine the runtime options into malloc_slow for fast path. Called
- * after processing all the options.
- */
- malloc_slow_flags |= (opt_junk_alloc ? flag_opt_junk_alloc : 0)
- | (opt_junk_free ? flag_opt_junk_free : 0)
- | (opt_quarantine ? flag_opt_quarantine : 0)
- | (opt_zero ? flag_opt_zero : 0)
- | (opt_utrace ? flag_opt_utrace : 0)
- | (opt_xmalloc ? flag_opt_xmalloc : 0);
-
- if (config_valgrind)
- malloc_slow_flags |= (in_valgrind ? flag_in_valgrind : 0);
-
- malloc_slow = (malloc_slow_flags != 0);
-}
-
-static void
-malloc_conf_init(void)
-{
- unsigned i;
- char buf[PATH_MAX + 1];
- const char *opts, *k, *v;
- size_t klen, vlen;
-
- /*
- * Automatically configure valgrind before processing options. The
- * valgrind option remains in jemalloc 3.x for compatibility reasons.
- */
- if (config_valgrind) {
- in_valgrind = (RUNNING_ON_VALGRIND != 0) ? true : false;
- if (config_fill && unlikely(in_valgrind)) {
- opt_junk = "false";
- opt_junk_alloc = false;
- opt_junk_free = false;
- assert(!opt_zero);
- opt_quarantine = JEMALLOC_VALGRIND_QUARANTINE_DEFAULT;
- opt_redzone = true;
- }
- if (config_tcache && unlikely(in_valgrind))
- opt_tcache = false;
- }
-
- for (i = 0; i < 4; i++) {
- /* Get runtime configuration. */
- switch (i) {
- case 0:
- opts = config_malloc_conf;
- break;
- case 1:
- if (je_malloc_conf != NULL) {
- /*
- * Use options that were compiled into the
- * program.
- */
- opts = je_malloc_conf;
- } else {
- /* No configuration specified. */
- buf[0] = '\0';
- opts = buf;
- }
- break;
- case 2: {
- ssize_t linklen = 0;
-#ifndef _WIN32
- int saved_errno = errno;
- const char *linkname =
-# ifdef JEMALLOC_PREFIX
- "/etc/"JEMALLOC_PREFIX"malloc.conf"
-# else
- "/etc/malloc.conf"
-# endif
- ;
-
- /*
- * Try to use the contents of the "/etc/malloc.conf"
- * symbolic link's name.
- */
- linklen = readlink(linkname, buf, sizeof(buf) - 1);
- if (linklen == -1) {
- /* No configuration specified. */
- linklen = 0;
- /* Restore errno. */
- set_errno(saved_errno);
- }
-#endif
- buf[linklen] = '\0';
- opts = buf;
- break;
- } case 3: {
- const char *envname =
-#ifdef JEMALLOC_PREFIX
- JEMALLOC_CPREFIX"MALLOC_CONF"
-#else
- "MALLOC_CONF"
-#endif
- ;
-
- if ((opts = secure_getenv(envname)) != NULL) {
- /*
- * Do nothing; opts is already initialized to
- * the value of the MALLOC_CONF environment
- * variable.
- */
- } else {
- /* No configuration specified. */
- buf[0] = '\0';
- opts = buf;
- }
- break;
- } default:
- not_reached();
- buf[0] = '\0';
- opts = buf;
- }
-
- while (*opts != '\0' && !malloc_conf_next(&opts, &k, &klen, &v,
- &vlen)) {
-#define CONF_MATCH(n) \
- (sizeof(n)-1 == klen && strncmp(n, k, klen) == 0)
-#define CONF_MATCH_VALUE(n) \
- (sizeof(n)-1 == vlen && strncmp(n, v, vlen) == 0)
-#define CONF_HANDLE_BOOL(o, n, cont) \
- if (CONF_MATCH(n)) { \
- if (CONF_MATCH_VALUE("true")) \
- o = true; \
- else if (CONF_MATCH_VALUE("false")) \
- o = false; \
- else { \
- malloc_conf_error( \
- "Invalid conf value", \
- k, klen, v, vlen); \
- } \
- if (cont) \
- continue; \
- }
-#define CONF_HANDLE_T_U(t, o, n, min, max, clip) \
- if (CONF_MATCH(n)) { \
- uintmax_t um; \
- char *end; \
- \
- set_errno(0); \
- um = malloc_strtoumax(v, &end, 0); \
- if (get_errno() != 0 || (uintptr_t)end -\
- (uintptr_t)v != vlen) { \
- malloc_conf_error( \
- "Invalid conf value", \
- k, klen, v, vlen); \
- } else if (clip) { \
- if ((min) != 0 && um < (min)) \
- o = (t)(min); \
- else if (um > (max)) \
- o = (t)(max); \
- else \
- o = (t)um; \
- } else { \
- if (((min) != 0 && um < (min)) \
- || um > (max)) { \
- malloc_conf_error( \
- "Out-of-range " \
- "conf value", \
- k, klen, v, vlen); \
- } else \
- o = (t)um; \
- } \
- continue; \
- }
-#define CONF_HANDLE_UNSIGNED(o, n, min, max, clip) \
- CONF_HANDLE_T_U(unsigned, o, n, min, max, clip)
-#define CONF_HANDLE_SIZE_T(o, n, min, max, clip) \
- CONF_HANDLE_T_U(size_t, o, n, min, max, clip)
-#define CONF_HANDLE_SSIZE_T(o, n, min, max) \
- if (CONF_MATCH(n)) { \
- long l; \
- char *end; \
- \
- set_errno(0); \
- l = strtol(v, &end, 0); \
- if (get_errno() != 0 || (uintptr_t)end -\
- (uintptr_t)v != vlen) { \
- malloc_conf_error( \
- "Invalid conf value", \
- k, klen, v, vlen); \
- } else if (l < (ssize_t)(min) || l > \
- (ssize_t)(max)) { \
- malloc_conf_error( \
- "Out-of-range conf value", \
- k, klen, v, vlen); \
- } else \
- o = l; \
- continue; \
- }
-#define CONF_HANDLE_CHAR_P(o, n, d) \
- if (CONF_MATCH(n)) { \
- size_t cpylen = (vlen <= \
- sizeof(o)-1) ? vlen : \
- sizeof(o)-1; \
- strncpy(o, v, cpylen); \
- o[cpylen] = '\0'; \
- continue; \
- }
-
- CONF_HANDLE_BOOL(opt_abort, "abort", true)
- /*
- * Chunks always require at least one header page,
- * as many as 2^(LG_SIZE_CLASS_GROUP+1) data pages, and
- * possibly an additional page in the presence of
- * redzones. In order to simplify options processing,
- * use a conservative bound that accommodates all these
- * constraints.
- */
- CONF_HANDLE_SIZE_T(opt_lg_chunk, "lg_chunk", LG_PAGE +
- LG_SIZE_CLASS_GROUP + (config_fill ? 2 : 1),
- (sizeof(size_t) << 3) - 1, true)
- if (strncmp("dss", k, klen) == 0) {
- int i;
- bool match = false;
- for (i = 0; i < dss_prec_limit; i++) {
- if (strncmp(dss_prec_names[i], v, vlen)
- == 0) {
- if (chunk_dss_prec_set(i)) {
- malloc_conf_error(
- "Error setting dss",
- k, klen, v, vlen);
- } else {
- opt_dss =
- dss_prec_names[i];
- match = true;
- break;
- }
- }
- }
- if (!match) {
- malloc_conf_error("Invalid conf value",
- k, klen, v, vlen);
- }
- continue;
- }
- CONF_HANDLE_UNSIGNED(opt_narenas, "narenas", 1,
- UINT_MAX, false)
- if (strncmp("purge", k, klen) == 0) {
- int i;
- bool match = false;
- for (i = 0; i < purge_mode_limit; i++) {
- if (strncmp(purge_mode_names[i], v,
- vlen) == 0) {
- opt_purge = (purge_mode_t)i;
- match = true;
- break;
- }
- }
- if (!match) {
- malloc_conf_error("Invalid conf value",
- k, klen, v, vlen);
- }
- continue;
- }
- CONF_HANDLE_SSIZE_T(opt_lg_dirty_mult, "lg_dirty_mult",
- -1, (sizeof(size_t) << 3) - 1)
- CONF_HANDLE_SSIZE_T(opt_decay_time, "decay_time", -1,
- NSTIME_SEC_MAX);
- CONF_HANDLE_BOOL(opt_stats_print, "stats_print", true)
- if (config_fill) {
- if (CONF_MATCH("junk")) {
- if (CONF_MATCH_VALUE("true")) {
- if (config_valgrind &&
- unlikely(in_valgrind)) {
- malloc_conf_error(
- "Deallocation-time "
- "junk filling cannot "
- "be enabled while "
- "running inside "
- "Valgrind", k, klen, v,
- vlen);
- } else {
- opt_junk = "true";
- opt_junk_alloc = true;
- opt_junk_free = true;
- }
- } else if (CONF_MATCH_VALUE("false")) {
- opt_junk = "false";
- opt_junk_alloc = opt_junk_free =
- false;
- } else if (CONF_MATCH_VALUE("alloc")) {
- opt_junk = "alloc";
- opt_junk_alloc = true;
- opt_junk_free = false;
- } else if (CONF_MATCH_VALUE("free")) {
- if (config_valgrind &&
- unlikely(in_valgrind)) {
- malloc_conf_error(
- "Deallocation-time "
- "junk filling cannot "
- "be enabled while "
- "running inside "
- "Valgrind", k, klen, v,
- vlen);
- } else {
- opt_junk = "free";
- opt_junk_alloc = false;
- opt_junk_free = true;
- }
- } else {
- malloc_conf_error(
- "Invalid conf value", k,
- klen, v, vlen);
- }
- continue;
- }
- CONF_HANDLE_SIZE_T(opt_quarantine, "quarantine",
- 0, SIZE_T_MAX, false)
- CONF_HANDLE_BOOL(opt_redzone, "redzone", true)
- CONF_HANDLE_BOOL(opt_zero, "zero", true)
- }
- if (config_utrace) {
- CONF_HANDLE_BOOL(opt_utrace, "utrace", true)
- }
- if (config_xmalloc) {
- CONF_HANDLE_BOOL(opt_xmalloc, "xmalloc", true)
- }
- if (config_tcache) {
- CONF_HANDLE_BOOL(opt_tcache, "tcache",
- !config_valgrind || !in_valgrind)
- if (CONF_MATCH("tcache")) {
- assert(config_valgrind && in_valgrind);
- if (opt_tcache) {
- opt_tcache = false;
- malloc_conf_error(
- "tcache cannot be enabled "
- "while running inside Valgrind",
- k, klen, v, vlen);
- }
- continue;
- }
- CONF_HANDLE_SSIZE_T(opt_lg_tcache_max,
- "lg_tcache_max", -1,
- (sizeof(size_t) << 3) - 1)
- }
- if (config_prof) {
- CONF_HANDLE_BOOL(opt_prof, "prof", true)
- CONF_HANDLE_CHAR_P(opt_prof_prefix,
- "prof_prefix", "jeprof")
- CONF_HANDLE_BOOL(opt_prof_active, "prof_active",
- true)
- CONF_HANDLE_BOOL(opt_prof_thread_active_init,
- "prof_thread_active_init", true)
- CONF_HANDLE_SIZE_T(opt_lg_prof_sample,
- "lg_prof_sample", 0,
- (sizeof(uint64_t) << 3) - 1, true)
- CONF_HANDLE_BOOL(opt_prof_accum, "prof_accum",
- true)
- CONF_HANDLE_SSIZE_T(opt_lg_prof_interval,
- "lg_prof_interval", -1,
- (sizeof(uint64_t) << 3) - 1)
- CONF_HANDLE_BOOL(opt_prof_gdump, "prof_gdump",
- true)
- CONF_HANDLE_BOOL(opt_prof_final, "prof_final",
- true)
- CONF_HANDLE_BOOL(opt_prof_leak, "prof_leak",
- true)
- }
- malloc_conf_error("Invalid conf pair", k, klen, v,
- vlen);
-#undef CONF_MATCH
-#undef CONF_HANDLE_BOOL
-#undef CONF_HANDLE_SIZE_T
-#undef CONF_HANDLE_SSIZE_T
-#undef CONF_HANDLE_CHAR_P
- }
- }
-}
-
-static bool
-malloc_init_hard_needed(void)
-{
-
- if (malloc_initialized() || (IS_INITIALIZER && malloc_init_state ==
- malloc_init_recursible)) {
- /*
- * Another thread initialized the allocator before this one
- * acquired init_lock, or this thread is the initializing
- * thread, and it is recursively allocating.
- */
- return (false);
- }
-#ifdef JEMALLOC_THREADED_INIT
- if (malloc_initializer != NO_INITIALIZER && !IS_INITIALIZER) {
- spin_t spinner;
-
- /* Busy-wait until the initializing thread completes. */
- spin_init(&spinner);
- do {
- malloc_mutex_unlock(TSDN_NULL, &init_lock);
- spin_adaptive(&spinner);
- malloc_mutex_lock(TSDN_NULL, &init_lock);
- } while (!malloc_initialized());
- return (false);
- }
-#endif
- return (true);
-}
-
-static bool
-malloc_init_hard_a0_locked()
-{
-
- malloc_initializer = INITIALIZER;
-
- if (config_prof)
- prof_boot0();
- malloc_conf_init();
- if (opt_stats_print) {
- /* Print statistics at exit. */
- if (atexit(stats_print_atexit) != 0) {
- malloc_write("<jemalloc>: Error in atexit()\n");
- if (opt_abort)
- abort();
- }
- }
- pages_boot();
- if (base_boot())
- return (true);
- if (chunk_boot())
- return (true);
- if (ctl_boot())
- return (true);
- if (config_prof)
- prof_boot1();
- arena_boot();
- if (config_tcache && tcache_boot(TSDN_NULL))
- return (true);
- if (malloc_mutex_init(&arenas_lock, "arenas", WITNESS_RANK_ARENAS))
- return (true);
- /*
- * Create enough scaffolding to allow recursive allocation in
- * malloc_ncpus().
- */
- narenas_auto = 1;
- narenas_total_set(narenas_auto);
- arenas = &a0;
- memset(arenas, 0, sizeof(arena_t *) * narenas_auto);
- /*
- * Initialize one arena here. The rest are lazily created in
- * arena_choose_hard().
- */
- if (arena_init(TSDN_NULL, 0) == NULL)
- return (true);
-
- malloc_init_state = malloc_init_a0_initialized;
-
- return (false);
-}
-
-static bool
-malloc_init_hard_a0(void)
-{
- bool ret;
-
- malloc_mutex_lock(TSDN_NULL, &init_lock);
- ret = malloc_init_hard_a0_locked();
- malloc_mutex_unlock(TSDN_NULL, &init_lock);
- return (ret);
-}
-
-/* Initialize data structures which may trigger recursive allocation. */
-static bool
-malloc_init_hard_recursible(void)
-{
-
- malloc_init_state = malloc_init_recursible;
-
- ncpus = malloc_ncpus();
-
-#if (!defined(JEMALLOC_MUTEX_INIT_CB) && !defined(JEMALLOC_ZONE) \
- && !defined(_WIN32) && !defined(__native_client__))
- /* LinuxThreads' pthread_atfork() allocates. */
- if (pthread_atfork(jemalloc_prefork, jemalloc_postfork_parent,
- jemalloc_postfork_child) != 0) {
- malloc_write("<jemalloc>: Error in pthread_atfork()\n");
- if (opt_abort)
- abort();
- return (true);
- }
-#endif
-
- return (false);
-}
-
-static bool
-malloc_init_hard_finish(tsdn_t *tsdn)
-{
-
- if (malloc_mutex_boot())
- return (true);
-
- if (opt_narenas == 0) {
- /*
- * For SMP systems, create more than one arena per CPU by
- * default.
- */
- if (ncpus > 1)
- opt_narenas = ncpus << 2;
- else
- opt_narenas = 1;
- }
- narenas_auto = opt_narenas;
- /*
- * Limit the number of arenas to the indexing range of MALLOCX_ARENA().
- */
- if (narenas_auto > MALLOCX_ARENA_MAX) {
- narenas_auto = MALLOCX_ARENA_MAX;
- malloc_printf("<jemalloc>: Reducing narenas to limit (%d)\n",
- narenas_auto);
- }
- narenas_total_set(narenas_auto);
-
- /* Allocate and initialize arenas. */
- arenas = (arena_t **)base_alloc(tsdn, sizeof(arena_t *) *
- (MALLOCX_ARENA_MAX+1));
- if (arenas == NULL)
- return (true);
- /* Copy the pointer to the one arena that was already initialized. */
- arena_set(0, a0);
-
- malloc_init_state = malloc_init_initialized;
- malloc_slow_flag_init();
-
- return (false);
-}
-
-static bool
-malloc_init_hard(void)
-{
- tsd_t *tsd;
-
-#if defined(_WIN32) && _WIN32_WINNT < 0x0600
- _init_init_lock();
-#endif
- malloc_mutex_lock(TSDN_NULL, &init_lock);
- if (!malloc_init_hard_needed()) {
- malloc_mutex_unlock(TSDN_NULL, &init_lock);
- return (false);
- }
-
- if (malloc_init_state != malloc_init_a0_initialized &&
- malloc_init_hard_a0_locked()) {
- malloc_mutex_unlock(TSDN_NULL, &init_lock);
- return (true);
- }
-
- malloc_mutex_unlock(TSDN_NULL, &init_lock);
- /* Recursive allocation relies on functional tsd. */
- tsd = malloc_tsd_boot0();
- if (tsd == NULL)
- return (true);
- if (malloc_init_hard_recursible())
- return (true);
- malloc_mutex_lock(tsd_tsdn(tsd), &init_lock);
-
- if (config_prof && prof_boot2(tsd)) {
- malloc_mutex_unlock(tsd_tsdn(tsd), &init_lock);
- return (true);
- }
-
- if (malloc_init_hard_finish(tsd_tsdn(tsd))) {
- malloc_mutex_unlock(tsd_tsdn(tsd), &init_lock);
- return (true);
- }
-
- malloc_mutex_unlock(tsd_tsdn(tsd), &init_lock);
- malloc_tsd_boot1();
- return (false);
-}
-
-/*
- * End initialization functions.
- */
-/******************************************************************************/
-/*
- * Begin malloc(3)-compatible functions.
- */
-
-static void *
-ialloc_prof_sample(tsd_t *tsd, size_t usize, szind_t ind, bool zero,
- prof_tctx_t *tctx, bool slow_path)
-{
- void *p;
-
- if (tctx == NULL)
- return (NULL);
- if (usize <= SMALL_MAXCLASS) {
- szind_t ind_large = size2index(LARGE_MINCLASS);
- p = ialloc(tsd, LARGE_MINCLASS, ind_large, zero, slow_path);
- if (p == NULL)
- return (NULL);
- arena_prof_promoted(tsd_tsdn(tsd), p, usize);
- } else
- p = ialloc(tsd, usize, ind, zero, slow_path);
-
- return (p);
-}
-
-JEMALLOC_ALWAYS_INLINE_C void *
-ialloc_prof(tsd_t *tsd, size_t usize, szind_t ind, bool zero, bool slow_path)
-{
- void *p;
- prof_tctx_t *tctx;
-
- tctx = prof_alloc_prep(tsd, usize, prof_active_get_unlocked(), true);
- if (unlikely((uintptr_t)tctx != (uintptr_t)1U))
- p = ialloc_prof_sample(tsd, usize, ind, zero, tctx, slow_path);
- else
- p = ialloc(tsd, usize, ind, zero, slow_path);
- if (unlikely(p == NULL)) {
- prof_alloc_rollback(tsd, tctx, true);
- return (NULL);
- }
- prof_malloc(tsd_tsdn(tsd), p, usize, tctx);
-
- return (p);
-}
-
-/*
- * ialloc_body() is inlined so that fast and slow paths are generated separately
- * with statically known slow_path.
- *
- * This function guarantees that *tsdn is non-NULL on success.
- */
-JEMALLOC_ALWAYS_INLINE_C void *
-ialloc_body(size_t size, bool zero, tsdn_t **tsdn, size_t *usize,
- bool slow_path)
-{
- tsd_t *tsd;
- szind_t ind;
-
- if (slow_path && unlikely(malloc_init())) {
- *tsdn = NULL;
- return (NULL);
- }
-
- tsd = tsd_fetch();
- *tsdn = tsd_tsdn(tsd);
- witness_assert_lockless(tsd_tsdn(tsd));
-
- ind = size2index(size);
- if (unlikely(ind >= NSIZES))
- return (NULL);
-
- if (config_stats || (config_prof && opt_prof) || (slow_path &&
- config_valgrind && unlikely(in_valgrind))) {
- *usize = index2size(ind);
- assert(*usize > 0 && *usize <= HUGE_MAXCLASS);
- }
-
- if (config_prof && opt_prof)
- return (ialloc_prof(tsd, *usize, ind, zero, slow_path));
-
- return (ialloc(tsd, size, ind, zero, slow_path));
-}
-
-JEMALLOC_ALWAYS_INLINE_C void
-ialloc_post_check(void *ret, tsdn_t *tsdn, size_t usize, const char *func,
- bool update_errno, bool slow_path)
-{
-
- assert(!tsdn_null(tsdn) || ret == NULL);
-
- if (unlikely(ret == NULL)) {
- if (slow_path && config_xmalloc && unlikely(opt_xmalloc)) {
- malloc_printf("<jemalloc>: Error in %s(): out of "
- "memory\n", func);
- abort();
- }
- if (update_errno)
- set_errno(ENOMEM);
- }
- if (config_stats && likely(ret != NULL)) {
- assert(usize == isalloc(tsdn, ret, config_prof));
- *tsd_thread_allocatedp_get(tsdn_tsd(tsdn)) += usize;
- }
- witness_assert_lockless(tsdn);
-}
-
-JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
-void JEMALLOC_NOTHROW *
-JEMALLOC_ATTR(malloc) JEMALLOC_ALLOC_SIZE(1)
-je_malloc(size_t size)
-{
- void *ret;
- tsdn_t *tsdn;
- size_t usize JEMALLOC_CC_SILENCE_INIT(0);
-
- if (size == 0)
- size = 1;
-
- if (likely(!malloc_slow)) {
- ret = ialloc_body(size, false, &tsdn, &usize, false);
- ialloc_post_check(ret, tsdn, usize, "malloc", true, false);
- } else {
- ret = ialloc_body(size, false, &tsdn, &usize, true);
- ialloc_post_check(ret, tsdn, usize, "malloc", true, true);
- UTRACE(0, size, ret);
- JEMALLOC_VALGRIND_MALLOC(ret != NULL, tsdn, ret, usize, false);
- }
-
- return (ret);
-}
-
-static void *
-imemalign_prof_sample(tsd_t *tsd, size_t alignment, size_t usize,
- prof_tctx_t *tctx)
-{
- void *p;
-
- if (tctx == NULL)
- return (NULL);
- if (usize <= SMALL_MAXCLASS) {
- assert(sa2u(LARGE_MINCLASS, alignment) == LARGE_MINCLASS);
- p = ipalloc(tsd, LARGE_MINCLASS, alignment, false);
- if (p == NULL)
- return (NULL);
- arena_prof_promoted(tsd_tsdn(tsd), p, usize);
- } else
- p = ipalloc(tsd, usize, alignment, false);
-
- return (p);
-}
-
-JEMALLOC_ALWAYS_INLINE_C void *
-imemalign_prof(tsd_t *tsd, size_t alignment, size_t usize)
-{
- void *p;
- prof_tctx_t *tctx;
-
- tctx = prof_alloc_prep(tsd, usize, prof_active_get_unlocked(), true);
- if (unlikely((uintptr_t)tctx != (uintptr_t)1U))
- p = imemalign_prof_sample(tsd, alignment, usize, tctx);
- else
- p = ipalloc(tsd, usize, alignment, false);
- if (unlikely(p == NULL)) {
- prof_alloc_rollback(tsd, tctx, true);
- return (NULL);
- }
- prof_malloc(tsd_tsdn(tsd), p, usize, tctx);
-
- return (p);
-}
-
-JEMALLOC_ATTR(nonnull(1))
-static int
-imemalign(void **memptr, size_t alignment, size_t size, size_t min_alignment)
-{
- int ret;
- tsd_t *tsd;
- size_t usize;
- void *result;
-
- assert(min_alignment != 0);
-
- if (unlikely(malloc_init())) {
- tsd = NULL;
- result = NULL;
- goto label_oom;
- }
- tsd = tsd_fetch();
- witness_assert_lockless(tsd_tsdn(tsd));
- if (size == 0)
- size = 1;
-
- /* Make sure that alignment is a large enough power of 2. */
- if (unlikely(((alignment - 1) & alignment) != 0
- || (alignment < min_alignment))) {
- if (config_xmalloc && unlikely(opt_xmalloc)) {
- malloc_write("<jemalloc>: Error allocating "
- "aligned memory: invalid alignment\n");
- abort();
- }
- result = NULL;
- ret = EINVAL;
- goto label_return;
- }
-
- usize = sa2u(size, alignment);
- if (unlikely(usize == 0 || usize > HUGE_MAXCLASS)) {
- result = NULL;
- goto label_oom;
- }
-
- if (config_prof && opt_prof)
- result = imemalign_prof(tsd, alignment, usize);
- else
- result = ipalloc(tsd, usize, alignment, false);
- if (unlikely(result == NULL))
- goto label_oom;
- assert(((uintptr_t)result & (alignment - 1)) == ZU(0));
-
- *memptr = result;
- ret = 0;
-label_return:
- if (config_stats && likely(result != NULL)) {
- assert(usize == isalloc(tsd_tsdn(tsd), result, config_prof));
- *tsd_thread_allocatedp_get(tsd) += usize;
- }
- UTRACE(0, size, result);
- JEMALLOC_VALGRIND_MALLOC(result != NULL, tsd_tsdn(tsd), result, usize,
- false);
- witness_assert_lockless(tsd_tsdn(tsd));
- return (ret);
-label_oom:
- assert(result == NULL);
- if (config_xmalloc && unlikely(opt_xmalloc)) {
- malloc_write("<jemalloc>: Error allocating aligned memory: "
- "out of memory\n");
- abort();
- }
- ret = ENOMEM;
- witness_assert_lockless(tsd_tsdn(tsd));
- goto label_return;
-}
-
-JEMALLOC_EXPORT int JEMALLOC_NOTHROW
-JEMALLOC_ATTR(nonnull(1))
-je_posix_memalign(void **memptr, size_t alignment, size_t size)
-{
- int ret;
-
- ret = imemalign(memptr, alignment, size, sizeof(void *));
-
- return (ret);
-}
-
-JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
-void JEMALLOC_NOTHROW *
-JEMALLOC_ATTR(malloc) JEMALLOC_ALLOC_SIZE(2)
-je_aligned_alloc(size_t alignment, size_t size)
-{
- void *ret;
- int err;
-
- if (unlikely((err = imemalign(&ret, alignment, size, 1)) != 0)) {
- ret = NULL;
- set_errno(err);
- }
-
- return (ret);
-}
-
-JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
-void JEMALLOC_NOTHROW *
-JEMALLOC_ATTR(malloc) JEMALLOC_ALLOC_SIZE2(1, 2)
-je_calloc(size_t num, size_t size)
-{
- void *ret;
- tsdn_t *tsdn;
- size_t num_size;
- size_t usize JEMALLOC_CC_SILENCE_INIT(0);
-
- num_size = num * size;
- if (unlikely(num_size == 0)) {
- if (num == 0 || size == 0)
- num_size = 1;
- else
- num_size = HUGE_MAXCLASS + 1; /* Trigger OOM. */
- /*
- * Try to avoid division here. We know that it isn't possible to
- * overflow during multiplication if neither operand uses any of the
- * most significant half of the bits in a size_t.
- */
- } else if (unlikely(((num | size) & (SIZE_T_MAX << (sizeof(size_t) <<
- 2))) && (num_size / size != num)))
- num_size = HUGE_MAXCLASS + 1; /* size_t overflow. */
-
- if (likely(!malloc_slow)) {
- ret = ialloc_body(num_size, true, &tsdn, &usize, false);
- ialloc_post_check(ret, tsdn, usize, "calloc", true, false);
- } else {
- ret = ialloc_body(num_size, true, &tsdn, &usize, true);
- ialloc_post_check(ret, tsdn, usize, "calloc", true, true);
- UTRACE(0, num_size, ret);
- JEMALLOC_VALGRIND_MALLOC(ret != NULL, tsdn, ret, usize, true);
- }
-
- return (ret);
-}
-
-static void *
-irealloc_prof_sample(tsd_t *tsd, void *old_ptr, size_t old_usize, size_t usize,
- prof_tctx_t *tctx)
-{
- void *p;
-
- if (tctx == NULL)
- return (NULL);
- if (usize <= SMALL_MAXCLASS) {
- p = iralloc(tsd, old_ptr, old_usize, LARGE_MINCLASS, 0, false);
- if (p == NULL)
- return (NULL);
- arena_prof_promoted(tsd_tsdn(tsd), p, usize);
- } else
- p = iralloc(tsd, old_ptr, old_usize, usize, 0, false);
-
- return (p);
-}
-
-JEMALLOC_ALWAYS_INLINE_C void *
-irealloc_prof(tsd_t *tsd, void *old_ptr, size_t old_usize, size_t usize)
-{
- void *p;
- bool prof_active;
- prof_tctx_t *old_tctx, *tctx;
-
- prof_active = prof_active_get_unlocked();
- old_tctx = prof_tctx_get(tsd_tsdn(tsd), old_ptr);
- tctx = prof_alloc_prep(tsd, usize, prof_active, true);
- if (unlikely((uintptr_t)tctx != (uintptr_t)1U))
- p = irealloc_prof_sample(tsd, old_ptr, old_usize, usize, tctx);
- else
- p = iralloc(tsd, old_ptr, old_usize, usize, 0, false);
- if (unlikely(p == NULL)) {
- prof_alloc_rollback(tsd, tctx, true);
- return (NULL);
- }
- prof_realloc(tsd, p, usize, tctx, prof_active, true, old_ptr, old_usize,
- old_tctx);
-
- return (p);
-}
-
-JEMALLOC_INLINE_C void
-ifree(tsd_t *tsd, void *ptr, tcache_t *tcache, bool slow_path)
-{
- size_t usize;
- UNUSED size_t rzsize JEMALLOC_CC_SILENCE_INIT(0);
-
- witness_assert_lockless(tsd_tsdn(tsd));
-
- assert(ptr != NULL);
- assert(malloc_initialized() || IS_INITIALIZER);
-
- if (config_prof && opt_prof) {
- usize = isalloc(tsd_tsdn(tsd), ptr, config_prof);
- prof_free(tsd, ptr, usize);
- } else if (config_stats || config_valgrind)
- usize = isalloc(tsd_tsdn(tsd), ptr, config_prof);
- if (config_stats)
- *tsd_thread_deallocatedp_get(tsd) += usize;
-
- if (likely(!slow_path))
- iqalloc(tsd, ptr, tcache, false);
- else {
- if (config_valgrind && unlikely(in_valgrind))
- rzsize = p2rz(tsd_tsdn(tsd), ptr);
- iqalloc(tsd, ptr, tcache, true);
- JEMALLOC_VALGRIND_FREE(ptr, rzsize);
- }
-}
-
-JEMALLOC_INLINE_C void
-isfree(tsd_t *tsd, void *ptr, size_t usize, tcache_t *tcache, bool slow_path)
-{
- UNUSED size_t rzsize JEMALLOC_CC_SILENCE_INIT(0);
-
- witness_assert_lockless(tsd_tsdn(tsd));
-
- assert(ptr != NULL);
- assert(malloc_initialized() || IS_INITIALIZER);
-
- if (config_prof && opt_prof)
- prof_free(tsd, ptr, usize);
- if (config_stats)
- *tsd_thread_deallocatedp_get(tsd) += usize;
- if (config_valgrind && unlikely(in_valgrind))
- rzsize = p2rz(tsd_tsdn(tsd), ptr);
- isqalloc(tsd, ptr, usize, tcache, slow_path);
- JEMALLOC_VALGRIND_FREE(ptr, rzsize);
-}
-
-JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
-void JEMALLOC_NOTHROW *
-JEMALLOC_ALLOC_SIZE(2)
-je_realloc(void *ptr, size_t size)
-{
- void *ret;
- tsdn_t *tsdn JEMALLOC_CC_SILENCE_INIT(NULL);
- size_t usize JEMALLOC_CC_SILENCE_INIT(0);
- size_t old_usize = 0;
- UNUSED size_t old_rzsize JEMALLOC_CC_SILENCE_INIT(0);
-
- if (unlikely(size == 0)) {
- if (ptr != NULL) {
- tsd_t *tsd;
-
- /* realloc(ptr, 0) is equivalent to free(ptr). */
- UTRACE(ptr, 0, 0);
- tsd = tsd_fetch();
- ifree(tsd, ptr, tcache_get(tsd, false), true);
- return (NULL);
- }
- size = 1;
- }
-
- if (likely(ptr != NULL)) {
- tsd_t *tsd;
-
- assert(malloc_initialized() || IS_INITIALIZER);
- malloc_thread_init();
- tsd = tsd_fetch();
-
- witness_assert_lockless(tsd_tsdn(tsd));
-
- old_usize = isalloc(tsd_tsdn(tsd), ptr, config_prof);
- if (config_valgrind && unlikely(in_valgrind)) {
- old_rzsize = config_prof ? p2rz(tsd_tsdn(tsd), ptr) :
- u2rz(old_usize);
- }
-
- if (config_prof && opt_prof) {
- usize = s2u(size);
- ret = unlikely(usize == 0 || usize > HUGE_MAXCLASS) ?
- NULL : irealloc_prof(tsd, ptr, old_usize, usize);
- } else {
- if (config_stats || (config_valgrind &&
- unlikely(in_valgrind)))
- usize = s2u(size);
- ret = iralloc(tsd, ptr, old_usize, size, 0, false);
- }
- tsdn = tsd_tsdn(tsd);
- } else {
- /* realloc(NULL, size) is equivalent to malloc(size). */
- if (likely(!malloc_slow))
- ret = ialloc_body(size, false, &tsdn, &usize, false);
- else
- ret = ialloc_body(size, false, &tsdn, &usize, true);
- assert(!tsdn_null(tsdn) || ret == NULL);
- }
-
- if (unlikely(ret == NULL)) {
- if (config_xmalloc && unlikely(opt_xmalloc)) {
- malloc_write("<jemalloc>: Error in realloc(): "
- "out of memory\n");
- abort();
- }
- set_errno(ENOMEM);
- }
- if (config_stats && likely(ret != NULL)) {
- tsd_t *tsd;
-
- assert(usize == isalloc(tsdn, ret, config_prof));
- tsd = tsdn_tsd(tsdn);
- *tsd_thread_allocatedp_get(tsd) += usize;
- *tsd_thread_deallocatedp_get(tsd) += old_usize;
- }
- UTRACE(ptr, size, ret);
- JEMALLOC_VALGRIND_REALLOC(true, tsdn, ret, usize, true, ptr, old_usize,
- old_rzsize, true, false);
- witness_assert_lockless(tsdn);
- return (ret);
-}
-
-JEMALLOC_EXPORT void JEMALLOC_NOTHROW
-je_free(void *ptr)
-{
-
- UTRACE(ptr, 0, 0);
- if (likely(ptr != NULL)) {
- tsd_t *tsd = tsd_fetch();
- witness_assert_lockless(tsd_tsdn(tsd));
- if (likely(!malloc_slow))
- ifree(tsd, ptr, tcache_get(tsd, false), false);
- else
- ifree(tsd, ptr, tcache_get(tsd, false), true);
- witness_assert_lockless(tsd_tsdn(tsd));
- }
-}
-
-/*
- * End malloc(3)-compatible functions.
- */
-/******************************************************************************/
-/*
- * Begin non-standard override functions.
- */
-
-#ifdef JEMALLOC_OVERRIDE_MEMALIGN
-JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
-void JEMALLOC_NOTHROW *
-JEMALLOC_ATTR(malloc)
-je_memalign(size_t alignment, size_t size)
-{
- void *ret JEMALLOC_CC_SILENCE_INIT(NULL);
- if (unlikely(imemalign(&ret, alignment, size, 1) != 0))
- ret = NULL;
- return (ret);
-}
-#endif
-
-#ifdef JEMALLOC_OVERRIDE_VALLOC
-JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
-void JEMALLOC_NOTHROW *
-JEMALLOC_ATTR(malloc)
-je_valloc(size_t size)
-{
- void *ret JEMALLOC_CC_SILENCE_INIT(NULL);
- if (unlikely(imemalign(&ret, PAGE, size, 1) != 0))
- ret = NULL;
- return (ret);
-}
-#endif
-
-/*
- * is_malloc(je_malloc) is some macro magic to detect if jemalloc_defs.h has
- * #define je_malloc malloc
- */
-#define malloc_is_malloc 1
-#define is_malloc_(a) malloc_is_ ## a
-#define is_malloc(a) is_malloc_(a)
-
-#if ((is_malloc(je_malloc) == 1) && defined(JEMALLOC_GLIBC_MALLOC_HOOK))
-/*
- * glibc provides the RTLD_DEEPBIND flag for dlopen which can make it possible
- * to inconsistently reference libc's malloc(3)-compatible functions
- * (https://bugzilla.mozilla.org/show_bug.cgi?id=493541).
- *
- * These definitions interpose hooks in glibc. The functions are actually
- * passed an extra argument for the caller return address, which will be
- * ignored.
- */
-JEMALLOC_EXPORT void (*__free_hook)(void *ptr) = je_free;
-JEMALLOC_EXPORT void *(*__malloc_hook)(size_t size) = je_malloc;
-JEMALLOC_EXPORT void *(*__realloc_hook)(void *ptr, size_t size) = je_realloc;
-# ifdef JEMALLOC_GLIBC_MEMALIGN_HOOK
-JEMALLOC_EXPORT void *(*__memalign_hook)(size_t alignment, size_t size) =
- je_memalign;
-# endif
-
-#ifdef CPU_COUNT
-/*
- * To enable static linking with glibc, the libc specific malloc interface must
- * be implemented also, so none of glibc's malloc.o functions are added to the
- * link.
- */
-#define ALIAS(je_fn) __attribute__((alias (#je_fn), used))
-/* To force macro expansion of je_ prefix before stringification. */
-#define PREALIAS(je_fn) ALIAS(je_fn)
-void *__libc_malloc(size_t size) PREALIAS(je_malloc);
-void __libc_free(void* ptr) PREALIAS(je_free);
-void *__libc_realloc(void* ptr, size_t size) PREALIAS(je_realloc);
-void *__libc_calloc(size_t n, size_t size) PREALIAS(je_calloc);
-void *__libc_memalign(size_t align, size_t s) PREALIAS(je_memalign);
-void *__libc_valloc(size_t size) PREALIAS(je_valloc);
-int __posix_memalign(void** r, size_t a, size_t s)
- PREALIAS(je_posix_memalign);
-#undef PREALIAS
-#undef ALIAS
-
-#endif
-
-#endif
-
-/*
- * End non-standard override functions.
- */
-/******************************************************************************/
-/*
- * Begin non-standard functions.
- */
-
-JEMALLOC_ALWAYS_INLINE_C bool
-imallocx_flags_decode(tsd_t *tsd, size_t size, int flags, size_t *usize,
- size_t *alignment, bool *zero, tcache_t **tcache, arena_t **arena)
-{
-
- if ((flags & MALLOCX_LG_ALIGN_MASK) == 0) {
- *alignment = 0;
- *usize = s2u(size);
- } else {
- *alignment = MALLOCX_ALIGN_GET_SPECIFIED(flags);
- *usize = sa2u(size, *alignment);
- }
- if (unlikely(*usize == 0 || *usize > HUGE_MAXCLASS))
- return (true);
- *zero = MALLOCX_ZERO_GET(flags);
- if ((flags & MALLOCX_TCACHE_MASK) != 0) {
- if ((flags & MALLOCX_TCACHE_MASK) == MALLOCX_TCACHE_NONE)
- *tcache = NULL;
- else
- *tcache = tcaches_get(tsd, MALLOCX_TCACHE_GET(flags));
- } else
- *tcache = tcache_get(tsd, true);
- if ((flags & MALLOCX_ARENA_MASK) != 0) {
- unsigned arena_ind = MALLOCX_ARENA_GET(flags);
- *arena = arena_get(tsd_tsdn(tsd), arena_ind, true);
- if (unlikely(*arena == NULL))
- return (true);
- } else
- *arena = NULL;
- return (false);
-}
-
-JEMALLOC_ALWAYS_INLINE_C void *
-imallocx_flags(tsdn_t *tsdn, size_t usize, size_t alignment, bool zero,
- tcache_t *tcache, arena_t *arena, bool slow_path)
-{
- szind_t ind;
-
- if (unlikely(alignment != 0))
- return (ipalloct(tsdn, usize, alignment, zero, tcache, arena));
- ind = size2index(usize);
- assert(ind < NSIZES);
- return (iallocztm(tsdn, usize, ind, zero, tcache, false, arena,
- slow_path));
-}
-
-static void *
-imallocx_prof_sample(tsdn_t *tsdn, size_t usize, size_t alignment, bool zero,
- tcache_t *tcache, arena_t *arena, bool slow_path)
-{
- void *p;
-
- if (usize <= SMALL_MAXCLASS) {
- assert(((alignment == 0) ? s2u(LARGE_MINCLASS) :
- sa2u(LARGE_MINCLASS, alignment)) == LARGE_MINCLASS);
- p = imallocx_flags(tsdn, LARGE_MINCLASS, alignment, zero,
- tcache, arena, slow_path);
- if (p == NULL)
- return (NULL);
- arena_prof_promoted(tsdn, p, usize);
- } else {
- p = imallocx_flags(tsdn, usize, alignment, zero, tcache, arena,
- slow_path);
- }
-
- return (p);
-}
-
-JEMALLOC_ALWAYS_INLINE_C void *
-imallocx_prof(tsd_t *tsd, size_t size, int flags, size_t *usize, bool slow_path)
-{
- void *p;
- size_t alignment;
- bool zero;
- tcache_t *tcache;
- arena_t *arena;
- prof_tctx_t *tctx;
-
- if (unlikely(imallocx_flags_decode(tsd, size, flags, usize, &alignment,
- &zero, &tcache, &arena)))
- return (NULL);
- tctx = prof_alloc_prep(tsd, *usize, prof_active_get_unlocked(), true);
- if (likely((uintptr_t)tctx == (uintptr_t)1U)) {
- p = imallocx_flags(tsd_tsdn(tsd), *usize, alignment, zero,
- tcache, arena, slow_path);
- } else if ((uintptr_t)tctx > (uintptr_t)1U) {
- p = imallocx_prof_sample(tsd_tsdn(tsd), *usize, alignment, zero,
- tcache, arena, slow_path);
- } else
- p = NULL;
- if (unlikely(p == NULL)) {
- prof_alloc_rollback(tsd, tctx, true);
- return (NULL);
- }
- prof_malloc(tsd_tsdn(tsd), p, *usize, tctx);
-
- assert(alignment == 0 || ((uintptr_t)p & (alignment - 1)) == ZU(0));
- return (p);
-}
-
-JEMALLOC_ALWAYS_INLINE_C void *
-imallocx_no_prof(tsd_t *tsd, size_t size, int flags, size_t *usize,
- bool slow_path)
-{
- void *p;
- size_t alignment;
- bool zero;
- tcache_t *tcache;
- arena_t *arena;
-
- if (unlikely(imallocx_flags_decode(tsd, size, flags, usize, &alignment,
- &zero, &tcache, &arena)))
- return (NULL);
- p = imallocx_flags(tsd_tsdn(tsd), *usize, alignment, zero, tcache,
- arena, slow_path);
- assert(alignment == 0 || ((uintptr_t)p & (alignment - 1)) == ZU(0));
- return (p);
-}
-
-/* This function guarantees that *tsdn is non-NULL on success. */
-JEMALLOC_ALWAYS_INLINE_C void *
-imallocx_body(size_t size, int flags, tsdn_t **tsdn, size_t *usize,
- bool slow_path)
-{
- tsd_t *tsd;
-
- if (slow_path && unlikely(malloc_init())) {
- *tsdn = NULL;
- return (NULL);
- }
-
- tsd = tsd_fetch();
- *tsdn = tsd_tsdn(tsd);
- witness_assert_lockless(tsd_tsdn(tsd));
-
- if (likely(flags == 0)) {
- szind_t ind = size2index(size);
- if (unlikely(ind >= NSIZES))
- return (NULL);
- if (config_stats || (config_prof && opt_prof) || (slow_path &&
- config_valgrind && unlikely(in_valgrind))) {
- *usize = index2size(ind);
- assert(*usize > 0 && *usize <= HUGE_MAXCLASS);
- }
-
- if (config_prof && opt_prof) {
- return (ialloc_prof(tsd, *usize, ind, false,
- slow_path));
- }
-
- return (ialloc(tsd, size, ind, false, slow_path));
- }
-
- if (config_prof && opt_prof)
- return (imallocx_prof(tsd, size, flags, usize, slow_path));
-
- return (imallocx_no_prof(tsd, size, flags, usize, slow_path));
-}
-
-JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
-void JEMALLOC_NOTHROW *
-JEMALLOC_ATTR(malloc) JEMALLOC_ALLOC_SIZE(1)
-je_mallocx(size_t size, int flags)
-{
- tsdn_t *tsdn;
- void *p;
- size_t usize;
-
- assert(size != 0);
-
- if (likely(!malloc_slow)) {
- p = imallocx_body(size, flags, &tsdn, &usize, false);
- ialloc_post_check(p, tsdn, usize, "mallocx", false, false);
- } else {
- p = imallocx_body(size, flags, &tsdn, &usize, true);
- ialloc_post_check(p, tsdn, usize, "mallocx", false, true);
- UTRACE(0, size, p);
- JEMALLOC_VALGRIND_MALLOC(p != NULL, tsdn, p, usize,
- MALLOCX_ZERO_GET(flags));
- }
-
- return (p);
-}
-
-static void *
-irallocx_prof_sample(tsd_t *tsd, void *old_ptr, size_t old_usize,
- size_t usize, size_t alignment, bool zero, tcache_t *tcache, arena_t *arena,
- prof_tctx_t *tctx)
-{
- void *p;
-
- if (tctx == NULL)
- return (NULL);
- if (usize <= SMALL_MAXCLASS) {
- p = iralloct(tsd, old_ptr, old_usize, LARGE_MINCLASS, alignment,
- zero, tcache, arena);
- if (p == NULL)
- return (NULL);
- arena_prof_promoted(tsd_tsdn(tsd), p, usize);
- } else {
- p = iralloct(tsd, old_ptr, old_usize, usize, alignment, zero,
- tcache, arena);
- }
-
- return (p);
-}
-
-JEMALLOC_ALWAYS_INLINE_C void *
-irallocx_prof(tsd_t *tsd, void *old_ptr, size_t old_usize, size_t size,
- size_t alignment, size_t *usize, bool zero, tcache_t *tcache,
- arena_t *arena)
-{
- void *p;
- bool prof_active;
- prof_tctx_t *old_tctx, *tctx;
-
- prof_active = prof_active_get_unlocked();
- old_tctx = prof_tctx_get(tsd_tsdn(tsd), old_ptr);
- tctx = prof_alloc_prep(tsd, *usize, prof_active, false);
- if (unlikely((uintptr_t)tctx != (uintptr_t)1U)) {
- p = irallocx_prof_sample(tsd, old_ptr, old_usize, *usize,
- alignment, zero, tcache, arena, tctx);
- } else {
- p = iralloct(tsd, old_ptr, old_usize, size, alignment, zero,
- tcache, arena);
- }
- if (unlikely(p == NULL)) {
- prof_alloc_rollback(tsd, tctx, false);
- return (NULL);
- }
-
- if (p == old_ptr && alignment != 0) {
- /*
- * The allocation did not move, so it is possible that the size
- * class is smaller than would guarantee the requested
- * alignment, and that the alignment constraint was
- * serendipitously satisfied. Additionally, old_usize may not
- * be the same as the current usize because of in-place large
- * reallocation. Therefore, query the actual value of usize.
- */
- *usize = isalloc(tsd_tsdn(tsd), p, config_prof);
- }
- prof_realloc(tsd, p, *usize, tctx, prof_active, false, old_ptr,
- old_usize, old_tctx);
-
- return (p);
-}
-
-JEMALLOC_EXPORT JEMALLOC_ALLOCATOR JEMALLOC_RESTRICT_RETURN
-void JEMALLOC_NOTHROW *
-JEMALLOC_ALLOC_SIZE(2)
-je_rallocx(void *ptr, size_t size, int flags)
-{
- void *p;
- tsd_t *tsd;
- size_t usize;
- size_t old_usize;
- UNUSED size_t old_rzsize JEMALLOC_CC_SILENCE_INIT(0);
- size_t alignment = MALLOCX_ALIGN_GET(flags);
- bool zero = flags & MALLOCX_ZERO;
- arena_t *arena;
- tcache_t *tcache;
-
- assert(ptr != NULL);
- assert(size != 0);
- assert(malloc_initialized() || IS_INITIALIZER);
- malloc_thread_init();
- tsd = tsd_fetch();
- witness_assert_lockless(tsd_tsdn(tsd));
-
- if (unlikely((flags & MALLOCX_ARENA_MASK) != 0)) {
- unsigned arena_ind = MALLOCX_ARENA_GET(flags);
- arena = arena_get(tsd_tsdn(tsd), arena_ind, true);
- if (unlikely(arena == NULL))
- goto label_oom;
- } else
- arena = NULL;
-
- if (unlikely((flags & MALLOCX_TCACHE_MASK) != 0)) {
- if ((flags & MALLOCX_TCACHE_MASK) == MALLOCX_TCACHE_NONE)
- tcache = NULL;
- else
- tcache = tcaches_get(tsd, MALLOCX_TCACHE_GET(flags));
- } else
- tcache = tcache_get(tsd, true);
-
- old_usize = isalloc(tsd_tsdn(tsd), ptr, config_prof);
- if (config_valgrind && unlikely(in_valgrind))
- old_rzsize = u2rz(old_usize);
-
- if (config_prof && opt_prof) {
- usize = (alignment == 0) ? s2u(size) : sa2u(size, alignment);
- if (unlikely(usize == 0 || usize > HUGE_MAXCLASS))
- goto label_oom;
- p = irallocx_prof(tsd, ptr, old_usize, size, alignment, &usize,
- zero, tcache, arena);
- if (unlikely(p == NULL))
- goto label_oom;
- } else {
- p = iralloct(tsd, ptr, old_usize, size, alignment, zero,
- tcache, arena);
- if (unlikely(p == NULL))
- goto label_oom;
- if (config_stats || (config_valgrind && unlikely(in_valgrind)))
- usize = isalloc(tsd_tsdn(tsd), p, config_prof);
- }
- assert(alignment == 0 || ((uintptr_t)p & (alignment - 1)) == ZU(0));
-
- if (config_stats) {
- *tsd_thread_allocatedp_get(tsd) += usize;
- *tsd_thread_deallocatedp_get(tsd) += old_usize;
- }
- UTRACE(ptr, size, p);
- JEMALLOC_VALGRIND_REALLOC(true, tsd_tsdn(tsd), p, usize, false, ptr,
- old_usize, old_rzsize, false, zero);
- witness_assert_lockless(tsd_tsdn(tsd));
- return (p);
-label_oom:
- if (config_xmalloc && unlikely(opt_xmalloc)) {
- malloc_write("<jemalloc>: Error in rallocx(): out of memory\n");
- abort();
- }
- UTRACE(ptr, size, 0);
- witness_assert_lockless(tsd_tsdn(tsd));
- return (NULL);
-}
-
-JEMALLOC_ALWAYS_INLINE_C size_t
-ixallocx_helper(tsdn_t *tsdn, void *ptr, size_t old_usize, size_t size,
- size_t extra, size_t alignment, bool zero)
-{
- size_t usize;
-
- if (ixalloc(tsdn, ptr, old_usize, size, extra, alignment, zero))
- return (old_usize);
- usize = isalloc(tsdn, ptr, config_prof);
-
- return (usize);
-}
-
-static size_t
-ixallocx_prof_sample(tsdn_t *tsdn, void *ptr, size_t old_usize, size_t size,
- size_t extra, size_t alignment, bool zero, prof_tctx_t *tctx)
-{
- size_t usize;
-
- if (tctx == NULL)
- return (old_usize);
- usize = ixallocx_helper(tsdn, ptr, old_usize, size, extra, alignment,
- zero);
-
- return (usize);
-}
-
-JEMALLOC_ALWAYS_INLINE_C size_t
-ixallocx_prof(tsd_t *tsd, void *ptr, size_t old_usize, size_t size,
- size_t extra, size_t alignment, bool zero)
-{
- size_t usize_max, usize;
- bool prof_active;
- prof_tctx_t *old_tctx, *tctx;
-
- prof_active = prof_active_get_unlocked();
- old_tctx = prof_tctx_get(tsd_tsdn(tsd), ptr);
- /*
- * usize isn't knowable before ixalloc() returns when extra is non-zero.
- * Therefore, compute its maximum possible value and use that in
- * prof_alloc_prep() to decide whether to capture a backtrace.
- * prof_realloc() will use the actual usize to decide whether to sample.
- */
- if (alignment == 0) {
- usize_max = s2u(size+extra);
- assert(usize_max > 0 && usize_max <= HUGE_MAXCLASS);
- } else {
- usize_max = sa2u(size+extra, alignment);
- if (unlikely(usize_max == 0 || usize_max > HUGE_MAXCLASS)) {
- /*
- * usize_max is out of range, and chances are that
- * allocation will fail, but use the maximum possible
- * value and carry on with prof_alloc_prep(), just in
- * case allocation succeeds.
- */
- usize_max = HUGE_MAXCLASS;
- }
- }
- tctx = prof_alloc_prep(tsd, usize_max, prof_active, false);
-
- if (unlikely((uintptr_t)tctx != (uintptr_t)1U)) {
- usize = ixallocx_prof_sample(tsd_tsdn(tsd), ptr, old_usize,
- size, extra, alignment, zero, tctx);
- } else {
- usize = ixallocx_helper(tsd_tsdn(tsd), ptr, old_usize, size,
- extra, alignment, zero);
- }
- if (usize == old_usize) {
- prof_alloc_rollback(tsd, tctx, false);
- return (usize);
- }
- prof_realloc(tsd, ptr, usize, tctx, prof_active, false, ptr, old_usize,
- old_tctx);
-
- return (usize);
-}
-
-JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW
-je_xallocx(void *ptr, size_t size, size_t extra, int flags)
-{
- tsd_t *tsd;
- size_t usize, old_usize;
- UNUSED size_t old_rzsize JEMALLOC_CC_SILENCE_INIT(0);
- size_t alignment = MALLOCX_ALIGN_GET(flags);
- bool zero = flags & MALLOCX_ZERO;
-
- assert(ptr != NULL);
- assert(size != 0);
- assert(SIZE_T_MAX - size >= extra);
- assert(malloc_initialized() || IS_INITIALIZER);
- malloc_thread_init();
- tsd = tsd_fetch();
- witness_assert_lockless(tsd_tsdn(tsd));
-
- old_usize = isalloc(tsd_tsdn(tsd), ptr, config_prof);
-
- /*
- * The API explicitly absolves itself of protecting against (size +
- * extra) numerical overflow, but we may need to clamp extra to avoid
- * exceeding HUGE_MAXCLASS.
- *
- * Ordinarily, size limit checking is handled deeper down, but here we
- * have to check as part of (size + extra) clamping, since we need the
- * clamped value in the above helper functions.
- */
- if (unlikely(size > HUGE_MAXCLASS)) {
- usize = old_usize;
- goto label_not_resized;
- }
- if (unlikely(HUGE_MAXCLASS - size < extra))
- extra = HUGE_MAXCLASS - size;
-
- if (config_valgrind && unlikely(in_valgrind))
- old_rzsize = u2rz(old_usize);
-
- if (config_prof && opt_prof) {
- usize = ixallocx_prof(tsd, ptr, old_usize, size, extra,
- alignment, zero);
- } else {
- usize = ixallocx_helper(tsd_tsdn(tsd), ptr, old_usize, size,
- extra, alignment, zero);
- }
- if (unlikely(usize == old_usize))
- goto label_not_resized;
-
- if (config_stats) {
- *tsd_thread_allocatedp_get(tsd) += usize;
- *tsd_thread_deallocatedp_get(tsd) += old_usize;
- }
- JEMALLOC_VALGRIND_REALLOC(false, tsd_tsdn(tsd), ptr, usize, false, ptr,
- old_usize, old_rzsize, false, zero);
-label_not_resized:
- UTRACE(ptr, size, ptr);
- witness_assert_lockless(tsd_tsdn(tsd));
- return (usize);
-}
-
-JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW
-JEMALLOC_ATTR(pure)
-je_sallocx(const void *ptr, int flags)
-{
- size_t usize;
- tsdn_t *tsdn;
-
- assert(malloc_initialized() || IS_INITIALIZER);
- malloc_thread_init();
-
- tsdn = tsdn_fetch();
- witness_assert_lockless(tsdn);
-
- if (config_ivsalloc)
- usize = ivsalloc(tsdn, ptr, config_prof);
- else
- usize = isalloc(tsdn, ptr, config_prof);
-
- witness_assert_lockless(tsdn);
- return (usize);
-}
-
-JEMALLOC_EXPORT void JEMALLOC_NOTHROW
-je_dallocx(void *ptr, int flags)
-{
- tsd_t *tsd;
- tcache_t *tcache;
-
- assert(ptr != NULL);
- assert(malloc_initialized() || IS_INITIALIZER);
-
- tsd = tsd_fetch();
- witness_assert_lockless(tsd_tsdn(tsd));
- if (unlikely((flags & MALLOCX_TCACHE_MASK) != 0)) {
- if ((flags & MALLOCX_TCACHE_MASK) == MALLOCX_TCACHE_NONE)
- tcache = NULL;
- else
- tcache = tcaches_get(tsd, MALLOCX_TCACHE_GET(flags));
- } else
- tcache = tcache_get(tsd, false);
-
- UTRACE(ptr, 0, 0);
- if (likely(!malloc_slow))
- ifree(tsd, ptr, tcache, false);
- else
- ifree(tsd, ptr, tcache, true);
- witness_assert_lockless(tsd_tsdn(tsd));
-}
-
-JEMALLOC_ALWAYS_INLINE_C size_t
-inallocx(tsdn_t *tsdn, size_t size, int flags)
-{
- size_t usize;
-
- witness_assert_lockless(tsdn);
-
- if (likely((flags & MALLOCX_LG_ALIGN_MASK) == 0))
- usize = s2u(size);
- else
- usize = sa2u(size, MALLOCX_ALIGN_GET_SPECIFIED(flags));
- witness_assert_lockless(tsdn);
- return (usize);
-}
-
-JEMALLOC_EXPORT void JEMALLOC_NOTHROW
-je_sdallocx(void *ptr, size_t size, int flags)
-{
- tsd_t *tsd;
- tcache_t *tcache;
- size_t usize;
-
- assert(ptr != NULL);
- assert(malloc_initialized() || IS_INITIALIZER);
- tsd = tsd_fetch();
- usize = inallocx(tsd_tsdn(tsd), size, flags);
- assert(usize == isalloc(tsd_tsdn(tsd), ptr, config_prof));
-
- witness_assert_lockless(tsd_tsdn(tsd));
- if (unlikely((flags & MALLOCX_TCACHE_MASK) != 0)) {
- if ((flags & MALLOCX_TCACHE_MASK) == MALLOCX_TCACHE_NONE)
- tcache = NULL;
- else
- tcache = tcaches_get(tsd, MALLOCX_TCACHE_GET(flags));
- } else
- tcache = tcache_get(tsd, false);
-
- UTRACE(ptr, 0, 0);
- if (likely(!malloc_slow))
- isfree(tsd, ptr, usize, tcache, false);
- else
- isfree(tsd, ptr, usize, tcache, true);
- witness_assert_lockless(tsd_tsdn(tsd));
-}
-
-JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW
-JEMALLOC_ATTR(pure)
-je_nallocx(size_t size, int flags)
-{
- size_t usize;
- tsdn_t *tsdn;
-
- assert(size != 0);
-
- if (unlikely(malloc_init()))
- return (0);
-
- tsdn = tsdn_fetch();
- witness_assert_lockless(tsdn);
-
- usize = inallocx(tsdn, size, flags);
- if (unlikely(usize > HUGE_MAXCLASS))
- return (0);
-
- witness_assert_lockless(tsdn);
- return (usize);
-}
-
-JEMALLOC_EXPORT int JEMALLOC_NOTHROW
-je_mallctl(const char *name, void *oldp, size_t *oldlenp, void *newp,
- size_t newlen)
-{
- int ret;
- tsd_t *tsd;
-
- if (unlikely(malloc_init()))
- return (EAGAIN);
-
- tsd = tsd_fetch();
- witness_assert_lockless(tsd_tsdn(tsd));
- ret = ctl_byname(tsd, name, oldp, oldlenp, newp, newlen);
- witness_assert_lockless(tsd_tsdn(tsd));
- return (ret);
-}
-
-JEMALLOC_EXPORT int JEMALLOC_NOTHROW
-je_mallctlnametomib(const char *name, size_t *mibp, size_t *miblenp)
-{
- int ret;
- tsdn_t *tsdn;
-
- if (unlikely(malloc_init()))
- return (EAGAIN);
-
- tsdn = tsdn_fetch();
- witness_assert_lockless(tsdn);
- ret = ctl_nametomib(tsdn, name, mibp, miblenp);
- witness_assert_lockless(tsdn);
- return (ret);
-}
-
-JEMALLOC_EXPORT int JEMALLOC_NOTHROW
-je_mallctlbymib(const size_t *mib, size_t miblen, void *oldp, size_t *oldlenp,
- void *newp, size_t newlen)
-{
- int ret;
- tsd_t *tsd;
-
- if (unlikely(malloc_init()))
- return (EAGAIN);
-
- tsd = tsd_fetch();
- witness_assert_lockless(tsd_tsdn(tsd));
- ret = ctl_bymib(tsd, mib, miblen, oldp, oldlenp, newp, newlen);
- witness_assert_lockless(tsd_tsdn(tsd));
- return (ret);
-}
-
-JEMALLOC_EXPORT void JEMALLOC_NOTHROW
-je_malloc_stats_print(void (*write_cb)(void *, const char *), void *cbopaque,
- const char *opts)
-{
- tsdn_t *tsdn;
-
- tsdn = tsdn_fetch();
- witness_assert_lockless(tsdn);
- stats_print(write_cb, cbopaque, opts);
- witness_assert_lockless(tsdn);
-}
-
-JEMALLOC_EXPORT size_t JEMALLOC_NOTHROW
-je_malloc_usable_size(JEMALLOC_USABLE_SIZE_CONST void *ptr)
-{
- size_t ret;
- tsdn_t *tsdn;
-
- assert(malloc_initialized() || IS_INITIALIZER);
- malloc_thread_init();
-
- tsdn = tsdn_fetch();
- witness_assert_lockless(tsdn);
-
- if (config_ivsalloc)
- ret = ivsalloc(tsdn, ptr, config_prof);
- else
- ret = (ptr == NULL) ? 0 : isalloc(tsdn, ptr, config_prof);
-
- witness_assert_lockless(tsdn);
- return (ret);
-}
-
-/*
- * End non-standard functions.
- */
-/******************************************************************************/
-/*
- * The following functions are used by threading libraries for protection of
- * malloc during fork().
- */
-
-/*
- * If an application creates a thread before doing any allocation in the main
- * thread, then calls fork(2) in the main thread followed by memory allocation
- * in the child process, a race can occur that results in deadlock within the
- * child: the main thread may have forked while the created thread had
- * partially initialized the allocator. Ordinarily jemalloc prevents
- * fork/malloc races via the following functions it registers during
- * initialization using pthread_atfork(), but of course that does no good if
- * the allocator isn't fully initialized at fork time. The following library
- * constructor is a partial solution to this problem. It may still be possible
- * to trigger the deadlock described above, but doing so would involve forking
- * via a library constructor that runs before jemalloc's runs.
- */
-#ifndef JEMALLOC_JET
-JEMALLOC_ATTR(constructor)
-static void
-jemalloc_constructor(void)
-{
-
- malloc_init();
-}
-#endif
-
-#ifndef JEMALLOC_MUTEX_INIT_CB
-void
-jemalloc_prefork(void)
-#else
-JEMALLOC_EXPORT void
-_malloc_prefork(void)
-#endif
-{
- tsd_t *tsd;
- unsigned i, j, narenas;
- arena_t *arena;
-
-#ifdef JEMALLOC_MUTEX_INIT_CB
- if (!malloc_initialized())
- return;
-#endif
- assert(malloc_initialized());
-
- tsd = tsd_fetch();
-
- narenas = narenas_total_get();
-
- witness_prefork(tsd);
- /* Acquire all mutexes in a safe order. */
- ctl_prefork(tsd_tsdn(tsd));
- malloc_mutex_prefork(tsd_tsdn(tsd), &arenas_lock);
- prof_prefork0(tsd_tsdn(tsd));
- for (i = 0; i < 3; i++) {
- for (j = 0; j < narenas; j++) {
- if ((arena = arena_get(tsd_tsdn(tsd), j, false)) !=
- NULL) {
- switch (i) {
- case 0:
- arena_prefork0(tsd_tsdn(tsd), arena);
- break;
- case 1:
- arena_prefork1(tsd_tsdn(tsd), arena);
- break;
- case 2:
- arena_prefork2(tsd_tsdn(tsd), arena);
- break;
- default: not_reached();
- }
- }
- }
- }
- base_prefork(tsd_tsdn(tsd));
- for (i = 0; i < narenas; i++) {
- if ((arena = arena_get(tsd_tsdn(tsd), i, false)) != NULL)
- arena_prefork3(tsd_tsdn(tsd), arena);
- }
- prof_prefork1(tsd_tsdn(tsd));
-}
-
-#ifndef JEMALLOC_MUTEX_INIT_CB
-void
-jemalloc_postfork_parent(void)
-#else
-JEMALLOC_EXPORT void
-_malloc_postfork(void)
-#endif
-{
- tsd_t *tsd;
- unsigned i, narenas;
-
-#ifdef JEMALLOC_MUTEX_INIT_CB
- if (!malloc_initialized())
- return;
-#endif
- assert(malloc_initialized());
-
- tsd = tsd_fetch();
-
- witness_postfork_parent(tsd);
- /* Release all mutexes, now that fork() has completed. */
- base_postfork_parent(tsd_tsdn(tsd));
- for (i = 0, narenas = narenas_total_get(); i < narenas; i++) {
- arena_t *arena;
-
- if ((arena = arena_get(tsd_tsdn(tsd), i, false)) != NULL)
- arena_postfork_parent(tsd_tsdn(tsd), arena);
- }
- prof_postfork_parent(tsd_tsdn(tsd));
- malloc_mutex_postfork_parent(tsd_tsdn(tsd), &arenas_lock);
- ctl_postfork_parent(tsd_tsdn(tsd));
-}
-
-void
-jemalloc_postfork_child(void)
-{
- tsd_t *tsd;
- unsigned i, narenas;
-
- assert(malloc_initialized());
-
- tsd = tsd_fetch();
-
- witness_postfork_child(tsd);
- /* Release all mutexes, now that fork() has completed. */
- base_postfork_child(tsd_tsdn(tsd));
- for (i = 0, narenas = narenas_total_get(); i < narenas; i++) {
- arena_t *arena;
-
- if ((arena = arena_get(tsd_tsdn(tsd), i, false)) != NULL)
- arena_postfork_child(tsd_tsdn(tsd), arena);
- }
- prof_postfork_child(tsd_tsdn(tsd));
- malloc_mutex_postfork_child(tsd_tsdn(tsd), &arenas_lock);
- ctl_postfork_child(tsd_tsdn(tsd));
-}
-
-/******************************************************************************/
diff --git a/memory/jemalloc/src/src/mb.c b/memory/jemalloc/src/src/mb.c
deleted file mode 100644
index dc2c0a256f..0000000000
--- a/memory/jemalloc/src/src/mb.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define JEMALLOC_MB_C_
-#include "jemalloc/internal/jemalloc_internal.h"
diff --git a/memory/jemalloc/src/src/mutex.c b/memory/jemalloc/src/src/mutex.c
deleted file mode 100644
index 6333e73d60..0000000000
--- a/memory/jemalloc/src/src/mutex.c
+++ /dev/null
@@ -1,158 +0,0 @@
-#define JEMALLOC_MUTEX_C_
-#include "jemalloc/internal/jemalloc_internal.h"
-
-#if defined(JEMALLOC_LAZY_LOCK) && !defined(_WIN32)
-#include <dlfcn.h>
-#endif
-
-#ifndef _CRT_SPINCOUNT
-#define _CRT_SPINCOUNT 4000
-#endif
-
-/******************************************************************************/
-/* Data. */
-
-#ifdef JEMALLOC_LAZY_LOCK
-bool isthreaded = false;
-#endif
-#ifdef JEMALLOC_MUTEX_INIT_CB
-static bool postpone_init = true;
-static malloc_mutex_t *postponed_mutexes = NULL;
-#endif
-
-#if defined(JEMALLOC_LAZY_LOCK) && !defined(_WIN32)
-static void pthread_create_once(void);
-#endif
-
-/******************************************************************************/
-/*
- * We intercept pthread_create() calls in order to toggle isthreaded if the
- * process goes multi-threaded.
- */
-
-#if defined(JEMALLOC_LAZY_LOCK) && !defined(_WIN32)
-static int (*pthread_create_fptr)(pthread_t *__restrict, const pthread_attr_t *,
- void *(*)(void *), void *__restrict);
-
-static void
-pthread_create_once(void)
-{
-
- pthread_create_fptr = dlsym(RTLD_NEXT, "pthread_create");
- if (pthread_create_fptr == NULL) {
- malloc_write("<jemalloc>: Error in dlsym(RTLD_NEXT, "
- "\"pthread_create\")\n");
- abort();
- }
-
- isthreaded = true;
-}
-
-JEMALLOC_EXPORT int
-pthread_create(pthread_t *__restrict thread,
- const pthread_attr_t *__restrict attr, void *(*start_routine)(void *),
- void *__restrict arg)
-{
- static pthread_once_t once_control = PTHREAD_ONCE_INIT;
-
- pthread_once(&once_control, pthread_create_once);
-
- return (pthread_create_fptr(thread, attr, start_routine, arg));
-}
-#endif
-
-/******************************************************************************/
-
-#ifdef JEMALLOC_MUTEX_INIT_CB
-JEMALLOC_EXPORT int _pthread_mutex_init_calloc_cb(pthread_mutex_t *mutex,
- void *(calloc_cb)(size_t, size_t));
-#endif
-
-bool
-malloc_mutex_init(malloc_mutex_t *mutex, const char *name, witness_rank_t rank)
-{
-
-#ifdef _WIN32
-# if _WIN32_WINNT >= 0x0600
- InitializeSRWLock(&mutex->lock);
-# else
- if (!InitializeCriticalSectionAndSpinCount(&mutex->lock,
- _CRT_SPINCOUNT))
- return (true);
-# endif
-#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
- mutex->lock = OS_UNFAIR_LOCK_INIT;
-#elif (defined(JEMALLOC_OSSPIN))
- mutex->lock = 0;
-#elif (defined(JEMALLOC_MUTEX_INIT_CB))
- if (postpone_init) {
- mutex->postponed_next = postponed_mutexes;
- postponed_mutexes = mutex;
- } else {
- if (_pthread_mutex_init_calloc_cb(&mutex->lock,
- bootstrap_calloc) != 0)
- return (true);
- }
-#else
- pthread_mutexattr_t attr;
-
- if (pthread_mutexattr_init(&attr) != 0)
- return (true);
- pthread_mutexattr_settype(&attr, MALLOC_MUTEX_TYPE);
- if (pthread_mutex_init(&mutex->lock, &attr) != 0) {
- pthread_mutexattr_destroy(&attr);
- return (true);
- }
- pthread_mutexattr_destroy(&attr);
-#endif
- if (config_debug)
- witness_init(&mutex->witness, name, rank, NULL);
- return (false);
-}
-
-void
-malloc_mutex_prefork(tsdn_t *tsdn, malloc_mutex_t *mutex)
-{
-
- malloc_mutex_lock(tsdn, mutex);
-}
-
-void
-malloc_mutex_postfork_parent(tsdn_t *tsdn, malloc_mutex_t *mutex)
-{
-
- malloc_mutex_unlock(tsdn, mutex);
-}
-
-void
-malloc_mutex_postfork_child(tsdn_t *tsdn, malloc_mutex_t *mutex)
-{
-
-#ifdef JEMALLOC_MUTEX_INIT_CB
- malloc_mutex_unlock(tsdn, mutex);
-#else
- if (malloc_mutex_init(mutex, mutex->witness.name,
- mutex->witness.rank)) {
- malloc_printf("<jemalloc>: Error re-initializing mutex in "
- "child\n");
- if (opt_abort)
- abort();
- }
-#endif
-}
-
-bool
-malloc_mutex_boot(void)
-{
-
-#ifdef JEMALLOC_MUTEX_INIT_CB
- postpone_init = false;
- while (postponed_mutexes != NULL) {
- if (_pthread_mutex_init_calloc_cb(&postponed_mutexes->lock,
- bootstrap_calloc) != 0)
- return (true);
- postponed_mutexes = postponed_mutexes->postponed_next;
- }
-#endif
- return (false);
-}
diff --git a/memory/jemalloc/src/src/nstime.c b/memory/jemalloc/src/src/nstime.c
deleted file mode 100644
index 0948e29faf..0000000000
--- a/memory/jemalloc/src/src/nstime.c
+++ /dev/null
@@ -1,194 +0,0 @@
-#include "jemalloc/internal/jemalloc_internal.h"
-
-#define BILLION UINT64_C(1000000000)
-
-void
-nstime_init(nstime_t *time, uint64_t ns)
-{
-
- time->ns = ns;
-}
-
-void
-nstime_init2(nstime_t *time, uint64_t sec, uint64_t nsec)
-{
-
- time->ns = sec * BILLION + nsec;
-}
-
-uint64_t
-nstime_ns(const nstime_t *time)
-{
-
- return (time->ns);
-}
-
-uint64_t
-nstime_sec(const nstime_t *time)
-{
-
- return (time->ns / BILLION);
-}
-
-uint64_t
-nstime_nsec(const nstime_t *time)
-{
-
- return (time->ns % BILLION);
-}
-
-void
-nstime_copy(nstime_t *time, const nstime_t *source)
-{
-
- *time = *source;
-}
-
-int
-nstime_compare(const nstime_t *a, const nstime_t *b)
-{
-
- return ((a->ns > b->ns) - (a->ns < b->ns));
-}
-
-void
-nstime_add(nstime_t *time, const nstime_t *addend)
-{
-
- assert(UINT64_MAX - time->ns >= addend->ns);
-
- time->ns += addend->ns;
-}
-
-void
-nstime_subtract(nstime_t *time, const nstime_t *subtrahend)
-{
-
- assert(nstime_compare(time, subtrahend) >= 0);
-
- time->ns -= subtrahend->ns;
-}
-
-void
-nstime_imultiply(nstime_t *time, uint64_t multiplier)
-{
-
- assert((((time->ns | multiplier) & (UINT64_MAX << (sizeof(uint64_t) <<
- 2))) == 0) || ((time->ns * multiplier) / multiplier == time->ns));
-
- time->ns *= multiplier;
-}
-
-void
-nstime_idivide(nstime_t *time, uint64_t divisor)
-{
-
- assert(divisor != 0);
-
- time->ns /= divisor;
-}
-
-uint64_t
-nstime_divide(const nstime_t *time, const nstime_t *divisor)
-{
-
- assert(divisor->ns != 0);
-
- return (time->ns / divisor->ns);
-}
-
-#ifdef _WIN32
-# define NSTIME_MONOTONIC true
-static void
-nstime_get(nstime_t *time)
-{
- FILETIME ft;
- uint64_t ticks_100ns;
-
- GetSystemTimeAsFileTime(&ft);
- ticks_100ns = (((uint64_t)ft.dwHighDateTime) << 32) | ft.dwLowDateTime;
-
- nstime_init(time, ticks_100ns * 100);
-}
-#elif JEMALLOC_HAVE_CLOCK_MONOTONIC_COARSE
-# define NSTIME_MONOTONIC true
-static void
-nstime_get(nstime_t *time)
-{
- struct timespec ts;
-
- clock_gettime(CLOCK_MONOTONIC_COARSE, &ts);
- nstime_init2(time, ts.tv_sec, ts.tv_nsec);
-}
-#elif JEMALLOC_HAVE_CLOCK_MONOTONIC
-# define NSTIME_MONOTONIC true
-static void
-nstime_get(nstime_t *time)
-{
- struct timespec ts;
-
- clock_gettime(CLOCK_MONOTONIC, &ts);
- nstime_init2(time, ts.tv_sec, ts.tv_nsec);
-}
-#elif JEMALLOC_HAVE_MACH_ABSOLUTE_TIME
-# define NSTIME_MONOTONIC true
-static void
-nstime_get(nstime_t *time)
-{
-
- nstime_init(time, mach_absolute_time());
-}
-#else
-# define NSTIME_MONOTONIC false
-static void
-nstime_get(nstime_t *time)
-{
- struct timeval tv;
-
- gettimeofday(&tv, NULL);
- nstime_init2(time, tv.tv_sec, tv.tv_usec * 1000);
-}
-#endif
-
-#ifdef JEMALLOC_JET
-#undef nstime_monotonic
-#define nstime_monotonic JEMALLOC_N(n_nstime_monotonic)
-#endif
-bool
-nstime_monotonic(void)
-{
-
- return (NSTIME_MONOTONIC);
-#undef NSTIME_MONOTONIC
-}
-#ifdef JEMALLOC_JET
-#undef nstime_monotonic
-#define nstime_monotonic JEMALLOC_N(nstime_monotonic)
-nstime_monotonic_t *nstime_monotonic = JEMALLOC_N(n_nstime_monotonic);
-#endif
-
-#ifdef JEMALLOC_JET
-#undef nstime_update
-#define nstime_update JEMALLOC_N(n_nstime_update)
-#endif
-bool
-nstime_update(nstime_t *time)
-{
- nstime_t old_time;
-
- nstime_copy(&old_time, time);
- nstime_get(time);
-
- /* Handle non-monotonic clocks. */
- if (unlikely(nstime_compare(&old_time, time) > 0)) {
- nstime_copy(time, &old_time);
- return (true);
- }
-
- return (false);
-}
-#ifdef JEMALLOC_JET
-#undef nstime_update
-#define nstime_update JEMALLOC_N(nstime_update)
-nstime_update_t *nstime_update = JEMALLOC_N(n_nstime_update);
-#endif
diff --git a/memory/jemalloc/src/src/pages.c b/memory/jemalloc/src/src/pages.c
deleted file mode 100644
index 647952ac3e..0000000000
--- a/memory/jemalloc/src/src/pages.c
+++ /dev/null
@@ -1,273 +0,0 @@
-#define JEMALLOC_PAGES_C_
-#include "jemalloc/internal/jemalloc_internal.h"
-
-#ifdef JEMALLOC_SYSCTL_VM_OVERCOMMIT
-#include <sys/sysctl.h>
-#endif
-
-/******************************************************************************/
-/* Data. */
-
-#ifndef _WIN32
-# define PAGES_PROT_COMMIT (PROT_READ | PROT_WRITE)
-# define PAGES_PROT_DECOMMIT (PROT_NONE)
-static int mmap_flags;
-#endif
-static bool os_overcommits;
-
-/******************************************************************************/
-
-void *
-pages_map(void *addr, size_t size, bool *commit)
-{
- void *ret;
-
- assert(size != 0);
-
- if (os_overcommits)
- *commit = true;
-
-#ifdef _WIN32
- /*
- * If VirtualAlloc can't allocate at the given address when one is
- * given, it fails and returns NULL.
- */
- ret = VirtualAlloc(addr, size, MEM_RESERVE | (*commit ? MEM_COMMIT : 0),
- PAGE_READWRITE);
-#else
- /*
- * We don't use MAP_FIXED here, because it can cause the *replacement*
- * of existing mappings, and we only want to create new mappings.
- */
- {
- int prot = *commit ? PAGES_PROT_COMMIT : PAGES_PROT_DECOMMIT;
-
- ret = mmap(addr, size, prot, mmap_flags, -1, 0);
- }
- assert(ret != NULL);
-
- if (ret == MAP_FAILED)
- ret = NULL;
- else if (addr != NULL && ret != addr) {
- /*
- * We succeeded in mapping memory, but not in the right place.
- */
- pages_unmap(ret, size);
- ret = NULL;
- }
-#endif
- assert(ret == NULL || (addr == NULL && ret != addr)
- || (addr != NULL && ret == addr));
- return (ret);
-}
-
-void
-pages_unmap(void *addr, size_t size)
-{
-
-#ifdef _WIN32
- if (VirtualFree(addr, 0, MEM_RELEASE) == 0)
-#else
- if (munmap(addr, size) == -1)
-#endif
- {
- char buf[BUFERROR_BUF];
-
- buferror(get_errno(), buf, sizeof(buf));
- malloc_printf("<jemalloc>: Error in "
-#ifdef _WIN32
- "VirtualFree"
-#else
- "munmap"
-#endif
- "(): %s\n", buf);
- if (opt_abort)
- abort();
- }
-}
-
-void *
-pages_trim(void *addr, size_t alloc_size, size_t leadsize, size_t size,
- bool *commit)
-{
- void *ret = (void *)((uintptr_t)addr + leadsize);
-
- assert(alloc_size >= leadsize + size);
-#ifdef _WIN32
- {
- void *new_addr;
-
- pages_unmap(addr, alloc_size);
- new_addr = pages_map(ret, size, commit);
- if (new_addr == ret)
- return (ret);
- if (new_addr)
- pages_unmap(new_addr, size);
- return (NULL);
- }
-#else
- {
- size_t trailsize = alloc_size - leadsize - size;
-
- if (leadsize != 0)
- pages_unmap(addr, leadsize);
- if (trailsize != 0)
- pages_unmap((void *)((uintptr_t)ret + size), trailsize);
- return (ret);
- }
-#endif
-}
-
-static bool
-pages_commit_impl(void *addr, size_t size, bool commit)
-{
-
- if (os_overcommits)
- return (true);
-
-#ifdef _WIN32
- return (commit ? (addr != VirtualAlloc(addr, size, MEM_COMMIT,
- PAGE_READWRITE)) : (!VirtualFree(addr, size, MEM_DECOMMIT)));
-#else
- {
- int prot = commit ? PAGES_PROT_COMMIT : PAGES_PROT_DECOMMIT;
- void *result = mmap(addr, size, prot, mmap_flags | MAP_FIXED,
- -1, 0);
- if (result == MAP_FAILED)
- return (true);
- if (result != addr) {
- /*
- * We succeeded in mapping memory, but not in the right
- * place.
- */
- pages_unmap(result, size);
- return (true);
- }
- return (false);
- }
-#endif
-}
-
-bool
-pages_commit(void *addr, size_t size)
-{
-
- return (pages_commit_impl(addr, size, true));
-}
-
-bool
-pages_decommit(void *addr, size_t size)
-{
-
- return (pages_commit_impl(addr, size, false));
-}
-
-bool
-pages_purge(void *addr, size_t size)
-{
- bool unzeroed;
-
-#ifdef _WIN32
- VirtualAlloc(addr, size, MEM_RESET, PAGE_READWRITE);
- unzeroed = true;
-#elif defined(JEMALLOC_HAVE_MADVISE)
-# ifdef JEMALLOC_PURGE_MADVISE_DONTNEED
-# define JEMALLOC_MADV_PURGE MADV_DONTNEED
-# define JEMALLOC_MADV_ZEROS true
-# elif defined(JEMALLOC_PURGE_MADVISE_FREE)
-# define JEMALLOC_MADV_PURGE MADV_FREE
-# define JEMALLOC_MADV_ZEROS false
-# else
-# error "No madvise(2) flag defined for purging unused dirty pages."
-# endif
- int err = madvise(addr, size, JEMALLOC_MADV_PURGE);
- unzeroed = (!JEMALLOC_MADV_ZEROS || err != 0);
-# undef JEMALLOC_MADV_PURGE
-# undef JEMALLOC_MADV_ZEROS
-#else
- /* Last resort no-op. */
- unzeroed = true;
-#endif
- return (unzeroed);
-}
-
-#ifdef JEMALLOC_SYSCTL_VM_OVERCOMMIT
-static bool
-os_overcommits_sysctl(void)
-{
- int vm_overcommit;
- size_t sz;
-
- sz = sizeof(vm_overcommit);
- if (sysctlbyname("vm.overcommit", &vm_overcommit, &sz, NULL, 0) != 0)
- return (false); /* Error. */
-
- return ((vm_overcommit & 0x3) == 0);
-}
-#endif
-
-#ifdef JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY
-/*
- * Use syscall(2) rather than {open,read,close}(2) when possible to avoid
- * reentry during bootstrapping if another library has interposed system call
- * wrappers.
- */
-static bool
-os_overcommits_proc(void)
-{
- int fd;
- char buf[1];
- ssize_t nread;
-
-#if defined(JEMALLOC_HAVE_SYSCALL) && defined(SYS_open)
- fd = (int)syscall(SYS_open, "/proc/sys/vm/overcommit_memory", O_RDONLY);
-#else
- fd = open("/proc/sys/vm/overcommit_memory", O_RDONLY);
-#endif
- if (fd == -1)
- return (false); /* Error. */
-
-#if defined(JEMALLOC_HAVE_SYSCALL) && defined(SYS_read)
- nread = (ssize_t)syscall(SYS_read, fd, &buf, sizeof(buf));
-#else
- nread = read(fd, &buf, sizeof(buf));
-#endif
-
-#if defined(JEMALLOC_HAVE_SYSCALL) && defined(SYS_close)
- syscall(SYS_close, fd);
-#else
- close(fd);
-#endif
-
- if (nread < 1)
- return (false); /* Error. */
- /*
- * /proc/sys/vm/overcommit_memory meanings:
- * 0: Heuristic overcommit.
- * 1: Always overcommit.
- * 2: Never overcommit.
- */
- return (buf[0] == '0' || buf[0] == '1');
-}
-#endif
-
-void
-pages_boot(void)
-{
-
-#ifndef _WIN32
- mmap_flags = MAP_PRIVATE | MAP_ANON;
-#endif
-
-#ifdef JEMALLOC_SYSCTL_VM_OVERCOMMIT
- os_overcommits = os_overcommits_sysctl();
-#elif defined(JEMALLOC_PROC_SYS_VM_OVERCOMMIT_MEMORY)
- os_overcommits = os_overcommits_proc();
-# ifdef MAP_NORESERVE
- if (os_overcommits)
- mmap_flags |= MAP_NORESERVE;
-# endif
-#else
- os_overcommits = false;
-#endif
-}
diff --git a/memory/jemalloc/src/src/prng.c b/memory/jemalloc/src/src/prng.c
deleted file mode 100644
index 76646a2a4c..0000000000
--- a/memory/jemalloc/src/src/prng.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define JEMALLOC_PRNG_C_
-#include "jemalloc/internal/jemalloc_internal.h"
diff --git a/memory/jemalloc/src/src/prof.c b/memory/jemalloc/src/src/prof.c
deleted file mode 100644
index c89dade1f1..0000000000
--- a/memory/jemalloc/src/src/prof.c
+++ /dev/null
@@ -1,2355 +0,0 @@
-#define JEMALLOC_PROF_C_
-#include "jemalloc/internal/jemalloc_internal.h"
-/******************************************************************************/
-
-#ifdef JEMALLOC_PROF_LIBUNWIND
-#define UNW_LOCAL_ONLY
-#include <libunwind.h>
-#endif
-
-#ifdef JEMALLOC_PROF_LIBGCC
-#include <unwind.h>
-#endif
-
-/******************************************************************************/
-/* Data. */
-
-bool opt_prof = false;
-bool opt_prof_active = true;
-bool opt_prof_thread_active_init = true;
-size_t opt_lg_prof_sample = LG_PROF_SAMPLE_DEFAULT;
-ssize_t opt_lg_prof_interval = LG_PROF_INTERVAL_DEFAULT;
-bool opt_prof_gdump = false;
-bool opt_prof_final = false;
-bool opt_prof_leak = false;
-bool opt_prof_accum = false;
-char opt_prof_prefix[
- /* Minimize memory bloat for non-prof builds. */
-#ifdef JEMALLOC_PROF
- PATH_MAX +
-#endif
- 1];
-
-/*
- * Initialized as opt_prof_active, and accessed via
- * prof_active_[gs]et{_unlocked,}().
- */
-bool prof_active;
-static malloc_mutex_t prof_active_mtx;
-
-/*
- * Initialized as opt_prof_thread_active_init, and accessed via
- * prof_thread_active_init_[gs]et().
- */
-static bool prof_thread_active_init;
-static malloc_mutex_t prof_thread_active_init_mtx;
-
-/*
- * Initialized as opt_prof_gdump, and accessed via
- * prof_gdump_[gs]et{_unlocked,}().
- */
-bool prof_gdump_val;
-static malloc_mutex_t prof_gdump_mtx;
-
-uint64_t prof_interval = 0;
-
-size_t lg_prof_sample;
-
-/*
- * Table of mutexes that are shared among gctx's. These are leaf locks, so
- * there is no problem with using them for more than one gctx at the same time.
- * The primary motivation for this sharing though is that gctx's are ephemeral,
- * and destroying mutexes causes complications for systems that allocate when
- * creating/destroying mutexes.
- */
-static malloc_mutex_t *gctx_locks;
-static unsigned cum_gctxs; /* Atomic counter. */
-
-/*
- * Table of mutexes that are shared among tdata's. No operations require
- * holding multiple tdata locks, so there is no problem with using them for more
- * than one tdata at the same time, even though a gctx lock may be acquired
- * while holding a tdata lock.
- */
-static malloc_mutex_t *tdata_locks;
-
-/*
- * Global hash of (prof_bt_t *)-->(prof_gctx_t *). This is the master data
- * structure that knows about all backtraces currently captured.
- */
-static ckh_t bt2gctx;
-static malloc_mutex_t bt2gctx_mtx;
-
-/*
- * Tree of all extant prof_tdata_t structures, regardless of state,
- * {attached,detached,expired}.
- */
-static prof_tdata_tree_t tdatas;
-static malloc_mutex_t tdatas_mtx;
-
-static uint64_t next_thr_uid;
-static malloc_mutex_t next_thr_uid_mtx;
-
-static malloc_mutex_t prof_dump_seq_mtx;
-static uint64_t prof_dump_seq;
-static uint64_t prof_dump_iseq;
-static uint64_t prof_dump_mseq;
-static uint64_t prof_dump_useq;
-
-/*
- * This buffer is rather large for stack allocation, so use a single buffer for
- * all profile dumps.
- */
-static malloc_mutex_t prof_dump_mtx;
-static char prof_dump_buf[
- /* Minimize memory bloat for non-prof builds. */
-#ifdef JEMALLOC_PROF
- PROF_DUMP_BUFSIZE
-#else
- 1
-#endif
-];
-static size_t prof_dump_buf_end;
-static int prof_dump_fd;
-
-/* Do not dump any profiles until bootstrapping is complete. */
-static bool prof_booted = false;
-
-/******************************************************************************/
-/*
- * Function prototypes for static functions that are referenced prior to
- * definition.
- */
-
-static bool prof_tctx_should_destroy(tsdn_t *tsdn, prof_tctx_t *tctx);
-static void prof_tctx_destroy(tsd_t *tsd, prof_tctx_t *tctx);
-static bool prof_tdata_should_destroy(tsdn_t *tsdn, prof_tdata_t *tdata,
- bool even_if_attached);
-static void prof_tdata_destroy(tsd_t *tsd, prof_tdata_t *tdata,
- bool even_if_attached);
-static char *prof_thread_name_alloc(tsdn_t *tsdn, const char *thread_name);
-
-/******************************************************************************/
-/* Red-black trees. */
-
-JEMALLOC_INLINE_C int
-prof_tctx_comp(const prof_tctx_t *a, const prof_tctx_t *b)
-{
- uint64_t a_thr_uid = a->thr_uid;
- uint64_t b_thr_uid = b->thr_uid;
- int ret = (a_thr_uid > b_thr_uid) - (a_thr_uid < b_thr_uid);
- if (ret == 0) {
- uint64_t a_thr_discrim = a->thr_discrim;
- uint64_t b_thr_discrim = b->thr_discrim;
- ret = (a_thr_discrim > b_thr_discrim) - (a_thr_discrim <
- b_thr_discrim);
- if (ret == 0) {
- uint64_t a_tctx_uid = a->tctx_uid;
- uint64_t b_tctx_uid = b->tctx_uid;
- ret = (a_tctx_uid > b_tctx_uid) - (a_tctx_uid <
- b_tctx_uid);
- }
- }
- return (ret);
-}
-
-rb_gen(static UNUSED, tctx_tree_, prof_tctx_tree_t, prof_tctx_t,
- tctx_link, prof_tctx_comp)
-
-JEMALLOC_INLINE_C int
-prof_gctx_comp(const prof_gctx_t *a, const prof_gctx_t *b)
-{
- unsigned a_len = a->bt.len;
- unsigned b_len = b->bt.len;
- unsigned comp_len = (a_len < b_len) ? a_len : b_len;
- int ret = memcmp(a->bt.vec, b->bt.vec, comp_len * sizeof(void *));
- if (ret == 0)
- ret = (a_len > b_len) - (a_len < b_len);
- return (ret);
-}
-
-rb_gen(static UNUSED, gctx_tree_, prof_gctx_tree_t, prof_gctx_t, dump_link,
- prof_gctx_comp)
-
-JEMALLOC_INLINE_C int
-prof_tdata_comp(const prof_tdata_t *a, const prof_tdata_t *b)
-{
- int ret;
- uint64_t a_uid = a->thr_uid;
- uint64_t b_uid = b->thr_uid;
-
- ret = ((a_uid > b_uid) - (a_uid < b_uid));
- if (ret == 0) {
- uint64_t a_discrim = a->thr_discrim;
- uint64_t b_discrim = b->thr_discrim;
-
- ret = ((a_discrim > b_discrim) - (a_discrim < b_discrim));
- }
- return (ret);
-}
-
-rb_gen(static UNUSED, tdata_tree_, prof_tdata_tree_t, prof_tdata_t, tdata_link,
- prof_tdata_comp)
-
-/******************************************************************************/
-
-void
-prof_alloc_rollback(tsd_t *tsd, prof_tctx_t *tctx, bool updated)
-{
- prof_tdata_t *tdata;
-
- cassert(config_prof);
-
- if (updated) {
- /*
- * Compute a new sample threshold. This isn't very important in
- * practice, because this function is rarely executed, so the
- * potential for sample bias is minimal except in contrived
- * programs.
- */
- tdata = prof_tdata_get(tsd, true);
- if (tdata != NULL)
- prof_sample_threshold_update(tdata);
- }
-
- if ((uintptr_t)tctx > (uintptr_t)1U) {
- malloc_mutex_lock(tsd_tsdn(tsd), tctx->tdata->lock);
- tctx->prepared = false;
- if (prof_tctx_should_destroy(tsd_tsdn(tsd), tctx))
- prof_tctx_destroy(tsd, tctx);
- else
- malloc_mutex_unlock(tsd_tsdn(tsd), tctx->tdata->lock);
- }
-}
-
-void
-prof_malloc_sample_object(tsdn_t *tsdn, const void *ptr, size_t usize,
- prof_tctx_t *tctx)
-{
-
- prof_tctx_set(tsdn, ptr, usize, tctx);
-
- malloc_mutex_lock(tsdn, tctx->tdata->lock);
- tctx->cnts.curobjs++;
- tctx->cnts.curbytes += usize;
- if (opt_prof_accum) {
- tctx->cnts.accumobjs++;
- tctx->cnts.accumbytes += usize;
- }
- tctx->prepared = false;
- malloc_mutex_unlock(tsdn, tctx->tdata->lock);
-}
-
-void
-prof_free_sampled_object(tsd_t *tsd, size_t usize, prof_tctx_t *tctx)
-{
-
- malloc_mutex_lock(tsd_tsdn(tsd), tctx->tdata->lock);
- assert(tctx->cnts.curobjs > 0);
- assert(tctx->cnts.curbytes >= usize);
- tctx->cnts.curobjs--;
- tctx->cnts.curbytes -= usize;
-
- if (prof_tctx_should_destroy(tsd_tsdn(tsd), tctx))
- prof_tctx_destroy(tsd, tctx);
- else
- malloc_mutex_unlock(tsd_tsdn(tsd), tctx->tdata->lock);
-}
-
-void
-bt_init(prof_bt_t *bt, void **vec)
-{
-
- cassert(config_prof);
-
- bt->vec = vec;
- bt->len = 0;
-}
-
-JEMALLOC_INLINE_C void
-prof_enter(tsd_t *tsd, prof_tdata_t *tdata)
-{
-
- cassert(config_prof);
- assert(tdata == prof_tdata_get(tsd, false));
-
- if (tdata != NULL) {
- assert(!tdata->enq);
- tdata->enq = true;
- }
-
- malloc_mutex_lock(tsd_tsdn(tsd), &bt2gctx_mtx);
-}
-
-JEMALLOC_INLINE_C void
-prof_leave(tsd_t *tsd, prof_tdata_t *tdata)
-{
-
- cassert(config_prof);
- assert(tdata == prof_tdata_get(tsd, false));
-
- malloc_mutex_unlock(tsd_tsdn(tsd), &bt2gctx_mtx);
-
- if (tdata != NULL) {
- bool idump, gdump;
-
- assert(tdata->enq);
- tdata->enq = false;
- idump = tdata->enq_idump;
- tdata->enq_idump = false;
- gdump = tdata->enq_gdump;
- tdata->enq_gdump = false;
-
- if (idump)
- prof_idump(tsd_tsdn(tsd));
- if (gdump)
- prof_gdump(tsd_tsdn(tsd));
- }
-}
-
-#ifdef JEMALLOC_PROF_LIBUNWIND
-void
-prof_backtrace(prof_bt_t *bt)
-{
- int nframes;
-
- cassert(config_prof);
- assert(bt->len == 0);
- assert(bt->vec != NULL);
-
- nframes = unw_backtrace(bt->vec, PROF_BT_MAX);
- if (nframes <= 0)
- return;
- bt->len = nframes;
-}
-#elif (defined(JEMALLOC_PROF_LIBGCC))
-static _Unwind_Reason_Code
-prof_unwind_init_callback(struct _Unwind_Context *context, void *arg)
-{
-
- cassert(config_prof);
-
- return (_URC_NO_REASON);
-}
-
-static _Unwind_Reason_Code
-prof_unwind_callback(struct _Unwind_Context *context, void *arg)
-{
- prof_unwind_data_t *data = (prof_unwind_data_t *)arg;
- void *ip;
-
- cassert(config_prof);
-
- ip = (void *)_Unwind_GetIP(context);
- if (ip == NULL)
- return (_URC_END_OF_STACK);
- data->bt->vec[data->bt->len] = ip;
- data->bt->len++;
- if (data->bt->len == data->max)
- return (_URC_END_OF_STACK);
-
- return (_URC_NO_REASON);
-}
-
-void
-prof_backtrace(prof_bt_t *bt)
-{
- prof_unwind_data_t data = {bt, PROF_BT_MAX};
-
- cassert(config_prof);
-
- _Unwind_Backtrace(prof_unwind_callback, &data);
-}
-#elif (defined(JEMALLOC_PROF_GCC))
-void
-prof_backtrace(prof_bt_t *bt)
-{
-#define BT_FRAME(i) \
- if ((i) < PROF_BT_MAX) { \
- void *p; \
- if (__builtin_frame_address(i) == 0) \
- return; \
- p = __builtin_return_address(i); \
- if (p == NULL) \
- return; \
- bt->vec[(i)] = p; \
- bt->len = (i) + 1; \
- } else \
- return;
-
- cassert(config_prof);
-
- BT_FRAME(0)
- BT_FRAME(1)
- BT_FRAME(2)
- BT_FRAME(3)
- BT_FRAME(4)
- BT_FRAME(5)
- BT_FRAME(6)
- BT_FRAME(7)
- BT_FRAME(8)
- BT_FRAME(9)
-
- BT_FRAME(10)
- BT_FRAME(11)
- BT_FRAME(12)
- BT_FRAME(13)
- BT_FRAME(14)
- BT_FRAME(15)
- BT_FRAME(16)
- BT_FRAME(17)
- BT_FRAME(18)
- BT_FRAME(19)
-
- BT_FRAME(20)
- BT_FRAME(21)
- BT_FRAME(22)
- BT_FRAME(23)
- BT_FRAME(24)
- BT_FRAME(25)
- BT_FRAME(26)
- BT_FRAME(27)
- BT_FRAME(28)
- BT_FRAME(29)
-
- BT_FRAME(30)
- BT_FRAME(31)
- BT_FRAME(32)
- BT_FRAME(33)
- BT_FRAME(34)
- BT_FRAME(35)
- BT_FRAME(36)
- BT_FRAME(37)
- BT_FRAME(38)
- BT_FRAME(39)
-
- BT_FRAME(40)
- BT_FRAME(41)
- BT_FRAME(42)
- BT_FRAME(43)
- BT_FRAME(44)
- BT_FRAME(45)
- BT_FRAME(46)
- BT_FRAME(47)
- BT_FRAME(48)
- BT_FRAME(49)
-
- BT_FRAME(50)
- BT_FRAME(51)
- BT_FRAME(52)
- BT_FRAME(53)
- BT_FRAME(54)
- BT_FRAME(55)
- BT_FRAME(56)
- BT_FRAME(57)
- BT_FRAME(58)
- BT_FRAME(59)
-
- BT_FRAME(60)
- BT_FRAME(61)
- BT_FRAME(62)
- BT_FRAME(63)
- BT_FRAME(64)
- BT_FRAME(65)
- BT_FRAME(66)
- BT_FRAME(67)
- BT_FRAME(68)
- BT_FRAME(69)
-
- BT_FRAME(70)
- BT_FRAME(71)
- BT_FRAME(72)
- BT_FRAME(73)
- BT_FRAME(74)
- BT_FRAME(75)
- BT_FRAME(76)
- BT_FRAME(77)
- BT_FRAME(78)
- BT_FRAME(79)
-
- BT_FRAME(80)
- BT_FRAME(81)
- BT_FRAME(82)
- BT_FRAME(83)
- BT_FRAME(84)
- BT_FRAME(85)
- BT_FRAME(86)
- BT_FRAME(87)
- BT_FRAME(88)
- BT_FRAME(89)
-
- BT_FRAME(90)
- BT_FRAME(91)
- BT_FRAME(92)
- BT_FRAME(93)
- BT_FRAME(94)
- BT_FRAME(95)
- BT_FRAME(96)
- BT_FRAME(97)
- BT_FRAME(98)
- BT_FRAME(99)
-
- BT_FRAME(100)
- BT_FRAME(101)
- BT_FRAME(102)
- BT_FRAME(103)
- BT_FRAME(104)
- BT_FRAME(105)
- BT_FRAME(106)
- BT_FRAME(107)
- BT_FRAME(108)
- BT_FRAME(109)
-
- BT_FRAME(110)
- BT_FRAME(111)
- BT_FRAME(112)
- BT_FRAME(113)
- BT_FRAME(114)
- BT_FRAME(115)
- BT_FRAME(116)
- BT_FRAME(117)
- BT_FRAME(118)
- BT_FRAME(119)
-
- BT_FRAME(120)
- BT_FRAME(121)
- BT_FRAME(122)
- BT_FRAME(123)
- BT_FRAME(124)
- BT_FRAME(125)
- BT_FRAME(126)
- BT_FRAME(127)
-#undef BT_FRAME
-}
-#else
-void
-prof_backtrace(prof_bt_t *bt)
-{
-
- cassert(config_prof);
- not_reached();
-}
-#endif
-
-static malloc_mutex_t *
-prof_gctx_mutex_choose(void)
-{
- unsigned ngctxs = atomic_add_u(&cum_gctxs, 1);
-
- return (&gctx_locks[(ngctxs - 1) % PROF_NCTX_LOCKS]);
-}
-
-static malloc_mutex_t *
-prof_tdata_mutex_choose(uint64_t thr_uid)
-{
-
- return (&tdata_locks[thr_uid % PROF_NTDATA_LOCKS]);
-}
-
-static prof_gctx_t *
-prof_gctx_create(tsdn_t *tsdn, prof_bt_t *bt)
-{
- /*
- * Create a single allocation that has space for vec of length bt->len.
- */
- size_t size = offsetof(prof_gctx_t, vec) + (bt->len * sizeof(void *));
- prof_gctx_t *gctx = (prof_gctx_t *)iallocztm(tsdn, size,
- size2index(size), false, NULL, true, arena_get(TSDN_NULL, 0, true),
- true);
- if (gctx == NULL)
- return (NULL);
- gctx->lock = prof_gctx_mutex_choose();
- /*
- * Set nlimbo to 1, in order to avoid a race condition with
- * prof_tctx_destroy()/prof_gctx_try_destroy().
- */
- gctx->nlimbo = 1;
- tctx_tree_new(&gctx->tctxs);
- /* Duplicate bt. */
- memcpy(gctx->vec, bt->vec, bt->len * sizeof(void *));
- gctx->bt.vec = gctx->vec;
- gctx->bt.len = bt->len;
- return (gctx);
-}
-
-static void
-prof_gctx_try_destroy(tsd_t *tsd, prof_tdata_t *tdata_self, prof_gctx_t *gctx,
- prof_tdata_t *tdata)
-{
-
- cassert(config_prof);
-
- /*
- * Check that gctx is still unused by any thread cache before destroying
- * it. prof_lookup() increments gctx->nlimbo in order to avoid a race
- * condition with this function, as does prof_tctx_destroy() in order to
- * avoid a race between the main body of prof_tctx_destroy() and entry
- * into this function.
- */
- prof_enter(tsd, tdata_self);
- malloc_mutex_lock(tsd_tsdn(tsd), gctx->lock);
- assert(gctx->nlimbo != 0);
- if (tctx_tree_empty(&gctx->tctxs) && gctx->nlimbo == 1) {
- /* Remove gctx from bt2gctx. */
- if (ckh_remove(tsd, &bt2gctx, &gctx->bt, NULL, NULL))
- not_reached();
- prof_leave(tsd, tdata_self);
- /* Destroy gctx. */
- malloc_mutex_unlock(tsd_tsdn(tsd), gctx->lock);
- idalloctm(tsd_tsdn(tsd), gctx, NULL, true, true);
- } else {
- /*
- * Compensate for increment in prof_tctx_destroy() or
- * prof_lookup().
- */
- gctx->nlimbo--;
- malloc_mutex_unlock(tsd_tsdn(tsd), gctx->lock);
- prof_leave(tsd, tdata_self);
- }
-}
-
-static bool
-prof_tctx_should_destroy(tsdn_t *tsdn, prof_tctx_t *tctx)
-{
-
- malloc_mutex_assert_owner(tsdn, tctx->tdata->lock);
-
- if (opt_prof_accum)
- return (false);
- if (tctx->cnts.curobjs != 0)
- return (false);
- if (tctx->prepared)
- return (false);
- return (true);
-}
-
-static bool
-prof_gctx_should_destroy(prof_gctx_t *gctx)
-{
-
- if (opt_prof_accum)
- return (false);
- if (!tctx_tree_empty(&gctx->tctxs))
- return (false);
- if (gctx->nlimbo != 0)
- return (false);
- return (true);
-}
-
-static void
-prof_tctx_destroy(tsd_t *tsd, prof_tctx_t *tctx)
-{
- prof_tdata_t *tdata = tctx->tdata;
- prof_gctx_t *gctx = tctx->gctx;
- bool destroy_tdata, destroy_tctx, destroy_gctx;
-
- malloc_mutex_assert_owner(tsd_tsdn(tsd), tctx->tdata->lock);
-
- assert(tctx->cnts.curobjs == 0);
- assert(tctx->cnts.curbytes == 0);
- assert(!opt_prof_accum);
- assert(tctx->cnts.accumobjs == 0);
- assert(tctx->cnts.accumbytes == 0);
-
- ckh_remove(tsd, &tdata->bt2tctx, &gctx->bt, NULL, NULL);
- destroy_tdata = prof_tdata_should_destroy(tsd_tsdn(tsd), tdata, false);
- malloc_mutex_unlock(tsd_tsdn(tsd), tdata->lock);
-
- malloc_mutex_lock(tsd_tsdn(tsd), gctx->lock);
- switch (tctx->state) {
- case prof_tctx_state_nominal:
- tctx_tree_remove(&gctx->tctxs, tctx);
- destroy_tctx = true;
- if (prof_gctx_should_destroy(gctx)) {
- /*
- * Increment gctx->nlimbo in order to keep another
- * thread from winning the race to destroy gctx while
- * this one has gctx->lock dropped. Without this, it
- * would be possible for another thread to:
- *
- * 1) Sample an allocation associated with gctx.
- * 2) Deallocate the sampled object.
- * 3) Successfully prof_gctx_try_destroy(gctx).
- *
- * The result would be that gctx no longer exists by the
- * time this thread accesses it in
- * prof_gctx_try_destroy().
- */
- gctx->nlimbo++;
- destroy_gctx = true;
- } else
- destroy_gctx = false;
- break;
- case prof_tctx_state_dumping:
- /*
- * A dumping thread needs tctx to remain valid until dumping
- * has finished. Change state such that the dumping thread will
- * complete destruction during a late dump iteration phase.
- */
- tctx->state = prof_tctx_state_purgatory;
- destroy_tctx = false;
- destroy_gctx = false;
- break;
- default:
- not_reached();
- destroy_tctx = false;
- destroy_gctx = false;
- }
- malloc_mutex_unlock(tsd_tsdn(tsd), gctx->lock);
- if (destroy_gctx) {
- prof_gctx_try_destroy(tsd, prof_tdata_get(tsd, false), gctx,
- tdata);
- }
-
- malloc_mutex_assert_not_owner(tsd_tsdn(tsd), tctx->tdata->lock);
-
- if (destroy_tdata)
- prof_tdata_destroy(tsd, tdata, false);
-
- if (destroy_tctx)
- idalloctm(tsd_tsdn(tsd), tctx, NULL, true, true);
-}
-
-static bool
-prof_lookup_global(tsd_t *tsd, prof_bt_t *bt, prof_tdata_t *tdata,
- void **p_btkey, prof_gctx_t **p_gctx, bool *p_new_gctx)
-{
- union {
- prof_gctx_t *p;
- void *v;
- } gctx;
- union {
- prof_bt_t *p;
- void *v;
- } btkey;
- bool new_gctx;
-
- prof_enter(tsd, tdata);
- if (ckh_search(&bt2gctx, bt, &btkey.v, &gctx.v)) {
- /* bt has never been seen before. Insert it. */
- gctx.p = prof_gctx_create(tsd_tsdn(tsd), bt);
- if (gctx.v == NULL) {
- prof_leave(tsd, tdata);
- return (true);
- }
- btkey.p = &gctx.p->bt;
- if (ckh_insert(tsd, &bt2gctx, btkey.v, gctx.v)) {
- /* OOM. */
- prof_leave(tsd, tdata);
- idalloctm(tsd_tsdn(tsd), gctx.v, NULL, true, true);
- return (true);
- }
- new_gctx = true;
- } else {
- /*
- * Increment nlimbo, in order to avoid a race condition with
- * prof_tctx_destroy()/prof_gctx_try_destroy().
- */
- malloc_mutex_lock(tsd_tsdn(tsd), gctx.p->lock);
- gctx.p->nlimbo++;
- malloc_mutex_unlock(tsd_tsdn(tsd), gctx.p->lock);
- new_gctx = false;
- }
- prof_leave(tsd, tdata);
-
- *p_btkey = btkey.v;
- *p_gctx = gctx.p;
- *p_new_gctx = new_gctx;
- return (false);
-}
-
-prof_tctx_t *
-prof_lookup(tsd_t *tsd, prof_bt_t *bt)
-{
- union {
- prof_tctx_t *p;
- void *v;
- } ret;
- prof_tdata_t *tdata;
- bool not_found;
-
- cassert(config_prof);
-
- tdata = prof_tdata_get(tsd, false);
- if (tdata == NULL)
- return (NULL);
-
- malloc_mutex_lock(tsd_tsdn(tsd), tdata->lock);
- not_found = ckh_search(&tdata->bt2tctx, bt, NULL, &ret.v);
- if (!not_found) /* Note double negative! */
- ret.p->prepared = true;
- malloc_mutex_unlock(tsd_tsdn(tsd), tdata->lock);
- if (not_found) {
- void *btkey;
- prof_gctx_t *gctx;
- bool new_gctx, error;
-
- /*
- * This thread's cache lacks bt. Look for it in the global
- * cache.
- */
- if (prof_lookup_global(tsd, bt, tdata, &btkey, &gctx,
- &new_gctx))
- return (NULL);
-
- /* Link a prof_tctx_t into gctx for this thread. */
- ret.v = iallocztm(tsd_tsdn(tsd), sizeof(prof_tctx_t),
- size2index(sizeof(prof_tctx_t)), false, NULL, true,
- arena_ichoose(tsd, NULL), true);
- if (ret.p == NULL) {
- if (new_gctx)
- prof_gctx_try_destroy(tsd, tdata, gctx, tdata);
- return (NULL);
- }
- ret.p->tdata = tdata;
- ret.p->thr_uid = tdata->thr_uid;
- ret.p->thr_discrim = tdata->thr_discrim;
- memset(&ret.p->cnts, 0, sizeof(prof_cnt_t));
- ret.p->gctx = gctx;
- ret.p->tctx_uid = tdata->tctx_uid_next++;
- ret.p->prepared = true;
- ret.p->state = prof_tctx_state_initializing;
- malloc_mutex_lock(tsd_tsdn(tsd), tdata->lock);
- error = ckh_insert(tsd, &tdata->bt2tctx, btkey, ret.v);
- malloc_mutex_unlock(tsd_tsdn(tsd), tdata->lock);
- if (error) {
- if (new_gctx)
- prof_gctx_try_destroy(tsd, tdata, gctx, tdata);
- idalloctm(tsd_tsdn(tsd), ret.v, NULL, true, true);
- return (NULL);
- }
- malloc_mutex_lock(tsd_tsdn(tsd), gctx->lock);
- ret.p->state = prof_tctx_state_nominal;
- tctx_tree_insert(&gctx->tctxs, ret.p);
- gctx->nlimbo--;
- malloc_mutex_unlock(tsd_tsdn(tsd), gctx->lock);
- }
-
- return (ret.p);
-}
-
-/*
- * The bodies of this function and prof_leakcheck() are compiled out unless heap
- * profiling is enabled, so that it is possible to compile jemalloc with
- * floating point support completely disabled. Avoiding floating point code is
- * important on memory-constrained systems, but it also enables a workaround for
- * versions of glibc that don't properly save/restore floating point registers
- * during dynamic lazy symbol loading (which internally calls into whatever
- * malloc implementation happens to be integrated into the application). Note
- * that some compilers (e.g. gcc 4.8) may use floating point registers for fast
- * memory moves, so jemalloc must be compiled with such optimizations disabled
- * (e.g.
- * -mno-sse) in order for the workaround to be complete.
- */
-void
-prof_sample_threshold_update(prof_tdata_t *tdata)
-{
-#ifdef JEMALLOC_PROF
- uint64_t r;
- double u;
-
- if (!config_prof)
- return;
-
- if (lg_prof_sample == 0) {
- tdata->bytes_until_sample = 0;
- return;
- }
-
- /*
- * Compute sample interval as a geometrically distributed random
- * variable with mean (2^lg_prof_sample).
- *
- * __ __
- * | log(u) | 1
- * tdata->bytes_until_sample = | -------- |, where p = ---------------
- * | log(1-p) | lg_prof_sample
- * 2
- *
- * For more information on the math, see:
- *
- * Non-Uniform Random Variate Generation
- * Luc Devroye
- * Springer-Verlag, New York, 1986
- * pp 500
- * (http://luc.devroye.org/rnbookindex.html)
- */
- r = prng_lg_range_u64(&tdata->prng_state, 53);
- u = (double)r * (1.0/9007199254740992.0L);
- tdata->bytes_until_sample = (uint64_t)(log(u) /
- log(1.0 - (1.0 / (double)((uint64_t)1U << lg_prof_sample))))
- + (uint64_t)1U;
-#endif
-}
-
-#ifdef JEMALLOC_JET
-static prof_tdata_t *
-prof_tdata_count_iter(prof_tdata_tree_t *tdatas, prof_tdata_t *tdata, void *arg)
-{
- size_t *tdata_count = (size_t *)arg;
-
- (*tdata_count)++;
-
- return (NULL);
-}
-
-size_t
-prof_tdata_count(void)
-{
- size_t tdata_count = 0;
- tsdn_t *tsdn;
-
- tsdn = tsdn_fetch();
- malloc_mutex_lock(tsdn, &tdatas_mtx);
- tdata_tree_iter(&tdatas, NULL, prof_tdata_count_iter,
- (void *)&tdata_count);
- malloc_mutex_unlock(tsdn, &tdatas_mtx);
-
- return (tdata_count);
-}
-#endif
-
-#ifdef JEMALLOC_JET
-size_t
-prof_bt_count(void)
-{
- size_t bt_count;
- tsd_t *tsd;
- prof_tdata_t *tdata;
-
- tsd = tsd_fetch();
- tdata = prof_tdata_get(tsd, false);
- if (tdata == NULL)
- return (0);
-
- malloc_mutex_lock(tsd_tsdn(tsd), &bt2gctx_mtx);
- bt_count = ckh_count(&bt2gctx);
- malloc_mutex_unlock(tsd_tsdn(tsd), &bt2gctx_mtx);
-
- return (bt_count);
-}
-#endif
-
-#ifdef JEMALLOC_JET
-#undef prof_dump_open
-#define prof_dump_open JEMALLOC_N(prof_dump_open_impl)
-#endif
-static int
-prof_dump_open(bool propagate_err, const char *filename)
-{
- int fd;
-
- fd = creat(filename, 0644);
- if (fd == -1 && !propagate_err) {
- malloc_printf("<jemalloc>: creat(\"%s\"), 0644) failed\n",
- filename);
- if (opt_abort)
- abort();
- }
-
- return (fd);
-}
-#ifdef JEMALLOC_JET
-#undef prof_dump_open
-#define prof_dump_open JEMALLOC_N(prof_dump_open)
-prof_dump_open_t *prof_dump_open = JEMALLOC_N(prof_dump_open_impl);
-#endif
-
-static bool
-prof_dump_flush(bool propagate_err)
-{
- bool ret = false;
- ssize_t err;
-
- cassert(config_prof);
-
- err = write(prof_dump_fd, prof_dump_buf, prof_dump_buf_end);
- if (err == -1) {
- if (!propagate_err) {
- malloc_write("<jemalloc>: write() failed during heap "
- "profile flush\n");
- if (opt_abort)
- abort();
- }
- ret = true;
- }
- prof_dump_buf_end = 0;
-
- return (ret);
-}
-
-static bool
-prof_dump_close(bool propagate_err)
-{
- bool ret;
-
- assert(prof_dump_fd != -1);
- ret = prof_dump_flush(propagate_err);
- close(prof_dump_fd);
- prof_dump_fd = -1;
-
- return (ret);
-}
-
-static bool
-prof_dump_write(bool propagate_err, const char *s)
-{
- size_t i, slen, n;
-
- cassert(config_prof);
-
- i = 0;
- slen = strlen(s);
- while (i < slen) {
- /* Flush the buffer if it is full. */
- if (prof_dump_buf_end == PROF_DUMP_BUFSIZE)
- if (prof_dump_flush(propagate_err) && propagate_err)
- return (true);
-
- if (prof_dump_buf_end + slen <= PROF_DUMP_BUFSIZE) {
- /* Finish writing. */
- n = slen - i;
- } else {
- /* Write as much of s as will fit. */
- n = PROF_DUMP_BUFSIZE - prof_dump_buf_end;
- }
- memcpy(&prof_dump_buf[prof_dump_buf_end], &s[i], n);
- prof_dump_buf_end += n;
- i += n;
- }
-
- return (false);
-}
-
-JEMALLOC_FORMAT_PRINTF(2, 3)
-static bool
-prof_dump_printf(bool propagate_err, const char *format, ...)
-{
- bool ret;
- va_list ap;
- char buf[PROF_PRINTF_BUFSIZE];
-
- va_start(ap, format);
- malloc_vsnprintf(buf, sizeof(buf), format, ap);
- va_end(ap);
- ret = prof_dump_write(propagate_err, buf);
-
- return (ret);
-}
-
-static void
-prof_tctx_merge_tdata(tsdn_t *tsdn, prof_tctx_t *tctx, prof_tdata_t *tdata)
-{
-
- malloc_mutex_assert_owner(tsdn, tctx->tdata->lock);
-
- malloc_mutex_lock(tsdn, tctx->gctx->lock);
-
- switch (tctx->state) {
- case prof_tctx_state_initializing:
- malloc_mutex_unlock(tsdn, tctx->gctx->lock);
- return;
- case prof_tctx_state_nominal:
- tctx->state = prof_tctx_state_dumping;
- malloc_mutex_unlock(tsdn, tctx->gctx->lock);
-
- memcpy(&tctx->dump_cnts, &tctx->cnts, sizeof(prof_cnt_t));
-
- tdata->cnt_summed.curobjs += tctx->dump_cnts.curobjs;
- tdata->cnt_summed.curbytes += tctx->dump_cnts.curbytes;
- if (opt_prof_accum) {
- tdata->cnt_summed.accumobjs +=
- tctx->dump_cnts.accumobjs;
- tdata->cnt_summed.accumbytes +=
- tctx->dump_cnts.accumbytes;
- }
- break;
- case prof_tctx_state_dumping:
- case prof_tctx_state_purgatory:
- not_reached();
- }
-}
-
-static void
-prof_tctx_merge_gctx(tsdn_t *tsdn, prof_tctx_t *tctx, prof_gctx_t *gctx)
-{
-
- malloc_mutex_assert_owner(tsdn, gctx->lock);
-
- gctx->cnt_summed.curobjs += tctx->dump_cnts.curobjs;
- gctx->cnt_summed.curbytes += tctx->dump_cnts.curbytes;
- if (opt_prof_accum) {
- gctx->cnt_summed.accumobjs += tctx->dump_cnts.accumobjs;
- gctx->cnt_summed.accumbytes += tctx->dump_cnts.accumbytes;
- }
-}
-
-static prof_tctx_t *
-prof_tctx_merge_iter(prof_tctx_tree_t *tctxs, prof_tctx_t *tctx, void *arg)
-{
- tsdn_t *tsdn = (tsdn_t *)arg;
-
- malloc_mutex_assert_owner(tsdn, tctx->gctx->lock);
-
- switch (tctx->state) {
- case prof_tctx_state_nominal:
- /* New since dumping started; ignore. */
- break;
- case prof_tctx_state_dumping:
- case prof_tctx_state_purgatory:
- prof_tctx_merge_gctx(tsdn, tctx, tctx->gctx);
- break;
- default:
- not_reached();
- }
-
- return (NULL);
-}
-
-struct prof_tctx_dump_iter_arg_s {
- tsdn_t *tsdn;
- bool propagate_err;
-};
-
-static prof_tctx_t *
-prof_tctx_dump_iter(prof_tctx_tree_t *tctxs, prof_tctx_t *tctx, void *opaque)
-{
- struct prof_tctx_dump_iter_arg_s *arg =
- (struct prof_tctx_dump_iter_arg_s *)opaque;
-
- malloc_mutex_assert_owner(arg->tsdn, tctx->gctx->lock);
-
- switch (tctx->state) {
- case prof_tctx_state_initializing:
- case prof_tctx_state_nominal:
- /* Not captured by this dump. */
- break;
- case prof_tctx_state_dumping:
- case prof_tctx_state_purgatory:
- if (prof_dump_printf(arg->propagate_err,
- " t%"FMTu64": %"FMTu64": %"FMTu64" [%"FMTu64": "
- "%"FMTu64"]\n", tctx->thr_uid, tctx->dump_cnts.curobjs,
- tctx->dump_cnts.curbytes, tctx->dump_cnts.accumobjs,
- tctx->dump_cnts.accumbytes))
- return (tctx);
- break;
- default:
- not_reached();
- }
- return (NULL);
-}
-
-static prof_tctx_t *
-prof_tctx_finish_iter(prof_tctx_tree_t *tctxs, prof_tctx_t *tctx, void *arg)
-{
- tsdn_t *tsdn = (tsdn_t *)arg;
- prof_tctx_t *ret;
-
- malloc_mutex_assert_owner(tsdn, tctx->gctx->lock);
-
- switch (tctx->state) {
- case prof_tctx_state_nominal:
- /* New since dumping started; ignore. */
- break;
- case prof_tctx_state_dumping:
- tctx->state = prof_tctx_state_nominal;
- break;
- case prof_tctx_state_purgatory:
- ret = tctx;
- goto label_return;
- default:
- not_reached();
- }
-
- ret = NULL;
-label_return:
- return (ret);
-}
-
-static void
-prof_dump_gctx_prep(tsdn_t *tsdn, prof_gctx_t *gctx, prof_gctx_tree_t *gctxs)
-{
-
- cassert(config_prof);
-
- malloc_mutex_lock(tsdn, gctx->lock);
-
- /*
- * Increment nlimbo so that gctx won't go away before dump.
- * Additionally, link gctx into the dump list so that it is included in
- * prof_dump()'s second pass.
- */
- gctx->nlimbo++;
- gctx_tree_insert(gctxs, gctx);
-
- memset(&gctx->cnt_summed, 0, sizeof(prof_cnt_t));
-
- malloc_mutex_unlock(tsdn, gctx->lock);
-}
-
-struct prof_gctx_merge_iter_arg_s {
- tsdn_t *tsdn;
- size_t leak_ngctx;
-};
-
-static prof_gctx_t *
-prof_gctx_merge_iter(prof_gctx_tree_t *gctxs, prof_gctx_t *gctx, void *opaque)
-{
- struct prof_gctx_merge_iter_arg_s *arg =
- (struct prof_gctx_merge_iter_arg_s *)opaque;
-
- malloc_mutex_lock(arg->tsdn, gctx->lock);
- tctx_tree_iter(&gctx->tctxs, NULL, prof_tctx_merge_iter,
- (void *)arg->tsdn);
- if (gctx->cnt_summed.curobjs != 0)
- arg->leak_ngctx++;
- malloc_mutex_unlock(arg->tsdn, gctx->lock);
-
- return (NULL);
-}
-
-static void
-prof_gctx_finish(tsd_t *tsd, prof_gctx_tree_t *gctxs)
-{
- prof_tdata_t *tdata = prof_tdata_get(tsd, false);
- prof_gctx_t *gctx;
-
- /*
- * Standard tree iteration won't work here, because as soon as we
- * decrement gctx->nlimbo and unlock gctx, another thread can
- * concurrently destroy it, which will corrupt the tree. Therefore,
- * tear down the tree one node at a time during iteration.
- */
- while ((gctx = gctx_tree_first(gctxs)) != NULL) {
- gctx_tree_remove(gctxs, gctx);
- malloc_mutex_lock(tsd_tsdn(tsd), gctx->lock);
- {
- prof_tctx_t *next;
-
- next = NULL;
- do {
- prof_tctx_t *to_destroy =
- tctx_tree_iter(&gctx->tctxs, next,
- prof_tctx_finish_iter,
- (void *)tsd_tsdn(tsd));
- if (to_destroy != NULL) {
- next = tctx_tree_next(&gctx->tctxs,
- to_destroy);
- tctx_tree_remove(&gctx->tctxs,
- to_destroy);
- idalloctm(tsd_tsdn(tsd), to_destroy,
- NULL, true, true);
- } else
- next = NULL;
- } while (next != NULL);
- }
- gctx->nlimbo--;
- if (prof_gctx_should_destroy(gctx)) {
- gctx->nlimbo++;
- malloc_mutex_unlock(tsd_tsdn(tsd), gctx->lock);
- prof_gctx_try_destroy(tsd, tdata, gctx, tdata);
- } else
- malloc_mutex_unlock(tsd_tsdn(tsd), gctx->lock);
- }
-}
-
-struct prof_tdata_merge_iter_arg_s {
- tsdn_t *tsdn;
- prof_cnt_t cnt_all;
-};
-
-static prof_tdata_t *
-prof_tdata_merge_iter(prof_tdata_tree_t *tdatas, prof_tdata_t *tdata,
- void *opaque)
-{
- struct prof_tdata_merge_iter_arg_s *arg =
- (struct prof_tdata_merge_iter_arg_s *)opaque;
-
- malloc_mutex_lock(arg->tsdn, tdata->lock);
- if (!tdata->expired) {
- size_t tabind;
- union {
- prof_tctx_t *p;
- void *v;
- } tctx;
-
- tdata->dumping = true;
- memset(&tdata->cnt_summed, 0, sizeof(prof_cnt_t));
- for (tabind = 0; !ckh_iter(&tdata->bt2tctx, &tabind, NULL,
- &tctx.v);)
- prof_tctx_merge_tdata(arg->tsdn, tctx.p, tdata);
-
- arg->cnt_all.curobjs += tdata->cnt_summed.curobjs;
- arg->cnt_all.curbytes += tdata->cnt_summed.curbytes;
- if (opt_prof_accum) {
- arg->cnt_all.accumobjs += tdata->cnt_summed.accumobjs;
- arg->cnt_all.accumbytes += tdata->cnt_summed.accumbytes;
- }
- } else
- tdata->dumping = false;
- malloc_mutex_unlock(arg->tsdn, tdata->lock);
-
- return (NULL);
-}
-
-static prof_tdata_t *
-prof_tdata_dump_iter(prof_tdata_tree_t *tdatas, prof_tdata_t *tdata, void *arg)
-{
- bool propagate_err = *(bool *)arg;
-
- if (!tdata->dumping)
- return (NULL);
-
- if (prof_dump_printf(propagate_err,
- " t%"FMTu64": %"FMTu64": %"FMTu64" [%"FMTu64": %"FMTu64"]%s%s\n",
- tdata->thr_uid, tdata->cnt_summed.curobjs,
- tdata->cnt_summed.curbytes, tdata->cnt_summed.accumobjs,
- tdata->cnt_summed.accumbytes,
- (tdata->thread_name != NULL) ? " " : "",
- (tdata->thread_name != NULL) ? tdata->thread_name : ""))
- return (tdata);
- return (NULL);
-}
-
-#ifdef JEMALLOC_JET
-#undef prof_dump_header
-#define prof_dump_header JEMALLOC_N(prof_dump_header_impl)
-#endif
-static bool
-prof_dump_header(tsdn_t *tsdn, bool propagate_err, const prof_cnt_t *cnt_all)
-{
- bool ret;
-
- if (prof_dump_printf(propagate_err,
- "heap_v2/%"FMTu64"\n"
- " t*: %"FMTu64": %"FMTu64" [%"FMTu64": %"FMTu64"]\n",
- ((uint64_t)1U << lg_prof_sample), cnt_all->curobjs,
- cnt_all->curbytes, cnt_all->accumobjs, cnt_all->accumbytes))
- return (true);
-
- malloc_mutex_lock(tsdn, &tdatas_mtx);
- ret = (tdata_tree_iter(&tdatas, NULL, prof_tdata_dump_iter,
- (void *)&propagate_err) != NULL);
- malloc_mutex_unlock(tsdn, &tdatas_mtx);
- return (ret);
-}
-#ifdef JEMALLOC_JET
-#undef prof_dump_header
-#define prof_dump_header JEMALLOC_N(prof_dump_header)
-prof_dump_header_t *prof_dump_header = JEMALLOC_N(prof_dump_header_impl);
-#endif
-
-static bool
-prof_dump_gctx(tsdn_t *tsdn, bool propagate_err, prof_gctx_t *gctx,
- const prof_bt_t *bt, prof_gctx_tree_t *gctxs)
-{
- bool ret;
- unsigned i;
- struct prof_tctx_dump_iter_arg_s prof_tctx_dump_iter_arg;
-
- cassert(config_prof);
- malloc_mutex_assert_owner(tsdn, gctx->lock);
-
- /* Avoid dumping such gctx's that have no useful data. */
- if ((!opt_prof_accum && gctx->cnt_summed.curobjs == 0) ||
- (opt_prof_accum && gctx->cnt_summed.accumobjs == 0)) {
- assert(gctx->cnt_summed.curobjs == 0);
- assert(gctx->cnt_summed.curbytes == 0);
- assert(gctx->cnt_summed.accumobjs == 0);
- assert(gctx->cnt_summed.accumbytes == 0);
- ret = false;
- goto label_return;
- }
-
- if (prof_dump_printf(propagate_err, "@")) {
- ret = true;
- goto label_return;
- }
- for (i = 0; i < bt->len; i++) {
- if (prof_dump_printf(propagate_err, " %#"FMTxPTR,
- (uintptr_t)bt->vec[i])) {
- ret = true;
- goto label_return;
- }
- }
-
- if (prof_dump_printf(propagate_err,
- "\n"
- " t*: %"FMTu64": %"FMTu64" [%"FMTu64": %"FMTu64"]\n",
- gctx->cnt_summed.curobjs, gctx->cnt_summed.curbytes,
- gctx->cnt_summed.accumobjs, gctx->cnt_summed.accumbytes)) {
- ret = true;
- goto label_return;
- }
-
- prof_tctx_dump_iter_arg.tsdn = tsdn;
- prof_tctx_dump_iter_arg.propagate_err = propagate_err;
- if (tctx_tree_iter(&gctx->tctxs, NULL, prof_tctx_dump_iter,
- (void *)&prof_tctx_dump_iter_arg) != NULL) {
- ret = true;
- goto label_return;
- }
-
- ret = false;
-label_return:
- return (ret);
-}
-
-#ifndef _WIN32
-JEMALLOC_FORMAT_PRINTF(1, 2)
-static int
-prof_open_maps(const char *format, ...)
-{
- int mfd;
- va_list ap;
- char filename[PATH_MAX + 1];
-
- va_start(ap, format);
- malloc_vsnprintf(filename, sizeof(filename), format, ap);
- va_end(ap);
- mfd = open(filename, O_RDONLY);
-
- return (mfd);
-}
-#endif
-
-static int
-prof_getpid(void)
-{
-
-#ifdef _WIN32
- return (GetCurrentProcessId());
-#else
- return (getpid());
-#endif
-}
-
-static bool
-prof_dump_maps(bool propagate_err)
-{
- bool ret;
- int mfd;
-
- cassert(config_prof);
-#ifdef __FreeBSD__
- mfd = prof_open_maps("/proc/curproc/map");
-#elif defined(_WIN32)
- mfd = -1; // Not implemented
-#else
- {
- int pid = prof_getpid();
-
- mfd = prof_open_maps("/proc/%d/task/%d/maps", pid, pid);
- if (mfd == -1)
- mfd = prof_open_maps("/proc/%d/maps", pid);
- }
-#endif
- if (mfd != -1) {
- ssize_t nread;
-
- if (prof_dump_write(propagate_err, "\nMAPPED_LIBRARIES:\n") &&
- propagate_err) {
- ret = true;
- goto label_return;
- }
- nread = 0;
- do {
- prof_dump_buf_end += nread;
- if (prof_dump_buf_end == PROF_DUMP_BUFSIZE) {
- /* Make space in prof_dump_buf before read(). */
- if (prof_dump_flush(propagate_err) &&
- propagate_err) {
- ret = true;
- goto label_return;
- }
- }
- nread = read(mfd, &prof_dump_buf[prof_dump_buf_end],
- PROF_DUMP_BUFSIZE - prof_dump_buf_end);
- } while (nread > 0);
- } else {
- ret = true;
- goto label_return;
- }
-
- ret = false;
-label_return:
- if (mfd != -1)
- close(mfd);
- return (ret);
-}
-
-/*
- * See prof_sample_threshold_update() comment for why the body of this function
- * is conditionally compiled.
- */
-static void
-prof_leakcheck(const prof_cnt_t *cnt_all, size_t leak_ngctx,
- const char *filename)
-{
-
-#ifdef JEMALLOC_PROF
- /*
- * Scaling is equivalent AdjustSamples() in jeprof, but the result may
- * differ slightly from what jeprof reports, because here we scale the
- * summary values, whereas jeprof scales each context individually and
- * reports the sums of the scaled values.
- */
- if (cnt_all->curbytes != 0) {
- double sample_period = (double)((uint64_t)1 << lg_prof_sample);
- double ratio = (((double)cnt_all->curbytes) /
- (double)cnt_all->curobjs) / sample_period;
- double scale_factor = 1.0 / (1.0 - exp(-ratio));
- uint64_t curbytes = (uint64_t)round(((double)cnt_all->curbytes)
- * scale_factor);
- uint64_t curobjs = (uint64_t)round(((double)cnt_all->curobjs) *
- scale_factor);
-
- malloc_printf("<jemalloc>: Leak approximation summary: ~%"FMTu64
- " byte%s, ~%"FMTu64" object%s, >= %zu context%s\n",
- curbytes, (curbytes != 1) ? "s" : "", curobjs, (curobjs !=
- 1) ? "s" : "", leak_ngctx, (leak_ngctx != 1) ? "s" : "");
- malloc_printf(
- "<jemalloc>: Run jeprof on \"%s\" for leak detail\n",
- filename);
- }
-#endif
-}
-
-struct prof_gctx_dump_iter_arg_s {
- tsdn_t *tsdn;
- bool propagate_err;
-};
-
-static prof_gctx_t *
-prof_gctx_dump_iter(prof_gctx_tree_t *gctxs, prof_gctx_t *gctx, void *opaque)
-{
- prof_gctx_t *ret;
- struct prof_gctx_dump_iter_arg_s *arg =
- (struct prof_gctx_dump_iter_arg_s *)opaque;
-
- malloc_mutex_lock(arg->tsdn, gctx->lock);
-
- if (prof_dump_gctx(arg->tsdn, arg->propagate_err, gctx, &gctx->bt,
- gctxs)) {
- ret = gctx;
- goto label_return;
- }
-
- ret = NULL;
-label_return:
- malloc_mutex_unlock(arg->tsdn, gctx->lock);
- return (ret);
-}
-
-static bool
-prof_dump(tsd_t *tsd, bool propagate_err, const char *filename, bool leakcheck)
-{
- prof_tdata_t *tdata;
- struct prof_tdata_merge_iter_arg_s prof_tdata_merge_iter_arg;
- size_t tabind;
- union {
- prof_gctx_t *p;
- void *v;
- } gctx;
- struct prof_gctx_merge_iter_arg_s prof_gctx_merge_iter_arg;
- struct prof_gctx_dump_iter_arg_s prof_gctx_dump_iter_arg;
- prof_gctx_tree_t gctxs;
-
- cassert(config_prof);
-
- tdata = prof_tdata_get(tsd, true);
- if (tdata == NULL)
- return (true);
-
- malloc_mutex_lock(tsd_tsdn(tsd), &prof_dump_mtx);
- prof_enter(tsd, tdata);
-
- /*
- * Put gctx's in limbo and clear their counters in preparation for
- * summing.
- */
- gctx_tree_new(&gctxs);
- for (tabind = 0; !ckh_iter(&bt2gctx, &tabind, NULL, &gctx.v);)
- prof_dump_gctx_prep(tsd_tsdn(tsd), gctx.p, &gctxs);
-
- /*
- * Iterate over tdatas, and for the non-expired ones snapshot their tctx
- * stats and merge them into the associated gctx's.
- */
- prof_tdata_merge_iter_arg.tsdn = tsd_tsdn(tsd);
- memset(&prof_tdata_merge_iter_arg.cnt_all, 0, sizeof(prof_cnt_t));
- malloc_mutex_lock(tsd_tsdn(tsd), &tdatas_mtx);
- tdata_tree_iter(&tdatas, NULL, prof_tdata_merge_iter,
- (void *)&prof_tdata_merge_iter_arg);
- malloc_mutex_unlock(tsd_tsdn(tsd), &tdatas_mtx);
-
- /* Merge tctx stats into gctx's. */
- prof_gctx_merge_iter_arg.tsdn = tsd_tsdn(tsd);
- prof_gctx_merge_iter_arg.leak_ngctx = 0;
- gctx_tree_iter(&gctxs, NULL, prof_gctx_merge_iter,
- (void *)&prof_gctx_merge_iter_arg);
-
- prof_leave(tsd, tdata);
-
- /* Create dump file. */
- if ((prof_dump_fd = prof_dump_open(propagate_err, filename)) == -1)
- goto label_open_close_error;
-
- /* Dump profile header. */
- if (prof_dump_header(tsd_tsdn(tsd), propagate_err,
- &prof_tdata_merge_iter_arg.cnt_all))
- goto label_write_error;
-
- /* Dump per gctx profile stats. */
- prof_gctx_dump_iter_arg.tsdn = tsd_tsdn(tsd);
- prof_gctx_dump_iter_arg.propagate_err = propagate_err;
- if (gctx_tree_iter(&gctxs, NULL, prof_gctx_dump_iter,
- (void *)&prof_gctx_dump_iter_arg) != NULL)
- goto label_write_error;
-
- /* Dump /proc/<pid>/maps if possible. */
- if (prof_dump_maps(propagate_err))
- goto label_write_error;
-
- if (prof_dump_close(propagate_err))
- goto label_open_close_error;
-
- prof_gctx_finish(tsd, &gctxs);
- malloc_mutex_unlock(tsd_tsdn(tsd), &prof_dump_mtx);
-
- if (leakcheck) {
- prof_leakcheck(&prof_tdata_merge_iter_arg.cnt_all,
- prof_gctx_merge_iter_arg.leak_ngctx, filename);
- }
- return (false);
-label_write_error:
- prof_dump_close(propagate_err);
-label_open_close_error:
- prof_gctx_finish(tsd, &gctxs);
- malloc_mutex_unlock(tsd_tsdn(tsd), &prof_dump_mtx);
- return (true);
-}
-
-#define DUMP_FILENAME_BUFSIZE (PATH_MAX + 1)
-#define VSEQ_INVALID UINT64_C(0xffffffffffffffff)
-static void
-prof_dump_filename(char *filename, char v, uint64_t vseq)
-{
-
- cassert(config_prof);
-
- if (vseq != VSEQ_INVALID) {
- /* "<prefix>.<pid>.<seq>.v<vseq>.heap" */
- malloc_snprintf(filename, DUMP_FILENAME_BUFSIZE,
- "%s.%d.%"FMTu64".%c%"FMTu64".heap",
- opt_prof_prefix, prof_getpid(), prof_dump_seq, v, vseq);
- } else {
- /* "<prefix>.<pid>.<seq>.<v>.heap" */
- malloc_snprintf(filename, DUMP_FILENAME_BUFSIZE,
- "%s.%d.%"FMTu64".%c.heap",
- opt_prof_prefix, prof_getpid(), prof_dump_seq, v);
- }
- prof_dump_seq++;
-}
-
-static void
-prof_fdump(void)
-{
- tsd_t *tsd;
- char filename[DUMP_FILENAME_BUFSIZE];
-
- cassert(config_prof);
- assert(opt_prof_final);
- assert(opt_prof_prefix[0] != '\0');
-
- if (!prof_booted)
- return;
- tsd = tsd_fetch();
-
- malloc_mutex_lock(tsd_tsdn(tsd), &prof_dump_seq_mtx);
- prof_dump_filename(filename, 'f', VSEQ_INVALID);
- malloc_mutex_unlock(tsd_tsdn(tsd), &prof_dump_seq_mtx);
- prof_dump(tsd, false, filename, opt_prof_leak);
-}
-
-void
-prof_idump(tsdn_t *tsdn)
-{
- tsd_t *tsd;
- prof_tdata_t *tdata;
-
- cassert(config_prof);
-
- if (!prof_booted || tsdn_null(tsdn))
- return;
- tsd = tsdn_tsd(tsdn);
- tdata = prof_tdata_get(tsd, false);
- if (tdata == NULL)
- return;
- if (tdata->enq) {
- tdata->enq_idump = true;
- return;
- }
-
- if (opt_prof_prefix[0] != '\0') {
- char filename[PATH_MAX + 1];
- malloc_mutex_lock(tsd_tsdn(tsd), &prof_dump_seq_mtx);
- prof_dump_filename(filename, 'i', prof_dump_iseq);
- prof_dump_iseq++;
- malloc_mutex_unlock(tsd_tsdn(tsd), &prof_dump_seq_mtx);
- prof_dump(tsd, false, filename, false);
- }
-}
-
-bool
-prof_mdump(tsd_t *tsd, const char *filename)
-{
- char filename_buf[DUMP_FILENAME_BUFSIZE];
-
- cassert(config_prof);
-
- if (!opt_prof || !prof_booted)
- return (true);
-
- if (filename == NULL) {
- /* No filename specified, so automatically generate one. */
- if (opt_prof_prefix[0] == '\0')
- return (true);
- malloc_mutex_lock(tsd_tsdn(tsd), &prof_dump_seq_mtx);
- prof_dump_filename(filename_buf, 'm', prof_dump_mseq);
- prof_dump_mseq++;
- malloc_mutex_unlock(tsd_tsdn(tsd), &prof_dump_seq_mtx);
- filename = filename_buf;
- }
- return (prof_dump(tsd, true, filename, false));
-}
-
-void
-prof_gdump(tsdn_t *tsdn)
-{
- tsd_t *tsd;
- prof_tdata_t *tdata;
-
- cassert(config_prof);
-
- if (!prof_booted || tsdn_null(tsdn))
- return;
- tsd = tsdn_tsd(tsdn);
- tdata = prof_tdata_get(tsd, false);
- if (tdata == NULL)
- return;
- if (tdata->enq) {
- tdata->enq_gdump = true;
- return;
- }
-
- if (opt_prof_prefix[0] != '\0') {
- char filename[DUMP_FILENAME_BUFSIZE];
- malloc_mutex_lock(tsdn, &prof_dump_seq_mtx);
- prof_dump_filename(filename, 'u', prof_dump_useq);
- prof_dump_useq++;
- malloc_mutex_unlock(tsdn, &prof_dump_seq_mtx);
- prof_dump(tsd, false, filename, false);
- }
-}
-
-static void
-prof_bt_hash(const void *key, size_t r_hash[2])
-{
- prof_bt_t *bt = (prof_bt_t *)key;
-
- cassert(config_prof);
-
- hash(bt->vec, bt->len * sizeof(void *), 0x94122f33U, r_hash);
-}
-
-static bool
-prof_bt_keycomp(const void *k1, const void *k2)
-{
- const prof_bt_t *bt1 = (prof_bt_t *)k1;
- const prof_bt_t *bt2 = (prof_bt_t *)k2;
-
- cassert(config_prof);
-
- if (bt1->len != bt2->len)
- return (false);
- return (memcmp(bt1->vec, bt2->vec, bt1->len * sizeof(void *)) == 0);
-}
-
-JEMALLOC_INLINE_C uint64_t
-prof_thr_uid_alloc(tsdn_t *tsdn)
-{
- uint64_t thr_uid;
-
- malloc_mutex_lock(tsdn, &next_thr_uid_mtx);
- thr_uid = next_thr_uid;
- next_thr_uid++;
- malloc_mutex_unlock(tsdn, &next_thr_uid_mtx);
-
- return (thr_uid);
-}
-
-static prof_tdata_t *
-prof_tdata_init_impl(tsd_t *tsd, uint64_t thr_uid, uint64_t thr_discrim,
- char *thread_name, bool active)
-{
- prof_tdata_t *tdata;
-
- cassert(config_prof);
-
- /* Initialize an empty cache for this thread. */
- tdata = (prof_tdata_t *)iallocztm(tsd_tsdn(tsd), sizeof(prof_tdata_t),
- size2index(sizeof(prof_tdata_t)), false, NULL, true,
- arena_get(TSDN_NULL, 0, true), true);
- if (tdata == NULL)
- return (NULL);
-
- tdata->lock = prof_tdata_mutex_choose(thr_uid);
- tdata->thr_uid = thr_uid;
- tdata->thr_discrim = thr_discrim;
- tdata->thread_name = thread_name;
- tdata->attached = true;
- tdata->expired = false;
- tdata->tctx_uid_next = 0;
-
- if (ckh_new(tsd, &tdata->bt2tctx, PROF_CKH_MINITEMS, prof_bt_hash,
- prof_bt_keycomp)) {
- idalloctm(tsd_tsdn(tsd), tdata, NULL, true, true);
- return (NULL);
- }
-
- tdata->prng_state = (uint64_t)(uintptr_t)tdata;
- prof_sample_threshold_update(tdata);
-
- tdata->enq = false;
- tdata->enq_idump = false;
- tdata->enq_gdump = false;
-
- tdata->dumping = false;
- tdata->active = active;
-
- malloc_mutex_lock(tsd_tsdn(tsd), &tdatas_mtx);
- tdata_tree_insert(&tdatas, tdata);
- malloc_mutex_unlock(tsd_tsdn(tsd), &tdatas_mtx);
-
- return (tdata);
-}
-
-prof_tdata_t *
-prof_tdata_init(tsd_t *tsd)
-{
-
- return (prof_tdata_init_impl(tsd, prof_thr_uid_alloc(tsd_tsdn(tsd)), 0,
- NULL, prof_thread_active_init_get(tsd_tsdn(tsd))));
-}
-
-static bool
-prof_tdata_should_destroy_unlocked(prof_tdata_t *tdata, bool even_if_attached)
-{
-
- if (tdata->attached && !even_if_attached)
- return (false);
- if (ckh_count(&tdata->bt2tctx) != 0)
- return (false);
- return (true);
-}
-
-static bool
-prof_tdata_should_destroy(tsdn_t *tsdn, prof_tdata_t *tdata,
- bool even_if_attached)
-{
-
- malloc_mutex_assert_owner(tsdn, tdata->lock);
-
- return (prof_tdata_should_destroy_unlocked(tdata, even_if_attached));
-}
-
-static void
-prof_tdata_destroy_locked(tsd_t *tsd, prof_tdata_t *tdata,
- bool even_if_attached)
-{
-
- malloc_mutex_assert_owner(tsd_tsdn(tsd), &tdatas_mtx);
-
- tdata_tree_remove(&tdatas, tdata);
-
- assert(prof_tdata_should_destroy_unlocked(tdata, even_if_attached));
-
- if (tdata->thread_name != NULL)
- idalloctm(tsd_tsdn(tsd), tdata->thread_name, NULL, true, true);
- ckh_delete(tsd, &tdata->bt2tctx);
- idalloctm(tsd_tsdn(tsd), tdata, NULL, true, true);
-}
-
-static void
-prof_tdata_destroy(tsd_t *tsd, prof_tdata_t *tdata, bool even_if_attached)
-{
-
- malloc_mutex_lock(tsd_tsdn(tsd), &tdatas_mtx);
- prof_tdata_destroy_locked(tsd, tdata, even_if_attached);
- malloc_mutex_unlock(tsd_tsdn(tsd), &tdatas_mtx);
-}
-
-static void
-prof_tdata_detach(tsd_t *tsd, prof_tdata_t *tdata)
-{
- bool destroy_tdata;
-
- malloc_mutex_lock(tsd_tsdn(tsd), tdata->lock);
- if (tdata->attached) {
- destroy_tdata = prof_tdata_should_destroy(tsd_tsdn(tsd), tdata,
- true);
- /*
- * Only detach if !destroy_tdata, because detaching would allow
- * another thread to win the race to destroy tdata.
- */
- if (!destroy_tdata)
- tdata->attached = false;
- tsd_prof_tdata_set(tsd, NULL);
- } else
- destroy_tdata = false;
- malloc_mutex_unlock(tsd_tsdn(tsd), tdata->lock);
- if (destroy_tdata)
- prof_tdata_destroy(tsd, tdata, true);
-}
-
-prof_tdata_t *
-prof_tdata_reinit(tsd_t *tsd, prof_tdata_t *tdata)
-{
- uint64_t thr_uid = tdata->thr_uid;
- uint64_t thr_discrim = tdata->thr_discrim + 1;
- char *thread_name = (tdata->thread_name != NULL) ?
- prof_thread_name_alloc(tsd_tsdn(tsd), tdata->thread_name) : NULL;
- bool active = tdata->active;
-
- prof_tdata_detach(tsd, tdata);
- return (prof_tdata_init_impl(tsd, thr_uid, thr_discrim, thread_name,
- active));
-}
-
-static bool
-prof_tdata_expire(tsdn_t *tsdn, prof_tdata_t *tdata)
-{
- bool destroy_tdata;
-
- malloc_mutex_lock(tsdn, tdata->lock);
- if (!tdata->expired) {
- tdata->expired = true;
- destroy_tdata = tdata->attached ? false :
- prof_tdata_should_destroy(tsdn, tdata, false);
- } else
- destroy_tdata = false;
- malloc_mutex_unlock(tsdn, tdata->lock);
-
- return (destroy_tdata);
-}
-
-static prof_tdata_t *
-prof_tdata_reset_iter(prof_tdata_tree_t *tdatas, prof_tdata_t *tdata, void *arg)
-{
- tsdn_t *tsdn = (tsdn_t *)arg;
-
- return (prof_tdata_expire(tsdn, tdata) ? tdata : NULL);
-}
-
-void
-prof_reset(tsd_t *tsd, size_t lg_sample)
-{
- prof_tdata_t *next;
-
- assert(lg_sample < (sizeof(uint64_t) << 3));
-
- malloc_mutex_lock(tsd_tsdn(tsd), &prof_dump_mtx);
- malloc_mutex_lock(tsd_tsdn(tsd), &tdatas_mtx);
-
- lg_prof_sample = lg_sample;
-
- next = NULL;
- do {
- prof_tdata_t *to_destroy = tdata_tree_iter(&tdatas, next,
- prof_tdata_reset_iter, (void *)tsd);
- if (to_destroy != NULL) {
- next = tdata_tree_next(&tdatas, to_destroy);
- prof_tdata_destroy_locked(tsd, to_destroy, false);
- } else
- next = NULL;
- } while (next != NULL);
-
- malloc_mutex_unlock(tsd_tsdn(tsd), &tdatas_mtx);
- malloc_mutex_unlock(tsd_tsdn(tsd), &prof_dump_mtx);
-}
-
-void
-prof_tdata_cleanup(tsd_t *tsd)
-{
- prof_tdata_t *tdata;
-
- if (!config_prof)
- return;
-
- tdata = tsd_prof_tdata_get(tsd);
- if (tdata != NULL)
- prof_tdata_detach(tsd, tdata);
-}
-
-bool
-prof_active_get(tsdn_t *tsdn)
-{
- bool prof_active_current;
-
- malloc_mutex_lock(tsdn, &prof_active_mtx);
- prof_active_current = prof_active;
- malloc_mutex_unlock(tsdn, &prof_active_mtx);
- return (prof_active_current);
-}
-
-bool
-prof_active_set(tsdn_t *tsdn, bool active)
-{
- bool prof_active_old;
-
- malloc_mutex_lock(tsdn, &prof_active_mtx);
- prof_active_old = prof_active;
- prof_active = active;
- malloc_mutex_unlock(tsdn, &prof_active_mtx);
- return (prof_active_old);
-}
-
-const char *
-prof_thread_name_get(tsd_t *tsd)
-{
- prof_tdata_t *tdata;
-
- tdata = prof_tdata_get(tsd, true);
- if (tdata == NULL)
- return ("");
- return (tdata->thread_name != NULL ? tdata->thread_name : "");
-}
-
-static char *
-prof_thread_name_alloc(tsdn_t *tsdn, const char *thread_name)
-{
- char *ret;
- size_t size;
-
- if (thread_name == NULL)
- return (NULL);
-
- size = strlen(thread_name) + 1;
- if (size == 1)
- return ("");
-
- ret = iallocztm(tsdn, size, size2index(size), false, NULL, true,
- arena_get(TSDN_NULL, 0, true), true);
- if (ret == NULL)
- return (NULL);
- memcpy(ret, thread_name, size);
- return (ret);
-}
-
-int
-prof_thread_name_set(tsd_t *tsd, const char *thread_name)
-{
- prof_tdata_t *tdata;
- unsigned i;
- char *s;
-
- tdata = prof_tdata_get(tsd, true);
- if (tdata == NULL)
- return (EAGAIN);
-
- /* Validate input. */
- if (thread_name == NULL)
- return (EFAULT);
- for (i = 0; thread_name[i] != '\0'; i++) {
- char c = thread_name[i];
- if (!isgraph(c) && !isblank(c))
- return (EFAULT);
- }
-
- s = prof_thread_name_alloc(tsd_tsdn(tsd), thread_name);
- if (s == NULL)
- return (EAGAIN);
-
- if (tdata->thread_name != NULL) {
- idalloctm(tsd_tsdn(tsd), tdata->thread_name, NULL, true, true);
- tdata->thread_name = NULL;
- }
- if (strlen(s) > 0)
- tdata->thread_name = s;
- return (0);
-}
-
-bool
-prof_thread_active_get(tsd_t *tsd)
-{
- prof_tdata_t *tdata;
-
- tdata = prof_tdata_get(tsd, true);
- if (tdata == NULL)
- return (false);
- return (tdata->active);
-}
-
-bool
-prof_thread_active_set(tsd_t *tsd, bool active)
-{
- prof_tdata_t *tdata;
-
- tdata = prof_tdata_get(tsd, true);
- if (tdata == NULL)
- return (true);
- tdata->active = active;
- return (false);
-}
-
-bool
-prof_thread_active_init_get(tsdn_t *tsdn)
-{
- bool active_init;
-
- malloc_mutex_lock(tsdn, &prof_thread_active_init_mtx);
- active_init = prof_thread_active_init;
- malloc_mutex_unlock(tsdn, &prof_thread_active_init_mtx);
- return (active_init);
-}
-
-bool
-prof_thread_active_init_set(tsdn_t *tsdn, bool active_init)
-{
- bool active_init_old;
-
- malloc_mutex_lock(tsdn, &prof_thread_active_init_mtx);
- active_init_old = prof_thread_active_init;
- prof_thread_active_init = active_init;
- malloc_mutex_unlock(tsdn, &prof_thread_active_init_mtx);
- return (active_init_old);
-}
-
-bool
-prof_gdump_get(tsdn_t *tsdn)
-{
- bool prof_gdump_current;
-
- malloc_mutex_lock(tsdn, &prof_gdump_mtx);
- prof_gdump_current = prof_gdump_val;
- malloc_mutex_unlock(tsdn, &prof_gdump_mtx);
- return (prof_gdump_current);
-}
-
-bool
-prof_gdump_set(tsdn_t *tsdn, bool gdump)
-{
- bool prof_gdump_old;
-
- malloc_mutex_lock(tsdn, &prof_gdump_mtx);
- prof_gdump_old = prof_gdump_val;
- prof_gdump_val = gdump;
- malloc_mutex_unlock(tsdn, &prof_gdump_mtx);
- return (prof_gdump_old);
-}
-
-void
-prof_boot0(void)
-{
-
- cassert(config_prof);
-
- memcpy(opt_prof_prefix, PROF_PREFIX_DEFAULT,
- sizeof(PROF_PREFIX_DEFAULT));
-}
-
-void
-prof_boot1(void)
-{
-
- cassert(config_prof);
-
- /*
- * opt_prof must be in its final state before any arenas are
- * initialized, so this function must be executed early.
- */
-
- if (opt_prof_leak && !opt_prof) {
- /*
- * Enable opt_prof, but in such a way that profiles are never
- * automatically dumped.
- */
- opt_prof = true;
- opt_prof_gdump = false;
- } else if (opt_prof) {
- if (opt_lg_prof_interval >= 0) {
- prof_interval = (((uint64_t)1U) <<
- opt_lg_prof_interval);
- }
- }
-}
-
-bool
-prof_boot2(tsd_t *tsd)
-{
-
- cassert(config_prof);
-
- if (opt_prof) {
- unsigned i;
-
- lg_prof_sample = opt_lg_prof_sample;
-
- prof_active = opt_prof_active;
- if (malloc_mutex_init(&prof_active_mtx, "prof_active",
- WITNESS_RANK_PROF_ACTIVE))
- return (true);
-
- prof_gdump_val = opt_prof_gdump;
- if (malloc_mutex_init(&prof_gdump_mtx, "prof_gdump",
- WITNESS_RANK_PROF_GDUMP))
- return (true);
-
- prof_thread_active_init = opt_prof_thread_active_init;
- if (malloc_mutex_init(&prof_thread_active_init_mtx,
- "prof_thread_active_init",
- WITNESS_RANK_PROF_THREAD_ACTIVE_INIT))
- return (true);
-
- if (ckh_new(tsd, &bt2gctx, PROF_CKH_MINITEMS, prof_bt_hash,
- prof_bt_keycomp))
- return (true);
- if (malloc_mutex_init(&bt2gctx_mtx, "prof_bt2gctx",
- WITNESS_RANK_PROF_BT2GCTX))
- return (true);
-
- tdata_tree_new(&tdatas);
- if (malloc_mutex_init(&tdatas_mtx, "prof_tdatas",
- WITNESS_RANK_PROF_TDATAS))
- return (true);
-
- next_thr_uid = 0;
- if (malloc_mutex_init(&next_thr_uid_mtx, "prof_next_thr_uid",
- WITNESS_RANK_PROF_NEXT_THR_UID))
- return (true);
-
- if (malloc_mutex_init(&prof_dump_seq_mtx, "prof_dump_seq",
- WITNESS_RANK_PROF_DUMP_SEQ))
- return (true);
- if (malloc_mutex_init(&prof_dump_mtx, "prof_dump",
- WITNESS_RANK_PROF_DUMP))
- return (true);
-
- if (opt_prof_final && opt_prof_prefix[0] != '\0' &&
- atexit(prof_fdump) != 0) {
- malloc_write("<jemalloc>: Error in atexit()\n");
- if (opt_abort)
- abort();
- }
-
- gctx_locks = (malloc_mutex_t *)base_alloc(tsd_tsdn(tsd),
- PROF_NCTX_LOCKS * sizeof(malloc_mutex_t));
- if (gctx_locks == NULL)
- return (true);
- for (i = 0; i < PROF_NCTX_LOCKS; i++) {
- if (malloc_mutex_init(&gctx_locks[i], "prof_gctx",
- WITNESS_RANK_PROF_GCTX))
- return (true);
- }
-
- tdata_locks = (malloc_mutex_t *)base_alloc(tsd_tsdn(tsd),
- PROF_NTDATA_LOCKS * sizeof(malloc_mutex_t));
- if (tdata_locks == NULL)
- return (true);
- for (i = 0; i < PROF_NTDATA_LOCKS; i++) {
- if (malloc_mutex_init(&tdata_locks[i], "prof_tdata",
- WITNESS_RANK_PROF_TDATA))
- return (true);
- }
- }
-
-#ifdef JEMALLOC_PROF_LIBGCC
- /*
- * Cause the backtracing machinery to allocate its internal state
- * before enabling profiling.
- */
- _Unwind_Backtrace(prof_unwind_init_callback, NULL);
-#endif
-
- prof_booted = true;
-
- return (false);
-}
-
-void
-prof_prefork0(tsdn_t *tsdn)
-{
-
- if (opt_prof) {
- unsigned i;
-
- malloc_mutex_prefork(tsdn, &prof_dump_mtx);
- malloc_mutex_prefork(tsdn, &bt2gctx_mtx);
- malloc_mutex_prefork(tsdn, &tdatas_mtx);
- for (i = 0; i < PROF_NTDATA_LOCKS; i++)
- malloc_mutex_prefork(tsdn, &tdata_locks[i]);
- for (i = 0; i < PROF_NCTX_LOCKS; i++)
- malloc_mutex_prefork(tsdn, &gctx_locks[i]);
- }
-}
-
-void
-prof_prefork1(tsdn_t *tsdn)
-{
-
- if (opt_prof) {
- malloc_mutex_prefork(tsdn, &prof_active_mtx);
- malloc_mutex_prefork(tsdn, &prof_dump_seq_mtx);
- malloc_mutex_prefork(tsdn, &prof_gdump_mtx);
- malloc_mutex_prefork(tsdn, &next_thr_uid_mtx);
- malloc_mutex_prefork(tsdn, &prof_thread_active_init_mtx);
- }
-}
-
-void
-prof_postfork_parent(tsdn_t *tsdn)
-{
-
- if (opt_prof) {
- unsigned i;
-
- malloc_mutex_postfork_parent(tsdn,
- &prof_thread_active_init_mtx);
- malloc_mutex_postfork_parent(tsdn, &next_thr_uid_mtx);
- malloc_mutex_postfork_parent(tsdn, &prof_gdump_mtx);
- malloc_mutex_postfork_parent(tsdn, &prof_dump_seq_mtx);
- malloc_mutex_postfork_parent(tsdn, &prof_active_mtx);
- for (i = 0; i < PROF_NCTX_LOCKS; i++)
- malloc_mutex_postfork_parent(tsdn, &gctx_locks[i]);
- for (i = 0; i < PROF_NTDATA_LOCKS; i++)
- malloc_mutex_postfork_parent(tsdn, &tdata_locks[i]);
- malloc_mutex_postfork_parent(tsdn, &tdatas_mtx);
- malloc_mutex_postfork_parent(tsdn, &bt2gctx_mtx);
- malloc_mutex_postfork_parent(tsdn, &prof_dump_mtx);
- }
-}
-
-void
-prof_postfork_child(tsdn_t *tsdn)
-{
-
- if (opt_prof) {
- unsigned i;
-
- malloc_mutex_postfork_child(tsdn, &prof_thread_active_init_mtx);
- malloc_mutex_postfork_child(tsdn, &next_thr_uid_mtx);
- malloc_mutex_postfork_child(tsdn, &prof_gdump_mtx);
- malloc_mutex_postfork_child(tsdn, &prof_dump_seq_mtx);
- malloc_mutex_postfork_child(tsdn, &prof_active_mtx);
- for (i = 0; i < PROF_NCTX_LOCKS; i++)
- malloc_mutex_postfork_child(tsdn, &gctx_locks[i]);
- for (i = 0; i < PROF_NTDATA_LOCKS; i++)
- malloc_mutex_postfork_child(tsdn, &tdata_locks[i]);
- malloc_mutex_postfork_child(tsdn, &tdatas_mtx);
- malloc_mutex_postfork_child(tsdn, &bt2gctx_mtx);
- malloc_mutex_postfork_child(tsdn, &prof_dump_mtx);
- }
-}
-
-/******************************************************************************/
diff --git a/memory/jemalloc/src/src/quarantine.c b/memory/jemalloc/src/src/quarantine.c
deleted file mode 100644
index 18903fb5c7..0000000000
--- a/memory/jemalloc/src/src/quarantine.c
+++ /dev/null
@@ -1,183 +0,0 @@
-#define JEMALLOC_QUARANTINE_C_
-#include "jemalloc/internal/jemalloc_internal.h"
-
-/*
- * Quarantine pointers close to NULL are used to encode state information that
- * is used for cleaning up during thread shutdown.
- */
-#define QUARANTINE_STATE_REINCARNATED ((quarantine_t *)(uintptr_t)1)
-#define QUARANTINE_STATE_PURGATORY ((quarantine_t *)(uintptr_t)2)
-#define QUARANTINE_STATE_MAX QUARANTINE_STATE_PURGATORY
-
-/******************************************************************************/
-/* Function prototypes for non-inline static functions. */
-
-static quarantine_t *quarantine_grow(tsd_t *tsd, quarantine_t *quarantine);
-static void quarantine_drain_one(tsdn_t *tsdn, quarantine_t *quarantine);
-static void quarantine_drain(tsdn_t *tsdn, quarantine_t *quarantine,
- size_t upper_bound);
-
-/******************************************************************************/
-
-static quarantine_t *
-quarantine_init(tsdn_t *tsdn, size_t lg_maxobjs)
-{
- quarantine_t *quarantine;
- size_t size;
-
- size = offsetof(quarantine_t, objs) + ((ZU(1) << lg_maxobjs) *
- sizeof(quarantine_obj_t));
- quarantine = (quarantine_t *)iallocztm(tsdn, size, size2index(size),
- false, NULL, true, arena_get(TSDN_NULL, 0, true), true);
- if (quarantine == NULL)
- return (NULL);
- quarantine->curbytes = 0;
- quarantine->curobjs = 0;
- quarantine->first = 0;
- quarantine->lg_maxobjs = lg_maxobjs;
-
- return (quarantine);
-}
-
-void
-quarantine_alloc_hook_work(tsd_t *tsd)
-{
- quarantine_t *quarantine;
-
- if (!tsd_nominal(tsd))
- return;
-
- quarantine = quarantine_init(tsd_tsdn(tsd), LG_MAXOBJS_INIT);
- /*
- * Check again whether quarantine has been initialized, because
- * quarantine_init() may have triggered recursive initialization.
- */
- if (tsd_quarantine_get(tsd) == NULL)
- tsd_quarantine_set(tsd, quarantine);
- else
- idalloctm(tsd_tsdn(tsd), quarantine, NULL, true, true);
-}
-
-static quarantine_t *
-quarantine_grow(tsd_t *tsd, quarantine_t *quarantine)
-{
- quarantine_t *ret;
-
- ret = quarantine_init(tsd_tsdn(tsd), quarantine->lg_maxobjs + 1);
- if (ret == NULL) {
- quarantine_drain_one(tsd_tsdn(tsd), quarantine);
- return (quarantine);
- }
-
- ret->curbytes = quarantine->curbytes;
- ret->curobjs = quarantine->curobjs;
- if (quarantine->first + quarantine->curobjs <= (ZU(1) <<
- quarantine->lg_maxobjs)) {
- /* objs ring buffer data are contiguous. */
- memcpy(ret->objs, &quarantine->objs[quarantine->first],
- quarantine->curobjs * sizeof(quarantine_obj_t));
- } else {
- /* objs ring buffer data wrap around. */
- size_t ncopy_a = (ZU(1) << quarantine->lg_maxobjs) -
- quarantine->first;
- size_t ncopy_b = quarantine->curobjs - ncopy_a;
-
- memcpy(ret->objs, &quarantine->objs[quarantine->first], ncopy_a
- * sizeof(quarantine_obj_t));
- memcpy(&ret->objs[ncopy_a], quarantine->objs, ncopy_b *
- sizeof(quarantine_obj_t));
- }
- idalloctm(tsd_tsdn(tsd), quarantine, NULL, true, true);
-
- tsd_quarantine_set(tsd, ret);
- return (ret);
-}
-
-static void
-quarantine_drain_one(tsdn_t *tsdn, quarantine_t *quarantine)
-{
- quarantine_obj_t *obj = &quarantine->objs[quarantine->first];
- assert(obj->usize == isalloc(tsdn, obj->ptr, config_prof));
- idalloctm(tsdn, obj->ptr, NULL, false, true);
- quarantine->curbytes -= obj->usize;
- quarantine->curobjs--;
- quarantine->first = (quarantine->first + 1) & ((ZU(1) <<
- quarantine->lg_maxobjs) - 1);
-}
-
-static void
-quarantine_drain(tsdn_t *tsdn, quarantine_t *quarantine, size_t upper_bound)
-{
-
- while (quarantine->curbytes > upper_bound && quarantine->curobjs > 0)
- quarantine_drain_one(tsdn, quarantine);
-}
-
-void
-quarantine(tsd_t *tsd, void *ptr)
-{
- quarantine_t *quarantine;
- size_t usize = isalloc(tsd_tsdn(tsd), ptr, config_prof);
-
- cassert(config_fill);
- assert(opt_quarantine);
-
- if ((quarantine = tsd_quarantine_get(tsd)) == NULL) {
- idalloctm(tsd_tsdn(tsd), ptr, NULL, false, true);
- return;
- }
- /*
- * Drain one or more objects if the quarantine size limit would be
- * exceeded by appending ptr.
- */
- if (quarantine->curbytes + usize > opt_quarantine) {
- size_t upper_bound = (opt_quarantine >= usize) ? opt_quarantine
- - usize : 0;
- quarantine_drain(tsd_tsdn(tsd), quarantine, upper_bound);
- }
- /* Grow the quarantine ring buffer if it's full. */
- if (quarantine->curobjs == (ZU(1) << quarantine->lg_maxobjs))
- quarantine = quarantine_grow(tsd, quarantine);
- /* quarantine_grow() must free a slot if it fails to grow. */
- assert(quarantine->curobjs < (ZU(1) << quarantine->lg_maxobjs));
- /* Append ptr if its size doesn't exceed the quarantine size. */
- if (quarantine->curbytes + usize <= opt_quarantine) {
- size_t offset = (quarantine->first + quarantine->curobjs) &
- ((ZU(1) << quarantine->lg_maxobjs) - 1);
- quarantine_obj_t *obj = &quarantine->objs[offset];
- obj->ptr = ptr;
- obj->usize = usize;
- quarantine->curbytes += usize;
- quarantine->curobjs++;
- if (config_fill && unlikely(opt_junk_free)) {
- /*
- * Only do redzone validation if Valgrind isn't in
- * operation.
- */
- if ((!config_valgrind || likely(!in_valgrind))
- && usize <= SMALL_MAXCLASS)
- arena_quarantine_junk_small(ptr, usize);
- else
- memset(ptr, JEMALLOC_FREE_JUNK, usize);
- }
- } else {
- assert(quarantine->curbytes == 0);
- idalloctm(tsd_tsdn(tsd), ptr, NULL, false, true);
- }
-}
-
-void
-quarantine_cleanup(tsd_t *tsd)
-{
- quarantine_t *quarantine;
-
- if (!config_fill)
- return;
-
- quarantine = tsd_quarantine_get(tsd);
- if (quarantine != NULL) {
- quarantine_drain(tsd_tsdn(tsd), quarantine, 0);
- idalloctm(tsd_tsdn(tsd), quarantine, NULL, true, true);
- tsd_quarantine_set(tsd, NULL);
- }
-}
diff --git a/memory/jemalloc/src/src/rtree.c b/memory/jemalloc/src/src/rtree.c
deleted file mode 100644
index f2e2997d55..0000000000
--- a/memory/jemalloc/src/src/rtree.c
+++ /dev/null
@@ -1,132 +0,0 @@
-#define JEMALLOC_RTREE_C_
-#include "jemalloc/internal/jemalloc_internal.h"
-
-static unsigned
-hmin(unsigned ha, unsigned hb)
-{
-
- return (ha < hb ? ha : hb);
-}
-
-/* Only the most significant bits of keys passed to rtree_[gs]et() are used. */
-bool
-rtree_new(rtree_t *rtree, unsigned bits, rtree_node_alloc_t *alloc,
- rtree_node_dalloc_t *dalloc)
-{
- unsigned bits_in_leaf, height, i;
-
- assert(RTREE_HEIGHT_MAX == ((ZU(1) << (LG_SIZEOF_PTR+3)) /
- RTREE_BITS_PER_LEVEL));
- assert(bits > 0 && bits <= (sizeof(uintptr_t) << 3));
-
- bits_in_leaf = (bits % RTREE_BITS_PER_LEVEL) == 0 ? RTREE_BITS_PER_LEVEL
- : (bits % RTREE_BITS_PER_LEVEL);
- if (bits > bits_in_leaf) {
- height = 1 + (bits - bits_in_leaf) / RTREE_BITS_PER_LEVEL;
- if ((height-1) * RTREE_BITS_PER_LEVEL + bits_in_leaf != bits)
- height++;
- } else
- height = 1;
- assert((height-1) * RTREE_BITS_PER_LEVEL + bits_in_leaf == bits);
-
- rtree->alloc = alloc;
- rtree->dalloc = dalloc;
- rtree->height = height;
-
- /* Root level. */
- rtree->levels[0].subtree = NULL;
- rtree->levels[0].bits = (height > 1) ? RTREE_BITS_PER_LEVEL :
- bits_in_leaf;
- rtree->levels[0].cumbits = rtree->levels[0].bits;
- /* Interior levels. */
- for (i = 1; i < height-1; i++) {
- rtree->levels[i].subtree = NULL;
- rtree->levels[i].bits = RTREE_BITS_PER_LEVEL;
- rtree->levels[i].cumbits = rtree->levels[i-1].cumbits +
- RTREE_BITS_PER_LEVEL;
- }
- /* Leaf level. */
- if (height > 1) {
- rtree->levels[height-1].subtree = NULL;
- rtree->levels[height-1].bits = bits_in_leaf;
- rtree->levels[height-1].cumbits = bits;
- }
-
- /* Compute lookup table to be used by rtree_start_level(). */
- for (i = 0; i < RTREE_HEIGHT_MAX; i++) {
- rtree->start_level[i] = hmin(RTREE_HEIGHT_MAX - 1 - i, height -
- 1);
- }
-
- return (false);
-}
-
-static void
-rtree_delete_subtree(rtree_t *rtree, rtree_node_elm_t *node, unsigned level)
-{
-
- if (level + 1 < rtree->height) {
- size_t nchildren, i;
-
- nchildren = ZU(1) << rtree->levels[level].bits;
- for (i = 0; i < nchildren; i++) {
- rtree_node_elm_t *child = node[i].child;
- if (child != NULL)
- rtree_delete_subtree(rtree, child, level + 1);
- }
- }
- rtree->dalloc(node);
-}
-
-void
-rtree_delete(rtree_t *rtree)
-{
- unsigned i;
-
- for (i = 0; i < rtree->height; i++) {
- rtree_node_elm_t *subtree = rtree->levels[i].subtree;
- if (subtree != NULL)
- rtree_delete_subtree(rtree, subtree, i);
- }
-}
-
-static rtree_node_elm_t *
-rtree_node_init(rtree_t *rtree, unsigned level, rtree_node_elm_t **elmp)
-{
- rtree_node_elm_t *node;
-
- if (atomic_cas_p((void **)elmp, NULL, RTREE_NODE_INITIALIZING)) {
- spin_t spinner;
-
- /*
- * Another thread is already in the process of initializing.
- * Spin-wait until initialization is complete.
- */
- spin_init(&spinner);
- do {
- spin_adaptive(&spinner);
- node = atomic_read_p((void **)elmp);
- } while (node == RTREE_NODE_INITIALIZING);
- } else {
- node = rtree->alloc(ZU(1) << rtree->levels[level].bits);
- if (node == NULL)
- return (NULL);
- atomic_write_p((void **)elmp, node);
- }
-
- return (node);
-}
-
-rtree_node_elm_t *
-rtree_subtree_read_hard(rtree_t *rtree, unsigned level)
-{
-
- return (rtree_node_init(rtree, level, &rtree->levels[level].subtree));
-}
-
-rtree_node_elm_t *
-rtree_child_read_hard(rtree_t *rtree, rtree_node_elm_t *elm, unsigned level)
-{
-
- return (rtree_node_init(rtree, level+1, &elm->child));
-}
diff --git a/memory/jemalloc/src/src/spin.c b/memory/jemalloc/src/src/spin.c
deleted file mode 100644
index 5242d95aa1..0000000000
--- a/memory/jemalloc/src/src/spin.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define JEMALLOC_SPIN_C_
-#include "jemalloc/internal/jemalloc_internal.h"
diff --git a/memory/jemalloc/src/src/stats.c b/memory/jemalloc/src/src/stats.c
deleted file mode 100644
index bd8af3999b..0000000000
--- a/memory/jemalloc/src/src/stats.c
+++ /dev/null
@@ -1,1153 +0,0 @@
-#define JEMALLOC_STATS_C_
-#include "jemalloc/internal/jemalloc_internal.h"
-
-#define CTL_GET(n, v, t) do { \
- size_t sz = sizeof(t); \
- xmallctl(n, v, &sz, NULL, 0); \
-} while (0)
-
-#define CTL_M2_GET(n, i, v, t) do { \
- size_t mib[6]; \
- size_t miblen = sizeof(mib) / sizeof(size_t); \
- size_t sz = sizeof(t); \
- xmallctlnametomib(n, mib, &miblen); \
- mib[2] = (i); \
- xmallctlbymib(mib, miblen, v, &sz, NULL, 0); \
-} while (0)
-
-#define CTL_M2_M4_GET(n, i, j, v, t) do { \
- size_t mib[6]; \
- size_t miblen = sizeof(mib) / sizeof(size_t); \
- size_t sz = sizeof(t); \
- xmallctlnametomib(n, mib, &miblen); \
- mib[2] = (i); \
- mib[4] = (j); \
- xmallctlbymib(mib, miblen, v, &sz, NULL, 0); \
-} while (0)
-
-/******************************************************************************/
-/* Data. */
-
-bool opt_stats_print = false;
-
-size_t stats_cactive = 0;
-
-/******************************************************************************/
-
-static void
-stats_arena_bins_print(void (*write_cb)(void *, const char *), void *cbopaque,
- bool json, bool large, bool huge, unsigned i)
-{
- size_t page;
- bool config_tcache, in_gap, in_gap_prev;
- unsigned nbins, j;
-
- CTL_GET("arenas.page", &page, size_t);
-
- CTL_GET("arenas.nbins", &nbins, unsigned);
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\"bins\": [\n");
- } else {
- CTL_GET("config.tcache", &config_tcache, bool);
- if (config_tcache) {
- malloc_cprintf(write_cb, cbopaque,
- "bins: size ind allocated nmalloc"
- " ndalloc nrequests curregs"
- " curruns regs pgs util nfills"
- " nflushes newruns reruns\n");
- } else {
- malloc_cprintf(write_cb, cbopaque,
- "bins: size ind allocated nmalloc"
- " ndalloc nrequests curregs"
- " curruns regs pgs util newruns"
- " reruns\n");
- }
- }
- for (j = 0, in_gap = false; j < nbins; j++) {
- uint64_t nruns;
- size_t reg_size, run_size, curregs;
- size_t curruns;
- uint32_t nregs;
- uint64_t nmalloc, ndalloc, nrequests, nfills, nflushes;
- uint64_t nreruns;
-
- CTL_M2_M4_GET("stats.arenas.0.bins.0.nruns", i, j, &nruns,
- uint64_t);
- in_gap_prev = in_gap;
- in_gap = (nruns == 0);
-
- if (!json && in_gap_prev && !in_gap) {
- malloc_cprintf(write_cb, cbopaque,
- " ---\n");
- }
-
- CTL_M2_GET("arenas.bin.0.size", j, &reg_size, size_t);
- CTL_M2_GET("arenas.bin.0.nregs", j, &nregs, uint32_t);
- CTL_M2_GET("arenas.bin.0.run_size", j, &run_size, size_t);
-
- CTL_M2_M4_GET("stats.arenas.0.bins.0.nmalloc", i, j, &nmalloc,
- uint64_t);
- CTL_M2_M4_GET("stats.arenas.0.bins.0.ndalloc", i, j, &ndalloc,
- uint64_t);
- CTL_M2_M4_GET("stats.arenas.0.bins.0.curregs", i, j, &curregs,
- size_t);
- CTL_M2_M4_GET("stats.arenas.0.bins.0.nrequests", i, j,
- &nrequests, uint64_t);
- if (config_tcache) {
- CTL_M2_M4_GET("stats.arenas.0.bins.0.nfills", i, j,
- &nfills, uint64_t);
- CTL_M2_M4_GET("stats.arenas.0.bins.0.nflushes", i, j,
- &nflushes, uint64_t);
- }
- CTL_M2_M4_GET("stats.arenas.0.bins.0.nreruns", i, j, &nreruns,
- uint64_t);
- CTL_M2_M4_GET("stats.arenas.0.bins.0.curruns", i, j, &curruns,
- size_t);
-
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\t{\n"
- "\t\t\t\t\t\t\"nmalloc\": %"FMTu64",\n"
- "\t\t\t\t\t\t\"ndalloc\": %"FMTu64",\n"
- "\t\t\t\t\t\t\"curregs\": %zu,\n"
- "\t\t\t\t\t\t\"nrequests\": %"FMTu64",\n",
- nmalloc,
- ndalloc,
- curregs,
- nrequests);
- if (config_tcache) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\t\t\"nfills\": %"FMTu64",\n"
- "\t\t\t\t\t\t\"nflushes\": %"FMTu64",\n",
- nfills,
- nflushes);
- }
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\t\t\"nreruns\": %"FMTu64",\n"
- "\t\t\t\t\t\t\"curruns\": %zu\n"
- "\t\t\t\t\t}%s\n",
- nreruns,
- curruns,
- (j + 1 < nbins) ? "," : "");
- } else if (!in_gap) {
- size_t availregs, milli;
- char util[6]; /* "x.yyy". */
-
- availregs = nregs * curruns;
- milli = (availregs != 0) ? (1000 * curregs) / availregs
- : 1000;
- assert(milli <= 1000);
- if (milli < 10) {
- malloc_snprintf(util, sizeof(util),
- "0.00%zu", milli);
- } else if (milli < 100) {
- malloc_snprintf(util, sizeof(util), "0.0%zu",
- milli);
- } else if (milli < 1000) {
- malloc_snprintf(util, sizeof(util), "0.%zu",
- milli);
- } else
- malloc_snprintf(util, sizeof(util), "1");
-
- if (config_tcache) {
- malloc_cprintf(write_cb, cbopaque,
- "%20zu %3u %12zu %12"FMTu64
- " %12"FMTu64" %12"FMTu64" %12zu"
- " %12zu %4u %3zu %-5s %12"FMTu64
- " %12"FMTu64" %12"FMTu64" %12"FMTu64"\n",
- reg_size, j, curregs * reg_size, nmalloc,
- ndalloc, nrequests, curregs, curruns, nregs,
- run_size / page, util, nfills, nflushes,
- nruns, nreruns);
- } else {
- malloc_cprintf(write_cb, cbopaque,
- "%20zu %3u %12zu %12"FMTu64
- " %12"FMTu64" %12"FMTu64" %12zu"
- " %12zu %4u %3zu %-5s %12"FMTu64
- " %12"FMTu64"\n",
- reg_size, j, curregs * reg_size, nmalloc,
- ndalloc, nrequests, curregs, curruns, nregs,
- run_size / page, util, nruns, nreruns);
- }
- }
- }
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t]%s\n", (large || huge) ? "," : "");
- } else {
- if (in_gap) {
- malloc_cprintf(write_cb, cbopaque,
- " ---\n");
- }
- }
-}
-
-static void
-stats_arena_lruns_print(void (*write_cb)(void *, const char *), void *cbopaque,
- bool json, bool huge, unsigned i)
-{
- unsigned nbins, nlruns, j;
- bool in_gap, in_gap_prev;
-
- CTL_GET("arenas.nbins", &nbins, unsigned);
- CTL_GET("arenas.nlruns", &nlruns, unsigned);
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\"lruns\": [\n");
- } else {
- malloc_cprintf(write_cb, cbopaque,
- "large: size ind allocated nmalloc"
- " ndalloc nrequests curruns\n");
- }
- for (j = 0, in_gap = false; j < nlruns; j++) {
- uint64_t nmalloc, ndalloc, nrequests;
- size_t run_size, curruns;
-
- CTL_M2_M4_GET("stats.arenas.0.lruns.0.nmalloc", i, j, &nmalloc,
- uint64_t);
- CTL_M2_M4_GET("stats.arenas.0.lruns.0.ndalloc", i, j, &ndalloc,
- uint64_t);
- CTL_M2_M4_GET("stats.arenas.0.lruns.0.nrequests", i, j,
- &nrequests, uint64_t);
- in_gap_prev = in_gap;
- in_gap = (nrequests == 0);
-
- if (!json && in_gap_prev && !in_gap) {
- malloc_cprintf(write_cb, cbopaque,
- " ---\n");
- }
-
- CTL_M2_GET("arenas.lrun.0.size", j, &run_size, size_t);
- CTL_M2_M4_GET("stats.arenas.0.lruns.0.curruns", i, j, &curruns,
- size_t);
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\t{\n"
- "\t\t\t\t\t\t\"curruns\": %zu\n"
- "\t\t\t\t\t}%s\n",
- curruns,
- (j + 1 < nlruns) ? "," : "");
- } else if (!in_gap) {
- malloc_cprintf(write_cb, cbopaque,
- "%20zu %3u %12zu %12"FMTu64" %12"FMTu64
- " %12"FMTu64" %12zu\n",
- run_size, nbins + j, curruns * run_size, nmalloc,
- ndalloc, nrequests, curruns);
- }
- }
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t]%s\n", huge ? "," : "");
- } else {
- if (in_gap) {
- malloc_cprintf(write_cb, cbopaque,
- " ---\n");
- }
- }
-}
-
-static void
-stats_arena_hchunks_print(void (*write_cb)(void *, const char *),
- void *cbopaque, bool json, unsigned i)
-{
- unsigned nbins, nlruns, nhchunks, j;
- bool in_gap, in_gap_prev;
-
- CTL_GET("arenas.nbins", &nbins, unsigned);
- CTL_GET("arenas.nlruns", &nlruns, unsigned);
- CTL_GET("arenas.nhchunks", &nhchunks, unsigned);
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\"hchunks\": [\n");
- } else {
- malloc_cprintf(write_cb, cbopaque,
- "huge: size ind allocated nmalloc"
- " ndalloc nrequests curhchunks\n");
- }
- for (j = 0, in_gap = false; j < nhchunks; j++) {
- uint64_t nmalloc, ndalloc, nrequests;
- size_t hchunk_size, curhchunks;
-
- CTL_M2_M4_GET("stats.arenas.0.hchunks.0.nmalloc", i, j,
- &nmalloc, uint64_t);
- CTL_M2_M4_GET("stats.arenas.0.hchunks.0.ndalloc", i, j,
- &ndalloc, uint64_t);
- CTL_M2_M4_GET("stats.arenas.0.hchunks.0.nrequests", i, j,
- &nrequests, uint64_t);
- in_gap_prev = in_gap;
- in_gap = (nrequests == 0);
-
- if (!json && in_gap_prev && !in_gap) {
- malloc_cprintf(write_cb, cbopaque,
- " ---\n");
- }
-
- CTL_M2_GET("arenas.hchunk.0.size", j, &hchunk_size, size_t);
- CTL_M2_M4_GET("stats.arenas.0.hchunks.0.curhchunks", i, j,
- &curhchunks, size_t);
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\t{\n"
- "\t\t\t\t\t\t\"curhchunks\": %zu\n"
- "\t\t\t\t\t}%s\n",
- curhchunks,
- (j + 1 < nhchunks) ? "," : "");
- } else if (!in_gap) {
- malloc_cprintf(write_cb, cbopaque,
- "%20zu %3u %12zu %12"FMTu64" %12"FMTu64
- " %12"FMTu64" %12zu\n",
- hchunk_size, nbins + nlruns + j,
- curhchunks * hchunk_size, nmalloc, ndalloc,
- nrequests, curhchunks);
- }
- }
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t]\n");
- } else {
- if (in_gap) {
- malloc_cprintf(write_cb, cbopaque,
- " ---\n");
- }
- }
-}
-
-static void
-stats_arena_print(void (*write_cb)(void *, const char *), void *cbopaque,
- bool json, unsigned i, bool bins, bool large, bool huge)
-{
- unsigned nthreads;
- const char *dss;
- ssize_t lg_dirty_mult, decay_time;
- size_t page, pactive, pdirty, mapped, retained;
- size_t metadata_mapped, metadata_allocated;
- uint64_t npurge, nmadvise, purged;
- size_t small_allocated;
- uint64_t small_nmalloc, small_ndalloc, small_nrequests;
- size_t large_allocated;
- uint64_t large_nmalloc, large_ndalloc, large_nrequests;
- size_t huge_allocated;
- uint64_t huge_nmalloc, huge_ndalloc, huge_nrequests;
-
- CTL_GET("arenas.page", &page, size_t);
-
- CTL_M2_GET("stats.arenas.0.nthreads", i, &nthreads, unsigned);
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\"nthreads\": %u,\n", nthreads);
- } else {
- malloc_cprintf(write_cb, cbopaque,
- "assigned threads: %u\n", nthreads);
- }
-
- CTL_M2_GET("stats.arenas.0.dss", i, &dss, const char *);
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\"dss\": \"%s\",\n", dss);
- } else {
- malloc_cprintf(write_cb, cbopaque,
- "dss allocation precedence: %s\n", dss);
- }
-
- CTL_M2_GET("stats.arenas.0.lg_dirty_mult", i, &lg_dirty_mult, ssize_t);
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\"lg_dirty_mult\": %zd,\n", lg_dirty_mult);
- } else {
- if (opt_purge == purge_mode_ratio) {
- if (lg_dirty_mult >= 0) {
- malloc_cprintf(write_cb, cbopaque,
- "min active:dirty page ratio: %u:1\n",
- (1U << lg_dirty_mult));
- } else {
- malloc_cprintf(write_cb, cbopaque,
- "min active:dirty page ratio: N/A\n");
- }
- }
- }
-
- CTL_M2_GET("stats.arenas.0.decay_time", i, &decay_time, ssize_t);
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\"decay_time\": %zd,\n", decay_time);
- } else {
- if (opt_purge == purge_mode_decay) {
- if (decay_time >= 0) {
- malloc_cprintf(write_cb, cbopaque,
- "decay time: %zd\n", decay_time);
- } else {
- malloc_cprintf(write_cb, cbopaque,
- "decay time: N/A\n");
- }
- }
- }
-
- CTL_M2_GET("stats.arenas.0.pactive", i, &pactive, size_t);
- CTL_M2_GET("stats.arenas.0.pdirty", i, &pdirty, size_t);
- CTL_M2_GET("stats.arenas.0.npurge", i, &npurge, uint64_t);
- CTL_M2_GET("stats.arenas.0.nmadvise", i, &nmadvise, uint64_t);
- CTL_M2_GET("stats.arenas.0.purged", i, &purged, uint64_t);
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\"pactive\": %zu,\n", pactive);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\"pdirty\": %zu,\n", pdirty);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\"npurge\": %"FMTu64",\n", npurge);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\"nmadvise\": %"FMTu64",\n", nmadvise);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\"purged\": %"FMTu64",\n", purged);
- } else {
- malloc_cprintf(write_cb, cbopaque,
- "purging: dirty: %zu, sweeps: %"FMTu64", madvises: %"FMTu64
- ", purged: %"FMTu64"\n", pdirty, npurge, nmadvise, purged);
- }
-
- CTL_M2_GET("stats.arenas.0.small.allocated", i, &small_allocated,
- size_t);
- CTL_M2_GET("stats.arenas.0.small.nmalloc", i, &small_nmalloc, uint64_t);
- CTL_M2_GET("stats.arenas.0.small.ndalloc", i, &small_ndalloc, uint64_t);
- CTL_M2_GET("stats.arenas.0.small.nrequests", i, &small_nrequests,
- uint64_t);
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\"small\": {\n");
-
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\t\"allocated\": %zu,\n", small_allocated);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\t\"nmalloc\": %"FMTu64",\n", small_nmalloc);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\t\"ndalloc\": %"FMTu64",\n", small_ndalloc);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\t\"nrequests\": %"FMTu64"\n", small_nrequests);
-
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t},\n");
- } else {
- malloc_cprintf(write_cb, cbopaque,
- " allocated nmalloc"
- " ndalloc nrequests\n");
- malloc_cprintf(write_cb, cbopaque,
- "small: %12zu %12"FMTu64" %12"FMTu64
- " %12"FMTu64"\n",
- small_allocated, small_nmalloc, small_ndalloc,
- small_nrequests);
- }
-
- CTL_M2_GET("stats.arenas.0.large.allocated", i, &large_allocated,
- size_t);
- CTL_M2_GET("stats.arenas.0.large.nmalloc", i, &large_nmalloc, uint64_t);
- CTL_M2_GET("stats.arenas.0.large.ndalloc", i, &large_ndalloc, uint64_t);
- CTL_M2_GET("stats.arenas.0.large.nrequests", i, &large_nrequests,
- uint64_t);
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\"large\": {\n");
-
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\t\"allocated\": %zu,\n", large_allocated);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\t\"nmalloc\": %"FMTu64",\n", large_nmalloc);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\t\"ndalloc\": %"FMTu64",\n", large_ndalloc);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\t\"nrequests\": %"FMTu64"\n", large_nrequests);
-
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t},\n");
- } else {
- malloc_cprintf(write_cb, cbopaque,
- "large: %12zu %12"FMTu64" %12"FMTu64
- " %12"FMTu64"\n",
- large_allocated, large_nmalloc, large_ndalloc,
- large_nrequests);
- }
-
- CTL_M2_GET("stats.arenas.0.huge.allocated", i, &huge_allocated, size_t);
- CTL_M2_GET("stats.arenas.0.huge.nmalloc", i, &huge_nmalloc, uint64_t);
- CTL_M2_GET("stats.arenas.0.huge.ndalloc", i, &huge_ndalloc, uint64_t);
- CTL_M2_GET("stats.arenas.0.huge.nrequests", i, &huge_nrequests,
- uint64_t);
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\"huge\": {\n");
-
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\t\"allocated\": %zu,\n", huge_allocated);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\t\"nmalloc\": %"FMTu64",\n", huge_nmalloc);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\t\"ndalloc\": %"FMTu64",\n", huge_ndalloc);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\t\"nrequests\": %"FMTu64"\n", huge_nrequests);
-
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t},\n");
- } else {
- malloc_cprintf(write_cb, cbopaque,
- "huge: %12zu %12"FMTu64" %12"FMTu64
- " %12"FMTu64"\n",
- huge_allocated, huge_nmalloc, huge_ndalloc, huge_nrequests);
- malloc_cprintf(write_cb, cbopaque,
- "total: %12zu %12"FMTu64" %12"FMTu64
- " %12"FMTu64"\n",
- small_allocated + large_allocated + huge_allocated,
- small_nmalloc + large_nmalloc + huge_nmalloc,
- small_ndalloc + large_ndalloc + huge_ndalloc,
- small_nrequests + large_nrequests + huge_nrequests);
- }
- if (!json) {
- malloc_cprintf(write_cb, cbopaque,
- "active: %12zu\n", pactive * page);
- }
-
- CTL_M2_GET("stats.arenas.0.mapped", i, &mapped, size_t);
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\"mapped\": %zu,\n", mapped);
- } else {
- malloc_cprintf(write_cb, cbopaque,
- "mapped: %12zu\n", mapped);
- }
-
- CTL_M2_GET("stats.arenas.0.retained", i, &retained, size_t);
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\"retained\": %zu,\n", retained);
- } else {
- malloc_cprintf(write_cb, cbopaque,
- "retained: %12zu\n", retained);
- }
-
- CTL_M2_GET("stats.arenas.0.metadata.mapped", i, &metadata_mapped,
- size_t);
- CTL_M2_GET("stats.arenas.0.metadata.allocated", i, &metadata_allocated,
- size_t);
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\"metadata\": {\n");
-
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\t\"mapped\": %zu,\n", metadata_mapped);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\t\"allocated\": %zu\n", metadata_allocated);
-
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t},\n");
- } else {
- malloc_cprintf(write_cb, cbopaque,
- "metadata: mapped: %zu, allocated: %zu\n",
- metadata_mapped, metadata_allocated);
- }
-
- if (bins) {
- stats_arena_bins_print(write_cb, cbopaque, json, large, huge,
- i);
- }
- if (large)
- stats_arena_lruns_print(write_cb, cbopaque, json, huge, i);
- if (huge)
- stats_arena_hchunks_print(write_cb, cbopaque, json, i);
-}
-
-static void
-stats_general_print(void (*write_cb)(void *, const char *), void *cbopaque,
- bool json, bool merged, bool unmerged)
-{
- const char *cpv;
- bool bv;
- unsigned uv;
- uint32_t u32v;
- uint64_t u64v;
- ssize_t ssv;
- size_t sv, bsz, usz, ssz, sssz, cpsz;
-
- bsz = sizeof(bool);
- usz = sizeof(unsigned);
- ssz = sizeof(size_t);
- sssz = sizeof(ssize_t);
- cpsz = sizeof(const char *);
-
- CTL_GET("version", &cpv, const char *);
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\"version\": \"%s\",\n", cpv);
- } else
- malloc_cprintf(write_cb, cbopaque, "Version: %s\n", cpv);
-
- /* config. */
-#define CONFIG_WRITE_BOOL_JSON(n, c) \
- if (json) { \
- CTL_GET("config."#n, &bv, bool); \
- malloc_cprintf(write_cb, cbopaque, \
- "\t\t\t\""#n"\": %s%s\n", bv ? "true" : "false", \
- (c)); \
- }
-
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\"config\": {\n");
- }
-
- CONFIG_WRITE_BOOL_JSON(cache_oblivious, ",")
-
- CTL_GET("config.debug", &bv, bool);
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"debug\": %s,\n", bv ? "true" : "false");
- } else {
- malloc_cprintf(write_cb, cbopaque, "Assertions %s\n",
- bv ? "enabled" : "disabled");
- }
-
- CONFIG_WRITE_BOOL_JSON(fill, ",")
- CONFIG_WRITE_BOOL_JSON(lazy_lock, ",")
-
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"malloc_conf\": \"%s\",\n",
- config_malloc_conf);
- } else {
- malloc_cprintf(write_cb, cbopaque,
- "config.malloc_conf: \"%s\"\n", config_malloc_conf);
- }
-
- CONFIG_WRITE_BOOL_JSON(munmap, ",")
- CONFIG_WRITE_BOOL_JSON(prof, ",")
- CONFIG_WRITE_BOOL_JSON(prof_libgcc, ",")
- CONFIG_WRITE_BOOL_JSON(prof_libunwind, ",")
- CONFIG_WRITE_BOOL_JSON(stats, ",")
- CONFIG_WRITE_BOOL_JSON(tcache, ",")
- CONFIG_WRITE_BOOL_JSON(tls, ",")
- CONFIG_WRITE_BOOL_JSON(utrace, ",")
- CONFIG_WRITE_BOOL_JSON(valgrind, ",")
- CONFIG_WRITE_BOOL_JSON(xmalloc, "")
-
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t},\n");
- }
-#undef CONFIG_WRITE_BOOL_JSON
-
- /* opt. */
-#define OPT_WRITE_BOOL(n, c) \
- if (je_mallctl("opt."#n, (void *)&bv, &bsz, NULL, 0) == 0) { \
- if (json) { \
- malloc_cprintf(write_cb, cbopaque, \
- "\t\t\t\""#n"\": %s%s\n", bv ? "true" : \
- "false", (c)); \
- } else { \
- malloc_cprintf(write_cb, cbopaque, \
- " opt."#n": %s\n", bv ? "true" : "false"); \
- } \
- }
-#define OPT_WRITE_BOOL_MUTABLE(n, m, c) { \
- bool bv2; \
- if (je_mallctl("opt."#n, (void *)&bv, &bsz, NULL, 0) == 0 && \
- je_mallctl(#m, &bv2, &bsz, NULL, 0) == 0) { \
- if (json) { \
- malloc_cprintf(write_cb, cbopaque, \
- "\t\t\t\""#n"\": %s%s\n", bv ? "true" : \
- "false", (c)); \
- } else { \
- malloc_cprintf(write_cb, cbopaque, \
- " opt."#n": %s ("#m": %s)\n", bv ? "true" \
- : "false", bv2 ? "true" : "false"); \
- } \
- } \
-}
-#define OPT_WRITE_UNSIGNED(n, c) \
- if (je_mallctl("opt."#n, (void *)&uv, &usz, NULL, 0) == 0) { \
- if (json) { \
- malloc_cprintf(write_cb, cbopaque, \
- "\t\t\t\""#n"\": %u%s\n", uv, (c)); \
- } else { \
- malloc_cprintf(write_cb, cbopaque, \
- " opt."#n": %u\n", uv); \
- } \
- }
-#define OPT_WRITE_SIZE_T(n, c) \
- if (je_mallctl("opt."#n, (void *)&sv, &ssz, NULL, 0) == 0) { \
- if (json) { \
- malloc_cprintf(write_cb, cbopaque, \
- "\t\t\t\""#n"\": %zu%s\n", sv, (c)); \
- } else { \
- malloc_cprintf(write_cb, cbopaque, \
- " opt."#n": %zu\n", sv); \
- } \
- }
-#define OPT_WRITE_SSIZE_T(n, c) \
- if (je_mallctl("opt."#n, (void *)&ssv, &sssz, NULL, 0) == 0) { \
- if (json) { \
- malloc_cprintf(write_cb, cbopaque, \
- "\t\t\t\""#n"\": %zd%s\n", ssv, (c)); \
- } else { \
- malloc_cprintf(write_cb, cbopaque, \
- " opt."#n": %zd\n", ssv); \
- } \
- }
-#define OPT_WRITE_SSIZE_T_MUTABLE(n, m, c) { \
- ssize_t ssv2; \
- if (je_mallctl("opt."#n, (void *)&ssv, &sssz, NULL, 0) == 0 && \
- je_mallctl(#m, &ssv2, &sssz, NULL, 0) == 0) { \
- if (json) { \
- malloc_cprintf(write_cb, cbopaque, \
- "\t\t\t\""#n"\": %zd%s\n", ssv, (c)); \
- } else { \
- malloc_cprintf(write_cb, cbopaque, \
- " opt."#n": %zd ("#m": %zd)\n", \
- ssv, ssv2); \
- } \
- } \
-}
-#define OPT_WRITE_CHAR_P(n, c) \
- if (je_mallctl("opt."#n, (void *)&cpv, &cpsz, NULL, 0) == 0) { \
- if (json) { \
- malloc_cprintf(write_cb, cbopaque, \
- "\t\t\t\""#n"\": \"%s\"%s\n", cpv, (c)); \
- } else { \
- malloc_cprintf(write_cb, cbopaque, \
- " opt."#n": \"%s\"\n", cpv); \
- } \
- }
-
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\"opt\": {\n");
- } else {
- malloc_cprintf(write_cb, cbopaque,
- "Run-time option settings:\n");
- }
- OPT_WRITE_BOOL(abort, ",")
- OPT_WRITE_SIZE_T(lg_chunk, ",")
- OPT_WRITE_CHAR_P(dss, ",")
- OPT_WRITE_UNSIGNED(narenas, ",")
- OPT_WRITE_CHAR_P(purge, ",")
- if (json || opt_purge == purge_mode_ratio) {
- OPT_WRITE_SSIZE_T_MUTABLE(lg_dirty_mult,
- arenas.lg_dirty_mult, ",")
- }
- if (json || opt_purge == purge_mode_decay) {
- OPT_WRITE_SSIZE_T_MUTABLE(decay_time, arenas.decay_time, ",")
- }
- OPT_WRITE_CHAR_P(junk, ",")
- OPT_WRITE_SIZE_T(quarantine, ",")
- OPT_WRITE_BOOL(redzone, ",")
- OPT_WRITE_BOOL(zero, ",")
- OPT_WRITE_BOOL(utrace, ",")
- OPT_WRITE_BOOL(xmalloc, ",")
- OPT_WRITE_BOOL(tcache, ",")
- OPT_WRITE_SSIZE_T(lg_tcache_max, ",")
- OPT_WRITE_BOOL(prof, ",")
- OPT_WRITE_CHAR_P(prof_prefix, ",")
- OPT_WRITE_BOOL_MUTABLE(prof_active, prof.active, ",")
- OPT_WRITE_BOOL_MUTABLE(prof_thread_active_init, prof.thread_active_init,
- ",")
- OPT_WRITE_SSIZE_T_MUTABLE(lg_prof_sample, prof.lg_sample, ",")
- OPT_WRITE_BOOL(prof_accum, ",")
- OPT_WRITE_SSIZE_T(lg_prof_interval, ",")
- OPT_WRITE_BOOL(prof_gdump, ",")
- OPT_WRITE_BOOL(prof_final, ",")
- OPT_WRITE_BOOL(prof_leak, ",")
- /*
- * stats_print is always emitted, so as long as stats_print comes last
- * it's safe to unconditionally omit the comma here (rather than having
- * to conditionally omit it elsewhere depending on configuration).
- */
- OPT_WRITE_BOOL(stats_print, "")
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t},\n");
- }
-
-#undef OPT_WRITE_BOOL
-#undef OPT_WRITE_BOOL_MUTABLE
-#undef OPT_WRITE_SIZE_T
-#undef OPT_WRITE_SSIZE_T
-#undef OPT_WRITE_CHAR_P
-
- /* arenas. */
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\"arenas\": {\n");
- }
-
- CTL_GET("arenas.narenas", &uv, unsigned);
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"narenas\": %u,\n", uv);
- } else
- malloc_cprintf(write_cb, cbopaque, "Arenas: %u\n", uv);
-
- CTL_GET("arenas.lg_dirty_mult", &ssv, ssize_t);
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"lg_dirty_mult\": %zd,\n", ssv);
- } else if (opt_purge == purge_mode_ratio) {
- if (ssv >= 0) {
- malloc_cprintf(write_cb, cbopaque,
- "Min active:dirty page ratio per arena: "
- "%u:1\n", (1U << ssv));
- } else {
- malloc_cprintf(write_cb, cbopaque,
- "Min active:dirty page ratio per arena: "
- "N/A\n");
- }
- }
- CTL_GET("arenas.decay_time", &ssv, ssize_t);
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"decay_time\": %zd,\n", ssv);
- } else if (opt_purge == purge_mode_decay) {
- malloc_cprintf(write_cb, cbopaque,
- "Unused dirty page decay time: %zd%s\n",
- ssv, (ssv < 0) ? " (no decay)" : "");
- }
-
- CTL_GET("arenas.quantum", &sv, size_t);
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"quantum\": %zu,\n", sv);
- } else
- malloc_cprintf(write_cb, cbopaque, "Quantum size: %zu\n", sv);
-
- CTL_GET("arenas.page", &sv, size_t);
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"page\": %zu,\n", sv);
- } else
- malloc_cprintf(write_cb, cbopaque, "Page size: %zu\n", sv);
-
- if (je_mallctl("arenas.tcache_max", (void *)&sv, &ssz, NULL, 0) == 0) {
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"tcache_max\": %zu,\n", sv);
- } else {
- malloc_cprintf(write_cb, cbopaque,
- "Maximum thread-cached size class: %zu\n", sv);
- }
- }
-
- if (json) {
- unsigned nbins, nlruns, nhchunks, i;
-
- CTL_GET("arenas.nbins", &nbins, unsigned);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"nbins\": %u,\n", nbins);
-
- CTL_GET("arenas.nhbins", &uv, unsigned);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"nhbins\": %u,\n", uv);
-
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"bin\": [\n");
- for (i = 0; i < nbins; i++) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t{\n");
-
- CTL_M2_GET("arenas.bin.0.size", i, &sv, size_t);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\t\"size\": %zu,\n", sv);
-
- CTL_M2_GET("arenas.bin.0.nregs", i, &u32v, uint32_t);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\t\"nregs\": %"FMTu32",\n", u32v);
-
- CTL_M2_GET("arenas.bin.0.run_size", i, &sv, size_t);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\t\"run_size\": %zu\n", sv);
-
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t}%s\n", (i + 1 < nbins) ? "," : "");
- }
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t],\n");
-
- CTL_GET("arenas.nlruns", &nlruns, unsigned);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"nlruns\": %u,\n", nlruns);
-
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"lrun\": [\n");
- for (i = 0; i < nlruns; i++) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t{\n");
-
- CTL_M2_GET("arenas.lrun.0.size", i, &sv, size_t);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\t\"size\": %zu\n", sv);
-
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t}%s\n", (i + 1 < nlruns) ? "," : "");
- }
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t],\n");
-
- CTL_GET("arenas.nhchunks", &nhchunks, unsigned);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"nhchunks\": %u,\n", nhchunks);
-
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"hchunk\": [\n");
- for (i = 0; i < nhchunks; i++) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t{\n");
-
- CTL_M2_GET("arenas.hchunk.0.size", i, &sv, size_t);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t\t\"size\": %zu\n", sv);
-
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\t}%s\n", (i + 1 < nhchunks) ? "," : "");
- }
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t]\n");
-
- malloc_cprintf(write_cb, cbopaque,
- "\t\t},\n");
- }
-
- /* prof. */
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\"prof\": {\n");
-
- CTL_GET("prof.thread_active_init", &bv, bool);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"thread_active_init\": %s,\n", bv ? "true" :
- "false");
-
- CTL_GET("prof.active", &bv, bool);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"active\": %s,\n", bv ? "true" : "false");
-
- CTL_GET("prof.gdump", &bv, bool);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"gdump\": %s,\n", bv ? "true" : "false");
-
- CTL_GET("prof.interval", &u64v, uint64_t);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"interval\": %"FMTu64",\n", u64v);
-
- CTL_GET("prof.lg_sample", &ssv, ssize_t);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"lg_sample\": %zd\n", ssv);
-
- malloc_cprintf(write_cb, cbopaque,
- "\t\t}%s\n", (config_stats || merged || unmerged) ? "," :
- "");
- }
-}
-
-static void
-stats_print_helper(void (*write_cb)(void *, const char *), void *cbopaque,
- bool json, bool merged, bool unmerged, bool bins, bool large, bool huge)
-{
- size_t *cactive;
- size_t allocated, active, metadata, resident, mapped, retained;
-
- CTL_GET("stats.cactive", &cactive, size_t *);
- CTL_GET("stats.allocated", &allocated, size_t);
- CTL_GET("stats.active", &active, size_t);
- CTL_GET("stats.metadata", &metadata, size_t);
- CTL_GET("stats.resident", &resident, size_t);
- CTL_GET("stats.mapped", &mapped, size_t);
- CTL_GET("stats.retained", &retained, size_t);
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\"stats\": {\n");
-
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"cactive\": %zu,\n", atomic_read_z(cactive));
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"allocated\": %zu,\n", allocated);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"active\": %zu,\n", active);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"metadata\": %zu,\n", metadata);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"resident\": %zu,\n", resident);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"mapped\": %zu,\n", mapped);
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"retained\": %zu\n", retained);
-
- malloc_cprintf(write_cb, cbopaque,
- "\t\t}%s\n", (merged || unmerged) ? "," : "");
- } else {
- malloc_cprintf(write_cb, cbopaque,
- "Allocated: %zu, active: %zu, metadata: %zu,"
- " resident: %zu, mapped: %zu, retained: %zu\n",
- allocated, active, metadata, resident, mapped, retained);
- malloc_cprintf(write_cb, cbopaque,
- "Current active ceiling: %zu\n",
- atomic_read_z(cactive));
- }
-
- if (merged || unmerged) {
- unsigned narenas;
-
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\"stats.arenas\": {\n");
- }
-
- CTL_GET("arenas.narenas", &narenas, unsigned);
- {
- VARIABLE_ARRAY(bool, initialized, narenas);
- size_t isz;
- unsigned i, j, ninitialized;
-
- isz = sizeof(bool) * narenas;
- xmallctl("arenas.initialized", (void *)initialized,
- &isz, NULL, 0);
- for (i = ninitialized = 0; i < narenas; i++) {
- if (initialized[i])
- ninitialized++;
- }
-
- /* Merged stats. */
- if (merged && (ninitialized > 1 || !unmerged)) {
- /* Print merged arena stats. */
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t\"merged\": {\n");
- } else {
- malloc_cprintf(write_cb, cbopaque,
- "\nMerged arenas stats:\n");
- }
- stats_arena_print(write_cb, cbopaque, json,
- narenas, bins, large, huge);
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t\t}%s\n", (ninitialized > 1) ?
- "," : "");
- }
- }
-
- /* Unmerged stats. */
- for (i = j = 0; i < narenas; i++) {
- if (initialized[i]) {
- if (json) {
- j++;
- malloc_cprintf(write_cb,
- cbopaque,
- "\t\t\t\"%u\": {\n", i);
- } else {
- malloc_cprintf(write_cb,
- cbopaque, "\narenas[%u]:\n",
- i);
- }
- stats_arena_print(write_cb, cbopaque,
- json, i, bins, large, huge);
- if (json) {
- malloc_cprintf(write_cb,
- cbopaque,
- "\t\t\t}%s\n", (j <
- ninitialized) ? "," : "");
- }
- }
- }
- }
-
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t\t}\n");
- }
- }
-}
-
-void
-stats_print(void (*write_cb)(void *, const char *), void *cbopaque,
- const char *opts)
-{
- int err;
- uint64_t epoch;
- size_t u64sz;
- bool json = false;
- bool general = true;
- bool merged = true;
- bool unmerged = true;
- bool bins = true;
- bool large = true;
- bool huge = true;
-
- /*
- * Refresh stats, in case mallctl() was called by the application.
- *
- * Check for OOM here, since refreshing the ctl cache can trigger
- * allocation. In practice, none of the subsequent mallctl()-related
- * calls in this function will cause OOM if this one succeeds.
- * */
- epoch = 1;
- u64sz = sizeof(uint64_t);
- err = je_mallctl("epoch", &epoch, &u64sz, &epoch, sizeof(uint64_t));
- if (err != 0) {
- if (err == EAGAIN) {
- malloc_write("<jemalloc>: Memory allocation failure in "
- "mallctl(\"epoch\", ...)\n");
- return;
- }
- malloc_write("<jemalloc>: Failure in mallctl(\"epoch\", "
- "...)\n");
- abort();
- }
-
- if (opts != NULL) {
- unsigned i;
-
- for (i = 0; opts[i] != '\0'; i++) {
- switch (opts[i]) {
- case 'J':
- json = true;
- break;
- case 'g':
- general = false;
- break;
- case 'm':
- merged = false;
- break;
- case 'a':
- unmerged = false;
- break;
- case 'b':
- bins = false;
- break;
- case 'l':
- large = false;
- break;
- case 'h':
- huge = false;
- break;
- default:;
- }
- }
- }
-
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "{\n"
- "\t\"jemalloc\": {\n");
- } else {
- malloc_cprintf(write_cb, cbopaque,
- "___ Begin jemalloc statistics ___\n");
- }
-
- if (general)
- stats_general_print(write_cb, cbopaque, json, merged, unmerged);
- if (config_stats) {
- stats_print_helper(write_cb, cbopaque, json, merged, unmerged,
- bins, large, huge);
- }
- if (json) {
- malloc_cprintf(write_cb, cbopaque,
- "\t}\n"
- "}\n");
- } else {
- malloc_cprintf(write_cb, cbopaque,
- "--- End jemalloc statistics ---\n");
- }
-}
diff --git a/memory/jemalloc/src/src/tcache.c b/memory/jemalloc/src/src/tcache.c
deleted file mode 100644
index f97aa420ca..0000000000
--- a/memory/jemalloc/src/src/tcache.c
+++ /dev/null
@@ -1,555 +0,0 @@
-#define JEMALLOC_TCACHE_C_
-#include "jemalloc/internal/jemalloc_internal.h"
-
-/******************************************************************************/
-/* Data. */
-
-bool opt_tcache = true;
-ssize_t opt_lg_tcache_max = LG_TCACHE_MAXCLASS_DEFAULT;
-
-tcache_bin_info_t *tcache_bin_info;
-static unsigned stack_nelms; /* Total stack elms per tcache. */
-
-unsigned nhbins;
-size_t tcache_maxclass;
-
-tcaches_t *tcaches;
-
-/* Index of first element within tcaches that has never been used. */
-static unsigned tcaches_past;
-
-/* Head of singly linked list tracking available tcaches elements. */
-static tcaches_t *tcaches_avail;
-
-/******************************************************************************/
-
-size_t
-tcache_salloc(tsdn_t *tsdn, const void *ptr)
-{
-
- return (arena_salloc(tsdn, ptr, false));
-}
-
-void
-tcache_event_hard(tsd_t *tsd, tcache_t *tcache)
-{
- szind_t binind = tcache->next_gc_bin;
- tcache_bin_t *tbin = &tcache->tbins[binind];
- tcache_bin_info_t *tbin_info = &tcache_bin_info[binind];
-
- if (tbin->low_water > 0) {
- /*
- * Flush (ceiling) 3/4 of the objects below the low water mark.
- */
- if (binind < NBINS) {
- tcache_bin_flush_small(tsd, tcache, tbin, binind,
- tbin->ncached - tbin->low_water + (tbin->low_water
- >> 2));
- } else {
- tcache_bin_flush_large(tsd, tbin, binind, tbin->ncached
- - tbin->low_water + (tbin->low_water >> 2), tcache);
- }
- /*
- * Reduce fill count by 2X. Limit lg_fill_div such that the
- * fill count is always at least 1.
- */
- if ((tbin_info->ncached_max >> (tbin->lg_fill_div+1)) >= 1)
- tbin->lg_fill_div++;
- } else if (tbin->low_water < 0) {
- /*
- * Increase fill count by 2X. Make sure lg_fill_div stays
- * greater than 0.
- */
- if (tbin->lg_fill_div > 1)
- tbin->lg_fill_div--;
- }
- tbin->low_water = tbin->ncached;
-
- tcache->next_gc_bin++;
- if (tcache->next_gc_bin == nhbins)
- tcache->next_gc_bin = 0;
-}
-
-void *
-tcache_alloc_small_hard(tsdn_t *tsdn, arena_t *arena, tcache_t *tcache,
- tcache_bin_t *tbin, szind_t binind, bool *tcache_success)
-{
- void *ret;
-
- arena_tcache_fill_small(tsdn, arena, tbin, binind, config_prof ?
- tcache->prof_accumbytes : 0);
- if (config_prof)
- tcache->prof_accumbytes = 0;
- ret = tcache_alloc_easy(tbin, tcache_success);
-
- return (ret);
-}
-
-void
-tcache_bin_flush_small(tsd_t *tsd, tcache_t *tcache, tcache_bin_t *tbin,
- szind_t binind, unsigned rem)
-{
- arena_t *arena;
- void *ptr;
- unsigned i, nflush, ndeferred;
- bool merged_stats = false;
-
- assert(binind < NBINS);
- assert(rem <= tbin->ncached);
-
- arena = arena_choose(tsd, NULL);
- assert(arena != NULL);
- for (nflush = tbin->ncached - rem; nflush > 0; nflush = ndeferred) {
- /* Lock the arena bin associated with the first object. */
- arena_chunk_t *chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(
- *(tbin->avail - 1));
- arena_t *bin_arena = extent_node_arena_get(&chunk->node);
- arena_bin_t *bin = &bin_arena->bins[binind];
-
- if (config_prof && bin_arena == arena) {
- if (arena_prof_accum(tsd_tsdn(tsd), arena,
- tcache->prof_accumbytes))
- prof_idump(tsd_tsdn(tsd));
- tcache->prof_accumbytes = 0;
- }
-
- malloc_mutex_lock(tsd_tsdn(tsd), &bin->lock);
- if (config_stats && bin_arena == arena) {
- assert(!merged_stats);
- merged_stats = true;
- bin->stats.nflushes++;
- bin->stats.nrequests += tbin->tstats.nrequests;
- tbin->tstats.nrequests = 0;
- }
- ndeferred = 0;
- for (i = 0; i < nflush; i++) {
- ptr = *(tbin->avail - 1 - i);
- assert(ptr != NULL);
- chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr);
- if (extent_node_arena_get(&chunk->node) == bin_arena) {
- size_t pageind = ((uintptr_t)ptr -
- (uintptr_t)chunk) >> LG_PAGE;
- arena_chunk_map_bits_t *bitselm =
- arena_bitselm_get_mutable(chunk, pageind);
- arena_dalloc_bin_junked_locked(tsd_tsdn(tsd),
- bin_arena, chunk, ptr, bitselm);
- } else {
- /*
- * This object was allocated via a different
- * arena bin than the one that is currently
- * locked. Stash the object, so that it can be
- * handled in a future pass.
- */
- *(tbin->avail - 1 - ndeferred) = ptr;
- ndeferred++;
- }
- }
- malloc_mutex_unlock(tsd_tsdn(tsd), &bin->lock);
- arena_decay_ticks(tsd_tsdn(tsd), bin_arena, nflush - ndeferred);
- }
- if (config_stats && !merged_stats) {
- /*
- * The flush loop didn't happen to flush to this thread's
- * arena, so the stats didn't get merged. Manually do so now.
- */
- arena_bin_t *bin = &arena->bins[binind];
- malloc_mutex_lock(tsd_tsdn(tsd), &bin->lock);
- bin->stats.nflushes++;
- bin->stats.nrequests += tbin->tstats.nrequests;
- tbin->tstats.nrequests = 0;
- malloc_mutex_unlock(tsd_tsdn(tsd), &bin->lock);
- }
-
- memmove(tbin->avail - rem, tbin->avail - tbin->ncached, rem *
- sizeof(void *));
- tbin->ncached = rem;
- if ((int)tbin->ncached < tbin->low_water)
- tbin->low_water = tbin->ncached;
-}
-
-void
-tcache_bin_flush_large(tsd_t *tsd, tcache_bin_t *tbin, szind_t binind,
- unsigned rem, tcache_t *tcache)
-{
- arena_t *arena;
- void *ptr;
- unsigned i, nflush, ndeferred;
- bool merged_stats = false;
-
- assert(binind < nhbins);
- assert(rem <= tbin->ncached);
-
- arena = arena_choose(tsd, NULL);
- assert(arena != NULL);
- for (nflush = tbin->ncached - rem; nflush > 0; nflush = ndeferred) {
- /* Lock the arena associated with the first object. */
- arena_chunk_t *chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(
- *(tbin->avail - 1));
- arena_t *locked_arena = extent_node_arena_get(&chunk->node);
- UNUSED bool idump;
-
- if (config_prof)
- idump = false;
- malloc_mutex_lock(tsd_tsdn(tsd), &locked_arena->lock);
- if ((config_prof || config_stats) && locked_arena == arena) {
- if (config_prof) {
- idump = arena_prof_accum_locked(arena,
- tcache->prof_accumbytes);
- tcache->prof_accumbytes = 0;
- }
- if (config_stats) {
- merged_stats = true;
- arena->stats.nrequests_large +=
- tbin->tstats.nrequests;
- arena->stats.lstats[binind - NBINS].nrequests +=
- tbin->tstats.nrequests;
- tbin->tstats.nrequests = 0;
- }
- }
- ndeferred = 0;
- for (i = 0; i < nflush; i++) {
- ptr = *(tbin->avail - 1 - i);
- assert(ptr != NULL);
- chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr);
- if (extent_node_arena_get(&chunk->node) ==
- locked_arena) {
- arena_dalloc_large_junked_locked(tsd_tsdn(tsd),
- locked_arena, chunk, ptr);
- } else {
- /*
- * This object was allocated via a different
- * arena than the one that is currently locked.
- * Stash the object, so that it can be handled
- * in a future pass.
- */
- *(tbin->avail - 1 - ndeferred) = ptr;
- ndeferred++;
- }
- }
- malloc_mutex_unlock(tsd_tsdn(tsd), &locked_arena->lock);
- if (config_prof && idump)
- prof_idump(tsd_tsdn(tsd));
- arena_decay_ticks(tsd_tsdn(tsd), locked_arena, nflush -
- ndeferred);
- }
- if (config_stats && !merged_stats) {
- /*
- * The flush loop didn't happen to flush to this thread's
- * arena, so the stats didn't get merged. Manually do so now.
- */
- malloc_mutex_lock(tsd_tsdn(tsd), &arena->lock);
- arena->stats.nrequests_large += tbin->tstats.nrequests;
- arena->stats.lstats[binind - NBINS].nrequests +=
- tbin->tstats.nrequests;
- tbin->tstats.nrequests = 0;
- malloc_mutex_unlock(tsd_tsdn(tsd), &arena->lock);
- }
-
- memmove(tbin->avail - rem, tbin->avail - tbin->ncached, rem *
- sizeof(void *));
- tbin->ncached = rem;
- if ((int)tbin->ncached < tbin->low_water)
- tbin->low_water = tbin->ncached;
-}
-
-static void
-tcache_arena_associate(tsdn_t *tsdn, tcache_t *tcache, arena_t *arena)
-{
-
- if (config_stats) {
- /* Link into list of extant tcaches. */
- malloc_mutex_lock(tsdn, &arena->lock);
- ql_elm_new(tcache, link);
- ql_tail_insert(&arena->tcache_ql, tcache, link);
- malloc_mutex_unlock(tsdn, &arena->lock);
- }
-}
-
-static void
-tcache_arena_dissociate(tsdn_t *tsdn, tcache_t *tcache, arena_t *arena)
-{
-
- if (config_stats) {
- /* Unlink from list of extant tcaches. */
- malloc_mutex_lock(tsdn, &arena->lock);
- if (config_debug) {
- bool in_ql = false;
- tcache_t *iter;
- ql_foreach(iter, &arena->tcache_ql, link) {
- if (iter == tcache) {
- in_ql = true;
- break;
- }
- }
- assert(in_ql);
- }
- ql_remove(&arena->tcache_ql, tcache, link);
- tcache_stats_merge(tsdn, tcache, arena);
- malloc_mutex_unlock(tsdn, &arena->lock);
- }
-}
-
-void
-tcache_arena_reassociate(tsdn_t *tsdn, tcache_t *tcache, arena_t *oldarena,
- arena_t *newarena)
-{
-
- tcache_arena_dissociate(tsdn, tcache, oldarena);
- tcache_arena_associate(tsdn, tcache, newarena);
-}
-
-tcache_t *
-tcache_get_hard(tsd_t *tsd)
-{
- arena_t *arena;
-
- if (!tcache_enabled_get()) {
- if (tsd_nominal(tsd))
- tcache_enabled_set(false); /* Memoize. */
- return (NULL);
- }
- arena = arena_choose(tsd, NULL);
- if (unlikely(arena == NULL))
- return (NULL);
- return (tcache_create(tsd_tsdn(tsd), arena));
-}
-
-tcache_t *
-tcache_create(tsdn_t *tsdn, arena_t *arena)
-{
- tcache_t *tcache;
- size_t size, stack_offset;
- unsigned i;
-
- size = offsetof(tcache_t, tbins) + (sizeof(tcache_bin_t) * nhbins);
- /* Naturally align the pointer stacks. */
- size = PTR_CEILING(size);
- stack_offset = size;
- size += stack_nelms * sizeof(void *);
- /* Avoid false cacheline sharing. */
- size = sa2u(size, CACHELINE);
-
- tcache = ipallocztm(tsdn, size, CACHELINE, true, NULL, true,
- arena_get(TSDN_NULL, 0, true));
- if (tcache == NULL)
- return (NULL);
-
- tcache_arena_associate(tsdn, tcache, arena);
-
- ticker_init(&tcache->gc_ticker, TCACHE_GC_INCR);
-
- assert((TCACHE_NSLOTS_SMALL_MAX & 1U) == 0);
- for (i = 0; i < nhbins; i++) {
- tcache->tbins[i].lg_fill_div = 1;
- stack_offset += tcache_bin_info[i].ncached_max * sizeof(void *);
- /*
- * avail points past the available space. Allocations will
- * access the slots toward higher addresses (for the benefit of
- * prefetch).
- */
- tcache->tbins[i].avail = (void **)((uintptr_t)tcache +
- (uintptr_t)stack_offset);
- }
-
- return (tcache);
-}
-
-static void
-tcache_destroy(tsd_t *tsd, tcache_t *tcache)
-{
- arena_t *arena;
- unsigned i;
-
- arena = arena_choose(tsd, NULL);
- tcache_arena_dissociate(tsd_tsdn(tsd), tcache, arena);
-
- for (i = 0; i < NBINS; i++) {
- tcache_bin_t *tbin = &tcache->tbins[i];
- tcache_bin_flush_small(tsd, tcache, tbin, i, 0);
-
- if (config_stats && tbin->tstats.nrequests != 0) {
- arena_bin_t *bin = &arena->bins[i];
- malloc_mutex_lock(tsd_tsdn(tsd), &bin->lock);
- bin->stats.nrequests += tbin->tstats.nrequests;
- malloc_mutex_unlock(tsd_tsdn(tsd), &bin->lock);
- }
- }
-
- for (; i < nhbins; i++) {
- tcache_bin_t *tbin = &tcache->tbins[i];
- tcache_bin_flush_large(tsd, tbin, i, 0, tcache);
-
- if (config_stats && tbin->tstats.nrequests != 0) {
- malloc_mutex_lock(tsd_tsdn(tsd), &arena->lock);
- arena->stats.nrequests_large += tbin->tstats.nrequests;
- arena->stats.lstats[i - NBINS].nrequests +=
- tbin->tstats.nrequests;
- malloc_mutex_unlock(tsd_tsdn(tsd), &arena->lock);
- }
- }
-
- if (config_prof && tcache->prof_accumbytes > 0 &&
- arena_prof_accum(tsd_tsdn(tsd), arena, tcache->prof_accumbytes))
- prof_idump(tsd_tsdn(tsd));
-
- idalloctm(tsd_tsdn(tsd), tcache, NULL, true, true);
-}
-
-void
-tcache_cleanup(tsd_t *tsd)
-{
- tcache_t *tcache;
-
- if (!config_tcache)
- return;
-
- if ((tcache = tsd_tcache_get(tsd)) != NULL) {
- tcache_destroy(tsd, tcache);
- tsd_tcache_set(tsd, NULL);
- }
-}
-
-void
-tcache_enabled_cleanup(tsd_t *tsd)
-{
-
- /* Do nothing. */
-}
-
-void
-tcache_stats_merge(tsdn_t *tsdn, tcache_t *tcache, arena_t *arena)
-{
- unsigned i;
-
- cassert(config_stats);
-
- malloc_mutex_assert_owner(tsdn, &arena->lock);
-
- /* Merge and reset tcache stats. */
- for (i = 0; i < NBINS; i++) {
- arena_bin_t *bin = &arena->bins[i];
- tcache_bin_t *tbin = &tcache->tbins[i];
- malloc_mutex_lock(tsdn, &bin->lock);
- bin->stats.nrequests += tbin->tstats.nrequests;
- malloc_mutex_unlock(tsdn, &bin->lock);
- tbin->tstats.nrequests = 0;
- }
-
- for (; i < nhbins; i++) {
- malloc_large_stats_t *lstats = &arena->stats.lstats[i - NBINS];
- tcache_bin_t *tbin = &tcache->tbins[i];
- arena->stats.nrequests_large += tbin->tstats.nrequests;
- lstats->nrequests += tbin->tstats.nrequests;
- tbin->tstats.nrequests = 0;
- }
-}
-
-bool
-tcaches_create(tsd_t *tsd, unsigned *r_ind)
-{
- arena_t *arena;
- tcache_t *tcache;
- tcaches_t *elm;
-
- if (tcaches == NULL) {
- tcaches = base_alloc(tsd_tsdn(tsd), sizeof(tcache_t *) *
- (MALLOCX_TCACHE_MAX+1));
- if (tcaches == NULL)
- return (true);
- }
-
- if (tcaches_avail == NULL && tcaches_past > MALLOCX_TCACHE_MAX)
- return (true);
- arena = arena_ichoose(tsd, NULL);
- if (unlikely(arena == NULL))
- return (true);
- tcache = tcache_create(tsd_tsdn(tsd), arena);
- if (tcache == NULL)
- return (true);
-
- if (tcaches_avail != NULL) {
- elm = tcaches_avail;
- tcaches_avail = tcaches_avail->next;
- elm->tcache = tcache;
- *r_ind = (unsigned)(elm - tcaches);
- } else {
- elm = &tcaches[tcaches_past];
- elm->tcache = tcache;
- *r_ind = tcaches_past;
- tcaches_past++;
- }
-
- return (false);
-}
-
-static void
-tcaches_elm_flush(tsd_t *tsd, tcaches_t *elm)
-{
-
- if (elm->tcache == NULL)
- return;
- tcache_destroy(tsd, elm->tcache);
- elm->tcache = NULL;
-}
-
-void
-tcaches_flush(tsd_t *tsd, unsigned ind)
-{
-
- tcaches_elm_flush(tsd, &tcaches[ind]);
-}
-
-void
-tcaches_destroy(tsd_t *tsd, unsigned ind)
-{
- tcaches_t *elm = &tcaches[ind];
- tcaches_elm_flush(tsd, elm);
- elm->next = tcaches_avail;
- tcaches_avail = elm;
-}
-
-bool
-tcache_boot(tsdn_t *tsdn)
-{
- unsigned i;
-
- /*
- * If necessary, clamp opt_lg_tcache_max, now that large_maxclass is
- * known.
- */
- if (opt_lg_tcache_max < 0 || (1U << opt_lg_tcache_max) < SMALL_MAXCLASS)
- tcache_maxclass = SMALL_MAXCLASS;
- else if ((1U << opt_lg_tcache_max) > large_maxclass)
- tcache_maxclass = large_maxclass;
- else
- tcache_maxclass = (1U << opt_lg_tcache_max);
-
- nhbins = size2index(tcache_maxclass) + 1;
-
- /* Initialize tcache_bin_info. */
- tcache_bin_info = (tcache_bin_info_t *)base_alloc(tsdn, nhbins *
- sizeof(tcache_bin_info_t));
- if (tcache_bin_info == NULL)
- return (true);
- stack_nelms = 0;
- for (i = 0; i < NBINS; i++) {
- if ((arena_bin_info[i].nregs << 1) <= TCACHE_NSLOTS_SMALL_MIN) {
- tcache_bin_info[i].ncached_max =
- TCACHE_NSLOTS_SMALL_MIN;
- } else if ((arena_bin_info[i].nregs << 1) <=
- TCACHE_NSLOTS_SMALL_MAX) {
- tcache_bin_info[i].ncached_max =
- (arena_bin_info[i].nregs << 1);
- } else {
- tcache_bin_info[i].ncached_max =
- TCACHE_NSLOTS_SMALL_MAX;
- }
- stack_nelms += tcache_bin_info[i].ncached_max;
- }
- for (; i < nhbins; i++) {
- tcache_bin_info[i].ncached_max = TCACHE_NSLOTS_LARGE;
- stack_nelms += tcache_bin_info[i].ncached_max;
- }
-
- return (false);
-}
diff --git a/memory/jemalloc/src/src/ticker.c b/memory/jemalloc/src/src/ticker.c
deleted file mode 100644
index db0902404e..0000000000
--- a/memory/jemalloc/src/src/ticker.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define JEMALLOC_TICKER_C_
-#include "jemalloc/internal/jemalloc_internal.h"
diff --git a/memory/jemalloc/src/src/tsd.c b/memory/jemalloc/src/src/tsd.c
deleted file mode 100644
index ec69a51c3d..0000000000
--- a/memory/jemalloc/src/src/tsd.c
+++ /dev/null
@@ -1,197 +0,0 @@
-#define JEMALLOC_TSD_C_
-#include "jemalloc/internal/jemalloc_internal.h"
-
-/******************************************************************************/
-/* Data. */
-
-static unsigned ncleanups;
-static malloc_tsd_cleanup_t cleanups[MALLOC_TSD_CLEANUPS_MAX];
-
-malloc_tsd_data(, , tsd_t, TSD_INITIALIZER)
-
-/******************************************************************************/
-
-void *
-malloc_tsd_malloc(size_t size)
-{
-
- return (a0malloc(CACHELINE_CEILING(size)));
-}
-
-void
-malloc_tsd_dalloc(void *wrapper)
-{
-
- a0dalloc(wrapper);
-}
-
-void
-malloc_tsd_no_cleanup(void *arg)
-{
-
- not_reached();
-}
-
-#if defined(JEMALLOC_MALLOC_THREAD_CLEANUP) || defined(_WIN32)
-#ifndef _WIN32
-JEMALLOC_EXPORT
-#endif
-void
-_malloc_thread_cleanup(void)
-{
- bool pending[MALLOC_TSD_CLEANUPS_MAX], again;
- unsigned i;
-
- for (i = 0; i < ncleanups; i++)
- pending[i] = true;
-
- do {
- again = false;
- for (i = 0; i < ncleanups; i++) {
- if (pending[i]) {
- pending[i] = cleanups[i]();
- if (pending[i])
- again = true;
- }
- }
- } while (again);
-}
-#endif
-
-void
-malloc_tsd_cleanup_register(bool (*f)(void))
-{
-
- assert(ncleanups < MALLOC_TSD_CLEANUPS_MAX);
- cleanups[ncleanups] = f;
- ncleanups++;
-}
-
-void
-tsd_cleanup(void *arg)
-{
- tsd_t *tsd = (tsd_t *)arg;
-
- switch (tsd->state) {
- case tsd_state_uninitialized:
- /* Do nothing. */
- break;
- case tsd_state_nominal:
-#define O(n, t) \
- n##_cleanup(tsd);
-MALLOC_TSD
-#undef O
- tsd->state = tsd_state_purgatory;
- tsd_set(tsd);
- break;
- case tsd_state_purgatory:
- /*
- * The previous time this destructor was called, we set the
- * state to tsd_state_purgatory so that other destructors
- * wouldn't cause re-creation of the tsd. This time, do
- * nothing, and do not request another callback.
- */
- break;
- case tsd_state_reincarnated:
- /*
- * Another destructor deallocated memory after this destructor
- * was called. Reset state to tsd_state_purgatory and request
- * another callback.
- */
- tsd->state = tsd_state_purgatory;
- tsd_set(tsd);
- break;
- default:
- not_reached();
- }
-}
-
-tsd_t *
-malloc_tsd_boot0(void)
-{
- tsd_t *tsd;
-
- ncleanups = 0;
- if (tsd_boot0())
- return (NULL);
- tsd = tsd_fetch();
- *tsd_arenas_tdata_bypassp_get(tsd) = true;
- return (tsd);
-}
-
-void
-malloc_tsd_boot1(void)
-{
-
- tsd_boot1();
- *tsd_arenas_tdata_bypassp_get(tsd_fetch()) = false;
-}
-
-#ifdef _WIN32
-static BOOL WINAPI
-_tls_callback(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
-{
-
- switch (fdwReason) {
-#ifdef JEMALLOC_LAZY_LOCK
- case DLL_THREAD_ATTACH:
- isthreaded = true;
- break;
-#endif
- case DLL_THREAD_DETACH:
- _malloc_thread_cleanup();
- break;
- default:
- break;
- }
- return (true);
-}
-
-#ifdef _MSC_VER
-# ifdef _M_IX86
-# pragma comment(linker, "/INCLUDE:__tls_used")
-# pragma comment(linker, "/INCLUDE:_tls_callback")
-# else
-# pragma comment(linker, "/INCLUDE:_tls_used")
-# pragma comment(linker, "/INCLUDE:tls_callback")
-# endif
-# pragma section(".CRT$XLY",long,read)
-#endif
-JEMALLOC_SECTION(".CRT$XLY") JEMALLOC_ATTR(used)
-BOOL (WINAPI *const tls_callback)(HINSTANCE hinstDLL,
- DWORD fdwReason, LPVOID lpvReserved) = _tls_callback;
-#endif
-
-#if (!defined(JEMALLOC_MALLOC_THREAD_CLEANUP) && !defined(JEMALLOC_TLS) && \
- !defined(_WIN32))
-void *
-tsd_init_check_recursion(tsd_init_head_t *head, tsd_init_block_t *block)
-{
- pthread_t self = pthread_self();
- tsd_init_block_t *iter;
-
- /* Check whether this thread has already inserted into the list. */
- malloc_mutex_lock(TSDN_NULL, &head->lock);
- ql_foreach(iter, &head->blocks, link) {
- if (iter->thread == self) {
- malloc_mutex_unlock(TSDN_NULL, &head->lock);
- return (iter->data);
- }
- }
- /* Insert block into list. */
- ql_elm_new(block, link);
- block->thread = self;
- ql_tail_insert(&head->blocks, block, link);
- malloc_mutex_unlock(TSDN_NULL, &head->lock);
- return (NULL);
-}
-
-void
-tsd_init_finish(tsd_init_head_t *head, tsd_init_block_t *block)
-{
-
- malloc_mutex_lock(TSDN_NULL, &head->lock);
- ql_remove(&head->blocks, block, link);
- malloc_mutex_unlock(TSDN_NULL, &head->lock);
-}
-#endif
diff --git a/memory/jemalloc/src/src/util.c b/memory/jemalloc/src/src/util.c
deleted file mode 100644
index 79052674f2..0000000000
--- a/memory/jemalloc/src/src/util.c
+++ /dev/null
@@ -1,666 +0,0 @@
-/*
- * Define simple versions of assertion macros that won't recurse in case
- * of assertion failures in malloc_*printf().
- */
-#define assert(e) do { \
- if (config_debug && !(e)) { \
- malloc_write("<jemalloc>: Failed assertion\n"); \
- abort(); \
- } \
-} while (0)
-
-#define not_reached() do { \
- if (config_debug) { \
- malloc_write("<jemalloc>: Unreachable code reached\n"); \
- abort(); \
- } \
- unreachable(); \
-} while (0)
-
-#define not_implemented() do { \
- if (config_debug) { \
- malloc_write("<jemalloc>: Not implemented\n"); \
- abort(); \
- } \
-} while (0)
-
-#define JEMALLOC_UTIL_C_
-#include "jemalloc/internal/jemalloc_internal.h"
-
-/******************************************************************************/
-/* Function prototypes for non-inline static functions. */
-
-static void wrtmessage(void *cbopaque, const char *s);
-#define U2S_BUFSIZE ((1U << (LG_SIZEOF_INTMAX_T + 3)) + 1)
-static char *u2s(uintmax_t x, unsigned base, bool uppercase, char *s,
- size_t *slen_p);
-#define D2S_BUFSIZE (1 + U2S_BUFSIZE)
-static char *d2s(intmax_t x, char sign, char *s, size_t *slen_p);
-#define O2S_BUFSIZE (1 + U2S_BUFSIZE)
-static char *o2s(uintmax_t x, bool alt_form, char *s, size_t *slen_p);
-#define X2S_BUFSIZE (2 + U2S_BUFSIZE)
-static char *x2s(uintmax_t x, bool alt_form, bool uppercase, char *s,
- size_t *slen_p);
-
-/******************************************************************************/
-
-/* malloc_message() setup. */
-static void
-wrtmessage(void *cbopaque, const char *s)
-{
-
-#if defined(JEMALLOC_HAVE_SYSCALL) && defined(SYS_write)
- /*
- * Use syscall(2) rather than write(2) when possible in order to avoid
- * the possibility of memory allocation within libc. This is necessary
- * on FreeBSD; most operating systems do not have this problem though.
- *
- * syscall() returns long or int, depending on platform, so capture the
- * unused result in the widest plausible type to avoid compiler
- * warnings.
- */
- UNUSED long result = syscall(SYS_write, STDERR_FILENO, s, strlen(s));
-#else
- UNUSED ssize_t result = write(STDERR_FILENO, s, strlen(s));
-#endif
-}
-
-JEMALLOC_EXPORT void (*je_malloc_message)(void *, const char *s);
-
-/*
- * Wrapper around malloc_message() that avoids the need for
- * je_malloc_message(...) throughout the code.
- */
-void
-malloc_write(const char *s)
-{
-
- if (je_malloc_message != NULL)
- je_malloc_message(NULL, s);
- else
- wrtmessage(NULL, s);
-}
-
-/*
- * glibc provides a non-standard strerror_r() when _GNU_SOURCE is defined, so
- * provide a wrapper.
- */
-int
-buferror(int err, char *buf, size_t buflen)
-{
-
-#ifdef _WIN32
- FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, err, 0,
- (LPSTR)buf, (DWORD)buflen, NULL);
- return (0);
-#elif defined(__GLIBC__) && defined(_GNU_SOURCE)
- char *b = strerror_r(err, buf, buflen);
- if (b != buf) {
- strncpy(buf, b, buflen);
- buf[buflen-1] = '\0';
- }
- return (0);
-#else
- return (strerror_r(err, buf, buflen));
-#endif
-}
-
-uintmax_t
-malloc_strtoumax(const char *restrict nptr, char **restrict endptr, int base)
-{
- uintmax_t ret, digit;
- unsigned b;
- bool neg;
- const char *p, *ns;
-
- p = nptr;
- if (base < 0 || base == 1 || base > 36) {
- ns = p;
- set_errno(EINVAL);
- ret = UINTMAX_MAX;
- goto label_return;
- }
- b = base;
-
- /* Swallow leading whitespace and get sign, if any. */
- neg = false;
- while (true) {
- switch (*p) {
- case '\t': case '\n': case '\v': case '\f': case '\r': case ' ':
- p++;
- break;
- case '-':
- neg = true;
- /* Fall through. */
- case '+':
- p++;
- /* Fall through. */
- default:
- goto label_prefix;
- }
- }
-
- /* Get prefix, if any. */
- label_prefix:
- /*
- * Note where the first non-whitespace/sign character is so that it is
- * possible to tell whether any digits are consumed (e.g., " 0" vs.
- * " -x").
- */
- ns = p;
- if (*p == '0') {
- switch (p[1]) {
- case '0': case '1': case '2': case '3': case '4': case '5':
- case '6': case '7':
- if (b == 0)
- b = 8;
- if (b == 8)
- p++;
- break;
- case 'X': case 'x':
- switch (p[2]) {
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9':
- case 'A': case 'B': case 'C': case 'D': case 'E':
- case 'F':
- case 'a': case 'b': case 'c': case 'd': case 'e':
- case 'f':
- if (b == 0)
- b = 16;
- if (b == 16)
- p += 2;
- break;
- default:
- break;
- }
- break;
- default:
- p++;
- ret = 0;
- goto label_return;
- }
- }
- if (b == 0)
- b = 10;
-
- /* Convert. */
- ret = 0;
- while ((*p >= '0' && *p <= '9' && (digit = *p - '0') < b)
- || (*p >= 'A' && *p <= 'Z' && (digit = 10 + *p - 'A') < b)
- || (*p >= 'a' && *p <= 'z' && (digit = 10 + *p - 'a') < b)) {
- uintmax_t pret = ret;
- ret *= b;
- ret += digit;
- if (ret < pret) {
- /* Overflow. */
- set_errno(ERANGE);
- ret = UINTMAX_MAX;
- goto label_return;
- }
- p++;
- }
- if (neg)
- ret = -ret;
-
- if (p == ns) {
- /* No conversion performed. */
- set_errno(EINVAL);
- ret = UINTMAX_MAX;
- goto label_return;
- }
-
-label_return:
- if (endptr != NULL) {
- if (p == ns) {
- /* No characters were converted. */
- *endptr = (char *)nptr;
- } else
- *endptr = (char *)p;
- }
- return (ret);
-}
-
-static char *
-u2s(uintmax_t x, unsigned base, bool uppercase, char *s, size_t *slen_p)
-{
- unsigned i;
-
- i = U2S_BUFSIZE - 1;
- s[i] = '\0';
- switch (base) {
- case 10:
- do {
- i--;
- s[i] = "0123456789"[x % (uint64_t)10];
- x /= (uint64_t)10;
- } while (x > 0);
- break;
- case 16: {
- const char *digits = (uppercase)
- ? "0123456789ABCDEF"
- : "0123456789abcdef";
-
- do {
- i--;
- s[i] = digits[x & 0xf];
- x >>= 4;
- } while (x > 0);
- break;
- } default: {
- const char *digits = (uppercase)
- ? "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
- : "0123456789abcdefghijklmnopqrstuvwxyz";
-
- assert(base >= 2 && base <= 36);
- do {
- i--;
- s[i] = digits[x % (uint64_t)base];
- x /= (uint64_t)base;
- } while (x > 0);
- }}
-
- *slen_p = U2S_BUFSIZE - 1 - i;
- return (&s[i]);
-}
-
-static char *
-d2s(intmax_t x, char sign, char *s, size_t *slen_p)
-{
- bool neg;
-
- if ((neg = (x < 0)))
- x = -x;
- s = u2s(x, 10, false, s, slen_p);
- if (neg)
- sign = '-';
- switch (sign) {
- case '-':
- if (!neg)
- break;
- /* Fall through. */
- case ' ':
- case '+':
- s--;
- (*slen_p)++;
- *s = sign;
- break;
- default: not_reached();
- }
- return (s);
-}
-
-static char *
-o2s(uintmax_t x, bool alt_form, char *s, size_t *slen_p)
-{
-
- s = u2s(x, 8, false, s, slen_p);
- if (alt_form && *s != '0') {
- s--;
- (*slen_p)++;
- *s = '0';
- }
- return (s);
-}
-
-static char *
-x2s(uintmax_t x, bool alt_form, bool uppercase, char *s, size_t *slen_p)
-{
-
- s = u2s(x, 16, uppercase, s, slen_p);
- if (alt_form) {
- s -= 2;
- (*slen_p) += 2;
- memcpy(s, uppercase ? "0X" : "0x", 2);
- }
- return (s);
-}
-
-size_t
-malloc_vsnprintf(char *str, size_t size, const char *format, va_list ap)
-{
- size_t i;
- const char *f;
-
-#define APPEND_C(c) do { \
- if (i < size) \
- str[i] = (c); \
- i++; \
-} while (0)
-#define APPEND_S(s, slen) do { \
- if (i < size) { \
- size_t cpylen = (slen <= size - i) ? slen : size - i; \
- memcpy(&str[i], s, cpylen); \
- } \
- i += slen; \
-} while (0)
-#define APPEND_PADDED_S(s, slen, width, left_justify) do { \
- /* Left padding. */ \
- size_t pad_len = (width == -1) ? 0 : ((slen < (size_t)width) ? \
- (size_t)width - slen : 0); \
- if (!left_justify && pad_len != 0) { \
- size_t j; \
- for (j = 0; j < pad_len; j++) \
- APPEND_C(' '); \
- } \
- /* Value. */ \
- APPEND_S(s, slen); \
- /* Right padding. */ \
- if (left_justify && pad_len != 0) { \
- size_t j; \
- for (j = 0; j < pad_len; j++) \
- APPEND_C(' '); \
- } \
-} while (0)
-#define GET_ARG_NUMERIC(val, len) do { \
- switch (len) { \
- case '?': \
- val = va_arg(ap, int); \
- break; \
- case '?' | 0x80: \
- val = va_arg(ap, unsigned int); \
- break; \
- case 'l': \
- val = va_arg(ap, long); \
- break; \
- case 'l' | 0x80: \
- val = va_arg(ap, unsigned long); \
- break; \
- case 'q': \
- val = va_arg(ap, long long); \
- break; \
- case 'q' | 0x80: \
- val = va_arg(ap, unsigned long long); \
- break; \
- case 'j': \
- val = va_arg(ap, intmax_t); \
- break; \
- case 'j' | 0x80: \
- val = va_arg(ap, uintmax_t); \
- break; \
- case 't': \
- val = va_arg(ap, ptrdiff_t); \
- break; \
- case 'z': \
- val = va_arg(ap, ssize_t); \
- break; \
- case 'z' | 0x80: \
- val = va_arg(ap, size_t); \
- break; \
- case 'p': /* Synthetic; used for %p. */ \
- val = va_arg(ap, uintptr_t); \
- break; \
- default: \
- not_reached(); \
- val = 0; \
- } \
-} while (0)
-
- i = 0;
- f = format;
- while (true) {
- switch (*f) {
- case '\0': goto label_out;
- case '%': {
- bool alt_form = false;
- bool left_justify = false;
- bool plus_space = false;
- bool plus_plus = false;
- int prec = -1;
- int width = -1;
- unsigned char len = '?';
- char *s;
- size_t slen;
-
- f++;
- /* Flags. */
- while (true) {
- switch (*f) {
- case '#':
- assert(!alt_form);
- alt_form = true;
- break;
- case '-':
- assert(!left_justify);
- left_justify = true;
- break;
- case ' ':
- assert(!plus_space);
- plus_space = true;
- break;
- case '+':
- assert(!plus_plus);
- plus_plus = true;
- break;
- default: goto label_width;
- }
- f++;
- }
- /* Width. */
- label_width:
- switch (*f) {
- case '*':
- width = va_arg(ap, int);
- f++;
- if (width < 0) {
- left_justify = true;
- width = -width;
- }
- break;
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9': {
- uintmax_t uwidth;
- set_errno(0);
- uwidth = malloc_strtoumax(f, (char **)&f, 10);
- assert(uwidth != UINTMAX_MAX || get_errno() !=
- ERANGE);
- width = (int)uwidth;
- break;
- } default:
- break;
- }
- /* Width/precision separator. */
- if (*f == '.')
- f++;
- else
- goto label_length;
- /* Precision. */
- switch (*f) {
- case '*':
- prec = va_arg(ap, int);
- f++;
- break;
- case '0': case '1': case '2': case '3': case '4':
- case '5': case '6': case '7': case '8': case '9': {
- uintmax_t uprec;
- set_errno(0);
- uprec = malloc_strtoumax(f, (char **)&f, 10);
- assert(uprec != UINTMAX_MAX || get_errno() !=
- ERANGE);
- prec = (int)uprec;
- break;
- }
- default: break;
- }
- /* Length. */
- label_length:
- switch (*f) {
- case 'l':
- f++;
- if (*f == 'l') {
- len = 'q';
- f++;
- } else
- len = 'l';
- break;
- case 'q': case 'j': case 't': case 'z':
- len = *f;
- f++;
- break;
- default: break;
- }
- /* Conversion specifier. */
- switch (*f) {
- case '%':
- /* %% */
- APPEND_C(*f);
- f++;
- break;
- case 'd': case 'i': {
- intmax_t val JEMALLOC_CC_SILENCE_INIT(0);
- char buf[D2S_BUFSIZE];
-
- GET_ARG_NUMERIC(val, len);
- s = d2s(val, (plus_plus ? '+' : (plus_space ?
- ' ' : '-')), buf, &slen);
- APPEND_PADDED_S(s, slen, width, left_justify);
- f++;
- break;
- } case 'o': {
- uintmax_t val JEMALLOC_CC_SILENCE_INIT(0);
- char buf[O2S_BUFSIZE];
-
- GET_ARG_NUMERIC(val, len | 0x80);
- s = o2s(val, alt_form, buf, &slen);
- APPEND_PADDED_S(s, slen, width, left_justify);
- f++;
- break;
- } case 'u': {
- uintmax_t val JEMALLOC_CC_SILENCE_INIT(0);
- char buf[U2S_BUFSIZE];
-
- GET_ARG_NUMERIC(val, len | 0x80);
- s = u2s(val, 10, false, buf, &slen);
- APPEND_PADDED_S(s, slen, width, left_justify);
- f++;
- break;
- } case 'x': case 'X': {
- uintmax_t val JEMALLOC_CC_SILENCE_INIT(0);
- char buf[X2S_BUFSIZE];
-
- GET_ARG_NUMERIC(val, len | 0x80);
- s = x2s(val, alt_form, *f == 'X', buf, &slen);
- APPEND_PADDED_S(s, slen, width, left_justify);
- f++;
- break;
- } case 'c': {
- unsigned char val;
- char buf[2];
-
- assert(len == '?' || len == 'l');
- assert_not_implemented(len != 'l');
- val = va_arg(ap, int);
- buf[0] = val;
- buf[1] = '\0';
- APPEND_PADDED_S(buf, 1, width, left_justify);
- f++;
- break;
- } case 's':
- assert(len == '?' || len == 'l');
- assert_not_implemented(len != 'l');
- s = va_arg(ap, char *);
- slen = (prec < 0) ? strlen(s) : (size_t)prec;
- APPEND_PADDED_S(s, slen, width, left_justify);
- f++;
- break;
- case 'p': {
- uintmax_t val;
- char buf[X2S_BUFSIZE];
-
- GET_ARG_NUMERIC(val, 'p');
- s = x2s(val, true, false, buf, &slen);
- APPEND_PADDED_S(s, slen, width, left_justify);
- f++;
- break;
- } default: not_reached();
- }
- break;
- } default: {
- APPEND_C(*f);
- f++;
- break;
- }}
- }
- label_out:
- if (i < size)
- str[i] = '\0';
- else
- str[size - 1] = '\0';
-
-#undef APPEND_C
-#undef APPEND_S
-#undef APPEND_PADDED_S
-#undef GET_ARG_NUMERIC
- return (i);
-}
-
-JEMALLOC_FORMAT_PRINTF(3, 4)
-size_t
-malloc_snprintf(char *str, size_t size, const char *format, ...)
-{
- size_t ret;
- va_list ap;
-
- va_start(ap, format);
- ret = malloc_vsnprintf(str, size, format, ap);
- va_end(ap);
-
- return (ret);
-}
-
-void
-malloc_vcprintf(void (*write_cb)(void *, const char *), void *cbopaque,
- const char *format, va_list ap)
-{
- char buf[MALLOC_PRINTF_BUFSIZE];
-
- if (write_cb == NULL) {
- /*
- * The caller did not provide an alternate write_cb callback
- * function, so use the default one. malloc_write() is an
- * inline function, so use malloc_message() directly here.
- */
- write_cb = (je_malloc_message != NULL) ? je_malloc_message :
- wrtmessage;
- cbopaque = NULL;
- }
-
- malloc_vsnprintf(buf, sizeof(buf), format, ap);
- write_cb(cbopaque, buf);
-}
-
-/*
- * Print to a callback function in such a way as to (hopefully) avoid memory
- * allocation.
- */
-JEMALLOC_FORMAT_PRINTF(3, 4)
-void
-malloc_cprintf(void (*write_cb)(void *, const char *), void *cbopaque,
- const char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
- malloc_vcprintf(write_cb, cbopaque, format, ap);
- va_end(ap);
-}
-
-/* Print to stderr in such a way as to avoid memory allocation. */
-JEMALLOC_FORMAT_PRINTF(1, 2)
-void
-malloc_printf(const char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
- malloc_vcprintf(NULL, NULL, format, ap);
- va_end(ap);
-}
-
-/*
- * Restore normal assertion macros, in order to make it possible to compile all
- * C files as a single concatenation.
- */
-#undef assert
-#undef not_reached
-#undef not_implemented
-#include "jemalloc/internal/assert.h"
diff --git a/memory/jemalloc/src/src/valgrind.c b/memory/jemalloc/src/src/valgrind.c
deleted file mode 100644
index 8e7ef3a2e6..0000000000
--- a/memory/jemalloc/src/src/valgrind.c
+++ /dev/null
@@ -1,34 +0,0 @@
-#include "jemalloc/internal/jemalloc_internal.h"
-#ifndef JEMALLOC_VALGRIND
-# error "This source file is for Valgrind integration."
-#endif
-
-#include <valgrind/memcheck.h>
-
-void
-valgrind_make_mem_noaccess(void *ptr, size_t usize)
-{
-
- VALGRIND_MAKE_MEM_NOACCESS(ptr, usize);
-}
-
-void
-valgrind_make_mem_undefined(void *ptr, size_t usize)
-{
-
- VALGRIND_MAKE_MEM_UNDEFINED(ptr, usize);
-}
-
-void
-valgrind_make_mem_defined(void *ptr, size_t usize)
-{
-
- VALGRIND_MAKE_MEM_DEFINED(ptr, usize);
-}
-
-void
-valgrind_freelike_block(void *ptr, size_t usize)
-{
-
- VALGRIND_FREELIKE_BLOCK(ptr, usize);
-}
diff --git a/memory/jemalloc/src/src/witness.c b/memory/jemalloc/src/src/witness.c
deleted file mode 100644
index 23753f246e..0000000000
--- a/memory/jemalloc/src/src/witness.c
+++ /dev/null
@@ -1,136 +0,0 @@
-#define JEMALLOC_WITNESS_C_
-#include "jemalloc/internal/jemalloc_internal.h"
-
-void
-witness_init(witness_t *witness, const char *name, witness_rank_t rank,
- witness_comp_t *comp)
-{
-
- witness->name = name;
- witness->rank = rank;
- witness->comp = comp;
-}
-
-#ifdef JEMALLOC_JET
-#undef witness_lock_error
-#define witness_lock_error JEMALLOC_N(n_witness_lock_error)
-#endif
-void
-witness_lock_error(const witness_list_t *witnesses, const witness_t *witness)
-{
- witness_t *w;
-
- malloc_printf("<jemalloc>: Lock rank order reversal:");
- ql_foreach(w, witnesses, link) {
- malloc_printf(" %s(%u)", w->name, w->rank);
- }
- malloc_printf(" %s(%u)\n", witness->name, witness->rank);
- abort();
-}
-#ifdef JEMALLOC_JET
-#undef witness_lock_error
-#define witness_lock_error JEMALLOC_N(witness_lock_error)
-witness_lock_error_t *witness_lock_error = JEMALLOC_N(n_witness_lock_error);
-#endif
-
-#ifdef JEMALLOC_JET
-#undef witness_owner_error
-#define witness_owner_error JEMALLOC_N(n_witness_owner_error)
-#endif
-void
-witness_owner_error(const witness_t *witness)
-{
-
- malloc_printf("<jemalloc>: Should own %s(%u)\n", witness->name,
- witness->rank);
- abort();
-}
-#ifdef JEMALLOC_JET
-#undef witness_owner_error
-#define witness_owner_error JEMALLOC_N(witness_owner_error)
-witness_owner_error_t *witness_owner_error = JEMALLOC_N(n_witness_owner_error);
-#endif
-
-#ifdef JEMALLOC_JET
-#undef witness_not_owner_error
-#define witness_not_owner_error JEMALLOC_N(n_witness_not_owner_error)
-#endif
-void
-witness_not_owner_error(const witness_t *witness)
-{
-
- malloc_printf("<jemalloc>: Should not own %s(%u)\n", witness->name,
- witness->rank);
- abort();
-}
-#ifdef JEMALLOC_JET
-#undef witness_not_owner_error
-#define witness_not_owner_error JEMALLOC_N(witness_not_owner_error)
-witness_not_owner_error_t *witness_not_owner_error =
- JEMALLOC_N(n_witness_not_owner_error);
-#endif
-
-#ifdef JEMALLOC_JET
-#undef witness_lockless_error
-#define witness_lockless_error JEMALLOC_N(n_witness_lockless_error)
-#endif
-void
-witness_lockless_error(const witness_list_t *witnesses)
-{
- witness_t *w;
-
- malloc_printf("<jemalloc>: Should not own any locks:");
- ql_foreach(w, witnesses, link) {
- malloc_printf(" %s(%u)", w->name, w->rank);
- }
- malloc_printf("\n");
- abort();
-}
-#ifdef JEMALLOC_JET
-#undef witness_lockless_error
-#define witness_lockless_error JEMALLOC_N(witness_lockless_error)
-witness_lockless_error_t *witness_lockless_error =
- JEMALLOC_N(n_witness_lockless_error);
-#endif
-
-void
-witnesses_cleanup(tsd_t *tsd)
-{
-
- witness_assert_lockless(tsd_tsdn(tsd));
-
- /* Do nothing. */
-}
-
-void
-witness_fork_cleanup(tsd_t *tsd)
-{
-
- /* Do nothing. */
-}
-
-void
-witness_prefork(tsd_t *tsd)
-{
-
- tsd_witness_fork_set(tsd, true);
-}
-
-void
-witness_postfork_parent(tsd_t *tsd)
-{
-
- tsd_witness_fork_set(tsd, false);
-}
-
-void
-witness_postfork_child(tsd_t *tsd)
-{
-#ifndef JEMALLOC_MUTEX_INIT_CB
- witness_list_t *witnesses;
-
- witnesses = tsd_witnessesp_get(tsd);
- ql_new(witnesses);
-#endif
- tsd_witness_fork_set(tsd, false);
-}
diff --git a/memory/jemalloc/src/src/zone.c b/memory/jemalloc/src/src/zone.c
deleted file mode 100644
index 0571920e46..0000000000
--- a/memory/jemalloc/src/src/zone.c
+++ /dev/null
@@ -1,330 +0,0 @@
-#include "jemalloc/internal/jemalloc_internal.h"
-#ifndef JEMALLOC_ZONE
-# error "This source file is for zones on Darwin (OS X)."
-#endif
-
-/*
- * The malloc_default_purgeable_zone() function is only available on >= 10.6.
- * We need to check whether it is present at runtime, thus the weak_import.
- */
-extern malloc_zone_t *malloc_default_purgeable_zone(void)
-JEMALLOC_ATTR(weak_import);
-
-/******************************************************************************/
-/* Data. */
-
-static malloc_zone_t *default_zone, *purgeable_zone;
-static malloc_zone_t jemalloc_zone;
-static struct malloc_introspection_t jemalloc_zone_introspect;
-
-/******************************************************************************/
-/* Function prototypes for non-inline static functions. */
-
-static size_t zone_size(malloc_zone_t *zone, void *ptr);
-static void *zone_malloc(malloc_zone_t *zone, size_t size);
-static void *zone_calloc(malloc_zone_t *zone, size_t num, size_t size);
-static void *zone_valloc(malloc_zone_t *zone, size_t size);
-static void zone_free(malloc_zone_t *zone, void *ptr);
-static void *zone_realloc(malloc_zone_t *zone, void *ptr, size_t size);
-#if (JEMALLOC_ZONE_VERSION >= 5)
-static void *zone_memalign(malloc_zone_t *zone, size_t alignment,
-#endif
-#if (JEMALLOC_ZONE_VERSION >= 6)
- size_t size);
-static void zone_free_definite_size(malloc_zone_t *zone, void *ptr,
- size_t size);
-#endif
-static void *zone_destroy(malloc_zone_t *zone);
-static size_t zone_good_size(malloc_zone_t *zone, size_t size);
-static void zone_force_lock(malloc_zone_t *zone);
-static void zone_force_unlock(malloc_zone_t *zone);
-
-/******************************************************************************/
-/*
- * Functions.
- */
-
-static size_t
-zone_size(malloc_zone_t *zone, void *ptr)
-{
-
- /*
- * There appear to be places within Darwin (such as setenv(3)) that
- * cause calls to this function with pointers that *no* zone owns. If
- * we knew that all pointers were owned by *some* zone, we could split
- * our zone into two parts, and use one as the default allocator and
- * the other as the default deallocator/reallocator. Since that will
- * not work in practice, we must check all pointers to assure that they
- * reside within a mapped chunk before determining size.
- */
- return (ivsalloc(tsdn_fetch(), ptr, config_prof));
-}
-
-static void *
-zone_malloc(malloc_zone_t *zone, size_t size)
-{
-
- return (je_malloc(size));
-}
-
-static void *
-zone_calloc(malloc_zone_t *zone, size_t num, size_t size)
-{
-
- return (je_calloc(num, size));
-}
-
-static void *
-zone_valloc(malloc_zone_t *zone, size_t size)
-{
- void *ret = NULL; /* Assignment avoids useless compiler warning. */
-
- je_posix_memalign(&ret, PAGE, size);
-
- return (ret);
-}
-
-static void
-zone_free(malloc_zone_t *zone, void *ptr)
-{
-
- if (ivsalloc(tsdn_fetch(), ptr, config_prof) != 0) {
- je_free(ptr);
- return;
- }
-
- free(ptr);
-}
-
-static void *
-zone_realloc(malloc_zone_t *zone, void *ptr, size_t size)
-{
-
- if (ivsalloc(tsdn_fetch(), ptr, config_prof) != 0)
- return (je_realloc(ptr, size));
-
- return (realloc(ptr, size));
-}
-
-#if (JEMALLOC_ZONE_VERSION >= 5)
-static void *
-zone_memalign(malloc_zone_t *zone, size_t alignment, size_t size)
-{
- void *ret = NULL; /* Assignment avoids useless compiler warning. */
-
- je_posix_memalign(&ret, alignment, size);
-
- return (ret);
-}
-#endif
-
-#if (JEMALLOC_ZONE_VERSION >= 6)
-static void
-zone_free_definite_size(malloc_zone_t *zone, void *ptr, size_t size)
-{
- size_t alloc_size;
-
- alloc_size = ivsalloc(tsdn_fetch(), ptr, config_prof);
- if (alloc_size != 0) {
- assert(alloc_size == size);
- je_free(ptr);
- return;
- }
-
- free(ptr);
-}
-#endif
-
-static void *
-zone_destroy(malloc_zone_t *zone)
-{
-
- /* This function should never be called. */
- not_reached();
- return (NULL);
-}
-
-static size_t
-zone_good_size(malloc_zone_t *zone, size_t size)
-{
-
- if (size == 0)
- size = 1;
- return (s2u(size));
-}
-
-static void
-zone_force_lock(malloc_zone_t *zone)
-{
-
- if (isthreaded)
- jemalloc_prefork();
-}
-
-static void
-zone_force_unlock(malloc_zone_t *zone)
-{
-
- /*
- * Call jemalloc_postfork_child() rather than
- * jemalloc_postfork_parent(), because this function is executed by both
- * parent and child. The parent can tolerate having state
- * reinitialized, but the child cannot unlock mutexes that were locked
- * by the parent.
- */
- if (isthreaded)
- jemalloc_postfork_child();
-}
-
-static void
-zone_init(void)
-{
-
- jemalloc_zone.size = (void *)zone_size;
- jemalloc_zone.malloc = (void *)zone_malloc;
- jemalloc_zone.calloc = (void *)zone_calloc;
- jemalloc_zone.valloc = (void *)zone_valloc;
- jemalloc_zone.free = (void *)zone_free;
- jemalloc_zone.realloc = (void *)zone_realloc;
- jemalloc_zone.destroy = (void *)zone_destroy;
- jemalloc_zone.zone_name = "jemalloc_zone";
- jemalloc_zone.batch_malloc = NULL;
- jemalloc_zone.batch_free = NULL;
- jemalloc_zone.introspect = &jemalloc_zone_introspect;
- jemalloc_zone.version = JEMALLOC_ZONE_VERSION;
-#if (JEMALLOC_ZONE_VERSION >= 5)
- jemalloc_zone.memalign = zone_memalign;
-#endif
-#if (JEMALLOC_ZONE_VERSION >= 6)
- jemalloc_zone.free_definite_size = zone_free_definite_size;
-#endif
-#if (JEMALLOC_ZONE_VERSION >= 8)
- jemalloc_zone.pressure_relief = NULL;
-#endif
-
- jemalloc_zone_introspect.enumerator = NULL;
- jemalloc_zone_introspect.good_size = (void *)zone_good_size;
- jemalloc_zone_introspect.check = NULL;
- jemalloc_zone_introspect.print = NULL;
- jemalloc_zone_introspect.log = NULL;
- jemalloc_zone_introspect.force_lock = (void *)zone_force_lock;
- jemalloc_zone_introspect.force_unlock = (void *)zone_force_unlock;
- jemalloc_zone_introspect.statistics = NULL;
-#if (JEMALLOC_ZONE_VERSION >= 6)
- jemalloc_zone_introspect.zone_locked = NULL;
-#endif
-#if (JEMALLOC_ZONE_VERSION >= 7)
- jemalloc_zone_introspect.enable_discharge_checking = NULL;
- jemalloc_zone_introspect.disable_discharge_checking = NULL;
- jemalloc_zone_introspect.discharge = NULL;
-# ifdef __BLOCKS__
- jemalloc_zone_introspect.enumerate_discharged_pointers = NULL;
-# else
- jemalloc_zone_introspect.enumerate_unavailable_without_blocks = NULL;
-# endif
-#endif
-}
-
-static malloc_zone_t *
-zone_default_get(void)
-{
- malloc_zone_t **zones = NULL;
- unsigned int num_zones = 0;
-
- /*
- * On OSX 10.12, malloc_default_zone returns a special zone that is not
- * present in the list of registered zones. That zone uses a "lite zone"
- * if one is present (apparently enabled when malloc stack logging is
- * enabled), or the first registered zone otherwise. In practice this
- * means unless malloc stack logging is enabled, the first registered
- * zone is the default. So get the list of zones to get the first one,
- * instead of relying on malloc_default_zone.
- */
- if (KERN_SUCCESS != malloc_get_all_zones(0, NULL,
- (vm_address_t**)&zones, &num_zones)) {
- /*
- * Reset the value in case the failure happened after it was
- * set.
- */
- num_zones = 0;
- }
-
- if (num_zones)
- return (zones[0]);
-
- return (malloc_default_zone());
-}
-
-/* As written, this function can only promote jemalloc_zone. */
-static void
-zone_promote(void)
-{
- malloc_zone_t *zone;
-
- do {
- /*
- * Unregister and reregister the default zone. On OSX >= 10.6,
- * unregistering takes the last registered zone and places it
- * at the location of the specified zone. Unregistering the
- * default zone thus makes the last registered one the default.
- * On OSX < 10.6, unregistering shifts all registered zones.
- * The first registered zone then becomes the default.
- */
- malloc_zone_unregister(default_zone);
- malloc_zone_register(default_zone);
-
- /*
- * On OSX 10.6, having the default purgeable zone appear before
- * the default zone makes some things crash because it thinks it
- * owns the default zone allocated pointers. We thus
- * unregister/re-register it in order to ensure it's always
- * after the default zone. On OSX < 10.6, there is no purgeable
- * zone, so this does nothing. On OSX >= 10.6, unregistering
- * replaces the purgeable zone with the last registered zone
- * above, i.e. the default zone. Registering it again then puts
- * it at the end, obviously after the default zone.
- */
- if (purgeable_zone != NULL) {
- malloc_zone_unregister(purgeable_zone);
- malloc_zone_register(purgeable_zone);
- }
-
- zone = zone_default_get();
- } while (zone != &jemalloc_zone);
-}
-
-JEMALLOC_ATTR(constructor)
-void
-zone_register(void)
-{
-
- /*
- * If something else replaced the system default zone allocator, don't
- * register jemalloc's.
- */
- default_zone = zone_default_get();
- if (!default_zone->zone_name || strcmp(default_zone->zone_name,
- "DefaultMallocZone") != 0)
- return;
-
- /*
- * The default purgeable zone is created lazily by OSX's libc. It uses
- * the default zone when it is created for "small" allocations
- * (< 15 KiB), but assumes the default zone is a scalable_zone. This
- * obviously fails when the default zone is the jemalloc zone, so
- * malloc_default_purgeable_zone() is called beforehand so that the
- * default purgeable zone is created when the default zone is still
- * a scalable_zone. As purgeable zones only exist on >= 10.6, we need
- * to check for the existence of malloc_default_purgeable_zone() at
- * run time.
- */
- purgeable_zone = (malloc_default_purgeable_zone == NULL) ? NULL :
- malloc_default_purgeable_zone();
-
- /* Register the custom zone. At this point it won't be the default. */
- zone_init();
- malloc_zone_register(&jemalloc_zone);
-
- /* Promote the custom zone to be default. */
- zone_promote();
-}
diff --git a/memory/jemalloc/src/test/include/test/SFMT-alti.h b/memory/jemalloc/src/test/include/test/SFMT-alti.h
deleted file mode 100644
index 0005df6b48..0000000000
--- a/memory/jemalloc/src/test/include/test/SFMT-alti.h
+++ /dev/null
@@ -1,186 +0,0 @@
-/*
- * This file derives from SFMT 1.3.3
- * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was
- * released under the terms of the following license:
- *
- * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
- * University. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of the Hiroshima University nor the names of
- * its contributors may be used to endorse or promote products
- * derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/**
- * @file SFMT-alti.h
- *
- * @brief SIMD oriented Fast Mersenne Twister(SFMT)
- * pseudorandom number generator
- *
- * @author Mutsuo Saito (Hiroshima University)
- * @author Makoto Matsumoto (Hiroshima University)
- *
- * Copyright (C) 2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
- * University. All rights reserved.
- *
- * The new BSD License is applied to this software.
- * see LICENSE.txt
- */
-
-#ifndef SFMT_ALTI_H
-#define SFMT_ALTI_H
-
-/**
- * This function represents the recursion formula in AltiVec and BIG ENDIAN.
- * @param a a 128-bit part of the interal state array
- * @param b a 128-bit part of the interal state array
- * @param c a 128-bit part of the interal state array
- * @param d a 128-bit part of the interal state array
- * @return output
- */
-JEMALLOC_ALWAYS_INLINE
-vector unsigned int vec_recursion(vector unsigned int a,
- vector unsigned int b,
- vector unsigned int c,
- vector unsigned int d) {
-
- const vector unsigned int sl1 = ALTI_SL1;
- const vector unsigned int sr1 = ALTI_SR1;
-#ifdef ONLY64
- const vector unsigned int mask = ALTI_MSK64;
- const vector unsigned char perm_sl = ALTI_SL2_PERM64;
- const vector unsigned char perm_sr = ALTI_SR2_PERM64;
-#else
- const vector unsigned int mask = ALTI_MSK;
- const vector unsigned char perm_sl = ALTI_SL2_PERM;
- const vector unsigned char perm_sr = ALTI_SR2_PERM;
-#endif
- vector unsigned int v, w, x, y, z;
- x = vec_perm(a, (vector unsigned int)perm_sl, perm_sl);
- v = a;
- y = vec_sr(b, sr1);
- z = vec_perm(c, (vector unsigned int)perm_sr, perm_sr);
- w = vec_sl(d, sl1);
- z = vec_xor(z, w);
- y = vec_and(y, mask);
- v = vec_xor(v, x);
- z = vec_xor(z, y);
- z = vec_xor(z, v);
- return z;
-}
-
-/**
- * This function fills the internal state array with pseudorandom
- * integers.
- */
-JEMALLOC_INLINE void gen_rand_all(sfmt_t *ctx) {
- int i;
- vector unsigned int r, r1, r2;
-
- r1 = ctx->sfmt[N - 2].s;
- r2 = ctx->sfmt[N - 1].s;
- for (i = 0; i < N - POS1; i++) {
- r = vec_recursion(ctx->sfmt[i].s, ctx->sfmt[i + POS1].s, r1, r2);
- ctx->sfmt[i].s = r;
- r1 = r2;
- r2 = r;
- }
- for (; i < N; i++) {
- r = vec_recursion(ctx->sfmt[i].s, ctx->sfmt[i + POS1 - N].s, r1, r2);
- ctx->sfmt[i].s = r;
- r1 = r2;
- r2 = r;
- }
-}
-
-/**
- * This function fills the user-specified array with pseudorandom
- * integers.
- *
- * @param array an 128-bit array to be filled by pseudorandom numbers.
- * @param size number of 128-bit pesudorandom numbers to be generated.
- */
-JEMALLOC_INLINE void gen_rand_array(sfmt_t *ctx, w128_t *array, int size) {
- int i, j;
- vector unsigned int r, r1, r2;
-
- r1 = ctx->sfmt[N - 2].s;
- r2 = ctx->sfmt[N - 1].s;
- for (i = 0; i < N - POS1; i++) {
- r = vec_recursion(ctx->sfmt[i].s, ctx->sfmt[i + POS1].s, r1, r2);
- array[i].s = r;
- r1 = r2;
- r2 = r;
- }
- for (; i < N; i++) {
- r = vec_recursion(ctx->sfmt[i].s, array[i + POS1 - N].s, r1, r2);
- array[i].s = r;
- r1 = r2;
- r2 = r;
- }
- /* main loop */
- for (; i < size - N; i++) {
- r = vec_recursion(array[i - N].s, array[i + POS1 - N].s, r1, r2);
- array[i].s = r;
- r1 = r2;
- r2 = r;
- }
- for (j = 0; j < 2 * N - size; j++) {
- ctx->sfmt[j].s = array[j + size - N].s;
- }
- for (; i < size; i++) {
- r = vec_recursion(array[i - N].s, array[i + POS1 - N].s, r1, r2);
- array[i].s = r;
- ctx->sfmt[j++].s = r;
- r1 = r2;
- r2 = r;
- }
-}
-
-#ifndef ONLY64
-#if defined(__APPLE__)
-#define ALTI_SWAP (vector unsigned char) \
- (4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 8, 9, 10, 11)
-#else
-#define ALTI_SWAP {4, 5, 6, 7, 0, 1, 2, 3, 12, 13, 14, 15, 8, 9, 10, 11}
-#endif
-/**
- * This function swaps high and low 32-bit of 64-bit integers in user
- * specified array.
- *
- * @param array an 128-bit array to be swaped.
- * @param size size of 128-bit array.
- */
-JEMALLOC_INLINE void swap(w128_t *array, int size) {
- int i;
- const vector unsigned char perm = ALTI_SWAP;
-
- for (i = 0; i < size; i++) {
- array[i].s = vec_perm(array[i].s, (vector unsigned int)perm, perm);
- }
-}
-#endif
-
-#endif
diff --git a/memory/jemalloc/src/test/include/test/SFMT-params.h b/memory/jemalloc/src/test/include/test/SFMT-params.h
deleted file mode 100644
index ade6622206..0000000000
--- a/memory/jemalloc/src/test/include/test/SFMT-params.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * This file derives from SFMT 1.3.3
- * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was
- * released under the terms of the following license:
- *
- * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
- * University. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of the Hiroshima University nor the names of
- * its contributors may be used to endorse or promote products
- * derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef SFMT_PARAMS_H
-#define SFMT_PARAMS_H
-
-#if !defined(MEXP)
-#ifdef __GNUC__
- #warning "MEXP is not defined. I assume MEXP is 19937."
-#endif
- #define MEXP 19937
-#endif
-/*-----------------
- BASIC DEFINITIONS
- -----------------*/
-/** Mersenne Exponent. The period of the sequence
- * is a multiple of 2^MEXP-1.
- * #define MEXP 19937 */
-/** SFMT generator has an internal state array of 128-bit integers,
- * and N is its size. */
-#define N (MEXP / 128 + 1)
-/** N32 is the size of internal state array when regarded as an array
- * of 32-bit integers.*/
-#define N32 (N * 4)
-/** N64 is the size of internal state array when regarded as an array
- * of 64-bit integers.*/
-#define N64 (N * 2)
-
-/*----------------------
- the parameters of SFMT
- following definitions are in paramsXXXX.h file.
- ----------------------*/
-/** the pick up position of the array.
-#define POS1 122
-*/
-
-/** the parameter of shift left as four 32-bit registers.
-#define SL1 18
- */
-
-/** the parameter of shift left as one 128-bit register.
- * The 128-bit integer is shifted by (SL2 * 8) bits.
-#define SL2 1
-*/
-
-/** the parameter of shift right as four 32-bit registers.
-#define SR1 11
-*/
-
-/** the parameter of shift right as one 128-bit register.
- * The 128-bit integer is shifted by (SL2 * 8) bits.
-#define SR2 1
-*/
-
-/** A bitmask, used in the recursion. These parameters are introduced
- * to break symmetry of SIMD.
-#define MSK1 0xdfffffefU
-#define MSK2 0xddfecb7fU
-#define MSK3 0xbffaffffU
-#define MSK4 0xbffffff6U
-*/
-
-/** These definitions are part of a 128-bit period certification vector.
-#define PARITY1 0x00000001U
-#define PARITY2 0x00000000U
-#define PARITY3 0x00000000U
-#define PARITY4 0xc98e126aU
-*/
-
-#if MEXP == 607
- #include "test/SFMT-params607.h"
-#elif MEXP == 1279
- #include "test/SFMT-params1279.h"
-#elif MEXP == 2281
- #include "test/SFMT-params2281.h"
-#elif MEXP == 4253
- #include "test/SFMT-params4253.h"
-#elif MEXP == 11213
- #include "test/SFMT-params11213.h"
-#elif MEXP == 19937
- #include "test/SFMT-params19937.h"
-#elif MEXP == 44497
- #include "test/SFMT-params44497.h"
-#elif MEXP == 86243
- #include "test/SFMT-params86243.h"
-#elif MEXP == 132049
- #include "test/SFMT-params132049.h"
-#elif MEXP == 216091
- #include "test/SFMT-params216091.h"
-#else
-#ifdef __GNUC__
- #error "MEXP is not valid."
- #undef MEXP
-#else
- #undef MEXP
-#endif
-
-#endif
-
-#endif /* SFMT_PARAMS_H */
diff --git a/memory/jemalloc/src/test/include/test/SFMT-params11213.h b/memory/jemalloc/src/test/include/test/SFMT-params11213.h
deleted file mode 100644
index 2994bd21da..0000000000
--- a/memory/jemalloc/src/test/include/test/SFMT-params11213.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * This file derives from SFMT 1.3.3
- * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was
- * released under the terms of the following license:
- *
- * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
- * University. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of the Hiroshima University nor the names of
- * its contributors may be used to endorse or promote products
- * derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef SFMT_PARAMS11213_H
-#define SFMT_PARAMS11213_H
-
-#define POS1 68
-#define SL1 14
-#define SL2 3
-#define SR1 7
-#define SR2 3
-#define MSK1 0xeffff7fbU
-#define MSK2 0xffffffefU
-#define MSK3 0xdfdfbfffU
-#define MSK4 0x7fffdbfdU
-#define PARITY1 0x00000001U
-#define PARITY2 0x00000000U
-#define PARITY3 0xe8148000U
-#define PARITY4 0xd0c7afa3U
-
-
-/* PARAMETERS FOR ALTIVEC */
-#if defined(__APPLE__) /* For OSX */
- #define ALTI_SL1 (vector unsigned int)(SL1, SL1, SL1, SL1)
- #define ALTI_SR1 (vector unsigned int)(SR1, SR1, SR1, SR1)
- #define ALTI_MSK (vector unsigned int)(MSK1, MSK2, MSK3, MSK4)
- #define ALTI_MSK64 \
- (vector unsigned int)(MSK2, MSK1, MSK4, MSK3)
- #define ALTI_SL2_PERM \
- (vector unsigned char)(3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10)
- #define ALTI_SL2_PERM64 \
- (vector unsigned char)(3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2)
- #define ALTI_SR2_PERM \
- (vector unsigned char)(5,6,7,0,9,10,11,4,13,14,15,8,19,19,19,12)
- #define ALTI_SR2_PERM64 \
- (vector unsigned char)(13,14,15,0,1,2,3,4,19,19,19,8,9,10,11,12)
-#else /* For OTHER OSs(Linux?) */
- #define ALTI_SL1 {SL1, SL1, SL1, SL1}
- #define ALTI_SR1 {SR1, SR1, SR1, SR1}
- #define ALTI_MSK {MSK1, MSK2, MSK3, MSK4}
- #define ALTI_MSK64 {MSK2, MSK1, MSK4, MSK3}
- #define ALTI_SL2_PERM {3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10}
- #define ALTI_SL2_PERM64 {3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2}
- #define ALTI_SR2_PERM {5,6,7,0,9,10,11,4,13,14,15,8,19,19,19,12}
- #define ALTI_SR2_PERM64 {13,14,15,0,1,2,3,4,19,19,19,8,9,10,11,12}
-#endif /* For OSX */
-#define IDSTR "SFMT-11213:68-14-3-7-3:effff7fb-ffffffef-dfdfbfff-7fffdbfd"
-
-#endif /* SFMT_PARAMS11213_H */
diff --git a/memory/jemalloc/src/test/include/test/SFMT-params1279.h b/memory/jemalloc/src/test/include/test/SFMT-params1279.h
deleted file mode 100644
index d7959f9808..0000000000
--- a/memory/jemalloc/src/test/include/test/SFMT-params1279.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * This file derives from SFMT 1.3.3
- * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was
- * released under the terms of the following license:
- *
- * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
- * University. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of the Hiroshima University nor the names of
- * its contributors may be used to endorse or promote products
- * derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef SFMT_PARAMS1279_H
-#define SFMT_PARAMS1279_H
-
-#define POS1 7
-#define SL1 14
-#define SL2 3
-#define SR1 5
-#define SR2 1
-#define MSK1 0xf7fefffdU
-#define MSK2 0x7fefcfffU
-#define MSK3 0xaff3ef3fU
-#define MSK4 0xb5ffff7fU
-#define PARITY1 0x00000001U
-#define PARITY2 0x00000000U
-#define PARITY3 0x00000000U
-#define PARITY4 0x20000000U
-
-
-/* PARAMETERS FOR ALTIVEC */
-#if defined(__APPLE__) /* For OSX */
- #define ALTI_SL1 (vector unsigned int)(SL1, SL1, SL1, SL1)
- #define ALTI_SR1 (vector unsigned int)(SR1, SR1, SR1, SR1)
- #define ALTI_MSK (vector unsigned int)(MSK1, MSK2, MSK3, MSK4)
- #define ALTI_MSK64 \
- (vector unsigned int)(MSK2, MSK1, MSK4, MSK3)
- #define ALTI_SL2_PERM \
- (vector unsigned char)(3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10)
- #define ALTI_SL2_PERM64 \
- (vector unsigned char)(3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2)
- #define ALTI_SR2_PERM \
- (vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14)
- #define ALTI_SR2_PERM64 \
- (vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14)
-#else /* For OTHER OSs(Linux?) */
- #define ALTI_SL1 {SL1, SL1, SL1, SL1}
- #define ALTI_SR1 {SR1, SR1, SR1, SR1}
- #define ALTI_MSK {MSK1, MSK2, MSK3, MSK4}
- #define ALTI_MSK64 {MSK2, MSK1, MSK4, MSK3}
- #define ALTI_SL2_PERM {3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10}
- #define ALTI_SL2_PERM64 {3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2}
- #define ALTI_SR2_PERM {7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14}
- #define ALTI_SR2_PERM64 {15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14}
-#endif /* For OSX */
-#define IDSTR "SFMT-1279:7-14-3-5-1:f7fefffd-7fefcfff-aff3ef3f-b5ffff7f"
-
-#endif /* SFMT_PARAMS1279_H */
diff --git a/memory/jemalloc/src/test/include/test/SFMT-params132049.h b/memory/jemalloc/src/test/include/test/SFMT-params132049.h
deleted file mode 100644
index a1dcec3926..0000000000
--- a/memory/jemalloc/src/test/include/test/SFMT-params132049.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * This file derives from SFMT 1.3.3
- * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was
- * released under the terms of the following license:
- *
- * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
- * University. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of the Hiroshima University nor the names of
- * its contributors may be used to endorse or promote products
- * derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef SFMT_PARAMS132049_H
-#define SFMT_PARAMS132049_H
-
-#define POS1 110
-#define SL1 19
-#define SL2 1
-#define SR1 21
-#define SR2 1
-#define MSK1 0xffffbb5fU
-#define MSK2 0xfb6ebf95U
-#define MSK3 0xfffefffaU
-#define MSK4 0xcff77fffU
-#define PARITY1 0x00000001U
-#define PARITY2 0x00000000U
-#define PARITY3 0xcb520000U
-#define PARITY4 0xc7e91c7dU
-
-
-/* PARAMETERS FOR ALTIVEC */
-#if defined(__APPLE__) /* For OSX */
- #define ALTI_SL1 (vector unsigned int)(SL1, SL1, SL1, SL1)
- #define ALTI_SR1 (vector unsigned int)(SR1, SR1, SR1, SR1)
- #define ALTI_MSK (vector unsigned int)(MSK1, MSK2, MSK3, MSK4)
- #define ALTI_MSK64 \
- (vector unsigned int)(MSK2, MSK1, MSK4, MSK3)
- #define ALTI_SL2_PERM \
- (vector unsigned char)(1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8)
- #define ALTI_SL2_PERM64 \
- (vector unsigned char)(1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0)
- #define ALTI_SR2_PERM \
- (vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14)
- #define ALTI_SR2_PERM64 \
- (vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14)
-#else /* For OTHER OSs(Linux?) */
- #define ALTI_SL1 {SL1, SL1, SL1, SL1}
- #define ALTI_SR1 {SR1, SR1, SR1, SR1}
- #define ALTI_MSK {MSK1, MSK2, MSK3, MSK4}
- #define ALTI_MSK64 {MSK2, MSK1, MSK4, MSK3}
- #define ALTI_SL2_PERM {1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8}
- #define ALTI_SL2_PERM64 {1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0}
- #define ALTI_SR2_PERM {7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14}
- #define ALTI_SR2_PERM64 {15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14}
-#endif /* For OSX */
-#define IDSTR "SFMT-132049:110-19-1-21-1:ffffbb5f-fb6ebf95-fffefffa-cff77fff"
-
-#endif /* SFMT_PARAMS132049_H */
diff --git a/memory/jemalloc/src/test/include/test/SFMT-params19937.h b/memory/jemalloc/src/test/include/test/SFMT-params19937.h
deleted file mode 100644
index fb92b4c9b0..0000000000
--- a/memory/jemalloc/src/test/include/test/SFMT-params19937.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * This file derives from SFMT 1.3.3
- * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was
- * released under the terms of the following license:
- *
- * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
- * University. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of the Hiroshima University nor the names of
- * its contributors may be used to endorse or promote products
- * derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef SFMT_PARAMS19937_H
-#define SFMT_PARAMS19937_H
-
-#define POS1 122
-#define SL1 18
-#define SL2 1
-#define SR1 11
-#define SR2 1
-#define MSK1 0xdfffffefU
-#define MSK2 0xddfecb7fU
-#define MSK3 0xbffaffffU
-#define MSK4 0xbffffff6U
-#define PARITY1 0x00000001U
-#define PARITY2 0x00000000U
-#define PARITY3 0x00000000U
-#define PARITY4 0x13c9e684U
-
-
-/* PARAMETERS FOR ALTIVEC */
-#if defined(__APPLE__) /* For OSX */
- #define ALTI_SL1 (vector unsigned int)(SL1, SL1, SL1, SL1)
- #define ALTI_SR1 (vector unsigned int)(SR1, SR1, SR1, SR1)
- #define ALTI_MSK (vector unsigned int)(MSK1, MSK2, MSK3, MSK4)
- #define ALTI_MSK64 \
- (vector unsigned int)(MSK2, MSK1, MSK4, MSK3)
- #define ALTI_SL2_PERM \
- (vector unsigned char)(1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8)
- #define ALTI_SL2_PERM64 \
- (vector unsigned char)(1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0)
- #define ALTI_SR2_PERM \
- (vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14)
- #define ALTI_SR2_PERM64 \
- (vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14)
-#else /* For OTHER OSs(Linux?) */
- #define ALTI_SL1 {SL1, SL1, SL1, SL1}
- #define ALTI_SR1 {SR1, SR1, SR1, SR1}
- #define ALTI_MSK {MSK1, MSK2, MSK3, MSK4}
- #define ALTI_MSK64 {MSK2, MSK1, MSK4, MSK3}
- #define ALTI_SL2_PERM {1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8}
- #define ALTI_SL2_PERM64 {1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0}
- #define ALTI_SR2_PERM {7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14}
- #define ALTI_SR2_PERM64 {15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14}
-#endif /* For OSX */
-#define IDSTR "SFMT-19937:122-18-1-11-1:dfffffef-ddfecb7f-bffaffff-bffffff6"
-
-#endif /* SFMT_PARAMS19937_H */
diff --git a/memory/jemalloc/src/test/include/test/SFMT-params216091.h b/memory/jemalloc/src/test/include/test/SFMT-params216091.h
deleted file mode 100644
index 125ce28204..0000000000
--- a/memory/jemalloc/src/test/include/test/SFMT-params216091.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * This file derives from SFMT 1.3.3
- * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was
- * released under the terms of the following license:
- *
- * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
- * University. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of the Hiroshima University nor the names of
- * its contributors may be used to endorse or promote products
- * derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef SFMT_PARAMS216091_H
-#define SFMT_PARAMS216091_H
-
-#define POS1 627
-#define SL1 11
-#define SL2 3
-#define SR1 10
-#define SR2 1
-#define MSK1 0xbff7bff7U
-#define MSK2 0xbfffffffU
-#define MSK3 0xbffffa7fU
-#define MSK4 0xffddfbfbU
-#define PARITY1 0xf8000001U
-#define PARITY2 0x89e80709U
-#define PARITY3 0x3bd2b64bU
-#define PARITY4 0x0c64b1e4U
-
-
-/* PARAMETERS FOR ALTIVEC */
-#if defined(__APPLE__) /* For OSX */
- #define ALTI_SL1 (vector unsigned int)(SL1, SL1, SL1, SL1)
- #define ALTI_SR1 (vector unsigned int)(SR1, SR1, SR1, SR1)
- #define ALTI_MSK (vector unsigned int)(MSK1, MSK2, MSK3, MSK4)
- #define ALTI_MSK64 \
- (vector unsigned int)(MSK2, MSK1, MSK4, MSK3)
- #define ALTI_SL2_PERM \
- (vector unsigned char)(3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10)
- #define ALTI_SL2_PERM64 \
- (vector unsigned char)(3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2)
- #define ALTI_SR2_PERM \
- (vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14)
- #define ALTI_SR2_PERM64 \
- (vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14)
-#else /* For OTHER OSs(Linux?) */
- #define ALTI_SL1 {SL1, SL1, SL1, SL1}
- #define ALTI_SR1 {SR1, SR1, SR1, SR1}
- #define ALTI_MSK {MSK1, MSK2, MSK3, MSK4}
- #define ALTI_MSK64 {MSK2, MSK1, MSK4, MSK3}
- #define ALTI_SL2_PERM {3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10}
- #define ALTI_SL2_PERM64 {3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2}
- #define ALTI_SR2_PERM {7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14}
- #define ALTI_SR2_PERM64 {15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14}
-#endif /* For OSX */
-#define IDSTR "SFMT-216091:627-11-3-10-1:bff7bff7-bfffffff-bffffa7f-ffddfbfb"
-
-#endif /* SFMT_PARAMS216091_H */
diff --git a/memory/jemalloc/src/test/include/test/SFMT-params2281.h b/memory/jemalloc/src/test/include/test/SFMT-params2281.h
deleted file mode 100644
index 0ef85c4070..0000000000
--- a/memory/jemalloc/src/test/include/test/SFMT-params2281.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * This file derives from SFMT 1.3.3
- * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was
- * released under the terms of the following license:
- *
- * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
- * University. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of the Hiroshima University nor the names of
- * its contributors may be used to endorse or promote products
- * derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef SFMT_PARAMS2281_H
-#define SFMT_PARAMS2281_H
-
-#define POS1 12
-#define SL1 19
-#define SL2 1
-#define SR1 5
-#define SR2 1
-#define MSK1 0xbff7ffbfU
-#define MSK2 0xfdfffffeU
-#define MSK3 0xf7ffef7fU
-#define MSK4 0xf2f7cbbfU
-#define PARITY1 0x00000001U
-#define PARITY2 0x00000000U
-#define PARITY3 0x00000000U
-#define PARITY4 0x41dfa600U
-
-
-/* PARAMETERS FOR ALTIVEC */
-#if defined(__APPLE__) /* For OSX */
- #define ALTI_SL1 (vector unsigned int)(SL1, SL1, SL1, SL1)
- #define ALTI_SR1 (vector unsigned int)(SR1, SR1, SR1, SR1)
- #define ALTI_MSK (vector unsigned int)(MSK1, MSK2, MSK3, MSK4)
- #define ALTI_MSK64 \
- (vector unsigned int)(MSK2, MSK1, MSK4, MSK3)
- #define ALTI_SL2_PERM \
- (vector unsigned char)(1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8)
- #define ALTI_SL2_PERM64 \
- (vector unsigned char)(1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0)
- #define ALTI_SR2_PERM \
- (vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14)
- #define ALTI_SR2_PERM64 \
- (vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14)
-#else /* For OTHER OSs(Linux?) */
- #define ALTI_SL1 {SL1, SL1, SL1, SL1}
- #define ALTI_SR1 {SR1, SR1, SR1, SR1}
- #define ALTI_MSK {MSK1, MSK2, MSK3, MSK4}
- #define ALTI_MSK64 {MSK2, MSK1, MSK4, MSK3}
- #define ALTI_SL2_PERM {1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8}
- #define ALTI_SL2_PERM64 {1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0}
- #define ALTI_SR2_PERM {7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14}
- #define ALTI_SR2_PERM64 {15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14}
-#endif /* For OSX */
-#define IDSTR "SFMT-2281:12-19-1-5-1:bff7ffbf-fdfffffe-f7ffef7f-f2f7cbbf"
-
-#endif /* SFMT_PARAMS2281_H */
diff --git a/memory/jemalloc/src/test/include/test/SFMT-params4253.h b/memory/jemalloc/src/test/include/test/SFMT-params4253.h
deleted file mode 100644
index 9f07bc67e1..0000000000
--- a/memory/jemalloc/src/test/include/test/SFMT-params4253.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * This file derives from SFMT 1.3.3
- * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was
- * released under the terms of the following license:
- *
- * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
- * University. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of the Hiroshima University nor the names of
- * its contributors may be used to endorse or promote products
- * derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef SFMT_PARAMS4253_H
-#define SFMT_PARAMS4253_H
-
-#define POS1 17
-#define SL1 20
-#define SL2 1
-#define SR1 7
-#define SR2 1
-#define MSK1 0x9f7bffffU
-#define MSK2 0x9fffff5fU
-#define MSK3 0x3efffffbU
-#define MSK4 0xfffff7bbU
-#define PARITY1 0xa8000001U
-#define PARITY2 0xaf5390a3U
-#define PARITY3 0xb740b3f8U
-#define PARITY4 0x6c11486dU
-
-
-/* PARAMETERS FOR ALTIVEC */
-#if defined(__APPLE__) /* For OSX */
- #define ALTI_SL1 (vector unsigned int)(SL1, SL1, SL1, SL1)
- #define ALTI_SR1 (vector unsigned int)(SR1, SR1, SR1, SR1)
- #define ALTI_MSK (vector unsigned int)(MSK1, MSK2, MSK3, MSK4)
- #define ALTI_MSK64 \
- (vector unsigned int)(MSK2, MSK1, MSK4, MSK3)
- #define ALTI_SL2_PERM \
- (vector unsigned char)(1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8)
- #define ALTI_SL2_PERM64 \
- (vector unsigned char)(1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0)
- #define ALTI_SR2_PERM \
- (vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14)
- #define ALTI_SR2_PERM64 \
- (vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14)
-#else /* For OTHER OSs(Linux?) */
- #define ALTI_SL1 {SL1, SL1, SL1, SL1}
- #define ALTI_SR1 {SR1, SR1, SR1, SR1}
- #define ALTI_MSK {MSK1, MSK2, MSK3, MSK4}
- #define ALTI_MSK64 {MSK2, MSK1, MSK4, MSK3}
- #define ALTI_SL2_PERM {1,2,3,23,5,6,7,0,9,10,11,4,13,14,15,8}
- #define ALTI_SL2_PERM64 {1,2,3,4,5,6,7,31,9,10,11,12,13,14,15,0}
- #define ALTI_SR2_PERM {7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14}
- #define ALTI_SR2_PERM64 {15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14}
-#endif /* For OSX */
-#define IDSTR "SFMT-4253:17-20-1-7-1:9f7bffff-9fffff5f-3efffffb-fffff7bb"
-
-#endif /* SFMT_PARAMS4253_H */
diff --git a/memory/jemalloc/src/test/include/test/SFMT-params44497.h b/memory/jemalloc/src/test/include/test/SFMT-params44497.h
deleted file mode 100644
index 85598fed51..0000000000
--- a/memory/jemalloc/src/test/include/test/SFMT-params44497.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * This file derives from SFMT 1.3.3
- * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was
- * released under the terms of the following license:
- *
- * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
- * University. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of the Hiroshima University nor the names of
- * its contributors may be used to endorse or promote products
- * derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef SFMT_PARAMS44497_H
-#define SFMT_PARAMS44497_H
-
-#define POS1 330
-#define SL1 5
-#define SL2 3
-#define SR1 9
-#define SR2 3
-#define MSK1 0xeffffffbU
-#define MSK2 0xdfbebfffU
-#define MSK3 0xbfbf7befU
-#define MSK4 0x9ffd7bffU
-#define PARITY1 0x00000001U
-#define PARITY2 0x00000000U
-#define PARITY3 0xa3ac4000U
-#define PARITY4 0xecc1327aU
-
-
-/* PARAMETERS FOR ALTIVEC */
-#if defined(__APPLE__) /* For OSX */
- #define ALTI_SL1 (vector unsigned int)(SL1, SL1, SL1, SL1)
- #define ALTI_SR1 (vector unsigned int)(SR1, SR1, SR1, SR1)
- #define ALTI_MSK (vector unsigned int)(MSK1, MSK2, MSK3, MSK4)
- #define ALTI_MSK64 \
- (vector unsigned int)(MSK2, MSK1, MSK4, MSK3)
- #define ALTI_SL2_PERM \
- (vector unsigned char)(3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10)
- #define ALTI_SL2_PERM64 \
- (vector unsigned char)(3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2)
- #define ALTI_SR2_PERM \
- (vector unsigned char)(5,6,7,0,9,10,11,4,13,14,15,8,19,19,19,12)
- #define ALTI_SR2_PERM64 \
- (vector unsigned char)(13,14,15,0,1,2,3,4,19,19,19,8,9,10,11,12)
-#else /* For OTHER OSs(Linux?) */
- #define ALTI_SL1 {SL1, SL1, SL1, SL1}
- #define ALTI_SR1 {SR1, SR1, SR1, SR1}
- #define ALTI_MSK {MSK1, MSK2, MSK3, MSK4}
- #define ALTI_MSK64 {MSK2, MSK1, MSK4, MSK3}
- #define ALTI_SL2_PERM {3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10}
- #define ALTI_SL2_PERM64 {3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2}
- #define ALTI_SR2_PERM {5,6,7,0,9,10,11,4,13,14,15,8,19,19,19,12}
- #define ALTI_SR2_PERM64 {13,14,15,0,1,2,3,4,19,19,19,8,9,10,11,12}
-#endif /* For OSX */
-#define IDSTR "SFMT-44497:330-5-3-9-3:effffffb-dfbebfff-bfbf7bef-9ffd7bff"
-
-#endif /* SFMT_PARAMS44497_H */
diff --git a/memory/jemalloc/src/test/include/test/SFMT-params607.h b/memory/jemalloc/src/test/include/test/SFMT-params607.h
deleted file mode 100644
index bc76485f8b..0000000000
--- a/memory/jemalloc/src/test/include/test/SFMT-params607.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * This file derives from SFMT 1.3.3
- * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was
- * released under the terms of the following license:
- *
- * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
- * University. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of the Hiroshima University nor the names of
- * its contributors may be used to endorse or promote products
- * derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef SFMT_PARAMS607_H
-#define SFMT_PARAMS607_H
-
-#define POS1 2
-#define SL1 15
-#define SL2 3
-#define SR1 13
-#define SR2 3
-#define MSK1 0xfdff37ffU
-#define MSK2 0xef7f3f7dU
-#define MSK3 0xff777b7dU
-#define MSK4 0x7ff7fb2fU
-#define PARITY1 0x00000001U
-#define PARITY2 0x00000000U
-#define PARITY3 0x00000000U
-#define PARITY4 0x5986f054U
-
-
-/* PARAMETERS FOR ALTIVEC */
-#if defined(__APPLE__) /* For OSX */
- #define ALTI_SL1 (vector unsigned int)(SL1, SL1, SL1, SL1)
- #define ALTI_SR1 (vector unsigned int)(SR1, SR1, SR1, SR1)
- #define ALTI_MSK (vector unsigned int)(MSK1, MSK2, MSK3, MSK4)
- #define ALTI_MSK64 \
- (vector unsigned int)(MSK2, MSK1, MSK4, MSK3)
- #define ALTI_SL2_PERM \
- (vector unsigned char)(3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10)
- #define ALTI_SL2_PERM64 \
- (vector unsigned char)(3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2)
- #define ALTI_SR2_PERM \
- (vector unsigned char)(5,6,7,0,9,10,11,4,13,14,15,8,19,19,19,12)
- #define ALTI_SR2_PERM64 \
- (vector unsigned char)(13,14,15,0,1,2,3,4,19,19,19,8,9,10,11,12)
-#else /* For OTHER OSs(Linux?) */
- #define ALTI_SL1 {SL1, SL1, SL1, SL1}
- #define ALTI_SR1 {SR1, SR1, SR1, SR1}
- #define ALTI_MSK {MSK1, MSK2, MSK3, MSK4}
- #define ALTI_MSK64 {MSK2, MSK1, MSK4, MSK3}
- #define ALTI_SL2_PERM {3,21,21,21,7,0,1,2,11,4,5,6,15,8,9,10}
- #define ALTI_SL2_PERM64 {3,4,5,6,7,29,29,29,11,12,13,14,15,0,1,2}
- #define ALTI_SR2_PERM {5,6,7,0,9,10,11,4,13,14,15,8,19,19,19,12}
- #define ALTI_SR2_PERM64 {13,14,15,0,1,2,3,4,19,19,19,8,9,10,11,12}
-#endif /* For OSX */
-#define IDSTR "SFMT-607:2-15-3-13-3:fdff37ff-ef7f3f7d-ff777b7d-7ff7fb2f"
-
-#endif /* SFMT_PARAMS607_H */
diff --git a/memory/jemalloc/src/test/include/test/SFMT-params86243.h b/memory/jemalloc/src/test/include/test/SFMT-params86243.h
deleted file mode 100644
index 5e4d783c5d..0000000000
--- a/memory/jemalloc/src/test/include/test/SFMT-params86243.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * This file derives from SFMT 1.3.3
- * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was
- * released under the terms of the following license:
- *
- * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
- * University. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of the Hiroshima University nor the names of
- * its contributors may be used to endorse or promote products
- * derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#ifndef SFMT_PARAMS86243_H
-#define SFMT_PARAMS86243_H
-
-#define POS1 366
-#define SL1 6
-#define SL2 7
-#define SR1 19
-#define SR2 1
-#define MSK1 0xfdbffbffU
-#define MSK2 0xbff7ff3fU
-#define MSK3 0xfd77efffU
-#define MSK4 0xbf9ff3ffU
-#define PARITY1 0x00000001U
-#define PARITY2 0x00000000U
-#define PARITY3 0x00000000U
-#define PARITY4 0xe9528d85U
-
-
-/* PARAMETERS FOR ALTIVEC */
-#if defined(__APPLE__) /* For OSX */
- #define ALTI_SL1 (vector unsigned int)(SL1, SL1, SL1, SL1)
- #define ALTI_SR1 (vector unsigned int)(SR1, SR1, SR1, SR1)
- #define ALTI_MSK (vector unsigned int)(MSK1, MSK2, MSK3, MSK4)
- #define ALTI_MSK64 \
- (vector unsigned int)(MSK2, MSK1, MSK4, MSK3)
- #define ALTI_SL2_PERM \
- (vector unsigned char)(25,25,25,25,3,25,25,25,7,0,1,2,11,4,5,6)
- #define ALTI_SL2_PERM64 \
- (vector unsigned char)(7,25,25,25,25,25,25,25,15,0,1,2,3,4,5,6)
- #define ALTI_SR2_PERM \
- (vector unsigned char)(7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14)
- #define ALTI_SR2_PERM64 \
- (vector unsigned char)(15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14)
-#else /* For OTHER OSs(Linux?) */
- #define ALTI_SL1 {SL1, SL1, SL1, SL1}
- #define ALTI_SR1 {SR1, SR1, SR1, SR1}
- #define ALTI_MSK {MSK1, MSK2, MSK3, MSK4}
- #define ALTI_MSK64 {MSK2, MSK1, MSK4, MSK3}
- #define ALTI_SL2_PERM {25,25,25,25,3,25,25,25,7,0,1,2,11,4,5,6}
- #define ALTI_SL2_PERM64 {7,25,25,25,25,25,25,25,15,0,1,2,3,4,5,6}
- #define ALTI_SR2_PERM {7,0,1,2,11,4,5,6,15,8,9,10,17,12,13,14}
- #define ALTI_SR2_PERM64 {15,0,1,2,3,4,5,6,17,8,9,10,11,12,13,14}
-#endif /* For OSX */
-#define IDSTR "SFMT-86243:366-6-7-19-1:fdbffbff-bff7ff3f-fd77efff-bf9ff3ff"
-
-#endif /* SFMT_PARAMS86243_H */
diff --git a/memory/jemalloc/src/test/include/test/SFMT-sse2.h b/memory/jemalloc/src/test/include/test/SFMT-sse2.h
deleted file mode 100644
index 0314a163d5..0000000000
--- a/memory/jemalloc/src/test/include/test/SFMT-sse2.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * This file derives from SFMT 1.3.3
- * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was
- * released under the terms of the following license:
- *
- * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
- * University. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of the Hiroshima University nor the names of
- * its contributors may be used to endorse or promote products
- * derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/**
- * @file SFMT-sse2.h
- * @brief SIMD oriented Fast Mersenne Twister(SFMT) for Intel SSE2
- *
- * @author Mutsuo Saito (Hiroshima University)
- * @author Makoto Matsumoto (Hiroshima University)
- *
- * @note We assume LITTLE ENDIAN in this file
- *
- * Copyright (C) 2006, 2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
- * University. All rights reserved.
- *
- * The new BSD License is applied to this software, see LICENSE.txt
- */
-
-#ifndef SFMT_SSE2_H
-#define SFMT_SSE2_H
-
-/**
- * This function represents the recursion formula.
- * @param a a 128-bit part of the interal state array
- * @param b a 128-bit part of the interal state array
- * @param c a 128-bit part of the interal state array
- * @param d a 128-bit part of the interal state array
- * @param mask 128-bit mask
- * @return output
- */
-JEMALLOC_ALWAYS_INLINE __m128i mm_recursion(__m128i *a, __m128i *b,
- __m128i c, __m128i d, __m128i mask) {
- __m128i v, x, y, z;
-
- x = _mm_load_si128(a);
- y = _mm_srli_epi32(*b, SR1);
- z = _mm_srli_si128(c, SR2);
- v = _mm_slli_epi32(d, SL1);
- z = _mm_xor_si128(z, x);
- z = _mm_xor_si128(z, v);
- x = _mm_slli_si128(x, SL2);
- y = _mm_and_si128(y, mask);
- z = _mm_xor_si128(z, x);
- z = _mm_xor_si128(z, y);
- return z;
-}
-
-/**
- * This function fills the internal state array with pseudorandom
- * integers.
- */
-JEMALLOC_INLINE void gen_rand_all(sfmt_t *ctx) {
- int i;
- __m128i r, r1, r2, mask;
- mask = _mm_set_epi32(MSK4, MSK3, MSK2, MSK1);
-
- r1 = _mm_load_si128(&ctx->sfmt[N - 2].si);
- r2 = _mm_load_si128(&ctx->sfmt[N - 1].si);
- for (i = 0; i < N - POS1; i++) {
- r = mm_recursion(&ctx->sfmt[i].si, &ctx->sfmt[i + POS1].si, r1, r2,
- mask);
- _mm_store_si128(&ctx->sfmt[i].si, r);
- r1 = r2;
- r2 = r;
- }
- for (; i < N; i++) {
- r = mm_recursion(&ctx->sfmt[i].si, &ctx->sfmt[i + POS1 - N].si, r1, r2,
- mask);
- _mm_store_si128(&ctx->sfmt[i].si, r);
- r1 = r2;
- r2 = r;
- }
-}
-
-/**
- * This function fills the user-specified array with pseudorandom
- * integers.
- *
- * @param array an 128-bit array to be filled by pseudorandom numbers.
- * @param size number of 128-bit pesudorandom numbers to be generated.
- */
-JEMALLOC_INLINE void gen_rand_array(sfmt_t *ctx, w128_t *array, int size) {
- int i, j;
- __m128i r, r1, r2, mask;
- mask = _mm_set_epi32(MSK4, MSK3, MSK2, MSK1);
-
- r1 = _mm_load_si128(&ctx->sfmt[N - 2].si);
- r2 = _mm_load_si128(&ctx->sfmt[N - 1].si);
- for (i = 0; i < N - POS1; i++) {
- r = mm_recursion(&ctx->sfmt[i].si, &ctx->sfmt[i + POS1].si, r1, r2,
- mask);
- _mm_store_si128(&array[i].si, r);
- r1 = r2;
- r2 = r;
- }
- for (; i < N; i++) {
- r = mm_recursion(&ctx->sfmt[i].si, &array[i + POS1 - N].si, r1, r2,
- mask);
- _mm_store_si128(&array[i].si, r);
- r1 = r2;
- r2 = r;
- }
- /* main loop */
- for (; i < size - N; i++) {
- r = mm_recursion(&array[i - N].si, &array[i + POS1 - N].si, r1, r2,
- mask);
- _mm_store_si128(&array[i].si, r);
- r1 = r2;
- r2 = r;
- }
- for (j = 0; j < 2 * N - size; j++) {
- r = _mm_load_si128(&array[j + size - N].si);
- _mm_store_si128(&ctx->sfmt[j].si, r);
- }
- for (; i < size; i++) {
- r = mm_recursion(&array[i - N].si, &array[i + POS1 - N].si, r1, r2,
- mask);
- _mm_store_si128(&array[i].si, r);
- _mm_store_si128(&ctx->sfmt[j++].si, r);
- r1 = r2;
- r2 = r;
- }
-}
-
-#endif
diff --git a/memory/jemalloc/src/test/include/test/SFMT.h b/memory/jemalloc/src/test/include/test/SFMT.h
deleted file mode 100644
index 09c1607dd4..0000000000
--- a/memory/jemalloc/src/test/include/test/SFMT.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/*
- * This file derives from SFMT 1.3.3
- * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was
- * released under the terms of the following license:
- *
- * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
- * University. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of the Hiroshima University nor the names of
- * its contributors may be used to endorse or promote products
- * derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/**
- * @file SFMT.h
- *
- * @brief SIMD oriented Fast Mersenne Twister(SFMT) pseudorandom
- * number generator
- *
- * @author Mutsuo Saito (Hiroshima University)
- * @author Makoto Matsumoto (Hiroshima University)
- *
- * Copyright (C) 2006, 2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
- * University. All rights reserved.
- *
- * The new BSD License is applied to this software.
- * see LICENSE.txt
- *
- * @note We assume that your system has inttypes.h. If your system
- * doesn't have inttypes.h, you have to typedef uint32_t and uint64_t,
- * and you have to define PRIu64 and PRIx64 in this file as follows:
- * @verbatim
- typedef unsigned int uint32_t
- typedef unsigned long long uint64_t
- #define PRIu64 "llu"
- #define PRIx64 "llx"
-@endverbatim
- * uint32_t must be exactly 32-bit unsigned integer type (no more, no
- * less), and uint64_t must be exactly 64-bit unsigned integer type.
- * PRIu64 and PRIx64 are used for printf function to print 64-bit
- * unsigned int and 64-bit unsigned int in hexadecimal format.
- */
-
-#ifndef SFMT_H
-#define SFMT_H
-
-typedef struct sfmt_s sfmt_t;
-
-uint32_t gen_rand32(sfmt_t *ctx);
-uint32_t gen_rand32_range(sfmt_t *ctx, uint32_t limit);
-uint64_t gen_rand64(sfmt_t *ctx);
-uint64_t gen_rand64_range(sfmt_t *ctx, uint64_t limit);
-void fill_array32(sfmt_t *ctx, uint32_t *array, int size);
-void fill_array64(sfmt_t *ctx, uint64_t *array, int size);
-sfmt_t *init_gen_rand(uint32_t seed);
-sfmt_t *init_by_array(uint32_t *init_key, int key_length);
-void fini_gen_rand(sfmt_t *ctx);
-const char *get_idstring(void);
-int get_min_array_size32(void);
-int get_min_array_size64(void);
-
-#ifndef JEMALLOC_ENABLE_INLINE
-double to_real1(uint32_t v);
-double genrand_real1(sfmt_t *ctx);
-double to_real2(uint32_t v);
-double genrand_real2(sfmt_t *ctx);
-double to_real3(uint32_t v);
-double genrand_real3(sfmt_t *ctx);
-double to_res53(uint64_t v);
-double to_res53_mix(uint32_t x, uint32_t y);
-double genrand_res53(sfmt_t *ctx);
-double genrand_res53_mix(sfmt_t *ctx);
-#endif
-
-#if (defined(JEMALLOC_ENABLE_INLINE) || defined(SFMT_C_))
-/* These real versions are due to Isaku Wada */
-/** generates a random number on [0,1]-real-interval */
-JEMALLOC_INLINE double to_real1(uint32_t v)
-{
- return v * (1.0/4294967295.0);
- /* divided by 2^32-1 */
-}
-
-/** generates a random number on [0,1]-real-interval */
-JEMALLOC_INLINE double genrand_real1(sfmt_t *ctx)
-{
- return to_real1(gen_rand32(ctx));
-}
-
-/** generates a random number on [0,1)-real-interval */
-JEMALLOC_INLINE double to_real2(uint32_t v)
-{
- return v * (1.0/4294967296.0);
- /* divided by 2^32 */
-}
-
-/** generates a random number on [0,1)-real-interval */
-JEMALLOC_INLINE double genrand_real2(sfmt_t *ctx)
-{
- return to_real2(gen_rand32(ctx));
-}
-
-/** generates a random number on (0,1)-real-interval */
-JEMALLOC_INLINE double to_real3(uint32_t v)
-{
- return (((double)v) + 0.5)*(1.0/4294967296.0);
- /* divided by 2^32 */
-}
-
-/** generates a random number on (0,1)-real-interval */
-JEMALLOC_INLINE double genrand_real3(sfmt_t *ctx)
-{
- return to_real3(gen_rand32(ctx));
-}
-/** These real versions are due to Isaku Wada */
-
-/** generates a random number on [0,1) with 53-bit resolution*/
-JEMALLOC_INLINE double to_res53(uint64_t v)
-{
- return v * (1.0/18446744073709551616.0L);
-}
-
-/** generates a random number on [0,1) with 53-bit resolution from two
- * 32 bit integers */
-JEMALLOC_INLINE double to_res53_mix(uint32_t x, uint32_t y)
-{
- return to_res53(x | ((uint64_t)y << 32));
-}
-
-/** generates a random number on [0,1) with 53-bit resolution
- */
-JEMALLOC_INLINE double genrand_res53(sfmt_t *ctx)
-{
- return to_res53(gen_rand64(ctx));
-}
-
-/** generates a random number on [0,1) with 53-bit resolution
- using 32bit integer.
- */
-JEMALLOC_INLINE double genrand_res53_mix(sfmt_t *ctx)
-{
- uint32_t x, y;
-
- x = gen_rand32(ctx);
- y = gen_rand32(ctx);
- return to_res53_mix(x, y);
-}
-#endif
-#endif
diff --git a/memory/jemalloc/src/test/include/test/btalloc.h b/memory/jemalloc/src/test/include/test/btalloc.h
deleted file mode 100644
index c3f9d4df73..0000000000
--- a/memory/jemalloc/src/test/include/test/btalloc.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* btalloc() provides a mechanism for allocating via permuted backtraces. */
-void *btalloc(size_t size, unsigned bits);
-
-#define btalloc_n_proto(n) \
-void *btalloc_##n(size_t size, unsigned bits);
-btalloc_n_proto(0)
-btalloc_n_proto(1)
-
-#define btalloc_n_gen(n) \
-void * \
-btalloc_##n(size_t size, unsigned bits) \
-{ \
- void *p; \
- \
- if (bits == 0) \
- p = mallocx(size, 0); \
- else { \
- switch (bits & 0x1U) { \
- case 0: \
- p = (btalloc_0(size, bits >> 1)); \
- break; \
- case 1: \
- p = (btalloc_1(size, bits >> 1)); \
- break; \
- default: not_reached(); \
- } \
- } \
- /* Intentionally sabotage tail call optimization. */ \
- assert_ptr_not_null(p, "Unexpected mallocx() failure"); \
- return (p); \
-}
diff --git a/memory/jemalloc/src/test/include/test/jemalloc_test.h.in b/memory/jemalloc/src/test/include/test/jemalloc_test.h.in
deleted file mode 100644
index 1f36e46954..0000000000
--- a/memory/jemalloc/src/test/include/test/jemalloc_test.h.in
+++ /dev/null
@@ -1,163 +0,0 @@
-#include <limits.h>
-#ifndef SIZE_T_MAX
-# define SIZE_T_MAX SIZE_MAX
-#endif
-#include <stdlib.h>
-#include <stdarg.h>
-#include <stdbool.h>
-#include <errno.h>
-#include <math.h>
-#include <string.h>
-#ifdef _WIN32
-# include "msvc_compat/strings.h"
-#endif
-
-#ifdef _WIN32
-# include <windows.h>
-# include "msvc_compat/windows_extra.h"
-#else
-# include <pthread.h>
-#endif
-
-#include "test/jemalloc_test_defs.h"
-
-#ifdef JEMALLOC_OSSPIN
-# include <libkern/OSAtomic.h>
-#endif
-
-#if defined(HAVE_ALTIVEC) && !defined(__APPLE__)
-# include <altivec.h>
-#endif
-#ifdef HAVE_SSE2
-# include <emmintrin.h>
-#endif
-
-/******************************************************************************/
-/*
- * For unit tests, expose all public and private interfaces.
- */
-#ifdef JEMALLOC_UNIT_TEST
-# define JEMALLOC_JET
-# define JEMALLOC_MANGLE
-# include "jemalloc/internal/jemalloc_internal.h"
-
-/******************************************************************************/
-/*
- * For integration tests, expose the public jemalloc interfaces, but only
- * expose the minimum necessary internal utility code (to avoid re-implementing
- * essentially identical code within the test infrastructure).
- */
-#elif defined(JEMALLOC_INTEGRATION_TEST)
-# define JEMALLOC_MANGLE
-# include "jemalloc/jemalloc@install_suffix@.h"
-# include "jemalloc/internal/jemalloc_internal_defs.h"
-# include "jemalloc/internal/jemalloc_internal_macros.h"
-
-static const bool config_debug =
-#ifdef JEMALLOC_DEBUG
- true
-#else
- false
-#endif
- ;
-
-# define JEMALLOC_N(n) @private_namespace@##n
-# include "jemalloc/internal/private_namespace.h"
-
-# define JEMALLOC_H_TYPES
-# define JEMALLOC_H_STRUCTS
-# define JEMALLOC_H_EXTERNS
-# define JEMALLOC_H_INLINES
-# include "jemalloc/internal/nstime.h"
-# include "jemalloc/internal/util.h"
-# include "jemalloc/internal/qr.h"
-# include "jemalloc/internal/ql.h"
-# undef JEMALLOC_H_TYPES
-# undef JEMALLOC_H_STRUCTS
-# undef JEMALLOC_H_EXTERNS
-# undef JEMALLOC_H_INLINES
-
-/******************************************************************************/
-/*
- * For stress tests, expose the public jemalloc interfaces with name mangling
- * so that they can be tested as e.g. malloc() and free(). Also expose the
- * public jemalloc interfaces with jet_ prefixes, so that stress tests can use
- * a separate allocator for their internal data structures.
- */
-#elif defined(JEMALLOC_STRESS_TEST)
-# include "jemalloc/jemalloc@install_suffix@.h"
-
-# include "jemalloc/jemalloc_protos_jet.h"
-
-# define JEMALLOC_JET
-# include "jemalloc/internal/jemalloc_internal.h"
-# include "jemalloc/internal/public_unnamespace.h"
-# undef JEMALLOC_JET
-
-# include "jemalloc/jemalloc_rename.h"
-# define JEMALLOC_MANGLE
-# ifdef JEMALLOC_STRESS_TESTLIB
-# include "jemalloc/jemalloc_mangle_jet.h"
-# else
-# include "jemalloc/jemalloc_mangle.h"
-# endif
-
-/******************************************************************************/
-/*
- * This header does dangerous things, the effects of which only test code
- * should be subject to.
- */
-#else
-# error "This header cannot be included outside a testing context"
-#endif
-
-/******************************************************************************/
-/*
- * Common test utilities.
- */
-#include "test/btalloc.h"
-#include "test/math.h"
-#include "test/mtx.h"
-#include "test/mq.h"
-#include "test/test.h"
-#include "test/timer.h"
-#include "test/thd.h"
-#define MEXP 19937
-#include "test/SFMT.h"
-
-/******************************************************************************/
-/*
- * Define always-enabled assertion macros, so that test assertions execute even
- * if assertions are disabled in the library code.
- */
-#undef assert
-#undef not_reached
-#undef not_implemented
-#undef assert_not_implemented
-
-#define assert(e) do { \
- if (!(e)) { \
- malloc_printf( \
- "<jemalloc>: %s:%d: Failed assertion: \"%s\"\n", \
- __FILE__, __LINE__, #e); \
- abort(); \
- } \
-} while (0)
-
-#define not_reached() do { \
- malloc_printf( \
- "<jemalloc>: %s:%d: Unreachable code reached\n", \
- __FILE__, __LINE__); \
- abort(); \
-} while (0)
-
-#define not_implemented() do { \
- malloc_printf("<jemalloc>: %s:%d: Not implemented\n", \
- __FILE__, __LINE__); \
- abort(); \
-} while (0)
-
-#define assert_not_implemented(e) do { \
- if (!(e)) \
- not_implemented(); \
-} while (0)
diff --git a/memory/jemalloc/src/test/include/test/jemalloc_test_defs.h.in b/memory/jemalloc/src/test/include/test/jemalloc_test_defs.h.in
deleted file mode 100644
index 5cc8532a34..0000000000
--- a/memory/jemalloc/src/test/include/test/jemalloc_test_defs.h.in
+++ /dev/null
@@ -1,9 +0,0 @@
-#include "jemalloc/internal/jemalloc_internal_defs.h"
-#include "jemalloc/internal/jemalloc_internal_decls.h"
-
-/*
- * For use by SFMT. configure.ac doesn't actually define HAVE_SSE2 because its
- * dependencies are notoriously unportable in practice.
- */
-#undef HAVE_SSE2
-#undef HAVE_ALTIVEC
diff --git a/memory/jemalloc/src/test/include/test/math.h b/memory/jemalloc/src/test/include/test/math.h
deleted file mode 100644
index b057b29a1d..0000000000
--- a/memory/jemalloc/src/test/include/test/math.h
+++ /dev/null
@@ -1,311 +0,0 @@
-#ifndef JEMALLOC_ENABLE_INLINE
-double ln_gamma(double x);
-double i_gamma(double x, double p, double ln_gamma_p);
-double pt_norm(double p);
-double pt_chi2(double p, double df, double ln_gamma_df_2);
-double pt_gamma(double p, double shape, double scale, double ln_gamma_shape);
-#endif
-
-#if (defined(JEMALLOC_ENABLE_INLINE) || defined(MATH_C_))
-/*
- * Compute the natural log of Gamma(x), accurate to 10 decimal places.
- *
- * This implementation is based on:
- *
- * Pike, M.C., I.D. Hill (1966) Algorithm 291: Logarithm of Gamma function
- * [S14]. Communications of the ACM 9(9):684.
- */
-JEMALLOC_INLINE double
-ln_gamma(double x)
-{
- double f, z;
-
- assert(x > 0.0);
-
- if (x < 7.0) {
- f = 1.0;
- z = x;
- while (z < 7.0) {
- f *= z;
- z += 1.0;
- }
- x = z;
- f = -log(f);
- } else
- f = 0.0;
-
- z = 1.0 / (x * x);
-
- return (f + (x-0.5) * log(x) - x + 0.918938533204673 +
- (((-0.000595238095238 * z + 0.000793650793651) * z -
- 0.002777777777778) * z + 0.083333333333333) / x);
-}
-
-/*
- * Compute the incomplete Gamma ratio for [0..x], where p is the shape
- * parameter, and ln_gamma_p is ln_gamma(p).
- *
- * This implementation is based on:
- *
- * Bhattacharjee, G.P. (1970) Algorithm AS 32: The incomplete Gamma integral.
- * Applied Statistics 19:285-287.
- */
-JEMALLOC_INLINE double
-i_gamma(double x, double p, double ln_gamma_p)
-{
- double acu, factor, oflo, gin, term, rn, a, b, an, dif;
- double pn[6];
- unsigned i;
-
- assert(p > 0.0);
- assert(x >= 0.0);
-
- if (x == 0.0)
- return (0.0);
-
- acu = 1.0e-10;
- oflo = 1.0e30;
- gin = 0.0;
- factor = exp(p * log(x) - x - ln_gamma_p);
-
- if (x <= 1.0 || x < p) {
- /* Calculation by series expansion. */
- gin = 1.0;
- term = 1.0;
- rn = p;
-
- while (true) {
- rn += 1.0;
- term *= x / rn;
- gin += term;
- if (term <= acu) {
- gin *= factor / p;
- return (gin);
- }
- }
- } else {
- /* Calculation by continued fraction. */
- a = 1.0 - p;
- b = a + x + 1.0;
- term = 0.0;
- pn[0] = 1.0;
- pn[1] = x;
- pn[2] = x + 1.0;
- pn[3] = x * b;
- gin = pn[2] / pn[3];
-
- while (true) {
- a += 1.0;
- b += 2.0;
- term += 1.0;
- an = a * term;
- for (i = 0; i < 2; i++)
- pn[i+4] = b * pn[i+2] - an * pn[i];
- if (pn[5] != 0.0) {
- rn = pn[4] / pn[5];
- dif = fabs(gin - rn);
- if (dif <= acu && dif <= acu * rn) {
- gin = 1.0 - factor * gin;
- return (gin);
- }
- gin = rn;
- }
- for (i = 0; i < 4; i++)
- pn[i] = pn[i+2];
-
- if (fabs(pn[4]) >= oflo) {
- for (i = 0; i < 4; i++)
- pn[i] /= oflo;
- }
- }
- }
-}
-
-/*
- * Given a value p in [0..1] of the lower tail area of the normal distribution,
- * compute the limit on the definite integral from [-inf..z] that satisfies p,
- * accurate to 16 decimal places.
- *
- * This implementation is based on:
- *
- * Wichura, M.J. (1988) Algorithm AS 241: The percentage points of the normal
- * distribution. Applied Statistics 37(3):477-484.
- */
-JEMALLOC_INLINE double
-pt_norm(double p)
-{
- double q, r, ret;
-
- assert(p > 0.0 && p < 1.0);
-
- q = p - 0.5;
- if (fabs(q) <= 0.425) {
- /* p close to 1/2. */
- r = 0.180625 - q * q;
- return (q * (((((((2.5090809287301226727e3 * r +
- 3.3430575583588128105e4) * r + 6.7265770927008700853e4) * r
- + 4.5921953931549871457e4) * r + 1.3731693765509461125e4) *
- r + 1.9715909503065514427e3) * r + 1.3314166789178437745e2)
- * r + 3.3871328727963666080e0) /
- (((((((5.2264952788528545610e3 * r +
- 2.8729085735721942674e4) * r + 3.9307895800092710610e4) * r
- + 2.1213794301586595867e4) * r + 5.3941960214247511077e3) *
- r + 6.8718700749205790830e2) * r + 4.2313330701600911252e1)
- * r + 1.0));
- } else {
- if (q < 0.0)
- r = p;
- else
- r = 1.0 - p;
- assert(r > 0.0);
-
- r = sqrt(-log(r));
- if (r <= 5.0) {
- /* p neither close to 1/2 nor 0 or 1. */
- r -= 1.6;
- ret = ((((((((7.74545014278341407640e-4 * r +
- 2.27238449892691845833e-2) * r +
- 2.41780725177450611770e-1) * r +
- 1.27045825245236838258e0) * r +
- 3.64784832476320460504e0) * r +
- 5.76949722146069140550e0) * r +
- 4.63033784615654529590e0) * r +
- 1.42343711074968357734e0) /
- (((((((1.05075007164441684324e-9 * r +
- 5.47593808499534494600e-4) * r +
- 1.51986665636164571966e-2)
- * r + 1.48103976427480074590e-1) * r +
- 6.89767334985100004550e-1) * r +
- 1.67638483018380384940e0) * r +
- 2.05319162663775882187e0) * r + 1.0));
- } else {
- /* p near 0 or 1. */
- r -= 5.0;
- ret = ((((((((2.01033439929228813265e-7 * r +
- 2.71155556874348757815e-5) * r +
- 1.24266094738807843860e-3) * r +
- 2.65321895265761230930e-2) * r +
- 2.96560571828504891230e-1) * r +
- 1.78482653991729133580e0) * r +
- 5.46378491116411436990e0) * r +
- 6.65790464350110377720e0) /
- (((((((2.04426310338993978564e-15 * r +
- 1.42151175831644588870e-7) * r +
- 1.84631831751005468180e-5) * r +
- 7.86869131145613259100e-4) * r +
- 1.48753612908506148525e-2) * r +
- 1.36929880922735805310e-1) * r +
- 5.99832206555887937690e-1)
- * r + 1.0));
- }
- if (q < 0.0)
- ret = -ret;
- return (ret);
- }
-}
-
-/*
- * Given a value p in [0..1] of the lower tail area of the Chi^2 distribution
- * with df degrees of freedom, where ln_gamma_df_2 is ln_gamma(df/2.0), compute
- * the upper limit on the definite integral from [0..z] that satisfies p,
- * accurate to 12 decimal places.
- *
- * This implementation is based on:
- *
- * Best, D.J., D.E. Roberts (1975) Algorithm AS 91: The percentage points of
- * the Chi^2 distribution. Applied Statistics 24(3):385-388.
- *
- * Shea, B.L. (1991) Algorithm AS R85: A remark on AS 91: The percentage
- * points of the Chi^2 distribution. Applied Statistics 40(1):233-235.
- */
-JEMALLOC_INLINE double
-pt_chi2(double p, double df, double ln_gamma_df_2)
-{
- double e, aa, xx, c, ch, a, q, p1, p2, t, x, b, s1, s2, s3, s4, s5, s6;
- unsigned i;
-
- assert(p >= 0.0 && p < 1.0);
- assert(df > 0.0);
-
- e = 5.0e-7;
- aa = 0.6931471805;
-
- xx = 0.5 * df;
- c = xx - 1.0;
-
- if (df < -1.24 * log(p)) {
- /* Starting approximation for small Chi^2. */
- ch = pow(p * xx * exp(ln_gamma_df_2 + xx * aa), 1.0 / xx);
- if (ch - e < 0.0)
- return (ch);
- } else {
- if (df > 0.32) {
- x = pt_norm(p);
- /*
- * Starting approximation using Wilson and Hilferty
- * estimate.
- */
- p1 = 0.222222 / df;
- ch = df * pow(x * sqrt(p1) + 1.0 - p1, 3.0);
- /* Starting approximation for p tending to 1. */
- if (ch > 2.2 * df + 6.0) {
- ch = -2.0 * (log(1.0 - p) - c * log(0.5 * ch) +
- ln_gamma_df_2);
- }
- } else {
- ch = 0.4;
- a = log(1.0 - p);
- while (true) {
- q = ch;
- p1 = 1.0 + ch * (4.67 + ch);
- p2 = ch * (6.73 + ch * (6.66 + ch));
- t = -0.5 + (4.67 + 2.0 * ch) / p1 - (6.73 + ch
- * (13.32 + 3.0 * ch)) / p2;
- ch -= (1.0 - exp(a + ln_gamma_df_2 + 0.5 * ch +
- c * aa) * p2 / p1) / t;
- if (fabs(q / ch - 1.0) - 0.01 <= 0.0)
- break;
- }
- }
- }
-
- for (i = 0; i < 20; i++) {
- /* Calculation of seven-term Taylor series. */
- q = ch;
- p1 = 0.5 * ch;
- if (p1 < 0.0)
- return (-1.0);
- p2 = p - i_gamma(p1, xx, ln_gamma_df_2);
- t = p2 * exp(xx * aa + ln_gamma_df_2 + p1 - c * log(ch));
- b = t / ch;
- a = 0.5 * t - b * c;
- s1 = (210.0 + a * (140.0 + a * (105.0 + a * (84.0 + a * (70.0 +
- 60.0 * a))))) / 420.0;
- s2 = (420.0 + a * (735.0 + a * (966.0 + a * (1141.0 + 1278.0 *
- a)))) / 2520.0;
- s3 = (210.0 + a * (462.0 + a * (707.0 + 932.0 * a))) / 2520.0;
- s4 = (252.0 + a * (672.0 + 1182.0 * a) + c * (294.0 + a *
- (889.0 + 1740.0 * a))) / 5040.0;
- s5 = (84.0 + 264.0 * a + c * (175.0 + 606.0 * a)) / 2520.0;
- s6 = (120.0 + c * (346.0 + 127.0 * c)) / 5040.0;
- ch += t * (1.0 + 0.5 * t * s1 - b * c * (s1 - b * (s2 - b * (s3
- - b * (s4 - b * (s5 - b * s6))))));
- if (fabs(q / ch - 1.0) <= e)
- break;
- }
-
- return (ch);
-}
-
-/*
- * Given a value p in [0..1] and Gamma distribution shape and scale parameters,
- * compute the upper limit on the definite integral from [0..z] that satisfies
- * p.
- */
-JEMALLOC_INLINE double
-pt_gamma(double p, double shape, double scale, double ln_gamma_shape)
-{
-
- return (pt_chi2(p, shape * 2.0, ln_gamma_shape) * 0.5 * scale);
-}
-#endif
diff --git a/memory/jemalloc/src/test/include/test/mq.h b/memory/jemalloc/src/test/include/test/mq.h
deleted file mode 100644
index 7c4df49318..0000000000
--- a/memory/jemalloc/src/test/include/test/mq.h
+++ /dev/null
@@ -1,109 +0,0 @@
-void mq_nanosleep(unsigned ns);
-
-/*
- * Simple templated message queue implementation that relies on only mutexes for
- * synchronization (which reduces portability issues). Given the following
- * setup:
- *
- * typedef struct mq_msg_s mq_msg_t;
- * struct mq_msg_s {
- * mq_msg(mq_msg_t) link;
- * [message data]
- * };
- * mq_gen(, mq_, mq_t, mq_msg_t, link)
- *
- * The API is as follows:
- *
- * bool mq_init(mq_t *mq);
- * void mq_fini(mq_t *mq);
- * unsigned mq_count(mq_t *mq);
- * mq_msg_t *mq_tryget(mq_t *mq);
- * mq_msg_t *mq_get(mq_t *mq);
- * void mq_put(mq_t *mq, mq_msg_t *msg);
- *
- * The message queue linkage embedded in each message is to be treated as
- * externally opaque (no need to initialize or clean up externally). mq_fini()
- * does not perform any cleanup of messages, since it knows nothing of their
- * payloads.
- */
-#define mq_msg(a_mq_msg_type) ql_elm(a_mq_msg_type)
-
-#define mq_gen(a_attr, a_prefix, a_mq_type, a_mq_msg_type, a_field) \
-typedef struct { \
- mtx_t lock; \
- ql_head(a_mq_msg_type) msgs; \
- unsigned count; \
-} a_mq_type; \
-a_attr bool \
-a_prefix##init(a_mq_type *mq) { \
- \
- if (mtx_init(&mq->lock)) \
- return (true); \
- ql_new(&mq->msgs); \
- mq->count = 0; \
- return (false); \
-} \
-a_attr void \
-a_prefix##fini(a_mq_type *mq) \
-{ \
- \
- mtx_fini(&mq->lock); \
-} \
-a_attr unsigned \
-a_prefix##count(a_mq_type *mq) \
-{ \
- unsigned count; \
- \
- mtx_lock(&mq->lock); \
- count = mq->count; \
- mtx_unlock(&mq->lock); \
- return (count); \
-} \
-a_attr a_mq_msg_type * \
-a_prefix##tryget(a_mq_type *mq) \
-{ \
- a_mq_msg_type *msg; \
- \
- mtx_lock(&mq->lock); \
- msg = ql_first(&mq->msgs); \
- if (msg != NULL) { \
- ql_head_remove(&mq->msgs, a_mq_msg_type, a_field); \
- mq->count--; \
- } \
- mtx_unlock(&mq->lock); \
- return (msg); \
-} \
-a_attr a_mq_msg_type * \
-a_prefix##get(a_mq_type *mq) \
-{ \
- a_mq_msg_type *msg; \
- unsigned ns; \
- \
- msg = a_prefix##tryget(mq); \
- if (msg != NULL) \
- return (msg); \
- \
- ns = 1; \
- while (true) { \
- mq_nanosleep(ns); \
- msg = a_prefix##tryget(mq); \
- if (msg != NULL) \
- return (msg); \
- if (ns < 1000*1000*1000) { \
- /* Double sleep time, up to max 1 second. */ \
- ns <<= 1; \
- if (ns > 1000*1000*1000) \
- ns = 1000*1000*1000; \
- } \
- } \
-} \
-a_attr void \
-a_prefix##put(a_mq_type *mq, a_mq_msg_type *msg) \
-{ \
- \
- mtx_lock(&mq->lock); \
- ql_elm_new(msg, a_field); \
- ql_tail_insert(&mq->msgs, msg, a_field); \
- mq->count++; \
- mtx_unlock(&mq->lock); \
-}
diff --git a/memory/jemalloc/src/test/include/test/mtx.h b/memory/jemalloc/src/test/include/test/mtx.h
deleted file mode 100644
index 58afbc3d13..0000000000
--- a/memory/jemalloc/src/test/include/test/mtx.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * mtx is a slightly simplified version of malloc_mutex. This code duplication
- * is unfortunate, but there are allocator bootstrapping considerations that
- * would leak into the test infrastructure if malloc_mutex were used directly
- * in tests.
- */
-
-typedef struct {
-#ifdef _WIN32
- CRITICAL_SECTION lock;
-#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
- os_unfair_lock lock;
-#elif (defined(JEMALLOC_OSSPIN))
- OSSpinLock lock;
-#else
- pthread_mutex_t lock;
-#endif
-} mtx_t;
-
-bool mtx_init(mtx_t *mtx);
-void mtx_fini(mtx_t *mtx);
-void mtx_lock(mtx_t *mtx);
-void mtx_unlock(mtx_t *mtx);
diff --git a/memory/jemalloc/src/test/include/test/test.h b/memory/jemalloc/src/test/include/test/test.h
deleted file mode 100644
index c8112eb8b1..0000000000
--- a/memory/jemalloc/src/test/include/test/test.h
+++ /dev/null
@@ -1,333 +0,0 @@
-#define ASSERT_BUFSIZE 256
-
-#define assert_cmp(t, a, b, cmp, neg_cmp, pri, ...) do { \
- t a_ = (a); \
- t b_ = (b); \
- if (!(a_ cmp b_)) { \
- char prefix[ASSERT_BUFSIZE]; \
- char message[ASSERT_BUFSIZE]; \
- malloc_snprintf(prefix, sizeof(prefix), \
- "%s:%s:%d: Failed assertion: " \
- "(%s) "#cmp" (%s) --> " \
- "%"pri" "#neg_cmp" %"pri": ", \
- __func__, __FILE__, __LINE__, \
- #a, #b, a_, b_); \
- malloc_snprintf(message, sizeof(message), __VA_ARGS__); \
- p_test_fail(prefix, message); \
- } \
-} while (0)
-
-#define assert_ptr_eq(a, b, ...) assert_cmp(void *, a, b, ==, \
- !=, "p", __VA_ARGS__)
-#define assert_ptr_ne(a, b, ...) assert_cmp(void *, a, b, !=, \
- ==, "p", __VA_ARGS__)
-#define assert_ptr_null(a, ...) assert_cmp(void *, a, NULL, ==, \
- !=, "p", __VA_ARGS__)
-#define assert_ptr_not_null(a, ...) assert_cmp(void *, a, NULL, !=, \
- ==, "p", __VA_ARGS__)
-
-#define assert_c_eq(a, b, ...) assert_cmp(char, a, b, ==, !=, "c", __VA_ARGS__)
-#define assert_c_ne(a, b, ...) assert_cmp(char, a, b, !=, ==, "c", __VA_ARGS__)
-#define assert_c_lt(a, b, ...) assert_cmp(char, a, b, <, >=, "c", __VA_ARGS__)
-#define assert_c_le(a, b, ...) assert_cmp(char, a, b, <=, >, "c", __VA_ARGS__)
-#define assert_c_ge(a, b, ...) assert_cmp(char, a, b, >=, <, "c", __VA_ARGS__)
-#define assert_c_gt(a, b, ...) assert_cmp(char, a, b, >, <=, "c", __VA_ARGS__)
-
-#define assert_x_eq(a, b, ...) assert_cmp(int, a, b, ==, !=, "#x", __VA_ARGS__)
-#define assert_x_ne(a, b, ...) assert_cmp(int, a, b, !=, ==, "#x", __VA_ARGS__)
-#define assert_x_lt(a, b, ...) assert_cmp(int, a, b, <, >=, "#x", __VA_ARGS__)
-#define assert_x_le(a, b, ...) assert_cmp(int, a, b, <=, >, "#x", __VA_ARGS__)
-#define assert_x_ge(a, b, ...) assert_cmp(int, a, b, >=, <, "#x", __VA_ARGS__)
-#define assert_x_gt(a, b, ...) assert_cmp(int, a, b, >, <=, "#x", __VA_ARGS__)
-
-#define assert_d_eq(a, b, ...) assert_cmp(int, a, b, ==, !=, "d", __VA_ARGS__)
-#define assert_d_ne(a, b, ...) assert_cmp(int, a, b, !=, ==, "d", __VA_ARGS__)
-#define assert_d_lt(a, b, ...) assert_cmp(int, a, b, <, >=, "d", __VA_ARGS__)
-#define assert_d_le(a, b, ...) assert_cmp(int, a, b, <=, >, "d", __VA_ARGS__)
-#define assert_d_ge(a, b, ...) assert_cmp(int, a, b, >=, <, "d", __VA_ARGS__)
-#define assert_d_gt(a, b, ...) assert_cmp(int, a, b, >, <=, "d", __VA_ARGS__)
-
-#define assert_u_eq(a, b, ...) assert_cmp(int, a, b, ==, !=, "u", __VA_ARGS__)
-#define assert_u_ne(a, b, ...) assert_cmp(int, a, b, !=, ==, "u", __VA_ARGS__)
-#define assert_u_lt(a, b, ...) assert_cmp(int, a, b, <, >=, "u", __VA_ARGS__)
-#define assert_u_le(a, b, ...) assert_cmp(int, a, b, <=, >, "u", __VA_ARGS__)
-#define assert_u_ge(a, b, ...) assert_cmp(int, a, b, >=, <, "u", __VA_ARGS__)
-#define assert_u_gt(a, b, ...) assert_cmp(int, a, b, >, <=, "u", __VA_ARGS__)
-
-#define assert_ld_eq(a, b, ...) assert_cmp(long, a, b, ==, \
- !=, "ld", __VA_ARGS__)
-#define assert_ld_ne(a, b, ...) assert_cmp(long, a, b, !=, \
- ==, "ld", __VA_ARGS__)
-#define assert_ld_lt(a, b, ...) assert_cmp(long, a, b, <, \
- >=, "ld", __VA_ARGS__)
-#define assert_ld_le(a, b, ...) assert_cmp(long, a, b, <=, \
- >, "ld", __VA_ARGS__)
-#define assert_ld_ge(a, b, ...) assert_cmp(long, a, b, >=, \
- <, "ld", __VA_ARGS__)
-#define assert_ld_gt(a, b, ...) assert_cmp(long, a, b, >, \
- <=, "ld", __VA_ARGS__)
-
-#define assert_lu_eq(a, b, ...) assert_cmp(unsigned long, \
- a, b, ==, !=, "lu", __VA_ARGS__)
-#define assert_lu_ne(a, b, ...) assert_cmp(unsigned long, \
- a, b, !=, ==, "lu", __VA_ARGS__)
-#define assert_lu_lt(a, b, ...) assert_cmp(unsigned long, \
- a, b, <, >=, "lu", __VA_ARGS__)
-#define assert_lu_le(a, b, ...) assert_cmp(unsigned long, \
- a, b, <=, >, "lu", __VA_ARGS__)
-#define assert_lu_ge(a, b, ...) assert_cmp(unsigned long, \
- a, b, >=, <, "lu", __VA_ARGS__)
-#define assert_lu_gt(a, b, ...) assert_cmp(unsigned long, \
- a, b, >, <=, "lu", __VA_ARGS__)
-
-#define assert_qd_eq(a, b, ...) assert_cmp(long long, a, b, ==, \
- !=, "qd", __VA_ARGS__)
-#define assert_qd_ne(a, b, ...) assert_cmp(long long, a, b, !=, \
- ==, "qd", __VA_ARGS__)
-#define assert_qd_lt(a, b, ...) assert_cmp(long long, a, b, <, \
- >=, "qd", __VA_ARGS__)
-#define assert_qd_le(a, b, ...) assert_cmp(long long, a, b, <=, \
- >, "qd", __VA_ARGS__)
-#define assert_qd_ge(a, b, ...) assert_cmp(long long, a, b, >=, \
- <, "qd", __VA_ARGS__)
-#define assert_qd_gt(a, b, ...) assert_cmp(long long, a, b, >, \
- <=, "qd", __VA_ARGS__)
-
-#define assert_qu_eq(a, b, ...) assert_cmp(unsigned long long, \
- a, b, ==, !=, "qu", __VA_ARGS__)
-#define assert_qu_ne(a, b, ...) assert_cmp(unsigned long long, \
- a, b, !=, ==, "qu", __VA_ARGS__)
-#define assert_qu_lt(a, b, ...) assert_cmp(unsigned long long, \
- a, b, <, >=, "qu", __VA_ARGS__)
-#define assert_qu_le(a, b, ...) assert_cmp(unsigned long long, \
- a, b, <=, >, "qu", __VA_ARGS__)
-#define assert_qu_ge(a, b, ...) assert_cmp(unsigned long long, \
- a, b, >=, <, "qu", __VA_ARGS__)
-#define assert_qu_gt(a, b, ...) assert_cmp(unsigned long long, \
- a, b, >, <=, "qu", __VA_ARGS__)
-
-#define assert_jd_eq(a, b, ...) assert_cmp(intmax_t, a, b, ==, \
- !=, "jd", __VA_ARGS__)
-#define assert_jd_ne(a, b, ...) assert_cmp(intmax_t, a, b, !=, \
- ==, "jd", __VA_ARGS__)
-#define assert_jd_lt(a, b, ...) assert_cmp(intmax_t, a, b, <, \
- >=, "jd", __VA_ARGS__)
-#define assert_jd_le(a, b, ...) assert_cmp(intmax_t, a, b, <=, \
- >, "jd", __VA_ARGS__)
-#define assert_jd_ge(a, b, ...) assert_cmp(intmax_t, a, b, >=, \
- <, "jd", __VA_ARGS__)
-#define assert_jd_gt(a, b, ...) assert_cmp(intmax_t, a, b, >, \
- <=, "jd", __VA_ARGS__)
-
-#define assert_ju_eq(a, b, ...) assert_cmp(uintmax_t, a, b, ==, \
- !=, "ju", __VA_ARGS__)
-#define assert_ju_ne(a, b, ...) assert_cmp(uintmax_t, a, b, !=, \
- ==, "ju", __VA_ARGS__)
-#define assert_ju_lt(a, b, ...) assert_cmp(uintmax_t, a, b, <, \
- >=, "ju", __VA_ARGS__)
-#define assert_ju_le(a, b, ...) assert_cmp(uintmax_t, a, b, <=, \
- >, "ju", __VA_ARGS__)
-#define assert_ju_ge(a, b, ...) assert_cmp(uintmax_t, a, b, >=, \
- <, "ju", __VA_ARGS__)
-#define assert_ju_gt(a, b, ...) assert_cmp(uintmax_t, a, b, >, \
- <=, "ju", __VA_ARGS__)
-
-#define assert_zd_eq(a, b, ...) assert_cmp(ssize_t, a, b, ==, \
- !=, "zd", __VA_ARGS__)
-#define assert_zd_ne(a, b, ...) assert_cmp(ssize_t, a, b, !=, \
- ==, "zd", __VA_ARGS__)
-#define assert_zd_lt(a, b, ...) assert_cmp(ssize_t, a, b, <, \
- >=, "zd", __VA_ARGS__)
-#define assert_zd_le(a, b, ...) assert_cmp(ssize_t, a, b, <=, \
- >, "zd", __VA_ARGS__)
-#define assert_zd_ge(a, b, ...) assert_cmp(ssize_t, a, b, >=, \
- <, "zd", __VA_ARGS__)
-#define assert_zd_gt(a, b, ...) assert_cmp(ssize_t, a, b, >, \
- <=, "zd", __VA_ARGS__)
-
-#define assert_zu_eq(a, b, ...) assert_cmp(size_t, a, b, ==, \
- !=, "zu", __VA_ARGS__)
-#define assert_zu_ne(a, b, ...) assert_cmp(size_t, a, b, !=, \
- ==, "zu", __VA_ARGS__)
-#define assert_zu_lt(a, b, ...) assert_cmp(size_t, a, b, <, \
- >=, "zu", __VA_ARGS__)
-#define assert_zu_le(a, b, ...) assert_cmp(size_t, a, b, <=, \
- >, "zu", __VA_ARGS__)
-#define assert_zu_ge(a, b, ...) assert_cmp(size_t, a, b, >=, \
- <, "zu", __VA_ARGS__)
-#define assert_zu_gt(a, b, ...) assert_cmp(size_t, a, b, >, \
- <=, "zu", __VA_ARGS__)
-
-#define assert_d32_eq(a, b, ...) assert_cmp(int32_t, a, b, ==, \
- !=, FMTd32, __VA_ARGS__)
-#define assert_d32_ne(a, b, ...) assert_cmp(int32_t, a, b, !=, \
- ==, FMTd32, __VA_ARGS__)
-#define assert_d32_lt(a, b, ...) assert_cmp(int32_t, a, b, <, \
- >=, FMTd32, __VA_ARGS__)
-#define assert_d32_le(a, b, ...) assert_cmp(int32_t, a, b, <=, \
- >, FMTd32, __VA_ARGS__)
-#define assert_d32_ge(a, b, ...) assert_cmp(int32_t, a, b, >=, \
- <, FMTd32, __VA_ARGS__)
-#define assert_d32_gt(a, b, ...) assert_cmp(int32_t, a, b, >, \
- <=, FMTd32, __VA_ARGS__)
-
-#define assert_u32_eq(a, b, ...) assert_cmp(uint32_t, a, b, ==, \
- !=, FMTu32, __VA_ARGS__)
-#define assert_u32_ne(a, b, ...) assert_cmp(uint32_t, a, b, !=, \
- ==, FMTu32, __VA_ARGS__)
-#define assert_u32_lt(a, b, ...) assert_cmp(uint32_t, a, b, <, \
- >=, FMTu32, __VA_ARGS__)
-#define assert_u32_le(a, b, ...) assert_cmp(uint32_t, a, b, <=, \
- >, FMTu32, __VA_ARGS__)
-#define assert_u32_ge(a, b, ...) assert_cmp(uint32_t, a, b, >=, \
- <, FMTu32, __VA_ARGS__)
-#define assert_u32_gt(a, b, ...) assert_cmp(uint32_t, a, b, >, \
- <=, FMTu32, __VA_ARGS__)
-
-#define assert_d64_eq(a, b, ...) assert_cmp(int64_t, a, b, ==, \
- !=, FMTd64, __VA_ARGS__)
-#define assert_d64_ne(a, b, ...) assert_cmp(int64_t, a, b, !=, \
- ==, FMTd64, __VA_ARGS__)
-#define assert_d64_lt(a, b, ...) assert_cmp(int64_t, a, b, <, \
- >=, FMTd64, __VA_ARGS__)
-#define assert_d64_le(a, b, ...) assert_cmp(int64_t, a, b, <=, \
- >, FMTd64, __VA_ARGS__)
-#define assert_d64_ge(a, b, ...) assert_cmp(int64_t, a, b, >=, \
- <, FMTd64, __VA_ARGS__)
-#define assert_d64_gt(a, b, ...) assert_cmp(int64_t, a, b, >, \
- <=, FMTd64, __VA_ARGS__)
-
-#define assert_u64_eq(a, b, ...) assert_cmp(uint64_t, a, b, ==, \
- !=, FMTu64, __VA_ARGS__)
-#define assert_u64_ne(a, b, ...) assert_cmp(uint64_t, a, b, !=, \
- ==, FMTu64, __VA_ARGS__)
-#define assert_u64_lt(a, b, ...) assert_cmp(uint64_t, a, b, <, \
- >=, FMTu64, __VA_ARGS__)
-#define assert_u64_le(a, b, ...) assert_cmp(uint64_t, a, b, <=, \
- >, FMTu64, __VA_ARGS__)
-#define assert_u64_ge(a, b, ...) assert_cmp(uint64_t, a, b, >=, \
- <, FMTu64, __VA_ARGS__)
-#define assert_u64_gt(a, b, ...) assert_cmp(uint64_t, a, b, >, \
- <=, FMTu64, __VA_ARGS__)
-
-#define assert_b_eq(a, b, ...) do { \
- bool a_ = (a); \
- bool b_ = (b); \
- if (!(a_ == b_)) { \
- char prefix[ASSERT_BUFSIZE]; \
- char message[ASSERT_BUFSIZE]; \
- malloc_snprintf(prefix, sizeof(prefix), \
- "%s:%s:%d: Failed assertion: " \
- "(%s) == (%s) --> %s != %s: ", \
- __func__, __FILE__, __LINE__, \
- #a, #b, a_ ? "true" : "false", \
- b_ ? "true" : "false"); \
- malloc_snprintf(message, sizeof(message), __VA_ARGS__); \
- p_test_fail(prefix, message); \
- } \
-} while (0)
-#define assert_b_ne(a, b, ...) do { \
- bool a_ = (a); \
- bool b_ = (b); \
- if (!(a_ != b_)) { \
- char prefix[ASSERT_BUFSIZE]; \
- char message[ASSERT_BUFSIZE]; \
- malloc_snprintf(prefix, sizeof(prefix), \
- "%s:%s:%d: Failed assertion: " \
- "(%s) != (%s) --> %s == %s: ", \
- __func__, __FILE__, __LINE__, \
- #a, #b, a_ ? "true" : "false", \
- b_ ? "true" : "false"); \
- malloc_snprintf(message, sizeof(message), __VA_ARGS__); \
- p_test_fail(prefix, message); \
- } \
-} while (0)
-#define assert_true(a, ...) assert_b_eq(a, true, __VA_ARGS__)
-#define assert_false(a, ...) assert_b_eq(a, false, __VA_ARGS__)
-
-#define assert_str_eq(a, b, ...) do { \
- if (strcmp((a), (b))) { \
- char prefix[ASSERT_BUFSIZE]; \
- char message[ASSERT_BUFSIZE]; \
- malloc_snprintf(prefix, sizeof(prefix), \
- "%s:%s:%d: Failed assertion: " \
- "(%s) same as (%s) --> " \
- "\"%s\" differs from \"%s\": ", \
- __func__, __FILE__, __LINE__, #a, #b, a, b); \
- malloc_snprintf(message, sizeof(message), __VA_ARGS__); \
- p_test_fail(prefix, message); \
- } \
-} while (0)
-#define assert_str_ne(a, b, ...) do { \
- if (!strcmp((a), (b))) { \
- char prefix[ASSERT_BUFSIZE]; \
- char message[ASSERT_BUFSIZE]; \
- malloc_snprintf(prefix, sizeof(prefix), \
- "%s:%s:%d: Failed assertion: " \
- "(%s) differs from (%s) --> " \
- "\"%s\" same as \"%s\": ", \
- __func__, __FILE__, __LINE__, #a, #b, a, b); \
- malloc_snprintf(message, sizeof(message), __VA_ARGS__); \
- p_test_fail(prefix, message); \
- } \
-} while (0)
-
-#define assert_not_reached(...) do { \
- char prefix[ASSERT_BUFSIZE]; \
- char message[ASSERT_BUFSIZE]; \
- malloc_snprintf(prefix, sizeof(prefix), \
- "%s:%s:%d: Unreachable code reached: ", \
- __func__, __FILE__, __LINE__); \
- malloc_snprintf(message, sizeof(message), __VA_ARGS__); \
- p_test_fail(prefix, message); \
-} while (0)
-
-/*
- * If this enum changes, corresponding changes in test/test.sh.in are also
- * necessary.
- */
-typedef enum {
- test_status_pass = 0,
- test_status_skip = 1,
- test_status_fail = 2,
-
- test_status_count = 3
-} test_status_t;
-
-typedef void (test_t)(void);
-
-#define TEST_BEGIN(f) \
-static void \
-f(void) \
-{ \
- p_test_init(#f);
-
-#define TEST_END \
- goto label_test_end; \
-label_test_end: \
- p_test_fini(); \
-}
-
-#define test(...) \
- p_test(__VA_ARGS__, NULL)
-
-#define test_no_malloc_init(...) \
- p_test_no_malloc_init(__VA_ARGS__, NULL)
-
-#define test_skip_if(e) do { \
- if (e) { \
- test_skip("%s:%s:%d: Test skipped: (%s)", \
- __func__, __FILE__, __LINE__, #e); \
- goto label_test_end; \
- } \
-} while (0)
-
-void test_skip(const char *format, ...) JEMALLOC_FORMAT_PRINTF(1, 2);
-void test_fail(const char *format, ...) JEMALLOC_FORMAT_PRINTF(1, 2);
-
-/* For private use by macros. */
-test_status_t p_test(test_t *t, ...);
-test_status_t p_test_no_malloc_init(test_t *t, ...);
-void p_test_init(const char *name);
-void p_test_fini(void);
-void p_test_fail(const char *prefix, const char *message);
diff --git a/memory/jemalloc/src/test/include/test/thd.h b/memory/jemalloc/src/test/include/test/thd.h
deleted file mode 100644
index 47a51262e9..0000000000
--- a/memory/jemalloc/src/test/include/test/thd.h
+++ /dev/null
@@ -1,9 +0,0 @@
-/* Abstraction layer for threading in tests. */
-#ifdef _WIN32
-typedef HANDLE thd_t;
-#else
-typedef pthread_t thd_t;
-#endif
-
-void thd_create(thd_t *thd, void *(*proc)(void *), void *arg);
-void thd_join(thd_t thd, void **ret);
diff --git a/memory/jemalloc/src/test/include/test/timer.h b/memory/jemalloc/src/test/include/test/timer.h
deleted file mode 100644
index ace6191b85..0000000000
--- a/memory/jemalloc/src/test/include/test/timer.h
+++ /dev/null
@@ -1,11 +0,0 @@
-/* Simple timer, for use in benchmark reporting. */
-
-typedef struct {
- nstime_t t0;
- nstime_t t1;
-} timedelta_t;
-
-void timer_start(timedelta_t *timer);
-void timer_stop(timedelta_t *timer);
-uint64_t timer_usec(const timedelta_t *timer);
-void timer_ratio(timedelta_t *a, timedelta_t *b, char *buf, size_t buflen);
diff --git a/memory/jemalloc/src/test/integration/MALLOCX_ARENA.c b/memory/jemalloc/src/test/integration/MALLOCX_ARENA.c
deleted file mode 100644
index 30c203ae65..0000000000
--- a/memory/jemalloc/src/test/integration/MALLOCX_ARENA.c
+++ /dev/null
@@ -1,69 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#define NTHREADS 10
-
-static bool have_dss =
-#ifdef JEMALLOC_DSS
- true
-#else
- false
-#endif
- ;
-
-void *
-thd_start(void *arg)
-{
- unsigned thread_ind = (unsigned)(uintptr_t)arg;
- unsigned arena_ind;
- void *p;
- size_t sz;
-
- sz = sizeof(arena_ind);
- assert_d_eq(mallctl("arenas.extend", &arena_ind, &sz, NULL, 0), 0,
- "Error in arenas.extend");
-
- if (thread_ind % 4 != 3) {
- size_t mib[3];
- size_t miblen = sizeof(mib) / sizeof(size_t);
- const char *dss_precs[] = {"disabled", "primary", "secondary"};
- unsigned prec_ind = thread_ind %
- (sizeof(dss_precs)/sizeof(char*));
- const char *dss = dss_precs[prec_ind];
- int expected_err = (have_dss || prec_ind == 0) ? 0 : EFAULT;
- assert_d_eq(mallctlnametomib("arena.0.dss", mib, &miblen), 0,
- "Error in mallctlnametomib()");
- mib[1] = arena_ind;
- assert_d_eq(mallctlbymib(mib, miblen, NULL, NULL, (void *)&dss,
- sizeof(const char *)), expected_err,
- "Error in mallctlbymib()");
- }
-
- p = mallocx(1, MALLOCX_ARENA(arena_ind));
- assert_ptr_not_null(p, "Unexpected mallocx() error");
- dallocx(p, 0);
-
- return (NULL);
-}
-
-TEST_BEGIN(test_MALLOCX_ARENA)
-{
- thd_t thds[NTHREADS];
- unsigned i;
-
- for (i = 0; i < NTHREADS; i++) {
- thd_create(&thds[i], thd_start,
- (void *)(uintptr_t)i);
- }
-
- for (i = 0; i < NTHREADS; i++)
- thd_join(thds[i], NULL);
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_MALLOCX_ARENA));
-}
diff --git a/memory/jemalloc/src/test/integration/aligned_alloc.c b/memory/jemalloc/src/test/integration/aligned_alloc.c
deleted file mode 100644
index 58438421d6..0000000000
--- a/memory/jemalloc/src/test/integration/aligned_alloc.c
+++ /dev/null
@@ -1,139 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#define CHUNK 0x400000
-#define MAXALIGN (((size_t)1) << 23)
-
-/*
- * On systems which can't merge extents, tests that call this function generate
- * a lot of dirty memory very quickly. Purging between cycles mitigates
- * potential OOM on e.g. 32-bit Windows.
- */
-static void
-purge(void)
-{
-
- assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
- "Unexpected mallctl error");
-}
-
-TEST_BEGIN(test_alignment_errors)
-{
- size_t alignment;
- void *p;
-
- alignment = 0;
- set_errno(0);
- p = aligned_alloc(alignment, 1);
- assert_false(p != NULL || get_errno() != EINVAL,
- "Expected error for invalid alignment %zu", alignment);
-
- for (alignment = sizeof(size_t); alignment < MAXALIGN;
- alignment <<= 1) {
- set_errno(0);
- p = aligned_alloc(alignment + 1, 1);
- assert_false(p != NULL || get_errno() != EINVAL,
- "Expected error for invalid alignment %zu",
- alignment + 1);
- }
-}
-TEST_END
-
-TEST_BEGIN(test_oom_errors)
-{
- size_t alignment, size;
- void *p;
-
-#if LG_SIZEOF_PTR == 3
- alignment = UINT64_C(0x8000000000000000);
- size = UINT64_C(0x8000000000000000);
-#else
- alignment = 0x80000000LU;
- size = 0x80000000LU;
-#endif
- set_errno(0);
- p = aligned_alloc(alignment, size);
- assert_false(p != NULL || get_errno() != ENOMEM,
- "Expected error for aligned_alloc(%zu, %zu)",
- alignment, size);
-
-#if LG_SIZEOF_PTR == 3
- alignment = UINT64_C(0x4000000000000000);
- size = UINT64_C(0xc000000000000001);
-#else
- alignment = 0x40000000LU;
- size = 0xc0000001LU;
-#endif
- set_errno(0);
- p = aligned_alloc(alignment, size);
- assert_false(p != NULL || get_errno() != ENOMEM,
- "Expected error for aligned_alloc(%zu, %zu)",
- alignment, size);
-
- alignment = 0x10LU;
-#if LG_SIZEOF_PTR == 3
- size = UINT64_C(0xfffffffffffffff0);
-#else
- size = 0xfffffff0LU;
-#endif
- set_errno(0);
- p = aligned_alloc(alignment, size);
- assert_false(p != NULL || get_errno() != ENOMEM,
- "Expected error for aligned_alloc(&p, %zu, %zu)",
- alignment, size);
-}
-TEST_END
-
-TEST_BEGIN(test_alignment_and_size)
-{
-#define NITER 4
- size_t alignment, size, total;
- unsigned i;
- void *ps[NITER];
-
- for (i = 0; i < NITER; i++)
- ps[i] = NULL;
-
- for (alignment = 8;
- alignment <= MAXALIGN;
- alignment <<= 1) {
- total = 0;
- for (size = 1;
- size < 3 * alignment && size < (1U << 31);
- size += (alignment >> (LG_SIZEOF_PTR-1)) - 1) {
- for (i = 0; i < NITER; i++) {
- ps[i] = aligned_alloc(alignment, size);
- if (ps[i] == NULL) {
- char buf[BUFERROR_BUF];
-
- buferror(get_errno(), buf, sizeof(buf));
- test_fail(
- "Error for alignment=%zu, "
- "size=%zu (%#zx): %s",
- alignment, size, size, buf);
- }
- total += malloc_usable_size(ps[i]);
- if (total >= (MAXALIGN << 1))
- break;
- }
- for (i = 0; i < NITER; i++) {
- if (ps[i] != NULL) {
- free(ps[i]);
- ps[i] = NULL;
- }
- }
- }
- purge();
- }
-#undef NITER
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_alignment_errors,
- test_oom_errors,
- test_alignment_and_size));
-}
diff --git a/memory/jemalloc/src/test/integration/allocated.c b/memory/jemalloc/src/test/integration/allocated.c
deleted file mode 100644
index 3630e80ce2..0000000000
--- a/memory/jemalloc/src/test/integration/allocated.c
+++ /dev/null
@@ -1,125 +0,0 @@
-#include "test/jemalloc_test.h"
-
-static const bool config_stats =
-#ifdef JEMALLOC_STATS
- true
-#else
- false
-#endif
- ;
-
-void *
-thd_start(void *arg)
-{
- int err;
- void *p;
- uint64_t a0, a1, d0, d1;
- uint64_t *ap0, *ap1, *dp0, *dp1;
- size_t sz, usize;
-
- sz = sizeof(a0);
- if ((err = mallctl("thread.allocated", &a0, &sz, NULL, 0))) {
- if (err == ENOENT)
- goto label_ENOENT;
- test_fail("%s(): Error in mallctl(): %s", __func__,
- strerror(err));
- }
- sz = sizeof(ap0);
- if ((err = mallctl("thread.allocatedp", &ap0, &sz, NULL, 0))) {
- if (err == ENOENT)
- goto label_ENOENT;
- test_fail("%s(): Error in mallctl(): %s", __func__,
- strerror(err));
- }
- assert_u64_eq(*ap0, a0,
- "\"thread.allocatedp\" should provide a pointer to internal "
- "storage");
-
- sz = sizeof(d0);
- if ((err = mallctl("thread.deallocated", &d0, &sz, NULL, 0))) {
- if (err == ENOENT)
- goto label_ENOENT;
- test_fail("%s(): Error in mallctl(): %s", __func__,
- strerror(err));
- }
- sz = sizeof(dp0);
- if ((err = mallctl("thread.deallocatedp", &dp0, &sz, NULL, 0))) {
- if (err == ENOENT)
- goto label_ENOENT;
- test_fail("%s(): Error in mallctl(): %s", __func__,
- strerror(err));
- }
- assert_u64_eq(*dp0, d0,
- "\"thread.deallocatedp\" should provide a pointer to internal "
- "storage");
-
- p = malloc(1);
- assert_ptr_not_null(p, "Unexpected malloc() error");
-
- sz = sizeof(a1);
- mallctl("thread.allocated", &a1, &sz, NULL, 0);
- sz = sizeof(ap1);
- mallctl("thread.allocatedp", &ap1, &sz, NULL, 0);
- assert_u64_eq(*ap1, a1,
- "Dereferenced \"thread.allocatedp\" value should equal "
- "\"thread.allocated\" value");
- assert_ptr_eq(ap0, ap1,
- "Pointer returned by \"thread.allocatedp\" should not change");
-
- usize = malloc_usable_size(p);
- assert_u64_le(a0 + usize, a1,
- "Allocated memory counter should increase by at least the amount "
- "explicitly allocated");
-
- free(p);
-
- sz = sizeof(d1);
- mallctl("thread.deallocated", &d1, &sz, NULL, 0);
- sz = sizeof(dp1);
- mallctl("thread.deallocatedp", &dp1, &sz, NULL, 0);
- assert_u64_eq(*dp1, d1,
- "Dereferenced \"thread.deallocatedp\" value should equal "
- "\"thread.deallocated\" value");
- assert_ptr_eq(dp0, dp1,
- "Pointer returned by \"thread.deallocatedp\" should not change");
-
- assert_u64_le(d0 + usize, d1,
- "Deallocated memory counter should increase by at least the amount "
- "explicitly deallocated");
-
- return (NULL);
-label_ENOENT:
- assert_false(config_stats,
- "ENOENT should only be returned if stats are disabled");
- test_skip("\"thread.allocated\" mallctl not available");
- return (NULL);
-}
-
-TEST_BEGIN(test_main_thread)
-{
-
- thd_start(NULL);
-}
-TEST_END
-
-TEST_BEGIN(test_subthread)
-{
- thd_t thd;
-
- thd_create(&thd, thd_start, NULL);
- thd_join(thd, NULL);
-}
-TEST_END
-
-int
-main(void)
-{
-
- /* Run tests multiple times to check for bad interactions. */
- return (test(
- test_main_thread,
- test_subthread,
- test_main_thread,
- test_subthread,
- test_main_thread));
-}
diff --git a/memory/jemalloc/src/test/integration/chunk.c b/memory/jemalloc/src/test/integration/chunk.c
deleted file mode 100644
index ff9bf967ae..0000000000
--- a/memory/jemalloc/src/test/integration/chunk.c
+++ /dev/null
@@ -1,293 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#ifdef JEMALLOC_FILL
-const char *malloc_conf = "junk:false";
-#endif
-
-static chunk_hooks_t orig_hooks;
-static chunk_hooks_t old_hooks;
-
-static bool do_dalloc = true;
-static bool do_decommit;
-
-static bool did_alloc;
-static bool did_dalloc;
-static bool did_commit;
-static bool did_decommit;
-static bool did_purge;
-static bool did_split;
-static bool did_merge;
-
-#if 0
-# define TRACE_HOOK(fmt, ...) malloc_printf(fmt, __VA_ARGS__)
-#else
-# define TRACE_HOOK(fmt, ...)
-#endif
-
-void *
-chunk_alloc(void *new_addr, size_t size, size_t alignment, bool *zero,
- bool *commit, unsigned arena_ind)
-{
-
- TRACE_HOOK("%s(new_addr=%p, size=%zu, alignment=%zu, *zero=%s, "
- "*commit=%s, arena_ind=%u)\n", __func__, new_addr, size, alignment,
- *zero ? "true" : "false", *commit ? "true" : "false", arena_ind);
- did_alloc = true;
- return (old_hooks.alloc(new_addr, size, alignment, zero, commit,
- arena_ind));
-}
-
-bool
-chunk_dalloc(void *chunk, size_t size, bool committed, unsigned arena_ind)
-{
-
- TRACE_HOOK("%s(chunk=%p, size=%zu, committed=%s, arena_ind=%u)\n",
- __func__, chunk, size, committed ? "true" : "false", arena_ind);
- did_dalloc = true;
- if (!do_dalloc)
- return (true);
- return (old_hooks.dalloc(chunk, size, committed, arena_ind));
-}
-
-bool
-chunk_commit(void *chunk, size_t size, size_t offset, size_t length,
- unsigned arena_ind)
-{
- bool err;
-
- TRACE_HOOK("%s(chunk=%p, size=%zu, offset=%zu, length=%zu, "
- "arena_ind=%u)\n", __func__, chunk, size, offset, length,
- arena_ind);
- err = old_hooks.commit(chunk, size, offset, length, arena_ind);
- did_commit = !err;
- return (err);
-}
-
-bool
-chunk_decommit(void *chunk, size_t size, size_t offset, size_t length,
- unsigned arena_ind)
-{
- bool err;
-
- TRACE_HOOK("%s(chunk=%p, size=%zu, offset=%zu, length=%zu, "
- "arena_ind=%u)\n", __func__, chunk, size, offset, length,
- arena_ind);
- if (!do_decommit)
- return (true);
- err = old_hooks.decommit(chunk, size, offset, length, arena_ind);
- did_decommit = !err;
- return (err);
-}
-
-bool
-chunk_purge(void *chunk, size_t size, size_t offset, size_t length,
- unsigned arena_ind)
-{
-
- TRACE_HOOK("%s(chunk=%p, size=%zu, offset=%zu, length=%zu "
- "arena_ind=%u)\n", __func__, chunk, size, offset, length,
- arena_ind);
- did_purge = true;
- return (old_hooks.purge(chunk, size, offset, length, arena_ind));
-}
-
-bool
-chunk_split(void *chunk, size_t size, size_t size_a, size_t size_b,
- bool committed, unsigned arena_ind)
-{
-
- TRACE_HOOK("%s(chunk=%p, size=%zu, size_a=%zu, size_b=%zu, "
- "committed=%s, arena_ind=%u)\n", __func__, chunk, size, size_a,
- size_b, committed ? "true" : "false", arena_ind);
- did_split = true;
- return (old_hooks.split(chunk, size, size_a, size_b, committed,
- arena_ind));
-}
-
-bool
-chunk_merge(void *chunk_a, size_t size_a, void *chunk_b, size_t size_b,
- bool committed, unsigned arena_ind)
-{
-
- TRACE_HOOK("%s(chunk_a=%p, size_a=%zu, chunk_b=%p size_b=%zu, "
- "committed=%s, arena_ind=%u)\n", __func__, chunk_a, size_a, chunk_b,
- size_b, committed ? "true" : "false", arena_ind);
- did_merge = true;
- return (old_hooks.merge(chunk_a, size_a, chunk_b, size_b,
- committed, arena_ind));
-}
-
-TEST_BEGIN(test_chunk)
-{
- void *p;
- size_t old_size, new_size, large0, large1, huge0, huge1, huge2, sz;
- unsigned arena_ind;
- int flags;
- size_t hooks_mib[3], purge_mib[3];
- size_t hooks_miblen, purge_miblen;
- chunk_hooks_t new_hooks = {
- chunk_alloc,
- chunk_dalloc,
- chunk_commit,
- chunk_decommit,
- chunk_purge,
- chunk_split,
- chunk_merge
- };
- bool xallocx_success_a, xallocx_success_b, xallocx_success_c;
-
- sz = sizeof(unsigned);
- assert_d_eq(mallctl("arenas.extend", &arena_ind, &sz, NULL, 0), 0,
- "Unexpected mallctl() failure");
- flags = MALLOCX_ARENA(arena_ind) | MALLOCX_TCACHE_NONE;
-
- /* Install custom chunk hooks. */
- hooks_miblen = sizeof(hooks_mib)/sizeof(size_t);
- assert_d_eq(mallctlnametomib("arena.0.chunk_hooks", hooks_mib,
- &hooks_miblen), 0, "Unexpected mallctlnametomib() failure");
- hooks_mib[1] = (size_t)arena_ind;
- old_size = sizeof(chunk_hooks_t);
- new_size = sizeof(chunk_hooks_t);
- assert_d_eq(mallctlbymib(hooks_mib, hooks_miblen, &old_hooks, &old_size,
- &new_hooks, new_size), 0, "Unexpected chunk_hooks error");
- orig_hooks = old_hooks;
- assert_ptr_ne(old_hooks.alloc, chunk_alloc, "Unexpected alloc error");
- assert_ptr_ne(old_hooks.dalloc, chunk_dalloc,
- "Unexpected dalloc error");
- assert_ptr_ne(old_hooks.commit, chunk_commit,
- "Unexpected commit error");
- assert_ptr_ne(old_hooks.decommit, chunk_decommit,
- "Unexpected decommit error");
- assert_ptr_ne(old_hooks.purge, chunk_purge, "Unexpected purge error");
- assert_ptr_ne(old_hooks.split, chunk_split, "Unexpected split error");
- assert_ptr_ne(old_hooks.merge, chunk_merge, "Unexpected merge error");
-
- /* Get large size classes. */
- sz = sizeof(size_t);
- assert_d_eq(mallctl("arenas.lrun.0.size", &large0, &sz, NULL, 0), 0,
- "Unexpected arenas.lrun.0.size failure");
- assert_d_eq(mallctl("arenas.lrun.1.size", &large1, &sz, NULL, 0), 0,
- "Unexpected arenas.lrun.1.size failure");
-
- /* Get huge size classes. */
- assert_d_eq(mallctl("arenas.hchunk.0.size", &huge0, &sz, NULL, 0), 0,
- "Unexpected arenas.hchunk.0.size failure");
- assert_d_eq(mallctl("arenas.hchunk.1.size", &huge1, &sz, NULL, 0), 0,
- "Unexpected arenas.hchunk.1.size failure");
- assert_d_eq(mallctl("arenas.hchunk.2.size", &huge2, &sz, NULL, 0), 0,
- "Unexpected arenas.hchunk.2.size failure");
-
- /* Test dalloc/decommit/purge cascade. */
- purge_miblen = sizeof(purge_mib)/sizeof(size_t);
- assert_d_eq(mallctlnametomib("arena.0.purge", purge_mib, &purge_miblen),
- 0, "Unexpected mallctlnametomib() failure");
- purge_mib[1] = (size_t)arena_ind;
- do_dalloc = false;
- do_decommit = false;
- p = mallocx(huge0 * 2, flags);
- assert_ptr_not_null(p, "Unexpected mallocx() error");
- did_dalloc = false;
- did_decommit = false;
- did_purge = false;
- did_split = false;
- xallocx_success_a = (xallocx(p, huge0, 0, flags) == huge0);
- assert_d_eq(mallctlbymib(purge_mib, purge_miblen, NULL, NULL, NULL, 0),
- 0, "Unexpected arena.%u.purge error", arena_ind);
- if (xallocx_success_a) {
- assert_true(did_dalloc, "Expected dalloc");
- assert_false(did_decommit, "Unexpected decommit");
- assert_true(did_purge, "Expected purge");
- }
- assert_true(did_split, "Expected split");
- dallocx(p, flags);
- do_dalloc = true;
-
- /* Test decommit/commit and observe split/merge. */
- do_dalloc = false;
- do_decommit = true;
- p = mallocx(huge0 * 2, flags);
- assert_ptr_not_null(p, "Unexpected mallocx() error");
- did_decommit = false;
- did_commit = false;
- did_split = false;
- did_merge = false;
- xallocx_success_b = (xallocx(p, huge0, 0, flags) == huge0);
- assert_d_eq(mallctlbymib(purge_mib, purge_miblen, NULL, NULL, NULL, 0),
- 0, "Unexpected arena.%u.purge error", arena_ind);
- if (xallocx_success_b)
- assert_true(did_split, "Expected split");
- xallocx_success_c = (xallocx(p, huge0 * 2, 0, flags) == huge0 * 2);
- assert_b_eq(did_decommit, did_commit, "Expected decommit/commit match");
- if (xallocx_success_b && xallocx_success_c)
- assert_true(did_merge, "Expected merge");
- dallocx(p, flags);
- do_dalloc = true;
- do_decommit = false;
-
- /* Test purge for partial-chunk huge allocations. */
- if (huge0 * 2 > huge2) {
- /*
- * There are at least four size classes per doubling, so a
- * successful xallocx() from size=huge2 to size=huge1 is
- * guaranteed to leave trailing purgeable memory.
- */
- p = mallocx(huge2, flags);
- assert_ptr_not_null(p, "Unexpected mallocx() error");
- did_purge = false;
- assert_zu_eq(xallocx(p, huge1, 0, flags), huge1,
- "Unexpected xallocx() failure");
- assert_true(did_purge, "Expected purge");
- dallocx(p, flags);
- }
-
- /* Test decommit for large allocations. */
- do_decommit = true;
- p = mallocx(large1, flags);
- assert_ptr_not_null(p, "Unexpected mallocx() error");
- assert_d_eq(mallctlbymib(purge_mib, purge_miblen, NULL, NULL, NULL, 0),
- 0, "Unexpected arena.%u.purge error", arena_ind);
- did_decommit = false;
- assert_zu_eq(xallocx(p, large0, 0, flags), large0,
- "Unexpected xallocx() failure");
- assert_d_eq(mallctlbymib(purge_mib, purge_miblen, NULL, NULL, NULL, 0),
- 0, "Unexpected arena.%u.purge error", arena_ind);
- did_commit = false;
- assert_zu_eq(xallocx(p, large1, 0, flags), large1,
- "Unexpected xallocx() failure");
- assert_b_eq(did_decommit, did_commit, "Expected decommit/commit match");
- dallocx(p, flags);
- do_decommit = false;
-
- /* Make sure non-huge allocation succeeds. */
- p = mallocx(42, flags);
- assert_ptr_not_null(p, "Unexpected mallocx() error");
- dallocx(p, flags);
-
- /* Restore chunk hooks. */
- assert_d_eq(mallctlbymib(hooks_mib, hooks_miblen, NULL, NULL,
- &old_hooks, new_size), 0, "Unexpected chunk_hooks error");
- assert_d_eq(mallctlbymib(hooks_mib, hooks_miblen, &old_hooks, &old_size,
- NULL, 0), 0, "Unexpected chunk_hooks error");
- assert_ptr_eq(old_hooks.alloc, orig_hooks.alloc,
- "Unexpected alloc error");
- assert_ptr_eq(old_hooks.dalloc, orig_hooks.dalloc,
- "Unexpected dalloc error");
- assert_ptr_eq(old_hooks.commit, orig_hooks.commit,
- "Unexpected commit error");
- assert_ptr_eq(old_hooks.decommit, orig_hooks.decommit,
- "Unexpected decommit error");
- assert_ptr_eq(old_hooks.purge, orig_hooks.purge,
- "Unexpected purge error");
- assert_ptr_eq(old_hooks.split, orig_hooks.split,
- "Unexpected split error");
- assert_ptr_eq(old_hooks.merge, orig_hooks.merge,
- "Unexpected merge error");
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(test_chunk));
-}
diff --git a/memory/jemalloc/src/test/integration/mallocx.c b/memory/jemalloc/src/test/integration/mallocx.c
deleted file mode 100644
index 43b76ebac9..0000000000
--- a/memory/jemalloc/src/test/integration/mallocx.c
+++ /dev/null
@@ -1,234 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#ifdef JEMALLOC_FILL
-const char *malloc_conf = "junk:false";
-#endif
-
-static unsigned
-get_nsizes_impl(const char *cmd)
-{
- unsigned ret;
- size_t z;
-
- z = sizeof(unsigned);
- assert_d_eq(mallctl(cmd, &ret, &z, NULL, 0), 0,
- "Unexpected mallctl(\"%s\", ...) failure", cmd);
-
- return (ret);
-}
-
-static unsigned
-get_nhuge(void)
-{
-
- return (get_nsizes_impl("arenas.nhchunks"));
-}
-
-static size_t
-get_size_impl(const char *cmd, size_t ind)
-{
- size_t ret;
- size_t z;
- size_t mib[4];
- size_t miblen = 4;
-
- z = sizeof(size_t);
- assert_d_eq(mallctlnametomib(cmd, mib, &miblen),
- 0, "Unexpected mallctlnametomib(\"%s\", ...) failure", cmd);
- mib[2] = ind;
- z = sizeof(size_t);
- assert_d_eq(mallctlbymib(mib, miblen, &ret, &z, NULL, 0),
- 0, "Unexpected mallctlbymib([\"%s\", %zu], ...) failure", cmd, ind);
-
- return (ret);
-}
-
-static size_t
-get_huge_size(size_t ind)
-{
-
- return (get_size_impl("arenas.hchunk.0.size", ind));
-}
-
-/*
- * On systems which can't merge extents, tests that call this function generate
- * a lot of dirty memory very quickly. Purging between cycles mitigates
- * potential OOM on e.g. 32-bit Windows.
- */
-static void
-purge(void)
-{
-
- assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
- "Unexpected mallctl error");
-}
-
-TEST_BEGIN(test_overflow)
-{
- size_t hugemax;
-
- hugemax = get_huge_size(get_nhuge()-1);
-
- assert_ptr_null(mallocx(hugemax+1, 0),
- "Expected OOM for mallocx(size=%#zx, 0)", hugemax+1);
-
- assert_ptr_null(mallocx(ZU(PTRDIFF_MAX)+1, 0),
- "Expected OOM for mallocx(size=%#zx, 0)", ZU(PTRDIFF_MAX)+1);
-
- assert_ptr_null(mallocx(SIZE_T_MAX, 0),
- "Expected OOM for mallocx(size=%#zx, 0)", SIZE_T_MAX);
-
- assert_ptr_null(mallocx(1, MALLOCX_ALIGN(ZU(PTRDIFF_MAX)+1)),
- "Expected OOM for mallocx(size=1, MALLOCX_ALIGN(%#zx))",
- ZU(PTRDIFF_MAX)+1);
-}
-TEST_END
-
-TEST_BEGIN(test_oom)
-{
- size_t hugemax;
- bool oom;
- void *ptrs[3];
- unsigned i;
-
- /*
- * It should be impossible to allocate three objects that each consume
- * nearly half the virtual address space.
- */
- hugemax = get_huge_size(get_nhuge()-1);
- oom = false;
- for (i = 0; i < sizeof(ptrs) / sizeof(void *); i++) {
- ptrs[i] = mallocx(hugemax, 0);
- if (ptrs[i] == NULL)
- oom = true;
- }
- assert_true(oom,
- "Expected OOM during series of calls to mallocx(size=%zu, 0)",
- hugemax);
- for (i = 0; i < sizeof(ptrs) / sizeof(void *); i++) {
- if (ptrs[i] != NULL)
- dallocx(ptrs[i], 0);
- }
- purge();
-
-#if LG_SIZEOF_PTR == 3
- assert_ptr_null(mallocx(0x8000000000000000ULL,
- MALLOCX_ALIGN(0x8000000000000000ULL)),
- "Expected OOM for mallocx()");
- assert_ptr_null(mallocx(0x8000000000000000ULL,
- MALLOCX_ALIGN(0x80000000)),
- "Expected OOM for mallocx()");
-#else
- assert_ptr_null(mallocx(0x80000000UL, MALLOCX_ALIGN(0x80000000UL)),
- "Expected OOM for mallocx()");
-#endif
-}
-TEST_END
-
-TEST_BEGIN(test_basic)
-{
-#define MAXSZ (((size_t)1) << 23)
- size_t sz;
-
- for (sz = 1; sz < MAXSZ; sz = nallocx(sz, 0) + 1) {
- size_t nsz, rsz;
- void *p;
- nsz = nallocx(sz, 0);
- assert_zu_ne(nsz, 0, "Unexpected nallocx() error");
- p = mallocx(sz, 0);
- assert_ptr_not_null(p,
- "Unexpected mallocx(size=%zx, flags=0) error", sz);
- rsz = sallocx(p, 0);
- assert_zu_ge(rsz, sz, "Real size smaller than expected");
- assert_zu_eq(nsz, rsz, "nallocx()/sallocx() size mismatch");
- dallocx(p, 0);
-
- p = mallocx(sz, 0);
- assert_ptr_not_null(p,
- "Unexpected mallocx(size=%zx, flags=0) error", sz);
- dallocx(p, 0);
-
- nsz = nallocx(sz, MALLOCX_ZERO);
- assert_zu_ne(nsz, 0, "Unexpected nallocx() error");
- p = mallocx(sz, MALLOCX_ZERO);
- assert_ptr_not_null(p,
- "Unexpected mallocx(size=%zx, flags=MALLOCX_ZERO) error",
- nsz);
- rsz = sallocx(p, 0);
- assert_zu_eq(nsz, rsz, "nallocx()/sallocx() rsize mismatch");
- dallocx(p, 0);
- purge();
- }
-#undef MAXSZ
-}
-TEST_END
-
-TEST_BEGIN(test_alignment_and_size)
-{
-#define MAXALIGN (((size_t)1) << 23)
-#define NITER 4
- size_t nsz, rsz, sz, alignment, total;
- unsigned i;
- void *ps[NITER];
-
- for (i = 0; i < NITER; i++)
- ps[i] = NULL;
-
- for (alignment = 8;
- alignment <= MAXALIGN;
- alignment <<= 1) {
- total = 0;
- for (sz = 1;
- sz < 3 * alignment && sz < (1U << 31);
- sz += (alignment >> (LG_SIZEOF_PTR-1)) - 1) {
- for (i = 0; i < NITER; i++) {
- nsz = nallocx(sz, MALLOCX_ALIGN(alignment) |
- MALLOCX_ZERO);
- assert_zu_ne(nsz, 0,
- "nallocx() error for alignment=%zu, "
- "size=%zu (%#zx)", alignment, sz, sz);
- ps[i] = mallocx(sz, MALLOCX_ALIGN(alignment) |
- MALLOCX_ZERO);
- assert_ptr_not_null(ps[i],
- "mallocx() error for alignment=%zu, "
- "size=%zu (%#zx)", alignment, sz, sz);
- rsz = sallocx(ps[i], 0);
- assert_zu_ge(rsz, sz,
- "Real size smaller than expected for "
- "alignment=%zu, size=%zu", alignment, sz);
- assert_zu_eq(nsz, rsz,
- "nallocx()/sallocx() size mismatch for "
- "alignment=%zu, size=%zu", alignment, sz);
- assert_ptr_null(
- (void *)((uintptr_t)ps[i] & (alignment-1)),
- "%p inadequately aligned for"
- " alignment=%zu, size=%zu", ps[i],
- alignment, sz);
- total += rsz;
- if (total >= (MAXALIGN << 1))
- break;
- }
- for (i = 0; i < NITER; i++) {
- if (ps[i] != NULL) {
- dallocx(ps[i], 0);
- ps[i] = NULL;
- }
- }
- }
- purge();
- }
-#undef MAXALIGN
-#undef NITER
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_overflow,
- test_oom,
- test_basic,
- test_alignment_and_size));
-}
diff --git a/memory/jemalloc/src/test/integration/overflow.c b/memory/jemalloc/src/test/integration/overflow.c
deleted file mode 100644
index 303d9b2d3e..0000000000
--- a/memory/jemalloc/src/test/integration/overflow.c
+++ /dev/null
@@ -1,49 +0,0 @@
-#include "test/jemalloc_test.h"
-
-TEST_BEGIN(test_overflow)
-{
- unsigned nhchunks;
- size_t mib[4];
- size_t sz, miblen, max_size_class;
- void *p;
-
- sz = sizeof(unsigned);
- assert_d_eq(mallctl("arenas.nhchunks", &nhchunks, &sz, NULL, 0), 0,
- "Unexpected mallctl() error");
-
- miblen = sizeof(mib) / sizeof(size_t);
- assert_d_eq(mallctlnametomib("arenas.hchunk.0.size", mib, &miblen), 0,
- "Unexpected mallctlnametomib() error");
- mib[2] = nhchunks - 1;
-
- sz = sizeof(size_t);
- assert_d_eq(mallctlbymib(mib, miblen, &max_size_class, &sz, NULL, 0), 0,
- "Unexpected mallctlbymib() error");
-
- assert_ptr_null(malloc(max_size_class + 1),
- "Expected OOM due to over-sized allocation request");
- assert_ptr_null(malloc(SIZE_T_MAX),
- "Expected OOM due to over-sized allocation request");
-
- assert_ptr_null(calloc(1, max_size_class + 1),
- "Expected OOM due to over-sized allocation request");
- assert_ptr_null(calloc(1, SIZE_T_MAX),
- "Expected OOM due to over-sized allocation request");
-
- p = malloc(1);
- assert_ptr_not_null(p, "Unexpected malloc() OOM");
- assert_ptr_null(realloc(p, max_size_class + 1),
- "Expected OOM due to over-sized allocation request");
- assert_ptr_null(realloc(p, SIZE_T_MAX),
- "Expected OOM due to over-sized allocation request");
- free(p);
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_overflow));
-}
diff --git a/memory/jemalloc/src/test/integration/posix_memalign.c b/memory/jemalloc/src/test/integration/posix_memalign.c
deleted file mode 100644
index e22e102002..0000000000
--- a/memory/jemalloc/src/test/integration/posix_memalign.c
+++ /dev/null
@@ -1,133 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#define CHUNK 0x400000
-#define MAXALIGN (((size_t)1) << 23)
-
-/*
- * On systems which can't merge extents, tests that call this function generate
- * a lot of dirty memory very quickly. Purging between cycles mitigates
- * potential OOM on e.g. 32-bit Windows.
- */
-static void
-purge(void)
-{
-
- assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
- "Unexpected mallctl error");
-}
-
-TEST_BEGIN(test_alignment_errors)
-{
- size_t alignment;
- void *p;
-
- for (alignment = 0; alignment < sizeof(void *); alignment++) {
- assert_d_eq(posix_memalign(&p, alignment, 1), EINVAL,
- "Expected error for invalid alignment %zu",
- alignment);
- }
-
- for (alignment = sizeof(size_t); alignment < MAXALIGN;
- alignment <<= 1) {
- assert_d_ne(posix_memalign(&p, alignment + 1, 1), 0,
- "Expected error for invalid alignment %zu",
- alignment + 1);
- }
-}
-TEST_END
-
-TEST_BEGIN(test_oom_errors)
-{
- size_t alignment, size;
- void *p;
-
-#if LG_SIZEOF_PTR == 3
- alignment = UINT64_C(0x8000000000000000);
- size = UINT64_C(0x8000000000000000);
-#else
- alignment = 0x80000000LU;
- size = 0x80000000LU;
-#endif
- assert_d_ne(posix_memalign(&p, alignment, size), 0,
- "Expected error for posix_memalign(&p, %zu, %zu)",
- alignment, size);
-
-#if LG_SIZEOF_PTR == 3
- alignment = UINT64_C(0x4000000000000000);
- size = UINT64_C(0xc000000000000001);
-#else
- alignment = 0x40000000LU;
- size = 0xc0000001LU;
-#endif
- assert_d_ne(posix_memalign(&p, alignment, size), 0,
- "Expected error for posix_memalign(&p, %zu, %zu)",
- alignment, size);
-
- alignment = 0x10LU;
-#if LG_SIZEOF_PTR == 3
- size = UINT64_C(0xfffffffffffffff0);
-#else
- size = 0xfffffff0LU;
-#endif
- assert_d_ne(posix_memalign(&p, alignment, size), 0,
- "Expected error for posix_memalign(&p, %zu, %zu)",
- alignment, size);
-}
-TEST_END
-
-TEST_BEGIN(test_alignment_and_size)
-{
-#define NITER 4
- size_t alignment, size, total;
- unsigned i;
- int err;
- void *ps[NITER];
-
- for (i = 0; i < NITER; i++)
- ps[i] = NULL;
-
- for (alignment = 8;
- alignment <= MAXALIGN;
- alignment <<= 1) {
- total = 0;
- for (size = 1;
- size < 3 * alignment && size < (1U << 31);
- size += (alignment >> (LG_SIZEOF_PTR-1)) - 1) {
- for (i = 0; i < NITER; i++) {
- err = posix_memalign(&ps[i],
- alignment, size);
- if (err) {
- char buf[BUFERROR_BUF];
-
- buferror(get_errno(), buf, sizeof(buf));
- test_fail(
- "Error for alignment=%zu, "
- "size=%zu (%#zx): %s",
- alignment, size, size, buf);
- }
- total += malloc_usable_size(ps[i]);
- if (total >= (MAXALIGN << 1))
- break;
- }
- for (i = 0; i < NITER; i++) {
- if (ps[i] != NULL) {
- free(ps[i]);
- ps[i] = NULL;
- }
- }
- }
- purge();
- }
-#undef NITER
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_alignment_errors,
- test_oom_errors,
- test_alignment_and_size));
-}
diff --git a/memory/jemalloc/src/test/integration/rallocx.c b/memory/jemalloc/src/test/integration/rallocx.c
deleted file mode 100644
index 66ad8660a4..0000000000
--- a/memory/jemalloc/src/test/integration/rallocx.c
+++ /dev/null
@@ -1,259 +0,0 @@
-#include "test/jemalloc_test.h"
-
-static unsigned
-get_nsizes_impl(const char *cmd)
-{
- unsigned ret;
- size_t z;
-
- z = sizeof(unsigned);
- assert_d_eq(mallctl(cmd, &ret, &z, NULL, 0), 0,
- "Unexpected mallctl(\"%s\", ...) failure", cmd);
-
- return (ret);
-}
-
-static unsigned
-get_nhuge(void)
-{
-
- return (get_nsizes_impl("arenas.nhchunks"));
-}
-
-static size_t
-get_size_impl(const char *cmd, size_t ind)
-{
- size_t ret;
- size_t z;
- size_t mib[4];
- size_t miblen = 4;
-
- z = sizeof(size_t);
- assert_d_eq(mallctlnametomib(cmd, mib, &miblen),
- 0, "Unexpected mallctlnametomib(\"%s\", ...) failure", cmd);
- mib[2] = ind;
- z = sizeof(size_t);
- assert_d_eq(mallctlbymib(mib, miblen, &ret, &z, NULL, 0),
- 0, "Unexpected mallctlbymib([\"%s\", %zu], ...) failure", cmd, ind);
-
- return (ret);
-}
-
-static size_t
-get_huge_size(size_t ind)
-{
-
- return (get_size_impl("arenas.hchunk.0.size", ind));
-}
-
-TEST_BEGIN(test_grow_and_shrink)
-{
- void *p, *q;
- size_t tsz;
-#define NCYCLES 3
- unsigned i, j;
-#define NSZS 2500
- size_t szs[NSZS];
-#define MAXSZ ZU(12 * 1024 * 1024)
-
- p = mallocx(1, 0);
- assert_ptr_not_null(p, "Unexpected mallocx() error");
- szs[0] = sallocx(p, 0);
-
- for (i = 0; i < NCYCLES; i++) {
- for (j = 1; j < NSZS && szs[j-1] < MAXSZ; j++) {
- q = rallocx(p, szs[j-1]+1, 0);
- assert_ptr_not_null(q,
- "Unexpected rallocx() error for size=%zu-->%zu",
- szs[j-1], szs[j-1]+1);
- szs[j] = sallocx(q, 0);
- assert_zu_ne(szs[j], szs[j-1]+1,
- "Expected size to be at least: %zu", szs[j-1]+1);
- p = q;
- }
-
- for (j--; j > 0; j--) {
- q = rallocx(p, szs[j-1], 0);
- assert_ptr_not_null(q,
- "Unexpected rallocx() error for size=%zu-->%zu",
- szs[j], szs[j-1]);
- tsz = sallocx(q, 0);
- assert_zu_eq(tsz, szs[j-1],
- "Expected size=%zu, got size=%zu", szs[j-1], tsz);
- p = q;
- }
- }
-
- dallocx(p, 0);
-#undef MAXSZ
-#undef NSZS
-#undef NCYCLES
-}
-TEST_END
-
-static bool
-validate_fill(const void *p, uint8_t c, size_t offset, size_t len)
-{
- bool ret = false;
- const uint8_t *buf = (const uint8_t *)p;
- size_t i;
-
- for (i = 0; i < len; i++) {
- uint8_t b = buf[offset+i];
- if (b != c) {
- test_fail("Allocation at %p (len=%zu) contains %#x "
- "rather than %#x at offset %zu", p, len, b, c,
- offset+i);
- ret = true;
- }
- }
-
- return (ret);
-}
-
-TEST_BEGIN(test_zero)
-{
- void *p, *q;
- size_t psz, qsz, i, j;
- size_t start_sizes[] = {1, 3*1024, 63*1024, 4095*1024};
-#define FILL_BYTE 0xaaU
-#define RANGE 2048
-
- for (i = 0; i < sizeof(start_sizes)/sizeof(size_t); i++) {
- size_t start_size = start_sizes[i];
- p = mallocx(start_size, MALLOCX_ZERO);
- assert_ptr_not_null(p, "Unexpected mallocx() error");
- psz = sallocx(p, 0);
-
- assert_false(validate_fill(p, 0, 0, psz),
- "Expected zeroed memory");
- memset(p, FILL_BYTE, psz);
- assert_false(validate_fill(p, FILL_BYTE, 0, psz),
- "Expected filled memory");
-
- for (j = 1; j < RANGE; j++) {
- q = rallocx(p, start_size+j, MALLOCX_ZERO);
- assert_ptr_not_null(q, "Unexpected rallocx() error");
- qsz = sallocx(q, 0);
- if (q != p || qsz != psz) {
- assert_false(validate_fill(q, FILL_BYTE, 0,
- psz), "Expected filled memory");
- assert_false(validate_fill(q, 0, psz, qsz-psz),
- "Expected zeroed memory");
- }
- if (psz != qsz) {
- memset((void *)((uintptr_t)q+psz), FILL_BYTE,
- qsz-psz);
- psz = qsz;
- }
- p = q;
- }
- assert_false(validate_fill(p, FILL_BYTE, 0, psz),
- "Expected filled memory");
- dallocx(p, 0);
- }
-#undef FILL_BYTE
-}
-TEST_END
-
-TEST_BEGIN(test_align)
-{
- void *p, *q;
- size_t align;
-#define MAX_ALIGN (ZU(1) << 25)
-
- align = ZU(1);
- p = mallocx(1, MALLOCX_ALIGN(align));
- assert_ptr_not_null(p, "Unexpected mallocx() error");
-
- for (align <<= 1; align <= MAX_ALIGN; align <<= 1) {
- q = rallocx(p, 1, MALLOCX_ALIGN(align));
- assert_ptr_not_null(q,
- "Unexpected rallocx() error for align=%zu", align);
- assert_ptr_null(
- (void *)((uintptr_t)q & (align-1)),
- "%p inadequately aligned for align=%zu",
- q, align);
- p = q;
- }
- dallocx(p, 0);
-#undef MAX_ALIGN
-}
-TEST_END
-
-TEST_BEGIN(test_lg_align_and_zero)
-{
- void *p, *q;
- unsigned lg_align;
- size_t sz;
-#define MAX_LG_ALIGN 25
-#define MAX_VALIDATE (ZU(1) << 22)
-
- lg_align = 0;
- p = mallocx(1, MALLOCX_LG_ALIGN(lg_align)|MALLOCX_ZERO);
- assert_ptr_not_null(p, "Unexpected mallocx() error");
-
- for (lg_align++; lg_align <= MAX_LG_ALIGN; lg_align++) {
- q = rallocx(p, 1, MALLOCX_LG_ALIGN(lg_align)|MALLOCX_ZERO);
- assert_ptr_not_null(q,
- "Unexpected rallocx() error for lg_align=%u", lg_align);
- assert_ptr_null(
- (void *)((uintptr_t)q & ((ZU(1) << lg_align)-1)),
- "%p inadequately aligned for lg_align=%u", q, lg_align);
- sz = sallocx(q, 0);
- if ((sz << 1) <= MAX_VALIDATE) {
- assert_false(validate_fill(q, 0, 0, sz),
- "Expected zeroed memory");
- } else {
- assert_false(validate_fill(q, 0, 0, MAX_VALIDATE),
- "Expected zeroed memory");
- assert_false(validate_fill(
- (void *)((uintptr_t)q+sz-MAX_VALIDATE),
- 0, 0, MAX_VALIDATE), "Expected zeroed memory");
- }
- p = q;
- }
- dallocx(p, 0);
-#undef MAX_VALIDATE
-#undef MAX_LG_ALIGN
-}
-TEST_END
-
-TEST_BEGIN(test_overflow)
-{
- size_t hugemax;
- void *p;
-
- hugemax = get_huge_size(get_nhuge()-1);
-
- p = mallocx(1, 0);
- assert_ptr_not_null(p, "Unexpected mallocx() failure");
-
- assert_ptr_null(rallocx(p, hugemax+1, 0),
- "Expected OOM for rallocx(p, size=%#zx, 0)", hugemax+1);
-
- assert_ptr_null(rallocx(p, ZU(PTRDIFF_MAX)+1, 0),
- "Expected OOM for rallocx(p, size=%#zx, 0)", ZU(PTRDIFF_MAX)+1);
-
- assert_ptr_null(rallocx(p, SIZE_T_MAX, 0),
- "Expected OOM for rallocx(p, size=%#zx, 0)", SIZE_T_MAX);
-
- assert_ptr_null(rallocx(p, 1, MALLOCX_ALIGN(ZU(PTRDIFF_MAX)+1)),
- "Expected OOM for rallocx(p, size=1, MALLOCX_ALIGN(%#zx))",
- ZU(PTRDIFF_MAX)+1);
-
- dallocx(p, 0);
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_grow_and_shrink,
- test_zero,
- test_align,
- test_lg_align_and_zero,
- test_overflow));
-}
diff --git a/memory/jemalloc/src/test/integration/sdallocx.c b/memory/jemalloc/src/test/integration/sdallocx.c
deleted file mode 100644
index b84817d767..0000000000
--- a/memory/jemalloc/src/test/integration/sdallocx.c
+++ /dev/null
@@ -1,57 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#define MAXALIGN (((size_t)1) << 25)
-#define NITER 4
-
-TEST_BEGIN(test_basic)
-{
- void *ptr = mallocx(64, 0);
- sdallocx(ptr, 64, 0);
-}
-TEST_END
-
-TEST_BEGIN(test_alignment_and_size)
-{
- size_t nsz, sz, alignment, total;
- unsigned i;
- void *ps[NITER];
-
- for (i = 0; i < NITER; i++)
- ps[i] = NULL;
-
- for (alignment = 8;
- alignment <= MAXALIGN;
- alignment <<= 1) {
- total = 0;
- for (sz = 1;
- sz < 3 * alignment && sz < (1U << 31);
- sz += (alignment >> (LG_SIZEOF_PTR-1)) - 1) {
- for (i = 0; i < NITER; i++) {
- nsz = nallocx(sz, MALLOCX_ALIGN(alignment) |
- MALLOCX_ZERO);
- ps[i] = mallocx(sz, MALLOCX_ALIGN(alignment) |
- MALLOCX_ZERO);
- total += nsz;
- if (total >= (MAXALIGN << 1))
- break;
- }
- for (i = 0; i < NITER; i++) {
- if (ps[i] != NULL) {
- sdallocx(ps[i], sz,
- MALLOCX_ALIGN(alignment));
- ps[i] = NULL;
- }
- }
- }
- }
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_basic,
- test_alignment_and_size));
-}
diff --git a/memory/jemalloc/src/test/integration/thread_arena.c b/memory/jemalloc/src/test/integration/thread_arena.c
deleted file mode 100644
index 67be535133..0000000000
--- a/memory/jemalloc/src/test/integration/thread_arena.c
+++ /dev/null
@@ -1,79 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#define NTHREADS 10
-
-void *
-thd_start(void *arg)
-{
- unsigned main_arena_ind = *(unsigned *)arg;
- void *p;
- unsigned arena_ind;
- size_t size;
- int err;
-
- p = malloc(1);
- assert_ptr_not_null(p, "Error in malloc()");
- free(p);
-
- size = sizeof(arena_ind);
- if ((err = mallctl("thread.arena", &arena_ind, &size, &main_arena_ind,
- sizeof(main_arena_ind)))) {
- char buf[BUFERROR_BUF];
-
- buferror(err, buf, sizeof(buf));
- test_fail("Error in mallctl(): %s", buf);
- }
-
- size = sizeof(arena_ind);
- if ((err = mallctl("thread.arena", &arena_ind, &size, NULL, 0))) {
- char buf[BUFERROR_BUF];
-
- buferror(err, buf, sizeof(buf));
- test_fail("Error in mallctl(): %s", buf);
- }
- assert_u_eq(arena_ind, main_arena_ind,
- "Arena index should be same as for main thread");
-
- return (NULL);
-}
-
-TEST_BEGIN(test_thread_arena)
-{
- void *p;
- unsigned arena_ind;
- size_t size;
- int err;
- thd_t thds[NTHREADS];
- unsigned i;
-
- p = malloc(1);
- assert_ptr_not_null(p, "Error in malloc()");
-
- size = sizeof(arena_ind);
- if ((err = mallctl("thread.arena", &arena_ind, &size, NULL, 0))) {
- char buf[BUFERROR_BUF];
-
- buferror(err, buf, sizeof(buf));
- test_fail("Error in mallctl(): %s", buf);
- }
-
- for (i = 0; i < NTHREADS; i++) {
- thd_create(&thds[i], thd_start,
- (void *)&arena_ind);
- }
-
- for (i = 0; i < NTHREADS; i++) {
- intptr_t join_ret;
- thd_join(thds[i], (void *)&join_ret);
- assert_zd_eq(join_ret, 0, "Unexpected thread join error");
- }
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_thread_arena));
-}
diff --git a/memory/jemalloc/src/test/integration/thread_tcache_enabled.c b/memory/jemalloc/src/test/integration/thread_tcache_enabled.c
deleted file mode 100644
index f4e89c682a..0000000000
--- a/memory/jemalloc/src/test/integration/thread_tcache_enabled.c
+++ /dev/null
@@ -1,113 +0,0 @@
-#include "test/jemalloc_test.h"
-
-static const bool config_tcache =
-#ifdef JEMALLOC_TCACHE
- true
-#else
- false
-#endif
- ;
-
-void *
-thd_start(void *arg)
-{
- int err;
- size_t sz;
- bool e0, e1;
-
- sz = sizeof(bool);
- if ((err = mallctl("thread.tcache.enabled", &e0, &sz, NULL, 0))) {
- if (err == ENOENT) {
- assert_false(config_tcache,
- "ENOENT should only be returned if tcache is "
- "disabled");
- }
- goto label_ENOENT;
- }
-
- if (e0) {
- e1 = false;
- assert_d_eq(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz),
- 0, "Unexpected mallctl() error");
- assert_true(e0, "tcache should be enabled");
- }
-
- e1 = true;
- assert_d_eq(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz), 0,
- "Unexpected mallctl() error");
- assert_false(e0, "tcache should be disabled");
-
- e1 = true;
- assert_d_eq(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz), 0,
- "Unexpected mallctl() error");
- assert_true(e0, "tcache should be enabled");
-
- e1 = false;
- assert_d_eq(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz), 0,
- "Unexpected mallctl() error");
- assert_true(e0, "tcache should be enabled");
-
- e1 = false;
- assert_d_eq(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz), 0,
- "Unexpected mallctl() error");
- assert_false(e0, "tcache should be disabled");
-
- free(malloc(1));
- e1 = true;
- assert_d_eq(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz), 0,
- "Unexpected mallctl() error");
- assert_false(e0, "tcache should be disabled");
-
- free(malloc(1));
- e1 = true;
- assert_d_eq(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz), 0,
- "Unexpected mallctl() error");
- assert_true(e0, "tcache should be enabled");
-
- free(malloc(1));
- e1 = false;
- assert_d_eq(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz), 0,
- "Unexpected mallctl() error");
- assert_true(e0, "tcache should be enabled");
-
- free(malloc(1));
- e1 = false;
- assert_d_eq(mallctl("thread.tcache.enabled", &e0, &sz, &e1, sz), 0,
- "Unexpected mallctl() error");
- assert_false(e0, "tcache should be disabled");
-
- free(malloc(1));
- return (NULL);
-label_ENOENT:
- test_skip("\"thread.tcache.enabled\" mallctl not available");
- return (NULL);
-}
-
-TEST_BEGIN(test_main_thread)
-{
-
- thd_start(NULL);
-}
-TEST_END
-
-TEST_BEGIN(test_subthread)
-{
- thd_t thd;
-
- thd_create(&thd, thd_start, NULL);
- thd_join(thd, NULL);
-}
-TEST_END
-
-int
-main(void)
-{
-
- /* Run tests multiple times to check for bad interactions. */
- return (test(
- test_main_thread,
- test_subthread,
- test_main_thread,
- test_subthread,
- test_main_thread));
-}
diff --git a/memory/jemalloc/src/test/integration/xallocx.c b/memory/jemalloc/src/test/integration/xallocx.c
deleted file mode 100644
index ad292bb562..0000000000
--- a/memory/jemalloc/src/test/integration/xallocx.c
+++ /dev/null
@@ -1,497 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#ifdef JEMALLOC_FILL
-const char *malloc_conf = "junk:false";
-#endif
-
-/*
- * Use a separate arena for xallocx() extension/contraction tests so that
- * internal allocation e.g. by heap profiling can't interpose allocations where
- * xallocx() would ordinarily be able to extend.
- */
-static unsigned
-arena_ind(void)
-{
- static unsigned ind = 0;
-
- if (ind == 0) {
- size_t sz = sizeof(ind);
- assert_d_eq(mallctl("arenas.extend", &ind, &sz, NULL, 0), 0,
- "Unexpected mallctl failure creating arena");
- }
-
- return (ind);
-}
-
-TEST_BEGIN(test_same_size)
-{
- void *p;
- size_t sz, tsz;
-
- p = mallocx(42, 0);
- assert_ptr_not_null(p, "Unexpected mallocx() error");
- sz = sallocx(p, 0);
-
- tsz = xallocx(p, sz, 0, 0);
- assert_zu_eq(tsz, sz, "Unexpected size change: %zu --> %zu", sz, tsz);
-
- dallocx(p, 0);
-}
-TEST_END
-
-TEST_BEGIN(test_extra_no_move)
-{
- void *p;
- size_t sz, tsz;
-
- p = mallocx(42, 0);
- assert_ptr_not_null(p, "Unexpected mallocx() error");
- sz = sallocx(p, 0);
-
- tsz = xallocx(p, sz, sz-42, 0);
- assert_zu_eq(tsz, sz, "Unexpected size change: %zu --> %zu", sz, tsz);
-
- dallocx(p, 0);
-}
-TEST_END
-
-TEST_BEGIN(test_no_move_fail)
-{
- void *p;
- size_t sz, tsz;
-
- p = mallocx(42, 0);
- assert_ptr_not_null(p, "Unexpected mallocx() error");
- sz = sallocx(p, 0);
-
- tsz = xallocx(p, sz + 5, 0, 0);
- assert_zu_eq(tsz, sz, "Unexpected size change: %zu --> %zu", sz, tsz);
-
- dallocx(p, 0);
-}
-TEST_END
-
-static unsigned
-get_nsizes_impl(const char *cmd)
-{
- unsigned ret;
- size_t z;
-
- z = sizeof(unsigned);
- assert_d_eq(mallctl(cmd, &ret, &z, NULL, 0), 0,
- "Unexpected mallctl(\"%s\", ...) failure", cmd);
-
- return (ret);
-}
-
-static unsigned
-get_nsmall(void)
-{
-
- return (get_nsizes_impl("arenas.nbins"));
-}
-
-static unsigned
-get_nlarge(void)
-{
-
- return (get_nsizes_impl("arenas.nlruns"));
-}
-
-static unsigned
-get_nhuge(void)
-{
-
- return (get_nsizes_impl("arenas.nhchunks"));
-}
-
-static size_t
-get_size_impl(const char *cmd, size_t ind)
-{
- size_t ret;
- size_t z;
- size_t mib[4];
- size_t miblen = 4;
-
- z = sizeof(size_t);
- assert_d_eq(mallctlnametomib(cmd, mib, &miblen),
- 0, "Unexpected mallctlnametomib(\"%s\", ...) failure", cmd);
- mib[2] = ind;
- z = sizeof(size_t);
- assert_d_eq(mallctlbymib(mib, miblen, &ret, &z, NULL, 0),
- 0, "Unexpected mallctlbymib([\"%s\", %zu], ...) failure", cmd, ind);
-
- return (ret);
-}
-
-static size_t
-get_small_size(size_t ind)
-{
-
- return (get_size_impl("arenas.bin.0.size", ind));
-}
-
-static size_t
-get_large_size(size_t ind)
-{
-
- return (get_size_impl("arenas.lrun.0.size", ind));
-}
-
-static size_t
-get_huge_size(size_t ind)
-{
-
- return (get_size_impl("arenas.hchunk.0.size", ind));
-}
-
-TEST_BEGIN(test_size)
-{
- size_t small0, hugemax;
- void *p;
-
- /* Get size classes. */
- small0 = get_small_size(0);
- hugemax = get_huge_size(get_nhuge()-1);
-
- p = mallocx(small0, 0);
- assert_ptr_not_null(p, "Unexpected mallocx() error");
-
- /* Test smallest supported size. */
- assert_zu_eq(xallocx(p, 1, 0, 0), small0,
- "Unexpected xallocx() behavior");
-
- /* Test largest supported size. */
- assert_zu_le(xallocx(p, hugemax, 0, 0), hugemax,
- "Unexpected xallocx() behavior");
-
- /* Test size overflow. */
- assert_zu_le(xallocx(p, hugemax+1, 0, 0), hugemax,
- "Unexpected xallocx() behavior");
- assert_zu_le(xallocx(p, SIZE_T_MAX, 0, 0), hugemax,
- "Unexpected xallocx() behavior");
-
- dallocx(p, 0);
-}
-TEST_END
-
-TEST_BEGIN(test_size_extra_overflow)
-{
- size_t small0, hugemax;
- void *p;
-
- /* Get size classes. */
- small0 = get_small_size(0);
- hugemax = get_huge_size(get_nhuge()-1);
-
- p = mallocx(small0, 0);
- assert_ptr_not_null(p, "Unexpected mallocx() error");
-
- /* Test overflows that can be resolved by clamping extra. */
- assert_zu_le(xallocx(p, hugemax-1, 2, 0), hugemax,
- "Unexpected xallocx() behavior");
- assert_zu_le(xallocx(p, hugemax, 1, 0), hugemax,
- "Unexpected xallocx() behavior");
-
- /* Test overflow such that hugemax-size underflows. */
- assert_zu_le(xallocx(p, hugemax+1, 2, 0), hugemax,
- "Unexpected xallocx() behavior");
- assert_zu_le(xallocx(p, hugemax+2, 3, 0), hugemax,
- "Unexpected xallocx() behavior");
- assert_zu_le(xallocx(p, SIZE_T_MAX-2, 2, 0), hugemax,
- "Unexpected xallocx() behavior");
- assert_zu_le(xallocx(p, SIZE_T_MAX-1, 1, 0), hugemax,
- "Unexpected xallocx() behavior");
-
- dallocx(p, 0);
-}
-TEST_END
-
-TEST_BEGIN(test_extra_small)
-{
- size_t small0, small1, hugemax;
- void *p;
-
- /* Get size classes. */
- small0 = get_small_size(0);
- small1 = get_small_size(1);
- hugemax = get_huge_size(get_nhuge()-1);
-
- p = mallocx(small0, 0);
- assert_ptr_not_null(p, "Unexpected mallocx() error");
-
- assert_zu_eq(xallocx(p, small1, 0, 0), small0,
- "Unexpected xallocx() behavior");
-
- assert_zu_eq(xallocx(p, small1, 0, 0), small0,
- "Unexpected xallocx() behavior");
-
- assert_zu_eq(xallocx(p, small0, small1 - small0, 0), small0,
- "Unexpected xallocx() behavior");
-
- /* Test size+extra overflow. */
- assert_zu_eq(xallocx(p, small0, hugemax - small0 + 1, 0), small0,
- "Unexpected xallocx() behavior");
- assert_zu_eq(xallocx(p, small0, SIZE_T_MAX - small0, 0), small0,
- "Unexpected xallocx() behavior");
-
- dallocx(p, 0);
-}
-TEST_END
-
-TEST_BEGIN(test_extra_large)
-{
- int flags = MALLOCX_ARENA(arena_ind());
- size_t smallmax, large0, large1, large2, huge0, hugemax;
- void *p;
-
- /* Get size classes. */
- smallmax = get_small_size(get_nsmall()-1);
- large0 = get_large_size(0);
- large1 = get_large_size(1);
- large2 = get_large_size(2);
- huge0 = get_huge_size(0);
- hugemax = get_huge_size(get_nhuge()-1);
-
- p = mallocx(large2, flags);
- assert_ptr_not_null(p, "Unexpected mallocx() error");
-
- assert_zu_eq(xallocx(p, large2, 0, flags), large2,
- "Unexpected xallocx() behavior");
- /* Test size decrease with zero extra. */
- assert_zu_eq(xallocx(p, large0, 0, flags), large0,
- "Unexpected xallocx() behavior");
- assert_zu_eq(xallocx(p, smallmax, 0, flags), large0,
- "Unexpected xallocx() behavior");
-
- assert_zu_eq(xallocx(p, large2, 0, flags), large2,
- "Unexpected xallocx() behavior");
- /* Test size decrease with non-zero extra. */
- assert_zu_eq(xallocx(p, large0, large2 - large0, flags), large2,
- "Unexpected xallocx() behavior");
- assert_zu_eq(xallocx(p, large1, large2 - large1, flags), large2,
- "Unexpected xallocx() behavior");
- assert_zu_eq(xallocx(p, large0, large1 - large0, flags), large1,
- "Unexpected xallocx() behavior");
- assert_zu_eq(xallocx(p, smallmax, large0 - smallmax, flags), large0,
- "Unexpected xallocx() behavior");
-
- assert_zu_eq(xallocx(p, large0, 0, flags), large0,
- "Unexpected xallocx() behavior");
- /* Test size increase with zero extra. */
- assert_zu_eq(xallocx(p, large2, 0, flags), large2,
- "Unexpected xallocx() behavior");
- assert_zu_eq(xallocx(p, huge0, 0, flags), large2,
- "Unexpected xallocx() behavior");
-
- assert_zu_eq(xallocx(p, large0, 0, flags), large0,
- "Unexpected xallocx() behavior");
- /* Test size increase with non-zero extra. */
- assert_zu_lt(xallocx(p, large0, huge0 - large0, flags), huge0,
- "Unexpected xallocx() behavior");
-
- assert_zu_eq(xallocx(p, large0, 0, flags), large0,
- "Unexpected xallocx() behavior");
- /* Test size increase with non-zero extra. */
- assert_zu_eq(xallocx(p, large0, large2 - large0, flags), large2,
- "Unexpected xallocx() behavior");
-
- assert_zu_eq(xallocx(p, large2, 0, flags), large2,
- "Unexpected xallocx() behavior");
- /* Test size+extra overflow. */
- assert_zu_lt(xallocx(p, large2, hugemax - large2 + 1, flags), huge0,
- "Unexpected xallocx() behavior");
-
- dallocx(p, flags);
-}
-TEST_END
-
-TEST_BEGIN(test_extra_huge)
-{
- int flags = MALLOCX_ARENA(arena_ind());
- size_t largemax, huge1, huge2, huge3, hugemax;
- void *p;
-
- /* Get size classes. */
- largemax = get_large_size(get_nlarge()-1);
- huge1 = get_huge_size(1);
- huge2 = get_huge_size(2);
- huge3 = get_huge_size(3);
- hugemax = get_huge_size(get_nhuge()-1);
-
- p = mallocx(huge3, flags);
- assert_ptr_not_null(p, "Unexpected mallocx() error");
-
- assert_zu_eq(xallocx(p, huge3, 0, flags), huge3,
- "Unexpected xallocx() behavior");
- /* Test size decrease with zero extra. */
- assert_zu_ge(xallocx(p, huge1, 0, flags), huge1,
- "Unexpected xallocx() behavior");
- assert_zu_ge(xallocx(p, largemax, 0, flags), huge1,
- "Unexpected xallocx() behavior");
-
- assert_zu_eq(xallocx(p, huge3, 0, flags), huge3,
- "Unexpected xallocx() behavior");
- /* Test size decrease with non-zero extra. */
- assert_zu_eq(xallocx(p, huge1, huge3 - huge1, flags), huge3,
- "Unexpected xallocx() behavior");
- assert_zu_eq(xallocx(p, huge2, huge3 - huge2, flags), huge3,
- "Unexpected xallocx() behavior");
- assert_zu_eq(xallocx(p, huge1, huge2 - huge1, flags), huge2,
- "Unexpected xallocx() behavior");
- assert_zu_ge(xallocx(p, largemax, huge1 - largemax, flags), huge1,
- "Unexpected xallocx() behavior");
-
- assert_zu_ge(xallocx(p, huge1, 0, flags), huge1,
- "Unexpected xallocx() behavior");
- /* Test size increase with zero extra. */
- assert_zu_le(xallocx(p, huge3, 0, flags), huge3,
- "Unexpected xallocx() behavior");
- assert_zu_le(xallocx(p, hugemax+1, 0, flags), huge3,
- "Unexpected xallocx() behavior");
-
- assert_zu_ge(xallocx(p, huge1, 0, flags), huge1,
- "Unexpected xallocx() behavior");
- /* Test size increase with non-zero extra. */
- assert_zu_le(xallocx(p, huge1, SIZE_T_MAX - huge1, flags), hugemax,
- "Unexpected xallocx() behavior");
-
- assert_zu_ge(xallocx(p, huge1, 0, flags), huge1,
- "Unexpected xallocx() behavior");
- /* Test size increase with non-zero extra. */
- assert_zu_le(xallocx(p, huge1, huge3 - huge1, flags), huge3,
- "Unexpected xallocx() behavior");
-
- assert_zu_eq(xallocx(p, huge3, 0, flags), huge3,
- "Unexpected xallocx() behavior");
- /* Test size+extra overflow. */
- assert_zu_le(xallocx(p, huge3, hugemax - huge3 + 1, flags), hugemax,
- "Unexpected xallocx() behavior");
-
- dallocx(p, flags);
-}
-TEST_END
-
-static void
-print_filled_extents(const void *p, uint8_t c, size_t len)
-{
- const uint8_t *pc = (const uint8_t *)p;
- size_t i, range0;
- uint8_t c0;
-
- malloc_printf(" p=%p, c=%#x, len=%zu:", p, c, len);
- range0 = 0;
- c0 = pc[0];
- for (i = 0; i < len; i++) {
- if (pc[i] != c0) {
- malloc_printf(" %#x[%zu..%zu)", c0, range0, i);
- range0 = i;
- c0 = pc[i];
- }
- }
- malloc_printf(" %#x[%zu..%zu)\n", c0, range0, i);
-}
-
-static bool
-validate_fill(const void *p, uint8_t c, size_t offset, size_t len)
-{
- const uint8_t *pc = (const uint8_t *)p;
- bool err;
- size_t i;
-
- for (i = offset, err = false; i < offset+len; i++) {
- if (pc[i] != c)
- err = true;
- }
-
- if (err)
- print_filled_extents(p, c, offset + len);
-
- return (err);
-}
-
-static void
-test_zero(size_t szmin, size_t szmax)
-{
- int flags = MALLOCX_ARENA(arena_ind()) | MALLOCX_ZERO;
- size_t sz, nsz;
- void *p;
-#define FILL_BYTE 0x7aU
-
- sz = szmax;
- p = mallocx(sz, flags);
- assert_ptr_not_null(p, "Unexpected mallocx() error");
- assert_false(validate_fill(p, 0x00, 0, sz), "Memory not filled: sz=%zu",
- sz);
-
- /*
- * Fill with non-zero so that non-debug builds are more likely to detect
- * errors.
- */
- memset(p, FILL_BYTE, sz);
- assert_false(validate_fill(p, FILL_BYTE, 0, sz),
- "Memory not filled: sz=%zu", sz);
-
- /* Shrink in place so that we can expect growing in place to succeed. */
- sz = szmin;
- assert_zu_eq(xallocx(p, sz, 0, flags), sz,
- "Unexpected xallocx() error");
- assert_false(validate_fill(p, FILL_BYTE, 0, sz),
- "Memory not filled: sz=%zu", sz);
-
- for (sz = szmin; sz < szmax; sz = nsz) {
- nsz = nallocx(sz+1, flags);
- assert_zu_eq(xallocx(p, sz+1, 0, flags), nsz,
- "Unexpected xallocx() failure");
- assert_false(validate_fill(p, FILL_BYTE, 0, sz),
- "Memory not filled: sz=%zu", sz);
- assert_false(validate_fill(p, 0x00, sz, nsz-sz),
- "Memory not filled: sz=%zu, nsz-sz=%zu", sz, nsz-sz);
- memset((void *)((uintptr_t)p + sz), FILL_BYTE, nsz-sz);
- assert_false(validate_fill(p, FILL_BYTE, 0, nsz),
- "Memory not filled: nsz=%zu", nsz);
- }
-
- dallocx(p, flags);
-}
-
-TEST_BEGIN(test_zero_large)
-{
- size_t large0, largemax;
-
- /* Get size classes. */
- large0 = get_large_size(0);
- largemax = get_large_size(get_nlarge()-1);
-
- test_zero(large0, largemax);
-}
-TEST_END
-
-TEST_BEGIN(test_zero_huge)
-{
- size_t huge0, huge1;
-
- /* Get size classes. */
- huge0 = get_huge_size(0);
- huge1 = get_huge_size(1);
-
- test_zero(huge1, huge0 * 2);
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_same_size,
- test_extra_no_move,
- test_no_move_fail,
- test_size,
- test_size_extra_overflow,
- test_extra_small,
- test_extra_large,
- test_extra_huge,
- test_zero_large,
- test_zero_huge));
-}
diff --git a/memory/jemalloc/src/test/src/SFMT.c b/memory/jemalloc/src/test/src/SFMT.c
deleted file mode 100644
index 80cabe05ee..0000000000
--- a/memory/jemalloc/src/test/src/SFMT.c
+++ /dev/null
@@ -1,719 +0,0 @@
-/*
- * This file derives from SFMT 1.3.3
- * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was
- * released under the terms of the following license:
- *
- * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
- * University. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of the Hiroshima University nor the names of
- * its contributors may be used to endorse or promote products
- * derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-/**
- * @file SFMT.c
- * @brief SIMD oriented Fast Mersenne Twister(SFMT)
- *
- * @author Mutsuo Saito (Hiroshima University)
- * @author Makoto Matsumoto (Hiroshima University)
- *
- * Copyright (C) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
- * University. All rights reserved.
- *
- * The new BSD License is applied to this software, see LICENSE.txt
- */
-#define SFMT_C_
-#include "test/jemalloc_test.h"
-#include "test/SFMT-params.h"
-
-#if defined(JEMALLOC_BIG_ENDIAN) && !defined(BIG_ENDIAN64)
-#define BIG_ENDIAN64 1
-#endif
-#if defined(__BIG_ENDIAN__) && !defined(__amd64) && !defined(BIG_ENDIAN64)
-#define BIG_ENDIAN64 1
-#endif
-#if defined(HAVE_ALTIVEC) && !defined(BIG_ENDIAN64)
-#define BIG_ENDIAN64 1
-#endif
-#if defined(ONLY64) && !defined(BIG_ENDIAN64)
- #if defined(__GNUC__)
- #error "-DONLY64 must be specified with -DBIG_ENDIAN64"
- #endif
-#undef ONLY64
-#endif
-/*------------------------------------------------------
- 128-bit SIMD data type for Altivec, SSE2 or standard C
- ------------------------------------------------------*/
-#if defined(HAVE_ALTIVEC)
-/** 128-bit data structure */
-union W128_T {
- vector unsigned int s;
- uint32_t u[4];
-};
-/** 128-bit data type */
-typedef union W128_T w128_t;
-
-#elif defined(HAVE_SSE2)
-/** 128-bit data structure */
-union W128_T {
- __m128i si;
- uint32_t u[4];
-};
-/** 128-bit data type */
-typedef union W128_T w128_t;
-
-#else
-
-/** 128-bit data structure */
-struct W128_T {
- uint32_t u[4];
-};
-/** 128-bit data type */
-typedef struct W128_T w128_t;
-
-#endif
-
-struct sfmt_s {
- /** the 128-bit internal state array */
- w128_t sfmt[N];
- /** index counter to the 32-bit internal state array */
- int idx;
- /** a flag: it is 0 if and only if the internal state is not yet
- * initialized. */
- int initialized;
-};
-
-/*--------------------------------------
- FILE GLOBAL VARIABLES
- internal state, index counter and flag
- --------------------------------------*/
-
-/** a parity check vector which certificate the period of 2^{MEXP} */
-static uint32_t parity[4] = {PARITY1, PARITY2, PARITY3, PARITY4};
-
-/*----------------
- STATIC FUNCTIONS
- ----------------*/
-JEMALLOC_INLINE_C int idxof(int i);
-#if (!defined(HAVE_ALTIVEC)) && (!defined(HAVE_SSE2))
-JEMALLOC_INLINE_C void rshift128(w128_t *out, w128_t const *in, int shift);
-JEMALLOC_INLINE_C void lshift128(w128_t *out, w128_t const *in, int shift);
-#endif
-JEMALLOC_INLINE_C void gen_rand_all(sfmt_t *ctx);
-JEMALLOC_INLINE_C void gen_rand_array(sfmt_t *ctx, w128_t *array, int size);
-JEMALLOC_INLINE_C uint32_t func1(uint32_t x);
-JEMALLOC_INLINE_C uint32_t func2(uint32_t x);
-static void period_certification(sfmt_t *ctx);
-#if defined(BIG_ENDIAN64) && !defined(ONLY64)
-JEMALLOC_INLINE_C void swap(w128_t *array, int size);
-#endif
-
-#if defined(HAVE_ALTIVEC)
- #include "test/SFMT-alti.h"
-#elif defined(HAVE_SSE2)
- #include "test/SFMT-sse2.h"
-#endif
-
-/**
- * This function simulate a 64-bit index of LITTLE ENDIAN
- * in BIG ENDIAN machine.
- */
-#ifdef ONLY64
-JEMALLOC_INLINE_C int idxof(int i) {
- return i ^ 1;
-}
-#else
-JEMALLOC_INLINE_C int idxof(int i) {
- return i;
-}
-#endif
-/**
- * This function simulates SIMD 128-bit right shift by the standard C.
- * The 128-bit integer given in in is shifted by (shift * 8) bits.
- * This function simulates the LITTLE ENDIAN SIMD.
- * @param out the output of this function
- * @param in the 128-bit data to be shifted
- * @param shift the shift value
- */
-#if (!defined(HAVE_ALTIVEC)) && (!defined(HAVE_SSE2))
-#ifdef ONLY64
-JEMALLOC_INLINE_C void rshift128(w128_t *out, w128_t const *in, int shift) {
- uint64_t th, tl, oh, ol;
-
- th = ((uint64_t)in->u[2] << 32) | ((uint64_t)in->u[3]);
- tl = ((uint64_t)in->u[0] << 32) | ((uint64_t)in->u[1]);
-
- oh = th >> (shift * 8);
- ol = tl >> (shift * 8);
- ol |= th << (64 - shift * 8);
- out->u[0] = (uint32_t)(ol >> 32);
- out->u[1] = (uint32_t)ol;
- out->u[2] = (uint32_t)(oh >> 32);
- out->u[3] = (uint32_t)oh;
-}
-#else
-JEMALLOC_INLINE_C void rshift128(w128_t *out, w128_t const *in, int shift) {
- uint64_t th, tl, oh, ol;
-
- th = ((uint64_t)in->u[3] << 32) | ((uint64_t)in->u[2]);
- tl = ((uint64_t)in->u[1] << 32) | ((uint64_t)in->u[0]);
-
- oh = th >> (shift * 8);
- ol = tl >> (shift * 8);
- ol |= th << (64 - shift * 8);
- out->u[1] = (uint32_t)(ol >> 32);
- out->u[0] = (uint32_t)ol;
- out->u[3] = (uint32_t)(oh >> 32);
- out->u[2] = (uint32_t)oh;
-}
-#endif
-/**
- * This function simulates SIMD 128-bit left shift by the standard C.
- * The 128-bit integer given in in is shifted by (shift * 8) bits.
- * This function simulates the LITTLE ENDIAN SIMD.
- * @param out the output of this function
- * @param in the 128-bit data to be shifted
- * @param shift the shift value
- */
-#ifdef ONLY64
-JEMALLOC_INLINE_C void lshift128(w128_t *out, w128_t const *in, int shift) {
- uint64_t th, tl, oh, ol;
-
- th = ((uint64_t)in->u[2] << 32) | ((uint64_t)in->u[3]);
- tl = ((uint64_t)in->u[0] << 32) | ((uint64_t)in->u[1]);
-
- oh = th << (shift * 8);
- ol = tl << (shift * 8);
- oh |= tl >> (64 - shift * 8);
- out->u[0] = (uint32_t)(ol >> 32);
- out->u[1] = (uint32_t)ol;
- out->u[2] = (uint32_t)(oh >> 32);
- out->u[3] = (uint32_t)oh;
-}
-#else
-JEMALLOC_INLINE_C void lshift128(w128_t *out, w128_t const *in, int shift) {
- uint64_t th, tl, oh, ol;
-
- th = ((uint64_t)in->u[3] << 32) | ((uint64_t)in->u[2]);
- tl = ((uint64_t)in->u[1] << 32) | ((uint64_t)in->u[0]);
-
- oh = th << (shift * 8);
- ol = tl << (shift * 8);
- oh |= tl >> (64 - shift * 8);
- out->u[1] = (uint32_t)(ol >> 32);
- out->u[0] = (uint32_t)ol;
- out->u[3] = (uint32_t)(oh >> 32);
- out->u[2] = (uint32_t)oh;
-}
-#endif
-#endif
-
-/**
- * This function represents the recursion formula.
- * @param r output
- * @param a a 128-bit part of the internal state array
- * @param b a 128-bit part of the internal state array
- * @param c a 128-bit part of the internal state array
- * @param d a 128-bit part of the internal state array
- */
-#if (!defined(HAVE_ALTIVEC)) && (!defined(HAVE_SSE2))
-#ifdef ONLY64
-JEMALLOC_INLINE_C void do_recursion(w128_t *r, w128_t *a, w128_t *b, w128_t *c,
- w128_t *d) {
- w128_t x;
- w128_t y;
-
- lshift128(&x, a, SL2);
- rshift128(&y, c, SR2);
- r->u[0] = a->u[0] ^ x.u[0] ^ ((b->u[0] >> SR1) & MSK2) ^ y.u[0]
- ^ (d->u[0] << SL1);
- r->u[1] = a->u[1] ^ x.u[1] ^ ((b->u[1] >> SR1) & MSK1) ^ y.u[1]
- ^ (d->u[1] << SL1);
- r->u[2] = a->u[2] ^ x.u[2] ^ ((b->u[2] >> SR1) & MSK4) ^ y.u[2]
- ^ (d->u[2] << SL1);
- r->u[3] = a->u[3] ^ x.u[3] ^ ((b->u[3] >> SR1) & MSK3) ^ y.u[3]
- ^ (d->u[3] << SL1);
-}
-#else
-JEMALLOC_INLINE_C void do_recursion(w128_t *r, w128_t *a, w128_t *b, w128_t *c,
- w128_t *d) {
- w128_t x;
- w128_t y;
-
- lshift128(&x, a, SL2);
- rshift128(&y, c, SR2);
- r->u[0] = a->u[0] ^ x.u[0] ^ ((b->u[0] >> SR1) & MSK1) ^ y.u[0]
- ^ (d->u[0] << SL1);
- r->u[1] = a->u[1] ^ x.u[1] ^ ((b->u[1] >> SR1) & MSK2) ^ y.u[1]
- ^ (d->u[1] << SL1);
- r->u[2] = a->u[2] ^ x.u[2] ^ ((b->u[2] >> SR1) & MSK3) ^ y.u[2]
- ^ (d->u[2] << SL1);
- r->u[3] = a->u[3] ^ x.u[3] ^ ((b->u[3] >> SR1) & MSK4) ^ y.u[3]
- ^ (d->u[3] << SL1);
-}
-#endif
-#endif
-
-#if (!defined(HAVE_ALTIVEC)) && (!defined(HAVE_SSE2))
-/**
- * This function fills the internal state array with pseudorandom
- * integers.
- */
-JEMALLOC_INLINE_C void gen_rand_all(sfmt_t *ctx) {
- int i;
- w128_t *r1, *r2;
-
- r1 = &ctx->sfmt[N - 2];
- r2 = &ctx->sfmt[N - 1];
- for (i = 0; i < N - POS1; i++) {
- do_recursion(&ctx->sfmt[i], &ctx->sfmt[i], &ctx->sfmt[i + POS1], r1,
- r2);
- r1 = r2;
- r2 = &ctx->sfmt[i];
- }
- for (; i < N; i++) {
- do_recursion(&ctx->sfmt[i], &ctx->sfmt[i], &ctx->sfmt[i + POS1 - N], r1,
- r2);
- r1 = r2;
- r2 = &ctx->sfmt[i];
- }
-}
-
-/**
- * This function fills the user-specified array with pseudorandom
- * integers.
- *
- * @param array an 128-bit array to be filled by pseudorandom numbers.
- * @param size number of 128-bit pseudorandom numbers to be generated.
- */
-JEMALLOC_INLINE_C void gen_rand_array(sfmt_t *ctx, w128_t *array, int size) {
- int i, j;
- w128_t *r1, *r2;
-
- r1 = &ctx->sfmt[N - 2];
- r2 = &ctx->sfmt[N - 1];
- for (i = 0; i < N - POS1; i++) {
- do_recursion(&array[i], &ctx->sfmt[i], &ctx->sfmt[i + POS1], r1, r2);
- r1 = r2;
- r2 = &array[i];
- }
- for (; i < N; i++) {
- do_recursion(&array[i], &ctx->sfmt[i], &array[i + POS1 - N], r1, r2);
- r1 = r2;
- r2 = &array[i];
- }
- for (; i < size - N; i++) {
- do_recursion(&array[i], &array[i - N], &array[i + POS1 - N], r1, r2);
- r1 = r2;
- r2 = &array[i];
- }
- for (j = 0; j < 2 * N - size; j++) {
- ctx->sfmt[j] = array[j + size - N];
- }
- for (; i < size; i++, j++) {
- do_recursion(&array[i], &array[i - N], &array[i + POS1 - N], r1, r2);
- r1 = r2;
- r2 = &array[i];
- ctx->sfmt[j] = array[i];
- }
-}
-#endif
-
-#if defined(BIG_ENDIAN64) && !defined(ONLY64) && !defined(HAVE_ALTIVEC)
-JEMALLOC_INLINE_C void swap(w128_t *array, int size) {
- int i;
- uint32_t x, y;
-
- for (i = 0; i < size; i++) {
- x = array[i].u[0];
- y = array[i].u[2];
- array[i].u[0] = array[i].u[1];
- array[i].u[2] = array[i].u[3];
- array[i].u[1] = x;
- array[i].u[3] = y;
- }
-}
-#endif
-/**
- * This function represents a function used in the initialization
- * by init_by_array
- * @param x 32-bit integer
- * @return 32-bit integer
- */
-static uint32_t func1(uint32_t x) {
- return (x ^ (x >> 27)) * (uint32_t)1664525UL;
-}
-
-/**
- * This function represents a function used in the initialization
- * by init_by_array
- * @param x 32-bit integer
- * @return 32-bit integer
- */
-static uint32_t func2(uint32_t x) {
- return (x ^ (x >> 27)) * (uint32_t)1566083941UL;
-}
-
-/**
- * This function certificate the period of 2^{MEXP}
- */
-static void period_certification(sfmt_t *ctx) {
- int inner = 0;
- int i, j;
- uint32_t work;
- uint32_t *psfmt32 = &ctx->sfmt[0].u[0];
-
- for (i = 0; i < 4; i++)
- inner ^= psfmt32[idxof(i)] & parity[i];
- for (i = 16; i > 0; i >>= 1)
- inner ^= inner >> i;
- inner &= 1;
- /* check OK */
- if (inner == 1) {
- return;
- }
- /* check NG, and modification */
- for (i = 0; i < 4; i++) {
- work = 1;
- for (j = 0; j < 32; j++) {
- if ((work & parity[i]) != 0) {
- psfmt32[idxof(i)] ^= work;
- return;
- }
- work = work << 1;
- }
- }
-}
-
-/*----------------
- PUBLIC FUNCTIONS
- ----------------*/
-/**
- * This function returns the identification string.
- * The string shows the word size, the Mersenne exponent,
- * and all parameters of this generator.
- */
-const char *get_idstring(void) {
- return IDSTR;
-}
-
-/**
- * This function returns the minimum size of array used for \b
- * fill_array32() function.
- * @return minimum size of array used for fill_array32() function.
- */
-int get_min_array_size32(void) {
- return N32;
-}
-
-/**
- * This function returns the minimum size of array used for \b
- * fill_array64() function.
- * @return minimum size of array used for fill_array64() function.
- */
-int get_min_array_size64(void) {
- return N64;
-}
-
-#ifndef ONLY64
-/**
- * This function generates and returns 32-bit pseudorandom number.
- * init_gen_rand or init_by_array must be called before this function.
- * @return 32-bit pseudorandom number
- */
-uint32_t gen_rand32(sfmt_t *ctx) {
- uint32_t r;
- uint32_t *psfmt32 = &ctx->sfmt[0].u[0];
-
- assert(ctx->initialized);
- if (ctx->idx >= N32) {
- gen_rand_all(ctx);
- ctx->idx = 0;
- }
- r = psfmt32[ctx->idx++];
- return r;
-}
-
-/* Generate a random integer in [0..limit). */
-uint32_t gen_rand32_range(sfmt_t *ctx, uint32_t limit) {
- uint32_t ret, above;
-
- above = 0xffffffffU - (0xffffffffU % limit);
- while (1) {
- ret = gen_rand32(ctx);
- if (ret < above) {
- ret %= limit;
- break;
- }
- }
- return ret;
-}
-#endif
-/**
- * This function generates and returns 64-bit pseudorandom number.
- * init_gen_rand or init_by_array must be called before this function.
- * The function gen_rand64 should not be called after gen_rand32,
- * unless an initialization is again executed.
- * @return 64-bit pseudorandom number
- */
-uint64_t gen_rand64(sfmt_t *ctx) {
-#if defined(BIG_ENDIAN64) && !defined(ONLY64)
- uint32_t r1, r2;
- uint32_t *psfmt32 = &ctx->sfmt[0].u[0];
-#else
- uint64_t r;
- uint64_t *psfmt64 = (uint64_t *)&ctx->sfmt[0].u[0];
-#endif
-
- assert(ctx->initialized);
- assert(ctx->idx % 2 == 0);
-
- if (ctx->idx >= N32) {
- gen_rand_all(ctx);
- ctx->idx = 0;
- }
-#if defined(BIG_ENDIAN64) && !defined(ONLY64)
- r1 = psfmt32[ctx->idx];
- r2 = psfmt32[ctx->idx + 1];
- ctx->idx += 2;
- return ((uint64_t)r2 << 32) | r1;
-#else
- r = psfmt64[ctx->idx / 2];
- ctx->idx += 2;
- return r;
-#endif
-}
-
-/* Generate a random integer in [0..limit). */
-uint64_t gen_rand64_range(sfmt_t *ctx, uint64_t limit) {
- uint64_t ret, above;
-
- above = KQU(0xffffffffffffffff) - (KQU(0xffffffffffffffff) % limit);
- while (1) {
- ret = gen_rand64(ctx);
- if (ret < above) {
- ret %= limit;
- break;
- }
- }
- return ret;
-}
-
-#ifndef ONLY64
-/**
- * This function generates pseudorandom 32-bit integers in the
- * specified array[] by one call. The number of pseudorandom integers
- * is specified by the argument size, which must be at least 624 and a
- * multiple of four. The generation by this function is much faster
- * than the following gen_rand function.
- *
- * For initialization, init_gen_rand or init_by_array must be called
- * before the first call of this function. This function can not be
- * used after calling gen_rand function, without initialization.
- *
- * @param array an array where pseudorandom 32-bit integers are filled
- * by this function. The pointer to the array must be \b "aligned"
- * (namely, must be a multiple of 16) in the SIMD version, since it
- * refers to the address of a 128-bit integer. In the standard C
- * version, the pointer is arbitrary.
- *
- * @param size the number of 32-bit pseudorandom integers to be
- * generated. size must be a multiple of 4, and greater than or equal
- * to (MEXP / 128 + 1) * 4.
- *
- * @note \b memalign or \b posix_memalign is available to get aligned
- * memory. Mac OSX doesn't have these functions, but \b malloc of OSX
- * returns the pointer to the aligned memory block.
- */
-void fill_array32(sfmt_t *ctx, uint32_t *array, int size) {
- assert(ctx->initialized);
- assert(ctx->idx == N32);
- assert(size % 4 == 0);
- assert(size >= N32);
-
- gen_rand_array(ctx, (w128_t *)array, size / 4);
- ctx->idx = N32;
-}
-#endif
-
-/**
- * This function generates pseudorandom 64-bit integers in the
- * specified array[] by one call. The number of pseudorandom integers
- * is specified by the argument size, which must be at least 312 and a
- * multiple of two. The generation by this function is much faster
- * than the following gen_rand function.
- *
- * For initialization, init_gen_rand or init_by_array must be called
- * before the first call of this function. This function can not be
- * used after calling gen_rand function, without initialization.
- *
- * @param array an array where pseudorandom 64-bit integers are filled
- * by this function. The pointer to the array must be "aligned"
- * (namely, must be a multiple of 16) in the SIMD version, since it
- * refers to the address of a 128-bit integer. In the standard C
- * version, the pointer is arbitrary.
- *
- * @param size the number of 64-bit pseudorandom integers to be
- * generated. size must be a multiple of 2, and greater than or equal
- * to (MEXP / 128 + 1) * 2
- *
- * @note \b memalign or \b posix_memalign is available to get aligned
- * memory. Mac OSX doesn't have these functions, but \b malloc of OSX
- * returns the pointer to the aligned memory block.
- */
-void fill_array64(sfmt_t *ctx, uint64_t *array, int size) {
- assert(ctx->initialized);
- assert(ctx->idx == N32);
- assert(size % 2 == 0);
- assert(size >= N64);
-
- gen_rand_array(ctx, (w128_t *)array, size / 2);
- ctx->idx = N32;
-
-#if defined(BIG_ENDIAN64) && !defined(ONLY64)
- swap((w128_t *)array, size /2);
-#endif
-}
-
-/**
- * This function initializes the internal state array with a 32-bit
- * integer seed.
- *
- * @param seed a 32-bit integer used as the seed.
- */
-sfmt_t *init_gen_rand(uint32_t seed) {
- void *p;
- sfmt_t *ctx;
- int i;
- uint32_t *psfmt32;
-
- if (posix_memalign(&p, sizeof(w128_t), sizeof(sfmt_t)) != 0) {
- return NULL;
- }
- ctx = (sfmt_t *)p;
- psfmt32 = &ctx->sfmt[0].u[0];
-
- psfmt32[idxof(0)] = seed;
- for (i = 1; i < N32; i++) {
- psfmt32[idxof(i)] = 1812433253UL * (psfmt32[idxof(i - 1)]
- ^ (psfmt32[idxof(i - 1)] >> 30))
- + i;
- }
- ctx->idx = N32;
- period_certification(ctx);
- ctx->initialized = 1;
-
- return ctx;
-}
-
-/**
- * This function initializes the internal state array,
- * with an array of 32-bit integers used as the seeds
- * @param init_key the array of 32-bit integers, used as a seed.
- * @param key_length the length of init_key.
- */
-sfmt_t *init_by_array(uint32_t *init_key, int key_length) {
- void *p;
- sfmt_t *ctx;
- int i, j, count;
- uint32_t r;
- int lag;
- int mid;
- int size = N * 4;
- uint32_t *psfmt32;
-
- if (posix_memalign(&p, sizeof(w128_t), sizeof(sfmt_t)) != 0) {
- return NULL;
- }
- ctx = (sfmt_t *)p;
- psfmt32 = &ctx->sfmt[0].u[0];
-
- if (size >= 623) {
- lag = 11;
- } else if (size >= 68) {
- lag = 7;
- } else if (size >= 39) {
- lag = 5;
- } else {
- lag = 3;
- }
- mid = (size - lag) / 2;
-
- memset(ctx->sfmt, 0x8b, sizeof(ctx->sfmt));
- if (key_length + 1 > N32) {
- count = key_length + 1;
- } else {
- count = N32;
- }
- r = func1(psfmt32[idxof(0)] ^ psfmt32[idxof(mid)]
- ^ psfmt32[idxof(N32 - 1)]);
- psfmt32[idxof(mid)] += r;
- r += key_length;
- psfmt32[idxof(mid + lag)] += r;
- psfmt32[idxof(0)] = r;
-
- count--;
- for (i = 1, j = 0; (j < count) && (j < key_length); j++) {
- r = func1(psfmt32[idxof(i)] ^ psfmt32[idxof((i + mid) % N32)]
- ^ psfmt32[idxof((i + N32 - 1) % N32)]);
- psfmt32[idxof((i + mid) % N32)] += r;
- r += init_key[j] + i;
- psfmt32[idxof((i + mid + lag) % N32)] += r;
- psfmt32[idxof(i)] = r;
- i = (i + 1) % N32;
- }
- for (; j < count; j++) {
- r = func1(psfmt32[idxof(i)] ^ psfmt32[idxof((i + mid) % N32)]
- ^ psfmt32[idxof((i + N32 - 1) % N32)]);
- psfmt32[idxof((i + mid) % N32)] += r;
- r += i;
- psfmt32[idxof((i + mid + lag) % N32)] += r;
- psfmt32[idxof(i)] = r;
- i = (i + 1) % N32;
- }
- for (j = 0; j < N32; j++) {
- r = func2(psfmt32[idxof(i)] + psfmt32[idxof((i + mid) % N32)]
- + psfmt32[idxof((i + N32 - 1) % N32)]);
- psfmt32[idxof((i + mid) % N32)] ^= r;
- r -= i;
- psfmt32[idxof((i + mid + lag) % N32)] ^= r;
- psfmt32[idxof(i)] = r;
- i = (i + 1) % N32;
- }
-
- ctx->idx = N32;
- period_certification(ctx);
- ctx->initialized = 1;
-
- return ctx;
-}
-
-void fini_gen_rand(sfmt_t *ctx) {
- assert(ctx != NULL);
-
- ctx->initialized = 0;
- free(ctx);
-}
diff --git a/memory/jemalloc/src/test/src/btalloc.c b/memory/jemalloc/src/test/src/btalloc.c
deleted file mode 100644
index 9a253d9784..0000000000
--- a/memory/jemalloc/src/test/src/btalloc.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#include "test/jemalloc_test.h"
-
-void *
-btalloc(size_t size, unsigned bits)
-{
-
- return (btalloc_0(size, bits));
-}
diff --git a/memory/jemalloc/src/test/src/btalloc_0.c b/memory/jemalloc/src/test/src/btalloc_0.c
deleted file mode 100644
index 77d8904ea9..0000000000
--- a/memory/jemalloc/src/test/src/btalloc_0.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "test/jemalloc_test.h"
-
-btalloc_n_gen(0)
diff --git a/memory/jemalloc/src/test/src/btalloc_1.c b/memory/jemalloc/src/test/src/btalloc_1.c
deleted file mode 100644
index 4c126c309d..0000000000
--- a/memory/jemalloc/src/test/src/btalloc_1.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#include "test/jemalloc_test.h"
-
-btalloc_n_gen(1)
diff --git a/memory/jemalloc/src/test/src/math.c b/memory/jemalloc/src/test/src/math.c
deleted file mode 100644
index 887a36390e..0000000000
--- a/memory/jemalloc/src/test/src/math.c
+++ /dev/null
@@ -1,2 +0,0 @@
-#define MATH_C_
-#include "test/jemalloc_test.h"
diff --git a/memory/jemalloc/src/test/src/mq.c b/memory/jemalloc/src/test/src/mq.c
deleted file mode 100644
index 40b31c15c7..0000000000
--- a/memory/jemalloc/src/test/src/mq.c
+++ /dev/null
@@ -1,29 +0,0 @@
-#include "test/jemalloc_test.h"
-
-/*
- * Sleep for approximately ns nanoseconds. No lower *nor* upper bound on sleep
- * time is guaranteed.
- */
-void
-mq_nanosleep(unsigned ns)
-{
-
- assert(ns <= 1000*1000*1000);
-
-#ifdef _WIN32
- Sleep(ns / 1000);
-#else
- {
- struct timespec timeout;
-
- if (ns < 1000*1000*1000) {
- timeout.tv_sec = 0;
- timeout.tv_nsec = ns;
- } else {
- timeout.tv_sec = 1;
- timeout.tv_nsec = 0;
- }
- nanosleep(&timeout, NULL);
- }
-#endif
-}
diff --git a/memory/jemalloc/src/test/src/mtx.c b/memory/jemalloc/src/test/src/mtx.c
deleted file mode 100644
index 8a5dfdd998..0000000000
--- a/memory/jemalloc/src/test/src/mtx.c
+++ /dev/null
@@ -1,73 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#ifndef _CRT_SPINCOUNT
-#define _CRT_SPINCOUNT 4000
-#endif
-
-bool
-mtx_init(mtx_t *mtx)
-{
-
-#ifdef _WIN32
- if (!InitializeCriticalSectionAndSpinCount(&mtx->lock, _CRT_SPINCOUNT))
- return (true);
-#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
- mtx->lock = OS_UNFAIR_LOCK_INIT;
-#elif (defined(JEMALLOC_OSSPIN))
- mtx->lock = 0;
-#else
- pthread_mutexattr_t attr;
-
- if (pthread_mutexattr_init(&attr) != 0)
- return (true);
- pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_DEFAULT);
- if (pthread_mutex_init(&mtx->lock, &attr) != 0) {
- pthread_mutexattr_destroy(&attr);
- return (true);
- }
- pthread_mutexattr_destroy(&attr);
-#endif
- return (false);
-}
-
-void
-mtx_fini(mtx_t *mtx)
-{
-
-#ifdef _WIN32
-#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
-#elif (defined(JEMALLOC_OSSPIN))
-#else
- pthread_mutex_destroy(&mtx->lock);
-#endif
-}
-
-void
-mtx_lock(mtx_t *mtx)
-{
-
-#ifdef _WIN32
- EnterCriticalSection(&mtx->lock);
-#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
- os_unfair_lock_lock(&mtx->lock);
-#elif (defined(JEMALLOC_OSSPIN))
- OSSpinLockLock(&mtx->lock);
-#else
- pthread_mutex_lock(&mtx->lock);
-#endif
-}
-
-void
-mtx_unlock(mtx_t *mtx)
-{
-
-#ifdef _WIN32
- LeaveCriticalSection(&mtx->lock);
-#elif (defined(JEMALLOC_OS_UNFAIR_LOCK))
- os_unfair_lock_unlock(&mtx->lock);
-#elif (defined(JEMALLOC_OSSPIN))
- OSSpinLockUnlock(&mtx->lock);
-#else
- pthread_mutex_unlock(&mtx->lock);
-#endif
-}
diff --git a/memory/jemalloc/src/test/src/test.c b/memory/jemalloc/src/test/src/test.c
deleted file mode 100644
index d70cc75015..0000000000
--- a/memory/jemalloc/src/test/src/test.c
+++ /dev/null
@@ -1,133 +0,0 @@
-#include "test/jemalloc_test.h"
-
-static unsigned test_count = 0;
-static test_status_t test_counts[test_status_count] = {0, 0, 0};
-static test_status_t test_status = test_status_pass;
-static const char * test_name = "";
-
-JEMALLOC_FORMAT_PRINTF(1, 2)
-void
-test_skip(const char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
- malloc_vcprintf(NULL, NULL, format, ap);
- va_end(ap);
- malloc_printf("\n");
- test_status = test_status_skip;
-}
-
-JEMALLOC_FORMAT_PRINTF(1, 2)
-void
-test_fail(const char *format, ...)
-{
- va_list ap;
-
- va_start(ap, format);
- malloc_vcprintf(NULL, NULL, format, ap);
- va_end(ap);
- malloc_printf("\n");
- test_status = test_status_fail;
-}
-
-static const char *
-test_status_string(test_status_t test_status)
-{
-
- switch (test_status) {
- case test_status_pass: return "pass";
- case test_status_skip: return "skip";
- case test_status_fail: return "fail";
- default: not_reached();
- }
-}
-
-void
-p_test_init(const char *name)
-{
-
- test_count++;
- test_status = test_status_pass;
- test_name = name;
-}
-
-void
-p_test_fini(void)
-{
-
- test_counts[test_status]++;
- malloc_printf("%s: %s\n", test_name, test_status_string(test_status));
-}
-
-static test_status_t
-p_test_impl(bool do_malloc_init, test_t *t, va_list ap)
-{
- test_status_t ret;
-
- if (do_malloc_init) {
- /*
- * Make sure initialization occurs prior to running tests.
- * Tests are special because they may use internal facilities
- * prior to triggering initialization as a side effect of
- * calling into the public API.
- */
- if (nallocx(1, 0) == 0) {
- malloc_printf("Initialization error");
- return (test_status_fail);
- }
- }
-
- ret = test_status_pass;
- for (; t != NULL; t = va_arg(ap, test_t *)) {
- t();
- if (test_status > ret)
- ret = test_status;
- }
-
- malloc_printf("--- %s: %u/%u, %s: %u/%u, %s: %u/%u ---\n",
- test_status_string(test_status_pass),
- test_counts[test_status_pass], test_count,
- test_status_string(test_status_skip),
- test_counts[test_status_skip], test_count,
- test_status_string(test_status_fail),
- test_counts[test_status_fail], test_count);
-
- return (ret);
-}
-
-test_status_t
-p_test(test_t *t, ...)
-{
- test_status_t ret;
- va_list ap;
-
- ret = test_status_pass;
- va_start(ap, t);
- ret = p_test_impl(true, t, ap);
- va_end(ap);
-
- return (ret);
-}
-
-test_status_t
-p_test_no_malloc_init(test_t *t, ...)
-{
- test_status_t ret;
- va_list ap;
-
- ret = test_status_pass;
- va_start(ap, t);
- ret = p_test_impl(false, t, ap);
- va_end(ap);
-
- return (ret);
-}
-
-void
-p_test_fail(const char *prefix, const char *message)
-{
-
- malloc_cprintf(NULL, NULL, "%s%s\n", prefix, message);
- test_status = test_status_fail;
-}
diff --git a/memory/jemalloc/src/test/src/thd.c b/memory/jemalloc/src/test/src/thd.c
deleted file mode 100644
index c9d0065869..0000000000
--- a/memory/jemalloc/src/test/src/thd.c
+++ /dev/null
@@ -1,39 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#ifdef _WIN32
-void
-thd_create(thd_t *thd, void *(*proc)(void *), void *arg)
-{
- LPTHREAD_START_ROUTINE routine = (LPTHREAD_START_ROUTINE)proc;
- *thd = CreateThread(NULL, 0, routine, arg, 0, NULL);
- if (*thd == NULL)
- test_fail("Error in CreateThread()\n");
-}
-
-void
-thd_join(thd_t thd, void **ret)
-{
-
- if (WaitForSingleObject(thd, INFINITE) == WAIT_OBJECT_0 && ret) {
- DWORD exit_code;
- GetExitCodeThread(thd, (LPDWORD) &exit_code);
- *ret = (void *)(uintptr_t)exit_code;
- }
-}
-
-#else
-void
-thd_create(thd_t *thd, void *(*proc)(void *), void *arg)
-{
-
- if (pthread_create(thd, NULL, proc, arg) != 0)
- test_fail("Error in pthread_create()\n");
-}
-
-void
-thd_join(thd_t thd, void **ret)
-{
-
- pthread_join(thd, ret);
-}
-#endif
diff --git a/memory/jemalloc/src/test/src/timer.c b/memory/jemalloc/src/test/src/timer.c
deleted file mode 100644
index 3c7e63a26f..0000000000
--- a/memory/jemalloc/src/test/src/timer.c
+++ /dev/null
@@ -1,60 +0,0 @@
-#include "test/jemalloc_test.h"
-
-void
-timer_start(timedelta_t *timer)
-{
-
- nstime_init(&timer->t0, 0);
- nstime_update(&timer->t0);
-}
-
-void
-timer_stop(timedelta_t *timer)
-{
-
- nstime_copy(&timer->t1, &timer->t0);
- nstime_update(&timer->t1);
-}
-
-uint64_t
-timer_usec(const timedelta_t *timer)
-{
- nstime_t delta;
-
- nstime_copy(&delta, &timer->t1);
- nstime_subtract(&delta, &timer->t0);
- return (nstime_ns(&delta) / 1000);
-}
-
-void
-timer_ratio(timedelta_t *a, timedelta_t *b, char *buf, size_t buflen)
-{
- uint64_t t0 = timer_usec(a);
- uint64_t t1 = timer_usec(b);
- uint64_t mult;
- size_t i = 0;
- size_t j, n;
-
- /* Whole. */
- n = malloc_snprintf(&buf[i], buflen-i, "%"FMTu64, t0 / t1);
- i += n;
- if (i >= buflen)
- return;
- mult = 1;
- for (j = 0; j < n; j++)
- mult *= 10;
-
- /* Decimal. */
- n = malloc_snprintf(&buf[i], buflen-i, ".");
- i += n;
-
- /* Fraction. */
- while (i < buflen-1) {
- uint64_t round = (i+1 == buflen-1 && ((t0 * mult * 10 / t1) % 10
- >= 5)) ? 1 : 0;
- n = malloc_snprintf(&buf[i], buflen-i,
- "%"FMTu64, (t0 * mult / t1) % 10 + round);
- i += n;
- mult *= 10;
- }
-}
diff --git a/memory/jemalloc/src/test/stress/microbench.c b/memory/jemalloc/src/test/stress/microbench.c
deleted file mode 100644
index 7dc45f89cb..0000000000
--- a/memory/jemalloc/src/test/stress/microbench.c
+++ /dev/null
@@ -1,182 +0,0 @@
-#include "test/jemalloc_test.h"
-
-JEMALLOC_INLINE_C void
-time_func(timedelta_t *timer, uint64_t nwarmup, uint64_t niter,
- void (*func)(void))
-{
- uint64_t i;
-
- for (i = 0; i < nwarmup; i++)
- func();
- timer_start(timer);
- for (i = 0; i < niter; i++)
- func();
- timer_stop(timer);
-}
-
-void
-compare_funcs(uint64_t nwarmup, uint64_t niter, const char *name_a,
- void (*func_a), const char *name_b, void (*func_b))
-{
- timedelta_t timer_a, timer_b;
- char ratio_buf[6];
- void *p;
-
- p = mallocx(1, 0);
- if (p == NULL) {
- test_fail("Unexpected mallocx() failure");
- return;
- }
-
- time_func(&timer_a, nwarmup, niter, func_a);
- time_func(&timer_b, nwarmup, niter, func_b);
-
- timer_ratio(&timer_a, &timer_b, ratio_buf, sizeof(ratio_buf));
- malloc_printf("%"FMTu64" iterations, %s=%"FMTu64"us, "
- "%s=%"FMTu64"us, ratio=1:%s\n",
- niter, name_a, timer_usec(&timer_a), name_b, timer_usec(&timer_b),
- ratio_buf);
-
- dallocx(p, 0);
-}
-
-static void
-malloc_free(void)
-{
- /* The compiler can optimize away free(malloc(1))! */
- void *p = malloc(1);
- if (p == NULL) {
- test_fail("Unexpected malloc() failure");
- return;
- }
- free(p);
-}
-
-static void
-mallocx_free(void)
-{
- void *p = mallocx(1, 0);
- if (p == NULL) {
- test_fail("Unexpected mallocx() failure");
- return;
- }
- free(p);
-}
-
-TEST_BEGIN(test_malloc_vs_mallocx)
-{
-
- compare_funcs(10*1000*1000, 100*1000*1000, "malloc",
- malloc_free, "mallocx", mallocx_free);
-}
-TEST_END
-
-static void
-malloc_dallocx(void)
-{
- void *p = malloc(1);
- if (p == NULL) {
- test_fail("Unexpected malloc() failure");
- return;
- }
- dallocx(p, 0);
-}
-
-static void
-malloc_sdallocx(void)
-{
- void *p = malloc(1);
- if (p == NULL) {
- test_fail("Unexpected malloc() failure");
- return;
- }
- sdallocx(p, 1, 0);
-}
-
-TEST_BEGIN(test_free_vs_dallocx)
-{
-
- compare_funcs(10*1000*1000, 100*1000*1000, "free", malloc_free,
- "dallocx", malloc_dallocx);
-}
-TEST_END
-
-TEST_BEGIN(test_dallocx_vs_sdallocx)
-{
-
- compare_funcs(10*1000*1000, 100*1000*1000, "dallocx", malloc_dallocx,
- "sdallocx", malloc_sdallocx);
-}
-TEST_END
-
-static void
-malloc_mus_free(void)
-{
- void *p;
-
- p = malloc(1);
- if (p == NULL) {
- test_fail("Unexpected malloc() failure");
- return;
- }
- malloc_usable_size(p);
- free(p);
-}
-
-static void
-malloc_sallocx_free(void)
-{
- void *p;
-
- p = malloc(1);
- if (p == NULL) {
- test_fail("Unexpected malloc() failure");
- return;
- }
- if (sallocx(p, 0) < 1)
- test_fail("Unexpected sallocx() failure");
- free(p);
-}
-
-TEST_BEGIN(test_mus_vs_sallocx)
-{
-
- compare_funcs(10*1000*1000, 100*1000*1000, "malloc_usable_size",
- malloc_mus_free, "sallocx", malloc_sallocx_free);
-}
-TEST_END
-
-static void
-malloc_nallocx_free(void)
-{
- void *p;
-
- p = malloc(1);
- if (p == NULL) {
- test_fail("Unexpected malloc() failure");
- return;
- }
- if (nallocx(1, 0) < 1)
- test_fail("Unexpected nallocx() failure");
- free(p);
-}
-
-TEST_BEGIN(test_sallocx_vs_nallocx)
-{
-
- compare_funcs(10*1000*1000, 100*1000*1000, "sallocx",
- malloc_sallocx_free, "nallocx", malloc_nallocx_free);
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_malloc_vs_mallocx,
- test_free_vs_dallocx,
- test_dallocx_vs_sdallocx,
- test_mus_vs_sallocx,
- test_sallocx_vs_nallocx));
-}
diff --git a/memory/jemalloc/src/test/test.sh.in b/memory/jemalloc/src/test/test.sh.in
deleted file mode 100644
index a39f99f6b5..0000000000
--- a/memory/jemalloc/src/test/test.sh.in
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/bin/sh
-
-case @abi@ in
- macho)
- export DYLD_FALLBACK_LIBRARY_PATH="@objroot@lib"
- ;;
- pecoff)
- export PATH="${PATH}:@objroot@lib"
- ;;
- *)
- ;;
-esac
-
-# Corresponds to test_status_t.
-pass_code=0
-skip_code=1
-fail_code=2
-
-pass_count=0
-skip_count=0
-fail_count=0
-for t in $@; do
- if [ $pass_count -ne 0 -o $skip_count -ne 0 -o $fail_count != 0 ] ; then
- echo
- fi
- echo "=== ${t} ==="
- ${t}@exe@ @abs_srcroot@ @abs_objroot@
- result_code=$?
- case ${result_code} in
- ${pass_code})
- pass_count=$((pass_count+1))
- ;;
- ${skip_code})
- skip_count=$((skip_count+1))
- ;;
- ${fail_code})
- fail_count=$((fail_count+1))
- ;;
- *)
- echo "Test harness error" 1>&2
- exit 1
- esac
-done
-
-total_count=`expr ${pass_count} + ${skip_count} + ${fail_count}`
-echo
-echo "Test suite summary: pass: ${pass_count}/${total_count}, skip: ${skip_count}/${total_count}, fail: ${fail_count}/${total_count}"
-
-if [ ${fail_count} -eq 0 ] ; then
- exit 0
-else
- exit 1
-fi
diff --git a/memory/jemalloc/src/test/unit/SFMT.c b/memory/jemalloc/src/test/unit/SFMT.c
deleted file mode 100644
index ba4be8702e..0000000000
--- a/memory/jemalloc/src/test/unit/SFMT.c
+++ /dev/null
@@ -1,1605 +0,0 @@
-/*
- * This file derives from SFMT 1.3.3
- * (http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/SFMT/index.html), which was
- * released under the terms of the following license:
- *
- * Copyright (c) 2006,2007 Mutsuo Saito, Makoto Matsumoto and Hiroshima
- * University. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are
- * met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above
- * copyright notice, this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided
- * with the distribution.
- * * Neither the name of the Hiroshima University nor the names of
- * its contributors may be used to endorse or promote products
- * derived from this software without specific prior written
- * permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
- * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
- * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-#include "test/jemalloc_test.h"
-
-#define BLOCK_SIZE 10000
-#define BLOCK_SIZE64 (BLOCK_SIZE / 2)
-#define COUNT_1 1000
-#define COUNT_2 700
-
-static const uint32_t init_gen_rand_32_expected[] = {
- 3440181298U, 1564997079U, 1510669302U, 2930277156U, 1452439940U,
- 3796268453U, 423124208U, 2143818589U, 3827219408U, 2987036003U,
- 2674978610U, 1536842514U, 2027035537U, 2534897563U, 1686527725U,
- 545368292U, 1489013321U, 1370534252U, 4231012796U, 3994803019U,
- 1764869045U, 824597505U, 862581900U, 2469764249U, 812862514U,
- 359318673U, 116957936U, 3367389672U, 2327178354U, 1898245200U,
- 3206507879U, 2378925033U, 1040214787U, 2524778605U, 3088428700U,
- 1417665896U, 964324147U, 2282797708U, 2456269299U, 313400376U,
- 2245093271U, 1015729427U, 2694465011U, 3246975184U, 1992793635U,
- 463679346U, 3721104591U, 3475064196U, 856141236U, 1499559719U,
- 3522818941U, 3721533109U, 1954826617U, 1282044024U, 1543279136U,
- 1301863085U, 2669145051U, 4221477354U, 3896016841U, 3392740262U,
- 462466863U, 1037679449U, 1228140306U, 922298197U, 1205109853U,
- 1872938061U, 3102547608U, 2742766808U, 1888626088U, 4028039414U,
- 157593879U, 1136901695U, 4038377686U, 3572517236U, 4231706728U,
- 2997311961U, 1189931652U, 3981543765U, 2826166703U, 87159245U,
- 1721379072U, 3897926942U, 1790395498U, 2569178939U, 1047368729U,
- 2340259131U, 3144212906U, 2301169789U, 2442885464U, 3034046771U,
- 3667880593U, 3935928400U, 2372805237U, 1666397115U, 2460584504U,
- 513866770U, 3810869743U, 2147400037U, 2792078025U, 2941761810U,
- 3212265810U, 984692259U, 346590253U, 1804179199U, 3298543443U,
- 750108141U, 2880257022U, 243310542U, 1869036465U, 1588062513U,
- 2983949551U, 1931450364U, 4034505847U, 2735030199U, 1628461061U,
- 2539522841U, 127965585U, 3992448871U, 913388237U, 559130076U,
- 1202933193U, 4087643167U, 2590021067U, 2256240196U, 1746697293U,
- 1013913783U, 1155864921U, 2715773730U, 915061862U, 1948766573U,
- 2322882854U, 3761119102U, 1343405684U, 3078711943U, 3067431651U,
- 3245156316U, 3588354584U, 3484623306U, 3899621563U, 4156689741U,
- 3237090058U, 3880063844U, 862416318U, 4039923869U, 2303788317U,
- 3073590536U, 701653667U, 2131530884U, 3169309950U, 2028486980U,
- 747196777U, 3620218225U, 432016035U, 1449580595U, 2772266392U,
- 444224948U, 1662832057U, 3184055582U, 3028331792U, 1861686254U,
- 1104864179U, 342430307U, 1350510923U, 3024656237U, 1028417492U,
- 2870772950U, 290847558U, 3675663500U, 508431529U, 4264340390U,
- 2263569913U, 1669302976U, 519511383U, 2706411211U, 3764615828U,
- 3883162495U, 4051445305U, 2412729798U, 3299405164U, 3991911166U,
- 2348767304U, 2664054906U, 3763609282U, 593943581U, 3757090046U,
- 2075338894U, 2020550814U, 4287452920U, 4290140003U, 1422957317U,
- 2512716667U, 2003485045U, 2307520103U, 2288472169U, 3940751663U,
- 4204638664U, 2892583423U, 1710068300U, 3904755993U, 2363243951U,
- 3038334120U, 547099465U, 771105860U, 3199983734U, 4282046461U,
- 2298388363U, 934810218U, 2837827901U, 3952500708U, 2095130248U,
- 3083335297U, 26885281U, 3932155283U, 1531751116U, 1425227133U,
- 495654159U, 3279634176U, 3855562207U, 3957195338U, 4159985527U,
- 893375062U, 1875515536U, 1327247422U, 3754140693U, 1028923197U,
- 1729880440U, 805571298U, 448971099U, 2726757106U, 2749436461U,
- 2485987104U, 175337042U, 3235477922U, 3882114302U, 2020970972U,
- 943926109U, 2762587195U, 1904195558U, 3452650564U, 108432281U,
- 3893463573U, 3977583081U, 2636504348U, 1110673525U, 3548479841U,
- 4258854744U, 980047703U, 4057175418U, 3890008292U, 145653646U,
- 3141868989U, 3293216228U, 1194331837U, 1254570642U, 3049934521U,
- 2868313360U, 2886032750U, 1110873820U, 279553524U, 3007258565U,
- 1104807822U, 3186961098U, 315764646U, 2163680838U, 3574508994U,
- 3099755655U, 191957684U, 3642656737U, 3317946149U, 3522087636U,
- 444526410U, 779157624U, 1088229627U, 1092460223U, 1856013765U,
- 3659877367U, 368270451U, 503570716U, 3000984671U, 2742789647U,
- 928097709U, 2914109539U, 308843566U, 2816161253U, 3667192079U,
- 2762679057U, 3395240989U, 2928925038U, 1491465914U, 3458702834U,
- 3787782576U, 2894104823U, 1296880455U, 1253636503U, 989959407U,
- 2291560361U, 2776790436U, 1913178042U, 1584677829U, 689637520U,
- 1898406878U, 688391508U, 3385234998U, 845493284U, 1943591856U,
- 2720472050U, 222695101U, 1653320868U, 2904632120U, 4084936008U,
- 1080720688U, 3938032556U, 387896427U, 2650839632U, 99042991U,
- 1720913794U, 1047186003U, 1877048040U, 2090457659U, 517087501U,
- 4172014665U, 2129713163U, 2413533132U, 2760285054U, 4129272496U,
- 1317737175U, 2309566414U, 2228873332U, 3889671280U, 1110864630U,
- 3576797776U, 2074552772U, 832002644U, 3097122623U, 2464859298U,
- 2679603822U, 1667489885U, 3237652716U, 1478413938U, 1719340335U,
- 2306631119U, 639727358U, 3369698270U, 226902796U, 2099920751U,
- 1892289957U, 2201594097U, 3508197013U, 3495811856U, 3900381493U,
- 841660320U, 3974501451U, 3360949056U, 1676829340U, 728899254U,
- 2047809627U, 2390948962U, 670165943U, 3412951831U, 4189320049U,
- 1911595255U, 2055363086U, 507170575U, 418219594U, 4141495280U,
- 2692088692U, 4203630654U, 3540093932U, 791986533U, 2237921051U,
- 2526864324U, 2956616642U, 1394958700U, 1983768223U, 1893373266U,
- 591653646U, 228432437U, 1611046598U, 3007736357U, 1040040725U,
- 2726180733U, 2789804360U, 4263568405U, 829098158U, 3847722805U,
- 1123578029U, 1804276347U, 997971319U, 4203797076U, 4185199713U,
- 2811733626U, 2343642194U, 2985262313U, 1417930827U, 3759587724U,
- 1967077982U, 1585223204U, 1097475516U, 1903944948U, 740382444U,
- 1114142065U, 1541796065U, 1718384172U, 1544076191U, 1134682254U,
- 3519754455U, 2866243923U, 341865437U, 645498576U, 2690735853U,
- 1046963033U, 2493178460U, 1187604696U, 1619577821U, 488503634U,
- 3255768161U, 2306666149U, 1630514044U, 2377698367U, 2751503746U,
- 3794467088U, 1796415981U, 3657173746U, 409136296U, 1387122342U,
- 1297726519U, 219544855U, 4270285558U, 437578827U, 1444698679U,
- 2258519491U, 963109892U, 3982244073U, 3351535275U, 385328496U,
- 1804784013U, 698059346U, 3920535147U, 708331212U, 784338163U,
- 785678147U, 1238376158U, 1557298846U, 2037809321U, 271576218U,
- 4145155269U, 1913481602U, 2763691931U, 588981080U, 1201098051U,
- 3717640232U, 1509206239U, 662536967U, 3180523616U, 1133105435U,
- 2963500837U, 2253971215U, 3153642623U, 1066925709U, 2582781958U,
- 3034720222U, 1090798544U, 2942170004U, 4036187520U, 686972531U,
- 2610990302U, 2641437026U, 1837562420U, 722096247U, 1315333033U,
- 2102231203U, 3402389208U, 3403698140U, 1312402831U, 2898426558U,
- 814384596U, 385649582U, 1916643285U, 1924625106U, 2512905582U,
- 2501170304U, 4275223366U, 2841225246U, 1467663688U, 3563567847U,
- 2969208552U, 884750901U, 102992576U, 227844301U, 3681442994U,
- 3502881894U, 4034693299U, 1166727018U, 1697460687U, 1737778332U,
- 1787161139U, 1053003655U, 1215024478U, 2791616766U, 2525841204U,
- 1629323443U, 3233815U, 2003823032U, 3083834263U, 2379264872U,
- 3752392312U, 1287475550U, 3770904171U, 3004244617U, 1502117784U,
- 918698423U, 2419857538U, 3864502062U, 1751322107U, 2188775056U,
- 4018728324U, 983712955U, 440071928U, 3710838677U, 2001027698U,
- 3994702151U, 22493119U, 3584400918U, 3446253670U, 4254789085U,
- 1405447860U, 1240245579U, 1800644159U, 1661363424U, 3278326132U,
- 3403623451U, 67092802U, 2609352193U, 3914150340U, 1814842761U,
- 3610830847U, 591531412U, 3880232807U, 1673505890U, 2585326991U,
- 1678544474U, 3148435887U, 3457217359U, 1193226330U, 2816576908U,
- 154025329U, 121678860U, 1164915738U, 973873761U, 269116100U,
- 52087970U, 744015362U, 498556057U, 94298882U, 1563271621U,
- 2383059628U, 4197367290U, 3958472990U, 2592083636U, 2906408439U,
- 1097742433U, 3924840517U, 264557272U, 2292287003U, 3203307984U,
- 4047038857U, 3820609705U, 2333416067U, 1839206046U, 3600944252U,
- 3412254904U, 583538222U, 2390557166U, 4140459427U, 2810357445U,
- 226777499U, 2496151295U, 2207301712U, 3283683112U, 611630281U,
- 1933218215U, 3315610954U, 3889441987U, 3719454256U, 3957190521U,
- 1313998161U, 2365383016U, 3146941060U, 1801206260U, 796124080U,
- 2076248581U, 1747472464U, 3254365145U, 595543130U, 3573909503U,
- 3758250204U, 2020768540U, 2439254210U, 93368951U, 3155792250U,
- 2600232980U, 3709198295U, 3894900440U, 2971850836U, 1578909644U,
- 1443493395U, 2581621665U, 3086506297U, 2443465861U, 558107211U,
- 1519367835U, 249149686U, 908102264U, 2588765675U, 1232743965U,
- 1001330373U, 3561331654U, 2259301289U, 1564977624U, 3835077093U,
- 727244906U, 4255738067U, 1214133513U, 2570786021U, 3899704621U,
- 1633861986U, 1636979509U, 1438500431U, 58463278U, 2823485629U,
- 2297430187U, 2926781924U, 3371352948U, 1864009023U, 2722267973U,
- 1444292075U, 437703973U, 1060414512U, 189705863U, 910018135U,
- 4077357964U, 884213423U, 2644986052U, 3973488374U, 1187906116U,
- 2331207875U, 780463700U, 3713351662U, 3854611290U, 412805574U,
- 2978462572U, 2176222820U, 829424696U, 2790788332U, 2750819108U,
- 1594611657U, 3899878394U, 3032870364U, 1702887682U, 1948167778U,
- 14130042U, 192292500U, 947227076U, 90719497U, 3854230320U,
- 784028434U, 2142399787U, 1563449646U, 2844400217U, 819143172U,
- 2883302356U, 2328055304U, 1328532246U, 2603885363U, 3375188924U,
- 933941291U, 3627039714U, 2129697284U, 2167253953U, 2506905438U,
- 1412424497U, 2981395985U, 1418359660U, 2925902456U, 52752784U,
- 3713667988U, 3924669405U, 648975707U, 1145520213U, 4018650664U,
- 3805915440U, 2380542088U, 2013260958U, 3262572197U, 2465078101U,
- 1114540067U, 3728768081U, 2396958768U, 590672271U, 904818725U,
- 4263660715U, 700754408U, 1042601829U, 4094111823U, 4274838909U,
- 2512692617U, 2774300207U, 2057306915U, 3470942453U, 99333088U,
- 1142661026U, 2889931380U, 14316674U, 2201179167U, 415289459U,
- 448265759U, 3515142743U, 3254903683U, 246633281U, 1184307224U,
- 2418347830U, 2092967314U, 2682072314U, 2558750234U, 2000352263U,
- 1544150531U, 399010405U, 1513946097U, 499682937U, 461167460U,
- 3045570638U, 1633669705U, 851492362U, 4052801922U, 2055266765U,
- 635556996U, 368266356U, 2385737383U, 3218202352U, 2603772408U,
- 349178792U, 226482567U, 3102426060U, 3575998268U, 2103001871U,
- 3243137071U, 225500688U, 1634718593U, 4283311431U, 4292122923U,
- 3842802787U, 811735523U, 105712518U, 663434053U, 1855889273U,
- 2847972595U, 1196355421U, 2552150115U, 4254510614U, 3752181265U,
- 3430721819U, 3828705396U, 3436287905U, 3441964937U, 4123670631U,
- 353001539U, 459496439U, 3799690868U, 1293777660U, 2761079737U,
- 498096339U, 3398433374U, 4080378380U, 2304691596U, 2995729055U,
- 4134660419U, 3903444024U, 3576494993U, 203682175U, 3321164857U,
- 2747963611U, 79749085U, 2992890370U, 1240278549U, 1772175713U,
- 2111331972U, 2655023449U, 1683896345U, 2836027212U, 3482868021U,
- 2489884874U, 756853961U, 2298874501U, 4013448667U, 4143996022U,
- 2948306858U, 4132920035U, 1283299272U, 995592228U, 3450508595U,
- 1027845759U, 1766942720U, 3861411826U, 1446861231U, 95974993U,
- 3502263554U, 1487532194U, 601502472U, 4129619129U, 250131773U,
- 2050079547U, 3198903947U, 3105589778U, 4066481316U, 3026383978U,
- 2276901713U, 365637751U, 2260718426U, 1394775634U, 1791172338U,
- 2690503163U, 2952737846U, 1568710462U, 732623190U, 2980358000U,
- 1053631832U, 1432426951U, 3229149635U, 1854113985U, 3719733532U,
- 3204031934U, 735775531U, 107468620U, 3734611984U, 631009402U,
- 3083622457U, 4109580626U, 159373458U, 1301970201U, 4132389302U,
- 1293255004U, 847182752U, 4170022737U, 96712900U, 2641406755U,
- 1381727755U, 405608287U, 4287919625U, 1703554290U, 3589580244U,
- 2911403488U, 2166565U, 2647306451U, 2330535117U, 1200815358U,
- 1165916754U, 245060911U, 4040679071U, 3684908771U, 2452834126U,
- 2486872773U, 2318678365U, 2940627908U, 1837837240U, 3447897409U,
- 4270484676U, 1495388728U, 3754288477U, 4204167884U, 1386977705U,
- 2692224733U, 3076249689U, 4109568048U, 4170955115U, 4167531356U,
- 4020189950U, 4261855038U, 3036907575U, 3410399885U, 3076395737U,
- 1046178638U, 144496770U, 230725846U, 3349637149U, 17065717U,
- 2809932048U, 2054581785U, 3608424964U, 3259628808U, 134897388U,
- 3743067463U, 257685904U, 3795656590U, 1562468719U, 3589103904U,
- 3120404710U, 254684547U, 2653661580U, 3663904795U, 2631942758U,
- 1063234347U, 2609732900U, 2332080715U, 3521125233U, 1180599599U,
- 1935868586U, 4110970440U, 296706371U, 2128666368U, 1319875791U,
- 1570900197U, 3096025483U, 1799882517U, 1928302007U, 1163707758U,
- 1244491489U, 3533770203U, 567496053U, 2757924305U, 2781639343U,
- 2818420107U, 560404889U, 2619609724U, 4176035430U, 2511289753U,
- 2521842019U, 3910553502U, 2926149387U, 3302078172U, 4237118867U,
- 330725126U, 367400677U, 888239854U, 545570454U, 4259590525U,
- 134343617U, 1102169784U, 1647463719U, 3260979784U, 1518840883U,
- 3631537963U, 3342671457U, 1301549147U, 2083739356U, 146593792U,
- 3217959080U, 652755743U, 2032187193U, 3898758414U, 1021358093U,
- 4037409230U, 2176407931U, 3427391950U, 2883553603U, 985613827U,
- 3105265092U, 3423168427U, 3387507672U, 467170288U, 2141266163U,
- 3723870208U, 916410914U, 1293987799U, 2652584950U, 769160137U,
- 3205292896U, 1561287359U, 1684510084U, 3136055621U, 3765171391U,
- 639683232U, 2639569327U, 1218546948U, 4263586685U, 3058215773U,
- 2352279820U, 401870217U, 2625822463U, 1529125296U, 2981801895U,
- 1191285226U, 4027725437U, 3432700217U, 4098835661U, 971182783U,
- 2443861173U, 3881457123U, 3874386651U, 457276199U, 2638294160U,
- 4002809368U, 421169044U, 1112642589U, 3076213779U, 3387033971U,
- 2499610950U, 3057240914U, 1662679783U, 461224431U, 1168395933U
-};
-static const uint32_t init_by_array_32_expected[] = {
- 2920711183U, 3885745737U, 3501893680U, 856470934U, 1421864068U,
- 277361036U, 1518638004U, 2328404353U, 3355513634U, 64329189U,
- 1624587673U, 3508467182U, 2481792141U, 3706480799U, 1925859037U,
- 2913275699U, 882658412U, 384641219U, 422202002U, 1873384891U,
- 2006084383U, 3924929912U, 1636718106U, 3108838742U, 1245465724U,
- 4195470535U, 779207191U, 1577721373U, 1390469554U, 2928648150U,
- 121399709U, 3170839019U, 4044347501U, 953953814U, 3821710850U,
- 3085591323U, 3666535579U, 3577837737U, 2012008410U, 3565417471U,
- 4044408017U, 433600965U, 1637785608U, 1798509764U, 860770589U,
- 3081466273U, 3982393409U, 2451928325U, 3437124742U, 4093828739U,
- 3357389386U, 2154596123U, 496568176U, 2650035164U, 2472361850U,
- 3438299U, 2150366101U, 1577256676U, 3802546413U, 1787774626U,
- 4078331588U, 3706103141U, 170391138U, 3806085154U, 1680970100U,
- 1961637521U, 3316029766U, 890610272U, 1453751581U, 1430283664U,
- 3051057411U, 3597003186U, 542563954U, 3796490244U, 1690016688U,
- 3448752238U, 440702173U, 347290497U, 1121336647U, 2540588620U,
- 280881896U, 2495136428U, 213707396U, 15104824U, 2946180358U,
- 659000016U, 566379385U, 2614030979U, 2855760170U, 334526548U,
- 2315569495U, 2729518615U, 564745877U, 1263517638U, 3157185798U,
- 1604852056U, 1011639885U, 2950579535U, 2524219188U, 312951012U,
- 1528896652U, 1327861054U, 2846910138U, 3966855905U, 2536721582U,
- 855353911U, 1685434729U, 3303978929U, 1624872055U, 4020329649U,
- 3164802143U, 1642802700U, 1957727869U, 1792352426U, 3334618929U,
- 2631577923U, 3027156164U, 842334259U, 3353446843U, 1226432104U,
- 1742801369U, 3552852535U, 3471698828U, 1653910186U, 3380330939U,
- 2313782701U, 3351007196U, 2129839995U, 1800682418U, 4085884420U,
- 1625156629U, 3669701987U, 615211810U, 3294791649U, 4131143784U,
- 2590843588U, 3207422808U, 3275066464U, 561592872U, 3957205738U,
- 3396578098U, 48410678U, 3505556445U, 1005764855U, 3920606528U,
- 2936980473U, 2378918600U, 2404449845U, 1649515163U, 701203563U,
- 3705256349U, 83714199U, 3586854132U, 922978446U, 2863406304U,
- 3523398907U, 2606864832U, 2385399361U, 3171757816U, 4262841009U,
- 3645837721U, 1169579486U, 3666433897U, 3174689479U, 1457866976U,
- 3803895110U, 3346639145U, 1907224409U, 1978473712U, 1036712794U,
- 980754888U, 1302782359U, 1765252468U, 459245755U, 3728923860U,
- 1512894209U, 2046491914U, 207860527U, 514188684U, 2288713615U,
- 1597354672U, 3349636117U, 2357291114U, 3995796221U, 945364213U,
- 1893326518U, 3770814016U, 1691552714U, 2397527410U, 967486361U,
- 776416472U, 4197661421U, 951150819U, 1852770983U, 4044624181U,
- 1399439738U, 4194455275U, 2284037669U, 1550734958U, 3321078108U,
- 1865235926U, 2912129961U, 2664980877U, 1357572033U, 2600196436U,
- 2486728200U, 2372668724U, 1567316966U, 2374111491U, 1839843570U,
- 20815612U, 3727008608U, 3871996229U, 824061249U, 1932503978U,
- 3404541726U, 758428924U, 2609331364U, 1223966026U, 1299179808U,
- 648499352U, 2180134401U, 880821170U, 3781130950U, 113491270U,
- 1032413764U, 4185884695U, 2490396037U, 1201932817U, 4060951446U,
- 4165586898U, 1629813212U, 2887821158U, 415045333U, 628926856U,
- 2193466079U, 3391843445U, 2227540681U, 1907099846U, 2848448395U,
- 1717828221U, 1372704537U, 1707549841U, 2294058813U, 2101214437U,
- 2052479531U, 1695809164U, 3176587306U, 2632770465U, 81634404U,
- 1603220563U, 644238487U, 302857763U, 897352968U, 2613146653U,
- 1391730149U, 4245717312U, 4191828749U, 1948492526U, 2618174230U,
- 3992984522U, 2178852787U, 3596044509U, 3445573503U, 2026614616U,
- 915763564U, 3415689334U, 2532153403U, 3879661562U, 2215027417U,
- 3111154986U, 2929478371U, 668346391U, 1152241381U, 2632029711U,
- 3004150659U, 2135025926U, 948690501U, 2799119116U, 4228829406U,
- 1981197489U, 4209064138U, 684318751U, 3459397845U, 201790843U,
- 4022541136U, 3043635877U, 492509624U, 3263466772U, 1509148086U,
- 921459029U, 3198857146U, 705479721U, 3835966910U, 3603356465U,
- 576159741U, 1742849431U, 594214882U, 2055294343U, 3634861861U,
- 449571793U, 3246390646U, 3868232151U, 1479156585U, 2900125656U,
- 2464815318U, 3960178104U, 1784261920U, 18311476U, 3627135050U,
- 644609697U, 424968996U, 919890700U, 2986824110U, 816423214U,
- 4003562844U, 1392714305U, 1757384428U, 2569030598U, 995949559U,
- 3875659880U, 2933807823U, 2752536860U, 2993858466U, 4030558899U,
- 2770783427U, 2775406005U, 2777781742U, 1931292655U, 472147933U,
- 3865853827U, 2726470545U, 2668412860U, 2887008249U, 408979190U,
- 3578063323U, 3242082049U, 1778193530U, 27981909U, 2362826515U,
- 389875677U, 1043878156U, 581653903U, 3830568952U, 389535942U,
- 3713523185U, 2768373359U, 2526101582U, 1998618197U, 1160859704U,
- 3951172488U, 1098005003U, 906275699U, 3446228002U, 2220677963U,
- 2059306445U, 132199571U, 476838790U, 1868039399U, 3097344807U,
- 857300945U, 396345050U, 2835919916U, 1782168828U, 1419519470U,
- 4288137521U, 819087232U, 596301494U, 872823172U, 1526888217U,
- 805161465U, 1116186205U, 2829002754U, 2352620120U, 620121516U,
- 354159268U, 3601949785U, 209568138U, 1352371732U, 2145977349U,
- 4236871834U, 1539414078U, 3558126206U, 3224857093U, 4164166682U,
- 3817553440U, 3301780278U, 2682696837U, 3734994768U, 1370950260U,
- 1477421202U, 2521315749U, 1330148125U, 1261554731U, 2769143688U,
- 3554756293U, 4235882678U, 3254686059U, 3530579953U, 1215452615U,
- 3574970923U, 4057131421U, 589224178U, 1000098193U, 171190718U,
- 2521852045U, 2351447494U, 2284441580U, 2646685513U, 3486933563U,
- 3789864960U, 1190528160U, 1702536782U, 1534105589U, 4262946827U,
- 2726686826U, 3584544841U, 2348270128U, 2145092281U, 2502718509U,
- 1027832411U, 3571171153U, 1287361161U, 4011474411U, 3241215351U,
- 2419700818U, 971242709U, 1361975763U, 1096842482U, 3271045537U,
- 81165449U, 612438025U, 3912966678U, 1356929810U, 733545735U,
- 537003843U, 1282953084U, 884458241U, 588930090U, 3930269801U,
- 2961472450U, 1219535534U, 3632251943U, 268183903U, 1441240533U,
- 3653903360U, 3854473319U, 2259087390U, 2548293048U, 2022641195U,
- 2105543911U, 1764085217U, 3246183186U, 482438805U, 888317895U,
- 2628314765U, 2466219854U, 717546004U, 2322237039U, 416725234U,
- 1544049923U, 1797944973U, 3398652364U, 3111909456U, 485742908U,
- 2277491072U, 1056355088U, 3181001278U, 129695079U, 2693624550U,
- 1764438564U, 3797785470U, 195503713U, 3266519725U, 2053389444U,
- 1961527818U, 3400226523U, 3777903038U, 2597274307U, 4235851091U,
- 4094406648U, 2171410785U, 1781151386U, 1378577117U, 654643266U,
- 3424024173U, 3385813322U, 679385799U, 479380913U, 681715441U,
- 3096225905U, 276813409U, 3854398070U, 2721105350U, 831263315U,
- 3276280337U, 2628301522U, 3984868494U, 1466099834U, 2104922114U,
- 1412672743U, 820330404U, 3491501010U, 942735832U, 710652807U,
- 3972652090U, 679881088U, 40577009U, 3705286397U, 2815423480U,
- 3566262429U, 663396513U, 3777887429U, 4016670678U, 404539370U,
- 1142712925U, 1140173408U, 2913248352U, 2872321286U, 263751841U,
- 3175196073U, 3162557581U, 2878996619U, 75498548U, 3836833140U,
- 3284664959U, 1157523805U, 112847376U, 207855609U, 1337979698U,
- 1222578451U, 157107174U, 901174378U, 3883717063U, 1618632639U,
- 1767889440U, 4264698824U, 1582999313U, 884471997U, 2508825098U,
- 3756370771U, 2457213553U, 3565776881U, 3709583214U, 915609601U,
- 460833524U, 1091049576U, 85522880U, 2553251U, 132102809U,
- 2429882442U, 2562084610U, 1386507633U, 4112471229U, 21965213U,
- 1981516006U, 2418435617U, 3054872091U, 4251511224U, 2025783543U,
- 1916911512U, 2454491136U, 3938440891U, 3825869115U, 1121698605U,
- 3463052265U, 802340101U, 1912886800U, 4031997367U, 3550640406U,
- 1596096923U, 610150600U, 431464457U, 2541325046U, 486478003U,
- 739704936U, 2862696430U, 3037903166U, 1129749694U, 2611481261U,
- 1228993498U, 510075548U, 3424962587U, 2458689681U, 818934833U,
- 4233309125U, 1608196251U, 3419476016U, 1858543939U, 2682166524U,
- 3317854285U, 631986188U, 3008214764U, 613826412U, 3567358221U,
- 3512343882U, 1552467474U, 3316162670U, 1275841024U, 4142173454U,
- 565267881U, 768644821U, 198310105U, 2396688616U, 1837659011U,
- 203429334U, 854539004U, 4235811518U, 3338304926U, 3730418692U,
- 3852254981U, 3032046452U, 2329811860U, 2303590566U, 2696092212U,
- 3894665932U, 145835667U, 249563655U, 1932210840U, 2431696407U,
- 3312636759U, 214962629U, 2092026914U, 3020145527U, 4073039873U,
- 2739105705U, 1308336752U, 855104522U, 2391715321U, 67448785U,
- 547989482U, 854411802U, 3608633740U, 431731530U, 537375589U,
- 3888005760U, 696099141U, 397343236U, 1864511780U, 44029739U,
- 1729526891U, 1993398655U, 2010173426U, 2591546756U, 275223291U,
- 1503900299U, 4217765081U, 2185635252U, 1122436015U, 3550155364U,
- 681707194U, 3260479338U, 933579397U, 2983029282U, 2505504587U,
- 2667410393U, 2962684490U, 4139721708U, 2658172284U, 2452602383U,
- 2607631612U, 1344296217U, 3075398709U, 2949785295U, 1049956168U,
- 3917185129U, 2155660174U, 3280524475U, 1503827867U, 674380765U,
- 1918468193U, 3843983676U, 634358221U, 2538335643U, 1873351298U,
- 3368723763U, 2129144130U, 3203528633U, 3087174986U, 2691698871U,
- 2516284287U, 24437745U, 1118381474U, 2816314867U, 2448576035U,
- 4281989654U, 217287825U, 165872888U, 2628995722U, 3533525116U,
- 2721669106U, 872340568U, 3429930655U, 3309047304U, 3916704967U,
- 3270160355U, 1348884255U, 1634797670U, 881214967U, 4259633554U,
- 174613027U, 1103974314U, 1625224232U, 2678368291U, 1133866707U,
- 3853082619U, 4073196549U, 1189620777U, 637238656U, 930241537U,
- 4042750792U, 3842136042U, 2417007212U, 2524907510U, 1243036827U,
- 1282059441U, 3764588774U, 1394459615U, 2323620015U, 1166152231U,
- 3307479609U, 3849322257U, 3507445699U, 4247696636U, 758393720U,
- 967665141U, 1095244571U, 1319812152U, 407678762U, 2640605208U,
- 2170766134U, 3663594275U, 4039329364U, 2512175520U, 725523154U,
- 2249807004U, 3312617979U, 2414634172U, 1278482215U, 349206484U,
- 1573063308U, 1196429124U, 3873264116U, 2400067801U, 268795167U,
- 226175489U, 2961367263U, 1968719665U, 42656370U, 1010790699U,
- 561600615U, 2422453992U, 3082197735U, 1636700484U, 3977715296U,
- 3125350482U, 3478021514U, 2227819446U, 1540868045U, 3061908980U,
- 1087362407U, 3625200291U, 361937537U, 580441897U, 1520043666U,
- 2270875402U, 1009161260U, 2502355842U, 4278769785U, 473902412U,
- 1057239083U, 1905829039U, 1483781177U, 2080011417U, 1207494246U,
- 1806991954U, 2194674403U, 3455972205U, 807207678U, 3655655687U,
- 674112918U, 195425752U, 3917890095U, 1874364234U, 1837892715U,
- 3663478166U, 1548892014U, 2570748714U, 2049929836U, 2167029704U,
- 697543767U, 3499545023U, 3342496315U, 1725251190U, 3561387469U,
- 2905606616U, 1580182447U, 3934525927U, 4103172792U, 1365672522U,
- 1534795737U, 3308667416U, 2841911405U, 3943182730U, 4072020313U,
- 3494770452U, 3332626671U, 55327267U, 478030603U, 411080625U,
- 3419529010U, 1604767823U, 3513468014U, 570668510U, 913790824U,
- 2283967995U, 695159462U, 3825542932U, 4150698144U, 1829758699U,
- 202895590U, 1609122645U, 1267651008U, 2910315509U, 2511475445U,
- 2477423819U, 3932081579U, 900879979U, 2145588390U, 2670007504U,
- 580819444U, 1864996828U, 2526325979U, 1019124258U, 815508628U,
- 2765933989U, 1277301341U, 3006021786U, 855540956U, 288025710U,
- 1919594237U, 2331223864U, 177452412U, 2475870369U, 2689291749U,
- 865194284U, 253432152U, 2628531804U, 2861208555U, 2361597573U,
- 1653952120U, 1039661024U, 2159959078U, 3709040440U, 3564718533U,
- 2596878672U, 2041442161U, 31164696U, 2662962485U, 3665637339U,
- 1678115244U, 2699839832U, 3651968520U, 3521595541U, 458433303U,
- 2423096824U, 21831741U, 380011703U, 2498168716U, 861806087U,
- 1673574843U, 4188794405U, 2520563651U, 2632279153U, 2170465525U,
- 4171949898U, 3886039621U, 1661344005U, 3424285243U, 992588372U,
- 2500984144U, 2993248497U, 3590193895U, 1535327365U, 515645636U,
- 131633450U, 3729760261U, 1613045101U, 3254194278U, 15889678U,
- 1493590689U, 244148718U, 2991472662U, 1401629333U, 777349878U,
- 2501401703U, 4285518317U, 3794656178U, 955526526U, 3442142820U,
- 3970298374U, 736025417U, 2737370764U, 1271509744U, 440570731U,
- 136141826U, 1596189518U, 923399175U, 257541519U, 3505774281U,
- 2194358432U, 2518162991U, 1379893637U, 2667767062U, 3748146247U,
- 1821712620U, 3923161384U, 1947811444U, 2392527197U, 4127419685U,
- 1423694998U, 4156576871U, 1382885582U, 3420127279U, 3617499534U,
- 2994377493U, 4038063986U, 1918458672U, 2983166794U, 4200449033U,
- 353294540U, 1609232588U, 243926648U, 2332803291U, 507996832U,
- 2392838793U, 4075145196U, 2060984340U, 4287475136U, 88232602U,
- 2491531140U, 4159725633U, 2272075455U, 759298618U, 201384554U,
- 838356250U, 1416268324U, 674476934U, 90795364U, 141672229U,
- 3660399588U, 4196417251U, 3249270244U, 3774530247U, 59587265U,
- 3683164208U, 19392575U, 1463123697U, 1882205379U, 293780489U,
- 2553160622U, 2933904694U, 675638239U, 2851336944U, 1435238743U,
- 2448730183U, 804436302U, 2119845972U, 322560608U, 4097732704U,
- 2987802540U, 641492617U, 2575442710U, 4217822703U, 3271835300U,
- 2836418300U, 3739921620U, 2138378768U, 2879771855U, 4294903423U,
- 3121097946U, 2603440486U, 2560820391U, 1012930944U, 2313499967U,
- 584489368U, 3431165766U, 897384869U, 2062537737U, 2847889234U,
- 3742362450U, 2951174585U, 4204621084U, 1109373893U, 3668075775U,
- 2750138839U, 3518055702U, 733072558U, 4169325400U, 788493625U
-};
-static const uint64_t init_gen_rand_64_expected[] = {
- KQU(16924766246869039260), KQU( 8201438687333352714),
- KQU( 2265290287015001750), KQU(18397264611805473832),
- KQU( 3375255223302384358), KQU( 6345559975416828796),
- KQU(18229739242790328073), KQU( 7596792742098800905),
- KQU( 255338647169685981), KQU( 2052747240048610300),
- KQU(18328151576097299343), KQU(12472905421133796567),
- KQU(11315245349717600863), KQU(16594110197775871209),
- KQU(15708751964632456450), KQU(10452031272054632535),
- KQU(11097646720811454386), KQU( 4556090668445745441),
- KQU(17116187693090663106), KQU(14931526836144510645),
- KQU( 9190752218020552591), KQU( 9625800285771901401),
- KQU(13995141077659972832), KQU( 5194209094927829625),
- KQU( 4156788379151063303), KQU( 8523452593770139494),
- KQU(14082382103049296727), KQU( 2462601863986088483),
- KQU( 3030583461592840678), KQU( 5221622077872827681),
- KQU( 3084210671228981236), KQU(13956758381389953823),
- KQU(13503889856213423831), KQU(15696904024189836170),
- KQU( 4612584152877036206), KQU( 6231135538447867881),
- KQU(10172457294158869468), KQU( 6452258628466708150),
- KQU(14044432824917330221), KQU( 370168364480044279),
- KQU(10102144686427193359), KQU( 667870489994776076),
- KQU( 2732271956925885858), KQU(18027788905977284151),
- KQU(15009842788582923859), KQU( 7136357960180199542),
- KQU(15901736243475578127), KQU(16951293785352615701),
- KQU(10551492125243691632), KQU(17668869969146434804),
- KQU(13646002971174390445), KQU( 9804471050759613248),
- KQU( 5511670439655935493), KQU(18103342091070400926),
- KQU(17224512747665137533), KQU(15534627482992618168),
- KQU( 1423813266186582647), KQU(15821176807932930024),
- KQU( 30323369733607156), KQU(11599382494723479403),
- KQU( 653856076586810062), KQU( 3176437395144899659),
- KQU(14028076268147963917), KQU(16156398271809666195),
- KQU( 3166955484848201676), KQU( 5746805620136919390),
- KQU(17297845208891256593), KQU(11691653183226428483),
- KQU(17900026146506981577), KQU(15387382115755971042),
- KQU(16923567681040845943), KQU( 8039057517199388606),
- KQU(11748409241468629263), KQU( 794358245539076095),
- KQU(13438501964693401242), KQU(14036803236515618962),
- KQU( 5252311215205424721), KQU(17806589612915509081),
- KQU( 6802767092397596006), KQU(14212120431184557140),
- KQU( 1072951366761385712), KQU(13098491780722836296),
- KQU( 9466676828710797353), KQU(12673056849042830081),
- KQU(12763726623645357580), KQU(16468961652999309493),
- KQU(15305979875636438926), KQU(17444713151223449734),
- KQU( 5692214267627883674), KQU(13049589139196151505),
- KQU( 880115207831670745), KQU( 1776529075789695498),
- KQU(16695225897801466485), KQU(10666901778795346845),
- KQU( 6164389346722833869), KQU( 2863817793264300475),
- KQU( 9464049921886304754), KQU( 3993566636740015468),
- KQU( 9983749692528514136), KQU(16375286075057755211),
- KQU(16042643417005440820), KQU(11445419662923489877),
- KQU( 7999038846885158836), KQU( 6721913661721511535),
- KQU( 5363052654139357320), KQU( 1817788761173584205),
- KQU(13290974386445856444), KQU( 4650350818937984680),
- KQU( 8219183528102484836), KQU( 1569862923500819899),
- KQU( 4189359732136641860), KQU(14202822961683148583),
- KQU( 4457498315309429058), KQU(13089067387019074834),
- KQU(11075517153328927293), KQU(10277016248336668389),
- KQU( 7070509725324401122), KQU(17808892017780289380),
- KQU(13143367339909287349), KQU( 1377743745360085151),
- KQU( 5749341807421286485), KQU(14832814616770931325),
- KQU( 7688820635324359492), KQU(10960474011539770045),
- KQU( 81970066653179790), KQU(12619476072607878022),
- KQU( 4419566616271201744), KQU(15147917311750568503),
- KQU( 5549739182852706345), KQU( 7308198397975204770),
- KQU(13580425496671289278), KQU(17070764785210130301),
- KQU( 8202832846285604405), KQU( 6873046287640887249),
- KQU( 6927424434308206114), KQU( 6139014645937224874),
- KQU(10290373645978487639), KQU(15904261291701523804),
- KQU( 9628743442057826883), KQU(18383429096255546714),
- KQU( 4977413265753686967), KQU( 7714317492425012869),
- KQU( 9025232586309926193), KQU(14627338359776709107),
- KQU(14759849896467790763), KQU(10931129435864423252),
- KQU( 4588456988775014359), KQU(10699388531797056724),
- KQU( 468652268869238792), KQU( 5755943035328078086),
- KQU( 2102437379988580216), KQU( 9986312786506674028),
- KQU( 2654207180040945604), KQU( 8726634790559960062),
- KQU( 100497234871808137), KQU( 2800137176951425819),
- KQU( 6076627612918553487), KQU( 5780186919186152796),
- KQU( 8179183595769929098), KQU( 6009426283716221169),
- KQU( 2796662551397449358), KQU( 1756961367041986764),
- KQU( 6972897917355606205), KQU(14524774345368968243),
- KQU( 2773529684745706940), KQU( 4853632376213075959),
- KQU( 4198177923731358102), KQU( 8271224913084139776),
- KQU( 2741753121611092226), KQU(16782366145996731181),
- KQU(15426125238972640790), KQU(13595497100671260342),
- KQU( 3173531022836259898), KQU( 6573264560319511662),
- KQU(18041111951511157441), KQU( 2351433581833135952),
- KQU( 3113255578908173487), KQU( 1739371330877858784),
- KQU(16046126562789165480), KQU( 8072101652214192925),
- KQU(15267091584090664910), KQU( 9309579200403648940),
- KQU( 5218892439752408722), KQU(14492477246004337115),
- KQU(17431037586679770619), KQU( 7385248135963250480),
- KQU( 9580144956565560660), KQU( 4919546228040008720),
- KQU(15261542469145035584), KQU(18233297270822253102),
- KQU( 5453248417992302857), KQU( 9309519155931460285),
- KQU(10342813012345291756), KQU(15676085186784762381),
- KQU(15912092950691300645), KQU( 9371053121499003195),
- KQU( 9897186478226866746), KQU(14061858287188196327),
- KQU( 122575971620788119), KQU(12146750969116317754),
- KQU( 4438317272813245201), KQU( 8332576791009527119),
- KQU(13907785691786542057), KQU(10374194887283287467),
- KQU( 2098798755649059566), KQU( 3416235197748288894),
- KQU( 8688269957320773484), KQU( 7503964602397371571),
- KQU(16724977015147478236), KQU( 9461512855439858184),
- KQU(13259049744534534727), KQU( 3583094952542899294),
- KQU( 8764245731305528292), KQU(13240823595462088985),
- KQU(13716141617617910448), KQU(18114969519935960955),
- KQU( 2297553615798302206), KQU( 4585521442944663362),
- KQU(17776858680630198686), KQU( 4685873229192163363),
- KQU( 152558080671135627), KQU(15424900540842670088),
- KQU(13229630297130024108), KQU(17530268788245718717),
- KQU(16675633913065714144), KQU( 3158912717897568068),
- KQU(15399132185380087288), KQU( 7401418744515677872),
- KQU(13135412922344398535), KQU( 6385314346100509511),
- KQU(13962867001134161139), KQU(10272780155442671999),
- KQU(12894856086597769142), KQU(13340877795287554994),
- KQU(12913630602094607396), KQU(12543167911119793857),
- KQU(17343570372251873096), KQU(10959487764494150545),
- KQU( 6966737953093821128), KQU(13780699135496988601),
- KQU( 4405070719380142046), KQU(14923788365607284982),
- KQU( 2869487678905148380), KQU( 6416272754197188403),
- KQU(15017380475943612591), KQU( 1995636220918429487),
- KQU( 3402016804620122716), KQU(15800188663407057080),
- KQU(11362369990390932882), KQU(15262183501637986147),
- KQU(10239175385387371494), KQU( 9352042420365748334),
- KQU( 1682457034285119875), KQU( 1724710651376289644),
- KQU( 2038157098893817966), KQU( 9897825558324608773),
- KQU( 1477666236519164736), KQU(16835397314511233640),
- KQU(10370866327005346508), KQU(10157504370660621982),
- KQU(12113904045335882069), KQU(13326444439742783008),
- KQU(11302769043000765804), KQU(13594979923955228484),
- KQU(11779351762613475968), KQU( 3786101619539298383),
- KQU( 8021122969180846063), KQU(15745904401162500495),
- KQU(10762168465993897267), KQU(13552058957896319026),
- KQU(11200228655252462013), KQU( 5035370357337441226),
- KQU( 7593918984545500013), KQU( 5418554918361528700),
- KQU( 4858270799405446371), KQU( 9974659566876282544),
- KQU(18227595922273957859), KQU( 2772778443635656220),
- KQU(14285143053182085385), KQU( 9939700992429600469),
- KQU(12756185904545598068), KQU( 2020783375367345262),
- KQU( 57026775058331227), KQU( 950827867930065454),
- KQU( 6602279670145371217), KQU( 2291171535443566929),
- KQU( 5832380724425010313), KQU( 1220343904715982285),
- KQU(17045542598598037633), KQU(15460481779702820971),
- KQU(13948388779949365130), KQU(13975040175430829518),
- KQU(17477538238425541763), KQU(11104663041851745725),
- KQU(15860992957141157587), KQU(14529434633012950138),
- KQU( 2504838019075394203), KQU( 7512113882611121886),
- KQU( 4859973559980886617), KQU( 1258601555703250219),
- KQU(15594548157514316394), KQU( 4516730171963773048),
- KQU(11380103193905031983), KQU( 6809282239982353344),
- KQU(18045256930420065002), KQU( 2453702683108791859),
- KQU( 977214582986981460), KQU( 2006410402232713466),
- KQU( 6192236267216378358), KQU( 3429468402195675253),
- KQU(18146933153017348921), KQU(17369978576367231139),
- KQU( 1246940717230386603), KQU(11335758870083327110),
- KQU(14166488801730353682), KQU( 9008573127269635732),
- KQU(10776025389820643815), KQU(15087605441903942962),
- KQU( 1359542462712147922), KQU(13898874411226454206),
- KQU(17911176066536804411), KQU( 9435590428600085274),
- KQU( 294488509967864007), KQU( 8890111397567922046),
- KQU( 7987823476034328778), KQU(13263827582440967651),
- KQU( 7503774813106751573), KQU(14974747296185646837),
- KQU( 8504765037032103375), KQU(17340303357444536213),
- KQU( 7704610912964485743), KQU( 8107533670327205061),
- KQU( 9062969835083315985), KQU(16968963142126734184),
- KQU(12958041214190810180), KQU( 2720170147759570200),
- KQU( 2986358963942189566), KQU(14884226322219356580),
- KQU( 286224325144368520), KQU(11313800433154279797),
- KQU(18366849528439673248), KQU(17899725929482368789),
- KQU( 3730004284609106799), KQU( 1654474302052767205),
- KQU( 5006698007047077032), KQU( 8196893913601182838),
- KQU(15214541774425211640), KQU(17391346045606626073),
- KQU( 8369003584076969089), KQU( 3939046733368550293),
- KQU(10178639720308707785), KQU( 2180248669304388697),
- KQU( 62894391300126322), KQU( 9205708961736223191),
- KQU( 6837431058165360438), KQU( 3150743890848308214),
- KQU(17849330658111464583), KQU(12214815643135450865),
- KQU(13410713840519603402), KQU( 3200778126692046802),
- KQU(13354780043041779313), KQU( 800850022756886036),
- KQU(15660052933953067433), KQU( 6572823544154375676),
- KQU(11030281857015819266), KQU(12682241941471433835),
- KQU(11654136407300274693), KQU( 4517795492388641109),
- KQU( 9757017371504524244), KQU(17833043400781889277),
- KQU(12685085201747792227), KQU(10408057728835019573),
- KQU( 98370418513455221), KQU( 6732663555696848598),
- KQU(13248530959948529780), KQU( 3530441401230622826),
- KQU(18188251992895660615), KQU( 1847918354186383756),
- KQU( 1127392190402660921), KQU(11293734643143819463),
- KQU( 3015506344578682982), KQU(13852645444071153329),
- KQU( 2121359659091349142), KQU( 1294604376116677694),
- KQU( 5616576231286352318), KQU( 7112502442954235625),
- KQU(11676228199551561689), KQU(12925182803007305359),
- KQU( 7852375518160493082), KQU( 1136513130539296154),
- KQU( 5636923900916593195), KQU( 3221077517612607747),
- KQU(17784790465798152513), KQU( 3554210049056995938),
- KQU(17476839685878225874), KQU( 3206836372585575732),
- KQU( 2765333945644823430), KQU(10080070903718799528),
- KQU( 5412370818878286353), KQU( 9689685887726257728),
- KQU( 8236117509123533998), KQU( 1951139137165040214),
- KQU( 4492205209227980349), KQU(16541291230861602967),
- KQU( 1424371548301437940), KQU( 9117562079669206794),
- KQU(14374681563251691625), KQU(13873164030199921303),
- KQU( 6680317946770936731), KQU(15586334026918276214),
- KQU(10896213950976109802), KQU( 9506261949596413689),
- KQU( 9903949574308040616), KQU( 6038397344557204470),
- KQU( 174601465422373648), KQU(15946141191338238030),
- KQU(17142225620992044937), KQU( 7552030283784477064),
- KQU( 2947372384532947997), KQU( 510797021688197711),
- KQU( 4962499439249363461), KQU( 23770320158385357),
- KQU( 959774499105138124), KQU( 1468396011518788276),
- KQU( 2015698006852312308), KQU( 4149400718489980136),
- KQU( 5992916099522371188), KQU(10819182935265531076),
- KQU(16189787999192351131), KQU( 342833961790261950),
- KQU(12470830319550495336), KQU(18128495041912812501),
- KQU( 1193600899723524337), KQU( 9056793666590079770),
- KQU( 2154021227041669041), KQU( 4963570213951235735),
- KQU( 4865075960209211409), KQU( 2097724599039942963),
- KQU( 2024080278583179845), KQU(11527054549196576736),
- KQU(10650256084182390252), KQU( 4808408648695766755),
- KQU( 1642839215013788844), KQU(10607187948250398390),
- KQU( 7076868166085913508), KQU( 730522571106887032),
- KQU(12500579240208524895), KQU( 4484390097311355324),
- KQU(15145801330700623870), KQU( 8055827661392944028),
- KQU( 5865092976832712268), KQU(15159212508053625143),
- KQU( 3560964582876483341), KQU( 4070052741344438280),
- KQU( 6032585709886855634), KQU(15643262320904604873),
- KQU( 2565119772293371111), KQU( 318314293065348260),
- KQU(15047458749141511872), KQU( 7772788389811528730),
- KQU( 7081187494343801976), KQU( 6465136009467253947),
- KQU(10425940692543362069), KQU( 554608190318339115),
- KQU(14796699860302125214), KQU( 1638153134431111443),
- KQU(10336967447052276248), KQU( 8412308070396592958),
- KQU( 4004557277152051226), KQU( 8143598997278774834),
- KQU(16413323996508783221), KQU(13139418758033994949),
- KQU( 9772709138335006667), KQU( 2818167159287157659),
- KQU(17091740573832523669), KQU(14629199013130751608),
- KQU(18268322711500338185), KQU( 8290963415675493063),
- KQU( 8830864907452542588), KQU( 1614839084637494849),
- KQU(14855358500870422231), KQU( 3472996748392519937),
- KQU(15317151166268877716), KQU( 5825895018698400362),
- KQU(16730208429367544129), KQU(10481156578141202800),
- KQU( 4746166512382823750), KQU(12720876014472464998),
- KQU( 8825177124486735972), KQU(13733447296837467838),
- KQU( 6412293741681359625), KQU( 8313213138756135033),
- KQU(11421481194803712517), KQU( 7997007691544174032),
- KQU( 6812963847917605930), KQU( 9683091901227558641),
- KQU(14703594165860324713), KQU( 1775476144519618309),
- KQU( 2724283288516469519), KQU( 717642555185856868),
- KQU( 8736402192215092346), KQU(11878800336431381021),
- KQU( 4348816066017061293), KQU( 6115112756583631307),
- KQU( 9176597239667142976), KQU(12615622714894259204),
- KQU(10283406711301385987), KQU( 5111762509485379420),
- KQU( 3118290051198688449), KQU( 7345123071632232145),
- KQU( 9176423451688682359), KQU( 4843865456157868971),
- KQU(12008036363752566088), KQU(12058837181919397720),
- KQU( 2145073958457347366), KQU( 1526504881672818067),
- KQU( 3488830105567134848), KQU(13208362960674805143),
- KQU( 4077549672899572192), KQU( 7770995684693818365),
- KQU( 1398532341546313593), KQU(12711859908703927840),
- KQU( 1417561172594446813), KQU(17045191024194170604),
- KQU( 4101933177604931713), KQU(14708428834203480320),
- KQU(17447509264469407724), KQU(14314821973983434255),
- KQU(17990472271061617265), KQU( 5087756685841673942),
- KQU(12797820586893859939), KQU( 1778128952671092879),
- KQU( 3535918530508665898), KQU( 9035729701042481301),
- KQU(14808661568277079962), KQU(14587345077537747914),
- KQU(11920080002323122708), KQU( 6426515805197278753),
- KQU( 3295612216725984831), KQU(11040722532100876120),
- KQU(12305952936387598754), KQU(16097391899742004253),
- KQU( 4908537335606182208), KQU(12446674552196795504),
- KQU(16010497855816895177), KQU( 9194378874788615551),
- KQU( 3382957529567613384), KQU( 5154647600754974077),
- KQU( 9801822865328396141), KQU( 9023662173919288143),
- KQU(17623115353825147868), KQU( 8238115767443015816),
- KQU(15811444159859002560), KQU( 9085612528904059661),
- KQU( 6888601089398614254), KQU( 258252992894160189),
- KQU( 6704363880792428622), KQU( 6114966032147235763),
- KQU(11075393882690261875), KQU( 8797664238933620407),
- KQU( 5901892006476726920), KQU( 5309780159285518958),
- KQU(14940808387240817367), KQU(14642032021449656698),
- KQU( 9808256672068504139), KQU( 3670135111380607658),
- KQU(11211211097845960152), KQU( 1474304506716695808),
- KQU(15843166204506876239), KQU( 7661051252471780561),
- KQU(10170905502249418476), KQU( 7801416045582028589),
- KQU( 2763981484737053050), KQU( 9491377905499253054),
- KQU(16201395896336915095), KQU( 9256513756442782198),
- KQU( 5411283157972456034), KQU( 5059433122288321676),
- KQU( 4327408006721123357), KQU( 9278544078834433377),
- KQU( 7601527110882281612), KQU(11848295896975505251),
- KQU(12096998801094735560), KQU(14773480339823506413),
- KQU(15586227433895802149), KQU(12786541257830242872),
- KQU( 6904692985140503067), KQU( 5309011515263103959),
- KQU(12105257191179371066), KQU(14654380212442225037),
- KQU( 2556774974190695009), KQU( 4461297399927600261),
- KQU(14888225660915118646), KQU(14915459341148291824),
- KQU( 2738802166252327631), KQU( 6047155789239131512),
- KQU(12920545353217010338), KQU(10697617257007840205),
- KQU( 2751585253158203504), KQU(13252729159780047496),
- KQU(14700326134672815469), KQU(14082527904374600529),
- KQU(16852962273496542070), KQU(17446675504235853907),
- KQU(15019600398527572311), KQU(12312781346344081551),
- KQU(14524667935039810450), KQU( 5634005663377195738),
- KQU(11375574739525000569), KQU( 2423665396433260040),
- KQU( 5222836914796015410), KQU( 4397666386492647387),
- KQU( 4619294441691707638), KQU( 665088602354770716),
- KQU(13246495665281593610), KQU( 6564144270549729409),
- KQU(10223216188145661688), KQU( 3961556907299230585),
- KQU(11543262515492439914), KQU(16118031437285993790),
- KQU( 7143417964520166465), KQU(13295053515909486772),
- KQU( 40434666004899675), KQU(17127804194038347164),
- KQU( 8599165966560586269), KQU( 8214016749011284903),
- KQU(13725130352140465239), KQU( 5467254474431726291),
- KQU( 7748584297438219877), KQU(16933551114829772472),
- KQU( 2169618439506799400), KQU( 2169787627665113463),
- KQU(17314493571267943764), KQU(18053575102911354912),
- KQU(11928303275378476973), KQU(11593850925061715550),
- KQU(17782269923473589362), KQU( 3280235307704747039),
- KQU( 6145343578598685149), KQU(17080117031114086090),
- KQU(18066839902983594755), KQU( 6517508430331020706),
- KQU( 8092908893950411541), KQU(12558378233386153732),
- KQU( 4476532167973132976), KQU(16081642430367025016),
- KQU( 4233154094369139361), KQU( 8693630486693161027),
- KQU(11244959343027742285), KQU(12273503967768513508),
- KQU(14108978636385284876), KQU( 7242414665378826984),
- KQU( 6561316938846562432), KQU( 8601038474994665795),
- KQU(17532942353612365904), KQU(17940076637020912186),
- KQU( 7340260368823171304), KQU( 7061807613916067905),
- KQU(10561734935039519326), KQU(17990796503724650862),
- KQU( 6208732943911827159), KQU( 359077562804090617),
- KQU(14177751537784403113), KQU(10659599444915362902),
- KQU(15081727220615085833), KQU(13417573895659757486),
- KQU(15513842342017811524), KQU(11814141516204288231),
- KQU( 1827312513875101814), KQU( 2804611699894603103),
- KQU(17116500469975602763), KQU(12270191815211952087),
- KQU(12256358467786024988), KQU(18435021722453971267),
- KQU( 671330264390865618), KQU( 476504300460286050),
- KQU(16465470901027093441), KQU( 4047724406247136402),
- KQU( 1322305451411883346), KQU( 1388308688834322280),
- KQU( 7303989085269758176), KQU( 9323792664765233642),
- KQU( 4542762575316368936), KQU(17342696132794337618),
- KQU( 4588025054768498379), KQU(13415475057390330804),
- KQU(17880279491733405570), KQU(10610553400618620353),
- KQU( 3180842072658960139), KQU(13002966655454270120),
- KQU( 1665301181064982826), KQU( 7083673946791258979),
- KQU( 190522247122496820), KQU(17388280237250677740),
- KQU( 8430770379923642945), KQU(12987180971921668584),
- KQU( 2311086108365390642), KQU( 2870984383579822345),
- KQU(14014682609164653318), KQU(14467187293062251484),
- KQU( 192186361147413298), KQU(15171951713531796524),
- KQU( 9900305495015948728), KQU(17958004775615466344),
- KQU(14346380954498606514), KQU(18040047357617407096),
- KQU( 5035237584833424532), KQU(15089555460613972287),
- KQU( 4131411873749729831), KQU( 1329013581168250330),
- KQU(10095353333051193949), KQU(10749518561022462716),
- KQU( 9050611429810755847), KQU(15022028840236655649),
- KQU( 8775554279239748298), KQU(13105754025489230502),
- KQU(15471300118574167585), KQU( 89864764002355628),
- KQU( 8776416323420466637), KQU( 5280258630612040891),
- KQU( 2719174488591862912), KQU( 7599309137399661994),
- KQU(15012887256778039979), KQU(14062981725630928925),
- KQU(12038536286991689603), KQU( 7089756544681775245),
- KQU(10376661532744718039), KQU( 1265198725901533130),
- KQU(13807996727081142408), KQU( 2935019626765036403),
- KQU( 7651672460680700141), KQU( 3644093016200370795),
- KQU( 2840982578090080674), KQU(17956262740157449201),
- KQU(18267979450492880548), KQU(11799503659796848070),
- KQU( 9942537025669672388), KQU(11886606816406990297),
- KQU( 5488594946437447576), KQU( 7226714353282744302),
- KQU( 3784851653123877043), KQU( 878018453244803041),
- KQU(12110022586268616085), KQU( 734072179404675123),
- KQU(11869573627998248542), KQU( 469150421297783998),
- KQU( 260151124912803804), KQU(11639179410120968649),
- KQU( 9318165193840846253), KQU(12795671722734758075),
- KQU(15318410297267253933), KQU( 691524703570062620),
- KQU( 5837129010576994601), KQU(15045963859726941052),
- KQU( 5850056944932238169), KQU(12017434144750943807),
- KQU( 7447139064928956574), KQU( 3101711812658245019),
- KQU(16052940704474982954), KQU(18195745945986994042),
- KQU( 8932252132785575659), KQU(13390817488106794834),
- KQU(11582771836502517453), KQU( 4964411326683611686),
- KQU( 2195093981702694011), KQU(14145229538389675669),
- KQU(16459605532062271798), KQU( 866316924816482864),
- KQU( 4593041209937286377), KQU( 8415491391910972138),
- KQU( 4171236715600528969), KQU(16637569303336782889),
- KQU( 2002011073439212680), KQU(17695124661097601411),
- KQU( 4627687053598611702), KQU( 7895831936020190403),
- KQU( 8455951300917267802), KQU( 2923861649108534854),
- KQU( 8344557563927786255), KQU( 6408671940373352556),
- KQU(12210227354536675772), KQU(14294804157294222295),
- KQU(10103022425071085127), KQU(10092959489504123771),
- KQU( 6554774405376736268), KQU(12629917718410641774),
- KQU( 6260933257596067126), KQU( 2460827021439369673),
- KQU( 2541962996717103668), KQU( 597377203127351475),
- KQU( 5316984203117315309), KQU( 4811211393563241961),
- KQU(13119698597255811641), KQU( 8048691512862388981),
- KQU(10216818971194073842), KQU( 4612229970165291764),
- KQU(10000980798419974770), KQU( 6877640812402540687),
- KQU( 1488727563290436992), KQU( 2227774069895697318),
- KQU(11237754507523316593), KQU(13478948605382290972),
- KQU( 1963583846976858124), KQU( 5512309205269276457),
- KQU( 3972770164717652347), KQU( 3841751276198975037),
- KQU(10283343042181903117), KQU( 8564001259792872199),
- KQU(16472187244722489221), KQU( 8953493499268945921),
- KQU( 3518747340357279580), KQU( 4003157546223963073),
- KQU( 3270305958289814590), KQU( 3966704458129482496),
- KQU( 8122141865926661939), KQU(14627734748099506653),
- KQU(13064426990862560568), KQU( 2414079187889870829),
- KQU( 5378461209354225306), KQU(10841985740128255566),
- KQU( 538582442885401738), KQU( 7535089183482905946),
- KQU(16117559957598879095), KQU( 8477890721414539741),
- KQU( 1459127491209533386), KQU(17035126360733620462),
- KQU( 8517668552872379126), KQU(10292151468337355014),
- KQU(17081267732745344157), KQU(13751455337946087178),
- KQU(14026945459523832966), KQU( 6653278775061723516),
- KQU(10619085543856390441), KQU( 2196343631481122885),
- KQU(10045966074702826136), KQU(10082317330452718282),
- KQU( 5920859259504831242), KQU( 9951879073426540617),
- KQU( 7074696649151414158), KQU(15808193543879464318),
- KQU( 7385247772746953374), KQU( 3192003544283864292),
- KQU(18153684490917593847), KQU(12423498260668568905),
- KQU(10957758099756378169), KQU(11488762179911016040),
- KQU( 2099931186465333782), KQU(11180979581250294432),
- KQU( 8098916250668367933), KQU( 3529200436790763465),
- KQU(12988418908674681745), KQU( 6147567275954808580),
- KQU( 3207503344604030989), KQU(10761592604898615360),
- KQU( 229854861031893504), KQU( 8809853962667144291),
- KQU(13957364469005693860), KQU( 7634287665224495886),
- KQU(12353487366976556874), KQU( 1134423796317152034),
- KQU( 2088992471334107068), KQU( 7393372127190799698),
- KQU( 1845367839871058391), KQU( 207922563987322884),
- KQU(11960870813159944976), KQU(12182120053317317363),
- KQU(17307358132571709283), KQU(13871081155552824936),
- KQU(18304446751741566262), KQU( 7178705220184302849),
- KQU(10929605677758824425), KQU(16446976977835806844),
- KQU(13723874412159769044), KQU( 6942854352100915216),
- KQU( 1726308474365729390), KQU( 2150078766445323155),
- KQU(15345558947919656626), KQU(12145453828874527201),
- KQU( 2054448620739726849), KQU( 2740102003352628137),
- KQU(11294462163577610655), KQU( 756164283387413743),
- KQU(17841144758438810880), KQU(10802406021185415861),
- KQU( 8716455530476737846), KQU( 6321788834517649606),
- KQU(14681322910577468426), KQU(17330043563884336387),
- KQU(12701802180050071614), KQU(14695105111079727151),
- KQU( 5112098511654172830), KQU( 4957505496794139973),
- KQU( 8270979451952045982), KQU(12307685939199120969),
- KQU(12425799408953443032), KQU( 8376410143634796588),
- KQU(16621778679680060464), KQU( 3580497854566660073),
- KQU( 1122515747803382416), KQU( 857664980960597599),
- KQU( 6343640119895925918), KQU(12878473260854462891),
- KQU(10036813920765722626), KQU(14451335468363173812),
- KQU( 5476809692401102807), KQU(16442255173514366342),
- KQU(13060203194757167104), KQU(14354124071243177715),
- KQU(15961249405696125227), KQU(13703893649690872584),
- KQU( 363907326340340064), KQU( 6247455540491754842),
- KQU(12242249332757832361), KQU( 156065475679796717),
- KQU( 9351116235749732355), KQU( 4590350628677701405),
- KQU( 1671195940982350389), KQU(13501398458898451905),
- KQU( 6526341991225002255), KQU( 1689782913778157592),
- KQU( 7439222350869010334), KQU(13975150263226478308),
- KQU(11411961169932682710), KQU(17204271834833847277),
- KQU( 541534742544435367), KQU( 6591191931218949684),
- KQU( 2645454775478232486), KQU( 4322857481256485321),
- KQU( 8477416487553065110), KQU(12902505428548435048),
- KQU( 971445777981341415), KQU(14995104682744976712),
- KQU( 4243341648807158063), KQU( 8695061252721927661),
- KQU( 5028202003270177222), KQU( 2289257340915567840),
- KQU(13870416345121866007), KQU(13994481698072092233),
- KQU( 6912785400753196481), KQU( 2278309315841980139),
- KQU( 4329765449648304839), KQU( 5963108095785485298),
- KQU( 4880024847478722478), KQU(16015608779890240947),
- KQU( 1866679034261393544), KQU( 914821179919731519),
- KQU( 9643404035648760131), KQU( 2418114953615593915),
- KQU( 944756836073702374), KQU(15186388048737296834),
- KQU( 7723355336128442206), KQU( 7500747479679599691),
- KQU(18013961306453293634), KQU( 2315274808095756456),
- KQU(13655308255424029566), KQU(17203800273561677098),
- KQU( 1382158694422087756), KQU( 5090390250309588976),
- KQU( 517170818384213989), KQU( 1612709252627729621),
- KQU( 1330118955572449606), KQU( 300922478056709885),
- KQU(18115693291289091987), KQU(13491407109725238321),
- KQU(15293714633593827320), KQU( 5151539373053314504),
- KQU( 5951523243743139207), KQU(14459112015249527975),
- KQU( 5456113959000700739), KQU( 3877918438464873016),
- KQU(12534071654260163555), KQU(15871678376893555041),
- KQU(11005484805712025549), KQU(16353066973143374252),
- KQU( 4358331472063256685), KQU( 8268349332210859288),
- KQU(12485161590939658075), KQU(13955993592854471343),
- KQU( 5911446886848367039), KQU(14925834086813706974),
- KQU( 6590362597857994805), KQU( 1280544923533661875),
- KQU( 1637756018947988164), KQU( 4734090064512686329),
- KQU(16693705263131485912), KQU( 6834882340494360958),
- KQU( 8120732176159658505), KQU( 2244371958905329346),
- KQU(10447499707729734021), KQU( 7318742361446942194),
- KQU( 8032857516355555296), KQU(14023605983059313116),
- KQU( 1032336061815461376), KQU( 9840995337876562612),
- KQU( 9869256223029203587), KQU(12227975697177267636),
- KQU(12728115115844186033), KQU( 7752058479783205470),
- KQU( 729733219713393087), KQU(12954017801239007622)
-};
-static const uint64_t init_by_array_64_expected[] = {
- KQU( 2100341266307895239), KQU( 8344256300489757943),
- KQU(15687933285484243894), KQU( 8268620370277076319),
- KQU(12371852309826545459), KQU( 8800491541730110238),
- KQU(18113268950100835773), KQU( 2886823658884438119),
- KQU( 3293667307248180724), KQU( 9307928143300172731),
- KQU( 7688082017574293629), KQU( 900986224735166665),
- KQU( 9977972710722265039), KQU( 6008205004994830552),
- KQU( 546909104521689292), KQU( 7428471521869107594),
- KQU(14777563419314721179), KQU(16116143076567350053),
- KQU( 5322685342003142329), KQU( 4200427048445863473),
- KQU( 4693092150132559146), KQU(13671425863759338582),
- KQU( 6747117460737639916), KQU( 4732666080236551150),
- KQU( 5912839950611941263), KQU( 3903717554504704909),
- KQU( 2615667650256786818), KQU(10844129913887006352),
- KQU(13786467861810997820), KQU(14267853002994021570),
- KQU(13767807302847237439), KQU(16407963253707224617),
- KQU( 4802498363698583497), KQU( 2523802839317209764),
- KQU( 3822579397797475589), KQU( 8950320572212130610),
- KQU( 3745623504978342534), KQU(16092609066068482806),
- KQU( 9817016950274642398), KQU(10591660660323829098),
- KQU(11751606650792815920), KQU( 5122873818577122211),
- KQU(17209553764913936624), KQU( 6249057709284380343),
- KQU(15088791264695071830), KQU(15344673071709851930),
- KQU( 4345751415293646084), KQU( 2542865750703067928),
- KQU(13520525127852368784), KQU(18294188662880997241),
- KQU( 3871781938044881523), KQU( 2873487268122812184),
- KQU(15099676759482679005), KQU(15442599127239350490),
- KQU( 6311893274367710888), KQU( 3286118760484672933),
- KQU( 4146067961333542189), KQU(13303942567897208770),
- KQU( 8196013722255630418), KQU( 4437815439340979989),
- KQU(15433791533450605135), KQU( 4254828956815687049),
- KQU( 1310903207708286015), KQU(10529182764462398549),
- KQU(14900231311660638810), KQU( 9727017277104609793),
- KQU( 1821308310948199033), KQU(11628861435066772084),
- KQU( 9469019138491546924), KQU( 3145812670532604988),
- KQU( 9938468915045491919), KQU( 1562447430672662142),
- KQU(13963995266697989134), KQU( 3356884357625028695),
- KQU( 4499850304584309747), KQU( 8456825817023658122),
- KQU(10859039922814285279), KQU( 8099512337972526555),
- KQU( 348006375109672149), KQU(11919893998241688603),
- KQU( 1104199577402948826), KQU(16689191854356060289),
- KQU(10992552041730168078), KQU( 7243733172705465836),
- KQU( 5668075606180319560), KQU(18182847037333286970),
- KQU( 4290215357664631322), KQU( 4061414220791828613),
- KQU(13006291061652989604), KQU( 7140491178917128798),
- KQU(12703446217663283481), KQU( 5500220597564558267),
- KQU(10330551509971296358), KQU(15958554768648714492),
- KQU( 5174555954515360045), KQU( 1731318837687577735),
- KQU( 3557700801048354857), KQU(13764012341928616198),
- KQU(13115166194379119043), KQU( 7989321021560255519),
- KQU( 2103584280905877040), KQU( 9230788662155228488),
- KQU(16396629323325547654), KQU( 657926409811318051),
- KQU(15046700264391400727), KQU( 5120132858771880830),
- KQU( 7934160097989028561), KQU( 6963121488531976245),
- KQU(17412329602621742089), KQU(15144843053931774092),
- KQU(17204176651763054532), KQU(13166595387554065870),
- KQU( 8590377810513960213), KQU( 5834365135373991938),
- KQU( 7640913007182226243), KQU( 3479394703859418425),
- KQU(16402784452644521040), KQU( 4993979809687083980),
- KQU(13254522168097688865), KQU(15643659095244365219),
- KQU( 5881437660538424982), KQU(11174892200618987379),
- KQU( 254409966159711077), KQU(17158413043140549909),
- KQU( 3638048789290376272), KQU( 1376816930299489190),
- KQU( 4622462095217761923), KQU(15086407973010263515),
- KQU(13253971772784692238), KQU( 5270549043541649236),
- KQU(11182714186805411604), KQU(12283846437495577140),
- KQU( 5297647149908953219), KQU(10047451738316836654),
- KQU( 4938228100367874746), KQU(12328523025304077923),
- KQU( 3601049438595312361), KQU( 9313624118352733770),
- KQU(13322966086117661798), KQU(16660005705644029394),
- KQU(11337677526988872373), KQU(13869299102574417795),
- KQU(15642043183045645437), KQU( 3021755569085880019),
- KQU( 4979741767761188161), KQU(13679979092079279587),
- KQU( 3344685842861071743), KQU(13947960059899588104),
- KQU( 305806934293368007), KQU( 5749173929201650029),
- KQU(11123724852118844098), KQU(15128987688788879802),
- KQU(15251651211024665009), KQU( 7689925933816577776),
- KQU(16732804392695859449), KQU(17087345401014078468),
- KQU(14315108589159048871), KQU( 4820700266619778917),
- KQU(16709637539357958441), KQU( 4936227875177351374),
- KQU( 2137907697912987247), KQU(11628565601408395420),
- KQU( 2333250549241556786), KQU( 5711200379577778637),
- KQU( 5170680131529031729), KQU(12620392043061335164),
- KQU( 95363390101096078), KQU( 5487981914081709462),
- KQU( 1763109823981838620), KQU( 3395861271473224396),
- KQU( 1300496844282213595), KQU( 6894316212820232902),
- KQU(10673859651135576674), KQU( 5911839658857903252),
- KQU(17407110743387299102), KQU( 8257427154623140385),
- KQU(11389003026741800267), KQU( 4070043211095013717),
- KQU(11663806997145259025), KQU(15265598950648798210),
- KQU( 630585789434030934), KQU( 3524446529213587334),
- KQU( 7186424168495184211), KQU(10806585451386379021),
- KQU(11120017753500499273), KQU( 1586837651387701301),
- KQU(17530454400954415544), KQU( 9991670045077880430),
- KQU( 7550997268990730180), KQU( 8640249196597379304),
- KQU( 3522203892786893823), KQU(10401116549878854788),
- KQU(13690285544733124852), KQU( 8295785675455774586),
- KQU(15535716172155117603), KQU( 3112108583723722511),
- KQU(17633179955339271113), KQU(18154208056063759375),
- KQU( 1866409236285815666), KQU(13326075895396412882),
- KQU( 8756261842948020025), KQU( 6281852999868439131),
- KQU(15087653361275292858), KQU(10333923911152949397),
- KQU( 5265567645757408500), KQU(12728041843210352184),
- KQU( 6347959327507828759), KQU( 154112802625564758),
- KQU(18235228308679780218), KQU( 3253805274673352418),
- KQU( 4849171610689031197), KQU(17948529398340432518),
- KQU(13803510475637409167), KQU(13506570190409883095),
- KQU(15870801273282960805), KQU( 8451286481299170773),
- KQU( 9562190620034457541), KQU( 8518905387449138364),
- KQU(12681306401363385655), KQU( 3788073690559762558),
- KQU( 5256820289573487769), KQU( 2752021372314875467),
- KQU( 6354035166862520716), KQU( 4328956378309739069),
- KQU( 449087441228269600), KQU( 5533508742653090868),
- KQU( 1260389420404746988), KQU(18175394473289055097),
- KQU( 1535467109660399420), KQU( 8818894282874061442),
- KQU(12140873243824811213), KQU(15031386653823014946),
- KQU( 1286028221456149232), KQU( 6329608889367858784),
- KQU( 9419654354945132725), KQU( 6094576547061672379),
- KQU(17706217251847450255), KQU( 1733495073065878126),
- KQU(16918923754607552663), KQU( 8881949849954945044),
- KQU(12938977706896313891), KQU(14043628638299793407),
- KQU(18393874581723718233), KQU( 6886318534846892044),
- KQU(14577870878038334081), KQU(13541558383439414119),
- KQU(13570472158807588273), KQU(18300760537910283361),
- KQU( 818368572800609205), KQU( 1417000585112573219),
- KQU(12337533143867683655), KQU(12433180994702314480),
- KQU( 778190005829189083), KQU(13667356216206524711),
- KQU( 9866149895295225230), KQU(11043240490417111999),
- KQU( 1123933826541378598), KQU( 6469631933605123610),
- KQU(14508554074431980040), KQU(13918931242962026714),
- KQU( 2870785929342348285), KQU(14786362626740736974),
- KQU(13176680060902695786), KQU( 9591778613541679456),
- KQU( 9097662885117436706), KQU( 749262234240924947),
- KQU( 1944844067793307093), KQU( 4339214904577487742),
- KQU( 8009584152961946551), KQU(16073159501225501777),
- KQU( 3335870590499306217), KQU(17088312653151202847),
- KQU( 3108893142681931848), KQU(16636841767202792021),
- KQU(10423316431118400637), KQU( 8008357368674443506),
- KQU(11340015231914677875), KQU(17687896501594936090),
- KQU(15173627921763199958), KQU( 542569482243721959),
- KQU(15071714982769812975), KQU( 4466624872151386956),
- KQU( 1901780715602332461), KQU( 9822227742154351098),
- KQU( 1479332892928648780), KQU( 6981611948382474400),
- KQU( 7620824924456077376), KQU(14095973329429406782),
- KQU( 7902744005696185404), KQU(15830577219375036920),
- KQU(10287076667317764416), KQU(12334872764071724025),
- KQU( 4419302088133544331), KQU(14455842851266090520),
- KQU(12488077416504654222), KQU( 7953892017701886766),
- KQU( 6331484925529519007), KQU( 4902145853785030022),
- KQU(17010159216096443073), KQU(11945354668653886087),
- KQU(15112022728645230829), KQU(17363484484522986742),
- KQU( 4423497825896692887), KQU( 8155489510809067471),
- KQU( 258966605622576285), KQU( 5462958075742020534),
- KQU( 6763710214913276228), KQU( 2368935183451109054),
- KQU(14209506165246453811), KQU( 2646257040978514881),
- KQU( 3776001911922207672), KQU( 1419304601390147631),
- KQU(14987366598022458284), KQU( 3977770701065815721),
- KQU( 730820417451838898), KQU( 3982991703612885327),
- KQU( 2803544519671388477), KQU(17067667221114424649),
- KQU( 2922555119737867166), KQU( 1989477584121460932),
- KQU(15020387605892337354), KQU( 9293277796427533547),
- KQU(10722181424063557247), KQU(16704542332047511651),
- KQU( 5008286236142089514), KQU(16174732308747382540),
- KQU(17597019485798338402), KQU(13081745199110622093),
- KQU( 8850305883842258115), KQU(12723629125624589005),
- KQU( 8140566453402805978), KQU(15356684607680935061),
- KQU(14222190387342648650), KQU(11134610460665975178),
- KQU( 1259799058620984266), KQU(13281656268025610041),
- KQU( 298262561068153992), KQU(12277871700239212922),
- KQU(13911297774719779438), KQU(16556727962761474934),
- KQU(17903010316654728010), KQU( 9682617699648434744),
- KQU(14757681836838592850), KQU( 1327242446558524473),
- KQU(11126645098780572792), KQU( 1883602329313221774),
- KQU( 2543897783922776873), KQU(15029168513767772842),
- KQU(12710270651039129878), KQU(16118202956069604504),
- KQU(15010759372168680524), KQU( 2296827082251923948),
- KQU(10793729742623518101), KQU(13829764151845413046),
- KQU(17769301223184451213), KQU( 3118268169210783372),
- KQU(17626204544105123127), KQU( 7416718488974352644),
- KQU(10450751996212925994), KQU( 9352529519128770586),
- KQU( 259347569641110140), KQU( 8048588892269692697),
- KQU( 1774414152306494058), KQU(10669548347214355622),
- KQU(13061992253816795081), KQU(18432677803063861659),
- KQU( 8879191055593984333), KQU(12433753195199268041),
- KQU(14919392415439730602), KQU( 6612848378595332963),
- KQU( 6320986812036143628), KQU(10465592420226092859),
- KQU( 4196009278962570808), KQU( 3747816564473572224),
- KQU(17941203486133732898), KQU( 2350310037040505198),
- KQU( 5811779859134370113), KQU(10492109599506195126),
- KQU( 7699650690179541274), KQU( 1954338494306022961),
- KQU(14095816969027231152), KQU( 5841346919964852061),
- KQU(14945969510148214735), KQU( 3680200305887550992),
- KQU( 6218047466131695792), KQU( 8242165745175775096),
- KQU(11021371934053307357), KQU( 1265099502753169797),
- KQU( 4644347436111321718), KQU( 3609296916782832859),
- KQU( 8109807992218521571), KQU(18387884215648662020),
- KQU(14656324896296392902), KQU(17386819091238216751),
- KQU(17788300878582317152), KQU( 7919446259742399591),
- KQU( 4466613134576358004), KQU(12928181023667938509),
- KQU(13147446154454932030), KQU(16552129038252734620),
- KQU( 8395299403738822450), KQU(11313817655275361164),
- KQU( 434258809499511718), KQU( 2074882104954788676),
- KQU( 7929892178759395518), KQU( 9006461629105745388),
- KQU( 5176475650000323086), KQU(11128357033468341069),
- KQU(12026158851559118955), KQU(14699716249471156500),
- KQU( 448982497120206757), KQU( 4156475356685519900),
- KQU( 6063816103417215727), KQU(10073289387954971479),
- KQU( 8174466846138590962), KQU( 2675777452363449006),
- KQU( 9090685420572474281), KQU( 6659652652765562060),
- KQU(12923120304018106621), KQU(11117480560334526775),
- KQU( 937910473424587511), KQU( 1838692113502346645),
- KQU(11133914074648726180), KQU( 7922600945143884053),
- KQU(13435287702700959550), KQU( 5287964921251123332),
- KQU(11354875374575318947), KQU(17955724760748238133),
- KQU(13728617396297106512), KQU( 4107449660118101255),
- KQU( 1210269794886589623), KQU(11408687205733456282),
- KQU( 4538354710392677887), KQU(13566803319341319267),
- KQU(17870798107734050771), KQU( 3354318982568089135),
- KQU( 9034450839405133651), KQU(13087431795753424314),
- KQU( 950333102820688239), KQU( 1968360654535604116),
- KQU(16840551645563314995), KQU( 8867501803892924995),
- KQU(11395388644490626845), KQU( 1529815836300732204),
- KQU(13330848522996608842), KQU( 1813432878817504265),
- KQU( 2336867432693429560), KQU(15192805445973385902),
- KQU( 2528593071076407877), KQU( 128459777936689248),
- KQU( 9976345382867214866), KQU( 6208885766767996043),
- KQU(14982349522273141706), KQU( 3099654362410737822),
- KQU(13776700761947297661), KQU( 8806185470684925550),
- KQU( 8151717890410585321), KQU( 640860591588072925),
- KQU(14592096303937307465), KQU( 9056472419613564846),
- KQU(14861544647742266352), KQU(12703771500398470216),
- KQU( 3142372800384138465), KQU( 6201105606917248196),
- KQU(18337516409359270184), KQU(15042268695665115339),
- KQU(15188246541383283846), KQU(12800028693090114519),
- KQU( 5992859621101493472), KQU(18278043971816803521),
- KQU( 9002773075219424560), KQU( 7325707116943598353),
- KQU( 7930571931248040822), KQU( 5645275869617023448),
- KQU( 7266107455295958487), KQU( 4363664528273524411),
- KQU(14313875763787479809), KQU(17059695613553486802),
- KQU( 9247761425889940932), KQU(13704726459237593128),
- KQU( 2701312427328909832), KQU(17235532008287243115),
- KQU(14093147761491729538), KQU( 6247352273768386516),
- KQU( 8268710048153268415), KQU( 7985295214477182083),
- KQU(15624495190888896807), KQU( 3772753430045262788),
- KQU( 9133991620474991698), KQU( 5665791943316256028),
- KQU( 7551996832462193473), KQU(13163729206798953877),
- KQU( 9263532074153846374), KQU( 1015460703698618353),
- KQU(17929874696989519390), KQU(18257884721466153847),
- KQU(16271867543011222991), KQU( 3905971519021791941),
- KQU(16814488397137052085), KQU( 1321197685504621613),
- KQU( 2870359191894002181), KQU(14317282970323395450),
- KQU(13663920845511074366), KQU( 2052463995796539594),
- KQU(14126345686431444337), KQU( 1727572121947022534),
- KQU(17793552254485594241), KQU( 6738857418849205750),
- KQU( 1282987123157442952), KQU(16655480021581159251),
- KQU( 6784587032080183866), KQU(14726758805359965162),
- KQU( 7577995933961987349), KQU(12539609320311114036),
- KQU(10789773033385439494), KQU( 8517001497411158227),
- KQU(10075543932136339710), KQU(14838152340938811081),
- KQU( 9560840631794044194), KQU(17445736541454117475),
- KQU(10633026464336393186), KQU(15705729708242246293),
- KQU( 1117517596891411098), KQU( 4305657943415886942),
- KQU( 4948856840533979263), KQU(16071681989041789593),
- KQU(13723031429272486527), KQU( 7639567622306509462),
- KQU(12670424537483090390), KQU( 9715223453097197134),
- KQU( 5457173389992686394), KQU( 289857129276135145),
- KQU(17048610270521972512), KQU( 692768013309835485),
- KQU(14823232360546632057), KQU(18218002361317895936),
- KQU( 3281724260212650204), KQU(16453957266549513795),
- KQU( 8592711109774511881), KQU( 929825123473369579),
- KQU(15966784769764367791), KQU( 9627344291450607588),
- KQU(10849555504977813287), KQU( 9234566913936339275),
- KQU( 6413807690366911210), KQU(10862389016184219267),
- KQU(13842504799335374048), KQU( 1531994113376881174),
- KQU( 2081314867544364459), KQU(16430628791616959932),
- KQU( 8314714038654394368), KQU( 9155473892098431813),
- KQU(12577843786670475704), KQU( 4399161106452401017),
- KQU( 1668083091682623186), KQU( 1741383777203714216),
- KQU( 2162597285417794374), KQU(15841980159165218736),
- KQU( 1971354603551467079), KQU( 1206714764913205968),
- KQU( 4790860439591272330), KQU(14699375615594055799),
- KQU( 8374423871657449988), KQU(10950685736472937738),
- KQU( 697344331343267176), KQU(10084998763118059810),
- KQU(12897369539795983124), KQU(12351260292144383605),
- KQU( 1268810970176811234), KQU( 7406287800414582768),
- KQU( 516169557043807831), KQU( 5077568278710520380),
- KQU( 3828791738309039304), KQU( 7721974069946943610),
- KQU( 3534670260981096460), KQU( 4865792189600584891),
- KQU(16892578493734337298), KQU( 9161499464278042590),
- KQU(11976149624067055931), KQU(13219479887277343990),
- KQU(14161556738111500680), KQU(14670715255011223056),
- KQU( 4671205678403576558), KQU(12633022931454259781),
- KQU(14821376219869187646), KQU( 751181776484317028),
- KQU( 2192211308839047070), KQU(11787306362361245189),
- KQU(10672375120744095707), KQU( 4601972328345244467),
- KQU(15457217788831125879), KQU( 8464345256775460809),
- KQU(10191938789487159478), KQU( 6184348739615197613),
- KQU(11425436778806882100), KQU( 2739227089124319793),
- KQU( 461464518456000551), KQU( 4689850170029177442),
- KQU( 6120307814374078625), KQU(11153579230681708671),
- KQU( 7891721473905347926), KQU(10281646937824872400),
- KQU( 3026099648191332248), KQU( 8666750296953273818),
- KQU(14978499698844363232), KQU(13303395102890132065),
- KQU( 8182358205292864080), KQU(10560547713972971291),
- KQU(11981635489418959093), KQU( 3134621354935288409),
- KQU(11580681977404383968), KQU(14205530317404088650),
- KQU( 5997789011854923157), KQU(13659151593432238041),
- KQU(11664332114338865086), KQU( 7490351383220929386),
- KQU( 7189290499881530378), KQU(15039262734271020220),
- KQU( 2057217285976980055), KQU( 555570804905355739),
- KQU(11235311968348555110), KQU(13824557146269603217),
- KQU(16906788840653099693), KQU( 7222878245455661677),
- KQU( 5245139444332423756), KQU( 4723748462805674292),
- KQU(12216509815698568612), KQU(17402362976648951187),
- KQU(17389614836810366768), KQU( 4880936484146667711),
- KQU( 9085007839292639880), KQU(13837353458498535449),
- KQU(11914419854360366677), KQU(16595890135313864103),
- KQU( 6313969847197627222), KQU(18296909792163910431),
- KQU(10041780113382084042), KQU( 2499478551172884794),
- KQU(11057894246241189489), KQU( 9742243032389068555),
- KQU(12838934582673196228), KQU(13437023235248490367),
- KQU(13372420669446163240), KQU( 6752564244716909224),
- KQU( 7157333073400313737), KQU(12230281516370654308),
- KQU( 1182884552219419117), KQU( 2955125381312499218),
- KQU(10308827097079443249), KQU( 1337648572986534958),
- KQU(16378788590020343939), KQU( 108619126514420935),
- KQU( 3990981009621629188), KQU( 5460953070230946410),
- KQU( 9703328329366531883), KQU(13166631489188077236),
- KQU( 1104768831213675170), KQU( 3447930458553877908),
- KQU( 8067172487769945676), KQU( 5445802098190775347),
- KQU( 3244840981648973873), KQU(17314668322981950060),
- KQU( 5006812527827763807), KQU(18158695070225526260),
- KQU( 2824536478852417853), KQU(13974775809127519886),
- KQU( 9814362769074067392), KQU(17276205156374862128),
- KQU(11361680725379306967), KQU( 3422581970382012542),
- KQU(11003189603753241266), KQU(11194292945277862261),
- KQU( 6839623313908521348), KQU(11935326462707324634),
- KQU( 1611456788685878444), KQU(13112620989475558907),
- KQU( 517659108904450427), KQU(13558114318574407624),
- KQU(15699089742731633077), KQU( 4988979278862685458),
- KQU( 8111373583056521297), KQU( 3891258746615399627),
- KQU( 8137298251469718086), KQU(12748663295624701649),
- KQU( 4389835683495292062), KQU( 5775217872128831729),
- KQU( 9462091896405534927), KQU( 8498124108820263989),
- KQU( 8059131278842839525), KQU(10503167994254090892),
- KQU(11613153541070396656), KQU(18069248738504647790),
- KQU( 570657419109768508), KQU( 3950574167771159665),
- KQU( 5514655599604313077), KQU( 2908460854428484165),
- KQU(10777722615935663114), KQU(12007363304839279486),
- KQU( 9800646187569484767), KQU( 8795423564889864287),
- KQU(14257396680131028419), KQU( 6405465117315096498),
- KQU( 7939411072208774878), KQU(17577572378528990006),
- KQU(14785873806715994850), KQU(16770572680854747390),
- KQU(18127549474419396481), KQU(11637013449455757750),
- KQU(14371851933996761086), KQU( 3601181063650110280),
- KQU( 4126442845019316144), KQU(10198287239244320669),
- KQU(18000169628555379659), KQU(18392482400739978269),
- KQU( 6219919037686919957), KQU( 3610085377719446052),
- KQU( 2513925039981776336), KQU(16679413537926716955),
- KQU(12903302131714909434), KQU( 5581145789762985009),
- KQU(12325955044293303233), KQU(17216111180742141204),
- KQU( 6321919595276545740), KQU( 3507521147216174501),
- KQU( 9659194593319481840), KQU(11473976005975358326),
- KQU(14742730101435987026), KQU( 492845897709954780),
- KQU(16976371186162599676), KQU(17712703422837648655),
- KQU( 9881254778587061697), KQU( 8413223156302299551),
- KQU( 1563841828254089168), KQU( 9996032758786671975),
- KQU( 138877700583772667), KQU(13003043368574995989),
- KQU( 4390573668650456587), KQU( 8610287390568126755),
- KQU(15126904974266642199), KQU( 6703637238986057662),
- KQU( 2873075592956810157), KQU( 6035080933946049418),
- KQU(13382846581202353014), KQU( 7303971031814642463),
- KQU(18418024405307444267), KQU( 5847096731675404647),
- KQU( 4035880699639842500), KQU(11525348625112218478),
- KQU( 3041162365459574102), KQU( 2604734487727986558),
- KQU(15526341771636983145), KQU(14556052310697370254),
- KQU(12997787077930808155), KQU( 9601806501755554499),
- KQU(11349677952521423389), KQU(14956777807644899350),
- KQU(16559736957742852721), KQU(12360828274778140726),
- KQU( 6685373272009662513), KQU(16932258748055324130),
- KQU(15918051131954158508), KQU( 1692312913140790144),
- KQU( 546653826801637367), KQU( 5341587076045986652),
- KQU(14975057236342585662), KQU(12374976357340622412),
- KQU(10328833995181940552), KQU(12831807101710443149),
- KQU(10548514914382545716), KQU( 2217806727199715993),
- KQU(12627067369242845138), KQU( 4598965364035438158),
- KQU( 150923352751318171), KQU(14274109544442257283),
- KQU( 4696661475093863031), KQU( 1505764114384654516),
- KQU(10699185831891495147), KQU( 2392353847713620519),
- KQU( 3652870166711788383), KQU( 8640653276221911108),
- KQU( 3894077592275889704), KQU( 4918592872135964845),
- KQU(16379121273281400789), KQU(12058465483591683656),
- KQU(11250106829302924945), KQU( 1147537556296983005),
- KQU( 6376342756004613268), KQU(14967128191709280506),
- KQU(18007449949790627628), KQU( 9497178279316537841),
- KQU( 7920174844809394893), KQU(10037752595255719907),
- KQU(15875342784985217697), KQU(15311615921712850696),
- KQU( 9552902652110992950), KQU(14054979450099721140),
- KQU( 5998709773566417349), KQU(18027910339276320187),
- KQU( 8223099053868585554), KQU( 7842270354824999767),
- KQU( 4896315688770080292), KQU(12969320296569787895),
- KQU( 2674321489185759961), KQU( 4053615936864718439),
- KQU(11349775270588617578), KQU( 4743019256284553975),
- KQU( 5602100217469723769), KQU(14398995691411527813),
- KQU( 7412170493796825470), KQU( 836262406131744846),
- KQU( 8231086633845153022), KQU( 5161377920438552287),
- KQU( 8828731196169924949), KQU(16211142246465502680),
- KQU( 3307990879253687818), KQU( 5193405406899782022),
- KQU( 8510842117467566693), KQU( 6070955181022405365),
- KQU(14482950231361409799), KQU(12585159371331138077),
- KQU( 3511537678933588148), KQU( 2041849474531116417),
- KQU(10944936685095345792), KQU(18303116923079107729),
- KQU( 2720566371239725320), KQU( 4958672473562397622),
- KQU( 3032326668253243412), KQU(13689418691726908338),
- KQU( 1895205511728843996), KQU( 8146303515271990527),
- KQU(16507343500056113480), KQU( 473996939105902919),
- KQU( 9897686885246881481), KQU(14606433762712790575),
- KQU( 6732796251605566368), KQU( 1399778120855368916),
- KQU( 935023885182833777), KQU(16066282816186753477),
- KQU( 7291270991820612055), KQU(17530230393129853844),
- KQU(10223493623477451366), KQU(15841725630495676683),
- KQU(17379567246435515824), KQU( 8588251429375561971),
- KQU(18339511210887206423), KQU(17349587430725976100),
- KQU(12244876521394838088), KQU( 6382187714147161259),
- KQU(12335807181848950831), KQU(16948885622305460665),
- KQU(13755097796371520506), KQU(14806740373324947801),
- KQU( 4828699633859287703), KQU( 8209879281452301604),
- KQU(12435716669553736437), KQU(13970976859588452131),
- KQU( 6233960842566773148), KQU(12507096267900505759),
- KQU( 1198713114381279421), KQU(14989862731124149015),
- KQU(15932189508707978949), KQU( 2526406641432708722),
- KQU( 29187427817271982), KQU( 1499802773054556353),
- KQU(10816638187021897173), KQU( 5436139270839738132),
- KQU( 6659882287036010082), KQU( 2154048955317173697),
- KQU(10887317019333757642), KQU(16281091802634424955),
- KQU(10754549879915384901), KQU(10760611745769249815),
- KQU( 2161505946972504002), KQU( 5243132808986265107),
- KQU(10129852179873415416), KQU( 710339480008649081),
- KQU( 7802129453068808528), KQU(17967213567178907213),
- KQU(15730859124668605599), KQU(13058356168962376502),
- KQU( 3701224985413645909), KQU(14464065869149109264),
- KQU( 9959272418844311646), KQU(10157426099515958752),
- KQU(14013736814538268528), KQU(17797456992065653951),
- KQU(17418878140257344806), KQU(15457429073540561521),
- KQU( 2184426881360949378), KQU( 2062193041154712416),
- KQU( 8553463347406931661), KQU( 4913057625202871854),
- KQU( 2668943682126618425), KQU(17064444737891172288),
- KQU( 4997115903913298637), KQU(12019402608892327416),
- KQU(17603584559765897352), KQU(11367529582073647975),
- KQU( 8211476043518436050), KQU( 8676849804070323674),
- KQU(18431829230394475730), KQU(10490177861361247904),
- KQU( 9508720602025651349), KQU( 7409627448555722700),
- KQU( 5804047018862729008), KQU(11943858176893142594),
- KQU(11908095418933847092), KQU( 5415449345715887652),
- KQU( 1554022699166156407), KQU( 9073322106406017161),
- KQU( 7080630967969047082), KQU(18049736940860732943),
- KQU(12748714242594196794), KQU( 1226992415735156741),
- KQU(17900981019609531193), KQU(11720739744008710999),
- KQU( 3006400683394775434), KQU(11347974011751996028),
- KQU( 3316999628257954608), KQU( 8384484563557639101),
- KQU(18117794685961729767), KQU( 1900145025596618194),
- KQU(17459527840632892676), KQU( 5634784101865710994),
- KQU( 7918619300292897158), KQU( 3146577625026301350),
- KQU( 9955212856499068767), KQU( 1873995843681746975),
- KQU( 1561487759967972194), KQU( 8322718804375878474),
- KQU(11300284215327028366), KQU( 4667391032508998982),
- KQU( 9820104494306625580), KQU(17922397968599970610),
- KQU( 1784690461886786712), KQU(14940365084341346821),
- KQU( 5348719575594186181), KQU(10720419084507855261),
- KQU(14210394354145143274), KQU( 2426468692164000131),
- KQU(16271062114607059202), KQU(14851904092357070247),
- KQU( 6524493015693121897), KQU( 9825473835127138531),
- KQU(14222500616268569578), KQU(15521484052007487468),
- KQU(14462579404124614699), KQU(11012375590820665520),
- KQU(11625327350536084927), KQU(14452017765243785417),
- KQU( 9989342263518766305), KQU( 3640105471101803790),
- KQU( 4749866455897513242), KQU(13963064946736312044),
- KQU(10007416591973223791), KQU(18314132234717431115),
- KQU( 3286596588617483450), KQU( 7726163455370818765),
- KQU( 7575454721115379328), KQU( 5308331576437663422),
- KQU(18288821894903530934), KQU( 8028405805410554106),
- KQU(15744019832103296628), KQU( 149765559630932100),
- KQU( 6137705557200071977), KQU(14513416315434803615),
- KQU(11665702820128984473), KQU( 218926670505601386),
- KQU( 6868675028717769519), KQU(15282016569441512302),
- KQU( 5707000497782960236), KQU( 6671120586555079567),
- KQU( 2194098052618985448), KQU(16849577895477330978),
- KQU(12957148471017466283), KQU( 1997805535404859393),
- KQU( 1180721060263860490), KQU(13206391310193756958),
- KQU(12980208674461861797), KQU( 3825967775058875366),
- KQU(17543433670782042631), KQU( 1518339070120322730),
- KQU(16344584340890991669), KQU( 2611327165318529819),
- KQU(11265022723283422529), KQU( 4001552800373196817),
- KQU(14509595890079346161), KQU( 3528717165416234562),
- KQU(18153222571501914072), KQU( 9387182977209744425),
- KQU(10064342315985580021), KQU(11373678413215253977),
- KQU( 2308457853228798099), KQU( 9729042942839545302),
- KQU( 7833785471140127746), KQU( 6351049900319844436),
- KQU(14454610627133496067), KQU(12533175683634819111),
- KQU(15570163926716513029), KQU(13356980519185762498)
-};
-
-TEST_BEGIN(test_gen_rand_32)
-{
- uint32_t array32[BLOCK_SIZE] JEMALLOC_ATTR(aligned(16));
- uint32_t array32_2[BLOCK_SIZE] JEMALLOC_ATTR(aligned(16));
- int i;
- uint32_t r32;
- sfmt_t *ctx;
-
- assert_d_le(get_min_array_size32(), BLOCK_SIZE,
- "Array size too small");
- ctx = init_gen_rand(1234);
- fill_array32(ctx, array32, BLOCK_SIZE);
- fill_array32(ctx, array32_2, BLOCK_SIZE);
- fini_gen_rand(ctx);
-
- ctx = init_gen_rand(1234);
- for (i = 0; i < BLOCK_SIZE; i++) {
- if (i < COUNT_1) {
- assert_u32_eq(array32[i], init_gen_rand_32_expected[i],
- "Output mismatch for i=%d", i);
- }
- r32 = gen_rand32(ctx);
- assert_u32_eq(r32, array32[i],
- "Mismatch at array32[%d]=%x, gen=%x", i, array32[i], r32);
- }
- for (i = 0; i < COUNT_2; i++) {
- r32 = gen_rand32(ctx);
- assert_u32_eq(r32, array32_2[i],
- "Mismatch at array32_2[%d]=%x, gen=%x", i, array32_2[i],
- r32);
- }
- fini_gen_rand(ctx);
-}
-TEST_END
-
-TEST_BEGIN(test_by_array_32)
-{
- uint32_t array32[BLOCK_SIZE] JEMALLOC_ATTR(aligned(16));
- uint32_t array32_2[BLOCK_SIZE] JEMALLOC_ATTR(aligned(16));
- int i;
- uint32_t ini[4] = {0x1234, 0x5678, 0x9abc, 0xdef0};
- uint32_t r32;
- sfmt_t *ctx;
-
- assert_d_le(get_min_array_size32(), BLOCK_SIZE,
- "Array size too small");
- ctx = init_by_array(ini, 4);
- fill_array32(ctx, array32, BLOCK_SIZE);
- fill_array32(ctx, array32_2, BLOCK_SIZE);
- fini_gen_rand(ctx);
-
- ctx = init_by_array(ini, 4);
- for (i = 0; i < BLOCK_SIZE; i++) {
- if (i < COUNT_1) {
- assert_u32_eq(array32[i], init_by_array_32_expected[i],
- "Output mismatch for i=%d", i);
- }
- r32 = gen_rand32(ctx);
- assert_u32_eq(r32, array32[i],
- "Mismatch at array32[%d]=%x, gen=%x", i, array32[i], r32);
- }
- for (i = 0; i < COUNT_2; i++) {
- r32 = gen_rand32(ctx);
- assert_u32_eq(r32, array32_2[i],
- "Mismatch at array32_2[%d]=%x, gen=%x", i, array32_2[i],
- r32);
- }
- fini_gen_rand(ctx);
-}
-TEST_END
-
-TEST_BEGIN(test_gen_rand_64)
-{
- uint64_t array64[BLOCK_SIZE64] JEMALLOC_ATTR(aligned(16));
- uint64_t array64_2[BLOCK_SIZE64] JEMALLOC_ATTR(aligned(16));
- int i;
- uint64_t r;
- sfmt_t *ctx;
-
- assert_d_le(get_min_array_size64(), BLOCK_SIZE64,
- "Array size too small");
- ctx = init_gen_rand(4321);
- fill_array64(ctx, array64, BLOCK_SIZE64);
- fill_array64(ctx, array64_2, BLOCK_SIZE64);
- fini_gen_rand(ctx);
-
- ctx = init_gen_rand(4321);
- for (i = 0; i < BLOCK_SIZE64; i++) {
- if (i < COUNT_1) {
- assert_u64_eq(array64[i], init_gen_rand_64_expected[i],
- "Output mismatch for i=%d", i);
- }
- r = gen_rand64(ctx);
- assert_u64_eq(r, array64[i],
- "Mismatch at array64[%d]=%"FMTx64", gen=%"FMTx64, i,
- array64[i], r);
- }
- for (i = 0; i < COUNT_2; i++) {
- r = gen_rand64(ctx);
- assert_u64_eq(r, array64_2[i],
- "Mismatch at array64_2[%d]=%"FMTx64" gen=%"FMTx64"", i,
- array64_2[i], r);
- }
- fini_gen_rand(ctx);
-}
-TEST_END
-
-TEST_BEGIN(test_by_array_64)
-{
- uint64_t array64[BLOCK_SIZE64] JEMALLOC_ATTR(aligned(16));
- uint64_t array64_2[BLOCK_SIZE64] JEMALLOC_ATTR(aligned(16));
- int i;
- uint64_t r;
- uint32_t ini[] = {5, 4, 3, 2, 1};
- sfmt_t *ctx;
-
- assert_d_le(get_min_array_size64(), BLOCK_SIZE64,
- "Array size too small");
- ctx = init_by_array(ini, 5);
- fill_array64(ctx, array64, BLOCK_SIZE64);
- fill_array64(ctx, array64_2, BLOCK_SIZE64);
- fini_gen_rand(ctx);
-
- ctx = init_by_array(ini, 5);
- for (i = 0; i < BLOCK_SIZE64; i++) {
- if (i < COUNT_1) {
- assert_u64_eq(array64[i], init_by_array_64_expected[i],
- "Output mismatch for i=%d", i);
- }
- r = gen_rand64(ctx);
- assert_u64_eq(r, array64[i],
- "Mismatch at array64[%d]=%"FMTx64" gen=%"FMTx64, i,
- array64[i], r);
- }
- for (i = 0; i < COUNT_2; i++) {
- r = gen_rand64(ctx);
- assert_u64_eq(r, array64_2[i],
- "Mismatch at array64_2[%d]=%"FMTx64" gen=%"FMTx64, i,
- array64_2[i], r);
- }
- fini_gen_rand(ctx);
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_gen_rand_32,
- test_by_array_32,
- test_gen_rand_64,
- test_by_array_64));
-}
diff --git a/memory/jemalloc/src/test/unit/a0.c b/memory/jemalloc/src/test/unit/a0.c
deleted file mode 100644
index b9ba45a3d4..0000000000
--- a/memory/jemalloc/src/test/unit/a0.c
+++ /dev/null
@@ -1,19 +0,0 @@
-#include "test/jemalloc_test.h"
-
-TEST_BEGIN(test_a0)
-{
- void *p;
-
- p = a0malloc(1);
- assert_ptr_not_null(p, "Unexpected a0malloc() error");
- a0dalloc(p);
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test_no_malloc_init(
- test_a0));
-}
diff --git a/memory/jemalloc/src/test/unit/arena_reset.c b/memory/jemalloc/src/test/unit/arena_reset.c
deleted file mode 100644
index 8ba36c21f8..0000000000
--- a/memory/jemalloc/src/test/unit/arena_reset.c
+++ /dev/null
@@ -1,159 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#ifdef JEMALLOC_PROF
-const char *malloc_conf = "prof:true,lg_prof_sample:0";
-#endif
-
-static unsigned
-get_nsizes_impl(const char *cmd)
-{
- unsigned ret;
- size_t z;
-
- z = sizeof(unsigned);
- assert_d_eq(mallctl(cmd, &ret, &z, NULL, 0), 0,
- "Unexpected mallctl(\"%s\", ...) failure", cmd);
-
- return (ret);
-}
-
-static unsigned
-get_nsmall(void)
-{
-
- return (get_nsizes_impl("arenas.nbins"));
-}
-
-static unsigned
-get_nlarge(void)
-{
-
- return (get_nsizes_impl("arenas.nlruns"));
-}
-
-static unsigned
-get_nhuge(void)
-{
-
- return (get_nsizes_impl("arenas.nhchunks"));
-}
-
-static size_t
-get_size_impl(const char *cmd, size_t ind)
-{
- size_t ret;
- size_t z;
- size_t mib[4];
- size_t miblen = 4;
-
- z = sizeof(size_t);
- assert_d_eq(mallctlnametomib(cmd, mib, &miblen),
- 0, "Unexpected mallctlnametomib(\"%s\", ...) failure", cmd);
- mib[2] = ind;
- z = sizeof(size_t);
- assert_d_eq(mallctlbymib(mib, miblen, &ret, &z, NULL, 0),
- 0, "Unexpected mallctlbymib([\"%s\", %zu], ...) failure", cmd, ind);
-
- return (ret);
-}
-
-static size_t
-get_small_size(size_t ind)
-{
-
- return (get_size_impl("arenas.bin.0.size", ind));
-}
-
-static size_t
-get_large_size(size_t ind)
-{
-
- return (get_size_impl("arenas.lrun.0.size", ind));
-}
-
-static size_t
-get_huge_size(size_t ind)
-{
-
- return (get_size_impl("arenas.hchunk.0.size", ind));
-}
-
-TEST_BEGIN(test_arena_reset)
-{
-#define NHUGE 4
- unsigned arena_ind, nsmall, nlarge, nhuge, nptrs, i;
- size_t sz, miblen;
- void **ptrs;
- int flags;
- size_t mib[3];
- tsdn_t *tsdn;
-
- test_skip_if((config_valgrind && unlikely(in_valgrind)) || (config_fill
- && unlikely(opt_quarantine)));
-
- sz = sizeof(unsigned);
- assert_d_eq(mallctl("arenas.extend", &arena_ind, &sz, NULL, 0), 0,
- "Unexpected mallctl() failure");
-
- flags = MALLOCX_ARENA(arena_ind) | MALLOCX_TCACHE_NONE;
-
- nsmall = get_nsmall();
- nlarge = get_nlarge();
- nhuge = get_nhuge() > NHUGE ? NHUGE : get_nhuge();
- nptrs = nsmall + nlarge + nhuge;
- ptrs = (void **)malloc(nptrs * sizeof(void *));
- assert_ptr_not_null(ptrs, "Unexpected malloc() failure");
-
- /* Allocate objects with a wide range of sizes. */
- for (i = 0; i < nsmall; i++) {
- sz = get_small_size(i);
- ptrs[i] = mallocx(sz, flags);
- assert_ptr_not_null(ptrs[i],
- "Unexpected mallocx(%zu, %#x) failure", sz, flags);
- }
- for (i = 0; i < nlarge; i++) {
- sz = get_large_size(i);
- ptrs[nsmall + i] = mallocx(sz, flags);
- assert_ptr_not_null(ptrs[i],
- "Unexpected mallocx(%zu, %#x) failure", sz, flags);
- }
- for (i = 0; i < nhuge; i++) {
- sz = get_huge_size(i);
- ptrs[nsmall + nlarge + i] = mallocx(sz, flags);
- assert_ptr_not_null(ptrs[i],
- "Unexpected mallocx(%zu, %#x) failure", sz, flags);
- }
-
- tsdn = tsdn_fetch();
-
- /* Verify allocations. */
- for (i = 0; i < nptrs; i++) {
- assert_zu_gt(ivsalloc(tsdn, ptrs[i], false), 0,
- "Allocation should have queryable size");
- }
-
- /* Reset. */
- miblen = sizeof(mib)/sizeof(size_t);
- assert_d_eq(mallctlnametomib("arena.0.reset", mib, &miblen), 0,
- "Unexpected mallctlnametomib() failure");
- mib[1] = (size_t)arena_ind;
- assert_d_eq(mallctlbymib(mib, miblen, NULL, NULL, NULL, 0), 0,
- "Unexpected mallctlbymib() failure");
-
- /* Verify allocations no longer exist. */
- for (i = 0; i < nptrs; i++) {
- assert_zu_eq(ivsalloc(tsdn, ptrs[i], false), 0,
- "Allocation should no longer exist");
- }
-
- free(ptrs);
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_arena_reset));
-}
diff --git a/memory/jemalloc/src/test/unit/atomic.c b/memory/jemalloc/src/test/unit/atomic.c
deleted file mode 100644
index bdd74f659c..0000000000
--- a/memory/jemalloc/src/test/unit/atomic.c
+++ /dev/null
@@ -1,122 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#define TEST_STRUCT(p, t) \
-struct p##_test_s { \
- t accum0; \
- t x; \
- t s; \
-}; \
-typedef struct p##_test_s p##_test_t;
-
-#define TEST_BODY(p, t, tc, ta, FMT) do { \
- const p##_test_t tests[] = { \
- {(t)-1, (t)-1, (t)-2}, \
- {(t)-1, (t) 0, (t)-2}, \
- {(t)-1, (t) 1, (t)-2}, \
- \
- {(t) 0, (t)-1, (t)-2}, \
- {(t) 0, (t) 0, (t)-2}, \
- {(t) 0, (t) 1, (t)-2}, \
- \
- {(t) 1, (t)-1, (t)-2}, \
- {(t) 1, (t) 0, (t)-2}, \
- {(t) 1, (t) 1, (t)-2}, \
- \
- {(t)0, (t)-(1 << 22), (t)-2}, \
- {(t)0, (t)(1 << 22), (t)-2}, \
- {(t)(1 << 22), (t)-(1 << 22), (t)-2}, \
- {(t)(1 << 22), (t)(1 << 22), (t)-2} \
- }; \
- unsigned i; \
- \
- for (i = 0; i < sizeof(tests)/sizeof(p##_test_t); i++) { \
- bool err; \
- t accum = tests[i].accum0; \
- assert_##ta##_eq(atomic_read_##p(&accum), \
- tests[i].accum0, \
- "Erroneous read, i=%u", i); \
- \
- assert_##ta##_eq(atomic_add_##p(&accum, tests[i].x), \
- (t)((tc)tests[i].accum0 + (tc)tests[i].x), \
- "i=%u, accum=%"FMT", x=%"FMT, \
- i, tests[i].accum0, tests[i].x); \
- assert_##ta##_eq(atomic_read_##p(&accum), accum, \
- "Erroneous add, i=%u", i); \
- \
- accum = tests[i].accum0; \
- assert_##ta##_eq(atomic_sub_##p(&accum, tests[i].x), \
- (t)((tc)tests[i].accum0 - (tc)tests[i].x), \
- "i=%u, accum=%"FMT", x=%"FMT, \
- i, tests[i].accum0, tests[i].x); \
- assert_##ta##_eq(atomic_read_##p(&accum), accum, \
- "Erroneous sub, i=%u", i); \
- \
- accum = tests[i].accum0; \
- err = atomic_cas_##p(&accum, tests[i].x, tests[i].s); \
- assert_b_eq(err, tests[i].accum0 != tests[i].x, \
- "Erroneous cas success/failure result"); \
- assert_##ta##_eq(accum, err ? tests[i].accum0 : \
- tests[i].s, "Erroneous cas effect, i=%u", i); \
- \
- accum = tests[i].accum0; \
- atomic_write_##p(&accum, tests[i].s); \
- assert_##ta##_eq(accum, tests[i].s, \
- "Erroneous write, i=%u", i); \
- } \
-} while (0)
-
-TEST_STRUCT(uint64, uint64_t)
-TEST_BEGIN(test_atomic_uint64)
-{
-
-#if !(LG_SIZEOF_PTR == 3 || LG_SIZEOF_INT == 3)
- test_skip("64-bit atomic operations not supported");
-#else
- TEST_BODY(uint64, uint64_t, uint64_t, u64, FMTx64);
-#endif
-}
-TEST_END
-
-TEST_STRUCT(uint32, uint32_t)
-TEST_BEGIN(test_atomic_uint32)
-{
-
- TEST_BODY(uint32, uint32_t, uint32_t, u32, "#"FMTx32);
-}
-TEST_END
-
-TEST_STRUCT(p, void *)
-TEST_BEGIN(test_atomic_p)
-{
-
- TEST_BODY(p, void *, uintptr_t, ptr, "p");
-}
-TEST_END
-
-TEST_STRUCT(z, size_t)
-TEST_BEGIN(test_atomic_z)
-{
-
- TEST_BODY(z, size_t, size_t, zu, "#zx");
-}
-TEST_END
-
-TEST_STRUCT(u, unsigned)
-TEST_BEGIN(test_atomic_u)
-{
-
- TEST_BODY(u, unsigned, unsigned, u, "#x");
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_atomic_uint64,
- test_atomic_uint32,
- test_atomic_p,
- test_atomic_z,
- test_atomic_u));
-}
diff --git a/memory/jemalloc/src/test/unit/bitmap.c b/memory/jemalloc/src/test/unit/bitmap.c
deleted file mode 100644
index a2dd54630c..0000000000
--- a/memory/jemalloc/src/test/unit/bitmap.c
+++ /dev/null
@@ -1,163 +0,0 @@
-#include "test/jemalloc_test.h"
-
-TEST_BEGIN(test_bitmap_size)
-{
- size_t i, prev_size;
-
- prev_size = 0;
- for (i = 1; i <= BITMAP_MAXBITS; i++) {
- bitmap_info_t binfo;
- size_t size;
-
- bitmap_info_init(&binfo, i);
- size = bitmap_size(&binfo);
- assert_true(size >= prev_size,
- "Bitmap size is smaller than expected");
- prev_size = size;
- }
-}
-TEST_END
-
-TEST_BEGIN(test_bitmap_init)
-{
- size_t i;
-
- for (i = 1; i <= BITMAP_MAXBITS; i++) {
- bitmap_info_t binfo;
- bitmap_info_init(&binfo, i);
- {
- size_t j;
- bitmap_t *bitmap = (bitmap_t *)malloc(
- bitmap_size(&binfo));
- bitmap_init(bitmap, &binfo);
-
- for (j = 0; j < i; j++) {
- assert_false(bitmap_get(bitmap, &binfo, j),
- "Bit should be unset");
- }
- free(bitmap);
- }
- }
-}
-TEST_END
-
-TEST_BEGIN(test_bitmap_set)
-{
- size_t i;
-
- for (i = 1; i <= BITMAP_MAXBITS; i++) {
- bitmap_info_t binfo;
- bitmap_info_init(&binfo, i);
- {
- size_t j;
- bitmap_t *bitmap = (bitmap_t *)malloc(
- bitmap_size(&binfo));
- bitmap_init(bitmap, &binfo);
-
- for (j = 0; j < i; j++)
- bitmap_set(bitmap, &binfo, j);
- assert_true(bitmap_full(bitmap, &binfo),
- "All bits should be set");
- free(bitmap);
- }
- }
-}
-TEST_END
-
-TEST_BEGIN(test_bitmap_unset)
-{
- size_t i;
-
- for (i = 1; i <= BITMAP_MAXBITS; i++) {
- bitmap_info_t binfo;
- bitmap_info_init(&binfo, i);
- {
- size_t j;
- bitmap_t *bitmap = (bitmap_t *)malloc(
- bitmap_size(&binfo));
- bitmap_init(bitmap, &binfo);
-
- for (j = 0; j < i; j++)
- bitmap_set(bitmap, &binfo, j);
- assert_true(bitmap_full(bitmap, &binfo),
- "All bits should be set");
- for (j = 0; j < i; j++)
- bitmap_unset(bitmap, &binfo, j);
- for (j = 0; j < i; j++)
- bitmap_set(bitmap, &binfo, j);
- assert_true(bitmap_full(bitmap, &binfo),
- "All bits should be set");
- free(bitmap);
- }
- }
-}
-TEST_END
-
-TEST_BEGIN(test_bitmap_sfu)
-{
- size_t i;
-
- for (i = 1; i <= BITMAP_MAXBITS; i++) {
- bitmap_info_t binfo;
- bitmap_info_init(&binfo, i);
- {
- size_t j;
- bitmap_t *bitmap = (bitmap_t *)malloc(
- bitmap_size(&binfo));
- bitmap_init(bitmap, &binfo);
-
- /* Iteratively set bits starting at the beginning. */
- for (j = 0; j < i; j++) {
- assert_zd_eq(bitmap_sfu(bitmap, &binfo), j,
- "First unset bit should be just after "
- "previous first unset bit");
- }
- assert_true(bitmap_full(bitmap, &binfo),
- "All bits should be set");
-
- /*
- * Iteratively unset bits starting at the end, and
- * verify that bitmap_sfu() reaches the unset bits.
- */
- for (j = i - 1; j < i; j--) { /* (i..0] */
- bitmap_unset(bitmap, &binfo, j);
- assert_zd_eq(bitmap_sfu(bitmap, &binfo), j,
- "First unset bit should the bit previously "
- "unset");
- bitmap_unset(bitmap, &binfo, j);
- }
- assert_false(bitmap_get(bitmap, &binfo, 0),
- "Bit should be unset");
-
- /*
- * Iteratively set bits starting at the beginning, and
- * verify that bitmap_sfu() looks past them.
- */
- for (j = 1; j < i; j++) {
- bitmap_set(bitmap, &binfo, j - 1);
- assert_zd_eq(bitmap_sfu(bitmap, &binfo), j,
- "First unset bit should be just after the "
- "bit previously set");
- bitmap_unset(bitmap, &binfo, j);
- }
- assert_zd_eq(bitmap_sfu(bitmap, &binfo), i - 1,
- "First unset bit should be the last bit");
- assert_true(bitmap_full(bitmap, &binfo),
- "All bits should be set");
- free(bitmap);
- }
- }
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_bitmap_size,
- test_bitmap_init,
- test_bitmap_set,
- test_bitmap_unset,
- test_bitmap_sfu));
-}
diff --git a/memory/jemalloc/src/test/unit/ckh.c b/memory/jemalloc/src/test/unit/ckh.c
deleted file mode 100644
index 2cbc226888..0000000000
--- a/memory/jemalloc/src/test/unit/ckh.c
+++ /dev/null
@@ -1,214 +0,0 @@
-#include "test/jemalloc_test.h"
-
-TEST_BEGIN(test_new_delete)
-{
- tsd_t *tsd;
- ckh_t ckh;
-
- tsd = tsd_fetch();
-
- assert_false(ckh_new(tsd, &ckh, 2, ckh_string_hash,
- ckh_string_keycomp), "Unexpected ckh_new() error");
- ckh_delete(tsd, &ckh);
-
- assert_false(ckh_new(tsd, &ckh, 3, ckh_pointer_hash,
- ckh_pointer_keycomp), "Unexpected ckh_new() error");
- ckh_delete(tsd, &ckh);
-}
-TEST_END
-
-TEST_BEGIN(test_count_insert_search_remove)
-{
- tsd_t *tsd;
- ckh_t ckh;
- const char *strs[] = {
- "a string",
- "A string",
- "a string.",
- "A string."
- };
- const char *missing = "A string not in the hash table.";
- size_t i;
-
- tsd = tsd_fetch();
-
- assert_false(ckh_new(tsd, &ckh, 2, ckh_string_hash,
- ckh_string_keycomp), "Unexpected ckh_new() error");
- assert_zu_eq(ckh_count(&ckh), 0,
- "ckh_count() should return %zu, but it returned %zu", ZU(0),
- ckh_count(&ckh));
-
- /* Insert. */
- for (i = 0; i < sizeof(strs)/sizeof(const char *); i++) {
- ckh_insert(tsd, &ckh, strs[i], strs[i]);
- assert_zu_eq(ckh_count(&ckh), i+1,
- "ckh_count() should return %zu, but it returned %zu", i+1,
- ckh_count(&ckh));
- }
-
- /* Search. */
- for (i = 0; i < sizeof(strs)/sizeof(const char *); i++) {
- union {
- void *p;
- const char *s;
- } k, v;
- void **kp, **vp;
- const char *ks, *vs;
-
- kp = (i & 1) ? &k.p : NULL;
- vp = (i & 2) ? &v.p : NULL;
- k.p = NULL;
- v.p = NULL;
- assert_false(ckh_search(&ckh, strs[i], kp, vp),
- "Unexpected ckh_search() error");
-
- ks = (i & 1) ? strs[i] : (const char *)NULL;
- vs = (i & 2) ? strs[i] : (const char *)NULL;
- assert_ptr_eq((void *)ks, (void *)k.s, "Key mismatch, i=%zu",
- i);
- assert_ptr_eq((void *)vs, (void *)v.s, "Value mismatch, i=%zu",
- i);
- }
- assert_true(ckh_search(&ckh, missing, NULL, NULL),
- "Unexpected ckh_search() success");
-
- /* Remove. */
- for (i = 0; i < sizeof(strs)/sizeof(const char *); i++) {
- union {
- void *p;
- const char *s;
- } k, v;
- void **kp, **vp;
- const char *ks, *vs;
-
- kp = (i & 1) ? &k.p : NULL;
- vp = (i & 2) ? &v.p : NULL;
- k.p = NULL;
- v.p = NULL;
- assert_false(ckh_remove(tsd, &ckh, strs[i], kp, vp),
- "Unexpected ckh_remove() error");
-
- ks = (i & 1) ? strs[i] : (const char *)NULL;
- vs = (i & 2) ? strs[i] : (const char *)NULL;
- assert_ptr_eq((void *)ks, (void *)k.s, "Key mismatch, i=%zu",
- i);
- assert_ptr_eq((void *)vs, (void *)v.s, "Value mismatch, i=%zu",
- i);
- assert_zu_eq(ckh_count(&ckh),
- sizeof(strs)/sizeof(const char *) - i - 1,
- "ckh_count() should return %zu, but it returned %zu",
- sizeof(strs)/sizeof(const char *) - i - 1,
- ckh_count(&ckh));
- }
-
- ckh_delete(tsd, &ckh);
-}
-TEST_END
-
-TEST_BEGIN(test_insert_iter_remove)
-{
-#define NITEMS ZU(1000)
- tsd_t *tsd;
- ckh_t ckh;
- void **p[NITEMS];
- void *q, *r;
- size_t i;
-
- tsd = tsd_fetch();
-
- assert_false(ckh_new(tsd, &ckh, 2, ckh_pointer_hash,
- ckh_pointer_keycomp), "Unexpected ckh_new() error");
-
- for (i = 0; i < NITEMS; i++) {
- p[i] = mallocx(i+1, 0);
- assert_ptr_not_null(p[i], "Unexpected mallocx() failure");
- }
-
- for (i = 0; i < NITEMS; i++) {
- size_t j;
-
- for (j = i; j < NITEMS; j++) {
- assert_false(ckh_insert(tsd, &ckh, p[j], p[j]),
- "Unexpected ckh_insert() failure");
- assert_false(ckh_search(&ckh, p[j], &q, &r),
- "Unexpected ckh_search() failure");
- assert_ptr_eq(p[j], q, "Key pointer mismatch");
- assert_ptr_eq(p[j], r, "Value pointer mismatch");
- }
-
- assert_zu_eq(ckh_count(&ckh), NITEMS,
- "ckh_count() should return %zu, but it returned %zu",
- NITEMS, ckh_count(&ckh));
-
- for (j = i + 1; j < NITEMS; j++) {
- assert_false(ckh_search(&ckh, p[j], NULL, NULL),
- "Unexpected ckh_search() failure");
- assert_false(ckh_remove(tsd, &ckh, p[j], &q, &r),
- "Unexpected ckh_remove() failure");
- assert_ptr_eq(p[j], q, "Key pointer mismatch");
- assert_ptr_eq(p[j], r, "Value pointer mismatch");
- assert_true(ckh_search(&ckh, p[j], NULL, NULL),
- "Unexpected ckh_search() success");
- assert_true(ckh_remove(tsd, &ckh, p[j], &q, &r),
- "Unexpected ckh_remove() success");
- }
-
- {
- bool seen[NITEMS];
- size_t tabind;
-
- memset(seen, 0, sizeof(seen));
-
- for (tabind = 0; !ckh_iter(&ckh, &tabind, &q, &r);) {
- size_t k;
-
- assert_ptr_eq(q, r, "Key and val not equal");
-
- for (k = 0; k < NITEMS; k++) {
- if (p[k] == q) {
- assert_false(seen[k],
- "Item %zu already seen", k);
- seen[k] = true;
- break;
- }
- }
- }
-
- for (j = 0; j < i + 1; j++)
- assert_true(seen[j], "Item %zu not seen", j);
- for (; j < NITEMS; j++)
- assert_false(seen[j], "Item %zu seen", j);
- }
- }
-
- for (i = 0; i < NITEMS; i++) {
- assert_false(ckh_search(&ckh, p[i], NULL, NULL),
- "Unexpected ckh_search() failure");
- assert_false(ckh_remove(tsd, &ckh, p[i], &q, &r),
- "Unexpected ckh_remove() failure");
- assert_ptr_eq(p[i], q, "Key pointer mismatch");
- assert_ptr_eq(p[i], r, "Value pointer mismatch");
- assert_true(ckh_search(&ckh, p[i], NULL, NULL),
- "Unexpected ckh_search() success");
- assert_true(ckh_remove(tsd, &ckh, p[i], &q, &r),
- "Unexpected ckh_remove() success");
- dallocx(p[i], 0);
- }
-
- assert_zu_eq(ckh_count(&ckh), 0,
- "ckh_count() should return %zu, but it returned %zu",
- ZU(0), ckh_count(&ckh));
- ckh_delete(tsd, &ckh);
-#undef NITEMS
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_new_delete,
- test_count_insert_search_remove,
- test_insert_iter_remove));
-}
diff --git a/memory/jemalloc/src/test/unit/decay.c b/memory/jemalloc/src/test/unit/decay.c
deleted file mode 100644
index e169ae24e0..0000000000
--- a/memory/jemalloc/src/test/unit/decay.c
+++ /dev/null
@@ -1,374 +0,0 @@
-#include "test/jemalloc_test.h"
-
-const char *malloc_conf = "purge:decay,decay_time:1";
-
-static nstime_monotonic_t *nstime_monotonic_orig;
-static nstime_update_t *nstime_update_orig;
-
-static unsigned nupdates_mock;
-static nstime_t time_mock;
-static bool monotonic_mock;
-
-static bool
-nstime_monotonic_mock(void)
-{
-
- return (monotonic_mock);
-}
-
-static bool
-nstime_update_mock(nstime_t *time)
-{
-
- nupdates_mock++;
- if (monotonic_mock)
- nstime_copy(time, &time_mock);
- return (!monotonic_mock);
-}
-
-TEST_BEGIN(test_decay_ticks)
-{
- ticker_t *decay_ticker;
- unsigned tick0, tick1;
- size_t sz, huge0, large0;
- void *p;
-
- test_skip_if(opt_purge != purge_mode_decay);
-
- decay_ticker = decay_ticker_get(tsd_fetch(), 0);
- assert_ptr_not_null(decay_ticker,
- "Unexpected failure getting decay ticker");
-
- sz = sizeof(size_t);
- assert_d_eq(mallctl("arenas.hchunk.0.size", &huge0, &sz, NULL, 0), 0,
- "Unexpected mallctl failure");
- assert_d_eq(mallctl("arenas.lrun.0.size", &large0, &sz, NULL, 0), 0,
- "Unexpected mallctl failure");
-
- /*
- * Test the standard APIs using a huge size class, since we can't
- * control tcache interactions (except by completely disabling tcache
- * for the entire test program).
- */
-
- /* malloc(). */
- tick0 = ticker_read(decay_ticker);
- p = malloc(huge0);
- assert_ptr_not_null(p, "Unexpected malloc() failure");
- tick1 = ticker_read(decay_ticker);
- assert_u32_ne(tick1, tick0, "Expected ticker to tick during malloc()");
- /* free(). */
- tick0 = ticker_read(decay_ticker);
- free(p);
- tick1 = ticker_read(decay_ticker);
- assert_u32_ne(tick1, tick0, "Expected ticker to tick during free()");
-
- /* calloc(). */
- tick0 = ticker_read(decay_ticker);
- p = calloc(1, huge0);
- assert_ptr_not_null(p, "Unexpected calloc() failure");
- tick1 = ticker_read(decay_ticker);
- assert_u32_ne(tick1, tick0, "Expected ticker to tick during calloc()");
- free(p);
-
- /* posix_memalign(). */
- tick0 = ticker_read(decay_ticker);
- assert_d_eq(posix_memalign(&p, sizeof(size_t), huge0), 0,
- "Unexpected posix_memalign() failure");
- tick1 = ticker_read(decay_ticker);
- assert_u32_ne(tick1, tick0,
- "Expected ticker to tick during posix_memalign()");
- free(p);
-
- /* aligned_alloc(). */
- tick0 = ticker_read(decay_ticker);
- p = aligned_alloc(sizeof(size_t), huge0);
- assert_ptr_not_null(p, "Unexpected aligned_alloc() failure");
- tick1 = ticker_read(decay_ticker);
- assert_u32_ne(tick1, tick0,
- "Expected ticker to tick during aligned_alloc()");
- free(p);
-
- /* realloc(). */
- /* Allocate. */
- tick0 = ticker_read(decay_ticker);
- p = realloc(NULL, huge0);
- assert_ptr_not_null(p, "Unexpected realloc() failure");
- tick1 = ticker_read(decay_ticker);
- assert_u32_ne(tick1, tick0, "Expected ticker to tick during realloc()");
- /* Reallocate. */
- tick0 = ticker_read(decay_ticker);
- p = realloc(p, huge0);
- assert_ptr_not_null(p, "Unexpected realloc() failure");
- tick1 = ticker_read(decay_ticker);
- assert_u32_ne(tick1, tick0, "Expected ticker to tick during realloc()");
- /* Deallocate. */
- tick0 = ticker_read(decay_ticker);
- realloc(p, 0);
- tick1 = ticker_read(decay_ticker);
- assert_u32_ne(tick1, tick0, "Expected ticker to tick during realloc()");
-
- /*
- * Test the *allocx() APIs using huge, large, and small size classes,
- * with tcache explicitly disabled.
- */
- {
- unsigned i;
- size_t allocx_sizes[3];
- allocx_sizes[0] = huge0;
- allocx_sizes[1] = large0;
- allocx_sizes[2] = 1;
-
- for (i = 0; i < sizeof(allocx_sizes) / sizeof(size_t); i++) {
- sz = allocx_sizes[i];
-
- /* mallocx(). */
- tick0 = ticker_read(decay_ticker);
- p = mallocx(sz, MALLOCX_TCACHE_NONE);
- assert_ptr_not_null(p, "Unexpected mallocx() failure");
- tick1 = ticker_read(decay_ticker);
- assert_u32_ne(tick1, tick0,
- "Expected ticker to tick during mallocx() (sz=%zu)",
- sz);
- /* rallocx(). */
- tick0 = ticker_read(decay_ticker);
- p = rallocx(p, sz, MALLOCX_TCACHE_NONE);
- assert_ptr_not_null(p, "Unexpected rallocx() failure");
- tick1 = ticker_read(decay_ticker);
- assert_u32_ne(tick1, tick0,
- "Expected ticker to tick during rallocx() (sz=%zu)",
- sz);
- /* xallocx(). */
- tick0 = ticker_read(decay_ticker);
- xallocx(p, sz, 0, MALLOCX_TCACHE_NONE);
- tick1 = ticker_read(decay_ticker);
- assert_u32_ne(tick1, tick0,
- "Expected ticker to tick during xallocx() (sz=%zu)",
- sz);
- /* dallocx(). */
- tick0 = ticker_read(decay_ticker);
- dallocx(p, MALLOCX_TCACHE_NONE);
- tick1 = ticker_read(decay_ticker);
- assert_u32_ne(tick1, tick0,
- "Expected ticker to tick during dallocx() (sz=%zu)",
- sz);
- /* sdallocx(). */
- p = mallocx(sz, MALLOCX_TCACHE_NONE);
- assert_ptr_not_null(p, "Unexpected mallocx() failure");
- tick0 = ticker_read(decay_ticker);
- sdallocx(p, sz, MALLOCX_TCACHE_NONE);
- tick1 = ticker_read(decay_ticker);
- assert_u32_ne(tick1, tick0,
- "Expected ticker to tick during sdallocx() "
- "(sz=%zu)", sz);
- }
- }
-
- /*
- * Test tcache fill/flush interactions for large and small size classes,
- * using an explicit tcache.
- */
- if (config_tcache) {
- unsigned tcache_ind, i;
- size_t tcache_sizes[2];
- tcache_sizes[0] = large0;
- tcache_sizes[1] = 1;
-
- sz = sizeof(unsigned);
- assert_d_eq(mallctl("tcache.create", &tcache_ind, &sz, NULL, 0),
- 0, "Unexpected mallctl failure");
-
- for (i = 0; i < sizeof(tcache_sizes) / sizeof(size_t); i++) {
- sz = tcache_sizes[i];
-
- /* tcache fill. */
- tick0 = ticker_read(decay_ticker);
- p = mallocx(sz, MALLOCX_TCACHE(tcache_ind));
- assert_ptr_not_null(p, "Unexpected mallocx() failure");
- tick1 = ticker_read(decay_ticker);
- assert_u32_ne(tick1, tick0,
- "Expected ticker to tick during tcache fill "
- "(sz=%zu)", sz);
- /* tcache flush. */
- dallocx(p, MALLOCX_TCACHE(tcache_ind));
- tick0 = ticker_read(decay_ticker);
- assert_d_eq(mallctl("tcache.flush", NULL, NULL,
- &tcache_ind, sizeof(unsigned)), 0,
- "Unexpected mallctl failure");
- tick1 = ticker_read(decay_ticker);
- assert_u32_ne(tick1, tick0,
- "Expected ticker to tick during tcache flush "
- "(sz=%zu)", sz);
- }
- }
-}
-TEST_END
-
-TEST_BEGIN(test_decay_ticker)
-{
-#define NPS 1024
- int flags = (MALLOCX_ARENA(0) | MALLOCX_TCACHE_NONE);
- void *ps[NPS];
- uint64_t epoch;
- uint64_t npurge0 = 0;
- uint64_t npurge1 = 0;
- size_t sz, large;
- unsigned i, nupdates0;
- nstime_t time, decay_time, deadline;
-
- test_skip_if(opt_purge != purge_mode_decay);
-
- /*
- * Allocate a bunch of large objects, pause the clock, deallocate the
- * objects, restore the clock, then [md]allocx() in a tight loop to
- * verify the ticker triggers purging.
- */
-
- if (config_tcache) {
- size_t tcache_max;
-
- sz = sizeof(size_t);
- assert_d_eq(mallctl("arenas.tcache_max", &tcache_max, &sz, NULL,
- 0), 0, "Unexpected mallctl failure");
- large = nallocx(tcache_max + 1, flags);
- } else {
- sz = sizeof(size_t);
- assert_d_eq(mallctl("arenas.lrun.0.size", &large, &sz, NULL, 0),
- 0, "Unexpected mallctl failure");
- }
-
- assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
- "Unexpected mallctl failure");
- assert_d_eq(mallctl("epoch", NULL, NULL, &epoch, sizeof(uint64_t)), 0,
- "Unexpected mallctl failure");
- sz = sizeof(uint64_t);
- assert_d_eq(mallctl("stats.arenas.0.npurge", &npurge0, &sz, NULL, 0),
- config_stats ? 0 : ENOENT, "Unexpected mallctl result");
-
- for (i = 0; i < NPS; i++) {
- ps[i] = mallocx(large, flags);
- assert_ptr_not_null(ps[i], "Unexpected mallocx() failure");
- }
-
- nupdates_mock = 0;
- nstime_init(&time_mock, 0);
- nstime_update(&time_mock);
- monotonic_mock = true;
-
- nstime_monotonic_orig = nstime_monotonic;
- nstime_update_orig = nstime_update;
- nstime_monotonic = nstime_monotonic_mock;
- nstime_update = nstime_update_mock;
-
- for (i = 0; i < NPS; i++) {
- dallocx(ps[i], flags);
- nupdates0 = nupdates_mock;
- assert_d_eq(mallctl("arena.0.decay", NULL, NULL, NULL, 0), 0,
- "Unexpected arena.0.decay failure");
- assert_u_gt(nupdates_mock, nupdates0,
- "Expected nstime_update() to be called");
- }
-
- nstime_monotonic = nstime_monotonic_orig;
- nstime_update = nstime_update_orig;
-
- nstime_init(&time, 0);
- nstime_update(&time);
- nstime_init2(&decay_time, opt_decay_time, 0);
- nstime_copy(&deadline, &time);
- nstime_add(&deadline, &decay_time);
- do {
- for (i = 0; i < DECAY_NTICKS_PER_UPDATE / 2; i++) {
- void *p = mallocx(1, flags);
- assert_ptr_not_null(p, "Unexpected mallocx() failure");
- dallocx(p, flags);
- }
- assert_d_eq(mallctl("epoch", NULL, NULL, &epoch,
- sizeof(uint64_t)), 0, "Unexpected mallctl failure");
- sz = sizeof(uint64_t);
- assert_d_eq(mallctl("stats.arenas.0.npurge", &npurge1, &sz,
- NULL, 0), config_stats ? 0 : ENOENT,
- "Unexpected mallctl result");
-
- nstime_update(&time);
- } while (nstime_compare(&time, &deadline) <= 0 && npurge1 == npurge0);
-
- if (config_stats)
- assert_u64_gt(npurge1, npurge0, "Expected purging to occur");
-#undef NPS
-}
-TEST_END
-
-TEST_BEGIN(test_decay_nonmonotonic)
-{
-#define NPS (SMOOTHSTEP_NSTEPS + 1)
- int flags = (MALLOCX_ARENA(0) | MALLOCX_TCACHE_NONE);
- void *ps[NPS];
- uint64_t epoch;
- uint64_t npurge0 = 0;
- uint64_t npurge1 = 0;
- size_t sz, large0;
- unsigned i, nupdates0;
-
- test_skip_if(opt_purge != purge_mode_decay);
-
- sz = sizeof(size_t);
- assert_d_eq(mallctl("arenas.lrun.0.size", &large0, &sz, NULL, 0), 0,
- "Unexpected mallctl failure");
-
- assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
- "Unexpected mallctl failure");
- assert_d_eq(mallctl("epoch", NULL, NULL, &epoch, sizeof(uint64_t)), 0,
- "Unexpected mallctl failure");
- sz = sizeof(uint64_t);
- assert_d_eq(mallctl("stats.arenas.0.npurge", &npurge0, &sz, NULL, 0),
- config_stats ? 0 : ENOENT, "Unexpected mallctl result");
-
- nupdates_mock = 0;
- nstime_init(&time_mock, 0);
- nstime_update(&time_mock);
- monotonic_mock = false;
-
- nstime_monotonic_orig = nstime_monotonic;
- nstime_update_orig = nstime_update;
- nstime_monotonic = nstime_monotonic_mock;
- nstime_update = nstime_update_mock;
-
- for (i = 0; i < NPS; i++) {
- ps[i] = mallocx(large0, flags);
- assert_ptr_not_null(ps[i], "Unexpected mallocx() failure");
- }
-
- for (i = 0; i < NPS; i++) {
- dallocx(ps[i], flags);
- nupdates0 = nupdates_mock;
- assert_d_eq(mallctl("arena.0.decay", NULL, NULL, NULL, 0), 0,
- "Unexpected arena.0.decay failure");
- assert_u_gt(nupdates_mock, nupdates0,
- "Expected nstime_update() to be called");
- }
-
- assert_d_eq(mallctl("epoch", NULL, NULL, &epoch, sizeof(uint64_t)), 0,
- "Unexpected mallctl failure");
- sz = sizeof(uint64_t);
- assert_d_eq(mallctl("stats.arenas.0.npurge", &npurge1, &sz, NULL, 0),
- config_stats ? 0 : ENOENT, "Unexpected mallctl result");
-
- if (config_stats)
- assert_u64_eq(npurge0, npurge1, "Unexpected purging occurred");
-
- nstime_monotonic = nstime_monotonic_orig;
- nstime_update = nstime_update_orig;
-#undef NPS
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_decay_ticks,
- test_decay_ticker,
- test_decay_nonmonotonic));
-}
diff --git a/memory/jemalloc/src/test/unit/fork.c b/memory/jemalloc/src/test/unit/fork.c
deleted file mode 100644
index c530797c4a..0000000000
--- a/memory/jemalloc/src/test/unit/fork.c
+++ /dev/null
@@ -1,64 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#ifndef _WIN32
-#include <sys/wait.h>
-#endif
-
-TEST_BEGIN(test_fork)
-{
-#ifndef _WIN32
- void *p;
- pid_t pid;
-
- p = malloc(1);
- assert_ptr_not_null(p, "Unexpected malloc() failure");
-
- pid = fork();
-
- free(p);
-
- p = malloc(64);
- assert_ptr_not_null(p, "Unexpected malloc() failure");
- free(p);
-
- if (pid == -1) {
- /* Error. */
- test_fail("Unexpected fork() failure");
- } else if (pid == 0) {
- /* Child. */
- _exit(0);
- } else {
- int status;
-
- /* Parent. */
- while (true) {
- if (waitpid(pid, &status, 0) == -1)
- test_fail("Unexpected waitpid() failure");
- if (WIFSIGNALED(status)) {
- test_fail("Unexpected child termination due to "
- "signal %d", WTERMSIG(status));
- break;
- }
- if (WIFEXITED(status)) {
- if (WEXITSTATUS(status) != 0) {
- test_fail(
- "Unexpected child exit value %d",
- WEXITSTATUS(status));
- }
- break;
- }
- }
- }
-#else
- test_skip("fork(2) is irrelevant to Windows");
-#endif
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_fork));
-}
diff --git a/memory/jemalloc/src/test/unit/hash.c b/memory/jemalloc/src/test/unit/hash.c
deleted file mode 100644
index 010c9d76fd..0000000000
--- a/memory/jemalloc/src/test/unit/hash.c
+++ /dev/null
@@ -1,185 +0,0 @@
-/*
- * This file is based on code that is part of SMHasher
- * (https://code.google.com/p/smhasher/), and is subject to the MIT license
- * (http://www.opensource.org/licenses/mit-license.php). Both email addresses
- * associated with the source code's revision history belong to Austin Appleby,
- * and the revision history ranges from 2010 to 2012. Therefore the copyright
- * and license are here taken to be:
- *
- * Copyright (c) 2010-2012 Austin Appleby
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- * THE SOFTWARE.
- */
-
-#include "test/jemalloc_test.h"
-
-typedef enum {
- hash_variant_x86_32,
- hash_variant_x86_128,
- hash_variant_x64_128
-} hash_variant_t;
-
-static int
-hash_variant_bits(hash_variant_t variant)
-{
-
- switch (variant) {
- case hash_variant_x86_32: return (32);
- case hash_variant_x86_128: return (128);
- case hash_variant_x64_128: return (128);
- default: not_reached();
- }
-}
-
-static const char *
-hash_variant_string(hash_variant_t variant)
-{
-
- switch (variant) {
- case hash_variant_x86_32: return ("hash_x86_32");
- case hash_variant_x86_128: return ("hash_x86_128");
- case hash_variant_x64_128: return ("hash_x64_128");
- default: not_reached();
- }
-}
-
-#define KEY_SIZE 256
-static void
-hash_variant_verify_key(hash_variant_t variant, uint8_t *key)
-{
- const int hashbytes = hash_variant_bits(variant) / 8;
- const int hashes_size = hashbytes * 256;
- VARIABLE_ARRAY(uint8_t, hashes, hashes_size);
- VARIABLE_ARRAY(uint8_t, final, hashbytes);
- unsigned i;
- uint32_t computed, expected;
-
- memset(key, 0, KEY_SIZE);
- memset(hashes, 0, hashes_size);
- memset(final, 0, hashbytes);
-
- /*
- * Hash keys of the form {0}, {0,1}, {0,1,2}, ..., {0,1,...,255} as the
- * seed.
- */
- for (i = 0; i < 256; i++) {
- key[i] = (uint8_t)i;
- switch (variant) {
- case hash_variant_x86_32: {
- uint32_t out;
- out = hash_x86_32(key, i, 256-i);
- memcpy(&hashes[i*hashbytes], &out, hashbytes);
- break;
- } case hash_variant_x86_128: {
- uint64_t out[2];
- hash_x86_128(key, i, 256-i, out);
- memcpy(&hashes[i*hashbytes], out, hashbytes);
- break;
- } case hash_variant_x64_128: {
- uint64_t out[2];
- hash_x64_128(key, i, 256-i, out);
- memcpy(&hashes[i*hashbytes], out, hashbytes);
- break;
- } default: not_reached();
- }
- }
-
- /* Hash the result array. */
- switch (variant) {
- case hash_variant_x86_32: {
- uint32_t out = hash_x86_32(hashes, hashes_size, 0);
- memcpy(final, &out, sizeof(out));
- break;
- } case hash_variant_x86_128: {
- uint64_t out[2];
- hash_x86_128(hashes, hashes_size, 0, out);
- memcpy(final, out, sizeof(out));
- break;
- } case hash_variant_x64_128: {
- uint64_t out[2];
- hash_x64_128(hashes, hashes_size, 0, out);
- memcpy(final, out, sizeof(out));
- break;
- } default: not_reached();
- }
-
- computed = (final[0] << 0) | (final[1] << 8) | (final[2] << 16) |
- (final[3] << 24);
-
- switch (variant) {
-#ifdef JEMALLOC_BIG_ENDIAN
- case hash_variant_x86_32: expected = 0x6213303eU; break;
- case hash_variant_x86_128: expected = 0x266820caU; break;
- case hash_variant_x64_128: expected = 0xcc622b6fU; break;
-#else
- case hash_variant_x86_32: expected = 0xb0f57ee3U; break;
- case hash_variant_x86_128: expected = 0xb3ece62aU; break;
- case hash_variant_x64_128: expected = 0x6384ba69U; break;
-#endif
- default: not_reached();
- }
-
- assert_u32_eq(computed, expected,
- "Hash mismatch for %s(): expected %#x but got %#x",
- hash_variant_string(variant), expected, computed);
-}
-
-static void
-hash_variant_verify(hash_variant_t variant)
-{
-#define MAX_ALIGN 16
- uint8_t key[KEY_SIZE + (MAX_ALIGN - 1)];
- unsigned i;
-
- for (i = 0; i < MAX_ALIGN; i++)
- hash_variant_verify_key(variant, &key[i]);
-#undef MAX_ALIGN
-}
-#undef KEY_SIZE
-
-TEST_BEGIN(test_hash_x86_32)
-{
-
- hash_variant_verify(hash_variant_x86_32);
-}
-TEST_END
-
-TEST_BEGIN(test_hash_x86_128)
-{
-
- hash_variant_verify(hash_variant_x86_128);
-}
-TEST_END
-
-TEST_BEGIN(test_hash_x64_128)
-{
-
- hash_variant_verify(hash_variant_x64_128);
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_hash_x86_32,
- test_hash_x86_128,
- test_hash_x64_128));
-}
diff --git a/memory/jemalloc/src/test/unit/junk.c b/memory/jemalloc/src/test/unit/junk.c
deleted file mode 100644
index 460bd524d3..0000000000
--- a/memory/jemalloc/src/test/unit/junk.c
+++ /dev/null
@@ -1,253 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#ifdef JEMALLOC_FILL
-# ifndef JEMALLOC_TEST_JUNK_OPT
-# define JEMALLOC_TEST_JUNK_OPT "junk:true"
-# endif
-const char *malloc_conf =
- "abort:false,zero:false,redzone:true,quarantine:0," JEMALLOC_TEST_JUNK_OPT;
-#endif
-
-static arena_dalloc_junk_small_t *arena_dalloc_junk_small_orig;
-static arena_dalloc_junk_large_t *arena_dalloc_junk_large_orig;
-static huge_dalloc_junk_t *huge_dalloc_junk_orig;
-static void *watch_for_junking;
-static bool saw_junking;
-
-static void
-watch_junking(void *p)
-{
-
- watch_for_junking = p;
- saw_junking = false;
-}
-
-static void
-arena_dalloc_junk_small_intercept(void *ptr, arena_bin_info_t *bin_info)
-{
- size_t i;
-
- arena_dalloc_junk_small_orig(ptr, bin_info);
- for (i = 0; i < bin_info->reg_size; i++) {
- assert_u_eq(((uint8_t *)ptr)[i], JEMALLOC_FREE_JUNK,
- "Missing junk fill for byte %zu/%zu of deallocated region",
- i, bin_info->reg_size);
- }
- if (ptr == watch_for_junking)
- saw_junking = true;
-}
-
-static void
-arena_dalloc_junk_large_intercept(void *ptr, size_t usize)
-{
- size_t i;
-
- arena_dalloc_junk_large_orig(ptr, usize);
- for (i = 0; i < usize; i++) {
- assert_u_eq(((uint8_t *)ptr)[i], JEMALLOC_FREE_JUNK,
- "Missing junk fill for byte %zu/%zu of deallocated region",
- i, usize);
- }
- if (ptr == watch_for_junking)
- saw_junking = true;
-}
-
-static void
-huge_dalloc_junk_intercept(void *ptr, size_t usize)
-{
-
- huge_dalloc_junk_orig(ptr, usize);
- /*
- * The conditions under which junk filling actually occurs are nuanced
- * enough that it doesn't make sense to duplicate the decision logic in
- * test code, so don't actually check that the region is junk-filled.
- */
- if (ptr == watch_for_junking)
- saw_junking = true;
-}
-
-static void
-test_junk(size_t sz_min, size_t sz_max)
-{
- uint8_t *s;
- size_t sz_prev, sz, i;
-
- if (opt_junk_free) {
- arena_dalloc_junk_small_orig = arena_dalloc_junk_small;
- arena_dalloc_junk_small = arena_dalloc_junk_small_intercept;
- arena_dalloc_junk_large_orig = arena_dalloc_junk_large;
- arena_dalloc_junk_large = arena_dalloc_junk_large_intercept;
- huge_dalloc_junk_orig = huge_dalloc_junk;
- huge_dalloc_junk = huge_dalloc_junk_intercept;
- }
-
- sz_prev = 0;
- s = (uint8_t *)mallocx(sz_min, 0);
- assert_ptr_not_null((void *)s, "Unexpected mallocx() failure");
-
- for (sz = sallocx(s, 0); sz <= sz_max;
- sz_prev = sz, sz = sallocx(s, 0)) {
- if (sz_prev > 0) {
- assert_u_eq(s[0], 'a',
- "Previously allocated byte %zu/%zu is corrupted",
- ZU(0), sz_prev);
- assert_u_eq(s[sz_prev-1], 'a',
- "Previously allocated byte %zu/%zu is corrupted",
- sz_prev-1, sz_prev);
- }
-
- for (i = sz_prev; i < sz; i++) {
- if (opt_junk_alloc) {
- assert_u_eq(s[i], JEMALLOC_ALLOC_JUNK,
- "Newly allocated byte %zu/%zu isn't "
- "junk-filled", i, sz);
- }
- s[i] = 'a';
- }
-
- if (xallocx(s, sz+1, 0, 0) == sz) {
- watch_junking(s);
- s = (uint8_t *)rallocx(s, sz+1, 0);
- assert_ptr_not_null((void *)s,
- "Unexpected rallocx() failure");
- assert_true(!opt_junk_free || saw_junking,
- "Expected region of size %zu to be junk-filled",
- sz);
- }
- }
-
- watch_junking(s);
- dallocx(s, 0);
- assert_true(!opt_junk_free || saw_junking,
- "Expected region of size %zu to be junk-filled", sz);
-
- if (opt_junk_free) {
- arena_dalloc_junk_small = arena_dalloc_junk_small_orig;
- arena_dalloc_junk_large = arena_dalloc_junk_large_orig;
- huge_dalloc_junk = huge_dalloc_junk_orig;
- }
-}
-
-TEST_BEGIN(test_junk_small)
-{
-
- test_skip_if(!config_fill);
- test_junk(1, SMALL_MAXCLASS-1);
-}
-TEST_END
-
-TEST_BEGIN(test_junk_large)
-{
-
- test_skip_if(!config_fill);
- test_junk(SMALL_MAXCLASS+1, large_maxclass);
-}
-TEST_END
-
-TEST_BEGIN(test_junk_huge)
-{
-
- test_skip_if(!config_fill);
- test_junk(large_maxclass+1, chunksize*2);
-}
-TEST_END
-
-arena_ralloc_junk_large_t *arena_ralloc_junk_large_orig;
-static void *most_recently_trimmed;
-
-static size_t
-shrink_size(size_t size)
-{
- size_t shrink_size;
-
- for (shrink_size = size - 1; nallocx(shrink_size, 0) == size;
- shrink_size--)
- ; /* Do nothing. */
-
- return (shrink_size);
-}
-
-static void
-arena_ralloc_junk_large_intercept(void *ptr, size_t old_usize, size_t usize)
-{
-
- arena_ralloc_junk_large_orig(ptr, old_usize, usize);
- assert_zu_eq(old_usize, large_maxclass, "Unexpected old_usize");
- assert_zu_eq(usize, shrink_size(large_maxclass), "Unexpected usize");
- most_recently_trimmed = ptr;
-}
-
-TEST_BEGIN(test_junk_large_ralloc_shrink)
-{
- void *p1, *p2;
-
- p1 = mallocx(large_maxclass, 0);
- assert_ptr_not_null(p1, "Unexpected mallocx() failure");
-
- arena_ralloc_junk_large_orig = arena_ralloc_junk_large;
- arena_ralloc_junk_large = arena_ralloc_junk_large_intercept;
-
- p2 = rallocx(p1, shrink_size(large_maxclass), 0);
- assert_ptr_eq(p1, p2, "Unexpected move during shrink");
-
- arena_ralloc_junk_large = arena_ralloc_junk_large_orig;
-
- assert_ptr_eq(most_recently_trimmed, p1,
- "Expected trimmed portion of region to be junk-filled");
-}
-TEST_END
-
-static bool detected_redzone_corruption;
-
-static void
-arena_redzone_corruption_replacement(void *ptr, size_t usize, bool after,
- size_t offset, uint8_t byte)
-{
-
- detected_redzone_corruption = true;
-}
-
-TEST_BEGIN(test_junk_redzone)
-{
- char *s;
- arena_redzone_corruption_t *arena_redzone_corruption_orig;
-
- test_skip_if(!config_fill);
- test_skip_if(!opt_junk_alloc || !opt_junk_free);
-
- arena_redzone_corruption_orig = arena_redzone_corruption;
- arena_redzone_corruption = arena_redzone_corruption_replacement;
-
- /* Test underflow. */
- detected_redzone_corruption = false;
- s = (char *)mallocx(1, 0);
- assert_ptr_not_null((void *)s, "Unexpected mallocx() failure");
- s[-1] = 0xbb;
- dallocx(s, 0);
- assert_true(detected_redzone_corruption,
- "Did not detect redzone corruption");
-
- /* Test overflow. */
- detected_redzone_corruption = false;
- s = (char *)mallocx(1, 0);
- assert_ptr_not_null((void *)s, "Unexpected mallocx() failure");
- s[sallocx(s, 0)] = 0xbb;
- dallocx(s, 0);
- assert_true(detected_redzone_corruption,
- "Did not detect redzone corruption");
-
- arena_redzone_corruption = arena_redzone_corruption_orig;
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_junk_small,
- test_junk_large,
- test_junk_huge,
- test_junk_large_ralloc_shrink,
- test_junk_redzone));
-}
diff --git a/memory/jemalloc/src/test/unit/junk_alloc.c b/memory/jemalloc/src/test/unit/junk_alloc.c
deleted file mode 100644
index a5895b5c0a..0000000000
--- a/memory/jemalloc/src/test/unit/junk_alloc.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define JEMALLOC_TEST_JUNK_OPT "junk:alloc"
-#include "junk.c"
-#undef JEMALLOC_TEST_JUNK_OPT
diff --git a/memory/jemalloc/src/test/unit/junk_free.c b/memory/jemalloc/src/test/unit/junk_free.c
deleted file mode 100644
index bb5183c90f..0000000000
--- a/memory/jemalloc/src/test/unit/junk_free.c
+++ /dev/null
@@ -1,3 +0,0 @@
-#define JEMALLOC_TEST_JUNK_OPT "junk:free"
-#include "junk.c"
-#undef JEMALLOC_TEST_JUNK_OPT
diff --git a/memory/jemalloc/src/test/unit/lg_chunk.c b/memory/jemalloc/src/test/unit/lg_chunk.c
deleted file mode 100644
index 7e5df3814d..0000000000
--- a/memory/jemalloc/src/test/unit/lg_chunk.c
+++ /dev/null
@@ -1,26 +0,0 @@
-#include "test/jemalloc_test.h"
-
-/*
- * Make sure that opt.lg_chunk clamping is sufficient. In practice, this test
- * program will fail a debug assertion during initialization and abort (rather
- * than the test soft-failing) if clamping is insufficient.
- */
-const char *malloc_conf = "lg_chunk:0";
-
-TEST_BEGIN(test_lg_chunk_clamp)
-{
- void *p;
-
- p = mallocx(1, 0);
- assert_ptr_not_null(p, "Unexpected mallocx() failure");
- dallocx(p, 0);
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_lg_chunk_clamp));
-}
diff --git a/memory/jemalloc/src/test/unit/mallctl.c b/memory/jemalloc/src/test/unit/mallctl.c
deleted file mode 100644
index 69f8c20c17..0000000000
--- a/memory/jemalloc/src/test/unit/mallctl.c
+++ /dev/null
@@ -1,731 +0,0 @@
-#include "test/jemalloc_test.h"
-
-TEST_BEGIN(test_mallctl_errors)
-{
- uint64_t epoch;
- size_t sz;
-
- assert_d_eq(mallctl("no_such_name", NULL, NULL, NULL, 0), ENOENT,
- "mallctl() should return ENOENT for non-existent names");
-
- assert_d_eq(mallctl("version", NULL, NULL, "0.0.0", strlen("0.0.0")),
- EPERM, "mallctl() should return EPERM on attempt to write "
- "read-only value");
-
- assert_d_eq(mallctl("epoch", NULL, NULL, &epoch, sizeof(epoch)-1),
- EINVAL, "mallctl() should return EINVAL for input size mismatch");
- assert_d_eq(mallctl("epoch", NULL, NULL, &epoch, sizeof(epoch)+1),
- EINVAL, "mallctl() should return EINVAL for input size mismatch");
-
- sz = sizeof(epoch)-1;
- assert_d_eq(mallctl("epoch", &epoch, &sz, NULL, 0), EINVAL,
- "mallctl() should return EINVAL for output size mismatch");
- sz = sizeof(epoch)+1;
- assert_d_eq(mallctl("epoch", &epoch, &sz, NULL, 0), EINVAL,
- "mallctl() should return EINVAL for output size mismatch");
-}
-TEST_END
-
-TEST_BEGIN(test_mallctlnametomib_errors)
-{
- size_t mib[1];
- size_t miblen;
-
- miblen = sizeof(mib)/sizeof(size_t);
- assert_d_eq(mallctlnametomib("no_such_name", mib, &miblen), ENOENT,
- "mallctlnametomib() should return ENOENT for non-existent names");
-}
-TEST_END
-
-TEST_BEGIN(test_mallctlbymib_errors)
-{
- uint64_t epoch;
- size_t sz;
- size_t mib[1];
- size_t miblen;
-
- miblen = sizeof(mib)/sizeof(size_t);
- assert_d_eq(mallctlnametomib("version", mib, &miblen), 0,
- "Unexpected mallctlnametomib() failure");
-
- assert_d_eq(mallctlbymib(mib, miblen, NULL, NULL, "0.0.0",
- strlen("0.0.0")), EPERM, "mallctl() should return EPERM on "
- "attempt to write read-only value");
-
- miblen = sizeof(mib)/sizeof(size_t);
- assert_d_eq(mallctlnametomib("epoch", mib, &miblen), 0,
- "Unexpected mallctlnametomib() failure");
-
- assert_d_eq(mallctlbymib(mib, miblen, NULL, NULL, &epoch,
- sizeof(epoch)-1), EINVAL,
- "mallctlbymib() should return EINVAL for input size mismatch");
- assert_d_eq(mallctlbymib(mib, miblen, NULL, NULL, &epoch,
- sizeof(epoch)+1), EINVAL,
- "mallctlbymib() should return EINVAL for input size mismatch");
-
- sz = sizeof(epoch)-1;
- assert_d_eq(mallctlbymib(mib, miblen, &epoch, &sz, NULL, 0), EINVAL,
- "mallctlbymib() should return EINVAL for output size mismatch");
- sz = sizeof(epoch)+1;
- assert_d_eq(mallctlbymib(mib, miblen, &epoch, &sz, NULL, 0), EINVAL,
- "mallctlbymib() should return EINVAL for output size mismatch");
-}
-TEST_END
-
-TEST_BEGIN(test_mallctl_read_write)
-{
- uint64_t old_epoch, new_epoch;
- size_t sz = sizeof(old_epoch);
-
- /* Blind. */
- assert_d_eq(mallctl("epoch", NULL, NULL, NULL, 0), 0,
- "Unexpected mallctl() failure");
- assert_zu_eq(sz, sizeof(old_epoch), "Unexpected output size");
-
- /* Read. */
- assert_d_eq(mallctl("epoch", &old_epoch, &sz, NULL, 0), 0,
- "Unexpected mallctl() failure");
- assert_zu_eq(sz, sizeof(old_epoch), "Unexpected output size");
-
- /* Write. */
- assert_d_eq(mallctl("epoch", NULL, NULL, &new_epoch, sizeof(new_epoch)),
- 0, "Unexpected mallctl() failure");
- assert_zu_eq(sz, sizeof(old_epoch), "Unexpected output size");
-
- /* Read+write. */
- assert_d_eq(mallctl("epoch", &old_epoch, &sz, &new_epoch,
- sizeof(new_epoch)), 0, "Unexpected mallctl() failure");
- assert_zu_eq(sz, sizeof(old_epoch), "Unexpected output size");
-}
-TEST_END
-
-TEST_BEGIN(test_mallctlnametomib_short_mib)
-{
- size_t mib[4];
- size_t miblen;
-
- miblen = 3;
- mib[3] = 42;
- assert_d_eq(mallctlnametomib("arenas.bin.0.nregs", mib, &miblen), 0,
- "Unexpected mallctlnametomib() failure");
- assert_zu_eq(miblen, 3, "Unexpected mib output length");
- assert_zu_eq(mib[3], 42,
- "mallctlnametomib() wrote past the end of the input mib");
-}
-TEST_END
-
-TEST_BEGIN(test_mallctl_config)
-{
-
-#define TEST_MALLCTL_CONFIG(config, t) do { \
- t oldval; \
- size_t sz = sizeof(oldval); \
- assert_d_eq(mallctl("config."#config, &oldval, &sz, NULL, 0), \
- 0, "Unexpected mallctl() failure"); \
- assert_b_eq(oldval, config_##config, "Incorrect config value"); \
- assert_zu_eq(sz, sizeof(oldval), "Unexpected output size"); \
-} while (0)
-
- TEST_MALLCTL_CONFIG(cache_oblivious, bool);
- TEST_MALLCTL_CONFIG(debug, bool);
- TEST_MALLCTL_CONFIG(fill, bool);
- TEST_MALLCTL_CONFIG(lazy_lock, bool);
- TEST_MALLCTL_CONFIG(malloc_conf, const char *);
- TEST_MALLCTL_CONFIG(munmap, bool);
- TEST_MALLCTL_CONFIG(prof, bool);
- TEST_MALLCTL_CONFIG(prof_libgcc, bool);
- TEST_MALLCTL_CONFIG(prof_libunwind, bool);
- TEST_MALLCTL_CONFIG(stats, bool);
- TEST_MALLCTL_CONFIG(tcache, bool);
- TEST_MALLCTL_CONFIG(tls, bool);
- TEST_MALLCTL_CONFIG(utrace, bool);
- TEST_MALLCTL_CONFIG(valgrind, bool);
- TEST_MALLCTL_CONFIG(xmalloc, bool);
-
-#undef TEST_MALLCTL_CONFIG
-}
-TEST_END
-
-TEST_BEGIN(test_mallctl_opt)
-{
- bool config_always = true;
-
-#define TEST_MALLCTL_OPT(t, opt, config) do { \
- t oldval; \
- size_t sz = sizeof(oldval); \
- int expected = config_##config ? 0 : ENOENT; \
- int result = mallctl("opt."#opt, &oldval, &sz, NULL, 0); \
- assert_d_eq(result, expected, \
- "Unexpected mallctl() result for opt."#opt); \
- assert_zu_eq(sz, sizeof(oldval), "Unexpected output size"); \
-} while (0)
-
- TEST_MALLCTL_OPT(bool, abort, always);
- TEST_MALLCTL_OPT(size_t, lg_chunk, always);
- TEST_MALLCTL_OPT(const char *, dss, always);
- TEST_MALLCTL_OPT(unsigned, narenas, always);
- TEST_MALLCTL_OPT(const char *, purge, always);
- TEST_MALLCTL_OPT(ssize_t, lg_dirty_mult, always);
- TEST_MALLCTL_OPT(ssize_t, decay_time, always);
- TEST_MALLCTL_OPT(bool, stats_print, always);
- TEST_MALLCTL_OPT(const char *, junk, fill);
- TEST_MALLCTL_OPT(size_t, quarantine, fill);
- TEST_MALLCTL_OPT(bool, redzone, fill);
- TEST_MALLCTL_OPT(bool, zero, fill);
- TEST_MALLCTL_OPT(bool, utrace, utrace);
- TEST_MALLCTL_OPT(bool, xmalloc, xmalloc);
- TEST_MALLCTL_OPT(bool, tcache, tcache);
- TEST_MALLCTL_OPT(size_t, lg_tcache_max, tcache);
- TEST_MALLCTL_OPT(bool, prof, prof);
- TEST_MALLCTL_OPT(const char *, prof_prefix, prof);
- TEST_MALLCTL_OPT(bool, prof_active, prof);
- TEST_MALLCTL_OPT(ssize_t, lg_prof_sample, prof);
- TEST_MALLCTL_OPT(bool, prof_accum, prof);
- TEST_MALLCTL_OPT(ssize_t, lg_prof_interval, prof);
- TEST_MALLCTL_OPT(bool, prof_gdump, prof);
- TEST_MALLCTL_OPT(bool, prof_final, prof);
- TEST_MALLCTL_OPT(bool, prof_leak, prof);
-
-#undef TEST_MALLCTL_OPT
-}
-TEST_END
-
-TEST_BEGIN(test_manpage_example)
-{
- unsigned nbins, i;
- size_t mib[4];
- size_t len, miblen;
-
- len = sizeof(nbins);
- assert_d_eq(mallctl("arenas.nbins", &nbins, &len, NULL, 0), 0,
- "Unexpected mallctl() failure");
-
- miblen = 4;
- assert_d_eq(mallctlnametomib("arenas.bin.0.size", mib, &miblen), 0,
- "Unexpected mallctlnametomib() failure");
- for (i = 0; i < nbins; i++) {
- size_t bin_size;
-
- mib[2] = i;
- len = sizeof(bin_size);
- assert_d_eq(mallctlbymib(mib, miblen, &bin_size, &len, NULL, 0),
- 0, "Unexpected mallctlbymib() failure");
- /* Do something with bin_size... */
- }
-}
-TEST_END
-
-TEST_BEGIN(test_tcache_none)
-{
- void *p0, *q, *p1;
-
- test_skip_if(!config_tcache);
-
- /* Allocate p and q. */
- p0 = mallocx(42, 0);
- assert_ptr_not_null(p0, "Unexpected mallocx() failure");
- q = mallocx(42, 0);
- assert_ptr_not_null(q, "Unexpected mallocx() failure");
-
- /* Deallocate p and q, but bypass the tcache for q. */
- dallocx(p0, 0);
- dallocx(q, MALLOCX_TCACHE_NONE);
-
- /* Make sure that tcache-based allocation returns p, not q. */
- p1 = mallocx(42, 0);
- assert_ptr_not_null(p1, "Unexpected mallocx() failure");
- assert_ptr_eq(p0, p1, "Expected tcache to allocate cached region");
-
- /* Clean up. */
- dallocx(p1, MALLOCX_TCACHE_NONE);
-}
-TEST_END
-
-TEST_BEGIN(test_tcache)
-{
-#define NTCACHES 10
- unsigned tis[NTCACHES];
- void *ps[NTCACHES];
- void *qs[NTCACHES];
- unsigned i;
- size_t sz, psz, qsz;
-
- test_skip_if(!config_tcache);
-
- psz = 42;
- qsz = nallocx(psz, 0) + 1;
-
- /* Create tcaches. */
- for (i = 0; i < NTCACHES; i++) {
- sz = sizeof(unsigned);
- assert_d_eq(mallctl("tcache.create", &tis[i], &sz, NULL, 0), 0,
- "Unexpected mallctl() failure, i=%u", i);
- }
-
- /* Exercise tcache ID recycling. */
- for (i = 0; i < NTCACHES; i++) {
- assert_d_eq(mallctl("tcache.destroy", NULL, NULL, &tis[i],
- sizeof(unsigned)), 0, "Unexpected mallctl() failure, i=%u",
- i);
- }
- for (i = 0; i < NTCACHES; i++) {
- sz = sizeof(unsigned);
- assert_d_eq(mallctl("tcache.create", &tis[i], &sz, NULL, 0), 0,
- "Unexpected mallctl() failure, i=%u", i);
- }
-
- /* Flush empty tcaches. */
- for (i = 0; i < NTCACHES; i++) {
- assert_d_eq(mallctl("tcache.flush", NULL, NULL, &tis[i],
- sizeof(unsigned)), 0, "Unexpected mallctl() failure, i=%u",
- i);
- }
-
- /* Cache some allocations. */
- for (i = 0; i < NTCACHES; i++) {
- ps[i] = mallocx(psz, MALLOCX_TCACHE(tis[i]));
- assert_ptr_not_null(ps[i], "Unexpected mallocx() failure, i=%u",
- i);
- dallocx(ps[i], MALLOCX_TCACHE(tis[i]));
-
- qs[i] = mallocx(qsz, MALLOCX_TCACHE(tis[i]));
- assert_ptr_not_null(qs[i], "Unexpected mallocx() failure, i=%u",
- i);
- dallocx(qs[i], MALLOCX_TCACHE(tis[i]));
- }
-
- /* Verify that tcaches allocate cached regions. */
- for (i = 0; i < NTCACHES; i++) {
- void *p0 = ps[i];
- ps[i] = mallocx(psz, MALLOCX_TCACHE(tis[i]));
- assert_ptr_not_null(ps[i], "Unexpected mallocx() failure, i=%u",
- i);
- assert_ptr_eq(ps[i], p0,
- "Expected mallocx() to allocate cached region, i=%u", i);
- }
-
- /* Verify that reallocation uses cached regions. */
- for (i = 0; i < NTCACHES; i++) {
- void *q0 = qs[i];
- qs[i] = rallocx(ps[i], qsz, MALLOCX_TCACHE(tis[i]));
- assert_ptr_not_null(qs[i], "Unexpected rallocx() failure, i=%u",
- i);
- assert_ptr_eq(qs[i], q0,
- "Expected rallocx() to allocate cached region, i=%u", i);
- /* Avoid undefined behavior in case of test failure. */
- if (qs[i] == NULL)
- qs[i] = ps[i];
- }
- for (i = 0; i < NTCACHES; i++)
- dallocx(qs[i], MALLOCX_TCACHE(tis[i]));
-
- /* Flush some non-empty tcaches. */
- for (i = 0; i < NTCACHES/2; i++) {
- assert_d_eq(mallctl("tcache.flush", NULL, NULL, &tis[i],
- sizeof(unsigned)), 0, "Unexpected mallctl() failure, i=%u",
- i);
- }
-
- /* Destroy tcaches. */
- for (i = 0; i < NTCACHES; i++) {
- assert_d_eq(mallctl("tcache.destroy", NULL, NULL, &tis[i],
- sizeof(unsigned)), 0, "Unexpected mallctl() failure, i=%u",
- i);
- }
-}
-TEST_END
-
-TEST_BEGIN(test_thread_arena)
-{
- unsigned arena_old, arena_new, narenas;
- size_t sz = sizeof(unsigned);
-
- assert_d_eq(mallctl("arenas.narenas", &narenas, &sz, NULL, 0), 0,
- "Unexpected mallctl() failure");
- assert_u_eq(narenas, opt_narenas, "Number of arenas incorrect");
- arena_new = narenas - 1;
- assert_d_eq(mallctl("thread.arena", &arena_old, &sz, &arena_new,
- sizeof(unsigned)), 0, "Unexpected mallctl() failure");
- arena_new = 0;
- assert_d_eq(mallctl("thread.arena", &arena_old, &sz, &arena_new,
- sizeof(unsigned)), 0, "Unexpected mallctl() failure");
-}
-TEST_END
-
-TEST_BEGIN(test_arena_i_lg_dirty_mult)
-{
- ssize_t lg_dirty_mult, orig_lg_dirty_mult, prev_lg_dirty_mult;
- size_t sz = sizeof(ssize_t);
-
- test_skip_if(opt_purge != purge_mode_ratio);
-
- assert_d_eq(mallctl("arena.0.lg_dirty_mult", &orig_lg_dirty_mult, &sz,
- NULL, 0), 0, "Unexpected mallctl() failure");
-
- lg_dirty_mult = -2;
- assert_d_eq(mallctl("arena.0.lg_dirty_mult", NULL, NULL,
- &lg_dirty_mult, sizeof(ssize_t)), EFAULT,
- "Unexpected mallctl() success");
-
- lg_dirty_mult = (sizeof(size_t) << 3);
- assert_d_eq(mallctl("arena.0.lg_dirty_mult", NULL, NULL,
- &lg_dirty_mult, sizeof(ssize_t)), EFAULT,
- "Unexpected mallctl() success");
-
- for (prev_lg_dirty_mult = orig_lg_dirty_mult, lg_dirty_mult = -1;
- lg_dirty_mult < (ssize_t)(sizeof(size_t) << 3); prev_lg_dirty_mult
- = lg_dirty_mult, lg_dirty_mult++) {
- ssize_t old_lg_dirty_mult;
-
- assert_d_eq(mallctl("arena.0.lg_dirty_mult", &old_lg_dirty_mult,
- &sz, &lg_dirty_mult, sizeof(ssize_t)), 0,
- "Unexpected mallctl() failure");
- assert_zd_eq(old_lg_dirty_mult, prev_lg_dirty_mult,
- "Unexpected old arena.0.lg_dirty_mult");
- }
-}
-TEST_END
-
-TEST_BEGIN(test_arena_i_decay_time)
-{
- ssize_t decay_time, orig_decay_time, prev_decay_time;
- size_t sz = sizeof(ssize_t);
-
- test_skip_if(opt_purge != purge_mode_decay);
-
- assert_d_eq(mallctl("arena.0.decay_time", &orig_decay_time, &sz,
- NULL, 0), 0, "Unexpected mallctl() failure");
-
- decay_time = -2;
- assert_d_eq(mallctl("arena.0.decay_time", NULL, NULL,
- &decay_time, sizeof(ssize_t)), EFAULT,
- "Unexpected mallctl() success");
-
- decay_time = 0x7fffffff;
- assert_d_eq(mallctl("arena.0.decay_time", NULL, NULL,
- &decay_time, sizeof(ssize_t)), 0,
- "Unexpected mallctl() failure");
-
- for (prev_decay_time = decay_time, decay_time = -1;
- decay_time < 20; prev_decay_time = decay_time, decay_time++) {
- ssize_t old_decay_time;
-
- assert_d_eq(mallctl("arena.0.decay_time", &old_decay_time,
- &sz, &decay_time, sizeof(ssize_t)), 0,
- "Unexpected mallctl() failure");
- assert_zd_eq(old_decay_time, prev_decay_time,
- "Unexpected old arena.0.decay_time");
- }
-}
-TEST_END
-
-TEST_BEGIN(test_arena_i_purge)
-{
- unsigned narenas;
- size_t sz = sizeof(unsigned);
- size_t mib[3];
- size_t miblen = 3;
-
- assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
- "Unexpected mallctl() failure");
-
- assert_d_eq(mallctl("arenas.narenas", &narenas, &sz, NULL, 0), 0,
- "Unexpected mallctl() failure");
- assert_d_eq(mallctlnametomib("arena.0.purge", mib, &miblen), 0,
- "Unexpected mallctlnametomib() failure");
- mib[1] = narenas;
- assert_d_eq(mallctlbymib(mib, miblen, NULL, NULL, NULL, 0), 0,
- "Unexpected mallctlbymib() failure");
-}
-TEST_END
-
-TEST_BEGIN(test_arena_i_decay)
-{
- unsigned narenas;
- size_t sz = sizeof(unsigned);
- size_t mib[3];
- size_t miblen = 3;
-
- assert_d_eq(mallctl("arena.0.decay", NULL, NULL, NULL, 0), 0,
- "Unexpected mallctl() failure");
-
- assert_d_eq(mallctl("arenas.narenas", &narenas, &sz, NULL, 0), 0,
- "Unexpected mallctl() failure");
- assert_d_eq(mallctlnametomib("arena.0.decay", mib, &miblen), 0,
- "Unexpected mallctlnametomib() failure");
- mib[1] = narenas;
- assert_d_eq(mallctlbymib(mib, miblen, NULL, NULL, NULL, 0), 0,
- "Unexpected mallctlbymib() failure");
-}
-TEST_END
-
-TEST_BEGIN(test_arena_i_dss)
-{
- const char *dss_prec_old, *dss_prec_new;
- size_t sz = sizeof(dss_prec_old);
- size_t mib[3];
- size_t miblen;
-
- miblen = sizeof(mib)/sizeof(size_t);
- assert_d_eq(mallctlnametomib("arena.0.dss", mib, &miblen), 0,
- "Unexpected mallctlnametomib() error");
-
- dss_prec_new = "disabled";
- assert_d_eq(mallctlbymib(mib, miblen, &dss_prec_old, &sz, &dss_prec_new,
- sizeof(dss_prec_new)), 0, "Unexpected mallctl() failure");
- assert_str_ne(dss_prec_old, "primary",
- "Unexpected default for dss precedence");
-
- assert_d_eq(mallctlbymib(mib, miblen, &dss_prec_new, &sz, &dss_prec_old,
- sizeof(dss_prec_old)), 0, "Unexpected mallctl() failure");
-
- assert_d_eq(mallctlbymib(mib, miblen, &dss_prec_old, &sz, NULL, 0), 0,
- "Unexpected mallctl() failure");
- assert_str_ne(dss_prec_old, "primary",
- "Unexpected value for dss precedence");
-
- mib[1] = narenas_total_get();
- dss_prec_new = "disabled";
- assert_d_eq(mallctlbymib(mib, miblen, &dss_prec_old, &sz, &dss_prec_new,
- sizeof(dss_prec_new)), 0, "Unexpected mallctl() failure");
- assert_str_ne(dss_prec_old, "primary",
- "Unexpected default for dss precedence");
-
- assert_d_eq(mallctlbymib(mib, miblen, &dss_prec_new, &sz, &dss_prec_old,
- sizeof(dss_prec_new)), 0, "Unexpected mallctl() failure");
-
- assert_d_eq(mallctlbymib(mib, miblen, &dss_prec_old, &sz, NULL, 0), 0,
- "Unexpected mallctl() failure");
- assert_str_ne(dss_prec_old, "primary",
- "Unexpected value for dss precedence");
-}
-TEST_END
-
-TEST_BEGIN(test_arenas_initialized)
-{
- unsigned narenas;
- size_t sz = sizeof(narenas);
-
- assert_d_eq(mallctl("arenas.narenas", &narenas, &sz, NULL, 0), 0,
- "Unexpected mallctl() failure");
- {
- VARIABLE_ARRAY(bool, initialized, narenas);
-
- sz = narenas * sizeof(bool);
- assert_d_eq(mallctl("arenas.initialized", initialized, &sz,
- NULL, 0), 0, "Unexpected mallctl() failure");
- }
-}
-TEST_END
-
-TEST_BEGIN(test_arenas_lg_dirty_mult)
-{
- ssize_t lg_dirty_mult, orig_lg_dirty_mult, prev_lg_dirty_mult;
- size_t sz = sizeof(ssize_t);
-
- test_skip_if(opt_purge != purge_mode_ratio);
-
- assert_d_eq(mallctl("arenas.lg_dirty_mult", &orig_lg_dirty_mult, &sz,
- NULL, 0), 0, "Unexpected mallctl() failure");
-
- lg_dirty_mult = -2;
- assert_d_eq(mallctl("arenas.lg_dirty_mult", NULL, NULL,
- &lg_dirty_mult, sizeof(ssize_t)), EFAULT,
- "Unexpected mallctl() success");
-
- lg_dirty_mult = (sizeof(size_t) << 3);
- assert_d_eq(mallctl("arenas.lg_dirty_mult", NULL, NULL,
- &lg_dirty_mult, sizeof(ssize_t)), EFAULT,
- "Unexpected mallctl() success");
-
- for (prev_lg_dirty_mult = orig_lg_dirty_mult, lg_dirty_mult = -1;
- lg_dirty_mult < (ssize_t)(sizeof(size_t) << 3); prev_lg_dirty_mult =
- lg_dirty_mult, lg_dirty_mult++) {
- ssize_t old_lg_dirty_mult;
-
- assert_d_eq(mallctl("arenas.lg_dirty_mult", &old_lg_dirty_mult,
- &sz, &lg_dirty_mult, sizeof(ssize_t)), 0,
- "Unexpected mallctl() failure");
- assert_zd_eq(old_lg_dirty_mult, prev_lg_dirty_mult,
- "Unexpected old arenas.lg_dirty_mult");
- }
-}
-TEST_END
-
-TEST_BEGIN(test_arenas_decay_time)
-{
- ssize_t decay_time, orig_decay_time, prev_decay_time;
- size_t sz = sizeof(ssize_t);
-
- test_skip_if(opt_purge != purge_mode_decay);
-
- assert_d_eq(mallctl("arenas.decay_time", &orig_decay_time, &sz,
- NULL, 0), 0, "Unexpected mallctl() failure");
-
- decay_time = -2;
- assert_d_eq(mallctl("arenas.decay_time", NULL, NULL,
- &decay_time, sizeof(ssize_t)), EFAULT,
- "Unexpected mallctl() success");
-
- decay_time = 0x7fffffff;
- assert_d_eq(mallctl("arenas.decay_time", NULL, NULL,
- &decay_time, sizeof(ssize_t)), 0,
- "Expected mallctl() failure");
-
- for (prev_decay_time = decay_time, decay_time = -1;
- decay_time < 20; prev_decay_time = decay_time, decay_time++) {
- ssize_t old_decay_time;
-
- assert_d_eq(mallctl("arenas.decay_time", &old_decay_time,
- &sz, &decay_time, sizeof(ssize_t)), 0,
- "Unexpected mallctl() failure");
- assert_zd_eq(old_decay_time, prev_decay_time,
- "Unexpected old arenas.decay_time");
- }
-}
-TEST_END
-
-TEST_BEGIN(test_arenas_constants)
-{
-
-#define TEST_ARENAS_CONSTANT(t, name, expected) do { \
- t name; \
- size_t sz = sizeof(t); \
- assert_d_eq(mallctl("arenas."#name, &name, &sz, NULL, 0), 0, \
- "Unexpected mallctl() failure"); \
- assert_zu_eq(name, expected, "Incorrect "#name" size"); \
-} while (0)
-
- TEST_ARENAS_CONSTANT(size_t, quantum, QUANTUM);
- TEST_ARENAS_CONSTANT(size_t, page, PAGE);
- TEST_ARENAS_CONSTANT(unsigned, nbins, NBINS);
- TEST_ARENAS_CONSTANT(unsigned, nlruns, nlclasses);
- TEST_ARENAS_CONSTANT(unsigned, nhchunks, nhclasses);
-
-#undef TEST_ARENAS_CONSTANT
-}
-TEST_END
-
-TEST_BEGIN(test_arenas_bin_constants)
-{
-
-#define TEST_ARENAS_BIN_CONSTANT(t, name, expected) do { \
- t name; \
- size_t sz = sizeof(t); \
- assert_d_eq(mallctl("arenas.bin.0."#name, &name, &sz, NULL, 0), \
- 0, "Unexpected mallctl() failure"); \
- assert_zu_eq(name, expected, "Incorrect "#name" size"); \
-} while (0)
-
- TEST_ARENAS_BIN_CONSTANT(size_t, size, arena_bin_info[0].reg_size);
- TEST_ARENAS_BIN_CONSTANT(uint32_t, nregs, arena_bin_info[0].nregs);
- TEST_ARENAS_BIN_CONSTANT(size_t, run_size, arena_bin_info[0].run_size);
-
-#undef TEST_ARENAS_BIN_CONSTANT
-}
-TEST_END
-
-TEST_BEGIN(test_arenas_lrun_constants)
-{
-
-#define TEST_ARENAS_LRUN_CONSTANT(t, name, expected) do { \
- t name; \
- size_t sz = sizeof(t); \
- assert_d_eq(mallctl("arenas.lrun.0."#name, &name, &sz, NULL, \
- 0), 0, "Unexpected mallctl() failure"); \
- assert_zu_eq(name, expected, "Incorrect "#name" size"); \
-} while (0)
-
- TEST_ARENAS_LRUN_CONSTANT(size_t, size, LARGE_MINCLASS);
-
-#undef TEST_ARENAS_LRUN_CONSTANT
-}
-TEST_END
-
-TEST_BEGIN(test_arenas_hchunk_constants)
-{
-
-#define TEST_ARENAS_HCHUNK_CONSTANT(t, name, expected) do { \
- t name; \
- size_t sz = sizeof(t); \
- assert_d_eq(mallctl("arenas.hchunk.0."#name, &name, &sz, NULL, \
- 0), 0, "Unexpected mallctl() failure"); \
- assert_zu_eq(name, expected, "Incorrect "#name" size"); \
-} while (0)
-
- TEST_ARENAS_HCHUNK_CONSTANT(size_t, size, chunksize);
-
-#undef TEST_ARENAS_HCHUNK_CONSTANT
-}
-TEST_END
-
-TEST_BEGIN(test_arenas_extend)
-{
- unsigned narenas_before, arena, narenas_after;
- size_t sz = sizeof(unsigned);
-
- assert_d_eq(mallctl("arenas.narenas", &narenas_before, &sz, NULL, 0), 0,
- "Unexpected mallctl() failure");
- assert_d_eq(mallctl("arenas.extend", &arena, &sz, NULL, 0), 0,
- "Unexpected mallctl() failure");
- assert_d_eq(mallctl("arenas.narenas", &narenas_after, &sz, NULL, 0), 0,
- "Unexpected mallctl() failure");
-
- assert_u_eq(narenas_before+1, narenas_after,
- "Unexpected number of arenas before versus after extension");
- assert_u_eq(arena, narenas_after-1, "Unexpected arena index");
-}
-TEST_END
-
-TEST_BEGIN(test_stats_arenas)
-{
-
-#define TEST_STATS_ARENAS(t, name) do { \
- t name; \
- size_t sz = sizeof(t); \
- assert_d_eq(mallctl("stats.arenas.0."#name, &name, &sz, NULL, \
- 0), 0, "Unexpected mallctl() failure"); \
-} while (0)
-
- TEST_STATS_ARENAS(unsigned, nthreads);
- TEST_STATS_ARENAS(const char *, dss);
- TEST_STATS_ARENAS(ssize_t, lg_dirty_mult);
- TEST_STATS_ARENAS(ssize_t, decay_time);
- TEST_STATS_ARENAS(size_t, pactive);
- TEST_STATS_ARENAS(size_t, pdirty);
-
-#undef TEST_STATS_ARENAS
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_mallctl_errors,
- test_mallctlnametomib_errors,
- test_mallctlbymib_errors,
- test_mallctl_read_write,
- test_mallctlnametomib_short_mib,
- test_mallctl_config,
- test_mallctl_opt,
- test_manpage_example,
- test_tcache_none,
- test_tcache,
- test_thread_arena,
- test_arena_i_lg_dirty_mult,
- test_arena_i_decay_time,
- test_arena_i_purge,
- test_arena_i_decay,
- test_arena_i_dss,
- test_arenas_initialized,
- test_arenas_lg_dirty_mult,
- test_arenas_decay_time,
- test_arenas_constants,
- test_arenas_bin_constants,
- test_arenas_lrun_constants,
- test_arenas_hchunk_constants,
- test_arenas_extend,
- test_stats_arenas));
-}
diff --git a/memory/jemalloc/src/test/unit/math.c b/memory/jemalloc/src/test/unit/math.c
deleted file mode 100644
index adb72bed97..0000000000
--- a/memory/jemalloc/src/test/unit/math.c
+++ /dev/null
@@ -1,398 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#define MAX_REL_ERR 1.0e-9
-#define MAX_ABS_ERR 1.0e-9
-
-#include <float.h>
-
-#ifdef __PGI
-#undef INFINITY
-#endif
-
-#ifndef INFINITY
-#define INFINITY (DBL_MAX + DBL_MAX)
-#endif
-
-static bool
-double_eq_rel(double a, double b, double max_rel_err, double max_abs_err)
-{
- double rel_err;
-
- if (fabs(a - b) < max_abs_err)
- return (true);
- rel_err = (fabs(b) > fabs(a)) ? fabs((a-b)/b) : fabs((a-b)/a);
- return (rel_err < max_rel_err);
-}
-
-static uint64_t
-factorial(unsigned x)
-{
- uint64_t ret = 1;
- unsigned i;
-
- for (i = 2; i <= x; i++)
- ret *= (uint64_t)i;
-
- return (ret);
-}
-
-TEST_BEGIN(test_ln_gamma_factorial)
-{
- unsigned x;
-
- /* exp(ln_gamma(x)) == (x-1)! for integer x. */
- for (x = 1; x <= 21; x++) {
- assert_true(double_eq_rel(exp(ln_gamma(x)),
- (double)factorial(x-1), MAX_REL_ERR, MAX_ABS_ERR),
- "Incorrect factorial result for x=%u", x);
- }
-}
-TEST_END
-
-/* Expected ln_gamma([0.0..100.0] increment=0.25). */
-static const double ln_gamma_misc_expected[] = {
- INFINITY,
- 1.28802252469807743, 0.57236494292470008, 0.20328095143129538,
- 0.00000000000000000, -0.09827183642181320, -0.12078223763524518,
- -0.08440112102048555, 0.00000000000000000, 0.12487171489239651,
- 0.28468287047291918, 0.47521466691493719, 0.69314718055994529,
- 0.93580193110872523, 1.20097360234707429, 1.48681557859341718,
- 1.79175946922805496, 2.11445692745037128, 2.45373657084244234,
- 2.80857141857573644, 3.17805383034794575, 3.56137591038669710,
- 3.95781396761871651, 4.36671603662228680, 4.78749174278204581,
- 5.21960398699022932, 5.66256205985714178, 6.11591589143154568,
- 6.57925121201010121, 7.05218545073853953, 7.53436423675873268,
- 8.02545839631598312, 8.52516136106541467, 9.03318691960512332,
- 9.54926725730099690, 10.07315123968123949, 10.60460290274525086,
- 11.14340011995171231, 11.68933342079726856, 12.24220494005076176,
- 12.80182748008146909, 13.36802367147604720, 13.94062521940376342,
- 14.51947222506051816, 15.10441257307551943, 15.69530137706046524,
- 16.29200047656724237, 16.89437797963419285, 17.50230784587389010,
- 18.11566950571089407, 18.73434751193644843, 19.35823122022435427,
- 19.98721449566188468, 20.62119544270163018, 21.26007615624470048,
- 21.90376249182879320, 22.55216385312342098, 23.20519299513386002,
- 23.86276584168908954, 24.52480131594137802, 25.19122118273868338,
- 25.86194990184851861, 26.53691449111561340, 27.21604439872720604,
- 27.89927138384089389, 28.58652940490193828, 29.27775451504081516,
- 29.97288476399884871, 30.67186010608067548, 31.37462231367769050,
- 32.08111489594735843, 32.79128302226991565, 33.50507345013689076,
- 34.22243445715505317, 34.94331577687681545, 35.66766853819134298,
- 36.39544520803305261, 37.12659953718355865, 37.86108650896109395,
- 38.59886229060776230, 39.33988418719949465, 40.08411059791735198,
- 40.83150097453079752, 41.58201578195490100, 42.33561646075348506,
- 43.09226539146988699, 43.85192586067515208, 44.61456202863158893,
- 45.38013889847690052, 46.14862228684032885, 46.91997879580877395,
- 47.69417578616628361, 48.47118135183522014, 49.25096429545256882,
- 50.03349410501914463, 50.81874093156324790, 51.60667556776436982,
- 52.39726942748592364, 53.19049452616926743, 53.98632346204390586,
- 54.78472939811231157, 55.58568604486942633, 56.38916764371992940,
- 57.19514895105859864, 58.00360522298051080, 58.81451220059079787,
- 59.62784609588432261, 60.44358357816834371, 61.26170176100199427,
- 62.08217818962842927, 62.90499082887649962, 63.73011805151035958,
- 64.55753862700632340, 65.38723171073768015, 66.21917683354901385,
- 67.05335389170279825, 67.88974313718154008, 68.72832516833013017,
- 69.56908092082363737, 70.41199165894616385, 71.25703896716800045,
- 72.10420474200799390, 72.95347118416940191, 73.80482079093779646,
- 74.65823634883015814, 75.51370092648485866, 76.37119786778275454,
- 77.23071078519033961, 78.09222355331530707, 78.95572030266725960,
- 79.82118541361435859, 80.68860351052903468, 81.55795945611502873,
- 82.42923834590904164, 83.30242550295004378, 84.17750647261028973,
- 85.05446701758152983, 85.93329311301090456, 86.81397094178107920,
- 87.69648688992882057, 88.58082754219766741, 89.46697967771913795,
- 90.35493026581838194, 91.24466646193963015, 92.13617560368709292,
- 93.02944520697742803, 93.92446296229978486, 94.82121673107967297,
- 95.71969454214321615, 96.61988458827809723, 97.52177522288820910,
- 98.42535495673848800, 99.33061245478741341, 100.23753653310367895,
- 101.14611615586458981, 102.05634043243354370, 102.96819861451382394,
- 103.88168009337621811, 104.79677439715833032, 105.71347118823287303,
- 106.63176026064346047, 107.55163153760463501, 108.47307506906540198,
- 109.39608102933323153, 110.32063971475740516, 111.24674154146920557,
- 112.17437704317786995, 113.10353686902013237, 114.03421178146170689,
- 114.96639265424990128, 115.90007047041454769, 116.83523632031698014,
- 117.77188139974506953, 118.70999700805310795, 119.64957454634490830,
- 120.59060551569974962, 121.53308151543865279, 122.47699424143097247,
- 123.42233548443955726, 124.36909712850338394, 125.31727114935689826,
- 126.26684961288492559, 127.21782467361175861, 128.17018857322420899,
- 129.12393363912724453, 130.07905228303084755, 131.03553699956862033,
- 131.99338036494577864, 132.95257503561629164, 133.91311374698926784,
- 134.87498931216194364, 135.83819462068046846, 136.80272263732638294,
- 137.76856640092901785, 138.73571902320256299, 139.70417368760718091,
- 140.67392364823425055, 141.64496222871400732, 142.61728282114600574,
- 143.59087888505104047, 144.56574394634486680, 145.54187159633210058,
- 146.51925549072063859, 147.49788934865566148, 148.47776695177302031,
- 149.45888214327129617, 150.44122882700193600, 151.42480096657754984,
- 152.40959258449737490, 153.39559776128982094, 154.38281063467164245,
- 155.37122539872302696, 156.36083630307879844, 157.35163765213474107,
- 158.34362380426921391, 159.33678917107920370, 160.33112821663092973,
- 161.32663545672428995, 162.32330545817117695, 163.32113283808695314,
- 164.32011226319519892, 165.32023844914485267, 166.32150615984036790,
- 167.32391020678358018, 168.32744544842768164, 169.33210678954270634,
- 170.33788918059275375, 171.34478761712384198, 172.35279713916281707,
- 173.36191283062726143, 174.37212981874515094, 175.38344327348534080,
- 176.39584840699734514, 177.40934047306160437, 178.42391476654847793,
- 179.43956662288721304, 180.45629141754378111, 181.47408456550741107,
- 182.49294152078630304, 183.51285777591152737, 184.53382886144947861,
- 185.55585034552262869, 186.57891783333786861, 187.60302696672312095,
- 188.62817342367162610, 189.65435291789341932, 190.68156119837468054,
- 191.70979404894376330, 192.73904728784492590, 193.76931676731820176,
- 194.80059837318714244, 195.83288802445184729, 196.86618167288995096,
- 197.90047530266301123, 198.93576492992946214, 199.97204660246373464,
- 201.00931639928148797, 202.04757043027063901, 203.08680483582807597,
- 204.12701578650228385, 205.16819948264117102, 206.21035215404597807,
- 207.25347005962987623, 208.29754948708190909, 209.34258675253678916,
- 210.38857820024875878, 211.43552020227099320, 212.48340915813977858,
- 213.53224149456323744, 214.58201366511514152, 215.63272214993284592,
- 216.68436345542014010, 217.73693411395422004, 218.79043068359703739,
- 219.84484974781133815, 220.90018791517996988, 221.95644181913033322,
- 223.01360811766215875, 224.07168349307951871, 225.13066465172661879,
- 226.19054832372759734, 227.25133126272962159, 228.31301024565024704,
- 229.37558207242807384, 230.43904356577689896, 231.50339157094342113,
- 232.56862295546847008, 233.63473460895144740, 234.70172344281823484,
- 235.76958639009222907, 236.83832040516844586, 237.90792246359117712,
- 238.97838956183431947, 240.04971871708477238, 241.12190696702904802,
- 242.19495136964280846, 243.26884900298270509, 244.34359696498191283,
- 245.41919237324782443, 246.49563236486270057, 247.57291409618682110,
- 248.65103474266476269, 249.72999149863338175, 250.80978157713354904,
- 251.89040220972316320, 252.97185064629374551, 254.05412415488834199,
- 255.13722002152300661, 256.22113555000953511, 257.30586806178126835,
- 258.39141489572085675, 259.47777340799029844, 260.56494097186322279,
- 261.65291497755913497, 262.74169283208021852, 263.83127195904967266,
- 264.92164979855277807, 266.01282380697938379, 267.10479145686849733,
- 268.19755023675537586, 269.29109765101975427, 270.38543121973674488,
- 271.48054847852881721, 272.57644697842033565, 273.67312428569374561,
- 274.77057798174683967, 275.86880566295326389, 276.96780494052313770,
- 278.06757344036617496, 279.16810880295668085, 280.26940868320008349,
- 281.37147075030043197, 282.47429268763045229, 283.57787219260217171,
- 284.68220697654078322, 285.78729476455760050, 286.89313329542699194,
- 287.99972032146268930, 289.10705360839756395, 290.21513093526289140,
- 291.32395009427028754, 292.43350889069523646, 293.54380514276073200,
- 294.65483668152336350, 295.76660135076059532, 296.87909700685889902,
- 297.99232151870342022, 299.10627276756946458, 300.22094864701409733,
- 301.33634706277030091, 302.45246593264130297, 303.56930318639643929,
- 304.68685676566872189, 305.80512462385280514, 306.92410472600477078,
- 308.04379504874236773, 309.16419358014690033, 310.28529831966631036,
- 311.40710727801865687, 312.52961847709792664, 313.65282994987899201,
- 314.77673974032603610, 315.90134590329950015, 317.02664650446632777,
- 318.15263962020929966, 319.27932333753892635, 320.40669575400545455,
- 321.53475497761127144, 322.66349912672620803, 323.79292633000159185,
- 324.92303472628691452, 326.05382246454587403, 327.18528770377525916,
- 328.31742861292224234, 329.45024337080525356, 330.58373016603343331,
- 331.71788719692847280, 332.85271267144611329, 333.98820480709991898,
- 335.12436183088397001, 336.26118197919845443, 337.39866349777429377,
- 338.53680464159958774, 339.67560367484657036, 340.81505887079896411,
- 341.95516851178109619, 343.09593088908627578, 344.23734430290727460,
- 345.37940706226686416, 346.52211748494903532, 347.66547389743118401,
- 348.80947463481720661, 349.95411804077025408, 351.09940246744753267,
- 352.24532627543504759, 353.39188783368263103, 354.53908551944078908,
- 355.68691771819692349, 356.83538282361303118, 357.98447923746385868,
- 359.13420536957539753
-};
-
-TEST_BEGIN(test_ln_gamma_misc)
-{
- unsigned i;
-
- for (i = 1; i < sizeof(ln_gamma_misc_expected)/sizeof(double); i++) {
- double x = (double)i * 0.25;
- assert_true(double_eq_rel(ln_gamma(x),
- ln_gamma_misc_expected[i], MAX_REL_ERR, MAX_ABS_ERR),
- "Incorrect ln_gamma result for i=%u", i);
- }
-}
-TEST_END
-
-/* Expected pt_norm([0.01..0.99] increment=0.01). */
-static const double pt_norm_expected[] = {
- -INFINITY,
- -2.32634787404084076, -2.05374891063182252, -1.88079360815125085,
- -1.75068607125216946, -1.64485362695147264, -1.55477359459685305,
- -1.47579102817917063, -1.40507156030963221, -1.34075503369021654,
- -1.28155156554460081, -1.22652812003661049, -1.17498679206608991,
- -1.12639112903880045, -1.08031934081495606, -1.03643338949378938,
- -0.99445788320975281, -0.95416525314619416, -0.91536508784281390,
- -0.87789629505122846, -0.84162123357291418, -0.80642124701824025,
- -0.77219321418868492, -0.73884684918521371, -0.70630256284008752,
- -0.67448975019608171, -0.64334540539291685, -0.61281299101662701,
- -0.58284150727121620, -0.55338471955567281, -0.52440051270804067,
- -0.49585034734745320, -0.46769879911450812, -0.43991316567323380,
- -0.41246312944140462, -0.38532046640756751, -0.35845879325119373,
- -0.33185334643681652, -0.30548078809939738, -0.27931903444745404,
- -0.25334710313579978, -0.22754497664114931, -0.20189347914185077,
- -0.17637416478086135, -0.15096921549677725, -0.12566134685507399,
- -0.10043372051146975, -0.07526986209982976, -0.05015358346473352,
- -0.02506890825871106, 0.00000000000000000, 0.02506890825871106,
- 0.05015358346473366, 0.07526986209982990, 0.10043372051146990,
- 0.12566134685507413, 0.15096921549677739, 0.17637416478086146,
- 0.20189347914185105, 0.22754497664114931, 0.25334710313579978,
- 0.27931903444745404, 0.30548078809939738, 0.33185334643681652,
- 0.35845879325119373, 0.38532046640756762, 0.41246312944140484,
- 0.43991316567323391, 0.46769879911450835, 0.49585034734745348,
- 0.52440051270804111, 0.55338471955567303, 0.58284150727121620,
- 0.61281299101662701, 0.64334540539291685, 0.67448975019608171,
- 0.70630256284008752, 0.73884684918521371, 0.77219321418868492,
- 0.80642124701824036, 0.84162123357291441, 0.87789629505122879,
- 0.91536508784281423, 0.95416525314619460, 0.99445788320975348,
- 1.03643338949378938, 1.08031934081495606, 1.12639112903880045,
- 1.17498679206608991, 1.22652812003661049, 1.28155156554460081,
- 1.34075503369021654, 1.40507156030963265, 1.47579102817917085,
- 1.55477359459685394, 1.64485362695147308, 1.75068607125217102,
- 1.88079360815125041, 2.05374891063182208, 2.32634787404084076
-};
-
-TEST_BEGIN(test_pt_norm)
-{
- unsigned i;
-
- for (i = 1; i < sizeof(pt_norm_expected)/sizeof(double); i++) {
- double p = (double)i * 0.01;
- assert_true(double_eq_rel(pt_norm(p), pt_norm_expected[i],
- MAX_REL_ERR, MAX_ABS_ERR),
- "Incorrect pt_norm result for i=%u", i);
- }
-}
-TEST_END
-
-/*
- * Expected pt_chi2(p=[0.01..0.99] increment=0.07,
- * df={0.1, 1.1, 10.1, 100.1, 1000.1}).
- */
-static const double pt_chi2_df[] = {0.1, 1.1, 10.1, 100.1, 1000.1};
-static const double pt_chi2_expected[] = {
- 1.168926411457320e-40, 1.347680397072034e-22, 3.886980416666260e-17,
- 8.245951724356564e-14, 2.068936347497604e-11, 1.562561743309233e-09,
- 5.459543043426564e-08, 1.114775688149252e-06, 1.532101202364371e-05,
- 1.553884683726585e-04, 1.239396954915939e-03, 8.153872320255721e-03,
- 4.631183739647523e-02, 2.473187311701327e-01, 2.175254800183617e+00,
-
- 0.0003729887888876379, 0.0164409238228929513, 0.0521523015190650113,
- 0.1064701372271216612, 0.1800913735793082115, 0.2748704281195626931,
- 0.3939246282787986497, 0.5420727552260817816, 0.7267265822221973259,
- 0.9596554296000253670, 1.2607440376386165326, 1.6671185084541604304,
- 2.2604828984738705167, 3.2868613342148607082, 6.9298574921692139839,
-
- 2.606673548632508, 4.602913725294877, 5.646152813924212,
- 6.488971315540869, 7.249823275816285, 7.977314231410841,
- 8.700354939944047, 9.441728024225892, 10.224338321374127,
- 11.076435368801061, 12.039320937038386, 13.183878752697167,
- 14.657791935084575, 16.885728216339373, 23.361991680031817,
-
- 70.14844087392152, 80.92379498849355, 85.53325420085891,
- 88.94433120715347, 91.83732712857017, 94.46719943606301,
- 96.96896479994635, 99.43412843510363, 101.94074719829733,
- 104.57228644307247, 107.43900093448734, 110.71844673417287,
- 114.76616819871325, 120.57422505959563, 135.92318818757556,
-
- 899.0072447849649, 937.9271278858220, 953.8117189560207,
- 965.3079371501154, 974.8974061207954, 983.4936235182347,
- 991.5691170518946, 999.4334123954690, 1007.3391826856553,
- 1015.5445154999951, 1024.3777075619569, 1034.3538789836223,
- 1046.4872561869577, 1063.5717461999654, 1107.0741966053859
-};
-
-TEST_BEGIN(test_pt_chi2)
-{
- unsigned i, j;
- unsigned e = 0;
-
- for (i = 0; i < sizeof(pt_chi2_df)/sizeof(double); i++) {
- double df = pt_chi2_df[i];
- double ln_gamma_df = ln_gamma(df * 0.5);
- for (j = 1; j < 100; j += 7) {
- double p = (double)j * 0.01;
- assert_true(double_eq_rel(pt_chi2(p, df, ln_gamma_df),
- pt_chi2_expected[e], MAX_REL_ERR, MAX_ABS_ERR),
- "Incorrect pt_chi2 result for i=%u, j=%u", i, j);
- e++;
- }
- }
-}
-TEST_END
-
-/*
- * Expected pt_gamma(p=[0.1..0.99] increment=0.07,
- * shape=[0.5..3.0] increment=0.5).
- */
-static const double pt_gamma_shape[] = {0.5, 1.0, 1.5, 2.0, 2.5, 3.0};
-static const double pt_gamma_expected[] = {
- 7.854392895485103e-05, 5.043466107888016e-03, 1.788288957794883e-02,
- 3.900956150232906e-02, 6.913847560638034e-02, 1.093710833465766e-01,
- 1.613412523825817e-01, 2.274682115597864e-01, 3.114117323127083e-01,
- 4.189466220207417e-01, 5.598106789059246e-01, 7.521856146202706e-01,
- 1.036125427911119e+00, 1.532450860038180e+00, 3.317448300510606e+00,
-
- 0.01005033585350144, 0.08338160893905107, 0.16251892949777497,
- 0.24846135929849966, 0.34249030894677596, 0.44628710262841947,
- 0.56211891815354142, 0.69314718055994529, 0.84397007029452920,
- 1.02165124753198167, 1.23787435600161766, 1.51412773262977574,
- 1.89711998488588196, 2.52572864430825783, 4.60517018598809091,
-
- 0.05741590094955853, 0.24747378084860744, 0.39888572212236084,
- 0.54394139997444901, 0.69048812513915159, 0.84311389861296104,
- 1.00580622221479898, 1.18298694218766931, 1.38038096305861213,
- 1.60627736383027453, 1.87396970522337947, 2.20749220408081070,
- 2.65852391865854942, 3.37934630984842244, 5.67243336507218476,
-
- 0.1485547402532659, 0.4657458011640391, 0.6832386130709406,
- 0.8794297834672100, 1.0700752852474524, 1.2629614217350744,
- 1.4638400448580779, 1.6783469900166610, 1.9132338090606940,
- 2.1778589228618777, 2.4868823970010991, 2.8664695666264195,
- 3.3724415436062114, 4.1682658512758071, 6.6383520679938108,
-
- 0.2771490383641385, 0.7195001279643727, 0.9969081732265243,
- 1.2383497880608061, 1.4675206597269927, 1.6953064251816552,
- 1.9291243435606809, 2.1757300955477641, 2.4428032131216391,
- 2.7406534569230616, 3.0851445039665513, 3.5043101122033367,
- 4.0575997065264637, 4.9182956424675286, 7.5431362346944937,
-
- 0.4360451650782932, 0.9983600902486267, 1.3306365880734528,
- 1.6129750834753802, 1.8767241606994294, 2.1357032436097660,
- 2.3988853336865565, 2.6740603137235603, 2.9697561737517959,
- 3.2971457713883265, 3.6731795898504660, 4.1275751617770631,
- 4.7230515633946677, 5.6417477865306020, 8.4059469148854635
-};
-
-TEST_BEGIN(test_pt_gamma_shape)
-{
- unsigned i, j;
- unsigned e = 0;
-
- for (i = 0; i < sizeof(pt_gamma_shape)/sizeof(double); i++) {
- double shape = pt_gamma_shape[i];
- double ln_gamma_shape = ln_gamma(shape);
- for (j = 1; j < 100; j += 7) {
- double p = (double)j * 0.01;
- assert_true(double_eq_rel(pt_gamma(p, shape, 1.0,
- ln_gamma_shape), pt_gamma_expected[e], MAX_REL_ERR,
- MAX_ABS_ERR),
- "Incorrect pt_gamma result for i=%u, j=%u", i, j);
- e++;
- }
- }
-}
-TEST_END
-
-TEST_BEGIN(test_pt_gamma_scale)
-{
- double shape = 1.0;
- double ln_gamma_shape = ln_gamma(shape);
-
- assert_true(double_eq_rel(
- pt_gamma(0.5, shape, 1.0, ln_gamma_shape) * 10.0,
- pt_gamma(0.5, shape, 10.0, ln_gamma_shape), MAX_REL_ERR,
- MAX_ABS_ERR),
- "Scale should be trivially equivalent to external multiplication");
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_ln_gamma_factorial,
- test_ln_gamma_misc,
- test_pt_norm,
- test_pt_chi2,
- test_pt_gamma_shape,
- test_pt_gamma_scale));
-}
diff --git a/memory/jemalloc/src/test/unit/mq.c b/memory/jemalloc/src/test/unit/mq.c
deleted file mode 100644
index bde2a480b6..0000000000
--- a/memory/jemalloc/src/test/unit/mq.c
+++ /dev/null
@@ -1,93 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#define NSENDERS 3
-#define NMSGS 100000
-
-typedef struct mq_msg_s mq_msg_t;
-struct mq_msg_s {
- mq_msg(mq_msg_t) link;
-};
-mq_gen(static, mq_, mq_t, mq_msg_t, link)
-
-TEST_BEGIN(test_mq_basic)
-{
- mq_t mq;
- mq_msg_t msg;
-
- assert_false(mq_init(&mq), "Unexpected mq_init() failure");
- assert_u_eq(mq_count(&mq), 0, "mq should be empty");
- assert_ptr_null(mq_tryget(&mq),
- "mq_tryget() should fail when the queue is empty");
-
- mq_put(&mq, &msg);
- assert_u_eq(mq_count(&mq), 1, "mq should contain one message");
- assert_ptr_eq(mq_tryget(&mq), &msg, "mq_tryget() should return msg");
-
- mq_put(&mq, &msg);
- assert_ptr_eq(mq_get(&mq), &msg, "mq_get() should return msg");
-
- mq_fini(&mq);
-}
-TEST_END
-
-static void *
-thd_receiver_start(void *arg)
-{
- mq_t *mq = (mq_t *)arg;
- unsigned i;
-
- for (i = 0; i < (NSENDERS * NMSGS); i++) {
- mq_msg_t *msg = mq_get(mq);
- assert_ptr_not_null(msg, "mq_get() should never return NULL");
- dallocx(msg, 0);
- }
- return (NULL);
-}
-
-static void *
-thd_sender_start(void *arg)
-{
- mq_t *mq = (mq_t *)arg;
- unsigned i;
-
- for (i = 0; i < NMSGS; i++) {
- mq_msg_t *msg;
- void *p;
- p = mallocx(sizeof(mq_msg_t), 0);
- assert_ptr_not_null(p, "Unexpected mallocx() failure");
- msg = (mq_msg_t *)p;
- mq_put(mq, msg);
- }
- return (NULL);
-}
-
-TEST_BEGIN(test_mq_threaded)
-{
- mq_t mq;
- thd_t receiver;
- thd_t senders[NSENDERS];
- unsigned i;
-
- assert_false(mq_init(&mq), "Unexpected mq_init() failure");
-
- thd_create(&receiver, thd_receiver_start, (void *)&mq);
- for (i = 0; i < NSENDERS; i++)
- thd_create(&senders[i], thd_sender_start, (void *)&mq);
-
- thd_join(receiver, NULL);
- for (i = 0; i < NSENDERS; i++)
- thd_join(senders[i], NULL);
-
- mq_fini(&mq);
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_mq_basic,
- test_mq_threaded));
-}
-
diff --git a/memory/jemalloc/src/test/unit/mtx.c b/memory/jemalloc/src/test/unit/mtx.c
deleted file mode 100644
index 96ff69486e..0000000000
--- a/memory/jemalloc/src/test/unit/mtx.c
+++ /dev/null
@@ -1,60 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#define NTHREADS 2
-#define NINCRS 2000000
-
-TEST_BEGIN(test_mtx_basic)
-{
- mtx_t mtx;
-
- assert_false(mtx_init(&mtx), "Unexpected mtx_init() failure");
- mtx_lock(&mtx);
- mtx_unlock(&mtx);
- mtx_fini(&mtx);
-}
-TEST_END
-
-typedef struct {
- mtx_t mtx;
- unsigned x;
-} thd_start_arg_t;
-
-static void *
-thd_start(void *varg)
-{
- thd_start_arg_t *arg = (thd_start_arg_t *)varg;
- unsigned i;
-
- for (i = 0; i < NINCRS; i++) {
- mtx_lock(&arg->mtx);
- arg->x++;
- mtx_unlock(&arg->mtx);
- }
- return (NULL);
-}
-
-TEST_BEGIN(test_mtx_race)
-{
- thd_start_arg_t arg;
- thd_t thds[NTHREADS];
- unsigned i;
-
- assert_false(mtx_init(&arg.mtx), "Unexpected mtx_init() failure");
- arg.x = 0;
- for (i = 0; i < NTHREADS; i++)
- thd_create(&thds[i], thd_start, (void *)&arg);
- for (i = 0; i < NTHREADS; i++)
- thd_join(thds[i], NULL);
- assert_u_eq(arg.x, NTHREADS * NINCRS,
- "Race-related counter corruption");
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_mtx_basic,
- test_mtx_race));
-}
diff --git a/memory/jemalloc/src/test/unit/nstime.c b/memory/jemalloc/src/test/unit/nstime.c
deleted file mode 100644
index 0368bc26e2..0000000000
--- a/memory/jemalloc/src/test/unit/nstime.c
+++ /dev/null
@@ -1,227 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#define BILLION UINT64_C(1000000000)
-
-TEST_BEGIN(test_nstime_init)
-{
- nstime_t nst;
-
- nstime_init(&nst, 42000000043);
- assert_u64_eq(nstime_ns(&nst), 42000000043, "ns incorrectly read");
- assert_u64_eq(nstime_sec(&nst), 42, "sec incorrectly read");
- assert_u64_eq(nstime_nsec(&nst), 43, "nsec incorrectly read");
-}
-TEST_END
-
-TEST_BEGIN(test_nstime_init2)
-{
- nstime_t nst;
-
- nstime_init2(&nst, 42, 43);
- assert_u64_eq(nstime_sec(&nst), 42, "sec incorrectly read");
- assert_u64_eq(nstime_nsec(&nst), 43, "nsec incorrectly read");
-}
-TEST_END
-
-TEST_BEGIN(test_nstime_copy)
-{
- nstime_t nsta, nstb;
-
- nstime_init2(&nsta, 42, 43);
- nstime_init(&nstb, 0);
- nstime_copy(&nstb, &nsta);
- assert_u64_eq(nstime_sec(&nstb), 42, "sec incorrectly copied");
- assert_u64_eq(nstime_nsec(&nstb), 43, "nsec incorrectly copied");
-}
-TEST_END
-
-TEST_BEGIN(test_nstime_compare)
-{
- nstime_t nsta, nstb;
-
- nstime_init2(&nsta, 42, 43);
- nstime_copy(&nstb, &nsta);
- assert_d_eq(nstime_compare(&nsta, &nstb), 0, "Times should be equal");
- assert_d_eq(nstime_compare(&nstb, &nsta), 0, "Times should be equal");
-
- nstime_init2(&nstb, 42, 42);
- assert_d_eq(nstime_compare(&nsta, &nstb), 1,
- "nsta should be greater than nstb");
- assert_d_eq(nstime_compare(&nstb, &nsta), -1,
- "nstb should be less than nsta");
-
- nstime_init2(&nstb, 42, 44);
- assert_d_eq(nstime_compare(&nsta, &nstb), -1,
- "nsta should be less than nstb");
- assert_d_eq(nstime_compare(&nstb, &nsta), 1,
- "nstb should be greater than nsta");
-
- nstime_init2(&nstb, 41, BILLION - 1);
- assert_d_eq(nstime_compare(&nsta, &nstb), 1,
- "nsta should be greater than nstb");
- assert_d_eq(nstime_compare(&nstb, &nsta), -1,
- "nstb should be less than nsta");
-
- nstime_init2(&nstb, 43, 0);
- assert_d_eq(nstime_compare(&nsta, &nstb), -1,
- "nsta should be less than nstb");
- assert_d_eq(nstime_compare(&nstb, &nsta), 1,
- "nstb should be greater than nsta");
-}
-TEST_END
-
-TEST_BEGIN(test_nstime_add)
-{
- nstime_t nsta, nstb;
-
- nstime_init2(&nsta, 42, 43);
- nstime_copy(&nstb, &nsta);
- nstime_add(&nsta, &nstb);
- nstime_init2(&nstb, 84, 86);
- assert_d_eq(nstime_compare(&nsta, &nstb), 0,
- "Incorrect addition result");
-
- nstime_init2(&nsta, 42, BILLION - 1);
- nstime_copy(&nstb, &nsta);
- nstime_add(&nsta, &nstb);
- nstime_init2(&nstb, 85, BILLION - 2);
- assert_d_eq(nstime_compare(&nsta, &nstb), 0,
- "Incorrect addition result");
-}
-TEST_END
-
-TEST_BEGIN(test_nstime_subtract)
-{
- nstime_t nsta, nstb;
-
- nstime_init2(&nsta, 42, 43);
- nstime_copy(&nstb, &nsta);
- nstime_subtract(&nsta, &nstb);
- nstime_init(&nstb, 0);
- assert_d_eq(nstime_compare(&nsta, &nstb), 0,
- "Incorrect subtraction result");
-
- nstime_init2(&nsta, 42, 43);
- nstime_init2(&nstb, 41, 44);
- nstime_subtract(&nsta, &nstb);
- nstime_init2(&nstb, 0, BILLION - 1);
- assert_d_eq(nstime_compare(&nsta, &nstb), 0,
- "Incorrect subtraction result");
-}
-TEST_END
-
-TEST_BEGIN(test_nstime_imultiply)
-{
- nstime_t nsta, nstb;
-
- nstime_init2(&nsta, 42, 43);
- nstime_imultiply(&nsta, 10);
- nstime_init2(&nstb, 420, 430);
- assert_d_eq(nstime_compare(&nsta, &nstb), 0,
- "Incorrect multiplication result");
-
- nstime_init2(&nsta, 42, 666666666);
- nstime_imultiply(&nsta, 3);
- nstime_init2(&nstb, 127, 999999998);
- assert_d_eq(nstime_compare(&nsta, &nstb), 0,
- "Incorrect multiplication result");
-}
-TEST_END
-
-TEST_BEGIN(test_nstime_idivide)
-{
- nstime_t nsta, nstb;
-
- nstime_init2(&nsta, 42, 43);
- nstime_copy(&nstb, &nsta);
- nstime_imultiply(&nsta, 10);
- nstime_idivide(&nsta, 10);
- assert_d_eq(nstime_compare(&nsta, &nstb), 0,
- "Incorrect division result");
-
- nstime_init2(&nsta, 42, 666666666);
- nstime_copy(&nstb, &nsta);
- nstime_imultiply(&nsta, 3);
- nstime_idivide(&nsta, 3);
- assert_d_eq(nstime_compare(&nsta, &nstb), 0,
- "Incorrect division result");
-}
-TEST_END
-
-TEST_BEGIN(test_nstime_divide)
-{
- nstime_t nsta, nstb, nstc;
-
- nstime_init2(&nsta, 42, 43);
- nstime_copy(&nstb, &nsta);
- nstime_imultiply(&nsta, 10);
- assert_u64_eq(nstime_divide(&nsta, &nstb), 10,
- "Incorrect division result");
-
- nstime_init2(&nsta, 42, 43);
- nstime_copy(&nstb, &nsta);
- nstime_imultiply(&nsta, 10);
- nstime_init(&nstc, 1);
- nstime_add(&nsta, &nstc);
- assert_u64_eq(nstime_divide(&nsta, &nstb), 10,
- "Incorrect division result");
-
- nstime_init2(&nsta, 42, 43);
- nstime_copy(&nstb, &nsta);
- nstime_imultiply(&nsta, 10);
- nstime_init(&nstc, 1);
- nstime_subtract(&nsta, &nstc);
- assert_u64_eq(nstime_divide(&nsta, &nstb), 9,
- "Incorrect division result");
-}
-TEST_END
-
-TEST_BEGIN(test_nstime_monotonic)
-{
-
- nstime_monotonic();
-}
-TEST_END
-
-TEST_BEGIN(test_nstime_update)
-{
- nstime_t nst;
-
- nstime_init(&nst, 0);
-
- assert_false(nstime_update(&nst), "Basic time update failed.");
-
- /* Only Rip Van Winkle sleeps this long. */
- {
- nstime_t addend;
- nstime_init2(&addend, 631152000, 0);
- nstime_add(&nst, &addend);
- }
- {
- nstime_t nst0;
- nstime_copy(&nst0, &nst);
- assert_true(nstime_update(&nst),
- "Update should detect time roll-back.");
- assert_d_eq(nstime_compare(&nst, &nst0), 0,
- "Time should not have been modified");
- }
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_nstime_init,
- test_nstime_init2,
- test_nstime_copy,
- test_nstime_compare,
- test_nstime_add,
- test_nstime_subtract,
- test_nstime_imultiply,
- test_nstime_idivide,
- test_nstime_divide,
- test_nstime_monotonic,
- test_nstime_update));
-}
diff --git a/memory/jemalloc/src/test/unit/ph.c b/memory/jemalloc/src/test/unit/ph.c
deleted file mode 100644
index da442f07e8..0000000000
--- a/memory/jemalloc/src/test/unit/ph.c
+++ /dev/null
@@ -1,290 +0,0 @@
-#include "test/jemalloc_test.h"
-
-typedef struct node_s node_t;
-
-struct node_s {
-#define NODE_MAGIC 0x9823af7e
- uint32_t magic;
- phn(node_t) link;
- uint64_t key;
-};
-
-static int
-node_cmp(const node_t *a, const node_t *b)
-{
- int ret;
-
- ret = (a->key > b->key) - (a->key < b->key);
- if (ret == 0) {
- /*
- * Duplicates are not allowed in the heap, so force an
- * arbitrary ordering for non-identical items with equal keys.
- */
- ret = (((uintptr_t)a) > ((uintptr_t)b))
- - (((uintptr_t)a) < ((uintptr_t)b));
- }
- return (ret);
-}
-
-static int
-node_cmp_magic(const node_t *a, const node_t *b) {
-
- assert_u32_eq(a->magic, NODE_MAGIC, "Bad magic");
- assert_u32_eq(b->magic, NODE_MAGIC, "Bad magic");
-
- return (node_cmp(a, b));
-}
-
-typedef ph(node_t) heap_t;
-ph_gen(static, heap_, heap_t, node_t, link, node_cmp_magic);
-
-static void
-node_print(const node_t *node, unsigned depth)
-{
- unsigned i;
- node_t *leftmost_child, *sibling;
-
- for (i = 0; i < depth; i++)
- malloc_printf("\t");
- malloc_printf("%2"FMTu64"\n", node->key);
-
- leftmost_child = phn_lchild_get(node_t, link, node);
- if (leftmost_child == NULL)
- return;
- node_print(leftmost_child, depth + 1);
-
- for (sibling = phn_next_get(node_t, link, leftmost_child); sibling !=
- NULL; sibling = phn_next_get(node_t, link, sibling)) {
- node_print(sibling, depth + 1);
- }
-}
-
-static void
-heap_print(const heap_t *heap)
-{
- node_t *auxelm;
-
- malloc_printf("vvv heap %p vvv\n", heap);
- if (heap->ph_root == NULL)
- goto label_return;
-
- node_print(heap->ph_root, 0);
-
- for (auxelm = phn_next_get(node_t, link, heap->ph_root); auxelm != NULL;
- auxelm = phn_next_get(node_t, link, auxelm)) {
- assert_ptr_eq(phn_next_get(node_t, link, phn_prev_get(node_t,
- link, auxelm)), auxelm,
- "auxelm's prev doesn't link to auxelm");
- node_print(auxelm, 0);
- }
-
-label_return:
- malloc_printf("^^^ heap %p ^^^\n", heap);
-}
-
-static unsigned
-node_validate(const node_t *node, const node_t *parent)
-{
- unsigned nnodes = 1;
- node_t *leftmost_child, *sibling;
-
- if (parent != NULL) {
- assert_d_ge(node_cmp_magic(node, parent), 0,
- "Child is less than parent");
- }
-
- leftmost_child = phn_lchild_get(node_t, link, node);
- if (leftmost_child == NULL)
- return (nnodes);
- assert_ptr_eq((void *)phn_prev_get(node_t, link, leftmost_child),
- (void *)node, "Leftmost child does not link to node");
- nnodes += node_validate(leftmost_child, node);
-
- for (sibling = phn_next_get(node_t, link, leftmost_child); sibling !=
- NULL; sibling = phn_next_get(node_t, link, sibling)) {
- assert_ptr_eq(phn_next_get(node_t, link, phn_prev_get(node_t,
- link, sibling)), sibling,
- "sibling's prev doesn't link to sibling");
- nnodes += node_validate(sibling, node);
- }
- return (nnodes);
-}
-
-static unsigned
-heap_validate(const heap_t *heap)
-{
- unsigned nnodes = 0;
- node_t *auxelm;
-
- if (heap->ph_root == NULL)
- goto label_return;
-
- nnodes += node_validate(heap->ph_root, NULL);
-
- for (auxelm = phn_next_get(node_t, link, heap->ph_root); auxelm != NULL;
- auxelm = phn_next_get(node_t, link, auxelm)) {
- assert_ptr_eq(phn_next_get(node_t, link, phn_prev_get(node_t,
- link, auxelm)), auxelm,
- "auxelm's prev doesn't link to auxelm");
- nnodes += node_validate(auxelm, NULL);
- }
-
-label_return:
- if (false)
- heap_print(heap);
- return (nnodes);
-}
-
-TEST_BEGIN(test_ph_empty)
-{
- heap_t heap;
-
- heap_new(&heap);
- assert_true(heap_empty(&heap), "Heap should be empty");
- assert_ptr_null(heap_first(&heap), "Unexpected node");
-}
-TEST_END
-
-static void
-node_remove(heap_t *heap, node_t *node)
-{
-
- heap_remove(heap, node);
-
- node->magic = 0;
-}
-
-static node_t *
-node_remove_first(heap_t *heap)
-{
- node_t *node = heap_remove_first(heap);
- node->magic = 0;
- return (node);
-}
-
-TEST_BEGIN(test_ph_random)
-{
-#define NNODES 25
-#define NBAGS 250
-#define SEED 42
- sfmt_t *sfmt;
- uint64_t bag[NNODES];
- heap_t heap;
- node_t nodes[NNODES];
- unsigned i, j, k;
-
- sfmt = init_gen_rand(SEED);
- for (i = 0; i < NBAGS; i++) {
- switch (i) {
- case 0:
- /* Insert in order. */
- for (j = 0; j < NNODES; j++)
- bag[j] = j;
- break;
- case 1:
- /* Insert in reverse order. */
- for (j = 0; j < NNODES; j++)
- bag[j] = NNODES - j - 1;
- break;
- default:
- for (j = 0; j < NNODES; j++)
- bag[j] = gen_rand64_range(sfmt, NNODES);
- }
-
- for (j = 1; j <= NNODES; j++) {
- /* Initialize heap and nodes. */
- heap_new(&heap);
- assert_u_eq(heap_validate(&heap), 0,
- "Incorrect node count");
- for (k = 0; k < j; k++) {
- nodes[k].magic = NODE_MAGIC;
- nodes[k].key = bag[k];
- }
-
- /* Insert nodes. */
- for (k = 0; k < j; k++) {
- heap_insert(&heap, &nodes[k]);
- if (i % 13 == 12) {
- /* Trigger merging. */
- assert_ptr_not_null(heap_first(&heap),
- "Heap should not be empty");
- }
- assert_u_eq(heap_validate(&heap), k + 1,
- "Incorrect node count");
- }
-
- assert_false(heap_empty(&heap),
- "Heap should not be empty");
-
- /* Remove nodes. */
- switch (i % 4) {
- case 0:
- for (k = 0; k < j; k++) {
- assert_u_eq(heap_validate(&heap), j - k,
- "Incorrect node count");
- node_remove(&heap, &nodes[k]);
- assert_u_eq(heap_validate(&heap), j - k
- - 1, "Incorrect node count");
- }
- break;
- case 1:
- for (k = j; k > 0; k--) {
- node_remove(&heap, &nodes[k-1]);
- assert_u_eq(heap_validate(&heap), k - 1,
- "Incorrect node count");
- }
- break;
- case 2: {
- node_t *prev = NULL;
- for (k = 0; k < j; k++) {
- node_t *node = node_remove_first(&heap);
- assert_u_eq(heap_validate(&heap), j - k
- - 1, "Incorrect node count");
- if (prev != NULL) {
- assert_d_ge(node_cmp(node,
- prev), 0,
- "Bad removal order");
- }
- prev = node;
- }
- break;
- } case 3: {
- node_t *prev = NULL;
- for (k = 0; k < j; k++) {
- node_t *node = heap_first(&heap);
- assert_u_eq(heap_validate(&heap), j - k,
- "Incorrect node count");
- if (prev != NULL) {
- assert_d_ge(node_cmp(node,
- prev), 0,
- "Bad removal order");
- }
- node_remove(&heap, node);
- assert_u_eq(heap_validate(&heap), j - k
- - 1, "Incorrect node count");
- prev = node;
- }
- break;
- } default:
- not_reached();
- }
-
- assert_ptr_null(heap_first(&heap),
- "Heap should be empty");
- assert_true(heap_empty(&heap), "Heap should be empty");
- }
- }
- fini_gen_rand(sfmt);
-#undef NNODES
-#undef SEED
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_ph_empty,
- test_ph_random));
-}
diff --git a/memory/jemalloc/src/test/unit/prng.c b/memory/jemalloc/src/test/unit/prng.c
deleted file mode 100644
index 80c9d733f9..0000000000
--- a/memory/jemalloc/src/test/unit/prng.c
+++ /dev/null
@@ -1,263 +0,0 @@
-#include "test/jemalloc_test.h"
-
-static void
-test_prng_lg_range_u32(bool atomic)
-{
- uint32_t sa, sb, ra, rb;
- unsigned lg_range;
-
- sa = 42;
- ra = prng_lg_range_u32(&sa, 32, atomic);
- sa = 42;
- rb = prng_lg_range_u32(&sa, 32, atomic);
- assert_u32_eq(ra, rb,
- "Repeated generation should produce repeated results");
-
- sb = 42;
- rb = prng_lg_range_u32(&sb, 32, atomic);
- assert_u32_eq(ra, rb,
- "Equivalent generation should produce equivalent results");
-
- sa = 42;
- ra = prng_lg_range_u32(&sa, 32, atomic);
- rb = prng_lg_range_u32(&sa, 32, atomic);
- assert_u32_ne(ra, rb,
- "Full-width results must not immediately repeat");
-
- sa = 42;
- ra = prng_lg_range_u32(&sa, 32, atomic);
- for (lg_range = 31; lg_range > 0; lg_range--) {
- sb = 42;
- rb = prng_lg_range_u32(&sb, lg_range, atomic);
- assert_u32_eq((rb & (UINT32_C(0xffffffff) << lg_range)),
- 0, "High order bits should be 0, lg_range=%u", lg_range);
- assert_u32_eq(rb, (ra >> (32 - lg_range)),
- "Expected high order bits of full-width result, "
- "lg_range=%u", lg_range);
- }
-}
-
-static void
-test_prng_lg_range_u64(void)
-{
- uint64_t sa, sb, ra, rb;
- unsigned lg_range;
-
- sa = 42;
- ra = prng_lg_range_u64(&sa, 64);
- sa = 42;
- rb = prng_lg_range_u64(&sa, 64);
- assert_u64_eq(ra, rb,
- "Repeated generation should produce repeated results");
-
- sb = 42;
- rb = prng_lg_range_u64(&sb, 64);
- assert_u64_eq(ra, rb,
- "Equivalent generation should produce equivalent results");
-
- sa = 42;
- ra = prng_lg_range_u64(&sa, 64);
- rb = prng_lg_range_u64(&sa, 64);
- assert_u64_ne(ra, rb,
- "Full-width results must not immediately repeat");
-
- sa = 42;
- ra = prng_lg_range_u64(&sa, 64);
- for (lg_range = 63; lg_range > 0; lg_range--) {
- sb = 42;
- rb = prng_lg_range_u64(&sb, lg_range);
- assert_u64_eq((rb & (UINT64_C(0xffffffffffffffff) << lg_range)),
- 0, "High order bits should be 0, lg_range=%u", lg_range);
- assert_u64_eq(rb, (ra >> (64 - lg_range)),
- "Expected high order bits of full-width result, "
- "lg_range=%u", lg_range);
- }
-}
-
-static void
-test_prng_lg_range_zu(bool atomic)
-{
- size_t sa, sb, ra, rb;
- unsigned lg_range;
-
- sa = 42;
- ra = prng_lg_range_zu(&sa, ZU(1) << (3 + LG_SIZEOF_PTR), atomic);
- sa = 42;
- rb = prng_lg_range_zu(&sa, ZU(1) << (3 + LG_SIZEOF_PTR), atomic);
- assert_zu_eq(ra, rb,
- "Repeated generation should produce repeated results");
-
- sb = 42;
- rb = prng_lg_range_zu(&sb, ZU(1) << (3 + LG_SIZEOF_PTR), atomic);
- assert_zu_eq(ra, rb,
- "Equivalent generation should produce equivalent results");
-
- sa = 42;
- ra = prng_lg_range_zu(&sa, ZU(1) << (3 + LG_SIZEOF_PTR), atomic);
- rb = prng_lg_range_zu(&sa, ZU(1) << (3 + LG_SIZEOF_PTR), atomic);
- assert_zu_ne(ra, rb,
- "Full-width results must not immediately repeat");
-
- sa = 42;
- ra = prng_lg_range_zu(&sa, ZU(1) << (3 + LG_SIZEOF_PTR), atomic);
- for (lg_range = (ZU(1) << (3 + LG_SIZEOF_PTR)) - 1; lg_range > 0;
- lg_range--) {
- sb = 42;
- rb = prng_lg_range_zu(&sb, lg_range, atomic);
- assert_zu_eq((rb & (SIZE_T_MAX << lg_range)),
- 0, "High order bits should be 0, lg_range=%u", lg_range);
- assert_zu_eq(rb, (ra >> ((ZU(1) << (3 + LG_SIZEOF_PTR)) -
- lg_range)), "Expected high order bits of full-width "
- "result, lg_range=%u", lg_range);
- }
-}
-
-TEST_BEGIN(test_prng_lg_range_u32_nonatomic)
-{
-
- test_prng_lg_range_u32(false);
-}
-TEST_END
-
-TEST_BEGIN(test_prng_lg_range_u32_atomic)
-{
-
- test_prng_lg_range_u32(true);
-}
-TEST_END
-
-TEST_BEGIN(test_prng_lg_range_u64_nonatomic)
-{
-
- test_prng_lg_range_u64();
-}
-TEST_END
-
-TEST_BEGIN(test_prng_lg_range_zu_nonatomic)
-{
-
- test_prng_lg_range_zu(false);
-}
-TEST_END
-
-TEST_BEGIN(test_prng_lg_range_zu_atomic)
-{
-
- test_prng_lg_range_zu(true);
-}
-TEST_END
-
-static void
-test_prng_range_u32(bool atomic)
-{
- uint32_t range;
-#define MAX_RANGE 10000000
-#define RANGE_STEP 97
-#define NREPS 10
-
- for (range = 2; range < MAX_RANGE; range += RANGE_STEP) {
- uint32_t s;
- unsigned rep;
-
- s = range;
- for (rep = 0; rep < NREPS; rep++) {
- uint32_t r = prng_range_u32(&s, range, atomic);
-
- assert_u32_lt(r, range, "Out of range");
- }
- }
-}
-
-static void
-test_prng_range_u64(void)
-{
- uint64_t range;
-#define MAX_RANGE 10000000
-#define RANGE_STEP 97
-#define NREPS 10
-
- for (range = 2; range < MAX_RANGE; range += RANGE_STEP) {
- uint64_t s;
- unsigned rep;
-
- s = range;
- for (rep = 0; rep < NREPS; rep++) {
- uint64_t r = prng_range_u64(&s, range);
-
- assert_u64_lt(r, range, "Out of range");
- }
- }
-}
-
-static void
-test_prng_range_zu(bool atomic)
-{
- size_t range;
-#define MAX_RANGE 10000000
-#define RANGE_STEP 97
-#define NREPS 10
-
- for (range = 2; range < MAX_RANGE; range += RANGE_STEP) {
- size_t s;
- unsigned rep;
-
- s = range;
- for (rep = 0; rep < NREPS; rep++) {
- size_t r = prng_range_zu(&s, range, atomic);
-
- assert_zu_lt(r, range, "Out of range");
- }
- }
-}
-
-TEST_BEGIN(test_prng_range_u32_nonatomic)
-{
-
- test_prng_range_u32(false);
-}
-TEST_END
-
-TEST_BEGIN(test_prng_range_u32_atomic)
-{
-
- test_prng_range_u32(true);
-}
-TEST_END
-
-TEST_BEGIN(test_prng_range_u64_nonatomic)
-{
-
- test_prng_range_u64();
-}
-TEST_END
-
-TEST_BEGIN(test_prng_range_zu_nonatomic)
-{
-
- test_prng_range_zu(false);
-}
-TEST_END
-
-TEST_BEGIN(test_prng_range_zu_atomic)
-{
-
- test_prng_range_zu(true);
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_prng_lg_range_u32_nonatomic,
- test_prng_lg_range_u32_atomic,
- test_prng_lg_range_u64_nonatomic,
- test_prng_lg_range_zu_nonatomic,
- test_prng_lg_range_zu_atomic,
- test_prng_range_u32_nonatomic,
- test_prng_range_u32_atomic,
- test_prng_range_u64_nonatomic,
- test_prng_range_zu_nonatomic,
- test_prng_range_zu_atomic));
-}
diff --git a/memory/jemalloc/src/test/unit/prof_accum.c b/memory/jemalloc/src/test/unit/prof_accum.c
deleted file mode 100644
index fd229e0fd2..0000000000
--- a/memory/jemalloc/src/test/unit/prof_accum.c
+++ /dev/null
@@ -1,91 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#define NTHREADS 4
-#define NALLOCS_PER_THREAD 50
-#define DUMP_INTERVAL 1
-#define BT_COUNT_CHECK_INTERVAL 5
-
-#ifdef JEMALLOC_PROF
-const char *malloc_conf =
- "prof:true,prof_accum:true,prof_active:false,lg_prof_sample:0";
-#endif
-
-static int
-prof_dump_open_intercept(bool propagate_err, const char *filename)
-{
- int fd;
-
- fd = open("/dev/null", O_WRONLY);
- assert_d_ne(fd, -1, "Unexpected open() failure");
-
- return (fd);
-}
-
-static void *
-alloc_from_permuted_backtrace(unsigned thd_ind, unsigned iteration)
-{
-
- return (btalloc(1, thd_ind*NALLOCS_PER_THREAD + iteration));
-}
-
-static void *
-thd_start(void *varg)
-{
- unsigned thd_ind = *(unsigned *)varg;
- size_t bt_count_prev, bt_count;
- unsigned i_prev, i;
-
- i_prev = 0;
- bt_count_prev = 0;
- for (i = 0; i < NALLOCS_PER_THREAD; i++) {
- void *p = alloc_from_permuted_backtrace(thd_ind, i);
- dallocx(p, 0);
- if (i % DUMP_INTERVAL == 0) {
- assert_d_eq(mallctl("prof.dump", NULL, NULL, NULL, 0),
- 0, "Unexpected error while dumping heap profile");
- }
-
- if (i % BT_COUNT_CHECK_INTERVAL == 0 ||
- i+1 == NALLOCS_PER_THREAD) {
- bt_count = prof_bt_count();
- assert_zu_le(bt_count_prev+(i-i_prev), bt_count,
- "Expected larger backtrace count increase");
- i_prev = i;
- bt_count_prev = bt_count;
- }
- }
-
- return (NULL);
-}
-
-TEST_BEGIN(test_idump)
-{
- bool active;
- thd_t thds[NTHREADS];
- unsigned thd_args[NTHREADS];
- unsigned i;
-
- test_skip_if(!config_prof);
-
- active = true;
- assert_d_eq(mallctl("prof.active", NULL, NULL, &active, sizeof(active)),
- 0, "Unexpected mallctl failure while activating profiling");
-
- prof_dump_open = prof_dump_open_intercept;
-
- for (i = 0; i < NTHREADS; i++) {
- thd_args[i] = i;
- thd_create(&thds[i], thd_start, (void *)&thd_args[i]);
- }
- for (i = 0; i < NTHREADS; i++)
- thd_join(thds[i], NULL);
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_idump));
-}
diff --git a/memory/jemalloc/src/test/unit/prof_active.c b/memory/jemalloc/src/test/unit/prof_active.c
deleted file mode 100644
index 8149095729..0000000000
--- a/memory/jemalloc/src/test/unit/prof_active.c
+++ /dev/null
@@ -1,136 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#ifdef JEMALLOC_PROF
-const char *malloc_conf =
- "prof:true,prof_thread_active_init:false,lg_prof_sample:0";
-#endif
-
-static void
-mallctl_bool_get(const char *name, bool expected, const char *func, int line)
-{
- bool old;
- size_t sz;
-
- sz = sizeof(old);
- assert_d_eq(mallctl(name, &old, &sz, NULL, 0), 0,
- "%s():%d: Unexpected mallctl failure reading %s", func, line, name);
- assert_b_eq(old, expected, "%s():%d: Unexpected %s value", func, line,
- name);
-}
-
-static void
-mallctl_bool_set(const char *name, bool old_expected, bool val_new,
- const char *func, int line)
-{
- bool old;
- size_t sz;
-
- sz = sizeof(old);
- assert_d_eq(mallctl(name, &old, &sz, &val_new, sizeof(val_new)), 0,
- "%s():%d: Unexpected mallctl failure reading/writing %s", func,
- line, name);
- assert_b_eq(old, old_expected, "%s():%d: Unexpected %s value", func,
- line, name);
-}
-
-static void
-mallctl_prof_active_get_impl(bool prof_active_old_expected, const char *func,
- int line)
-{
-
- mallctl_bool_get("prof.active", prof_active_old_expected, func, line);
-}
-#define mallctl_prof_active_get(a) \
- mallctl_prof_active_get_impl(a, __func__, __LINE__)
-
-static void
-mallctl_prof_active_set_impl(bool prof_active_old_expected,
- bool prof_active_new, const char *func, int line)
-{
-
- mallctl_bool_set("prof.active", prof_active_old_expected,
- prof_active_new, func, line);
-}
-#define mallctl_prof_active_set(a, b) \
- mallctl_prof_active_set_impl(a, b, __func__, __LINE__)
-
-static void
-mallctl_thread_prof_active_get_impl(bool thread_prof_active_old_expected,
- const char *func, int line)
-{
-
- mallctl_bool_get("thread.prof.active", thread_prof_active_old_expected,
- func, line);
-}
-#define mallctl_thread_prof_active_get(a) \
- mallctl_thread_prof_active_get_impl(a, __func__, __LINE__)
-
-static void
-mallctl_thread_prof_active_set_impl(bool thread_prof_active_old_expected,
- bool thread_prof_active_new, const char *func, int line)
-{
-
- mallctl_bool_set("thread.prof.active", thread_prof_active_old_expected,
- thread_prof_active_new, func, line);
-}
-#define mallctl_thread_prof_active_set(a, b) \
- mallctl_thread_prof_active_set_impl(a, b, __func__, __LINE__)
-
-static void
-prof_sampling_probe_impl(bool expect_sample, const char *func, int line)
-{
- void *p;
- size_t expected_backtraces = expect_sample ? 1 : 0;
-
- assert_zu_eq(prof_bt_count(), 0, "%s():%d: Expected 0 backtraces", func,
- line);
- p = mallocx(1, 0);
- assert_ptr_not_null(p, "Unexpected mallocx() failure");
- assert_zu_eq(prof_bt_count(), expected_backtraces,
- "%s():%d: Unexpected backtrace count", func, line);
- dallocx(p, 0);
-}
-#define prof_sampling_probe(a) \
- prof_sampling_probe_impl(a, __func__, __LINE__)
-
-TEST_BEGIN(test_prof_active)
-{
-
- test_skip_if(!config_prof);
-
- mallctl_prof_active_get(true);
- mallctl_thread_prof_active_get(false);
-
- mallctl_prof_active_set(true, true);
- mallctl_thread_prof_active_set(false, false);
- /* prof.active, !thread.prof.active. */
- prof_sampling_probe(false);
-
- mallctl_prof_active_set(true, false);
- mallctl_thread_prof_active_set(false, false);
- /* !prof.active, !thread.prof.active. */
- prof_sampling_probe(false);
-
- mallctl_prof_active_set(false, false);
- mallctl_thread_prof_active_set(false, true);
- /* !prof.active, thread.prof.active. */
- prof_sampling_probe(false);
-
- mallctl_prof_active_set(false, true);
- mallctl_thread_prof_active_set(true, true);
- /* prof.active, thread.prof.active. */
- prof_sampling_probe(true);
-
- /* Restore settings. */
- mallctl_prof_active_set(true, true);
- mallctl_thread_prof_active_set(true, false);
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_prof_active));
-}
diff --git a/memory/jemalloc/src/test/unit/prof_gdump.c b/memory/jemalloc/src/test/unit/prof_gdump.c
deleted file mode 100644
index a0e6ee9211..0000000000
--- a/memory/jemalloc/src/test/unit/prof_gdump.c
+++ /dev/null
@@ -1,81 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#ifdef JEMALLOC_PROF
-const char *malloc_conf = "prof:true,prof_active:false,prof_gdump:true";
-#endif
-
-static bool did_prof_dump_open;
-
-static int
-prof_dump_open_intercept(bool propagate_err, const char *filename)
-{
- int fd;
-
- did_prof_dump_open = true;
-
- fd = open("/dev/null", O_WRONLY);
- assert_d_ne(fd, -1, "Unexpected open() failure");
-
- return (fd);
-}
-
-TEST_BEGIN(test_gdump)
-{
- bool active, gdump, gdump_old;
- void *p, *q, *r, *s;
- size_t sz;
-
- test_skip_if(!config_prof);
-
- active = true;
- assert_d_eq(mallctl("prof.active", NULL, NULL, &active, sizeof(active)),
- 0, "Unexpected mallctl failure while activating profiling");
-
- prof_dump_open = prof_dump_open_intercept;
-
- did_prof_dump_open = false;
- p = mallocx(chunksize, 0);
- assert_ptr_not_null(p, "Unexpected mallocx() failure");
- assert_true(did_prof_dump_open, "Expected a profile dump");
-
- did_prof_dump_open = false;
- q = mallocx(chunksize, 0);
- assert_ptr_not_null(q, "Unexpected mallocx() failure");
- assert_true(did_prof_dump_open, "Expected a profile dump");
-
- gdump = false;
- sz = sizeof(gdump_old);
- assert_d_eq(mallctl("prof.gdump", &gdump_old, &sz, &gdump,
- sizeof(gdump)), 0,
- "Unexpected mallctl failure while disabling prof.gdump");
- assert(gdump_old);
- did_prof_dump_open = false;
- r = mallocx(chunksize, 0);
- assert_ptr_not_null(q, "Unexpected mallocx() failure");
- assert_false(did_prof_dump_open, "Unexpected profile dump");
-
- gdump = true;
- sz = sizeof(gdump_old);
- assert_d_eq(mallctl("prof.gdump", &gdump_old, &sz, &gdump,
- sizeof(gdump)), 0,
- "Unexpected mallctl failure while enabling prof.gdump");
- assert(!gdump_old);
- did_prof_dump_open = false;
- s = mallocx(chunksize, 0);
- assert_ptr_not_null(q, "Unexpected mallocx() failure");
- assert_true(did_prof_dump_open, "Expected a profile dump");
-
- dallocx(p, 0);
- dallocx(q, 0);
- dallocx(r, 0);
- dallocx(s, 0);
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_gdump));
-}
diff --git a/memory/jemalloc/src/test/unit/prof_idump.c b/memory/jemalloc/src/test/unit/prof_idump.c
deleted file mode 100644
index bdea53ecdd..0000000000
--- a/memory/jemalloc/src/test/unit/prof_idump.c
+++ /dev/null
@@ -1,51 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#ifdef JEMALLOC_PROF
-const char *malloc_conf =
- "prof:true,prof_accum:true,prof_active:false,lg_prof_sample:0,"
- "lg_prof_interval:0";
-#endif
-
-static bool did_prof_dump_open;
-
-static int
-prof_dump_open_intercept(bool propagate_err, const char *filename)
-{
- int fd;
-
- did_prof_dump_open = true;
-
- fd = open("/dev/null", O_WRONLY);
- assert_d_ne(fd, -1, "Unexpected open() failure");
-
- return (fd);
-}
-
-TEST_BEGIN(test_idump)
-{
- bool active;
- void *p;
-
- test_skip_if(!config_prof);
-
- active = true;
- assert_d_eq(mallctl("prof.active", NULL, NULL, &active, sizeof(active)),
- 0, "Unexpected mallctl failure while activating profiling");
-
- prof_dump_open = prof_dump_open_intercept;
-
- did_prof_dump_open = false;
- p = mallocx(1, 0);
- assert_ptr_not_null(p, "Unexpected mallocx() failure");
- dallocx(p, 0);
- assert_true(did_prof_dump_open, "Expected a profile dump");
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_idump));
-}
diff --git a/memory/jemalloc/src/test/unit/prof_reset.c b/memory/jemalloc/src/test/unit/prof_reset.c
deleted file mode 100644
index 5ae45fd2cc..0000000000
--- a/memory/jemalloc/src/test/unit/prof_reset.c
+++ /dev/null
@@ -1,303 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#ifdef JEMALLOC_PROF
-const char *malloc_conf =
- "prof:true,prof_active:false,lg_prof_sample:0";
-#endif
-
-static int
-prof_dump_open_intercept(bool propagate_err, const char *filename)
-{
- int fd;
-
- fd = open("/dev/null", O_WRONLY);
- assert_d_ne(fd, -1, "Unexpected open() failure");
-
- return (fd);
-}
-
-static void
-set_prof_active(bool active)
-{
-
- assert_d_eq(mallctl("prof.active", NULL, NULL, &active, sizeof(active)),
- 0, "Unexpected mallctl failure");
-}
-
-static size_t
-get_lg_prof_sample(void)
-{
- size_t lg_prof_sample;
- size_t sz = sizeof(size_t);
-
- assert_d_eq(mallctl("prof.lg_sample", &lg_prof_sample, &sz, NULL, 0), 0,
- "Unexpected mallctl failure while reading profiling sample rate");
- return (lg_prof_sample);
-}
-
-static void
-do_prof_reset(size_t lg_prof_sample)
-{
- assert_d_eq(mallctl("prof.reset", NULL, NULL,
- &lg_prof_sample, sizeof(size_t)), 0,
- "Unexpected mallctl failure while resetting profile data");
- assert_zu_eq(lg_prof_sample, get_lg_prof_sample(),
- "Expected profile sample rate change");
-}
-
-TEST_BEGIN(test_prof_reset_basic)
-{
- size_t lg_prof_sample_orig, lg_prof_sample, lg_prof_sample_next;
- size_t sz;
- unsigned i;
-
- test_skip_if(!config_prof);
-
- sz = sizeof(size_t);
- assert_d_eq(mallctl("opt.lg_prof_sample", &lg_prof_sample_orig, &sz,
- NULL, 0), 0,
- "Unexpected mallctl failure while reading profiling sample rate");
- assert_zu_eq(lg_prof_sample_orig, 0,
- "Unexpected profiling sample rate");
- lg_prof_sample = get_lg_prof_sample();
- assert_zu_eq(lg_prof_sample_orig, lg_prof_sample,
- "Unexpected disagreement between \"opt.lg_prof_sample\" and "
- "\"prof.lg_sample\"");
-
- /* Test simple resets. */
- for (i = 0; i < 2; i++) {
- assert_d_eq(mallctl("prof.reset", NULL, NULL, NULL, 0), 0,
- "Unexpected mallctl failure while resetting profile data");
- lg_prof_sample = get_lg_prof_sample();
- assert_zu_eq(lg_prof_sample_orig, lg_prof_sample,
- "Unexpected profile sample rate change");
- }
-
- /* Test resets with prof.lg_sample changes. */
- lg_prof_sample_next = 1;
- for (i = 0; i < 2; i++) {
- do_prof_reset(lg_prof_sample_next);
- lg_prof_sample = get_lg_prof_sample();
- assert_zu_eq(lg_prof_sample, lg_prof_sample_next,
- "Expected profile sample rate change");
- lg_prof_sample_next = lg_prof_sample_orig;
- }
-
- /* Make sure the test code restored prof.lg_sample. */
- lg_prof_sample = get_lg_prof_sample();
- assert_zu_eq(lg_prof_sample_orig, lg_prof_sample,
- "Unexpected disagreement between \"opt.lg_prof_sample\" and "
- "\"prof.lg_sample\"");
-}
-TEST_END
-
-bool prof_dump_header_intercepted = false;
-prof_cnt_t cnt_all_copy = {0, 0, 0, 0};
-static bool
-prof_dump_header_intercept(tsdn_t *tsdn, bool propagate_err,
- const prof_cnt_t *cnt_all)
-{
-
- prof_dump_header_intercepted = true;
- memcpy(&cnt_all_copy, cnt_all, sizeof(prof_cnt_t));
-
- return (false);
-}
-
-TEST_BEGIN(test_prof_reset_cleanup)
-{
- void *p;
- prof_dump_header_t *prof_dump_header_orig;
-
- test_skip_if(!config_prof);
-
- set_prof_active(true);
-
- assert_zu_eq(prof_bt_count(), 0, "Expected 0 backtraces");
- p = mallocx(1, 0);
- assert_ptr_not_null(p, "Unexpected mallocx() failure");
- assert_zu_eq(prof_bt_count(), 1, "Expected 1 backtrace");
-
- prof_dump_header_orig = prof_dump_header;
- prof_dump_header = prof_dump_header_intercept;
- assert_false(prof_dump_header_intercepted, "Unexpected intercept");
-
- assert_d_eq(mallctl("prof.dump", NULL, NULL, NULL, 0),
- 0, "Unexpected error while dumping heap profile");
- assert_true(prof_dump_header_intercepted, "Expected intercept");
- assert_u64_eq(cnt_all_copy.curobjs, 1, "Expected 1 allocation");
-
- assert_d_eq(mallctl("prof.reset", NULL, NULL, NULL, 0), 0,
- "Unexpected error while resetting heap profile data");
- assert_d_eq(mallctl("prof.dump", NULL, NULL, NULL, 0),
- 0, "Unexpected error while dumping heap profile");
- assert_u64_eq(cnt_all_copy.curobjs, 0, "Expected 0 allocations");
- assert_zu_eq(prof_bt_count(), 1, "Expected 1 backtrace");
-
- prof_dump_header = prof_dump_header_orig;
-
- dallocx(p, 0);
- assert_zu_eq(prof_bt_count(), 0, "Expected 0 backtraces");
-
- set_prof_active(false);
-}
-TEST_END
-
-#define NTHREADS 4
-#define NALLOCS_PER_THREAD (1U << 13)
-#define OBJ_RING_BUF_COUNT 1531
-#define RESET_INTERVAL (1U << 10)
-#define DUMP_INTERVAL 3677
-static void *
-thd_start(void *varg)
-{
- unsigned thd_ind = *(unsigned *)varg;
- unsigned i;
- void *objs[OBJ_RING_BUF_COUNT];
-
- memset(objs, 0, sizeof(objs));
-
- for (i = 0; i < NALLOCS_PER_THREAD; i++) {
- if (i % RESET_INTERVAL == 0) {
- assert_d_eq(mallctl("prof.reset", NULL, NULL, NULL, 0),
- 0, "Unexpected error while resetting heap profile "
- "data");
- }
-
- if (i % DUMP_INTERVAL == 0) {
- assert_d_eq(mallctl("prof.dump", NULL, NULL, NULL, 0),
- 0, "Unexpected error while dumping heap profile");
- }
-
- {
- void **pp = &objs[i % OBJ_RING_BUF_COUNT];
- if (*pp != NULL) {
- dallocx(*pp, 0);
- *pp = NULL;
- }
- *pp = btalloc(1, thd_ind*NALLOCS_PER_THREAD + i);
- assert_ptr_not_null(*pp,
- "Unexpected btalloc() failure");
- }
- }
-
- /* Clean up any remaining objects. */
- for (i = 0; i < OBJ_RING_BUF_COUNT; i++) {
- void **pp = &objs[i % OBJ_RING_BUF_COUNT];
- if (*pp != NULL) {
- dallocx(*pp, 0);
- *pp = NULL;
- }
- }
-
- return (NULL);
-}
-
-TEST_BEGIN(test_prof_reset)
-{
- size_t lg_prof_sample_orig;
- thd_t thds[NTHREADS];
- unsigned thd_args[NTHREADS];
- unsigned i;
- size_t bt_count, tdata_count;
-
- test_skip_if(!config_prof);
-
- bt_count = prof_bt_count();
- assert_zu_eq(bt_count, 0,
- "Unexpected pre-existing tdata structures");
- tdata_count = prof_tdata_count();
-
- lg_prof_sample_orig = get_lg_prof_sample();
- do_prof_reset(5);
-
- set_prof_active(true);
-
- for (i = 0; i < NTHREADS; i++) {
- thd_args[i] = i;
- thd_create(&thds[i], thd_start, (void *)&thd_args[i]);
- }
- for (i = 0; i < NTHREADS; i++)
- thd_join(thds[i], NULL);
-
- assert_zu_eq(prof_bt_count(), bt_count,
- "Unexpected bactrace count change");
- assert_zu_eq(prof_tdata_count(), tdata_count,
- "Unexpected remaining tdata structures");
-
- set_prof_active(false);
-
- do_prof_reset(lg_prof_sample_orig);
-}
-TEST_END
-#undef NTHREADS
-#undef NALLOCS_PER_THREAD
-#undef OBJ_RING_BUF_COUNT
-#undef RESET_INTERVAL
-#undef DUMP_INTERVAL
-
-/* Test sampling at the same allocation site across resets. */
-#define NITER 10
-TEST_BEGIN(test_xallocx)
-{
- size_t lg_prof_sample_orig;
- unsigned i;
- void *ptrs[NITER];
-
- test_skip_if(!config_prof);
-
- lg_prof_sample_orig = get_lg_prof_sample();
- set_prof_active(true);
-
- /* Reset profiling. */
- do_prof_reset(0);
-
- for (i = 0; i < NITER; i++) {
- void *p;
- size_t sz, nsz;
-
- /* Reset profiling. */
- do_prof_reset(0);
-
- /* Allocate small object (which will be promoted). */
- p = ptrs[i] = mallocx(1, 0);
- assert_ptr_not_null(p, "Unexpected mallocx() failure");
-
- /* Reset profiling. */
- do_prof_reset(0);
-
- /* Perform successful xallocx(). */
- sz = sallocx(p, 0);
- assert_zu_eq(xallocx(p, sz, 0, 0), sz,
- "Unexpected xallocx() failure");
-
- /* Perform unsuccessful xallocx(). */
- nsz = nallocx(sz+1, 0);
- assert_zu_eq(xallocx(p, nsz, 0, 0), sz,
- "Unexpected xallocx() success");
- }
-
- for (i = 0; i < NITER; i++) {
- /* dallocx. */
- dallocx(ptrs[i], 0);
- }
-
- set_prof_active(false);
- do_prof_reset(lg_prof_sample_orig);
-}
-TEST_END
-#undef NITER
-
-int
-main(void)
-{
-
- /* Intercept dumping prior to running any tests. */
- prof_dump_open = prof_dump_open_intercept;
-
- return (test(
- test_prof_reset_basic,
- test_prof_reset_cleanup,
- test_prof_reset,
- test_xallocx));
-}
diff --git a/memory/jemalloc/src/test/unit/prof_thread_name.c b/memory/jemalloc/src/test/unit/prof_thread_name.c
deleted file mode 100644
index f501158d7d..0000000000
--- a/memory/jemalloc/src/test/unit/prof_thread_name.c
+++ /dev/null
@@ -1,129 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#ifdef JEMALLOC_PROF
-const char *malloc_conf = "prof:true,prof_active:false";
-#endif
-
-static void
-mallctl_thread_name_get_impl(const char *thread_name_expected, const char *func,
- int line)
-{
- const char *thread_name_old;
- size_t sz;
-
- sz = sizeof(thread_name_old);
- assert_d_eq(mallctl("thread.prof.name", &thread_name_old, &sz, NULL, 0),
- 0, "%s():%d: Unexpected mallctl failure reading thread.prof.name",
- func, line);
- assert_str_eq(thread_name_old, thread_name_expected,
- "%s():%d: Unexpected thread.prof.name value", func, line);
-}
-#define mallctl_thread_name_get(a) \
- mallctl_thread_name_get_impl(a, __func__, __LINE__)
-
-static void
-mallctl_thread_name_set_impl(const char *thread_name, const char *func,
- int line)
-{
-
- assert_d_eq(mallctl("thread.prof.name", NULL, NULL, &thread_name,
- sizeof(thread_name)), 0,
- "%s():%d: Unexpected mallctl failure reading thread.prof.name",
- func, line);
- mallctl_thread_name_get_impl(thread_name, func, line);
-}
-#define mallctl_thread_name_set(a) \
- mallctl_thread_name_set_impl(a, __func__, __LINE__)
-
-TEST_BEGIN(test_prof_thread_name_validation)
-{
- const char *thread_name;
-
- test_skip_if(!config_prof);
-
- mallctl_thread_name_get("");
- mallctl_thread_name_set("hi there");
-
- /* NULL input shouldn't be allowed. */
- thread_name = NULL;
- assert_d_eq(mallctl("thread.prof.name", NULL, NULL, &thread_name,
- sizeof(thread_name)), EFAULT,
- "Unexpected mallctl result writing \"%s\" to thread.prof.name",
- thread_name);
-
- /* '\n' shouldn't be allowed. */
- thread_name = "hi\nthere";
- assert_d_eq(mallctl("thread.prof.name", NULL, NULL, &thread_name,
- sizeof(thread_name)), EFAULT,
- "Unexpected mallctl result writing \"%s\" to thread.prof.name",
- thread_name);
-
- /* Simultaneous read/write shouldn't be allowed. */
- {
- const char *thread_name_old;
- size_t sz;
-
- sz = sizeof(thread_name_old);
- assert_d_eq(mallctl("thread.prof.name", &thread_name_old, &sz,
- &thread_name, sizeof(thread_name)), EPERM,
- "Unexpected mallctl result writing \"%s\" to "
- "thread.prof.name", thread_name);
- }
-
- mallctl_thread_name_set("");
-}
-TEST_END
-
-#define NTHREADS 4
-#define NRESET 25
-static void *
-thd_start(void *varg)
-{
- unsigned thd_ind = *(unsigned *)varg;
- char thread_name[16] = "";
- unsigned i;
-
- malloc_snprintf(thread_name, sizeof(thread_name), "thread %u", thd_ind);
-
- mallctl_thread_name_get("");
- mallctl_thread_name_set(thread_name);
-
- for (i = 0; i < NRESET; i++) {
- assert_d_eq(mallctl("prof.reset", NULL, NULL, NULL, 0), 0,
- "Unexpected error while resetting heap profile data");
- mallctl_thread_name_get(thread_name);
- }
-
- mallctl_thread_name_set(thread_name);
- mallctl_thread_name_set("");
-
- return (NULL);
-}
-
-TEST_BEGIN(test_prof_thread_name_threaded)
-{
- thd_t thds[NTHREADS];
- unsigned thd_args[NTHREADS];
- unsigned i;
-
- test_skip_if(!config_prof);
-
- for (i = 0; i < NTHREADS; i++) {
- thd_args[i] = i;
- thd_create(&thds[i], thd_start, (void *)&thd_args[i]);
- }
- for (i = 0; i < NTHREADS; i++)
- thd_join(thds[i], NULL);
-}
-TEST_END
-#undef NTHREADS
-#undef NRESET
-
-int
-main(void)
-{
-
- return (test(
- test_prof_thread_name_validation,
- test_prof_thread_name_threaded));
-}
diff --git a/memory/jemalloc/src/test/unit/ql.c b/memory/jemalloc/src/test/unit/ql.c
deleted file mode 100644
index 05fad450fc..0000000000
--- a/memory/jemalloc/src/test/unit/ql.c
+++ /dev/null
@@ -1,209 +0,0 @@
-#include "test/jemalloc_test.h"
-
-/* Number of ring entries, in [2..26]. */
-#define NENTRIES 9
-
-typedef struct list_s list_t;
-typedef ql_head(list_t) list_head_t;
-
-struct list_s {
- ql_elm(list_t) link;
- char id;
-};
-
-static void
-test_empty_list(list_head_t *head)
-{
- list_t *t;
- unsigned i;
-
- assert_ptr_null(ql_first(head), "Unexpected element for empty list");
- assert_ptr_null(ql_last(head, link),
- "Unexpected element for empty list");
-
- i = 0;
- ql_foreach(t, head, link) {
- i++;
- }
- assert_u_eq(i, 0, "Unexpected element for empty list");
-
- i = 0;
- ql_reverse_foreach(t, head, link) {
- i++;
- }
- assert_u_eq(i, 0, "Unexpected element for empty list");
-}
-
-TEST_BEGIN(test_ql_empty)
-{
- list_head_t head;
-
- ql_new(&head);
- test_empty_list(&head);
-}
-TEST_END
-
-static void
-init_entries(list_t *entries, unsigned nentries)
-{
- unsigned i;
-
- for (i = 0; i < nentries; i++) {
- entries[i].id = 'a' + i;
- ql_elm_new(&entries[i], link);
- }
-}
-
-static void
-test_entries_list(list_head_t *head, list_t *entries, unsigned nentries)
-{
- list_t *t;
- unsigned i;
-
- assert_c_eq(ql_first(head)->id, entries[0].id, "Element id mismatch");
- assert_c_eq(ql_last(head, link)->id, entries[nentries-1].id,
- "Element id mismatch");
-
- i = 0;
- ql_foreach(t, head, link) {
- assert_c_eq(t->id, entries[i].id, "Element id mismatch");
- i++;
- }
-
- i = 0;
- ql_reverse_foreach(t, head, link) {
- assert_c_eq(t->id, entries[nentries-i-1].id,
- "Element id mismatch");
- i++;
- }
-
- for (i = 0; i < nentries-1; i++) {
- t = ql_next(head, &entries[i], link);
- assert_c_eq(t->id, entries[i+1].id, "Element id mismatch");
- }
- assert_ptr_null(ql_next(head, &entries[nentries-1], link),
- "Unexpected element");
-
- assert_ptr_null(ql_prev(head, &entries[0], link), "Unexpected element");
- for (i = 1; i < nentries; i++) {
- t = ql_prev(head, &entries[i], link);
- assert_c_eq(t->id, entries[i-1].id, "Element id mismatch");
- }
-}
-
-TEST_BEGIN(test_ql_tail_insert)
-{
- list_head_t head;
- list_t entries[NENTRIES];
- unsigned i;
-
- ql_new(&head);
- init_entries(entries, sizeof(entries)/sizeof(list_t));
- for (i = 0; i < NENTRIES; i++)
- ql_tail_insert(&head, &entries[i], link);
-
- test_entries_list(&head, entries, NENTRIES);
-}
-TEST_END
-
-TEST_BEGIN(test_ql_tail_remove)
-{
- list_head_t head;
- list_t entries[NENTRIES];
- unsigned i;
-
- ql_new(&head);
- init_entries(entries, sizeof(entries)/sizeof(list_t));
- for (i = 0; i < NENTRIES; i++)
- ql_tail_insert(&head, &entries[i], link);
-
- for (i = 0; i < NENTRIES; i++) {
- test_entries_list(&head, entries, NENTRIES-i);
- ql_tail_remove(&head, list_t, link);
- }
- test_empty_list(&head);
-}
-TEST_END
-
-TEST_BEGIN(test_ql_head_insert)
-{
- list_head_t head;
- list_t entries[NENTRIES];
- unsigned i;
-
- ql_new(&head);
- init_entries(entries, sizeof(entries)/sizeof(list_t));
- for (i = 0; i < NENTRIES; i++)
- ql_head_insert(&head, &entries[NENTRIES-i-1], link);
-
- test_entries_list(&head, entries, NENTRIES);
-}
-TEST_END
-
-TEST_BEGIN(test_ql_head_remove)
-{
- list_head_t head;
- list_t entries[NENTRIES];
- unsigned i;
-
- ql_new(&head);
- init_entries(entries, sizeof(entries)/sizeof(list_t));
- for (i = 0; i < NENTRIES; i++)
- ql_head_insert(&head, &entries[NENTRIES-i-1], link);
-
- for (i = 0; i < NENTRIES; i++) {
- test_entries_list(&head, &entries[i], NENTRIES-i);
- ql_head_remove(&head, list_t, link);
- }
- test_empty_list(&head);
-}
-TEST_END
-
-TEST_BEGIN(test_ql_insert)
-{
- list_head_t head;
- list_t entries[8];
- list_t *a, *b, *c, *d, *e, *f, *g, *h;
-
- ql_new(&head);
- init_entries(entries, sizeof(entries)/sizeof(list_t));
- a = &entries[0];
- b = &entries[1];
- c = &entries[2];
- d = &entries[3];
- e = &entries[4];
- f = &entries[5];
- g = &entries[6];
- h = &entries[7];
-
- /*
- * ql_remove(), ql_before_insert(), and ql_after_insert() are used
- * internally by other macros that are already tested, so there's no
- * need to test them completely. However, insertion/deletion from the
- * middle of lists is not otherwise tested; do so here.
- */
- ql_tail_insert(&head, f, link);
- ql_before_insert(&head, f, b, link);
- ql_before_insert(&head, f, c, link);
- ql_after_insert(f, h, link);
- ql_after_insert(f, g, link);
- ql_before_insert(&head, b, a, link);
- ql_after_insert(c, d, link);
- ql_before_insert(&head, f, e, link);
-
- test_entries_list(&head, entries, sizeof(entries)/sizeof(list_t));
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_ql_empty,
- test_ql_tail_insert,
- test_ql_tail_remove,
- test_ql_head_insert,
- test_ql_head_remove,
- test_ql_insert));
-}
diff --git a/memory/jemalloc/src/test/unit/qr.c b/memory/jemalloc/src/test/unit/qr.c
deleted file mode 100644
index a2a2d902b5..0000000000
--- a/memory/jemalloc/src/test/unit/qr.c
+++ /dev/null
@@ -1,248 +0,0 @@
-#include "test/jemalloc_test.h"
-
-/* Number of ring entries, in [2..26]. */
-#define NENTRIES 9
-/* Split index, in [1..NENTRIES). */
-#define SPLIT_INDEX 5
-
-typedef struct ring_s ring_t;
-
-struct ring_s {
- qr(ring_t) link;
- char id;
-};
-
-static void
-init_entries(ring_t *entries)
-{
- unsigned i;
-
- for (i = 0; i < NENTRIES; i++) {
- qr_new(&entries[i], link);
- entries[i].id = 'a' + i;
- }
-}
-
-static void
-test_independent_entries(ring_t *entries)
-{
- ring_t *t;
- unsigned i, j;
-
- for (i = 0; i < NENTRIES; i++) {
- j = 0;
- qr_foreach(t, &entries[i], link) {
- j++;
- }
- assert_u_eq(j, 1,
- "Iteration over single-element ring should visit precisely "
- "one element");
- }
- for (i = 0; i < NENTRIES; i++) {
- j = 0;
- qr_reverse_foreach(t, &entries[i], link) {
- j++;
- }
- assert_u_eq(j, 1,
- "Iteration over single-element ring should visit precisely "
- "one element");
- }
- for (i = 0; i < NENTRIES; i++) {
- t = qr_next(&entries[i], link);
- assert_ptr_eq(t, &entries[i],
- "Next element in single-element ring should be same as "
- "current element");
- }
- for (i = 0; i < NENTRIES; i++) {
- t = qr_prev(&entries[i], link);
- assert_ptr_eq(t, &entries[i],
- "Previous element in single-element ring should be same as "
- "current element");
- }
-}
-
-TEST_BEGIN(test_qr_one)
-{
- ring_t entries[NENTRIES];
-
- init_entries(entries);
- test_independent_entries(entries);
-}
-TEST_END
-
-static void
-test_entries_ring(ring_t *entries)
-{
- ring_t *t;
- unsigned i, j;
-
- for (i = 0; i < NENTRIES; i++) {
- j = 0;
- qr_foreach(t, &entries[i], link) {
- assert_c_eq(t->id, entries[(i+j) % NENTRIES].id,
- "Element id mismatch");
- j++;
- }
- }
- for (i = 0; i < NENTRIES; i++) {
- j = 0;
- qr_reverse_foreach(t, &entries[i], link) {
- assert_c_eq(t->id, entries[(NENTRIES+i-j-1) %
- NENTRIES].id, "Element id mismatch");
- j++;
- }
- }
- for (i = 0; i < NENTRIES; i++) {
- t = qr_next(&entries[i], link);
- assert_c_eq(t->id, entries[(i+1) % NENTRIES].id,
- "Element id mismatch");
- }
- for (i = 0; i < NENTRIES; i++) {
- t = qr_prev(&entries[i], link);
- assert_c_eq(t->id, entries[(NENTRIES+i-1) % NENTRIES].id,
- "Element id mismatch");
- }
-}
-
-TEST_BEGIN(test_qr_after_insert)
-{
- ring_t entries[NENTRIES];
- unsigned i;
-
- init_entries(entries);
- for (i = 1; i < NENTRIES; i++)
- qr_after_insert(&entries[i - 1], &entries[i], link);
- test_entries_ring(entries);
-}
-TEST_END
-
-TEST_BEGIN(test_qr_remove)
-{
- ring_t entries[NENTRIES];
- ring_t *t;
- unsigned i, j;
-
- init_entries(entries);
- for (i = 1; i < NENTRIES; i++)
- qr_after_insert(&entries[i - 1], &entries[i], link);
-
- for (i = 0; i < NENTRIES; i++) {
- j = 0;
- qr_foreach(t, &entries[i], link) {
- assert_c_eq(t->id, entries[i+j].id,
- "Element id mismatch");
- j++;
- }
- j = 0;
- qr_reverse_foreach(t, &entries[i], link) {
- assert_c_eq(t->id, entries[NENTRIES - 1 - j].id,
- "Element id mismatch");
- j++;
- }
- qr_remove(&entries[i], link);
- }
- test_independent_entries(entries);
-}
-TEST_END
-
-TEST_BEGIN(test_qr_before_insert)
-{
- ring_t entries[NENTRIES];
- ring_t *t;
- unsigned i, j;
-
- init_entries(entries);
- for (i = 1; i < NENTRIES; i++)
- qr_before_insert(&entries[i - 1], &entries[i], link);
- for (i = 0; i < NENTRIES; i++) {
- j = 0;
- qr_foreach(t, &entries[i], link) {
- assert_c_eq(t->id, entries[(NENTRIES+i-j) %
- NENTRIES].id, "Element id mismatch");
- j++;
- }
- }
- for (i = 0; i < NENTRIES; i++) {
- j = 0;
- qr_reverse_foreach(t, &entries[i], link) {
- assert_c_eq(t->id, entries[(i+j+1) % NENTRIES].id,
- "Element id mismatch");
- j++;
- }
- }
- for (i = 0; i < NENTRIES; i++) {
- t = qr_next(&entries[i], link);
- assert_c_eq(t->id, entries[(NENTRIES+i-1) % NENTRIES].id,
- "Element id mismatch");
- }
- for (i = 0; i < NENTRIES; i++) {
- t = qr_prev(&entries[i], link);
- assert_c_eq(t->id, entries[(i+1) % NENTRIES].id,
- "Element id mismatch");
- }
-}
-TEST_END
-
-static void
-test_split_entries(ring_t *entries)
-{
- ring_t *t;
- unsigned i, j;
-
- for (i = 0; i < NENTRIES; i++) {
- j = 0;
- qr_foreach(t, &entries[i], link) {
- if (i < SPLIT_INDEX) {
- assert_c_eq(t->id,
- entries[(i+j) % SPLIT_INDEX].id,
- "Element id mismatch");
- } else {
- assert_c_eq(t->id, entries[(i+j-SPLIT_INDEX) %
- (NENTRIES-SPLIT_INDEX) + SPLIT_INDEX].id,
- "Element id mismatch");
- }
- j++;
- }
- }
-}
-
-TEST_BEGIN(test_qr_meld_split)
-{
- ring_t entries[NENTRIES];
- unsigned i;
-
- init_entries(entries);
- for (i = 1; i < NENTRIES; i++)
- qr_after_insert(&entries[i - 1], &entries[i], link);
-
- qr_split(&entries[0], &entries[SPLIT_INDEX], link);
- test_split_entries(entries);
-
- qr_meld(&entries[0], &entries[SPLIT_INDEX], link);
- test_entries_ring(entries);
-
- qr_meld(&entries[0], &entries[SPLIT_INDEX], link);
- test_split_entries(entries);
-
- qr_split(&entries[0], &entries[SPLIT_INDEX], link);
- test_entries_ring(entries);
-
- qr_split(&entries[0], &entries[0], link);
- test_entries_ring(entries);
-
- qr_meld(&entries[0], &entries[0], link);
- test_entries_ring(entries);
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_qr_one,
- test_qr_after_insert,
- test_qr_remove,
- test_qr_before_insert,
- test_qr_meld_split));
-}
diff --git a/memory/jemalloc/src/test/unit/quarantine.c b/memory/jemalloc/src/test/unit/quarantine.c
deleted file mode 100644
index bbd48a51dd..0000000000
--- a/memory/jemalloc/src/test/unit/quarantine.c
+++ /dev/null
@@ -1,108 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#define QUARANTINE_SIZE 8192
-#define STRINGIFY_HELPER(x) #x
-#define STRINGIFY(x) STRINGIFY_HELPER(x)
-
-#ifdef JEMALLOC_FILL
-const char *malloc_conf = "abort:false,junk:true,redzone:true,quarantine:"
- STRINGIFY(QUARANTINE_SIZE);
-#endif
-
-void
-quarantine_clear(void)
-{
- void *p;
-
- p = mallocx(QUARANTINE_SIZE*2, 0);
- assert_ptr_not_null(p, "Unexpected mallocx() failure");
- dallocx(p, 0);
-}
-
-TEST_BEGIN(test_quarantine)
-{
-#define SZ ZU(256)
-#define NQUARANTINED (QUARANTINE_SIZE/SZ)
- void *quarantined[NQUARANTINED+1];
- size_t i, j;
-
- test_skip_if(!config_fill);
-
- assert_zu_eq(nallocx(SZ, 0), SZ,
- "SZ=%zu does not precisely equal a size class", SZ);
-
- quarantine_clear();
-
- /*
- * Allocate enough regions to completely fill the quarantine, plus one
- * more. The last iteration occurs with a completely full quarantine,
- * but no regions should be drained from the quarantine until the last
- * deallocation occurs. Therefore no region recycling should occur
- * until after this loop completes.
- */
- for (i = 0; i < NQUARANTINED+1; i++) {
- void *p = mallocx(SZ, 0);
- assert_ptr_not_null(p, "Unexpected mallocx() failure");
- quarantined[i] = p;
- dallocx(p, 0);
- for (j = 0; j < i; j++) {
- assert_ptr_ne(p, quarantined[j],
- "Quarantined region recycled too early; "
- "i=%zu, j=%zu", i, j);
- }
- }
-#undef NQUARANTINED
-#undef SZ
-}
-TEST_END
-
-static bool detected_redzone_corruption;
-
-static void
-arena_redzone_corruption_replacement(void *ptr, size_t usize, bool after,
- size_t offset, uint8_t byte)
-{
-
- detected_redzone_corruption = true;
-}
-
-TEST_BEGIN(test_quarantine_redzone)
-{
- char *s;
- arena_redzone_corruption_t *arena_redzone_corruption_orig;
-
- test_skip_if(!config_fill);
-
- arena_redzone_corruption_orig = arena_redzone_corruption;
- arena_redzone_corruption = arena_redzone_corruption_replacement;
-
- /* Test underflow. */
- detected_redzone_corruption = false;
- s = (char *)mallocx(1, 0);
- assert_ptr_not_null((void *)s, "Unexpected mallocx() failure");
- s[-1] = 0xbb;
- dallocx(s, 0);
- assert_true(detected_redzone_corruption,
- "Did not detect redzone corruption");
-
- /* Test overflow. */
- detected_redzone_corruption = false;
- s = (char *)mallocx(1, 0);
- assert_ptr_not_null((void *)s, "Unexpected mallocx() failure");
- s[sallocx(s, 0)] = 0xbb;
- dallocx(s, 0);
- assert_true(detected_redzone_corruption,
- "Did not detect redzone corruption");
-
- arena_redzone_corruption = arena_redzone_corruption_orig;
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_quarantine,
- test_quarantine_redzone));
-}
diff --git a/memory/jemalloc/src/test/unit/rb.c b/memory/jemalloc/src/test/unit/rb.c
deleted file mode 100644
index cf3d3a7835..0000000000
--- a/memory/jemalloc/src/test/unit/rb.c
+++ /dev/null
@@ -1,354 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#define rbtn_black_height(a_type, a_field, a_rbt, r_height) do { \
- a_type *rbp_bh_t; \
- for (rbp_bh_t = (a_rbt)->rbt_root, (r_height) = 0; \
- rbp_bh_t != NULL; \
- rbp_bh_t = rbtn_left_get(a_type, a_field, rbp_bh_t)) { \
- if (!rbtn_red_get(a_type, a_field, rbp_bh_t)) { \
- (r_height)++; \
- } \
- } \
-} while (0)
-
-typedef struct node_s node_t;
-
-struct node_s {
-#define NODE_MAGIC 0x9823af7e
- uint32_t magic;
- rb_node(node_t) link;
- uint64_t key;
-};
-
-static int
-node_cmp(const node_t *a, const node_t *b) {
- int ret;
-
- assert_u32_eq(a->magic, NODE_MAGIC, "Bad magic");
- assert_u32_eq(b->magic, NODE_MAGIC, "Bad magic");
-
- ret = (a->key > b->key) - (a->key < b->key);
- if (ret == 0) {
- /*
- * Duplicates are not allowed in the tree, so force an
- * arbitrary ordering for non-identical items with equal keys.
- */
- ret = (((uintptr_t)a) > ((uintptr_t)b))
- - (((uintptr_t)a) < ((uintptr_t)b));
- }
- return (ret);
-}
-
-typedef rb_tree(node_t) tree_t;
-rb_gen(static, tree_, tree_t, node_t, link, node_cmp);
-
-TEST_BEGIN(test_rb_empty)
-{
- tree_t tree;
- node_t key;
-
- tree_new(&tree);
-
- assert_true(tree_empty(&tree), "Tree should be empty");
- assert_ptr_null(tree_first(&tree), "Unexpected node");
- assert_ptr_null(tree_last(&tree), "Unexpected node");
-
- key.key = 0;
- key.magic = NODE_MAGIC;
- assert_ptr_null(tree_search(&tree, &key), "Unexpected node");
-
- key.key = 0;
- key.magic = NODE_MAGIC;
- assert_ptr_null(tree_nsearch(&tree, &key), "Unexpected node");
-
- key.key = 0;
- key.magic = NODE_MAGIC;
- assert_ptr_null(tree_psearch(&tree, &key), "Unexpected node");
-}
-TEST_END
-
-static unsigned
-tree_recurse(node_t *node, unsigned black_height, unsigned black_depth)
-{
- unsigned ret = 0;
- node_t *left_node;
- node_t *right_node;
-
- if (node == NULL)
- return (ret);
-
- left_node = rbtn_left_get(node_t, link, node);
- right_node = rbtn_right_get(node_t, link, node);
-
- if (!rbtn_red_get(node_t, link, node))
- black_depth++;
-
- /* Red nodes must be interleaved with black nodes. */
- if (rbtn_red_get(node_t, link, node)) {
- if (left_node != NULL)
- assert_false(rbtn_red_get(node_t, link, left_node),
- "Node should be black");
- if (right_node != NULL)
- assert_false(rbtn_red_get(node_t, link, right_node),
- "Node should be black");
- }
-
- /* Self. */
- assert_u32_eq(node->magic, NODE_MAGIC, "Bad magic");
-
- /* Left subtree. */
- if (left_node != NULL)
- ret += tree_recurse(left_node, black_height, black_depth);
- else
- ret += (black_depth != black_height);
-
- /* Right subtree. */
- if (right_node != NULL)
- ret += tree_recurse(right_node, black_height, black_depth);
- else
- ret += (black_depth != black_height);
-
- return (ret);
-}
-
-static node_t *
-tree_iterate_cb(tree_t *tree, node_t *node, void *data)
-{
- unsigned *i = (unsigned *)data;
- node_t *search_node;
-
- assert_u32_eq(node->magic, NODE_MAGIC, "Bad magic");
-
- /* Test rb_search(). */
- search_node = tree_search(tree, node);
- assert_ptr_eq(search_node, node,
- "tree_search() returned unexpected node");
-
- /* Test rb_nsearch(). */
- search_node = tree_nsearch(tree, node);
- assert_ptr_eq(search_node, node,
- "tree_nsearch() returned unexpected node");
-
- /* Test rb_psearch(). */
- search_node = tree_psearch(tree, node);
- assert_ptr_eq(search_node, node,
- "tree_psearch() returned unexpected node");
-
- (*i)++;
-
- return (NULL);
-}
-
-static unsigned
-tree_iterate(tree_t *tree)
-{
- unsigned i;
-
- i = 0;
- tree_iter(tree, NULL, tree_iterate_cb, (void *)&i);
-
- return (i);
-}
-
-static unsigned
-tree_iterate_reverse(tree_t *tree)
-{
- unsigned i;
-
- i = 0;
- tree_reverse_iter(tree, NULL, tree_iterate_cb, (void *)&i);
-
- return (i);
-}
-
-static void
-node_remove(tree_t *tree, node_t *node, unsigned nnodes)
-{
- node_t *search_node;
- unsigned black_height, imbalances;
-
- tree_remove(tree, node);
-
- /* Test rb_nsearch(). */
- search_node = tree_nsearch(tree, node);
- if (search_node != NULL) {
- assert_u64_ge(search_node->key, node->key,
- "Key ordering error");
- }
-
- /* Test rb_psearch(). */
- search_node = tree_psearch(tree, node);
- if (search_node != NULL) {
- assert_u64_le(search_node->key, node->key,
- "Key ordering error");
- }
-
- node->magic = 0;
-
- rbtn_black_height(node_t, link, tree, black_height);
- imbalances = tree_recurse(tree->rbt_root, black_height, 0);
- assert_u_eq(imbalances, 0, "Tree is unbalanced");
- assert_u_eq(tree_iterate(tree), nnodes-1,
- "Unexpected node iteration count");
- assert_u_eq(tree_iterate_reverse(tree), nnodes-1,
- "Unexpected node iteration count");
-}
-
-static node_t *
-remove_iterate_cb(tree_t *tree, node_t *node, void *data)
-{
- unsigned *nnodes = (unsigned *)data;
- node_t *ret = tree_next(tree, node);
-
- node_remove(tree, node, *nnodes);
-
- return (ret);
-}
-
-static node_t *
-remove_reverse_iterate_cb(tree_t *tree, node_t *node, void *data)
-{
- unsigned *nnodes = (unsigned *)data;
- node_t *ret = tree_prev(tree, node);
-
- node_remove(tree, node, *nnodes);
-
- return (ret);
-}
-
-static void
-destroy_cb(node_t *node, void *data)
-{
- unsigned *nnodes = (unsigned *)data;
-
- assert_u_gt(*nnodes, 0, "Destruction removed too many nodes");
- (*nnodes)--;
-}
-
-TEST_BEGIN(test_rb_random)
-{
-#define NNODES 25
-#define NBAGS 250
-#define SEED 42
- sfmt_t *sfmt;
- uint64_t bag[NNODES];
- tree_t tree;
- node_t nodes[NNODES];
- unsigned i, j, k, black_height, imbalances;
-
- sfmt = init_gen_rand(SEED);
- for (i = 0; i < NBAGS; i++) {
- switch (i) {
- case 0:
- /* Insert in order. */
- for (j = 0; j < NNODES; j++)
- bag[j] = j;
- break;
- case 1:
- /* Insert in reverse order. */
- for (j = 0; j < NNODES; j++)
- bag[j] = NNODES - j - 1;
- break;
- default:
- for (j = 0; j < NNODES; j++)
- bag[j] = gen_rand64_range(sfmt, NNODES);
- }
-
- for (j = 1; j <= NNODES; j++) {
- /* Initialize tree and nodes. */
- tree_new(&tree);
- for (k = 0; k < j; k++) {
- nodes[k].magic = NODE_MAGIC;
- nodes[k].key = bag[k];
- }
-
- /* Insert nodes. */
- for (k = 0; k < j; k++) {
- tree_insert(&tree, &nodes[k]);
-
- rbtn_black_height(node_t, link, &tree,
- black_height);
- imbalances = tree_recurse(tree.rbt_root,
- black_height, 0);
- assert_u_eq(imbalances, 0,
- "Tree is unbalanced");
-
- assert_u_eq(tree_iterate(&tree), k+1,
- "Unexpected node iteration count");
- assert_u_eq(tree_iterate_reverse(&tree), k+1,
- "Unexpected node iteration count");
-
- assert_false(tree_empty(&tree),
- "Tree should not be empty");
- assert_ptr_not_null(tree_first(&tree),
- "Tree should not be empty");
- assert_ptr_not_null(tree_last(&tree),
- "Tree should not be empty");
-
- tree_next(&tree, &nodes[k]);
- tree_prev(&tree, &nodes[k]);
- }
-
- /* Remove nodes. */
- switch (i % 5) {
- case 0:
- for (k = 0; k < j; k++)
- node_remove(&tree, &nodes[k], j - k);
- break;
- case 1:
- for (k = j; k > 0; k--)
- node_remove(&tree, &nodes[k-1], k);
- break;
- case 2: {
- node_t *start;
- unsigned nnodes = j;
-
- start = NULL;
- do {
- start = tree_iter(&tree, start,
- remove_iterate_cb, (void *)&nnodes);
- nnodes--;
- } while (start != NULL);
- assert_u_eq(nnodes, 0,
- "Removal terminated early");
- break;
- } case 3: {
- node_t *start;
- unsigned nnodes = j;
-
- start = NULL;
- do {
- start = tree_reverse_iter(&tree, start,
- remove_reverse_iterate_cb,
- (void *)&nnodes);
- nnodes--;
- } while (start != NULL);
- assert_u_eq(nnodes, 0,
- "Removal terminated early");
- break;
- } case 4: {
- unsigned nnodes = j;
- tree_destroy(&tree, destroy_cb, &nnodes);
- assert_u_eq(nnodes, 0,
- "Destruction terminated early");
- break;
- } default:
- not_reached();
- }
- }
- }
- fini_gen_rand(sfmt);
-#undef NNODES
-#undef NBAGS
-#undef SEED
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_rb_empty,
- test_rb_random));
-}
diff --git a/memory/jemalloc/src/test/unit/rtree.c b/memory/jemalloc/src/test/unit/rtree.c
deleted file mode 100644
index b54b3e86f5..0000000000
--- a/memory/jemalloc/src/test/unit/rtree.c
+++ /dev/null
@@ -1,151 +0,0 @@
-#include "test/jemalloc_test.h"
-
-static rtree_node_elm_t *
-node_alloc(size_t nelms)
-{
-
- return ((rtree_node_elm_t *)calloc(nelms, sizeof(rtree_node_elm_t)));
-}
-
-static void
-node_dalloc(rtree_node_elm_t *node)
-{
-
- free(node);
-}
-
-TEST_BEGIN(test_rtree_get_empty)
-{
- unsigned i;
-
- for (i = 1; i <= (sizeof(uintptr_t) << 3); i++) {
- rtree_t rtree;
- assert_false(rtree_new(&rtree, i, node_alloc, node_dalloc),
- "Unexpected rtree_new() failure");
- assert_ptr_null(rtree_get(&rtree, 0, false),
- "rtree_get() should return NULL for empty tree");
- rtree_delete(&rtree);
- }
-}
-TEST_END
-
-TEST_BEGIN(test_rtree_extrema)
-{
- unsigned i;
- extent_node_t node_a, node_b;
-
- for (i = 1; i <= (sizeof(uintptr_t) << 3); i++) {
- rtree_t rtree;
- assert_false(rtree_new(&rtree, i, node_alloc, node_dalloc),
- "Unexpected rtree_new() failure");
-
- assert_false(rtree_set(&rtree, 0, &node_a),
- "Unexpected rtree_set() failure");
- assert_ptr_eq(rtree_get(&rtree, 0, true), &node_a,
- "rtree_get() should return previously set value");
-
- assert_false(rtree_set(&rtree, ~((uintptr_t)0), &node_b),
- "Unexpected rtree_set() failure");
- assert_ptr_eq(rtree_get(&rtree, ~((uintptr_t)0), true), &node_b,
- "rtree_get() should return previously set value");
-
- rtree_delete(&rtree);
- }
-}
-TEST_END
-
-TEST_BEGIN(test_rtree_bits)
-{
- unsigned i, j, k;
-
- for (i = 1; i < (sizeof(uintptr_t) << 3); i++) {
- uintptr_t keys[] = {0, 1,
- (((uintptr_t)1) << (sizeof(uintptr_t)*8-i)) - 1};
- extent_node_t node;
- rtree_t rtree;
-
- assert_false(rtree_new(&rtree, i, node_alloc, node_dalloc),
- "Unexpected rtree_new() failure");
-
- for (j = 0; j < sizeof(keys)/sizeof(uintptr_t); j++) {
- assert_false(rtree_set(&rtree, keys[j], &node),
- "Unexpected rtree_set() failure");
- for (k = 0; k < sizeof(keys)/sizeof(uintptr_t); k++) {
- assert_ptr_eq(rtree_get(&rtree, keys[k], true),
- &node, "rtree_get() should return "
- "previously set value and ignore "
- "insignificant key bits; i=%u, j=%u, k=%u, "
- "set key=%#"FMTxPTR", get key=%#"FMTxPTR, i,
- j, k, keys[j], keys[k]);
- }
- assert_ptr_null(rtree_get(&rtree,
- (((uintptr_t)1) << (sizeof(uintptr_t)*8-i)), false),
- "Only leftmost rtree leaf should be set; "
- "i=%u, j=%u", i, j);
- assert_false(rtree_set(&rtree, keys[j], NULL),
- "Unexpected rtree_set() failure");
- }
-
- rtree_delete(&rtree);
- }
-}
-TEST_END
-
-TEST_BEGIN(test_rtree_random)
-{
- unsigned i;
- sfmt_t *sfmt;
-#define NSET 16
-#define SEED 42
-
- sfmt = init_gen_rand(SEED);
- for (i = 1; i <= (sizeof(uintptr_t) << 3); i++) {
- uintptr_t keys[NSET];
- extent_node_t node;
- unsigned j;
- rtree_t rtree;
-
- assert_false(rtree_new(&rtree, i, node_alloc, node_dalloc),
- "Unexpected rtree_new() failure");
-
- for (j = 0; j < NSET; j++) {
- keys[j] = (uintptr_t)gen_rand64(sfmt);
- assert_false(rtree_set(&rtree, keys[j], &node),
- "Unexpected rtree_set() failure");
- assert_ptr_eq(rtree_get(&rtree, keys[j], true), &node,
- "rtree_get() should return previously set value");
- }
- for (j = 0; j < NSET; j++) {
- assert_ptr_eq(rtree_get(&rtree, keys[j], true), &node,
- "rtree_get() should return previously set value");
- }
-
- for (j = 0; j < NSET; j++) {
- assert_false(rtree_set(&rtree, keys[j], NULL),
- "Unexpected rtree_set() failure");
- assert_ptr_null(rtree_get(&rtree, keys[j], true),
- "rtree_get() should return previously set value");
- }
- for (j = 0; j < NSET; j++) {
- assert_ptr_null(rtree_get(&rtree, keys[j], true),
- "rtree_get() should return previously set value");
- }
-
- rtree_delete(&rtree);
- }
- fini_gen_rand(sfmt);
-#undef NSET
-#undef SEED
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_rtree_get_empty,
- test_rtree_extrema,
- test_rtree_bits,
- test_rtree_random));
-}
diff --git a/memory/jemalloc/src/test/unit/run_quantize.c b/memory/jemalloc/src/test/unit/run_quantize.c
deleted file mode 100644
index b1ca6356dc..0000000000
--- a/memory/jemalloc/src/test/unit/run_quantize.c
+++ /dev/null
@@ -1,149 +0,0 @@
-#include "test/jemalloc_test.h"
-
-TEST_BEGIN(test_small_run_size)
-{
- unsigned nbins, i;
- size_t sz, run_size;
- size_t mib[4];
- size_t miblen = sizeof(mib) / sizeof(size_t);
-
- /*
- * Iterate over all small size classes, get their run sizes, and verify
- * that the quantized size is the same as the run size.
- */
-
- sz = sizeof(unsigned);
- assert_d_eq(mallctl("arenas.nbins", &nbins, &sz, NULL, 0), 0,
- "Unexpected mallctl failure");
-
- assert_d_eq(mallctlnametomib("arenas.bin.0.run_size", mib, &miblen), 0,
- "Unexpected mallctlnametomib failure");
- for (i = 0; i < nbins; i++) {
- mib[2] = i;
- sz = sizeof(size_t);
- assert_d_eq(mallctlbymib(mib, miblen, &run_size, &sz, NULL, 0),
- 0, "Unexpected mallctlbymib failure");
- assert_zu_eq(run_size, run_quantize_floor(run_size),
- "Small run quantization should be a no-op (run_size=%zu)",
- run_size);
- assert_zu_eq(run_size, run_quantize_ceil(run_size),
- "Small run quantization should be a no-op (run_size=%zu)",
- run_size);
- }
-}
-TEST_END
-
-TEST_BEGIN(test_large_run_size)
-{
- bool cache_oblivious;
- unsigned nlruns, i;
- size_t sz, run_size_prev, ceil_prev;
- size_t mib[4];
- size_t miblen = sizeof(mib) / sizeof(size_t);
-
- /*
- * Iterate over all large size classes, get their run sizes, and verify
- * that the quantized size is the same as the run size.
- */
-
- sz = sizeof(bool);
- assert_d_eq(mallctl("config.cache_oblivious", &cache_oblivious, &sz,
- NULL, 0), 0, "Unexpected mallctl failure");
-
- sz = sizeof(unsigned);
- assert_d_eq(mallctl("arenas.nlruns", &nlruns, &sz, NULL, 0), 0,
- "Unexpected mallctl failure");
-
- assert_d_eq(mallctlnametomib("arenas.lrun.0.size", mib, &miblen), 0,
- "Unexpected mallctlnametomib failure");
- for (i = 0; i < nlruns; i++) {
- size_t lrun_size, run_size, floor, ceil;
-
- mib[2] = i;
- sz = sizeof(size_t);
- assert_d_eq(mallctlbymib(mib, miblen, &lrun_size, &sz, NULL, 0),
- 0, "Unexpected mallctlbymib failure");
- run_size = cache_oblivious ? lrun_size + PAGE : lrun_size;
- floor = run_quantize_floor(run_size);
- ceil = run_quantize_ceil(run_size);
-
- assert_zu_eq(run_size, floor,
- "Large run quantization should be a no-op for precise "
- "size (lrun_size=%zu, run_size=%zu)", lrun_size, run_size);
- assert_zu_eq(run_size, ceil,
- "Large run quantization should be a no-op for precise "
- "size (lrun_size=%zu, run_size=%zu)", lrun_size, run_size);
-
- if (i > 0) {
- assert_zu_eq(run_size_prev, run_quantize_floor(run_size
- - PAGE), "Floor should be a precise size");
- if (run_size_prev < ceil_prev) {
- assert_zu_eq(ceil_prev, run_size,
- "Ceiling should be a precise size "
- "(run_size_prev=%zu, ceil_prev=%zu, "
- "run_size=%zu)", run_size_prev, ceil_prev,
- run_size);
- }
- }
- run_size_prev = floor;
- ceil_prev = run_quantize_ceil(run_size + PAGE);
- }
-}
-TEST_END
-
-TEST_BEGIN(test_monotonic)
-{
- unsigned nbins, nlruns, i;
- size_t sz, floor_prev, ceil_prev;
-
- /*
- * Iterate over all run sizes and verify that
- * run_quantize_{floor,ceil}() are monotonic.
- */
-
- sz = sizeof(unsigned);
- assert_d_eq(mallctl("arenas.nbins", &nbins, &sz, NULL, 0), 0,
- "Unexpected mallctl failure");
-
- sz = sizeof(unsigned);
- assert_d_eq(mallctl("arenas.nlruns", &nlruns, &sz, NULL, 0), 0,
- "Unexpected mallctl failure");
-
- floor_prev = 0;
- ceil_prev = 0;
- for (i = 1; i <= chunksize >> LG_PAGE; i++) {
- size_t run_size, floor, ceil;
-
- run_size = i << LG_PAGE;
- floor = run_quantize_floor(run_size);
- ceil = run_quantize_ceil(run_size);
-
- assert_zu_le(floor, run_size,
- "Floor should be <= (floor=%zu, run_size=%zu, ceil=%zu)",
- floor, run_size, ceil);
- assert_zu_ge(ceil, run_size,
- "Ceiling should be >= (floor=%zu, run_size=%zu, ceil=%zu)",
- floor, run_size, ceil);
-
- assert_zu_le(floor_prev, floor, "Floor should be monotonic "
- "(floor_prev=%zu, floor=%zu, run_size=%zu, ceil=%zu)",
- floor_prev, floor, run_size, ceil);
- assert_zu_le(ceil_prev, ceil, "Ceiling should be monotonic "
- "(floor=%zu, run_size=%zu, ceil_prev=%zu, ceil=%zu)",
- floor, run_size, ceil_prev, ceil);
-
- floor_prev = floor;
- ceil_prev = ceil;
- }
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_small_run_size,
- test_large_run_size,
- test_monotonic));
-}
diff --git a/memory/jemalloc/src/test/unit/size_classes.c b/memory/jemalloc/src/test/unit/size_classes.c
deleted file mode 100644
index 4e1e0ce4f6..0000000000
--- a/memory/jemalloc/src/test/unit/size_classes.c
+++ /dev/null
@@ -1,184 +0,0 @@
-#include "test/jemalloc_test.h"
-
-static size_t
-get_max_size_class(void)
-{
- unsigned nhchunks;
- size_t mib[4];
- size_t sz, miblen, max_size_class;
-
- sz = sizeof(unsigned);
- assert_d_eq(mallctl("arenas.nhchunks", &nhchunks, &sz, NULL, 0), 0,
- "Unexpected mallctl() error");
-
- miblen = sizeof(mib) / sizeof(size_t);
- assert_d_eq(mallctlnametomib("arenas.hchunk.0.size", mib, &miblen), 0,
- "Unexpected mallctlnametomib() error");
- mib[2] = nhchunks - 1;
-
- sz = sizeof(size_t);
- assert_d_eq(mallctlbymib(mib, miblen, &max_size_class, &sz, NULL, 0), 0,
- "Unexpected mallctlbymib() error");
-
- return (max_size_class);
-}
-
-TEST_BEGIN(test_size_classes)
-{
- size_t size_class, max_size_class;
- szind_t index, max_index;
-
- max_size_class = get_max_size_class();
- max_index = size2index(max_size_class);
-
- for (index = 0, size_class = index2size(index); index < max_index ||
- size_class < max_size_class; index++, size_class =
- index2size(index)) {
- assert_true(index < max_index,
- "Loop conditionals should be equivalent; index=%u, "
- "size_class=%zu (%#zx)", index, size_class, size_class);
- assert_true(size_class < max_size_class,
- "Loop conditionals should be equivalent; index=%u, "
- "size_class=%zu (%#zx)", index, size_class, size_class);
-
- assert_u_eq(index, size2index(size_class),
- "size2index() does not reverse index2size(): index=%u -->"
- " size_class=%zu --> index=%u --> size_class=%zu", index,
- size_class, size2index(size_class),
- index2size(size2index(size_class)));
- assert_zu_eq(size_class, index2size(size2index(size_class)),
- "index2size() does not reverse size2index(): index=%u -->"
- " size_class=%zu --> index=%u --> size_class=%zu", index,
- size_class, size2index(size_class),
- index2size(size2index(size_class)));
-
- assert_u_eq(index+1, size2index(size_class+1),
- "Next size_class does not round up properly");
-
- assert_zu_eq(size_class, (index > 0) ?
- s2u(index2size(index-1)+1) : s2u(1),
- "s2u() does not round up to size class");
- assert_zu_eq(size_class, s2u(size_class-1),
- "s2u() does not round up to size class");
- assert_zu_eq(size_class, s2u(size_class),
- "s2u() does not compute same size class");
- assert_zu_eq(s2u(size_class+1), index2size(index+1),
- "s2u() does not round up to next size class");
- }
-
- assert_u_eq(index, size2index(index2size(index)),
- "size2index() does not reverse index2size()");
- assert_zu_eq(max_size_class, index2size(size2index(max_size_class)),
- "index2size() does not reverse size2index()");
-
- assert_zu_eq(size_class, s2u(index2size(index-1)+1),
- "s2u() does not round up to size class");
- assert_zu_eq(size_class, s2u(size_class-1),
- "s2u() does not round up to size class");
- assert_zu_eq(size_class, s2u(size_class),
- "s2u() does not compute same size class");
-}
-TEST_END
-
-TEST_BEGIN(test_psize_classes)
-{
- size_t size_class, max_size_class;
- pszind_t pind, max_pind;
-
- max_size_class = get_max_size_class();
- max_pind = psz2ind(max_size_class);
-
- for (pind = 0, size_class = pind2sz(pind); pind < max_pind ||
- size_class < max_size_class; pind++, size_class =
- pind2sz(pind)) {
- assert_true(pind < max_pind,
- "Loop conditionals should be equivalent; pind=%u, "
- "size_class=%zu (%#zx)", pind, size_class, size_class);
- assert_true(size_class < max_size_class,
- "Loop conditionals should be equivalent; pind=%u, "
- "size_class=%zu (%#zx)", pind, size_class, size_class);
-
- assert_u_eq(pind, psz2ind(size_class),
- "psz2ind() does not reverse pind2sz(): pind=%u -->"
- " size_class=%zu --> pind=%u --> size_class=%zu", pind,
- size_class, psz2ind(size_class),
- pind2sz(psz2ind(size_class)));
- assert_zu_eq(size_class, pind2sz(psz2ind(size_class)),
- "pind2sz() does not reverse psz2ind(): pind=%u -->"
- " size_class=%zu --> pind=%u --> size_class=%zu", pind,
- size_class, psz2ind(size_class),
- pind2sz(psz2ind(size_class)));
-
- assert_u_eq(pind+1, psz2ind(size_class+1),
- "Next size_class does not round up properly");
-
- assert_zu_eq(size_class, (pind > 0) ?
- psz2u(pind2sz(pind-1)+1) : psz2u(1),
- "psz2u() does not round up to size class");
- assert_zu_eq(size_class, psz2u(size_class-1),
- "psz2u() does not round up to size class");
- assert_zu_eq(size_class, psz2u(size_class),
- "psz2u() does not compute same size class");
- assert_zu_eq(psz2u(size_class+1), pind2sz(pind+1),
- "psz2u() does not round up to next size class");
- }
-
- assert_u_eq(pind, psz2ind(pind2sz(pind)),
- "psz2ind() does not reverse pind2sz()");
- assert_zu_eq(max_size_class, pind2sz(psz2ind(max_size_class)),
- "pind2sz() does not reverse psz2ind()");
-
- assert_zu_eq(size_class, psz2u(pind2sz(pind-1)+1),
- "psz2u() does not round up to size class");
- assert_zu_eq(size_class, psz2u(size_class-1),
- "psz2u() does not round up to size class");
- assert_zu_eq(size_class, psz2u(size_class),
- "psz2u() does not compute same size class");
-}
-TEST_END
-
-TEST_BEGIN(test_overflow)
-{
- size_t max_size_class;
-
- max_size_class = get_max_size_class();
-
- assert_u_eq(size2index(max_size_class+1), NSIZES,
- "size2index() should return NSIZES on overflow");
- assert_u_eq(size2index(ZU(PTRDIFF_MAX)+1), NSIZES,
- "size2index() should return NSIZES on overflow");
- assert_u_eq(size2index(SIZE_T_MAX), NSIZES,
- "size2index() should return NSIZES on overflow");
-
- assert_zu_eq(s2u(max_size_class+1), 0,
- "s2u() should return 0 for unsupported size");
- assert_zu_eq(s2u(ZU(PTRDIFF_MAX)+1), 0,
- "s2u() should return 0 for unsupported size");
- assert_zu_eq(s2u(SIZE_T_MAX), 0,
- "s2u() should return 0 on overflow");
-
- assert_u_eq(psz2ind(max_size_class+1), NPSIZES,
- "psz2ind() should return NPSIZES on overflow");
- assert_u_eq(psz2ind(ZU(PTRDIFF_MAX)+1), NPSIZES,
- "psz2ind() should return NPSIZES on overflow");
- assert_u_eq(psz2ind(SIZE_T_MAX), NPSIZES,
- "psz2ind() should return NPSIZES on overflow");
-
- assert_zu_eq(psz2u(max_size_class+1), 0,
- "psz2u() should return 0 for unsupported size");
- assert_zu_eq(psz2u(ZU(PTRDIFF_MAX)+1), 0,
- "psz2u() should return 0 for unsupported size");
- assert_zu_eq(psz2u(SIZE_T_MAX), 0,
- "psz2u() should return 0 on overflow");
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_size_classes,
- test_psize_classes,
- test_overflow));
-}
diff --git a/memory/jemalloc/src/test/unit/smoothstep.c b/memory/jemalloc/src/test/unit/smoothstep.c
deleted file mode 100644
index 4cfb213435..0000000000
--- a/memory/jemalloc/src/test/unit/smoothstep.c
+++ /dev/null
@@ -1,106 +0,0 @@
-#include "test/jemalloc_test.h"
-
-static const uint64_t smoothstep_tab[] = {
-#define STEP(step, h, x, y) \
- h,
- SMOOTHSTEP
-#undef STEP
-};
-
-TEST_BEGIN(test_smoothstep_integral)
-{
- uint64_t sum, min, max;
- unsigned i;
-
- /*
- * The integral of smoothstep in the [0..1] range equals 1/2. Verify
- * that the fixed point representation's integral is no more than
- * rounding error distant from 1/2. Regarding rounding, each table
- * element is rounded down to the nearest fixed point value, so the
- * integral may be off by as much as SMOOTHSTEP_NSTEPS ulps.
- */
- sum = 0;
- for (i = 0; i < SMOOTHSTEP_NSTEPS; i++)
- sum += smoothstep_tab[i];
-
- max = (KQU(1) << (SMOOTHSTEP_BFP-1)) * (SMOOTHSTEP_NSTEPS+1);
- min = max - SMOOTHSTEP_NSTEPS;
-
- assert_u64_ge(sum, min,
- "Integral too small, even accounting for truncation");
- assert_u64_le(sum, max, "Integral exceeds 1/2");
- if (false) {
- malloc_printf("%"FMTu64" ulps under 1/2 (limit %d)\n",
- max - sum, SMOOTHSTEP_NSTEPS);
- }
-}
-TEST_END
-
-TEST_BEGIN(test_smoothstep_monotonic)
-{
- uint64_t prev_h;
- unsigned i;
-
- /*
- * The smoothstep function is monotonic in [0..1], i.e. its slope is
- * non-negative. In practice we want to parametrize table generation
- * such that piecewise slope is greater than zero, but do not require
- * that here.
- */
- prev_h = 0;
- for (i = 0; i < SMOOTHSTEP_NSTEPS; i++) {
- uint64_t h = smoothstep_tab[i];
- assert_u64_ge(h, prev_h, "Piecewise non-monotonic, i=%u", i);
- prev_h = h;
- }
- assert_u64_eq(smoothstep_tab[SMOOTHSTEP_NSTEPS-1],
- (KQU(1) << SMOOTHSTEP_BFP), "Last step must equal 1");
-}
-TEST_END
-
-TEST_BEGIN(test_smoothstep_slope)
-{
- uint64_t prev_h, prev_delta;
- unsigned i;
-
- /*
- * The smoothstep slope strictly increases until x=0.5, and then
- * strictly decreases until x=1.0. Verify the slightly weaker
- * requirement of monotonicity, so that inadequate table precision does
- * not cause false test failures.
- */
- prev_h = 0;
- prev_delta = 0;
- for (i = 0; i < SMOOTHSTEP_NSTEPS / 2 + SMOOTHSTEP_NSTEPS % 2; i++) {
- uint64_t h = smoothstep_tab[i];
- uint64_t delta = h - prev_h;
- assert_u64_ge(delta, prev_delta,
- "Slope must monotonically increase in 0.0 <= x <= 0.5, "
- "i=%u", i);
- prev_h = h;
- prev_delta = delta;
- }
-
- prev_h = KQU(1) << SMOOTHSTEP_BFP;
- prev_delta = 0;
- for (i = SMOOTHSTEP_NSTEPS-1; i >= SMOOTHSTEP_NSTEPS / 2; i--) {
- uint64_t h = smoothstep_tab[i];
- uint64_t delta = prev_h - h;
- assert_u64_ge(delta, prev_delta,
- "Slope must monotonically decrease in 0.5 <= x <= 1.0, "
- "i=%u", i);
- prev_h = h;
- prev_delta = delta;
- }
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_smoothstep_integral,
- test_smoothstep_monotonic,
- test_smoothstep_slope));
-}
diff --git a/memory/jemalloc/src/test/unit/stats.c b/memory/jemalloc/src/test/unit/stats.c
deleted file mode 100644
index a9a3981fbe..0000000000
--- a/memory/jemalloc/src/test/unit/stats.c
+++ /dev/null
@@ -1,447 +0,0 @@
-#include "test/jemalloc_test.h"
-
-TEST_BEGIN(test_stats_summary)
-{
- size_t *cactive;
- size_t sz, allocated, active, resident, mapped;
- int expected = config_stats ? 0 : ENOENT;
-
- sz = sizeof(cactive);
- assert_d_eq(mallctl("stats.cactive", &cactive, &sz, NULL, 0), expected,
- "Unexpected mallctl() result");
-
- sz = sizeof(size_t);
- assert_d_eq(mallctl("stats.allocated", &allocated, &sz, NULL, 0),
- expected, "Unexpected mallctl() result");
- assert_d_eq(mallctl("stats.active", &active, &sz, NULL, 0), expected,
- "Unexpected mallctl() result");
- assert_d_eq(mallctl("stats.resident", &resident, &sz, NULL, 0),
- expected, "Unexpected mallctl() result");
- assert_d_eq(mallctl("stats.mapped", &mapped, &sz, NULL, 0), expected,
- "Unexpected mallctl() result");
-
- if (config_stats) {
- assert_zu_le(active, *cactive,
- "active should be no larger than cactive");
- assert_zu_le(allocated, active,
- "allocated should be no larger than active");
- assert_zu_lt(active, resident,
- "active should be less than resident");
- assert_zu_lt(active, mapped,
- "active should be less than mapped");
- }
-}
-TEST_END
-
-TEST_BEGIN(test_stats_huge)
-{
- void *p;
- uint64_t epoch;
- size_t allocated;
- uint64_t nmalloc, ndalloc, nrequests;
- size_t sz;
- int expected = config_stats ? 0 : ENOENT;
-
- p = mallocx(large_maxclass+1, 0);
- assert_ptr_not_null(p, "Unexpected mallocx() failure");
-
- assert_d_eq(mallctl("epoch", NULL, NULL, &epoch, sizeof(epoch)), 0,
- "Unexpected mallctl() failure");
-
- sz = sizeof(size_t);
- assert_d_eq(mallctl("stats.arenas.0.huge.allocated", &allocated, &sz,
- NULL, 0), expected, "Unexpected mallctl() result");
- sz = sizeof(uint64_t);
- assert_d_eq(mallctl("stats.arenas.0.huge.nmalloc", &nmalloc, &sz, NULL,
- 0), expected, "Unexpected mallctl() result");
- assert_d_eq(mallctl("stats.arenas.0.huge.ndalloc", &ndalloc, &sz, NULL,
- 0), expected, "Unexpected mallctl() result");
- assert_d_eq(mallctl("stats.arenas.0.huge.nrequests", &nrequests, &sz,
- NULL, 0), expected, "Unexpected mallctl() result");
-
- if (config_stats) {
- assert_zu_gt(allocated, 0,
- "allocated should be greater than zero");
- assert_u64_ge(nmalloc, ndalloc,
- "nmalloc should be at least as large as ndalloc");
- assert_u64_le(nmalloc, nrequests,
- "nmalloc should no larger than nrequests");
- }
-
- dallocx(p, 0);
-}
-TEST_END
-
-TEST_BEGIN(test_stats_arenas_summary)
-{
- unsigned arena;
- void *little, *large, *huge;
- uint64_t epoch;
- size_t sz;
- int expected = config_stats ? 0 : ENOENT;
- size_t mapped;
- uint64_t npurge, nmadvise, purged;
-
- arena = 0;
- assert_d_eq(mallctl("thread.arena", NULL, NULL, &arena, sizeof(arena)),
- 0, "Unexpected mallctl() failure");
-
- little = mallocx(SMALL_MAXCLASS, 0);
- assert_ptr_not_null(little, "Unexpected mallocx() failure");
- large = mallocx(large_maxclass, 0);
- assert_ptr_not_null(large, "Unexpected mallocx() failure");
- huge = mallocx(chunksize, 0);
- assert_ptr_not_null(huge, "Unexpected mallocx() failure");
-
- dallocx(little, 0);
- dallocx(large, 0);
- dallocx(huge, 0);
-
- assert_d_eq(mallctl("arena.0.purge", NULL, NULL, NULL, 0), 0,
- "Unexpected mallctl() failure");
-
- assert_d_eq(mallctl("epoch", NULL, NULL, &epoch, sizeof(epoch)), 0,
- "Unexpected mallctl() failure");
-
- sz = sizeof(size_t);
- assert_d_eq(mallctl("stats.arenas.0.mapped", &mapped, &sz, NULL, 0),
- expected, "Unexepected mallctl() result");
- sz = sizeof(uint64_t);
- assert_d_eq(mallctl("stats.arenas.0.npurge", &npurge, &sz, NULL, 0),
- expected, "Unexepected mallctl() result");
- assert_d_eq(mallctl("stats.arenas.0.nmadvise", &nmadvise, &sz, NULL, 0),
- expected, "Unexepected mallctl() result");
- assert_d_eq(mallctl("stats.arenas.0.purged", &purged, &sz, NULL, 0),
- expected, "Unexepected mallctl() result");
-
- if (config_stats) {
- assert_u64_gt(npurge, 0,
- "At least one purge should have occurred");
- assert_u64_le(nmadvise, purged,
- "nmadvise should be no greater than purged");
- }
-}
-TEST_END
-
-void *
-thd_start(void *arg)
-{
-
- return (NULL);
-}
-
-static void
-no_lazy_lock(void)
-{
- thd_t thd;
-
- thd_create(&thd, thd_start, NULL);
- thd_join(thd, NULL);
-}
-
-TEST_BEGIN(test_stats_arenas_small)
-{
- unsigned arena;
- void *p;
- size_t sz, allocated;
- uint64_t epoch, nmalloc, ndalloc, nrequests;
- int expected = config_stats ? 0 : ENOENT;
-
- no_lazy_lock(); /* Lazy locking would dodge tcache testing. */
-
- arena = 0;
- assert_d_eq(mallctl("thread.arena", NULL, NULL, &arena, sizeof(arena)),
- 0, "Unexpected mallctl() failure");
-
- p = mallocx(SMALL_MAXCLASS, 0);
- assert_ptr_not_null(p, "Unexpected mallocx() failure");
-
- assert_d_eq(mallctl("thread.tcache.flush", NULL, NULL, NULL, 0),
- config_tcache ? 0 : ENOENT, "Unexpected mallctl() result");
-
- assert_d_eq(mallctl("epoch", NULL, NULL, &epoch, sizeof(epoch)), 0,
- "Unexpected mallctl() failure");
-
- sz = sizeof(size_t);
- assert_d_eq(mallctl("stats.arenas.0.small.allocated", &allocated, &sz,
- NULL, 0), expected, "Unexpected mallctl() result");
- sz = sizeof(uint64_t);
- assert_d_eq(mallctl("stats.arenas.0.small.nmalloc", &nmalloc, &sz,
- NULL, 0), expected, "Unexpected mallctl() result");
- assert_d_eq(mallctl("stats.arenas.0.small.ndalloc", &ndalloc, &sz,
- NULL, 0), expected, "Unexpected mallctl() result");
- assert_d_eq(mallctl("stats.arenas.0.small.nrequests", &nrequests, &sz,
- NULL, 0), expected, "Unexpected mallctl() result");
-
- if (config_stats) {
- assert_zu_gt(allocated, 0,
- "allocated should be greater than zero");
- assert_u64_gt(nmalloc, 0,
- "nmalloc should be no greater than zero");
- assert_u64_ge(nmalloc, ndalloc,
- "nmalloc should be at least as large as ndalloc");
- assert_u64_gt(nrequests, 0,
- "nrequests should be greater than zero");
- }
-
- dallocx(p, 0);
-}
-TEST_END
-
-TEST_BEGIN(test_stats_arenas_large)
-{
- unsigned arena;
- void *p;
- size_t sz, allocated;
- uint64_t epoch, nmalloc, ndalloc, nrequests;
- int expected = config_stats ? 0 : ENOENT;
-
- arena = 0;
- assert_d_eq(mallctl("thread.arena", NULL, NULL, &arena, sizeof(arena)),
- 0, "Unexpected mallctl() failure");
-
- p = mallocx(large_maxclass, 0);
- assert_ptr_not_null(p, "Unexpected mallocx() failure");
-
- assert_d_eq(mallctl("epoch", NULL, NULL, &epoch, sizeof(epoch)), 0,
- "Unexpected mallctl() failure");
-
- sz = sizeof(size_t);
- assert_d_eq(mallctl("stats.arenas.0.large.allocated", &allocated, &sz,
- NULL, 0), expected, "Unexpected mallctl() result");
- sz = sizeof(uint64_t);
- assert_d_eq(mallctl("stats.arenas.0.large.nmalloc", &nmalloc, &sz,
- NULL, 0), expected, "Unexpected mallctl() result");
- assert_d_eq(mallctl("stats.arenas.0.large.ndalloc", &ndalloc, &sz,
- NULL, 0), expected, "Unexpected mallctl() result");
- assert_d_eq(mallctl("stats.arenas.0.large.nrequests", &nrequests, &sz,
- NULL, 0), expected, "Unexpected mallctl() result");
-
- if (config_stats) {
- assert_zu_gt(allocated, 0,
- "allocated should be greater than zero");
- assert_u64_gt(nmalloc, 0,
- "nmalloc should be greater than zero");
- assert_u64_ge(nmalloc, ndalloc,
- "nmalloc should be at least as large as ndalloc");
- assert_u64_gt(nrequests, 0,
- "nrequests should be greater than zero");
- }
-
- dallocx(p, 0);
-}
-TEST_END
-
-TEST_BEGIN(test_stats_arenas_huge)
-{
- unsigned arena;
- void *p;
- size_t sz, allocated;
- uint64_t epoch, nmalloc, ndalloc;
- int expected = config_stats ? 0 : ENOENT;
-
- arena = 0;
- assert_d_eq(mallctl("thread.arena", NULL, NULL, &arena, sizeof(arena)),
- 0, "Unexpected mallctl() failure");
-
- p = mallocx(chunksize, 0);
- assert_ptr_not_null(p, "Unexpected mallocx() failure");
-
- assert_d_eq(mallctl("epoch", NULL, NULL, &epoch, sizeof(epoch)), 0,
- "Unexpected mallctl() failure");
-
- sz = sizeof(size_t);
- assert_d_eq(mallctl("stats.arenas.0.huge.allocated", &allocated, &sz,
- NULL, 0), expected, "Unexpected mallctl() result");
- sz = sizeof(uint64_t);
- assert_d_eq(mallctl("stats.arenas.0.huge.nmalloc", &nmalloc, &sz,
- NULL, 0), expected, "Unexpected mallctl() result");
- assert_d_eq(mallctl("stats.arenas.0.huge.ndalloc", &ndalloc, &sz,
- NULL, 0), expected, "Unexpected mallctl() result");
-
- if (config_stats) {
- assert_zu_gt(allocated, 0,
- "allocated should be greater than zero");
- assert_u64_gt(nmalloc, 0,
- "nmalloc should be greater than zero");
- assert_u64_ge(nmalloc, ndalloc,
- "nmalloc should be at least as large as ndalloc");
- }
-
- dallocx(p, 0);
-}
-TEST_END
-
-TEST_BEGIN(test_stats_arenas_bins)
-{
- unsigned arena;
- void *p;
- size_t sz, curruns, curregs;
- uint64_t epoch, nmalloc, ndalloc, nrequests, nfills, nflushes;
- uint64_t nruns, nreruns;
- int expected = config_stats ? 0 : ENOENT;
-
- arena = 0;
- assert_d_eq(mallctl("thread.arena", NULL, NULL, &arena, sizeof(arena)),
- 0, "Unexpected mallctl() failure");
-
- p = mallocx(arena_bin_info[0].reg_size, 0);
- assert_ptr_not_null(p, "Unexpected mallocx() failure");
-
- assert_d_eq(mallctl("thread.tcache.flush", NULL, NULL, NULL, 0),
- config_tcache ? 0 : ENOENT, "Unexpected mallctl() result");
-
- assert_d_eq(mallctl("epoch", NULL, NULL, &epoch, sizeof(epoch)), 0,
- "Unexpected mallctl() failure");
-
- sz = sizeof(uint64_t);
- assert_d_eq(mallctl("stats.arenas.0.bins.0.nmalloc", &nmalloc, &sz,
- NULL, 0), expected, "Unexpected mallctl() result");
- assert_d_eq(mallctl("stats.arenas.0.bins.0.ndalloc", &ndalloc, &sz,
- NULL, 0), expected, "Unexpected mallctl() result");
- assert_d_eq(mallctl("stats.arenas.0.bins.0.nrequests", &nrequests, &sz,
- NULL, 0), expected, "Unexpected mallctl() result");
- sz = sizeof(size_t);
- assert_d_eq(mallctl("stats.arenas.0.bins.0.curregs", &curregs, &sz,
- NULL, 0), expected, "Unexpected mallctl() result");
-
- sz = sizeof(uint64_t);
- assert_d_eq(mallctl("stats.arenas.0.bins.0.nfills", &nfills, &sz,
- NULL, 0), config_tcache ? expected : ENOENT,
- "Unexpected mallctl() result");
- assert_d_eq(mallctl("stats.arenas.0.bins.0.nflushes", &nflushes, &sz,
- NULL, 0), config_tcache ? expected : ENOENT,
- "Unexpected mallctl() result");
-
- assert_d_eq(mallctl("stats.arenas.0.bins.0.nruns", &nruns, &sz,
- NULL, 0), expected, "Unexpected mallctl() result");
- assert_d_eq(mallctl("stats.arenas.0.bins.0.nreruns", &nreruns, &sz,
- NULL, 0), expected, "Unexpected mallctl() result");
- sz = sizeof(size_t);
- assert_d_eq(mallctl("stats.arenas.0.bins.0.curruns", &curruns, &sz,
- NULL, 0), expected, "Unexpected mallctl() result");
-
- if (config_stats) {
- assert_u64_gt(nmalloc, 0,
- "nmalloc should be greater than zero");
- assert_u64_ge(nmalloc, ndalloc,
- "nmalloc should be at least as large as ndalloc");
- assert_u64_gt(nrequests, 0,
- "nrequests should be greater than zero");
- assert_zu_gt(curregs, 0,
- "allocated should be greater than zero");
- if (config_tcache) {
- assert_u64_gt(nfills, 0,
- "At least one fill should have occurred");
- assert_u64_gt(nflushes, 0,
- "At least one flush should have occurred");
- }
- assert_u64_gt(nruns, 0,
- "At least one run should have been allocated");
- assert_zu_gt(curruns, 0,
- "At least one run should be currently allocated");
- }
-
- dallocx(p, 0);
-}
-TEST_END
-
-TEST_BEGIN(test_stats_arenas_lruns)
-{
- unsigned arena;
- void *p;
- uint64_t epoch, nmalloc, ndalloc, nrequests;
- size_t curruns, sz;
- int expected = config_stats ? 0 : ENOENT;
-
- arena = 0;
- assert_d_eq(mallctl("thread.arena", NULL, NULL, &arena, sizeof(arena)),
- 0, "Unexpected mallctl() failure");
-
- p = mallocx(LARGE_MINCLASS, 0);
- assert_ptr_not_null(p, "Unexpected mallocx() failure");
-
- assert_d_eq(mallctl("epoch", NULL, NULL, &epoch, sizeof(epoch)), 0,
- "Unexpected mallctl() failure");
-
- sz = sizeof(uint64_t);
- assert_d_eq(mallctl("stats.arenas.0.lruns.0.nmalloc", &nmalloc, &sz,
- NULL, 0), expected, "Unexpected mallctl() result");
- assert_d_eq(mallctl("stats.arenas.0.lruns.0.ndalloc", &ndalloc, &sz,
- NULL, 0), expected, "Unexpected mallctl() result");
- assert_d_eq(mallctl("stats.arenas.0.lruns.0.nrequests", &nrequests, &sz,
- NULL, 0), expected, "Unexpected mallctl() result");
- sz = sizeof(size_t);
- assert_d_eq(mallctl("stats.arenas.0.lruns.0.curruns", &curruns, &sz,
- NULL, 0), expected, "Unexpected mallctl() result");
-
- if (config_stats) {
- assert_u64_gt(nmalloc, 0,
- "nmalloc should be greater than zero");
- assert_u64_ge(nmalloc, ndalloc,
- "nmalloc should be at least as large as ndalloc");
- assert_u64_gt(nrequests, 0,
- "nrequests should be greater than zero");
- assert_u64_gt(curruns, 0,
- "At least one run should be currently allocated");
- }
-
- dallocx(p, 0);
-}
-TEST_END
-
-TEST_BEGIN(test_stats_arenas_hchunks)
-{
- unsigned arena;
- void *p;
- uint64_t epoch, nmalloc, ndalloc;
- size_t curhchunks, sz;
- int expected = config_stats ? 0 : ENOENT;
-
- arena = 0;
- assert_d_eq(mallctl("thread.arena", NULL, NULL, &arena, sizeof(arena)),
- 0, "Unexpected mallctl() failure");
-
- p = mallocx(chunksize, 0);
- assert_ptr_not_null(p, "Unexpected mallocx() failure");
-
- assert_d_eq(mallctl("epoch", NULL, NULL, &epoch, sizeof(epoch)), 0,
- "Unexpected mallctl() failure");
-
- sz = sizeof(uint64_t);
- assert_d_eq(mallctl("stats.arenas.0.hchunks.0.nmalloc", &nmalloc, &sz,
- NULL, 0), expected, "Unexpected mallctl() result");
- assert_d_eq(mallctl("stats.arenas.0.hchunks.0.ndalloc", &ndalloc, &sz,
- NULL, 0), expected, "Unexpected mallctl() result");
- sz = sizeof(size_t);
- assert_d_eq(mallctl("stats.arenas.0.hchunks.0.curhchunks", &curhchunks,
- &sz, NULL, 0), expected, "Unexpected mallctl() result");
-
- if (config_stats) {
- assert_u64_gt(nmalloc, 0,
- "nmalloc should be greater than zero");
- assert_u64_ge(nmalloc, ndalloc,
- "nmalloc should be at least as large as ndalloc");
- assert_u64_gt(curhchunks, 0,
- "At least one chunk should be currently allocated");
- }
-
- dallocx(p, 0);
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_stats_summary,
- test_stats_huge,
- test_stats_arenas_summary,
- test_stats_arenas_small,
- test_stats_arenas_large,
- test_stats_arenas_huge,
- test_stats_arenas_bins,
- test_stats_arenas_lruns,
- test_stats_arenas_hchunks));
-}
diff --git a/memory/jemalloc/src/test/unit/ticker.c b/memory/jemalloc/src/test/unit/ticker.c
deleted file mode 100644
index e737020abd..0000000000
--- a/memory/jemalloc/src/test/unit/ticker.c
+++ /dev/null
@@ -1,76 +0,0 @@
-#include "test/jemalloc_test.h"
-
-TEST_BEGIN(test_ticker_tick)
-{
-#define NREPS 2
-#define NTICKS 3
- ticker_t ticker;
- int32_t i, j;
-
- ticker_init(&ticker, NTICKS);
- for (i = 0; i < NREPS; i++) {
- for (j = 0; j < NTICKS; j++) {
- assert_u_eq(ticker_read(&ticker), NTICKS - j,
- "Unexpected ticker value (i=%d, j=%d)", i, j);
- assert_false(ticker_tick(&ticker),
- "Unexpected ticker fire (i=%d, j=%d)", i, j);
- }
- assert_u32_eq(ticker_read(&ticker), 0,
- "Expected ticker depletion");
- assert_true(ticker_tick(&ticker),
- "Expected ticker fire (i=%d)", i);
- assert_u32_eq(ticker_read(&ticker), NTICKS,
- "Expected ticker reset");
- }
-#undef NTICKS
-}
-TEST_END
-
-TEST_BEGIN(test_ticker_ticks)
-{
-#define NTICKS 3
- ticker_t ticker;
-
- ticker_init(&ticker, NTICKS);
-
- assert_u_eq(ticker_read(&ticker), NTICKS, "Unexpected ticker value");
- assert_false(ticker_ticks(&ticker, NTICKS), "Unexpected ticker fire");
- assert_u_eq(ticker_read(&ticker), 0, "Unexpected ticker value");
- assert_true(ticker_ticks(&ticker, NTICKS), "Expected ticker fire");
- assert_u_eq(ticker_read(&ticker), NTICKS, "Unexpected ticker value");
-
- assert_true(ticker_ticks(&ticker, NTICKS + 1), "Expected ticker fire");
- assert_u_eq(ticker_read(&ticker), NTICKS, "Unexpected ticker value");
-#undef NTICKS
-}
-TEST_END
-
-TEST_BEGIN(test_ticker_copy)
-{
-#define NTICKS 3
- ticker_t ta, tb;
-
- ticker_init(&ta, NTICKS);
- ticker_copy(&tb, &ta);
- assert_u_eq(ticker_read(&tb), NTICKS, "Unexpected ticker value");
- assert_true(ticker_ticks(&tb, NTICKS + 1), "Expected ticker fire");
- assert_u_eq(ticker_read(&tb), NTICKS, "Unexpected ticker value");
-
- ticker_tick(&ta);
- ticker_copy(&tb, &ta);
- assert_u_eq(ticker_read(&tb), NTICKS - 1, "Unexpected ticker value");
- assert_true(ticker_ticks(&tb, NTICKS), "Expected ticker fire");
- assert_u_eq(ticker_read(&tb), NTICKS, "Unexpected ticker value");
-#undef NTICKS
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_ticker_tick,
- test_ticker_ticks,
- test_ticker_copy));
-}
diff --git a/memory/jemalloc/src/test/unit/tsd.c b/memory/jemalloc/src/test/unit/tsd.c
deleted file mode 100644
index 4e2622a34e..0000000000
--- a/memory/jemalloc/src/test/unit/tsd.c
+++ /dev/null
@@ -1,112 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#define THREAD_DATA 0x72b65c10
-
-typedef unsigned int data_t;
-
-static bool data_cleanup_executed;
-
-malloc_tsd_types(data_, data_t)
-malloc_tsd_protos(, data_, data_t)
-
-void
-data_cleanup(void *arg)
-{
- data_t *data = (data_t *)arg;
-
- if (!data_cleanup_executed) {
- assert_x_eq(*data, THREAD_DATA,
- "Argument passed into cleanup function should match tsd "
- "value");
- }
- data_cleanup_executed = true;
-
- /*
- * Allocate during cleanup for two rounds, in order to assure that
- * jemalloc's internal tsd reinitialization happens.
- */
- switch (*data) {
- case THREAD_DATA:
- *data = 1;
- data_tsd_set(data);
- break;
- case 1:
- *data = 2;
- data_tsd_set(data);
- break;
- case 2:
- return;
- default:
- not_reached();
- }
-
- {
- void *p = mallocx(1, 0);
- assert_ptr_not_null(p, "Unexpeced mallocx() failure");
- dallocx(p, 0);
- }
-}
-
-malloc_tsd_externs(data_, data_t)
-#define DATA_INIT 0x12345678
-malloc_tsd_data(, data_, data_t, DATA_INIT)
-malloc_tsd_funcs(, data_, data_t, DATA_INIT, data_cleanup)
-
-static void *
-thd_start(void *arg)
-{
- data_t d = (data_t)(uintptr_t)arg;
- void *p;
-
- assert_x_eq(*data_tsd_get(true), DATA_INIT,
- "Initial tsd get should return initialization value");
-
- p = malloc(1);
- assert_ptr_not_null(p, "Unexpected malloc() failure");
-
- data_tsd_set(&d);
- assert_x_eq(*data_tsd_get(true), d,
- "After tsd set, tsd get should return value that was set");
-
- d = 0;
- assert_x_eq(*data_tsd_get(true), (data_t)(uintptr_t)arg,
- "Resetting local data should have no effect on tsd");
-
- free(p);
- return (NULL);
-}
-
-TEST_BEGIN(test_tsd_main_thread)
-{
-
- thd_start((void *) 0xa5f3e329);
-}
-TEST_END
-
-TEST_BEGIN(test_tsd_sub_thread)
-{
- thd_t thd;
-
- data_cleanup_executed = false;
- thd_create(&thd, thd_start, (void *)THREAD_DATA);
- thd_join(thd, NULL);
- assert_true(data_cleanup_executed,
- "Cleanup function should have executed");
-}
-TEST_END
-
-int
-main(void)
-{
-
- /* Core tsd bootstrapping must happen prior to data_tsd_boot(). */
- if (nallocx(1, 0) == 0) {
- malloc_printf("Initialization error");
- return (test_status_fail);
- }
- data_tsd_boot();
-
- return (test(
- test_tsd_main_thread,
- test_tsd_sub_thread));
-}
diff --git a/memory/jemalloc/src/test/unit/util.c b/memory/jemalloc/src/test/unit/util.c
deleted file mode 100644
index c958dc0fba..0000000000
--- a/memory/jemalloc/src/test/unit/util.c
+++ /dev/null
@@ -1,317 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#define TEST_POW2_CEIL(t, suf, pri) do { \
- unsigned i, pow2; \
- t x; \
- \
- assert_##suf##_eq(pow2_ceil_##suf(0), 0, "Unexpected result"); \
- \
- for (i = 0; i < sizeof(t) * 8; i++) { \
- assert_##suf##_eq(pow2_ceil_##suf(((t)1) << i), ((t)1) \
- << i, "Unexpected result"); \
- } \
- \
- for (i = 2; i < sizeof(t) * 8; i++) { \
- assert_##suf##_eq(pow2_ceil_##suf((((t)1) << i) - 1), \
- ((t)1) << i, "Unexpected result"); \
- } \
- \
- for (i = 0; i < sizeof(t) * 8 - 1; i++) { \
- assert_##suf##_eq(pow2_ceil_##suf((((t)1) << i) + 1), \
- ((t)1) << (i+1), "Unexpected result"); \
- } \
- \
- for (pow2 = 1; pow2 < 25; pow2++) { \
- for (x = (((t)1) << (pow2-1)) + 1; x <= ((t)1) << pow2; \
- x++) { \
- assert_##suf##_eq(pow2_ceil_##suf(x), \
- ((t)1) << pow2, \
- "Unexpected result, x=%"pri, x); \
- } \
- } \
-} while (0)
-
-TEST_BEGIN(test_pow2_ceil_u64)
-{
-
- TEST_POW2_CEIL(uint64_t, u64, FMTu64);
-}
-TEST_END
-
-TEST_BEGIN(test_pow2_ceil_u32)
-{
-
- TEST_POW2_CEIL(uint32_t, u32, FMTu32);
-}
-TEST_END
-
-TEST_BEGIN(test_pow2_ceil_zu)
-{
-
- TEST_POW2_CEIL(size_t, zu, "zu");
-}
-TEST_END
-
-TEST_BEGIN(test_malloc_strtoumax_no_endptr)
-{
- int err;
-
- set_errno(0);
- assert_ju_eq(malloc_strtoumax("0", NULL, 0), 0, "Unexpected result");
- err = get_errno();
- assert_d_eq(err, 0, "Unexpected failure");
-}
-TEST_END
-
-TEST_BEGIN(test_malloc_strtoumax)
-{
- struct test_s {
- const char *input;
- const char *expected_remainder;
- int base;
- int expected_errno;
- const char *expected_errno_name;
- uintmax_t expected_x;
- };
-#define ERR(e) e, #e
-#define KUMAX(x) ((uintmax_t)x##ULL)
- struct test_s tests[] = {
- {"0", "0", -1, ERR(EINVAL), UINTMAX_MAX},
- {"0", "0", 1, ERR(EINVAL), UINTMAX_MAX},
- {"0", "0", 37, ERR(EINVAL), UINTMAX_MAX},
-
- {"", "", 0, ERR(EINVAL), UINTMAX_MAX},
- {"+", "+", 0, ERR(EINVAL), UINTMAX_MAX},
- {"++3", "++3", 0, ERR(EINVAL), UINTMAX_MAX},
- {"-", "-", 0, ERR(EINVAL), UINTMAX_MAX},
-
- {"42", "", 0, ERR(0), KUMAX(42)},
- {"+42", "", 0, ERR(0), KUMAX(42)},
- {"-42", "", 0, ERR(0), KUMAX(-42)},
- {"042", "", 0, ERR(0), KUMAX(042)},
- {"+042", "", 0, ERR(0), KUMAX(042)},
- {"-042", "", 0, ERR(0), KUMAX(-042)},
- {"0x42", "", 0, ERR(0), KUMAX(0x42)},
- {"+0x42", "", 0, ERR(0), KUMAX(0x42)},
- {"-0x42", "", 0, ERR(0), KUMAX(-0x42)},
-
- {"0", "", 0, ERR(0), KUMAX(0)},
- {"1", "", 0, ERR(0), KUMAX(1)},
-
- {"42", "", 0, ERR(0), KUMAX(42)},
- {" 42", "", 0, ERR(0), KUMAX(42)},
- {"42 ", " ", 0, ERR(0), KUMAX(42)},
- {"0x", "x", 0, ERR(0), KUMAX(0)},
- {"42x", "x", 0, ERR(0), KUMAX(42)},
-
- {"07", "", 0, ERR(0), KUMAX(7)},
- {"010", "", 0, ERR(0), KUMAX(8)},
- {"08", "8", 0, ERR(0), KUMAX(0)},
- {"0_", "_", 0, ERR(0), KUMAX(0)},
-
- {"0x", "x", 0, ERR(0), KUMAX(0)},
- {"0X", "X", 0, ERR(0), KUMAX(0)},
- {"0xg", "xg", 0, ERR(0), KUMAX(0)},
- {"0XA", "", 0, ERR(0), KUMAX(10)},
-
- {"010", "", 10, ERR(0), KUMAX(10)},
- {"0x3", "x3", 10, ERR(0), KUMAX(0)},
-
- {"12", "2", 2, ERR(0), KUMAX(1)},
- {"78", "8", 8, ERR(0), KUMAX(7)},
- {"9a", "a", 10, ERR(0), KUMAX(9)},
- {"9A", "A", 10, ERR(0), KUMAX(9)},
- {"fg", "g", 16, ERR(0), KUMAX(15)},
- {"FG", "G", 16, ERR(0), KUMAX(15)},
- {"0xfg", "g", 16, ERR(0), KUMAX(15)},
- {"0XFG", "G", 16, ERR(0), KUMAX(15)},
- {"z_", "_", 36, ERR(0), KUMAX(35)},
- {"Z_", "_", 36, ERR(0), KUMAX(35)}
- };
-#undef ERR
-#undef KUMAX
- unsigned i;
-
- for (i = 0; i < sizeof(tests)/sizeof(struct test_s); i++) {
- struct test_s *test = &tests[i];
- int err;
- uintmax_t result;
- char *remainder;
-
- set_errno(0);
- result = malloc_strtoumax(test->input, &remainder, test->base);
- err = get_errno();
- assert_d_eq(err, test->expected_errno,
- "Expected errno %s for \"%s\", base %d",
- test->expected_errno_name, test->input, test->base);
- assert_str_eq(remainder, test->expected_remainder,
- "Unexpected remainder for \"%s\", base %d",
- test->input, test->base);
- if (err == 0) {
- assert_ju_eq(result, test->expected_x,
- "Unexpected result for \"%s\", base %d",
- test->input, test->base);
- }
- }
-}
-TEST_END
-
-TEST_BEGIN(test_malloc_snprintf_truncated)
-{
-#define BUFLEN 15
- char buf[BUFLEN];
- size_t result;
- size_t len;
-#define TEST(expected_str_untruncated, ...) do { \
- result = malloc_snprintf(buf, len, __VA_ARGS__); \
- assert_d_eq(strncmp(buf, expected_str_untruncated, len-1), 0, \
- "Unexpected string inequality (\"%s\" vs \"%s\")", \
- buf, expected_str_untruncated); \
- assert_zu_eq(result, strlen(expected_str_untruncated), \
- "Unexpected result"); \
-} while (0)
-
- for (len = 1; len < BUFLEN; len++) {
- TEST("012346789", "012346789");
- TEST("a0123b", "a%sb", "0123");
- TEST("a01234567", "a%s%s", "0123", "4567");
- TEST("a0123 ", "a%-6s", "0123");
- TEST("a 0123", "a%6s", "0123");
- TEST("a 012", "a%6.3s", "0123");
- TEST("a 012", "a%*.*s", 6, 3, "0123");
- TEST("a 123b", "a% db", 123);
- TEST("a123b", "a%-db", 123);
- TEST("a-123b", "a%-db", -123);
- TEST("a+123b", "a%+db", 123);
- }
-#undef BUFLEN
-#undef TEST
-}
-TEST_END
-
-TEST_BEGIN(test_malloc_snprintf)
-{
-#define BUFLEN 128
- char buf[BUFLEN];
- size_t result;
-#define TEST(expected_str, ...) do { \
- result = malloc_snprintf(buf, sizeof(buf), __VA_ARGS__); \
- assert_str_eq(buf, expected_str, "Unexpected output"); \
- assert_zu_eq(result, strlen(expected_str), "Unexpected result");\
-} while (0)
-
- TEST("hello", "hello");
-
- TEST("50%, 100%", "50%%, %d%%", 100);
-
- TEST("a0123b", "a%sb", "0123");
-
- TEST("a 0123b", "a%5sb", "0123");
- TEST("a 0123b", "a%*sb", 5, "0123");
-
- TEST("a0123 b", "a%-5sb", "0123");
- TEST("a0123b", "a%*sb", -1, "0123");
- TEST("a0123 b", "a%*sb", -5, "0123");
- TEST("a0123 b", "a%-*sb", -5, "0123");
-
- TEST("a012b", "a%.3sb", "0123");
- TEST("a012b", "a%.*sb", 3, "0123");
- TEST("a0123b", "a%.*sb", -3, "0123");
-
- TEST("a 012b", "a%5.3sb", "0123");
- TEST("a 012b", "a%5.*sb", 3, "0123");
- TEST("a 012b", "a%*.3sb", 5, "0123");
- TEST("a 012b", "a%*.*sb", 5, 3, "0123");
- TEST("a 0123b", "a%*.*sb", 5, -3, "0123");
-
- TEST("_abcd_", "_%x_", 0xabcd);
- TEST("_0xabcd_", "_%#x_", 0xabcd);
- TEST("_1234_", "_%o_", 01234);
- TEST("_01234_", "_%#o_", 01234);
- TEST("_1234_", "_%u_", 1234);
-
- TEST("_1234_", "_%d_", 1234);
- TEST("_ 1234_", "_% d_", 1234);
- TEST("_+1234_", "_%+d_", 1234);
- TEST("_-1234_", "_%d_", -1234);
- TEST("_-1234_", "_% d_", -1234);
- TEST("_-1234_", "_%+d_", -1234);
-
- TEST("_-1234_", "_%d_", -1234);
- TEST("_1234_", "_%d_", 1234);
- TEST("_-1234_", "_%i_", -1234);
- TEST("_1234_", "_%i_", 1234);
- TEST("_01234_", "_%#o_", 01234);
- TEST("_1234_", "_%u_", 1234);
- TEST("_0x1234abc_", "_%#x_", 0x1234abc);
- TEST("_0X1234ABC_", "_%#X_", 0x1234abc);
- TEST("_c_", "_%c_", 'c');
- TEST("_string_", "_%s_", "string");
- TEST("_0x42_", "_%p_", ((void *)0x42));
-
- TEST("_-1234_", "_%ld_", ((long)-1234));
- TEST("_1234_", "_%ld_", ((long)1234));
- TEST("_-1234_", "_%li_", ((long)-1234));
- TEST("_1234_", "_%li_", ((long)1234));
- TEST("_01234_", "_%#lo_", ((long)01234));
- TEST("_1234_", "_%lu_", ((long)1234));
- TEST("_0x1234abc_", "_%#lx_", ((long)0x1234abc));
- TEST("_0X1234ABC_", "_%#lX_", ((long)0x1234ABC));
-
- TEST("_-1234_", "_%lld_", ((long long)-1234));
- TEST("_1234_", "_%lld_", ((long long)1234));
- TEST("_-1234_", "_%lli_", ((long long)-1234));
- TEST("_1234_", "_%lli_", ((long long)1234));
- TEST("_01234_", "_%#llo_", ((long long)01234));
- TEST("_1234_", "_%llu_", ((long long)1234));
- TEST("_0x1234abc_", "_%#llx_", ((long long)0x1234abc));
- TEST("_0X1234ABC_", "_%#llX_", ((long long)0x1234ABC));
-
- TEST("_-1234_", "_%qd_", ((long long)-1234));
- TEST("_1234_", "_%qd_", ((long long)1234));
- TEST("_-1234_", "_%qi_", ((long long)-1234));
- TEST("_1234_", "_%qi_", ((long long)1234));
- TEST("_01234_", "_%#qo_", ((long long)01234));
- TEST("_1234_", "_%qu_", ((long long)1234));
- TEST("_0x1234abc_", "_%#qx_", ((long long)0x1234abc));
- TEST("_0X1234ABC_", "_%#qX_", ((long long)0x1234ABC));
-
- TEST("_-1234_", "_%jd_", ((intmax_t)-1234));
- TEST("_1234_", "_%jd_", ((intmax_t)1234));
- TEST("_-1234_", "_%ji_", ((intmax_t)-1234));
- TEST("_1234_", "_%ji_", ((intmax_t)1234));
- TEST("_01234_", "_%#jo_", ((intmax_t)01234));
- TEST("_1234_", "_%ju_", ((intmax_t)1234));
- TEST("_0x1234abc_", "_%#jx_", ((intmax_t)0x1234abc));
- TEST("_0X1234ABC_", "_%#jX_", ((intmax_t)0x1234ABC));
-
- TEST("_1234_", "_%td_", ((ptrdiff_t)1234));
- TEST("_-1234_", "_%td_", ((ptrdiff_t)-1234));
- TEST("_1234_", "_%ti_", ((ptrdiff_t)1234));
- TEST("_-1234_", "_%ti_", ((ptrdiff_t)-1234));
-
- TEST("_-1234_", "_%zd_", ((ssize_t)-1234));
- TEST("_1234_", "_%zd_", ((ssize_t)1234));
- TEST("_-1234_", "_%zi_", ((ssize_t)-1234));
- TEST("_1234_", "_%zi_", ((ssize_t)1234));
- TEST("_01234_", "_%#zo_", ((ssize_t)01234));
- TEST("_1234_", "_%zu_", ((ssize_t)1234));
- TEST("_0x1234abc_", "_%#zx_", ((ssize_t)0x1234abc));
- TEST("_0X1234ABC_", "_%#zX_", ((ssize_t)0x1234ABC));
-#undef BUFLEN
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_pow2_ceil_u64,
- test_pow2_ceil_u32,
- test_pow2_ceil_zu,
- test_malloc_strtoumax_no_endptr,
- test_malloc_strtoumax,
- test_malloc_snprintf_truncated,
- test_malloc_snprintf));
-}
diff --git a/memory/jemalloc/src/test/unit/witness.c b/memory/jemalloc/src/test/unit/witness.c
deleted file mode 100644
index ed172753c7..0000000000
--- a/memory/jemalloc/src/test/unit/witness.c
+++ /dev/null
@@ -1,278 +0,0 @@
-#include "test/jemalloc_test.h"
-
-static witness_lock_error_t *witness_lock_error_orig;
-static witness_owner_error_t *witness_owner_error_orig;
-static witness_not_owner_error_t *witness_not_owner_error_orig;
-static witness_lockless_error_t *witness_lockless_error_orig;
-
-static bool saw_lock_error;
-static bool saw_owner_error;
-static bool saw_not_owner_error;
-static bool saw_lockless_error;
-
-static void
-witness_lock_error_intercept(const witness_list_t *witnesses,
- const witness_t *witness)
-{
-
- saw_lock_error = true;
-}
-
-static void
-witness_owner_error_intercept(const witness_t *witness)
-{
-
- saw_owner_error = true;
-}
-
-static void
-witness_not_owner_error_intercept(const witness_t *witness)
-{
-
- saw_not_owner_error = true;
-}
-
-static void
-witness_lockless_error_intercept(const witness_list_t *witnesses)
-{
-
- saw_lockless_error = true;
-}
-
-static int
-witness_comp(const witness_t *a, const witness_t *b)
-{
-
- assert_u_eq(a->rank, b->rank, "Witnesses should have equal rank");
-
- return (strcmp(a->name, b->name));
-}
-
-static int
-witness_comp_reverse(const witness_t *a, const witness_t *b)
-{
-
- assert_u_eq(a->rank, b->rank, "Witnesses should have equal rank");
-
- return (-strcmp(a->name, b->name));
-}
-
-TEST_BEGIN(test_witness)
-{
- witness_t a, b;
- tsdn_t *tsdn;
-
- test_skip_if(!config_debug);
-
- tsdn = tsdn_fetch();
-
- witness_assert_lockless(tsdn);
-
- witness_init(&a, "a", 1, NULL);
- witness_assert_not_owner(tsdn, &a);
- witness_lock(tsdn, &a);
- witness_assert_owner(tsdn, &a);
-
- witness_init(&b, "b", 2, NULL);
- witness_assert_not_owner(tsdn, &b);
- witness_lock(tsdn, &b);
- witness_assert_owner(tsdn, &b);
-
- witness_unlock(tsdn, &a);
- witness_unlock(tsdn, &b);
-
- witness_assert_lockless(tsdn);
-}
-TEST_END
-
-TEST_BEGIN(test_witness_comp)
-{
- witness_t a, b, c, d;
- tsdn_t *tsdn;
-
- test_skip_if(!config_debug);
-
- tsdn = tsdn_fetch();
-
- witness_assert_lockless(tsdn);
-
- witness_init(&a, "a", 1, witness_comp);
- witness_assert_not_owner(tsdn, &a);
- witness_lock(tsdn, &a);
- witness_assert_owner(tsdn, &a);
-
- witness_init(&b, "b", 1, witness_comp);
- witness_assert_not_owner(tsdn, &b);
- witness_lock(tsdn, &b);
- witness_assert_owner(tsdn, &b);
- witness_unlock(tsdn, &b);
-
- witness_lock_error_orig = witness_lock_error;
- witness_lock_error = witness_lock_error_intercept;
- saw_lock_error = false;
-
- witness_init(&c, "c", 1, witness_comp_reverse);
- witness_assert_not_owner(tsdn, &c);
- assert_false(saw_lock_error, "Unexpected witness lock error");
- witness_lock(tsdn, &c);
- assert_true(saw_lock_error, "Expected witness lock error");
- witness_unlock(tsdn, &c);
-
- saw_lock_error = false;
-
- witness_init(&d, "d", 1, NULL);
- witness_assert_not_owner(tsdn, &d);
- assert_false(saw_lock_error, "Unexpected witness lock error");
- witness_lock(tsdn, &d);
- assert_true(saw_lock_error, "Expected witness lock error");
- witness_unlock(tsdn, &d);
-
- witness_unlock(tsdn, &a);
-
- witness_assert_lockless(tsdn);
-
- witness_lock_error = witness_lock_error_orig;
-}
-TEST_END
-
-TEST_BEGIN(test_witness_reversal)
-{
- witness_t a, b;
- tsdn_t *tsdn;
-
- test_skip_if(!config_debug);
-
- witness_lock_error_orig = witness_lock_error;
- witness_lock_error = witness_lock_error_intercept;
- saw_lock_error = false;
-
- tsdn = tsdn_fetch();
-
- witness_assert_lockless(tsdn);
-
- witness_init(&a, "a", 1, NULL);
- witness_init(&b, "b", 2, NULL);
-
- witness_lock(tsdn, &b);
- assert_false(saw_lock_error, "Unexpected witness lock error");
- witness_lock(tsdn, &a);
- assert_true(saw_lock_error, "Expected witness lock error");
-
- witness_unlock(tsdn, &a);
- witness_unlock(tsdn, &b);
-
- witness_assert_lockless(tsdn);
-
- witness_lock_error = witness_lock_error_orig;
-}
-TEST_END
-
-TEST_BEGIN(test_witness_recursive)
-{
- witness_t a;
- tsdn_t *tsdn;
-
- test_skip_if(!config_debug);
-
- witness_not_owner_error_orig = witness_not_owner_error;
- witness_not_owner_error = witness_not_owner_error_intercept;
- saw_not_owner_error = false;
-
- witness_lock_error_orig = witness_lock_error;
- witness_lock_error = witness_lock_error_intercept;
- saw_lock_error = false;
-
- tsdn = tsdn_fetch();
-
- witness_assert_lockless(tsdn);
-
- witness_init(&a, "a", 1, NULL);
-
- witness_lock(tsdn, &a);
- assert_false(saw_lock_error, "Unexpected witness lock error");
- assert_false(saw_not_owner_error, "Unexpected witness not owner error");
- witness_lock(tsdn, &a);
- assert_true(saw_lock_error, "Expected witness lock error");
- assert_true(saw_not_owner_error, "Expected witness not owner error");
-
- witness_unlock(tsdn, &a);
-
- witness_assert_lockless(tsdn);
-
- witness_owner_error = witness_owner_error_orig;
- witness_lock_error = witness_lock_error_orig;
-
-}
-TEST_END
-
-TEST_BEGIN(test_witness_unlock_not_owned)
-{
- witness_t a;
- tsdn_t *tsdn;
-
- test_skip_if(!config_debug);
-
- witness_owner_error_orig = witness_owner_error;
- witness_owner_error = witness_owner_error_intercept;
- saw_owner_error = false;
-
- tsdn = tsdn_fetch();
-
- witness_assert_lockless(tsdn);
-
- witness_init(&a, "a", 1, NULL);
-
- assert_false(saw_owner_error, "Unexpected owner error");
- witness_unlock(tsdn, &a);
- assert_true(saw_owner_error, "Expected owner error");
-
- witness_assert_lockless(tsdn);
-
- witness_owner_error = witness_owner_error_orig;
-}
-TEST_END
-
-TEST_BEGIN(test_witness_lockful)
-{
- witness_t a;
- tsdn_t *tsdn;
-
- test_skip_if(!config_debug);
-
- witness_lockless_error_orig = witness_lockless_error;
- witness_lockless_error = witness_lockless_error_intercept;
- saw_lockless_error = false;
-
- tsdn = tsdn_fetch();
-
- witness_assert_lockless(tsdn);
-
- witness_init(&a, "a", 1, NULL);
-
- assert_false(saw_lockless_error, "Unexpected lockless error");
- witness_assert_lockless(tsdn);
-
- witness_lock(tsdn, &a);
- witness_assert_lockless(tsdn);
- assert_true(saw_lockless_error, "Expected lockless error");
-
- witness_unlock(tsdn, &a);
-
- witness_assert_lockless(tsdn);
-
- witness_lockless_error = witness_lockless_error_orig;
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_witness,
- test_witness_comp,
- test_witness_reversal,
- test_witness_recursive,
- test_witness_unlock_not_owned,
- test_witness_lockful));
-}
diff --git a/memory/jemalloc/src/test/unit/zero.c b/memory/jemalloc/src/test/unit/zero.c
deleted file mode 100644
index 30ebe37a45..0000000000
--- a/memory/jemalloc/src/test/unit/zero.c
+++ /dev/null
@@ -1,80 +0,0 @@
-#include "test/jemalloc_test.h"
-
-#ifdef JEMALLOC_FILL
-const char *malloc_conf =
- "abort:false,junk:false,zero:true,redzone:false,quarantine:0";
-#endif
-
-static void
-test_zero(size_t sz_min, size_t sz_max)
-{
- uint8_t *s;
- size_t sz_prev, sz, i;
-#define MAGIC ((uint8_t)0x61)
-
- sz_prev = 0;
- s = (uint8_t *)mallocx(sz_min, 0);
- assert_ptr_not_null((void *)s, "Unexpected mallocx() failure");
-
- for (sz = sallocx(s, 0); sz <= sz_max;
- sz_prev = sz, sz = sallocx(s, 0)) {
- if (sz_prev > 0) {
- assert_u_eq(s[0], MAGIC,
- "Previously allocated byte %zu/%zu is corrupted",
- ZU(0), sz_prev);
- assert_u_eq(s[sz_prev-1], MAGIC,
- "Previously allocated byte %zu/%zu is corrupted",
- sz_prev-1, sz_prev);
- }
-
- for (i = sz_prev; i < sz; i++) {
- assert_u_eq(s[i], 0x0,
- "Newly allocated byte %zu/%zu isn't zero-filled",
- i, sz);
- s[i] = MAGIC;
- }
-
- if (xallocx(s, sz+1, 0, 0) == sz) {
- s = (uint8_t *)rallocx(s, sz+1, 0);
- assert_ptr_not_null((void *)s,
- "Unexpected rallocx() failure");
- }
- }
-
- dallocx(s, 0);
-#undef MAGIC
-}
-
-TEST_BEGIN(test_zero_small)
-{
-
- test_skip_if(!config_fill);
- test_zero(1, SMALL_MAXCLASS-1);
-}
-TEST_END
-
-TEST_BEGIN(test_zero_large)
-{
-
- test_skip_if(!config_fill);
- test_zero(SMALL_MAXCLASS+1, large_maxclass);
-}
-TEST_END
-
-TEST_BEGIN(test_zero_huge)
-{
-
- test_skip_if(!config_fill);
- test_zero(large_maxclass+1, chunksize*2);
-}
-TEST_END
-
-int
-main(void)
-{
-
- return (test(
- test_zero_small,
- test_zero_large,
- test_zero_huge));
-}
diff --git a/memory/jemalloc/update.sh b/memory/jemalloc/update.sh
deleted file mode 100755
index bd126ec8a4..0000000000
--- a/memory/jemalloc/update.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/bash
-
-set -e
-
-cd `dirname $0`
-
-source upstream.info
-
-rm -rf src
-git clone "$UPSTREAM_REPO" src
-cd src
-git checkout "$UPSTREAM_COMMIT"
-autoconf
-git describe --long --abbrev=40 > VERSION
-rm -rf .git .gitignore .gitattributes autom4te.cache .autom4te.cfg
-
-cd ..
-hg addremove -q src
-
-echo "jemalloc has now been updated. Don't forget to run hg commit!"
diff --git a/memory/jemalloc/upstream.info b/memory/jemalloc/upstream.info
deleted file mode 100644
index ba561cc54f..0000000000
--- a/memory/jemalloc/upstream.info
+++ /dev/null
@@ -1,2 +0,0 @@
-UPSTREAM_REPO=https://github.com/jemalloc/jemalloc
-UPSTREAM_COMMIT=4.3.1
diff --git a/memory/moz.build b/memory/moz.build
index cf8bbc0f39..acbcfaec9c 100644
--- a/memory/moz.build
+++ b/memory/moz.build
@@ -20,9 +20,5 @@ if CONFIG['MOZ_MEMORY']:
'mozjemalloc',
]
- if CONFIG['MOZ_JEMALLOC4'] or CONFIG['MOZ_REPLACE_MALLOC']:
- if not CONFIG['MOZ_SYSTEM_JEMALLOC']:
- DIRS += ['jemalloc']
-
if CONFIG['MOZ_REPLACE_MALLOC']:
DIRS += ['replace']
diff --git a/memory/mozjemalloc/Makefile.in b/memory/mozjemalloc/Makefile.in
index 6c47e1fa27..f02b315eca 100644
--- a/memory/mozjemalloc/Makefile.in
+++ b/memory/mozjemalloc/Makefile.in
@@ -3,11 +3,9 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-ifndef MOZ_JEMALLOC4
# Force optimize mozjemalloc on --disable-optimize builds.
# This works around the issue that the Android NDK's definition of ffs is
# broken when compiling without optimization, while avoiding to add yet another
# configure test.
MOZ_OPTIMIZE = 1
-endif
diff --git a/memory/mozjemalloc/jemalloc.c b/memory/mozjemalloc/jemalloc.c
index 5d4d83a24e..7950b43e89 100644
--- a/memory/mozjemalloc/jemalloc.c
+++ b/memory/mozjemalloc/jemalloc.c
@@ -2,7 +2,7 @@
/* vim:set softtabstop=8 shiftwidth=8 noet: */
/*-
* Copyright (C) 2006-2008 Jason Evans <jasone@FreeBSD.org>.
- * All rights reserved.
+ * Copyright (C) 2015-2018 Mark Straver <moonchild@palemoon.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -140,17 +140,9 @@
#endif
/*
- * Use only one arena by default. Mozilla does not currently make extensive
- * use of concurrent allocation, so the increased fragmentation associated with
- * multiple arenas is not warranted.
- *
- * When using the Servo style system, we do indeed make use of significant
- * concurrent allocation, and the overhead matters. Bug 1291355 tracks
- * investigating the fragmentation overhead of turning this on for users.
+ * Uncomment this to use only one arena by default.
*/
-#ifndef MOZ_STYLO
-#define MOZ_MEMORY_NARENAS_DEFAULT_ONE
-#endif
+// #define MOZ_MEMORY_NARENAS_DEFAULT_ONE
/*
* Pass this set of options to jemalloc as its default. It does not override
@@ -199,13 +191,6 @@
*/
#define MALLOC_VALIDATE
-/*
- * MALLOC_BALANCE enables monitoring of arena lock contention and dynamically
- * re-balances arena load if exponentially averaged contention exceeds a
- * certain threshold.
- */
-/* #define MALLOC_BALANCE */
-
#if defined(MOZ_MEMORY_LINUX) && !defined(MOZ_MEMORY_ANDROID)
#define _GNU_SOURCE /* For mremap(2). */
#if 0 /* Enable in order to test decommit code on Linux. */
@@ -224,9 +209,6 @@
#ifdef MOZ_MEMORY_WINDOWS
-/* Some defines from the CRT internal headers that we need here. */
-#define _CRT_SPINCOUNT 5000
-#define __crtInitCritSecAndSpinCount InitializeCriticalSectionAndSpinCount
#include <io.h>
#include <windows.h>
#include <intrin.h>
@@ -433,10 +415,6 @@ void *_mmap(void *addr, size_t length, int prot, int flags,
#endif
#endif
-#ifdef MOZ_MEMORY_DARWIN
-static const bool isthreaded = true;
-#endif
-
#if defined(MOZ_MEMORY_SOLARIS) && defined(MAP_ALIGN) && !defined(JEMALLOC_NEVER_USES_MAP_ALIGN)
#define JEMALLOC_USES_MAP_ALIGN /* Required on Solaris 10. Might improve performance elsewhere. */
#endif
@@ -471,9 +449,7 @@ static const bool isthreaded = true;
# define SIZEOF_PTR_2POW 2
#endif
#define PIC
-#ifndef MOZ_MEMORY_DARWIN
-static const bool isthreaded = true;
-#else
+#ifdef MOZ_MEMORY_DARWIN
# define NO_TLS
#endif
#if 0
@@ -529,13 +505,6 @@ static const bool isthreaded = true;
# define NO_TLS
#endif
-#ifdef NO_TLS
- /* MALLOC_BALANCE requires TLS. */
-# ifdef MALLOC_BALANCE
-# undef MALLOC_BALANCE
-# endif
-#endif
-
/*
* Size and alignment of memory chunks that are allocated by the OS's virtual
* memory system.
@@ -615,24 +584,6 @@ static const bool isthreaded = true;
*/
#define BLOCK_COST_2POW 4
-#ifdef MALLOC_BALANCE
- /*
- * We use an exponential moving average to track recent lock contention,
- * where the size of the history window is N, and alpha=2/(N+1).
- *
- * Due to integer math rounding, very small values here can cause
- * substantial degradation in accuracy, thus making the moving average decay
- * faster than it would with precise calculation.
- */
-# define BALANCE_ALPHA_INV_2POW 9
-
- /*
- * Threshold value for the exponential moving contention average at which to
- * re-assign a thread.
- */
-# define BALANCE_THRESHOLD_DEFAULT (1U << (SPIN_LIMIT_2POW-4))
-#endif
-
/******************************************************************************/
/* MALLOC_DECOMMIT and MALLOC_DOUBLE_PURGE are mutually exclusive. */
@@ -646,8 +597,8 @@ static const bool isthreaded = true;
* issues in some cases.
*/
#if defined(MOZ_MEMORY_WINDOWS)
-#define malloc_mutex_t CRITICAL_SECTION
-#define malloc_spinlock_t CRITICAL_SECTION
+#define malloc_mutex_t SRWLOCK
+#define malloc_spinlock_t SRWLOCK
#elif defined(MOZ_MEMORY_DARWIN)
typedef struct {
OSSpinLock lock;
@@ -746,11 +697,6 @@ struct arena_stats_s {
size_t allocated_large;
uint64_t nmalloc_large;
uint64_t ndalloc_large;
-
-#ifdef MALLOC_BALANCE
- /* Number of times this arena reassigned a thread due to contention. */
- uint64_t nbalance;
-#endif
};
#endif /* #ifdef MALLOC_STATS */
@@ -1035,14 +981,6 @@ struct arena_s {
*/
arena_avail_tree_t runs_avail;
-#ifdef MALLOC_BALANCE
- /*
- * The arena load balancing machinery needs to keep track of how much
- * lock contention there is. This value is exponentially averaged.
- */
- uint32_t contention;
-#endif
-
/*
* bins is used to store rings of free regions of the following sizes,
* assuming a 16-byte quantum, 4kB pagesize, and default MALLOC_OPTIONS.
@@ -1281,11 +1219,7 @@ static size_t base_committed;
static arena_t **arenas;
static unsigned narenas;
#ifndef NO_TLS
-# ifdef MALLOC_BALANCE
-static unsigned narenas_2pow;
-# else
static unsigned next_arena;
-# endif
#endif
#ifdef MOZ_MEMORY
static malloc_spinlock_t arenas_lock; /* Protects arenas initialization. */
@@ -1327,9 +1261,6 @@ static const bool opt_zero = false;
#endif
static size_t opt_dirty_max = DIRTY_MAX_DEFAULT;
-#ifdef MALLOC_BALANCE
-static uint64_t opt_balance_threshold = BALANCE_THRESHOLD_DEFAULT;
-#endif
static bool opt_print_stats = false;
#ifdef MALLOC_STATIC_SIZES
#define opt_quantum_2pow QUANTUM_2POW_MIN
@@ -1424,9 +1355,6 @@ static void arena_run_trim_tail(arena_t *arena, arena_chunk_t *chunk,
static arena_run_t *arena_bin_nonfull_run_get(arena_t *arena, arena_bin_t *bin);
static void *arena_bin_malloc_hard(arena_t *arena, arena_bin_t *bin);
static size_t arena_bin_run_size_calc(arena_bin_t *bin, size_t min_run_size);
-#ifdef MALLOC_BALANCE
-static void arena_lock_balance_hard(arena_t *arena);
-#endif
static void *arena_malloc_large(arena_t *arena, size_t size, bool zero);
static void *arena_palloc(arena_t *arena, size_t alignment, size_t size,
size_t alloc_size);
@@ -1635,9 +1563,7 @@ static bool
malloc_mutex_init(malloc_mutex_t *mutex)
{
#if defined(MOZ_MEMORY_WINDOWS)
- if (isthreaded)
- if (! __crtInitCritSecAndSpinCount(mutex, _CRT_SPINCOUNT))
- return (true);
+ InitializeSRWLock(mutex);
#elif defined(MOZ_MEMORY_DARWIN)
mutex->lock = OS_SPINLOCK_INIT;
#elif defined(MOZ_MEMORY_LINUX) && !defined(MOZ_MEMORY_ANDROID)
@@ -1666,14 +1592,13 @@ malloc_mutex_lock(malloc_mutex_t *mutex)
{
#if defined(MOZ_MEMORY_WINDOWS)
- EnterCriticalSection(mutex);
+ AcquireSRWLockExclusive(mutex);
#elif defined(MOZ_MEMORY_DARWIN)
OSSpinLockLock(&mutex->lock);
#elif defined(MOZ_MEMORY)
pthread_mutex_lock(mutex);
#else
- if (isthreaded)
- _SPINLOCK(&mutex->lock);
+ _SPINLOCK(&mutex->lock);
#endif
}
@@ -1682,14 +1607,13 @@ malloc_mutex_unlock(malloc_mutex_t *mutex)
{
#if defined(MOZ_MEMORY_WINDOWS)
- LeaveCriticalSection(mutex);
+ ReleaseSRWLockExclusive(mutex);
#elif defined(MOZ_MEMORY_DARWIN)
OSSpinLockUnlock(&mutex->lock);
#elif defined(MOZ_MEMORY)
pthread_mutex_unlock(mutex);
#else
- if (isthreaded)
- _SPINUNLOCK(&mutex->lock);
+ _SPINUNLOCK(&mutex->lock);
#endif
}
@@ -1700,9 +1624,7 @@ static bool
malloc_spin_init(malloc_spinlock_t *lock)
{
#if defined(MOZ_MEMORY_WINDOWS)
- if (isthreaded)
- if (! __crtInitCritSecAndSpinCount(lock, _CRT_SPINCOUNT))
- return (true);
+ InitializeSRWLock(lock);
#elif defined(MOZ_MEMORY_DARWIN)
lock->lock = OS_SPINLOCK_INIT;
#elif defined(MOZ_MEMORY_LINUX) && !defined(MOZ_MEMORY_ANDROID)
@@ -1729,14 +1651,13 @@ malloc_spin_lock(malloc_spinlock_t *lock)
{
#if defined(MOZ_MEMORY_WINDOWS)
- EnterCriticalSection(lock);
+ AcquireSRWLockExclusive(lock);
#elif defined(MOZ_MEMORY_DARWIN)
OSSpinLockLock(&lock->lock);
#elif defined(MOZ_MEMORY)
pthread_mutex_lock(lock);
#else
- if (isthreaded)
- _SPINLOCK(&lock->lock);
+ _SPINLOCK(&lock->lock);
#endif
}
@@ -1744,14 +1665,13 @@ static inline void
malloc_spin_unlock(malloc_spinlock_t *lock)
{
#if defined(MOZ_MEMORY_WINDOWS)
- LeaveCriticalSection(lock);
+ ReleaseSRWLockExclusive(lock);
#elif defined(MOZ_MEMORY_DARWIN)
OSSpinLockUnlock(&lock->lock);
#elif defined(MOZ_MEMORY)
pthread_mutex_unlock(lock);
#else
- if (isthreaded)
- _SPINUNLOCK(&lock->lock);
+ _SPINUNLOCK(&lock->lock);
#endif
}
@@ -1805,30 +1725,28 @@ malloc_spin_lock(pthread_mutex_t *lock)
{
unsigned ret = 0;
- if (isthreaded) {
- if (_pthread_mutex_trylock(lock) != 0) {
- unsigned i;
- volatile unsigned j;
+ if (_pthread_mutex_trylock(lock) != 0) {
+ unsigned i;
+ volatile unsigned j;
- /* Exponentially back off. */
- for (i = 1; i <= SPIN_LIMIT_2POW; i++) {
- for (j = 0; j < (1U << i); j++)
- ret++;
+ /* Exponentially back off. */
+ for (i = 1; i <= SPIN_LIMIT_2POW; i++) {
+ for (j = 0; j < (1U << i); j++)
+ ret++;
- CPU_SPINWAIT;
- if (_pthread_mutex_trylock(lock) == 0)
- return (ret);
- }
-
- /*
- * Spinning failed. Block until the lock becomes
- * available, in order to avoid indefinite priority
- * inversion.
- */
- _pthread_mutex_lock(lock);
- assert((ret << BLOCK_COST_2POW) != 0);
- return (ret << BLOCK_COST_2POW);
+ CPU_SPINWAIT;
+ if (_pthread_mutex_trylock(lock) == 0)
+ return (ret);
}
+
+ /*
+ * Spinning failed. Block until the lock becomes
+ * available, in order to avoid indefinite priority
+ * inversion.
+ */
+ _pthread_mutex_lock(lock);
+ assert((ret << BLOCK_COST_2POW) != 0);
+ return (ret << BLOCK_COST_2POW);
}
return (ret);
@@ -1837,9 +1755,7 @@ malloc_spin_lock(pthread_mutex_t *lock)
static inline void
malloc_spin_unlock(pthread_mutex_t *lock)
{
-
- if (isthreaded)
- _pthread_mutex_unlock(lock);
+ _pthread_mutex_unlock(lock);
}
#endif
@@ -1893,56 +1809,6 @@ pow2_ceil(size_t x)
return (x);
}
-#ifdef MALLOC_BALANCE
-/*
- * Use a simple linear congruential pseudo-random number generator:
- *
- * prn(y) = (a*x + c) % m
- *
- * where the following constants ensure maximal period:
- *
- * a == Odd number (relatively prime to 2^n), and (a-1) is a multiple of 4.
- * c == Odd number (relatively prime to 2^n).
- * m == 2^32
- *
- * See Knuth's TAOCP 3rd Ed., Vol. 2, pg. 17 for details on these constraints.
- *
- * This choice of m has the disadvantage that the quality of the bits is
- * proportional to bit position. For example. the lowest bit has a cycle of 2,
- * the next has a cycle of 4, etc. For this reason, we prefer to use the upper
- * bits.
- */
-# define PRN_DEFINE(suffix, var, a, c) \
-static inline void \
-sprn_##suffix(uint32_t seed) \
-{ \
- var = seed; \
-} \
- \
-static inline uint32_t \
-prn_##suffix(uint32_t lg_range) \
-{ \
- uint32_t ret, x; \
- \
- assert(lg_range > 0); \
- assert(lg_range <= 32); \
- \
- x = (var * (a)) + (c); \
- var = x; \
- ret = x >> (32 - lg_range); \
- \
- return (ret); \
-}
-# define SPRN(suffix, seed) sprn_##suffix(seed)
-# define PRN(suffix, lg_range) prn_##suffix(lg_range)
-#endif
-
-#ifdef MALLOC_BALANCE
-/* Define the PRNG used for arena assignment. */
-static __thread uint32_t balance_x;
-PRN_DEFINE(balance, balance_x, 1297, 1301)
-#endif
-
#ifdef MALLOC_UTRACE
static int
utrace(const void *addr, size_t len)
@@ -3089,10 +2955,6 @@ choose_arena(void)
* introduces a bootstrapping issue.
*/
#ifndef NO_TLS
- if (isthreaded == false) {
- /* Avoid the overhead of TLS for single-threaded operation. */
- return (arenas[0]);
- }
# ifdef MOZ_MEMORY_WINDOWS
ret = (arena_t*)TlsGetValue(tlsIndex);
@@ -3105,7 +2967,7 @@ choose_arena(void)
RELEASE_ASSERT(ret != NULL);
}
#else
- if (isthreaded && narenas > 1) {
+ if (narenas > 1) {
unsigned long ind;
/*
@@ -3162,31 +3024,12 @@ choose_arena_hard(void)
{
arena_t *ret;
- assert(isthreaded);
-
-#ifdef MALLOC_BALANCE
- /* Seed the PRNG used for arena load balancing. */
- SPRN(balance, (uint32_t)(uintptr_t)(_pthread_self()));
-#endif
-
if (narenas > 1) {
-#ifdef MALLOC_BALANCE
- unsigned ind;
-
- ind = PRN(balance, narenas_2pow);
- if ((ret = arenas[ind]) == NULL) {
- malloc_spin_lock(&arenas_lock);
- if ((ret = arenas[ind]) == NULL)
- ret = arenas_extend(ind);
- malloc_spin_unlock(&arenas_lock);
- }
-#else
malloc_spin_lock(&arenas_lock);
if ((ret = arenas[next_arena]) == NULL)
ret = arenas_extend(next_arena);
next_arena = (next_arena + 1) % narenas;
malloc_spin_unlock(&arenas_lock);
-#endif
} else
ret = arenas[0];
@@ -4120,63 +3963,6 @@ arena_bin_run_size_calc(arena_bin_t *bin, size_t min_run_size)
return (good_run_size);
}
-#ifdef MALLOC_BALANCE
-static inline void
-arena_lock_balance(arena_t *arena)
-{
- unsigned contention;
-
- contention = malloc_spin_lock(&arena->lock);
- if (narenas > 1) {
- /*
- * Calculate the exponentially averaged contention for this
- * arena. Due to integer math always rounding down, this value
- * decays somewhat faster then normal.
- */
- arena->contention = (((uint64_t)arena->contention
- * (uint64_t)((1U << BALANCE_ALPHA_INV_2POW)-1))
- + (uint64_t)contention) >> BALANCE_ALPHA_INV_2POW;
- if (arena->contention >= opt_balance_threshold)
- arena_lock_balance_hard(arena);
- }
-}
-
-static void
-arena_lock_balance_hard(arena_t *arena)
-{
- uint32_t ind;
-
- arena->contention = 0;
-#ifdef MALLOC_STATS
- arena->stats.nbalance++;
-#endif
- ind = PRN(balance, narenas_2pow);
- if (arenas[ind] != NULL) {
-#ifdef MOZ_MEMORY_WINDOWS
- TlsSetValue(tlsIndex, arenas[ind]);
-#else
- arenas_map = arenas[ind];
-#endif
- } else {
- malloc_spin_lock(&arenas_lock);
- if (arenas[ind] != NULL) {
-#ifdef MOZ_MEMORY_WINDOWS
- TlsSetValue(tlsIndex, arenas[ind]);
-#else
- arenas_map = arenas[ind];
-#endif
- } else {
-#ifdef MOZ_MEMORY_WINDOWS
- TlsSetValue(tlsIndex, arenas_extend(ind));
-#else
- arenas_map = arenas_extend(ind);
-#endif
- }
- malloc_spin_unlock(&arenas_lock);
- }
-}
-#endif
-
static inline void *
arena_malloc_small(arena_t *arena, size_t size, bool zero)
{
@@ -4211,11 +3997,8 @@ arena_malloc_small(arena_t *arena, size_t size, bool zero)
}
RELEASE_ASSERT(size == bin->reg_size);
-#ifdef MALLOC_BALANCE
- arena_lock_balance(arena);
-#else
malloc_spin_lock(&arena->lock);
-#endif
+
if ((run = bin->runcur) != NULL && run->nfree > 0)
ret = arena_bin_malloc_easy(arena, bin, run);
else
@@ -4253,11 +4036,7 @@ arena_malloc_large(arena_t *arena, size_t size, bool zero)
/* Large allocation. */
size = PAGE_CEILING(size);
-#ifdef MALLOC_BALANCE
- arena_lock_balance(arena);
-#else
malloc_spin_lock(&arena->lock);
-#endif
ret = (void *)arena_run_alloc(arena, NULL, size, true, zero);
if (ret == NULL) {
malloc_spin_unlock(&arena->lock);
@@ -4329,11 +4108,8 @@ arena_palloc(arena_t *arena, size_t alignment, size_t size, size_t alloc_size)
assert((size & pagesize_mask) == 0);
assert((alignment & pagesize_mask) == 0);
-#ifdef MALLOC_BALANCE
- arena_lock_balance(arena);
-#else
malloc_spin_lock(&arena->lock);
-#endif
+
ret = (void *)arena_run_alloc(arena, NULL, alloc_size, true, false);
if (ret == NULL) {
malloc_spin_unlock(&arena->lock);
@@ -4756,11 +4532,7 @@ arena_ralloc_large_shrink(arena_t *arena, arena_chunk_t *chunk, void *ptr,
* Shrink the run, and make trailing pages available for other
* allocations.
*/
-#ifdef MALLOC_BALANCE
- arena_lock_balance(arena);
-#else
malloc_spin_lock(&arena->lock);
-#endif
arena_run_trim_tail(arena, chunk, (arena_run_t *)ptr, oldsize, size,
true);
#ifdef MALLOC_STATS
@@ -4780,11 +4552,7 @@ arena_ralloc_large_grow(arena_t *arena, arena_chunk_t *chunk, void *ptr,
/* Try to extend the run. */
assert(size > oldsize);
-#ifdef MALLOC_BALANCE
- arena_lock_balance(arena);
-#else
malloc_spin_lock(&arena->lock);
-#endif
if (pageind + npages < chunk_npages && (chunk->map[pageind+npages].bits
& CHUNK_MAP_ALLOCATED) == 0 && (chunk->map[pageind+npages].bits &
~pagesize_mask) >= size - oldsize) {
@@ -4962,10 +4730,6 @@ arena_new(arena_t *arena)
arena_avail_tree_new(&arena->runs_avail);
-#ifdef MALLOC_BALANCE
- arena->contention = 0;
-#endif
-
/* Initialize bins. */
prev_run_size = pagesize;
@@ -5273,7 +5037,10 @@ huge_dalloc(void *ptr)
base_node_dealloc(node);
}
-#ifndef MOZ_MEMORY_NARENAS_DEFAULT_ONE
+/*
+ * Platform-specific methods to determine the number of CPUs in a system.
+ * This will be used to determine the desired number of arenas.
+ */
#ifdef MOZ_MEMORY_BSD
static inline unsigned
malloc_ncpus(void)
@@ -5371,11 +5138,19 @@ malloc_ncpus(void)
{
return sysconf(_SC_NPROCESSORS_ONLN);
}
+#elif (defined(MOZ_MEMORY_WINDOWS))
+static inline unsigned
+malloc_ncpus(void)
+{
+ SYSTEM_INFO info;
+
+ GetSystemInfo(&info);
+ return (info.dwNumberOfProcessors);
+}
#else
static inline unsigned
malloc_ncpus(void)
{
-
/*
* We lack a way to determine the number of CPUs on this platform, so
* assume 1 CPU.
@@ -5383,7 +5158,6 @@ malloc_ncpus(void)
return (1);
}
#endif
-#endif
static void
malloc_print_stats(void)
@@ -5426,10 +5200,6 @@ malloc_print_stats(void)
#endif
_malloc_message("Max arenas: ", umax2s(narenas, 10, s), "\n",
"");
-#ifdef MALLOC_BALANCE
- _malloc_message("Arena balance threshold: ",
- umax2s(opt_balance_threshold, 10, s), "\n", "");
-#endif
_malloc_message("Pointer size: ", umax2s(sizeof(void *), 10, s),
"\n", "");
_malloc_message("Quantum size: ", umax2s(quantum, 10, s), "\n",
@@ -5447,9 +5217,6 @@ malloc_print_stats(void)
#ifdef MALLOC_STATS
{
size_t allocated, mapped = 0;
-#ifdef MALLOC_BALANCE
- uint64_t nbalance = 0;
-#endif
unsigned i;
arena_t *arena;
@@ -5464,9 +5231,6 @@ malloc_print_stats(void)
allocated +=
arenas[i]->stats.allocated_large;
mapped += arenas[i]->stats.mapped;
-#ifdef MALLOC_BALANCE
- nbalance += arenas[i]->stats.nbalance;
-#endif
malloc_spin_unlock(&arenas[i]->lock);
}
}
@@ -5489,11 +5253,6 @@ malloc_print_stats(void)
allocated, mapped);
#endif
-#ifdef MALLOC_BALANCE
- malloc_printf("Arena balance reassignments: %llu\n",
- nbalance);
-#endif
-
/* Print chunk stats. */
malloc_printf(
"huge: nmalloc ndalloc allocated\n");
@@ -5584,20 +5343,16 @@ malloc_init_hard(void)
GetSystemInfo(&info);
result = info.dwPageSize;
-
-#ifndef MOZ_MEMORY_NARENAS_DEFAULT_ONE
- ncpus = info.dwNumberOfProcessors;
-#endif
}
#else
-#ifndef MOZ_MEMORY_NARENAS_DEFAULT_ONE
- ncpus = malloc_ncpus();
-#endif
-
result = sysconf(_SC_PAGESIZE);
assert(result != -1);
#endif
+#ifndef MOZ_MEMORY_NARENAS_DEFAULT_ONE
+ ncpus = malloc_ncpus();
+#endif
+
/* We assume that the page size is a power of 2. */
assert(((result - 1) & result) == 0);
#ifdef MALLOC_STATIC_SIZES
@@ -5699,18 +5454,8 @@ MALLOC_OUT:
opt_abort = true;
break;
case 'b':
-#ifdef MALLOC_BALANCE
- opt_balance_threshold >>= 1;
-#endif
- break;
case 'B':
-#ifdef MALLOC_BALANCE
- if (opt_balance_threshold == 0)
- opt_balance_threshold = 1;
- else if ((opt_balance_threshold << 1)
- > opt_balance_threshold)
- opt_balance_threshold <<= 1;
-#endif
+ // Balancing option is ignored
break;
#ifdef MALLOC_FILL
#ifndef MALLOC_PRODUCTION
@@ -5953,12 +5698,6 @@ MALLOC_OUT:
if (narenas == 0)
narenas = 1;
}
-#ifdef MALLOC_BALANCE
- assert(narenas != 0);
- for (narenas_2pow = 0;
- (narenas >> (narenas_2pow + 1)) != 0;
- narenas_2pow++);
-#endif
#ifdef NO_TLS
if (narenas > 1) {
@@ -5988,9 +5727,7 @@ MALLOC_OUT:
#endif
#ifndef NO_TLS
-# ifndef MALLOC_BALANCE
next_arena = 0;
-# endif
#endif
/* Allocate and initialize arenas. */
@@ -6031,14 +5768,6 @@ MALLOC_OUT:
#endif
#endif
- /*
- * Seed here for the initial thread, since choose_arena_hard() is only
- * called for other threads. The seed value doesn't really matter.
- */
-#ifdef MALLOC_BALANCE
- SPRN(balance, 42);
-#endif
-
malloc_spin_init(&arenas_lock);
#ifdef MALLOC_VALIDATE
@@ -6579,13 +6308,7 @@ jemalloc_stats_impl(jemalloc_stats_t *stats)
#endif
false;
stats->narenas = narenas;
- stats->balance_threshold =
-#ifdef MALLOC_BALANCE
- opt_balance_threshold
-#else
- SIZE_T_MAX
-#endif
- ;
+ stats->balance_threshold = SIZE_T_MAX;
stats->quantum = quantum;
stats->small_max = small_max;
stats->large_max = arena_maxclass;
diff --git a/memory/mozjemalloc/jemalloc_types.h b/memory/mozjemalloc/jemalloc_types.h
index ae8dc4414d..96165ae4d0 100644
--- a/memory/mozjemalloc/jemalloc_types.h
+++ b/memory/mozjemalloc/jemalloc_types.h
@@ -2,7 +2,7 @@
/* vim:set softtabstop=8 shiftwidth=8: */
/*-
* Copyright (C) 2006-2008 Jason Evans <jasone@FreeBSD.org>.
- * All rights reserved.
+ * Copyright (C) 2015-2018 Mark Straver <moonchild@palemoon.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/memory/mozjemalloc/linkedlist.h b/memory/mozjemalloc/linkedlist.h
index d755314105..acb10e56d1 100644
--- a/memory/mozjemalloc/linkedlist.h
+++ b/memory/mozjemalloc/linkedlist.h
@@ -2,7 +2,7 @@
/* vim:set softtabstop=8 shiftwidth=8 noet: */
/*-
* Copyright (C) the Mozilla Foundation.
- * All rights reserved.
+ * Copyright (C) 2015-2018 Mark Straver <moonchild@palemoon.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/memory/mozjemalloc/moz.build b/memory/mozjemalloc/moz.build
index 0660d1300a..feeb4fb07c 100644
--- a/memory/mozjemalloc/moz.build
+++ b/memory/mozjemalloc/moz.build
@@ -8,16 +8,15 @@ EXPORTS += [
'jemalloc_types.h',
]
-if not CONFIG['MOZ_JEMALLOC4']:
- SOURCES += [
- 'jemalloc.c',
- ]
- FINAL_LIBRARY = 'memory'
-
- # See bug 422055.
- if CONFIG['OS_ARCH'] == 'SunOS' and not CONFIG['GNU_CC'] \
- and CONFIG['MOZ_OPTIMIZE']:
- CFLAGS += ['-xO5']
+SOURCES += [
+ 'jemalloc.c',
+]
+FINAL_LIBRARY = 'memory'
+
+# See bug 422055.
+if CONFIG['OS_ARCH'] == 'SunOS' and not CONFIG['GNU_CC'] \
+ and CONFIG['MOZ_OPTIMIZE']:
+ CFLAGS += ['-xO5']
# For non release/esr builds, enable (some) fatal jemalloc assertions. This
# helps us catch memory errors.
diff --git a/memory/mozjemalloc/osx_zone_types.h b/memory/mozjemalloc/osx_zone_types.h
index 0979535907..603649dbc2 100644
--- a/memory/mozjemalloc/osx_zone_types.h
+++ b/memory/mozjemalloc/osx_zone_types.h
@@ -2,7 +2,7 @@
/* vim:set softtabstop=8 shiftwidth=8: */
/*-
* Copyright (C) 2006-2008 Jason Evans <jasone@FreeBSD.org>.
- * All rights reserved.
+ * Copyright (C) 2015-2018 Mark Straver <moonchild@palemoon.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/memory/mozjemalloc/ql.h b/memory/mozjemalloc/ql.h
index 000cd2380c..2fdb2d40c4 100644
--- a/memory/mozjemalloc/ql.h
+++ b/memory/mozjemalloc/ql.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Copyright (C) 2002 Jason Evans <jasone@canonware.com>.
- * All rights reserved.
+ * Copyright (C) 2015-2018 Mark Straver <moonchild@palemoon.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/memory/mozjemalloc/qr.h b/memory/mozjemalloc/qr.h
index ee60491d7f..03891664bb 100644
--- a/memory/mozjemalloc/qr.h
+++ b/memory/mozjemalloc/qr.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Copyright (C) 2002 Jason Evans <jasone@canonware.com>.
- * All rights reserved.
+ * Copyright (C) 2015-2018 Mark Straver <moonchild@palemoon.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/memory/mozjemalloc/rb.h b/memory/mozjemalloc/rb.h
index 43d8569d00..53a926d46a 100644
--- a/memory/mozjemalloc/rb.h
+++ b/memory/mozjemalloc/rb.h
@@ -1,7 +1,7 @@
/******************************************************************************
*
* Copyright (C) 2008 Jason Evans <jasone@FreeBSD.org>.
- * All rights reserved.
+ * Copyright (C) 2015-2018 Mark Straver <moonchild@palemoon.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
diff --git a/memory/replace/jemalloc/moz.build b/memory/replace/jemalloc/moz.build
deleted file mode 100644
index 5e907af55c..0000000000
--- a/memory/replace/jemalloc/moz.build
+++ /dev/null
@@ -1,31 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-SOURCES += [
- '../../build/jemalloc_config.cpp',
- '../../build/mozjemalloc_compat.c',
-]
-
-# Android doesn't have pthread_atfork, so just implement a dummy function.
-# It shouldn't make much problem, as the use of fork is pretty limited on
-# Android.
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
- SOURCES += [
- 'pthread_atfork.c',
- ]
-
-SharedLibrary('replace_jemalloc')
-
-DEFINES['MOZ_JEMALLOC4'] = True
-DEFINES['MOZ_REPLACE_JEMALLOC'] = True
-
-LOCAL_INCLUDES += ['!../../jemalloc/src/include']
-if CONFIG['_MSC_VER']:
- LOCAL_INCLUDES += ['/memory/jemalloc/src/include/msvc_compat']
- if not CONFIG['HAVE_INTTYPES_H']:
- LOCAL_INCLUDES += ['/memory/jemalloc/src/include/msvc_compat/C99']
-
-DISABLE_STL_WRAPPING = True
diff --git a/memory/replace/jemalloc/pthread_atfork.c b/memory/replace/jemalloc/pthread_atfork.c
deleted file mode 100644
index 6e737f0729..0000000000
--- a/memory/replace/jemalloc/pthread_atfork.c
+++ /dev/null
@@ -1,10 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-int pthread_atfork(void (*prefork)(void),
- void (*postfork_parent)(void),
- void (*postfork_child)(void))
-{
- return 0;
-}
diff --git a/memory/replace/logalloc/replay/Replay.cpp b/memory/replace/logalloc/replay/Replay.cpp
index 30fcd21e57..0ae20de2cc 100644
--- a/memory/replace/logalloc/replay/Replay.cpp
+++ b/memory/replace/logalloc/replay/Replay.cpp
@@ -286,7 +286,7 @@ MOZ_BEGIN_EXTERN_C
/* mozjemalloc relies on DllMain to initialize, but DllMain is not invoked
* for executables, so manually invoke mozjemalloc initialization. */
-#if defined(_WIN32) && !defined(MOZ_JEMALLOC4)
+#if defined(_WIN32)
void malloc_init_hard(void);
#endif
@@ -475,7 +475,7 @@ main()
FdReader reader(0);
Replay replay;
-#if defined(_WIN32) && !defined(MOZ_JEMALLOC4)
+#if defined(_WIN32)
malloc_init_hard();
#endif
diff --git a/memory/replace/moz.build b/memory/replace/moz.build
index 111b8456b0..e850637cbb 100644
--- a/memory/replace/moz.build
+++ b/memory/replace/moz.build
@@ -9,10 +9,6 @@ DIRS += [
'replace',
]
-# Build jemalloc3 as a replace-malloc lib when building with mozjemalloc
-if not CONFIG['MOZ_JEMALLOC4']:
- DIRS += ['jemalloc']
-
if CONFIG['MOZ_REPLACE_MALLOC_LINKAGE'] == 'dummy library':
DIRS += ['dummy']
diff --git a/mfbt/Compression.cpp b/mfbt/Compression.cpp
index c114c6c0fc..6be8020a9a 100644
--- a/mfbt/Compression.cpp
+++ b/mfbt/Compression.cpp
@@ -16,8 +16,12 @@ using namespace mozilla::Compression;
namespace {
+extern "C" {
+
#include "lz4.c"
+}
+
}/* anonymous namespace */
/* Our wrappers */
@@ -27,7 +31,8 @@ LZ4::compress(const char* aSource, size_t aInputSize, char* aDest)
{
CheckedInt<int> inputSizeChecked = aInputSize;
MOZ_ASSERT(inputSizeChecked.isValid());
- return LZ4_compress(aSource, aDest, inputSizeChecked.value());
+ return LZ4_compress_default(aSource, aDest, inputSizeChecked.value(),
+ LZ4_compressBound(inputSizeChecked.value()));
}
size_t
@@ -38,8 +43,8 @@ LZ4::compressLimitedOutput(const char* aSource, size_t aInputSize, char* aDest,
MOZ_ASSERT(inputSizeChecked.isValid());
CheckedInt<int> maxOutputSizeChecked = aMaxOutputSize;
MOZ_ASSERT(maxOutputSizeChecked.isValid());
- return LZ4_compress_limitedOutput(aSource, aDest, inputSizeChecked.value(),
- maxOutputSizeChecked.value());
+ return LZ4_compress_default(aSource, aDest, inputSizeChecked.value(),
+ maxOutputSizeChecked.value());
}
bool
diff --git a/mfbt/TextUtils.h b/mfbt/TextUtils.h
new file mode 100644
index 0000000000..9494296ce1
--- /dev/null
+++ b/mfbt/TextUtils.h
@@ -0,0 +1,58 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/* Character/text operations. */
+
+#ifndef mozilla_TextUtils_h
+#define mozilla_TextUtils_h
+
+#include "mozilla/TypeTraits.h"
+
+namespace mozilla {
+
+namespace detail {
+
+template<typename Char>
+class MakeUnsignedChar
+ : public MakeUnsigned<Char>
+{};
+
+template<>
+class MakeUnsignedChar<char16_t>
+{
+public:
+ using Type = char16_t;
+};
+
+template<>
+class MakeUnsignedChar<char32_t>
+{
+public:
+ using Type = char32_t;
+};
+
+} // namespace detail
+
+/**
+ * Returns true iff |aChar| matches [a-zA-Z].
+ *
+ * This function is basically what you thought isalpha was, except its behavior
+ * doesn't depend on the user's current locale.
+ */
+template<typename Char>
+constexpr bool
+IsAsciiAlpha(Char aChar)
+{
+ using UnsignedChar = typename detail::MakeUnsignedChar<Char>::Type;
+ return ('a' <= static_cast<UnsignedChar>(aChar) &&
+ static_cast<UnsignedChar>(aChar) <= 'z') ||
+ ('A' <= static_cast<UnsignedChar>(aChar) &&
+ static_cast<UnsignedChar>(aChar) <= 'Z');
+}
+
+} // namespace mozilla
+
+#endif /* mozilla_TextUtils_h */
diff --git a/mfbt/lz4.c b/mfbt/lz4.c
index c416fe815a..5752b4d17b 100644
--- a/mfbt/lz4.c
+++ b/mfbt/lz4.c
@@ -1,6 +1,7 @@
/*
LZ4 - Fast LZ compression algorithm
- Copyright (C) 2011-2014, Yann Collet.
+ Copyright (C) 2011-2017, Yann Collet.
+
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
Redistribution and use in source and binary forms, with or without
@@ -27,118 +28,96 @@
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
You can contact the author at :
- - LZ4 source repository : http://code.google.com/p/lz4/
- - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c
+ - LZ4 homepage : http://www.lz4.org
+ - LZ4 source repository : https://github.com/lz4/lz4
*/
-/**************************************
- Tuning parameters
+
+/*-************************************
+* Tuning parameters
**************************************/
/*
- * HEAPMODE :
+ * LZ4_HEAPMODE :
* Select how default compression functions will allocate memory for their hash table,
- * in memory stack (0:default, fastest), or in memory heap (1:requires memory allocation (malloc)).
+ * in memory stack (0:default, fastest), or in memory heap (1:requires malloc()).
*/
-#define HEAPMODE 0
-
-
-/**************************************
- CPU Feature Detection
-**************************************/
-/* 32 or 64 bits ? */
-#if (defined(__x86_64__) || defined(_M_X64) || defined(_WIN64) \
- || defined(__powerpc64__) || defined(__powerpc64le__) \
- || defined(__ppc64__) || defined(__ppc64le__) \
- || defined(__PPC64__) || defined(__PPC64LE__) \
- || defined(__ia64) || defined(__itanium__) || defined(_M_IA64) \
- || (defined(__mips64) && defined(_ABI64))) /* Detects 64 bits mode */
-# define LZ4_ARCH64 1
-#else
-# define LZ4_ARCH64 0
+#ifndef LZ4_HEAPMODE
+# define LZ4_HEAPMODE 0
#endif
/*
- * Little Endian or Big Endian ?
- * Overwrite the #define below if you know your architecture endianess
+ * ACCELERATION_DEFAULT :
+ * Select "acceleration" for LZ4_compress_fast() when parameter value <= 0
*/
-#include <stdlib.h> /* Apparently required to detect endianess */
-#if defined (__GLIBC__)
-# include <endian.h>
-# if (__BYTE_ORDER == __BIG_ENDIAN)
-# define LZ4_BIG_ENDIAN 1
+#define ACCELERATION_DEFAULT 1
+
+
+/*-************************************
+* CPU Feature Detection
+**************************************/
+/* LZ4_FORCE_MEMORY_ACCESS
+ * By default, access to unaligned memory is controlled by `memcpy()`, which is safe and portable.
+ * Unfortunately, on some target/compiler combinations, the generated assembly is sub-optimal.
+ * The below switch allow to select different access method for improved performance.
+ * Method 0 (default) : use `memcpy()`. Safe and portable.
+ * Method 1 : `__packed` statement. It depends on compiler extension (ie, not portable).
+ * This method is safe if your compiler supports it, and *generally* as fast or faster than `memcpy`.
+ * Method 2 : direct access. This method is portable but violate C standard.
+ * It can generate buggy code on targets which assembly generation depends on alignment.
+ * But in some circumstances, it's the only known way to get the most performance (ie GCC + ARMv6)
+ * See https://fastcompression.blogspot.fr/2015/08/accessing-unaligned-memory.html for details.
+ * Prefer these methods in priority order (0 > 1 > 2)
+ */
+#ifndef LZ4_FORCE_MEMORY_ACCESS /* can be defined externally */
+# if defined(__GNUC__) && ( defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) )
+# define LZ4_FORCE_MEMORY_ACCESS 2
+# elif defined(__INTEL_COMPILER) || defined(__GNUC__)
+# define LZ4_FORCE_MEMORY_ACCESS 1
# endif
-#elif (defined(__BIG_ENDIAN__) || defined(__BIG_ENDIAN) || defined(_BIG_ENDIAN)) && !(defined(__LITTLE_ENDIAN__) || defined(__LITTLE_ENDIAN) || defined(_LITTLE_ENDIAN))
-# define LZ4_BIG_ENDIAN 1
-#elif defined(__sparc) || defined(__sparc__) \
- || defined(__powerpc__) || defined(__ppc__) || defined(__PPC__) \
- || defined(__hpux) || defined(__hppa) \
- || defined(_MIPSEB) || defined(__s390__)
-# define LZ4_BIG_ENDIAN 1
-#else
-/* Little Endian assumed. PDP Endian and other very rare endian format are unsupported. */
#endif
/*
- * Unaligned memory access is automatically enabled for "common" CPU, such as x86.
- * For others CPU, such as ARM, the compiler may be more cautious, inserting unnecessary extra code to ensure aligned access property
- * If you know your target CPU supports unaligned memory access, you want to force this option manually to improve performance
+ * LZ4_FORCE_SW_BITCOUNT
+ * Define this parameter if your target system or compiler does not support hardware bit count
*/
-#if defined(__ARM_FEATURE_UNALIGNED)
-# define LZ4_FORCE_UNALIGNED_ACCESS 1
-#endif
-
-/* Define this parameter if your target system or compiler does not support hardware bit count */
#if defined(_MSC_VER) && defined(_WIN32_WCE) /* Visual Studio for Windows CE does not support Hardware bit count */
# define LZ4_FORCE_SW_BITCOUNT
#endif
-/*
- * BIG_ENDIAN_NATIVE_BUT_INCOMPATIBLE :
- * This option may provide a small boost to performance for some big endian cpu, although probably modest.
- * You may set this option to 1 if data will remain within closed environment.
- * This option is useless on Little_Endian CPU (such as x86)
- */
-/* #define BIG_ENDIAN_NATIVE_BUT_INCOMPATIBLE 1 */
+/*-************************************
+* Dependency
+**************************************/
+#include "lz4.h"
+/* see also "memory routines" below */
-/**************************************
- Compiler Options
+/*-************************************
+* Compiler Options
**************************************/
-#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */
-/* "restrict" is a known keyword */
-#else
-# define restrict /* Disable restrict */
-#endif
-
#ifdef _MSC_VER /* Visual Studio */
-# define FORCE_INLINE static __forceinline
-# include <intrin.h> /* For Visual 2005 */
-# if LZ4_ARCH64 /* 64-bits */
-# pragma intrinsic(_BitScanForward64) /* For Visual 2005 */
-# pragma intrinsic(_BitScanReverse64) /* For Visual 2005 */
-# else /* 32-bits */
-# pragma intrinsic(_BitScanForward) /* For Visual 2005 */
-# pragma intrinsic(_BitScanReverse) /* For Visual 2005 */
-# endif
+# include <intrin.h>
# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */
-#else
-# ifdef __GNUC__
-# define FORCE_INLINE static inline __attribute__((always_inline))
-# else
-# define FORCE_INLINE static inline
-# endif
-#endif
-
-#ifdef _MSC_VER /* Visual Studio */
-# define lz4_bswap16(x) _byteswap_ushort(x)
-#else
-# define lz4_bswap16(x) ((unsigned short int) ((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8)))
-#endif
-
-#define GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
+# pragma warning(disable : 4293) /* disable: C4293: too large shift (32-bits) */
+#endif /* _MSC_VER */
-#if (GCC_VERSION >= 302) || (__INTEL_COMPILER >= 800) || defined(__clang__)
+#ifndef FORCE_INLINE
+# ifdef _MSC_VER /* Visual Studio */
+# define FORCE_INLINE static __forceinline
+# else
+# if defined (__cplusplus) || defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */
+# ifdef __GNUC__
+# define FORCE_INLINE static inline __attribute__((always_inline))
+# else
+# define FORCE_INLINE static inline
+# endif
+# else
+# define FORCE_INLINE static
+# endif /* __STDC_VERSION__ */
+# endif /* _MSC_VER */
+#endif /* FORCE_INLINE */
+
+#if (defined(__GNUC__) && (__GNUC__ >= 3)) || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800)) || defined(__clang__)
# define expect(expr,value) (__builtin_expect ((expr),(value)) )
#else
# define expect(expr,value) (expr)
@@ -148,8 +127,8 @@
#define unlikely(expr) expect((expr) != 0, 0)
-/**************************************
- Memory routines
+/*-************************************
+* Memory routines
**************************************/
#include <stdlib.h> /* malloc, calloc, free */
#define ALLOCATOR(n,s) calloc(n,s)
@@ -158,84 +137,146 @@
#define MEM_INIT memset
-/**************************************
- Includes
+/*-************************************
+* Basic Types
**************************************/
-#include "lz4.h"
-
-
-/**************************************
- Basic Types
-**************************************/
-#if defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */
+#if defined(__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)
# include <stdint.h>
typedef uint8_t BYTE;
typedef uint16_t U16;
typedef uint32_t U32;
typedef int32_t S32;
typedef uint64_t U64;
+ typedef uintptr_t uptrval;
#else
typedef unsigned char BYTE;
typedef unsigned short U16;
typedef unsigned int U32;
typedef signed int S32;
typedef unsigned long long U64;
+ typedef size_t uptrval; /* generally true, except OpenVMS-64 */
#endif
-#if defined(__GNUC__) && !defined(LZ4_FORCE_UNALIGNED_ACCESS)
-# define _PACKED __attribute__ ((packed))
+#if defined(__x86_64__)
+ typedef U64 reg_t; /* 64-bits in x32 mode */
#else
-# define _PACKED
+ typedef size_t reg_t; /* 32-bits in x32 mode */
#endif
-#if !defined(LZ4_FORCE_UNALIGNED_ACCESS) && !defined(__GNUC__)
-# if defined(__IBMC__) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
-# pragma pack(1)
-# else
-# pragma pack(push, 1)
-# endif
-#endif
+/*-************************************
+* Reading and writing into memory
+**************************************/
+static unsigned LZ4_isLittleEndian(void)
+{
+ const union { U32 u; BYTE c[4]; } one = { 1 }; /* don't use static : performance detrimental */
+ return one.c[0];
+}
-typedef struct { U16 v; } _PACKED U16_S;
-typedef struct { U32 v; } _PACKED U32_S;
-typedef struct { U64 v; } _PACKED U64_S;
-typedef struct {size_t v;} _PACKED size_t_S;
-#if !defined(LZ4_FORCE_UNALIGNED_ACCESS) && !defined(__GNUC__)
-# if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
-# pragma pack(0)
-# else
-# pragma pack(pop)
-# endif
-#endif
+#if defined(LZ4_FORCE_MEMORY_ACCESS) && (LZ4_FORCE_MEMORY_ACCESS==2)
+/* lie to the compiler about data alignment; use with caution */
-#define A16(x) (((U16_S *)(x))->v)
-#define A32(x) (((U32_S *)(x))->v)
-#define A64(x) (((U64_S *)(x))->v)
-#define AARCH(x) (((size_t_S *)(x))->v)
+static U16 LZ4_read16(const void* memPtr) { return *(const U16*) memPtr; }
+static U32 LZ4_read32(const void* memPtr) { return *(const U32*) memPtr; }
+static reg_t LZ4_read_ARCH(const void* memPtr) { return *(const reg_t*) memPtr; }
+static void LZ4_write16(void* memPtr, U16 value) { *(U16*)memPtr = value; }
+static void LZ4_write32(void* memPtr, U32 value) { *(U32*)memPtr = value; }
-/**************************************
- Constants
-**************************************/
-#define LZ4_HASHLOG (LZ4_MEMORY_USAGE-2)
-#define HASHTABLESIZE (1 << LZ4_MEMORY_USAGE)
-#define HASH_SIZE_U32 (1 << LZ4_HASHLOG)
+#elif defined(LZ4_FORCE_MEMORY_ACCESS) && (LZ4_FORCE_MEMORY_ACCESS==1)
+
+/* __pack instructions are safer, but compiler specific, hence potentially problematic for some compilers */
+/* currently only defined for gcc and icc */
+typedef union { U16 u16; U32 u32; reg_t uArch; } __attribute__((packed)) unalign;
+
+static U16 LZ4_read16(const void* ptr) { return ((const unalign*)ptr)->u16; }
+static U32 LZ4_read32(const void* ptr) { return ((const unalign*)ptr)->u32; }
+static reg_t LZ4_read_ARCH(const void* ptr) { return ((const unalign*)ptr)->uArch; }
+
+static void LZ4_write16(void* memPtr, U16 value) { ((unalign*)memPtr)->u16 = value; }
+static void LZ4_write32(void* memPtr, U32 value) { ((unalign*)memPtr)->u32 = value; }
+
+#else /* safe and portable access through memcpy() */
+static U16 LZ4_read16(const void* memPtr)
+{
+ U16 val; memcpy(&val, memPtr, sizeof(val)); return val;
+}
+
+static U32 LZ4_read32(const void* memPtr)
+{
+ U32 val; memcpy(&val, memPtr, sizeof(val)); return val;
+}
+
+static reg_t LZ4_read_ARCH(const void* memPtr)
+{
+ reg_t val; memcpy(&val, memPtr, sizeof(val)); return val;
+}
+
+static void LZ4_write16(void* memPtr, U16 value)
+{
+ memcpy(memPtr, &value, sizeof(value));
+}
+
+static void LZ4_write32(void* memPtr, U32 value)
+{
+ memcpy(memPtr, &value, sizeof(value));
+}
+
+#endif /* LZ4_FORCE_MEMORY_ACCESS */
+
+
+static U16 LZ4_readLE16(const void* memPtr)
+{
+ if (LZ4_isLittleEndian()) {
+ return LZ4_read16(memPtr);
+ } else {
+ const BYTE* p = (const BYTE*)memPtr;
+ return (U16)((U16)p[0] + (p[1]<<8));
+ }
+}
+
+static void LZ4_writeLE16(void* memPtr, U16 value)
+{
+ if (LZ4_isLittleEndian()) {
+ LZ4_write16(memPtr, value);
+ } else {
+ BYTE* p = (BYTE*)memPtr;
+ p[0] = (BYTE) value;
+ p[1] = (BYTE)(value>>8);
+ }
+}
+
+static void LZ4_copy8(void* dst, const void* src)
+{
+ memcpy(dst,src,8);
+}
+
+/* customized variant of memcpy, which can overwrite up to 8 bytes beyond dstEnd */
+static void LZ4_wildCopy(void* dstPtr, const void* srcPtr, void* dstEnd)
+{
+ BYTE* d = (BYTE*)dstPtr;
+ const BYTE* s = (const BYTE*)srcPtr;
+ BYTE* const e = (BYTE*)dstEnd;
+
+ do { LZ4_copy8(d,s); d+=8; s+=8; } while (d<e);
+}
+
+
+/*-************************************
+* Common Constants
+**************************************/
#define MINMATCH 4
-#define COPYLENGTH 8
+#define WILDCOPYLENGTH 8
#define LASTLITERALS 5
-#define MFLIMIT (COPYLENGTH+MINMATCH)
+#define MFLIMIT (WILDCOPYLENGTH+MINMATCH)
static const int LZ4_minLength = (MFLIMIT+1);
-#define KB *(1U<<10)
-#define MB *(1U<<20)
+#define KB *(1 <<10)
+#define MB *(1 <<20)
#define GB *(1U<<30)
-#define LZ4_64KLIMIT ((64 KB) + (MFLIMIT-1))
-#define SKIPSTRENGTH 6 /* Increasing this value will make the compression run slower on incompressible data */
-
#define MAXD_LOG 16
#define MAX_DISTANCE ((1 << MAXD_LOG) - 1)
@@ -245,208 +286,213 @@ static const int LZ4_minLength = (MFLIMIT+1);
#define RUN_MASK ((1U<<RUN_BITS)-1)
-/**************************************
- Structures and local types
+/*-************************************
+* Error detection
**************************************/
-typedef struct {
- U32 hashTable[HASH_SIZE_U32];
- U32 currentOffset;
- U32 initCheck;
- const BYTE* dictionary;
- const BYTE* bufferStart;
- U32 dictSize;
-} LZ4_stream_t_internal;
+#define LZ4_STATIC_ASSERT(c) { enum { LZ4_static_assert = 1/(int)(!!(c)) }; } /* use only *after* variable declarations */
+
+#if defined(LZ4_DEBUG) && (LZ4_DEBUG>=2)
+# include <stdio.h>
+# define DEBUGLOG(l, ...) { \
+ if (l<=LZ4_DEBUG) { \
+ fprintf(stderr, __FILE__ ": "); \
+ fprintf(stderr, __VA_ARGS__); \
+ fprintf(stderr, " \n"); \
+ } }
+#else
+# define DEBUGLOG(l, ...) {} /* disabled */
+#endif
-typedef enum { notLimited = 0, limitedOutput = 1 } limitedOutput_directive;
-typedef enum { byPtr, byU32, byU16 } tableType_t;
-typedef enum { noDict = 0, withPrefix64k, usingExtDict } dict_directive;
-typedef enum { noDictIssue = 0, dictSmall } dictIssue_directive;
+/*-************************************
+* Common functions
+**************************************/
+static unsigned LZ4_NbCommonBytes (register reg_t val)
+{
+ if (LZ4_isLittleEndian()) {
+ if (sizeof(val)==8) {
+# if defined(_MSC_VER) && defined(_WIN64) && !defined(LZ4_FORCE_SW_BITCOUNT)
+ unsigned long r = 0;
+ _BitScanForward64( &r, (U64)val );
+ return (int)(r>>3);
+# elif (defined(__clang__) || (defined(__GNUC__) && (__GNUC__>=3))) && !defined(LZ4_FORCE_SW_BITCOUNT)
+ return (__builtin_ctzll((U64)val) >> 3);
+# else
+ static const int DeBruijnBytePos[64] = { 0, 0, 0, 0, 0, 1, 1, 2, 0, 3, 1, 3, 1, 4, 2, 7, 0, 2, 3, 6, 1, 5, 3, 5, 1, 3, 4, 4, 2, 5, 6, 7, 7, 0, 1, 2, 3, 3, 4, 6, 2, 6, 5, 5, 3, 4, 5, 6, 7, 1, 2, 4, 6, 4, 4, 5, 7, 2, 6, 5, 7, 6, 7, 7 };
+ return DeBruijnBytePos[((U64)((val & -(long long)val) * 0x0218A392CDABBD3FULL)) >> 58];
+# endif
+ } else /* 32 bits */ {
+# if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT)
+ unsigned long r;
+ _BitScanForward( &r, (U32)val );
+ return (int)(r>>3);
+# elif (defined(__clang__) || (defined(__GNUC__) && (__GNUC__>=3))) && !defined(LZ4_FORCE_SW_BITCOUNT)
+ return (__builtin_ctz((U32)val) >> 3);
+# else
+ static const int DeBruijnBytePos[32] = { 0, 0, 3, 0, 3, 1, 3, 0, 3, 2, 2, 1, 3, 2, 0, 1, 3, 3, 1, 2, 2, 2, 2, 0, 3, 1, 2, 0, 1, 0, 1, 1 };
+ return DeBruijnBytePos[((U32)((val & -(S32)val) * 0x077CB531U)) >> 27];
+# endif
+ }
+ } else /* Big Endian CPU */ {
+ if (sizeof(val)==8) {
+# if defined(_MSC_VER) && defined(_WIN64) && !defined(LZ4_FORCE_SW_BITCOUNT)
+ unsigned long r = 0;
+ _BitScanReverse64( &r, val );
+ return (unsigned)(r>>3);
+# elif (defined(__clang__) || (defined(__GNUC__) && (__GNUC__>=3))) && !defined(LZ4_FORCE_SW_BITCOUNT)
+ return (__builtin_clzll((U64)val) >> 3);
+# else
+ unsigned r;
+ if (!(val>>32)) { r=4; } else { r=0; val>>=32; }
+ if (!(val>>16)) { r+=2; val>>=8; } else { val>>=24; }
+ r += (!val);
+ return r;
+# endif
+ } else /* 32 bits */ {
+# if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT)
+ unsigned long r = 0;
+ _BitScanReverse( &r, (unsigned long)val );
+ return (unsigned)(r>>3);
+# elif (defined(__clang__) || (defined(__GNUC__) && (__GNUC__>=3))) && !defined(LZ4_FORCE_SW_BITCOUNT)
+ return (__builtin_clz((U32)val) >> 3);
+# else
+ unsigned r;
+ if (!(val>>16)) { r=2; val>>=8; } else { r=0; val>>=24; }
+ r += (!val);
+ return r;
+# endif
+ }
+ }
+}
-typedef enum { endOnOutputSize = 0, endOnInputSize = 1 } endCondition_directive;
-typedef enum { full = 0, partial = 1 } earlyEnd_directive;
+#define STEPSIZE sizeof(reg_t)
+static unsigned LZ4_count(const BYTE* pIn, const BYTE* pMatch, const BYTE* pInLimit)
+{
+ const BYTE* const pStart = pIn;
+ while (likely(pIn<pInLimit-(STEPSIZE-1))) {
+ reg_t const diff = LZ4_read_ARCH(pMatch) ^ LZ4_read_ARCH(pIn);
+ if (!diff) { pIn+=STEPSIZE; pMatch+=STEPSIZE; continue; }
+ pIn += LZ4_NbCommonBytes(diff);
+ return (unsigned)(pIn - pStart);
+ }
-/**************************************
- Architecture-specific macros
-**************************************/
-#define STEPSIZE sizeof(size_t)
-#define LZ4_COPYSTEP(d,s) { AARCH(d) = AARCH(s); d+=STEPSIZE; s+=STEPSIZE; }
-#define LZ4_COPY8(d,s) { LZ4_COPYSTEP(d,s); if (STEPSIZE<8) LZ4_COPYSTEP(d,s); }
-
-#if (defined(LZ4_BIG_ENDIAN) && !defined(BIG_ENDIAN_NATIVE_BUT_INCOMPATIBLE))
-# define LZ4_READ_LITTLEENDIAN_16(d,s,p) { U16 v = A16(p); v = lz4_bswap16(v); d = (s) - v; }
-# define LZ4_WRITE_LITTLEENDIAN_16(p,i) { U16 v = (U16)(i); v = lz4_bswap16(v); A16(p) = v; p+=2; }
-#else /* Little Endian */
-# define LZ4_READ_LITTLEENDIAN_16(d,s,p) { d = (s) - A16(p); }
-# define LZ4_WRITE_LITTLEENDIAN_16(p,v) { A16(p) = v; p+=2; }
-#endif
+ if ((STEPSIZE==8) && (pIn<(pInLimit-3)) && (LZ4_read32(pMatch) == LZ4_read32(pIn))) { pIn+=4; pMatch+=4; }
+ if ((pIn<(pInLimit-1)) && (LZ4_read16(pMatch) == LZ4_read16(pIn))) { pIn+=2; pMatch+=2; }
+ if ((pIn<pInLimit) && (*pMatch == *pIn)) pIn++;
+ return (unsigned)(pIn - pStart);
+}
-/**************************************
- Macros
+#ifndef LZ4_COMMONDEFS_ONLY
+/*-************************************
+* Local Constants
**************************************/
-#define LZ4_STATIC_ASSERT(c) { enum { LZ4_static_assert = 1/(!!(c)) }; } /* use only *after* variable declarations */
-#if LZ4_ARCH64 || !defined(__GNUC__)
-# define LZ4_WILDCOPY(d,s,e) { do { LZ4_COPY8(d,s) } while (d<e); } /* at the end, d>=e; */
-#else
-# define LZ4_WILDCOPY(d,s,e) { if (likely(e-d <= 8)) LZ4_COPY8(d,s) else do { LZ4_COPY8(d,s) } while (d<e); }
-#endif
+static const int LZ4_64Klimit = ((64 KB) + (MFLIMIT-1));
+static const U32 LZ4_skipTrigger = 6; /* Increase this value ==> compression run slower on incompressible data */
-/****************************
- Private local functions
-****************************/
-#if LZ4_ARCH64
+/*-************************************
+* Local Structures and types
+**************************************/
+typedef enum { notLimited = 0, limitedOutput = 1 } limitedOutput_directive;
+typedef enum { byPtr, byU32, byU16 } tableType_t;
-int LZ4_NbCommonBytes (register U64 val)
-{
-# if defined(LZ4_BIG_ENDIAN)
-# if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT)
- unsigned long r = 0;
- _BitScanReverse64( &r, val );
- return (int)(r>>3);
-# elif defined(__GNUC__) && (GCC_VERSION >= 304) && !defined(LZ4_FORCE_SW_BITCOUNT)
- return (__builtin_clzll(val) >> 3);
-# else
- int r;
- if (!(val>>32)) { r=4; } else { r=0; val>>=32; }
- if (!(val>>16)) { r+=2; val>>=8; } else { val>>=24; }
- r += (!val);
- return r;
-# endif
-# else
-# if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT)
- unsigned long r = 0;
- _BitScanForward64( &r, val );
- return (int)(r>>3);
-# elif defined(__GNUC__) && (GCC_VERSION >= 304) && !defined(LZ4_FORCE_SW_BITCOUNT)
- return (__builtin_ctzll(val) >> 3);
-# else
- static const int DeBruijnBytePos[64] = { 0, 0, 0, 0, 0, 1, 1, 2, 0, 3, 1, 3, 1, 4, 2, 7, 0, 2, 3, 6, 1, 5, 3, 5, 1, 3, 4, 4, 2, 5, 6, 7, 7, 0, 1, 2, 3, 3, 4, 6, 2, 6, 5, 5, 3, 4, 5, 6, 7, 1, 2, 4, 6, 4, 4, 5, 7, 2, 6, 5, 7, 6, 7, 7 };
- return DeBruijnBytePos[((U64)((val & -(long long)val) * 0x0218A392CDABBD3FULL)) >> 58];
-# endif
-# endif
-}
+typedef enum { noDict = 0, withPrefix64k, usingExtDict } dict_directive;
+typedef enum { noDictIssue = 0, dictSmall } dictIssue_directive;
-#else
+typedef enum { endOnOutputSize = 0, endOnInputSize = 1 } endCondition_directive;
+typedef enum { full = 0, partial = 1 } earlyEnd_directive;
-int LZ4_NbCommonBytes (register U32 val)
-{
-# if defined(LZ4_BIG_ENDIAN)
-# if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT)
- unsigned long r = 0;
- _BitScanReverse( &r, val );
- return (int)(r>>3);
-# elif defined(__GNUC__) && (GCC_VERSION >= 304) && !defined(LZ4_FORCE_SW_BITCOUNT)
- return (__builtin_clz(val) >> 3);
-# else
- int r;
- if (!(val>>16)) { r=2; val>>=8; } else { r=0; val>>=24; }
- r += (!val);
- return r;
-# endif
-# else
-# if defined(_MSC_VER) && !defined(LZ4_FORCE_SW_BITCOUNT)
- unsigned long r;
- _BitScanForward( &r, val );
- return (int)(r>>3);
-# elif defined(__GNUC__) && (GCC_VERSION >= 304) && !defined(LZ4_FORCE_SW_BITCOUNT)
- return (__builtin_ctz(val) >> 3);
-# else
- static const int DeBruijnBytePos[32] = { 0, 0, 3, 0, 3, 1, 3, 0, 3, 2, 2, 1, 3, 2, 0, 1, 3, 3, 1, 2, 2, 2, 2, 0, 3, 1, 2, 0, 1, 0, 1, 1 };
- return DeBruijnBytePos[((U32)((val & -(S32)val) * 0x077CB531U)) >> 27];
-# endif
-# endif
-}
-#endif
+/*-************************************
+* Local Utils
+**************************************/
+int LZ4_versionNumber (void) { return LZ4_VERSION_NUMBER; }
+const char* LZ4_versionString(void) { return LZ4_VERSION_STRING; }
+int LZ4_compressBound(int isize) { return LZ4_COMPRESSBOUND(isize); }
+int LZ4_sizeofState() { return LZ4_STREAMSIZE; }
-/********************************
- Compression functions
+/*-******************************
+* Compression functions
********************************/
-int LZ4_compressBound(int isize) { return LZ4_COMPRESSBOUND(isize); }
-
-static int LZ4_hashSequence(U32 sequence, tableType_t tableType)
+static U32 LZ4_hash4(U32 sequence, tableType_t const tableType)
{
if (tableType == byU16)
- return (((sequence) * 2654435761U) >> ((MINMATCH*8)-(LZ4_HASHLOG+1)));
+ return ((sequence * 2654435761U) >> ((MINMATCH*8)-(LZ4_HASHLOG+1)));
else
- return (((sequence) * 2654435761U) >> ((MINMATCH*8)-LZ4_HASHLOG));
+ return ((sequence * 2654435761U) >> ((MINMATCH*8)-LZ4_HASHLOG));
}
-static int LZ4_hashPosition(const BYTE* p, tableType_t tableType) { return LZ4_hashSequence(A32(p), tableType); }
+static U32 LZ4_hash5(U64 sequence, tableType_t const tableType)
+{
+ static const U64 prime5bytes = 889523592379ULL;
+ static const U64 prime8bytes = 11400714785074694791ULL;
+ const U32 hashLog = (tableType == byU16) ? LZ4_HASHLOG+1 : LZ4_HASHLOG;
+ if (LZ4_isLittleEndian())
+ return (U32)(((sequence << 24) * prime5bytes) >> (64 - hashLog));
+ else
+ return (U32)(((sequence >> 24) * prime8bytes) >> (64 - hashLog));
+}
+
+FORCE_INLINE U32 LZ4_hashPosition(const void* const p, tableType_t const tableType)
+{
+ if ((sizeof(reg_t)==8) && (tableType != byU16)) return LZ4_hash5(LZ4_read_ARCH(p), tableType);
+ return LZ4_hash4(LZ4_read32(p), tableType);
+}
-static void LZ4_putPositionOnHash(const BYTE* p, U32 h, void* tableBase, tableType_t tableType, const BYTE* srcBase)
+static void LZ4_putPositionOnHash(const BYTE* p, U32 h, void* tableBase, tableType_t const tableType, const BYTE* srcBase)
{
switch (tableType)
{
- case byPtr: { const BYTE** hashTable = (const BYTE**) tableBase; hashTable[h] = p; break; }
- case byU32: { U32* hashTable = (U32*) tableBase; hashTable[h] = (U32)(p-srcBase); break; }
- case byU16: { U16* hashTable = (U16*) tableBase; hashTable[h] = (U16)(p-srcBase); break; }
+ case byPtr: { const BYTE** hashTable = (const BYTE**)tableBase; hashTable[h] = p; return; }
+ case byU32: { U32* hashTable = (U32*) tableBase; hashTable[h] = (U32)(p-srcBase); return; }
+ case byU16: { U16* hashTable = (U16*) tableBase; hashTable[h] = (U16)(p-srcBase); return; }
}
}
-static void LZ4_putPosition(const BYTE* p, void* tableBase, tableType_t tableType, const BYTE* srcBase)
+FORCE_INLINE void LZ4_putPosition(const BYTE* p, void* tableBase, tableType_t tableType, const BYTE* srcBase)
{
- U32 h = LZ4_hashPosition(p, tableType);
+ U32 const h = LZ4_hashPosition(p, tableType);
LZ4_putPositionOnHash(p, h, tableBase, tableType, srcBase);
}
static const BYTE* LZ4_getPositionOnHash(U32 h, void* tableBase, tableType_t tableType, const BYTE* srcBase)
{
if (tableType == byPtr) { const BYTE** hashTable = (const BYTE**) tableBase; return hashTable[h]; }
- if (tableType == byU32) { U32* hashTable = (U32*) tableBase; return hashTable[h] + srcBase; }
- { U16* hashTable = (U16*) tableBase; return hashTable[h] + srcBase; } /* default, to ensure a return */
+ if (tableType == byU32) { const U32* const hashTable = (U32*) tableBase; return hashTable[h] + srcBase; }
+ { const U16* const hashTable = (U16*) tableBase; return hashTable[h] + srcBase; } /* default, to ensure a return */
}
-static const BYTE* LZ4_getPosition(const BYTE* p, void* tableBase, tableType_t tableType, const BYTE* srcBase)
+FORCE_INLINE const BYTE* LZ4_getPosition(const BYTE* p, void* tableBase, tableType_t tableType, const BYTE* srcBase)
{
- U32 h = LZ4_hashPosition(p, tableType);
+ U32 const h = LZ4_hashPosition(p, tableType);
return LZ4_getPositionOnHash(h, tableBase, tableType, srcBase);
}
-static unsigned LZ4_count(const BYTE* pIn, const BYTE* pRef, const BYTE* pInLimit)
-{
- const BYTE* const pStart = pIn;
-
- while (likely(pIn<pInLimit-(STEPSIZE-1)))
- {
- size_t diff = AARCH(pRef) ^ AARCH(pIn);
- if (!diff) { pIn+=STEPSIZE; pRef+=STEPSIZE; continue; }
- pIn += LZ4_NbCommonBytes(diff);
- return (unsigned)(pIn - pStart);
- }
- if (sizeof(void*)==8) if ((pIn<(pInLimit-3)) && (A32(pRef) == A32(pIn))) { pIn+=4; pRef+=4; }
- if ((pIn<(pInLimit-1)) && (A16(pRef) == A16(pIn))) { pIn+=2; pRef+=2; }
- if ((pIn<pInLimit) && (*pRef == *pIn)) pIn++;
-
- return (unsigned)(pIn - pStart);
-}
-
-static int LZ4_compress_generic(
- void* ctx,
- const char* source,
- char* dest,
- int inputSize,
- int maxOutputSize,
-
- limitedOutput_directive outputLimited,
- tableType_t tableType,
- dict_directive dict,
- dictIssue_directive dictIssue)
+/** LZ4_compress_generic() :
+ inlined, to ensure branches are decided at compilation time */
+FORCE_INLINE int LZ4_compress_generic(
+ LZ4_stream_t_internal* const cctx,
+ const char* const source,
+ char* const dest,
+ const int inputSize,
+ const int maxOutputSize,
+ const limitedOutput_directive outputLimited,
+ const tableType_t tableType,
+ const dict_directive dict,
+ const dictIssue_directive dictIssue,
+ const U32 acceleration)
{
- LZ4_stream_t_internal* const dictPtr = (LZ4_stream_t_internal*)ctx;
-
const BYTE* ip = (const BYTE*) source;
const BYTE* base;
const BYTE* lowLimit;
- const BYTE* const lowRefLimit = ip - dictPtr->dictSize;
- const BYTE* const dictionary = dictPtr->dictionary;
- const BYTE* const dictEnd = dictionary + dictPtr->dictSize;
- const size_t dictDelta = dictEnd - (const BYTE*)source;
+ const BYTE* const lowRefLimit = ip - cctx->dictSize;
+ const BYTE* const dictionary = cctx->dictionary;
+ const BYTE* const dictEnd = dictionary + cctx->dictSize;
+ const ptrdiff_t dictDelta = dictEnd - (const BYTE*)source;
const BYTE* anchor = (const BYTE*) source;
const BYTE* const iend = ip + inputSize;
const BYTE* const mflimit = iend - MFLIMIT;
@@ -455,12 +501,10 @@ static int LZ4_compress_generic(
BYTE* op = (BYTE*) dest;
BYTE* const olimit = op + maxOutputSize;
- const int skipStrength = SKIPSTRENGTH;
U32 forwardH;
- size_t refDelta=0;
/* Init conditions */
- if ((U32)inputSize > (U32)LZ4_MAX_INPUT_SIZE) return 0; /* Unsupported input size, too large (or negative) */
+ if ((U32)inputSize > (U32)LZ4_MAX_INPUT_SIZE) return 0; /* Unsupported inputSize, too large (or negative) */
switch(dict)
{
case noDict:
@@ -469,125 +513,118 @@ static int LZ4_compress_generic(
lowLimit = (const BYTE*)source;
break;
case withPrefix64k:
- base = (const BYTE*)source - dictPtr->currentOffset;
- lowLimit = (const BYTE*)source - dictPtr->dictSize;
+ base = (const BYTE*)source - cctx->currentOffset;
+ lowLimit = (const BYTE*)source - cctx->dictSize;
break;
case usingExtDict:
- base = (const BYTE*)source - dictPtr->currentOffset;
+ base = (const BYTE*)source - cctx->currentOffset;
lowLimit = (const BYTE*)source;
break;
}
- if ((tableType == byU16) && (inputSize>=(int)LZ4_64KLIMIT)) return 0; /* Size too large (not within 64K limit) */
- if (inputSize<LZ4_minLength) goto _last_literals; /* Input too small, no compression (all literals) */
+ if ((tableType == byU16) && (inputSize>=LZ4_64Klimit)) return 0; /* Size too large (not within 64K limit) */
+ if (inputSize<LZ4_minLength) goto _last_literals; /* Input too small, no compression (all literals) */
/* First Byte */
- LZ4_putPosition(ip, ctx, tableType, base);
+ LZ4_putPosition(ip, cctx->hashTable, tableType, base);
ip++; forwardH = LZ4_hashPosition(ip, tableType);
/* Main Loop */
- for ( ; ; )
- {
- const BYTE* ref;
+ for ( ; ; ) {
+ ptrdiff_t refDelta = 0;
+ const BYTE* match;
BYTE* token;
- {
- const BYTE* forwardIp = ip;
- unsigned step=1;
- unsigned searchMatchNb = (1U << skipStrength);
- /* Find a match */
+ /* Find a match */
+ { const BYTE* forwardIp = ip;
+ unsigned step = 1;
+ unsigned searchMatchNb = acceleration << LZ4_skipTrigger;
do {
- U32 h = forwardH;
+ U32 const h = forwardH;
ip = forwardIp;
forwardIp += step;
- step = searchMatchNb++ >> skipStrength;
- //if (step>8) step=8; // required for valid forwardIp ; slows down uncompressible data a bit
+ step = (searchMatchNb++ >> LZ4_skipTrigger);
if (unlikely(forwardIp > mflimit)) goto _last_literals;
- ref = LZ4_getPositionOnHash(h, ctx, tableType, base);
- if (dict==usingExtDict)
- {
- if (ref<(const BYTE*)source)
- {
+ match = LZ4_getPositionOnHash(h, cctx->hashTable, tableType, base);
+ if (dict==usingExtDict) {
+ if (match < (const BYTE*)source) {
refDelta = dictDelta;
lowLimit = dictionary;
- }
- else
- {
+ } else {
refDelta = 0;
lowLimit = (const BYTE*)source;
- }
- }
+ } }
forwardH = LZ4_hashPosition(forwardIp, tableType);
- LZ4_putPositionOnHash(ip, h, ctx, tableType, base);
+ LZ4_putPositionOnHash(ip, h, cctx->hashTable, tableType, base);
- } while ( ((dictIssue==dictSmall) ? (ref < lowRefLimit) : 0)
- || ((tableType==byU16) ? 0 : (ref + MAX_DISTANCE < ip))
- || (A32(ref+refDelta) != A32(ip)) );
+ } while ( ((dictIssue==dictSmall) ? (match < lowRefLimit) : 0)
+ || ((tableType==byU16) ? 0 : (match + MAX_DISTANCE < ip))
+ || (LZ4_read32(match+refDelta) != LZ4_read32(ip)) );
}
/* Catch up */
- while ((ip>anchor) && (ref+refDelta > lowLimit) && (unlikely(ip[-1]==ref[refDelta-1]))) { ip--; ref--; }
+ while (((ip>anchor) & (match+refDelta > lowLimit)) && (unlikely(ip[-1]==match[refDelta-1]))) { ip--; match--; }
- {
- /* Encode Literal length */
- unsigned litLength = (unsigned)(ip - anchor);
+ /* Encode Literals */
+ { unsigned const litLength = (unsigned)(ip - anchor);
token = op++;
- if ((outputLimited) && (unlikely(op + litLength + (2 + 1 + LASTLITERALS) + (litLength/255) > olimit)))
- return 0; /* Check output limit */
- if (litLength>=RUN_MASK)
- {
+ if ((outputLimited) && /* Check output buffer overflow */
+ (unlikely(op + litLength + (2 + 1 + LASTLITERALS) + (litLength/255) > olimit)))
+ return 0;
+ if (litLength >= RUN_MASK) {
int len = (int)litLength-RUN_MASK;
- *token=(RUN_MASK<<ML_BITS);
+ *token = (RUN_MASK<<ML_BITS);
for(; len >= 255 ; len-=255) *op++ = 255;
*op++ = (BYTE)len;
}
else *token = (BYTE)(litLength<<ML_BITS);
/* Copy Literals */
- { BYTE* end = op+litLength; LZ4_WILDCOPY(op,anchor,end); op=end; }
+ LZ4_wildCopy(op, anchor, op+litLength);
+ op+=litLength;
}
_next_match:
/* Encode Offset */
- LZ4_WRITE_LITTLEENDIAN_16(op, (U16)(ip-ref));
+ LZ4_writeLE16(op, (U16)(ip-match)); op+=2;
/* Encode MatchLength */
- {
- unsigned matchLength;
+ { unsigned matchCode;
- if ((dict==usingExtDict) && (lowLimit==dictionary))
- {
+ if ((dict==usingExtDict) && (lowLimit==dictionary)) {
const BYTE* limit;
- ref += refDelta;
- limit = ip + (dictEnd-ref);
+ match += refDelta;
+ limit = ip + (dictEnd-match);
if (limit > matchlimit) limit = matchlimit;
- matchLength = LZ4_count(ip+MINMATCH, ref+MINMATCH, limit);
- ip += MINMATCH + matchLength;
- if (ip==limit)
- {
- unsigned more = LZ4_count(ip, (const BYTE*)source, matchlimit);
- matchLength += more;
+ matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, limit);
+ ip += MINMATCH + matchCode;
+ if (ip==limit) {
+ unsigned const more = LZ4_count(ip, (const BYTE*)source, matchlimit);
+ matchCode += more;
ip += more;
}
- }
- else
- {
- matchLength = LZ4_count(ip+MINMATCH, ref+MINMATCH, matchlimit);
- ip += MINMATCH + matchLength;
+ } else {
+ matchCode = LZ4_count(ip+MINMATCH, match+MINMATCH, matchlimit);
+ ip += MINMATCH + matchCode;
}
- if (matchLength>=ML_MASK)
- {
- if ((outputLimited) && (unlikely(op + (1 + LASTLITERALS) + (matchLength>>8) > olimit)))
- return 0; /* Check output limit */
+ if ( outputLimited && /* Check output buffer overflow */
+ (unlikely(op + (1 + LASTLITERALS) + (matchCode>>8) > olimit)) )
+ return 0;
+ if (matchCode >= ML_MASK) {
*token += ML_MASK;
- matchLength -= ML_MASK;
- for (; matchLength >= 510 ; matchLength-=510) { *op++ = 255; *op++ = 255; }
- if (matchLength >= 255) { matchLength-=255; *op++ = 255; }
- *op++ = (BYTE)matchLength;
- }
- else *token += (BYTE)(matchLength);
+ matchCode -= ML_MASK;
+ LZ4_write32(op, 0xFFFFFFFF);
+ while (matchCode >= 4*255) {
+ op+=4;
+ LZ4_write32(op, 0xFFFFFFFF);
+ matchCode -= 4*255;
+ }
+ op += matchCode / 255;
+ *op++ = (BYTE)(matchCode % 255);
+ } else
+ *token += (BYTE)(matchCode);
}
anchor = ip;
@@ -596,27 +633,22 @@ _next_match:
if (ip > mflimit) break;
/* Fill table */
- LZ4_putPosition(ip-2, ctx, tableType, base);
+ LZ4_putPosition(ip-2, cctx->hashTable, tableType, base);
/* Test next position */
- ref = LZ4_getPosition(ip, ctx, tableType, base);
- if (dict==usingExtDict)
- {
- if (ref<(const BYTE*)source)
- {
+ match = LZ4_getPosition(ip, cctx->hashTable, tableType, base);
+ if (dict==usingExtDict) {
+ if (match < (const BYTE*)source) {
refDelta = dictDelta;
lowLimit = dictionary;
- }
- else
- {
+ } else {
refDelta = 0;
lowLimit = (const BYTE*)source;
- }
- }
- LZ4_putPosition(ip, ctx, tableType, base);
- if ( ((dictIssue==dictSmall) ? (ref>=lowRefLimit) : 1)
- && (ref+MAX_DISTANCE>=ip)
- && (A32(ref+refDelta)==A32(ip)) )
+ } }
+ LZ4_putPosition(ip, cctx->hashTable, tableType, base);
+ if ( ((dictIssue==dictSmall) ? (match>=lowRefLimit) : 1)
+ && (match+MAX_DISTANCE>=ip)
+ && (LZ4_read32(match+refDelta)==LZ4_read32(ip)) )
{ token=op++; *token=0; goto _next_match; }
/* Prepare next loop */
@@ -625,14 +657,20 @@ _next_match:
_last_literals:
/* Encode Last Literals */
- {
- int lastRun = (int)(iend - anchor);
- if ((outputLimited) && (((char*)op - dest) + lastRun + 1 + ((lastRun+255-RUN_MASK)/255) > (U32)maxOutputSize))
- return 0; /* Check output limit */
- if (lastRun>=(int)RUN_MASK) { *op++=(RUN_MASK<<ML_BITS); lastRun-=RUN_MASK; for(; lastRun >= 255 ; lastRun-=255) *op++ = 255; *op++ = (BYTE) lastRun; }
- else *op++ = (BYTE)(lastRun<<ML_BITS);
- memcpy(op, anchor, iend - anchor);
- op += iend-anchor;
+ { size_t const lastRun = (size_t)(iend - anchor);
+ if ( (outputLimited) && /* Check output buffer overflow */
+ ((op - (BYTE*)dest) + lastRun + 1 + ((lastRun+255-RUN_MASK)/255) > (U32)maxOutputSize) )
+ return 0;
+ if (lastRun >= RUN_MASK) {
+ size_t accumulator = lastRun - RUN_MASK;
+ *op++ = RUN_MASK << ML_BITS;
+ for(; accumulator >= 255 ; accumulator-=255) *op++ = 255;
+ *op++ = (BYTE) accumulator;
+ } else {
+ *op++ = (BYTE)(lastRun<<ML_BITS);
+ }
+ memcpy(op, anchor, lastRun);
+ op += lastRun;
}
/* End */
@@ -640,109 +678,325 @@ _last_literals:
}
-int LZ4_compress(const char* source, char* dest, int inputSize)
+int LZ4_compress_fast_extState(void* state, const char* source, char* dest, int inputSize, int maxOutputSize, int acceleration)
{
-#if (HEAPMODE)
- void* ctx = ALLOCATOR(LZ4_STREAMSIZE_U32, 4); /* Aligned on 4-bytes boundaries */
+ LZ4_stream_t_internal* ctx = &((LZ4_stream_t*)state)->internal_donotuse;
+ LZ4_resetStream((LZ4_stream_t*)state);
+ if (acceleration < 1) acceleration = ACCELERATION_DEFAULT;
+
+ if (maxOutputSize >= LZ4_compressBound(inputSize)) {
+ if (inputSize < LZ4_64Klimit)
+ return LZ4_compress_generic(ctx, source, dest, inputSize, 0, notLimited, byU16, noDict, noDictIssue, acceleration);
+ else
+ return LZ4_compress_generic(ctx, source, dest, inputSize, 0, notLimited, (sizeof(void*)==8) ? byU32 : byPtr, noDict, noDictIssue, acceleration);
+ } else {
+ if (inputSize < LZ4_64Klimit)
+ return LZ4_compress_generic(ctx, source, dest, inputSize, maxOutputSize, limitedOutput, byU16, noDict, noDictIssue, acceleration);
+ else
+ return LZ4_compress_generic(ctx, source, dest, inputSize, maxOutputSize, limitedOutput, (sizeof(void*)==8) ? byU32 : byPtr, noDict, noDictIssue, acceleration);
+ }
+}
+
+
+int LZ4_compress_fast(const char* source, char* dest, int inputSize, int maxOutputSize, int acceleration)
+{
+#if (LZ4_HEAPMODE)
+ void* ctxPtr = ALLOCATOR(1, sizeof(LZ4_stream_t)); /* malloc-calloc always properly aligned */
#else
- U32 ctx[LZ4_STREAMSIZE_U32] = {0}; /* Ensure data is aligned on 4-bytes boundaries */
+ LZ4_stream_t ctx;
+ void* const ctxPtr = &ctx;
#endif
- int result;
- if (inputSize < (int)LZ4_64KLIMIT)
- result = LZ4_compress_generic((void*)ctx, source, dest, inputSize, 0, notLimited, byU16, noDict, noDictIssue);
- else
- result = LZ4_compress_generic((void*)ctx, source, dest, inputSize, 0, notLimited, (sizeof(void*)==8) ? byU32 : byPtr, noDict, noDictIssue);
+ int const result = LZ4_compress_fast_extState(ctxPtr, source, dest, inputSize, maxOutputSize, acceleration);
-#if (HEAPMODE)
- FREEMEM(ctx);
+#if (LZ4_HEAPMODE)
+ FREEMEM(ctxPtr);
#endif
return result;
}
-int LZ4_compress_limitedOutput(const char* source, char* dest, int inputSize, int maxOutputSize)
+
+int LZ4_compress_default(const char* source, char* dest, int inputSize, int maxOutputSize)
{
-#if (HEAPMODE)
- void* ctx = ALLOCATOR(LZ4_STREAMSIZE_U32, 4); /* Aligned on 4-bytes boundaries */
+ return LZ4_compress_fast(source, dest, inputSize, maxOutputSize, 1);
+}
+
+
+/* hidden debug function */
+/* strangely enough, gcc generates faster code when this function is uncommented, even if unused */
+int LZ4_compress_fast_force(const char* source, char* dest, int inputSize, int maxOutputSize, int acceleration)
+{
+ LZ4_stream_t ctx;
+ LZ4_resetStream(&ctx);
+
+ if (inputSize < LZ4_64Klimit)
+ return LZ4_compress_generic(&ctx.internal_donotuse, source, dest, inputSize, maxOutputSize, limitedOutput, byU16, noDict, noDictIssue, acceleration);
+ else
+ return LZ4_compress_generic(&ctx.internal_donotuse, source, dest, inputSize, maxOutputSize, limitedOutput, sizeof(void*)==8 ? byU32 : byPtr, noDict, noDictIssue, acceleration);
+}
+
+
+/*-******************************
+* *_destSize() variant
+********************************/
+
+static int LZ4_compress_destSize_generic(
+ LZ4_stream_t_internal* const ctx,
+ const char* const src,
+ char* const dst,
+ int* const srcSizePtr,
+ const int targetDstSize,
+ const tableType_t tableType)
+{
+ const BYTE* ip = (const BYTE*) src;
+ const BYTE* base = (const BYTE*) src;
+ const BYTE* lowLimit = (const BYTE*) src;
+ const BYTE* anchor = ip;
+ const BYTE* const iend = ip + *srcSizePtr;
+ const BYTE* const mflimit = iend - MFLIMIT;
+ const BYTE* const matchlimit = iend - LASTLITERALS;
+
+ BYTE* op = (BYTE*) dst;
+ BYTE* const oend = op + targetDstSize;
+ BYTE* const oMaxLit = op + targetDstSize - 2 /* offset */ - 8 /* because 8+MINMATCH==MFLIMIT */ - 1 /* token */;
+ BYTE* const oMaxMatch = op + targetDstSize - (LASTLITERALS + 1 /* token */);
+ BYTE* const oMaxSeq = oMaxLit - 1 /* token */;
+
+ U32 forwardH;
+
+
+ /* Init conditions */
+ if (targetDstSize < 1) return 0; /* Impossible to store anything */
+ if ((U32)*srcSizePtr > (U32)LZ4_MAX_INPUT_SIZE) return 0; /* Unsupported input size, too large (or negative) */
+ if ((tableType == byU16) && (*srcSizePtr>=LZ4_64Klimit)) return 0; /* Size too large (not within 64K limit) */
+ if (*srcSizePtr<LZ4_minLength) goto _last_literals; /* Input too small, no compression (all literals) */
+
+ /* First Byte */
+ *srcSizePtr = 0;
+ LZ4_putPosition(ip, ctx->hashTable, tableType, base);
+ ip++; forwardH = LZ4_hashPosition(ip, tableType);
+
+ /* Main Loop */
+ for ( ; ; ) {
+ const BYTE* match;
+ BYTE* token;
+
+ /* Find a match */
+ { const BYTE* forwardIp = ip;
+ unsigned step = 1;
+ unsigned searchMatchNb = 1 << LZ4_skipTrigger;
+
+ do {
+ U32 h = forwardH;
+ ip = forwardIp;
+ forwardIp += step;
+ step = (searchMatchNb++ >> LZ4_skipTrigger);
+
+ if (unlikely(forwardIp > mflimit)) goto _last_literals;
+
+ match = LZ4_getPositionOnHash(h, ctx->hashTable, tableType, base);
+ forwardH = LZ4_hashPosition(forwardIp, tableType);
+ LZ4_putPositionOnHash(ip, h, ctx->hashTable, tableType, base);
+
+ } while ( ((tableType==byU16) ? 0 : (match + MAX_DISTANCE < ip))
+ || (LZ4_read32(match) != LZ4_read32(ip)) );
+ }
+
+ /* Catch up */
+ while ((ip>anchor) && (match > lowLimit) && (unlikely(ip[-1]==match[-1]))) { ip--; match--; }
+
+ /* Encode Literal length */
+ { unsigned litLength = (unsigned)(ip - anchor);
+ token = op++;
+ if (op + ((litLength+240)/255) + litLength > oMaxLit) {
+ /* Not enough space for a last match */
+ op--;
+ goto _last_literals;
+ }
+ if (litLength>=RUN_MASK) {
+ unsigned len = litLength - RUN_MASK;
+ *token=(RUN_MASK<<ML_BITS);
+ for(; len >= 255 ; len-=255) *op++ = 255;
+ *op++ = (BYTE)len;
+ }
+ else *token = (BYTE)(litLength<<ML_BITS);
+
+ /* Copy Literals */
+ LZ4_wildCopy(op, anchor, op+litLength);
+ op += litLength;
+ }
+
+_next_match:
+ /* Encode Offset */
+ LZ4_writeLE16(op, (U16)(ip-match)); op+=2;
+
+ /* Encode MatchLength */
+ { size_t matchLength = LZ4_count(ip+MINMATCH, match+MINMATCH, matchlimit);
+
+ if (op + ((matchLength+240)/255) > oMaxMatch) {
+ /* Match description too long : reduce it */
+ matchLength = (15-1) + (oMaxMatch-op) * 255;
+ }
+ ip += MINMATCH + matchLength;
+
+ if (matchLength>=ML_MASK) {
+ *token += ML_MASK;
+ matchLength -= ML_MASK;
+ while (matchLength >= 255) { matchLength-=255; *op++ = 255; }
+ *op++ = (BYTE)matchLength;
+ }
+ else *token += (BYTE)(matchLength);
+ }
+
+ anchor = ip;
+
+ /* Test end of block */
+ if (ip > mflimit) break;
+ if (op > oMaxSeq) break;
+
+ /* Fill table */
+ LZ4_putPosition(ip-2, ctx->hashTable, tableType, base);
+
+ /* Test next position */
+ match = LZ4_getPosition(ip, ctx->hashTable, tableType, base);
+ LZ4_putPosition(ip, ctx->hashTable, tableType, base);
+ if ( (match+MAX_DISTANCE>=ip)
+ && (LZ4_read32(match)==LZ4_read32(ip)) )
+ { token=op++; *token=0; goto _next_match; }
+
+ /* Prepare next loop */
+ forwardH = LZ4_hashPosition(++ip, tableType);
+ }
+
+_last_literals:
+ /* Encode Last Literals */
+ { size_t lastRunSize = (size_t)(iend - anchor);
+ if (op + 1 /* token */ + ((lastRunSize+240)/255) /* litLength */ + lastRunSize /* literals */ > oend) {
+ /* adapt lastRunSize to fill 'dst' */
+ lastRunSize = (oend-op) - 1;
+ lastRunSize -= (lastRunSize+240)/255;
+ }
+ ip = anchor + lastRunSize;
+
+ if (lastRunSize >= RUN_MASK) {
+ size_t accumulator = lastRunSize - RUN_MASK;
+ *op++ = RUN_MASK << ML_BITS;
+ for(; accumulator >= 255 ; accumulator-=255) *op++ = 255;
+ *op++ = (BYTE) accumulator;
+ } else {
+ *op++ = (BYTE)(lastRunSize<<ML_BITS);
+ }
+ memcpy(op, anchor, lastRunSize);
+ op += lastRunSize;
+ }
+
+ /* End */
+ *srcSizePtr = (int) (((const char*)ip)-src);
+ return (int) (((char*)op)-dst);
+}
+
+
+static int LZ4_compress_destSize_extState (LZ4_stream_t* state, const char* src, char* dst, int* srcSizePtr, int targetDstSize)
+{
+ LZ4_resetStream(state);
+
+ if (targetDstSize >= LZ4_compressBound(*srcSizePtr)) { /* compression success is guaranteed */
+ return LZ4_compress_fast_extState(state, src, dst, *srcSizePtr, targetDstSize, 1);
+ } else {
+ if (*srcSizePtr < LZ4_64Klimit)
+ return LZ4_compress_destSize_generic(&state->internal_donotuse, src, dst, srcSizePtr, targetDstSize, byU16);
+ else
+ return LZ4_compress_destSize_generic(&state->internal_donotuse, src, dst, srcSizePtr, targetDstSize, sizeof(void*)==8 ? byU32 : byPtr);
+ }
+}
+
+
+int LZ4_compress_destSize(const char* src, char* dst, int* srcSizePtr, int targetDstSize)
+{
+#if (LZ4_HEAPMODE)
+ LZ4_stream_t* ctx = (LZ4_stream_t*)ALLOCATOR(1, sizeof(LZ4_stream_t)); /* malloc-calloc always properly aligned */
#else
- U32 ctx[LZ4_STREAMSIZE_U32] = {0}; /* Ensure data is aligned on 4-bytes boundaries */
+ LZ4_stream_t ctxBody;
+ LZ4_stream_t* ctx = &ctxBody;
#endif
- int result;
- if (inputSize < (int)LZ4_64KLIMIT)
- result = LZ4_compress_generic((void*)ctx, source, dest, inputSize, maxOutputSize, limitedOutput, byU16, noDict, noDictIssue);
- else
- result = LZ4_compress_generic((void*)ctx, source, dest, inputSize, maxOutputSize, limitedOutput, (sizeof(void*)==8) ? byU32 : byPtr, noDict, noDictIssue);
+ int result = LZ4_compress_destSize_extState(ctx, src, dst, srcSizePtr, targetDstSize);
-#if (HEAPMODE)
+#if (LZ4_HEAPMODE)
FREEMEM(ctx);
#endif
return result;
}
-/*****************************************
- Experimental : Streaming functions
-*****************************************/
-void* LZ4_createStream()
+/*-******************************
+* Streaming functions
+********************************/
+
+LZ4_stream_t* LZ4_createStream(void)
{
- void* lz4s = ALLOCATOR(4, LZ4_STREAMSIZE_U32);
- MEM_INIT(lz4s, 0, LZ4_STREAMSIZE);
+ LZ4_stream_t* lz4s = (LZ4_stream_t*)ALLOCATOR(8, LZ4_STREAMSIZE_U64);
+ LZ4_STATIC_ASSERT(LZ4_STREAMSIZE >= sizeof(LZ4_stream_t_internal)); /* A compilation error here means LZ4_STREAMSIZE is not large enough */
+ LZ4_resetStream(lz4s);
return lz4s;
}
-int LZ4_free (void* LZ4_stream)
+void LZ4_resetStream (LZ4_stream_t* LZ4_stream)
+{
+ MEM_INIT(LZ4_stream, 0, sizeof(LZ4_stream_t));
+}
+
+int LZ4_freeStream (LZ4_stream_t* LZ4_stream)
{
+ if (!LZ4_stream) return 0; /* support free on NULL */
FREEMEM(LZ4_stream);
return (0);
}
-int LZ4_loadDict (void* LZ4_dict, const char* dictionary, int dictSize)
+#define HASH_UNIT sizeof(reg_t)
+int LZ4_loadDict (LZ4_stream_t* LZ4_dict, const char* dictionary, int dictSize)
{
- LZ4_stream_t_internal* dict = (LZ4_stream_t_internal*) LZ4_dict;
+ LZ4_stream_t_internal* dict = &LZ4_dict->internal_donotuse;
const BYTE* p = (const BYTE*)dictionary;
const BYTE* const dictEnd = p + dictSize;
const BYTE* base;
- LZ4_STATIC_ASSERT(LZ4_STREAMSIZE >= sizeof(LZ4_stream_t_internal)); /* A compilation error here means LZ4_STREAMSIZE is not large enough */
- if (dict->initCheck) MEM_INIT(dict, 0, sizeof(LZ4_stream_t_internal)); /* Uninitialized structure detected */
+ if ((dict->initCheck) || (dict->currentOffset > 1 GB)) /* Uninitialized structure, or reuse overflow */
+ LZ4_resetStream(LZ4_dict);
- if (dictSize < MINMATCH)
- {
+ if (dictSize < (int)HASH_UNIT) {
dict->dictionary = NULL;
dict->dictSize = 0;
- return 1;
+ return 0;
}
- if (p <= dictEnd - 64 KB) p = dictEnd - 64 KB;
+ if ((dictEnd - p) > 64 KB) p = dictEnd - 64 KB;
+ dict->currentOffset += 64 KB;
base = p - dict->currentOffset;
dict->dictionary = p;
dict->dictSize = (U32)(dictEnd - p);
dict->currentOffset += dict->dictSize;
- while (p <= dictEnd-MINMATCH)
- {
- LZ4_putPosition(p, dict, byU32, base);
+ while (p <= dictEnd-HASH_UNIT) {
+ LZ4_putPosition(p, dict->hashTable, byU32, base);
p+=3;
}
- return 1;
+ return dict->dictSize;
}
-void LZ4_renormDictT(LZ4_stream_t_internal* LZ4_dict, const BYTE* src)
+static void LZ4_renormDictT(LZ4_stream_t_internal* LZ4_dict, const BYTE* src)
{
if ((LZ4_dict->currentOffset > 0x80000000) ||
- ((size_t)LZ4_dict->currentOffset > (size_t)src)) /* address space overflow */
- {
+ ((uptrval)LZ4_dict->currentOffset > (uptrval)src)) { /* address space overflow */
/* rescale hash table */
- U32 delta = LZ4_dict->currentOffset - 64 KB;
+ U32 const delta = LZ4_dict->currentOffset - 64 KB;
const BYTE* dictEnd = LZ4_dict->dictionary + LZ4_dict->dictSize;
int i;
- for (i=0; i<HASH_SIZE_U32; i++)
- {
+ for (i=0; i<LZ4_HASH_SIZE_U32; i++) {
if (LZ4_dict->hashTable[i] < delta) LZ4_dict->hashTable[i]=0;
else LZ4_dict->hashTable[i] -= delta;
}
@@ -753,22 +1007,20 @@ void LZ4_renormDictT(LZ4_stream_t_internal* LZ4_dict, const BYTE* src)
}
-FORCE_INLINE int LZ4_compress_continue_generic (void* LZ4_stream, const char* source, char* dest, int inputSize,
- int maxOutputSize, limitedOutput_directive limit)
+int LZ4_compress_fast_continue (LZ4_stream_t* LZ4_stream, const char* source, char* dest, int inputSize, int maxOutputSize, int acceleration)
{
- LZ4_stream_t_internal* streamPtr = (LZ4_stream_t_internal*)LZ4_stream;
+ LZ4_stream_t_internal* streamPtr = &LZ4_stream->internal_donotuse;
const BYTE* const dictEnd = streamPtr->dictionary + streamPtr->dictSize;
const BYTE* smallest = (const BYTE*) source;
if (streamPtr->initCheck) return 0; /* Uninitialized structure detected */
if ((streamPtr->dictSize>0) && (smallest>dictEnd)) smallest = dictEnd;
LZ4_renormDictT(streamPtr, smallest);
+ if (acceleration < 1) acceleration = ACCELERATION_DEFAULT;
/* Check overlapping input/dictionary space */
- {
- const BYTE* sourceEnd = (const BYTE*) source + inputSize;
- if ((sourceEnd > streamPtr->dictionary) && (sourceEnd < dictEnd))
- {
+ { const BYTE* sourceEnd = (const BYTE*) source + inputSize;
+ if ((sourceEnd > streamPtr->dictionary) && (sourceEnd < dictEnd)) {
streamPtr->dictSize = (U32)(dictEnd - sourceEnd);
if (streamPtr->dictSize > 64 KB) streamPtr->dictSize = 64 KB;
if (streamPtr->dictSize < 4) streamPtr->dictSize = 0;
@@ -777,25 +1029,23 @@ FORCE_INLINE int LZ4_compress_continue_generic (void* LZ4_stream, const char* so
}
/* prefix mode : source data follows dictionary */
- if (dictEnd == (const BYTE*)source)
- {
+ if (dictEnd == (const BYTE*)source) {
int result;
if ((streamPtr->dictSize < 64 KB) && (streamPtr->dictSize < streamPtr->currentOffset))
- result = LZ4_compress_generic(LZ4_stream, source, dest, inputSize, maxOutputSize, limit, byU32, withPrefix64k, dictSmall);
+ result = LZ4_compress_generic(streamPtr, source, dest, inputSize, maxOutputSize, limitedOutput, byU32, withPrefix64k, dictSmall, acceleration);
else
- result = LZ4_compress_generic(LZ4_stream, source, dest, inputSize, maxOutputSize, limit, byU32, withPrefix64k, noDictIssue);
+ result = LZ4_compress_generic(streamPtr, source, dest, inputSize, maxOutputSize, limitedOutput, byU32, withPrefix64k, noDictIssue, acceleration);
streamPtr->dictSize += (U32)inputSize;
streamPtr->currentOffset += (U32)inputSize;
return result;
}
/* external dictionary mode */
- {
- int result;
+ { int result;
if ((streamPtr->dictSize < 64 KB) && (streamPtr->dictSize < streamPtr->currentOffset))
- result = LZ4_compress_generic(LZ4_stream, source, dest, inputSize, maxOutputSize, limit, byU32, usingExtDict, dictSmall);
+ result = LZ4_compress_generic(streamPtr, source, dest, inputSize, maxOutputSize, limitedOutput, byU32, usingExtDict, dictSmall, acceleration);
else
- result = LZ4_compress_generic(LZ4_stream, source, dest, inputSize, maxOutputSize, limit, byU32, usingExtDict, noDictIssue);
+ result = LZ4_compress_generic(streamPtr, source, dest, inputSize, maxOutputSize, limitedOutput, byU32, usingExtDict, noDictIssue, acceleration);
streamPtr->dictionary = (const BYTE*)source;
streamPtr->dictSize = (U32)inputSize;
streamPtr->currentOffset += (U32)inputSize;
@@ -804,29 +1054,18 @@ FORCE_INLINE int LZ4_compress_continue_generic (void* LZ4_stream, const char* so
}
-int LZ4_compress_continue (void* LZ4_stream, const char* source, char* dest, int inputSize)
-{
- return LZ4_compress_continue_generic(LZ4_stream, source, dest, inputSize, 0, notLimited);
-}
-
-int LZ4_compress_limitedOutput_continue (void* LZ4_stream, const char* source, char* dest, int inputSize, int maxOutputSize)
-{
- return LZ4_compress_continue_generic(LZ4_stream, source, dest, inputSize, maxOutputSize, limitedOutput);
-}
-
-
-// Hidden debug function, to force separate dictionary mode
+/* Hidden debug function, to force external dictionary mode */
int LZ4_compress_forceExtDict (LZ4_stream_t* LZ4_dict, const char* source, char* dest, int inputSize)
{
- LZ4_stream_t_internal* streamPtr = (LZ4_stream_t_internal*)LZ4_dict;
+ LZ4_stream_t_internal* streamPtr = &LZ4_dict->internal_donotuse;
int result;
const BYTE* const dictEnd = streamPtr->dictionary + streamPtr->dictSize;
const BYTE* smallest = dictEnd;
if (smallest > (const BYTE*) source) smallest = (const BYTE*) source;
- LZ4_renormDictT((LZ4_stream_t_internal*)LZ4_dict, smallest);
+ LZ4_renormDictT(streamPtr, smallest);
- result = LZ4_compress_generic(LZ4_dict, source, dest, inputSize, 0, notLimited, byU32, usingExtDict, noDictIssue);
+ result = LZ4_compress_generic(streamPtr, source, dest, inputSize, 0, notLimited, byU32, usingExtDict, noDictIssue, 1);
streamPtr->dictionary = (const BYTE*)source;
streamPtr->dictSize = (U32)inputSize;
@@ -836,36 +1075,43 @@ int LZ4_compress_forceExtDict (LZ4_stream_t* LZ4_dict, const char* source, char*
}
-int LZ4_saveDict (void* LZ4_dict, char* safeBuffer, int dictSize)
+/*! LZ4_saveDict() :
+ * If previously compressed data block is not guaranteed to remain available at its memory location,
+ * save it into a safer place (char* safeBuffer).
+ * Note : you don't need to call LZ4_loadDict() afterwards,
+ * dictionary is immediately usable, you can therefore call LZ4_compress_fast_continue().
+ * Return : saved dictionary size in bytes (necessarily <= dictSize), or 0 if error.
+ */
+int LZ4_saveDict (LZ4_stream_t* LZ4_dict, char* safeBuffer, int dictSize)
{
- LZ4_stream_t_internal* dict = (LZ4_stream_t_internal*) LZ4_dict;
- const BYTE* previousDictEnd = dict->dictionary + dict->dictSize;
+ LZ4_stream_t_internal* const dict = &LZ4_dict->internal_donotuse;
+ const BYTE* const previousDictEnd = dict->dictionary + dict->dictSize;
if ((U32)dictSize > 64 KB) dictSize = 64 KB; /* useless to define a dictionary > 64 KB */
if ((U32)dictSize > dict->dictSize) dictSize = dict->dictSize;
- memcpy(safeBuffer, previousDictEnd - dictSize, dictSize);
+ memmove(safeBuffer, previousDictEnd - dictSize, dictSize);
dict->dictionary = (const BYTE*)safeBuffer;
dict->dictSize = (U32)dictSize;
- return 1;
+ return dictSize;
}
-/****************************
- Decompression functions
-****************************/
-/*
- * This generic decompression function cover all use cases.
- * It shall be instanciated several times, using different sets of directives
- * Note that it is essential this generic function is really inlined,
- * in order to remove useless branches during compilation optimisation.
+/*-*****************************
+* Decompression functions
+*******************************/
+/*! LZ4_decompress_generic() :
+ * This generic decompression function cover all use cases.
+ * It shall be instantiated several times, using different sets of directives
+ * Note that it is important this generic function is really inlined,
+ * in order to remove useless branches during compilation optimization.
*/
FORCE_INLINE int LZ4_decompress_generic(
- const char* source,
- char* dest,
+ const char* const source,
+ char* const dest,
int inputSize,
int outputSize, /* If endOnInput==endOnInputSize, this value is the max size of Output Buffer. */
@@ -873,162 +1119,143 @@ FORCE_INLINE int LZ4_decompress_generic(
int partialDecoding, /* full, partial */
int targetOutputSize, /* only used if partialDecoding==partial */
int dict, /* noDict, withPrefix64k, usingExtDict */
- const char* dictStart, /* only if dict==usingExtDict */
- int dictSize /* note : = 0 if noDict */
+ const BYTE* const lowPrefix, /* == dest when no prefix */
+ const BYTE* const dictStart, /* only if dict==usingExtDict */
+ const size_t dictSize /* note : = 0 if noDict */
)
{
/* Local Variables */
- const BYTE* restrict ip = (const BYTE*) source;
- const BYTE* ref;
+ const BYTE* ip = (const BYTE*) source;
const BYTE* const iend = ip + inputSize;
BYTE* op = (BYTE*) dest;
BYTE* const oend = op + outputSize;
BYTE* cpy;
BYTE* oexit = op + targetOutputSize;
- const BYTE* const lowLimit = (const BYTE*)dest - dictSize;
+ const BYTE* const lowLimit = lowPrefix - dictSize;
const BYTE* const dictEnd = (const BYTE*)dictStart + dictSize;
-//#define OLD
-#ifdef OLD
- const size_t dec32table[] = {0, 3, 2, 3, 0, 0, 0, 0}; /* static reduces speed for LZ4_decompress_safe() on GCC64 */
-#else
- const size_t dec32table[] = {4-0, 4-3, 4-2, 4-3, 4-0, 4-0, 4-0, 4-0}; /* static reduces speed for LZ4_decompress_safe() on GCC64 */
-#endif
- static const size_t dec64table[] = {0, 0, 0, (size_t)-1, 0, 1, 2, 3};
+ const unsigned dec32table[] = {0, 1, 2, 1, 4, 4, 4, 4};
+ const int dec64table[] = {0, 0, 0, -1, 0, 1, 2, 3};
- const int checkOffset = (endOnInput) && (dictSize < (int)(64 KB));
+ const int safeDecode = (endOnInput==endOnInputSize);
+ const int checkOffset = ((safeDecode) && (dictSize < (int)(64 KB)));
/* Special cases */
- if ((partialDecoding) && (oexit> oend-MFLIMIT)) oexit = oend-MFLIMIT; /* targetOutputSize too high => decode everything */
- if ((endOnInput) && (unlikely(outputSize==0))) return ((inputSize==1) && (*ip==0)) ? 0 : -1; /* Empty output buffer */
+ if ((partialDecoding) && (oexit > oend-MFLIMIT)) oexit = oend-MFLIMIT; /* targetOutputSize too high => decode everything */
+ if ((endOnInput) && (unlikely(outputSize==0))) return ((inputSize==1) && (*ip==0)) ? 0 : -1; /* Empty output buffer */
if ((!endOnInput) && (unlikely(outputSize==0))) return (*ip==0?1:-1);
-
- /* Main Loop */
- while (1)
- {
- unsigned token;
+ /* Main Loop : decode sequences */
+ while (1) {
size_t length;
+ const BYTE* match;
+ size_t offset;
- /* get runlength */
- token = *ip++;
- if ((length=(token>>ML_BITS)) == RUN_MASK)
- {
+ /* get literal length */
+ unsigned const token = *ip++;
+ if ((length=(token>>ML_BITS)) == RUN_MASK) {
unsigned s;
- do
- {
+ do {
s = *ip++;
length += s;
- }
- while (likely((endOnInput)?ip<iend-RUN_MASK:1) && (s==255));
- //if ((sizeof(void*)==4) && unlikely(length>LZ4_MAX_INPUT_SIZE)) goto _output_error; /* overflow detection */
- if ((sizeof(void*)==4) && unlikely((size_t)(op+length)<(size_t)(op))) goto _output_error; /* quickfix issue 134 */
- if ((endOnInput) && (sizeof(void*)==4) && unlikely((size_t)(ip+length)<(size_t)(ip))) goto _output_error; /* quickfix issue 134 */
+ } while ( likely(endOnInput ? ip<iend-RUN_MASK : 1) & (s==255) );
+ if ((safeDecode) && unlikely((uptrval)(op)+length<(uptrval)(op))) goto _output_error; /* overflow detection */
+ if ((safeDecode) && unlikely((uptrval)(ip)+length<(uptrval)(ip))) goto _output_error; /* overflow detection */
}
/* copy literals */
cpy = op+length;
- if (((endOnInput) && ((cpy>(partialDecoding?oexit:oend-MFLIMIT)) || (ip+length>iend-(2+1+LASTLITERALS))) )
- || ((!endOnInput) && (cpy>oend-COPYLENGTH)))
+ if ( ((endOnInput) && ((cpy>(partialDecoding?oexit:oend-MFLIMIT)) || (ip+length>iend-(2+1+LASTLITERALS))) )
+ || ((!endOnInput) && (cpy>oend-WILDCOPYLENGTH)) )
{
- if (partialDecoding)
- {
+ if (partialDecoding) {
if (cpy > oend) goto _output_error; /* Error : write attempt beyond end of output buffer */
if ((endOnInput) && (ip+length > iend)) goto _output_error; /* Error : read attempt beyond end of input buffer */
- }
- else
- {
+ } else {
if ((!endOnInput) && (cpy != oend)) goto _output_error; /* Error : block decoding must stop exactly there */
if ((endOnInput) && ((ip+length != iend) || (cpy > oend))) goto _output_error; /* Error : input must be consumed */
}
memcpy(op, ip, length);
ip += length;
op += length;
- break; /* Necessarily EOF, due to parsing restrictions */
+ break; /* Necessarily EOF, due to parsing restrictions */
}
- LZ4_WILDCOPY(op, ip, cpy); ip -= (op-cpy); op = cpy;
+ LZ4_wildCopy(op, ip, cpy);
+ ip += length; op = cpy;
/* get offset */
- LZ4_READ_LITTLEENDIAN_16(ref,cpy,ip); ip+=2;
- if ((checkOffset) && (unlikely(ref < lowLimit))) goto _output_error; /* Error : offset outside destination buffer */
+ offset = LZ4_readLE16(ip); ip+=2;
+ match = op - offset;
+ if ((checkOffset) && (unlikely(match < lowLimit))) goto _output_error; /* Error : offset outside buffers */
+ LZ4_write32(op, (U32)offset); /* costs ~1%; silence an msan warning when offset==0 */
/* get matchlength */
- if ((length=(token&ML_MASK)) == ML_MASK)
- {
+ length = token & ML_MASK;
+ if (length == ML_MASK) {
unsigned s;
- do
- {
- if ((endOnInput) && (ip > iend-LASTLITERALS)) goto _output_error;
+ do {
s = *ip++;
+ if ((endOnInput) && (ip > iend-LASTLITERALS)) goto _output_error;
length += s;
} while (s==255);
- //if ((sizeof(void*)==4) && unlikely(length>LZ4_MAX_INPUT_SIZE)) goto _output_error; /* overflow detection */
- if ((sizeof(void*)==4) && unlikely((size_t)(op+length)<(size_t)op)) goto _output_error; /* quickfix issue 134 */
+ if ((safeDecode) && unlikely((uptrval)(op)+length<(uptrval)op)) goto _output_error; /* overflow detection */
}
+ length += MINMATCH;
/* check external dictionary */
- if ((dict==usingExtDict) && (ref < (BYTE* const)dest))
- {
- if (unlikely(op+length+MINMATCH > oend-LASTLITERALS)) goto _output_error;
-
- if (length+MINMATCH <= (size_t)(dest-(char*)ref))
- {
- ref = dictEnd - (dest-(char*)ref);
- memcpy(op, ref, length+MINMATCH);
- op += length+MINMATCH;
- }
- else
- {
- size_t copySize = (size_t)(dest-(char*)ref);
+ if ((dict==usingExtDict) && (match < lowPrefix)) {
+ if (unlikely(op+length > oend-LASTLITERALS)) goto _output_error; /* doesn't respect parsing restriction */
+
+ if (length <= (size_t)(lowPrefix-match)) {
+ /* match can be copied as a single segment from external dictionary */
+ memmove(op, dictEnd - (lowPrefix-match), length);
+ op += length;
+ } else {
+ /* match encompass external dictionary and current block */
+ size_t const copySize = (size_t)(lowPrefix-match);
+ size_t const restSize = length - copySize;
memcpy(op, dictEnd - copySize, copySize);
op += copySize;
- copySize = length+MINMATCH - copySize;
- if (copySize > (size_t)((char*)op-dest)) /* overlap */
- {
- BYTE* const cpy = op + copySize;
- const BYTE* ref = (BYTE*)dest;
- while (op < cpy) *op++ = *ref++;
- }
- else
- {
- memcpy(op, dest, copySize);
- op += copySize;
- }
- }
+ if (restSize > (size_t)(op-lowPrefix)) { /* overlap copy */
+ BYTE* const endOfMatch = op + restSize;
+ const BYTE* copyFrom = lowPrefix;
+ while (op < endOfMatch) *op++ = *copyFrom++;
+ } else {
+ memcpy(op, lowPrefix, restSize);
+ op += restSize;
+ } }
continue;
}
- /* copy repeated sequence */
- if (unlikely((op-ref)<(int)STEPSIZE))
- {
- const size_t dec64 = dec64table[(sizeof(void*)==4) ? 0 : op-ref];
- op[0] = ref[0];
- op[1] = ref[1];
- op[2] = ref[2];
- op[3] = ref[3];
-#ifdef OLD
- op += 4, ref += 4; ref -= dec32table[op-ref];
- A32(op) = A32(ref);
- op += STEPSIZE-4; ref -= dec64;
-#else
- ref += dec32table[op-ref];
- A32(op+4) = A32(ref);
- op += STEPSIZE; ref -= dec64;
-#endif
- } else { LZ4_COPYSTEP(op,ref); }
- cpy = op + length - (STEPSIZE-4);
-
- if (unlikely(cpy>oend-COPYLENGTH-(STEPSIZE-4)))
- {
- if (cpy > oend-LASTLITERALS) goto _output_error; /* Error : last 5 bytes must be literals */
- if (op<oend-COPYLENGTH) LZ4_WILDCOPY(op, ref, (oend-COPYLENGTH));
- while(op<cpy) *op++=*ref++;
- op=cpy;
- continue;
+ /* copy match within block */
+ cpy = op + length;
+ if (unlikely(offset<8)) {
+ const int dec64 = dec64table[offset];
+ op[0] = match[0];
+ op[1] = match[1];
+ op[2] = match[2];
+ op[3] = match[3];
+ match += dec32table[offset];
+ memcpy(op+4, match, 4);
+ match -= dec64;
+ } else { LZ4_copy8(op, match); match+=8; }
+ op += 8;
+
+ if (unlikely(cpy>oend-12)) {
+ BYTE* const oCopyLimit = oend-(WILDCOPYLENGTH-1);
+ if (cpy > oend-LASTLITERALS) goto _output_error; /* Error : last LASTLITERALS bytes must be literals (uncompressed) */
+ if (op < oCopyLimit) {
+ LZ4_wildCopy(op, match, oCopyLimit);
+ match += oCopyLimit - op;
+ op = oCopyLimit;
+ }
+ while (op<cpy) *op++ = *match++;
+ } else {
+ LZ4_copy8(op, match);
+ if (length>16) LZ4_wildCopy(op+8, match+8, cpy);
}
- LZ4_WILDCOPY(op, ref, cpy);
op=cpy; /* correction */
}
@@ -1036,64 +1263,59 @@ FORCE_INLINE int LZ4_decompress_generic(
if (endOnInput)
return (int) (((char*)op)-dest); /* Nb of output bytes decoded */
else
- return (int) (((char*)ip)-source); /* Nb of input bytes read */
+ return (int) (((const char*)ip)-source); /* Nb of input bytes read */
/* Overflow error detected */
_output_error:
- return (int) (-(((char*)ip)-source))-1;
+ return (int) (-(((const char*)ip)-source))-1;
}
-int LZ4_decompress_safe(const char* source, char* dest, int compressedSize, int maxOutputSize)
+int LZ4_decompress_safe(const char* source, char* dest, int compressedSize, int maxDecompressedSize)
{
- return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, endOnInputSize, full, 0, noDict, NULL, 0);
+ return LZ4_decompress_generic(source, dest, compressedSize, maxDecompressedSize, endOnInputSize, full, 0, noDict, (BYTE*)dest, NULL, 0);
}
-int LZ4_decompress_safe_partial(const char* source, char* dest, int compressedSize, int targetOutputSize, int maxOutputSize)
+int LZ4_decompress_safe_partial(const char* source, char* dest, int compressedSize, int targetOutputSize, int maxDecompressedSize)
{
- return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, endOnInputSize, partial, targetOutputSize, noDict, NULL, 0);
+ return LZ4_decompress_generic(source, dest, compressedSize, maxDecompressedSize, endOnInputSize, partial, targetOutputSize, noDict, (BYTE*)dest, NULL, 0);
}
int LZ4_decompress_fast(const char* source, char* dest, int originalSize)
{
- return LZ4_decompress_generic(source, dest, 0, originalSize, endOnOutputSize, full, 0, withPrefix64k, NULL, 0);
+ return LZ4_decompress_generic(source, dest, 0, originalSize, endOnOutputSize, full, 0, withPrefix64k, (BYTE*)(dest - 64 KB), NULL, 64 KB);
}
-/* streaming decompression functions */
-//#define LZ4_STREAMDECODESIZE_U32 4
-//#define LZ4_STREAMDECODESIZE (LZ4_STREAMDECODESIZE_U32 * sizeof(unsigned int))
-//typedef struct { unsigned int table[LZ4_STREAMDECODESIZE_U32]; } LZ4_streamDecode_t;
-typedef struct
-{
- const char* dictionary;
- int dictSize;
-} LZ4_streamDecode_t_internal;
+/*===== streaming decompression functions =====*/
-/*
- * If you prefer dynamic allocation methods,
- * LZ4_createStreamDecode()
- * provides a pointer (void*) towards an initialized LZ4_streamDecode_t structure.
- */
-void* LZ4_createStreamDecode()
+LZ4_streamDecode_t* LZ4_createStreamDecode(void)
{
- void* lz4s = ALLOCATOR(sizeof(U32), LZ4_STREAMDECODESIZE_U32);
- MEM_INIT(lz4s, 0, LZ4_STREAMDECODESIZE);
+ LZ4_streamDecode_t* lz4s = (LZ4_streamDecode_t*) ALLOCATOR(1, sizeof(LZ4_streamDecode_t));
return lz4s;
}
-/*
- * LZ4_setDictDecode
- * Use this function to instruct where to find the dictionary
+int LZ4_freeStreamDecode (LZ4_streamDecode_t* LZ4_stream)
+{
+ if (!LZ4_stream) return 0; /* support free on NULL */
+ FREEMEM(LZ4_stream);
+ return 0;
+}
+
+/*!
+ * LZ4_setStreamDecode() :
+ * Use this function to instruct where to find the dictionary.
* This function is not necessary if previous data is still available where it was decoded.
* Loading a size of 0 is allowed (same effect as no dictionary).
* Return : 1 if OK, 0 if error
*/
-int LZ4_setDictDecode (void* LZ4_streamDecode, const char* dictionary, int dictSize)
+int LZ4_setStreamDecode (LZ4_streamDecode_t* LZ4_streamDecode, const char* dictionary, int dictSize)
{
- LZ4_streamDecode_t_internal* lz4sd = (LZ4_streamDecode_t_internal*) LZ4_streamDecode;
- lz4sd->dictionary = dictionary;
- lz4sd->dictSize = dictSize;
+ LZ4_streamDecode_t_internal* lz4sd = &LZ4_streamDecode->internal_donotuse;
+ lz4sd->prefixSize = (size_t) dictSize;
+ lz4sd->prefixEnd = (const BYTE*) dictionary + dictSize;
+ lz4sd->externalDict = NULL;
+ lz4sd->extDictSize = 0;
return 1;
}
@@ -1102,43 +1324,55 @@ int LZ4_setDictDecode (void* LZ4_streamDecode, const char* dictionary, int dictS
These decoding functions allow decompression of multiple blocks in "streaming" mode.
Previously decoded blocks must still be available at the memory position where they were decoded.
If it's not possible, save the relevant part of decoded data into a safe buffer,
- and indicate where it stands using LZ4_setDictDecode()
+ and indicate where it stands using LZ4_setStreamDecode()
*/
-int LZ4_decompress_safe_continue (void* LZ4_streamDecode, const char* source, char* dest, int compressedSize, int maxOutputSize)
+int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int compressedSize, int maxOutputSize)
{
- LZ4_streamDecode_t_internal* lz4sd = (LZ4_streamDecode_t_internal*) LZ4_streamDecode;
+ LZ4_streamDecode_t_internal* lz4sd = &LZ4_streamDecode->internal_donotuse;
int result;
- result = LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, endOnInputSize, full, 0, usingExtDict, lz4sd->dictionary, lz4sd->dictSize);
- if (result <= 0) return result;
- if (lz4sd->dictionary + lz4sd->dictSize == dest)
- {
- lz4sd->dictSize += result;
- }
- else
- {
- lz4sd->dictionary = dest;
- lz4sd->dictSize = result;
+ if (lz4sd->prefixEnd == (BYTE*)dest) {
+ result = LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize,
+ endOnInputSize, full, 0,
+ usingExtDict, lz4sd->prefixEnd - lz4sd->prefixSize, lz4sd->externalDict, lz4sd->extDictSize);
+ if (result <= 0) return result;
+ lz4sd->prefixSize += result;
+ lz4sd->prefixEnd += result;
+ } else {
+ lz4sd->extDictSize = lz4sd->prefixSize;
+ lz4sd->externalDict = lz4sd->prefixEnd - lz4sd->extDictSize;
+ result = LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize,
+ endOnInputSize, full, 0,
+ usingExtDict, (BYTE*)dest, lz4sd->externalDict, lz4sd->extDictSize);
+ if (result <= 0) return result;
+ lz4sd->prefixSize = result;
+ lz4sd->prefixEnd = (BYTE*)dest + result;
}
return result;
}
-int LZ4_decompress_fast_continue (void* LZ4_streamDecode, const char* source, char* dest, int originalSize)
+int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int originalSize)
{
- LZ4_streamDecode_t_internal* lz4sd = (LZ4_streamDecode_t_internal*) LZ4_streamDecode;
+ LZ4_streamDecode_t_internal* lz4sd = &LZ4_streamDecode->internal_donotuse;
int result;
- result = LZ4_decompress_generic(source, dest, 0, originalSize, endOnOutputSize, full, 0, usingExtDict, lz4sd->dictionary, lz4sd->dictSize);
- if (result <= 0) return result;
- if (lz4sd->dictionary + lz4sd->dictSize == dest)
- {
- lz4sd->dictSize += result;
- }
- else
- {
- lz4sd->dictionary = dest;
- lz4sd->dictSize = result;
+ if (lz4sd->prefixEnd == (BYTE*)dest) {
+ result = LZ4_decompress_generic(source, dest, 0, originalSize,
+ endOnOutputSize, full, 0,
+ usingExtDict, lz4sd->prefixEnd - lz4sd->prefixSize, lz4sd->externalDict, lz4sd->extDictSize);
+ if (result <= 0) return result;
+ lz4sd->prefixSize += originalSize;
+ lz4sd->prefixEnd += originalSize;
+ } else {
+ lz4sd->extDictSize = lz4sd->prefixSize;
+ lz4sd->externalDict = lz4sd->prefixEnd - lz4sd->extDictSize;
+ result = LZ4_decompress_generic(source, dest, 0, originalSize,
+ endOnOutputSize, full, 0,
+ usingExtDict, (BYTE*)dest, lz4sd->externalDict, lz4sd->extDictSize);
+ if (result <= 0) return result;
+ lz4sd->prefixSize = originalSize;
+ lz4sd->prefixEnd = (BYTE*)dest + originalSize;
}
return result;
@@ -1152,12 +1386,97 @@ Advanced decoding functions :
the dictionary must be explicitly provided within parameters
*/
+FORCE_INLINE int LZ4_decompress_usingDict_generic(const char* source, char* dest, int compressedSize, int maxOutputSize, int safe, const char* dictStart, int dictSize)
+{
+ if (dictSize==0)
+ return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, safe, full, 0, noDict, (BYTE*)dest, NULL, 0);
+ if (dictStart+dictSize == dest) {
+ if (dictSize >= (int)(64 KB - 1))
+ return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, safe, full, 0, withPrefix64k, (BYTE*)dest-64 KB, NULL, 0);
+ return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, safe, full, 0, noDict, (BYTE*)dest-dictSize, NULL, 0);
+ }
+ return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, safe, full, 0, usingExtDict, (BYTE*)dest, (const BYTE*)dictStart, dictSize);
+}
+
int LZ4_decompress_safe_usingDict(const char* source, char* dest, int compressedSize, int maxOutputSize, const char* dictStart, int dictSize)
{
- return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, endOnInputSize, full, 0, usingExtDict, dictStart, dictSize);
+ return LZ4_decompress_usingDict_generic(source, dest, compressedSize, maxOutputSize, 1, dictStart, dictSize);
}
int LZ4_decompress_fast_usingDict(const char* source, char* dest, int originalSize, const char* dictStart, int dictSize)
{
- return LZ4_decompress_generic(source, dest, 0, originalSize, endOnOutputSize, full, 0, usingExtDict, dictStart, dictSize);
+ return LZ4_decompress_usingDict_generic(source, dest, 0, originalSize, 0, dictStart, dictSize);
+}
+
+/* debug function */
+int LZ4_decompress_safe_forceExtDict(const char* source, char* dest, int compressedSize, int maxOutputSize, const char* dictStart, int dictSize)
+{
+ return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, endOnInputSize, full, 0, usingExtDict, (BYTE*)dest, (const BYTE*)dictStart, dictSize);
}
+
+
+/*=*************************************************
+* Obsolete Functions
+***************************************************/
+/* obsolete compression functions */
+int LZ4_compress_limitedOutput(const char* source, char* dest, int inputSize, int maxOutputSize) { return LZ4_compress_default(source, dest, inputSize, maxOutputSize); }
+int LZ4_compress(const char* source, char* dest, int inputSize) { return LZ4_compress_default(source, dest, inputSize, LZ4_compressBound(inputSize)); }
+int LZ4_compress_limitedOutput_withState (void* state, const char* src, char* dst, int srcSize, int dstSize) { return LZ4_compress_fast_extState(state, src, dst, srcSize, dstSize, 1); }
+int LZ4_compress_withState (void* state, const char* src, char* dst, int srcSize) { return LZ4_compress_fast_extState(state, src, dst, srcSize, LZ4_compressBound(srcSize), 1); }
+int LZ4_compress_limitedOutput_continue (LZ4_stream_t* LZ4_stream, const char* src, char* dst, int srcSize, int maxDstSize) { return LZ4_compress_fast_continue(LZ4_stream, src, dst, srcSize, maxDstSize, 1); }
+int LZ4_compress_continue (LZ4_stream_t* LZ4_stream, const char* source, char* dest, int inputSize) { return LZ4_compress_fast_continue(LZ4_stream, source, dest, inputSize, LZ4_compressBound(inputSize), 1); }
+
+/*
+These function names are deprecated and should no longer be used.
+They are only provided here for compatibility with older user programs.
+- LZ4_uncompress is totally equivalent to LZ4_decompress_fast
+- LZ4_uncompress_unknownOutputSize is totally equivalent to LZ4_decompress_safe
+*/
+int LZ4_uncompress (const char* source, char* dest, int outputSize) { return LZ4_decompress_fast(source, dest, outputSize); }
+int LZ4_uncompress_unknownOutputSize (const char* source, char* dest, int isize, int maxOutputSize) { return LZ4_decompress_safe(source, dest, isize, maxOutputSize); }
+
+
+/* Obsolete Streaming functions */
+
+int LZ4_sizeofStreamState() { return LZ4_STREAMSIZE; }
+
+static void LZ4_init(LZ4_stream_t* lz4ds, BYTE* base)
+{
+ MEM_INIT(lz4ds, 0, sizeof(LZ4_stream_t));
+ lz4ds->internal_donotuse.bufferStart = base;
+}
+
+int LZ4_resetStreamState(void* state, char* inputBuffer)
+{
+ if ((((uptrval)state) & 3) != 0) return 1; /* Error : pointer is not aligned on 4-bytes boundary */
+ LZ4_init((LZ4_stream_t*)state, (BYTE*)inputBuffer);
+ return 0;
+}
+
+void* LZ4_create (char* inputBuffer)
+{
+ LZ4_stream_t* lz4ds = (LZ4_stream_t*)ALLOCATOR(8, sizeof(LZ4_stream_t));
+ LZ4_init (lz4ds, (BYTE*)inputBuffer);
+ return lz4ds;
+}
+
+char* LZ4_slideInputBuffer (void* LZ4_Data)
+{
+ LZ4_stream_t_internal* ctx = &((LZ4_stream_t*)LZ4_Data)->internal_donotuse;
+ int dictSize = LZ4_saveDict((LZ4_stream_t*)LZ4_Data, (char*)ctx->bufferStart, 64 KB);
+ return (char*)(ctx->bufferStart + dictSize);
+}
+
+/* Obsolete streaming decompression functions */
+
+int LZ4_decompress_safe_withPrefix64k(const char* source, char* dest, int compressedSize, int maxOutputSize)
+{
+ return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, endOnInputSize, full, 0, withPrefix64k, (BYTE*)dest - 64 KB, NULL, 64 KB);
+}
+
+int LZ4_decompress_fast_withPrefix64k(const char* source, char* dest, int originalSize)
+{
+ return LZ4_decompress_generic(source, dest, 0, originalSize, endOnOutputSize, full, 0, withPrefix64k, (BYTE*)dest - 64 KB, NULL, 64 KB);
+}
+
+#endif /* LZ4_COMMONDEFS_ONLY */
diff --git a/mfbt/lz4.h b/mfbt/lz4.h
index bf6780122f..86ca0d59c1 100644
--- a/mfbt/lz4.h
+++ b/mfbt/lz4.h
@@ -1,7 +1,8 @@
/*
- LZ4 - Fast LZ compression algorithm
- Header File
- Copyright (C) 2011-2014, Yann Collet.
+ * LZ4 - Fast LZ compression algorithm
+ * Header File
+ * Copyright (C) 2011-2017, Yann Collet.
+
BSD 2-Clause License (http://www.opensource.org/licenses/bsd-license.php)
Redistribution and use in source and binary forms, with or without
@@ -28,247 +29,433 @@
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
You can contact the author at :
- - LZ4 source repository : http://code.google.com/p/lz4/
- - LZ4 public forum : https://groups.google.com/forum/#!forum/lz4c
+ - LZ4 homepage : http://www.lz4.org
+ - LZ4 source repository : https://github.com/lz4/lz4
*/
-#pragma once
-
#if defined (__cplusplus)
extern "C" {
#endif
+#ifndef LZ4_H_2983827168210
+#define LZ4_H_2983827168210
-/**************************************
- Version
-**************************************/
-#define LZ4_VERSION_MAJOR 1 /* for major interface/format changes */
-#define LZ4_VERSION_MINOR 2 /* for minor interface/format changes */
+/* --- Dependency --- */
+#include <stddef.h> /* size_t */
+
+
+/**
+ Introduction
+
+ LZ4 is lossless compression algorithm, providing compression speed at 400 MB/s per core,
+ scalable with multi-cores CPU. It features an extremely fast decoder, with speed in
+ multiple GB/s per core, typically reaching RAM speed limits on multi-core systems.
+
+ The LZ4 compression library provides in-memory compression and decompression functions.
+ Compression can be done in:
+ - a single step (described as Simple Functions)
+ - a single step, reusing a context (described in Advanced Functions)
+ - unbounded multiple steps (described as Streaming compression)
+
+ lz4.h provides block compression functions. It gives full buffer control to user.
+ Decompressing an lz4-compressed block also requires metadata (such as compressed size).
+ Each application is free to encode such metadata in whichever way it wants.
+
+ An additional format, called LZ4 frame specification (doc/lz4_Frame_format.md),
+ take care of encoding standard metadata alongside LZ4-compressed blocks.
+ If your application requires interoperability, it's recommended to use it.
+ A library is provided to take care of it, see lz4frame.h.
+*/
+
+/*^***************************************************************
+* Export parameters
+*****************************************************************/
+/*
+* LZ4_DLL_EXPORT :
+* Enable exporting of functions when building a Windows DLL
+* LZ4LIB_API :
+* Control library symbols visibility.
+*/
+#if defined(LZ4_DLL_EXPORT) && (LZ4_DLL_EXPORT==1)
+# define LZ4LIB_API __declspec(dllexport)
+#elif defined(LZ4_DLL_IMPORT) && (LZ4_DLL_IMPORT==1)
+# define LZ4LIB_API __declspec(dllimport) /* It isn't required but allows to generate better code, saving a function pointer load from the IAT and an indirect jump.*/
+#elif defined(__GNUC__) && (__GNUC__ >= 4)
+# define LZ4LIB_API __attribute__ ((__visibility__ ("default")))
+#else
+# define LZ4LIB_API
+#endif
+
+
+/*------ Version ------*/
+#define LZ4_VERSION_MAJOR 1 /* for breaking interface changes */
+#define LZ4_VERSION_MINOR 8 /* for new (non-breaking) interface capabilities */
#define LZ4_VERSION_RELEASE 0 /* for tweaks, bug-fixes, or development */
+#define LZ4_VERSION_NUMBER (LZ4_VERSION_MAJOR *100*100 + LZ4_VERSION_MINOR *100 + LZ4_VERSION_RELEASE)
-/**************************************
- Tuning parameter
+#define LZ4_LIB_VERSION LZ4_VERSION_MAJOR.LZ4_VERSION_MINOR.LZ4_VERSION_RELEASE
+#define LZ4_QUOTE(str) #str
+#define LZ4_EXPAND_AND_QUOTE(str) LZ4_QUOTE(str)
+#define LZ4_VERSION_STRING LZ4_EXPAND_AND_QUOTE(LZ4_LIB_VERSION)
+
+LZ4LIB_API int LZ4_versionNumber (void); /**< library version number; to be used when checking dll version */
+LZ4LIB_API const char* LZ4_versionString (void); /**< library version string; to be used when checking dll version */
+
+
+/*-************************************
+* Tuning parameter
**************************************/
-/*
+/*!
* LZ4_MEMORY_USAGE :
* Memory usage formula : N->2^N Bytes (examples : 10 -> 1KB; 12 -> 4KB ; 16 -> 64KB; 20 -> 1MB; etc.)
* Increasing memory usage improves compression ratio
* Reduced memory usage can improve speed, due to cache effect
* Default value is 14, for 16KB, which nicely fits into Intel x86 L1 cache
*/
-#define LZ4_MEMORY_USAGE 14
-
+#ifndef LZ4_MEMORY_USAGE
+# define LZ4_MEMORY_USAGE 14
+#endif
-/**************************************
- Simple Functions
+/*-************************************
+* Simple Functions
**************************************/
-
-int LZ4_compress (const char* source, char* dest, int inputSize);
-int LZ4_decompress_safe (const char* source, char* dest, int compressedSize, int maxOutputSize);
-
-/*
-LZ4_compress() :
- Compresses 'inputSize' bytes from 'source' into 'dest'.
- Destination buffer must be already allocated,
- and must be sized to handle worst cases situations (input data not compressible)
- Worst case size evaluation is provided by function LZ4_compressBound()
- inputSize : Max supported value is LZ4_MAX_INPUT_VALUE
- return : the number of bytes written in buffer dest
- or 0 if the compression fails
-
-LZ4_decompress_safe() :
- compressedSize : is obviously the source size
- maxOutputSize : is the size of the destination buffer, which must be already allocated.
- return : the number of bytes decoded in the destination buffer (necessarily <= maxOutputSize)
- If the destination buffer is not large enough, decoding will stop and output an error code (<0).
+/*! LZ4_compress_default() :
+ Compresses 'sourceSize' bytes from buffer 'source'
+ into already allocated 'dest' buffer of size 'maxDestSize'.
+ Compression is guaranteed to succeed if 'maxDestSize' >= LZ4_compressBound(sourceSize).
+ It also runs faster, so it's a recommended setting.
+ If the function cannot compress 'source' into a more limited 'dest' budget,
+ compression stops *immediately*, and the function result is zero.
+ As a consequence, 'dest' content is not valid.
+ This function never writes outside 'dest' buffer, nor read outside 'source' buffer.
+ sourceSize : Max supported value is LZ4_MAX_INPUT_VALUE
+ maxDestSize : full or partial size of buffer 'dest' (which must be already allocated)
+ return : the number of bytes written into buffer 'dest' (necessarily <= maxOutputSize)
+ or 0 if compression fails */
+LZ4LIB_API int LZ4_compress_default(const char* source, char* dest, int sourceSize, int maxDestSize);
+
+/*! LZ4_decompress_safe() :
+ compressedSize : is the precise full size of the compressed block.
+ maxDecompressedSize : is the size of destination buffer, which must be already allocated.
+ return : the number of bytes decompressed into destination buffer (necessarily <= maxDecompressedSize)
+ If destination buffer is not large enough, decoding will stop and output an error code (<0).
If the source stream is detected malformed, the function will stop decoding and return a negative result.
- This function is protected against buffer overflow exploits :
- it never writes outside of output buffer, and never reads outside of input buffer.
- Therefore, it is protected against malicious data packets.
-*/
-
-
-/*
-Note :
- Should you prefer to explicitly allocate compression-table memory using your own allocation method,
- use the streaming functions provided below, simply reset the memory area between each call to LZ4_compress_continue()
+ This function is protected against buffer overflow exploits, including malicious data packets.
+ It never writes outside output buffer, nor reads outside input buffer.
*/
+LZ4LIB_API int LZ4_decompress_safe (const char* source, char* dest, int compressedSize, int maxDecompressedSize);
-/**************************************
- Advanced Functions
+/*-************************************
+* Advanced Functions
**************************************/
#define LZ4_MAX_INPUT_SIZE 0x7E000000 /* 2 113 929 216 bytes */
-#define LZ4_COMPRESSBOUND(isize) ((unsigned int)(isize) > (unsigned int)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16)
+#define LZ4_COMPRESSBOUND(isize) ((unsigned)(isize) > (unsigned)LZ4_MAX_INPUT_SIZE ? 0 : (isize) + ((isize)/255) + 16)
-/*
+/*!
LZ4_compressBound() :
- Provides the maximum size that LZ4 may output in a "worst case" scenario (input data not compressible)
- primarily useful for memory allocation of output buffer.
- macro is also provided when result needs to be evaluated at compilation (such as stack memory allocation).
-
- isize : is the input size. Max supported value is LZ4_MAX_INPUT_SIZE
- return : maximum output size in a "worst case" scenario
- or 0, if input size is too large ( > LZ4_MAX_INPUT_SIZE)
+ Provides the maximum size that LZ4 compression may output in a "worst case" scenario (input data not compressible)
+ This function is primarily useful for memory allocation purposes (destination buffer size).
+ Macro LZ4_COMPRESSBOUND() is also provided for compilation-time evaluation (stack memory allocation for example).
+ Note that LZ4_compress_default() compress faster when dest buffer size is >= LZ4_compressBound(srcSize)
+ inputSize : max supported value is LZ4_MAX_INPUT_SIZE
+ return : maximum output size in a "worst case" scenario
+ or 0, if input size is too large ( > LZ4_MAX_INPUT_SIZE)
+*/
+LZ4LIB_API int LZ4_compressBound(int inputSize);
+
+/*!
+LZ4_compress_fast() :
+ Same as LZ4_compress_default(), but allows to select an "acceleration" factor.
+ The larger the acceleration value, the faster the algorithm, but also the lesser the compression.
+ It's a trade-off. It can be fine tuned, with each successive value providing roughly +~3% to speed.
+ An acceleration value of "1" is the same as regular LZ4_compress_default()
+ Values <= 0 will be replaced by ACCELERATION_DEFAULT (see lz4.c), which is 1.
*/
-int LZ4_compressBound(int isize);
+LZ4LIB_API int LZ4_compress_fast (const char* source, char* dest, int sourceSize, int maxDestSize, int acceleration);
-/*
-LZ4_compress_limitedOutput() :
- Compress 'inputSize' bytes from 'source' into an output buffer 'dest' of maximum size 'maxOutputSize'.
- If it cannot achieve it, compression will stop, and result of the function will be zero.
- This function never writes outside of provided output buffer.
-
- inputSize : Max supported value is LZ4_MAX_INPUT_VALUE
- maxOutputSize : is the size of the destination buffer (which must be already allocated)
- return : the number of bytes written in buffer 'dest'
- or 0 if the compression fails
+/*!
+LZ4_compress_fast_extState() :
+ Same compression function, just using an externally allocated memory space to store compression state.
+ Use LZ4_sizeofState() to know how much memory must be allocated,
+ and allocate it on 8-bytes boundaries (using malloc() typically).
+ Then, provide it as 'void* state' to compression function.
+*/
+LZ4LIB_API int LZ4_sizeofState(void);
+LZ4LIB_API int LZ4_compress_fast_extState (void* state, const char* source, char* dest, int inputSize, int maxDestSize, int acceleration);
+
+
+/*!
+LZ4_compress_destSize() :
+ Reverse the logic, by compressing as much data as possible from 'source' buffer
+ into already allocated buffer 'dest' of size 'targetDestSize'.
+ This function either compresses the entire 'source' content into 'dest' if it's large enough,
+ or fill 'dest' buffer completely with as much data as possible from 'source'.
+ *sourceSizePtr : will be modified to indicate how many bytes where read from 'source' to fill 'dest'.
+ New value is necessarily <= old value.
+ return : Nb bytes written into 'dest' (necessarily <= targetDestSize)
+ or 0 if compression fails
*/
-int LZ4_compress_limitedOutput (const char* source, char* dest, int inputSize, int maxOutputSize);
+LZ4LIB_API int LZ4_compress_destSize (const char* source, char* dest, int* sourceSizePtr, int targetDestSize);
-/*
+/*!
LZ4_decompress_fast() :
originalSize : is the original and therefore uncompressed size
return : the number of bytes read from the source buffer (in other words, the compressed size)
- If the source stream is malformed, the function will stop decoding and return a negative result.
+ If the source stream is detected malformed, the function will stop decoding and return a negative result.
Destination buffer must be already allocated. Its size must be a minimum of 'originalSize' bytes.
- note : This function is a bit faster than LZ4_decompress_safe()
- It provides fast decompression and fully respect memory boundaries for properly formed compressed data.
- It does not provide full protection against intentionnally modified data stream.
- Use this function in a trusted environment (data to decode comes from a trusted source).
+ note : This function fully respect memory boundaries for properly formed compressed data.
+ It is a bit faster than LZ4_decompress_safe().
+ However, it does not provide any protection against intentionally modified data stream (malicious input).
+ Use this function in trusted environment only (data to decode comes from a trusted source).
*/
-int LZ4_decompress_fast (const char* source, char* dest, int originalSize);
+LZ4LIB_API int LZ4_decompress_fast (const char* source, char* dest, int originalSize);
-
-/*
+/*!
LZ4_decompress_safe_partial() :
This function decompress a compressed block of size 'compressedSize' at position 'source'
- into output buffer 'dest' of size 'maxOutputSize'.
+ into destination buffer 'dest' of size 'maxDecompressedSize'.
The function tries to stop decompressing operation as soon as 'targetOutputSize' has been reached,
reducing decompression time.
- return : the number of bytes decoded in the destination buffer (necessarily <= maxOutputSize)
+ return : the number of bytes decoded in the destination buffer (necessarily <= maxDecompressedSize)
Note : this number can be < 'targetOutputSize' should the compressed block to decode be smaller.
Always control how many bytes were decoded.
If the source stream is detected malformed, the function will stop decoding and return a negative result.
This function never writes outside of output buffer, and never reads outside of input buffer. It is therefore protected against malicious data packets
*/
-int LZ4_decompress_safe_partial (const char* source, char* dest, int compressedSize, int targetOutputSize, int maxOutputSize);
+LZ4LIB_API int LZ4_decompress_safe_partial (const char* source, char* dest, int compressedSize, int targetOutputSize, int maxDecompressedSize);
-/***********************************************
- Experimental Streaming Compression Functions
+/*-*********************************************
+* Streaming Compression Functions
***********************************************/
+typedef union LZ4_stream_u LZ4_stream_t; /* incomplete type (defined later) */
-#define LZ4_STREAMSIZE_U32 ((1 << (LZ4_MEMORY_USAGE-2)) + 8)
-#define LZ4_STREAMSIZE (LZ4_STREAMSIZE_U32 * sizeof(unsigned int))
-/*
- * LZ4_stream_t
- * information structure to track an LZ4 stream.
- * important : set this structure content to zero before first use !
- */
-typedef struct { unsigned int table[LZ4_STREAMSIZE_U32]; } LZ4_stream_t;
-
-/*
- * If you prefer dynamic allocation methods,
- * LZ4_createStream
- * provides a pointer (void*) towards an initialized LZ4_stream_t structure.
- * LZ4_free just frees it.
+/*! LZ4_createStream() and LZ4_freeStream() :
+ * LZ4_createStream() will allocate and initialize an `LZ4_stream_t` structure.
+ * LZ4_freeStream() releases its memory.
*/
-void* LZ4_createStream();
-int LZ4_free (void* LZ4_stream);
-
+LZ4LIB_API LZ4_stream_t* LZ4_createStream(void);
+LZ4LIB_API int LZ4_freeStream (LZ4_stream_t* streamPtr);
-/*
- * LZ4_loadDict
- * Use this function to load a static dictionary into LZ4_stream.
- * Any previous data will be forgotten, only 'dictionary' will remain in memory.
- * Loading a size of 0 is allowed (same effect as init).
- * Return : 1 if OK, 0 if error
+/*! LZ4_resetStream() :
+ * An LZ4_stream_t structure can be allocated once and re-used multiple times.
+ * Use this function to init an allocated `LZ4_stream_t` structure and start a new compression.
*/
-int LZ4_loadDict (void* LZ4_stream, const char* dictionary, int dictSize);
+LZ4LIB_API void LZ4_resetStream (LZ4_stream_t* streamPtr);
-/*
- * LZ4_compress_continue
- * Compress data block 'source', using blocks compressed before as dictionary to improve compression ratio
- * Previous data blocks are assumed to still be present at their previous location.
+/*! LZ4_loadDict() :
+ * Use this function to load a static dictionary into LZ4_stream.
+ * Any previous data will be forgotten, only 'dictionary' will remain in memory.
+ * Loading a size of 0 is allowed.
+ * Return : dictionary size, in bytes (necessarily <= 64 KB)
*/
-int LZ4_compress_continue (void* LZ4_stream, const char* source, char* dest, int inputSize);
-
-/*
- * LZ4_compress_limitedOutput_continue
- * Same as before, but also specify a maximum target compressed size (maxOutputSize)
- * If objective cannot be met, compression exits, and returns a zero.
+LZ4LIB_API int LZ4_loadDict (LZ4_stream_t* streamPtr, const char* dictionary, int dictSize);
+
+/*! LZ4_compress_fast_continue() :
+ * Compress buffer content 'src', using data from previously compressed blocks as dictionary to improve compression ratio.
+ * Important : Previous data blocks are assumed to remain present and unmodified !
+ * 'dst' buffer must be already allocated.
+ * If dstCapacity >= LZ4_compressBound(srcSize), compression is guaranteed to succeed, and runs faster.
+ * If not, and if compressed data cannot fit into 'dst' buffer size, compression stops, and function @return==0.
+ * After an error, the stream status is invalid, it can only be reset or freed.
*/
-int LZ4_compress_limitedOutput_continue (void* LZ4_stream, const char* source, char* dest, int inputSize, int maxOutputSize);
+LZ4LIB_API int LZ4_compress_fast_continue (LZ4_stream_t* streamPtr, const char* src, char* dst, int srcSize, int dstCapacity, int acceleration);
-/*
- * LZ4_saveDict
- * If previously compressed data block is not guaranteed to remain at its previous memory location
- * save it into a safe place (char* safeBuffer)
- * Note : you don't need to call LZ4_loadDict() afterwards,
- * dictionary is immediately usable, you can therefore call again LZ4_compress_continue()
- * Return : 1 if OK, 0 if error
- * Note : any dictSize > 64 KB will be interpreted as 64KB.
+/*! LZ4_saveDict() :
+ * If previously compressed data block is not guaranteed to remain available at its current memory location,
+ * save it into a safer place (char* safeBuffer).
+ * Note : it's not necessary to call LZ4_loadDict() after LZ4_saveDict(), dictionary is immediately usable.
+ * @return : saved dictionary size in bytes (necessarily <= dictSize), or 0 if error.
*/
-int LZ4_saveDict (void* LZ4_stream, char* safeBuffer, int dictSize);
+LZ4LIB_API int LZ4_saveDict (LZ4_stream_t* streamPtr, char* safeBuffer, int dictSize);
-/************************************************
- Experimental Streaming Decompression Functions
+/*-**********************************************
+* Streaming Decompression Functions
+* Bufferless synchronous API
************************************************/
+typedef union LZ4_streamDecode_u LZ4_streamDecode_t; /* incomplete type (defined later) */
-#define LZ4_STREAMDECODESIZE_U32 4
-#define LZ4_STREAMDECODESIZE (LZ4_STREAMDECODESIZE_U32 * sizeof(unsigned int))
-/*
- * LZ4_streamDecode_t
- * information structure to track an LZ4 stream.
- * important : set this structure content to zero before first use !
+/*! LZ4_createStreamDecode() and LZ4_freeStreamDecode() :
+ * creation / destruction of streaming decompression tracking structure */
+LZ4LIB_API LZ4_streamDecode_t* LZ4_createStreamDecode(void);
+LZ4LIB_API int LZ4_freeStreamDecode (LZ4_streamDecode_t* LZ4_stream);
+
+/*! LZ4_setStreamDecode() :
+ * Use this function to instruct where to find the dictionary.
+ * Setting a size of 0 is allowed (same effect as reset).
+ * @return : 1 if OK, 0 if error
*/
-typedef struct { unsigned int table[LZ4_STREAMDECODESIZE_U32]; } LZ4_streamDecode_t;
+LZ4LIB_API int LZ4_setStreamDecode (LZ4_streamDecode_t* LZ4_streamDecode, const char* dictionary, int dictSize);
+
+/*! LZ4_decompress_*_continue() :
+ * These decoding functions allow decompression of multiple blocks in "streaming" mode.
+ * Previously decoded blocks *must* remain available at the memory position where they were decoded (up to 64 KB)
+ * In the case of a ring buffers, decoding buffer must be either :
+ * - Exactly same size as encoding buffer, with same update rule (block boundaries at same positions)
+ * In which case, the decoding & encoding ring buffer can have any size, including very small ones ( < 64 KB).
+ * - Larger than encoding buffer, by a minimum of maxBlockSize more bytes.
+ * maxBlockSize is implementation dependent. It's the maximum size you intend to compress into a single block.
+ * In which case, encoding and decoding buffers do not need to be synchronized,
+ * and encoding ring buffer can have any size, including small ones ( < 64 KB).
+ * - _At least_ 64 KB + 8 bytes + maxBlockSize.
+ * In which case, encoding and decoding buffers do not need to be synchronized,
+ * and encoding ring buffer can have any size, including larger than decoding buffer.
+ * Whenever these conditions are not possible, save the last 64KB of decoded data into a safe buffer,
+ * and indicate where it is saved using LZ4_setStreamDecode()
+*/
+LZ4LIB_API int LZ4_decompress_safe_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int compressedSize, int maxDecompressedSize);
+LZ4LIB_API int LZ4_decompress_fast_continue (LZ4_streamDecode_t* LZ4_streamDecode, const char* source, char* dest, int originalSize);
-/*
- * If you prefer dynamic allocation methods,
- * LZ4_createStreamDecode()
- * provides a pointer (void*) towards an initialized LZ4_streamDecode_t structure.
- * LZ4_free just frees it.
+
+/*! LZ4_decompress_*_usingDict() :
+ * These decoding functions work the same as
+ * a combination of LZ4_setStreamDecode() followed by LZ4_decompress_*_continue()
+ * They are stand-alone, and don't need an LZ4_streamDecode_t structure.
*/
-void* LZ4_createStreamDecode();
-int LZ4_free (void* LZ4_stream); /* yes, it's the same one as for compression */
+LZ4LIB_API int LZ4_decompress_safe_usingDict (const char* source, char* dest, int compressedSize, int maxDecompressedSize, const char* dictStart, int dictSize);
+LZ4LIB_API int LZ4_decompress_fast_usingDict (const char* source, char* dest, int originalSize, const char* dictStart, int dictSize);
+
+
+/*^**********************************************
+ * !!!!!! STATIC LINKING ONLY !!!!!!
+ ***********************************************/
+/*-************************************
+ * Private definitions
+ **************************************
+ * Do not use these definitions.
+ * They are exposed to allow static allocation of `LZ4_stream_t` and `LZ4_streamDecode_t`.
+ * Using these definitions will expose code to API and/or ABI break in future versions of the library.
+ **************************************/
+#define LZ4_HASHLOG (LZ4_MEMORY_USAGE-2)
+#define LZ4_HASHTABLESIZE (1 << LZ4_MEMORY_USAGE)
+#define LZ4_HASH_SIZE_U32 (1 << LZ4_HASHLOG) /* required as macro for static allocation */
+
+#if defined(__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)
+#include <stdint.h>
+
+typedef struct {
+ uint32_t hashTable[LZ4_HASH_SIZE_U32];
+ uint32_t currentOffset;
+ uint32_t initCheck;
+ const uint8_t* dictionary;
+ uint8_t* bufferStart; /* obsolete, used for slideInputBuffer */
+ uint32_t dictSize;
+} LZ4_stream_t_internal;
+
+typedef struct {
+ const uint8_t* externalDict;
+ size_t extDictSize;
+ const uint8_t* prefixEnd;
+ size_t prefixSize;
+} LZ4_streamDecode_t_internal;
+
+#else
+
+typedef struct {
+ unsigned int hashTable[LZ4_HASH_SIZE_U32];
+ unsigned int currentOffset;
+ unsigned int initCheck;
+ const unsigned char* dictionary;
+ unsigned char* bufferStart; /* obsolete, used for slideInputBuffer */
+ unsigned int dictSize;
+} LZ4_stream_t_internal;
+
+typedef struct {
+ const unsigned char* externalDict;
+ size_t extDictSize;
+ const unsigned char* prefixEnd;
+ size_t prefixSize;
+} LZ4_streamDecode_t_internal;
-/*
-*_continue() :
- These decoding functions allow decompression of multiple blocks in "streaming" mode.
- Previously decoded blocks must still be available at the memory position where they were decoded.
- If it's not possible, save the relevant part of decoded data into a safe buffer,
- and indicate where it stands using LZ4_setDictDecode()
-*/
-int LZ4_decompress_safe_continue (void* LZ4_streamDecode, const char* source, char* dest, int compressedSize, int maxOutputSize);
-int LZ4_decompress_fast_continue (void* LZ4_streamDecode, const char* source, char* dest, int originalSize);
+#endif
-/*
- * LZ4_setDictDecode
- * Use this function to instruct where to find the dictionary.
- * This function can be used to specify a static dictionary,
- * or to instruct where to find some previously decoded data saved into a different memory space.
- * Setting a size of 0 is allowed (same effect as no dictionary).
- * Return : 1 if OK, 0 if error
+/*!
+ * LZ4_stream_t :
+ * information structure to track an LZ4 stream.
+ * init this structure before first use.
+ * note : only use in association with static linking !
+ * this definition is not API/ABI safe,
+ * it may change in a future version !
*/
-int LZ4_setDictDecode (void* LZ4_streamDecode, const char* dictionary, int dictSize);
+#define LZ4_STREAMSIZE_U64 ((1 << (LZ4_MEMORY_USAGE-3)) + 4)
+#define LZ4_STREAMSIZE (LZ4_STREAMSIZE_U64 * sizeof(unsigned long long))
+union LZ4_stream_u {
+ unsigned long long table[LZ4_STREAMSIZE_U64];
+ LZ4_stream_t_internal internal_donotuse;
+} ; /* previously typedef'd to LZ4_stream_t */
+
+
+/*!
+ * LZ4_streamDecode_t :
+ * information structure to track an LZ4 stream during decompression.
+ * init this structure using LZ4_setStreamDecode (or memset()) before first use
+ * note : only use in association with static linking !
+ * this definition is not API/ABI safe,
+ * and may change in a future version !
+ */
+#define LZ4_STREAMDECODESIZE_U64 4
+#define LZ4_STREAMDECODESIZE (LZ4_STREAMDECODESIZE_U64 * sizeof(unsigned long long))
+union LZ4_streamDecode_u {
+ unsigned long long table[LZ4_STREAMDECODESIZE_U64];
+ LZ4_streamDecode_t_internal internal_donotuse;
+} ; /* previously typedef'd to LZ4_streamDecode_t */
-/*
-Advanced decoding functions :
-*_usingDict() :
- These decoding functions work the same as
- a combination of LZ4_setDictDecode() followed by LZ4_decompress_x_continue()
- all together into a single function call.
- It doesn't use nor update an LZ4_streamDecode_t structure.
-*/
-int LZ4_decompress_safe_usingDict (const char* source, char* dest, int compressedSize, int maxOutputSize, const char* dictStart, int dictSize);
-int LZ4_decompress_fast_usingDict (const char* source, char* dest, int originalSize, const char* dictStart, int dictSize);
+/*-************************************
+* Obsolete Functions
+**************************************/
+/*! Deprecation warnings
+ Should deprecation warnings be a problem,
+ it is generally possible to disable them,
+ typically with -Wno-deprecated-declarations for gcc
+ or _CRT_SECURE_NO_WARNINGS in Visual.
+ Otherwise, it's also possible to define LZ4_DISABLE_DEPRECATE_WARNINGS */
+#ifdef LZ4_DISABLE_DEPRECATE_WARNINGS
+# define LZ4_DEPRECATED(message) /* disable deprecation warnings */
+#else
+# define LZ4_GCC_VERSION (__GNUC__ * 100 + __GNUC_MINOR__)
+# if defined (__cplusplus) && (__cplusplus >= 201402) /* C++14 or greater */
+# define LZ4_DEPRECATED(message) [[deprecated(message)]]
+# elif (LZ4_GCC_VERSION >= 405) || defined(__clang__)
+# define LZ4_DEPRECATED(message) __attribute__((deprecated(message)))
+# elif (LZ4_GCC_VERSION >= 301)
+# define LZ4_DEPRECATED(message) __attribute__((deprecated))
+# elif defined(_MSC_VER)
+# define LZ4_DEPRECATED(message) __declspec(deprecated(message))
+# else
+# pragma message("WARNING: You need to implement LZ4_DEPRECATED for this compiler")
+# define LZ4_DEPRECATED(message)
+# endif
+#endif /* LZ4_DISABLE_DEPRECATE_WARNINGS */
+
+/* Obsolete compression functions */
+LZ4LIB_API LZ4_DEPRECATED("use LZ4_compress_default() instead") int LZ4_compress (const char* source, char* dest, int sourceSize);
+LZ4LIB_API LZ4_DEPRECATED("use LZ4_compress_default() instead") int LZ4_compress_limitedOutput (const char* source, char* dest, int sourceSize, int maxOutputSize);
+LZ4LIB_API LZ4_DEPRECATED("use LZ4_compress_fast_extState() instead") int LZ4_compress_withState (void* state, const char* source, char* dest, int inputSize);
+LZ4LIB_API LZ4_DEPRECATED("use LZ4_compress_fast_extState() instead") int LZ4_compress_limitedOutput_withState (void* state, const char* source, char* dest, int inputSize, int maxOutputSize);
+LZ4LIB_API LZ4_DEPRECATED("use LZ4_compress_fast_continue() instead") int LZ4_compress_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize);
+LZ4LIB_API LZ4_DEPRECATED("use LZ4_compress_fast_continue() instead") int LZ4_compress_limitedOutput_continue (LZ4_stream_t* LZ4_streamPtr, const char* source, char* dest, int inputSize, int maxOutputSize);
+
+/* Obsolete decompression functions */
+LZ4LIB_API LZ4_DEPRECATED("use LZ4_decompress_fast() instead") int LZ4_uncompress (const char* source, char* dest, int outputSize);
+LZ4LIB_API LZ4_DEPRECATED("use LZ4_decompress_safe() instead") int LZ4_uncompress_unknownOutputSize (const char* source, char* dest, int isize, int maxOutputSize);
+
+/* Obsolete streaming functions; use new streaming interface whenever possible */
+LZ4LIB_API LZ4_DEPRECATED("use LZ4_createStream() instead") void* LZ4_create (char* inputBuffer);
+LZ4LIB_API LZ4_DEPRECATED("use LZ4_createStream() instead") int LZ4_sizeofStreamState(void);
+LZ4LIB_API LZ4_DEPRECATED("use LZ4_resetStream() instead") int LZ4_resetStreamState(void* state, char* inputBuffer);
+LZ4LIB_API LZ4_DEPRECATED("use LZ4_saveDict() instead") char* LZ4_slideInputBuffer (void* state);
+
+/* Obsolete streaming decoding functions */
+LZ4LIB_API LZ4_DEPRECATED("use LZ4_decompress_safe_usingDict() instead") int LZ4_decompress_safe_withPrefix64k (const char* src, char* dst, int compressedSize, int maxDstSize);
+LZ4LIB_API LZ4_DEPRECATED("use LZ4_decompress_fast_usingDict() instead") int LZ4_decompress_fast_withPrefix64k (const char* src, char* dst, int originalSize);
+
+#endif /* LZ4_H_2983827168210 */
#if defined (__cplusplus)
diff --git a/mfbt/moz.build b/mfbt/moz.build
index f23a3b6f5d..897a686f48 100644
--- a/mfbt/moz.build
+++ b/mfbt/moz.build
@@ -87,6 +87,7 @@ EXPORTS.mozilla = [
'StaticAnalysisFunctions.h',
'TaggedAnonymousMemory.h',
'TemplateLib.h',
+ 'TextUtils.h',
'ThreadLocal.h',
'ToString.h',
'Tuple.h',
diff --git a/mfbt/tests/TestTextUtils.cpp b/mfbt/tests/TestTextUtils.cpp
new file mode 100644
index 0000000000..db481c1389
--- /dev/null
+++ b/mfbt/tests/TestTextUtils.cpp
@@ -0,0 +1,106 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "mozilla/Assertions.h"
+#include "mozilla/TextUtils.h"
+
+using mozilla::IsAsciiAlpha;
+
+// char
+
+static_assert(!IsAsciiAlpha('@'), "'@' isn't ASCII alpha");
+static_assert('@' == 0x40, "'@' has value 0x40");
+
+static_assert('A' == 0x41, "'A' has value 0x41");
+static_assert(IsAsciiAlpha('A'), "'A' is ASCII alpha");
+static_assert(IsAsciiAlpha('B'), "'B' is ASCII alpha");
+static_assert(IsAsciiAlpha('M'), "'M' is ASCII alpha");
+static_assert(IsAsciiAlpha('Y'), "'Y' is ASCII alpha");
+static_assert(IsAsciiAlpha('Z'), "'Z' is ASCII alpha");
+
+static_assert('Z' == 0x5A, "'Z' has value 0x5A");
+static_assert('[' == 0x5B, "'[' has value 0x5B");
+static_assert(!IsAsciiAlpha('['), "'[' isn't ASCII alpha");
+
+static_assert(!IsAsciiAlpha('`'), "'`' isn't ASCII alpha");
+static_assert('`' == 0x60, "'`' has value 0x60");
+
+static_assert('a' == 0x61, "'a' has value 0x61");
+static_assert(IsAsciiAlpha('a'), "'a' is ASCII alpha");
+static_assert(IsAsciiAlpha('b'), "'b' is ASCII alpha");
+static_assert(IsAsciiAlpha('m'), "'m' is ASCII alpha");
+static_assert(IsAsciiAlpha('y'), "'y' is ASCII alpha");
+static_assert(IsAsciiAlpha('z'), "'z' is ASCII alpha");
+
+static_assert('z' == 0x7A, "'z' has value 0x7A");
+static_assert('{' == 0x7B, "'{' has value 0x7B");
+static_assert(!IsAsciiAlpha('{'), "'{' isn't ASCII alpha");
+
+// char16_t
+
+static_assert(!IsAsciiAlpha(u'@'), "u'@' isn't ASCII alpha");
+static_assert(u'@' == 0x40, "u'@' has value 0x40");
+
+static_assert(u'A' == 0x41, "u'A' has value 0x41");
+static_assert(IsAsciiAlpha(u'A'), "u'A' is ASCII alpha");
+static_assert(IsAsciiAlpha(u'B'), "u'B' is ASCII alpha");
+static_assert(IsAsciiAlpha(u'M'), "u'M' is ASCII alpha");
+static_assert(IsAsciiAlpha(u'Y'), "u'Y' is ASCII alpha");
+static_assert(IsAsciiAlpha(u'Z'), "u'Z' is ASCII alpha");
+
+static_assert(u'Z' == 0x5A, "u'Z' has value 0x5A");
+static_assert(u'[' == 0x5B, "u'[' has value 0x5B");
+static_assert(!IsAsciiAlpha(u'['), "u'[' isn't ASCII alpha");
+
+static_assert(!IsAsciiAlpha(u'`'), "u'`' isn't ASCII alpha");
+static_assert(u'`' == 0x60, "u'`' has value 0x60");
+
+static_assert(u'a' == 0x61, "u'a' has value 0x61");
+static_assert(IsAsciiAlpha(u'a'), "u'a' is ASCII alpha");
+static_assert(IsAsciiAlpha(u'b'), "u'b' is ASCII alpha");
+static_assert(IsAsciiAlpha(u'm'), "u'm' is ASCII alpha");
+static_assert(IsAsciiAlpha(u'y'), "u'y' is ASCII alpha");
+static_assert(IsAsciiAlpha(u'z'), "u'z' is ASCII alpha");
+
+static_assert(u'z' == 0x7A, "u'z' has value 0x7A");
+static_assert(u'{' == 0x7B, "u'{' has value 0x7B");
+static_assert(!IsAsciiAlpha(u'{'), "u'{' isn't ASCII alpha");
+
+// char32_t
+
+static_assert(!IsAsciiAlpha(U'@'), "U'@' isn't ASCII alpha");
+static_assert(U'@' == 0x40, "U'@' has value 0x40");
+
+static_assert(U'A' == 0x41, "U'A' has value 0x41");
+static_assert(IsAsciiAlpha(U'A'), "U'A' is ASCII alpha");
+static_assert(IsAsciiAlpha(U'B'), "U'B' is ASCII alpha");
+static_assert(IsAsciiAlpha(U'M'), "U'M' is ASCII alpha");
+static_assert(IsAsciiAlpha(U'Y'), "U'Y' is ASCII alpha");
+static_assert(IsAsciiAlpha(U'Z'), "U'Z' is ASCII alpha");
+
+static_assert(U'Z' == 0x5A, "U'Z' has value 0x5A");
+static_assert(U'[' == 0x5B, "U'[' has value 0x5B");
+static_assert(!IsAsciiAlpha(U'['), "U'[' isn't ASCII alpha");
+
+static_assert(!IsAsciiAlpha(U'`'), "U'`' isn't ASCII alpha");
+static_assert(U'`' == 0x60, "U'`' has value 0x60");
+
+static_assert(U'a' == 0x61, "U'a' has value 0x61");
+static_assert(IsAsciiAlpha(U'a'), "U'a' is ASCII alpha");
+static_assert(IsAsciiAlpha(U'b'), "U'b' is ASCII alpha");
+static_assert(IsAsciiAlpha(U'm'), "U'm' is ASCII alpha");
+static_assert(IsAsciiAlpha(U'y'), "U'y' is ASCII alpha");
+static_assert(IsAsciiAlpha(U'z'), "U'z' is ASCII alpha");
+
+static_assert(U'z' == 0x7A, "U'z' has value 0x7A");
+static_assert(U'{' == 0x7B, "U'{' has value 0x7B");
+static_assert(!IsAsciiAlpha(U'{'), "U'{' isn't ASCII alpha");
+
+int
+main()
+{
+ return 0;
+}
diff --git a/mfbt/tests/moz.build b/mfbt/tests/moz.build
index f96117e038..bd25ab1d0b 100644
--- a/mfbt/tests/moz.build
+++ b/mfbt/tests/moz.build
@@ -42,6 +42,7 @@ CppUnitTests([
'TestSHA1',
'TestSplayTree',
'TestTemplateLib',
+ 'TestTextUtils',
'TestTuple',
'TestTypedEnum',
'TestTypeTraits',
diff --git a/mobile/android/app/build.gradle b/mobile/android/app/build.gradle
index 18586cadb5..724b955ef4 100644
--- a/mobile/android/app/build.gradle
+++ b/mobile/android/app/build.gradle
@@ -100,9 +100,7 @@ android {
srcDir "${topsrcdir}/mobile/android/stumbler/java"
}
- if (!mozconfig.substs.MOZ_CRASHREPORTER) {
- exclude 'org/mozilla/gecko/CrashReporter.java'
- }
+ exclude 'org/mozilla/gecko/CrashReporter.java'
if (!mozconfig.substs.MOZ_NATIVE_DEVICES) {
exclude 'org/mozilla/gecko/ChromeCastDisplay.java'
diff --git a/mobile/android/app/mobile.js b/mobile/android/app/mobile.js
index 9a28bd7160..c0eba6596b 100644
--- a/mobile/android/app/mobile.js
+++ b/mobile/android/app/mobile.js
@@ -215,8 +215,8 @@ pref("extensions.hideUpdateButton", false);
pref("extensions.strictCompatibility", false);
pref("extensions.minCompatibleAppVersion", "11.0");
-pref("extensions.update.url", "https://versioncheck.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
-pref("extensions.update.background.url", "https://versioncheck-bg.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=%APP_VERSION%&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
+pref("extensions.update.url", "https://versioncheck.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=52.9&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
+pref("extensions.update.background.url", "https://versioncheck-bg.addons.mozilla.org/update/VersionCheck.php?reqVersion=%REQ_VERSION%&id=%ITEM_ID%&version=%ITEM_VERSION%&maxAppVersion=%ITEM_MAXAPPVERSION%&status=%ITEM_STATUS%&appID=%APP_ID%&appVersion=52.9&appOS=%APP_OS%&appABI=%APP_ABI%&locale=%APP_LOCALE%&currentAppVersion=%CURRENT_APP_VERSION%&updateType=%UPDATE_TYPE%&compatMode=%COMPATIBILITY_MODE%");
pref("extensions.hotfix.id", "firefox-android-hotfix@mozilla.org");
pref("extensions.hotfix.cert.checkAttributes", true);
diff --git a/mobile/android/base/AndroidManifest.xml.in b/mobile/android/base/AndroidManifest.xml.in
index 2ec98c35ab..0352c1ab68 100644
--- a/mobile/android/base/AndroidManifest.xml.in
+++ b/mobile/android/base/AndroidManifest.xml.in
@@ -263,20 +263,6 @@
#include ../search/manifests/SearchAndroidManifest_activities.xml.in
#endif
-#if MOZ_CRASHREPORTER
- <activity android:name="org.mozilla.gecko.CrashReporter"
- android:process="@ANDROID_PACKAGE_NAME@.CrashReporter"
- android:label="@string/crash_reporter_title"
- android:icon="@drawable/crash_reporter"
- android:theme="@style/Gecko"
- android:exported="false"
- android:excludeFromRecents="true">
- <intent-filter>
- <action android:name="org.mozilla.gecko.reportCrash" />
- </intent-filter>
- </activity>
-#endif
-
<activity android:name="org.mozilla.gecko.preferences.GeckoPreferences"
android:theme="@style/Gecko.Preferences"
android:configChanges="orientation|screenSize|locale|layoutDirection"
diff --git a/mobile/android/base/AppConstants.java.in b/mobile/android/base/AppConstants.java.in
index 25a6a456ef..21748e73ba 100644
--- a/mobile/android/base/AppConstants.java.in
+++ b/mobile/android/base/AppConstants.java.in
@@ -194,13 +194,6 @@ public class AppConstants {
false;
//#endif
- public static final boolean MOZ_CRASHREPORTER =
-//#if MOZ_CRASHREPORTER
- true;
-//#else
- false;
-//#endif
-
public static final boolean MOZ_DATA_REPORTING =
//#ifdef MOZ_DATA_REPORTING
true;
diff --git a/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java b/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
index 5ab1bc3fd7..aab5be2de4 100644
--- a/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
+++ b/mobile/android/base/java/org/mozilla/gecko/preferences/GeckoPreferences.java
@@ -734,12 +734,6 @@ OnSharedPreferenceChangeListener
i--;
continue;
}
- } else if (PREFS_CRASHREPORTER_ENABLED.equals(key)) {
- if (!AppConstants.MOZ_CRASHREPORTER || !Restrictions.isAllowed(this, Restrictable.DATA_CHOICES)) {
- preferences.removePreference(pref);
- i--;
- continue;
- }
} else if (PREFS_GEO_REPORTING.equals(key) ||
PREFS_GEO_LEARN_MORE.equals(key)) {
if (!AppConstants.MOZ_STUMBLER_BUILD_TIME_ENABLED || !Restrictions.isAllowed(this, Restrictable.DATA_CHOICES)) {
diff --git a/mobile/android/base/moz.build b/mobile/android/base/moz.build
index 6c88464ab5..eac831421f 100644
--- a/mobile/android/base/moz.build
+++ b/mobile/android/base/moz.build
@@ -805,10 +805,6 @@ gbjar.extra_jars += [
CONFIG['ANDROID_SUPPORT_V4_AAR_INTERNAL_LIB'],
'constants.jar'
]
-if CONFIG['MOZ_CRASHREPORTER']:
- gbjar.sources += [ 'java/org/mozilla/gecko/CrashReporter.java' ]
- ANDROID_RES_DIRS += [ 'crashreporter/res' ]
-
if CONFIG['MOZ_ANDROID_GCM']:
gbjar.sources += ['java/org/mozilla/gecko/' + x for x in [
'gcm/GcmInstanceIDListenerService.java',
@@ -1089,7 +1085,7 @@ for var in ('ANDROID_PACKAGE_NAME', 'ANDROID_CPU_ARCH',
'MOZ_APP_DISPLAYNAME', 'MOZ_APP_UA_NAME', 'MOZ_APP_ID', 'MOZ_APP_NAME',
'MOZ_APP_VENDOR', 'MOZ_APP_VERSION', 'MOZ_CHILD_PROCESS_NAME',
'MOZ_ANDROID_APPLICATION_CLASS', 'MOZ_ANDROID_BROWSER_INTENT_CLASS', 'MOZ_ANDROID_SEARCH_INTENT_CLASS',
- 'MOZ_CRASHREPORTER', 'MOZ_UPDATE_CHANNEL', 'OMNIJAR_NAME',
+ 'MOZ_UPDATE_CHANNEL', 'OMNIJAR_NAME',
'OS_TARGET', 'TARGET_XPCOM_ABI'):
DEFINES[var] = CONFIG[var]
diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/CrashHandler.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/CrashHandler.java
index 15df273368..0c8eeff9e9 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/CrashHandler.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/CrashHandler.java
@@ -467,10 +467,6 @@ public class CrashHandler implements Thread.UncaughtExceptionHandler {
@Override
public boolean reportException(final Thread thread, final Throwable exc) {
- if (AppConstants.MOZ_CRASHREPORTER && AppConstants.MOZILLA_OFFICIAL) {
- // Only use Java crash reporter if enabled on official build.
- return super.reportException(thread, exc);
- }
return false;
}
};
diff --git a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
index a802126395..152981649f 100644
--- a/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
+++ b/mobile/android/geckoview/src/main/java/org/mozilla/gecko/GeckoAppShell.java
@@ -166,10 +166,6 @@ public class GeckoAppShell
// reportJavaCrash should have caused us to hard crash. If we're still here,
// it probably means Gecko is not loaded, and we should do something else.
- if (AppConstants.MOZ_CRASHREPORTER && AppConstants.MOZILLA_OFFICIAL) {
- // Only use Java crash reporter if enabled on official build.
- return super.reportException(thread, exc);
- }
return false;
}
};
diff --git a/mobile/android/installer/package-manifest.in b/mobile/android/installer/package-manifest.in
index a643ea243d..086138d47f 100644
--- a/mobile/android/installer/package-manifest.in
+++ b/mobile/android/installer/package-manifest.in
@@ -507,14 +507,6 @@
@BINPATH@/@DLL_PREFIX@mozsandbox@DLL_SUFFIX@
#endif
-; [Crash Reporter]
-; CrashService is not used on Android but the ini files are required for L10N
-; strings, see bug 1191351.
-#ifdef MOZ_CRASHREPORTER
-@BINPATH@/crashreporter.ini
-@BINPATH@/crashreporter-override.ini
-#endif
-
[mobile]
@BINPATH@/chrome/chrome@JAREXT@
@BINPATH@/chrome/chrome.manifest
diff --git a/mobile/android/tests/browser/robocop/robocop_head.js b/mobile/android/tests/browser/robocop/robocop_head.js
index 0fa7e56c8a..c9e1383f21 100644
--- a/mobile/android/tests/browser/robocop/robocop_head.js
+++ b/mobile/android/tests/browser/robocop/robocop_head.js
@@ -69,25 +69,6 @@ try {
}
catch (e) { }
-// Enable crash reporting, if possible
-// We rely on the Python harness to set MOZ_CRASHREPORTER_NO_REPORT
-// and handle checking for minidumps.
-// Note that if we're in a child process, we don't want to init the
-// crashreporter component.
-try { // nsIXULRuntime is not available in some configurations.
- if (runningInParent &&
- "@mozilla.org/toolkit/crash-reporter;1" in Components.classes) {
- // Remember to update </toolkit/crashreporter/test/unit/test_crashreporter.js>
- // too if you change this initial setting.
- let crashReporter =
- Components.classes["@mozilla.org/toolkit/crash-reporter;1"]
- .getService(Components.interfaces.nsICrashReporter);
- crashReporter.enabled = true;
- crashReporter.minidumpPath = do_get_cwd();
- }
-}
-catch (e) { }
-
/**
* Date.now() is not necessarily monotonically increasing (insert sob story
* about times not being the right tool to use for measuring intervals of time,
diff --git a/modules/libjar/nsJARURI.cpp b/modules/libjar/nsJARURI.cpp
index e46e514671..d1e4b5a593 100644
--- a/modules/libjar/nsJARURI.cpp
+++ b/modules/libjar/nsJARURI.cpp
@@ -41,7 +41,6 @@ NS_IMPL_RELEASE(nsJARURI)
NS_INTERFACE_MAP_BEGIN(nsJARURI)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIJARURI)
NS_INTERFACE_MAP_ENTRY(nsIURI)
- NS_INTERFACE_MAP_ENTRY(nsIURIWithQuery)
NS_INTERFACE_MAP_ENTRY(nsIURL)
NS_INTERFACE_MAP_ENTRY(nsIJARURI)
NS_INTERFACE_MAP_ENTRY(nsISerializable)
diff --git a/modules/libjar/nsJARURI.h b/modules/libjar/nsJARURI.h
index 31271e4ac1..d2608a5c6d 100644
--- a/modules/libjar/nsJARURI.h
+++ b/modules/libjar/nsJARURI.h
@@ -41,7 +41,6 @@ class nsJARURI final : public nsIJARURI,
public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIURI
- NS_DECL_NSIURIWITHQUERY
NS_DECL_NSIURL
NS_DECL_NSIJARURI
NS_DECL_NSISERIALIZABLE
diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js
index 7e0b4dde3e..4239c83bdb 100644
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -24,7 +24,7 @@ pref("general.useragent.locale", "chrome://global/locale/intl.properties");
pref("general.useragent.compatMode.gecko", false);
pref("general.useragent.compatMode.firefox", false);
pref("general.useragent.compatMode.version", "52.9");
-pref("general.useragent.appVersionIsBuildID", true);
+pref("general.useragent.appVersionIsBuildID", false);
// This pref exists only for testing purposes. In order to disable all
// overrides by default, don't initialize UserAgentOverrides.jsm.
@@ -118,6 +118,14 @@ pref("browser.cache.compression_level", 0);
// Don't show "Open with" option on download dialog if true.
pref("browser.download.forbid_open_with", false);
+#ifdef XP_WIN
+// Save internet zone information on downloaded files:
+// 0 => Never
+// 1 => Always
+// 2 => Use system setting
+pref("browser.download.saveZoneInformation", 2);
+#endif
+
// Whether or not testing features are enabled.
pref("dom.quotaManager.testing", false);
@@ -175,6 +183,9 @@ pref("dom.enable_resource_timing", true);
// Enable high-resolution timing markers for users
pref("dom.enable_user_timing", true);
+// Whether performance.GetEntries* will contain an entry for the active document
+pref("dom.enable_performance_navigation_timing", true);
+
// Enable printing performance marks/measures to log
pref("dom.performance.enable_user_timing_logging", false);
@@ -184,6 +195,9 @@ pref("dom.performance.enable_notify_performance_timing", false);
// Enable Permission API's .revoke() method
pref("dom.permissions.revoke.enable", false);
+// Enable exposing timeToNonBlankPaint
+pref("dom.performance.time_to_non_blank_paint.enabled", false);
+
// Enable Performance Observer API
#ifdef NIGHTLY_BUILD
pref("dom.enable_performance_observer", true);
@@ -192,11 +206,7 @@ pref("dom.enable_performance_observer", false);
#endif
// Enable requestIdleCallback API
-#ifdef NIGHTLY_BUILD
pref("dom.requestIdleCallback.enabled", true);
-#else
-pref("dom.requestIdleCallback.enabled", false);
-#endif
// Whether the Gamepad API is enabled
pref("dom.gamepad.enabled", true);
@@ -777,16 +787,17 @@ pref("gfx.font_rendering.opentype_svg.enabled", true);
// comma separated list of backends to use in order of preference
// e.g., pref("gfx.canvas.azure.backends", "direct2d,skia,cairo");
pref("gfx.canvas.azure.backends", "direct2d1.1,skia,cairo");
-pref("gfx.content.azure.backends", "direct2d1.1,skia,cairo");
+pref("gfx.content.azure.backends", "direct2d1.1,cairo");
#else
#ifdef XP_MACOSX
-pref("gfx.content.azure.backends", "skia");
-pref("gfx.canvas.azure.backends", "skia");
+pref("gfx.content.azure.backends", "cg");
+pref("gfx.canvas.azure.backends", "skia,cg");
// Accelerated cg canvas where available (10.7+)
pref("gfx.canvas.azure.accelerated", true);
#else
-pref("gfx.canvas.azure.backends", "skia");
-pref("gfx.content.azure.backends", "skia");
+// Linux etc.
+pref("gfx.canvas.azure.backends", "skia,cairo");
+pref("gfx.content.azure.backends", "cairo");
#endif
#endif
@@ -1156,7 +1167,7 @@ pref("dom.require_user_interaction_for_beforeunload", true);
pref("dom.disable_open_during_load", false);
pref("dom.popup_maximum", 20);
-pref("dom.popup_allowed_events", "change click dblclick mouseup notificationclick reset submit touchend");
+pref("dom.popup_allowed_events", "change click dblclick mouseup pointerup notificationclick reset submit touchend");
pref("dom.disable_open_click_delay", 1000);
pref("dom.storage.enabled", true);
@@ -1179,10 +1190,13 @@ pref("dom.forms.number", true);
// platforms which don't have a color picker implemented yet.
pref("dom.forms.color", true);
-// Support for input type=date, time, month, week and datetime-local. By
-// default, disabled.
+// Support for input type=date and type=time. By default, disabled.
pref("dom.forms.datetime", false);
+// Support for input type=month, type=week and type=datetime-local. By default,
+// disabled.
+pref("dom.forms.datetime.others", false);
+
// Enable time picker UI. By default, disabled.
pref("dom.forms.datetime.timepicker", false);
@@ -1233,6 +1247,8 @@ pref("dom.webcomponents.enabled", false);
pref("dom.webcomponents.customelements.enabled", false);
pref("javascript.enabled", true);
+// Enable Array.prototype.values
+pref("javascript.options.array_prototype_values", true);
pref("javascript.options.strict", false);
#ifdef DEBUG
pref("javascript.options.strict.debug", false);
@@ -4736,28 +4752,23 @@ pref("dom.webnotifications.requireinteraction.enabled", false);
// Alert animation effect, name is disableSlidingEffect for backwards-compat.
pref("alerts.disableSlidingEffect", false);
+// The immediate duration of the alert, in milliseconds.
+pref("alerts.durationImmediate", 20000);
// Show favicons in web notifications.
pref("alerts.showFavicons", false);
// DOM full-screen API.
pref("full-screen-api.enabled", false);
-#ifdef RELEASE_OR_BETA
-pref("full-screen-api.unprefix.enabled", false);
-#else
pref("full-screen-api.unprefix.enabled", true);
-#endif
pref("full-screen-api.allow-trusted-requests-only", true);
pref("full-screen-api.pointer-lock.enabled", true);
+
// transition duration of fade-to-black and fade-from-black, unit: ms
-#ifndef MOZ_WIDGET_GTK
-pref("full-screen-api.transition-duration.enter", "200 200");
-pref("full-screen-api.transition-duration.leave", "200 200");
-#else
pref("full-screen-api.transition-duration.enter", "0 0");
pref("full-screen-api.transition-duration.leave", "0 0");
-#endif
+
// timeout for black screen in fullscreen transition, unit: ms
-pref("full-screen-api.transition.timeout", 1000);
+pref("full-screen-api.transition.timeout", 500);
// time for the warning box stays on the screen before sliding out, unit: ms
pref("full-screen-api.warning.timeout", 3000);
// delay for the warning box to show when pointer stays on the top, unit: ms
@@ -5552,6 +5563,12 @@ pref("security.mixed_content.use_hsts", true);
// Approximately 1 week default cache for HSTS priming failures
pref ("security.mixed_content.hsts_priming_cache_timeout", 10080);
+// TODO: Bug 1380959: Block toplevel data: URI navigations
+// If true, all toplevel data: URI navigations will be blocked.
+// Please note that manually entering a data: URI in the
+// URL-Bar will not be blocked when flipping this pref.
+pref("security.data_uri.block_toplevel_data_uri_navigations", false);
+
// Disable Storage api in release builds.
#ifdef NIGHTLY_BUILD
pref("dom.storageManager.enabled", true);
diff --git a/modules/libpref/nsPrefBranch.cpp b/modules/libpref/nsPrefBranch.cpp
index 2fd4992c8f..98e06aaa42 100644
--- a/modules/libpref/nsPrefBranch.cpp
+++ b/modules/libpref/nsPrefBranch.cpp
@@ -26,10 +26,6 @@
#include "prefapi_private_data.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsICrashReporter.h"
-#endif
-
#include "nsIConsoleService.h"
#ifdef DEBUG
@@ -335,16 +331,6 @@ NS_IMETHODIMP nsPrefBranch::GetComplexValue(const char *aPrefName, const nsIID &
// some addons, see bug 836263.
nsAutoString wdata;
if (!AppendUTF8toUTF16(utf8String, wdata, mozilla::fallible)) {
-#ifdef MOZ_CRASHREPORTER
- nsCOMPtr<nsICrashReporter> cr =
- do_GetService("@mozilla.org/toolkit/crash-reporter;1");
- if (cr) {
- cr->AnnotateCrashReport(NS_LITERAL_CSTRING("bug836263-size"),
- nsPrintfCString("%x", utf8String.Length()));
- cr->RegisterAppMemory(uint64_t(utf8String.BeginReading()),
- std::min(0x1000U, utf8String.Length()));
- }
-#endif
NS_RUNTIMEABORT("bug836263");
}
theString->SetData(wdata);
diff --git a/moz.build b/moz.build
index fee89428de..2c02ec3a01 100644
--- a/moz.build
+++ b/moz.build
@@ -84,6 +84,4 @@ if not CONFIG['JS_STANDALONE'] and CONFIG['MOZ_BUILD_APP']:
# Bring in the configuration for the configured application.
include('/' + CONFIG['MOZ_BUILD_APP'] + '/app.mozbuild')
-CONFIGURE_SUBST_FILES += ['.cargo/config']
-
include('build/templates.mozbuild')
diff --git a/moz.configure b/moz.configure
index cecc1335e6..64cdc8ac6e 100644
--- a/moz.configure
+++ b/moz.configure
@@ -52,38 +52,6 @@ def compile_environment(compile_env):
set_config('COMPILE_ENVIRONMENT', compile_environment)
add_old_configure_assignment('COMPILE_ENVIRONMENT', compile_environment)
-js_option('--disable-tests',
- help='Do not build test libraries & programs')
-
-@depends('--disable-tests')
-def enable_tests(value):
- if value:
- return True
-
-set_config('ENABLE_TESTS', enable_tests)
-set_define('ENABLE_TESTS', enable_tests)
-
-@depends(enable_tests)
-def gtest_has_rtti(value):
- if value:
- return '0'
-
-set_define('GTEST_HAS_RTTI', gtest_has_rtti)
-
-@depends(target, enable_tests)
-def linux_gtest_defines(target, enable_tests):
- if enable_tests and target.os == 'Android':
- return namespace(os_linux_android=True,
- use_own_tr1_tuple=True,
- has_clone='0')
-
-set_define('GTEST_OS_LINUX_ANDROID',
- delayed_getattr(linux_gtest_defines, 'os_linux_android'))
-set_define('GTEST_USE_OWN_TR1_TUPLE',
- delayed_getattr(linux_gtest_defines, 'use_own_tr1_tuple'))
-set_define('GTEST_HAS_CLONE',
- delayed_getattr(linux_gtest_defines, 'has_clone'))
-
js_option('--enable-debug',
nargs='?',
help='Enable building with developer debug info '
diff --git a/mozglue/android/NSSBridge.cpp b/mozglue/android/NSSBridge.cpp
index 2a9b5771df..3343ad1b24 100644
--- a/mozglue/android/NSSBridge.cpp
+++ b/mozglue/android/NSSBridge.cpp
@@ -37,6 +37,10 @@ NSS_WRAPPER_INT(PL_Base64Encode)
NSS_WRAPPER_INT(PL_Base64Decode)
NSS_WRAPPER_INT(PL_strfree)
+SECStatus doCrypto(JNIEnv* jenv, const char *path, const char *value, char** result, bool doEncrypt);
+SECStatus encode(const uint8_t* data, uint32_t srclen, char** result);
+SECStatus decode(const char* data, uint8_t** result, uint32_t* length);
+
int
setup_nss_functions(void *nss_handle,
void *nspr_handle,
@@ -189,41 +193,40 @@ doCrypto(JNIEnv* jenv, const char *path, const char *value, char** result, bool
keyid.len = 0;
rv = f_PK11SDR_Encrypt(&keyid, &request, &reply, nullptr);
- if (rv != SECSuccess) {
+ if (rv == SECSuccess) {
+ rv = encode(reply.data, reply.len, result);
+ if (rv == SECSuccess) {
+ LOG("Encrypted: %s\n", *result);
+ } else {
+ throwError(jenv, "encode");
+ }
+ } else {
throwError(jenv, "PK11SDR_Encrypt");
- goto done;
}
- rv = encode(reply.data, reply.len, result);
- if (rv != SECSuccess) {
- throwError(jenv, "encode");
- goto done;
- }
- LOG("Encrypted: %s\n", *result);
} else {
LOG("Decoding: %s\n", value);
- rv = decode(value, &request.data, (int32_t*)&request.len);
+ rv = decode(value, &request.data, &request.len);
if (rv != SECSuccess) {
throwError(jenv, "decode");
return rv;
}
rv = f_PK11SDR_Decrypt(&request, &reply, nullptr);
- if (rv != SECSuccess) {
- throwError(jenv, "PK11SDR_Decrypt");
- goto done;
- }
- *result = (char *)malloc(reply.len+1);
- strncpy(*result, (char *)reply.data, reply.len);
- (*result)[reply.len] = '\0';
+ if (rv == SECSuccess) {
+ *result = static_cast<char*>(malloc(reply.len + 1));
+ strncpy(*result, reinterpret_cast<char*>(reply.data), reply.len);
+ (*result)[reply.len] = '\0';
- // This can print sensitive data. Uncomment if you need it.
- // LOG("Decoded %i letters: %s\n", reply.len, *result);
+ // This can print sensitive data. Uncomment if you need it.
+ // LOG("Decoded %i letters: %s\n", reply.len, *result);
+ } else {
+ throwError(jenv, "PK11SDR_Decrypt");
+ }
free(request.data);
}
-done:
f_SECITEM_ZfreeItem(&reply, false);
return rv;
}
@@ -232,64 +235,51 @@ done:
* Base64 encodes the data passed in. The caller must deallocate _retval using free();
*/
SECStatus
-encode(const unsigned char *data, int32_t dataLen, char **_retval)
+encode(const uint8_t* data, uint32_t srclen, char** result)
{
- SECStatus rv = SECSuccess;
- char *encoded = f_PL_Base64Encode((const char *)data, dataLen, nullptr);
- if (!encoded)
- rv = SECFailure;
- if (!*encoded)
- rv = SECFailure;
-
- if (rv == SECSuccess) {
- *_retval = (char *)malloc(strlen(encoded)+1);
- strcpy(*_retval, encoded);
+ if (srclen > (PR_UINT32_MAX / 4) * 3) {
+ return SECFailure;
}
- if (encoded) {
- f_PR_Free(encoded);
+ const uint32_t dstlen = ((srclen + 2) / 3) * 4;
+ char* const buffer = static_cast<char*>(malloc(dstlen + 1));
+
+ if (!buffer || !f_PL_Base64Encode(reinterpret_cast<const char*>(data), srclen, buffer)) {
+ free(buffer);
+ *result = nullptr;
+ return SECFailure;
}
- return rv;
+ buffer[dstlen] = '\0';
+ *result = buffer;
+ return SECSuccess;
}
/*
* Base64 decodes the data passed in. The caller must deallocate result using free();
*/
SECStatus
-decode(const char *data, unsigned char **result, int32_t *length)
+decode(const char* data, uint8_t** result, uint32_t* length)
{
- SECStatus rv = SECSuccess;
- uint32_t len = strlen(data);
- int adjust = 0;
-
- /* Compute length adjustment */
- if (len > 0 && data[len-1] == '=') {
- adjust++;
- if (data[len-2] == '=') adjust++;
+ uint32_t srclen = strlen(data);
+ while (srclen && data[srclen - 1] == '=') {
+ srclen--;
}
- char *decoded;
- decoded = f_PL_Base64Decode(data, len, nullptr);
- if (!decoded) {
- return SECFailure;
- }
- if (!*decoded) {
+ // Avoid overflow when calculating result length.
+ const uint32_t dstlen = (srclen / 4) * 3 + ((srclen % 4) * 3) / 4;
+ // At most 2 extra bytes due to padding in input.
+ uint8_t* const buffer = static_cast<uint8_t*>(malloc(dstlen + 2));
+
+ if (!buffer || !f_PL_Base64Decode(data, srclen, reinterpret_cast<char*>(buffer))) {
+ free(buffer);
+ *result = nullptr;
+ *length = 0;
return SECFailure;
}
- *length = (len*3)/4 - adjust;
- LOG("Decoded %i chars into %i chars\n", len, *length);
-
- *result = (unsigned char*)malloc((size_t)len);
-
- if (!*result) {
- rv = SECFailure;
- } else {
- memcpy((char*)*result, decoded, len);
- }
- f_PR_Free(decoded);
- return rv;
+ buffer[dstlen] = '\0';
+ *result = buffer;
+ *length = dstlen;
+ return SECSuccess;
}
-
-
diff --git a/mozglue/android/NSSBridge.h b/mozglue/android/NSSBridge.h
index 77bcd11724..83ec8d7494 100644
--- a/mozglue/android/NSSBridge.h
+++ b/mozglue/android/NSSBridge.h
@@ -39,8 +39,4 @@ NSS_WRAPPER(PK11_GetInternalKeySlot, PK11SlotInfo *, void)
NSS_WRAPPER(PK11_NeedUserInit, PRBool, PK11SlotInfo *)
NSS_WRAPPER(PK11_InitPin, SECStatus, PK11SlotInfo*, const char*, const char*)
-bool setPassword(PK11SlotInfo *slot);
-SECStatus doCrypto(JNIEnv* jenv, const char *path, const char *value, char** result, bool doEncrypt);
-SECStatus encode(const unsigned char *data, int32_t dataLen, char **_retval);
-SECStatus decode(const char *data, unsigned char **result, int32_t * _retval);
#endif /* NSS_h */
diff --git a/mozglue/build/moz.build b/mozglue/build/moz.build
index d289747785..5f61d847d8 100644
--- a/mozglue/build/moz.build
+++ b/mozglue/build/moz.build
@@ -32,7 +32,7 @@ if CONFIG['OS_TARGET'] == 'WINNT':
if not CONFIG['JS_STANDALONE']:
- if CONFIG['MOZ_MEMORY'] and (CONFIG['MOZ_SYSTEM_JEMALLOC'] or FORCE_SHARED_LIB):
+ if CONFIG['MOZ_MEMORY'] and FORCE_SHARED_LIB:
pass
# TODO: SHARED_LIBRARY_LIBS go here
else:
diff --git a/netwerk/base/LoadInfo.cpp b/netwerk/base/LoadInfo.cpp
index 42fdea4a18..ede825b8f9 100644
--- a/netwerk/base/LoadInfo.cpp
+++ b/netwerk/base/LoadInfo.cpp
@@ -7,6 +7,7 @@
#include "mozilla/LoadInfo.h"
#include "mozilla/Assertions.h"
+#include "mozilla/dom/TabChild.h"
#include "mozilla/dom/ToJSValue.h"
#include "mozIThirdPartyUtil.h"
#include "nsFrameLoader.h"
@@ -47,12 +48,14 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
aTriggeringPrincipal : mLoadingPrincipal.get())
, mPrincipalToInherit(nullptr)
, mLoadingContext(do_GetWeakReference(aLoadingContext))
+ , mContextForTopLevelLoad(nullptr)
, mSecurityFlags(aSecurityFlags)
, mInternalContentPolicyType(aContentPolicyType)
, mTainting(LoadTainting::Basic)
, mUpgradeInsecureRequests(false)
, mVerifySignedContent(false)
, mEnforceSRI(false)
+ , mForceAllowDataURI(false)
, mForceInheritPrincipalDropped(false)
, mInnerWindowID(0)
, mOuterWindowID(0)
@@ -63,6 +66,7 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
, mIsThirdPartyContext(false)
, mForcePreflight(false)
, mIsPreflight(false)
+ , mLoadTriggeredFromExternal(false)
, mForceHSTSPriming(false)
, mMixedContentWouldBlock(false)
{
@@ -215,16 +219,19 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
*/
LoadInfo::LoadInfo(nsPIDOMWindowOuter* aOuterWindow,
nsIPrincipal* aTriggeringPrincipal,
+ nsISupports* aContextForTopLevelLoad,
nsSecurityFlags aSecurityFlags)
: mLoadingPrincipal(nullptr)
, mTriggeringPrincipal(aTriggeringPrincipal)
, mPrincipalToInherit(nullptr)
+ , mContextForTopLevelLoad(do_GetWeakReference(aContextForTopLevelLoad))
, mSecurityFlags(aSecurityFlags)
, mInternalContentPolicyType(nsIContentPolicy::TYPE_DOCUMENT)
, mTainting(LoadTainting::Basic)
, mUpgradeInsecureRequests(false)
, mVerifySignedContent(false)
, mEnforceSRI(false)
+ , mForceAllowDataURI(false)
, mForceInheritPrincipalDropped(false)
, mInnerWindowID(0)
, mOuterWindowID(0)
@@ -235,6 +242,7 @@ LoadInfo::LoadInfo(nsPIDOMWindowOuter* aOuterWindow,
, mIsThirdPartyContext(false) // NB: TYPE_DOCUMENT implies not third-party.
, mForcePreflight(false)
, mIsPreflight(false)
+ , mLoadTriggeredFromExternal(false)
, mForceHSTSPriming(false)
, mMixedContentWouldBlock(false)
{
@@ -276,12 +284,14 @@ LoadInfo::LoadInfo(const LoadInfo& rhs)
, mTriggeringPrincipal(rhs.mTriggeringPrincipal)
, mPrincipalToInherit(rhs.mPrincipalToInherit)
, mLoadingContext(rhs.mLoadingContext)
+ , mContextForTopLevelLoad(rhs.mContextForTopLevelLoad)
, mSecurityFlags(rhs.mSecurityFlags)
, mInternalContentPolicyType(rhs.mInternalContentPolicyType)
, mTainting(rhs.mTainting)
, mUpgradeInsecureRequests(rhs.mUpgradeInsecureRequests)
, mVerifySignedContent(rhs.mVerifySignedContent)
, mEnforceSRI(rhs.mEnforceSRI)
+ , mForceAllowDataURI(rhs.mForceAllowDataURI)
, mForceInheritPrincipalDropped(rhs.mForceInheritPrincipalDropped)
, mInnerWindowID(rhs.mInnerWindowID)
, mOuterWindowID(rhs.mOuterWindowID)
@@ -297,6 +307,7 @@ LoadInfo::LoadInfo(const LoadInfo& rhs)
, mCorsUnsafeHeaders(rhs.mCorsUnsafeHeaders)
, mForcePreflight(rhs.mForcePreflight)
, mIsPreflight(rhs.mIsPreflight)
+ , mLoadTriggeredFromExternal(rhs.mLoadTriggeredFromExternal)
, mForceHSTSPriming(rhs.mForceHSTSPriming)
, mMixedContentWouldBlock(rhs.mMixedContentWouldBlock)
{
@@ -311,6 +322,7 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
bool aUpgradeInsecureRequests,
bool aVerifySignedContent,
bool aEnforceSRI,
+ bool aForceAllowDataURI,
bool aForceInheritPrincipalDropped,
uint64_t aInnerWindowID,
uint64_t aOuterWindowID,
@@ -325,6 +337,7 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
const nsTArray<nsCString>& aCorsUnsafeHeaders,
bool aForcePreflight,
bool aIsPreflight,
+ bool aLoadTriggeredFromExternal,
bool aForceHSTSPriming,
bool aMixedContentWouldBlock)
: mLoadingPrincipal(aLoadingPrincipal)
@@ -336,6 +349,7 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
, mUpgradeInsecureRequests(aUpgradeInsecureRequests)
, mVerifySignedContent(aVerifySignedContent)
, mEnforceSRI(aEnforceSRI)
+ , mForceAllowDataURI(aForceAllowDataURI)
, mForceInheritPrincipalDropped(aForceInheritPrincipalDropped)
, mInnerWindowID(aInnerWindowID)
, mOuterWindowID(aOuterWindowID)
@@ -348,6 +362,7 @@ LoadInfo::LoadInfo(nsIPrincipal* aLoadingPrincipal,
, mCorsUnsafeHeaders(aCorsUnsafeHeaders)
, mForcePreflight(aForcePreflight)
, mIsPreflight(aIsPreflight)
+ , mLoadTriggeredFromExternal(aLoadTriggeredFromExternal)
, mForceHSTSPriming (aForceHSTSPriming)
, mMixedContentWouldBlock(aMixedContentWouldBlock)
{
@@ -477,6 +492,17 @@ LoadInfo::LoadingNode()
return node;
}
+nsISupports*
+LoadInfo::ContextForTopLevelLoad()
+{
+ // Most likely you want to query LoadingNode() instead of
+ // ContextForTopLevelLoad() if this assertion fires.
+ MOZ_ASSERT(mInternalContentPolicyType == nsIContentPolicy::TYPE_DOCUMENT,
+ "should only query this context for top level document loads");
+ nsCOMPtr<nsISupports> context = do_QueryReferent(mContextForTopLevelLoad);
+ return context;
+}
+
NS_IMETHODIMP
LoadInfo::GetSecurityFlags(nsSecurityFlags* aResult)
{
@@ -648,6 +674,23 @@ LoadInfo::GetEnforceSRI(bool* aResult)
}
NS_IMETHODIMP
+LoadInfo::SetForceAllowDataURI(bool aForceAllowDataURI)
+{
+ MOZ_ASSERT(!mForceAllowDataURI ||
+ mInternalContentPolicyType == nsIContentPolicy::TYPE_DOCUMENT,
+ "can only allow data URI navigation for TYPE_DOCUMENT");
+ mForceAllowDataURI = aForceAllowDataURI;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+LoadInfo::GetForceAllowDataURI(bool* aForceAllowDataURI)
+{
+ *aForceAllowDataURI = mForceAllowDataURI;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
LoadInfo::GetForceInheritPrincipalDropped(bool* aResult)
{
*aResult = mForceInheritPrincipalDropped;
@@ -873,6 +916,23 @@ LoadInfo::GetIsPreflight(bool* aIsPreflight)
}
NS_IMETHODIMP
+LoadInfo::SetLoadTriggeredFromExternal(bool aLoadTriggeredFromExternal)
+{
+ MOZ_ASSERT(!aLoadTriggeredFromExternal ||
+ mInternalContentPolicyType == nsIContentPolicy::TYPE_DOCUMENT,
+ "can only set load triggered from external for TYPE_DOCUMENT");
+ mLoadTriggeredFromExternal = aLoadTriggeredFromExternal;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+LoadInfo::GetLoadTriggeredFromExternal(bool* aLoadTriggeredFromExternal)
+{
+ *aLoadTriggeredFromExternal = mLoadTriggeredFromExternal;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
LoadInfo::GetForceHSTSPriming(bool* aForceHSTSPriming)
{
*aForceHSTSPriming = mForceHSTSPriming;
diff --git a/netwerk/base/LoadInfo.h b/netwerk/base/LoadInfo.h
index 3e1b92ff4c..0ae6061b3e 100644
--- a/netwerk/base/LoadInfo.h
+++ b/netwerk/base/LoadInfo.h
@@ -59,10 +59,12 @@ public:
nsSecurityFlags aSecurityFlags,
nsContentPolicyType aContentPolicyType);
- // Constructor used for TYPE_DOCUMENT loads which have no reasonable
- // loadingNode or loadingPrincipal
+ // Constructor used for TYPE_DOCUMENT loads which have a different
+ // loadingContext than other loads. This ContextForTopLevelLoad is
+ // only used for content policy checks.
LoadInfo(nsPIDOMWindowOuter* aOuterWindow,
nsIPrincipal* aTriggeringPrincipal,
+ nsISupports* aContextForTopLevelLoad,
nsSecurityFlags aSecurityFlags);
// create an exact copy of the loadinfo
@@ -94,6 +96,7 @@ private:
bool aUpgradeInsecureRequests,
bool aVerifySignedContent,
bool aEnforceSRI,
+ bool aForceAllowDataURI,
bool aForceInheritPrincipalDropped,
uint64_t aInnerWindowID,
uint64_t aOuterWindowID,
@@ -108,6 +111,7 @@ private:
const nsTArray<nsCString>& aUnsafeHeaders,
bool aForcePreflight,
bool aIsPreflight,
+ bool aLoadTriggeredFromExternal,
bool aForceHSTSPriming,
bool aMixedContentWouldBlock);
LoadInfo(const LoadInfo& rhs);
@@ -132,12 +136,14 @@ private:
nsCOMPtr<nsIPrincipal> mTriggeringPrincipal;
nsCOMPtr<nsIPrincipal> mPrincipalToInherit;
nsWeakPtr mLoadingContext;
+ nsWeakPtr mContextForTopLevelLoad;
nsSecurityFlags mSecurityFlags;
nsContentPolicyType mInternalContentPolicyType;
LoadTainting mTainting;
bool mUpgradeInsecureRequests;
bool mVerifySignedContent;
bool mEnforceSRI;
+ bool mForceAllowDataURI;
bool mForceInheritPrincipalDropped;
uint64_t mInnerWindowID;
uint64_t mOuterWindowID;
@@ -152,6 +158,7 @@ private:
nsTArray<nsCString> mCorsUnsafeHeaders;
bool mForcePreflight;
bool mIsPreflight;
+ bool mLoadTriggeredFromExternal;
bool mForceHSTSPriming : 1;
bool mMixedContentWouldBlock : 1;
diff --git a/netwerk/base/moz.build b/netwerk/base/moz.build
index 3b731db109..5de1eea81e 100644
--- a/netwerk/base/moz.build
+++ b/netwerk/base/moz.build
@@ -132,7 +132,6 @@ XPIDL_SOURCES += [
'nsIURIClassifier.idl',
'nsIURIWithBlobImpl.idl',
'nsIURIWithPrincipal.idl',
- 'nsIURIWithQuery.idl',
'nsIURL.idl',
'nsIURLParser.idl',
'nsPILoadGroupInternal.idl',
diff --git a/netwerk/base/nsBufferedStreams.h b/netwerk/base/nsBufferedStreams.h
index 93a770bebf..fee55695aa 100644
--- a/netwerk/base/nsBufferedStreams.h
+++ b/netwerk/base/nsBufferedStreams.h
@@ -88,10 +88,10 @@ protected:
////////////////////////////////////////////////////////////////////////////////
-class nsBufferedOutputStream final : public nsBufferedStream,
- public nsISafeOutputStream,
- public nsIBufferedOutputStream,
- public nsIStreamBufferAccess
+class nsBufferedOutputStream : public nsBufferedStream,
+ public nsISafeOutputStream,
+ public nsIBufferedOutputStream,
+ public nsIStreamBufferAccess
{
public:
NS_DECL_ISUPPORTS_INHERITED
diff --git a/netwerk/base/nsILoadInfo.idl b/netwerk/base/nsILoadInfo.idl
index 78433c8b88..4ec29b9725 100644
--- a/netwerk/base/nsILoadInfo.idl
+++ b/netwerk/base/nsILoadInfo.idl
@@ -324,6 +324,16 @@ interface nsILoadInfo : nsISupports
nsINode binaryLoadingNode();
/**
+ * A C++ friendly version of the loadingContext for toplevel loads.
+ * Most likely you want to query the ownerDocument or LoadingNode
+ * and not this context only available for TYPE_DOCUMENT loads.
+ * Please note that except for loads of TYPE_DOCUMENT, this
+ * ContextForTopLevelLoad will always return null.
+ */
+ [noscript, notxpcom, nostdcall, binaryname(ContextForTopLevelLoad)]
+ nsISupports binaryContextForTopLevelLoad();
+
+ /**
* The securityFlags of that channel.
*/
readonly attribute nsSecurityFlags securityFlags;
@@ -470,6 +480,11 @@ interface nsILoadInfo : nsISupports
[infallible] attribute boolean enforceSRI;
/**
+ * If true, toplevel data: URI navigation is allowed
+ */
+ [infallible] attribute boolean forceAllowDataURI;
+
+ /**
* The SEC_FORCE_INHERIT_PRINCIPAL flag may be dropped when a load info
* object is created. Specifically, it will be dropped if the SEC_SANDBOXED
* flag is also present. This flag is set if SEC_FORCE_INHERIT_PRINCIPAL was
@@ -575,6 +590,13 @@ interface nsILoadInfo : nsISupports
[infallible] attribute boolean initialSecurityCheckDone;
/**
+ * Returns true if the load was triggered from an external application
+ * (e.g. Thunderbird). Please note that this flag will only ever be true
+ * if the load is of TYPE_DOCUMENT.
+ */
+ [infallible] attribute boolean loadTriggeredFromExternal;
+
+ /**
* Whenever a channel gets redirected, append the principal of the
* channel [before the channels got redirected] to the loadinfo,
* so that at every point this array lets us reason about all the
diff --git a/netwerk/base/nsINetworkInterceptController.idl b/netwerk/base/nsINetworkInterceptController.idl
index 17d27de42a..721b7a334d 100644
--- a/netwerk/base/nsINetworkInterceptController.idl
+++ b/netwerk/base/nsINetworkInterceptController.idl
@@ -14,12 +14,16 @@ interface nsIURI;
%{C++
#include "nsIConsoleReportCollector.h"
namespace mozilla {
+class TimeStamp;
+
namespace dom {
class ChannelInfo;
}
}
%}
+native TimeStamp(mozilla::TimeStamp);
+
[ptr] native ChannelInfo(mozilla::dom::ChannelInfo);
/**
@@ -97,6 +101,30 @@ interface nsIInterceptedChannel : nsISupports
[noscript]
readonly attribute nsIConsoleReportCollector consoleReportCollector;
+ /**
+ * Save the timestamps of various service worker interception phases.
+ */
+ [noscript]
+ void SetLaunchServiceWorkerStart(in TimeStamp aTimeStamp);
+
+ [noscript]
+ void SetLaunchServiceWorkerEnd(in TimeStamp aTimeStamp);
+
+ [noscript]
+ void SetDispatchFetchEventStart(in TimeStamp aTimeStamp);
+
+ [noscript]
+ void SetDispatchFetchEventEnd(in TimeStamp aTimeStamp);
+
+ [noscript]
+ void SetHandleFetchEventStart(in TimeStamp aTimeStamp);
+
+ [noscript]
+ void SetHandleFetchEventEnd(in TimeStamp aTimeStamp);
+
+ [noscript]
+ void SaveTimeStampsToUnderlyingChannel();
+
%{C++
already_AddRefed<nsIConsoleReportCollector>
GetConsoleReportCollector()
diff --git a/netwerk/base/nsIOService.cpp b/netwerk/base/nsIOService.cpp
index 0da79c18ae..8b7f31f99d 100644
--- a/netwerk/base/nsIOService.cpp
+++ b/netwerk/base/nsIOService.cpp
@@ -173,6 +173,8 @@ uint32_t nsIOService::gDefaultSegmentCount = 24;
bool nsIOService::sTelemetryEnabled = false;
+bool nsIOService::sBlockToplevelDataUriNavigations = false;
+
////////////////////////////////////////////////////////////////////////////////
nsIOService::nsIOService()
@@ -251,6 +253,8 @@ nsIOService::Init()
NS_WARNING("failed to get observer service");
Preferences::AddBoolVarCache(&sTelemetryEnabled, "toolkit.telemetry.enabled", false);
+ Preferences::AddBoolVarCache(&sBlockToplevelDataUriNavigations,
+ "security.data_uri.block_toplevel_data_uri_navigations", false);
Preferences::AddBoolVarCache(&mOfflineMirrorsConnectivity, OFFLINE_MIRRORS_CONNECTIVITY, true);
gIOService = this;
@@ -1876,5 +1880,11 @@ nsIOService::SpeculativeAnonymousConnect2(nsIURI *aURI,
return SpeculativeConnectInternal(aURI, aPrincipal, aCallbacks, true);
}
+/*static*/ bool
+nsIOService::BlockToplevelDataUriNavigations()
+{
+ return sBlockToplevelDataUriNavigations;
+}
+
} // namespace net
} // namespace mozilla
diff --git a/netwerk/base/nsIOService.h b/netwerk/base/nsIOService.h
index 7ac23b7910..e592c4d1c9 100644
--- a/netwerk/base/nsIOService.h
+++ b/netwerk/base/nsIOService.h
@@ -95,6 +95,8 @@ public:
bool IsLinkUp();
+ static bool BlockToplevelDataUriNavigations();
+
// Used to trigger a recheck of the captive portal status
nsresult RecheckCaptivePortal();
private:
@@ -176,6 +178,8 @@ private:
static bool sTelemetryEnabled;
+ static bool sBlockToplevelDataUriNavigations;
+
// These timestamps are needed for collecting telemetry on PR_Connect,
// PR_ConnectContinue and PR_Close blocking time. If we spend very long
// time in any of these functions we want to know if and what network
diff --git a/netwerk/base/nsITimedChannel.idl b/netwerk/base/nsITimedChannel.idl
index 13b65e7b82..83670a11e6 100644
--- a/netwerk/base/nsITimedChannel.idl
+++ b/netwerk/base/nsITimedChannel.idl
@@ -21,7 +21,8 @@ interface nsITimedChannel : nsISupports {
attribute boolean timingEnabled;
// The number of redirects
- attribute uint16_t redirectCount;
+ attribute uint8_t redirectCount;
+ attribute uint8_t internalRedirectCount;
[noscript] readonly attribute TimeStamp channelCreation;
[noscript] readonly attribute TimeStamp asyncOpen;
@@ -37,6 +38,15 @@ interface nsITimedChannel : nsISupports {
[noscript] readonly attribute TimeStamp responseStart;
[noscript] readonly attribute TimeStamp responseEnd;
+ // The following are only set when the request is intercepted by a service
+ // worker no matter the response is synthesized.
+ [noscript] attribute TimeStamp launchServiceWorkerStart;
+ [noscript] attribute TimeStamp launchServiceWorkerEnd;
+ [noscript] attribute TimeStamp dispatchFetchEventStart;
+ [noscript] attribute TimeStamp dispatchFetchEventEnd;
+ [noscript] attribute TimeStamp handleFetchEventStart;
+ [noscript] attribute TimeStamp handleFetchEventEnd;
+
// The redirect attributes timings must be writeble, se we can transfer
// the data from one channel to the redirected channel.
[noscript] attribute TimeStamp redirectStart;
@@ -67,6 +77,12 @@ interface nsITimedChannel : nsISupports {
// All following are PRTime versions of the above.
readonly attribute PRTime channelCreationTime;
readonly attribute PRTime asyncOpenTime;
+ readonly attribute PRTime launchServiceWorkerStartTime;
+ readonly attribute PRTime launchServiceWorkerEndTime;
+ readonly attribute PRTime dispatchFetchEventStartTime;
+ readonly attribute PRTime dispatchFetchEventEndTime;
+ readonly attribute PRTime handleFetchEventStartTime;
+ readonly attribute PRTime handleFetchEventEndTime;
readonly attribute PRTime domainLookupStartTime;
readonly attribute PRTime domainLookupEndTime;
readonly attribute PRTime connectStartTime;
diff --git a/netwerk/base/nsIURI.idl b/netwerk/base/nsIURI.idl
index 2384c5fd99..ef163813aa 100644
--- a/netwerk/base/nsIURI.idl
+++ b/netwerk/base/nsIURI.idl
@@ -10,18 +10,18 @@
* provides accessors to set and query the most basic components of an URI.
* Subclasses, including nsIURL, impose greater structure on the URI.
*
- * This interface follows Tim Berners-Lee's URI spec (RFC2396) [1], where the
+ * This interface follows Tim Berners-Lee's URI spec (RFC3986) [1], where the
* basic URI components are defined as such:
* <pre>
- * ftp://username:password@hostname:portnumber/pathname#ref
- * \ / \ / \ / \ /\ \ /
- * - --------------- ------ -------- | -
- * | | | | | |
- * | | | | | Ref
- * | | | Port \ /
- * | | Host / --------
- * | UserPass / |
- * Scheme / Path
+ * ftp://username:password@hostname:portnumber/pathname?query#ref
+ * \ / \ / \ / \ /\ / \ / \ /
+ * - --------------- ------ -------- ------- --- -
+ * | | | | | | |
+ * | | | | FilePath Query Ref
+ * | | | Port \ /
+ * | | Host / ------------
+ * | UserPass / |
+ * Scheme / Path
* \ /
* --------------------------------
* |
@@ -30,13 +30,9 @@
* The definition of the URI components has been extended to allow for
* internationalized domain names [2] and the more generic IRI structure [3].
*
- * Note also that the RFC defines #-separated fragment identifiers as being
- * "not part of the URI". Despite this, we bundle them as part of the URI, for
- * convenience.
- *
- * [1] http://www.ietf.org/rfc/rfc2396.txt
- * [2] http://www.ietf.org/internet-drafts/draft-ietf-idn-idna-06.txt
- * [3] http://www.ietf.org/internet-drafts/draft-masinter-url-i18n-08.txt
+ * [1] https://tools.ietf.org/html/rfc3986
+ * [2] https://tools.ietf.org/html/rfc5890
+ * [3] https://tools.ietf.org/html/rfc3987
*/
%{C++
@@ -116,7 +112,7 @@ interface nsIURI : nsISupports
/**
* The Scheme is the protocol to which this URI refers. The scheme is
- * restricted to the US-ASCII charset per RFC2396. Setting this is
+ * restricted to the US-ASCII charset per RFC3986. Setting this is
* highly discouraged outside of a protocol handler implementation, since
* that will generally lead to incorrect results.
*/
@@ -174,6 +170,9 @@ interface nsIURI : nsISupports
* empty, depending on the protocol).
*
* Some characters may be escaped.
+ *
+ * This attribute contains query and ref parts for historical reasons.
+ * Use the 'filePath' attribute if you do not want those parts included.
*/
attribute AUTF8String path;
@@ -281,10 +280,31 @@ interface nsIURI : nsISupports
/**
* returns a string for the current URI with the ref element cleared.
*/
- readonly attribute AUTF8String specIgnoringRef;
+ readonly attribute AUTF8String specIgnoringRef;
/**
* Returns if there is a reference portion (the part after the "#") of the URI.
*/
- readonly attribute boolean hasRef;
+ readonly attribute boolean hasRef;
+
+ /************************************************************************
+ * Additional attributes added for .query support:
+ */
+
+ /**
+ * Returns a path including the directory and file portions of a
+ * URL. For example, the filePath of "http://host/foo/bar.html#baz"
+ * is "/foo/bar.html".
+ *
+ * Some characters may be escaped.
+ */
+ attribute AUTF8String filePath;
+
+ /**
+ * Returns the query portion (the part after the "?") of the URL.
+ * If there isn't one, an empty string is returned.
+ *
+ * Some characters may be escaped.
+ */
+ attribute AUTF8String query;
};
diff --git a/netwerk/base/nsIURIWithQuery.idl b/netwerk/base/nsIURIWithQuery.idl
deleted file mode 100644
index 749b2773d8..0000000000
--- a/netwerk/base/nsIURIWithQuery.idl
+++ /dev/null
@@ -1,30 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsIURI.idl"
-
-/**
- * nsIURIWithQuery is implemented by URIs which have a query parameter.
- * This is useful for the URL API.
- */
-[scriptable, uuid(367510ee-8556-435a-8f99-b5fd357e08cc)]
-interface nsIURIWithQuery : nsIURI
-{
- /**
- * Returns a path including the directory and file portions of a
- * URL. For example, the filePath of "http://host/foo/bar.html#baz"
- * is "/foo/bar.html".
- *
- * Some characters may be escaped.
- */
- attribute AUTF8String filePath;
-
- /**
- * Returns the query portion (the part after the "?") of the URL.
- * If there isn't one, an empty string is returned.
- *
- * Some characters may be escaped.
- */
- attribute AUTF8String query;
-};
diff --git a/netwerk/base/nsIURL.idl b/netwerk/base/nsIURL.idl
index aeaa3f6949..9ff6c3dcda 100644
--- a/netwerk/base/nsIURL.idl
+++ b/netwerk/base/nsIURL.idl
@@ -3,7 +3,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#include "nsIURIWithQuery.idl"
+#include "nsIURI.idl"
/**
* The nsIURL interface provides convenience methods that further
@@ -20,7 +20,7 @@
* filePath
*/
[scriptable, uuid(86adcd89-0b70-47a2-b0fe-5bb2c5f37e31)]
-interface nsIURL : nsIURIWithQuery
+interface nsIURL : nsIURI
{
/*************************************************************************
* The URL path is broken down into the following principal components:
@@ -28,7 +28,7 @@ interface nsIURL : nsIURIWithQuery
* attribute AUTF8String filePath;
* attribute AUTF8String query;
*
- * These are inherited from nsIURIWithQuery.
+ * These are inherited from nsIURI.
*/
/*************************************************************************
diff --git a/netwerk/base/nsSimpleURI.cpp b/netwerk/base/nsSimpleURI.cpp
index ae5c51a1e5..dbc0dc8179 100644
--- a/netwerk/base/nsSimpleURI.cpp
+++ b/netwerk/base/nsSimpleURI.cpp
@@ -48,7 +48,7 @@ nsSimpleURI::~nsSimpleURI()
NS_IMPL_ADDREF(nsSimpleURI)
NS_IMPL_RELEASE(nsSimpleURI)
NS_INTERFACE_TABLE_HEAD(nsSimpleURI)
-NS_INTERFACE_TABLE(nsSimpleURI, nsIURI, nsIURIWithQuery, nsISerializable,
+NS_INTERFACE_TABLE(nsSimpleURI, nsIURI, nsISerializable,
nsIClassInfo, nsIMutable, nsIIPCSerializableURI)
NS_INTERFACE_TABLE_TO_MAP_SEGUE
if (aIID.Equals(kThisSimpleURIImplementationCID))
@@ -784,10 +784,6 @@ nsSimpleURI::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const {
return aMallocSizeOf(this) + SizeOfExcludingThis(aMallocSizeOf);
}
-//----------------------------------------------------------------------------
-// nsSimpleURI::nsIURIWithQuery
-//----------------------------------------------------------------------------
-
NS_IMETHODIMP
nsSimpleURI::GetFilePath(nsACString& aFilePath)
{
diff --git a/netwerk/base/nsSimpleURI.h b/netwerk/base/nsSimpleURI.h
index 29bc9b3139..842136ed63 100644
--- a/netwerk/base/nsSimpleURI.h
+++ b/netwerk/base/nsSimpleURI.h
@@ -8,7 +8,6 @@
#include "mozilla/MemoryReporting.h"
#include "nsIURI.h"
-#include "nsIURIWithQuery.h"
#include "nsISerializable.h"
#include "nsString.h"
#include "nsIClassInfo.h"
@@ -28,7 +27,7 @@ namespace net {
}
class nsSimpleURI
- : public nsIURIWithQuery
+ : public nsIURI
, public nsISerializable
, public nsIClassInfo
, public nsIMutable
@@ -41,7 +40,6 @@ protected:
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIURI
- NS_DECL_NSIURIWITHQUERY
NS_DECL_NSISERIALIZABLE
NS_DECL_NSICLASSINFO
NS_DECL_NSIMUTABLE
diff --git a/netwerk/base/nsStandardURL.cpp b/netwerk/base/nsStandardURL.cpp
index bc1350f28f..e2a290e4dc 100644
--- a/netwerk/base/nsStandardURL.cpp
+++ b/netwerk/base/nsStandardURL.cpp
@@ -781,11 +781,13 @@ nsStandardURL::BuildNormalizedSpec(const char *spec)
i = AppendSegmentToBuf(buf, i, spec, username, mUsername,
&encUsername, useEncUsername, &diff);
ShiftFromPassword(diff);
- if (password.mLen >= 0) {
+ if (password.mLen > 0) {
buf[i++] = ':';
i = AppendSegmentToBuf(buf, i, spec, password, mPassword,
&encPassword, useEncPassword, &diff);
ShiftFromHost(diff);
+ } else {
+ mPassword.mLen = -1;
}
buf[i++] = '@';
}
@@ -1180,7 +1182,6 @@ NS_IMPL_RELEASE(nsStandardURL)
NS_INTERFACE_MAP_BEGIN(nsStandardURL)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIStandardURL)
NS_INTERFACE_MAP_ENTRY(nsIURI)
- NS_INTERFACE_MAP_ENTRY(nsIURIWithQuery)
NS_INTERFACE_MAP_ENTRY(nsIURL)
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIFileURL, mSupportsFileURL)
NS_INTERFACE_MAP_ENTRY(nsIStandardURL)
@@ -1483,6 +1484,11 @@ nsStandardURL::SetSpec(const nsACString &input)
rv = BuildNormalizedSpec(spec);
}
+ // Make sure that a URLTYPE_AUTHORITY has a non-empty hostname.
+ if (mURLType == URLTYPE_AUTHORITY && mHost.mLen == -1) {
+ rv = NS_ERROR_MALFORMED_URI;
+ }
+
if (NS_FAILED(rv)) {
Clear();
// If parsing the spec has failed, restore the old URL
@@ -1616,7 +1622,7 @@ nsStandardURL::SetUserPass(const nsACString &input)
usernameLen),
esc_Username | esc_AlwaysCopy,
buf, ignoredOut);
- if (passwordLen >= 0) {
+ if (passwordLen > 0) {
buf.Append(':');
passwordLen = encoder.EncodeSegmentCount(userpass.get(),
URLSegment(passwordPos,
@@ -1624,6 +1630,8 @@ nsStandardURL::SetUserPass(const nsACString &input)
esc_Password |
esc_AlwaysCopy, buf,
ignoredOut);
+ } else {
+ passwordLen = -1;
}
if (mUsername.mLen < 0)
buf.Append('@');
@@ -1654,8 +1662,10 @@ nsStandardURL::SetUserPass(const nsACString &input)
// update positions and lengths
mUsername.mLen = usernameLen;
mPassword.mLen = passwordLen;
- if (passwordLen)
+ if (passwordLen > 0) {
mPassword.mPos = mUsername.mPos + mUsername.mLen + 1;
+ }
+
return NS_OK;
}
@@ -3092,20 +3102,26 @@ nsStandardURL::SetFile(nsIFile *file)
rv = net_GetURLSpecFromFile(file, url);
if (NS_FAILED(rv)) return rv;
- SetSpec(url);
+ uint32_t oldURLType = mURLType;
+ uint32_t oldDefaultPort = mDefaultPort;
+ rv = Init(nsIStandardURL::URLTYPE_NO_AUTHORITY, -1, url, nullptr, nullptr);
- rv = Init(mURLType, mDefaultPort, url, nullptr, nullptr);
+ if (NS_FAILED(rv)) {
+ // Restore the old url type and default port if the call to Init fails.
+ mURLType = oldURLType;
+ mDefaultPort = oldDefaultPort;
+ return rv;
+ }
// must clone |file| since its value is not guaranteed to remain constant
- if (NS_SUCCEEDED(rv)) {
- InvalidateCache();
- if (NS_FAILED(file->Clone(getter_AddRefs(mFile)))) {
- NS_WARNING("nsIFile::Clone failed");
- // failure to clone is not fatal (GetFile will generate mFile)
- mFile = nullptr;
- }
+ InvalidateCache();
+ if (NS_FAILED(file->Clone(getter_AddRefs(mFile)))) {
+ NS_WARNING("nsIFile::Clone failed");
+ // failure to clone is not fatal (GetFile will generate mFile)
+ mFile = nullptr;
}
- return rv;
+
+ return NS_OK;
}
//----------------------------------------------------------------------------
@@ -3425,10 +3441,29 @@ ToIPCSegment(const nsStandardURL::URLSegment& aSegment)
}
inline
-nsStandardURL::URLSegment
-FromIPCSegment(const ipc::StandardURLSegment& aSegment)
+MOZ_MUST_USE bool
+FromIPCSegment(const nsACString& aSpec, const ipc::StandardURLSegment& aSegment, nsStandardURL::URLSegment& aTarget)
{
- return nsStandardURL::URLSegment(aSegment.position(), aSegment.length());
+ // This seems to be just an empty segment.
+ if (aSegment.length() == -1) {
+ aTarget = nsStandardURL::URLSegment();
+ return true;
+ }
+
+ // A value of -1 means an empty segment, but < -1 is undefined.
+ if (NS_WARN_IF(aSegment.length() < -1)) {
+ return false;
+ }
+
+ // Make sure the segment does not extend beyond the spec.
+ if (NS_WARN_IF(aSegment.position() + aSegment.length() > aSpec.Length())) {
+ return false;
+ }
+
+ aTarget.mPos = aSegment.position();
+ aTarget.mLen = aSegment.length();
+
+ return true;
}
void
@@ -3503,23 +3538,38 @@ nsStandardURL::Deserialize(const URIParams& aParams)
mPort = params.port();
mDefaultPort = params.defaultPort();
mSpec = params.spec();
- mScheme = FromIPCSegment(params.scheme());
- mAuthority = FromIPCSegment(params.authority());
- mUsername = FromIPCSegment(params.username());
- mPassword = FromIPCSegment(params.password());
- mHost = FromIPCSegment(params.host());
- mPath = FromIPCSegment(params.path());
- mFilepath = FromIPCSegment(params.filePath());
- mDirectory = FromIPCSegment(params.directory());
- mBasename = FromIPCSegment(params.baseName());
- mExtension = FromIPCSegment(params.extension());
- mQuery = FromIPCSegment(params.query());
- mRef = FromIPCSegment(params.ref());
+
+ NS_ENSURE_TRUE(mSpec.Length() <= (uint32_t) net_GetURLMaxLength(), false);
+ NS_ENSURE_TRUE(FromIPCSegment(mSpec, params.scheme(), mScheme), false);
+ NS_ENSURE_TRUE(FromIPCSegment(mSpec, params.authority(), mAuthority), false);
+ NS_ENSURE_TRUE(FromIPCSegment(mSpec, params.username(), mUsername), false);
+ NS_ENSURE_TRUE(FromIPCSegment(mSpec, params.password(), mPassword), false);
+ NS_ENSURE_TRUE(FromIPCSegment(mSpec, params.host(), mHost), false);
+ NS_ENSURE_TRUE(FromIPCSegment(mSpec, params.path(), mPath), false);
+ NS_ENSURE_TRUE(FromIPCSegment(mSpec, params.filePath(), mFilepath), false);
+ NS_ENSURE_TRUE(FromIPCSegment(mSpec, params.directory(), mDirectory), false);
+ NS_ENSURE_TRUE(FromIPCSegment(mSpec, params.baseName(), mBasename), false);
+ NS_ENSURE_TRUE(FromIPCSegment(mSpec, params.extension(), mExtension), false);
+ NS_ENSURE_TRUE(FromIPCSegment(mSpec, params.query(), mQuery), false);
+ NS_ENSURE_TRUE(FromIPCSegment(mSpec, params.ref(), mRef), false);
+
mOriginCharset = params.originCharset();
mMutable = params.isMutable();
mSupportsFileURL = params.supportsFileURL();
mHostEncoding = params.hostEncoding();
+ // Some sanity checks
+ NS_ENSURE_TRUE(mScheme.mPos == 0, false);
+ NS_ENSURE_TRUE(mScheme.mLen > 0, false);
+ // Make sure scheme is followed by :// (3 characters)
+ NS_ENSURE_TRUE(mScheme.mLen < INT32_MAX - 3, false); // avoid overflow
+ NS_ENSURE_TRUE(mSpec.Length() >= (uint32_t) mScheme.mLen + 3, false);
+ NS_ENSURE_TRUE(nsDependentCSubstring(mSpec, mScheme.mLen, 3).EqualsLiteral("://"), false);
+ NS_ENSURE_TRUE(mPath.mLen != -1 && mSpec.CharAt(mPath.mPos) == '/', false);
+ NS_ENSURE_TRUE(mPath.mPos == mFilepath.mPos, false);
+ NS_ENSURE_TRUE(mQuery.mLen == -1 || mSpec.CharAt(mQuery.mPos - 1) == '?', false);
+ NS_ENSURE_TRUE(mRef.mLen == -1 || mSpec.CharAt(mRef.mPos - 1) == '#', false);
+
// mSpecEncoding and mHostA are just caches that can be recovered as needed.
return true;
}
diff --git a/netwerk/base/nsStandardURL.h b/netwerk/base/nsStandardURL.h
index 90f7f7db24..0ca345572a 100644
--- a/netwerk/base/nsStandardURL.h
+++ b/netwerk/base/nsStandardURL.h
@@ -54,7 +54,6 @@ protected:
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIURI
- NS_DECL_NSIURIWITHQUERY
NS_DECL_NSIURL
NS_DECL_NSIFILEURL
NS_DECL_NSISTANDARDURL
diff --git a/netwerk/base/security-prefs.js b/netwerk/base/security-prefs.js
index d1b56ce355..329a4c6b70 100644
--- a/netwerk/base/security-prefs.js
+++ b/netwerk/base/security-prefs.js
@@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
pref("security.tls.version.min", 1);
-pref("security.tls.version.max", 4);
+pref("security.tls.version.max", 3);
pref("security.tls.version.fallback-limit", 3);
pref("security.tls.insecure_fallback_hosts", "");
pref("security.tls.unrestricted_rc4_fallback", false);
diff --git a/netwerk/ipc/NeckoChannelParams.ipdlh b/netwerk/ipc/NeckoChannelParams.ipdlh
index 9365397d19..bb7562c648 100644
--- a/netwerk/ipc/NeckoChannelParams.ipdlh
+++ b/netwerk/ipc/NeckoChannelParams.ipdlh
@@ -20,6 +20,7 @@ using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
using RequestHeaderTuples from "mozilla/net/PHttpChannelParams.h";
using struct nsHttpAtom from "nsHttp.h";
using class nsHttpResponseHead from "nsHttpResponseHead.h";
+using class mozilla::TimeStamp from "mozilla/TimeStamp.h";
namespace mozilla {
namespace net {
@@ -39,6 +40,7 @@ struct LoadInfoArgs
bool upgradeInsecureRequests;
bool verifySignedContent;
bool enforceSRI;
+ bool forceAllowDataURI;
bool forceInheritPrincipalDropped;
uint64_t innerWindowID;
uint64_t outerWindowID;
@@ -53,6 +55,7 @@ struct LoadInfoArgs
nsCString[] corsUnsafeHeaders;
bool forcePreflight;
bool isPreflight;
+ bool loadTriggeredFromExternal;
bool forceHSTSPriming;
bool mixedContentWouldBlock;
};
@@ -132,6 +135,12 @@ struct HttpChannelOpenArgs
nsCString channelId;
uint64_t contentWindowId;
nsCString preferredAlternativeType;
+ TimeStamp launchServiceWorkerStart;
+ TimeStamp launchServiceWorkerEnd;
+ TimeStamp dispatchFetchEventStart;
+ TimeStamp dispatchFetchEventEnd;
+ TimeStamp handleFetchEventStart;
+ TimeStamp handleFetchEventEnd;
};
struct HttpChannelConnectArgs
diff --git a/netwerk/ipc/NeckoMessageUtils.h b/netwerk/ipc/NeckoMessageUtils.h
index 778691369c..1633b82b64 100644
--- a/netwerk/ipc/NeckoMessageUtils.h
+++ b/netwerk/ipc/NeckoMessageUtils.h
@@ -14,11 +14,6 @@
#include "mozilla/net/DNS.h"
#include "TimingStruct.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#include "nsPrintfCString.h"
-#endif
-
namespace IPC {
// nsIPermissionManager utilities
@@ -102,12 +97,6 @@ struct ParamTraits<mozilla::net::NetAddr>
aMsg->WriteBytes(aParam.local.path, sizeof(aParam.local.path));
#endif
} else {
-#ifdef MOZ_CRASHREPORTER
- if (XRE_IsParentProcess()) {
- nsPrintfCString msg("%d", aParam.raw.family);
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Unknown NetAddr socket family"), msg);
- }
-#endif
NS_RUNTIMEABORT("Unknown socket family");
}
}
diff --git a/netwerk/protocol/http/Http2Session.cpp b/netwerk/protocol/http/Http2Session.cpp
index 55ddbe9087..4f350af83b 100644
--- a/netwerk/protocol/http/Http2Session.cpp
+++ b/netwerk/protocol/http/Http2Session.cpp
@@ -1044,6 +1044,15 @@ Http2Session::CleanupStream(Http2Stream *aStream, nsresult aResult,
return;
}
+ Http2PushedStream *pushSource = aStream->PushSource();
+ if (pushSource) {
+ // aStream is a synthetic attached to an even push
+ MOZ_ASSERT(pushSource->GetConsumerStream() == aStream);
+ MOZ_ASSERT(!aStream->StreamID());
+ MOZ_ASSERT(!(pushSource->StreamID() & 0x1));
+ aStream->ClearPushSource();
+ }
+
if (aStream->DeferCleanup(aResult)) {
LOG3(("Http2Session::CleanupStream 0x%X deferred\n", aStream->StreamID()));
return;
@@ -1054,15 +1063,6 @@ Http2Session::CleanupStream(Http2Stream *aStream, nsresult aResult,
return;
}
- Http2PushedStream *pushSource = aStream->PushSource();
- if (pushSource) {
- // aStream is a synthetic attached to an even push
- MOZ_ASSERT(pushSource->GetConsumerStream() == aStream);
- MOZ_ASSERT(!aStream->StreamID());
- MOZ_ASSERT(!(pushSource->StreamID() & 0x1));
- pushSource->SetConsumerStream(nullptr);
- }
-
// don't reset a stream that has recevied a fin or rst
if (!aStream->RecvdFin() && !aStream->RecvdReset() && aStream->StreamID() &&
!(mInputFrameFinal && (aStream == mInputFrameDataStream))) { // !(recvdfin with mark pending)
diff --git a/netwerk/protocol/http/Http2Stream.cpp b/netwerk/protocol/http/Http2Stream.cpp
index f49c1f138e..7a8f968550 100644
--- a/netwerk/protocol/http/Http2Stream.cpp
+++ b/netwerk/protocol/http/Http2Stream.cpp
@@ -103,10 +103,20 @@ Http2Stream::Http2Stream(nsAHttpTransaction *httpTransaction,
Http2Stream::~Http2Stream()
{
+ ClearPushSource();
ClearTransactionsBlockedOnTunnel();
mStreamID = Http2Session::kDeadStreamID;
}
+void
+Http2Stream::ClearPushSource()
+{
+ if (mPushSource) {
+ mPushSource->SetConsumerStream(nullptr);
+ mPushSource = nullptr;
+ }
+}
+
// ReadSegments() is used to write data down the socket. Generally, HTTP
// request data is pulled from the approriate transaction and
// converted to HTTP/2 data. Sometimes control data like a window-update is
@@ -1083,6 +1093,10 @@ Http2Stream::ConvertPushHeaders(Http2Decompressor *decompressor,
void
Http2Stream::Close(nsresult reason)
{
+ // In case we are connected to a push, make sure the push knows we are closed,
+ // so it doesn't try to give us any more DATA that comes on it after our close.
+ ClearPushSource();
+
mTransaction->Close(reason);
}
diff --git a/netwerk/protocol/http/Http2Stream.h b/netwerk/protocol/http/Http2Stream.h
index 968461ee4a..8783eefeda 100644
--- a/netwerk/protocol/http/Http2Stream.h
+++ b/netwerk/protocol/http/Http2Stream.h
@@ -50,6 +50,7 @@ public:
uint32_t StreamID() { return mStreamID; }
Http2PushedStream *PushSource() { return mPushSource; }
+ void ClearPushSource();
stateType HTTPState() { return mState; }
void SetHTTPState(stateType val) { mState = val; }
diff --git a/netwerk/protocol/http/HttpBaseChannel.cpp b/netwerk/protocol/http/HttpBaseChannel.cpp
index 0ff7922800..d161f9a432 100644
--- a/netwerk/protocol/http/HttpBaseChannel.cpp
+++ b/netwerk/protocol/http/HttpBaseChannel.cpp
@@ -105,6 +105,7 @@ HttpBaseChannel::HttpBaseChannel()
, mHttpHandler(gHttpHandler)
, mReferrerPolicy(REFERRER_POLICY_NO_REFERRER_WHEN_DOWNGRADE)
, mRedirectCount(0)
+ , mInternalRedirectCount(0)
, mForcePending(false)
, mCorsIncludeCredentials(false)
, mCorsMode(nsIHttpChannelInternal::CORS_MODE_NO_CORS)
@@ -2480,9 +2481,9 @@ HttpBaseChannel::GetFetchCacheMode(uint32_t* aFetchCacheMode)
*aFetchCacheMode = nsIHttpChannelInternal::FETCH_CACHE_MODE_RELOAD;
} else if (mLoadFlags & VALIDATE_ALWAYS) {
*aFetchCacheMode = nsIHttpChannelInternal::FETCH_CACHE_MODE_NO_CACHE;
- } else if (mLoadFlags & (LOAD_FROM_CACHE | nsICachingChannel::LOAD_ONLY_FROM_CACHE)) {
+ } else if (mLoadFlags & (VALIDATE_NEVER | nsICachingChannel::LOAD_ONLY_FROM_CACHE)) {
*aFetchCacheMode = nsIHttpChannelInternal::FETCH_CACHE_MODE_ONLY_IF_CACHED;
- } else if (mLoadFlags & LOAD_FROM_CACHE) {
+ } else if (mLoadFlags & VALIDATE_NEVER) {
*aFetchCacheMode = nsIHttpChannelInternal::FETCH_CACHE_MODE_FORCE_CACHE;
} else {
*aFetchCacheMode = nsIHttpChannelInternal::FETCH_CACHE_MODE_DEFAULT;
@@ -2518,7 +2519,7 @@ HttpBaseChannel::SetFetchCacheMode(uint32_t aFetchCacheMode)
break;
case nsIHttpChannelInternal::FETCH_CACHE_MODE_FORCE_CACHE:
// force-cache means don't validate unless if the response would vary.
- mLoadFlags |= LOAD_FROM_CACHE;
+ mLoadFlags |= VALIDATE_NEVER;
break;
case nsIHttpChannelInternal::FETCH_CACHE_MODE_ONLY_IF_CACHED:
// only-if-cached means only from cache, no network, no validation, generate
@@ -2527,7 +2528,7 @@ HttpBaseChannel::SetFetchCacheMode(uint32_t aFetchCacheMode)
// the user has things in their cache without any network traffic side
// effects) are addressed in the Request constructor which enforces/requires
// same-origin request mode.
- mLoadFlags |= LOAD_FROM_CACHE | nsICachingChannel::LOAD_ONLY_FROM_CACHE;
+ mLoadFlags |= VALIDATE_NEVER | nsICachingChannel::LOAD_ONLY_FROM_CACHE;
break;
}
@@ -3128,12 +3129,6 @@ HttpBaseChannel::SetupReplacementChannel(nsIURI *newURI,
// convey the mAllowPipelining and mAllowSTS flags
httpChannel->SetAllowPipelining(mAllowPipelining);
httpChannel->SetAllowSTS(mAllowSTS);
- // convey the new redirection limit
- // make sure we don't underflow
- uint32_t redirectionLimit = mRedirectionLimit
- ? mRedirectionLimit - 1
- : 0;
- httpChannel->SetRedirectionLimit(redirectionLimit);
// convey the Accept header value
{
@@ -3215,23 +3210,40 @@ HttpBaseChannel::SetupReplacementChannel(nsIURI *newURI,
do_QueryInterface(static_cast<nsIHttpChannel*>(this)));
if (oldTimedChannel && newTimedChannel) {
newTimedChannel->SetTimingEnabled(mTimingEnabled);
- newTimedChannel->SetRedirectCount(mRedirectCount + 1);
+
+ if (redirectFlags & nsIChannelEventSink::REDIRECT_INTERNAL) {
+ int8_t newCount = mInternalRedirectCount + 1;
+ newTimedChannel->SetInternalRedirectCount(
+ std::max(newCount, mInternalRedirectCount));
+ } else {
+ int8_t newCount = mRedirectCount + 1;
+ newTimedChannel->SetRedirectCount(
+ std::max(newCount, mRedirectCount));
+ }
// If the RedirectStart is null, we will use the AsyncOpen value of the
// previous channel (this is the first redirect in the redirects chain).
if (mRedirectStartTimeStamp.IsNull()) {
- TimeStamp asyncOpen;
- oldTimedChannel->GetAsyncOpen(&asyncOpen);
- newTimedChannel->SetRedirectStart(asyncOpen);
- }
- else {
+ // Only do this for real redirects. Internal redirects should be hidden.
+ if (!(redirectFlags & nsIChannelEventSink::REDIRECT_INTERNAL)) {
+ TimeStamp asyncOpen;
+ oldTimedChannel->GetAsyncOpen(&asyncOpen);
+ newTimedChannel->SetRedirectStart(asyncOpen);
+ }
+ } else {
newTimedChannel->SetRedirectStart(mRedirectStartTimeStamp);
}
- // The RedirectEnd timestamp is equal to the previous channel response end.
- TimeStamp prevResponseEnd;
- oldTimedChannel->GetResponseEnd(&prevResponseEnd);
- newTimedChannel->SetRedirectEnd(prevResponseEnd);
+ // For internal redirects just propagate the last redirect end time
+ // forward. Otherwise the new redirect end time is the last response
+ // end time.
+ TimeStamp newRedirectEnd;
+ if (redirectFlags & nsIChannelEventSink::REDIRECT_INTERNAL) {
+ oldTimedChannel->GetRedirectEnd(&newRedirectEnd);
+ } else {
+ oldTimedChannel->GetResponseEnd(&newRedirectEnd);
+ }
+ newTimedChannel->SetRedirectEnd(newRedirectEnd);
nsAutoString initiatorType;
oldTimedChannel->GetInitiatorType(initiatorType);
@@ -3253,6 +3265,16 @@ HttpBaseChannel::SetupReplacementChannel(nsIURI *newURI,
mAllRedirectsPassTimingAllowCheck &&
oldTimedChannel->TimingAllowCheck(principal));
}
+
+ // Propagate service worker measurements across redirects. The
+ // PeformanceResourceTiming.workerStart API expects to see the
+ // worker start time after a redirect.
+ newTimedChannel->SetLaunchServiceWorkerStart(mLaunchServiceWorkerStart);
+ newTimedChannel->SetLaunchServiceWorkerEnd(mLaunchServiceWorkerEnd);
+ newTimedChannel->SetDispatchFetchEventStart(mDispatchFetchEventStart);
+ newTimedChannel->SetDispatchFetchEventEnd(mDispatchFetchEventEnd);
+ newTimedChannel->SetHandleFetchEventStart(mHandleFetchEventStart);
+ newTimedChannel->SetHandleFetchEventEnd(mHandleFetchEventEnd);
}
// Pass the preferred alt-data type on to the new channel.
@@ -3318,20 +3340,34 @@ HttpBaseChannel::GetAsyncOpen(TimeStamp* _retval) {
* redirects. This check must be done by the consumers.
*/
NS_IMETHODIMP
-HttpBaseChannel::GetRedirectCount(uint16_t *aRedirectCount)
+HttpBaseChannel::GetRedirectCount(uint8_t *aRedirectCount)
{
*aRedirectCount = mRedirectCount;
return NS_OK;
}
NS_IMETHODIMP
-HttpBaseChannel::SetRedirectCount(uint16_t aRedirectCount)
+HttpBaseChannel::SetRedirectCount(uint8_t aRedirectCount)
{
mRedirectCount = aRedirectCount;
return NS_OK;
}
NS_IMETHODIMP
+HttpBaseChannel::GetInternalRedirectCount(uint8_t *aRedirectCount)
+{
+ *aRedirectCount = mInternalRedirectCount;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+HttpBaseChannel::SetInternalRedirectCount(uint8_t aRedirectCount)
+{
+ mInternalRedirectCount = aRedirectCount;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
HttpBaseChannel::GetRedirectStart(TimeStamp* _retval)
{
*_retval = mRedirectStartTimeStamp;
@@ -3431,6 +3467,84 @@ HttpBaseChannel::TimingAllowCheck(nsIPrincipal *aOrigin, bool *_retval)
}
NS_IMETHODIMP
+HttpBaseChannel::GetLaunchServiceWorkerStart(TimeStamp* _retval) {
+ MOZ_ASSERT(_retval);
+ *_retval = mLaunchServiceWorkerStart;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+HttpBaseChannel::SetLaunchServiceWorkerStart(TimeStamp aTimeStamp) {
+ mLaunchServiceWorkerStart = aTimeStamp;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+HttpBaseChannel::GetLaunchServiceWorkerEnd(TimeStamp* _retval) {
+ MOZ_ASSERT(_retval);
+ *_retval = mLaunchServiceWorkerEnd;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+HttpBaseChannel::SetLaunchServiceWorkerEnd(TimeStamp aTimeStamp) {
+ mLaunchServiceWorkerEnd = aTimeStamp;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+HttpBaseChannel::GetDispatchFetchEventStart(TimeStamp* _retval) {
+ MOZ_ASSERT(_retval);
+ *_retval = mDispatchFetchEventStart;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+HttpBaseChannel::SetDispatchFetchEventStart(TimeStamp aTimeStamp) {
+ mDispatchFetchEventStart = aTimeStamp;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+HttpBaseChannel::GetDispatchFetchEventEnd(TimeStamp* _retval) {
+ MOZ_ASSERT(_retval);
+ *_retval = mDispatchFetchEventEnd;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+HttpBaseChannel::SetDispatchFetchEventEnd(TimeStamp aTimeStamp) {
+ mDispatchFetchEventEnd = aTimeStamp;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+HttpBaseChannel::GetHandleFetchEventStart(TimeStamp* _retval) {
+ MOZ_ASSERT(_retval);
+ *_retval = mHandleFetchEventStart;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+HttpBaseChannel::SetHandleFetchEventStart(TimeStamp aTimeStamp) {
+ mHandleFetchEventStart = aTimeStamp;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+HttpBaseChannel::GetHandleFetchEventEnd(TimeStamp* _retval) {
+ MOZ_ASSERT(_retval);
+ *_retval = mHandleFetchEventEnd;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+HttpBaseChannel::SetHandleFetchEventEnd(TimeStamp aTimeStamp) {
+ mHandleFetchEventEnd = aTimeStamp;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
HttpBaseChannel::GetDomainLookupStart(TimeStamp* _retval) {
*_retval = mTransactionTimings.domainLookupStart;
return NS_OK;
@@ -3520,6 +3634,12 @@ HttpBaseChannel::Get##name##Time(PRTime* _retval) { \
IMPL_TIMING_ATTR(ChannelCreation)
IMPL_TIMING_ATTR(AsyncOpen)
+IMPL_TIMING_ATTR(LaunchServiceWorkerStart)
+IMPL_TIMING_ATTR(LaunchServiceWorkerEnd)
+IMPL_TIMING_ATTR(DispatchFetchEventStart)
+IMPL_TIMING_ATTR(DispatchFetchEventEnd)
+IMPL_TIMING_ATTR(HandleFetchEventStart)
+IMPL_TIMING_ATTR(HandleFetchEventEnd)
IMPL_TIMING_ATTR(DomainLookupStart)
IMPL_TIMING_ATTR(DomainLookupEnd)
IMPL_TIMING_ATTR(ConnectStart)
diff --git a/netwerk/protocol/http/HttpBaseChannel.h b/netwerk/protocol/http/HttpBaseChannel.h
index c8184a601b..9aa696a70a 100644
--- a/netwerk/protocol/http/HttpBaseChannel.h
+++ b/netwerk/protocol/http/HttpBaseChannel.h
@@ -506,7 +506,9 @@ protected:
// the HTML file.
nsString mInitiatorType;
// Number of redirects that has occurred.
- int16_t mRedirectCount;
+ int8_t mRedirectCount;
+ // Number of internal redirects that has occurred.
+ int8_t mInternalRedirectCount;
// A time value equal to the starting time of the fetch that initiates the
// redirect.
mozilla::TimeStamp mRedirectStartTimeStamp;
@@ -519,6 +521,12 @@ protected:
TimeStamp mAsyncOpenTime;
TimeStamp mCacheReadStart;
TimeStamp mCacheReadEnd;
+ TimeStamp mLaunchServiceWorkerStart;
+ TimeStamp mLaunchServiceWorkerEnd;
+ TimeStamp mDispatchFetchEventStart;
+ TimeStamp mDispatchFetchEventEnd;
+ TimeStamp mHandleFetchEventStart;
+ TimeStamp mHandleFetchEventEnd;
// copied from the transaction before we null out mTransaction
// so that the timing can still be queried from OnStopRequest
TimingStruct mTransactionTimings;
diff --git a/netwerk/protocol/http/HttpChannelChild.cpp b/netwerk/protocol/http/HttpChannelChild.cpp
index f0b9e2136d..6d09135c4c 100644
--- a/netwerk/protocol/http/HttpChannelChild.cpp
+++ b/netwerk/protocol/http/HttpChannelChild.cpp
@@ -2132,6 +2132,13 @@ HttpChannelChild::ContinueAsyncOpen()
return NS_ERROR_FAILURE;
}
+ openArgs.launchServiceWorkerStart() = mLaunchServiceWorkerStart;
+ openArgs.launchServiceWorkerEnd() = mLaunchServiceWorkerEnd;
+ openArgs.dispatchFetchEventStart() = mDispatchFetchEventStart;
+ openArgs.dispatchFetchEventEnd() = mDispatchFetchEventEnd;
+ openArgs.handleFetchEventStart() = mHandleFetchEventStart;
+ openArgs.handleFetchEventEnd() = mHandleFetchEventEnd;
+
// The socket transport in the chrome process now holds a logical ref to us
// until OnStopRequest, or we do a redirect, or we hit an IPDL error.
AddIPDLReference();
diff --git a/netwerk/protocol/http/HttpChannelParent.cpp b/netwerk/protocol/http/HttpChannelParent.cpp
index fe076a237e..90ed597a61 100644
--- a/netwerk/protocol/http/HttpChannelParent.cpp
+++ b/netwerk/protocol/http/HttpChannelParent.cpp
@@ -130,7 +130,13 @@ HttpChannelParent::Init(const HttpChannelCreationArgs& aArgs)
a.initialRwin(), a.blockAuthPrompt(),
a.suspendAfterSynthesizeResponse(),
a.allowStaleCacheContent(), a.contentTypeHint(),
- a.channelId(), a.contentWindowId(), a.preferredAlternativeType());
+ a.channelId(), a.contentWindowId(), a.preferredAlternativeType(),
+ a.launchServiceWorkerStart(),
+ a.launchServiceWorkerEnd(),
+ a.dispatchFetchEventStart(),
+ a.dispatchFetchEventEnd(),
+ a.handleFetchEventStart(),
+ a.handleFetchEventEnd());
}
case HttpChannelCreationArgs::THttpChannelConnectArgs:
{
@@ -329,7 +335,13 @@ HttpChannelParent::DoAsyncOpen( const URIParams& aURI,
const nsCString& aContentTypeHint,
const nsCString& aChannelId,
const uint64_t& aContentWindowId,
- const nsCString& aPreferredAlternativeType)
+ const nsCString& aPreferredAlternativeType,
+ const TimeStamp& aLaunchServiceWorkerStart,
+ const TimeStamp& aLaunchServiceWorkerEnd,
+ const TimeStamp& aDispatchFetchEventStart,
+ const TimeStamp& aDispatchFetchEventEnd,
+ const TimeStamp& aHandleFetchEventStart,
+ const TimeStamp& aHandleFetchEventEnd)
{
nsCOMPtr<nsIURI> uri = DeserializeURI(aURI);
if (!uri) {
@@ -534,6 +546,13 @@ HttpChannelParent::DoAsyncOpen( const URIParams& aURI,
mChannel->SetInitialRwin(aInitialRwin);
mChannel->SetBlockAuthPrompt(aBlockAuthPrompt);
+ mChannel->SetLaunchServiceWorkerStart(aLaunchServiceWorkerStart);
+ mChannel->SetLaunchServiceWorkerEnd(aLaunchServiceWorkerEnd);
+ mChannel->SetDispatchFetchEventStart(aDispatchFetchEventStart);
+ mChannel->SetDispatchFetchEventEnd(aDispatchFetchEventEnd);
+ mChannel->SetHandleFetchEventStart(aHandleFetchEventStart);
+ mChannel->SetHandleFetchEventEnd(aHandleFetchEventEnd);
+
nsCOMPtr<nsIApplicationCacheChannel> appCacheChan =
do_QueryObject(mChannel);
nsCOMPtr<nsIApplicationCacheService> appCacheService =
@@ -1159,7 +1178,7 @@ HttpChannelParent::OnStartRequest(nsIRequest *aRequest, nsISupports *aContext)
nsCString secInfoSerialization;
UpdateAndSerializeSecurityInfo(secInfoSerialization);
- uint16_t redirectCount = 0;
+ uint8_t redirectCount = 0;
chan->GetRedirectCount(&redirectCount);
nsCOMPtr<nsISupports> cacheKey;
@@ -1772,8 +1791,8 @@ HttpChannelParent::UpdateAndSerializeSecurityInfo(nsACString& aSerializedSecurit
bool
HttpChannelParent::DoSendDeleteSelf()
{
- bool rv = SendDeleteSelf();
mIPCClosed = true;
+ bool rv = SendDeleteSelf();
return rv;
}
diff --git a/netwerk/protocol/http/HttpChannelParent.h b/netwerk/protocol/http/HttpChannelParent.h
index 51fae5a82a..56854bb558 100644
--- a/netwerk/protocol/http/HttpChannelParent.h
+++ b/netwerk/protocol/http/HttpChannelParent.h
@@ -143,7 +143,13 @@ protected:
const nsCString& aContentTypeHint,
const nsCString& aChannelId,
const uint64_t& aContentWindowId,
- const nsCString& aPreferredAlternativeType);
+ const nsCString& aPreferredAlternativeType,
+ const TimeStamp& aLaunchServiceWorkerStart,
+ const TimeStamp& aLaunchServiceWorkerEnd,
+ const TimeStamp& aDispatchFetchEventStart,
+ const TimeStamp& aDispatchFetchEventEnd,
+ const TimeStamp& aHandleFetchEventStart,
+ const TimeStamp& aHandleFetchEventEnd);
virtual bool RecvSetPriority(const uint16_t& priority) override;
virtual bool RecvSetClassOfService(const uint32_t& cos) override;
@@ -209,7 +215,7 @@ private:
RefPtr<nsHttpChannel> mChannel;
nsCOMPtr<nsICacheEntry> mCacheEntry;
nsCOMPtr<nsIAssociatedContentSecurity> mAssociatedContentSecurity;
- bool mIPCClosed; // PHttpChannel actor has been Closed()
+ Atomic<bool> mIPCClosed; // PHttpChannel actor has been Closed()
nsCOMPtr<nsIChannel> mRedirectChannel;
nsCOMPtr<nsIAsyncVerifyRedirectCallback> mRedirectCallback;
diff --git a/netwerk/protocol/http/InterceptedChannel.cpp b/netwerk/protocol/http/InterceptedChannel.cpp
index 9e38e27344..2dadbe7603 100644
--- a/netwerk/protocol/http/InterceptedChannel.cpp
+++ b/netwerk/protocol/http/InterceptedChannel.cpp
@@ -10,6 +10,7 @@
#include "nsInputStreamPump.h"
#include "nsIPipe.h"
#include "nsIStreamListener.h"
+#include "nsITimedChannel.h"
#include "nsHttpChannel.h"
#include "HttpChannelChild.h"
#include "nsHttpResponseHead.h"
@@ -134,6 +135,40 @@ InterceptedChannelBase::SetReleaseHandle(nsISupports* aHandle)
return NS_OK;
}
+NS_IMETHODIMP
+InterceptedChannelBase::SaveTimeStampsToUnderlyingChannel()
+{
+ MOZ_ASSERT(NS_IsMainThread());
+
+ nsCOMPtr<nsIChannel> underlyingChannel;
+ nsresult rv = GetChannel(getter_AddRefs(underlyingChannel));
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+
+ nsCOMPtr<nsITimedChannel> timedChannel =
+ do_QueryInterface(underlyingChannel);
+ MOZ_ASSERT(timedChannel);
+
+ rv = timedChannel->SetLaunchServiceWorkerStart(mLaunchServiceWorkerStart);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+
+ rv = timedChannel->SetLaunchServiceWorkerEnd(mLaunchServiceWorkerEnd);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+
+ rv = timedChannel->SetDispatchFetchEventStart(mDispatchFetchEventStart);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+
+ rv = timedChannel->SetDispatchFetchEventEnd(mDispatchFetchEventEnd);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+
+ rv = timedChannel->SetHandleFetchEventStart(mHandleFetchEventStart);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+
+ rv = timedChannel->SetHandleFetchEventEnd(mHandleFetchEventEnd);
+ MOZ_ASSERT(NS_SUCCEEDED(rv));
+
+ return rv;
+}
+
/* static */
already_AddRefed<nsIURI>
InterceptedChannelBase::SecureUpgradeChannelURI(nsIChannel* aChannel)
diff --git a/netwerk/protocol/http/InterceptedChannel.h b/netwerk/protocol/http/InterceptedChannel.h
index 688f211de7..efab7abca6 100644
--- a/netwerk/protocol/http/InterceptedChannel.h
+++ b/netwerk/protocol/http/InterceptedChannel.h
@@ -46,6 +46,13 @@ protected:
nsresult DoSynthesizeStatus(uint16_t aStatus, const nsACString& aReason);
nsresult DoSynthesizeHeader(const nsACString& aName, const nsACString& aValue);
+ TimeStamp mLaunchServiceWorkerStart;
+ TimeStamp mLaunchServiceWorkerEnd;
+ TimeStamp mDispatchFetchEventStart;
+ TimeStamp mDispatchFetchEventEnd;
+ TimeStamp mHandleFetchEventStart;
+ TimeStamp mHandleFetchEventEnd;
+
virtual ~InterceptedChannelBase();
public:
explicit InterceptedChannelBase(nsINetworkInterceptController* aController);
@@ -60,6 +67,50 @@ public:
NS_IMETHOD GetConsoleReportCollector(nsIConsoleReportCollector** aCollectorOut) override;
NS_IMETHOD SetReleaseHandle(nsISupports* aHandle) override;
+ NS_IMETHODIMP
+ SetLaunchServiceWorkerStart(TimeStamp aTimeStamp) override
+ {
+ mLaunchServiceWorkerStart = aTimeStamp;
+ return NS_OK;
+ }
+
+ NS_IMETHODIMP
+ SetLaunchServiceWorkerEnd(TimeStamp aTimeStamp) override
+ {
+ mLaunchServiceWorkerEnd = aTimeStamp;
+ return NS_OK;
+ }
+
+ NS_IMETHODIMP
+ SetDispatchFetchEventStart(TimeStamp aTimeStamp) override
+ {
+ mDispatchFetchEventStart = aTimeStamp;
+ return NS_OK;
+ }
+
+ NS_IMETHODIMP
+ SetDispatchFetchEventEnd(TimeStamp aTimeStamp) override
+ {
+ mDispatchFetchEventEnd = aTimeStamp;
+ return NS_OK;
+ }
+
+ NS_IMETHODIMP
+ SetHandleFetchEventStart(TimeStamp aTimeStamp) override
+ {
+ mHandleFetchEventStart = aTimeStamp;
+ return NS_OK;
+ }
+
+ NS_IMETHODIMP
+ SetHandleFetchEventEnd(TimeStamp aTimeStamp) override
+ {
+ mHandleFetchEventEnd = aTimeStamp;
+ return NS_OK;
+ }
+
+ NS_IMETHODIMP SaveTimeStampsToUnderlyingChannel() override;
+
static already_AddRefed<nsIURI>
SecureUpgradeChannelURI(nsIChannel* aChannel);
};
diff --git a/netwerk/protocol/http/NullHttpChannel.cpp b/netwerk/protocol/http/NullHttpChannel.cpp
index 61efe39562..2954006ada 100644
--- a/netwerk/protocol/http/NullHttpChannel.cpp
+++ b/netwerk/protocol/http/NullHttpChannel.cpp
@@ -539,13 +539,25 @@ NullHttpChannel::SetTimingEnabled(bool aTimingEnabled)
}
NS_IMETHODIMP
-NullHttpChannel::GetRedirectCount(uint16_t *aRedirectCount)
+NullHttpChannel::GetRedirectCount(uint8_t *aRedirectCount)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
-NullHttpChannel::SetRedirectCount(uint16_t aRedirectCount)
+NullHttpChannel::SetRedirectCount(uint8_t aRedirectCount)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+NullHttpChannel::GetInternalRedirectCount(uint8_t *aRedirectCount)
+{
+ return NS_ERROR_NOT_IMPLEMENTED;
+}
+
+NS_IMETHODIMP
+NullHttpChannel::SetInternalRedirectCount(uint8_t aRedirectCount)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
@@ -565,6 +577,90 @@ NullHttpChannel::GetAsyncOpen(mozilla::TimeStamp *aAsyncOpen)
}
NS_IMETHODIMP
+NullHttpChannel::GetLaunchServiceWorkerStart(mozilla::TimeStamp *_retval)
+{
+ MOZ_ASSERT(_retval);
+ *_retval = mAsyncOpenTime;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+NullHttpChannel::SetLaunchServiceWorkerStart(mozilla::TimeStamp aTimeStamp)
+{
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+NullHttpChannel::GetLaunchServiceWorkerEnd(mozilla::TimeStamp *_retval)
+{
+ MOZ_ASSERT(_retval);
+ *_retval = mAsyncOpenTime;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+NullHttpChannel::SetLaunchServiceWorkerEnd(mozilla::TimeStamp aTimeStamp)
+{
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+NullHttpChannel::GetDispatchFetchEventStart(mozilla::TimeStamp *_retval)
+{
+ MOZ_ASSERT(_retval);
+ *_retval = mAsyncOpenTime;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+NullHttpChannel::SetDispatchFetchEventStart(mozilla::TimeStamp aTimeStamp)
+{
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+NullHttpChannel::GetDispatchFetchEventEnd(mozilla::TimeStamp *_retval)
+{
+ MOZ_ASSERT(_retval);
+ *_retval = mAsyncOpenTime;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+NullHttpChannel::SetDispatchFetchEventEnd(mozilla::TimeStamp aTimeStamp)
+{
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+NullHttpChannel::GetHandleFetchEventStart(mozilla::TimeStamp *_retval)
+{
+ MOZ_ASSERT(_retval);
+ *_retval = mAsyncOpenTime;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+NullHttpChannel::SetHandleFetchEventStart(mozilla::TimeStamp aTimeStamp)
+{
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+NullHttpChannel::GetHandleFetchEventEnd(mozilla::TimeStamp *_retval)
+{
+ MOZ_ASSERT(_retval);
+ *_retval = mAsyncOpenTime;
+ return NS_OK;
+}
+
+NS_IMETHODIMP
+NullHttpChannel::SetHandleFetchEventEnd(mozilla::TimeStamp aTimeStamp)
+{
+ return NS_OK;
+}
+
+NS_IMETHODIMP
NullHttpChannel::GetDomainLookupStart(mozilla::TimeStamp *aDomainLookupStart)
{
*aDomainLookupStart = mAsyncOpenTime;
@@ -761,6 +857,12 @@ NullHttpChannel::Get##name##Time(PRTime* _retval) { \
IMPL_TIMING_ATTR(ChannelCreation)
IMPL_TIMING_ATTR(AsyncOpen)
+IMPL_TIMING_ATTR(LaunchServiceWorkerStart)
+IMPL_TIMING_ATTR(LaunchServiceWorkerEnd)
+IMPL_TIMING_ATTR(DispatchFetchEventStart)
+IMPL_TIMING_ATTR(DispatchFetchEventEnd)
+IMPL_TIMING_ATTR(HandleFetchEventStart)
+IMPL_TIMING_ATTR(HandleFetchEventEnd)
IMPL_TIMING_ATTR(DomainLookupStart)
IMPL_TIMING_ATTR(DomainLookupEnd)
IMPL_TIMING_ATTR(ConnectStart)
diff --git a/netwerk/protocol/http/nsHttpChannel.cpp b/netwerk/protocol/http/nsHttpChannel.cpp
index ce0f45dabe..05699df621 100644
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -1152,7 +1152,7 @@ ProcessXCTO(nsIURI* aURI, nsHttpResponseHead* aResponseHead, nsILoadInfo* aLoadI
}
if (aLoadInfo->GetExternalContentPolicyType() == nsIContentPolicy::TYPE_SCRIPT) {
- if (nsContentUtils::IsScriptType(contentType)) {
+ if (nsContentUtils::IsJavascriptMIMEType(NS_ConvertUTF8toUTF16(contentType))) {
return NS_OK;
}
ReportTypeBlocking(aURI, aLoadInfo, "MimeTypeMismatch");
@@ -5402,7 +5402,7 @@ nsHttpChannel::AsyncProcessRedirection(uint32_t redirectType)
if (NS_EscapeURL(location.get(), -1, esc_OnlyNonASCII, locationBuf))
location = locationBuf;
- if (mRedirectionLimit == 0) {
+ if (mRedirectCount >= mRedirectionLimit || mInternalRedirectCount >= mRedirectionLimit) {
LOG(("redirection limit reached!\n"));
return NS_ERROR_REDIRECT_LOOP;
}
diff --git a/netwerk/protocol/http/nsHttpHandler.h b/netwerk/protocol/http/nsHttpHandler.h
index d51662db90..35b14a511b 100644
--- a/netwerk/protocol/http/nsHttpHandler.h
+++ b/netwerk/protocol/http/nsHttpHandler.h
@@ -489,8 +489,8 @@ private:
nsCString mCompatGecko;
bool mCompatGeckoEnabled;
nsCString mCompatFirefox;
- nsCString mCompatFirefoxVersion;
bool mCompatFirefoxEnabled;
+ nsCString mCompatFirefoxVersion;
nsXPIDLCString mCompatDevice;
nsCString mDeviceModelId;
diff --git a/netwerk/sctp/datachannel/DataChannel.cpp b/netwerk/sctp/datachannel/DataChannel.cpp
index bf7790f51c..d47a9d5ead 100644
--- a/netwerk/sctp/datachannel/DataChannel.cpp
+++ b/netwerk/sctp/datachannel/DataChannel.cpp
@@ -646,6 +646,7 @@ DataChannelConnection::SctpDtlsInput(TransportFlow *flow,
}
}
// Pass the data to SCTP
+ MutexAutoLock lock(mLock);
usrsctp_conninput(static_cast<void *>(this), data, len, 0);
}
@@ -1016,7 +1017,7 @@ DataChannelConnection::SendDeferredMessages()
bool still_blocked = false;
// This may block while something is modifying channels, but should not block for IO
- MutexAutoLock lock(mLock);
+ mLock.AssertCurrentThreadOwns();
// XXX For total fairness, on a still_blocked we'd start next time at the
// same index. Sorry, not going to bother for now.
@@ -1923,7 +1924,7 @@ DataChannelConnection::ReceiveCallback(struct socket* sock, void *data, size_t d
if (!data) {
usrsctp_close(sock); // SCTP has finished shutting down
} else {
- MutexAutoLock lock(mLock);
+ mLock.AssertCurrentThreadOwns();
if (flags & MSG_NOTIFICATION) {
HandleNotification(static_cast<union sctp_notification *>(data), datalen);
} else {
diff --git a/netwerk/test/unit/test_URIs.js b/netwerk/test/unit/test_URIs.js
index b68c4f7874..1cad7768f7 100644
--- a/netwerk/test/unit/test_URIs.js
+++ b/netwerk/test/unit/test_URIs.js
@@ -92,18 +92,6 @@ var gTests = [
ref: "",
relativeURI: "data/text/plain,2",
nsIURL: true, nsINestedURI: false },
- { spec: "ftp://",
- scheme: "ftp",
- prePath: "ftp://",
- path: "/",
- ref: "",
- nsIURL: true, nsINestedURI: false },
- { spec: "ftp:///",
- scheme: "ftp",
- prePath: "ftp://",
- path: "/",
- ref: "",
- nsIURL: true, nsINestedURI: false },
{ spec: "ftp://ftp.mozilla.org/pub/mozilla.org/README",
scheme: "ftp",
prePath: "ftp://ftp.mozilla.org",
@@ -121,7 +109,7 @@ var gTests = [
nsIURL: true, nsINestedURI: false },
{ spec: "ftp://foo:@ftp.mozilla.org:100/pub/mozilla.org/README",
scheme: "ftp",
- prePath: "ftp://foo:@ftp.mozilla.org:100",
+ prePath: "ftp://foo@ftp.mozilla.org:100",
port: 100,
username: "foo",
password: "",
@@ -135,18 +123,6 @@ var gTests = [
path: "//mozilla.org/",
ref: "",
nsIURL: false, nsINestedURI: false },
- { spec: "http://",
- scheme: "http",
- prePath: "http://",
- path: "/",
- ref: "",
- nsIURL: true, nsINestedURI: false },
- { spec: "http:///",
- scheme: "http",
- prePath: "http://",
- path: "/",
- ref: "",
- nsIURL: true, nsINestedURI: false },
{ spec: "http://www.example.com/",
scheme: "http",
prePath: "http://www.example.com",
diff --git a/netwerk/test/unit/test_standardurl.js b/netwerk/test/unit/test_standardurl.js
index c4d44f41ff..4cc2f393ee 100644
--- a/netwerk/test/unit/test_standardurl.js
+++ b/netwerk/test/unit/test_standardurl.js
@@ -251,6 +251,17 @@ add_test(function test_escapeBrackets()
run_next_test();
});
+add_test(function test_escapeQuote()
+{
+ var url = stringToURL("http://example.com/#'");
+ do_check_eq(url.spec, "http://example.com/#'");
+ do_check_eq(url.ref, "'");
+ url.ref = "test'test";
+ do_check_eq(url.spec, "http://example.com/#test'test");
+ do_check_eq(url.ref, "test'test");
+ run_next_test();
+});
+
add_test(function test_apostropheEncoding()
{
// For now, single quote is escaped everywhere _except_ the path.
@@ -335,6 +346,14 @@ add_test(function test_backslashReplacement()
run_next_test();
});
+add_test(function test_authority_host()
+{
+ Assert.throws(() => { stringToURL("http:"); }, "TYPE_AUTHORITY should have host");
+ Assert.throws(() => { stringToURL("http:///"); }, "TYPE_AUTHORITY should have host");
+
+ run_next_test();
+});
+
add_test(function test_trim_C0_and_space()
{
var url = stringToURL("\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f http://example.com/ \x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f ");
@@ -453,3 +472,23 @@ add_test(function test_invalidHostChars() {
// hostname separators, so there is no way to set them and fail.
run_next_test();
});
+
+add_test(function test_emptyPassword() {
+ var url = stringToURL("http://a:@example.com");
+ do_check_eq(url.spec, "http://a@example.com/");
+ url.password = "pp";
+ do_check_eq(url.spec, "http://a:pp@example.com/");
+ url.password = "";
+ do_check_eq(url.spec, "http://a@example.com/");
+ url.userPass = "xxx:";
+ do_check_eq(url.spec, "http://xxx@example.com/");
+ url.password = "zzzz";
+ do_check_eq(url.spec, "http://xxx:zzzz@example.com/");
+ url.userPass = "xxxxx:yyyyyy";
+ do_check_eq(url.spec, "http://xxxxx:yyyyyy@example.com/");
+ url.userPass = "z:";
+ do_check_eq(url.spec, "http://z@example.com/");
+ url.password = "ppppppppppp";
+ do_check_eq(url.spec, "http://z:ppppppppppp@example.com/");
+ run_next_test();
+});
diff --git a/nsprpub/TAG-INFO b/nsprpub/TAG-INFO
new file mode 100644
index 0000000000..ebe7269ae6
--- /dev/null
+++ b/nsprpub/TAG-INFO
@@ -0,0 +1 @@
+NSPR_4_16_RTM
diff --git a/nsprpub/configure b/nsprpub/configure
index 19e9fa60f6..b8ad2b4ebf 100755
--- a/nsprpub/configure
+++ b/nsprpub/configure
@@ -2488,7 +2488,7 @@ test -n "$target_alias" &&
program_prefix=${target_alias}-
MOD_MAJOR_VERSION=4
-MOD_MINOR_VERSION=18
+MOD_MINOR_VERSION=16
MOD_PATCH_VERSION=0
NSPR_MODNAME=nspr20
_HAVE_PTHREADS=
@@ -6560,13 +6560,11 @@ fi
$as_echo "#define HAVE_POINTER_LOCALTIME_R 1" >>confdefs.h
-
HOST_DARWIN_MAJOR=`echo "$build_os" | sed -E -e 's/^darwin([0-9]+).*$/\1/'`
-
if test "$HOST_DARWIN_MAJOR" -ge 15 ; then
$as_echo "#define HAS_CONNECTX 1" >>confdefs.h
-
fi
+
AS='$(CC) -x assembler-with-cpp'
CFLAGS="$CFLAGS -Wall -fno-common"
case "${target_cpu}" in
@@ -8474,12 +8472,19 @@ case "$target" in
fi
if test "$USE_PTHREADS"; then
- cat >>confdefs.h <<_ACEOF
+ if echo "$OS_RELEASE" | egrep '^(B.10.10|B.10.20)' >/dev/null; then
+ $as_echo "#define _REENTRANT 1" >>confdefs.h
+
+ $as_echo "#define _PR_DCETHREADS 1" >>confdefs.h
+
+ else
+ cat >>confdefs.h <<_ACEOF
#define _POSIX_C_SOURCE 199506L
_ACEOF
- $as_echo "#define _PR_HAVE_THREADSAFE_GETHOST 1" >>confdefs.h
+ $as_echo "#define _PR_HAVE_THREADSAFE_GETHOST 1" >>confdefs.h
+ fi
fi
if test "$USE_USER_PTHREADS"; then
cat >>confdefs.h <<_ACEOF
diff --git a/nsprpub/configure.in b/nsprpub/configure.in
index 7b0b8b395d..22b4e72245 100644
--- a/nsprpub/configure.in
+++ b/nsprpub/configure.in
@@ -15,7 +15,7 @@ dnl ========================================================
dnl = Defaults
dnl ========================================================
MOD_MAJOR_VERSION=4
-MOD_MINOR_VERSION=18
+MOD_MINOR_VERSION=16
MOD_PATCH_VERSION=0
NSPR_MODNAME=nspr20
_HAVE_PTHREADS=
@@ -2889,8 +2889,13 @@ case "$target" in
AC_DEFINE(_PR_LOCAL_THREADS_ONLY)
fi
if test "$USE_PTHREADS"; then
- AC_DEFINE_UNQUOTED(_POSIX_C_SOURCE,199506L)
- AC_DEFINE(_PR_HAVE_THREADSAFE_GETHOST)
+ if echo "$OS_RELEASE" | egrep '^(B.10.10|B.10.20)' >/dev/null; then
+ AC_DEFINE(_REENTRANT)
+ AC_DEFINE(_PR_DCETHREADS)
+ else
+ AC_DEFINE_UNQUOTED(_POSIX_C_SOURCE,199506L)
+ AC_DEFINE(_PR_HAVE_THREADSAFE_GETHOST)
+ fi
fi
if test "$USE_USER_PTHREADS"; then
AC_DEFINE_UNQUOTED(_POSIX_C_SOURCE,199506L)
diff --git a/nsprpub/pr/include/md/_pth.h b/nsprpub/pr/include/md/_pth.h
index 5603223a08..eeeef04387 100644
--- a/nsprpub/pr/include/md/_pth.h
+++ b/nsprpub/pr/include/md/_pth.h
@@ -14,7 +14,29 @@
#define _PR_MD_DISABLE_CLOCK_INTERRUPTS()
#define _PR_MD_ENABLE_CLOCK_INTERRUPTS()
-#if defined(BSDI)
+/* In good standards fashion, the DCE threads (based on posix-4) are not
+ * quite the same as newer posix implementations. These are mostly name
+ * changes and small differences, so macros usually do the trick
+ */
+#ifdef _PR_DCETHREADS
+#define _PT_PTHREAD_MUTEXATTR_INIT pthread_mutexattr_create
+#define _PT_PTHREAD_MUTEXATTR_DESTROY pthread_mutexattr_delete
+#define _PT_PTHREAD_MUTEX_INIT(m, a) pthread_mutex_init(&(m), a)
+#define _PT_PTHREAD_MUTEX_IS_LOCKED(m) (0 == pthread_mutex_trylock(&(m)))
+#define _PT_PTHREAD_CONDATTR_INIT pthread_condattr_create
+#define _PT_PTHREAD_COND_INIT(m, a) pthread_cond_init(&(m), a)
+#define _PT_PTHREAD_CONDATTR_DESTROY pthread_condattr_delete
+
+/* Notes about differences between DCE threads and pthreads 10:
+ * 1. pthread_mutex_trylock returns 1 when it locks the mutex
+ * 0 when it does not. The latest pthreads has a set of errno-like
+ * return values.
+ * 2. return values from pthread_cond_timedwait are different.
+ *
+ *
+ *
+ */
+#elif defined(BSDI)
/*
* Mutex and condition attributes are not supported. The attr
* argument to pthread_mutex_init() and pthread_cond_init() must
@@ -84,7 +106,13 @@
* PR_EnterMonitor calls any of these functions, infinite
* recursion ensues.
*/
-#if defined(IRIX) || defined(OSF1) || defined(AIX) || defined(SOLARIS) \
+#if defined(_PR_DCETHREADS)
+#define _PT_PTHREAD_INVALIDATE_THR_HANDLE(t) \
+ memset(&(t), 0, sizeof(pthread_t))
+#define _PT_PTHREAD_THR_HANDLE_IS_INVALID(t) \
+ (!memcmp(&(t), &pt_zero_tid, sizeof(pthread_t)))
+#define _PT_PTHREAD_COPY_THR_HANDLE(st, dt) (dt) = (st)
+#elif defined(IRIX) || defined(OSF1) || defined(AIX) || defined(SOLARIS) \
|| defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
|| defined(HPUX) || defined(FREEBSD) \
|| defined(NETBSD) || defined(OPENBSD) || defined(BSDI) \
@@ -97,7 +125,17 @@
#error "pthreads is not supported for this architecture"
#endif
-#if defined(_PR_PTHREADS)
+#if defined(_PR_DCETHREADS)
+#define _PT_PTHREAD_ATTR_INIT pthread_attr_create
+#define _PT_PTHREAD_ATTR_DESTROY pthread_attr_delete
+#define _PT_PTHREAD_CREATE(t, a, f, r) pthread_create(t, a, f, r)
+#define _PT_PTHREAD_KEY_CREATE pthread_keycreate
+#define _PT_PTHREAD_ATTR_SETSCHEDPOLICY pthread_attr_setsched
+#define _PT_PTHREAD_ATTR_GETSTACKSIZE(a, s) \
+ (*(s) = pthread_attr_getstacksize(*(a)), 0)
+#define _PT_PTHREAD_GETSPECIFIC(k, r) \
+ pthread_getspecific((k), (pthread_addr_t *) &(r))
+#elif defined(_PR_PTHREADS)
#define _PT_PTHREAD_ATTR_INIT pthread_attr_init
#define _PT_PTHREAD_ATTR_DESTROY pthread_attr_destroy
#define _PT_PTHREAD_CREATE(t, a, f, r) pthread_create(t, &a, f, r)
@@ -109,6 +147,22 @@
#error "Cannot determine pthread strategy"
#endif
+#if defined(_PR_DCETHREADS)
+#define _PT_PTHREAD_EXPLICIT_SCHED _PT_PTHREAD_DEFAULT_SCHED
+#endif
+
+/*
+ * pthread_mutex_trylock returns different values in DCE threads and
+ * pthreads.
+ */
+#if defined(_PR_DCETHREADS)
+#define PT_TRYLOCK_SUCCESS 1
+#define PT_TRYLOCK_BUSY 0
+#else
+#define PT_TRYLOCK_SUCCESS 0
+#define PT_TRYLOCK_BUSY EBUSY
+#endif
+
/*
* These platforms don't have sigtimedwait()
*/
@@ -136,9 +190,16 @@
#define PT_PRIO_MIN DEFAULT_PRIO
#define PT_PRIO_MAX DEFAULT_PRIO
#elif defined(HPUX)
+
+#if defined(_PR_DCETHREADS)
+#define PT_PRIO_MIN PRI_OTHER_MIN
+#define PT_PRIO_MAX PRI_OTHER_MAX
+#else /* defined(_PR_DCETHREADS) */
#include <sys/sched.h>
#define PT_PRIO_MIN sched_get_priority_min(SCHED_OTHER)
#define PT_PRIO_MAX sched_get_priority_max(SCHED_OTHER)
+#endif /* defined(_PR_DCETHREADS) */
+
#elif defined(LINUX) || defined(__GNU__) || defined(__GLIBC__) \
|| defined(FREEBSD) || defined(SYMBIAN)
#define PT_PRIO_MIN sched_get_priority_min(SCHED_OTHER)
@@ -177,7 +238,9 @@
* Needed for garbage collection -- Look at PR_Suspend/PR_Resume
* implementation.
*/
-#if defined(OSF1)
+#if defined(_PR_DCETHREADS)
+#define _PT_PTHREAD_YIELD() pthread_yield()
+#elif defined(OSF1)
/*
* sched_yield can't be called from a signal handler. Must use
* the _np version.
diff --git a/nsprpub/pr/include/prinet.h b/nsprpub/pr/include/prinet.h
index fc9f739186..15d229fe45 100644
--- a/nsprpub/pr/include/prinet.h
+++ b/nsprpub/pr/include/prinet.h
@@ -54,7 +54,7 @@ struct sockaddr_dl;
#endif /* XP_UNIX */
#include <netdb.h>
-#if defined(BSDI) || defined(QNX)
+#if defined(FREEBSD) || defined(BSDI) || defined(QNX)
#include <rpc/types.h> /* the only place that defines INADDR_LOOPBACK */
#endif
diff --git a/nsprpub/pr/include/prinit.h b/nsprpub/pr/include/prinit.h
index c55788923b..fd935ec309 100644
--- a/nsprpub/pr/include/prinit.h
+++ b/nsprpub/pr/include/prinit.h
@@ -31,9 +31,9 @@ PR_BEGIN_EXTERN_C
** The format of the version string is
** "<major version>.<minor version>[.<patch level>] [<Beta>]"
*/
-#define PR_VERSION "4.18"
+#define PR_VERSION "4.16"
#define PR_VMAJOR 4
-#define PR_VMINOR 18
+#define PR_VMINOR 16
#define PR_VPATCH 0
#define PR_BETA PR_FALSE
diff --git a/nsprpub/pr/include/private/primpl.h b/nsprpub/pr/include/private/primpl.h
index a817c206c6..dc24a25727 100644
--- a/nsprpub/pr/include/private/primpl.h
+++ b/nsprpub/pr/include/private/primpl.h
@@ -6,6 +6,14 @@
#ifndef primpl_h___
#define primpl_h___
+/*
+ * HP-UX 10.10's pthread.h (DCE threads) includes dce/cma.h, which
+ * has:
+ * #define sigaction _sigaction_sys
+ * This macro causes chaos if signal.h gets included before pthread.h.
+ * To be safe, we include pthread.h first.
+ */
+
#if defined(_PR_PTHREADS)
#include <pthread.h>
#endif
@@ -1869,7 +1877,7 @@ extern PRFileDesc *_pr_stderr;
** and functions with macros that expand to the native thread
** types and functions on each platform.
*/
-#if defined(_PR_PTHREADS)
+#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
#define _PR_ZONE_ALLOCATOR
#endif
@@ -2157,18 +2165,6 @@ extern PRUint32 connectCount;
#endif /* XP_BEOS */
-#if defined(_WIN64) && defined(WIN95)
-typedef struct _PRFileDescList {
- PRFileDesc *fd;
- struct _PRFileDescList *next;
-} PRFileDescList;
-
-extern PRLock *_fd_waiting_for_overlapped_done_lock;
-extern PRFileDescList *_fd_waiting_for_overlapped_done;
-extern void CheckOverlappedPendingSocketsAreDone();
-#endif
-
-
PR_END_EXTERN_C
#endif /* primpl_h___ */
diff --git a/nsprpub/pr/src/Makefile.in b/nsprpub/pr/src/Makefile.in
index 19c5a6987c..48b6faed7b 100644
--- a/nsprpub/pr/src/Makefile.in
+++ b/nsprpub/pr/src/Makefile.in
@@ -138,8 +138,12 @@ endif
ifeq ($(OS_ARCH),HP-UX)
ifeq ($(USE_PTHREADS), 1)
+ifeq (,$(filter-out B.10.10 B.10.20,$(OS_RELEASE)))
+OS_LIBS = -ldce
+else
OS_LIBS = -lpthread -lrt
endif
+endif
ifeq ($(PTHREADS_USER), 1)
OS_LIBS = -lpthread
endif
diff --git a/nsprpub/pr/src/io/prio.c b/nsprpub/pr/src/io/prio.c
index 10ae5e098c..bf9763a2cd 100644
--- a/nsprpub/pr/src/io/prio.c
+++ b/nsprpub/pr/src/io/prio.c
@@ -137,82 +137,11 @@ PR_IMPLEMENT(void) PR_FreeFileDesc(PRFileDesc *fd)
_PR_Putfd(fd);
}
-#if defined(_WIN64) && defined(WIN95)
-
-PRFileDescList *_fd_waiting_for_overlapped_done = NULL;
-PRLock *_fd_waiting_for_overlapped_done_lock = NULL;
-
-void CheckOverlappedPendingSocketsAreDone()
-{
- if (!_fd_waiting_for_overlapped_done_lock ||
- !_fd_waiting_for_overlapped_done) {
- return;
- }
-
- PR_Lock(_fd_waiting_for_overlapped_done_lock);
-
- PRFileDescList *cur = _fd_waiting_for_overlapped_done;
- PRFileDescList *previous = NULL;
- while (cur) {
- PR_ASSERT(cur->fd->secret->overlappedActive);
- PRFileDesc *fd = cur->fd;
- DWORD rvSent;
- if (GetOverlappedResult((HANDLE)fd->secret->md.osfd, &fd->secret->ol, &rvSent, FALSE) == TRUE) {
- fd->secret->overlappedActive = PR_FALSE;
- PR_LOG(_pr_io_lm, PR_LOG_MIN,
- ("CheckOverlappedPendingSocketsAreDone GetOverlappedResult succeeded\n"));
- } else {
- DWORD err = WSAGetLastError();
- PR_LOG(_pr_io_lm, PR_LOG_MIN,
- ("CheckOverlappedPendingSocketsAreDone GetOverlappedResult failed %d\n", err));
- if (err != ERROR_IO_INCOMPLETE) {
- fd->secret->overlappedActive = PR_FALSE;
- }
- }
-
- if (!fd->secret->overlappedActive) {
-
- _PR_MD_CLOSE_SOCKET(fd->secret->md.osfd);
- fd->secret->state = _PR_FILEDESC_CLOSED;
-#ifdef _PR_HAVE_PEEK_BUFFER
- if (fd->secret->peekBuffer) {
- PR_ASSERT(fd->secret->peekBufSize > 0);
- PR_DELETE(fd->secret->peekBuffer);
- fd->secret->peekBufSize = 0;
- fd->secret->peekBytes = 0;
- }
-#endif
-
- PR_FreeFileDesc(fd);
-
- if (previous) {
- previous->next = cur->next;
- } else {
- _fd_waiting_for_overlapped_done = cur->next;
- }
- PRFileDescList *del = cur;
- cur = cur->next;
- PR_Free(del);
- } else {
- previous = cur;
- cur = cur->next;
- }
- }
-
- PR_Unlock(_fd_waiting_for_overlapped_done_lock);
-}
-#endif
-
/*
** Wait for some i/o to finish on one or more more poll descriptors.
*/
PR_IMPLEMENT(PRInt32) PR_Poll(PRPollDesc *pds, PRIntn npds, PRIntervalTime timeout)
{
-#if defined(_WIN64) && defined(WIN95)
- // For each iteration check if TFO overlapped IOs are down.
- CheckOverlappedPendingSocketsAreDone();
-#endif
-
return(_PR_MD_PR_POLL(pds, npds, timeout));
}
diff --git a/nsprpub/pr/src/io/prsocket.c b/nsprpub/pr/src/io/prsocket.c
index 26f7a245d2..a24b8e1bb4 100644
--- a/nsprpub/pr/src/io/prsocket.c
+++ b/nsprpub/pr/src/io/prsocket.c
@@ -304,25 +304,7 @@ static PRStatus PR_CALLBACK SocketConnectContinue(
if (err != 0) {
_PR_MD_MAP_CONNECT_ERROR(err);
} else {
-#if defined(_WIN64)
- if (fd->secret->overlappedActive) {
- PRInt32 rvSent;
- if (GetOverlappedResult(osfd, &fd->secret->ol, &rvSent, FALSE) == FALSE) {
- err = WSAGetLastError();
- PR_LOG(_pr_io_lm, PR_LOG_MIN,
- ("SocketConnectContinue GetOverlappedResult failed %d\n", err));
- if (err != ERROR_IO_INCOMPLETE) {
- _PR_MD_MAP_CONNECT_ERROR(err);
- fd->secret->overlappedActive = PR_FALSE;
- }
- }
- }
- if (err == 0) {
- PR_SetError(PR_UNKNOWN_ERROR, 0);
- }
-#else
PR_SetError(PR_UNKNOWN_ERROR, 0);
-#endif
}
return PR_FAILURE;
}
@@ -737,56 +719,6 @@ static PRStatus PR_CALLBACK SocketClose(PRFileDesc *fd)
}
if (fd->secret->state == _PR_FILEDESC_OPEN) {
-#if defined(_WIN64) && defined(WIN95)
- /* TCP Fast Open on Windows must use ConnectEx, which uses overlapped
- * input/output. Before closing such a socket we must cancelIO.
- */
- if (fd->secret->overlappedActive) {
- PR_ASSERT(fd->secret->nonblocking);
- if (CancelIo((HANDLE) fd->secret->md.osfd) == TRUE) {
- PR_LOG(_pr_io_lm, PR_LOG_MIN,
- ("SocketClose - CancelIo succeeded\n"));
- } else {
- DWORD err = WSAGetLastError();
- PR_LOG(_pr_io_lm, PR_LOG_MIN,
- ("SocketClose - CancelIo failed err=%x\n", err));
- }
-
- DWORD rvSent;
- if (GetOverlappedResult((HANDLE)fd->secret->md.osfd, &fd->secret->ol, &rvSent, FALSE) == TRUE) {
- fd->secret->overlappedActive = PR_FALSE;
- PR_LOG(_pr_io_lm, PR_LOG_MIN,
- ("SocketClose GetOverlappedResult succeeded\n"));
- } else {
- DWORD err = WSAGetLastError();
- PR_LOG(_pr_io_lm, PR_LOG_MIN,
- ("SocketClose GetOverlappedResult failed %d\n", err));
- if (err != ERROR_IO_INCOMPLETE) {
- _PR_MD_MAP_CONNECT_ERROR(err);
- fd->secret->overlappedActive = PR_FALSE;
- }
- }
- }
-
- if (fd->secret->overlappedActive &&
- _fd_waiting_for_overlapped_done_lock) {
- // Put osfd into the list to be checked later.
- PRFileDescList *forWaiting = PR_NEW(PRFileDescList);
- if (!forWaiting) {
- PR_SetError(PR_OUT_OF_MEMORY_ERROR, 0);
- return PR_FAILURE;
- }
- forWaiting->fd = fd;
-
- PR_Lock(_fd_waiting_for_overlapped_done_lock);
- forWaiting->next = _fd_waiting_for_overlapped_done;
- _fd_waiting_for_overlapped_done = forWaiting;
- PR_Unlock(_fd_waiting_for_overlapped_done_lock);
-
- return PR_SUCCESS;
- }
-#endif
-
if (_PR_MD_CLOSE_SOCKET(fd->secret->md.osfd) < 0) {
return PR_FAILURE;
}
diff --git a/nsprpub/pr/src/md/unix/unix.c b/nsprpub/pr/src/md/unix/unix.c
index 29e24e5745..662f561b6f 100644
--- a/nsprpub/pr/src/md/unix/unix.c
+++ b/nsprpub/pr/src/md/unix/unix.c
@@ -2854,11 +2854,28 @@ void _PR_UnixInit(void)
#endif
#endif /* !defined(_PR_PTHREADS) */
+ /*
+ * Under HP-UX DCE threads, sigaction() installs a per-thread
+ * handler, so we use sigvector() to install a process-wide
+ * handler.
+ */
+#if defined(HPUX) && defined(_PR_DCETHREADS)
+ {
+ struct sigvec vec;
+
+ vec.sv_handler = SIG_IGN;
+ vec.sv_mask = 0;
+ vec.sv_flags = 0;
+ rv = sigvector(SIGPIPE, &vec, NULL);
+ PR_ASSERT(0 == rv);
+ }
+#else
sigact.sa_handler = SIG_IGN;
sigemptyset(&sigact.sa_mask);
sigact.sa_flags = 0;
rv = sigaction(SIGPIPE, &sigact, 0);
PR_ASSERT(0 == rv);
+#endif /* HPUX && _PR_DCETHREADS */
_pr_rename_lock = PR_NewLock();
PR_ASSERT(NULL != _pr_rename_lock);
diff --git a/nsprpub/pr/src/md/unix/uxproces.c b/nsprpub/pr/src/md/unix/uxproces.c
index 18f23fde80..5286b9e185 100644
--- a/nsprpub/pr/src/md/unix/uxproces.c
+++ b/nsprpub/pr/src/md/unix/uxproces.c
@@ -685,6 +685,10 @@ static void pr_SigchldHandler(int sig)
static void pr_InstallSigchldHandler()
{
+#if defined(HPUX) && defined(_PR_DCETHREADS)
+#error "HP-UX DCE threads have their own SIGCHLD handler"
+#endif
+
struct sigaction act, oact;
int rv;
diff --git a/nsprpub/pr/src/md/windows/ntthread.c b/nsprpub/pr/src/md/windows/ntthread.c
index 1fdf0e93be..fead1236d2 100644
--- a/nsprpub/pr/src/md/windows/ntthread.c
+++ b/nsprpub/pr/src/md/windows/ntthread.c
@@ -27,9 +27,6 @@ PRUint32 _nt_idleCount;
extern __declspec(thread) PRThread *_pr_io_restarted_io;
extern DWORD _pr_io_restartedIOIndex;
-typedef HRESULT (WINAPI *SETTHREADDESCRIPTION)(HANDLE, PCWSTR);
-static SETTHREADDESCRIPTION sSetThreadDescription = NULL;
-
/* Must check the restarted_io *before* decrementing no_sched to 0 */
#define POST_SWITCH_WORK() \
PR_BEGIN_MACRO \
@@ -82,8 +79,6 @@ _nt_handle_restarted_io(PRThread *restarted_io)
void
_PR_MD_EARLY_INIT()
{
- HMODULE hModule;
-
_MD_NEW_LOCK( &_nt_idleLock );
_nt_idleCount = 0;
PR_INIT_CLIST(&_nt_idleList);
@@ -103,15 +98,6 @@ _PR_MD_EARLY_INIT()
_pr_intsOffIndex = TlsAlloc();
_pr_io_restartedIOIndex = TlsAlloc();
}
-
- // SetThreadDescription is Windows 10 build 1607+
- hModule = GetModuleHandleW(L"kernel32.dll");
- if (hModule) {
- sSetThreadDescription =
- (SETTHREADDESCRIPTION) GetProcAddress(
- hModule,
- "SetThreadDescription");
- }
}
void _PR_MD_CLEANUP_BEFORE_EXIT(void)
@@ -307,16 +293,7 @@ _PR_MD_SET_CURRENT_THREAD_NAME(const char *name)
{
#ifdef _MSC_VER
THREADNAME_INFO info;
-#endif
-
- if (sSetThreadDescription) {
- WCHAR wideName[MAX_PATH];
- if (MultiByteToWideChar(CP_ACP, 0, name, -1, wideName, MAX_PATH)) {
- sSetThreadDescription(GetCurrentThread(), wideName);
- }
- }
-#ifdef _MSC_VER
if (!IsDebuggerPresent())
return;
diff --git a/nsprpub/pr/src/md/windows/w95sock.c b/nsprpub/pr/src/md/windows/w95sock.c
index c6a3ec111f..0429c655aa 100644
--- a/nsprpub/pr/src/md/windows/w95sock.c
+++ b/nsprpub/pr/src/md/windows/w95sock.c
@@ -382,11 +382,6 @@ PRInt32
_PR_MD_TCPSENDTO(PRFileDesc *fd, const void *buf, PRInt32 amount, PRIntn flags,
const PRNetAddr *addr, PRUint32 addrlen, PRIntervalTime timeout)
{
- if (!_fd_waiting_for_overlapped_done_lock) {
- PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
- return PR_FAILURE;
- }
-
if (PR_CallOnce(&_pr_has_connectex_once, _pr_set_connectex) != PR_SUCCESS) {
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
return PR_FAILURE;
diff --git a/nsprpub/pr/src/md/windows/w95thred.c b/nsprpub/pr/src/md/windows/w95thred.c
index a365411f50..c27d982a74 100644
--- a/nsprpub/pr/src/md/windows/w95thred.c
+++ b/nsprpub/pr/src/md/windows/w95thred.c
@@ -1,4 +1,3 @@
-
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -28,32 +27,14 @@ DWORD _pr_currentCPUIndex;
int _pr_intsOff = 0;
_PRInterruptTable _pr_interruptTable[] = { { 0 } };
-typedef HRESULT (WINAPI *SETTHREADDESCRIPTION)(HANDLE, PCWSTR);
-static SETTHREADDESCRIPTION sSetThreadDescription = NULL;
-
void
_PR_MD_EARLY_INIT()
{
- HMODULE hModule;
-
#ifndef _PR_USE_STATIC_TLS
_pr_currentThreadIndex = TlsAlloc();
_pr_lastThreadIndex = TlsAlloc();
_pr_currentCPUIndex = TlsAlloc();
#endif
-
-#if defined(_WIN64) && defined(WIN95)
- _fd_waiting_for_overlapped_done_lock = PR_NewLock();
-#endif
-
- // SetThreadDescription is Windows 10 build 1607+
- hModule = GetModuleHandleW(L"kernel32.dll");
- if (hModule) {
- sSetThreadDescription =
- (SETTHREADDESCRIPTION) GetProcAddress(
- hModule,
- "SetThreadDescription");
- }
}
void _PR_MD_CLEANUP_BEFORE_EXIT(void)
@@ -69,29 +50,6 @@ void _PR_MD_CLEANUP_BEFORE_EXIT(void)
TlsFree(_pr_lastThreadIndex);
TlsFree(_pr_currentCPUIndex);
#endif
-
-#if defined(_WIN64) && defined(WIN95)
- // For each iteration check if TFO overlapped IOs are down.
- if (_fd_waiting_for_overlapped_done_lock) {
- PRIntervalTime delay = PR_MillisecondsToInterval(1000);
- PRFileDescList *cur;
- do {
- CheckOverlappedPendingSocketsAreDone();
-
- PR_Lock(_fd_waiting_for_overlapped_done_lock);
- cur = _fd_waiting_for_overlapped_done;
- PR_Unlock(_fd_waiting_for_overlapped_done_lock);
-#if defined(DO_NOT_WAIT_FOR_CONNECT_OVERLAPPED_OPERATIONS)
- cur = NULL;
-#endif
- if (cur) {
- PR_Sleep(delay); // wait another 1s.
- }
- } while (cur);
-
- PR_DestroyLock(_fd_waiting_for_overlapped_done_lock);
- }
-#endif
}
PRStatus
@@ -232,16 +190,7 @@ _PR_MD_SET_CURRENT_THREAD_NAME(const char *name)
{
#ifdef _MSC_VER
THREADNAME_INFO info;
-#endif
-
- if (sSetThreadDescription) {
- WCHAR wideName[MAX_PATH];
- if (MultiByteToWideChar(CP_ACP, 0, name, -1, wideName, MAX_PATH)) {
- sSetThreadDescription(GetCurrentThread(), wideName);
- }
- }
-#ifdef _MSC_VER
if (!IsDebuggerPresent())
return;
diff --git a/nsprpub/pr/src/md/windows/win32_errors.c b/nsprpub/pr/src/md/windows/win32_errors.c
index 2757921875..d26820a7a9 100644
--- a/nsprpub/pr/src/md/windows/win32_errors.c
+++ b/nsprpub/pr/src/md/windows/win32_errors.c
@@ -166,26 +166,21 @@ void _MD_win32_map_default_error(PRInt32 err)
prError = PR_ADDRESS_IN_USE_ERROR;
break;
case WSAEADDRNOTAVAIL:
- case ERROR_INVALID_NETNAME:
prError = PR_ADDRESS_NOT_AVAILABLE_ERROR;
break;
case WSAEAFNOSUPPORT:
- case ERROR_INCORRECT_ADDRESS:
prError = PR_ADDRESS_NOT_SUPPORTED_ERROR;
break;
case WSAEALREADY:
- case ERROR_ALREADY_INITIALIZED:
prError = PR_ALREADY_INITIATED_ERROR;
break;
case WSAEBADF:
prError = PR_BAD_DESCRIPTOR_ERROR;
break;
case WSAECONNABORTED:
- case ERROR_CONNECTION_ABORTED:
prError = PR_CONNECT_ABORTED_ERROR;
break;
case WSAECONNREFUSED:
- case ERROR_CONNECTION_REFUSED:
prError = PR_CONNECT_REFUSED_ERROR;
break;
case WSAECONNRESET:
@@ -198,7 +193,6 @@ void _MD_win32_map_default_error(PRInt32 err)
prError = PR_ACCESS_FAULT_ERROR;
break;
case WSAEHOSTUNREACH:
- case ERROR_HOST_UNREACHABLE:
prError = PR_HOST_UNREACHABLE_ERROR;
break;
case WSAEINVAL:
@@ -214,14 +208,12 @@ void _MD_win32_map_default_error(PRInt32 err)
prError = PR_BUFFER_OVERFLOW_ERROR;
break;
case WSAENETDOWN:
- case ERROR_NO_NETWORK:
prError = PR_NETWORK_DOWN_ERROR;
break;
case WSAENETRESET:
prError = PR_CONNECT_ABORTED_ERROR;
break;
case WSAENETUNREACH:
- case ERROR_NETWORK_UNREACHABLE:
prError = PR_NETWORK_UNREACHABLE_ERROR;
break;
case WSAENOBUFS:
diff --git a/nsprpub/pr/src/misc/pratom.c b/nsprpub/pr/src/misc/pratom.c
index 65e6f3cd8a..95bbee1d52 100644
--- a/nsprpub/pr/src/misc/pratom.c
+++ b/nsprpub/pr/src/misc/pratom.c
@@ -23,7 +23,7 @@
#if !defined(_PR_HAVE_ATOMIC_OPS)
-#if defined(_PR_PTHREADS)
+#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
/*
* PR_AtomicDecrement() is used in NSPR's thread-specific data
* destructor. Because thread-specific data destructors may be
@@ -190,7 +190,7 @@ _PR_MD_ATOMIC_SET(PRInt32 *val, PRInt32 newval)
pthread_mutex_unlock(&atomic_locks[idx]);
return rv;
}
-#else /* _PR_PTHREADS */
+#else /* _PR_PTHREADS && !_PR_DCETHREADS */
/*
* We use a single lock for all the emulated atomic operations.
* The lock contention should be acceptable.
@@ -259,7 +259,7 @@ _PR_MD_ATOMIC_SET(PRInt32 *val, PRInt32 newval)
PR_Unlock(atomic_lock);
return rv;
}
-#endif /* _PR_PTHREADS */
+#endif /* _PR_PTHREADS && !_PR_DCETHREADS */
#endif /* !_PR_HAVE_ATOMIC_OPS */
diff --git a/nsprpub/pr/src/pthreads/ptio.c b/nsprpub/pr/src/pthreads/ptio.c
index f6aa567418..9dde031912 100644
--- a/nsprpub/pr/src/pthreads/ptio.c
+++ b/nsprpub/pr/src/pthreads/ptio.c
@@ -1895,6 +1895,19 @@ static PRInt32 pt_Send(
PRInt32 tmp_amount = amount;
#endif
+ /*
+ * Under HP-UX DCE threads, pthread.h includes dce/cma_ux.h,
+ * which has the following:
+ * # define send cma_send
+ * extern int cma_send (int , void *, int, int );
+ * So we need to cast away the 'const' of argument #2 for send().
+ */
+#if defined (HPUX) && defined(_PR_DCETHREADS)
+#define PT_SENDBUF_CAST (void *)
+#else
+#define PT_SENDBUF_CAST
+#endif
+
if (pt_TestAbort()) return bytes;
/*
@@ -1905,9 +1918,9 @@ static PRInt32 pt_Send(
#if defined(SOLARIS)
PR_ASSERT(0 == flags);
retry:
- bytes = write(fd->secret->md.osfd, buf, tmp_amount);
+ bytes = write(fd->secret->md.osfd, PT_SENDBUF_CAST buf, tmp_amount);
#else
- bytes = send(fd->secret->md.osfd, buf, amount, flags);
+ bytes = send(fd->secret->md.osfd, PT_SENDBUF_CAST buf, amount, flags);
#endif
syserrno = errno;
diff --git a/nsprpub/pr/src/pthreads/ptsynch.c b/nsprpub/pr/src/pthreads/ptsynch.c
index a93b74795e..251205336b 100644
--- a/nsprpub/pr/src/pthreads/ptsynch.c
+++ b/nsprpub/pr/src/pthreads/ptsynch.c
@@ -23,6 +23,11 @@ static pthread_condattr_t _pt_cvar_attr;
#if defined(DEBUG)
extern PTDebug pt_debug; /* this is shared between several modules */
+
+#if defined(_PR_DCETHREADS)
+static pthread_t pt_zero_tid; /* a null pthread_t (pthread_t is a struct
+ * in DCE threads) to compare with */
+#endif /* defined(_PR_DCETHREADS) */
#endif /* defined(DEBUG) */
#if defined(FREEBSD)
@@ -258,7 +263,12 @@ static PRIntn pt_TimedWait(
rv = pthread_cond_timedwait(cv, ml, &tmo);
/* NSPR doesn't report timeouts */
+#ifdef _PR_DCETHREADS
+ if (rv == -1) return (errno == EAGAIN) ? 0 : errno;
+ else return rv;
+#else
return (rv == ETIMEDOUT) ? 0 : rv;
+#endif
} /* pt_TimedWait */
@@ -1161,14 +1171,14 @@ PR_IMPLEMENT(PRStatus) PR_DeleteSemaphore(const char *name)
PR_IMPLEMENT(PRStatus) PRP_TryLock(PRLock *lock)
{
PRIntn rv = pthread_mutex_trylock(&lock->mutex);
- if (rv == 0)
+ if (rv == PT_TRYLOCK_SUCCESS)
{
PR_ASSERT(PR_FALSE == lock->locked);
lock->locked = PR_TRUE;
lock->owner = pthread_self();
}
/* XXX set error code? */
- return (0 == rv) ? PR_SUCCESS : PR_FAILURE;
+ return (PT_TRYLOCK_SUCCESS == rv) ? PR_SUCCESS : PR_FAILURE;
} /* PRP_TryLock */
PR_IMPLEMENT(PRCondVar*) PRP_NewNakedCondVar(void)
diff --git a/nsprpub/pr/src/pthreads/ptthread.c b/nsprpub/pr/src/pthreads/ptthread.c
index 6046d5d8d2..9e12606ea3 100644
--- a/nsprpub/pr/src/pthreads/ptthread.c
+++ b/nsprpub/pr/src/pthreads/ptthread.c
@@ -9,7 +9,7 @@
** Exports: ptthread.h
*/
-#if defined(_PR_PTHREADS)
+#if defined(_PR_PTHREADS) || defined(_PR_DCETHREADS)
#include "prlog.h"
#include "primpl.h"
@@ -58,7 +58,7 @@ static struct _PT_Bookeeping
pthread_key_t key; /* thread private data key */
PRBool keyCreated; /* whether 'key' should be deleted */
PRThread *first, *last; /* list of threads we know about */
-#if _POSIX_THREAD_PRIORITY_SCHEDULING > 0
+#if defined(_PR_DCETHREADS) || _POSIX_THREAD_PRIORITY_SCHEDULING > 0
PRInt32 minPrio, maxPrio; /* range of scheduling priorities */
#endif
} pt_book = {0};
@@ -67,7 +67,7 @@ static void _pt_thread_death(void *arg);
static void _pt_thread_death_internal(void *arg, PRBool callDestructors);
static void init_pthread_gc_support(void);
-#if _POSIX_THREAD_PRIORITY_SCHEDULING > 0
+#if defined(_PR_DCETHREADS) || _POSIX_THREAD_PRIORITY_SCHEDULING > 0
static PRIntn pt_PriorityMap(PRThreadPriority pri)
{
#ifdef NTO
@@ -148,6 +148,21 @@ static void *_pt_root(void *arg)
}
#endif
+ /*
+ ** DCE Threads can't detach during creation, so do it late.
+ ** I would like to do it only here, but that doesn't seem
+ ** to work.
+ */
+#if defined(_PR_DCETHREADS)
+ if (detached)
+ {
+ /* pthread_detach() modifies its argument, so we must pass a copy */
+ pthread_t self = id;
+ rv = pthread_detach(&self);
+ PR_ASSERT(0 == rv);
+ }
+#endif /* defined(_PR_DCETHREADS) */
+
/* Set up the thread stack information */
_PR_InitializeStack(thred->stack);
@@ -314,7 +329,7 @@ static PRThread* _PR_CreateThread(
if (EPERM != pt_schedpriv)
{
-#if _POSIX_THREAD_PRIORITY_SCHEDULING > 0
+#if !defined(_PR_DCETHREADS) && _POSIX_THREAD_PRIORITY_SCHEDULING > 0
struct sched_param schedule;
#endif
@@ -325,7 +340,10 @@ static PRThread* _PR_CreateThread(
/* Use the default scheduling policy */
-#if _POSIX_THREAD_PRIORITY_SCHEDULING > 0
+#if defined(_PR_DCETHREADS)
+ rv = pthread_attr_setprio(&tattr, pt_PriorityMap(priority));
+ PR_ASSERT(0 == rv);
+#elif _POSIX_THREAD_PRIORITY_SCHEDULING > 0
rv = pthread_attr_getschedparam(&tattr, &schedule);
PR_ASSERT(0 == rv);
schedule.sched_priority = pt_PriorityMap(priority);
@@ -335,13 +353,19 @@ static PRThread* _PR_CreateThread(
rv = pthread_attr_setschedpolicy(&tattr, SCHED_RR); /* Round Robin */
PR_ASSERT(0 == rv);
#endif
-#endif /* _POSIX_THREAD_PRIORITY_SCHEDULING > 0 */
+#endif /* !defined(_PR_DCETHREADS) */
}
+ /*
+ * DCE threads can't set detach state before creating the thread.
+ * AIX can't set detach late. Why can't we all just get along?
+ */
+#if !defined(_PR_DCETHREADS)
rv = pthread_attr_setdetachstate(&tattr,
((PR_JOINABLE_THREAD == state) ?
PTHREAD_CREATE_JOINABLE : PTHREAD_CREATE_DETACHED));
PR_ASSERT(0 == rv);
+#endif /* !defined(_PR_DCETHREADS) */
/*
* If stackSize is 0, we use the default pthread stack size.
@@ -432,6 +456,7 @@ static PRThread* _PR_CreateThread(
*/
rv = _PT_PTHREAD_CREATE(&id, tattr, _pt_root, thred);
+#if !defined(_PR_DCETHREADS)
if (EPERM == rv)
{
#if defined(IRIX)
@@ -457,10 +482,15 @@ static PRThread* _PR_CreateThread(
#endif /* IRIX */
rv = _PT_PTHREAD_CREATE(&id, tattr, _pt_root, thred);
}
+#endif
if (0 != rv)
{
+#if defined(_PR_DCETHREADS)
+ PRIntn oserr = errno;
+#else
PRIntn oserr = rv;
+#endif
PR_Lock(pt_book.ml);
if (thred->state & PT_THREAD_SYSTEM)
pt_book.system -= 1;
@@ -572,6 +602,10 @@ PR_IMPLEMENT(PRStatus) PR_JoinThread(PRThread *thred)
PR_ASSERT(rv == 0 && result == NULL);
if (0 == rv)
{
+#ifdef _PR_DCETHREADS
+ rv = pthread_detach(&id);
+ PR_ASSERT(0 == rv);
+#endif
/*
* PR_FALSE, because the thread already called the TPD
* destructors before exiting _pt_root.
@@ -659,7 +693,10 @@ PR_IMPLEMENT(void) PR_SetThreadPriority(PRThread *thred, PRThreadPriority newPri
else if ((PRIntn)PR_PRIORITY_LAST < (PRIntn)newPri)
newPri = PR_PRIORITY_LAST;
-#if _POSIX_THREAD_PRIORITY_SCHEDULING > 0
+#if defined(_PR_DCETHREADS)
+ rv = pthread_setprio(thred->id, pt_PriorityMap(newPri));
+ /* pthread_setprio returns the old priority */
+#elif _POSIX_THREAD_PRIORITY_SCHEDULING > 0
if (EPERM != pt_schedpriv)
{
int policy;
@@ -890,7 +927,7 @@ void _PR_InitThreads(
pthread_init();
#endif
-#if _POSIX_THREAD_PRIORITY_SCHEDULING > 0
+#if defined(_PR_DCETHREADS) || _POSIX_THREAD_PRIORITY_SCHEDULING > 0
#if defined(FREEBSD)
{
pthread_attr_t attr;
@@ -1124,7 +1161,11 @@ PR_IMPLEMENT(void) PR_ProcessExit(PRIntn status)
PR_IMPLEMENT(PRUint32) PR_GetThreadID(PRThread *thred)
{
+#if defined(_PR_DCETHREADS)
+ return (PRUint32)&thred->id; /* this is really a sham! */
+#else
return (PRUint32)thred->id; /* and I don't know what they will do with it */
+#endif
}
/*
@@ -1156,6 +1197,18 @@ PR_SetThreadDumpProc(PRThread* thread, PRThreadDumpProc dump, void *arg)
* Garbage collection support follows.
*/
+#if defined(_PR_DCETHREADS)
+
+/*
+ * statics for Garbage Collection support. We don't need to protect these
+ * signal masks since the garbage collector itself is protected by a lock
+ * and multiple threads will not be garbage collecting at the same time.
+ */
+static sigset_t javagc_vtalarm_sigmask;
+static sigset_t javagc_intsoff_sigmask;
+
+#else /* defined(_PR_DCETHREADS) */
+
/* a bogus signal mask for forcing a timed wait */
/* Not so bogus in AIX as we really do a sigwait */
static sigset_t sigwait_set;
@@ -1171,6 +1224,8 @@ static void suspend_signal_handler(PRIntn sig);
static void null_signal_handler(PRIntn sig);
#endif
+#endif /* defined(_PR_DCETHREADS) */
+
/*
* Linux pthreads use SIGUSR1 and SIGUSR2 internally, which
* conflict with the use of these two signals in our GC support.
@@ -1181,6 +1236,12 @@ static void init_pthread_gc_support(void)
#ifndef SYMBIAN
PRIntn rv;
+#if defined(_PR_DCETHREADS)
+ rv = sigemptyset(&javagc_vtalarm_sigmask);
+ PR_ASSERT(0 == rv);
+ rv = sigaddset(&javagc_vtalarm_sigmask, SIGVTALRM);
+ PR_ASSERT(0 == rv);
+#else /* defined(_PR_DCETHREADS) */
{
struct sigaction sigact_usr2;
@@ -1208,6 +1269,7 @@ static void init_pthread_gc_support(void)
PR_ASSERT(0 ==rv);
}
#endif /* defined(PT_NO_SIGTIMEDWAIT) */
+#endif /* defined(_PR_DCETHREADS) */
#endif /* SYMBIAN */
}
@@ -1238,8 +1300,10 @@ PR_IMPLEMENT(PRStatus) PR_EnumerateThreads(PREnumerator func, void *arg)
PRThread* thred = pt_book.first;
#if defined(DEBUG) || defined(FORCE_PR_ASSERT)
+#if !defined(_PR_DCETHREADS)
PRThread *me = PR_GetCurrentThread();
#endif
+#endif
PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, ("Begin PR_EnumerateThreads\n"));
/*
@@ -1267,7 +1331,9 @@ PR_IMPLEMENT(PRStatus) PR_EnumerateThreads(PREnumerator func, void *arg)
if (_PT_IS_GCABLE_THREAD(thred))
{
+#if !defined(_PR_DCETHREADS)
PR_ASSERT((thred == me) || (thred->suspend & PT_THREAD_SUSPENDED));
+#endif
PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS,
("In PR_EnumerateThreads callback thread %p thid = %X\n",
thred, thred->id));
@@ -1295,6 +1361,8 @@ PR_IMPLEMENT(PRStatus) PR_EnumerateThreads(PREnumerator func, void *arg)
* proceed until the thread is suspended or resumed.
*/
+#if !defined(_PR_DCETHREADS)
+
/*
* In the signal handler, we can not use condition variable notify or wait.
* This does not work consistently across all pthread platforms. We also can not
@@ -1593,6 +1661,78 @@ PR_IMPLEMENT(void *)PR_GetSP(PRThread *thred)
return thred->sp;
} /* PR_GetSP */
+#else /* !defined(_PR_DCETHREADS) */
+
+static pthread_once_t pt_gc_support_control = pthread_once_init;
+
+/*
+ * For DCE threads, there is no pthread_kill or a way of suspending or resuming a
+ * particular thread. We will just disable the preemption (virtual timer alarm) and
+ * let the executing thread finish the garbage collection. This stops all other threads
+ * (GC able or not) and is very inefficient but there is no other choice.
+ */
+PR_IMPLEMENT(void) PR_SuspendAll()
+{
+ PRIntn rv;
+
+ rv = pthread_once(&pt_gc_support_control, init_pthread_gc_support);
+ PR_ASSERT(0 == rv); /* returns -1 on failure */
+#ifdef DEBUG
+ suspendAllOn = PR_TRUE;
+#endif
+ PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, ("Begin PR_SuspendAll\n"));
+ /*
+ * turn off preemption - i.e add virtual alarm signal to the set of
+ * blocking signals
+ */
+ rv = sigprocmask(
+ SIG_BLOCK, &javagc_vtalarm_sigmask, &javagc_intsoff_sigmask);
+ PR_ASSERT(0 == rv);
+ suspendAllSuspended = PR_TRUE;
+ PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, ("End PR_SuspendAll\n"));
+} /* PR_SuspendAll */
+
+PR_IMPLEMENT(void) PR_ResumeAll()
+{
+ PRIntn rv;
+
+ suspendAllSuspended = PR_FALSE;
+ PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, ("Begin PR_ResumeAll\n"));
+ /* turn on preemption - i.e re-enable virtual alarm signal */
+
+ rv = sigprocmask(SIG_SETMASK, &javagc_intsoff_sigmask, (sigset_t *)NULL);
+ PR_ASSERT(0 == rv);
+#ifdef DEBUG
+ suspendAllOn = PR_FALSE;
+#endif
+
+ PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, ("End PR_ResumeAll\n"));
+} /* PR_ResumeAll */
+
+/* Return the stack pointer for the given thread- used by the GC */
+PR_IMPLEMENT(void*)PR_GetSP(PRThread *thred)
+{
+ pthread_t tid = thred->id;
+ char *thread_tcb, *top_sp;
+
+ /*
+ * For HPUX DCE threads, pthread_t is a struct with the
+ * following three fields (see pthread.h, dce/cma.h):
+ * cma_t_address field1;
+ * short int field2;
+ * short int field3;
+ * where cma_t_address is typedef'd to be either void*
+ * or char*.
+ */
+ PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, ("Begin PR_GetSP\n"));
+ thread_tcb = (char*)tid.field1;
+ top_sp = *(char**)(thread_tcb + 128);
+ PR_LOG(_pr_gc_lm, PR_LOG_ALWAYS, ("End PR_GetSP %p \n", top_sp));
+ return top_sp;
+} /* PR_GetSP */
+
+#endif /* !defined(_PR_DCETHREADS) */
+
PR_IMPLEMENT(PRStatus) PR_SetCurrentThreadName(const char *name)
{
PRThread *thread;
@@ -1677,6 +1817,6 @@ PR_IMPLEMENT(const char *) PR_GetThreadName(const PRThread *thread)
return thread->name;
}
-#endif /* defined(_PR_PTHREADS) */
+#endif /* defined(_PR_PTHREADS) || defined(_PR_DCETHREADS) */
/* ptthread.c */
diff --git a/nsprpub/pr/src/threads/prrwlock.c b/nsprpub/pr/src/threads/prrwlock.c
index 1dd9e0a900..2e0f9ea4e8 100644
--- a/nsprpub/pr/src/threads/prrwlock.c
+++ b/nsprpub/pr/src/threads/prrwlock.c
@@ -7,7 +7,7 @@
#include <string.h>
-#if defined(HPUX) && defined(_PR_PTHREADS)
+#if defined(HPUX) && defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
#include <pthread.h>
#define HAVE_UNIX98_RWLOCK
diff --git a/nsprpub/pr/tests/Makefile.in b/nsprpub/pr/tests/Makefile.in
index 79a67f09cb..df1f1f2ddc 100644
--- a/nsprpub/pr/tests/Makefile.in
+++ b/nsprpub/pr/tests/Makefile.in
@@ -373,6 +373,9 @@ endif
ifeq (,$(filter-out FreeBSD OpenBSD BSD_OS QNX Darwin OpenUNIX,$(OS_ARCH)))
LIBPTHREAD =
endif
+ifeq ($(OS_ARCH)$(basename $(OS_RELEASE)),HP-UXB.10)
+LIBPTHREAD = -ldce
+endif
endif
ifeq ($(OS_TARGET),Android)
diff --git a/nsprpub/pr/tests/attach.c b/nsprpub/pr/tests/attach.c
index a1493b8ec5..a5daf9d969 100644
--- a/nsprpub/pr/tests/attach.c
+++ b/nsprpub/pr/tests/attach.c
@@ -111,6 +111,16 @@ static int32 threadStartFunc(void *arg)
static void * threadStartFunc(void *arg)
#endif
{
+#ifdef _PR_DCETHREADS
+ {
+ int rv;
+ pthread_t self = pthread_self();
+ rv = pthread_detach(&self);
+ if (debug_mode) PR_ASSERT(0 == rv);
+ else if (0 != rv) failed_already=1;
+ }
+#endif
+
Measure(AttachDetach, "Attach/Detach");
#ifndef IRIX
@@ -196,12 +206,14 @@ int main(int argc, char **argv)
goto exit_now;
}
+#ifndef _PR_DCETHREADS
rv = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
if (debug_mode) PR_ASSERT(0 == rv);
else if (0 != rv) {
failed_already=1;
goto exit_now;
}
+#endif /* !_PR_DCETHREADS */
rv = _PT_PTHREAD_CREATE(&threadID, attr, threadStartFunc, NULL);
if (rv != 0) {
fprintf(stderr, "thread creation failed: error code %d\n", rv);
diff --git a/nsprpub/pr/tests/dceemu.c b/nsprpub/pr/tests/dceemu.c
index 99fd6cb7c1..b06b49e3a7 100644
--- a/nsprpub/pr/tests/dceemu.c
+++ b/nsprpub/pr/tests/dceemu.c
@@ -29,6 +29,8 @@
#include <stdio.h>
#include <stdlib.h>
+#if defined(_PR_DCETHREADS)
+
PRIntn failed_already=0;
PRIntn debug_mode=0;
@@ -78,13 +80,20 @@ static PRIntn prmain(PRIntn argc, char **argv)
} /* prmain */
+#endif /* #if defined(_PR_DCETHREADS) */
+
int main(int argc, char **argv)
{
+
+#if defined(_PR_DCETHREADS)
PR_Initialize(prmain, argc, argv, 0);
if(failed_already)
return 1;
else
return 0;
+#else
+ return 0;
+#endif
} /* main */
diff --git a/nsprpub/pr/tests/foreign.c b/nsprpub/pr/tests/foreign.c
index cfb2e56eff..637f419d11 100644
--- a/nsprpub/pr/tests/foreign.c
+++ b/nsprpub/pr/tests/foreign.c
@@ -52,7 +52,7 @@ static int _debug_on = 0;
#define DPRINTF(arg) if (_debug_on) PR_fprintf arg
-#if defined(_PR_PTHREADS)
+#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
#include <pthread.h>
#include "md/_pth.h"
static void *pthread_start(void *arg)
@@ -63,7 +63,7 @@ static void *pthread_start(void *arg)
start(data);
return NULL;
} /* pthread_start */
-#endif /* defined(_PR_PTHREADS) */
+#endif /* defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) */
#if defined(IRIX) && !defined(_PR_PTHREADS)
#include <sys/types.h>
@@ -109,7 +109,7 @@ static PRStatus NSPRPUB_TESTS_CreateThread(StartFn start, void *arg)
}
break;
case thread_pthread:
-#if defined(_PR_PTHREADS)
+#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
{
int rv;
pthread_t id;
@@ -137,7 +137,7 @@ static PRStatus NSPRPUB_TESTS_CreateThread(StartFn start, void *arg)
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
rv = PR_FAILURE;
break;
-#endif /* defined(_PR_PTHREADS) */
+#endif /* defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) */
case thread_sproc:
#if defined(IRIX) && !defined(_PR_PTHREADS)
diff --git a/nsprpub/pr/tests/forktest.c b/nsprpub/pr/tests/forktest.c
index 66dc64575e..a389fa479c 100644
--- a/nsprpub/pr/tests/forktest.c
+++ b/nsprpub/pr/tests/forktest.c
@@ -196,6 +196,51 @@ finish:
return;
}
+#ifdef _PR_DCETHREADS
+
+#include <syscall.h>
+
+pid_t PR_UnixFork1(void)
+{
+ pid_t parent = getpid();
+ int rv = syscall(SYS_fork);
+
+ if (rv == -1) {
+ return (pid_t) -1;
+ } else {
+ /* For each process, rv is the pid of the other process */
+ if (rv == parent) {
+ /* the child */
+ return 0;
+ } else {
+ /* the parent */
+ return rv;
+ }
+ }
+}
+
+#elif defined(SOLARIS)
+
+/*
+ * It seems like that in Solaris 2.4 one must call fork1() if the
+ * the child process is going to use thread functions. Solaris 2.5
+ * doesn't have this problem. Calling fork() also works.
+ */
+
+pid_t PR_UnixFork1(void)
+{
+ return fork1();
+}
+
+#else
+
+pid_t PR_UnixFork1(void)
+{
+ return fork();
+}
+
+#endif /* PR_DCETHREADS */
+
int main(int argc, char **argv)
{
pid_t pid;
@@ -205,7 +250,7 @@ int main(int argc, char **argv)
DoIO();
- pid = fork();
+ pid = PR_UnixFork1();
if (pid == (pid_t) -1) {
fprintf(stderr, "Fork failed: errno %d\n", errno);
diff --git a/nsprpub/pr/tests/provider.c b/nsprpub/pr/tests/provider.c
index 932241ec3b..0e6569d66b 100644
--- a/nsprpub/pr/tests/provider.c
+++ b/nsprpub/pr/tests/provider.c
@@ -606,7 +606,7 @@ typedef struct StartObject
void *arg;
} StartObject;
-#if defined(_PR_PTHREADS)
+#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
#include "md/_pth.h"
#include <pthread.h>
@@ -619,7 +619,7 @@ static void *pthread_start(void *arg)
start(data);
return NULL;
} /* pthread_start */
-#endif /* defined(_PR_PTHREADS) */
+#endif /* defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) */
#if defined(IRIX) && !defined(_PR_PTHREADS)
#include <sys/types.h>
@@ -657,10 +657,10 @@ static PRStatus JoinThread(PRThread *thread)
rv = PR_JoinThread(thread);
break;
case thread_pthread:
-#if defined(_PR_PTHREADS)
+#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
rv = PR_SUCCESS;
break;
-#endif /* defined(_PR_PTHREADS) */
+#endif /* defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) */
case thread_win32:
#if defined(WIN32)
rv = PR_SUCCESS;
@@ -690,7 +690,7 @@ static PRStatus NewThread(
}
break;
case thread_pthread:
-#if defined(_PR_PTHREADS)
+#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
{
int rv;
pthread_t id;
@@ -717,7 +717,7 @@ static PRStatus NewThread(
#else
PR_SetError(PR_NOT_IMPLEMENTED_ERROR, 0);
rv = PR_FAILURE;
-#endif /* defined(_PR_PTHREADS) */
+#endif /* defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS) */
break;
case thread_sproc:
diff --git a/nsprpub/pr/tests/socket.c b/nsprpub/pr/tests/socket.c
index 92f019d018..5ee2b78f38 100644
--- a/nsprpub/pr/tests/socket.c
+++ b/nsprpub/pr/tests/socket.c
@@ -21,7 +21,7 @@
#ifdef XP_UNIX
#include <sys/mman.h>
#endif
-#if defined(_PR_PTHREADS)
+#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
#include <pthread.h>
#endif
@@ -313,7 +313,7 @@ PRThread* create_new_thread(PRThreadType type,
PRInt32 native_thread = 0;
PR_ASSERT(state == PR_UNJOINABLE_THREAD);
-#if defined(_PR_PTHREADS) || defined(WIN32)
+#if (defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)) || defined(WIN32)
switch(index % 4) {
case 0:
scope = (PR_LOCAL_THREAD);
@@ -332,7 +332,7 @@ PRInt32 native_thread = 0;
break;
}
if (native_thread) {
-#if defined(_PR_PTHREADS)
+#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
pthread_t tid;
if (!pthread_create(&tid, NULL, (void * (*)(void *)) start, arg))
return((PRThread *) tid);
diff --git a/nsprpub/pr/tests/testfile.c b/nsprpub/pr/tests/testfile.c
index 1191bfe944..23659876ef 100644
--- a/nsprpub/pr/tests/testfile.c
+++ b/nsprpub/pr/tests/testfile.c
@@ -13,7 +13,7 @@
#include <windows.h>
#include <process.h>
#endif
-#if defined(_PR_PTHREADS)
+#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
#include <pthread.h>
#endif
#ifdef SYMBIAN
@@ -104,7 +104,7 @@ PRInt32 native_thread = 0;
PR_ASSERT(state == PR_UNJOINABLE_THREAD);
-#if defined(_PR_PTHREADS) || defined(WIN32) || defined(XP_OS2)
+#if (defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)) || defined(WIN32) || defined(XP_OS2)
switch(index % 4) {
case 0:
@@ -124,7 +124,7 @@ PRInt32 native_thread = 0;
break;
}
if (native_thread) {
-#if defined(_PR_PTHREADS)
+#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
pthread_t tid;
if (!pthread_create(&tid, NULL, start, arg))
return((PRThread *) tid);
diff --git a/nsprpub/pr/tests/thrpool_client.c b/nsprpub/pr/tests/thrpool_client.c
index 7f3df32715..a0e1e4c24d 100644
--- a/nsprpub/pr/tests/thrpool_client.c
+++ b/nsprpub/pr/tests/thrpool_client.c
@@ -21,7 +21,7 @@
#ifdef XP_UNIX
#include <sys/mman.h>
#endif
-#if defined(_PR_PTHREADS)
+#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
#include <pthread.h>
#endif
diff --git a/nsprpub/pr/tests/thrpool_server.c b/nsprpub/pr/tests/thrpool_server.c
index ef09f23b51..9665829a1a 100644
--- a/nsprpub/pr/tests/thrpool_server.c
+++ b/nsprpub/pr/tests/thrpool_server.c
@@ -21,7 +21,7 @@
#ifdef XP_UNIX
#include <sys/mman.h>
#endif
-#if defined(_PR_PTHREADS)
+#if defined(_PR_PTHREADS) && !defined(_PR_DCETHREADS)
#include <pthread.h>
#endif
diff --git a/nsprpub/pr/tests/vercheck.c b/nsprpub/pr/tests/vercheck.c
index da2f7b1de6..6170125dea 100644
--- a/nsprpub/pr/tests/vercheck.c
+++ b/nsprpub/pr/tests/vercheck.c
@@ -39,8 +39,7 @@ static char *compatible_version[] = {
"4.9.6",
"4.10", "4.10.1", "4.10.2", "4.10.3", "4.10.4",
"4.10.5", "4.10.6", "4.10.7", "4.10.8", "4.10.9",
- "4.10.10", "4.11", "4.12", "4.13", "4.14", "4.15",
- "4.16", "4.17",
+ "4.10.10", "4.11", "4.12", "4.13", "4.14", "4.15"
PR_VERSION
};
@@ -56,8 +55,8 @@ static char *incompatible_version[] = {
"3.0", "3.0.1",
"3.1", "3.1.1", "3.1.2", "3.1.3",
"3.5", "3.5.1",
- "4.18.1",
- "4.19", "4.19.1",
+ "4.16.1",
+ "4.17", "4.17.1",
"10.0", "11.1", "12.14.20"
};
diff --git a/old-configure.in b/old-configure.in
index 9eb2139882..7d336d37fc 100644
--- a/old-configure.in
+++ b/old-configure.in
@@ -68,7 +68,7 @@ GNOMEUI_VERSION=2.2.0
GCONF_VERSION=1.2.1
STARTUP_NOTIFICATION_VERSION=0.8
DBUS_VERSION=0.60
-SQLITE_VERSION=3.19.3
+SQLITE_VERSION=3.21.0
dnl Set various checks
dnl ========================================================
@@ -936,7 +936,7 @@ case "$target" in
fi
MOZ_GFX_OPTIMIZE_MOBILE=1
- MOZ_OPTIMIZE_FLAGS="-Os"
+ MOZ_OPTIMIZE_FLAGS="-O2"
if test -z "$CLANG_CC"; then
MOZ_OPTIMIZE_FLAGS="-freorder-blocks -fno-reorder-functions $MOZ_OPTIMIZE_FLAGS"
fi
@@ -945,7 +945,7 @@ case "$target" in
*-*linux*)
if test "$GNU_CC" -o "$GNU_CXX"; then
MOZ_PGO_OPTIMIZE_FLAGS="-O3"
- MOZ_OPTIMIZE_FLAGS="-Os"
+ MOZ_OPTIMIZE_FLAGS="-O2"
if test -z "$CLANG_CC"; then
MOZ_OPTIMIZE_FLAGS="-freorder-blocks $MOZ_OPTIMIZE_FLAGS"
fi
@@ -2109,7 +2109,7 @@ MOZ_ARG_WITH_BOOL(system-nss,
_USE_SYSTEM_NSS=1 )
if test -n "$_USE_SYSTEM_NSS"; then
- AM_PATH_NSS(3.35, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
+ AM_PATH_NSS(3.28.6, [MOZ_SYSTEM_NSS=1], [AC_MSG_ERROR([you don't have NSS installed or your version is too old])])
fi
if test -n "$MOZ_SYSTEM_NSS"; then
@@ -2256,10 +2256,11 @@ dnl ========================================================
MOZ_ARG_HEADER(Application)
+ENABLE_TESTS=
ENABLE_SYSTEM_EXTENSION_DIRS=1
MOZ_BRANDING_DIRECTORY=
MOZ_OFFICIAL_BRANDING=
-MC_OFFICIAL=1
+MC_OFFICIAL=
MOZ_FEEDS=1
MOZ_AUTH_EXTENSION=1
if test "$MOZ_IOS"; then
@@ -2271,7 +2272,7 @@ MOZ_TREMOR=
MOZ_SAMPLE_TYPE_FLOAT32=
MOZ_SAMPLE_TYPE_S16=
MOZ_DIRECTSHOW=
-MOZ_WEBRTC=1
+MOZ_WEBRTC=
MOZ_PEERCONNECTION=
MOZ_SRTP=
MOZ_WEBRTC_SIGNALING=
@@ -2312,6 +2313,11 @@ MOZ_BINARY_EXTENSIONS=
MOZ_JETPACK=1
MOZ_DEVTOOLS_SERVER=1
MOZ_DEVTOOLS=
+MOZ_PLACES=1
+MOZ_SOCIAL=1
+MOZ_SERVICES_HEALTHREPORT=1
+MOZ_SERVICES_SYNC=1
+MOZ_SERVICES_CLOUDSYNC=1
case "$target_os" in
mingw*)
@@ -2347,10 +2353,10 @@ AC_SUBST(MOZ_ANDROID_DISTRIBUTION_DIRECTORY)
dnl ========================================================
dnl = Vendor override
dnl ========================================================
-MOZ_ARG_DISABLE_BOOL(official-vendor,
-[ --disable-official-vendor Disable the use of official vendor.],
- MC_OFFICIAL=,
- MC_OFFICIAL=1)
+MOZ_ARG_ENABLE_BOOL(official-vendor,
+[ --enable-official-vendor This is an official release build.],
+ MC_OFFICIAL=1,
+ MC_OFFICIAL=)
dnl ========================================================
@@ -2358,11 +2364,10 @@ dnl = Trademarked Branding
dnl ========================================================
MOZ_ARG_ENABLE_BOOL(official-branding,
[ --enable-official-branding
- Enable Official mozilla.org Branding
+ Enable Official Branding
Do not distribute builds with
--enable-official-branding unless you have
- permission to use trademarks per
- http://www.mozilla.org/foundation/trademarks/ .],
+ permission to use our trademarks!],
MOZ_OFFICIAL_BRANDING=1,
MOZ_OFFICIAL_BRANDING=)
@@ -2407,15 +2412,6 @@ if test -n "$WITH_APP_BASENAME" ; then
MOZ_APP_BASENAME="$WITH_APP_BASENAME"
fi
-# Special cases where we need to AC_DEFINE something. Also a holdover for apps
-# that haven't made a confvars.sh yet. Don't add new stuff here, use
-# MOZ_BUILD_APP.
-case "$MOZ_BUILD_APP" in
-xulrunner)
- AC_DEFINE(MOZ_XULRUNNER)
- ;;
-esac
-
if test -n "$MOZ_B2G"; then
AC_DEFINE(MOZ_B2G)
fi
@@ -2425,7 +2421,6 @@ if test -n "$MOZ_GRAPHENE"; then
AC_DEFINE(MOZ_GRAPHENE)
fi
-AC_SUBST(MOZ_XULRUNNER)
AC_SUBST(MOZ_B2G)
AC_SUBST(MOZ_B2G_VERSION)
@@ -2582,6 +2577,7 @@ if test -n "$MOZ_OFFICIAL_BRANDING"; then
else
MOZ_BRANDING_DIRECTORY=${MOZ_OFFICIAL_BRANDING_DIRECTORY}
AC_DEFINE(MOZ_OFFICIAL_BRANDING)
+dnl Using official branding implies an official release build.
MC_OFFICIAL=1
fi
fi
@@ -3482,68 +3478,6 @@ AC_SUBST(MOZ_GAMEPAD)
AC_SUBST(MOZ_GAMEPAD_BACKEND)
dnl ========================================================
-dnl = Breakpad crash reporting (on by default on supported platforms)
-dnl ========================================================
-
-case $target in
-i?86-*-mingw*|x86_64-*-mingw*)
- MOZ_CRASHREPORTER=1
- ;;
-i?86-apple-darwin*|x86_64-apple-darwin*)
- if test -z "$MOZ_IOS"; then
- MOZ_CRASHREPORTER=1
- fi
- ;;
-i?86-*-linux*|x86_64-*-linux*|arm-*-linux*)
- if test "$MOZ_ENABLE_GTK"; then
- MOZ_CRASHREPORTER=1
- fi
- ;;
-*-android*|*-linuxandroid*)
- MOZ_CRASHREPORTER=1
- ;;
-esac
-
-MOZ_ARG_DISABLE_BOOL(crashreporter,
-[ --disable-crashreporter Disable breakpad crash reporting],
- [MOZ_CRASHREPORTER=],
- [MOZ_CRASHREPORTER=F # Force enable breakpad])
-
-if test "$OS_ARCH" != "$HOST_OS_ARCH" -a "$OS_ARCH" != "WINNT" -a "$OS_ARCH" != "Darwin"; then
- if test "$MOZ_CRASHREPORTER" = F; then
- AC_MSG_ERROR([Cannot --enable-crashreporter, as breakpad tools do not support compiling on $HOST_OS_ARCH while targeting $OS_ARCH.])
- fi
- MOZ_CRASHREPORTER=
-fi
-
-if test -n "$MOZ_CRASHREPORTER"; then
- AC_DEFINE(MOZ_CRASHREPORTER)
-
- if test "$OS_TARGET" = "Linux" && \
- test -z "$SKIP_LIBRARY_CHECKS"; then
- PKG_CHECK_MODULES(MOZ_GTHREAD, gthread-2.0)
- fi
-
- if test "$OS_ARCH" = "WINNT"; then
- if test -z "$HAVE_64BIT_BUILD" -a -n "$COMPILE_ENVIRONMENT"; then
- MOZ_CRASHREPORTER_INJECTOR=1
- AC_DEFINE(MOZ_CRASHREPORTER_INJECTOR)
- fi
- fi
-fi
-
-MOZ_ARG_WITH_STRING(crashreporter-enable-percent,
-[ --with-crashreporter-enable-percent=NN
- Enable sending crash reports by default on NN% of users. (default=100)],
-[ val=`echo $withval | sed 's/[^0-9]//g'`
- MOZ_CRASHREPORTER_ENABLE_PERCENT="$val"])
-
-if test -z "$MOZ_CRASHREPORTER_ENABLE_PERCENT"; then
- MOZ_CRASHREPORTER_ENABLE_PERCENT=100
-fi
-AC_DEFINE_UNQUOTED(MOZ_CRASHREPORTER_ENABLE_PERCENT, $MOZ_CRASHREPORTER_ENABLE_PERCENT)
-
-dnl ========================================================
dnl = libjpeg-turbo configuration
dnl ========================================================
MOZ_LIBJPEG_TURBO=
@@ -3861,6 +3795,32 @@ if test -n "$MOZ_UPDATER"; then
fi
dnl ========================================================
+dnl Build the tests?
+dnl ========================================================
+MOZ_ARG_ENABLE_BOOL(tests,
+[ --enable-tests Build test libraries & programs],
+ ENABLE_TESTS=1,
+ ENABLE_TESTS= )
+
+if test -n "$ENABLE_TESTS"; then
+ GTEST_HAS_RTTI=0
+ AC_DEFINE(ENABLE_TESTS)
+ AC_DEFINE_UNQUOTED(GTEST_HAS_RTTI, 0)
+ AC_SUBST(GTEST_HAS_RTTI)
+ if test -n "$_WIN32_MSVC"; then
+ AC_DEFINE_UNQUOTED(_VARIADIC_MAX, 10)
+ fi
+ if test "${OS_TARGET}" = "Android"; then
+ AC_DEFINE(GTEST_OS_LINUX_ANDROID)
+ AC_DEFINE(GTEST_USE_OWN_TR1_TUPLE)
+ AC_DEFINE_UNQUOTED(GTEST_HAS_CLONE, 0)
+ AC_SUBST(GTEST_OS_LINUX_ANDROID)
+ AC_SUBST(GTEST_USE_OWN_TR1_TUPLE)
+ AC_SUBST(GTEST_HAS_CLONE)
+ fi
+fi
+
+dnl ========================================================
dnl parental controls (for Windows Vista)
dnl ========================================================
MOZ_ARG_DISABLE_BOOL(parental-controls,
@@ -4329,8 +4289,6 @@ Android|WINNT|Darwin)
esac
if test -n "$MOZ_REPLACE_MALLOC"; then
- MOZ_SYSTEM_JEMALLOC=
-
dnl Replace-malloc Mac linkage quirks
if test -n "$MACOSX_DEPLOYMENT_TARGET"; then
AC_CACHE_CHECK([how to do weak dynamic linking],
@@ -4397,15 +4355,6 @@ if test -z "$MOZ_MEMORY"; then
;;
esac
else
- if test -n "$MOZ_JEMALLOC4" -a -z "$MOZ_REPLACE_MALLOC"; then
- MOZ_SYSTEM_JEMALLOC=1
- AC_CHECK_FUNCS(mallctl nallocx,,
- [MOZ_SYSTEM_JEMALLOC=
- break])
- if test -n "$MOZ_SYSTEM_JEMALLOC"; then
- AC_DEFINE(MOZ_SYSTEM_JEMALLOC)
- fi
- fi
if test "x$MOZ_DEBUG" = "x1"; then
AC_DEFINE(MOZ_MEMORY_DEBUG)
fi
@@ -4418,7 +4367,6 @@ else
;;
esac
fi # MOZ_MEMORY
-AC_SUBST(MOZ_SYSTEM_JEMALLOC)
AC_SUBST(MOZ_GLUE_IN_PROGRAM)
# Allow the application to provide a subconfigure script.
@@ -5254,6 +5202,43 @@ if test "$ENABLE_MARIONETTE"; then
fi
dnl ========================================================
+dnl =
+dnl = Miscellaneous (former toolkit/moz.configure)
+dnl =
+dnl ========================================================
+
+dnl Build Places if required
+AC_SUBST(MOZ_PLACES)
+if test "$MOZ_PLACES"; then
+ AC_DEFINE(MOZ_PLACES)
+fi
+
+dnl Build SocialAPI if required
+AC_SUBST(MOZ_SOCIAL)
+if test "$MOZ_SOCIAL"; then
+ AC_DEFINE(MOZ_SOCIAL)
+fi
+
+dnl Build Firefox Health Reporter Service
+AC_SUBST(MOZ_SERVICES_HEALTHREPORT)
+if test -n "$MOZ_SERVICES_HEALTHREPORT"; then
+ AC_DEFINE(MOZ_SERVICES_HEALTHREPORT)
+fi
+
+dnl Build Sync Services if required
+AC_SUBST(MOZ_SERVICES_SYNC)
+if test -n "$MOZ_SERVICES_SYNC"; then
+ AC_DEFINE(MOZ_SERVICES_SYNC)
+fi
+
+dnl Build Services/CloudSync if required
+AC_SUBST(MOZ_SERVICES_CLOUDSYNC)
+if test -n "$MOZ_SERVICES_CLOUDSYNC"; then
+ AC_DEFINE(MOZ_SERVICES_CLOUDSYNC)
+fi
+
+
+dnl ========================================================
if test "$MOZ_DEBUG" -o "$MOZ_DMD"; then
MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS=
fi
@@ -5287,12 +5272,12 @@ AC_SUBST(LIBICONV)
AC_SUBST(MOZ_TOOLKIT_SEARCH)
AC_SUBST(MOZ_FEEDS)
+AC_SUBST(ENABLE_TESTS)
+
AC_SUBST(MOZ_UNIVERSALCHARDET)
AC_SUBST(ACCESSIBILITY)
AC_SUBST(MOZ_SPELLCHECK)
AC_SUBST(MOZ_ANDROID_ANR_REPORTER)
-AC_SUBST(MOZ_CRASHREPORTER)
-AC_SUBST(MOZ_CRASHREPORTER_INJECTOR)
AC_SUBST(MOZ_MAINTENANCE_SERVICE)
AC_SUBST(MOZ_VERIFY_MAR_SIGNATURE)
AC_SUBST(MOZ_ENABLE_SIGNMAR)
@@ -5503,7 +5488,7 @@ AC_SUBST(MOZ_SIMPLE_PACKAGE_NAME)
AC_SUBST(MOZILLA_OFFICIAL)
if test "$MOZILLA_OFFICIAL"; then
AC_DEFINE(MOZILLA_OFFICIAL)
- # Build revisions should always be present in official builds
+ # Build revisions should always be present in official Mozilla builds
MOZ_INCLUDE_SOURCE_INFO=1
fi
@@ -5525,7 +5510,7 @@ fi
dnl If we have any service that uploads data (and requires data submission
dnl policy alert), set MOZ_DATA_REPORTING.
dnl We need SUBST for build system and DEFINE for xul preprocessor.
-if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" || test -n "$MOZ_CRASHREPORTER"; then
+if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT"; then
MOZ_DATA_REPORTING=1
AC_DEFINE(MOZ_DATA_REPORTING)
AC_SUBST(MOZ_DATA_REPORTING)
@@ -5778,6 +5763,7 @@ MOZ_BRANDING_DIRECTORY=$MOZ_BRANDING_DIRECTORY
MC_BASILISK=$MC_BASILISK
MC_PALEMOON=$MC_PALEMOON
MOZ_SANDBOX=$MOZ_SANDBOX
+MOZ_EME=$MOZ_EME
MOZ_WEBRTC=$MOZ_WEBRTC
MOZ_SYSTEM_LIBEVENT=$MOZ_SYSTEM_LIBEVENT
MOZ_SYSTEM_NSS=$MOZ_SYSTEM_NSS
@@ -5863,10 +5849,6 @@ AC_SUBST(NSS_DISABLE_LIBPKIX)
MOZ_CREATE_CONFIG_STATUS()
-if test "$COMPILE_ENVIRONMENT"; then
- MOZ_SUBCONFIGURE_JEMALLOC()
-fi
-
# Run freetype configure script
if test "$MOZ_TREE_FREETYPE"; then
diff --git a/python/mozbuild/mozbuild/mach_commands.py b/python/mozbuild/mozbuild/mach_commands.py
index ae71d08687..f654db7697 100644
--- a/python/mozbuild/mozbuild/mach_commands.py
+++ b/python/mozbuild/mozbuild/mach_commands.py
@@ -536,10 +536,6 @@ class Build(MachCommandBase):
# arguably make the build action useful for Fennec. Another day...
if self.substs['MOZ_BUILD_APP'] != 'mobile/android':
print('To take your build for a test drive, run: |mach run|')
- app = self.substs['MOZ_BUILD_APP']
- if app in ('browser', 'mobile/android'):
- print('For more information on what to do now, see '
- 'https://developer.mozilla.org/docs/Developer_Guide/So_You_Just_Built_Firefox')
except Exception:
# Ignore Exceptions in case we can't find config.status (such
# as when doing OSX Universal builds)
diff --git a/python/mozbuild/mozbuild/mozinfo.py b/python/mozbuild/mozbuild/mozinfo.py
index 2c08c4e9f0..3e1d0a7607 100755
--- a/python/mozbuild/mozbuild/mozinfo.py
+++ b/python/mozbuild/mozbuild/mozinfo.py
@@ -80,7 +80,6 @@ def build_dict(config, env=os.environ):
d['nightly_build'] = substs.get('NIGHTLY_BUILD') == '1'
d['release_or_beta'] = substs.get('RELEASE_OR_BETA') == '1'
d['pgo'] = substs.get('MOZ_PGO') == '1'
- d['crashreporter'] = bool(substs.get('MOZ_CRASHREPORTER'))
d['datareporting'] = bool(substs.get('MOZ_DATA_REPORTING'))
d['healthreport'] = substs.get('MOZ_SERVICES_HEALTHREPORT') == '1'
d['sync'] = substs.get('MOZ_SERVICES_SYNC') == '1'
@@ -91,7 +90,7 @@ def build_dict(config, env=os.environ):
d['bin_suffix'] = substs.get('BIN_SUFFIX', '')
d['addon_signing'] = substs.get('MOZ_ADDON_SIGNING') == '1'
d['require_signing'] = substs.get('MOZ_REQUIRE_SIGNING') == '1'
- d['official'] = bool(substs.get('MOZILLA_OFFICIAL'))
+ d['official'] = bool(substs.get('MC_OFFICIAL'))
d['sm_promise'] = bool(substs.get('SPIDERMONKEY_PROMISE'))
def guess_platform():
diff --git a/python/mozbuild/mozbuild/test/test_mozinfo.py b/python/mozbuild/mozbuild/test/test_mozinfo.py
index 1a4194cb50..6d0909b2d2 100755
--- a/python/mozbuild/mozbuild/test/test_mozinfo.py
+++ b/python/mozbuild/mozbuild/test/test_mozinfo.py
@@ -215,7 +215,6 @@ class TestBuildDict(unittest.TestCase, Base):
OS_TARGET='Linux',
TARGET_CPU='i386',
MOZ_WIDGET_TOOLKIT='gtk2',
- MOZ_CRASHREPORTER='1',
)))
self.assertEqual(True, d['crashreporter'])
diff --git a/security/certverifier/CertVerifier.cpp b/security/certverifier/CertVerifier.cpp
index 61d8fcdb85..2957a269f6 100644
--- a/security/certverifier/CertVerifier.cpp
+++ b/security/certverifier/CertVerifier.cpp
@@ -224,8 +224,7 @@ CertVerifier::VerifySignedCertificateTimestamps(
CERTCertListNode* issuerNode = CERT_LIST_NEXT(endEntityNode);
if (!issuerNode || CERT_LIST_END(issuerNode, builtChain)) {
// Issuer certificate is required for SCT verification.
- // TODO(bug 1294580): change this to Result::FATAL_ERROR_INVALID_ARGS
- return Success;
+ return Result::FATAL_ERROR_INVALID_ARGS;
}
CERTCertificate* endEntity = endEntityNode->cert;
diff --git a/security/certverifier/NSSCertDBTrustDomain.cpp b/security/certverifier/NSSCertDBTrustDomain.cpp
index 412adb4034..b4e12fe9c4 100644
--- a/security/certverifier/NSSCertDBTrustDomain.cpp
+++ b/security/certverifier/NSSCertDBTrustDomain.cpp
@@ -242,10 +242,14 @@ NSSCertDBTrustDomain::GetCertTrust(EndEntityOrCA endEntityOrCA,
return Success;
}
- // For TRUST, we only use the CERTDB_TRUSTED_CA bit, because Gecko hasn't
+ // For TRUST, we only use the CERTDB_TRUSTED_CA bit, because Goanna hasn't
// needed to consider end-entity certs to be their own trust anchors since
- // Gecko implemented nsICertOverrideService.
- if (flags & CERTDB_TRUSTED_CA) {
+ // Goanna implemented nsICertOverrideService.
+ // Of course, for this to work as expected, we need to make sure we're
+ // inquiring about the trust of a CA and not an end-entity. If an end-entity
+ // has the CERTDB_TRUSTED_CA bit set, Gecko does not consider it to be a
+ // trust anchor; it must inherit its trust.
+ if (flags & CERTDB_TRUSTED_CA && endEntityOrCA == EndEntityOrCA::MustBeCA) {
if (policy.IsAnyPolicy()) {
trustLevel = TrustLevel::TrustAnchor;
return Success;
diff --git a/security/manager/ssl/tests/unit/test_cert_trust.js b/security/manager/ssl/tests/unit/test_cert_trust.js
index 622678c7a6..bf081f1bde 100644
--- a/security/manager/ssl/tests/unit/test_cert_trust.js
+++ b/security/manager/ssl/tests/unit/test_cert_trust.js
@@ -208,9 +208,31 @@ function run_test() {
setCertTrust(ca_cert, ",,");
setCertTrust(int_cert, ",,");
- // It turns out that if an end-entity certificate is manually trusted, it can
- // be the root of its own verified chain. This will be removed in bug 1294580.
- setCertTrust(ee_cert, "C,,");
+ // If an end-entity certificate is manually trusted, it may not be the root of
+ // its own verified chain. In general this will cause "unknown issuer" errors
+ // unless a CA trust anchor can be found.
+ setCertTrust(ee_cert, "CTu,CTu,CTu");
+ checkCertErrorGeneric(certdb, ee_cert, SEC_ERROR_UNKNOWN_ISSUER,
+ certificateUsageSSLServer);
+ checkCertErrorGeneric(certdb, ee_cert, SEC_ERROR_UNKNOWN_ISSUER,
+ certificateUsageSSLClient);
+ checkCertErrorGeneric(certdb, ee_cert, SEC_ERROR_UNKNOWN_ISSUER,
+ certificateUsageEmailSigner);
+ checkCertErrorGeneric(certdb, ee_cert, SEC_ERROR_UNKNOWN_ISSUER,
+ certificateUsageEmailRecipient);
+ checkCertErrorGeneric(certdb, ee_cert, SEC_ERROR_UNKNOWN_ISSUER,
+ certificateUsageObjectSigner);
+
+ // Now make a CA trust anchor available.
+ setCertTrust(ca_cert, "CTu,CTu,CTu");
checkCertErrorGeneric(certdb, ee_cert, PRErrorCodeSuccess,
certificateUsageSSLServer);
+ checkCertErrorGeneric(certdb, ee_cert, PRErrorCodeSuccess,
+ certificateUsageSSLClient);
+ checkCertErrorGeneric(certdb, ee_cert, PRErrorCodeSuccess,
+ certificateUsageEmailSigner);
+ checkCertErrorGeneric(certdb, ee_cert, PRErrorCodeSuccess,
+ certificateUsageEmailRecipient);
+ checkCertErrorGeneric(certdb, ee_cert, PRErrorCodeSuccess,
+ certificateUsageObjectSigner);
}
diff --git a/security/nss/.taskcluster.yml b/security/nss/.taskcluster.yml
index 494d31a7b0..9d56c9bcd2 100644
--- a/security/nss/.taskcluster.yml
+++ b/security/nss/.taskcluster.yml
@@ -57,7 +57,7 @@ tasks:
- "tc-treeherder.v2.{{project}}.{{revision}}.{{pushlog_id}}"
payload:
- image: nssdev/nss-decision:0.0.2
+ image: ttaubert/nss-decision:0.0.2
env:
TC_OWNER: {{owner}}
diff --git a/security/nss/TAG-INFO b/security/nss/TAG-INFO
new file mode 100644
index 0000000000..2ff04f9900
--- /dev/null
+++ b/security/nss/TAG-INFO
@@ -0,0 +1 @@
+NSS_3_32_1_RTM
diff --git a/security/nss/automation/abi-check/expected-report-libnspr4.so.txt b/security/nss/automation/abi-check/expected-report-libnspr4.so.txt
index 44f52325f5..e69de29bb2 100644
--- a/security/nss/automation/abi-check/expected-report-libnspr4.so.txt
+++ b/security/nss/automation/abi-check/expected-report-libnspr4.so.txt
@@ -1,8 +0,0 @@
-Functions changes summary: 1 Removed, 0 Changed, 0 Added function
-Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
-
-1 Removed function:
-
- 'function void PR_EXPERIMENTAL_ONLY_IN_4_17_GetOverlappedIOHandle(void**)' {PR_EXPERIMENTAL_ONLY_IN_4_17_GetOverlappedIOHandle}
-
-
diff --git a/security/nss/automation/abi-check/expected-report-libssl3.so.txt b/security/nss/automation/abi-check/expected-report-libssl3.so.txt
index 2a093094fc..e69de29bb2 100644
--- a/security/nss/automation/abi-check/expected-report-libssl3.so.txt
+++ b/security/nss/automation/abi-check/expected-report-libssl3.so.txt
@@ -1,3 +0,0 @@
-Functions changes summary: 0 Removed, 0 Changed (5 filtered out), 0 Added function
-Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
-
diff --git a/security/nss/automation/abi-check/previous-nss-release b/security/nss/automation/abi-check/previous-nss-release
index a91a569f53..b8d28cde03 100644
--- a/security/nss/automation/abi-check/previous-nss-release
+++ b/security/nss/automation/abi-check/previous-nss-release
@@ -1 +1 @@
-NSS_3_34_BRANCH
+NSS_3_31_BRANCH
diff --git a/security/nss/automation/buildbot-slave/build.sh b/security/nss/automation/buildbot-slave/build.sh
index 844254dae0..3fc914803f 100755
--- a/security/nss/automation/buildbot-slave/build.sh
+++ b/security/nss/automation/buildbot-slave/build.sh
@@ -236,14 +236,11 @@ check_abi()
BASE_NSPR=NSPR_$(head -1 ${HGDIR}/baseline/nss/automation/release/nspr-version.txt | cut -d . -f 1-2 | tr . _)_BRANCH
hg clone -u "${BASE_NSPR}" "${HGDIR}/nspr" "${HGDIR}/baseline/nspr"
if [ $? -ne 0 ]; then
- echo "nonexisting tag ${BASE_NSPR} derived from ${BASE_NSS} automation/release/nspr-version.txt"
- # Assume that version hasn't been released yet, fall back to trunk
- pushd "${HGDIR}/baseline/nspr"
- hg update default
- popd
+ echo "invalid tag ${BASE_NSPR} derived from ${BASE_NSS} automation/release/nspr-version.txt"
+ return 1
fi
- print_log "######## building baseline NSPR/NSS ########"
+ print_log "######## building older NSPR/NSS ########"
pushd ${HGDIR}/baseline/nss
print_log "$ ${MAKE} ${NSS_BUILD_TARGET}"
@@ -256,44 +253,26 @@ check_abi()
fi
popd
- ABI_PROBLEM_FOUND=0
ABI_REPORT=${OUTPUTDIR}/abi-diff.txt
rm -f ${ABI_REPORT}
PREVDIST=${HGDIR}/baseline/dist
NEWDIST=${HGDIR}/dist
ALL_SOs="libfreebl3.so libfreeblpriv3.so libnspr4.so libnss3.so libnssckbi.so libnssdbm3.so libnsssysinit.so libnssutil3.so libplc4.so libplds4.so libsmime3.so libsoftokn3.so libssl3.so"
for SO in ${ALL_SOs}; do
- if [ ! -f ${HGDIR}/nss/automation/abi-check/expected-report-$SO.txt ]; then
- touch ${HGDIR}/nss/automation/abi-check/expected-report-$SO.txt
+ if [ ! -f nss/automation/abi-check/expected-report-$SO.txt ]; then
+ touch nss/automation/abi-check/expected-report-$SO.txt
fi
abidiff --hd1 $PREVDIST/public/ --hd2 $NEWDIST/public \
$PREVDIST/*/lib/$SO $NEWDIST/*/lib/$SO \
- > ${HGDIR}/nss/automation/abi-check/new-report-$SO.txt
- if [ $? -ne 0 ]; then
- ABI_PROBLEM_FOUND=1
- print_log "FAILED to run abidiff {$PREVDIST , $NEWDIST} for $SO, or failed writing to ${HGDIR}/nss/automation/abi-check/new-report-$SO.txt"
- fi
- if [ ! -f ${HGDIR}/nss/automation/abi-check/expected-report-$SO.txt ]; then
- ABI_PROBLEM_FOUND=1
- print_log "FAILED to access report file: ${HGDIR}/nss/automation/abi-check/expected-report-$SO.txt"
- fi
-
- diff -wB -u ${HGDIR}/nss/automation/abi-check/expected-report-$SO.txt \
- ${HGDIR}/nss/automation/abi-check/new-report-$SO.txt >> ${ABI_REPORT}
- if [ ! -f ${ABI_REPORT} ]; then
- ABI_PROBLEM_FOUND=1
- print_log "FAILED to compare exepcted and new report: ${HGDIR}/nss/automation/abi-check/new-report-$SO.txt"
- fi
+ > nss/automation/abi-check/new-report-$SO.txt
+ diff -u nss/automation/abi-check/expected-report-$SO.txt \
+ nss/automation/abi-check/new-report-$SO.txt >> ${ABI_REPORT}
done
if [ -s ${ABI_REPORT} ]; then
print_log "FAILED: there are new unexpected ABI changes"
cat ${ABI_REPORT}
return 1
- elif [ $ABI_PROBLEM_FOUND -ne 0 ]; then
- print_log "FAILED: failure executing the ABI checks"
- cat ${ABI_REPORT}
- return 1
fi
return 0
diff --git a/security/nss/automation/clang-format/run_clang_format.sh b/security/nss/automation/clang-format/run_clang_format.sh
index 378b00ff09..2ba5ebeb1a 100644
--- a/security/nss/automation/clang-format/run_clang_format.sh
+++ b/security/nss/automation/clang-format/run_clang_format.sh
@@ -6,8 +6,6 @@ if [[ $(id -u) -eq 0 ]]; then
exec su worker -c "$0 $*"
fi
-set -e
-
# Apply clang-format on the provided folder and verify that this doesn't change any file.
# If any file differs after formatting, the script eventually exits with 1.
# Any differences between formatted and unformatted files is printed to stdout to give a hint what's wrong.
@@ -23,16 +21,17 @@ blacklist=(
"./lib/zlib" \
"./lib/sqlite" \
"./gtests/google_test" \
+ "./.hg" \
"./out" \
)
-top=$(cd "$(dirname $0)/../.."; pwd -P)
+top="$(dirname $0)/../.."
+cd "$top"
if [ $# -gt 0 ]; then
dirs=("$@")
else
- cd "$top"
- dirs=($(find . -maxdepth 2 -mindepth 1 -type d ! -path '*/.*' -print))
+ dirs=($(find . -maxdepth 2 -mindepth 1 -type d ! -path . \( ! -regex '.*/' \)))
fi
format_folder()
@@ -47,20 +46,20 @@ format_folder()
}
for dir in "${dirs[@]}"; do
- if format_folder "$dir"; then
+ if format_folder "$dir" ; then
c="${dir//[^\/]}"
echo "formatting $dir ..."
- depth=()
+ depth=""
if [ "${#c}" == "1" ]; then
- depth+=(-maxdepth 1)
+ depth="-maxdepth 1"
fi
- find "$dir" "${depth[@]}" -type f \( -name '*.[ch]' -o -name '*.cc' \) -exec clang-format -i {} \+
+ find "$dir" $depth -type f \( -name '*.[ch]' -o -name '*.cc' \) -exec clang-format -i {} \+
fi
done
TMPFILE=$(mktemp /tmp/$(basename $0).XXXXXX)
-trap 'rm -f $TMPFILE' exit
-if [[ -d "$top/.hg" ]]; then
+trap 'rm $TMPFILE' exit
+if (cd $(dirname $0); hg root >/dev/null 2>&1); then
hg diff --git "$top" | tee $TMPFILE
else
git -C "$top" diff | tee $TMPFILE
diff --git a/security/nss/automation/clang-format/setup.sh b/security/nss/automation/clang-format/setup.sh
index beac9e9051..9b2480e902 100644
--- a/security/nss/automation/clang-format/setup.sh
+++ b/security/nss/automation/clang-format/setup.sh
@@ -17,8 +17,8 @@ apt_packages+=('locales')
apt-get install -y --no-install-recommends ${apt_packages[@]}
# Download clang.
-curl -L https://releases.llvm.org/3.9.1/clang+llvm-3.9.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz -o clang.tar.xz
-curl -L https://releases.llvm.org/3.9.1/clang+llvm-3.9.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz.sig -o clang.tar.xz.sig
+curl -L http://releases.llvm.org/3.9.1/clang+llvm-3.9.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz -o clang.tar.xz
+curl -L http://releases.llvm.org/3.9.1/clang+llvm-3.9.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz.sig -o clang.tar.xz.sig
# Verify the signature.
gpg --keyserver pool.sks-keyservers.net --recv-keys B6C8F98282B944E3B0D5C2530FC3042E345AD05D
gpg --verify clang.tar.xz.sig
diff --git a/security/nss/automation/release/nspr-version.txt b/security/nss/automation/release/nspr-version.txt
index 01eeb3615f..98783a6152 100644
--- a/security/nss/automation/release/nspr-version.txt
+++ b/security/nss/automation/release/nspr-version.txt
@@ -1,4 +1,4 @@
-4.18
+4.16
# The first line of this file must contain the human readable NSPR
# version number, which is the minimum required version of NSPR
diff --git a/security/nss/automation/taskcluster/docker-clang-3.9/setup.sh b/security/nss/automation/taskcluster/docker-clang-3.9/setup.sh
index 3076667a6e..7b7d534e66 100644
--- a/security/nss/automation/taskcluster/docker-clang-3.9/setup.sh
+++ b/security/nss/automation/taskcluster/docker-clang-3.9/setup.sh
@@ -25,8 +25,8 @@ apt-get -y update
apt-get install -y --no-install-recommends ${apt_packages[@]}
# Download clang.
-curl -LO https://releases.llvm.org/3.9.1/clang+llvm-3.9.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz
-curl -LO https://releases.llvm.org/3.9.1/clang+llvm-3.9.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz.sig
+curl -LO http://releases.llvm.org/3.9.1/clang+llvm-3.9.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz
+curl -LO http://releases.llvm.org/3.9.1/clang+llvm-3.9.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz.sig
# Verify the signature.
gpg --keyserver pool.sks-keyservers.net --recv-keys B6C8F98282B944E3B0D5C2530FC3042E345AD05D
gpg --verify *.tar.xz.sig
diff --git a/security/nss/automation/taskcluster/docker-decision/Dockerfile b/security/nss/automation/taskcluster/docker-decision/Dockerfile
index 473ce64ba3..35777c0b7c 100644
--- a/security/nss/automation/taskcluster/docker-decision/Dockerfile
+++ b/security/nss/automation/taskcluster/docker-decision/Dockerfile
@@ -12,9 +12,6 @@ RUN chmod +x /home/worker/bin/*
ADD setup.sh /tmp/setup.sh
RUN bash /tmp/setup.sh
-# Change user.
-USER worker
-
# Env variables.
ENV HOME /home/worker
ENV SHELL /bin/bash
diff --git a/security/nss/automation/taskcluster/docker-decision/bin/checkout.sh b/security/nss/automation/taskcluster/docker-decision/bin/checkout.sh
index 0cdd2ac405..9167f6bda6 100644
--- a/security/nss/automation/taskcluster/docker-decision/bin/checkout.sh
+++ b/security/nss/automation/taskcluster/docker-decision/bin/checkout.sh
@@ -2,6 +2,11 @@
set -v -e -x
+if [ $(id -u) = 0 ]; then
+ # Drop privileges by re-running this script.
+ exec su worker $0
+fi
+
# Default values for testing.
REVISION=${NSS_HEAD_REVISION:-default}
REPOSITORY=${NSS_HEAD_REPOSITORY:-https://hg.mozilla.org/projects/nss}
diff --git a/security/nss/automation/taskcluster/docker-gcc-4.4/Dockerfile b/security/nss/automation/taskcluster/docker-gcc-4.4/Dockerfile
deleted file mode 100644
index 3330c007fe..0000000000
--- a/security/nss/automation/taskcluster/docker-gcc-4.4/Dockerfile
+++ /dev/null
@@ -1,30 +0,0 @@
-FROM ubuntu:14.04
-MAINTAINER Tim Taubert <ttaubert@mozilla.com>
-
-RUN useradd -d /home/worker -s /bin/bash -m worker
-WORKDIR /home/worker
-
-# Add build and test scripts.
-ADD bin /home/worker/bin
-RUN chmod +x /home/worker/bin/*
-
-# Install dependencies.
-ADD setup.sh /tmp/setup.sh
-RUN bash /tmp/setup.sh
-
-# Change user.
-USER worker
-
-# Env variables.
-ENV HOME /home/worker
-ENV SHELL /bin/bash
-ENV USER worker
-ENV LOGNAME worker
-ENV HOSTNAME taskcluster-worker
-ENV LANG en_US.UTF-8
-ENV LC_ALL en_US.UTF-8
-ENV HOST localhost
-ENV DOMSUF localdomain
-
-# Set a default command for debugging.
-CMD ["/bin/bash", "--login"]
diff --git a/security/nss/automation/taskcluster/docker-gcc-4.4/bin/checkout.sh b/security/nss/automation/taskcluster/docker-gcc-4.4/bin/checkout.sh
deleted file mode 100644
index 9167f6bda6..0000000000
--- a/security/nss/automation/taskcluster/docker-gcc-4.4/bin/checkout.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/env bash
-
-set -v -e -x
-
-if [ $(id -u) = 0 ]; then
- # Drop privileges by re-running this script.
- exec su worker $0
-fi
-
-# Default values for testing.
-REVISION=${NSS_HEAD_REVISION:-default}
-REPOSITORY=${NSS_HEAD_REPOSITORY:-https://hg.mozilla.org/projects/nss}
-
-# Clone NSS.
-for i in 0 2 5; do
- sleep $i
- hg clone -r $REVISION $REPOSITORY nss && exit 0
- rm -rf nss
-done
-exit 1
diff --git a/security/nss/automation/taskcluster/docker-gcc-4.4/setup.sh b/security/nss/automation/taskcluster/docker-gcc-4.4/setup.sh
deleted file mode 100644
index f6325d966c..0000000000
--- a/security/nss/automation/taskcluster/docker-gcc-4.4/setup.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env bash
-
-set -v -e -x
-
-# Update packages.
-export DEBIAN_FRONTEND=noninteractive
-apt-get -y update && apt-get -y upgrade
-
-apt_packages=()
-apt_packages+=('ca-certificates')
-apt_packages+=('g++-4.4')
-apt_packages+=('gcc-4.4')
-apt_packages+=('locales')
-apt_packages+=('make')
-apt_packages+=('mercurial')
-apt_packages+=('zlib1g-dev')
-
-# Install packages.
-apt-get -y update
-apt-get install -y --no-install-recommends ${apt_packages[@]}
-
-locale-gen en_US.UTF-8
-dpkg-reconfigure locales
-
-# Cleanup.
-rm -rf ~/.ccache ~/.cache
-apt-get autoremove -y
-apt-get clean
-apt-get autoclean
-rm $0
diff --git a/security/nss/automation/taskcluster/docker-hacl/Dockerfile b/security/nss/automation/taskcluster/docker-hacl/Dockerfile
deleted file mode 100644
index e8a88f06c7..0000000000
--- a/security/nss/automation/taskcluster/docker-hacl/Dockerfile
+++ /dev/null
@@ -1,30 +0,0 @@
-FROM ubuntu:xenial
-
-MAINTAINER Franziskus Kiefer <franziskuskiefer@gmail.com>
-# Based on the HACL* image from Benjamin Beurdouche and
-# the original F* formula with Daniel Fabian
-
-# Pinned versions of HACL* (F* and KreMLin are pinned as submodules)
-ENV haclrepo https://github.com/mitls/hacl-star.git
-
-# Define versions of dependencies
-ENV opamv 4.04.2
-ENV haclversion dcd48329d535727dbde93877b124c5ec4a7a2b20
-
-# Install required packages and set versions
-ADD setup.sh /tmp/setup.sh
-RUN bash /tmp/setup.sh
-
-# Create user, add scripts.
-RUN useradd -ms /bin/bash worker
-WORKDIR /home/worker
-ADD bin /home/worker/bin
-RUN chmod +x /home/worker/bin/*
-USER worker
-
-# Build F*, HACL*, verify. Install a few more dependencies.
-ENV OPAMYES true
-ENV PATH "/home/worker/hacl-star/dependencies/z3/bin:$PATH"
-ADD setup-user.sh /tmp/setup-user.sh
-ADD license.txt /tmp/license.txt
-RUN bash /tmp/setup-user.sh
diff --git a/security/nss/automation/taskcluster/docker-hacl/bin/checkout.sh b/security/nss/automation/taskcluster/docker-hacl/bin/checkout.sh
deleted file mode 100644
index 9167f6bda6..0000000000
--- a/security/nss/automation/taskcluster/docker-hacl/bin/checkout.sh
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/env bash
-
-set -v -e -x
-
-if [ $(id -u) = 0 ]; then
- # Drop privileges by re-running this script.
- exec su worker $0
-fi
-
-# Default values for testing.
-REVISION=${NSS_HEAD_REVISION:-default}
-REPOSITORY=${NSS_HEAD_REPOSITORY:-https://hg.mozilla.org/projects/nss}
-
-# Clone NSS.
-for i in 0 2 5; do
- sleep $i
- hg clone -r $REVISION $REPOSITORY nss && exit 0
- rm -rf nss
-done
-exit 1
diff --git a/security/nss/automation/taskcluster/docker-hacl/license.txt b/security/nss/automation/taskcluster/docker-hacl/license.txt
deleted file mode 100644
index 03d25c4d31..0000000000
--- a/security/nss/automation/taskcluster/docker-hacl/license.txt
+++ /dev/null
@@ -1,15 +0,0 @@
-/* Copyright 2016-2017 INRIA and Microsoft Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
diff --git a/security/nss/automation/taskcluster/docker-hacl/setup-user.sh b/security/nss/automation/taskcluster/docker-hacl/setup-user.sh
deleted file mode 100644
index b8accaf584..0000000000
--- a/security/nss/automation/taskcluster/docker-hacl/setup-user.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env bash
-
-set -v -e -x
-
-# Prepare build (OCaml packages)
-opam init
-echo ". /home/worker/.opam/opam-init/init.sh > /dev/null 2> /dev/null || true" >> .bashrc
-opam switch -v ${opamv}
-opam install ocamlfind batteries sqlite3 fileutils yojson ppx_deriving_yojson zarith pprint menhir ulex process fix wasm stdint
-
-# Get the HACL* code
-git clone ${haclrepo} hacl-star
-git -C hacl-star checkout ${haclversion}
-
-# Prepare submodules, and build, verify, test, and extract c code
-# This caches the extracted c code (pins the HACL* version). All we need to do
-# on CI now is comparing the code in this docker image with the one in NSS.
-opam config exec -- make -C hacl-star prepare -j$(nproc)
-make -C hacl-star verify-nss -j$(nproc)
-make -C hacl-star -f Makefile.build snapshots/nss -j$(nproc)
-KOPTS="-funroll-loops 5" make -C hacl-star/code/curve25519 test -j$(nproc)
-make -C hacl-star/code/salsa-family test -j$(nproc)
-make -C hacl-star/code/poly1305 test -j$(nproc)
-
-# Cleanup.
-rm -rf ~/.ccache ~/.cache
diff --git a/security/nss/automation/taskcluster/docker-hacl/setup.sh b/security/nss/automation/taskcluster/docker-hacl/setup.sh
deleted file mode 100644
index f5f8bd7d5e..0000000000
--- a/security/nss/automation/taskcluster/docker-hacl/setup.sh
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/env bash
-
-set -v -e -x
-
-# Update packages.
-export DEBIAN_FRONTEND=noninteractive
-apt-get -qq update
-apt-get install --yes libssl-dev libsqlite3-dev g++-5 gcc-5 m4 make opam pkg-config python libgmp3-dev cmake curl libtool-bin autoconf wget locales
-update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 200
-update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 200
-
-# Get clang-format-3.9
-curl -LO https://releases.llvm.org/3.9.1/clang+llvm-3.9.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz
-curl -LO https://releases.llvm.org/3.9.1/clang+llvm-3.9.1-x86_64-linux-gnu-ubuntu-16.04.tar.xz.sig
-# Verify the signature.
-gpg --keyserver pool.sks-keyservers.net --recv-keys B6C8F98282B944E3B0D5C2530FC3042E345AD05D
-gpg --verify *.tar.xz.sig
-# Install into /usr/local/.
-tar xJvf *.tar.xz -C /usr/local --strip-components=1
-# Cleanup.
-rm *.tar.xz*
-
-locale-gen en_US.UTF-8
-dpkg-reconfigure locales
-
-# Cleanup.
-rm -rf ~/.ccache ~/.cache
-apt-get autoremove -y
-apt-get clean
-apt-get autoclean
diff --git a/security/nss/automation/taskcluster/docker/setup.sh b/security/nss/automation/taskcluster/docker/setup.sh
index 01f9c413a5..3ba4e854ef 100644
--- a/security/nss/automation/taskcluster/docker/setup.sh
+++ b/security/nss/automation/taskcluster/docker/setup.sh
@@ -48,8 +48,8 @@ apt-get -y update
apt-get install -y --no-install-recommends ${apt_packages[@]}
# Download clang.
-curl -LO https://releases.llvm.org/4.0.0/clang+llvm-4.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
-curl -LO https://releases.llvm.org/4.0.0/clang+llvm-4.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz.sig
+curl -LO http://releases.llvm.org/4.0.0/clang+llvm-4.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz
+curl -LO http://releases.llvm.org/4.0.0/clang+llvm-4.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz.sig
# Verify the signature.
gpg --keyserver pool.sks-keyservers.net --recv-keys B6C8F98282B944E3B0D5C2530FC3042E345AD05D
gpg --verify *.tar.xz.sig
diff --git a/security/nss/automation/taskcluster/graph/src/context_hash.js b/security/nss/automation/taskcluster/graph/src/context_hash.js
index 0699a0590e..f0a2e9a88c 100644
--- a/security/nss/automation/taskcluster/graph/src/context_hash.js
+++ b/security/nss/automation/taskcluster/graph/src/context_hash.js
@@ -27,24 +27,14 @@ function collectFilesInDirectory(dir) {
});
}
-// A list of hashes for each file in the given path.
-function collectFileHashes(context_path) {
+// Compute a context hash for the given context path.
+export default function (context_path) {
let root = path.join(__dirname, "../../../..");
let dir = path.join(root, context_path);
let files = collectFilesInDirectory(dir).sort();
-
- return files.map(file => {
+ let hashes = files.map(file => {
return sha256(file + "|" + fs.readFileSync(file, "utf-8"));
});
-}
-
-// Compute a context hash for the given context path.
-export default function (context_path) {
- // Regenerate all images when the image_builder changes.
- let hashes = collectFileHashes("automation/taskcluster/image_builder");
-
- // Regenerate images when the image itself changes.
- hashes = hashes.concat(collectFileHashes(context_path));
// Generate a new prefix every month to ensure the image stays buildable.
let now = new Date();
diff --git a/security/nss/automation/taskcluster/graph/src/extend.js b/security/nss/automation/taskcluster/graph/src/extend.js
index 90e23ae601..d541a1a3b6 100644
--- a/security/nss/automation/taskcluster/graph/src/extend.js
+++ b/security/nss/automation/taskcluster/graph/src/extend.js
@@ -15,29 +15,15 @@ const LINUX_CLANG39_IMAGE = {
path: "automation/taskcluster/docker-clang-3.9"
};
-const LINUX_GCC44_IMAGE = {
- name: "linux-gcc-4.4",
- path: "automation/taskcluster/docker-gcc-4.4"
-};
-
const FUZZ_IMAGE = {
name: "fuzz",
path: "automation/taskcluster/docker-fuzz"
};
-const HACL_GEN_IMAGE = {
- name: "hacl",
- path: "automation/taskcluster/docker-hacl"
-};
-
const WINDOWS_CHECKOUT_CMD =
"bash -c \"hg clone -r $NSS_HEAD_REVISION $NSS_HEAD_REPOSITORY nss || " +
"(sleep 2; hg clone -r $NSS_HEAD_REVISION $NSS_HEAD_REPOSITORY nss) || " +
"(sleep 5; hg clone -r $NSS_HEAD_REVISION $NSS_HEAD_REPOSITORY nss)\"";
-const MAC_CHECKOUT_CMD = ["bash", "-c",
- "hg clone -r $NSS_HEAD_REVISION $NSS_HEAD_REPOSITORY nss || " +
- "(sleep 2; hg clone -r $NSS_HEAD_REVISION $NSS_HEAD_REPOSITORY nss) || " +
- "(sleep 5; hg clone -r $NSS_HEAD_REVISION $NSS_HEAD_REPOSITORY nss)"];
/*****************************************************************************/
@@ -65,15 +51,6 @@ queue.filter(task => {
if (task.platform == "aarch64") {
return false;
}
-
- // No mac
- if (task.platform == "mac") {
- return false;
- }
- }
-
- if (task.tests == "fips" && task.platform == "mac") {
- return false;
}
// Only old make builds have -Ddisable_libpkix=0 and can run chain tests.
@@ -82,8 +59,8 @@ queue.filter(task => {
}
if (task.group == "Test") {
- // Don't run test builds on old make platforms, and not for fips gyp.
- if (task.collection == "make" || task.collection == "fips") {
+ // Don't run test builds on old make platforms
+ if (task.collection == "make") {
return false;
}
}
@@ -101,19 +78,11 @@ queue.filter(task => {
queue.map(task => {
if (task.collection == "asan") {
// CRMF and FIPS tests still leak, unfortunately.
- if (task.tests == "crmf") {
+ if (task.tests == "crmf" || task.tests == "fips") {
task.env.ASAN_OPTIONS = "detect_leaks=0";
}
}
- // We don't run FIPS SSL tests
- if (task.tests == "ssl") {
- if (!task.env) {
- task.env = {};
- }
- task.env.NSS_SSL_TESTS = "crl iopr policy";
- }
-
// Windows is slow.
if (task.platform == "windows2012-64" && task.tests == "chains") {
task.maxRunTime = 7200;
@@ -159,18 +128,6 @@ export default async function main() {
],
});
- await scheduleLinux("Linux 64 (opt, make)", {
- env: {USE_64: "1", BUILD_OPT: "1"},
- platform: "linux64",
- image: LINUX_IMAGE,
- collection: "make",
- command: [
- "/bin/bash",
- "-c",
- "bin/checkout.sh && nss/automation/taskcluster/scripts/build.sh"
- ],
- });
-
await scheduleLinux("Linux 32 (debug, make)", {
platform: "linux32",
image: LINUX_IMAGE,
@@ -196,12 +153,6 @@ export default async function main() {
features: ["allowPtrace"],
}, "--ubsan --asan");
- await scheduleLinux("Linux 64 (FIPS opt)", {
- platform: "linux64",
- collection: "fips",
- image: LINUX_IMAGE,
- }, "--enable-fips --opt");
-
await scheduleWindows("Windows 2012 64 (debug, make)", {
platform: "windows2012-64",
collection: "make",
@@ -265,70 +216,6 @@ export default async function main() {
collection: "opt",
}, aarch64_base)
);
-
- await scheduleMac("Mac (opt)", {collection: "opt"}, "--opt");
- await scheduleMac("Mac (debug)", {collection: "debug"});
-}
-
-
-async function scheduleMac(name, base, args = "") {
- let mac_base = merge(base, {
- env: {
- PATH: "/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin",
- NSS_TASKCLUSTER_MAC: "1",
- DOMSUF: "localdomain",
- HOST: "localhost",
- },
- provisioner: "localprovisioner",
- workerType: "nss-macos-10-12",
- platform: "mac"
- });
-
- // Build base definition.
- let build_base = merge({
- command: [
- MAC_CHECKOUT_CMD,
- ["bash", "-c",
- "nss/automation/taskcluster/scripts/build_gyp.sh", args]
- ],
- provisioner: "localprovisioner",
- workerType: "nss-macos-10-12",
- platform: "mac",
- maxRunTime: 7200,
- artifacts: [{
- expires: 24 * 7,
- type: "directory",
- path: "public"
- }],
- kind: "build",
- symbol: "B"
- }, mac_base);
-
- // The task that builds NSPR+NSS.
- let task_build = queue.scheduleTask(merge(build_base, {name}));
-
- // The task that generates certificates.
- let task_cert = queue.scheduleTask(merge(build_base, {
- name: "Certificates",
- command: [
- MAC_CHECKOUT_CMD,
- ["bash", "-c",
- "nss/automation/taskcluster/scripts/gen_certs.sh"]
- ],
- parent: task_build,
- symbol: "Certs"
- }));
-
- // Schedule tests.
- scheduleTests(task_build, task_cert, merge(mac_base, {
- command: [
- MAC_CHECKOUT_CMD,
- ["bash", "-c",
- "nss/automation/taskcluster/scripts/run_tests.sh"]
- ]
- }));
-
- return queue.submit();
}
/*****************************************************************************/
@@ -355,45 +242,6 @@ async function scheduleLinux(name, base, args = "") {
// The task that builds NSPR+NSS.
let task_build = queue.scheduleTask(merge(build_base, {name}));
- // Make builds run FIPS tests, which need an extra FIPS build.
- if (base.collection == "make") {
- let extra_build = queue.scheduleTask(merge(build_base, {
- env: { NSS_FORCE_FIPS: "1" },
- group: "FIPS",
- name: `${name} w/ NSS_FORCE_FIPS`
- }));
-
- // The task that generates certificates.
- let task_cert = queue.scheduleTask(merge(build_base, {
- name: "Certificates",
- command: [
- "/bin/bash",
- "-c",
- "bin/checkout.sh && nss/automation/taskcluster/scripts/gen_certs.sh"
- ],
- parent: extra_build,
- symbol: "Certs-F",
- group: "FIPS",
- }));
-
- // Schedule FIPS tests.
- queue.scheduleTask(merge(base, {
- parent: task_cert,
- name: "FIPS",
- command: [
- "/bin/bash",
- "-c",
- "bin/checkout.sh && nss/automation/taskcluster/scripts/run_tests.sh"
- ],
- cycle: "standard",
- kind: "test",
- name: "FIPS tests",
- symbol: "Tests-F",
- tests: "fips",
- group: "FIPS"
- }));
- }
-
// The task that generates certificates.
let task_cert = queue.scheduleTask(merge(build_base, {
name: "Certificates",
@@ -427,26 +275,6 @@ async function scheduleLinux(name, base, args = "") {
}));
queue.scheduleTask(merge(extra_base, {
- name: `${name} w/ gcc-4.4`,
- image: LINUX_GCC44_IMAGE,
- env: {
- USE_64: "1",
- CC: "gcc-4.4",
- CCC: "g++-4.4",
- // gcc-4.6 introduced nullptr.
- NSS_DISABLE_GTESTS: "1",
- },
- // Use the old Makefile-based build system, GYP doesn't have a proper GCC
- // version check for __int128 support. It's mainly meant to cover RHEL6.
- command: [
- "/bin/bash",
- "-c",
- "bin/checkout.sh && nss/automation/taskcluster/scripts/build.sh",
- ],
- symbol: "gcc-4.4"
- }));
-
- queue.scheduleTask(merge(extra_base, {
name: `${name} w/ gcc-4.8`,
env: {
CC: "gcc-4.8",
@@ -575,13 +403,12 @@ async function scheduleFuzzing() {
// Schedule MPI fuzzing runs.
let mpi_base = merge(run_base, {group: "MPI"});
- let mpi_names = ["add", "addmod", "div", "mod", "mulmod", "sqr",
+ let mpi_names = ["add", "addmod", "div", "expmod", "mod", "mulmod", "sqr",
"sqrmod", "sub", "submod"];
for (let name of mpi_names) {
scheduleFuzzingRun(mpi_base, `MPI (${name})`, `mpi-${name}`, 4096, name);
}
scheduleFuzzingRun(mpi_base, `MPI (invmod)`, `mpi-invmod`, 256, "invmod");
- scheduleFuzzingRun(mpi_base, `MPI (expmod)`, `mpi-expmod`, 2048, "expmod");
// Schedule TLS fuzzing runs (non-fuzzing mode).
let tls_base = merge(run_base, {group: "TLS"});
@@ -798,43 +625,6 @@ async function scheduleWindows(name, base, build_script) {
symbol: "B"
});
- // Make builds run FIPS tests, which need an extra FIPS build.
- if (base.collection == "make") {
- let extra_build = queue.scheduleTask(merge(build_base, {
- env: { NSS_FORCE_FIPS: "1" },
- group: "FIPS",
- name: `${name} w/ NSS_FORCE_FIPS`
- }));
-
- // The task that generates certificates.
- let task_cert = queue.scheduleTask(merge(build_base, {
- name: "Certificates",
- command: [
- WINDOWS_CHECKOUT_CMD,
- "bash -c nss/automation/taskcluster/windows/gen_certs.sh"
- ],
- parent: extra_build,
- symbol: "Certs-F",
- group: "FIPS",
- }));
-
- // Schedule FIPS tests.
- queue.scheduleTask(merge(base, {
- parent: task_cert,
- name: "FIPS",
- command: [
- WINDOWS_CHECKOUT_CMD,
- "bash -c nss/automation/taskcluster/windows/run_tests.sh"
- ],
- cycle: "standard",
- kind: "test",
- name: "FIPS tests",
- symbol: "Tests-F",
- tests: "fips",
- group: "FIPS"
- }));
- }
-
// The task that builds NSPR+NSS.
let task_build = queue.scheduleTask(merge(build_base, {name}));
@@ -913,6 +703,9 @@ function scheduleTests(task_build, task_cert, test_base) {
name: "DB tests", symbol: "DB", tests: "dbtests"
}));
queue.scheduleTask(merge(cert_base, {
+ name: "FIPS tests", symbol: "FIPS", tests: "fips"
+ }));
+ queue.scheduleTask(merge(cert_base, {
name: "Merge tests", symbol: "Merge", tests: "merge"
}));
queue.scheduleTask(merge(cert_base, {
@@ -980,16 +773,5 @@ async function scheduleTools() {
]
}));
- queue.scheduleTask(merge(base, {
- symbol: "hacl",
- name: "hacl",
- image: HACL_GEN_IMAGE,
- command: [
- "/bin/bash",
- "-c",
- "bin/checkout.sh && nss/automation/taskcluster/scripts/run_hacl.sh"
- ]
- }));
-
return queue.submit();
}
diff --git a/security/nss/automation/taskcluster/graph/src/image_builder.js b/security/nss/automation/taskcluster/graph/src/image_builder.js
index b89b6980c1..bc90e0242f 100644
--- a/security/nss/automation/taskcluster/graph/src/image_builder.js
+++ b/security/nss/automation/taskcluster/graph/src/image_builder.js
@@ -31,11 +31,13 @@ export async function buildTask({name, path}) {
return {
name: "Image Builder",
- image: "nssdev/image_builder:0.1.5",
+ image: "taskcluster/image_builder:0.1.5",
routes: ["index." + ns],
env: {
- NSS_HEAD_REPOSITORY: process.env.NSS_HEAD_REPOSITORY,
- NSS_HEAD_REVISION: process.env.NSS_HEAD_REVISION,
+ HEAD_REPOSITORY: process.env.NSS_HEAD_REPOSITORY,
+ BASE_REPOSITORY: process.env.NSS_HEAD_REPOSITORY,
+ HEAD_REV: process.env.NSS_HEAD_REVISION,
+ HEAD_REF: process.env.NSS_HEAD_REVISION,
PROJECT: process.env.TC_PROJECT,
CONTEXT_PATH: path,
HASH: hash
@@ -50,11 +52,10 @@ export async function buildTask({name, path}) {
command: [
"/bin/bash",
"-c",
- "bin/checkout.sh && nss/automation/taskcluster/scripts/build_image.sh"
+ "/home/worker/bin/build_image.sh"
],
platform: "nss-decision",
features: ["dind"],
- maxRunTime: 7200,
kind: "build",
symbol: "I"
};
diff --git a/security/nss/automation/taskcluster/graph/src/try_syntax.js b/security/nss/automation/taskcluster/graph/src/try_syntax.js
index 1f4e12eeee..7748e068a0 100644
--- a/security/nss/automation/taskcluster/graph/src/try_syntax.js
+++ b/security/nss/automation/taskcluster/graph/src/try_syntax.js
@@ -22,10 +22,10 @@ function parseOptions(opts) {
}
// Parse platforms.
- let allPlatforms = ["linux", "linux64", "linux64-asan", "linux64-fips",
+ let allPlatforms = ["linux", "linux64", "linux64-asan",
"win", "win64", "win-make", "win64-make",
"linux64-make", "linux-make", "linux-fuzz",
- "linux64-fuzz", "aarch64", "mac"];
+ "linux64-fuzz", "aarch64"];
let platforms = intersect(opts.platform.split(/\s*,\s*/), allPlatforms);
// If the given value is nonsense or "none" default to all platforms.
@@ -51,7 +51,7 @@ function parseOptions(opts) {
}
// Parse tools.
- let allTools = ["clang-format", "scan-build", "hacl"];
+ let allTools = ["clang-format", "scan-build"];
let tools = intersect(opts.tools.split(/\s*,\s*/), allTools);
// If the given value is "all" run all tools.
@@ -111,7 +111,6 @@ function filter(opts) {
"linux": "linux32",
"linux-fuzz": "linux32",
"linux64-asan": "linux64",
- "linux64-fips": "linux64",
"linux64-fuzz": "linux64",
"linux64-make": "linux64",
"linux-make": "linux32",
@@ -127,8 +126,6 @@ function filter(opts) {
// Additional checks.
if (platform == "linux64-asan") {
keep &= coll("asan");
- } else if (platform == "linux64-fips") {
- keep &= coll("fips");
} else if (platform == "linux64-make" || platform == "linux-make" ||
platform == "win64-make" || platform == "win-make") {
keep &= coll("make");
diff --git a/security/nss/automation/taskcluster/image_builder/Dockerfile b/security/nss/automation/taskcluster/image_builder/Dockerfile
deleted file mode 100644
index f8b4edcc53..0000000000
--- a/security/nss/automation/taskcluster/image_builder/Dockerfile
+++ /dev/null
@@ -1,23 +0,0 @@
-FROM ubuntu:16.04
-MAINTAINER Tim Taubert <ttaubert@mozilla.com>
-
-WORKDIR /home/worker
-
-ENV DEBIAN_FRONTEND noninteractive
-
-RUN apt-get update && apt-get install -y apt-transport-https apt-utils
-RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 36A1D7869245C8950F966E92D8576A8BA88D21E9 && \
- sh -c "echo deb https://get.docker.io/ubuntu docker main \
- > /etc/apt/sources.list.d/docker.list"
-RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 41BD8711B1F0EC2B0D85B91CF59CE3A8323293EE && \
- sh -c "echo deb http://ppa.launchpad.net/mercurial-ppa/releases/ubuntu xenial main \
- > /etc/apt/sources.list.d/mercurial.list"
-RUN apt-get update && apt-get install -y \
- lxc-docker-1.6.1 \
- mercurial
-
-ADD bin /home/worker/bin
-RUN chmod +x /home/worker/bin/*
-
-# Set a default command useful for debugging
-CMD ["/bin/bash", "--login"]
diff --git a/security/nss/automation/taskcluster/image_builder/VERSION b/security/nss/automation/taskcluster/image_builder/VERSION
deleted file mode 100644
index 9faa1b7a73..0000000000
--- a/security/nss/automation/taskcluster/image_builder/VERSION
+++ /dev/null
@@ -1 +0,0 @@
-0.1.5
diff --git a/security/nss/automation/taskcluster/image_builder/bin/checkout.sh b/security/nss/automation/taskcluster/image_builder/bin/checkout.sh
deleted file mode 100644
index 0cdd2ac405..0000000000
--- a/security/nss/automation/taskcluster/image_builder/bin/checkout.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env bash
-
-set -v -e -x
-
-# Default values for testing.
-REVISION=${NSS_HEAD_REVISION:-default}
-REPOSITORY=${NSS_HEAD_REPOSITORY:-https://hg.mozilla.org/projects/nss}
-
-# Clone NSS.
-for i in 0 2 5; do
- sleep $i
- hg clone -r $REVISION $REPOSITORY nss && exit 0
- rm -rf nss
-done
-exit 1
diff --git a/security/nss/automation/taskcluster/scripts/build_gyp.sh b/security/nss/automation/taskcluster/scripts/build_gyp.sh
index fb3a33a52b..7190bd5c49 100755
--- a/security/nss/automation/taskcluster/scripts/build_gyp.sh
+++ b/security/nss/automation/taskcluster/scripts/build_gyp.sh
@@ -9,10 +9,5 @@ hg_clone https://hg.mozilla.org/projects/nspr ./nspr default
nss/build.sh -g -v "$@"
# Package.
-if [[ $(uname) = "Darwin" ]]; then
- mkdir -p public
- tar cvfjh public/dist.tar.bz2 dist
-else
- mkdir artifacts
- tar cvfjh artifacts/dist.tar.bz2 dist
-fi
+mkdir artifacts
+tar cvfjh artifacts/dist.tar.bz2 dist
diff --git a/security/nss/automation/taskcluster/scripts/build_image.sh b/security/nss/automation/taskcluster/scripts/build_image.sh
deleted file mode 100644
index b422214e71..0000000000
--- a/security/nss/automation/taskcluster/scripts/build_image.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/bash -vex
-
-set -x -e -v
-
-# Prefix errors with taskcluster error prefix so that they are parsed by Treeherder
-raise_error() {
- echo
- echo "[taskcluster-image-build:error] $1"
- exit 1
-}
-
-# Ensure that the PROJECT is specified so the image can be indexed
-test -n "$PROJECT" || raise_error "Project must be provided."
-test -n "$HASH" || raise_error "Context Hash must be provided."
-
-CONTEXT_PATH=/home/worker/nss/$CONTEXT_PATH
-
-test -d $CONTEXT_PATH || raise_error "Context Path $CONTEXT_PATH does not exist."
-test -f "$CONTEXT_PATH/Dockerfile" || raise_error "Dockerfile must be present in $CONTEXT_PATH."
-
-docker build -t $PROJECT:$HASH $CONTEXT_PATH
-
-mkdir /artifacts
-docker save $PROJECT:$HASH > /artifacts/image.tar
diff --git a/security/nss/automation/taskcluster/scripts/gen_certs.sh b/security/nss/automation/taskcluster/scripts/gen_certs.sh
index c03db7e9c2..b8d4f60bae 100755
--- a/security/nss/automation/taskcluster/scripts/gen_certs.sh
+++ b/security/nss/automation/taskcluster/scripts/gen_certs.sh
@@ -12,10 +12,5 @@ NSS_TESTS=cert NSS_CYCLES="standard pkix sharedb" $(dirname $0)/run_tests.sh
echo 1 > tests_results/security/localhost
# Package.
-if [[ $(uname) = "Darwin" ]]; then
- mkdir -p public
- tar cvfjh public/dist.tar.bz2 dist tests_results
-else
- mkdir artifacts
- tar cvfjh artifacts/dist.tar.bz2 dist tests_results
-fi
+mkdir artifacts
+tar cvfjh artifacts/dist.tar.bz2 dist tests_results
diff --git a/security/nss/automation/taskcluster/scripts/run_hacl.sh b/security/nss/automation/taskcluster/scripts/run_hacl.sh
deleted file mode 100644
index 281075eef4..0000000000
--- a/security/nss/automation/taskcluster/scripts/run_hacl.sh
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/usr/bin/env bash
-
-if [[ $(id -u) -eq 0 ]]; then
- # Drop privileges by re-running this script.
- # Note: this mangles arguments, better to avoid running scripts as root.
- exec su worker -c "$0 $*"
-fi
-
-set -e -x -v
-
-# The docker image this is running in has the HACL* and NSS sources.
-# The extracted C code from HACL* is already generated and the HACL* tests were
-# successfully executed.
-
-# Verify Poly1305 (doesn't work in docker image build)
-make verify -C ~/hacl-star/code/poly1305 -j$(nproc)
-
-# Add license header to specs
-spec_files=($(find ~/hacl-star/specs -type f -name '*.fst'))
-for f in "${spec_files[@]}"; do
- cat /tmp/license.txt "$f" > /tmp/tmpfile && mv /tmp/tmpfile "$f"
-done
-
-# Format the extracted C code.
-cd ~/hacl-star/snapshots/nss
-cp ~/nss/.clang-format .
-find . -type f -name '*.[ch]' -exec clang-format -i {} \+
-
-# These diff commands will return 1 if there are differences and stop the script.
-files=($(find ~/nss/lib/freebl/verified/ -type f -name '*.[ch]'))
-for f in "${files[@]}"; do
- diff $f $(basename "$f")
-done
-
-# Check that the specs didn't change either.
-cd ~/hacl-star/specs
-files=($(find ~/nss/lib/freebl/verified/specs -type f))
-for f in "${files[@]}"; do
- diff $f $(basename "$f")
-done
diff --git a/security/nss/automation/taskcluster/scripts/split.sh b/security/nss/automation/taskcluster/scripts/split.sh
index fded64e1b2..4d18385eca 100644
--- a/security/nss/automation/taskcluster/scripts/split.sh
+++ b/security/nss/automation/taskcluster/scripts/split.sh
@@ -23,10 +23,16 @@ split_util() {
# Copy everything.
cp -R $nssdir $dstdir
+ # Skip gtests when building.
+ sed '/^DIRS = /s/ cpputil gtests$//' $nssdir/manifest.mn > $dstdir/manifest.mn-t && mv $dstdir/manifest.mn-t $dstdir/manifest.mn
+
# Remove subdirectories that we don't want.
rm -rf $dstdir/cmd
+ rm -rf $dstdir/tests
rm -rf $dstdir/lib
rm -rf $dstdir/automation
+ rm -rf $dstdir/gtests
+ rm -rf $dstdir/cpputil
rm -rf $dstdir/doc
# Start with an empty cmd lib directories to be filled selectively.
diff --git a/security/nss/automation/taskcluster/windows/releng.manifest b/security/nss/automation/taskcluster/windows/releng.manifest
index d571c544d6..68d2c1d9e6 100644
--- a/security/nss/automation/taskcluster/windows/releng.manifest
+++ b/security/nss/automation/taskcluster/windows/releng.manifest
@@ -1,10 +1,10 @@
[
{
- "version": "Visual Studio 2017 15.4.2 / SDK 10.0.15063.0",
- "size": 303146863,
- "digest": "18700889e6b5e81613b9cf57ce4e0d46a6ee45bb4c5c33bae2604a5275326128775b8a032a1eb178c5db973746d565340c4e36d98375789e1d5bd836ab16ba58",
+ "version": "Visual Studio 2015 Update 3 14.0.25425.01 / SDK 10.0.14393.0",
+ "size": 326656969,
+ "digest": "babc414ffc0457d27f5a1ed24a8e4873afbe2f1c1a4075469a27c005e1babc3b2a788f643f825efedff95b79686664c67ec4340ed535487168a3482e68559bc7",
"algorithm": "sha512",
- "filename": "vs2017_15.4.2.zip",
+ "filename": "vs2015u3.zip",
"unpack": true
},
{
diff --git a/security/nss/automation/taskcluster/windows/setup.sh b/security/nss/automation/taskcluster/windows/setup.sh
index 36a040ba1c..7def50db4f 100644
--- a/security/nss/automation/taskcluster/windows/setup.sh
+++ b/security/nss/automation/taskcluster/windows/setup.sh
@@ -2,12 +2,12 @@
set -v -e -x
-export VSPATH="$(pwd)/vs2017_15.4.2"
+export VSPATH="$(pwd)/vs2015u3"
export NINJA_PATH="$(pwd)/ninja/bin"
export WINDOWSSDKDIR="${VSPATH}/SDK"
export VS90COMNTOOLS="${VSPATH}/VC"
-export INCLUDE="${VSPATH}/VC/include:${VSPATH}/SDK/Include/10.0.15063.0/ucrt:${VSPATH}/SDK/Include/10.0.15063.0/shared:${VSPATH}/SDK/Include/10.0.15063.0/um"
+export INCLUDE="${VSPATH}/VC/include:${VSPATH}/SDK/Include/10.0.14393.0/ucrt:${VSPATH}/SDK/Include/10.0.14393.0/shared:${VSPATH}/SDK/Include/10.0.14393.0/um"
# Usage: hg_clone repo dir [revision=@]
hg_clone() {
@@ -23,4 +23,4 @@ hg_clone() {
}
hg_clone https://hg.mozilla.org/build/tools tools default
-tools/scripts/tooltool/tooltool_wrapper.sh $(dirname $0)/releng.manifest https://tooltool.mozilla-releng.net/ non-existant-file.sh /c/mozilla-build/python/python.exe /c/builds/tooltool.py --authentication-file /c/builds/relengapi.tok -c /c/builds/tooltool_cache
+tools/scripts/tooltool/tooltool_wrapper.sh $(dirname $0)/releng.manifest https://api.pub.build.mozilla.org/tooltool/ non-existant-file.sh /c/mozilla-build/python/python.exe /c/builds/tooltool.py --authentication-file /c/builds/relengapi.tok -c /c/builds/tooltool_cache
diff --git a/security/nss/automation/taskcluster/windows/setup32.sh b/security/nss/automation/taskcluster/windows/setup32.sh
index 19bed284d1..bcddabfa39 100644
--- a/security/nss/automation/taskcluster/windows/setup32.sh
+++ b/security/nss/automation/taskcluster/windows/setup32.sh
@@ -4,7 +4,7 @@ set -v -e -x
source $(dirname $0)/setup.sh
-export WIN32_REDIST_DIR="${VSPATH}/VC/redist/x86/Microsoft.VC141.CRT"
+export WIN32_REDIST_DIR="${VSPATH}/VC/redist/x86/Microsoft.VC140.CRT"
export WIN_UCRT_REDIST_DIR="${VSPATH}/SDK/Redist/ucrt/DLLs/x86"
-export PATH="${NINJA_PATH}:${VSPATH}/VC/bin/Hostx64/x86:${VSPATH}/VC/bin/Hostx64/x64:${VSPATH}/VC/Hostx86/x86:${VSPATH}/SDK/bin/10.0.15063.0/x64:${VSPATH}/VC/redist/x86/Microsoft.VC141.CRT:${VSPATH}/SDK/Redist/ucrt/DLLs/x86:${PATH}"
-export LIB="${VSPATH}/VC/lib/x86:${VSPATH}/SDK/lib/10.0.15063.0/ucrt/x86:${VSPATH}/SDK/lib/10.0.15063.0/um/x86"
+export PATH="${NINJA_PATH}:${VSPATH}/VC/bin/amd64_x86:${VSPATH}/VC/bin/amd64:${VSPATH}/VC/bin:${VSPATH}/SDK/bin/x86:${VSPATH}/SDK/bin/x64:${VSPATH}/VC/redist/x86/Microsoft.VC140.CRT:${VSPATH}/VC/redist/x64/Microsoft.VC140.CRT:${VSPATH}/SDK/Redist/ucrt/DLLs/x86:${VSPATH}/SDK/Redist/ucrt/DLLs/x64:${PATH}"
+export LIB="${VSPATH}/VC/lib:${VSPATH}/SDK/lib/10.0.14393.0/ucrt/x86:${VSPATH}/SDK/lib/10.0.14393.0/um/x86"
diff --git a/security/nss/automation/taskcluster/windows/setup64.sh b/security/nss/automation/taskcluster/windows/setup64.sh
index d16cb0ec9d..f308298c18 100644
--- a/security/nss/automation/taskcluster/windows/setup64.sh
+++ b/security/nss/automation/taskcluster/windows/setup64.sh
@@ -4,7 +4,7 @@ set -v -e -x
source $(dirname $0)/setup.sh
-export WIN32_REDIST_DIR="${VSPATH}/VC/redist/x64/Microsoft.VC141.CRT"
+export WIN32_REDIST_DIR="${VSPATH}/VC/redist/x64/Microsoft.VC140.CRT"
export WIN_UCRT_REDIST_DIR="${VSPATH}/SDK/Redist/ucrt/DLLs/x64"
-export PATH="${NINJA_PATH}:${VSPATH}/VC/bin/Hostx64/x64:${VSPATH}/VC/bin/Hostx86/x86:${VSPATH}/SDK/bin/10.0.15063.0/x64:${VSPATH}/VC/redist/x64/Microsoft.VC141.CRT:${VSPATH}/SDK/Redist/ucrt/DLLs/x64:${PATH}"
-export LIB="${VSPATH}/VC/lib/x64:${VSPATH}/SDK/lib/10.0.15063.0/ucrt/x64:${VSPATH}/SDK/lib/10.0.15063.0/um/x64"
+export PATH="${NINJA_PATH}:${VSPATH}/VC/bin/amd64:${VSPATH}/VC/bin:${VSPATH}/SDK/bin/x64:${VSPATH}/VC/redist/x64/Microsoft.VC140.CRT:${VSPATH}/SDK/Redist/ucrt/DLLs/x64:${PATH}"
+export LIB="${VSPATH}/VC/lib/amd64:${VSPATH}/SDK/lib/10.0.14393.0/ucrt/x64:${VSPATH}/SDK/lib/10.0.14393.0/um/x64"
diff --git a/security/nss/build.sh b/security/nss/build.sh
index 2db8256d8b..2b377dec57 100755
--- a/security/nss/build.sh
+++ b/security/nss/build.sh
@@ -68,14 +68,11 @@ fi
while [ $# -gt 0 ]; do
case $1 in
-c) clean=1 ;;
- -cc) clean_only=1 ;;
--gyp|-g) rebuild_gyp=1 ;;
--nspr) nspr_clean; rebuild_nspr=1 ;;
-j) ninja_params+=(-j "$2"); shift ;;
-v) ninja_params+=(-v); verbose=1 ;;
--test) gyp_params+=(-Dtest_build=1) ;;
- --clang) export CC=clang; export CCC=clang++; export CXX=clang++ ;;
- --gcc) export CC=gcc; export CCC=g++; export CXX=g++ ;;
--fuzz) fuzz=1 ;;
--fuzz=oss) fuzz=1; fuzz_oss=1 ;;
--fuzz=tls) fuzz=1; fuzz_tls=1 ;;
@@ -97,7 +94,6 @@ while [ $# -gt 0 ]; do
--with-nspr=?*) set_nspr_path "${1#*=}"; no_local_nspr=1 ;;
--system-nspr) set_nspr_path "/usr/include/nspr/:"; no_local_nspr=1 ;;
--enable-libpkix) gyp_params+=(-Ddisable_libpkix=0) ;;
- --enable-fips) gyp_params+=(-Ddisable_fips=0) ;;
*) show_help; exit 2 ;;
esac
shift
@@ -125,15 +121,10 @@ dist_dir=$(mkdir -p "$dist_dir"; cd "$dist_dir"; pwd -P)
gyp_params+=(-Dnss_dist_dir="$dist_dir")
# -c = clean first
-if [ "$clean" = 1 -o "$clean_only" = 1 ]; then
+if [ "$clean" = 1 ]; then
nspr_clean
rm -rf "$cwd"/out
rm -rf "$dist_dir"
- # -cc = only clean, don't build
- if [ "$clean_only" = 1 ]; then
- echo "Cleaned"
- exit 0
- fi
fi
# This saves a canonical representation of arguments that we are passing to gyp
diff --git a/security/nss/cmd/bltest/blapitest.c b/security/nss/cmd/bltest/blapitest.c
index ca3d6f3144..a3a162da12 100644
--- a/security/nss/cmd/bltest/blapitest.c
+++ b/security/nss/cmd/bltest/blapitest.c
@@ -20,14 +20,16 @@
#include "secport.h"
#include "secoid.h"
#include "nssutil.h"
-#include "ecl-curve.h"
#include "pkcs1_vectors.h"
+#ifndef NSS_DISABLE_ECC
+#include "ecl-curve.h"
SECStatus EC_DecodeParams(const SECItem *encodedParams,
ECParams **ecparams);
SECStatus EC_CopyParams(PLArenaPool *arena, ECParams *dstParams,
const ECParams *srcParams);
+#endif
char *progName;
char *testdir = NULL;
@@ -133,14 +135,18 @@ Usage()
PRINTUSAGE(progName, "-S -m mode", "Sign a buffer");
PRINTUSAGE("", "", "[-i plaintext] [-o signature] [-k key]");
PRINTUSAGE("", "", "[-b bufsize]");
+#ifndef NSS_DISABLE_ECC
PRINTUSAGE("", "", "[-n curvename]");
+#endif
PRINTUSAGE("", "", "[-p repetitions | -5 time_interval] [-4 th_num]");
PRINTUSAGE("", "-m", "cipher mode to use");
PRINTUSAGE("", "-i", "file which contains input buffer");
PRINTUSAGE("", "-o", "file for signature");
PRINTUSAGE("", "-k", "file which contains key");
+#ifndef NSS_DISABLE_ECC
PRINTUSAGE("", "-n", "name of curve for EC key generation; one of:");
PRINTUSAGE("", "", " nistp256, nistp384, nistp521");
+#endif
PRINTUSAGE("", "-p", "do performance test");
PRINTUSAGE("", "-4", "run test in multithread mode. th_num number of parallel threads");
PRINTUSAGE("", "-5", "run test for specified time interval(in seconds)");
@@ -363,6 +369,7 @@ dsakey_from_filedata(PLArenaPool *arena, SECItem *filedata)
return key;
}
+#ifndef NSS_DISABLE_ECC
static ECPrivateKey *
eckey_from_filedata(PLArenaPool *arena, SECItem *filedata)
{
@@ -512,6 +519,7 @@ getECParams(const char *curve)
return ecparams;
}
+#endif /* NSS_DISABLE_ECC */
static void
dump_pqg(PQGParams *pqg)
@@ -529,6 +537,7 @@ dump_dsakey(DSAPrivateKey *key)
SECU_PrintInteger(stdout, &key->privateValue, "PRIVATE VALUE:", 0);
}
+#ifndef NSS_DISABLE_ECC
static void
dump_ecp(ECParams *ecp)
{
@@ -543,6 +552,7 @@ dump_eckey(ECPrivateKey *key)
SECU_PrintInteger(stdout, &key->publicValue, "PUBLIC VALUE:", 0);
SECU_PrintInteger(stdout, &key->privateValue, "PRIVATE VALUE:", 0);
}
+#endif
static void
dump_rsakey(RSAPrivateKey *key)
@@ -628,15 +638,17 @@ typedef enum {
bltestRSA, /* Public Key Ciphers */
bltestRSA_OAEP, /* . (Public Key Enc.) */
bltestRSA_PSS, /* . (Public Key Sig.) */
- bltestECDSA, /* . (Public Key Sig.) */
- bltestDSA, /* . (Public Key Sig.) */
- bltestMD2, /* Hash algorithms */
- bltestMD5, /* . */
- bltestSHA1, /* . */
- bltestSHA224, /* . */
- bltestSHA256, /* . */
- bltestSHA384, /* . */
- bltestSHA512, /* . */
+#ifndef NSS_DISABLE_ECC
+ bltestECDSA, /* . (Public Key Sig.) */
+#endif
+ bltestDSA, /* . (Public Key Sig.) */
+ bltestMD2, /* Hash algorithms */
+ bltestMD5, /* . */
+ bltestSHA1, /* . */
+ bltestSHA224, /* . */
+ bltestSHA256, /* . */
+ bltestSHA384, /* . */
+ bltestSHA512, /* . */
NUMMODES
} bltestCipherMode;
@@ -666,7 +678,9 @@ static char *mode_strings[] =
"rsa",
"rsa_oaep",
"rsa_pss",
+#ifndef NSS_DISABLE_ECC
"ecdsa",
+#endif
/*"pqg",*/
"dsa",
"md2",
@@ -718,11 +732,13 @@ typedef struct
PQGParams *pqg;
} bltestDSAParams;
+#ifndef NSS_DISABLE_ECC
typedef struct
{
char *curveName;
bltestIO sigseed;
} bltestECDSAParams;
+#endif
typedef struct
{
@@ -735,7 +751,9 @@ typedef struct
union {
bltestRSAParams rsa;
bltestDSAParams dsa;
+#ifndef NSS_DISABLE_ECC
bltestECDSAParams ecdsa;
+#endif
} cipherParams;
} bltestAsymKeyParams;
@@ -1292,6 +1310,7 @@ dsa_verifyDigest(void *cx, SECItem *output, const SECItem *input)
return DSA_VerifyDigest((DSAPublicKey *)params->pubKey, output, input);
}
+#ifndef NSS_DISABLE_ECC
SECStatus
ecdsa_signDigest(void *cx, SECItem *output, const SECItem *input)
{
@@ -1312,6 +1331,7 @@ ecdsa_verifyDigest(void *cx, SECItem *output, const SECItem *input)
bltestAsymKeyParams *params = (bltestAsymKeyParams *)cx;
return ECDSA_VerifyDigest((ECPublicKey *)params->pubKey, output, input);
}
+#endif
SECStatus
bltest_des_init(bltestCipherInfo *cipherInfo, PRBool encrypt)
@@ -1791,6 +1811,7 @@ bltest_dsa_init(bltestCipherInfo *cipherInfo, PRBool encrypt)
return SECSuccess;
}
+#ifndef NSS_DISABLE_ECC
SECStatus
bltest_ecdsa_init(bltestCipherInfo *cipherInfo, PRBool encrypt)
{
@@ -1856,6 +1877,7 @@ bltest_ecdsa_init(bltestCipherInfo *cipherInfo, PRBool encrypt)
}
return SECSuccess;
}
+#endif
/* XXX unfortunately, this is not defined in blapi.h */
SECStatus
@@ -2147,7 +2169,11 @@ finish:
SECStatus
pubkeyInitKey(bltestCipherInfo *cipherInfo, PRFileDesc *file,
+#ifndef NSS_DISABLE_ECC
int keysize, int exponent, char *curveName)
+#else
+ int keysize, int exponent)
+#endif
{
int i;
SECStatus rv = SECSuccess;
@@ -2156,10 +2182,12 @@ pubkeyInitKey(bltestCipherInfo *cipherInfo, PRFileDesc *file,
RSAPrivateKey **rsaKey = NULL;
bltestDSAParams *dsap;
DSAPrivateKey **dsaKey = NULL;
+#ifndef NSS_DISABLE_ECC
SECItem *tmpECParamsDER;
ECParams *tmpECParams = NULL;
SECItem ecSerialize[3];
ECPrivateKey **ecKey = NULL;
+#endif
switch (cipherInfo->mode) {
case bltestRSA:
case bltestRSA_PSS:
@@ -2196,6 +2224,7 @@ pubkeyInitKey(bltestCipherInfo *cipherInfo, PRFileDesc *file,
dsap->keysize = (*dsaKey)->params.prime.len * 8;
}
break;
+#ifndef NSS_DISABLE_ECC
case bltestECDSA:
ecKey = (ECPrivateKey **)&asymk->privKey;
if (curveName != NULL) {
@@ -2225,6 +2254,7 @@ pubkeyInitKey(bltestCipherInfo *cipherInfo, PRFileDesc *file,
*ecKey = eckey_from_filedata(cipherInfo->arena, &asymk->key.buf);
}
break;
+#endif
default:
return SECFailure;
}
@@ -2311,6 +2341,7 @@ cipherInit(bltestCipherInfo *cipherInfo, PRBool encrypt)
}
return bltest_dsa_init(cipherInfo, encrypt);
break;
+#ifndef NSS_DISABLE_ECC
case bltestECDSA:
if (encrypt) {
SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf,
@@ -2318,6 +2349,7 @@ cipherInit(bltestCipherInfo *cipherInfo, PRBool encrypt)
}
return bltest_ecdsa_init(cipherInfo, encrypt);
break;
+#endif
case bltestMD2:
restart = cipherInfo->params.hash.restart;
SECITEM_AllocItem(cipherInfo->arena, &cipherInfo->output.buf,
@@ -2612,7 +2644,9 @@ cipherFinish(bltestCipherInfo *cipherInfo)
case bltestRSA_PSS: /* will be freed with it. */
case bltestRSA_OAEP:
case bltestDSA:
+#ifndef NSS_DISABLE_ECC
case bltestECDSA:
+#endif
case bltestMD2: /* hash contexts are ephemeral */
case bltestMD5:
case bltestSHA1:
@@ -2788,6 +2822,7 @@ print_td:
fprintf(stdout, "%8d", info->params.asymk.cipherParams.dsa.keysize);
}
break;
+#ifndef NSS_DISABLE_ECC
case bltestECDSA:
if (td) {
fprintf(stdout, "%12s", "ec_curve");
@@ -2798,6 +2833,7 @@ print_td:
ecCurve_map[curveName] ? ecCurve_map[curveName]->text : "Unsupported curve");
}
break;
+#endif
case bltestMD2:
case bltestMD5:
case bltestSHA1:
@@ -3027,6 +3063,7 @@ get_params(PLArenaPool *arena, bltestParams *params,
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "ciphertext", j);
load_file_data(arena, &params->asymk.sig, filename, bltestBase64Encoded);
break;
+#ifndef NSS_DISABLE_ECC
case bltestECDSA:
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "key", j);
load_file_data(arena, &params->asymk.key, filename, bltestBase64Encoded);
@@ -3038,6 +3075,7 @@ get_params(PLArenaPool *arena, bltestParams *params,
sprintf(filename, "%s/tests/%s/%s%d", testdir, modestr, "ciphertext", j);
load_file_data(arena, &params->asymk.sig, filename, bltestBase64Encoded);
break;
+#endif
case bltestMD2:
case bltestMD5:
case bltestSHA1:
@@ -3259,11 +3297,13 @@ dump_file(bltestCipherMode mode, char *filename)
load_file_data(arena, &keydata, filename, bltestBase64Encoded);
key = dsakey_from_filedata(arena, &keydata.buf);
dump_dsakey(key);
+#ifndef NSS_DISABLE_ECC
} else if (mode == bltestECDSA) {
ECPrivateKey *key;
load_file_data(arena, &keydata, filename, bltestBase64Encoded);
key = eckey_from_filedata(arena, &keydata.buf);
dump_eckey(key);
+#endif
}
PORT_FreeArena(arena, PR_FALSE);
return SECFailure;
@@ -3550,7 +3590,9 @@ enum {
opt_Key,
opt_HexWSpc,
opt_Mode,
+#ifndef NSS_DISABLE_ECC
opt_CurveName,
+#endif
opt_Output,
opt_Repetitions,
opt_ZeroBuf,
@@ -3602,7 +3644,9 @@ static secuCommandFlag bltest_options[] =
{ /* opt_Key */ 'k', PR_TRUE, 0, PR_FALSE },
{ /* opt_HexWSpc */ 'l', PR_FALSE, 0, PR_FALSE },
{ /* opt_Mode */ 'm', PR_TRUE, 0, PR_FALSE },
+#ifndef NSS_DISABLE_ECC
{ /* opt_CurveName */ 'n', PR_TRUE, 0, PR_FALSE },
+#endif
{ /* opt_Output */ 'o', PR_TRUE, 0, PR_FALSE },
{ /* opt_Repetitions */ 'p', PR_TRUE, 0, PR_FALSE },
{ /* opt_ZeroBuf */ 'q', PR_FALSE, 0, PR_FALSE },
@@ -3635,7 +3679,9 @@ main(int argc, char **argv)
bltestCipherInfo *cipherInfoListHead, *cipherInfo = NULL;
bltestIOMode ioMode;
int bufsize, exponent, curThrdNum;
+#ifndef NSS_DISABLE_ECC
char *curveName = NULL;
+#endif
int i, commandsEntered;
int inoff, outoff;
int threads = 1;
@@ -3871,10 +3917,12 @@ main(int argc, char **argv)
else
exponent = 65537;
+#ifndef NSS_DISABLE_ECC
if (bltest.options[opt_CurveName].activated)
curveName = PORT_Strdup(bltest.options[opt_CurveName].arg);
else
curveName = NULL;
+#endif
if (bltest.commands[cmd_Verify].activated &&
!bltest.options[opt_SigFile].activated) {
@@ -3960,7 +4008,11 @@ main(int argc, char **argv)
file = PR_Open("tmp.key", PR_WRONLY | PR_CREATE_FILE, 00660);
}
params->key.mode = bltestBase64Encoded;
+#ifndef NSS_DISABLE_ECC
pubkeyInitKey(cipherInfo, file, keysize, exponent, curveName);
+#else
+ pubkeyInitKey(cipherInfo, file, keysize, exponent);
+#endif
PR_Close(file);
}
diff --git a/security/nss/cmd/certcgi/certcgi.c b/security/nss/cmd/certcgi/certcgi.c
index 4d1a1061a5..35409e2500 100644
--- a/security/nss/cmd/certcgi/certcgi.c
+++ b/security/nss/cmd/certcgi/certcgi.c
@@ -233,7 +233,8 @@ make_datastruct(char *data, int len)
if (remaining == 1) {
remaining += fields;
fields = fields * 2;
- datastruct = (Pair *)PORT_Realloc(datastruct, fields * sizeof(Pair));
+ datastruct = (Pair *)PORT_Realloc(datastruct, fields *
+ sizeof(Pair));
if (datastruct == NULL) {
error_allocate();
}
diff --git a/security/nss/cmd/certutil/certutil.c b/security/nss/cmd/certutil/certutil.c
index 03f4478b70..fbc752c1b8 100644
--- a/security/nss/cmd/certutil/certutil.c
+++ b/security/nss/cmd/certutil/certutil.c
@@ -194,8 +194,6 @@ CertReq(SECKEYPrivateKey *privk, SECKEYPublicKey *pubk, KeyType keyType,
PLArenaPool *arena;
void *extHandle;
SECItem signedReq = { siBuffer, NULL, 0 };
- SECAlgorithmID signAlg;
- SECItem *params = NULL;
arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
if (!arena) {
@@ -213,26 +211,11 @@ CertReq(SECKEYPrivateKey *privk, SECKEYPublicKey *pubk, KeyType keyType,
/* Change cert type to RSA-PSS, if desired. */
if (pssCertificate) {
- params = SEC_CreateSignatureAlgorithmParameters(arena,
- NULL,
- SEC_OID_PKCS1_RSA_PSS_SIGNATURE,
- hashAlgTag,
- NULL,
- privk);
- if (!params) {
- PORT_FreeArena(arena, PR_FALSE);
- SECKEY_DestroySubjectPublicKeyInfo(spki);
- SECU_PrintError(progName, "unable to create RSA-PSS parameters");
- return SECFailure;
- }
-
spki->algorithm.parameters.data = NULL;
rv = SECOID_SetAlgorithmID(arena, &spki->algorithm,
- SEC_OID_PKCS1_RSA_PSS_SIGNATURE,
- hashAlgTag == SEC_OID_UNKNOWN ? NULL : params);
+ SEC_OID_PKCS1_RSA_PSS_SIGNATURE, 0);
if (rv != SECSuccess) {
PORT_FreeArena(arena, PR_FALSE);
- SECKEY_DestroySubjectPublicKeyInfo(spki);
SECU_PrintError(progName, "unable to set algorithm ID");
return SECFailure;
}
@@ -273,34 +256,16 @@ CertReq(SECKEYPrivateKey *privk, SECKEYPublicKey *pubk, KeyType keyType,
return SECFailure;
}
- PORT_Memset(&signAlg, 0, sizeof(signAlg));
- if (pssCertificate) {
- rv = SECOID_SetAlgorithmID(arena, &signAlg,
- SEC_OID_PKCS1_RSA_PSS_SIGNATURE, params);
- if (rv != SECSuccess) {
- PORT_FreeArena(arena, PR_FALSE);
- SECU_PrintError(progName, "unable to set algorithm ID");
- return SECFailure;
- }
- } else {
- signAlgTag = SEC_GetSignatureAlgorithmOidTag(keyType, hashAlgTag);
- if (signAlgTag == SEC_OID_UNKNOWN) {
- PORT_FreeArena(arena, PR_FALSE);
- SECU_PrintError(progName, "unknown Key or Hash type");
- return SECFailure;
- }
- rv = SECOID_SetAlgorithmID(arena, &signAlg, signAlgTag, 0);
- if (rv != SECSuccess) {
- PORT_FreeArena(arena, PR_FALSE);
- SECU_PrintError(progName, "unable to set algorithm ID");
- return SECFailure;
- }
+ /* Sign the request */
+ signAlgTag = SEC_GetSignatureAlgorithmOidTag(keyType, hashAlgTag);
+ if (signAlgTag == SEC_OID_UNKNOWN) {
+ PORT_FreeArena(arena, PR_FALSE);
+ SECU_PrintError(progName, "unknown Key or Hash type");
+ return SECFailure;
}
- /* Sign the request */
- rv = SEC_DerSignDataWithAlgorithmID(arena, &signedReq,
- encoding->data, encoding->len,
- privk, &signAlg);
+ rv = SEC_DerSignData(arena, &signedReq, encoding->data, encoding->len,
+ privk, signAlgTag);
if (rv) {
PORT_FreeArena(arena, PR_FALSE);
SECU_PrintError(progName, "signing of data failed");
@@ -400,7 +365,7 @@ ChangeTrustAttributes(CERTCertDBHandle *handle, PK11SlotInfo *slot,
CERTCertificate *cert;
CERTCertTrust *trust;
- cert = CERT_FindCertByNicknameOrEmailAddrCX(handle, name, pwdata);
+ cert = CERT_FindCertByNicknameOrEmailAddr(handle, name);
if (!cert) {
SECU_PrintError(progName, "could not find certificate named \"%s\"",
name);
@@ -626,10 +591,6 @@ ListCerts(CERTCertDBHandle *handle, char *nickname, char *email,
{
SECStatus rv;
- if (slot && PK11_NeedUserInit(slot)) {
- printf("\nDatabase needs user init\n");
- }
-
if (!ascii && !raw && !nickname && !email) {
PR_fprintf(outfile, "\n%-60s %-5s\n%-60s %-5s\n\n",
"Certificate Nickname", "Trust Attributes", "",
@@ -653,12 +614,12 @@ ListCerts(CERTCertDBHandle *handle, char *nickname, char *email,
}
static SECStatus
-DeleteCert(CERTCertDBHandle *handle, char *name, void *pwdata)
+DeleteCert(CERTCertDBHandle *handle, char *name)
{
SECStatus rv;
CERTCertificate *cert;
- cert = CERT_FindCertByNicknameOrEmailAddrCX(handle, name, pwdata);
+ cert = CERT_FindCertByNicknameOrEmailAddr(handle, name);
if (!cert) {
SECU_PrintError(progName, "could not find certificate named \"%s\"",
name);
@@ -674,12 +635,12 @@ DeleteCert(CERTCertDBHandle *handle, char *name, void *pwdata)
}
static SECStatus
-RenameCert(CERTCertDBHandle *handle, char *name, char *newName, void *pwdata)
+RenameCert(CERTCertDBHandle *handle, char *name, char *newName)
{
SECStatus rv;
CERTCertificate *cert;
- cert = CERT_FindCertByNicknameOrEmailAddrCX(handle, name, pwdata);
+ cert = CERT_FindCertByNicknameOrEmailAddr(handle, name);
if (!cert) {
SECU_PrintError(progName, "could not find certificate named \"%s\"",
name);
@@ -1054,18 +1015,6 @@ ListModules(void)
}
static void
-PrintBuildFlags()
-{
-#ifdef NSS_FIPS_DISABLED
- PR_fprintf(PR_STDOUT, "NSS_FIPS_DISABLED\n");
-#endif
-#ifdef NSS_NO_INIT_SUPPORT
- PR_fprintf(PR_STDOUT, "NSS_NO_INIT_SUPPORT\n");
-#endif
- exit(0);
-}
-
-static void
PrintSyntax(char *progName)
{
#define FPS fprintf(stderr,
@@ -1095,10 +1044,15 @@ PrintSyntax(char *progName)
"\t\t [-f pwfile] [-z noisefile] [-d certdir] [-P dbprefix]\n", progName);
FPS "\t%s -G [-h token-name] -k dsa [-q pqgfile -g key-size] [-f pwfile]\n"
"\t\t [-z noisefile] [-d certdir] [-P dbprefix]\n", progName);
+#ifndef NSS_DISABLE_ECC
FPS "\t%s -G [-h token-name] -k ec -q curve [-f pwfile]\n"
"\t\t [-z noisefile] [-d certdir] [-P dbprefix]\n", progName);
FPS "\t%s -K [-n key-name] [-h token-name] [-k dsa|ec|rsa|all]\n",
progName);
+#else
+ FPS "\t%s -K [-n key-name] [-h token-name] [-k dsa|rsa|all]\n",
+ progName);
+#endif /* NSS_DISABLE_ECC */
FPS "\t\t [-f pwfile] [-X] [-d certdir] [-P dbprefix]\n");
FPS "\t%s --upgrade-merge --source-dir upgradeDir --upgrade-id uniqueID\n",
progName);
@@ -1112,7 +1066,6 @@ PrintSyntax(char *progName)
FPS "\t%s -L [-n cert-name] [-h token-name] [--email email-address]\n",
progName);
FPS "\t\t [-X] [-r] [-a] [--dump-ext-val OID] [-d certdir] [-P dbprefix]\n");
- FPS "\t%s --build-flags\n", progName);
FPS "\t%s -M -n cert-name -t trustargs [-d certdir] [-P dbprefix]\n",
progName);
FPS "\t%s -O -n cert-name [-X] [-d certdir] [-a] [-P dbprefix]\n", progName);
@@ -1231,8 +1184,6 @@ luC(enum usage_level ul, const char *command)
" -o output-cert");
FPS "%-20s Self sign\n",
" -x");
- FPS "%-20s Sign the certificate with RSA-PSS (the issuer key must be rsa)\n",
- " --pss-sign");
FPS "%-20s Cert serial number\n",
" -m serial-number");
FPS "%-20s Time Warp\n",
@@ -1293,10 +1244,17 @@ luG(enum usage_level ul, const char *command)
return;
FPS "%-20s Name of token in which to generate key (default is internal)\n",
" -h token-name");
+#ifndef NSS_DISABLE_ECC
FPS "%-20s Type of key pair to generate (\"dsa\", \"ec\", \"rsa\" (default))\n",
" -k key-type");
FPS "%-20s Key size in bits, (min %d, max %d, default %d) (not for ec)\n",
" -g key-size", MIN_KEY_BITS, MAX_KEY_BITS, DEFAULT_KEY_BITS);
+#else
+ FPS "%-20s Type of key pair to generate (\"dsa\", \"rsa\" (default))\n",
+ " -k key-type");
+ FPS "%-20s Key size in bits, (min %d, max %d, default %d)\n",
+ " -g key-size", MIN_KEY_BITS, MAX_KEY_BITS, DEFAULT_KEY_BITS);
+#endif /* NSS_DISABLE_ECC */
FPS "%-20s Set the public exponent value (3, 17, 65537) (rsa only)\n",
" -y exp");
FPS "%-20s Specify the password file\n",
@@ -1305,6 +1263,7 @@ luG(enum usage_level ul, const char *command)
" -z noisefile");
FPS "%-20s read PQG value from pqgfile (dsa only)\n",
" -q pqgfile");
+#ifndef NSS_DISABLE_ECC
FPS "%-20s Elliptic curve name (ec only)\n",
" -q curve-name");
FPS "%-20s One of nistp256, nistp384, nistp521, curve25519.\n", "");
@@ -1326,6 +1285,7 @@ luG(enum usage_level ul, const char *command)
FPS "%-20s c2tnb359w1, c2pnb368w1, c2tnb431r1, secp112r1, \n", "");
FPS "%-20s secp112r2, secp128r1, secp128r2, sect113r1, sect113r2\n", "");
FPS "%-20s sect131r1, sect131r2\n", "");
+#endif
FPS "%-20s Key database directory (default is ~/.netscape)\n",
" -d keydir");
FPS "%-20s Cert & Key database prefix\n",
@@ -1415,7 +1375,9 @@ luK(enum usage_level ul, const char *command)
" -h token-name ");
FPS "%-20s Key type (\"all\" (default), \"dsa\","
+#ifndef NSS_DISABLE_ECC
" \"ec\","
+#endif
" \"rsa\")\n",
" -k key-type");
FPS "%-20s The nickname of the key or associated certificate\n",
@@ -1558,7 +1520,11 @@ luR(enum usage_level ul, const char *command)
" -s subject");
FPS "%-20s Output the cert request to this file\n",
" -o output-req");
+#ifndef NSS_DISABLE_ECC
FPS "%-20s Type of key pair to generate (\"dsa\", \"ec\", \"rsa\" (default))\n",
+#else
+ FPS "%-20s Type of key pair to generate (\"dsa\", \"rsa\" (default))\n",
+#endif /* NSS_DISABLE_ECC */
" -k key-type-or-id");
FPS "%-20s or nickname of the cert key to use \n",
"");
@@ -1566,14 +1532,14 @@ luR(enum usage_level ul, const char *command)
" -h token-name");
FPS "%-20s Key size in bits, RSA keys only (min %d, max %d, default %d)\n",
" -g key-size", MIN_KEY_BITS, MAX_KEY_BITS, DEFAULT_KEY_BITS);
- FPS "%-20s Create a certificate request restricted to RSA-PSS (rsa only)\n",
- " --pss");
FPS "%-20s Name of file containing PQG parameters (dsa only)\n",
" -q pqgfile");
+#ifndef NSS_DISABLE_ECC
FPS "%-20s Elliptic curve name (ec only)\n",
" -q curve-name");
FPS "%-20s See the \"-G\" option for a full list of supported names.\n",
"");
+#endif /* NSS_DISABLE_ECC */
FPS "%-20s Specify the password file\n",
" -f pwfile");
FPS "%-20s Key database directory (default is ~/.netscape)\n",
@@ -1739,24 +1705,26 @@ luS(enum usage_level ul, const char *command)
" -c issuer-name");
FPS "%-20s Set the certificate trust attributes (see -A above)\n",
" -t trustargs");
+#ifndef NSS_DISABLE_ECC
FPS "%-20s Type of key pair to generate (\"dsa\", \"ec\", \"rsa\" (default))\n",
+#else
+ FPS "%-20s Type of key pair to generate (\"dsa\", \"rsa\" (default))\n",
+#endif /* NSS_DISABLE_ECC */
" -k key-type-or-id");
FPS "%-20s Name of token in which to generate key (default is internal)\n",
" -h token-name");
FPS "%-20s Key size in bits, RSA keys only (min %d, max %d, default %d)\n",
" -g key-size", MIN_KEY_BITS, MAX_KEY_BITS, DEFAULT_KEY_BITS);
- FPS "%-20s Create a certificate restricted to RSA-PSS (rsa only)\n",
- " --pss");
FPS "%-20s Name of file containing PQG parameters (dsa only)\n",
" -q pqgfile");
+#ifndef NSS_DISABLE_ECC
FPS "%-20s Elliptic curve name (ec only)\n",
" -q curve-name");
FPS "%-20s See the \"-G\" option for a full list of supported names.\n",
"");
+#endif /* NSS_DISABLE_ECC */
FPS "%-20s Self sign\n",
" -x");
- FPS "%-20s Sign the certificate with RSA-PSS (the issuer key must be rsa)\n",
- " --pss-sign");
FPS "%-20s Cert serial number\n",
" -m serial-number");
FPS "%-20s Time Warp\n",
@@ -1826,18 +1794,6 @@ luS(enum usage_level ul, const char *command)
}
static void
-luBuildFlags(enum usage_level ul, const char *command)
-{
- int is_my_command = (command && 0 == strcmp(command, "build-flags"));
- if (ul == usage_all || !command || is_my_command)
- FPS "%-15s Print enabled build flags relevant for NSS test execution\n",
- "--build-flags");
- if (ul == usage_selected && !is_my_command)
- return;
- FPS "\n");
-}
-
-static void
LongUsage(char *progName, enum usage_level ul, const char *command)
{
luA(ul, command);
@@ -1851,7 +1807,6 @@ LongUsage(char *progName, enum usage_level ul, const char *command)
luU(ul, command);
luK(ul, command);
luL(ul, command);
- luBuildFlags(ul, command);
luM(ul, command);
luN(ul, command);
luT(ul, command);
@@ -1934,119 +1889,46 @@ MakeV1Cert(CERTCertDBHandle *handle,
}
static SECStatus
-SetSignatureAlgorithm(PLArenaPool *arena,
- SECAlgorithmID *signAlg,
- SECAlgorithmID *spkiAlg,
- SECOidTag hashAlgTag,
- SECKEYPrivateKey *privKey,
- PRBool pssSign)
-{
- SECStatus rv;
-
- if (pssSign ||
- SECOID_GetAlgorithmTag(spkiAlg) == SEC_OID_PKCS1_RSA_PSS_SIGNATURE) {
- SECItem *srcParams;
- SECItem *params;
-
- if (SECOID_GetAlgorithmTag(spkiAlg) == SEC_OID_PKCS1_RSA_PSS_SIGNATURE) {
- srcParams = &spkiAlg->parameters;
- } else {
- /* If the issuer's public key is RSA, the parameter field
- * of the SPKI should be NULL, which can't be used as a
- * basis of RSA-PSS parameters. */
- srcParams = NULL;
- }
- params = SEC_CreateSignatureAlgorithmParameters(arena,
- NULL,
- SEC_OID_PKCS1_RSA_PSS_SIGNATURE,
- hashAlgTag,
- srcParams,
- privKey);
- if (!params) {
- SECU_PrintError(progName, "Could not create RSA-PSS parameters");
- return SECFailure;
- }
- rv = SECOID_SetAlgorithmID(arena, signAlg,
- SEC_OID_PKCS1_RSA_PSS_SIGNATURE,
- params);
- if (rv != SECSuccess) {
- SECU_PrintError(progName, "Could not set signature algorithm id.");
- return rv;
- }
- } else {
- KeyType keyType = SECKEY_GetPrivateKeyType(privKey);
- SECOidTag algID;
-
- algID = SEC_GetSignatureAlgorithmOidTag(keyType, hashAlgTag);
- if (algID == SEC_OID_UNKNOWN) {
- SECU_PrintError(progName, "Unknown key or hash type for issuer.");
- return SECFailure;
- }
- rv = SECOID_SetAlgorithmID(arena, signAlg, algID, 0);
- if (rv != SECSuccess) {
- SECU_PrintError(progName, "Could not set signature algorithm id.");
- return rv;
- }
- }
- return SECSuccess;
-}
-
-static SECStatus
SignCert(CERTCertDBHandle *handle, CERTCertificate *cert, PRBool selfsign,
SECOidTag hashAlgTag,
SECKEYPrivateKey *privKey, char *issuerNickName,
- int certVersion, PRBool pssSign, void *pwarg)
+ int certVersion, void *pwarg)
{
SECItem der;
SECKEYPrivateKey *caPrivateKey = NULL;
SECStatus rv;
PLArenaPool *arena;
- CERTCertificate *issuer;
+ SECOidTag algID;
void *dummy;
- arena = cert->arena;
-
- if (selfsign) {
- issuer = cert;
- } else {
- issuer = PK11_FindCertFromNickname(issuerNickName, pwarg);
+ if (!selfsign) {
+ CERTCertificate *issuer = PK11_FindCertFromNickname(issuerNickName, pwarg);
if ((CERTCertificate *)NULL == issuer) {
SECU_PrintError(progName, "unable to find issuer with nickname %s",
issuerNickName);
- rv = SECFailure;
- goto done;
+ return SECFailure;
}
+
privKey = caPrivateKey = PK11_FindKeyByAnyCert(issuer, pwarg);
+ CERT_DestroyCertificate(issuer);
if (caPrivateKey == NULL) {
SECU_PrintError(progName, "unable to retrieve key %s", issuerNickName);
- rv = SECFailure;
- CERT_DestroyCertificate(issuer);
- goto done;
+ return SECFailure;
}
}
- if (pssSign &&
- (SECKEY_GetPrivateKeyType(privKey) != rsaKey &&
- SECKEY_GetPrivateKeyType(privKey) != rsaPssKey)) {
- SECU_PrintError(progName, "unable to create RSA-PSS signature with key %s",
- issuerNickName);
+ arena = cert->arena;
+
+ algID = SEC_GetSignatureAlgorithmOidTag(privKey->keyType, hashAlgTag);
+ if (algID == SEC_OID_UNKNOWN) {
+ fprintf(stderr, "Unknown key or hash type for issuer.");
rv = SECFailure;
- if (!selfsign) {
- CERT_DestroyCertificate(issuer);
- }
goto done;
}
- rv = SetSignatureAlgorithm(arena,
- &cert->signature,
- &issuer->subjectPublicKeyInfo.algorithm,
- hashAlgTag,
- privKey,
- pssSign);
- if (!selfsign) {
- CERT_DestroyCertificate(issuer);
- }
+ rv = SECOID_SetAlgorithmID(arena, &cert->signature, algID, 0);
if (rv != SECSuccess) {
+ fprintf(stderr, "Could not set signature algorithm id.");
goto done;
}
@@ -2065,8 +1947,7 @@ SignCert(CERTCertDBHandle *handle, CERTCertificate *cert, PRBool selfsign,
break;
default:
PORT_SetError(SEC_ERROR_INVALID_ARGS);
- rv = SECFailure;
- goto done;
+ return SECFailure;
}
der.len = 0;
@@ -2079,8 +1960,7 @@ SignCert(CERTCertDBHandle *handle, CERTCertificate *cert, PRBool selfsign,
goto done;
}
- rv = SEC_DerSignDataWithAlgorithmID(arena, &cert->derCert, der.data, der.len,
- privKey, &cert->signature);
+ rv = SEC_DerSignData(arena, &cert->derCert, der.data, der.len, privKey, algID);
if (rv != SECSuccess) {
fprintf(stderr, "Could not sign encoded certificate data.\n");
/* result allocated out of the arena, it will be freed
@@ -2113,7 +1993,6 @@ CreateCert(
certutilExtnList extnList,
const char *extGeneric,
int certVersion,
- PRBool pssSign,
SECItem *certDER)
{
void *extHandle = NULL;
@@ -2174,7 +2053,7 @@ CreateCert(
rv = SignCert(handle, subjectCert, selfsign, hashAlgTag,
*selfsignprivkey, issuerNickName,
- certVersion, pssSign, pwarg);
+ certVersion, pwarg);
if (rv != SECSuccess)
break;
@@ -2427,7 +2306,6 @@ enum {
cmd_Merge,
cmd_UpgradeMerge, /* test only */
cmd_Rename,
- cmd_BuildFlags,
max_cmd
};
@@ -2498,7 +2376,6 @@ enum certutilOpts {
opt_GenericExtensions,
opt_NewNickname,
opt_Pss,
- opt_PssSign,
opt_Help
};
@@ -2530,9 +2407,7 @@ static const secuCommandFlag commands_init[] =
{ /* cmd_UpgradeMerge */ 0, PR_FALSE, 0, PR_FALSE,
"upgrade-merge" },
{ /* cmd_Rename */ 0, PR_FALSE, 0, PR_FALSE,
- "rename" },
- { /* cmd_BuildFlags */ 0, PR_FALSE, 0, PR_FALSE,
- "build-flags" }
+ "rename" }
};
#define NUM_COMMANDS ((sizeof commands_init) / (sizeof commands_init[0]))
@@ -2621,8 +2496,6 @@ static const secuCommandFlag options_init[] =
"new-n" },
{ /* opt_Pss */ 0, PR_FALSE, 0, PR_FALSE,
"pss" },
- { /* opt_PssSign */ 0, PR_FALSE, 0, PR_FALSE,
- "pss-sign" },
};
#define NUM_OPTIONS ((sizeof options_init) / (sizeof options_init[0]))
@@ -2719,10 +2592,6 @@ certutil_main(int argc, char **argv, PRBool initialize)
exit(1);
}
- if (certutil.commands[cmd_BuildFlags].activated) {
- PrintBuildFlags();
- }
-
if (certutil.options[opt_PasswordFile].arg) {
pwdata.source = PW_FROMFILE;
pwdata.data = certutil.options[opt_PasswordFile].arg;
@@ -2752,10 +2621,12 @@ certutil_main(int argc, char **argv, PRBool initialize)
progName, MIN_KEY_BITS, MAX_KEY_BITS);
return 255;
}
+#ifndef NSS_DISABLE_ECC
if (keytype == ecKey) {
PR_fprintf(PR_STDERR, "%s -g: Not for ec keys.\n", progName);
return 255;
}
+#endif /* NSS_DISABLE_ECC */
}
/* -h specify token name */
@@ -2784,8 +2655,10 @@ certutil_main(int argc, char **argv, PRBool initialize)
keytype = rsaKey;
} else if (PL_strcmp(arg, "dsa") == 0) {
keytype = dsaKey;
+#ifndef NSS_DISABLE_ECC
} else if (PL_strcmp(arg, "ec") == 0) {
keytype = ecKey;
+#endif /* NSS_DISABLE_ECC */
} else if (PL_strcmp(arg, "all") == 0) {
keytype = nullKey;
} else {
@@ -2838,10 +2711,16 @@ certutil_main(int argc, char **argv, PRBool initialize)
/* -q PQG file or curve name */
if (certutil.options[opt_PQGFile].activated) {
+#ifndef NSS_DISABLE_ECC
if ((keytype != dsaKey) && (keytype != ecKey)) {
PR_fprintf(PR_STDERR, "%s -q: specifies a PQG file for DSA keys"
" (-k dsa) or a named curve for EC keys (-k ec)\n)",
progName);
+#else /* } */
+ if (keytype != dsaKey) {
+ PR_fprintf(PR_STDERR, "%s -q: PQG file is for DSA key (-k dsa).\n)",
+ progName);
+#endif /* NSS_DISABLE_ECC */
return 255;
}
}
@@ -3153,43 +3032,11 @@ certutil_main(int argc, char **argv, PRBool initialize)
/* If creating new database, initialize the password. */
if (certutil.commands[cmd_NewDBs].activated) {
- if (certutil.options[opt_EmptyPassword].activated && (PK11_NeedUserInit(slot))) {
- rv = PK11_InitPin(slot, (char *)NULL, "");
- } else {
- rv = SECU_ChangePW2(slot, 0, 0, certutil.options[opt_PasswordFile].arg,
- certutil.options[opt_NewPasswordFile].arg);
- }
- if (rv != SECSuccess) {
- SECU_PrintError(progName, "Could not set password for the slot");
- goto shutdown;
- }
- }
-
- /* if we are going to modify the cert database,
- * make sure it's initialized */
- if (certutil.commands[cmd_ModifyCertTrust].activated ||
- certutil.commands[cmd_CreateAndAddCert].activated ||
- certutil.commands[cmd_AddCert].activated ||
- certutil.commands[cmd_AddEmailCert].activated) {
- if (PK11_NeedLogin(slot) && PK11_NeedUserInit(slot)) {
- char *password = NULL;
- /* fetch the password from the command line or the file
- * if no password is supplied, initialize the password to NULL */
- if (pwdata.source == PW_FROMFILE) {
- password = SECU_FilePasswd(slot, PR_FALSE, pwdata.data);
- } else if (pwdata.source == PW_PLAINTEXT) {
- password = PL_strdup(pwdata.data);
- }
- rv = PK11_InitPin(slot, (char *)NULL, password ? password : "");
- if (password) {
- PORT_Memset(password, 0, PL_strlen(password));
- PORT_Free(password);
- }
- if (rv != SECSuccess) {
- SECU_PrintError(progName, "Could not set password for the slot");
- goto shutdown;
- }
- }
+ if (certutil.options[opt_EmptyPassword].activated && (PK11_NeedUserInit(slot)))
+ PK11_InitPin(slot, (char *)NULL, "");
+ else
+ SECU_ChangePW2(slot, 0, 0, certutil.options[opt_PasswordFile].arg,
+ certutil.options[opt_NewPasswordFile].arg);
}
/* walk through the upgrade merge if necessary.
@@ -3367,12 +3214,12 @@ certutil_main(int argc, char **argv, PRBool initialize)
}
/* Delete cert (-D) */
if (certutil.commands[cmd_DeleteCert].activated) {
- rv = DeleteCert(certHandle, name, &pwdata);
+ rv = DeleteCert(certHandle, name);
goto shutdown;
}
/* Rename cert (--rename) */
if (certutil.commands[cmd_Rename].activated) {
- rv = RenameCert(certHandle, name, newName, &pwdata);
+ rv = RenameCert(certHandle, name, newName);
goto shutdown;
}
/* Delete key (-F) */
@@ -3390,10 +3237,7 @@ certutil_main(int argc, char **argv, PRBool initialize)
if (certutil.commands[cmd_ChangePassword].activated) {
rv = SECU_ChangePW2(slot, 0, 0, certutil.options[opt_PasswordFile].arg,
certutil.options[opt_NewPasswordFile].arg);
- if (rv != SECSuccess) {
- SECU_PrintError(progName, "Could not set password for the slot");
- goto shutdown;
- }
+ goto shutdown;
}
/* Reset the a token */
if (certutil.commands[cmd_TokenReset].activated) {
@@ -3518,25 +3362,6 @@ certutil_main(int argc, char **argv, PRBool initialize)
}
}
- /* --pss-sign is to sign a certificate with RSA-PSS, even if the
- * issuer's key is an RSA key. If the key is an RSA-PSS key, the
- * generated signature is always RSA-PSS. */
- if (certutil.options[opt_PssSign].activated) {
- if (!certutil.commands[cmd_CreateNewCert].activated &&
- !certutil.commands[cmd_CreateAndAddCert].activated) {
- PR_fprintf(PR_STDERR,
- "%s -%c: --pss-sign only works with -C or -S.\n",
- progName, commandToRun);
- return 255;
- }
- if (keytype != rsaKey) {
- PR_fprintf(PR_STDERR,
- "%s -%c: --pss-sign only works with RSA keys.\n",
- progName, commandToRun);
- return 255;
- }
- }
-
/* If we need a list of extensions convert the flags into list format */
if (certutil.commands[cmd_CertReq].activated ||
certutil.commands[cmd_CreateAndAddCert].activated ||
@@ -3674,7 +3499,6 @@ certutil_main(int argc, char **argv, PRBool initialize)
(certutil.options[opt_GenericExtensions].activated ? certutil.options[opt_GenericExtensions].arg
: NULL),
certVersion,
- certutil.options[opt_PssSign].activated,
&certDER);
if (rv)
goto shutdown;
diff --git a/security/nss/cmd/certutil/keystuff.c b/security/nss/cmd/certutil/keystuff.c
index 330284c61c..2878e3765d 100644
--- a/security/nss/cmd/certutil/keystuff.c
+++ b/security/nss/cmd/certutil/keystuff.c
@@ -380,6 +380,7 @@ CERTUTIL_FileForRNG(const char *noise)
return SECSuccess;
}
+#ifndef NSS_DISABLE_ECC
typedef struct curveNameTagPairStr {
char *curveName;
SECOidTag curveOidTag;
@@ -494,9 +495,9 @@ getECParams(const char *curve)
ecparams = SECITEM_AllocItem(NULL, NULL, (2 + oidData->oid.len));
- /*
+ /*
* ecparams->data needs to contain the ASN encoding of an object ID (OID)
- * representing the named curve. The actual OID is in
+ * representing the named curve. The actual OID is in
* oidData->oid.data so we simply prepend 0x06 and OID length
*/
ecparams->data[0] = SEC_ASN1_OBJECT_ID;
@@ -505,6 +506,7 @@ getECParams(const char *curve)
return ecparams;
}
+#endif /* NSS_DISABLE_ECC */
SECKEYPrivateKey *
CERTUTIL_GeneratePrivateKey(KeyType keytype, PK11SlotInfo *slot, int size,
@@ -562,12 +564,14 @@ CERTUTIL_GeneratePrivateKey(KeyType keytype, PK11SlotInfo *slot, int size,
params = (void *)&default_pqg_params;
}
break;
+#ifndef NSS_DISABLE_ECC
case ecKey:
mechanism = CKM_EC_KEY_PAIR_GEN;
/* For EC keys, PQGFile determines EC parameters */
if ((params = (void *)getECParams(pqgFile)) == NULL)
return NULL;
break;
+#endif /* NSS_DISABLE_ECC */
default:
return NULL;
}
@@ -576,7 +580,8 @@ CERTUTIL_GeneratePrivateKey(KeyType keytype, PK11SlotInfo *slot, int size,
fprintf(stderr, "Generating key. This may take a few moments...\n\n");
privKey = PK11_GenerateKeyPairWithOpFlags(slot, mechanism, params, pubkeyp,
- attrFlags, opFlagsOn, opFlagsOn | opFlagsOff,
+ attrFlags, opFlagsOn, opFlagsOn |
+ opFlagsOff,
pwdata /*wincx*/);
/* free up the params */
switch (keytype) {
@@ -584,9 +589,11 @@ CERTUTIL_GeneratePrivateKey(KeyType keytype, PK11SlotInfo *slot, int size,
if (dsaparams)
CERTUTIL_DestroyParamsPQG(dsaparams);
break;
+#ifndef NSS_DISABLE_ECC
case ecKey:
SECITEM_FreeItem((SECItem *)params, PR_TRUE);
break;
+#endif
default: /* nothing to free */
break;
}
diff --git a/security/nss/cmd/crlutil/crlgen.c b/security/nss/cmd/crlutil/crlgen.c
index fce5e2a601..1f9dc4b438 100644
--- a/security/nss/cmd/crlutil/crlgen.c
+++ b/security/nss/cmd/crlutil/crlgen.c
@@ -616,7 +616,8 @@ crlgen_CreateInvalidityDate(PLArenaPool *arena, const char **dataArr,
goto loser;
}
- PORT_Memcpy(encodedItem->data, dataArr[2], (encodedItem->len = length) * sizeof(char));
+ PORT_Memcpy(encodedItem->data, dataArr[2], (encodedItem->len = length) *
+ sizeof(char));
*extCode = SEC_OID_X509_INVALID_DATE;
return encodedItem;
diff --git a/security/nss/cmd/fipstest/fipstest.c b/security/nss/cmd/fipstest/fipstest.c
index 061f3dde09..ab73e42a50 100644
--- a/security/nss/cmd/fipstest/fipstest.c
+++ b/security/nss/cmd/fipstest/fipstest.c
@@ -35,11 +35,13 @@
#include "../../lib/freebl/mpi/mpi.h"
#endif
+#ifndef NSS_DISABLE_ECC
extern SECStatus
EC_DecodeParams(const SECItem *encodedParams, ECParams **ecparams);
extern SECStatus
EC_CopyParams(PLArenaPool *arena, ECParams *dstParams,
const ECParams *srcParams);
+#endif
#define ENCRYPT 1
#define DECRYPT 0
@@ -2092,6 +2094,7 @@ get_next_line(FILE *req, char *key, char *val, FILE *rsp)
return (c == EOF) ? -1 : ignore;
}
+#ifndef NSS_DISABLE_ECC
typedef struct curveNameTagPairStr {
char *curveName;
SECOidTag curveOidTag;
@@ -2955,6 +2958,7 @@ loser:
}
fclose(ecdsareq);
}
+#endif /* NSS_DISABLE_ECC */
PRBool
isblankline(char *b)
@@ -5922,7 +5926,8 @@ tls(char *reqfn)
goto loser;
}
crv = NSC_DeriveKey(session, &master_mech, pms_handle,
- derive_template, derive_template_count - 1,
+ derive_template, derive_template_count -
+ 1,
&master_handle);
if (crv != CKR_OK) {
fprintf(stderr, "NSC_DeriveKey(master) failed crv=0x%x\n",
@@ -6089,6 +6094,7 @@ main(int argc, char **argv)
/* Signature Verification Test */
dsa_sigver_test(argv[3]);
}
+#ifndef NSS_DISABLE_ECC
/*************/
/* ECDSA */
/*************/
@@ -6107,6 +6113,7 @@ main(int argc, char **argv)
/* Signature Verification Test */
ecdsa_sigver_test(argv[3]);
}
+#endif /* NSS_DISABLE_ECC */
/*************/
/* RNG */
/*************/
diff --git a/security/nss/cmd/fipstest/runtest.sh b/security/nss/cmd/fipstest/runtest.sh
index 5f8e66a081..99cefed773 100644
--- a/security/nss/cmd/fipstest/runtest.sh
+++ b/security/nss/cmd/fipstest/runtest.sh
@@ -7,6 +7,9 @@
TESTDIR=${1-.}
COMMAND=${2-run}
TESTS="aes aesgcm dsa ecdsa hmac tls rng rsa sha tdea"
+if [ ${NSS_ENABLE_ECC}x = 1x ]; then
+ TESTS=${TESTS} ecdsa
+fi
for i in $TESTS
do
echo "********************Running $i tests"
diff --git a/security/nss/cmd/lib/secutil.c b/security/nss/cmd/lib/secutil.c
index 2b33f89633..cb4752df9c 100644
--- a/security/nss/cmd/lib/secutil.c
+++ b/security/nss/cmd/lib/secutil.c
@@ -54,10 +54,6 @@ static char consoleName[] = {
static PRBool utf8DisplayEnabled = PR_FALSE;
-/* The minimum password/pin length (in Unicode characters) in FIPS mode,
- * defined in lib/softoken/pkcs11i.h. */
-#define FIPS_MIN_PIN 7
-
void
SECU_EnableUtf8Display(PRBool enable)
{
@@ -240,8 +236,7 @@ SECU_GetModulePassword(PK11SlotInfo *slot, PRBool retry, void *arg)
sprintf(prompt,
"Press Enter, then enter PIN for \"%s\" on external device.\n",
PK11_GetTokenName(slot));
- char *pw = SECU_GetPasswordString(NULL, prompt);
- PORT_Free(pw);
+ (void)SECU_GetPasswordString(NULL, prompt);
/* Fall Through */
case PW_PLAINTEXT:
return PL_strdup(pwdata->data);
@@ -281,25 +276,10 @@ secu_InitSlotPassword(PK11SlotInfo *slot, PRBool retry, void *arg)
}
/* we have no password, so initialize database with one */
- if (PK11_IsFIPS()) {
- PR_fprintf(PR_STDERR,
- "Enter a password which will be used to encrypt your keys.\n"
- "The password should be at least %d characters long,\n"
- "and should consist of at least three character classes.\n"
- "The available character classes are: digits (0-9), ASCII\n"
- "lowercase letters, ASCII uppercase letters, ASCII\n"
- "non-alphanumeric characters, and non-ASCII characters.\n\n"
- "If an ASCII uppercase letter appears at the beginning of\n"
- "the password, it is not counted toward its character class.\n"
- "Similarly, if a digit appears at the end of the password,\n"
- "it is not counted toward its character class.\n\n",
- FIPS_MIN_PIN);
- } else {
- PR_fprintf(PR_STDERR,
- "Enter a password which will be used to encrypt your keys.\n"
- "The password should be at least 8 characters long,\n"
- "and should contain at least one non-alphabetic character.\n\n");
- }
+ PR_fprintf(PR_STDERR,
+ "Enter a password which will be used to encrypt your keys.\n"
+ "The password should be at least 8 characters long,\n"
+ "and should contain at least one non-alphabetic character.\n\n");
output = fopen(consoleName, "w");
if (output == NULL) {
@@ -485,6 +465,48 @@ SECU_ConfigDirectory(const char *base)
return buf;
}
+/*Turn off SSL for now */
+/* This gets called by SSL when server wants our cert & key */
+int
+SECU_GetClientAuthData(void *arg, PRFileDesc *fd,
+ struct CERTDistNamesStr *caNames,
+ struct CERTCertificateStr **pRetCert,
+ struct SECKEYPrivateKeyStr **pRetKey)
+{
+ SECKEYPrivateKey *key;
+ CERTCertificate *cert;
+ int errsave;
+
+ if (arg == NULL) {
+ fprintf(stderr, "no key/cert name specified for client auth\n");
+ return -1;
+ }
+ cert = PK11_FindCertFromNickname(arg, NULL);
+ errsave = PORT_GetError();
+ if (!cert) {
+ if (errsave == SEC_ERROR_BAD_PASSWORD)
+ fprintf(stderr, "Bad password\n");
+ else if (errsave > 0)
+ fprintf(stderr, "Unable to read cert (error %d)\n", errsave);
+ else if (errsave == SEC_ERROR_BAD_DATABASE)
+ fprintf(stderr, "Unable to get cert from database (%d)\n", errsave);
+ else
+ fprintf(stderr, "SECKEY_FindKeyByName: internal error %d\n", errsave);
+ return -1;
+ }
+
+ key = PK11_FindKeyByAnyCert(arg, NULL);
+ if (!key) {
+ fprintf(stderr, "Unable to get key (%d)\n", PORT_GetError());
+ return -1;
+ }
+
+ *pRetCert = cert;
+ *pRetKey = key;
+
+ return 0;
+}
+
SECStatus
SECU_ReadDERFromFile(SECItem *der, PRFileDesc *inFile, PRBool ascii,
PRBool warnOnPrivateKeyInAsciiFile)
@@ -969,7 +991,7 @@ secu_PrintUniversalString(FILE *out, const SECItem *i, const char *m, int level)
for (s = my.data, d = tmp.data; len > 0; len--) {
PRUint32 bmpChar = (s[0] << 24) | (s[1] << 16) | (s[2] << 8) | s[3];
s += 4;
- if (!isprint(bmpChar & 0xFF))
+ if (!isprint(bmpChar))
goto loser;
*d++ = (unsigned char)bmpChar;
}
@@ -1193,7 +1215,7 @@ secu_PrintRSAPSSParams(FILE *out, SECItem *value, char *m, int level)
SECU_Indent(out, level + 1);
fprintf(out, "Salt length: default, %i (0x%2X)\n", 20, 20);
} else {
- SECU_PrintInteger(out, &param.saltLength, "Salt length", level + 1);
+ SECU_PrintInteger(out, &param.saltLength, "Salt Length", level + 1);
}
} else {
SECU_Indent(out, level + 1);
@@ -1313,12 +1335,15 @@ SECU_PrintAlgorithmID(FILE *out, SECAlgorithmID *a, char *m, int level)
return;
}
+ if (algtag == SEC_OID_PKCS1_RSA_PSS_SIGNATURE) {
+ secu_PrintRSAPSSParams(out, &a->parameters, "Parameters", level + 1);
+ return;
+ }
+
if (a->parameters.len == 0 ||
(a->parameters.len == 2 &&
PORT_Memcmp(a->parameters.data, "\005\000", 2) == 0)) {
/* No arguments or NULL argument */
- } else if (algtag == SEC_OID_PKCS1_RSA_PSS_SIGNATURE) {
- secu_PrintRSAPSSParams(out, &a->parameters, "Parameters", level + 1);
} else {
/* Print args to algorithm */
SECU_PrintAsHex(out, &a->parameters, "Args", level + 1);
@@ -1365,6 +1390,7 @@ secu_PrintAttribute(FILE *out, SEC_PKCS7Attribute *attr, char *m, int level)
}
}
+#ifndef NSS_DISABLE_ECC
static void
secu_PrintECPublicKey(FILE *out, SECKEYPublicKey *pk, char *m, int level)
{
@@ -1383,6 +1409,7 @@ secu_PrintECPublicKey(FILE *out, SECKEYPublicKey *pk, char *m, int level)
SECU_PrintObjectID(out, &curveOID, "Curve", level + 1);
}
}
+#endif /* NSS_DISABLE_ECC */
void
SECU_PrintRSAPublicKey(FILE *out, SECKEYPublicKey *pk, char *m, int level)
@@ -1430,9 +1457,11 @@ secu_PrintSubjectPublicKeyInfo(FILE *out, PLArenaPool *arena,
SECU_PrintDSAPublicKey(out, pk, "DSA Public Key", level + 1);
break;
+#ifndef NSS_DISABLE_ECC
case ecKey:
secu_PrintECPublicKey(out, pk, "EC Public Key", level + 1);
break;
+#endif
case dhKey:
case fortezzaKey:
@@ -3585,6 +3614,44 @@ loser:
return rv;
}
+#if 0
+
+/* we need access to the private function cert_FindExtension for this code to work */
+
+CERTAuthKeyID *
+SECU_FindCRLAuthKeyIDExten (PLArenaPool *arena, CERTSignedCrl *scrl)
+{
+ SECItem encodedExtenValue;
+ SECStatus rv;
+ CERTAuthKeyID *ret;
+ CERTCrl* crl;
+
+ if (!scrl) {
+ PORT_SetError(SEC_ERROR_INVALID_ARGS);
+ return NULL;
+ }
+
+ crl = &scrl->crl;
+
+ encodedExtenValue.data = NULL;
+ encodedExtenValue.len = 0;
+
+ rv = cert_FindExtension(crl->extensions, SEC_OID_X509_AUTH_KEY_ID,
+ &encodedExtenValue);
+ if ( rv != SECSuccess ) {
+ return (NULL);
+ }
+
+ ret = CERT_DecodeAuthKeyID (arena, &encodedExtenValue);
+
+ PORT_Free(encodedExtenValue.data);
+ encodedExtenValue.data = NULL;
+
+ return(ret);
+}
+
+#endif
+
/*
* Find the issuer of a Crl. Use the authorityKeyID if it exists.
*/
@@ -3658,7 +3725,7 @@ SECU_FindCertByNicknameOrFilename(CERTCertDBHandle *handle,
void *pwarg)
{
CERTCertificate *the_cert;
- the_cert = CERT_FindCertByNicknameOrEmailAddrCX(handle, name, pwarg);
+ the_cert = CERT_FindCertByNicknameOrEmailAddr(handle, name);
if (the_cert) {
return the_cert;
}
diff --git a/security/nss/cmd/libpkix/pkix/util/test_list2.c b/security/nss/cmd/libpkix/pkix/util/test_list2.c
index b802ff0e66..7e4114e521 100644
--- a/security/nss/cmd/libpkix/pkix/util/test_list2.c
+++ b/security/nss/cmd/libpkix/pkix/util/test_list2.c
@@ -78,14 +78,16 @@ test_list2(int argc, char *argv[])
for (i = 0; i < size; i++)
for (j = 9; j > i; j--) {
PKIX_TEST_EXPECT_NO_ERROR(PKIX_List_GetItem(list, j, &obj, plContext));
- PKIX_TEST_EXPECT_NO_ERROR(PKIX_List_GetItem(list, j - 1,
+ PKIX_TEST_EXPECT_NO_ERROR(PKIX_List_GetItem(list, j -
+ 1,
&obj2, plContext));
PKIX_TEST_EXPECT_NO_ERROR(PKIX_PL_Object_Compare(obj, obj2, &cmpResult, plContext));
if (cmpResult < 0) {
/* Exchange the items */
PKIX_TEST_EXPECT_NO_ERROR(PKIX_List_SetItem(list, j, obj2, plContext));
- PKIX_TEST_EXPECT_NO_ERROR(PKIX_List_SetItem(list, j - 1,
+ PKIX_TEST_EXPECT_NO_ERROR(PKIX_List_SetItem(list, j -
+ 1,
obj, plContext));
}
/* DecRef objects */
diff --git a/security/nss/cmd/listsuites/listsuites.c b/security/nss/cmd/listsuites/listsuites.c
index 8eb2c3553e..458130e5ec 100644
--- a/security/nss/cmd/listsuites/listsuites.c
+++ b/security/nss/cmd/listsuites/listsuites.c
@@ -10,9 +10,7 @@
#include <errno.h>
#include <stdio.h>
-#include "nss.h"
#include "secport.h"
-#include "secutil.h"
#include "ssl.h"
int
@@ -21,43 +19,6 @@ main(int argc, char **argv)
const PRUint16 *cipherSuites = SSL_ImplementedCiphers;
int i;
int errCount = 0;
- SECStatus rv;
- PRErrorCode err;
- char *certDir = NULL;
-
- /* load policy from $SSL_DIR/pkcs11.txt, for testing */
- certDir = SECU_DefaultSSLDir();
- if (certDir) {
- rv = NSS_Init(certDir);
- } else {
- rv = NSS_NoDB_Init(NULL);
- }
- if (rv != SECSuccess) {
- err = PR_GetError();
- ++errCount;
- fprintf(stderr, "NSS_Init failed: %s\n", PORT_ErrorToString(err));
- goto out;
- }
-
- /* apply policy */
- rv = NSS_SetAlgorithmPolicy(SEC_OID_APPLY_SSL_POLICY, NSS_USE_POLICY_IN_SSL, 0);
- if (rv != SECSuccess) {
- err = PR_GetError();
- ++errCount;
- fprintf(stderr, "NSS_SetAlgorithmPolicy failed: %s\n",
- PORT_ErrorToString(err));
- goto out;
- }
-
- /* update the default cipher suites according to the policy */
- rv = SSL_OptionSetDefault(SSL_SECURITY, PR_TRUE);
- if (rv != SECSuccess) {
- err = PR_GetError();
- ++errCount;
- fprintf(stderr, "SSL_OptionSetDefault failed: %s\n",
- PORT_ErrorToString(err));
- goto out;
- }
fputs("This version of libSSL supports these cipher suites:\n\n", stdout);
@@ -97,14 +58,5 @@ main(int argc, char **argv)
info.isFIPS ? "FIPS" : "",
info.nonStandard ? "nonStandard" : "");
}
-
-out:
- rv = NSS_Shutdown();
- if (rv != SECSuccess) {
- err = PR_GetError();
- ++errCount;
- fprintf(stderr, "NSS_Shutdown failed: %s\n", PORT_ErrorToString(err));
- }
-
return errCount;
}
diff --git a/security/nss/cmd/manifest.mn b/security/nss/cmd/manifest.mn
index f5e6bc2366..153384ce14 100644
--- a/security/nss/cmd/manifest.mn
+++ b/security/nss/cmd/manifest.mn
@@ -63,7 +63,6 @@ NSS_SRCDIRS = \
pp \
pwdecrypt \
rsaperf \
- rsapoptst \
sdrtest \
selfserv \
signtool \
diff --git a/security/nss/cmd/modutil/error.h b/security/nss/cmd/modutil/error.h
index d9f06592f8..b328afebc6 100644
--- a/security/nss/cmd/modutil/error.h
+++ b/security/nss/cmd/modutil/error.h
@@ -57,7 +57,6 @@ typedef enum {
UNSPECIFIED_ERR,
NOCERTDB_MISUSE_ERR,
NSS_INITIALIZE_FAILED_ERR,
- INITPW_FAILED_ERR,
LAST_ERR /* must be last */
} Error;
@@ -110,9 +109,8 @@ static char *errStrings[] = {
"ERROR: Failed to change default.\n",
"ERROR: Unable to read from standard input.\n",
"ERROR: Unknown error occurred.\n",
- "ERROR: -nocertdb option can only be used with the -jar command.\n",
- "ERROR: NSS_Initialize() failed.\n",
- "ERROR: Unable to set initial password on the database.\n"
+ "ERROR: -nocertdb option can only be used with the -jar command.\n"
+ "ERROR: NSS_Initialize() failed.\n"
};
typedef enum {
diff --git a/security/nss/cmd/modutil/install-ds.c b/security/nss/cmd/modutil/install-ds.c
index 0305687626..c8fef78979 100644
--- a/security/nss/cmd/modutil/install-ds.c
+++ b/security/nss/cmd/modutil/install-ds.c
@@ -975,7 +975,8 @@ Pk11Install_Platform_Print(Pk11Install_Platform* _this, int pad)
printf("Doesn't use equiv\n");
}
PAD(pad);
- printf("Module File: %s\n", _this->moduleFile ? _this->moduleFile : "<NULL>");
+ printf("Module File: %s\n", _this->moduleFile ? _this->moduleFile
+ : "<NULL>");
PAD(pad);
printf("mechFlags: %lx\n", _this->mechFlags);
PAD(pad);
diff --git a/security/nss/cmd/modutil/modutil.c b/security/nss/cmd/modutil/modutil.c
index c1b44be536..02972f7b46 100644
--- a/security/nss/cmd/modutil/modutil.c
+++ b/security/nss/cmd/modutil/modutil.c
@@ -865,7 +865,7 @@ main(int argc, char* argv[])
errcode = ChangePW(tokenName, pwFile, newpwFile);
break;
case CREATE_COMMAND:
- errcode = InitPW();
+ /* The work was already done in init_crypto() */
break;
case DEFAULT_COMMAND:
errcode = SetDefaultModule(moduleName, slotName, mechanisms);
diff --git a/security/nss/cmd/modutil/modutil.h b/security/nss/cmd/modutil/modutil.h
index 04aa908c85..127d0d0dab 100644
--- a/security/nss/cmd/modutil/modutil.h
+++ b/security/nss/cmd/modutil/modutil.h
@@ -29,7 +29,6 @@ Error AddModule(char *moduleName, char *libFile, char *ciphers,
Error DeleteModule(char *moduleName);
Error ListModule(char *moduleName);
Error ListModules();
-Error InitPW(void);
Error ChangePW(char *tokenName, char *pwFile, char *newpwFile);
Error EnableModule(char *moduleName, char *slotName, PRBool enable);
Error RawAddModule(char *dbmodulespec, char *modulespec);
diff --git a/security/nss/cmd/modutil/pk11.c b/security/nss/cmd/modutil/pk11.c
index 1efc1895c4..834469af1e 100644
--- a/security/nss/cmd/modutil/pk11.c
+++ b/security/nss/cmd/modutil/pk11.c
@@ -670,39 +670,6 @@ loser:
/************************************************************************
*
- * I n i t P W
- */
-Error
-InitPW(void)
-{
- PK11SlotInfo *slot;
- Error ret = UNSPECIFIED_ERR;
-
- slot = PK11_GetInternalKeySlot();
- if (!slot) {
- PR_fprintf(PR_STDERR, errStrings[NO_SUCH_TOKEN_ERR], "internal");
- return NO_SUCH_TOKEN_ERR;
- }
-
- /* Set the initial password to empty */
- if (PK11_NeedUserInit(slot)) {
- if (PK11_InitPin(slot, NULL, "") != SECSuccess) {
- PR_fprintf(PR_STDERR, errStrings[INITPW_FAILED_ERR]);
- ret = INITPW_FAILED_ERR;
- goto loser;
- }
- }
-
- ret = SUCCESS;
-
-loser:
- PK11_FreeSlot(slot);
-
- return ret;
-}
-
-/************************************************************************
- *
* C h a n g e P W
*/
Error
@@ -728,7 +695,7 @@ ChangePW(char *tokenName, char *pwFile, char *newpwFile)
ret = BAD_PW_ERR;
goto loser;
}
- } else if (PK11_NeedLogin(slot)) {
+ } else {
for (matching = PR_FALSE; !matching;) {
oldpw = SECU_GetPasswordString(NULL, "Enter old password: ");
if (PK11_CheckUserPassword(slot, oldpw) == SECSuccess) {
diff --git a/security/nss/cmd/multinit/multinit.c b/security/nss/cmd/multinit/multinit.c
index 874263e56a..a57c4819f2 100644
--- a/security/nss/cmd/multinit/multinit.c
+++ b/security/nss/cmd/multinit/multinit.c
@@ -502,7 +502,8 @@ do_list_certs(const char *progName, int log)
SECU_PrintCertNickname(node, stderr);
if (log) {
- fprintf(stderr, "* Slot=%s*\n", cert->slot ? PK11_GetTokenName(cert->slot) : "none");
+ fprintf(stderr, "* Slot=%s*\n", cert->slot ? PK11_GetTokenName(cert->slot)
+ : "none");
fprintf(stderr, "* Nickname=%s*\n", cert->nickname);
fprintf(stderr, "* Subject=<%s>*\n", cert->subjectName);
fprintf(stderr, "* Issuer=<%s>*\n", cert->issuerName);
diff --git a/security/nss/cmd/pk11mode/pk11mode.c b/security/nss/cmd/pk11mode/pk11mode.c
index 99891096cf..2f1fa374ee 100644
--- a/security/nss/cmd/pk11mode/pk11mode.c
+++ b/security/nss/cmd/pk11mode/pk11mode.c
@@ -2169,22 +2169,36 @@ PKM_Mechanism(CK_FUNCTION_LIST_PTR pFunctionList,
PKM_LogIt(" ulMinKeySize = %lu\n", minfo.ulMinKeySize);
PKM_LogIt(" ulMaxKeySize = %lu\n", minfo.ulMaxKeySize);
PKM_LogIt(" flags = 0x%08x\n", minfo.flags);
- PKM_LogIt(" -> HW = %s\n", minfo.flags & CKF_HW ? "TRUE" : "FALSE");
- PKM_LogIt(" -> ENCRYPT = %s\n", minfo.flags & CKF_ENCRYPT ? "TRUE" : "FALSE");
- PKM_LogIt(" -> DECRYPT = %s\n", minfo.flags & CKF_DECRYPT ? "TRUE" : "FALSE");
- PKM_LogIt(" -> DIGEST = %s\n", minfo.flags & CKF_DIGEST ? "TRUE" : "FALSE");
- PKM_LogIt(" -> SIGN = %s\n", minfo.flags & CKF_SIGN ? "TRUE" : "FALSE");
- PKM_LogIt(" -> SIGN_RECOVER = %s\n", minfo.flags & CKF_SIGN_RECOVER ? "TRUE" : "FALSE");
- PKM_LogIt(" -> VERIFY = %s\n", minfo.flags & CKF_VERIFY ? "TRUE" : "FALSE");
+ PKM_LogIt(" -> HW = %s\n", minfo.flags & CKF_HW ? "TRUE"
+ : "FALSE");
+ PKM_LogIt(" -> ENCRYPT = %s\n", minfo.flags & CKF_ENCRYPT ? "TRUE"
+ : "FALSE");
+ PKM_LogIt(" -> DECRYPT = %s\n", minfo.flags & CKF_DECRYPT ? "TRUE"
+ : "FALSE");
+ PKM_LogIt(" -> DIGEST = %s\n", minfo.flags & CKF_DIGEST ? "TRUE"
+ : "FALSE");
+ PKM_LogIt(" -> SIGN = %s\n", minfo.flags & CKF_SIGN ? "TRUE"
+ : "FALSE");
+ PKM_LogIt(" -> SIGN_RECOVER = %s\n", minfo.flags &
+ CKF_SIGN_RECOVER
+ ? "TRUE"
+ : "FALSE");
+ PKM_LogIt(" -> VERIFY = %s\n", minfo.flags & CKF_VERIFY ? "TRUE"
+ : "FALSE");
PKM_LogIt(" -> VERIFY_RECOVER = %s\n",
minfo.flags & CKF_VERIFY_RECOVER ? "TRUE" : "FALSE");
- PKM_LogIt(" -> GENERATE = %s\n", minfo.flags & CKF_GENERATE ? "TRUE" : "FALSE");
+ PKM_LogIt(" -> GENERATE = %s\n", minfo.flags & CKF_GENERATE ? "TRUE"
+ : "FALSE");
PKM_LogIt(" -> GENERATE_KEY_PAIR = %s\n",
minfo.flags & CKF_GENERATE_KEY_PAIR ? "TRUE" : "FALSE");
- PKM_LogIt(" -> WRAP = %s\n", minfo.flags & CKF_WRAP ? "TRUE" : "FALSE");
- PKM_LogIt(" -> UNWRAP = %s\n", minfo.flags & CKF_UNWRAP ? "TRUE" : "FALSE");
- PKM_LogIt(" -> DERIVE = %s\n", minfo.flags & CKF_DERIVE ? "TRUE" : "FALSE");
- PKM_LogIt(" -> EXTENSION = %s\n", minfo.flags & CKF_EXTENSION ? "TRUE" : "FALSE");
+ PKM_LogIt(" -> WRAP = %s\n", minfo.flags & CKF_WRAP ? "TRUE"
+ : "FALSE");
+ PKM_LogIt(" -> UNWRAP = %s\n", minfo.flags & CKF_UNWRAP ? "TRUE"
+ : "FALSE");
+ PKM_LogIt(" -> DERIVE = %s\n", minfo.flags & CKF_DERIVE ? "TRUE"
+ : "FALSE");
+ PKM_LogIt(" -> EXTENSION = %s\n", minfo.flags & CKF_EXTENSION ? "TRUE"
+ : "FALSE");
PKM_LogIt("\n");
}
@@ -3590,12 +3604,24 @@ PKM_FindAllObjects(CK_FUNCTION_LIST_PTR pFunctionList,
PKM_LogIt(" state = %lu\n", sinfo.state);
PKM_LogIt(" flags = 0x%08x\n", sinfo.flags);
#ifdef CKF_EXCLUSIVE_SESSION
- PKM_LogIt(" -> EXCLUSIVE SESSION = %s\n", sinfo.flags & CKF_EXCLUSIVE_SESSION ? "TRUE" : "FALSE");
+ PKM_LogIt(" -> EXCLUSIVE SESSION = %s\n", sinfo.flags &
+ CKF_EXCLUSIVE_SESSION
+ ? "TRUE"
+ : "FALSE");
#endif /* CKF_EXCLUSIVE_SESSION */
- PKM_LogIt(" -> RW SESSION = %s\n", sinfo.flags & CKF_RW_SESSION ? "TRUE" : "FALSE");
- PKM_LogIt(" -> SERIAL SESSION = %s\n", sinfo.flags & CKF_SERIAL_SESSION ? "TRUE" : "FALSE");
+ PKM_LogIt(" -> RW SESSION = %s\n", sinfo.flags &
+ CKF_RW_SESSION
+ ? "TRUE"
+ : "FALSE");
+ PKM_LogIt(" -> SERIAL SESSION = %s\n", sinfo.flags &
+ CKF_SERIAL_SESSION
+ ? "TRUE"
+ : "FALSE");
#ifdef CKF_INSERTION_CALLBACK
- PKM_LogIt(" -> INSERTION CALLBACK = %s\n", sinfo.flags & CKF_INSERTION_CALLBACK ? "TRUE" : "FALSE");
+ PKM_LogIt(" -> INSERTION CALLBACK = %s\n", sinfo.flags &
+ CKF_INSERTION_CALLBACK
+ ? "TRUE"
+ : "FALSE");
#endif /* CKF_INSERTION_CALLBACK */
PKM_LogIt(" ulDeviceError = %lu\n", sinfo.ulDeviceError);
PKM_LogIt("\n");
diff --git a/security/nss/cmd/pk12util/pk12util.c b/security/nss/cmd/pk12util/pk12util.c
index 70454a0d8f..0ac1ba00ec 100644
--- a/security/nss/cmd/pk12util/pk12util.c
+++ b/security/nss/cmd/pk12util/pk12util.c
@@ -23,7 +23,6 @@
static char *progName;
PRBool pk12_debugging = PR_FALSE;
PRBool dumpRawFile;
-static PRBool pk12uForceUnicode;
PRIntn pk12uErrno = 0;
@@ -358,7 +357,6 @@ p12U_ReadPKCS12File(SECItem *uniPwp, char *in_file, PK11SlotInfo *slot,
SECItem p12file = { 0 };
SECStatus rv = SECFailure;
PRBool swapUnicode = PR_FALSE;
- PRBool forceUnicode = pk12uForceUnicode;
PRBool trypw;
int error;
@@ -426,18 +424,6 @@ p12U_ReadPKCS12File(SECItem *uniPwp, char *in_file, PK11SlotInfo *slot,
SEC_PKCS12DecoderFinish(p12dcx);
uniPwp->len = 0;
trypw = PR_TRUE;
- } else if (forceUnicode == pk12uForceUnicode) {
- /* try again with a different password encoding */
- forceUnicode = !pk12uForceUnicode;
- rv = NSS_OptionSet(__NSS_PKCS12_DECODE_FORCE_UNICODE,
- forceUnicode);
- if (rv != SECSuccess) {
- SECU_PrintError(progName, "PKCS12 decoding failed to set option");
- pk12uErrno = PK12UERR_DECODEVERIFY;
- break;
- }
- SEC_PKCS12DecoderFinish(p12dcx);
- trypw = PR_TRUE;
} else {
SECU_PrintError(progName, "PKCS12 decode not verified");
pk12uErrno = PK12UERR_DECODEVERIFY;
@@ -445,15 +431,6 @@ p12U_ReadPKCS12File(SECItem *uniPwp, char *in_file, PK11SlotInfo *slot,
}
}
} while (trypw == PR_TRUE);
-
- /* revert the option setting */
- if (forceUnicode != pk12uForceUnicode) {
- rv = NSS_OptionSet(__NSS_PKCS12_DECODE_FORCE_UNICODE, pk12uForceUnicode);
- if (rv != SECSuccess) {
- SECU_PrintError(progName, "PKCS12 decoding failed to set option");
- pk12uErrno = PK12UERR_DECODEVERIFY;
- }
- }
/* rv has been set at this point */
done:
@@ -493,8 +470,6 @@ P12U_ImportPKCS12Object(char *in_file, PK11SlotInfo *slot,
{
SEC_PKCS12DecoderContext *p12dcx = NULL;
SECItem uniPwitem = { 0 };
- PRBool forceUnicode = pk12uForceUnicode;
- PRBool trypw;
SECStatus rv = SECFailure;
rv = P12U_InitSlot(slot, slotPw);
@@ -505,62 +480,31 @@ P12U_ImportPKCS12Object(char *in_file, PK11SlotInfo *slot,
return rv;
}
- do {
- trypw = PR_FALSE; /* normally we do this once */
- rv = SECFailure;
- p12dcx = p12U_ReadPKCS12File(&uniPwitem, in_file, slot, slotPw, p12FilePw);
-
- if (p12dcx == NULL) {
- goto loser;
- }
+ rv = SECFailure;
+ p12dcx = p12U_ReadPKCS12File(&uniPwitem, in_file, slot, slotPw, p12FilePw);
- /* make sure the bags are okey dokey -- nicknames correct, etc. */
- rv = SEC_PKCS12DecoderValidateBags(p12dcx, P12U_NicknameCollisionCallback);
- if (rv != SECSuccess) {
- if (PORT_GetError() == SEC_ERROR_PKCS12_DUPLICATE_DATA) {
- pk12uErrno = PK12UERR_CERTALREADYEXISTS;
- } else {
- pk12uErrno = PK12UERR_DECODEVALIBAGS;
- }
- SECU_PrintError(progName, "PKCS12 decode validate bags failed");
- goto loser;
- }
+ if (p12dcx == NULL) {
+ goto loser;
+ }
- /* stuff 'em in */
- if (forceUnicode != pk12uForceUnicode) {
- rv = NSS_OptionSet(__NSS_PKCS12_DECODE_FORCE_UNICODE,
- forceUnicode);
- if (rv != SECSuccess) {
- SECU_PrintError(progName, "PKCS12 decode set option failed");
- pk12uErrno = PK12UERR_DECODEIMPTBAGS;
- goto loser;
- }
- }
- rv = SEC_PKCS12DecoderImportBags(p12dcx);
- if (rv != SECSuccess) {
- if (PR_GetError() == SEC_ERROR_PKCS12_UNABLE_TO_IMPORT_KEY &&
- forceUnicode == pk12uForceUnicode) {
- /* try again with a different password encoding */
- forceUnicode = !pk12uForceUnicode;
- SEC_PKCS12DecoderFinish(p12dcx);
- SECITEM_ZfreeItem(&uniPwitem, PR_FALSE);
- trypw = PR_TRUE;
- } else {
- SECU_PrintError(progName, "PKCS12 decode import bags failed");
- pk12uErrno = PK12UERR_DECODEIMPTBAGS;
- goto loser;
- }
+ /* make sure the bags are okey dokey -- nicknames correct, etc. */
+ rv = SEC_PKCS12DecoderValidateBags(p12dcx, P12U_NicknameCollisionCallback);
+ if (rv != SECSuccess) {
+ if (PORT_GetError() == SEC_ERROR_PKCS12_DUPLICATE_DATA) {
+ pk12uErrno = PK12UERR_CERTALREADYEXISTS;
+ } else {
+ pk12uErrno = PK12UERR_DECODEVALIBAGS;
}
- } while (trypw);
+ SECU_PrintError(progName, "PKCS12 decode validate bags failed");
+ goto loser;
+ }
- /* revert the option setting */
- if (forceUnicode != pk12uForceUnicode) {
- rv = NSS_OptionSet(__NSS_PKCS12_DECODE_FORCE_UNICODE, pk12uForceUnicode);
- if (rv != SECSuccess) {
- SECU_PrintError(progName, "PKCS12 decode set option failed");
- pk12uErrno = PK12UERR_DECODEIMPTBAGS;
- goto loser;
- }
+ /* stuff 'em in */
+ rv = SEC_PKCS12DecoderImportBags(p12dcx);
+ if (rv != SECSuccess) {
+ SECU_PrintError(progName, "PKCS12 decode import bags failed");
+ pk12uErrno = PK12UERR_DECODEIMPTBAGS;
+ goto loser;
}
fprintf(stdout, "%s: PKCS12 IMPORT SUCCESSFUL\n", progName);
@@ -1003,7 +947,6 @@ main(int argc, char **argv)
int keyLen = 0;
int certKeyLen = 0;
secuCommand pk12util;
- PRInt32 forceUnicode;
#ifdef _CRTDBG_MAP_ALLOC
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
@@ -1035,14 +978,6 @@ main(int argc, char **argv)
Usage(progName);
}
- rv = NSS_OptionGet(__NSS_PKCS12_DECODE_FORCE_UNICODE, &forceUnicode);
- if (rv != SECSuccess) {
- SECU_PrintError(progName,
- "Failed to get NSS_PKCS12_DECODE_FORCE_UNICODE option");
- Usage(progName);
- }
- pk12uForceUnicode = forceUnicode;
-
slotname = SECU_GetOptionArg(&pk12util, opt_TokenName);
import_file = (pk12util.options[opt_List].activated) ? SECU_GetOptionArg(&pk12util, opt_List)
diff --git a/security/nss/cmd/pp/pp.c b/security/nss/cmd/pp/pp.c
index d6e276834c..9f33d10a47 100644
--- a/security/nss/cmd/pp/pp.c
+++ b/security/nss/cmd/pp/pp.c
@@ -84,8 +84,6 @@ main(int argc, char **argv)
if (!inFile) {
fprintf(stderr, "%s: unable to open \"%s\" for reading\n",
progName, optstate->value);
- PORT_Free(typeTag);
- PL_DestroyOptState(optstate);
return -1;
}
break;
@@ -95,8 +93,6 @@ main(int argc, char **argv)
if (!outFile) {
fprintf(stderr, "%s: unable to open \"%s\" for writing\n",
progName, optstate->value);
- PORT_Free(typeTag);
- PL_DestroyOptState(optstate);
return -1;
}
break;
diff --git a/security/nss/cmd/rsaperf/rsaperf.c b/security/nss/cmd/rsaperf/rsaperf.c
index 2bb23856e7..556030f6a7 100644
--- a/security/nss/cmd/rsaperf/rsaperf.c
+++ b/security/nss/cmd/rsaperf/rsaperf.c
@@ -671,7 +671,8 @@ main(int argc, char **argv)
printf("%ld iterations in %s\n",
iters, TimingGenerateString(timeCtx));
- printf("%.2f operations/s .\n", ((double)(iters) * (double)1000000.0) / (double)timeCtx->interval);
+ printf("%.2f operations/s .\n", ((double)(iters) * (double)1000000.0) /
+ (double)timeCtx->interval);
TimingDivide(timeCtx, iters);
printf("one operation every %s\n", TimingGenerateString(timeCtx));
diff --git a/security/nss/cmd/rsapoptst/rsapoptst.c b/security/nss/cmd/rsapoptst/rsapoptst.c
index d9468e6d6f..81ddcd6c43 100644
--- a/security/nss/cmd/rsapoptst/rsapoptst.c
+++ b/security/nss/cmd/rsapoptst/rsapoptst.c
@@ -23,7 +23,7 @@ static const struct test_args test_array[] = {
{ "d_n_q", 0x02, "private exponent, modulus, prime2" },
{ "d_p_q", 0x04, "private exponent, prime1, prime2" },
{ "e_d_q", 0x08, "public exponent, private exponent, prime2" },
- { "e_d_n", 0x10, "public exponent, private exponent, modulus" }
+ { "e_d_n", 0x10, "public exponent, private exponent, moduls" }
};
static const int test_array_size =
(sizeof(test_array) / sizeof(struct test_args));
@@ -58,7 +58,6 @@ const static CK_ATTRIBUTE rsaTemplate[] = {
{ CKA_TOKEN, NULL, 0 },
{ CKA_SENSITIVE, NULL, 0 },
{ CKA_PRIVATE, NULL, 0 },
- { CKA_ID, NULL, 0 },
{ CKA_MODULUS, NULL, 0 },
{ CKA_PUBLIC_EXPONENT, NULL, 0 },
{ CKA_PRIVATE_EXPONENT, NULL, 0 },
@@ -124,77 +123,46 @@ fail:
#define ATTR_STRING(x) getNameFromAttribute(x)
-static void
-dumphex(FILE *file, const unsigned char *cpval, int start, int end)
-{
- int i;
- for (i = start; i < end; i++) {
- if ((i % 16) == 0)
- fprintf(file, "\n ");
- fprintf(file, " %02x", cpval[i]);
- }
- return;
-}
-
void
-dumpTemplate(FILE *file, const CK_ATTRIBUTE *template, int start, int end)
+dumpTemplate(CK_ATTRIBUTE *template, int start, int end)
{
- int i;
- for (i = start; i < end; i++) {
+ int i, j;
+ for (i = 0; i < end; i++) {
unsigned char cval;
CK_ULONG ulval;
- const unsigned char *cpval;
+ unsigned char *cpval;
- fprintf(file, "%s:", ATTR_STRING(template[i].type));
+ fprintf(stderr, "%s:", ATTR_STRING(template[i].type));
switch (template[i].ulValueLen) {
case 1:
cval = *(unsigned char *)template[i].pValue;
switch (cval) {
case 0:
- fprintf(file, " false");
+ fprintf(stderr, " false");
break;
case 1:
- fprintf(file, " true");
+ fprintf(stderr, " true");
break;
default:
- fprintf(file, " %d (=0x%02x,'%c')", cval, cval, cval);
+ fprintf(stderr, " %d (=0x%02x,'%c')", cval, cval, cval);
break;
}
break;
case sizeof(CK_ULONG):
ulval = *(CK_ULONG *)template[i].pValue;
- fprintf(file, " %ld (=0x%04lx)", ulval, ulval);
+ fprintf(stderr, " %ld (=0x%04lx)", ulval, ulval);
break;
default:
- cpval = (const unsigned char *)template[i].pValue;
- dumphex(file, cpval, 0, template[i].ulValueLen);
+ cpval = (unsigned char *)template[i].pValue;
+ for (j = 0; j < template[i].ulValueLen; j++) {
+ if ((j % 16) == 0)
+ fprintf(stderr, "\n ");
+ fprintf(stderr, " %02x", cpval[j]);
+ }
break;
}
- fprintf(file, "\n");
- }
-}
-
-void
-dumpItem(FILE *file, const SECItem *item)
-{
- const unsigned char *cpval;
-
- if (item == NULL) {
- fprintf(file, " pNULL ");
- return;
- }
- if (item->data == NULL) {
- fprintf(file, " NULL ");
- return;
+ fprintf(stderr, "\n");
}
- if (item->len == 0) {
- fprintf(file, " Empty ");
- return;
- }
- cpval = item->data;
- dumphex(file, cpval, 0, item->len);
- fprintf(file, " ");
- return;
}
PRBool
@@ -216,16 +184,13 @@ rsaKeysAreEqual(PK11ObjectType srcType, void *src,
printf("Could read source key\n");
return PR_FALSE;
}
- rv = readKey(destType, dest, destTemplate, 0, RSA_ATTRIBUTES);
+ readKey(destType, dest, destTemplate, 0, RSA_ATTRIBUTES);
if (rv != SECSuccess) {
printf("Could read dest key\n");
return PR_FALSE;
}
for (i = 0; i < RSA_ATTRIBUTES; i++) {
- if (srcTemplate[i].type == CKA_ID) {
- continue; /* we purposefully make the CKA_ID different */
- }
if (srcTemplate[i].ulValueLen != destTemplate[i].ulValueLen) {
printf("key->%s not equal src_len = %ld, dest_len=%ld\n",
ATTR_STRING(srcTemplate[i].type),
@@ -239,22 +204,18 @@ rsaKeysAreEqual(PK11ObjectType srcType, void *src,
}
if (!areEqual) {
fprintf(stderr, "original key:\n");
- dumpTemplate(stderr, srcTemplate, 0, RSA_ATTRIBUTES);
+ dumpTemplate(srcTemplate, 0, RSA_ATTRIBUTES);
fprintf(stderr, "created key:\n");
- dumpTemplate(stderr, destTemplate, 0, RSA_ATTRIBUTES);
+ dumpTemplate(destTemplate, 0, RSA_ATTRIBUTES);
}
- resetTemplate(srcTemplate, 0, RSA_ATTRIBUTES);
- resetTemplate(destTemplate, 0, RSA_ATTRIBUTES);
return areEqual;
}
static int exp_exp_prime_fail_count = 0;
-#define LEAK_ID 0xf
-
static int
doRSAPopulateTest(unsigned int keySize, unsigned long exponent,
- int mask, int round, void *pwarg)
+ int mask, void *pwarg)
{
SECKEYPrivateKey *rsaPrivKey;
SECKEYPublicKey *rsaPubKey;
@@ -266,10 +227,7 @@ doRSAPopulateTest(unsigned int keySize, unsigned long exponent,
CK_OBJECT_CLASS obj_class = CKO_PRIVATE_KEY;
CK_KEY_TYPE key_type = CKK_RSA;
CK_BBOOL ck_false = CK_FALSE;
- CK_BYTE cka_id[2] = { 0, 0 };
int failed = 0;
- int leak_found; /* did we find the expected leak */
- int expect_leak = 0; /* are we expecting a leak? */
rsaParams.pe = exponent;
rsaParams.keySizeInBits = keySize;
@@ -301,15 +259,11 @@ doRSAPopulateTest(unsigned int keySize, unsigned long exponent,
tstTemplate[3].ulValueLen = sizeof(ck_false);
tstTemplate[4].pValue = &ck_false;
tstTemplate[4].ulValueLen = sizeof(ck_false);
- tstTemplate[5].pValue = &cka_id[0];
- tstTemplate[5].ulValueLen = sizeof(cka_id);
- tstHeaderCount = 6;
- cka_id[0] = round;
+ tstHeaderCount = 5;
if (mask & 1) {
printf("%s\n", test_array[1].description);
resetTemplate(tstTemplate, tstHeaderCount, RSA_ATTRIBUTES);
- cka_id[1] = 0;
copyAttribute(PK11_TypePrivKey, rsaPrivKey, tstTemplate,
tstHeaderCount, CKA_PUBLIC_EXPONENT);
copyAttribute(PK11_TypePrivKey, rsaPrivKey, tstTemplate,
@@ -317,10 +271,10 @@ doRSAPopulateTest(unsigned int keySize, unsigned long exponent,
copyAttribute(PK11_TypePrivKey, rsaPrivKey, tstTemplate,
tstHeaderCount + 2, CKA_PRIME_1);
- tstPrivKey = PK11_CreateManagedGenericObject(slot, tstTemplate,
- tstHeaderCount +
- 3,
- PR_FALSE);
+ tstPrivKey = PK11_CreateGenericObject(slot, tstTemplate,
+ tstHeaderCount +
+ 3,
+ PR_FALSE);
if (tstPrivKey == NULL) {
fprintf(stderr, "RSA Populate failed: pubExp mod p\n");
failed = 1;
@@ -336,7 +290,6 @@ doRSAPopulateTest(unsigned int keySize, unsigned long exponent,
printf("%s\n", test_array[2].description);
/* test the basic2 case, public exponent, modulus, prime2 */
resetTemplate(tstTemplate, tstHeaderCount, RSA_ATTRIBUTES);
- cka_id[1] = 1;
copyAttribute(PK11_TypePrivKey, rsaPrivKey, tstTemplate,
tstHeaderCount, CKA_PUBLIC_EXPONENT);
copyAttribute(PK11_TypePrivKey, rsaPrivKey, tstTemplate,
@@ -346,10 +299,10 @@ doRSAPopulateTest(unsigned int keySize, unsigned long exponent,
/* test with q in the prime1 position */
tstTemplate[tstHeaderCount + 2].type = CKA_PRIME_1;
- tstPrivKey = PK11_CreateManagedGenericObject(slot, tstTemplate,
- tstHeaderCount +
- 3,
- PR_FALSE);
+ tstPrivKey = PK11_CreateGenericObject(slot, tstTemplate,
+ tstHeaderCount +
+ 3,
+ PR_FALSE);
if (tstPrivKey == NULL) {
fprintf(stderr, "RSA Populate failed: pubExp mod q\n");
failed = 1;
@@ -365,7 +318,6 @@ doRSAPopulateTest(unsigned int keySize, unsigned long exponent,
printf("%s\n", test_array[3].description);
/* test the medium case, private exponent, prime1, prime2 */
resetTemplate(tstTemplate, tstHeaderCount, RSA_ATTRIBUTES);
- cka_id[1] = 2;
copyAttribute(PK11_TypePrivKey, rsaPrivKey, tstTemplate,
tstHeaderCount, CKA_PRIVATE_EXPONENT);
@@ -377,10 +329,10 @@ doRSAPopulateTest(unsigned int keySize, unsigned long exponent,
tstTemplate[tstHeaderCount + 2].type = CKA_PRIME_1;
tstTemplate[tstHeaderCount + 1].type = CKA_PRIME_2;
- tstPrivKey = PK11_CreateManagedGenericObject(slot, tstTemplate,
- tstHeaderCount +
- 3,
- PR_FALSE);
+ tstPrivKey = PK11_CreateGenericObject(slot, tstTemplate,
+ tstHeaderCount +
+ 3,
+ PR_FALSE);
if (tstPrivKey == NULL) {
fprintf(stderr, "RSA Populate failed: privExp p q\n");
failed = 1;
@@ -396,7 +348,6 @@ doRSAPopulateTest(unsigned int keySize, unsigned long exponent,
printf("%s\n", test_array[4].description);
/* test the advanced case, public exponent, private exponent, prime2 */
resetTemplate(tstTemplate, tstHeaderCount, RSA_ATTRIBUTES);
- cka_id[1] = 3;
copyAttribute(PK11_TypePrivKey, rsaPrivKey, tstTemplate,
tstHeaderCount, CKA_PRIVATE_EXPONENT);
copyAttribute(PK11_TypePrivKey, rsaPrivKey, tstTemplate,
@@ -404,10 +355,10 @@ doRSAPopulateTest(unsigned int keySize, unsigned long exponent,
copyAttribute(PK11_TypePrivKey, rsaPrivKey, tstTemplate,
tstHeaderCount + 2, CKA_PRIME_2);
- tstPrivKey = PK11_CreateManagedGenericObject(slot, tstTemplate,
- tstHeaderCount +
- 3,
- PR_FALSE);
+ tstPrivKey = PK11_CreateGenericObject(slot, tstTemplate,
+ tstHeaderCount +
+ 3,
+ PR_FALSE);
if (tstPrivKey == NULL) {
fprintf(stderr, "RSA Populate failed: pubExp privExp q\n");
fprintf(stderr, " this is expected periodically. It means we\n");
@@ -422,12 +373,11 @@ doRSAPopulateTest(unsigned int keySize, unsigned long exponent,
if (tstPrivKey)
PK11_DestroyGenericObject(tstPrivKey);
}
- if (mask & 0x10) {
+ if (mask & 16) {
printf("%s\n", test_array[5].description);
/* test the advanced case2, public exponent, private exponent, modulus
*/
resetTemplate(tstTemplate, tstHeaderCount, RSA_ATTRIBUTES);
- cka_id[1] = LEAK_ID;
copyAttribute(PK11_TypePrivKey, rsaPrivKey, tstTemplate,
tstHeaderCount, CKA_PRIVATE_EXPONENT);
@@ -436,7 +386,6 @@ doRSAPopulateTest(unsigned int keySize, unsigned long exponent,
copyAttribute(PK11_TypePrivKey, rsaPrivKey, tstTemplate,
tstHeaderCount + 2, CKA_MODULUS);
- /* purposefully use the old version. This will create a leak */
tstPrivKey = PK11_CreateGenericObject(slot, tstTemplate,
tstHeaderCount +
3,
@@ -449,59 +398,9 @@ doRSAPopulateTest(unsigned int keySize, unsigned long exponent,
fprintf(stderr, "RSA Populate key mismatch: pubExp privExp mod\n");
failed = 1;
}
- expect_leak = 1;
if (tstPrivKey)
PK11_DestroyGenericObject(tstPrivKey);
}
- resetTemplate(tstTemplate, tstHeaderCount, RSA_ATTRIBUTES);
- SECKEY_DestroyPrivateKey(rsaPrivKey);
- SECKEY_DestroyPublicKey(rsaPubKey);
-
- /* make sure we didn't leak */
- leak_found = 0;
- tstPrivKey = PK11_FindGenericObjects(slot, CKO_PRIVATE_KEY);
- if (tstPrivKey) {
- SECStatus rv;
- PK11GenericObject *thisKey;
- int i;
-
- fprintf(stderr, "Leaking keys...\n");
- for (i = 0, thisKey = tstPrivKey; thisKey; i++,
- thisKey = PK11_GetNextGenericObject(thisKey)) {
- SECItem id = { 0, NULL, 0 };
-
- rv = PK11_ReadRawAttribute(PK11_TypeGeneric, thisKey,
- CKA_ID, &id);
- if (rv != SECSuccess) {
- fprintf(stderr, "Key %d: couldn't read CKA_ID: %s\n",
- i, PORT_ErrorToString(PORT_GetError()));
- continue;
- }
- fprintf(stderr, "id = { ");
- dumpItem(stderr, &id);
- fprintf(stderr, "};");
- if (id.data[1] == LEAK_ID) {
- fprintf(stderr, " ---> leak expected\n");
- if (id.data[0] == round)
- leak_found = 1;
- } else {
- if (id.len != sizeof(cka_id)) {
- fprintf(stderr,
- " ---> ERROR unexpected leak in generated key\n");
- } else {
- fprintf(stderr,
- " ---> ERROR unexpected leak in constructed key\n");
- }
- failed = 1;
- }
- SECITEM_FreeItem(&id, PR_FALSE);
- }
- PK11_DestroyGenericObjects(tstPrivKey);
- }
- if (expect_leak && !leak_found) {
- fprintf(stderr, "ERROR expected leak not found\n");
- failed = 1;
- }
PK11_FreeSlot(slot);
return failed ? -1 : 0;
@@ -618,7 +517,7 @@ main(int argc, char **argv)
exp_exp_prime_fail_count = 0;
for (i = 0; i < repeat; i++) {
printf("Running RSA Populate test run %d\n", i);
- ret = doRSAPopulateTest(keySize, exponent, mask, i, NULL);
+ ret = doRSAPopulateTest(keySize, exponent, mask, NULL);
if (ret != 0) {
i++;
break;
@@ -632,9 +531,5 @@ main(int argc, char **argv)
exp_exp_prime_fail_count, i,
(((double)exp_exp_prime_fail_count) * 100.0) / (double)i);
}
- if (NSS_Shutdown() != SECSuccess) {
- fprintf(stderr, "Shutdown failed\n");
- ret = -1;
- }
return ret;
}
diff --git a/security/nss/cmd/rsapoptst/rsapoptst.gyp b/security/nss/cmd/rsapoptst/rsapoptst.gyp
deleted file mode 100644
index 325a109095..0000000000
--- a/security/nss/cmd/rsapoptst/rsapoptst.gyp
+++ /dev/null
@@ -1,25 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-{
- 'includes': [
- '../../coreconf/config.gypi',
- '../../cmd/platlibs.gypi'
- ],
- 'targets': [
- {
- 'target_name': 'rsapoptst',
- 'type': 'executable',
- 'sources': [
- 'rsapoptst.c'
- ],
- 'dependencies': [
- '<(DEPTH)/exports.gyp:dbm_exports',
- '<(DEPTH)/exports.gyp:nss_exports',
- ]
- }
- ],
- 'variables': {
- 'module': 'nss',
- }
-}
diff --git a/security/nss/cmd/selfserv/selfserv.c b/security/nss/cmd/selfserv/selfserv.c
index fac428e101..65b1ee3042 100644
--- a/security/nss/cmd/selfserv/selfserv.c
+++ b/security/nss/cmd/selfserv/selfserv.c
@@ -38,7 +38,6 @@
#include "nss.h"
#include "ssl.h"
#include "sslproto.h"
-#include "sslexp.h"
#include "cert.h"
#include "certt.h"
#include "ocsp.h"
@@ -166,7 +165,9 @@ PrintUsageHeader(const char *progName)
" [-V [min-version]:[max-version]] [-a sni_name]\n"
" [ T <good|revoked|unknown|badsig|corrupted|none|ocsp>] [-A ca]\n"
" [-C SSLCacheEntries] [-S dsa_nickname] -Q [-I groups]"
+#ifndef NSS_DISABLE_ECC
" [-e ec_nickname]"
+#endif /* NSS_DISABLE_ECC */
"\n"
" -U [0|1] -H [0|1|2] -W [0|1]\n"
"\n",
@@ -1954,10 +1955,6 @@ server_main(
if (enabledVersions.max < SSL_LIBRARY_VERSION_TLS_1_3) {
errExit("You tried enabling 0RTT without enabling TLS 1.3!");
}
- rv = SSL_SetupAntiReplay(10 * PR_USEC_PER_SEC, 7, 14);
- if (rv != SECSuccess) {
- errExit("error configuring anti-replay ");
- }
rv = SSL_OptionSet(model_sock, SSL_ENABLE_0RTT_DATA, PR_TRUE);
if (rv != SECSuccess) {
errExit("error enabling 0RTT ");
@@ -2346,6 +2343,7 @@ main(int argc, char **argv)
dir = optstate->value;
break;
+#ifndef NSS_DISABLE_ECC
case 'e':
if (certNicknameIndex >= MAX_CERT_NICKNAME_ARRAY_INDEX) {
Usage(progName);
@@ -2353,6 +2351,7 @@ main(int argc, char **argv)
}
certNicknameArray[certNicknameIndex++] = PORT_Strdup(optstate->value);
break;
+#endif /* NSS_DISABLE_ECC */
case 'f':
pwdata.source = PW_FROMFILE;
@@ -2554,14 +2553,6 @@ main(int argc, char **argv)
tmp = PR_GetEnvSecure("TMPDIR");
if (!tmp)
tmp = PR_GetEnvSecure("TEMP");
-
- /* Call the NSS initialization routines */
- rv = NSS_Initialize(dir, certPrefix, certPrefix, SECMOD_DB, NSS_INIT_READONLY);
- if (rv != SECSuccess) {
- fputs("NSS_Init failed.\n", stderr);
- exit(8);
- }
-
if (envString) {
/* we're one of the children in a multi-process server. */
listen_sock = PR_GetInheritedFD(inheritableSockName);
@@ -2616,6 +2607,13 @@ main(int argc, char **argv)
/* set our password function */
PK11_SetPasswordFunc(SECU_GetModulePassword);
+ /* Call the NSS initialization routines */
+ rv = NSS_Initialize(dir, certPrefix, certPrefix, SECMOD_DB, NSS_INIT_READONLY);
+ if (rv != SECSuccess) {
+ fputs("NSS_Init failed.\n", stderr);
+ exit(8);
+ }
+
/* all SSL3 cipher suites are enabled by default. */
if (cipherString) {
char *cstringSaved = cipherString;
@@ -2683,7 +2681,9 @@ main(int argc, char **argv)
certNicknameArray[i]);
exit(11);
}
+#ifdef NSS_DISABLE_ECC
if (privKey[i]->keyType != ecKey)
+#endif
setupCertStatus(certStatusArena, ocspStaplingMode, cert[i], i, &pwdata);
}
diff --git a/security/nss/cmd/signtool/javascript.c b/security/nss/cmd/signtool/javascript.c
index ffff2db592..746f724f89 100644
--- a/security/nss/cmd/signtool/javascript.c
+++ b/security/nss/cmd/signtool/javascript.c
@@ -1115,7 +1115,8 @@ extract_js(char *filename)
textStart = 0;
startLine = 0;
- while (linenum = FB_GetLineNum(fb), (curchar = FB_GetChar(fb)) != EOF) {
+ while (linenum = FB_GetLineNum(fb), (curchar = FB_GetChar(fb)) !=
+ EOF) {
switch (state) {
case TEXT_HTML_STATE:
if (curchar == '<') {
diff --git a/security/nss/cmd/signtool/signtool.c b/security/nss/cmd/signtool/signtool.c
index 915a00fbc1..51857d6389 100644
--- a/security/nss/cmd/signtool/signtool.c
+++ b/security/nss/cmd/signtool/signtool.c
@@ -1033,7 +1033,9 @@ main(int argc, char *argv[])
if (errorCount > 0 || warningCount > 0) {
PR_fprintf(outputFD, "%d error%s, %d warning%s.\n",
errorCount,
- errorCount == 1 ? "" : "s", warningCount, warningCount == 1 ? "" : "s");
+ errorCount == 1 ? "" : "s", warningCount, warningCount == 1
+ ? ""
+ : "s");
} else {
PR_fprintf(outputFD, "Directory %s signed successfully.\n",
jartree);
diff --git a/security/nss/cmd/smimetools/cmsutil.c b/security/nss/cmd/smimetools/cmsutil.c
index fe17f26a48..10e743c6b8 100644
--- a/security/nss/cmd/smimetools/cmsutil.c
+++ b/security/nss/cmd/smimetools/cmsutil.c
@@ -1572,7 +1572,10 @@ main(int argc, char **argv)
{
unsigned int j;
for (j = 0; j < input.len; j++)
- fprintf(stderr, "%2x%c", input.data[j], (j > 0 && j % 35 == 0) ? '\n' : ' ');
+ fprintf(stderr, "%2x%c", input.data[j], (j > 0 &&
+ j % 35 == 0)
+ ? '\n'
+ : ' ');
}
}
if (input.len > 0) { /* skip if certs-only (or other zero content) */
diff --git a/security/nss/cmd/ssltap/ssltap.c b/security/nss/cmd/ssltap/ssltap.c
index a2471884e6..197b1942de 100644
--- a/security/nss/cmd/ssltap/ssltap.c
+++ b/security/nss/cmd/ssltap/ssltap.c
@@ -1637,7 +1637,8 @@ print_ssl3_handshake(unsigned char *recordBuf,
PR_snprintf(certFileName, sizeof certFileName, "cert.%03d",
++certFileNumber);
cfd =
- PR_Open(certFileName, PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE,
+ PR_Open(certFileName, PR_WRONLY |
+ PR_CREATE_FILE | PR_TRUNCATE,
0664);
if (!cfd) {
PR_fprintf(PR_STDOUT,
@@ -1721,7 +1722,8 @@ print_ssl3_handshake(unsigned char *recordBuf,
0 &&
sslhexparse) {
PR_fprintf(PR_STDOUT, " = {\n");
- print_hex(dnLen, hsdata + pos);
+ print_hex(dnLen, hsdata +
+ pos);
PR_fprintf(PR_STDOUT, " }\n");
} else {
PR_fprintf(PR_STDOUT, "\n");
@@ -1794,7 +1796,8 @@ print_ssl3_handshake(unsigned char *recordBuf,
PR_snprintf(ocspFileName, sizeof ocspFileName, "ocsp.%03d",
++ocspFileNumber);
- ofd = PR_Open(ocspFileName, PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE,
+ ofd = PR_Open(ocspFileName, PR_WRONLY |
+ PR_CREATE_FILE | PR_TRUNCATE,
0664);
if (!ofd) {
PR_fprintf(PR_STDOUT,
@@ -2164,7 +2167,8 @@ print_ssl(DataBufferList *s, int length, unsigned char *buffer)
break;
case 22: /* handshake */
- print_ssl3_handshake(recordBuf, recordLen - s->hMACsize,
+ print_ssl3_handshake(recordBuf, recordLen -
+ s->hMACsize,
&sr, s);
break;
diff --git a/security/nss/cmd/strsclnt/strsclnt.c b/security/nss/cmd/strsclnt/strsclnt.c
index 7d259bd0aa..f65e319137 100644
--- a/security/nss/cmd/strsclnt/strsclnt.c
+++ b/security/nss/cmd/strsclnt/strsclnt.c
@@ -886,10 +886,8 @@ PRBool
LoggedIn(CERTCertificate *cert, SECKEYPrivateKey *key)
{
if ((cert->slot) && (key->pkcs11Slot) &&
- (!PK11_NeedLogin(cert->slot) ||
- PR_TRUE == PK11_IsLoggedIn(cert->slot, NULL)) &&
- (!PK11_NeedLogin(key->pkcs11Slot) ||
- PR_TRUE == PK11_IsLoggedIn(key->pkcs11Slot, NULL))) {
+ (PR_TRUE == PK11_IsLoggedIn(cert->slot, NULL)) &&
+ (PR_TRUE == PK11_IsLoggedIn(key->pkcs11Slot, NULL))) {
return PR_TRUE;
}
diff --git a/security/nss/cmd/tstclnt/tstclnt.c b/security/nss/cmd/tstclnt/tstclnt.c
index 1ad99502bb..959afec597 100644
--- a/security/nss/cmd/tstclnt/tstclnt.c
+++ b/security/nss/cmd/tstclnt/tstclnt.c
@@ -31,7 +31,6 @@
#include "ocsp.h"
#include "ssl.h"
#include "sslproto.h"
-#include "sslexp.h"
#include "pk11func.h"
#include "secmod.h"
#include "plgetopt.h"
@@ -96,7 +95,6 @@ PRBool verbose;
int dumpServerChain = 0;
int renegotiationsToDo = 0;
int renegotiationsDone = 0;
-PRBool initializedServerSessionCache = PR_FALSE;
static char *progName;
@@ -180,7 +178,7 @@ PrintUsageHeader(const char *progName)
"[-n nickname] [-Bafosvx] [-c ciphers] [-Y] [-Z]\n"
"[-V [min-version]:[max-version]] [-K] [-T] [-U]\n"
"[-r N] [-w passwd] [-W pwfile] [-q [-t seconds]] [-I groups]\n"
- "[-A requestfile] [-L totalconnections] [-P {client,server}] [-Q]\n"
+ "[-A requestfile] [-L totalconnections]\n"
"\n",
progName);
}
@@ -204,7 +202,7 @@ PrintParameterUsage(void)
fprintf(stderr, "%-20s Print certificate chain information\n", "-C");
fprintf(stderr, "%-20s (use -C twice to print more certificate details)\n", "");
fprintf(stderr, "%-20s (use -C three times to include PEM format certificate dumps)\n", "");
- fprintf(stderr, "%-20s Nickname of key and cert\n",
+ fprintf(stderr, "%-20s Nickname of key and cert for client auth\n",
"-n nickname");
fprintf(stderr,
"%-20s Restricts the set of enabled SSL/TLS protocols versions.\n"
@@ -253,9 +251,6 @@ PrintParameterUsage(void)
"%-20s The following values are valid:\n"
"%-20s P256, P384, P521, x25519, FF2048, FF3072, FF4096, FF6144, FF8192\n",
"-I", "", "");
- fprintf(stderr, "%-20s Enable alternative TLS 1.3 handshake\n", "-X alt-server-hello");
- fprintf(stderr, "%-20s Use DTLS\n", "-P {client, server}");
- fprintf(stderr, "%-20s Exit after handshake\n", "-Q");
}
static void
@@ -919,12 +914,6 @@ char *requestString = NULL;
PRInt32 requestStringLen = 0;
PRBool requestSent = PR_FALSE;
PRBool enableZeroRtt = PR_FALSE;
-PRBool enableAltServerHello = PR_FALSE;
-PRBool useDTLS = PR_FALSE;
-PRBool actAsServer = PR_FALSE;
-PRBool stopAfterHandshake = PR_FALSE;
-PRBool requestToExit = PR_FALSE;
-char *versionString = NULL;
static int
writeBytesToServer(PRFileDesc *s, const char *buf, int nb)
@@ -1007,129 +996,12 @@ handshakeCallback(PRFileDesc *fd, void *client_data)
writeBytesToServer(fd, requestString, requestStringLen);
}
}
- if (stopAfterHandshake) {
- requestToExit = PR_TRUE;
- }
}
#define REQUEST_WAITING (requestString && !requestSent)
-static SECStatus
-installServerCertificate(PRFileDesc *s, char *nickname)
-{
- CERTCertificate *cert;
- SECKEYPrivateKey *privKey = NULL;
-
- if (!nickname) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- return SECFailure;
- }
-
- cert = PK11_FindCertFromNickname(nickname, &pwdata);
- if (cert == NULL) {
- return SECFailure;
- }
-
- privKey = PK11_FindKeyByAnyCert(cert, &pwdata);
- if (privKey == NULL) {
- return SECFailure;
- }
- if (SSL_ConfigServerCert(s, cert, privKey, NULL, 0) != SECSuccess) {
- return SECFailure;
- }
- SECKEY_DestroyPrivateKey(privKey);
- CERT_DestroyCertificate(cert);
-
- return SECSuccess;
-}
-
-static SECStatus
-bindToClient(PRFileDesc *s)
-{
- PRStatus status;
- status = PR_Bind(s, &addr);
- if (status != PR_SUCCESS) {
- return SECFailure;
- }
-
- for (;;) {
- /* Bind the remote address on first packet. This must happen
- * before we SSL-ize the socket because we need to get the
- * peer's address before SSLizing. Recvfrom gives us that
- * while not consuming any data. */
- unsigned char tmp;
- PRNetAddr remote;
- int nb;
-
- nb = PR_RecvFrom(s, &tmp, 1, PR_MSG_PEEK,
- &remote, PR_INTERVAL_NO_TIMEOUT);
- if (nb != 1)
- continue;
-
- status = PR_Connect(s, &remote, PR_INTERVAL_NO_TIMEOUT);
- if (status != PR_SUCCESS) {
- SECU_PrintError(progName, "server bind to remote end failed");
- return SECFailure;
- }
- return SECSuccess;
- }
-
- /* Unreachable. */
-}
-
-static SECStatus
-connectToServer(PRFileDesc *s, PRPollDesc *pollset)
-{
- PRStatus status;
- PRInt32 filesReady;
-
- status = PR_Connect(s, &addr, PR_INTERVAL_NO_TIMEOUT);
- if (status != PR_SUCCESS) {
- if (PR_GetError() == PR_IN_PROGRESS_ERROR) {
- if (verbose)
- SECU_PrintError(progName, "connect");
- milliPause(50 * multiplier);
- pollset[SSOCK_FD].in_flags = PR_POLL_WRITE | PR_POLL_EXCEPT;
- pollset[SSOCK_FD].out_flags = 0;
- pollset[SSOCK_FD].fd = s;
- while (1) {
- FPRINTF(stderr,
- "%s: about to call PR_Poll for connect completion!\n",
- progName);
- filesReady = PR_Poll(pollset, 1, PR_INTERVAL_NO_TIMEOUT);
- if (filesReady < 0) {
- SECU_PrintError(progName, "unable to connect (poll)");
- return SECFailure;
- }
- FPRINTF(stderr,
- "%s: PR_Poll returned 0x%02x for socket out_flags.\n",
- progName, pollset[SSOCK_FD].out_flags);
- if (filesReady == 0) { /* shouldn't happen! */
- SECU_PrintError(progName, "%s: PR_Poll returned zero!\n");
- return SECFailure;
- }
- status = PR_GetConnectStatus(pollset);
- if (status == PR_SUCCESS) {
- break;
- }
- if (PR_GetError() != PR_IN_PROGRESS_ERROR) {
- SECU_PrintError(progName, "unable to connect (poll)");
- return SECFailure;
- }
- SECU_PrintError(progName, "poll");
- milliPause(50 * multiplier);
- }
- } else {
- SECU_PrintError(progName, "unable to connect");
- return SECFailure;
- }
- }
-
- return SECSuccess;
-}
-
static int
-run(void)
+run_client(void)
{
int headerSeparatorPtrnId = 0;
int error = 0;
@@ -1145,23 +1017,13 @@ run(void)
requestSent = PR_FALSE;
/* Create socket */
- if (useDTLS) {
- s = PR_OpenUDPSocket(addr.raw.family);
- } else {
- s = PR_OpenTCPSocket(addr.raw.family);
- }
-
+ s = PR_OpenTCPSocket(addr.raw.family);
if (s == NULL) {
SECU_PrintError(progName, "error creating socket");
error = 1;
goto done;
}
- if (actAsServer) {
- if (bindToClient(s) != SECSuccess) {
- return 1;
- }
- }
opt.option = PR_SockOpt_Nonblocking;
opt.value.non_blocking = PR_TRUE; /* default */
if (serverCertAuth.testFreshStatusFromSideChannel) {
@@ -1174,16 +1036,13 @@ run(void)
goto done;
}
- if (useDTLS) {
- s = DTLS_ImportFD(NULL, s);
- } else {
- s = SSL_ImportFD(NULL, s);
- }
+ s = SSL_ImportFD(NULL, s);
if (s == NULL) {
SECU_PrintError(progName, "error importing socket");
error = 1;
goto done;
}
+
SSL_SetPKCS11PinArg(s, &pwdata);
rv = SSL_OptionSet(s, SSL_SECURITY, 1);
@@ -1193,7 +1052,7 @@ run(void)
goto done;
}
- rv = SSL_OptionSet(s, actAsServer ? SSL_HANDSHAKE_AS_SERVER : SSL_HANDSHAKE_AS_CLIENT, 1);
+ rv = SSL_OptionSet(s, SSL_HANDSHAKE_AS_CLIENT, 1);
if (rv != SECSuccess) {
SECU_PrintError(progName, "error enabling client handshake");
error = 1;
@@ -1319,16 +1178,6 @@ run(void)
}
}
- /* Alternate ServerHello content type (TLS 1.3 only) */
- if (enableAltServerHello) {
- rv = SSL_UseAltServerHelloType(s, PR_TRUE);
- if (rv != SECSuccess) {
- SECU_PrintError(progName, "error enabling alternate ServerHello type");
- error = 1;
- goto done;
- }
- }
-
/* require the use of fixed finite-field DH groups */
if (requireDHNamedGroups) {
rv = SSL_OptionSet(s, SSL_REQUIRE_DH_NAMED_GROUPS, PR_TRUE);
@@ -1363,21 +1212,7 @@ run(void)
if (override) {
SSL_BadCertHook(s, ownBadCertHandler, NULL);
}
- if (actAsServer) {
- rv = installServerCertificate(s, nickname);
- if (rv != SECSuccess) {
- SECU_PrintError(progName, "error installing server cert");
- return 1;
- }
- rv = SSL_ConfigServerSessionIDCache(1024, 0, 0, ".");
- if (rv != SECSuccess) {
- SECU_PrintError(progName, "error configuring session cache");
- return 1;
- }
- initializedServerSessionCache = PR_TRUE;
- } else {
- SSL_GetClientAuthDataHook(s, own_GetClientAuthData, (void *)nickname);
- }
+ SSL_GetClientAuthDataHook(s, own_GetClientAuthData, (void *)nickname);
SSL_HandshakeCallback(s, handshakeCallback, hs2SniHostName);
if (hs1SniHostName) {
SSL_SetURL(s, hs1SniHostName);
@@ -1385,27 +1220,56 @@ run(void)
SSL_SetURL(s, host);
}
- if (actAsServer) {
- rv = SSL_ResetHandshake(s, PR_TRUE /* server */);
- if (rv != SECSuccess) {
- return 1;
- }
- } else {
- /* Try to connect to the server */
- rv = connectToServer(s, pollset);
- if (rv != SECSuccess) {
- ;
+ /* Try to connect to the server */
+ status = PR_Connect(s, &addr, PR_INTERVAL_NO_TIMEOUT);
+ if (status != PR_SUCCESS) {
+ if (PR_GetError() == PR_IN_PROGRESS_ERROR) {
+ if (verbose)
+ SECU_PrintError(progName, "connect");
+ milliPause(50 * multiplier);
+ pollset[SSOCK_FD].in_flags = PR_POLL_WRITE | PR_POLL_EXCEPT;
+ pollset[SSOCK_FD].out_flags = 0;
+ pollset[SSOCK_FD].fd = s;
+ while (1) {
+ FPRINTF(stderr,
+ "%s: about to call PR_Poll for connect completion!\n",
+ progName);
+ filesReady = PR_Poll(pollset, 1, PR_INTERVAL_NO_TIMEOUT);
+ if (filesReady < 0) {
+ SECU_PrintError(progName, "unable to connect (poll)");
+ error = 1;
+ goto done;
+ }
+ FPRINTF(stderr,
+ "%s: PR_Poll returned 0x%02x for socket out_flags.\n",
+ progName, pollset[SSOCK_FD].out_flags);
+ if (filesReady == 0) { /* shouldn't happen! */
+ FPRINTF(stderr, "%s: PR_Poll returned zero!\n", progName);
+ error = 1;
+ goto done;
+ }
+ status = PR_GetConnectStatus(pollset);
+ if (status == PR_SUCCESS) {
+ break;
+ }
+ if (PR_GetError() != PR_IN_PROGRESS_ERROR) {
+ SECU_PrintError(progName, "unable to connect (poll)");
+ error = 1;
+ goto done;
+ }
+ SECU_PrintError(progName, "poll");
+ milliPause(50 * multiplier);
+ }
+ } else {
+ SECU_PrintError(progName, "unable to connect");
error = 1;
goto done;
}
}
pollset[SSOCK_FD].fd = s;
- pollset[SSOCK_FD].in_flags = PR_POLL_EXCEPT;
- if (!actAsServer)
- pollset[SSOCK_FD].in_flags |= (clientSpeaksFirst ? 0 : PR_POLL_READ);
- else
- pollset[SSOCK_FD].in_flags |= PR_POLL_READ;
+ pollset[SSOCK_FD].in_flags = PR_POLL_EXCEPT |
+ (clientSpeaksFirst ? 0 : PR_POLL_READ);
pollset[STDIN_FD].fd = PR_GetSpecialFD(PR_StandardInput);
if (!REQUEST_WAITING) {
pollset[STDIN_FD].in_flags = PR_POLL_READ;
@@ -1455,11 +1319,9 @@ run(void)
** Select on stdin and on the socket. Write data from stdin to
** socket, read data from socket and write to stdout.
*/
- requestToExit = PR_FALSE;
FPRINTF(stderr, "%s: ready...\n", progName);
- while (!requestToExit &&
- ((pollset[SSOCK_FD].in_flags | pollset[STDIN_FD].in_flags) ||
- REQUEST_WAITING)) {
+ while ((pollset[SSOCK_FD].in_flags | pollset[STDIN_FD].in_flags) ||
+ REQUEST_WAITING) {
char buf[4000]; /* buffer for stdin */
int nb; /* num bytes read from stdin. */
@@ -1645,10 +1507,12 @@ main(int argc, char **argv)
}
}
+ SSL_VersionRangeGetSupported(ssl_variant_stream, &enabledVersions);
+
/* XXX: 'B' was used in the past but removed in 3.28,
* please leave some time before resuing it. */
optstate = PL_CreateOptState(argc, argv,
- "46A:CDFGHI:KL:M:OP:QR:STUV:W:X:YZa:bc:d:fgh:m:n:op:qr:st:uvw:z");
+ "46A:CDFGHI:KL:M:OR:STUV:W:YZa:bc:d:fgh:m:n:op:qr:st:uvw:z");
while ((optstatus = PL_GetNextOpt(optstate)) == PL_OPT_OK) {
switch (optstate->option) {
case '?':
@@ -1729,21 +1593,6 @@ main(int argc, char **argv)
};
break;
- case 'P':
- useDTLS = PR_TRUE;
- if (!strcmp(optstate->value, "server")) {
- actAsServer = 1;
- } else {
- if (strcmp(optstate->value, "client")) {
- Usage(progName);
- }
- }
- break;
-
- case 'Q':
- stopAfterHandshake = PR_TRUE;
- break;
-
case 'R':
rootModule = PORT_Strdup(optstate->value);
break;
@@ -1761,16 +1610,14 @@ main(int argc, char **argv)
break;
case 'V':
- versionString = PORT_Strdup(optstate->value);
- break;
-
- case 'X':
- if (!strcmp(optstate->value, "alt-server-hello")) {
- enableAltServerHello = PR_TRUE;
- } else {
+ if (SECU_ParseSSLVersionRangeString(optstate->value,
+ enabledVersions, &enabledVersions) !=
+ SECSuccess) {
+ fprintf(stderr, "Bad version specified.\n");
Usage(progName);
}
break;
+
case 'Y':
PrintCipherUsage(progName);
exit(0);
@@ -1880,19 +1727,8 @@ main(int argc, char **argv)
break;
}
}
- PL_DestroyOptState(optstate);
- SSL_VersionRangeGetSupported(useDTLS ? ssl_variant_datagram : ssl_variant_stream, &enabledVersions);
-
- if (versionString) {
- if (SECU_ParseSSLVersionRangeString(versionString,
- enabledVersions, &enabledVersions) !=
- SECSuccess) {
- fprintf(stderr, "Bad version specified.\n");
- Usage(progName);
- }
- PORT_Free(versionString);
- }
+ PL_DestroyOptState(optstate);
if (optstatus == PL_OPT_BAD) {
Usage(progName);
@@ -1922,7 +1758,7 @@ main(int argc, char **argv)
PR_Init(PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1);
PK11_SetPasswordFunc(SECU_GetModulePassword);
- memset(&addr, 0, sizeof(addr));
+
status = PR_StringToNetAddr(host, &addr);
if (status == PR_SUCCESS) {
addr.inet.port = PR_htons(portno);
@@ -1934,7 +1770,6 @@ main(int argc, char **argv)
addrInfo = PR_GetAddrInfoByName(host, PR_AF_UNSPEC,
PR_AI_ADDRCONFIG | PR_AI_NOCANONNAME);
if (!addrInfo) {
- fprintf(stderr, "HOSTNAME=%s\n", host);
SECU_PrintError(progName, "error looking up host");
error = 1;
goto done;
@@ -2049,7 +1884,7 @@ main(int argc, char **argv)
}
while (numConnections--) {
- error = run();
+ error = run_client();
if (error) {
goto done;
}
@@ -2080,12 +1915,6 @@ done:
}
if (NSS_IsInitialized()) {
SSL_ClearSessionCache();
- if (initializedServerSessionCache) {
- if (SSL_ShutdownServerSessionIDCache() != SECSuccess) {
- error = 1;
- }
- }
-
if (NSS_Shutdown() != SECSuccess) {
error = 1;
}
diff --git a/security/nss/coreconf/config.gypi b/security/nss/coreconf/config.gypi
index f4c3fbd0fd..9ea528ae4b 100644
--- a/security/nss/coreconf/config.gypi
+++ b/security/nss/coreconf/config.gypi
@@ -96,6 +96,7 @@
'mozilla_client%': 0,
'moz_fold_libs%': 0,
'moz_folded_library_name%': '',
+ 'ssl_enable_zlib%': 1,
'sanitizer_flags%': 0,
'test_build%': 0,
'no_zdefs%': 0,
@@ -108,7 +109,6 @@
'nss_public_dist_dir%': '<(nss_dist_dir)/public',
'nss_private_dist_dir%': '<(nss_dist_dir)/private',
'only_dev_random%': 1,
- 'disable_fips%': 1,
},
'target_defaults': {
# Settings specific to targets should go here.
@@ -125,12 +125,6 @@
'<(nss_dist_dir)/private/<(module)',
],
'conditions': [
- [ 'disable_fips==1', {
- 'defines': [
- 'NSS_FIPS_DISABLED',
- 'NSS_NO_INIT_SUPPORT',
- ],
- }],
[ 'OS!="android" and OS!="mac" and OS!="win"', {
'libraries': [
'-lpthread',
@@ -173,7 +167,7 @@
},
},
}],
- [ 'target_arch=="arm64" or target_arch=="aarch64" or target_arch=="sparc64" or target_arch=="ppc64" or target_arch=="ppc64le" or target_arch=="s390x" or target_arch=="mips64"', {
+ [ 'target_arch=="arm64" or target_arch=="aarch64"', {
'defines': [
'NSS_USE_64',
],
@@ -300,6 +294,7 @@
'Common': {
'abstract': 1,
'defines': [
+ 'NSS_NO_INIT_SUPPORT',
'USE_UTIL_DIRECTLY',
'NO_NSPR_10_SUPPORT',
'SSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES',
diff --git a/security/nss/coreconf/config.mk b/security/nss/coreconf/config.mk
index 55d95c30ea..09b733d5ca 100644
--- a/security/nss/coreconf/config.mk
+++ b/security/nss/coreconf/config.mk
@@ -146,6 +146,10 @@ endif
# [16.0] Global environ ment defines
#######################################################################
+ifdef NSS_DISABLE_ECC
+DEFINES += -DNSS_DISABLE_ECC
+endif
+
ifdef NSS_ALLOW_UNSUPPORTED_CRITICAL
DEFINES += -DNSS_ALLOW_UNSUPPORTED_CRITICAL
endif
@@ -172,7 +176,7 @@ endif
# FIPS support requires startup tests to be executed at load time of shared modules.
# For performance reasons, these tests are disabled by default.
-# When compiling binaries that must support FIPS mode,
+# When compiling binaries that must support FIPS mode,
# you should define NSS_FORCE_FIPS
#
# NSS_NO_INIT_SUPPORT is always defined on platforms that don't support
@@ -199,3 +203,8 @@ DEFINES += -DNO_NSPR_10_SUPPORT
# Hide old, deprecated, TLS cipher suite names when building NSS
DEFINES += -DSSL_DISABLE_DEPRECATED_CIPHER_SUITE_NAMES
+
+# Mozilla's mozilla/modules/zlib/src/zconf.h adds the MOZ_Z_ prefix to zlib
+# exported symbols, which causes problem when NSS is built as part of Mozilla.
+# So we add a NSS_SSL_ENABLE_ZLIB variable to allow Mozilla to turn this off.
+NSS_SSL_ENABLE_ZLIB = 1
diff --git a/security/nss/coreconf/coreconf.dep b/security/nss/coreconf/coreconf.dep
index 5182f75552..590d1bfaee 100644
--- a/security/nss/coreconf/coreconf.dep
+++ b/security/nss/coreconf/coreconf.dep
@@ -10,3 +10,4 @@
*/
#error "Do not include this header file."
+
diff --git a/security/nss/coreconf/werror.py b/security/nss/coreconf/werror.py
index c469c40029..0d3843f64e 100644
--- a/security/nss/coreconf/werror.py
+++ b/security/nss/coreconf/werror.py
@@ -24,7 +24,7 @@ def main():
# If we aren't clang, make sure we have gcc 4.8 at least
if not cc_is_clang:
try:
- v = subprocess.check_output([cc, '-dumpversion'], stderr=sink).decode("utf-8")
+ v = subprocess.check_output([cc, '-dumpversion'], stderr=sink)
v = v.strip(' \r\n').split('.')
v = list(map(int, v))
if v[0] < 4 or (v[0] == 4 and v[1] < 8):
diff --git a/security/nss/cpputil/.clang-format b/security/nss/cpputil/.clang-format
deleted file mode 100644
index 06e3c5115f..0000000000
--- a/security/nss/cpputil/.clang-format
+++ /dev/null
@@ -1,4 +0,0 @@
----
-Language: Cpp
-BasedOnStyle: Google
-...
diff --git a/security/nss/cpputil/Makefile b/security/nss/cpputil/Makefile
deleted file mode 100644
index 7adfc61179..0000000000
--- a/security/nss/cpputil/Makefile
+++ /dev/null
@@ -1,49 +0,0 @@
-#! gmake
-#
-# 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/.
-
-#######################################################################
-# (1) Include initial platform-independent assignments (MANDATORY). #
-#######################################################################
-
-include manifest.mn
-
-#######################################################################
-# (2) Include "global" configuration information. (OPTIONAL) #
-#######################################################################
-
-include $(CORE_DEPTH)/coreconf/config.mk
-
-#######################################################################
-# (3) Include "component" configuration information. (OPTIONAL) #
-#######################################################################
-
-ifeq (WINNT,$(OS_ARCH))
-OS_CFLAGS += -EHsc
-else
-CXXFLAGS += -std=c++0x
-endif
-
-#######################################################################
-# (4) Include "local" platform-dependent assignments (OPTIONAL). #
-#######################################################################
-
-include config.mk
-
-#######################################################################
-# (5) Execute "global" rules. (OPTIONAL) #
-#######################################################################
-
-include $(CORE_DEPTH)/coreconf/rules.mk
-
-#######################################################################
-# (6) Execute "component" rules. (OPTIONAL) #
-#######################################################################
-
-
-
-#######################################################################
-# (7) Execute "local" rules. (OPTIONAL). #
-#######################################################################
diff --git a/security/nss/cpputil/README b/security/nss/cpputil/README
deleted file mode 100644
index 22297dd33f..0000000000
--- a/security/nss/cpputil/README
+++ /dev/null
@@ -1,11 +0,0 @@
-######################################
-## PLEASE READ BEFORE USING CPPUTIL ##
-######################################
-
-This is a static library supposed to be mainly used by NSS internally. We use
-it for testing, fuzzing, and a few new tools written in C++ that we're
-experimenting with.
-
-You might find it handy to use for your own projects but please be aware that
-we will make no promises your application won't break in the future. We will
-provide no support if you decide to link against it.
diff --git a/security/nss/cpputil/config.mk b/security/nss/cpputil/config.mk
deleted file mode 100644
index b8c03de796..0000000000
--- a/security/nss/cpputil/config.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-
-#
-# Override TARGETS variable so that only static libraries
-# are specifed as dependencies within rules.mk.
-#
-
-TARGETS = $(LIBRARY)
-SHARED_LIBRARY =
-IMPORT_LIBRARY =
-PROGRAM =
-
diff --git a/security/nss/cpputil/cpputil.gyp b/security/nss/cpputil/cpputil.gyp
deleted file mode 100644
index 5042acf5cd..0000000000
--- a/security/nss/cpputil/cpputil.gyp
+++ /dev/null
@@ -1,29 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-{
- 'includes': [
- '../coreconf/config.gypi',
- ],
- 'targets': [
- {
- 'target_name': 'cpputil',
- 'type': 'static_library',
- 'sources': [
- 'databuffer.cc',
- 'dummy_io.cc',
- 'dummy_io_fwd.cc',
- 'tls_parser.cc',
- ],
- 'dependencies': [
- '<(DEPTH)/exports.gyp:nss_exports',
- ],
- 'direct_dependent_settings': {
- 'include_dirs': [
- '<(DEPTH)/cpputil',
- ],
- },
- },
- ],
-}
-
diff --git a/security/nss/cpputil/cpputil.h b/security/nss/cpputil/cpputil.h
deleted file mode 100644
index 017ce9bfc5..0000000000
--- a/security/nss/cpputil/cpputil.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef cpputil_h__
-#define cpputil_h__
-
-static unsigned char* toUcharPtr(const uint8_t* v) {
- return const_cast<unsigned char*>(static_cast<const unsigned char*>(v));
-}
-
-#endif // cpputil_h__
diff --git a/security/nss/cpputil/databuffer.cc b/security/nss/cpputil/databuffer.cc
deleted file mode 100644
index d60ebccb34..0000000000
--- a/security/nss/cpputil/databuffer.cc
+++ /dev/null
@@ -1,127 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "databuffer.h"
-#include <algorithm>
-#include <cassert>
-#include <cstring>
-#include <iomanip>
-#include <iostream>
-#if defined(WIN32) || defined(WIN64)
-#include <winsock2.h>
-#else
-#include <arpa/inet.h>
-#endif
-
-namespace nss_test {
-
-void DataBuffer::Assign(const uint8_t* data, size_t len) {
- if (data) {
- Allocate(len);
- memcpy(static_cast<void*>(data_), static_cast<const void*>(data), len);
- } else {
- assert(len == 0);
- data_ = nullptr;
- len_ = 0;
- }
-}
-
-// Write will do a new allocation and expand the size of the buffer if needed.
-// Returns the offset of the end of the write.
-size_t DataBuffer::Write(size_t index, const uint8_t* val, size_t count) {
- assert(val);
- if (index + count > len_) {
- size_t newlen = index + count;
- uint8_t* tmp = new uint8_t[newlen]; // Always > 0.
- if (data_) {
- memcpy(static_cast<void*>(tmp), static_cast<const void*>(data_), len_);
- }
- if (index > len_) {
- memset(static_cast<void*>(tmp + len_), 0, index - len_);
- }
- delete[] data_;
- data_ = tmp;
- len_ = newlen;
- }
- if (data_) {
- memcpy(static_cast<void*>(data_ + index), static_cast<const void*>(val),
- count);
- }
- return index + count;
-}
-
-// Write an integer, also performing host-to-network order conversion.
-// Returns the offset of the end of the write.
-size_t DataBuffer::Write(size_t index, uint32_t val, size_t count) {
- assert(count <= sizeof(uint32_t));
- uint32_t nvalue = htonl(val);
- auto* addr = reinterpret_cast<const uint8_t*>(&nvalue);
- return Write(index, addr + sizeof(uint32_t) - count, count);
-}
-
-void DataBuffer::Splice(const uint8_t* ins, size_t ins_len, size_t index,
- size_t remove) {
- assert(ins);
- uint8_t* old_value = data_;
- size_t old_len = len_;
-
- // The amount of stuff remaining from the tail of the old.
- size_t tail_len = old_len - (std::min)(old_len, index + remove);
- // The new length: the head of the old, the new, and the tail of the old.
- len_ = index + ins_len + tail_len;
- data_ = new uint8_t[len_ ? len_ : 1];
-
- // The head of the old.
- if (old_value) {
- Write(0, old_value, (std::min)(old_len, index));
- }
- // Maybe a gap.
- if (old_value && index > old_len) {
- memset(old_value + index, 0, index - old_len);
- }
- // The new.
- Write(index, ins, ins_len);
- // The tail of the old.
- if (tail_len > 0) {
- Write(index + ins_len, old_value + index + remove, tail_len);
- }
-
- delete[] old_value;
-}
-
-// This can't use the same trick as Write(), since we might be reading from a
-// smaller data source.
-bool DataBuffer::Read(size_t index, size_t count, uint64_t* val) const {
- assert(count <= sizeof(uint64_t));
- assert(val);
- if ((index > len()) || (count > (len() - index))) {
- return false;
- }
- *val = 0;
- for (size_t i = 0; i < count; ++i) {
- *val = (*val << 8) | data()[index + i];
- }
- return true;
-}
-
-bool DataBuffer::Read(size_t index, size_t count, uint32_t* val) const {
- assert(count <= sizeof(uint32_t));
- uint64_t tmp;
-
- if (!Read(index, count, &tmp)) {
- return false;
- }
- *val = tmp & 0xffffffff;
- return true;
-}
-
-size_t DataBuffer::logging_limit = 32;
-
-/* static */ void DataBuffer::SetLogLimit(size_t limit) {
- DataBuffer::logging_limit = limit;
-}
-
-} // namespace nss_test
diff --git a/security/nss/cpputil/databuffer.h b/security/nss/cpputil/databuffer.h
deleted file mode 100644
index 58e07efe19..0000000000
--- a/security/nss/cpputil/databuffer.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef databuffer_h__
-#define databuffer_h__
-
-#include <algorithm>
-#include <cstring>
-#include <iomanip>
-#include <iostream>
-
-namespace nss_test {
-
-class DataBuffer {
- public:
- DataBuffer() : data_(nullptr), len_(0) {}
- DataBuffer(const uint8_t* data, size_t len) : data_(nullptr), len_(0) {
- Assign(data, len);
- }
- DataBuffer(const DataBuffer& other) : data_(nullptr), len_(0) {
- Assign(other);
- }
- ~DataBuffer() { delete[] data_; }
-
- DataBuffer& operator=(const DataBuffer& other) {
- if (&other != this) {
- Assign(other);
- }
- return *this;
- }
-
- void Allocate(size_t len) {
- delete[] data_;
- data_ = new uint8_t[len ? len : 1]; // Don't depend on new [0].
- len_ = len;
- }
-
- void Truncate(size_t len) { len_ = (std::min)(len_, len); }
-
- void Assign(const DataBuffer& other) { Assign(other.data(), other.len()); }
-
- void Assign(const uint8_t* data, size_t len);
-
- // Write will do a new allocation and expand the size of the buffer if needed.
- // Returns the offset of the end of the write.
- size_t Write(size_t index, const uint8_t* val, size_t count);
- size_t Write(size_t index, const DataBuffer& buf) {
- return Write(index, buf.data(), buf.len());
- }
-
- // Write an integer, also performing host-to-network order conversion.
- // Returns the offset of the end of the write.
- size_t Write(size_t index, uint32_t val, size_t count);
-
- // Starting at |index|, remove |remove| bytes and replace them with the
- // contents of |buf|.
- void Splice(const DataBuffer& buf, size_t index, size_t remove = 0) {
- Splice(buf.data(), buf.len(), index, remove);
- }
-
- void Splice(const uint8_t* ins, size_t ins_len, size_t index,
- size_t remove = 0);
- void Append(const DataBuffer& buf) { Splice(buf, len_); }
-
- bool Read(size_t index, size_t count, uint64_t* val) const;
- bool Read(size_t index, size_t count, uint32_t* val) const;
-
- const uint8_t* data() const { return data_; }
- uint8_t* data() { return data_; }
- size_t len() const { return len_; }
- bool empty() const { return len_ == 0; }
-
- static void SetLogLimit(size_t limit);
- friend std::ostream& operator<<(std::ostream& stream, const DataBuffer& buf);
-
- private:
- static size_t logging_limit;
- uint8_t* data_;
- size_t len_;
-};
-
-inline std::ostream& operator<<(std::ostream& stream, const DataBuffer& buf) {
- stream << "[" << buf.len() << "] ";
- for (size_t i = 0; i < buf.len(); ++i) {
- if (i >= DataBuffer::logging_limit) {
- stream << "...";
- break;
- }
- stream << std::hex << std::setfill('0') << std::setw(2)
- << static_cast<unsigned>(buf.data()[i]);
- }
- stream << std::dec;
- return stream;
-}
-
-inline bool operator==(const DataBuffer& a, const DataBuffer& b) {
- return (a.empty() && b.empty()) ||
- (a.len() == b.len() && 0 == memcmp(a.data(), b.data(), a.len()));
-}
-
-inline bool operator!=(const DataBuffer& a, const DataBuffer& b) {
- return !(a == b);
-}
-
-} // namespace nss_test
-
-#endif
diff --git a/security/nss/cpputil/dummy_io.cc b/security/nss/cpputil/dummy_io.cc
deleted file mode 100644
index ef45db8339..0000000000
--- a/security/nss/cpputil/dummy_io.cc
+++ /dev/null
@@ -1,225 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include <assert.h>
-#include <iostream>
-
-#include "prerror.h"
-#include "prio.h"
-
-#include "dummy_io.h"
-
-#define UNIMPLEMENTED() \
- std::cerr << "Unimplemented: " << __FUNCTION__ << std::endl; \
- assert(false);
-
-extern const struct PRIOMethods DummyMethodsForward;
-
-ScopedPRFileDesc DummyIOLayerMethods::CreateFD(PRDescIdentity id,
- DummyIOLayerMethods *methods) {
- ScopedPRFileDesc fd(PR_CreateIOLayerStub(id, &DummyMethodsForward));
- assert(fd);
- if (!fd) {
- return nullptr;
- }
- fd->secret = reinterpret_cast<PRFilePrivate *>(methods);
- return fd;
-}
-
-PRStatus DummyIOLayerMethods::Close(PRFileDesc *f) {
- f->secret = nullptr;
- f->dtor(f);
- return PR_SUCCESS;
-}
-
-int32_t DummyIOLayerMethods::Read(PRFileDesc *f, void *buf, int32_t length) {
- UNIMPLEMENTED();
- return -1;
-}
-
-int32_t DummyIOLayerMethods::Write(PRFileDesc *f, const void *buf,
- int32_t length) {
- UNIMPLEMENTED();
- return -1;
-}
-
-int32_t DummyIOLayerMethods::Available(PRFileDesc *f) {
- UNIMPLEMENTED();
- return -1;
-}
-
-int64_t DummyIOLayerMethods::Available64(PRFileDesc *f) {
- UNIMPLEMENTED();
- return -1;
-}
-
-PRStatus DummyIOLayerMethods::Sync(PRFileDesc *f) {
- UNIMPLEMENTED();
- return PR_FAILURE;
-}
-
-int32_t DummyIOLayerMethods::Seek(PRFileDesc *f, int32_t offset,
- PRSeekWhence how) {
- UNIMPLEMENTED();
- return -1;
-}
-
-int64_t DummyIOLayerMethods::Seek64(PRFileDesc *f, int64_t offset,
- PRSeekWhence how) {
- UNIMPLEMENTED();
- return -1;
-}
-
-PRStatus DummyIOLayerMethods::FileInfo(PRFileDesc *f, PRFileInfo *info) {
- UNIMPLEMENTED();
- return PR_FAILURE;
-}
-
-PRStatus DummyIOLayerMethods::FileInfo64(PRFileDesc *f, PRFileInfo64 *info) {
- UNIMPLEMENTED();
- return PR_FAILURE;
-}
-
-int32_t DummyIOLayerMethods::Writev(PRFileDesc *f, const PRIOVec *iov,
- int32_t iov_size, PRIntervalTime to) {
- UNIMPLEMENTED();
- return -1;
-}
-
-PRStatus DummyIOLayerMethods::Connect(PRFileDesc *f, const PRNetAddr *addr,
- PRIntervalTime to) {
- UNIMPLEMENTED();
- return PR_FAILURE;
-}
-
-PRFileDesc *DummyIOLayerMethods::Accept(PRFileDesc *sd, PRNetAddr *addr,
- PRIntervalTime to) {
- UNIMPLEMENTED();
- return nullptr;
-}
-
-PRStatus DummyIOLayerMethods::Bind(PRFileDesc *f, const PRNetAddr *addr) {
- UNIMPLEMENTED();
- return PR_FAILURE;
-}
-
-PRStatus DummyIOLayerMethods::Listen(PRFileDesc *f, int32_t depth) {
- UNIMPLEMENTED();
- return PR_FAILURE;
-}
-
-PRStatus DummyIOLayerMethods::Shutdown(PRFileDesc *f, int32_t how) {
- return PR_SUCCESS;
-}
-
-int32_t DummyIOLayerMethods::Recv(PRFileDesc *f, void *buf, int32_t buflen,
- int32_t flags, PRIntervalTime to) {
- UNIMPLEMENTED();
- return -1;
-}
-
-// Note: this is always nonblocking and assumes a zero timeout.
-int32_t DummyIOLayerMethods::Send(PRFileDesc *f, const void *buf,
- int32_t amount, int32_t flags,
- PRIntervalTime to) {
- return Write(f, buf, amount);
-}
-
-int32_t DummyIOLayerMethods::Recvfrom(PRFileDesc *f, void *buf, int32_t amount,
- int32_t flags, PRNetAddr *addr,
- PRIntervalTime to) {
- UNIMPLEMENTED();
- return -1;
-}
-
-int32_t DummyIOLayerMethods::Sendto(PRFileDesc *f, const void *buf,
- int32_t amount, int32_t flags,
- const PRNetAddr *addr, PRIntervalTime to) {
- UNIMPLEMENTED();
- return -1;
-}
-
-int16_t DummyIOLayerMethods::Poll(PRFileDesc *f, int16_t in_flags,
- int16_t *out_flags) {
- UNIMPLEMENTED();
- return -1;
-}
-
-int32_t DummyIOLayerMethods::AcceptRead(PRFileDesc *sd, PRFileDesc **nd,
- PRNetAddr **raddr, void *buf,
- int32_t amount, PRIntervalTime t) {
- UNIMPLEMENTED();
- return -1;
-}
-
-int32_t DummyIOLayerMethods::TransmitFile(PRFileDesc *sd, PRFileDesc *f,
- const void *headers, int32_t hlen,
- PRTransmitFileFlags flags,
- PRIntervalTime t) {
- UNIMPLEMENTED();
- return -1;
-}
-
-// TODO: Modify to return unique names for each channel
-// somehow, as opposed to always the same static address. The current
-// implementation messes up the session cache, which is why it's off
-// elsewhere
-PRStatus DummyIOLayerMethods::Getpeername(PRFileDesc *f, PRNetAddr *addr) {
- addr->inet.family = PR_AF_INET;
- addr->inet.port = 0;
- addr->inet.ip = 0;
-
- return PR_SUCCESS;
-}
-
-PRStatus DummyIOLayerMethods::Getsockname(PRFileDesc *f, PRNetAddr *addr) {
- UNIMPLEMENTED();
- return PR_FAILURE;
-}
-
-PRStatus DummyIOLayerMethods::Getsockoption(PRFileDesc *f,
- PRSocketOptionData *opt) {
- switch (opt->option) {
- case PR_SockOpt_Nonblocking:
- opt->value.non_blocking = PR_TRUE;
- return PR_SUCCESS;
- default:
- UNIMPLEMENTED();
- break;
- }
-
- return PR_FAILURE;
-}
-
-PRStatus DummyIOLayerMethods::Setsockoption(PRFileDesc *f,
- const PRSocketOptionData *opt) {
- switch (opt->option) {
- case PR_SockOpt_Nonblocking:
- return PR_SUCCESS;
- case PR_SockOpt_NoDelay:
- return PR_SUCCESS;
- default:
- UNIMPLEMENTED();
- break;
- }
-
- return PR_FAILURE;
-}
-
-int32_t DummyIOLayerMethods::Sendfile(PRFileDesc *out, PRSendFileData *in,
- PRTransmitFileFlags flags,
- PRIntervalTime to) {
- UNIMPLEMENTED();
- return -1;
-}
-
-PRStatus DummyIOLayerMethods::ConnectContinue(PRFileDesc *f, int16_t flags) {
- UNIMPLEMENTED();
- return PR_FAILURE;
-}
-
-int32_t DummyIOLayerMethods::Reserved(PRFileDesc *f) {
- UNIMPLEMENTED();
- return -1;
-}
diff --git a/security/nss/cpputil/dummy_io.h b/security/nss/cpputil/dummy_io.h
deleted file mode 100644
index 797ac61133..0000000000
--- a/security/nss/cpputil/dummy_io.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef dummy_io_h__
-#define dummy_io_h__
-
-#include "prerror.h"
-#include "prio.h"
-
-#include "scoped_ptrs.h"
-
-class DummyIOLayerMethods {
- public:
- static ScopedPRFileDesc CreateFD(PRDescIdentity id,
- DummyIOLayerMethods *methods);
-
- virtual PRStatus Close(PRFileDesc *f);
- virtual int32_t Read(PRFileDesc *f, void *buf, int32_t length);
- virtual int32_t Write(PRFileDesc *f, const void *buf, int32_t length);
- virtual int32_t Available(PRFileDesc *f);
- virtual int64_t Available64(PRFileDesc *f);
- virtual PRStatus Sync(PRFileDesc *f);
- virtual int32_t Seek(PRFileDesc *f, int32_t offset, PRSeekWhence how);
- virtual int64_t Seek64(PRFileDesc *f, int64_t offset, PRSeekWhence how);
- virtual PRStatus FileInfo(PRFileDesc *f, PRFileInfo *info);
- virtual PRStatus FileInfo64(PRFileDesc *f, PRFileInfo64 *info);
- virtual int32_t Writev(PRFileDesc *f, const PRIOVec *iov, int32_t iov_size,
- PRIntervalTime to);
- virtual PRStatus Connect(PRFileDesc *f, const PRNetAddr *addr,
- PRIntervalTime to);
- virtual PRFileDesc *Accept(PRFileDesc *sd, PRNetAddr *addr,
- PRIntervalTime to);
- virtual PRStatus Bind(PRFileDesc *f, const PRNetAddr *addr);
- virtual PRStatus Listen(PRFileDesc *f, int32_t depth);
- virtual PRStatus Shutdown(PRFileDesc *f, int32_t how);
- virtual int32_t Recv(PRFileDesc *f, void *buf, int32_t buflen, int32_t flags,
- PRIntervalTime to);
- virtual int32_t Send(PRFileDesc *f, const void *buf, int32_t amount,
- int32_t flags, PRIntervalTime to);
- virtual int32_t Recvfrom(PRFileDesc *f, void *buf, int32_t amount,
- int32_t flags, PRNetAddr *addr, PRIntervalTime to);
- virtual int32_t Sendto(PRFileDesc *f, const void *buf, int32_t amount,
- int32_t flags, const PRNetAddr *addr,
- PRIntervalTime to);
- virtual int16_t Poll(PRFileDesc *f, int16_t in_flags, int16_t *out_flags);
- virtual int32_t AcceptRead(PRFileDesc *sd, PRFileDesc **nd, PRNetAddr **raddr,
- void *buf, int32_t amount, PRIntervalTime t);
- virtual int32_t TransmitFile(PRFileDesc *sd, PRFileDesc *f,
- const void *headers, int32_t hlen,
- PRTransmitFileFlags flags, PRIntervalTime t);
- virtual PRStatus Getpeername(PRFileDesc *f, PRNetAddr *addr);
- virtual PRStatus Getsockname(PRFileDesc *f, PRNetAddr *addr);
- virtual PRStatus Getsockoption(PRFileDesc *f, PRSocketOptionData *opt);
- virtual PRStatus Setsockoption(PRFileDesc *f, const PRSocketOptionData *opt);
- virtual int32_t Sendfile(PRFileDesc *out, PRSendFileData *in,
- PRTransmitFileFlags flags, PRIntervalTime to);
- virtual PRStatus ConnectContinue(PRFileDesc *f, int16_t flags);
- virtual int32_t Reserved(PRFileDesc *f);
-};
-
-#endif // dummy_io_h__
diff --git a/security/nss/cpputil/dummy_io_fwd.cc b/security/nss/cpputil/dummy_io_fwd.cc
deleted file mode 100644
index 5e53d9e1bc..0000000000
--- a/security/nss/cpputil/dummy_io_fwd.cc
+++ /dev/null
@@ -1,162 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "prio.h"
-
-#include "dummy_io.h"
-
-static DummyIOLayerMethods *ToMethods(PRFileDesc *f) {
- return reinterpret_cast<DummyIOLayerMethods *>(f->secret);
-}
-
-static PRStatus DummyClose(PRFileDesc *f) { return ToMethods(f)->Close(f); }
-
-static int32_t DummyRead(PRFileDesc *f, void *buf, int32_t length) {
- return ToMethods(f)->Read(f, buf, length);
-}
-
-static int32_t DummyWrite(PRFileDesc *f, const void *buf, int32_t length) {
- return ToMethods(f)->Write(f, buf, length);
-}
-
-static int32_t DummyAvailable(PRFileDesc *f) {
- return ToMethods(f)->Available(f);
-}
-
-static int64_t DummyAvailable64(PRFileDesc *f) {
- return ToMethods(f)->Available64(f);
-}
-
-static PRStatus DummySync(PRFileDesc *f) { return ToMethods(f)->Sync(f); }
-
-static int32_t DummySeek(PRFileDesc *f, int32_t offset, PRSeekWhence how) {
- return ToMethods(f)->Seek(f, offset, how);
-}
-
-static int64_t DummySeek64(PRFileDesc *f, int64_t offset, PRSeekWhence how) {
- return ToMethods(f)->Seek64(f, offset, how);
-}
-
-static PRStatus DummyFileInfo(PRFileDesc *f, PRFileInfo *info) {
- return ToMethods(f)->FileInfo(f, info);
-}
-
-static PRStatus DummyFileInfo64(PRFileDesc *f, PRFileInfo64 *info) {
- return ToMethods(f)->FileInfo64(f, info);
-}
-
-static int32_t DummyWritev(PRFileDesc *f, const PRIOVec *iov, int32_t iov_size,
- PRIntervalTime to) {
- return ToMethods(f)->Writev(f, iov, iov_size, to);
-}
-
-static PRStatus DummyConnect(PRFileDesc *f, const PRNetAddr *addr,
- PRIntervalTime to) {
- return ToMethods(f)->Connect(f, addr, to);
-}
-
-static PRFileDesc *DummyAccept(PRFileDesc *f, PRNetAddr *addr,
- PRIntervalTime to) {
- return ToMethods(f)->Accept(f, addr, to);
-}
-
-static PRStatus DummyBind(PRFileDesc *f, const PRNetAddr *addr) {
- return ToMethods(f)->Bind(f, addr);
-}
-
-static PRStatus DummyListen(PRFileDesc *f, int32_t depth) {
- return ToMethods(f)->Listen(f, depth);
-}
-
-static PRStatus DummyShutdown(PRFileDesc *f, int32_t how) {
- return ToMethods(f)->Shutdown(f, how);
-}
-
-static int32_t DummyRecv(PRFileDesc *f, void *buf, int32_t buflen,
- int32_t flags, PRIntervalTime to) {
- return ToMethods(f)->Recv(f, buf, buflen, flags, to);
-}
-
-static int32_t DummySend(PRFileDesc *f, const void *buf, int32_t amount,
- int32_t flags, PRIntervalTime to) {
- return ToMethods(f)->Send(f, buf, amount, flags, to);
-}
-
-static int32_t DummyRecvfrom(PRFileDesc *f, void *buf, int32_t amount,
- int32_t flags, PRNetAddr *addr,
- PRIntervalTime to) {
- return ToMethods(f)->Recvfrom(f, buf, amount, flags, addr, to);
-}
-
-static int32_t DummySendto(PRFileDesc *f, const void *buf, int32_t amount,
- int32_t flags, const PRNetAddr *addr,
- PRIntervalTime to) {
- return ToMethods(f)->Sendto(f, buf, amount, flags, addr, to);
-}
-
-static int16_t DummyPoll(PRFileDesc *f, int16_t in_flags, int16_t *out_flags) {
- return ToMethods(f)->Poll(f, in_flags, out_flags);
-}
-
-static int32_t DummyAcceptRead(PRFileDesc *f, PRFileDesc **nd,
- PRNetAddr **raddr, void *buf, int32_t amount,
- PRIntervalTime t) {
- return ToMethods(f)->AcceptRead(f, nd, raddr, buf, amount, t);
-}
-
-static int32_t DummyTransmitFile(PRFileDesc *sd, PRFileDesc *f,
- const void *headers, int32_t hlen,
- PRTransmitFileFlags flags, PRIntervalTime t) {
- return ToMethods(f)->TransmitFile(sd, f, headers, hlen, flags, t);
-}
-
-static PRStatus DummyGetpeername(PRFileDesc *f, PRNetAddr *addr) {
- return ToMethods(f)->Getpeername(f, addr);
-}
-
-static PRStatus DummyGetsockname(PRFileDesc *f, PRNetAddr *addr) {
- return ToMethods(f)->Getsockname(f, addr);
-}
-
-static PRStatus DummyGetsockoption(PRFileDesc *f, PRSocketOptionData *opt) {
- return ToMethods(f)->Getsockoption(f, opt);
-}
-
-static PRStatus DummySetsockoption(PRFileDesc *f,
- const PRSocketOptionData *opt) {
- return ToMethods(f)->Setsockoption(f, opt);
-}
-
-static int32_t DummySendfile(PRFileDesc *f, PRSendFileData *in,
- PRTransmitFileFlags flags, PRIntervalTime to) {
- return ToMethods(f)->Sendfile(f, in, flags, to);
-}
-
-static PRStatus DummyConnectContinue(PRFileDesc *f, int16_t flags) {
- return ToMethods(f)->ConnectContinue(f, flags);
-}
-
-static int32_t DummyReserved(PRFileDesc *f) {
- return ToMethods(f)->Reserved(f);
-}
-
-extern const struct PRIOMethods DummyMethodsForward = {
- PR_DESC_LAYERED, DummyClose,
- DummyRead, DummyWrite,
- DummyAvailable, DummyAvailable64,
- DummySync, DummySeek,
- DummySeek64, DummyFileInfo,
- DummyFileInfo64, DummyWritev,
- DummyConnect, DummyAccept,
- DummyBind, DummyListen,
- DummyShutdown, DummyRecv,
- DummySend, DummyRecvfrom,
- DummySendto, DummyPoll,
- DummyAcceptRead, DummyTransmitFile,
- DummyGetsockname, DummyGetpeername,
- DummyReserved, DummyReserved,
- DummyGetsockoption, DummySetsockoption,
- DummySendfile, DummyConnectContinue,
- DummyReserved, DummyReserved,
- DummyReserved, DummyReserved};
diff --git a/security/nss/cpputil/manifest.mn b/security/nss/cpputil/manifest.mn
deleted file mode 100644
index b3ccad8b59..0000000000
--- a/security/nss/cpputil/manifest.mn
+++ /dev/null
@@ -1,24 +0,0 @@
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-CORE_DEPTH = ..
-DEPTH = ..
-
-MODULE = nss
-LIBRARY_NAME = cpputil
-
-ifeq ($(NSS_BUILD_UTIL_ONLY),1)
-CPPSRCS = \
- $(NULL)
-else
-CPPSRCS = \
- databuffer.cc \
- dummy_io.cc \
- dummy_io_fwd.cc \
- tls_parser.cc \
- $(NULL)
-endif
-
-EXPORTS = \
- $(NULL)
diff --git a/security/nss/cpputil/scoped_ptrs.h b/security/nss/cpputil/scoped_ptrs.h
deleted file mode 100644
index b92b8132b7..0000000000
--- a/security/nss/cpputil/scoped_ptrs.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef scoped_ptrs_h__
-#define scoped_ptrs_h__
-
-#include <memory>
-#include "cert.h"
-#include "keyhi.h"
-#include "pk11pub.h"
-#include "pkcs11uri.h"
-
-struct ScopedDelete {
- void operator()(CERTCertificate* cert) { CERT_DestroyCertificate(cert); }
- void operator()(CERTCertificateList* list) {
- CERT_DestroyCertificateList(list);
- }
- void operator()(CERTName* name) { CERT_DestroyName(name); }
- void operator()(CERTCertList* list) { CERT_DestroyCertList(list); }
- void operator()(CERTSubjectPublicKeyInfo* spki) {
- SECKEY_DestroySubjectPublicKeyInfo(spki);
- }
- void operator()(PK11SlotInfo* slot) { PK11_FreeSlot(slot); }
- void operator()(PK11SymKey* key) { PK11_FreeSymKey(key); }
- void operator()(PRFileDesc* fd) { PR_Close(fd); }
- void operator()(SECAlgorithmID* id) { SECOID_DestroyAlgorithmID(id, true); }
- void operator()(SECItem* item) { SECITEM_FreeItem(item, true); }
- void operator()(SECKEYPublicKey* key) { SECKEY_DestroyPublicKey(key); }
- void operator()(SECKEYPrivateKey* key) { SECKEY_DestroyPrivateKey(key); }
- void operator()(SECKEYPrivateKeyList* list) {
- SECKEY_DestroyPrivateKeyList(list);
- }
- void operator()(PK11URI* uri) { PK11URI_DestroyURI(uri); }
- void operator()(PLArenaPool* arena) { PORT_FreeArena(arena, PR_FALSE); }
- void operator()(PK11Context* context) { PK11_DestroyContext(context, true); }
- void operator()(PK11GenericObject* obj) { PK11_DestroyGenericObject(obj); }
-};
-
-template <class T>
-struct ScopedMaybeDelete {
- void operator()(T* ptr) {
- if (ptr) {
- ScopedDelete del;
- del(ptr);
- }
- }
-};
-
-#define SCOPED(x) typedef std::unique_ptr<x, ScopedMaybeDelete<x> > Scoped##x
-
-SCOPED(CERTCertificate);
-SCOPED(CERTCertificateList);
-SCOPED(CERTCertList);
-SCOPED(CERTName);
-SCOPED(CERTSubjectPublicKeyInfo);
-SCOPED(PK11SlotInfo);
-SCOPED(PK11SymKey);
-SCOPED(PRFileDesc);
-SCOPED(SECAlgorithmID);
-SCOPED(SECItem);
-SCOPED(SECKEYPublicKey);
-SCOPED(SECKEYPrivateKey);
-SCOPED(SECKEYPrivateKeyList);
-SCOPED(PK11URI);
-SCOPED(PLArenaPool);
-SCOPED(PK11Context);
-SCOPED(PK11GenericObject);
-
-#undef SCOPED
-
-#endif // scoped_ptrs_h__
diff --git a/security/nss/cpputil/scoped_ptrs_util.h b/security/nss/cpputil/scoped_ptrs_util.h
deleted file mode 100644
index 2dbf34e1d3..0000000000
--- a/security/nss/cpputil/scoped_ptrs_util.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef scoped_ptrs_util_h__
-#define scoped_ptrs_util_h__
-
-#include <memory>
-#include "pkcs11uri.h"
-#include "secoid.h"
-
-struct ScopedDelete {
- void operator()(SECAlgorithmID* id) { SECOID_DestroyAlgorithmID(id, true); }
- void operator()(SECItem* item) { SECITEM_FreeItem(item, true); }
- void operator()(PK11URI* uri) { PK11URI_DestroyURI(uri); }
- void operator()(PLArenaPool* arena) { PORT_FreeArena(arena, PR_FALSE); }
-};
-
-template <class T>
-struct ScopedMaybeDelete {
- void operator()(T* ptr) {
- if (ptr) {
- ScopedDelete del;
- del(ptr);
- }
- }
-};
-
-#define SCOPED(x) typedef std::unique_ptr<x, ScopedMaybeDelete<x> > Scoped##x
-
-SCOPED(SECAlgorithmID);
-SCOPED(SECItem);
-SCOPED(PK11URI);
-
-#undef SCOPED
-
-#endif // scoped_ptrs_util_h__
diff --git a/security/nss/cpputil/tls_parser.cc b/security/nss/cpputil/tls_parser.cc
deleted file mode 100644
index e4c06aa910..0000000000
--- a/security/nss/cpputil/tls_parser.cc
+++ /dev/null
@@ -1,73 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "tls_parser.h"
-
-namespace nss_test {
-
-bool TlsParser::Read(uint8_t* val) {
- if (remaining() < 1) {
- return false;
- }
- *val = *ptr();
- consume(1);
- return true;
-}
-
-bool TlsParser::Read(uint32_t* val, size_t size) {
- if (size > sizeof(uint32_t)) {
- return false;
- }
-
- uint32_t v = 0;
- for (size_t i = 0; i < size; ++i) {
- uint8_t tmp;
- if (!Read(&tmp)) {
- return false;
- }
-
- v = (v << 8) | tmp;
- }
-
- *val = v;
- return true;
-}
-
-bool TlsParser::Read(DataBuffer* val, size_t len) {
- if (remaining() < len) {
- return false;
- }
-
- val->Assign(ptr(), len);
- consume(len);
- return true;
-}
-
-bool TlsParser::ReadVariable(DataBuffer* val, size_t len_size) {
- uint32_t len;
- if (!Read(&len, len_size)) {
- return false;
- }
- return Read(val, len);
-}
-
-bool TlsParser::Skip(size_t len) {
- if (len > remaining()) {
- return false;
- }
- consume(len);
- return true;
-}
-
-bool TlsParser::SkipVariable(size_t len_size) {
- uint32_t len;
- if (!Read(&len, len_size)) {
- return false;
- }
- return Skip(len);
-}
-
-} // namespace nss_test
diff --git a/security/nss/cpputil/tls_parser.h b/security/nss/cpputil/tls_parser.h
deleted file mode 100644
index a5f5771d56..0000000000
--- a/security/nss/cpputil/tls_parser.h
+++ /dev/null
@@ -1,145 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef tls_parser_h_
-#define tls_parser_h_
-
-#include <cstdint>
-#include <cstring>
-#include <memory>
-#if defined(WIN32) || defined(WIN64)
-#include <winsock2.h>
-#else
-#include <arpa/inet.h>
-#endif
-#include "databuffer.h"
-#include "sslt.h"
-
-namespace nss_test {
-
-const uint8_t kTlsChangeCipherSpecType = 20;
-const uint8_t kTlsAlertType = 21;
-const uint8_t kTlsHandshakeType = 22;
-const uint8_t kTlsApplicationDataType = 23;
-const uint8_t kTlsAltHandshakeType = 24;
-const uint8_t kTlsAckType = 25;
-
-const uint8_t kTlsHandshakeClientHello = 1;
-const uint8_t kTlsHandshakeServerHello = 2;
-const uint8_t kTlsHandshakeNewSessionTicket = 4;
-const uint8_t kTlsHandshakeHelloRetryRequest = 6;
-const uint8_t kTlsHandshakeEncryptedExtensions = 8;
-const uint8_t kTlsHandshakeCertificate = 11;
-const uint8_t kTlsHandshakeServerKeyExchange = 12;
-const uint8_t kTlsHandshakeCertificateRequest = 13;
-const uint8_t kTlsHandshakeCertificateVerify = 15;
-const uint8_t kTlsHandshakeClientKeyExchange = 16;
-const uint8_t kTlsHandshakeFinished = 20;
-
-const uint8_t kTlsAlertWarning = 1;
-const uint8_t kTlsAlertFatal = 2;
-
-const uint8_t kTlsAlertCloseNotify = 0;
-const uint8_t kTlsAlertUnexpectedMessage = 10;
-const uint8_t kTlsAlertBadRecordMac = 20;
-const uint8_t kTlsAlertRecordOverflow = 22;
-const uint8_t kTlsAlertHandshakeFailure = 40;
-const uint8_t kTlsAlertIllegalParameter = 47;
-const uint8_t kTlsAlertDecodeError = 50;
-const uint8_t kTlsAlertDecryptError = 51;
-const uint8_t kTlsAlertProtocolVersion = 70;
-const uint8_t kTlsAlertInternalError = 80;
-const uint8_t kTlsAlertInappropriateFallback = 86;
-const uint8_t kTlsAlertMissingExtension = 109;
-const uint8_t kTlsAlertUnsupportedExtension = 110;
-const uint8_t kTlsAlertUnrecognizedName = 112;
-const uint8_t kTlsAlertNoApplicationProtocol = 120;
-
-const uint8_t kTlsFakeChangeCipherSpec[] = {
- kTlsChangeCipherSpecType, // Type
- 0xfe,
- 0xff, // Version
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x00,
- 0x10, // Fictitious sequence #
- 0x00,
- 0x01, // Length
- 0x01 // Value
-};
-
-static const uint8_t kTls13PskKe = 0;
-static const uint8_t kTls13PskDhKe = 1;
-static const uint8_t kTls13PskAuth = 0;
-static const uint8_t kTls13PskSignAuth = 1;
-
-inline std::ostream& operator<<(std::ostream& os, SSLProtocolVariant v) {
- return os << ((v == ssl_variant_stream) ? "TLS" : "DTLS");
-}
-
-inline bool IsDtls(uint16_t version) { return (version & 0x8000) == 0x8000; }
-
-inline uint16_t NormalizeTlsVersion(uint16_t version) {
- if (version == 0xfeff) {
- return 0x0302; // special: DTLS 1.0 == TLS 1.1
- }
- if (IsDtls(version)) {
- return (version ^ 0xffff) + 0x0201;
- }
- return version;
-}
-
-inline uint16_t TlsVersionToDtlsVersion(uint16_t version) {
- if (version == 0x0302) {
- return 0xfeff;
- }
- if (version == 0x0304) {
- return version;
- }
- return 0xffff - version + 0x0201;
-}
-
-inline size_t WriteVariable(DataBuffer* target, size_t index,
- const DataBuffer& buf, size_t len_size) {
- index = target->Write(index, static_cast<uint32_t>(buf.len()), len_size);
- return target->Write(index, buf.data(), buf.len());
-}
-
-class TlsParser {
- public:
- TlsParser(const uint8_t* data, size_t len) : buffer_(data, len), offset_(0) {}
- explicit TlsParser(const DataBuffer& buf) : buffer_(buf), offset_(0) {}
-
- bool Read(uint8_t* val);
- // Read an integral type of specified width.
- bool Read(uint32_t* val, size_t size);
- // Reads len bytes into dest buffer, overwriting it.
- bool Read(DataBuffer* dest, size_t len);
- // Reads bytes into dest buffer, overwriting it. The number of bytes is
- // determined by reading from len_size bytes from the stream first.
- bool ReadVariable(DataBuffer* dest, size_t len_size);
-
- bool Skip(size_t len);
- bool SkipVariable(size_t len_size);
-
- size_t consumed() const { return offset_; }
- size_t remaining() const { return buffer_.len() - offset_; }
-
- private:
- void consume(size_t len) { offset_ += len; }
- const uint8_t* ptr() const { return buffer_.data() + offset_; }
-
- DataBuffer buffer_;
- size_t offset_;
-};
-
-} // namespace nss_test
-
-#endif
diff --git a/security/nss/doc/certutil.xml b/security/nss/doc/certutil.xml
index d5062bd5eb..461b213898 100644
--- a/security/nss/doc/certutil.xml
+++ b/security/nss/doc/certutil.xml
@@ -456,16 +456,6 @@ of the attribute codes:
</varlistentry>
<varlistentry>
- <term>--pss</term>
- <listitem><para>Restrict the generated certificate (with the <option>-S</option> option) or certificate request (with the <option>-R</option> option) to be used with the RSA-PSS signature scheme. This only works when the private key of the certificate or certificate request is RSA.</para></listitem>
- </varlistentry>
-
- <varlistentry>
- <term>--pss-sign</term>
- <listitem><para>Sign the generated certificate with the RSA-PSS signature scheme (with the <option>-C</option> or <option>-S</option> option). This only works when the private key of the signer's certificate is RSA. If the signer's certificate is restricted to RSA-PSS, it is not necessary to specify this option.</para></listitem>
- </varlistentry>
-
- <varlistentry>
<term>-z noise-file</term>
<listitem><para>Read a seed value from the specified file to generate a new private and public key pair. This argument makes it possible to use hardware-generated seed values or manually create a value from the keyboard. The minimum file size is 20 bytes.</para></listitem>
</varlistentry>
diff --git a/security/nss/doc/html/certutil.html b/security/nss/doc/html/certutil.html
index 902d1309a4..eb2e94322b 100644
--- a/security/nss/doc/html/certutil.html
+++ b/security/nss/doc/html/certutil.html
@@ -1,4 +1,4 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>CERTUTIL</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><link rel="home" href="index.html" title="CERTUTIL"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">CERTUTIL</th></tr></table><hr></div><div class="refentry"><a name="certutil"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>certutil — Manage keys and certificate in both NSS databases and other NSS tokens</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">certutil</code> [<em class="replaceable"><code>options</code></em>] [[<em class="replaceable"><code>arguments</code></em>]]</p></div></div><div class="refsection"><a name="idm140440587239488"></a><h2>STATUS</h2><p>This documentation is still work in progress. Please contribute to the initial review in <a class="ulink" href="https://bugzilla.mozilla.org/show_bug.cgi?id=836477" target="_top">Mozilla NSS bug 836477</a>
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>CERTUTIL</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="CERTUTIL"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">CERTUTIL</th></tr></table><hr></div><div class="refentry"><a name="certutil"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>certutil — Manage keys and certificate in both NSS databases and other NSS tokens</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">certutil</code> [<em class="replaceable"><code>options</code></em>] [[<em class="replaceable"><code>arguments</code></em>]]</p></div></div><div class="refsection"><a name="idm139774553663312"></a><h2>STATUS</h2><p>This documentation is still work in progress. Please contribute to the initial review in <a class="ulink" href="https://bugzilla.mozilla.org/show_bug.cgi?id=836477" target="_top">Mozilla NSS bug 836477</a>
</p></div><div class="refsection"><a name="description"></a><h2>Description</h2><p>The Certificate Database Tool, <span class="command"><strong>certutil</strong></span>, is a command-line utility that can create and modify certificate and key databases. It can specifically list, generate, modify, or delete certificates, create or change the password, generate new public and private key pairs, display the contents of the key database, or delete key pairs within the key database.</p><p>Certificate issuance, part of the key and certificate management process, requires that keys and certificates be created in the key database. This document discusses certificate and key database management. For information on the security module database management, see the <span class="command"><strong>modutil</strong></span> manpage.</p></div><div class="refsection"><a name="options"></a><h2>Command Options and Arguments</h2><p>Running <span class="command"><strong>certutil</strong></span> always requires one and only one command option to specify the type of certificate operation. Each command option may take zero or more arguments. The command option <code class="option">-H</code> will list all the command options and their relevant arguments.</p><p><span class="command"><strong>Command Options</strong></span></p><div class="variablelist"><dl class="variablelist"><dt><span class="term">-A </span></dt><dd><p>Add an existing certificate to a certificate database. The certificate database should already exist; if one is not present, this command option will initialize one by default.</p></dd><dt><span class="term">-B</span></dt><dd><p>Run a series of commands from the specified batch file. This requires the <code class="option">-i</code> argument.</p></dd><dt><span class="term">-C </span></dt><dd><p>Create a new binary certificate file from a binary certificate request file. Use the <code class="option">-i</code> argument to specify the certificate request file. If this argument is not used, <span class="command"><strong>certutil</strong></span> prompts for a filename. </p></dd><dt><span class="term">-D </span></dt><dd><p>Delete a certificate from the certificate database.</p></dd><dt><span class="term">--rename </span></dt><dd><p>Change the database nickname of a certificate.</p></dd><dt><span class="term">-E </span></dt><dd><p>Add an email certificate to the certificate database.</p></dd><dt><span class="term">-F</span></dt><dd><p>Delete a private key from a key database. Specify the key to delete with the -n argument. Specify the database from which to delete the key with the
<code class="option">-d</code> argument. Use the <code class="option">-k</code> argument to specify explicitly whether to delete a DSA, RSA, or ECC key. If you don't use the <code class="option">-k</code> argument, the option looks for an RSA key matching the specified nickname.
</p><p>
@@ -20,26 +20,25 @@ Add one or multiple extensions that certutil cannot encode yet, by loading their
duplicate nicknames. Giving a key type generates a new key pair;
giving the ID of an existing key reuses that key pair (which is
required to renew certificates).
- </p></dd><dt><span class="term">-l </span></dt><dd><p>Display detailed information when validating a certificate with the -V option.</p></dd><dt><span class="term">-m serial-number</span></dt><dd><p>Assign a unique serial number to a certificate being created. This operation should be performed by a CA. If no serial number is provided a default serial number is made from the current time. Serial numbers are limited to integers </p></dd><dt><span class="term">-n nickname</span></dt><dd><p>Specify the nickname of a certificate or key to list, create, add to a database, modify, or validate. Bracket the nickname string with quotation marks if it contains spaces.</p></dd><dt><span class="term">-o output-file</span></dt><dd><p>Specify the output file name for new certificates or binary certificate requests. Bracket the output-file string with quotation marks if it contains spaces. If this argument is not used the output destination defaults to standard output.</p></dd><dt><span class="term">-P dbPrefix</span></dt><dd><p>Specify the prefix used on the certificate and key database file. This argument is provided to support legacy servers. Most applications do not use a database prefix.</p></dd><dt><span class="term">-p phone</span></dt><dd><p>Specify a contact telephone number to include in new certificates or certificate requests. Bracket this string with quotation marks if it contains spaces.</p></dd><dt><span class="term">-q pqgfile or curve-name</span></dt><dd><p>Read an alternate PQG value from the specified file when generating DSA key pairs. If this argument is not used, <span class="command"><strong>certutil</strong></span> generates its own PQG value. PQG files are created with a separate DSA utility.</p><p>Elliptic curve name is one of the ones from nistp256, nistp384, nistp521, curve25519.</p><p>
- If a token is available that supports more curves, the foolowing curves are supported as well:
- sect163k1, nistk163, sect163r1, sect163r2,
- nistb163, sect193r1, sect193r2, sect233k1, nistk233,
- sect233r1, nistb233, sect239k1, sect283k1, nistk283,
- sect283r1, nistb283, sect409k1, nistk409, sect409r1,
- nistb409, sect571k1, nistk571, sect571r1, nistb571,
- secp160k1, secp160r1, secp160r2, secp192k1, secp192r1,
- nistp192, secp224k1, secp224r1, nistp224, secp256k1,
- secp256r1, secp384r1, secp521r1,
- prime192v1, prime192v2, prime192v3,
- prime239v1, prime239v2, prime239v3, c2pnb163v1,
- c2pnb163v2, c2pnb163v3, c2pnb176v1, c2tnb191v1,
- c2tnb191v2, c2tnb191v3,
- c2pnb208w1, c2tnb239v1, c2tnb239v2, c2tnb239v3,
- c2pnb272w1, c2pnb304w1,
- c2tnb359w1, c2pnb368w1, c2tnb431r1, secp112r1,
- secp112r2, secp128r1, secp128r2, sect113r1, sect113r2,
- sect131r1, sect131r2
- </p></dd><dt><span class="term">-r </span></dt><dd><p>Display a certificate's binary DER encoding when listing information about that certificate with the -L option.</p></dd><dt><span class="term">-s subject</span></dt><dd><p>Identify a particular certificate owner for new certificates or certificate requests. Bracket this string with quotation marks if it contains spaces. The subject identification format follows RFC #1485.</p></dd><dt><span class="term">-t trustargs</span></dt><dd><p>Specify the trust attributes to modify in an existing certificate or to apply to a certificate when creating it or adding it to a database. There are three available trust categories for each certificate, expressed in the order <span class="emphasis"><em>SSL, email, object signing</em></span> for each trust setting. In each category position, use none, any, or all
+ </p></dd><dt><span class="term">-l </span></dt><dd><p>Display detailed information when validating a certificate with the -V option.</p></dd><dt><span class="term">-m serial-number</span></dt><dd><p>Assign a unique serial number to a certificate being created. This operation should be performed by a CA. If no serial number is provided a default serial number is made from the current time. Serial numbers are limited to integers </p></dd><dt><span class="term">-n nickname</span></dt><dd><p>Specify the nickname of a certificate or key to list, create, add to a database, modify, or validate. Bracket the nickname string with quotation marks if it contains spaces.</p></dd><dt><span class="term">-o output-file</span></dt><dd><p>Specify the output file name for new certificates or binary certificate requests. Bracket the output-file string with quotation marks if it contains spaces. If this argument is not used the output destination defaults to standard output.</p></dd><dt><span class="term">-P dbPrefix</span></dt><dd><p>Specify the prefix used on the certificate and key database file. This argument is provided to support legacy servers. Most applications do not use a database prefix.</p></dd><dt><span class="term">-p phone</span></dt><dd><p>Specify a contact telephone number to include in new certificates or certificate requests. Bracket this string with quotation marks if it contains spaces.</p></dd><dt><span class="term">-q pqgfile or curve-name</span></dt><dd><p>Read an alternate PQG value from the specified file when generating DSA key pairs. If this argument is not used, <span class="command"><strong>certutil</strong></span> generates its own PQG value. PQG files are created with a separate DSA utility.</p><p>Elliptic curve name is one of the ones from nistp256, nistp384, nistp521, curve25519.</p><p>If a token is available that supports more curves, the foolowing curves are supported as well:
+ sect163k1, nistk163, sect163r1, sect163r2,
+ nistb163, sect193r1, sect193r2, sect233k1, nistk233,
+ sect233r1, nistb233, sect239k1, sect283k1, nistk283,
+ sect283r1, nistb283, sect409k1, nistk409, sect409r1,
+ nistb409, sect571k1, nistk571, sect571r1, nistb571,
+ secp160k1, secp160r1, secp160r2, secp192k1, secp192r1,
+ nistp192, secp224k1, secp224r1, nistp224, secp256k1,
+ secp256r1, secp384r1, secp521r1,
+ prime192v1, prime192v2, prime192v3,
+ prime239v1, prime239v2, prime239v3, c2pnb163v1,
+ c2pnb163v2, c2pnb163v3, c2pnb176v1, c2tnb191v1,
+ c2tnb191v2, c2tnb191v3,
+ c2pnb208w1, c2tnb239v1, c2tnb239v2, c2tnb239v3,
+ c2pnb272w1, c2pnb304w1,
+ c2tnb359w1, c2pnb368w1, c2tnb431r1, secp112r1,
+ secp112r2, secp128r1, secp128r2, sect113r1, sect113r2,
+ sect131r1, sect131r2</p>
+ </dd><dt><span class="term">-r </span></dt><dd><p>Display a certificate's binary DER encoding when listing information about that certificate with the -L option.</p></dd><dt><span class="term">-s subject</span></dt><dd><p>Identify a particular certificate owner for new certificates or certificate requests. Bracket this string with quotation marks if it contains spaces. The subject identification format follows RFC #1485.</p></dd><dt><span class="term">-t trustargs</span></dt><dd><p>Specify the trust attributes to modify in an existing certificate or to apply to a certificate when creating it or adding it to a database. There are three available trust categories for each certificate, expressed in the order <span class="emphasis"><em>SSL, email, object signing</em></span> for each trust setting. In each category position, use none, any, or all
of the attribute codes:
</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
<span class="command"><strong>p</strong></span> - Valid peer
@@ -60,7 +59,7 @@ of the attribute codes:
the certificate or adding it to a database. Express the offset in integers,
using a minus sign (-) to indicate a negative offset. If this argument is
not used, the validity period begins at the current system time. The length
- of the validity period is set with the -v argument. </p></dd><dt><span class="term">-X </span></dt><dd><p>Force the key and certificate database to open in read-write mode. This is used with the <code class="option">-U</code> and <code class="option">-L</code> command options.</p></dd><dt><span class="term">-x </span></dt><dd><p>Use <span class="command"><strong>certutil</strong></span> to generate the signature for a certificate being created or added to a database, rather than obtaining a signature from a separate CA.</p></dd><dt><span class="term">-y exp</span></dt><dd><p>Set an alternate exponent value to use in generating a new RSA public key for the database, instead of the default value of 65537. The available alternate values are 3 and 17.</p></dd><dt><span class="term">--pss</span></dt><dd><p>Restrict the generated certificate (with the <code class="option">-S</code> option) or certificate request (with the <code class="option">-R</code> option) to be used with the RSA-PSS signature scheme. This only works when the private key of the certificate or certificate request is RSA.</p></dd><dt><span class="term">--pss-sign</span></dt><dd><p>Sign the generated certificate with the RSA-PSS signature scheme (with the <code class="option">-C</code> or <code class="option">-S</code> option). This only works when the private key of the signer's certificate is RSA. If the signer's certificate is restricted to RSA-PSS, it is not necessary to specify this option.</p></dd><dt><span class="term">-z noise-file</span></dt><dd><p>Read a seed value from the specified file to generate a new private and public key pair. This argument makes it possible to use hardware-generated seed values or manually create a value from the keyboard. The minimum file size is 20 bytes.</p></dd><dt><span class="term">-Z hashAlg</span></dt><dd><p>Specify the hash algorithm to use with the -C, -S or -R command options. Possible keywords:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>MD2</p></li><li class="listitem"><p>MD4</p></li><li class="listitem"><p>MD5</p></li><li class="listitem"><p>SHA1</p></li><li class="listitem"><p>SHA224</p></li><li class="listitem"><p>SHA256</p></li><li class="listitem"><p>SHA384</p></li><li class="listitem"><p>SHA512</p></li></ul></div></dd><dt><span class="term">-0 SSO_password</span></dt><dd><p>Set a site security officer password on a token.</p></dd><dt><span class="term">-1 | --keyUsage keyword,keyword</span></dt><dd><p>Set an X.509 V3 Certificate Type Extension in the certificate. There are several available keywords:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
+ of the validity period is set with the -v argument. </p></dd><dt><span class="term">-X </span></dt><dd><p>Force the key and certificate database to open in read-write mode. This is used with the <code class="option">-U</code> and <code class="option">-L</code> command options.</p></dd><dt><span class="term">-x </span></dt><dd><p>Use <span class="command"><strong>certutil</strong></span> to generate the signature for a certificate being created or added to a database, rather than obtaining a signature from a separate CA.</p></dd><dt><span class="term">-y exp</span></dt><dd><p>Set an alternate exponent value to use in generating a new RSA public key for the database, instead of the default value of 65537. The available alternate values are 3 and 17.</p></dd><dt><span class="term">-z noise-file</span></dt><dd><p>Read a seed value from the specified file to generate a new private and public key pair. This argument makes it possible to use hardware-generated seed values or manually create a value from the keyboard. The minimum file size is 20 bytes.</p></dd><dt><span class="term">-Z hashAlg</span></dt><dd><p>Specify the hash algorithm to use with the -C, -S or -R command options. Possible keywords:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>MD2</p></li><li class="listitem"><p>MD4</p></li><li class="listitem"><p>MD5</p></li><li class="listitem"><p>SHA1</p></li><li class="listitem"><p>SHA224</p></li><li class="listitem"><p>SHA256</p></li><li class="listitem"><p>SHA384</p></li><li class="listitem"><p>SHA512</p></li></ul></div></dd><dt><span class="term">-0 SSO_password</span></dt><dd><p>Set a site security officer password on a token.</p></dd><dt><span class="term">-1 | --keyUsage keyword,keyword</span></dt><dd><p>Set an X.509 V3 Certificate Type Extension in the certificate. There are several available keywords:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
digitalSignature
</p></li><li class="listitem"><p>
nonRepudiation
diff --git a/security/nss/doc/html/pk12util.html b/security/nss/doc/html/pk12util.html
index 94dbf51e97..fe516dd83a 100644
--- a/security/nss/doc/html/pk12util.html
+++ b/security/nss/doc/html/pk12util.html
@@ -1,6 +1,6 @@
-<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>PK12UTIL</title><meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"><link rel="home" href="index.html" title="PK12UTIL"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">PK12UTIL</th></tr></table><hr></div><div class="refentry"><a name="pk12util"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>pk12util — Export and import keys and certificate to or from a PKCS #12 file and the NSS database</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">pk12util</code> [-i p12File|-l p12File|-o p12File] [-d [sql:]directory] [-h tokenname] [-P dbprefix] [-r] [-v] [-k slotPasswordFile|-K slotPassword] [-w p12filePasswordFile|-W p12filePassword]</p></div></div><div class="refsection"><a name="idm139975398059856"></a><h2>STATUS</h2><p>This documentation is still work in progress. Please contribute to the initial review in <a class="ulink" href="https://bugzilla.mozilla.org/show_bug.cgi?id=836477" target="_top">Mozilla NSS bug 836477</a>
- </p></div><div class="refsection"><a name="description"></a><h2>Description</h2><p>The PKCS #12 utility, <span class="command"><strong>pk12util</strong></span>, enables sharing certificates among any server that supports PKCS #12. The tool can import certificates and keys from PKCS #12 files into security databases, export certificates, and list certificates and keys.</p></div><div class="refsection"><a name="options"></a><h2>Options and Arguments</h2><p><span class="command"><strong>Options</strong></span></p><div class="variablelist"><dl class="variablelist"><dt><span class="term">-i p12file</span></dt><dd><p>Import keys and certificates from a PKCS #12 file into a security database.</p></dd><dt><span class="term">-l p12file</span></dt><dd><p>List the keys and certificates in PKCS #12 file.</p></dd><dt><span class="term">-o p12file</span></dt><dd><p>Export keys and certificates from the security database to a PKCS #12 file.</p></dd></dl></div><p><span class="command"><strong>Arguments</strong></span></p><div class="variablelist"><dl class="variablelist"><dt><span class="term">-c keyCipher</span></dt><dd><p>Specify the key encryption algorithm.</p></dd><dt><span class="term">-C certCipher</span></dt><dd><p>Specify the certiticate encryption algorithm.</p></dd><dt><span class="term">-d [sql:]directory</span></dt><dd><p>Specify the database directory into which to import to or export from certificates and keys.</p><p><span class="command"><strong>pk12util</strong></span> supports two types of databases: the legacy security databases (<code class="filename">cert8.db</code>, <code class="filename">key3.db</code>, and <code class="filename">secmod.db</code>) and new SQLite databases (<code class="filename">cert9.db</code>, <code class="filename">key4.db</code>, and <code class="filename">pkcs11.txt</code>). If the prefix <span class="command"><strong>sql:</strong></span> is not used, then the tool assumes that the given databases are in the old format.</p></dd><dt><span class="term">-h tokenname</span></dt><dd><p>Specify the name of the token to import into or export from.</p></dd><dt><span class="term">-k slotPasswordFile</span></dt><dd><p>Specify the text file containing the slot's password.</p></dd><dt><span class="term">-K slotPassword</span></dt><dd><p>Specify the slot's password.</p></dd><dt><span class="term">-m | --key-len keyLength</span></dt><dd><p>Specify the desired length of the symmetric key to be used to encrypt the private key.</p></dd><dt><span class="term">-n | --cert-key-len certKeyLength</span></dt><dd><p>Specify the desired length of the symmetric key to be used to encrypt the certificates and other meta-data.</p></dd><dt><span class="term">-n certname</span></dt><dd><p>Specify the nickname of the cert and private key to export.</p></dd><dt><span class="term">-P prefix</span></dt><dd><p>Specify the prefix used on the certificate and key databases. This option is provided as a special case.
- Changing the names of the certificate and key databases is not recommended.</p></dd><dt><span class="term">-r</span></dt><dd><p>Dumps all of the data in raw (binary) form. This must be saved as a DER file. The default is to return information in a pretty-print ASCII format, which displays the information about the certificates and public keys in the p12 file.</p></dd><dt><span class="term">-v </span></dt><dd><p>Enable debug logging when importing.</p></dd><dt><span class="term">-w p12filePasswordFile</span></dt><dd><p>Specify the text file containing the pkcs #12 file password.</p></dd><dt><span class="term">-W p12filePassword</span></dt><dd><p>Specify the pkcs #12 file password.</p></dd></dl></div></div><div class="refsection"><a name="return-codes"></a><h2>Return Codes</h2><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p> 0 - No error</p></li><li class="listitem"><p> 1 - User Cancelled</p></li><li class="listitem"><p> 2 - Usage error</p></li><li class="listitem"><p> 6 - NLS init error</p></li><li class="listitem"><p> 8 - Certificate DB open error</p></li><li class="listitem"><p> 9 - Key DB open error</p></li><li class="listitem"><p> 10 - File initialization error</p></li><li class="listitem"><p> 11 - Unicode conversion error</p></li><li class="listitem"><p> 12 - Temporary file creation error</p></li><li class="listitem"><p> 13 - PKCS11 get slot error</p></li><li class="listitem"><p> 14 - PKCS12 decoder start error</p></li><li class="listitem"><p> 15 - error read from import file</p></li><li class="listitem"><p> 16 - pkcs12 decode error</p></li><li class="listitem"><p> 17 - pkcs12 decoder verify error</p></li><li class="listitem"><p> 18 - pkcs12 decoder validate bags error</p></li><li class="listitem"><p> 19 - pkcs12 decoder import bags error</p></li><li class="listitem"><p> 20 - key db conversion version 3 to version 2 error</p></li><li class="listitem"><p> 21 - cert db conversion version 7 to version 5 error</p></li><li class="listitem"><p> 22 - cert and key dbs patch error</p></li><li class="listitem"><p> 23 - get default cert db error</p></li><li class="listitem"><p> 24 - find cert by nickname error</p></li><li class="listitem"><p> 25 - create export context error</p></li><li class="listitem"><p> 26 - PKCS12 add password itegrity error</p></li><li class="listitem"><p> 27 - cert and key Safes creation error</p></li><li class="listitem"><p> 28 - PKCS12 add cert and key error</p></li><li class="listitem"><p> 29 - PKCS12 encode error</p></li></ul></div></div><div class="refsection"><a name="examples"></a><h2>Examples</h2><p><span class="command"><strong>Importing Keys and Certificates</strong></span></p><p>The most basic usage of <span class="command"><strong>pk12util</strong></span> for importing a certificate or key is the PKCS #12 input file (<code class="option">-i</code>) and some way to specify the security database being accessed (either <code class="option">-d</code> for a directory or <code class="option">-h</code> for a token).
+<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>PK12UTIL</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="PK12UTIL"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">PK12UTIL</th></tr></table><hr></div><div class="refentry"><a name="pk12util"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>pk12util — Export and import keys and certificate to or from a PKCS #12 file and the NSS database</p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="cmdsynopsis"><p><code class="command">pk12util</code> [-i p12File|-l p12File|-o p12File] [-d [sql:]directory] [-h tokenname] [-P dbprefix] [-r] [-v] [-k slotPasswordFile|-K slotPassword] [-w p12filePasswordFile|-W p12filePassword]</p></div></div><div class="refsection"><a name="idm233250345408"></a><h2>STATUS</h2><p>This documentation is still work in progress. Please contribute to the initial review in <a class="ulink" href="https://bugzilla.mozilla.org/show_bug.cgi?id=836477" target="_top">Mozilla NSS bug 836477</a>
+ </p></div><div class="refsection"><a name="description"></a><h2>Description</h2><p>The PKCS #12 utility, <span class="command"><strong>pk12util</strong></span>, enables sharing certificates among any server that supports PKCS#12. The tool can import certificates and keys from PKCS#12 files into security databases, export certificates, and list certificates and keys.</p></div><div class="refsection"><a name="options"></a><h2>Options and Arguments</h2><p><span class="command"><strong>Options</strong></span></p><div class="variablelist"><dl class="variablelist"><dt><span class="term">-i p12file</span></dt><dd><p>Import keys and certificates from a PKCS#12 file into a security database.</p></dd><dt><span class="term">-l p12file</span></dt><dd><p>List the keys and certificates in PKCS#12 file.</p></dd><dt><span class="term">-o p12file</span></dt><dd><p>Export keys and certificates from the security database to a PKCS#12 file.</p></dd></dl></div><p><span class="command"><strong>Arguments</strong></span></p><div class="variablelist"><dl class="variablelist"><dt><span class="term">-c keyCipher</span></dt><dd><p>Specify the key encryption algorithm.</p></dd><dt><span class="term">-C certCipher</span></dt><dd><p>Specify the key cert (overall package) encryption algorithm.</p></dd><dt><span class="term">-d [sql:]directory</span></dt><dd><p>Specify the database directory into which to import to or export from certificates and keys.</p><p><span class="command"><strong>pk12util</strong></span> supports two types of databases: the legacy security databases (<code class="filename">cert8.db</code>, <code class="filename">key3.db</code>, and <code class="filename">secmod.db</code>) and new SQLite databases (<code class="filename">cert9.db</code>, <code class="filename">key4.db</code>, and <code class="filename">pkcs11.txt</code>). If the prefix <span class="command"><strong>sql:</strong></span> is not used, then the tool assumes that the given databases are in the old format.</p></dd><dt><span class="term">-h tokenname</span></dt><dd><p>Specify the name of the token to import into or export from.</p></dd><dt><span class="term">-k slotPasswordFile</span></dt><dd><p>Specify the text file containing the slot's password.</p></dd><dt><span class="term">-K slotPassword</span></dt><dd><p>Specify the slot's password.</p></dd><dt><span class="term">-m | --key-len keyLength</span></dt><dd><p>Specify the desired length of the symmetric key to be used to encrypt the private key.</p></dd><dt><span class="term">-n | --cert-key-len certKeyLength</span></dt><dd><p>Specify the desired length of the symmetric key to be used to encrypt the certificates and other meta-data.</p></dd><dt><span class="term">-n certname</span></dt><dd><p>Specify the nickname of the cert and private key to export.</p></dd><dt><span class="term">-P prefix</span></dt><dd><p>Specify the prefix used on the certificate and key databases. This option is provided as a special case.
+ Changing the names of the certificate and key databases is not recommended.</p></dd><dt><span class="term">-r</span></dt><dd><p>Dumps all of the data in raw (binary) form. This must be saved as a DER file. The default is to return information in a pretty-print ASCII format, which displays the information about the certificates and public keys in the p12 file.</p></dd><dt><span class="term">-v </span></dt><dd><p>Enable debug logging when importing.</p></dd><dt><span class="term">-w p12filePasswordFile</span></dt><dd><p>Specify the text file containing the pkcs #12 file password.</p></dd><dt><span class="term">-W p12filePassword</span></dt><dd><p>Specify the pkcs #12 file password.</p></dd></dl></div></div><div class="refsection"><a name="return-codes"></a><h2>Return Codes</h2><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p> 0 - No error</p></li><li class="listitem"><p> 1 - User Cancelled</p></li><li class="listitem"><p> 2 - Usage error</p></li><li class="listitem"><p> 6 - NLS init error</p></li><li class="listitem"><p> 8 - Certificate DB open error</p></li><li class="listitem"><p> 9 - Key DB open error</p></li><li class="listitem"><p> 10 - File initialization error</p></li><li class="listitem"><p> 11 - Unicode conversion error</p></li><li class="listitem"><p> 12 - Temporary file creation error</p></li><li class="listitem"><p> 13 - PKCS11 get slot error</p></li><li class="listitem"><p> 14 - PKCS12 decoder start error</p></li><li class="listitem"><p> 15 - error read from import file</p></li><li class="listitem"><p> 16 - pkcs12 decode error</p></li><li class="listitem"><p> 17 - pkcs12 decoder verify error</p></li><li class="listitem"><p> 18 - pkcs12 decoder validate bags error</p></li><li class="listitem"><p> 19 - pkcs12 decoder import bags error</p></li><li class="listitem"><p> 20 - key db conversion version 3 to version 2 error</p></li><li class="listitem"><p> 21 - cert db conversion version 7 to version 5 error</p></li><li class="listitem"><p> 22 - cert and key dbs patch error</p></li><li class="listitem"><p> 23 - get default cert db error</p></li><li class="listitem"><p> 24 - find cert by nickname error</p></li><li class="listitem"><p> 25 - create export context error</p></li><li class="listitem"><p> 26 - PKCS12 add password itegrity error</p></li><li class="listitem"><p> 27 - cert and key Safes creation error</p></li><li class="listitem"><p> 28 - PKCS12 add cert and key error</p></li><li class="listitem"><p> 29 - PKCS12 encode error</p></li></ul></div></div><div class="refsection"><a name="examples"></a><h2>Examples</h2><p><span class="command"><strong>Importing Keys and Certificates</strong></span></p><p>The most basic usage of <span class="command"><strong>pk12util</strong></span> for importing a certificate or key is the PKCS#12 input file (<code class="option">-i</code>) and some way to specify the security database being accessed (either <code class="option">-d</code> for a directory or <code class="option">-h</code> for a token).
</p><p>
pk12util -i p12File [-h tokenname] [-v] [-d [sql:]directory] [-P dbprefix] [-k slotPasswordFile|-K slotPassword] [-w p12filePasswordFile|-W p12filePassword]
</p><p>For example:</p><p> </p><pre class="programlisting"># pk12util -i /tmp/cert-files/users.p12 -d sql:/home/my/sharednssdb
@@ -12,7 +12,7 @@ and should contain at least one non-alphabetic character.
Enter new password:
Re-enter password:
Enter password for PKCS12 file:
-pk12util: PKCS12 IMPORT SUCCESSFUL</pre><p><span class="command"><strong>Exporting Keys and Certificates</strong></span></p><p>Using the <span class="command"><strong>pk12util</strong></span> command to export certificates and keys requires both the name of the certificate to extract from the database (<code class="option">-n</code>) and the PKCS #12-formatted output file to write to. There are optional parameters that can be used to encrypt the file to protect the certificate material.
+pk12util: PKCS12 IMPORT SUCCESSFUL</pre><p><span class="command"><strong>Exporting Keys and Certificates</strong></span></p><p>Using the <span class="command"><strong>pk12util</strong></span> command to export certificates and keys requires both the name of the certificate to extract from the database (<code class="option">-n</code>) and the PKCS#12-formatted output file to write to. There are optional parameters that can be used to encrypt the file to protect the certificate material.
</p><p>pk12util -o p12File -n certname [-c keyCipher] [-C certCipher] [-m|--key_len keyLen] [-n|--cert_key_len certKeyLen] [-d [sql:]directory] [-P dbprefix] [-k slotPasswordFile|-K slotPassword] [-w p12filePasswordFile|-W p12filePassword]</p><p>For example:</p><pre class="programlisting"># pk12util -o certs.p12 -n Server-Cert -d sql:/home/my/sharednssdb
Enter password for PKCS12 file:
Re-enter password: </pre><p><span class="command"><strong>Listing Keys and Certificates</strong></span></p><p>The information in a <code class="filename">.p12</code> file are not human-readable. The certificates and keys in the file can be printed (listed) in a human-readable pretty-print format that shows information for every certificate and any public keys in the <code class="filename">.p12</code> file.
@@ -48,7 +48,7 @@ Key(shrouded):
Certificate Friendly Name: Thawte Personal Freemail Issuing CA - Thawte Consulting
Certificate Friendly Name: Thawte Freemail Member's Thawte Consulting (Pty) Ltd. ID
- </pre></div><div class="refsection"><a name="encryption"></a><h2>Password Encryption</h2><p>PKCS #12 provides for not only the protection of the private keys but also the certificate and meta-data associated with the keys. Password-based encryption is used to protect private keys on export to a PKCS #12 file and, optionally, the associated certificates. If no algorithm is specified, the tool defaults to using PKCS #12 SHA-1 and 3-key triple DES for private key encryption. When not in FIPS mode, PKCS #12 SHA-1 and 40-bit RC4 is used for certificate encryption. When in FIPS mode, there is no certificate encryption. If certificate encryption is not wanted, specify <strong class="userinput"><code>"NONE"</code></strong> as the argument of the <code class="option">-C</code> option.</p><p>The private key is always protected with strong encryption by default.</p><p>Several types of ciphers are supported.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">PKCS #5 password-based encryption</span></dt><dd><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>PBES2 with AES-CBC-Pad as underlying encryption scheme (<strong class="userinput"><code>"AES-128-CBC"</code></strong>, <strong class="userinput"><code>"AES-192-CBC"</code></strong>, and <strong class="userinput"><code>"AES-256-CBC"</code></strong>)</p></li></ul></div></dd><dt><span class="term">PKCS #12 password-based encryption</span></dt><dd><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>SHA-1 and 128-bit RC4 (<strong class="userinput"><code>"PKCS #12 V2 PBE With SHA-1 And 128 Bit RC4"</code></strong> or <strong class="userinput"><code>"RC4"</code></strong>)</p></li><li class="listitem"><p>SHA-1 and 40-bit RC4 (<strong class="userinput"><code>"PKCS #12 V2 PBE With SHA-1 And 40 Bit RC4"</code></strong>) (used by default for certificate encryption in non-FIPS mode)</p></li><li class="listitem"><p>SHA-1 and 3-key triple-DES (<strong class="userinput"><code>"PKCS #12 V2 PBE With SHA-1 And 3KEY Triple DES-CBC"</code></strong> or <strong class="userinput"><code>"DES-EDE3-CBC"</code></strong>)</p></li><li class="listitem"><p>SHA-1 and 128-bit RC2 (<strong class="userinput"><code>"PKCS #12 V2 PBE With SHA-1 And 128 Bit RC2 CBC"</code></strong> or <strong class="userinput"><code>"RC2-CBC"</code></strong>)</p></li><li class="listitem"><p>SHA-1 and 40-bit RC2 (<strong class="userinput"><code>"PKCS #12 V2 PBE With SHA-1 And 40 Bit RC2 CBC"</code></strong>)</p></li></ul></div></dd></dl></div><p>With PKCS #12, the crypto provider may be the soft token module or an external hardware module. If the cryptographic module does not support the requested algorithm, then the next best fit will be selected (usually the default). If no suitable replacement for the desired algorithm can be found, the tool returns the error <span class="emphasis"><em>no security module can perform the requested operation</em></span>.</p></div><div class="refsection"><a name="databases"></a><h2>NSS Database Types</h2><p>NSS originally used BerkeleyDB databases to store security information.
+ </pre></div><div class="refsection"><a name="encryption"></a><h2>Password Encryption</h2><p>PKCS#12 provides for not only the protection of the private keys but also the certificate and meta-data associated with the keys. Password-based encryption is used to protect private keys on export to a PKCS#12 file and, optionally, the entire package. If no algorithm is specified, the tool defaults to using <span class="command"><strong>PKCS12 V2 PBE with SHA1 and 3KEY Triple DES-cbc</strong></span> for private key encryption. <span class="command"><strong>PKCS12 V2 PBE with SHA1 and 40 Bit RC4</strong></span> is the default for the overall package encryption when not in FIPS mode. When in FIPS mode, there is no package encryption.</p><p>The private key is always protected with strong encryption by default.</p><p>Several types of ciphers are supported.</p><div class="variablelist"><dl class="variablelist"><dt><span class="term">Symmetric CBC ciphers for PKCS#5 V2</span></dt><dd><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>DES-CBC</p></li><li class="listitem"><p>RC2-CBC</p></li><li class="listitem"><p>RC5-CBCPad</p></li><li class="listitem"><p>DES-EDE3-CBC (the default for key encryption)</p></li><li class="listitem"><p>AES-128-CBC</p></li><li class="listitem"><p>AES-192-CBC</p></li><li class="listitem"><p>AES-256-CBC</p></li><li class="listitem"><p>CAMELLIA-128-CBC</p></li><li class="listitem"><p>CAMELLIA-192-CBC</p></li><li class="listitem"><p>CAMELLIA-256-CBC</p></li></ul></div></dd><dt><span class="term">PKCS#12 PBE ciphers</span></dt><dd><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>PKCS #12 PBE with Sha1 and 128 Bit RC4</p></li><li class="listitem"><p>PKCS #12 PBE with Sha1 and 40 Bit RC4</p></li><li class="listitem"><p>PKCS #12 PBE with Sha1 and Triple DES CBC</p></li><li class="listitem"><p>PKCS #12 PBE with Sha1 and 128 Bit RC2 CBC</p></li><li class="listitem"><p>PKCS #12 PBE with Sha1 and 40 Bit RC2 CBC</p></li><li class="listitem"><p>PKCS12 V2 PBE with SHA1 and 128 Bit RC4</p></li><li class="listitem"><p>PKCS12 V2 PBE with SHA1 and 40 Bit RC4 (the default for non-FIPS mode)</p></li><li class="listitem"><p>PKCS12 V2 PBE with SHA1 and 3KEY Triple DES-cbc</p></li><li class="listitem"><p>PKCS12 V2 PBE with SHA1 and 2KEY Triple DES-cbc</p></li><li class="listitem"><p>PKCS12 V2 PBE with SHA1 and 128 Bit RC2 CBC</p></li><li class="listitem"><p>PKCS12 V2 PBE with SHA1 and 40 Bit RC2 CBC</p></li></ul></div></dd><dt><span class="term">PKCS#5 PBE ciphers</span></dt><dd><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>PKCS #5 Password Based Encryption with MD2 and DES CBC</p></li><li class="listitem"><p>PKCS #5 Password Based Encryption with MD5 and DES CBC</p></li><li class="listitem"><p>PKCS #5 Password Based Encryption with SHA1 and DES CBC</p></li></ul></div></dd></dl></div><p>With PKCS#12, the crypto provider may be the soft token module or an external hardware module. If the cryptographic module does not support the requested algorithm, then the next best fit will be selected (usually the default). If no suitable replacement for the desired algorithm can be found, the tool returns the error <span class="emphasis"><em>no security module can perform the requested operation</em></span>.</p></div><div class="refsection"><a name="databases"></a><h2>NSS Database Types</h2><p>NSS originally used BerkeleyDB databases to store security information.
The last versions of these <span class="emphasis"><em>legacy</em></span> databases are:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
cert8.db for certificates
</p></li><li class="listitem"><p>
@@ -68,7 +68,7 @@ BerkleyDB. These new databases provide more accessibility and performance:</p><d
Using the SQLite databases must be manually specified by using the <span class="command"><strong>sql:</strong></span> prefix with the given security directory. For example:</p><pre class="programlisting"># pk12util -i /tmp/cert-files/users.p12 -d sql:/home/my/sharednssdb</pre><p>To set the shared database type as the default type for the tools, set the <code class="envar">NSS_DEFAULT_DB_TYPE</code> environment variable to <code class="envar">sql</code>:</p><pre class="programlisting">export NSS_DEFAULT_DB_TYPE="sql"</pre><p>This line can be set added to the <code class="filename">~/.bashrc</code> file to make the change permanent.</p><p>Most applications do not use the shared database by default, but they can be configured to use them. For example, this how-to article covers how to configure Firefox and Thunderbird to use the new shared NSS databases:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
https://wiki.mozilla.org/NSS_Shared_DB_Howto</p></li></ul></div><p>For an engineering draft on the changes in the shared NSS databases, see the NSS project wiki:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
https://wiki.mozilla.org/NSS_Shared_DB
- </p></li></ul></div></div><div class="refsection"><a name="compatibility"></a><h2>Compatibility Notes</h2><p>The exporting behavior of <span class="command"><strong>pk12util</strong></span> has changed over time, while importing files exported with older versions of NSS is still supported.</p><p>Until the 3.30 release, <span class="command"><strong>pk12util</strong></span> used the UTF-16 encoding for the PKCS #5 password-based encryption schemes, while the recommendation is to encode passwords in UTF-8 if the used encryption scheme is defined outside of the PKCS #12 standard.</p><p>Until the 3.31 release, even when <strong class="userinput"><code>"AES-128-CBC"</code></strong> or <strong class="userinput"><code>"AES-192-CBC"</code></strong> is given from the command line, <span class="command"><strong>pk12util</strong></span> always used 256-bit AES as the underlying encryption scheme.</p><p>For historical reasons, <span class="command"><strong>pk12util</strong></span> accepts password-based encryption schemes not listed in this document. However, those schemes are not officially supported and may have issues in interoperability with other tools.</p></div><div class="refsection"><a name="seealso"></a><h2>See Also</h2><p>certutil (1)</p><p>modutil (1)</p><p>The NSS wiki has information on the new database design and how to configure applications to use it.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
+ </p></li></ul></div></div><div class="refsection"><a name="seealso"></a><h2>See Also</h2><p>certutil (1)</p><p>modutil (1)</p><p>The NSS wiki has information on the new database design and how to configure applications to use it.</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>
https://wiki.mozilla.org/NSS_Shared_DB_Howto</p></li><li class="listitem"><p>
https://wiki.mozilla.org/NSS_Shared_DB
</p></li></ul></div></div><div class="refsection"><a name="resources"></a><h2>Additional Resources</h2><p>For information about NSS and other tools related to NSS (like JSS), check out the NSS project wiki at <a class="ulink" href="http://www.mozilla.org/projects/security/pki/nss/" target="_top">http://www.mozilla.org/projects/security/pki/nss/</a>. The NSS site relates directly to NSS code changes and releases.</p><p>Mailing lists: https://lists.mozilla.org/listinfo/dev-tech-crypto</p><p>IRC: Freenode at #dogtag-pki</p></div><div class="refsection"><a name="authors"></a><h2>Authors</h2><p>The NSS tools were written and maintained by developers with Netscape, Red Hat, Sun, Oracle, Mozilla, and Google.</p><p>
diff --git a/security/nss/doc/nroff/certutil.1 b/security/nss/doc/nroff/certutil.1
index 80a02fc276..b2a8bd2bb8 100644
--- a/security/nss/doc/nroff/certutil.1
+++ b/security/nss/doc/nroff/certutil.1
@@ -1,13 +1,13 @@
'\" t
.\" Title: CERTUTIL
.\" Author: [see the "Authors" section]
-.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
-.\" Date: 27 October 2017
+.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
+.\" Date: 8 September 2016
.\" Manual: NSS Security Tools
.\" Source: nss-tools
.\" Language: English
.\"
-.TH "CERTUTIL" "1" "27 October 2017" "nss-tools" "NSS Security Tools"
+.TH "CERTUTIL" "1" "8 September 2016" "nss-tools" "NSS Security Tools"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -371,9 +371,9 @@ Read an alternate PQG value from the specified file when generating DSA key pair
\fBcertutil\fR
generates its own PQG value\&. PQG files are created with a separate DSA utility\&.
.sp
-Elliptic curve name is one of the ones from nistp256, nistp384, nistp521, curve25519\&.
+Elliptic curve name is one of the ones from nistp256, nistp384, nistp521, curve25519.
.sp
-If a token is available that supports more curves, the foolowing curves are supported as well: sect163k1, nistk163, sect163r1, sect163r2, nistb163, sect193r1, sect193r2, sect233k1, nistk233, sect233r1, nistb233, sect239k1, sect283k1, nistk283, sect283r1, nistb283, sect409k1, nistk409, sect409r1, nistb409, sect571k1, nistk571, sect571r1, nistb571, secp160k1, secp160r1, secp160r2, secp192k1, secp192r1, nistp192, secp224k1, secp224r1, nistp224, secp256k1, secp256r1, secp384r1, secp521r1, prime192v1, prime192v2, prime192v3, prime239v1, prime239v2, prime239v3, c2pnb163v1, c2pnb163v2, c2pnb163v3, c2pnb176v1, c2tnb191v1, c2tnb191v2, c2tnb191v3, c2pnb208w1, c2tnb239v1, c2tnb239v2, c2tnb239v3, c2pnb272w1, c2pnb304w1, c2tnb359w1, c2pnb368w1, c2tnb431r1, secp112r1, secp112r2, secp128r1, secp128r2, sect113r1, sect113r2, sect131r1, sect131r2
+If a token is available that supports more curves, the foolowing curves are supported as well: sect163k1, nistk163, sect163r1, sect163r2, nistb163, sect193r1, sect193r2, sect233k1, nistk233, sect233r1, nistb233, sect239k1, sect283k1, nistk283, sect283r1, nistb283, sect409k1, nistk409, sect409r1, nistb409, sect571k1, nistk571, sect571r1, nistb571, secp160k1, secp160r1, secp160r2, secp192k1, secp192r1, nistp192, secp224k1, secp224r1, nistp224, secp256k1, secp256r1, secp384r1, secp521r1, prime192v1, prime192v2, prime192v3, prime239v1, prime239v2, prime239v3, c2pnb163v1, c2pnb163v2, c2pnb163v3, c2pnb176v1, c2tnb191v1, c2tnb191v2, c2tnb191v3, c2pnb208w1, c2tnb239v1, c2tnb239v2, c2tnb239v3, c2pnb272w1, c2pnb304w1, c2tnb359w1, c2pnb368w1, c2tnb431r1, secp112r1, secp112r2, secp128r1, secp128r2, sect113r1, sect113r2, sect131r1, sect131r2
.RE
.PP
\-r
@@ -609,24 +609,6 @@ to generate the signature for a certificate being created or added to a database
Set an alternate exponent value to use in generating a new RSA public key for the database, instead of the default value of 65537\&. The available alternate values are 3 and 17\&.
.RE
.PP
-\-\-pss
-.RS 4
-Restrict the generated certificate (with the
-\fB\-S\fR
-option) or certificate request (with the
-\fB\-R\fR
-option) to be used with the RSA\-PSS signature scheme\&. This only works when the private key of the certificate or certificate request is RSA\&.
-.RE
-.PP
-\-\-pss\-sign
-.RS 4
-Sign the generated certificate with the RSA\-PSS signature scheme (with the
-\fB\-C\fR
-or
-\fB\-S\fR
-option)\&. This only works when the private key of the signer\*(Aqs certificate is RSA\&. If the signer\*(Aqs certificate is restricted to RSA\-PSS, it is not necessary to specify this option\&.
-.RE
-.PP
\-z noise\-file
.RS 4
Read a seed value from the specified file to generate a new private and public key pair\&. This argument makes it possible to use hardware\-generated seed values or manually create a value from the keyboard\&. The minimum file size is 20 bytes\&.
@@ -1530,8 +1512,7 @@ There are ways to narrow the keys listed in the search results:
.IP \(bu 2.3
.\}
To return a specific key, use the
-\fB\-n\fR
-\fIname\fR
+\fB\-n\fR\fIname\fR
argument with the name of the key\&.
.RE
.sp
@@ -1544,8 +1525,7 @@ argument with the name of the key\&.
.IP \(bu 2.3
.\}
If there are multiple security devices loaded, then the
-\fB\-h\fR
-\fItokenname\fR
+\fB\-h\fR\fItokenname\fR
argument can search a specific token or all tokens\&.
.RE
.sp
@@ -1558,8 +1538,7 @@ argument can search a specific token or all tokens\&.
.IP \(bu 2.3
.\}
If there are multiple key types available, then the
-\fB\-k\fR
-\fIkey\-type\fR
+\fB\-k\fR\fIkey\-type\fR
argument can search a specific type of key, like RSA, DSA, or ECC\&.
.RE
.PP
diff --git a/security/nss/doc/nroff/pk12util.1 b/security/nss/doc/nroff/pk12util.1
index e0a8da833e..c4fa972c0a 100644
--- a/security/nss/doc/nroff/pk12util.1
+++ b/security/nss/doc/nroff/pk12util.1
@@ -1,13 +1,13 @@
'\" t
.\" Title: PK12UTIL
.\" Author: [see the "Authors" section]
-.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
-.\" Date: 27 October 2017
+.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
+.\" Date: 5 June 2014
.\" Manual: NSS Security Tools
.\" Source: nss-tools
.\" Language: English
.\"
-.TH "PK12UTIL" "1" "27 October 2017" "nss-tools" "NSS Security Tools"
+.TH "PK12UTIL" "1" "5 June 2014" "nss-tools" "NSS Security Tools"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
@@ -39,24 +39,24 @@ This documentation is still work in progress\&. Please contribute to the initial
.SH "DESCRIPTION"
.PP
The PKCS #12 utility,
-\fBpk12util\fR, enables sharing certificates among any server that supports PKCS #12\&. The tool can import certificates and keys from PKCS #12 files into security databases, export certificates, and list certificates and keys\&.
+\fBpk12util\fR, enables sharing certificates among any server that supports PKCS#12\&. The tool can import certificates and keys from PKCS#12 files into security databases, export certificates, and list certificates and keys\&.
.SH "OPTIONS AND ARGUMENTS"
.PP
\fBOptions\fR
.PP
\-i p12file
.RS 4
-Import keys and certificates from a PKCS #12 file into a security database\&.
+Import keys and certificates from a PKCS#12 file into a security database\&.
.RE
.PP
\-l p12file
.RS 4
-List the keys and certificates in PKCS #12 file\&.
+List the keys and certificates in PKCS#12 file\&.
.RE
.PP
\-o p12file
.RS 4
-Export keys and certificates from the security database to a PKCS #12 file\&.
+Export keys and certificates from the security database to a PKCS#12 file\&.
.RE
.PP
\fBArguments\fR
@@ -68,7 +68,7 @@ Specify the key encryption algorithm\&.
.PP
\-C certCipher
.RS 4
-Specify the certiticate encryption algorithm\&.
+Specify the key cert (overall package) encryption algorithm\&.
.RE
.PP
\-d [sql:]directory
@@ -432,7 +432,7 @@ Specify the pkcs #12 file password\&.
.PP
The most basic usage of
\fBpk12util\fR
-for importing a certificate or key is the PKCS #12 input file (\fB\-i\fR) and some way to specify the security database being accessed (either
+for importing a certificate or key is the PKCS#12 input file (\fB\-i\fR) and some way to specify the security database being accessed (either
\fB\-d\fR
for a directory or
\fB\-h\fR
@@ -467,7 +467,7 @@ pk12util: PKCS12 IMPORT SUCCESSFUL
.PP
Using the
\fBpk12util\fR
-command to export certificates and keys requires both the name of the certificate to extract from the database (\fB\-n\fR) and the PKCS #12\-formatted output file to write to\&. There are optional parameters that can be used to encrypt the file to protect the certificate material\&.
+command to export certificates and keys requires both the name of the certificate to extract from the database (\fB\-n\fR) and the PKCS#12\-formatted output file to write to\&. There are optional parameters that can be used to encrypt the file to protect the certificate material\&.
.PP
pk12util \-o p12File \-n certname [\-c keyCipher] [\-C certCipher] [\-m|\-\-key_len keyLen] [\-n|\-\-cert_key_len certKeyLen] [\-d [sql:]directory] [\-P dbprefix] [\-k slotPasswordFile|\-K slotPassword] [\-w p12filePasswordFile|\-W p12filePassword]
.PP
@@ -559,17 +559,17 @@ Certificate Friendly Name: Thawte Freemail Member\*(Aqs Thawte Consulting (Pt
.\}
.SH "PASSWORD ENCRYPTION"
.PP
-PKCS #12 provides for not only the protection of the private keys but also the certificate and meta\-data associated with the keys\&. Password\-based encryption is used to protect private keys on export to a PKCS #12 file and, optionally, the associated certificates\&. If no algorithm is specified, the tool defaults to using PKCS #12 SHA\-1 and 3\-key triple DES for private key encryption\&. When not in FIPS mode, PKCS #12 SHA\-1 and 40\-bit RC4 is used for certificate encryption\&. When in FIPS mode, there is no certificate encryption\&. If certificate encryption is not wanted, specify
-\fB"NONE"\fR
-as the argument of the
-\fB\-C\fR
-option\&.
+PKCS#12 provides for not only the protection of the private keys but also the certificate and meta\-data associated with the keys\&. Password\-based encryption is used to protect private keys on export to a PKCS#12 file and, optionally, the entire package\&. If no algorithm is specified, the tool defaults to using
+\fBPKCS12 V2 PBE with SHA1 and 3KEY Triple DES\-cbc\fR
+for private key encryption\&.
+\fBPKCS12 V2 PBE with SHA1 and 40 Bit RC4\fR
+is the default for the overall package encryption when not in FIPS mode\&. When in FIPS mode, there is no package encryption\&.
.PP
The private key is always protected with strong encryption by default\&.
.PP
Several types of ciphers are supported\&.
.PP
-PKCS #5 password\-based encryption
+Symmetric CBC ciphers for PKCS#5 V2
.RS 4
.sp
.RS 4
@@ -580,13 +580,110 @@ PKCS #5 password\-based encryption
.sp -1
.IP \(bu 2.3
.\}
-PBES2 with AES\-CBC\-Pad as underlying encryption scheme (\fB"AES\-128\-CBC"\fR,
-\fB"AES\-192\-CBC"\fR, and
-\fB"AES\-256\-CBC"\fR)
+DES\-CBC
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+RC2\-CBC
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+RC5\-CBCPad
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+DES\-EDE3\-CBC (the default for key encryption)
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+AES\-128\-CBC
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+AES\-192\-CBC
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+AES\-256\-CBC
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+CAMELLIA\-128\-CBC
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+CAMELLIA\-192\-CBC
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+CAMELLIA\-256\-CBC
.RE
.RE
.PP
-PKCS #12 password\-based encryption
+PKCS#12 PBE ciphers
.RS 4
.sp
.RS 4
@@ -597,9 +694,7 @@ PKCS #12 password\-based encryption
.sp -1
.IP \(bu 2.3
.\}
-SHA\-1 and 128\-bit RC4 (\fB"PKCS #12 V2 PBE With SHA\-1 And 128 Bit RC4"\fR
-or
-\fB"RC4"\fR)
+PKCS #12 PBE with Sha1 and 128 Bit RC4
.RE
.sp
.RS 4
@@ -610,7 +705,7 @@ or
.sp -1
.IP \(bu 2.3
.\}
-SHA\-1 and 40\-bit RC4 (\fB"PKCS #12 V2 PBE With SHA\-1 And 40 Bit RC4"\fR) (used by default for certificate encryption in non\-FIPS mode)
+PKCS #12 PBE with Sha1 and 40 Bit RC4
.RE
.sp
.RS 4
@@ -621,9 +716,7 @@ SHA\-1 and 40\-bit RC4 (\fB"PKCS #12 V2 PBE With SHA\-1 And 40 Bit RC4"\fR) (use
.sp -1
.IP \(bu 2.3
.\}
-SHA\-1 and 3\-key triple\-DES (\fB"PKCS #12 V2 PBE With SHA\-1 And 3KEY Triple DES\-CBC"\fR
-or
-\fB"DES\-EDE3\-CBC"\fR)
+PKCS #12 PBE with Sha1 and Triple DES CBC
.RE
.sp
.RS 4
@@ -634,9 +727,7 @@ or
.sp -1
.IP \(bu 2.3
.\}
-SHA\-1 and 128\-bit RC2 (\fB"PKCS #12 V2 PBE With SHA\-1 And 128 Bit RC2 CBC"\fR
-or
-\fB"RC2\-CBC"\fR)
+PKCS #12 PBE with Sha1 and 128 Bit RC2 CBC
.RE
.sp
.RS 4
@@ -647,11 +738,114 @@ or
.sp -1
.IP \(bu 2.3
.\}
-SHA\-1 and 40\-bit RC2 (\fB"PKCS #12 V2 PBE With SHA\-1 And 40 Bit RC2 CBC"\fR)
+PKCS #12 PBE with Sha1 and 40 Bit RC2 CBC
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+PKCS12 V2 PBE with SHA1 and 128 Bit RC4
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+PKCS12 V2 PBE with SHA1 and 40 Bit RC4 (the default for non\-FIPS mode)
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+PKCS12 V2 PBE with SHA1 and 3KEY Triple DES\-cbc
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+PKCS12 V2 PBE with SHA1 and 2KEY Triple DES\-cbc
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+PKCS12 V2 PBE with SHA1 and 128 Bit RC2 CBC
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+PKCS12 V2 PBE with SHA1 and 40 Bit RC2 CBC
.RE
.RE
.PP
-With PKCS #12, the crypto provider may be the soft token module or an external hardware module\&. If the cryptographic module does not support the requested algorithm, then the next best fit will be selected (usually the default)\&. If no suitable replacement for the desired algorithm can be found, the tool returns the error
+PKCS#5 PBE ciphers
+.RS 4
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+PKCS #5 Password Based Encryption with MD2 and DES CBC
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+PKCS #5 Password Based Encryption with MD5 and DES CBC
+.RE
+.sp
+.RS 4
+.ie n \{\
+\h'-04'\(bu\h'+03'\c
+.\}
+.el \{\
+.sp -1
+.IP \(bu 2.3
+.\}
+PKCS #5 Password Based Encryption with SHA1 and DES CBC
+.RE
+.RE
+.PP
+With PKCS#12, the crypto provider may be the soft token module or an external hardware module\&. If the cryptographic module does not support the requested algorithm, then the next best fit will be selected (usually the default)\&. If no suitable replacement for the desired algorithm can be found, the tool returns the error
\fIno security module can perform the requested operation\fR\&.
.SH "NSS DATABASE TYPES"
.PP
@@ -793,27 +987,6 @@ For an engineering draft on the changes in the shared NSS databases, see the NSS
.\}
https://wiki\&.mozilla\&.org/NSS_Shared_DB
.RE
-.SH "COMPATIBILITY NOTES"
-.PP
-The exporting behavior of
-\fBpk12util\fR
-has changed over time, while importing files exported with older versions of NSS is still supported\&.
-.PP
-Until the 3\&.30 release,
-\fBpk12util\fR
-used the UTF\-16 encoding for the PKCS #5 password\-based encryption schemes, while the recommendation is to encode passwords in UTF\-8 if the used encryption scheme is defined outside of the PKCS #12 standard\&.
-.PP
-Until the 3\&.31 release, even when
-\fB"AES\-128\-CBC"\fR
-or
-\fB"AES\-192\-CBC"\fR
-is given from the command line,
-\fBpk12util\fR
-always used 256\-bit AES as the underlying encryption scheme\&.
-.PP
-For historical reasons,
-\fBpk12util\fR
-accepts password\-based encryption schemes not listed in this document\&. However, those schemes are not officially supported and may have issues in interoperability with other tools\&.
.SH "SEE ALSO"
.PP
certutil (1)
diff --git a/security/nss/doc/pk12util.xml b/security/nss/doc/pk12util.xml
index c267949653..03ee356e65 100644
--- a/security/nss/doc/pk12util.xml
+++ b/security/nss/doc/pk12util.xml
@@ -46,7 +46,7 @@
<refsection id="description">
<title>Description</title>
- <para>The PKCS #12 utility, <command>pk12util</command>, enables sharing certificates among any server that supports PKCS #12. The tool can import certificates and keys from PKCS #12 files into security databases, export certificates, and list certificates and keys.</para>
+ <para>The PKCS #12 utility, <command>pk12util</command>, enables sharing certificates among any server that supports PKCS#12. The tool can import certificates and keys from PKCS#12 files into security databases, export certificates, and list certificates and keys.</para>
</refsection>
<refsection id="options">
@@ -55,17 +55,17 @@
<variablelist>
<varlistentry>
<term>-i p12file</term>
- <listitem><para>Import keys and certificates from a PKCS #12 file into a security database.</para></listitem>
+ <listitem><para>Import keys and certificates from a PKCS#12 file into a security database.</para></listitem>
</varlistentry>
<varlistentry>
<term>-l p12file</term>
- <listitem><para>List the keys and certificates in PKCS #12 file.</para></listitem>
+ <listitem><para>List the keys and certificates in PKCS#12 file.</para></listitem>
</varlistentry>
<varlistentry>
<term>-o p12file</term>
- <listitem><para>Export keys and certificates from the security database to a PKCS #12 file.</para></listitem>
+ <listitem><para>Export keys and certificates from the security database to a PKCS#12 file.</para></listitem>
</varlistentry>
</variablelist>
@@ -78,7 +78,7 @@
<varlistentry>
<term>-C certCipher</term>
- <listitem><para>Specify the certiticate encryption algorithm.</para></listitem>
+ <listitem><para>Specify the key cert (overall package) encryption algorithm.</para></listitem>
</varlistentry>
<varlistentry>
@@ -233,7 +233,7 @@
<refsection id="examples">
<title>Examples</title>
<para><command>Importing Keys and Certificates</command></para>
- <para>The most basic usage of <command>pk12util</command> for importing a certificate or key is the PKCS #12 input file (<option>-i</option>) and some way to specify the security database being accessed (either <option>-d</option> for a directory or <option>-h</option> for a token).
+ <para>The most basic usage of <command>pk12util</command> for importing a certificate or key is the PKCS#12 input file (<option>-i</option>) and some way to specify the security database being accessed (either <option>-d</option> for a directory or <option>-h</option> for a token).
</para>
<para>
pk12util -i p12File [-h tokenname] [-v] [-d [sql:]directory] [-P dbprefix] [-k slotPasswordFile|-K slotPassword] [-w p12filePasswordFile|-W p12filePassword]
@@ -252,7 +252,7 @@ Enter password for PKCS12 file:
pk12util: PKCS12 IMPORT SUCCESSFUL</programlisting>
<para><command>Exporting Keys and Certificates</command></para>
- <para>Using the <command>pk12util</command> command to export certificates and keys requires both the name of the certificate to extract from the database (<option>-n</option>) and the PKCS #12-formatted output file to write to. There are optional parameters that can be used to encrypt the file to protect the certificate material.
+ <para>Using the <command>pk12util</command> command to export certificates and keys requires both the name of the certificate to extract from the database (<option>-n</option>) and the PKCS#12-formatted output file to write to. There are optional parameters that can be used to encrypt the file to protect the certificate material.
</para>
<para>pk12util -o p12File -n certname [-c keyCipher] [-C certCipher] [-m|--key_len keyLen] [-n|--cert_key_len certKeyLen] [-d [sql:]directory] [-P dbprefix] [-k slotPasswordFile|-K slotPassword] [-w p12filePasswordFile|-W p12filePassword]</para>
<para>For example:</para>
@@ -304,34 +304,58 @@ Certificate Friendly Name: Thawte Freemail Member's Thawte Consulting (Pty) L
<refsection id="encryption">
<title>Password Encryption</title>
- <para>PKCS #12 provides for not only the protection of the private keys but also the certificate and meta-data associated with the keys. Password-based encryption is used to protect private keys on export to a PKCS #12 file and, optionally, the associated certificates. If no algorithm is specified, the tool defaults to using PKCS #12 SHA-1 and 3-key triple DES for private key encryption. When not in FIPS mode, PKCS #12 SHA-1 and 40-bit RC4 is used for certificate encryption. When in FIPS mode, there is no certificate encryption. If certificate encryption is not wanted, specify <userinput>"NONE"</userinput> as the argument of the <option>-C</option> option.</para>
+ <para>PKCS#12 provides for not only the protection of the private keys but also the certificate and meta-data associated with the keys. Password-based encryption is used to protect private keys on export to a PKCS#12 file and, optionally, the entire package. If no algorithm is specified, the tool defaults to using <command>PKCS12 V2 PBE with SHA1 and 3KEY Triple DES-cbc</command> for private key encryption. <command>PKCS12 V2 PBE with SHA1 and 40 Bit RC4</command> is the default for the overall package encryption when not in FIPS mode. When in FIPS mode, there is no package encryption.</para>
<para>The private key is always protected with strong encryption by default.</para>
<para>Several types of ciphers are supported.</para>
<variablelist>
<varlistentry>
- <term>PKCS #5 password-based encryption</term>
+ <term>Symmetric CBC ciphers for PKCS#5 V2</term>
<listitem>
- <itemizedlist>
- <listitem><para>PBES2 with AES-CBC-Pad as underlying encryption scheme (<userinput>"AES-128-CBC"</userinput>, <userinput>"AES-192-CBC"</userinput>, and <userinput>"AES-256-CBC"</userinput>)</para></listitem>
- </itemizedlist>
+ <itemizedlist>
+ <listitem><para>DES-CBC</para></listitem>
+ <listitem><para>RC2-CBC</para></listitem>
+ <listitem><para>RC5-CBCPad</para></listitem>
+ <listitem><para>DES-EDE3-CBC (the default for key encryption)</para></listitem>
+ <listitem><para>AES-128-CBC</para></listitem>
+ <listitem><para>AES-192-CBC</para></listitem>
+ <listitem><para>AES-256-CBC</para></listitem>
+ <listitem><para>CAMELLIA-128-CBC</para></listitem>
+ <listitem><para>CAMELLIA-192-CBC</para></listitem>
+ <listitem><para>CAMELLIA-256-CBC</para></listitem>
+ </itemizedlist>
</listitem>
</varlistentry>
<varlistentry>
- <term>PKCS #12 password-based encryption</term>
+ <term>PKCS#12 PBE ciphers</term>
<listitem>
- <itemizedlist>
- <listitem><para>SHA-1 and 128-bit RC4 (<userinput>"PKCS #12 V2 PBE With SHA-1 And 128 Bit RC4"</userinput> or <userinput>"RC4"</userinput>)</para></listitem>
- <listitem><para>SHA-1 and 40-bit RC4 (<userinput>"PKCS #12 V2 PBE With SHA-1 And 40 Bit RC4"</userinput>) (used by default for certificate encryption in non-FIPS mode)</para></listitem>
- <listitem><para>SHA-1 and 3-key triple-DES (<userinput>"PKCS #12 V2 PBE With SHA-1 And 3KEY Triple DES-CBC"</userinput> or <userinput>"DES-EDE3-CBC"</userinput>)</para></listitem>
- <listitem><para>SHA-1 and 128-bit RC2 (<userinput>"PKCS #12 V2 PBE With SHA-1 And 128 Bit RC2 CBC"</userinput> or <userinput>"RC2-CBC"</userinput>)</para></listitem>
- <listitem><para>SHA-1 and 40-bit RC2 (<userinput>"PKCS #12 V2 PBE With SHA-1 And 40 Bit RC2 CBC"</userinput>)</para></listitem>
- </itemizedlist>
+ <itemizedlist>
+ <listitem><para>PKCS #12 PBE with Sha1 and 128 Bit RC4</para></listitem>
+ <listitem><para>PKCS #12 PBE with Sha1 and 40 Bit RC4</para></listitem>
+ <listitem><para>PKCS #12 PBE with Sha1 and Triple DES CBC</para></listitem>
+ <listitem><para>PKCS #12 PBE with Sha1 and 128 Bit RC2 CBC</para></listitem>
+ <listitem><para>PKCS #12 PBE with Sha1 and 40 Bit RC2 CBC</para></listitem>
+ <listitem><para>PKCS12 V2 PBE with SHA1 and 128 Bit RC4</para></listitem>
+ <listitem><para>PKCS12 V2 PBE with SHA1 and 40 Bit RC4 (the default for non-FIPS mode)</para></listitem>
+ <listitem><para>PKCS12 V2 PBE with SHA1 and 3KEY Triple DES-cbc</para></listitem>
+ <listitem><para>PKCS12 V2 PBE with SHA1 and 2KEY Triple DES-cbc</para></listitem>
+ <listitem><para>PKCS12 V2 PBE with SHA1 and 128 Bit RC2 CBC</para></listitem>
+ <listitem><para>PKCS12 V2 PBE with SHA1 and 40 Bit RC2 CBC</para></listitem>
+ </itemizedlist>
+ </listitem>
+ </varlistentry>
+ <varlistentry><term>PKCS#5 PBE ciphers</term>
+ <listitem>
+ <itemizedlist>
+ <listitem><para>PKCS #5 Password Based Encryption with MD2 and DES CBC</para></listitem>
+ <listitem><para>PKCS #5 Password Based Encryption with MD5 and DES CBC</para></listitem>
+ <listitem><para>PKCS #5 Password Based Encryption with SHA1 and DES CBC</para></listitem>
+ </itemizedlist>
</listitem>
</varlistentry>
</variablelist>
- <para>With PKCS #12, the crypto provider may be the soft token module or an external hardware module. If the cryptographic module does not support the requested algorithm, then the next best fit will be selected (usually the default). If no suitable replacement for the desired algorithm can be found, the tool returns the error <emphasis>no security module can perform the requested operation</emphasis>.</para>
+ <para>With PKCS#12, the crypto provider may be the soft token module or an external hardware module. If the cryptographic module does not support the requested algorithm, then the next best fit will be selected (usually the default). If no suitable replacement for the desired algorithm can be found, the tool returns the error <emphasis>no security module can perform the requested operation</emphasis>.</para>
</refsection>
<refsection id="databases"><title>NSS Database Types</title>
@@ -408,14 +432,6 @@ Using the SQLite databases must be manually specified by using the <command>sql:
</itemizedlist>
</refsection>
- <refsection id="compatibility">
- <title>Compatibility Notes</title>
- <para>The exporting behavior of <command>pk12util</command> has changed over time, while importing files exported with older versions of NSS is still supported.</para>
- <para>Until the 3.30 release, <command>pk12util</command> used the UTF-16 encoding for the PKCS #5 password-based encryption schemes, while the recommendation is to encode passwords in UTF-8 if the used encryption scheme is defined outside of the PKCS #12 standard.</para>
- <para>Until the 3.31 release, even when <userinput>"AES-128-CBC"</userinput> or <userinput>"AES-192-CBC"</userinput> is given from the command line, <command>pk12util</command> always used 256-bit AES as the underlying encryption scheme.</para>
- <para>For historical reasons, <command>pk12util</command> accepts password-based encryption schemes not listed in this document. However, those schemes are not officially supported and may have issues in interoperability with other tools.</para>
- </refsection>
-
<refsection id="seealso">
<title>See Also</title>
<para>certutil (1)</para>
diff --git a/security/nss/fuzz/config/clone_libfuzzer.sh b/security/nss/fuzz/config/clone_libfuzzer.sh
index c516057d78..f1dc2e14bb 100644
--- a/security/nss/fuzz/config/clone_libfuzzer.sh
+++ b/security/nss/fuzz/config/clone_libfuzzer.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-LIBFUZZER_REVISION=6937e68f927b6aefe526fcb9db8953f497e6e74d
+LIBFUZZER_REVISION=56bd1d43451cca4b6a11d3be316bb77ab159b09d
d=$(dirname $0)
$d/git-copy.sh https://chromium.googlesource.com/chromium/llvm-project/llvm/lib/Fuzzer $LIBFUZZER_REVISION $d/../libFuzzer
diff --git a/security/nss/fuzz/config/git-copy.sh b/security/nss/fuzz/config/git-copy.sh
index a9e817e2a6..a5c7d371da 100644
--- a/security/nss/fuzz/config/git-copy.sh
+++ b/security/nss/fuzz/config/git-copy.sh
@@ -7,18 +7,18 @@ if [ $# -lt 3 ]; then
exit 2
fi
-REPO="$1"
-COMMIT="$2"
-DIR="$3"
+REPO=$1
+COMMIT=$2
+DIR=$3
echo "Copy '$COMMIT' from '$REPO' to '$DIR'"
-if [ -f "$DIR"/.git-copy ]; then
- CURRENT=$(cat "$DIR"/.git-copy)
- if [ $(echo -n "$COMMIT" | wc -c) != "40" ]; then
+if [ -f $DIR/.git-copy ]; then
+ CURRENT=$(cat $DIR/.git-copy)
+ if [ $(echo -n $COMMIT | wc -c) != "40" ]; then
# On the off chance that $COMMIT is a remote head.
- ACTUAL=$(git ls-remote "$REPO" "$COMMIT" | cut -c 1-40 -)
+ ACTUAL=$(git ls-remote $REPO $COMMIT | cut -c 1-40 -)
else
- ACTUAL="$COMMIT"
+ ACTUAL=$COMMIT
fi
if [ "$CURRENT" = "$ACTUAL" ]; then
echo "Up to date."
@@ -26,9 +26,8 @@ if [ -f "$DIR"/.git-copy ]; then
fi
fi
-rm -rf "$DIR"
-git init -q "$DIR"
-git -C "$DIR" fetch -q --depth=1 "$REPO" "$COMMIT":git-copy-tmp
-git -C "$DIR" reset --hard git-copy-tmp
-git -C "$DIR" rev-parse --verify HEAD > "$DIR"/.git-copy
-rm -rf "$DIR"/.git
+git init -q $DIR
+git -C $DIR fetch -q --depth=1 $REPO $COMMIT:git-copy-tmp
+git -C $DIR reset --hard git-copy-tmp
+git -C $DIR rev-parse --verify HEAD > $DIR/.git-copy
+rm -rf $DIR/.git
diff --git a/security/nss/fuzz/mpi_expmod_target.cc b/security/nss/fuzz/mpi_expmod_target.cc
index b9be5854fb..ed31da354b 100644
--- a/security/nss/fuzz/mpi_expmod_target.cc
+++ b/security/nss/fuzz/mpi_expmod_target.cc
@@ -19,15 +19,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
auto modulus = get_modulus(data, size, ctx);
// Compare with OpenSSL exp mod
m1 = &std::get<1>(modulus);
- // The exponent b (B) can get really big. Make it smaller if necessary.
- if (MP_USED(&b) > 100) {
- size_t shift = (MP_USED(&b) - 100) * MP_DIGIT_BIT;
- mp_div_2d(&b, shift, &b, nullptr);
- BN_rshift(B, B, shift);
- }
- check_equal(A, &a, max_size);
- check_equal(B, &b, max_size);
- check_equal(std::get<0>(modulus), m1, 3 * max_size);
assert(mp_exptmod(&a, &b, m1, &c) == MP_OKAY);
(void)BN_mod_exp(C, A, B, std::get<0>(modulus), ctx);
check_equal(C, &c, 2 * max_size);
diff --git a/security/nss/fuzz/mpi_helper.cc b/security/nss/fuzz/mpi_helper.cc
index d092fdb119..65cf4b9cd0 100644
--- a/security/nss/fuzz/mpi_helper.cc
+++ b/security/nss/fuzz/mpi_helper.cc
@@ -12,12 +12,6 @@ char *to_char(const uint8_t *x) {
return reinterpret_cast<char *>(const_cast<unsigned char *>(x));
}
-void print_bn(std::string label, BIGNUM *x) {
- char *xc = BN_bn2hex(x);
- std::cout << label << ": " << std::hex << xc << std::endl;
- OPENSSL_free(xc);
-}
-
// Check that the two numbers are equal.
void check_equal(BIGNUM *b, mp_int *m, size_t max_size) {
char *bnBc = BN_bn2hex(b);
diff --git a/security/nss/fuzz/mpi_helper.h b/security/nss/fuzz/mpi_helper.h
index ef7041b257..17383744ba 100644
--- a/security/nss/fuzz/mpi_helper.h
+++ b/security/nss/fuzz/mpi_helper.h
@@ -23,7 +23,6 @@ void parse_input(const uint8_t *data, size_t size, BIGNUM *A, BIGNUM *B,
void parse_input(const uint8_t *data, size_t size, BIGNUM *A, mp_int *a);
std::tuple<BIGNUM *, mp_int> get_modulus(const uint8_t *data, size_t size,
BN_CTX *ctx);
-void print_bn(std::string label, BIGNUM *x);
// Initialise MPI and BN variables
// XXX: Also silence unused variable warnings for R.
diff --git a/security/nss/fuzz/tls_mutators.cc b/security/nss/fuzz/tls_mutators.cc
index 228bd0bb7a..e9770cb39f 100644
--- a/security/nss/fuzz/tls_mutators.cc
+++ b/security/nss/fuzz/tls_mutators.cc
@@ -2,14 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#include <algorithm>
#include "shared.h"
#include "tls_parser.h"
#include "ssl.h"
-extern "C" {
#include "sslimpl.h"
-}
using namespace nss_test;
@@ -42,9 +39,7 @@ class Record {
void truncate(size_t length) {
assert(length >= 5 + gExtraHeaderBytes);
uint8_t *dest = const_cast<uint8_t *>(data_);
- size_t l = length - (5 + gExtraHeaderBytes);
- dest[3] = (l >> 8) & 0xff;
- dest[4] = l & 0xff;
+ (void)ssl_EncodeUintX(length - 5 - gExtraHeaderBytes, 2, &dest[3]);
memmove(dest + length, data_ + size_, remaining_);
}
@@ -227,8 +222,8 @@ size_t FragmentRecord(uint8_t *data, size_t size, size_t max_size,
}
// Pick a record to fragment at random.
- std::uniform_int_distribution<size_t> rand_record(0, records.size() - 1);
- auto &rec = records.at(rand_record(rng));
+ std::uniform_int_distribution<size_t> dist(0, records.size() - 1);
+ auto &rec = records.at(dist(rng));
uint8_t *rdata = const_cast<uint8_t *>(rec->data());
size_t length = rec->size();
size_t content_length = length - 5;
@@ -238,21 +233,17 @@ size_t FragmentRecord(uint8_t *data, size_t size, size_t max_size,
}
// Assign a new length to the first fragment.
- std::uniform_int_distribution<size_t> rand_size(1, content_length - 1);
- size_t first_length = rand_size(rng);
- size_t second_length = content_length - first_length;
- rdata[3] = (first_length >> 8) & 0xff;
- rdata[4] = first_length & 0xff;
- uint8_t *second_record = rdata + 5 + first_length;
+ size_t new_length = content_length / 2;
+ uint8_t *content = ssl_EncodeUintX(new_length, 2, &rdata[3]);
- // Make room for the header of the second record.
- memmove(second_record + 5, second_record,
- rec->remaining() + content_length - first_length);
+ // Make room for one more header.
+ memmove(content + new_length + 5, content + new_length,
+ rec->remaining() + content_length - new_length);
// Write second header.
- memcpy(second_record, rdata, 3);
- second_record[3] = (second_length >> 8) & 0xff;
- second_record[4] = second_length & 0xff;
+ memcpy(content + new_length, rdata, 3);
+ (void)ssl_EncodeUintX(content_length - new_length, 2,
+ &content[new_length + 3]);
return size + 5;
}
diff --git a/security/nss/fuzz/tls_socket.h b/security/nss/fuzz/tls_socket.h
index e30f6fa3ca..61fa4b3a88 100644
--- a/security/nss/fuzz/tls_socket.h
+++ b/security/nss/fuzz/tls_socket.h
@@ -10,7 +10,6 @@
class DummyPrSocket : public DummyIOLayerMethods {
public:
DummyPrSocket(const uint8_t *buf, size_t len) : buf_(buf), len_(len) {}
- virtual ~DummyPrSocket() {}
int32_t Read(PRFileDesc *f, void *data, int32_t len) override;
int32_t Write(PRFileDesc *f, const void *buf, int32_t length) override;
diff --git a/security/nss/gtests/certdb_gtest/alg1485_unittest.cc b/security/nss/gtests/certdb_gtest/alg1485_unittest.cc
index ef67330927..b7c6594149 100644
--- a/security/nss/gtests/certdb_gtest/alg1485_unittest.cc
+++ b/security/nss/gtests/certdb_gtest/alg1485_unittest.cc
@@ -10,7 +10,6 @@
#include "nss.h"
#include "scoped_ptrs.h"
-#include "prprf.h"
namespace nss_test {
@@ -90,23 +89,4 @@ INSTANTIATE_TEST_CASE_P(ParseAVAStrings, Alg1485ParseTest,
::testing::ValuesIn(kAVATestStrings));
INSTANTIATE_TEST_CASE_P(CompareAVAStrings, Alg1485CompareTest,
::testing::ValuesIn(kAVACompareStrings));
-
-TEST_F(Alg1485Test, ShortOIDTest) {
- // This is not a valid OID (too short). CERT_GetOidString should return 0.
- unsigned char data[] = {0x05};
- const SECItem oid = {siBuffer, data, sizeof(data)};
- char* result = CERT_GetOidString(&oid);
- EXPECT_EQ(result, nullptr);
-}
-
-TEST_F(Alg1485Test, BrokenOIDTest) {
- // This is not a valid OID (first bit of last byte is not set).
- // CERT_GetOidString should return 0.
- unsigned char data[] = {0x81, 0x82, 0x83, 0x84};
- const SECItem oid = {siBuffer, data, sizeof(data)};
- char* result = CERT_GetOidString(&oid);
- EXPECT_EQ(15U, strlen(result));
- EXPECT_EQ(0, strncmp("OID.UNSUPPORTED", result, 15));
- PR_smprintf_free(result);
-}
}
diff --git a/security/nss/gtests/common/util.h b/security/nss/gtests/common/util.h
index 7ed1fd7991..ccab5604e1 100644
--- a/security/nss/gtests/common/util.h
+++ b/security/nss/gtests/common/util.h
@@ -10,7 +10,7 @@
#include <cassert>
#include <vector>
-static inline std::vector<uint8_t> hex_string_to_bytes(std::string s) {
+std::vector<uint8_t> hex_string_to_bytes(std::string s) {
std::vector<uint8_t> bytes;
for (size_t i = 0; i < s.length(); i += 2) {
bytes.push_back(std::stoul(s.substr(i, 2), nullptr, 16));
diff --git a/security/nss/gtests/cryptohi_gtest/Makefile b/security/nss/gtests/cryptohi_gtest/Makefile
deleted file mode 100644
index 0d547e0803..0000000000
--- a/security/nss/gtests/cryptohi_gtest/Makefile
+++ /dev/null
@@ -1,43 +0,0 @@
-#! gmake
-#
-# 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/.
-
-#######################################################################
-# (1) Include initial platform-independent assignments (MANDATORY). #
-#######################################################################
-
-include manifest.mn
-
-#######################################################################
-# (2) Include "global" configuration information. (OPTIONAL) #
-#######################################################################
-
-include $(CORE_DEPTH)/coreconf/config.mk
-
-#######################################################################
-# (3) Include "component" configuration information. (OPTIONAL) #
-#######################################################################
-
-
-#######################################################################
-# (4) Include "local" platform-dependent assignments (OPTIONAL). #
-#######################################################################
-
-include ../common/gtest.mk
-
-#######################################################################
-# (5) Execute "global" rules. (OPTIONAL) #
-#######################################################################
-
-include $(CORE_DEPTH)/coreconf/rules.mk
-
-#######################################################################
-# (6) Execute "component" rules. (OPTIONAL) #
-#######################################################################
-
-
-#######################################################################
-# (7) Execute "local" rules. (OPTIONAL). #
-#######################################################################
diff --git a/security/nss/gtests/cryptohi_gtest/cryptohi_gtest.gyp b/security/nss/gtests/cryptohi_gtest/cryptohi_gtest.gyp
deleted file mode 100644
index 72c815ecac..0000000000
--- a/security/nss/gtests/cryptohi_gtest/cryptohi_gtest.gyp
+++ /dev/null
@@ -1,29 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-{
- 'includes': [
- '../../coreconf/config.gypi',
- '../common/gtest.gypi',
- ],
- 'targets': [
- {
- 'target_name': 'cryptohi_gtest',
- 'type': 'executable',
- 'sources': [
- 'cryptohi_unittest.cc',
- '<(DEPTH)/gtests/common/gtests.cc'
- ],
- 'dependencies': [
- '<(DEPTH)/exports.gyp:nss_exports',
- '<(DEPTH)/gtests/google_test/google_test.gyp:gtest',
- '<(DEPTH)/lib/util/util.gyp:nssutil3',
- '<(DEPTH)/lib/ssl/ssl.gyp:ssl3',
- '<(DEPTH)/lib/nss/nss.gyp:nss3',
- ]
- }
- ],
- 'variables': {
- 'module': 'nss'
- }
-}
diff --git a/security/nss/gtests/cryptohi_gtest/cryptohi_unittest.cc b/security/nss/gtests/cryptohi_gtest/cryptohi_unittest.cc
deleted file mode 100644
index ab553ee012..0000000000
--- a/security/nss/gtests/cryptohi_gtest/cryptohi_unittest.cc
+++ /dev/null
@@ -1,373 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include <string>
-
-#include "gtest/gtest.h"
-
-#include "scoped_ptrs.h"
-#include "cryptohi.h"
-#include "secitem.h"
-#include "secerr.h"
-
-namespace nss_test {
-
-class SignParamsTestF : public ::testing::Test {
- protected:
- ScopedPLArenaPool arena_;
- ScopedSECKEYPrivateKey privk_;
- ScopedSECKEYPublicKey pubk_;
- ScopedSECKEYPrivateKey ecPrivk_;
- ScopedSECKEYPublicKey ecPubk_;
-
- void SetUp() {
- arena_.reset(PORT_NewArena(2048));
-
- SECKEYPublicKey *pubk;
- SECKEYPrivateKey *privk = SECKEY_CreateRSAPrivateKey(1024, &pubk, NULL);
- ASSERT_NE(nullptr, pubk);
- pubk_.reset(pubk);
- ASSERT_NE(nullptr, privk);
- privk_.reset(privk);
-
- SECKEYECParams ecParams = {siBuffer, NULL, 0};
- SECOidData *oidData;
- oidData = SECOID_FindOIDByTag(SEC_OID_CURVE25519);
- ASSERT_NE(nullptr, oidData);
- ASSERT_NE(nullptr,
- SECITEM_AllocItem(NULL, &ecParams, (2 + oidData->oid.len)))
- << "Couldn't allocate memory for OID.";
- ecParams.data[0] = SEC_ASN1_OBJECT_ID; /* we have to prepend 0x06 */
- ecParams.data[1] = oidData->oid.len;
- memcpy(ecParams.data + 2, oidData->oid.data, oidData->oid.len);
- SECKEYPublicKey *ecPubk;
- SECKEYPrivateKey *ecPrivk =
- SECKEY_CreateECPrivateKey(&ecParams, &ecPubk, NULL);
- ASSERT_NE(nullptr, ecPubk);
- ecPubk_.reset(ecPubk);
- ASSERT_NE(nullptr, ecPrivk);
- ecPrivk_.reset(ecPrivk);
- }
-
- void CreatePssParams(SECKEYRSAPSSParams *params, SECOidTag hashAlgTag) {
- PORT_Memset(params, 0, sizeof(SECKEYRSAPSSParams));
-
- params->hashAlg = (SECAlgorithmID *)PORT_ArenaZAlloc(
- arena_.get(), sizeof(SECAlgorithmID));
- ASSERT_NE(nullptr, params->hashAlg);
- SECStatus rv =
- SECOID_SetAlgorithmID(arena_.get(), params->hashAlg, hashAlgTag, NULL);
- ASSERT_EQ(SECSuccess, rv);
- }
-
- void CreatePssParams(SECKEYRSAPSSParams *params, SECOidTag hashAlgTag,
- SECOidTag maskHashAlgTag) {
- CreatePssParams(params, hashAlgTag);
-
- SECAlgorithmID maskHashAlg;
- PORT_Memset(&maskHashAlg, 0, sizeof(maskHashAlg));
- SECStatus rv =
- SECOID_SetAlgorithmID(arena_.get(), &maskHashAlg, maskHashAlgTag, NULL);
- ASSERT_EQ(SECSuccess, rv);
-
- SECItem *maskHashAlgItem =
- SEC_ASN1EncodeItem(arena_.get(), NULL, &maskHashAlg,
- SEC_ASN1_GET(SECOID_AlgorithmIDTemplate));
-
- params->maskAlg = (SECAlgorithmID *)PORT_ArenaZAlloc(
- arena_.get(), sizeof(SECAlgorithmID));
- ASSERT_NE(nullptr, params->maskAlg);
-
- rv = SECOID_SetAlgorithmID(arena_.get(), params->maskAlg,
- SEC_OID_PKCS1_MGF1, maskHashAlgItem);
- ASSERT_EQ(SECSuccess, rv);
- }
-
- void CreatePssParams(SECKEYRSAPSSParams *params, SECOidTag hashAlgTag,
- SECOidTag maskHashAlgTag, unsigned long saltLength) {
- CreatePssParams(params, hashAlgTag, maskHashAlgTag);
-
- SECItem *saltLengthItem =
- SEC_ASN1EncodeInteger(arena_.get(), &params->saltLength, saltLength);
- ASSERT_EQ(&params->saltLength, saltLengthItem);
- }
-
- void CheckHashAlg(SECKEYRSAPSSParams *params, SECOidTag hashAlgTag) {
- // If hash algorithm is SHA-1, it must be omitted in the parameters
- if (hashAlgTag == SEC_OID_SHA1) {
- EXPECT_EQ(nullptr, params->hashAlg);
- } else {
- EXPECT_NE(nullptr, params->hashAlg);
- EXPECT_EQ(hashAlgTag, SECOID_GetAlgorithmTag(params->hashAlg));
- }
- }
-
- void CheckMaskAlg(SECKEYRSAPSSParams *params, SECOidTag hashAlgTag) {
- SECStatus rv;
-
- // If hash algorithm is SHA-1, it must be omitted in the parameters
- if (hashAlgTag == SEC_OID_SHA1)
- EXPECT_EQ(nullptr, params->hashAlg);
- else {
- EXPECT_NE(nullptr, params->maskAlg);
- EXPECT_EQ(SEC_OID_PKCS1_MGF1, SECOID_GetAlgorithmTag(params->maskAlg));
-
- SECAlgorithmID hashAlg;
- rv = SEC_QuickDERDecodeItem(arena_.get(), &hashAlg,
- SEC_ASN1_GET(SECOID_AlgorithmIDTemplate),
- &params->maskAlg->parameters);
- ASSERT_EQ(SECSuccess, rv);
-
- EXPECT_EQ(hashAlgTag, SECOID_GetAlgorithmTag(&hashAlg));
- }
- }
-
- void CheckSaltLength(SECKEYRSAPSSParams *params, SECOidTag hashAlg) {
- // If the salt length parameter is missing, that means it is 20 (default)
- if (!params->saltLength.data) {
- return;
- }
-
- unsigned long value;
- SECStatus rv = SEC_ASN1DecodeInteger(&params->saltLength, &value);
- ASSERT_EQ(SECSuccess, rv);
-
- // The salt length are usually the same as the hash length,
- // except for the case where the hash length exceeds the limit
- // set by the key length
- switch (hashAlg) {
- case SEC_OID_SHA1:
- EXPECT_EQ(20UL, value);
- break;
- case SEC_OID_SHA224:
- EXPECT_EQ(28UL, value);
- break;
- case SEC_OID_SHA256:
- EXPECT_EQ(32UL, value);
- break;
- case SEC_OID_SHA384:
- EXPECT_EQ(48UL, value);
- break;
- case SEC_OID_SHA512:
- // Truncated from 64, because our private key is 1024-bit
- EXPECT_EQ(62UL, value);
- break;
- default:
- FAIL();
- }
- }
-};
-
-class SignParamsTest
- : public SignParamsTestF,
- public ::testing::WithParamInterface<std::tuple<SECOidTag, SECOidTag>> {};
-
-class SignParamsSourceTest : public SignParamsTestF,
- public ::testing::WithParamInterface<SECOidTag> {};
-
-TEST_P(SignParamsTest, CreateRsa) {
- SECOidTag hashAlg = std::get<0>(GetParam());
- SECOidTag srcHashAlg = std::get<1>(GetParam());
-
- SECItem *srcParams;
- if (srcHashAlg != SEC_OID_UNKNOWN) {
- SECKEYRSAPSSParams pssParams;
- ASSERT_NO_FATAL_FAILURE(
- CreatePssParams(&pssParams, srcHashAlg, srcHashAlg));
- srcParams = SEC_ASN1EncodeItem(arena_.get(), nullptr, &pssParams,
- SEC_ASN1_GET(SECKEY_RSAPSSParamsTemplate));
- ASSERT_NE(nullptr, srcParams);
- } else {
- srcParams = NULL;
- }
-
- SECItem *params = SEC_CreateSignatureAlgorithmParameters(
- arena_.get(), nullptr, SEC_OID_PKCS1_RSA_ENCRYPTION, hashAlg, srcParams,
- privk_.get());
-
- // PKCS#1 RSA actually doesn't take any parameters, but if it is
- // given, return a copy of it
- if (srcHashAlg != SEC_OID_UNKNOWN) {
- EXPECT_EQ(srcParams->len, params->len);
- EXPECT_EQ(0, memcmp(params->data, srcParams->data, srcParams->len));
- } else {
- EXPECT_EQ(nullptr, params);
- }
-}
-
-TEST_P(SignParamsTest, CreateRsaPss) {
- SECOidTag hashAlg = std::get<0>(GetParam());
- SECOidTag srcHashAlg = std::get<1>(GetParam());
-
- SECItem *srcParams;
- if (srcHashAlg != SEC_OID_UNKNOWN) {
- SECKEYRSAPSSParams pssParams;
- ASSERT_NO_FATAL_FAILURE(
- CreatePssParams(&pssParams, srcHashAlg, srcHashAlg));
- srcParams = SEC_ASN1EncodeItem(arena_.get(), nullptr, &pssParams,
- SEC_ASN1_GET(SECKEY_RSAPSSParamsTemplate));
- ASSERT_NE(nullptr, srcParams);
- } else {
- srcParams = NULL;
- }
-
- SECItem *params = SEC_CreateSignatureAlgorithmParameters(
- arena_.get(), nullptr, SEC_OID_PKCS1_RSA_PSS_SIGNATURE, hashAlg,
- srcParams, privk_.get());
-
- if (hashAlg != SEC_OID_UNKNOWN && srcHashAlg != SEC_OID_UNKNOWN &&
- hashAlg != srcHashAlg) {
- EXPECT_EQ(nullptr, params);
- return;
- }
-
- EXPECT_NE(nullptr, params);
-
- SECKEYRSAPSSParams pssParams;
- PORT_Memset(&pssParams, 0, sizeof(pssParams));
- SECStatus rv =
- SEC_QuickDERDecodeItem(arena_.get(), &pssParams,
- SEC_ASN1_GET(SECKEY_RSAPSSParamsTemplate), params);
- ASSERT_EQ(SECSuccess, rv);
-
- if (hashAlg == SEC_OID_UNKNOWN) {
- if (!pssParams.hashAlg) {
- hashAlg = SEC_OID_SHA1;
- } else {
- hashAlg = SECOID_GetAlgorithmTag(pssParams.hashAlg);
- }
-
- if (srcHashAlg == SEC_OID_UNKNOWN) {
- // If both hashAlg and srcHashAlg is unset, NSS will decide the hash
- // algorithm based on the key length; in this case it's SHA256
- EXPECT_EQ(SEC_OID_SHA256, hashAlg);
- } else {
- EXPECT_EQ(srcHashAlg, hashAlg);
- }
- }
-
- ASSERT_NO_FATAL_FAILURE(CheckHashAlg(&pssParams, hashAlg));
- ASSERT_NO_FATAL_FAILURE(CheckMaskAlg(&pssParams, hashAlg));
- ASSERT_NO_FATAL_FAILURE(CheckSaltLength(&pssParams, hashAlg));
-
- // The default trailer field (1) must be omitted
- EXPECT_EQ(nullptr, pssParams.trailerField.data);
-}
-
-TEST_P(SignParamsTest, CreateRsaPssWithECPrivateKey) {
- SECOidTag hashAlg = std::get<0>(GetParam());
- SECOidTag srcHashAlg = std::get<1>(GetParam());
-
- SECItem *srcParams;
- if (srcHashAlg != SEC_OID_UNKNOWN) {
- SECKEYRSAPSSParams pssParams;
- ASSERT_NO_FATAL_FAILURE(
- CreatePssParams(&pssParams, srcHashAlg, srcHashAlg));
- srcParams = SEC_ASN1EncodeItem(arena_.get(), nullptr, &pssParams,
- SEC_ASN1_GET(SECKEY_RSAPSSParamsTemplate));
- ASSERT_NE(nullptr, srcParams);
- } else {
- srcParams = NULL;
- }
-
- SECItem *params = SEC_CreateSignatureAlgorithmParameters(
- arena_.get(), nullptr, SEC_OID_PKCS1_RSA_PSS_SIGNATURE, hashAlg,
- srcParams, ecPrivk_.get());
-
- EXPECT_EQ(nullptr, params);
-}
-
-TEST_P(SignParamsTest, CreateRsaPssWithInvalidHashAlg) {
- SECOidTag srcHashAlg = std::get<1>(GetParam());
-
- SECItem *srcParams;
- if (srcHashAlg != SEC_OID_UNKNOWN) {
- SECKEYRSAPSSParams pssParams;
- ASSERT_NO_FATAL_FAILURE(
- CreatePssParams(&pssParams, srcHashAlg, srcHashAlg));
- srcParams = SEC_ASN1EncodeItem(arena_.get(), nullptr, &pssParams,
- SEC_ASN1_GET(SECKEY_RSAPSSParamsTemplate));
- ASSERT_NE(nullptr, srcParams);
- } else {
- srcParams = NULL;
- }
-
- SECItem *params = SEC_CreateSignatureAlgorithmParameters(
- arena_.get(), nullptr, SEC_OID_PKCS1_RSA_PSS_SIGNATURE, SEC_OID_MD5,
- srcParams, privk_.get());
-
- EXPECT_EQ(nullptr, params);
-}
-
-TEST_P(SignParamsSourceTest, CreateRsaPssWithInvalidHashAlg) {
- SECOidTag hashAlg = GetParam();
-
- SECItem *srcParams;
- SECKEYRSAPSSParams pssParams;
- ASSERT_NO_FATAL_FAILURE(
- CreatePssParams(&pssParams, SEC_OID_MD5, SEC_OID_MD5));
- srcParams = SEC_ASN1EncodeItem(arena_.get(), nullptr, &pssParams,
- SEC_ASN1_GET(SECKEY_RSAPSSParamsTemplate));
- ASSERT_NE(nullptr, srcParams);
-
- SECItem *params = SEC_CreateSignatureAlgorithmParameters(
- arena_.get(), nullptr, SEC_OID_PKCS1_RSA_PSS_SIGNATURE, hashAlg,
- srcParams, privk_.get());
-
- EXPECT_EQ(nullptr, params);
-}
-
-TEST_P(SignParamsSourceTest, CreateRsaPssWithInvalidSaltLength) {
- SECOidTag hashAlg = GetParam();
-
- SECItem *srcParams;
- SECKEYRSAPSSParams pssParams;
- ASSERT_NO_FATAL_FAILURE(
- CreatePssParams(&pssParams, SEC_OID_SHA512, SEC_OID_SHA512, 100));
- srcParams = SEC_ASN1EncodeItem(arena_.get(), nullptr, &pssParams,
- SEC_ASN1_GET(SECKEY_RSAPSSParamsTemplate));
- ASSERT_NE(nullptr, srcParams);
-
- SECItem *params = SEC_CreateSignatureAlgorithmParameters(
- arena_.get(), nullptr, SEC_OID_PKCS1_RSA_PSS_SIGNATURE, hashAlg,
- srcParams, privk_.get());
-
- EXPECT_EQ(nullptr, params);
-}
-
-TEST_P(SignParamsSourceTest, CreateRsaPssWithHashMismatch) {
- SECOidTag hashAlg = GetParam();
-
- SECItem *srcParams;
- SECKEYRSAPSSParams pssParams;
- ASSERT_NO_FATAL_FAILURE(
- CreatePssParams(&pssParams, SEC_OID_SHA256, SEC_OID_SHA512));
- srcParams = SEC_ASN1EncodeItem(arena_.get(), nullptr, &pssParams,
- SEC_ASN1_GET(SECKEY_RSAPSSParamsTemplate));
- ASSERT_NE(nullptr, srcParams);
-
- SECItem *params = SEC_CreateSignatureAlgorithmParameters(
- arena_.get(), nullptr, SEC_OID_PKCS1_RSA_PSS_SIGNATURE, hashAlg,
- srcParams, privk_.get());
-
- EXPECT_EQ(nullptr, params);
-}
-
-INSTANTIATE_TEST_CASE_P(
- SignParamsTestCases, SignParamsTest,
- ::testing::Combine(::testing::Values(SEC_OID_UNKNOWN, SEC_OID_SHA1,
- SEC_OID_SHA224, SEC_OID_SHA256,
- SEC_OID_SHA384, SEC_OID_SHA512),
- ::testing::Values(SEC_OID_UNKNOWN, SEC_OID_SHA1,
- SEC_OID_SHA224, SEC_OID_SHA256,
- SEC_OID_SHA384, SEC_OID_SHA512)));
-
-INSTANTIATE_TEST_CASE_P(SignParamsSourceTestCases, SignParamsSourceTest,
- ::testing::Values(SEC_OID_UNKNOWN, SEC_OID_SHA1,
- SEC_OID_SHA224, SEC_OID_SHA256,
- SEC_OID_SHA384, SEC_OID_SHA512));
-
-} // namespace nss_test
diff --git a/security/nss/gtests/cryptohi_gtest/manifest.mn b/security/nss/gtests/cryptohi_gtest/manifest.mn
deleted file mode 100644
index 644463aa6a..0000000000
--- a/security/nss/gtests/cryptohi_gtest/manifest.mn
+++ /dev/null
@@ -1,22 +0,0 @@
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-CORE_DEPTH = ../..
-DEPTH = ../..
-MODULE = nss
-
-CPPSRCS = \
- cryptohi_unittest.cc \
- $(NULL)
-
-INCLUDES += -I$(CORE_DEPTH)/gtests/google_test/gtest/include \
- -I$(CORE_DEPTH)/gtests/common \
- -I$(CORE_DEPTH)/cpputil
-
-REQUIRES = nspr gtest
-
-PROGRAM = cryptohi_gtest
-
-EXTRA_LIBS = $(DIST)/lib/$(LIB_PREFIX)gtest.$(LIB_SUFFIX) $(EXTRA_OBJS) \
- $(DIST)/lib/$(LIB_PREFIX)gtestutil.$(LIB_SUFFIX)
diff --git a/security/nss/gtests/freebl_gtest/blake2b_unittest.cc b/security/nss/gtests/freebl_gtest/blake2b_unittest.cc
deleted file mode 100644
index e6b0c11576..0000000000
--- a/security/nss/gtests/freebl_gtest/blake2b_unittest.cc
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- * blake2b_unittest.cc - unittests for blake2b hash function
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "blapi.h"
-#include "nspr.h"
-#include "nss.h"
-#include "secerr.h"
-
-#include <cstdlib>
-#include <iostream>
-#include <memory>
-
-#define GTEST_HAS_RTTI 0
-#include "gtest/gtest.h"
-
-#include "kat/blake2b_kat.h"
-
-template <class T>
-struct ScopedDelete {
- void operator()(T* ptr) {
- if (ptr) {
- BLAKE2B_DestroyContext(ptr, PR_TRUE);
- }
- }
-};
-
-typedef std::unique_ptr<BLAKE2BContext, ScopedDelete<BLAKE2BContext>>
- ScopedBLAKE2BContext;
-
-class Blake2BTests : public ::testing::Test {};
-
-class Blake2BKAT
- : public ::testing::TestWithParam<std::pair<int, std::vector<uint8_t>>> {};
-
-class Blake2BKATUnkeyed : public Blake2BKAT {};
-class Blake2BKATKeyed : public Blake2BKAT {};
-
-TEST_P(Blake2BKATUnkeyed, Unkeyed) {
- std::vector<uint8_t> values(BLAKE2B512_LENGTH);
- SECStatus rv =
- BLAKE2B_HashBuf(values.data(), kat_data.data(), std::get<0>(GetParam()));
- ASSERT_EQ(SECSuccess, rv);
- EXPECT_EQ(values, std::get<1>(GetParam()));
-}
-
-TEST_P(Blake2BKATKeyed, Keyed) {
- std::vector<uint8_t> values(BLAKE2B512_LENGTH);
- SECStatus rv = BLAKE2B_MAC_HashBuf(values.data(), kat_data.data(),
- std::get<0>(GetParam()), key.data(),
- BLAKE2B_KEY_SIZE);
- ASSERT_EQ(SECSuccess, rv);
- EXPECT_EQ(values, std::get<1>(GetParam()));
-}
-
-INSTANTIATE_TEST_CASE_P(UnkeyedKAT, Blake2BKATUnkeyed,
- ::testing::ValuesIn(TestcasesUnkeyed));
-INSTANTIATE_TEST_CASE_P(KeyedKAT, Blake2BKATKeyed,
- ::testing::ValuesIn(TestcasesKeyed));
-
-TEST_F(Blake2BTests, ContextTest) {
- ScopedBLAKE2BContext ctx(BLAKE2B_NewContext());
- ASSERT_TRUE(ctx) << "BLAKE2B_NewContext failed!";
-
- SECStatus rv = BLAKE2B_Begin(ctx.get());
- ASSERT_EQ(SECSuccess, rv);
-
- size_t src_length = 252;
- const size_t quarter = 63;
-
- for (int i = 0; i < 4 && src_length > 0; i++) {
- rv = BLAKE2B_Update(ctx.get(), kat_data.data() + i * quarter,
- PR_MIN(quarter, src_length));
- ASSERT_EQ(SECSuccess, rv);
-
- size_t len = BLAKE2B_FlattenSize(ctx.get());
- std::vector<unsigned char> ctxbytes(len);
- rv = BLAKE2B_Flatten(ctx.get(), ctxbytes.data());
- ASSERT_EQ(SECSuccess, rv);
- ScopedBLAKE2BContext ctx_cpy(BLAKE2B_Resurrect(ctxbytes.data(), NULL));
- ASSERT_TRUE(ctx_cpy) << "BLAKE2B_Resurrect failed!";
- ASSERT_EQ(SECSuccess, PORT_Memcmp(ctx.get(), ctx_cpy.get(), len));
- src_length -= quarter;
- }
- ASSERT_EQ(0U, src_length);
-
- std::vector<uint8_t> digest(BLAKE2B512_LENGTH);
- rv = BLAKE2B_End(ctx.get(), digest.data(), nullptr, BLAKE2B512_LENGTH);
- ASSERT_EQ(SECSuccess, rv);
- ASSERT_EQ(std::get<1>(TestcasesUnkeyed[252]), digest)
- << "BLAKE2B_End failed!";
-}
-
-TEST_F(Blake2BTests, ContextTest2) {
- ScopedBLAKE2BContext ctx(BLAKE2B_NewContext());
- ASSERT_TRUE(ctx) << "BLAKE2B_NewContext failed!";
-
- SECStatus rv = BLAKE2B_Begin(ctx.get());
- ASSERT_EQ(SECSuccess, rv);
-
- rv = BLAKE2B_Update(ctx.get(), kat_data.data(), 128);
- ASSERT_EQ(SECSuccess, rv);
- rv = BLAKE2B_Update(ctx.get(), kat_data.data() + 128, 127);
- ASSERT_EQ(SECSuccess, rv);
-
- std::vector<uint8_t> digest(BLAKE2B512_LENGTH);
- rv = BLAKE2B_End(ctx.get(), digest.data(), nullptr, BLAKE2B512_LENGTH);
- ASSERT_EQ(SECSuccess, rv);
- ASSERT_EQ(std::get<1>(TestcasesUnkeyed[255]), digest)
- << "BLAKE2B_End failed!";
-}
-
-TEST_F(Blake2BTests, CloneTest) {
- ScopedBLAKE2BContext ctx(BLAKE2B_NewContext());
- ScopedBLAKE2BContext cloned_ctx(BLAKE2B_NewContext());
- ASSERT_TRUE(ctx) << "BLAKE2B_NewContext failed!";
- ASSERT_TRUE(cloned_ctx) << "BLAKE2B_NewContext failed!";
-
- SECStatus rv = BLAKE2B_Begin(ctx.get());
- ASSERT_EQ(SECSuccess, rv);
- rv = BLAKE2B_Update(ctx.get(), kat_data.data(), 255);
- ASSERT_EQ(SECSuccess, rv);
- BLAKE2B_Clone(cloned_ctx.get(), ctx.get());
-
- std::vector<uint8_t> digest(BLAKE2B512_LENGTH);
- rv = BLAKE2B_End(cloned_ctx.get(), digest.data(), nullptr, BLAKE2B512_LENGTH);
- ASSERT_EQ(SECSuccess, rv);
- ASSERT_EQ(std::get<1>(TestcasesUnkeyed[255]), digest)
- << "BLAKE2B_End failed!";
-}
-
-TEST_F(Blake2BTests, NullTest) {
- std::vector<uint8_t> digest(BLAKE2B512_LENGTH);
- SECStatus rv = BLAKE2B_HashBuf(digest.data(), nullptr, 0);
- ASSERT_EQ(SECSuccess, rv);
- EXPECT_EQ(std::get<1>(TestcasesUnkeyed[0]), digest);
-
- digest = std::vector<uint8_t>(BLAKE2B512_LENGTH);
- rv = BLAKE2B_MAC_HashBuf(digest.data(), nullptr, 0, key.data(),
- BLAKE2B_KEY_SIZE);
- ASSERT_EQ(SECSuccess, rv);
- EXPECT_EQ(std::get<1>(TestcasesKeyed[0]), digest);
-}
-
-TEST_F(Blake2BTests, HashTest) {
- ScopedBLAKE2BContext ctx(BLAKE2B_NewContext());
- ASSERT_TRUE(ctx) << "BLAKE2B_NewContext failed!";
-
- std::vector<uint8_t> digest(BLAKE2B512_LENGTH);
- SECStatus rv = BLAKE2B_Hash(digest.data(), "abc");
- std::vector<uint8_t> expected = {
- 0xba, 0x80, 0xa5, 0x3f, 0x98, 0x1c, 0x4d, 0x0d, 0x6a, 0x27, 0x97,
- 0xb6, 0x9f, 0x12, 0xf6, 0xe9, 0x4c, 0x21, 0x2f, 0x14, 0x68, 0x5a,
- 0xc4, 0xb7, 0x4b, 0x12, 0xbb, 0x6f, 0xdb, 0xff, 0xa2, 0xd1, 0x7d,
- 0x87, 0xc5, 0x39, 0x2a, 0xab, 0x79, 0x2d, 0xc2, 0x52, 0xd5, 0xde,
- 0x45, 0x33, 0xcc, 0x95, 0x18, 0xd3, 0x8a, 0xa8, 0xdb, 0xf1, 0x92,
- 0x5a, 0xb9, 0x23, 0x86, 0xed, 0xd4, 0x00, 0x99, 0x23};
- ASSERT_EQ(SECSuccess, rv);
- EXPECT_EQ(expected, digest);
-}
-
-TEST_F(Blake2BTests, LongHashTest) {
- ScopedBLAKE2BContext ctx(BLAKE2B_NewContext());
- ASSERT_TRUE(ctx) << "BLAKE2B_NewContext failed!";
-
- std::vector<uint8_t> digest(BLAKE2B512_LENGTH);
- SECStatus rv = BLAKE2B_Hash(
- digest.data(),
- "qwertzuiopasdfghjklyxcvbnm123456789qwertzuiopasdfghjklyxcvbnm123456789qw"
- "ertzuiopasdfghjklyxcvbnm123456789qwertzuiopasdfghjklyxcvbnm123456789qwer"
- "tzuiopasdfghjklyxcvbnm123456789qwertzuiopasdfghjklyxcvbnm123456789qwertz"
- "uiopasdfghjklyxcvbnm123456789qwertzuiopasdfghjklyxcvbnm123456789");
- std::vector<uint8_t> expected = {
- 0x1f, 0x9e, 0xe6, 0x5a, 0xa0, 0x36, 0x05, 0xfc, 0x41, 0x0e, 0x2f,
- 0x55, 0x96, 0xfd, 0xb5, 0x9d, 0x85, 0x95, 0x5e, 0x24, 0x37, 0xe7,
- 0x0d, 0xe4, 0xa0, 0x22, 0x4a, 0xe1, 0x59, 0x1f, 0x97, 0x03, 0x57,
- 0x54, 0xf0, 0xca, 0x92, 0x75, 0x2f, 0x9e, 0x86, 0xeb, 0x82, 0x4f,
- 0x9c, 0xf4, 0x02, 0x17, 0x7f, 0x76, 0x56, 0x26, 0x46, 0xf4, 0x07,
- 0xfd, 0x1f, 0x78, 0xdb, 0x7b, 0x0d, 0x24, 0x43, 0xf0};
- ASSERT_EQ(SECSuccess, rv);
- EXPECT_EQ(expected, digest);
-}
-
-TEST_F(Blake2BTests, TruncatedHashTest) {
- ScopedBLAKE2BContext ctx(BLAKE2B_NewContext());
- ASSERT_TRUE(ctx) << "BLAKE2B_NewContext failed!";
-
- SECStatus rv = BLAKE2B_Begin(ctx.get());
- ASSERT_EQ(SECSuccess, rv);
-
- rv = BLAKE2B_Update(ctx.get(), kat_data.data(), 128);
- ASSERT_EQ(SECSuccess, rv);
- rv = BLAKE2B_Update(ctx.get(), kat_data.data() + 128, 127);
- ASSERT_EQ(SECSuccess, rv);
-
- size_t max_digest_len = BLAKE2B512_LENGTH - 5;
- std::vector<uint8_t> digest(max_digest_len);
- unsigned int digest_len;
- rv = BLAKE2B_End(ctx.get(), digest.data(), &digest_len, max_digest_len);
- ASSERT_EQ(SECSuccess, rv);
- ASSERT_EQ(digest.size(), digest_len);
- ASSERT_EQ(0, memcmp(std::get<1>(TestcasesUnkeyed[255]).data(), digest.data(),
- max_digest_len))
- << "BLAKE2B_End failed!";
-}
-
-TEST_F(Blake2BTests, TruncatedHashTest2) {
- ScopedBLAKE2BContext ctx(BLAKE2B_NewContext());
- ASSERT_TRUE(ctx) << "BLAKE2B_NewContext failed!";
-
- SECStatus rv = BLAKE2B_Begin(ctx.get());
- ASSERT_EQ(SECSuccess, rv);
-
- rv = BLAKE2B_Update(ctx.get(), kat_data.data(), 128);
- ASSERT_EQ(SECSuccess, rv);
- rv = BLAKE2B_Update(ctx.get(), kat_data.data() + 128, 127);
- ASSERT_EQ(SECSuccess, rv);
-
- size_t max_digest_len = BLAKE2B512_LENGTH - 60;
- std::vector<uint8_t> digest(max_digest_len);
- unsigned int digest_len;
- rv = BLAKE2B_End(ctx.get(), digest.data(), &digest_len, max_digest_len);
- ASSERT_EQ(SECSuccess, rv);
- ASSERT_EQ(digest.size(), digest_len);
-}
-
-TEST_F(Blake2BTests, OverlongKeyTest) {
- ScopedBLAKE2BContext ctx(BLAKE2B_NewContext());
- ASSERT_TRUE(ctx) << "BLAKE2B_NewContext failed!";
-
- std::vector<uint8_t> key = {
- 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31,
- 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32,
- 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33,
- 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34,
- 0x35, 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35,
- 0x36, 0x37, 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35};
- std::vector<uint8_t> data = {0x61, 0x62, 0x63};
-
- std::vector<uint8_t> digest(BLAKE2B512_LENGTH);
- SECStatus rv =
- BLAKE2B_MAC_HashBuf(digest.data(), data.data(), 3, key.data(), 65);
- EXPECT_EQ(SECFailure, rv);
- EXPECT_EQ(SEC_ERROR_INVALID_ARGS, PORT_GetError());
-}
-
-TEST_F(Blake2BTests, EmptyKeyTest) {
- ScopedBLAKE2BContext ctx(BLAKE2B_NewContext());
- ASSERT_TRUE(ctx) << "BLAKE2B_NewContext failed!";
-
- uint8_t key[1]; // A vector.data() would give us a nullptr.
- std::vector<uint8_t> data = {0x61, 0x62, 0x63};
-
- std::vector<uint8_t> digest(BLAKE2B512_LENGTH);
- SECStatus rv = BLAKE2B_MAC_HashBuf(digest.data(), data.data(), 3, key, 0);
- EXPECT_EQ(SECFailure, rv);
- EXPECT_EQ(SEC_ERROR_INVALID_ARGS, PORT_GetError());
-}
-
-int main(int argc, char** argv) {
- ::testing::InitGoogleTest(&argc, argv);
-
- if (NSS_NoDB_Init(nullptr) != SECSuccess) {
- return 1;
- }
-
- int rv = RUN_ALL_TESTS();
-
- if (NSS_Shutdown() != SECSuccess) {
- return 1;
- }
-
- return rv;
-}
diff --git a/security/nss/gtests/freebl_gtest/freebl_gtest.gyp b/security/nss/gtests/freebl_gtest/freebl_gtest.gyp
index 21a87c557c..7e11cd1036 100644
--- a/security/nss/gtests/freebl_gtest/freebl_gtest.gyp
+++ b/security/nss/gtests/freebl_gtest/freebl_gtest.gyp
@@ -8,10 +8,17 @@
],
'targets': [
{
- # Dependencies for tests.
- 'target_name': 'freebl_gtest_deps',
- 'type': 'none',
+ 'target_name': 'freebl_gtest',
+ 'type': 'executable',
+ 'sources': [
+ 'mpi_unittest.cc',
+ 'dh_unittest.cc',
+ 'ecl_unittest.cc',
+ 'ghash_unittest.cc',
+ '<(DEPTH)/gtests/common/gtests.cc'
+ ],
'dependencies': [
+ '<(DEPTH)/exports.gyp:nss_exports',
'<(DEPTH)/lib/util/util.gyp:nssutil3',
'<(DEPTH)/gtests/google_test/google_test.gyp:gtest',
'<(DEPTH)/lib/nss/nss.gyp:nss_static',
@@ -26,57 +33,42 @@
],
},
{
- 'target_name': 'freebl_gtest',
- 'type': 'executable',
- 'sources': [
- 'mpi_unittest.cc',
- 'dh_unittest.cc',
- 'ecl_unittest.cc',
- 'ghash_unittest.cc',
- 'rsa_unittest.cc',
- '<(DEPTH)/gtests/common/gtests.cc'
- ],
- 'dependencies': [
- 'freebl_gtest_deps',
- '<(DEPTH)/exports.gyp:nss_exports',
- ],
- },
- {
'target_name': 'prng_gtest',
'type': 'executable',
'sources': [
'prng_kat_unittest.cc',
],
'dependencies': [
- 'freebl_gtest_deps',
'<(DEPTH)/exports.gyp:nss_exports',
+ '<(DEPTH)/lib/util/util.gyp:nssutil3',
+ '<(DEPTH)/gtests/google_test/google_test.gyp:gtest',
+ '<(DEPTH)/lib/nss/nss.gyp:nss_static',
+ '<(DEPTH)/lib/pk11wrap/pk11wrap.gyp:pk11wrap_static',
+ '<(DEPTH)/lib/cryptohi/cryptohi.gyp:cryptohi',
+ '<(DEPTH)/lib/certhigh/certhigh.gyp:certhi',
+ '<(DEPTH)/lib/certdb/certdb.gyp:certdb',
+ '<(DEPTH)/lib/base/base.gyp:nssb',
+ '<(DEPTH)/lib/dev/dev.gyp:nssdev',
+ '<(DEPTH)/lib/pki/pki.gyp:nsspki',
+ '<(DEPTH)/lib/ssl/ssl.gyp:ssl',
+ '<(DEPTH)/lib/libpkix/libpkix.gyp:libpkix',
],
- },
- {
- 'target_name': 'blake2b_gtest',
- 'type': 'executable',
- 'sources': [
- 'blake2b_unittest.cc',
+ 'conditions': [
+ [ 'OS=="win"', {
+ 'libraries': [
+ 'advapi32.lib',
+ ],
+ }],
],
- 'dependencies': [
- 'freebl_gtest_deps',
- '<(DEPTH)/exports.gyp:nss_exports',
+ 'defines': [
+ 'NSS_USE_STATIC_LIBS'
],
},
],
'target_defaults': {
'include_dirs': [
- '<(DEPTH)/lib/freebl/ecl',
'<(DEPTH)/lib/freebl/mpi',
'<(DEPTH)/lib/freebl/',
- '<(DEPTH)/lib/ssl/',
- '<(DEPTH)/lib/util/',
- '<(DEPTH)/lib/certdb/',
- '<(DEPTH)/lib/cryptohi/',
- '<(DEPTH)/lib/pk11wrap/',
- ],
- 'defines': [
- 'NSS_USE_STATIC_LIBS',
],
# For test builds we have to set MPI defines.
'conditions': [
@@ -93,11 +85,6 @@
'MP_ASSEMBLY_DIV_2DX1D',
],
}],
- [ 'OS=="win"', {
- 'libraries': [
- 'advapi32.lib',
- ],
- }],
],
},
'variables': {
diff --git a/security/nss/gtests/freebl_gtest/kat/blake2b_kat.h b/security/nss/gtests/freebl_gtest/kat/blake2b_kat.h
deleted file mode 100644
index 28921cc945..0000000000
--- a/security/nss/gtests/freebl_gtest/kat/blake2b_kat.h
+++ /dev/null
@@ -1,4646 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/* https://github.com/BLAKE2/BLAKE2/blob/master/testvectors/blake2b-kat.txt */
-
-#include <vector>
-#include <stdint.h>
-
-const std::vector<uint8_t> key = {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63};
-
-const std::vector<uint8_t> kat_data = {
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
- 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
- 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
- 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89,
- 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
- 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
- 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
- 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
- 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164,
- 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179,
- 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194,
- 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209,
- 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224,
- 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239,
- 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254,
- 255};
-
-std::vector<std::pair<int, std::vector<uint8_t>>> TestcasesUnkeyed = {
- std::make_pair(
- 0,
- std::vector<uint8_t>(
- {0x78, 0x6a, 0x02, 0xf7, 0x42, 0x01, 0x59, 0x03, 0xc6, 0xc6, 0xfd,
- 0x85, 0x25, 0x52, 0xd2, 0x72, 0x91, 0x2f, 0x47, 0x40, 0xe1, 0x58,
- 0x47, 0x61, 0x8a, 0x86, 0xe2, 0x17, 0xf7, 0x1f, 0x54, 0x19, 0xd2,
- 0x5e, 0x10, 0x31, 0xaf, 0xee, 0x58, 0x53, 0x13, 0x89, 0x64, 0x44,
- 0x93, 0x4e, 0xb0, 0x4b, 0x90, 0x3a, 0x68, 0x5b, 0x14, 0x48, 0xb7,
- 0x55, 0xd5, 0x6f, 0x70, 0x1a, 0xfe, 0x9b, 0xe2, 0xce})),
- std::make_pair(
- 1,
- std::vector<uint8_t>(
- {0x2f, 0xa3, 0xf6, 0x86, 0xdf, 0x87, 0x69, 0x95, 0x16, 0x7e, 0x7c,
- 0x2e, 0x5d, 0x74, 0xc4, 0xc7, 0xb6, 0xe4, 0x8f, 0x80, 0x68, 0xfe,
- 0x0e, 0x44, 0x20, 0x83, 0x44, 0xd4, 0x80, 0xf7, 0x90, 0x4c, 0x36,
- 0x96, 0x3e, 0x44, 0x11, 0x5f, 0xe3, 0xeb, 0x2a, 0x3a, 0xc8, 0x69,
- 0x4c, 0x28, 0xbc, 0xb4, 0xf5, 0xa0, 0xf3, 0x27, 0x6f, 0x2e, 0x79,
- 0x48, 0x7d, 0x82, 0x19, 0x05, 0x7a, 0x50, 0x6e, 0x4b})),
- std::make_pair(
- 2,
- std::vector<uint8_t>(
- {0x1c, 0x08, 0x79, 0x8d, 0xc6, 0x41, 0xab, 0xa9, 0xde, 0xe4, 0x35,
- 0xe2, 0x25, 0x19, 0xa4, 0x72, 0x9a, 0x09, 0xb2, 0xbf, 0xe0, 0xff,
- 0x00, 0xef, 0x2d, 0xcd, 0x8e, 0xd6, 0xf8, 0xa0, 0x7d, 0x15, 0xea,
- 0xf4, 0xae, 0xe5, 0x2b, 0xbf, 0x18, 0xab, 0x56, 0x08, 0xa6, 0x19,
- 0x0f, 0x70, 0xb9, 0x04, 0x86, 0xc8, 0xa7, 0xd4, 0x87, 0x37, 0x10,
- 0xb1, 0x11, 0x5d, 0x3d, 0xeb, 0xbb, 0x43, 0x27, 0xb5})),
- std::make_pair(
- 3,
- std::vector<uint8_t>(
- {0x40, 0xa3, 0x74, 0x72, 0x73, 0x02, 0xd9, 0xa4, 0x76, 0x9c, 0x17,
- 0xb5, 0xf4, 0x09, 0xff, 0x32, 0xf5, 0x8a, 0xa2, 0x4f, 0xf1, 0x22,
- 0xd7, 0x60, 0x3e, 0x4f, 0xda, 0x15, 0x09, 0xe9, 0x19, 0xd4, 0x10,
- 0x7a, 0x52, 0xc5, 0x75, 0x70, 0xa6, 0xd9, 0x4e, 0x50, 0x96, 0x7a,
- 0xea, 0x57, 0x3b, 0x11, 0xf8, 0x6f, 0x47, 0x3f, 0x53, 0x75, 0x65,
- 0xc6, 0x6f, 0x70, 0x39, 0x83, 0x0a, 0x85, 0xd1, 0x86})),
- std::make_pair(
- 4,
- std::vector<uint8_t>(
- {0x77, 0xdd, 0xf4, 0xb1, 0x44, 0x25, 0xeb, 0x3d, 0x05, 0x3c, 0x1e,
- 0x84, 0xe3, 0x46, 0x9d, 0x92, 0xc4, 0xcd, 0x91, 0x0e, 0xd2, 0x0f,
- 0x92, 0x03, 0x5e, 0x0c, 0x99, 0xd8, 0xa7, 0xa8, 0x6c, 0xec, 0xaf,
- 0x69, 0xf9, 0x66, 0x3c, 0x20, 0xa7, 0xaa, 0x23, 0x0b, 0xc8, 0x2f,
- 0x60, 0xd2, 0x2f, 0xb4, 0xa0, 0x0b, 0x09, 0xd3, 0xeb, 0x8f, 0xc6,
- 0x5e, 0xf5, 0x47, 0xfe, 0x63, 0xc8, 0xd3, 0xdd, 0xce})),
- std::make_pair(
- 5,
- std::vector<uint8_t>(
- {0xcb, 0xaa, 0x0b, 0xa7, 0xd4, 0x82, 0xb1, 0xf3, 0x01, 0x10, 0x9a,
- 0xe4, 0x10, 0x51, 0x99, 0x1a, 0x32, 0x89, 0xbc, 0x11, 0x98, 0x00,
- 0x5a, 0xf2, 0x26, 0xc5, 0xe4, 0xf1, 0x03, 0xb6, 0x65, 0x79, 0xf4,
- 0x61, 0x36, 0x10, 0x44, 0xc8, 0xba, 0x34, 0x39, 0xff, 0x12, 0xc5,
- 0x15, 0xfb, 0x29, 0xc5, 0x21, 0x61, 0xb7, 0xeb, 0x9c, 0x28, 0x37,
- 0xb7, 0x6a, 0x5d, 0xc3, 0x3f, 0x7c, 0xb2, 0xe2, 0xe8})),
- std::make_pair(
- 6,
- std::vector<uint8_t>(
- {0xf9, 0x5d, 0x45, 0xcf, 0x69, 0xaf, 0x5c, 0x20, 0x23, 0xbd, 0xb5,
- 0x05, 0x82, 0x1e, 0x62, 0xe8, 0x5d, 0x7c, 0xae, 0xdf, 0x7b, 0xed,
- 0xa1, 0x2c, 0x02, 0x48, 0x77, 0x5b, 0x0c, 0x88, 0x20, 0x5e, 0xeb,
- 0x35, 0xaf, 0x3a, 0x90, 0x81, 0x6f, 0x66, 0x08, 0xce, 0x7d, 0xd4,
- 0x4e, 0xc2, 0x8d, 0xb1, 0x14, 0x06, 0x14, 0xe1, 0xdd, 0xeb, 0xf3,
- 0xaa, 0x9c, 0xd1, 0x84, 0x3e, 0x0f, 0xad, 0x2c, 0x36})),
- std::make_pair(
- 7,
- std::vector<uint8_t>(
- {0x8f, 0x94, 0x5b, 0xa7, 0x00, 0xf2, 0x53, 0x0e, 0x5c, 0x2a, 0x7d,
- 0xf7, 0xd5, 0xdc, 0xe0, 0xf8, 0x3f, 0x9e, 0xfc, 0x78, 0xc0, 0x73,
- 0xfe, 0x71, 0xae, 0x1f, 0x88, 0x20, 0x4a, 0x4f, 0xd1, 0xcf, 0x70,
- 0xa0, 0x73, 0xf5, 0xd1, 0xf9, 0x42, 0xed, 0x62, 0x3a, 0xa1, 0x6e,
- 0x90, 0xa8, 0x71, 0x24, 0x6c, 0x90, 0xc4, 0x5b, 0x62, 0x1b, 0x34,
- 0x01, 0xa5, 0xdd, 0xbd, 0x9d, 0xf6, 0x26, 0x41, 0x65})),
- std::make_pair(
- 8,
- std::vector<uint8_t>(
- {0xe9, 0x98, 0xe0, 0xdc, 0x03, 0xec, 0x30, 0xeb, 0x99, 0xbb, 0x6b,
- 0xfa, 0xaf, 0x66, 0x18, 0xac, 0xc6, 0x20, 0x32, 0x0d, 0x72, 0x20,
- 0xb3, 0xaf, 0x2b, 0x23, 0xd1, 0x12, 0xd8, 0xe9, 0xcb, 0x12, 0x62,
- 0xf3, 0xc0, 0xd6, 0x0d, 0x18, 0x3b, 0x1e, 0xe7, 0xf0, 0x96, 0xd1,
- 0x2d, 0xae, 0x42, 0xc9, 0x58, 0x41, 0x86, 0x00, 0x21, 0x4d, 0x04,
- 0xf5, 0xed, 0x6f, 0x5e, 0x71, 0x8b, 0xe3, 0x55, 0x66})),
- std::make_pair(
- 9,
- std::vector<uint8_t>(
- {0x6a, 0x9a, 0x09, 0x0c, 0x61, 0xb3, 0x41, 0x0a, 0xed, 0xe7, 0xec,
- 0x91, 0x38, 0x14, 0x6c, 0xeb, 0x2c, 0x69, 0x66, 0x2f, 0x46, 0x0c,
- 0x3d, 0xa5, 0x3c, 0x65, 0x15, 0xc1, 0xeb, 0x31, 0xf4, 0x1c, 0xa3,
- 0xd2, 0x80, 0xe5, 0x67, 0x88, 0x2f, 0x95, 0xcf, 0x66, 0x4a, 0x94,
- 0x14, 0x7d, 0x78, 0xf4, 0x2c, 0xfc, 0x71, 0x4a, 0x40, 0xd2, 0x2e,
- 0xf1, 0x94, 0x70, 0xe0, 0x53, 0x49, 0x35, 0x08, 0xa2})),
- std::make_pair(
- 10,
- std::vector<uint8_t>(
- {0x29, 0x10, 0x25, 0x11, 0xd7, 0x49, 0xdb, 0x3c, 0xc9, 0xb4, 0xe3,
- 0x35, 0xfa, 0x1f, 0x5e, 0x8f, 0xac, 0xa8, 0x42, 0x1d, 0x55, 0x8f,
- 0x6a, 0x3f, 0x33, 0x21, 0xd5, 0x0d, 0x04, 0x4a, 0x24, 0x8b, 0xa5,
- 0x95, 0xcf, 0xc3, 0xef, 0xd3, 0xd2, 0xad, 0xc9, 0x73, 0x34, 0xda,
- 0x73, 0x24, 0x13, 0xf5, 0xcb, 0xf4, 0x75, 0x1c, 0x36, 0x2b, 0xa1,
- 0xd5, 0x38, 0x62, 0xac, 0x1e, 0x8d, 0xab, 0xee, 0xe8})),
- std::make_pair(
- 11,
- std::vector<uint8_t>(
- {0xc9, 0x7a, 0x47, 0x79, 0xd4, 0x7e, 0x6f, 0x77, 0x72, 0x9b, 0x59,
- 0x17, 0xd0, 0x13, 0x8a, 0xbb, 0x35, 0x98, 0x0a, 0xb6, 0x41, 0xbd,
- 0x73, 0xa8, 0x85, 0x9e, 0xb1, 0xac, 0x98, 0xc0, 0x53, 0x62, 0xed,
- 0x7d, 0x60, 0x8f, 0x2e, 0x95, 0x87, 0xd6, 0xba, 0x9e, 0x27, 0x1d,
- 0x34, 0x31, 0x25, 0xd4, 0x0d, 0x93, 0x3a, 0x8e, 0xd0, 0x4e, 0xc1,
- 0xfe, 0x75, 0xec, 0x40, 0x7c, 0x7a, 0x53, 0xc3, 0x4e})),
- std::make_pair(
- 12,
- std::vector<uint8_t>(
- {0x10, 0xf0, 0xdc, 0x91, 0xb9, 0xf8, 0x45, 0xfb, 0x95, 0xfa, 0xd6,
- 0x86, 0x0e, 0x6c, 0xe1, 0xad, 0xfa, 0x00, 0x2c, 0x7f, 0xc3, 0x27,
- 0x11, 0x6d, 0x44, 0xd0, 0x47, 0xcd, 0x7d, 0x58, 0x70, 0xd7, 0x72,
- 0xbb, 0x12, 0xb5, 0xfa, 0xc0, 0x0e, 0x02, 0xb0, 0x8a, 0xc2, 0xa0,
- 0x17, 0x4d, 0x04, 0x46, 0xc3, 0x6a, 0xb3, 0x5f, 0x14, 0xca, 0x31,
- 0x89, 0x4c, 0xd6, 0x1c, 0x78, 0xc8, 0x49, 0xb4, 0x8a})),
- std::make_pair(
- 13,
- std::vector<uint8_t>(
- {0xde, 0xa9, 0x10, 0x1c, 0xac, 0x62, 0xb8, 0xf6, 0xa3, 0xc6, 0x50,
- 0xf9, 0x0e, 0xea, 0x5b, 0xfa, 0xe2, 0x65, 0x3a, 0x4e, 0xaf, 0xd6,
- 0x3a, 0x6d, 0x1f, 0x0f, 0x13, 0x2d, 0xb9, 0xe4, 0xf2, 0xb1, 0xb6,
- 0x62, 0x43, 0x2e, 0xc8, 0x5b, 0x17, 0xbc, 0xac, 0x41, 0xe7, 0x75,
- 0x63, 0x78, 0x81, 0xf6, 0xaa, 0xb3, 0x8d, 0xd6, 0x6d, 0xcb, 0xd0,
- 0x80, 0xf0, 0x99, 0x0a, 0x7a, 0x6e, 0x98, 0x54, 0xfe})),
- std::make_pair(
- 14,
- std::vector<uint8_t>(
- {0x44, 0x1f, 0xfa, 0xa0, 0x8c, 0xd7, 0x9d, 0xff, 0x4a, 0xfc, 0x9b,
- 0x9e, 0x5b, 0x56, 0x20, 0xee, 0xc0, 0x86, 0x73, 0x0c, 0x25, 0xf6,
- 0x61, 0xb1, 0xd6, 0xfb, 0xfb, 0xd1, 0xce, 0xc3, 0x14, 0x8d, 0xd7,
- 0x22, 0x58, 0xc6, 0x56, 0x41, 0xf2, 0xfc, 0xa5, 0xeb, 0x15, 0x5f,
- 0xad, 0xbc, 0xab, 0xb1, 0x3c, 0x6e, 0x21, 0xdc, 0x11, 0xfa, 0xf7,
- 0x2c, 0x2a, 0x28, 0x1b, 0x7d, 0x56, 0x14, 0x5f, 0x19})),
- std::make_pair(
- 15,
- std::vector<uint8_t>(
- {0x44, 0x4b, 0x24, 0x0f, 0xe3, 0xed, 0x86, 0xd0, 0xe2, 0xef, 0x4c,
- 0xe7, 0xd8, 0x51, 0xed, 0xde, 0x22, 0x15, 0x55, 0x82, 0xaa, 0x09,
- 0x14, 0x79, 0x7b, 0x72, 0x6c, 0xd0, 0x58, 0xb6, 0xf4, 0x59, 0x32,
- 0xe0, 0xe1, 0x29, 0x51, 0x68, 0x76, 0x52, 0x7b, 0x1d, 0xd8, 0x8f,
- 0xc6, 0x6d, 0x71, 0x19, 0xf4, 0xab, 0x3b, 0xed, 0x93, 0xa6, 0x1a,
- 0x0e, 0x2d, 0x2d, 0x2a, 0xea, 0xc3, 0x36, 0xd9, 0x58})),
- std::make_pair(
- 16,
- std::vector<uint8_t>(
- {0xbf, 0xba, 0xbb, 0xef, 0x45, 0x55, 0x4c, 0xcf, 0xa0, 0xdc, 0x83,
- 0x75, 0x2a, 0x19, 0xcc, 0x35, 0xd5, 0x92, 0x09, 0x56, 0xb3, 0x01,
- 0xd5, 0x58, 0xd7, 0x72, 0x28, 0x2b, 0xc8, 0x67, 0x00, 0x91, 0x68,
- 0xe9, 0xe9, 0x86, 0x06, 0xbb, 0x5b, 0xa7, 0x3a, 0x38, 0x5d, 0xe5,
- 0x74, 0x92, 0x28, 0xc9, 0x25, 0xa8, 0x50, 0x19, 0xb7, 0x1f, 0x72,
- 0xfe, 0x29, 0xb3, 0xcd, 0x37, 0xca, 0x52, 0xef, 0xe6})),
- std::make_pair(
- 17,
- std::vector<uint8_t>(
- {0x9c, 0x4d, 0x0c, 0x3e, 0x1c, 0xdb, 0xbf, 0x48, 0x5b, 0xec, 0x86,
- 0xf4, 0x1c, 0xec, 0x7c, 0x98, 0x37, 0x3f, 0x0e, 0x09, 0xf3, 0x92,
- 0x84, 0x9a, 0xaa, 0x22, 0x9e, 0xbf, 0xbf, 0x39, 0x7b, 0x22, 0x08,
- 0x55, 0x29, 0xcb, 0x7e, 0xf3, 0x9f, 0x9c, 0x7c, 0x22, 0x22, 0xa5,
- 0x14, 0x18, 0x2b, 0x1e, 0xff, 0xaa, 0x17, 0x8c, 0xc3, 0x68, 0x7b,
- 0x1b, 0x2b, 0x6c, 0xbc, 0xb6, 0xfd, 0xeb, 0x96, 0xf8})),
- std::make_pair(
- 18,
- std::vector<uint8_t>(
- {0x47, 0x71, 0x76, 0xb3, 0xbf, 0xcb, 0xad, 0xd7, 0x65, 0x7c, 0x23,
- 0xc2, 0x46, 0x25, 0xe4, 0xd0, 0xd6, 0x74, 0xd1, 0x86, 0x8f, 0x00,
- 0x60, 0x06, 0x39, 0x8a, 0xf9, 0x7a, 0xa4, 0x18, 0x77, 0xc8, 0xe7,
- 0x0d, 0x3d, 0x14, 0xc3, 0xbb, 0xc9, 0xbb, 0xcd, 0xce, 0xa8, 0x01,
- 0xbd, 0x0e, 0x15, 0x99, 0xaf, 0x1f, 0x3e, 0xec, 0x67, 0x40, 0x51,
- 0x70, 0xf4, 0xe2, 0x6c, 0x96, 0x4a, 0x57, 0xa8, 0xb7})),
- std::make_pair(
- 19,
- std::vector<uint8_t>(
- {0xa7, 0x8c, 0x49, 0x0e, 0xda, 0x31, 0x73, 0xbb, 0x3f, 0x10, 0xde,
- 0xe5, 0x2f, 0x11, 0x0f, 0xb1, 0xc0, 0x8e, 0x03, 0x02, 0x23, 0x0b,
- 0x85, 0xdd, 0xd7, 0xc1, 0x12, 0x57, 0xd9, 0x2d, 0xe1, 0x48, 0x78,
- 0x5e, 0xf0, 0x0c, 0x03, 0x9c, 0x0b, 0xb8, 0xeb, 0x98, 0x08, 0xa3,
- 0x5b, 0x2d, 0x8c, 0x08, 0x0f, 0x57, 0x28, 0x59, 0x71, 0x4c, 0x9d,
- 0x40, 0x69, 0xc5, 0xbc, 0xaf, 0x09, 0x0e, 0x89, 0x8e})),
- std::make_pair(
- 20,
- std::vector<uint8_t>(
- {0x58, 0xd0, 0x23, 0x39, 0x7b, 0xeb, 0x5b, 0x41, 0x45, 0xcb, 0x22,
- 0x55, 0xb0, 0x7d, 0x74, 0x29, 0x0b, 0x36, 0xd9, 0xfd, 0x1e, 0x59,
- 0x4a, 0xfb, 0xd8, 0xee, 0xa4, 0x7c, 0x20, 0x5b, 0x2e, 0xfb, 0xfe,
- 0x6f, 0x46, 0x19, 0x0f, 0xaf, 0x95, 0xaf, 0x50, 0x4a, 0xb0, 0x72,
- 0xe3, 0x6f, 0x6c, 0x85, 0xd7, 0x67, 0xa3, 0x21, 0xbf, 0xd7, 0xf2,
- 0x26, 0x87, 0xa4, 0xab, 0xbf, 0x49, 0x4a, 0x68, 0x9c})),
- std::make_pair(
- 21,
- std::vector<uint8_t>(
- {0x40, 0x01, 0xec, 0x74, 0xd5, 0xa4, 0x6f, 0xd2, 0x9c, 0x2c, 0x3c,
- 0xdb, 0xe5, 0xd1, 0xb9, 0xf2, 0x0e, 0x51, 0xa9, 0x41, 0xbe, 0x98,
- 0xd2, 0xa4, 0xe1, 0xe2, 0xfb, 0xf8, 0x66, 0xa6, 0x72, 0x12, 0x1d,
- 0xb6, 0xf8, 0x1a, 0x51, 0x4c, 0xfd, 0x10, 0xe7, 0x35, 0x8d, 0x57,
- 0x1b, 0xdb, 0xa4, 0x8e, 0x4c, 0xe7, 0x08, 0xb9, 0xd1, 0x24, 0x89,
- 0x4b, 0xc0, 0xb5, 0xed, 0x55, 0x49, 0x35, 0xf7, 0x3a})),
- std::make_pair(
- 22,
- std::vector<uint8_t>(
- {0xcc, 0xd1, 0xb2, 0x2d, 0xab, 0x65, 0x11, 0x22, 0x5d, 0x24, 0x01,
- 0xea, 0x2d, 0x86, 0x25, 0xd2, 0x06, 0xa1, 0x24, 0x73, 0xcc, 0x73,
- 0x2b, 0x61, 0x5e, 0x56, 0x40, 0xce, 0xff, 0xf0, 0xa4, 0xad, 0xf9,
- 0x71, 0xb0, 0xe8, 0x27, 0xa6, 0x19, 0xe0, 0xa8, 0x0f, 0x5d, 0xb9,
- 0xcc, 0xd0, 0x96, 0x23, 0x29, 0x01, 0x0d, 0x07, 0xe3, 0x4a, 0x20,
- 0x64, 0xe7, 0x31, 0xc5, 0x20, 0x81, 0x7b, 0x21, 0x83})),
- std::make_pair(
- 23,
- std::vector<uint8_t>(
- {0xb4, 0xa0, 0xa9, 0xe3, 0x57, 0x4e, 0xdb, 0x9e, 0x1e, 0x72, 0xaa,
- 0x31, 0xe3, 0x9c, 0xc5, 0xf3, 0x0d, 0xbf, 0x94, 0x3f, 0x8c, 0xab,
- 0xc4, 0x08, 0x44, 0x96, 0x54, 0xa3, 0x91, 0x31, 0xe6, 0x6d, 0x71,
- 0x8a, 0x18, 0x81, 0x91, 0x43, 0xe3, 0xea, 0x96, 0xb4, 0xa1, 0x89,
- 0x59, 0x88, 0xa1, 0xc0, 0x05, 0x6c, 0xf2, 0xb6, 0xe0, 0x4f, 0x9a,
- 0xc1, 0x9d, 0x65, 0x73, 0x83, 0xc2, 0x91, 0x0c, 0x44})),
- std::make_pair(
- 24,
- std::vector<uint8_t>(
- {0x44, 0x7b, 0xec, 0xab, 0x16, 0x63, 0x06, 0x08, 0xd3, 0x9f, 0x4f,
- 0x05, 0x8b, 0x16, 0xf7, 0xaf, 0x95, 0xb8, 0x5a, 0x76, 0xaa, 0x0f,
- 0xa7, 0xce, 0xa2, 0xb8, 0x07, 0x55, 0xfb, 0x76, 0xe9, 0xc8, 0x04,
- 0xf2, 0xca, 0x78, 0xf0, 0x26, 0x43, 0xc9, 0x15, 0xfb, 0xf2, 0xfc,
- 0xe5, 0xe1, 0x9d, 0xe8, 0x60, 0x00, 0xde, 0x03, 0xb1, 0x88, 0x61,
- 0x81, 0x5a, 0x83, 0x12, 0x60, 0x71, 0xf8, 0xa3, 0x7b})),
- std::make_pair(
- 25,
- std::vector<uint8_t>(
- {0x54, 0xe6, 0xda, 0xb9, 0x97, 0x73, 0x80, 0xa5, 0x66, 0x58, 0x22,
- 0xdb, 0x93, 0x37, 0x4e, 0xda, 0x52, 0x8d, 0x9b, 0xeb, 0x62, 0x6f,
- 0x9b, 0x94, 0x02, 0x70, 0x71, 0xcb, 0x26, 0x67, 0x5e, 0x11, 0x2b,
- 0x4a, 0x7f, 0xec, 0x94, 0x1e, 0xe6, 0x0a, 0x81, 0xe4, 0xd2, 0xea,
- 0x3f, 0xf7, 0xbc, 0x52, 0xcf, 0xc4, 0x5d, 0xfb, 0xfe, 0x73, 0x5a,
- 0x1c, 0x64, 0x6b, 0x2c, 0xf6, 0xd6, 0xa4, 0x9b, 0x62})),
- std::make_pair(
- 26,
- std::vector<uint8_t>(
- {0x3e, 0xa6, 0x26, 0x25, 0x94, 0x9e, 0x36, 0x46, 0x70, 0x4d, 0x7e,
- 0x3c, 0x90, 0x6f, 0x82, 0xf6, 0xc0, 0x28, 0xf5, 0x40, 0xf5, 0xf7,
- 0x2a, 0x79, 0x4b, 0x0c, 0x57, 0xbf, 0x97, 0xb7, 0x64, 0x9b, 0xfe,
- 0xb9, 0x0b, 0x01, 0xd3, 0xca, 0x3e, 0x82, 0x9d, 0xe2, 0x1b, 0x38,
- 0x26, 0xe6, 0xf8, 0x70, 0x14, 0xd3, 0xc7, 0x73, 0x50, 0xcb, 0x5a,
- 0x15, 0xff, 0x5d, 0x46, 0x8a, 0x81, 0xbe, 0xc1, 0x60})),
- std::make_pair(
- 27,
- std::vector<uint8_t>(
- {0x21, 0x3c, 0xfe, 0x14, 0x5c, 0x54, 0xa3, 0x36, 0x91, 0x56, 0x99,
- 0x80, 0xe5, 0x93, 0x8c, 0x88, 0x83, 0xa4, 0x6d, 0x84, 0xd1, 0x49,
- 0xc8, 0xff, 0x1a, 0x67, 0xcd, 0x28, 0x7b, 0x4d, 0x49, 0xc6, 0xda,
- 0x69, 0xd3, 0xa0, 0x35, 0x44, 0x3d, 0xb0, 0x85, 0x98, 0x3d, 0x0e,
- 0xfe, 0x63, 0x70, 0x6b, 0xd5, 0xb6, 0xf1, 0x5a, 0x7d, 0xa4, 0x59,
- 0xe8, 0xd5, 0x0a, 0x19, 0x09, 0x3d, 0xb5, 0x5e, 0x80})),
- std::make_pair(
- 28,
- std::vector<uint8_t>(
- {0x57, 0x16, 0xc4, 0xa3, 0x8f, 0x38, 0xdb, 0x10, 0x4e, 0x49, 0x4a,
- 0x0a, 0x27, 0xcb, 0xe8, 0x9a, 0x26, 0xa6, 0xbb, 0x6f, 0x49, 0x9e,
- 0xc0, 0x1c, 0x8c, 0x01, 0xaa, 0x7c, 0xb8, 0x84, 0x97, 0xe7, 0x51,
- 0x48, 0xcd, 0x6e, 0xee, 0x12, 0xa7, 0x16, 0x8b, 0x6f, 0x78, 0xab,
- 0x74, 0xe4, 0xbe, 0x74, 0x92, 0x51, 0xa1, 0xa7, 0x4c, 0x38, 0xc8,
- 0x6d, 0x61, 0x29, 0x17, 0x7e, 0x28, 0x89, 0xe0, 0xb6})),
- std::make_pair(
- 29,
- std::vector<uint8_t>(
- {0x03, 0x04, 0x60, 0xa9, 0x8b, 0xdf, 0x9f, 0xf1, 0x7c, 0xd9, 0x64,
- 0x04, 0xf2, 0x8f, 0xc3, 0x04, 0xf2, 0xb7, 0xc0, 0x4e, 0xaa, 0xde,
- 0x53, 0x67, 0x7f, 0xd2, 0x8f, 0x78, 0x8c, 0xa2, 0x21, 0x86, 0xb8,
- 0xbc, 0x80, 0xdd, 0x21, 0xd1, 0x7f, 0x85, 0x49, 0xc7, 0x11, 0xaf,
- 0xf0, 0xe5, 0x14, 0xe1, 0x9d, 0x4e, 0x15, 0xf5, 0x99, 0x02, 0x52,
- 0xa0, 0x3e, 0x08, 0x2f, 0x28, 0xdc, 0x20, 0x52, 0xf6})),
- std::make_pair(
- 30,
- std::vector<uint8_t>(
- {0x19, 0xe7, 0xf1, 0xcc, 0xee, 0x88, 0xa1, 0x06, 0x72, 0x33, 0x3e,
- 0x39, 0x0c, 0xf2, 0x20, 0x13, 0xa8, 0xc7, 0x34, 0xc6, 0xcb, 0x9e,
- 0xab, 0x41, 0xf1, 0x7c, 0x3c, 0x80, 0x32, 0xa2, 0xe4, 0xac, 0xa0,
- 0x56, 0x9e, 0xa3, 0x6f, 0x08, 0x60, 0xc7, 0xa1, 0xaf, 0x28, 0xfa,
- 0x47, 0x68, 0x40, 0xd6, 0x60, 0x11, 0x16, 0x88, 0x59, 0x33, 0x4a,
- 0x9e, 0x4e, 0xf9, 0xcc, 0x2e, 0x61, 0xa0, 0xe2, 0x9e})),
- std::make_pair(
- 31,
- std::vector<uint8_t>(
- {0x29, 0xf8, 0xb8, 0xc7, 0x8c, 0x80, 0xf2, 0xfc, 0xb4, 0xbd, 0xf7,
- 0x82, 0x5e, 0xd9, 0x0a, 0x70, 0xd6, 0x25, 0xff, 0x78, 0x5d, 0x26,
- 0x26, 0x77, 0xe2, 0x50, 0xc0, 0x4f, 0x37, 0x20, 0xc8, 0x88, 0xd0,
- 0x3f, 0x80, 0x45, 0xe4, 0xed, 0xf3, 0xf5, 0x28, 0x5b, 0xd3, 0x9d,
- 0x92, 0x8a, 0x10, 0xa7, 0xd0, 0xa5, 0xdf, 0x00, 0xb8, 0x48, 0x4a,
- 0xc2, 0x86, 0x81, 0x42, 0xa1, 0xe8, 0xbe, 0xa3, 0x51})),
- std::make_pair(
- 32,
- std::vector<uint8_t>(
- {0x5c, 0x52, 0x92, 0x0a, 0x72, 0x63, 0xe3, 0x9d, 0x57, 0x92, 0x0c,
- 0xa0, 0xcb, 0x75, 0x2a, 0xc6, 0xd7, 0x9a, 0x04, 0xfe, 0xf8, 0xa7,
- 0xa2, 0x16, 0xa1, 0xec, 0xb7, 0x11, 0x5c, 0xe0, 0x6d, 0x89, 0xfd,
- 0x7d, 0x73, 0x5b, 0xd6, 0xf4, 0x27, 0x25, 0x55, 0xdb, 0xa2, 0x2c,
- 0x2d, 0x1c, 0x96, 0xe6, 0x35, 0x23, 0x22, 0xc6, 0x2c, 0x56, 0x30,
- 0xfd, 0xe0, 0xf4, 0x77, 0x7a, 0x76, 0xc3, 0xde, 0x2c})),
- std::make_pair(
- 33,
- std::vector<uint8_t>(
- {0x83, 0xb0, 0x98, 0xf2, 0x62, 0x25, 0x1b, 0xf6, 0x60, 0x06, 0x4a,
- 0x9d, 0x35, 0x11, 0xce, 0x76, 0x87, 0xa0, 0x9e, 0x6d, 0xfb, 0xb8,
- 0x78, 0x29, 0x9c, 0x30, 0xe9, 0x3d, 0xfb, 0x43, 0xa9, 0x31, 0x4d,
- 0xb9, 0xa6, 0x00, 0x33, 0x7d, 0xb2, 0x6e, 0xbe, 0xed, 0xaf, 0x22,
- 0x56, 0xa9, 0x6d, 0xab, 0xe9, 0xb2, 0x9e, 0x75, 0x73, 0xad, 0x11,
- 0xc3, 0x52, 0x3d, 0x87, 0x4d, 0xde, 0x5b, 0xe7, 0xed})),
- std::make_pair(
- 34,
- std::vector<uint8_t>(
- {0x94, 0x47, 0xd9, 0x8a, 0xa5, 0xc9, 0x33, 0x13, 0x52, 0xf4, 0x3d,
- 0x3e, 0x56, 0xd0, 0xa9, 0xa9, 0xf9, 0x58, 0x18, 0x65, 0x99, 0x8e,
- 0x28, 0x85, 0xcc, 0x56, 0xdd, 0x0a, 0x0b, 0xd5, 0xa7, 0xb5, 0x05,
- 0x95, 0xbd, 0x10, 0xf7, 0x52, 0x9b, 0xcd, 0x31, 0xf3, 0x7d, 0xc1,
- 0x6a, 0x14, 0x65, 0xd5, 0x94, 0x07, 0x96, 0x67, 0xda, 0x2a, 0x3f,
- 0xcb, 0x70, 0x40, 0x14, 0x98, 0x83, 0x7c, 0xed, 0xeb})),
- std::make_pair(
- 35,
- std::vector<uint8_t>(
- {0x86, 0x77, 0x32, 0xf2, 0xfe, 0xeb, 0x23, 0x89, 0x30, 0x97, 0x56,
- 0x1a, 0xc7, 0x10, 0xa4, 0xbf, 0xf4, 0x53, 0xbe, 0x9c, 0xfb, 0xed,
- 0xba, 0x8b, 0xa3, 0x24, 0xf9, 0xd3, 0x12, 0xa8, 0x2d, 0x73, 0x2e,
- 0x1b, 0x83, 0xb8, 0x29, 0xfd, 0xcd, 0x17, 0x7b, 0x88, 0x2c, 0xa0,
- 0xc1, 0xbf, 0x54, 0x4b, 0x22, 0x3b, 0xe5, 0x29, 0x92, 0x4a, 0x24,
- 0x6a, 0x63, 0xcf, 0x05, 0x9b, 0xfd, 0xc5, 0x0a, 0x1b})),
- std::make_pair(
- 36,
- std::vector<uint8_t>(
- {0xf1, 0x5a, 0xb2, 0x6d, 0x4c, 0xdf, 0xcf, 0x56, 0xe1, 0x96, 0xbb,
- 0x6b, 0xa1, 0x70, 0xa8, 0xfc, 0xcc, 0x41, 0x4d, 0xe9, 0x28, 0x5a,
- 0xfd, 0x98, 0xa3, 0xd3, 0xcf, 0x2f, 0xb8, 0x8f, 0xcb, 0xc0, 0xf1,
- 0x98, 0x32, 0xac, 0x43, 0x3a, 0x5b, 0x2c, 0xc2, 0x39, 0x2a, 0x4c,
- 0xe3, 0x43, 0x32, 0x98, 0x7d, 0x8d, 0x2c, 0x2b, 0xef, 0x6c, 0x34,
- 0x66, 0x13, 0x8d, 0xb0, 0xc6, 0xe4, 0x2f, 0xa4, 0x7b})),
- std::make_pair(
- 37,
- std::vector<uint8_t>(
- {0x28, 0x13, 0x51, 0x6d, 0x68, 0xed, 0x4a, 0x08, 0xb3, 0x9d, 0x64,
- 0x8a, 0xa6, 0xaa, 0xcd, 0x81, 0xe9, 0xd6, 0x55, 0xec, 0xd5, 0xf0,
- 0xc1, 0x35, 0x56, 0xc6, 0x0f, 0xdf, 0x0d, 0x33, 0x3e, 0xa3, 0x84,
- 0x64, 0xb3, 0x6c, 0x02, 0xba, 0xcc, 0xd7, 0x46, 0xe9, 0x57, 0x5e,
- 0x96, 0xc6, 0x30, 0x14, 0xf0, 0x74, 0xae, 0x34, 0xa0, 0xa2, 0x5b,
- 0x32, 0x0f, 0x0f, 0xbe, 0xdd, 0x6a, 0xcf, 0x76, 0x65})),
- std::make_pair(
- 38,
- std::vector<uint8_t>(
- {0xd3, 0x25, 0x9a, 0xfc, 0xa8, 0xa4, 0x89, 0x62, 0xfa, 0x89, 0x2e,
- 0x14, 0x5a, 0xcf, 0x54, 0x7f, 0x26, 0x92, 0x3a, 0xe8, 0xd4, 0x92,
- 0x4c, 0x8a, 0x53, 0x15, 0x81, 0x52, 0x6b, 0x04, 0xb4, 0x4c, 0x7a,
- 0xf8, 0x3c, 0x64, 0x3e, 0xf5, 0xa0, 0xbc, 0x28, 0x2d, 0x36, 0xf3,
- 0xfb, 0x04, 0xc8, 0x4e, 0x28, 0xb3, 0x51, 0xf4, 0x0c, 0x74, 0xb6,
- 0x9d, 0xc7, 0x84, 0x0b, 0xc7, 0x17, 0xb6, 0xf1, 0x5f})),
- std::make_pair(
- 39,
- std::vector<uint8_t>(
- {0xf1, 0x4b, 0x06, 0x1a, 0xe3, 0x59, 0xfa, 0x31, 0xb9, 0x89, 0xe3,
- 0x03, 0x32, 0xbf, 0xe8, 0xde, 0x8c, 0xc8, 0xcd, 0xb5, 0x68, 0xe1,
- 0x4b, 0xe2, 0x14, 0xa2, 0x22, 0x3b, 0x84, 0xca, 0xab, 0x74, 0x19,
- 0x54, 0x9e, 0xcf, 0xcc, 0x96, 0xce, 0x2a, 0xce, 0xc1, 0x19, 0x48,
- 0x5d, 0x87, 0xd1, 0x57, 0xd3, 0xa8, 0x73, 0x4f, 0xc4, 0x26, 0x59,
- 0x7d, 0x64, 0xf3, 0x65, 0x70, 0xce, 0xaf, 0x22, 0x4d})),
- std::make_pair(
- 40,
- std::vector<uint8_t>(
- {0x55, 0xe7, 0x0b, 0x01, 0xd1, 0xfb, 0xf8, 0xb2, 0x3b, 0x57, 0xfb,
- 0x62, 0xe2, 0x6c, 0x2c, 0xe5, 0x4f, 0x13, 0xf8, 0xfa, 0x24, 0x64,
- 0xe6, 0xeb, 0x98, 0xd1, 0x6a, 0x61, 0x17, 0x02, 0x6d, 0x8b, 0x90,
- 0x81, 0x90, 0x12, 0x49, 0x6d, 0x40, 0x71, 0xeb, 0xe2, 0xe5, 0x95,
- 0x57, 0xec, 0xe3, 0x51, 0x9a, 0x7a, 0xa4, 0x58, 0x02, 0xf9, 0x61,
- 0x53, 0x74, 0x87, 0x73, 0x32, 0xb7, 0x34, 0x90, 0xb3})),
- std::make_pair(
- 41,
- std::vector<uint8_t>(
- {0x25, 0x26, 0x1e, 0xb2, 0x96, 0x97, 0x1d, 0x6e, 0x4a, 0x71, 0xb2,
- 0x92, 0x8e, 0x64, 0x83, 0x9c, 0x67, 0xd4, 0x22, 0x87, 0x2b, 0xf9,
- 0xf3, 0xc3, 0x19, 0x93, 0x61, 0x52, 0x22, 0xde, 0x9f, 0x8f, 0x0b,
- 0x2c, 0x4b, 0xe8, 0x54, 0x85, 0x59, 0xb4, 0xb3, 0x54, 0xe7, 0x36,
- 0x41, 0x6e, 0x32, 0x18, 0xd4, 0xe8, 0xa1, 0xe2, 0x19, 0xa4, 0xa6,
- 0xd4, 0x3e, 0x1a, 0x9a, 0x52, 0x1d, 0x0e, 0x75, 0xfc})),
- std::make_pair(
- 42,
- std::vector<uint8_t>(
- {0x08, 0x30, 0x7f, 0x34, 0x7c, 0x41, 0x29, 0x4e, 0x34, 0xbb, 0x54,
- 0xcb, 0x42, 0xb1, 0x52, 0x2d, 0x22, 0xf8, 0x24, 0xf7, 0xb6, 0xe5,
- 0xdb, 0x50, 0xfd, 0xa0, 0x96, 0x79, 0x8e, 0x18, 0x1a, 0x8f, 0x02,
- 0x6f, 0xa2, 0x7b, 0x4a, 0xe4, 0x5d, 0x52, 0xa6, 0x2c, 0xaf, 0x9d,
- 0x51, 0x98, 0xe2, 0x4a, 0x49, 0x13, 0xc6, 0x67, 0x17, 0x75, 0xb2,
- 0xd7, 0x23, 0xc1, 0x23, 0x9b, 0xfb, 0xf0, 0x16, 0xd7})),
- std::make_pair(
- 43,
- std::vector<uint8_t>(
- {0x1e, 0x5c, 0x62, 0xe7, 0xe9, 0xbf, 0xa1, 0xb1, 0x18, 0x74, 0x7a,
- 0x2d, 0xe0, 0x8b, 0x3c, 0xa1, 0x01, 0x12, 0xaf, 0x96, 0xa4, 0x6e,
- 0x4b, 0x22, 0xc3, 0xfc, 0x06, 0xf9, 0xbf, 0xee, 0x4e, 0xb5, 0xc4,
- 0x9e, 0x05, 0x7a, 0x4a, 0x48, 0x86, 0x23, 0x43, 0x24, 0x57, 0x25,
- 0x76, 0xbb, 0x9b, 0x5e, 0xcf, 0xde, 0x0d, 0x99, 0xb0, 0xde, 0x4f,
- 0x98, 0xec, 0x16, 0xe4, 0xd1, 0xb8, 0x5f, 0xa9, 0x47})),
- std::make_pair(
- 44,
- std::vector<uint8_t>(
- {0xc7, 0x4a, 0x77, 0x39, 0x5f, 0xb8, 0xbc, 0x12, 0x64, 0x47, 0x45,
- 0x48, 0x38, 0xe5, 0x61, 0xe9, 0x62, 0x85, 0x3d, 0xc7, 0xeb, 0x49,
- 0xa1, 0xe3, 0xcb, 0x67, 0xc3, 0xd0, 0x85, 0x1f, 0x3e, 0x39, 0x51,
- 0x7b, 0xe8, 0xc3, 0x50, 0xac, 0x91, 0x09, 0x03, 0xd4, 0x9c, 0xd2,
- 0xbf, 0xdf, 0x54, 0x5c, 0x99, 0x31, 0x6d, 0x03, 0x46, 0x17, 0x0b,
- 0x73, 0x9f, 0x0a, 0xdd, 0x5d, 0x53, 0x3c, 0x2c, 0xfc})),
- std::make_pair(
- 45,
- std::vector<uint8_t>(
- {0x0d, 0xd5, 0x7b, 0x42, 0x3c, 0xc0, 0x1e, 0xb2, 0x86, 0x13, 0x91,
- 0xeb, 0x88, 0x6a, 0x0d, 0x17, 0x07, 0x9b, 0x93, 0x3f, 0xc7, 0x6e,
- 0xb3, 0xfc, 0x08, 0xa1, 0x9f, 0x8a, 0x74, 0x95, 0x2c, 0xb6, 0x8f,
- 0x6b, 0xcd, 0xc6, 0x44, 0xf7, 0x73, 0x70, 0x96, 0x6e, 0x4d, 0x13,
- 0xe8, 0x05, 0x60, 0xbc, 0xf0, 0x82, 0xef, 0x04, 0x79, 0xd4, 0x8f,
- 0xbb, 0xab, 0x4d, 0xf0, 0x3b, 0x53, 0xa4, 0xe1, 0x78})),
- std::make_pair(
- 46,
- std::vector<uint8_t>(
- {0x4d, 0x8d, 0xc3, 0x92, 0x3e, 0xdc, 0xcd, 0xfc, 0xe7, 0x00, 0x72,
- 0x39, 0x8b, 0x8a, 0x3d, 0xa5, 0xc3, 0x1f, 0xcb, 0x3e, 0xe3, 0xb6,
- 0x45, 0xc8, 0x5f, 0x71, 0x7c, 0xba, 0xeb, 0x4b, 0x67, 0x3a, 0x19,
- 0x39, 0x44, 0x25, 0xa5, 0x85, 0xbf, 0xb4, 0x64, 0xd9, 0x2f, 0x15,
- 0x97, 0xd0, 0xb7, 0x54, 0xd1, 0x63, 0xf9, 0x7c, 0xed, 0x34, 0x3b,
- 0x25, 0xdb, 0x5a, 0x70, 0xef, 0x48, 0xeb, 0xb3, 0x4f})),
- std::make_pair(
- 47,
- std::vector<uint8_t>(
- {0xf0, 0xa5, 0x05, 0x53, 0xe4, 0xdf, 0xb0, 0xc4, 0xe3, 0xe3, 0xd3,
- 0xba, 0x82, 0x03, 0x48, 0x57, 0xe3, 0xb1, 0xe5, 0x09, 0x18, 0xf5,
- 0xb8, 0xa7, 0xd6, 0x98, 0xe1, 0x0d, 0x24, 0x2b, 0x0f, 0xb5, 0x44,
- 0xaf, 0x6c, 0x92, 0xd0, 0xc3, 0xaa, 0xf9, 0x93, 0x22, 0x20, 0x41,
- 0x61, 0x17, 0xb4, 0xe7, 0x8e, 0xcb, 0x8a, 0x8f, 0x43, 0x0e, 0x13,
- 0xb8, 0x2a, 0x59, 0x15, 0x29, 0x0a, 0x58, 0x19, 0xc5})),
- std::make_pair(
- 48,
- std::vector<uint8_t>(
- {0xb1, 0x55, 0x43, 0xf3, 0xf7, 0x36, 0x08, 0x66, 0x27, 0xcc, 0x53,
- 0x65, 0xe7, 0xe8, 0x98, 0x8c, 0x2e, 0xf1, 0x55, 0xc0, 0xfd, 0x4f,
- 0x42, 0x89, 0x61, 0xb0, 0x0d, 0x15, 0x26, 0xf0, 0x4d, 0x6d, 0x6a,
- 0x65, 0x8b, 0x4b, 0x8e, 0xd3, 0x2c, 0x5d, 0x86, 0x21, 0xe7, 0xf4,
- 0xf8, 0xe8, 0xa9, 0x33, 0xd9, 0xec, 0xc9, 0xdd, 0x1b, 0x83, 0x33,
- 0xcb, 0xe2, 0x8c, 0xfc, 0x37, 0xd9, 0x71, 0x9e, 0x1c})),
- std::make_pair(
- 49,
- std::vector<uint8_t>(
- {0x7b, 0x4f, 0xa1, 0x58, 0xe4, 0x15, 0xfe, 0xf0, 0x23, 0x24, 0x72,
- 0x64, 0xcb, 0xbe, 0x15, 0xd1, 0x6d, 0x91, 0xa4, 0x44, 0x24, 0xa8,
- 0xdb, 0x70, 0x7e, 0xb1, 0xe2, 0x03, 0x3c, 0x30, 0xe9, 0xe1, 0xe7,
- 0xc8, 0xc0, 0x86, 0x45, 0x95, 0xd2, 0xcb, 0x8c, 0x58, 0x0e, 0xb4,
- 0x7e, 0x9d, 0x16, 0xab, 0xbd, 0x7e, 0x44, 0xe8, 0x24, 0xf7, 0xce,
- 0xdb, 0x7d, 0xef, 0x57, 0x13, 0x0e, 0x52, 0xcf, 0xe9})),
- std::make_pair(
- 50,
- std::vector<uint8_t>(
- {0x60, 0x42, 0x4f, 0xf2, 0x32, 0x34, 0xc3, 0x4d, 0xc9, 0x68, 0x7a,
- 0xd5, 0x02, 0x86, 0x93, 0x72, 0xcc, 0x31, 0xa5, 0x93, 0x80, 0x18,
- 0x6b, 0xc2, 0x36, 0x1c, 0x83, 0x5d, 0x97, 0x2f, 0x49, 0x66, 0x6e,
- 0xb1, 0xac, 0x69, 0x62, 0x9d, 0xe6, 0x46, 0xf0, 0x3f, 0x9b, 0x4d,
- 0xb9, 0xe2, 0xac, 0xe0, 0x93, 0xfb, 0xfd, 0xf8, 0xf2, 0x0a, 0xb5,
- 0xf9, 0x85, 0x41, 0x97, 0x8b, 0xe8, 0xef, 0x54, 0x9f})),
- std::make_pair(
- 51,
- std::vector<uint8_t>(
- {0x74, 0x06, 0x01, 0x8c, 0xe7, 0x04, 0xd8, 0x4f, 0x5e, 0xb9, 0xc7,
- 0x9f, 0xea, 0x97, 0xda, 0x34, 0x56, 0x99, 0x46, 0x8a, 0x35, 0x0e,
- 0xe0, 0xb2, 0xd0, 0xf3, 0xa4, 0xbf, 0x20, 0x70, 0x30, 0x4e, 0xa8,
- 0x62, 0xd7, 0x2a, 0x51, 0xc5, 0x7d, 0x30, 0x64, 0x94, 0x72, 0x86,
- 0xf5, 0x31, 0xe0, 0xea, 0xf7, 0x56, 0x37, 0x02, 0x26, 0x2e, 0x6c,
- 0x72, 0x4a, 0xbf, 0x5e, 0xd8, 0xc8, 0x39, 0x8d, 0x17})),
- std::make_pair(
- 52,
- std::vector<uint8_t>(
- {0x14, 0xef, 0x5c, 0x6d, 0x64, 0x7b, 0x3b, 0xd1, 0xe6, 0xe3, 0x20,
- 0x06, 0xc2, 0x31, 0x19, 0x98, 0x10, 0xde, 0x5c, 0x4d, 0xc8, 0x8e,
- 0x70, 0x24, 0x02, 0x73, 0xb0, 0xea, 0x18, 0xe6, 0x51, 0xa3, 0xeb,
- 0x4f, 0x5c, 0xa3, 0x11, 0x4b, 0x8a, 0x56, 0x71, 0x69, 0x69, 0xc7,
- 0xcd, 0xa2, 0x7e, 0x0c, 0x8d, 0xb8, 0x32, 0xad, 0x5e, 0x89, 0xa2,
- 0xdc, 0x6c, 0xb0, 0xad, 0xbe, 0x7d, 0x93, 0xab, 0xd1})),
- std::make_pair(
- 53,
- std::vector<uint8_t>(
- {0x38, 0xcf, 0x6c, 0x24, 0xe3, 0xe0, 0x8b, 0xcf, 0x1f, 0x6c, 0xf3,
- 0xd1, 0xb1, 0xf6, 0x5b, 0x90, 0x52, 0x39, 0xa3, 0x11, 0x80, 0x33,
- 0x24, 0x9e, 0x44, 0x81, 0x13, 0xec, 0x63, 0x2e, 0xa6, 0xdc, 0x34,
- 0x6f, 0xee, 0xb2, 0x57, 0x1c, 0x38, 0xbd, 0x9a, 0x73, 0x98, 0xb2,
- 0x22, 0x12, 0x80, 0x32, 0x80, 0x02, 0xb2, 0x3e, 0x1a, 0x45, 0xad,
- 0xaf, 0xfe, 0x66, 0xd9, 0x3f, 0x65, 0x64, 0xea, 0xa2})),
- std::make_pair(
- 54,
- std::vector<uint8_t>(
- {0x6c, 0xd7, 0x20, 0x8a, 0x4b, 0xc7, 0xe7, 0xe5, 0x62, 0x01, 0xbb,
- 0xba, 0x02, 0xa0, 0xf4, 0x89, 0xcd, 0x38, 0x4a, 0xbe, 0x40, 0xaf,
- 0xd4, 0x22, 0x2f, 0x15, 0x8b, 0x3d, 0x98, 0x6e, 0xe7, 0x2a, 0x54,
- 0xc5, 0x0f, 0xb6, 0x4f, 0xd4, 0xed, 0x25, 0x30, 0xed, 0xa2, 0xc8,
- 0xaf, 0x29, 0x28, 0xa0, 0xda, 0x6d, 0x4f, 0x83, 0x0a, 0xe1, 0xc9,
- 0xdb, 0x46, 0x9d, 0xfd, 0x97, 0x0f, 0x12, 0xa5, 0x6f})),
- std::make_pair(
- 55,
- std::vector<uint8_t>(
- {0x65, 0x98, 0x58, 0xf0, 0xb5, 0xc9, 0xed, 0xab, 0x5b, 0x94, 0xfd,
- 0x73, 0x2f, 0x6e, 0x6b, 0x17, 0xc5, 0x1c, 0xc0, 0x96, 0x10, 0x4f,
- 0x09, 0xbe, 0xb3, 0xaf, 0xc3, 0xaa, 0x46, 0x7c, 0x2e, 0xcf, 0x88,
- 0x5c, 0x4c, 0x65, 0x41, 0xef, 0xfa, 0x90, 0x23, 0xd3, 0xb5, 0x73,
- 0x8a, 0xe5, 0xa1, 0x4d, 0x86, 0x7e, 0x15, 0xdb, 0x06, 0xfe, 0x1f,
- 0x9d, 0x11, 0x27, 0xb7, 0x7e, 0x1a, 0xab, 0xb5, 0x16})),
- std::make_pair(
- 56,
- std::vector<uint8_t>(
- {0x26, 0xcc, 0xa0, 0x12, 0x6f, 0x5d, 0x1a, 0x81, 0x3c, 0x62, 0xe5,
- 0xc7, 0x10, 0x01, 0xc0, 0x46, 0xf9, 0xc9, 0x20, 0x95, 0x70, 0x45,
- 0x50, 0xbe, 0x58, 0x73, 0xa4, 0x95, 0xa9, 0x99, 0xad, 0x01, 0x0a,
- 0x4f, 0x79, 0x49, 0x1f, 0x24, 0xf2, 0x86, 0x50, 0x0a, 0xdc, 0xe1,
- 0xa1, 0x37, 0xbc, 0x20, 0x84, 0xe4, 0x94, 0x9f, 0x5b, 0x72, 0x94,
- 0xce, 0xfe, 0x51, 0xec, 0xaf, 0xf8, 0xe9, 0x5c, 0xba})),
- std::make_pair(
- 57,
- std::vector<uint8_t>(
- {0x41, 0x47, 0xc1, 0xf5, 0x51, 0x72, 0x78, 0x8c, 0x55, 0x67, 0xc5,
- 0x61, 0xfe, 0xef, 0x87, 0x6f, 0x62, 0x1f, 0xff, 0x1c, 0xe8, 0x77,
- 0x86, 0xb8, 0x46, 0x76, 0x37, 0xe7, 0x0d, 0xfb, 0xcd, 0x0d, 0xbd,
- 0xb6, 0x41, 0x5c, 0xb6, 0x00, 0x95, 0x4a, 0xb9, 0xc0, 0x4c, 0x0e,
- 0x45, 0x7e, 0x62, 0x5b, 0x40, 0x72, 0x22, 0xc0, 0xfe, 0x1a, 0xe2,
- 0x1b, 0x21, 0x43, 0x68, 0x8a, 0xda, 0x94, 0xdc, 0x58})),
- std::make_pair(
- 58,
- std::vector<uint8_t>(
- {0x5b, 0x1b, 0xf1, 0x54, 0xc6, 0x2a, 0x8a, 0xf6, 0xe9, 0x3d, 0x35,
- 0xf1, 0x8f, 0x7f, 0x90, 0xab, 0xb1, 0x6a, 0x6e, 0xf0, 0xe8, 0xd1,
- 0xae, 0xcd, 0x11, 0x8b, 0xf7, 0x01, 0x67, 0xba, 0xb2, 0xaf, 0x08,
- 0x93, 0x5c, 0x6f, 0xdc, 0x06, 0x63, 0xce, 0x74, 0x48, 0x2d, 0x17,
- 0xa8, 0xe5, 0x4b, 0x54, 0x6d, 0x1c, 0x29, 0x66, 0x31, 0xc6, 0x5f,
- 0x3b, 0x52, 0x2a, 0x51, 0x58, 0x39, 0xd4, 0x3d, 0x71})),
- std::make_pair(
- 59,
- std::vector<uint8_t>(
- {0x9f, 0x60, 0x04, 0x19, 0xa4, 0xe8, 0xf4, 0xfb, 0x83, 0x4c, 0x24,
- 0xb0, 0xf7, 0xfc, 0x13, 0xbf, 0x4e, 0x27, 0x9d, 0x98, 0xe8, 0xa3,
- 0xc7, 0x65, 0xee, 0x93, 0x49, 0x17, 0x40, 0x3e, 0x3a, 0x66, 0x09,
- 0x71, 0x82, 0xea, 0x21, 0x45, 0x3c, 0xb6, 0x3e, 0xbb, 0xe8, 0xb7,
- 0x3a, 0x9c, 0x21, 0x67, 0x59, 0x64, 0x46, 0x43, 0x8c, 0x57, 0x62,
- 0x7f, 0x33, 0x0b, 0xad, 0xd4, 0xf5, 0x69, 0xf7, 0xd6})),
- std::make_pair(
- 60,
- std::vector<uint8_t>(
- {0x45, 0x7e, 0xf6, 0x46, 0x6a, 0x89, 0x24, 0xfd, 0x80, 0x11, 0xa3,
- 0x44, 0x71, 0xa5, 0xa1, 0xac, 0x8c, 0xcd, 0x9b, 0xd0, 0xd0, 0x7a,
- 0x97, 0x41, 0x4a, 0xc9, 0x43, 0x02, 0x1c, 0xe4, 0xb9, 0xe4, 0xb9,
- 0xc8, 0xdb, 0x0a, 0x28, 0xf0, 0x16, 0xed, 0x43, 0xb1, 0x54, 0x24,
- 0x81, 0x99, 0x00, 0x22, 0x14, 0x7b, 0x31, 0x3e, 0x19, 0x46, 0x71,
- 0x13, 0x1e, 0x70, 0x8d, 0xd4, 0x3a, 0x3e, 0xd7, 0xdc})),
- std::make_pair(
- 61,
- std::vector<uint8_t>(
- {0x99, 0x97, 0xb2, 0x19, 0x4d, 0x9a, 0xf6, 0xdf, 0xcb, 0x91, 0x43,
- 0xf4, 0x1c, 0x0e, 0xd8, 0x3d, 0x3a, 0x3f, 0x43, 0x88, 0x36, 0x11,
- 0x03, 0xd3, 0x8c, 0x2a, 0x49, 0xb2, 0x80, 0xa5, 0x81, 0x21, 0x27,
- 0x15, 0xfd, 0x90, 0x8d, 0x41, 0xc6, 0x51, 0xf5, 0xc7, 0x15, 0xca,
- 0x38, 0xc0, 0xce, 0x28, 0x30, 0xa3, 0x7e, 0x00, 0xe5, 0x08, 0xce,
- 0xd1, 0xbc, 0xdc, 0x32, 0x0e, 0x5e, 0x4d, 0x1e, 0x2e})),
- std::make_pair(
- 62,
- std::vector<uint8_t>(
- {0x5c, 0x6b, 0xbf, 0x16, 0xba, 0xa1, 0x80, 0xf9, 0x86, 0xbd, 0x40,
- 0xa1, 0x28, 0x7e, 0xd4, 0xc5, 0x49, 0x77, 0x0e, 0x72, 0x84, 0x85,
- 0x8f, 0xc4, 0x7b, 0xc2, 0x1a, 0xb9, 0x5e, 0xbb, 0xf3, 0x37, 0x4b,
- 0x4e, 0xe3, 0xfd, 0x9f, 0x2a, 0xf6, 0x0f, 0x33, 0x95, 0x22, 0x1b,
- 0x2a, 0xcc, 0x76, 0xf2, 0xd3, 0x4c, 0x13, 0x29, 0x54, 0x04, 0x9f,
- 0x8a, 0x3a, 0x99, 0x6f, 0x1e, 0x32, 0xec, 0x84, 0xe5})),
- std::make_pair(
- 63,
- std::vector<uint8_t>(
- {0xd1, 0x0b, 0xf9, 0xa1, 0x5b, 0x1c, 0x9f, 0xc8, 0xd4, 0x1f, 0x89,
- 0xbb, 0x14, 0x0b, 0xf0, 0xbe, 0x08, 0xd2, 0xf3, 0x66, 0x61, 0x76,
- 0xd1, 0x3b, 0xaa, 0xc4, 0xd3, 0x81, 0x35, 0x8a, 0xd0, 0x74, 0xc9,
- 0xd4, 0x74, 0x8c, 0x30, 0x05, 0x20, 0xeb, 0x02, 0x6d, 0xae, 0xae,
- 0xa7, 0xc5, 0xb1, 0x58, 0x89, 0x2f, 0xde, 0x4e, 0x8e, 0xc1, 0x7d,
- 0xc9, 0x98, 0xdc, 0xd5, 0x07, 0xdf, 0x26, 0xeb, 0x63})),
- std::make_pair(
- 64,
- std::vector<uint8_t>(
- {0x2f, 0xc6, 0xe6, 0x9f, 0xa2, 0x6a, 0x89, 0xa5, 0xed, 0x26, 0x90,
- 0x92, 0xcb, 0x9b, 0x2a, 0x44, 0x9a, 0x44, 0x09, 0xa7, 0xa4, 0x40,
- 0x11, 0xee, 0xca, 0xd1, 0x3d, 0x7c, 0x4b, 0x04, 0x56, 0x60, 0x2d,
- 0x40, 0x2f, 0xa5, 0x84, 0x4f, 0x1a, 0x7a, 0x75, 0x81, 0x36, 0xce,
- 0x3d, 0x5d, 0x8d, 0x0e, 0x8b, 0x86, 0x92, 0x1f, 0xff, 0xf4, 0xf6,
- 0x92, 0xdd, 0x95, 0xbd, 0xc8, 0xe5, 0xff, 0x00, 0x52})),
- std::make_pair(
- 65,
- std::vector<uint8_t>(
- {0xfc, 0xbe, 0x8b, 0xe7, 0xdc, 0xb4, 0x9a, 0x32, 0xdb, 0xdf, 0x23,
- 0x94, 0x59, 0xe2, 0x63, 0x08, 0xb8, 0x4d, 0xff, 0x1e, 0xa4, 0x80,
- 0xdf, 0x8d, 0x10, 0x4e, 0xef, 0xf3, 0x4b, 0x46, 0xfa, 0xe9, 0x86,
- 0x27, 0xb4, 0x50, 0xc2, 0x26, 0x7d, 0x48, 0xc0, 0x94, 0x6a, 0x69,
- 0x7c, 0x5b, 0x59, 0x53, 0x14, 0x52, 0xac, 0x04, 0x84, 0xf1, 0xc8,
- 0x4e, 0x3a, 0x33, 0xd0, 0xc3, 0x39, 0xbb, 0x2e, 0x28})),
- std::make_pair(
- 66,
- std::vector<uint8_t>(
- {0xa1, 0x90, 0x93, 0xa6, 0xe3, 0xbc, 0xf5, 0x95, 0x2f, 0x85, 0x0f,
- 0x20, 0x30, 0xf6, 0x9b, 0x96, 0x06, 0xf1, 0x47, 0xf9, 0x0b, 0x8b,
- 0xae, 0xe3, 0x36, 0x2d, 0xa7, 0x1d, 0x9f, 0x35, 0xb4, 0x4e, 0xf9,
- 0xd8, 0xf0, 0xa7, 0x71, 0x2b, 0xa1, 0x87, 0x7f, 0xdd, 0xcd, 0x2d,
- 0x8e, 0xa8, 0xf1, 0xe5, 0xa7, 0x73, 0xd0, 0xb7, 0x45, 0xd4, 0x72,
- 0x56, 0x05, 0x98, 0x3a, 0x2d, 0xe9, 0x01, 0xf8, 0x03})),
- std::make_pair(
- 67,
- std::vector<uint8_t>(
- {0x3c, 0x20, 0x06, 0x42, 0x3f, 0x73, 0xe2, 0x68, 0xfa, 0x59, 0xd2,
- 0x92, 0x03, 0x77, 0xeb, 0x29, 0xa4, 0xf9, 0xa8, 0xb4, 0x62, 0xbe,
- 0x15, 0x98, 0x3e, 0xe3, 0xb8, 0x5a, 0xe8, 0xa7, 0x8e, 0x99, 0x26,
- 0x33, 0x58, 0x1a, 0x90, 0x99, 0x89, 0x3b, 0x63, 0xdb, 0x30, 0x24,
- 0x1c, 0x34, 0xf6, 0x43, 0x02, 0x7d, 0xc8, 0x78, 0x27, 0x9a, 0xf5,
- 0x85, 0x0d, 0x7e, 0x2d, 0x4a, 0x26, 0x53, 0x07, 0x3a})),
- std::make_pair(
- 68,
- std::vector<uint8_t>(
- {0xd0, 0xf2, 0xf2, 0xe3, 0x78, 0x76, 0x53, 0xf7, 0x7c, 0xce, 0x2f,
- 0xa2, 0x48, 0x35, 0x78, 0x5b, 0xbd, 0x0c, 0x43, 0x3f, 0xc7, 0x79,
- 0x46, 0x5a, 0x11, 0x51, 0x49, 0x90, 0x5a, 0x9d, 0xd1, 0xcb, 0x82,
- 0x7a, 0x62, 0x85, 0x06, 0xd4, 0x57, 0xfc, 0xf1, 0x24, 0xa0, 0xc2,
- 0xae, 0xf9, 0xce, 0x2d, 0x2a, 0x0a, 0x0f, 0x63, 0x54, 0x55, 0x70,
- 0xd8, 0x66, 0x7f, 0xf9, 0xe2, 0xeb, 0xa0, 0x73, 0x34})),
- std::make_pair(
- 69,
- std::vector<uint8_t>(
- {0x78, 0xa9, 0xfc, 0x04, 0x8e, 0x25, 0xc6, 0xdc, 0xb5, 0xde, 0x45,
- 0x66, 0x7d, 0xe8, 0xff, 0xdd, 0x3a, 0x93, 0x71, 0x11, 0x41, 0xd5,
- 0x94, 0xe9, 0xfa, 0x62, 0xa9, 0x59, 0x47, 0x5d, 0xa6, 0x07, 0x5e,
- 0xa8, 0xf0, 0x91, 0x6e, 0x84, 0xe4, 0x5a, 0xd9, 0x11, 0xb7, 0x54,
- 0x67, 0x07, 0x7e, 0xe5, 0x2d, 0x2c, 0x9a, 0xeb, 0xf4, 0xd5, 0x8f,
- 0x20, 0xce, 0x4a, 0x3a, 0x00, 0x45, 0x8b, 0x05, 0xd4})),
- std::make_pair(
- 70,
- std::vector<uint8_t>(
- {0x45, 0x81, 0x3f, 0x44, 0x17, 0x69, 0xab, 0x6e, 0xd3, 0x7d, 0x34,
- 0x9f, 0xf6, 0xe7, 0x22, 0x67, 0xd7, 0x6a, 0xe6, 0xbb, 0x3e, 0x3c,
- 0x61, 0x2e, 0xc0, 0x5c, 0x6e, 0x02, 0xa1, 0x2a, 0xf5, 0xa3, 0x7c,
- 0x91, 0x8b, 0x52, 0xbf, 0x74, 0x26, 0x7c, 0x3f, 0x6a, 0x3f, 0x18,
- 0x3a, 0x80, 0x64, 0xff, 0x84, 0xc0, 0x7b, 0x19, 0x3d, 0x08, 0x06,
- 0x67, 0x89, 0xa0, 0x1a, 0xcc, 0xdb, 0x6f, 0x93, 0x40})),
- std::make_pair(
- 71,
- std::vector<uint8_t>(
- {0x95, 0x6d, 0xa1, 0xc6, 0x8d, 0x83, 0xa7, 0xb8, 0x81, 0xe0, 0x1b,
- 0x9a, 0x96, 0x6c, 0x3c, 0x0b, 0xf2, 0x7f, 0x68, 0x60, 0x6a, 0x8b,
- 0x71, 0xd4, 0x57, 0xbd, 0x01, 0x6d, 0x4c, 0x41, 0xdd, 0x8a, 0x38,
- 0x0c, 0x70, 0x9a, 0x29, 0x6c, 0xb4, 0xc6, 0x54, 0x47, 0x92, 0x92,
- 0x0f, 0xd7, 0x88, 0x83, 0x57, 0x71, 0xa0, 0x7d, 0x4a, 0x16, 0xfb,
- 0x52, 0xed, 0x48, 0x05, 0x03, 0x31, 0xdc, 0x4c, 0x8b})),
- std::make_pair(
- 72,
- std::vector<uint8_t>(
- {0xdf, 0x18, 0x6c, 0x2d, 0xc0, 0x9c, 0xaa, 0x48, 0xe1, 0x4e, 0x94,
- 0x2f, 0x75, 0xde, 0x5a, 0xc1, 0xb7, 0xa2, 0x1e, 0x4f, 0x9f, 0x07,
- 0x2a, 0x5b, 0x37, 0x1e, 0x09, 0xe0, 0x73, 0x45, 0xb0, 0x74, 0x0c,
- 0x76, 0x17, 0x7b, 0x01, 0x27, 0x88, 0x08, 0xfe, 0xc0, 0x25, 0xed,
- 0xed, 0x98, 0x22, 0xc1, 0x22, 0xaf, 0xd1, 0xc6, 0x3e, 0x6f, 0x0c,
- 0xe2, 0xe3, 0x26, 0x31, 0x04, 0x10, 0x63, 0x14, 0x5c})),
- std::make_pair(
- 73,
- std::vector<uint8_t>(
- {0x87, 0x47, 0x56, 0x40, 0x96, 0x6a, 0x9f, 0xdc, 0xd6, 0xd3, 0xa3,
- 0xb5, 0xa2, 0xcc, 0xa5, 0xc0, 0x8f, 0x0d, 0x88, 0x2b, 0x10, 0x24,
- 0x3c, 0x0e, 0xc1, 0xbf, 0x3c, 0x6b, 0x1c, 0x37, 0xf2, 0xcd, 0x32,
- 0x12, 0xf1, 0x9a, 0x05, 0x78, 0x64, 0x47, 0x7d, 0x5e, 0xaf, 0x8f,
- 0xae, 0xd7, 0x3f, 0x29, 0x37, 0xc7, 0x68, 0xa0, 0xaf, 0x41, 0x5e,
- 0x84, 0xbb, 0xce, 0x6b, 0xd7, 0xde, 0x23, 0xb6, 0x60})),
- std::make_pair(
- 74,
- std::vector<uint8_t>(
- {0xc3, 0xb5, 0x73, 0xbb, 0xe1, 0x09, 0x49, 0xa0, 0xfb, 0xd4, 0xff,
- 0x88, 0x4c, 0x44, 0x6f, 0x22, 0x29, 0xb7, 0x69, 0x02, 0xf9, 0xdf,
- 0xdb, 0xb8, 0xa0, 0x35, 0x3d, 0xa5, 0xc8, 0x3c, 0xa1, 0x4e, 0x81,
- 0x51, 0xbb, 0xaa, 0xc8, 0x2f, 0xd1, 0x57, 0x6a, 0x00, 0x9a, 0xdc,
- 0x6f, 0x19, 0x35, 0xcf, 0x26, 0xed, 0xd4, 0xf1, 0xfb, 0x8d, 0xa4,
- 0x83, 0xe6, 0xc5, 0xcd, 0x9d, 0x89, 0x23, 0xad, 0xc3})),
- std::make_pair(
- 75,
- std::vector<uint8_t>(
- {0xb0, 0x9d, 0x8d, 0x0b, 0xba, 0x8a, 0x72, 0x86, 0xe4, 0x35, 0x68,
- 0xf7, 0x90, 0x75, 0x50, 0xe4, 0x20, 0x36, 0xd6, 0x74, 0xe3, 0xc8,
- 0xfc, 0x34, 0xd8, 0xca, 0x46, 0xf7, 0x71, 0xd6, 0x46, 0x6b, 0x70,
- 0xfb, 0x60, 0x58, 0x75, 0xf6, 0xa8, 0x63, 0xc8, 0x77, 0xd1, 0x2f,
- 0x07, 0x06, 0x3f, 0xdc, 0x2e, 0x90, 0xcc, 0xd4, 0x59, 0xb1, 0x91,
- 0x0d, 0xcd, 0x52, 0xd8, 0xf1, 0x0b, 0x2b, 0x0a, 0x15})),
- std::make_pair(
- 76,
- std::vector<uint8_t>(
- {0xaf, 0x3a, 0x22, 0xbf, 0x75, 0xb2, 0x1a, 0xbf, 0xb0, 0xac, 0xd5,
- 0x44, 0x22, 0xba, 0x1b, 0x73, 0x00, 0xa9, 0x52, 0xef, 0xf0, 0x2e,
- 0xbe, 0xb6, 0x5b, 0x5c, 0x23, 0x44, 0x71, 0xa9, 0x8d, 0xf3, 0x2f,
- 0x4f, 0x96, 0x43, 0xce, 0x19, 0x04, 0x10, 0x8a, 0x16, 0x87, 0x67,
- 0x92, 0x42, 0x80, 0xbd, 0x76, 0xc8, 0x3f, 0x8c, 0x82, 0xd9, 0xa7,
- 0x9d, 0x92, 0x59, 0xb1, 0x95, 0x36, 0x2a, 0x2a, 0x04})),
- std::make_pair(
- 77,
- std::vector<uint8_t>(
- {0xbf, 0x4f, 0xf2, 0x22, 0x1b, 0x7e, 0x69, 0x57, 0xa7, 0x24, 0xcd,
- 0x96, 0x4a, 0xa3, 0xd5, 0xd0, 0xd9, 0x94, 0x1f, 0x54, 0x04, 0x13,
- 0x75, 0x2f, 0x46, 0x99, 0xd8, 0x10, 0x1b, 0x3e, 0x53, 0x75, 0x08,
- 0xbf, 0x09, 0xf8, 0x50, 0x8b, 0x31, 0x77, 0x36, 0xff, 0xd2, 0x65,
- 0xf2, 0x84, 0x7a, 0xa7, 0xd8, 0x4b, 0xd2, 0xd9, 0x75, 0x69, 0xc4,
- 0x9d, 0x63, 0x2a, 0xed, 0x99, 0x45, 0xe5, 0xfa, 0x5e})),
- std::make_pair(
- 78,
- std::vector<uint8_t>(
- {0x9c, 0x6b, 0x6b, 0x78, 0x19, 0x9b, 0x1b, 0xda, 0xcb, 0x43, 0x00,
- 0xe3, 0x14, 0x79, 0xfa, 0x62, 0x2a, 0x6b, 0x5b, 0xc8, 0x0d, 0x46,
- 0x78, 0xa6, 0x07, 0x8f, 0x88, 0xa8, 0x26, 0x8c, 0xd7, 0x20, 0x6a,
- 0x27, 0x99, 0xe8, 0xd4, 0x62, 0x1a, 0x46, 0x4e, 0xf6, 0xb4, 0x3d,
- 0xd8, 0xad, 0xff, 0xe9, 0x7c, 0xaf, 0x22, 0x1b, 0x22, 0xb6, 0xb8,
- 0x77, 0x8b, 0x14, 0x9a, 0x82, 0x2a, 0xef, 0xbb, 0x09})),
- std::make_pair(
- 79,
- std::vector<uint8_t>(
- {0x89, 0x06, 0x56, 0xf0, 0x9c, 0x99, 0xd2, 0x80, 0xb5, 0xec, 0xb3,
- 0x81, 0xf5, 0x64, 0x27, 0xb8, 0x13, 0x75, 0x1b, 0xc6, 0x52, 0xc7,
- 0x82, 0x80, 0x78, 0xb2, 0x3a, 0x4a, 0xf8, 0x3b, 0x4e, 0x3a, 0x61,
- 0xfd, 0xba, 0xc6, 0x1f, 0x89, 0xbe, 0xe8, 0x4e, 0xa6, 0xbe, 0xe7,
- 0x60, 0xc0, 0x47, 0xf2, 0x5c, 0x6b, 0x0a, 0x20, 0x1c, 0x69, 0xa3,
- 0x8f, 0xd6, 0xfd, 0x97, 0x1a, 0xf1, 0x85, 0x88, 0xbb})),
- std::make_pair(
- 80,
- std::vector<uint8_t>(
- {0x31, 0xa0, 0x46, 0xf7, 0x88, 0x2f, 0xfe, 0x6f, 0x83, 0xce, 0x47,
- 0x2e, 0x9a, 0x07, 0x01, 0x83, 0x2e, 0xc7, 0xb3, 0xf7, 0x6f, 0xbc,
- 0xfd, 0x1d, 0xf6, 0x0f, 0xe3, 0xea, 0x48, 0xfd, 0xe1, 0x65, 0x12,
- 0x54, 0x24, 0x7c, 0x3f, 0xd9, 0x5e, 0x10, 0x0f, 0x91, 0x72, 0x73,
- 0x1e, 0x17, 0xfd, 0x52, 0x97, 0xc1, 0x1f, 0x4b, 0xb3, 0x28, 0x36,
- 0x3c, 0xa3, 0x61, 0x62, 0x4a, 0x81, 0xaf, 0x79, 0x7c})),
- std::make_pair(
- 81,
- std::vector<uint8_t>(
- {0x27, 0xa6, 0x0b, 0x2d, 0x00, 0xe7, 0xa6, 0x71, 0xd4, 0x7d, 0x0a,
- 0xec, 0x2a, 0x68, 0x6a, 0x0a, 0xc0, 0x4b, 0x52, 0xf4, 0x0a, 0xb6,
- 0x62, 0x90, 0x28, 0xeb, 0x7d, 0x13, 0xf4, 0xba, 0xa9, 0x9a, 0xc0,
- 0xfe, 0x46, 0xee, 0x6c, 0x81, 0x49, 0x44, 0xf2, 0xf4, 0xb4, 0xd2,
- 0x0e, 0x93, 0x78, 0xe4, 0x84, 0x7e, 0xa4, 0x4c, 0x13, 0x17, 0x80,
- 0x91, 0xe2, 0x77, 0xb8, 0x7e, 0xa7, 0xa5, 0x57, 0x11})),
- std::make_pair(
- 82,
- std::vector<uint8_t>(
- {0x8b, 0x5c, 0xce, 0xf1, 0x94, 0x16, 0x2c, 0x1f, 0x19, 0xd6, 0x8f,
- 0x91, 0xe0, 0xb0, 0x92, 0x8f, 0x28, 0x9e, 0xc5, 0x28, 0x37, 0x20,
- 0x84, 0x0c, 0x2f, 0x73, 0xd2, 0x53, 0x11, 0x12, 0x38, 0xdc, 0xfe,
- 0x94, 0xaf, 0x2b, 0x59, 0xc2, 0xc1, 0xca, 0x25, 0x91, 0x90, 0x1a,
- 0x7b, 0xc0, 0x60, 0xe7, 0x45, 0x9b, 0x6c, 0x47, 0xdf, 0x0f, 0x71,
- 0x70, 0x1a, 0x35, 0xcc, 0x0a, 0xa8, 0x31, 0xb5, 0xb6})),
- std::make_pair(
- 83,
- std::vector<uint8_t>(
- {0x57, 0xab, 0x6c, 0x4b, 0x22, 0x29, 0xae, 0xb3, 0xb7, 0x04, 0x76,
- 0xd8, 0x03, 0xcd, 0x63, 0x81, 0x2f, 0x10, 0x7c, 0xe6, 0xda, 0x17,
- 0xfe, 0xd9, 0xb1, 0x78, 0x75, 0xe8, 0xf8, 0x6c, 0x72, 0x4f, 0x49,
- 0xe0, 0x24, 0xcb, 0xf3, 0xa1, 0xb8, 0xb1, 0x19, 0xc5, 0x03, 0x57,
- 0x65, 0x2b, 0x81, 0x87, 0x9d, 0x2a, 0xde, 0x2d, 0x58, 0x8b, 0x9e,
- 0x4f, 0x7c, 0xed, 0xba, 0x0e, 0x46, 0x44, 0xc9, 0xee})),
- std::make_pair(
- 84,
- std::vector<uint8_t>(
- {0x01, 0x90, 0xa8, 0xda, 0xc3, 0x20, 0xa7, 0x39, 0xf3, 0x22, 0xe1,
- 0x57, 0x31, 0xaa, 0x14, 0x0d, 0xda, 0xf5, 0xbe, 0xd2, 0x94, 0xd5,
- 0xc8, 0x2e, 0x54, 0xfe, 0xf2, 0x9f, 0x21, 0x4e, 0x18, 0xaa, 0xfa,
- 0xa8, 0x4f, 0x8b, 0xe9, 0x9a, 0xf6, 0x29, 0x50, 0x26, 0x6b, 0x8f,
- 0x90, 0x1f, 0x15, 0xdd, 0x4c, 0x5d, 0x35, 0x51, 0x6f, 0xc3, 0x5b,
- 0x4c, 0xab, 0x2e, 0x96, 0xe4, 0x69, 0x5b, 0xbe, 0x1c})),
- std::make_pair(
- 85,
- std::vector<uint8_t>(
- {0xd1, 0x4d, 0x7c, 0x4c, 0x41, 0x5e, 0xeb, 0x0e, 0x10, 0xb1, 0x59,
- 0x22, 0x4b, 0xea, 0x12, 0x7e, 0xbd, 0x84, 0xf9, 0x59, 0x1c, 0x70,
- 0x2a, 0x33, 0x0f, 0x5b, 0xb7, 0xbb, 0x7a, 0xa4, 0x4e, 0xa3, 0x9d,
- 0xe6, 0xed, 0x01, 0xf1, 0x8d, 0xa7, 0xad, 0xf4, 0x0c, 0xfb, 0x97,
- 0xc5, 0xd1, 0x52, 0xc2, 0x75, 0x28, 0x82, 0x4b, 0x21, 0xe2, 0x39,
- 0x52, 0x6a, 0xf8, 0xf3, 0x6b, 0x21, 0x4e, 0x0c, 0xfb})),
- std::make_pair(
- 86,
- std::vector<uint8_t>(
- {0xbe, 0x28, 0xc4, 0xbe, 0x70, 0x69, 0x70, 0x48, 0x8f, 0xac, 0x7d,
- 0x29, 0xc3, 0xbd, 0x5c, 0x4e, 0x98, 0x60, 0x85, 0xc4, 0xc3, 0x33,
- 0x2f, 0x1f, 0x3f, 0xd3, 0x09, 0x73, 0xdb, 0x61, 0x41, 0x64, 0xba,
- 0x2f, 0x31, 0xa7, 0x88, 0x75, 0xff, 0xdc, 0x15, 0x03, 0x25, 0xc8,
- 0x83, 0x27, 0xa9, 0x44, 0x3e, 0xd0, 0x4f, 0xdf, 0xe5, 0xbe, 0x93,
- 0x87, 0x6d, 0x16, 0x28, 0x56, 0x0c, 0x76, 0x4a, 0x80})),
- std::make_pair(
- 87,
- std::vector<uint8_t>(
- {0x03, 0x1d, 0xa1, 0x06, 0x9e, 0x3a, 0x2e, 0x9c, 0x33, 0x82, 0xe4,
- 0x36, 0xff, 0xd7, 0x9d, 0xf7, 0x4b, 0x1c, 0xa6, 0xa8, 0xad, 0xb2,
- 0xde, 0xab, 0xe6, 0x76, 0xab, 0x45, 0x99, 0x4c, 0xbc, 0x05, 0x4f,
- 0x03, 0x7d, 0x2f, 0x0e, 0xac, 0xe8, 0x58, 0xd3, 0x2c, 0x14, 0xe2,
- 0xd1, 0xc8, 0xb4, 0x60, 0x77, 0x30, 0x8e, 0x3b, 0xdc, 0x2c, 0x1b,
- 0x53, 0x17, 0x2e, 0xcf, 0x7a, 0x8c, 0x14, 0xe3, 0x49})),
- std::make_pair(
- 88,
- std::vector<uint8_t>(
- {0x46, 0x65, 0xce, 0xf8, 0xba, 0x4d, 0xb4, 0xd0, 0xac, 0xb1, 0x18,
- 0xf2, 0x98, 0x7f, 0x0b, 0xb0, 0x9f, 0x8f, 0x86, 0xaa, 0x44, 0x5a,
- 0xa3, 0xd5, 0xfc, 0x9a, 0x8b, 0x34, 0x68, 0x64, 0x78, 0x74, 0x89,
- 0xe8, 0xfc, 0xec, 0xc1, 0x25, 0xd1, 0x7e, 0x9b, 0x56, 0xe1, 0x29,
- 0x88, 0xea, 0xc5, 0xec, 0xc7, 0x28, 0x68, 0x83, 0xdb, 0x06, 0x61,
- 0xb8, 0xff, 0x05, 0xda, 0x2a, 0xff, 0xf3, 0x0f, 0xe4})),
- std::make_pair(
- 89,
- std::vector<uint8_t>(
- {0x63, 0xb7, 0x03, 0x2e, 0x5f, 0x93, 0x0c, 0xc9, 0x93, 0x95, 0x17,
- 0xf9, 0xe9, 0x86, 0x81, 0x6c, 0xfb, 0xec, 0x2b, 0xe5, 0x9b, 0x95,
- 0x68, 0xb1, 0x3f, 0x2e, 0xad, 0x05, 0xba, 0xe7, 0x77, 0x7c, 0xab,
- 0x62, 0x0c, 0x66, 0x59, 0x40, 0x4f, 0x74, 0x09, 0xe4, 0x19, 0x9a,
- 0x3b, 0xe5, 0xf7, 0x86, 0x5a, 0xa7, 0xcb, 0xdf, 0x8c, 0x42, 0x53,
- 0xf7, 0xe8, 0x21, 0x9b, 0x1b, 0xd5, 0xf4, 0x6f, 0xea})),
- std::make_pair(
- 90,
- std::vector<uint8_t>(
- {0x9f, 0x09, 0xbf, 0x09, 0x3a, 0x2b, 0x0f, 0xf8, 0xc2, 0x63, 0x4b,
- 0x49, 0xe3, 0x7f, 0x1b, 0x21, 0x35, 0xb4, 0x47, 0xaa, 0x91, 0x44,
- 0xc9, 0x78, 0x7d, 0xbf, 0xd9, 0x21, 0x29, 0x31, 0x6c, 0x99, 0xe8,
- 0x8a, 0xab, 0x8a, 0x21, 0xfd, 0xef, 0x23, 0x72, 0xd1, 0x18, 0x9a,
- 0xec, 0x50, 0x0f, 0x95, 0x77, 0x5f, 0x1f, 0x92, 0xbf, 0xb4, 0x55,
- 0x45, 0xe4, 0x25, 0x9f, 0xb9, 0xb7, 0xb0, 0x2d, 0x14})),
- std::make_pair(
- 91,
- std::vector<uint8_t>(
- {0xf9, 0xf8, 0x49, 0x3c, 0x68, 0x08, 0x88, 0x07, 0xdf, 0x7f, 0x6a,
- 0x26, 0x93, 0xd6, 0x4e, 0xa5, 0x9f, 0x03, 0xe9, 0xe0, 0x5a, 0x22,
- 0x3e, 0x68, 0x52, 0x4c, 0xa3, 0x21, 0x95, 0xa4, 0x73, 0x4b, 0x65,
- 0x4f, 0xce, 0xa4, 0xd2, 0x73, 0x4c, 0x86, 0x6c, 0xf9, 0x5c, 0x88,
- 0x9f, 0xb1, 0x0c, 0x49, 0x15, 0x9b, 0xe2, 0xf5, 0x04, 0x3d, 0xc9,
- 0x8b, 0xb5, 0x5e, 0x02, 0xef, 0x7b, 0xdc, 0xb0, 0x82})),
- std::make_pair(
- 92,
- std::vector<uint8_t>(
- {0x3c, 0x9a, 0x73, 0x59, 0xab, 0x4f, 0xeb, 0xce, 0x07, 0xb2, 0x0a,
- 0xc4, 0x47, 0xb0, 0x6a, 0x24, 0x0b, 0x7f, 0xe1, 0xda, 0xe5, 0x43,
- 0x9c, 0x49, 0xb6, 0x0b, 0x58, 0x19, 0xf7, 0x81, 0x2e, 0x4c, 0x17,
- 0x24, 0x06, 0xc1, 0xaa, 0xc3, 0x16, 0x71, 0x3c, 0xf0, 0xdd, 0xed,
- 0x10, 0x38, 0x07, 0x72, 0x58, 0xe2, 0xef, 0xf5, 0xb3, 0x39, 0x13,
- 0xd9, 0xd9, 0x5c, 0xae, 0xb4, 0xe6, 0xc6, 0xb9, 0x70})),
- std::make_pair(
- 93,
- std::vector<uint8_t>(
- {0xad, 0x6a, 0xab, 0x80, 0x84, 0x51, 0x0e, 0x82, 0x2c, 0xfc, 0xe8,
- 0x62, 0x5d, 0x62, 0xcf, 0x4d, 0xe6, 0x55, 0xf4, 0x76, 0x38, 0x84,
- 0xc7, 0x1e, 0x80, 0xba, 0xb9, 0xac, 0x9d, 0x53, 0x18, 0xdb, 0xa4,
- 0xa6, 0x03, 0x3e, 0xd2, 0x90, 0x84, 0xe6, 0x52, 0x16, 0xc0, 0x31,
- 0x60, 0x6c, 0xa1, 0x76, 0x15, 0xdc, 0xfe, 0x3b, 0xa1, 0x1d, 0x26,
- 0x85, 0x1a, 0xe0, 0x99, 0x9c, 0xa6, 0xe2, 0x32, 0xcf})),
- std::make_pair(
- 94,
- std::vector<uint8_t>(
- {0x15, 0x6e, 0x9e, 0x62, 0x61, 0x37, 0x4c, 0x9d, 0xc8, 0x84, 0xf3,
- 0x6e, 0x70, 0xf0, 0xfe, 0x1a, 0xb9, 0x29, 0x79, 0x97, 0xb8, 0x36,
- 0xfa, 0x7d, 0x17, 0x0a, 0x9c, 0x9e, 0xbf, 0x57, 0x5b, 0x88, 0x1e,
- 0x7b, 0xce, 0xa4, 0x4d, 0x6c, 0x02, 0x48, 0xd3, 0x55, 0x97, 0x90,
- 0x71, 0x54, 0x82, 0x89, 0x55, 0xbe, 0x19, 0x13, 0x58, 0x52, 0xf9,
- 0x22, 0x88, 0x15, 0xec, 0xa0, 0x24, 0xa8, 0xad, 0xfb})),
- std::make_pair(
- 95,
- std::vector<uint8_t>(
- {0x42, 0x15, 0x40, 0x76, 0x33, 0xf4, 0xcc, 0xa9, 0xb6, 0x78, 0x8b,
- 0xe9, 0x3e, 0x6a, 0xa3, 0xd9, 0x63, 0xc7, 0xd6, 0xce, 0x4b, 0x14,
- 0x72, 0x47, 0x09, 0x9f, 0x46, 0xa3, 0xac, 0xb5, 0x00, 0xa3, 0x00,
- 0x38, 0xcb, 0x3e, 0x78, 0x8c, 0x3d, 0x29, 0xf1, 0x32, 0xad, 0x84,
- 0x4e, 0x80, 0xe9, 0xe9, 0x92, 0x51, 0xf6, 0xdb, 0x96, 0xac, 0xd8,
- 0xa0, 0x91, 0xcf, 0xc7, 0x70, 0xaf, 0x53, 0x84, 0x7b})),
- std::make_pair(
- 96,
- std::vector<uint8_t>(
- {0x1c, 0x07, 0x7e, 0x27, 0x9d, 0xe6, 0x54, 0x85, 0x23, 0x50, 0x2b,
- 0x6d, 0xf8, 0x00, 0xff, 0xda, 0xb5, 0xe2, 0xc3, 0xe9, 0x44, 0x2e,
- 0xb8, 0x38, 0xf5, 0x8c, 0x29, 0x5f, 0x3b, 0x14, 0x7c, 0xef, 0x9d,
- 0x70, 0x1c, 0x41, 0xc3, 0x21, 0x28, 0x3f, 0x00, 0xc7, 0x1a, 0xff,
- 0xa0, 0x61, 0x93, 0x10, 0x39, 0x91, 0x26, 0x29, 0x5b, 0x78, 0xdd,
- 0x4d, 0x1a, 0x74, 0x57, 0x2e, 0xf9, 0xed, 0x51, 0x35})),
- std::make_pair(
- 97,
- std::vector<uint8_t>(
- {0xf0, 0x7a, 0x55, 0x5f, 0x49, 0xfe, 0x48, 0x1c, 0xf4, 0xcd, 0x0a,
- 0x87, 0xb7, 0x1b, 0x82, 0xe4, 0xa9, 0x50, 0x64, 0xd0, 0x66, 0x77,
- 0xfd, 0xd9, 0x0a, 0x0e, 0xb5, 0x98, 0x87, 0x7b, 0xa1, 0xc8, 0x3d,
- 0x46, 0x77, 0xb3, 0x93, 0xc3, 0xa3, 0xb6, 0x66, 0x1c, 0x42, 0x1f,
- 0x5b, 0x12, 0xcb, 0x99, 0xd2, 0x03, 0x76, 0xba, 0x72, 0x75, 0xc2,
- 0xf3, 0xa8, 0xf5, 0xa9, 0xb7, 0x82, 0x17, 0x20, 0xda})),
- std::make_pair(
- 98,
- std::vector<uint8_t>(
- {0xb5, 0x91, 0x1b, 0x38, 0x0d, 0x20, 0xc7, 0xb0, 0x43, 0x23, 0xe4,
- 0x02, 0x6b, 0x38, 0xe2, 0x00, 0xf5, 0x34, 0x25, 0x92, 0x33, 0xb5,
- 0x81, 0xe0, 0x2c, 0x1e, 0x3e, 0x2d, 0x84, 0x38, 0xd6, 0xc6, 0x6d,
- 0x5a, 0x4e, 0xb2, 0x01, 0xd5, 0xa8, 0xb7, 0x50, 0x72, 0xc4, 0xec,
- 0x29, 0x10, 0x63, 0x34, 0xda, 0x70, 0xbc, 0x79, 0x52, 0x1b, 0x0c,
- 0xed, 0x2c, 0xfd, 0x53, 0x3f, 0x5f, 0xf8, 0x4f, 0x95})),
- std::make_pair(
- 99,
- std::vector<uint8_t>(
- {0x01, 0xf0, 0x70, 0xa0, 0x9b, 0xae, 0x91, 0x12, 0x96, 0x36, 0x1f,
- 0x91, 0xaa, 0x0e, 0x8e, 0x0d, 0x09, 0xa7, 0x72, 0x54, 0x78, 0x53,
- 0x6d, 0x9d, 0x48, 0xc5, 0xfe, 0x1e, 0x5e, 0x7c, 0x3c, 0x5b, 0x9b,
- 0x9d, 0x6e, 0xb0, 0x77, 0x96, 0xf6, 0xda, 0x57, 0xae, 0x56, 0x2a,
- 0x7d, 0x70, 0xe8, 0x82, 0xe3, 0x7a, 0xdf, 0xde, 0x83, 0xf0, 0xc4,
- 0x33, 0xc2, 0xcd, 0x36, 0x35, 0x36, 0xbb, 0x22, 0xc8})),
- std::make_pair(
- 100,
- std::vector<uint8_t>(
- {0x6f, 0x79, 0x3e, 0xb4, 0x37, 0x4a, 0x48, 0xb0, 0x77, 0x5a, 0xca,
- 0xf9, 0xad, 0xcf, 0x8e, 0x45, 0xe5, 0x42, 0x70, 0xc9, 0x47, 0x5f,
- 0x00, 0x4a, 0xd8, 0xd5, 0x97, 0x3e, 0x2a, 0xca, 0x52, 0x74, 0x7f,
- 0xf4, 0xed, 0x04, 0xae, 0x96, 0x72, 0x75, 0xb9, 0xf9, 0xeb, 0x0e,
- 0x1f, 0xf7, 0x5f, 0xb4, 0xf7, 0x94, 0xfa, 0x8b, 0xe9, 0xad, 0xd7,
- 0xa4, 0x13, 0x04, 0x86, 0x8d, 0x10, 0x3f, 0xab, 0x10})),
- std::make_pair(
- 101,
- std::vector<uint8_t>(
- {0x96, 0x5f, 0x20, 0xf1, 0x39, 0x76, 0x5f, 0xcc, 0x4c, 0xe4, 0xba,
- 0x37, 0x94, 0x67, 0x58, 0x63, 0xca, 0xc2, 0x4d, 0xb4, 0x72, 0xcd,
- 0x2b, 0x79, 0x9d, 0x03, 0x5b, 0xce, 0x3d, 0xbe, 0xa5, 0x02, 0xda,
- 0x7b, 0x52, 0x48, 0x65, 0xf6, 0xb8, 0x11, 0xd8, 0xc5, 0x82, 0x8d,
- 0x3a, 0x88, 0x96, 0x46, 0xfe, 0x64, 0xa3, 0x80, 0xda, 0x1a, 0xa7,
- 0xc7, 0x04, 0x4e, 0x9f, 0x24, 0x5d, 0xce, 0xd1, 0x28})),
- std::make_pair(
- 102,
- std::vector<uint8_t>(
- {0xec, 0x29, 0x5b, 0x57, 0x83, 0x60, 0x12, 0x44, 0xc3, 0x0e, 0x46,
- 0x41, 0xe3, 0xb4, 0x5b, 0xe2, 0x22, 0xc4, 0xdc, 0xe7, 0x7a, 0x58,
- 0x70, 0x0f, 0x53, 0xbc, 0x8e, 0xc5, 0x2a, 0x94, 0x16, 0x90, 0xb4,
- 0xd0, 0xb0, 0x87, 0xfb, 0x6f, 0xcb, 0x3f, 0x39, 0x83, 0x2b, 0x9d,
- 0xe8, 0xf7, 0x5e, 0xc2, 0x0b, 0xd4, 0x30, 0x79, 0x81, 0x17, 0x49,
- 0xcd, 0xc9, 0x07, 0xed, 0xb9, 0x41, 0x57, 0xd1, 0x80})),
- std::make_pair(
- 103,
- std::vector<uint8_t>(
- {0x61, 0xc7, 0x2f, 0x8c, 0xcc, 0x91, 0xdb, 0xb5, 0x4c, 0xa6, 0x75,
- 0x0b, 0xc4, 0x89, 0x67, 0x2d, 0xe0, 0x9f, 0xae, 0xdb, 0x8f, 0xdd,
- 0x4f, 0x94, 0xff, 0x23, 0x20, 0x90, 0x9a, 0x30, 0x3f, 0x5d, 0x5a,
- 0x98, 0x48, 0x1c, 0x0b, 0xc1, 0xa6, 0x25, 0x41, 0x9f, 0xb4, 0xde,
- 0xbf, 0xbf, 0x7f, 0x8a, 0x53, 0xbb, 0x07, 0xec, 0x3d, 0x98, 0x5e,
- 0x8e, 0xa1, 0x1e, 0x72, 0xd5, 0x59, 0x94, 0x07, 0x80})),
- std::make_pair(
- 104,
- std::vector<uint8_t>(
- {0xaf, 0xd8, 0x14, 0x5b, 0x25, 0x9e, 0xef, 0xc8, 0xd1, 0x26, 0x20,
- 0xc3, 0xc5, 0xb0, 0x3e, 0x1e, 0xd8, 0xfd, 0x2c, 0xce, 0xfe, 0x03,
- 0x65, 0x07, 0x8c, 0x80, 0xfd, 0x42, 0xc1, 0x77, 0x0e, 0x28, 0xb4,
- 0x49, 0x48, 0xf2, 0x7e, 0x65, 0xa1, 0x88, 0x66, 0x90, 0x11, 0x0d,
- 0xb8, 0x14, 0x39, 0x7b, 0x68, 0xe4, 0x3d, 0x80, 0xd1, 0xba, 0x16,
- 0xdf, 0xa3, 0x58, 0xe7, 0x39, 0xc8, 0x98, 0xcf, 0xa3})),
- std::make_pair(
- 105,
- std::vector<uint8_t>(
- {0x55, 0x2f, 0xc7, 0x89, 0x3c, 0xf1, 0xce, 0x93, 0x3a, 0xda, 0x35,
- 0xc0, 0xda, 0x98, 0x84, 0x4e, 0x41, 0x54, 0x5e, 0x24, 0x4c, 0x31,
- 0x57, 0xa1, 0x42, 0x8d, 0x7b, 0x4c, 0x21, 0xf9, 0xcd, 0x7e, 0x40,
- 0x71, 0xae, 0xd7, 0x7b, 0x7c, 0xa9, 0xf1, 0xc3, 0x8f, 0xba, 0x32,
- 0x23, 0x74, 0x12, 0xef, 0x21, 0xa3, 0x42, 0x74, 0x2e, 0xc8, 0x32,
- 0x43, 0x78, 0xf2, 0x1e, 0x50, 0x7f, 0xaf, 0xdd, 0x88})),
- std::make_pair(
- 106,
- std::vector<uint8_t>(
- {0x46, 0x7a, 0x33, 0xfb, 0xad, 0xf5, 0xeb, 0xc5, 0x25, 0x96, 0xef,
- 0x86, 0xaa, 0xae, 0xfc, 0x6f, 0xab, 0xa8, 0xee, 0x65, 0x1b, 0x1c,
- 0xe0, 0x4d, 0xe3, 0x68, 0xa0, 0x3a, 0x5a, 0x90, 0x40, 0xef, 0x28,
- 0x35, 0xe0, 0x0a, 0xdb, 0x09, 0xab, 0xb3, 0xfb, 0xd2, 0xbc, 0xe8,
- 0x18, 0xa2, 0x41, 0x3d, 0x0b, 0x02, 0x53, 0xb5, 0xbd, 0xa4, 0xfc,
- 0x5b, 0x2f, 0x6f, 0x85, 0xf3, 0xfd, 0x5b, 0x55, 0xf2})),
- std::make_pair(
- 107,
- std::vector<uint8_t>(
- {0x22, 0xef, 0xf8, 0xe6, 0xdd, 0x52, 0x36, 0xf5, 0xf5, 0x7d, 0x94,
- 0xed, 0xe8, 0x74, 0xd6, 0xc9, 0x42, 0x8e, 0x8f, 0x5d, 0x56, 0x6f,
- 0x17, 0xcd, 0x6d, 0x18, 0x48, 0xcd, 0x75, 0x2f, 0xe1, 0x3c, 0x65,
- 0x5c, 0xb1, 0x0f, 0xba, 0xaf, 0xf7, 0x68, 0x72, 0xf2, 0xbf, 0x2d,
- 0xa9, 0x9e, 0x15, 0xdc, 0x62, 0x40, 0x75, 0xe1, 0xec, 0x2f, 0x58,
- 0xa3, 0xf6, 0x40, 0x72, 0x12, 0x18, 0x38, 0x56, 0x9e})),
- std::make_pair(
- 108,
- std::vector<uint8_t>(
- {0x9c, 0xec, 0x6b, 0xbf, 0x62, 0xc4, 0xbc, 0xe4, 0x13, 0x8a, 0xba,
- 0xe1, 0xcb, 0xec, 0x8d, 0xad, 0x31, 0x95, 0x04, 0x44, 0xe9, 0x03,
- 0x21, 0xb1, 0x34, 0x71, 0x96, 0x83, 0x4c, 0x11, 0x4b, 0x86, 0x4a,
- 0xf3, 0xf3, 0xcc, 0x35, 0x08, 0xf8, 0x37, 0x51, 0xff, 0xb4, 0xed,
- 0xa7, 0xc8, 0x4d, 0x14, 0x07, 0x34, 0xbb, 0x42, 0x63, 0xc3, 0x62,
- 0x5c, 0x00, 0xf0, 0x4f, 0x4c, 0x80, 0x68, 0x98, 0x1b})),
- std::make_pair(
- 109,
- std::vector<uint8_t>(
- {0xa8, 0xb6, 0x0f, 0xa4, 0xfc, 0x24, 0x42, 0xf6, 0xf1, 0x51, 0x4a,
- 0xd7, 0x40, 0x26, 0x26, 0x92, 0x0c, 0xc7, 0xc2, 0xc9, 0xf7, 0x21,
- 0x24, 0xb8, 0xcb, 0xa8, 0xee, 0x2c, 0xb7, 0xc4, 0x58, 0x6f, 0x65,
- 0x8a, 0x44, 0x10, 0xcf, 0xfc, 0xc0, 0xab, 0x88, 0x34, 0x39, 0x55,
- 0xe0, 0x94, 0xc6, 0xaf, 0x0d, 0x20, 0xd0, 0xc7, 0x14, 0xfb, 0x0a,
- 0x98, 0x8f, 0x54, 0x3f, 0x30, 0x0f, 0x58, 0xd3, 0x89})),
- std::make_pair(
- 110,
- std::vector<uint8_t>(
- {0x82, 0x71, 0xcc, 0x45, 0xdf, 0xa5, 0xe4, 0x17, 0x0e, 0x84, 0x7e,
- 0x86, 0x30, 0xb9, 0x52, 0xcf, 0x9c, 0x2a, 0xa7, 0x77, 0xd0, 0x6f,
- 0x26, 0xa7, 0x58, 0x5b, 0x83, 0x81, 0xf1, 0x88, 0xda, 0xcc, 0x73,
- 0x37, 0x39, 0x1c, 0xfc, 0xc9, 0x4b, 0x05, 0x3d, 0xc4, 0xec, 0x29,
- 0xcc, 0x17, 0xf0, 0x77, 0x87, 0x04, 0x28, 0xf1, 0xac, 0x23, 0xfd,
- 0xdd, 0xa1, 0x65, 0xef, 0x5a, 0x3f, 0x15, 0x5f, 0x39})),
- std::make_pair(
- 111,
- std::vector<uint8_t>(
- {0xbf, 0x23, 0xc0, 0xc2, 0x5c, 0x80, 0x60, 0xe4, 0xf6, 0x99, 0x5f,
- 0x16, 0x23, 0xa3, 0xbe, 0xbe, 0xca, 0xa9, 0x6e, 0x30, 0x86, 0x80,
- 0x00, 0x0a, 0x8a, 0xa3, 0xcd, 0x56, 0xbb, 0x1a, 0x6d, 0xa0, 0x99,
- 0xe1, 0x0d, 0x92, 0x31, 0xb3, 0x7f, 0x45, 0x19, 0xb2, 0xef, 0xd2,
- 0xc2, 0x4d, 0xe7, 0x2f, 0x31, 0xa5, 0xf1, 0x95, 0x35, 0x24, 0x1b,
- 0x4a, 0x59, 0xfa, 0x3c, 0x03, 0xce, 0xb7, 0x90, 0xe7})),
- std::make_pair(
- 112,
- std::vector<uint8_t>(
- {0x87, 0x7f, 0xd6, 0x52, 0xc0, 0x52, 0x81, 0x00, 0x9c, 0x0a, 0x52,
- 0x50, 0xe7, 0xa3, 0xa6, 0x71, 0xf8, 0xb1, 0x8c, 0x10, 0x88, 0x17,
- 0xfe, 0x4a, 0x87, 0x4d, 0xe2, 0x2d, 0xa8, 0xe4, 0x5d, 0xb1, 0x19,
- 0x58, 0xa6, 0x00, 0xc5, 0xf6, 0x2e, 0x67, 0xd3, 0x6c, 0xbf, 0x84,
- 0x47, 0x4c, 0xf2, 0x44, 0xa9, 0xc2, 0xb0, 0x3a, 0x9f, 0xb9, 0xdc,
- 0x71, 0x1c, 0xd1, 0xa2, 0xca, 0xb6, 0xf3, 0xfa, 0xe0})),
- std::make_pair(
- 113,
- std::vector<uint8_t>(
- {0x29, 0xdf, 0x4d, 0x87, 0xea, 0x44, 0x4b, 0xaf, 0x5b, 0xcd, 0xf5,
- 0xf4, 0xe4, 0x15, 0x79, 0xe2, 0x8a, 0x67, 0xde, 0x84, 0x14, 0x9f,
- 0x06, 0xc0, 0x3f, 0x11, 0x0e, 0xa8, 0x4f, 0x57, 0x2a, 0x9f, 0x67,
- 0x6a, 0xdd, 0xd0, 0x4c, 0x48, 0x78, 0xf4, 0x9c, 0x5c, 0x00, 0xac,
- 0xcd, 0xa4, 0x41, 0xb1, 0xa3, 0x87, 0xca, 0xce, 0xb2, 0xe9, 0x93,
- 0xbb, 0x7a, 0x10, 0xcd, 0x8c, 0x2d, 0x67, 0x17, 0xe1})),
- std::make_pair(
- 114,
- std::vector<uint8_t>(
- {0x71, 0x0d, 0xac, 0xb1, 0x66, 0x84, 0x46, 0x39, 0xcd, 0x7b, 0x63,
- 0x7c, 0x27, 0x42, 0x09, 0x42, 0x4e, 0x24, 0x49, 0xdc, 0x35, 0xd7,
- 0x90, 0xbb, 0xfa, 0x4f, 0x76, 0x17, 0x70, 0x54, 0xa3, 0x6b, 0x3b,
- 0x76, 0xfa, 0xc0, 0xca, 0x6e, 0x61, 0xdf, 0x1e, 0x68, 0x70, 0x00,
- 0x67, 0x8a, 0xc0, 0x74, 0x6d, 0xf7, 0x5d, 0x0a, 0x39, 0x54, 0x89,
- 0x76, 0x81, 0xfd, 0x39, 0x3a, 0x15, 0x5a, 0x1b, 0xb4})),
- std::make_pair(
- 115,
- std::vector<uint8_t>(
- {0xc1, 0xd5, 0xf9, 0x3b, 0x8d, 0xea, 0x1f, 0x25, 0x71, 0xba, 0xbc,
- 0xcb, 0xc0, 0x17, 0x64, 0x54, 0x1a, 0x0c, 0xda, 0x87, 0xe4, 0x44,
- 0xd6, 0x73, 0xc5, 0x09, 0x66, 0xca, 0x55, 0x9c, 0x33, 0x35, 0x4b,
- 0x3a, 0xcb, 0x26, 0xe5, 0xd5, 0x78, 0x1f, 0xfb, 0x28, 0x84, 0x7a,
- 0x4b, 0x47, 0x54, 0xd7, 0x70, 0x08, 0xc6, 0x2a, 0x83, 0x58, 0x35,
- 0xf5, 0x00, 0xde, 0xa7, 0xc3, 0xb5, 0x8b, 0xda, 0xe2})),
- std::make_pair(
- 116,
- std::vector<uint8_t>(
- {0xa4, 0x1e, 0x41, 0x27, 0x1c, 0xda, 0xb8, 0xaf, 0x4d, 0x72, 0xb1,
- 0x04, 0xbf, 0xb2, 0xad, 0x04, 0x1a, 0xc4, 0xdf, 0x14, 0x67, 0x7d,
- 0xa6, 0x71, 0xd8, 0x56, 0x40, 0xc4, 0xb1, 0x87, 0xf5, 0x0c, 0x2b,
- 0x66, 0x51, 0x3c, 0x46, 0x19, 0xfb, 0xd5, 0xd5, 0xdc, 0x4f, 0xe6,
- 0x5d, 0xd3, 0x7b, 0x90, 0x42, 0xe9, 0x84, 0x8d, 0xda, 0x55, 0x6a,
- 0x50, 0x4c, 0xaa, 0x2b, 0x1c, 0x6a, 0xfe, 0x47, 0x30})),
- std::make_pair(
- 117,
- std::vector<uint8_t>(
- {0xe7, 0xbc, 0xba, 0xcd, 0xc3, 0x79, 0xc4, 0x3d, 0x81, 0xeb, 0xad,
- 0xcb, 0x37, 0x78, 0x15, 0x52, 0xfc, 0x1d, 0x75, 0x3e, 0x8c, 0xf3,
- 0x10, 0xd9, 0x68, 0x39, 0x2d, 0x06, 0xc9, 0x1f, 0x1d, 0x64, 0xcc,
- 0x9e, 0x90, 0xce, 0x1d, 0x22, 0xc3, 0x2d, 0x27, 0x7f, 0xc6, 0xcd,
- 0xa4, 0x33, 0xa4, 0xd4, 0x42, 0xc7, 0x62, 0xe9, 0xea, 0xcf, 0x2c,
- 0x25, 0x9f, 0x32, 0xd6, 0x4c, 0xf9, 0xda, 0x3a, 0x22})),
- std::make_pair(
- 118,
- std::vector<uint8_t>(
- {0x51, 0x75, 0x5b, 0x4a, 0xc5, 0x45, 0x6b, 0x13, 0x21, 0x8a, 0x19,
- 0xc5, 0xb9, 0x24, 0x2f, 0x57, 0xc4, 0xa9, 0x81, 0xe4, 0xd4, 0xec,
- 0xdc, 0xe0, 0x9a, 0x31, 0x93, 0x36, 0x2b, 0x80, 0x8a, 0x57, 0x93,
- 0x45, 0xd4, 0x88, 0x1c, 0x26, 0x07, 0xa5, 0x65, 0x34, 0xdd, 0x7f,
- 0x21, 0x95, 0x6a, 0xff, 0x72, 0xc2, 0xf4, 0x17, 0x3a, 0x6e, 0x7b,
- 0x6c, 0xc2, 0x21, 0x2b, 0xa0, 0xe3, 0xda, 0xee, 0x1f})),
- std::make_pair(
- 119,
- std::vector<uint8_t>(
- {0xdc, 0xc2, 0xc4, 0xbe, 0xb9, 0xc1, 0xf2, 0x60, 0x7b, 0x78, 0x6c,
- 0x20, 0xc6, 0x31, 0x97, 0x23, 0x47, 0x03, 0x4c, 0x1c, 0xc0, 0x2f,
- 0xcc, 0x7d, 0x02, 0xff, 0x01, 0x09, 0x9c, 0xfe, 0x1c, 0x69, 0x89,
- 0x84, 0x0a, 0xc2, 0x13, 0x92, 0x36, 0x29, 0x11, 0x3a, 0xa8, 0xba,
- 0xd7, 0x13, 0xcc, 0xf0, 0xfe, 0x4c, 0xe1, 0x32, 0x64, 0xfb, 0x32,
- 0xb8, 0xb0, 0xfe, 0x37, 0x2d, 0xa3, 0x82, 0x54, 0x4a})),
- std::make_pair(
- 120,
- std::vector<uint8_t>(
- {0x3d, 0x55, 0x17, 0x6a, 0xce, 0xa4, 0xa7, 0xe3, 0xa6, 0x5f, 0xfa,
- 0x9f, 0xb1, 0x0a, 0x7a, 0x17, 0x67, 0x19, 0x9c, 0xf0, 0x77, 0xce,
- 0xe9, 0xf7, 0x15, 0x32, 0xd6, 0x7c, 0xd7, 0xc7, 0x3c, 0x9f, 0x93,
- 0xcf, 0xc3, 0x7c, 0xcd, 0xcc, 0x1f, 0xde, 0xf5, 0x0a, 0xad, 0x46,
- 0xa5, 0x04, 0xa6, 0x50, 0xd2, 0x98, 0xd5, 0x97, 0xa3, 0xa9, 0xfa,
- 0x95, 0xc6, 0xc4, 0x0c, 0xb7, 0x1f, 0xa5, 0xe7, 0x25})),
- std::make_pair(
- 121,
- std::vector<uint8_t>(
- {0xd0, 0x77, 0x13, 0xc0, 0x05, 0xde, 0x96, 0xdd, 0x21, 0xd2, 0xeb,
- 0x8b, 0xbe, 0xca, 0x66, 0x74, 0x6e, 0xa5, 0x1a, 0x31, 0xae, 0x92,
- 0x2a, 0x3e, 0x74, 0x86, 0x48, 0x89, 0x54, 0x0a, 0x48, 0xdb, 0x27,
- 0xd7, 0xe4, 0xc9, 0x03, 0x11, 0x63, 0x8b, 0x22, 0x4b, 0xf0, 0x20,
- 0x1b, 0x50, 0x18, 0x91, 0x75, 0x48, 0x48, 0x11, 0x3c, 0x26, 0x61,
- 0x08, 0xd0, 0xad, 0xb1, 0x3d, 0xb7, 0x19, 0x09, 0xc7})),
- std::make_pair(
- 122,
- std::vector<uint8_t>(
- {0x58, 0x98, 0x3c, 0x21, 0x43, 0x3d, 0x95, 0x0c, 0xaa, 0x23, 0xe4,
- 0xbc, 0x18, 0x54, 0x3b, 0x8e, 0x60, 0x1c, 0x20, 0x43, 0x18, 0x53,
- 0x21, 0x52, 0xda, 0xf5, 0xe1, 0x59, 0xa0, 0xcd, 0x14, 0x80, 0x18,
- 0x3d, 0x29, 0x28, 0x5c, 0x05, 0xf1, 0x29, 0xcb, 0x0c, 0xc3, 0x16,
- 0x46, 0x87, 0x92, 0x80, 0x86, 0xff, 0xe3, 0x80, 0x15, 0x8d, 0xf1,
- 0xd3, 0x94, 0xc6, 0xac, 0x0d, 0x42, 0x88, 0xbc, 0xa8})),
- std::make_pair(
- 123,
- std::vector<uint8_t>(
- {0x81, 0x00, 0xa8, 0xdc, 0x52, 0x8d, 0x2b, 0x68, 0x2a, 0xb4, 0x25,
- 0x08, 0x01, 0xba, 0x33, 0xf0, 0x2a, 0x3e, 0x94, 0xc5, 0x4d, 0xac,
- 0x0a, 0xe1, 0x48, 0x2a, 0xa2, 0x1f, 0x51, 0xef, 0x3a, 0x82, 0xf3,
- 0x80, 0x7e, 0x6f, 0xac, 0xb0, 0xae, 0xb0, 0x59, 0x47, 0xbf, 0x7a,
- 0xa2, 0xad, 0xcb, 0x03, 0x43, 0x56, 0xf9, 0x0f, 0xa4, 0x56, 0x0e,
- 0xde, 0x02, 0x20, 0x1a, 0x37, 0xe4, 0x11, 0xec, 0x1a})),
- std::make_pair(
- 124,
- std::vector<uint8_t>(
- {0x07, 0x02, 0x5f, 0x1b, 0xb6, 0xc7, 0x84, 0xf3, 0xfe, 0x49, 0xde,
- 0x5c, 0x14, 0xb9, 0x36, 0xa5, 0xac, 0xac, 0xac, 0xaa, 0xb3, 0x3f,
- 0x6a, 0xc4, 0xd0, 0xe0, 0x0a, 0xb6, 0xa1, 0x24, 0x83, 0xd6, 0xbe,
- 0xc0, 0x0b, 0x4f, 0xe6, 0x7c, 0x7c, 0xa5, 0xcc, 0x50, 0x8c, 0x2a,
- 0x53, 0xef, 0xb5, 0xbf, 0xa5, 0x39, 0x87, 0x69, 0xd8, 0x43, 0xff,
- 0x0d, 0x9e, 0x8b, 0x14, 0xd3, 0x6a, 0x01, 0xa7, 0x7f})),
- std::make_pair(
- 125,
- std::vector<uint8_t>(
- {0xba, 0x6a, 0xef, 0xd9, 0x72, 0xb6, 0x18, 0x6e, 0x02, 0x7a, 0x76,
- 0x27, 0x3a, 0x4a, 0x72, 0x33, 0x21, 0xa3, 0xf5, 0x80, 0xcf, 0xa8,
- 0x94, 0xda, 0x5a, 0x9c, 0xe8, 0xe7, 0x21, 0xc8, 0x28, 0x55, 0x2c,
- 0x64, 0xda, 0xce, 0xe3, 0xa7, 0xfd, 0x2d, 0x74, 0x3b, 0x5c, 0x35,
- 0xad, 0x0c, 0x8e, 0xfa, 0x71, 0xf8, 0xce, 0x99, 0xbf, 0x96, 0x33,
- 0x47, 0x10, 0xe2, 0xc2, 0x34, 0x6e, 0x8f, 0x3c, 0x52})),
- std::make_pair(
- 126,
- std::vector<uint8_t>(
- {0xe0, 0x72, 0x1e, 0x02, 0x51, 0x7a, 0xed, 0xfa, 0x4e, 0x7e, 0x9b,
- 0xa5, 0x03, 0xe0, 0x25, 0xfd, 0x46, 0xe7, 0x14, 0x56, 0x6d, 0xc8,
- 0x89, 0xa8, 0x4c, 0xbf, 0xe5, 0x6a, 0x55, 0xdf, 0xbe, 0x2f, 0xc4,
- 0x93, 0x8a, 0xc4, 0x12, 0x05, 0x88, 0x33, 0x5d, 0xea, 0xc8, 0xef,
- 0x3f, 0xa2, 0x29, 0xad, 0xc9, 0x64, 0x7f, 0x54, 0xad, 0x2e, 0x34,
- 0x72, 0x23, 0x4f, 0x9b, 0x34, 0xef, 0xc4, 0x65, 0x43})),
- std::make_pair(
- 127,
- std::vector<uint8_t>(
- {0xb6, 0x29, 0x26, 0x69, 0xcc, 0xd3, 0x8d, 0x5f, 0x01, 0xca, 0xae,
- 0x96, 0xba, 0x27, 0x2c, 0x76, 0xa8, 0x79, 0xa4, 0x57, 0x43, 0xaf,
- 0xa0, 0x72, 0x5d, 0x83, 0xb9, 0xeb, 0xb2, 0x66, 0x65, 0xb7, 0x31,
- 0xf1, 0x84, 0x8c, 0x52, 0xf1, 0x19, 0x72, 0xb6, 0x64, 0x4f, 0x55,
- 0x4c, 0x06, 0x4f, 0xa9, 0x07, 0x80, 0xdb, 0xbb, 0xf3, 0xa8, 0x9d,
- 0x4f, 0xc3, 0x1f, 0x67, 0xdf, 0x3e, 0x58, 0x57, 0xef})),
- std::make_pair(
- 128,
- std::vector<uint8_t>(
- {0x23, 0x19, 0xe3, 0x78, 0x9c, 0x47, 0xe2, 0xda, 0xa5, 0xfe, 0x80,
- 0x7f, 0x61, 0xbe, 0xc2, 0xa1, 0xa6, 0x53, 0x7f, 0xa0, 0x3f, 0x19,
- 0xff, 0x32, 0xe8, 0x7e, 0xec, 0xbf, 0xd6, 0x4b, 0x7e, 0x0e, 0x8c,
- 0xcf, 0xf4, 0x39, 0xac, 0x33, 0x3b, 0x04, 0x0f, 0x19, 0xb0, 0xc4,
- 0xdd, 0xd1, 0x1a, 0x61, 0xe2, 0x4a, 0xc1, 0xfe, 0x0f, 0x10, 0xa0,
- 0x39, 0x80, 0x6c, 0x5d, 0xcc, 0x0d, 0xa3, 0xd1, 0x15})),
- std::make_pair(
- 129,
- std::vector<uint8_t>(
- {0xf5, 0x97, 0x11, 0xd4, 0x4a, 0x03, 0x1d, 0x5f, 0x97, 0xa9, 0x41,
- 0x3c, 0x06, 0x5d, 0x1e, 0x61, 0x4c, 0x41, 0x7e, 0xde, 0x99, 0x85,
- 0x90, 0x32, 0x5f, 0x49, 0xba, 0xd2, 0xfd, 0x44, 0x4d, 0x3e, 0x44,
- 0x18, 0xbe, 0x19, 0xae, 0xc4, 0xe1, 0x14, 0x49, 0xac, 0x1a, 0x57,
- 0x20, 0x78, 0x98, 0xbc, 0x57, 0xd7, 0x6a, 0x1b, 0xcf, 0x35, 0x66,
- 0x29, 0x2c, 0x20, 0xc6, 0x83, 0xa5, 0xc4, 0x64, 0x8f})),
- std::make_pair(
- 130,
- std::vector<uint8_t>(
- {0xdf, 0x0a, 0x9d, 0x0c, 0x21, 0x28, 0x43, 0xa6, 0xa9, 0x34, 0xe3,
- 0x90, 0x2b, 0x2d, 0xd3, 0x0d, 0x17, 0xfb, 0xa5, 0xf9, 0x69, 0xd2,
- 0x03, 0x0b, 0x12, 0xa5, 0x46, 0xd8, 0xa6, 0xa4, 0x5e, 0x80, 0xcf,
- 0x56, 0x35, 0xf0, 0x71, 0xf0, 0x45, 0x2e, 0x9c, 0x91, 0x92, 0x75,
- 0xda, 0x99, 0xbe, 0xd5, 0x1e, 0xb1, 0x17, 0x3c, 0x1a, 0xf0, 0x51,
- 0x87, 0x26, 0xb7, 0x5b, 0x0e, 0xc3, 0xba, 0xe2, 0xb5})),
- std::make_pair(
- 131,
- std::vector<uint8_t>(
- {0xa3, 0xeb, 0x6e, 0x6c, 0x7b, 0xf2, 0xfb, 0x8b, 0x28, 0xbf, 0xe8,
- 0xb1, 0x5e, 0x15, 0xbb, 0x50, 0x0f, 0x78, 0x1e, 0xcc, 0x86, 0xf7,
- 0x78, 0xc3, 0xa4, 0xe6, 0x55, 0xfc, 0x58, 0x69, 0xbf, 0x28, 0x46,
- 0xa2, 0x45, 0xd4, 0xe3, 0x3b, 0x7b, 0x14, 0x43, 0x6a, 0x17, 0xe6,
- 0x3b, 0xe7, 0x9b, 0x36, 0x65, 0x5c, 0x22, 0x6a, 0x50, 0xff, 0xbc,
- 0x71, 0x24, 0x20, 0x7b, 0x02, 0x02, 0x34, 0x2d, 0xb5})),
- std::make_pair(
- 132,
- std::vector<uint8_t>(
- {0x56, 0xd4, 0xcb, 0xcd, 0x07, 0x05, 0x63, 0x42, 0x6a, 0x01, 0x70,
- 0x69, 0x42, 0x5c, 0x2c, 0xd2, 0xae, 0x54, 0x06, 0x68, 0x28, 0x7a,
- 0x5f, 0xb9, 0xda, 0xc4, 0x32, 0xeb, 0x8a, 0xb1, 0xa3, 0x53, 0xa3,
- 0x0f, 0x2f, 0xe1, 0xf4, 0x0d, 0x83, 0x33, 0x3a, 0xfe, 0x69, 0x6a,
- 0x26, 0x77, 0x95, 0x40, 0x8a, 0x92, 0xfe, 0x7d, 0xa0, 0x7a, 0x0c,
- 0x18, 0x14, 0xcf, 0x77, 0xf3, 0x6e, 0x10, 0x5e, 0xe8})),
- std::make_pair(
- 133,
- std::vector<uint8_t>(
- {0xe5, 0x9b, 0x99, 0x87, 0xd4, 0x28, 0xb3, 0xed, 0xa3, 0x7d, 0x80,
- 0xab, 0xdb, 0x16, 0xcd, 0x2b, 0x0a, 0xef, 0x67, 0x4c, 0x2b, 0x1d,
- 0xda, 0x44, 0x32, 0xea, 0x91, 0xee, 0x6c, 0x93, 0x5c, 0x68, 0x4b,
- 0x48, 0xb4, 0x42, 0x8a, 0x8c, 0xc7, 0x40, 0xe5, 0x79, 0xa3, 0x0d,
- 0xef, 0xf3, 0x5a, 0x80, 0x30, 0x13, 0x82, 0x0d, 0xd2, 0x3f, 0x14,
- 0xae, 0x1d, 0x84, 0x13, 0xb5, 0xc8, 0x67, 0x2a, 0xec})),
- std::make_pair(
- 134,
- std::vector<uint8_t>(
- {0xcd, 0x9f, 0xcc, 0x99, 0xf9, 0x9d, 0x4c, 0xc1, 0x6d, 0x03, 0x19,
- 0x00, 0xb2, 0xa7, 0x36, 0xe1, 0x50, 0x8d, 0xb4, 0xb5, 0x86, 0x81,
- 0x4e, 0x63, 0x45, 0x85, 0x7f, 0x35, 0x4a, 0x70, 0xcc, 0xec, 0xb1,
- 0xdf, 0x3b, 0x50, 0xa1, 0x9a, 0xda, 0xf4, 0x3c, 0x27, 0x8e, 0xfa,
- 0x42, 0x3f, 0xf4, 0xbb, 0x6c, 0x52, 0x3e, 0xc7, 0xfd, 0x78, 0x59,
- 0xb9, 0x7b, 0x16, 0x8a, 0x7e, 0xbf, 0xf8, 0x46, 0x7c})),
- std::make_pair(
- 135,
- std::vector<uint8_t>(
- {0x06, 0x02, 0x18, 0x5d, 0x8c, 0x3a, 0x78, 0x73, 0x8b, 0x99, 0x16,
- 0x4b, 0x8b, 0xc6, 0xff, 0xb2, 0x1c, 0x7d, 0xeb, 0xeb, 0xbf, 0x80,
- 0x63, 0x72, 0xe0, 0xda, 0x44, 0xd1, 0x21, 0x54, 0x55, 0x97, 0xb9,
- 0xc6, 0x62, 0xa2, 0x55, 0xdc, 0x31, 0x54, 0x2c, 0xf9, 0x95, 0xec,
- 0xbe, 0x6a, 0x50, 0xfb, 0x5e, 0x6e, 0x0e, 0xe4, 0xef, 0x24, 0x0f,
- 0xe5, 0x57, 0xed, 0xed, 0x11, 0x88, 0x08, 0x7e, 0x86})),
- std::make_pair(
- 136,
- std::vector<uint8_t>(
- {0xc0, 0x8a, 0xfa, 0x5b, 0x92, 0x7b, 0xf0, 0x80, 0x97, 0xaf, 0xc5,
- 0xff, 0xf9, 0xca, 0x4e, 0x78, 0x00, 0x12, 0x5c, 0x1f, 0x52, 0xf2,
- 0xaf, 0x35, 0x53, 0xfa, 0x2b, 0x89, 0xe1, 0xe3, 0x01, 0x5c, 0x4f,
- 0x87, 0xd5, 0xe0, 0xa4, 0x89, 0x56, 0xad, 0x31, 0x45, 0x0b, 0x08,
- 0x3d, 0xad, 0x14, 0x7f, 0xfb, 0x5e, 0xc0, 0x34, 0x34, 0xa2, 0x68,
- 0x30, 0xcf, 0x37, 0xd1, 0x03, 0xab, 0x50, 0xc5, 0xda})),
- std::make_pair(
- 137,
- std::vector<uint8_t>(
- {0x36, 0xf1, 0xe1, 0xc1, 0x1d, 0x6e, 0xf6, 0xbc, 0x3b, 0x53, 0x6d,
- 0x50, 0x5d, 0x54, 0x4a, 0x87, 0x15, 0x22, 0xc5, 0xc2, 0xa2, 0x53,
- 0x06, 0x7e, 0xc9, 0x93, 0x3b, 0x6e, 0xc2, 0x54, 0x64, 0xda, 0xf9,
- 0x85, 0x52, 0x5f, 0x5b, 0x95, 0x60, 0xa1, 0x6d, 0x89, 0x02, 0x59,
- 0xac, 0x1b, 0xb5, 0xcc, 0x67, 0xc0, 0xc4, 0x69, 0xcd, 0xe1, 0x33,
- 0xde, 0xf0, 0x00, 0xea, 0x1d, 0x68, 0x6f, 0x4f, 0x5d})),
- std::make_pair(
- 138,
- std::vector<uint8_t>(
- {0xbf, 0x2a, 0xb2, 0xe2, 0x47, 0x0f, 0x54, 0x38, 0xc3, 0xb6, 0x89,
- 0xe6, 0x6e, 0x76, 0x86, 0xff, 0xfa, 0x0c, 0xb1, 0xe1, 0x79, 0x8a,
- 0xd3, 0xa8, 0x6f, 0xf9, 0x90, 0x75, 0xbf, 0x61, 0x38, 0xe3, 0x3d,
- 0x9c, 0x0c, 0xe5, 0x9a, 0xfb, 0x24, 0xac, 0x67, 0xa0, 0x2a, 0xf3,
- 0x44, 0x28, 0x19, 0x1a, 0x9a, 0x0a, 0x60, 0x41, 0xc0, 0x74, 0x71,
- 0xb7, 0xc3, 0xb1, 0xa7, 0x52, 0xd6, 0xfc, 0x0b, 0x8b})),
- std::make_pair(
- 139,
- std::vector<uint8_t>(
- {0xd4, 0x00, 0x60, 0x1f, 0x97, 0x28, 0xcc, 0xc4, 0xc9, 0x23, 0x42,
- 0xd9, 0x78, 0x7d, 0x8d, 0x28, 0xab, 0x32, 0x3a, 0xf3, 0x75, 0xca,
- 0x56, 0x24, 0xb4, 0xbb, 0x91, 0xd1, 0x72, 0x71, 0xfb, 0xae, 0x86,
- 0x2e, 0x41, 0x3b, 0xe7, 0x3f, 0x1f, 0x68, 0xe6, 0x15, 0xb8, 0xc5,
- 0xc3, 0x91, 0xbe, 0x0d, 0xbd, 0x91, 0x44, 0x74, 0x6e, 0xb3, 0x39,
- 0xad, 0x54, 0x15, 0x47, 0xba, 0x9c, 0x46, 0x8a, 0x17})),
- std::make_pair(
- 140,
- std::vector<uint8_t>(
- {0x79, 0xfe, 0x2f, 0xe1, 0x57, 0xeb, 0x85, 0xa0, 0x38, 0xab, 0xb8,
- 0xeb, 0xbc, 0x64, 0x77, 0x31, 0xd2, 0xc8, 0x3f, 0x51, 0xb0, 0xac,
- 0x6e, 0xe1, 0x4a, 0xa2, 0x84, 0xcb, 0x6a, 0x35, 0x49, 0xa4, 0xdc,
- 0xce, 0xb3, 0x00, 0x74, 0x0a, 0x82, 0x5f, 0x52, 0xf5, 0xfb, 0x30,
- 0xb0, 0x3b, 0x8c, 0x4d, 0x8b, 0x0f, 0x4a, 0xa6, 0x7a, 0x63, 0xf4,
- 0xa9, 0x4e, 0x33, 0x03, 0xc4, 0xed, 0xa4, 0xc0, 0x2b})),
- std::make_pair(
- 141,
- std::vector<uint8_t>(
- {0x75, 0x35, 0x13, 0x13, 0xb5, 0x2a, 0x85, 0x29, 0x29, 0x8d, 0x8c,
- 0x18, 0x6b, 0x17, 0x68, 0x66, 0x6d, 0xcc, 0xa8, 0x59, 0x53, 0x17,
- 0xd7, 0xa4, 0x81, 0x6e, 0xb8, 0x8c, 0x06, 0x20, 0x20, 0xc0, 0xc8,
- 0xef, 0xc5, 0x54, 0xbb, 0x34, 0x1b, 0x64, 0x68, 0x8d, 0xb5, 0xcc,
- 0xaf, 0xc3, 0x5f, 0x3c, 0x3c, 0xd0, 0x9d, 0x65, 0x64, 0xb3, 0x6d,
- 0x7b, 0x04, 0xa2, 0x48, 0xe1, 0x46, 0x98, 0x0d, 0x4b})),
- std::make_pair(
- 142,
- std::vector<uint8_t>(
- {0xe3, 0x12, 0x8b, 0x1d, 0x31, 0x1d, 0x02, 0x17, 0x9d, 0x7f, 0x25,
- 0xf9, 0x7a, 0x5a, 0x8b, 0xee, 0x2c, 0xc8, 0xc8, 0x63, 0x03, 0x64,
- 0x4f, 0xcd, 0x66, 0x4e, 0x15, 0x7d, 0x1f, 0xef, 0x00, 0xf2, 0x3e,
- 0x46, 0xf9, 0xa5, 0xe8, 0xe5, 0xc8, 0x90, 0xce, 0x56, 0x5b, 0xb6,
- 0xab, 0xd4, 0x30, 0x2c, 0xe0, 0x64, 0x69, 0xd5, 0x2a, 0x5b, 0xd5,
- 0x3e, 0x1c, 0x5a, 0x54, 0xd0, 0x46, 0x49, 0xdc, 0x03})),
- std::make_pair(
- 143,
- std::vector<uint8_t>(
- {0xc2, 0x38, 0x2a, 0x72, 0xd2, 0xd3, 0xac, 0xe9, 0xd5, 0x93, 0x3d,
- 0x00, 0xb6, 0x08, 0x27, 0xed, 0x38, 0x0c, 0xda, 0x08, 0xd0, 0xba,
- 0x5f, 0x6d, 0xd4, 0x1e, 0x29, 0xee, 0x6d, 0xbe, 0x8e, 0xcb, 0x92,
- 0x35, 0xf0, 0x6b, 0xe9, 0x5d, 0x83, 0xb6, 0x81, 0x6a, 0x2f, 0xb7,
- 0xa5, 0xad, 0x47, 0x03, 0x5e, 0x8a, 0x4b, 0x69, 0xa4, 0x88, 0x4b,
- 0x99, 0xe4, 0xbe, 0xce, 0x58, 0xca, 0xb2, 0x5d, 0x44})),
- std::make_pair(
- 144,
- std::vector<uint8_t>(
- {0x6b, 0x1c, 0x69, 0x46, 0x0b, 0xbd, 0x50, 0xac, 0x2e, 0xd6, 0xf3,
- 0x2e, 0x6e, 0x88, 0x7c, 0xfe, 0xd4, 0x07, 0xd4, 0x7d, 0xcf, 0x0a,
- 0xaa, 0x60, 0x38, 0x7f, 0xe3, 0x20, 0xd7, 0x80, 0xbd, 0x03, 0xea,
- 0xb6, 0xd7, 0xba, 0xeb, 0x2a, 0x07, 0xd1, 0x0c, 0xd5, 0x52, 0xa3,
- 0x00, 0x34, 0x13, 0x54, 0xea, 0x9a, 0x5f, 0x03, 0x18, 0x3a, 0x62,
- 0x3f, 0x92, 0xa2, 0xd4, 0xd9, 0xf0, 0x09, 0x26, 0xaf})),
- std::make_pair(
- 145,
- std::vector<uint8_t>(
- {0x6c, 0xda, 0x20, 0x6c, 0x80, 0xcd, 0xc9, 0xc4, 0x4b, 0xa9, 0x90,
- 0xe0, 0x32, 0x8c, 0x31, 0x4f, 0x81, 0x9b, 0x14, 0x2d, 0x00, 0x63,
- 0x04, 0x04, 0xc4, 0x8c, 0x05, 0xdc, 0x76, 0xd1, 0xb0, 0x0c, 0xe4,
- 0xd7, 0x2f, 0xc6, 0xa4, 0x8e, 0x14, 0x69, 0xdd, 0xef, 0x60, 0x94,
- 0x12, 0xc3, 0x64, 0x82, 0x08, 0x54, 0x21, 0x4b, 0x48, 0x69, 0xaf,
- 0x09, 0x0f, 0x00, 0xd3, 0xc1, 0xba, 0x44, 0x3e, 0x1b})),
- std::make_pair(
- 146,
- std::vector<uint8_t>(
- {0x7f, 0xfc, 0x8c, 0x26, 0xfb, 0xd6, 0xa0, 0xf7, 0xa6, 0x09, 0xe6,
- 0xe1, 0x93, 0x9f, 0x6a, 0x9e, 0xdf, 0x1b, 0x0b, 0x06, 0x66, 0x41,
- 0xfb, 0x76, 0xc4, 0xf9, 0x60, 0x2e, 0xd7, 0x48, 0xd1, 0x16, 0x02,
- 0x49, 0x6b, 0x35, 0x35, 0x5b, 0x1a, 0xa2, 0x55, 0x85, 0x0a, 0x50,
- 0x9d, 0x2f, 0x8e, 0xe1, 0x8c, 0x8f, 0x3e, 0x1d, 0x7d, 0xcb, 0xc3,
- 0x7a, 0x13, 0x65, 0x98, 0xf5, 0x6a, 0x59, 0xed, 0x17})),
- std::make_pair(
- 147,
- std::vector<uint8_t>(
- {0x70, 0xde, 0x1f, 0x08, 0xdd, 0x4e, 0x09, 0xd5, 0xfc, 0x15, 0x1f,
- 0x17, 0xfc, 0x99, 0x1a, 0x23, 0xab, 0xfc, 0x05, 0x10, 0x42, 0x90,
- 0xd5, 0x04, 0x68, 0x88, 0x2e, 0xfa, 0xf5, 0x82, 0xb6, 0xec, 0x2f,
- 0x14, 0xf5, 0x77, 0xc0, 0xd6, 0x8c, 0x3a, 0xd0, 0x66, 0x26, 0x91,
- 0x6e, 0x3c, 0x86, 0xe6, 0xda, 0xab, 0x6c, 0x53, 0xe5, 0x16, 0x3e,
- 0x82, 0xb6, 0xbd, 0x0c, 0xe4, 0x9f, 0xc0, 0xd8, 0xdf})),
- std::make_pair(
- 148,
- std::vector<uint8_t>(
- {0x4f, 0x81, 0x93, 0x57, 0x56, 0xed, 0x35, 0xee, 0x20, 0x58, 0xee,
- 0x0c, 0x6a, 0x61, 0x10, 0xd6, 0xfa, 0xc5, 0xcb, 0x6a, 0x4f, 0x46,
- 0xaa, 0x94, 0x11, 0x60, 0x3f, 0x99, 0x96, 0x58, 0x23, 0xb6, 0xda,
- 0x48, 0x38, 0x27, 0x6c, 0x5c, 0x06, 0xbc, 0x78, 0x80, 0xe3, 0x76,
- 0xd9, 0x27, 0x58, 0x36, 0x9e, 0xe7, 0x30, 0x5b, 0xce, 0xc8, 0xd3,
- 0xcf, 0xd2, 0x8c, 0xca, 0xbb, 0x7b, 0x4f, 0x05, 0x79})),
- std::make_pair(
- 149,
- std::vector<uint8_t>(
- {0xab, 0xcb, 0x61, 0xcb, 0x36, 0x83, 0xd1, 0x8f, 0x27, 0xad, 0x52,
- 0x79, 0x08, 0xed, 0x2d, 0x32, 0xa0, 0x42, 0x6c, 0xb7, 0xbb, 0x4b,
- 0xf1, 0x80, 0x61, 0x90, 0x3a, 0x7d, 0xc4, 0x2e, 0x7e, 0x76, 0xf9,
- 0x82, 0x38, 0x23, 0x04, 0xd1, 0x8a, 0xf8, 0xc8, 0x0d, 0x91, 0xdd,
- 0x58, 0xdd, 0x47, 0xaf, 0x76, 0xf8, 0xe2, 0xc3, 0x6e, 0x28, 0xaf,
- 0x24, 0x76, 0xb4, 0xbc, 0xcf, 0x82, 0xe8, 0x9f, 0xdf})),
- std::make_pair(
- 150,
- std::vector<uint8_t>(
- {0x02, 0xd2, 0x61, 0xad, 0x56, 0xa5, 0x26, 0x33, 0x1b, 0x64, 0x3d,
- 0xd2, 0x18, 0x6d, 0xe9, 0xa8, 0x2e, 0x72, 0xa5, 0x82, 0x23, 0xcd,
- 0x1e, 0x72, 0x36, 0x86, 0xc5, 0x3d, 0x86, 0x9b, 0x83, 0xb9, 0x46,
- 0x32, 0xb7, 0xb6, 0x47, 0xab, 0x2a, 0xfc, 0x0d, 0x52, 0x2e, 0x29,
- 0xda, 0x3a, 0x56, 0x15, 0xb7, 0x41, 0xd8, 0x28, 0x52, 0xe0, 0xdf,
- 0x41, 0xb6, 0x60, 0x07, 0xdb, 0xcb, 0xa9, 0x05, 0x43})),
- std::make_pair(
- 151,
- std::vector<uint8_t>(
- {0xc5, 0x83, 0x27, 0x41, 0xfa, 0x30, 0xc5, 0x43, 0x68, 0x23, 0x01,
- 0x53, 0x83, 0xd2, 0x97, 0xff, 0x4c, 0x4a, 0x5d, 0x72, 0x76, 0xc3,
- 0xf9, 0x02, 0x12, 0x20, 0x66, 0xe0, 0x4b, 0xe5, 0x43, 0x1b, 0x1a,
- 0x85, 0xfa, 0xf7, 0x3b, 0x91, 0x84, 0x34, 0xf9, 0x30, 0x09, 0x63,
- 0xd1, 0xde, 0xa9, 0xe8, 0xac, 0x39, 0x24, 0xef, 0x49, 0x02, 0x26,
- 0xed, 0xee, 0xa5, 0xf7, 0x43, 0xe4, 0x10, 0x66, 0x9f})),
- std::make_pair(
- 152,
- std::vector<uint8_t>(
- {0xcf, 0xae, 0xab, 0x26, 0x8c, 0xd0, 0x75, 0xa5, 0xa6, 0xae, 0xd5,
- 0x15, 0x02, 0x3a, 0x03, 0x2d, 0x54, 0xf2, 0xf2, 0xff, 0x73, 0x3c,
- 0xe0, 0xcb, 0xc7, 0x8d, 0xb5, 0x1d, 0xb4, 0x50, 0x4d, 0x67, 0x59,
- 0x23, 0xf8, 0x27, 0x46, 0xd6, 0x59, 0x46, 0x06, 0xad, 0x5d, 0x67,
- 0x73, 0x4b, 0x11, 0xa6, 0x7c, 0xc6, 0xa4, 0x68, 0xc2, 0x03, 0x2e,
- 0x43, 0xca, 0x1a, 0x94, 0xc6, 0x27, 0x3a, 0x98, 0x5e})),
- std::make_pair(
- 153,
- std::vector<uint8_t>(
- {0x86, 0x08, 0x50, 0xf9, 0x2e, 0xb2, 0x68, 0x27, 0x2b, 0x67, 0xd1,
- 0x33, 0x60, 0x9b, 0xd6, 0x4e, 0x34, 0xf6, 0x1b, 0xf0, 0x3f, 0x4c,
- 0x17, 0x38, 0x64, 0x5c, 0x17, 0xfe, 0xc8, 0x18, 0x46, 0x5d, 0x7e,
- 0xcd, 0x2b, 0xe2, 0x90, 0x76, 0x41, 0x13, 0x00, 0x25, 0xfd, 0xa7,
- 0x94, 0x70, 0xab, 0x73, 0x16, 0x46, 0xe7, 0xf6, 0x94, 0x40, 0xe8,
- 0x36, 0x7e, 0xa7, 0x6a, 0xc4, 0xce, 0xe8, 0xa1, 0xdf})),
- std::make_pair(
- 154,
- std::vector<uint8_t>(
- {0x84, 0xb1, 0x54, 0xed, 0x29, 0xbb, 0xed, 0xef, 0xa6, 0x48, 0x28,
- 0x68, 0x39, 0x04, 0x6f, 0x4b, 0x5a, 0xa3, 0x44, 0x30, 0xe2, 0xd6,
- 0x7f, 0x74, 0x96, 0xe4, 0xc3, 0x9f, 0x2c, 0x7e, 0xa7, 0x89, 0x95,
- 0xf6, 0x9e, 0x12, 0x92, 0x20, 0x00, 0x16, 0xf1, 0x6a, 0xc3, 0xb3,
- 0x77, 0x00, 0xe6, 0xc7, 0xe7, 0x86, 0x1a, 0xfc, 0x39, 0x6b, 0x64,
- 0xa5, 0x9a, 0x1d, 0xbf, 0x47, 0xa5, 0x5c, 0x4b, 0xbc})),
- std::make_pair(
- 155,
- std::vector<uint8_t>(
- {0xae, 0xee, 0xc2, 0x60, 0xa5, 0xd8, 0xef, 0xf5, 0xcc, 0xab, 0x8b,
- 0x95, 0xda, 0x43, 0x5a, 0x63, 0xed, 0x7a, 0x21, 0xea, 0x7f, 0xc7,
- 0x55, 0x94, 0x13, 0xfd, 0x61, 0x7e, 0x33, 0x60, 0x9f, 0x8c, 0x29,
- 0x0e, 0x64, 0xbb, 0xac, 0xc5, 0x28, 0xf6, 0xc0, 0x80, 0x26, 0x22,
- 0x88, 0xb0, 0xf0, 0xa3, 0x21, 0x9b, 0xe2, 0x23, 0xc9, 0x91, 0xbe,
- 0xe9, 0x2e, 0x72, 0x34, 0x95, 0x93, 0xe6, 0x76, 0x38})),
- std::make_pair(
- 156,
- std::vector<uint8_t>(
- {0x8a, 0xd7, 0x8a, 0x9f, 0x26, 0x60, 0x1d, 0x12, 0x7e, 0x8d, 0x2f,
- 0x2f, 0x97, 0x6e, 0x63, 0xd1, 0x9a, 0x05, 0x4a, 0x17, 0xdc, 0xf5,
- 0x9e, 0x0f, 0x01, 0x3a, 0xb5, 0x4a, 0x68, 0x87, 0xbb, 0xdf, 0xfd,
- 0xe7, 0xaa, 0xae, 0x11, 0x7e, 0x0f, 0xbf, 0x32, 0x71, 0x01, 0x65,
- 0x95, 0xb9, 0xd9, 0xc7, 0x12, 0xc0, 0x1b, 0x2c, 0x53, 0xe9, 0x65,
- 0x5a, 0x38, 0x2b, 0xc4, 0x52, 0x2e, 0x61, 0x66, 0x45})),
- std::make_pair(
- 157,
- std::vector<uint8_t>(
- {0x89, 0x34, 0x15, 0x9d, 0xad, 0xe1, 0xac, 0x74, 0x14, 0x7d, 0xfa,
- 0x28, 0x2c, 0x75, 0x95, 0x4f, 0xce, 0xf4, 0x43, 0xef, 0x25, 0xf8,
- 0x0d, 0xfe, 0x9f, 0xb6, 0xea, 0x63, 0x3b, 0x85, 0x45, 0x11, 0x1d,
- 0x08, 0xb3, 0x4e, 0xf4, 0x3f, 0xff, 0x17, 0x02, 0x6c, 0x79, 0x64,
- 0xf5, 0xde, 0xac, 0x6d, 0x2b, 0x3c, 0x29, 0xda, 0xcf, 0x27, 0x47,
- 0xf0, 0x22, 0xdf, 0x59, 0x67, 0xdf, 0xdc, 0x1a, 0x0a})),
- std::make_pair(
- 158,
- std::vector<uint8_t>(
- {0xcd, 0x36, 0xdd, 0x0b, 0x24, 0x06, 0x14, 0xcf, 0x2f, 0xa2, 0xb9,
- 0xe9, 0x59, 0x67, 0x9d, 0xcd, 0xd7, 0x2e, 0xc0, 0xcd, 0x58, 0xa4,
- 0x3d, 0xa3, 0x79, 0x0a, 0x92, 0xf6, 0xcd, 0xeb, 0x9e, 0x1e, 0x79,
- 0x5e, 0x47, 0x8a, 0x0a, 0x47, 0xd3, 0x71, 0x10, 0x0d, 0x34, 0x0c,
- 0x5c, 0xed, 0xcd, 0xbb, 0xc9, 0xe6, 0x8b, 0x3f, 0x46, 0x08, 0x18,
- 0xe5, 0xbd, 0xff, 0x7b, 0x4c, 0xda, 0x4c, 0x27, 0x44})),
- std::make_pair(
- 159,
- std::vector<uint8_t>(
- {0x00, 0xdf, 0x4e, 0x09, 0x9b, 0x80, 0x71, 0x37, 0xa8, 0x59, 0x90,
- 0xf4, 0x9d, 0x3a, 0x94, 0x31, 0x5e, 0x5a, 0x5f, 0x7f, 0x7a, 0x60,
- 0x76, 0xb3, 0x03, 0xe9, 0x6b, 0x05, 0x6f, 0xb9, 0x38, 0x00, 0x11,
- 0x1f, 0x47, 0x96, 0x28, 0xe2, 0xf8, 0xdb, 0x59, 0xae, 0xb6, 0xac,
- 0x70, 0xc3, 0xb6, 0x1f, 0x51, 0xf9, 0xb4, 0x6e, 0x80, 0xff, 0xde,
- 0xae, 0x25, 0xeb, 0xdd, 0xb4, 0xaf, 0x6c, 0xb4, 0xee})),
- std::make_pair(
- 160,
- std::vector<uint8_t>(
- {0x2b, 0x9c, 0x95, 0x5e, 0x6c, 0xae, 0xd4, 0xb7, 0xc9, 0xe2, 0x46,
- 0xb8, 0x6f, 0x9a, 0x17, 0x26, 0xe8, 0x10, 0xc5, 0x9d, 0x12, 0x6c,
- 0xee, 0x66, 0xed, 0x71, 0xbf, 0x01, 0x5b, 0x83, 0x55, 0x8a, 0x4b,
- 0x6d, 0x84, 0xd1, 0x8d, 0xc3, 0xff, 0x46, 0x20, 0xc2, 0xff, 0xb7,
- 0x22, 0x35, 0x9f, 0xde, 0xf8, 0x5b, 0xa0, 0xd4, 0xe2, 0xd2, 0x2e,
- 0xcb, 0xe0, 0xed, 0x78, 0x4f, 0x99, 0xaf, 0xe5, 0x87})),
- std::make_pair(
- 161,
- std::vector<uint8_t>(
- {0x18, 0x1d, 0xf0, 0xa2, 0x61, 0xa2, 0xf7, 0xd2, 0x9e, 0xa5, 0xa1,
- 0x57, 0x72, 0x71, 0x51, 0x05, 0xd4, 0x50, 0xa4, 0xb6, 0xc2, 0x36,
- 0xf6, 0x99, 0xf4, 0x62, 0xd6, 0x0c, 0xa7, 0x64, 0x87, 0xfe, 0xed,
- 0xfc, 0x9f, 0x5e, 0xb9, 0x2d, 0xf8, 0x38, 0xe8, 0xfb, 0x5d, 0xc3,
- 0x69, 0x4e, 0x84, 0xc5, 0xe0, 0xf4, 0xa1, 0x0b, 0x76, 0x1f, 0x50,
- 0x67, 0x62, 0xbe, 0x05, 0x2c, 0x74, 0x5a, 0x6e, 0xe8})),
- std::make_pair(
- 162,
- std::vector<uint8_t>(
- {0x21, 0xfb, 0x20, 0x34, 0x58, 0xbf, 0x3a, 0x7e, 0x9a, 0x80, 0x43,
- 0x9f, 0x9a, 0x90, 0x28, 0x99, 0xcd, 0x5d, 0xe0, 0x13, 0x9d, 0xfd,
- 0x56, 0xf7, 0x11, 0x0c, 0x9d, 0xec, 0x84, 0x37, 0xb2, 0x6b, 0xda,
- 0x63, 0xde, 0x2f, 0x56, 0x59, 0x26, 0xd8, 0x5e, 0xdb, 0x1d, 0x6c,
- 0x68, 0x25, 0x66, 0x97, 0x43, 0xdd, 0x99, 0x92, 0x65, 0x3d, 0x13,
- 0x97, 0x95, 0x44, 0xd5, 0xdc, 0x82, 0x28, 0xbf, 0xaa})),
- std::make_pair(
- 163,
- std::vector<uint8_t>(
- {0xef, 0x02, 0x1f, 0x29, 0xc5, 0xff, 0xb8, 0x30, 0xe6, 0x4b, 0x9a,
- 0xa9, 0x05, 0x8d, 0xd6, 0x60, 0xfd, 0x2f, 0xcb, 0x81, 0xc4, 0x97,
- 0xa7, 0xe6, 0x98, 0xbc, 0xfb, 0xf5, 0x9d, 0xe5, 0xad, 0x4a, 0x86,
- 0xff, 0x93, 0xc1, 0x0a, 0x4b, 0x9d, 0x1a, 0xe5, 0x77, 0x47, 0x25,
- 0xf9, 0x07, 0x2d, 0xcd, 0xe9, 0xe1, 0xf1, 0x99, 0xba, 0xb9, 0x1f,
- 0x8b, 0xff, 0x92, 0x18, 0x64, 0xaa, 0x50, 0x2e, 0xee})),
- std::make_pair(
- 164,
- std::vector<uint8_t>(
- {0xb3, 0xcf, 0xda, 0x40, 0x52, 0x6b, 0x7f, 0x1d, 0x37, 0x56, 0x9b,
- 0xdf, 0xcd, 0xf9, 0x11, 0xe5, 0xa6, 0xef, 0xe6, 0xb2, 0xec, 0x90,
- 0xa0, 0x45, 0x4c, 0x47, 0xb2, 0xc0, 0x46, 0xbf, 0x13, 0x0f, 0xc3,
- 0xb3, 0x52, 0xb3, 0x4d, 0xf4, 0x81, 0x3d, 0x48, 0xd3, 0x3a, 0xb8,
- 0xe2, 0x69, 0xb6, 0x9b, 0x07, 0x56, 0x76, 0xcb, 0x6d, 0x00, 0xa8,
- 0xdc, 0xf9, 0xe1, 0xf9, 0x67, 0xec, 0x19, 0x1b, 0x2c})),
- std::make_pair(
- 165,
- std::vector<uint8_t>(
- {0xb4, 0xc6, 0xc3, 0xb2, 0x67, 0x07, 0x1e, 0xef, 0xb9, 0xc8, 0xc7,
- 0x2e, 0x0e, 0x2b, 0x94, 0x12, 0x93, 0x64, 0x1f, 0x86, 0x73, 0xcb,
- 0x70, 0xc1, 0xcc, 0x26, 0xad, 0x1e, 0x73, 0xcf, 0x14, 0x17, 0x55,
- 0x86, 0x0a, 0xd1, 0x9b, 0x34, 0xc2, 0xf3, 0x4e, 0xd3, 0x5b, 0xb5,
- 0x2e, 0xc4, 0x50, 0x7c, 0xc1, 0xfe, 0x59, 0x04, 0x77, 0x43, 0xa5,
- 0xf0, 0xc6, 0xfe, 0xbd, 0xe6, 0x25, 0xe2, 0x60, 0x91})),
- std::make_pair(
- 166,
- std::vector<uint8_t>(
- {0x57, 0xa3, 0x4f, 0x2b, 0xcc, 0xa6, 0x0d, 0x4b, 0x85, 0x10, 0x3b,
- 0x83, 0x0c, 0x9d, 0x79, 0x52, 0xa4, 0x16, 0xbe, 0x52, 0x63, 0xae,
- 0x42, 0x9c, 0x9e, 0x5e, 0x53, 0xfe, 0x85, 0x90, 0xa8, 0xf7, 0x8e,
- 0xc6, 0x5a, 0x51, 0x10, 0x9e, 0xa8, 0x5d, 0xcd, 0xf7, 0xb6, 0x22,
- 0x3f, 0x9f, 0x2b, 0x34, 0x05, 0x39, 0xfa, 0xd8, 0x19, 0x23, 0xdb,
- 0xf8, 0xed, 0xab, 0xf9, 0x51, 0x29, 0xe4, 0xdf, 0xf6})),
- std::make_pair(
- 167,
- std::vector<uint8_t>(
- {0x9c, 0xf4, 0x66, 0x62, 0xfc, 0xd6, 0x1a, 0x23, 0x22, 0x77, 0xb6,
- 0x85, 0x66, 0x3b, 0x8b, 0x5d, 0xa8, 0x32, 0xdf, 0xd9, 0xa3, 0xb8,
- 0xcc, 0xfe, 0xec, 0x99, 0x3e, 0xc6, 0xac, 0x41, 0x5a, 0xd0, 0x7e,
- 0x04, 0x8a, 0xdf, 0xe4, 0x14, 0xdf, 0x27, 0x27, 0x70, 0xdb, 0xa8,
- 0x67, 0xda, 0x5c, 0x12, 0x24, 0xc6, 0xfd, 0x0a, 0xa0, 0xc2, 0x18,
- 0x7d, 0x42, 0x6a, 0xc6, 0x47, 0xe9, 0x88, 0x73, 0x61})),
- std::make_pair(
- 168,
- std::vector<uint8_t>(
- {0x5c, 0xe1, 0x04, 0x2a, 0xb4, 0xd5, 0x42, 0xc2, 0xf9, 0xee, 0x9d,
- 0x17, 0x26, 0x2a, 0xf8, 0x16, 0x40, 0x98, 0x93, 0x5b, 0xef, 0x17,
- 0x3d, 0x0e, 0x18, 0x48, 0x9b, 0x04, 0x84, 0x17, 0x46, 0xcd, 0x2f,
- 0x2d, 0xf8, 0x66, 0xbd, 0x7d, 0xa6, 0xe5, 0xef, 0x90, 0x24, 0xc6,
- 0x48, 0x02, 0x3e, 0xc7, 0x23, 0xab, 0x9c, 0x62, 0xfd, 0x80, 0x28,
- 0x57, 0x39, 0xd8, 0x4f, 0x15, 0xd2, 0xab, 0x51, 0x5a})),
- std::make_pair(
- 169,
- std::vector<uint8_t>(
- {0x84, 0x88, 0x39, 0x6b, 0xd4, 0xa8, 0x72, 0x9b, 0x7a, 0x47, 0x31,
- 0x78, 0xf2, 0x32, 0xda, 0xdf, 0x3f, 0x0f, 0x8e, 0x22, 0x67, 0x8b,
- 0xa5, 0xa4, 0x3e, 0x04, 0x1e, 0x72, 0xda, 0x1e, 0x2c, 0xf8, 0x21,
- 0x94, 0xc3, 0x07, 0x20, 0x7a, 0x54, 0xcb, 0x81, 0x56, 0x29, 0x33,
- 0x39, 0xea, 0xec, 0x69, 0x3f, 0xf6, 0x6b, 0xfc, 0xd5, 0xef, 0xc6,
- 0x5e, 0x95, 0xe4, 0xec, 0xaf, 0x54, 0x53, 0x0a, 0xbd})),
- std::make_pair(
- 170,
- std::vector<uint8_t>(
- {0xf5, 0x98, 0xda, 0x90, 0x1c, 0x38, 0x35, 0xbc, 0xa5, 0x60, 0x77,
- 0x90, 0x37, 0xdf, 0xde, 0x9f, 0x0c, 0x51, 0xdc, 0x61, 0xc0, 0xb7,
- 0x60, 0xfc, 0x15, 0x22, 0xd7, 0xb4, 0x70, 0xee, 0x63, 0xf5, 0xbd,
- 0xc6, 0x49, 0x84, 0x76, 0xe8, 0x60, 0x49, 0xad, 0x86, 0xe4, 0xe2,
- 0x1a, 0xf2, 0x85, 0x4a, 0x98, 0x4c, 0xc9, 0x05, 0x42, 0x7d, 0x2f,
- 0x17, 0xf6, 0x6b, 0x1f, 0x41, 0xc3, 0xda, 0x6f, 0x61})),
- std::make_pair(
- 171,
- std::vector<uint8_t>(
- {0x5f, 0x93, 0x26, 0x97, 0x98, 0xcf, 0x02, 0x13, 0x21, 0x07, 0x33,
- 0x76, 0x60, 0xa8, 0xd7, 0xa1, 0x77, 0x35, 0x4c, 0x02, 0x12, 0xeb,
- 0x93, 0xe5, 0x55, 0xe7, 0xc3, 0x7a, 0x08, 0xae, 0xf3, 0xd8, 0xdc,
- 0xe0, 0x12, 0x17, 0x01, 0x1c, 0xd9, 0x65, 0xc0, 0x4d, 0xd2, 0xc1,
- 0x05, 0xf2, 0xe2, 0xb6, 0xca, 0xe5, 0xe4, 0xe6, 0xbc, 0xaf, 0x09,
- 0xdf, 0xbe, 0xe3, 0xe0, 0xa6, 0xa6, 0x35, 0x7c, 0x37})),
- std::make_pair(
- 172,
- std::vector<uint8_t>(
- {0x0e, 0xcf, 0x58, 0x1d, 0x47, 0xba, 0xc9, 0x23, 0x09, 0x86, 0xfa,
- 0xab, 0xd7, 0x0c, 0x2f, 0x5b, 0x80, 0xe9, 0x10, 0x66, 0xf0, 0xec,
- 0x55, 0xa8, 0x42, 0x93, 0x78, 0x82, 0x28, 0x6d, 0x2c, 0xa0, 0x07,
- 0xbb, 0x4e, 0x97, 0x3b, 0x0b, 0x09, 0x1d, 0x52, 0x16, 0x7f, 0xf7,
- 0xc4, 0x00, 0x9c, 0x7a, 0xb4, 0xad, 0x38, 0xff, 0xf1, 0xdc, 0xea,
- 0xcd, 0xb7, 0xbe, 0x81, 0xef, 0x4a, 0x45, 0x29, 0x52})),
- std::make_pair(
- 173,
- std::vector<uint8_t>(
- {0x5a, 0xec, 0xa8, 0xab, 0xe1, 0x52, 0x85, 0x82, 0xb2, 0xa3, 0x07,
- 0xb4, 0x00, 0x95, 0x85, 0x49, 0x8a, 0x3d, 0x46, 0x7c, 0xa6, 0x10,
- 0x1c, 0xb0, 0xc5, 0x12, 0x6f, 0x99, 0x76, 0x05, 0x6e, 0x9f, 0xfc,
- 0x12, 0x3c, 0xc2, 0x0c, 0x30, 0x2b, 0x2a, 0x73, 0x7f, 0x49, 0x2c,
- 0x75, 0xd2, 0x1f, 0x01, 0x51, 0x2c, 0x90, 0xca, 0x05, 0x41, 0xdf,
- 0xa5, 0x6e, 0x95, 0x0a, 0x32, 0x1d, 0xcb, 0x28, 0xd8})),
- std::make_pair(
- 174,
- std::vector<uint8_t>(
- {0x73, 0x2f, 0xbf, 0x8f, 0x1c, 0xb2, 0xb8, 0x32, 0x92, 0x63, 0xed,
- 0xe2, 0x78, 0x58, 0xfe, 0x46, 0xf8, 0xd3, 0x35, 0x4d, 0x37, 0x6b,
- 0xcd, 0xa0, 0x54, 0x8e, 0x7c, 0xe1, 0xfa, 0x9d, 0xd1, 0x1f, 0x85,
- 0xeb, 0x66, 0x1f, 0xe9, 0x50, 0xb5, 0x43, 0xaa, 0x63, 0x5c, 0xa4,
- 0xd3, 0xf0, 0x4e, 0xde, 0x5b, 0x32, 0xd6, 0xb6, 0x56, 0xe5, 0xce,
- 0x1c, 0x44, 0xd3, 0x5c, 0x4a, 0x6c, 0x56, 0xcf, 0xf8})),
- std::make_pair(
- 175,
- std::vector<uint8_t>(
- {0xd5, 0xe9, 0x38, 0x73, 0x5d, 0x63, 0x78, 0x8c, 0x80, 0x10, 0x0a,
- 0xef, 0xd1, 0x86, 0x48, 0xd1, 0x8c, 0xf2, 0x72, 0xf6, 0x9f, 0x20,
- 0xff, 0x24, 0xcf, 0xe2, 0x89, 0x5c, 0x08, 0x8a, 0xd0, 0x8b, 0x01,
- 0x04, 0xda, 0x16, 0x72, 0xa4, 0xeb, 0x26, 0xfc, 0x52, 0x54, 0x5c,
- 0xc7, 0xd7, 0xa0, 0x1b, 0x26, 0x6c, 0xf5, 0x46, 0xc4, 0x03, 0xc4,
- 0x5b, 0xd1, 0x29, 0xeb, 0x41, 0xbd, 0xd9, 0x20, 0x0b})),
- std::make_pair(
- 176,
- std::vector<uint8_t>(
- {0x65, 0xa2, 0x45, 0xb4, 0x93, 0x52, 0xee, 0x29, 0x7d, 0x91, 0xaf,
- 0x8c, 0x8b, 0xe0, 0x05, 0x28, 0xac, 0x6e, 0x04, 0x6d, 0xd8, 0x3a,
- 0xc7, 0xbd, 0x46, 0x5a, 0x98, 0x81, 0x6d, 0xd6, 0x8f, 0x3e, 0x00,
- 0xe1, 0xae, 0x8f, 0x89, 0x53, 0x27, 0xa7, 0xe9, 0xa8, 0xc9, 0x32,
- 0x65, 0x98, 0x37, 0x9a, 0x29, 0xc9, 0xfc, 0x91, 0xec, 0x0c, 0x6e,
- 0xef, 0x08, 0xf3, 0xe2, 0xb2, 0x16, 0xc1, 0x10, 0x08})),
- std::make_pair(
- 177,
- std::vector<uint8_t>(
- {0xc9, 0x56, 0x54, 0xb6, 0x30, 0x19, 0x13, 0x0a, 0xb4, 0x5d, 0xd0,
- 0xfb, 0x49, 0x41, 0xb9, 0x8a, 0xeb, 0x3a, 0xf2, 0xa1, 0x23, 0x91,
- 0x3e, 0xca, 0x2c, 0xe9, 0x9b, 0x3e, 0x97, 0x41, 0x0a, 0x7b, 0xf8,
- 0x66, 0x1c, 0xc7, 0xfb, 0xaa, 0x2b, 0xc1, 0xcf, 0x2b, 0x13, 0x11,
- 0x3b, 0x1e, 0xd4, 0x0a, 0x01, 0x18, 0xb8, 0x8e, 0x5f, 0xff, 0xc3,
- 0x54, 0x27, 0x59, 0xea, 0x00, 0x7e, 0xd4, 0xc5, 0x8d})),
- std::make_pair(
- 178,
- std::vector<uint8_t>(
- {0x1e, 0xb2, 0x62, 0xf3, 0x8f, 0xa4, 0x94, 0x43, 0x1f, 0x01, 0x7d,
- 0xad, 0x44, 0xc0, 0xdf, 0xb6, 0x93, 0x24, 0xac, 0x03, 0x2f, 0x04,
- 0xb6, 0x57, 0xfc, 0x91, 0xa8, 0x86, 0x47, 0xbb, 0x74, 0x76, 0x0f,
- 0x24, 0xe7, 0xc9, 0x56, 0x51, 0x4f, 0x0c, 0xf0, 0x02, 0x99, 0x0b,
- 0x18, 0x2c, 0x16, 0x42, 0xb9, 0xb2, 0x42, 0x6e, 0x96, 0xa6, 0x11,
- 0x87, 0xe4, 0xe0, 0x12, 0xf0, 0x0e, 0x21, 0x7d, 0x84})),
- std::make_pair(
- 179,
- std::vector<uint8_t>(
- {0x3b, 0x95, 0x5a, 0xee, 0xbf, 0xa5, 0x15, 0x1a, 0xc1, 0xab, 0x8e,
- 0x3f, 0x5c, 0xc1, 0xe3, 0x76, 0x70, 0x84, 0xc8, 0x42, 0xa5, 0x75,
- 0xd3, 0x62, 0x69, 0x83, 0x6e, 0x97, 0x35, 0x3d, 0x41, 0x62, 0x2b,
- 0x73, 0x1d, 0xdd, 0xcd, 0x5f, 0x26, 0x95, 0x50, 0xa3, 0xa5, 0xb8,
- 0x7b, 0xe1, 0xe9, 0x03, 0x26, 0x34, 0x0b, 0x6e, 0x0e, 0x62, 0x55,
- 0x58, 0x15, 0xd9, 0x60, 0x05, 0x97, 0xac, 0x6e, 0xf9})),
- std::make_pair(
- 180,
- std::vector<uint8_t>(
- {0x68, 0x28, 0x9f, 0x66, 0x05, 0x47, 0x3b, 0xa0, 0xe4, 0xf2, 0x41,
- 0xba, 0xf7, 0x47, 0x7a, 0x98, 0x85, 0x42, 0x6a, 0x85, 0x8f, 0x19,
- 0xef, 0x2a, 0x18, 0xb0, 0xd4, 0x0e, 0xf8, 0xe4, 0x12, 0x82, 0xed,
- 0x55, 0x26, 0xb5, 0x19, 0x79, 0x9e, 0x27, 0x0f, 0x13, 0x88, 0x13,
- 0x27, 0x91, 0x82, 0x78, 0x75, 0x57, 0x11, 0x07, 0x1d, 0x85, 0x11,
- 0xfe, 0x96, 0x3e, 0x3b, 0x56, 0x06, 0xaa, 0x37, 0x16})),
- std::make_pair(
- 181,
- std::vector<uint8_t>(
- {0x80, 0xa3, 0x37, 0x87, 0x54, 0x26, 0x12, 0xc3, 0x8f, 0x6b, 0xcd,
- 0x7c, 0xd8, 0x6c, 0xab, 0x46, 0x02, 0x27, 0x50, 0x9b, 0x1c, 0xba,
- 0xd5, 0xec, 0x40, 0x8a, 0x91, 0x41, 0x3d, 0x51, 0x15, 0x5a, 0x04,
- 0x76, 0xda, 0xdb, 0xf3, 0xa2, 0x51, 0x8e, 0x4a, 0x6e, 0x77, 0xcc,
- 0x34, 0x66, 0x22, 0xe3, 0x47, 0xa4, 0x69, 0xbf, 0x8b, 0xaa, 0x5f,
- 0x04, 0xeb, 0x2d, 0x98, 0x70, 0x53, 0x55, 0xd0, 0x63})),
- std::make_pair(
- 182,
- std::vector<uint8_t>(
- {0x34, 0x62, 0x9b, 0xc6, 0xd8, 0x31, 0x39, 0x1c, 0x4c, 0xdf, 0x8a,
- 0xf1, 0xb4, 0xb7, 0xb6, 0xb8, 0xe8, 0xee, 0x17, 0xcf, 0x98, 0xc7,
- 0x0e, 0x5d, 0xd5, 0x86, 0xcd, 0x99, 0xf1, 0x4b, 0x11, 0xdf, 0x94,
- 0x51, 0x66, 0x23, 0x6a, 0x95, 0x71, 0xe6, 0xd5, 0x91, 0xbb, 0x83,
- 0xee, 0x4d, 0x16, 0x4d, 0x46, 0xf6, 0xb9, 0xd8, 0xef, 0x86, 0xff,
- 0x86, 0x5a, 0x81, 0xbf, 0xb9, 0x1b, 0x00, 0x42, 0x4b})),
- std::make_pair(
- 183,
- std::vector<uint8_t>(
- {0x8b, 0x7c, 0xc3, 0x39, 0x16, 0x38, 0x63, 0xbb, 0x43, 0x83, 0xe5,
- 0x42, 0xb0, 0xef, 0x0e, 0x7c, 0xf3, 0x6b, 0x84, 0xad, 0x93, 0x2c,
- 0xdf, 0x5a, 0x80, 0x41, 0x9e, 0xc9, 0xad, 0x69, 0x2e, 0x7a, 0x7e,
- 0x78, 0x4d, 0x2c, 0x7c, 0xb3, 0x79, 0x6a, 0x18, 0xb8, 0xf8, 0x00,
- 0x03, 0x5f, 0x3a, 0xa0, 0x6c, 0x82, 0x41, 0x00, 0x61, 0x11, 0x20,
- 0xa7, 0xbd, 0xeb, 0x35, 0x61, 0x8c, 0xcb, 0x81, 0xb7})),
- std::make_pair(
- 184,
- std::vector<uint8_t>(
- {0x4f, 0x08, 0x4e, 0x49, 0x39, 0xdd, 0x5a, 0x7f, 0x5a, 0x65, 0x8f,
- 0xad, 0x58, 0xa1, 0x8a, 0x15, 0xc2, 0x5c, 0x32, 0xec, 0x1c, 0x7f,
- 0xd5, 0xc5, 0xc6, 0xc3, 0xe8, 0x92, 0xb3, 0x97, 0x1a, 0xea, 0xac,
- 0x30, 0x83, 0x04, 0xef, 0x17, 0xb1, 0xc4, 0x72, 0x39, 0xea, 0x4b,
- 0xb3, 0x98, 0xb3, 0xfd, 0x6d, 0x45, 0x28, 0xd8, 0xde, 0x8e, 0x76,
- 0x8a, 0xe0, 0xf1, 0xa5, 0xa5, 0xc6, 0xb5, 0xc2, 0x97})),
- std::make_pair(
- 185,
- std::vector<uint8_t>(
- {0x48, 0xf4, 0x07, 0xa1, 0xaf, 0x5b, 0x80, 0x09, 0xb2, 0x05, 0x17,
- 0x42, 0xe8, 0xcf, 0x5c, 0xd5, 0x65, 0x66, 0x69, 0xe7, 0xd7, 0x22,
- 0xee, 0x8e, 0x7b, 0xd2, 0x02, 0x06, 0x08, 0x49, 0x44, 0x21, 0x68,
- 0xd8, 0xfa, 0xcc, 0x11, 0x7c, 0x01, 0x2b, 0xfb, 0x7b, 0xf4, 0x49,
- 0xd9, 0x9b, 0xef, 0xff, 0x6a, 0x34, 0xae, 0xa2, 0x03, 0xf1, 0xd8,
- 0xd3, 0x52, 0x72, 0x2b, 0xe5, 0x01, 0x4e, 0xc8, 0x18})),
- std::make_pair(
- 186,
- std::vector<uint8_t>(
- {0xa6, 0xaa, 0x82, 0xcd, 0x1e, 0x42, 0x6f, 0x9a, 0x73, 0xbf, 0xa3,
- 0x9a, 0x29, 0x03, 0x78, 0x76, 0x11, 0x46, 0x55, 0xb8, 0xc2, 0x2d,
- 0x6d, 0x3f, 0xf8, 0xb6, 0x38, 0xae, 0x7d, 0xea, 0x6b, 0x17, 0x84,
- 0x3e, 0x09, 0xe5, 0x2e, 0xb6, 0x6f, 0xa1, 0xe4, 0x75, 0xe4, 0xa8,
- 0xa3, 0xde, 0x42, 0x9b, 0x7d, 0x0f, 0x4a, 0x77, 0x6f, 0xcb, 0x8b,
- 0xdc, 0x9b, 0x9f, 0xed, 0xe7, 0xd5, 0x2e, 0x81, 0x5f})),
- std::make_pair(
- 187,
- std::vector<uint8_t>(
- {0x58, 0x17, 0x02, 0x7d, 0x6b, 0xdd, 0x00, 0xc5, 0xdd, 0x10, 0xac,
- 0x59, 0x3c, 0xd5, 0x60, 0x37, 0x22, 0x70, 0x77, 0x5a, 0x18, 0x52,
- 0x6d, 0x7e, 0x6f, 0x13, 0x87, 0x2a, 0x2e, 0x20, 0xea, 0xb6, 0x64,
- 0x62, 0x5b, 0xe7, 0x16, 0x8a, 0xc4, 0xbd, 0x7c, 0x9e, 0x0c, 0xe7,
- 0xfc, 0x40, 0x99, 0xe0, 0xf4, 0x84, 0x42, 0xe2, 0xc7, 0x67, 0x19,
- 0x1c, 0x6e, 0x12, 0x84, 0xe9, 0xb2, 0xcc, 0xea, 0x8c})),
- std::make_pair(
- 188,
- std::vector<uint8_t>(
- {0x08, 0xe4, 0x10, 0x28, 0x34, 0x0a, 0x45, 0xc7, 0x4e, 0x40, 0x52,
- 0xb3, 0xa8, 0xd6, 0x38, 0x9e, 0x22, 0xe0, 0x43, 0xa1, 0xad, 0xab,
- 0x5e, 0x28, 0xd9, 0x76, 0x19, 0x45, 0x0d, 0x72, 0x34, 0x69, 0xb6,
- 0x20, 0xca, 0xa5, 0x19, 0xb8, 0x1c, 0x14, 0x52, 0x38, 0x54, 0xf6,
- 0x19, 0xfd, 0x30, 0x27, 0xe3, 0x84, 0x7b, 0xd0, 0x32, 0x76, 0xe6,
- 0x06, 0x04, 0xa8, 0x0d, 0xdb, 0x4d, 0xe8, 0x76, 0xd6})),
- std::make_pair(
- 189,
- std::vector<uint8_t>(
- {0x13, 0x0b, 0x84, 0x20, 0x53, 0x7e, 0xb0, 0x7d, 0x72, 0xab, 0xda,
- 0x07, 0xc8, 0x5a, 0xcb, 0xd8, 0xb9, 0xa4, 0x4f, 0x16, 0x32, 0x1d,
- 0xd0, 0x42, 0x21, 0x45, 0xf8, 0x09, 0x67, 0x3d, 0x30, 0xf2, 0xb5,
- 0x32, 0x13, 0x26, 0xe2, 0xbf, 0xf3, 0x17, 0xef, 0x3f, 0xef, 0x98,
- 0x3c, 0x51, 0xc4, 0xf8, 0xab, 0x24, 0xa3, 0x25, 0xd2, 0x98, 0xe3,
- 0x4a, 0xfc, 0xe5, 0x69, 0xa8, 0x25, 0x55, 0x77, 0x4c})),
- std::make_pair(
- 190,
- std::vector<uint8_t>(
- {0xac, 0x49, 0xb8, 0x44, 0xaf, 0xaa, 0x01, 0x2e, 0x31, 0xc4, 0x74,
- 0xca, 0x26, 0x36, 0x48, 0x84, 0x4f, 0xd2, 0xf6, 0x30, 0x79, 0x92,
- 0xc2, 0xf7, 0x52, 0xac, 0xa0, 0x2c, 0x38, 0x28, 0x96, 0x51, 0x75,
- 0x79, 0x4d, 0xee, 0xe2, 0xd2, 0xee, 0x95, 0xc6, 0x1c, 0xd2, 0x84,
- 0xf6, 0xb5, 0xa2, 0xd7, 0x5e, 0x2e, 0xf2, 0xb2, 0x9e, 0xe8, 0x14,
- 0x9e, 0x77, 0xfb, 0x81, 0x44, 0x7b, 0x2f, 0xd0, 0x4b})),
- std::make_pair(
- 191,
- std::vector<uint8_t>(
- {0xb9, 0xd7, 0xca, 0x81, 0xcc, 0x60, 0xbb, 0x95, 0x78, 0xe4, 0x40,
- 0x24, 0xe5, 0xa0, 0xa0, 0xbe, 0x80, 0xf2, 0x73, 0x36, 0xa6, 0xa9,
- 0xf4, 0xe5, 0x3d, 0xf3, 0x99, 0x9c, 0xb1, 0x91, 0x28, 0x0b, 0x09,
- 0x0e, 0x2a, 0xc2, 0xd2, 0x9c, 0x5b, 0xaa, 0xd9, 0xd7, 0x14, 0x15,
- 0xbd, 0xc1, 0x29, 0xe6, 0x9a, 0xa2, 0x66, 0x7a, 0xf6, 0xa7, 0xfd,
- 0x5e, 0x18, 0x9f, 0xcc, 0xdc, 0xee, 0x81, 0x73, 0x40})),
- std::make_pair(
- 192,
- std::vector<uint8_t>(
- {0xa7, 0x55, 0xe1, 0x13, 0x38, 0x65, 0x72, 0xc7, 0x5c, 0xed, 0x61,
- 0xd7, 0x19, 0x70, 0x60, 0x70, 0xb9, 0x14, 0x60, 0x48, 0xe4, 0x2a,
- 0x9f, 0x8c, 0xd3, 0x56, 0x67, 0xa0, 0x88, 0xb4, 0x2f, 0x08, 0x80,
- 0x8a, 0xbd, 0xf7, 0x7e, 0x61, 0x8a, 0xbd, 0x95, 0x9a, 0xfc, 0x75,
- 0x73, 0x79, 0xca, 0x2c, 0x00, 0xbc, 0xc1, 0xa4, 0x83, 0x90, 0xfa,
- 0x2b, 0xff, 0x61, 0x8b, 0x1e, 0x00, 0x78, 0xa6, 0x13})),
- std::make_pair(
- 193,
- std::vector<uint8_t>(
- {0xa7, 0x3c, 0x7d, 0xeb, 0xed, 0x32, 0x6f, 0x1c, 0x0d, 0xb0, 0x79,
- 0x5e, 0xe7, 0xd6, 0xe3, 0x94, 0x68, 0x94, 0xb8, 0x26, 0xb1, 0xf8,
- 0x10, 0x1c, 0x56, 0xc8, 0x23, 0xba, 0x17, 0x16, 0x83, 0x12, 0xe7,
- 0xf5, 0x3f, 0xc7, 0xdb, 0xe5, 0x2c, 0x3e, 0x11, 0xe6, 0x98, 0x52,
- 0xc4, 0x04, 0x85, 0xe2, 0xef, 0x18, 0x24, 0x77, 0x86, 0x2e, 0xa6,
- 0xa3, 0x4e, 0xc1, 0x36, 0xe2, 0xdf, 0xee, 0xa6, 0xf4})),
- std::make_pair(
- 194,
- std::vector<uint8_t>(
- {0x6c, 0xb8, 0xf9, 0xd5, 0x2c, 0x56, 0xd8, 0x2c, 0xac, 0x28, 0xf3,
- 0x9e, 0xa1, 0x59, 0x3e, 0x8b, 0xb2, 0x50, 0x62, 0x93, 0xac, 0x0d,
- 0x68, 0x37, 0x6a, 0x17, 0x09, 0xb6, 0x2a, 0x46, 0xdf, 0x14, 0xa4,
- 0xae, 0x64, 0xb2, 0xd8, 0xfa, 0xb7, 0x67, 0x33, 0xa1, 0xce, 0xd2,
- 0xd5, 0x48, 0xe3, 0xf3, 0xc6, 0xfc, 0xb4, 0x9d, 0x40, 0xc3, 0xd5,
- 0x80, 0x8e, 0x44, 0x9c, 0xd8, 0x3d, 0x1c, 0x2a, 0xa2})),
- std::make_pair(
- 195,
- std::vector<uint8_t>(
- {0x68, 0x3f, 0xa2, 0xb2, 0x36, 0x9a, 0x10, 0x16, 0x2c, 0x1c, 0x1c,
- 0x7b, 0x24, 0xbc, 0x97, 0x0e, 0xe6, 0x7d, 0xa2, 0x20, 0x56, 0x4f,
- 0x32, 0x20, 0x3f, 0x62, 0x56, 0x96, 0xc0, 0x35, 0x2a, 0x0b, 0x9a,
- 0xd9, 0x66, 0x24, 0x36, 0x2d, 0x95, 0x2d, 0x84, 0x46, 0x3c, 0x11,
- 0x06, 0xa2, 0xdb, 0xa7, 0xa0, 0x92, 0x59, 0x98, 0x84, 0xb3, 0x5a,
- 0x0b, 0x89, 0xc8, 0xf1, 0xb6, 0xa9, 0xb5, 0xa6, 0x1e})),
- std::make_pair(
- 196,
- std::vector<uint8_t>(
- {0xaa, 0xd9, 0xad, 0x44, 0x61, 0x01, 0x18, 0xb7, 0x7d, 0x50, 0x8a,
- 0xeb, 0x1b, 0xbc, 0xd1, 0xc1, 0xb7, 0xd0, 0x17, 0x13, 0x97, 0xfb,
- 0x51, 0x0a, 0x40, 0x1b, 0xbc, 0x0e, 0xc3, 0x46, 0x23, 0x67, 0x0d,
- 0x86, 0xa2, 0xdc, 0x3c, 0x8f, 0x3a, 0xb5, 0xa2, 0x04, 0x4d, 0xf7,
- 0x30, 0x25, 0x67, 0x27, 0x54, 0x5f, 0x08, 0x60, 0xce, 0x21, 0xa1,
- 0xea, 0xc7, 0x17, 0xdf, 0xc4, 0x8f, 0x5d, 0x22, 0x8e})),
- std::make_pair(
- 197,
- std::vector<uint8_t>(
- {0xc4, 0x25, 0x78, 0xde, 0x23, 0xb4, 0xc9, 0x87, 0xd5, 0xe1, 0xac,
- 0x4d, 0x68, 0x9e, 0xd5, 0xde, 0x4b, 0x04, 0x17, 0xf9, 0x70, 0x4b,
- 0xc6, 0xbc, 0xe9, 0x69, 0xfa, 0x13, 0x47, 0x15, 0x85, 0xd6, 0x2c,
- 0x2c, 0xb1, 0x21, 0x2a, 0x94, 0x4f, 0x39, 0x7f, 0xc9, 0xca, 0x2c,
- 0x37, 0x47, 0xc3, 0xbe, 0xb6, 0x94, 0xec, 0x4c, 0x5b, 0xe6, 0x88,
- 0x28, 0xdd, 0xa5, 0x3e, 0xf4, 0x3f, 0xae, 0xc6, 0xc0})),
- std::make_pair(
- 198,
- std::vector<uint8_t>(
- {0x47, 0x0f, 0x00, 0x84, 0x1e, 0xe8, 0x24, 0x4e, 0x63, 0xed, 0x2c,
- 0x7e, 0xa3, 0x0e, 0x2e, 0x41, 0x98, 0x97, 0xc1, 0x97, 0x46, 0x2e,
- 0xcc, 0xce, 0xcf, 0x71, 0x3b, 0x42, 0xa5, 0x06, 0x5f, 0xff, 0x59,
- 0x14, 0xbc, 0x9b, 0x79, 0xaf, 0xfe, 0x8f, 0x6b, 0x65, 0x78, 0x75,
- 0xe7, 0x89, 0xae, 0x21, 0x3b, 0xd9, 0x14, 0xcd, 0x35, 0xbd, 0x17,
- 0x4d, 0x46, 0xe9, 0xd1, 0x8b, 0xd8, 0x43, 0x77, 0x3d})),
- std::make_pair(
- 199,
- std::vector<uint8_t>(
- {0x34, 0xfc, 0x42, 0x13, 0x73, 0x0f, 0x47, 0xa5, 0xe9, 0xa3, 0x58,
- 0x0f, 0x64, 0x3e, 0x12, 0x94, 0x5c, 0xfc, 0xb3, 0x1b, 0xf2, 0x06,
- 0xf6, 0xad, 0x45, 0x0c, 0xe5, 0x28, 0xda, 0x3f, 0xa4, 0x32, 0xe0,
- 0x05, 0xd6, 0xb0, 0xec, 0xce, 0x10, 0xdc, 0xa7, 0xc5, 0x99, 0x5f,
- 0x6a, 0xac, 0xc5, 0x15, 0x0e, 0x1b, 0x00, 0x9e, 0x19, 0x75, 0x1e,
- 0x83, 0x09, 0xf8, 0x85, 0x95, 0x31, 0x84, 0x43, 0x74})),
- std::make_pair(
- 200,
- std::vector<uint8_t>(
- {0xfb, 0x3c, 0x1f, 0x0f, 0x56, 0xa5, 0x6f, 0x8e, 0x31, 0x6f, 0xdf,
- 0x5d, 0x85, 0x3c, 0x8c, 0x87, 0x2c, 0x39, 0x63, 0x5d, 0x08, 0x36,
- 0x34, 0xc3, 0x90, 0x4f, 0xc3, 0xac, 0x07, 0xd1, 0xb5, 0x78, 0xe8,
- 0x5f, 0xf0, 0xe4, 0x80, 0xe9, 0x2d, 0x44, 0xad, 0xe3, 0x3b, 0x62,
- 0xe8, 0x93, 0xee, 0x32, 0x34, 0x3e, 0x79, 0xdd, 0xf6, 0xef, 0x29,
- 0x2e, 0x89, 0xb5, 0x82, 0xd3, 0x12, 0x50, 0x23, 0x14})),
- std::make_pair(
- 201,
- std::vector<uint8_t>(
- {0xc7, 0xc9, 0x7f, 0xc6, 0x5d, 0xd2, 0xb9, 0xe3, 0xd3, 0xd6, 0x07,
- 0xd3, 0x15, 0x98, 0xd3, 0xf8, 0x42, 0x61, 0xe9, 0x91, 0x92, 0x51,
- 0xe9, 0xc8, 0xe5, 0x7b, 0xb5, 0xf8, 0x29, 0x37, 0x7d, 0x5f, 0x73,
- 0xea, 0xbb, 0xed, 0x55, 0xc6, 0xc3, 0x81, 0x18, 0x0f, 0x29, 0xad,
- 0x02, 0xe5, 0xbe, 0x79, 0x7f, 0xfe, 0xc7, 0xe5, 0x7b, 0xde, 0xcb,
- 0xc5, 0x0a, 0xd3, 0xd0, 0x62, 0xf0, 0x99, 0x3a, 0xb0})),
- std::make_pair(
- 202,
- std::vector<uint8_t>(
- {0xa5, 0x7a, 0x49, 0xcd, 0xbe, 0x67, 0xae, 0x7d, 0x9f, 0x79, 0x7b,
- 0xb5, 0xcc, 0x7e, 0xfc, 0x2d, 0xf0, 0x7f, 0x4e, 0x1b, 0x15, 0x95,
- 0x5f, 0x85, 0xda, 0xe7, 0x4b, 0x76, 0xe2, 0xec, 0xb8, 0x5a, 0xfb,
- 0x6c, 0xd9, 0xee, 0xed, 0x88, 0x88, 0xd5, 0xca, 0x3e, 0xc5, 0xab,
- 0x65, 0xd2, 0x7a, 0x7b, 0x19, 0xe5, 0x78, 0x47, 0x57, 0x60, 0xa0,
- 0x45, 0xac, 0x3c, 0x92, 0xe1, 0x3a, 0x93, 0x8e, 0x77})),
- std::make_pair(
- 203,
- std::vector<uint8_t>(
- {0xc7, 0x14, 0x3f, 0xce, 0x96, 0x14, 0xa1, 0x7f, 0xd6, 0x53, 0xae,
- 0xb1, 0x40, 0x72, 0x6d, 0xc9, 0xc3, 0xdb, 0xb1, 0xde, 0x6c, 0xc5,
- 0x81, 0xb2, 0x72, 0x68, 0x97, 0xec, 0x24, 0xb7, 0xa5, 0x03, 0x59,
- 0xad, 0x49, 0x22, 0x43, 0xbe, 0x66, 0xd9, 0xed, 0xd8, 0xc9, 0x33,
- 0xb5, 0xb8, 0x0e, 0x0b, 0x91, 0xbb, 0x61, 0xea, 0x98, 0x05, 0x60,
- 0x06, 0x51, 0x69, 0x76, 0xfa, 0xe8, 0xd9, 0x9a, 0x35})),
- std::make_pair(
- 204,
- std::vector<uint8_t>(
- {0x65, 0xbb, 0x58, 0xd0, 0x7f, 0x93, 0x7e, 0x2d, 0x3c, 0x7e, 0x65,
- 0x38, 0x5f, 0x9c, 0x54, 0x73, 0x0b, 0x70, 0x41, 0x05, 0xcc, 0xdb,
- 0x69, 0x1f, 0x6e, 0x14, 0x6d, 0x4e, 0xe8, 0xf6, 0xc0, 0x86, 0xf4,
- 0x95, 0x11, 0x03, 0x51, 0x10, 0xa9, 0xad, 0x60, 0x31, 0xfd, 0xce,
- 0xb9, 0x43, 0xe0, 0xf9, 0x61, 0x3b, 0xcb, 0x27, 0x6d, 0xd4, 0x0f,
- 0x06, 0x24, 0xef, 0x0f, 0x92, 0x4f, 0x80, 0x97, 0x83})),
- std::make_pair(
- 205,
- std::vector<uint8_t>(
- {0xe5, 0x40, 0x27, 0x7f, 0x68, 0x3b, 0x11, 0x86, 0xdd, 0x3b, 0x5b,
- 0x3f, 0x61, 0x43, 0x33, 0x96, 0x58, 0x1a, 0x35, 0xfe, 0xb1, 0x20,
- 0x02, 0xbe, 0x8c, 0x6a, 0x62, 0x31, 0xfc, 0x40, 0xff, 0xa7, 0x0f,
- 0x08, 0x08, 0x1b, 0xc5, 0x8b, 0x2d, 0x94, 0xf7, 0x64, 0x95, 0x43,
- 0x61, 0x4a, 0x43, 0x5f, 0xaa, 0x2d, 0x62, 0x11, 0x0e, 0x13, 0xda,
- 0xbc, 0x7b, 0x86, 0x62, 0x9b, 0x63, 0xaf, 0x9c, 0x24})),
- std::make_pair(
- 206,
- std::vector<uint8_t>(
- {0x41, 0x85, 0x00, 0x87, 0x8c, 0x5f, 0xbc, 0xb5, 0x84, 0xc4, 0x32,
- 0xf4, 0x28, 0x5e, 0x05, 0xe4, 0x9f, 0x2e, 0x3e, 0x07, 0x53, 0x99,
- 0xa0, 0xdb, 0xfc, 0xf8, 0x74, 0xeb, 0xf8, 0xc0, 0x3d, 0x02, 0xbf,
- 0x16, 0xbc, 0x69, 0x89, 0xd1, 0x61, 0xc7, 0x7c, 0xa0, 0x78, 0x6b,
- 0x05, 0x05, 0x3c, 0x6c, 0x70, 0x94, 0x33, 0x71, 0x23, 0x19, 0x19,
- 0x21, 0x28, 0x83, 0x5c, 0xf0, 0xb6, 0x60, 0x59, 0x5b})),
- std::make_pair(
- 207,
- std::vector<uint8_t>(
- {0x88, 0x90, 0x90, 0xdb, 0xb1, 0x94, 0x4b, 0xdc, 0x94, 0x33, 0xee,
- 0x5e, 0xf1, 0x01, 0x0c, 0x7a, 0x4a, 0x24, 0xa8, 0xe7, 0x1e, 0xce,
- 0xa8, 0xe1, 0x2a, 0x31, 0x31, 0x8c, 0xe4, 0x9d, 0xca, 0xb0, 0xac,
- 0xa5, 0xc3, 0x80, 0x23, 0x34, 0xaa, 0xb2, 0xcc, 0x84, 0xb1, 0x4c,
- 0x6b, 0x93, 0x21, 0xfe, 0x58, 0x6b, 0xf3, 0xf8, 0x76, 0xf1, 0x9c,
- 0xd4, 0x06, 0xeb, 0x11, 0x27, 0xfb, 0x94, 0x48, 0x01})),
- std::make_pair(
- 208,
- std::vector<uint8_t>(
- {0x53, 0xb6, 0xa2, 0x89, 0x10, 0xaa, 0x92, 0xe2, 0x7e, 0x53, 0x6f,
- 0xb5, 0x49, 0xcf, 0x9b, 0x99, 0x18, 0x79, 0x10, 0x60, 0x89, 0x8e,
- 0x0b, 0x9f, 0xe1, 0x83, 0x57, 0x7f, 0xf4, 0x3b, 0x5e, 0x9c, 0x76,
- 0x89, 0xc7, 0x45, 0xb3, 0x2e, 0x41, 0x22, 0x69, 0x83, 0x7c, 0x31,
- 0xb8, 0x9e, 0x6c, 0xc1, 0x2b, 0xf7, 0x6e, 0x13, 0xca, 0xd3, 0x66,
- 0xb7, 0x4e, 0xce, 0x48, 0xbb, 0x85, 0xfd, 0x09, 0xe9})),
- std::make_pair(
- 209,
- std::vector<uint8_t>(
- {0x7c, 0x09, 0x20, 0x80, 0xc6, 0xa8, 0x0d, 0x67, 0x24, 0x09, 0xd0,
- 0x81, 0xd3, 0xd1, 0x77, 0x10, 0x6b, 0xcd, 0x63, 0x56, 0x77, 0x85,
- 0x14, 0x07, 0x19, 0x49, 0x09, 0x50, 0xae, 0x07, 0xae, 0x8f, 0xca,
- 0xab, 0xba, 0xaa, 0xb3, 0x30, 0xcf, 0xbc, 0xf7, 0x37, 0x44, 0x82,
- 0xc2, 0x20, 0xaf, 0x2e, 0xad, 0xee, 0xb7, 0x3d, 0xcb, 0xb3, 0x5e,
- 0xd8, 0x23, 0x34, 0x4e, 0x14, 0x4e, 0x7d, 0x48, 0x99})),
- std::make_pair(
- 210,
- std::vector<uint8_t>(
- {0x9c, 0xcd, 0xe5, 0x66, 0xd2, 0x40, 0x05, 0x09, 0x18, 0x11, 0x11,
- 0xf3, 0x2d, 0xde, 0x4c, 0xd6, 0x32, 0x09, 0xfe, 0x59, 0xa3, 0x0c,
- 0x11, 0x45, 0x46, 0xad, 0x27, 0x76, 0xd8, 0x89, 0xa4, 0x1b, 0xad,
- 0x8f, 0xa1, 0xbb, 0x46, 0x8c, 0xb2, 0xf9, 0xd4, 0x2c, 0xa9, 0x92,
- 0x8a, 0x77, 0x70, 0xfe, 0xf8, 0xe8, 0xba, 0x4d, 0x0c, 0x81, 0x2d,
- 0x9a, 0x1e, 0x75, 0xc3, 0xd8, 0xd2, 0xcc, 0xd7, 0x5a})),
- std::make_pair(
- 211,
- std::vector<uint8_t>(
- {0x6e, 0x29, 0x3b, 0xf5, 0xd0, 0x3f, 0xe4, 0x39, 0x77, 0xcf, 0xe3,
- 0xf5, 0x7c, 0xcd, 0xb3, 0xae, 0x28, 0x2a, 0x85, 0x45, 0x5d, 0xca,
- 0x33, 0xf3, 0x7f, 0x4b, 0x74, 0xf8, 0x39, 0x8c, 0xc6, 0x12, 0x43,
- 0x3d, 0x75, 0x5c, 0xbe, 0xc4, 0x12, 0xf8, 0xf8, 0x2a, 0x3b, 0xd3,
- 0xbc, 0x4a, 0x27, 0x8f, 0x7e, 0xcd, 0x0d, 0xfa, 0x9b, 0xbd, 0xc4,
- 0x0b, 0xe7, 0xa7, 0x87, 0xc8, 0xf1, 0x59, 0xb2, 0xdf})),
- std::make_pair(
- 212,
- std::vector<uint8_t>(
- {0xc5, 0x65, 0x46, 0xfb, 0x21, 0x78, 0x45, 0x6f, 0x33, 0x61, 0x64,
- 0xc1, 0x8b, 0x90, 0xde, 0xff, 0xc8, 0x3a, 0xe2, 0xb5, 0xa3, 0xac,
- 0xa7, 0x7b, 0x68, 0x84, 0xd3, 0x6d, 0x2c, 0x1d, 0xb3, 0x95, 0x01,
- 0xb3, 0xe6, 0x5e, 0x36, 0xc7, 0x58, 0xc6, 0x6e, 0x31, 0x88, 0x45,
- 0x1f, 0xdb, 0x35, 0x15, 0xee, 0x16, 0x2c, 0x00, 0x1f, 0x06, 0xc3,
- 0xe8, 0xcb, 0x57, 0x3a, 0xdf, 0x30, 0xf7, 0xa1, 0x01})),
- std::make_pair(
- 213,
- std::vector<uint8_t>(
- {0x6f, 0x82, 0xf8, 0x9f, 0x29, 0x9e, 0xbc, 0xa2, 0xfe, 0x01, 0x4b,
- 0x59, 0xbf, 0xfe, 0x1a, 0xa8, 0x4e, 0x88, 0xb1, 0x91, 0x5f, 0xe2,
- 0x56, 0xaf, 0xb6, 0x46, 0xfd, 0x84, 0x48, 0xaf, 0x2b, 0x88, 0x91,
- 0xa7, 0xfa, 0xb3, 0x7a, 0x4e, 0xa6, 0xf9, 0xa5, 0x0e, 0x6c, 0x31,
- 0x70, 0x39, 0xd8, 0xcf, 0x87, 0x8f, 0x4c, 0x8e, 0x1a, 0x0d, 0xd4,
- 0x64, 0xf0, 0xb4, 0xd6, 0xff, 0x1c, 0x7e, 0xa8, 0x53})),
- std::make_pair(
- 214,
- std::vector<uint8_t>(
- {0x2b, 0x85, 0x99, 0xff, 0x9c, 0x3d, 0x61, 0x98, 0x63, 0x7a, 0xd5,
- 0x1e, 0x57, 0xd1, 0x99, 0x8b, 0x0d, 0x75, 0x31, 0x3f, 0xe2, 0xdd,
- 0x61, 0xa5, 0x33, 0xc9, 0x64, 0xa6, 0xdd, 0x96, 0x07, 0xc6, 0xf7,
- 0x23, 0xe9, 0x45, 0x2c, 0xe4, 0x6e, 0x01, 0x4b, 0x1c, 0x1d, 0x6d,
- 0xe7, 0x7b, 0xa5, 0xb8, 0x8c, 0x91, 0x4d, 0x1c, 0x59, 0x7b, 0xf1,
- 0xea, 0xe1, 0x34, 0x74, 0xb4, 0x29, 0x0e, 0x89, 0xb2})),
- std::make_pair(
- 215,
- std::vector<uint8_t>(
- {0x08, 0xbf, 0x34, 0x6d, 0x38, 0xe1, 0xdf, 0x06, 0xc8, 0x26, 0x0e,
- 0xdb, 0x1d, 0xa7, 0x55, 0x79, 0x27, 0x59, 0x48, 0xd5, 0xc0, 0xa0,
- 0xaa, 0x9e, 0xd2, 0x88, 0x6f, 0x88, 0x56, 0xde, 0x54, 0x17, 0xa1,
- 0x56, 0x99, 0x87, 0x58, 0xf5, 0xb1, 0x7e, 0x52, 0xf1, 0x01, 0xca,
- 0x95, 0x7a, 0x71, 0x13, 0x74, 0x73, 0xdf, 0xd1, 0x8d, 0x7d, 0x20,
- 0x9c, 0x4c, 0x10, 0xd9, 0x23, 0x3c, 0x93, 0x69, 0x1d})),
- std::make_pair(
- 216,
- std::vector<uint8_t>(
- {0x6d, 0xf2, 0x15, 0x6d, 0x77, 0x31, 0x14, 0xd3, 0x10, 0xb6, 0x3d,
- 0xb9, 0xee, 0x53, 0x50, 0xd7, 0x7e, 0x6b, 0xcf, 0x25, 0xb0, 0x5f,
- 0xcd, 0x91, 0x0f, 0x9b, 0x31, 0xbc, 0x42, 0xbb, 0x13, 0xfe, 0x82,
- 0x25, 0xeb, 0xcb, 0x2a, 0x23, 0xa6, 0x22, 0x80, 0x77, 0x7b, 0x6b,
- 0xf7, 0x4e, 0x2c, 0xd0, 0x91, 0x7c, 0x76, 0x40, 0xb4, 0x3d, 0xef,
- 0xe4, 0x68, 0xcd, 0x1e, 0x18, 0xc9, 0x43, 0xc6, 0x6a})),
- std::make_pair(
- 217,
- std::vector<uint8_t>(
- {0x7c, 0x70, 0x38, 0xbc, 0x13, 0xa9, 0x11, 0x51, 0x82, 0x8a, 0x5b,
- 0xa8, 0x2b, 0x4a, 0x96, 0x04, 0x0f, 0x25, 0x8a, 0x4d, 0xfb, 0x1b,
- 0x13, 0x73, 0xf0, 0xd3, 0x59, 0x16, 0x8a, 0xfb, 0x05, 0x17, 0xa2,
- 0x0b, 0x28, 0xa1, 0x2d, 0x36, 0x44, 0x04, 0x6b, 0xe6, 0x6b, 0x8d,
- 0x08, 0xd8, 0xae, 0x7f, 0x6a, 0x92, 0x3e, 0xa1, 0xc0, 0x01, 0x87,
- 0xc6, 0xd1, 0x1d, 0xc5, 0x02, 0xba, 0xc7, 0x13, 0x05})),
- std::make_pair(
- 218,
- std::vector<uint8_t>(
- {0xbc, 0xd1, 0xb3, 0x0d, 0x80, 0x8f, 0xb7, 0x39, 0xb9, 0x87, 0xcb,
- 0xf1, 0x54, 0xbe, 0xa0, 0x0d, 0xa9, 0xd4, 0x03, 0x80, 0xb8, 0x61,
- 0xd4, 0xc1, 0xd6, 0x37, 0x71, 0x22, 0xda, 0xdd, 0x61, 0xc0, 0xe5,
- 0x90, 0x18, 0xb7, 0x19, 0x41, 0xcf, 0xb6, 0x2e, 0x00, 0xdc, 0xd7,
- 0x0a, 0xeb, 0x9a, 0xbf, 0x04, 0x73, 0xe8, 0x0f, 0x0a, 0x7e, 0xca,
- 0x6b, 0x6d, 0xea, 0x24, 0x6a, 0xb2, 0x29, 0xdd, 0x2b})),
- std::make_pair(
- 219,
- std::vector<uint8_t>(
- {0x7e, 0xd4, 0x46, 0x8d, 0x96, 0x85, 0x30, 0xfe, 0x7a, 0xb2, 0xc3,
- 0x35, 0x40, 0xb2, 0x6d, 0x8c, 0x3b, 0xd3, 0xed, 0x44, 0xb3, 0x4f,
- 0xbe, 0x8c, 0x2a, 0x9d, 0x7f, 0x80, 0x5b, 0x5a, 0xda, 0x0e, 0xa2,
- 0x52, 0xee, 0xad, 0xe4, 0xfc, 0xe9, 0x7f, 0x89, 0x72, 0x8a, 0xd8,
- 0x5b, 0xc8, 0xbb, 0x24, 0x30, 0xb1, 0xbe, 0xf2, 0xcd, 0xdd, 0x32,
- 0xc8, 0x44, 0x6e, 0x59, 0xb8, 0xe8, 0xba, 0x3c, 0x67})),
- std::make_pair(
- 220,
- std::vector<uint8_t>(
- {0x6d, 0x30, 0xb7, 0xc6, 0xce, 0x8a, 0x32, 0x36, 0xc0, 0xca, 0x2f,
- 0x8d, 0x72, 0x8b, 0x10, 0x88, 0xca, 0x06, 0x98, 0x3a, 0x80, 0x43,
- 0xe6, 0x21, 0xd5, 0xdc, 0xf0, 0xc5, 0x37, 0xd1, 0x3b, 0x08, 0x79,
- 0x1e, 0xde, 0xb0, 0x1a, 0x3c, 0xf0, 0x94, 0x3e, 0xc1, 0xc8, 0x90,
- 0xab, 0x6e, 0x29, 0xb1, 0x46, 0xa2, 0x36, 0xcd, 0x46, 0xbc, 0xb9,
- 0xd9, 0x3b, 0xf5, 0x16, 0xfb, 0x67, 0xc6, 0x3f, 0xe5})),
- std::make_pair(
- 221,
- std::vector<uint8_t>(
- {0x97, 0xfe, 0x03, 0xce, 0xf3, 0x14, 0x38, 0x50, 0x89, 0x11, 0xbd,
- 0xed, 0x97, 0x59, 0x80, 0xa6, 0x60, 0x29, 0x30, 0x5d, 0xc5, 0xe3,
- 0xfa, 0x8a, 0xd1, 0xb4, 0xfb, 0x22, 0xfc, 0xdf, 0x5a, 0x19, 0xa7,
- 0x33, 0x32, 0x03, 0x27, 0xd8, 0xf7, 0x1c, 0xcf, 0x49, 0x6c, 0xb3,
- 0xa4, 0x4a, 0x77, 0xaf, 0x56, 0xe3, 0xdd, 0xe7, 0x3d, 0x3a, 0x5f,
- 0x17, 0x68, 0x96, 0xcc, 0x57, 0xc9, 0xa5, 0xad, 0x99})),
- std::make_pair(
- 222,
- std::vector<uint8_t>(
- {0x78, 0x5a, 0x9d, 0x0f, 0xbd, 0x21, 0x13, 0x6d, 0xbc, 0xe8, 0xfa,
- 0x7e, 0xaf, 0xd6, 0x3c, 0x9d, 0xad, 0x22, 0x00, 0x52, 0x97, 0x84,
- 0x16, 0xb3, 0x1d, 0x97, 0x53, 0xea, 0xa1, 0x49, 0x09, 0x78, 0x47,
- 0xed, 0x9b, 0x30, 0xa6, 0x5c, 0x70, 0x50, 0x7e, 0xff, 0x01, 0x87,
- 0x91, 0x49, 0xed, 0x5c, 0xf0, 0x47, 0x1d, 0x37, 0x79, 0x8e, 0xdc,
- 0x05, 0xab, 0xd5, 0x6a, 0xd4, 0xa2, 0xcc, 0xcb, 0x1d})),
- std::make_pair(
- 223,
- std::vector<uint8_t>(
- {0xad, 0x40, 0x8d, 0x2a, 0xbd, 0xdf, 0xd3, 0x7b, 0x3b, 0xf3, 0x47,
- 0x94, 0xc1, 0xa3, 0x37, 0x1d, 0x92, 0x8e, 0xd7, 0xfc, 0x8d, 0x96,
- 0x62, 0x25, 0x33, 0x35, 0x84, 0xc5, 0x66, 0x58, 0x17, 0x83, 0x2a,
- 0x37, 0xc0, 0x7f, 0x0d, 0xc7, 0xcb, 0x5a, 0xa8, 0x74, 0xcd, 0x7d,
- 0x20, 0xfe, 0x8f, 0xab, 0x8e, 0xab, 0xcb, 0x9b, 0x33, 0xd2, 0xe0,
- 0x84, 0x1f, 0x6e, 0x20, 0x09, 0x60, 0x89, 0x9d, 0x95})),
- std::make_pair(
- 224,
- std::vector<uint8_t>(
- {0x97, 0x66, 0x8f, 0x74, 0x5b, 0x60, 0x32, 0xfc, 0x81, 0x5d, 0x95,
- 0x79, 0x32, 0x27, 0x69, 0xdc, 0xcd, 0x95, 0x01, 0xa5, 0x08, 0x00,
- 0x29, 0xb8, 0xae, 0x82, 0x6b, 0xef, 0xb6, 0x74, 0x23, 0x31, 0xbd,
- 0x9f, 0x76, 0xef, 0xeb, 0x3e, 0x2b, 0x8e, 0x81, 0xa9, 0x78, 0x6b,
- 0x28, 0x2f, 0x50, 0x68, 0xa3, 0xa2, 0x42, 0x46, 0x97, 0xa7, 0x7c,
- 0x41, 0x87, 0x6b, 0x7e, 0x75, 0x3f, 0x4c, 0x77, 0x67})),
- std::make_pair(
- 225,
- std::vector<uint8_t>(
- {0x26, 0xbb, 0x98, 0x5f, 0x47, 0xe7, 0xfe, 0xe0, 0xcf, 0xd2, 0x52,
- 0xd4, 0xef, 0x96, 0xbe, 0xd4, 0x2b, 0x9c, 0x37, 0x0c, 0x1c, 0x6a,
- 0x3e, 0x8c, 0x9e, 0xb0, 0x4e, 0xf7, 0xf7, 0x81, 0x8b, 0x83, 0x3a,
- 0x0d, 0x1f, 0x04, 0x3e, 0xba, 0xfb, 0x91, 0x1d, 0xc7, 0x79, 0xe0,
- 0x27, 0x40, 0xa0, 0x2a, 0x44, 0xd3, 0xa1, 0xea, 0x45, 0xed, 0x4a,
- 0xd5, 0x5e, 0x68, 0x6c, 0x92, 0x7c, 0xaf, 0xe9, 0x7e})),
- std::make_pair(
- 226,
- std::vector<uint8_t>(
- {0x5b, 0xfe, 0x2b, 0x1d, 0xcf, 0x7f, 0xe9, 0xb9, 0x50, 0x88, 0xac,
- 0xed, 0xb5, 0x75, 0xc1, 0x90, 0x16, 0xc7, 0x43, 0xb2, 0xe7, 0x63,
- 0xbf, 0x58, 0x51, 0xac, 0x40, 0x7c, 0x9e, 0xda, 0x43, 0x71, 0x5e,
- 0xdf, 0xa4, 0x8b, 0x48, 0x25, 0x49, 0x2c, 0x51, 0x79, 0x59, 0x3f,
- 0xff, 0x21, 0x35, 0x1b, 0x76, 0xe8, 0xb7, 0xe0, 0x34, 0xe4, 0xc5,
- 0x3c, 0x79, 0xf6, 0x1f, 0x29, 0xc4, 0x79, 0xbd, 0x08})),
- std::make_pair(
- 227,
- std::vector<uint8_t>(
- {0xc7, 0x65, 0x09, 0xef, 0x72, 0xf4, 0xa6, 0xf9, 0xc9, 0xc4, 0x06,
- 0x18, 0xed, 0x52, 0xb2, 0x08, 0x4f, 0x83, 0x50, 0x22, 0x32, 0xe0,
- 0xac, 0x8b, 0xda, 0xf3, 0x26, 0x43, 0x68, 0xe4, 0xd0, 0x18, 0x0f,
- 0x68, 0x54, 0xc4, 0xab, 0xf4, 0xf6, 0x50, 0x9c, 0x79, 0xca, 0xaf,
- 0xc4, 0x4c, 0xf3, 0x19, 0x4a, 0xfc, 0x57, 0xbd, 0x07, 0x7b, 0xd7,
- 0xb3, 0xc9, 0xbd, 0xa3, 0xd4, 0xb8, 0x77, 0x58, 0x16})),
- std::make_pair(
- 228,
- std::vector<uint8_t>(
- {0xd6, 0x6f, 0x2b, 0xea, 0xb9, 0x90, 0xe3, 0x54, 0xcc, 0xb9, 0x10,
- 0xe4, 0xe9, 0xc7, 0xac, 0x61, 0x8c, 0x7b, 0x63, 0xef, 0x29, 0x2a,
- 0x96, 0xb5, 0x52, 0x34, 0x1d, 0xe7, 0x8d, 0xc4, 0x6d, 0x3e, 0xc8,
- 0xcf, 0xab, 0xc6, 0x99, 0xb5, 0x0a, 0xf4, 0x1f, 0xda, 0x39, 0xcf,
- 0x1b, 0x01, 0x73, 0x66, 0x09, 0x23, 0x51, 0x0a, 0xd6, 0x7f, 0xae,
- 0xde, 0xf5, 0x20, 0x7c, 0xff, 0xe8, 0x64, 0x1d, 0x20})),
- std::make_pair(
- 229,
- std::vector<uint8_t>(
- {0x7d, 0x8f, 0x06, 0x72, 0x99, 0x2b, 0x79, 0xbe, 0x3a, 0x36, 0x4d,
- 0x8e, 0x59, 0x04, 0xf4, 0xab, 0x71, 0x3b, 0xbc, 0x8a, 0xb0, 0x1b,
- 0x4f, 0x30, 0x9a, 0xd8, 0xcc, 0xf2, 0x23, 0xce, 0x10, 0x34, 0xa8,
- 0x60, 0xdc, 0xb0, 0xb0, 0x05, 0x50, 0x61, 0x2c, 0xc2, 0xfa, 0x17,
- 0xf2, 0x96, 0x9e, 0x18, 0xf2, 0x2e, 0x14, 0x27, 0xd2, 0x54, 0xb4,
- 0xa8, 0x2b, 0x3a, 0x03, 0xa3, 0xeb, 0x39, 0x4a, 0xdf})),
- std::make_pair(
- 230,
- std::vector<uint8_t>(
- {0xa5, 0x6d, 0x67, 0x25, 0xbf, 0xb3, 0xde, 0x47, 0xc1, 0x41, 0x4a,
- 0xdf, 0x25, 0xfc, 0x8f, 0x0f, 0xc9, 0x84, 0x6f, 0x69, 0x87, 0x72,
- 0x2b, 0xc0, 0x63, 0x66, 0xd5, 0xca, 0x4e, 0x89, 0x72, 0x29, 0x25,
- 0xeb, 0xbc, 0x88, 0x14, 0x18, 0x84, 0x40, 0x75, 0x39, 0x7a, 0x0c,
- 0xa8, 0x98, 0x42, 0xc7, 0xb9, 0xe9, 0xe0, 0x7e, 0x1d, 0x9d, 0x18,
- 0x3e, 0xbe, 0xb3, 0x9e, 0x12, 0x0b, 0x48, 0x3b, 0xf7})),
- std::make_pair(
- 231,
- std::vector<uint8_t>(
- {0xaf, 0x5e, 0x03, 0xd7, 0xfe, 0x60, 0xc6, 0x7e, 0x10, 0x31, 0x33,
- 0x44, 0x43, 0x4e, 0x79, 0x48, 0x5a, 0x03, 0xa7, 0x58, 0xd6, 0xdc,
- 0xe9, 0x85, 0x57, 0x47, 0x45, 0x76, 0x3c, 0x1c, 0x5c, 0x77, 0xd4,
- 0xfb, 0x3e, 0x6f, 0xb1, 0x22, 0x30, 0x36, 0x83, 0x70, 0x99, 0x3b,
- 0xf9, 0x0f, 0xee, 0xd0, 0xc5, 0xd1, 0x60, 0x75, 0x24, 0x56, 0x2d,
- 0x7c, 0x09, 0xc0, 0xc2, 0x10, 0xed, 0x39, 0x3d, 0x7c})),
- std::make_pair(
- 232,
- std::vector<uint8_t>(
- {0x7a, 0x20, 0x54, 0x0c, 0xc0, 0x7b, 0xf7, 0x2b, 0x58, 0x24, 0x21,
- 0xfc, 0x34, 0x2e, 0x82, 0xf5, 0x21, 0x34, 0xb6, 0x98, 0x41, 0xec,
- 0x28, 0xed, 0x18, 0x9e, 0x2e, 0xa6, 0xa2, 0x9d, 0xd2, 0xf8, 0x2a,
- 0x64, 0x03, 0x52, 0xd2, 0x22, 0xb5, 0x2f, 0x29, 0x11, 0xdc, 0x72,
- 0xa7, 0xda, 0xb3, 0x1c, 0xaa, 0xdd, 0x80, 0xc6, 0x11, 0x8f, 0x13,
- 0xc5, 0x6b, 0x2a, 0x1e, 0x43, 0x73, 0xbe, 0x0e, 0xa3})),
- std::make_pair(
- 233,
- std::vector<uint8_t>(
- {0x48, 0x6f, 0x02, 0xc6, 0x3e, 0x54, 0x67, 0xea, 0x1f, 0xdd, 0xe7,
- 0xe8, 0x2b, 0xfa, 0xcc, 0x2c, 0x1b, 0xa5, 0xd6, 0x36, 0xd9, 0xf3,
- 0xd0, 0x8b, 0x21, 0x0d, 0xa3, 0xf3, 0x72, 0xf7, 0x06, 0xec, 0x21,
- 0x8c, 0xc1, 0x7f, 0xf6, 0x0a, 0xef, 0x70, 0x3b, 0xbe, 0x0c, 0x15,
- 0xc3, 0x8a, 0xe5, 0x5d, 0x28, 0x6a, 0x68, 0x4f, 0x86, 0x4c, 0x78,
- 0x21, 0x1c, 0xca, 0xb4, 0x17, 0x8c, 0x92, 0xad, 0xba})),
- std::make_pair(
- 234,
- std::vector<uint8_t>(
- {0x1c, 0x7a, 0x5c, 0x1d, 0xed, 0xcd, 0x04, 0xa9, 0x21, 0x78, 0x8f,
- 0x7e, 0xb2, 0x33, 0x61, 0xca, 0x19, 0x53, 0xb0, 0x4b, 0x9c, 0x7a,
- 0xec, 0x35, 0xd6, 0x5e, 0xa3, 0xe4, 0x99, 0x6d, 0xb2, 0x6f, 0x28,
- 0x12, 0x78, 0xea, 0x4a, 0xe6, 0x66, 0xad, 0x81, 0x02, 0x7d, 0x98,
- 0xaf, 0x57, 0x26, 0x2c, 0xdb, 0xfa, 0x4c, 0x08, 0x5f, 0x42, 0x10,
- 0x56, 0x8c, 0x7e, 0x15, 0xee, 0xc7, 0x80, 0x51, 0x14})),
- std::make_pair(
- 235,
- std::vector<uint8_t>(
- {0x9c, 0xe3, 0xfa, 0x9a, 0x86, 0x0b, 0xdb, 0xd5, 0x37, 0x8f, 0xd6,
- 0xd7, 0xb8, 0xb6, 0x71, 0xc6, 0xcb, 0x76, 0x92, 0x91, 0x0c, 0xe8,
- 0xf9, 0xb6, 0xcb, 0x41, 0x22, 0xcb, 0xcb, 0xe6, 0xac, 0x06, 0xca,
- 0x04, 0x22, 0xce, 0xf1, 0x22, 0x59, 0x35, 0x05, 0x3b, 0x7d, 0x19,
- 0x3a, 0x81, 0xb9, 0xe9, 0x72, 0xeb, 0x85, 0xa1, 0xd3, 0x07, 0x4f,
- 0x14, 0xcb, 0xb5, 0xec, 0x9f, 0x05, 0x73, 0x89, 0x2d})),
- std::make_pair(
- 236,
- std::vector<uint8_t>(
- {0xa9, 0x11, 0x87, 0xbe, 0x5c, 0x37, 0x1c, 0x42, 0x65, 0xc1, 0x74,
- 0xfd, 0x46, 0x53, 0xb8, 0xab, 0x70, 0x85, 0x51, 0xf8, 0x3d, 0x1f,
- 0xee, 0x1c, 0xc1, 0x47, 0x95, 0x81, 0xbc, 0x00, 0x6d, 0x6f, 0xb7,
- 0x8f, 0xcc, 0x9a, 0x5d, 0xee, 0x1d, 0xb3, 0x66, 0x6f, 0x50, 0x8f,
- 0x97, 0x80, 0xa3, 0x75, 0x93, 0xeb, 0xcc, 0xcf, 0x5f, 0xbe, 0xd3,
- 0x96, 0x67, 0xdc, 0x63, 0x61, 0xe9, 0x21, 0xf7, 0x79})),
- std::make_pair(
- 237,
- std::vector<uint8_t>(
- {0x46, 0x25, 0x76, 0x7d, 0x7b, 0x1d, 0x3d, 0x3e, 0xd2, 0xfb, 0xc6,
- 0x74, 0xaf, 0x14, 0xe0, 0x24, 0x41, 0x52, 0xf2, 0xa4, 0x02, 0x1f,
- 0xcf, 0x33, 0x11, 0x50, 0x5d, 0x89, 0xbd, 0x81, 0xe2, 0xf9, 0xf9,
- 0xa5, 0x00, 0xc3, 0xb1, 0x99, 0x91, 0x4d, 0xb4, 0x95, 0x00, 0xb3,
- 0xc9, 0x8d, 0x03, 0xea, 0x93, 0x28, 0x67, 0x51, 0xa6, 0x86, 0xa3,
- 0xb8, 0x75, 0xda, 0xab, 0x0c, 0xcd, 0x63, 0xb4, 0x4f})),
- std::make_pair(
- 238,
- std::vector<uint8_t>(
- {0x43, 0xdf, 0xdf, 0xe1, 0xb0, 0x14, 0xfe, 0xd3, 0xa2, 0xac, 0xab,
- 0xb7, 0xf3, 0xe9, 0xa1, 0x82, 0xf2, 0xaa, 0x18, 0x01, 0x9d, 0x27,
- 0xe3, 0xe6, 0xcd, 0xcf, 0x31, 0xa1, 0x5b, 0x42, 0x8e, 0x91, 0xe7,
- 0xb0, 0x8c, 0xf5, 0xe5, 0xc3, 0x76, 0xfc, 0xe2, 0xd8, 0xa2, 0x8f,
- 0xf8, 0x5a, 0xb0, 0xa0, 0xa1, 0x65, 0x6e, 0xdb, 0x4a, 0x0a, 0x91,
- 0x53, 0x26, 0x20, 0x09, 0x6d, 0x9a, 0x5a, 0x65, 0x2d})),
- std::make_pair(
- 239,
- std::vector<uint8_t>(
- {0x27, 0x9e, 0x32, 0x02, 0xbe, 0x39, 0x89, 0xba, 0x31, 0x12, 0x77,
- 0x25, 0x85, 0x17, 0x74, 0x87, 0xe4, 0xfe, 0x3e, 0xe3, 0xea, 0xb4,
- 0x9c, 0x2f, 0x7f, 0xa7, 0xfe, 0x87, 0xcf, 0xe7, 0xb8, 0x0d, 0x3e,
- 0x03, 0x55, 0xed, 0xff, 0x6d, 0x03, 0x1e, 0x6c, 0x96, 0xc7, 0x95,
- 0xdb, 0x1c, 0x6f, 0x04, 0x18, 0x80, 0xec, 0x38, 0x24, 0xde, 0xfa,
- 0xcf, 0x92, 0x63, 0x82, 0x0a, 0x8e, 0x73, 0x27, 0xde})),
- std::make_pair(
- 240,
- std::vector<uint8_t>(
- {0xea, 0x2d, 0x06, 0x6a, 0xc2, 0x29, 0xd4, 0xd4, 0xb6, 0x16, 0xa8,
- 0xbe, 0xde, 0xc7, 0x34, 0x32, 0x52, 0x24, 0xe4, 0xb4, 0xe5, 0x8f,
- 0x1a, 0xe6, 0xda, 0xd7, 0xe4, 0x0c, 0x2d, 0xa2, 0x91, 0x96, 0xc3,
- 0xb1, 0xea, 0x95, 0x71, 0xda, 0xcc, 0x81, 0xe8, 0x73, 0x28, 0xca,
- 0xa0, 0x21, 0x1e, 0x09, 0x02, 0x7b, 0x05, 0x24, 0xaa, 0x3f, 0x4a,
- 0x84, 0x99, 0x17, 0xb3, 0x58, 0x67, 0x47, 0xeb, 0xbb})),
- std::make_pair(
- 241,
- std::vector<uint8_t>(
- {0x49, 0xf0, 0x14, 0xf5, 0xc6, 0x18, 0x22, 0xc8, 0x99, 0xab, 0x5c,
- 0xae, 0x51, 0xbe, 0x40, 0x44, 0xa4, 0x49, 0x5e, 0x77, 0x7d, 0xeb,
- 0x7d, 0xa9, 0xb6, 0xd8, 0x49, 0x0e, 0xfb, 0xb8, 0x75, 0x30, 0xad,
- 0xf2, 0x93, 0xda, 0xf0, 0x79, 0xf9, 0x4c, 0x33, 0xb7, 0x04, 0x4e,
- 0xf6, 0x2e, 0x2e, 0x5b, 0xb3, 0xeb, 0x11, 0xe1, 0x73, 0x04, 0xf8,
- 0x45, 0x3e, 0xe6, 0xce, 0x24, 0xf0, 0x33, 0xdd, 0xb0})),
- std::make_pair(
- 242,
- std::vector<uint8_t>(
- {0x92, 0x33, 0x49, 0x03, 0x44, 0xe5, 0xb0, 0xdc, 0x59, 0x12, 0x67,
- 0x1b, 0x7a, 0xe5, 0x4c, 0xee, 0x77, 0x30, 0xdb, 0xe1, 0xf4, 0xc7,
- 0xd9, 0x2a, 0x4d, 0x3e, 0x3a, 0xab, 0x50, 0x57, 0x17, 0x08, 0xdb,
- 0x51, 0xdc, 0xf9, 0xc2, 0x94, 0x45, 0x91, 0xdb, 0x65, 0x1d, 0xb3,
- 0x2d, 0x22, 0x93, 0x5b, 0x86, 0x94, 0x49, 0x69, 0xbe, 0x77, 0xd5,
- 0xb5, 0xfe, 0xae, 0x6c, 0x38, 0x40, 0xa8, 0xdb, 0x26})),
- std::make_pair(
- 243,
- std::vector<uint8_t>(
- {0xb6, 0xe7, 0x5e, 0x6f, 0x4c, 0x7f, 0x45, 0x3b, 0x74, 0x65, 0xd2,
- 0x5b, 0x5a, 0xc8, 0xc7, 0x19, 0x69, 0x02, 0xea, 0xa9, 0x53, 0x87,
- 0x52, 0x28, 0xc8, 0x63, 0x4e, 0x16, 0xe2, 0xae, 0x1f, 0x38, 0xbc,
- 0x32, 0x75, 0x30, 0x43, 0x35, 0xf5, 0x98, 0x9e, 0xcc, 0xc1, 0xe3,
- 0x41, 0x67, 0xd4, 0xe6, 0x8d, 0x77, 0x19, 0x96, 0x8f, 0xba, 0x8e,
- 0x2f, 0xe6, 0x79, 0x47, 0xc3, 0x5c, 0x48, 0xe8, 0x06})),
- std::make_pair(
- 244,
- std::vector<uint8_t>(
- {0xcc, 0x14, 0xca, 0x66, 0x5a, 0xf1, 0x48, 0x3e, 0xfb, 0xc3, 0xaf,
- 0x80, 0x08, 0x0e, 0x65, 0x0d, 0x50, 0x46, 0xa3, 0x93, 0x2f, 0x4f,
- 0x51, 0xf3, 0xfe, 0x90, 0xa0, 0x70, 0x5e, 0xc2, 0x51, 0x04, 0xad,
- 0xf0, 0x78, 0x39, 0x26, 0x5d, 0xc5, 0x1d, 0x43, 0x40, 0x14, 0x11,
- 0x24, 0x6e, 0x47, 0x4f, 0x0d, 0x5e, 0x56, 0x37, 0xaf, 0x94, 0x76,
- 0x72, 0x83, 0xd5, 0x3e, 0x06, 0x17, 0xe9, 0x81, 0xf4})),
- std::make_pair(
- 245,
- std::vector<uint8_t>(
- {0x23, 0x0a, 0x1c, 0x85, 0x7c, 0xb2, 0xe7, 0x85, 0x2e, 0x41, 0xb6,
- 0x47, 0xe9, 0x0e, 0x45, 0x85, 0xd2, 0xd8, 0x81, 0xe1, 0x73, 0x4d,
- 0xc3, 0x89, 0x55, 0x35, 0x6e, 0x8d, 0xd7, 0xbf, 0xf3, 0x90, 0x53,
- 0x09, 0x2c, 0x6b, 0x38, 0xe2, 0x36, 0xe1, 0x89, 0x95, 0x25, 0x64,
- 0x70, 0x73, 0xdd, 0xdf, 0x68, 0x95, 0xd6, 0x42, 0x06, 0x32, 0x5e,
- 0x76, 0x47, 0xf2, 0x75, 0x56, 0x7b, 0x25, 0x59, 0x09})),
- std::make_pair(
- 246,
- std::vector<uint8_t>(
- {0xcb, 0xb6, 0x53, 0x21, 0xac, 0x43, 0x6e, 0x2f, 0xfd, 0xab, 0x29,
- 0x36, 0x35, 0x9c, 0xe4, 0x90, 0x23, 0xf7, 0xde, 0xe7, 0x61, 0x4e,
- 0xf2, 0x8d, 0x17, 0x3c, 0x3d, 0x27, 0xc5, 0xd1, 0xbf, 0xfa, 0x51,
- 0x55, 0x3d, 0x43, 0x3f, 0x8e, 0xe3, 0xc9, 0xe4, 0x9c, 0x05, 0xa2,
- 0xb8, 0x83, 0xcc, 0xe9, 0x54, 0xc9, 0xa8, 0x09, 0x3b, 0x80, 0x61,
- 0x2a, 0x0c, 0xdd, 0x47, 0x32, 0xe0, 0x41, 0xf9, 0x95})),
- std::make_pair(
- 247,
- std::vector<uint8_t>(
- {0x3e, 0x7e, 0x57, 0x00, 0x74, 0x33, 0x72, 0x75, 0xef, 0xb5, 0x13,
- 0x15, 0x58, 0x80, 0x34, 0xc3, 0xcf, 0x0d, 0xdd, 0xca, 0x20, 0xb4,
- 0x61, 0x2e, 0x0b, 0xd5, 0xb8, 0x81, 0xe7, 0xe5, 0x47, 0x6d, 0x31,
- 0x9c, 0xe4, 0xfe, 0x9f, 0x19, 0x18, 0x6e, 0x4c, 0x08, 0x26, 0xf4,
- 0x4f, 0x13, 0x1e, 0xb0, 0x48, 0xe6, 0x5b, 0xe2, 0x42, 0xb1, 0x17,
- 0x2c, 0x63, 0xba, 0xdb, 0x12, 0x3a, 0xb0, 0xcb, 0xe8})),
- std::make_pair(
- 248,
- std::vector<uint8_t>(
- {0xd3, 0x2e, 0x9e, 0xc0, 0x2d, 0x38, 0xd4, 0xe1, 0xb8, 0x24, 0x9d,
- 0xf8, 0xdc, 0xb0, 0x0c, 0x5b, 0x9c, 0x68, 0xeb, 0x89, 0x22, 0x67,
- 0x2e, 0x35, 0x05, 0x39, 0x3b, 0x6a, 0x21, 0x0b, 0xa5, 0x6f, 0x94,
- 0x96, 0xe5, 0xee, 0x04, 0x90, 0xef, 0x38, 0x7c, 0x3c, 0xde, 0xc0,
- 0x61, 0xf0, 0x6b, 0xc0, 0x38, 0x2d, 0x93, 0x04, 0xca, 0xfb, 0xb8,
- 0xe0, 0xcd, 0x33, 0xd5, 0x70, 0x29, 0xe6, 0x2d, 0xf2})),
- std::make_pair(
- 249,
- std::vector<uint8_t>(
- {0x8c, 0x15, 0x12, 0x46, 0x60, 0x89, 0xf0, 0x5b, 0x37, 0x75, 0xc2,
- 0x62, 0xb6, 0x2d, 0x22, 0xb8, 0x38, 0x54, 0xa8, 0x32, 0x18, 0x13,
- 0x0b, 0x4e, 0xc9, 0x1b, 0x3c, 0xcb, 0xd2, 0x93, 0xd2, 0xa5, 0x43,
- 0x02, 0xce, 0xca, 0xab, 0x9b, 0x10, 0x0c, 0x68, 0xd1, 0xe6, 0xdd,
- 0xc8, 0xf0, 0x7c, 0xdd, 0xbd, 0xfe, 0x6f, 0xda, 0xaa, 0xf0, 0x99,
- 0xcc, 0x09, 0xd6, 0xb7, 0x25, 0x87, 0x9c, 0x63, 0x69})),
- std::make_pair(
- 250,
- std::vector<uint8_t>(
- {0x91, 0xa7, 0xf6, 0x1c, 0x97, 0xc2, 0x91, 0x1e, 0x4c, 0x81, 0x2e,
- 0xf7, 0x1d, 0x78, 0x0a, 0xd8, 0xfa, 0x78, 0x87, 0x94, 0x56, 0x1d,
- 0x08, 0x30, 0x3f, 0xd1, 0xc1, 0xcb, 0x60, 0x8a, 0x46, 0xa1, 0x25,
- 0x63, 0x08, 0x6e, 0xc5, 0xb3, 0x9d, 0x47, 0x1a, 0xed, 0x94, 0xfb,
- 0x0f, 0x6c, 0x67, 0x8a, 0x43, 0xb8, 0x79, 0x29, 0x32, 0xf9, 0x02,
- 0x8d, 0x77, 0x2a, 0x22, 0x76, 0x8e, 0xa2, 0x3a, 0x9b})),
- std::make_pair(
- 251,
- std::vector<uint8_t>(
- {0x4f, 0x6b, 0xb2, 0x22, 0xa3, 0x95, 0xe8, 0xb1, 0x8f, 0x6b, 0xa1,
- 0x55, 0x47, 0x7a, 0xed, 0x3f, 0x07, 0x29, 0xac, 0x9e, 0x83, 0xe1,
- 0x6d, 0x31, 0xa2, 0xa8, 0xbc, 0x65, 0x54, 0x22, 0xb8, 0x37, 0xc8,
- 0x91, 0xc6, 0x19, 0x9e, 0x6f, 0x0d, 0x75, 0x79, 0x9e, 0x3b, 0x69,
- 0x15, 0x25, 0xc5, 0x81, 0x95, 0x35, 0x17, 0xf2, 0x52, 0xc4, 0xb9,
- 0xe3, 0xa2, 0x7a, 0x28, 0xfb, 0xaf, 0x49, 0x64, 0x4c})),
- std::make_pair(
- 252,
- std::vector<uint8_t>(
- {0x5d, 0x06, 0xc0, 0x7e, 0x7a, 0x64, 0x6c, 0x41, 0x3a, 0x50, 0x1c,
- 0x3f, 0x4b, 0xb2, 0xfc, 0x38, 0x12, 0x7d, 0xe7, 0x50, 0x9b, 0x70,
- 0x77, 0xc4, 0xd9, 0xb5, 0x61, 0x32, 0x01, 0xc1, 0xaa, 0x02, 0xfd,
- 0x5f, 0x79, 0xd2, 0x74, 0x59, 0x15, 0xdd, 0x57, 0xfb, 0xcb, 0x4c,
- 0xe0, 0x86, 0x95, 0xf6, 0xef, 0xc0, 0xcb, 0x3d, 0x2d, 0x33, 0x0e,
- 0x19, 0xb4, 0xb0, 0xe6, 0x00, 0x4e, 0xa6, 0x47, 0x1e})),
- std::make_pair(
- 253,
- std::vector<uint8_t>(
- {0xb9, 0x67, 0x56, 0xe5, 0x79, 0x09, 0x96, 0x8f, 0x14, 0xb7, 0x96,
- 0xa5, 0xd3, 0x0f, 0x4c, 0x9d, 0x67, 0x14, 0x72, 0xcf, 0x82, 0xc8,
- 0xcf, 0xb2, 0xca, 0xca, 0x7a, 0xc7, 0xa4, 0x4c, 0xa0, 0xa1, 0x4c,
- 0x98, 0x42, 0xd0, 0x0c, 0x82, 0xe3, 0x37, 0x50, 0x2c, 0x94, 0xd5,
- 0x96, 0x0a, 0xca, 0x4c, 0x49, 0x2e, 0xa7, 0xb0, 0xdf, 0x91, 0x9d,
- 0xdf, 0x1a, 0xad, 0xa2, 0xa2, 0x75, 0xbb, 0x10, 0xd4})),
- std::make_pair(
- 254,
- std::vector<uint8_t>(
- {0xff, 0x0a, 0x01, 0x5e, 0x98, 0xdb, 0x9c, 0x99, 0xf0, 0x39, 0x77,
- 0x71, 0x0a, 0xac, 0x3e, 0x65, 0x8c, 0x0d, 0x89, 0x6f, 0x6d, 0x71,
- 0xd6, 0x18, 0xba, 0x79, 0xdc, 0x6c, 0xf7, 0x2a, 0xc7, 0x5b, 0x7c,
- 0x03, 0x8e, 0xb6, 0x86, 0x2d, 0xed, 0xe4, 0x54, 0x3e, 0x14, 0x54,
- 0x13, 0xa6, 0x36, 0x8d, 0x69, 0xf5, 0x72, 0x2c, 0x82, 0x7b, 0xa3,
- 0xef, 0x25, 0xb6, 0xae, 0x64, 0x40, 0xd3, 0x92, 0x76})),
- std::make_pair(
- 255,
- std::vector<uint8_t>(
- {0x5b, 0x21, 0xc5, 0xfd, 0x88, 0x68, 0x36, 0x76, 0x12, 0x47, 0x4f,
- 0xa2, 0xe7, 0x0e, 0x9c, 0xfa, 0x22, 0x01, 0xff, 0xee, 0xe8, 0xfa,
- 0xfa, 0xb5, 0x79, 0x7a, 0xd5, 0x8f, 0xef, 0xa1, 0x7c, 0x9b, 0x5b,
- 0x10, 0x7d, 0xa4, 0xa3, 0xdb, 0x63, 0x20, 0xba, 0xaf, 0x2c, 0x86,
- 0x17, 0xd5, 0xa5, 0x1d, 0xf9, 0x14, 0xae, 0x88, 0xda, 0x38, 0x67,
- 0xc2, 0xd4, 0x1f, 0x0c, 0xc1, 0x4f, 0xa6, 0x79, 0x28}))};
-
-std::vector<std::pair<int, std::vector<uint8_t>>> TestcasesKeyed = {
- std::make_pair(
- 0,
- std::vector<uint8_t>(
- {0x10, 0xeb, 0xb6, 0x77, 0x00, 0xb1, 0x86, 0x8e, 0xfb, 0x44, 0x17,
- 0x98, 0x7a, 0xcf, 0x46, 0x90, 0xae, 0x9d, 0x97, 0x2f, 0xb7, 0xa5,
- 0x90, 0xc2, 0xf0, 0x28, 0x71, 0x79, 0x9a, 0xaa, 0x47, 0x86, 0xb5,
- 0xe9, 0x96, 0xe8, 0xf0, 0xf4, 0xeb, 0x98, 0x1f, 0xc2, 0x14, 0xb0,
- 0x05, 0xf4, 0x2d, 0x2f, 0xf4, 0x23, 0x34, 0x99, 0x39, 0x16, 0x53,
- 0xdf, 0x7a, 0xef, 0xcb, 0xc1, 0x3f, 0xc5, 0x15, 0x68})),
- std::make_pair(
- 1,
- std::vector<uint8_t>(
- {0x96, 0x1f, 0x6d, 0xd1, 0xe4, 0xdd, 0x30, 0xf6, 0x39, 0x01, 0x69,
- 0x0c, 0x51, 0x2e, 0x78, 0xe4, 0xb4, 0x5e, 0x47, 0x42, 0xed, 0x19,
- 0x7c, 0x3c, 0x5e, 0x45, 0xc5, 0x49, 0xfd, 0x25, 0xf2, 0xe4, 0x18,
- 0x7b, 0x0b, 0xc9, 0xfe, 0x30, 0x49, 0x2b, 0x16, 0xb0, 0xd0, 0xbc,
- 0x4e, 0xf9, 0xb0, 0xf3, 0x4c, 0x70, 0x03, 0xfa, 0xc0, 0x9a, 0x5e,
- 0xf1, 0x53, 0x2e, 0x69, 0x43, 0x02, 0x34, 0xce, 0xbd})),
- std::make_pair(
- 2,
- std::vector<uint8_t>(
- {0xda, 0x2c, 0xfb, 0xe2, 0xd8, 0x40, 0x9a, 0x0f, 0x38, 0x02, 0x61,
- 0x13, 0x88, 0x4f, 0x84, 0xb5, 0x01, 0x56, 0x37, 0x1a, 0xe3, 0x04,
- 0xc4, 0x43, 0x01, 0x73, 0xd0, 0x8a, 0x99, 0xd9, 0xfb, 0x1b, 0x98,
- 0x31, 0x64, 0xa3, 0x77, 0x07, 0x06, 0xd5, 0x37, 0xf4, 0x9e, 0x0c,
- 0x91, 0x6d, 0x9f, 0x32, 0xb9, 0x5c, 0xc3, 0x7a, 0x95, 0xb9, 0x9d,
- 0x85, 0x74, 0x36, 0xf0, 0x23, 0x2c, 0x88, 0xa9, 0x65})),
- std::make_pair(
- 3,
- std::vector<uint8_t>(
- {0x33, 0xd0, 0x82, 0x5d, 0xdd, 0xf7, 0xad, 0xa9, 0x9b, 0x0e, 0x7e,
- 0x30, 0x71, 0x04, 0xad, 0x07, 0xca, 0x9c, 0xfd, 0x96, 0x92, 0x21,
- 0x4f, 0x15, 0x61, 0x35, 0x63, 0x15, 0xe7, 0x84, 0xf3, 0xe5, 0xa1,
- 0x7e, 0x36, 0x4a, 0xe9, 0xdb, 0xb1, 0x4c, 0xb2, 0x03, 0x6d, 0xf9,
- 0x32, 0xb7, 0x7f, 0x4b, 0x29, 0x27, 0x61, 0x36, 0x5f, 0xb3, 0x28,
- 0xde, 0x7a, 0xfd, 0xc6, 0xd8, 0x99, 0x8f, 0x5f, 0xc1})),
- std::make_pair(
- 4,
- std::vector<uint8_t>(
- {0xbe, 0xaa, 0x5a, 0x3d, 0x08, 0xf3, 0x80, 0x71, 0x43, 0xcf, 0x62,
- 0x1d, 0x95, 0xcd, 0x69, 0x05, 0x14, 0xd0, 0xb4, 0x9e, 0xff, 0xf9,
- 0xc9, 0x1d, 0x24, 0xb5, 0x92, 0x41, 0xec, 0x0e, 0xef, 0xa5, 0xf6,
- 0x01, 0x96, 0xd4, 0x07, 0x04, 0x8b, 0xba, 0x8d, 0x21, 0x46, 0x82,
- 0x8e, 0xbc, 0xb0, 0x48, 0x8d, 0x88, 0x42, 0xfd, 0x56, 0xbb, 0x4f,
- 0x6d, 0xf8, 0xe1, 0x9c, 0x4b, 0x4d, 0xaa, 0xb8, 0xac})),
- std::make_pair(
- 5,
- std::vector<uint8_t>(
- {0x09, 0x80, 0x84, 0xb5, 0x1f, 0xd1, 0x3d, 0xea, 0xe5, 0xf4, 0x32,
- 0x0d, 0xe9, 0x4a, 0x68, 0x8e, 0xe0, 0x7b, 0xae, 0xa2, 0x80, 0x04,
- 0x86, 0x68, 0x9a, 0x86, 0x36, 0x11, 0x7b, 0x46, 0xc1, 0xf4, 0xc1,
- 0xf6, 0xaf, 0x7f, 0x74, 0xae, 0x7c, 0x85, 0x76, 0x00, 0x45, 0x6a,
- 0x58, 0xa3, 0xaf, 0x25, 0x1d, 0xc4, 0x72, 0x3a, 0x64, 0xcc, 0x7c,
- 0x0a, 0x5a, 0xb6, 0xd9, 0xca, 0xc9, 0x1c, 0x20, 0xbb})),
- std::make_pair(
- 6,
- std::vector<uint8_t>(
- {0x60, 0x44, 0x54, 0x0d, 0x56, 0x08, 0x53, 0xeb, 0x1c, 0x57, 0xdf,
- 0x00, 0x77, 0xdd, 0x38, 0x10, 0x94, 0x78, 0x1c, 0xdb, 0x90, 0x73,
- 0xe5, 0xb1, 0xb3, 0xd3, 0xf6, 0xc7, 0x82, 0x9e, 0x12, 0x06, 0x6b,
- 0xba, 0xca, 0x96, 0xd9, 0x89, 0xa6, 0x90, 0xde, 0x72, 0xca, 0x31,
- 0x33, 0xa8, 0x36, 0x52, 0xba, 0x28, 0x4a, 0x6d, 0x62, 0x94, 0x2b,
- 0x27, 0x1f, 0xfa, 0x26, 0x20, 0xc9, 0xe7, 0x5b, 0x1f})),
- std::make_pair(
- 7,
- std::vector<uint8_t>(
- {0x7a, 0x8c, 0xfe, 0x9b, 0x90, 0xf7, 0x5f, 0x7e, 0xcb, 0x3a, 0xcc,
- 0x05, 0x3a, 0xae, 0xd6, 0x19, 0x31, 0x12, 0xb6, 0xf6, 0xa4, 0xae,
- 0xeb, 0x3f, 0x65, 0xd3, 0xde, 0x54, 0x19, 0x42, 0xde, 0xb9, 0xe2,
- 0x22, 0x81, 0x52, 0xa3, 0xc4, 0xbb, 0xbe, 0x72, 0xfc, 0x3b, 0x12,
- 0x62, 0x95, 0x28, 0xcf, 0xbb, 0x09, 0xfe, 0x63, 0x0f, 0x04, 0x74,
- 0x33, 0x9f, 0x54, 0xab, 0xf4, 0x53, 0xe2, 0xed, 0x52})),
- std::make_pair(
- 8,
- std::vector<uint8_t>(
- {0x38, 0x0b, 0xea, 0xf6, 0xea, 0x7c, 0xc9, 0x36, 0x5e, 0x27, 0x0e,
- 0xf0, 0xe6, 0xf3, 0xa6, 0x4f, 0xb9, 0x02, 0xac, 0xae, 0x51, 0xdd,
- 0x55, 0x12, 0xf8, 0x42, 0x59, 0xad, 0x2c, 0x91, 0xf4, 0xbc, 0x41,
- 0x08, 0xdb, 0x73, 0x19, 0x2a, 0x5b, 0xbf, 0xb0, 0xcb, 0xcf, 0x71,
- 0xe4, 0x6c, 0x3e, 0x21, 0xae, 0xe1, 0xc5, 0xe8, 0x60, 0xdc, 0x96,
- 0xe8, 0xeb, 0x0b, 0x7b, 0x84, 0x26, 0xe6, 0xab, 0xe9})),
- std::make_pair(
- 9,
- std::vector<uint8_t>(
- {0x60, 0xfe, 0x3c, 0x45, 0x35, 0xe1, 0xb5, 0x9d, 0x9a, 0x61, 0xea,
- 0x85, 0x00, 0xbf, 0xac, 0x41, 0xa6, 0x9d, 0xff, 0xb1, 0xce, 0xad,
- 0xd9, 0xac, 0xa3, 0x23, 0xe9, 0xa6, 0x25, 0xb6, 0x4d, 0xa5, 0x76,
- 0x3b, 0xad, 0x72, 0x26, 0xda, 0x02, 0xb9, 0xc8, 0xc4, 0xf1, 0xa5,
- 0xde, 0x14, 0x0a, 0xc5, 0xa6, 0xc1, 0x12, 0x4e, 0x4f, 0x71, 0x8c,
- 0xe0, 0xb2, 0x8e, 0xa4, 0x73, 0x93, 0xaa, 0x66, 0x37})),
- std::make_pair(
- 10,
- std::vector<uint8_t>(
- {0x4f, 0xe1, 0x81, 0xf5, 0x4a, 0xd6, 0x3a, 0x29, 0x83, 0xfe, 0xaa,
- 0xf7, 0x7d, 0x1e, 0x72, 0x35, 0xc2, 0xbe, 0xb1, 0x7f, 0xa3, 0x28,
- 0xb6, 0xd9, 0x50, 0x5b, 0xda, 0x32, 0x7d, 0xf1, 0x9f, 0xc3, 0x7f,
- 0x02, 0xc4, 0xb6, 0xf0, 0x36, 0x8c, 0xe2, 0x31, 0x47, 0x31, 0x3a,
- 0x8e, 0x57, 0x38, 0xb5, 0xfa, 0x2a, 0x95, 0xb2, 0x9d, 0xe1, 0xc7,
- 0xf8, 0x26, 0x4e, 0xb7, 0x7b, 0x69, 0xf5, 0x85, 0xcd})),
- std::make_pair(
- 11,
- std::vector<uint8_t>(
- {0xf2, 0x28, 0x77, 0x3c, 0xe3, 0xf3, 0xa4, 0x2b, 0x5f, 0x14, 0x4d,
- 0x63, 0x23, 0x7a, 0x72, 0xd9, 0x96, 0x93, 0xad, 0xb8, 0x83, 0x7d,
- 0x0e, 0x11, 0x2a, 0x8a, 0x0f, 0x8f, 0xff, 0xf2, 0xc3, 0x62, 0x85,
- 0x7a, 0xc4, 0x9c, 0x11, 0xec, 0x74, 0x0d, 0x15, 0x00, 0x74, 0x9d,
- 0xac, 0x9b, 0x1f, 0x45, 0x48, 0x10, 0x8b, 0xf3, 0x15, 0x57, 0x94,
- 0xdc, 0xc9, 0xe4, 0x08, 0x28, 0x49, 0xe2, 0xb8, 0x5b})),
- std::make_pair(
- 12,
- std::vector<uint8_t>(
- {0x96, 0x24, 0x52, 0xa8, 0x45, 0x5c, 0xc5, 0x6c, 0x85, 0x11, 0x31,
- 0x7e, 0x3b, 0x1f, 0x3b, 0x2c, 0x37, 0xdf, 0x75, 0xf5, 0x88, 0xe9,
- 0x43, 0x25, 0xfd, 0xd7, 0x70, 0x70, 0x35, 0x9c, 0xf6, 0x3a, 0x9a,
- 0xe6, 0xe9, 0x30, 0x93, 0x6f, 0xdf, 0x8e, 0x1e, 0x08, 0xff, 0xca,
- 0x44, 0x0c, 0xfb, 0x72, 0xc2, 0x8f, 0x06, 0xd8, 0x9a, 0x21, 0x51,
- 0xd1, 0xc4, 0x6c, 0xd5, 0xb2, 0x68, 0xef, 0x85, 0x63})),
- std::make_pair(
- 13,
- std::vector<uint8_t>(
- {0x43, 0xd4, 0x4b, 0xfa, 0x18, 0x76, 0x8c, 0x59, 0x89, 0x6b, 0xf7,
- 0xed, 0x17, 0x65, 0xcb, 0x2d, 0x14, 0xaf, 0x8c, 0x26, 0x02, 0x66,
- 0x03, 0x90, 0x99, 0xb2, 0x5a, 0x60, 0x3e, 0x4d, 0xdc, 0x50, 0x39,
- 0xd6, 0xef, 0x3a, 0x91, 0x84, 0x7d, 0x10, 0x88, 0xd4, 0x01, 0xc0,
- 0xc7, 0xe8, 0x47, 0x78, 0x1a, 0x8a, 0x59, 0x0d, 0x33, 0xa3, 0xc6,
- 0xcb, 0x4d, 0xf0, 0xfa, 0xb1, 0xc2, 0xf2, 0x23, 0x55})),
- std::make_pair(
- 14,
- std::vector<uint8_t>(
- {0xdc, 0xff, 0xa9, 0xd5, 0x8c, 0x2a, 0x4c, 0xa2, 0xcd, 0xbb, 0x0c,
- 0x7a, 0xa4, 0xc4, 0xc1, 0xd4, 0x51, 0x65, 0x19, 0x00, 0x89, 0xf4,
- 0xe9, 0x83, 0xbb, 0x1c, 0x2c, 0xab, 0x4a, 0xae, 0xff, 0x1f, 0xa2,
- 0xb5, 0xee, 0x51, 0x6f, 0xec, 0xd7, 0x80, 0x54, 0x02, 0x40, 0xbf,
- 0x37, 0xe5, 0x6c, 0x8b, 0xcc, 0xa7, 0xfa, 0xb9, 0x80, 0xe1, 0xe6,
- 0x1c, 0x94, 0x00, 0xd8, 0xa9, 0xa5, 0xb1, 0x4a, 0xc6})),
- std::make_pair(
- 15,
- std::vector<uint8_t>(
- {0x6f, 0xbf, 0x31, 0xb4, 0x5a, 0xb0, 0xc0, 0xb8, 0xda, 0xd1, 0xc0,
- 0xf5, 0xf4, 0x06, 0x13, 0x79, 0x91, 0x2d, 0xde, 0x5a, 0xa9, 0x22,
- 0x09, 0x9a, 0x03, 0x0b, 0x72, 0x5c, 0x73, 0x34, 0x6c, 0x52, 0x42,
- 0x91, 0xad, 0xef, 0x89, 0xd2, 0xf6, 0xfd, 0x8d, 0xfc, 0xda, 0x6d,
- 0x07, 0xda, 0xd8, 0x11, 0xa9, 0x31, 0x45, 0x36, 0xc2, 0x91, 0x5e,
- 0xd4, 0x5d, 0xa3, 0x49, 0x47, 0xe8, 0x3d, 0xe3, 0x4e})),
- std::make_pair(
- 16,
- std::vector<uint8_t>(
- {0xa0, 0xc6, 0x5b, 0xdd, 0xde, 0x8a, 0xde, 0xf5, 0x72, 0x82, 0xb0,
- 0x4b, 0x11, 0xe7, 0xbc, 0x8a, 0xab, 0x10, 0x5b, 0x99, 0x23, 0x1b,
- 0x75, 0x0c, 0x02, 0x1f, 0x4a, 0x73, 0x5c, 0xb1, 0xbc, 0xfa, 0xb8,
- 0x75, 0x53, 0xbb, 0xa3, 0xab, 0xb0, 0xc3, 0xe6, 0x4a, 0x0b, 0x69,
- 0x55, 0x28, 0x51, 0x85, 0xa0, 0xbd, 0x35, 0xfb, 0x8c, 0xfd, 0xe5,
- 0x57, 0x32, 0x9b, 0xeb, 0xb1, 0xf6, 0x29, 0xee, 0x93})),
- std::make_pair(
- 17,
- std::vector<uint8_t>(
- {0xf9, 0x9d, 0x81, 0x55, 0x50, 0x55, 0x8e, 0x81, 0xec, 0xa2, 0xf9,
- 0x67, 0x18, 0xae, 0xd1, 0x0d, 0x86, 0xf3, 0xf1, 0xcf, 0xb6, 0x75,
- 0xcc, 0xe0, 0x6b, 0x0e, 0xff, 0x02, 0xf6, 0x17, 0xc5, 0xa4, 0x2c,
- 0x5a, 0xa7, 0x60, 0x27, 0x0f, 0x26, 0x79, 0xda, 0x26, 0x77, 0xc5,
- 0xae, 0xb9, 0x4f, 0x11, 0x42, 0x27, 0x7f, 0x21, 0xc7, 0xf7, 0x9f,
- 0x3c, 0x4f, 0x0c, 0xce, 0x4e, 0xd8, 0xee, 0x62, 0xb1})),
- std::make_pair(
- 18,
- std::vector<uint8_t>(
- {0x95, 0x39, 0x1d, 0xa8, 0xfc, 0x7b, 0x91, 0x7a, 0x20, 0x44, 0xb3,
- 0xd6, 0xf5, 0x37, 0x4e, 0x1c, 0xa0, 0x72, 0xb4, 0x14, 0x54, 0xd5,
- 0x72, 0xc7, 0x35, 0x6c, 0x05, 0xfd, 0x4b, 0xc1, 0xe0, 0xf4, 0x0b,
- 0x8b, 0xb8, 0xb4, 0xa9, 0xf6, 0xbc, 0xe9, 0xbe, 0x2c, 0x46, 0x23,
- 0xc3, 0x99, 0xb0, 0xdc, 0xa0, 0xda, 0xb0, 0x5c, 0xb7, 0x28, 0x1b,
- 0x71, 0xa2, 0x1b, 0x0e, 0xbc, 0xd9, 0xe5, 0x56, 0x70})),
- std::make_pair(
- 19,
- std::vector<uint8_t>(
- {0x04, 0xb9, 0xcd, 0x3d, 0x20, 0xd2, 0x21, 0xc0, 0x9a, 0xc8, 0x69,
- 0x13, 0xd3, 0xdc, 0x63, 0x04, 0x19, 0x89, 0xa9, 0xa1, 0xe6, 0x94,
- 0xf1, 0xe6, 0x39, 0xa3, 0xba, 0x7e, 0x45, 0x18, 0x40, 0xf7, 0x50,
- 0xc2, 0xfc, 0x19, 0x1d, 0x56, 0xad, 0x61, 0xf2, 0xe7, 0x93, 0x6b,
- 0xc0, 0xac, 0x8e, 0x09, 0x4b, 0x60, 0xca, 0xee, 0xd8, 0x78, 0xc1,
- 0x87, 0x99, 0x04, 0x54, 0x02, 0xd6, 0x1c, 0xea, 0xf9})),
- std::make_pair(
- 20,
- std::vector<uint8_t>(
- {0xec, 0x0e, 0x0e, 0xf7, 0x07, 0xe4, 0xed, 0x6c, 0x0c, 0x66, 0xf9,
- 0xe0, 0x89, 0xe4, 0x95, 0x4b, 0x05, 0x80, 0x30, 0xd2, 0xdd, 0x86,
- 0x39, 0x8f, 0xe8, 0x40, 0x59, 0x63, 0x1f, 0x9e, 0xe5, 0x91, 0xd9,
- 0xd7, 0x73, 0x75, 0x35, 0x51, 0x49, 0x17, 0x8c, 0x0c, 0xf8, 0xf8,
- 0xe7, 0xc4, 0x9e, 0xd2, 0xa5, 0xe4, 0xf9, 0x54, 0x88, 0xa2, 0x24,
- 0x70, 0x67, 0xc2, 0x08, 0x51, 0x0f, 0xad, 0xc4, 0x4c})),
- std::make_pair(
- 21,
- std::vector<uint8_t>(
- {0x9a, 0x37, 0xcc, 0xe2, 0x73, 0xb7, 0x9c, 0x09, 0x91, 0x36, 0x77,
- 0x51, 0x0e, 0xaf, 0x76, 0x88, 0xe8, 0x9b, 0x33, 0x14, 0xd3, 0x53,
- 0x2f, 0xd2, 0x76, 0x4c, 0x39, 0xde, 0x02, 0x2a, 0x29, 0x45, 0xb5,
- 0x71, 0x0d, 0x13, 0x51, 0x7a, 0xf8, 0xdd, 0xc0, 0x31, 0x66, 0x24,
- 0xe7, 0x3b, 0xec, 0x1c, 0xe6, 0x7d, 0xf1, 0x52, 0x28, 0x30, 0x20,
- 0x36, 0xf3, 0x30, 0xab, 0x0c, 0xb4, 0xd2, 0x18, 0xdd})),
- std::make_pair(
- 22,
- std::vector<uint8_t>(
- {0x4c, 0xf9, 0xbb, 0x8f, 0xb3, 0xd4, 0xde, 0x8b, 0x38, 0xb2, 0xf2,
- 0x62, 0xd3, 0xc4, 0x0f, 0x46, 0xdf, 0xe7, 0x47, 0xe8, 0xfc, 0x0a,
- 0x41, 0x4c, 0x19, 0x3d, 0x9f, 0xcf, 0x75, 0x31, 0x06, 0xce, 0x47,
- 0xa1, 0x8f, 0x17, 0x2f, 0x12, 0xe8, 0xa2, 0xf1, 0xc2, 0x67, 0x26,
- 0x54, 0x53, 0x58, 0xe5, 0xee, 0x28, 0xc9, 0xe2, 0x21, 0x3a, 0x87,
- 0x87, 0xaa, 0xfb, 0xc5, 0x16, 0xd2, 0x34, 0x31, 0x52})),
- std::make_pair(
- 23,
- std::vector<uint8_t>(
- {0x64, 0xe0, 0xc6, 0x3a, 0xf9, 0xc8, 0x08, 0xfd, 0x89, 0x31, 0x37,
- 0x12, 0x98, 0x67, 0xfd, 0x91, 0x93, 0x9d, 0x53, 0xf2, 0xaf, 0x04,
- 0xbe, 0x4f, 0xa2, 0x68, 0x00, 0x61, 0x00, 0x06, 0x9b, 0x2d, 0x69,
- 0xda, 0xa5, 0xc5, 0xd8, 0xed, 0x7f, 0xdd, 0xcb, 0x2a, 0x70, 0xee,
- 0xec, 0xdf, 0x2b, 0x10, 0x5d, 0xd4, 0x6a, 0x1e, 0x3b, 0x73, 0x11,
- 0x72, 0x8f, 0x63, 0x9a, 0xb4, 0x89, 0x32, 0x6b, 0xc9})),
- std::make_pair(
- 24,
- std::vector<uint8_t>(
- {0x5e, 0x9c, 0x93, 0x15, 0x8d, 0x65, 0x9b, 0x2d, 0xef, 0x06, 0xb0,
- 0xc3, 0xc7, 0x56, 0x50, 0x45, 0x54, 0x26, 0x62, 0xd6, 0xee, 0xe8,
- 0xa9, 0x6a, 0x89, 0xb7, 0x8a, 0xde, 0x09, 0xfe, 0x8b, 0x3d, 0xcc,
- 0x09, 0x6d, 0x4f, 0xe4, 0x88, 0x15, 0xd8, 0x8d, 0x8f, 0x82, 0x62,
- 0x01, 0x56, 0x60, 0x2a, 0xf5, 0x41, 0x95, 0x5e, 0x1f, 0x6c, 0xa3,
- 0x0d, 0xce, 0x14, 0xe2, 0x54, 0xc3, 0x26, 0xb8, 0x8f})),
- std::make_pair(
- 25,
- std::vector<uint8_t>(
- {0x77, 0x75, 0xdf, 0xf8, 0x89, 0x45, 0x8d, 0xd1, 0x1a, 0xef, 0x41,
- 0x72, 0x76, 0x85, 0x3e, 0x21, 0x33, 0x5e, 0xb8, 0x8e, 0x4d, 0xec,
- 0x9c, 0xfb, 0x4e, 0x9e, 0xdb, 0x49, 0x82, 0x00, 0x88, 0x55, 0x1a,
- 0x2c, 0xa6, 0x03, 0x39, 0xf1, 0x20, 0x66, 0x10, 0x11, 0x69, 0xf0,
- 0xdf, 0xe8, 0x4b, 0x09, 0x8f, 0xdd, 0xb1, 0x48, 0xd9, 0xda, 0x6b,
- 0x3d, 0x61, 0x3d, 0xf2, 0x63, 0x88, 0x9a, 0xd6, 0x4b})),
- std::make_pair(
- 26,
- std::vector<uint8_t>(
- {0xf0, 0xd2, 0x80, 0x5a, 0xfb, 0xb9, 0x1f, 0x74, 0x39, 0x51, 0x35,
- 0x1a, 0x6d, 0x02, 0x4f, 0x93, 0x53, 0xa2, 0x3c, 0x7c, 0xe1, 0xfc,
- 0x2b, 0x05, 0x1b, 0x3a, 0x8b, 0x96, 0x8c, 0x23, 0x3f, 0x46, 0xf5,
- 0x0f, 0x80, 0x6e, 0xcb, 0x15, 0x68, 0xff, 0xaa, 0x0b, 0x60, 0x66,
- 0x1e, 0x33, 0x4b, 0x21, 0xdd, 0xe0, 0x4f, 0x8f, 0xa1, 0x55, 0xac,
- 0x74, 0x0e, 0xeb, 0x42, 0xe2, 0x0b, 0x60, 0xd7, 0x64})),
- std::make_pair(
- 27,
- std::vector<uint8_t>(
- {0x86, 0xa2, 0xaf, 0x31, 0x6e, 0x7d, 0x77, 0x54, 0x20, 0x1b, 0x94,
- 0x2e, 0x27, 0x53, 0x64, 0xac, 0x12, 0xea, 0x89, 0x62, 0xab, 0x5b,
- 0xd8, 0xd7, 0xfb, 0x27, 0x6d, 0xc5, 0xfb, 0xff, 0xc8, 0xf9, 0xa2,
- 0x8c, 0xae, 0x4e, 0x48, 0x67, 0xdf, 0x67, 0x80, 0xd9, 0xb7, 0x25,
- 0x24, 0x16, 0x09, 0x27, 0xc8, 0x55, 0xda, 0x5b, 0x60, 0x78, 0xe0,
- 0xb5, 0x54, 0xaa, 0x91, 0xe3, 0x1c, 0xb9, 0xca, 0x1d})),
- std::make_pair(
- 28,
- std::vector<uint8_t>(
- {0x10, 0xbd, 0xf0, 0xca, 0xa0, 0x80, 0x27, 0x05, 0xe7, 0x06, 0x36,
- 0x9b, 0xaf, 0x8a, 0x3f, 0x79, 0xd7, 0x2c, 0x0a, 0x03, 0xa8, 0x06,
- 0x75, 0xa7, 0xbb, 0xb0, 0x0b, 0xe3, 0xa4, 0x5e, 0x51, 0x64, 0x24,
- 0xd1, 0xee, 0x88, 0xef, 0xb5, 0x6f, 0x6d, 0x57, 0x77, 0x54, 0x5a,
- 0xe6, 0xe2, 0x77, 0x65, 0xc3, 0xa8, 0xf5, 0xe4, 0x93, 0xfc, 0x30,
- 0x89, 0x15, 0x63, 0x89, 0x33, 0xa1, 0xdf, 0xee, 0x55})),
- std::make_pair(
- 29,
- std::vector<uint8_t>(
- {0xb0, 0x17, 0x81, 0x09, 0x2b, 0x17, 0x48, 0x45, 0x9e, 0x2e, 0x4e,
- 0xc1, 0x78, 0x69, 0x66, 0x27, 0xbf, 0x4e, 0xba, 0xfe, 0xbb, 0xa7,
- 0x74, 0xec, 0xf0, 0x18, 0xb7, 0x9a, 0x68, 0xae, 0xb8, 0x49, 0x17,
- 0xbf, 0x0b, 0x84, 0xbb, 0x79, 0xd1, 0x7b, 0x74, 0x31, 0x51, 0x14,
- 0x4c, 0xd6, 0x6b, 0x7b, 0x33, 0xa4, 0xb9, 0xe5, 0x2c, 0x76, 0xc4,
- 0xe1, 0x12, 0x05, 0x0f, 0xf5, 0x38, 0x5b, 0x7f, 0x0b})),
- std::make_pair(
- 30,
- std::vector<uint8_t>(
- {0xc6, 0xdb, 0xc6, 0x1d, 0xec, 0x6e, 0xae, 0xac, 0x81, 0xe3, 0xd5,
- 0xf7, 0x55, 0x20, 0x3c, 0x8e, 0x22, 0x05, 0x51, 0x53, 0x4a, 0x0b,
- 0x2f, 0xd1, 0x05, 0xa9, 0x18, 0x89, 0x94, 0x5a, 0x63, 0x85, 0x50,
- 0x20, 0x4f, 0x44, 0x09, 0x3d, 0xd9, 0x98, 0xc0, 0x76, 0x20, 0x5d,
- 0xff, 0xad, 0x70, 0x3a, 0x0e, 0x5c, 0xd3, 0xc7, 0xf4, 0x38, 0xa7,
- 0xe6, 0x34, 0xcd, 0x59, 0xfe, 0xde, 0xdb, 0x53, 0x9e})),
- std::make_pair(
- 31,
- std::vector<uint8_t>(
- {0xeb, 0xa5, 0x1a, 0xcf, 0xfb, 0x4c, 0xea, 0x31, 0xdb, 0x4b, 0x8d,
- 0x87, 0xe9, 0xbf, 0x7d, 0xd4, 0x8f, 0xe9, 0x7b, 0x02, 0x53, 0xae,
- 0x67, 0xaa, 0x58, 0x0f, 0x9a, 0xc4, 0xa9, 0xd9, 0x41, 0xf2, 0xbe,
- 0xa5, 0x18, 0xee, 0x28, 0x68, 0x18, 0xcc, 0x9f, 0x63, 0x3f, 0x2a,
- 0x3b, 0x9f, 0xb6, 0x8e, 0x59, 0x4b, 0x48, 0xcd, 0xd6, 0xd5, 0x15,
- 0xbf, 0x1d, 0x52, 0xba, 0x6c, 0x85, 0xa2, 0x03, 0xa7})),
- std::make_pair(
- 32,
- std::vector<uint8_t>(
- {0x86, 0x22, 0x1f, 0x3a, 0xda, 0x52, 0x03, 0x7b, 0x72, 0x22, 0x4f,
- 0x10, 0x5d, 0x79, 0x99, 0x23, 0x1c, 0x5e, 0x55, 0x34, 0xd0, 0x3d,
- 0xa9, 0xd9, 0xc0, 0xa1, 0x2a, 0xcb, 0x68, 0x46, 0x0c, 0xd3, 0x75,
- 0xda, 0xf8, 0xe2, 0x43, 0x86, 0x28, 0x6f, 0x96, 0x68, 0xf7, 0x23,
- 0x26, 0xdb, 0xf9, 0x9b, 0xa0, 0x94, 0x39, 0x24, 0x37, 0xd3, 0x98,
- 0xe9, 0x5b, 0xb8, 0x16, 0x1d, 0x71, 0x7f, 0x89, 0x91})),
- std::make_pair(
- 33,
- std::vector<uint8_t>(
- {0x55, 0x95, 0xe0, 0x5c, 0x13, 0xa7, 0xec, 0x4d, 0xc8, 0xf4, 0x1f,
- 0xb7, 0x0c, 0xb5, 0x0a, 0x71, 0xbc, 0xe1, 0x7c, 0x02, 0x4f, 0xf6,
- 0xde, 0x7a, 0xf6, 0x18, 0xd0, 0xcc, 0x4e, 0x9c, 0x32, 0xd9, 0x57,
- 0x0d, 0x6d, 0x3e, 0xa4, 0x5b, 0x86, 0x52, 0x54, 0x91, 0x03, 0x0c,
- 0x0d, 0x8f, 0x2b, 0x18, 0x36, 0xd5, 0x77, 0x8c, 0x1c, 0xe7, 0x35,
- 0xc1, 0x77, 0x07, 0xdf, 0x36, 0x4d, 0x05, 0x43, 0x47})),
- std::make_pair(
- 34,
- std::vector<uint8_t>(
- {0xce, 0x0f, 0x4f, 0x6a, 0xca, 0x89, 0x59, 0x0a, 0x37, 0xfe, 0x03,
- 0x4d, 0xd7, 0x4d, 0xd5, 0xfa, 0x65, 0xeb, 0x1c, 0xbd, 0x0a, 0x41,
- 0x50, 0x8a, 0xad, 0xdc, 0x09, 0x35, 0x1a, 0x3c, 0xea, 0x6d, 0x18,
- 0xcb, 0x21, 0x89, 0xc5, 0x4b, 0x70, 0x0c, 0x00, 0x9f, 0x4c, 0xbf,
- 0x05, 0x21, 0xc7, 0xea, 0x01, 0xbe, 0x61, 0xc5, 0xae, 0x09, 0xcb,
- 0x54, 0xf2, 0x7b, 0xc1, 0xb4, 0x4d, 0x65, 0x8c, 0x82})),
- std::make_pair(
- 35,
- std::vector<uint8_t>(
- {0x7e, 0xe8, 0x0b, 0x06, 0xa2, 0x15, 0xa3, 0xbc, 0xa9, 0x70, 0xc7,
- 0x7c, 0xda, 0x87, 0x61, 0x82, 0x2b, 0xc1, 0x03, 0xd4, 0x4f, 0xa4,
- 0xb3, 0x3f, 0x4d, 0x07, 0xdc, 0xb9, 0x97, 0xe3, 0x6d, 0x55, 0x29,
- 0x8b, 0xce, 0xae, 0x12, 0x24, 0x1b, 0x3f, 0xa0, 0x7f, 0xa6, 0x3b,
- 0xe5, 0x57, 0x60, 0x68, 0xda, 0x38, 0x7b, 0x8d, 0x58, 0x59, 0xae,
- 0xab, 0x70, 0x13, 0x69, 0x84, 0x8b, 0x17, 0x6d, 0x42})),
- std::make_pair(
- 36,
- std::vector<uint8_t>(
- {0x94, 0x0a, 0x84, 0xb6, 0xa8, 0x4d, 0x10, 0x9a, 0xab, 0x20, 0x8c,
- 0x02, 0x4c, 0x6c, 0xe9, 0x64, 0x76, 0x76, 0xba, 0x0a, 0xaa, 0x11,
- 0xf8, 0x6d, 0xbb, 0x70, 0x18, 0xf9, 0xfd, 0x22, 0x20, 0xa6, 0xd9,
- 0x01, 0xa9, 0x02, 0x7f, 0x9a, 0xbc, 0xf9, 0x35, 0x37, 0x27, 0x27,
- 0xcb, 0xf0, 0x9e, 0xbd, 0x61, 0xa2, 0xa2, 0xee, 0xb8, 0x76, 0x53,
- 0xe8, 0xec, 0xad, 0x1b, 0xab, 0x85, 0xdc, 0x83, 0x27})),
- std::make_pair(
- 37,
- std::vector<uint8_t>(
- {0x20, 0x20, 0xb7, 0x82, 0x64, 0xa8, 0x2d, 0x9f, 0x41, 0x51, 0x14,
- 0x1a, 0xdb, 0xa8, 0xd4, 0x4b, 0xf2, 0x0c, 0x5e, 0xc0, 0x62, 0xee,
- 0xe9, 0xb5, 0x95, 0xa1, 0x1f, 0x9e, 0x84, 0x90, 0x1b, 0xf1, 0x48,
- 0xf2, 0x98, 0xe0, 0xc9, 0xf8, 0x77, 0x7d, 0xcd, 0xbc, 0x7c, 0xc4,
- 0x67, 0x0a, 0xac, 0x35, 0x6c, 0xc2, 0xad, 0x8c, 0xcb, 0x16, 0x29,
- 0xf1, 0x6f, 0x6a, 0x76, 0xbc, 0xef, 0xbe, 0xe7, 0x60})),
- std::make_pair(
- 38,
- std::vector<uint8_t>(
- {0xd1, 0xb8, 0x97, 0xb0, 0xe0, 0x75, 0xba, 0x68, 0xab, 0x57, 0x2a,
- 0xdf, 0x9d, 0x9c, 0x43, 0x66, 0x63, 0xe4, 0x3e, 0xb3, 0xd8, 0xe6,
- 0x2d, 0x92, 0xfc, 0x49, 0xc9, 0xbe, 0x21, 0x4e, 0x6f, 0x27, 0x87,
- 0x3f, 0xe2, 0x15, 0xa6, 0x51, 0x70, 0xe6, 0xbe, 0xa9, 0x02, 0x40,
- 0x8a, 0x25, 0xb4, 0x95, 0x06, 0xf4, 0x7b, 0xab, 0xd0, 0x7c, 0xec,
- 0xf7, 0x11, 0x3e, 0xc1, 0x0c, 0x5d, 0xd3, 0x12, 0x52})),
- std::make_pair(
- 39,
- std::vector<uint8_t>(
- {0xb1, 0x4d, 0x0c, 0x62, 0xab, 0xfa, 0x46, 0x9a, 0x35, 0x71, 0x77,
- 0xe5, 0x94, 0xc1, 0x0c, 0x19, 0x42, 0x43, 0xed, 0x20, 0x25, 0xab,
- 0x8a, 0xa5, 0xad, 0x2f, 0xa4, 0x1a, 0xd3, 0x18, 0xe0, 0xff, 0x48,
- 0xcd, 0x5e, 0x60, 0xbe, 0xc0, 0x7b, 0x13, 0x63, 0x4a, 0x71, 0x1d,
- 0x23, 0x26, 0xe4, 0x88, 0xa9, 0x85, 0xf3, 0x1e, 0x31, 0x15, 0x33,
- 0x99, 0xe7, 0x30, 0x88, 0xef, 0xc8, 0x6a, 0x5c, 0x55})),
- std::make_pair(
- 40,
- std::vector<uint8_t>(
- {0x41, 0x69, 0xc5, 0xcc, 0x80, 0x8d, 0x26, 0x97, 0xdc, 0x2a, 0x82,
- 0x43, 0x0d, 0xc2, 0x3e, 0x3c, 0xd3, 0x56, 0xdc, 0x70, 0xa9, 0x45,
- 0x66, 0x81, 0x05, 0x02, 0xb8, 0xd6, 0x55, 0xb3, 0x9a, 0xbf, 0x9e,
- 0x7f, 0x90, 0x2f, 0xe7, 0x17, 0xe0, 0x38, 0x92, 0x19, 0x85, 0x9e,
- 0x19, 0x45, 0xdf, 0x1a, 0xf6, 0xad, 0xa4, 0x2e, 0x4c, 0xcd, 0xa5,
- 0x5a, 0x19, 0x7b, 0x71, 0x00, 0xa3, 0x0c, 0x30, 0xa1})),
- std::make_pair(
- 41,
- std::vector<uint8_t>(
- {0x25, 0x8a, 0x4e, 0xdb, 0x11, 0x3d, 0x66, 0xc8, 0x39, 0xc8, 0xb1,
- 0xc9, 0x1f, 0x15, 0xf3, 0x5a, 0xde, 0x60, 0x9f, 0x11, 0xcd, 0x7f,
- 0x86, 0x81, 0xa4, 0x04, 0x5b, 0x9f, 0xef, 0x7b, 0x0b, 0x24, 0xc8,
- 0x2c, 0xda, 0x06, 0xa5, 0xf2, 0x06, 0x7b, 0x36, 0x88, 0x25, 0xe3,
- 0x91, 0x4e, 0x53, 0xd6, 0x94, 0x8e, 0xde, 0x92, 0xef, 0xd6, 0xe8,
- 0x38, 0x7f, 0xa2, 0xe5, 0x37, 0x23, 0x9b, 0x5b, 0xee})),
- std::make_pair(
- 42,
- std::vector<uint8_t>(
- {0x79, 0xd2, 0xd8, 0x69, 0x6d, 0x30, 0xf3, 0x0f, 0xb3, 0x46, 0x57,
- 0x76, 0x11, 0x71, 0xa1, 0x1e, 0x6c, 0x3f, 0x1e, 0x64, 0xcb, 0xe7,
- 0xbe, 0xbe, 0xe1, 0x59, 0xcb, 0x95, 0xbf, 0xaf, 0x81, 0x2b, 0x4f,
- 0x41, 0x1e, 0x2f, 0x26, 0xd9, 0xc4, 0x21, 0xdc, 0x2c, 0x28, 0x4a,
- 0x33, 0x42, 0xd8, 0x23, 0xec, 0x29, 0x38, 0x49, 0xe4, 0x2d, 0x1e,
- 0x46, 0xb0, 0xa4, 0xac, 0x1e, 0x3c, 0x86, 0xab, 0xaa})),
- std::make_pair(
- 43,
- std::vector<uint8_t>(
- {0x8b, 0x94, 0x36, 0x01, 0x0d, 0xc5, 0xde, 0xe9, 0x92, 0xae, 0x38,
- 0xae, 0xa9, 0x7f, 0x2c, 0xd6, 0x3b, 0x94, 0x6d, 0x94, 0xfe, 0xdd,
- 0x2e, 0xc9, 0x67, 0x1d, 0xcd, 0xe3, 0xbd, 0x4c, 0xe9, 0x56, 0x4d,
- 0x55, 0x5c, 0x66, 0xc1, 0x5b, 0xb2, 0xb9, 0x00, 0xdf, 0x72, 0xed,
- 0xb6, 0xb8, 0x91, 0xeb, 0xca, 0xdf, 0xef, 0xf6, 0x3c, 0x9e, 0xa4,
- 0x03, 0x6a, 0x99, 0x8b, 0xe7, 0x97, 0x39, 0x81, 0xe7})),
- std::make_pair(
- 44,
- std::vector<uint8_t>(
- {0xc8, 0xf6, 0x8e, 0x69, 0x6e, 0xd2, 0x82, 0x42, 0xbf, 0x99, 0x7f,
- 0x5b, 0x3b, 0x34, 0x95, 0x95, 0x08, 0xe4, 0x2d, 0x61, 0x38, 0x10,
- 0xf1, 0xe2, 0xa4, 0x35, 0xc9, 0x6e, 0xd2, 0xff, 0x56, 0x0c, 0x70,
- 0x22, 0xf3, 0x61, 0xa9, 0x23, 0x4b, 0x98, 0x37, 0xfe, 0xee, 0x90,
- 0xbf, 0x47, 0x92, 0x2e, 0xe0, 0xfd, 0x5f, 0x8d, 0xdf, 0x82, 0x37,
- 0x18, 0xd8, 0x6d, 0x1e, 0x16, 0xc6, 0x09, 0x00, 0x71})),
- std::make_pair(
- 45,
- std::vector<uint8_t>(
- {0xb0, 0x2d, 0x3e, 0xee, 0x48, 0x60, 0xd5, 0x86, 0x8b, 0x2c, 0x39,
- 0xce, 0x39, 0xbf, 0xe8, 0x10, 0x11, 0x29, 0x05, 0x64, 0xdd, 0x67,
- 0x8c, 0x85, 0xe8, 0x78, 0x3f, 0x29, 0x30, 0x2d, 0xfc, 0x13, 0x99,
- 0xba, 0x95, 0xb6, 0xb5, 0x3c, 0xd9, 0xeb, 0xbf, 0x40, 0x0c, 0xca,
- 0x1d, 0xb0, 0xab, 0x67, 0xe1, 0x9a, 0x32, 0x5f, 0x2d, 0x11, 0x58,
- 0x12, 0xd2, 0x5d, 0x00, 0x97, 0x8a, 0xd1, 0xbc, 0xa4})),
- std::make_pair(
- 46,
- std::vector<uint8_t>(
- {0x76, 0x93, 0xea, 0x73, 0xaf, 0x3a, 0xc4, 0xda, 0xd2, 0x1c, 0xa0,
- 0xd8, 0xda, 0x85, 0xb3, 0x11, 0x8a, 0x7d, 0x1c, 0x60, 0x24, 0xcf,
- 0xaf, 0x55, 0x76, 0x99, 0x86, 0x82, 0x17, 0xbc, 0x0c, 0x2f, 0x44,
- 0xa1, 0x99, 0xbc, 0x6c, 0x0e, 0xdd, 0x51, 0x97, 0x98, 0xba, 0x05,
- 0xbd, 0x5b, 0x1b, 0x44, 0x84, 0x34, 0x6a, 0x47, 0xc2, 0xca, 0xdf,
- 0x6b, 0xf3, 0x0b, 0x78, 0x5c, 0xc8, 0x8b, 0x2b, 0xaf})),
- std::make_pair(
- 47,
- std::vector<uint8_t>(
- {0xa0, 0xe5, 0xc1, 0xc0, 0x03, 0x1c, 0x02, 0xe4, 0x8b, 0x7f, 0x09,
- 0xa5, 0xe8, 0x96, 0xee, 0x9a, 0xef, 0x2f, 0x17, 0xfc, 0x9e, 0x18,
- 0xe9, 0x97, 0xd7, 0xf6, 0xca, 0xc7, 0xae, 0x31, 0x64, 0x22, 0xc2,
- 0xb1, 0xe7, 0x79, 0x84, 0xe5, 0xf3, 0xa7, 0x3c, 0xb4, 0x5d, 0xee,
- 0xd5, 0xd3, 0xf8, 0x46, 0x00, 0x10, 0x5e, 0x6e, 0xe3, 0x8f, 0x2d,
- 0x09, 0x0c, 0x7d, 0x04, 0x42, 0xea, 0x34, 0xc4, 0x6d})),
- std::make_pair(
- 48,
- std::vector<uint8_t>(
- {0x41, 0xda, 0xa6, 0xad, 0xcf, 0xdb, 0x69, 0xf1, 0x44, 0x0c, 0x37,
- 0xb5, 0x96, 0x44, 0x01, 0x65, 0xc1, 0x5a, 0xda, 0x59, 0x68, 0x13,
- 0xe2, 0xe2, 0x2f, 0x06, 0x0f, 0xcd, 0x55, 0x1f, 0x24, 0xde, 0xe8,
- 0xe0, 0x4b, 0xa6, 0x89, 0x03, 0x87, 0x88, 0x6c, 0xee, 0xc4, 0xa7,
- 0xa0, 0xd7, 0xfc, 0x6b, 0x44, 0x50, 0x63, 0x92, 0xec, 0x38, 0x22,
- 0xc0, 0xd8, 0xc1, 0xac, 0xfc, 0x7d, 0x5a, 0xeb, 0xe8})),
- std::make_pair(
- 49,
- std::vector<uint8_t>(
- {0x14, 0xd4, 0xd4, 0x0d, 0x59, 0x84, 0xd8, 0x4c, 0x5c, 0xf7, 0x52,
- 0x3b, 0x77, 0x98, 0xb2, 0x54, 0xe2, 0x75, 0xa3, 0xa8, 0xcc, 0x0a,
- 0x1b, 0xd0, 0x6e, 0xbc, 0x0b, 0xee, 0x72, 0x68, 0x56, 0xac, 0xc3,
- 0xcb, 0xf5, 0x16, 0xff, 0x66, 0x7c, 0xda, 0x20, 0x58, 0xad, 0x5c,
- 0x34, 0x12, 0x25, 0x44, 0x60, 0xa8, 0x2c, 0x92, 0x18, 0x70, 0x41,
- 0x36, 0x3c, 0xc7, 0x7a, 0x4d, 0xc2, 0x15, 0xe4, 0x87})),
- std::make_pair(
- 50,
- std::vector<uint8_t>(
- {0xd0, 0xe7, 0xa1, 0xe2, 0xb9, 0xa4, 0x47, 0xfe, 0xe8, 0x3e, 0x22,
- 0x77, 0xe9, 0xff, 0x80, 0x10, 0xc2, 0xf3, 0x75, 0xae, 0x12, 0xfa,
- 0x7a, 0xaa, 0x8c, 0xa5, 0xa6, 0x31, 0x78, 0x68, 0xa2, 0x6a, 0x36,
- 0x7a, 0x0b, 0x69, 0xfb, 0xc1, 0xcf, 0x32, 0xa5, 0x5d, 0x34, 0xeb,
- 0x37, 0x06, 0x63, 0x01, 0x6f, 0x3d, 0x21, 0x10, 0x23, 0x0e, 0xba,
- 0x75, 0x40, 0x28, 0xa5, 0x6f, 0x54, 0xac, 0xf5, 0x7c})),
- std::make_pair(
- 51,
- std::vector<uint8_t>(
- {0xe7, 0x71, 0xaa, 0x8d, 0xb5, 0xa3, 0xe0, 0x43, 0xe8, 0x17, 0x8f,
- 0x39, 0xa0, 0x85, 0x7b, 0xa0, 0x4a, 0x3f, 0x18, 0xe4, 0xaa, 0x05,
- 0x74, 0x3c, 0xf8, 0xd2, 0x22, 0xb0, 0xb0, 0x95, 0x82, 0x53, 0x50,
- 0xba, 0x42, 0x2f, 0x63, 0x38, 0x2a, 0x23, 0xd9, 0x2e, 0x41, 0x49,
- 0x07, 0x4e, 0x81, 0x6a, 0x36, 0xc1, 0xcd, 0x28, 0x28, 0x4d, 0x14,
- 0x62, 0x67, 0x94, 0x0b, 0x31, 0xf8, 0x81, 0x8e, 0xa2})),
- std::make_pair(
- 52,
- std::vector<uint8_t>(
- {0xfe, 0xb4, 0xfd, 0x6f, 0x9e, 0x87, 0xa5, 0x6b, 0xef, 0x39, 0x8b,
- 0x32, 0x84, 0xd2, 0xbd, 0xa5, 0xb5, 0xb0, 0xe1, 0x66, 0x58, 0x3a,
- 0x66, 0xb6, 0x1e, 0x53, 0x84, 0x57, 0xff, 0x05, 0x84, 0x87, 0x2c,
- 0x21, 0xa3, 0x29, 0x62, 0xb9, 0x92, 0x8f, 0xfa, 0xb5, 0x8d, 0xe4,
- 0xaf, 0x2e, 0xdd, 0x4e, 0x15, 0xd8, 0xb3, 0x55, 0x70, 0x52, 0x32,
- 0x07, 0xff, 0x4e, 0x2a, 0x5a, 0xa7, 0x75, 0x4c, 0xaa})),
- std::make_pair(
- 53,
- std::vector<uint8_t>(
- {0x46, 0x2f, 0x17, 0xbf, 0x00, 0x5f, 0xb1, 0xc1, 0xb9, 0xe6, 0x71,
- 0x77, 0x9f, 0x66, 0x52, 0x09, 0xec, 0x28, 0x73, 0xe3, 0xe4, 0x11,
- 0xf9, 0x8d, 0xab, 0xf2, 0x40, 0xa1, 0xd5, 0xec, 0x3f, 0x95, 0xce,
- 0x67, 0x96, 0xb6, 0xfc, 0x23, 0xfe, 0x17, 0x19, 0x03, 0xb5, 0x02,
- 0x02, 0x34, 0x67, 0xde, 0xc7, 0x27, 0x3f, 0xf7, 0x48, 0x79, 0xb9,
- 0x29, 0x67, 0xa2, 0xa4, 0x3a, 0x5a, 0x18, 0x3d, 0x33})),
- std::make_pair(
- 54,
- std::vector<uint8_t>(
- {0xd3, 0x33, 0x81, 0x93, 0xb6, 0x45, 0x53, 0xdb, 0xd3, 0x8d, 0x14,
- 0x4b, 0xea, 0x71, 0xc5, 0x91, 0x5b, 0xb1, 0x10, 0xe2, 0xd8, 0x81,
- 0x80, 0xdb, 0xc5, 0xdb, 0x36, 0x4f, 0xd6, 0x17, 0x1d, 0xf3, 0x17,
- 0xfc, 0x72, 0x68, 0x83, 0x1b, 0x5a, 0xef, 0x75, 0xe4, 0x34, 0x2b,
- 0x2f, 0xad, 0x87, 0x97, 0xba, 0x39, 0xed, 0xdc, 0xef, 0x80, 0xe6,
- 0xec, 0x08, 0x15, 0x93, 0x50, 0xb1, 0xad, 0x69, 0x6d})),
- std::make_pair(
- 55,
- std::vector<uint8_t>(
- {0xe1, 0x59, 0x0d, 0x58, 0x5a, 0x3d, 0x39, 0xf7, 0xcb, 0x59, 0x9a,
- 0xbd, 0x47, 0x90, 0x70, 0x96, 0x64, 0x09, 0xa6, 0x84, 0x6d, 0x43,
- 0x77, 0xac, 0xf4, 0x47, 0x1d, 0x06, 0x5d, 0x5d, 0xb9, 0x41, 0x29,
- 0xcc, 0x9b, 0xe9, 0x25, 0x73, 0xb0, 0x5e, 0xd2, 0x26, 0xbe, 0x1e,
- 0x9b, 0x7c, 0xb0, 0xca, 0xbe, 0x87, 0x91, 0x85, 0x89, 0xf8, 0x0d,
- 0xad, 0xd4, 0xef, 0x5e, 0xf2, 0x5a, 0x93, 0xd2, 0x8e})),
- std::make_pair(
- 56,
- std::vector<uint8_t>(
- {0xf8, 0xf3, 0x72, 0x6a, 0xc5, 0xa2, 0x6c, 0xc8, 0x01, 0x32, 0x49,
- 0x3a, 0x6f, 0xed, 0xcb, 0x0e, 0x60, 0x76, 0x0c, 0x09, 0xcf, 0xc8,
- 0x4c, 0xad, 0x17, 0x81, 0x75, 0x98, 0x68, 0x19, 0x66, 0x5e, 0x76,
- 0x84, 0x2d, 0x7b, 0x9f, 0xed, 0xf7, 0x6d, 0xdd, 0xeb, 0xf5, 0xd3,
- 0xf5, 0x6f, 0xaa, 0xad, 0x44, 0x77, 0x58, 0x7a, 0xf2, 0x16, 0x06,
- 0xd3, 0x96, 0xae, 0x57, 0x0d, 0x8e, 0x71, 0x9a, 0xf2})),
- std::make_pair(
- 57,
- std::vector<uint8_t>(
- {0x30, 0x18, 0x60, 0x55, 0xc0, 0x79, 0x49, 0x94, 0x81, 0x83, 0xc8,
- 0x50, 0xe9, 0xa7, 0x56, 0xcc, 0x09, 0x93, 0x7e, 0x24, 0x7d, 0x9d,
- 0x92, 0x8e, 0x86, 0x9e, 0x20, 0xba, 0xfc, 0x3c, 0xd9, 0x72, 0x17,
- 0x19, 0xd3, 0x4e, 0x04, 0xa0, 0x89, 0x9b, 0x92, 0xc7, 0x36, 0x08,
- 0x45, 0x50, 0x18, 0x68, 0x86, 0xef, 0xba, 0x2e, 0x79, 0x0d, 0x8b,
- 0xe6, 0xeb, 0xf0, 0x40, 0xb2, 0x09, 0xc4, 0x39, 0xa4})),
- std::make_pair(
- 58,
- std::vector<uint8_t>(
- {0xf3, 0xc4, 0x27, 0x6c, 0xb8, 0x63, 0x63, 0x77, 0x12, 0xc2, 0x41,
- 0xc4, 0x44, 0xc5, 0xcc, 0x1e, 0x35, 0x54, 0xe0, 0xfd, 0xdb, 0x17,
- 0x4d, 0x03, 0x58, 0x19, 0xdd, 0x83, 0xeb, 0x70, 0x0b, 0x4c, 0xe8,
- 0x8d, 0xf3, 0xab, 0x38, 0x41, 0xba, 0x02, 0x08, 0x5e, 0x1a, 0x99,
- 0xb4, 0xe1, 0x73, 0x10, 0xc5, 0x34, 0x10, 0x75, 0xc0, 0x45, 0x8b,
- 0xa3, 0x76, 0xc9, 0x5a, 0x68, 0x18, 0xfb, 0xb3, 0xe2})),
- std::make_pair(
- 59,
- std::vector<uint8_t>(
- {0x0a, 0xa0, 0x07, 0xc4, 0xdd, 0x9d, 0x58, 0x32, 0x39, 0x30, 0x40,
- 0xa1, 0x58, 0x3c, 0x93, 0x0b, 0xca, 0x7d, 0xc5, 0xe7, 0x7e, 0xa5,
- 0x3a, 0xdd, 0x7e, 0x2b, 0x3f, 0x7c, 0x8e, 0x23, 0x13, 0x68, 0x04,
- 0x35, 0x20, 0xd4, 0xa3, 0xef, 0x53, 0xc9, 0x69, 0xb6, 0xbb, 0xfd,
- 0x02, 0x59, 0x46, 0xf6, 0x32, 0xbd, 0x7f, 0x76, 0x5d, 0x53, 0xc2,
- 0x10, 0x03, 0xb8, 0xf9, 0x83, 0xf7, 0x5e, 0x2a, 0x6a})),
- std::make_pair(
- 60,
- std::vector<uint8_t>(
- {0x08, 0xe9, 0x46, 0x47, 0x20, 0x53, 0x3b, 0x23, 0xa0, 0x4e, 0xc2,
- 0x4f, 0x7a, 0xe8, 0xc1, 0x03, 0x14, 0x5f, 0x76, 0x53, 0x87, 0xd7,
- 0x38, 0x77, 0x7d, 0x3d, 0x34, 0x34, 0x77, 0xfd, 0x1c, 0x58, 0xdb,
- 0x05, 0x21, 0x42, 0xca, 0xb7, 0x54, 0xea, 0x67, 0x43, 0x78, 0xe1,
- 0x87, 0x66, 0xc5, 0x35, 0x42, 0xf7, 0x19, 0x70, 0x17, 0x1c, 0xc4,
- 0xf8, 0x16, 0x94, 0x24, 0x6b, 0x71, 0x7d, 0x75, 0x64})),
- std::make_pair(
- 61,
- std::vector<uint8_t>(
- {0xd3, 0x7f, 0xf7, 0xad, 0x29, 0x79, 0x93, 0xe7, 0xec, 0x21, 0xe0,
- 0xf1, 0xb4, 0xb5, 0xae, 0x71, 0x9c, 0xdc, 0x83, 0xc5, 0xdb, 0x68,
- 0x75, 0x27, 0xf2, 0x75, 0x16, 0xcb, 0xff, 0xa8, 0x22, 0x88, 0x8a,
- 0x68, 0x10, 0xee, 0x5c, 0x1c, 0xa7, 0xbf, 0xe3, 0x32, 0x11, 0x19,
- 0xbe, 0x1a, 0xb7, 0xbf, 0xa0, 0xa5, 0x02, 0x67, 0x1c, 0x83, 0x29,
- 0x49, 0x4d, 0xf7, 0xad, 0x6f, 0x52, 0x2d, 0x44, 0x0f})),
- std::make_pair(
- 62,
- std::vector<uint8_t>(
- {0xdd, 0x90, 0x42, 0xf6, 0xe4, 0x64, 0xdc, 0xf8, 0x6b, 0x12, 0x62,
- 0xf6, 0xac, 0xcf, 0xaf, 0xbd, 0x8c, 0xfd, 0x90, 0x2e, 0xd3, 0xed,
- 0x89, 0xab, 0xf7, 0x8f, 0xfa, 0x48, 0x2d, 0xbd, 0xee, 0xb6, 0x96,
- 0x98, 0x42, 0x39, 0x4c, 0x9a, 0x11, 0x68, 0xae, 0x3d, 0x48, 0x1a,
- 0x01, 0x78, 0x42, 0xf6, 0x60, 0x00, 0x2d, 0x42, 0x44, 0x7c, 0x6b,
- 0x22, 0xf7, 0xb7, 0x2f, 0x21, 0xaa, 0xe0, 0x21, 0xc9})),
- std::make_pair(
- 63,
- std::vector<uint8_t>(
- {0xbd, 0x96, 0x5b, 0xf3, 0x1e, 0x87, 0xd7, 0x03, 0x27, 0x53, 0x6f,
- 0x2a, 0x34, 0x1c, 0xeb, 0xc4, 0x76, 0x8e, 0xca, 0x27, 0x5f, 0xa0,
- 0x5e, 0xf9, 0x8f, 0x7f, 0x1b, 0x71, 0xa0, 0x35, 0x12, 0x98, 0xde,
- 0x00, 0x6f, 0xba, 0x73, 0xfe, 0x67, 0x33, 0xed, 0x01, 0xd7, 0x58,
- 0x01, 0xb4, 0xa9, 0x28, 0xe5, 0x42, 0x31, 0xb3, 0x8e, 0x38, 0xc5,
- 0x62, 0xb2, 0xe3, 0x3e, 0xa1, 0x28, 0x49, 0x92, 0xfa})),
- std::make_pair(
- 64,
- std::vector<uint8_t>(
- {0x65, 0x67, 0x6d, 0x80, 0x06, 0x17, 0x97, 0x2f, 0xbd, 0x87, 0xe4,
- 0xb9, 0x51, 0x4e, 0x1c, 0x67, 0x40, 0x2b, 0x7a, 0x33, 0x10, 0x96,
- 0xd3, 0xbf, 0xac, 0x22, 0xf1, 0xab, 0xb9, 0x53, 0x74, 0xab, 0xc9,
- 0x42, 0xf1, 0x6e, 0x9a, 0xb0, 0xea, 0xd3, 0x3b, 0x87, 0xc9, 0x19,
- 0x68, 0xa6, 0xe5, 0x09, 0xe1, 0x19, 0xff, 0x07, 0x78, 0x7b, 0x3e,
- 0xf4, 0x83, 0xe1, 0xdc, 0xdc, 0xcf, 0x6e, 0x30, 0x22})),
- std::make_pair(
- 65,
- std::vector<uint8_t>(
- {0x93, 0x9f, 0xa1, 0x89, 0x69, 0x9c, 0x5d, 0x2c, 0x81, 0xdd, 0xd1,
- 0xff, 0xc1, 0xfa, 0x20, 0x7c, 0x97, 0x0b, 0x6a, 0x36, 0x85, 0xbb,
- 0x29, 0xce, 0x1d, 0x3e, 0x99, 0xd4, 0x2f, 0x2f, 0x74, 0x42, 0xda,
- 0x53, 0xe9, 0x5a, 0x72, 0x90, 0x73, 0x14, 0xf4, 0x58, 0x83, 0x99,
- 0xa3, 0xff, 0x5b, 0x0a, 0x92, 0xbe, 0xb3, 0xf6, 0xbe, 0x26, 0x94,
- 0xf9, 0xf8, 0x6e, 0xcf, 0x29, 0x52, 0xd5, 0xb4, 0x1c})),
- std::make_pair(
- 66,
- std::vector<uint8_t>(
- {0xc5, 0x16, 0x54, 0x17, 0x01, 0x86, 0x3f, 0x91, 0x00, 0x5f, 0x31,
- 0x41, 0x08, 0xce, 0xec, 0xe3, 0xc6, 0x43, 0xe0, 0x4f, 0xc8, 0xc4,
- 0x2f, 0xd2, 0xff, 0x55, 0x62, 0x20, 0xe6, 0x16, 0xaa, 0xa6, 0xa4,
- 0x8a, 0xeb, 0x97, 0xa8, 0x4b, 0xad, 0x74, 0x78, 0x2e, 0x8d, 0xff,
- 0x96, 0xa1, 0xa2, 0xfa, 0x94, 0x93, 0x39, 0xd7, 0x22, 0xed, 0xca,
- 0xa3, 0x2b, 0x57, 0x06, 0x70, 0x41, 0xdf, 0x88, 0xcc})),
- std::make_pair(
- 67,
- std::vector<uint8_t>(
- {0x98, 0x7f, 0xd6, 0xe0, 0xd6, 0x85, 0x7c, 0x55, 0x3e, 0xae, 0xbb,
- 0x3d, 0x34, 0x97, 0x0a, 0x2c, 0x2f, 0x6e, 0x89, 0xa3, 0x54, 0x8f,
- 0x49, 0x25, 0x21, 0x72, 0x2b, 0x80, 0xa1, 0xc2, 0x1a, 0x15, 0x38,
- 0x92, 0x34, 0x6d, 0x2c, 0xba, 0x64, 0x44, 0x21, 0x2d, 0x56, 0xda,
- 0x9a, 0x26, 0xe3, 0x24, 0xdc, 0xcb, 0xc0, 0xdc, 0xde, 0x85, 0xd4,
- 0xd2, 0xee, 0x43, 0x99, 0xee, 0xc5, 0xa6, 0x4e, 0x8f})),
- std::make_pair(
- 68,
- std::vector<uint8_t>(
- {0xae, 0x56, 0xde, 0xb1, 0xc2, 0x32, 0x8d, 0x9c, 0x40, 0x17, 0x70,
- 0x6b, 0xce, 0x6e, 0x99, 0xd4, 0x13, 0x49, 0x05, 0x3b, 0xa9, 0xd3,
- 0x36, 0xd6, 0x77, 0xc4, 0xc2, 0x7d, 0x9f, 0xd5, 0x0a, 0xe6, 0xae,
- 0xe1, 0x7e, 0x85, 0x31, 0x54, 0xe1, 0xf4, 0xfe, 0x76, 0x72, 0x34,
- 0x6d, 0xa2, 0xea, 0xa3, 0x1e, 0xea, 0x53, 0xfc, 0xf2, 0x4a, 0x22,
- 0x80, 0x4f, 0x11, 0xd0, 0x3d, 0xa6, 0xab, 0xfc, 0x2b})),
- std::make_pair(
- 69,
- std::vector<uint8_t>(
- {0x49, 0xd6, 0xa6, 0x08, 0xc9, 0xbd, 0xe4, 0x49, 0x18, 0x70, 0x49,
- 0x85, 0x72, 0xac, 0x31, 0xaa, 0xc3, 0xfa, 0x40, 0x93, 0x8b, 0x38,
- 0xa7, 0x81, 0x8f, 0x72, 0x38, 0x3e, 0xb0, 0x40, 0xad, 0x39, 0x53,
- 0x2b, 0xc0, 0x65, 0x71, 0xe1, 0x3d, 0x76, 0x7e, 0x69, 0x45, 0xab,
- 0x77, 0xc0, 0xbd, 0xc3, 0xb0, 0x28, 0x42, 0x53, 0x34, 0x3f, 0x9f,
- 0x6c, 0x12, 0x44, 0xeb, 0xf2, 0xff, 0x0d, 0xf8, 0x66})),
- std::make_pair(
- 70,
- std::vector<uint8_t>(
- {0xda, 0x58, 0x2a, 0xd8, 0xc5, 0x37, 0x0b, 0x44, 0x69, 0xaf, 0x86,
- 0x2a, 0xa6, 0x46, 0x7a, 0x22, 0x93, 0xb2, 0xb2, 0x8b, 0xd8, 0x0a,
- 0xe0, 0xe9, 0x1f, 0x42, 0x5a, 0xd3, 0xd4, 0x72, 0x49, 0xfd, 0xf9,
- 0x88, 0x25, 0xcc, 0x86, 0xf1, 0x40, 0x28, 0xc3, 0x30, 0x8c, 0x98,
- 0x04, 0xc7, 0x8b, 0xfe, 0xee, 0xee, 0x46, 0x14, 0x44, 0xce, 0x24,
- 0x36, 0x87, 0xe1, 0xa5, 0x05, 0x22, 0x45, 0x6a, 0x1d})),
- std::make_pair(
- 71,
- std::vector<uint8_t>(
- {0xd5, 0x26, 0x6a, 0xa3, 0x33, 0x11, 0x94, 0xae, 0xf8, 0x52, 0xee,
- 0xd8, 0x6d, 0x7b, 0x5b, 0x26, 0x33, 0xa0, 0xaf, 0x1c, 0x73, 0x59,
- 0x06, 0xf2, 0xe1, 0x32, 0x79, 0xf1, 0x49, 0x31, 0xa9, 0xfc, 0x3b,
- 0x0e, 0xac, 0x5c, 0xe9, 0x24, 0x52, 0x73, 0xbd, 0x1a, 0xa9, 0x29,
- 0x05, 0xab, 0xe1, 0x62, 0x78, 0xef, 0x7e, 0xfd, 0x47, 0x69, 0x47,
- 0x89, 0xa7, 0x28, 0x3b, 0x77, 0xda, 0x3c, 0x70, 0xf8})),
- std::make_pair(
- 72,
- std::vector<uint8_t>(
- {0x29, 0x62, 0x73, 0x4c, 0x28, 0x25, 0x21, 0x86, 0xa9, 0xa1, 0x11,
- 0x1c, 0x73, 0x2a, 0xd4, 0xde, 0x45, 0x06, 0xd4, 0xb4, 0x48, 0x09,
- 0x16, 0x30, 0x3e, 0xb7, 0x99, 0x1d, 0x65, 0x9c, 0xcd, 0xa0, 0x7a,
- 0x99, 0x11, 0x91, 0x4b, 0xc7, 0x5c, 0x41, 0x8a, 0xb7, 0xa4, 0x54,
- 0x17, 0x57, 0xad, 0x05, 0x47, 0x96, 0xe2, 0x67, 0x97, 0xfe, 0xaf,
- 0x36, 0xe9, 0xf6, 0xad, 0x43, 0xf1, 0x4b, 0x35, 0xa4})),
- std::make_pair(
- 73,
- std::vector<uint8_t>(
- {0xe8, 0xb7, 0x9e, 0xc5, 0xd0, 0x6e, 0x11, 0x1b, 0xdf, 0xaf, 0xd7,
- 0x1e, 0x9f, 0x57, 0x60, 0xf0, 0x0a, 0xc8, 0xac, 0x5d, 0x8b, 0xf7,
- 0x68, 0xf9, 0xff, 0x6f, 0x08, 0xb8, 0xf0, 0x26, 0x09, 0x6b, 0x1c,
- 0xc3, 0xa4, 0xc9, 0x73, 0x33, 0x30, 0x19, 0xf1, 0xe3, 0x55, 0x3e,
- 0x77, 0xda, 0x3f, 0x98, 0xcb, 0x9f, 0x54, 0x2e, 0x0a, 0x90, 0xe5,
- 0xf8, 0xa9, 0x40, 0xcc, 0x58, 0xe5, 0x98, 0x44, 0xb3})),
- std::make_pair(
- 74,
- std::vector<uint8_t>(
- {0xdf, 0xb3, 0x20, 0xc4, 0x4f, 0x9d, 0x41, 0xd1, 0xef, 0xdc, 0xc0,
- 0x15, 0xf0, 0x8d, 0xd5, 0x53, 0x9e, 0x52, 0x6e, 0x39, 0xc8, 0x7d,
- 0x50, 0x9a, 0xe6, 0x81, 0x2a, 0x96, 0x9e, 0x54, 0x31, 0xbf, 0x4f,
- 0xa7, 0xd9, 0x1f, 0xfd, 0x03, 0xb9, 0x81, 0xe0, 0xd5, 0x44, 0xcf,
- 0x72, 0xd7, 0xb1, 0xc0, 0x37, 0x4f, 0x88, 0x01, 0x48, 0x2e, 0x6d,
- 0xea, 0x2e, 0xf9, 0x03, 0x87, 0x7e, 0xba, 0x67, 0x5e})),
- std::make_pair(
- 75,
- std::vector<uint8_t>(
- {0xd8, 0x86, 0x75, 0x11, 0x8f, 0xdb, 0x55, 0xa5, 0xfb, 0x36, 0x5a,
- 0xc2, 0xaf, 0x1d, 0x21, 0x7b, 0xf5, 0x26, 0xce, 0x1e, 0xe9, 0xc9,
- 0x4b, 0x2f, 0x00, 0x90, 0xb2, 0xc5, 0x8a, 0x06, 0xca, 0x58, 0x18,
- 0x7d, 0x7f, 0xe5, 0x7c, 0x7b, 0xed, 0x9d, 0x26, 0xfc, 0xa0, 0x67,
- 0xb4, 0x11, 0x0e, 0xef, 0xcd, 0x9a, 0x0a, 0x34, 0x5d, 0xe8, 0x72,
- 0xab, 0xe2, 0x0d, 0xe3, 0x68, 0x00, 0x1b, 0x07, 0x45})),
- std::make_pair(
- 76,
- std::vector<uint8_t>(
- {0xb8, 0x93, 0xf2, 0xfc, 0x41, 0xf7, 0xb0, 0xdd, 0x6e, 0x2f, 0x6a,
- 0xa2, 0xe0, 0x37, 0x0c, 0x0c, 0xff, 0x7d, 0xf0, 0x9e, 0x3a, 0xcf,
- 0xcc, 0x0e, 0x92, 0x0b, 0x6e, 0x6f, 0xad, 0x0e, 0xf7, 0x47, 0xc4,
- 0x06, 0x68, 0x41, 0x7d, 0x34, 0x2b, 0x80, 0xd2, 0x35, 0x1e, 0x8c,
- 0x17, 0x5f, 0x20, 0x89, 0x7a, 0x06, 0x2e, 0x97, 0x65, 0xe6, 0xc6,
- 0x7b, 0x53, 0x9b, 0x6b, 0xa8, 0xb9, 0x17, 0x05, 0x45})),
- std::make_pair(
- 77,
- std::vector<uint8_t>(
- {0x6c, 0x67, 0xec, 0x56, 0x97, 0xac, 0xcd, 0x23, 0x5c, 0x59, 0xb4,
- 0x86, 0xd7, 0xb7, 0x0b, 0xae, 0xed, 0xcb, 0xd4, 0xaa, 0x64, 0xeb,
- 0xd4, 0xee, 0xf3, 0xc7, 0xea, 0xc1, 0x89, 0x56, 0x1a, 0x72, 0x62,
- 0x50, 0xae, 0xc4, 0xd4, 0x8c, 0xad, 0xca, 0xfb, 0xbe, 0x2c, 0xe3,
- 0xc1, 0x6c, 0xe2, 0xd6, 0x91, 0xa8, 0xcc, 0xe0, 0x6e, 0x88, 0x79,
- 0x55, 0x6d, 0x44, 0x83, 0xed, 0x71, 0x65, 0xc0, 0x63})),
- std::make_pair(
- 78,
- std::vector<uint8_t>(
- {0xf1, 0xaa, 0x2b, 0x04, 0x4f, 0x8f, 0x0c, 0x63, 0x8a, 0x3f, 0x36,
- 0x2e, 0x67, 0x7b, 0x5d, 0x89, 0x1d, 0x6f, 0xd2, 0xab, 0x07, 0x65,
- 0xf6, 0xee, 0x1e, 0x49, 0x87, 0xde, 0x05, 0x7e, 0xad, 0x35, 0x78,
- 0x83, 0xd9, 0xb4, 0x05, 0xb9, 0xd6, 0x09, 0xee, 0xa1, 0xb8, 0x69,
- 0xd9, 0x7f, 0xb1, 0x6d, 0x9b, 0x51, 0x01, 0x7c, 0x55, 0x3f, 0x3b,
- 0x93, 0xc0, 0xa1, 0xe0, 0xf1, 0x29, 0x6f, 0xed, 0xcd})),
- std::make_pair(
- 79,
- std::vector<uint8_t>(
- {0xcb, 0xaa, 0x25, 0x95, 0x72, 0xd4, 0xae, 0xbf, 0xc1, 0x91, 0x7a,
- 0xcd, 0xdc, 0x58, 0x2b, 0x9f, 0x8d, 0xfa, 0xa9, 0x28, 0xa1, 0x98,
- 0xca, 0x7a, 0xcd, 0x0f, 0x2a, 0xa7, 0x6a, 0x13, 0x4a, 0x90, 0x25,
- 0x2e, 0x62, 0x98, 0xa6, 0x5b, 0x08, 0x18, 0x6a, 0x35, 0x0d, 0x5b,
- 0x76, 0x26, 0x69, 0x9f, 0x8c, 0xb7, 0x21, 0xa3, 0xea, 0x59, 0x21,
- 0xb7, 0x53, 0xae, 0x3a, 0x2d, 0xce, 0x24, 0xba, 0x3a})),
- std::make_pair(
- 80,
- std::vector<uint8_t>(
- {0xfa, 0x15, 0x49, 0xc9, 0x79, 0x6c, 0xd4, 0xd3, 0x03, 0xdc, 0xf4,
- 0x52, 0xc1, 0xfb, 0xd5, 0x74, 0x4f, 0xd9, 0xb9, 0xb4, 0x70, 0x03,
- 0xd9, 0x20, 0xb9, 0x2d, 0xe3, 0x48, 0x39, 0xd0, 0x7e, 0xf2, 0xa2,
- 0x9d, 0xed, 0x68, 0xf6, 0xfc, 0x9e, 0x6c, 0x45, 0xe0, 0x71, 0xa2,
- 0xe4, 0x8b, 0xd5, 0x0c, 0x50, 0x84, 0xe9, 0x6b, 0x65, 0x7d, 0xd0,
- 0x40, 0x40, 0x45, 0xa1, 0xdd, 0xef, 0xe2, 0x82, 0xed})),
- std::make_pair(
- 81,
- std::vector<uint8_t>(
- {0x5c, 0xf2, 0xac, 0x89, 0x7a, 0xb4, 0x44, 0xdc, 0xb5, 0xc8, 0xd8,
- 0x7c, 0x49, 0x5d, 0xbd, 0xb3, 0x4e, 0x18, 0x38, 0xb6, 0xb6, 0x29,
- 0x42, 0x7c, 0xaa, 0x51, 0x70, 0x2a, 0xd0, 0xf9, 0x68, 0x85, 0x25,
- 0xf1, 0x3b, 0xec, 0x50, 0x3a, 0x3c, 0x3a, 0x2c, 0x80, 0xa6, 0x5e,
- 0x0b, 0x57, 0x15, 0xe8, 0xaf, 0xab, 0x00, 0xff, 0xa5, 0x6e, 0xc4,
- 0x55, 0xa4, 0x9a, 0x1a, 0xd3, 0x0a, 0xa2, 0x4f, 0xcd})),
- std::make_pair(
- 82,
- std::vector<uint8_t>(
- {0x9a, 0xaf, 0x80, 0x20, 0x7b, 0xac, 0xe1, 0x7b, 0xb7, 0xab, 0x14,
- 0x57, 0x57, 0xd5, 0x69, 0x6b, 0xde, 0x32, 0x40, 0x6e, 0xf2, 0x2b,
- 0x44, 0x29, 0x2e, 0xf6, 0x5d, 0x45, 0x19, 0xc3, 0xbb, 0x2a, 0xd4,
- 0x1a, 0x59, 0xb6, 0x2c, 0xc3, 0xe9, 0x4b, 0x6f, 0xa9, 0x6d, 0x32,
- 0xa7, 0xfa, 0xad, 0xae, 0x28, 0xaf, 0x7d, 0x35, 0x09, 0x72, 0x19,
- 0xaa, 0x3f, 0xd8, 0xcd, 0xa3, 0x1e, 0x40, 0xc2, 0x75})),
- std::make_pair(
- 83,
- std::vector<uint8_t>(
- {0xaf, 0x88, 0xb1, 0x63, 0x40, 0x2c, 0x86, 0x74, 0x5c, 0xb6, 0x50,
- 0xc2, 0x98, 0x8f, 0xb9, 0x52, 0x11, 0xb9, 0x4b, 0x03, 0xef, 0x29,
- 0x0e, 0xed, 0x96, 0x62, 0x03, 0x42, 0x41, 0xfd, 0x51, 0xcf, 0x39,
- 0x8f, 0x80, 0x73, 0xe3, 0x69, 0x35, 0x4c, 0x43, 0xea, 0xe1, 0x05,
- 0x2f, 0x9b, 0x63, 0xb0, 0x81, 0x91, 0xca, 0xa1, 0x38, 0xaa, 0x54,
- 0xfe, 0xa8, 0x89, 0xcc, 0x70, 0x24, 0x23, 0x68, 0x97})),
- std::make_pair(
- 84,
- std::vector<uint8_t>(
- {0x48, 0xfa, 0x7d, 0x64, 0xe1, 0xce, 0xee, 0x27, 0xb9, 0x86, 0x4d,
- 0xb5, 0xad, 0xa4, 0xb5, 0x3d, 0x00, 0xc9, 0xbc, 0x76, 0x26, 0x55,
- 0x58, 0x13, 0xd3, 0xcd, 0x67, 0x30, 0xab, 0x3c, 0xc0, 0x6f, 0xf3,
- 0x42, 0xd7, 0x27, 0x90, 0x5e, 0x33, 0x17, 0x1b, 0xde, 0x6e, 0x84,
- 0x76, 0xe7, 0x7f, 0xb1, 0x72, 0x08, 0x61, 0xe9, 0x4b, 0x73, 0xa2,
- 0xc5, 0x38, 0xd2, 0x54, 0x74, 0x62, 0x85, 0xf4, 0x30})),
- std::make_pair(
- 85,
- std::vector<uint8_t>(
- {0x0e, 0x6f, 0xd9, 0x7a, 0x85, 0xe9, 0x04, 0xf8, 0x7b, 0xfe, 0x85,
- 0xbb, 0xeb, 0x34, 0xf6, 0x9e, 0x1f, 0x18, 0x10, 0x5c, 0xf4, 0xed,
- 0x4f, 0x87, 0xae, 0xc3, 0x6c, 0x6e, 0x8b, 0x5f, 0x68, 0xbd, 0x2a,
- 0x6f, 0x3d, 0xc8, 0xa9, 0xec, 0xb2, 0xb6, 0x1d, 0xb4, 0xee, 0xdb,
- 0x6b, 0x2e, 0xa1, 0x0b, 0xf9, 0xcb, 0x02, 0x51, 0xfb, 0x0f, 0x8b,
- 0x34, 0x4a, 0xbf, 0x7f, 0x36, 0x6b, 0x6d, 0xe5, 0xab})),
- std::make_pair(
- 86,
- std::vector<uint8_t>(
- {0x06, 0x62, 0x2d, 0xa5, 0x78, 0x71, 0x76, 0x28, 0x7f, 0xdc, 0x8f,
- 0xed, 0x44, 0x0b, 0xad, 0x18, 0x7d, 0x83, 0x00, 0x99, 0xc9, 0x4e,
- 0x6d, 0x04, 0xc8, 0xe9, 0xc9, 0x54, 0xcd, 0xa7, 0x0c, 0x8b, 0xb9,
- 0xe1, 0xfc, 0x4a, 0x6d, 0x0b, 0xaa, 0x83, 0x1b, 0x9b, 0x78, 0xef,
- 0x66, 0x48, 0x68, 0x1a, 0x48, 0x67, 0xa1, 0x1d, 0xa9, 0x3e, 0xe3,
- 0x6e, 0x5e, 0x6a, 0x37, 0xd8, 0x7f, 0xc6, 0x3f, 0x6f})),
- std::make_pair(
- 87,
- std::vector<uint8_t>(
- {0x1d, 0xa6, 0x77, 0x2b, 0x58, 0xfa, 0xbf, 0x9c, 0x61, 0xf6, 0x8d,
- 0x41, 0x2c, 0x82, 0xf1, 0x82, 0xc0, 0x23, 0x6d, 0x7d, 0x57, 0x5e,
- 0xf0, 0xb5, 0x8d, 0xd2, 0x24, 0x58, 0xd6, 0x43, 0xcd, 0x1d, 0xfc,
- 0x93, 0xb0, 0x38, 0x71, 0xc3, 0x16, 0xd8, 0x43, 0x0d, 0x31, 0x29,
- 0x95, 0xd4, 0x19, 0x7f, 0x08, 0x74, 0xc9, 0x91, 0x72, 0xba, 0x00,
- 0x4a, 0x01, 0xee, 0x29, 0x5a, 0xba, 0xc2, 0x4e, 0x46})),
- std::make_pair(
- 88,
- std::vector<uint8_t>(
- {0x3c, 0xd2, 0xd9, 0x32, 0x0b, 0x7b, 0x1d, 0x5f, 0xb9, 0xaa, 0xb9,
- 0x51, 0xa7, 0x60, 0x23, 0xfa, 0x66, 0x7b, 0xe1, 0x4a, 0x91, 0x24,
- 0xe3, 0x94, 0x51, 0x39, 0x18, 0xa3, 0xf4, 0x40, 0x96, 0xae, 0x49,
- 0x04, 0xba, 0x0f, 0xfc, 0x15, 0x0b, 0x63, 0xbc, 0x7a, 0xb1, 0xee,
- 0xb9, 0xa6, 0xe2, 0x57, 0xe5, 0xc8, 0xf0, 0x00, 0xa7, 0x03, 0x94,
- 0xa5, 0xaf, 0xd8, 0x42, 0x71, 0x5d, 0xe1, 0x5f, 0x29})),
- std::make_pair(
- 89,
- std::vector<uint8_t>(
- {0x04, 0xcd, 0xc1, 0x4f, 0x74, 0x34, 0xe0, 0xb4, 0xbe, 0x70, 0xcb,
- 0x41, 0xdb, 0x4c, 0x77, 0x9a, 0x88, 0xea, 0xef, 0x6a, 0xcc, 0xeb,
- 0xcb, 0x41, 0xf2, 0xd4, 0x2f, 0xff, 0xe7, 0xf3, 0x2a, 0x8e, 0x28,
- 0x1b, 0x5c, 0x10, 0x3a, 0x27, 0x02, 0x1d, 0x0d, 0x08, 0x36, 0x22,
- 0x50, 0x75, 0x3c, 0xdf, 0x70, 0x29, 0x21, 0x95, 0xa5, 0x3a, 0x48,
- 0x72, 0x8c, 0xeb, 0x58, 0x44, 0xc2, 0xd9, 0x8b, 0xab})),
- std::make_pair(
- 90,
- std::vector<uint8_t>(
- {0x90, 0x71, 0xb7, 0xa8, 0xa0, 0x75, 0xd0, 0x09, 0x5b, 0x8f, 0xb3,
- 0xae, 0x51, 0x13, 0x78, 0x57, 0x35, 0xab, 0x98, 0xe2, 0xb5, 0x2f,
- 0xaf, 0x91, 0xd5, 0xb8, 0x9e, 0x44, 0xaa, 0xc5, 0xb5, 0xd4, 0xeb,
- 0xbf, 0x91, 0x22, 0x3b, 0x0f, 0xf4, 0xc7, 0x19, 0x05, 0xda, 0x55,
- 0x34, 0x2e, 0x64, 0x65, 0x5d, 0x6e, 0xf8, 0xc8, 0x9a, 0x47, 0x68,
- 0xc3, 0xf9, 0x3a, 0x6d, 0xc0, 0x36, 0x6b, 0x5b, 0xc8})),
- std::make_pair(
- 91,
- std::vector<uint8_t>(
- {0xeb, 0xb3, 0x02, 0x40, 0xdd, 0x96, 0xc7, 0xbc, 0x8d, 0x0a, 0xbe,
- 0x49, 0xaa, 0x4e, 0xdc, 0xbb, 0x4a, 0xfd, 0xc5, 0x1f, 0xf9, 0xaa,
- 0xf7, 0x20, 0xd3, 0xf9, 0xe7, 0xfb, 0xb0, 0xf9, 0xc6, 0xd6, 0x57,
- 0x13, 0x50, 0x50, 0x17, 0x69, 0xfc, 0x4e, 0xbd, 0x0b, 0x21, 0x41,
- 0x24, 0x7f, 0xf4, 0x00, 0xd4, 0xfd, 0x4b, 0xe4, 0x14, 0xed, 0xf3,
- 0x77, 0x57, 0xbb, 0x90, 0xa3, 0x2a, 0xc5, 0xc6, 0x5a})),
- std::make_pair(
- 92,
- std::vector<uint8_t>(
- {0x85, 0x32, 0xc5, 0x8b, 0xf3, 0xc8, 0x01, 0x5d, 0x9d, 0x1c, 0xbe,
- 0x00, 0xee, 0xf1, 0xf5, 0x08, 0x2f, 0x8f, 0x36, 0x32, 0xfb, 0xe9,
- 0xf1, 0xed, 0x4f, 0x9d, 0xfb, 0x1f, 0xa7, 0x9e, 0x82, 0x83, 0x06,
- 0x6d, 0x77, 0xc4, 0x4c, 0x4a, 0xf9, 0x43, 0xd7, 0x6b, 0x30, 0x03,
- 0x64, 0xae, 0xcb, 0xd0, 0x64, 0x8c, 0x8a, 0x89, 0x39, 0xbd, 0x20,
- 0x41, 0x23, 0xf4, 0xb5, 0x62, 0x60, 0x42, 0x2d, 0xec})),
- std::make_pair(
- 93,
- std::vector<uint8_t>(
- {0xfe, 0x98, 0x46, 0xd6, 0x4f, 0x7c, 0x77, 0x08, 0x69, 0x6f, 0x84,
- 0x0e, 0x2d, 0x76, 0xcb, 0x44, 0x08, 0xb6, 0x59, 0x5c, 0x2f, 0x81,
- 0xec, 0x6a, 0x28, 0xa7, 0xf2, 0xf2, 0x0c, 0xb8, 0x8c, 0xfe, 0x6a,
- 0xc0, 0xb9, 0xe9, 0xb8, 0x24, 0x4f, 0x08, 0xbd, 0x70, 0x95, 0xc3,
- 0x50, 0xc1, 0xd0, 0x84, 0x2f, 0x64, 0xfb, 0x01, 0xbb, 0x7f, 0x53,
- 0x2d, 0xfc, 0xd4, 0x73, 0x71, 0xb0, 0xae, 0xeb, 0x79})),
- std::make_pair(
- 94,
- std::vector<uint8_t>(
- {0x28, 0xf1, 0x7e, 0xa6, 0xfb, 0x6c, 0x42, 0x09, 0x2d, 0xc2, 0x64,
- 0x25, 0x7e, 0x29, 0x74, 0x63, 0x21, 0xfb, 0x5b, 0xda, 0xea, 0x98,
- 0x73, 0xc2, 0xa7, 0xfa, 0x9d, 0x8f, 0x53, 0x81, 0x8e, 0x89, 0x9e,
- 0x16, 0x1b, 0xc7, 0x7d, 0xfe, 0x80, 0x90, 0xaf, 0xd8, 0x2b, 0xf2,
- 0x26, 0x6c, 0x5c, 0x1b, 0xc9, 0x30, 0xa8, 0xd1, 0x54, 0x76, 0x24,
- 0x43, 0x9e, 0x66, 0x2e, 0xf6, 0x95, 0xf2, 0x6f, 0x24})),
- std::make_pair(
- 95,
- std::vector<uint8_t>(
- {0xec, 0x6b, 0x7d, 0x7f, 0x03, 0x0d, 0x48, 0x50, 0xac, 0xae, 0x3c,
- 0xb6, 0x15, 0xc2, 0x1d, 0xd2, 0x52, 0x06, 0xd6, 0x3e, 0x84, 0xd1,
- 0xdb, 0x8d, 0x95, 0x73, 0x70, 0x73, 0x7b, 0xa0, 0xe9, 0x84, 0x67,
- 0xea, 0x0c, 0xe2, 0x74, 0xc6, 0x61, 0x99, 0x90, 0x1e, 0xae, 0xc1,
- 0x8a, 0x08, 0x52, 0x57, 0x15, 0xf5, 0x3b, 0xfd, 0xb0, 0xaa, 0xcb,
- 0x61, 0x3d, 0x34, 0x2e, 0xbd, 0xce, 0xed, 0xdc, 0x3b})),
- std::make_pair(
- 96,
- std::vector<uint8_t>(
- {0xb4, 0x03, 0xd3, 0x69, 0x1c, 0x03, 0xb0, 0xd3, 0x41, 0x8d, 0xf3,
- 0x27, 0xd5, 0x86, 0x0d, 0x34, 0xbb, 0xfc, 0xc4, 0x51, 0x9b, 0xfb,
- 0xce, 0x36, 0xbf, 0x33, 0xb2, 0x08, 0x38, 0x5f, 0xad, 0xb9, 0x18,
- 0x6b, 0xc7, 0x8a, 0x76, 0xc4, 0x89, 0xd8, 0x9f, 0xd5, 0x7e, 0x7d,
- 0xc7, 0x54, 0x12, 0xd2, 0x3b, 0xcd, 0x1d, 0xae, 0x84, 0x70, 0xce,
- 0x92, 0x74, 0x75, 0x4b, 0xb8, 0x58, 0x5b, 0x13, 0xc5})),
- std::make_pair(
- 97,
- std::vector<uint8_t>(
- {0x31, 0xfc, 0x79, 0x73, 0x8b, 0x87, 0x72, 0xb3, 0xf5, 0x5c, 0xd8,
- 0x17, 0x88, 0x13, 0xb3, 0xb5, 0x2d, 0x0d, 0xb5, 0xa4, 0x19, 0xd3,
- 0x0b, 0xa9, 0x49, 0x5c, 0x4b, 0x9d, 0xa0, 0x21, 0x9f, 0xac, 0x6d,
- 0xf8, 0xe7, 0xc2, 0x3a, 0x81, 0x15, 0x51, 0xa6, 0x2b, 0x82, 0x7f,
- 0x25, 0x6e, 0xcd, 0xb8, 0x12, 0x4a, 0xc8, 0xa6, 0x79, 0x2c, 0xcf,
- 0xec, 0xc3, 0xb3, 0x01, 0x27, 0x22, 0xe9, 0x44, 0x63})),
- std::make_pair(
- 98,
- std::vector<uint8_t>(
- {0xbb, 0x20, 0x39, 0xec, 0x28, 0x70, 0x91, 0xbc, 0xc9, 0x64, 0x2f,
- 0xc9, 0x00, 0x49, 0xe7, 0x37, 0x32, 0xe0, 0x2e, 0x57, 0x7e, 0x28,
- 0x62, 0xb3, 0x22, 0x16, 0xae, 0x9b, 0xed, 0xcd, 0x73, 0x0c, 0x4c,
- 0x28, 0x4e, 0xf3, 0x96, 0x8c, 0x36, 0x8b, 0x7d, 0x37, 0x58, 0x4f,
- 0x97, 0xbd, 0x4b, 0x4d, 0xc6, 0xef, 0x61, 0x27, 0xac, 0xfe, 0x2e,
- 0x6a, 0xe2, 0x50, 0x91, 0x24, 0xe6, 0x6c, 0x8a, 0xf4})),
- std::make_pair(
- 99,
- std::vector<uint8_t>(
- {0xf5, 0x3d, 0x68, 0xd1, 0x3f, 0x45, 0xed, 0xfc, 0xb9, 0xbd, 0x41,
- 0x5e, 0x28, 0x31, 0xe9, 0x38, 0x35, 0x0d, 0x53, 0x80, 0xd3, 0x43,
- 0x22, 0x78, 0xfc, 0x1c, 0x0c, 0x38, 0x1f, 0xcb, 0x7c, 0x65, 0xc8,
- 0x2d, 0xaf, 0xe0, 0x51, 0xd8, 0xc8, 0xb0, 0xd4, 0x4e, 0x09, 0x74,
- 0xa0, 0xe5, 0x9e, 0xc7, 0xbf, 0x7e, 0xd0, 0x45, 0x9f, 0x86, 0xe9,
- 0x6f, 0x32, 0x9f, 0xc7, 0x97, 0x52, 0x51, 0x0f, 0xd3})),
- std::make_pair(
- 100,
- std::vector<uint8_t>(
- {0x8d, 0x56, 0x8c, 0x79, 0x84, 0xf0, 0xec, 0xdf, 0x76, 0x40, 0xfb,
- 0xc4, 0x83, 0xb5, 0xd8, 0xc9, 0xf8, 0x66, 0x34, 0xf6, 0xf4, 0x32,
- 0x91, 0x84, 0x1b, 0x30, 0x9a, 0x35, 0x0a, 0xb9, 0xc1, 0x13, 0x7d,
- 0x24, 0x06, 0x6b, 0x09, 0xda, 0x99, 0x44, 0xba, 0xc5, 0x4d, 0x5b,
- 0xb6, 0x58, 0x0d, 0x83, 0x60, 0x47, 0xaa, 0xc7, 0x4a, 0xb7, 0x24,
- 0xb8, 0x87, 0xeb, 0xf9, 0x3d, 0x4b, 0x32, 0xec, 0xa9})),
- std::make_pair(
- 101,
- std::vector<uint8_t>(
- {0xc0, 0xb6, 0x5c, 0xe5, 0xa9, 0x6f, 0xf7, 0x74, 0xc4, 0x56, 0xca,
- 0xc3, 0xb5, 0xf2, 0xc4, 0xcd, 0x35, 0x9b, 0x4f, 0xf5, 0x3e, 0xf9,
- 0x3a, 0x3d, 0xa0, 0x77, 0x8b, 0xe4, 0x90, 0x0d, 0x1e, 0x8d, 0xa1,
- 0x60, 0x1e, 0x76, 0x9e, 0x8f, 0x1b, 0x02, 0xd2, 0xa2, 0xf8, 0xc5,
- 0xb9, 0xfa, 0x10, 0xb4, 0x4f, 0x1c, 0x18, 0x69, 0x85, 0x46, 0x8f,
- 0xee, 0xb0, 0x08, 0x73, 0x02, 0x83, 0xa6, 0x65, 0x7d})),
- std::make_pair(
- 102,
- std::vector<uint8_t>(
- {0x49, 0x00, 0xbb, 0xa6, 0xf5, 0xfb, 0x10, 0x3e, 0xce, 0x8e, 0xc9,
- 0x6a, 0xda, 0x13, 0xa5, 0xc3, 0xc8, 0x54, 0x88, 0xe0, 0x55, 0x51,
- 0xda, 0x6b, 0x6b, 0x33, 0xd9, 0x88, 0xe6, 0x11, 0xec, 0x0f, 0xe2,
- 0xe3, 0xc2, 0xaa, 0x48, 0xea, 0x6a, 0xe8, 0x98, 0x6a, 0x3a, 0x23,
- 0x1b, 0x22, 0x3c, 0x5d, 0x27, 0xce, 0xc2, 0xea, 0xdd, 0xe9, 0x1c,
- 0xe0, 0x79, 0x81, 0xee, 0x65, 0x28, 0x62, 0xd1, 0xe4})),
- std::make_pair(
- 103,
- std::vector<uint8_t>(
- {0xc7, 0xf5, 0xc3, 0x7c, 0x72, 0x85, 0xf9, 0x27, 0xf7, 0x64, 0x43,
- 0x41, 0x4d, 0x43, 0x57, 0xff, 0x78, 0x96, 0x47, 0xd7, 0xa0, 0x05,
- 0xa5, 0xa7, 0x87, 0xe0, 0x3c, 0x34, 0x6b, 0x57, 0xf4, 0x9f, 0x21,
- 0xb6, 0x4f, 0xa9, 0xcf, 0x4b, 0x7e, 0x45, 0x57, 0x3e, 0x23, 0x04,
- 0x90, 0x17, 0x56, 0x71, 0x21, 0xa9, 0xc3, 0xd4, 0xb2, 0xb7, 0x3e,
- 0xc5, 0xe9, 0x41, 0x35, 0x77, 0x52, 0x5d, 0xb4, 0x5a})),
- std::make_pair(
- 104,
- std::vector<uint8_t>(
- {0xec, 0x70, 0x96, 0x33, 0x07, 0x36, 0xfd, 0xb2, 0xd6, 0x4b, 0x56,
- 0x53, 0xe7, 0x47, 0x5d, 0xa7, 0x46, 0xc2, 0x3a, 0x46, 0x13, 0xa8,
- 0x26, 0x87, 0xa2, 0x80, 0x62, 0xd3, 0x23, 0x63, 0x64, 0x28, 0x4a,
- 0xc0, 0x17, 0x20, 0xff, 0xb4, 0x06, 0xcf, 0xe2, 0x65, 0xc0, 0xdf,
- 0x62, 0x6a, 0x18, 0x8c, 0x9e, 0x59, 0x63, 0xac, 0xe5, 0xd3, 0xd5,
- 0xbb, 0x36, 0x3e, 0x32, 0xc3, 0x8c, 0x21, 0x90, 0xa6})),
- std::make_pair(
- 105,
- std::vector<uint8_t>(
- {0x82, 0xe7, 0x44, 0xc7, 0x5f, 0x46, 0x49, 0xec, 0x52, 0xb8, 0x07,
- 0x71, 0xa7, 0x7d, 0x47, 0x5a, 0x3b, 0xc0, 0x91, 0x98, 0x95, 0x56,
- 0x96, 0x0e, 0x27, 0x6a, 0x5f, 0x9e, 0xad, 0x92, 0xa0, 0x3f, 0x71,
- 0x87, 0x42, 0xcd, 0xcf, 0xea, 0xee, 0x5c, 0xb8, 0x5c, 0x44, 0xaf,
- 0x19, 0x8a, 0xdc, 0x43, 0xa4, 0xa4, 0x28, 0xf5, 0xf0, 0xc2, 0xdd,
- 0xb0, 0xbe, 0x36, 0x05, 0x9f, 0x06, 0xd7, 0xdf, 0x73})),
- std::make_pair(
- 106,
- std::vector<uint8_t>(
- {0x28, 0x34, 0xb7, 0xa7, 0x17, 0x0f, 0x1f, 0x5b, 0x68, 0x55, 0x9a,
- 0xb7, 0x8c, 0x10, 0x50, 0xec, 0x21, 0xc9, 0x19, 0x74, 0x0b, 0x78,
- 0x4a, 0x90, 0x72, 0xf6, 0xe5, 0xd6, 0x9f, 0x82, 0x8d, 0x70, 0xc9,
- 0x19, 0xc5, 0x03, 0x9f, 0xb1, 0x48, 0xe3, 0x9e, 0x2c, 0x8a, 0x52,
- 0x11, 0x83, 0x78, 0xb0, 0x64, 0xca, 0x8d, 0x50, 0x01, 0xcd, 0x10,
- 0xa5, 0x47, 0x83, 0x87, 0xb9, 0x66, 0x71, 0x5e, 0xd6})),
- std::make_pair(
- 107,
- std::vector<uint8_t>(
- {0x16, 0xb4, 0xad, 0xa8, 0x83, 0xf7, 0x2f, 0x85, 0x3b, 0xb7, 0xef,
- 0x25, 0x3e, 0xfc, 0xab, 0x0c, 0x3e, 0x21, 0x61, 0x68, 0x7a, 0xd6,
- 0x15, 0x43, 0xa0, 0xd2, 0x82, 0x4f, 0x91, 0xc1, 0xf8, 0x13, 0x47,
- 0xd8, 0x6b, 0xe7, 0x09, 0xb1, 0x69, 0x96, 0xe1, 0x7f, 0x2d, 0xd4,
- 0x86, 0x92, 0x7b, 0x02, 0x88, 0xad, 0x38, 0xd1, 0x30, 0x63, 0xc4,
- 0xa9, 0x67, 0x2c, 0x39, 0x39, 0x7d, 0x37, 0x89, 0xb6})),
- std::make_pair(
- 108,
- std::vector<uint8_t>(
- {0x78, 0xd0, 0x48, 0xf3, 0xa6, 0x9d, 0x8b, 0x54, 0xae, 0x0e, 0xd6,
- 0x3a, 0x57, 0x3a, 0xe3, 0x50, 0xd8, 0x9f, 0x7c, 0x6c, 0xf1, 0xf3,
- 0x68, 0x89, 0x30, 0xde, 0x89, 0x9a, 0xfa, 0x03, 0x76, 0x97, 0x62,
- 0x9b, 0x31, 0x4e, 0x5c, 0xd3, 0x03, 0xaa, 0x62, 0xfe, 0xea, 0x72,
- 0xa2, 0x5b, 0xf4, 0x2b, 0x30, 0x4b, 0x6c, 0x6b, 0xcb, 0x27, 0xfa,
- 0xe2, 0x1c, 0x16, 0xd9, 0x25, 0xe1, 0xfb, 0xda, 0xc3})),
- std::make_pair(
- 109,
- std::vector<uint8_t>(
- {0x0f, 0x74, 0x6a, 0x48, 0x74, 0x92, 0x87, 0xad, 0xa7, 0x7a, 0x82,
- 0x96, 0x1f, 0x05, 0xa4, 0xda, 0x4a, 0xbd, 0xb7, 0xd7, 0x7b, 0x12,
- 0x20, 0xf8, 0x36, 0xd0, 0x9e, 0xc8, 0x14, 0x35, 0x9c, 0x0e, 0xc0,
- 0x23, 0x9b, 0x8c, 0x7b, 0x9f, 0xf9, 0xe0, 0x2f, 0x56, 0x9d, 0x1b,
- 0x30, 0x1e, 0xf6, 0x7c, 0x46, 0x12, 0xd1, 0xde, 0x4f, 0x73, 0x0f,
- 0x81, 0xc1, 0x2c, 0x40, 0xcc, 0x06, 0x3c, 0x5c, 0xaa})),
- std::make_pair(
- 110,
- std::vector<uint8_t>(
- {0xf0, 0xfc, 0x85, 0x9d, 0x3b, 0xd1, 0x95, 0xfb, 0xdc, 0x2d, 0x59,
- 0x1e, 0x4c, 0xda, 0xc1, 0x51, 0x79, 0xec, 0x0f, 0x1d, 0xc8, 0x21,
- 0xc1, 0x1d, 0xf1, 0xf0, 0xc1, 0xd2, 0x6e, 0x62, 0x60, 0xaa, 0xa6,
- 0x5b, 0x79, 0xfa, 0xfa, 0xca, 0xfd, 0x7d, 0x3a, 0xd6, 0x1e, 0x60,
- 0x0f, 0x25, 0x09, 0x05, 0xf5, 0x87, 0x8c, 0x87, 0x45, 0x28, 0x97,
- 0x64, 0x7a, 0x35, 0xb9, 0x95, 0xbc, 0xad, 0xc3, 0xa3})),
- std::make_pair(
- 111,
- std::vector<uint8_t>(
- {0x26, 0x20, 0xf6, 0x87, 0xe8, 0x62, 0x5f, 0x6a, 0x41, 0x24, 0x60,
- 0xb4, 0x2e, 0x2c, 0xef, 0x67, 0x63, 0x42, 0x08, 0xce, 0x10, 0xa0,
- 0xcb, 0xd4, 0xdf, 0xf7, 0x04, 0x4a, 0x41, 0xb7, 0x88, 0x00, 0x77,
- 0xe9, 0xf8, 0xdc, 0x3b, 0x8d, 0x12, 0x16, 0xd3, 0x37, 0x6a, 0x21,
- 0xe0, 0x15, 0xb5, 0x8f, 0xb2, 0x79, 0xb5, 0x21, 0xd8, 0x3f, 0x93,
- 0x88, 0xc7, 0x38, 0x2c, 0x85, 0x05, 0x59, 0x0b, 0x9b})),
- std::make_pair(
- 112,
- std::vector<uint8_t>(
- {0x22, 0x7e, 0x3a, 0xed, 0x8d, 0x2c, 0xb1, 0x0b, 0x91, 0x8f, 0xcb,
- 0x04, 0xf9, 0xde, 0x3e, 0x6d, 0x0a, 0x57, 0xe0, 0x84, 0x76, 0xd9,
- 0x37, 0x59, 0xcd, 0x7b, 0x2e, 0xd5, 0x4a, 0x1c, 0xbf, 0x02, 0x39,
- 0xc5, 0x28, 0xfb, 0x04, 0xbb, 0xf2, 0x88, 0x25, 0x3e, 0x60, 0x1d,
- 0x3b, 0xc3, 0x8b, 0x21, 0x79, 0x4a, 0xfe, 0xf9, 0x0b, 0x17, 0x09,
- 0x4a, 0x18, 0x2c, 0xac, 0x55, 0x77, 0x45, 0xe7, 0x5f})),
- std::make_pair(
- 113,
- std::vector<uint8_t>(
- {0x1a, 0x92, 0x99, 0x01, 0xb0, 0x9c, 0x25, 0xf2, 0x7d, 0x6b, 0x35,
- 0xbe, 0x7b, 0x2f, 0x1c, 0x47, 0x45, 0x13, 0x1f, 0xde, 0xbc, 0xa7,
- 0xf3, 0xe2, 0x45, 0x19, 0x26, 0x72, 0x04, 0x34, 0xe0, 0xdb, 0x6e,
- 0x74, 0xfd, 0x69, 0x3a, 0xd2, 0x9b, 0x77, 0x7d, 0xc3, 0x35, 0x5c,
- 0x59, 0x2a, 0x36, 0x1c, 0x48, 0x73, 0xb0, 0x11, 0x33, 0xa5, 0x7c,
- 0x2e, 0x3b, 0x70, 0x75, 0xcb, 0xdb, 0x86, 0xf4, 0xfc})),
- std::make_pair(
- 114,
- std::vector<uint8_t>(
- {0x5f, 0xd7, 0x96, 0x8b, 0xc2, 0xfe, 0x34, 0xf2, 0x20, 0xb5, 0xe3,
- 0xdc, 0x5a, 0xf9, 0x57, 0x17, 0x42, 0xd7, 0x3b, 0x7d, 0x60, 0x81,
- 0x9f, 0x28, 0x88, 0xb6, 0x29, 0x07, 0x2b, 0x96, 0xa9, 0xd8, 0xab,
- 0x2d, 0x91, 0xb8, 0x2d, 0x0a, 0x9a, 0xab, 0xa6, 0x1b, 0xbd, 0x39,
- 0x95, 0x81, 0x32, 0xfc, 0xc4, 0x25, 0x70, 0x23, 0xd1, 0xec, 0xa5,
- 0x91, 0xb3, 0x05, 0x4e, 0x2d, 0xc8, 0x1c, 0x82, 0x00})),
- std::make_pair(
- 115,
- std::vector<uint8_t>(
- {0xdf, 0xcc, 0xe8, 0xcf, 0x32, 0x87, 0x0c, 0xc6, 0xa5, 0x03, 0xea,
- 0xda, 0xfc, 0x87, 0xfd, 0x6f, 0x78, 0x91, 0x8b, 0x9b, 0x4d, 0x07,
- 0x37, 0xdb, 0x68, 0x10, 0xbe, 0x99, 0x6b, 0x54, 0x97, 0xe7, 0xe5,
- 0xcc, 0x80, 0xe3, 0x12, 0xf6, 0x1e, 0x71, 0xff, 0x3e, 0x96, 0x24,
- 0x43, 0x60, 0x73, 0x15, 0x64, 0x03, 0xf7, 0x35, 0xf5, 0x6b, 0x0b,
- 0x01, 0x84, 0x5c, 0x18, 0xf6, 0xca, 0xf7, 0x72, 0xe6})),
- std::make_pair(
- 116,
- std::vector<uint8_t>(
- {0x02, 0xf7, 0xef, 0x3a, 0x9c, 0xe0, 0xff, 0xf9, 0x60, 0xf6, 0x70,
- 0x32, 0xb2, 0x96, 0xef, 0xca, 0x30, 0x61, 0xf4, 0x93, 0x4d, 0x69,
- 0x07, 0x49, 0xf2, 0xd0, 0x1c, 0x35, 0xc8, 0x1c, 0x14, 0xf3, 0x9a,
- 0x67, 0xfa, 0x35, 0x0b, 0xc8, 0xa0, 0x35, 0x9b, 0xf1, 0x72, 0x4b,
- 0xff, 0xc3, 0xbc, 0xa6, 0xd7, 0xc7, 0xbb, 0xa4, 0x79, 0x1f, 0xd5,
- 0x22, 0xa3, 0xad, 0x35, 0x3c, 0x02, 0xec, 0x5a, 0xa8})),
- std::make_pair(
- 117,
- std::vector<uint8_t>(
- {0x64, 0xbe, 0x5c, 0x6a, 0xba, 0x65, 0xd5, 0x94, 0x84, 0x4a, 0xe7,
- 0x8b, 0xb0, 0x22, 0xe5, 0xbe, 0xbe, 0x12, 0x7f, 0xd6, 0xb6, 0xff,
- 0xa5, 0xa1, 0x37, 0x03, 0x85, 0x5a, 0xb6, 0x3b, 0x62, 0x4d, 0xcd,
- 0x1a, 0x36, 0x3f, 0x99, 0x20, 0x3f, 0x63, 0x2e, 0xc3, 0x86, 0xf3,
- 0xea, 0x76, 0x7f, 0xc9, 0x92, 0xe8, 0xed, 0x96, 0x86, 0x58, 0x6a,
- 0xa2, 0x75, 0x55, 0xa8, 0x59, 0x9d, 0x5b, 0x80, 0x8f})),
- std::make_pair(
- 118,
- std::vector<uint8_t>(
- {0xf7, 0x85, 0x85, 0x50, 0x5c, 0x4e, 0xaa, 0x54, 0xa8, 0xb5, 0xbe,
- 0x70, 0xa6, 0x1e, 0x73, 0x5e, 0x0f, 0xf9, 0x7a, 0xf9, 0x44, 0xdd,
- 0xb3, 0x00, 0x1e, 0x35, 0xd8, 0x6c, 0x4e, 0x21, 0x99, 0xd9, 0x76,
- 0x10, 0x4b, 0x6a, 0xe3, 0x17, 0x50, 0xa3, 0x6a, 0x72, 0x6e, 0xd2,
- 0x85, 0x06, 0x4f, 0x59, 0x81, 0xb5, 0x03, 0x88, 0x9f, 0xef, 0x82,
- 0x2f, 0xcd, 0xc2, 0x89, 0x8d, 0xdd, 0xb7, 0x88, 0x9a})),
- std::make_pair(
- 119,
- std::vector<uint8_t>(
- {0xe4, 0xb5, 0x56, 0x60, 0x33, 0x86, 0x95, 0x72, 0xed, 0xfd, 0x87,
- 0x47, 0x9a, 0x5b, 0xb7, 0x3c, 0x80, 0xe8, 0x75, 0x9b, 0x91, 0x23,
- 0x28, 0x79, 0xd9, 0x6b, 0x1d, 0xda, 0x36, 0xc0, 0x12, 0x07, 0x6e,
- 0xe5, 0xa2, 0xed, 0x7a, 0xe2, 0xde, 0x63, 0xef, 0x84, 0x06, 0xa0,
- 0x6a, 0xea, 0x82, 0xc1, 0x88, 0x03, 0x1b, 0x56, 0x0b, 0xea, 0xfb,
- 0x58, 0x3f, 0xb3, 0xde, 0x9e, 0x57, 0x95, 0x2a, 0x7e})),
- std::make_pair(
- 120,
- std::vector<uint8_t>(
- {0xe1, 0xb3, 0xe7, 0xed, 0x86, 0x7f, 0x6c, 0x94, 0x84, 0xa2, 0xa9,
- 0x7f, 0x77, 0x15, 0xf2, 0x5e, 0x25, 0x29, 0x4e, 0x99, 0x2e, 0x41,
- 0xf6, 0xa7, 0xc1, 0x61, 0xff, 0xc2, 0xad, 0xc6, 0xda, 0xae, 0xb7,
- 0x11, 0x31, 0x02, 0xd5, 0xe6, 0x09, 0x02, 0x87, 0xfe, 0x6a, 0xd9,
- 0x4c, 0xe5, 0xd6, 0xb7, 0x39, 0xc6, 0xca, 0x24, 0x0b, 0x05, 0xc7,
- 0x6f, 0xb7, 0x3f, 0x25, 0xdd, 0x02, 0x4b, 0xf9, 0x35})),
- std::make_pair(
- 121,
- std::vector<uint8_t>(
- {0x85, 0xfd, 0x08, 0x5f, 0xdc, 0x12, 0xa0, 0x80, 0x98, 0x3d, 0xf0,
- 0x7b, 0xd7, 0x01, 0x2b, 0x0d, 0x40, 0x2a, 0x0f, 0x40, 0x43, 0xfc,
- 0xb2, 0x77, 0x5a, 0xdf, 0x0b, 0xad, 0x17, 0x4f, 0x9b, 0x08, 0xd1,
- 0x67, 0x6e, 0x47, 0x69, 0x85, 0x78, 0x5c, 0x0a, 0x5d, 0xcc, 0x41,
- 0xdb, 0xff, 0x6d, 0x95, 0xef, 0x4d, 0x66, 0xa3, 0xfb, 0xdc, 0x4a,
- 0x74, 0xb8, 0x2b, 0xa5, 0x2d, 0xa0, 0x51, 0x2b, 0x74})),
- std::make_pair(
- 122,
- std::vector<uint8_t>(
- {0xae, 0xd8, 0xfa, 0x76, 0x4b, 0x0f, 0xbf, 0xf8, 0x21, 0xe0, 0x52,
- 0x33, 0xd2, 0xf7, 0xb0, 0x90, 0x0e, 0xc4, 0x4d, 0x82, 0x6f, 0x95,
- 0xe9, 0x3c, 0x34, 0x3c, 0x1b, 0xc3, 0xba, 0x5a, 0x24, 0x37, 0x4b,
- 0x1d, 0x61, 0x6e, 0x7e, 0x7a, 0xba, 0x45, 0x3a, 0x0a, 0xda, 0x5e,
- 0x4f, 0xab, 0x53, 0x82, 0x40, 0x9e, 0x0d, 0x42, 0xce, 0x9c, 0x2b,
- 0xc7, 0xfb, 0x39, 0xa9, 0x9c, 0x34, 0x0c, 0x20, 0xf0})),
- std::make_pair(
- 123,
- std::vector<uint8_t>(
- {0x7b, 0xa3, 0xb2, 0xe2, 0x97, 0x23, 0x35, 0x22, 0xee, 0xb3, 0x43,
- 0xbd, 0x3e, 0xbc, 0xfd, 0x83, 0x5a, 0x04, 0x00, 0x77, 0x35, 0xe8,
- 0x7f, 0x0c, 0xa3, 0x00, 0xcb, 0xee, 0x6d, 0x41, 0x65, 0x65, 0x16,
- 0x21, 0x71, 0x58, 0x1e, 0x40, 0x20, 0xff, 0x4c, 0xf1, 0x76, 0x45,
- 0x0f, 0x12, 0x91, 0xea, 0x22, 0x85, 0xcb, 0x9e, 0xbf, 0xfe, 0x4c,
- 0x56, 0x66, 0x06, 0x27, 0x68, 0x51, 0x45, 0x05, 0x1c})),
- std::make_pair(
- 124,
- std::vector<uint8_t>(
- {0xde, 0x74, 0x8b, 0xcf, 0x89, 0xec, 0x88, 0x08, 0x47, 0x21, 0xe1,
- 0x6b, 0x85, 0xf3, 0x0a, 0xdb, 0x1a, 0x61, 0x34, 0xd6, 0x64, 0xb5,
- 0x84, 0x35, 0x69, 0xba, 0xbc, 0x5b, 0xbd, 0x1a, 0x15, 0xca, 0x9b,
- 0x61, 0x80, 0x3c, 0x90, 0x1a, 0x4f, 0xef, 0x32, 0x96, 0x5a, 0x17,
- 0x49, 0xc9, 0xf3, 0xa4, 0xe2, 0x43, 0xe1, 0x73, 0x93, 0x9d, 0xc5,
- 0xa8, 0xdc, 0x49, 0x5c, 0x67, 0x1a, 0xb5, 0x21, 0x45})),
- std::make_pair(
- 125,
- std::vector<uint8_t>(
- {0xaa, 0xf4, 0xd2, 0xbd, 0xf2, 0x00, 0xa9, 0x19, 0x70, 0x6d, 0x98,
- 0x42, 0xdc, 0xe1, 0x6c, 0x98, 0x14, 0x0d, 0x34, 0xbc, 0x43, 0x3d,
- 0xf3, 0x20, 0xab, 0xa9, 0xbd, 0x42, 0x9e, 0x54, 0x9a, 0xa7, 0xa3,
- 0x39, 0x76, 0x52, 0xa4, 0xd7, 0x68, 0x27, 0x77, 0x86, 0xcf, 0x99,
- 0x3c, 0xde, 0x23, 0x38, 0x67, 0x3e, 0xd2, 0xe6, 0xb6, 0x6c, 0x96,
- 0x1f, 0xef, 0xb8, 0x2c, 0xd2, 0x0c, 0x93, 0x33, 0x8f})),
- std::make_pair(
- 126,
- std::vector<uint8_t>(
- {0xc4, 0x08, 0x21, 0x89, 0x68, 0xb7, 0x88, 0xbf, 0x86, 0x4f, 0x09,
- 0x97, 0xe6, 0xbc, 0x4c, 0x3d, 0xba, 0x68, 0xb2, 0x76, 0xe2, 0x12,
- 0x5a, 0x48, 0x43, 0x29, 0x60, 0x52, 0xff, 0x93, 0xbf, 0x57, 0x67,
- 0xb8, 0xcd, 0xce, 0x71, 0x31, 0xf0, 0x87, 0x64, 0x30, 0xc1, 0x16,
- 0x5f, 0xec, 0x6c, 0x4f, 0x47, 0xad, 0xaa, 0x4f, 0xd8, 0xbc, 0xfa,
- 0xce, 0xf4, 0x63, 0xb5, 0xd3, 0xd0, 0xfa, 0x61, 0xa0})),
- std::make_pair(
- 127,
- std::vector<uint8_t>(
- {0x76, 0xd2, 0xd8, 0x19, 0xc9, 0x2b, 0xce, 0x55, 0xfa, 0x8e, 0x09,
- 0x2a, 0xb1, 0xbf, 0x9b, 0x9e, 0xab, 0x23, 0x7a, 0x25, 0x26, 0x79,
- 0x86, 0xca, 0xcf, 0x2b, 0x8e, 0xe1, 0x4d, 0x21, 0x4d, 0x73, 0x0d,
- 0xc9, 0xa5, 0xaa, 0x2d, 0x7b, 0x59, 0x6e, 0x86, 0xa1, 0xfd, 0x8f,
- 0xa0, 0x80, 0x4c, 0x77, 0x40, 0x2d, 0x2f, 0xcd, 0x45, 0x08, 0x36,
- 0x88, 0xb2, 0x18, 0xb1, 0xcd, 0xfa, 0x0d, 0xcb, 0xcb})),
- std::make_pair(
- 128,
- std::vector<uint8_t>(
- {0x72, 0x06, 0x5e, 0xe4, 0xdd, 0x91, 0xc2, 0xd8, 0x50, 0x9f, 0xa1,
- 0xfc, 0x28, 0xa3, 0x7c, 0x7f, 0xc9, 0xfa, 0x7d, 0x5b, 0x3f, 0x8a,
- 0xd3, 0xd0, 0xd7, 0xa2, 0x56, 0x26, 0xb5, 0x7b, 0x1b, 0x44, 0x78,
- 0x8d, 0x4c, 0xaf, 0x80, 0x62, 0x90, 0x42, 0x5f, 0x98, 0x90, 0xa3,
- 0xa2, 0xa3, 0x5a, 0x90, 0x5a, 0xb4, 0xb3, 0x7a, 0xcf, 0xd0, 0xda,
- 0x6e, 0x45, 0x17, 0xb2, 0x52, 0x5c, 0x96, 0x51, 0xe4})),
- std::make_pair(
- 129,
- std::vector<uint8_t>(
- {0x64, 0x47, 0x5d, 0xfe, 0x76, 0x00, 0xd7, 0x17, 0x1b, 0xea, 0x0b,
- 0x39, 0x4e, 0x27, 0xc9, 0xb0, 0x0d, 0x8e, 0x74, 0xdd, 0x1e, 0x41,
- 0x6a, 0x79, 0x47, 0x36, 0x82, 0xad, 0x3d, 0xfd, 0xbb, 0x70, 0x66,
- 0x31, 0x55, 0x80, 0x55, 0xcf, 0xc8, 0xa4, 0x0e, 0x07, 0xbd, 0x01,
- 0x5a, 0x45, 0x40, 0xdc, 0xde, 0xa1, 0x58, 0x83, 0xcb, 0xbf, 0x31,
- 0x41, 0x2d, 0xf1, 0xde, 0x1c, 0xd4, 0x15, 0x2b, 0x91})),
- std::make_pair(
- 130,
- std::vector<uint8_t>(
- {0x12, 0xcd, 0x16, 0x74, 0xa4, 0x48, 0x8a, 0x5d, 0x7c, 0x2b, 0x31,
- 0x60, 0xd2, 0xe2, 0xc4, 0xb5, 0x83, 0x71, 0xbe, 0xda, 0xd7, 0x93,
- 0x41, 0x8d, 0x6f, 0x19, 0xc6, 0xee, 0x38, 0x5d, 0x70, 0xb3, 0xe0,
- 0x67, 0x39, 0x36, 0x9d, 0x4d, 0xf9, 0x10, 0xed, 0xb0, 0xb0, 0xa5,
- 0x4c, 0xbf, 0xf4, 0x3d, 0x54, 0x54, 0x4c, 0xd3, 0x7a, 0xb3, 0xa0,
- 0x6c, 0xfa, 0x0a, 0x3d, 0xda, 0xc8, 0xb6, 0x6c, 0x89})),
- std::make_pair(
- 131,
- std::vector<uint8_t>(
- {0x60, 0x75, 0x69, 0x66, 0x47, 0x9d, 0xed, 0xc6, 0xdd, 0x4b, 0xcf,
- 0xf8, 0xea, 0x7d, 0x1d, 0x4c, 0xe4, 0xd4, 0xaf, 0x2e, 0x7b, 0x09,
- 0x7e, 0x32, 0xe3, 0x76, 0x35, 0x18, 0x44, 0x11, 0x47, 0xcc, 0x12,
- 0xb3, 0xc0, 0xee, 0x6d, 0x2e, 0xca, 0xbf, 0x11, 0x98, 0xce, 0xc9,
- 0x2e, 0x86, 0xa3, 0x61, 0x6f, 0xba, 0x4f, 0x4e, 0x87, 0x2f, 0x58,
- 0x25, 0x33, 0x0a, 0xdb, 0xb4, 0xc1, 0xde, 0xe4, 0x44})),
- std::make_pair(
- 132,
- std::vector<uint8_t>(
- {0xa7, 0x80, 0x3b, 0xcb, 0x71, 0xbc, 0x1d, 0x0f, 0x43, 0x83, 0xdd,
- 0xe1, 0xe0, 0x61, 0x2e, 0x04, 0xf8, 0x72, 0xb7, 0x15, 0xad, 0x30,
- 0x81, 0x5c, 0x22, 0x49, 0xcf, 0x34, 0xab, 0xb8, 0xb0, 0x24, 0x91,
- 0x5c, 0xb2, 0xfc, 0x9f, 0x4e, 0x7c, 0xc4, 0xc8, 0xcf, 0xd4, 0x5b,
- 0xe2, 0xd5, 0xa9, 0x1e, 0xab, 0x09, 0x41, 0xc7, 0xd2, 0x70, 0xe2,
- 0xda, 0x4c, 0xa4, 0xa9, 0xf7, 0xac, 0x68, 0x66, 0x3a})),
- std::make_pair(
- 133,
- std::vector<uint8_t>(
- {0xb8, 0x4e, 0xf6, 0xa7, 0x22, 0x9a, 0x34, 0xa7, 0x50, 0xd9, 0xa9,
- 0x8e, 0xe2, 0x52, 0x98, 0x71, 0x81, 0x6b, 0x87, 0xfb, 0xe3, 0xbc,
- 0x45, 0xb4, 0x5f, 0xa5, 0xae, 0x82, 0xd5, 0x14, 0x15, 0x40, 0x21,
- 0x11, 0x65, 0xc3, 0xc5, 0xd7, 0xa7, 0x47, 0x6b, 0xa5, 0xa4, 0xaa,
- 0x06, 0xd6, 0x64, 0x76, 0xf0, 0xd9, 0xdc, 0x49, 0xa3, 0xf1, 0xee,
- 0x72, 0xc3, 0xac, 0xab, 0xd4, 0x98, 0x96, 0x74, 0x14})),
- std::make_pair(
- 134,
- std::vector<uint8_t>(
- {0xfa, 0xe4, 0xb6, 0xd8, 0xef, 0xc3, 0xf8, 0xc8, 0xe6, 0x4d, 0x00,
- 0x1d, 0xab, 0xec, 0x3a, 0x21, 0xf5, 0x44, 0xe8, 0x27, 0x14, 0x74,
- 0x52, 0x51, 0xb2, 0xb4, 0xb3, 0x93, 0xf2, 0xf4, 0x3e, 0x0d, 0xa3,
- 0xd4, 0x03, 0xc6, 0x4d, 0xb9, 0x5a, 0x2c, 0xb6, 0xe2, 0x3e, 0xbb,
- 0x7b, 0x9e, 0x94, 0xcd, 0xd5, 0xdd, 0xac, 0x54, 0xf0, 0x7c, 0x4a,
- 0x61, 0xbd, 0x3c, 0xb1, 0x0a, 0xa6, 0xf9, 0x3b, 0x49})),
- std::make_pair(
- 135,
- std::vector<uint8_t>(
- {0x34, 0xf7, 0x28, 0x66, 0x05, 0xa1, 0x22, 0x36, 0x95, 0x40, 0x14,
- 0x1d, 0xed, 0x79, 0xb8, 0x95, 0x72, 0x55, 0xda, 0x2d, 0x41, 0x55,
- 0xab, 0xbf, 0x5a, 0x8d, 0xbb, 0x89, 0xc8, 0xeb, 0x7e, 0xde, 0x8e,
- 0xee, 0xf1, 0xda, 0xa4, 0x6d, 0xc2, 0x9d, 0x75, 0x1d, 0x04, 0x5d,
- 0xc3, 0xb1, 0xd6, 0x58, 0xbb, 0x64, 0xb8, 0x0f, 0xf8, 0x58, 0x9e,
- 0xdd, 0xb3, 0x82, 0x4b, 0x13, 0xda, 0x23, 0x5a, 0x6b})),
- std::make_pair(
- 136,
- std::vector<uint8_t>(
- {0x3b, 0x3b, 0x48, 0x43, 0x4b, 0xe2, 0x7b, 0x9e, 0xab, 0xab, 0xba,
- 0x43, 0xbf, 0x6b, 0x35, 0xf1, 0x4b, 0x30, 0xf6, 0xa8, 0x8d, 0xc2,
- 0xe7, 0x50, 0xc3, 0x58, 0x47, 0x0d, 0x6b, 0x3a, 0xa3, 0xc1, 0x8e,
- 0x47, 0xdb, 0x40, 0x17, 0xfa, 0x55, 0x10, 0x6d, 0x82, 0x52, 0xf0,
- 0x16, 0x37, 0x1a, 0x00, 0xf5, 0xf8, 0xb0, 0x70, 0xb7, 0x4b, 0xa5,
- 0xf2, 0x3c, 0xff, 0xc5, 0x51, 0x1c, 0x9f, 0x09, 0xf0})),
- std::make_pair(
- 137,
- std::vector<uint8_t>(
- {0xba, 0x28, 0x9e, 0xbd, 0x65, 0x62, 0xc4, 0x8c, 0x3e, 0x10, 0xa8,
- 0xad, 0x6c, 0xe0, 0x2e, 0x73, 0x43, 0x3d, 0x1e, 0x93, 0xd7, 0xc9,
- 0x27, 0x9d, 0x4d, 0x60, 0xa7, 0xe8, 0x79, 0xee, 0x11, 0xf4, 0x41,
- 0xa0, 0x00, 0xf4, 0x8e, 0xd9, 0xf7, 0xc4, 0xed, 0x87, 0xa4, 0x51,
- 0x36, 0xd7, 0xdc, 0xcd, 0xca, 0x48, 0x21, 0x09, 0xc7, 0x8a, 0x51,
- 0x06, 0x2b, 0x3b, 0xa4, 0x04, 0x4a, 0xda, 0x24, 0x69})),
- std::make_pair(
- 138,
- std::vector<uint8_t>(
- {0x02, 0x29, 0x39, 0xe2, 0x38, 0x6c, 0x5a, 0x37, 0x04, 0x98, 0x56,
- 0xc8, 0x50, 0xa2, 0xbb, 0x10, 0xa1, 0x3d, 0xfe, 0xa4, 0x21, 0x2b,
- 0x4c, 0x73, 0x2a, 0x88, 0x40, 0xa9, 0xff, 0xa5, 0xfa, 0xf5, 0x48,
- 0x75, 0xc5, 0x44, 0x88, 0x16, 0xb2, 0x78, 0x5a, 0x00, 0x7d, 0xa8,
- 0xa8, 0xd2, 0xbc, 0x7d, 0x71, 0xa5, 0x4e, 0x4e, 0x65, 0x71, 0xf1,
- 0x0b, 0x60, 0x0c, 0xbd, 0xb2, 0x5d, 0x13, 0xed, 0xe3})),
- std::make_pair(
- 139,
- std::vector<uint8_t>(
- {0xe6, 0xfe, 0xc1, 0x9d, 0x89, 0xce, 0x87, 0x17, 0xb1, 0xa0, 0x87,
- 0x02, 0x46, 0x70, 0xfe, 0x02, 0x6f, 0x6c, 0x7c, 0xbd, 0xa1, 0x1c,
- 0xae, 0xf9, 0x59, 0xbb, 0x2d, 0x35, 0x1b, 0xf8, 0x56, 0xf8, 0x05,
- 0x5d, 0x1c, 0x0e, 0xbd, 0xaa, 0xa9, 0xd1, 0xb1, 0x78, 0x86, 0xfc,
- 0x2c, 0x56, 0x2b, 0x5e, 0x99, 0x64, 0x2f, 0xc0, 0x64, 0x71, 0x0c,
- 0x0d, 0x34, 0x88, 0xa0, 0x2b, 0x5e, 0xd7, 0xf6, 0xfd})),
- std::make_pair(
- 140,
- std::vector<uint8_t>(
- {0x94, 0xc9, 0x6f, 0x02, 0xa8, 0xf5, 0x76, 0xac, 0xa3, 0x2b, 0xa6,
- 0x1c, 0x2b, 0x20, 0x6f, 0x90, 0x72, 0x85, 0xd9, 0x29, 0x9b, 0x83,
- 0xac, 0x17, 0x5c, 0x20, 0x9a, 0x8d, 0x43, 0xd5, 0x3b, 0xfe, 0x68,
- 0x3d, 0xd1, 0xd8, 0x3e, 0x75, 0x49, 0xcb, 0x90, 0x6c, 0x28, 0xf5,
- 0x9a, 0xb7, 0xc4, 0x6f, 0x87, 0x51, 0x36, 0x6a, 0x28, 0xc3, 0x9d,
- 0xd5, 0xfe, 0x26, 0x93, 0xc9, 0x01, 0x96, 0x66, 0xc8})),
- std::make_pair(
- 141,
- std::vector<uint8_t>(
- {0x31, 0xa0, 0xcd, 0x21, 0x5e, 0xbd, 0x2c, 0xb6, 0x1d, 0xe5, 0xb9,
- 0xed, 0xc9, 0x1e, 0x61, 0x95, 0xe3, 0x1c, 0x59, 0xa5, 0x64, 0x8d,
- 0x5c, 0x9f, 0x73, 0x7e, 0x12, 0x5b, 0x26, 0x05, 0x70, 0x8f, 0x2e,
- 0x32, 0x5a, 0xb3, 0x38, 0x1c, 0x8d, 0xce, 0x1a, 0x3e, 0x95, 0x88,
- 0x86, 0xf1, 0xec, 0xdc, 0x60, 0x31, 0x8f, 0x88, 0x2c, 0xfe, 0x20,
- 0xa2, 0x41, 0x91, 0x35, 0x2e, 0x61, 0x7b, 0x0f, 0x21})),
- std::make_pair(
- 142,
- std::vector<uint8_t>(
- {0x91, 0xab, 0x50, 0x4a, 0x52, 0x2d, 0xce, 0x78, 0x77, 0x9f, 0x4c,
- 0x6c, 0x6b, 0xa2, 0xe6, 0xb6, 0xdb, 0x55, 0x65, 0xc7, 0x6d, 0x3e,
- 0x7e, 0x7c, 0x92, 0x0c, 0xaf, 0x7f, 0x75, 0x7e, 0xf9, 0xdb, 0x7c,
- 0x8f, 0xcf, 0x10, 0xe5, 0x7f, 0x03, 0x37, 0x9e, 0xa9, 0xbf, 0x75,
- 0xeb, 0x59, 0x89, 0x5d, 0x96, 0xe1, 0x49, 0x80, 0x0b, 0x6a, 0xae,
- 0x01, 0xdb, 0x77, 0x8b, 0xb9, 0x0a, 0xfb, 0xc9, 0x89})),
- std::make_pair(
- 143,
- std::vector<uint8_t>(
- {0xd8, 0x5c, 0xab, 0xc6, 0xbd, 0x5b, 0x1a, 0x01, 0xa5, 0xaf, 0xd8,
- 0xc6, 0x73, 0x47, 0x40, 0xda, 0x9f, 0xd1, 0xc1, 0xac, 0xc6, 0xdb,
- 0x29, 0xbf, 0xc8, 0xa2, 0xe5, 0xb6, 0x68, 0xb0, 0x28, 0xb6, 0xb3,
- 0x15, 0x4b, 0xfb, 0x87, 0x03, 0xfa, 0x31, 0x80, 0x25, 0x1d, 0x58,
- 0x9a, 0xd3, 0x80, 0x40, 0xce, 0xb7, 0x07, 0xc4, 0xba, 0xd1, 0xb5,
- 0x34, 0x3c, 0xb4, 0x26, 0xb6, 0x1e, 0xaa, 0x49, 0xc1})),
- std::make_pair(
- 144,
- std::vector<uint8_t>(
- {0xd6, 0x2e, 0xfb, 0xec, 0x2c, 0xa9, 0xc1, 0xf8, 0xbd, 0x66, 0xce,
- 0x8b, 0x3f, 0x6a, 0x89, 0x8c, 0xb3, 0xf7, 0x56, 0x6b, 0xa6, 0x56,
- 0x8c, 0x61, 0x8a, 0xd1, 0xfe, 0xb2, 0xb6, 0x5b, 0x76, 0xc3, 0xce,
- 0x1d, 0xd2, 0x0f, 0x73, 0x95, 0x37, 0x2f, 0xaf, 0x28, 0x42, 0x7f,
- 0x61, 0xc9, 0x27, 0x80, 0x49, 0xcf, 0x01, 0x40, 0xdf, 0x43, 0x4f,
- 0x56, 0x33, 0x04, 0x8c, 0x86, 0xb8, 0x1e, 0x03, 0x99})),
- std::make_pair(
- 145,
- std::vector<uint8_t>(
- {0x7c, 0x8f, 0xdc, 0x61, 0x75, 0x43, 0x9e, 0x2c, 0x3d, 0xb1, 0x5b,
- 0xaf, 0xa7, 0xfb, 0x06, 0x14, 0x3a, 0x6a, 0x23, 0xbc, 0x90, 0xf4,
- 0x49, 0xe7, 0x9d, 0xee, 0xf7, 0x3c, 0x3d, 0x49, 0x2a, 0x67, 0x17,
- 0x15, 0xc1, 0x93, 0xb6, 0xfe, 0xa9, 0xf0, 0x36, 0x05, 0x0b, 0x94,
- 0x60, 0x69, 0x85, 0x6b, 0x89, 0x7e, 0x08, 0xc0, 0x07, 0x68, 0xf5,
- 0xee, 0x5d, 0xdc, 0xf7, 0x0b, 0x7c, 0xd6, 0xd0, 0xe0})),
- std::make_pair(
- 146,
- std::vector<uint8_t>(
- {0x58, 0x60, 0x2e, 0xe7, 0x46, 0x8e, 0x6b, 0xc9, 0xdf, 0x21, 0xbd,
- 0x51, 0xb2, 0x3c, 0x00, 0x5f, 0x72, 0xd6, 0xcb, 0x01, 0x3f, 0x0a,
- 0x1b, 0x48, 0xcb, 0xec, 0x5e, 0xca, 0x29, 0x92, 0x99, 0xf9, 0x7f,
- 0x09, 0xf5, 0x4a, 0x9a, 0x01, 0x48, 0x3e, 0xae, 0xb3, 0x15, 0xa6,
- 0x47, 0x8b, 0xad, 0x37, 0xba, 0x47, 0xca, 0x13, 0x47, 0xc7, 0xc8,
- 0xfc, 0x9e, 0x66, 0x95, 0x59, 0x2c, 0x91, 0xd7, 0x23})),
- std::make_pair(
- 147,
- std::vector<uint8_t>(
- {0x27, 0xf5, 0xb7, 0x9e, 0xd2, 0x56, 0xb0, 0x50, 0x99, 0x3d, 0x79,
- 0x34, 0x96, 0xed, 0xf4, 0x80, 0x7c, 0x1d, 0x85, 0xa7, 0xb0, 0xa6,
- 0x7c, 0x9c, 0x4f, 0xa9, 0x98, 0x60, 0x75, 0x0b, 0x0a, 0xe6, 0x69,
- 0x89, 0x67, 0x0a, 0x8f, 0xfd, 0x78, 0x56, 0xd7, 0xce, 0x41, 0x15,
- 0x99, 0xe5, 0x8c, 0x4d, 0x77, 0xb2, 0x32, 0xa6, 0x2b, 0xef, 0x64,
- 0xd1, 0x52, 0x75, 0xbe, 0x46, 0xa6, 0x82, 0x35, 0xff})),
- std::make_pair(
- 148,
- std::vector<uint8_t>(
- {0x39, 0x57, 0xa9, 0x76, 0xb9, 0xf1, 0x88, 0x7b, 0xf0, 0x04, 0xa8,
- 0xdc, 0xa9, 0x42, 0xc9, 0x2d, 0x2b, 0x37, 0xea, 0x52, 0x60, 0x0f,
- 0x25, 0xe0, 0xc9, 0xbc, 0x57, 0x07, 0xd0, 0x27, 0x9c, 0x00, 0xc6,
- 0xe8, 0x5a, 0x83, 0x9b, 0x0d, 0x2d, 0x8e, 0xb5, 0x9c, 0x51, 0xd9,
- 0x47, 0x88, 0xeb, 0xe6, 0x24, 0x74, 0xa7, 0x91, 0xca, 0xdf, 0x52,
- 0xcc, 0xcf, 0x20, 0xf5, 0x07, 0x0b, 0x65, 0x73, 0xfc})),
- std::make_pair(
- 149,
- std::vector<uint8_t>(
- {0xea, 0xa2, 0x37, 0x6d, 0x55, 0x38, 0x0b, 0xf7, 0x72, 0xec, 0xca,
- 0x9c, 0xb0, 0xaa, 0x46, 0x68, 0xc9, 0x5c, 0x70, 0x71, 0x62, 0xfa,
- 0x86, 0xd5, 0x18, 0xc8, 0xce, 0x0c, 0xa9, 0xbf, 0x73, 0x62, 0xb9,
- 0xf2, 0xa0, 0xad, 0xc3, 0xff, 0x59, 0x92, 0x2d, 0xf9, 0x21, 0xb9,
- 0x45, 0x67, 0xe8, 0x1e, 0x45, 0x2f, 0x6c, 0x1a, 0x07, 0xfc, 0x81,
- 0x7c, 0xeb, 0xe9, 0x96, 0x04, 0xb3, 0x50, 0x5d, 0x38})),
- std::make_pair(
- 150,
- std::vector<uint8_t>(
- {0xc1, 0xe2, 0xc7, 0x8b, 0x6b, 0x27, 0x34, 0xe2, 0x48, 0x0e, 0xc5,
- 0x50, 0x43, 0x4c, 0xb5, 0xd6, 0x13, 0x11, 0x1a, 0xdc, 0xc2, 0x1d,
- 0x47, 0x55, 0x45, 0xc3, 0xb1, 0xb7, 0xe6, 0xff, 0x12, 0x44, 0x44,
- 0x76, 0xe5, 0xc0, 0x55, 0x13, 0x2e, 0x22, 0x29, 0xdc, 0x0f, 0x80,
- 0x70, 0x44, 0xbb, 0x91, 0x9b, 0x1a, 0x56, 0x62, 0xdd, 0x38, 0xa9,
- 0xee, 0x65, 0xe2, 0x43, 0xa3, 0x91, 0x1a, 0xed, 0x1a})),
- std::make_pair(
- 151,
- std::vector<uint8_t>(
- {0x8a, 0xb4, 0x87, 0x13, 0x38, 0x9d, 0xd0, 0xfc, 0xf9, 0xf9, 0x65,
- 0xd3, 0xce, 0x66, 0xb1, 0xe5, 0x59, 0xa1, 0xf8, 0xc5, 0x87, 0x41,
- 0xd6, 0x76, 0x83, 0xcd, 0x97, 0x13, 0x54, 0xf4, 0x52, 0xe6, 0x2d,
- 0x02, 0x07, 0xa6, 0x5e, 0x43, 0x6c, 0x5d, 0x5d, 0x8f, 0x8e, 0xe7,
- 0x1c, 0x6a, 0xbf, 0xe5, 0x0e, 0x66, 0x90, 0x04, 0xc3, 0x02, 0xb3,
- 0x1a, 0x7e, 0xa8, 0x31, 0x1d, 0x4a, 0x91, 0x60, 0x51})),
- std::make_pair(
- 152,
- std::vector<uint8_t>(
- {0x24, 0xce, 0x0a, 0xdd, 0xaa, 0x4c, 0x65, 0x03, 0x8b, 0xd1, 0xb1,
- 0xc0, 0xf1, 0x45, 0x2a, 0x0b, 0x12, 0x87, 0x77, 0xaa, 0xbc, 0x94,
- 0xa2, 0x9d, 0xf2, 0xfd, 0x6c, 0x7e, 0x2f, 0x85, 0xf8, 0xab, 0x9a,
- 0xc7, 0xef, 0xf5, 0x16, 0xb0, 0xe0, 0xa8, 0x25, 0xc8, 0x4a, 0x24,
- 0xcf, 0xe4, 0x92, 0xea, 0xad, 0x0a, 0x63, 0x08, 0xe4, 0x6d, 0xd4,
- 0x2f, 0xe8, 0x33, 0x3a, 0xb9, 0x71, 0xbb, 0x30, 0xca})),
- std::make_pair(
- 153,
- std::vector<uint8_t>(
- {0x51, 0x54, 0xf9, 0x29, 0xee, 0x03, 0x04, 0x5b, 0x6b, 0x0c, 0x00,
- 0x04, 0xfa, 0x77, 0x8e, 0xde, 0xe1, 0xd1, 0x39, 0x89, 0x32, 0x67,
- 0xcc, 0x84, 0x82, 0x5a, 0xd7, 0xb3, 0x6c, 0x63, 0xde, 0x32, 0x79,
- 0x8e, 0x4a, 0x16, 0x6d, 0x24, 0x68, 0x65, 0x61, 0x35, 0x4f, 0x63,
- 0xb0, 0x07, 0x09, 0xa1, 0x36, 0x4b, 0x3c, 0x24, 0x1d, 0xe3, 0xfe,
- 0xbf, 0x07, 0x54, 0x04, 0x58, 0x97, 0x46, 0x7c, 0xd4})),
- std::make_pair(
- 154,
- std::vector<uint8_t>(
- {0xe7, 0x4e, 0x90, 0x79, 0x20, 0xfd, 0x87, 0xbd, 0x5a, 0xd6, 0x36,
- 0xdd, 0x11, 0x08, 0x5e, 0x50, 0xee, 0x70, 0x45, 0x9c, 0x44, 0x3e,
- 0x1c, 0xe5, 0x80, 0x9a, 0xf2, 0xbc, 0x2e, 0xba, 0x39, 0xf9, 0xe6,
- 0xd7, 0x12, 0x8e, 0x0e, 0x37, 0x12, 0xc3, 0x16, 0xda, 0x06, 0xf4,
- 0x70, 0x5d, 0x78, 0xa4, 0x83, 0x8e, 0x28, 0x12, 0x1d, 0x43, 0x44,
- 0xa2, 0xc7, 0x9c, 0x5e, 0x0d, 0xb3, 0x07, 0xa6, 0x77})),
- std::make_pair(
- 155,
- std::vector<uint8_t>(
- {0xbf, 0x91, 0xa2, 0x23, 0x34, 0xba, 0xc2, 0x0f, 0x3f, 0xd8, 0x06,
- 0x63, 0xb3, 0xcd, 0x06, 0xc4, 0xe8, 0x80, 0x2f, 0x30, 0xe6, 0xb5,
- 0x9f, 0x90, 0xd3, 0x03, 0x5c, 0xc9, 0x79, 0x8a, 0x21, 0x7e, 0xd5,
- 0xa3, 0x1a, 0xbb, 0xda, 0x7f, 0xa6, 0x84, 0x28, 0x27, 0xbd, 0xf2,
- 0xa7, 0xa1, 0xc2, 0x1f, 0x6f, 0xcf, 0xcc, 0xbb, 0x54, 0xc6, 0xc5,
- 0x29, 0x26, 0xf3, 0x2d, 0xa8, 0x16, 0x26, 0x9b, 0xe1})),
- std::make_pair(
- 156,
- std::vector<uint8_t>(
- {0xd9, 0xd5, 0xc7, 0x4b, 0xe5, 0x12, 0x1b, 0x0b, 0xd7, 0x42, 0xf2,
- 0x6b, 0xff, 0xb8, 0xc8, 0x9f, 0x89, 0x17, 0x1f, 0x3f, 0x93, 0x49,
- 0x13, 0x49, 0x2b, 0x09, 0x03, 0xc2, 0x71, 0xbb, 0xe2, 0xb3, 0x39,
- 0x5e, 0xf2, 0x59, 0x66, 0x9b, 0xef, 0x43, 0xb5, 0x7f, 0x7f, 0xcc,
- 0x30, 0x27, 0xdb, 0x01, 0x82, 0x3f, 0x6b, 0xae, 0xe6, 0x6e, 0x4f,
- 0x9f, 0xea, 0xd4, 0xd6, 0x72, 0x6c, 0x74, 0x1f, 0xce})),
- std::make_pair(
- 157,
- std::vector<uint8_t>(
- {0x50, 0xc8, 0xb8, 0xcf, 0x34, 0xcd, 0x87, 0x9f, 0x80, 0xe2, 0xfa,
- 0xab, 0x32, 0x30, 0xb0, 0xc0, 0xe1, 0xcc, 0x3e, 0x9d, 0xca, 0xde,
- 0xb1, 0xb9, 0xd9, 0x7a, 0xb9, 0x23, 0x41, 0x5d, 0xd9, 0xa1, 0xfe,
- 0x38, 0xad, 0xdd, 0x5c, 0x11, 0x75, 0x6c, 0x67, 0x99, 0x0b, 0x25,
- 0x6e, 0x95, 0xad, 0x6d, 0x8f, 0x9f, 0xed, 0xce, 0x10, 0xbf, 0x1c,
- 0x90, 0x67, 0x9c, 0xde, 0x0e, 0xcf, 0x1b, 0xe3, 0x47})),
- std::make_pair(
- 158,
- std::vector<uint8_t>(
- {0x0a, 0x38, 0x6e, 0x7c, 0xd5, 0xdd, 0x9b, 0x77, 0xa0, 0x35, 0xe0,
- 0x9f, 0xe6, 0xfe, 0xe2, 0xc8, 0xce, 0x61, 0xb5, 0x38, 0x3c, 0x87,
- 0xea, 0x43, 0x20, 0x50, 0x59, 0xc5, 0xe4, 0xcd, 0x4f, 0x44, 0x08,
- 0x31, 0x9b, 0xb0, 0xa8, 0x23, 0x60, 0xf6, 0xa5, 0x8e, 0x6c, 0x9c,
- 0xe3, 0xf4, 0x87, 0xc4, 0x46, 0x06, 0x3b, 0xf8, 0x13, 0xbc, 0x6b,
- 0xa5, 0x35, 0xe1, 0x7f, 0xc1, 0x82, 0x6c, 0xfc, 0x91})),
- std::make_pair(
- 159,
- std::vector<uint8_t>(
- {0x1f, 0x14, 0x59, 0xcb, 0x6b, 0x61, 0xcb, 0xac, 0x5f, 0x0e, 0xfe,
- 0x8f, 0xc4, 0x87, 0x53, 0x8f, 0x42, 0x54, 0x89, 0x87, 0xfc, 0xd5,
- 0x62, 0x21, 0xcf, 0xa7, 0xbe, 0xb2, 0x25, 0x04, 0x76, 0x9e, 0x79,
- 0x2c, 0x45, 0xad, 0xfb, 0x1d, 0x6b, 0x3d, 0x60, 0xd7, 0xb7, 0x49,
- 0xc8, 0xa7, 0x5b, 0x0b, 0xdf, 0x14, 0xe8, 0xea, 0x72, 0x1b, 0x95,
- 0xdc, 0xa5, 0x38, 0xca, 0x6e, 0x25, 0x71, 0x12, 0x09})),
- std::make_pair(
- 160,
- std::vector<uint8_t>(
- {0xe5, 0x8b, 0x38, 0x36, 0xb7, 0xd8, 0xfe, 0xdb, 0xb5, 0x0c, 0xa5,
- 0x72, 0x5c, 0x65, 0x71, 0xe7, 0x4c, 0x07, 0x85, 0xe9, 0x78, 0x21,
- 0xda, 0xb8, 0xb6, 0x29, 0x8c, 0x10, 0xe4, 0xc0, 0x79, 0xd4, 0xa6,
- 0xcd, 0xf2, 0x2f, 0x0f, 0xed, 0xb5, 0x50, 0x32, 0x92, 0x5c, 0x16,
- 0x74, 0x81, 0x15, 0xf0, 0x1a, 0x10, 0x5e, 0x77, 0xe0, 0x0c, 0xee,
- 0x3d, 0x07, 0x92, 0x4d, 0xc0, 0xd8, 0xf9, 0x06, 0x59})),
- std::make_pair(
- 161,
- std::vector<uint8_t>(
- {0xb9, 0x29, 0xcc, 0x65, 0x05, 0xf0, 0x20, 0x15, 0x86, 0x72, 0xde,
- 0xda, 0x56, 0xd0, 0xdb, 0x08, 0x1a, 0x2e, 0xe3, 0x4c, 0x00, 0xc1,
- 0x10, 0x00, 0x29, 0xbd, 0xf8, 0xea, 0x98, 0x03, 0x4f, 0xa4, 0xbf,
- 0x3e, 0x86, 0x55, 0xec, 0x69, 0x7f, 0xe3, 0x6f, 0x40, 0x55, 0x3c,
- 0x5b, 0xb4, 0x68, 0x01, 0x64, 0x4a, 0x62, 0x7d, 0x33, 0x42, 0xf4,
- 0xfc, 0x92, 0xb6, 0x1f, 0x03, 0x29, 0x0f, 0xb3, 0x81})),
- std::make_pair(
- 162,
- std::vector<uint8_t>(
- {0x72, 0xd3, 0x53, 0x99, 0x4b, 0x49, 0xd3, 0xe0, 0x31, 0x53, 0x92,
- 0x9a, 0x1e, 0x4d, 0x4f, 0x18, 0x8e, 0xe5, 0x8a, 0xb9, 0xe7, 0x2e,
- 0xe8, 0xe5, 0x12, 0xf2, 0x9b, 0xc7, 0x73, 0x91, 0x38, 0x19, 0xce,
- 0x05, 0x7d, 0xdd, 0x70, 0x02, 0xc0, 0x43, 0x3e, 0xe0, 0xa1, 0x61,
- 0x14, 0xe3, 0xd1, 0x56, 0xdd, 0x2c, 0x4a, 0x7e, 0x80, 0xee, 0x53,
- 0x37, 0x8b, 0x86, 0x70, 0xf2, 0x3e, 0x33, 0xef, 0x56})),
- std::make_pair(
- 163,
- std::vector<uint8_t>(
- {0xc7, 0x0e, 0xf9, 0xbf, 0xd7, 0x75, 0xd4, 0x08, 0x17, 0x67, 0x37,
- 0xa0, 0x73, 0x6d, 0x68, 0x51, 0x7c, 0xe1, 0xaa, 0xad, 0x7e, 0x81,
- 0xa9, 0x3c, 0x8c, 0x1e, 0xd9, 0x67, 0xea, 0x21, 0x4f, 0x56, 0xc8,
- 0xa3, 0x77, 0xb1, 0x76, 0x3e, 0x67, 0x66, 0x15, 0xb6, 0x0f, 0x39,
- 0x88, 0x24, 0x1e, 0xae, 0x6e, 0xab, 0x96, 0x85, 0xa5, 0x12, 0x49,
- 0x29, 0xd2, 0x81, 0x88, 0xf2, 0x9e, 0xab, 0x06, 0xf7})),
- std::make_pair(
- 164,
- std::vector<uint8_t>(
- {0xc2, 0x30, 0xf0, 0x80, 0x26, 0x79, 0xcb, 0x33, 0x82, 0x2e, 0xf8,
- 0xb3, 0xb2, 0x1b, 0xf7, 0xa9, 0xa2, 0x89, 0x42, 0x09, 0x29, 0x01,
- 0xd7, 0xda, 0xc3, 0x76, 0x03, 0x00, 0x83, 0x10, 0x26, 0xcf, 0x35,
- 0x4c, 0x92, 0x32, 0xdf, 0x3e, 0x08, 0x4d, 0x99, 0x03, 0x13, 0x0c,
- 0x60, 0x1f, 0x63, 0xc1, 0xf4, 0xa4, 0xa4, 0xb8, 0x10, 0x6e, 0x46,
- 0x8c, 0xd4, 0x43, 0xbb, 0xe5, 0xa7, 0x34, 0xf4, 0x5f})),
- std::make_pair(
- 165,
- std::vector<uint8_t>(
- {0x6f, 0x43, 0x09, 0x4c, 0xaf, 0xb5, 0xeb, 0xf1, 0xf7, 0xa4, 0x93,
- 0x7e, 0xc5, 0x0f, 0x56, 0xa4, 0xc9, 0xda, 0x30, 0x3c, 0xbb, 0x55,
- 0xac, 0x1f, 0x27, 0xf1, 0xf1, 0x97, 0x6c, 0xd9, 0x6b, 0xed, 0xa9,
- 0x46, 0x4f, 0x0e, 0x7b, 0x9c, 0x54, 0x62, 0x0b, 0x8a, 0x9f, 0xba,
- 0x98, 0x31, 0x64, 0xb8, 0xbe, 0x35, 0x78, 0x42, 0x5a, 0x02, 0x4f,
- 0x5f, 0xe1, 0x99, 0xc3, 0x63, 0x56, 0xb8, 0x89, 0x72})),
- std::make_pair(
- 166,
- std::vector<uint8_t>(
- {0x37, 0x45, 0x27, 0x3f, 0x4c, 0x38, 0x22, 0x5d, 0xb2, 0x33, 0x73,
- 0x81, 0x87, 0x1a, 0x0c, 0x6a, 0xaf, 0xd3, 0xaf, 0x9b, 0x01, 0x8c,
- 0x88, 0xaa, 0x02, 0x02, 0x58, 0x50, 0xa5, 0xdc, 0x3a, 0x42, 0xa1,
- 0xa3, 0xe0, 0x3e, 0x56, 0xcb, 0xf1, 0xb0, 0x87, 0x6d, 0x63, 0xa4,
- 0x41, 0xf1, 0xd2, 0x85, 0x6a, 0x39, 0xb8, 0x80, 0x1e, 0xb5, 0xaf,
- 0x32, 0x52, 0x01, 0xc4, 0x15, 0xd6, 0x5e, 0x97, 0xfe})),
- std::make_pair(
- 167,
- std::vector<uint8_t>(
- {0xc5, 0x0c, 0x44, 0xcc, 0xa3, 0xec, 0x3e, 0xda, 0xae, 0x77, 0x9a,
- 0x7e, 0x17, 0x94, 0x50, 0xeb, 0xdd, 0xa2, 0xf9, 0x70, 0x67, 0xc6,
- 0x90, 0xaa, 0x6c, 0x5a, 0x4a, 0xc7, 0xc3, 0x01, 0x39, 0xbb, 0x27,
- 0xc0, 0xdf, 0x4d, 0xb3, 0x22, 0x0e, 0x63, 0xcb, 0x11, 0x0d, 0x64,
- 0xf3, 0x7f, 0xfe, 0x07, 0x8d, 0xb7, 0x26, 0x53, 0xe2, 0xda, 0xac,
- 0xf9, 0x3a, 0xe3, 0xf0, 0xa2, 0xd1, 0xa7, 0xeb, 0x2e})),
- std::make_pair(
- 168,
- std::vector<uint8_t>(
- {0x8a, 0xef, 0x26, 0x3e, 0x38, 0x5c, 0xbc, 0x61, 0xe1, 0x9b, 0x28,
- 0x91, 0x42, 0x43, 0x26, 0x2a, 0xf5, 0xaf, 0xe8, 0x72, 0x6a, 0xf3,
- 0xce, 0x39, 0xa7, 0x9c, 0x27, 0x02, 0x8c, 0xf3, 0xec, 0xd3, 0xf8,
- 0xd2, 0xdf, 0xd9, 0xcf, 0xc9, 0xad, 0x91, 0xb5, 0x8f, 0x6f, 0x20,
- 0x77, 0x8f, 0xd5, 0xf0, 0x28, 0x94, 0xa3, 0xd9, 0x1c, 0x7d, 0x57,
- 0xd1, 0xe4, 0xb8, 0x66, 0xa7, 0xf3, 0x64, 0xb6, 0xbe})),
- std::make_pair(
- 169,
- std::vector<uint8_t>(
- {0x28, 0x69, 0x61, 0x41, 0xde, 0x6e, 0x2d, 0x9b, 0xcb, 0x32, 0x35,
- 0x57, 0x8a, 0x66, 0x16, 0x6c, 0x14, 0x48, 0xd3, 0xe9, 0x05, 0xa1,
- 0xb4, 0x82, 0xd4, 0x23, 0xbe, 0x4b, 0xc5, 0x36, 0x9b, 0xc8, 0xc7,
- 0x4d, 0xae, 0x0a, 0xcc, 0x9c, 0xc1, 0x23, 0xe1, 0xd8, 0xdd, 0xce,
- 0x9f, 0x97, 0x91, 0x7e, 0x8c, 0x01, 0x9c, 0x55, 0x2d, 0xa3, 0x2d,
- 0x39, 0xd2, 0x21, 0x9b, 0x9a, 0xbf, 0x0f, 0xa8, 0xc8})),
- std::make_pair(
- 170,
- std::vector<uint8_t>(
- {0x2f, 0xb9, 0xeb, 0x20, 0x85, 0x83, 0x01, 0x81, 0x90, 0x3a, 0x9d,
- 0xaf, 0xe3, 0xdb, 0x42, 0x8e, 0xe1, 0x5b, 0xe7, 0x66, 0x22, 0x24,
- 0xef, 0xd6, 0x43, 0x37, 0x1f, 0xb2, 0x56, 0x46, 0xae, 0xe7, 0x16,
- 0xe5, 0x31, 0xec, 0xa6, 0x9b, 0x2b, 0xdc, 0x82, 0x33, 0xf1, 0xa8,
- 0x08, 0x1f, 0xa4, 0x3d, 0xa1, 0x50, 0x03, 0x02, 0x97, 0x5a, 0x77,
- 0xf4, 0x2f, 0xa5, 0x92, 0x13, 0x67, 0x10, 0xe9, 0xdc})),
- std::make_pair(
- 171,
- std::vector<uint8_t>(
- {0x66, 0xf9, 0xa7, 0x14, 0x3f, 0x7a, 0x33, 0x14, 0xa6, 0x69, 0xbf,
- 0x2e, 0x24, 0xbb, 0xb3, 0x50, 0x14, 0x26, 0x1d, 0x63, 0x9f, 0x49,
- 0x5b, 0x6c, 0x9c, 0x1f, 0x10, 0x4f, 0xe8, 0xe3, 0x20, 0xac, 0xa6,
- 0x0d, 0x45, 0x50, 0xd6, 0x9d, 0x52, 0xed, 0xbd, 0x5a, 0x3c, 0xde,
- 0xb4, 0x01, 0x4a, 0xe6, 0x5b, 0x1d, 0x87, 0xaa, 0x77, 0x0b, 0x69,
- 0xae, 0x5c, 0x15, 0xf4, 0x33, 0x0b, 0x0b, 0x0a, 0xd8})),
- std::make_pair(
- 172,
- std::vector<uint8_t>(
- {0xf4, 0xc4, 0xdd, 0x1d, 0x59, 0x4c, 0x35, 0x65, 0xe3, 0xe2, 0x5c,
- 0xa4, 0x3d, 0xad, 0x82, 0xf6, 0x2a, 0xbe, 0xa4, 0x83, 0x5e, 0xd4,
- 0xcd, 0x81, 0x1b, 0xcd, 0x97, 0x5e, 0x46, 0x27, 0x98, 0x28, 0xd4,
- 0x4d, 0x4c, 0x62, 0xc3, 0x67, 0x9f, 0x1b, 0x7f, 0x7b, 0x9d, 0xd4,
- 0x57, 0x1d, 0x7b, 0x49, 0x55, 0x73, 0x47, 0xb8, 0xc5, 0x46, 0x0c,
- 0xbd, 0xc1, 0xbe, 0xf6, 0x90, 0xfb, 0x2a, 0x08, 0xc0})),
- std::make_pair(
- 173,
- std::vector<uint8_t>(
- {0x8f, 0x1d, 0xc9, 0x64, 0x9c, 0x3a, 0x84, 0x55, 0x1f, 0x8f, 0x6e,
- 0x91, 0xca, 0xc6, 0x82, 0x42, 0xa4, 0x3b, 0x1f, 0x8f, 0x32, 0x8e,
- 0xe9, 0x22, 0x80, 0x25, 0x73, 0x87, 0xfa, 0x75, 0x59, 0xaa, 0x6d,
- 0xb1, 0x2e, 0x4a, 0xea, 0xdc, 0x2d, 0x26, 0x09, 0x91, 0x78, 0x74,
- 0x9c, 0x68, 0x64, 0xb3, 0x57, 0xf3, 0xf8, 0x3b, 0x2f, 0xb3, 0xef,
- 0xa8, 0xd2, 0xa8, 0xdb, 0x05, 0x6b, 0xed, 0x6b, 0xcc})),
- std::make_pair(
- 174,
- std::vector<uint8_t>(
- {0x31, 0x39, 0xc1, 0xa7, 0xf9, 0x7a, 0xfd, 0x16, 0x75, 0xd4, 0x60,
- 0xeb, 0xbc, 0x07, 0xf2, 0x72, 0x8a, 0xa1, 0x50, 0xdf, 0x84, 0x96,
- 0x24, 0x51, 0x1e, 0xe0, 0x4b, 0x74, 0x3b, 0xa0, 0xa8, 0x33, 0x09,
- 0x2f, 0x18, 0xc1, 0x2d, 0xc9, 0x1b, 0x4d, 0xd2, 0x43, 0xf3, 0x33,
- 0x40, 0x2f, 0x59, 0xfe, 0x28, 0xab, 0xdb, 0xbb, 0xae, 0x30, 0x1e,
- 0x7b, 0x65, 0x9c, 0x7a, 0x26, 0xd5, 0xc0, 0xf9, 0x79})),
- std::make_pair(
- 175,
- std::vector<uint8_t>(
- {0x06, 0xf9, 0x4a, 0x29, 0x96, 0x15, 0x8a, 0x81, 0x9f, 0xe3, 0x4c,
- 0x40, 0xde, 0x3c, 0xf0, 0x37, 0x9f, 0xd9, 0xfb, 0x85, 0xb3, 0xe3,
- 0x63, 0xba, 0x39, 0x26, 0xa0, 0xe7, 0xd9, 0x60, 0xe3, 0xf4, 0xc2,
- 0xe0, 0xc7, 0x0c, 0x7c, 0xe0, 0xcc, 0xb2, 0xa6, 0x4f, 0xc2, 0x98,
- 0x69, 0xf6, 0xe7, 0xab, 0x12, 0xbd, 0x4d, 0x3f, 0x14, 0xfc, 0xe9,
- 0x43, 0x27, 0x90, 0x27, 0xe7, 0x85, 0xfb, 0x5c, 0x29})),
- std::make_pair(
- 176,
- std::vector<uint8_t>(
- {0xc2, 0x9c, 0x39, 0x9e, 0xf3, 0xee, 0xe8, 0x96, 0x1e, 0x87, 0x56,
- 0x5c, 0x1c, 0xe2, 0x63, 0x92, 0x5f, 0xc3, 0xd0, 0xce, 0x26, 0x7d,
- 0x13, 0xe4, 0x8d, 0xd9, 0xe7, 0x32, 0xee, 0x67, 0xb0, 0xf6, 0x9f,
- 0xad, 0x56, 0x40, 0x1b, 0x0f, 0x10, 0xfc, 0xaa, 0xc1, 0x19, 0x20,
- 0x10, 0x46, 0xcc, 0xa2, 0x8c, 0x5b, 0x14, 0xab, 0xde, 0xa3, 0x21,
- 0x2a, 0xe6, 0x55, 0x62, 0xf7, 0xf1, 0x38, 0xdb, 0x3d})),
- std::make_pair(
- 177,
- std::vector<uint8_t>(
- {0x4c, 0xec, 0x4c, 0x9d, 0xf5, 0x2e, 0xef, 0x05, 0xc3, 0xf6, 0xfa,
- 0xaa, 0x97, 0x91, 0xbc, 0x74, 0x45, 0x93, 0x71, 0x83, 0x22, 0x4e,
- 0xcc, 0x37, 0xa1, 0xe5, 0x8d, 0x01, 0x32, 0xd3, 0x56, 0x17, 0x53,
- 0x1d, 0x7e, 0x79, 0x5f, 0x52, 0xaf, 0x7b, 0x1e, 0xb9, 0xd1, 0x47,
- 0xde, 0x12, 0x92, 0xd3, 0x45, 0xfe, 0x34, 0x18, 0x23, 0xf8, 0xe6,
- 0xbc, 0x1e, 0x5b, 0xad, 0xca, 0x5c, 0x65, 0x61, 0x08})),
- std::make_pair(
- 178,
- std::vector<uint8_t>(
- {0x89, 0x8b, 0xfb, 0xae, 0x93, 0xb3, 0xe1, 0x8d, 0x00, 0x69, 0x7e,
- 0xab, 0x7d, 0x97, 0x04, 0xfa, 0x36, 0xec, 0x33, 0x9d, 0x07, 0x61,
- 0x31, 0xce, 0xfd, 0xf3, 0x0e, 0xdb, 0xe8, 0xd9, 0xcc, 0x81, 0xc3,
- 0xa8, 0x0b, 0x12, 0x96, 0x59, 0xb1, 0x63, 0xa3, 0x23, 0xba, 0xb9,
- 0x79, 0x3d, 0x4f, 0xee, 0xd9, 0x2d, 0x54, 0xda, 0xe9, 0x66, 0xc7,
- 0x75, 0x29, 0x76, 0x4a, 0x09, 0xbe, 0x88, 0xdb, 0x45})),
- std::make_pair(
- 179,
- std::vector<uint8_t>(
- {0xee, 0x9b, 0xd0, 0x46, 0x9d, 0x3a, 0xaf, 0x4f, 0x14, 0x03, 0x5b,
- 0xe4, 0x8a, 0x2c, 0x3b, 0x84, 0xd9, 0xb4, 0xb1, 0xff, 0xf1, 0xd9,
- 0x45, 0xe1, 0xf1, 0xc1, 0xd3, 0x89, 0x80, 0xa9, 0x51, 0xbe, 0x19,
- 0x7b, 0x25, 0xfe, 0x22, 0xc7, 0x31, 0xf2, 0x0a, 0xea, 0xcc, 0x93,
- 0x0b, 0xa9, 0xc4, 0xa1, 0xf4, 0x76, 0x22, 0x27, 0x61, 0x7a, 0xd3,
- 0x50, 0xfd, 0xab, 0xb4, 0xe8, 0x02, 0x73, 0xa0, 0xf4})),
- std::make_pair(
- 180,
- std::vector<uint8_t>(
- {0x3d, 0x4d, 0x31, 0x13, 0x30, 0x05, 0x81, 0xcd, 0x96, 0xac, 0xbf,
- 0x09, 0x1c, 0x3d, 0x0f, 0x3c, 0x31, 0x01, 0x38, 0xcd, 0x69, 0x79,
- 0xe6, 0x02, 0x6c, 0xde, 0x62, 0x3e, 0x2d, 0xd1, 0xb2, 0x4d, 0x4a,
- 0x86, 0x38, 0xbe, 0xd1, 0x07, 0x33, 0x44, 0x78, 0x3a, 0xd0, 0x64,
- 0x9c, 0xc6, 0x30, 0x5c, 0xce, 0xc0, 0x4b, 0xeb, 0x49, 0xf3, 0x1c,
- 0x63, 0x30, 0x88, 0xa9, 0x9b, 0x65, 0x13, 0x02, 0x67})),
- std::make_pair(
- 181,
- std::vector<uint8_t>(
- {0x95, 0xc0, 0x59, 0x1a, 0xd9, 0x1f, 0x92, 0x1a, 0xc7, 0xbe, 0x6d,
- 0x9c, 0xe3, 0x7e, 0x06, 0x63, 0xed, 0x80, 0x11, 0xc1, 0xcf, 0xd6,
- 0xd0, 0x16, 0x2a, 0x55, 0x72, 0xe9, 0x43, 0x68, 0xba, 0xc0, 0x20,
- 0x24, 0x48, 0x5e, 0x6a, 0x39, 0x85, 0x4a, 0xa4, 0x6f, 0xe3, 0x8e,
- 0x97, 0xd6, 0xc6, 0xb1, 0x94, 0x7c, 0xd2, 0x72, 0xd8, 0x6b, 0x06,
- 0xbb, 0x5b, 0x2f, 0x78, 0xb9, 0xb6, 0x8d, 0x55, 0x9d})),
- std::make_pair(
- 182,
- std::vector<uint8_t>(
- {0x22, 0x7b, 0x79, 0xde, 0xd3, 0x68, 0x15, 0x3b, 0xf4, 0x6c, 0x0a,
- 0x3c, 0xa9, 0x78, 0xbf, 0xdb, 0xef, 0x31, 0xf3, 0x02, 0x4a, 0x56,
- 0x65, 0x84, 0x24, 0x68, 0x49, 0x0b, 0x0f, 0xf7, 0x48, 0xae, 0x04,
- 0xe7, 0x83, 0x2e, 0xd4, 0xc9, 0xf4, 0x9d, 0xe9, 0xb1, 0x70, 0x67,
- 0x09, 0xd6, 0x23, 0xe5, 0xc8, 0xc1, 0x5e, 0x3c, 0xae, 0xca, 0xe8,
- 0xd5, 0xe4, 0x33, 0x43, 0x0f, 0xf7, 0x2f, 0x20, 0xeb})),
- std::make_pair(
- 183,
- std::vector<uint8_t>(
- {0x5d, 0x34, 0xf3, 0x95, 0x2f, 0x01, 0x05, 0xee, 0xf8, 0x8a, 0xe8,
- 0xb6, 0x4c, 0x6c, 0xe9, 0x5e, 0xbf, 0xad, 0xe0, 0xe0, 0x2c, 0x69,
- 0xb0, 0x87, 0x62, 0xa8, 0x71, 0x2d, 0x2e, 0x49, 0x11, 0xad, 0x3f,
- 0x94, 0x1f, 0xc4, 0x03, 0x4d, 0xc9, 0xb2, 0xe4, 0x79, 0xfd, 0xbc,
- 0xd2, 0x79, 0xb9, 0x02, 0xfa, 0xf5, 0xd8, 0x38, 0xbb, 0x2e, 0x0c,
- 0x64, 0x95, 0xd3, 0x72, 0xb5, 0xb7, 0x02, 0x98, 0x13})),
- std::make_pair(
- 184,
- std::vector<uint8_t>(
- {0x7f, 0x93, 0x9b, 0xf8, 0x35, 0x3a, 0xbc, 0xe4, 0x9e, 0x77, 0xf1,
- 0x4f, 0x37, 0x50, 0xaf, 0x20, 0xb7, 0xb0, 0x39, 0x02, 0xe1, 0xa1,
- 0xe7, 0xfb, 0x6a, 0xaf, 0x76, 0xd0, 0x25, 0x9c, 0xd4, 0x01, 0xa8,
- 0x31, 0x90, 0xf1, 0x56, 0x40, 0xe7, 0x4f, 0x3e, 0x6c, 0x5a, 0x90,
- 0xe8, 0x39, 0xc7, 0x82, 0x1f, 0x64, 0x74, 0x75, 0x7f, 0x75, 0xc7,
- 0xbf, 0x90, 0x02, 0x08, 0x4d, 0xdc, 0x7a, 0x62, 0xdc})),
- std::make_pair(
- 185,
- std::vector<uint8_t>(
- {0x06, 0x2b, 0x61, 0xa2, 0xf9, 0xa3, 0x3a, 0x71, 0xd7, 0xd0, 0xa0,
- 0x61, 0x19, 0x64, 0x4c, 0x70, 0xb0, 0x71, 0x6a, 0x50, 0x4d, 0xe7,
- 0xe5, 0xe1, 0xbe, 0x49, 0xbd, 0x7b, 0x86, 0xe7, 0xed, 0x68, 0x17,
- 0x71, 0x4f, 0x9f, 0x0f, 0xc3, 0x13, 0xd0, 0x61, 0x29, 0x59, 0x7e,
- 0x9a, 0x22, 0x35, 0xec, 0x85, 0x21, 0xde, 0x36, 0xf7, 0x29, 0x0a,
- 0x90, 0xcc, 0xfc, 0x1f, 0xfa, 0x6d, 0x0a, 0xee, 0x29})),
- std::make_pair(
- 186,
- std::vector<uint8_t>(
- {0xf2, 0x9e, 0x01, 0xee, 0xae, 0x64, 0x31, 0x1e, 0xb7, 0xf1, 0xc6,
- 0x42, 0x2f, 0x94, 0x6b, 0xf7, 0xbe, 0xa3, 0x63, 0x79, 0x52, 0x3e,
- 0x7b, 0x2b, 0xba, 0xba, 0x7d, 0x1d, 0x34, 0xa2, 0x2d, 0x5e, 0xa5,
- 0xf1, 0xc5, 0xa0, 0x9d, 0x5c, 0xe1, 0xfe, 0x68, 0x2c, 0xce, 0xd9,
- 0xa4, 0x79, 0x8d, 0x1a, 0x05, 0xb4, 0x6c, 0xd7, 0x2d, 0xff, 0x5c,
- 0x1b, 0x35, 0x54, 0x40, 0xb2, 0xa2, 0xd4, 0x76, 0xbc})),
- std::make_pair(
- 187,
- std::vector<uint8_t>(
- {0xec, 0x38, 0xcd, 0x3b, 0xba, 0xb3, 0xef, 0x35, 0xd7, 0xcb, 0x6d,
- 0x5c, 0x91, 0x42, 0x98, 0x35, 0x1d, 0x8a, 0x9d, 0xc9, 0x7f, 0xce,
- 0xe0, 0x51, 0xa8, 0xa0, 0x2f, 0x58, 0xe3, 0xed, 0x61, 0x84, 0xd0,
- 0xb7, 0x81, 0x0a, 0x56, 0x15, 0x41, 0x1a, 0xb1, 0xb9, 0x52, 0x09,
- 0xc3, 0xc8, 0x10, 0x11, 0x4f, 0xde, 0xb2, 0x24, 0x52, 0x08, 0x4e,
- 0x77, 0xf3, 0xf8, 0x47, 0xc6, 0xdb, 0xaa, 0xfe, 0x16})),
- std::make_pair(
- 188,
- std::vector<uint8_t>(
- {0xc2, 0xae, 0xf5, 0xe0, 0xca, 0x43, 0xe8, 0x26, 0x41, 0x56, 0x5b,
- 0x8c, 0xb9, 0x43, 0xaa, 0x8b, 0xa5, 0x35, 0x50, 0xca, 0xef, 0x79,
- 0x3b, 0x65, 0x32, 0xfa, 0xfa, 0xd9, 0x4b, 0x81, 0x60, 0x82, 0xf0,
- 0x11, 0x3a, 0x3e, 0xa2, 0xf6, 0x36, 0x08, 0xab, 0x40, 0x43, 0x7e,
- 0xcc, 0x0f, 0x02, 0x29, 0xcb, 0x8f, 0xa2, 0x24, 0xdc, 0xf1, 0xc4,
- 0x78, 0xa6, 0x7d, 0x9b, 0x64, 0x16, 0x2b, 0x92, 0xd1})),
- std::make_pair(
- 189,
- std::vector<uint8_t>(
- {0x15, 0xf5, 0x34, 0xef, 0xff, 0x71, 0x05, 0xcd, 0x1c, 0x25, 0x4d,
- 0x07, 0x4e, 0x27, 0xd5, 0x89, 0x8b, 0x89, 0x31, 0x3b, 0x7d, 0x36,
- 0x6d, 0xc2, 0xd7, 0xd8, 0x71, 0x13, 0xfa, 0x7d, 0x53, 0xaa, 0xe1,
- 0x3f, 0x6d, 0xba, 0x48, 0x7a, 0xd8, 0x10, 0x3d, 0x5e, 0x85, 0x4c,
- 0x91, 0xfd, 0xb6, 0xe1, 0xe7, 0x4b, 0x2e, 0xf6, 0xd1, 0x43, 0x17,
- 0x69, 0xc3, 0x07, 0x67, 0xdd, 0xe0, 0x67, 0xa3, 0x5c})),
- std::make_pair(
- 190,
- std::vector<uint8_t>(
- {0x89, 0xac, 0xbc, 0xa0, 0xb1, 0x69, 0x89, 0x7a, 0x0a, 0x27, 0x14,
- 0xc2, 0xdf, 0x8c, 0x95, 0xb5, 0xb7, 0x9c, 0xb6, 0x93, 0x90, 0x14,
- 0x2b, 0x7d, 0x60, 0x18, 0xbb, 0x3e, 0x30, 0x76, 0xb0, 0x99, 0xb7,
- 0x9a, 0x96, 0x41, 0x52, 0xa9, 0xd9, 0x12, 0xb1, 0xb8, 0x64, 0x12,
- 0xb7, 0xe3, 0x72, 0xe9, 0xce, 0xca, 0xd7, 0xf2, 0x5d, 0x4c, 0xba,
- 0xb8, 0xa3, 0x17, 0xbe, 0x36, 0x49, 0x2a, 0x67, 0xd7})),
- std::make_pair(
- 191,
- std::vector<uint8_t>(
- {0xe3, 0xc0, 0x73, 0x91, 0x90, 0xed, 0x84, 0x9c, 0x9c, 0x96, 0x2f,
- 0xd9, 0xdb, 0xb5, 0x5e, 0x20, 0x7e, 0x62, 0x4f, 0xca, 0xc1, 0xeb,
- 0x41, 0x76, 0x91, 0x51, 0x54, 0x99, 0xee, 0xa8, 0xd8, 0x26, 0x7b,
- 0x7e, 0x8f, 0x12, 0x87, 0xa6, 0x36, 0x33, 0xaf, 0x50, 0x11, 0xfd,
- 0xe8, 0xc4, 0xdd, 0xf5, 0x5b, 0xfd, 0xf7, 0x22, 0xed, 0xf8, 0x88,
- 0x31, 0x41, 0x4f, 0x2c, 0xfa, 0xed, 0x59, 0xcb, 0x9a})),
- std::make_pair(
- 192,
- std::vector<uint8_t>(
- {0x8d, 0x6c, 0xf8, 0x7c, 0x08, 0x38, 0x0d, 0x2d, 0x15, 0x06, 0xee,
- 0xe4, 0x6f, 0xd4, 0x22, 0x2d, 0x21, 0xd8, 0xc0, 0x4e, 0x58, 0x5f,
- 0xbf, 0xd0, 0x82, 0x69, 0xc9, 0x8f, 0x70, 0x28, 0x33, 0xa1, 0x56,
- 0x32, 0x6a, 0x07, 0x24, 0x65, 0x64, 0x00, 0xee, 0x09, 0x35, 0x1d,
- 0x57, 0xb4, 0x40, 0x17, 0x5e, 0x2a, 0x5d, 0xe9, 0x3c, 0xc5, 0xf8,
- 0x0d, 0xb6, 0xda, 0xf8, 0x35, 0x76, 0xcf, 0x75, 0xfa})),
- std::make_pair(
- 193,
- std::vector<uint8_t>(
- {0xda, 0x24, 0xbe, 0xde, 0x38, 0x36, 0x66, 0xd5, 0x63, 0xee, 0xed,
- 0x37, 0xf6, 0x31, 0x9b, 0xaf, 0x20, 0xd5, 0xc7, 0x5d, 0x16, 0x35,
- 0xa6, 0xba, 0x5e, 0xf4, 0xcf, 0xa1, 0xac, 0x95, 0x48, 0x7e, 0x96,
- 0xf8, 0xc0, 0x8a, 0xf6, 0x00, 0xaa, 0xb8, 0x7c, 0x98, 0x6e, 0xba,
- 0xd4, 0x9f, 0xc7, 0x0a, 0x58, 0xb4, 0x89, 0x0b, 0x9c, 0x87, 0x6e,
- 0x09, 0x10, 0x16, 0xda, 0xf4, 0x9e, 0x1d, 0x32, 0x2e})),
- std::make_pair(
- 194,
- std::vector<uint8_t>(
- {0xf9, 0xd1, 0xd1, 0xb1, 0xe8, 0x7e, 0xa7, 0xae, 0x75, 0x3a, 0x02,
- 0x97, 0x50, 0xcc, 0x1c, 0xf3, 0xd0, 0x15, 0x7d, 0x41, 0x80, 0x5e,
- 0x24, 0x5c, 0x56, 0x17, 0xbb, 0x93, 0x4e, 0x73, 0x2f, 0x0a, 0xe3,
- 0x18, 0x0b, 0x78, 0xe0, 0x5b, 0xfe, 0x76, 0xc7, 0xc3, 0x05, 0x1e,
- 0x3e, 0x3a, 0xc7, 0x8b, 0x9b, 0x50, 0xc0, 0x51, 0x42, 0x65, 0x7e,
- 0x1e, 0x03, 0x21, 0x5d, 0x6e, 0xc7, 0xbf, 0xd0, 0xfc})),
- std::make_pair(
- 195,
- std::vector<uint8_t>(
- {0x11, 0xb7, 0xbc, 0x16, 0x68, 0x03, 0x20, 0x48, 0xaa, 0x43, 0x34,
- 0x3d, 0xe4, 0x76, 0x39, 0x5e, 0x81, 0x4b, 0xbb, 0xc2, 0x23, 0x67,
- 0x8d, 0xb9, 0x51, 0xa1, 0xb0, 0x3a, 0x02, 0x1e, 0xfa, 0xc9, 0x48,
- 0xcf, 0xbe, 0x21, 0x5f, 0x97, 0xfe, 0x9a, 0x72, 0xa2, 0xf6, 0xbc,
- 0x03, 0x9e, 0x39, 0x56, 0xbf, 0xa4, 0x17, 0xc1, 0xa9, 0xf1, 0x0d,
- 0x6d, 0x7b, 0xa5, 0xd3, 0xd3, 0x2f, 0xf3, 0x23, 0xe5})),
- std::make_pair(
- 196,
- std::vector<uint8_t>(
- {0xb8, 0xd9, 0x00, 0x0e, 0x4f, 0xc2, 0xb0, 0x66, 0xed, 0xb9, 0x1a,
- 0xfe, 0xe8, 0xe7, 0xeb, 0x0f, 0x24, 0xe3, 0xa2, 0x01, 0xdb, 0x8b,
- 0x67, 0x93, 0xc0, 0x60, 0x85, 0x81, 0xe6, 0x28, 0xed, 0x0b, 0xcc,
- 0x4e, 0x5a, 0xa6, 0x78, 0x79, 0x92, 0xa4, 0xbc, 0xc4, 0x4e, 0x28,
- 0x80, 0x93, 0xe6, 0x3e, 0xe8, 0x3a, 0xbd, 0x0b, 0xc3, 0xec, 0x6d,
- 0x09, 0x34, 0xa6, 0x74, 0xa4, 0xda, 0x13, 0x83, 0x8a})),
- std::make_pair(
- 197,
- std::vector<uint8_t>(
- {0xce, 0x32, 0x5e, 0x29, 0x4f, 0x9b, 0x67, 0x19, 0xd6, 0xb6, 0x12,
- 0x78, 0x27, 0x6a, 0xe0, 0x6a, 0x25, 0x64, 0xc0, 0x3b, 0xb0, 0xb7,
- 0x83, 0xfa, 0xfe, 0x78, 0x5b, 0xdf, 0x89, 0xc7, 0xd5, 0xac, 0xd8,
- 0x3e, 0x78, 0x75, 0x6d, 0x30, 0x1b, 0x44, 0x56, 0x99, 0x02, 0x4e,
- 0xae, 0xb7, 0x7b, 0x54, 0xd4, 0x77, 0x33, 0x6e, 0xc2, 0xa4, 0xf3,
- 0x32, 0xf2, 0xb3, 0xf8, 0x87, 0x65, 0xdd, 0xb0, 0xc3})),
- std::make_pair(
- 198,
- std::vector<uint8_t>(
- {0x29, 0xac, 0xc3, 0x0e, 0x96, 0x03, 0xae, 0x2f, 0xcc, 0xf9, 0x0b,
- 0xf9, 0x7e, 0x6c, 0xc4, 0x63, 0xeb, 0xe2, 0x8c, 0x1b, 0x2f, 0x9b,
- 0x4b, 0x76, 0x5e, 0x70, 0x53, 0x7c, 0x25, 0xc7, 0x02, 0xa2, 0x9d,
- 0xcb, 0xfb, 0xf1, 0x4c, 0x99, 0xc5, 0x43, 0x45, 0xba, 0x2b, 0x51,
- 0xf1, 0x7b, 0x77, 0xb5, 0xf1, 0x5d, 0xb9, 0x2b, 0xba, 0xd8, 0xfa,
- 0x95, 0xc4, 0x71, 0xf5, 0xd0, 0x70, 0xa1, 0x37, 0xcc})),
- std::make_pair(
- 199,
- std::vector<uint8_t>(
- {0x33, 0x79, 0xcb, 0xaa, 0xe5, 0x62, 0xa8, 0x7b, 0x4c, 0x04, 0x25,
- 0x55, 0x0f, 0xfd, 0xd6, 0xbf, 0xe1, 0x20, 0x3f, 0x0d, 0x66, 0x6c,
- 0xc7, 0xea, 0x09, 0x5b, 0xe4, 0x07, 0xa5, 0xdf, 0xe6, 0x1e, 0xe9,
- 0x14, 0x41, 0xcd, 0x51, 0x54, 0xb3, 0xe5, 0x3b, 0x4f, 0x5f, 0xb3,
- 0x1a, 0xd4, 0xc7, 0xa9, 0xad, 0x5c, 0x7a, 0xf4, 0xae, 0x67, 0x9a,
- 0xa5, 0x1a, 0x54, 0x00, 0x3a, 0x54, 0xca, 0x6b, 0x2d})),
- std::make_pair(
- 200,
- std::vector<uint8_t>(
- {0x30, 0x95, 0xa3, 0x49, 0xd2, 0x45, 0x70, 0x8c, 0x7c, 0xf5, 0x50,
- 0x11, 0x87, 0x03, 0xd7, 0x30, 0x2c, 0x27, 0xb6, 0x0a, 0xf5, 0xd4,
- 0xe6, 0x7f, 0xc9, 0x78, 0xf8, 0xa4, 0xe6, 0x09, 0x53, 0xc7, 0xa0,
- 0x4f, 0x92, 0xfc, 0xf4, 0x1a, 0xee, 0x64, 0x32, 0x1c, 0xcb, 0x70,
- 0x7a, 0x89, 0x58, 0x51, 0x55, 0x2b, 0x1e, 0x37, 0xb0, 0x0b, 0xc5,
- 0xe6, 0xb7, 0x2f, 0xa5, 0xbc, 0xef, 0x9e, 0x3f, 0xff})),
- std::make_pair(
- 201,
- std::vector<uint8_t>(
- {0x07, 0x26, 0x2d, 0x73, 0x8b, 0x09, 0x32, 0x1f, 0x4d, 0xbc, 0xce,
- 0xc4, 0xbb, 0x26, 0xf4, 0x8c, 0xb0, 0xf0, 0xed, 0x24, 0x6c, 0xe0,
- 0xb3, 0x1b, 0x9a, 0x6e, 0x7b, 0xc6, 0x83, 0x04, 0x9f, 0x1f, 0x3e,
- 0x55, 0x45, 0xf2, 0x8c, 0xe9, 0x32, 0xdd, 0x98, 0x5c, 0x5a, 0xb0,
- 0xf4, 0x3b, 0xd6, 0xde, 0x07, 0x70, 0x56, 0x0a, 0xf3, 0x29, 0x06,
- 0x5e, 0xd2, 0xe4, 0x9d, 0x34, 0x62, 0x4c, 0x2c, 0xbb})),
- std::make_pair(
- 202,
- std::vector<uint8_t>(
- {0xb6, 0x40, 0x5e, 0xca, 0x8e, 0xe3, 0x31, 0x6c, 0x87, 0x06, 0x1c,
- 0xc6, 0xec, 0x18, 0xdb, 0xa5, 0x3e, 0x6c, 0x25, 0x0c, 0x63, 0xba,
- 0x1f, 0x3b, 0xae, 0x9e, 0x55, 0xdd, 0x34, 0x98, 0x03, 0x6a, 0xf0,
- 0x8c, 0xd2, 0x72, 0xaa, 0x24, 0xd7, 0x13, 0xc6, 0x02, 0x0d, 0x77,
- 0xab, 0x2f, 0x39, 0x19, 0xaf, 0x1a, 0x32, 0xf3, 0x07, 0x42, 0x06,
- 0x18, 0xab, 0x97, 0xe7, 0x39, 0x53, 0x99, 0x4f, 0xb4})),
- std::make_pair(
- 203,
- std::vector<uint8_t>(
- {0x7e, 0xe6, 0x82, 0xf6, 0x31, 0x48, 0xee, 0x45, 0xf6, 0xe5, 0x31,
- 0x5d, 0xa8, 0x1e, 0x5c, 0x6e, 0x55, 0x7c, 0x2c, 0x34, 0x64, 0x1f,
- 0xc5, 0x09, 0xc7, 0xa5, 0x70, 0x10, 0x88, 0xc3, 0x8a, 0x74, 0x75,
- 0x61, 0x68, 0xe2, 0xcd, 0x8d, 0x35, 0x1e, 0x88, 0xfd, 0x1a, 0x45,
- 0x1f, 0x36, 0x0a, 0x01, 0xf5, 0xb2, 0x58, 0x0f, 0x9b, 0x5a, 0x2e,
- 0x8c, 0xfc, 0x13, 0x8f, 0x3d, 0xd5, 0x9a, 0x3f, 0xfc})),
- std::make_pair(
- 204,
- std::vector<uint8_t>(
- {0x1d, 0x26, 0x3c, 0x17, 0x9d, 0x6b, 0x26, 0x8f, 0x6f, 0xa0, 0x16,
- 0xf3, 0xa4, 0xf2, 0x9e, 0x94, 0x38, 0x91, 0x12, 0x5e, 0xd8, 0x59,
- 0x3c, 0x81, 0x25, 0x60, 0x59, 0xf5, 0xa7, 0xb4, 0x4a, 0xf2, 0xdc,
- 0xb2, 0x03, 0x0d, 0x17, 0x5c, 0x00, 0xe6, 0x2e, 0xca, 0xf7, 0xee,
- 0x96, 0x68, 0x2a, 0xa0, 0x7a, 0xb2, 0x0a, 0x61, 0x10, 0x24, 0xa2,
- 0x85, 0x32, 0xb1, 0xc2, 0x5b, 0x86, 0x65, 0x79, 0x02})),
- std::make_pair(
- 205,
- std::vector<uint8_t>(
- {0x10, 0x6d, 0x13, 0x2c, 0xbd, 0xb4, 0xcd, 0x25, 0x97, 0x81, 0x28,
- 0x46, 0xe2, 0xbc, 0x1b, 0xf7, 0x32, 0xfe, 0xc5, 0xf0, 0xa5, 0xf6,
- 0x5d, 0xbb, 0x39, 0xec, 0x4e, 0x6d, 0xc6, 0x4a, 0xb2, 0xce, 0x6d,
- 0x24, 0x63, 0x0d, 0x0f, 0x15, 0xa8, 0x05, 0xc3, 0x54, 0x00, 0x25,
- 0xd8, 0x4a, 0xfa, 0x98, 0xe3, 0x67, 0x03, 0xc3, 0xdb, 0xee, 0x71,
- 0x3e, 0x72, 0xdd, 0xe8, 0x46, 0x5b, 0xc1, 0xbe, 0x7e})),
- std::make_pair(
- 206,
- std::vector<uint8_t>(
- {0x0e, 0x79, 0x96, 0x82, 0x26, 0x65, 0x06, 0x67, 0xa8, 0xd8, 0x62,
- 0xea, 0x8d, 0xa4, 0x89, 0x1a, 0xf5, 0x6a, 0x4e, 0x3a, 0x8b, 0x6d,
- 0x17, 0x50, 0xe3, 0x94, 0xf0, 0xde, 0xa7, 0x6d, 0x64, 0x0d, 0x85,
- 0x07, 0x7b, 0xce, 0xc2, 0xcc, 0x86, 0x88, 0x6e, 0x50, 0x67, 0x51,
- 0xb4, 0xf6, 0xa5, 0x83, 0x8f, 0x7f, 0x0b, 0x5f, 0xef, 0x76, 0x5d,
- 0x9d, 0xc9, 0x0d, 0xcd, 0xcb, 0xaf, 0x07, 0x9f, 0x08})),
- std::make_pair(
- 207,
- std::vector<uint8_t>(
- {0x52, 0x11, 0x56, 0xa8, 0x2a, 0xb0, 0xc4, 0xe5, 0x66, 0xe5, 0x84,
- 0x4d, 0x5e, 0x31, 0xad, 0x9a, 0xaf, 0x14, 0x4b, 0xbd, 0x5a, 0x46,
- 0x4f, 0xdc, 0xa3, 0x4d, 0xbd, 0x57, 0x17, 0xe8, 0xff, 0x71, 0x1d,
- 0x3f, 0xfe, 0xbb, 0xfa, 0x08, 0x5d, 0x67, 0xfe, 0x99, 0x6a, 0x34,
- 0xf6, 0xd3, 0xe4, 0xe6, 0x0b, 0x13, 0x96, 0xbf, 0x4b, 0x16, 0x10,
- 0xc2, 0x63, 0xbd, 0xbb, 0x83, 0x4d, 0x56, 0x08, 0x16})),
- std::make_pair(
- 208,
- std::vector<uint8_t>(
- {0x1a, 0xba, 0x88, 0xbe, 0xfc, 0x55, 0xbc, 0x25, 0xef, 0xbc, 0xe0,
- 0x2d, 0xb8, 0xb9, 0x93, 0x3e, 0x46, 0xf5, 0x76, 0x61, 0xba, 0xea,
- 0xbe, 0xb2, 0x1c, 0xc2, 0x57, 0x4d, 0x2a, 0x51, 0x8a, 0x3c, 0xba,
- 0x5d, 0xc5, 0xa3, 0x8e, 0x49, 0x71, 0x34, 0x40, 0xb2, 0x5f, 0x9c,
- 0x74, 0x4e, 0x75, 0xf6, 0xb8, 0x5c, 0x9d, 0x8f, 0x46, 0x81, 0xf6,
- 0x76, 0x16, 0x0f, 0x61, 0x05, 0x35, 0x7b, 0x84, 0x06})),
- std::make_pair(
- 209,
- std::vector<uint8_t>(
- {0x5a, 0x99, 0x49, 0xfc, 0xb2, 0xc4, 0x73, 0xcd, 0xa9, 0x68, 0xac,
- 0x1b, 0x5d, 0x08, 0x56, 0x6d, 0xc2, 0xd8, 0x16, 0xd9, 0x60, 0xf5,
- 0x7e, 0x63, 0xb8, 0x98, 0xfa, 0x70, 0x1c, 0xf8, 0xeb, 0xd3, 0xf5,
- 0x9b, 0x12, 0x4d, 0x95, 0xbf, 0xbb, 0xed, 0xc5, 0xf1, 0xcf, 0x0e,
- 0x17, 0xd5, 0xea, 0xed, 0x0c, 0x02, 0xc5, 0x0b, 0x69, 0xd8, 0xa4,
- 0x02, 0xca, 0xbc, 0xca, 0x44, 0x33, 0xb5, 0x1f, 0xd4})),
- std::make_pair(
- 210,
- std::vector<uint8_t>(
- {0xb0, 0xce, 0xad, 0x09, 0x80, 0x7c, 0x67, 0x2a, 0xf2, 0xeb, 0x2b,
- 0x0f, 0x06, 0xdd, 0xe4, 0x6c, 0xf5, 0x37, 0x0e, 0x15, 0xa4, 0x09,
- 0x6b, 0x1a, 0x7d, 0x7c, 0xbb, 0x36, 0xec, 0x31, 0xc2, 0x05, 0xfb,
- 0xef, 0xca, 0x00, 0xb7, 0xa4, 0x16, 0x2f, 0xa8, 0x9f, 0xb4, 0xfb,
- 0x3e, 0xb7, 0x8d, 0x79, 0x77, 0x0c, 0x23, 0xf4, 0x4e, 0x72, 0x06,
- 0x66, 0x4c, 0xe3, 0xcd, 0x93, 0x1c, 0x29, 0x1e, 0x5d})),
- std::make_pair(
- 211,
- std::vector<uint8_t>(
- {0xbb, 0x66, 0x64, 0x93, 0x1e, 0xc9, 0x70, 0x44, 0xe4, 0x5b, 0x2a,
- 0xe4, 0x20, 0xae, 0x1c, 0x55, 0x1a, 0x88, 0x74, 0xbc, 0x93, 0x7d,
- 0x08, 0xe9, 0x69, 0x39, 0x9c, 0x39, 0x64, 0xeb, 0xdb, 0xa8, 0x34,
- 0x6c, 0xdd, 0x5d, 0x09, 0xca, 0xaf, 0xe4, 0xc2, 0x8b, 0xa7, 0xec,
- 0x78, 0x81, 0x91, 0xce, 0xca, 0x65, 0xdd, 0xd6, 0xf9, 0x5f, 0x18,
- 0x58, 0x3e, 0x04, 0x0d, 0x0f, 0x30, 0xd0, 0x36, 0x4d})),
- std::make_pair(
- 212,
- std::vector<uint8_t>(
- {0x65, 0xbc, 0x77, 0x0a, 0x5f, 0xaa, 0x37, 0x92, 0x36, 0x98, 0x03,
- 0x68, 0x3e, 0x84, 0x4b, 0x0b, 0xe7, 0xee, 0x96, 0xf2, 0x9f, 0x6d,
- 0x6a, 0x35, 0x56, 0x80, 0x06, 0xbd, 0x55, 0x90, 0xf9, 0xa4, 0xef,
- 0x63, 0x9b, 0x7a, 0x80, 0x61, 0xc7, 0xb0, 0x42, 0x4b, 0x66, 0xb6,
- 0x0a, 0xc3, 0x4a, 0xf3, 0x11, 0x99, 0x05, 0xf3, 0x3a, 0x9d, 0x8c,
- 0x3a, 0xe1, 0x83, 0x82, 0xca, 0x9b, 0x68, 0x99, 0x00})),
- std::make_pair(
- 213,
- std::vector<uint8_t>(
- {0xea, 0x9b, 0x4d, 0xca, 0x33, 0x33, 0x36, 0xaa, 0xf8, 0x39, 0xa4,
- 0x5c, 0x6e, 0xaa, 0x48, 0xb8, 0xcb, 0x4c, 0x7d, 0xda, 0xbf, 0xfe,
- 0xa4, 0xf6, 0x43, 0xd6, 0x35, 0x7e, 0xa6, 0x62, 0x8a, 0x48, 0x0a,
- 0x5b, 0x45, 0xf2, 0xb0, 0x52, 0xc1, 0xb0, 0x7d, 0x1f, 0xed, 0xca,
- 0x91, 0x8b, 0x6f, 0x11, 0x39, 0xd8, 0x0f, 0x74, 0xc2, 0x45, 0x10,
- 0xdc, 0xba, 0xa4, 0xbe, 0x70, 0xea, 0xcc, 0x1b, 0x06})),
- std::make_pair(
- 214,
- std::vector<uint8_t>(
- {0xe6, 0x34, 0x2f, 0xb4, 0xa7, 0x80, 0xad, 0x97, 0x5d, 0x0e, 0x24,
- 0xbc, 0xe1, 0x49, 0x98, 0x9b, 0x91, 0xd3, 0x60, 0x55, 0x7e, 0x87,
- 0x99, 0x4f, 0x6b, 0x45, 0x7b, 0x89, 0x55, 0x75, 0xcc, 0x02, 0xd0,
- 0xc1, 0x5b, 0xad, 0x3c, 0xe7, 0x57, 0x7f, 0x4c, 0x63, 0x92, 0x7f,
- 0xf1, 0x3f, 0x3e, 0x38, 0x1f, 0xf7, 0xe7, 0x2b, 0xdb, 0xe7, 0x45,
- 0x32, 0x48, 0x44, 0xa9, 0xd2, 0x7e, 0x3f, 0x1c, 0x01})),
- std::make_pair(
- 215,
- std::vector<uint8_t>(
- {0x3e, 0x20, 0x9c, 0x9b, 0x33, 0xe8, 0xe4, 0x61, 0x17, 0x8a, 0xb4,
- 0x6b, 0x1c, 0x64, 0xb4, 0x9a, 0x07, 0xfb, 0x74, 0x5f, 0x1c, 0x8b,
- 0xc9, 0x5f, 0xbf, 0xb9, 0x4c, 0x6b, 0x87, 0xc6, 0x95, 0x16, 0x65,
- 0x1b, 0x26, 0x4e, 0xf9, 0x80, 0x93, 0x7f, 0xad, 0x41, 0x23, 0x8b,
- 0x91, 0xdd, 0xc0, 0x11, 0xa5, 0xdd, 0x77, 0x7c, 0x7e, 0xfd, 0x44,
- 0x94, 0xb4, 0xb6, 0xec, 0xd3, 0xa9, 0xc2, 0x2a, 0xc0})),
- std::make_pair(
- 216,
- std::vector<uint8_t>(
- {0xfd, 0x6a, 0x3d, 0x5b, 0x18, 0x75, 0xd8, 0x04, 0x86, 0xd6, 0xe6,
- 0x96, 0x94, 0xa5, 0x6d, 0xbb, 0x04, 0xa9, 0x9a, 0x4d, 0x05, 0x1f,
- 0x15, 0xdb, 0x26, 0x89, 0x77, 0x6b, 0xa1, 0xc4, 0x88, 0x2e, 0x6d,
- 0x46, 0x2a, 0x60, 0x3b, 0x70, 0x15, 0xdc, 0x9f, 0x4b, 0x74, 0x50,
- 0xf0, 0x53, 0x94, 0x30, 0x3b, 0x86, 0x52, 0xcf, 0xb4, 0x04, 0xa2,
- 0x66, 0x96, 0x2c, 0x41, 0xba, 0xe6, 0xe1, 0x8a, 0x94})),
- std::make_pair(
- 217,
- std::vector<uint8_t>(
- {0x95, 0x1e, 0x27, 0x51, 0x7e, 0x6b, 0xad, 0x9e, 0x41, 0x95, 0xfc,
- 0x86, 0x71, 0xde, 0xe3, 0xe7, 0xe9, 0xbe, 0x69, 0xce, 0xe1, 0x42,
- 0x2c, 0xb9, 0xfe, 0xcf, 0xce, 0x0d, 0xba, 0x87, 0x5f, 0x7b, 0x31,
- 0x0b, 0x93, 0xee, 0x3a, 0x3d, 0x55, 0x8f, 0x94, 0x1f, 0x63, 0x5f,
- 0x66, 0x8f, 0xf8, 0x32, 0xd2, 0xc1, 0xd0, 0x33, 0xc5, 0xe2, 0xf0,
- 0x99, 0x7e, 0x4c, 0x66, 0xf1, 0x47, 0x34, 0x4e, 0x02})),
- std::make_pair(
- 218,
- std::vector<uint8_t>(
- {0x8e, 0xba, 0x2f, 0x87, 0x4f, 0x1a, 0xe8, 0x40, 0x41, 0x90, 0x3c,
- 0x7c, 0x42, 0x53, 0xc8, 0x22, 0x92, 0x53, 0x0f, 0xc8, 0x50, 0x95,
- 0x50, 0xbf, 0xdc, 0x34, 0xc9, 0x5c, 0x7e, 0x28, 0x89, 0xd5, 0x65,
- 0x0b, 0x0a, 0xd8, 0xcb, 0x98, 0x8e, 0x5c, 0x48, 0x94, 0xcb, 0x87,
- 0xfb, 0xfb, 0xb1, 0x96, 0x12, 0xea, 0x93, 0xcc, 0xc4, 0xc5, 0xca,
- 0xd1, 0x71, 0x58, 0xb9, 0x76, 0x34, 0x64, 0xb4, 0x92})),
- std::make_pair(
- 219,
- std::vector<uint8_t>(
- {0x16, 0xf7, 0x12, 0xea, 0xa1, 0xb7, 0xc6, 0x35, 0x47, 0x19, 0xa8,
- 0xe7, 0xdb, 0xdf, 0xaf, 0x55, 0xe4, 0x06, 0x3a, 0x4d, 0x27, 0x7d,
- 0x94, 0x75, 0x50, 0x01, 0x9b, 0x38, 0xdf, 0xb5, 0x64, 0x83, 0x09,
- 0x11, 0x05, 0x7d, 0x50, 0x50, 0x61, 0x36, 0xe2, 0x39, 0x4c, 0x3b,
- 0x28, 0x94, 0x5c, 0xc9, 0x64, 0x96, 0x7d, 0x54, 0xe3, 0x00, 0x0c,
- 0x21, 0x81, 0x62, 0x6c, 0xfb, 0x9b, 0x73, 0xef, 0xd2})),
- std::make_pair(
- 220,
- std::vector<uint8_t>(
- {0xc3, 0x96, 0x39, 0xe7, 0xd5, 0xc7, 0xfb, 0x8c, 0xdd, 0x0f, 0xd3,
- 0xe6, 0xa5, 0x20, 0x96, 0x03, 0x94, 0x37, 0x12, 0x2f, 0x21, 0xc7,
- 0x8f, 0x16, 0x79, 0xce, 0xa9, 0xd7, 0x8a, 0x73, 0x4c, 0x56, 0xec,
- 0xbe, 0xb2, 0x86, 0x54, 0xb4, 0xf1, 0x8e, 0x34, 0x2c, 0x33, 0x1f,
- 0x6f, 0x72, 0x29, 0xec, 0x4b, 0x4b, 0xc2, 0x81, 0xb2, 0xd8, 0x0a,
- 0x6e, 0xb5, 0x00, 0x43, 0xf3, 0x17, 0x96, 0xc8, 0x8c})),
- std::make_pair(
- 221,
- std::vector<uint8_t>(
- {0x72, 0xd0, 0x81, 0xaf, 0x99, 0xf8, 0xa1, 0x73, 0xdc, 0xc9, 0xa0,
- 0xac, 0x4e, 0xb3, 0x55, 0x74, 0x05, 0x63, 0x9a, 0x29, 0x08, 0x4b,
- 0x54, 0xa4, 0x01, 0x72, 0x91, 0x2a, 0x2f, 0x8a, 0x39, 0x51, 0x29,
- 0xd5, 0x53, 0x6f, 0x09, 0x18, 0xe9, 0x02, 0xf9, 0xe8, 0xfa, 0x60,
- 0x00, 0x99, 0x5f, 0x41, 0x68, 0xdd, 0xc5, 0xf8, 0x93, 0x01, 0x1b,
- 0xe6, 0xa0, 0xdb, 0xc9, 0xb8, 0xa1, 0xa3, 0xf5, 0xbb})),
- std::make_pair(
- 222,
- std::vector<uint8_t>(
- {0xc1, 0x1a, 0xa8, 0x1e, 0x5e, 0xfd, 0x24, 0xd5, 0xfc, 0x27, 0xee,
- 0x58, 0x6c, 0xfd, 0x88, 0x47, 0xfb, 0xb0, 0xe2, 0x76, 0x01, 0xcc,
- 0xec, 0xe5, 0xec, 0xca, 0x01, 0x98, 0xe3, 0xc7, 0x76, 0x53, 0x93,
- 0xbb, 0x74, 0x45, 0x7c, 0x7e, 0x7a, 0x27, 0xeb, 0x91, 0x70, 0x35,
- 0x0e, 0x1f, 0xb5, 0x38, 0x57, 0x17, 0x75, 0x06, 0xbe, 0x3e, 0x76,
- 0x2c, 0xc0, 0xf1, 0x4d, 0x8c, 0x3a, 0xfe, 0x90, 0x77})),
- std::make_pair(
- 223,
- std::vector<uint8_t>(
- {0xc2, 0x8f, 0x21, 0x50, 0xb4, 0x52, 0xe6, 0xc0, 0xc4, 0x24, 0xbc,
- 0xde, 0x6f, 0x8d, 0x72, 0x00, 0x7f, 0x93, 0x10, 0xfe, 0xd7, 0xf2,
- 0xf8, 0x7d, 0xe0, 0xdb, 0xb6, 0x4f, 0x44, 0x79, 0xd6, 0xc1, 0x44,
- 0x1b, 0xa6, 0x6f, 0x44, 0xb2, 0xac, 0xce, 0xe6, 0x16, 0x09, 0x17,
- 0x7e, 0xd3, 0x40, 0x12, 0x8b, 0x40, 0x7e, 0xce, 0xc7, 0xc6, 0x4b,
- 0xbe, 0x50, 0xd6, 0x3d, 0x22, 0xd8, 0x62, 0x77, 0x27})),
- std::make_pair(
- 224,
- std::vector<uint8_t>(
- {0xf6, 0x3d, 0x88, 0x12, 0x28, 0x77, 0xec, 0x30, 0xb8, 0xc8, 0xb0,
- 0x0d, 0x22, 0xe8, 0x90, 0x00, 0xa9, 0x66, 0x42, 0x61, 0x12, 0xbd,
- 0x44, 0x16, 0x6e, 0x2f, 0x52, 0x5b, 0x76, 0x9c, 0xcb, 0xe9, 0xb2,
- 0x86, 0xd4, 0x37, 0xa0, 0x12, 0x91, 0x30, 0xdd, 0xe1, 0xa8, 0x6c,
- 0x43, 0xe0, 0x4b, 0xed, 0xb5, 0x94, 0xe6, 0x71, 0xd9, 0x82, 0x83,
- 0xaf, 0xe6, 0x4c, 0xe3, 0x31, 0xde, 0x98, 0x28, 0xfd})),
- std::make_pair(
- 225,
- std::vector<uint8_t>(
- {0x34, 0x8b, 0x05, 0x32, 0x88, 0x0b, 0x88, 0xa6, 0x61, 0x4a, 0x8d,
- 0x74, 0x08, 0xc3, 0xf9, 0x13, 0x35, 0x7f, 0xbb, 0x60, 0xe9, 0x95,
- 0xc6, 0x02, 0x05, 0xbe, 0x91, 0x39, 0xe7, 0x49, 0x98, 0xae, 0xde,
- 0x7f, 0x45, 0x81, 0xe4, 0x2f, 0x6b, 0x52, 0x69, 0x8f, 0x7f, 0xa1,
- 0x21, 0x97, 0x08, 0xc1, 0x44, 0x98, 0x06, 0x7f, 0xd1, 0xe0, 0x95,
- 0x02, 0xde, 0x83, 0xa7, 0x7d, 0xd2, 0x81, 0x15, 0x0c})),
- std::make_pair(
- 226,
- std::vector<uint8_t>(
- {0x51, 0x33, 0xdc, 0x8b, 0xef, 0x72, 0x53, 0x59, 0xdf, 0xf5, 0x97,
- 0x92, 0xd8, 0x5e, 0xaf, 0x75, 0xb7, 0xe1, 0xdc, 0xd1, 0x97, 0x8b,
- 0x01, 0xc3, 0x5b, 0x1b, 0x85, 0xfc, 0xeb, 0xc6, 0x33, 0x88, 0xad,
- 0x99, 0xa1, 0x7b, 0x63, 0x46, 0xa2, 0x17, 0xdc, 0x1a, 0x96, 0x22,
- 0xeb, 0xd1, 0x22, 0xec, 0xf6, 0x91, 0x3c, 0x4d, 0x31, 0xa6, 0xb5,
- 0x2a, 0x69, 0x5b, 0x86, 0xaf, 0x00, 0xd7, 0x41, 0xa0})),
- std::make_pair(
- 227,
- std::vector<uint8_t>(
- {0x27, 0x53, 0xc4, 0xc0, 0xe9, 0x8e, 0xca, 0xd8, 0x06, 0xe8, 0x87,
- 0x80, 0xec, 0x27, 0xfc, 0xcd, 0x0f, 0x5c, 0x1a, 0xb5, 0x47, 0xf9,
- 0xe4, 0xbf, 0x16, 0x59, 0xd1, 0x92, 0xc2, 0x3a, 0xa2, 0xcc, 0x97,
- 0x1b, 0x58, 0xb6, 0x80, 0x25, 0x80, 0xba, 0xef, 0x8a, 0xdc, 0x3b,
- 0x77, 0x6e, 0xf7, 0x08, 0x6b, 0x25, 0x45, 0xc2, 0x98, 0x7f, 0x34,
- 0x8e, 0xe3, 0x71, 0x9c, 0xde, 0xf2, 0x58, 0xc4, 0x03})),
- std::make_pair(
- 228,
- std::vector<uint8_t>(
- {0xb1, 0x66, 0x35, 0x73, 0xce, 0x4b, 0x9d, 0x8c, 0xae, 0xfc, 0x86,
- 0x50, 0x12, 0xf3, 0xe3, 0x97, 0x14, 0xb9, 0x89, 0x8a, 0x5d, 0xa6,
- 0xce, 0x17, 0xc2, 0x5a, 0x6a, 0x47, 0x93, 0x1a, 0x9d, 0xdb, 0x9b,
- 0xbe, 0x98, 0xad, 0xaa, 0x55, 0x3b, 0xee, 0xd4, 0x36, 0xe8, 0x95,
- 0x78, 0x45, 0x54, 0x16, 0xc2, 0xa5, 0x2a, 0x52, 0x5c, 0xf2, 0x86,
- 0x2b, 0x8d, 0x1d, 0x49, 0xa2, 0x53, 0x1b, 0x73, 0x91})),
- std::make_pair(
- 229,
- std::vector<uint8_t>(
- {0x64, 0xf5, 0x8b, 0xd6, 0xbf, 0xc8, 0x56, 0xf5, 0xe8, 0x73, 0xb2,
- 0xa2, 0x95, 0x6e, 0xa0, 0xed, 0xa0, 0xd6, 0xdb, 0x0d, 0xa3, 0x9c,
- 0x8c, 0x7f, 0xc6, 0x7c, 0x9f, 0x9f, 0xee, 0xfc, 0xff, 0x30, 0x72,
- 0xcd, 0xf9, 0xe6, 0xea, 0x37, 0xf6, 0x9a, 0x44, 0xf0, 0xc6, 0x1a,
- 0xa0, 0xda, 0x36, 0x93, 0xc2, 0xdb, 0x5b, 0x54, 0x96, 0x0c, 0x02,
- 0x81, 0xa0, 0x88, 0x15, 0x1d, 0xb4, 0x2b, 0x11, 0xe8})),
- std::make_pair(
- 230,
- std::vector<uint8_t>(
- {0x07, 0x64, 0xc7, 0xbe, 0x28, 0x12, 0x5d, 0x90, 0x65, 0xc4, 0xb9,
- 0x8a, 0x69, 0xd6, 0x0a, 0xed, 0xe7, 0x03, 0x54, 0x7c, 0x66, 0xa1,
- 0x2e, 0x17, 0xe1, 0xc6, 0x18, 0x99, 0x41, 0x32, 0xf5, 0xef, 0x82,
- 0x48, 0x2c, 0x1e, 0x3f, 0xe3, 0x14, 0x6c, 0xc6, 0x53, 0x76, 0xcc,
- 0x10, 0x9f, 0x01, 0x38, 0xed, 0x9a, 0x80, 0xe4, 0x9f, 0x1f, 0x3c,
- 0x7d, 0x61, 0x0d, 0x2f, 0x24, 0x32, 0xf2, 0x06, 0x05})),
- std::make_pair(
- 231,
- std::vector<uint8_t>(
- {0xf7, 0x48, 0x78, 0x43, 0x98, 0xa2, 0xff, 0x03, 0xeb, 0xeb, 0x07,
- 0xe1, 0x55, 0xe6, 0x61, 0x16, 0xa8, 0x39, 0x74, 0x1a, 0x33, 0x6e,
- 0x32, 0xda, 0x71, 0xec, 0x69, 0x60, 0x01, 0xf0, 0xad, 0x1b, 0x25,
- 0xcd, 0x48, 0xc6, 0x9c, 0xfc, 0xa7, 0x26, 0x5e, 0xca, 0x1d, 0xd7,
- 0x19, 0x04, 0xa0, 0xce, 0x74, 0x8a, 0xc4, 0x12, 0x4f, 0x35, 0x71,
- 0x07, 0x6d, 0xfa, 0x71, 0x16, 0xa9, 0xcf, 0x00, 0xe9})),
- std::make_pair(
- 232,
- std::vector<uint8_t>(
- {0x3f, 0x0d, 0xbc, 0x01, 0x86, 0xbc, 0xeb, 0x6b, 0x78, 0x5b, 0xa7,
- 0x8d, 0x2a, 0x2a, 0x01, 0x3c, 0x91, 0x0b, 0xe1, 0x57, 0xbd, 0xaf,
- 0xfa, 0xe8, 0x1b, 0xb6, 0x66, 0x3b, 0x1a, 0x73, 0x72, 0x2f, 0x7f,
- 0x12, 0x28, 0x79, 0x5f, 0x3e, 0xca, 0xda, 0x87, 0xcf, 0x6e, 0xf0,
- 0x07, 0x84, 0x74, 0xaf, 0x73, 0xf3, 0x1e, 0xca, 0x0c, 0xc2, 0x00,
- 0xed, 0x97, 0x5b, 0x68, 0x93, 0xf7, 0x61, 0xcb, 0x6d})),
- std::make_pair(
- 233,
- std::vector<uint8_t>(
- {0xd4, 0x76, 0x2c, 0xd4, 0x59, 0x98, 0x76, 0xca, 0x75, 0xb2, 0xb8,
- 0xfe, 0x24, 0x99, 0x44, 0xdb, 0xd2, 0x7a, 0xce, 0x74, 0x1f, 0xda,
- 0xb9, 0x36, 0x16, 0xcb, 0xc6, 0xe4, 0x25, 0x46, 0x0f, 0xeb, 0x51,
- 0xd4, 0xe7, 0xad, 0xcc, 0x38, 0x18, 0x0e, 0x7f, 0xc4, 0x7c, 0x89,
- 0x02, 0x4a, 0x7f, 0x56, 0x19, 0x1a, 0xdb, 0x87, 0x8d, 0xfd, 0xe4,
- 0xea, 0xd6, 0x22, 0x23, 0xf5, 0xa2, 0x61, 0x0e, 0xfe})),
- std::make_pair(
- 234,
- std::vector<uint8_t>(
- {0xcd, 0x36, 0xb3, 0xd5, 0xb4, 0xc9, 0x1b, 0x90, 0xfc, 0xbb, 0xa7,
- 0x95, 0x13, 0xcf, 0xee, 0x19, 0x07, 0xd8, 0x64, 0x5a, 0x16, 0x2a,
- 0xfd, 0x0c, 0xd4, 0xcf, 0x41, 0x92, 0xd4, 0xa5, 0xf4, 0xc8, 0x92,
- 0x18, 0x3a, 0x8e, 0xac, 0xdb, 0x2b, 0x6b, 0x6a, 0x9d, 0x9a, 0xa8,
- 0xc1, 0x1a, 0xc1, 0xb2, 0x61, 0xb3, 0x80, 0xdb, 0xee, 0x24, 0xca,
- 0x46, 0x8f, 0x1b, 0xfd, 0x04, 0x3c, 0x58, 0xee, 0xfe})),
- std::make_pair(
- 235,
- std::vector<uint8_t>(
- {0x98, 0x59, 0x34, 0x52, 0x28, 0x16, 0x61, 0xa5, 0x3c, 0x48, 0xa9,
- 0xd8, 0xcd, 0x79, 0x08, 0x26, 0xc1, 0xa1, 0xce, 0x56, 0x77, 0x38,
- 0x05, 0x3d, 0x0b, 0xee, 0x4a, 0x91, 0xa3, 0xd5, 0xbd, 0x92, 0xee,
- 0xfd, 0xba, 0xbe, 0xbe, 0x32, 0x04, 0xf2, 0x03, 0x1c, 0xa5, 0xf7,
- 0x81, 0xbd, 0xa9, 0x9e, 0xf5, 0xd8, 0xae, 0x56, 0xe5, 0xb0, 0x4a,
- 0x9e, 0x1e, 0xcd, 0x21, 0xb0, 0xeb, 0x05, 0xd3, 0xe1})),
- std::make_pair(
- 236,
- std::vector<uint8_t>(
- {0x77, 0x1f, 0x57, 0xdd, 0x27, 0x75, 0xcc, 0xda, 0xb5, 0x59, 0x21,
- 0xd3, 0xe8, 0xe3, 0x0c, 0xcf, 0x48, 0x4d, 0x61, 0xfe, 0x1c, 0x1b,
- 0x9c, 0x2a, 0xe8, 0x19, 0xd0, 0xfb, 0x2a, 0x12, 0xfa, 0xb9, 0xbe,
- 0x70, 0xc4, 0xa7, 0xa1, 0x38, 0xda, 0x84, 0xe8, 0x28, 0x04, 0x35,
- 0xda, 0xad, 0xe5, 0xbb, 0xe6, 0x6a, 0xf0, 0x83, 0x6a, 0x15, 0x4f,
- 0x81, 0x7f, 0xb1, 0x7f, 0x33, 0x97, 0xe7, 0x25, 0xa3})),
- std::make_pair(
- 237,
- std::vector<uint8_t>(
- {0xc6, 0x08, 0x97, 0xc6, 0xf8, 0x28, 0xe2, 0x1f, 0x16, 0xfb, 0xb5,
- 0xf1, 0x5b, 0x32, 0x3f, 0x87, 0xb6, 0xc8, 0x95, 0x5e, 0xab, 0xf1,
- 0xd3, 0x80, 0x61, 0xf7, 0x07, 0xf6, 0x08, 0xab, 0xdd, 0x99, 0x3f,
- 0xac, 0x30, 0x70, 0x63, 0x3e, 0x28, 0x6c, 0xf8, 0x33, 0x9c, 0xe2,
- 0x95, 0xdd, 0x35, 0x2d, 0xf4, 0xb4, 0xb4, 0x0b, 0x2f, 0x29, 0xda,
- 0x1d, 0xd5, 0x0b, 0x3a, 0x05, 0xd0, 0x79, 0xe6, 0xbb})),
- std::make_pair(
- 238,
- std::vector<uint8_t>(
- {0x82, 0x10, 0xcd, 0x2c, 0x2d, 0x3b, 0x13, 0x5c, 0x2c, 0xf0, 0x7f,
- 0xa0, 0xd1, 0x43, 0x3c, 0xd7, 0x71, 0xf3, 0x25, 0xd0, 0x75, 0xc6,
- 0x46, 0x9d, 0x9c, 0x7f, 0x1b, 0xa0, 0x94, 0x3c, 0xd4, 0xab, 0x09,
- 0x80, 0x8c, 0xab, 0xf4, 0xac, 0xb9, 0xce, 0x5b, 0xb8, 0x8b, 0x49,
- 0x89, 0x29, 0xb4, 0xb8, 0x47, 0xf6, 0x81, 0xad, 0x2c, 0x49, 0x0d,
- 0x04, 0x2d, 0xb2, 0xae, 0xc9, 0x42, 0x14, 0xb0, 0x6b})),
- std::make_pair(
- 239,
- std::vector<uint8_t>(
- {0x1d, 0x4e, 0xdf, 0xff, 0xd8, 0xfd, 0x80, 0xf7, 0xe4, 0x10, 0x78,
- 0x40, 0xfa, 0x3a, 0xa3, 0x1e, 0x32, 0x59, 0x84, 0x91, 0xe4, 0xaf,
- 0x70, 0x13, 0xc1, 0x97, 0xa6, 0x5b, 0x7f, 0x36, 0xdd, 0x3a, 0xc4,
- 0xb4, 0x78, 0x45, 0x61, 0x11, 0xcd, 0x43, 0x09, 0xd9, 0x24, 0x35,
- 0x10, 0x78, 0x2f, 0xa3, 0x1b, 0x7c, 0x4c, 0x95, 0xfa, 0x95, 0x15,
- 0x20, 0xd0, 0x20, 0xeb, 0x7e, 0x5c, 0x36, 0xe4, 0xef})),
- std::make_pair(
- 240,
- std::vector<uint8_t>(
- {0xaf, 0x8e, 0x6e, 0x91, 0xfa, 0xb4, 0x6c, 0xe4, 0x87, 0x3e, 0x1a,
- 0x50, 0xa8, 0xef, 0x44, 0x8c, 0xc2, 0x91, 0x21, 0xf7, 0xf7, 0x4d,
- 0xee, 0xf3, 0x4a, 0x71, 0xef, 0x89, 0xcc, 0x00, 0xd9, 0x27, 0x4b,
- 0xc6, 0xc2, 0x45, 0x4b, 0xbb, 0x32, 0x30, 0xd8, 0xb2, 0xec, 0x94,
- 0xc6, 0x2b, 0x1d, 0xec, 0x85, 0xf3, 0x59, 0x3b, 0xfa, 0x30, 0xea,
- 0x6f, 0x7a, 0x44, 0xd7, 0xc0, 0x94, 0x65, 0xa2, 0x53})),
- std::make_pair(
- 241,
- std::vector<uint8_t>(
- {0x29, 0xfd, 0x38, 0x4e, 0xd4, 0x90, 0x6f, 0x2d, 0x13, 0xaa, 0x9f,
- 0xe7, 0xaf, 0x90, 0x59, 0x90, 0x93, 0x8b, 0xed, 0x80, 0x7f, 0x18,
- 0x32, 0x45, 0x4a, 0x37, 0x2a, 0xb4, 0x12, 0xee, 0xa1, 0xf5, 0x62,
- 0x5a, 0x1f, 0xcc, 0x9a, 0xc8, 0x34, 0x3b, 0x7c, 0x67, 0xc5, 0xab,
- 0xa6, 0xe0, 0xb1, 0xcc, 0x46, 0x44, 0x65, 0x49, 0x13, 0x69, 0x2c,
- 0x6b, 0x39, 0xeb, 0x91, 0x87, 0xce, 0xac, 0xd3, 0xec})),
- std::make_pair(
- 242,
- std::vector<uint8_t>(
- {0xa2, 0x68, 0xc7, 0x88, 0x5d, 0x98, 0x74, 0xa5, 0x1c, 0x44, 0xdf,
- 0xfe, 0xd8, 0xea, 0x53, 0xe9, 0x4f, 0x78, 0x45, 0x6e, 0x0b, 0x2e,
- 0xd9, 0x9f, 0xf5, 0xa3, 0x92, 0x47, 0x60, 0x81, 0x38, 0x26, 0xd9,
- 0x60, 0xa1, 0x5e, 0xdb, 0xed, 0xbb, 0x5d, 0xe5, 0x22, 0x6b, 0xa4,
- 0xb0, 0x74, 0xe7, 0x1b, 0x05, 0xc5, 0x5b, 0x97, 0x56, 0xbb, 0x79,
- 0xe5, 0x5c, 0x02, 0x75, 0x4c, 0x2c, 0x7b, 0x6c, 0x8a})),
- std::make_pair(
- 243,
- std::vector<uint8_t>(
- {0x0c, 0xf8, 0x54, 0x54, 0x88, 0xd5, 0x6a, 0x86, 0x81, 0x7c, 0xd7,
- 0xec, 0xb1, 0x0f, 0x71, 0x16, 0xb7, 0xea, 0x53, 0x0a, 0x45, 0xb6,
- 0xea, 0x49, 0x7b, 0x6c, 0x72, 0xc9, 0x97, 0xe0, 0x9e, 0x3d, 0x0d,
- 0xa8, 0x69, 0x8f, 0x46, 0xbb, 0x00, 0x6f, 0xc9, 0x77, 0xc2, 0xcd,
- 0x3d, 0x11, 0x77, 0x46, 0x3a, 0xc9, 0x05, 0x7f, 0xdd, 0x16, 0x62,
- 0xc8, 0x5d, 0x0c, 0x12, 0x64, 0x43, 0xc1, 0x04, 0x73})),
- std::make_pair(
- 244,
- std::vector<uint8_t>(
- {0xb3, 0x96, 0x14, 0x26, 0x8f, 0xdd, 0x87, 0x81, 0x51, 0x5e, 0x2c,
- 0xfe, 0xbf, 0x89, 0xb4, 0xd5, 0x40, 0x2b, 0xab, 0x10, 0xc2, 0x26,
- 0xe6, 0x34, 0x4e, 0x6b, 0x9a, 0xe0, 0x00, 0xfb, 0x0d, 0x6c, 0x79,
- 0xcb, 0x2f, 0x3e, 0xc8, 0x0e, 0x80, 0xea, 0xeb, 0x19, 0x80, 0xd2,
- 0xf8, 0x69, 0x89, 0x16, 0xbd, 0x2e, 0x9f, 0x74, 0x72, 0x36, 0x65,
- 0x51, 0x16, 0x64, 0x9c, 0xd3, 0xca, 0x23, 0xa8, 0x37})),
- std::make_pair(
- 245,
- std::vector<uint8_t>(
- {0x74, 0xbe, 0xf0, 0x92, 0xfc, 0x6f, 0x1e, 0x5d, 0xba, 0x36, 0x63,
- 0xa3, 0xfb, 0x00, 0x3b, 0x2a, 0x5b, 0xa2, 0x57, 0x49, 0x65, 0x36,
- 0xd9, 0x9f, 0x62, 0xb9, 0xd7, 0x3f, 0x8f, 0x9e, 0xb3, 0xce, 0x9f,
- 0xf3, 0xee, 0xc7, 0x09, 0xeb, 0x88, 0x36, 0x55, 0xec, 0x9e, 0xb8,
- 0x96, 0xb9, 0x12, 0x8f, 0x2a, 0xfc, 0x89, 0xcf, 0x7d, 0x1a, 0xb5,
- 0x8a, 0x72, 0xf4, 0xa3, 0xbf, 0x03, 0x4d, 0x2b, 0x4a})),
- std::make_pair(
- 246,
- std::vector<uint8_t>(
- {0x3a, 0x98, 0x8d, 0x38, 0xd7, 0x56, 0x11, 0xf3, 0xef, 0x38, 0xb8,
- 0x77, 0x49, 0x80, 0xb3, 0x3e, 0x57, 0x3b, 0x6c, 0x57, 0xbe, 0xe0,
- 0x46, 0x9b, 0xa5, 0xee, 0xd9, 0xb4, 0x4f, 0x29, 0x94, 0x5e, 0x73,
- 0x47, 0x96, 0x7f, 0xba, 0x2c, 0x16, 0x2e, 0x1c, 0x3b, 0xe7, 0xf3,
- 0x10, 0xf2, 0xf7, 0x5e, 0xe2, 0x38, 0x1e, 0x7b, 0xfd, 0x6b, 0x3f,
- 0x0b, 0xae, 0xa8, 0xd9, 0x5d, 0xfb, 0x1d, 0xaf, 0xb1})),
- std::make_pair(
- 247,
- std::vector<uint8_t>(
- {0x58, 0xae, 0xdf, 0xce, 0x6f, 0x67, 0xdd, 0xc8, 0x5a, 0x28, 0xc9,
- 0x92, 0xf1, 0xc0, 0xbd, 0x09, 0x69, 0xf0, 0x41, 0xe6, 0x6f, 0x1e,
- 0xe8, 0x80, 0x20, 0xa1, 0x25, 0xcb, 0xfc, 0xfe, 0xbc, 0xd6, 0x17,
- 0x09, 0xc9, 0xc4, 0xeb, 0xa1, 0x92, 0xc1, 0x5e, 0x69, 0xf0, 0x20,
- 0xd4, 0x62, 0x48, 0x60, 0x19, 0xfa, 0x8d, 0xea, 0x0c, 0xd7, 0xa4,
- 0x29, 0x21, 0xa1, 0x9d, 0x2f, 0xe5, 0x46, 0xd4, 0x3d})),
- std::make_pair(
- 248,
- std::vector<uint8_t>(
- {0x93, 0x47, 0xbd, 0x29, 0x14, 0x73, 0xe6, 0xb4, 0xe3, 0x68, 0x43,
- 0x7b, 0x8e, 0x56, 0x1e, 0x06, 0x5f, 0x64, 0x9a, 0x6d, 0x8a, 0xda,
- 0x47, 0x9a, 0xd0, 0x9b, 0x19, 0x99, 0xa8, 0xf2, 0x6b, 0x91, 0xcf,
- 0x61, 0x20, 0xfd, 0x3b, 0xfe, 0x01, 0x4e, 0x83, 0xf2, 0x3a, 0xcf,
- 0xa4, 0xc0, 0xad, 0x7b, 0x37, 0x12, 0xb2, 0xc3, 0xc0, 0x73, 0x32,
- 0x70, 0x66, 0x31, 0x12, 0xcc, 0xd9, 0x28, 0x5c, 0xd9})),
- std::make_pair(
- 249,
- std::vector<uint8_t>(
- {0xb3, 0x21, 0x63, 0xe7, 0xc5, 0xdb, 0xb5, 0xf5, 0x1f, 0xdc, 0x11,
- 0xd2, 0xea, 0xc8, 0x75, 0xef, 0xbb, 0xcb, 0x7e, 0x76, 0x99, 0x09,
- 0x0a, 0x7e, 0x7f, 0xf8, 0xa8, 0xd5, 0x07, 0x95, 0xaf, 0x5d, 0x74,
- 0xd9, 0xff, 0x98, 0x54, 0x3e, 0xf8, 0xcd, 0xf8, 0x9a, 0xc1, 0x3d,
- 0x04, 0x85, 0x27, 0x87, 0x56, 0xe0, 0xef, 0x00, 0xc8, 0x17, 0x74,
- 0x56, 0x61, 0xe1, 0xd5, 0x9f, 0xe3, 0x8e, 0x75, 0x37})),
- std::make_pair(
- 250,
- std::vector<uint8_t>(
- {0x10, 0x85, 0xd7, 0x83, 0x07, 0xb1, 0xc4, 0xb0, 0x08, 0xc5, 0x7a,
- 0x2e, 0x7e, 0x5b, 0x23, 0x46, 0x58, 0xa0, 0xa8, 0x2e, 0x4f, 0xf1,
- 0xe4, 0xaa, 0xac, 0x72, 0xb3, 0x12, 0xfd, 0xa0, 0xfe, 0x27, 0xd2,
- 0x33, 0xbc, 0x5b, 0x10, 0xe9, 0xcc, 0x17, 0xfd, 0xc7, 0x69, 0x7b,
- 0x54, 0x0c, 0x7d, 0x95, 0xeb, 0x21, 0x5a, 0x19, 0xa1, 0xa0, 0xe2,
- 0x0e, 0x1a, 0xbf, 0xa1, 0x26, 0xef, 0xd5, 0x68, 0xc7})),
- std::make_pair(
- 251,
- std::vector<uint8_t>(
- {0x4e, 0x5c, 0x73, 0x4c, 0x7d, 0xde, 0x01, 0x1d, 0x83, 0xea, 0xc2,
- 0xb7, 0x34, 0x7b, 0x37, 0x35, 0x94, 0xf9, 0x2d, 0x70, 0x91, 0xb9,
- 0xca, 0x34, 0xcb, 0x9c, 0x6f, 0x39, 0xbd, 0xf5, 0xa8, 0xd2, 0xf1,
- 0x34, 0x37, 0x9e, 0x16, 0xd8, 0x22, 0xf6, 0x52, 0x21, 0x70, 0xcc,
- 0xf2, 0xdd, 0xd5, 0x5c, 0x84, 0xb9, 0xe6, 0xc6, 0x4f, 0xc9, 0x27,
- 0xac, 0x4c, 0xf8, 0xdf, 0xb2, 0xa1, 0x77, 0x01, 0xf2})),
- std::make_pair(
- 252,
- std::vector<uint8_t>(
- {0x69, 0x5d, 0x83, 0xbd, 0x99, 0x0a, 0x11, 0x17, 0xb3, 0xd0, 0xce,
- 0x06, 0xcc, 0x88, 0x80, 0x27, 0xd1, 0x2a, 0x05, 0x4c, 0x26, 0x77,
- 0xfd, 0x82, 0xf0, 0xd4, 0xfb, 0xfc, 0x93, 0x57, 0x55, 0x23, 0xe7,
- 0x99, 0x1a, 0x5e, 0x35, 0xa3, 0x75, 0x2e, 0x9b, 0x70, 0xce, 0x62,
- 0x99, 0x2e, 0x26, 0x8a, 0x87, 0x77, 0x44, 0xcd, 0xd4, 0x35, 0xf5,
- 0xf1, 0x30, 0x86, 0x9c, 0x9a, 0x20, 0x74, 0xb3, 0x38})),
- std::make_pair(
- 253,
- std::vector<uint8_t>(
- {0xa6, 0x21, 0x37, 0x43, 0x56, 0x8e, 0x3b, 0x31, 0x58, 0xb9, 0x18,
- 0x43, 0x01, 0xf3, 0x69, 0x08, 0x47, 0x55, 0x4c, 0x68, 0x45, 0x7c,
- 0xb4, 0x0f, 0xc9, 0xa4, 0xb8, 0xcf, 0xd8, 0xd4, 0xa1, 0x18, 0xc3,
- 0x01, 0xa0, 0x77, 0x37, 0xae, 0xda, 0x0f, 0x92, 0x9c, 0x68, 0x91,
- 0x3c, 0x5f, 0x51, 0xc8, 0x03, 0x94, 0xf5, 0x3b, 0xff, 0x1c, 0x3e,
- 0x83, 0xb2, 0xe4, 0x0c, 0xa9, 0x7e, 0xba, 0x9e, 0x15})),
- std::make_pair(
- 254,
- std::vector<uint8_t>(
- {0xd4, 0x44, 0xbf, 0xa2, 0x36, 0x2a, 0x96, 0xdf, 0x21, 0x3d, 0x07,
- 0x0e, 0x33, 0xfa, 0x84, 0x1f, 0x51, 0x33, 0x4e, 0x4e, 0x76, 0x86,
- 0x6b, 0x81, 0x39, 0xe8, 0xaf, 0x3b, 0xb3, 0x39, 0x8b, 0xe2, 0xdf,
- 0xad, 0xdc, 0xbc, 0x56, 0xb9, 0x14, 0x6d, 0xe9, 0xf6, 0x81, 0x18,
- 0xdc, 0x58, 0x29, 0xe7, 0x4b, 0x0c, 0x28, 0xd7, 0x71, 0x19, 0x07,
- 0xb1, 0x21, 0xf9, 0x16, 0x1c, 0xb9, 0x2b, 0x69, 0xa9})),
- std::make_pair(
- 255,
- std::vector<uint8_t>(
- {0x14, 0x27, 0x09, 0xd6, 0x2e, 0x28, 0xfc, 0xcc, 0xd0, 0xaf, 0x97,
- 0xfa, 0xd0, 0xf8, 0x46, 0x5b, 0x97, 0x1e, 0x82, 0x20, 0x1d, 0xc5,
- 0x10, 0x70, 0xfa, 0xa0, 0x37, 0x2a, 0xa4, 0x3e, 0x92, 0x48, 0x4b,
- 0xe1, 0xc1, 0xe7, 0x3b, 0xa1, 0x09, 0x06, 0xd5, 0xd1, 0x85, 0x3d,
- 0xb6, 0xa4, 0x10, 0x6e, 0x0a, 0x7b, 0xf9, 0x80, 0x0d, 0x37, 0x3d,
- 0x6d, 0xee, 0x2d, 0x46, 0xd6, 0x2e, 0xf2, 0xa4, 0x61}))}; \ No newline at end of file
diff --git a/security/nss/gtests/freebl_gtest/rsa_unittest.cc b/security/nss/gtests/freebl_gtest/rsa_unittest.cc
deleted file mode 100644
index 5c667a1d17..0000000000
--- a/security/nss/gtests/freebl_gtest/rsa_unittest.cc
+++ /dev/null
@@ -1,61 +0,0 @@
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this file,
-// You can obtain one at http://mozilla.org/MPL/2.0/.
-
-#include "gtest/gtest.h"
-
-#include <stdint.h>
-
-#include "blapi.h"
-#include "secitem.h"
-
-template <class T>
-struct ScopedDelete {
- void operator()(T* ptr) {
- if (ptr) {
- PORT_FreeArena(ptr->arena, PR_TRUE);
- }
- }
-};
-
-typedef std::unique_ptr<RSAPrivateKey, ScopedDelete<RSAPrivateKey>>
- ScopedRSAPrivateKey;
-
-class RSANewKeyTest : public ::testing::Test {
- protected:
- RSAPrivateKey* CreateKeyWithExponent(int keySizeInBits,
- unsigned char publicExponent) {
- SECItem exp = {siBuffer, 0, 0};
- unsigned char pubExp[1] = {publicExponent};
- exp.data = pubExp;
- exp.len = 1;
-
- return RSA_NewKey(keySizeInBits, &exp);
- }
-};
-
-TEST_F(RSANewKeyTest, expOneTest) {
- ScopedRSAPrivateKey key(CreateKeyWithExponent(2048, 0x01));
- ASSERT_TRUE(key == nullptr);
-}
-TEST_F(RSANewKeyTest, expTwoTest) {
- ScopedRSAPrivateKey key(CreateKeyWithExponent(2048, 0x02));
- ASSERT_TRUE(key == nullptr);
-}
-TEST_F(RSANewKeyTest, expFourTest) {
- ScopedRSAPrivateKey key(CreateKeyWithExponent(2048, 0x04));
- ASSERT_TRUE(key == nullptr);
-}
-TEST_F(RSANewKeyTest, WrongKeysizeTest) {
- ScopedRSAPrivateKey key(CreateKeyWithExponent(2047, 0x03));
- ASSERT_TRUE(key == nullptr);
-}
-
-TEST_F(RSANewKeyTest, expThreeTest) {
- ScopedRSAPrivateKey key(CreateKeyWithExponent(2048, 0x03));
-#ifdef NSS_FIPS_DISABLED
- ASSERT_TRUE(key != nullptr);
-#else
- ASSERT_TRUE(key == nullptr);
-#endif
-}
diff --git a/security/nss/gtests/manifest.mn b/security/nss/gtests/manifest.mn
index 13048f037c..1ae4cab776 100644
--- a/security/nss/gtests/manifest.mn
+++ b/security/nss/gtests/manifest.mn
@@ -13,6 +13,7 @@ LIB_SRCDIRS = \
ifneq ($(NSS_BUILD_WITHOUT_UTIL),1)
UTIL_SRCDIRS = \
util_gtest \
+ der_gtest \
$(NULL)
endif
@@ -21,12 +22,9 @@ ifneq ($(NSS_BUILD_UTIL_ONLY),1)
NSS_SRCDIRS = \
certdb_gtest \
certhigh_gtest \
- cryptohi_gtest \
- der_gtest \
pk11_gtest \
- softoken_gtest \
ssl_gtest \
- nss_bogo_shim \
+ nss_bogo_shim \
$(NULL)
endif
endif
diff --git a/security/nss/gtests/nss_bogo_shim/Makefile b/security/nss/gtests/nss_bogo_shim/Makefile
index a2ac4b145c..fd6426d89c 100644
--- a/security/nss/gtests/nss_bogo_shim/Makefile
+++ b/security/nss/gtests/nss_bogo_shim/Makefile
@@ -30,6 +30,10 @@ include ../common/gtest.mk
CFLAGS += -I$(CORE_DEPTH)/lib/ssl
+ifdef NSS_SSL_ENABLE_ZLIB
+include $(CORE_DEPTH)/coreconf/zlib.mk
+endif
+
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
@@ -44,3 +48,5 @@ include $(CORE_DEPTH)/coreconf/rules.mk
#######################################################################
# (7) Execute "local" rules. (OPTIONAL). #
#######################################################################
+
+
diff --git a/security/nss/gtests/nss_bogo_shim/config.json b/security/nss/gtests/nss_bogo_shim/config.json
index fed7ca993b..4109bd2ca2 100644
--- a/security/nss/gtests/nss_bogo_shim/config.json
+++ b/security/nss/gtests/nss_bogo_shim/config.json
@@ -1,14 +1,12 @@
{
"DisabledTests": {
"### These tests break whenever we rev versions, so just leave them here for easy uncommenting":"",
- "*TLS13*":"(NSS=19, BoGo=18)",
- "*HelloRetryRequest*":"(NSS=19, BoGo=18)",
- "*KeyShare*":"(NSS=19, BoGo=18)",
- "*EncryptedExtensions*":"(NSS=19, BoGo=18)",
- "*SecondClientHello*":"(NSS=19, BoGo=18)",
- "*IgnoreClientVersionOrder*":"(NSS=19, BoGo=18)",
- "SkipEarlyData*":"(NSS=19, BoGo=18)",
- "*Binder*":"(NSS=19, BoGo=18)",
+ "#*TLS13*":"(NSS=18, BoGo=16)",
+ "#*HelloRetryRequest*":"(NSS=18, BoGo=16)",
+ "#*KeyShare*":"(NSS=18, BoGo=16)",
+ "#*EncryptedExtensions*":"(NSS=18, BoGo=16)",
+ "#*SecondClientHello*":"(NSS=18, BoGo=16)",
+ "#*IgnoreClientVersionOrder*":"(NSS=18, BoGo=16)",
"Resume-Server-BinderWrongLength":"Alert disagreement (Bug 1317633)",
"Resume-Server-NoPSKBinder":"Alert disagreement (Bug 1317633)",
"CheckRecordVersion-TLS*":"Bug 1317634",
@@ -68,3 +66,4 @@
":DIGEST_CHECK_FAILED:":"SSL_ERROR_BAD_HANDSHAKE_HASH_VALUE"
}
}
+
diff --git a/security/nss/gtests/pk11_gtest/manifest.mn b/security/nss/gtests/pk11_gtest/manifest.mn
index a3dff9d100..fb773ee18e 100644
--- a/security/nss/gtests/pk11_gtest/manifest.mn
+++ b/security/nss/gtests/pk11_gtest/manifest.mn
@@ -11,7 +11,6 @@ CPPSRCS = \
pk11_chacha20poly1305_unittest.cc \
pk11_curve25519_unittest.cc \
pk11_ecdsa_unittest.cc \
- pk11_encrypt_derive_unittest.cc \
pk11_export_unittest.cc \
pk11_pbkdf2_unittest.cc \
pk11_prf_unittest.cc \
@@ -24,12 +23,10 @@ INCLUDES += -I$(CORE_DEPTH)/gtests/google_test/gtest/include \
-I$(CORE_DEPTH)/gtests/common \
-I$(CORE_DEPTH)/cpputil
-REQUIRES = nspr nss libdbm gtest cpputil
+REQUIRES = nspr nss libdbm gtest
PROGRAM = pk11_gtest
-EXTRA_LIBS = $(DIST)/lib/$(LIB_PREFIX)gtest.$(LIB_SUFFIX) \
- $(DIST)/lib/$(LIB_PREFIX)cpputil.$(LIB_SUFFIX) \
- $(DIST)/lib/$(LIB_PREFIX)gtestutil.$(LIB_SUFFIX) \
- $(NULL)
+EXTRA_LIBS = $(DIST)/lib/$(LIB_PREFIX)gtest.$(LIB_SUFFIX) $(EXTRA_OBJS) \
+ $(DIST)/lib/$(LIB_PREFIX)gtestutil.$(LIB_SUFFIX)
diff --git a/security/nss/gtests/pk11_gtest/pk11_ecdsa_unittest.cc b/security/nss/gtests/pk11_gtest/pk11_ecdsa_unittest.cc
index fb06598525..a54190c7c9 100644
--- a/security/nss/gtests/pk11_gtest/pk11_ecdsa_unittest.cc
+++ b/security/nss/gtests/pk11_gtest/pk11_ecdsa_unittest.cc
@@ -15,117 +15,103 @@
namespace nss_test {
-class Pkcs11EcdsaTestBase : public Pk11SignatureTest {
+class Pkcs11EcdsaTest : public Pk11SignatureTest {
protected:
- Pkcs11EcdsaTestBase(SECOidTag hash_oid)
- : Pk11SignatureTest(CKM_ECDSA, hash_oid) {}
+ CK_MECHANISM_TYPE mechanism() { return CKM_ECDSA; }
+ SECItem* parameters() { return nullptr; }
};
-struct Pkcs11EcdsaTestParams {
- SECOidTag hash_oid_;
- Pkcs11SignatureTestParams sig_params_;
+class Pkcs11EcdsaSha256Test : public Pkcs11EcdsaTest {
+ protected:
+ SECOidTag hashOID() { return SEC_OID_SHA256; }
};
-class Pkcs11EcdsaTest
- : public Pkcs11EcdsaTestBase,
- public ::testing::WithParamInterface<Pkcs11EcdsaTestParams> {
- public:
- Pkcs11EcdsaTest() : Pkcs11EcdsaTestBase(GetParam().hash_oid_) {}
+class Pkcs11EcdsaSha384Test : public Pkcs11EcdsaTest {
+ protected:
+ SECOidTag hashOID() { return SEC_OID_SHA384; }
};
-TEST_P(Pkcs11EcdsaTest, Verify) { Verify(GetParam().sig_params_); }
+class Pkcs11EcdsaSha512Test : public Pkcs11EcdsaTest {
+ protected:
+ SECOidTag hashOID() { return SEC_OID_SHA512; }
+};
-TEST_P(Pkcs11EcdsaTest, SignAndVerify) {
- SignAndVerify(GetParam().sig_params_);
+TEST_F(Pkcs11EcdsaSha256Test, VerifyP256) {
+ SIG_TEST_VECTOR_VERIFY(kP256Spki, kP256Data, kP256Signature)
+}
+TEST_F(Pkcs11EcdsaSha256Test, SignAndVerifyP256) {
+ SIG_TEST_VECTOR_SIGN_VERIFY(kP256Pkcs8, kP256Spki, kP256Data)
}
-static const Pkcs11EcdsaTestParams kEcdsaVectors[] = {
- {SEC_OID_SHA256,
- {DataBuffer(kP256Pkcs8, sizeof(kP256Pkcs8)),
- DataBuffer(kP256Spki, sizeof(kP256Spki)),
- DataBuffer(kP256Data, sizeof(kP256Data)),
- DataBuffer(kP256Signature, sizeof(kP256Signature))}},
- {SEC_OID_SHA384,
- {DataBuffer(kP384Pkcs8, sizeof(kP384Pkcs8)),
- DataBuffer(kP384Spki, sizeof(kP384Spki)),
- DataBuffer(kP384Data, sizeof(kP384Data)),
- DataBuffer(kP384Signature, sizeof(kP384Signature))}},
- {SEC_OID_SHA512,
- {DataBuffer(kP521Pkcs8, sizeof(kP521Pkcs8)),
- DataBuffer(kP521Spki, sizeof(kP521Spki)),
- DataBuffer(kP521Data, sizeof(kP521Data)),
- DataBuffer(kP521Signature, sizeof(kP521Signature))}}};
-
-INSTANTIATE_TEST_CASE_P(EcdsaSignVerify, Pkcs11EcdsaTest,
- ::testing::ValuesIn(kEcdsaVectors));
-
-class Pkcs11EcdsaSha256Test : public Pkcs11EcdsaTestBase {
- public:
- Pkcs11EcdsaSha256Test() : Pkcs11EcdsaTestBase(SEC_OID_SHA256) {}
-};
+TEST_F(Pkcs11EcdsaSha384Test, VerifyP384) {
+ SIG_TEST_VECTOR_VERIFY(kP384Spki, kP384Data, kP384Signature)
+}
+TEST_F(Pkcs11EcdsaSha384Test, SignAndVerifyP384) {
+ SIG_TEST_VECTOR_SIGN_VERIFY(kP384Pkcs8, kP384Spki, kP384Data)
+}
+
+TEST_F(Pkcs11EcdsaSha512Test, VerifyP521) {
+ SIG_TEST_VECTOR_VERIFY(kP521Spki, kP521Data, kP521Signature)
+}
+TEST_F(Pkcs11EcdsaSha512Test, SignAndVerifyP521) {
+ SIG_TEST_VECTOR_SIGN_VERIFY(kP521Pkcs8, kP521Spki, kP521Data)
+}
// Importing a private key in PKCS#8 format must fail when the outer AlgID
// struct contains neither id-ecPublicKey nor a namedCurve parameter.
TEST_F(Pkcs11EcdsaSha256Test, ImportNoCurveOIDOrAlgorithmParams) {
- DataBuffer k(kP256Pkcs8NoCurveOIDOrAlgorithmParams,
- sizeof(kP256Pkcs8NoCurveOIDOrAlgorithmParams));
- EXPECT_FALSE(ImportPrivateKey(k));
+ EXPECT_FALSE(ImportPrivateKey(kP256Pkcs8NoCurveOIDOrAlgorithmParams,
+ sizeof(kP256Pkcs8NoCurveOIDOrAlgorithmParams)));
};
// Importing a private key in PKCS#8 format must succeed when only the outer
// AlgID struct contains the namedCurve parameters.
TEST_F(Pkcs11EcdsaSha256Test, ImportOnlyAlgorithmParams) {
- DataBuffer k(kP256Pkcs8OnlyAlgorithmParams,
- sizeof(kP256Pkcs8OnlyAlgorithmParams));
- DataBuffer data(kP256Data, sizeof(kP256Data));
- DataBuffer sig;
- EXPECT_TRUE(ImportPrivateKeyAndSignHashedData(k, data, &sig));
+ EXPECT_TRUE(ImportPrivateKeyAndSignHashedData(
+ kP256Pkcs8OnlyAlgorithmParams, sizeof(kP256Pkcs8OnlyAlgorithmParams),
+ kP256Data, sizeof(kP256Data)));
};
// Importing a private key in PKCS#8 format must succeed when the outer AlgID
// struct and the inner ECPrivateKey contain the same namedCurve parameters.
// The inner curveOID is always ignored, so only the outer one will be used.
TEST_F(Pkcs11EcdsaSha256Test, ImportMatchingCurveOIDAndAlgorithmParams) {
- DataBuffer k(kP256Pkcs8MatchingCurveOIDAndAlgorithmParams,
- sizeof(kP256Pkcs8MatchingCurveOIDAndAlgorithmParams));
- DataBuffer data(kP256Data, sizeof(kP256Data));
- DataBuffer sig;
- EXPECT_TRUE(ImportPrivateKeyAndSignHashedData(k, data, &sig));
+ EXPECT_TRUE(ImportPrivateKeyAndSignHashedData(
+ kP256Pkcs8MatchingCurveOIDAndAlgorithmParams,
+ sizeof(kP256Pkcs8MatchingCurveOIDAndAlgorithmParams), kP256Data,
+ sizeof(kP256Data)));
};
// Importing a private key in PKCS#8 format must succeed when the outer AlgID
// struct and the inner ECPrivateKey contain dissimilar namedCurve parameters.
// The inner curveOID is always ignored, so only the outer one will be used.
TEST_F(Pkcs11EcdsaSha256Test, ImportDissimilarCurveOIDAndAlgorithmParams) {
- DataBuffer k(kP256Pkcs8DissimilarCurveOIDAndAlgorithmParams,
- sizeof(kP256Pkcs8DissimilarCurveOIDAndAlgorithmParams));
- DataBuffer data(kP256Data, sizeof(kP256Data));
- DataBuffer sig;
- EXPECT_TRUE(ImportPrivateKeyAndSignHashedData(k, data, &sig));
+ EXPECT_TRUE(ImportPrivateKeyAndSignHashedData(
+ kP256Pkcs8DissimilarCurveOIDAndAlgorithmParams,
+ sizeof(kP256Pkcs8DissimilarCurveOIDAndAlgorithmParams), kP256Data,
+ sizeof(kP256Data)));
};
// Importing a private key in PKCS#8 format must fail when the outer ASN.1
// AlgorithmID struct contains only id-ecPublicKey but no namedCurve parameter.
TEST_F(Pkcs11EcdsaSha256Test, ImportNoAlgorithmParams) {
- DataBuffer k(kP256Pkcs8NoAlgorithmParams,
- sizeof(kP256Pkcs8NoAlgorithmParams));
- EXPECT_FALSE(ImportPrivateKey(k));
+ EXPECT_FALSE(ImportPrivateKey(kP256Pkcs8NoAlgorithmParams,
+ sizeof(kP256Pkcs8NoAlgorithmParams)));
};
// Importing a private key in PKCS#8 format must fail when id-ecPublicKey is
// given (so we know it's an EC key) but the namedCurve parameter is unknown.
TEST_F(Pkcs11EcdsaSha256Test, ImportInvalidAlgorithmParams) {
- DataBuffer k(kP256Pkcs8InvalidAlgorithmParams,
- sizeof(kP256Pkcs8InvalidAlgorithmParams));
- EXPECT_FALSE(ImportPrivateKey(k));
+ EXPECT_FALSE(ImportPrivateKey(kP256Pkcs8InvalidAlgorithmParams,
+ sizeof(kP256Pkcs8InvalidAlgorithmParams)));
};
// Importing a private key in PKCS#8 format with a point not on the curve will
// succeed. Using the contained public key however will fail when trying to
// import it before using it for any operation.
TEST_F(Pkcs11EcdsaSha256Test, ImportPointNotOnCurve) {
- DataBuffer k(kP256Pkcs8PointNotOnCurve, sizeof(kP256Pkcs8PointNotOnCurve));
- ScopedSECKEYPrivateKey privKey(ImportPrivateKey(k));
+ ScopedSECKEYPrivateKey privKey(ImportPrivateKey(
+ kP256Pkcs8PointNotOnCurve, sizeof(kP256Pkcs8PointNotOnCurve)));
ASSERT_TRUE(privKey);
ScopedSECKEYPublicKey pubKey(SECKEY_ConvertToPublicKey(privKey.get()));
@@ -141,23 +127,23 @@ TEST_F(Pkcs11EcdsaSha256Test, ImportPointNotOnCurve) {
// Importing a private key in PKCS#8 format must fail when no point is given.
// PK11 currently offers no APIs to derive raw public keys from private values.
TEST_F(Pkcs11EcdsaSha256Test, ImportNoPublicKey) {
- DataBuffer k(kP256Pkcs8NoPublicKey, sizeof(kP256Pkcs8NoPublicKey));
- EXPECT_FALSE(ImportPrivateKey(k));
+ EXPECT_FALSE(
+ ImportPrivateKey(kP256Pkcs8NoPublicKey, sizeof(kP256Pkcs8NoPublicKey)));
};
// Importing a public key in SPKI format must fail when id-ecPublicKey is
// given (so we know it's an EC key) but the namedCurve parameter is missing.
TEST_F(Pkcs11EcdsaSha256Test, ImportSpkiNoAlgorithmParams) {
- DataBuffer k(kP256SpkiNoAlgorithmParams, sizeof(kP256SpkiNoAlgorithmParams));
- EXPECT_FALSE(ImportPublicKey(k));
+ EXPECT_FALSE(ImportPublicKey(kP256SpkiNoAlgorithmParams,
+ sizeof(kP256SpkiNoAlgorithmParams)));
}
// Importing a public key in SPKI format with a point not on the curve will
// succeed. Using the public key however will fail when trying to import
// it before using it for any operation.
TEST_F(Pkcs11EcdsaSha256Test, ImportSpkiPointNotOnCurve) {
- DataBuffer k(kP256SpkiPointNotOnCurve, sizeof(kP256SpkiPointNotOnCurve));
- ScopedSECKEYPublicKey pubKey(ImportPublicKey(k));
+ ScopedSECKEYPublicKey pubKey(ImportPublicKey(
+ kP256SpkiPointNotOnCurve, sizeof(kP256SpkiPointNotOnCurve)));
ASSERT_TRUE(pubKey);
ScopedPK11SlotInfo slot(PK11_GetInternalSlot());
diff --git a/security/nss/gtests/pk11_gtest/pk11_encrypt_derive_unittest.cc b/security/nss/gtests/pk11_gtest/pk11_encrypt_derive_unittest.cc
deleted file mode 100644
index aa92756f26..0000000000
--- a/security/nss/gtests/pk11_gtest/pk11_encrypt_derive_unittest.cc
+++ /dev/null
@@ -1,210 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "pk11pub.h"
-#include "nssutil.h"
-#include <stdio.h>
-#include "prerror.h"
-#include "nss.h"
-#include "gtest/gtest.h"
-#include "scoped_ptrs.h"
-#include "cpputil.h"
-#include "databuffer.h"
-#include "util.h"
-
-#define MAX_KEY_SIZE 24
-
-namespace nss_test {
-
-static const uint8_t kIv[] = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77,
- 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff,
- 0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77};
-static const uint8_t kInput[] = {
- 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00, 0xff, 0xee, 0xdd, 0xcc,
- 0xbb, 0xaa, 0x99, 0x88, 0x77, 0x66, 0x55, 0x44, 0x33, 0x22, 0x11, 0x00};
-
-class EncryptDeriveTest
- : public ::testing::Test,
- public ::testing::WithParamInterface<CK_MECHANISM_TYPE> {
- public:
- void TestEncryptDerive() {
- ScopedPK11SymKey derived_key(PK11_Derive(key_.get(), derive_mech(),
- derive_param(), encrypt_mech(),
- CKA_DECRYPT, keysize()));
- ASSERT_TRUE(derived_key);
-
- uint8_t derived_key_data[MAX_KEY_SIZE];
- ASSERT_GE(sizeof(derived_key_data), keysize());
- GetKeyData(derived_key, derived_key_data, keysize());
- RemoveChecksum(derived_key_data);
-
- uint8_t reference_key_data[MAX_KEY_SIZE];
- unsigned int reference_len = 0;
- SECStatus rv = PK11_Encrypt(key_.get(), encrypt_mech(), encrypt_param(),
- reference_key_data, &reference_len, keysize(),
- kInput, keysize());
- ASSERT_EQ(SECSuccess, rv);
- ASSERT_EQ(keysize(), static_cast<size_t>(reference_len));
- RemoveChecksum(reference_key_data);
-
- EXPECT_EQ(DataBuffer(reference_key_data, keysize()),
- DataBuffer(derived_key_data, keysize()));
- }
-
- protected:
- unsigned int keysize() const { return 16; }
-
- private:
- CK_MECHANISM_TYPE encrypt_mech() const { return GetParam(); }
-
- CK_MECHANISM_TYPE derive_mech() const {
- switch (encrypt_mech()) {
- case CKM_DES3_ECB:
- return CKM_DES3_ECB_ENCRYPT_DATA;
- case CKM_DES3_CBC:
- return CKM_DES3_CBC_ENCRYPT_DATA;
- case CKM_AES_ECB:
- return CKM_AES_ECB_ENCRYPT_DATA;
- case CKM_AES_CBC:
- return CKM_AES_CBC_ENCRYPT_DATA;
- case CKM_CAMELLIA_ECB:
- return CKM_CAMELLIA_ECB_ENCRYPT_DATA;
- case CKM_CAMELLIA_CBC:
- return CKM_CAMELLIA_CBC_ENCRYPT_DATA;
- case CKM_SEED_ECB:
- return CKM_SEED_ECB_ENCRYPT_DATA;
- case CKM_SEED_CBC:
- return CKM_SEED_CBC_ENCRYPT_DATA;
- default:
- ADD_FAILURE() << "Unknown mechanism";
- break;
- }
- return CKM_INVALID_MECHANISM;
- }
-
- SECItem* derive_param() const {
- static CK_AES_CBC_ENCRYPT_DATA_PARAMS aes_data;
- static CK_DES_CBC_ENCRYPT_DATA_PARAMS des_data;
- static CK_KEY_DERIVATION_STRING_DATA string_data;
- static SECItem param = {siBuffer, NULL, 0};
-
- switch (encrypt_mech()) {
- case CKM_DES3_ECB:
- case CKM_AES_ECB:
- case CKM_CAMELLIA_ECB:
- case CKM_SEED_ECB:
- string_data.pData = toUcharPtr(kInput);
- string_data.ulLen = keysize();
- param.data = reinterpret_cast<uint8_t*>(&string_data);
- param.len = sizeof(string_data);
- break;
-
- case CKM_DES3_CBC:
- des_data.pData = toUcharPtr(kInput);
- des_data.length = keysize();
- PORT_Memcpy(des_data.iv, kIv, 8);
- param.data = reinterpret_cast<uint8_t*>(&des_data);
- param.len = sizeof(des_data);
- break;
-
- case CKM_AES_CBC:
- case CKM_CAMELLIA_CBC:
- case CKM_SEED_CBC:
- aes_data.pData = toUcharPtr(kInput);
- aes_data.length = keysize();
- PORT_Memcpy(aes_data.iv, kIv, keysize());
- param.data = reinterpret_cast<uint8_t*>(&aes_data);
- param.len = sizeof(aes_data);
- break;
-
- default:
- ADD_FAILURE() << "Unknown mechanism";
- break;
- }
- return &param;
- }
-
- SECItem* encrypt_param() const {
- static SECItem param = {siBuffer, NULL, 0};
-
- switch (encrypt_mech()) {
- case CKM_DES3_ECB:
- case CKM_AES_ECB:
- case CKM_CAMELLIA_ECB:
- case CKM_SEED_ECB:
- // No parameter needed here.
- break;
-
- case CKM_DES3_CBC:
- case CKM_AES_CBC:
- case CKM_CAMELLIA_CBC:
- case CKM_SEED_CBC:
- param.data = toUcharPtr(kIv);
- param.len = keysize();
- break;
-
- default:
- ADD_FAILURE() << "Unknown mechanism";
- break;
- }
- return &param;
- }
-
- virtual void SetUp() {
- slot_.reset(PK11_GetBestSlot(derive_mech(), NULL));
- ASSERT_TRUE(slot_);
-
- key_.reset(PK11_TokenKeyGenWithFlags(slot_.get(), encrypt_mech(), NULL,
- keysize(), NULL,
- CKF_ENCRYPT | CKF_DERIVE, 0, NULL));
- ASSERT_TRUE(key_);
- }
-
- void GetKeyData(ScopedPK11SymKey& key, uint8_t* buf, size_t max_len) const {
- ASSERT_EQ(SECSuccess, PK11_ExtractKeyValue(key.get()));
- SECItem* data = PK11_GetKeyData(key.get());
- ASSERT_TRUE(data);
- ASSERT_EQ(max_len, static_cast<size_t>(data->len));
- PORT_Memcpy(buf, data->data, data->len);
- }
-
- // Remove checksum if the key is a 3DES key.
- void RemoveChecksum(uint8_t* key_data) const {
- if (encrypt_mech() != CKM_DES3_CBC && encrypt_mech() != CKM_DES3_ECB) {
- return;
- }
- for (size_t i = 0; i < keysize(); ++i) {
- key_data[i] &= 0xfe;
- }
- }
-
- ScopedPK11SlotInfo slot_;
- ScopedPK11SymKey key_;
-};
-
-TEST_P(EncryptDeriveTest, Test) { TestEncryptDerive(); }
-
-static const CK_MECHANISM_TYPE kEncryptDeriveMechanisms[] = {
- CKM_DES3_ECB, CKM_DES3_CBC, CKM_AES_ECB, CKM_AES_ECB, CKM_AES_CBC,
- CKM_CAMELLIA_ECB, CKM_CAMELLIA_CBC, CKM_SEED_ECB, CKM_SEED_CBC};
-
-INSTANTIATE_TEST_CASE_P(EncryptDeriveTests, EncryptDeriveTest,
- ::testing::ValuesIn(kEncryptDeriveMechanisms));
-
-// This class handles the case where 3DES takes a 192-bit key
-// where all 24 octets will be used.
-class EncryptDerive3Test : public EncryptDeriveTest {
- protected:
- unsigned int keysize() const { return 24; }
-};
-
-TEST_P(EncryptDerive3Test, Test) { TestEncryptDerive(); }
-
-static const CK_MECHANISM_TYPE kDES3EncryptDeriveMechanisms[] = {CKM_DES3_ECB,
- CKM_DES3_CBC};
-
-INSTANTIATE_TEST_CASE_P(Encrypt3DeriveTests, EncryptDerive3Test,
- ::testing::ValuesIn(kDES3EncryptDeriveMechanisms));
-
-} // namespace nss_test
diff --git a/security/nss/gtests/pk11_gtest/pk11_gtest.gyp b/security/nss/gtests/pk11_gtest/pk11_gtest.gyp
index 076b4d37ff..c47ff47785 100644
--- a/security/nss/gtests/pk11_gtest/pk11_gtest.gyp
+++ b/security/nss/gtests/pk11_gtest/pk11_gtest.gyp
@@ -16,7 +16,6 @@
'pk11_chacha20poly1305_unittest.cc',
'pk11_curve25519_unittest.cc',
'pk11_ecdsa_unittest.cc',
- 'pk11_encrypt_derive_unittest.cc',
'pk11_pbkdf2_unittest.cc',
'pk11_prf_unittest.cc',
'pk11_prng_unittest.cc',
@@ -27,7 +26,6 @@
'dependencies': [
'<(DEPTH)/exports.gyp:nss_exports',
'<(DEPTH)/lib/util/util.gyp:nssutil3',
- '<(DEPTH)/cpputil/cpputil.gyp:cpputil',
'<(DEPTH)/gtests/google_test/google_test.gyp:gtest',
],
'conditions': [
diff --git a/security/nss/gtests/pk11_gtest/pk11_rsapss_unittest.cc b/security/nss/gtests/pk11_gtest/pk11_rsapss_unittest.cc
index 6c8c5ab4e9..012bae0e9e 100644
--- a/security/nss/gtests/pk11_gtest/pk11_rsapss_unittest.cc
+++ b/security/nss/gtests/pk11_gtest/pk11_rsapss_unittest.cc
@@ -12,14 +12,14 @@
#include "gtest/gtest.h"
#include "scoped_ptrs.h"
-#include "pk11_signature_test.h"
#include "pk11_rsapss_vectors.h"
+#include "pk11_signature_test.h"
namespace nss_test {
-class Pkcs11RsaPssTest : public Pk11SignatureTest {
+class Pkcs11RsaPssVectorTest : public Pk11SignatureTest {
public:
- Pkcs11RsaPssTest() : Pk11SignatureTest(CKM_RSA_PKCS_PSS, SEC_OID_SHA1) {
+ Pkcs11RsaPssVectorTest() {
rsaPssParams_.hashAlg = CKM_SHA_1;
rsaPssParams_.mgf = CKG_MGF1_SHA1;
rsaPssParams_.sLen = HASH_ResultLenByOidTag(SEC_OID_SHA1);
@@ -30,14 +30,16 @@ class Pkcs11RsaPssTest : public Pk11SignatureTest {
}
protected:
- const SECItem* parameters() const { return &params_; }
+ CK_MECHANISM_TYPE mechanism() { return CKM_RSA_PKCS_PSS; }
+ SECItem* parameters() { return &params_; }
+ SECOidTag hashOID() { return SEC_OID_SHA1; }
private:
CK_RSA_PKCS_PSS_PARAMS rsaPssParams_;
SECItem params_;
};
-TEST_F(Pkcs11RsaPssTest, GenerateAndSignAndVerify) {
+TEST_F(Pkcs11RsaPssVectorTest, GenerateAndSignAndVerify) {
// Sign data with a 1024-bit RSA key, using PSS/SHA-256.
SECOidTag hashOid = SEC_OID_SHA256;
CK_MECHANISM_TYPE hashMech = CKM_SHA256;
@@ -93,56 +95,105 @@ TEST_F(Pkcs11RsaPssTest, GenerateAndSignAndVerify) {
EXPECT_EQ(rv, SECFailure);
}
-class Pkcs11RsaPssVectorTest
- : public Pkcs11RsaPssTest,
- public ::testing::WithParamInterface<Pkcs11SignatureTestParams> {};
+// RSA-PSS test vectors, pss-vect.txt, Example 1.1: A 1024-bit RSA Key Pair
+// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
+TEST_F(Pkcs11RsaPssVectorTest, VerifyKnownSignature1) {
+ SIG_TEST_VECTOR_VERIFY(kTestVector1Spki, kTestVector1Data, kTestVector1Sig);
+}
+TEST_F(Pkcs11RsaPssVectorTest, SignAndVerify1) {
+ SIG_TEST_VECTOR_SIGN_VERIFY(kTestVector1Pkcs8, kTestVector1Spki,
+ kTestVector1Data);
+}
-TEST_P(Pkcs11RsaPssVectorTest, Verify) { Verify(GetParam()); }
+// RSA-PSS test vectors, pss-vect.txt, Example 2.1: A 1025-bit RSA Key Pair
+// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
+TEST_F(Pkcs11RsaPssVectorTest, VerifyKnownSignature2) {
+ SIG_TEST_VECTOR_VERIFY(kTestVector2Spki, kTestVector2Data, kTestVector2Sig);
+}
+TEST_F(Pkcs11RsaPssVectorTest, SignAndVerify2) {
+ SIG_TEST_VECTOR_SIGN_VERIFY(kTestVector2Pkcs8, kTestVector2Spki,
+ kTestVector2Data);
+}
-TEST_P(Pkcs11RsaPssVectorTest, SignAndVerify) { SignAndVerify(GetParam()); }
+// RSA-PSS test vectors, pss-vect.txt, Example 3.1: A 1026-bit RSA Key Pair
+// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
+TEST_F(Pkcs11RsaPssVectorTest, VerifyKnownSignature3) {
+ SIG_TEST_VECTOR_VERIFY(kTestVector3Spki, kTestVector3Data, kTestVector3Sig);
+}
+TEST_F(Pkcs11RsaPssVectorTest, SignAndVerify3) {
+ SIG_TEST_VECTOR_SIGN_VERIFY(kTestVector3Pkcs8, kTestVector3Spki,
+ kTestVector3Data);
+}
-#define VECTOR(pkcs8, spki, data, sig) \
- { \
- DataBuffer(pkcs8, sizeof(pkcs8)), DataBuffer(spki, sizeof(spki)), \
- DataBuffer(data, sizeof(data)), DataBuffer(sig, sizeof(sig)) \
- }
-#define VECTOR_N(n) \
- VECTOR(kTestVector##n##Pkcs8, kTestVector##n##Spki, kTestVector##n##Data, \
- kTestVector##n##Sig)
-
-static const Pkcs11SignatureTestParams kRsaPssVectors[] = {
- // RSA-PSS test vectors, pss-vect.txt, Example 1.1: A 1024-bit RSA Key Pair
- // <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
- VECTOR_N(1),
- // RSA-PSS test vectors, pss-vect.txt, Example 2.1: A 1025-bit RSA Key Pair
- // <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
- VECTOR_N(2),
- // RSA-PSS test vectors, pss-vect.txt, Example 3.1: A 1026-bit RSA Key Pair
- // <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
- VECTOR_N(3),
- // RSA-PSS test vectors, pss-vect.txt, Example 4.1: A 1027-bit RSA Key Pair
- // <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
- VECTOR_N(4),
- // RSA-PSS test vectors, pss-vect.txt, Example 5.1: A 1028-bit RSA Key Pair
- // <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
- VECTOR_N(5),
- // RSA-PSS test vectors, pss-vect.txt, Example 6.1: A 1029-bit RSA Key Pair
- // <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
- VECTOR_N(6),
- // RSA-PSS test vectors, pss-vect.txt, Example 7.1: A 1030-bit RSA Key Pair
- // <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
- VECTOR_N(7),
- // RSA-PSS test vectors, pss-vect.txt, Example 8.1: A 1031-bit RSA Key Pair
- // <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
- VECTOR_N(8),
- // RSA-PSS test vectors, pss-vect.txt, Example 9.1: A 1536-bit RSA Key Pair
- // <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
- VECTOR_N(9),
- // RSA-PSS test vectors, pss-vect.txt, Example 10.1: A 2048-bit RSA Key Pair
- // <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
- VECTOR_N(10)};
-
-INSTANTIATE_TEST_CASE_P(RsaPssSignVerify, Pkcs11RsaPssVectorTest,
- ::testing::ValuesIn(kRsaPssVectors));
+// RSA-PSS test vectors, pss-vect.txt, Example 4.1: A 1027-bit RSA Key Pair
+// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
+TEST_F(Pkcs11RsaPssVectorTest, VerifyKnownSignature4) {
+ SIG_TEST_VECTOR_VERIFY(kTestVector4Spki, kTestVector4Data, kTestVector4Sig);
+}
+TEST_F(Pkcs11RsaPssVectorTest, SignAndVerify4) {
+ SIG_TEST_VECTOR_SIGN_VERIFY(kTestVector4Pkcs8, kTestVector4Spki,
+ kTestVector4Data);
+}
+
+// RSA-PSS test vectors, pss-vect.txt, Example 5.1: A 1028-bit RSA Key Pair
+// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
+TEST_F(Pkcs11RsaPssVectorTest, VerifyKnownSignature5) {
+ SIG_TEST_VECTOR_VERIFY(kTestVector5Spki, kTestVector5Data, kTestVector5Sig);
+}
+TEST_F(Pkcs11RsaPssVectorTest, SignAndVerify5) {
+ SIG_TEST_VECTOR_SIGN_VERIFY(kTestVector5Pkcs8, kTestVector5Spki,
+ kTestVector5Data);
+}
+
+// RSA-PSS test vectors, pss-vect.txt, Example 6.1: A 1029-bit RSA Key Pair
+// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
+TEST_F(Pkcs11RsaPssVectorTest, VerifyKnownSignature6) {
+ SIG_TEST_VECTOR_VERIFY(kTestVector6Spki, kTestVector6Data, kTestVector6Sig);
+}
+TEST_F(Pkcs11RsaPssVectorTest, SignAndVerify6) {
+ SIG_TEST_VECTOR_SIGN_VERIFY(kTestVector6Pkcs8, kTestVector6Spki,
+ kTestVector6Data);
+}
+
+// RSA-PSS test vectors, pss-vect.txt, Example 7.1: A 1030-bit RSA Key Pair
+// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
+TEST_F(Pkcs11RsaPssVectorTest, VerifyKnownSignature7) {
+ SIG_TEST_VECTOR_VERIFY(kTestVector7Spki, kTestVector7Data, kTestVector7Sig);
+}
+TEST_F(Pkcs11RsaPssVectorTest, SignAndVerify7) {
+ SIG_TEST_VECTOR_SIGN_VERIFY(kTestVector7Pkcs8, kTestVector7Spki,
+ kTestVector7Data);
+}
+
+// RSA-PSS test vectors, pss-vect.txt, Example 8.1: A 1031-bit RSA Key Pair
+// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
+TEST_F(Pkcs11RsaPssVectorTest, VerifyKnownSignature8) {
+ SIG_TEST_VECTOR_VERIFY(kTestVector8Spki, kTestVector8Data, kTestVector8Sig);
+}
+TEST_F(Pkcs11RsaPssVectorTest, SignAndVerify8) {
+ SIG_TEST_VECTOR_SIGN_VERIFY(kTestVector8Pkcs8, kTestVector8Spki,
+ kTestVector8Data);
+}
+
+// RSA-PSS test vectors, pss-vect.txt, Example 9.1: A 1536-bit RSA Key Pair
+// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
+TEST_F(Pkcs11RsaPssVectorTest, VerifyKnownSignature9) {
+ SIG_TEST_VECTOR_VERIFY(kTestVector9Spki, kTestVector9Data, kTestVector9Sig);
+}
+TEST_F(Pkcs11RsaPssVectorTest, SignAndVerify9) {
+ SIG_TEST_VECTOR_SIGN_VERIFY(kTestVector9Pkcs8, kTestVector9Spki,
+ kTestVector9Data);
+}
+
+// RSA-PSS test vectors, pss-vect.txt, Example 10.1: A 2048-bit RSA Key Pair
+// <ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1-vec.zip>
+TEST_F(Pkcs11RsaPssVectorTest, VerifyKnownSignature10) {
+ SIG_TEST_VECTOR_VERIFY(kTestVector10Spki, kTestVector10Data,
+ kTestVector10Sig);
+}
+TEST_F(Pkcs11RsaPssVectorTest, SignAndVerify10) {
+ SIG_TEST_VECTOR_SIGN_VERIFY(kTestVector10Pkcs8, kTestVector10Spki,
+ kTestVector10Data);
+}
} // namespace nss_test
diff --git a/security/nss/gtests/pk11_gtest/pk11_signature_test.h b/security/nss/gtests/pk11_gtest/pk11_signature_test.h
index b141043716..e6a0a9c579 100644
--- a/security/nss/gtests/pk11_gtest/pk11_signature_test.h
+++ b/security/nss/gtests/pk11_gtest/pk11_signature_test.h
@@ -9,37 +9,26 @@
#include "cpputil.h"
#include "scoped_ptrs.h"
-#include "databuffer.h"
#include "gtest/gtest.h"
namespace nss_test {
-// For test vectors.
-struct Pkcs11SignatureTestParams {
- const DataBuffer pkcs8_;
- const DataBuffer spki_;
- const DataBuffer data_;
- const DataBuffer signature_;
-};
-
class Pk11SignatureTest : public ::testing::Test {
protected:
- Pk11SignatureTest(CK_MECHANISM_TYPE mechanism, SECOidTag hash_oid)
- : mechanism_(mechanism), hash_oid_(hash_oid) {}
+ virtual CK_MECHANISM_TYPE mechanism() = 0;
+ virtual SECItem* parameters() = 0;
+ virtual SECOidTag hashOID() = 0;
- virtual const SECItem* parameters() const { return nullptr; }
- CK_MECHANISM_TYPE mechanism() const { return mechanism_; }
-
- ScopedSECKEYPrivateKey ImportPrivateKey(const DataBuffer& pkcs8) {
+ ScopedSECKEYPrivateKey ImportPrivateKey(const uint8_t* pkcs8,
+ size_t pkcs8_len) {
ScopedPK11SlotInfo slot(PK11_GetInternalSlot());
if (!slot) {
- ADD_FAILURE() << "No slot";
return nullptr;
}
- SECItem pkcs8Item = {siBuffer, toUcharPtr(pkcs8.data()),
- static_cast<unsigned int>(pkcs8.len())};
+ SECItem pkcs8Item = {siBuffer, toUcharPtr(pkcs8),
+ static_cast<unsigned int>(pkcs8_len)};
SECKEYPrivateKey* key = nullptr;
SECStatus rv = PK11_ImportDERPrivateKeyInfoAndReturnKey(
@@ -53,9 +42,9 @@ class Pk11SignatureTest : public ::testing::Test {
return ScopedSECKEYPrivateKey(key);
}
- ScopedSECKEYPublicKey ImportPublicKey(const DataBuffer& spki) {
- SECItem spkiItem = {siBuffer, toUcharPtr(spki.data()),
- static_cast<unsigned int>(spki.len())};
+ ScopedSECKEYPublicKey ImportPublicKey(const uint8_t* spki, size_t spki_len) {
+ SECItem spkiItem = {siBuffer, toUcharPtr(spki),
+ static_cast<unsigned int>(spki_len)};
ScopedCERTSubjectPublicKeyInfo certSpki(
SECKEY_DecodeDERSubjectPublicKeyInfo(&spkiItem));
@@ -63,74 +52,87 @@ class Pk11SignatureTest : public ::testing::Test {
return ScopedSECKEYPublicKey(SECKEY_ExtractPublicKey(certSpki.get()));
}
- bool ComputeHash(const DataBuffer& data, DataBuffer* hash) {
- hash->Allocate(static_cast<size_t>(HASH_ResultLenByOidTag(hash_oid_)));
- SECStatus rv =
- PK11_HashBuf(hash_oid_, hash->data(), data.data(), data.len());
- return rv == SECSuccess;
+ ScopedSECItem ComputeHash(const uint8_t* data, size_t len) {
+ unsigned int hLen = HASH_ResultLenByOidTag(hashOID());
+ ScopedSECItem hash(SECITEM_AllocItem(nullptr, nullptr, hLen));
+ if (!hash) {
+ return nullptr;
+ }
+
+ SECStatus rv = PK11_HashBuf(hashOID(), hash->data, data, len);
+ if (rv != SECSuccess) {
+ return nullptr;
+ }
+
+ return hash;
}
- bool SignHashedData(ScopedSECKEYPrivateKey& privKey, const DataBuffer& hash,
- DataBuffer* sig) {
- SECItem hashItem = {siBuffer, toUcharPtr(hash.data()),
- static_cast<unsigned int>(hash.len())};
- int sigLen = PK11_SignatureLen(privKey.get());
- EXPECT_LT(0, sigLen);
- sig->Allocate(static_cast<size_t>(sigLen));
- SECItem sigItem = {siBuffer, toUcharPtr(sig->data()),
- static_cast<unsigned int>(sig->len())};
- SECStatus rv = PK11_SignWithMechanism(privKey.get(), mechanism_,
- parameters(), &sigItem, &hashItem);
- return rv == SECSuccess;
+ ScopedSECItem SignHashedData(ScopedSECKEYPrivateKey& privKey,
+ ScopedSECItem& hash) {
+ unsigned int sLen = PK11_SignatureLen(privKey.get());
+ ScopedSECItem sig(SECITEM_AllocItem(nullptr, nullptr, sLen));
+ if (!sig) {
+ return nullptr;
+ }
+
+ SECStatus rv = PK11_SignWithMechanism(privKey.get(), mechanism(),
+ parameters(), sig.get(), hash.get());
+ if (rv != SECSuccess) {
+ return nullptr;
+ }
+
+ return sig;
}
- bool ImportPrivateKeyAndSignHashedData(const DataBuffer& pkcs8,
- const DataBuffer& data,
- DataBuffer* sig) {
- ScopedSECKEYPrivateKey privKey(ImportPrivateKey(pkcs8));
+ ScopedSECItem ImportPrivateKeyAndSignHashedData(const uint8_t* pkcs8,
+ size_t pkcs8_len,
+ const uint8_t* data,
+ size_t data_len) {
+ ScopedSECKEYPrivateKey privKey(ImportPrivateKey(pkcs8, pkcs8_len));
if (!privKey) {
- return false;
+ return nullptr;
}
- DataBuffer hash;
- if (!ComputeHash(data, &hash)) {
- ADD_FAILURE() << "Failed to compute hash";
- return false;
+ ScopedSECItem hash(ComputeHash(data, data_len));
+ if (!hash) {
+ return nullptr;
}
- return SignHashedData(privKey, hash, sig);
+
+ return ScopedSECItem(SignHashedData(privKey, hash));
}
- void Verify(const Pkcs11SignatureTestParams& params, const DataBuffer& sig) {
- ScopedSECKEYPublicKey pubKey(ImportPublicKey(params.spki_));
+ void Verify(const uint8_t* spki, size_t spki_len, const uint8_t* data,
+ size_t data_len, const uint8_t* sig, size_t sig_len) {
+ ScopedSECKEYPublicKey pubKey(ImportPublicKey(spki, spki_len));
ASSERT_TRUE(pubKey);
- DataBuffer hash;
- ASSERT_TRUE(ComputeHash(params.data_, &hash));
+ ScopedSECItem hash(ComputeHash(data, data_len));
+ ASSERT_TRUE(hash);
+
+ SECItem sigItem = {siBuffer, toUcharPtr(sig),
+ static_cast<unsigned int>(sig_len)};
// Verify.
- SECItem hashItem = {siBuffer, toUcharPtr(hash.data()),
- static_cast<unsigned int>(hash.len())};
- SECItem sigItem = {siBuffer, toUcharPtr(sig.data()),
- static_cast<unsigned int>(sig.len())};
SECStatus rv = PK11_VerifyWithMechanism(
- pubKey.get(), mechanism_, parameters(), &sigItem, &hashItem, nullptr);
+ pubKey.get(), mechanism(), parameters(), &sigItem, hash.get(), nullptr);
EXPECT_EQ(rv, SECSuccess);
}
- void Verify(const Pkcs11SignatureTestParams& params) {
- Verify(params, params.signature_);
- }
+ void SignAndVerify(const uint8_t* pkcs8, size_t pkcs8_len,
+ const uint8_t* spki, size_t spki_len, const uint8_t* data,
+ size_t data_len) {
+ ScopedSECItem sig(
+ ImportPrivateKeyAndSignHashedData(pkcs8, pkcs8_len, data, data_len));
+ ASSERT_TRUE(sig);
- void SignAndVerify(const Pkcs11SignatureTestParams& params) {
- DataBuffer sig;
- ASSERT_TRUE(
- ImportPrivateKeyAndSignHashedData(params.pkcs8_, params.data_, &sig));
- Verify(params, sig);
+ Verify(spki, spki_len, data, data_len, sig->data, sig->len);
}
-
- private:
- CK_MECHANISM_TYPE mechanism_;
- SECOidTag hash_oid_;
};
+#define SIG_TEST_VECTOR_VERIFY(spki, data, sig) \
+ Verify(spki, sizeof(spki), data, sizeof(data), sig, sizeof(sig));
+
+#define SIG_TEST_VECTOR_SIGN_VERIFY(pkcs8, spki, data) \
+ SignAndVerify(pkcs8, sizeof(pkcs8), spki, sizeof(spki), data, sizeof(data));
+
} // namespace nss_test
diff --git a/security/nss/gtests/softoken_gtest/Makefile b/security/nss/gtests/softoken_gtest/Makefile
deleted file mode 100644
index 996669782d..0000000000
--- a/security/nss/gtests/softoken_gtest/Makefile
+++ /dev/null
@@ -1,45 +0,0 @@
-#! gmake
-#
-# 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/.
-
-#######################################################################
-# (1) Include initial platform-independent assignments (MANDATORY). #
-#######################################################################
-
-include manifest.mn
-
-#######################################################################
-# (2) Include "global" configuration information. (OPTIONAL) #
-#######################################################################
-
-include $(CORE_DEPTH)/coreconf/config.mk
-
-#######################################################################
-# (3) Include "component" configuration information. (OPTIONAL) #
-#######################################################################
-
-
-#######################################################################
-# (4) Include "local" platform-dependent assignments (OPTIONAL). #
-#######################################################################
-
-include ../common/gtest.mk
-
-CFLAGS += -I$(CORE_DEPTH)/lib/util
-
-#######################################################################
-# (5) Execute "global" rules. (OPTIONAL) #
-#######################################################################
-
-include $(CORE_DEPTH)/coreconf/rules.mk
-
-#######################################################################
-# (6) Execute "component" rules. (OPTIONAL) #
-#######################################################################
-
-
-#######################################################################
-# (7) Execute "local" rules. (OPTIONAL). #
-#######################################################################
diff --git a/security/nss/gtests/softoken_gtest/manifest.mn b/security/nss/gtests/softoken_gtest/manifest.mn
deleted file mode 100644
index 4b34c099f5..0000000000
--- a/security/nss/gtests/softoken_gtest/manifest.mn
+++ /dev/null
@@ -1,25 +0,0 @@
-# -*- makefile -*-
-# 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/.
-CORE_DEPTH = ../..
-DEPTH = ../..
-MODULE = nss
-
-CPPSRCS = \
- softoken_gtest.cc \
- $(NULL)
-
-INCLUDES += \
- -I$(CORE_DEPTH)/gtests/google_test/gtest/include \
- -I$(CORE_DEPTH)/cpputil \
- $(NULL)
-
-REQUIRES = nspr gtest
-
-PROGRAM = softoken_gtest
-
-EXTRA_LIBS = \
- $(DIST)/lib/$(LIB_PREFIX)gtest.$(LIB_SUFFIX) \
- $(DIST)/lib/$(LIB_PREFIX)gtestutil.$(LIB_SUFFIX) \
- $(NULL)
diff --git a/security/nss/gtests/softoken_gtest/softoken_gtest.cc b/security/nss/gtests/softoken_gtest/softoken_gtest.cc
deleted file mode 100644
index d61e2e75fa..0000000000
--- a/security/nss/gtests/softoken_gtest/softoken_gtest.cc
+++ /dev/null
@@ -1,360 +0,0 @@
-#include <cstdlib>
-#if defined(_WIN32)
-#include <windows.h>
-#include <codecvt>
-#endif
-
-#include "cert.h"
-#include "certdb.h"
-#include "nspr.h"
-#include "nss.h"
-#include "pk11pub.h"
-#include "secerr.h"
-
-#include "scoped_ptrs.h"
-
-#define GTEST_HAS_RTTI 0
-#include "gtest/gtest.h"
-
-namespace nss_test {
-
-// Given a prefix, attempts to create a unique directory that the user can do
-// work in without impacting other tests. For example, if given the prefix
-// "scratch", a directory like "scratch05c17b25" will be created in the current
-// working directory (or the location specified by NSS_GTEST_WORKDIR, if
-// defined).
-// Upon destruction, the implementation will attempt to delete the directory.
-// However, no attempt is made to first remove files in the directory - the
-// user is responsible for this. If the directory is not empty, deleting it will
-// fail.
-// Statistically, it is technically possible to fail to create a unique
-// directory name, but this is extremely unlikely given the expected workload of
-// this implementation.
-class ScopedUniqueDirectory {
- public:
- explicit ScopedUniqueDirectory(const std::string &prefix);
-
- // NB: the directory must be empty upon destruction
- ~ScopedUniqueDirectory() { assert(rmdir(mPath.c_str()) == 0); }
-
- const std::string &GetPath() { return mPath; }
- const std::string &GetUTF8Path() { return mUTF8Path; }
-
- private:
- static const int RETRY_LIMIT = 5;
- static void GenerateRandomName(/*in/out*/ std::string &prefix);
- static bool TryMakingDirectory(/*in/out*/ std::string &prefix);
-
- std::string mPath;
- std::string mUTF8Path;
-};
-
-ScopedUniqueDirectory::ScopedUniqueDirectory(const std::string &prefix) {
- std::string path;
- const char *workingDirectory = PR_GetEnvSecure("NSS_GTEST_WORKDIR");
- if (workingDirectory) {
- path.assign(workingDirectory);
- }
- path.append(prefix);
- for (int i = 0; i < RETRY_LIMIT; i++) {
- std::string pathCopy(path);
- // TryMakingDirectory will modify its input. If it fails, we want to throw
- // away the modified result.
- if (TryMakingDirectory(pathCopy)) {
- mPath.assign(pathCopy);
- break;
- }
- }
- assert(mPath.length() > 0);
-#if defined(_WIN32)
- // sqldb always uses UTF-8 regardless of the current system locale.
- DWORD len =
- MultiByteToWideChar(CP_ACP, 0, mPath.data(), mPath.size(), nullptr, 0);
- std::vector<wchar_t> buf(len, L'\0');
- MultiByteToWideChar(CP_ACP, 0, mPath.data(), mPath.size(), buf.data(),
- buf.size());
- std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
- mUTF8Path = converter.to_bytes(std::wstring(buf.begin(), buf.end()));
-#else
- mUTF8Path = mPath;
-#endif
-}
-
-void ScopedUniqueDirectory::GenerateRandomName(std::string &prefix) {
- std::stringstream ss;
- ss << prefix;
- // RAND_MAX is at least 32767.
- ss << std::setfill('0') << std::setw(4) << std::hex << rand() << rand();
- // This will overwrite the value of prefix. This is a little inefficient, but
- // at least it makes the code simple.
- ss >> prefix;
-}
-
-bool ScopedUniqueDirectory::TryMakingDirectory(std::string &prefix) {
- GenerateRandomName(prefix);
-#if defined(_WIN32)
- return _mkdir(prefix.c_str()) == 0;
-#else
- return mkdir(prefix.c_str(), 0777) == 0;
-#endif
-}
-
-class SoftokenTest : public ::testing::Test {
- protected:
- SoftokenTest() : mNSSDBDir("SoftokenTest.d-") {}
- SoftokenTest(const std::string &prefix) : mNSSDBDir(prefix) {}
-
- virtual void SetUp() {
- std::string nssInitArg("sql:");
- nssInitArg.append(mNSSDBDir.GetUTF8Path());
- ASSERT_EQ(SECSuccess, NSS_Initialize(nssInitArg.c_str(), "", "", SECMOD_DB,
- NSS_INIT_NOROOTINIT));
- }
-
- virtual void TearDown() {
- ASSERT_EQ(SECSuccess, NSS_Shutdown());
- const std::string &nssDBDirPath = mNSSDBDir.GetPath();
- ASSERT_EQ(0, unlink((nssDBDirPath + "/cert9.db").c_str()));
- ASSERT_EQ(0, unlink((nssDBDirPath + "/key4.db").c_str()));
- ASSERT_EQ(0, unlink((nssDBDirPath + "/pkcs11.txt").c_str()));
- }
-
- ScopedUniqueDirectory mNSSDBDir;
-};
-
-TEST_F(SoftokenTest, ResetSoftokenEmptyPassword) {
- ScopedPK11SlotInfo slot(PK11_GetInternalKeySlot());
- ASSERT_TRUE(slot);
- EXPECT_EQ(SECSuccess, PK11_InitPin(slot.get(), nullptr, nullptr));
- EXPECT_EQ(SECSuccess, PK11_ResetToken(slot.get(), nullptr));
- EXPECT_EQ(SECSuccess, PK11_InitPin(slot.get(), nullptr, nullptr));
-}
-
-TEST_F(SoftokenTest, ResetSoftokenNonEmptyPassword) {
- ScopedPK11SlotInfo slot(PK11_GetInternalKeySlot());
- ASSERT_TRUE(slot);
- EXPECT_EQ(SECSuccess, PK11_InitPin(slot.get(), nullptr, "password"));
- EXPECT_EQ(SECSuccess, PK11_ResetToken(slot.get(), nullptr));
- EXPECT_EQ(SECSuccess, PK11_InitPin(slot.get(), nullptr, "password2"));
-}
-
-// Test certificate to use in the CreateObject tests.
-static const CK_OBJECT_CLASS cko_nss_trust = CKO_NSS_TRUST;
-static const CK_BBOOL ck_false = CK_FALSE;
-static const CK_BBOOL ck_true = CK_TRUE;
-static const CK_TRUST ckt_nss_must_verify_trust = CKT_NSS_MUST_VERIFY_TRUST;
-static const CK_TRUST ckt_nss_trusted_delegator = CKT_NSS_TRUSTED_DELEGATOR;
-static const CK_ATTRIBUTE attributes[] = {
- {CKA_CLASS, (void *)&cko_nss_trust, (PRUint32)sizeof(CK_OBJECT_CLASS)},
- {CKA_TOKEN, (void *)&ck_true, (PRUint32)sizeof(CK_BBOOL)},
- {CKA_PRIVATE, (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL)},
- {CKA_MODIFIABLE, (void *)&ck_false, (PRUint32)sizeof(CK_BBOOL)},
- {CKA_LABEL,
- (void *)"Symantec Class 2 Public Primary Certification Authority - G4",
- (PRUint32)61},
- {CKA_CERT_SHA1_HASH,
- (void *)"\147\044\220\056\110\001\260\042\226\100\020\106\264\261\147\054"
- "\251\165\375\053",
- (PRUint32)20},
- {CKA_CERT_MD5_HASH,
- (void *)"\160\325\060\361\332\224\227\324\327\164\337\276\355\150\336\226",
- (PRUint32)16},
- {CKA_ISSUER,
- (void *)"\060\201\224\061\013\060\011\006\003\125\004\006\023\002\125\123"
- "\061\035\060\033\006\003\125\004\012\023\024\123\171\155\141\156"
- "\164\145\143\040\103\157\162\160\157\162\141\164\151\157\156\061"
- "\037\060\035\006\003\125\004\013\023\026\123\171\155\141\156\164"
- "\145\143\040\124\162\165\163\164\040\116\145\164\167\157\162\153"
- "\061\105\060\103\006\003\125\004\003\023\074\123\171\155\141\156"
- "\164\145\143\040\103\154\141\163\163\040\062\040\120\165\142\154"
- "\151\143\040\120\162\151\155\141\162\171\040\103\145\162\164\151"
- "\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151"
- "\164\171\040\055\040\107\064",
- (PRUint32)151},
- {CKA_SERIAL_NUMBER,
- (void *)"\002\020\064\027\145\022\100\073\267\126\200\055\200\313\171\125"
- "\246\036",
- (PRUint32)18},
- {CKA_TRUST_SERVER_AUTH, (void *)&ckt_nss_must_verify_trust,
- (PRUint32)sizeof(CK_TRUST)},
- {CKA_TRUST_EMAIL_PROTECTION, (void *)&ckt_nss_trusted_delegator,
- (PRUint32)sizeof(CK_TRUST)},
- {CKA_TRUST_CODE_SIGNING, (void *)&ckt_nss_must_verify_trust,
- (PRUint32)sizeof(CK_TRUST)},
- {CKA_TRUST_STEP_UP_APPROVED, (void *)&ck_false,
- (PRUint32)sizeof(CK_BBOOL)}};
-
-TEST_F(SoftokenTest, CreateObjectNonEmptyPassword) {
- ScopedPK11SlotInfo slot(PK11_GetInternalKeySlot());
- ASSERT_TRUE(slot);
- EXPECT_EQ(SECSuccess, PK11_InitPin(slot.get(), nullptr, "password"));
- EXPECT_EQ(SECSuccess, PK11_Logout(slot.get()));
- ScopedPK11GenericObject obj(PK11_CreateGenericObject(
- slot.get(), attributes, PR_ARRAY_SIZE(attributes), true));
- EXPECT_EQ(nullptr, obj);
-}
-
-TEST_F(SoftokenTest, CreateObjectChangePassword) {
- ScopedPK11SlotInfo slot(PK11_GetInternalKeySlot());
- ASSERT_TRUE(slot);
- EXPECT_EQ(SECSuccess, PK11_InitPin(slot.get(), nullptr, nullptr));
- EXPECT_EQ(SECSuccess, PK11_ChangePW(slot.get(), "", "password"));
- EXPECT_EQ(SECSuccess, PK11_Logout(slot.get()));
- ScopedPK11GenericObject obj(PK11_CreateGenericObject(
- slot.get(), attributes, PR_ARRAY_SIZE(attributes), true));
- EXPECT_EQ(nullptr, obj);
-}
-
-TEST_F(SoftokenTest, CreateObjectChangeToEmptyPassword) {
- ScopedPK11SlotInfo slot(PK11_GetInternalKeySlot());
- ASSERT_TRUE(slot);
- EXPECT_EQ(SECSuccess, PK11_InitPin(slot.get(), nullptr, "password"));
- EXPECT_EQ(SECSuccess, PK11_ChangePW(slot.get(), "password", ""));
- // PK11_Logout returnes an error and SEC_ERROR_TOKEN_NOT_LOGGED_IN if the user
- // is not "logged in".
- EXPECT_EQ(SECFailure, PK11_Logout(slot.get()));
- EXPECT_EQ(SEC_ERROR_TOKEN_NOT_LOGGED_IN, PORT_GetError());
- ScopedPK11GenericObject obj(PK11_CreateGenericObject(
- slot.get(), attributes, PR_ARRAY_SIZE(attributes), true));
- // Because there's no password we can't logout and the operation should have
- // succeeded.
- EXPECT_NE(nullptr, obj);
-}
-
-class SoftokenNonAsciiTest : public SoftokenTest {
- protected:
- SoftokenNonAsciiTest() : SoftokenTest("SoftokenTest.\xF7-") {}
-};
-
-TEST_F(SoftokenNonAsciiTest, NonAsciiPathWorking) {
- ScopedPK11SlotInfo slot(PK11_GetInternalKeySlot());
- ASSERT_TRUE(slot);
- EXPECT_EQ(SECSuccess, PK11_InitPin(slot.get(), nullptr, nullptr));
- EXPECT_EQ(SECSuccess, PK11_ResetToken(slot.get(), nullptr));
- EXPECT_EQ(SECSuccess, PK11_InitPin(slot.get(), nullptr, nullptr));
-}
-
-// This is just any X509 certificate. Its contents don't matter.
-static unsigned char certDER[] = {
- 0x30, 0x82, 0x01, 0xEF, 0x30, 0x82, 0x01, 0x94, 0xA0, 0x03, 0x02, 0x01,
- 0x02, 0x02, 0x14, 0x49, 0xC4, 0xC4, 0x4A, 0xB6, 0x86, 0x07, 0xA3, 0x06,
- 0xDC, 0x4D, 0xC8, 0xC3, 0xFE, 0xC7, 0x21, 0x3A, 0x2D, 0xE4, 0xDA, 0x30,
- 0x0B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B,
- 0x30, 0x0F, 0x31, 0x0D, 0x30, 0x0B, 0x06, 0x03, 0x55, 0x04, 0x03, 0x0C,
- 0x04, 0x74, 0x65, 0x73, 0x74, 0x30, 0x22, 0x18, 0x0F, 0x32, 0x30, 0x31,
- 0x35, 0x31, 0x31, 0x32, 0x38, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5A,
- 0x18, 0x0F, 0x32, 0x30, 0x31, 0x38, 0x30, 0x32, 0x30, 0x35, 0x30, 0x30,
- 0x30, 0x30, 0x30, 0x30, 0x5A, 0x30, 0x0F, 0x31, 0x0D, 0x30, 0x0B, 0x06,
- 0x03, 0x55, 0x04, 0x03, 0x0C, 0x04, 0x74, 0x65, 0x73, 0x74, 0x30, 0x82,
- 0x01, 0x22, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D,
- 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82,
- 0x01, 0x0A, 0x02, 0x82, 0x01, 0x01, 0x00, 0xBA, 0x88, 0x51, 0xA8, 0x44,
- 0x8E, 0x16, 0xD6, 0x41, 0xFD, 0x6E, 0xB6, 0x88, 0x06, 0x36, 0x10, 0x3D,
- 0x3C, 0x13, 0xD9, 0xEA, 0xE4, 0x35, 0x4A, 0xB4, 0xEC, 0xF5, 0x68, 0x57,
- 0x6C, 0x24, 0x7B, 0xC1, 0xC7, 0x25, 0xA8, 0xE0, 0xD8, 0x1F, 0xBD, 0xB1,
- 0x9C, 0x06, 0x9B, 0x6E, 0x1A, 0x86, 0xF2, 0x6B, 0xE2, 0xAF, 0x5A, 0x75,
- 0x6B, 0x6A, 0x64, 0x71, 0x08, 0x7A, 0xA5, 0x5A, 0xA7, 0x45, 0x87, 0xF7,
- 0x1C, 0xD5, 0x24, 0x9C, 0x02, 0x7E, 0xCD, 0x43, 0xFC, 0x1E, 0x69, 0xD0,
- 0x38, 0x20, 0x29, 0x93, 0xAB, 0x20, 0xC3, 0x49, 0xE4, 0xDB, 0xB9, 0x4C,
- 0xC2, 0x6B, 0x6C, 0x0E, 0xED, 0x15, 0x82, 0x0F, 0xF1, 0x7E, 0xAD, 0x69,
- 0x1A, 0xB1, 0xD3, 0x02, 0x3A, 0x8B, 0x2A, 0x41, 0xEE, 0xA7, 0x70, 0xE0,
- 0x0F, 0x0D, 0x8D, 0xFD, 0x66, 0x0B, 0x2B, 0xB0, 0x24, 0x92, 0xA4, 0x7D,
- 0xB9, 0x88, 0x61, 0x79, 0x90, 0xB1, 0x57, 0x90, 0x3D, 0xD2, 0x3B, 0xC5,
- 0xE0, 0xB8, 0x48, 0x1F, 0xA8, 0x37, 0xD3, 0x88, 0x43, 0xEF, 0x27, 0x16,
- 0xD8, 0x55, 0xB7, 0x66, 0x5A, 0xAA, 0x7E, 0x02, 0x90, 0x2F, 0x3A, 0x7B,
- 0x10, 0x80, 0x06, 0x24, 0xCC, 0x1C, 0x6C, 0x97, 0xAD, 0x96, 0x61, 0x5B,
- 0xB7, 0xE2, 0x96, 0x12, 0xC0, 0x75, 0x31, 0xA3, 0x0C, 0x91, 0xDD, 0xB4,
- 0xCA, 0xF7, 0xFC, 0xAD, 0x1D, 0x25, 0xD3, 0x09, 0xEF, 0xB9, 0x17, 0x0E,
- 0xA7, 0x68, 0xE1, 0xB3, 0x7B, 0x2F, 0x22, 0x6F, 0x69, 0xE3, 0xB4, 0x8A,
- 0x95, 0x61, 0x1D, 0xEE, 0x26, 0xD6, 0x25, 0x9D, 0xAB, 0x91, 0x08, 0x4E,
- 0x36, 0xCB, 0x1C, 0x24, 0x04, 0x2C, 0xBF, 0x16, 0x8B, 0x2F, 0xE5, 0xF1,
- 0x8F, 0x99, 0x17, 0x31, 0xB8, 0xB3, 0xFE, 0x49, 0x23, 0xFA, 0x72, 0x51,
- 0xC4, 0x31, 0xD5, 0x03, 0xAC, 0xDA, 0x18, 0x0A, 0x35, 0xED, 0x8D, 0x02,
- 0x03, 0x01, 0x00, 0x01, 0x30, 0x0B, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
- 0xF7, 0x0D, 0x01, 0x01, 0x0B, 0x03, 0x48, 0x00, 0x30, 0x45, 0x02, 0x20,
- 0x5C, 0x75, 0x51, 0x9F, 0x13, 0x11, 0x50, 0xCD, 0x5D, 0x8A, 0xDE, 0x20,
- 0xA3, 0xBC, 0x06, 0x30, 0x91, 0xFF, 0xB2, 0x73, 0x75, 0x5F, 0x31, 0x64,
- 0xEC, 0xFD, 0xCB, 0x42, 0x80, 0x0A, 0x70, 0xE6, 0x02, 0x21, 0x00, 0x82,
- 0x12, 0xF7, 0xE5, 0xEA, 0x40, 0x27, 0xFD, 0xF7, 0xC0, 0x0E, 0x25, 0xF3,
- 0x3E, 0x34, 0x95, 0x80, 0xB9, 0xA3, 0x38, 0xE0, 0x56, 0x68, 0xDA, 0xE5,
- 0xC1, 0xF5, 0x37, 0xC7, 0xB5, 0xCE, 0x0D};
-
-struct PasswordPair {
- const char *mInitialPassword;
- const char *mSecondPassword;
-};
-
-class SoftokenPasswordChangeTest
- : public SoftokenTest,
- public ::testing::WithParamInterface<PasswordPair> {};
-
-TEST_P(SoftokenPasswordChangeTest, KeepTrustAfterPasswordChange) {
- const PasswordPair &passwords = GetParam();
- ScopedPK11SlotInfo slot(PK11_GetInternalKeySlot());
- ASSERT_TRUE(slot);
- // Set a password.
- EXPECT_EQ(SECSuccess,
- PK11_InitPin(slot.get(), nullptr, passwords.mInitialPassword));
- SECItem certDERItem = {siBuffer, certDER, sizeof(certDER)};
- // Import a certificate.
- ScopedCERTCertificate cert(CERT_NewTempCertificate(
- CERT_GetDefaultCertDB(), &certDERItem, nullptr, true, true));
- EXPECT_TRUE(cert);
- SECStatus result =
- PK11_ImportCert(slot.get(), cert.get(), CK_INVALID_HANDLE, "test", false);
- EXPECT_EQ(SECSuccess, result);
- // Set a trust value.
- CERTCertTrust trust = {CERTDB_TRUSTED_CLIENT_CA | CERTDB_NS_TRUSTED_CA |
- CERTDB_TRUSTED_CA | CERTDB_VALID_CA,
- 0, 0};
- result = CERT_ChangeCertTrust(nullptr, cert.get(), &trust);
- EXPECT_EQ(SECSuccess, result);
- // Release the certificate to ensure we get it from the DB rather than an
- // in-memory cache, below.
- cert = nullptr;
- // Change the password.
- result = PK11_ChangePW(slot.get(), passwords.mInitialPassword,
- passwords.mSecondPassword);
- EXPECT_EQ(SECSuccess, result);
- // Look up the certificate again.
- ScopedCERTCertificate newCert(
- PK11_FindCertFromDERCertItem(slot.get(), &certDERItem, nullptr));
- EXPECT_TRUE(newCert.get());
- // The trust should be the same as before.
- CERTCertTrust newTrust = {0, 0, 0};
- result = CERT_GetCertTrust(newCert.get(), &newTrust);
- EXPECT_EQ(SECSuccess, result);
- EXPECT_EQ(trust.sslFlags, newTrust.sslFlags);
- EXPECT_EQ(trust.emailFlags, newTrust.emailFlags);
- EXPECT_EQ(trust.objectSigningFlags, newTrust.objectSigningFlags);
-}
-
-static const PasswordPair PASSWORD_CHANGE_TESTS[] = {
- {"password", ""}, // non-empty to empty password
- {"", "password"}, // empty to non-empty password
- {"password", "password2"}, // non-empty to non-empty password
-};
-
-INSTANTIATE_TEST_CASE_P(SoftokenPasswordChangeTests, SoftokenPasswordChangeTest,
- ::testing::ValuesIn(PASSWORD_CHANGE_TESTS));
-
-class SoftokenNoDBTest : public ::testing::Test {};
-
-TEST_F(SoftokenNoDBTest, NeedUserInitNoDB) {
- ASSERT_EQ(SECSuccess, NSS_NoDB_Init("."));
- ScopedPK11SlotInfo slot(PK11_GetInternalKeySlot());
- ASSERT_TRUE(slot);
- EXPECT_EQ(PR_FALSE, PK11_NeedUserInit(slot.get()));
-
- // When shutting down in here we have to release the slot first.
- slot = nullptr;
- ASSERT_EQ(SECSuccess, NSS_Shutdown());
-}
-
-} // namespace nss_test
-
-int main(int argc, char **argv) {
- ::testing::InitGoogleTest(&argc, argv);
-
- return RUN_ALL_TESTS();
-}
diff --git a/security/nss/gtests/softoken_gtest/softoken_gtest.gyp b/security/nss/gtests/softoken_gtest/softoken_gtest.gyp
deleted file mode 100644
index cff0ea414a..0000000000
--- a/security/nss/gtests/softoken_gtest/softoken_gtest.gyp
+++ /dev/null
@@ -1,51 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-{
- 'includes': [
- '../../coreconf/config.gypi',
- '../common/gtest.gypi',
- ],
- 'targets': [
- {
- 'target_name': 'softoken_gtest',
- 'type': 'executable',
- 'sources': [
- 'softoken_gtest.cc',
- ],
- 'dependencies': [
- '<(DEPTH)/exports.gyp:nss_exports',
- '<(DEPTH)/lib/util/util.gyp:nssutil3',
- '<(DEPTH)/gtests/google_test/google_test.gyp:gtest',
- ],
- 'conditions': [
- [ 'test_build==1', {
- 'dependencies': [
- '<(DEPTH)/lib/nss/nss.gyp:nss_static',
- '<(DEPTH)/lib/pk11wrap/pk11wrap.gyp:pk11wrap_static',
- '<(DEPTH)/lib/cryptohi/cryptohi.gyp:cryptohi',
- '<(DEPTH)/lib/certhigh/certhigh.gyp:certhi',
- '<(DEPTH)/lib/certdb/certdb.gyp:certdb',
- '<(DEPTH)/lib/base/base.gyp:nssb',
- '<(DEPTH)/lib/dev/dev.gyp:nssdev',
- '<(DEPTH)/lib/pki/pki.gyp:nsspki',
- '<(DEPTH)/lib/ssl/ssl.gyp:ssl',
- ],
- }, {
- 'dependencies': [
- '<(DEPTH)/lib/nss/nss.gyp:nss3',
- '<(DEPTH)/lib/ssl/ssl.gyp:ssl3',
- ],
- }],
- ],
- }
- ],
- 'target_defaults': {
- 'include_dirs': [
- '../../lib/util'
- ]
- },
- 'variables': {
- 'module': 'nss'
- }
-}
diff --git a/security/nss/gtests/ssl_gtest/Makefile b/security/nss/gtests/ssl_gtest/Makefile
index 95c111aebd..a9a9290e00 100644
--- a/security/nss/gtests/ssl_gtest/Makefile
+++ b/security/nss/gtests/ssl_gtest/Makefile
@@ -29,6 +29,10 @@ include ../common/gtest.mk
CFLAGS += -I$(CORE_DEPTH)/lib/ssl
+ifdef NSS_SSL_ENABLE_ZLIB
+include $(CORE_DEPTH)/coreconf/zlib.mk
+endif
+
ifdef NSS_DISABLE_TLS_1_3
NSS_DISABLE_TLS_1_3=1
# Run parameterized tests only, for which we can easily exclude TLS 1.3
diff --git a/security/nss/gtests/ssl_gtest/bloomfilter_unittest.cc b/security/nss/gtests/ssl_gtest/bloomfilter_unittest.cc
deleted file mode 100644
index 110cfa13a9..0000000000
--- a/security/nss/gtests/ssl_gtest/bloomfilter_unittest.cc
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-extern "C" {
-#include "sslbloom.h"
-}
-
-#include "gtest_utils.h"
-
-namespace nss_test {
-
-// Some random-ish inputs to test with. These don't result in collisions in any
-// of the configurations that are tested below.
-static const uint8_t kHashes1[] = {
- 0x79, 0x53, 0xb8, 0xdd, 0x6b, 0x98, 0xce, 0x00, 0xb7, 0xdc, 0xe8,
- 0x03, 0x70, 0x8c, 0xe3, 0xac, 0x06, 0x8b, 0x22, 0xfd, 0x0e, 0x34,
- 0x48, 0xe6, 0xe5, 0xe0, 0x8a, 0xd6, 0x16, 0x18, 0xe5, 0x48};
-static const uint8_t kHashes2[] = {
- 0xc6, 0xdd, 0x6e, 0xc4, 0x76, 0xb8, 0x55, 0xf2, 0xa4, 0xfc, 0x59,
- 0x04, 0xa4, 0x90, 0xdc, 0xa7, 0xa7, 0x0d, 0x94, 0x8f, 0xc2, 0xdc,
- 0x15, 0x6d, 0x48, 0x93, 0x9d, 0x05, 0xbb, 0x9a, 0xbc, 0xc1};
-
-typedef struct {
- unsigned int k;
- unsigned int bits;
-} BloomFilterConfig;
-
-class BloomFilterTest
- : public ::testing::Test,
- public ::testing::WithParamInterface<BloomFilterConfig> {
- public:
- BloomFilterTest() : filter_() {}
-
- void SetUp() { Init(); }
-
- void TearDown() { sslBloom_Destroy(&filter_); }
-
- protected:
- void Init() {
- if (filter_.filter) {
- sslBloom_Destroy(&filter_);
- }
- ASSERT_EQ(SECSuccess,
- sslBloom_Init(&filter_, GetParam().k, GetParam().bits));
- }
-
- bool Check(const uint8_t* hashes) {
- return sslBloom_Check(&filter_, hashes) ? true : false;
- }
-
- void Add(const uint8_t* hashes, bool expect_collision = false) {
- EXPECT_EQ(expect_collision, sslBloom_Add(&filter_, hashes) ? true : false);
- EXPECT_TRUE(Check(hashes));
- }
-
- sslBloomFilter filter_;
-};
-
-TEST_P(BloomFilterTest, InitOnly) {}
-
-TEST_P(BloomFilterTest, AddToEmpty) {
- EXPECT_FALSE(Check(kHashes1));
- Add(kHashes1);
-}
-
-TEST_P(BloomFilterTest, AddTwo) {
- Add(kHashes1);
- Add(kHashes2);
-}
-
-TEST_P(BloomFilterTest, AddOneTwice) {
- Add(kHashes1);
- Add(kHashes1, true);
-}
-
-TEST_P(BloomFilterTest, Zero) {
- Add(kHashes1);
- sslBloom_Zero(&filter_);
- EXPECT_FALSE(Check(kHashes1));
- EXPECT_FALSE(Check(kHashes2));
-}
-
-TEST_P(BloomFilterTest, Fill) {
- sslBloom_Fill(&filter_);
- EXPECT_TRUE(Check(kHashes1));
- EXPECT_TRUE(Check(kHashes2));
-}
-
-static const BloomFilterConfig kBloomFilterConfigurations[] = {
- {1, 1}, // 1 hash, 1 bit input - high chance of collision.
- {1, 2}, // 1 hash, 2 bits - smaller than the basic unit size.
- {1, 3}, // 1 hash, 3 bits - same as basic unit size.
- {1, 4}, // 1 hash, 4 bits - 2 octets each.
- {3, 10}, // 3 hashes over a reasonable number of bits.
- {3, 3}, // Test that we can read multiple bits.
- {4, 15}, // A credible filter.
- {2, 18}, // A moderately large allocation.
- {16, 16}, // Insane, use all of the bits from the hashes.
- {16, 9}, // This also uses all of the bits from the hashes.
-};
-
-INSTANTIATE_TEST_CASE_P(BloomFilterConfigurations, BloomFilterTest,
- ::testing::ValuesIn(kBloomFilterConfigurations));
-
-} // namespace nspr_test
diff --git a/security/nss/gtests/ssl_gtest/libssl_internals.c b/security/nss/gtests/ssl_gtest/libssl_internals.c
index 887d852786..97b8354aec 100644
--- a/security/nss/gtests/ssl_gtest/libssl_internals.c
+++ b/security/nss/gtests/ssl_gtest/libssl_internals.c
@@ -34,17 +34,18 @@ SECStatus SSLInt_UpdateSSLv2ClientRandom(PRFileDesc *fd, uint8_t *rnd,
return SECFailure;
}
+ ssl3_InitState(ss);
ssl3_RestartHandshakeHashes(ss);
// Ensure we don't overrun hs.client_random.
rnd_len = PR_MIN(SSL3_RANDOM_LENGTH, rnd_len);
- // Zero the client_random.
- PORT_Memset(ss->ssl3.hs.client_random, 0, SSL3_RANDOM_LENGTH);
+ // Zero the client_random struct.
+ PORT_Memset(&ss->ssl3.hs.client_random, 0, SSL3_RANDOM_LENGTH);
// Copy over the challenge bytes.
size_t offset = SSL3_RANDOM_LENGTH - rnd_len;
- PORT_Memcpy(ss->ssl3.hs.client_random + offset, rnd, rnd_len);
+ PORT_Memcpy(&ss->ssl3.hs.client_random.rand[offset], rnd, rnd_len);
// Rehash the SSLv2 client hello message.
return ssl3_UpdateHandshakeHashes(ss, msg, msg_len);
@@ -72,11 +73,10 @@ SECStatus SSLInt_SetMTU(PRFileDesc *fd, PRUint16 mtu) {
return SECFailure;
}
ss->ssl3.mtu = mtu;
- ss->ssl3.hs.rtRetries = 0; /* Avoid DTLS shrinking the MTU any more. */
return SECSuccess;
}
-PRInt32 SSLInt_CountCipherSpecs(PRFileDesc *fd) {
+PRInt32 SSLInt_CountTls13CipherSpecs(PRFileDesc *fd) {
PRCList *cur_p;
PRInt32 ct = 0;
@@ -92,7 +92,7 @@ PRInt32 SSLInt_CountCipherSpecs(PRFileDesc *fd) {
return ct;
}
-void SSLInt_PrintCipherSpecs(const char *label, PRFileDesc *fd) {
+void SSLInt_PrintTls13CipherSpecs(PRFileDesc *fd) {
PRCList *cur_p;
sslSocket *ss = ssl_FindSocket(fd);
@@ -100,31 +100,27 @@ void SSLInt_PrintCipherSpecs(const char *label, PRFileDesc *fd) {
return;
}
- fprintf(stderr, "Cipher specs for %s\n", label);
+ fprintf(stderr, "Cipher specs\n");
for (cur_p = PR_NEXT_LINK(&ss->ssl3.hs.cipherSpecs);
cur_p != &ss->ssl3.hs.cipherSpecs; cur_p = PR_NEXT_LINK(cur_p)) {
ssl3CipherSpec *spec = (ssl3CipherSpec *)cur_p;
- fprintf(stderr, " %s spec epoch=%d (%s) refct=%d\n", SPEC_DIR(spec),
- spec->epoch, spec->phase, spec->refCt);
+ fprintf(stderr, " %s\n", spec->phase);
}
}
-/* Force a timer expiry by backdating when all active timers were started. We
- * could set the remaining time to 0 but then backoff would not work properly if
- * we decide to test it. */
-SECStatus SSLInt_ShiftDtlsTimers(PRFileDesc *fd, PRIntervalTime shift) {
- size_t i;
+/* Force a timer expiry by backdating when the timer was started.
+ * We could set the remaining time to 0 but then backoff would not
+ * work properly if we decide to test it. */
+void SSLInt_ForceTimerExpiry(PRFileDesc *fd) {
sslSocket *ss = ssl_FindSocket(fd);
if (!ss) {
- return SECFailure;
+ return;
}
- for (i = 0; i < PR_ARRAY_SIZE(ss->ssl3.hs.timers); ++i) {
- if (ss->ssl3.hs.timers[i].cb) {
- ss->ssl3.hs.timers[i].started -= shift;
- }
- }
- return SECSuccess;
+ if (!ss->ssl3.hs.rtTimerCb) return;
+
+ ss->ssl3.hs.rtTimerStarted =
+ PR_IntervalNow() - PR_MillisecondsToInterval(ss->ssl3.hs.rtTimeoutMs + 1);
}
#define CHECK_SECRET(secret) \
@@ -140,6 +136,7 @@ PRBool SSLInt_CheckSecretsDestroyed(PRFileDesc *fd) {
}
CHECK_SECRET(currentSecret);
+ CHECK_SECRET(resumptionMasterSecret);
CHECK_SECRET(dheSecret);
CHECK_SECRET(clientEarlyTrafficSecret);
CHECK_SECRET(clientHsTrafficSecret);
@@ -229,7 +226,28 @@ PRBool SSLInt_SendAlert(PRFileDesc *fd, uint8_t level, uint8_t type) {
return PR_TRUE;
}
+PRBool SSLInt_SendNewSessionTicket(PRFileDesc *fd) {
+ sslSocket *ss = ssl_FindSocket(fd);
+ if (!ss) {
+ return PR_FALSE;
+ }
+
+ ssl_GetSSL3HandshakeLock(ss);
+ ssl_GetXmitBufLock(ss);
+
+ SECStatus rv = tls13_SendNewSessionTicket(ss);
+ if (rv == SECSuccess) {
+ rv = ssl3_FlushHandshake(ss, 0);
+ }
+
+ ssl_ReleaseXmitBufLock(ss);
+ ssl_ReleaseSSL3HandshakeLock(ss);
+
+ return rv == SECSuccess;
+}
+
SECStatus SSLInt_AdvanceReadSeqNum(PRFileDesc *fd, PRUint64 to) {
+ PRUint64 epoch;
sslSocket *ss;
ssl3CipherSpec *spec;
@@ -237,40 +255,43 @@ SECStatus SSLInt_AdvanceReadSeqNum(PRFileDesc *fd, PRUint64 to) {
if (!ss) {
return SECFailure;
}
- if (to >= RECORD_SEQ_MAX) {
+ if (to >= (1ULL << 48)) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
return SECFailure;
}
ssl_GetSpecWriteLock(ss);
spec = ss->ssl3.crSpec;
- spec->seqNum = to;
+ epoch = spec->read_seq_num >> 48;
+ spec->read_seq_num = (epoch << 48) | to;
/* For DTLS, we need to fix the record sequence number. For this, we can just
* scrub the entire structure on the assumption that the new sequence number
* is far enough past the last received sequence number. */
- if (spec->seqNum <= spec->recvdRecords.right + DTLS_RECVD_RECORDS_WINDOW) {
+ if (to <= spec->recvdRecords.right + DTLS_RECVD_RECORDS_WINDOW) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
return SECFailure;
}
- dtls_RecordSetRecvd(&spec->recvdRecords, spec->seqNum);
+ dtls_RecordSetRecvd(&spec->recvdRecords, to);
ssl_ReleaseSpecWriteLock(ss);
return SECSuccess;
}
SECStatus SSLInt_AdvanceWriteSeqNum(PRFileDesc *fd, PRUint64 to) {
+ PRUint64 epoch;
sslSocket *ss;
ss = ssl_FindSocket(fd);
if (!ss) {
return SECFailure;
}
- if (to >= RECORD_SEQ_MAX) {
+ if (to >= (1ULL << 48)) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
return SECFailure;
}
ssl_GetSpecWriteLock(ss);
- ss->ssl3.cwSpec->seqNum = to;
+ epoch = ss->ssl3.cwSpec->write_seq_num >> 48;
+ ss->ssl3.cwSpec->write_seq_num = (epoch << 48) | to;
ssl_ReleaseSpecWriteLock(ss);
return SECSuccess;
}
@@ -284,9 +305,9 @@ SECStatus SSLInt_AdvanceWriteSeqByAWindow(PRFileDesc *fd, PRInt32 extra) {
return SECFailure;
}
ssl_GetSpecReadLock(ss);
- to = ss->ssl3.cwSpec->seqNum + DTLS_RECVD_RECORDS_WINDOW + extra;
+ to = ss->ssl3.cwSpec->write_seq_num + DTLS_RECVD_RECORDS_WINDOW + extra;
ssl_ReleaseSpecReadLock(ss);
- return SSLInt_AdvanceWriteSeqNum(fd, to);
+ return SSLInt_AdvanceWriteSeqNum(fd, to & RECORD_SEQ_MAX);
}
SSLKEAType SSLInt_GetKEAType(SSLNamedGroup group) {
@@ -312,20 +333,46 @@ SECStatus SSLInt_SetCipherSpecChangeFunc(PRFileDesc *fd,
return SECSuccess;
}
-PK11SymKey *SSLInt_CipherSpecToKey(const ssl3CipherSpec *spec) {
- return spec->keyMaterial.key;
+static ssl3KeyMaterial *GetKeyingMaterial(PRBool isServer,
+ ssl3CipherSpec *spec) {
+ return isServer ? &spec->server : &spec->client;
}
-SSLCipherAlgorithm SSLInt_CipherSpecToAlgorithm(const ssl3CipherSpec *spec) {
- return spec->cipherDef->calg;
+PK11SymKey *SSLInt_CipherSpecToKey(PRBool isServer, ssl3CipherSpec *spec) {
+ return GetKeyingMaterial(isServer, spec)->write_key;
}
-const PRUint8 *SSLInt_CipherSpecToIv(const ssl3CipherSpec *spec) {
- return spec->keyMaterial.iv;
+SSLCipherAlgorithm SSLInt_CipherSpecToAlgorithm(PRBool isServer,
+ ssl3CipherSpec *spec) {
+ return spec->cipher_def->calg;
}
-PRUint16 SSLInt_CipherSpecToEpoch(const ssl3CipherSpec *spec) {
- return spec->epoch;
+unsigned char *SSLInt_CipherSpecToIv(PRBool isServer, ssl3CipherSpec *spec) {
+ return GetKeyingMaterial(isServer, spec)->write_iv;
+}
+
+SECStatus SSLInt_EnableShortHeaders(PRFileDesc *fd) {
+ sslSocket *ss;
+
+ ss = ssl_FindSocket(fd);
+ if (!ss) {
+ return SECFailure;
+ }
+
+ ss->opt.enableShortHeaders = PR_TRUE;
+ return SECSuccess;
+}
+
+SECStatus SSLInt_UsingShortHeaders(PRFileDesc *fd, PRBool *result) {
+ sslSocket *ss;
+
+ ss = ssl_FindSocket(fd);
+ if (!ss) {
+ return SECFailure;
+ }
+
+ *result = ss->ssl3.hs.shortHeaders;
+ return SECSuccess;
}
void SSLInt_SetTicketLifetime(uint32_t lifetime) {
@@ -358,21 +405,3 @@ SECStatus SSLInt_SetSocketMaxEarlyDataSize(PRFileDesc *fd, uint32_t size) {
return SECSuccess;
}
-
-void SSLInt_RolloverAntiReplay(void) {
- tls13_AntiReplayRollover(ssl_TimeUsec());
-}
-
-SECStatus SSLInt_GetEpochs(PRFileDesc *fd, PRUint16 *readEpoch,
- PRUint16 *writeEpoch) {
- sslSocket *ss = ssl_FindSocket(fd);
- if (!ss || !readEpoch || !writeEpoch) {
- return SECFailure;
- }
-
- ssl_GetSpecReadLock(ss);
- *readEpoch = ss->ssl3.crSpec->epoch;
- *writeEpoch = ss->ssl3.cwSpec->epoch;
- ssl_ReleaseSpecReadLock(ss);
- return SECSuccess;
-}
diff --git a/security/nss/gtests/ssl_gtest/libssl_internals.h b/security/nss/gtests/ssl_gtest/libssl_internals.h
index 95d4afdaf9..33709c4b4e 100644
--- a/security/nss/gtests/ssl_gtest/libssl_internals.h
+++ b/security/nss/gtests/ssl_gtest/libssl_internals.h
@@ -24,9 +24,9 @@ SECStatus SSLInt_UpdateSSLv2ClientRandom(PRFileDesc *fd, uint8_t *rnd,
PRBool SSLInt_ExtensionNegotiated(PRFileDesc *fd, PRUint16 ext);
void SSLInt_ClearSelfEncryptKey();
void SSLInt_SetSelfEncryptMacKey(PK11SymKey *key);
-PRInt32 SSLInt_CountCipherSpecs(PRFileDesc *fd);
-void SSLInt_PrintCipherSpecs(const char *label, PRFileDesc *fd);
-SECStatus SSLInt_ShiftDtlsTimers(PRFileDesc *fd, PRIntervalTime shift);
+PRInt32 SSLInt_CountTls13CipherSpecs(PRFileDesc *fd);
+void SSLInt_PrintTls13CipherSpecs(PRFileDesc *fd);
+void SSLInt_ForceTimerExpiry(PRFileDesc *fd);
SECStatus SSLInt_SetMTU(PRFileDesc *fd, PRUint16 mtu);
PRBool SSLInt_CheckSecretsDestroyed(PRFileDesc *fd);
PRBool SSLInt_DamageClientHsTrafficSecret(PRFileDesc *fd);
@@ -35,23 +35,23 @@ PRBool SSLInt_DamageEarlyTrafficSecret(PRFileDesc *fd);
SECStatus SSLInt_Set0RttAlpn(PRFileDesc *fd, PRUint8 *data, unsigned int len);
PRBool SSLInt_HasCertWithAuthType(PRFileDesc *fd, SSLAuthType authType);
PRBool SSLInt_SendAlert(PRFileDesc *fd, uint8_t level, uint8_t type);
+PRBool SSLInt_SendNewSessionTicket(PRFileDesc *fd);
SECStatus SSLInt_AdvanceWriteSeqNum(PRFileDesc *fd, PRUint64 to);
SECStatus SSLInt_AdvanceReadSeqNum(PRFileDesc *fd, PRUint64 to);
SECStatus SSLInt_AdvanceWriteSeqByAWindow(PRFileDesc *fd, PRInt32 extra);
SSLKEAType SSLInt_GetKEAType(SSLNamedGroup group);
-SECStatus SSLInt_GetEpochs(PRFileDesc *fd, PRUint16 *readEpoch,
- PRUint16 *writeEpoch);
SECStatus SSLInt_SetCipherSpecChangeFunc(PRFileDesc *fd,
sslCipherSpecChangedFunc func,
void *arg);
-PRUint16 SSLInt_CipherSpecToEpoch(const ssl3CipherSpec *spec);
-PK11SymKey *SSLInt_CipherSpecToKey(const ssl3CipherSpec *spec);
-SSLCipherAlgorithm SSLInt_CipherSpecToAlgorithm(const ssl3CipherSpec *spec);
-const PRUint8 *SSLInt_CipherSpecToIv(const ssl3CipherSpec *spec);
+PK11SymKey *SSLInt_CipherSpecToKey(PRBool isServer, ssl3CipherSpec *spec);
+SSLCipherAlgorithm SSLInt_CipherSpecToAlgorithm(PRBool isServer,
+ ssl3CipherSpec *spec);
+unsigned char *SSLInt_CipherSpecToIv(PRBool isServer, ssl3CipherSpec *spec);
+SECStatus SSLInt_EnableShortHeaders(PRFileDesc *fd);
+SECStatus SSLInt_UsingShortHeaders(PRFileDesc *fd, PRBool *result);
void SSLInt_SetTicketLifetime(uint32_t lifetime);
void SSLInt_SetMaxEarlyDataSize(uint32_t size);
SECStatus SSLInt_SetSocketMaxEarlyDataSize(PRFileDesc *fd, uint32_t size);
-void SSLInt_RolloverAntiReplay(void);
#endif // ndef libssl_internals_h_
diff --git a/security/nss/gtests/ssl_gtest/manifest.mn b/security/nss/gtests/ssl_gtest/manifest.mn
index 5d893bab35..cc729c0f16 100644
--- a/security/nss/gtests/ssl_gtest/manifest.mn
+++ b/security/nss/gtests/ssl_gtest/manifest.mn
@@ -12,13 +12,11 @@ CSRCS = \
$(NULL)
CPPSRCS = \
- bloomfilter_unittest.cc \
ssl_0rtt_unittest.cc \
ssl_agent_unittest.cc \
ssl_auth_unittest.cc \
ssl_cert_ext_unittest.cc \
ssl_ciphersuite_unittest.cc \
- ssl_custext_unittest.cc \
ssl_damage_unittest.cc \
ssl_dhe_unittest.cc \
ssl_drop_unittest.cc \
@@ -31,16 +29,11 @@ CPPSRCS = \
ssl_gather_unittest.cc \
ssl_gtest.cc \
ssl_hrr_unittest.cc \
- ssl_keylog_unittest.cc \
- ssl_keyupdate_unittest.cc \
ssl_loopback_unittest.cc \
- ssl_misc_unittest.cc \
ssl_record_unittest.cc \
ssl_resumption_unittest.cc \
- ssl_renegotiation_unittest.cc \
ssl_skip_unittest.cc \
ssl_staticrsa_unittest.cc \
- ssl_tls13compat_unittest.cc \
ssl_v2_client_hello_unittest.cc \
ssl_version_unittest.cc \
ssl_versionpolicy_unittest.cc \
diff --git a/security/nss/gtests/ssl_gtest/ssl_0rtt_unittest.cc b/security/nss/gtests/ssl_gtest/ssl_0rtt_unittest.cc
index a602954902..85b7011a1c 100644
--- a/security/nss/gtests/ssl_gtest/ssl_0rtt_unittest.cc
+++ b/security/nss/gtests/ssl_gtest/ssl_0rtt_unittest.cc
@@ -7,7 +7,6 @@
#include "secerr.h"
#include "ssl.h"
#include "sslerr.h"
-#include "sslexp.h"
#include "sslproto.h"
extern "C" {
@@ -45,93 +44,6 @@ TEST_P(TlsConnectTls13, ZeroRttServerRejectByOption) {
SendReceive();
}
-TEST_P(TlsConnectTls13, ZeroRttApparentReplayAfterRestart) {
- // The test fixtures call SSL_SetupAntiReplay() in SetUp(). This results in
- // 0-RTT being rejected until at least one window passes. SetupFor0Rtt()
- // forces a rollover of the anti-replay filters, which clears this state.
- // Here, we do the setup manually here without that forced rollover.
-
- ConfigureSessionCache(RESUME_BOTH, RESUME_TICKET);
- ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3);
- server_->Set0RttEnabled(true); // So we signal that we allow 0-RTT.
- Connect();
- SendReceive(); // Need to read so that we absorb the session ticket.
- CheckKeys();
-
- Reset();
- StartConnect();
- client_->Set0RttEnabled(true);
- server_->Set0RttEnabled(true);
- ExpectResumption(RESUME_TICKET);
- ZeroRttSendReceive(true, false);
- Handshake();
- CheckConnected();
- SendReceive();
-}
-
-class TlsZeroRttReplayTest : public TlsConnectTls13 {
- private:
- class SaveFirstPacket : public PacketFilter {
- public:
- PacketFilter::Action Filter(const DataBuffer& input,
- DataBuffer* output) override {
- if (!packet_.len() && input.len()) {
- packet_ = input;
- }
- return KEEP;
- }
-
- const DataBuffer& packet() const { return packet_; }
-
- private:
- DataBuffer packet_;
- };
-
- protected:
- void RunTest(bool rollover) {
- // Run the initial handshake
- SetupForZeroRtt();
-
- // Now run a true 0-RTT handshake, but capture the first packet.
- auto first_packet = std::make_shared<SaveFirstPacket>();
- client_->SetPacketFilter(first_packet);
- client_->Set0RttEnabled(true);
- server_->Set0RttEnabled(true);
- ExpectResumption(RESUME_TICKET);
- ZeroRttSendReceive(true, true);
- Handshake();
- EXPECT_LT(0U, first_packet->packet().len());
- ExpectEarlyDataAccepted(true);
- CheckConnected();
- SendReceive();
-
- if (rollover) {
- SSLInt_RolloverAntiReplay();
- }
-
- // Now replay that packet against the server.
- Reset();
- server_->StartConnect();
- server_->Set0RttEnabled(true);
-
- // Capture the early_data extension, which should not appear.
- auto early_data_ext =
- std::make_shared<TlsExtensionCapture>(ssl_tls13_early_data_xtn);
- server_->SetPacketFilter(early_data_ext);
-
- // Finally, replay the ClientHello and force the server to consume it. Stop
- // after the server sends its first flight; the client will not be able to
- // complete this handshake.
- server_->adapter()->PacketReceived(first_packet->packet());
- server_->Handshake();
- EXPECT_FALSE(early_data_ext->captured());
- }
-};
-
-TEST_P(TlsZeroRttReplayTest, ZeroRttReplay) { RunTest(false); }
-
-TEST_P(TlsZeroRttReplayTest, ZeroRttReplayAfterRollover) { RunTest(true); }
-
// Test that we don't try to send 0-RTT data when the server sent
// us a ticket without the 0-RTT flags.
TEST_P(TlsConnectTls13, ZeroRttOptionsSetLate) {
@@ -140,7 +52,8 @@ TEST_P(TlsConnectTls13, ZeroRttOptionsSetLate) {
SendReceive(); // Need to read so that we absorb the session ticket.
CheckKeys(ssl_kea_ecdh, ssl_auth_rsa_sign);
Reset();
- StartConnect();
+ server_->StartConnect();
+ client_->StartConnect();
// Now turn on 0-RTT but too late for the ticket.
client_->Set0RttEnabled(true);
server_->Set0RttEnabled(true);
@@ -167,7 +80,8 @@ TEST_P(TlsConnectTls13, ZeroRttServerForgetTicket) {
TEST_P(TlsConnectTls13, ZeroRttServerOnly) {
ExpectResumption(RESUME_NONE);
server_->Set0RttEnabled(true);
- StartConnect();
+ client_->StartConnect();
+ server_->StartConnect();
// Client sends ordinary ClientHello.
client_->Handshake();
@@ -185,61 +99,6 @@ TEST_P(TlsConnectTls13, ZeroRttServerOnly) {
CheckKeys();
}
-// A small sleep after sending the ClientHello means that the ticket age that
-// arrives at the server is too low. With a small tolerance for variation in
-// ticket age (which is determined by the |window| parameter that is passed to
-// SSL_SetupAntiReplay()), the server then rejects early data.
-TEST_P(TlsConnectTls13, ZeroRttRejectOldTicket) {
- SetupForZeroRtt();
- client_->Set0RttEnabled(true);
- server_->Set0RttEnabled(true);
- EXPECT_EQ(SECSuccess, SSL_SetupAntiReplay(1, 1, 3));
- SSLInt_RolloverAntiReplay(); // Make sure to flush replay state.
- SSLInt_RolloverAntiReplay();
- ExpectResumption(RESUME_TICKET);
- ZeroRttSendReceive(true, false, []() {
- PR_Sleep(PR_MillisecondsToInterval(10));
- return true;
- });
- Handshake();
- ExpectEarlyDataAccepted(false);
- CheckConnected();
- SendReceive();
-}
-
-// In this test, we falsely inflate the estimate of the RTT by delaying the
-// ServerHello on the first handshake. This results in the server estimating a
-// higher value of the ticket age than the client ultimately provides. Add a
-// small tolerance for variation in ticket age and the ticket will appear to
-// arrive prematurely, causing the server to reject early data.
-TEST_P(TlsConnectTls13, ZeroRttRejectPrematureTicket) {
- ConfigureSessionCache(RESUME_BOTH, RESUME_TICKET);
- ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3);
- server_->Set0RttEnabled(true);
- StartConnect();
- client_->Handshake(); // ClientHello
- server_->Handshake(); // ServerHello
- PR_Sleep(PR_MillisecondsToInterval(10));
- Handshake(); // Remainder of handshake
- CheckConnected();
- SendReceive();
- CheckKeys();
-
- Reset();
- client_->Set0RttEnabled(true);
- server_->Set0RttEnabled(true);
- EXPECT_EQ(SECSuccess, SSL_SetupAntiReplay(1, 1, 3));
- SSLInt_RolloverAntiReplay(); // Make sure to flush replay state.
- SSLInt_RolloverAntiReplay();
- ExpectResumption(RESUME_TICKET);
- ExpectEarlyDataAccepted(false);
- StartConnect();
- ZeroRttSendReceive(true, false);
- Handshake();
- CheckConnected();
- SendReceive();
-}
-
TEST_P(TlsConnectTls13, TestTls13ZeroRttAlpn) {
EnableAlpn();
SetupForZeroRtt();
@@ -258,14 +117,6 @@ TEST_P(TlsConnectTls13, TestTls13ZeroRttAlpn) {
CheckAlpn("a");
}
-// NOTE: In this test and those below, the client always sends
-// post-ServerHello alerts with the handshake keys, even if the server
-// has accepted 0-RTT. In some cases, as with errors in
-// EncryptedExtensions, the client can't know the server's behavior,
-// and in others it's just simpler. What the server is expecting
-// depends on whether it accepted 0-RTT or not. Eventually, we may
-// make the server trial decrypt.
-//
// Have the server negotiate a different ALPN value, and therefore
// reject 0-RTT.
TEST_P(TlsConnectTls13, TestTls13ZeroRttAlpnChangeServer) {
@@ -304,17 +155,12 @@ TEST_P(TlsConnectTls13, TestTls13ZeroRttNoAlpnServer) {
client_->CheckAlpn(SSL_NEXT_PROTO_EARLY_VALUE, "a");
EXPECT_EQ(SECSuccess, SSLInt_Set0RttAlpn(client_->ssl_fd(), b, sizeof(b)));
client_->CheckAlpn(SSL_NEXT_PROTO_EARLY_VALUE, "b");
- client_->ExpectSendAlert(kTlsAlertIllegalParameter);
+ ExpectAlert(client_, kTlsAlertIllegalParameter);
return true;
});
- if (variant_ == ssl_variant_stream) {
- server_->ExpectSendAlert(kTlsAlertBadRecordMac);
- Handshake();
- server_->CheckErrorCode(SSL_ERROR_BAD_MAC_READ);
- } else {
- client_->Handshake();
- }
+ Handshake();
client_->CheckErrorCode(SSL_ERROR_NEXT_PROTOCOL_DATA_INVALID);
+ server_->CheckErrorCode(SSL_ERROR_ILLEGAL_PARAMETER_ALERT);
}
// Set up with no ALPN and then set the client so it thinks it has ALPN.
@@ -329,17 +175,12 @@ TEST_P(TlsConnectTls13, TestTls13ZeroRttNoAlpnClient) {
PRUint8 b[] = {'b'};
EXPECT_EQ(SECSuccess, SSLInt_Set0RttAlpn(client_->ssl_fd(), b, 1));
client_->CheckAlpn(SSL_NEXT_PROTO_EARLY_VALUE, "b");
- client_->ExpectSendAlert(kTlsAlertIllegalParameter);
+ ExpectAlert(client_, kTlsAlertIllegalParameter);
return true;
});
- if (variant_ == ssl_variant_stream) {
- server_->ExpectSendAlert(kTlsAlertBadRecordMac);
- Handshake();
- server_->CheckErrorCode(SSL_ERROR_BAD_MAC_READ);
- } else {
- client_->Handshake();
- }
+ Handshake();
client_->CheckErrorCode(SSL_ERROR_NEXT_PROTOCOL_DATA_INVALID);
+ server_->CheckErrorCode(SSL_ERROR_ILLEGAL_PARAMETER_ALERT);
}
// Remove the old ALPN value and so the client will not offer early data.
@@ -377,7 +218,9 @@ TEST_P(TlsConnectTls13, TestTls13ZeroRttDowngrade) {
SSL_LIBRARY_VERSION_TLS_1_3);
server_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_2,
SSL_LIBRARY_VERSION_TLS_1_2);
- StartConnect();
+ client_->StartConnect();
+ server_->StartConnect();
+
// We will send the early data xtn without sending actual early data. Thus
// a 1.2 server shouldn't fail until the client sends an alert because the
// client sends end_of_early_data only after reading the server's flight.
@@ -418,7 +261,9 @@ TEST_P(TlsConnectTls13, TestTls13ZeroRttDowngradeEarlyData) {
SSL_LIBRARY_VERSION_TLS_1_3);
server_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_2,
SSL_LIBRARY_VERSION_TLS_1_2);
- StartConnect();
+ client_->StartConnect();
+ server_->StartConnect();
+
// Send the early data xtn in the CH, followed by early app data. The server
// will fail right after sending its flight, when receiving the early data.
client_->Set0RttEnabled(true);
@@ -465,6 +310,7 @@ TEST_P(TlsConnectTls13, SendTooMuchEarlyData) {
server_->Set0RttEnabled(true);
ExpectResumption(RESUME_TICKET);
+ ExpectAlert(client_, kTlsAlertEndOfEarlyData);
client_->Handshake();
CheckEarlyDataLimit(client_, short_size);
@@ -518,6 +364,7 @@ TEST_P(TlsConnectTls13, ReceiveTooMuchEarlyData) {
server_->Set0RttEnabled(true);
ExpectResumption(RESUME_TICKET);
+ client_->ExpectSendAlert(kTlsAlertEndOfEarlyData);
client_->Handshake(); // Send ClientHello
CheckEarlyDataLimit(client_, limit);
@@ -552,86 +399,4 @@ TEST_P(TlsConnectTls13, ReceiveTooMuchEarlyData) {
}
}
-class PacketCoalesceFilter : public PacketFilter {
- public:
- PacketCoalesceFilter() : packet_data_() {}
-
- void SendCoalesced(std::shared_ptr<TlsAgent> agent) {
- agent->SendDirect(packet_data_);
- }
-
- protected:
- PacketFilter::Action Filter(const DataBuffer& input,
- DataBuffer* output) override {
- packet_data_.Write(packet_data_.len(), input);
- return DROP;
- }
-
- private:
- DataBuffer packet_data_;
-};
-
-TEST_P(TlsConnectTls13, ZeroRttOrdering) {
- SetupForZeroRtt();
- client_->Set0RttEnabled(true);
- server_->Set0RttEnabled(true);
- ExpectResumption(RESUME_TICKET);
-
- // Send out the ClientHello.
- client_->Handshake();
-
- // Now, coalesce the next three things from the client: early data, second
- // flight and 1-RTT data.
- auto coalesce = std::make_shared<PacketCoalesceFilter>();
- client_->SetPacketFilter(coalesce);
-
- // Send (and hold) early data.
- static const std::vector<uint8_t> early_data = {3, 2, 1};
- EXPECT_EQ(static_cast<PRInt32>(early_data.size()),
- PR_Write(client_->ssl_fd(), early_data.data(), early_data.size()));
-
- // Send (and hold) the second client handshake flight.
- // The client sends EndOfEarlyData after seeing the server Finished.
- server_->Handshake();
- client_->Handshake();
-
- // Send (and hold) 1-RTT data.
- static const std::vector<uint8_t> late_data = {7, 8, 9, 10};
- EXPECT_EQ(static_cast<PRInt32>(late_data.size()),
- PR_Write(client_->ssl_fd(), late_data.data(), late_data.size()));
-
- // Now release them all at once.
- coalesce->SendCoalesced(client_);
-
- // Now ensure that the three steps are exposed in the right order on the
- // server: delivery of early data, handshake callback, delivery of 1-RTT.
- size_t step = 0;
- server_->SetHandshakeCallback([&step](TlsAgent*) {
- EXPECT_EQ(1U, step);
- ++step;
- });
-
- std::vector<uint8_t> buf(10);
- PRInt32 read = PR_Read(server_->ssl_fd(), buf.data(), buf.size());
- ASSERT_EQ(static_cast<PRInt32>(early_data.size()), read);
- buf.resize(read);
- EXPECT_EQ(early_data, buf);
- EXPECT_EQ(0U, step);
- ++step;
-
- // The third read should be after the handshake callback and should return the
- // data that was sent after the handshake completed.
- buf.resize(10);
- read = PR_Read(server_->ssl_fd(), buf.data(), buf.size());
- ASSERT_EQ(static_cast<PRInt32>(late_data.size()), read);
- buf.resize(read);
- EXPECT_EQ(late_data, buf);
- EXPECT_EQ(2U, step);
-}
-
-#ifndef NSS_DISABLE_TLS_1_3
-INSTANTIATE_TEST_CASE_P(Tls13ZeroRttReplayTest, TlsZeroRttReplayTest,
- TlsConnectTestBase::kTlsVariantsAll);
-#endif
-
} // namespace nss_test
diff --git a/security/nss/gtests/ssl_gtest/ssl_agent_unittest.cc b/security/nss/gtests/ssl_gtest/ssl_agent_unittest.cc
index 0aa9a4c78d..5035a338d2 100644
--- a/security/nss/gtests/ssl_gtest/ssl_agent_unittest.cc
+++ b/security/nss/gtests/ssl_gtest/ssl_agent_unittest.cc
@@ -31,7 +31,7 @@ const static uint8_t kCannedTls13ClientHello[] = {
0x00, 0x00, 0xa0, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x09, 0x00, 0x00, 0x06,
0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0xff, 0x01, 0x00, 0x01, 0x00, 0x00,
0x0a, 0x00, 0x12, 0x00, 0x10, 0x00, 0x17, 0x00, 0x18, 0x00, 0x19, 0x01,
- 0x00, 0x01, 0x01, 0x01, 0x02, 0x01, 0x03, 0x01, 0x04, 0x00, 0x33, 0x00,
+ 0x00, 0x01, 0x01, 0x01, 0x02, 0x01, 0x03, 0x01, 0x04, 0x00, 0x28, 0x00,
0x47, 0x00, 0x45, 0x00, 0x17, 0x00, 0x41, 0x04, 0x86, 0x4a, 0xb9, 0xdc,
0x6a, 0x38, 0xa7, 0xce, 0xe7, 0xc2, 0x4f, 0xa6, 0x28, 0xb9, 0xdc, 0x65,
0xbf, 0x73, 0x47, 0x3c, 0x9c, 0x65, 0x8c, 0x47, 0x6d, 0x57, 0x22, 0x8a,
@@ -44,14 +44,13 @@ const static uint8_t kCannedTls13ClientHello[] = {
0x02, 0x05, 0x02, 0x06, 0x02, 0x02, 0x02};
const static uint8_t kCannedTls13ServerHello[] = {
- 0x03, 0x03, 0x9c, 0xbc, 0x14, 0x9b, 0x0e, 0x2e, 0xfa, 0x0d, 0xf3,
- 0xf0, 0x5c, 0x70, 0x7a, 0xe0, 0xd1, 0x9b, 0x3e, 0x5a, 0x44, 0x6b,
- 0xdf, 0xe5, 0xc2, 0x28, 0x64, 0xf7, 0x00, 0xc1, 0x9c, 0x08, 0x76,
- 0x08, 0x00, 0x13, 0x01, 0x00, 0x00, 0x2e, 0x00, 0x33, 0x00, 0x24,
- 0x00, 0x1d, 0x00, 0x20, 0xc2, 0xcf, 0x23, 0x17, 0x64, 0x23, 0x03,
- 0xf0, 0xfb, 0x45, 0x98, 0x26, 0xd1, 0x65, 0x24, 0xa1, 0x6c, 0xa9,
- 0x80, 0x8f, 0x2c, 0xac, 0x0a, 0xea, 0x53, 0x3a, 0xcb, 0xe3, 0x08,
- 0x84, 0xae, 0x19, 0x00, 0x2b, 0x00, 0x02, 0x7f, kD13};
+ 0x7f, kD13, 0x9c, 0xbc, 0x14, 0x9b, 0x0e, 0x2e, 0xfa, 0x0d, 0xf3, 0xf0,
+ 0x5c, 0x70, 0x7a, 0xe0, 0xd1, 0x9b, 0x3e, 0x5a, 0x44, 0x6b, 0xdf, 0xe5,
+ 0xc2, 0x28, 0x64, 0xf7, 0x00, 0xc1, 0x9c, 0x08, 0x76, 0x08, 0x13, 0x01,
+ 0x00, 0x28, 0x00, 0x28, 0x00, 0x24, 0x00, 0x1d, 0x00, 0x20, 0xc2, 0xcf,
+ 0x23, 0x17, 0x64, 0x23, 0x03, 0xf0, 0xfb, 0x45, 0x98, 0x26, 0xd1, 0x65,
+ 0x24, 0xa1, 0x6c, 0xa9, 0x80, 0x8f, 0x2c, 0xac, 0x0a, 0xea, 0x53, 0x3a,
+ 0xcb, 0xe3, 0x08, 0x84, 0xae, 0x19};
static const char *k0RttData = "ABCDEF";
TEST_P(TlsAgentTest, EarlyFinished) {
diff --git a/security/nss/gtests/ssl_gtest/ssl_auth_unittest.cc b/security/nss/gtests/ssl_gtest/ssl_auth_unittest.cc
index dbcdd92eae..dbcbc9aa33 100644
--- a/security/nss/gtests/ssl_gtest/ssl_auth_unittest.cc
+++ b/security/nss/gtests/ssl_gtest/ssl_auth_unittest.cc
@@ -29,25 +29,7 @@ TEST_P(TlsConnectGeneric, ServerAuthBigRsa) {
}
TEST_P(TlsConnectGeneric, ServerAuthRsaChain) {
- Reset("rsa_chain");
- Connect();
- CheckKeys();
- size_t chain_length;
- EXPECT_TRUE(client_->GetPeerChainLength(&chain_length));
- EXPECT_EQ(2UL, chain_length);
-}
-
-TEST_P(TlsConnectGeneric, ServerAuthRsaPssChain) {
- Reset("rsa_pss_chain");
- Connect();
- CheckKeys();
- size_t chain_length;
- EXPECT_TRUE(client_->GetPeerChainLength(&chain_length));
- EXPECT_EQ(2UL, chain_length);
-}
-
-TEST_P(TlsConnectGeneric, ServerAuthRsaCARsaPssChain) {
- Reset("rsa_ca_rsa_pss_chain");
+ Reset(TlsAgent::kServerRsaChain);
Connect();
CheckKeys();
size_t chain_length;
@@ -159,11 +141,13 @@ TEST_P(TlsConnectTls12, ClientAuthBigRsaCheckSigAlg) {
class TlsZeroCertificateRequestSigAlgsFilter : public TlsHandshakeFilter {
public:
- TlsZeroCertificateRequestSigAlgsFilter()
- : TlsHandshakeFilter({kTlsHandshakeCertificateRequest}) {}
virtual PacketFilter::Action FilterHandshake(
const TlsHandshakeFilter::HandshakeHeader& header,
const DataBuffer& input, DataBuffer* output) {
+ if (header.handshake_type() != kTlsHandshakeCertificateRequest) {
+ return KEEP;
+ }
+
TlsParser parser(input);
std::cerr << "Zeroing CertReq.supported_signature_algorithms" << std::endl;
@@ -597,7 +581,8 @@ class EnforceNoActivity : public PacketFilter {
TEST_P(TlsConnectGenericPre13, AuthCompleteDelayed) {
client_->SetAuthCertificateCallback(AuthCompleteBlock);
- StartConnect();
+ server_->StartConnect();
+ client_->StartConnect();
client_->Handshake(); // Send ClientHello
server_->Handshake(); // Send ServerHello
client_->Handshake(); // Send ClientKeyExchange and Finished
@@ -625,7 +610,8 @@ TEST_P(TlsConnectGenericPre13, AuthCompleteDelayed) {
TEST_P(TlsConnectTls13, AuthCompleteDelayed) {
client_->SetAuthCertificateCallback(AuthCompleteBlock);
- StartConnect();
+ server_->StartConnect();
+ client_->StartConnect();
client_->Handshake(); // Send ClientHello
server_->Handshake(); // Send ServerHello
EXPECT_EQ(TlsAgent::STATE_CONNECTING, client_->state());
diff --git a/security/nss/gtests/ssl_gtest/ssl_cert_ext_unittest.cc b/security/nss/gtests/ssl_gtest/ssl_cert_ext_unittest.cc
index 36ee104afd..3463782e09 100644
--- a/security/nss/gtests/ssl_gtest/ssl_cert_ext_unittest.cc
+++ b/security/nss/gtests/ssl_gtest/ssl_cert_ext_unittest.cc
@@ -82,8 +82,9 @@ TEST_P(TlsConnectGenericPre13, SignedCertificateTimestampsLegacy) {
ssl_kea_rsa));
EXPECT_EQ(SECSuccess, SSL_SetSignedCertTimestamps(server_->ssl_fd(),
&kSctItem, ssl_kea_rsa));
-
- client_->SetOption(SSL_ENABLE_SIGNED_CERT_TIMESTAMPS, PR_TRUE);
+ EXPECT_EQ(SECSuccess,
+ SSL_OptionSet(client_->ssl_fd(), SSL_ENABLE_SIGNED_CERT_TIMESTAMPS,
+ PR_TRUE));
SignedCertificateTimestampsExtractor timestamps_extractor(client_);
Connect();
@@ -95,7 +96,9 @@ TEST_P(TlsConnectGeneric, SignedCertificateTimestampsSuccess) {
EnsureTlsSetup();
EXPECT_TRUE(
server_->ConfigServerCert(TlsAgent::kServerRsa, true, &kExtraSctData));
- client_->SetOption(SSL_ENABLE_SIGNED_CERT_TIMESTAMPS, PR_TRUE);
+ EXPECT_EQ(SECSuccess,
+ SSL_OptionSet(client_->ssl_fd(), SSL_ENABLE_SIGNED_CERT_TIMESTAMPS,
+ PR_TRUE));
SignedCertificateTimestampsExtractor timestamps_extractor(client_);
Connect();
@@ -117,7 +120,9 @@ TEST_P(TlsConnectGeneric, SignedCertificateTimestampsInactiveClient) {
TEST_P(TlsConnectGeneric, SignedCertificateTimestampsInactiveServer) {
EnsureTlsSetup();
- client_->SetOption(SSL_ENABLE_SIGNED_CERT_TIMESTAMPS, PR_TRUE);
+ EXPECT_EQ(SECSuccess,
+ SSL_OptionSet(client_->ssl_fd(), SSL_ENABLE_SIGNED_CERT_TIMESTAMPS,
+ PR_TRUE));
SignedCertificateTimestampsExtractor timestamps_extractor(client_);
Connect();
@@ -168,14 +173,16 @@ TEST_P(TlsConnectGeneric, OcspNotRequested) {
// Even if the client asks, the server has nothing unless it is configured.
TEST_P(TlsConnectGeneric, OcspNotProvided) {
EnsureTlsSetup();
- client_->SetOption(SSL_ENABLE_OCSP_STAPLING, PR_TRUE);
+ EXPECT_EQ(SECSuccess, SSL_OptionSet(client_->ssl_fd(),
+ SSL_ENABLE_OCSP_STAPLING, PR_TRUE));
client_->SetAuthCertificateCallback(CheckNoOCSP);
Connect();
}
TEST_P(TlsConnectGenericPre13, OcspMangled) {
EnsureTlsSetup();
- client_->SetOption(SSL_ENABLE_OCSP_STAPLING, PR_TRUE);
+ EXPECT_EQ(SECSuccess, SSL_OptionSet(client_->ssl_fd(),
+ SSL_ENABLE_OCSP_STAPLING, PR_TRUE));
EXPECT_TRUE(
server_->ConfigServerCert(TlsAgent::kServerRsa, true, &kOcspExtraData));
@@ -190,7 +197,8 @@ TEST_P(TlsConnectGenericPre13, OcspMangled) {
TEST_P(TlsConnectGeneric, OcspSuccess) {
EnsureTlsSetup();
- client_->SetOption(SSL_ENABLE_OCSP_STAPLING, PR_TRUE);
+ EXPECT_EQ(SECSuccess, SSL_OptionSet(client_->ssl_fd(),
+ SSL_ENABLE_OCSP_STAPLING, PR_TRUE));
auto capture_ocsp =
std::make_shared<TlsExtensionCapture>(ssl_cert_status_xtn);
server_->SetPacketFilter(capture_ocsp);
@@ -217,7 +225,8 @@ TEST_P(TlsConnectGeneric, OcspSuccess) {
TEST_P(TlsConnectGeneric, OcspHugeSuccess) {
EnsureTlsSetup();
- client_->SetOption(SSL_ENABLE_OCSP_STAPLING, PR_TRUE);
+ EXPECT_EQ(SECSuccess, SSL_OptionSet(client_->ssl_fd(),
+ SSL_ENABLE_OCSP_STAPLING, PR_TRUE));
uint8_t hugeOcspValue[16385];
memset(hugeOcspValue, 0xa1, sizeof(hugeOcspValue));
diff --git a/security/nss/gtests/ssl_gtest/ssl_ciphersuite_unittest.cc b/security/nss/gtests/ssl_gtest/ssl_ciphersuite_unittest.cc
index 810656868e..85c30b2bfa 100644
--- a/security/nss/gtests/ssl_gtest/ssl_ciphersuite_unittest.cc
+++ b/security/nss/gtests/ssl_gtest/ssl_ciphersuite_unittest.cc
@@ -31,11 +31,11 @@ class TlsCipherSuiteTestBase : public TlsConnectTestBase {
public:
TlsCipherSuiteTestBase(SSLProtocolVariant variant, uint16_t version,
uint16_t cipher_suite, SSLNamedGroup group,
- SSLSignatureScheme sig_scheme)
+ SSLSignatureScheme signature_scheme)
: TlsConnectTestBase(variant, version),
cipher_suite_(cipher_suite),
group_(group),
- sig_scheme_(sig_scheme),
+ signature_scheme_(signature_scheme),
csinfo_({0}) {
SECStatus rv =
SSL_GetCipherSuiteInfo(cipher_suite_, &csinfo_, sizeof(csinfo_));
@@ -60,14 +60,14 @@ class TlsCipherSuiteTestBase : public TlsConnectTestBase {
server_->ConfigNamedGroups(groups);
kea_type_ = SSLInt_GetKEAType(group_);
- client_->SetSignatureSchemes(&sig_scheme_, 1);
- server_->SetSignatureSchemes(&sig_scheme_, 1);
+ client_->SetSignatureSchemes(&signature_scheme_, 1);
+ server_->SetSignatureSchemes(&signature_scheme_, 1);
}
}
virtual void SetupCertificate() {
if (version_ >= SSL_LIBRARY_VERSION_TLS_1_3) {
- switch (sig_scheme_) {
+ switch (signature_scheme_) {
case ssl_sig_rsa_pkcs1_sha256:
case ssl_sig_rsa_pkcs1_sha384:
case ssl_sig_rsa_pkcs1_sha512:
@@ -93,7 +93,8 @@ class TlsCipherSuiteTestBase : public TlsConnectTestBase {
auth_type_ = ssl_auth_ecdsa;
break;
default:
- ADD_FAILURE() << "Unsupported signature scheme: " << sig_scheme_;
+ ASSERT_TRUE(false) << "Unsupported signature scheme: "
+ << signature_scheme_;
break;
}
} else {
@@ -186,7 +187,7 @@ class TlsCipherSuiteTestBase : public TlsConnectTestBase {
SSLAuthType auth_type_;
SSLKEAType kea_type_;
SSLNamedGroup group_;
- SSLSignatureScheme sig_scheme_;
+ SSLSignatureScheme signature_scheme_;
SSLCipherSuiteInfo csinfo_;
};
@@ -235,29 +236,27 @@ TEST_P(TlsCipherSuiteTest, ResumeCipherSuite) {
ConnectAndCheckCipherSuite();
}
+// This only works for stream ciphers because we modify the sequence number -
+// which is included explicitly in the DTLS record header - and that trips a
+// different error code. Note that the message that the client sends would not
+// decrypt (the nonce/IV wouldn't match), but the record limit is hit before
+// attempting to decrypt a record.
TEST_P(TlsCipherSuiteTest, ReadLimit) {
SetupCertificate();
EnableSingleCipher();
ConnectAndCheckCipherSuite();
- if (version_ < SSL_LIBRARY_VERSION_TLS_1_3) {
- uint64_t last = last_safe_write();
- EXPECT_EQ(SECSuccess, SSLInt_AdvanceWriteSeqNum(client_->ssl_fd(), last));
- EXPECT_EQ(SECSuccess, SSLInt_AdvanceReadSeqNum(server_->ssl_fd(), last));
+ EXPECT_EQ(SECSuccess,
+ SSLInt_AdvanceWriteSeqNum(client_->ssl_fd(), last_safe_write()));
+ EXPECT_EQ(SECSuccess,
+ SSLInt_AdvanceReadSeqNum(server_->ssl_fd(), last_safe_write()));
- client_->SendData(10, 10);
- server_->ReadBytes(); // This should be OK.
- } else {
- // In TLS 1.3, reading or writing triggers a KeyUpdate. That would mean
- // that the sequence numbers would reset and we wouldn't hit the limit. So
- // we move the sequence number to one less than the limit directly and don't
- // test sending and receiving just before the limit.
- uint64_t last = record_limit() - 1;
- EXPECT_EQ(SECSuccess, SSLInt_AdvanceReadSeqNum(server_->ssl_fd(), last));
- }
+ client_->SendData(10, 10);
+ server_->ReadBytes(); // This should be OK.
- // The payload needs to be big enough to pass for encrypted. The code checks
- // the limit before it tries to decrypt.
- static const uint8_t payload[32] = {6};
+ // The payload needs to be big enough to pass for encrypted. In the extreme
+ // case (TLS 1.3), this means 1 for payload, 1 for content type and 16 for
+ // authentication tag.
+ static const uint8_t payload[18] = {6};
DataBuffer record;
uint64_t epoch;
if (variant_ == ssl_variant_datagram) {
@@ -272,17 +271,13 @@ TEST_P(TlsCipherSuiteTest, ReadLimit) {
TlsAgentTestBase::MakeRecord(variant_, kTlsApplicationDataType, version_,
payload, sizeof(payload), &record,
(epoch << 48) | record_limit());
- client_->SendDirect(record);
+ server_->adapter()->PacketReceived(record);
server_->ExpectReadWriteError();
server_->ReadBytes();
EXPECT_EQ(SSL_ERROR_TOO_MANY_RECORDS, server_->error_code());
}
TEST_P(TlsCipherSuiteTest, WriteLimit) {
- // This asserts in TLS 1.3 because we expect an automatic update.
- if (version_ >= SSL_LIBRARY_VERSION_TLS_1_3) {
- return;
- }
SetupCertificate();
EnableSingleCipher();
ConnectAndCheckCipherSuite();
diff --git a/security/nss/gtests/ssl_gtest/ssl_custext_unittest.cc b/security/nss/gtests/ssl_gtest/ssl_custext_unittest.cc
deleted file mode 100644
index dad944a1fc..0000000000
--- a/security/nss/gtests/ssl_gtest/ssl_custext_unittest.cc
+++ /dev/null
@@ -1,503 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "ssl.h"
-#include "ssl3prot.h"
-#include "sslerr.h"
-#include "sslproto.h"
-#include "sslexp.h"
-
-#include <memory>
-
-#include "tls_connect.h"
-
-namespace nss_test {
-
-static void IncrementCounterArg(void *arg) {
- if (arg) {
- auto *called = reinterpret_cast<size_t *>(arg);
- ++*called;
- }
-}
-
-PRBool NoopExtensionWriter(PRFileDesc *fd, SSLHandshakeType message,
- PRUint8 *data, unsigned int *len,
- unsigned int maxLen, void *arg) {
- IncrementCounterArg(arg);
- return PR_FALSE;
-}
-
-PRBool EmptyExtensionWriter(PRFileDesc *fd, SSLHandshakeType message,
- PRUint8 *data, unsigned int *len,
- unsigned int maxLen, void *arg) {
- IncrementCounterArg(arg);
- return PR_TRUE;
-}
-
-SECStatus NoopExtensionHandler(PRFileDesc *fd, SSLHandshakeType message,
- const PRUint8 *data, unsigned int len,
- SSLAlertDescription *alert, void *arg) {
- return SECSuccess;
-}
-
-// All of the (current) set of supported extensions, plus a few extra.
-static const uint16_t kManyExtensions[] = {
- ssl_server_name_xtn,
- ssl_cert_status_xtn,
- ssl_supported_groups_xtn,
- ssl_ec_point_formats_xtn,
- ssl_signature_algorithms_xtn,
- ssl_signature_algorithms_cert_xtn,
- ssl_use_srtp_xtn,
- ssl_app_layer_protocol_xtn,
- ssl_signed_cert_timestamp_xtn,
- ssl_padding_xtn,
- ssl_extended_master_secret_xtn,
- ssl_session_ticket_xtn,
- ssl_tls13_key_share_xtn,
- ssl_tls13_pre_shared_key_xtn,
- ssl_tls13_early_data_xtn,
- ssl_tls13_supported_versions_xtn,
- ssl_tls13_cookie_xtn,
- ssl_tls13_psk_key_exchange_modes_xtn,
- ssl_tls13_ticket_early_data_info_xtn,
- ssl_tls13_certificate_authorities_xtn,
- ssl_next_proto_nego_xtn,
- ssl_renegotiation_info_xtn,
- ssl_tls13_short_header_xtn,
- 1,
- 0xffff};
-// The list here includes all extensions we expect to use (SSL_MAX_EXTENSIONS),
-// plus the deprecated values (see sslt.h), and two extra dummy values.
-PR_STATIC_ASSERT((SSL_MAX_EXTENSIONS + 5) == PR_ARRAY_SIZE(kManyExtensions));
-
-void InstallManyWriters(std::shared_ptr<TlsAgent> agent,
- SSLExtensionWriter writer, size_t *installed = nullptr,
- size_t *called = nullptr) {
- for (size_t i = 0; i < PR_ARRAY_SIZE(kManyExtensions); ++i) {
- SSLExtensionSupport support = ssl_ext_none;
- SECStatus rv = SSL_GetExtensionSupport(kManyExtensions[i], &support);
- ASSERT_EQ(SECSuccess, rv) << "SSL_GetExtensionSupport cannot fail";
-
- rv = SSL_InstallExtensionHooks(agent->ssl_fd(), kManyExtensions[i], writer,
- called, NoopExtensionHandler, nullptr);
- if (support == ssl_ext_native_only) {
- EXPECT_EQ(SECFailure, rv);
- EXPECT_EQ(SEC_ERROR_INVALID_ARGS, PORT_GetError());
- } else {
- if (installed) {
- ++*installed;
- }
- EXPECT_EQ(SECSuccess, rv);
- }
- }
-}
-
-TEST_F(TlsConnectStreamTls13, CustomExtensionAllNoopClient) {
- EnsureTlsSetup();
- size_t installed = 0;
- size_t called = 0;
- InstallManyWriters(client_, NoopExtensionWriter, &installed, &called);
- EXPECT_LT(0U, installed);
- Connect();
- EXPECT_EQ(installed, called);
-}
-
-TEST_F(TlsConnectStreamTls13, CustomExtensionAllNoopServer) {
- EnsureTlsSetup();
- size_t installed = 0;
- size_t called = 0;
- InstallManyWriters(server_, NoopExtensionWriter, &installed, &called);
- EXPECT_LT(0U, installed);
- Connect();
- // Extension writers are all called for each of ServerHello,
- // EncryptedExtensions, and Certificate.
- EXPECT_EQ(installed * 3, called);
-}
-
-TEST_F(TlsConnectStreamTls13, CustomExtensionEmptyWriterClient) {
- EnsureTlsSetup();
- InstallManyWriters(client_, EmptyExtensionWriter);
- InstallManyWriters(server_, EmptyExtensionWriter);
- Connect();
-}
-
-TEST_F(TlsConnectStreamTls13, CustomExtensionEmptyWriterServer) {
- EnsureTlsSetup();
- InstallManyWriters(server_, EmptyExtensionWriter);
- // Sending extensions that the client doesn't expect leads to extensions
- // appearing even if the client didn't send one, or in the wrong messages.
- client_->ExpectSendAlert(kTlsAlertUnsupportedExtension);
- server_->ExpectSendAlert(kTlsAlertBadRecordMac);
- ConnectExpectFail();
-}
-
-// Install an writer to disable sending of a natively-supported extension.
-TEST_F(TlsConnectStreamTls13, CustomExtensionWriterDisable) {
- EnsureTlsSetup();
-
- // This option enables sending the extension via the native support.
- SECStatus rv = SSL_OptionSet(client_->ssl_fd(),
- SSL_ENABLE_SIGNED_CERT_TIMESTAMPS, PR_TRUE);
- EXPECT_EQ(SECSuccess, rv);
-
- // This installs an override that doesn't do anything. You have to specify
- // something; passing all nullptr values removes an existing handler.
- rv = SSL_InstallExtensionHooks(
- client_->ssl_fd(), ssl_signed_cert_timestamp_xtn, NoopExtensionWriter,
- nullptr, NoopExtensionHandler, nullptr);
- EXPECT_EQ(SECSuccess, rv);
- auto capture =
- std::make_shared<TlsExtensionCapture>(ssl_signed_cert_timestamp_xtn);
- client_->SetPacketFilter(capture);
-
- Connect();
- // So nothing will be sent.
- EXPECT_FALSE(capture->captured());
-}
-
-// An extension that is unlikely to be parsed as valid.
-static uint8_t kNonsenseExtension[] = {91, 82, 73, 64, 55, 46, 37, 28, 19};
-
-static PRBool NonsenseExtensionWriter(PRFileDesc *fd, SSLHandshakeType message,
- PRUint8 *data, unsigned int *len,
- unsigned int maxLen, void *arg) {
- TlsAgent *agent = reinterpret_cast<TlsAgent *>(arg);
- EXPECT_NE(nullptr, agent);
- EXPECT_NE(nullptr, data);
- EXPECT_NE(nullptr, len);
- EXPECT_EQ(0U, *len);
- EXPECT_LT(0U, maxLen);
- EXPECT_EQ(agent->ssl_fd(), fd);
-
- if (message != ssl_hs_client_hello && message != ssl_hs_server_hello &&
- message != ssl_hs_encrypted_extensions) {
- return PR_FALSE;
- }
-
- *len = static_cast<unsigned int>(sizeof(kNonsenseExtension));
- EXPECT_GE(maxLen, *len);
- if (maxLen < *len) {
- return PR_FALSE;
- }
- PORT_Memcpy(data, kNonsenseExtension, *len);
- return PR_TRUE;
-}
-
-// Override the extension handler for an natively-supported and produce
-// nonsense, which results in a handshake failure.
-TEST_F(TlsConnectStreamTls13, CustomExtensionOverride) {
- EnsureTlsSetup();
-
- // This option enables sending the extension via the native support.
- SECStatus rv = SSL_OptionSet(client_->ssl_fd(),
- SSL_ENABLE_SIGNED_CERT_TIMESTAMPS, PR_TRUE);
- EXPECT_EQ(SECSuccess, rv);
-
- // This installs an override that sends nonsense.
- rv = SSL_InstallExtensionHooks(
- client_->ssl_fd(), ssl_signed_cert_timestamp_xtn, NonsenseExtensionWriter,
- client_.get(), NoopExtensionHandler, nullptr);
- EXPECT_EQ(SECSuccess, rv);
-
- // Capture it to see what we got.
- auto capture =
- std::make_shared<TlsExtensionCapture>(ssl_signed_cert_timestamp_xtn);
- client_->SetPacketFilter(capture);
-
- ConnectExpectAlert(server_, kTlsAlertDecodeError);
-
- EXPECT_TRUE(capture->captured());
- EXPECT_EQ(DataBuffer(kNonsenseExtension, sizeof(kNonsenseExtension)),
- capture->extension());
-}
-
-static SECStatus NonsenseExtensionHandler(PRFileDesc *fd,
- SSLHandshakeType message,
- const PRUint8 *data, unsigned int len,
- SSLAlertDescription *alert,
- void *arg) {
- TlsAgent *agent = reinterpret_cast<TlsAgent *>(arg);
- EXPECT_EQ(agent->ssl_fd(), fd);
- if (agent->role() == TlsAgent::SERVER) {
- EXPECT_EQ(ssl_hs_client_hello, message);
- } else {
- EXPECT_TRUE(message == ssl_hs_server_hello ||
- message == ssl_hs_encrypted_extensions);
- }
- EXPECT_EQ(DataBuffer(kNonsenseExtension, sizeof(kNonsenseExtension)),
- DataBuffer(data, len));
- EXPECT_NE(nullptr, alert);
- return SECSuccess;
-}
-
-// Send nonsense in an extension from client to server.
-TEST_F(TlsConnectStreamTls13, CustomExtensionClientToServer) {
- EnsureTlsSetup();
-
- // This installs an override that sends nonsense.
- const uint16_t extension_code = 0xffe5;
- SECStatus rv = SSL_InstallExtensionHooks(
- client_->ssl_fd(), extension_code, NonsenseExtensionWriter, client_.get(),
- NoopExtensionHandler, nullptr);
- EXPECT_EQ(SECSuccess, rv);
-
- // Capture it to see what we got.
- auto capture = std::make_shared<TlsExtensionCapture>(extension_code);
- client_->SetPacketFilter(capture);
-
- // Handle it so that the handshake completes.
- rv = SSL_InstallExtensionHooks(server_->ssl_fd(), extension_code,
- NoopExtensionWriter, nullptr,
- NonsenseExtensionHandler, server_.get());
- EXPECT_EQ(SECSuccess, rv);
-
- Connect();
-
- EXPECT_TRUE(capture->captured());
- EXPECT_EQ(DataBuffer(kNonsenseExtension, sizeof(kNonsenseExtension)),
- capture->extension());
-}
-
-static PRBool NonsenseExtensionWriterSH(PRFileDesc *fd,
- SSLHandshakeType message, PRUint8 *data,
- unsigned int *len, unsigned int maxLen,
- void *arg) {
- if (message == ssl_hs_server_hello) {
- return NonsenseExtensionWriter(fd, message, data, len, maxLen, arg);
- }
- return PR_FALSE;
-}
-
-// Send nonsense in an extension from server to client, in ServerHello.
-TEST_F(TlsConnectStreamTls13, CustomExtensionServerToClientSH) {
- EnsureTlsSetup();
-
- // This installs an override that sends nothing but expects nonsense.
- const uint16_t extension_code = 0xff5e;
- SECStatus rv = SSL_InstallExtensionHooks(
- client_->ssl_fd(), extension_code, EmptyExtensionWriter, nullptr,
- NonsenseExtensionHandler, client_.get());
- EXPECT_EQ(SECSuccess, rv);
-
- // Have the server send nonsense.
- rv = SSL_InstallExtensionHooks(server_->ssl_fd(), extension_code,
- NonsenseExtensionWriterSH, server_.get(),
- NoopExtensionHandler, nullptr);
- EXPECT_EQ(SECSuccess, rv);
-
- // Capture the extension from the ServerHello only and check it.
- auto capture = std::make_shared<TlsExtensionCapture>(extension_code);
- capture->SetHandshakeTypes({kTlsHandshakeServerHello});
- server_->SetPacketFilter(capture);
-
- Connect();
-
- EXPECT_TRUE(capture->captured());
- EXPECT_EQ(DataBuffer(kNonsenseExtension, sizeof(kNonsenseExtension)),
- capture->extension());
-}
-
-static PRBool NonsenseExtensionWriterEE(PRFileDesc *fd,
- SSLHandshakeType message, PRUint8 *data,
- unsigned int *len, unsigned int maxLen,
- void *arg) {
- if (message == ssl_hs_encrypted_extensions) {
- return NonsenseExtensionWriter(fd, message, data, len, maxLen, arg);
- }
- return PR_FALSE;
-}
-
-// Send nonsense in an extension from server to client, in EncryptedExtensions.
-TEST_F(TlsConnectStreamTls13, CustomExtensionServerToClientEE) {
- EnsureTlsSetup();
-
- // This installs an override that sends nothing but expects nonsense.
- const uint16_t extension_code = 0xff5e;
- SECStatus rv = SSL_InstallExtensionHooks(
- client_->ssl_fd(), extension_code, EmptyExtensionWriter, nullptr,
- NonsenseExtensionHandler, client_.get());
- EXPECT_EQ(SECSuccess, rv);
-
- // Have the server send nonsense.
- rv = SSL_InstallExtensionHooks(server_->ssl_fd(), extension_code,
- NonsenseExtensionWriterEE, server_.get(),
- NoopExtensionHandler, nullptr);
- EXPECT_EQ(SECSuccess, rv);
-
- // Capture the extension from the EncryptedExtensions only and check it.
- auto capture = std::make_shared<TlsExtensionCapture>(extension_code);
- capture->SetHandshakeTypes({kTlsHandshakeEncryptedExtensions});
- server_->SetTlsRecordFilter(capture);
-
- Connect();
-
- EXPECT_TRUE(capture->captured());
- EXPECT_EQ(DataBuffer(kNonsenseExtension, sizeof(kNonsenseExtension)),
- capture->extension());
-}
-
-TEST_F(TlsConnectStreamTls13, CustomExtensionUnsolicitedServer) {
- EnsureTlsSetup();
-
- const uint16_t extension_code = 0xff5e;
- SECStatus rv = SSL_InstallExtensionHooks(
- server_->ssl_fd(), extension_code, NonsenseExtensionWriter, server_.get(),
- NoopExtensionHandler, nullptr);
- EXPECT_EQ(SECSuccess, rv);
-
- // Capture it to see what we got.
- auto capture = std::make_shared<TlsExtensionCapture>(extension_code);
- server_->SetPacketFilter(capture);
-
- client_->ExpectSendAlert(kTlsAlertUnsupportedExtension);
- server_->ExpectSendAlert(kTlsAlertBadRecordMac);
- ConnectExpectFail();
-
- EXPECT_TRUE(capture->captured());
- EXPECT_EQ(DataBuffer(kNonsenseExtension, sizeof(kNonsenseExtension)),
- capture->extension());
-}
-
-SECStatus RejectExtensionHandler(PRFileDesc *fd, SSLHandshakeType message,
- const PRUint8 *data, unsigned int len,
- SSLAlertDescription *alert, void *arg) {
- return SECFailure;
-}
-
-TEST_F(TlsConnectStreamTls13, CustomExtensionServerReject) {
- EnsureTlsSetup();
-
- // This installs an override that sends nonsense.
- const uint16_t extension_code = 0xffe7;
- SECStatus rv = SSL_InstallExtensionHooks(client_->ssl_fd(), extension_code,
- EmptyExtensionWriter, nullptr,
- NoopExtensionHandler, nullptr);
- EXPECT_EQ(SECSuccess, rv);
-
- // Reject the extension for no good reason.
- rv = SSL_InstallExtensionHooks(server_->ssl_fd(), extension_code,
- NoopExtensionWriter, nullptr,
- RejectExtensionHandler, nullptr);
- EXPECT_EQ(SECSuccess, rv);
-
- ConnectExpectAlert(server_, kTlsAlertHandshakeFailure);
-}
-
-// Send nonsense in an extension from client to server.
-TEST_F(TlsConnectStreamTls13, CustomExtensionClientReject) {
- EnsureTlsSetup();
-
- // This installs an override that sends nothing but expects nonsense.
- const uint16_t extension_code = 0xff58;
- SECStatus rv = SSL_InstallExtensionHooks(client_->ssl_fd(), extension_code,
- EmptyExtensionWriter, nullptr,
- RejectExtensionHandler, nullptr);
- EXPECT_EQ(SECSuccess, rv);
-
- // Have the server send nonsense.
- rv = SSL_InstallExtensionHooks(server_->ssl_fd(), extension_code,
- EmptyExtensionWriter, nullptr,
- NoopExtensionHandler, nullptr);
- EXPECT_EQ(SECSuccess, rv);
-
- client_->ExpectSendAlert(kTlsAlertHandshakeFailure);
- server_->ExpectSendAlert(kTlsAlertBadRecordMac);
- ConnectExpectFail();
-}
-
-static const uint8_t kCustomAlert = 0xf6;
-
-SECStatus AlertExtensionHandler(PRFileDesc *fd, SSLHandshakeType message,
- const PRUint8 *data, unsigned int len,
- SSLAlertDescription *alert, void *arg) {
- *alert = kCustomAlert;
- return SECFailure;
-}
-
-TEST_F(TlsConnectStreamTls13, CustomExtensionServerRejectAlert) {
- EnsureTlsSetup();
-
- // This installs an override that sends nonsense.
- const uint16_t extension_code = 0xffea;
- SECStatus rv = SSL_InstallExtensionHooks(client_->ssl_fd(), extension_code,
- EmptyExtensionWriter, nullptr,
- NoopExtensionHandler, nullptr);
- EXPECT_EQ(SECSuccess, rv);
-
- // Reject the extension for no good reason.
- rv = SSL_InstallExtensionHooks(server_->ssl_fd(), extension_code,
- NoopExtensionWriter, nullptr,
- AlertExtensionHandler, nullptr);
- EXPECT_EQ(SECSuccess, rv);
-
- ConnectExpectAlert(server_, kCustomAlert);
-}
-
-// Send nonsense in an extension from client to server.
-TEST_F(TlsConnectStreamTls13, CustomExtensionClientRejectAlert) {
- EnsureTlsSetup();
-
- // This installs an override that sends nothing but expects nonsense.
- const uint16_t extension_code = 0xff5a;
- SECStatus rv = SSL_InstallExtensionHooks(client_->ssl_fd(), extension_code,
- EmptyExtensionWriter, nullptr,
- AlertExtensionHandler, nullptr);
- EXPECT_EQ(SECSuccess, rv);
-
- // Have the server send nonsense.
- rv = SSL_InstallExtensionHooks(server_->ssl_fd(), extension_code,
- EmptyExtensionWriter, nullptr,
- NoopExtensionHandler, nullptr);
- EXPECT_EQ(SECSuccess, rv);
-
- client_->ExpectSendAlert(kCustomAlert);
- server_->ExpectSendAlert(kTlsAlertBadRecordMac);
- ConnectExpectFail();
-}
-
-// Configure a custom extension hook badly.
-TEST_F(TlsConnectStreamTls13, CustomExtensionOnlyWriter) {
- EnsureTlsSetup();
-
- // This installs an override that sends nothing but expects nonsense.
- SECStatus rv =
- SSL_InstallExtensionHooks(client_->ssl_fd(), 0xff6c, EmptyExtensionWriter,
- nullptr, nullptr, nullptr);
- EXPECT_EQ(SECFailure, rv);
- EXPECT_EQ(SEC_ERROR_INVALID_ARGS, PORT_GetError());
-}
-
-TEST_F(TlsConnectStreamTls13, CustomExtensionOnlyHandler) {
- EnsureTlsSetup();
-
- // This installs an override that sends nothing but expects nonsense.
- SECStatus rv =
- SSL_InstallExtensionHooks(client_->ssl_fd(), 0xff6d, nullptr, nullptr,
- NoopExtensionHandler, nullptr);
- EXPECT_EQ(SECFailure, rv);
- EXPECT_EQ(SEC_ERROR_INVALID_ARGS, PORT_GetError());
-}
-
-TEST_F(TlsConnectStreamTls13, CustomExtensionOverrunBuffer) {
- EnsureTlsSetup();
- // This doesn't actually overrun the buffer, but it says that it does.
- auto overrun_writer = [](PRFileDesc *fd, SSLHandshakeType message,
- PRUint8 *data, unsigned int *len,
- unsigned int maxLen, void *arg) -> PRBool {
- *len = maxLen + 1;
- return PR_TRUE;
- };
- SECStatus rv =
- SSL_InstallExtensionHooks(client_->ssl_fd(), 0xff71, overrun_writer,
- nullptr, NoopExtensionHandler, nullptr);
- EXPECT_EQ(SECSuccess, rv);
- client_->StartConnect();
- client_->Handshake();
- client_->CheckErrorCode(SEC_ERROR_APPLICATION_CALLBACK_ERROR);
-}
-
-} // namespace "nss_test"
diff --git a/security/nss/gtests/ssl_gtest/ssl_damage_unittest.cc b/security/nss/gtests/ssl_gtest/ssl_damage_unittest.cc
index d1668b823a..69fd003313 100644
--- a/security/nss/gtests/ssl_gtest/ssl_damage_unittest.cc
+++ b/security/nss/gtests/ssl_gtest/ssl_damage_unittest.cc
@@ -29,7 +29,8 @@ TEST_F(TlsConnectTest, DamageSecretHandleClientFinished) {
SSL_LIBRARY_VERSION_TLS_1_3);
server_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_1,
SSL_LIBRARY_VERSION_TLS_1_3);
- StartConnect();
+ server_->StartConnect();
+ client_->StartConnect();
client_->Handshake();
server_->Handshake();
std::cerr << "Damaging HS secret" << std::endl;
@@ -50,12 +51,16 @@ TEST_F(TlsConnectTest, DamageSecretHandleServerFinished) {
SSL_LIBRARY_VERSION_TLS_1_3);
server_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_1,
SSL_LIBRARY_VERSION_TLS_1_3);
+ client_->ExpectSendAlert(kTlsAlertDecryptError);
+ // The server can't read the client's alert, so it also sends an alert.
+ server_->ExpectSendAlert(kTlsAlertBadRecordMac);
server_->SetPacketFilter(std::make_shared<AfterRecordN>(
server_, client_,
0, // ServerHello.
[this]() { SSLInt_DamageServerHsTrafficSecret(client_->ssl_fd()); }));
- ConnectExpectAlert(client_, kTlsAlertDecryptError);
+ ConnectExpectFail();
client_->CheckErrorCode(SSL_ERROR_BAD_HANDSHAKE_HASH_VALUE);
+ server_->CheckErrorCode(SSL_ERROR_BAD_MAC_READ);
}
TEST_P(TlsConnectGenericPre13, DamageServerSignature) {
@@ -74,7 +79,16 @@ TEST_P(TlsConnectTls13, DamageServerSignature) {
auto filter =
std::make_shared<TlsLastByteDamager>(kTlsHandshakeCertificateVerify);
server_->SetTlsRecordFilter(filter);
- ConnectExpectAlert(client_, kTlsAlertDecryptError);
+ filter->EnableDecryption();
+ client_->ExpectSendAlert(kTlsAlertDecryptError);
+ // The server can't read the client's alert, so it also sends an alert.
+ if (variant_ == ssl_variant_stream) {
+ server_->ExpectSendAlert(kTlsAlertBadRecordMac);
+ ConnectExpectFail();
+ server_->CheckErrorCode(SSL_ERROR_BAD_MAC_READ);
+ } else {
+ ConnectExpectFailOneSide(TlsAgent::CLIENT);
+ }
client_->CheckErrorCode(SEC_ERROR_BAD_SIGNATURE);
}
@@ -86,9 +100,11 @@ TEST_P(TlsConnectGeneric, DamageClientSignature) {
std::make_shared<TlsLastByteDamager>(kTlsHandshakeCertificateVerify);
client_->SetTlsRecordFilter(filter);
server_->ExpectSendAlert(kTlsAlertDecryptError);
+ filter->EnableDecryption();
// Do these handshakes by hand to avoid race condition on
// the client processing the server's alert.
- StartConnect();
+ client_->StartConnect();
+ server_->StartConnect();
client_->Handshake();
server_->Handshake();
client_->Handshake();
diff --git a/security/nss/gtests/ssl_gtest/ssl_dhe_unittest.cc b/security/nss/gtests/ssl_gtest/ssl_dhe_unittest.cc
index 4aa3bb6392..97943303ad 100644
--- a/security/nss/gtests/ssl_gtest/ssl_dhe_unittest.cc
+++ b/security/nss/gtests/ssl_gtest/ssl_dhe_unittest.cc
@@ -59,7 +59,8 @@ TEST_P(TlsConnectTls13, SharesForBothEcdheAndDhe) {
TEST_P(TlsConnectGeneric, ConnectFfdheClient) {
EnableOnlyDheCiphers();
- client_->SetOption(SSL_REQUIRE_DH_NAMED_GROUPS, PR_TRUE);
+ EXPECT_EQ(SECSuccess, SSL_OptionSet(client_->ssl_fd(),
+ SSL_REQUIRE_DH_NAMED_GROUPS, PR_TRUE));
auto groups_capture =
std::make_shared<TlsExtensionCapture>(ssl_supported_groups_xtn);
auto shares_capture =
@@ -89,7 +90,8 @@ TEST_P(TlsConnectGeneric, ConnectFfdheClient) {
// because the client automatically sends the supported groups extension.
TEST_P(TlsConnectGenericPre13, ConnectFfdheServer) {
EnableOnlyDheCiphers();
- server_->SetOption(SSL_REQUIRE_DH_NAMED_GROUPS, PR_TRUE);
+ EXPECT_EQ(SECSuccess, SSL_OptionSet(server_->ssl_fd(),
+ SSL_REQUIRE_DH_NAMED_GROUPS, PR_TRUE));
if (version_ >= SSL_LIBRARY_VERSION_TLS_1_3) {
Connect();
@@ -103,11 +105,14 @@ TEST_P(TlsConnectGenericPre13, ConnectFfdheServer) {
class TlsDheServerKeyExchangeDamager : public TlsHandshakeFilter {
public:
- TlsDheServerKeyExchangeDamager()
- : TlsHandshakeFilter({kTlsHandshakeServerKeyExchange}) {}
+ TlsDheServerKeyExchangeDamager() {}
virtual PacketFilter::Action FilterHandshake(
const TlsHandshakeFilter::HandshakeHeader& header,
const DataBuffer& input, DataBuffer* output) {
+ if (header.handshake_type() != kTlsHandshakeServerKeyExchange) {
+ return KEEP;
+ }
+
// Damage the first octet of dh_p. Anything other than the known prime will
// be rejected as "weak" when we have SSL_REQUIRE_DH_NAMED_GROUPS enabled.
*output = input;
@@ -121,7 +126,8 @@ class TlsDheServerKeyExchangeDamager : public TlsHandshakeFilter {
// the signature until everything else has been checked.
TEST_P(TlsConnectGenericPre13, DamageServerKeyShare) {
EnableOnlyDheCiphers();
- client_->SetOption(SSL_REQUIRE_DH_NAMED_GROUPS, PR_TRUE);
+ EXPECT_EQ(SECSuccess, SSL_OptionSet(client_->ssl_fd(),
+ SSL_REQUIRE_DH_NAMED_GROUPS, PR_TRUE));
server_->SetPacketFilter(std::make_shared<TlsDheServerKeyExchangeDamager>());
ConnectExpectAlert(client_, kTlsAlertIllegalParameter);
@@ -141,8 +147,7 @@ class TlsDheSkeChangeY : public TlsHandshakeFilter {
kYZeroPad
};
- TlsDheSkeChangeY(uint8_t handshake_type, ChangeYTo change)
- : TlsHandshakeFilter({handshake_type}), change_Y_(change) {}
+ TlsDheSkeChangeY(ChangeYTo change) : change_Y_(change) {}
protected:
void ChangeY(const DataBuffer& input, DataBuffer* output, size_t offset,
@@ -208,9 +213,7 @@ class TlsDheSkeChangeY : public TlsHandshakeFilter {
class TlsDheSkeChangeYServer : public TlsDheSkeChangeY {
public:
TlsDheSkeChangeYServer(ChangeYTo change, bool modify)
- : TlsDheSkeChangeY(kTlsHandshakeServerKeyExchange, change),
- modify_(modify),
- p_() {}
+ : TlsDheSkeChangeY(change), modify_(modify), p_() {}
const DataBuffer& prime() const { return p_; }
@@ -218,6 +221,10 @@ class TlsDheSkeChangeYServer : public TlsDheSkeChangeY {
virtual PacketFilter::Action FilterHandshake(
const TlsHandshakeFilter::HandshakeHeader& header,
const DataBuffer& input, DataBuffer* output) override {
+ if (header.handshake_type() != kTlsHandshakeServerKeyExchange) {
+ return KEEP;
+ }
+
size_t offset = 2;
// Read dh_p
uint32_t dh_len = 0;
@@ -247,13 +254,16 @@ class TlsDheSkeChangeYClient : public TlsDheSkeChangeY {
TlsDheSkeChangeYClient(
ChangeYTo change,
std::shared_ptr<const TlsDheSkeChangeYServer> server_filter)
- : TlsDheSkeChangeY(kTlsHandshakeClientKeyExchange, change),
- server_filter_(server_filter) {}
+ : TlsDheSkeChangeY(change), server_filter_(server_filter) {}
protected:
virtual PacketFilter::Action FilterHandshake(
const TlsHandshakeFilter::HandshakeHeader& header,
const DataBuffer& input, DataBuffer* output) override {
+ if (header.handshake_type() != kTlsHandshakeClientKeyExchange) {
+ return KEEP;
+ }
+
ChangeY(input, output, 0, server_filter_->prime());
return CHANGE;
}
@@ -279,7 +289,8 @@ class TlsDamageDHYTest
TEST_P(TlsDamageDHYTest, DamageServerY) {
EnableOnlyDheCiphers();
if (std::get<3>(GetParam())) {
- client_->SetOption(SSL_REQUIRE_DH_NAMED_GROUPS, PR_TRUE);
+ EXPECT_EQ(SECSuccess, SSL_OptionSet(client_->ssl_fd(),
+ SSL_REQUIRE_DH_NAMED_GROUPS, PR_TRUE));
}
TlsDheSkeChangeY::ChangeYTo change = std::get<2>(GetParam());
server_->SetPacketFilter(
@@ -309,7 +320,8 @@ TEST_P(TlsDamageDHYTest, DamageServerY) {
TEST_P(TlsDamageDHYTest, DamageClientY) {
EnableOnlyDheCiphers();
if (std::get<3>(GetParam())) {
- client_->SetOption(SSL_REQUIRE_DH_NAMED_GROUPS, PR_TRUE);
+ EXPECT_EQ(SECSuccess, SSL_OptionSet(client_->ssl_fd(),
+ SSL_REQUIRE_DH_NAMED_GROUPS, PR_TRUE));
}
// The filter on the server is required to capture the prime.
auto server_filter =
@@ -358,10 +370,13 @@ INSTANTIATE_TEST_CASE_P(
class TlsDheSkeMakePEven : public TlsHandshakeFilter {
public:
- TlsDheSkeMakePEven() : TlsHandshakeFilter({kTlsHandshakeServerKeyExchange}) {}
virtual PacketFilter::Action FilterHandshake(
const TlsHandshakeFilter::HandshakeHeader& header,
const DataBuffer& input, DataBuffer* output) {
+ if (header.handshake_type() != kTlsHandshakeServerKeyExchange) {
+ return KEEP;
+ }
+
// Find the end of dh_p
uint32_t dh_len = 0;
EXPECT_TRUE(input.Read(0, 2, &dh_len));
@@ -389,10 +404,13 @@ TEST_P(TlsConnectGenericPre13, MakeDhePEven) {
class TlsDheSkeZeroPadP : public TlsHandshakeFilter {
public:
- TlsDheSkeZeroPadP() : TlsHandshakeFilter({kTlsHandshakeServerKeyExchange}) {}
virtual PacketFilter::Action FilterHandshake(
const TlsHandshakeFilter::HandshakeHeader& header,
const DataBuffer& input, DataBuffer* output) {
+ if (header.handshake_type() != kTlsHandshakeServerKeyExchange) {
+ return KEEP;
+ }
+
*output = input;
uint32_t dh_len = 0;
EXPECT_TRUE(input.Read(0, 2, &dh_len));
@@ -427,7 +445,8 @@ TEST_P(TlsConnectGenericPre13, PadDheP) {
// Note: This test case can take ages to generate the weak DH key.
TEST_P(TlsConnectGenericPre13, WeakDHGroup) {
EnableOnlyDheCiphers();
- client_->SetOption(SSL_REQUIRE_DH_NAMED_GROUPS, PR_TRUE);
+ EXPECT_EQ(SECSuccess, SSL_OptionSet(client_->ssl_fd(),
+ SSL_REQUIRE_DH_NAMED_GROUPS, PR_TRUE));
EXPECT_EQ(SECSuccess,
SSL_EnableWeakDHEPrimeGroup(server_->ssl_fd(), PR_TRUE));
@@ -477,7 +496,8 @@ TEST_P(TlsConnectTls13, NamedGroupMismatch13) {
// custom group in contrast to the previous test.
TEST_P(TlsConnectGenericPre13, RequireNamedGroupsMismatchPre13) {
EnableOnlyDheCiphers();
- client_->SetOption(SSL_REQUIRE_DH_NAMED_GROUPS, PR_TRUE);
+ EXPECT_EQ(SECSuccess, SSL_OptionSet(client_->ssl_fd(),
+ SSL_REQUIRE_DH_NAMED_GROUPS, PR_TRUE));
static const std::vector<SSLNamedGroup> server_groups = {ssl_grp_ffdhe_3072};
static const std::vector<SSLNamedGroup> client_groups = {ssl_grp_ec_secp256r1,
ssl_grp_ffdhe_2048};
@@ -505,7 +525,8 @@ TEST_P(TlsConnectGenericPre13, PreferredFfdhe) {
TEST_P(TlsConnectGenericPre13, MismatchDHE) {
EnableOnlyDheCiphers();
- client_->SetOption(SSL_REQUIRE_DH_NAMED_GROUPS, PR_TRUE);
+ EXPECT_EQ(SECSuccess, SSL_OptionSet(client_->ssl_fd(),
+ SSL_REQUIRE_DH_NAMED_GROUPS, PR_TRUE));
static const SSLDHEGroupType serverGroups[] = {ssl_ff_dhe_3072_group};
EXPECT_EQ(SECSuccess, SSL_DHEGroupPrefSet(server_->ssl_fd(), serverGroups,
PR_ARRAY_SIZE(serverGroups)));
@@ -523,8 +544,7 @@ TEST_P(TlsConnectTls13, ResumeFfdhe) {
ConfigureSessionCache(RESUME_BOTH, RESUME_TICKET);
Connect();
SendReceive(); // Need to read so that we absorb the session ticket.
- CheckKeys(ssl_kea_dh, ssl_grp_ffdhe_2048, ssl_auth_rsa_sign,
- ssl_sig_rsa_pss_sha256);
+ CheckKeys(ssl_kea_dh, ssl_auth_rsa_sign);
Reset();
ConfigureSessionCache(RESUME_BOTH, RESUME_TICKET);
@@ -537,8 +557,7 @@ TEST_P(TlsConnectTls13, ResumeFfdhe) {
server_->SetPacketFilter(serverCapture);
ExpectResumption(RESUME_TICKET);
Connect();
- CheckKeys(ssl_kea_dh, ssl_grp_ffdhe_2048, ssl_auth_rsa_sign,
- ssl_sig_rsa_pss_sha256);
+ CheckKeys(ssl_kea_dh, ssl_grp_ffdhe_2048, ssl_auth_rsa_sign, ssl_sig_none);
ASSERT_LT(0UL, clientCapture->extension().len());
ASSERT_LT(0UL, serverCapture->extension().len());
}
@@ -546,15 +565,16 @@ TEST_P(TlsConnectTls13, ResumeFfdhe) {
class TlsDheSkeChangeSignature : public TlsHandshakeFilter {
public:
TlsDheSkeChangeSignature(uint16_t version, const uint8_t* data, size_t len)
- : TlsHandshakeFilter({kTlsHandshakeServerKeyExchange}),
- version_(version),
- data_(data),
- len_(len) {}
+ : version_(version), data_(data), len_(len) {}
protected:
virtual PacketFilter::Action FilterHandshake(const HandshakeHeader& header,
const DataBuffer& input,
DataBuffer* output) {
+ if (header.handshake_type() != kTlsHandshakeServerKeyExchange) {
+ return KEEP;
+ }
+
TlsParser parser(input);
EXPECT_TRUE(parser.SkipVariable(2)); // dh_p
EXPECT_TRUE(parser.SkipVariable(2)); // dh_g
diff --git a/security/nss/gtests/ssl_gtest/ssl_drop_unittest.cc b/security/nss/gtests/ssl_gtest/ssl_drop_unittest.cc
index c059e9938d..3cc3b0e620 100644
--- a/security/nss/gtests/ssl_gtest/ssl_drop_unittest.cc
+++ b/security/nss/gtests/ssl_gtest/ssl_drop_unittest.cc
@@ -6,7 +6,6 @@
#include "secerr.h"
#include "ssl.h"
-#include "sslexp.h"
extern "C" {
// This is not something that should make you happy.
@@ -21,13 +20,13 @@ extern "C" {
namespace nss_test {
-TEST_P(TlsConnectDatagramPre13, DropClientFirstFlightOnce) {
+TEST_P(TlsConnectDatagram, DropClientFirstFlightOnce) {
client_->SetPacketFilter(std::make_shared<SelectiveDropFilter>(0x1));
Connect();
SendReceive();
}
-TEST_P(TlsConnectDatagramPre13, DropServerFirstFlightOnce) {
+TEST_P(TlsConnectDatagram, DropServerFirstFlightOnce) {
server_->SetPacketFilter(std::make_shared<SelectiveDropFilter>(0x1));
Connect();
SendReceive();
@@ -36,760 +35,36 @@ TEST_P(TlsConnectDatagramPre13, DropServerFirstFlightOnce) {
// This drops the first transmission from both the client and server of all
// flights that they send. Note: In DTLS 1.3, the shorter handshake means that
// this will also drop some application data, so we can't call SendReceive().
-TEST_P(TlsConnectDatagramPre13, DropAllFirstTransmissions) {
+TEST_P(TlsConnectDatagram, DropAllFirstTransmissions) {
client_->SetPacketFilter(std::make_shared<SelectiveDropFilter>(0x15));
server_->SetPacketFilter(std::make_shared<SelectiveDropFilter>(0x5));
Connect();
}
// This drops the server's first flight three times.
-TEST_P(TlsConnectDatagramPre13, DropServerFirstFlightThrice) {
+TEST_P(TlsConnectDatagram, DropServerFirstFlightThrice) {
server_->SetPacketFilter(std::make_shared<SelectiveDropFilter>(0x7));
Connect();
}
// This drops the client's second flight once
-TEST_P(TlsConnectDatagramPre13, DropClientSecondFlightOnce) {
+TEST_P(TlsConnectDatagram, DropClientSecondFlightOnce) {
client_->SetPacketFilter(std::make_shared<SelectiveDropFilter>(0x2));
Connect();
}
// This drops the client's second flight three times.
-TEST_P(TlsConnectDatagramPre13, DropClientSecondFlightThrice) {
+TEST_P(TlsConnectDatagram, DropClientSecondFlightThrice) {
client_->SetPacketFilter(std::make_shared<SelectiveDropFilter>(0xe));
Connect();
}
// This drops the server's second flight three times.
-TEST_P(TlsConnectDatagramPre13, DropServerSecondFlightThrice) {
+TEST_P(TlsConnectDatagram, DropServerSecondFlightThrice) {
server_->SetPacketFilter(std::make_shared<SelectiveDropFilter>(0xe));
Connect();
}
-class TlsDropDatagram13 : public TlsConnectDatagram13 {
- public:
- TlsDropDatagram13()
- : client_filters_(),
- server_filters_(),
- expected_client_acks_(0),
- expected_server_acks_(1) {}
-
- void SetUp() {
- TlsConnectDatagram13::SetUp();
- ConfigureSessionCache(RESUME_NONE, RESUME_NONE);
- SetFilters();
- }
-
- void SetFilters() {
- EnsureTlsSetup();
- client_->SetPacketFilter(client_filters_.chain_);
- client_filters_.ack_->SetAgent(client_.get());
- client_filters_.ack_->EnableDecryption();
- server_->SetPacketFilter(server_filters_.chain_);
- server_filters_.ack_->SetAgent(server_.get());
- server_filters_.ack_->EnableDecryption();
- }
-
- void HandshakeAndAck(const std::shared_ptr<TlsAgent>& agent) {
- agent->Handshake(); // Read flight.
- ShiftDtlsTimers();
- agent->Handshake(); // Generate ACK.
- }
-
- void ShrinkPostServerHelloMtu() {
- // Abuse the custom extension mechanism to modify the MTU so that the
- // Certificate message is split into two pieces.
- ASSERT_EQ(
- SECSuccess,
- SSL_InstallExtensionHooks(
- server_->ssl_fd(), 1,
- [](PRFileDesc* fd, SSLHandshakeType message, PRUint8* data,
- unsigned int* len, unsigned int maxLen, void* arg) -> PRBool {
- SSLInt_SetMTU(fd, 500); // Splits the certificate.
- return PR_FALSE;
- },
- nullptr,
- [](PRFileDesc* fd, SSLHandshakeType message, const PRUint8* data,
- unsigned int len, SSLAlertDescription* alert,
- void* arg) -> SECStatus { return SECSuccess; },
- nullptr));
- }
-
- protected:
- class DropAckChain {
- public:
- DropAckChain()
- : records_(std::make_shared<TlsRecordRecorder>()),
- ack_(std::make_shared<TlsRecordRecorder>(content_ack)),
- drop_(std::make_shared<SelectiveRecordDropFilter>(0, false)),
- chain_(std::make_shared<ChainedPacketFilter>(
- ChainedPacketFilterInit({records_, ack_, drop_}))) {}
-
- const TlsRecord& record(size_t i) const { return records_->record(i); }
-
- std::shared_ptr<TlsRecordRecorder> records_;
- std::shared_ptr<TlsRecordRecorder> ack_;
- std::shared_ptr<SelectiveRecordDropFilter> drop_;
- std::shared_ptr<PacketFilter> chain_;
- };
-
- void CheckAcks(const DropAckChain& chain, size_t index,
- std::vector<uint64_t> acks) {
- const DataBuffer& buf = chain.ack_->record(index).buffer;
- size_t offset = 0;
-
- EXPECT_EQ(acks.size() * 8, buf.len());
- if ((acks.size() * 8) != buf.len()) {
- while (offset < buf.len()) {
- uint64_t ack;
- ASSERT_TRUE(buf.Read(offset, 8, &ack));
- offset += 8;
- std::cerr << "Ack=0x" << std::hex << ack << std::dec << std::endl;
- }
- return;
- }
-
- for (size_t i = 0; i < acks.size(); ++i) {
- uint64_t a = acks[i];
- uint64_t ack;
- ASSERT_TRUE(buf.Read(offset, 8, &ack));
- offset += 8;
- if (a != ack) {
- ADD_FAILURE() << "Wrong ack " << i << " expected=0x" << std::hex << a
- << " got=0x" << ack << std::dec;
- }
- }
- }
-
- void CheckedHandshakeSendReceive() {
- Handshake();
- CheckPostHandshake();
- }
-
- void CheckPostHandshake() {
- CheckConnected();
- SendReceive();
- EXPECT_EQ(expected_client_acks_, client_filters_.ack_->count());
- EXPECT_EQ(expected_server_acks_, server_filters_.ack_->count());
- }
-
- protected:
- DropAckChain client_filters_;
- DropAckChain server_filters_;
- size_t expected_client_acks_;
- size_t expected_server_acks_;
-};
-
-// All of these tests produce a minimum one ACK, from the server
-// to the client upon receiving the client Finished.
-// Dropping complete first and second flights does not produce
-// ACKs
-TEST_F(TlsDropDatagram13, DropClientFirstFlightOnce) {
- client_filters_.drop_->Reset({0});
- StartConnect();
- client_->Handshake();
- server_->Handshake();
- CheckedHandshakeSendReceive();
- CheckAcks(server_filters_, 0, {0x0002000000000000ULL});
-}
-
-TEST_F(TlsDropDatagram13, DropServerFirstFlightOnce) {
- server_filters_.drop_->Reset(0xff);
- StartConnect();
- client_->Handshake();
- // Send the first flight, all dropped.
- server_->Handshake();
- server_filters_.drop_->Disable();
- CheckedHandshakeSendReceive();
- CheckAcks(server_filters_, 0, {0x0002000000000000ULL});
-}
-
-// Dropping the server's first record also does not produce
-// an ACK because the next record is ignored.
-// TODO(ekr@rtfm.com): We should generate an empty ACK.
-TEST_F(TlsDropDatagram13, DropServerFirstRecordOnce) {
- server_filters_.drop_->Reset({0});
- StartConnect();
- client_->Handshake();
- server_->Handshake();
- Handshake();
- CheckedHandshakeSendReceive();
- CheckAcks(server_filters_, 0, {0x0002000000000000ULL});
-}
-
-// Dropping the second packet of the server's flight should
-// produce an ACK.
-TEST_F(TlsDropDatagram13, DropServerSecondRecordOnce) {
- server_filters_.drop_->Reset({1});
- StartConnect();
- client_->Handshake();
- server_->Handshake();
- HandshakeAndAck(client_);
- expected_client_acks_ = 1;
- CheckedHandshakeSendReceive();
- CheckAcks(client_filters_, 0, {0});
- CheckAcks(server_filters_, 0, {0x0002000000000000ULL});
-}
-
-// Drop the server ACK and verify that the client retransmits
-// the ClientHello.
-TEST_F(TlsDropDatagram13, DropServerAckOnce) {
- StartConnect();
- client_->Handshake();
- server_->Handshake();
- // At this point the server has sent it's first flight,
- // so make it drop the ACK.
- server_filters_.drop_->Reset({0});
- client_->Handshake(); // Send the client Finished.
- server_->Handshake(); // Receive the Finished and send the ACK.
- EXPECT_EQ(TlsAgent::STATE_CONNECTED, client_->state());
- EXPECT_EQ(TlsAgent::STATE_CONNECTED, server_->state());
- // Wait for the DTLS timeout to make sure we retransmit the
- // Finished.
- ShiftDtlsTimers();
- client_->Handshake(); // Retransmit the Finished.
- server_->Handshake(); // Read the Finished and send an ACK.
- uint8_t buf[1];
- PRInt32 rv = PR_Read(client_->ssl_fd(), buf, sizeof(buf));
- expected_server_acks_ = 2;
- EXPECT_GT(0, rv);
- EXPECT_EQ(PR_WOULD_BLOCK_ERROR, PORT_GetError());
- CheckPostHandshake();
- // There should be two copies of the finished ACK
- CheckAcks(server_filters_, 0, {0x0002000000000000ULL});
- CheckAcks(server_filters_, 0, {0x0002000000000000ULL});
-}
-
-// Drop the client certificate verify.
-TEST_F(TlsDropDatagram13, DropClientCertVerify) {
- StartConnect();
- client_->SetupClientAuth();
- server_->RequestClientAuth(true);
- client_->Handshake();
- server_->Handshake();
- // Have the client drop Cert Verify
- client_filters_.drop_->Reset({1});
- expected_server_acks_ = 2;
- CheckedHandshakeSendReceive();
- // Ack of the Cert.
- CheckAcks(server_filters_, 0, {0x0002000000000000ULL});
- // Ack of the whole client handshake.
- CheckAcks(
- server_filters_, 1,
- {0x0002000000000000ULL, // CH (we drop everything after this on client)
- 0x0002000000000003ULL, // CT (2)
- 0x0002000000000004ULL} // FIN (2)
- );
-}
-
-// Shrink the MTU down so that certs get split and drop the first piece.
-TEST_F(TlsDropDatagram13, DropFirstHalfOfServerCertificate) {
- server_filters_.drop_->Reset({2});
- StartConnect();
- ShrinkPostServerHelloMtu();
- client_->Handshake();
- server_->Handshake();
- // Check that things got split.
- EXPECT_EQ(6UL,
- server_filters_.records_->count()); // SH, EE, CT1, CT2, CV, FIN
- size_t ct1_size = server_filters_.record(2).buffer.len();
- server_filters_.records_->Clear();
- expected_client_acks_ = 1;
- HandshakeAndAck(client_);
- server_->Handshake(); // Retransmit
- EXPECT_EQ(3UL, server_filters_.records_->count()); // CT2, CV, FIN
- // Check that the first record is CT1 (which is identical to the same
- // as the previous CT1).
- EXPECT_EQ(ct1_size, server_filters_.record(0).buffer.len());
- CheckedHandshakeSendReceive();
- CheckAcks(client_filters_, 0,
- {0, // SH
- 0x0002000000000000ULL, // EE
- 0x0002000000000002ULL} // CT2
- );
- CheckAcks(server_filters_, 0, {0x0002000000000000ULL});
-}
-
-// Shrink the MTU down so that certs get split and drop the second piece.
-TEST_F(TlsDropDatagram13, DropSecondHalfOfServerCertificate) {
- server_filters_.drop_->Reset({3});
- StartConnect();
- ShrinkPostServerHelloMtu();
- client_->Handshake();
- server_->Handshake();
- // Check that things got split.
- EXPECT_EQ(6UL,
- server_filters_.records_->count()); // SH, EE, CT1, CT2, CV, FIN
- size_t ct1_size = server_filters_.record(3).buffer.len();
- server_filters_.records_->Clear();
- expected_client_acks_ = 1;
- HandshakeAndAck(client_);
- server_->Handshake(); // Retransmit
- EXPECT_EQ(3UL, server_filters_.records_->count()); // CT1, CV, FIN
- // Check that the first record is CT1
- EXPECT_EQ(ct1_size, server_filters_.record(0).buffer.len());
- CheckedHandshakeSendReceive();
- CheckAcks(client_filters_, 0,
- {
- 0, // SH
- 0x0002000000000000ULL, // EE
- 0x0002000000000001ULL, // CT1
- });
- CheckAcks(server_filters_, 0, {0x0002000000000000ULL});
-}
-
-// In this test, the Certificate message is sent four times, we drop all or part
-// of the first three attempts:
-// 1. Without fragmentation so that we can see how big it is - we drop that.
-// 2. In two pieces - we drop half AND the resulting ACK.
-// 3. In three pieces - we drop the middle piece.
-//
-// After that we let all the ACKs through and allow the handshake to complete
-// without further interference.
-//
-// This allows us to test that ranges of handshake messages are sent correctly
-// even when there are overlapping acknowledgments; that ACKs with duplicate or
-// overlapping message ranges are handled properly; and that extra
-// retransmissions are handled properly.
-class TlsFragmentationAndRecoveryTest : public TlsDropDatagram13 {
- public:
- TlsFragmentationAndRecoveryTest() : cert_len_(0) {}
-
- protected:
- void RunTest(size_t dropped_half) {
- FirstFlightDropCertificate();
-
- SecondAttemptDropHalf(dropped_half);
- size_t dropped_half_size = server_record_len(dropped_half);
- size_t second_flight_count = server_filters_.records_->count();
-
- ThirdAttemptDropMiddle();
- size_t repaired_third_size = server_record_len((dropped_half == 0) ? 0 : 2);
- size_t third_flight_count = server_filters_.records_->count();
-
- AckAndCompleteRetransmission();
- size_t final_server_flight_count = server_filters_.records_->count();
- EXPECT_LE(3U, final_server_flight_count); // CT(sixth), CV, Fin
- CheckSizeOfSixth(dropped_half_size, repaired_third_size);
-
- SendDelayedAck();
- // Same number of messages as the last flight.
- EXPECT_EQ(final_server_flight_count, server_filters_.records_->count());
- // Double check that the Certificate size is still correct.
- CheckSizeOfSixth(dropped_half_size, repaired_third_size);
-
- CompleteHandshake(final_server_flight_count);
-
- // This is the ACK for the first attempt to send a whole certificate.
- std::vector<uint64_t> client_acks = {
- 0, // SH
- 0x0002000000000000ULL // EE
- };
- CheckAcks(client_filters_, 0, client_acks);
- // And from the second attempt for the half was kept (we delayed this ACK).
- client_acks.push_back(0x0002000000000000ULL + second_flight_count +
- ~dropped_half % 2);
- CheckAcks(client_filters_, 1, client_acks);
- // And the third attempt where the first and last thirds got through.
- client_acks.push_back(0x0002000000000000ULL + second_flight_count +
- third_flight_count - 1);
- client_acks.push_back(0x0002000000000000ULL + second_flight_count +
- third_flight_count + 1);
- CheckAcks(client_filters_, 2, client_acks);
- CheckAcks(server_filters_, 0, {0x0002000000000000ULL});
- }
-
- private:
- void FirstFlightDropCertificate() {
- StartConnect();
- client_->Handshake();
-
- // Note: 1 << N is the Nth packet, starting from zero.
- server_filters_.drop_->Reset(1 << 2); // Drop Cert0.
- server_->Handshake();
- EXPECT_EQ(5U, server_filters_.records_->count()); // SH, EE, CT, CV, Fin
- cert_len_ = server_filters_.records_->record(2).buffer.len();
-
- HandshakeAndAck(client_);
- EXPECT_EQ(2U, client_filters_.records_->count());
- }
-
- // Lower the MTU so that the server has to split the certificate in two
- // pieces. The server resends Certificate (in two), plus CV and Fin.
- void SecondAttemptDropHalf(size_t dropped_half) {
- ASSERT_LE(0U, dropped_half);
- ASSERT_GT(2U, dropped_half);
- server_filters_.records_->Clear();
- server_filters_.drop_->Reset({dropped_half}); // Drop Cert1[half]
- SplitServerMtu(2);
- server_->Handshake();
- EXPECT_LE(4U, server_filters_.records_->count()); // CT x2, CV, Fin
-
- // Generate and capture the ACK from the client.
- client_filters_.drop_->Reset({0});
- HandshakeAndAck(client_);
- EXPECT_EQ(3U, client_filters_.records_->count());
- }
-
- // Lower the MTU again so that the server sends Certificate cut into three
- // pieces. Drop the middle piece.
- void ThirdAttemptDropMiddle() {
- server_filters_.records_->Clear();
- server_filters_.drop_->Reset({1}); // Drop Cert2[1] (of 3)
- SplitServerMtu(3);
- // Because we dropped the client ACK, the server retransmits on a timer.
- ShiftDtlsTimers();
- server_->Handshake();
- EXPECT_LE(5U, server_filters_.records_->count()); // CT x3, CV, Fin
- }
-
- void AckAndCompleteRetransmission() {
- // Generate ACKs.
- HandshakeAndAck(client_);
- // The server should send the final sixth of the certificate: the client has
- // acknowledged the first half and the last third. Also send CV and Fin.
- server_filters_.records_->Clear();
- server_->Handshake();
- }
-
- void CheckSizeOfSixth(size_t size_of_half, size_t size_of_third) {
- // Work out if the final sixth is the right size. We get the records with
- // overheads added, which obscures the length of the payload. We want to
- // ensure that the server only sent the missing sixth of the Certificate.
- //
- // We captured |size_of_half + overhead| and |size_of_third + overhead| and
- // want to calculate |size_of_third - size_of_third + overhead|. We can't
- // calculate |overhead|, but it is is (currently) always a handshake message
- // header, a content type, and an authentication tag:
- static const size_t record_overhead = 12 + 1 + 16;
- EXPECT_EQ(size_of_half - size_of_third + record_overhead,
- server_filters_.records_->record(0).buffer.len());
- }
-
- void SendDelayedAck() {
- // Send the ACK we held back. The reordered ACK doesn't add new
- // information,
- // but triggers an extra retransmission of the missing records again (even
- // though the client has all that it needs).
- client_->SendRecordDirect(client_filters_.records_->record(2));
- server_filters_.records_->Clear();
- server_->Handshake();
- }
-
- void CompleteHandshake(size_t extra_retransmissions) {
- // All this messing around shouldn't cause a failure...
- Handshake();
- // ...but it leaves a mess. Add an extra few calls to Handshake() for the
- // client so that it absorbs the extra retransmissions.
- for (size_t i = 0; i < extra_retransmissions; ++i) {
- client_->Handshake();
- }
- CheckConnected();
- }
-
- // Split the server MTU so that the Certificate is split into |count| pieces.
- // The calculation doesn't need to be perfect as long as the Certificate
- // message is split into the right number of pieces.
- void SplitServerMtu(size_t count) {
- // Set the MTU based on the formula:
- // bare_size = cert_len_ - actual_overhead
- // MTU = ceil(bare_size / count) + pessimistic_overhead
- //
- // actual_overhead is the amount of actual overhead on the record we
- // captured, which is (note that our length doesn't include the header):
- static const size_t actual_overhead = 12 + // handshake message header
- 1 + // content type
- 16; // authentication tag
- size_t bare_size = cert_len_ - actual_overhead;
-
- // pessimistic_overhead is the amount of expansion that NSS assumes will be
- // added to each handshake record. Right now, that is DTLS_MIN_FRAGMENT:
- static const size_t pessimistic_overhead =
- 12 + // handshake message header
- 1 + // content type
- 13 + // record header length
- 64; // maximum record expansion: IV, MAC and block cipher expansion
-
- size_t mtu = (bare_size + count - 1) / count + pessimistic_overhead;
- if (g_ssl_gtest_verbose) {
- std::cerr << "server: set MTU to " << mtu << std::endl;
- }
- EXPECT_EQ(SECSuccess, SSLInt_SetMTU(server_->ssl_fd(), mtu));
- }
-
- size_t server_record_len(size_t index) const {
- return server_filters_.records_->record(index).buffer.len();
- }
-
- size_t cert_len_;
-};
-
-TEST_F(TlsFragmentationAndRecoveryTest, DropFirstHalf) { RunTest(0); }
-
-TEST_F(TlsFragmentationAndRecoveryTest, DropSecondHalf) { RunTest(1); }
-
-TEST_F(TlsDropDatagram13, NoDropsDuringZeroRtt) {
- SetupForZeroRtt();
- SetFilters();
- std::cerr << "Starting second handshake" << std::endl;
- client_->Set0RttEnabled(true);
- server_->Set0RttEnabled(true);
- ExpectResumption(RESUME_TICKET);
- ZeroRttSendReceive(true, true);
- Handshake();
- ExpectEarlyDataAccepted(true);
- CheckConnected();
- SendReceive();
- CheckAcks(server_filters_, 0, {0x0002000000000000ULL});
-}
-
-TEST_F(TlsDropDatagram13, DropEEDuringZeroRtt) {
- SetupForZeroRtt();
- SetFilters();
- std::cerr << "Starting second handshake" << std::endl;
- client_->Set0RttEnabled(true);
- server_->Set0RttEnabled(true);
- ExpectResumption(RESUME_TICKET);
- server_filters_.drop_->Reset({1});
- ZeroRttSendReceive(true, true);
- HandshakeAndAck(client_);
- Handshake();
- ExpectEarlyDataAccepted(true);
- CheckConnected();
- SendReceive();
- CheckAcks(client_filters_, 0, {0});
- CheckAcks(server_filters_, 0, {0x0002000000000000ULL});
-}
-
-class TlsReorderDatagram13 : public TlsDropDatagram13 {
- public:
- TlsReorderDatagram13() {}
-
- // Send records from the records buffer in the given order.
- void ReSend(TlsAgent::Role side, std::vector<size_t> indices) {
- std::shared_ptr<TlsAgent> agent;
- std::shared_ptr<TlsRecordRecorder> records;
-
- if (side == TlsAgent::CLIENT) {
- agent = client_;
- records = client_filters_.records_;
- } else {
- agent = server_;
- records = server_filters_.records_;
- }
-
- for (auto i : indices) {
- agent->SendRecordDirect(records->record(i));
- }
- }
-};
-
-// Reorder the server records so that EE comes at the end
-// of the flight and will still produce an ACK.
-TEST_F(TlsDropDatagram13, ReorderServerEE) {
- server_filters_.drop_->Reset({1});
- StartConnect();
- client_->Handshake();
- server_->Handshake();
- // We dropped EE, now reinject.
- server_->SendRecordDirect(server_filters_.record(1));
- expected_client_acks_ = 1;
- HandshakeAndAck(client_);
- CheckedHandshakeSendReceive();
- CheckAcks(client_filters_, 0,
- {
- 0, // SH
- 0x0002000000000000, // EE
- });
- CheckAcks(server_filters_, 0, {0x0002000000000000ULL});
-}
-
-// The client sends an out of order non-handshake message
-// but with the handshake key.
-class TlsSendCipherSpecCapturer {
- public:
- TlsSendCipherSpecCapturer(std::shared_ptr<TlsAgent>& agent)
- : send_cipher_specs_() {
- SSLInt_SetCipherSpecChangeFunc(agent->ssl_fd(), CipherSpecChanged,
- (void*)this);
- }
-
- std::shared_ptr<TlsCipherSpec> spec(size_t i) {
- if (i >= send_cipher_specs_.size()) {
- return nullptr;
- }
- return send_cipher_specs_[i];
- }
-
- private:
- static void CipherSpecChanged(void* arg, PRBool sending,
- ssl3CipherSpec* newSpec) {
- if (!sending) {
- return;
- }
-
- auto self = static_cast<TlsSendCipherSpecCapturer*>(arg);
-
- auto spec = std::make_shared<TlsCipherSpec>();
- bool ret = spec->Init(SSLInt_CipherSpecToEpoch(newSpec),
- SSLInt_CipherSpecToAlgorithm(newSpec),
- SSLInt_CipherSpecToKey(newSpec),
- SSLInt_CipherSpecToIv(newSpec));
- EXPECT_EQ(true, ret);
- self->send_cipher_specs_.push_back(spec);
- }
-
- std::vector<std::shared_ptr<TlsCipherSpec>> send_cipher_specs_;
-};
-
-TEST_F(TlsDropDatagram13, SendOutOfOrderAppWithHandshakeKey) {
- StartConnect();
- TlsSendCipherSpecCapturer capturer(client_);
- client_->Handshake();
- server_->Handshake();
- client_->Handshake();
- EXPECT_EQ(TlsAgent::STATE_CONNECTED, client_->state());
- server_->Handshake();
- EXPECT_EQ(TlsAgent::STATE_CONNECTED, server_->state());
- // After the client sends Finished, inject an app data record
- // with the handshake key. This should produce an alert.
- uint8_t buf[] = {'a', 'b', 'c'};
- auto spec = capturer.spec(0);
- ASSERT_NE(nullptr, spec.get());
- ASSERT_EQ(2, spec->epoch());
- ASSERT_TRUE(client_->SendEncryptedRecord(
- spec, SSL_LIBRARY_VERSION_DTLS_1_2_WIRE, 0x0002000000000002,
- kTlsApplicationDataType, DataBuffer(buf, sizeof(buf))));
-
- // Now have the server consume the bogus message.
- server_->ExpectSendAlert(illegal_parameter, kTlsAlertFatal);
- server_->Handshake();
- EXPECT_EQ(TlsAgent::STATE_ERROR, server_->state());
- EXPECT_EQ(SSL_ERROR_RX_UNKNOWN_RECORD_TYPE, PORT_GetError());
-}
-
-TEST_F(TlsDropDatagram13, SendOutOfOrderHsNonsenseWithHandshakeKey) {
- StartConnect();
- TlsSendCipherSpecCapturer capturer(client_);
- client_->Handshake();
- server_->Handshake();
- client_->Handshake();
- EXPECT_EQ(TlsAgent::STATE_CONNECTED, client_->state());
- server_->Handshake();
- EXPECT_EQ(TlsAgent::STATE_CONNECTED, server_->state());
- // Inject a new bogus handshake record, which the server responds
- // to by just ACKing the original one (we ignore the contents).
- uint8_t buf[] = {'a', 'b', 'c'};
- auto spec = capturer.spec(0);
- ASSERT_NE(nullptr, spec.get());
- ASSERT_EQ(2, spec->epoch());
- ASSERT_TRUE(client_->SendEncryptedRecord(
- spec, SSL_LIBRARY_VERSION_DTLS_1_2_WIRE, 0x0002000000000002,
- kTlsHandshakeType, DataBuffer(buf, sizeof(buf))));
- server_->Handshake();
- EXPECT_EQ(2UL, server_filters_.ack_->count());
- CheckAcks(server_filters_, 0, {0x0002000000000000ULL});
- CheckAcks(server_filters_, 1, {0x0002000000000000ULL});
-}
-
-// Shrink the MTU down so that certs get split and then swap the first and
-// second pieces of the server certificate.
-TEST_F(TlsReorderDatagram13, ReorderServerCertificate) {
- StartConnect();
- ShrinkPostServerHelloMtu();
- client_->Handshake();
- // Drop the entire handshake flight so we can reorder.
- server_filters_.drop_->Reset(0xff);
- server_->Handshake();
- // Check that things got split.
- EXPECT_EQ(6UL,
- server_filters_.records_->count()); // CH, EE, CT1, CT2, CV, FIN
- // Now re-send things in a different order.
- ReSend(TlsAgent::SERVER, std::vector<size_t>{0, 1, 3, 2, 4, 5});
- // Clear.
- server_filters_.drop_->Disable();
- server_filters_.records_->Clear();
- // Wait for client to send ACK.
- ShiftDtlsTimers();
- CheckedHandshakeSendReceive();
- EXPECT_EQ(2UL, server_filters_.records_->count()); // ACK + Data
- CheckAcks(server_filters_, 0, {0x0002000000000000ULL});
-}
-
-TEST_F(TlsReorderDatagram13, DataAfterEOEDDuringZeroRtt) {
- SetupForZeroRtt();
- SetFilters();
- std::cerr << "Starting second handshake" << std::endl;
- client_->Set0RttEnabled(true);
- server_->Set0RttEnabled(true);
- ExpectResumption(RESUME_TICKET);
- // Send the client's first flight of zero RTT data.
- ZeroRttSendReceive(true, true);
- // Now send another client application data record but
- // capture it.
- client_filters_.records_->Clear();
- client_filters_.drop_->Reset(0xff);
- const char* k0RttData = "123456";
- const PRInt32 k0RttDataLen = static_cast<PRInt32>(strlen(k0RttData));
- PRInt32 rv =
- PR_Write(client_->ssl_fd(), k0RttData, k0RttDataLen); // 0-RTT write.
- EXPECT_EQ(k0RttDataLen, rv);
- EXPECT_EQ(1UL, client_filters_.records_->count()); // data
- server_->Handshake();
- client_->Handshake();
- ExpectEarlyDataAccepted(true);
- // The server still hasn't received anything at this point.
- EXPECT_EQ(3UL, client_filters_.records_->count()); // data, EOED, FIN
- EXPECT_EQ(TlsAgent::STATE_CONNECTED, client_->state());
- EXPECT_EQ(TlsAgent::STATE_CONNECTING, server_->state());
- // Now re-send the client's messages: EOED, data, FIN
- ReSend(TlsAgent::CLIENT, std::vector<size_t>({1, 0, 2}));
- server_->Handshake();
- CheckConnected();
- CheckAcks(server_filters_, 0, {0x0002000000000000ULL});
- uint8_t buf[8];
- rv = PR_Read(server_->ssl_fd(), buf, sizeof(buf));
- EXPECT_EQ(-1, rv);
- EXPECT_EQ(PR_WOULD_BLOCK_ERROR, PORT_GetError());
-}
-
-TEST_F(TlsReorderDatagram13, DataAfterFinDuringZeroRtt) {
- SetupForZeroRtt();
- SetFilters();
- std::cerr << "Starting second handshake" << std::endl;
- client_->Set0RttEnabled(true);
- server_->Set0RttEnabled(true);
- ExpectResumption(RESUME_TICKET);
- // Send the client's first flight of zero RTT data.
- ZeroRttSendReceive(true, true);
- // Now send another client application data record but
- // capture it.
- client_filters_.records_->Clear();
- client_filters_.drop_->Reset(0xff);
- const char* k0RttData = "123456";
- const PRInt32 k0RttDataLen = static_cast<PRInt32>(strlen(k0RttData));
- PRInt32 rv =
- PR_Write(client_->ssl_fd(), k0RttData, k0RttDataLen); // 0-RTT write.
- EXPECT_EQ(k0RttDataLen, rv);
- EXPECT_EQ(1UL, client_filters_.records_->count()); // data
- server_->Handshake();
- client_->Handshake();
- ExpectEarlyDataAccepted(true);
- // The server still hasn't received anything at this point.
- EXPECT_EQ(3UL, client_filters_.records_->count()); // EOED, FIN, Data
- EXPECT_EQ(TlsAgent::STATE_CONNECTED, client_->state());
- EXPECT_EQ(TlsAgent::STATE_CONNECTING, server_->state());
- // Now re-send the client's messages: EOED, FIN, Data
- ReSend(TlsAgent::CLIENT, std::vector<size_t>({1, 2, 0}));
- server_->Handshake();
- CheckConnected();
- CheckAcks(server_filters_, 0, {0x0002000000000000ULL});
- uint8_t buf[8];
- rv = PR_Read(server_->ssl_fd(), buf, sizeof(buf));
- EXPECT_EQ(-1, rv);
- EXPECT_EQ(PR_WOULD_BLOCK_ERROR, PORT_GetError());
-}
-
static void GetCipherAndLimit(uint16_t version, uint16_t* cipher,
uint64_t* limit = nullptr) {
uint64_t l;
@@ -836,6 +111,7 @@ TEST_P(TlsConnectDatagram12Plus, MissAWindow) {
GetCipherAndLimit(version_, &cipher);
server_->EnableSingleCipher(cipher);
Connect();
+
EXPECT_EQ(SECSuccess, SSLInt_AdvanceWriteSeqByAWindow(client_->ssl_fd(), 0));
SendReceive();
}
@@ -853,7 +129,5 @@ TEST_P(TlsConnectDatagram12Plus, MissAWindowAndOne) {
INSTANTIATE_TEST_CASE_P(Datagram12Plus, TlsConnectDatagram12Plus,
TlsConnectTestBase::kTlsV12Plus);
-INSTANTIATE_TEST_CASE_P(DatagramPre13, TlsConnectDatagramPre13,
- TlsConnectTestBase::kTlsV11V12);
} // namespace nss_test
diff --git a/security/nss/gtests/ssl_gtest/ssl_ecdh_unittest.cc b/security/nss/gtests/ssl_gtest/ssl_ecdh_unittest.cc
index e0f8b1f55f..1e406b6c20 100644
--- a/security/nss/gtests/ssl_gtest/ssl_ecdh_unittest.cc
+++ b/security/nss/gtests/ssl_gtest/ssl_ecdh_unittest.cc
@@ -193,9 +193,7 @@ TEST_P(TlsConnectGenericPre13, P384PriorityFromModelSocket) {
class TlsKeyExchangeGroupCapture : public TlsHandshakeFilter {
public:
- TlsKeyExchangeGroupCapture()
- : TlsHandshakeFilter({kTlsHandshakeServerKeyExchange}),
- group_(ssl_grp_none) {}
+ TlsKeyExchangeGroupCapture() : group_(ssl_grp_none) {}
SSLNamedGroup group() const { return group_; }
@@ -203,6 +201,10 @@ class TlsKeyExchangeGroupCapture : public TlsHandshakeFilter {
virtual PacketFilter::Action FilterHandshake(const HandshakeHeader &header,
const DataBuffer &input,
DataBuffer *output) {
+ if (header.handshake_type() != kTlsHandshakeServerKeyExchange) {
+ return KEEP;
+ }
+
uint32_t value = 0;
EXPECT_TRUE(input.Read(0, 1, &value));
EXPECT_EQ(3U, value) << "curve type has to be 3";
@@ -516,12 +518,16 @@ TEST_P(TlsKeyExchangeTest13, MultipleClientShares) {
// Replace the point in the client key exchange message with an empty one
class ECCClientKEXFilter : public TlsHandshakeFilter {
public:
- ECCClientKEXFilter() : TlsHandshakeFilter({kTlsHandshakeClientKeyExchange}) {}
+ ECCClientKEXFilter() {}
protected:
virtual PacketFilter::Action FilterHandshake(const HandshakeHeader &header,
const DataBuffer &input,
DataBuffer *output) {
+ if (header.handshake_type() != kTlsHandshakeClientKeyExchange) {
+ return KEEP;
+ }
+
// Replace the client key exchange message with an empty point
output->Allocate(1);
output->Write(0, 0U, 1); // set point length 0
@@ -532,16 +538,20 @@ class ECCClientKEXFilter : public TlsHandshakeFilter {
// Replace the point in the server key exchange message with an empty one
class ECCServerKEXFilter : public TlsHandshakeFilter {
public:
- ECCServerKEXFilter() : TlsHandshakeFilter({kTlsHandshakeServerKeyExchange}) {}
+ ECCServerKEXFilter() {}
protected:
virtual PacketFilter::Action FilterHandshake(const HandshakeHeader &header,
const DataBuffer &input,
DataBuffer *output) {
+ if (header.handshake_type() != kTlsHandshakeServerKeyExchange) {
+ return KEEP;
+ }
+
// Replace the server key exchange message with an empty point
output->Allocate(4);
output->Write(0, 3U, 1); // named curve
- uint32_t curve = 0;
+ uint32_t curve;
EXPECT_TRUE(input.Read(1, 2, &curve)); // get curve id
output->Write(1, curve, 2); // write curve id
output->Write(3, 0U, 1); // point length 0
diff --git a/security/nss/gtests/ssl_gtest/ssl_exporter_unittest.cc b/security/nss/gtests/ssl_gtest/ssl_exporter_unittest.cc
index c42883eb76..be407b42ea 100644
--- a/security/nss/gtests/ssl_gtest/ssl_exporter_unittest.cc
+++ b/security/nss/gtests/ssl_gtest/ssl_exporter_unittest.cc
@@ -118,6 +118,7 @@ int32_t RegularExporterShouldFail(TlsAgent* agent, const SECItem* srvNameArr,
TEST_P(TlsConnectTls13, EarlyExporter) {
SetupForZeroRtt();
+ ExpectAlert(client_, kTlsAlertEndOfEarlyData);
client_->Set0RttEnabled(true);
server_->Set0RttEnabled(true);
ExpectResumption(RESUME_TICKET);
diff --git a/security/nss/gtests/ssl_gtest/ssl_extension_unittest.cc b/security/nss/gtests/ssl_gtest/ssl_extension_unittest.cc
index 4142ab07af..d15139419a 100644
--- a/security/nss/gtests/ssl_gtest/ssl_extension_unittest.cc
+++ b/security/nss/gtests/ssl_gtest/ssl_extension_unittest.cc
@@ -61,14 +61,60 @@ class TlsExtensionDamager : public TlsExtensionFilter {
size_t index_;
};
+class TlsExtensionInjector : public TlsHandshakeFilter {
+ public:
+ TlsExtensionInjector(uint16_t ext, DataBuffer& data)
+ : extension_(ext), data_(data) {}
+
+ virtual PacketFilter::Action FilterHandshake(const HandshakeHeader& header,
+ const DataBuffer& input,
+ DataBuffer* output) {
+ TlsParser parser(input);
+ if (!TlsExtensionFilter::FindExtensions(&parser, header)) {
+ return KEEP;
+ }
+ size_t offset = parser.consumed();
+
+ *output = input;
+
+ // Increase the size of the extensions.
+ uint16_t ext_len;
+ memcpy(&ext_len, output->data() + offset, sizeof(ext_len));
+ ext_len = htons(ntohs(ext_len) + data_.len() + 4);
+ memcpy(output->data() + offset, &ext_len, sizeof(ext_len));
+
+ // Insert the extension type and length.
+ DataBuffer type_length;
+ type_length.Allocate(4);
+ type_length.Write(0, extension_, 2);
+ type_length.Write(2, data_.len(), 2);
+ output->Splice(type_length, offset + 2);
+
+ // Insert the payload.
+ if (data_.len() > 0) {
+ output->Splice(data_, offset + 6);
+ }
+
+ return CHANGE;
+ }
+
+ private:
+ const uint16_t extension_;
+ const DataBuffer data_;
+};
+
class TlsExtensionAppender : public TlsHandshakeFilter {
public:
TlsExtensionAppender(uint8_t handshake_type, uint16_t ext, DataBuffer& data)
- : TlsHandshakeFilter({handshake_type}), extension_(ext), data_(data) {}
+ : handshake_type_(handshake_type), extension_(ext), data_(data) {}
virtual PacketFilter::Action FilterHandshake(const HandshakeHeader& header,
const DataBuffer& input,
DataBuffer* output) {
+ if (header.handshake_type() != handshake_type_) {
+ return KEEP;
+ }
+
TlsParser parser(input);
if (!TlsExtensionFilter::FindExtensions(&parser, header)) {
return KEEP;
@@ -113,6 +159,7 @@ class TlsExtensionAppender : public TlsHandshakeFilter {
return true;
}
+ const uint8_t handshake_type_;
const uint16_t extension_;
const DataBuffer data_;
};
@@ -153,7 +200,8 @@ class TlsExtensionTestBase : public TlsConnectTestBase {
client_->ConfigNamedGroups(client_groups);
server_->ConfigNamedGroups(server_groups);
EnsureTlsSetup();
- StartConnect();
+ client_->StartConnect();
+ server_->StartConnect();
client_->Handshake(); // Send ClientHello
server_->Handshake(); // Send HRR.
client_->SetPacketFilter(std::make_shared<TlsExtensionDropper>(type));
@@ -961,6 +1009,7 @@ class TlsBogusExtensionTest : public TlsConnectTestBase,
std::make_shared<TlsExtensionAppender>(message, extension, empty);
if (version_ >= SSL_LIBRARY_VERSION_TLS_1_3) {
server_->SetTlsRecordFilter(filter);
+ filter->EnableDecryption();
} else {
server_->SetPacketFilter(filter);
}
@@ -983,20 +1032,17 @@ class TlsBogusExtensionTestPre13 : public TlsBogusExtensionTest {
class TlsBogusExtensionTest13 : public TlsBogusExtensionTest {
protected:
void ConnectAndFail(uint8_t message) override {
- if (message != kTlsHandshakeServerHello) {
+ if (message == kTlsHandshakeHelloRetryRequest) {
ConnectExpectAlert(client_, kTlsAlertUnsupportedExtension);
return;
}
- FailWithAlert(kTlsAlertUnsupportedExtension);
- }
-
- void FailWithAlert(uint8_t alert) {
- StartConnect();
+ client_->StartConnect();
+ server_->StartConnect();
client_->Handshake(); // ClientHello
server_->Handshake(); // ServerHello
- client_->ExpectSendAlert(alert);
+ client_->ExpectSendAlert(kTlsAlertUnsupportedExtension);
client_->Handshake();
if (variant_ == ssl_variant_stream) {
server_->ExpectSendAlert(kTlsAlertBadRecordMac);
@@ -1021,12 +1067,9 @@ TEST_P(TlsBogusExtensionTest13, AddBogusExtensionCertificate) {
Run(kTlsHandshakeCertificate);
}
-// It's perfectly valid to set unknown extensions in CertificateRequest.
TEST_P(TlsBogusExtensionTest13, AddBogusExtensionCertificateRequest) {
server_->RequestClientAuth(false);
- AddFilter(kTlsHandshakeCertificateRequest, 0xff);
- ConnectExpectAlert(client_, kTlsAlertDecryptError);
- client_->CheckErrorCode(SEC_ERROR_BAD_SIGNATURE);
+ Run(kTlsHandshakeCertificateRequest);
}
TEST_P(TlsBogusExtensionTest13, AddBogusExtensionHelloRetryRequest) {
@@ -1036,6 +1079,10 @@ TEST_P(TlsBogusExtensionTest13, AddBogusExtensionHelloRetryRequest) {
Run(kTlsHandshakeHelloRetryRequest);
}
+TEST_P(TlsBogusExtensionTest13, AddVersionExtensionServerHello) {
+ Run(kTlsHandshakeServerHello, ssl_tls13_supported_versions_xtn);
+}
+
TEST_P(TlsBogusExtensionTest13, AddVersionExtensionEncryptedExtensions) {
Run(kTlsHandshakeEncryptedExtensions, ssl_tls13_supported_versions_xtn);
}
@@ -1049,6 +1096,13 @@ TEST_P(TlsBogusExtensionTest13, AddVersionExtensionCertificateRequest) {
Run(kTlsHandshakeCertificateRequest, ssl_tls13_supported_versions_xtn);
}
+TEST_P(TlsBogusExtensionTest13, AddVersionExtensionHelloRetryRequest) {
+ static const std::vector<SSLNamedGroup> groups = {ssl_grp_ec_secp384r1};
+ server_->ConfigNamedGroups(groups);
+
+ Run(kTlsHandshakeHelloRetryRequest, ssl_tls13_supported_versions_xtn);
+}
+
// NewSessionTicket allows unknown extensions AND it isn't protected by the
// Finished. So adding an unknown extension doesn't cause an error.
TEST_P(TlsBogusExtensionTest13, AddBogusExtensionNewSessionTicket) {
diff --git a/security/nss/gtests/ssl_gtest/ssl_fragment_unittest.cc b/security/nss/gtests/ssl_gtest/ssl_fragment_unittest.cc
index 64b824786d..44cacce465 100644
--- a/security/nss/gtests/ssl_gtest/ssl_fragment_unittest.cc
+++ b/security/nss/gtests/ssl_gtest/ssl_fragment_unittest.cc
@@ -51,16 +51,10 @@ class RecordFragmenter : public PacketFilter {
while (parser.remaining()) {
TlsHandshakeFilter::HandshakeHeader handshake_header;
DataBuffer handshake_body;
- bool complete = false;
- if (!handshake_header.Parse(&parser, record_header, DataBuffer(),
- &handshake_body, &complete)) {
+ if (!handshake_header.Parse(&parser, record_header, &handshake_body)) {
ADD_FAILURE() << "couldn't parse handshake header";
return false;
}
- if (!complete) {
- ADD_FAILURE() << "don't want to deal with fragmented messages";
- return false;
- }
DataBuffer record_fragment;
// We can't fragment handshake records that are too small.
@@ -88,7 +82,7 @@ class RecordFragmenter : public PacketFilter {
while (parser.remaining()) {
TlsRecordHeader header;
DataBuffer record;
- if (!header.Parse(0, &parser, &record)) {
+ if (!header.Parse(&parser, &record)) {
ADD_FAILURE() << "bad record header";
return false;
}
diff --git a/security/nss/gtests/ssl_gtest/ssl_fuzz_unittest.cc b/security/nss/gtests/ssl_gtest/ssl_fuzz_unittest.cc
index ab4c0eab7e..1587b66de9 100644
--- a/security/nss/gtests/ssl_gtest/ssl_fuzz_unittest.cc
+++ b/security/nss/gtests/ssl_gtest/ssl_fuzz_unittest.cc
@@ -47,9 +47,9 @@ class TlsApplicationDataRecorder : public TlsRecordFilter {
// Ensure that ssl_Time() returns a constant value.
FUZZ_F(TlsFuzzTest, SSL_Time_Constant) {
- PRUint32 now = ssl_TimeSec();
+ PRUint32 now = ssl_Time();
PR_Sleep(PR_SecondsToInterval(2));
- EXPECT_EQ(ssl_TimeSec(), now);
+ EXPECT_EQ(ssl_Time(), now);
}
// Check that due to the deterministic PRNG we derive
@@ -215,6 +215,58 @@ FUZZ_P(TlsConnectGeneric, SessionTicketResumption) {
SendReceive();
}
+class TlsSessionTicketMacDamager : public TlsExtensionFilter {
+ public:
+ TlsSessionTicketMacDamager() {}
+ virtual PacketFilter::Action FilterExtension(uint16_t extension_type,
+ const DataBuffer& input,
+ DataBuffer* output) {
+ if (extension_type != ssl_session_ticket_xtn &&
+ extension_type != ssl_tls13_pre_shared_key_xtn) {
+ return KEEP;
+ }
+
+ *output = input;
+
+ // Handle everything before TLS 1.3.
+ if (extension_type == ssl_session_ticket_xtn) {
+ // Modify the last byte of the MAC.
+ output->data()[output->len() - 1] ^= 0xff;
+ }
+
+ // Handle TLS 1.3.
+ if (extension_type == ssl_tls13_pre_shared_key_xtn) {
+ TlsParser parser(input);
+
+ uint32_t ids_len;
+ EXPECT_TRUE(parser.Read(&ids_len, 2) && ids_len > 0);
+
+ uint32_t ticket_len;
+ EXPECT_TRUE(parser.Read(&ticket_len, 2) && ticket_len > 0);
+
+ // Modify the last byte of the MAC.
+ output->data()[2 + 2 + ticket_len - 1] ^= 0xff;
+ }
+
+ return CHANGE;
+ }
+};
+
+// Check that session ticket resumption works with a bad MAC.
+FUZZ_P(TlsConnectGeneric, SessionTicketResumptionBadMac) {
+ ConfigureSessionCache(RESUME_BOTH, RESUME_TICKET);
+ Connect();
+ SendReceive();
+
+ Reset();
+ ConfigureSessionCache(RESUME_BOTH, RESUME_TICKET);
+ ExpectResumption(RESUME_TICKET);
+
+ client_->SetPacketFilter(std::make_shared<TlsSessionTicketMacDamager>());
+ Connect();
+ SendReceive();
+}
+
// Check that session tickets are not encrypted.
FUZZ_P(TlsConnectGeneric, UnencryptedSessionTickets) {
ConfigureSessionCache(RESUME_TICKET, RESUME_TICKET);
@@ -224,13 +276,10 @@ FUZZ_P(TlsConnectGeneric, UnencryptedSessionTickets) {
server_->SetPacketFilter(i1);
Connect();
- std::cerr << "ticket" << i1->buffer() << std::endl;
size_t offset = 4; /* lifetime */
if (version_ == SSL_LIBRARY_VERSION_TLS_1_3) {
- offset += 4; /* ticket_age_add */
- uint32_t nonce_len = 0;
- EXPECT_TRUE(i1->buffer().Read(offset, 1, &nonce_len));
- offset += 1 + nonce_len;
+ offset += 1 + 1 + /* ke_modes */
+ 1 + 1; /* auth_modes */
}
offset += 2 + /* ticket length */
2; /* TLS_EX_SESS_TICKET_VERSION */
diff --git a/security/nss/gtests/ssl_gtest/ssl_gtest.cc b/security/nss/gtests/ssl_gtest/ssl_gtest.cc
index 2fff9d7cbb..cd10076b8d 100644
--- a/security/nss/gtests/ssl_gtest/ssl_gtest.cc
+++ b/security/nss/gtests/ssl_gtest/ssl_gtest.cc
@@ -6,7 +6,6 @@
#include <cstdlib>
#include "test_io.h"
-#include "databuffer.h"
#define GTEST_HAS_RTTI 0
#include "gtest/gtest.h"
@@ -29,7 +28,6 @@ int main(int argc, char** argv) {
++i;
} else if (!strcmp(argv[i], "-v")) {
g_ssl_gtest_verbose = true;
- nss_test::DataBuffer::SetLogLimit(16384);
}
}
diff --git a/security/nss/gtests/ssl_gtest/ssl_gtest.gyp b/security/nss/gtests/ssl_gtest/ssl_gtest.gyp
index e2a8d830ac..8cd7d10096 100644
--- a/security/nss/gtests/ssl_gtest/ssl_gtest.gyp
+++ b/security/nss/gtests/ssl_gtest/ssl_gtest.gyp
@@ -11,7 +11,6 @@
'target_name': 'ssl_gtest',
'type': 'executable',
'sources': [
- 'bloomfilter_unittest.cc',
'libssl_internals.c',
'selfencrypt_unittest.cc',
'ssl_0rtt_unittest.cc',
@@ -19,7 +18,6 @@
'ssl_auth_unittest.cc',
'ssl_cert_ext_unittest.cc',
'ssl_ciphersuite_unittest.cc',
- 'ssl_custext_unittest.cc',
'ssl_damage_unittest.cc',
'ssl_dhe_unittest.cc',
'ssl_drop_unittest.cc',
@@ -32,16 +30,11 @@
'ssl_gather_unittest.cc',
'ssl_gtest.cc',
'ssl_hrr_unittest.cc',
- 'ssl_keylog_unittest.cc',
- 'ssl_keyupdate_unittest.cc',
'ssl_loopback_unittest.cc',
- 'ssl_misc_unittest.cc',
'ssl_record_unittest.cc',
'ssl_resumption_unittest.cc',
- 'ssl_renegotiation_unittest.cc',
'ssl_skip_unittest.cc',
'ssl_staticrsa_unittest.cc',
- 'ssl_tls13compat_unittest.cc',
'ssl_v2_client_hello_unittest.cc',
'ssl_version_unittest.cc',
'ssl_versionpolicy_unittest.cc',
diff --git a/security/nss/gtests/ssl_gtest/ssl_hrr_unittest.cc b/security/nss/gtests/ssl_gtest/ssl_hrr_unittest.cc
index 93e19a7203..39055f6419 100644
--- a/security/nss/gtests/ssl_gtest/ssl_hrr_unittest.cc
+++ b/security/nss/gtests/ssl_gtest/ssl_hrr_unittest.cc
@@ -187,590 +187,6 @@ TEST_P(TlsConnectTls13, RetryWithSameKeyShare) {
EXPECT_EQ(SSL_ERROR_ILLEGAL_PARAMETER_ALERT, client_->error_code());
}
-// Here we modify the second ClientHello so that the client retries with the
-// same shares, even though the server wanted something else.
-TEST_P(TlsConnectTls13, RetryWithTwoShares) {
- EnsureTlsSetup();
- EXPECT_EQ(SECSuccess, SSL_SendAdditionalKeyShares(client_->ssl_fd(), 1));
- client_->SetPacketFilter(std::make_shared<KeyShareReplayer>());
-
- static const std::vector<SSLNamedGroup> groups = {ssl_grp_ec_secp384r1,
- ssl_grp_ec_secp521r1};
- server_->ConfigNamedGroups(groups);
- ConnectExpectAlert(server_, kTlsAlertIllegalParameter);
- EXPECT_EQ(SSL_ERROR_BAD_2ND_CLIENT_HELLO, server_->error_code());
- EXPECT_EQ(SSL_ERROR_ILLEGAL_PARAMETER_ALERT, client_->error_code());
-}
-
-TEST_P(TlsConnectTls13, RetryCallbackAccept) {
- EnsureTlsSetup();
-
- auto accept_hello = [](PRBool firstHello, const PRUint8* clientToken,
- unsigned int clientTokenLen, PRUint8* appToken,
- unsigned int* appTokenLen, unsigned int appTokenMax,
- void* arg) {
- auto* called = reinterpret_cast<bool*>(arg);
- *called = true;
-
- EXPECT_TRUE(firstHello);
- EXPECT_EQ(0U, clientTokenLen);
- return ssl_hello_retry_accept;
- };
-
- bool cb_run = false;
- EXPECT_EQ(SECSuccess, SSL_HelloRetryRequestCallback(server_->ssl_fd(),
- accept_hello, &cb_run));
- Connect();
- EXPECT_TRUE(cb_run);
-}
-
-TEST_P(TlsConnectTls13, RetryCallbackAcceptGroupMismatch) {
- EnsureTlsSetup();
-
- auto accept_hello_twice = [](PRBool firstHello, const PRUint8* clientToken,
- unsigned int clientTokenLen, PRUint8* appToken,
- unsigned int* appTokenLen,
- unsigned int appTokenMax, void* arg) {
- auto* called = reinterpret_cast<size_t*>(arg);
- ++*called;
-
- EXPECT_EQ(0U, clientTokenLen);
- return ssl_hello_retry_accept;
- };
-
- auto capture = std::make_shared<TlsExtensionCapture>(ssl_tls13_cookie_xtn);
- capture->SetHandshakeTypes({kTlsHandshakeHelloRetryRequest});
- server_->SetPacketFilter(capture);
-
- static const std::vector<SSLNamedGroup> groups = {ssl_grp_ec_secp384r1};
- server_->ConfigNamedGroups(groups);
-
- size_t cb_run = 0;
- EXPECT_EQ(SECSuccess, SSL_HelloRetryRequestCallback(
- server_->ssl_fd(), accept_hello_twice, &cb_run));
- Connect();
- EXPECT_EQ(2U, cb_run);
- EXPECT_TRUE(capture->captured()) << "expected a cookie in HelloRetryRequest";
-}
-
-TEST_P(TlsConnectTls13, RetryCallbackFail) {
- EnsureTlsSetup();
-
- auto fail_hello = [](PRBool firstHello, const PRUint8* clientToken,
- unsigned int clientTokenLen, PRUint8* appToken,
- unsigned int* appTokenLen, unsigned int appTokenMax,
- void* arg) {
- auto* called = reinterpret_cast<bool*>(arg);
- *called = true;
-
- EXPECT_TRUE(firstHello);
- EXPECT_EQ(0U, clientTokenLen);
- return ssl_hello_retry_fail;
- };
-
- bool cb_run = false;
- EXPECT_EQ(SECSuccess, SSL_HelloRetryRequestCallback(server_->ssl_fd(),
- fail_hello, &cb_run));
- ConnectExpectAlert(server_, kTlsAlertHandshakeFailure);
- server_->CheckErrorCode(SSL_ERROR_APPLICATION_ABORT);
- EXPECT_TRUE(cb_run);
-}
-
-// Asking for retry twice isn't allowed.
-TEST_P(TlsConnectTls13, RetryCallbackRequestHrrTwice) {
- EnsureTlsSetup();
-
- auto bad_callback = [](PRBool firstHello, const PRUint8* clientToken,
- unsigned int clientTokenLen, PRUint8* appToken,
- unsigned int* appTokenLen, unsigned int appTokenMax,
- void* arg) -> SSLHelloRetryRequestAction {
- return ssl_hello_retry_request;
- };
- EXPECT_EQ(SECSuccess, SSL_HelloRetryRequestCallback(server_->ssl_fd(),
- bad_callback, NULL));
- ConnectExpectAlert(server_, kTlsAlertInternalError);
- server_->CheckErrorCode(SSL_ERROR_APP_CALLBACK_ERROR);
-}
-
-// Accepting the CH and modifying the token isn't allowed.
-TEST_P(TlsConnectTls13, RetryCallbackAcceptAndSetToken) {
- EnsureTlsSetup();
-
- auto bad_callback = [](PRBool firstHello, const PRUint8* clientToken,
- unsigned int clientTokenLen, PRUint8* appToken,
- unsigned int* appTokenLen, unsigned int appTokenMax,
- void* arg) -> SSLHelloRetryRequestAction {
- *appTokenLen = 1;
- return ssl_hello_retry_accept;
- };
- EXPECT_EQ(SECSuccess, SSL_HelloRetryRequestCallback(server_->ssl_fd(),
- bad_callback, NULL));
- ConnectExpectAlert(server_, kTlsAlertInternalError);
- server_->CheckErrorCode(SSL_ERROR_APP_CALLBACK_ERROR);
-}
-
-// As above, but with reject.
-TEST_P(TlsConnectTls13, RetryCallbackRejectAndSetToken) {
- EnsureTlsSetup();
-
- auto bad_callback = [](PRBool firstHello, const PRUint8* clientToken,
- unsigned int clientTokenLen, PRUint8* appToken,
- unsigned int* appTokenLen, unsigned int appTokenMax,
- void* arg) -> SSLHelloRetryRequestAction {
- *appTokenLen = 1;
- return ssl_hello_retry_fail;
- };
- EXPECT_EQ(SECSuccess, SSL_HelloRetryRequestCallback(server_->ssl_fd(),
- bad_callback, NULL));
- ConnectExpectAlert(server_, kTlsAlertInternalError);
- server_->CheckErrorCode(SSL_ERROR_APP_CALLBACK_ERROR);
-}
-
-// This is a (pretend) buffer overflow.
-TEST_P(TlsConnectTls13, RetryCallbackSetTooLargeToken) {
- EnsureTlsSetup();
-
- auto bad_callback = [](PRBool firstHello, const PRUint8* clientToken,
- unsigned int clientTokenLen, PRUint8* appToken,
- unsigned int* appTokenLen, unsigned int appTokenMax,
- void* arg) -> SSLHelloRetryRequestAction {
- *appTokenLen = appTokenMax + 1;
- return ssl_hello_retry_accept;
- };
- EXPECT_EQ(SECSuccess, SSL_HelloRetryRequestCallback(server_->ssl_fd(),
- bad_callback, NULL));
- ConnectExpectAlert(server_, kTlsAlertInternalError);
- server_->CheckErrorCode(SSL_ERROR_APP_CALLBACK_ERROR);
-}
-
-SSLHelloRetryRequestAction RetryHello(PRBool firstHello,
- const PRUint8* clientToken,
- unsigned int clientTokenLen,
- PRUint8* appToken,
- unsigned int* appTokenLen,
- unsigned int appTokenMax, void* arg) {
- auto* called = reinterpret_cast<size_t*>(arg);
- ++*called;
-
- EXPECT_EQ(0U, clientTokenLen);
- return firstHello ? ssl_hello_retry_request : ssl_hello_retry_accept;
-}
-
-TEST_P(TlsConnectTls13, RetryCallbackRetry) {
- EnsureTlsSetup();
-
- auto capture_hrr = std::make_shared<TlsInspectorRecordHandshakeMessage>(
- ssl_hs_hello_retry_request);
- auto capture_key_share =
- std::make_shared<TlsExtensionCapture>(ssl_tls13_key_share_xtn);
- capture_key_share->SetHandshakeTypes({kTlsHandshakeHelloRetryRequest});
- std::vector<std::shared_ptr<PacketFilter>> chain = {capture_hrr,
- capture_key_share};
- server_->SetPacketFilter(std::make_shared<ChainedPacketFilter>(chain));
-
- size_t cb_called = 0;
- EXPECT_EQ(SECSuccess, SSL_HelloRetryRequestCallback(server_->ssl_fd(),
- RetryHello, &cb_called));
-
- // Do the first message exchange.
- StartConnect();
- client_->Handshake();
- server_->Handshake();
-
- EXPECT_EQ(1U, cb_called) << "callback should be called once here";
- EXPECT_LT(0U, capture_hrr->buffer().len()) << "HelloRetryRequest expected";
- EXPECT_FALSE(capture_key_share->captured())
- << "no key_share extension expected";
-
- auto capture_cookie =
- std::make_shared<TlsExtensionCapture>(ssl_tls13_cookie_xtn);
- client_->SetPacketFilter(capture_cookie);
-
- Handshake();
- CheckConnected();
- EXPECT_EQ(2U, cb_called);
- EXPECT_TRUE(capture_cookie->captured()) << "should have a cookie";
-}
-
-static size_t CountShares(const DataBuffer& key_share) {
- size_t count = 0;
- uint32_t len = 0;
- size_t offset = 2;
-
- EXPECT_TRUE(key_share.Read(0, 2, &len));
- EXPECT_EQ(key_share.len() - 2, len);
- while (offset < key_share.len()) {
- offset += 2; // Skip KeyShareEntry.group
- EXPECT_TRUE(key_share.Read(offset, 2, &len));
- offset += 2 + len; // Skip KeyShareEntry.key_exchange
- ++count;
- }
- return count;
-}
-
-TEST_P(TlsConnectTls13, RetryCallbackRetryWithAdditionalShares) {
- EnsureTlsSetup();
- EXPECT_EQ(SECSuccess, SSL_SendAdditionalKeyShares(client_->ssl_fd(), 1));
-
- auto capture_server =
- std::make_shared<TlsExtensionCapture>(ssl_tls13_key_share_xtn);
- capture_server->SetHandshakeTypes({kTlsHandshakeHelloRetryRequest});
- server_->SetPacketFilter(capture_server);
-
- size_t cb_called = 0;
- EXPECT_EQ(SECSuccess, SSL_HelloRetryRequestCallback(server_->ssl_fd(),
- RetryHello, &cb_called));
-
- // Do the first message exchange.
- StartConnect();
- client_->Handshake();
- server_->Handshake();
-
- EXPECT_EQ(1U, cb_called) << "callback should be called once here";
- EXPECT_FALSE(capture_server->captured())
- << "no key_share extension expected from server";
-
- auto capture_client_2nd =
- std::make_shared<TlsExtensionCapture>(ssl_tls13_key_share_xtn);
- client_->SetPacketFilter(capture_client_2nd);
-
- Handshake();
- CheckConnected();
- EXPECT_EQ(2U, cb_called);
- EXPECT_TRUE(capture_client_2nd->captured()) << "client should send key_share";
- EXPECT_EQ(2U, CountShares(capture_client_2nd->extension()))
- << "client should still send two shares";
-}
-
-// The callback should be run even if we have another reason to send
-// HelloRetryRequest. In this case, the server sends HRR because the server
-// wants a P-384 key share and the client didn't offer one.
-TEST_P(TlsConnectTls13, RetryCallbackRetryWithGroupMismatch) {
- EnsureTlsSetup();
-
- auto capture_cookie =
- std::make_shared<TlsExtensionCapture>(ssl_tls13_cookie_xtn);
- capture_cookie->SetHandshakeTypes({kTlsHandshakeHelloRetryRequest});
- auto capture_key_share =
- std::make_shared<TlsExtensionCapture>(ssl_tls13_key_share_xtn);
- capture_key_share->SetHandshakeTypes({kTlsHandshakeHelloRetryRequest});
- server_->SetPacketFilter(std::make_shared<ChainedPacketFilter>(
- ChainedPacketFilterInit{capture_cookie, capture_key_share}));
-
- static const std::vector<SSLNamedGroup> groups = {ssl_grp_ec_secp384r1};
- server_->ConfigNamedGroups(groups);
-
- size_t cb_called = 0;
- EXPECT_EQ(SECSuccess, SSL_HelloRetryRequestCallback(server_->ssl_fd(),
- RetryHello, &cb_called));
- Connect();
- EXPECT_EQ(2U, cb_called);
- EXPECT_TRUE(capture_cookie->captured()) << "cookie expected";
- EXPECT_TRUE(capture_key_share->captured()) << "key_share expected";
-}
-
-static const uint8_t kApplicationToken[] = {0x92, 0x44, 0x00};
-
-SSLHelloRetryRequestAction RetryHelloWithToken(
- PRBool firstHello, const PRUint8* clientToken, unsigned int clientTokenLen,
- PRUint8* appToken, unsigned int* appTokenLen, unsigned int appTokenMax,
- void* arg) {
- auto* called = reinterpret_cast<size_t*>(arg);
- ++*called;
-
- if (firstHello) {
- memcpy(appToken, kApplicationToken, sizeof(kApplicationToken));
- *appTokenLen = sizeof(kApplicationToken);
- return ssl_hello_retry_request;
- }
-
- EXPECT_EQ(DataBuffer(kApplicationToken, sizeof(kApplicationToken)),
- DataBuffer(clientToken, static_cast<size_t>(clientTokenLen)));
- return ssl_hello_retry_accept;
-}
-
-TEST_P(TlsConnectTls13, RetryCallbackRetryWithToken) {
- EnsureTlsSetup();
-
- auto capture_key_share =
- std::make_shared<TlsExtensionCapture>(ssl_tls13_key_share_xtn);
- capture_key_share->SetHandshakeTypes({kTlsHandshakeHelloRetryRequest});
- server_->SetPacketFilter(capture_key_share);
-
- size_t cb_called = 0;
- EXPECT_EQ(SECSuccess,
- SSL_HelloRetryRequestCallback(server_->ssl_fd(),
- RetryHelloWithToken, &cb_called));
- Connect();
- EXPECT_EQ(2U, cb_called);
- EXPECT_FALSE(capture_key_share->captured()) << "no key share expected";
-}
-
-TEST_P(TlsConnectTls13, RetryCallbackRetryWithTokenAndGroupMismatch) {
- EnsureTlsSetup();
-
- static const std::vector<SSLNamedGroup> groups = {ssl_grp_ec_secp384r1};
- server_->ConfigNamedGroups(groups);
-
- auto capture_key_share =
- std::make_shared<TlsExtensionCapture>(ssl_tls13_key_share_xtn);
- capture_key_share->SetHandshakeTypes({kTlsHandshakeHelloRetryRequest});
- server_->SetPacketFilter(capture_key_share);
-
- size_t cb_called = 0;
- EXPECT_EQ(SECSuccess,
- SSL_HelloRetryRequestCallback(server_->ssl_fd(),
- RetryHelloWithToken, &cb_called));
- Connect();
- EXPECT_EQ(2U, cb_called);
- EXPECT_TRUE(capture_key_share->captured()) << "key share expected";
-}
-
-SSLHelloRetryRequestAction CheckTicketToken(
- PRBool firstHello, const PRUint8* clientToken, unsigned int clientTokenLen,
- PRUint8* appToken, unsigned int* appTokenLen, unsigned int appTokenMax,
- void* arg) {
- auto* called = reinterpret_cast<bool*>(arg);
- *called = true;
-
- EXPECT_TRUE(firstHello);
- EXPECT_EQ(DataBuffer(kApplicationToken, sizeof(kApplicationToken)),
- DataBuffer(clientToken, static_cast<size_t>(clientTokenLen)));
- return ssl_hello_retry_accept;
-}
-
-// Stream because SSL_SendSessionTicket only supports that.
-TEST_F(TlsConnectStreamTls13, RetryCallbackWithSessionTicketToken) {
- ConfigureSessionCache(RESUME_BOTH, RESUME_TICKET);
- Connect();
- EXPECT_EQ(SECSuccess,
- SSL_SendSessionTicket(server_->ssl_fd(), kApplicationToken,
- sizeof(kApplicationToken)));
- SendReceive();
-
- Reset();
- ConfigureSessionCache(RESUME_BOTH, RESUME_TICKET);
- ExpectResumption(RESUME_TICKET);
-
- bool cb_run = false;
- EXPECT_EQ(SECSuccess, SSL_HelloRetryRequestCallback(
- server_->ssl_fd(), CheckTicketToken, &cb_run));
- Connect();
- EXPECT_TRUE(cb_run);
-}
-
-void TriggerHelloRetryRequest(std::shared_ptr<TlsAgent>& client,
- std::shared_ptr<TlsAgent>& server) {
- size_t cb_called = 0;
- EXPECT_EQ(SECSuccess, SSL_HelloRetryRequestCallback(server->ssl_fd(),
- RetryHello, &cb_called));
-
- // Start the handshake.
- client->StartConnect();
- server->StartConnect();
- client->Handshake();
- server->Handshake();
- EXPECT_EQ(1U, cb_called);
-}
-
-TEST_P(TlsConnectTls13, RetryStateless) {
- ConfigureSelfEncrypt();
- EnsureTlsSetup();
-
- TriggerHelloRetryRequest(client_, server_);
- MakeNewServer();
-
- Handshake();
- SendReceive();
-}
-
-TEST_P(TlsConnectTls13, RetryStatefulDropCookie) {
- ConfigureSelfEncrypt();
- EnsureTlsSetup();
-
- TriggerHelloRetryRequest(client_, server_);
- client_->SetPacketFilter(
- std::make_shared<TlsExtensionDropper>(ssl_tls13_cookie_xtn));
-
- ExpectAlert(server_, kTlsAlertMissingExtension);
- Handshake();
- client_->CheckErrorCode(SSL_ERROR_MISSING_EXTENSION_ALERT);
- server_->CheckErrorCode(SSL_ERROR_MISSING_COOKIE_EXTENSION);
-}
-
-// Stream only because DTLS drops bad packets.
-TEST_F(TlsConnectStreamTls13, RetryStatelessDamageFirstClientHello) {
- ConfigureSelfEncrypt();
- EnsureTlsSetup();
-
- auto damage_ch = std::make_shared<TlsExtensionInjector>(0xfff3, DataBuffer());
- client_->SetPacketFilter(damage_ch);
-
- TriggerHelloRetryRequest(client_, server_);
- MakeNewServer();
-
- // Key exchange fails when the handshake continues because client and server
- // disagree about the transcript.
- client_->ExpectSendAlert(kTlsAlertBadRecordMac);
- server_->ExpectSendAlert(kTlsAlertBadRecordMac);
- Handshake();
- server_->CheckErrorCode(SSL_ERROR_BAD_MAC_READ);
- client_->CheckErrorCode(SSL_ERROR_BAD_MAC_READ);
-}
-
-TEST_F(TlsConnectStreamTls13, RetryStatelessDamageSecondClientHello) {
- ConfigureSelfEncrypt();
- EnsureTlsSetup();
-
- TriggerHelloRetryRequest(client_, server_);
- MakeNewServer();
-
- auto damage_ch = std::make_shared<TlsExtensionInjector>(0xfff3, DataBuffer());
- client_->SetPacketFilter(damage_ch);
-
- // Key exchange fails when the handshake continues because client and server
- // disagree about the transcript.
- client_->ExpectSendAlert(kTlsAlertBadRecordMac);
- server_->ExpectSendAlert(kTlsAlertBadRecordMac);
- Handshake();
- server_->CheckErrorCode(SSL_ERROR_BAD_MAC_READ);
- client_->CheckErrorCode(SSL_ERROR_BAD_MAC_READ);
-}
-
-// Read the cipher suite from the HRR and disable it on the identified agent.
-static void DisableSuiteFromHrr(
- std::shared_ptr<TlsAgent>& agent,
- std::shared_ptr<TlsInspectorRecordHandshakeMessage>& capture_hrr) {
- uint32_t tmp;
- size_t offset = 2 + 32; // skip version + server_random
- ASSERT_TRUE(
- capture_hrr->buffer().Read(offset, 1, &tmp)); // session_id length
- EXPECT_EQ(0U, tmp);
- offset += 1 + tmp;
- ASSERT_TRUE(capture_hrr->buffer().Read(offset, 2, &tmp)); // suite
- EXPECT_EQ(
- SECSuccess,
- SSL_CipherPrefSet(agent->ssl_fd(), static_cast<uint16_t>(tmp), PR_FALSE));
-}
-
-TEST_P(TlsConnectTls13, RetryStatelessDisableSuiteClient) {
- ConfigureSelfEncrypt();
- EnsureTlsSetup();
-
- auto capture_hrr = std::make_shared<TlsInspectorRecordHandshakeMessage>(
- ssl_hs_hello_retry_request);
- server_->SetPacketFilter(capture_hrr);
-
- TriggerHelloRetryRequest(client_, server_);
- MakeNewServer();
-
- DisableSuiteFromHrr(client_, capture_hrr);
-
- // The client thinks that the HelloRetryRequest is bad, even though its
- // because it changed its mind about the cipher suite.
- ExpectAlert(client_, kTlsAlertIllegalParameter);
- Handshake();
- client_->CheckErrorCode(SSL_ERROR_NO_CYPHER_OVERLAP);
- server_->CheckErrorCode(SSL_ERROR_ILLEGAL_PARAMETER_ALERT);
-}
-
-TEST_P(TlsConnectTls13, RetryStatelessDisableSuiteServer) {
- ConfigureSelfEncrypt();
- EnsureTlsSetup();
-
- auto capture_hrr = std::make_shared<TlsInspectorRecordHandshakeMessage>(
- ssl_hs_hello_retry_request);
- server_->SetPacketFilter(capture_hrr);
-
- TriggerHelloRetryRequest(client_, server_);
- MakeNewServer();
-
- DisableSuiteFromHrr(server_, capture_hrr);
-
- ExpectAlert(server_, kTlsAlertIllegalParameter);
- Handshake();
- server_->CheckErrorCode(SSL_ERROR_BAD_2ND_CLIENT_HELLO);
- client_->CheckErrorCode(SSL_ERROR_ILLEGAL_PARAMETER_ALERT);
-}
-
-TEST_P(TlsConnectTls13, RetryStatelessDisableGroupClient) {
- ConfigureSelfEncrypt();
- EnsureTlsSetup();
-
- TriggerHelloRetryRequest(client_, server_);
- MakeNewServer();
-
- static const std::vector<SSLNamedGroup> groups = {ssl_grp_ec_secp384r1};
- client_->ConfigNamedGroups(groups);
-
- // We're into undefined behavior on the client side, but - at the point this
- // test was written - the client here doesn't amend its key shares because the
- // server doesn't ask it to. The server notices that the key share (x25519)
- // doesn't match the negotiated group (P-384) and objects.
- ExpectAlert(server_, kTlsAlertIllegalParameter);
- Handshake();
- server_->CheckErrorCode(SSL_ERROR_BAD_2ND_CLIENT_HELLO);
- client_->CheckErrorCode(SSL_ERROR_ILLEGAL_PARAMETER_ALERT);
-}
-
-TEST_P(TlsConnectTls13, RetryStatelessDisableGroupServer) {
- ConfigureSelfEncrypt();
- EnsureTlsSetup();
-
- TriggerHelloRetryRequest(client_, server_);
- MakeNewServer();
-
- static const std::vector<SSLNamedGroup> groups = {ssl_grp_ec_secp384r1};
- server_->ConfigNamedGroups(groups);
-
- ExpectAlert(server_, kTlsAlertIllegalParameter);
- Handshake();
- server_->CheckErrorCode(SSL_ERROR_BAD_2ND_CLIENT_HELLO);
- client_->CheckErrorCode(SSL_ERROR_ILLEGAL_PARAMETER_ALERT);
-}
-
-TEST_P(TlsConnectTls13, RetryStatelessBadCookie) {
- ConfigureSelfEncrypt();
- EnsureTlsSetup();
-
- TriggerHelloRetryRequest(client_, server_);
-
- // Now replace the self-encrypt MAC key with a garbage key.
- static const uint8_t bad_hmac_key[32] = {0};
- SECItem key_item = {siBuffer, const_cast<uint8_t*>(bad_hmac_key),
- sizeof(bad_hmac_key)};
- ScopedPK11SlotInfo slot(PK11_GetInternalSlot());
- PK11SymKey* hmac_key =
- PK11_ImportSymKey(slot.get(), CKM_SHA256_HMAC, PK11_OriginUnwrap,
- CKA_SIGN, &key_item, nullptr);
- ASSERT_NE(nullptr, hmac_key);
- SSLInt_SetSelfEncryptMacKey(hmac_key); // Passes ownership.
-
- MakeNewServer();
-
- ExpectAlert(server_, kTlsAlertIllegalParameter);
- Handshake();
- server_->CheckErrorCode(SSL_ERROR_BAD_2ND_CLIENT_HELLO);
- client_->CheckErrorCode(SSL_ERROR_ILLEGAL_PARAMETER_ALERT);
-}
-
-// Stream because the server doesn't consume the alert and terminate.
-TEST_F(TlsConnectStreamTls13, RetryWithDifferentCipherSuite) {
- EnsureTlsSetup();
- // Force a HelloRetryRequest.
- static const std::vector<SSLNamedGroup> groups = {ssl_grp_ec_secp384r1};
- server_->ConfigNamedGroups(groups);
- // Then switch out the default suite (TLS_AES_128_GCM_SHA256).
- server_->SetPacketFilter(std::make_shared<SelectedCipherSuiteReplacer>(
- TLS_CHACHA20_POLY1305_SHA256));
-
- client_->ExpectSendAlert(kTlsAlertIllegalParameter);
- server_->ExpectSendAlert(kTlsAlertBadRecordMac);
- ConnectExpectFail();
- EXPECT_EQ(SSL_ERROR_RX_MALFORMED_SERVER_HELLO, client_->error_code());
- EXPECT_EQ(SSL_ERROR_BAD_MAC_READ, server_->error_code());
-}
-
// This tests that the second attempt at sending a ClientHello (after receiving
// a HelloRetryRequest) is correctly retransmitted.
TEST_F(TlsConnectDatagram13, DropClientSecondFlightWithHelloRetry) {
@@ -817,54 +233,6 @@ TEST_P(TlsKeyExchange13, ConnectEcdhePreferenceMismatchHrrExtraShares) {
CheckKEXDetails(client_groups, client_groups);
}
-// The callback should be run even if we have another reason to send
-// HelloRetryRequest. In this case, the server sends HRR because the server
-// wants an X25519 key share and the client didn't offer one.
-TEST_P(TlsKeyExchange13,
- RetryCallbackRetryWithGroupMismatchAndAdditionalShares) {
- EnsureKeyShareSetup();
-
- static const std::vector<SSLNamedGroup> client_groups = {
- ssl_grp_ec_secp256r1, ssl_grp_ec_secp384r1, ssl_grp_ec_curve25519};
- client_->ConfigNamedGroups(client_groups);
- static const std::vector<SSLNamedGroup> server_groups = {
- ssl_grp_ec_curve25519};
- server_->ConfigNamedGroups(server_groups);
- EXPECT_EQ(SECSuccess, SSL_SendAdditionalKeyShares(client_->ssl_fd(), 1));
-
- auto capture_server =
- std::make_shared<TlsExtensionCapture>(ssl_tls13_key_share_xtn);
- capture_server->SetHandshakeTypes({kTlsHandshakeHelloRetryRequest});
- server_->SetPacketFilter(std::make_shared<ChainedPacketFilter>(
- ChainedPacketFilterInit{capture_hrr_, capture_server}));
-
- size_t cb_called = 0;
- EXPECT_EQ(SECSuccess, SSL_HelloRetryRequestCallback(server_->ssl_fd(),
- RetryHello, &cb_called));
-
- // Do the first message exchange.
- StartConnect();
- client_->Handshake();
- server_->Handshake();
-
- EXPECT_EQ(1U, cb_called) << "callback should be called once here";
- EXPECT_TRUE(capture_server->captured()) << "key_share extension expected";
-
- uint32_t server_group = 0;
- EXPECT_TRUE(capture_server->extension().Read(0, 2, &server_group));
- EXPECT_EQ(ssl_grp_ec_curve25519, static_cast<SSLNamedGroup>(server_group));
-
- Handshake();
- CheckConnected();
- EXPECT_EQ(2U, cb_called);
- EXPECT_TRUE(shares_capture2_->captured()) << "client should send shares";
-
- CheckKeys();
- static const std::vector<SSLNamedGroup> client_shares(
- client_groups.begin(), client_groups.begin() + 2);
- CheckKEXDetails(client_groups, client_shares, server_groups[0]);
-}
-
TEST_F(TlsConnectTest, Select12AfterHelloRetryRequest) {
EnsureTlsSetup();
client_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_2,
@@ -877,7 +245,8 @@ TEST_F(TlsConnectTest, Select12AfterHelloRetryRequest) {
static const std::vector<SSLNamedGroup> server_groups = {
ssl_grp_ec_secp384r1, ssl_grp_ec_secp521r1};
server_->ConfigNamedGroups(server_groups);
- StartConnect();
+ client_->StartConnect();
+ server_->StartConnect();
client_->Handshake();
server_->Handshake();
@@ -907,30 +276,15 @@ class HelloRetryRequestAgentTest : public TlsAgentTestClient {
void MakeCannedHrr(const uint8_t* body, size_t len, DataBuffer* hrr_record,
uint32_t seq_num = 0) const {
DataBuffer hrr_data;
- const uint8_t ssl_hello_retry_random[] = {
- 0xCF, 0x21, 0xAD, 0x74, 0xE5, 0x9A, 0x61, 0x11, 0xBE, 0x1D, 0x8C,
- 0x02, 0x1E, 0x65, 0xB8, 0x91, 0xC2, 0xA2, 0x11, 0x16, 0x7A, 0xBB,
- 0x8C, 0x5E, 0x07, 0x9E, 0x09, 0xE2, 0xC8, 0xA8, 0x33, 0x9C};
-
- hrr_data.Allocate(len + 6);
+ hrr_data.Allocate(len + 4);
size_t i = 0;
- i = hrr_data.Write(i, 0x0303, 2);
- i = hrr_data.Write(i, ssl_hello_retry_random,
- sizeof(ssl_hello_retry_random));
- i = hrr_data.Write(i, static_cast<uint32_t>(0), 1); // session_id
- i = hrr_data.Write(i, TLS_AES_128_GCM_SHA256, 2);
- i = hrr_data.Write(i, ssl_compression_null, 1);
- // Add extensions. First a length, which includes the supported version.
- i = hrr_data.Write(i, static_cast<uint32_t>(len) + 6, 2);
- // Now the supported version.
- i = hrr_data.Write(i, ssl_tls13_supported_versions_xtn, 2);
- i = hrr_data.Write(i, 2, 2);
i = hrr_data.Write(i, 0x7f00 | TLS_1_3_DRAFT_VERSION, 2);
+ i = hrr_data.Write(i, static_cast<uint32_t>(len), 2);
if (len) {
hrr_data.Write(i, body, len);
}
DataBuffer hrr;
- MakeHandshakeMessage(kTlsHandshakeServerHello, hrr_data.data(),
+ MakeHandshakeMessage(kTlsHandshakeHelloRetryRequest, hrr_data.data(),
hrr_data.len(), &hrr, seq_num);
MakeRecord(kTlsHandshakeType, SSL_LIBRARY_VERSION_TLS_1_3, hrr.data(),
hrr.len(), hrr_record, seq_num);
@@ -980,6 +334,28 @@ TEST_P(HelloRetryRequestAgentTest, HandleNoopHelloRetryRequest) {
SSL_ERROR_RX_MALFORMED_HELLO_RETRY_REQUEST);
}
+TEST_P(HelloRetryRequestAgentTest, HandleHelloRetryRequestCookie) {
+ const uint8_t canned_cookie_hrr[] = {
+ static_cast<uint8_t>(ssl_tls13_cookie_xtn >> 8),
+ static_cast<uint8_t>(ssl_tls13_cookie_xtn),
+ 0,
+ 5, // length of cookie extension
+ 0,
+ 3, // cookie value length
+ 0xc0,
+ 0x0c,
+ 0x13};
+ DataBuffer hrr;
+ MakeCannedHrr(canned_cookie_hrr, sizeof(canned_cookie_hrr), &hrr);
+ auto capture = std::make_shared<TlsExtensionCapture>(ssl_tls13_cookie_xtn);
+ agent_->SetPacketFilter(capture);
+ ProcessMessage(hrr, TlsAgent::STATE_CONNECTING);
+ const size_t cookie_pos = 2 + 2; // cookie_xtn, extension len
+ DataBuffer cookie(canned_cookie_hrr + cookie_pos,
+ sizeof(canned_cookie_hrr) - cookie_pos);
+ EXPECT_EQ(cookie, capture->extension());
+}
+
INSTANTIATE_TEST_CASE_P(HelloRetryRequestAgentTests, HelloRetryRequestAgentTest,
::testing::Combine(TlsConnectTestBase::kTlsVariantsAll,
TlsConnectTestBase::kTlsV13));
diff --git a/security/nss/gtests/ssl_gtest/ssl_keylog_unittest.cc b/security/nss/gtests/ssl_gtest/ssl_keylog_unittest.cc
deleted file mode 100644
index 8ed3423054..0000000000
--- a/security/nss/gtests/ssl_gtest/ssl_keylog_unittest.cc
+++ /dev/null
@@ -1,118 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifdef NSS_ALLOW_SSLKEYLOGFILE
-
-#include <cstdlib>
-#include <fstream>
-#include <sstream>
-
-#include "gtest_utils.h"
-#include "tls_connect.h"
-
-namespace nss_test {
-
-static const std::string keylog_file_path = "keylog.txt";
-static const std::string keylog_env = "SSLKEYLOGFILE=" + keylog_file_path;
-
-class KeyLogFileTest : public TlsConnectGeneric {
- public:
- void SetUp() {
- TlsConnectTestBase::SetUp();
- // Remove previous results (if any).
- (void)remove(keylog_file_path.c_str());
- PR_SetEnv(keylog_env.c_str());
- }
-
- void CheckKeyLog() {
- std::ifstream f(keylog_file_path);
- std::map<std::string, size_t> labels;
- std::set<std::string> client_randoms;
- for (std::string line; std::getline(f, line);) {
- if (line[0] == '#') {
- continue;
- }
-
- std::istringstream iss(line);
- std::string label, client_random, secret;
- iss >> label >> client_random >> secret;
-
- ASSERT_EQ(64U, client_random.size());
- client_randoms.insert(client_random);
- labels[label]++;
- }
-
- if (version_ < SSL_LIBRARY_VERSION_TLS_1_3) {
- ASSERT_EQ(1U, client_randoms.size());
- } else {
- /* two handshakes for 0-RTT */
- ASSERT_EQ(2U, client_randoms.size());
- }
-
- // Every entry occurs twice (one log from server, one from client).
- if (version_ < SSL_LIBRARY_VERSION_TLS_1_3) {
- ASSERT_EQ(2U, labels["CLIENT_RANDOM"]);
- } else {
- ASSERT_EQ(2U, labels["CLIENT_EARLY_TRAFFIC_SECRET"]);
- ASSERT_EQ(2U, labels["EARLY_EXPORTER_SECRET"]);
- ASSERT_EQ(4U, labels["CLIENT_HANDSHAKE_TRAFFIC_SECRET"]);
- ASSERT_EQ(4U, labels["SERVER_HANDSHAKE_TRAFFIC_SECRET"]);
- ASSERT_EQ(4U, labels["CLIENT_TRAFFIC_SECRET_0"]);
- ASSERT_EQ(4U, labels["SERVER_TRAFFIC_SECRET_0"]);
- ASSERT_EQ(4U, labels["EXPORTER_SECRET"]);
- }
- }
-
- void ConnectAndCheck() {
- // This is a child process, ensure that error messages immediately
- // propagate or else it will not be visible.
- ::testing::GTEST_FLAG(throw_on_failure) = true;
-
- if (version_ == SSL_LIBRARY_VERSION_TLS_1_3) {
- SetupForZeroRtt();
- client_->Set0RttEnabled(true);
- server_->Set0RttEnabled(true);
- ExpectResumption(RESUME_TICKET);
- ZeroRttSendReceive(true, true);
- Handshake();
- ExpectEarlyDataAccepted(true);
- CheckConnected();
- SendReceive();
- } else {
- Connect();
- }
- CheckKeyLog();
- _exit(0);
- }
-};
-
-// Tests are run in a separate process to ensure that NSS is not initialized yet
-// and can process the SSLKEYLOGFILE environment variable.
-
-TEST_P(KeyLogFileTest, KeyLogFile) {
- testing::GTEST_FLAG(death_test_style) = "threadsafe";
-
- ASSERT_EXIT(ConnectAndCheck(), ::testing::ExitedWithCode(0), "");
-}
-
-INSTANTIATE_TEST_CASE_P(
- KeyLogFileDTLS12, KeyLogFileTest,
- ::testing::Combine(TlsConnectTestBase::kTlsVariantsDatagram,
- TlsConnectTestBase::kTlsV11V12));
-INSTANTIATE_TEST_CASE_P(
- KeyLogFileTLS12, KeyLogFileTest,
- ::testing::Combine(TlsConnectTestBase::kTlsVariantsStream,
- TlsConnectTestBase::kTlsV10ToV12));
-#ifndef NSS_DISABLE_TLS_1_3
-INSTANTIATE_TEST_CASE_P(
- KeyLogFileTLS13, KeyLogFileTest,
- ::testing::Combine(TlsConnectTestBase::kTlsVariantsStream,
- TlsConnectTestBase::kTlsV13));
-#endif
-
-} // namespace nss_test
-
-#endif // NSS_ALLOW_SSLKEYLOGFILE
diff --git a/security/nss/gtests/ssl_gtest/ssl_keyupdate_unittest.cc b/security/nss/gtests/ssl_gtest/ssl_keyupdate_unittest.cc
deleted file mode 100644
index d03775c25d..0000000000
--- a/security/nss/gtests/ssl_gtest/ssl_keyupdate_unittest.cc
+++ /dev/null
@@ -1,178 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "secerr.h"
-#include "ssl.h"
-#include "sslerr.h"
-#include "sslproto.h"
-
-extern "C" {
-// This is not something that should make you happy.
-#include "libssl_internals.h"
-}
-
-#include "gtest_utils.h"
-#include "scoped_ptrs.h"
-#include "tls_connect.h"
-#include "tls_filter.h"
-#include "tls_parser.h"
-
-namespace nss_test {
-
-// All stream only tests; DTLS isn't supported yet.
-
-TEST_F(TlsConnectTest, KeyUpdateClient) {
- ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3);
- Connect();
- EXPECT_EQ(SECSuccess, SSL_KeyUpdate(client_->ssl_fd(), PR_FALSE));
- SendReceive(50);
- SendReceive(60);
- CheckEpochs(4, 3);
-}
-
-TEST_F(TlsConnectTest, KeyUpdateClientRequestUpdate) {
- ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3);
- Connect();
- EXPECT_EQ(SECSuccess, SSL_KeyUpdate(client_->ssl_fd(), PR_TRUE));
- // SendReceive() only gives each peer one chance to read. This isn't enough
- // when the read on one side generates another handshake message. A second
- // read gives each peer an extra chance to consume the KeyUpdate.
- SendReceive(50);
- SendReceive(60); // Cumulative count.
- CheckEpochs(4, 4);
-}
-
-TEST_F(TlsConnectTest, KeyUpdateServer) {
- ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3);
- Connect();
- EXPECT_EQ(SECSuccess, SSL_KeyUpdate(server_->ssl_fd(), PR_FALSE));
- SendReceive(50);
- SendReceive(60);
- CheckEpochs(3, 4);
-}
-
-TEST_F(TlsConnectTest, KeyUpdateServerRequestUpdate) {
- ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3);
- Connect();
- EXPECT_EQ(SECSuccess, SSL_KeyUpdate(server_->ssl_fd(), PR_TRUE));
- SendReceive(50);
- SendReceive(60);
- CheckEpochs(4, 4);
-}
-
-TEST_F(TlsConnectTest, KeyUpdateConsecutiveRequests) {
- ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3);
- Connect();
- EXPECT_EQ(SECSuccess, SSL_KeyUpdate(server_->ssl_fd(), PR_TRUE));
- EXPECT_EQ(SECSuccess, SSL_KeyUpdate(server_->ssl_fd(), PR_TRUE));
- SendReceive(50);
- SendReceive(60);
- // The server should have updated twice, but the client should have declined
- // to respond to the second request from the server, since it doesn't send
- // anything in between those two requests.
- CheckEpochs(4, 5);
-}
-
-// Check that a local update can be immediately followed by a remotely triggered
-// update even if there is no use of the keys.
-TEST_F(TlsConnectTest, KeyUpdateLocalUpdateThenConsecutiveRequests) {
- ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3);
- Connect();
- // This should trigger an update on the client.
- EXPECT_EQ(SECSuccess, SSL_KeyUpdate(client_->ssl_fd(), PR_FALSE));
- // The client should update for the first request.
- EXPECT_EQ(SECSuccess, SSL_KeyUpdate(server_->ssl_fd(), PR_TRUE));
- // ...but not the second.
- EXPECT_EQ(SECSuccess, SSL_KeyUpdate(server_->ssl_fd(), PR_TRUE));
- SendReceive(50);
- SendReceive(60);
- // Both should have updated twice.
- CheckEpochs(5, 5);
-}
-
-TEST_F(TlsConnectTest, KeyUpdateMultiple) {
- ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3);
- Connect();
- EXPECT_EQ(SECSuccess, SSL_KeyUpdate(server_->ssl_fd(), PR_FALSE));
- EXPECT_EQ(SECSuccess, SSL_KeyUpdate(server_->ssl_fd(), PR_TRUE));
- EXPECT_EQ(SECSuccess, SSL_KeyUpdate(server_->ssl_fd(), PR_FALSE));
- EXPECT_EQ(SECSuccess, SSL_KeyUpdate(client_->ssl_fd(), PR_FALSE));
- SendReceive(50);
- SendReceive(60);
- CheckEpochs(5, 6);
-}
-
-// Both ask the other for an update, and both should react.
-TEST_F(TlsConnectTest, KeyUpdateBothRequest) {
- ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3);
- Connect();
- EXPECT_EQ(SECSuccess, SSL_KeyUpdate(client_->ssl_fd(), PR_TRUE));
- EXPECT_EQ(SECSuccess, SSL_KeyUpdate(server_->ssl_fd(), PR_TRUE));
- SendReceive(50);
- SendReceive(60);
- CheckEpochs(5, 5);
-}
-
-// If the sequence number exceeds the number of writes before an automatic
-// update (currently 3/4 of the max records for the cipher suite), then the
-// stack should send an update automatically (but not request one).
-TEST_F(TlsConnectTest, KeyUpdateAutomaticOnWrite) {
- ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3);
- ConnectWithCipherSuite(TLS_AES_128_GCM_SHA256);
-
- // Set this to one below the write threshold.
- uint64_t threshold = (0x5aULL << 28) * 3 / 4;
- EXPECT_EQ(SECSuccess,
- SSLInt_AdvanceWriteSeqNum(client_->ssl_fd(), threshold));
- EXPECT_EQ(SECSuccess, SSLInt_AdvanceReadSeqNum(server_->ssl_fd(), threshold));
-
- // This should be OK.
- client_->SendData(10);
- server_->ReadBytes();
-
- // This should cause the client to update.
- client_->SendData(10);
- server_->ReadBytes();
-
- SendReceive(100);
- CheckEpochs(4, 3);
-}
-
-// If the sequence number exceeds a certain number of reads (currently 7/8 of
-// the max records for the cipher suite), then the stack should send AND request
-// an update automatically. However, the sender (client) will be above its
-// automatic update threshold, so the KeyUpdate - that it sends with the old
-// cipher spec - will exceed the receiver (server) automatic update threshold.
-// The receiver gets a packet with a sequence number over its automatic read
-// update threshold. Even though the sender has updated, the code that checks
-// the sequence numbers at the receiver doesn't know this and it will request an
-// update. This causes two updates: one from the sender (without requesting a
-// response) and one from the receiver (which does request a response).
-TEST_F(TlsConnectTest, KeyUpdateAutomaticOnRead) {
- ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3);
- ConnectWithCipherSuite(TLS_AES_128_GCM_SHA256);
-
- // Move to right at the read threshold. Unlike the write test, we can't send
- // packets because that would cause the client to update, which would spoil
- // the test.
- uint64_t threshold = ((0x5aULL << 28) * 7 / 8) + 1;
- EXPECT_EQ(SECSuccess,
- SSLInt_AdvanceWriteSeqNum(client_->ssl_fd(), threshold));
- EXPECT_EQ(SECSuccess, SSLInt_AdvanceReadSeqNum(server_->ssl_fd(), threshold));
-
- // This should cause the client to update, but not early enough to prevent the
- // server from updating also.
- client_->SendData(10);
- server_->ReadBytes();
-
- // Need two SendReceive() calls to ensure that the update that the server
- // requested is properly generated and consumed.
- SendReceive(70);
- SendReceive(80);
- CheckEpochs(5, 4);
-}
-
-} // namespace nss_test
diff --git a/security/nss/gtests/ssl_gtest/ssl_loopback_unittest.cc b/security/nss/gtests/ssl_gtest/ssl_loopback_unittest.cc
index 4bc6e60ab4..77703dd8ef 100644
--- a/security/nss/gtests/ssl_gtest/ssl_loopback_unittest.cc
+++ b/security/nss/gtests/ssl_gtest/ssl_loopback_unittest.cc
@@ -6,7 +6,6 @@
#include <functional>
#include <memory>
-#include <vector>
#include "secerr.h"
#include "ssl.h"
#include "sslerr.h"
@@ -85,13 +84,13 @@ class TlsAlertRecorder : public TlsRecordFilter {
};
class HelloTruncator : public TlsHandshakeFilter {
- public:
- HelloTruncator()
- : TlsHandshakeFilter(
- {kTlsHandshakeClientHello, kTlsHandshakeServerHello}) {}
PacketFilter::Action FilterHandshake(const HandshakeHeader& header,
const DataBuffer& input,
DataBuffer* output) override {
+ if (header.handshake_type() != kTlsHandshakeClientHello &&
+ header.handshake_type() != kTlsHandshakeServerHello) {
+ return KEEP;
+ }
output->Assign(input.data(), input.len() - 1);
return CHANGE;
}
@@ -103,9 +102,9 @@ TEST_P(TlsConnectGeneric, CaptureAlertServer) {
auto alert_recorder = std::make_shared<TlsAlertRecorder>();
server_->SetPacketFilter(alert_recorder);
- ConnectExpectAlert(server_, kTlsAlertDecodeError);
+ ConnectExpectAlert(server_, kTlsAlertIllegalParameter);
EXPECT_EQ(kTlsAlertFatal, alert_recorder->level());
- EXPECT_EQ(kTlsAlertDecodeError, alert_recorder->description());
+ EXPECT_EQ(kTlsAlertIllegalParameter, alert_recorder->description());
}
TEST_P(TlsConnectGenericPre13, CaptureAlertClient) {
@@ -124,7 +123,8 @@ TEST_P(TlsConnectTls13, CaptureAlertClient) {
auto alert_recorder = std::make_shared<TlsAlertRecorder>();
client_->SetPacketFilter(alert_recorder);
- StartConnect();
+ server_->StartConnect();
+ client_->StartConnect();
client_->Handshake();
client_->ExpectSendAlert(kTlsAlertDecodeError);
@@ -166,107 +166,26 @@ TEST_P(TlsConnectDatagram, ConnectSrtp) {
SendReceive();
}
-TEST_P(TlsConnectGeneric, ConnectSendReceive) {
- Connect();
- SendReceive();
-}
-
-class SaveTlsRecord : public TlsRecordFilter {
- public:
- SaveTlsRecord(size_t index) : index_(index), count_(0), contents_() {}
-
- const DataBuffer& contents() const { return contents_; }
-
- protected:
- PacketFilter::Action FilterRecord(const TlsRecordHeader& header,
- const DataBuffer& data,
- DataBuffer* changed) override {
- if (count_++ == index_) {
- contents_ = data;
- }
- return KEEP;
- }
-
- private:
- const size_t index_;
- size_t count_;
- DataBuffer contents_;
-};
-
-// Check that decrypting filters work and can read any record.
-// This test (currently) only works in TLS 1.3 where we can decrypt.
-TEST_F(TlsConnectStreamTls13, DecryptRecordClient) {
- EnsureTlsSetup();
- // 0 = ClientHello, 1 = Finished, 2 = SendReceive, 3 = SendBuffer
- auto saved = std::make_shared<SaveTlsRecord>(3);
- client_->SetTlsRecordFilter(saved);
- Connect();
- SendReceive();
-
- static const uint8_t data[] = {0xde, 0xad, 0xdc};
- DataBuffer buf(data, sizeof(data));
- client_->SendBuffer(buf);
- EXPECT_EQ(buf, saved->contents());
-}
-
-TEST_F(TlsConnectStreamTls13, DecryptRecordServer) {
- EnsureTlsSetup();
- // Disable tickets so that we are sure to not get NewSessionTicket.
- EXPECT_EQ(SECSuccess, SSL_OptionSet(server_->ssl_fd(),
- SSL_ENABLE_SESSION_TICKETS, PR_FALSE));
- // 0 = ServerHello, 1 = other handshake, 2 = SendReceive, 3 = SendBuffer
- auto saved = std::make_shared<SaveTlsRecord>(3);
- server_->SetTlsRecordFilter(saved);
+// 1.3 is disabled in the next few tests because we don't
+// presently support resumption in 1.3.
+TEST_P(TlsConnectStreamPre13, ConnectAndClientRenegotiate) {
Connect();
- SendReceive();
-
- static const uint8_t data[] = {0xde, 0xad, 0xd5};
- DataBuffer buf(data, sizeof(data));
- server_->SendBuffer(buf);
- EXPECT_EQ(buf, saved->contents());
+ server_->PrepareForRenegotiate();
+ client_->StartRenegotiate();
+ Handshake();
+ CheckConnected();
}
-class DropTlsRecord : public TlsRecordFilter {
- public:
- DropTlsRecord(size_t index) : index_(index), count_(0) {}
-
- protected:
- PacketFilter::Action FilterRecord(const TlsRecordHeader& header,
- const DataBuffer& data,
- DataBuffer* changed) override {
- if (count_++ == index_) {
- return DROP;
- }
- return KEEP;
- }
-
- private:
- const size_t index_;
- size_t count_;
-};
-
-// Test that decrypting filters work correctly and are able to drop records.
-TEST_F(TlsConnectStreamTls13, DropRecordServer) {
- EnsureTlsSetup();
- // Disable session tickets so that the server doesn't send an extra record.
- EXPECT_EQ(SECSuccess, SSL_OptionSet(server_->ssl_fd(),
- SSL_ENABLE_SESSION_TICKETS, PR_FALSE));
-
- // 0 = ServerHello, 1 = other handshake, 2 = first write
- server_->SetTlsRecordFilter(std::make_shared<DropTlsRecord>(2));
+TEST_P(TlsConnectStreamPre13, ConnectAndServerRenegotiate) {
Connect();
- server_->SendData(23, 23); // This should be dropped, so it won't be counted.
- server_->ResetSentBytes();
- SendReceive();
+ client_->PrepareForRenegotiate();
+ server_->StartRenegotiate();
+ Handshake();
+ CheckConnected();
}
-TEST_F(TlsConnectStreamTls13, DropRecordClient) {
- EnsureTlsSetup();
- // 0 = ClientHello, 1 = Finished, 2 = first write
- client_->SetTlsRecordFilter(std::make_shared<DropTlsRecord>(2));
+TEST_P(TlsConnectGeneric, ConnectSendReceive) {
Connect();
- client_->SendData(26, 26); // This should be dropped, so it won't be counted.
- client_->ResetSentBytes();
SendReceive();
}
@@ -305,70 +224,29 @@ TEST_P(TlsConnectStream, ShortRead) {
ASSERT_EQ(50U, client_->received_bytes());
}
-// We enable compression via the API but it's disabled internally,
-// so we should never get it.
-TEST_P(TlsConnectGeneric, ConnectWithCompressionEnabled) {
+TEST_P(TlsConnectGeneric, ConnectWithCompressionMaybe) {
EnsureTlsSetup();
- client_->SetOption(SSL_ENABLE_DEFLATE, PR_TRUE);
- server_->SetOption(SSL_ENABLE_DEFLATE, PR_TRUE);
+ client_->EnableCompression();
+ server_->EnableCompression();
Connect();
- EXPECT_FALSE(client_->is_compressed());
+ EXPECT_EQ(client_->version() < SSL_LIBRARY_VERSION_TLS_1_3 &&
+ variant_ != ssl_variant_datagram,
+ client_->is_compressed());
SendReceive();
}
-class TlsHolddownTest : public TlsConnectDatagram {
- protected:
- // This causes all timers to run to completion. It advances the clock and
- // handshakes on both peers until both peers have no more timers pending,
- // which should happen at the end of a handshake. This is necessary to ensure
- // that the relatively long holddown timer expires, but that any other timers
- // also expire and run correctly.
- void RunAllTimersDown() {
- while (true) {
- PRIntervalTime time;
- SECStatus rv = DTLS_GetHandshakeTimeout(client_->ssl_fd(), &time);
- if (rv != SECSuccess) {
- rv = DTLS_GetHandshakeTimeout(server_->ssl_fd(), &time);
- if (rv != SECSuccess) {
- break; // Neither peer has an outstanding timer.
- }
- }
-
- if (g_ssl_gtest_verbose) {
- std::cerr << "Shifting timers" << std::endl;
- }
- ShiftDtlsTimers();
- Handshake();
- }
- }
-};
-
-TEST_P(TlsHolddownTest, TestDtlsHolddownExpiry) {
+TEST_P(TlsConnectDatagram, TestDtlsHolddownExpiry) {
Connect();
- std::cerr << "Expiring holddown timer" << std::endl;
- RunAllTimersDown();
+ std::cerr << "Expiring holddown timer\n";
+ SSLInt_ForceTimerExpiry(client_->ssl_fd());
+ SSLInt_ForceTimerExpiry(server_->ssl_fd());
SendReceive();
if (version_ >= SSL_LIBRARY_VERSION_TLS_1_3) {
// One for send, one for receive.
- EXPECT_EQ(2, SSLInt_CountCipherSpecs(client_->ssl_fd()));
+ EXPECT_EQ(2, SSLInt_CountTls13CipherSpecs(client_->ssl_fd()));
}
}
-TEST_P(TlsHolddownTest, TestDtlsHolddownExpiryResumption) {
- ConfigureSessionCache(RESUME_BOTH, RESUME_TICKET);
- Connect();
- SendReceive();
-
- Reset();
- ConfigureSessionCache(RESUME_BOTH, RESUME_TICKET);
- ExpectResumption(RESUME_TICKET);
- Connect();
- RunAllTimersDown();
- SendReceive();
- // One for send, one for receive.
- EXPECT_EQ(2, SSLInt_CountCipherSpecs(client_->ssl_fd()));
-}
-
class TlsPreCCSHeaderInjector : public TlsRecordFilter {
public:
TlsPreCCSHeaderInjector() {}
@@ -396,7 +274,8 @@ TEST_P(TlsConnectStreamPre13, ClientFinishedHeaderBeforeCCS) {
TEST_P(TlsConnectStreamPre13, ServerFinishedHeaderBeforeCCS) {
server_->SetPacketFilter(std::make_shared<TlsPreCCSHeaderInjector>());
- StartConnect();
+ client_->StartConnect();
+ server_->StartConnect();
ExpectAlert(client_, kTlsAlertUnexpectedMessage);
Handshake();
EXPECT_EQ(TlsAgent::STATE_ERROR, client_->state());
@@ -427,65 +306,21 @@ TEST_P(TlsConnectTls13, AlertWrongLevel) {
TEST_F(TlsConnectStreamTls13, Tls13FailedWriteSecondFlight) {
EnsureTlsSetup();
- StartConnect();
+ client_->StartConnect();
+ server_->StartConnect();
client_->Handshake();
server_->Handshake(); // Send first flight.
- client_->adapter()->SetWriteError(PR_IO_ERROR);
+ client_->adapter()->CloseWrites();
client_->Handshake(); // This will get an error, but shouldn't crash.
client_->CheckErrorCode(SSL_ERROR_SOCKET_WRITE_FAILURE);
}
-TEST_P(TlsConnectDatagram, BlockedWrite) {
- Connect();
-
- // Mark the socket as blocked.
- client_->adapter()->SetWriteError(PR_WOULD_BLOCK_ERROR);
- static const uint8_t data[] = {1, 2, 3};
- int32_t rv = PR_Write(client_->ssl_fd(), data, sizeof(data));
- EXPECT_GT(0, rv);
- EXPECT_EQ(PR_WOULD_BLOCK_ERROR, PORT_GetError());
-
- // Remove the write error and though the previous write failed, future reads
- // and writes should just work as if it never happened.
- client_->adapter()->SetWriteError(0);
- SendReceive();
-}
-
-TEST_F(TlsConnectTest, ConnectSSLv3) {
- ConfigureVersion(SSL_LIBRARY_VERSION_3_0);
- EnableOnlyStaticRsaCiphers();
+TEST_F(TlsConnectStreamTls13, NegotiateShortHeaders) {
+ client_->SetShortHeadersEnabled();
+ server_->SetShortHeadersEnabled();
+ client_->ExpectShortHeaders();
+ server_->ExpectShortHeaders();
Connect();
- CheckKeys(ssl_kea_rsa, ssl_grp_none, ssl_auth_rsa_decrypt, ssl_sig_none);
-}
-
-TEST_F(TlsConnectTest, ConnectSSLv3ClientAuth) {
- ConfigureVersion(SSL_LIBRARY_VERSION_3_0);
- EnableOnlyStaticRsaCiphers();
- client_->SetupClientAuth();
- server_->RequestClientAuth(true);
- Connect();
- CheckKeys(ssl_kea_rsa, ssl_grp_none, ssl_auth_rsa_decrypt, ssl_sig_none);
-}
-
-static size_t ExpectedCbcLen(size_t in, size_t hmac = 20, size_t block = 16) {
- // MAC-then-Encrypt expansion formula:
- return ((in + hmac + (block - 1)) / block) * block;
-}
-
-TEST_F(TlsConnectTest, OneNRecordSplitting) {
- ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_0);
- EnsureTlsSetup();
- ConnectWithCipherSuite(TLS_RSA_WITH_AES_128_CBC_SHA);
- auto records = std::make_shared<TlsRecordRecorder>();
- server_->SetPacketFilter(records);
- // This should be split into 1, 16384 and 20.
- DataBuffer big_buffer;
- big_buffer.Allocate(1 + 16384 + 20);
- server_->SendBuffer(big_buffer);
- ASSERT_EQ(3U, records->count());
- EXPECT_EQ(ExpectedCbcLen(1), records->record(0).buffer.len());
- EXPECT_EQ(ExpectedCbcLen(16384), records->record(1).buffer.len());
- EXPECT_EQ(ExpectedCbcLen(20), records->record(2).buffer.len());
}
INSTANTIATE_TEST_CASE_P(
@@ -501,8 +336,6 @@ INSTANTIATE_TEST_CASE_P(StreamOnly, TlsConnectStream,
TlsConnectTestBase::kTlsVAll);
INSTANTIATE_TEST_CASE_P(DatagramOnly, TlsConnectDatagram,
TlsConnectTestBase::kTlsV11Plus);
-INSTANTIATE_TEST_CASE_P(DatagramHolddown, TlsHolddownTest,
- TlsConnectTestBase::kTlsV11Plus);
INSTANTIATE_TEST_CASE_P(
Pre12Stream, TlsConnectPre12,
diff --git a/security/nss/gtests/ssl_gtest/ssl_misc_unittest.cc b/security/nss/gtests/ssl_gtest/ssl_misc_unittest.cc
deleted file mode 100644
index 2b1b92dcd8..0000000000
--- a/security/nss/gtests/ssl_gtest/ssl_misc_unittest.cc
+++ /dev/null
@@ -1,20 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "sslexp.h"
-
-#include "gtest_utils.h"
-
-namespace nss_test {
-
-class MiscTest : public ::testing::Test {};
-
-TEST_F(MiscTest, NonExistentExperimentalAPI) {
- EXPECT_EQ(nullptr, SSL_GetExperimentalAPI("blah"));
- EXPECT_EQ(SSL_ERROR_UNSUPPORTED_EXPERIMENTAL_API, PORT_GetError());
-}
-
-} // namespace nss_test
diff --git a/security/nss/gtests/ssl_gtest/ssl_record_unittest.cc b/security/nss/gtests/ssl_gtest/ssl_record_unittest.cc
index d1d496f492..ef81b222c8 100644
--- a/security/nss/gtests/ssl_gtest/ssl_record_unittest.cc
+++ b/security/nss/gtests/ssl_gtest/ssl_record_unittest.cc
@@ -10,8 +10,6 @@
#include "databuffer.h"
#include "gtest_utils.h"
-#include "tls_connect.h"
-#include "tls_filter.h"
namespace nss_test {
@@ -53,8 +51,8 @@ class TlsPaddingTest
<< " total length=" << plaintext_.len() << std::endl;
std::cerr << "Plaintext: " << plaintext_ << std::endl;
sslBuffer s;
- s.buf = const_cast<unsigned char*>(
- static_cast<const unsigned char*>(plaintext_.data()));
+ s.buf = const_cast<unsigned char *>(
+ static_cast<const unsigned char *>(plaintext_.data()));
s.len = plaintext_.len();
SECStatus rv = ssl_RemoveTLSCBCPadding(&s, kMacSize);
if (expect_success) {
@@ -101,73 +99,6 @@ TEST_P(TlsPaddingTest, LastByteOfPadWrong) {
}
}
-class RecordReplacer : public TlsRecordFilter {
- public:
- RecordReplacer(size_t size)
- : TlsRecordFilter(), enabled_(false), size_(size) {}
-
- PacketFilter::Action FilterRecord(const TlsRecordHeader& header,
- const DataBuffer& data,
- DataBuffer* changed) override {
- if (!enabled_) {
- return KEEP;
- }
-
- EXPECT_EQ(kTlsApplicationDataType, header.content_type());
- changed->Allocate(size_);
-
- for (size_t i = 0; i < size_; ++i) {
- changed->data()[i] = i & 0xff;
- }
-
- enabled_ = false;
- return CHANGE;
- }
-
- void Enable() { enabled_ = true; }
-
- private:
- bool enabled_;
- size_t size_;
-};
-
-TEST_F(TlsConnectStreamTls13, LargeRecord) {
- EnsureTlsSetup();
-
- const size_t record_limit = 16384;
- auto replacer = std::make_shared<RecordReplacer>(record_limit);
- client_->SetTlsRecordFilter(replacer);
- Connect();
-
- replacer->Enable();
- client_->SendData(10);
- WAIT_(server_->received_bytes() == record_limit, 2000);
- ASSERT_EQ(record_limit, server_->received_bytes());
-}
-
-TEST_F(TlsConnectStreamTls13, TooLargeRecord) {
- EnsureTlsSetup();
-
- const size_t record_limit = 16384;
- auto replacer = std::make_shared<RecordReplacer>(record_limit + 1);
- client_->SetTlsRecordFilter(replacer);
- Connect();
-
- replacer->Enable();
- ExpectAlert(server_, kTlsAlertRecordOverflow);
- client_->SendData(10); // This is expanded.
-
- uint8_t buf[record_limit + 2];
- PRInt32 rv = PR_Read(server_->ssl_fd(), buf, sizeof(buf));
- EXPECT_GT(0, rv);
- EXPECT_EQ(SSL_ERROR_RX_RECORD_TOO_LONG, PORT_GetError());
-
- // Read the server alert.
- rv = PR_Read(client_->ssl_fd(), buf, sizeof(buf));
- EXPECT_GT(0, rv);
- EXPECT_EQ(SSL_ERROR_RECORD_OVERFLOW_ALERT, PORT_GetError());
-}
-
const static size_t kContentSizesArr[] = {
1, kMacSize - 1, kMacSize, 30, 31, 32, 36, 256, 257, 287, 288};
diff --git a/security/nss/gtests/ssl_gtest/ssl_renegotiation_unittest.cc b/security/nss/gtests/ssl_gtest/ssl_renegotiation_unittest.cc
deleted file mode 100644
index a902a5f7f0..0000000000
--- a/security/nss/gtests/ssl_gtest/ssl_renegotiation_unittest.cc
+++ /dev/null
@@ -1,212 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include <functional>
-#include <memory>
-#include "secerr.h"
-#include "ssl.h"
-#include "sslerr.h"
-#include "sslproto.h"
-
-#include "gtest_utils.h"
-#include "tls_connect.h"
-
-namespace nss_test {
-
-// 1.3 is disabled in the next few tests because we don't
-// presently support resumption in 1.3.
-TEST_P(TlsConnectStreamPre13, RenegotiateClient) {
- Connect();
- server_->PrepareForRenegotiate();
- client_->StartRenegotiate();
- Handshake();
- CheckConnected();
-}
-
-TEST_P(TlsConnectStreamPre13, RenegotiateServer) {
- Connect();
- client_->PrepareForRenegotiate();
- server_->StartRenegotiate();
- Handshake();
- CheckConnected();
-}
-
-// The renegotiation options shouldn't cause an error if TLS 1.3 is chosen.
-TEST_F(TlsConnectTest, RenegotiationConfigTls13) {
- EnsureTlsSetup();
- ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3);
- server_->SetOption(SSL_ENABLE_RENEGOTIATION, SSL_RENEGOTIATE_UNRESTRICTED);
- server_->SetOption(SSL_REQUIRE_SAFE_NEGOTIATION, PR_TRUE);
- Connect();
- SendReceive();
- CheckKeys();
-}
-
-TEST_P(TlsConnectStream, ConnectTls10AndServerRenegotiateHigher) {
- if (version_ == SSL_LIBRARY_VERSION_TLS_1_0) {
- return;
- }
- // Set the client so it will accept any version from 1.0
- // to |version_|.
- client_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_0, version_);
- server_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_0,
- SSL_LIBRARY_VERSION_TLS_1_0);
- // Reset version so that the checks succeed.
- uint16_t test_version = version_;
- version_ = SSL_LIBRARY_VERSION_TLS_1_0;
- Connect();
-
- // Now renegotiate, with the server being set to do
- // |version_|.
- client_->PrepareForRenegotiate();
- server_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_0, test_version);
- // Reset version and cipher suite so that the preinfo callback
- // doesn't fail.
- server_->ResetPreliminaryInfo();
- server_->StartRenegotiate();
-
- if (test_version >= SSL_LIBRARY_VERSION_TLS_1_3) {
- ExpectAlert(server_, kTlsAlertUnexpectedMessage);
- } else {
- ExpectAlert(server_, kTlsAlertProtocolVersion);
- }
-
- Handshake();
- if (test_version >= SSL_LIBRARY_VERSION_TLS_1_3) {
- // In TLS 1.3, the server detects this problem.
- client_->CheckErrorCode(SSL_ERROR_HANDSHAKE_UNEXPECTED_ALERT);
- server_->CheckErrorCode(SSL_ERROR_RENEGOTIATION_NOT_ALLOWED);
- } else {
- client_->CheckErrorCode(SSL_ERROR_PROTOCOL_VERSION_ALERT);
- server_->CheckErrorCode(SSL_ERROR_UNSUPPORTED_VERSION);
- }
-}
-
-TEST_P(TlsConnectStream, ConnectTls10AndClientRenegotiateHigher) {
- if (version_ == SSL_LIBRARY_VERSION_TLS_1_0) {
- return;
- }
- // Set the client so it will accept any version from 1.0
- // to |version_|.
- client_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_0, version_);
- server_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_0,
- SSL_LIBRARY_VERSION_TLS_1_0);
- // Reset version so that the checks succeed.
- uint16_t test_version = version_;
- version_ = SSL_LIBRARY_VERSION_TLS_1_0;
- Connect();
-
- // Now renegotiate, with the server being set to do
- // |version_|.
- server_->PrepareForRenegotiate();
- server_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_0, test_version);
- // Reset version and cipher suite so that the preinfo callback
- // doesn't fail.
- server_->ResetPreliminaryInfo();
- client_->StartRenegotiate();
- if (test_version >= SSL_LIBRARY_VERSION_TLS_1_3) {
- ExpectAlert(server_, kTlsAlertUnexpectedMessage);
- } else {
- ExpectAlert(server_, kTlsAlertProtocolVersion);
- }
- Handshake();
- if (test_version >= SSL_LIBRARY_VERSION_TLS_1_3) {
- // In TLS 1.3, the server detects this problem.
- client_->CheckErrorCode(SSL_ERROR_HANDSHAKE_UNEXPECTED_ALERT);
- server_->CheckErrorCode(SSL_ERROR_RENEGOTIATION_NOT_ALLOWED);
- } else {
- client_->CheckErrorCode(SSL_ERROR_PROTOCOL_VERSION_ALERT);
- server_->CheckErrorCode(SSL_ERROR_UNSUPPORTED_VERSION);
- }
-}
-
-TEST_P(TlsConnectStream, ConnectAndServerRenegotiateLower) {
- if (version_ == SSL_LIBRARY_VERSION_TLS_1_0) {
- return;
- }
- Connect();
-
- // Now renegotiate with the server set to TLS 1.0.
- client_->PrepareForRenegotiate();
- server_->PrepareForRenegotiate();
- client_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_0, version_);
- // Reset version and cipher suite so that the preinfo callback
- // doesn't fail.
- server_->ResetPreliminaryInfo();
-
- SECStatus rv = SSL_ReHandshake(server_->ssl_fd(), PR_TRUE);
- if (version_ >= SSL_LIBRARY_VERSION_TLS_1_3) {
- EXPECT_EQ(SECFailure, rv);
- return;
- }
- ASSERT_EQ(SECSuccess, rv);
-
- // Now, before handshaking, tweak the server configuration.
- server_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_0,
- SSL_LIBRARY_VERSION_TLS_1_0);
-
- // The server should catch the own error.
- ExpectAlert(server_, kTlsAlertProtocolVersion);
-
- Handshake();
- client_->CheckErrorCode(SSL_ERROR_PROTOCOL_VERSION_ALERT);
- server_->CheckErrorCode(SSL_ERROR_UNSUPPORTED_VERSION);
-}
-
-TEST_P(TlsConnectStream, ConnectAndServerWontRenegotiateLower) {
- if (version_ == SSL_LIBRARY_VERSION_TLS_1_0) {
- return;
- }
- Connect();
-
- // Now renegotiate with the server set to TLS 1.0.
- client_->PrepareForRenegotiate();
- server_->PrepareForRenegotiate();
- client_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_0, version_);
- server_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_0,
- SSL_LIBRARY_VERSION_TLS_1_0);
- // Reset version and cipher suite so that the preinfo callback
- // doesn't fail.
- server_->ResetPreliminaryInfo();
-
- EXPECT_EQ(SECFailure, SSL_ReHandshake(server_->ssl_fd(), PR_TRUE));
-}
-
-TEST_P(TlsConnectStream, ConnectAndClientWontRenegotiateLower) {
- if (version_ == SSL_LIBRARY_VERSION_TLS_1_0) {
- return;
- }
- Connect();
-
- // Now renegotiate with the client set to TLS 1.0.
- client_->PrepareForRenegotiate();
- server_->PrepareForRenegotiate();
- server_->ResetPreliminaryInfo();
- client_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_0,
- SSL_LIBRARY_VERSION_TLS_1_0);
- // The client will refuse to renegotiate down.
- EXPECT_EQ(SECFailure, SSL_ReHandshake(client_->ssl_fd(), PR_TRUE));
-}
-
-TEST_F(TlsConnectTest, Tls13RejectsRehandshakeClient) {
- EnsureTlsSetup();
- ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3);
- Connect();
- SECStatus rv = SSL_ReHandshake(client_->ssl_fd(), PR_TRUE);
- EXPECT_EQ(SECFailure, rv);
- EXPECT_EQ(SSL_ERROR_RENEGOTIATION_NOT_ALLOWED, PORT_GetError());
-}
-
-TEST_F(TlsConnectTest, Tls13RejectsRehandshakeServer) {
- EnsureTlsSetup();
- ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3);
- Connect();
- SECStatus rv = SSL_ReHandshake(server_->ssl_fd(), PR_TRUE);
- EXPECT_EQ(SECFailure, rv);
- EXPECT_EQ(SSL_ERROR_RENEGOTIATION_NOT_ALLOWED, PORT_GetError());
-}
-
-} // namespace nss_test
diff --git a/security/nss/gtests/ssl_gtest/ssl_resumption_unittest.cc b/security/nss/gtests/ssl_gtest/ssl_resumption_unittest.cc
index a413caf2c2..ce0e3ca8db 100644
--- a/security/nss/gtests/ssl_gtest/ssl_resumption_unittest.cc
+++ b/security/nss/gtests/ssl_gtest/ssl_resumption_unittest.cc
@@ -9,7 +9,6 @@
#include "secerr.h"
#include "ssl.h"
#include "sslerr.h"
-#include "sslexp.h"
#include "sslproto.h"
extern "C" {
@@ -247,7 +246,8 @@ TEST_P(TlsConnectGeneric, ConnectWithExpiredTicketAtServer) {
: ssl_session_ticket_xtn;
auto capture = std::make_shared<TlsExtensionCapture>(xtn);
client_->SetPacketFilter(capture);
- StartConnect();
+ client_->StartConnect();
+ server_->StartConnect();
client_->Handshake();
EXPECT_TRUE(capture->captured());
EXPECT_LT(0U, capture->extension().len());
@@ -355,7 +355,10 @@ TEST_P(TlsConnectGenericPre13, ConnectEcdheTwiceReuseKey) {
// This test parses the ServerKeyExchange, which isn't in 1.3
TEST_P(TlsConnectGenericPre13, ConnectEcdheTwiceNewKey) {
- server_->SetOption(SSL_REUSE_SERVER_ECDHE_KEY, PR_FALSE);
+ server_->EnsureTlsSetup();
+ SECStatus rv =
+ SSL_OptionSet(server_->ssl_fd(), SSL_REUSE_SERVER_ECDHE_KEY, PR_FALSE);
+ EXPECT_EQ(SECSuccess, rv);
auto i1 = std::make_shared<TlsInspectorRecordHandshakeMessage>(
kTlsHandshakeServerKeyExchange);
server_->SetPacketFilter(i1);
@@ -366,7 +369,9 @@ TEST_P(TlsConnectGenericPre13, ConnectEcdheTwiceNewKey) {
// Restart
Reset();
- server_->SetOption(SSL_REUSE_SERVER_ECDHE_KEY, PR_FALSE);
+ server_->EnsureTlsSetup();
+ rv = SSL_OptionSet(server_->ssl_fd(), SSL_REUSE_SERVER_ECDHE_KEY, PR_FALSE);
+ EXPECT_EQ(SECSuccess, rv);
auto i2 = std::make_shared<TlsInspectorRecordHandshakeMessage>(
kTlsHandshakeServerKeyExchange);
server_->SetPacketFilter(i2);
@@ -396,8 +401,7 @@ TEST_P(TlsConnectTls13, TestTls13ResumeDifferentGroup) {
client_->ConfigNamedGroups(kFFDHEGroups);
server_->ConfigNamedGroups(kFFDHEGroups);
Connect();
- CheckKeys(ssl_kea_dh, ssl_grp_ffdhe_2048, ssl_auth_rsa_sign,
- ssl_sig_rsa_pss_sha256);
+ CheckKeys(ssl_kea_dh, ssl_grp_ffdhe_2048, ssl_auth_rsa_sign, ssl_sig_none);
}
// We need to enable different cipher suites at different times in the following
@@ -457,6 +461,36 @@ TEST_P(TlsConnectGeneric, TestResumeServerDifferentCipher) {
CheckKeys();
}
+class SelectedCipherSuiteReplacer : public TlsHandshakeFilter {
+ public:
+ SelectedCipherSuiteReplacer(uint16_t suite) : cipher_suite_(suite) {}
+
+ protected:
+ PacketFilter::Action FilterHandshake(const HandshakeHeader& header,
+ const DataBuffer& input,
+ DataBuffer* output) override {
+ if (header.handshake_type() != kTlsHandshakeServerHello) {
+ return KEEP;
+ }
+
+ *output = input;
+ uint32_t temp = 0;
+ EXPECT_TRUE(input.Read(0, 2, &temp));
+ // Cipher suite is after version(2) and random(32).
+ size_t pos = 34;
+ if (temp < SSL_LIBRARY_VERSION_TLS_1_3) {
+ // In old versions, we have to skip a session_id too.
+ EXPECT_TRUE(input.Read(pos, 1, &temp));
+ pos += 1 + temp;
+ }
+ output->Write(pos, static_cast<uint32_t>(cipher_suite_), 2);
+ return CHANGE;
+ }
+
+ private:
+ uint16_t cipher_suite_;
+};
+
// Test that the client doesn't tolerate the server picking a different cipher
// suite for resumption.
TEST_P(TlsConnectStream, TestResumptionOverrideCipher) {
@@ -490,13 +524,16 @@ TEST_P(TlsConnectStream, TestResumptionOverrideCipher) {
class SelectedVersionReplacer : public TlsHandshakeFilter {
public:
- SelectedVersionReplacer(uint16_t version)
- : TlsHandshakeFilter({kTlsHandshakeServerHello}), version_(version) {}
+ SelectedVersionReplacer(uint16_t version) : version_(version) {}
protected:
PacketFilter::Action FilterHandshake(const HandshakeHeader& header,
const DataBuffer& input,
DataBuffer* output) override {
+ if (header.handshake_type() != kTlsHandshakeServerHello) {
+ return KEEP;
+ }
+
*output = input;
output->Write(0, static_cast<uint32_t>(version_), 2);
return CHANGE;
@@ -572,7 +609,7 @@ TEST_F(TlsConnectTest, TestTls13ResumptionTwice) {
Connect();
SendReceive();
CheckKeys(ssl_kea_ecdh, ssl_grp_ec_curve25519, ssl_auth_rsa_sign,
- ssl_sig_rsa_pss_sha256);
+ ssl_sig_none);
// The filter will go away when we reset, so save the captured extension.
DataBuffer initialTicket(c1->extension());
ASSERT_LT(0U, initialTicket.len());
@@ -590,7 +627,7 @@ TEST_F(TlsConnectTest, TestTls13ResumptionTwice) {
Connect();
SendReceive();
CheckKeys(ssl_kea_ecdh, ssl_grp_ec_curve25519, ssl_auth_rsa_sign,
- ssl_sig_rsa_pss_sha256);
+ ssl_sig_none);
ASSERT_LT(0U, c2->extension().len());
ScopedCERTCertificate cert2(SSL_PeerCertificate(client_->ssl_fd()));
@@ -615,158 +652,18 @@ TEST_F(TlsConnectTest, TestTls13ResumptionDuplicateNST) {
// Clear the session ticket keys to invalidate the old ticket.
SSLInt_ClearSelfEncryptKey();
- SSL_SendSessionTicket(server_->ssl_fd(), NULL, 0);
-
- SendReceive(); // Need to read so that we absorb the session tickets.
- CheckKeys();
-
- // Resume the connection.
- Reset();
- ConfigureSessionCache(RESUME_BOTH, RESUME_TICKET);
- ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3);
- ExpectResumption(RESUME_TICKET);
- Connect();
- SendReceive();
-}
-
-// Check that the value captured in a NewSessionTicket message matches the value
-// captured from a pre_shared_key extension.
-void NstTicketMatchesPskIdentity(const DataBuffer& nst, const DataBuffer& psk) {
- uint32_t len;
-
- size_t offset = 4 + 4; // Skip ticket_lifetime and ticket_age_add.
- ASSERT_TRUE(nst.Read(offset, 1, &len));
- offset += 1 + len; // Skip ticket_nonce.
-
- ASSERT_TRUE(nst.Read(offset, 2, &len));
- offset += 2; // Skip the ticket length.
- ASSERT_LE(offset + len, nst.len());
- DataBuffer nst_ticket(nst.data() + offset, static_cast<size_t>(len));
-
- offset = 2; // Skip the identities length.
- ASSERT_TRUE(psk.Read(offset, 2, &len));
- offset += 2; // Skip the identity length.
- ASSERT_LE(offset + len, psk.len());
- DataBuffer psk_ticket(psk.data() + offset, static_cast<size_t>(len));
-
- EXPECT_EQ(nst_ticket, psk_ticket);
-}
-
-TEST_F(TlsConnectTest, TestTls13ResumptionDuplicateNSTWithToken) {
- ConfigureSessionCache(RESUME_BOTH, RESUME_TICKET);
- ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3);
-
- auto nst_capture = std::make_shared<TlsInspectorRecordHandshakeMessage>(
- ssl_hs_new_session_ticket);
- server_->SetTlsRecordFilter(nst_capture);
- Connect();
-
- // Clear the session ticket keys to invalidate the old ticket.
- SSLInt_ClearSelfEncryptKey();
- nst_capture->Reset();
- uint8_t token[] = {0x20, 0x20, 0xff, 0x00};
- EXPECT_EQ(SECSuccess,
- SSL_SendSessionTicket(server_->ssl_fd(), token, sizeof(token)));
+ SSLInt_SendNewSessionTicket(server_->ssl_fd());
SendReceive(); // Need to read so that we absorb the session tickets.
CheckKeys();
- EXPECT_LT(0U, nst_capture->buffer().len());
// Resume the connection.
Reset();
ConfigureSessionCache(RESUME_BOTH, RESUME_TICKET);
ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3);
ExpectResumption(RESUME_TICKET);
-
- auto psk_capture =
- std::make_shared<TlsExtensionCapture>(ssl_tls13_pre_shared_key_xtn);
- client_->SetPacketFilter(psk_capture);
Connect();
SendReceive();
-
- NstTicketMatchesPskIdentity(nst_capture->buffer(), psk_capture->extension());
-}
-
-// Disable SSL_ENABLE_SESSION_TICKETS but ensure that tickets can still be sent
-// by invoking SSL_SendSessionTicket directly (and that the ticket is usable).
-TEST_F(TlsConnectTest, SendSessionTicketWithTicketsDisabled) {
- ConfigureSessionCache(RESUME_BOTH, RESUME_TICKET);
- ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3);
-
- EXPECT_EQ(SECSuccess, SSL_OptionSet(server_->ssl_fd(),
- SSL_ENABLE_SESSION_TICKETS, PR_FALSE));
-
- auto nst_capture = std::make_shared<TlsInspectorRecordHandshakeMessage>(
- ssl_hs_new_session_ticket);
- server_->SetTlsRecordFilter(nst_capture);
- Connect();
-
- EXPECT_EQ(0U, nst_capture->buffer().len()) << "expect nothing captured yet";
-
- EXPECT_EQ(SECSuccess, SSL_SendSessionTicket(server_->ssl_fd(), NULL, 0));
- EXPECT_LT(0U, nst_capture->buffer().len()) << "should capture now";
-
- SendReceive(); // Ensure that the client reads the ticket.
-
- // Resume the connection.
- Reset();
- ConfigureSessionCache(RESUME_BOTH, RESUME_TICKET);
- ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3);
- ExpectResumption(RESUME_TICKET);
-
- auto psk_capture =
- std::make_shared<TlsExtensionCapture>(ssl_tls13_pre_shared_key_xtn);
- client_->SetPacketFilter(psk_capture);
- Connect();
- SendReceive();
-
- NstTicketMatchesPskIdentity(nst_capture->buffer(), psk_capture->extension());
-}
-
-// Test calling SSL_SendSessionTicket in inappropriate conditions.
-TEST_F(TlsConnectTest, SendSessionTicketInappropriate) {
- ConfigureSessionCache(RESUME_BOTH, RESUME_TICKET);
- ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_2);
-
- EXPECT_EQ(SECFailure, SSL_SendSessionTicket(client_->ssl_fd(), NULL, 0))
- << "clients can't send tickets";
- EXPECT_EQ(SEC_ERROR_INVALID_ARGS, PORT_GetError());
-
- StartConnect();
-
- EXPECT_EQ(SECFailure, SSL_SendSessionTicket(server_->ssl_fd(), NULL, 0))
- << "no ticket before the handshake has started";
- EXPECT_EQ(SEC_ERROR_INVALID_ARGS, PORT_GetError());
- Handshake();
- EXPECT_EQ(SECFailure, SSL_SendSessionTicket(server_->ssl_fd(), NULL, 0))
- << "no special tickets in TLS 1.2";
- EXPECT_EQ(SEC_ERROR_INVALID_ARGS, PORT_GetError());
-}
-
-TEST_F(TlsConnectTest, SendSessionTicketMassiveToken) {
- ConfigureSessionCache(RESUME_BOTH, RESUME_TICKET);
- ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3);
- Connect();
- // It should be safe to set length with a NULL token because the length should
- // be checked before reading token.
- EXPECT_EQ(SECFailure, SSL_SendSessionTicket(server_->ssl_fd(), NULL, 0x1ffff))
- << "this is clearly too big";
- EXPECT_EQ(SEC_ERROR_INVALID_ARGS, PORT_GetError());
-
- static const uint8_t big_token[0xffff] = {1};
- EXPECT_EQ(SECFailure, SSL_SendSessionTicket(server_->ssl_fd(), big_token,
- sizeof(big_token)))
- << "this is too big, but that's not immediately obvious";
- EXPECT_EQ(SEC_ERROR_INVALID_ARGS, PORT_GetError());
-}
-
-TEST_F(TlsConnectDatagram13, SendSessionTicketDtls) {
- ConfigureSessionCache(RESUME_BOTH, RESUME_TICKET);
- ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3);
- Connect();
- EXPECT_EQ(SECFailure, SSL_SendSessionTicket(server_->ssl_fd(), NULL, 0))
- << "no extra tickets in DTLS until we have Ack support";
- EXPECT_EQ(SSL_ERROR_FEATURE_NOT_SUPPORTED_FOR_VERSION, PORT_GetError());
}
TEST_F(TlsConnectTest, TestTls13ResumptionDowngrade) {
@@ -822,84 +719,13 @@ TEST_F(TlsConnectTest, TestTls13ResumptionForcedDowngrade) {
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256));
filters.push_back(
std::make_shared<SelectedVersionReplacer>(SSL_LIBRARY_VERSION_TLS_1_2));
-
- // Drop a bunch of extensions so that we get past the SH processing. The
- // version extension says TLS 1.3, which is counter to our goal, the others
- // are not permitted in TLS 1.2 handshakes.
- filters.push_back(
- std::make_shared<TlsExtensionDropper>(ssl_tls13_supported_versions_xtn));
- filters.push_back(
- std::make_shared<TlsExtensionDropper>(ssl_tls13_key_share_xtn));
- filters.push_back(
- std::make_shared<TlsExtensionDropper>(ssl_tls13_pre_shared_key_xtn));
server_->SetPacketFilter(std::make_shared<ChainedPacketFilter>(filters));
- // The client here generates an unexpected_message alert when it receives an
- // encrypted handshake message from the server (EncryptedExtension). The
- // client expects to receive an unencrypted TLS 1.2 Certificate message.
- // The server can't decrypt the alert.
- client_->ExpectSendAlert(kTlsAlertUnexpectedMessage);
+ client_->ExpectSendAlert(kTlsAlertDecodeError);
server_->ExpectSendAlert(kTlsAlertBadRecordMac); // Server can't read
ConnectExpectFail();
- client_->CheckErrorCode(SSL_ERROR_RX_UNEXPECTED_APPLICATION_DATA);
+ client_->CheckErrorCode(SSL_ERROR_RX_MALFORMED_SERVER_HELLO);
server_->CheckErrorCode(SSL_ERROR_BAD_MAC_READ);
}
-TEST_P(TlsConnectGeneric, ReConnectTicket) {
- ConfigureSessionCache(RESUME_BOTH, RESUME_BOTH);
- server_->EnableSingleCipher(ChooseOneCipher(version_));
- Connect();
- SendReceive();
- CheckKeys(ssl_kea_ecdh, ssl_grp_ec_curve25519, ssl_auth_rsa_sign,
- ssl_sig_rsa_pss_sha256);
- // Resume
- Reset();
- ConfigureSessionCache(RESUME_BOTH, RESUME_BOTH);
- ExpectResumption(RESUME_TICKET);
- Connect();
- // Only the client knows this.
- CheckKeysResumption(ssl_kea_ecdh, ssl_grp_none, ssl_grp_ec_curve25519,
- ssl_auth_rsa_sign, ssl_sig_rsa_pss_sha256);
-}
-
-TEST_P(TlsConnectGenericPre13, ReConnectCache) {
- ConfigureSessionCache(RESUME_SESSIONID, RESUME_SESSIONID);
- server_->EnableSingleCipher(ChooseOneCipher(version_));
- Connect();
- SendReceive();
- CheckKeys(ssl_kea_ecdh, ssl_grp_ec_curve25519, ssl_auth_rsa_sign,
- ssl_sig_rsa_pss_sha256);
- // Resume
- Reset();
- ExpectResumption(RESUME_SESSIONID);
- Connect();
- CheckKeysResumption(ssl_kea_ecdh, ssl_grp_none, ssl_grp_ec_curve25519,
- ssl_auth_rsa_sign, ssl_sig_rsa_pss_sha256);
-}
-
-TEST_P(TlsConnectGeneric, ReConnectAgainTicket) {
- ConfigureSessionCache(RESUME_BOTH, RESUME_BOTH);
- server_->EnableSingleCipher(ChooseOneCipher(version_));
- Connect();
- SendReceive();
- CheckKeys(ssl_kea_ecdh, ssl_grp_ec_curve25519, ssl_auth_rsa_sign,
- ssl_sig_rsa_pss_sha256);
- // Resume
- Reset();
- ConfigureSessionCache(RESUME_BOTH, RESUME_BOTH);
- ExpectResumption(RESUME_TICKET);
- Connect();
- // Only the client knows this.
- CheckKeysResumption(ssl_kea_ecdh, ssl_grp_none, ssl_grp_ec_curve25519,
- ssl_auth_rsa_sign, ssl_sig_rsa_pss_sha256);
- // Resume connection again
- Reset();
- ConfigureSessionCache(RESUME_BOTH, RESUME_BOTH);
- ExpectResumption(RESUME_TICKET, 2);
- Connect();
- // Only the client knows this.
- CheckKeysResumption(ssl_kea_ecdh, ssl_grp_none, ssl_grp_ec_curve25519,
- ssl_auth_rsa_sign, ssl_sig_rsa_pss_sha256);
-}
-
} // namespace nss_test
diff --git a/security/nss/gtests/ssl_gtest/ssl_skip_unittest.cc b/security/nss/gtests/ssl_gtest/ssl_skip_unittest.cc
index 335bfecfa5..a130ef77fb 100644
--- a/security/nss/gtests/ssl_gtest/ssl_skip_unittest.cc
+++ b/security/nss/gtests/ssl_gtest/ssl_skip_unittest.cc
@@ -43,14 +43,7 @@ class TlsHandshakeSkipFilter : public TlsRecordFilter {
size_t start = parser.consumed();
TlsHandshakeFilter::HandshakeHeader header;
DataBuffer ignored;
- bool complete = false;
- if (!header.Parse(&parser, record_header, DataBuffer(), &ignored,
- &complete)) {
- ADD_FAILURE() << "Error parsing handshake header";
- return KEEP;
- }
- if (!complete) {
- ADD_FAILURE() << "Don't want to deal with fragmented input";
+ if (!header.Parse(&parser, record_header, &ignored)) {
return KEEP;
}
@@ -108,15 +101,26 @@ class Tls13SkipTest : public TlsConnectTestBase,
void ServerSkipTest(std::shared_ptr<TlsRecordFilter> filter, int32_t error) {
EnsureTlsSetup();
server_->SetTlsRecordFilter(filter);
- ExpectAlert(client_, kTlsAlertUnexpectedMessage);
- ConnectExpectFail();
+ filter->EnableDecryption();
+ client_->ExpectSendAlert(kTlsAlertUnexpectedMessage);
+ if (variant_ == ssl_variant_stream) {
+ server_->ExpectSendAlert(kTlsAlertBadRecordMac);
+ ConnectExpectFail();
+ } else {
+ ConnectExpectFailOneSide(TlsAgent::CLIENT);
+ }
client_->CheckErrorCode(error);
- server_->CheckErrorCode(SSL_ERROR_HANDSHAKE_UNEXPECTED_ALERT);
+ if (variant_ == ssl_variant_stream) {
+ server_->CheckErrorCode(SSL_ERROR_BAD_MAC_READ);
+ } else {
+ ASSERT_EQ(TlsAgent::STATE_CONNECTING, server_->state());
+ }
}
void ClientSkipTest(std::shared_ptr<TlsRecordFilter> filter, int32_t error) {
EnsureTlsSetup();
client_->SetTlsRecordFilter(filter);
+ filter->EnableDecryption();
server_->ExpectSendAlert(kTlsAlertUnexpectedMessage);
ConnectExpectFailOneSide(TlsAgent::SERVER);
@@ -167,10 +171,11 @@ TEST_P(TlsSkipTest, SkipServerKeyExchangeEcdsa) {
}
TEST_P(TlsSkipTest, SkipCertAndKeyExch) {
- auto chain = std::make_shared<ChainedPacketFilter>(ChainedPacketFilterInit{
- std::make_shared<TlsHandshakeSkipFilter>(kTlsHandshakeCertificate),
- std::make_shared<TlsHandshakeSkipFilter>(
- kTlsHandshakeServerKeyExchange)});
+ auto chain = std::make_shared<ChainedPacketFilter>();
+ chain->Add(
+ std::make_shared<TlsHandshakeSkipFilter>(kTlsHandshakeCertificate));
+ chain->Add(
+ std::make_shared<TlsHandshakeSkipFilter>(kTlsHandshakeServerKeyExchange));
ServerSkipTest(chain);
client_->CheckErrorCode(SSL_ERROR_RX_UNEXPECTED_HELLO_DONE);
}
diff --git a/security/nss/gtests/ssl_gtest/ssl_staticrsa_unittest.cc b/security/nss/gtests/ssl_gtest/ssl_staticrsa_unittest.cc
index e7fe44d92f..8db1f30e1b 100644
--- a/security/nss/gtests/ssl_gtest/ssl_staticrsa_unittest.cc
+++ b/security/nss/gtests/ssl_gtest/ssl_staticrsa_unittest.cc
@@ -71,7 +71,7 @@ TEST_P(TlsConnectGenericPre13, ConnectStaticRSABogusPMSVersionIgnore) {
EnableOnlyStaticRsaCiphers();
client_->SetPacketFilter(
std::make_shared<TlsInspectorClientHelloVersionChanger>(server_));
- server_->SetOption(SSL_ROLLBACK_DETECTION, PR_FALSE);
+ server_->DisableRollbackDetection();
Connect();
}
@@ -102,7 +102,7 @@ TEST_P(TlsConnectStreamPre13,
EnableExtendedMasterSecret();
client_->SetPacketFilter(
std::make_shared<TlsInspectorClientHelloVersionChanger>(server_));
- server_->SetOption(SSL_ROLLBACK_DETECTION, PR_FALSE);
+ server_->DisableRollbackDetection();
Connect();
}
diff --git a/security/nss/gtests/ssl_gtest/ssl_tls13compat_unittest.cc b/security/nss/gtests/ssl_gtest/ssl_tls13compat_unittest.cc
deleted file mode 100644
index 75cee52fc9..0000000000
--- a/security/nss/gtests/ssl_gtest/ssl_tls13compat_unittest.cc
+++ /dev/null
@@ -1,337 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include <memory>
-#include <vector>
-#include "ssl.h"
-#include "sslerr.h"
-#include "sslproto.h"
-
-#include "gtest_utils.h"
-#include "tls_connect.h"
-#include "tls_filter.h"
-#include "tls_parser.h"
-
-namespace nss_test {
-
-class Tls13CompatTest : public TlsConnectStreamTls13 {
- protected:
- void EnableCompatMode() {
- client_->SetOption(SSL_ENABLE_TLS13_COMPAT_MODE, PR_TRUE);
- }
-
- void InstallFilters() {
- EnsureTlsSetup();
- client_recorders_.Install(client_);
- server_recorders_.Install(server_);
- }
-
- void CheckRecordVersions() {
- ASSERT_EQ(SSL_LIBRARY_VERSION_TLS_1_0,
- client_recorders_.records_->record(0).header.version());
- CheckRecordsAreTls12("client", client_recorders_.records_, 1);
- CheckRecordsAreTls12("server", server_recorders_.records_, 0);
- }
-
- void CheckHelloVersions() {
- uint32_t ver;
- ASSERT_TRUE(server_recorders_.hello_->buffer().Read(0, 2, &ver));
- ASSERT_EQ(SSL_LIBRARY_VERSION_TLS_1_2, static_cast<uint16_t>(ver));
- ASSERT_TRUE(client_recorders_.hello_->buffer().Read(0, 2, &ver));
- ASSERT_EQ(SSL_LIBRARY_VERSION_TLS_1_2, static_cast<uint16_t>(ver));
- }
-
- void CheckForCCS(bool expected_client, bool expected_server) {
- client_recorders_.CheckForCCS(expected_client);
- server_recorders_.CheckForCCS(expected_server);
- }
-
- void CheckForRegularHandshake() {
- CheckRecordVersions();
- CheckHelloVersions();
- EXPECT_EQ(0U, client_recorders_.session_id_length());
- EXPECT_EQ(0U, server_recorders_.session_id_length());
- CheckForCCS(false, false);
- }
-
- void CheckForCompatHandshake() {
- CheckRecordVersions();
- CheckHelloVersions();
- EXPECT_EQ(32U, client_recorders_.session_id_length());
- EXPECT_EQ(32U, server_recorders_.session_id_length());
- CheckForCCS(true, true);
- }
-
- private:
- struct Recorders {
- Recorders()
- : records_(new TlsRecordRecorder()),
- hello_(new TlsInspectorRecordHandshakeMessage(std::set<uint8_t>(
- {kTlsHandshakeClientHello, kTlsHandshakeServerHello}))) {}
-
- uint8_t session_id_length() const {
- // session_id is always after version (2) and random (32).
- uint32_t len = 0;
- EXPECT_TRUE(hello_->buffer().Read(2 + 32, 1, &len));
- return static_cast<uint8_t>(len);
- }
-
- void CheckForCCS(bool expected) const {
- EXPECT_LT(0U, records_->count());
- for (size_t i = 0; i < records_->count(); ++i) {
- // Only the second record can be a CCS.
- bool expected_match = expected && (i == 1);
- EXPECT_EQ(expected_match,
- kTlsChangeCipherSpecType ==
- records_->record(i).header.content_type());
- }
- }
-
- void Install(std::shared_ptr<TlsAgent>& agent) {
- agent->SetPacketFilter(std::make_shared<ChainedPacketFilter>(
- ChainedPacketFilterInit({records_, hello_})));
- }
-
- std::shared_ptr<TlsRecordRecorder> records_;
- std::shared_ptr<TlsInspectorRecordHandshakeMessage> hello_;
- };
-
- void CheckRecordsAreTls12(const std::string& agent,
- const std::shared_ptr<TlsRecordRecorder>& records,
- size_t start) {
- EXPECT_LE(start, records->count());
- for (size_t i = start; i < records->count(); ++i) {
- EXPECT_EQ(SSL_LIBRARY_VERSION_TLS_1_2,
- records->record(i).header.version())
- << agent << ": record " << i << " has wrong version";
- }
- }
-
- Recorders client_recorders_;
- Recorders server_recorders_;
-};
-
-TEST_F(Tls13CompatTest, Disabled) {
- InstallFilters();
- Connect();
- CheckForRegularHandshake();
-}
-
-TEST_F(Tls13CompatTest, Enabled) {
- EnableCompatMode();
- InstallFilters();
- Connect();
- CheckForCompatHandshake();
-}
-
-TEST_F(Tls13CompatTest, EnabledZeroRtt) {
- SetupForZeroRtt();
- EnableCompatMode();
- InstallFilters();
-
- client_->Set0RttEnabled(true);
- server_->Set0RttEnabled(true);
- ExpectResumption(RESUME_TICKET);
- ZeroRttSendReceive(true, true);
- CheckForCCS(true, true);
- Handshake();
- ExpectEarlyDataAccepted(true);
- CheckConnected();
-
- CheckForCompatHandshake();
-}
-
-TEST_F(Tls13CompatTest, EnabledHrr) {
- EnableCompatMode();
- InstallFilters();
-
- // Force a HelloRetryRequest. The server sends CCS immediately.
- server_->ConfigNamedGroups({ssl_grp_ec_secp384r1});
- client_->StartConnect();
- server_->StartConnect();
- client_->Handshake();
- server_->Handshake();
- CheckForCCS(false, true);
-
- Handshake();
- CheckConnected();
- CheckForCompatHandshake();
-}
-
-TEST_F(Tls13CompatTest, EnabledStatelessHrr) {
- EnableCompatMode();
- InstallFilters();
-
- // Force a HelloRetryRequest
- server_->ConfigNamedGroups({ssl_grp_ec_secp384r1});
- client_->StartConnect();
- server_->StartConnect();
- client_->Handshake();
- server_->Handshake();
- CheckForCCS(false, true);
-
- // A new server should just work, but not send another CCS.
- MakeNewServer();
- InstallFilters();
- server_->ConfigNamedGroups({ssl_grp_ec_secp384r1});
-
- Handshake();
- CheckConnected();
- CheckForCompatHandshake();
-}
-
-TEST_F(Tls13CompatTest, EnabledHrrZeroRtt) {
- SetupForZeroRtt();
- EnableCompatMode();
- InstallFilters();
- server_->ConfigNamedGroups({ssl_grp_ec_secp384r1});
-
- // With 0-RTT, the client sends CCS immediately. With HRR, the server sends
- // CCS immediately too.
- client_->Set0RttEnabled(true);
- server_->Set0RttEnabled(true);
- ExpectResumption(RESUME_TICKET);
- ZeroRttSendReceive(true, false);
- CheckForCCS(true, true);
-
- Handshake();
- ExpectEarlyDataAccepted(false);
- CheckConnected();
- CheckForCompatHandshake();
-}
-
-static const uint8_t kCannedCcs[] = {
- kTlsChangeCipherSpecType,
- SSL_LIBRARY_VERSION_TLS_1_2 >> 8,
- SSL_LIBRARY_VERSION_TLS_1_2 & 0xff,
- 0,
- 1, // length
- 1 // change_cipher_spec_choice
-};
-
-// A ChangeCipherSpec is ignored by a server because we have to tolerate it for
-// compatibility mode. That doesn't mean that we have to tolerate it
-// unconditionally. If we negotiate 1.3, we expect to see a cookie extension.
-TEST_F(TlsConnectStreamTls13, ChangeCipherSpecBeforeClientHello13) {
- EnsureTlsSetup();
- server_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_2,
- SSL_LIBRARY_VERSION_TLS_1_3);
- client_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_2,
- SSL_LIBRARY_VERSION_TLS_1_3);
- // Client sends CCS before starting the handshake.
- client_->SendDirect(DataBuffer(kCannedCcs, sizeof(kCannedCcs)));
- ConnectExpectAlert(server_, kTlsAlertUnexpectedMessage);
- server_->CheckErrorCode(SSL_ERROR_RX_UNEXPECTED_CHANGE_CIPHER);
- client_->CheckErrorCode(SSL_ERROR_HANDSHAKE_UNEXPECTED_ALERT);
-}
-
-// A ChangeCipherSpec is ignored by a server because we have to tolerate it for
-// compatibility mode. That doesn't mean that we have to tolerate it
-// unconditionally. If we negotiate 1.3, we expect to see a cookie extension.
-TEST_F(TlsConnectStreamTls13, ChangeCipherSpecBeforeClientHelloTwice) {
- EnsureTlsSetup();
- server_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_2,
- SSL_LIBRARY_VERSION_TLS_1_3);
- client_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_2,
- SSL_LIBRARY_VERSION_TLS_1_3);
- // Client sends CCS before starting the handshake.
- client_->SendDirect(DataBuffer(kCannedCcs, sizeof(kCannedCcs)));
- client_->SendDirect(DataBuffer(kCannedCcs, sizeof(kCannedCcs)));
- ConnectExpectAlert(server_, kTlsAlertUnexpectedMessage);
- server_->CheckErrorCode(SSL_ERROR_RX_UNEXPECTED_CHANGE_CIPHER);
- client_->CheckErrorCode(SSL_ERROR_HANDSHAKE_UNEXPECTED_ALERT);
-}
-
-// If we negotiate 1.2, we abort.
-TEST_F(TlsConnectStreamTls13, ChangeCipherSpecBeforeClientHello12) {
- EnsureTlsSetup();
- server_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_2,
- SSL_LIBRARY_VERSION_TLS_1_3);
- client_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_2,
- SSL_LIBRARY_VERSION_TLS_1_2);
- // Client sends CCS before starting the handshake.
- client_->SendDirect(DataBuffer(kCannedCcs, sizeof(kCannedCcs)));
- ConnectExpectAlert(server_, kTlsAlertUnexpectedMessage);
- server_->CheckErrorCode(SSL_ERROR_RX_UNEXPECTED_CHANGE_CIPHER);
- client_->CheckErrorCode(SSL_ERROR_HANDSHAKE_UNEXPECTED_ALERT);
-}
-
-TEST_F(TlsConnectDatagram13, CompatModeDtlsClient) {
- EnsureTlsSetup();
- client_->SetOption(SSL_ENABLE_TLS13_COMPAT_MODE, PR_TRUE);
- auto client_records = std::make_shared<TlsRecordRecorder>();
- client_->SetPacketFilter(client_records);
- auto server_records = std::make_shared<TlsRecordRecorder>();
- server_->SetPacketFilter(server_records);
- Connect();
-
- ASSERT_EQ(2U, client_records->count()); // CH, Fin
- EXPECT_EQ(kTlsHandshakeType, client_records->record(0).header.content_type());
- EXPECT_EQ(kTlsApplicationDataType,
- client_records->record(1).header.content_type());
-
- ASSERT_EQ(6U, server_records->count()); // SH, EE, CT, CV, Fin, Ack
- EXPECT_EQ(kTlsHandshakeType, server_records->record(0).header.content_type());
- for (size_t i = 1; i < server_records->count(); ++i) {
- EXPECT_EQ(kTlsApplicationDataType,
- server_records->record(i).header.content_type());
- }
-}
-
-class AddSessionIdFilter : public TlsHandshakeFilter {
- public:
- AddSessionIdFilter() : TlsHandshakeFilter({ssl_hs_client_hello}) {}
-
- protected:
- PacketFilter::Action FilterHandshake(const HandshakeHeader& header,
- const DataBuffer& input,
- DataBuffer* output) override {
- uint32_t session_id_len = 0;
- EXPECT_TRUE(input.Read(2 + 32, 1, &session_id_len));
- EXPECT_EQ(0U, session_id_len);
- uint8_t session_id[33] = {32}; // 32 for length, the rest zero.
- *output = input;
- output->Splice(session_id, sizeof(session_id), 34, 1);
- return CHANGE;
- }
-};
-
-// Adding a session ID to a DTLS ClientHello should not trigger compatibility
-// mode. It should be ignored instead.
-TEST_F(TlsConnectDatagram13, CompatModeDtlsServer) {
- EnsureTlsSetup();
- auto client_records = std::make_shared<TlsRecordRecorder>();
- client_->SetPacketFilter(
- std::make_shared<ChainedPacketFilter>(ChainedPacketFilterInit(
- {client_records, std::make_shared<AddSessionIdFilter>()})));
- auto server_hello = std::make_shared<TlsInspectorRecordHandshakeMessage>(
- kTlsHandshakeServerHello);
- auto server_records = std::make_shared<TlsRecordRecorder>();
- server_->SetPacketFilter(std::make_shared<ChainedPacketFilter>(
- ChainedPacketFilterInit({server_records, server_hello})));
- StartConnect();
- client_->Handshake();
- server_->Handshake();
- // The client will consume the ServerHello, but discard everything else
- // because it doesn't decrypt. And don't wait around for the client to ACK.
- client_->Handshake();
-
- ASSERT_EQ(1U, client_records->count());
- EXPECT_EQ(kTlsHandshakeType, client_records->record(0).header.content_type());
-
- ASSERT_EQ(5U, server_records->count()); // SH, EE, CT, CV, Fin
- EXPECT_EQ(kTlsHandshakeType, server_records->record(0).header.content_type());
- for (size_t i = 1; i < server_records->count(); ++i) {
- EXPECT_EQ(kTlsApplicationDataType,
- server_records->record(i).header.content_type());
- }
-
- uint32_t session_id_len = 0;
- EXPECT_TRUE(server_hello->buffer().Read(2 + 32, 1, &session_id_len));
- EXPECT_EQ(0U, session_id_len);
-}
-
-} // nss_test
diff --git a/security/nss/gtests/ssl_gtest/ssl_v2_client_hello_unittest.cc b/security/nss/gtests/ssl_gtest/ssl_v2_client_hello_unittest.cc
index 2f8ddd6fed..110e3e0b6f 100644
--- a/security/nss/gtests/ssl_gtest/ssl_v2_client_hello_unittest.cc
+++ b/security/nss/gtests/ssl_gtest/ssl_v2_client_hello_unittest.cc
@@ -153,6 +153,13 @@ class SSLv2ClientHelloTestF : public TlsConnectTestBase {
client_->SetPacketFilter(filter_);
}
+ void RequireSafeRenegotiation() {
+ server_->EnsureTlsSetup();
+ SECStatus rv =
+ SSL_OptionSet(server_->ssl_fd(), SSL_REQUIRE_SAFE_NEGOTIATION, PR_TRUE);
+ EXPECT_EQ(rv, SECSuccess);
+ }
+
void SetExpectedVersion(uint16_t version) {
TlsConnectTestBase::SetExpectedVersion(version);
filter_->SetVersion(version);
@@ -312,7 +319,7 @@ TEST_P(SSLv2ClientHelloTest, BigClientRandom) {
// Connection must fail if we require safe renegotiation but the client doesn't
// include TLS_EMPTY_RENEGOTIATION_INFO_SCSV in the list of cipher suites.
TEST_P(SSLv2ClientHelloTest, RequireSafeRenegotiation) {
- server_->SetOption(SSL_REQUIRE_SAFE_NEGOTIATION, PR_TRUE);
+ RequireSafeRenegotiation();
SetAvailableCipherSuite(TLS_DHE_RSA_WITH_AES_128_CBC_SHA);
ConnectExpectAlert(server_, kTlsAlertHandshakeFailure);
EXPECT_EQ(SSL_ERROR_UNSAFE_NEGOTIATION, server_->error_code());
@@ -321,7 +328,7 @@ TEST_P(SSLv2ClientHelloTest, RequireSafeRenegotiation) {
// Connection must succeed when requiring safe renegotiation and the client
// includes TLS_EMPTY_RENEGOTIATION_INFO_SCSV in the list of cipher suites.
TEST_P(SSLv2ClientHelloTest, RequireSafeRenegotiationWithSCSV) {
- server_->SetOption(SSL_REQUIRE_SAFE_NEGOTIATION, PR_TRUE);
+ RequireSafeRenegotiation();
std::vector<uint16_t> cipher_suites = {TLS_DHE_RSA_WITH_AES_128_CBC_SHA,
TLS_EMPTY_RENEGOTIATION_INFO_SCSV};
SetAvailableCipherSuites(cipher_suites);
diff --git a/security/nss/gtests/ssl_gtest/ssl_version_unittest.cc b/security/nss/gtests/ssl_gtest/ssl_version_unittest.cc
index 9db293b07c..379a67e350 100644
--- a/security/nss/gtests/ssl_gtest/ssl_version_unittest.cc
+++ b/security/nss/gtests/ssl_gtest/ssl_version_unittest.cc
@@ -128,12 +128,12 @@ TEST_F(TlsConnectTest, TestFallbackFromTls13) {
#endif
TEST_P(TlsConnectGeneric, TestFallbackSCSVVersionMatch) {
- client_->SetOption(SSL_ENABLE_FALLBACK_SCSV, PR_TRUE);
+ client_->SetFallbackSCSVEnabled(true);
Connect();
}
TEST_P(TlsConnectGenericPre13, TestFallbackSCSVVersionMismatch) {
- client_->SetOption(SSL_ENABLE_FALLBACK_SCSV, PR_TRUE);
+ client_->SetFallbackSCSVEnabled(true);
server_->SetVersionRange(version_, version_ + 1);
ConnectExpectAlert(server_, kTlsAlertInappropriateFallback);
client_->CheckErrorCode(SSL_ERROR_INAPPROPRIATE_FALLBACK_ALERT);
@@ -155,10 +155,107 @@ TEST_F(TlsConnectTest, DisallowSSLv3HelloWithTLSv13Enabled) {
EXPECT_EQ(SECFailure, rv);
}
+TEST_P(TlsConnectStream, ConnectTls10AndServerRenegotiateHigher) {
+ if (version_ == SSL_LIBRARY_VERSION_TLS_1_0) {
+ return;
+ }
+ // Set the client so it will accept any version from 1.0
+ // to |version_|.
+ client_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_0, version_);
+ server_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_0,
+ SSL_LIBRARY_VERSION_TLS_1_0);
+ // Reset version so that the checks succeed.
+ uint16_t test_version = version_;
+ version_ = SSL_LIBRARY_VERSION_TLS_1_0;
+ Connect();
+
+ // Now renegotiate, with the server being set to do
+ // |version_|.
+ client_->PrepareForRenegotiate();
+ server_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_0, test_version);
+ // Reset version and cipher suite so that the preinfo callback
+ // doesn't fail.
+ server_->ResetPreliminaryInfo();
+ server_->StartRenegotiate();
+
+ if (test_version >= SSL_LIBRARY_VERSION_TLS_1_3) {
+ ExpectAlert(server_, kTlsAlertUnexpectedMessage);
+ } else {
+ ExpectAlert(client_, kTlsAlertIllegalParameter);
+ }
+
+ Handshake();
+ if (test_version >= SSL_LIBRARY_VERSION_TLS_1_3) {
+ // In TLS 1.3, the server detects this problem.
+ client_->CheckErrorCode(SSL_ERROR_HANDSHAKE_UNEXPECTED_ALERT);
+ server_->CheckErrorCode(SSL_ERROR_RENEGOTIATION_NOT_ALLOWED);
+ } else {
+ client_->CheckErrorCode(SSL_ERROR_UNSUPPORTED_VERSION);
+ server_->CheckErrorCode(SSL_ERROR_ILLEGAL_PARAMETER_ALERT);
+ }
+}
+
+TEST_P(TlsConnectStream, ConnectTls10AndClientRenegotiateHigher) {
+ if (version_ == SSL_LIBRARY_VERSION_TLS_1_0) {
+ return;
+ }
+ // Set the client so it will accept any version from 1.0
+ // to |version_|.
+ client_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_0, version_);
+ server_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_0,
+ SSL_LIBRARY_VERSION_TLS_1_0);
+ // Reset version so that the checks succeed.
+ uint16_t test_version = version_;
+ version_ = SSL_LIBRARY_VERSION_TLS_1_0;
+ Connect();
+
+ // Now renegotiate, with the server being set to do
+ // |version_|.
+ server_->PrepareForRenegotiate();
+ server_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_0, test_version);
+ // Reset version and cipher suite so that the preinfo callback
+ // doesn't fail.
+ server_->ResetPreliminaryInfo();
+ client_->StartRenegotiate();
+ if (test_version >= SSL_LIBRARY_VERSION_TLS_1_3) {
+ ExpectAlert(server_, kTlsAlertUnexpectedMessage);
+ } else {
+ ExpectAlert(client_, kTlsAlertIllegalParameter);
+ }
+ Handshake();
+ if (test_version >= SSL_LIBRARY_VERSION_TLS_1_3) {
+ // In TLS 1.3, the server detects this problem.
+ client_->CheckErrorCode(SSL_ERROR_HANDSHAKE_UNEXPECTED_ALERT);
+ server_->CheckErrorCode(SSL_ERROR_RENEGOTIATION_NOT_ALLOWED);
+ } else {
+ client_->CheckErrorCode(SSL_ERROR_UNSUPPORTED_VERSION);
+ server_->CheckErrorCode(SSL_ERROR_ILLEGAL_PARAMETER_ALERT);
+ }
+}
+
+TEST_F(TlsConnectTest, Tls13RejectsRehandshakeClient) {
+ EnsureTlsSetup();
+ ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3);
+ Connect();
+ SECStatus rv = SSL_ReHandshake(client_->ssl_fd(), PR_TRUE);
+ EXPECT_EQ(SECFailure, rv);
+ EXPECT_EQ(SSL_ERROR_RENEGOTIATION_NOT_ALLOWED, PORT_GetError());
+}
+
+TEST_F(TlsConnectTest, Tls13RejectsRehandshakeServer) {
+ EnsureTlsSetup();
+ ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3);
+ Connect();
+ SECStatus rv = SSL_ReHandshake(server_->ssl_fd(), PR_TRUE);
+ EXPECT_EQ(SECFailure, rv);
+ EXPECT_EQ(SSL_ERROR_RENEGOTIATION_NOT_ALLOWED, PORT_GetError());
+}
+
TEST_P(TlsConnectGeneric, AlertBeforeServerHello) {
EnsureTlsSetup();
client_->ExpectReceiveAlert(kTlsAlertUnrecognizedName, kTlsAlertWarning);
- StartConnect();
+ client_->StartConnect();
+ server_->StartConnect();
client_->Handshake(); // Send ClientHello.
static const uint8_t kWarningAlert[] = {kTlsAlertWarning,
kTlsAlertUnrecognizedName};
@@ -217,20 +314,20 @@ TEST_F(TlsConnectStreamTls13, Tls14ClientHelloWithSupportedVersions) {
client_->SetPacketFilter(
std::make_shared<TlsInspectorClientHelloVersionSetter>(
SSL_LIBRARY_VERSION_TLS_1_3 + 1));
- auto capture =
- std::make_shared<TlsExtensionCapture>(ssl_tls13_supported_versions_xtn);
+ auto capture = std::make_shared<TlsInspectorRecordHandshakeMessage>(
+ kTlsHandshakeServerHello);
server_->SetPacketFilter(capture);
client_->ExpectSendAlert(kTlsAlertBadRecordMac);
server_->ExpectSendAlert(kTlsAlertBadRecordMac);
ConnectExpectFail();
client_->CheckErrorCode(SSL_ERROR_BAD_MAC_READ);
server_->CheckErrorCode(SSL_ERROR_BAD_MAC_READ);
-
- ASSERT_EQ(2U, capture->extension().len());
- uint32_t version = 0;
- ASSERT_TRUE(capture->extension().Read(0, 2, &version));
+ const DataBuffer& server_hello = capture->buffer();
+ ASSERT_GT(server_hello.len(), 2U);
+ uint32_t ver;
+ ASSERT_TRUE(server_hello.Read(0, 2, &ver));
// This way we don't need to change with new draft version.
- ASSERT_LT(static_cast<uint32_t>(SSL_LIBRARY_VERSION_TLS_1_2), version);
+ ASSERT_LT(static_cast<uint32_t>(SSL_LIBRARY_VERSION_TLS_1_2), ver);
}
} // namespace nss_test
diff --git a/security/nss/gtests/ssl_gtest/test_io.cc b/security/nss/gtests/ssl_gtest/test_io.cc
index adcdbfbafb..b9f0c672e8 100644
--- a/security/nss/gtests/ssl_gtest/test_io.cc
+++ b/security/nss/gtests/ssl_gtest/test_io.cc
@@ -98,13 +98,8 @@ int32_t DummyPrSocket::Recv(PRFileDesc *f, void *buf, int32_t buflen,
}
int32_t DummyPrSocket::Write(PRFileDesc *f, const void *buf, int32_t length) {
- if (write_error_) {
- PR_SetError(write_error_, 0);
- return -1;
- }
-
auto peer = peer_.lock();
- if (!peer) {
+ if (!peer || !writeable_) {
PR_SetError(PR_IO_ERROR, 0);
return -1;
}
@@ -114,7 +109,7 @@ int32_t DummyPrSocket::Write(PRFileDesc *f, const void *buf, int32_t length) {
DataBuffer filtered;
PacketFilter::Action action = PacketFilter::KEEP;
if (filter_) {
- action = filter_->Process(packet, &filtered);
+ action = filter_->Filter(packet, &filtered);
}
switch (action) {
case PacketFilter::CHANGE:
diff --git a/security/nss/gtests/ssl_gtest/test_io.h b/security/nss/gtests/ssl_gtest/test_io.h
index 469d90a7c8..ac24972228 100644
--- a/security/nss/gtests/ssl_gtest/test_io.h
+++ b/security/nss/gtests/ssl_gtest/test_io.h
@@ -33,17 +33,8 @@ class PacketFilter {
CHANGE, // change the packet to a different value
DROP // drop the packet
};
- PacketFilter(bool enabled = true) : enabled_(enabled) {}
- virtual ~PacketFilter() {}
- virtual Action Process(const DataBuffer& input, DataBuffer* output) {
- if (!enabled_) {
- return KEEP;
- }
- return Filter(input, output);
- }
- void Enable() { enabled_ = true; }
- void Disable() { enabled_ = false; }
+ virtual ~PacketFilter() {}
// The packet filter takes input and has the option of mutating it.
//
@@ -52,9 +43,6 @@ class PacketFilter {
// case the value in *output is ignored. A Filter can return DROP, in which
// case the packet is dropped (and *output is ignored).
virtual Action Filter(const DataBuffer& input, DataBuffer* output) = 0;
-
- private:
- bool enabled_;
};
class DummyPrSocket : public DummyIOLayerMethods {
@@ -65,7 +53,7 @@ class DummyPrSocket : public DummyIOLayerMethods {
peer_(),
input_(),
filter_(nullptr),
- write_error_(0) {}
+ writeable_(true) {}
virtual ~DummyPrSocket() {}
// Create a file descriptor that will reference this object. The fd must not
@@ -83,7 +71,7 @@ class DummyPrSocket : public DummyIOLayerMethods {
int32_t Recv(PRFileDesc* f, void* buf, int32_t buflen, int32_t flags,
PRIntervalTime to) override;
int32_t Write(PRFileDesc* f, const void* buf, int32_t length) override;
- void SetWriteError(PRErrorCode code) { write_error_ = code; }
+ void CloseWrites() { writeable_ = false; }
SSLProtocolVariant variant() const { return variant_; }
bool readable() const { return !input_.empty(); }
@@ -110,7 +98,7 @@ class DummyPrSocket : public DummyIOLayerMethods {
std::weak_ptr<DummyPrSocket> peer_;
std::queue<Packet> input_;
std::shared_ptr<PacketFilter> filter_;
- PRErrorCode write_error_;
+ bool writeable_;
};
// Marker interface.
diff --git a/security/nss/gtests/ssl_gtest/tls_agent.cc b/security/nss/gtests/ssl_gtest/tls_agent.cc
index 3b939bba86..d6d91f7f7b 100644
--- a/security/nss/gtests/ssl_gtest/tls_agent.cc
+++ b/security/nss/gtests/ssl_gtest/tls_agent.cc
@@ -10,7 +10,6 @@
#include "pk11func.h"
#include "ssl.h"
#include "sslerr.h"
-#include "sslexp.h"
#include "sslproto.h"
#include "tls_parser.h"
@@ -36,6 +35,7 @@ const std::string TlsAgent::kServerRsa = "rsa"; // both sign and encrypt
const std::string TlsAgent::kServerRsaSign = "rsa_sign";
const std::string TlsAgent::kServerRsaPss = "rsa_pss";
const std::string TlsAgent::kServerRsaDecrypt = "rsa_decrypt";
+const std::string TlsAgent::kServerRsaChain = "rsa_chain";
const std::string TlsAgent::kServerEcdsa256 = "ecdsa256";
const std::string TlsAgent::kServerEcdsa384 = "ecdsa384";
const std::string TlsAgent::kServerEcdsa521 = "ecdsa521";
@@ -73,6 +73,7 @@ TlsAgent::TlsAgent(const std::string& name, Role role,
handshake_callback_(),
auth_certificate_callback_(),
sni_callback_(),
+ expect_short_headers_(false),
skip_version_checks_(false) {
memset(&info_, 0, sizeof(info_));
memset(&csinfo_, 0, sizeof(csinfo_));
@@ -92,11 +93,11 @@ TlsAgent::~TlsAgent() {
// Add failures manually, if any, so we don't throw in a destructor.
if (expected_received_alert_ != kTlsAlertCloseNotify ||
expected_received_alert_level_ != kTlsAlertWarning) {
- ADD_FAILURE() << "Wrong expected_received_alert status: " << role_str();
+ ADD_FAILURE() << "Wrong expected_received_alert status";
}
if (expected_sent_alert_ != kTlsAlertCloseNotify ||
expected_sent_alert_level_ != kTlsAlertWarning) {
- ADD_FAILURE() << "Wrong expected_sent_alert status: " << role_str();
+ ADD_FAILURE() << "Wrong expected_sent_alert status";
}
}
@@ -257,10 +258,13 @@ void TlsAgent::CheckCipherSuite(uint16_t cipher_suite) {
}
void TlsAgent::RequestClientAuth(bool requireAuth) {
+ EXPECT_TRUE(EnsureTlsSetup());
ASSERT_EQ(SERVER, role_);
- SetOption(SSL_REQUEST_CERTIFICATE, PR_TRUE);
- SetOption(SSL_REQUIRE_CERTIFICATE, requireAuth ? PR_TRUE : PR_FALSE);
+ EXPECT_EQ(SECSuccess,
+ SSL_OptionSet(ssl_fd(), SSL_REQUEST_CERTIFICATE, PR_TRUE));
+ EXPECT_EQ(SECSuccess, SSL_OptionSet(ssl_fd(), SSL_REQUIRE_CERTIFICATE,
+ requireAuth ? PR_TRUE : PR_FALSE));
EXPECT_EQ(SECSuccess, SSL_AuthCertificateHook(
ssl_fd(), &TlsAgent::ClientAuthenticated, this));
@@ -372,8 +376,42 @@ void TlsAgent::ConfigNamedGroups(const std::vector<SSLNamedGroup>& groups) {
EXPECT_EQ(SECSuccess, rv);
}
+void TlsAgent::SetSessionTicketsEnabled(bool en) {
+ EXPECT_TRUE(EnsureTlsSetup());
+
+ SECStatus rv = SSL_OptionSet(ssl_fd(), SSL_ENABLE_SESSION_TICKETS,
+ en ? PR_TRUE : PR_FALSE);
+ EXPECT_EQ(SECSuccess, rv);
+}
+
+void TlsAgent::SetSessionCacheEnabled(bool en) {
+ EXPECT_TRUE(EnsureTlsSetup());
+
+ SECStatus rv = SSL_OptionSet(ssl_fd(), SSL_NO_CACHE, en ? PR_FALSE : PR_TRUE);
+ EXPECT_EQ(SECSuccess, rv);
+}
+
void TlsAgent::Set0RttEnabled(bool en) {
- SetOption(SSL_ENABLE_0RTT_DATA, en ? PR_TRUE : PR_FALSE);
+ EXPECT_TRUE(EnsureTlsSetup());
+
+ SECStatus rv =
+ SSL_OptionSet(ssl_fd(), SSL_ENABLE_0RTT_DATA, en ? PR_TRUE : PR_FALSE);
+ EXPECT_EQ(SECSuccess, rv);
+}
+
+void TlsAgent::SetFallbackSCSVEnabled(bool en) {
+ EXPECT_TRUE(role_ == CLIENT && EnsureTlsSetup());
+
+ SECStatus rv = SSL_OptionSet(ssl_fd(), SSL_ENABLE_FALLBACK_SCSV,
+ en ? PR_TRUE : PR_FALSE);
+ EXPECT_EQ(SECSuccess, rv);
+}
+
+void TlsAgent::SetShortHeadersEnabled() {
+ EXPECT_TRUE(EnsureTlsSetup());
+
+ SECStatus rv = SSLInt_EnableShortHeaders(ssl_fd());
+ EXPECT_EQ(SECSuccess, rv);
}
void TlsAgent::SetVersionRange(uint16_t minver, uint16_t maxver) {
@@ -399,6 +437,8 @@ void TlsAgent::SetServerKeyBits(uint16_t bits) { server_key_bits_ = bits; }
void TlsAgent::ExpectReadWriteError() { expect_readwrite_error_ = true; }
+void TlsAgent::ExpectShortHeaders() { expect_short_headers_ = true; }
+
void TlsAgent::SkipVersionChecks() { skip_version_checks_ = true; }
void TlsAgent::SetSignatureSchemes(const SSLSignatureScheme* schemes,
@@ -477,12 +517,6 @@ void TlsAgent::CheckKEA(SSLKEAType kea_type, SSLNamedGroup kea_group,
}
}
-void TlsAgent::CheckOriginalKEA(SSLNamedGroup kea_group) const {
- if (kea_group != ssl_grp_ffdhe_custom) {
- EXPECT_EQ(kea_group, info_.originalKeaGroup);
- }
-}
-
void TlsAgent::CheckAuthType(SSLAuthType auth_type,
SSLSignatureScheme sig_scheme) const {
EXPECT_EQ(STATE_CONNECTED, state_);
@@ -535,7 +569,8 @@ void TlsAgent::EnableFalseStart() {
falsestart_enabled_ = true;
EXPECT_EQ(SECSuccess, SSL_SetCanFalseStartCallback(
ssl_fd(), CanFalseStartCallback, this));
- SetOption(SSL_ENABLE_FALSE_START, PR_TRUE);
+ EXPECT_EQ(SECSuccess,
+ SSL_OptionSet(ssl_fd(), SSL_ENABLE_FALSE_START, PR_TRUE));
}
void TlsAgent::ExpectResumption() { expect_resumption_ = true; }
@@ -543,7 +578,7 @@ void TlsAgent::ExpectResumption() { expect_resumption_ = true; }
void TlsAgent::EnableAlpn(const uint8_t* val, size_t len) {
EXPECT_TRUE(EnsureTlsSetup());
- SetOption(SSL_ENABLE_ALPN, PR_TRUE);
+ EXPECT_EQ(SECSuccess, SSL_OptionSet(ssl_fd(), SSL_ENABLE_ALPN, PR_TRUE));
EXPECT_EQ(SECSuccess, SSL_SetNextProtoNego(ssl_fd(), val, len));
}
@@ -587,8 +622,12 @@ void TlsAgent::CheckErrorCode(int32_t expected) const {
}
static uint8_t GetExpectedAlertLevel(uint8_t alert) {
- if (alert == kTlsAlertCloseNotify) {
- return kTlsAlertWarning;
+ switch (alert) {
+ case kTlsAlertCloseNotify:
+ case kTlsAlertEndOfEarlyData:
+ return kTlsAlertWarning;
+ default:
+ break;
}
return kTlsAlertFatal;
}
@@ -691,50 +730,6 @@ void TlsAgent::ResetPreliminaryInfo() {
expected_cipher_suite_ = 0;
}
-void TlsAgent::ValidateCipherSpecs() {
- PRInt32 cipherSpecs = SSLInt_CountCipherSpecs(ssl_fd());
- // We use one ciphersuite in each direction.
- PRInt32 expected = 2;
- if (variant_ == ssl_variant_datagram) {
- // For DTLS 1.3, the client retains the cipher spec for early data and the
- // handshake so that it can retransmit EndOfEarlyData and its final flight.
- // It also retains the handshake read cipher spec so that it can read ACKs
- // from the server. The server retains the handshake read cipher spec so it
- // can read the client's retransmitted Finished.
- if (expected_version_ >= SSL_LIBRARY_VERSION_TLS_1_3) {
- if (role_ == CLIENT) {
- expected = info_.earlyDataAccepted ? 5 : 4;
- } else {
- expected = 3;
- }
- } else {
- // For DTLS 1.1 and 1.2, the last endpoint to send maintains a cipher spec
- // until the holddown timer runs down.
- if (expect_resumption_) {
- if (role_ == CLIENT) {
- expected = 3;
- }
- } else {
- if (role_ == SERVER) {
- expected = 3;
- }
- }
- }
- }
- // This function will be run before the handshake completes if false start is
- // enabled. In that case, the client will still be reading cleartext, but
- // will have a spec prepared for reading ciphertext. With DTLS, the client
- // will also have a spec retained for retransmission of handshake messages.
- if (role_ == CLIENT && falsestart_enabled_ && !handshake_callback_called_) {
- EXPECT_GT(SSL_LIBRARY_VERSION_TLS_1_3, expected_version_);
- expected = (variant_ == ssl_variant_datagram) ? 4 : 3;
- }
- EXPECT_EQ(expected, cipherSpecs);
- if (expected != cipherSpecs) {
- SSLInt_PrintCipherSpecs(role_str().c_str(), ssl_fd());
- }
-}
-
void TlsAgent::Connected() {
if (state_ == STATE_CONNECTED) {
return;
@@ -748,8 +743,6 @@ void TlsAgent::Connected() {
EXPECT_EQ(SECSuccess, rv);
EXPECT_EQ(sizeof(info_), info_.length);
- EXPECT_EQ(expect_resumption_, info_.resumed == PR_TRUE);
-
// Preliminary values are exposed through callbacks during the handshake.
// If either expected values were set or the callbacks were called, check
// that the final values are correct.
@@ -760,13 +753,32 @@ void TlsAgent::Connected() {
EXPECT_EQ(SECSuccess, rv);
EXPECT_EQ(sizeof(csinfo_), csinfo_.length);
- ValidateCipherSpecs();
+ if (expected_version_ >= SSL_LIBRARY_VERSION_TLS_1_3) {
+ PRInt32 cipherSuites = SSLInt_CountTls13CipherSpecs(ssl_fd());
+ // We use one ciphersuite in each direction, plus one that's kept around
+ // by DTLS for retransmission.
+ PRInt32 expected =
+ ((variant_ == ssl_variant_datagram) && (role_ == CLIENT)) ? 3 : 2;
+ EXPECT_EQ(expected, cipherSuites);
+ if (expected != cipherSuites) {
+ SSLInt_PrintTls13CipherSpecs(ssl_fd());
+ }
+ }
+ PRBool short_headers;
+ rv = SSLInt_UsingShortHeaders(ssl_fd(), &short_headers);
+ EXPECT_EQ(SECSuccess, rv);
+ EXPECT_EQ((PRBool)expect_short_headers_, short_headers);
SetState(STATE_CONNECTED);
}
void TlsAgent::EnableExtendedMasterSecret() {
- SetOption(SSL_ENABLE_EXTENDED_MASTER_SECRET, PR_TRUE);
+ ASSERT_TRUE(EnsureTlsSetup());
+
+ SECStatus rv =
+ SSL_OptionSet(ssl_fd(), SSL_ENABLE_EXTENDED_MASTER_SECRET, PR_TRUE);
+
+ ASSERT_EQ(SECSuccess, rv);
}
void TlsAgent::CheckExtendedMasterSecret(bool expected) {
@@ -789,6 +801,21 @@ void TlsAgent::CheckSecretsDestroyed() {
ASSERT_EQ(PR_TRUE, SSLInt_CheckSecretsDestroyed(ssl_fd()));
}
+void TlsAgent::DisableRollbackDetection() {
+ ASSERT_TRUE(EnsureTlsSetup());
+
+ SECStatus rv = SSL_OptionSet(ssl_fd(), SSL_ROLLBACK_DETECTION, PR_FALSE);
+
+ ASSERT_EQ(SECSuccess, rv);
+}
+
+void TlsAgent::EnableCompression() {
+ ASSERT_TRUE(EnsureTlsSetup());
+
+ SECStatus rv = SSL_OptionSet(ssl_fd(), SSL_ENABLE_DEFLATE, PR_TRUE);
+ ASSERT_EQ(SECSuccess, rv);
+}
+
void TlsAgent::SetDowngradeCheckVersion(uint16_t version) {
ASSERT_TRUE(EnsureTlsSetup());
@@ -856,14 +883,6 @@ void TlsAgent::SendDirect(const DataBuffer& buf) {
}
}
-void TlsAgent::SendRecordDirect(const TlsRecord& record) {
- DataBuffer buf;
-
- auto rv = record.header.Write(&buf, 0, record.buffer);
- EXPECT_EQ(record.header.header_length() + record.buffer.len(), rv);
- SendDirect(buf);
-}
-
static bool ErrorIsNonFatal(PRErrorCode code) {
return code == PR_WOULD_BLOCK_ERROR || code == SSL_ERROR_RX_SHORT_DTLS_READ;
}
@@ -899,27 +918,6 @@ void TlsAgent::SendBuffer(const DataBuffer& buf) {
}
}
-bool TlsAgent::SendEncryptedRecord(const std::shared_ptr<TlsCipherSpec>& spec,
- uint16_t wireVersion, uint64_t seq,
- uint8_t ct, const DataBuffer& buf) {
- LOGV("Writing " << buf.len() << " bytes");
- // Ensure we are a TLS 1.3 cipher agent.
- EXPECT_GE(expected_version_, SSL_LIBRARY_VERSION_TLS_1_3);
- TlsRecordHeader header(wireVersion, kTlsApplicationDataType, seq);
- DataBuffer padded = buf;
- padded.Write(padded.len(), ct, 1);
- DataBuffer ciphertext;
- if (!spec->Protect(header, padded, &ciphertext)) {
- return false;
- }
-
- DataBuffer record;
- auto rv = header.Write(&record, 0, ciphertext);
- EXPECT_EQ(header.header_length() + ciphertext.len(), rv);
- SendDirect(record);
- return true;
-}
-
void TlsAgent::ReadBytes(size_t amount) {
uint8_t block[16384];
@@ -953,20 +951,23 @@ void TlsAgent::ReadBytes(size_t amount) {
void TlsAgent::ResetSentBytes() { send_ctr_ = 0; }
-void TlsAgent::SetOption(int32_t option, int value) {
- ASSERT_TRUE(EnsureTlsSetup());
- EXPECT_EQ(SECSuccess, SSL_OptionSet(ssl_fd(), option, value));
-}
-
void TlsAgent::ConfigureSessionCache(SessionResumptionMode mode) {
- SetOption(SSL_NO_CACHE, mode & RESUME_SESSIONID ? PR_FALSE : PR_TRUE);
- SetOption(SSL_ENABLE_SESSION_TICKETS,
- mode & RESUME_TICKET ? PR_TRUE : PR_FALSE);
+ EXPECT_TRUE(EnsureTlsSetup());
+
+ SECStatus rv = SSL_OptionSet(ssl_fd(), SSL_NO_CACHE,
+ mode & RESUME_SESSIONID ? PR_FALSE : PR_TRUE);
+ EXPECT_EQ(SECSuccess, rv);
+
+ rv = SSL_OptionSet(ssl_fd(), SSL_ENABLE_SESSION_TICKETS,
+ mode & RESUME_TICKET ? PR_TRUE : PR_FALSE);
+ EXPECT_EQ(SECSuccess, rv);
}
void TlsAgent::DisableECDHEServerKeyReuse() {
+ ASSERT_TRUE(EnsureTlsSetup());
ASSERT_EQ(TlsAgent::SERVER, role_);
- SetOption(SSL_REUSE_SERVER_ECDHE_KEY, PR_FALSE);
+ SECStatus rv = SSL_OptionSet(ssl_fd(), SSL_REUSE_SERVER_ECDHE_KEY, PR_FALSE);
+ EXPECT_EQ(SECSuccess, rv);
}
static const std::string kTlsRolesAllArr[] = {"CLIENT", "SERVER"};
diff --git a/security/nss/gtests/ssl_gtest/tls_agent.h b/security/nss/gtests/ssl_gtest/tls_agent.h
index b3fd892ae4..4bccb9a849 100644
--- a/security/nss/gtests/ssl_gtest/tls_agent.h
+++ b/security/nss/gtests/ssl_gtest/tls_agent.h
@@ -66,6 +66,7 @@ class TlsAgent : public PollTarget {
static const std::string kServerRsaSign;
static const std::string kServerRsaPss;
static const std::string kServerRsaDecrypt;
+ static const std::string kServerRsaChain; // A cert that requires a chain.
static const std::string kServerEcdsa256;
static const std::string kServerEcdsa384;
static const std::string kServerEcdsa521;
@@ -80,11 +81,9 @@ class TlsAgent : public PollTarget {
adapter_->SetPeer(peer->adapter_);
}
- // Set a filter that can access plaintext (TLS 1.3 only).
void SetTlsRecordFilter(std::shared_ptr<TlsRecordFilter> filter) {
filter->SetAgent(this);
adapter_->SetPacketFilter(filter);
- filter->EnableDecryption();
}
void SetPacketFilter(std::shared_ptr<PacketFilter> filter) {
@@ -96,7 +95,6 @@ class TlsAgent : public PollTarget {
void StartConnect(PRFileDesc* model = nullptr);
void CheckKEA(SSLKEAType kea_type, SSLNamedGroup group,
size_t kea_size = 0) const;
- void CheckOriginalKEA(SSLNamedGroup kea_group) const;
void CheckAuthType(SSLAuthType auth_type,
SSLSignatureScheme sig_scheme) const;
@@ -123,10 +121,12 @@ class TlsAgent : public PollTarget {
void SetupClientAuth();
void RequestClientAuth(bool requireAuth);
- void SetOption(int32_t option, int value);
void ConfigureSessionCache(SessionResumptionMode mode);
+ void SetSessionTicketsEnabled(bool en);
+ void SetSessionCacheEnabled(bool en);
void Set0RttEnabled(bool en);
void SetFallbackSCSVEnabled(bool en);
+ void SetShortHeadersEnabled();
void SetVersionRange(uint16_t minver, uint16_t maxver);
void GetVersionRange(uint16_t* minver, uint16_t* maxver);
void CheckPreliminaryInfo();
@@ -136,6 +136,7 @@ class TlsAgent : public PollTarget {
void ExpectReadWriteError();
void EnableFalseStart();
void ExpectResumption();
+ void ExpectShortHeaders();
void SkipVersionChecks();
void SetSignatureSchemes(const SSLSignatureScheme* schemes, size_t count);
void EnableAlpn(const uint8_t* val, size_t len);
@@ -148,17 +149,15 @@ class TlsAgent : public PollTarget {
// Send data on the socket, encrypting it.
void SendData(size_t bytes, size_t blocksize = 1024);
void SendBuffer(const DataBuffer& buf);
- bool SendEncryptedRecord(const std::shared_ptr<TlsCipherSpec>& spec,
- uint16_t wireVersion, uint64_t seq, uint8_t ct,
- const DataBuffer& buf);
// Send data directly to the underlying socket, skipping the TLS layer.
void SendDirect(const DataBuffer& buf);
- void SendRecordDirect(const TlsRecord& record);
void ReadBytes(size_t max = 16384U);
void ResetSentBytes(); // Hack to test drops.
void EnableExtendedMasterSecret();
void CheckExtendedMasterSecret(bool expected);
void CheckEarlyDataAccepted(bool expected);
+ void DisableRollbackDetection();
+ void EnableCompression();
void SetDowngradeCheckVersion(uint16_t version);
void CheckSecretsDestroyed();
void ConfigNamedGroups(const std::vector<SSLNamedGroup>& groups);
@@ -171,8 +170,6 @@ class TlsAgent : public PollTarget {
Role role() const { return role_; }
std::string role_str() const { return role_ == SERVER ? "server" : "client"; }
- SSLProtocolVariant variant() const { return variant_; }
-
State state() const { return state_; }
const CERTCertificate* peer_cert() const {
@@ -256,7 +253,6 @@ class TlsAgent : public PollTarget {
const static char* states[];
void SetState(State state);
- void ValidateCipherSpecs();
// Dummy auth certificate hook.
static SECStatus AuthCertificateHook(void* arg, PRFileDesc* fd,
@@ -392,6 +388,7 @@ class TlsAgent : public PollTarget {
HandshakeCallbackFunction handshake_callback_;
AuthCertificateCallbackFunction auth_certificate_callback_;
SniCallbackFunction sni_callback_;
+ bool expect_short_headers_;
bool skip_version_checks_;
};
diff --git a/security/nss/gtests/ssl_gtest/tls_connect.cc b/security/nss/gtests/ssl_gtest/tls_connect.cc
index 0af5123e9e..c8de5a1fee 100644
--- a/security/nss/gtests/ssl_gtest/tls_connect.cc
+++ b/security/nss/gtests/ssl_gtest/tls_connect.cc
@@ -5,7 +5,6 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "tls_connect.h"
-#include "sslexp.h"
extern "C" {
#include "libssl_internals.h"
}
@@ -89,8 +88,6 @@ std::string VersionString(uint16_t version) {
switch (version) {
case 0:
return "(no version)";
- case SSL_LIBRARY_VERSION_3_0:
- return "1.0";
case SSL_LIBRARY_VERSION_TLS_1_0:
return "1.0";
case SSL_LIBRARY_VERSION_TLS_1_1:
@@ -115,7 +112,6 @@ TlsConnectTestBase::TlsConnectTestBase(SSLProtocolVariant variant,
server_model_(nullptr),
version_(version),
expected_resumption_mode_(RESUME_NONE),
- expected_resumptions_(0),
session_ids_(),
expect_extended_master_secret_(false),
expect_early_data_accepted_(false),
@@ -165,22 +161,6 @@ void TlsConnectTestBase::CheckShares(
EXPECT_EQ(shares.len(), i);
}
-void TlsConnectTestBase::CheckEpochs(uint16_t client_epoch,
- uint16_t server_epoch) const {
- uint16_t read_epoch = 0;
- uint16_t write_epoch = 0;
-
- EXPECT_EQ(SECSuccess,
- SSLInt_GetEpochs(client_->ssl_fd(), &read_epoch, &write_epoch));
- EXPECT_EQ(server_epoch, read_epoch) << "client read epoch";
- EXPECT_EQ(client_epoch, write_epoch) << "client write epoch";
-
- EXPECT_EQ(SECSuccess,
- SSLInt_GetEpochs(server_->ssl_fd(), &read_epoch, &write_epoch));
- EXPECT_EQ(client_epoch, read_epoch) << "server read epoch";
- EXPECT_EQ(server_epoch, write_epoch) << "server write epoch";
-}
-
void TlsConnectTestBase::ClearStats() {
// Clear statistics.
SSL3Statistics* stats = SSL_GetStatistics();
@@ -198,7 +178,6 @@ void TlsConnectTestBase::SetUp() {
SSLInt_ClearSelfEncryptKey();
SSLInt_SetTicketLifetime(30);
SSLInt_SetMaxEarlyDataSize(1024);
- SSL_SetupAntiReplay(1 * PR_USEC_PER_SEC, 1, 3);
ClearStats();
Init();
}
@@ -240,27 +219,12 @@ void TlsConnectTestBase::Reset(const std::string& server_name,
Init();
}
-void TlsConnectTestBase::MakeNewServer() {
- auto replacement = std::make_shared<TlsAgent>(
- server_->name(), TlsAgent::SERVER, server_->variant());
- server_ = replacement;
- if (version_) {
- server_->SetVersionRange(version_, version_);
- }
- client_->SetPeer(server_);
- server_->SetPeer(client_);
- server_->StartConnect();
-}
-
-void TlsConnectTestBase::ExpectResumption(SessionResumptionMode expected,
- uint8_t num_resumptions) {
+void TlsConnectTestBase::ExpectResumption(SessionResumptionMode expected) {
expected_resumption_mode_ = expected;
if (expected != RESUME_NONE) {
client_->ExpectResumption();
server_->ExpectResumption();
- expected_resumptions_ = num_resumptions;
}
- EXPECT_EQ(expected_resumptions_ == 0, expected == RESUME_NONE);
}
void TlsConnectTestBase::EnsureTlsSetup() {
@@ -294,11 +258,6 @@ void TlsConnectTestBase::Connect() {
CheckConnected();
}
-void TlsConnectTestBase::StartConnect() {
- server_->StartConnect(server_model_ ? server_model_->ssl_fd() : nullptr);
- client_->StartConnect(client_model_ ? client_model_->ssl_fd() : nullptr);
-}
-
void TlsConnectTestBase::ConnectWithCipherSuite(uint16_t cipher_suite) {
EnsureTlsSetup();
client_->EnableSingleCipher(cipher_suite);
@@ -315,19 +274,6 @@ void TlsConnectTestBase::ConnectWithCipherSuite(uint16_t cipher_suite) {
}
void TlsConnectTestBase::CheckConnected() {
- // Have the client read handshake twice to make sure we get the
- // NST and the ACK.
- if (client_->version() >= SSL_LIBRARY_VERSION_TLS_1_3 &&
- variant_ == ssl_variant_datagram) {
- client_->Handshake();
- client_->Handshake();
- auto suites = SSLInt_CountCipherSpecs(client_->ssl_fd());
- // Verify that we dropped the client's retransmission cipher suites.
- EXPECT_EQ(2, suites) << "Client has the wrong number of suites";
- if (suites != 2) {
- SSLInt_PrintCipherSpecs("client", client_->ssl_fd());
- }
- }
EXPECT_EQ(client_->version(), server_->version());
if (!skip_version_checks_) {
// Check the version is as expected
@@ -368,12 +314,10 @@ void TlsConnectTestBase::CheckConnected() {
void TlsConnectTestBase::CheckKeys(SSLKEAType kea_type, SSLNamedGroup kea_group,
SSLAuthType auth_type,
SSLSignatureScheme sig_scheme) const {
- if (kea_group != ssl_grp_none) {
- client_->CheckKEA(kea_type, kea_group);
- server_->CheckKEA(kea_type, kea_group);
- }
- server_->CheckAuthType(auth_type, sig_scheme);
+ client_->CheckKEA(kea_type, kea_group);
+ server_->CheckKEA(kea_type, kea_group);
client_->CheckAuthType(auth_type, sig_scheme);
+ server_->CheckAuthType(auth_type, sig_scheme);
}
void TlsConnectTestBase::CheckKeys(SSLKEAType kea_type,
@@ -428,19 +372,9 @@ void TlsConnectTestBase::CheckKeys() const {
CheckKeys(ssl_kea_ecdh, ssl_auth_rsa_sign);
}
-void TlsConnectTestBase::CheckKeysResumption(SSLKEAType kea_type,
- SSLNamedGroup kea_group,
- SSLNamedGroup original_kea_group,
- SSLAuthType auth_type,
- SSLSignatureScheme sig_scheme) {
- CheckKeys(kea_type, kea_group, auth_type, sig_scheme);
- EXPECT_TRUE(expected_resumption_mode_ != RESUME_NONE);
- client_->CheckOriginalKEA(original_kea_group);
- server_->CheckOriginalKEA(original_kea_group);
-}
-
void TlsConnectTestBase::ConnectExpectFail() {
- StartConnect();
+ server_->StartConnect();
+ client_->StartConnect();
Handshake();
ASSERT_EQ(TlsAgent::STATE_ERROR, client_->state());
ASSERT_EQ(TlsAgent::STATE_ERROR, server_->state());
@@ -461,7 +395,8 @@ void TlsConnectTestBase::ConnectExpectAlert(std::shared_ptr<TlsAgent>& sender,
}
void TlsConnectTestBase::ConnectExpectFailOneSide(TlsAgent::Role failing_side) {
- StartConnect();
+ server_->StartConnect();
+ client_->StartConnect();
client_->SetServerKeyBits(server_->server_key_bits());
client_->Handshake();
server_->Handshake();
@@ -520,33 +455,29 @@ void TlsConnectTestBase::EnableSomeEcdhCiphers() {
}
}
-void TlsConnectTestBase::ConfigureSelfEncrypt() {
- ScopedCERTCertificate cert;
- ScopedSECKEYPrivateKey privKey;
- ASSERT_TRUE(
- TlsAgent::LoadCertificate(TlsAgent::kServerRsaDecrypt, &cert, &privKey));
-
- ScopedSECKEYPublicKey pubKey(CERT_ExtractPublicKey(cert.get()));
- ASSERT_TRUE(pubKey);
-
- EXPECT_EQ(SECSuccess,
- SSL_SetSessionTicketKeyPair(pubKey.get(), privKey.get()));
-}
-
void TlsConnectTestBase::ConfigureSessionCache(SessionResumptionMode client,
SessionResumptionMode server) {
client_->ConfigureSessionCache(client);
server_->ConfigureSessionCache(server);
if ((server & RESUME_TICKET) != 0) {
- ConfigureSelfEncrypt();
+ ScopedCERTCertificate cert;
+ ScopedSECKEYPrivateKey privKey;
+ ASSERT_TRUE(TlsAgent::LoadCertificate(TlsAgent::kServerRsaDecrypt, &cert,
+ &privKey));
+
+ ScopedSECKEYPublicKey pubKey(CERT_ExtractPublicKey(cert.get()));
+ ASSERT_TRUE(pubKey);
+
+ EXPECT_EQ(SECSuccess,
+ SSL_SetSessionTicketKeyPair(pubKey.get(), privKey.get()));
}
}
void TlsConnectTestBase::CheckResumption(SessionResumptionMode expected) {
EXPECT_NE(RESUME_BOTH, expected);
- int resume_count = expected ? expected_resumptions_ : 0;
- int stateless_count = (expected & RESUME_TICKET) ? expected_resumptions_ : 0;
+ int resume_count = expected ? 1 : 0;
+ int stateless_count = (expected & RESUME_TICKET) ? 1 : 0;
// Note: hch == server counter; hsh == client counter.
SSL3Statistics* stats = SSL_GetStatistics();
@@ -559,7 +490,7 @@ void TlsConnectTestBase::CheckResumption(SessionResumptionMode expected) {
if (expected != RESUME_NONE) {
if (client_->version() < SSL_LIBRARY_VERSION_TLS_1_3) {
// Check that the last two session ids match.
- ASSERT_EQ(1U + expected_resumptions_, session_ids_.size());
+ ASSERT_EQ(2U, session_ids_.size());
EXPECT_EQ(session_ids_[session_ids_.size() - 1],
session_ids_[session_ids_.size() - 2]);
} else {
@@ -609,28 +540,31 @@ void TlsConnectTestBase::CheckSrtp() const {
server_->CheckSrtp();
}
-void TlsConnectTestBase::SendReceive(size_t total) {
- ASSERT_GT(total, client_->received_bytes());
- ASSERT_GT(total, server_->received_bytes());
- client_->SendData(total - server_->received_bytes());
- server_->SendData(total - client_->received_bytes());
- Receive(total); // Receive() is cumulative
+void TlsConnectTestBase::SendReceive() {
+ client_->SendData(50);
+ server_->SendData(50);
+ Receive(50);
}
// Do a first connection so we can do 0-RTT on the second one.
void TlsConnectTestBase::SetupForZeroRtt() {
- // If we don't do this, then all 0-RTT attempts will be rejected.
- SSLInt_RolloverAntiReplay();
-
ConfigureSessionCache(RESUME_BOTH, RESUME_TICKET);
- ConfigureVersion(SSL_LIBRARY_VERSION_TLS_1_3);
+ client_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_1,
+ SSL_LIBRARY_VERSION_TLS_1_3);
+ server_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_1,
+ SSL_LIBRARY_VERSION_TLS_1_3);
server_->Set0RttEnabled(true); // So we signal that we allow 0-RTT.
Connect();
SendReceive(); // Need to read so that we absorb the session ticket.
CheckKeys();
Reset();
- StartConnect();
+ client_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_1,
+ SSL_LIBRARY_VERSION_TLS_1_3);
+ server_->SetVersionRange(SSL_LIBRARY_VERSION_TLS_1_1,
+ SSL_LIBRARY_VERSION_TLS_1_3);
+ server_->StartConnect();
+ client_->StartConnect();
}
// Do a first connection so we can do resumption
@@ -650,6 +584,10 @@ void TlsConnectTestBase::ZeroRttSendReceive(
const char* k0RttData = "ABCDEF";
const PRInt32 k0RttDataLen = static_cast<PRInt32>(strlen(k0RttData));
+ if (expect_writable && expect_readable) {
+ ExpectAlert(client_, kTlsAlertEndOfEarlyData);
+ }
+
client_->Handshake(); // Send ClientHello.
if (post_clienthello_check) {
if (!post_clienthello_check()) return;
@@ -661,7 +599,7 @@ void TlsConnectTestBase::ZeroRttSendReceive(
} else {
EXPECT_EQ(SECFailure, rv);
}
- server_->Handshake(); // Consume ClientHello
+ server_->Handshake(); // Consume ClientHello, EE, Finished.
std::vector<uint8_t> buf(k0RttDataLen);
rv = PR_Read(server_->ssl_fd(), buf.data(), k0RttDataLen); // 0-RTT read
@@ -715,30 +653,6 @@ void TlsConnectTestBase::SkipVersionChecks() {
server_->SkipVersionChecks();
}
-// Shift the DTLS timers, to the minimum time necessary to let the next timer
-// run on either client or server. This allows tests to skip waiting without
-// having timers run out of order.
-void TlsConnectTestBase::ShiftDtlsTimers() {
- PRIntervalTime time_shift = PR_INTERVAL_NO_TIMEOUT;
- PRIntervalTime time;
- SECStatus rv = DTLS_GetHandshakeTimeout(client_->ssl_fd(), &time);
- if (rv == SECSuccess) {
- time_shift = time;
- }
- rv = DTLS_GetHandshakeTimeout(server_->ssl_fd(), &time);
- if (rv == SECSuccess &&
- (time < time_shift || time_shift == PR_INTERVAL_NO_TIMEOUT)) {
- time_shift = time;
- }
-
- if (time_shift == PR_INTERVAL_NO_TIMEOUT) {
- return;
- }
-
- EXPECT_EQ(SECSuccess, SSLInt_ShiftDtlsTimers(client_->ssl_fd(), time_shift));
- EXPECT_EQ(SECSuccess, SSLInt_ShiftDtlsTimers(server_->ssl_fd(), time_shift));
-}
-
TlsConnectGeneric::TlsConnectGeneric()
: TlsConnectTestBase(std::get<0>(GetParam()), std::get<1>(GetParam())) {}
@@ -777,15 +691,11 @@ void TlsKeyExchangeTest::ConfigNamedGroups(
}
std::vector<SSLNamedGroup> TlsKeyExchangeTest::GetGroupDetails(
- const std::shared_ptr<TlsExtensionCapture>& capture) {
- EXPECT_TRUE(capture->captured());
- const DataBuffer& ext = capture->extension();
-
+ const DataBuffer& ext) {
uint32_t tmp = 0;
EXPECT_TRUE(ext.Read(0, 2, &tmp));
EXPECT_EQ(ext.len() - 2, static_cast<size_t>(tmp));
EXPECT_TRUE(ext.len() % 2 == 0);
-
std::vector<SSLNamedGroup> groups;
for (size_t i = 1; i < ext.len() / 2; i += 1) {
EXPECT_TRUE(ext.Read(2 * i, 2, &tmp));
@@ -795,14 +705,10 @@ std::vector<SSLNamedGroup> TlsKeyExchangeTest::GetGroupDetails(
}
std::vector<SSLNamedGroup> TlsKeyExchangeTest::GetShareDetails(
- const std::shared_ptr<TlsExtensionCapture>& capture) {
- EXPECT_TRUE(capture->captured());
- const DataBuffer& ext = capture->extension();
-
+ const DataBuffer& ext) {
uint32_t tmp = 0;
EXPECT_TRUE(ext.Read(0, 2, &tmp));
EXPECT_EQ(ext.len() - 2, static_cast<size_t>(tmp));
-
std::vector<SSLNamedGroup> shares;
size_t i = 2;
while (i < ext.len()) {
@@ -818,15 +724,17 @@ std::vector<SSLNamedGroup> TlsKeyExchangeTest::GetShareDetails(
void TlsKeyExchangeTest::CheckKEXDetails(
const std::vector<SSLNamedGroup>& expected_groups,
const std::vector<SSLNamedGroup>& expected_shares, bool expect_hrr) {
- std::vector<SSLNamedGroup> groups = GetGroupDetails(groups_capture_);
+ std::vector<SSLNamedGroup> groups =
+ GetGroupDetails(groups_capture_->extension());
EXPECT_EQ(expected_groups, groups);
if (version_ >= SSL_LIBRARY_VERSION_TLS_1_3) {
ASSERT_LT(0U, expected_shares.size());
- std::vector<SSLNamedGroup> shares = GetShareDetails(shares_capture_);
+ std::vector<SSLNamedGroup> shares =
+ GetShareDetails(shares_capture_->extension());
EXPECT_EQ(expected_shares, shares);
} else {
- EXPECT_FALSE(shares_capture_->captured());
+ EXPECT_EQ(0U, shares_capture_->extension().len());
}
EXPECT_EQ(expect_hrr, capture_hrr_->buffer().len() != 0);
@@ -848,6 +756,8 @@ void TlsKeyExchangeTest::CheckKEXDetails(
EXPECT_NE(expected_share2, it);
}
std::vector<SSLNamedGroup> expected_shares2 = {expected_share2};
- EXPECT_EQ(expected_shares2, GetShareDetails(shares_capture2_));
+ std::vector<SSLNamedGroup> shares =
+ GetShareDetails(shares_capture2_->extension());
+ EXPECT_EQ(expected_shares2, shares);
}
} // namespace nss_test
diff --git a/security/nss/gtests/ssl_gtest/tls_connect.h b/security/nss/gtests/ssl_gtest/tls_connect.h
index c650dda1dc..73e8dc81a9 100644
--- a/security/nss/gtests/ssl_gtest/tls_connect.h
+++ b/security/nss/gtests/ssl_gtest/tls_connect.h
@@ -61,11 +61,7 @@ class TlsConnectTestBase : public ::testing::Test {
// Reset, and update the certificate names on both peers
void Reset(const std::string& server_name,
const std::string& client_name = "client");
- // Replace the server.
- void MakeNewServer();
- // Set up
- void StartConnect();
// Run the handshake.
void Handshake();
// Connect and check that it works.
@@ -85,28 +81,20 @@ class TlsConnectTestBase : public ::testing::Test {
void CheckKeys(SSLKEAType kea_type, SSLAuthType auth_type) const;
// This version assumes defaults.
void CheckKeys() const;
- // Check that keys on resumed sessions.
- void CheckKeysResumption(SSLKEAType kea_type, SSLNamedGroup kea_group,
- SSLNamedGroup original_kea_group,
- SSLAuthType auth_type,
- SSLSignatureScheme sig_scheme);
void CheckGroups(const DataBuffer& groups,
std::function<void(SSLNamedGroup)> check_group);
void CheckShares(const DataBuffer& shares,
std::function<void(SSLNamedGroup)> check_group);
- void CheckEpochs(uint16_t client_epoch, uint16_t server_epoch) const;
void ConfigureVersion(uint16_t version);
void SetExpectedVersion(uint16_t version);
// Expect resumption of a particular type.
- void ExpectResumption(SessionResumptionMode expected,
- uint8_t num_resumed = 1);
+ void ExpectResumption(SessionResumptionMode expected);
void DisableAllCiphers();
void EnableOnlyStaticRsaCiphers();
void EnableOnlyDheCiphers();
void EnableSomeEcdhCiphers();
void EnableExtendedMasterSecret();
- void ConfigureSelfEncrypt();
void ConfigureSessionCache(SessionResumptionMode client,
SessionResumptionMode server);
void EnableAlpn();
@@ -115,7 +103,7 @@ class TlsConnectTestBase : public ::testing::Test {
void CheckAlpn(const std::string& val);
void EnableSrtp();
void CheckSrtp() const;
- void SendReceive(size_t total = 50);
+ void SendReceive();
void SetupForZeroRtt();
void SetupForResume();
void ZeroRttSendReceive(
@@ -127,9 +115,6 @@ class TlsConnectTestBase : public ::testing::Test {
void DisableECDHEServerKeyReuse();
void SkipVersionChecks();
- // Move the DTLS timers for both endpoints to pop the next timer.
- void ShiftDtlsTimers();
-
protected:
SSLProtocolVariant variant_;
std::shared_ptr<TlsAgent> client_;
@@ -138,7 +123,6 @@ class TlsConnectTestBase : public ::testing::Test {
std::unique_ptr<TlsAgent> server_model_;
uint16_t version_;
SessionResumptionMode expected_resumption_mode_;
- uint8_t expected_resumptions_;
std::vector<std::vector<uint8_t>> session_ids_;
// A simple value of "a", "b". Note that the preferred value of "a" is placed
@@ -260,11 +244,6 @@ class TlsConnectDatagram13 : public TlsConnectTestBase {
: TlsConnectTestBase(ssl_variant_datagram, SSL_LIBRARY_VERSION_TLS_1_3) {}
};
-class TlsConnectDatagramPre13 : public TlsConnectDatagram {
- public:
- TlsConnectDatagramPre13() {}
-};
-
// A variant that is used only with Pre13.
class TlsConnectGenericPre13 : public TlsConnectGeneric {};
@@ -277,10 +256,8 @@ class TlsKeyExchangeTest : public TlsConnectGeneric {
void EnsureKeyShareSetup();
void ConfigNamedGroups(const std::vector<SSLNamedGroup>& groups);
- std::vector<SSLNamedGroup> GetGroupDetails(
- const std::shared_ptr<TlsExtensionCapture>& capture);
- std::vector<SSLNamedGroup> GetShareDetails(
- const std::shared_ptr<TlsExtensionCapture>& capture);
+ std::vector<SSLNamedGroup> GetGroupDetails(const DataBuffer& ext);
+ std::vector<SSLNamedGroup> GetShareDetails(const DataBuffer& ext);
void CheckKEXDetails(const std::vector<SSLNamedGroup>& expectedGroups,
const std::vector<SSLNamedGroup>& expectedShares);
void CheckKEXDetails(const std::vector<SSLNamedGroup>& expectedGroups,
diff --git a/security/nss/gtests/ssl_gtest/tls_filter.cc b/security/nss/gtests/ssl_gtest/tls_filter.cc
index 89f2012950..76d9aaaffc 100644
--- a/security/nss/gtests/ssl_gtest/tls_filter.cc
+++ b/security/nss/gtests/ssl_gtest/tls_filter.cc
@@ -12,7 +12,6 @@ extern "C" {
#include "libssl_internals.h"
}
-#include <cassert>
#include <iostream>
#include "gtest_utils.h"
#include "tls_agent.h"
@@ -58,22 +57,17 @@ void TlsRecordFilter::CipherSpecChanged(void* arg, PRBool sending,
PRBool isServer = self->agent()->role() == TlsAgent::SERVER;
if (g_ssl_gtest_verbose) {
- std::cerr << (isServer ? "server" : "client") << ": "
- << (sending ? "send" : "receive")
- << " cipher spec changed: " << newSpec->epoch << " ("
- << newSpec->phase << ")" << std::endl;
- }
- if (!sending) {
- return;
+ std::cerr << "Cipher spec changed. Role="
+ << (isServer ? "server" : "client")
+ << " direction=" << (sending ? "send" : "receive") << std::endl;
}
+ if (!sending) return;
- self->in_sequence_number_ = 0;
- self->out_sequence_number_ = 0;
- self->dropped_record_ = false;
self->cipher_spec_.reset(new TlsCipherSpec());
- bool ret = self->cipher_spec_->Init(
- SSLInt_CipherSpecToEpoch(newSpec), SSLInt_CipherSpecToAlgorithm(newSpec),
- SSLInt_CipherSpecToKey(newSpec), SSLInt_CipherSpecToIv(newSpec));
+ bool ret =
+ self->cipher_spec_->Init(SSLInt_CipherSpecToAlgorithm(isServer, newSpec),
+ SSLInt_CipherSpecToKey(isServer, newSpec),
+ SSLInt_CipherSpecToIv(isServer, newSpec));
EXPECT_EQ(true, ret);
}
@@ -89,23 +83,11 @@ PacketFilter::Action TlsRecordFilter::Filter(const DataBuffer& input,
TlsRecordHeader header;
DataBuffer record;
- if (!header.Parse(in_sequence_number_, &parser, &record)) {
+ if (!header.Parse(&parser, &record)) {
ADD_FAILURE() << "not a valid record";
return KEEP;
}
- // Track the sequence number, which is necessary for stream mode (the
- // sequence number is in the header for datagram).
- //
- // This isn't perfectly robust. If there is a change from an active cipher
- // spec to another active cipher spec (KeyUpdate for instance) AND writes
- // are consolidated across that change AND packets were dropped from the
- // older epoch, we will not correctly re-encrypt records in the old epoch to
- // update their sequence numbers.
- if (cipher_spec_ && header.content_type() == kTlsApplicationDataType) {
- ++in_sequence_number_;
- }
-
if (FilterRecord(header, record, &offset, output) != KEEP) {
changed = true;
} else {
@@ -138,49 +120,30 @@ PacketFilter::Action TlsRecordFilter::FilterRecord(
header.sequence_number()};
PacketFilter::Action action = FilterRecord(real_header, plaintext, &filtered);
- // In stream mode, even if something doesn't change we need to re-encrypt if
- // previous packets were dropped.
if (action == KEEP) {
- if (header.is_dtls() || !dropped_record_) {
- return KEEP;
- }
- filtered = plaintext;
+ return KEEP;
}
if (action == DROP) {
- std::cerr << "record drop: " << header << ":" << record << std::endl;
- dropped_record_ = true;
+ std::cerr << "record drop: " << record << std::endl;
return DROP;
}
EXPECT_GT(0x10000U, filtered.len());
- if (action != KEEP) {
- std::cerr << "record old: " << plaintext << std::endl;
- std::cerr << "record new: " << filtered << std::endl;
- }
-
- uint64_t seq_num;
- if (header.is_dtls() || !cipher_spec_ ||
- header.content_type() != kTlsApplicationDataType) {
- seq_num = header.sequence_number();
- } else {
- seq_num = out_sequence_number_++;
- }
- TlsRecordHeader out_header = {header.version(), header.content_type(),
- seq_num};
+ std::cerr << "record old: " << plaintext << std::endl;
+ std::cerr << "record new: " << filtered << std::endl;
DataBuffer ciphertext;
- bool rv = Protect(out_header, inner_content_type, filtered, &ciphertext);
+ bool rv = Protect(header, inner_content_type, filtered, &ciphertext);
EXPECT_TRUE(rv);
if (!rv) {
return KEEP;
}
- *offset = out_header.Write(output, *offset, ciphertext);
+ *offset = header.Write(output, *offset, ciphertext);
return CHANGE;
}
-bool TlsRecordHeader::Parse(uint64_t sequence_number, TlsParser* parser,
- DataBuffer* body) {
+bool TlsRecordHeader::Parse(TlsParser* parser, DataBuffer* body) {
if (!parser->Read(&content_type_)) {
return false;
}
@@ -191,7 +154,7 @@ bool TlsRecordHeader::Parse(uint64_t sequence_number, TlsParser* parser,
}
version_ = version;
- // If this is DTLS, overwrite the sequence number.
+ sequence_number_ = 0;
if (IsDtls(version)) {
uint32_t tmp;
if (!parser->Read(&tmp, 4)) {
@@ -202,8 +165,6 @@ bool TlsRecordHeader::Parse(uint64_t sequence_number, TlsParser* parser,
return false;
}
sequence_number_ |= static_cast<uint64_t>(tmp);
- } else {
- sequence_number_ = sequence_number;
}
return parser->ReadVariable(body, 2);
}
@@ -232,9 +193,7 @@ bool TlsRecordFilter::Unprotect(const TlsRecordHeader& header,
return true;
}
- if (!cipher_spec_->Unprotect(header, ciphertext, plaintext)) {
- return false;
- }
+ if (!cipher_spec_->Unprotect(header, ciphertext, plaintext)) return false;
size_t len = plaintext->len();
while (len > 0 && !plaintext->data()[len - 1]) {
@@ -247,11 +206,6 @@ bool TlsRecordFilter::Unprotect(const TlsRecordHeader& header,
*inner_content_type = plaintext->data()[len - 1];
plaintext->Truncate(len - 1);
- if (g_ssl_gtest_verbose) {
- std::cerr << "unprotect: " << std::hex << header.sequence_number()
- << std::dec << " type=" << static_cast<int>(*inner_content_type)
- << " " << *plaintext << std::endl;
- }
return true;
}
@@ -264,44 +218,16 @@ bool TlsRecordFilter::Protect(const TlsRecordHeader& header,
*ciphertext = plaintext;
return true;
}
- if (g_ssl_gtest_verbose) {
- std::cerr << "protect: " << header.sequence_number() << std::endl;
- }
DataBuffer padded = plaintext;
padded.Write(padded.len(), inner_content_type, 1);
return cipher_spec_->Protect(header, padded, ciphertext);
}
-bool IsHelloRetry(const DataBuffer& body) {
- static const uint8_t ssl_hello_retry_random[] = {
- 0xCF, 0x21, 0xAD, 0x74, 0xE5, 0x9A, 0x61, 0x11, 0xBE, 0x1D, 0x8C,
- 0x02, 0x1E, 0x65, 0xB8, 0x91, 0xC2, 0xA2, 0x11, 0x16, 0x7A, 0xBB,
- 0x8C, 0x5E, 0x07, 0x9E, 0x09, 0xE2, 0xC8, 0xA8, 0x33, 0x9C};
- return memcmp(body.data() + 2, ssl_hello_retry_random,
- sizeof(ssl_hello_retry_random)) == 0;
-}
-
-bool TlsHandshakeFilter::IsFilteredType(const HandshakeHeader& header,
- const DataBuffer& body) {
- if (handshake_types_.empty()) {
- return true;
- }
-
- uint8_t type = header.handshake_type();
- if (type == kTlsHandshakeServerHello) {
- if (IsHelloRetry(body)) {
- type = kTlsHandshakeHelloRetryRequest;
- }
- }
- return handshake_types_.count(type) > 0U;
-}
-
PacketFilter::Action TlsHandshakeFilter::FilterRecord(
const TlsRecordHeader& record_header, const DataBuffer& input,
DataBuffer* output) {
// Check that the first byte is as requested.
- if ((record_header.content_type() != kTlsHandshakeType) &&
- (record_header.content_type() != kTlsAltHandshakeType)) {
+ if (record_header.content_type() != kTlsHandshakeType) {
return KEEP;
}
@@ -313,29 +239,12 @@ PacketFilter::Action TlsHandshakeFilter::FilterRecord(
while (parser.remaining()) {
HandshakeHeader header;
DataBuffer handshake;
- bool complete = false;
- if (!header.Parse(&parser, record_header, preceding_fragment_, &handshake,
- &complete)) {
+ if (!header.Parse(&parser, record_header, &handshake)) {
return KEEP;
}
- if (!complete) {
- EXPECT_TRUE(record_header.is_dtls());
- // Save the fragment and drop it from this record. Fragments are
- // coalesced with the last fragment of the handshake message.
- changed = true;
- preceding_fragment_.Assign(handshake);
- continue;
- }
- preceding_fragment_.Truncate(0);
-
DataBuffer filtered;
- PacketFilter::Action action;
- if (!IsFilteredType(header, handshake)) {
- action = KEEP;
- } else {
- action = FilterHandshake(header, handshake, &filtered);
- }
+ PacketFilter::Action action = FilterHandshake(header, handshake, &filtered);
if (action == DROP) {
changed = true;
std::cerr << "handshake drop: " << handshake << std::endl;
@@ -349,8 +258,6 @@ PacketFilter::Action TlsHandshakeFilter::FilterRecord(
std::cerr << "handshake old: " << handshake << std::endl;
std::cerr << "handshake new: " << filtered << std::endl;
source = &filtered;
- } else if (preceding_fragment_.len()) {
- changed = true;
}
offset = header.Write(output, offset, *source);
@@ -360,16 +267,12 @@ PacketFilter::Action TlsHandshakeFilter::FilterRecord(
}
bool TlsHandshakeFilter::HandshakeHeader::ReadLength(
- TlsParser* parser, const TlsRecordHeader& header, uint32_t expected_offset,
- uint32_t* length, bool* last_fragment) {
- uint32_t message_length;
- if (!parser->Read(&message_length, 3)) {
+ TlsParser* parser, const TlsRecordHeader& header, uint32_t* length) {
+ if (!parser->Read(length, 3)) {
return false; // malformed
}
if (!header.is_dtls()) {
- *last_fragment = true;
- *length = message_length;
return true; // nothing left to do
}
@@ -380,50 +283,32 @@ bool TlsHandshakeFilter::HandshakeHeader::ReadLength(
}
message_seq_ = message_seq_tmp;
- uint32_t offset = 0;
- if (!parser->Read(&offset, 3)) {
- return false;
- }
- // We only parse if the fragments are all complete and in order.
- if (offset != expected_offset) {
- EXPECT_NE(0U, header.epoch())
- << "Received out of order handshake fragment for epoch 0";
+ uint32_t fragment_offset;
+ if (!parser->Read(&fragment_offset, 3)) {
return false;
}
- // For DTLS, we return the length of just this fragment.
- if (!parser->Read(length, 3)) {
+ uint32_t fragment_length;
+ if (!parser->Read(&fragment_length, 3)) {
return false;
}
- // It's a fragment if the entire message is longer than what we have.
- *last_fragment = message_length == (*length + offset);
- return true;
+ // All current tests where we are using this code don't fragment.
+ return (fragment_offset == 0 && fragment_length == *length);
}
bool TlsHandshakeFilter::HandshakeHeader::Parse(
- TlsParser* parser, const TlsRecordHeader& record_header,
- const DataBuffer& preceding_fragment, DataBuffer* body, bool* complete) {
- *complete = false;
-
+ TlsParser* parser, const TlsRecordHeader& record_header, DataBuffer* body) {
version_ = record_header.version();
if (!parser->Read(&handshake_type_)) {
return false; // malformed
}
-
uint32_t length;
- if (!ReadLength(parser, record_header, preceding_fragment.len(), &length,
- complete)) {
+ if (!ReadLength(parser, record_header, &length)) {
return false;
}
- if (!parser->Read(body, length)) {
- return false;
- }
- if (preceding_fragment.len()) {
- body->Splice(preceding_fragment, 0);
- }
- return true;
+ return parser->Read(body, length);
}
size_t TlsHandshakeFilter::HandshakeHeader::WriteFragment(
@@ -460,23 +345,20 @@ PacketFilter::Action TlsInspectorRecordHandshakeMessage::FilterHandshake(
return KEEP;
}
- buffer_ = input;
+ if (header.handshake_type() == handshake_type_) {
+ buffer_ = input;
+ }
return KEEP;
}
PacketFilter::Action TlsInspectorReplaceHandshakeMessage::FilterHandshake(
const HandshakeHeader& header, const DataBuffer& input,
DataBuffer* output) {
- *output = buffer_;
- return CHANGE;
-}
-
-PacketFilter::Action TlsRecordRecorder::FilterRecord(
- const TlsRecordHeader& header, const DataBuffer& input,
- DataBuffer* output) {
- if (!filter_ || (header.content_type() == ct_)) {
- records_.push_back({header, input});
+ if (header.handshake_type() == handshake_type_) {
+ *output = buffer_;
+ return CHANGE;
}
+
return KEEP;
}
@@ -487,30 +369,15 @@ PacketFilter::Action TlsConversationRecorder::FilterRecord(
return KEEP;
}
-PacketFilter::Action TlsHeaderRecorder::FilterRecord(
- const TlsRecordHeader& header, const DataBuffer& input,
- DataBuffer* output) {
- headers_.push_back(header);
- return KEEP;
-}
-
-const TlsRecordHeader* TlsHeaderRecorder::header(size_t index) {
- if (index > headers_.size() + 1) {
- return nullptr;
- }
- return &headers_[index];
-}
-
PacketFilter::Action ChainedPacketFilter::Filter(const DataBuffer& input,
DataBuffer* output) {
DataBuffer in(input);
bool changed = false;
for (auto it = filters_.begin(); it != filters_.end(); ++it) {
- PacketFilter::Action action = (*it)->Process(in, output);
+ PacketFilter::Action action = (*it)->Filter(in, output);
if (action == DROP) {
return DROP;
}
-
if (action == CHANGE) {
in = *output;
changed = true;
@@ -563,6 +430,15 @@ bool FindServerHelloExtensions(TlsParser* parser, const TlsVersioned& header) {
return true;
}
+static bool FindHelloRetryExtensions(TlsParser* parser,
+ const TlsVersioned& header) {
+ // TODO for -19 add cipher suite
+ if (!parser->Skip(2)) { // version
+ return false;
+ }
+ return true;
+}
+
bool FindEncryptedExtensions(TlsParser* parser, const TlsVersioned& header) {
return true;
}
@@ -572,6 +448,13 @@ static bool FindCertReqExtensions(TlsParser* parser,
if (!parser->SkipVariable(1)) { // request context
return false;
}
+ // TODO remove the next two for -19
+ if (!parser->SkipVariable(2)) { // signature_algorithms
+ return false;
+ }
+ if (!parser->SkipVariable(2)) { // certificate_authorities
+ return false;
+ }
return true;
}
@@ -595,9 +478,6 @@ static bool FindNewSessionTicketExtensions(TlsParser* parser,
if (!parser->Skip(8)) { // lifetime, age add
return false;
}
- if (!parser->SkipVariable(1)) { // ticket_nonce
- return false;
- }
if (!parser->SkipVariable(2)) { // ticket
return false;
}
@@ -607,6 +487,7 @@ static bool FindNewSessionTicketExtensions(TlsParser* parser,
static const std::map<uint16_t, TlsExtensionFinder> kExtensionFinders = {
{kTlsHandshakeClientHello, FindClientHelloExtensions},
{kTlsHandshakeServerHello, FindServerHelloExtensions},
+ {kTlsHandshakeHelloRetryRequest, FindHelloRetryExtensions},
{kTlsHandshakeEncryptedExtensions, FindEncryptedExtensions},
{kTlsHandshakeCertificateRequest, FindCertReqExtensions},
{kTlsHandshakeCertificate, FindCertificateExtensions},
@@ -624,6 +505,10 @@ bool TlsExtensionFilter::FindExtensions(TlsParser* parser,
PacketFilter::Action TlsExtensionFilter::FilterHandshake(
const HandshakeHeader& header, const DataBuffer& input,
DataBuffer* output) {
+ if (handshake_types_.count(header.handshake_type()) == 0) {
+ return KEEP;
+ }
+
TlsParser parser(input);
if (!FindExtensions(&parser, header)) {
return KEEP;
@@ -725,38 +610,6 @@ PacketFilter::Action TlsExtensionDropper::FilterExtension(
return KEEP;
}
-PacketFilter::Action TlsExtensionInjector::FilterHandshake(
- const HandshakeHeader& header, const DataBuffer& input,
- DataBuffer* output) {
- TlsParser parser(input);
- if (!TlsExtensionFilter::FindExtensions(&parser, header)) {
- return KEEP;
- }
- size_t offset = parser.consumed();
-
- *output = input;
-
- // Increase the size of the extensions.
- uint16_t ext_len;
- memcpy(&ext_len, output->data() + offset, sizeof(ext_len));
- ext_len = htons(ntohs(ext_len) + data_.len() + 4);
- memcpy(output->data() + offset, &ext_len, sizeof(ext_len));
-
- // Insert the extension type and length.
- DataBuffer type_length;
- type_length.Allocate(4);
- type_length.Write(0, extension_, 2);
- type_length.Write(2, data_.len(), 2);
- output->Splice(type_length, offset + 2);
-
- // Insert the payload.
- if (data_.len() > 0) {
- output->Splice(data_, offset + 6);
- }
-
- return CHANGE;
-}
-
PacketFilter::Action AfterRecordN::FilterRecord(const TlsRecordHeader& header,
const DataBuffer& body,
DataBuffer* out) {
@@ -775,8 +628,10 @@ PacketFilter::Action AfterRecordN::FilterRecord(const TlsRecordHeader& header,
PacketFilter::Action TlsInspectorClientHelloVersionChanger::FilterHandshake(
const HandshakeHeader& header, const DataBuffer& input,
DataBuffer* output) {
- EXPECT_EQ(SECSuccess,
- SSLInt_IncrementClientHandshakeVersion(server_.lock()->ssl_fd()));
+ if (header.handshake_type() == kTlsHandshakeClientKeyExchange) {
+ EXPECT_EQ(SECSuccess,
+ SSLInt_IncrementClientHandshakeVersion(server_.lock()->ssl_fd()));
+ }
return KEEP;
}
@@ -788,49 +643,15 @@ PacketFilter::Action SelectiveDropFilter::Filter(const DataBuffer& input,
return ((1 << counter_++) & pattern_) ? DROP : KEEP;
}
-PacketFilter::Action SelectiveRecordDropFilter::FilterRecord(
- const TlsRecordHeader& header, const DataBuffer& data,
- DataBuffer* changed) {
- if (counter_ >= 32) {
- return KEEP;
- }
- return ((1 << counter_++) & pattern_) ? DROP : KEEP;
-}
-
-/* static */ uint32_t SelectiveRecordDropFilter::ToPattern(
- std::initializer_list<size_t> records) {
- uint32_t pattern = 0;
- for (auto it = records.begin(); it != records.end(); ++it) {
- EXPECT_GT(32U, *it);
- assert(*it < 32U);
- pattern |= 1 << *it;
- }
- return pattern;
-}
-
PacketFilter::Action TlsInspectorClientHelloVersionSetter::FilterHandshake(
const HandshakeHeader& header, const DataBuffer& input,
DataBuffer* output) {
- *output = input;
- output->Write(0, version_, 2);
- return CHANGE;
-}
-
-PacketFilter::Action SelectedCipherSuiteReplacer::FilterHandshake(
- const HandshakeHeader& header, const DataBuffer& input,
- DataBuffer* output) {
- *output = input;
- uint32_t temp = 0;
- EXPECT_TRUE(input.Read(0, 2, &temp));
- // Cipher suite is after version(2) and random(32).
- size_t pos = 34;
- if (temp < SSL_LIBRARY_VERSION_TLS_1_3) {
- // In old versions, we have to skip a session_id too.
- EXPECT_TRUE(input.Read(pos, 1, &temp));
- pos += 1 + temp;
- }
- output->Write(pos, static_cast<uint32_t>(cipher_suite_), 2);
- return CHANGE;
+ if (header.handshake_type() == kTlsHandshakeClientHello) {
+ *output = input;
+ output->Write(0, version_, 2);
+ return CHANGE;
+ }
+ return KEEP;
}
} // namespace nss_test
diff --git a/security/nss/gtests/ssl_gtest/tls_filter.h b/security/nss/gtests/ssl_gtest/tls_filter.h
index 1db3b90f69..e4030e23f5 100644
--- a/security/nss/gtests/ssl_gtest/tls_filter.h
+++ b/security/nss/gtests/ssl_gtest/tls_filter.h
@@ -50,13 +50,10 @@ class TlsRecordHeader : public TlsVersioned {
uint8_t content_type() const { return content_type_; }
uint64_t sequence_number() const { return sequence_number_; }
- uint16_t epoch() const {
- return static_cast<uint16_t>(sequence_number_ >> 48);
- }
- size_t header_length() const { return is_dtls() ? 13 : 5; }
+ size_t header_length() const { return is_dtls() ? 11 : 3; }
// Parse the header; return true if successful; body in an outparam if OK.
- bool Parse(uint64_t sequence_number, TlsParser* parser, DataBuffer* body);
+ bool Parse(TlsParser* parser, DataBuffer* body);
// Write the header and body to a buffer at the given offset.
// Return the offset of the end of the write.
size_t Write(DataBuffer* buffer, size_t offset, const DataBuffer& body) const;
@@ -66,21 +63,10 @@ class TlsRecordHeader : public TlsVersioned {
uint64_t sequence_number_;
};
-struct TlsRecord {
- const TlsRecordHeader header;
- const DataBuffer buffer;
-};
-
// Abstract filter that operates on entire (D)TLS records.
class TlsRecordFilter : public PacketFilter {
public:
- TlsRecordFilter()
- : agent_(nullptr),
- count_(0),
- cipher_spec_(),
- dropped_record_(false),
- in_sequence_number_(0),
- out_sequence_number_(0) {}
+ TlsRecordFilter() : agent_(nullptr), count_(0), cipher_spec_() {}
void SetAgent(const TlsAgent* agent) { agent_ = agent; }
const TlsAgent* agent() const { return agent_; }
@@ -129,21 +115,14 @@ class TlsRecordFilter : public PacketFilter {
const TlsAgent* agent_;
size_t count_;
std::unique_ptr<TlsCipherSpec> cipher_spec_;
- // Whether we dropped a record since the cipher spec changed.
- bool dropped_record_;
- // The sequence number we use for reading records as they are written.
- uint64_t in_sequence_number_;
- // The sequence number we use for writing modified records.
- uint64_t out_sequence_number_;
};
-inline std::ostream& operator<<(std::ostream& stream, const TlsVersioned& v) {
+inline std::ostream& operator<<(std::ostream& stream, TlsVersioned v) {
v.WriteStream(stream);
return stream;
}
-inline std::ostream& operator<<(std::ostream& stream,
- const TlsRecordHeader& hdr) {
+inline std::ostream& operator<<(std::ostream& stream, TlsRecordHeader& hdr) {
hdr.WriteStream(stream);
stream << ' ';
switch (hdr.content_type()) {
@@ -154,17 +133,13 @@ inline std::ostream& operator<<(std::ostream& stream,
stream << "Alert";
break;
case kTlsHandshakeType:
- case kTlsAltHandshakeType:
stream << "Handshake";
break;
case kTlsApplicationDataType:
stream << "Data";
break;
- case kTlsAckType:
- stream << "ACK";
- break;
default:
- stream << '<' << static_cast<int>(hdr.content_type()) << '>';
+ stream << '<' << hdr.content_type() << '>';
break;
}
return stream << ' ' << std::hex << hdr.sequence_number() << std::dec;
@@ -175,16 +150,7 @@ inline std::ostream& operator<<(std::ostream& stream,
// records and that they don't span records or anything crazy like that.
class TlsHandshakeFilter : public TlsRecordFilter {
public:
- TlsHandshakeFilter() : handshake_types_(), preceding_fragment_() {}
- TlsHandshakeFilter(const std::set<uint8_t>& types)
- : handshake_types_(types), preceding_fragment_() {}
-
- // This filter can be set to be selective based on handshake message type. If
- // this function isn't used (or the set is empty), then all handshake messages
- // will be filtered.
- void SetHandshakeTypes(const std::set<uint8_t>& types) {
- handshake_types_ = types;
- }
+ TlsHandshakeFilter() {}
class HandshakeHeader : public TlsVersioned {
public:
@@ -192,8 +158,7 @@ class TlsHandshakeFilter : public TlsRecordFilter {
uint8_t handshake_type() const { return handshake_type_; }
bool Parse(TlsParser* parser, const TlsRecordHeader& record_header,
- const DataBuffer& preceding_fragment, DataBuffer* body,
- bool* complete);
+ DataBuffer* body);
size_t Write(DataBuffer* buffer, size_t offset,
const DataBuffer& body) const;
size_t WriteFragment(DataBuffer* buffer, size_t offset,
@@ -204,8 +169,7 @@ class TlsHandshakeFilter : public TlsRecordFilter {
// Reads the length from the record header.
// This also reads the DTLS fragment information and checks it.
bool ReadLength(TlsParser* parser, const TlsRecordHeader& header,
- uint32_t expected_offset, uint32_t* length,
- bool* last_fragment);
+ uint32_t* length);
uint8_t handshake_type_;
uint16_t message_seq_;
@@ -221,30 +185,22 @@ class TlsHandshakeFilter : public TlsRecordFilter {
DataBuffer* output) = 0;
private:
- bool IsFilteredType(const HandshakeHeader& header,
- const DataBuffer& handshake);
-
- std::set<uint8_t> handshake_types_;
- DataBuffer preceding_fragment_;
};
// Make a copy of the first instance of a handshake message.
class TlsInspectorRecordHandshakeMessage : public TlsHandshakeFilter {
public:
TlsInspectorRecordHandshakeMessage(uint8_t handshake_type)
- : TlsHandshakeFilter({handshake_type}), buffer_() {}
- TlsInspectorRecordHandshakeMessage(const std::set<uint8_t>& handshake_types)
- : TlsHandshakeFilter(handshake_types), buffer_() {}
+ : handshake_type_(handshake_type), buffer_() {}
virtual PacketFilter::Action FilterHandshake(const HandshakeHeader& header,
const DataBuffer& input,
DataBuffer* output);
- void Reset() { buffer_.Truncate(0); }
-
const DataBuffer& buffer() const { return buffer_; }
private:
+ uint8_t handshake_type_;
DataBuffer buffer_;
};
@@ -253,39 +209,17 @@ class TlsInspectorReplaceHandshakeMessage : public TlsHandshakeFilter {
public:
TlsInspectorReplaceHandshakeMessage(uint8_t handshake_type,
const DataBuffer& replacement)
- : TlsHandshakeFilter({handshake_type}), buffer_(replacement) {}
+ : handshake_type_(handshake_type), buffer_(replacement) {}
virtual PacketFilter::Action FilterHandshake(const HandshakeHeader& header,
const DataBuffer& input,
DataBuffer* output);
private:
+ uint8_t handshake_type_;
DataBuffer buffer_;
};
-// Make a copy of each record of a given type.
-class TlsRecordRecorder : public TlsRecordFilter {
- public:
- TlsRecordRecorder(uint8_t ct) : filter_(true), ct_(ct), records_() {}
- TlsRecordRecorder()
- : filter_(false),
- ct_(content_handshake), // dummy (<optional> is C++14)
- records_() {}
- virtual PacketFilter::Action FilterRecord(const TlsRecordHeader& header,
- const DataBuffer& input,
- DataBuffer* output);
-
- size_t count() const { return records_.size(); }
- void Clear() { records_.clear(); }
-
- const TlsRecord& record(size_t i) const { return records_[i]; }
-
- private:
- bool filter_;
- uint8_t ct_;
- std::vector<TlsRecord> records_;
-};
-
// Make a copy of the complete conversation.
class TlsConversationRecorder : public TlsRecordFilter {
public:
@@ -296,31 +230,15 @@ class TlsConversationRecorder : public TlsRecordFilter {
DataBuffer* output);
private:
- DataBuffer buffer_;
+ DataBuffer& buffer_;
};
-// Make a copy of the records
-class TlsHeaderRecorder : public TlsRecordFilter {
- public:
- virtual PacketFilter::Action FilterRecord(const TlsRecordHeader& header,
- const DataBuffer& input,
- DataBuffer* output);
- const TlsRecordHeader* header(size_t index);
-
- private:
- std::vector<TlsRecordHeader> headers_;
-};
-
-typedef std::initializer_list<std::shared_ptr<PacketFilter>>
- ChainedPacketFilterInit;
-
// Runs multiple packet filters in series.
class ChainedPacketFilter : public PacketFilter {
public:
ChainedPacketFilter() {}
ChainedPacketFilter(const std::vector<std::shared_ptr<PacketFilter>> filters)
: filters_(filters.begin(), filters.end()) {}
- ChainedPacketFilter(ChainedPacketFilterInit il) : filters_(il) {}
virtual ~ChainedPacketFilter() {}
virtual PacketFilter::Action Filter(const DataBuffer& input,
@@ -338,13 +256,13 @@ typedef std::function<bool(TlsParser* parser, const TlsVersioned& header)>
class TlsExtensionFilter : public TlsHandshakeFilter {
public:
- TlsExtensionFilter()
- : TlsHandshakeFilter({kTlsHandshakeClientHello, kTlsHandshakeServerHello,
- kTlsHandshakeHelloRetryRequest,
- kTlsHandshakeEncryptedExtensions}) {}
+ TlsExtensionFilter() : handshake_types_() {
+ handshake_types_.insert(kTlsHandshakeClientHello);
+ handshake_types_.insert(kTlsHandshakeServerHello);
+ }
TlsExtensionFilter(const std::set<uint8_t>& types)
- : TlsHandshakeFilter(types) {}
+ : handshake_types_(types) {}
static bool FindExtensions(TlsParser* parser, const HandshakeHeader& header);
@@ -361,6 +279,8 @@ class TlsExtensionFilter : public TlsHandshakeFilter {
PacketFilter::Action FilterExtensions(TlsParser* parser,
const DataBuffer& input,
DataBuffer* output);
+
+ std::set<uint8_t> handshake_types_;
};
class TlsExtensionCapture : public TlsExtensionFilter {
@@ -406,21 +326,6 @@ class TlsExtensionDropper : public TlsExtensionFilter {
uint16_t extension_;
};
-class TlsExtensionInjector : public TlsHandshakeFilter {
- public:
- TlsExtensionInjector(uint16_t ext, const DataBuffer& data)
- : extension_(ext), data_(data) {}
-
- protected:
- PacketFilter::Action FilterHandshake(const HandshakeHeader& header,
- const DataBuffer& input,
- DataBuffer* output) override;
-
- private:
- const uint16_t extension_;
- const DataBuffer data_;
-};
-
class TlsAgent;
typedef std::function<void(void)> VoidFunction;
@@ -447,7 +352,7 @@ class AfterRecordN : public TlsRecordFilter {
class TlsInspectorClientHelloVersionChanger : public TlsHandshakeFilter {
public:
TlsInspectorClientHelloVersionChanger(std::shared_ptr<TlsAgent>& server)
- : TlsHandshakeFilter({kTlsHandshakeClientKeyExchange}), server_(server) {}
+ : server_(server) {}
virtual PacketFilter::Action FilterHandshake(const HandshakeHeader& header,
const DataBuffer& input,
@@ -472,47 +377,10 @@ class SelectiveDropFilter : public PacketFilter {
uint8_t counter_;
};
-// This class selectively drops complete records. The difference from
-// SelectiveDropFilter is that if multiple DTLS records are in the same
-// datagram, we just drop one.
-class SelectiveRecordDropFilter : public TlsRecordFilter {
- public:
- SelectiveRecordDropFilter(uint32_t pattern, bool enabled = true)
- : pattern_(pattern), counter_(0) {
- if (!enabled) {
- Disable();
- }
- }
- SelectiveRecordDropFilter(std::initializer_list<size_t> records)
- : SelectiveRecordDropFilter(ToPattern(records), true) {}
-
- void Reset(uint32_t pattern) {
- counter_ = 0;
- PacketFilter::Enable();
- pattern_ = pattern;
- }
-
- void Reset(std::initializer_list<size_t> records) {
- Reset(ToPattern(records));
- }
-
- protected:
- PacketFilter::Action FilterRecord(const TlsRecordHeader& header,
- const DataBuffer& data,
- DataBuffer* changed) override;
-
- private:
- static uint32_t ToPattern(std::initializer_list<size_t> records);
-
- uint32_t pattern_;
- uint8_t counter_;
-};
-
// Set the version number in the ClientHello.
class TlsInspectorClientHelloVersionSetter : public TlsHandshakeFilter {
public:
- TlsInspectorClientHelloVersionSetter(uint16_t version)
- : TlsHandshakeFilter({kTlsHandshakeClientHello}), version_(version) {}
+ TlsInspectorClientHelloVersionSetter(uint16_t version) : version_(version) {}
virtual PacketFilter::Action FilterHandshake(const HandshakeHeader& header,
const DataBuffer& input,
@@ -543,20 +411,6 @@ class TlsLastByteDamager : public TlsHandshakeFilter {
uint8_t type_;
};
-class SelectedCipherSuiteReplacer : public TlsHandshakeFilter {
- public:
- SelectedCipherSuiteReplacer(uint16_t suite)
- : TlsHandshakeFilter({kTlsHandshakeServerHello}), cipher_suite_(suite) {}
-
- protected:
- PacketFilter::Action FilterHandshake(const HandshakeHeader& header,
- const DataBuffer& input,
- DataBuffer* output) override;
-
- private:
- uint16_t cipher_suite_;
-};
-
} // namespace nss_test
#endif
diff --git a/security/nss/gtests/ssl_gtest/tls_hkdf_unittest.cc b/security/nss/gtests/ssl_gtest/tls_hkdf_unittest.cc
index 45f6cf2bd9..51ff938b14 100644
--- a/security/nss/gtests/ssl_gtest/tls_hkdf_unittest.cc
+++ b/security/nss/gtests/ssl_gtest/tls_hkdf_unittest.cc
@@ -241,13 +241,13 @@ TEST_P(TlsHkdfTest, HkdfExpandLabel) {
{/* ssl_hash_md5 */},
{/* ssl_hash_sha1 */},
{/* ssl_hash_sha224 */},
- {0xc6, 0xdd, 0x6e, 0xc4, 0x76, 0xb8, 0x55, 0xf2, 0xa4, 0xfc, 0x59,
- 0x04, 0xa4, 0x90, 0xdc, 0xa7, 0xa7, 0x0d, 0x94, 0x8f, 0xc2, 0xdc,
- 0x15, 0x6d, 0x48, 0x93, 0x9d, 0x05, 0xbb, 0x9a, 0xbc, 0xc1},
- {0x41, 0xea, 0x77, 0x09, 0x8c, 0x90, 0x04, 0x10, 0xec, 0xbc, 0x37, 0xd8,
- 0x5b, 0x54, 0xcd, 0x7b, 0x08, 0x15, 0x13, 0x20, 0xed, 0x1e, 0x3f, 0x54,
- 0x74, 0xf7, 0x8b, 0x06, 0x38, 0x28, 0x06, 0x37, 0x75, 0x23, 0xa2, 0xb7,
- 0x34, 0xb1, 0x72, 0x2e, 0x59, 0x6d, 0x5a, 0x31, 0xf5, 0x53, 0xab, 0x99}};
+ {0x34, 0x7c, 0x67, 0x80, 0xff, 0x0b, 0xba, 0xd7, 0x1c, 0x28, 0x3b,
+ 0x16, 0xeb, 0x2f, 0x9c, 0xf6, 0x2d, 0x24, 0xe6, 0xcd, 0xb6, 0x13,
+ 0xd5, 0x17, 0x76, 0x54, 0x8c, 0xb0, 0x7d, 0xcd, 0xe7, 0x4c},
+ {0x4b, 0x1e, 0x5e, 0xc1, 0x49, 0x30, 0x78, 0xea, 0x35, 0xbd, 0x3f, 0x01,
+ 0x04, 0xe6, 0x1a, 0xea, 0x14, 0xcc, 0x18, 0x2a, 0xd1, 0xc4, 0x76, 0x21,
+ 0xc4, 0x64, 0xc0, 0x4e, 0x4b, 0x36, 0x16, 0x05, 0x6f, 0x04, 0xab, 0xe9,
+ 0x43, 0xb1, 0x2d, 0xa8, 0xa7, 0x17, 0x9a, 0x5f, 0x09, 0x91, 0x7d, 0x1f}};
const DataBuffer expected_data(tv[hash_type_], kHashLength[hash_type_]);
HkdfExpandLabel(&k1_, hash_type_, kSessionHash, kHashLength[hash_type_],
diff --git a/security/nss/gtests/ssl_gtest/tls_protect.cc b/security/nss/gtests/ssl_gtest/tls_protect.cc
index 6c945f66eb..efcd89e145 100644
--- a/security/nss/gtests/ssl_gtest/tls_protect.cc
+++ b/security/nss/gtests/ssl_gtest/tls_protect.cc
@@ -32,6 +32,7 @@ void AeadCipher::FormatNonce(uint64_t seq, uint8_t *nonce) {
}
DataBuffer d(nonce, 12);
+ std::cerr << "Nonce " << d << std::endl;
}
bool AeadCipher::AeadInner(bool decrypt, void *params, size_t param_length,
@@ -91,9 +92,8 @@ bool AeadCipherChacha20Poly1305::Aead(bool decrypt, uint64_t seq,
in, inlen, out, outlen, maxlen);
}
-bool TlsCipherSpec::Init(uint16_t epoch, SSLCipherAlgorithm cipher,
- PK11SymKey *key, const uint8_t *iv) {
- epoch_ = epoch;
+bool TlsCipherSpec::Init(SSLCipherAlgorithm cipher, PK11SymKey *key,
+ const uint8_t *iv) {
switch (cipher) {
case ssl_calg_aes_gcm:
aead_.reset(new AeadCipherAesGcm());
diff --git a/security/nss/gtests/ssl_gtest/tls_protect.h b/security/nss/gtests/ssl_gtest/tls_protect.h
index 93ffd63227..4efbd6e6bb 100644
--- a/security/nss/gtests/ssl_gtest/tls_protect.h
+++ b/security/nss/gtests/ssl_gtest/tls_protect.h
@@ -20,7 +20,7 @@ class TlsRecordHeader;
class AeadCipher {
public:
AeadCipher(CK_MECHANISM_TYPE mech) : mech_(mech), key_(nullptr) {}
- virtual ~AeadCipher();
+ ~AeadCipher();
bool Init(PK11SymKey *key, const uint8_t *iv);
virtual bool Aead(bool decrypt, uint64_t seq, const uint8_t *in, size_t inlen,
@@ -58,19 +58,16 @@ class AeadCipherAesGcm : public AeadCipher {
// Our analog of ssl3CipherSpec
class TlsCipherSpec {
public:
- TlsCipherSpec() : epoch_(0), aead_() {}
+ TlsCipherSpec() : aead_() {}
- bool Init(uint16_t epoch, SSLCipherAlgorithm cipher, PK11SymKey *key,
- const uint8_t *iv);
+ bool Init(SSLCipherAlgorithm cipher, PK11SymKey *key, const uint8_t *iv);
bool Protect(const TlsRecordHeader &header, const DataBuffer &plaintext,
DataBuffer *ciphertext);
bool Unprotect(const TlsRecordHeader &header, const DataBuffer &ciphertext,
DataBuffer *plaintext);
- uint16_t epoch() const { return epoch_; }
private:
- uint16_t epoch_;
std::unique_ptr<AeadCipher> aead_;
};
diff --git a/security/nss/gtests/util_gtest/manifest.mn b/security/nss/gtests/util_gtest/manifest.mn
index a90e8431ef..edede657f8 100644
--- a/security/nss/gtests/util_gtest/manifest.mn
+++ b/security/nss/gtests/util_gtest/manifest.mn
@@ -10,8 +10,6 @@ CPPSRCS = \
util_utf8_unittest.cc \
util_b64_unittest.cc \
util_pkcs11uri_unittest.cc \
- util_aligned_malloc_unittest.cc \
- util_memcmpzero_unittest.cc \
$(NULL)
INCLUDES += \
diff --git a/security/nss/gtests/util_gtest/util_aligned_malloc_unittest.cc b/security/nss/gtests/util_gtest/util_aligned_malloc_unittest.cc
deleted file mode 100644
index 9745ca7d3e..0000000000
--- a/security/nss/gtests/util_gtest/util_aligned_malloc_unittest.cc
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "gtest/gtest.h"
-#include "scoped_ptrs_util.h"
-
-namespace nss_test {
-
-struct SomeContext {
- uint8_t some_buf[13];
- void *mem;
-};
-
-template <class T>
-struct ScopedDelete {
- void operator()(T *ptr) {
- if (ptr) {
- PORT_Free(ptr->mem);
- }
- }
-};
-typedef std::unique_ptr<SomeContext, ScopedDelete<SomeContext> >
- ScopedSomeContext;
-
-class AlignedMallocTest : public ::testing::Test,
- public ::testing::WithParamInterface<size_t> {
- protected:
- ScopedSomeContext test_align_new(size_t alignment) {
- ScopedSomeContext ctx(PORT_ZNewAligned(SomeContext, alignment, mem));
- return ctx;
- };
- ScopedSomeContext test_align_alloc(size_t alignment) {
- void *mem = nullptr;
- ScopedSomeContext ctx((SomeContext *)PORT_ZAllocAligned(sizeof(SomeContext),
- alignment, &mem));
- if (ctx) {
- ctx->mem = mem;
- }
- return ctx;
- }
-};
-
-TEST_P(AlignedMallocTest, TestNew) {
- size_t alignment = GetParam();
- ScopedSomeContext ctx = test_align_new(alignment);
- EXPECT_TRUE(ctx.get());
- EXPECT_EQ(0U, (uintptr_t)ctx.get() % alignment);
-}
-
-TEST_P(AlignedMallocTest, TestAlloc) {
- size_t alignment = GetParam();
- ScopedSomeContext ctx = test_align_alloc(alignment);
- EXPECT_TRUE(ctx.get());
- EXPECT_EQ(0U, (uintptr_t)ctx.get() % alignment);
-}
-
-class AlignedMallocTestBadSize : public AlignedMallocTest {};
-
-TEST_P(AlignedMallocTestBadSize, TestNew) {
- size_t alignment = GetParam();
- ScopedSomeContext ctx = test_align_new(alignment);
- EXPECT_FALSE(ctx.get());
-}
-
-TEST_P(AlignedMallocTestBadSize, TestAlloc) {
- size_t alignment = GetParam();
- ScopedSomeContext ctx = test_align_alloc(alignment);
- EXPECT_FALSE(ctx.get());
-}
-
-static const size_t kSizes[] = {1, 2, 4, 8, 16, 32, 64};
-static const size_t kBadSizes[] = {0, 7, 17, 24, 56};
-
-INSTANTIATE_TEST_CASE_P(AllAligned, AlignedMallocTest,
- ::testing::ValuesIn(kSizes));
-INSTANTIATE_TEST_CASE_P(AllAlignedBadSize, AlignedMallocTestBadSize,
- ::testing::ValuesIn(kBadSizes));
-
-} // namespace nss_test
diff --git a/security/nss/gtests/util_gtest/util_gtest.gyp b/security/nss/gtests/util_gtest/util_gtest.gyp
index 1c54329b2d..7abd71b2f6 100644
--- a/security/nss/gtests/util_gtest/util_gtest.gyp
+++ b/security/nss/gtests/util_gtest/util_gtest.gyp
@@ -14,8 +14,6 @@
'util_utf8_unittest.cc',
'util_b64_unittest.cc',
'util_pkcs11uri_unittest.cc',
- 'util_aligned_malloc_unittest.cc',
- 'util_memcmpzero_unittest.cc',
'<(DEPTH)/gtests/common/gtests.cc',
],
'dependencies': [
diff --git a/security/nss/gtests/util_gtest/util_memcmpzero_unittest.cc b/security/nss/gtests/util_gtest/util_memcmpzero_unittest.cc
deleted file mode 100644
index 29cac3f67b..0000000000
--- a/security/nss/gtests/util_gtest/util_memcmpzero_unittest.cc
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this file,
- * You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "gtest/gtest.h"
-#include "scoped_ptrs_util.h"
-
-namespace nss_test {
-
-class MemcmpZeroTest : public ::testing::Test {
- protected:
- unsigned int test_memcmp_zero(const std::vector<uint8_t> &mem) {
- return NSS_SecureMemcmpZero(mem.data(), mem.size());
- };
-};
-
-TEST_F(MemcmpZeroTest, TestMemcmpZeroTrue) {
- unsigned int rv = test_memcmp_zero(std::vector<uint8_t>(37, 0));
- EXPECT_EQ(0U, rv);
-}
-
-TEST_F(MemcmpZeroTest, TestMemcmpZeroFalse5) {
- std::vector<uint8_t> vec(37, 0);
- vec[5] = 1;
- unsigned int rv = test_memcmp_zero(vec);
- EXPECT_NE(0U, rv);
-}
-
-TEST_F(MemcmpZeroTest, TestMemcmpZeroFalse37) {
- std::vector<uint8_t> vec(37, 0);
- vec[vec.size() - 1] = 0xFF;
- unsigned int rv = test_memcmp_zero(vec);
- EXPECT_NE(0U, rv);
-}
-
-TEST_F(MemcmpZeroTest, TestMemcmpZeroFalse0) {
- std::vector<uint8_t> vec(37, 0);
- vec[0] = 1;
- unsigned int rv = test_memcmp_zero(vec);
- EXPECT_NE(0U, rv);
-}
-
-} // namespace nss_test
diff --git a/security/nss/help.txt b/security/nss/help.txt
deleted file mode 100644
index 03ed36e6c8..0000000000
--- a/security/nss/help.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-Usage: build.sh [-hcv] [-cc] [-j <n>] [--nspr] [--gyp|-g] [--opt|-o] [-m32]
- [--test] [--pprof] [--scan-build[=output]] [--ct-verif]
- [--asan] [--ubsan] [--msan] [--sancov[=edge|bb|func|...]]
- [--disable-tests] [--fuzz[=tls|oss]] [--system-sqlite]
- [--no-zdefs] [--with-nspr] [--system-nspr] [--enable-libpkix]
- [--enable-fips]
-
-This script builds NSS with gyp and ninja.
-
-This build system is still under development. It does not yet support all
-the features or platforms that NSS supports.
-
-NSS build tool options:
-
- -h display this help and exit
- -c clean before build
- -cc clean without building
- -v verbose build
- -j <n> run at most <n> concurrent jobs
- --nspr force a rebuild of NSPR
- --gyp|-g force a rerun of gyp
- --opt|-o do an opt build
- -m32 do a 32-bit build on a 64-bit system
- --clang build with clang and clang++
- --gcc build with gcc and g++
- --test ignore map files and export everything we have
- --fuzz build fuzzing targets (this always enables test builds)
- --fuzz=tls to enable TLS fuzzing mode
- --fuzz=oss to build for OSS-Fuzz
- --pprof build with gperftool support
- --ct-verif build with valgrind for ct-verif
- --scan-build run the build with scan-build (scan-build has to be in the path)
- --scan-build=/out/path sets the output path for scan-build
- --asan do an asan build
- --ubsan do an ubsan build
- --ubsan=bool,shift,... sets specific UB sanitizers
- --msan do an msan build
- --sancov do sanitize coverage builds
- --sancov=func sets coverage to function level for example
- --disable-tests don't build tests and corresponding cmdline utils
- --system-sqlite use system sqlite
- --no-zdefs don't set -Wl,-z,defs
- --with-nspr don't build NSPR but use the one at the given location, e.g.
- --with-nspr=/path/to/nspr/include:/path/to/nspr/lib
- --system-nspr use system nspr. This requires an installation of NSPR and
- might not work on all systems.
- --enable-libpkix make libpkix part of the build.
- --enable-fips don't disable FIPS checks.
diff --git a/security/nss/lib/certdb/alg1485.c b/security/nss/lib/certdb/alg1485.c
index 9a69c5bc51..38b2fe4b51 100644
--- a/security/nss/lib/certdb/alg1485.c
+++ b/security/nss/lib/certdb/alg1485.c
@@ -703,19 +703,14 @@ CERT_GetOidString(const SECItem* oid)
return NULL;
}
- /* If the OID has length 1, we bail. */
- if (oid->len < 2) {
- return NULL;
- }
-
/* first will point to the next sequence of bytes to decode */
first = (PRUint8*)oid->data;
/* stop points to one past the legitimate data */
stop = &first[oid->len];
/*
- * Check for our pseudo-encoded single-digit OIDs
- */
+ * Check for our pseudo-encoded single-digit OIDs
+ */
if ((*first == 0x80) && (2 == oid->len)) {
/* Funky encoding. The second byte is the number */
rvString = PR_smprintf("%lu", (PRUint32)first[1]);
@@ -733,10 +728,6 @@ CERT_GetOidString(const SECItem* oid)
break;
}
}
- /* There's no first bit set, so this isn't valid. Bail.*/
- if (last == stop) {
- goto unsupported;
- }
bytesBeforeLast = (unsigned int)(last - first);
if (bytesBeforeLast <= 3U) { /* 0-28 bit number */
PRUint32 n = 0;
@@ -757,12 +748,12 @@ CERT_GetOidString(const SECItem* oid)
CASE(2, 0x7f);
CASE(1, 0x7f);
case 0:
- n |= last[0] & 0x7f;
+ n |=
+ last[0] & 0x7f;
break;
}
- if (last[0] & 0x80) {
+ if (last[0] & 0x80)
goto unsupported;
- }
if (!rvString) {
/* This is the first number.. decompose it */
@@ -1314,7 +1305,8 @@ CERT_GetCertificateEmailAddress(CERTCertificate* cert)
}
} else if (current->type == certRFC822Name) {
rawEmailAddr =
- (char*)PORT_ArenaZAlloc(cert->arena, current->name.other.len + 1);
+ (char*)PORT_ArenaZAlloc(cert->arena, current->name.other.len +
+ 1);
if (!rawEmailAddr) {
goto finish;
}
diff --git a/security/nss/lib/certdb/cert.h b/security/nss/lib/certdb/cert.h
index c76a5a9b03..4224da1080 100644
--- a/security/nss/lib/certdb/cert.h
+++ b/security/nss/lib/certdb/cert.h
@@ -504,8 +504,6 @@ extern CERTCertificate *CERT_FindCertByKeyID(CERTCertDBHandle *handle,
*/
extern CERTCertificate *CERT_FindCertByIssuerAndSN(
CERTCertDBHandle *handle, CERTIssuerAndSN *issuerAndSN);
-extern CERTCertificate *CERT_FindCertByIssuerAndSNCX(
- CERTCertDBHandle *handle, CERTIssuerAndSN *issuerAndSN, void *wincx);
/*
** Find a certificate in the database by a subject key ID
@@ -549,9 +547,6 @@ CERTCertificate *CERT_FindCertByEmailAddr(CERTCertDBHandle *handle,
*/
CERTCertificate *CERT_FindCertByNicknameOrEmailAddr(CERTCertDBHandle *handle,
const char *name);
-CERTCertificate *CERT_FindCertByNicknameOrEmailAddrCX(CERTCertDBHandle *handle,
- const char *name,
- void *wincx);
/*
** Find a certificate in the database by a email address or nickname
@@ -560,9 +555,6 @@ CERTCertificate *CERT_FindCertByNicknameOrEmailAddrCX(CERTCertDBHandle *handle,
*/
CERTCertificate *CERT_FindCertByNicknameOrEmailAddrForUsage(
CERTCertDBHandle *handle, const char *name, SECCertUsage lookingForUsage);
-CERTCertificate *CERT_FindCertByNicknameOrEmailAddrForUsageCX(
- CERTCertDBHandle *handle, const char *name, SECCertUsage lookingForUsage,
- void *wincx);
/*
** Find a certificate in the database by a digest of a subject public key
diff --git a/security/nss/lib/certdb/certdb.c b/security/nss/lib/certdb/certdb.c
index 1a676a7207..7864edc08e 100644
--- a/security/nss/lib/certdb/certdb.c
+++ b/security/nss/lib/certdb/certdb.c
@@ -1192,7 +1192,6 @@ CERT_CheckKeyUsage(CERTCertificate *cert, unsigned int requiredUsage)
case rsaKey:
requiredUsage |= KU_KEY_ENCIPHERMENT;
break;
- case rsaPssKey:
case dsaKey:
requiredUsage |= KU_DIGITAL_SIGNATURE;
break;
diff --git a/security/nss/lib/certdb/crl.c b/security/nss/lib/certdb/crl.c
index d1c48dfba6..87469085e7 100644
--- a/security/nss/lib/certdb/crl.c
+++ b/security/nss/lib/certdb/crl.c
@@ -1294,7 +1294,8 @@ DPCache_AddCRL(CRLDPCache* cache, CachedCrl* newcrl, PRBool* added)
}
}
- newcrls = (CachedCrl**)PORT_Realloc(cache->crls, (cache->ncrls + 1) * sizeof(CachedCrl*));
+ newcrls = (CachedCrl**)PORT_Realloc(cache->crls, (cache->ncrls + 1) *
+ sizeof(CachedCrl*));
if (!newcrls) {
return SECFailure;
}
diff --git a/security/nss/lib/certdb/stanpcertdb.c b/security/nss/lib/certdb/stanpcertdb.c
index beaa660406..4d42bd50d8 100644
--- a/security/nss/lib/certdb/stanpcertdb.c
+++ b/security/nss/lib/certdb/stanpcertdb.c
@@ -457,15 +457,15 @@ __CERT_NewTempCertificate(CERTCertDBHandle *handle, SECItem *derCert,
return CERT_NewTempCertificate(handle, derCert, nickname, isperm, copyDER);
}
-static CERTCertificate *
-common_FindCertByIssuerAndSN(CERTCertDBHandle *handle,
- CERTIssuerAndSN *issuerAndSN,
- void *wincx)
+/* maybe all the wincx's should be some const for internal token login? */
+CERTCertificate *
+CERT_FindCertByIssuerAndSN(CERTCertDBHandle *handle,
+ CERTIssuerAndSN *issuerAndSN)
{
PK11SlotInfo *slot;
CERTCertificate *cert;
- cert = PK11_FindCertByIssuerAndSN(&slot, issuerAndSN, wincx);
+ cert = PK11_FindCertByIssuerAndSN(&slot, issuerAndSN, NULL);
if (cert && slot) {
PK11_FreeSlot(slot);
}
@@ -473,23 +473,6 @@ common_FindCertByIssuerAndSN(CERTCertDBHandle *handle,
return cert;
}
-/* maybe all the wincx's should be some const for internal token login? */
-CERTCertificate *
-CERT_FindCertByIssuerAndSN(CERTCertDBHandle *handle,
- CERTIssuerAndSN *issuerAndSN)
-{
- return common_FindCertByIssuerAndSN(handle, issuerAndSN, NULL);
-}
-
-/* maybe all the wincx's should be some const for internal token login? */
-CERTCertificate *
-CERT_FindCertByIssuerAndSNCX(CERTCertDBHandle *handle,
- CERTIssuerAndSN *issuerAndSN,
- void *wincx)
-{
- return common_FindCertByIssuerAndSN(handle, issuerAndSN, wincx);
-}
-
static NSSCertificate *
get_best_temp_or_perm(NSSCertificate *ct, NSSCertificate *cp)
{
@@ -604,8 +587,7 @@ CERT_FindCertByDERCert(CERTCertDBHandle *handle, SECItem *derCert)
static CERTCertificate *
common_FindCertByNicknameOrEmailAddrForUsage(CERTCertDBHandle *handle,
const char *name, PRBool anyUsage,
- SECCertUsage lookingForUsage,
- void *wincx)
+ SECCertUsage lookingForUsage)
{
NSSCryptoContext *cc;
NSSCertificate *c, *ct;
@@ -638,7 +620,7 @@ common_FindCertByNicknameOrEmailAddrForUsage(CERTCertDBHandle *handle,
}
if (anyUsage) {
- cert = PK11_FindCertFromNickname(name, wincx);
+ cert = PK11_FindCertFromNickname(name, NULL);
} else {
if (ct) {
/* Does ct really have the required usage? */
@@ -650,7 +632,7 @@ common_FindCertByNicknameOrEmailAddrForUsage(CERTCertDBHandle *handle,
}
}
- certlist = PK11_FindCertsFromNickname(name, wincx);
+ certlist = PK11_FindCertsFromNickname(name, NULL);
if (certlist) {
SECStatus rv =
CERT_FilterCertListByUsage(certlist, lookingForUsage, PR_FALSE);
@@ -677,15 +659,7 @@ CERTCertificate *
CERT_FindCertByNicknameOrEmailAddr(CERTCertDBHandle *handle, const char *name)
{
return common_FindCertByNicknameOrEmailAddrForUsage(handle, name, PR_TRUE,
- 0, NULL);
-}
-
-CERTCertificate *
-CERT_FindCertByNicknameOrEmailAddrCX(CERTCertDBHandle *handle, const char *name,
- void *wincx)
-{
- return common_FindCertByNicknameOrEmailAddrForUsage(handle, name, PR_TRUE,
- 0, wincx);
+ 0);
}
CERTCertificate *
@@ -694,17 +668,7 @@ CERT_FindCertByNicknameOrEmailAddrForUsage(CERTCertDBHandle *handle,
SECCertUsage lookingForUsage)
{
return common_FindCertByNicknameOrEmailAddrForUsage(handle, name, PR_FALSE,
- lookingForUsage, NULL);
-}
-
-CERTCertificate *
-CERT_FindCertByNicknameOrEmailAddrForUsageCX(CERTCertDBHandle *handle,
- const char *name,
- SECCertUsage lookingForUsage,
- void *wincx)
-{
- return common_FindCertByNicknameOrEmailAddrForUsage(handle, name, PR_FALSE,
- lookingForUsage, wincx);
+ lookingForUsage);
}
static void
diff --git a/security/nss/lib/ckfw/builtins/certdata.txt b/security/nss/lib/ckfw/builtins/certdata.txt
index 5d2baf3a56..45b659b7aa 100644
--- a/security/nss/lib/ckfw/builtins/certdata.txt
+++ b/security/nss/lib/ckfw/builtins/certdata.txt
@@ -69,6 +69,34 @@ CKA_PRIVATE CK_BBOOL CK_FALSE
CKA_MODIFIABLE CK_BBOOL CK_FALSE
CKA_LABEL UTF8 "Mozilla Builtin Roots"
+# Distrust "Distrust a pb.com certificate that does not comply with the baseline requirements."
+# Issuer: OU=Equifax Secure Certificate Authority,O=Equifax,C=US
+# Serial Number: 1407252 (0x157914)
+# Subject: CN=*.pb.com,OU=Meters,O=Pitney Bowes,L=Danbury,ST=Connecticut,C=US
+# Not Valid Before: Mon Feb 01 14:54:04 2010
+# Not Valid After : Tue Sep 30 00:00:00 2014
+# Fingerprint (MD5): 8F:46:BE:99:47:6F:93:DC:5C:01:54:50:D0:4A:BD:AC
+# Fingerprint (SHA1): 30:F1:82:CA:1A:5E:4E:4F:F3:6E:D0:E6:38:18:B8:B9:41:CB:5F:8C
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Distrust a pb.com certificate that does not comply with the baseline requirements."
+CKA_ISSUER MULTILINE_OCTAL
+\060\116\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\020\060\016\006\003\125\004\012\023\007\105\161\165\151\146\141
+\170\061\055\060\053\006\003\125\004\013\023\044\105\161\165\151
+\146\141\170\040\123\145\143\165\162\145\040\103\145\162\164\151
+\146\151\143\141\164\145\040\101\165\164\150\157\162\151\164\171
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\003\025\171\024
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
#
# Certificate "GlobalSign Root CA"
#
@@ -2398,7 +2426,7 @@ END
CKA_SERIAL_NUMBER MULTILINE_OCTAL
\002\003\001\000\040
END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
@@ -3656,7 +3684,7 @@ END
CKA_SERIAL_NUMBER MULTILINE_OCTAL
\002\001\000
END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
@@ -3815,7 +3843,7 @@ END
CKA_SERIAL_NUMBER MULTILINE_OCTAL
\002\001\000
END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
@@ -4265,6 +4293,213 @@ CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
#
+# Certificate "StartCom Certification Authority"
+#
+# Issuer: CN=StartCom Certification Authority,OU=Secure Digital Certificate Signing,O=StartCom Ltd.,C=IL
+# Serial Number: 1 (0x1)
+# Subject: CN=StartCom Certification Authority,OU=Secure Digital Certificate Signing,O=StartCom Ltd.,C=IL
+# Not Valid Before: Sun Sep 17 19:46:36 2006
+# Not Valid After : Wed Sep 17 19:46:36 2036
+# Fingerprint (MD5): 22:4D:8F:8A:FC:F7:35:C2:BB:57:34:90:7B:8B:22:16
+# Fingerprint (SHA1): 3E:2B:F7:F2:03:1B:96:F3:8C:E6:C4:D8:A8:5D:3E:2D:58:47:6A:0F
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "StartCom Certification Authority"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\175\061\013\060\011\006\003\125\004\006\023\002\111\114\061
+\026\060\024\006\003\125\004\012\023\015\123\164\141\162\164\103
+\157\155\040\114\164\144\056\061\053\060\051\006\003\125\004\013
+\023\042\123\145\143\165\162\145\040\104\151\147\151\164\141\154
+\040\103\145\162\164\151\146\151\143\141\164\145\040\123\151\147
+\156\151\156\147\061\051\060\047\006\003\125\004\003\023\040\123
+\164\141\162\164\103\157\155\040\103\145\162\164\151\146\151\143
+\141\164\151\157\156\040\101\165\164\150\157\162\151\164\171
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\175\061\013\060\011\006\003\125\004\006\023\002\111\114\061
+\026\060\024\006\003\125\004\012\023\015\123\164\141\162\164\103
+\157\155\040\114\164\144\056\061\053\060\051\006\003\125\004\013
+\023\042\123\145\143\165\162\145\040\104\151\147\151\164\141\154
+\040\103\145\162\164\151\146\151\143\141\164\145\040\123\151\147
+\156\151\156\147\061\051\060\047\006\003\125\004\003\023\040\123
+\164\141\162\164\103\157\155\040\103\145\162\164\151\146\151\143
+\141\164\151\157\156\040\101\165\164\150\157\162\151\164\171
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\001\001
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\007\311\060\202\005\261\240\003\002\001\002\002\001\001
+\060\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060
+\175\061\013\060\011\006\003\125\004\006\023\002\111\114\061\026
+\060\024\006\003\125\004\012\023\015\123\164\141\162\164\103\157
+\155\040\114\164\144\056\061\053\060\051\006\003\125\004\013\023
+\042\123\145\143\165\162\145\040\104\151\147\151\164\141\154\040
+\103\145\162\164\151\146\151\143\141\164\145\040\123\151\147\156
+\151\156\147\061\051\060\047\006\003\125\004\003\023\040\123\164
+\141\162\164\103\157\155\040\103\145\162\164\151\146\151\143\141
+\164\151\157\156\040\101\165\164\150\157\162\151\164\171\060\036
+\027\015\060\066\060\071\061\067\061\071\064\066\063\066\132\027
+\015\063\066\060\071\061\067\061\071\064\066\063\066\132\060\175
+\061\013\060\011\006\003\125\004\006\023\002\111\114\061\026\060
+\024\006\003\125\004\012\023\015\123\164\141\162\164\103\157\155
+\040\114\164\144\056\061\053\060\051\006\003\125\004\013\023\042
+\123\145\143\165\162\145\040\104\151\147\151\164\141\154\040\103
+\145\162\164\151\146\151\143\141\164\145\040\123\151\147\156\151
+\156\147\061\051\060\047\006\003\125\004\003\023\040\123\164\141
+\162\164\103\157\155\040\103\145\162\164\151\146\151\143\141\164
+\151\157\156\040\101\165\164\150\157\162\151\164\171\060\202\002
+\042\060\015\006\011\052\206\110\206\367\015\001\001\001\005\000
+\003\202\002\017\000\060\202\002\012\002\202\002\001\000\301\210
+\333\011\274\154\106\174\170\237\225\173\265\063\220\362\162\142
+\326\301\066\040\042\044\136\316\351\167\362\103\012\242\006\144
+\244\314\216\066\370\070\346\043\360\156\155\261\074\335\162\243
+\205\034\241\323\075\264\063\053\323\057\257\376\352\260\101\131
+\147\266\304\006\175\012\236\164\205\326\171\114\200\067\172\337
+\071\005\122\131\367\364\033\106\103\244\322\205\205\322\303\161
+\363\165\142\064\272\054\212\177\036\217\356\355\064\320\021\307
+\226\315\122\075\272\063\326\335\115\336\013\073\112\113\237\302
+\046\057\372\265\026\034\162\065\167\312\074\135\346\312\341\046
+\213\032\066\166\134\001\333\164\024\045\376\355\265\240\210\017
+\335\170\312\055\037\007\227\060\001\055\162\171\372\106\326\023
+\052\250\271\246\253\203\111\035\345\362\357\335\344\001\216\030
+\012\217\143\123\026\205\142\251\016\031\072\314\265\146\246\302
+\153\164\007\344\053\341\166\076\264\155\330\366\104\341\163\142
+\037\073\304\276\240\123\126\045\154\121\011\367\252\253\312\277
+\166\375\155\233\363\235\333\277\075\146\274\014\126\252\257\230
+\110\225\072\113\337\247\130\120\331\070\165\251\133\352\103\014
+\002\377\231\353\350\154\115\160\133\051\145\234\335\252\135\314
+\257\001\061\354\014\353\322\215\350\352\234\173\346\156\367\047
+\146\014\032\110\327\156\102\343\077\336\041\076\173\341\015\160
+\373\143\252\250\154\032\124\264\134\045\172\311\242\311\213\026
+\246\273\054\176\027\136\005\115\130\156\022\035\001\356\022\020
+\015\306\062\177\030\377\374\364\372\315\156\221\350\066\111\276
+\032\110\151\213\302\226\115\032\022\262\151\027\301\012\220\326
+\372\171\042\110\277\272\173\151\370\160\307\372\172\067\330\330
+\015\322\166\117\127\377\220\267\343\221\322\335\357\302\140\267
+\147\072\335\376\252\234\360\324\213\177\162\042\316\306\237\227
+\266\370\257\212\240\020\250\331\373\030\306\266\265\134\122\074
+\211\266\031\052\163\001\012\017\003\263\022\140\362\172\057\201
+\333\243\156\377\046\060\227\365\213\335\211\127\266\255\075\263
+\257\053\305\267\166\002\360\245\326\053\232\206\024\052\162\366
+\343\063\214\135\011\113\023\337\273\214\164\023\122\113\002\003
+\001\000\001\243\202\002\122\060\202\002\116\060\014\006\003\125
+\035\023\004\005\060\003\001\001\377\060\013\006\003\125\035\017
+\004\004\003\002\001\256\060\035\006\003\125\035\016\004\026\004
+\024\116\013\357\032\244\100\133\245\027\151\207\060\312\064\150
+\103\320\101\256\362\060\144\006\003\125\035\037\004\135\060\133
+\060\054\240\052\240\050\206\046\150\164\164\160\072\057\057\143
+\145\162\164\056\163\164\141\162\164\143\157\155\056\157\162\147
+\057\163\146\163\143\141\055\143\162\154\056\143\162\154\060\053
+\240\051\240\047\206\045\150\164\164\160\072\057\057\143\162\154
+\056\163\164\141\162\164\143\157\155\056\157\162\147\057\163\146
+\163\143\141\055\143\162\154\056\143\162\154\060\202\001\135\006
+\003\125\035\040\004\202\001\124\060\202\001\120\060\202\001\114
+\006\013\053\006\001\004\001\201\265\067\001\001\001\060\202\001
+\073\060\057\006\010\053\006\001\005\005\007\002\001\026\043\150
+\164\164\160\072\057\057\143\145\162\164\056\163\164\141\162\164
+\143\157\155\056\157\162\147\057\160\157\154\151\143\171\056\160
+\144\146\060\065\006\010\053\006\001\005\005\007\002\001\026\051
+\150\164\164\160\072\057\057\143\145\162\164\056\163\164\141\162
+\164\143\157\155\056\157\162\147\057\151\156\164\145\162\155\145
+\144\151\141\164\145\056\160\144\146\060\201\320\006\010\053\006
+\001\005\005\007\002\002\060\201\303\060\047\026\040\123\164\141
+\162\164\040\103\157\155\155\145\162\143\151\141\154\040\050\123
+\164\141\162\164\103\157\155\051\040\114\164\144\056\060\003\002
+\001\001\032\201\227\114\151\155\151\164\145\144\040\114\151\141
+\142\151\154\151\164\171\054\040\162\145\141\144\040\164\150\145
+\040\163\145\143\164\151\157\156\040\052\114\145\147\141\154\040
+\114\151\155\151\164\141\164\151\157\156\163\052\040\157\146\040
+\164\150\145\040\123\164\141\162\164\103\157\155\040\103\145\162
+\164\151\146\151\143\141\164\151\157\156\040\101\165\164\150\157
+\162\151\164\171\040\120\157\154\151\143\171\040\141\166\141\151
+\154\141\142\154\145\040\141\164\040\150\164\164\160\072\057\057
+\143\145\162\164\056\163\164\141\162\164\143\157\155\056\157\162
+\147\057\160\157\154\151\143\171\056\160\144\146\060\021\006\011
+\140\206\110\001\206\370\102\001\001\004\004\003\002\000\007\060
+\070\006\011\140\206\110\001\206\370\102\001\015\004\053\026\051
+\123\164\141\162\164\103\157\155\040\106\162\145\145\040\123\123
+\114\040\103\145\162\164\151\146\151\143\141\164\151\157\156\040
+\101\165\164\150\157\162\151\164\171\060\015\006\011\052\206\110
+\206\367\015\001\001\005\005\000\003\202\002\001\000\026\154\231
+\364\146\014\064\365\320\205\136\175\012\354\332\020\116\070\034
+\136\337\246\045\005\113\221\062\301\350\073\361\075\335\104\011
+\133\007\111\212\051\313\146\002\267\261\232\367\045\230\011\074
+\216\033\341\335\066\207\053\113\273\150\323\071\146\075\240\046
+\307\362\071\221\035\121\253\202\173\176\325\316\132\344\342\003
+\127\160\151\227\010\371\136\130\246\012\337\214\006\232\105\026
+\026\070\012\136\127\366\142\307\172\002\005\346\274\036\265\362
+\236\364\251\051\203\370\262\024\343\156\050\207\104\303\220\032
+\336\070\251\074\254\103\115\144\105\316\335\050\251\134\362\163
+\173\004\370\027\350\253\261\363\056\134\144\156\163\061\072\022
+\270\274\263\021\344\175\217\201\121\232\073\215\211\364\115\223
+\146\173\074\003\355\323\232\035\232\363\145\120\365\240\320\165
+\237\057\257\360\352\202\103\230\370\151\234\211\171\304\103\216
+\106\162\343\144\066\022\257\367\045\036\070\211\220\167\176\303
+\153\152\271\303\313\104\113\254\170\220\213\347\307\054\036\113
+\021\104\310\064\122\047\315\012\135\237\205\301\211\325\032\170
+\362\225\020\123\062\335\200\204\146\165\331\265\150\050\373\141
+\056\276\204\250\070\300\231\022\206\245\036\147\144\255\006\056
+\057\251\160\205\307\226\017\174\211\145\365\216\103\124\016\253
+\335\245\200\071\224\140\300\064\311\226\160\054\243\022\365\037
+\110\173\275\034\176\153\267\235\220\364\042\073\256\370\374\052
+\312\372\202\122\240\357\257\113\125\223\353\301\265\360\042\213
+\254\064\116\046\042\004\241\207\054\165\112\267\345\175\023\327
+\270\014\144\300\066\322\311\057\206\022\214\043\011\301\033\202
+\073\163\111\243\152\127\207\224\345\326\170\305\231\103\143\343
+\115\340\167\055\341\145\231\162\151\004\032\107\011\346\017\001
+\126\044\373\037\277\016\171\251\130\056\271\304\011\001\176\225
+\272\155\000\006\076\262\352\112\020\071\330\320\053\365\277\354
+\165\277\227\002\305\011\033\010\334\125\067\342\201\373\067\204
+\103\142\040\312\347\126\113\145\352\376\154\301\044\223\044\241
+\064\353\005\377\232\042\256\233\175\077\361\145\121\012\246\060
+\152\263\364\210\034\200\015\374\162\212\350\203\136
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for Certificate "StartCom Certification Authority"
+# Issuer: CN=StartCom Certification Authority,OU=Secure Digital Certificate Signing,O=StartCom Ltd.,C=IL
+# Serial Number: 1 (0x1)
+# Subject: CN=StartCom Certification Authority,OU=Secure Digital Certificate Signing,O=StartCom Ltd.,C=IL
+# Not Valid Before: Sun Sep 17 19:46:36 2006
+# Not Valid After : Wed Sep 17 19:46:36 2036
+# Fingerprint (MD5): 22:4D:8F:8A:FC:F7:35:C2:BB:57:34:90:7B:8B:22:16
+# Fingerprint (SHA1): 3E:2B:F7:F2:03:1B:96:F3:8C:E6:C4:D8:A8:5D:3E:2D:58:47:6A:0F
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "StartCom Certification Authority"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\076\053\367\362\003\033\226\363\214\346\304\330\250\135\076\055
+\130\107\152\017
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\042\115\217\212\374\367\065\302\273\127\064\220\173\213\042\026
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\175\061\013\060\011\006\003\125\004\006\023\002\111\114\061
+\026\060\024\006\003\125\004\012\023\015\123\164\141\162\164\103
+\157\155\040\114\164\144\056\061\053\060\051\006\003\125\004\013
+\023\042\123\145\143\165\162\145\040\104\151\147\151\164\141\154
+\040\103\145\162\164\151\146\151\143\141\164\145\040\123\151\147
+\156\151\156\147\061\051\060\047\006\003\125\004\003\023\040\123
+\164\141\162\164\103\157\155\040\103\145\162\164\151\146\151\143
+\141\164\151\157\156\040\101\165\164\150\157\162\151\164\171
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\001\001
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
# Certificate "Taiwan GRCA"
#
# Issuer: O=Government Root Certification Authority,C=TW
@@ -5110,6 +5345,149 @@ CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
#
+# Certificate "DST ACES CA X6"
+#
+# Issuer: CN=DST ACES CA X6,OU=DST ACES,O=Digital Signature Trust,C=US
+# Serial Number:0d:5e:99:0a:d6:9d:b7:78:ec:d8:07:56:3b:86:15:d9
+# Subject: CN=DST ACES CA X6,OU=DST ACES,O=Digital Signature Trust,C=US
+# Not Valid Before: Thu Nov 20 21:19:58 2003
+# Not Valid After : Mon Nov 20 21:19:58 2017
+# Fingerprint (MD5): 21:D8:4C:82:2B:99:09:33:A2:EB:14:24:8D:8E:5F:E8
+# Fingerprint (SHA1): 40:54:DA:6F:1C:3F:40:74:AC:ED:0F:EC:CD:DB:79:D1:53:FB:90:1D
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "DST ACES CA X6"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\133\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\040\060\036\006\003\125\004\012\023\027\104\151\147\151\164\141
+\154\040\123\151\147\156\141\164\165\162\145\040\124\162\165\163
+\164\061\021\060\017\006\003\125\004\013\023\010\104\123\124\040
+\101\103\105\123\061\027\060\025\006\003\125\004\003\023\016\104
+\123\124\040\101\103\105\123\040\103\101\040\130\066
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\133\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\040\060\036\006\003\125\004\012\023\027\104\151\147\151\164\141
+\154\040\123\151\147\156\141\164\165\162\145\040\124\162\165\163
+\164\061\021\060\017\006\003\125\004\013\023\010\104\123\124\040
+\101\103\105\123\061\027\060\025\006\003\125\004\003\023\016\104
+\123\124\040\101\103\105\123\040\103\101\040\130\066
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\020\015\136\231\012\326\235\267\170\354\330\007\126\073\206
+\025\331
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\004\011\060\202\002\361\240\003\002\001\002\002\020\015
+\136\231\012\326\235\267\170\354\330\007\126\073\206\025\331\060
+\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060\133
+\061\013\060\011\006\003\125\004\006\023\002\125\123\061\040\060
+\036\006\003\125\004\012\023\027\104\151\147\151\164\141\154\040
+\123\151\147\156\141\164\165\162\145\040\124\162\165\163\164\061
+\021\060\017\006\003\125\004\013\023\010\104\123\124\040\101\103
+\105\123\061\027\060\025\006\003\125\004\003\023\016\104\123\124
+\040\101\103\105\123\040\103\101\040\130\066\060\036\027\015\060
+\063\061\061\062\060\062\061\061\071\065\070\132\027\015\061\067
+\061\061\062\060\062\061\061\071\065\070\132\060\133\061\013\060
+\011\006\003\125\004\006\023\002\125\123\061\040\060\036\006\003
+\125\004\012\023\027\104\151\147\151\164\141\154\040\123\151\147
+\156\141\164\165\162\145\040\124\162\165\163\164\061\021\060\017
+\006\003\125\004\013\023\010\104\123\124\040\101\103\105\123\061
+\027\060\025\006\003\125\004\003\023\016\104\123\124\040\101\103
+\105\123\040\103\101\040\130\066\060\202\001\042\060\015\006\011
+\052\206\110\206\367\015\001\001\001\005\000\003\202\001\017\000
+\060\202\001\012\002\202\001\001\000\271\075\365\054\311\224\334
+\165\212\225\135\143\350\204\167\166\146\271\131\221\134\106\335
+\222\076\237\371\016\003\264\075\141\222\275\043\046\265\143\356
+\222\322\236\326\074\310\015\220\137\144\201\261\250\010\015\114
+\330\371\323\005\050\122\264\001\045\305\225\034\014\176\076\020
+\204\165\317\301\031\221\143\317\350\250\221\210\271\103\122\273
+\200\261\125\211\213\061\372\320\267\166\276\101\075\060\232\244
+\042\045\027\163\350\036\342\323\254\052\275\133\070\041\325\052
+\113\327\125\175\343\072\125\275\327\155\153\002\127\153\346\107
+\174\010\310\202\272\336\247\207\075\241\155\270\060\126\302\263
+\002\201\137\055\365\342\232\060\030\050\270\146\323\313\001\226
+\157\352\212\105\125\326\340\235\377\147\053\027\002\246\116\032
+\152\021\013\176\267\173\347\230\326\214\166\157\301\073\333\120
+\223\176\345\320\216\037\067\270\275\272\306\237\154\351\174\063
+\362\062\074\046\107\372\047\044\002\311\176\035\133\210\102\023
+\152\065\174\175\065\351\056\146\221\162\223\325\062\046\304\164
+\365\123\243\263\135\232\366\011\313\002\003\001\000\001\243\201
+\310\060\201\305\060\017\006\003\125\035\023\001\001\377\004\005
+\060\003\001\001\377\060\016\006\003\125\035\017\001\001\377\004
+\004\003\002\001\306\060\037\006\003\125\035\021\004\030\060\026
+\201\024\160\153\151\055\157\160\163\100\164\162\165\163\164\144
+\163\164\056\143\157\155\060\142\006\003\125\035\040\004\133\060
+\131\060\127\006\012\140\206\110\001\145\003\002\001\001\001\060
+\111\060\107\006\010\053\006\001\005\005\007\002\001\026\073\150
+\164\164\160\072\057\057\167\167\167\056\164\162\165\163\164\144
+\163\164\056\143\157\155\057\143\145\162\164\151\146\151\143\141
+\164\145\163\057\160\157\154\151\143\171\057\101\103\105\123\055
+\151\156\144\145\170\056\150\164\155\154\060\035\006\003\125\035
+\016\004\026\004\024\011\162\006\116\030\103\017\345\326\314\303
+\152\213\061\173\170\217\250\203\270\060\015\006\011\052\206\110
+\206\367\015\001\001\005\005\000\003\202\001\001\000\243\330\216
+\326\262\333\316\005\347\062\315\001\323\004\003\345\166\344\126
+\053\234\231\220\350\010\060\154\337\175\075\356\345\277\265\044
+\100\204\111\341\321\050\256\304\302\072\123\060\210\361\365\167
+\156\121\312\372\377\231\257\044\137\033\240\375\362\254\204\312
+\337\251\360\137\004\056\255\026\277\041\227\020\201\075\343\377
+\207\215\062\334\224\345\107\212\136\152\023\311\224\225\075\322
+\356\310\064\225\320\200\324\255\062\010\200\124\074\340\275\122
+\123\327\122\174\262\151\077\177\172\317\152\164\312\372\004\052
+\234\114\132\006\245\351\040\255\105\146\017\151\361\335\277\351
+\343\062\213\372\340\301\206\115\162\074\056\330\223\170\012\052
+\370\330\322\047\075\031\211\137\132\173\212\073\314\014\332\121
+\256\307\013\367\053\260\067\005\354\274\127\043\342\070\322\233
+\150\363\126\022\210\117\102\174\270\061\304\265\333\344\310\041
+\064\351\110\021\065\356\372\307\222\127\305\237\064\344\307\366
+\367\016\013\114\234\150\170\173\161\061\307\353\036\340\147\101
+\363\267\240\247\315\345\172\063\066\152\372\232\053
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for Certificate "DST ACES CA X6"
+# Issuer: CN=DST ACES CA X6,OU=DST ACES,O=Digital Signature Trust,C=US
+# Serial Number:0d:5e:99:0a:d6:9d:b7:78:ec:d8:07:56:3b:86:15:d9
+# Subject: CN=DST ACES CA X6,OU=DST ACES,O=Digital Signature Trust,C=US
+# Not Valid Before: Thu Nov 20 21:19:58 2003
+# Not Valid After : Mon Nov 20 21:19:58 2017
+# Fingerprint (MD5): 21:D8:4C:82:2B:99:09:33:A2:EB:14:24:8D:8E:5F:E8
+# Fingerprint (SHA1): 40:54:DA:6F:1C:3F:40:74:AC:ED:0F:EC:CD:DB:79:D1:53:FB:90:1D
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "DST ACES CA X6"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\100\124\332\157\034\077\100\164\254\355\017\354\315\333\171\321
+\123\373\220\035
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\041\330\114\202\053\231\011\063\242\353\024\044\215\216\137\350
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\133\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\040\060\036\006\003\125\004\012\023\027\104\151\147\151\164\141
+\154\040\123\151\147\156\141\164\165\162\145\040\124\162\165\163
+\164\061\021\060\017\006\003\125\004\013\023\010\104\123\124\040
+\101\103\105\123\061\027\060\025\006\003\125\004\003\023\016\104
+\123\124\040\101\103\105\123\040\103\101\040\130\066
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\020\015\136\231\012\326\235\267\170\354\330\007\126\073\206
+\025\331
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
# Certificate "SwissSign Platinum CA - G2"
#
# Issuer: CN=SwissSign Platinum CA - G2,O=SwissSign AG,C=CH
@@ -6774,6 +7152,311 @@ CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
#
+# Certificate "MD5 Collisions Forged Rogue CA 25c3"
+#
+# Issuer: CN=Equifax Secure Global eBusiness CA-1,O=Equifax Secure Inc.,C=US
+# Serial Number: 66 (0x42)
+# Subject: CN=MD5 Collisions Inc. (http://www.phreedom.org/md5)
+# Not Valid Before: Sat Jul 31 00:00:01 2004
+# Not Valid After : Thu Sep 02 00:00:01 2004
+# Fingerprint (MD5): 16:7A:13:15:B9:17:39:A3:F1:05:6A:E6:3E:D9:3A:38
+# Fingerprint (SHA1): 64:23:13:7E:5C:53:D6:4A:A6:64:85:ED:36:54:F5:AB:05:5A:8B:8A
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "MD5 Collisions Forged Rogue CA 25c3"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\074\061\072\060\070\006\003\125\004\003\023\061\115\104\065
+\040\103\157\154\154\151\163\151\157\156\163\040\111\156\143\056
+\040\050\150\164\164\160\072\057\057\167\167\167\056\160\150\162
+\145\145\144\157\155\056\157\162\147\057\155\144\065\051
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\132\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\034\060\032\006\003\125\004\012\023\023\105\161\165\151\146\141
+\170\040\123\145\143\165\162\145\040\111\156\143\056\061\055\060
+\053\006\003\125\004\003\023\044\105\161\165\151\146\141\170\040
+\123\145\143\165\162\145\040\107\154\157\142\141\154\040\145\102
+\165\163\151\156\145\163\163\040\103\101\055\061
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\001\102
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\004\062\060\202\003\233\240\003\002\001\002\002\001\102
+\060\015\006\011\052\206\110\206\367\015\001\001\004\005\000\060
+\132\061\013\060\011\006\003\125\004\006\023\002\125\123\061\034
+\060\032\006\003\125\004\012\023\023\105\161\165\151\146\141\170
+\040\123\145\143\165\162\145\040\111\156\143\056\061\055\060\053
+\006\003\125\004\003\023\044\105\161\165\151\146\141\170\040\123
+\145\143\165\162\145\040\107\154\157\142\141\154\040\145\102\165
+\163\151\156\145\163\163\040\103\101\055\061\060\036\027\015\060
+\064\060\067\063\061\060\060\060\060\060\061\132\027\015\060\064
+\060\071\060\062\060\060\060\060\060\061\132\060\074\061\072\060
+\070\006\003\125\004\003\023\061\115\104\065\040\103\157\154\154
+\151\163\151\157\156\163\040\111\156\143\056\040\050\150\164\164
+\160\072\057\057\167\167\167\056\160\150\162\145\145\144\157\155
+\056\157\162\147\057\155\144\065\051\060\201\237\060\015\006\011
+\052\206\110\206\367\015\001\001\001\005\000\003\201\215\000\060
+\201\211\002\201\201\000\272\246\131\311\054\050\326\052\260\370
+\355\237\106\244\244\067\356\016\031\150\131\321\263\003\231\121
+\326\026\232\136\067\153\025\340\016\113\365\204\144\370\243\333
+\101\157\065\325\233\025\037\333\304\070\122\160\201\227\136\217
+\240\265\367\176\071\360\062\254\036\255\104\322\263\372\110\303
+\316\221\233\354\364\234\174\341\132\365\310\067\153\232\203\336
+\347\312\040\227\061\102\163\025\221\150\364\210\257\371\050\050
+\305\351\017\163\260\027\113\023\114\231\165\320\104\346\176\010
+\154\032\362\117\033\101\002\003\001\000\001\243\202\002\044\060
+\202\002\040\060\013\006\003\125\035\017\004\004\003\002\001\306
+\060\017\006\003\125\035\023\001\001\377\004\005\060\003\001\001
+\377\060\035\006\003\125\035\016\004\026\004\024\247\004\140\037
+\253\162\103\010\305\177\010\220\125\126\034\326\316\346\070\353
+\060\037\006\003\125\035\043\004\030\060\026\200\024\276\250\240
+\164\162\120\153\104\267\311\043\330\373\250\377\263\127\153\150
+\154\060\202\001\276\006\011\140\206\110\001\206\370\102\001\015
+\004\202\001\257\026\202\001\253\063\000\000\000\047\136\071\340
+\211\141\017\116\243\305\105\013\066\273\001\321\123\252\303\010
+\217\157\370\117\076\207\207\104\021\334\140\340\337\222\125\371
+\270\163\033\124\223\305\237\320\106\304\140\266\065\142\315\271
+\257\034\250\151\032\311\133\074\226\067\300\355\147\357\273\376
+\300\213\234\120\057\051\275\203\042\236\216\010\372\254\023\160
+\242\130\177\142\142\212\021\367\211\366\337\266\147\131\163\026
+\373\143\026\212\264\221\070\316\056\365\266\276\114\244\224\111
+\344\145\021\012\102\025\311\301\060\342\151\325\105\175\245\046
+\273\271\141\354\142\144\360\071\341\347\274\150\330\120\121\236
+\035\140\323\321\243\247\012\370\003\040\241\160\001\027\221\066
+\117\002\160\061\206\203\335\367\017\330\007\035\021\263\023\004
+\245\334\360\256\120\261\050\016\143\151\052\014\202\157\217\107
+\063\337\154\242\006\222\361\117\105\276\331\060\066\243\053\214
+\326\167\256\065\143\177\116\114\232\223\110\066\331\237\002\003
+\001\000\001\243\201\275\060\201\272\060\016\006\003\125\035\017
+\001\001\377\004\004\003\002\004\360\060\035\006\003\125\035\016
+\004\026\004\024\315\246\203\372\245\140\067\367\226\067\027\051
+\336\101\170\361\207\211\125\347\060\073\006\003\125\035\037\004
+\064\060\062\060\060\240\056\240\054\206\052\150\164\164\160\072
+\057\057\143\162\154\056\147\145\157\164\162\165\163\164\056\143
+\157\155\057\143\162\154\163\057\147\154\157\142\141\154\143\141
+\061\056\143\162\154\060\037\006\003\125\035\043\004\030\060\026
+\200\024\276\250\240\164\162\120\153\104\267\311\043\330\373\250
+\377\263\127\153\150\154\060\035\006\003\125\035\045\004\026\060
+\024\006\010\053\006\001\005\005\007\003\001\006\010\053\006\001
+\005\005\007\003\002\060\014\006\003\125\035\023\001\001\377\004
+\002\060\000\060\015\006\011\052\206\110\206\367\015\001\001\004
+\005\000\003\201\201\000\247\041\002\215\321\016\242\200\167\045
+\375\103\140\025\217\354\357\220\107\324\204\102\025\046\021\034
+\315\302\074\020\051\251\266\337\253\127\165\221\332\345\053\263
+\220\105\034\060\143\126\077\212\331\120\372\355\130\154\300\145
+\254\146\127\336\034\306\166\073\365\000\016\216\105\316\177\114
+\220\354\053\306\315\263\264\217\142\320\376\267\305\046\162\104
+\355\366\230\133\256\313\321\225\365\332\010\276\150\106\261\165
+\310\354\035\217\036\172\224\361\252\123\170\242\105\256\124\352
+\321\236\164\310\166\147
+END
+
+# Trust for Certificate "MD5 Collisions Forged Rogue CA 25c3"
+# Issuer: CN=Equifax Secure Global eBusiness CA-1,O=Equifax Secure Inc.,C=US
+# Serial Number: 66 (0x42)
+# Subject: CN=MD5 Collisions Inc. (http://www.phreedom.org/md5)
+# Not Valid Before: Sat Jul 31 00:00:01 2004
+# Not Valid After : Thu Sep 02 00:00:01 2004
+# Fingerprint (MD5): 16:7A:13:15:B9:17:39:A3:F1:05:6A:E6:3E:D9:3A:38
+# Fingerprint (SHA1): 64:23:13:7E:5C:53:D6:4A:A6:64:85:ED:36:54:F5:AB:05:5A:8B:8A
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "MD5 Collisions Forged Rogue CA 25c3"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\144\043\023\176\134\123\326\112\246\144\205\355\066\124\365\253
+\005\132\213\212
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\026\172\023\025\271\027\071\243\361\005\152\346\076\331\072\070
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\132\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\034\060\032\006\003\125\004\012\023\023\105\161\165\151\146\141
+\170\040\123\145\143\165\162\145\040\111\156\143\056\061\055\060
+\053\006\003\125\004\003\023\044\105\161\165\151\146\141\170\040
+\123\145\143\165\162\145\040\107\154\157\142\141\154\040\145\102
+\165\163\151\156\145\163\163\040\103\101\055\061
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\001\102
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+# Distrust "Distrusted AC DG Tresor SSL"
+# Issuer: CN=AC DGTPE Signature Authentification,O=DGTPE,C=FR
+# Serial Number: 204199 (0x31da7)
+# Subject: CN=AC DG Tr..sor SSL,O=DG Tr..sor,C=FR
+# Not Valid Before: Thu Jul 18 10:05:28 2013
+# Not Valid After : Fri Jul 18 10:05:28 2014
+# Fingerprint (MD5): 3A:EA:9E:FC:00:0C:E2:06:6C:E0:AC:39:C1:31:DE:C8
+# Fingerprint (SHA1): 5C:E3:39:46:5F:41:A1:E4:23:14:9F:65:54:40:95:40:4D:E6:EB:E2
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Distrusted AC DG Tresor SSL"
+CKA_ISSUER MULTILINE_OCTAL
+\060\113\061\013\060\011\006\003\125\004\006\023\002\106\122\061
+\016\060\014\006\003\125\004\012\023\005\104\107\124\120\105\061
+\054\060\052\006\003\125\004\003\023\043\101\103\040\104\107\124
+\120\105\040\123\151\147\156\141\164\165\162\145\040\101\165\164
+\150\145\156\164\151\146\151\143\141\164\151\157\156
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\003\003\035\247
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "Security Communication EV RootCA1"
+#
+# Issuer: OU=Security Communication EV RootCA1,O="SECOM Trust Systems CO.,LTD.",C=JP
+# Serial Number: 0 (0x0)
+# Subject: OU=Security Communication EV RootCA1,O="SECOM Trust Systems CO.,LTD.",C=JP
+# Not Valid Before: Wed Jun 06 02:12:32 2007
+# Not Valid After : Sat Jun 06 02:12:32 2037
+# Fingerprint (MD5): 22:2D:A6:01:EA:7C:0A:F7:F0:6C:56:43:3F:77:76:D3
+# Fingerprint (SHA1): FE:B8:C4:32:DC:F9:76:9A:CE:AE:3D:D8:90:8F:FD:28:86:65:64:7D
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Security Communication EV RootCA1"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\140\061\013\060\011\006\003\125\004\006\023\002\112\120\061
+\045\060\043\006\003\125\004\012\023\034\123\105\103\117\115\040
+\124\162\165\163\164\040\123\171\163\164\145\155\163\040\103\117
+\056\054\114\124\104\056\061\052\060\050\006\003\125\004\013\023
+\041\123\145\143\165\162\151\164\171\040\103\157\155\155\165\156
+\151\143\141\164\151\157\156\040\105\126\040\122\157\157\164\103
+\101\061
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\140\061\013\060\011\006\003\125\004\006\023\002\112\120\061
+\045\060\043\006\003\125\004\012\023\034\123\105\103\117\115\040
+\124\162\165\163\164\040\123\171\163\164\145\155\163\040\103\117
+\056\054\114\124\104\056\061\052\060\050\006\003\125\004\013\023
+\041\123\145\143\165\162\151\164\171\040\103\157\155\155\165\156
+\151\143\141\164\151\157\156\040\105\126\040\122\157\157\164\103
+\101\061
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\001\000
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\003\175\060\202\002\145\240\003\002\001\002\002\001\000
+\060\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060
+\140\061\013\060\011\006\003\125\004\006\023\002\112\120\061\045
+\060\043\006\003\125\004\012\023\034\123\105\103\117\115\040\124
+\162\165\163\164\040\123\171\163\164\145\155\163\040\103\117\056
+\054\114\124\104\056\061\052\060\050\006\003\125\004\013\023\041
+\123\145\143\165\162\151\164\171\040\103\157\155\155\165\156\151
+\143\141\164\151\157\156\040\105\126\040\122\157\157\164\103\101
+\061\060\036\027\015\060\067\060\066\060\066\060\062\061\062\063
+\062\132\027\015\063\067\060\066\060\066\060\062\061\062\063\062
+\132\060\140\061\013\060\011\006\003\125\004\006\023\002\112\120
+\061\045\060\043\006\003\125\004\012\023\034\123\105\103\117\115
+\040\124\162\165\163\164\040\123\171\163\164\145\155\163\040\103
+\117\056\054\114\124\104\056\061\052\060\050\006\003\125\004\013
+\023\041\123\145\143\165\162\151\164\171\040\103\157\155\155\165
+\156\151\143\141\164\151\157\156\040\105\126\040\122\157\157\164
+\103\101\061\060\202\001\042\060\015\006\011\052\206\110\206\367
+\015\001\001\001\005\000\003\202\001\017\000\060\202\001\012\002
+\202\001\001\000\274\177\354\127\233\044\340\376\234\272\102\171
+\251\210\212\372\200\340\365\007\051\103\352\216\012\064\066\215
+\034\372\247\265\071\170\377\227\165\367\057\344\252\153\004\204
+\104\312\246\342\150\216\375\125\120\142\017\244\161\016\316\007
+\070\055\102\205\120\255\074\226\157\213\325\242\016\317\336\111
+\211\075\326\144\056\070\345\036\154\265\127\212\236\357\110\016
+\315\172\151\026\207\104\265\220\344\006\235\256\241\004\227\130
+\171\357\040\112\202\153\214\042\277\354\037\017\351\204\161\355
+\361\016\344\270\030\023\314\126\066\135\321\232\036\121\153\071
+\156\140\166\210\064\013\363\263\321\260\235\312\141\342\144\035
+\301\106\007\270\143\335\036\063\145\263\216\011\125\122\075\265
+\275\377\007\353\255\141\125\030\054\251\151\230\112\252\100\305
+\063\024\145\164\000\371\221\336\257\003\110\305\100\124\334\017
+\204\220\150\040\305\222\226\334\056\345\002\105\252\300\137\124
+\370\155\352\111\317\135\154\113\257\357\232\302\126\134\306\065
+\126\102\152\060\137\302\253\366\342\075\077\263\311\021\217\061
+\114\327\237\111\002\003\001\000\001\243\102\060\100\060\035\006
+\003\125\035\016\004\026\004\024\065\112\365\115\257\077\327\202
+\070\254\253\161\145\027\165\214\235\125\223\346\060\016\006\003
+\125\035\017\001\001\377\004\004\003\002\001\006\060\017\006\003
+\125\035\023\001\001\377\004\005\060\003\001\001\377\060\015\006
+\011\052\206\110\206\367\015\001\001\005\005\000\003\202\001\001
+\000\250\207\351\354\370\100\147\135\303\301\146\307\100\113\227
+\374\207\023\220\132\304\357\240\312\137\213\267\247\267\361\326
+\265\144\267\212\263\270\033\314\332\373\254\146\210\101\316\350
+\374\344\333\036\210\246\355\047\120\033\002\060\044\106\171\376
+\004\207\160\227\100\163\321\300\301\127\031\232\151\245\047\231
+\253\235\142\204\366\121\301\054\311\043\025\330\050\267\253\045
+\023\265\106\341\206\002\377\046\214\304\210\222\035\126\376\031
+\147\362\125\344\200\243\153\234\253\167\341\121\161\015\040\333
+\020\232\333\275\166\171\007\167\231\050\255\232\136\332\261\117
+\104\054\065\216\245\226\307\375\203\360\130\306\171\326\230\174
+\250\215\376\206\076\007\026\222\341\173\347\035\354\063\166\176
+\102\056\112\205\371\221\211\150\204\003\201\245\233\232\276\343
+\067\305\124\253\126\073\030\055\101\244\014\370\102\333\231\240
+\340\162\157\273\135\341\026\117\123\012\144\371\116\364\277\116
+\124\275\170\154\210\352\277\234\023\044\302\160\151\242\177\017
+\310\074\255\010\311\260\230\100\243\052\347\210\203\355\167\217
+\164
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for Certificate "Security Communication EV RootCA1"
+# Issuer: OU=Security Communication EV RootCA1,O="SECOM Trust Systems CO.,LTD.",C=JP
+# Serial Number: 0 (0x0)
+# Subject: OU=Security Communication EV RootCA1,O="SECOM Trust Systems CO.,LTD.",C=JP
+# Not Valid Before: Wed Jun 06 02:12:32 2007
+# Not Valid After : Sat Jun 06 02:12:32 2037
+# Fingerprint (MD5): 22:2D:A6:01:EA:7C:0A:F7:F0:6C:56:43:3F:77:76:D3
+# Fingerprint (SHA1): FE:B8:C4:32:DC:F9:76:9A:CE:AE:3D:D8:90:8F:FD:28:86:65:64:7D
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Security Communication EV RootCA1"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\376\270\304\062\334\371\166\232\316\256\075\330\220\217\375\050
+\206\145\144\175
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\042\055\246\001\352\174\012\367\360\154\126\103\077\167\166\323
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\140\061\013\060\011\006\003\125\004\006\023\002\112\120\061
+\045\060\043\006\003\125\004\012\023\034\123\105\103\117\115\040
+\124\162\165\163\164\040\123\171\163\164\145\155\163\040\103\117
+\056\054\114\124\104\056\061\052\060\050\006\003\125\004\013\023
+\041\123\145\143\165\162\151\164\171\040\103\157\155\155\165\156
+\151\143\141\164\151\157\156\040\105\126\040\122\157\157\164\103
+\101\061
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\001\000
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
# Certificate "OISTE WISeKey Global Root GA CA"
#
# Issuer: CN=OISTE WISeKey Global Root GA CA,OU=OISTE Foundation Endorsed,OU=Copyright (c) 2005,O=WISeKey,C=CH
@@ -7968,6 +8651,203 @@ CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
#
+# Certificate "TUBITAK UEKAE Kok Sertifika Hizmet Saglayicisi - Surum 3"
+#
+# Issuer: CN=T..B..TAK UEKAE K..k Sertifika Hizmet Sa..lay..c..s.. - S..r..m ...,OU=Kamu Sertifikasyon Merkezi,OU=Ulusal Elektronik ve Kriptoloji Ara..t..rma Enstit..s.. - UEKAE,O=T..rkiye Bilimsel ve Teknolojik Ara..t..rma Kurumu - T..B..TAK,L=Gebze - Kocaeli,C=TR
+# Serial Number: 17 (0x11)
+# Subject: CN=T..B..TAK UEKAE K..k Sertifika Hizmet Sa..lay..c..s.. - S..r..m ...,OU=Kamu Sertifikasyon Merkezi,OU=Ulusal Elektronik ve Kriptoloji Ara..t..rma Enstit..s.. - UEKAE,O=T..rkiye Bilimsel ve Teknolojik Ara..t..rma Kurumu - T..B..TAK,L=Gebze - Kocaeli,C=TR
+# Not Valid Before: Fri Aug 24 11:37:07 2007
+# Not Valid After : Mon Aug 21 11:37:07 2017
+# Fingerprint (MD5): ED:41:F5:8C:50:C5:2B:9C:73:E6:EE:6C:EB:C2:A8:26
+# Fingerprint (SHA1): 1B:4B:39:61:26:27:6B:64:91:A2:68:6D:D7:02:43:21:2D:1F:1D:96
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "T\xc3\x9c\x42\xC4\xB0TAK UEKAE K\xC3\xB6k Sertifika Hizmet Sa\xC4\x9Flay\xc4\xb1\x63\xc4\xb1s\xc4\xb1 - S\xC3\xBCr\xC3\xBCm 3"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\202\001\053\061\013\060\011\006\003\125\004\006\023\002\124
+\122\061\030\060\026\006\003\125\004\007\014\017\107\145\142\172
+\145\040\055\040\113\157\143\141\145\154\151\061\107\060\105\006
+\003\125\004\012\014\076\124\303\274\162\153\151\171\145\040\102
+\151\154\151\155\163\145\154\040\166\145\040\124\145\153\156\157
+\154\157\152\151\153\040\101\162\141\305\237\164\304\261\162\155
+\141\040\113\165\162\165\155\165\040\055\040\124\303\234\102\304
+\260\124\101\113\061\110\060\106\006\003\125\004\013\014\077\125
+\154\165\163\141\154\040\105\154\145\153\164\162\157\156\151\153
+\040\166\145\040\113\162\151\160\164\157\154\157\152\151\040\101
+\162\141\305\237\164\304\261\162\155\141\040\105\156\163\164\151
+\164\303\274\163\303\274\040\055\040\125\105\113\101\105\061\043
+\060\041\006\003\125\004\013\014\032\113\141\155\165\040\123\145
+\162\164\151\146\151\153\141\163\171\157\156\040\115\145\162\153
+\145\172\151\061\112\060\110\006\003\125\004\003\014\101\124\303
+\234\102\304\260\124\101\113\040\125\105\113\101\105\040\113\303
+\266\153\040\123\145\162\164\151\146\151\153\141\040\110\151\172
+\155\145\164\040\123\141\304\237\154\141\171\304\261\143\304\261
+\163\304\261\040\055\040\123\303\274\162\303\274\155\040\063
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\202\001\053\061\013\060\011\006\003\125\004\006\023\002\124
+\122\061\030\060\026\006\003\125\004\007\014\017\107\145\142\172
+\145\040\055\040\113\157\143\141\145\154\151\061\107\060\105\006
+\003\125\004\012\014\076\124\303\274\162\153\151\171\145\040\102
+\151\154\151\155\163\145\154\040\166\145\040\124\145\153\156\157
+\154\157\152\151\153\040\101\162\141\305\237\164\304\261\162\155
+\141\040\113\165\162\165\155\165\040\055\040\124\303\234\102\304
+\260\124\101\113\061\110\060\106\006\003\125\004\013\014\077\125
+\154\165\163\141\154\040\105\154\145\153\164\162\157\156\151\153
+\040\166\145\040\113\162\151\160\164\157\154\157\152\151\040\101
+\162\141\305\237\164\304\261\162\155\141\040\105\156\163\164\151
+\164\303\274\163\303\274\040\055\040\125\105\113\101\105\061\043
+\060\041\006\003\125\004\013\014\032\113\141\155\165\040\123\145
+\162\164\151\146\151\153\141\163\171\157\156\040\115\145\162\153
+\145\172\151\061\112\060\110\006\003\125\004\003\014\101\124\303
+\234\102\304\260\124\101\113\040\125\105\113\101\105\040\113\303
+\266\153\040\123\145\162\164\151\146\151\153\141\040\110\151\172
+\155\145\164\040\123\141\304\237\154\141\171\304\261\143\304\261
+\163\304\261\040\055\040\123\303\274\162\303\274\155\040\063
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\001\021
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\005\027\060\202\003\377\240\003\002\001\002\002\001\021
+\060\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060
+\202\001\053\061\013\060\011\006\003\125\004\006\023\002\124\122
+\061\030\060\026\006\003\125\004\007\014\017\107\145\142\172\145
+\040\055\040\113\157\143\141\145\154\151\061\107\060\105\006\003
+\125\004\012\014\076\124\303\274\162\153\151\171\145\040\102\151
+\154\151\155\163\145\154\040\166\145\040\124\145\153\156\157\154
+\157\152\151\153\040\101\162\141\305\237\164\304\261\162\155\141
+\040\113\165\162\165\155\165\040\055\040\124\303\234\102\304\260
+\124\101\113\061\110\060\106\006\003\125\004\013\014\077\125\154
+\165\163\141\154\040\105\154\145\153\164\162\157\156\151\153\040
+\166\145\040\113\162\151\160\164\157\154\157\152\151\040\101\162
+\141\305\237\164\304\261\162\155\141\040\105\156\163\164\151\164
+\303\274\163\303\274\040\055\040\125\105\113\101\105\061\043\060
+\041\006\003\125\004\013\014\032\113\141\155\165\040\123\145\162
+\164\151\146\151\153\141\163\171\157\156\040\115\145\162\153\145
+\172\151\061\112\060\110\006\003\125\004\003\014\101\124\303\234
+\102\304\260\124\101\113\040\125\105\113\101\105\040\113\303\266
+\153\040\123\145\162\164\151\146\151\153\141\040\110\151\172\155
+\145\164\040\123\141\304\237\154\141\171\304\261\143\304\261\163
+\304\261\040\055\040\123\303\274\162\303\274\155\040\063\060\036
+\027\015\060\067\060\070\062\064\061\061\063\067\060\067\132\027
+\015\061\067\060\070\062\061\061\061\063\067\060\067\132\060\202
+\001\053\061\013\060\011\006\003\125\004\006\023\002\124\122\061
+\030\060\026\006\003\125\004\007\014\017\107\145\142\172\145\040
+\055\040\113\157\143\141\145\154\151\061\107\060\105\006\003\125
+\004\012\014\076\124\303\274\162\153\151\171\145\040\102\151\154
+\151\155\163\145\154\040\166\145\040\124\145\153\156\157\154\157
+\152\151\153\040\101\162\141\305\237\164\304\261\162\155\141\040
+\113\165\162\165\155\165\040\055\040\124\303\234\102\304\260\124
+\101\113\061\110\060\106\006\003\125\004\013\014\077\125\154\165
+\163\141\154\040\105\154\145\153\164\162\157\156\151\153\040\166
+\145\040\113\162\151\160\164\157\154\157\152\151\040\101\162\141
+\305\237\164\304\261\162\155\141\040\105\156\163\164\151\164\303
+\274\163\303\274\040\055\040\125\105\113\101\105\061\043\060\041
+\006\003\125\004\013\014\032\113\141\155\165\040\123\145\162\164
+\151\146\151\153\141\163\171\157\156\040\115\145\162\153\145\172
+\151\061\112\060\110\006\003\125\004\003\014\101\124\303\234\102
+\304\260\124\101\113\040\125\105\113\101\105\040\113\303\266\153
+\040\123\145\162\164\151\146\151\153\141\040\110\151\172\155\145
+\164\040\123\141\304\237\154\141\171\304\261\143\304\261\163\304
+\261\040\055\040\123\303\274\162\303\274\155\040\063\060\202\001
+\042\060\015\006\011\052\206\110\206\367\015\001\001\001\005\000
+\003\202\001\017\000\060\202\001\012\002\202\001\001\000\212\155
+\113\377\020\210\072\303\366\176\224\350\352\040\144\160\256\041
+\201\276\072\173\074\333\361\035\122\177\131\372\363\042\114\225
+\240\220\274\110\116\021\253\373\267\265\215\172\203\050\214\046
+\106\330\116\225\100\207\141\237\305\236\155\201\207\127\154\212
+\073\264\146\352\314\100\374\343\252\154\262\313\001\333\062\277
+\322\353\205\317\241\015\125\303\133\070\127\160\270\165\306\171
+\321\024\060\355\033\130\133\153\357\065\362\241\041\116\305\316
+\174\231\137\154\271\270\042\223\120\247\315\114\160\152\276\152
+\005\177\023\234\053\036\352\376\107\316\004\245\157\254\223\056
+\174\053\237\236\171\023\221\350\352\236\312\070\165\216\142\260
+\225\223\052\345\337\351\136\227\156\040\137\137\204\172\104\071
+\031\100\034\272\125\053\373\060\262\201\357\204\343\334\354\230
+\070\071\003\205\010\251\124\003\005\051\360\311\217\213\352\013
+\206\145\031\021\323\351\011\043\336\150\223\003\311\066\034\041
+\156\316\214\146\361\231\060\330\327\263\303\035\370\201\056\250
+\275\202\013\146\376\202\313\341\340\032\202\303\100\201\002\003
+\001\000\001\243\102\060\100\060\035\006\003\125\035\016\004\026
+\004\024\275\210\207\311\217\366\244\012\013\252\353\305\376\221
+\043\235\253\112\212\062\060\016\006\003\125\035\017\001\001\377
+\004\004\003\002\001\006\060\017\006\003\125\035\023\001\001\377
+\004\005\060\003\001\001\377\060\015\006\011\052\206\110\206\367
+\015\001\001\005\005\000\003\202\001\001\000\035\174\372\111\217
+\064\351\267\046\222\026\232\005\164\347\113\320\155\071\154\303
+\046\366\316\270\061\274\304\337\274\052\370\067\221\030\334\004
+\310\144\231\053\030\155\200\003\131\311\256\370\130\320\076\355
+\303\043\237\151\074\206\070\034\236\357\332\047\170\321\204\067
+\161\212\074\113\071\317\176\105\006\326\055\330\212\115\170\022
+\326\255\302\323\313\322\320\101\363\046\066\112\233\225\154\014
+\356\345\321\103\047\146\301\210\367\172\263\040\154\352\260\151
+\053\307\040\350\014\003\304\101\005\231\342\077\344\153\370\240
+\206\201\307\204\306\037\325\113\201\022\262\026\041\054\023\241
+\200\262\136\014\112\023\236\040\330\142\100\253\220\352\144\112
+\057\254\015\001\022\171\105\250\057\207\031\150\310\342\205\307
+\060\262\165\371\070\077\262\300\223\264\153\342\003\104\316\147
+\240\337\211\326\255\214\166\243\023\303\224\141\053\153\331\154
+\301\007\012\042\007\205\154\205\044\106\251\276\077\213\170\204
+\202\176\044\014\235\375\201\067\343\045\250\355\066\116\225\054
+\311\234\220\332\354\251\102\074\255\266\002
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for Certificate "TUBITAK UEKAE Kok Sertifika Hizmet Saglayicisi - Surum 3"
+# Issuer: CN=T..B..TAK UEKAE K..k Sertifika Hizmet Sa..lay..c..s.. - S..r..m ...,OU=Kamu Sertifikasyon Merkezi,OU=Ulusal Elektronik ve Kriptoloji Ara..t..rma Enstit..s.. - UEKAE,O=T..rkiye Bilimsel ve Teknolojik Ara..t..rma Kurumu - T..B..TAK,L=Gebze - Kocaeli,C=TR
+# Serial Number: 17 (0x11)
+# Subject: CN=T..B..TAK UEKAE K..k Sertifika Hizmet Sa..lay..c..s.. - S..r..m ...,OU=Kamu Sertifikasyon Merkezi,OU=Ulusal Elektronik ve Kriptoloji Ara..t..rma Enstit..s.. - UEKAE,O=T..rkiye Bilimsel ve Teknolojik Ara..t..rma Kurumu - T..B..TAK,L=Gebze - Kocaeli,C=TR
+# Not Valid Before: Fri Aug 24 11:37:07 2007
+# Not Valid After : Mon Aug 21 11:37:07 2017
+# Fingerprint (MD5): ED:41:F5:8C:50:C5:2B:9C:73:E6:EE:6C:EB:C2:A8:26
+# Fingerprint (SHA1): 1B:4B:39:61:26:27:6B:64:91:A2:68:6D:D7:02:43:21:2D:1F:1D:96
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "T\xc3\x9c\x42\xC4\xB0TAK UEKAE K\xC3\xB6k Sertifika Hizmet Sa\xC4\x9Flay\xc4\xb1\x63\xc4\xb1s\xc4\xb1 - S\xC3\xBCr\xC3\xBCm 3"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\033\113\071\141\046\047\153\144\221\242\150\155\327\002\103\041
+\055\037\035\226
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\355\101\365\214\120\305\053\234\163\346\356\154\353\302\250\046
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\202\001\053\061\013\060\011\006\003\125\004\006\023\002\124
+\122\061\030\060\026\006\003\125\004\007\014\017\107\145\142\172
+\145\040\055\040\113\157\143\141\145\154\151\061\107\060\105\006
+\003\125\004\012\014\076\124\303\274\162\153\151\171\145\040\102
+\151\154\151\155\163\145\154\040\166\145\040\124\145\153\156\157
+\154\157\152\151\153\040\101\162\141\305\237\164\304\261\162\155
+\141\040\113\165\162\165\155\165\040\055\040\124\303\234\102\304
+\260\124\101\113\061\110\060\106\006\003\125\004\013\014\077\125
+\154\165\163\141\154\040\105\154\145\153\164\162\157\156\151\153
+\040\166\145\040\113\162\151\160\164\157\154\157\152\151\040\101
+\162\141\305\237\164\304\261\162\155\141\040\105\156\163\164\151
+\164\303\274\163\303\274\040\055\040\125\105\113\101\105\061\043
+\060\041\006\003\125\004\013\014\032\113\141\155\165\040\123\145
+\162\164\151\146\151\153\141\163\171\157\156\040\115\145\162\153
+\145\172\151\061\112\060\110\006\003\125\004\003\014\101\124\303
+\234\102\304\260\124\101\113\040\125\105\113\101\105\040\113\303
+\266\153\040\123\145\162\164\151\146\151\153\141\040\110\151\172
+\155\145\164\040\123\141\304\237\154\141\171\304\261\143\304\261
+\163\304\261\040\055\040\123\303\274\162\303\274\155\040\063
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\001\021
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
# Certificate "certSIGN ROOT CA"
#
# Issuer: OU=certSIGN ROOT CA,O=certSIGN,C=RO
@@ -9581,6 +10461,172 @@ CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
#
+# Certificate "ACEDICOM Root"
+#
+# Issuer: C=ES,O=EDICOM,OU=PKI,CN=ACEDICOM Root
+# Serial Number:61:8d:c7:86:3b:01:82:05
+# Subject: C=ES,O=EDICOM,OU=PKI,CN=ACEDICOM Root
+# Not Valid Before: Fri Apr 18 16:24:22 2008
+# Not Valid After : Thu Apr 13 16:24:22 2028
+# Fingerprint (MD5): 42:81:A0:E2:1C:E3:55:10:DE:55:89:42:65:96:22:E6
+# Fingerprint (SHA1): E0:B4:32:2E:B2:F6:A5:68:B6:54:53:84:48:18:4A:50:36:87:43:84
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "ACEDICOM Root"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\104\061\026\060\024\006\003\125\004\003\014\015\101\103\105
+\104\111\103\117\115\040\122\157\157\164\061\014\060\012\006\003
+\125\004\013\014\003\120\113\111\061\017\060\015\006\003\125\004
+\012\014\006\105\104\111\103\117\115\061\013\060\011\006\003\125
+\004\006\023\002\105\123
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\104\061\026\060\024\006\003\125\004\003\014\015\101\103\105
+\104\111\103\117\115\040\122\157\157\164\061\014\060\012\006\003
+\125\004\013\014\003\120\113\111\061\017\060\015\006\003\125\004
+\012\014\006\105\104\111\103\117\115\061\013\060\011\006\003\125
+\004\006\023\002\105\123
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\010\141\215\307\206\073\001\202\005
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\005\265\060\202\003\235\240\003\002\001\002\002\010\141
+\215\307\206\073\001\202\005\060\015\006\011\052\206\110\206\367
+\015\001\001\005\005\000\060\104\061\026\060\024\006\003\125\004
+\003\014\015\101\103\105\104\111\103\117\115\040\122\157\157\164
+\061\014\060\012\006\003\125\004\013\014\003\120\113\111\061\017
+\060\015\006\003\125\004\012\014\006\105\104\111\103\117\115\061
+\013\060\011\006\003\125\004\006\023\002\105\123\060\036\027\015
+\060\070\060\064\061\070\061\066\062\064\062\062\132\027\015\062
+\070\060\064\061\063\061\066\062\064\062\062\132\060\104\061\026
+\060\024\006\003\125\004\003\014\015\101\103\105\104\111\103\117
+\115\040\122\157\157\164\061\014\060\012\006\003\125\004\013\014
+\003\120\113\111\061\017\060\015\006\003\125\004\012\014\006\105
+\104\111\103\117\115\061\013\060\011\006\003\125\004\006\023\002
+\105\123\060\202\002\042\060\015\006\011\052\206\110\206\367\015
+\001\001\001\005\000\003\202\002\017\000\060\202\002\012\002\202
+\002\001\000\377\222\225\341\150\006\166\264\054\310\130\110\312
+\375\200\124\051\125\143\044\377\220\145\233\020\165\173\303\152
+\333\142\002\001\362\030\206\265\174\132\070\261\344\130\271\373
+\323\330\055\237\275\062\067\277\054\025\155\276\265\364\041\322
+\023\221\331\007\255\001\005\326\363\275\167\316\137\102\201\012
+\371\152\343\203\000\250\053\056\125\023\143\201\312\107\034\173
+\134\026\127\172\033\203\140\004\072\076\145\303\315\001\336\336
+\244\326\014\272\216\336\331\004\356\027\126\042\233\217\143\375
+\115\026\013\267\173\167\214\371\045\265\321\155\231\022\056\117
+\032\270\346\352\004\222\256\075\021\271\121\102\075\207\260\061
+\205\257\171\132\234\376\347\116\136\222\117\103\374\253\072\255
+\245\022\046\146\271\342\014\327\230\316\324\130\245\225\100\012
+\267\104\235\023\164\053\302\245\353\042\025\230\020\330\213\305
+\004\237\035\217\140\345\006\033\233\317\271\171\240\075\242\043
+\077\102\077\153\372\034\003\173\060\215\316\154\300\277\346\033
+\137\277\147\270\204\031\325\025\357\173\313\220\066\061\142\311
+\274\002\253\106\137\233\376\032\150\224\064\075\220\216\255\366
+\344\035\011\177\112\210\070\077\276\147\375\064\226\365\035\274
+\060\164\313\070\356\325\154\253\324\374\364\000\267\000\133\205
+\062\026\166\063\351\330\243\231\235\005\000\252\026\346\363\201
+\175\157\175\252\206\155\255\025\164\323\304\242\161\252\364\024
+\175\347\062\270\037\274\325\361\116\275\157\027\002\071\327\016
+\225\102\072\307\000\076\351\046\143\021\352\013\321\112\377\030
+\235\262\327\173\057\072\331\226\373\350\036\222\256\023\125\310
+\331\047\366\334\110\033\260\044\301\205\343\167\235\232\244\363
+\014\021\035\015\310\264\024\356\265\202\127\011\277\040\130\177
+\057\042\043\330\160\313\171\154\311\113\362\251\052\310\374\207
+\053\327\032\120\370\047\350\057\103\343\072\275\330\127\161\375
+\316\246\122\133\371\335\115\355\345\366\157\211\355\273\223\234
+\166\041\165\360\222\114\051\367\057\234\001\056\376\120\106\236
+\144\014\024\263\007\133\305\302\163\154\361\007\134\105\044\024
+\065\256\203\361\152\115\211\172\372\263\330\055\146\360\066\207
+\365\053\123\002\003\001\000\001\243\201\252\060\201\247\060\017
+\006\003\125\035\023\001\001\377\004\005\060\003\001\001\377\060
+\037\006\003\125\035\043\004\030\060\026\200\024\246\263\341\053
+\053\111\266\327\163\241\252\224\365\001\347\163\145\114\254\120
+\060\016\006\003\125\035\017\001\001\377\004\004\003\002\001\206
+\060\035\006\003\125\035\016\004\026\004\024\246\263\341\053\053
+\111\266\327\163\241\252\224\365\001\347\163\145\114\254\120\060
+\104\006\003\125\035\040\004\075\060\073\060\071\006\004\125\035
+\040\000\060\061\060\057\006\010\053\006\001\005\005\007\002\001
+\026\043\150\164\164\160\072\057\057\141\143\145\144\151\143\157
+\155\056\145\144\151\143\157\155\147\162\157\165\160\056\143\157
+\155\057\144\157\143\060\015\006\011\052\206\110\206\367\015\001
+\001\005\005\000\003\202\002\001\000\316\054\013\122\121\142\046
+\175\014\047\203\217\305\366\332\240\150\173\117\222\136\352\244
+\163\062\021\123\104\262\104\313\235\354\017\171\102\263\020\246
+\307\015\235\313\266\372\077\072\174\352\277\210\123\033\074\367
+\202\372\005\065\063\341\065\250\127\300\347\375\215\117\077\223
+\062\117\170\146\003\167\007\130\351\225\310\176\076\320\171\000
+\214\362\033\121\063\233\274\224\351\072\173\156\122\055\062\236
+\043\244\105\373\266\056\023\260\213\030\261\335\316\325\035\247
+\102\177\125\276\373\133\273\107\324\374\044\315\004\256\226\005
+\025\326\254\316\060\363\312\013\305\272\342\042\340\246\255\042
+\344\002\356\164\021\177\114\377\170\035\065\332\346\002\064\353
+\030\022\141\167\006\011\026\143\352\030\255\242\207\037\362\307
+\200\011\011\165\116\020\250\217\075\206\270\165\021\300\044\142
+\212\226\173\112\105\351\354\131\305\276\153\203\346\341\350\254
+\265\060\036\376\005\007\200\371\341\043\015\120\217\005\230\377
+\054\137\350\073\266\255\317\201\265\041\207\312\010\052\043\047
+\060\040\053\317\355\224\133\254\262\172\322\307\050\241\212\013
+\233\115\112\054\155\205\077\011\162\074\147\342\331\334\007\272
+\353\145\173\132\001\143\326\220\133\117\027\146\075\177\013\031
+\243\223\143\020\122\052\237\024\026\130\342\334\245\364\241\026
+\213\016\221\213\201\312\233\131\372\330\153\221\007\145\125\137
+\122\037\257\072\373\220\335\151\245\133\234\155\016\054\266\372
+\316\254\245\174\062\112\147\100\334\060\064\043\335\327\004\043
+\146\360\374\125\200\247\373\146\031\202\065\147\142\160\071\136
+\157\307\352\220\100\104\010\036\270\262\326\333\356\131\247\015
+\030\171\064\274\124\030\136\123\312\064\121\355\105\012\346\216
+\307\202\066\076\247\070\143\251\060\054\027\020\140\222\237\125
+\207\022\131\020\302\017\147\151\021\314\116\036\176\112\232\255
+\257\100\250\165\254\126\220\164\270\240\234\245\171\157\334\351
+\032\310\151\005\351\272\372\003\263\174\344\340\116\302\316\235
+\350\266\106\015\156\176\127\072\147\224\302\313\037\234\167\112
+\147\116\151\206\103\223\070\373\266\333\117\203\221\324\140\176
+\113\076\053\070\007\125\230\136\244
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for Certificate "ACEDICOM Root"
+# Issuer: C=ES,O=EDICOM,OU=PKI,CN=ACEDICOM Root
+# Serial Number:61:8d:c7:86:3b:01:82:05
+# Subject: C=ES,O=EDICOM,OU=PKI,CN=ACEDICOM Root
+# Not Valid Before: Fri Apr 18 16:24:22 2008
+# Not Valid After : Thu Apr 13 16:24:22 2028
+# Fingerprint (MD5): 42:81:A0:E2:1C:E3:55:10:DE:55:89:42:65:96:22:E6
+# Fingerprint (SHA1): E0:B4:32:2E:B2:F6:A5:68:B6:54:53:84:48:18:4A:50:36:87:43:84
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "ACEDICOM Root"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\340\264\062\056\262\366\245\150\266\124\123\204\110\030\112\120
+\066\207\103\204
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\102\201\240\342\034\343\125\020\336\125\211\102\145\226\042\346
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\104\061\026\060\024\006\003\125\004\003\014\015\101\103\105
+\104\111\103\117\115\040\122\157\157\164\061\014\060\012\006\003
+\125\004\013\014\003\120\113\111\061\017\060\015\006\003\125\004
+\012\014\006\105\104\111\103\117\115\061\013\060\011\006\003\125
+\004\006\023\002\105\123
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\010\141\215\307\206\073\001\202\005
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+
+#
# Certificate "Microsec e-Szigno Root CA 2009"
#
# Issuer: E=info@e-szigno.hu,CN=Microsec e-Szigno Root CA 2009,O=Microsec Ltd.,L=Budapest,C=HU
@@ -10621,6 +11667,1725 @@ CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
#
+# Certificate "Bogus Mozilla Addons"
+#
+# Issuer: CN=UTN-USERFirst-Hardware,OU=http://www.usertrust.com,O=The USERTRUST Network,L=Salt Lake City,ST=UT,C=US
+# Serial Number:00:92:39:d5:34:8f:40:d1:69:5a:74:54:70:e1:f2:3f:43
+# Subject: CN=addons.mozilla.org,OU=PlatinumSSL,OU=Hosted by GTI Group Corporation,OU=Tech Dept.,O=Google Ltd.,STREET=Sea Village 10,L=English,ST=Florida,postalCode=38477,C=US
+# Not Valid Before: Tue Mar 15 00:00:00 2011
+# Not Valid After : Fri Mar 14 23:59:59 2014
+# Fingerprint (MD5): 84:C5:18:67:1F:2A:1A:90:BE:E2:B1:18:4F:03:00:32
+# Fingerprint (SHA1): 30:5F:8B:D1:7A:A2:CB:C4:83:A4:C4:1B:19:A3:9A:0C:75:DA:39:D6
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Bogus Mozilla Addons"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\201\342\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\016\060\014\006\003\125\004\021\023\005\063\070\064\067\067
+\061\020\060\016\006\003\125\004\010\023\007\106\154\157\162\151
+\144\141\061\020\060\016\006\003\125\004\007\023\007\105\156\147
+\154\151\163\150\061\027\060\025\006\003\125\004\011\023\016\123
+\145\141\040\126\151\154\154\141\147\145\040\061\060\061\024\060
+\022\006\003\125\004\012\023\013\107\157\157\147\154\145\040\114
+\164\144\056\061\023\060\021\006\003\125\004\013\023\012\124\145
+\143\150\040\104\145\160\164\056\061\050\060\046\006\003\125\004
+\013\023\037\110\157\163\164\145\144\040\142\171\040\107\124\111
+\040\107\162\157\165\160\040\103\157\162\160\157\162\141\164\151
+\157\156\061\024\060\022\006\003\125\004\013\023\013\120\154\141
+\164\151\156\165\155\123\123\114\061\033\060\031\006\003\125\004
+\003\023\022\141\144\144\157\156\163\056\155\157\172\151\154\154
+\141\056\157\162\147
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\227\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\013\060\011\006\003\125\004\010\023\002\125\124\061\027\060
+\025\006\003\125\004\007\023\016\123\141\154\164\040\114\141\153
+\145\040\103\151\164\171\061\036\060\034\006\003\125\004\012\023
+\025\124\150\145\040\125\123\105\122\124\122\125\123\124\040\116
+\145\164\167\157\162\153\061\041\060\037\006\003\125\004\013\023
+\030\150\164\164\160\072\057\057\167\167\167\056\165\163\145\162
+\164\162\165\163\164\056\143\157\155\061\037\060\035\006\003\125
+\004\003\023\026\125\124\116\055\125\123\105\122\106\151\162\163
+\164\055\110\141\162\144\167\141\162\145
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\021\000\222\071\325\064\217\100\321\151\132\164\124\160\341
+\362\077\103
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\005\370\060\202\004\340\240\003\002\001\002\002\021\000
+\222\071\325\064\217\100\321\151\132\164\124\160\341\362\077\103
+\060\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060
+\201\227\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\013\060\011\006\003\125\004\010\023\002\125\124\061\027\060\025
+\006\003\125\004\007\023\016\123\141\154\164\040\114\141\153\145
+\040\103\151\164\171\061\036\060\034\006\003\125\004\012\023\025
+\124\150\145\040\125\123\105\122\124\122\125\123\124\040\116\145
+\164\167\157\162\153\061\041\060\037\006\003\125\004\013\023\030
+\150\164\164\160\072\057\057\167\167\167\056\165\163\145\162\164
+\162\165\163\164\056\143\157\155\061\037\060\035\006\003\125\004
+\003\023\026\125\124\116\055\125\123\105\122\106\151\162\163\164
+\055\110\141\162\144\167\141\162\145\060\036\027\015\061\061\060
+\063\061\065\060\060\060\060\060\060\132\027\015\061\064\060\063
+\061\064\062\063\065\071\065\071\132\060\201\342\061\013\060\011
+\006\003\125\004\006\023\002\125\123\061\016\060\014\006\003\125
+\004\021\023\005\063\070\064\067\067\061\020\060\016\006\003\125
+\004\010\023\007\106\154\157\162\151\144\141\061\020\060\016\006
+\003\125\004\007\023\007\105\156\147\154\151\163\150\061\027\060
+\025\006\003\125\004\011\023\016\123\145\141\040\126\151\154\154
+\141\147\145\040\061\060\061\024\060\022\006\003\125\004\012\023
+\013\107\157\157\147\154\145\040\114\164\144\056\061\023\060\021
+\006\003\125\004\013\023\012\124\145\143\150\040\104\145\160\164
+\056\061\050\060\046\006\003\125\004\013\023\037\110\157\163\164
+\145\144\040\142\171\040\107\124\111\040\107\162\157\165\160\040
+\103\157\162\160\157\162\141\164\151\157\156\061\024\060\022\006
+\003\125\004\013\023\013\120\154\141\164\151\156\165\155\123\123
+\114\061\033\060\031\006\003\125\004\003\023\022\141\144\144\157
+\156\163\056\155\157\172\151\154\154\141\056\157\162\147\060\202
+\001\042\060\015\006\011\052\206\110\206\367\015\001\001\001\005
+\000\003\202\001\017\000\060\202\001\012\002\202\001\001\000\253
+\306\155\066\363\025\163\170\203\163\316\164\205\325\256\354\262
+\360\340\044\037\023\203\270\040\254\273\232\376\210\273\253\241
+\035\013\037\105\000\252\111\267\065\067\014\152\357\107\114\271
+\321\276\343\127\022\004\215\222\307\266\354\001\274\266\332\307
+\201\070\040\255\162\205\346\016\374\201\154\007\255\150\166\070
+\305\104\327\314\306\112\305\227\076\144\364\121\346\360\176\262
+\354\126\367\045\202\115\111\230\313\026\230\335\043\361\211\221
+\321\027\227\100\231\046\326\342\242\053\136\337\275\211\362\033
+\032\123\055\314\120\101\172\320\075\052\014\125\160\024\001\351
+\130\111\020\172\013\223\202\213\341\036\355\072\200\020\202\316
+\226\212\064\360\314\327\323\271\264\120\207\125\124\011\270\235
+\102\050\125\000\345\214\065\124\277\335\045\221\106\267\015\345
+\135\203\250\345\213\373\204\344\074\256\166\332\304\103\053\133
+\164\013\370\276\135\150\361\170\133\265\316\175\361\135\231\100
+\332\312\356\070\201\120\276\230\241\154\270\044\255\363\257\214
+\017\327\021\050\054\204\030\114\175\265\331\217\060\265\033\002
+\003\001\000\001\243\202\001\360\060\202\001\354\060\037\006\003
+\125\035\043\004\030\060\026\200\024\241\162\137\046\033\050\230
+\103\225\135\007\067\325\205\226\235\113\322\303\105\060\035\006
+\003\125\035\016\004\026\004\024\335\200\322\124\075\367\114\160
+\312\243\260\335\064\172\062\344\350\073\132\073\060\016\006\003
+\125\035\017\001\001\377\004\004\003\002\005\240\060\014\006\003
+\125\035\023\001\001\377\004\002\060\000\060\035\006\003\125\035
+\045\004\026\060\024\006\010\053\006\001\005\005\007\003\001\006
+\010\053\006\001\005\005\007\003\002\060\106\006\003\125\035\040
+\004\077\060\075\060\073\006\014\053\006\001\004\001\262\061\001
+\002\001\003\004\060\053\060\051\006\010\053\006\001\005\005\007
+\002\001\026\035\150\164\164\160\163\072\057\057\163\145\143\165
+\162\145\056\143\157\155\157\144\157\056\143\157\155\057\103\120
+\123\060\173\006\003\125\035\037\004\164\060\162\060\070\240\066
+\240\064\206\062\150\164\164\160\072\057\057\143\162\154\056\143
+\157\155\157\144\157\143\141\056\143\157\155\057\125\124\116\055
+\125\123\105\122\106\151\162\163\164\055\110\141\162\144\167\141
+\162\145\056\143\162\154\060\066\240\064\240\062\206\060\150\164
+\164\160\072\057\057\143\162\154\056\143\157\155\157\144\157\056
+\156\145\164\057\125\124\116\055\125\123\105\122\106\151\162\163
+\164\055\110\141\162\144\167\141\162\145\056\143\162\154\060\161
+\006\010\053\006\001\005\005\007\001\001\004\145\060\143\060\073
+\006\010\053\006\001\005\005\007\060\002\206\057\150\164\164\160
+\072\057\057\143\162\164\056\143\157\155\157\144\157\143\141\056
+\143\157\155\057\125\124\116\101\144\144\124\162\165\163\164\123
+\145\162\166\145\162\103\101\056\143\162\164\060\044\006\010\053
+\006\001\005\005\007\060\001\206\030\150\164\164\160\072\057\057
+\157\143\163\160\056\143\157\155\157\144\157\143\141\056\143\157
+\155\060\065\006\003\125\035\021\004\056\060\054\202\022\141\144
+\144\157\156\163\056\155\157\172\151\154\154\141\056\157\162\147
+\202\026\167\167\167\056\141\144\144\157\156\163\056\155\157\172
+\151\154\154\141\056\157\162\147\060\015\006\011\052\206\110\206
+\367\015\001\001\005\005\000\003\202\001\001\000\063\073\143\025
+\374\261\354\024\054\223\335\165\224\336\201\132\331\116\231\276
+\373\112\244\071\125\115\241\100\172\336\023\052\207\251\067\317
+\350\325\373\255\321\173\155\157\214\040\207\202\124\346\127\111
+\274\040\050\204\315\326\001\331\223\213\027\156\043\146\345\204
+\310\200\077\306\241\160\200\344\354\115\035\371\374\221\132\163
+\142\051\232\367\040\034\141\340\213\071\237\312\274\176\215\335
+\274\331\261\343\237\236\337\025\123\221\041\122\013\331\032\043
+\017\146\066\333\254\223\226\112\243\245\042\317\051\367\242\231
+\250\366\266\331\100\256\331\176\266\366\130\056\233\254\066\312
+\144\217\145\122\334\206\234\202\253\156\120\113\332\137\372\005
+\000\210\060\016\336\215\126\277\201\107\215\075\006\342\262\142
+\222\147\217\236\310\232\262\345\006\270\160\044\270\167\174\043
+\012\070\303\171\010\330\261\121\235\254\225\021\307\100\027\236
+\243\034\217\362\021\247\150\047\332\111\005\204\030\174\130\055
+\001\147\134\345\237\241\051\273\112\071\105\057\277\021\252\171
+\242\355\264\324\265\145\103\267\223\106\212\323
+END
+
+# Trust for Certificate "Bogus Mozilla Addons"
+# Issuer: CN=UTN-USERFirst-Hardware,OU=http://www.usertrust.com,O=The USERTRUST Network,L=Salt Lake City,ST=UT,C=US
+# Serial Number:00:92:39:d5:34:8f:40:d1:69:5a:74:54:70:e1:f2:3f:43
+# Subject: CN=addons.mozilla.org,OU=PlatinumSSL,OU=Hosted by GTI Group Corporation,OU=Tech Dept.,O=Google Ltd.,STREET=Sea Village 10,L=English,ST=Florida,postalCode=38477,C=US
+# Not Valid Before: Tue Mar 15 00:00:00 2011
+# Not Valid After : Fri Mar 14 23:59:59 2014
+# Fingerprint (MD5): 84:C5:18:67:1F:2A:1A:90:BE:E2:B1:18:4F:03:00:32
+# Fingerprint (SHA1): 30:5F:8B:D1:7A:A2:CB:C4:83:A4:C4:1B:19:A3:9A:0C:75:DA:39:D6
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Bogus Mozilla Addons"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\060\137\213\321\172\242\313\304\203\244\304\033\031\243\232\014
+\165\332\071\326
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\204\305\030\147\037\052\032\220\276\342\261\030\117\003\000\062
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\227\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\013\060\011\006\003\125\004\010\023\002\125\124\061\027\060
+\025\006\003\125\004\007\023\016\123\141\154\164\040\114\141\153
+\145\040\103\151\164\171\061\036\060\034\006\003\125\004\012\023
+\025\124\150\145\040\125\123\105\122\124\122\125\123\124\040\116
+\145\164\167\157\162\153\061\041\060\037\006\003\125\004\013\023
+\030\150\164\164\160\072\057\057\167\167\167\056\165\163\145\162
+\164\162\165\163\164\056\143\157\155\061\037\060\035\006\003\125
+\004\003\023\026\125\124\116\055\125\123\105\122\106\151\162\163
+\164\055\110\141\162\144\167\141\162\145
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\021\000\222\071\325\064\217\100\321\151\132\164\124\160\341
+\362\077\103
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "Bogus Global Trustee"
+#
+# Issuer: CN=UTN-USERFirst-Hardware,OU=http://www.usertrust.com,O=The USERTRUST Network,L=Salt Lake City,ST=UT,C=US
+# Serial Number:00:d8:f3:5f:4e:b7:87:2b:2d:ab:06:92:e3:15:38:2f:b0
+# Subject: CN=global trustee,OU=PlatinumSSL,OU=Hosted by GTI Group Corporation,OU=Global Trustee,O=Global Trustee,STREET=Sea Village 10,L=Tampa,ST=Florida,postalCode=38477,C=US
+# Not Valid Before: Tue Mar 15 00:00:00 2011
+# Not Valid After : Fri Mar 14 23:59:59 2014
+# Fingerprint (MD5): FE:0D:01:6E:71:CB:8C:D8:3F:0E:0C:CD:49:35:B8:57
+# Fingerprint (SHA1): 61:79:3F:CB:FA:4F:90:08:30:9B:BA:5F:F1:2D:2C:B2:9C:D4:15:1A
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Bogus Global Trustee"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\201\343\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\016\060\014\006\003\125\004\021\023\005\063\070\064\067\067
+\061\020\060\016\006\003\125\004\010\023\007\106\154\157\162\151
+\144\141\061\016\060\014\006\003\125\004\007\023\005\124\141\155
+\160\141\061\027\060\025\006\003\125\004\011\023\016\123\145\141
+\040\126\151\154\154\141\147\145\040\061\060\061\027\060\025\006
+\003\125\004\012\023\016\107\154\157\142\141\154\040\124\162\165
+\163\164\145\145\061\027\060\025\006\003\125\004\013\023\016\107
+\154\157\142\141\154\040\124\162\165\163\164\145\145\061\050\060
+\046\006\003\125\004\013\023\037\110\157\163\164\145\144\040\142
+\171\040\107\124\111\040\107\162\157\165\160\040\103\157\162\160
+\157\162\141\164\151\157\156\061\024\060\022\006\003\125\004\013
+\023\013\120\154\141\164\151\156\165\155\123\123\114\061\027\060
+\025\006\003\125\004\003\023\016\147\154\157\142\141\154\040\164
+\162\165\163\164\145\145
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\227\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\013\060\011\006\003\125\004\010\023\002\125\124\061\027\060
+\025\006\003\125\004\007\023\016\123\141\154\164\040\114\141\153
+\145\040\103\151\164\171\061\036\060\034\006\003\125\004\012\023
+\025\124\150\145\040\125\123\105\122\124\122\125\123\124\040\116
+\145\164\167\157\162\153\061\041\060\037\006\003\125\004\013\023
+\030\150\164\164\160\072\057\057\167\167\167\056\165\163\145\162
+\164\162\165\163\164\056\143\157\155\061\037\060\035\006\003\125
+\004\003\023\026\125\124\116\055\125\123\105\122\106\151\162\163
+\164\055\110\141\162\144\167\141\162\145
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\021\000\330\363\137\116\267\207\053\055\253\006\222\343\025
+\070\057\260
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\006\335\060\202\005\305\240\003\002\001\002\002\021\000
+\330\363\137\116\267\207\053\055\253\006\222\343\025\070\057\260
+\060\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060
+\201\227\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\013\060\011\006\003\125\004\010\023\002\125\124\061\027\060\025
+\006\003\125\004\007\023\016\123\141\154\164\040\114\141\153\145
+\040\103\151\164\171\061\036\060\034\006\003\125\004\012\023\025
+\124\150\145\040\125\123\105\122\124\122\125\123\124\040\116\145
+\164\167\157\162\153\061\041\060\037\006\003\125\004\013\023\030
+\150\164\164\160\072\057\057\167\167\167\056\165\163\145\162\164
+\162\165\163\164\056\143\157\155\061\037\060\035\006\003\125\004
+\003\023\026\125\124\116\055\125\123\105\122\106\151\162\163\164
+\055\110\141\162\144\167\141\162\145\060\036\027\015\061\061\060
+\063\061\065\060\060\060\060\060\060\132\027\015\061\064\060\063
+\061\064\062\063\065\071\065\071\132\060\201\343\061\013\060\011
+\006\003\125\004\006\023\002\125\123\061\016\060\014\006\003\125
+\004\021\023\005\063\070\064\067\067\061\020\060\016\006\003\125
+\004\010\023\007\106\154\157\162\151\144\141\061\016\060\014\006
+\003\125\004\007\023\005\124\141\155\160\141\061\027\060\025\006
+\003\125\004\011\023\016\123\145\141\040\126\151\154\154\141\147
+\145\040\061\060\061\027\060\025\006\003\125\004\012\023\016\107
+\154\157\142\141\154\040\124\162\165\163\164\145\145\061\027\060
+\025\006\003\125\004\013\023\016\107\154\157\142\141\154\040\124
+\162\165\163\164\145\145\061\050\060\046\006\003\125\004\013\023
+\037\110\157\163\164\145\144\040\142\171\040\107\124\111\040\107
+\162\157\165\160\040\103\157\162\160\157\162\141\164\151\157\156
+\061\024\060\022\006\003\125\004\013\023\013\120\154\141\164\151
+\156\165\155\123\123\114\061\027\060\025\006\003\125\004\003\023
+\016\147\154\157\142\141\154\040\164\162\165\163\164\145\145\060
+\202\002\042\060\015\006\011\052\206\110\206\367\015\001\001\001
+\005\000\003\202\002\017\000\060\202\002\012\002\202\002\001\000
+\331\164\362\252\101\035\337\365\302\026\103\111\134\051\277\266
+\211\164\051\274\234\215\014\106\117\131\176\262\101\027\146\064
+\014\145\211\341\154\045\343\206\012\236\042\105\042\214\335\235
+\346\243\225\336\334\210\002\125\134\343\133\221\165\353\046\151
+\143\271\056\306\312\056\047\337\210\272\002\040\156\376\271\013
+\051\327\247\326\327\110\032\034\316\335\037\251\047\016\142\117
+\241\226\036\335\124\072\064\143\112\166\365\167\175\131\147\330
+\020\324\265\017\072\103\042\230\333\364\011\304\012\160\316\335
+\220\324\057\357\164\023\303\315\302\211\071\142\025\235\346\164
+\250\350\233\360\143\156\234\211\266\016\255\233\367\314\202\350
+\350\055\270\013\332\042\354\111\205\007\210\231\230\077\364\164
+\251\011\367\201\174\227\013\131\231\030\162\213\333\224\202\053
+\247\350\252\153\227\277\210\176\165\260\213\105\105\014\307\250
+\011\352\033\101\130\060\073\137\170\145\025\064\322\344\074\064
+\015\035\330\144\074\212\245\126\111\231\050\055\113\362\317\315
+\331\156\111\144\233\251\171\220\167\125\251\010\033\255\032\164
+\236\340\003\223\012\011\267\255\247\264\134\357\203\154\267\232
+\264\306\150\100\200\035\102\321\156\171\233\251\031\041\232\234
+\371\206\055\000\321\064\376\340\266\371\125\266\365\046\305\225
+\026\245\174\163\237\012\051\211\254\072\230\367\233\164\147\267
+\220\267\135\011\043\152\152\355\054\020\356\123\012\020\360\026
+\037\127\263\261\015\171\221\031\260\353\315\060\077\240\024\137
+\263\306\375\134\063\247\260\377\230\260\125\214\271\245\362\157
+\107\044\111\041\151\314\102\242\121\000\100\205\214\202\202\253
+\062\245\313\232\334\320\331\030\015\337\031\364\257\203\015\301
+\076\061\333\044\110\266\165\200\241\341\311\167\144\036\247\345
+\213\177\025\115\113\247\302\320\355\171\225\136\221\061\354\030
+\377\116\237\110\024\352\165\272\041\316\051\166\351\037\116\121
+\207\056\263\314\004\140\272\043\037\037\145\262\012\270\325\156
+\217\113\102\211\107\251\201\220\133\053\262\266\256\346\240\160
+\173\170\220\012\172\305\345\347\305\373\012\366\057\151\214\214
+\037\127\340\006\231\377\021\325\122\062\040\227\047\230\356\145
+\002\003\001\000\001\243\202\001\324\060\202\001\320\060\037\006
+\003\125\035\043\004\030\060\026\200\024\241\162\137\046\033\050
+\230\103\225\135\007\067\325\205\226\235\113\322\303\105\060\035
+\006\003\125\035\016\004\026\004\024\267\303\336\032\103\355\101
+\227\251\217\051\170\234\003\271\254\100\102\000\254\060\016\006
+\003\125\035\017\001\001\377\004\004\003\002\005\240\060\014\006
+\003\125\035\023\001\001\377\004\002\060\000\060\035\006\003\125
+\035\045\004\026\060\024\006\010\053\006\001\005\005\007\003\001
+\006\010\053\006\001\005\005\007\003\002\060\106\006\003\125\035
+\040\004\077\060\075\060\073\006\014\053\006\001\004\001\262\061
+\001\002\001\003\004\060\053\060\051\006\010\053\006\001\005\005
+\007\002\001\026\035\150\164\164\160\163\072\057\057\163\145\143
+\165\162\145\056\143\157\155\157\144\157\056\143\157\155\057\103
+\120\123\060\173\006\003\125\035\037\004\164\060\162\060\070\240
+\066\240\064\206\062\150\164\164\160\072\057\057\143\162\154\056
+\143\157\155\157\144\157\143\141\056\143\157\155\057\125\124\116
+\055\125\123\105\122\106\151\162\163\164\055\110\141\162\144\167
+\141\162\145\056\143\162\154\060\066\240\064\240\062\206\060\150
+\164\164\160\072\057\057\143\162\154\056\143\157\155\157\144\157
+\056\156\145\164\057\125\124\116\055\125\123\105\122\106\151\162
+\163\164\055\110\141\162\144\167\141\162\145\056\143\162\154\060
+\161\006\010\053\006\001\005\005\007\001\001\004\145\060\143\060
+\073\006\010\053\006\001\005\005\007\060\002\206\057\150\164\164
+\160\072\057\057\143\162\164\056\143\157\155\157\144\157\143\141
+\056\143\157\155\057\125\124\116\101\144\144\124\162\165\163\164
+\123\145\162\166\145\162\103\101\056\143\162\164\060\044\006\010
+\053\006\001\005\005\007\060\001\206\030\150\164\164\160\072\057
+\057\157\143\163\160\056\143\157\155\157\144\157\143\141\056\143
+\157\155\060\031\006\003\125\035\021\004\022\060\020\202\016\147
+\154\157\142\141\154\040\164\162\165\163\164\145\145\060\015\006
+\011\052\206\110\206\367\015\001\001\005\005\000\003\202\001\001
+\000\217\272\165\272\071\324\046\323\160\017\304\263\002\247\305
+\022\043\161\311\376\143\351\243\142\170\044\104\117\324\271\021
+\076\037\307\050\347\125\153\356\364\341\000\221\206\212\311\011
+\153\237\056\244\105\071\321\141\142\136\223\245\005\105\170\237
+\140\022\054\364\154\145\145\015\314\106\064\213\050\272\240\306
+\364\231\161\144\363\042\166\254\117\363\142\311\247\063\132\007
+\037\075\311\206\200\334\333\004\057\207\047\350\277\110\104\201
+\300\360\111\043\156\037\345\344\003\206\044\023\242\205\142\174
+\130\004\312\346\215\023\162\012\272\126\104\242\017\274\373\240
+\075\015\052\177\373\236\251\011\075\267\132\324\212\215\341\045
+\350\244\011\204\160\255\022\104\271\317\271\063\172\272\134\346
+\113\246\273\005\006\230\377\362\230\122\173\167\200\047\112\331
+\342\372\271\122\324\373\373\346\326\055\236\217\301\025\104\215
+\233\164\057\356\224\132\116\323\304\213\212\254\103\235\163\366
+\256\014\207\211\255\207\311\311\307\335\272\024\140\172\370\265
+\065\235\302\215\306\226\201\015\251\122\212\051\100\004\351\031
+\264
+END
+
+# Trust for Certificate "Bogus Global Trustee"
+# Issuer: CN=UTN-USERFirst-Hardware,OU=http://www.usertrust.com,O=The USERTRUST Network,L=Salt Lake City,ST=UT,C=US
+# Serial Number:00:d8:f3:5f:4e:b7:87:2b:2d:ab:06:92:e3:15:38:2f:b0
+# Subject: CN=global trustee,OU=PlatinumSSL,OU=Hosted by GTI Group Corporation,OU=Global Trustee,O=Global Trustee,STREET=Sea Village 10,L=Tampa,ST=Florida,postalCode=38477,C=US
+# Not Valid Before: Tue Mar 15 00:00:00 2011
+# Not Valid After : Fri Mar 14 23:59:59 2014
+# Fingerprint (MD5): FE:0D:01:6E:71:CB:8C:D8:3F:0E:0C:CD:49:35:B8:57
+# Fingerprint (SHA1): 61:79:3F:CB:FA:4F:90:08:30:9B:BA:5F:F1:2D:2C:B2:9C:D4:15:1A
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Bogus Global Trustee"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\141\171\077\313\372\117\220\010\060\233\272\137\361\055\054\262
+\234\324\025\032
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\376\015\001\156\161\313\214\330\077\016\014\315\111\065\270\127
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\227\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\013\060\011\006\003\125\004\010\023\002\125\124\061\027\060
+\025\006\003\125\004\007\023\016\123\141\154\164\040\114\141\153
+\145\040\103\151\164\171\061\036\060\034\006\003\125\004\012\023
+\025\124\150\145\040\125\123\105\122\124\122\125\123\124\040\116
+\145\164\167\157\162\153\061\041\060\037\006\003\125\004\013\023
+\030\150\164\164\160\072\057\057\167\167\167\056\165\163\145\162
+\164\162\165\163\164\056\143\157\155\061\037\060\035\006\003\125
+\004\003\023\026\125\124\116\055\125\123\105\122\106\151\162\163
+\164\055\110\141\162\144\167\141\162\145
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\021\000\330\363\137\116\267\207\053\055\253\006\222\343\025
+\070\057\260
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "Bogus GMail"
+#
+# Issuer: CN=UTN-USERFirst-Hardware,OU=http://www.usertrust.com,O=The USERTRUST Network,L=Salt Lake City,ST=UT,C=US
+# Serial Number:04:7e:cb:e9:fc:a5:5f:7b:d0:9e:ae:36:e1:0c:ae:1e
+# Subject: CN=mail.google.com,OU=PlatinumSSL,OU=Hosted by GTI Group Corporation,OU=Tech Dept.,O=Google Ltd.,STREET=Sea Village 10,L=English,ST=Florida,postalCode=38477,C=US
+# Not Valid Before: Tue Mar 15 00:00:00 2011
+# Not Valid After : Fri Mar 14 23:59:59 2014
+# Fingerprint (MD5): 4C:77:1F:EB:CA:31:C1:29:98:E9:2C:10:B3:AF:49:1C
+# Fingerprint (SHA1): 64:31:72:30:36:FD:26:DE:A5:02:79:2F:A5:95:92:24:93:03:0F:97
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Bogus GMail"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\201\337\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\016\060\014\006\003\125\004\021\023\005\063\070\064\067\067
+\061\020\060\016\006\003\125\004\010\023\007\106\154\157\162\151
+\144\141\061\020\060\016\006\003\125\004\007\023\007\105\156\147
+\154\151\163\150\061\027\060\025\006\003\125\004\011\023\016\123
+\145\141\040\126\151\154\154\141\147\145\040\061\060\061\024\060
+\022\006\003\125\004\012\023\013\107\157\157\147\154\145\040\114
+\164\144\056\061\023\060\021\006\003\125\004\013\023\012\124\145
+\143\150\040\104\145\160\164\056\061\050\060\046\006\003\125\004
+\013\023\037\110\157\163\164\145\144\040\142\171\040\107\124\111
+\040\107\162\157\165\160\040\103\157\162\160\157\162\141\164\151
+\157\156\061\024\060\022\006\003\125\004\013\023\013\120\154\141
+\164\151\156\165\155\123\123\114\061\030\060\026\006\003\125\004
+\003\023\017\155\141\151\154\056\147\157\157\147\154\145\056\143
+\157\155
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\227\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\013\060\011\006\003\125\004\010\023\002\125\124\061\027\060
+\025\006\003\125\004\007\023\016\123\141\154\164\040\114\141\153
+\145\040\103\151\164\171\061\036\060\034\006\003\125\004\012\023
+\025\124\150\145\040\125\123\105\122\124\122\125\123\124\040\116
+\145\164\167\157\162\153\061\041\060\037\006\003\125\004\013\023
+\030\150\164\164\160\072\057\057\167\167\167\056\165\163\145\162
+\164\162\165\163\164\056\143\157\155\061\037\060\035\006\003\125
+\004\003\023\026\125\124\116\055\125\123\105\122\106\151\162\163
+\164\055\110\141\162\144\167\141\162\145
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\020\004\176\313\351\374\245\137\173\320\236\256\066\341\014
+\256\036
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\005\356\060\202\004\326\240\003\002\001\002\002\020\004
+\176\313\351\374\245\137\173\320\236\256\066\341\014\256\036\060
+\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060\201
+\227\061\013\060\011\006\003\125\004\006\023\002\125\123\061\013
+\060\011\006\003\125\004\010\023\002\125\124\061\027\060\025\006
+\003\125\004\007\023\016\123\141\154\164\040\114\141\153\145\040
+\103\151\164\171\061\036\060\034\006\003\125\004\012\023\025\124
+\150\145\040\125\123\105\122\124\122\125\123\124\040\116\145\164
+\167\157\162\153\061\041\060\037\006\003\125\004\013\023\030\150
+\164\164\160\072\057\057\167\167\167\056\165\163\145\162\164\162
+\165\163\164\056\143\157\155\061\037\060\035\006\003\125\004\003
+\023\026\125\124\116\055\125\123\105\122\106\151\162\163\164\055
+\110\141\162\144\167\141\162\145\060\036\027\015\061\061\060\063
+\061\065\060\060\060\060\060\060\132\027\015\061\064\060\063\061
+\064\062\063\065\071\065\071\132\060\201\337\061\013\060\011\006
+\003\125\004\006\023\002\125\123\061\016\060\014\006\003\125\004
+\021\023\005\063\070\064\067\067\061\020\060\016\006\003\125\004
+\010\023\007\106\154\157\162\151\144\141\061\020\060\016\006\003
+\125\004\007\023\007\105\156\147\154\151\163\150\061\027\060\025
+\006\003\125\004\011\023\016\123\145\141\040\126\151\154\154\141
+\147\145\040\061\060\061\024\060\022\006\003\125\004\012\023\013
+\107\157\157\147\154\145\040\114\164\144\056\061\023\060\021\006
+\003\125\004\013\023\012\124\145\143\150\040\104\145\160\164\056
+\061\050\060\046\006\003\125\004\013\023\037\110\157\163\164\145
+\144\040\142\171\040\107\124\111\040\107\162\157\165\160\040\103
+\157\162\160\157\162\141\164\151\157\156\061\024\060\022\006\003
+\125\004\013\023\013\120\154\141\164\151\156\165\155\123\123\114
+\061\030\060\026\006\003\125\004\003\023\017\155\141\151\154\056
+\147\157\157\147\154\145\056\143\157\155\060\202\001\042\060\015
+\006\011\052\206\110\206\367\015\001\001\001\005\000\003\202\001
+\017\000\060\202\001\012\002\202\001\001\000\260\163\360\362\004
+\356\302\242\106\312\064\052\252\273\140\043\321\021\166\037\037
+\072\320\145\203\116\232\105\250\103\160\205\166\360\037\207\000
+\002\037\156\073\027\027\304\265\351\031\106\242\222\045\215\142
+\052\264\143\060\037\271\205\370\065\341\026\132\166\111\314\120
+\110\123\071\131\211\326\204\002\373\232\354\033\307\121\325\166
+\225\220\324\072\052\270\246\336\002\115\006\373\315\355\245\106
+\101\137\125\164\345\354\176\100\334\120\234\265\344\065\135\036
+\150\040\370\351\336\243\152\050\277\101\322\241\263\342\045\215
+\014\033\312\075\223\014\030\256\337\305\274\375\274\202\272\150
+\000\327\026\062\161\237\145\265\021\332\150\131\320\246\127\144
+\033\311\376\230\345\365\245\145\352\341\333\356\364\263\235\263
+\216\352\207\256\026\322\036\240\174\174\151\077\051\026\205\001
+\123\247\154\361\140\253\335\242\374\045\107\324\062\321\022\335
+\367\110\022\340\374\234\242\167\230\351\211\231\270\370\070\361
+\214\006\302\172\043\066\155\233\235\315\060\310\307\064\027\036
+\273\175\102\310\253\347\025\026\366\163\265\002\003\001\000\001
+\243\202\001\352\060\202\001\346\060\037\006\003\125\035\043\004
+\030\060\026\200\024\241\162\137\046\033\050\230\103\225\135\007
+\067\325\205\226\235\113\322\303\105\060\035\006\003\125\035\016
+\004\026\004\024\030\052\242\310\324\172\077\173\255\004\213\275
+\157\236\020\106\023\170\161\235\060\016\006\003\125\035\017\001
+\001\377\004\004\003\002\005\240\060\014\006\003\125\035\023\001
+\001\377\004\002\060\000\060\035\006\003\125\035\045\004\026\060
+\024\006\010\053\006\001\005\005\007\003\001\006\010\053\006\001
+\005\005\007\003\002\060\106\006\003\125\035\040\004\077\060\075
+\060\073\006\014\053\006\001\004\001\262\061\001\002\001\003\004
+\060\053\060\051\006\010\053\006\001\005\005\007\002\001\026\035
+\150\164\164\160\163\072\057\057\163\145\143\165\162\145\056\143
+\157\155\157\144\157\056\143\157\155\057\103\120\123\060\173\006
+\003\125\035\037\004\164\060\162\060\070\240\066\240\064\206\062
+\150\164\164\160\072\057\057\143\162\154\056\143\157\155\157\144
+\157\143\141\056\143\157\155\057\125\124\116\055\125\123\105\122
+\106\151\162\163\164\055\110\141\162\144\167\141\162\145\056\143
+\162\154\060\066\240\064\240\062\206\060\150\164\164\160\072\057
+\057\143\162\154\056\143\157\155\157\144\157\056\156\145\164\057
+\125\124\116\055\125\123\105\122\106\151\162\163\164\055\110\141
+\162\144\167\141\162\145\056\143\162\154\060\161\006\010\053\006
+\001\005\005\007\001\001\004\145\060\143\060\073\006\010\053\006
+\001\005\005\007\060\002\206\057\150\164\164\160\072\057\057\143
+\162\164\056\143\157\155\157\144\157\143\141\056\143\157\155\057
+\125\124\116\101\144\144\124\162\165\163\164\123\145\162\166\145
+\162\103\101\056\143\162\164\060\044\006\010\053\006\001\005\005
+\007\060\001\206\030\150\164\164\160\072\057\057\157\143\163\160
+\056\143\157\155\157\144\157\143\141\056\143\157\155\060\057\006
+\003\125\035\021\004\050\060\046\202\017\155\141\151\154\056\147
+\157\157\147\154\145\056\143\157\155\202\023\167\167\167\056\155
+\141\151\154\056\147\157\157\147\154\145\056\143\157\155\060\015
+\006\011\052\206\110\206\367\015\001\001\005\005\000\003\202\001
+\001\000\147\006\010\012\047\305\223\156\002\362\336\027\077\320
+\323\033\174\377\265\315\172\307\167\307\276\337\022\312\031\336
+\260\023\127\014\003\221\304\171\122\317\177\267\136\125\040\204
+\111\335\365\320\051\057\016\004\332\131\236\016\023\237\364\300
+\062\233\377\241\021\044\052\227\243\362\077\075\052\153\250\255
+\214\031\165\225\016\035\045\375\117\304\172\025\303\035\307\023
+\100\310\015\276\227\140\162\246\376\045\276\217\354\325\246\206
+\303\041\134\131\122\331\152\013\134\237\113\336\265\371\354\342
+\364\305\314\142\123\166\211\145\344\051\332\267\277\226\340\140
+\215\015\267\011\125\326\100\125\035\301\362\226\041\165\257\211
+\206\037\135\201\227\051\050\036\051\327\226\301\040\003\062\173
+\000\073\152\067\027\132\243\263\032\157\062\073\156\361\243\135
+\253\253\314\052\313\060\014\037\065\043\213\151\104\134\352\254
+\050\140\355\253\153\143\236\366\222\274\275\232\132\046\114\305
+\230\270\016\031\076\374\005\061\343\026\331\375\220\005\003\206
+\306\127\001\037\177\170\240\317\063\152\252\146\153\042\320\247
+\111\043
+END
+
+# Trust for Certificate "Bogus GMail"
+# Issuer: CN=UTN-USERFirst-Hardware,OU=http://www.usertrust.com,O=The USERTRUST Network,L=Salt Lake City,ST=UT,C=US
+# Serial Number:04:7e:cb:e9:fc:a5:5f:7b:d0:9e:ae:36:e1:0c:ae:1e
+# Subject: CN=mail.google.com,OU=PlatinumSSL,OU=Hosted by GTI Group Corporation,OU=Tech Dept.,O=Google Ltd.,STREET=Sea Village 10,L=English,ST=Florida,postalCode=38477,C=US
+# Not Valid Before: Tue Mar 15 00:00:00 2011
+# Not Valid After : Fri Mar 14 23:59:59 2014
+# Fingerprint (MD5): 4C:77:1F:EB:CA:31:C1:29:98:E9:2C:10:B3:AF:49:1C
+# Fingerprint (SHA1): 64:31:72:30:36:FD:26:DE:A5:02:79:2F:A5:95:92:24:93:03:0F:97
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Bogus GMail"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\144\061\162\060\066\375\046\336\245\002\171\057\245\225\222\044
+\223\003\017\227
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\114\167\037\353\312\061\301\051\230\351\054\020\263\257\111\034
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\227\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\013\060\011\006\003\125\004\010\023\002\125\124\061\027\060
+\025\006\003\125\004\007\023\016\123\141\154\164\040\114\141\153
+\145\040\103\151\164\171\061\036\060\034\006\003\125\004\012\023
+\025\124\150\145\040\125\123\105\122\124\122\125\123\124\040\116
+\145\164\167\157\162\153\061\041\060\037\006\003\125\004\013\023
+\030\150\164\164\160\072\057\057\167\167\167\056\165\163\145\162
+\164\162\165\163\164\056\143\157\155\061\037\060\035\006\003\125
+\004\003\023\026\125\124\116\055\125\123\105\122\106\151\162\163
+\164\055\110\141\162\144\167\141\162\145
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\020\004\176\313\351\374\245\137\173\320\236\256\066\341\014
+\256\036
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "Bogus Google"
+#
+# Issuer: CN=UTN-USERFirst-Hardware,OU=http://www.usertrust.com,O=The USERTRUST Network,L=Salt Lake City,ST=UT,C=US
+# Serial Number:00:f5:c8:6a:f3:61:62:f1:3a:64:f5:4f:6d:c9:58:7c:06
+# Subject: CN=www.google.com,OU=PlatinumSSL,OU=Hosted by GTI Group Corporation,OU=Tech Dept.,O=Google Ltd.,STREET=Sea Village 10,L=English,ST=Florida,postalCode=38477,C=US
+# Not Valid Before: Tue Mar 15 00:00:00 2011
+# Not Valid After : Fri Mar 14 23:59:59 2014
+# Fingerprint (MD5): 01:73:A9:58:F0:BC:C9:BE:94:2B:1A:4C:98:24:E3:B8
+# Fingerprint (SHA1): 19:16:A2:AF:34:6D:39:9F:50:31:3C:39:32:00:F1:41:40:45:66:16
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Bogus Google"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\201\336\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\016\060\014\006\003\125\004\021\023\005\063\070\064\067\067
+\061\020\060\016\006\003\125\004\010\023\007\106\154\157\162\151
+\144\141\061\020\060\016\006\003\125\004\007\023\007\105\156\147
+\154\151\163\150\061\027\060\025\006\003\125\004\011\023\016\123
+\145\141\040\126\151\154\154\141\147\145\040\061\060\061\024\060
+\022\006\003\125\004\012\023\013\107\157\157\147\154\145\040\114
+\164\144\056\061\023\060\021\006\003\125\004\013\023\012\124\145
+\143\150\040\104\145\160\164\056\061\050\060\046\006\003\125\004
+\013\023\037\110\157\163\164\145\144\040\142\171\040\107\124\111
+\040\107\162\157\165\160\040\103\157\162\160\157\162\141\164\151
+\157\156\061\024\060\022\006\003\125\004\013\023\013\120\154\141
+\164\151\156\165\155\123\123\114\061\027\060\025\006\003\125\004
+\003\023\016\167\167\167\056\147\157\157\147\154\145\056\143\157
+\155
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\227\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\013\060\011\006\003\125\004\010\023\002\125\124\061\027\060
+\025\006\003\125\004\007\023\016\123\141\154\164\040\114\141\153
+\145\040\103\151\164\171\061\036\060\034\006\003\125\004\012\023
+\025\124\150\145\040\125\123\105\122\124\122\125\123\124\040\116
+\145\164\167\157\162\153\061\041\060\037\006\003\125\004\013\023
+\030\150\164\164\160\072\057\057\167\167\167\056\165\163\145\162
+\164\162\165\163\164\056\143\157\155\061\037\060\035\006\003\125
+\004\003\023\026\125\124\116\055\125\123\105\122\106\151\162\163
+\164\055\110\141\162\144\167\141\162\145
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\021\000\365\310\152\363\141\142\361\072\144\365\117\155\311
+\130\174\006
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\005\344\060\202\004\314\240\003\002\001\002\002\021\000
+\365\310\152\363\141\142\361\072\144\365\117\155\311\130\174\006
+\060\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060
+\201\227\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\013\060\011\006\003\125\004\010\023\002\125\124\061\027\060\025
+\006\003\125\004\007\023\016\123\141\154\164\040\114\141\153\145
+\040\103\151\164\171\061\036\060\034\006\003\125\004\012\023\025
+\124\150\145\040\125\123\105\122\124\122\125\123\124\040\116\145
+\164\167\157\162\153\061\041\060\037\006\003\125\004\013\023\030
+\150\164\164\160\072\057\057\167\167\167\056\165\163\145\162\164
+\162\165\163\164\056\143\157\155\061\037\060\035\006\003\125\004
+\003\023\026\125\124\116\055\125\123\105\122\106\151\162\163\164
+\055\110\141\162\144\167\141\162\145\060\036\027\015\061\061\060
+\063\061\065\060\060\060\060\060\060\132\027\015\061\064\060\063
+\061\064\062\063\065\071\065\071\132\060\201\336\061\013\060\011
+\006\003\125\004\006\023\002\125\123\061\016\060\014\006\003\125
+\004\021\023\005\063\070\064\067\067\061\020\060\016\006\003\125
+\004\010\023\007\106\154\157\162\151\144\141\061\020\060\016\006
+\003\125\004\007\023\007\105\156\147\154\151\163\150\061\027\060
+\025\006\003\125\004\011\023\016\123\145\141\040\126\151\154\154
+\141\147\145\040\061\060\061\024\060\022\006\003\125\004\012\023
+\013\107\157\157\147\154\145\040\114\164\144\056\061\023\060\021
+\006\003\125\004\013\023\012\124\145\143\150\040\104\145\160\164
+\056\061\050\060\046\006\003\125\004\013\023\037\110\157\163\164
+\145\144\040\142\171\040\107\124\111\040\107\162\157\165\160\040
+\103\157\162\160\157\162\141\164\151\157\156\061\024\060\022\006
+\003\125\004\013\023\013\120\154\141\164\151\156\165\155\123\123
+\114\061\027\060\025\006\003\125\004\003\023\016\167\167\167\056
+\147\157\157\147\154\145\056\143\157\155\060\202\001\042\060\015
+\006\011\052\206\110\206\367\015\001\001\001\005\000\003\202\001
+\017\000\060\202\001\012\002\202\001\001\000\260\163\360\362\004
+\356\302\242\106\312\064\052\252\273\140\043\321\021\166\037\037
+\072\320\145\203\116\232\105\250\103\160\205\166\360\037\207\000
+\002\037\156\073\027\027\304\265\351\031\106\242\222\045\215\142
+\052\264\143\060\037\271\205\370\065\341\026\132\166\111\314\120
+\110\123\071\131\211\326\204\002\373\232\354\033\307\121\325\166
+\225\220\324\072\052\270\246\336\002\115\006\373\315\355\245\106
+\101\137\125\164\345\354\176\100\334\120\234\265\344\065\135\036
+\150\040\370\351\336\243\152\050\277\101\322\241\263\342\045\215
+\014\033\312\075\223\014\030\256\337\305\274\375\274\202\272\150
+\000\327\026\062\161\237\145\265\021\332\150\131\320\246\127\144
+\033\311\376\230\345\365\245\145\352\341\333\356\364\263\235\263
+\216\352\207\256\026\322\036\240\174\174\151\077\051\026\205\001
+\123\247\154\361\140\253\335\242\374\045\107\324\062\321\022\335
+\367\110\022\340\374\234\242\167\230\351\211\231\270\370\070\361
+\214\006\302\172\043\066\155\233\235\315\060\310\307\064\027\036
+\273\175\102\310\253\347\025\026\366\163\265\002\003\001\000\001
+\243\202\001\340\060\202\001\334\060\037\006\003\125\035\043\004
+\030\060\026\200\024\241\162\137\046\033\050\230\103\225\135\007
+\067\325\205\226\235\113\322\303\105\060\035\006\003\125\035\016
+\004\026\004\024\030\052\242\310\324\172\077\173\255\004\213\275
+\157\236\020\106\023\170\161\235\060\016\006\003\125\035\017\001
+\001\377\004\004\003\002\005\240\060\014\006\003\125\035\023\001
+\001\377\004\002\060\000\060\035\006\003\125\035\045\004\026\060
+\024\006\010\053\006\001\005\005\007\003\001\006\010\053\006\001
+\005\005\007\003\002\060\106\006\003\125\035\040\004\077\060\075
+\060\073\006\014\053\006\001\004\001\262\061\001\002\001\003\004
+\060\053\060\051\006\010\053\006\001\005\005\007\002\001\026\035
+\150\164\164\160\163\072\057\057\163\145\143\165\162\145\056\143
+\157\155\157\144\157\056\143\157\155\057\103\120\123\060\173\006
+\003\125\035\037\004\164\060\162\060\070\240\066\240\064\206\062
+\150\164\164\160\072\057\057\143\162\154\056\143\157\155\157\144
+\157\143\141\056\143\157\155\057\125\124\116\055\125\123\105\122
+\106\151\162\163\164\055\110\141\162\144\167\141\162\145\056\143
+\162\154\060\066\240\064\240\062\206\060\150\164\164\160\072\057
+\057\143\162\154\056\143\157\155\157\144\157\056\156\145\164\057
+\125\124\116\055\125\123\105\122\106\151\162\163\164\055\110\141
+\162\144\167\141\162\145\056\143\162\154\060\161\006\010\053\006
+\001\005\005\007\001\001\004\145\060\143\060\073\006\010\053\006
+\001\005\005\007\060\002\206\057\150\164\164\160\072\057\057\143
+\162\164\056\143\157\155\157\144\157\143\141\056\143\157\155\057
+\125\124\116\101\144\144\124\162\165\163\164\123\145\162\166\145
+\162\103\101\056\143\162\164\060\044\006\010\053\006\001\005\005
+\007\060\001\206\030\150\164\164\160\072\057\057\157\143\163\160
+\056\143\157\155\157\144\157\143\141\056\143\157\155\060\045\006
+\003\125\035\021\004\036\060\034\202\016\167\167\167\056\147\157
+\157\147\154\145\056\143\157\155\202\012\147\157\157\147\154\145
+\056\143\157\155\060\015\006\011\052\206\110\206\367\015\001\001
+\005\005\000\003\202\001\001\000\161\300\231\077\136\366\275\063
+\377\236\026\313\250\277\335\160\371\322\123\073\066\256\311\027
+\310\256\136\115\335\142\367\267\323\076\167\243\376\300\173\062
+\265\311\224\005\122\120\362\137\075\171\204\111\117\135\154\260
+\327\131\275\324\154\210\372\374\305\145\206\353\050\122\242\102
+\366\174\274\152\307\007\056\045\321\220\142\040\306\215\121\302
+\054\105\071\116\003\332\367\030\350\314\012\072\331\105\330\154
+\156\064\213\142\234\116\025\371\103\356\345\227\300\077\255\065
+\023\305\053\006\307\101\375\342\367\176\105\255\233\321\341\146
+\355\370\172\113\224\071\172\057\353\350\077\103\330\065\326\126
+\372\164\347\155\346\355\254\145\204\376\320\115\006\022\336\332
+\131\000\074\011\134\317\210\113\350\075\264\025\041\222\314\155
+\246\121\342\216\227\361\364\202\106\313\304\123\136\332\134\235
+\145\222\001\145\211\000\345\266\231\377\046\100\361\057\031\061
+\010\032\261\147\125\206\015\256\065\063\206\274\227\110\222\327
+\226\140\370\316\374\226\353\207\304\163\314\224\233\130\133\363
+\172\244\047\023\326\117\364\151
+END
+
+# Trust for Certificate "Bogus Google"
+# Issuer: CN=UTN-USERFirst-Hardware,OU=http://www.usertrust.com,O=The USERTRUST Network,L=Salt Lake City,ST=UT,C=US
+# Serial Number:00:f5:c8:6a:f3:61:62:f1:3a:64:f5:4f:6d:c9:58:7c:06
+# Subject: CN=www.google.com,OU=PlatinumSSL,OU=Hosted by GTI Group Corporation,OU=Tech Dept.,O=Google Ltd.,STREET=Sea Village 10,L=English,ST=Florida,postalCode=38477,C=US
+# Not Valid Before: Tue Mar 15 00:00:00 2011
+# Not Valid After : Fri Mar 14 23:59:59 2014
+# Fingerprint (MD5): 01:73:A9:58:F0:BC:C9:BE:94:2B:1A:4C:98:24:E3:B8
+# Fingerprint (SHA1): 19:16:A2:AF:34:6D:39:9F:50:31:3C:39:32:00:F1:41:40:45:66:16
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Bogus Google"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\031\026\242\257\064\155\071\237\120\061\074\071\062\000\361\101
+\100\105\146\026
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\001\163\251\130\360\274\311\276\224\053\032\114\230\044\343\270
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\227\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\013\060\011\006\003\125\004\010\023\002\125\124\061\027\060
+\025\006\003\125\004\007\023\016\123\141\154\164\040\114\141\153
+\145\040\103\151\164\171\061\036\060\034\006\003\125\004\012\023
+\025\124\150\145\040\125\123\105\122\124\122\125\123\124\040\116
+\145\164\167\157\162\153\061\041\060\037\006\003\125\004\013\023
+\030\150\164\164\160\072\057\057\167\167\167\056\165\163\145\162
+\164\162\165\163\164\056\143\157\155\061\037\060\035\006\003\125
+\004\003\023\026\125\124\116\055\125\123\105\122\106\151\162\163
+\164\055\110\141\162\144\167\141\162\145
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\021\000\365\310\152\363\141\142\361\072\144\365\117\155\311
+\130\174\006
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "Bogus Skype"
+#
+# Issuer: CN=UTN-USERFirst-Hardware,OU=http://www.usertrust.com,O=The USERTRUST Network,L=Salt Lake City,ST=UT,C=US
+# Serial Number:00:e9:02:8b:95:78:e4:15:dc:1a:71:0a:2b:88:15:44:47
+# Subject: CN=login.skype.com,OU=PlatinumSSL,OU=Hosted by GTI Group Corporation,OU=Tech Dept.,O=Google Ltd.,STREET=Sea Village 10,L=English,ST=Florida,postalCode=38477,C=US
+# Not Valid Before: Tue Mar 15 00:00:00 2011
+# Not Valid After : Fri Mar 14 23:59:59 2014
+# Fingerprint (MD5): 85:A4:B4:C4:69:21:DF:A1:6A:0D:58:56:58:4B:33:44
+# Fingerprint (SHA1): 47:1C:94:9A:81:43:DB:5A:D5:CD:F1:C9:72:86:4A:25:04:FA:23:C9
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Bogus Skype"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\201\337\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\016\060\014\006\003\125\004\021\023\005\063\070\064\067\067
+\061\020\060\016\006\003\125\004\010\023\007\106\154\157\162\151
+\144\141\061\020\060\016\006\003\125\004\007\023\007\105\156\147
+\154\151\163\150\061\027\060\025\006\003\125\004\011\023\016\123
+\145\141\040\126\151\154\154\141\147\145\040\061\060\061\024\060
+\022\006\003\125\004\012\023\013\107\157\157\147\154\145\040\114
+\164\144\056\061\023\060\021\006\003\125\004\013\023\012\124\145
+\143\150\040\104\145\160\164\056\061\050\060\046\006\003\125\004
+\013\023\037\110\157\163\164\145\144\040\142\171\040\107\124\111
+\040\107\162\157\165\160\040\103\157\162\160\157\162\141\164\151
+\157\156\061\024\060\022\006\003\125\004\013\023\013\120\154\141
+\164\151\156\165\155\123\123\114\061\030\060\026\006\003\125\004
+\003\023\017\154\157\147\151\156\056\163\153\171\160\145\056\143
+\157\155
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\227\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\013\060\011\006\003\125\004\010\023\002\125\124\061\027\060
+\025\006\003\125\004\007\023\016\123\141\154\164\040\114\141\153
+\145\040\103\151\164\171\061\036\060\034\006\003\125\004\012\023
+\025\124\150\145\040\125\123\105\122\124\122\125\123\124\040\116
+\145\164\167\157\162\153\061\041\060\037\006\003\125\004\013\023
+\030\150\164\164\160\072\057\057\167\167\167\056\165\163\145\162
+\164\162\165\163\164\056\143\157\155\061\037\060\035\006\003\125
+\004\003\023\026\125\124\116\055\125\123\105\122\106\151\162\163
+\164\055\110\141\162\144\167\141\162\145
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\021\000\351\002\213\225\170\344\025\334\032\161\012\053\210
+\025\104\107
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\005\357\060\202\004\327\240\003\002\001\002\002\021\000
+\351\002\213\225\170\344\025\334\032\161\012\053\210\025\104\107
+\060\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060
+\201\227\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\013\060\011\006\003\125\004\010\023\002\125\124\061\027\060\025
+\006\003\125\004\007\023\016\123\141\154\164\040\114\141\153\145
+\040\103\151\164\171\061\036\060\034\006\003\125\004\012\023\025
+\124\150\145\040\125\123\105\122\124\122\125\123\124\040\116\145
+\164\167\157\162\153\061\041\060\037\006\003\125\004\013\023\030
+\150\164\164\160\072\057\057\167\167\167\056\165\163\145\162\164
+\162\165\163\164\056\143\157\155\061\037\060\035\006\003\125\004
+\003\023\026\125\124\116\055\125\123\105\122\106\151\162\163\164
+\055\110\141\162\144\167\141\162\145\060\036\027\015\061\061\060
+\063\061\065\060\060\060\060\060\060\132\027\015\061\064\060\063
+\061\064\062\063\065\071\065\071\132\060\201\337\061\013\060\011
+\006\003\125\004\006\023\002\125\123\061\016\060\014\006\003\125
+\004\021\023\005\063\070\064\067\067\061\020\060\016\006\003\125
+\004\010\023\007\106\154\157\162\151\144\141\061\020\060\016\006
+\003\125\004\007\023\007\105\156\147\154\151\163\150\061\027\060
+\025\006\003\125\004\011\023\016\123\145\141\040\126\151\154\154
+\141\147\145\040\061\060\061\024\060\022\006\003\125\004\012\023
+\013\107\157\157\147\154\145\040\114\164\144\056\061\023\060\021
+\006\003\125\004\013\023\012\124\145\143\150\040\104\145\160\164
+\056\061\050\060\046\006\003\125\004\013\023\037\110\157\163\164
+\145\144\040\142\171\040\107\124\111\040\107\162\157\165\160\040
+\103\157\162\160\157\162\141\164\151\157\156\061\024\060\022\006
+\003\125\004\013\023\013\120\154\141\164\151\156\165\155\123\123
+\114\061\030\060\026\006\003\125\004\003\023\017\154\157\147\151
+\156\056\163\153\171\160\145\056\143\157\155\060\202\001\042\060
+\015\006\011\052\206\110\206\367\015\001\001\001\005\000\003\202
+\001\017\000\060\202\001\012\002\202\001\001\000\260\170\231\206
+\016\242\163\043\324\132\303\111\353\261\066\214\174\312\204\256
+\074\257\070\210\050\231\215\055\130\023\261\227\170\076\122\040
+\147\254\133\163\230\154\062\125\311\160\321\331\252\025\350\056
+\046\205\201\274\126\344\274\200\143\333\116\327\365\002\276\121
+\143\036\074\333\337\327\000\135\132\271\345\173\152\352\070\040
+\262\073\266\356\165\124\204\371\246\312\070\160\335\277\260\377
+\245\205\135\264\101\376\335\075\331\052\341\060\103\032\230\171
+\223\240\137\340\147\154\225\372\076\172\256\161\173\343\155\210
+\102\077\045\324\356\276\150\150\254\255\254\140\340\040\243\071
+\203\271\133\050\243\223\155\241\275\166\012\343\353\256\207\047
+\016\124\217\264\110\014\232\124\364\135\216\067\120\334\136\244
+\213\153\113\334\246\363\064\276\167\131\042\210\377\031\053\155
+\166\144\163\332\014\207\007\053\232\067\072\320\342\214\366\066
+\062\153\232\171\314\322\073\223\157\032\115\154\346\301\235\100
+\254\055\164\303\276\352\134\163\145\001\051\261\052\277\160\131
+\301\316\306\303\242\310\105\137\272\147\075\017\002\003\001\000
+\001\243\202\001\352\060\202\001\346\060\037\006\003\125\035\043
+\004\030\060\026\200\024\241\162\137\046\033\050\230\103\225\135
+\007\067\325\205\226\235\113\322\303\105\060\035\006\003\125\035
+\016\004\026\004\024\325\216\132\121\023\264\051\015\061\266\034
+\215\076\121\121\061\012\063\252\201\060\016\006\003\125\035\017
+\001\001\377\004\004\003\002\005\240\060\014\006\003\125\035\023
+\001\001\377\004\002\060\000\060\035\006\003\125\035\045\004\026
+\060\024\006\010\053\006\001\005\005\007\003\001\006\010\053\006
+\001\005\005\007\003\002\060\106\006\003\125\035\040\004\077\060
+\075\060\073\006\014\053\006\001\004\001\262\061\001\002\001\003
+\004\060\053\060\051\006\010\053\006\001\005\005\007\002\001\026
+\035\150\164\164\160\163\072\057\057\163\145\143\165\162\145\056
+\143\157\155\157\144\157\056\143\157\155\057\103\120\123\060\173
+\006\003\125\035\037\004\164\060\162\060\070\240\066\240\064\206
+\062\150\164\164\160\072\057\057\143\162\154\056\143\157\155\157
+\144\157\143\141\056\143\157\155\057\125\124\116\055\125\123\105
+\122\106\151\162\163\164\055\110\141\162\144\167\141\162\145\056
+\143\162\154\060\066\240\064\240\062\206\060\150\164\164\160\072
+\057\057\143\162\154\056\143\157\155\157\144\157\056\156\145\164
+\057\125\124\116\055\125\123\105\122\106\151\162\163\164\055\110
+\141\162\144\167\141\162\145\056\143\162\154\060\161\006\010\053
+\006\001\005\005\007\001\001\004\145\060\143\060\073\006\010\053
+\006\001\005\005\007\060\002\206\057\150\164\164\160\072\057\057
+\143\162\164\056\143\157\155\157\144\157\143\141\056\143\157\155
+\057\125\124\116\101\144\144\124\162\165\163\164\123\145\162\166
+\145\162\103\101\056\143\162\164\060\044\006\010\053\006\001\005
+\005\007\060\001\206\030\150\164\164\160\072\057\057\157\143\163
+\160\056\143\157\155\157\144\157\143\141\056\143\157\155\060\057
+\006\003\125\035\021\004\050\060\046\202\017\154\157\147\151\156
+\056\163\153\171\160\145\056\143\157\155\202\023\167\167\167\056
+\154\157\147\151\156\056\163\153\171\160\145\056\143\157\155\060
+\015\006\011\052\206\110\206\367\015\001\001\005\005\000\003\202
+\001\001\000\010\362\201\165\221\273\316\022\004\030\302\115\132
+\373\106\220\012\124\104\364\362\335\007\201\360\037\246\172\157
+\237\317\270\016\054\117\234\304\232\365\250\366\272\244\311\172
+\135\261\342\132\312\074\372\140\250\150\076\313\272\055\342\315
+\326\266\344\222\074\151\255\127\352\250\057\070\020\204\162\345
+\150\161\355\276\353\156\030\357\143\172\276\347\044\377\300\143
+\375\130\073\114\201\222\330\051\253\216\065\135\327\323\011\153
+\205\323\325\163\005\104\342\345\273\203\123\020\313\362\317\267
+\156\341\151\267\241\222\144\305\317\315\202\273\066\240\070\255
+\327\044\337\123\374\077\142\267\267\325\307\127\343\223\061\160
+\216\044\211\206\312\143\053\071\272\135\331\152\140\354\241\116
+\212\376\123\370\136\222\337\057\134\046\027\155\003\175\002\017
+\017\252\103\147\155\260\142\277\176\123\335\314\354\170\163\225
+\345\245\366\000\243\004\375\077\004\052\263\230\305\267\003\034
+\333\311\120\253\260\005\035\036\276\126\264\317\076\102\023\224
+\236\371\347\001\201\245\170\157\014\172\166\254\005\206\354\254
+\302\021\254
+END
+
+# Trust for Certificate "Bogus Skype"
+# Issuer: CN=UTN-USERFirst-Hardware,OU=http://www.usertrust.com,O=The USERTRUST Network,L=Salt Lake City,ST=UT,C=US
+# Serial Number:00:e9:02:8b:95:78:e4:15:dc:1a:71:0a:2b:88:15:44:47
+# Subject: CN=login.skype.com,OU=PlatinumSSL,OU=Hosted by GTI Group Corporation,OU=Tech Dept.,O=Google Ltd.,STREET=Sea Village 10,L=English,ST=Florida,postalCode=38477,C=US
+# Not Valid Before: Tue Mar 15 00:00:00 2011
+# Not Valid After : Fri Mar 14 23:59:59 2014
+# Fingerprint (MD5): 85:A4:B4:C4:69:21:DF:A1:6A:0D:58:56:58:4B:33:44
+# Fingerprint (SHA1): 47:1C:94:9A:81:43:DB:5A:D5:CD:F1:C9:72:86:4A:25:04:FA:23:C9
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Bogus Skype"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\107\034\224\232\201\103\333\132\325\315\361\311\162\206\112\045
+\004\372\043\311
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\205\244\264\304\151\041\337\241\152\015\130\126\130\113\063\104
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\227\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\013\060\011\006\003\125\004\010\023\002\125\124\061\027\060
+\025\006\003\125\004\007\023\016\123\141\154\164\040\114\141\153
+\145\040\103\151\164\171\061\036\060\034\006\003\125\004\012\023
+\025\124\150\145\040\125\123\105\122\124\122\125\123\124\040\116
+\145\164\167\157\162\153\061\041\060\037\006\003\125\004\013\023
+\030\150\164\164\160\072\057\057\167\167\167\056\165\163\145\162
+\164\162\165\163\164\056\143\157\155\061\037\060\035\006\003\125
+\004\003\023\026\125\124\116\055\125\123\105\122\106\151\162\163
+\164\055\110\141\162\144\167\141\162\145
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\021\000\351\002\213\225\170\344\025\334\032\161\012\053\210
+\025\104\107
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "Bogus Yahoo 1"
+#
+# Issuer: CN=UTN-USERFirst-Hardware,OU=http://www.usertrust.com,O=The USERTRUST Network,L=Salt Lake City,ST=UT,C=US
+# Serial Number:00:d7:55:8f:da:f5:f1:10:5b:b2:13:28:2b:70:77:29:a3
+# Subject: CN=login.yahoo.com,OU=PlatinumSSL,OU=Hosted by GTI Group Corporation,OU=Tech Dept.,O=Google Ltd.,STREET=Sea Village 10,L=English,ST=Florida,postalCode=38477,C=US
+# Not Valid Before: Tue Mar 15 00:00:00 2011
+# Not Valid After : Fri Mar 14 23:59:59 2014
+# Fingerprint (MD5): 0C:1F:BE:D3:FC:09:6E:E6:6E:C2:66:39:75:86:6B:EB
+# Fingerprint (SHA1): 63:FE:AE:96:0B:AA:91:E3:43:CE:2B:D8:B7:17:98:C7:6B:DB:77:D0
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Bogus Yahoo 1"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\201\337\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\016\060\014\006\003\125\004\021\023\005\063\070\064\067\067
+\061\020\060\016\006\003\125\004\010\023\007\106\154\157\162\151
+\144\141\061\020\060\016\006\003\125\004\007\023\007\105\156\147
+\154\151\163\150\061\027\060\025\006\003\125\004\011\023\016\123
+\145\141\040\126\151\154\154\141\147\145\040\061\060\061\024\060
+\022\006\003\125\004\012\023\013\107\157\157\147\154\145\040\114
+\164\144\056\061\023\060\021\006\003\125\004\013\023\012\124\145
+\143\150\040\104\145\160\164\056\061\050\060\046\006\003\125\004
+\013\023\037\110\157\163\164\145\144\040\142\171\040\107\124\111
+\040\107\162\157\165\160\040\103\157\162\160\157\162\141\164\151
+\157\156\061\024\060\022\006\003\125\004\013\023\013\120\154\141
+\164\151\156\165\155\123\123\114\061\030\060\026\006\003\125\004
+\003\023\017\154\157\147\151\156\056\171\141\150\157\157\056\143
+\157\155
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\227\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\013\060\011\006\003\125\004\010\023\002\125\124\061\027\060
+\025\006\003\125\004\007\023\016\123\141\154\164\040\114\141\153
+\145\040\103\151\164\171\061\036\060\034\006\003\125\004\012\023
+\025\124\150\145\040\125\123\105\122\124\122\125\123\124\040\116
+\145\164\167\157\162\153\061\041\060\037\006\003\125\004\013\023
+\030\150\164\164\160\072\057\057\167\167\167\056\165\163\145\162
+\164\162\165\163\164\056\143\157\155\061\037\060\035\006\003\125
+\004\003\023\026\125\124\116\055\125\123\105\122\106\151\162\163
+\164\055\110\141\162\144\167\141\162\145
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\021\000\327\125\217\332\365\361\020\133\262\023\050\053\160
+\167\051\243
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\005\357\060\202\004\327\240\003\002\001\002\002\021\000
+\327\125\217\332\365\361\020\133\262\023\050\053\160\167\051\243
+\060\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060
+\201\227\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\013\060\011\006\003\125\004\010\023\002\125\124\061\027\060\025
+\006\003\125\004\007\023\016\123\141\154\164\040\114\141\153\145
+\040\103\151\164\171\061\036\060\034\006\003\125\004\012\023\025
+\124\150\145\040\125\123\105\122\124\122\125\123\124\040\116\145
+\164\167\157\162\153\061\041\060\037\006\003\125\004\013\023\030
+\150\164\164\160\072\057\057\167\167\167\056\165\163\145\162\164
+\162\165\163\164\056\143\157\155\061\037\060\035\006\003\125\004
+\003\023\026\125\124\116\055\125\123\105\122\106\151\162\163\164
+\055\110\141\162\144\167\141\162\145\060\036\027\015\061\061\060
+\063\061\065\060\060\060\060\060\060\132\027\015\061\064\060\063
+\061\064\062\063\065\071\065\071\132\060\201\337\061\013\060\011
+\006\003\125\004\006\023\002\125\123\061\016\060\014\006\003\125
+\004\021\023\005\063\070\064\067\067\061\020\060\016\006\003\125
+\004\010\023\007\106\154\157\162\151\144\141\061\020\060\016\006
+\003\125\004\007\023\007\105\156\147\154\151\163\150\061\027\060
+\025\006\003\125\004\011\023\016\123\145\141\040\126\151\154\154
+\141\147\145\040\061\060\061\024\060\022\006\003\125\004\012\023
+\013\107\157\157\147\154\145\040\114\164\144\056\061\023\060\021
+\006\003\125\004\013\023\012\124\145\143\150\040\104\145\160\164
+\056\061\050\060\046\006\003\125\004\013\023\037\110\157\163\164
+\145\144\040\142\171\040\107\124\111\040\107\162\157\165\160\040
+\103\157\162\160\157\162\141\164\151\157\156\061\024\060\022\006
+\003\125\004\013\023\013\120\154\141\164\151\156\165\155\123\123
+\114\061\030\060\026\006\003\125\004\003\023\017\154\157\147\151
+\156\056\171\141\150\157\157\056\143\157\155\060\202\001\042\060
+\015\006\011\052\206\110\206\367\015\001\001\001\005\000\003\202
+\001\017\000\060\202\001\012\002\202\001\001\000\241\244\005\075
+\355\205\105\223\212\030\115\306\003\000\127\342\100\167\360\034
+\353\320\031\337\042\135\010\177\321\007\074\101\211\106\027\243
+\011\372\374\370\251\004\321\226\217\253\327\117\074\371\255\030
+\251\164\201\304\127\012\072\046\026\316\142\076\274\077\154\041
+\356\223\215\313\015\240\037\232\226\320\217\255\365\223\223\202
+\356\162\014\241\165\025\243\173\204\126\270\255\377\122\021\161
+\204\274\072\060\013\176\230\250\341\250\077\067\122\320\361\174
+\157\220\330\105\012\254\071\162\152\141\325\273\303\214\371\302
+\314\337\375\072\161\271\257\274\334\072\334\014\266\261\322\321
+\211\273\101\266\362\336\127\325\025\337\374\375\342\061\305\337
+\312\301\330\217\054\277\360\016\133\161\340\064\161\303\305\115
+\175\172\324\372\355\060\113\057\352\266\056\236\223\074\342\072
+\370\102\242\032\356\334\337\315\017\251\366\171\204\032\216\154
+\002\266\206\345\277\121\152\146\370\363\234\323\131\014\173\245
+\231\170\315\174\231\372\306\226\107\330\062\324\164\166\016\167
+\113\040\164\244\267\211\165\222\112\264\133\125\002\003\001\000
+\001\243\202\001\352\060\202\001\346\060\037\006\003\125\035\043
+\004\030\060\026\200\024\241\162\137\046\033\050\230\103\225\135
+\007\067\325\205\226\235\113\322\303\105\060\035\006\003\125\035
+\016\004\026\004\024\206\111\105\374\063\031\063\324\004\355\047
+\141\356\350\001\311\014\177\057\176\060\016\006\003\125\035\017
+\001\001\377\004\004\003\002\005\240\060\014\006\003\125\035\023
+\001\001\377\004\002\060\000\060\035\006\003\125\035\045\004\026
+\060\024\006\010\053\006\001\005\005\007\003\001\006\010\053\006
+\001\005\005\007\003\002\060\106\006\003\125\035\040\004\077\060
+\075\060\073\006\014\053\006\001\004\001\262\061\001\002\001\003
+\004\060\053\060\051\006\010\053\006\001\005\005\007\002\001\026
+\035\150\164\164\160\163\072\057\057\163\145\143\165\162\145\056
+\143\157\155\157\144\157\056\143\157\155\057\103\120\123\060\173
+\006\003\125\035\037\004\164\060\162\060\070\240\066\240\064\206
+\062\150\164\164\160\072\057\057\143\162\154\056\143\157\155\157
+\144\157\143\141\056\143\157\155\057\125\124\116\055\125\123\105
+\122\106\151\162\163\164\055\110\141\162\144\167\141\162\145\056
+\143\162\154\060\066\240\064\240\062\206\060\150\164\164\160\072
+\057\057\143\162\154\056\143\157\155\157\144\157\056\156\145\164
+\057\125\124\116\055\125\123\105\122\106\151\162\163\164\055\110
+\141\162\144\167\141\162\145\056\143\162\154\060\161\006\010\053
+\006\001\005\005\007\001\001\004\145\060\143\060\073\006\010\053
+\006\001\005\005\007\060\002\206\057\150\164\164\160\072\057\057
+\143\162\164\056\143\157\155\157\144\157\143\141\056\143\157\155
+\057\125\124\116\101\144\144\124\162\165\163\164\123\145\162\166
+\145\162\103\101\056\143\162\164\060\044\006\010\053\006\001\005
+\005\007\060\001\206\030\150\164\164\160\072\057\057\157\143\163
+\160\056\143\157\155\157\144\157\143\141\056\143\157\155\060\057
+\006\003\125\035\021\004\050\060\046\202\017\154\157\147\151\156
+\056\171\141\150\157\157\056\143\157\155\202\023\167\167\167\056
+\154\157\147\151\156\056\171\141\150\157\157\056\143\157\155\060
+\015\006\011\052\206\110\206\367\015\001\001\005\005\000\003\202
+\001\001\000\075\127\311\110\044\134\356\144\201\365\256\276\125
+\051\026\377\052\057\204\355\331\370\243\003\310\060\146\273\310
+\324\201\055\041\367\010\367\254\226\102\232\101\165\172\272\135
+\020\043\313\222\102\141\372\212\332\155\145\064\031\345\251\326
+\055\023\170\327\201\104\222\251\156\200\143\025\313\376\065\037
+\002\321\212\024\260\250\314\224\040\073\250\032\360\135\066\120
+\333\015\256\351\144\344\366\215\151\175\060\310\024\027\000\112
+\345\246\065\373\175\015\042\235\171\166\122\054\274\227\006\210
+\232\025\364\163\346\361\365\230\245\315\007\104\221\270\247\150
+\147\105\322\162\021\140\342\161\267\120\125\342\212\251\015\326
+\222\356\004\052\213\060\240\242\005\106\064\155\222\306\073\252
+\115\240\320\253\001\031\012\062\267\350\343\317\361\322\227\111
+\173\254\244\227\367\360\127\256\143\167\232\177\226\332\115\375
+\276\334\007\066\343\045\275\211\171\216\051\022\023\213\210\007
+\373\153\333\244\315\263\055\047\351\324\312\140\327\205\123\373
+\164\306\134\065\214\160\037\371\262\267\222\047\040\307\224\325
+\147\024\060
+END
+
+# Trust for Certificate "Bogus Yahoo 1"
+# Issuer: CN=UTN-USERFirst-Hardware,OU=http://www.usertrust.com,O=The USERTRUST Network,L=Salt Lake City,ST=UT,C=US
+# Serial Number:00:d7:55:8f:da:f5:f1:10:5b:b2:13:28:2b:70:77:29:a3
+# Subject: CN=login.yahoo.com,OU=PlatinumSSL,OU=Hosted by GTI Group Corporation,OU=Tech Dept.,O=Google Ltd.,STREET=Sea Village 10,L=English,ST=Florida,postalCode=38477,C=US
+# Not Valid Before: Tue Mar 15 00:00:00 2011
+# Not Valid After : Fri Mar 14 23:59:59 2014
+# Fingerprint (MD5): 0C:1F:BE:D3:FC:09:6E:E6:6E:C2:66:39:75:86:6B:EB
+# Fingerprint (SHA1): 63:FE:AE:96:0B:AA:91:E3:43:CE:2B:D8:B7:17:98:C7:6B:DB:77:D0
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Bogus Yahoo 1"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\143\376\256\226\013\252\221\343\103\316\053\330\267\027\230\307
+\153\333\167\320
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\014\037\276\323\374\011\156\346\156\302\146\071\165\206\153\353
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\227\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\013\060\011\006\003\125\004\010\023\002\125\124\061\027\060
+\025\006\003\125\004\007\023\016\123\141\154\164\040\114\141\153
+\145\040\103\151\164\171\061\036\060\034\006\003\125\004\012\023
+\025\124\150\145\040\125\123\105\122\124\122\125\123\124\040\116
+\145\164\167\157\162\153\061\041\060\037\006\003\125\004\013\023
+\030\150\164\164\160\072\057\057\167\167\167\056\165\163\145\162
+\164\162\165\163\164\056\143\157\155\061\037\060\035\006\003\125
+\004\003\023\026\125\124\116\055\125\123\105\122\106\151\162\163
+\164\055\110\141\162\144\167\141\162\145
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\021\000\327\125\217\332\365\361\020\133\262\023\050\053\160
+\167\051\243
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "Bogus Yahoo 2"
+#
+# Issuer: CN=UTN-USERFirst-Hardware,OU=http://www.usertrust.com,O=The USERTRUST Network,L=Salt Lake City,ST=UT,C=US
+# Serial Number:39:2a:43:4f:0e:07:df:1f:8a:a3:05:de:34:e0:c2:29
+# Subject: CN=login.yahoo.com,OU=PlatinumSSL,OU=Hosted by GTI Group Corporation,OU=Tech Dept.,O=Google Ltd.,STREET=Sea Village 10,L=English,ST=Florida,postalCode=38477,C=US
+# Not Valid Before: Tue Mar 15 00:00:00 2011
+# Not Valid After : Fri Mar 14 23:59:59 2014
+# Fingerprint (MD5): 72:DC:C8:72:6C:53:3B:B2:FD:CC:5D:19:BD:AF:A6:31
+# Fingerprint (SHA1): D0:18:B6:2D:C5:18:90:72:47:DF:50:92:5B:B0:9A:CF:4A:5C:B3:AD
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Bogus Yahoo 2"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\201\337\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\016\060\014\006\003\125\004\021\023\005\063\070\064\067\067
+\061\020\060\016\006\003\125\004\010\023\007\106\154\157\162\151
+\144\141\061\020\060\016\006\003\125\004\007\023\007\105\156\147
+\154\151\163\150\061\027\060\025\006\003\125\004\011\023\016\123
+\145\141\040\126\151\154\154\141\147\145\040\061\060\061\024\060
+\022\006\003\125\004\012\023\013\107\157\157\147\154\145\040\114
+\164\144\056\061\023\060\021\006\003\125\004\013\023\012\124\145
+\143\150\040\104\145\160\164\056\061\050\060\046\006\003\125\004
+\013\023\037\110\157\163\164\145\144\040\142\171\040\107\124\111
+\040\107\162\157\165\160\040\103\157\162\160\157\162\141\164\151
+\157\156\061\024\060\022\006\003\125\004\013\023\013\120\154\141
+\164\151\156\165\155\123\123\114\061\030\060\026\006\003\125\004
+\003\023\017\154\157\147\151\156\056\171\141\150\157\157\056\143
+\157\155
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\227\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\013\060\011\006\003\125\004\010\023\002\125\124\061\027\060
+\025\006\003\125\004\007\023\016\123\141\154\164\040\114\141\153
+\145\040\103\151\164\171\061\036\060\034\006\003\125\004\012\023
+\025\124\150\145\040\125\123\105\122\124\122\125\123\124\040\116
+\145\164\167\157\162\153\061\041\060\037\006\003\125\004\013\023
+\030\150\164\164\160\072\057\057\167\167\167\056\165\163\145\162
+\164\162\165\163\164\056\143\157\155\061\037\060\035\006\003\125
+\004\003\023\026\125\124\116\055\125\123\105\122\106\151\162\163
+\164\055\110\141\162\144\167\141\162\145
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\020\071\052\103\117\016\007\337\037\212\243\005\336\064\340
+\302\051
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\005\331\060\202\004\301\240\003\002\001\002\002\020\071
+\052\103\117\016\007\337\037\212\243\005\336\064\340\302\051\060
+\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060\201
+\227\061\013\060\011\006\003\125\004\006\023\002\125\123\061\013
+\060\011\006\003\125\004\010\023\002\125\124\061\027\060\025\006
+\003\125\004\007\023\016\123\141\154\164\040\114\141\153\145\040
+\103\151\164\171\061\036\060\034\006\003\125\004\012\023\025\124
+\150\145\040\125\123\105\122\124\122\125\123\124\040\116\145\164
+\167\157\162\153\061\041\060\037\006\003\125\004\013\023\030\150
+\164\164\160\072\057\057\167\167\167\056\165\163\145\162\164\162
+\165\163\164\056\143\157\155\061\037\060\035\006\003\125\004\003
+\023\026\125\124\116\055\125\123\105\122\106\151\162\163\164\055
+\110\141\162\144\167\141\162\145\060\036\027\015\061\061\060\063
+\061\065\060\060\060\060\060\060\132\027\015\061\064\060\063\061
+\064\062\063\065\071\065\071\132\060\201\337\061\013\060\011\006
+\003\125\004\006\023\002\125\123\061\016\060\014\006\003\125\004
+\021\023\005\063\070\064\067\067\061\020\060\016\006\003\125\004
+\010\023\007\106\154\157\162\151\144\141\061\020\060\016\006\003
+\125\004\007\023\007\105\156\147\154\151\163\150\061\027\060\025
+\006\003\125\004\011\023\016\123\145\141\040\126\151\154\154\141
+\147\145\040\061\060\061\024\060\022\006\003\125\004\012\023\013
+\107\157\157\147\154\145\040\114\164\144\056\061\023\060\021\006
+\003\125\004\013\023\012\124\145\143\150\040\104\145\160\164\056
+\061\050\060\046\006\003\125\004\013\023\037\110\157\163\164\145
+\144\040\142\171\040\107\124\111\040\107\162\157\165\160\040\103
+\157\162\160\157\162\141\164\151\157\156\061\024\060\022\006\003
+\125\004\013\023\013\120\154\141\164\151\156\165\155\123\123\114
+\061\030\060\026\006\003\125\004\003\023\017\154\157\147\151\156
+\056\171\141\150\157\157\056\143\157\155\060\202\001\042\060\015
+\006\011\052\206\110\206\367\015\001\001\001\005\000\003\202\001
+\017\000\060\202\001\012\002\202\001\001\000\241\244\005\075\355
+\205\105\223\212\030\115\306\003\000\127\342\100\167\360\034\353
+\320\031\337\042\135\010\177\321\007\074\101\211\106\027\243\011
+\372\374\370\251\004\321\226\217\253\327\117\074\371\255\030\251
+\164\201\304\127\012\072\046\026\316\142\076\274\077\154\041\356
+\223\215\313\015\240\037\232\226\320\217\255\365\223\223\202\356
+\162\014\241\165\025\243\173\204\126\270\255\377\122\021\161\204
+\274\072\060\013\176\230\250\341\250\077\067\122\320\361\174\157
+\220\330\105\012\254\071\162\152\141\325\273\303\214\371\302\314
+\337\375\072\161\271\257\274\334\072\334\014\266\261\322\321\211
+\273\101\266\362\336\127\325\025\337\374\375\342\061\305\337\312
+\301\330\217\054\277\360\016\133\161\340\064\161\303\305\115\175
+\172\324\372\355\060\113\057\352\266\056\236\223\074\342\072\370
+\102\242\032\356\334\337\315\017\251\366\171\204\032\216\154\002
+\266\206\345\277\121\152\146\370\363\234\323\131\014\173\245\231
+\170\315\174\231\372\306\226\107\330\062\324\164\166\016\167\113
+\040\164\244\267\211\165\222\112\264\133\125\002\003\001\000\001
+\243\202\001\325\060\202\001\321\060\037\006\003\125\035\043\004
+\030\060\026\200\024\241\162\137\046\033\050\230\103\225\135\007
+\067\325\205\226\235\113\322\303\105\060\035\006\003\125\035\016
+\004\026\004\024\206\111\105\374\063\031\063\324\004\355\047\141
+\356\350\001\311\014\177\057\176\060\016\006\003\125\035\017\001
+\001\377\004\004\003\002\005\240\060\014\006\003\125\035\023\001
+\001\377\004\002\060\000\060\035\006\003\125\035\045\004\026\060
+\024\006\010\053\006\001\005\005\007\003\001\006\010\053\006\001
+\005\005\007\003\002\060\106\006\003\125\035\040\004\077\060\075
+\060\073\006\014\053\006\001\004\001\262\061\001\002\001\003\004
+\060\053\060\051\006\010\053\006\001\005\005\007\002\001\026\035
+\150\164\164\160\163\072\057\057\163\145\143\165\162\145\056\143
+\157\155\157\144\157\056\143\157\155\057\103\120\123\060\173\006
+\003\125\035\037\004\164\060\162\060\070\240\066\240\064\206\062
+\150\164\164\160\072\057\057\143\162\154\056\143\157\155\157\144
+\157\143\141\056\143\157\155\057\125\124\116\055\125\123\105\122
+\106\151\162\163\164\055\110\141\162\144\167\141\162\145\056\143
+\162\154\060\066\240\064\240\062\206\060\150\164\164\160\072\057
+\057\143\162\154\056\143\157\155\157\144\157\056\156\145\164\057
+\125\124\116\055\125\123\105\122\106\151\162\163\164\055\110\141
+\162\144\167\141\162\145\056\143\162\154\060\161\006\010\053\006
+\001\005\005\007\001\001\004\145\060\143\060\073\006\010\053\006
+\001\005\005\007\060\002\206\057\150\164\164\160\072\057\057\143
+\162\164\056\143\157\155\157\144\157\143\141\056\143\157\155\057
+\125\124\116\101\144\144\124\162\165\163\164\123\145\162\166\145
+\162\103\101\056\143\162\164\060\044\006\010\053\006\001\005\005
+\007\060\001\206\030\150\164\164\160\072\057\057\157\143\163\160
+\056\143\157\155\157\144\157\143\141\056\143\157\155\060\032\006
+\003\125\035\021\004\023\060\021\202\017\154\157\147\151\156\056
+\171\141\150\157\157\056\143\157\155\060\015\006\011\052\206\110
+\206\367\015\001\001\005\005\000\003\202\001\001\000\127\142\341
+\167\353\374\037\277\210\123\257\130\323\324\326\155\147\060\027
+\100\276\340\037\144\336\207\025\314\340\244\126\251\321\237\371
+\001\376\002\261\261\352\342\137\356\161\026\061\371\010\325\302
+\327\232\233\262\132\070\327\251\177\351\207\153\061\371\013\254
+\331\375\120\161\340\333\202\222\017\201\234\215\167\351\353\056
+\352\324\043\101\207\354\055\262\170\263\216\261\147\322\356\161
+\003\010\022\231\263\002\051\157\336\213\336\301\251\003\012\132
+\063\034\075\021\003\306\110\014\230\234\025\056\331\246\205\122
+\347\005\212\256\060\043\353\355\050\154\140\351\055\177\217\107
+\213\057\320\334\346\273\017\176\137\362\110\201\216\120\004\143
+\261\121\200\165\232\251\266\020\034\020\137\157\030\157\340\016
+\226\105\316\356\361\265\040\333\357\332\156\310\225\343\366\105
+\375\312\374\245\137\111\155\006\036\322\336\141\075\025\175\067
+\345\034\065\216\006\302\153\367\264\250\050\054\061\313\252\264
+\247\227\117\235\212\366\257\176\067\271\173\075\337\222\146\213
+\217\116\235\306\066\347\134\246\253\022\017\326\317
+END
+
+# Trust for Certificate "Bogus Yahoo 2"
+# Issuer: CN=UTN-USERFirst-Hardware,OU=http://www.usertrust.com,O=The USERTRUST Network,L=Salt Lake City,ST=UT,C=US
+# Serial Number:39:2a:43:4f:0e:07:df:1f:8a:a3:05:de:34:e0:c2:29
+# Subject: CN=login.yahoo.com,OU=PlatinumSSL,OU=Hosted by GTI Group Corporation,OU=Tech Dept.,O=Google Ltd.,STREET=Sea Village 10,L=English,ST=Florida,postalCode=38477,C=US
+# Not Valid Before: Tue Mar 15 00:00:00 2011
+# Not Valid After : Fri Mar 14 23:59:59 2014
+# Fingerprint (MD5): 72:DC:C8:72:6C:53:3B:B2:FD:CC:5D:19:BD:AF:A6:31
+# Fingerprint (SHA1): D0:18:B6:2D:C5:18:90:72:47:DF:50:92:5B:B0:9A:CF:4A:5C:B3:AD
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Bogus Yahoo 2"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\320\030\266\055\305\030\220\162\107\337\120\222\133\260\232\317
+\112\134\263\255
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\162\334\310\162\154\123\073\262\375\314\135\031\275\257\246\061
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\227\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\013\060\011\006\003\125\004\010\023\002\125\124\061\027\060
+\025\006\003\125\004\007\023\016\123\141\154\164\040\114\141\153
+\145\040\103\151\164\171\061\036\060\034\006\003\125\004\012\023
+\025\124\150\145\040\125\123\105\122\124\122\125\123\124\040\116
+\145\164\167\157\162\153\061\041\060\037\006\003\125\004\013\023
+\030\150\164\164\160\072\057\057\167\167\167\056\165\163\145\162
+\164\162\165\163\164\056\143\157\155\061\037\060\035\006\003\125
+\004\003\023\026\125\124\116\055\125\123\105\122\106\151\162\163
+\164\055\110\141\162\144\167\141\162\145
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\020\071\052\103\117\016\007\337\037\212\243\005\336\064\340
+\302\051
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "Bogus Yahoo 3"
+#
+# Issuer: CN=UTN-USERFirst-Hardware,OU=http://www.usertrust.com,O=The USERTRUST Network,L=Salt Lake City,ST=UT,C=US
+# Serial Number:3e:75:ce:d4:6b:69:30:21:21:88:30:ae:86:a8:2a:71
+# Subject: CN=login.yahoo.com,OU=PlatinumSSL,OU=Hosted by GTI Group Corporation,OU=Tech Dept.,O=Google Ltd.,STREET=Sea Village 10,L=English,ST=Florida,postalCode=38477,C=US
+# Not Valid Before: Tue Mar 15 00:00:00 2011
+# Not Valid After : Fri Mar 14 23:59:59 2014
+# Fingerprint (MD5): 4A:DC:3C:67:ED:21:CD:5B:CE:5D:C8:11:E4:9E:CF:3D
+# Fingerprint (SHA1): 80:96:2A:E4:D6:C5:B4:42:89:4E:95:A1:3E:4A:69:9E:07:D6:94:CF
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Bogus Yahoo 3"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\201\337\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\016\060\014\006\003\125\004\021\023\005\063\070\064\067\067
+\061\020\060\016\006\003\125\004\010\023\007\106\154\157\162\151
+\144\141\061\020\060\016\006\003\125\004\007\023\007\105\156\147
+\154\151\163\150\061\027\060\025\006\003\125\004\011\023\016\123
+\145\141\040\126\151\154\154\141\147\145\040\061\060\061\024\060
+\022\006\003\125\004\012\023\013\107\157\157\147\154\145\040\114
+\164\144\056\061\023\060\021\006\003\125\004\013\023\012\124\145
+\143\150\040\104\145\160\164\056\061\050\060\046\006\003\125\004
+\013\023\037\110\157\163\164\145\144\040\142\171\040\107\124\111
+\040\107\162\157\165\160\040\103\157\162\160\157\162\141\164\151
+\157\156\061\024\060\022\006\003\125\004\013\023\013\120\154\141
+\164\151\156\165\155\123\123\114\061\030\060\026\006\003\125\004
+\003\023\017\154\157\147\151\156\056\171\141\150\157\157\056\143
+\157\155
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\227\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\013\060\011\006\003\125\004\010\023\002\125\124\061\027\060
+\025\006\003\125\004\007\023\016\123\141\154\164\040\114\141\153
+\145\040\103\151\164\171\061\036\060\034\006\003\125\004\012\023
+\025\124\150\145\040\125\123\105\122\124\122\125\123\124\040\116
+\145\164\167\157\162\153\061\041\060\037\006\003\125\004\013\023
+\030\150\164\164\160\072\057\057\167\167\167\056\165\163\145\162
+\164\162\165\163\164\056\143\157\155\061\037\060\035\006\003\125
+\004\003\023\026\125\124\116\055\125\123\105\122\106\151\162\163
+\164\055\110\141\162\144\167\141\162\145
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\020\076\165\316\324\153\151\060\041\041\210\060\256\206\250
+\052\161
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\005\331\060\202\004\301\240\003\002\001\002\002\020\076
+\165\316\324\153\151\060\041\041\210\060\256\206\250\052\161\060
+\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060\201
+\227\061\013\060\011\006\003\125\004\006\023\002\125\123\061\013
+\060\011\006\003\125\004\010\023\002\125\124\061\027\060\025\006
+\003\125\004\007\023\016\123\141\154\164\040\114\141\153\145\040
+\103\151\164\171\061\036\060\034\006\003\125\004\012\023\025\124
+\150\145\040\125\123\105\122\124\122\125\123\124\040\116\145\164
+\167\157\162\153\061\041\060\037\006\003\125\004\013\023\030\150
+\164\164\160\072\057\057\167\167\167\056\165\163\145\162\164\162
+\165\163\164\056\143\157\155\061\037\060\035\006\003\125\004\003
+\023\026\125\124\116\055\125\123\105\122\106\151\162\163\164\055
+\110\141\162\144\167\141\162\145\060\036\027\015\061\061\060\063
+\061\065\060\060\060\060\060\060\132\027\015\061\064\060\063\061
+\064\062\063\065\071\065\071\132\060\201\337\061\013\060\011\006
+\003\125\004\006\023\002\125\123\061\016\060\014\006\003\125\004
+\021\023\005\063\070\064\067\067\061\020\060\016\006\003\125\004
+\010\023\007\106\154\157\162\151\144\141\061\020\060\016\006\003
+\125\004\007\023\007\105\156\147\154\151\163\150\061\027\060\025
+\006\003\125\004\011\023\016\123\145\141\040\126\151\154\154\141
+\147\145\040\061\060\061\024\060\022\006\003\125\004\012\023\013
+\107\157\157\147\154\145\040\114\164\144\056\061\023\060\021\006
+\003\125\004\013\023\012\124\145\143\150\040\104\145\160\164\056
+\061\050\060\046\006\003\125\004\013\023\037\110\157\163\164\145
+\144\040\142\171\040\107\124\111\040\107\162\157\165\160\040\103
+\157\162\160\157\162\141\164\151\157\156\061\024\060\022\006\003
+\125\004\013\023\013\120\154\141\164\151\156\165\155\123\123\114
+\061\030\060\026\006\003\125\004\003\023\017\154\157\147\151\156
+\056\171\141\150\157\157\056\143\157\155\060\202\001\042\060\015
+\006\011\052\206\110\206\367\015\001\001\001\005\000\003\202\001
+\017\000\060\202\001\012\002\202\001\001\000\241\244\005\075\355
+\205\105\223\212\030\115\306\003\000\127\342\100\167\360\034\353
+\320\031\337\042\135\010\177\321\007\074\101\211\106\027\243\011
+\372\374\370\251\004\321\226\217\253\327\117\074\371\255\030\251
+\164\201\304\127\012\072\046\026\316\142\076\274\077\154\041\356
+\223\215\313\015\240\037\232\226\320\217\255\365\223\223\202\356
+\162\014\241\165\025\243\173\204\126\270\255\377\122\021\161\204
+\274\072\060\013\176\230\250\341\250\077\067\122\320\361\174\157
+\220\330\105\012\254\071\162\152\141\325\273\303\214\371\302\314
+\337\375\072\161\271\257\274\334\072\334\014\266\261\322\321\211
+\273\101\266\362\336\127\325\025\337\374\375\342\061\305\337\312
+\301\330\217\054\277\360\016\133\161\340\064\161\303\305\115\175
+\172\324\372\355\060\113\057\352\266\056\236\223\074\342\072\370
+\102\242\032\356\334\337\315\017\251\366\171\204\032\216\154\002
+\266\206\345\277\121\152\146\370\363\234\323\131\014\173\245\231
+\170\315\174\231\372\306\226\107\330\062\324\164\166\016\167\113
+\040\164\244\267\211\165\222\112\264\133\125\002\003\001\000\001
+\243\202\001\325\060\202\001\321\060\037\006\003\125\035\043\004
+\030\060\026\200\024\241\162\137\046\033\050\230\103\225\135\007
+\067\325\205\226\235\113\322\303\105\060\035\006\003\125\035\016
+\004\026\004\024\206\111\105\374\063\031\063\324\004\355\047\141
+\356\350\001\311\014\177\057\176\060\016\006\003\125\035\017\001
+\001\377\004\004\003\002\005\240\060\014\006\003\125\035\023\001
+\001\377\004\002\060\000\060\035\006\003\125\035\045\004\026\060
+\024\006\010\053\006\001\005\005\007\003\001\006\010\053\006\001
+\005\005\007\003\002\060\106\006\003\125\035\040\004\077\060\075
+\060\073\006\014\053\006\001\004\001\262\061\001\002\001\003\004
+\060\053\060\051\006\010\053\006\001\005\005\007\002\001\026\035
+\150\164\164\160\163\072\057\057\163\145\143\165\162\145\056\143
+\157\155\157\144\157\056\143\157\155\057\103\120\123\060\173\006
+\003\125\035\037\004\164\060\162\060\070\240\066\240\064\206\062
+\150\164\164\160\072\057\057\143\162\154\056\143\157\155\157\144
+\157\143\141\056\143\157\155\057\125\124\116\055\125\123\105\122
+\106\151\162\163\164\055\110\141\162\144\167\141\162\145\056\143
+\162\154\060\066\240\064\240\062\206\060\150\164\164\160\072\057
+\057\143\162\154\056\143\157\155\157\144\157\056\156\145\164\057
+\125\124\116\055\125\123\105\122\106\151\162\163\164\055\110\141
+\162\144\167\141\162\145\056\143\162\154\060\161\006\010\053\006
+\001\005\005\007\001\001\004\145\060\143\060\073\006\010\053\006
+\001\005\005\007\060\002\206\057\150\164\164\160\072\057\057\143
+\162\164\056\143\157\155\157\144\157\143\141\056\143\157\155\057
+\125\124\116\101\144\144\124\162\165\163\164\123\145\162\166\145
+\162\103\101\056\143\162\164\060\044\006\010\053\006\001\005\005
+\007\060\001\206\030\150\164\164\160\072\057\057\157\143\163\160
+\056\143\157\155\157\144\157\143\141\056\143\157\155\060\032\006
+\003\125\035\021\004\023\060\021\202\017\154\157\147\151\156\056
+\171\141\150\157\157\056\143\157\155\060\015\006\011\052\206\110
+\206\367\015\001\001\005\005\000\003\202\001\001\000\123\151\230
+\216\050\116\234\053\133\035\314\153\167\050\075\273\372\245\116
+\176\126\051\244\352\020\342\364\346\055\006\321\204\333\043\316
+\227\363\150\266\017\072\336\025\013\044\035\221\343\154\056\060
+\267\351\160\260\303\106\200\360\323\261\121\277\117\326\170\240
+\374\254\306\317\061\004\143\342\064\125\005\112\075\366\060\272
+\363\063\345\272\322\226\363\325\261\266\223\211\032\244\150\276
+\176\355\143\264\032\110\300\123\344\243\360\071\014\062\222\307
+\103\015\032\161\355\320\106\223\277\223\142\154\063\113\315\066
+\015\151\136\273\154\226\231\041\151\304\113\147\162\333\154\152
+\270\367\150\355\305\217\255\143\145\225\012\114\340\371\017\176
+\067\075\252\324\223\272\147\011\303\245\244\015\003\132\155\325
+\013\376\360\100\024\264\366\270\151\174\155\302\062\113\237\265
+\032\347\106\256\114\132\053\252\172\136\220\127\225\372\333\146
+\002\040\036\152\151\146\025\234\302\266\365\274\120\265\375\105
+\307\037\150\264\107\131\254\304\033\050\223\116\122\123\022\003
+\130\113\161\203\237\146\346\254\171\110\376\376\107
+END
+
+# Trust for Certificate "Bogus Yahoo 3"
+# Issuer: CN=UTN-USERFirst-Hardware,OU=http://www.usertrust.com,O=The USERTRUST Network,L=Salt Lake City,ST=UT,C=US
+# Serial Number:3e:75:ce:d4:6b:69:30:21:21:88:30:ae:86:a8:2a:71
+# Subject: CN=login.yahoo.com,OU=PlatinumSSL,OU=Hosted by GTI Group Corporation,OU=Tech Dept.,O=Google Ltd.,STREET=Sea Village 10,L=English,ST=Florida,postalCode=38477,C=US
+# Not Valid Before: Tue Mar 15 00:00:00 2011
+# Not Valid After : Fri Mar 14 23:59:59 2014
+# Fingerprint (MD5): 4A:DC:3C:67:ED:21:CD:5B:CE:5D:C8:11:E4:9E:CF:3D
+# Fingerprint (SHA1): 80:96:2A:E4:D6:C5:B4:42:89:4E:95:A1:3E:4A:69:9E:07:D6:94:CF
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Bogus Yahoo 3"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\200\226\052\344\326\305\264\102\211\116\225\241\076\112\151\236
+\007\326\224\317
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\112\334\074\147\355\041\315\133\316\135\310\021\344\236\317\075
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\227\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\013\060\011\006\003\125\004\010\023\002\125\124\061\027\060
+\025\006\003\125\004\007\023\016\123\141\154\164\040\114\141\153
+\145\040\103\151\164\171\061\036\060\034\006\003\125\004\012\023
+\025\124\150\145\040\125\123\105\122\124\122\125\123\124\040\116
+\145\164\167\157\162\153\061\041\060\037\006\003\125\004\013\023
+\030\150\164\164\160\072\057\057\167\167\167\056\165\163\145\162
+\164\162\165\163\164\056\143\157\155\061\037\060\035\006\003\125
+\004\003\023\026\125\124\116\055\125\123\105\122\106\151\162\163
+\164\055\110\141\162\144\167\141\162\145
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\020\076\165\316\324\153\151\060\041\041\210\060\256\206\250
+\052\161
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "Bogus live.com"
+#
+# Issuer: CN=UTN-USERFirst-Hardware,OU=http://www.usertrust.com,O=The USERTRUST Network,L=Salt Lake City,ST=UT,C=US
+# Serial Number:00:b0:b7:13:3e:d0:96:f9:b5:6f:ae:91:c8:74:bd:3a:c0
+# Subject: CN=login.live.com,OU=PlatinumSSL,OU=Hosted by GTI Group Corporation,OU=Tech Dept.,O=Google Ltd.,STREET=Sea Village 10,L=English,ST=Florida,postalCode=38477,C=US
+# Not Valid Before: Tue Mar 15 00:00:00 2011
+# Not Valid After : Fri Mar 14 23:59:59 2014
+# Fingerprint (MD5): D0:D4:39:E3:CC:5C:52:DD:08:CD:E9:AB:E8:11:59:D4
+# Fingerprint (SHA1): CE:A5:86:B2:CE:59:3E:C7:D9:39:89:83:37:C5:78:14:70:8A:B2:BE
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Bogus live.com"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\201\336\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\016\060\014\006\003\125\004\021\023\005\063\070\064\067\067
+\061\020\060\016\006\003\125\004\010\023\007\106\154\157\162\151
+\144\141\061\020\060\016\006\003\125\004\007\023\007\105\156\147
+\154\151\163\150\061\027\060\025\006\003\125\004\011\023\016\123
+\145\141\040\126\151\154\154\141\147\145\040\061\060\061\024\060
+\022\006\003\125\004\012\023\013\107\157\157\147\154\145\040\114
+\164\144\056\061\023\060\021\006\003\125\004\013\023\012\124\145
+\143\150\040\104\145\160\164\056\061\050\060\046\006\003\125\004
+\013\023\037\110\157\163\164\145\144\040\142\171\040\107\124\111
+\040\107\162\157\165\160\040\103\157\162\160\157\162\141\164\151
+\157\156\061\024\060\022\006\003\125\004\013\023\013\120\154\141
+\164\151\156\165\155\123\123\114\061\027\060\025\006\003\125\004
+\003\023\016\154\157\147\151\156\056\154\151\166\145\056\143\157
+\155
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\227\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\013\060\011\006\003\125\004\010\023\002\125\124\061\027\060
+\025\006\003\125\004\007\023\016\123\141\154\164\040\114\141\153
+\145\040\103\151\164\171\061\036\060\034\006\003\125\004\012\023
+\025\124\150\145\040\125\123\105\122\124\122\125\123\124\040\116
+\145\164\167\157\162\153\061\041\060\037\006\003\125\004\013\023
+\030\150\164\164\160\072\057\057\167\167\167\056\165\163\145\162
+\164\162\165\163\164\056\143\157\155\061\037\060\035\006\003\125
+\004\003\023\026\125\124\116\055\125\123\105\122\106\151\162\163
+\164\055\110\141\162\144\167\141\162\145
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\021\000\260\267\023\076\320\226\371\265\157\256\221\310\164
+\275\072\300
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\005\354\060\202\004\324\240\003\002\001\002\002\021\000
+\260\267\023\076\320\226\371\265\157\256\221\310\164\275\072\300
+\060\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060
+\201\227\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\013\060\011\006\003\125\004\010\023\002\125\124\061\027\060\025
+\006\003\125\004\007\023\016\123\141\154\164\040\114\141\153\145
+\040\103\151\164\171\061\036\060\034\006\003\125\004\012\023\025
+\124\150\145\040\125\123\105\122\124\122\125\123\124\040\116\145
+\164\167\157\162\153\061\041\060\037\006\003\125\004\013\023\030
+\150\164\164\160\072\057\057\167\167\167\056\165\163\145\162\164
+\162\165\163\164\056\143\157\155\061\037\060\035\006\003\125\004
+\003\023\026\125\124\116\055\125\123\105\122\106\151\162\163\164
+\055\110\141\162\144\167\141\162\145\060\036\027\015\061\061\060
+\063\061\065\060\060\060\060\060\060\132\027\015\061\064\060\063
+\061\064\062\063\065\071\065\071\132\060\201\336\061\013\060\011
+\006\003\125\004\006\023\002\125\123\061\016\060\014\006\003\125
+\004\021\023\005\063\070\064\067\067\061\020\060\016\006\003\125
+\004\010\023\007\106\154\157\162\151\144\141\061\020\060\016\006
+\003\125\004\007\023\007\105\156\147\154\151\163\150\061\027\060
+\025\006\003\125\004\011\023\016\123\145\141\040\126\151\154\154
+\141\147\145\040\061\060\061\024\060\022\006\003\125\004\012\023
+\013\107\157\157\147\154\145\040\114\164\144\056\061\023\060\021
+\006\003\125\004\013\023\012\124\145\143\150\040\104\145\160\164
+\056\061\050\060\046\006\003\125\004\013\023\037\110\157\163\164
+\145\144\040\142\171\040\107\124\111\040\107\162\157\165\160\040
+\103\157\162\160\157\162\141\164\151\157\156\061\024\060\022\006
+\003\125\004\013\023\013\120\154\141\164\151\156\165\155\123\123
+\114\061\027\060\025\006\003\125\004\003\023\016\154\157\147\151
+\156\056\154\151\166\145\056\143\157\155\060\202\001\042\060\015
+\006\011\052\206\110\206\367\015\001\001\001\005\000\003\202\001
+\017\000\060\202\001\012\002\202\001\001\000\363\374\053\057\357
+\341\255\131\360\102\074\302\361\202\277\054\101\223\321\366\230
+\063\225\114\274\142\361\225\130\010\266\351\173\167\110\260\323
+\334\027\077\274\156\346\354\036\354\215\027\376\034\044\306\076
+\147\075\222\225\242\060\300\247\127\040\317\160\210\227\112\005
+\223\171\223\102\227\057\076\377\304\024\024\050\242\023\066\264
+\370\356\276\035\274\170\135\141\223\137\353\210\327\321\344\053
+\232\315\130\342\007\105\237\117\270\271\100\152\063\054\133\041
+\003\132\112\224\362\172\227\131\033\250\265\102\330\203\000\252
+\064\314\247\166\320\107\003\137\005\257\073\341\271\241\064\045
+\267\154\137\232\060\204\230\302\302\327\362\270\102\112\020\125
+\275\372\123\201\135\215\150\146\105\054\122\176\345\304\004\303
+\124\347\303\071\332\172\112\305\271\230\202\040\341\054\140\127
+\277\272\362\106\000\274\137\072\334\343\063\227\370\112\230\271
+\354\063\117\055\140\154\025\222\246\201\112\013\351\354\166\160
+\064\061\027\160\346\160\113\216\213\323\165\313\170\111\253\146
+\233\206\237\217\251\304\001\350\312\033\347\002\003\001\000\001
+\243\202\001\350\060\202\001\344\060\037\006\003\125\035\043\004
+\030\060\026\200\024\241\162\137\046\033\050\230\103\225\135\007
+\067\325\205\226\235\113\322\303\105\060\035\006\003\125\035\016
+\004\026\004\024\324\144\366\251\350\245\176\327\277\143\122\003
+\203\123\333\305\101\215\352\200\060\016\006\003\125\035\017\001
+\001\377\004\004\003\002\005\240\060\014\006\003\125\035\023\001
+\001\377\004\002\060\000\060\035\006\003\125\035\045\004\026\060
+\024\006\010\053\006\001\005\005\007\003\001\006\010\053\006\001
+\005\005\007\003\002\060\106\006\003\125\035\040\004\077\060\075
+\060\073\006\014\053\006\001\004\001\262\061\001\002\001\003\004
+\060\053\060\051\006\010\053\006\001\005\005\007\002\001\026\035
+\150\164\164\160\163\072\057\057\163\145\143\165\162\145\056\143
+\157\155\157\144\157\056\143\157\155\057\103\120\123\060\173\006
+\003\125\035\037\004\164\060\162\060\070\240\066\240\064\206\062
+\150\164\164\160\072\057\057\143\162\154\056\143\157\155\157\144
+\157\143\141\056\143\157\155\057\125\124\116\055\125\123\105\122
+\106\151\162\163\164\055\110\141\162\144\167\141\162\145\056\143
+\162\154\060\066\240\064\240\062\206\060\150\164\164\160\072\057
+\057\143\162\154\056\143\157\155\157\144\157\056\156\145\164\057
+\125\124\116\055\125\123\105\122\106\151\162\163\164\055\110\141
+\162\144\167\141\162\145\056\143\162\154\060\161\006\010\053\006
+\001\005\005\007\001\001\004\145\060\143\060\073\006\010\053\006
+\001\005\005\007\060\002\206\057\150\164\164\160\072\057\057\143
+\162\164\056\143\157\155\157\144\157\143\141\056\143\157\155\057
+\125\124\116\101\144\144\124\162\165\163\164\123\145\162\166\145
+\162\103\101\056\143\162\164\060\044\006\010\053\006\001\005\005
+\007\060\001\206\030\150\164\164\160\072\057\057\157\143\163\160
+\056\143\157\155\157\144\157\143\141\056\143\157\155\060\055\006
+\003\125\035\021\004\046\060\044\202\016\154\157\147\151\156\056
+\154\151\166\145\056\143\157\155\202\022\167\167\167\056\154\157
+\147\151\156\056\154\151\166\145\056\143\157\155\060\015\006\011
+\052\206\110\206\367\015\001\001\005\005\000\003\202\001\001\000
+\124\343\244\232\044\322\363\035\102\255\033\360\036\253\373\332
+\325\252\351\317\132\263\036\127\173\061\362\156\127\113\061\257
+\063\273\266\015\025\307\136\131\001\316\104\265\267\277\011\311
+\325\334\151\204\351\305\032\267\360\076\324\300\044\275\051\137
+\264\351\326\130\353\105\021\211\064\064\323\021\353\064\316\052
+\117\000\075\366\162\357\151\146\300\237\232\254\176\160\120\254
+\125\107\332\276\103\133\354\213\310\305\043\204\311\237\266\122
+\010\317\221\033\057\200\151\346\064\063\346\263\237\244\345\015
+\232\025\371\127\374\013\251\101\013\365\377\130\101\222\042\047
+\146\022\006\307\052\330\131\247\306\337\104\022\117\300\250\177
+\247\101\310\310\151\377\272\005\056\227\255\073\320\353\363\025
+\155\176\033\345\272\335\064\276\042\021\354\150\230\063\201\002
+\152\013\023\125\171\061\165\116\072\310\266\023\275\227\157\067
+\012\013\055\210\016\336\147\220\302\263\312\040\312\232\121\364
+\144\076\333\364\056\105\362\307\107\027\250\364\372\220\132\177
+\200\246\202\254\344\154\201\106\273\122\205\040\044\370\200\352
+END
+
+# Trust for Certificate "Bogus live.com"
+# Issuer: CN=UTN-USERFirst-Hardware,OU=http://www.usertrust.com,O=The USERTRUST Network,L=Salt Lake City,ST=UT,C=US
+# Serial Number:00:b0:b7:13:3e:d0:96:f9:b5:6f:ae:91:c8:74:bd:3a:c0
+# Subject: CN=login.live.com,OU=PlatinumSSL,OU=Hosted by GTI Group Corporation,OU=Tech Dept.,O=Google Ltd.,STREET=Sea Village 10,L=English,ST=Florida,postalCode=38477,C=US
+# Not Valid Before: Tue Mar 15 00:00:00 2011
+# Not Valid After : Fri Mar 14 23:59:59 2014
+# Fingerprint (MD5): D0:D4:39:E3:CC:5C:52:DD:08:CD:E9:AB:E8:11:59:D4
+# Fingerprint (SHA1): CE:A5:86:B2:CE:59:3E:C7:D9:39:89:83:37:C5:78:14:70:8A:B2:BE
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Bogus live.com"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\316\245\206\262\316\131\076\307\331\071\211\203\067\305\170\024
+\160\212\262\276
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\320\324\071\343\314\134\122\335\010\315\351\253\350\021\131\324
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\227\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\013\060\011\006\003\125\004\010\023\002\125\124\061\027\060
+\025\006\003\125\004\007\023\016\123\141\154\164\040\114\141\153
+\145\040\103\151\164\171\061\036\060\034\006\003\125\004\012\023
+\025\124\150\145\040\125\123\105\122\124\122\125\123\124\040\116
+\145\164\167\157\162\153\061\041\060\037\006\003\125\004\013\023
+\030\150\164\164\160\072\057\057\167\167\167\056\165\163\145\162
+\164\162\165\163\164\056\143\157\155\061\037\060\035\006\003\125
+\004\003\023\026\125\124\116\055\125\123\105\122\106\151\162\163
+\164\055\110\141\162\144\167\141\162\145
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\021\000\260\267\023\076\320\226\371\265\157\256\221\310\164
+\275\072\300
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
# Certificate "Go Daddy Root Certificate Authority - G2"
#
# Issuer: CN=Go Daddy Root Certificate Authority - G2,O="GoDaddy.com, Inc.",L=Scottsdale,ST=Arizona,C=US
@@ -11728,6 +14493,175 @@ CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
#
+# Certificate "Certinomis - Autorité Racine"
+#
+# Issuer: CN=Certinomis - Autorit.. Racine,OU=0002 433998903,O=Certinomis,C=FR
+# Serial Number: 1 (0x1)
+# Subject: CN=Certinomis - Autorit.. Racine,OU=0002 433998903,O=Certinomis,C=FR
+# Not Valid Before: Wed Sep 17 08:28:59 2008
+# Not Valid After : Sun Sep 17 08:28:59 2028
+# Fingerprint (MD5): 7F:30:78:8C:03:E3:CA:C9:0A:E2:C9:EA:1E:AA:55:1A
+# Fingerprint (SHA1): 2E:14:DA:EC:28:F0:FA:1E:8E:38:9A:4E:AB:EB:26:C0:0A:D3:83:C3
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Certinomis - Autorité Racine"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\143\061\013\060\011\006\003\125\004\006\023\002\106\122\061
+\023\060\021\006\003\125\004\012\023\012\103\145\162\164\151\156
+\157\155\151\163\061\027\060\025\006\003\125\004\013\023\016\060
+\060\060\062\040\064\063\063\071\071\070\071\060\063\061\046\060
+\044\006\003\125\004\003\014\035\103\145\162\164\151\156\157\155
+\151\163\040\055\040\101\165\164\157\162\151\164\303\251\040\122
+\141\143\151\156\145
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\143\061\013\060\011\006\003\125\004\006\023\002\106\122\061
+\023\060\021\006\003\125\004\012\023\012\103\145\162\164\151\156
+\157\155\151\163\061\027\060\025\006\003\125\004\013\023\016\060
+\060\060\062\040\064\063\063\071\071\070\071\060\063\061\046\060
+\044\006\003\125\004\003\014\035\103\145\162\164\151\156\157\155
+\151\163\040\055\040\101\165\164\157\162\151\164\303\251\040\122
+\141\143\151\156\145
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\001\001
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\005\234\060\202\003\204\240\003\002\001\002\002\001\001
+\060\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060
+\143\061\013\060\011\006\003\125\004\006\023\002\106\122\061\023
+\060\021\006\003\125\004\012\023\012\103\145\162\164\151\156\157
+\155\151\163\061\027\060\025\006\003\125\004\013\023\016\060\060
+\060\062\040\064\063\063\071\071\070\071\060\063\061\046\060\044
+\006\003\125\004\003\014\035\103\145\162\164\151\156\157\155\151
+\163\040\055\040\101\165\164\157\162\151\164\303\251\040\122\141
+\143\151\156\145\060\036\027\015\060\070\060\071\061\067\060\070
+\062\070\065\071\132\027\015\062\070\060\071\061\067\060\070\062
+\070\065\071\132\060\143\061\013\060\011\006\003\125\004\006\023
+\002\106\122\061\023\060\021\006\003\125\004\012\023\012\103\145
+\162\164\151\156\157\155\151\163\061\027\060\025\006\003\125\004
+\013\023\016\060\060\060\062\040\064\063\063\071\071\070\071\060
+\063\061\046\060\044\006\003\125\004\003\014\035\103\145\162\164
+\151\156\157\155\151\163\040\055\040\101\165\164\157\162\151\164
+\303\251\040\122\141\143\151\156\145\060\202\002\042\060\015\006
+\011\052\206\110\206\367\015\001\001\001\005\000\003\202\002\017
+\000\060\202\002\012\002\202\002\001\000\235\205\237\206\323\343
+\257\307\262\153\156\063\340\236\267\102\064\125\235\371\201\276
+\143\330\043\166\016\227\124\315\231\114\032\361\071\307\210\330
+\027\120\014\236\141\332\300\116\125\336\347\132\270\172\116\167
+\207\015\345\270\353\372\236\136\173\036\304\317\050\164\307\223
+\365\024\306\042\050\004\371\221\303\253\047\163\152\016\056\115
+\363\056\050\037\160\337\125\057\116\355\307\161\157\011\162\056
+\355\325\062\227\320\361\130\167\321\140\274\116\136\333\232\204
+\366\107\141\105\053\366\120\246\177\152\161\047\110\204\065\236
+\254\376\151\251\236\172\136\065\045\372\264\247\111\065\167\226
+\247\066\133\341\315\337\043\160\330\135\114\245\010\203\361\246
+\044\070\023\250\354\057\250\241\147\307\246\055\206\107\356\212
+\374\354\233\016\164\364\053\111\002\173\220\165\214\374\231\071
+\001\071\326\112\211\345\236\166\253\076\226\050\070\046\213\335
+\215\214\300\366\001\036\157\245\061\022\070\175\225\302\161\356
+\355\164\256\344\066\242\103\165\325\361\000\233\342\344\327\314
+\102\003\113\170\172\345\175\273\270\256\056\040\223\323\344\141
+\337\161\341\166\147\227\077\266\337\152\163\132\144\042\345\102
+\333\317\201\003\223\330\364\343\020\340\162\366\000\160\254\360
+\301\172\017\005\177\317\064\151\105\265\223\344\031\333\122\026
+\043\005\211\016\215\110\344\045\157\263\170\277\142\365\007\372
+\225\044\302\226\262\350\243\043\302\135\003\374\303\323\345\174
+\311\165\043\327\364\365\274\336\344\337\315\200\277\221\210\175
+\247\023\264\071\272\054\272\275\321\153\314\363\245\050\355\104
+\236\175\122\243\157\226\056\031\176\034\363\133\307\026\216\273
+\140\175\167\146\107\124\202\000\021\140\154\062\301\250\070\033
+\353\156\230\023\326\356\070\365\360\237\016\357\376\061\201\301
+\322\044\225\057\123\172\151\242\360\017\206\105\216\130\202\053
+\114\042\324\136\240\347\175\046\047\110\337\045\106\215\112\050
+\174\206\236\371\233\032\131\271\145\277\005\335\266\102\135\075
+\346\000\110\202\136\040\367\021\202\336\312\330\237\346\067\107
+\046\036\353\170\367\141\303\101\144\130\002\101\371\332\340\321
+\370\371\350\375\122\070\266\365\211\337\002\003\001\000\001\243
+\133\060\131\060\017\006\003\125\035\023\001\001\377\004\005\060
+\003\001\001\377\060\016\006\003\125\035\017\001\001\377\004\004
+\003\002\001\006\060\035\006\003\125\035\016\004\026\004\024\015
+\214\266\141\332\104\270\321\024\175\303\276\175\136\110\360\316
+\312\152\260\060\027\006\003\125\035\040\004\020\060\016\060\014
+\006\012\052\201\172\001\126\002\002\000\001\001\060\015\006\011
+\052\206\110\206\367\015\001\001\005\005\000\003\202\002\001\000
+\044\076\140\006\176\035\357\072\076\333\352\257\034\232\054\001
+\013\364\305\265\331\111\061\364\135\101\215\211\014\116\377\154
+\242\375\377\342\006\310\071\237\361\132\251\335\042\130\025\250
+\212\323\261\346\062\011\202\003\154\327\077\010\307\370\271\272
+\000\155\271\326\374\122\062\135\244\177\244\061\224\273\266\114
+\070\177\050\060\065\377\237\043\123\267\266\356\024\160\000\100
+\053\332\107\253\064\176\136\247\126\060\141\053\213\103\254\375
+\266\210\050\365\153\266\076\140\112\272\102\220\064\147\215\352
+\353\137\105\124\073\027\254\213\344\306\145\017\356\320\214\135
+\146\071\316\062\247\330\020\227\300\176\064\234\237\224\363\366
+\206\037\317\033\163\255\224\171\207\150\160\303\063\245\160\347
+\330\325\070\224\157\143\171\353\277\012\016\010\347\305\057\017
+\102\240\053\024\100\377\041\340\005\305\047\341\204\021\023\272
+\326\206\035\101\013\023\043\211\323\311\013\350\212\272\172\243
+\243\163\067\065\200\175\022\270\063\167\100\070\300\372\136\060
+\322\362\266\243\261\326\242\225\227\201\233\122\355\151\114\377
+\200\344\123\333\124\133\003\155\124\137\261\270\357\044\275\157
+\237\021\303\307\144\302\017\050\142\205\146\136\032\173\262\267
+\357\256\065\311\031\063\250\270\047\333\063\125\277\150\341\165
+\110\104\126\373\315\323\110\273\107\211\072\254\151\365\200\306
+\344\104\120\057\124\304\252\103\305\061\061\130\275\226\305\352
+\165\154\232\165\261\115\370\367\227\377\226\026\362\227\115\350
+\366\363\021\371\072\175\212\070\156\004\313\341\323\105\025\252
+\245\321\035\235\135\143\350\044\346\066\024\342\207\255\033\131
+\365\104\233\373\327\167\174\037\001\160\142\241\040\032\242\305
+\032\050\364\041\003\356\056\331\301\200\352\271\331\202\326\133
+\166\302\313\073\265\322\000\360\243\016\341\255\156\100\367\333
+\240\264\320\106\256\025\327\104\302\115\065\371\322\013\362\027
+\366\254\146\325\044\262\117\321\034\231\300\156\365\175\353\164
+\004\270\371\115\167\011\327\264\317\007\060\011\361\270\000\126
+\331\027\026\026\012\053\206\337\217\001\031\032\345\273\202\143
+\377\276\013\166\026\136\067\067\346\330\164\227\242\231\105\171
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for Certificate "Certinomis - Autorité Racine"
+# Issuer: CN=Certinomis - Autorit.. Racine,OU=0002 433998903,O=Certinomis,C=FR
+# Serial Number: 1 (0x1)
+# Subject: CN=Certinomis - Autorit.. Racine,OU=0002 433998903,O=Certinomis,C=FR
+# Not Valid Before: Wed Sep 17 08:28:59 2008
+# Not Valid After : Sun Sep 17 08:28:59 2028
+# Fingerprint (MD5): 7F:30:78:8C:03:E3:CA:C9:0A:E2:C9:EA:1E:AA:55:1A
+# Fingerprint (SHA1): 2E:14:DA:EC:28:F0:FA:1E:8E:38:9A:4E:AB:EB:26:C0:0A:D3:83:C3
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Certinomis - Autorité Racine"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\056\024\332\354\050\360\372\036\216\070\232\116\253\353\046\300
+\012\323\203\303
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\177\060\170\214\003\343\312\311\012\342\311\352\036\252\125\032
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\143\061\013\060\011\006\003\125\004\006\023\002\106\122\061
+\023\060\021\006\003\125\004\012\023\012\103\145\162\164\151\156
+\157\155\151\163\061\027\060\025\006\003\125\004\013\023\016\060
+\060\060\062\040\064\063\063\071\071\070\071\060\063\061\046\060
+\044\006\003\125\004\003\014\035\103\145\162\164\151\156\157\155
+\151\163\040\055\040\101\165\164\157\162\151\164\303\251\040\122
+\141\143\151\156\145
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\001\001
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
# Certificate "TWCA Root Certification Authority"
#
# Issuer: CN=TWCA Root Certification Authority,OU=Root CA,O=TAIWAN-CA,C=TW
@@ -12032,6 +14966,605 @@ CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
#
+# Certificate "Explicitly Distrust DigiNotar Services 1024 CA"
+#
+# Issuer: E=info@diginotar.nl,CN=DigiNotar Services 1024 CA,O=DigiNotar,C=NL
+# Serial Number: 268435455 (0xfffffff)
+# Subject: E=info@diginotar.nl,CN=DigiNotar Services 1024 CA,O=DigiNotar,C=NL
+# Not Valid Before: Thu Jul 26 15:59:01 2007
+# Not Valid After : Mon Aug 26 16:29:01 2013
+# Fingerprint (MD5): 2F:16:68:97:4C:68:4F:CE:52:8A:EC:53:8F:93:49:F8
+# Fingerprint (SHA1): 12:3B:EA:CA:66:67:77:61:E0:EB:68:F2:FE:ED:A2:0F:20:05:55:70
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Explicitly Distrust DigiNotar Services 1024 CA"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\150\061\013\060\011\006\003\125\004\006\023\002\116\114\061
+\022\060\020\006\003\125\004\012\023\011\104\151\147\151\116\157
+\164\141\162\061\043\060\041\006\003\125\004\003\023\032\104\151
+\147\151\116\157\164\141\162\040\123\145\162\166\151\143\145\163
+\040\061\060\062\064\040\103\101\061\040\060\036\006\011\052\206
+\110\206\367\015\001\011\001\026\021\151\156\146\157\100\144\151
+\147\151\156\157\164\141\162\056\156\154
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\150\061\013\060\011\006\003\125\004\006\023\002\116\114\061
+\022\060\020\006\003\125\004\012\023\011\104\151\147\151\116\157
+\164\141\162\061\043\060\041\006\003\125\004\003\023\032\104\151
+\147\151\116\157\164\141\162\040\123\145\162\166\151\143\145\163
+\040\061\060\062\064\040\103\101\061\040\060\036\006\011\052\206
+\110\206\367\015\001\011\001\026\021\151\156\146\157\100\144\151
+\147\151\156\157\164\141\162\056\156\154
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\004\017\377\377\377
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\003\161\060\202\002\332\240\003\002\001\002\002\004\017
+\377\377\377\060\015\006\011\052\206\110\206\367\015\001\001\005
+\005\000\060\150\061\013\060\011\006\003\125\004\006\023\002\116
+\114\061\022\060\020\006\003\125\004\012\023\011\104\151\147\151
+\116\157\164\141\162\061\043\060\041\006\003\125\004\003\023\032
+\104\151\147\151\116\157\164\141\162\040\123\145\162\166\151\143
+\145\163\040\061\060\062\064\040\103\101\061\040\060\036\006\011
+\052\206\110\206\367\015\001\011\001\026\021\151\156\146\157\100
+\144\151\147\151\156\157\164\141\162\056\156\154\060\036\027\015
+\060\067\060\067\062\066\061\065\065\071\060\061\132\027\015\061
+\063\060\070\062\066\061\066\062\071\060\061\132\060\150\061\013
+\060\011\006\003\125\004\006\023\002\116\114\061\022\060\020\006
+\003\125\004\012\023\011\104\151\147\151\116\157\164\141\162\061
+\043\060\041\006\003\125\004\003\023\032\104\151\147\151\116\157
+\164\141\162\040\123\145\162\166\151\143\145\163\040\061\060\062
+\064\040\103\101\061\040\060\036\006\011\052\206\110\206\367\015
+\001\011\001\026\021\151\156\146\157\100\144\151\147\151\156\157
+\164\141\162\056\156\154\060\201\237\060\015\006\011\052\206\110
+\206\367\015\001\001\001\005\000\003\201\215\000\060\201\211\002
+\201\201\000\332\233\115\135\074\371\321\342\213\306\306\010\040
+\305\331\036\110\354\146\130\147\171\142\053\101\143\364\211\215
+\150\332\257\270\224\066\213\031\044\244\240\223\322\231\017\262
+\255\055\065\115\315\057\152\341\371\233\031\053\274\004\032\176
+\055\075\122\144\315\361\076\147\017\211\056\350\362\117\256\246
+\010\241\205\376\241\251\011\346\306\253\076\103\374\257\172\003
+\221\332\246\071\246\141\356\230\117\030\250\323\263\257\146\202
+\351\237\274\335\162\371\006\004\275\022\331\030\044\347\253\223
+\123\213\131\002\003\001\000\001\243\202\001\046\060\202\001\042
+\060\022\006\003\125\035\023\001\001\377\004\010\060\006\001\001
+\377\002\001\000\060\047\006\003\125\035\045\004\040\060\036\006
+\010\053\006\001\005\005\007\003\001\006\010\053\006\001\005\005
+\007\003\002\006\010\053\006\001\005\005\007\003\004\060\021\006
+\003\125\035\040\004\012\060\010\060\006\006\004\125\035\040\000
+\060\063\006\010\053\006\001\005\005\007\001\001\004\047\060\045
+\060\043\006\010\053\006\001\005\005\007\060\001\206\027\150\164
+\164\160\072\057\057\157\143\163\160\056\145\156\164\162\165\163
+\164\056\156\145\164\060\063\006\003\125\035\037\004\054\060\052
+\060\050\240\046\240\044\206\042\150\164\164\160\072\057\057\143
+\162\154\056\145\156\164\162\165\163\164\056\156\145\164\057\163
+\145\162\166\145\162\061\056\143\162\154\060\035\006\003\125\035
+\016\004\026\004\024\376\334\224\111\014\157\357\134\177\306\361
+\022\231\117\026\111\255\373\202\145\060\013\006\003\125\035\017
+\004\004\003\002\001\006\060\037\006\003\125\035\043\004\030\060
+\026\200\024\360\027\142\023\125\075\263\377\012\000\153\373\120
+\204\227\363\355\142\320\032\060\031\006\011\052\206\110\206\366
+\175\007\101\000\004\014\060\012\033\004\126\067\056\061\003\002
+\000\201\060\015\006\011\052\206\110\206\367\015\001\001\005\005
+\000\003\201\201\000\143\164\152\067\251\077\226\234\146\310\130
+\254\011\311\357\365\145\224\177\243\002\304\070\061\275\135\043
+\207\354\324\126\262\311\262\156\344\005\006\374\354\365\372\210
+\160\131\324\356\346\335\265\172\240\243\140\057\002\014\253\336
+\022\135\257\360\065\113\252\212\107\221\032\365\205\054\102\307
+\035\357\225\103\263\136\270\225\223\245\332\305\050\252\255\162
+\055\061\255\231\153\154\377\214\041\047\257\255\232\221\053\307
+\335\130\303\156\007\305\237\171\322\307\214\125\277\114\307\047
+\136\121\026\053\076
+END
+
+# Trust for Certificate "Explicitly Distrust DigiNotar Services 1024 CA"
+# Issuer: E=info@diginotar.nl,CN=DigiNotar Services 1024 CA,O=DigiNotar,C=NL
+# Serial Number: 268435455 (0xfffffff)
+# Subject: E=info@diginotar.nl,CN=DigiNotar Services 1024 CA,O=DigiNotar,C=NL
+# Not Valid Before: Thu Jul 26 15:59:01 2007
+# Not Valid After : Mon Aug 26 16:29:01 2013
+# Fingerprint (MD5): 2F:16:68:97:4C:68:4F:CE:52:8A:EC:53:8F:93:49:F8
+# Fingerprint (SHA1): 12:3B:EA:CA:66:67:77:61:E0:EB:68:F2:FE:ED:A2:0F:20:05:55:70
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Explicitly Distrust DigiNotar Services 1024 CA"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\022\073\352\312\146\147\167\141\340\353\150\362\376\355\242\017
+\040\005\125\160
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\057\026\150\227\114\150\117\316\122\212\354\123\217\223\111\370
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\150\061\013\060\011\006\003\125\004\006\023\002\116\114\061
+\022\060\020\006\003\125\004\012\023\011\104\151\147\151\116\157
+\164\141\162\061\043\060\041\006\003\125\004\003\023\032\104\151
+\147\151\116\157\164\141\162\040\123\145\162\166\151\143\145\163
+\040\061\060\062\064\040\103\101\061\040\060\036\006\011\052\206
+\110\206\367\015\001\011\001\026\021\151\156\146\157\100\144\151
+\147\151\156\157\164\141\162\056\156\154
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\004\017\377\377\377
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "Explicitly Distrust DigiNotar Cyber CA"
+#
+# Issuer: E=info@diginotar.nl,CN=DigiNotar Cyber CA,O=DigiNotar,C=NL
+# Serial Number: 268435455 (0xfffffff)
+# Subject: E=info@diginotar.nl,CN=DigiNotar Cyber CA,O=DigiNotar,C=NL
+# Not Valid Before: Wed Oct 04 10:54:12 2006
+# Not Valid After : Tue Oct 04 10:53:12 2011
+# Fingerprint (MD5): BC:BD:89:12:B4:FF:E5:F9:26:47:C8:60:36:5B:D9:54
+# Fingerprint (SHA1): A5:8E:A0:EC:F6:44:56:35:19:1D:68:5B:C7:A0:E4:1C:B0:4D:79:2E
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Explicitly Distrust DigiNotar Cyber CA"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\140\061\013\060\011\006\003\125\004\006\023\002\116\114\061
+\022\060\020\006\003\125\004\012\023\011\104\151\147\151\116\157
+\164\141\162\061\033\060\031\006\003\125\004\003\023\022\104\151
+\147\151\116\157\164\141\162\040\103\171\142\145\162\040\103\101
+\061\040\060\036\006\011\052\206\110\206\367\015\001\011\001\026
+\021\151\156\146\157\100\144\151\147\151\156\157\164\141\162\056
+\156\154
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\140\061\013\060\011\006\003\125\004\006\023\002\116\114\061
+\022\060\020\006\003\125\004\012\023\011\104\151\147\151\116\157
+\164\141\162\061\033\060\031\006\003\125\004\003\023\022\104\151
+\147\151\116\157\164\141\162\040\103\171\142\145\162\040\103\101
+\061\040\060\036\006\011\052\206\110\206\367\015\001\011\001\026
+\021\151\156\146\157\100\144\151\147\151\156\157\164\141\162\056
+\156\154
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\004\017\377\377\377
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\005\105\060\202\004\256\240\003\002\001\002\002\004\017
+\377\377\377\060\015\006\011\052\206\110\206\367\015\001\001\005
+\005\000\060\140\061\013\060\011\006\003\125\004\006\023\002\116
+\114\061\022\060\020\006\003\125\004\012\023\011\104\151\147\151
+\116\157\164\141\162\061\033\060\031\006\003\125\004\003\023\022
+\104\151\147\151\116\157\164\141\162\040\103\171\142\145\162\040
+\103\101\061\040\060\036\006\011\052\206\110\206\367\015\001\011
+\001\026\021\151\156\146\157\100\144\151\147\151\156\157\164\141
+\162\056\156\154\060\036\027\015\060\066\061\060\060\064\061\060
+\065\064\061\062\132\027\015\061\061\061\060\060\064\061\060\065
+\063\061\062\132\060\140\061\013\060\011\006\003\125\004\006\023
+\002\116\114\061\022\060\020\006\003\125\004\012\023\011\104\151
+\147\151\116\157\164\141\162\061\033\060\031\006\003\125\004\003
+\023\022\104\151\147\151\116\157\164\141\162\040\103\171\142\145
+\162\040\103\101\061\040\060\036\006\011\052\206\110\206\367\015
+\001\011\001\026\021\151\156\146\157\100\144\151\147\151\156\157
+\164\141\162\056\156\154\060\202\002\042\060\015\006\011\052\206
+\110\206\367\015\001\001\001\005\000\003\202\002\017\000\060\202
+\002\012\002\202\002\001\000\322\316\025\012\055\250\136\204\147
+\255\375\276\357\106\307\310\271\317\163\374\364\064\271\371\054
+\103\347\140\023\075\172\343\262\317\073\147\154\220\255\300\271
+\077\204\122\360\065\102\334\164\334\050\073\275\122\264\247\254
+\162\105\027\306\360\211\353\264\252\045\362\135\113\136\321\331
+\207\272\326\175\174\365\316\062\237\020\063\305\261\112\273\136
+\221\061\302\320\351\101\302\221\144\176\011\101\073\333\213\010
+\067\152\252\312\122\336\265\071\036\300\210\003\245\077\213\231
+\023\141\103\265\233\202\263\356\040\157\317\241\104\242\352\057
+\153\100\237\217\053\127\255\241\123\302\205\042\151\235\240\077
+\121\337\013\101\221\015\245\341\250\252\134\111\010\135\275\336
+\160\101\261\017\311\143\153\323\177\064\164\002\057\064\132\170
+\165\034\150\172\201\147\212\363\332\100\360\140\143\364\222\040
+\327\003\246\075\243\036\147\304\204\033\101\245\311\214\346\275
+\352\110\266\005\026\010\263\067\022\132\367\141\074\367\070\157
+\056\227\340\157\126\070\124\323\050\265\255\024\156\056\113\144
+\265\047\145\267\165\045\011\266\007\075\225\126\002\012\202\140
+\262\163\105\340\063\046\121\164\232\271\324\120\034\366\115\133
+\133\122\122\023\132\246\177\247\016\341\350\101\124\147\230\214
+\207\325\311\323\154\313\323\124\222\006\011\064\101\367\201\157
+\077\236\311\174\165\125\260\347\301\263\167\350\303\304\000\065
+\225\100\160\020\112\005\336\045\273\237\131\245\144\274\107\140
+\277\140\343\166\213\023\125\335\341\164\172\271\317\044\246\152
+\177\336\144\042\104\130\150\202\152\020\371\075\345\076\033\271
+\275\374\042\364\140\004\211\273\125\155\050\125\372\336\216\215
+\033\041\024\327\067\213\064\173\115\366\262\262\020\317\063\261
+\175\034\142\231\110\313\053\154\166\226\125\277\031\015\035\037
+\273\145\252\033\216\231\265\306\050\220\345\202\055\170\120\040
+\232\375\171\057\044\177\360\211\051\151\364\175\315\163\276\263
+\355\116\301\321\355\122\136\217\367\270\327\215\207\255\262\331
+\033\121\022\377\126\263\341\257\064\175\134\244\170\210\020\236
+\235\003\306\245\252\242\044\121\367\111\024\305\261\356\131\103
+\225\337\253\150\050\060\077\002\003\001\000\001\243\202\001\206
+\060\202\001\202\060\022\006\003\125\035\023\001\001\377\004\010
+\060\006\001\001\377\002\001\001\060\123\006\003\125\035\040\004
+\114\060\112\060\110\006\011\053\006\001\004\001\261\076\001\000
+\060\073\060\071\006\010\053\006\001\005\005\007\002\001\026\055
+\150\164\164\160\072\057\057\167\167\167\056\160\165\142\154\151
+\143\055\164\162\165\163\164\056\143\157\155\057\103\120\123\057
+\117\155\156\151\122\157\157\164\056\150\164\155\154\060\016\006
+\003\125\035\017\001\001\377\004\004\003\002\001\006\060\201\240
+\006\003\125\035\043\004\201\230\060\201\225\200\024\246\014\035
+\237\141\377\007\027\265\277\070\106\333\103\060\325\216\260\122
+\006\241\171\244\167\060\165\061\013\060\011\006\003\125\004\006
+\023\002\125\123\061\030\060\026\006\003\125\004\012\023\017\107
+\124\105\040\103\157\162\160\157\162\141\164\151\157\156\061\047
+\060\045\006\003\125\004\013\023\036\107\124\105\040\103\171\142
+\145\162\124\162\165\163\164\040\123\157\154\165\164\151\157\156
+\163\054\040\111\156\143\056\061\043\060\041\006\003\125\004\003
+\023\032\107\124\105\040\103\171\142\145\162\124\162\165\163\164
+\040\107\154\157\142\141\154\040\122\157\157\164\202\002\001\245
+\060\105\006\003\125\035\037\004\076\060\074\060\072\240\070\240
+\066\206\064\150\164\164\160\072\057\057\167\167\167\056\160\165
+\142\154\151\143\055\164\162\165\163\164\056\143\157\155\057\143
+\147\151\055\142\151\156\057\103\122\114\057\062\060\061\070\057
+\143\144\160\056\143\162\154\060\035\006\003\125\035\016\004\026
+\004\024\253\371\150\337\317\112\067\327\173\105\214\137\162\336
+\100\104\303\145\273\302\060\015\006\011\052\206\110\206\367\015
+\001\001\005\005\000\003\201\201\000\217\150\153\245\133\007\272
+\104\146\016\034\250\134\060\173\063\344\012\046\004\374\357\236
+\032\070\326\056\241\037\320\231\107\302\165\144\044\375\236\073
+\050\166\271\046\050\141\221\014\155\054\370\004\237\174\120\001
+\325\343\151\257\357\025\322\105\233\044\011\052\146\005\117\045
+\201\312\135\276\252\301\131\047\256\063\216\202\367\337\164\260
+\125\263\216\370\347\067\310\156\252\126\104\366\275\123\201\043
+\226\075\264\372\062\212\123\146\104\045\242\045\306\246\074\045
+\214\360\340\050\006\042\267\046\101
+END
+
+# Trust for Certificate "Explicitly Distrust DigiNotar Cyber CA"
+# Issuer: E=info@diginotar.nl,CN=DigiNotar Cyber CA,O=DigiNotar,C=NL
+# Serial Number: 268435455 (0xfffffff)
+# Subject: E=info@diginotar.nl,CN=DigiNotar Cyber CA,O=DigiNotar,C=NL
+# Not Valid Before: Wed Oct 04 10:54:12 2006
+# Not Valid After : Tue Oct 04 10:53:12 2011
+# Fingerprint (MD5): BC:BD:89:12:B4:FF:E5:F9:26:47:C8:60:36:5B:D9:54
+# Fingerprint (SHA1): A5:8E:A0:EC:F6:44:56:35:19:1D:68:5B:C7:A0:E4:1C:B0:4D:79:2E
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Explicitly Distrust DigiNotar Cyber CA"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\245\216\240\354\366\104\126\065\031\035\150\133\307\240\344\034
+\260\115\171\056
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\274\275\211\022\264\377\345\371\046\107\310\140\066\133\331\124
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\140\061\013\060\011\006\003\125\004\006\023\002\116\114\061
+\022\060\020\006\003\125\004\012\023\011\104\151\147\151\116\157
+\164\141\162\061\033\060\031\006\003\125\004\003\023\022\104\151
+\147\151\116\157\164\141\162\040\103\171\142\145\162\040\103\101
+\061\040\060\036\006\011\052\206\110\206\367\015\001\011\001\026
+\021\151\156\146\157\100\144\151\147\151\156\157\164\141\162\056
+\156\154
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\004\017\377\377\377
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "Explicitly Distrust DigiNotar Cyber CA 2nd"
+#
+# Issuer: CN=DigiNotar Cyber CA,O=DigiNotar,C=NL
+# Serial Number: 268435455 (0xfffffff)
+# Subject: CN=DigiNotar Cyber CA,O=DigiNotar,C=NL
+# Not Valid Before: Wed Sep 27 10:53:53 2006
+# Not Valid After : Fri Sep 20 09:44:07 2013
+# Fingerprint (MD5): F0:AE:A9:3D:F2:2C:88:DC:7C:85:1B:96:7D:5A:1C:11
+# Fingerprint (SHA1): 88:1E:45:05:0F:98:D9:59:FB:0A:35:F9:4C:0E:28:97:55:16:29:B3
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Explicitly Distrust DigiNotar Cyber CA 2nd"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\076\061\013\060\011\006\003\125\004\006\023\002\116\114\061
+\022\060\020\006\003\125\004\012\023\011\104\151\147\151\116\157
+\164\141\162\061\033\060\031\006\003\125\004\003\023\022\104\151
+\147\151\116\157\164\141\162\040\103\171\142\145\162\040\103\101
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\076\061\013\060\011\006\003\125\004\006\023\002\116\114\061
+\022\060\020\006\003\125\004\012\023\011\104\151\147\151\116\157
+\164\141\162\061\033\060\031\006\003\125\004\003\023\022\104\151
+\147\151\116\157\164\141\162\040\103\171\142\145\162\040\103\101
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\004\017\377\377\377
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\005\001\060\202\004\152\240\003\002\001\002\002\004\017
+\377\377\377\060\015\006\011\052\206\110\206\367\015\001\001\005
+\005\000\060\076\061\013\060\011\006\003\125\004\006\023\002\116
+\114\061\022\060\020\006\003\125\004\012\023\011\104\151\147\151
+\116\157\164\141\162\061\033\060\031\006\003\125\004\003\023\022
+\104\151\147\151\116\157\164\141\162\040\103\171\142\145\162\040
+\103\101\060\036\027\015\060\066\060\071\062\067\061\060\065\063
+\065\063\132\027\015\061\063\060\071\062\060\060\071\064\064\060
+\067\132\060\076\061\013\060\011\006\003\125\004\006\023\002\116
+\114\061\022\060\020\006\003\125\004\012\023\011\104\151\147\151
+\116\157\164\141\162\061\033\060\031\006\003\125\004\003\023\022
+\104\151\147\151\116\157\164\141\162\040\103\171\142\145\162\040
+\103\101\060\202\002\042\060\015\006\011\052\206\110\206\367\015
+\001\001\001\005\000\003\202\002\017\000\060\202\002\012\002\202
+\002\001\000\322\316\025\012\055\250\136\204\147\255\375\276\357
+\106\307\310\271\317\163\374\364\064\271\371\054\103\347\140\023
+\075\172\343\262\317\073\147\154\220\255\300\271\077\204\122\360
+\065\102\334\164\334\050\073\275\122\264\247\254\162\105\027\306
+\360\211\353\264\252\045\362\135\113\136\321\331\207\272\326\175
+\174\365\316\062\237\020\063\305\261\112\273\136\221\061\302\320
+\351\101\302\221\144\176\011\101\073\333\213\010\067\152\252\312
+\122\336\265\071\036\300\210\003\245\077\213\231\023\141\103\265
+\233\202\263\356\040\157\317\241\104\242\352\057\153\100\237\217
+\053\127\255\241\123\302\205\042\151\235\240\077\121\337\013\101
+\221\015\245\341\250\252\134\111\010\135\275\336\160\101\261\017
+\311\143\153\323\177\064\164\002\057\064\132\170\165\034\150\172
+\201\147\212\363\332\100\360\140\143\364\222\040\327\003\246\075
+\243\036\147\304\204\033\101\245\311\214\346\275\352\110\266\005
+\026\010\263\067\022\132\367\141\074\367\070\157\056\227\340\157
+\126\070\124\323\050\265\255\024\156\056\113\144\265\047\145\267
+\165\045\011\266\007\075\225\126\002\012\202\140\262\163\105\340
+\063\046\121\164\232\271\324\120\034\366\115\133\133\122\122\023
+\132\246\177\247\016\341\350\101\124\147\230\214\207\325\311\323
+\154\313\323\124\222\006\011\064\101\367\201\157\077\236\311\174
+\165\125\260\347\301\263\167\350\303\304\000\065\225\100\160\020
+\112\005\336\045\273\237\131\245\144\274\107\140\277\140\343\166
+\213\023\125\335\341\164\172\271\317\044\246\152\177\336\144\042
+\104\130\150\202\152\020\371\075\345\076\033\271\275\374\042\364
+\140\004\211\273\125\155\050\125\372\336\216\215\033\041\024\327
+\067\213\064\173\115\366\262\262\020\317\063\261\175\034\142\231
+\110\313\053\154\166\226\125\277\031\015\035\037\273\145\252\033
+\216\231\265\306\050\220\345\202\055\170\120\040\232\375\171\057
+\044\177\360\211\051\151\364\175\315\163\276\263\355\116\301\321
+\355\122\136\217\367\270\327\215\207\255\262\331\033\121\022\377
+\126\263\341\257\064\175\134\244\170\210\020\236\235\003\306\245
+\252\242\044\121\367\111\024\305\261\356\131\103\225\337\253\150
+\050\060\077\002\003\001\000\001\243\202\001\206\060\202\001\202
+\060\022\006\003\125\035\023\001\001\377\004\010\060\006\001\001
+\377\002\001\001\060\123\006\003\125\035\040\004\114\060\112\060
+\110\006\011\053\006\001\004\001\261\076\001\000\060\073\060\071
+\006\010\053\006\001\005\005\007\002\001\026\055\150\164\164\160
+\072\057\057\167\167\167\056\160\165\142\154\151\143\055\164\162
+\165\163\164\056\143\157\155\057\103\120\123\057\117\155\156\151
+\122\157\157\164\056\150\164\155\154\060\016\006\003\125\035\017
+\001\001\377\004\004\003\002\001\006\060\201\240\006\003\125\035
+\043\004\201\230\060\201\225\200\024\246\014\035\237\141\377\007
+\027\265\277\070\106\333\103\060\325\216\260\122\006\241\171\244
+\167\060\165\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\030\060\026\006\003\125\004\012\023\017\107\124\105\040\103
+\157\162\160\157\162\141\164\151\157\156\061\047\060\045\006\003
+\125\004\013\023\036\107\124\105\040\103\171\142\145\162\124\162
+\165\163\164\040\123\157\154\165\164\151\157\156\163\054\040\111
+\156\143\056\061\043\060\041\006\003\125\004\003\023\032\107\124
+\105\040\103\171\142\145\162\124\162\165\163\164\040\107\154\157
+\142\141\154\040\122\157\157\164\202\002\001\245\060\105\006\003
+\125\035\037\004\076\060\074\060\072\240\070\240\066\206\064\150
+\164\164\160\072\057\057\167\167\167\056\160\165\142\154\151\143
+\055\164\162\165\163\164\056\143\157\155\057\143\147\151\055\142
+\151\156\057\103\122\114\057\062\060\061\070\057\143\144\160\056
+\143\162\154\060\035\006\003\125\035\016\004\026\004\024\253\371
+\150\337\317\112\067\327\173\105\214\137\162\336\100\104\303\145
+\273\302\060\015\006\011\052\206\110\206\367\015\001\001\005\005
+\000\003\201\201\000\011\312\142\017\215\273\112\340\324\172\065
+\053\006\055\321\050\141\266\254\001\373\203\111\274\256\324\057
+\055\206\256\031\203\245\326\035\023\342\027\276\376\062\164\351
+\172\024\070\312\224\136\367\051\001\151\161\033\221\032\375\243
+\273\252\035\312\173\342\026\375\241\243\016\363\014\137\262\341
+\040\061\224\053\136\222\166\355\372\351\265\043\246\277\012\073
+\003\251\157\122\140\124\315\137\351\267\057\174\242\047\375\101
+\203\165\266\015\373\170\046\363\261\105\351\062\225\052\032\065
+\041\225\305\242\165
+END
+
+# Trust for Certificate "Explicitly Distrust DigiNotar Cyber CA 2nd"
+# Issuer: CN=DigiNotar Cyber CA,O=DigiNotar,C=NL
+# Serial Number: 268435455 (0xfffffff)
+# Subject: CN=DigiNotar Cyber CA,O=DigiNotar,C=NL
+# Not Valid Before: Wed Sep 27 10:53:53 2006
+# Not Valid After : Fri Sep 20 09:44:07 2013
+# Fingerprint (MD5): F0:AE:A9:3D:F2:2C:88:DC:7C:85:1B:96:7D:5A:1C:11
+# Fingerprint (SHA1): 88:1E:45:05:0F:98:D9:59:FB:0A:35:F9:4C:0E:28:97:55:16:29:B3
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Explicitly Distrust DigiNotar Cyber CA 2nd"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\210\036\105\005\017\230\331\131\373\012\065\371\114\016\050\227
+\125\026\051\263
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\360\256\251\075\362\054\210\334\174\205\033\226\175\132\034\021
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\076\061\013\060\011\006\003\125\004\006\023\002\116\114\061
+\022\060\020\006\003\125\004\012\023\011\104\151\147\151\116\157
+\164\141\162\061\033\060\031\006\003\125\004\003\023\022\104\151
+\147\151\116\157\164\141\162\040\103\171\142\145\162\040\103\101
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\004\017\377\377\377
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "Explicitly Distrusted DigiNotar PKIoverheid"
+#
+# Issuer: CN=DigiNotar PKIoverheid CA Overheid en Bedrijven,O=DigiNotar B.V.,C=NL
+# Serial Number: 268435455 (0xfffffff)
+# Subject: CN=DigiNotar PKIoverheid CA Overheid en Bedrijven,O=DigiNotar B.V.,C=NL
+# Not Valid Before: Thu Jul 05 08:42:08 2007
+# Not Valid After : Mon Jul 27 08:39:47 2015
+# Fingerprint (MD5): A3:CF:B3:FF:F9:4F:A7:B1:EB:3A:75:58:4E:2E:9F:EA
+# Fingerprint (SHA1): A7:A8:C9:AC:F4:5F:90:92:76:86:B8:C0:A2:0E:93:58:7D:DE:30:E4
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Explicitly Distrusted DigiNotar PKIoverheid"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\137\061\013\060\011\006\003\125\004\006\023\002\116\114\061
+\027\060\025\006\003\125\004\012\023\016\104\151\147\151\116\157
+\164\141\162\040\102\056\126\056\061\067\060\065\006\003\125\004
+\003\023\056\104\151\147\151\116\157\164\141\162\040\120\113\111
+\157\166\145\162\150\145\151\144\040\103\101\040\117\166\145\162
+\150\145\151\144\040\145\156\040\102\145\144\162\151\152\166\145
+\156
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\137\061\013\060\011\006\003\125\004\006\023\002\116\114\061
+\027\060\025\006\003\125\004\012\023\016\104\151\147\151\116\157
+\164\141\162\040\102\056\126\056\061\067\060\065\006\003\125\004
+\003\023\056\104\151\147\151\116\157\164\141\162\040\120\113\111
+\157\166\145\162\150\145\151\144\040\103\101\040\117\166\145\162
+\150\145\151\144\040\145\156\040\102\145\144\162\151\152\166\145
+\156
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\004\017\377\377\377
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\004\216\060\202\003\166\240\003\002\001\002\002\004\017
+\377\377\377\060\015\006\011\052\206\110\206\367\015\001\001\005
+\005\000\060\137\061\013\060\011\006\003\125\004\006\023\002\116
+\114\061\027\060\025\006\003\125\004\012\023\016\104\151\147\151
+\116\157\164\141\162\040\102\056\126\056\061\067\060\065\006\003
+\125\004\003\023\056\104\151\147\151\116\157\164\141\162\040\120
+\113\111\157\166\145\162\150\145\151\144\040\103\101\040\117\166
+\145\162\150\145\151\144\040\145\156\040\102\145\144\162\151\152
+\166\145\156\060\036\027\015\060\067\060\067\060\065\060\070\064
+\062\060\070\132\027\015\061\065\060\067\062\067\060\070\063\071
+\064\067\132\060\137\061\013\060\011\006\003\125\004\006\023\002
+\116\114\061\027\060\025\006\003\125\004\012\023\016\104\151\147
+\151\116\157\164\141\162\040\102\056\126\056\061\067\060\065\006
+\003\125\004\003\023\056\104\151\147\151\116\157\164\141\162\040
+\120\113\111\157\166\145\162\150\145\151\144\040\103\101\040\117
+\166\145\162\150\145\151\144\040\145\156\040\102\145\144\162\151
+\152\166\145\156\060\202\001\042\060\015\006\011\052\206\110\206
+\367\015\001\001\001\005\000\003\202\001\017\000\060\202\001\012
+\002\202\001\001\000\334\275\322\247\116\152\012\273\073\242\205
+\341\177\000\255\276\264\060\150\230\007\315\240\172\304\224\317
+\161\371\212\067\344\123\353\127\166\314\213\346\154\376\356\207
+\125\310\076\273\004\071\000\247\200\170\254\133\117\176\364\275
+\270\124\270\161\073\007\061\111\071\223\124\174\040\073\171\053
+\217\273\141\220\175\261\254\346\037\220\056\235\105\001\251\144
+\055\115\303\057\271\347\120\325\116\052\134\253\166\166\067\106
+\327\171\354\102\231\367\242\354\244\211\160\334\070\053\207\246
+\252\044\346\235\222\044\033\276\366\375\324\057\031\027\172\346
+\062\007\224\124\005\123\103\351\154\274\257\107\313\274\313\375
+\275\073\104\022\201\361\153\113\273\355\264\317\253\045\117\030
+\322\314\002\374\243\117\265\102\063\313\131\315\011\334\323\120
+\375\240\166\214\254\176\146\212\102\366\255\034\222\363\266\373
+\024\106\353\115\327\057\060\340\155\356\133\066\276\104\164\267
+\040\005\127\205\115\350\000\031\242\366\014\346\256\241\300\102
+\337\247\254\202\135\307\150\267\030\346\211\113\232\153\372\316
+\171\371\363\054\247\002\003\001\000\001\243\202\001\120\060\202
+\001\114\060\110\006\003\125\035\040\004\101\060\077\060\075\006
+\004\125\035\040\000\060\065\060\063\006\010\053\006\001\005\005
+\007\002\001\026\047\150\164\164\160\072\057\057\167\167\167\056
+\144\151\147\151\156\157\164\141\162\056\156\154\057\143\160\163
+\057\160\153\151\157\166\145\162\150\145\151\144\060\017\006\003
+\125\035\023\001\001\377\004\005\060\003\001\001\377\060\016\006
+\003\125\035\017\001\001\377\004\004\003\002\001\006\060\201\200
+\006\003\125\035\043\004\171\060\167\200\024\013\206\326\017\167
+\243\150\261\373\144\011\303\210\156\134\004\034\127\351\075\241
+\131\244\127\060\125\061\013\060\011\006\003\125\004\006\023\002
+\116\114\061\036\060\034\006\003\125\004\012\023\025\123\164\141
+\141\164\040\144\145\162\040\116\145\144\145\162\154\141\156\144
+\145\156\061\046\060\044\006\003\125\004\003\023\035\123\164\141
+\141\164\040\144\145\162\040\116\145\144\145\162\154\141\156\144
+\145\156\040\122\157\157\164\040\103\101\202\004\000\230\232\171
+\060\075\006\003\125\035\037\004\066\060\064\060\062\240\060\240
+\056\206\054\150\164\164\160\072\057\057\143\162\154\056\160\153
+\151\157\166\145\162\150\145\151\144\056\156\154\057\104\157\155
+\117\166\114\141\164\145\163\164\103\122\114\056\143\162\154\060
+\035\006\003\125\035\016\004\026\004\024\114\010\311\215\166\361
+\230\307\076\337\074\327\057\165\015\261\166\171\227\314\060\015
+\006\011\052\206\110\206\367\015\001\001\005\005\000\003\202\001
+\001\000\014\224\207\032\277\115\343\205\342\356\327\330\143\171
+\016\120\337\306\204\133\322\273\331\365\061\012\032\065\227\164
+\337\024\372\052\017\076\355\240\343\010\366\325\116\133\257\246
+\256\045\342\105\153\042\017\267\124\050\176\222\336\215\024\154
+\321\034\345\156\164\004\234\267\357\064\104\105\337\311\203\035
+\031\037\300\051\151\337\211\325\077\302\260\123\155\345\116\027
+\344\163\141\043\023\046\161\103\375\114\131\313\303\337\042\252
+\041\053\331\277\225\021\032\212\244\342\253\247\135\113\157\051
+\365\122\321\344\322\025\261\213\376\360\003\317\247\175\351\231
+\207\070\263\015\163\024\344\162\054\341\316\365\255\006\110\144
+\372\323\051\271\242\330\273\364\325\013\245\100\104\103\216\240
+\277\316\132\245\122\114\144\323\027\061\141\314\350\244\212\350
+\344\210\373\351\345\057\006\063\063\233\224\146\146\261\253\120
+\072\241\011\201\164\123\132\047\271\246\322\045\317\323\303\247
+\377\226\320\057\352\340\036\215\122\351\030\034\040\012\107\240
+\226\126\016\100\220\121\104\254\032\375\361\356\205\037\367\102
+\132\145
+END
+
+# Trust for Certificate "Explicitly Distrusted DigiNotar PKIoverheid"
+# Issuer: CN=DigiNotar PKIoverheid CA Overheid en Bedrijven,O=DigiNotar B.V.,C=NL
+# Serial Number: 268435455 (0xfffffff)
+# Subject: CN=DigiNotar PKIoverheid CA Overheid en Bedrijven,O=DigiNotar B.V.,C=NL
+# Not Valid Before: Thu Jul 05 08:42:08 2007
+# Not Valid After : Mon Jul 27 08:39:47 2015
+# Fingerprint (MD5): A3:CF:B3:FF:F9:4F:A7:B1:EB:3A:75:58:4E:2E:9F:EA
+# Fingerprint (SHA1): A7:A8:C9:AC:F4:5F:90:92:76:86:B8:C0:A2:0E:93:58:7D:DE:30:E4
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Explicitly Distrusted DigiNotar PKIoverheid"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\247\250\311\254\364\137\220\222\166\206\270\300\242\016\223\130
+\175\336\060\344
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\243\317\263\377\371\117\247\261\353\072\165\130\116\056\237\352
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\137\061\013\060\011\006\003\125\004\006\023\002\116\114\061
+\027\060\025\006\003\125\004\012\023\016\104\151\147\151\116\157
+\164\141\162\040\102\056\126\056\061\067\060\065\006\003\125\004
+\003\023\056\104\151\147\151\116\157\164\141\162\040\120\113\111
+\157\166\145\162\150\145\151\144\040\103\101\040\117\166\145\162
+\150\145\151\144\040\145\156\040\102\145\144\162\151\152\166\145
+\156
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\004\017\377\377\377
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
# Certificate "Explicitly Distrusted DigiNotar PKIoverheid G2"
#
# Issuer: CN=DigiNotar PKIoverheid CA Organisatie - G2,O=DigiNotar B.V.,C=NL
@@ -12213,6 +15746,315 @@ CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
#
+# Certificate "Explicitly Distrusted Malaysian Digicert Sdn. Bhd. (cyb)"
+#
+# Issuer: CN=GTE CyberTrust Global Root,OU="GTE CyberTrust Solutions, Inc.",O=GTE Corporation,C=US
+# Serial Number:07:ff:ff:ff:ff:ff
+# Subject: CN=Digisign Server ID (Enrich),OU=457608-K,O=Digicert Sdn. Bhd.,C=MY
+# Not Valid Before: Tue Jul 17 15:17:49 2007
+# Not Valid After : Tue Jul 17 15:16:55 2012
+# Fingerprint (MD5): D2:DE:AE:50:A4:98:2D:6F:37:B7:86:52:C8:2D:4B:6A
+# Fingerprint (SHA1): 55:50:AF:EC:BF:E8:C3:AD:C4:0B:E3:AD:0C:A7:E4:15:8C:39:59:4F
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Explicitly Distrusted Malaysian Digicert Sdn. Bhd. (cyb)"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\143\061\013\060\011\006\003\125\004\006\023\002\115\131\061
+\033\060\031\006\003\125\004\012\023\022\104\151\147\151\143\145
+\162\164\040\123\144\156\056\040\102\150\144\056\061\021\060\017
+\006\003\125\004\013\023\010\064\065\067\066\060\070\055\113\061
+\044\060\042\006\003\125\004\003\023\033\104\151\147\151\163\151
+\147\156\040\123\145\162\166\145\162\040\111\104\040\050\105\156
+\162\151\143\150\051
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\165\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\030\060\026\006\003\125\004\012\023\017\107\124\105\040\103\157
+\162\160\157\162\141\164\151\157\156\061\047\060\045\006\003\125
+\004\013\023\036\107\124\105\040\103\171\142\145\162\124\162\165
+\163\164\040\123\157\154\165\164\151\157\156\163\054\040\111\156
+\143\056\061\043\060\041\006\003\125\004\003\023\032\107\124\105
+\040\103\171\142\145\162\124\162\165\163\164\040\107\154\157\142
+\141\154\040\122\157\157\164
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\006\007\377\377\377\377\377
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\003\315\060\202\003\066\240\003\002\001\002\002\006\007
+\377\377\377\377\377\060\015\006\011\052\206\110\206\367\015\001
+\001\005\005\000\060\165\061\013\060\011\006\003\125\004\006\023
+\002\125\123\061\030\060\026\006\003\125\004\012\023\017\107\124
+\105\040\103\157\162\160\157\162\141\164\151\157\156\061\047\060
+\045\006\003\125\004\013\023\036\107\124\105\040\103\171\142\145
+\162\124\162\165\163\164\040\123\157\154\165\164\151\157\156\163
+\054\040\111\156\143\056\061\043\060\041\006\003\125\004\003\023
+\032\107\124\105\040\103\171\142\145\162\124\162\165\163\164\040
+\107\154\157\142\141\154\040\122\157\157\164\060\036\027\015\060
+\067\060\067\061\067\061\065\061\067\064\071\132\027\015\061\062
+\060\067\061\067\061\065\061\066\065\065\132\060\143\061\013\060
+\011\006\003\125\004\006\023\002\115\131\061\033\060\031\006\003
+\125\004\012\023\022\104\151\147\151\143\145\162\164\040\123\144
+\156\056\040\102\150\144\056\061\021\060\017\006\003\125\004\013
+\023\010\064\065\067\066\060\070\055\113\061\044\060\042\006\003
+\125\004\003\023\033\104\151\147\151\163\151\147\156\040\123\145
+\162\166\145\162\040\111\104\040\050\105\156\162\151\143\150\051
+\060\201\237\060\015\006\011\052\206\110\206\367\015\001\001\001
+\005\000\003\201\215\000\060\201\211\002\201\201\000\255\250\144
+\113\115\207\307\204\131\271\373\220\106\240\246\211\300\361\376
+\325\332\124\202\067\015\231\053\105\046\012\350\126\260\177\312
+\250\364\216\107\204\001\202\051\343\263\152\265\221\363\373\225
+\205\274\162\250\144\350\012\100\234\305\364\161\256\173\173\152
+\007\352\220\024\117\215\211\257\224\253\262\006\324\002\152\173
+\230\037\131\271\072\315\124\372\040\337\262\052\012\351\270\335
+\151\220\300\051\323\116\320\227\355\146\314\305\031\111\006\177
+\372\136\054\174\173\205\033\062\102\337\173\225\045\002\003\001
+\000\001\243\202\001\170\060\202\001\164\060\022\006\003\125\035
+\023\001\001\377\004\010\060\006\001\001\377\002\001\000\060\134
+\006\003\125\035\040\004\125\060\123\060\110\006\011\053\006\001
+\004\001\261\076\001\000\060\073\060\071\006\010\053\006\001\005
+\005\007\002\001\026\055\150\164\164\160\072\057\057\143\171\142
+\145\162\164\162\165\163\164\056\157\155\156\151\162\157\157\164
+\056\143\157\155\057\162\145\160\157\163\151\164\157\162\171\056
+\143\146\155\060\007\006\005\140\203\112\001\001\060\016\006\003
+\125\035\017\001\001\377\004\004\003\002\001\346\060\201\211\006
+\003\125\035\043\004\201\201\060\177\241\171\244\167\060\165\061
+\013\060\011\006\003\125\004\006\023\002\125\123\061\030\060\026
+\006\003\125\004\012\023\017\107\124\105\040\103\157\162\160\157
+\162\141\164\151\157\156\061\047\060\045\006\003\125\004\013\023
+\036\107\124\105\040\103\171\142\145\162\124\162\165\163\164\040
+\123\157\154\165\164\151\157\156\163\054\040\111\156\143\056\061
+\043\060\041\006\003\125\004\003\023\032\107\124\105\040\103\171
+\142\145\162\124\162\165\163\164\040\107\154\157\142\141\154\040
+\122\157\157\164\202\002\001\245\060\105\006\003\125\035\037\004
+\076\060\074\060\072\240\070\240\066\206\064\150\164\164\160\072
+\057\057\167\167\167\056\160\165\142\154\151\143\055\164\162\165
+\163\164\056\143\157\155\057\143\147\151\055\142\151\156\057\103
+\122\114\057\062\060\061\070\057\143\144\160\056\143\162\154\060
+\035\006\003\125\035\016\004\026\004\024\306\026\223\116\026\027
+\354\026\256\214\224\166\363\206\155\305\164\156\204\167\060\015
+\006\011\052\206\110\206\367\015\001\001\005\005\000\003\201\201
+\000\166\000\173\246\170\053\146\035\216\136\066\306\244\216\005
+\362\043\222\174\223\147\323\364\300\012\175\213\055\331\352\325
+\157\032\363\341\112\051\132\042\204\115\120\057\113\014\362\377
+\205\302\173\125\324\104\202\276\155\254\147\216\274\264\037\222
+\234\121\200\032\024\366\156\253\141\210\013\255\034\177\367\113
+\120\121\326\145\033\246\107\161\025\136\260\161\363\065\024\362
+\067\275\143\310\325\360\223\132\064\137\330\075\350\135\367\305
+\036\300\345\317\037\206\044\251\074\007\146\315\301\322\066\143
+\131
+END
+
+# Trust for Certificate "Explicitly Distrusted Malaysian Digicert Sdn. Bhd. (cyb)"
+# Issuer: CN=GTE CyberTrust Global Root,OU="GTE CyberTrust Solutions, Inc.",O=GTE Corporation,C=US
+# Serial Number:07:ff:ff:ff:ff:ff
+# Subject: CN=Digisign Server ID (Enrich),OU=457608-K,O=Digicert Sdn. Bhd.,C=MY
+# Not Valid Before: Tue Jul 17 15:17:49 2007
+# Not Valid After : Tue Jul 17 15:16:55 2012
+# Fingerprint (MD5): D2:DE:AE:50:A4:98:2D:6F:37:B7:86:52:C8:2D:4B:6A
+# Fingerprint (SHA1): 55:50:AF:EC:BF:E8:C3:AD:C4:0B:E3:AD:0C:A7:E4:15:8C:39:59:4F
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Explicitly Distrusted Malaysian Digicert Sdn. Bhd. (cyb)"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\125\120\257\354\277\350\303\255\304\013\343\255\014\247\344\025
+\214\071\131\117
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\322\336\256\120\244\230\055\157\067\267\206\122\310\055\113\152
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\165\061\013\060\011\006\003\125\004\006\023\002\125\123\061
+\030\060\026\006\003\125\004\012\023\017\107\124\105\040\103\157
+\162\160\157\162\141\164\151\157\156\061\047\060\045\006\003\125
+\004\013\023\036\107\124\105\040\103\171\142\145\162\124\162\165
+\163\164\040\123\157\154\165\164\151\157\156\163\054\040\111\156
+\143\056\061\043\060\041\006\003\125\004\003\023\032\107\124\105
+\040\103\171\142\145\162\124\162\165\163\164\040\107\154\157\142
+\141\154\040\122\157\157\164
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\006\007\377\377\377\377\377
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "Explicitly Distrusted Malaysian Digicert Sdn. Bhd. (en)"
+#
+# Issuer: CN=Entrust.net Certification Authority (2048),OU=(c) 1999 Entrust.net Limited,OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.),O=Entrust.net
+# Serial Number:07:ff:ff:ff:ff:ff
+# Subject: CN=Digisign Server ID - (Enrich),OU=457608-K,O=Digicert Sdn. Bhd.,C=MY
+# Not Valid Before: Fri Jul 16 17:23:38 2010
+# Not Valid After : Thu Jul 16 17:53:38 2015
+# Fingerprint (MD5): D7:69:61:7F:35:0F:9C:46:A3:AA:EB:F8:55:FC:84:F2
+# Fingerprint (SHA1): 6B:3C:3B:80:AD:CA:A6:BA:8A:9F:54:A6:7A:ED:12:69:05:6D:31:26
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Explicitly Distrusted Malaysian Digicert Sdn. Bhd. (en)"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\145\061\013\060\011\006\003\125\004\006\023\002\115\131\061
+\033\060\031\006\003\125\004\012\023\022\104\151\147\151\143\145
+\162\164\040\123\144\156\056\040\102\150\144\056\061\021\060\017
+\006\003\125\004\013\023\010\064\065\067\066\060\070\055\113\061
+\046\060\044\006\003\125\004\003\023\035\104\151\147\151\163\151
+\147\156\040\123\145\162\166\145\162\040\111\104\040\055\040\050
+\105\156\162\151\143\150\051
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\264\061\024\060\022\006\003\125\004\012\023\013\105\156
+\164\162\165\163\164\056\156\145\164\061\100\060\076\006\003\125
+\004\013\024\067\167\167\167\056\145\156\164\162\165\163\164\056
+\156\145\164\057\103\120\123\137\062\060\064\070\040\151\156\143
+\157\162\160\056\040\142\171\040\162\145\146\056\040\050\154\151
+\155\151\164\163\040\154\151\141\142\056\051\061\045\060\043\006
+\003\125\004\013\023\034\050\143\051\040\061\071\071\071\040\105
+\156\164\162\165\163\164\056\156\145\164\040\114\151\155\151\164
+\145\144\061\063\060\061\006\003\125\004\003\023\052\105\156\164
+\162\165\163\164\056\156\145\164\040\103\145\162\164\151\146\151
+\143\141\164\151\157\156\040\101\165\164\150\157\162\151\164\171
+\040\050\062\060\064\070\051
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\006\007\377\377\377\377\377
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\004\320\060\202\003\270\240\003\002\001\002\002\006\007
+\377\377\377\377\377\060\015\006\011\052\206\110\206\367\015\001
+\001\005\005\000\060\201\264\061\024\060\022\006\003\125\004\012
+\023\013\105\156\164\162\165\163\164\056\156\145\164\061\100\060
+\076\006\003\125\004\013\024\067\167\167\167\056\145\156\164\162
+\165\163\164\056\156\145\164\057\103\120\123\137\062\060\064\070
+\040\151\156\143\157\162\160\056\040\142\171\040\162\145\146\056
+\040\050\154\151\155\151\164\163\040\154\151\141\142\056\051\061
+\045\060\043\006\003\125\004\013\023\034\050\143\051\040\061\071
+\071\071\040\105\156\164\162\165\163\164\056\156\145\164\040\114
+\151\155\151\164\145\144\061\063\060\061\006\003\125\004\003\023
+\052\105\156\164\162\165\163\164\056\156\145\164\040\103\145\162
+\164\151\146\151\143\141\164\151\157\156\040\101\165\164\150\157
+\162\151\164\171\040\050\062\060\064\070\051\060\036\027\015\061
+\060\060\067\061\066\061\067\062\063\063\070\132\027\015\061\065
+\060\067\061\066\061\067\065\063\063\070\132\060\145\061\013\060
+\011\006\003\125\004\006\023\002\115\131\061\033\060\031\006\003
+\125\004\012\023\022\104\151\147\151\143\145\162\164\040\123\144
+\156\056\040\102\150\144\056\061\021\060\017\006\003\125\004\013
+\023\010\064\065\067\066\060\070\055\113\061\046\060\044\006\003
+\125\004\003\023\035\104\151\147\151\163\151\147\156\040\123\145
+\162\166\145\162\040\111\104\040\055\040\050\105\156\162\151\143
+\150\051\060\202\001\042\060\015\006\011\052\206\110\206\367\015
+\001\001\001\005\000\003\202\001\017\000\060\202\001\012\002\202
+\001\001\000\305\211\344\364\015\006\100\222\131\307\032\263\065
+\321\016\114\052\063\371\370\257\312\236\177\356\271\247\155\140
+\364\124\350\157\325\233\363\033\143\061\004\150\162\321\064\026
+\214\264\027\054\227\336\163\305\330\220\025\240\032\053\365\313
+\263\110\206\104\360\035\210\114\316\101\102\032\357\365\014\336
+\376\100\332\071\040\367\006\125\072\152\235\106\301\322\157\245
+\262\310\127\076\051\243\234\340\351\205\167\146\350\230\247\044
+\176\276\300\131\040\345\104\157\266\127\330\276\316\302\145\167
+\130\306\141\101\321\164\004\310\177\111\102\305\162\251\162\026
+\356\214\335\022\135\264\112\324\321\257\120\267\330\252\165\166
+\150\255\076\135\252\060\155\141\250\253\020\133\076\023\277\063
+\340\257\104\235\070\042\133\357\114\057\246\161\046\025\046\312
+\050\214\331\372\216\216\251\242\024\065\342\233\044\210\264\364
+\177\205\235\203\117\007\241\266\024\220\066\304\064\034\215\046
+\141\155\023\157\170\276\350\217\047\307\113\204\226\243\206\150
+\014\043\276\013\354\214\224\000\251\004\212\023\220\367\337\205
+\154\014\261\002\003\001\000\001\243\202\001\064\060\202\001\060
+\060\016\006\003\125\035\017\001\001\377\004\004\003\002\001\006
+\060\022\006\003\125\035\023\001\001\377\004\010\060\006\001\001
+\377\002\001\000\060\047\006\003\125\035\045\004\040\060\036\006
+\010\053\006\001\005\005\007\003\001\006\010\053\006\001\005\005
+\007\003\002\006\010\053\006\001\005\005\007\003\004\060\063\006
+\010\053\006\001\005\005\007\001\001\004\047\060\045\060\043\006
+\010\053\006\001\005\005\007\060\001\206\027\150\164\164\160\072
+\057\057\157\143\163\160\056\145\156\164\162\165\163\164\056\156
+\145\164\060\104\006\003\125\035\040\004\075\060\073\060\071\006
+\005\140\203\112\001\001\060\060\060\056\006\010\053\006\001\005
+\005\007\002\001\026\042\150\164\164\160\072\057\057\167\167\167
+\056\144\151\147\151\143\145\162\164\056\143\157\155\056\155\171
+\057\143\160\163\056\150\164\155\060\062\006\003\125\035\037\004
+\053\060\051\060\047\240\045\240\043\206\041\150\164\164\160\072
+\057\057\143\162\154\056\145\156\164\162\165\163\164\056\156\145
+\164\057\062\060\064\070\143\141\056\143\162\154\060\021\006\003
+\125\035\016\004\012\004\010\114\116\314\045\050\003\051\201\060
+\037\006\003\125\035\043\004\030\060\026\200\024\125\344\201\321
+\021\200\276\330\211\271\010\243\061\371\241\044\011\026\271\160
+\060\015\006\011\052\206\110\206\367\015\001\001\005\005\000\003
+\202\001\001\000\227\114\357\112\072\111\254\162\374\060\040\153
+\264\051\133\247\305\225\004\220\371\062\325\302\205\152\336\003
+\241\067\371\211\000\260\132\254\125\176\333\103\065\377\311\001
+\370\121\276\314\046\312\310\152\244\304\124\076\046\036\347\014
+\243\315\227\147\224\335\246\102\353\134\315\217\071\171\153\063
+\171\041\006\171\372\202\104\025\231\314\301\267\071\323\106\142
+\174\262\160\353\157\316\040\252\076\031\267\351\164\202\234\264
+\245\113\115\141\000\067\344\207\322\362\024\072\144\174\270\251
+\173\141\340\223\042\347\325\237\076\107\346\066\166\240\123\330
+\000\003\072\017\265\063\376\226\312\323\322\202\072\056\335\327
+\110\341\344\247\151\314\034\351\231\112\347\312\160\105\327\013
+\007\016\232\165\033\320\057\222\157\366\244\007\303\275\034\113
+\246\204\266\175\250\232\251\322\247\051\361\013\127\151\036\227
+\127\046\354\053\103\254\324\105\203\005\000\351\343\360\106\100
+\007\372\352\261\121\163\223\034\245\335\123\021\067\310\052\247
+\025\047\035\264\252\314\177\252\061\060\374\270\105\237\110\011
+\355\020\342\305
+END
+
+# Trust for Certificate "Explicitly Distrusted Malaysian Digicert Sdn. Bhd. (en)"
+# Issuer: CN=Entrust.net Certification Authority (2048),OU=(c) 1999 Entrust.net Limited,OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.),O=Entrust.net
+# Serial Number:07:ff:ff:ff:ff:ff
+# Subject: CN=Digisign Server ID - (Enrich),OU=457608-K,O=Digicert Sdn. Bhd.,C=MY
+# Not Valid Before: Fri Jul 16 17:23:38 2010
+# Not Valid After : Thu Jul 16 17:53:38 2015
+# Fingerprint (MD5): D7:69:61:7F:35:0F:9C:46:A3:AA:EB:F8:55:FC:84:F2
+# Fingerprint (SHA1): 6B:3C:3B:80:AD:CA:A6:BA:8A:9F:54:A6:7A:ED:12:69:05:6D:31:26
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Explicitly Distrusted Malaysian Digicert Sdn. Bhd. (en)"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\153\074\073\200\255\312\246\272\212\237\124\246\172\355\022\151
+\005\155\061\046
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\327\151\141\177\065\017\234\106\243\252\353\370\125\374\204\362
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\264\061\024\060\022\006\003\125\004\012\023\013\105\156
+\164\162\165\163\164\056\156\145\164\061\100\060\076\006\003\125
+\004\013\024\067\167\167\167\056\145\156\164\162\165\163\164\056
+\156\145\164\057\103\120\123\137\062\060\064\070\040\151\156\143
+\157\162\160\056\040\142\171\040\162\145\146\056\040\050\154\151
+\155\151\164\163\040\154\151\141\142\056\051\061\045\060\043\006
+\003\125\004\013\023\034\050\143\051\040\061\071\071\071\040\105
+\156\164\162\165\163\164\056\156\145\164\040\114\151\155\151\164
+\145\144\061\063\060\061\006\003\125\004\003\023\052\105\156\164
+\162\165\163\164\056\156\145\164\040\103\145\162\164\151\146\151
+\143\141\164\151\157\156\040\101\165\164\150\157\162\151\164\171
+\040\050\062\060\064\070\051
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\006\007\377\377\377\377\377
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+
+#
# Certificate "Security Communication RootCA2"
#
# Issuer: OU=Security Communication RootCA2,O="SECOM Trust Systems CO.,LTD.",C=JP
@@ -13058,6 +16900,372 @@ CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
#
+# Certificate "StartCom Certification Authority"
+#
+# Issuer: CN=StartCom Certification Authority,OU=Secure Digital Certificate Signing,O=StartCom Ltd.,C=IL
+# Serial Number: 45 (0x2d)
+# Subject: CN=StartCom Certification Authority,OU=Secure Digital Certificate Signing,O=StartCom Ltd.,C=IL
+# Not Valid Before: Sun Sep 17 19:46:37 2006
+# Not Valid After : Wed Sep 17 19:46:36 2036
+# Fingerprint (MD5): C9:3B:0D:84:41:FC:A4:76:79:23:08:57:DE:10:19:16
+# Fingerprint (SHA1): A3:F1:33:3F:E2:42:BF:CF:C5:D1:4E:8F:39:42:98:40:68:10:D1:A0
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "StartCom Certification Authority"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\175\061\013\060\011\006\003\125\004\006\023\002\111\114\061
+\026\060\024\006\003\125\004\012\023\015\123\164\141\162\164\103
+\157\155\040\114\164\144\056\061\053\060\051\006\003\125\004\013
+\023\042\123\145\143\165\162\145\040\104\151\147\151\164\141\154
+\040\103\145\162\164\151\146\151\143\141\164\145\040\123\151\147
+\156\151\156\147\061\051\060\047\006\003\125\004\003\023\040\123
+\164\141\162\164\103\157\155\040\103\145\162\164\151\146\151\143
+\141\164\151\157\156\040\101\165\164\150\157\162\151\164\171
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\175\061\013\060\011\006\003\125\004\006\023\002\111\114\061
+\026\060\024\006\003\125\004\012\023\015\123\164\141\162\164\103
+\157\155\040\114\164\144\056\061\053\060\051\006\003\125\004\013
+\023\042\123\145\143\165\162\145\040\104\151\147\151\164\141\154
+\040\103\145\162\164\151\146\151\143\141\164\145\040\123\151\147
+\156\151\156\147\061\051\060\047\006\003\125\004\003\023\040\123
+\164\141\162\164\103\157\155\040\103\145\162\164\151\146\151\143
+\141\164\151\157\156\040\101\165\164\150\157\162\151\164\171
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\001\055
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\007\207\060\202\005\157\240\003\002\001\002\002\001\055
+\060\015\006\011\052\206\110\206\367\015\001\001\013\005\000\060
+\175\061\013\060\011\006\003\125\004\006\023\002\111\114\061\026
+\060\024\006\003\125\004\012\023\015\123\164\141\162\164\103\157
+\155\040\114\164\144\056\061\053\060\051\006\003\125\004\013\023
+\042\123\145\143\165\162\145\040\104\151\147\151\164\141\154\040
+\103\145\162\164\151\146\151\143\141\164\145\040\123\151\147\156
+\151\156\147\061\051\060\047\006\003\125\004\003\023\040\123\164
+\141\162\164\103\157\155\040\103\145\162\164\151\146\151\143\141
+\164\151\157\156\040\101\165\164\150\157\162\151\164\171\060\036
+\027\015\060\066\060\071\061\067\061\071\064\066\063\067\132\027
+\015\063\066\060\071\061\067\061\071\064\066\063\066\132\060\175
+\061\013\060\011\006\003\125\004\006\023\002\111\114\061\026\060
+\024\006\003\125\004\012\023\015\123\164\141\162\164\103\157\155
+\040\114\164\144\056\061\053\060\051\006\003\125\004\013\023\042
+\123\145\143\165\162\145\040\104\151\147\151\164\141\154\040\103
+\145\162\164\151\146\151\143\141\164\145\040\123\151\147\156\151
+\156\147\061\051\060\047\006\003\125\004\003\023\040\123\164\141
+\162\164\103\157\155\040\103\145\162\164\151\146\151\143\141\164
+\151\157\156\040\101\165\164\150\157\162\151\164\171\060\202\002
+\042\060\015\006\011\052\206\110\206\367\015\001\001\001\005\000
+\003\202\002\017\000\060\202\002\012\002\202\002\001\000\301\210
+\333\011\274\154\106\174\170\237\225\173\265\063\220\362\162\142
+\326\301\066\040\042\044\136\316\351\167\362\103\012\242\006\144
+\244\314\216\066\370\070\346\043\360\156\155\261\074\335\162\243
+\205\034\241\323\075\264\063\053\323\057\257\376\352\260\101\131
+\147\266\304\006\175\012\236\164\205\326\171\114\200\067\172\337
+\071\005\122\131\367\364\033\106\103\244\322\205\205\322\303\161
+\363\165\142\064\272\054\212\177\036\217\356\355\064\320\021\307
+\226\315\122\075\272\063\326\335\115\336\013\073\112\113\237\302
+\046\057\372\265\026\034\162\065\167\312\074\135\346\312\341\046
+\213\032\066\166\134\001\333\164\024\045\376\355\265\240\210\017
+\335\170\312\055\037\007\227\060\001\055\162\171\372\106\326\023
+\052\250\271\246\253\203\111\035\345\362\357\335\344\001\216\030
+\012\217\143\123\026\205\142\251\016\031\072\314\265\146\246\302
+\153\164\007\344\053\341\166\076\264\155\330\366\104\341\163\142
+\037\073\304\276\240\123\126\045\154\121\011\367\252\253\312\277
+\166\375\155\233\363\235\333\277\075\146\274\014\126\252\257\230
+\110\225\072\113\337\247\130\120\331\070\165\251\133\352\103\014
+\002\377\231\353\350\154\115\160\133\051\145\234\335\252\135\314
+\257\001\061\354\014\353\322\215\350\352\234\173\346\156\367\047
+\146\014\032\110\327\156\102\343\077\336\041\076\173\341\015\160
+\373\143\252\250\154\032\124\264\134\045\172\311\242\311\213\026
+\246\273\054\176\027\136\005\115\130\156\022\035\001\356\022\020
+\015\306\062\177\030\377\374\364\372\315\156\221\350\066\111\276
+\032\110\151\213\302\226\115\032\022\262\151\027\301\012\220\326
+\372\171\042\110\277\272\173\151\370\160\307\372\172\067\330\330
+\015\322\166\117\127\377\220\267\343\221\322\335\357\302\140\267
+\147\072\335\376\252\234\360\324\213\177\162\042\316\306\237\227
+\266\370\257\212\240\020\250\331\373\030\306\266\265\134\122\074
+\211\266\031\052\163\001\012\017\003\263\022\140\362\172\057\201
+\333\243\156\377\046\060\227\365\213\335\211\127\266\255\075\263
+\257\053\305\267\166\002\360\245\326\053\232\206\024\052\162\366
+\343\063\214\135\011\113\023\337\273\214\164\023\122\113\002\003
+\001\000\001\243\202\002\020\060\202\002\014\060\017\006\003\125
+\035\023\001\001\377\004\005\060\003\001\001\377\060\016\006\003
+\125\035\017\001\001\377\004\004\003\002\001\006\060\035\006\003
+\125\035\016\004\026\004\024\116\013\357\032\244\100\133\245\027
+\151\207\060\312\064\150\103\320\101\256\362\060\037\006\003\125
+\035\043\004\030\060\026\200\024\116\013\357\032\244\100\133\245
+\027\151\207\060\312\064\150\103\320\101\256\362\060\202\001\132
+\006\003\125\035\040\004\202\001\121\060\202\001\115\060\202\001
+\111\006\013\053\006\001\004\001\201\265\067\001\001\001\060\202
+\001\070\060\056\006\010\053\006\001\005\005\007\002\001\026\042
+\150\164\164\160\072\057\057\167\167\167\056\163\164\141\162\164
+\163\163\154\056\143\157\155\057\160\157\154\151\143\171\056\160
+\144\146\060\064\006\010\053\006\001\005\005\007\002\001\026\050
+\150\164\164\160\072\057\057\167\167\167\056\163\164\141\162\164
+\163\163\154\056\143\157\155\057\151\156\164\145\162\155\145\144
+\151\141\164\145\056\160\144\146\060\201\317\006\010\053\006\001
+\005\005\007\002\002\060\201\302\060\047\026\040\123\164\141\162
+\164\040\103\157\155\155\145\162\143\151\141\154\040\050\123\164
+\141\162\164\103\157\155\051\040\114\164\144\056\060\003\002\001
+\001\032\201\226\114\151\155\151\164\145\144\040\114\151\141\142
+\151\154\151\164\171\054\040\162\145\141\144\040\164\150\145\040
+\163\145\143\164\151\157\156\040\052\114\145\147\141\154\040\114
+\151\155\151\164\141\164\151\157\156\163\052\040\157\146\040\164
+\150\145\040\123\164\141\162\164\103\157\155\040\103\145\162\164
+\151\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162
+\151\164\171\040\120\157\154\151\143\171\040\141\166\141\151\154
+\141\142\154\145\040\141\164\040\150\164\164\160\072\057\057\167
+\167\167\056\163\164\141\162\164\163\163\154\056\143\157\155\057
+\160\157\154\151\143\171\056\160\144\146\060\021\006\011\140\206
+\110\001\206\370\102\001\001\004\004\003\002\000\007\060\070\006
+\011\140\206\110\001\206\370\102\001\015\004\053\026\051\123\164
+\141\162\164\103\157\155\040\106\162\145\145\040\123\123\114\040
+\103\145\162\164\151\146\151\143\141\164\151\157\156\040\101\165
+\164\150\157\162\151\164\171\060\015\006\011\052\206\110\206\367
+\015\001\001\013\005\000\003\202\002\001\000\216\217\347\334\224
+\171\174\361\205\177\237\111\157\153\312\135\373\214\376\004\305
+\301\142\321\175\102\212\274\123\267\224\003\146\060\077\261\347
+\012\247\120\040\125\045\177\166\172\024\015\353\004\016\100\346
+\076\330\210\253\007\047\203\251\165\246\067\163\307\375\113\322
+\115\255\027\100\310\106\276\073\177\121\374\303\266\005\061\334
+\315\205\042\116\161\267\362\161\136\260\032\306\272\223\213\170
+\222\112\205\370\170\017\203\376\057\255\054\367\344\244\273\055
+\320\347\015\072\270\076\316\366\170\366\256\107\044\312\243\065
+\066\316\307\306\207\230\332\354\373\351\262\316\047\233\210\303
+\004\241\366\013\131\150\257\311\333\020\017\115\366\144\143\134
+\245\022\157\222\262\223\224\307\210\027\016\223\266\176\142\213
+\220\177\253\116\237\374\343\165\024\117\052\062\337\133\015\340
+\365\173\223\015\253\241\317\207\341\245\004\105\350\074\022\245
+\011\305\260\321\267\123\363\140\024\272\205\151\152\041\174\037
+\165\141\027\040\027\173\154\073\101\051\134\341\254\132\321\315
+\214\233\353\140\035\031\354\367\345\260\332\371\171\030\245\105
+\077\111\103\127\322\335\044\325\054\243\375\221\215\047\265\345
+\353\024\006\232\114\173\041\273\072\255\060\006\030\300\330\301
+\153\054\177\131\134\135\221\261\160\042\127\353\212\153\110\112
+\325\017\051\354\306\100\300\057\210\114\150\001\027\167\364\044
+\031\117\275\372\341\262\040\041\113\335\032\330\051\175\252\270
+\336\124\354\041\125\200\154\036\365\060\310\243\020\345\262\346
+\052\024\061\303\205\055\214\230\261\206\132\117\211\131\055\271
+\307\367\034\310\212\177\300\235\005\112\346\102\117\142\243\155
+\051\244\037\205\253\333\345\201\310\255\052\075\114\135\133\204
+\046\161\304\205\136\161\044\312\245\033\154\330\141\323\032\340
+\124\333\316\272\251\062\265\042\366\163\101\011\135\270\027\135
+\016\017\231\220\326\107\332\157\012\072\142\050\024\147\202\331
+\361\320\200\131\233\313\061\330\233\017\214\167\116\265\150\212
+\362\154\366\044\016\055\154\160\305\163\321\336\024\320\161\217
+\266\323\173\002\366\343\270\324\011\156\153\236\165\204\071\346
+\177\045\245\362\110\000\300\244\001\332\077
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "StartCom Certification Authority"
+# Issuer: CN=StartCom Certification Authority,OU=Secure Digital Certificate Signing,O=StartCom Ltd.,C=IL
+# Serial Number: 45 (0x2d)
+# Subject: CN=StartCom Certification Authority,OU=Secure Digital Certificate Signing,O=StartCom Ltd.,C=IL
+# Not Valid Before: Sun Sep 17 19:46:37 2006
+# Not Valid After : Wed Sep 17 19:46:36 2036
+# Fingerprint (MD5): C9:3B:0D:84:41:FC:A4:76:79:23:08:57:DE:10:19:16
+# Fingerprint (SHA1): A3:F1:33:3F:E2:42:BF:CF:C5:D1:4E:8F:39:42:98:40:68:10:D1:A0
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "StartCom Certification Authority"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\243\361\063\077\342\102\277\317\305\321\116\217\071\102\230\100
+\150\020\321\240
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\311\073\015\204\101\374\244\166\171\043\010\127\336\020\031\026
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\175\061\013\060\011\006\003\125\004\006\023\002\111\114\061
+\026\060\024\006\003\125\004\012\023\015\123\164\141\162\164\103
+\157\155\040\114\164\144\056\061\053\060\051\006\003\125\004\013
+\023\042\123\145\143\165\162\145\040\104\151\147\151\164\141\154
+\040\103\145\162\164\151\146\151\143\141\164\145\040\123\151\147
+\156\151\156\147\061\051\060\047\006\003\125\004\003\023\040\123
+\164\141\162\164\103\157\155\040\103\145\162\164\151\146\151\143
+\141\164\151\157\156\040\101\165\164\150\157\162\151\164\171
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\001\055
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "StartCom Certification Authority G2"
+#
+# Issuer: CN=StartCom Certification Authority G2,O=StartCom Ltd.,C=IL
+# Serial Number: 59 (0x3b)
+# Subject: CN=StartCom Certification Authority G2,O=StartCom Ltd.,C=IL
+# Not Valid Before: Fri Jan 01 01:00:01 2010
+# Not Valid After : Sat Dec 31 23:59:01 2039
+# Fingerprint (MD5): 78:4B:FB:9E:64:82:0A:D3:B8:4C:62:F3:64:F2:90:64
+# Fingerprint (SHA1): 31:F1:FD:68:22:63:20:EE:C6:3B:3F:9D:EA:4A:3E:53:7C:7C:39:17
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "StartCom Certification Authority G2"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\123\061\013\060\011\006\003\125\004\006\023\002\111\114\061
+\026\060\024\006\003\125\004\012\023\015\123\164\141\162\164\103
+\157\155\040\114\164\144\056\061\054\060\052\006\003\125\004\003
+\023\043\123\164\141\162\164\103\157\155\040\103\145\162\164\151
+\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151
+\164\171\040\107\062
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\123\061\013\060\011\006\003\125\004\006\023\002\111\114\061
+\026\060\024\006\003\125\004\012\023\015\123\164\141\162\164\103
+\157\155\040\114\164\144\056\061\054\060\052\006\003\125\004\003
+\023\043\123\164\141\162\164\103\157\155\040\103\145\162\164\151
+\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151
+\164\171\040\107\062
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\001\073
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\005\143\060\202\003\113\240\003\002\001\002\002\001\073
+\060\015\006\011\052\206\110\206\367\015\001\001\013\005\000\060
+\123\061\013\060\011\006\003\125\004\006\023\002\111\114\061\026
+\060\024\006\003\125\004\012\023\015\123\164\141\162\164\103\157
+\155\040\114\164\144\056\061\054\060\052\006\003\125\004\003\023
+\043\123\164\141\162\164\103\157\155\040\103\145\162\164\151\146
+\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151\164
+\171\040\107\062\060\036\027\015\061\060\060\061\060\061\060\061
+\060\060\060\061\132\027\015\063\071\061\062\063\061\062\063\065
+\071\060\061\132\060\123\061\013\060\011\006\003\125\004\006\023
+\002\111\114\061\026\060\024\006\003\125\004\012\023\015\123\164
+\141\162\164\103\157\155\040\114\164\144\056\061\054\060\052\006
+\003\125\004\003\023\043\123\164\141\162\164\103\157\155\040\103
+\145\162\164\151\146\151\143\141\164\151\157\156\040\101\165\164
+\150\157\162\151\164\171\040\107\062\060\202\002\042\060\015\006
+\011\052\206\110\206\367\015\001\001\001\005\000\003\202\002\017
+\000\060\202\002\012\002\202\002\001\000\266\211\066\133\007\267
+\040\066\275\202\273\341\026\040\003\225\172\257\016\243\125\311
+\045\231\112\305\320\126\101\207\220\115\041\140\244\024\207\073
+\315\375\262\076\264\147\003\152\355\341\017\113\300\221\205\160
+\105\340\102\236\336\051\043\324\001\015\240\020\171\270\333\003
+\275\363\251\057\321\306\340\017\313\236\212\024\012\270\275\366
+\126\142\361\305\162\266\062\045\331\262\363\275\145\305\015\054
+\156\325\222\157\030\213\000\101\024\202\157\100\040\046\172\050
+\017\365\036\177\047\367\224\261\067\075\267\307\221\367\342\001
+\354\375\224\211\341\314\156\323\066\326\012\031\171\256\327\064
+\202\145\377\174\102\273\266\335\013\246\064\257\113\140\376\177
+\103\111\006\213\214\103\270\126\362\331\177\041\103\027\352\247
+\110\225\001\165\165\352\053\245\103\225\352\025\204\235\010\215
+\046\156\125\233\253\334\322\071\322\061\035\140\342\254\314\126
+\105\044\365\034\124\253\356\206\335\226\062\205\370\114\117\350
+\225\166\266\005\335\066\043\147\274\377\025\342\312\073\346\246
+\354\073\354\046\021\064\110\215\366\200\053\032\043\002\353\212
+\034\072\166\052\173\126\026\034\162\052\263\252\343\140\245\000
+\237\004\233\342\157\036\024\130\133\245\154\213\130\074\303\272
+\116\072\134\367\341\226\053\076\357\007\274\244\345\135\314\115
+\237\015\341\334\252\273\341\156\032\354\217\341\266\114\115\171
+\162\135\027\065\013\035\327\301\107\332\226\044\340\320\162\250
+\132\137\146\055\020\334\057\052\023\256\046\376\012\034\031\314
+\320\076\013\234\310\011\056\371\133\226\172\107\234\351\172\363
+\005\120\164\225\163\236\060\011\363\227\202\136\346\217\071\010
+\036\131\345\065\024\102\023\377\000\234\367\276\252\120\317\342
+\121\110\327\270\157\257\370\116\176\063\230\222\024\142\072\165
+\143\317\173\372\336\202\073\251\273\071\342\304\275\054\000\016
+\310\027\254\023\357\115\045\216\330\263\220\057\251\332\051\175
+\035\257\164\072\262\047\300\301\036\076\165\243\026\251\257\172
+\042\135\237\023\032\317\247\240\353\343\206\012\323\375\346\226
+\225\327\043\310\067\335\304\174\252\066\254\230\032\022\261\340
+\116\350\261\073\365\326\157\361\060\327\002\003\001\000\001\243
+\102\060\100\060\017\006\003\125\035\023\001\001\377\004\005\060
+\003\001\001\377\060\016\006\003\125\035\017\001\001\377\004\004
+\003\002\001\006\060\035\006\003\125\035\016\004\026\004\024\113
+\305\264\100\153\255\034\263\245\034\145\156\106\066\211\207\005
+\014\016\266\060\015\006\011\052\206\110\206\367\015\001\001\013
+\005\000\003\202\002\001\000\163\127\077\054\325\225\062\176\067
+\333\226\222\353\031\136\176\123\347\101\354\021\266\107\357\265
+\336\355\164\134\305\361\216\111\340\374\156\231\023\315\237\212
+\332\315\072\012\330\072\132\011\077\137\064\320\057\003\322\146
+\035\032\275\234\220\067\310\014\216\007\132\224\105\106\052\346
+\276\172\332\241\251\244\151\022\222\260\175\066\324\104\207\327
+\121\361\051\143\326\165\315\026\344\047\211\035\370\302\062\110
+\375\333\231\320\217\137\124\164\314\254\147\064\021\142\331\014
+\012\067\207\321\243\027\110\216\322\027\035\366\327\375\333\145
+\353\375\250\324\365\326\117\244\133\165\350\305\322\140\262\333
+\011\176\045\213\173\272\122\222\236\076\350\305\167\241\074\340
+\112\163\153\141\317\206\334\103\377\377\041\376\043\135\044\112
+\365\323\155\017\142\004\005\127\202\332\156\244\063\045\171\113
+\056\124\031\213\314\054\075\060\351\321\006\377\350\062\106\276
+\265\063\166\167\250\001\135\226\301\301\325\276\256\045\300\311
+\036\012\011\040\210\241\016\311\363\157\115\202\124\000\040\247
+\322\217\344\071\124\027\056\215\036\270\033\273\033\275\232\116
+\073\020\064\334\234\210\123\357\242\061\133\130\117\221\142\310
+\302\232\232\315\025\135\070\251\326\276\370\023\265\237\022\151
+\362\120\142\254\373\027\067\364\356\270\165\147\140\020\373\203
+\120\371\104\265\165\234\100\027\262\376\375\171\135\156\130\130
+\137\060\374\000\256\257\063\301\016\116\154\272\247\246\241\177
+\062\333\070\340\261\162\027\012\053\221\354\152\143\046\355\211
+\324\170\314\164\036\005\370\153\376\214\152\166\071\051\256\145
+\043\022\225\010\042\034\227\316\133\006\356\014\342\273\274\037
+\104\223\366\330\070\105\005\041\355\344\255\253\022\266\003\244
+\102\056\055\304\011\072\003\147\151\204\232\341\131\220\212\050
+\205\325\135\164\261\321\016\040\130\233\023\245\260\143\246\355
+\173\107\375\105\125\060\244\356\232\324\346\342\207\357\230\311
+\062\202\021\051\042\274\000\012\061\136\055\017\300\216\351\153
+\262\217\056\006\330\321\221\307\306\022\364\114\375\060\027\303
+\301\332\070\133\343\251\352\346\241\272\171\357\163\330\266\123
+\127\055\366\320\341\327\110
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "StartCom Certification Authority G2"
+# Issuer: CN=StartCom Certification Authority G2,O=StartCom Ltd.,C=IL
+# Serial Number: 59 (0x3b)
+# Subject: CN=StartCom Certification Authority G2,O=StartCom Ltd.,C=IL
+# Not Valid Before: Fri Jan 01 01:00:01 2010
+# Not Valid After : Sat Dec 31 23:59:01 2039
+# Fingerprint (MD5): 78:4B:FB:9E:64:82:0A:D3:B8:4C:62:F3:64:F2:90:64
+# Fingerprint (SHA1): 31:F1:FD:68:22:63:20:EE:C6:3B:3F:9D:EA:4A:3E:53:7C:7C:39:17
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "StartCom Certification Authority G2"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\061\361\375\150\042\143\040\356\306\073\077\235\352\112\076\123
+\174\174\071\027
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\170\113\373\236\144\202\012\323\270\114\142\363\144\362\220\144
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\123\061\013\060\011\006\003\125\004\006\023\002\111\114\061
+\026\060\024\006\003\125\004\012\023\015\123\164\141\162\164\103
+\157\155\040\114\164\144\056\061\054\060\052\006\003\125\004\003
+\023\043\123\164\141\162\164\103\157\155\040\103\145\162\164\151
+\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151
+\164\171\040\107\062
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\001\073
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
# Certificate "Buypass Class 2 Root CA"
#
# Issuer: CN=Buypass Class 2 Root CA,O=Buypass AS-983163327,C=NO
@@ -13739,6 +17947,172 @@ CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
#
+# Certificate "TURKTRUST Certificate Services Provider Root 2007"
+#
+# Issuer: O=T..RKTRUST Bilgi ..leti..im ve Bili..im G..venli..i Hizmetleri A...,L=Ankara,C=TR,CN=T..RKTRUST Elektronik Sertifika Hizmet Sa..lay..c..s..
+# Serial Number: 1 (0x1)
+# Subject: O=T..RKTRUST Bilgi ..leti..im ve Bili..im G..venli..i Hizmetleri A...,L=Ankara,C=TR,CN=T..RKTRUST Elektronik Sertifika Hizmet Sa..lay..c..s..
+# Not Valid Before: Tue Dec 25 18:37:19 2007
+# Not Valid After : Fri Dec 22 18:37:19 2017
+# Fingerprint (MD5): 2B:70:20:56:86:82:A0:18:C8:07:53:12:28:70:21:72
+# Fingerprint (SHA1): F1:7F:6F:B6:31:DC:99:E3:A3:C8:7F:FE:1C:F1:81:10:88:D9:60:33
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "TURKTRUST Certificate Services Provider Root 2007"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\201\277\061\077\060\075\006\003\125\004\003\014\066\124\303
+\234\122\113\124\122\125\123\124\040\105\154\145\153\164\162\157
+\156\151\153\040\123\145\162\164\151\146\151\153\141\040\110\151
+\172\155\145\164\040\123\141\304\237\154\141\171\304\261\143\304
+\261\163\304\261\061\013\060\011\006\003\125\004\006\023\002\124
+\122\061\017\060\015\006\003\125\004\007\014\006\101\156\153\141
+\162\141\061\136\060\134\006\003\125\004\012\014\125\124\303\234
+\122\113\124\122\125\123\124\040\102\151\154\147\151\040\304\260
+\154\145\164\151\305\237\151\155\040\166\145\040\102\151\154\151
+\305\237\151\155\040\107\303\274\166\145\156\154\151\304\237\151
+\040\110\151\172\155\145\164\154\145\162\151\040\101\056\305\236
+\056\040\050\143\051\040\101\162\141\154\304\261\153\040\062\060
+\060\067
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\277\061\077\060\075\006\003\125\004\003\014\066\124\303
+\234\122\113\124\122\125\123\124\040\105\154\145\153\164\162\157
+\156\151\153\040\123\145\162\164\151\146\151\153\141\040\110\151
+\172\155\145\164\040\123\141\304\237\154\141\171\304\261\143\304
+\261\163\304\261\061\013\060\011\006\003\125\004\006\023\002\124
+\122\061\017\060\015\006\003\125\004\007\014\006\101\156\153\141
+\162\141\061\136\060\134\006\003\125\004\012\014\125\124\303\234
+\122\113\124\122\125\123\124\040\102\151\154\147\151\040\304\260
+\154\145\164\151\305\237\151\155\040\166\145\040\102\151\154\151
+\305\237\151\155\040\107\303\274\166\145\156\154\151\304\237\151
+\040\110\151\172\155\145\164\154\145\162\151\040\101\056\305\236
+\056\040\050\143\051\040\101\162\141\154\304\261\153\040\062\060
+\060\067
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\001\001
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\004\075\060\202\003\045\240\003\002\001\002\002\001\001
+\060\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060
+\201\277\061\077\060\075\006\003\125\004\003\014\066\124\303\234
+\122\113\124\122\125\123\124\040\105\154\145\153\164\162\157\156
+\151\153\040\123\145\162\164\151\146\151\153\141\040\110\151\172
+\155\145\164\040\123\141\304\237\154\141\171\304\261\143\304\261
+\163\304\261\061\013\060\011\006\003\125\004\006\023\002\124\122
+\061\017\060\015\006\003\125\004\007\014\006\101\156\153\141\162
+\141\061\136\060\134\006\003\125\004\012\014\125\124\303\234\122
+\113\124\122\125\123\124\040\102\151\154\147\151\040\304\260\154
+\145\164\151\305\237\151\155\040\166\145\040\102\151\154\151\305
+\237\151\155\040\107\303\274\166\145\156\154\151\304\237\151\040
+\110\151\172\155\145\164\154\145\162\151\040\101\056\305\236\056
+\040\050\143\051\040\101\162\141\154\304\261\153\040\062\060\060
+\067\060\036\027\015\060\067\061\062\062\065\061\070\063\067\061
+\071\132\027\015\061\067\061\062\062\062\061\070\063\067\061\071
+\132\060\201\277\061\077\060\075\006\003\125\004\003\014\066\124
+\303\234\122\113\124\122\125\123\124\040\105\154\145\153\164\162
+\157\156\151\153\040\123\145\162\164\151\146\151\153\141\040\110
+\151\172\155\145\164\040\123\141\304\237\154\141\171\304\261\143
+\304\261\163\304\261\061\013\060\011\006\003\125\004\006\023\002
+\124\122\061\017\060\015\006\003\125\004\007\014\006\101\156\153
+\141\162\141\061\136\060\134\006\003\125\004\012\014\125\124\303
+\234\122\113\124\122\125\123\124\040\102\151\154\147\151\040\304
+\260\154\145\164\151\305\237\151\155\040\166\145\040\102\151\154
+\151\305\237\151\155\040\107\303\274\166\145\156\154\151\304\237
+\151\040\110\151\172\155\145\164\154\145\162\151\040\101\056\305
+\236\056\040\050\143\051\040\101\162\141\154\304\261\153\040\062
+\060\060\067\060\202\001\042\060\015\006\011\052\206\110\206\367
+\015\001\001\001\005\000\003\202\001\017\000\060\202\001\012\002
+\202\001\001\000\253\267\076\012\214\310\245\130\025\346\212\357
+\047\075\112\264\350\045\323\315\063\302\040\334\031\356\210\077
+\115\142\360\335\023\167\217\141\251\052\265\324\362\271\061\130
+\051\073\057\077\152\234\157\163\166\045\356\064\040\200\356\352
+\267\360\304\012\315\053\206\224\311\343\140\261\104\122\262\132
+\051\264\221\227\203\330\267\246\024\057\051\111\242\363\005\006
+\373\264\117\332\241\154\232\146\237\360\103\011\312\352\162\217
+\353\000\327\065\071\327\126\027\107\027\060\364\276\277\077\302
+\150\257\066\100\301\251\364\251\247\350\020\153\010\212\367\206
+\036\334\232\052\025\006\366\243\360\364\340\307\024\324\121\177
+\317\264\333\155\257\107\226\027\233\167\161\330\247\161\235\044
+\014\366\224\077\205\061\022\117\272\356\116\202\270\271\076\217
+\043\067\136\314\242\252\165\367\030\157\011\323\256\247\124\050
+\064\373\341\340\073\140\175\240\276\171\211\206\310\237\055\371
+\012\113\304\120\242\347\375\171\026\307\172\013\030\317\316\114
+\357\175\326\007\157\230\361\257\261\301\172\327\201\065\270\252
+\027\264\340\313\002\003\001\000\001\243\102\060\100\060\035\006
+\003\125\035\016\004\026\004\024\051\305\220\253\045\257\021\344
+\141\277\243\377\210\141\221\346\016\376\234\201\060\016\006\003
+\125\035\017\001\001\377\004\004\003\002\001\006\060\017\006\003
+\125\035\023\001\001\377\004\005\060\003\001\001\377\060\015\006
+\011\052\206\110\206\367\015\001\001\005\005\000\003\202\001\001
+\000\020\015\332\370\072\354\050\321\024\225\202\261\022\054\121
+\172\101\045\066\114\237\354\077\037\204\235\145\124\134\250\026
+\002\100\372\156\032\067\204\357\162\235\206\012\125\235\126\050
+\254\146\054\320\072\126\223\064\007\045\255\010\260\217\310\017
+\011\131\312\235\230\034\345\124\370\271\105\177\152\227\157\210
+\150\115\112\006\046\067\210\002\016\266\306\326\162\231\316\153
+\167\332\142\061\244\126\037\256\137\215\167\332\135\366\210\374
+\032\331\236\265\201\360\062\270\343\210\320\234\363\152\240\271
+\233\024\131\065\066\117\317\363\216\136\135\027\255\025\225\330
+\335\262\325\025\156\000\116\263\113\317\146\224\344\340\315\265
+\005\332\143\127\213\345\263\252\333\300\056\034\220\104\333\032
+\135\030\244\356\276\004\133\231\325\161\137\125\145\144\142\325
+\242\233\004\131\206\310\142\167\347\174\202\105\152\075\027\277
+\354\235\165\014\256\243\157\132\323\057\230\066\364\360\365\031
+\253\021\135\310\246\343\052\130\152\102\011\303\275\222\046\146
+\062\015\135\010\125\164\377\214\230\320\012\246\204\152\321\071
+\175
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "TURKTRUST Certificate Services Provider Root 2007"
+# Issuer: O=T..RKTRUST Bilgi ..leti..im ve Bili..im G..venli..i Hizmetleri A...,L=Ankara,C=TR,CN=T..RKTRUST Elektronik Sertifika Hizmet Sa..lay..c..s..
+# Serial Number: 1 (0x1)
+# Subject: O=T..RKTRUST Bilgi ..leti..im ve Bili..im G..venli..i Hizmetleri A...,L=Ankara,C=TR,CN=T..RKTRUST Elektronik Sertifika Hizmet Sa..lay..c..s..
+# Not Valid Before: Tue Dec 25 18:37:19 2007
+# Not Valid After : Fri Dec 22 18:37:19 2017
+# Fingerprint (MD5): 2B:70:20:56:86:82:A0:18:C8:07:53:12:28:70:21:72
+# Fingerprint (SHA1): F1:7F:6F:B6:31:DC:99:E3:A3:C8:7F:FE:1C:F1:81:10:88:D9:60:33
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "TURKTRUST Certificate Services Provider Root 2007"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\361\177\157\266\061\334\231\343\243\310\177\376\034\361\201\020
+\210\331\140\063
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\053\160\040\126\206\202\240\030\310\007\123\022\050\160\041\162
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\277\061\077\060\075\006\003\125\004\003\014\066\124\303
+\234\122\113\124\122\125\123\124\040\105\154\145\153\164\162\157
+\156\151\153\040\123\145\162\164\151\146\151\153\141\040\110\151
+\172\155\145\164\040\123\141\304\237\154\141\171\304\261\143\304
+\261\163\304\261\061\013\060\011\006\003\125\004\006\023\002\124
+\122\061\017\060\015\006\003\125\004\007\014\006\101\156\153\141
+\162\141\061\136\060\134\006\003\125\004\012\014\125\124\303\234
+\122\113\124\122\125\123\124\040\102\151\154\147\151\040\304\260
+\154\145\164\151\305\237\151\155\040\166\145\040\102\151\154\151
+\305\237\151\155\040\107\303\274\166\145\156\154\151\304\237\151
+\040\110\151\172\155\145\164\154\145\162\151\040\101\056\305\236
+\056\040\050\143\051\040\101\162\141\154\304\261\153\040\062\060
+\060\067
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\001\001
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
# Certificate "D-TRUST Root Class 3 CA 2 2009"
#
# Issuer: CN=D-TRUST Root Class 3 CA 2 2009,O=D-Trust GmbH,C=DE
@@ -14025,6 +18399,269 @@ CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
#
+# Certificate "PSCProcert"
+#
+# Issuer: E=acraiz@suscerte.gob.ve,OU=Superintendencia de Servicios de Certificacion Electronica,O=Sistema Nacional de Certificacion Electronica,ST=Distrito Capital,L=Caracas,C=VE,CN=Autoridad de Certificacion Raiz del Estado Venezolano
+# Serial Number: 11 (0xb)
+# Subject: CN=PSCProcert,C=VE,O=Sistema Nacional de Certificacion Electronica,OU=Proveedor de Certificados PROCERT,ST=Miranda,L=Chacao,E=contacto@procert.net.ve
+# Not Valid Before: Tue Dec 28 16:51:00 2010
+# Not Valid After : Fri Dec 25 23:59:59 2020
+# Fingerprint (MD5): E6:24:E9:12:01:AE:0C:DE:8E:85:C4:CE:A3:12:DD:EC
+# Fingerprint (SHA1): 70:C1:8D:74:B4:28:81:0A:E4:FD:A5:75:D7:01:9F:99:B0:3D:50:74
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "PSCProcert"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\201\321\061\046\060\044\006\011\052\206\110\206\367\015\001
+\011\001\026\027\143\157\156\164\141\143\164\157\100\160\162\157
+\143\145\162\164\056\156\145\164\056\166\145\061\017\060\015\006
+\003\125\004\007\023\006\103\150\141\143\141\157\061\020\060\016
+\006\003\125\004\010\023\007\115\151\162\141\156\144\141\061\052
+\060\050\006\003\125\004\013\023\041\120\162\157\166\145\145\144
+\157\162\040\144\145\040\103\145\162\164\151\146\151\143\141\144
+\157\163\040\120\122\117\103\105\122\124\061\066\060\064\006\003
+\125\004\012\023\055\123\151\163\164\145\155\141\040\116\141\143
+\151\157\156\141\154\040\144\145\040\103\145\162\164\151\146\151
+\143\141\143\151\157\156\040\105\154\145\143\164\162\157\156\151
+\143\141\061\013\060\011\006\003\125\004\006\023\002\126\105\061
+\023\060\021\006\003\125\004\003\023\012\120\123\103\120\162\157
+\143\145\162\164
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\202\001\036\061\076\060\074\006\003\125\004\003\023\065\101
+\165\164\157\162\151\144\141\144\040\144\145\040\103\145\162\164
+\151\146\151\143\141\143\151\157\156\040\122\141\151\172\040\144
+\145\154\040\105\163\164\141\144\157\040\126\145\156\145\172\157
+\154\141\156\157\061\013\060\011\006\003\125\004\006\023\002\126
+\105\061\020\060\016\006\003\125\004\007\023\007\103\141\162\141
+\143\141\163\061\031\060\027\006\003\125\004\010\023\020\104\151
+\163\164\162\151\164\157\040\103\141\160\151\164\141\154\061\066
+\060\064\006\003\125\004\012\023\055\123\151\163\164\145\155\141
+\040\116\141\143\151\157\156\141\154\040\144\145\040\103\145\162
+\164\151\146\151\143\141\143\151\157\156\040\105\154\145\143\164
+\162\157\156\151\143\141\061\103\060\101\006\003\125\004\013\023
+\072\123\165\160\145\162\151\156\164\145\156\144\145\156\143\151
+\141\040\144\145\040\123\145\162\166\151\143\151\157\163\040\144
+\145\040\103\145\162\164\151\146\151\143\141\143\151\157\156\040
+\105\154\145\143\164\162\157\156\151\143\141\061\045\060\043\006
+\011\052\206\110\206\367\015\001\011\001\026\026\141\143\162\141
+\151\172\100\163\165\163\143\145\162\164\145\056\147\157\142\056
+\166\145
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\001\013
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\011\206\060\202\007\156\240\003\002\001\002\002\001\013
+\060\015\006\011\052\206\110\206\367\015\001\001\013\005\000\060
+\202\001\036\061\076\060\074\006\003\125\004\003\023\065\101\165
+\164\157\162\151\144\141\144\040\144\145\040\103\145\162\164\151
+\146\151\143\141\143\151\157\156\040\122\141\151\172\040\144\145
+\154\040\105\163\164\141\144\157\040\126\145\156\145\172\157\154
+\141\156\157\061\013\060\011\006\003\125\004\006\023\002\126\105
+\061\020\060\016\006\003\125\004\007\023\007\103\141\162\141\143
+\141\163\061\031\060\027\006\003\125\004\010\023\020\104\151\163
+\164\162\151\164\157\040\103\141\160\151\164\141\154\061\066\060
+\064\006\003\125\004\012\023\055\123\151\163\164\145\155\141\040
+\116\141\143\151\157\156\141\154\040\144\145\040\103\145\162\164
+\151\146\151\143\141\143\151\157\156\040\105\154\145\143\164\162
+\157\156\151\143\141\061\103\060\101\006\003\125\004\013\023\072
+\123\165\160\145\162\151\156\164\145\156\144\145\156\143\151\141
+\040\144\145\040\123\145\162\166\151\143\151\157\163\040\144\145
+\040\103\145\162\164\151\146\151\143\141\143\151\157\156\040\105
+\154\145\143\164\162\157\156\151\143\141\061\045\060\043\006\011
+\052\206\110\206\367\015\001\011\001\026\026\141\143\162\141\151
+\172\100\163\165\163\143\145\162\164\145\056\147\157\142\056\166
+\145\060\036\027\015\061\060\061\062\062\070\061\066\065\061\060
+\060\132\027\015\062\060\061\062\062\065\062\063\065\071\065\071
+\132\060\201\321\061\046\060\044\006\011\052\206\110\206\367\015
+\001\011\001\026\027\143\157\156\164\141\143\164\157\100\160\162
+\157\143\145\162\164\056\156\145\164\056\166\145\061\017\060\015
+\006\003\125\004\007\023\006\103\150\141\143\141\157\061\020\060
+\016\006\003\125\004\010\023\007\115\151\162\141\156\144\141\061
+\052\060\050\006\003\125\004\013\023\041\120\162\157\166\145\145
+\144\157\162\040\144\145\040\103\145\162\164\151\146\151\143\141
+\144\157\163\040\120\122\117\103\105\122\124\061\066\060\064\006
+\003\125\004\012\023\055\123\151\163\164\145\155\141\040\116\141
+\143\151\157\156\141\154\040\144\145\040\103\145\162\164\151\146
+\151\143\141\143\151\157\156\040\105\154\145\143\164\162\157\156
+\151\143\141\061\013\060\011\006\003\125\004\006\023\002\126\105
+\061\023\060\021\006\003\125\004\003\023\012\120\123\103\120\162
+\157\143\145\162\164\060\202\002\042\060\015\006\011\052\206\110
+\206\367\015\001\001\001\005\000\003\202\002\017\000\060\202\002
+\012\002\202\002\001\000\325\267\364\243\224\063\241\106\251\125
+\141\111\015\250\207\163\136\221\055\160\301\006\032\224\332\075
+\354\025\102\301\365\214\256\152\027\361\212\255\374\200\225\352
+\203\104\242\133\172\125\316\117\247\245\325\272\270\037\240\047
+\300\120\123\076\215\271\300\016\270\025\334\326\154\370\236\370
+\004\045\337\200\217\020\205\335\175\057\173\200\335\127\000\144
+\043\370\156\311\276\225\117\341\165\354\340\176\136\225\315\261
+\357\276\172\102\330\311\054\323\353\032\032\042\213\267\177\006
+\211\345\074\365\022\300\273\323\013\231\137\220\174\216\055\057
+\167\063\222\112\041\106\250\251\010\254\361\366\021\002\331\225
+\026\236\215\057\226\346\002\335\165\302\024\052\132\326\311\175
+\045\302\301\374\252\147\205\342\354\276\321\174\074\372\257\325
+\156\377\123\101\324\365\062\070\261\342\137\304\371\216\020\357
+\006\251\002\211\377\343\014\156\227\340\337\235\333\041\320\364
+\076\010\151\154\330\324\344\066\370\203\266\262\066\217\234\357
+\072\067\026\175\277\242\151\327\073\133\162\320\257\252\077\134
+\146\223\254\012\042\141\266\322\240\231\310\124\223\135\250\266
+\321\275\135\012\136\167\224\242\055\300\202\216\274\312\003\052
+\064\256\163\361\324\265\014\275\276\147\233\124\353\341\372\240
+\132\354\070\176\076\301\314\242\307\104\061\165\352\077\345\007
+\322\253\241\045\226\366\346\344\240\135\067\030\071\141\000\063
+\135\106\324\000\304\264\312\074\361\242\243\076\363\072\377\151
+\060\056\100\335\366\237\234\046\311\226\067\255\347\071\242\277
+\352\151\333\125\042\225\123\052\224\265\337\255\026\070\201\165
+\146\343\307\054\033\223\234\252\214\243\312\331\154\074\027\155
+\234\334\174\123\340\040\047\103\066\371\022\341\074\134\275\146
+\277\242\151\043\070\270\231\140\231\016\126\123\072\234\176\024
+\214\260\006\157\361\206\166\220\257\375\257\376\220\306\217\237
+\177\213\222\043\234\347\025\166\217\325\213\224\023\162\151\373
+\053\141\143\210\357\346\244\136\346\243\027\152\130\107\313\161
+\117\024\013\136\310\002\010\046\242\313\351\257\153\212\031\307
+\313\024\126\365\341\332\265\331\374\277\163\070\332\371\347\257
+\156\244\067\342\007\047\002\003\001\000\001\243\202\003\027\060
+\202\003\023\060\022\006\003\125\035\023\001\001\377\004\010\060
+\006\001\001\377\002\001\001\060\067\006\003\125\035\022\004\060
+\060\056\202\017\163\165\163\143\145\162\164\145\056\147\157\142
+\056\166\145\240\033\006\005\140\206\136\002\002\240\022\014\020
+\122\111\106\055\107\055\062\060\060\060\064\060\063\066\055\060
+\060\035\006\003\125\035\016\004\026\004\024\101\017\031\070\252
+\231\177\102\013\244\327\047\230\124\242\027\114\055\121\124\060
+\202\001\120\006\003\125\035\043\004\202\001\107\060\202\001\103
+\200\024\255\273\042\035\306\340\322\001\250\375\166\120\122\223
+\355\230\301\115\256\323\241\202\001\046\244\202\001\042\060\202
+\001\036\061\076\060\074\006\003\125\004\003\023\065\101\165\164
+\157\162\151\144\141\144\040\144\145\040\103\145\162\164\151\146
+\151\143\141\143\151\157\156\040\122\141\151\172\040\144\145\154
+\040\105\163\164\141\144\157\040\126\145\156\145\172\157\154\141
+\156\157\061\013\060\011\006\003\125\004\006\023\002\126\105\061
+\020\060\016\006\003\125\004\007\023\007\103\141\162\141\143\141
+\163\061\031\060\027\006\003\125\004\010\023\020\104\151\163\164
+\162\151\164\157\040\103\141\160\151\164\141\154\061\066\060\064
+\006\003\125\004\012\023\055\123\151\163\164\145\155\141\040\116
+\141\143\151\157\156\141\154\040\144\145\040\103\145\162\164\151
+\146\151\143\141\143\151\157\156\040\105\154\145\143\164\162\157
+\156\151\143\141\061\103\060\101\006\003\125\004\013\023\072\123
+\165\160\145\162\151\156\164\145\156\144\145\156\143\151\141\040
+\144\145\040\123\145\162\166\151\143\151\157\163\040\144\145\040
+\103\145\162\164\151\146\151\143\141\143\151\157\156\040\105\154
+\145\143\164\162\157\156\151\143\141\061\045\060\043\006\011\052
+\206\110\206\367\015\001\011\001\026\026\141\143\162\141\151\172
+\100\163\165\163\143\145\162\164\145\056\147\157\142\056\166\145
+\202\001\012\060\016\006\003\125\035\017\001\001\377\004\004\003
+\002\001\006\060\115\006\003\125\035\021\004\106\060\104\202\016
+\160\162\157\143\145\162\164\056\156\145\164\056\166\145\240\025
+\006\005\140\206\136\002\001\240\014\014\012\120\123\103\055\060
+\060\060\060\060\062\240\033\006\005\140\206\136\002\002\240\022
+\014\020\122\111\106\055\112\055\063\061\066\063\065\063\067\063
+\055\067\060\166\006\003\125\035\037\004\157\060\155\060\106\240
+\104\240\102\206\100\150\164\164\160\072\057\057\167\167\167\056
+\163\165\163\143\145\162\164\145\056\147\157\142\056\166\145\057
+\154\143\162\057\103\105\122\124\111\106\111\103\101\104\117\055
+\122\101\111\132\055\123\110\101\063\070\064\103\122\114\104\105
+\122\056\143\162\154\060\043\240\041\240\037\206\035\154\144\141
+\160\072\057\057\141\143\162\141\151\172\056\163\165\163\143\145
+\162\164\145\056\147\157\142\056\166\145\060\067\006\010\053\006
+\001\005\005\007\001\001\004\053\060\051\060\047\006\010\053\006
+\001\005\005\007\060\001\206\033\150\164\164\160\072\057\057\157
+\143\163\160\056\163\165\163\143\145\162\164\145\056\147\157\142
+\056\166\145\060\101\006\003\125\035\040\004\072\060\070\060\066
+\006\006\140\206\136\003\001\002\060\054\060\052\006\010\053\006
+\001\005\005\007\002\001\026\036\150\164\164\160\072\057\057\167
+\167\167\056\163\165\163\143\145\162\164\145\056\147\157\142\056
+\166\145\057\144\160\143\060\015\006\011\052\206\110\206\367\015
+\001\001\013\005\000\003\202\002\001\000\053\131\353\042\231\273
+\204\252\117\336\220\306\321\206\161\043\236\113\003\221\107\160
+\273\300\222\140\354\340\324\347\155\306\323\355\147\203\167\122
+\325\362\345\167\247\066\262\343\124\276\331\273\012\233\021\357
+\141\364\306\231\063\231\365\257\000\071\215\203\277\246\275\065
+\176\054\134\061\064\157\154\333\363\144\001\230\252\224\054\101
+\335\025\206\312\153\051\116\026\300\111\374\327\203\110\023\007
+\121\204\061\122\210\273\206\027\307\153\057\212\040\255\305\013
+\217\160\076\052\273\033\161\217\271\244\240\375\330\225\331\257
+\131\277\045\053\230\351\143\223\057\140\036\304\252\370\167\365
+\213\154\057\355\176\056\265\117\100\015\356\274\127\167\347\331
+\266\324\077\225\047\072\040\325\345\256\253\154\065\237\301\241
+\035\131\334\204\201\356\115\007\342\110\266\236\113\225\055\101
+\261\341\350\336\176\057\005\036\150\356\277\273\220\145\072\310
+\356\352\261\030\067\034\142\223\244\240\061\354\161\154\221\346
+\244\171\211\132\024\247\024\120\005\114\244\000\127\060\054\301
+\265\141\226\334\076\036\204\257\071\102\317\345\320\054\261\044
+\274\337\100\303\355\177\143\112\275\341\117\022\144\206\225\363
+\260\347\310\267\341\123\275\222\346\363\014\226\271\353\350\346
+\222\355\247\201\011\024\013\374\225\172\317\217\326\064\117\066
+\022\334\136\321\064\165\306\106\200\057\225\004\214\307\206\304
+\250\046\211\250\077\031\233\201\273\121\244\112\206\253\013\021
+\017\261\256\143\123\155\050\352\335\063\126\070\034\262\255\200
+\323\327\162\275\232\154\231\143\350\000\273\101\166\005\267\133
+\231\030\212\303\270\022\134\126\317\126\014\175\350\342\317\355
+\274\164\107\373\356\323\027\116\042\117\126\377\120\363\056\346
+\071\246\202\326\161\312\336\267\325\272\150\010\355\231\314\375
+\242\222\313\151\270\235\371\012\244\246\076\117\223\050\052\141
+\154\007\046\000\377\226\137\150\206\270\270\316\312\125\340\253
+\261\075\177\230\327\063\016\132\075\330\170\302\304\140\057\307
+\142\360\141\221\322\070\260\366\236\125\333\100\200\005\022\063
+\316\035\222\233\321\151\263\377\277\361\222\012\141\065\077\335
+\376\206\364\274\340\032\161\263\142\246
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "PSCProcert"
+# Issuer: E=acraiz@suscerte.gob.ve,OU=Superintendencia de Servicios de Certificacion Electronica,O=Sistema Nacional de Certificacion Electronica,ST=Distrito Capital,L=Caracas,C=VE,CN=Autoridad de Certificacion Raiz del Estado Venezolano
+# Serial Number: 11 (0xb)
+# Subject: CN=PSCProcert,C=VE,O=Sistema Nacional de Certificacion Electronica,OU=Proveedor de Certificados PROCERT,ST=Miranda,L=Chacao,E=contacto@procert.net.ve
+# Not Valid Before: Tue Dec 28 16:51:00 2010
+# Not Valid After : Fri Dec 25 23:59:59 2020
+# Fingerprint (MD5): E6:24:E9:12:01:AE:0C:DE:8E:85:C4:CE:A3:12:DD:EC
+# Fingerprint (SHA1): 70:C1:8D:74:B4:28:81:0A:E4:FD:A5:75:D7:01:9F:99:B0:3D:50:74
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "PSCProcert"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\160\301\215\164\264\050\201\012\344\375\245\165\327\001\237\231
+\260\075\120\164
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\346\044\351\022\001\256\014\336\216\205\304\316\243\022\335\354
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\202\001\036\061\076\060\074\006\003\125\004\003\023\065\101
+\165\164\157\162\151\144\141\144\040\144\145\040\103\145\162\164
+\151\146\151\143\141\143\151\157\156\040\122\141\151\172\040\144
+\145\154\040\105\163\164\141\144\157\040\126\145\156\145\172\157
+\154\141\156\157\061\013\060\011\006\003\125\004\006\023\002\126
+\105\061\020\060\016\006\003\125\004\007\023\007\103\141\162\141
+\143\141\163\061\031\060\027\006\003\125\004\010\023\020\104\151
+\163\164\162\151\164\157\040\103\141\160\151\164\141\154\061\066
+\060\064\006\003\125\004\012\023\055\123\151\163\164\145\155\141
+\040\116\141\143\151\157\156\141\154\040\144\145\040\103\145\162
+\164\151\146\151\143\141\143\151\157\156\040\105\154\145\143\164
+\162\157\156\151\143\141\061\103\060\101\006\003\125\004\013\023
+\072\123\165\160\145\162\151\156\164\145\156\144\145\156\143\151
+\141\040\144\145\040\123\145\162\166\151\143\151\157\163\040\144
+\145\040\103\145\162\164\151\146\151\143\141\143\151\157\156\040
+\105\154\145\143\164\162\157\156\151\143\141\061\045\060\043\006
+\011\052\206\110\206\367\015\001\011\001\026\026\141\143\162\141
+\151\172\100\163\165\163\143\145\162\164\145\056\147\157\142\056
+\166\145
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\001\013
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
# Certificate "Swisscom Root CA 2"
#
# Issuer: CN=Swisscom Root CA 2,OU=Digital Certificate Services,O=Swisscom,C=ch
@@ -14200,6 +18837,169 @@ CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
#
+# Certificate "CA Disig Root R1"
+#
+# Issuer: CN=CA Disig Root R1,O=Disig a.s.,L=Bratislava,C=SK
+# Serial Number:00:c3:03:9a:ee:50:90:6e:28
+# Subject: CN=CA Disig Root R1,O=Disig a.s.,L=Bratislava,C=SK
+# Not Valid Before: Thu Jul 19 09:06:56 2012
+# Not Valid After : Sat Jul 19 09:06:56 2042
+# Fingerprint (MD5): BE:EC:11:93:9A:F5:69:21:BC:D7:C1:C0:67:89:CC:2A
+# Fingerprint (SHA1): 8E:1C:74:F8:A6:20:B9:E5:8A:F4:61:FA:EC:2B:47:56:51:1A:52:C6
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "CA Disig Root R1"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\122\061\013\060\011\006\003\125\004\006\023\002\123\113\061
+\023\060\021\006\003\125\004\007\023\012\102\162\141\164\151\163
+\154\141\166\141\061\023\060\021\006\003\125\004\012\023\012\104
+\151\163\151\147\040\141\056\163\056\061\031\060\027\006\003\125
+\004\003\023\020\103\101\040\104\151\163\151\147\040\122\157\157
+\164\040\122\061
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\122\061\013\060\011\006\003\125\004\006\023\002\123\113\061
+\023\060\021\006\003\125\004\007\023\012\102\162\141\164\151\163
+\154\141\166\141\061\023\060\021\006\003\125\004\012\023\012\104
+\151\163\151\147\040\141\056\163\056\061\031\060\027\006\003\125
+\004\003\023\020\103\101\040\104\151\163\151\147\040\122\157\157
+\164\040\122\061
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\011\000\303\003\232\356\120\220\156\050
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\005\151\060\202\003\121\240\003\002\001\002\002\011\000
+\303\003\232\356\120\220\156\050\060\015\006\011\052\206\110\206
+\367\015\001\001\005\005\000\060\122\061\013\060\011\006\003\125
+\004\006\023\002\123\113\061\023\060\021\006\003\125\004\007\023
+\012\102\162\141\164\151\163\154\141\166\141\061\023\060\021\006
+\003\125\004\012\023\012\104\151\163\151\147\040\141\056\163\056
+\061\031\060\027\006\003\125\004\003\023\020\103\101\040\104\151
+\163\151\147\040\122\157\157\164\040\122\061\060\036\027\015\061
+\062\060\067\061\071\060\071\060\066\065\066\132\027\015\064\062
+\060\067\061\071\060\071\060\066\065\066\132\060\122\061\013\060
+\011\006\003\125\004\006\023\002\123\113\061\023\060\021\006\003
+\125\004\007\023\012\102\162\141\164\151\163\154\141\166\141\061
+\023\060\021\006\003\125\004\012\023\012\104\151\163\151\147\040
+\141\056\163\056\061\031\060\027\006\003\125\004\003\023\020\103
+\101\040\104\151\163\151\147\040\122\157\157\164\040\122\061\060
+\202\002\042\060\015\006\011\052\206\110\206\367\015\001\001\001
+\005\000\003\202\002\017\000\060\202\002\012\002\202\002\001\000
+\252\303\170\367\334\230\243\247\132\136\167\030\262\335\004\144
+\017\143\375\233\226\011\200\325\350\252\245\342\234\046\224\072
+\350\231\163\214\235\337\327\337\203\363\170\117\100\341\177\322
+\247\322\345\312\023\223\347\355\306\167\137\066\265\224\257\350
+\070\216\333\233\345\174\273\314\215\353\165\163\341\044\315\346
+\247\055\031\056\330\326\212\153\024\353\010\142\012\330\334\263
+\000\115\303\043\174\137\103\010\043\062\022\334\355\014\255\300
+\175\017\245\172\102\331\132\160\331\277\247\327\001\034\366\233
+\253\216\267\112\206\170\240\036\126\061\256\357\202\012\200\101
+\367\033\311\256\253\062\046\324\054\153\355\175\153\344\342\136
+\042\012\105\313\204\061\115\254\376\333\321\107\272\371\140\227
+\071\261\145\307\336\373\231\344\012\042\261\055\115\345\110\046
+\151\253\342\252\363\373\374\222\051\062\351\263\076\115\037\047
+\241\315\216\271\027\373\045\076\311\156\363\167\332\015\022\366
+\135\307\273\066\020\325\124\326\363\340\342\107\110\346\336\024
+\332\141\122\257\046\264\365\161\117\311\327\322\006\337\143\312
+\377\041\350\131\006\340\010\325\204\025\123\367\103\345\174\305
+\240\211\230\153\163\306\150\316\145\336\275\177\005\367\261\356
+\366\127\241\140\225\305\314\352\223\072\276\231\256\233\002\243
+\255\311\026\265\316\335\136\231\170\176\032\071\176\262\300\005
+\244\300\202\245\243\107\236\214\352\134\266\274\147\333\346\052
+\115\322\004\334\243\256\105\367\274\213\234\034\247\326\325\003
+\334\010\313\056\026\312\134\100\063\350\147\303\056\347\246\104
+\352\021\105\034\065\145\055\036\105\141\044\033\202\056\245\235
+\063\135\145\370\101\371\056\313\224\077\037\243\014\061\044\104
+\355\307\136\255\120\272\306\101\233\254\360\027\145\300\370\135
+\157\133\240\012\064\074\356\327\352\210\237\230\371\257\116\044
+\372\227\262\144\166\332\253\364\355\343\303\140\357\325\371\002
+\310\055\237\203\257\147\151\006\247\061\125\325\317\113\157\377
+\004\005\307\130\254\137\026\033\345\322\243\353\061\333\037\063
+\025\115\320\362\245\123\365\313\341\075\116\150\055\330\022\335
+\252\362\346\115\233\111\345\305\050\241\272\260\132\306\240\265
+\002\003\001\000\001\243\102\060\100\060\017\006\003\125\035\023
+\001\001\377\004\005\060\003\001\001\377\060\016\006\003\125\035
+\017\001\001\377\004\004\003\002\001\006\060\035\006\003\125\035
+\016\004\026\004\024\211\012\264\070\223\032\346\253\356\233\221
+\030\371\365\074\076\065\320\323\202\060\015\006\011\052\206\110
+\206\367\015\001\001\005\005\000\003\202\002\001\000\062\213\366
+\235\112\311\276\024\345\214\254\070\312\072\011\324\033\316\206
+\263\335\353\324\272\050\276\022\256\105\054\004\164\254\023\121
+\305\130\030\146\115\202\332\325\334\223\300\047\341\276\174\237
+\122\236\022\126\366\325\234\251\364\165\234\372\067\022\217\034
+\223\354\127\376\007\017\253\325\022\367\017\256\141\136\126\200
+\111\365\374\060\365\233\117\037\101\057\034\204\323\211\307\342
+\332\002\166\355\011\317\154\301\270\034\203\034\026\372\224\315
+\175\240\310\030\322\310\235\156\365\275\151\324\155\075\065\350
+\036\242\117\140\327\007\051\374\262\243\244\235\156\025\222\126
+\031\114\012\260\351\174\322\031\115\102\106\354\275\375\366\127
+\133\335\230\176\244\115\314\162\003\203\130\135\357\223\072\101
+\172\143\252\174\072\250\365\254\244\321\335\242\055\266\052\374
+\237\001\216\342\020\261\304\312\344\147\333\125\045\031\077\375
+\350\066\176\263\341\341\201\257\021\026\213\120\227\140\031\202
+\000\300\153\115\163\270\321\023\007\076\352\266\061\117\360\102
+\232\155\342\021\164\345\224\254\215\204\225\074\041\257\305\332
+\107\310\337\071\142\142\313\133\120\013\327\201\100\005\234\233
+\355\272\266\213\036\004\157\226\040\071\355\244\175\051\333\110
+\316\202\334\324\002\215\035\004\061\132\307\113\360\154\141\122
+\327\264\121\302\201\154\315\341\373\247\241\322\222\166\317\261
+\017\067\130\244\362\122\161\147\077\014\210\170\200\211\301\310
+\265\037\222\143\276\247\172\212\126\054\032\250\246\234\265\135
+\263\143\320\023\040\241\353\221\154\320\215\175\257\337\013\344
+\027\271\206\236\070\261\224\014\130\214\340\125\252\073\143\155
+\232\211\140\270\144\052\222\306\067\364\176\103\103\267\163\350
+\001\347\177\227\017\327\362\173\031\375\032\327\217\311\372\205
+\153\172\235\236\211\266\246\050\231\223\210\100\367\076\315\121
+\243\312\352\357\171\107\041\265\376\062\342\307\303\121\157\276
+\200\164\360\244\303\072\362\117\351\137\337\031\012\362\073\023
+\103\254\061\244\263\347\353\374\030\326\001\251\363\052\217\066
+\016\353\264\261\274\267\114\311\153\277\241\363\331\364\355\342
+\360\343\355\144\236\075\057\226\122\117\200\123\213
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "CA Disig Root R1"
+# Issuer: CN=CA Disig Root R1,O=Disig a.s.,L=Bratislava,C=SK
+# Serial Number:00:c3:03:9a:ee:50:90:6e:28
+# Subject: CN=CA Disig Root R1,O=Disig a.s.,L=Bratislava,C=SK
+# Not Valid Before: Thu Jul 19 09:06:56 2012
+# Not Valid After : Sat Jul 19 09:06:56 2042
+# Fingerprint (MD5): BE:EC:11:93:9A:F5:69:21:BC:D7:C1:C0:67:89:CC:2A
+# Fingerprint (SHA1): 8E:1C:74:F8:A6:20:B9:E5:8A:F4:61:FA:EC:2B:47:56:51:1A:52:C6
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "CA Disig Root R1"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\216\034\164\370\246\040\271\345\212\364\141\372\354\053\107\126
+\121\032\122\306
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\276\354\021\223\232\365\151\041\274\327\301\300\147\211\314\052
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\122\061\013\060\011\006\003\125\004\006\023\002\123\113\061
+\023\060\021\006\003\125\004\007\023\012\102\162\141\164\151\163
+\154\141\166\141\061\023\060\021\006\003\125\004\012\023\012\104
+\151\163\151\147\040\141\056\163\056\061\031\060\027\006\003\125
+\004\003\023\020\103\101\040\104\151\163\151\147\040\122\157\157
+\164\040\122\061
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\011\000\303\003\232\356\120\220\156\050
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
# Certificate "CA Disig Root R2"
#
# Issuer: CN=CA Disig Root R2,O=Disig a.s.,L=Bratislava,C=SK
@@ -16517,6 +21317,333 @@ CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
#
+# Certificate "WoSign"
+#
+# Issuer: CN=Certification Authority of WoSign,O=WoSign CA Limited,C=CN
+# Serial Number:5e:68:d6:11:71:94:63:50:56:00:68:f3:3e:c9:c5:91
+# Subject: CN=Certification Authority of WoSign,O=WoSign CA Limited,C=CN
+# Not Valid Before: Sat Aug 08 01:00:01 2009
+# Not Valid After : Mon Aug 08 01:00:01 2039
+# Fingerprint (SHA-256): 4B:22:D5:A6:AE:C9:9F:3C:DB:79:AA:5E:C0:68:38:47:9C:D5:EC:BA:71:64:F7:F2:2D:C1:D6:5F:63:D8:57:08
+# Fingerprint (SHA1): B9:42:94:BF:91:EA:8F:B6:4B:E6:10:97:C7:FB:00:13:59:B6:76:CB
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "WoSign"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\125\061\013\060\011\006\003\125\004\006\023\002\103\116\061
+\032\060\030\006\003\125\004\012\023\021\127\157\123\151\147\156
+\040\103\101\040\114\151\155\151\164\145\144\061\052\060\050\006
+\003\125\004\003\023\041\103\145\162\164\151\146\151\143\141\164
+\151\157\156\040\101\165\164\150\157\162\151\164\171\040\157\146
+\040\127\157\123\151\147\156
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\125\061\013\060\011\006\003\125\004\006\023\002\103\116\061
+\032\060\030\006\003\125\004\012\023\021\127\157\123\151\147\156
+\040\103\101\040\114\151\155\151\164\145\144\061\052\060\050\006
+\003\125\004\003\023\041\103\145\162\164\151\146\151\143\141\164
+\151\157\156\040\101\165\164\150\157\162\151\164\171\040\157\146
+\040\127\157\123\151\147\156
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\020\136\150\326\021\161\224\143\120\126\000\150\363\076\311
+\305\221
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\005\166\060\202\003\136\240\003\002\001\002\002\020\136
+\150\326\021\161\224\143\120\126\000\150\363\076\311\305\221\060
+\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060\125
+\061\013\060\011\006\003\125\004\006\023\002\103\116\061\032\060
+\030\006\003\125\004\012\023\021\127\157\123\151\147\156\040\103
+\101\040\114\151\155\151\164\145\144\061\052\060\050\006\003\125
+\004\003\023\041\103\145\162\164\151\146\151\143\141\164\151\157
+\156\040\101\165\164\150\157\162\151\164\171\040\157\146\040\127
+\157\123\151\147\156\060\036\027\015\060\071\060\070\060\070\060
+\061\060\060\060\061\132\027\015\063\071\060\070\060\070\060\061
+\060\060\060\061\132\060\125\061\013\060\011\006\003\125\004\006
+\023\002\103\116\061\032\060\030\006\003\125\004\012\023\021\127
+\157\123\151\147\156\040\103\101\040\114\151\155\151\164\145\144
+\061\052\060\050\006\003\125\004\003\023\041\103\145\162\164\151
+\146\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151
+\164\171\040\157\146\040\127\157\123\151\147\156\060\202\002\042
+\060\015\006\011\052\206\110\206\367\015\001\001\001\005\000\003
+\202\002\017\000\060\202\002\012\002\202\002\001\000\275\312\215
+\254\270\221\025\126\227\173\153\134\172\302\336\153\331\241\260
+\303\020\043\372\247\241\262\314\061\372\076\331\246\051\157\026
+\075\340\153\370\270\100\137\333\071\250\000\172\213\240\115\124
+\175\302\042\170\374\216\011\270\250\205\327\314\225\227\113\164
+\330\236\176\360\000\344\016\211\256\111\050\104\032\020\231\062
+\017\045\210\123\244\015\263\017\022\010\026\013\003\161\047\034
+\177\341\333\322\375\147\150\304\005\135\012\016\135\160\327\330
+\227\240\274\123\101\232\221\215\364\236\066\146\172\176\126\301
+\220\137\346\261\150\040\066\244\214\044\054\054\107\013\131\166
+\146\060\265\276\336\355\217\370\235\323\273\001\060\346\362\363
+\016\340\054\222\200\363\205\371\050\212\264\124\056\232\355\367
+\166\374\025\150\026\353\112\154\353\056\022\217\324\317\376\014
+\307\134\035\013\176\005\062\276\136\260\011\052\102\325\311\116
+\220\263\131\015\273\172\176\315\325\010\132\264\177\330\034\151
+\021\371\047\017\173\006\257\124\203\030\173\341\335\124\172\121
+\150\156\167\374\306\277\122\112\146\106\241\262\147\032\273\243
+\117\167\240\276\135\377\374\126\013\103\162\167\220\312\236\371
+\362\071\365\015\251\364\352\327\347\263\020\057\060\102\067\041
+\314\060\160\311\206\230\017\314\130\115\203\273\175\345\032\245
+\067\215\266\254\062\227\000\072\143\161\044\036\236\067\304\377
+\164\324\067\300\342\376\210\106\140\021\335\010\077\120\066\253
+\270\172\244\225\142\152\156\260\312\152\041\132\151\363\363\373
+\035\160\071\225\363\247\156\246\201\211\241\210\305\073\161\312
+\243\122\356\203\273\375\240\167\364\344\157\347\102\333\155\112
+\231\212\064\110\274\027\334\344\200\010\042\266\362\061\300\077
+\004\076\353\237\040\171\326\270\006\144\144\002\061\327\251\315
+\122\373\204\105\151\011\000\052\334\125\213\304\006\106\113\300
+\112\035\011\133\071\050\375\251\253\316\000\371\056\110\113\046
+\346\060\114\245\130\312\264\104\202\117\347\221\036\063\303\260
+\223\377\021\374\201\322\312\037\161\051\335\166\117\222\045\257
+\035\201\267\017\057\214\303\006\314\057\047\243\112\344\016\231
+\272\174\036\105\037\177\252\031\105\226\375\374\075\002\003\001
+\000\001\243\102\060\100\060\016\006\003\125\035\017\001\001\377
+\004\004\003\002\001\006\060\017\006\003\125\035\023\001\001\377
+\004\005\060\003\001\001\377\060\035\006\003\125\035\016\004\026
+\004\024\341\146\317\016\321\361\263\113\267\006\040\024\376\207
+\022\325\366\376\373\076\060\015\006\011\052\206\110\206\367\015
+\001\001\005\005\000\003\202\002\001\000\250\313\162\100\262\166
+\301\176\173\374\255\144\343\062\173\314\074\266\135\106\323\365
+\054\342\160\135\310\056\330\006\175\230\321\013\041\240\211\131
+\044\001\235\371\257\011\175\012\043\202\064\325\374\174\162\231
+\271\243\327\124\364\352\122\160\016\305\365\326\073\341\072\011
+\062\346\041\071\223\275\263\025\352\117\152\364\365\213\077\057
+\174\215\130\056\305\341\071\240\076\307\075\112\163\236\100\172
+\300\053\141\251\147\311\363\044\271\263\155\125\054\132\035\236
+\045\162\316\013\255\252\307\125\142\013\276\373\143\263\141\104
+\043\243\313\341\032\016\367\232\006\115\336\324\043\116\041\226
+\133\071\133\127\035\057\135\010\136\011\171\377\174\227\265\115
+\203\256\015\326\346\243\171\340\063\320\231\226\002\060\247\076
+\377\322\243\103\077\005\132\006\352\104\002\332\174\370\110\320
+\063\251\371\007\307\225\341\365\076\365\135\161\272\362\225\251
+\164\210\141\131\343\277\312\132\023\272\162\264\214\135\066\207
+\351\246\305\074\023\277\336\320\104\046\356\267\354\056\160\372
+\327\235\267\254\345\305\100\132\346\327\154\173\054\303\126\233
+\107\315\013\316\372\033\264\041\327\267\146\270\364\045\060\213
+\134\015\271\352\147\262\364\155\256\325\241\236\117\330\237\351
+\047\002\260\035\006\326\217\343\373\110\022\237\177\021\241\020
+\076\114\121\072\226\260\321\023\361\307\330\046\256\072\312\221
+\304\151\235\337\001\051\144\121\157\150\332\024\354\010\101\227
+\220\215\320\262\200\362\317\302\075\277\221\150\305\200\147\036
+\304\140\023\125\325\141\231\127\174\272\225\017\141\111\072\312
+\165\274\311\012\223\077\147\016\022\362\050\342\061\033\300\127
+\026\337\010\174\031\301\176\017\037\205\036\012\066\174\133\176
+\047\274\172\277\340\333\364\332\122\275\336\014\124\160\061\221
+\103\225\310\274\360\076\335\011\176\060\144\120\355\177\001\244
+\063\147\115\150\117\276\025\357\260\366\002\021\242\033\023\045
+\072\334\302\131\361\343\134\106\273\147\054\002\106\352\036\110
+\246\346\133\331\265\274\121\242\222\226\333\252\306\067\042\246
+\376\314\040\164\243\055\251\056\153\313\300\202\021\041\265\223
+\171\356\104\206\276\327\036\344\036\373
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "WoSign"
+# Issuer: CN=Certification Authority of WoSign,O=WoSign CA Limited,C=CN
+# Serial Number:5e:68:d6:11:71:94:63:50:56:00:68:f3:3e:c9:c5:91
+# Subject: CN=Certification Authority of WoSign,O=WoSign CA Limited,C=CN
+# Not Valid Before: Sat Aug 08 01:00:01 2009
+# Not Valid After : Mon Aug 08 01:00:01 2039
+# Fingerprint (SHA-256): 4B:22:D5:A6:AE:C9:9F:3C:DB:79:AA:5E:C0:68:38:47:9C:D5:EC:BA:71:64:F7:F2:2D:C1:D6:5F:63:D8:57:08
+# Fingerprint (SHA1): B9:42:94:BF:91:EA:8F:B6:4B:E6:10:97:C7:FB:00:13:59:B6:76:CB
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "WoSign"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\271\102\224\277\221\352\217\266\113\346\020\227\307\373\000\023
+\131\266\166\313
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\241\362\371\265\322\310\172\164\270\363\005\361\327\341\204\215
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\125\061\013\060\011\006\003\125\004\006\023\002\103\116\061
+\032\060\030\006\003\125\004\012\023\021\127\157\123\151\147\156
+\040\103\101\040\114\151\155\151\164\145\144\061\052\060\050\006
+\003\125\004\003\023\041\103\145\162\164\151\146\151\143\141\164
+\151\157\156\040\101\165\164\150\157\162\151\164\171\040\157\146
+\040\127\157\123\151\147\156
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\020\136\150\326\021\161\224\143\120\126\000\150\363\076\311
+\305\221
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "WoSign China"
+#
+# Issuer: CN=CA ...............,O=WoSign CA Limited,C=CN
+# Serial Number:50:70:6b:cd:d8:13:fc:1b:4e:3b:33:72:d2:11:48:8d
+# Subject: CN=CA ...............,O=WoSign CA Limited,C=CN
+# Not Valid Before: Sat Aug 08 01:00:01 2009
+# Not Valid After : Mon Aug 08 01:00:01 2039
+# Fingerprint (SHA-256): D6:F0:34:BD:94:AA:23:3F:02:97:EC:A4:24:5B:28:39:73:E4:47:AA:59:0F:31:0C:77:F4:8F:DF:83:11:22:54
+# Fingerprint (SHA1): 16:32:47:8D:89:F9:21:3A:92:00:85:63:F5:A4:A7:D3:12:40:8A:D6
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "WoSign China"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\106\061\013\060\011\006\003\125\004\006\023\002\103\116\061
+\032\060\030\006\003\125\004\012\023\021\127\157\123\151\147\156
+\040\103\101\040\114\151\155\151\164\145\144\061\033\060\031\006
+\003\125\004\003\014\022\103\101\040\346\262\203\351\200\232\346
+\240\271\350\257\201\344\271\246
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\106\061\013\060\011\006\003\125\004\006\023\002\103\116\061
+\032\060\030\006\003\125\004\012\023\021\127\157\123\151\147\156
+\040\103\101\040\114\151\155\151\164\145\144\061\033\060\031\006
+\003\125\004\003\014\022\103\101\040\346\262\203\351\200\232\346
+\240\271\350\257\201\344\271\246
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\020\120\160\153\315\330\023\374\033\116\073\063\162\322\021
+\110\215
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\005\130\060\202\003\100\240\003\002\001\002\002\020\120
+\160\153\315\330\023\374\033\116\073\063\162\322\021\110\215\060
+\015\006\011\052\206\110\206\367\015\001\001\013\005\000\060\106
+\061\013\060\011\006\003\125\004\006\023\002\103\116\061\032\060
+\030\006\003\125\004\012\023\021\127\157\123\151\147\156\040\103
+\101\040\114\151\155\151\164\145\144\061\033\060\031\006\003\125
+\004\003\014\022\103\101\040\346\262\203\351\200\232\346\240\271
+\350\257\201\344\271\246\060\036\027\015\060\071\060\070\060\070
+\060\061\060\060\060\061\132\027\015\063\071\060\070\060\070\060
+\061\060\060\060\061\132\060\106\061\013\060\011\006\003\125\004
+\006\023\002\103\116\061\032\060\030\006\003\125\004\012\023\021
+\127\157\123\151\147\156\040\103\101\040\114\151\155\151\164\145
+\144\061\033\060\031\006\003\125\004\003\014\022\103\101\040\346
+\262\203\351\200\232\346\240\271\350\257\201\344\271\246\060\202
+\002\042\060\015\006\011\052\206\110\206\367\015\001\001\001\005
+\000\003\202\002\017\000\060\202\002\012\002\202\002\001\000\320
+\111\041\036\045\374\207\301\052\302\254\333\166\206\006\116\347
+\320\164\064\334\355\145\065\374\120\326\210\077\244\360\177\353
+\017\137\171\057\211\261\375\274\143\130\067\223\233\070\370\267
+\133\251\372\330\161\307\264\274\200\227\215\154\113\361\120\325
+\052\051\252\250\031\172\226\346\225\216\164\355\227\012\127\165
+\364\005\333\155\013\071\271\001\177\252\366\326\332\154\346\005
+\340\244\115\122\374\333\320\164\267\021\214\173\215\117\377\207
+\203\256\377\005\003\023\127\120\067\376\214\226\122\020\114\137
+\277\224\161\151\331\226\076\014\103\117\276\060\300\237\071\164
+\117\006\105\135\243\326\126\071\150\007\314\207\117\120\167\223
+\161\331\104\010\261\212\064\351\211\254\333\233\116\341\331\344
+\122\105\214\056\024\037\221\153\031\035\150\051\054\126\304\342
+\036\023\127\144\360\141\343\271\021\337\260\341\127\240\033\255
+\327\137\321\257\333\053\055\077\320\150\216\017\352\237\017\213
+\065\130\033\023\034\364\336\065\241\012\135\326\352\337\022\157
+\300\373\151\007\106\162\334\201\366\004\043\027\340\115\165\341
+\162\157\260\050\353\233\341\341\203\241\237\112\135\257\314\233
+\372\002\040\266\030\142\167\221\073\243\325\145\255\334\174\220
+\167\034\104\101\244\112\213\353\225\162\351\366\011\144\334\250
+\055\237\164\170\350\301\242\011\143\234\357\240\333\117\235\225
+\253\040\117\267\260\367\207\134\246\240\344\067\070\307\134\343
+\065\017\054\255\243\200\242\354\056\135\300\317\355\213\005\302
+\346\163\156\366\211\325\365\322\106\216\352\155\143\033\036\212
+\311\175\246\370\234\353\345\325\143\205\115\163\146\151\021\376
+\310\016\364\301\307\146\111\123\176\344\031\153\361\351\172\131
+\243\155\176\305\027\346\047\306\357\033\333\157\374\015\115\006
+\001\264\016\134\060\106\125\140\257\070\145\072\312\107\272\254
+\054\314\106\037\262\106\226\077\363\355\046\005\356\167\241\152
+\153\176\055\155\130\134\112\324\216\147\270\361\332\325\106\212
+\047\371\021\362\311\102\376\116\336\337\037\134\304\244\206\207
+\026\063\241\247\027\030\245\015\344\005\345\053\302\053\013\242
+\225\220\271\375\140\074\116\211\076\347\234\356\037\273\001\002
+\003\001\000\001\243\102\060\100\060\016\006\003\125\035\017\001
+\001\377\004\004\003\002\001\006\060\017\006\003\125\035\023\001
+\001\377\004\005\060\003\001\001\377\060\035\006\003\125\035\016
+\004\026\004\024\340\115\277\334\233\101\135\023\350\144\360\247
+\351\025\244\341\201\301\272\061\060\015\006\011\052\206\110\206
+\367\015\001\001\013\005\000\003\202\002\001\000\152\212\160\070
+\131\266\332\213\030\310\276\052\323\266\031\325\146\051\172\135
+\315\133\057\163\034\046\116\243\175\157\253\267\051\115\246\351
+\245\021\203\247\071\163\257\020\104\222\346\045\135\117\141\372
+\310\006\276\116\113\357\376\363\061\376\306\174\160\012\101\130
+\332\350\231\113\226\311\170\274\230\174\002\051\355\011\200\346
+\012\072\202\002\052\342\311\057\310\126\031\046\356\170\034\043
+\375\367\223\145\116\347\363\230\230\257\315\335\331\236\100\210
+\061\050\072\253\056\013\260\254\014\044\372\172\046\230\363\022
+\141\020\364\135\027\367\176\342\170\227\124\342\214\350\051\272
+\214\020\062\275\335\063\153\070\206\176\071\075\016\003\162\247
+\135\171\217\105\212\131\256\133\041\156\061\106\325\131\215\317
+\025\137\335\061\045\317\333\140\326\201\104\162\051\002\127\366
+\226\324\326\377\352\051\333\071\305\270\054\212\032\215\316\313
+\347\102\061\206\005\150\016\236\024\335\000\220\272\151\105\010
+\333\156\220\201\206\247\052\005\077\346\204\071\370\267\371\127
+\137\114\244\171\132\020\014\136\325\153\377\065\137\005\121\036
+\154\243\165\251\317\120\203\323\174\364\146\367\202\215\075\014
+\175\350\337\173\250\016\033\054\234\256\100\160\207\332\355\247
+\026\202\132\276\065\154\040\116\042\141\331\274\121\172\315\172
+\141\334\113\021\371\376\147\064\317\056\004\146\141\134\127\227
+\043\214\363\206\033\110\337\052\257\247\301\377\330\216\076\003
+\273\330\052\260\372\024\045\262\121\153\206\103\205\056\007\043
+\026\200\215\114\373\264\143\073\314\303\164\355\033\243\036\376
+\065\017\137\174\035\026\206\365\016\303\225\361\057\257\135\045
+\073\121\346\327\166\101\070\321\113\003\071\050\245\036\221\162
+\324\175\253\227\063\304\323\076\340\151\266\050\171\240\011\215
+\034\321\377\101\162\110\006\374\232\056\347\040\371\233\242\336
+\211\355\256\074\011\257\312\127\263\222\211\160\100\344\057\117
+\302\160\203\100\327\044\054\153\347\011\037\323\325\307\301\010
+\364\333\016\073\034\007\013\103\021\204\041\206\351\200\324\165
+\330\253\361\002\142\301\261\176\125\141\317\023\327\046\260\327
+\234\313\051\213\070\112\013\016\220\215\272\241
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "WoSign China"
+# Issuer: CN=CA ...............,O=WoSign CA Limited,C=CN
+# Serial Number:50:70:6b:cd:d8:13:fc:1b:4e:3b:33:72:d2:11:48:8d
+# Subject: CN=CA ...............,O=WoSign CA Limited,C=CN
+# Not Valid Before: Sat Aug 08 01:00:01 2009
+# Not Valid After : Mon Aug 08 01:00:01 2039
+# Fingerprint (SHA-256): D6:F0:34:BD:94:AA:23:3F:02:97:EC:A4:24:5B:28:39:73:E4:47:AA:59:0F:31:0C:77:F4:8F:DF:83:11:22:54
+# Fingerprint (SHA1): 16:32:47:8D:89:F9:21:3A:92:00:85:63:F5:A4:A7:D3:12:40:8A:D6
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "WoSign China"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\026\062\107\215\211\371\041\072\222\000\205\143\365\244\247\323
+\022\100\212\326
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\170\203\133\122\026\166\304\044\073\203\170\350\254\332\232\223
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\106\061\013\060\011\006\003\125\004\006\023\002\103\116\061
+\032\060\030\006\003\125\004\012\023\021\127\157\123\151\147\156
+\040\103\101\040\114\151\155\151\164\145\144\061\033\060\031\006
+\003\125\004\003\014\022\103\101\040\346\262\203\351\200\232\346
+\240\271\350\257\201\344\271\246
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\020\120\160\153\315\330\023\374\033\116\073\063\162\322\021
+\110\215
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
# Certificate "COMODO RSA Certification Authority"
#
# Issuer: CN=COMODO RSA Certification Authority,O=COMODO CA Limited,L=Salford,ST=Greater Manchester,C=GB
@@ -17231,6 +22358,188 @@ CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
#
+# Certificate "VeriSign-C3SSA-G2-temporary-intermediate-after-1024bit-removal"
+#
+# Issuer: CN=VeriSign Class 3 Public Primary Certification Authority - G5,OU="(c) 2006 VeriSign, Inc. - For authorized use only",OU=VeriSign Trust Network,O="VeriSign, Inc.",C=US
+# Serial Number:2f:00:6e:cd:17:70:66:e7:5f:a3:82:0a:79:1f:05:ae
+# Subject: CN=VeriSign Class 3 Secure Server CA - G2,OU=Terms of use at https://www.verisign.com/rpa (c)09,OU=VeriSign Trust Network,O="VeriSign, Inc.",C=US
+# Not Valid Before: Thu Mar 26 00:00:00 2009
+# Not Valid After : Sun Mar 24 23:59:59 2019
+# Fingerprint (SHA-256): 0A:41:51:D5:E5:8B:84:B8:AC:E5:3A:5C:12:12:2A:C9:59:CD:69:91:FB:B3:8E:99:B5:76:C0:AB:DA:C3:58:14
+# Fingerprint (SHA1): 76:44:59:78:1B:AC:B0:47:63:A5:D0:A1:58:91:65:26:1F:29:8E:3B
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "VeriSign-C3SSA-G2-temporary-intermediate-after-1024bit-removal"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\201\265\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123
+\151\147\156\054\040\111\156\143\056\061\037\060\035\006\003\125
+\004\013\023\026\126\145\162\151\123\151\147\156\040\124\162\165
+\163\164\040\116\145\164\167\157\162\153\061\073\060\071\006\003
+\125\004\013\023\062\124\145\162\155\163\040\157\146\040\165\163
+\145\040\141\164\040\150\164\164\160\163\072\057\057\167\167\167
+\056\166\145\162\151\163\151\147\156\056\143\157\155\057\162\160
+\141\040\050\143\051\060\071\061\057\060\055\006\003\125\004\003
+\023\046\126\145\162\151\123\151\147\156\040\103\154\141\163\163
+\040\063\040\123\145\143\165\162\145\040\123\145\162\166\145\162
+\040\103\101\040\055\040\107\062
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\312\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123
+\151\147\156\054\040\111\156\143\056\061\037\060\035\006\003\125
+\004\013\023\026\126\145\162\151\123\151\147\156\040\124\162\165
+\163\164\040\116\145\164\167\157\162\153\061\072\060\070\006\003
+\125\004\013\023\061\050\143\051\040\062\060\060\066\040\126\145
+\162\151\123\151\147\156\054\040\111\156\143\056\040\055\040\106
+\157\162\040\141\165\164\150\157\162\151\172\145\144\040\165\163
+\145\040\157\156\154\171\061\105\060\103\006\003\125\004\003\023
+\074\126\145\162\151\123\151\147\156\040\103\154\141\163\163\040
+\063\040\120\165\142\154\151\143\040\120\162\151\155\141\162\171
+\040\103\145\162\164\151\146\151\143\141\164\151\157\156\040\101
+\165\164\150\157\162\151\164\171\040\055\040\107\065
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\020\057\000\156\315\027\160\146\347\137\243\202\012\171\037
+\005\256
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\005\071\060\202\004\041\240\003\002\001\002\002\020\057
+\000\156\315\027\160\146\347\137\243\202\012\171\037\005\256\060
+\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060\201
+\312\061\013\060\011\006\003\125\004\006\023\002\125\123\061\027
+\060\025\006\003\125\004\012\023\016\126\145\162\151\123\151\147
+\156\054\040\111\156\143\056\061\037\060\035\006\003\125\004\013
+\023\026\126\145\162\151\123\151\147\156\040\124\162\165\163\164
+\040\116\145\164\167\157\162\153\061\072\060\070\006\003\125\004
+\013\023\061\050\143\051\040\062\060\060\066\040\126\145\162\151
+\123\151\147\156\054\040\111\156\143\056\040\055\040\106\157\162
+\040\141\165\164\150\157\162\151\172\145\144\040\165\163\145\040
+\157\156\154\171\061\105\060\103\006\003\125\004\003\023\074\126
+\145\162\151\123\151\147\156\040\103\154\141\163\163\040\063\040
+\120\165\142\154\151\143\040\120\162\151\155\141\162\171\040\103
+\145\162\164\151\146\151\143\141\164\151\157\156\040\101\165\164
+\150\157\162\151\164\171\040\055\040\107\065\060\036\027\015\060
+\071\060\063\062\066\060\060\060\060\060\060\132\027\015\061\071
+\060\063\062\064\062\063\065\071\065\071\132\060\201\265\061\013
+\060\011\006\003\125\004\006\023\002\125\123\061\027\060\025\006
+\003\125\004\012\023\016\126\145\162\151\123\151\147\156\054\040
+\111\156\143\056\061\037\060\035\006\003\125\004\013\023\026\126
+\145\162\151\123\151\147\156\040\124\162\165\163\164\040\116\145
+\164\167\157\162\153\061\073\060\071\006\003\125\004\013\023\062
+\124\145\162\155\163\040\157\146\040\165\163\145\040\141\164\040
+\150\164\164\160\163\072\057\057\167\167\167\056\166\145\162\151
+\163\151\147\156\056\143\157\155\057\162\160\141\040\050\143\051
+\060\071\061\057\060\055\006\003\125\004\003\023\046\126\145\162
+\151\123\151\147\156\040\103\154\141\163\163\040\063\040\123\145
+\143\165\162\145\040\123\145\162\166\145\162\040\103\101\040\055
+\040\107\062\060\202\001\042\060\015\006\011\052\206\110\206\367
+\015\001\001\001\005\000\003\202\001\017\000\060\202\001\012\002
+\202\001\001\000\324\126\217\127\073\067\050\246\100\143\322\225
+\325\005\164\332\265\031\152\226\326\161\127\057\342\300\064\214
+\240\225\263\214\341\067\044\363\056\355\103\105\005\216\211\327
+\372\332\112\265\370\076\215\116\307\371\111\120\105\067\100\237
+\164\252\240\121\125\141\361\140\204\211\245\236\200\215\057\260
+\041\252\105\202\304\317\264\024\177\107\025\040\050\202\260\150
+\022\300\256\134\007\327\366\131\314\313\142\126\134\115\111\377
+\046\210\253\124\121\072\057\112\332\016\230\342\211\162\271\374
+\367\150\074\304\037\071\172\313\027\201\363\014\255\017\334\141
+\142\033\020\013\004\036\051\030\161\136\142\313\103\336\276\061
+\272\161\002\031\116\046\251\121\332\214\144\151\003\336\234\375
+\175\375\173\141\274\374\204\174\210\134\264\303\173\355\137\053
+\106\022\361\375\000\001\232\213\133\351\243\005\056\217\056\133
+\336\363\033\170\370\146\221\010\300\136\316\325\260\066\312\324
+\250\173\240\175\371\060\172\277\370\335\031\121\053\040\272\376
+\247\317\241\116\260\147\365\200\252\053\203\056\322\216\124\211
+\216\036\051\013\002\003\001\000\001\243\202\001\054\060\202\001
+\050\060\022\006\003\125\035\023\001\001\377\004\010\060\006\001
+\001\377\002\001\000\060\016\006\003\125\035\017\001\001\377\004
+\004\003\002\001\006\060\051\006\003\125\035\021\004\042\060\040
+\244\036\060\034\061\032\060\030\006\003\125\004\003\023\021\103
+\154\141\163\163\063\103\101\062\060\064\070\055\061\055\065\062
+\060\035\006\003\125\035\016\004\026\004\024\245\357\013\021\316
+\300\101\003\243\112\145\220\110\262\034\340\127\055\175\107\060
+\146\006\003\125\035\040\004\137\060\135\060\133\006\013\140\206
+\110\001\206\370\105\001\007\027\003\060\114\060\043\006\010\053
+\006\001\005\005\007\002\001\026\027\150\164\164\160\163\072\057
+\057\144\056\163\171\155\143\142\056\143\157\155\057\143\160\163
+\060\045\006\010\053\006\001\005\005\007\002\002\060\031\032\027
+\150\164\164\160\163\072\057\057\144\056\163\171\155\143\142\056
+\143\157\155\057\162\160\141\060\057\006\003\125\035\037\004\050
+\060\046\060\044\240\042\240\040\206\036\150\164\164\160\072\057
+\057\163\056\163\171\155\143\142\056\143\157\155\057\160\143\141
+\063\055\147\065\056\143\162\154\060\037\006\003\125\035\043\004
+\030\060\026\200\024\177\323\145\247\302\335\354\273\360\060\011
+\363\103\071\372\002\257\063\061\063\060\015\006\011\052\206\110
+\206\367\015\001\001\005\005\000\003\202\001\001\000\053\216\024
+\314\354\206\010\140\067\213\154\145\211\045\041\336\057\122\242
+\007\236\130\323\263\026\170\001\231\121\225\264\023\167\314\167
+\335\013\134\201\067\326\276\366\142\326\004\067\013\030\163\232
+\323\366\301\242\036\155\234\273\214\021\346\076\022\136\007\137
+\013\203\134\164\002\340\120\364\261\046\033\155\306\350\351\277
+\115\271\001\025\031\354\120\232\371\021\360\201\130\103\054\115
+\021\100\263\132\106\010\246\136\163\241\210\022\065\214\377\003
+\072\275\326\235\372\347\334\226\271\032\144\076\304\375\331\012
+\266\145\236\272\245\250\130\374\073\042\360\242\127\356\212\127
+\107\234\167\307\045\341\254\064\005\115\363\202\176\101\043\272
+\264\127\363\347\306\001\145\327\115\211\231\034\151\115\136\170
+\366\353\162\161\075\262\304\225\001\237\135\014\267\057\045\246
+\134\171\101\357\236\304\147\074\241\235\177\161\072\320\225\227
+\354\170\102\164\230\156\276\076\150\114\127\074\250\223\101\207
+\013\344\271\257\221\373\120\114\014\272\300\044\047\321\025\333
+\145\110\041\012\057\327\334\176\240\314\145\176\171
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "VeriSign-C3SSA-G2-temporary-intermediate-after-1024bit-removal"
+# Issuer: CN=VeriSign Class 3 Public Primary Certification Authority - G5,OU="(c) 2006 VeriSign, Inc. - For authorized use only",OU=VeriSign Trust Network,O="VeriSign, Inc.",C=US
+# Serial Number:2f:00:6e:cd:17:70:66:e7:5f:a3:82:0a:79:1f:05:ae
+# Subject: CN=VeriSign Class 3 Secure Server CA - G2,OU=Terms of use at https://www.verisign.com/rpa (c)09,OU=VeriSign Trust Network,O="VeriSign, Inc.",C=US
+# Not Valid Before: Thu Mar 26 00:00:00 2009
+# Not Valid After : Sun Mar 24 23:59:59 2019
+# Fingerprint (SHA-256): 0A:41:51:D5:E5:8B:84:B8:AC:E5:3A:5C:12:12:2A:C9:59:CD:69:91:FB:B3:8E:99:B5:76:C0:AB:DA:C3:58:14
+# Fingerprint (SHA1): 76:44:59:78:1B:AC:B0:47:63:A5:D0:A1:58:91:65:26:1F:29:8E:3B
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "VeriSign-C3SSA-G2-temporary-intermediate-after-1024bit-removal"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\166\104\131\170\033\254\260\107\143\245\320\241\130\221\145\046
+\037\051\216\073
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\277\022\155\372\174\325\133\046\171\072\215\252\021\357\057\134
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\201\312\061\013\060\011\006\003\125\004\006\023\002\125\123
+\061\027\060\025\006\003\125\004\012\023\016\126\145\162\151\123
+\151\147\156\054\040\111\156\143\056\061\037\060\035\006\003\125
+\004\013\023\026\126\145\162\151\123\151\147\156\040\124\162\165
+\163\164\040\116\145\164\167\157\162\153\061\072\060\070\006\003
+\125\004\013\023\061\050\143\051\040\062\060\060\066\040\126\145
+\162\151\123\151\147\156\054\040\111\156\143\056\040\055\040\106
+\157\162\040\141\165\164\150\157\162\151\172\145\144\040\165\163
+\145\040\157\156\154\171\061\105\060\103\006\003\125\004\003\023
+\074\126\145\162\151\123\151\147\156\040\103\154\141\163\163\040
+\063\040\120\165\142\154\151\143\040\120\162\151\155\141\162\171
+\040\103\145\162\164\151\146\151\143\141\164\151\157\156\040\101
+\165\164\150\157\162\151\164\171\040\055\040\107\065
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\020\057\000\156\315\027\160\146\347\137\243\202\012\171\037
+\005\256
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
# Certificate "Staat der Nederlanden Root CA - G3"
#
# Issuer: CN=Staat der Nederlanden Root CA - G3,O=Staat der Nederlanden,C=NL
@@ -18509,6 +23818,149 @@ CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
#
+# Certificate "Explicitly Distrusted MCSHOLDING CA"
+#
+# Issuer: CN=CNNIC ROOT,O=CNNIC,C=CN
+# Serial Number: 1228079246 (0x4933008e)
+# Subject: CN=MCSHOLDING TEST,O=MCSHOLDING,C=EG
+# Not Valid Before: Thu Mar 19 06:20:09 2015
+# Not Valid After : Fri Apr 03 06:20:09 2015
+# Fingerprint (SHA-256): 27:40:D9:56:B1:12:7B:79:1A:A1:B3:CC:64:4A:4D:BE:DB:A7:61:86:A2:36:38:B9:51:02:35:1A:83:4E:A8:61
+# Fingerprint (SHA1): E1:F3:59:1E:76:98:65:C4:E4:47:AC:C3:7E:AF:C9:E2:BF:E4:C5:76
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Explicitly Distrusted MCSHOLDING CA"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\074\061\013\060\011\006\003\125\004\006\023\002\105\107\061
+\023\060\021\006\003\125\004\012\014\012\115\103\123\110\117\114
+\104\111\116\107\061\030\060\026\006\003\125\004\003\014\017\115
+\103\123\110\117\114\104\111\116\107\040\124\105\123\124
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\062\061\013\060\011\006\003\125\004\006\023\002\103\116\061
+\016\060\014\006\003\125\004\012\023\005\103\116\116\111\103\061
+\023\060\021\006\003\125\004\003\023\012\103\116\116\111\103\040
+\122\117\117\124
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\004\111\063\000\216
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\004\222\060\202\003\172\240\003\002\001\002\002\004\111
+\063\000\216\060\015\006\011\052\206\110\206\367\015\001\001\013
+\005\000\060\062\061\013\060\011\006\003\125\004\006\023\002\103
+\116\061\016\060\014\006\003\125\004\012\023\005\103\116\116\111
+\103\061\023\060\021\006\003\125\004\003\023\012\103\116\116\111
+\103\040\122\117\117\124\060\036\027\015\061\065\060\063\061\071
+\060\066\062\060\060\071\132\027\015\061\065\060\064\060\063\060
+\066\062\060\060\071\132\060\074\061\013\060\011\006\003\125\004
+\006\023\002\105\107\061\023\060\021\006\003\125\004\012\014\012
+\115\103\123\110\117\114\104\111\116\107\061\030\060\026\006\003
+\125\004\003\014\017\115\103\123\110\117\114\104\111\116\107\040
+\124\105\123\124\060\202\001\042\060\015\006\011\052\206\110\206
+\367\015\001\001\001\005\000\003\202\001\017\000\060\202\001\012
+\002\202\001\001\000\245\371\165\014\006\256\356\014\021\315\226
+\063\115\153\316\300\112\014\075\135\353\322\113\011\177\347\107
+\054\254\161\000\371\010\257\064\361\243\152\307\374\346\253\316
+\320\276\312\315\052\230\230\271\320\216\063\111\007\141\040\321
+\132\064\316\203\024\006\171\216\032\277\333\344\240\070\072\356
+\224\271\243\240\130\072\211\024\254\140\076\003\324\307\315\073
+\034\260\232\210\032\111\020\251\260\262\375\345\350\341\004\342
+\352\202\155\376\014\121\105\221\255\165\042\256\377\117\220\013
+\300\123\145\167\076\036\302\126\265\066\306\326\205\314\016\203
+\032\063\037\166\231\133\053\227\053\213\327\321\024\025\114\235
+\131\327\200\057\244\242\205\325\210\066\002\140\125\312\130\337
+\223\374\112\142\007\226\323\304\372\277\215\001\047\227\057\246
+\134\164\361\072\102\156\135\171\024\060\061\032\074\331\262\127
+\115\340\270\077\017\151\061\242\235\145\231\331\326\061\207\265
+\230\046\337\360\313\273\025\300\044\023\142\122\032\153\313\105
+\007\227\343\304\224\136\311\015\107\054\351\317\351\364\217\376
+\065\341\062\347\061\002\003\001\000\001\243\202\001\244\060\202
+\001\240\060\166\006\010\053\006\001\005\005\007\001\001\004\152
+\060\150\060\051\006\010\053\006\001\005\005\007\060\001\206\035
+\150\164\164\160\072\057\057\157\143\163\160\143\156\156\151\143
+\162\157\157\164\056\143\156\156\151\143\056\143\156\060\073\006
+\010\053\006\001\005\005\007\060\002\206\057\150\164\164\160\072
+\057\057\167\167\167\056\143\156\156\151\143\056\143\156\057\144
+\157\167\156\154\157\141\144\057\143\145\162\164\057\103\116\116
+\111\103\122\117\117\124\056\143\145\162\060\037\006\003\125\035
+\043\004\030\060\026\200\024\145\362\061\255\052\367\367\335\122
+\226\012\307\002\301\016\357\246\325\073\021\060\017\006\003\125
+\035\023\001\001\377\004\005\060\003\001\001\377\060\077\006\003
+\125\035\040\004\070\060\066\060\064\006\012\053\006\001\004\001
+\201\351\014\001\006\060\046\060\044\006\010\053\006\001\005\005
+\007\002\001\026\030\150\164\164\160\072\057\057\167\167\167\056
+\143\156\156\151\143\056\143\156\057\143\160\163\057\060\201\206
+\006\003\125\035\037\004\177\060\175\060\102\240\100\240\076\244
+\074\060\072\061\013\060\011\006\003\125\004\006\023\002\103\116
+\061\016\060\014\006\003\125\004\012\014\005\103\116\116\111\103
+\061\014\060\012\006\003\125\004\013\014\003\143\162\154\061\015
+\060\013\006\003\125\004\003\014\004\143\162\154\061\060\067\240
+\065\240\063\206\061\150\164\164\160\072\057\057\143\162\154\056
+\143\156\156\151\143\056\143\156\057\144\157\167\156\154\157\141
+\144\057\162\157\157\164\163\150\141\062\143\162\154\057\103\122
+\114\061\056\143\162\154\060\013\006\003\125\035\017\004\004\003
+\002\001\006\060\035\006\003\125\035\016\004\026\004\024\104\244
+\211\253\024\137\075\157\040\074\252\174\372\031\256\364\110\140
+\005\265\060\015\006\011\052\206\110\206\367\015\001\001\013\005
+\000\003\202\001\001\000\134\264\365\123\233\117\271\340\204\211
+\061\276\236\056\352\236\041\113\245\217\155\241\246\363\057\110
+\353\351\333\255\036\061\200\320\171\073\020\357\232\044\367\223
+\033\065\363\032\302\307\302\054\012\177\157\133\361\137\163\221
+\004\373\015\171\015\351\032\006\326\203\375\116\140\235\154\222
+\103\114\352\144\230\104\253\327\373\107\320\257\037\144\114\342
+\335\167\150\026\302\054\241\240\201\227\000\102\037\176\040\170
+\350\306\120\035\013\177\025\223\131\130\100\024\204\360\247\220
+\153\066\005\147\352\177\042\155\273\321\245\046\115\263\060\244
+\130\324\133\265\032\214\120\214\270\015\341\240\007\263\017\130
+\316\327\005\265\175\065\171\157\242\333\014\000\052\150\044\214
+\176\234\301\166\111\272\174\146\021\336\362\107\316\376\320\316
+\125\276\010\332\362\171\046\052\025\071\316\153\030\246\337\330
+\207\050\231\224\016\055\150\241\232\316\122\066\234\053\354\264
+\150\263\154\025\254\313\160\102\362\304\101\245\310\374\041\170
+\123\167\062\040\251\041\114\162\342\323\262\311\166\033\030\130
+\102\013\102\222\263\344
+END
+
+# Distrust "Explicitly Distrusted MCSHOLDING CA"
+# Issuer: CN=CNNIC ROOT,O=CNNIC,C=CN
+# Serial Number: 1228079246 (0x4933008e)
+# Subject: CN=MCSHOLDING TEST,O=MCSHOLDING,C=EG
+# Not Valid Before: Thu Mar 19 06:20:09 2015
+# Not Valid After : Fri Apr 03 06:20:09 2015
+# Fingerprint (SHA-256): 27:40:D9:56:B1:12:7B:79:1A:A1:B3:CC:64:4A:4D:BE:DB:A7:61:86:A2:36:38:B9:51:02:35:1A:83:4E:A8:61
+# Fingerprint (SHA1): E1:F3:59:1E:76:98:65:C4:E4:47:AC:C3:7E:AF:C9:E2:BF:E4:C5:76
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Explicitly Distrusted MCSHOLDING CA"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\341\363\131\036\166\230\145\304\344\107\254\303\176\257\311\342
+\277\344\305\166
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\366\212\253\024\076\326\060\045\267\111\015\167\205\160\231\313
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\062\061\013\060\011\006\003\125\004\006\023\002\103\116\061
+\016\060\014\006\003\125\004\012\023\005\103\116\116\111\103\061
+\023\060\021\006\003\125\004\003\023\012\103\116\116\111\103\040
+\122\117\117\124
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\004\111\063\000\216
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
# Certificate "TÜRKTRUST Elektronik Sertifika Hizmet Sağlayıcısı H5"
#
# Issuer: CN=T..RKTRUST Elektronik Sertifika Hizmet Sa..lay..c..s.. H5,O=T..RKTRUST Bilgi ..leti..im ve Bili..im G..venli..i Hizmetleri A....,L=Ankara,C=TR
@@ -18977,6 +24429,248 @@ CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
#
+# Certificate "Certification Authority of WoSign G2"
+#
+# Issuer: CN=Certification Authority of WoSign G2,O=WoSign CA Limited,C=CN
+# Serial Number:6b:25:da:8a:88:9d:7c:bc:0f:05:b3:b1:7a:61:45:44
+# Subject: CN=Certification Authority of WoSign G2,O=WoSign CA Limited,C=CN
+# Not Valid Before: Sat Nov 08 00:58:58 2014
+# Not Valid After : Tue Nov 08 00:58:58 2044
+# Fingerprint (SHA-256): D4:87:A5:6F:83:B0:74:82:E8:5E:96:33:94:C1:EC:C2:C9:E5:1D:09:03:EE:94:6B:02:C3:01:58:1E:D9:9E:16
+# Fingerprint (SHA1): FB:ED:DC:90:65:B7:27:20:37:BC:55:0C:9C:56:DE:BB:F2:78:94:E1
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Certification Authority of WoSign G2"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\130\061\013\060\011\006\003\125\004\006\023\002\103\116\061
+\032\060\030\006\003\125\004\012\023\021\127\157\123\151\147\156
+\040\103\101\040\114\151\155\151\164\145\144\061\055\060\053\006
+\003\125\004\003\023\044\103\145\162\164\151\146\151\143\141\164
+\151\157\156\040\101\165\164\150\157\162\151\164\171\040\157\146
+\040\127\157\123\151\147\156\040\107\062
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\130\061\013\060\011\006\003\125\004\006\023\002\103\116\061
+\032\060\030\006\003\125\004\012\023\021\127\157\123\151\147\156
+\040\103\101\040\114\151\155\151\164\145\144\061\055\060\053\006
+\003\125\004\003\023\044\103\145\162\164\151\146\151\143\141\164
+\151\157\156\040\101\165\164\150\157\162\151\164\171\040\157\146
+\040\127\157\123\151\147\156\040\107\062
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\020\153\045\332\212\210\235\174\274\017\005\263\261\172\141
+\105\104
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\003\174\060\202\002\144\240\003\002\001\002\002\020\153
+\045\332\212\210\235\174\274\017\005\263\261\172\141\105\104\060
+\015\006\011\052\206\110\206\367\015\001\001\013\005\000\060\130
+\061\013\060\011\006\003\125\004\006\023\002\103\116\061\032\060
+\030\006\003\125\004\012\023\021\127\157\123\151\147\156\040\103
+\101\040\114\151\155\151\164\145\144\061\055\060\053\006\003\125
+\004\003\023\044\103\145\162\164\151\146\151\143\141\164\151\157
+\156\040\101\165\164\150\157\162\151\164\171\040\157\146\040\127
+\157\123\151\147\156\040\107\062\060\036\027\015\061\064\061\061
+\060\070\060\060\065\070\065\070\132\027\015\064\064\061\061\060
+\070\060\060\065\070\065\070\132\060\130\061\013\060\011\006\003
+\125\004\006\023\002\103\116\061\032\060\030\006\003\125\004\012
+\023\021\127\157\123\151\147\156\040\103\101\040\114\151\155\151
+\164\145\144\061\055\060\053\006\003\125\004\003\023\044\103\145
+\162\164\151\146\151\143\141\164\151\157\156\040\101\165\164\150
+\157\162\151\164\171\040\157\146\040\127\157\123\151\147\156\040
+\107\062\060\202\001\042\060\015\006\011\052\206\110\206\367\015
+\001\001\001\005\000\003\202\001\017\000\060\202\001\012\002\202
+\001\001\000\276\305\304\240\042\200\111\117\277\331\207\021\306
+\123\341\273\017\275\140\177\257\366\202\016\037\334\260\216\075
+\227\340\120\074\217\072\357\146\073\105\007\233\040\370\343\327
+\045\206\065\220\026\242\135\157\060\031\010\207\013\177\006\262
+\235\142\217\336\257\222\245\140\324\053\200\232\122\077\365\232
+\203\351\064\132\313\331\325\142\134\346\016\340\337\006\230\016
+\200\174\312\264\035\023\210\153\016\250\044\167\003\320\356\133
+\363\312\151\221\065\071\126\305\155\343\367\075\117\136\223\070
+\044\312\030\351\044\313\222\003\335\314\034\075\011\160\344\040
+\344\361\256\254\273\163\151\243\143\072\017\105\017\241\112\232
+\302\321\143\254\313\020\370\075\346\116\050\267\353\304\225\261
+\254\375\136\253\372\101\313\135\235\113\334\364\174\166\357\147
+\177\000\172\215\322\240\032\134\115\042\341\265\332\335\166\263
+\324\166\337\136\270\213\230\310\024\124\314\153\027\222\267\340
+\112\277\111\224\141\013\070\220\217\135\044\154\045\173\073\171
+\331\342\176\235\255\237\230\241\006\374\170\024\140\127\370\356
+\200\167\261\002\003\001\000\001\243\102\060\100\060\016\006\003
+\125\035\017\001\001\377\004\004\003\002\001\006\060\017\006\003
+\125\035\023\001\001\377\004\005\060\003\001\001\377\060\035\006
+\003\125\035\016\004\026\004\024\372\140\251\353\145\305\335\026
+\024\010\116\014\017\215\233\340\367\144\257\147\060\015\006\011
+\052\206\110\206\367\015\001\001\013\005\000\003\202\001\001\000
+\127\303\172\066\202\234\215\230\342\253\100\252\107\217\307\247
+\133\355\174\347\075\146\132\073\061\273\337\363\026\063\221\374
+\174\173\245\302\246\146\343\252\260\267\047\230\077\111\327\140
+\147\147\077\066\117\112\313\361\024\372\132\207\050\034\355\217
+\101\062\306\225\371\175\332\275\173\133\302\260\041\343\217\106
+\334\041\070\103\164\114\373\060\370\027\162\301\062\374\310\221
+\027\304\314\130\067\116\013\314\132\367\041\065\050\203\154\140
+\055\104\353\122\214\120\075\265\154\022\327\372\011\273\154\262
+\112\261\305\211\344\374\323\122\330\141\027\376\172\224\204\217
+\171\266\063\131\272\017\304\013\342\160\240\113\170\056\372\310
+\237\375\257\221\145\012\170\070\025\345\227\027\024\335\371\340
+\054\064\370\070\320\204\042\000\300\024\121\030\053\002\334\060
+\132\360\350\001\174\065\072\043\257\010\344\257\252\216\050\102
+\111\056\360\365\231\064\276\355\017\113\030\341\322\044\074\273
+\135\107\267\041\362\215\321\012\231\216\343\156\076\255\160\340
+\217\271\312\314\156\201\061\366\173\234\172\171\344\147\161\030
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "Certification Authority of WoSign G2"
+# Issuer: CN=Certification Authority of WoSign G2,O=WoSign CA Limited,C=CN
+# Serial Number:6b:25:da:8a:88:9d:7c:bc:0f:05:b3:b1:7a:61:45:44
+# Subject: CN=Certification Authority of WoSign G2,O=WoSign CA Limited,C=CN
+# Not Valid Before: Sat Nov 08 00:58:58 2014
+# Not Valid After : Tue Nov 08 00:58:58 2044
+# Fingerprint (SHA-256): D4:87:A5:6F:83:B0:74:82:E8:5E:96:33:94:C1:EC:C2:C9:E5:1D:09:03:EE:94:6B:02:C3:01:58:1E:D9:9E:16
+# Fingerprint (SHA1): FB:ED:DC:90:65:B7:27:20:37:BC:55:0C:9C:56:DE:BB:F2:78:94:E1
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "Certification Authority of WoSign G2"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\373\355\334\220\145\267\047\040\067\274\125\014\234\126\336\273
+\362\170\224\341
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\310\034\175\031\252\313\161\223\362\120\370\122\250\036\272\140
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\130\061\013\060\011\006\003\125\004\006\023\002\103\116\061
+\032\060\030\006\003\125\004\012\023\021\127\157\123\151\147\156
+\040\103\101\040\114\151\155\151\164\145\144\061\055\060\053\006
+\003\125\004\003\023\044\103\145\162\164\151\146\151\143\141\164
+\151\157\156\040\101\165\164\150\157\162\151\164\171\040\157\146
+\040\127\157\123\151\147\156\040\107\062
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\020\153\045\332\212\210\235\174\274\017\005\263\261\172\141
+\105\104
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
+# Certificate "CA WoSign ECC Root"
+#
+# Issuer: CN=CA WoSign ECC Root,O=WoSign CA Limited,C=CN
+# Serial Number:68:4a:58:70:80:6b:f0:8f:02:fa:f6:de:e8:b0:90:90
+# Subject: CN=CA WoSign ECC Root,O=WoSign CA Limited,C=CN
+# Not Valid Before: Sat Nov 08 00:58:58 2014
+# Not Valid After : Tue Nov 08 00:58:58 2044
+# Fingerprint (SHA-256): 8B:45:DA:1C:06:F7:91:EB:0C:AB:F2:6B:E5:88:F5:FB:23:16:5C:2E:61:4B:F8:85:56:2D:0D:CE:50:B2:9B:02
+# Fingerprint (SHA1): D2:7A:D2:BE:ED:94:C0:A1:3C:C7:25:21:EA:5D:71:BE:81:19:F3:2B
+CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "CA WoSign ECC Root"
+CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
+CKA_SUBJECT MULTILINE_OCTAL
+\060\106\061\013\060\011\006\003\125\004\006\023\002\103\116\061
+\032\060\030\006\003\125\004\012\023\021\127\157\123\151\147\156
+\040\103\101\040\114\151\155\151\164\145\144\061\033\060\031\006
+\003\125\004\003\023\022\103\101\040\127\157\123\151\147\156\040
+\105\103\103\040\122\157\157\164
+END
+CKA_ID UTF8 "0"
+CKA_ISSUER MULTILINE_OCTAL
+\060\106\061\013\060\011\006\003\125\004\006\023\002\103\116\061
+\032\060\030\006\003\125\004\012\023\021\127\157\123\151\147\156
+\040\103\101\040\114\151\155\151\164\145\144\061\033\060\031\006
+\003\125\004\003\023\022\103\101\040\127\157\123\151\147\156\040
+\105\103\103\040\122\157\157\164
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\020\150\112\130\160\200\153\360\217\002\372\366\336\350\260
+\220\220
+END
+CKA_VALUE MULTILINE_OCTAL
+\060\202\002\011\060\202\001\217\240\003\002\001\002\002\020\150
+\112\130\160\200\153\360\217\002\372\366\336\350\260\220\220\060
+\012\006\010\052\206\110\316\075\004\003\003\060\106\061\013\060
+\011\006\003\125\004\006\023\002\103\116\061\032\060\030\006\003
+\125\004\012\023\021\127\157\123\151\147\156\040\103\101\040\114
+\151\155\151\164\145\144\061\033\060\031\006\003\125\004\003\023
+\022\103\101\040\127\157\123\151\147\156\040\105\103\103\040\122
+\157\157\164\060\036\027\015\061\064\061\061\060\070\060\060\065
+\070\065\070\132\027\015\064\064\061\061\060\070\060\060\065\070
+\065\070\132\060\106\061\013\060\011\006\003\125\004\006\023\002
+\103\116\061\032\060\030\006\003\125\004\012\023\021\127\157\123
+\151\147\156\040\103\101\040\114\151\155\151\164\145\144\061\033
+\060\031\006\003\125\004\003\023\022\103\101\040\127\157\123\151
+\147\156\040\105\103\103\040\122\157\157\164\060\166\060\020\006
+\007\052\206\110\316\075\002\001\006\005\053\201\004\000\042\003
+\142\000\004\341\375\216\270\103\044\253\226\173\205\302\272\013
+\255\215\340\072\343\044\271\322\261\276\210\072\312\277\112\270
+\371\357\054\057\257\121\120\074\107\165\154\370\224\267\233\374
+\050\036\305\124\314\143\235\026\113\123\301\347\040\253\315\254
+\045\322\177\217\302\301\132\202\136\060\213\172\124\316\003\265
+\221\177\252\224\320\321\212\110\314\202\005\046\241\325\121\022
+\326\173\066\243\102\060\100\060\016\006\003\125\035\017\001\001
+\377\004\004\003\002\001\006\060\017\006\003\125\035\023\001\001
+\377\004\005\060\003\001\001\377\060\035\006\003\125\035\016\004
+\026\004\024\252\375\325\132\243\366\207\213\062\205\375\321\062
+\133\200\105\223\363\003\270\060\012\006\010\052\206\110\316\075
+\004\003\003\003\150\000\060\145\002\061\000\344\244\204\260\201
+\325\075\260\164\254\224\244\350\016\075\000\164\114\241\227\153
+\371\015\121\074\241\331\073\364\015\253\251\237\276\116\162\312
+\205\324\331\354\265\062\105\030\157\253\255\002\060\175\307\367
+\151\143\057\241\341\230\357\023\020\321\171\077\321\376\352\073
+\177\336\126\364\220\261\025\021\330\262\042\025\320\057\303\046
+\056\153\361\221\262\220\145\364\232\346\220\356\112
+END
+CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
+
+# Trust for "CA WoSign ECC Root"
+# Issuer: CN=CA WoSign ECC Root,O=WoSign CA Limited,C=CN
+# Serial Number:68:4a:58:70:80:6b:f0:8f:02:fa:f6:de:e8:b0:90:90
+# Subject: CN=CA WoSign ECC Root,O=WoSign CA Limited,C=CN
+# Not Valid Before: Sat Nov 08 00:58:58 2014
+# Not Valid After : Tue Nov 08 00:58:58 2044
+# Fingerprint (SHA-256): 8B:45:DA:1C:06:F7:91:EB:0C:AB:F2:6B:E5:88:F5:FB:23:16:5C:2E:61:4B:F8:85:56:2D:0D:CE:50:B2:9B:02
+# Fingerprint (SHA1): D2:7A:D2:BE:ED:94:C0:A1:3C:C7:25:21:EA:5D:71:BE:81:19:F3:2B
+CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
+CKA_TOKEN CK_BBOOL CK_TRUE
+CKA_PRIVATE CK_BBOOL CK_FALSE
+CKA_MODIFIABLE CK_BBOOL CK_FALSE
+CKA_LABEL UTF8 "CA WoSign ECC Root"
+CKA_CERT_SHA1_HASH MULTILINE_OCTAL
+\322\172\322\276\355\224\300\241\074\307\045\041\352\135\161\276
+\201\031\363\053
+END
+CKA_CERT_MD5_HASH MULTILINE_OCTAL
+\200\306\123\356\141\202\050\162\360\377\041\271\027\312\262\040
+END
+CKA_ISSUER MULTILINE_OCTAL
+\060\106\061\013\060\011\006\003\125\004\006\023\002\103\116\061
+\032\060\030\006\003\125\004\012\023\021\127\157\123\151\147\156
+\040\103\101\040\114\151\155\151\164\145\144\061\033\060\031\006
+\003\125\004\003\023\022\103\101\040\127\157\123\151\147\156\040
+\105\103\103\040\122\157\157\164
+END
+CKA_SERIAL_NUMBER MULTILINE_OCTAL
+\002\020\150\112\130\160\200\153\360\217\002\372\366\336\350\260
+\220\220
+END
+CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
+CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
+CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
+
+#
# Certificate "SZAFIR ROOT CA2"
#
# Issuer: CN=SZAFIR ROOT CA2,O=Krajowa Izba Rozliczeniowa S.A.,C=PL
@@ -22179,1284 +27873,3 @@ CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-
-#
-# Certificate "GDCA TrustAUTH R5 ROOT"
-#
-# Issuer: CN=GDCA TrustAUTH R5 ROOT,O="GUANG DONG CERTIFICATE AUTHORITY CO.,LTD.",C=CN
-# Serial Number:7d:09:97:fe:f0:47:ea:7a
-# Subject: CN=GDCA TrustAUTH R5 ROOT,O="GUANG DONG CERTIFICATE AUTHORITY CO.,LTD.",C=CN
-# Not Valid Before: Wed Nov 26 05:13:15 2014
-# Not Valid After : Mon Dec 31 15:59:59 2040
-# Fingerprint (SHA-256): BF:FF:8F:D0:44:33:48:7D:6A:8A:A6:0C:1A:29:76:7A:9F:C2:BB:B0:5E:42:0F:71:3A:13:B9:92:89:1D:38:93
-# Fingerprint (SHA1): 0F:36:38:5B:81:1A:25:C3:9B:31:4E:83:CA:E9:34:66:70:CC:74:B4
-CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "GDCA TrustAUTH R5 ROOT"
-CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
-CKA_SUBJECT MULTILINE_OCTAL
-\060\142\061\013\060\011\006\003\125\004\006\023\002\103\116\061
-\062\060\060\006\003\125\004\012\014\051\107\125\101\116\107\040
-\104\117\116\107\040\103\105\122\124\111\106\111\103\101\124\105
-\040\101\125\124\110\117\122\111\124\131\040\103\117\056\054\114
-\124\104\056\061\037\060\035\006\003\125\004\003\014\026\107\104
-\103\101\040\124\162\165\163\164\101\125\124\110\040\122\065\040
-\122\117\117\124
-END
-CKA_ID UTF8 "0"
-CKA_ISSUER MULTILINE_OCTAL
-\060\142\061\013\060\011\006\003\125\004\006\023\002\103\116\061
-\062\060\060\006\003\125\004\012\014\051\107\125\101\116\107\040
-\104\117\116\107\040\103\105\122\124\111\106\111\103\101\124\105
-\040\101\125\124\110\117\122\111\124\131\040\103\117\056\054\114
-\124\104\056\061\037\060\035\006\003\125\004\003\014\026\107\104
-\103\101\040\124\162\165\163\164\101\125\124\110\040\122\065\040
-\122\117\117\124
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\010\175\011\227\376\360\107\352\172
-END
-CKA_VALUE MULTILINE_OCTAL
-\060\202\005\210\060\202\003\160\240\003\002\001\002\002\010\175
-\011\227\376\360\107\352\172\060\015\006\011\052\206\110\206\367
-\015\001\001\013\005\000\060\142\061\013\060\011\006\003\125\004
-\006\023\002\103\116\061\062\060\060\006\003\125\004\012\014\051
-\107\125\101\116\107\040\104\117\116\107\040\103\105\122\124\111
-\106\111\103\101\124\105\040\101\125\124\110\117\122\111\124\131
-\040\103\117\056\054\114\124\104\056\061\037\060\035\006\003\125
-\004\003\014\026\107\104\103\101\040\124\162\165\163\164\101\125
-\124\110\040\122\065\040\122\117\117\124\060\036\027\015\061\064
-\061\061\062\066\060\065\061\063\061\065\132\027\015\064\060\061
-\062\063\061\061\065\065\071\065\071\132\060\142\061\013\060\011
-\006\003\125\004\006\023\002\103\116\061\062\060\060\006\003\125
-\004\012\014\051\107\125\101\116\107\040\104\117\116\107\040\103
-\105\122\124\111\106\111\103\101\124\105\040\101\125\124\110\117
-\122\111\124\131\040\103\117\056\054\114\124\104\056\061\037\060
-\035\006\003\125\004\003\014\026\107\104\103\101\040\124\162\165
-\163\164\101\125\124\110\040\122\065\040\122\117\117\124\060\202
-\002\042\060\015\006\011\052\206\110\206\367\015\001\001\001\005
-\000\003\202\002\017\000\060\202\002\012\002\202\002\001\000\331
-\243\026\360\310\164\164\167\233\357\063\015\073\006\176\125\374
-\265\140\217\166\206\022\102\175\126\146\076\210\202\355\162\143
-\016\236\213\335\064\054\002\121\121\303\031\375\131\124\204\311
-\361\153\263\114\260\351\350\106\135\070\306\242\247\056\021\127
-\272\202\025\242\234\217\155\260\231\112\012\362\353\211\160\143
-\116\171\304\267\133\275\242\135\261\362\101\002\053\255\251\072
-\243\354\171\012\354\137\072\343\375\357\200\074\255\064\233\032
-\253\210\046\173\126\242\202\206\037\353\065\211\203\177\137\256
-\051\116\075\266\156\354\256\301\360\047\233\256\343\364\354\357
-\256\177\367\206\075\162\172\353\245\373\131\116\247\353\225\214
-\042\071\171\341\055\010\217\314\274\221\270\101\367\024\301\043
-\251\303\255\232\105\104\263\262\327\054\315\306\051\342\120\020
-\256\134\313\202\216\027\030\066\175\227\346\210\232\260\115\064
-\011\364\054\271\132\146\052\260\027\233\236\036\166\235\112\146
-\061\101\337\077\373\305\006\357\033\266\176\032\106\066\367\144
-\143\073\343\071\030\043\347\147\165\024\325\165\127\222\067\275
-\276\152\033\046\120\362\066\046\006\220\305\160\001\144\155\166
-\146\341\221\333\156\007\300\141\200\056\262\056\057\214\160\247
-\321\073\074\263\221\344\156\266\304\073\160\362\154\222\227\011
-\315\107\175\030\300\363\273\236\017\326\213\256\007\266\132\017
-\316\013\014\107\247\345\076\270\275\175\307\233\065\240\141\227
-\072\101\165\027\314\053\226\167\052\222\041\036\331\225\166\040
-\147\150\317\015\275\337\326\037\011\152\232\342\314\163\161\244
-\057\175\022\200\267\123\060\106\136\113\124\231\017\147\311\245
-\310\362\040\301\202\354\235\021\337\302\002\373\032\073\321\355
-\040\232\357\145\144\222\020\015\052\342\336\160\361\030\147\202
-\214\141\336\270\274\321\057\234\373\017\320\053\355\033\166\271
-\344\071\125\370\370\241\035\270\252\200\000\114\202\347\262\177
-\011\270\274\060\240\057\015\365\122\236\216\367\222\263\012\000
-\035\000\124\227\006\340\261\007\331\307\017\134\145\175\074\155
-\131\127\344\355\245\215\351\100\123\237\025\113\240\161\366\032
-\041\343\332\160\006\041\130\024\207\205\167\171\252\202\171\002
-\003\001\000\001\243\102\060\100\060\035\006\003\125\035\016\004
-\026\004\024\342\311\100\237\115\316\350\232\241\174\317\016\077
-\145\305\051\210\152\031\121\060\017\006\003\125\035\023\001\001
-\377\004\005\060\003\001\001\377\060\016\006\003\125\035\017\001
-\001\377\004\004\003\002\001\206\060\015\006\011\052\206\110\206
-\367\015\001\001\013\005\000\003\202\002\001\000\321\111\127\340
-\247\314\150\130\272\001\017\053\031\315\215\260\141\105\254\021
-\355\143\120\151\370\037\177\276\026\217\375\235\353\013\252\062
-\107\166\322\147\044\355\275\174\063\062\227\052\307\005\206\146
-\015\027\175\024\025\033\324\353\375\037\232\366\136\227\151\267
-\032\045\244\012\263\221\077\137\066\254\213\354\127\250\076\347
-\201\212\030\127\071\205\164\032\102\307\351\133\023\137\217\371
-\010\351\222\164\215\365\107\322\253\073\326\373\170\146\116\066
-\175\371\351\222\351\004\336\375\111\143\374\155\373\024\161\223
-\147\057\107\112\267\271\377\036\052\163\160\106\060\277\132\362
-\057\171\245\341\215\014\331\371\262\143\067\214\067\145\205\160
-\152\134\133\011\162\271\255\143\074\261\335\370\374\062\277\067
-\206\344\273\216\230\047\176\272\037\026\341\160\021\362\003\337
-\045\142\062\047\046\030\062\204\237\377\000\072\023\272\232\115
-\364\117\270\024\160\042\261\312\053\220\316\051\301\160\364\057
-\235\177\362\220\036\326\132\337\267\106\374\346\206\372\313\340
-\040\166\172\272\246\313\365\174\336\142\245\261\213\356\336\202
-\146\212\116\072\060\037\077\200\313\255\047\272\014\136\327\320
-\261\126\312\167\161\262\265\165\241\120\251\100\103\027\302\050
-\331\317\122\213\133\310\143\324\102\076\240\063\172\106\056\367
-\012\040\106\124\176\152\117\061\361\201\176\102\164\070\145\163
-\047\356\306\174\270\216\327\245\072\327\230\241\234\214\020\125
-\323\333\113\354\100\220\362\315\156\127\322\142\016\174\127\223
-\261\247\155\315\235\203\273\052\347\345\266\073\161\130\255\375
-\321\105\274\132\221\356\123\025\157\323\105\011\165\156\272\220
-\135\036\004\317\067\337\036\250\146\261\214\346\040\152\357\374
-\110\116\164\230\102\257\051\157\056\152\307\373\175\321\146\061
-\042\314\206\000\176\146\203\014\102\364\275\064\222\303\032\352
-\117\312\176\162\115\013\160\214\246\110\273\246\241\024\366\373
-\130\104\231\024\256\252\013\223\151\240\051\045\112\245\313\053
-\335\212\146\007\026\170\025\127\161\033\354\365\107\204\363\236
-\061\067\172\325\177\044\255\344\274\375\375\314\156\203\350\014
-\250\267\101\154\007\335\275\074\206\227\057\322
-END
-CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
-
-# Trust for "GDCA TrustAUTH R5 ROOT"
-# Issuer: CN=GDCA TrustAUTH R5 ROOT,O="GUANG DONG CERTIFICATE AUTHORITY CO.,LTD.",C=CN
-# Serial Number:7d:09:97:fe:f0:47:ea:7a
-# Subject: CN=GDCA TrustAUTH R5 ROOT,O="GUANG DONG CERTIFICATE AUTHORITY CO.,LTD.",C=CN
-# Not Valid Before: Wed Nov 26 05:13:15 2014
-# Not Valid After : Mon Dec 31 15:59:59 2040
-# Fingerprint (SHA-256): BF:FF:8F:D0:44:33:48:7D:6A:8A:A6:0C:1A:29:76:7A:9F:C2:BB:B0:5E:42:0F:71:3A:13:B9:92:89:1D:38:93
-# Fingerprint (SHA1): 0F:36:38:5B:81:1A:25:C3:9B:31:4E:83:CA:E9:34:66:70:CC:74:B4
-CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "GDCA TrustAUTH R5 ROOT"
-CKA_CERT_SHA1_HASH MULTILINE_OCTAL
-\017\066\070\133\201\032\045\303\233\061\116\203\312\351\064\146
-\160\314\164\264
-END
-CKA_CERT_MD5_HASH MULTILINE_OCTAL
-\143\314\331\075\064\065\134\157\123\243\342\010\160\110\037\264
-END
-CKA_ISSUER MULTILINE_OCTAL
-\060\142\061\013\060\011\006\003\125\004\006\023\002\103\116\061
-\062\060\060\006\003\125\004\012\014\051\107\125\101\116\107\040
-\104\117\116\107\040\103\105\122\124\111\106\111\103\101\124\105
-\040\101\125\124\110\117\122\111\124\131\040\103\117\056\054\114
-\124\104\056\061\037\060\035\006\003\125\004\003\014\026\107\104
-\103\101\040\124\162\165\163\164\101\125\124\110\040\122\065\040
-\122\117\117\124
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\010\175\011\227\376\360\107\352\172
-END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-
-#
-# Certificate "TrustCor RootCert CA-1"
-#
-# Issuer: CN=TrustCor RootCert CA-1,OU=TrustCor Certificate Authority,O=TrustCor Systems S. de R.L.,L=Panama City,ST=Panama,C=PA
-# Serial Number:00:da:9b:ec:71:f3:03:b0:19
-# Subject: CN=TrustCor RootCert CA-1,OU=TrustCor Certificate Authority,O=TrustCor Systems S. de R.L.,L=Panama City,ST=Panama,C=PA
-# Not Valid Before: Thu Feb 04 12:32:16 2016
-# Not Valid After : Mon Dec 31 17:23:16 2029
-# Fingerprint (SHA-256): D4:0E:9C:86:CD:8F:E4:68:C1:77:69:59:F4:9E:A7:74:FA:54:86:84:B6:C4:06:F3:90:92:61:F4:DC:E2:57:5C
-# Fingerprint (SHA1): FF:BD:CD:E7:82:C8:43:5E:3C:6F:26:86:5C:CA:A8:3A:45:5B:C3:0A
-CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "TrustCor RootCert CA-1"
-CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
-CKA_SUBJECT MULTILINE_OCTAL
-\060\201\244\061\013\060\011\006\003\125\004\006\023\002\120\101
-\061\017\060\015\006\003\125\004\010\014\006\120\141\156\141\155
-\141\061\024\060\022\006\003\125\004\007\014\013\120\141\156\141
-\155\141\040\103\151\164\171\061\044\060\042\006\003\125\004\012
-\014\033\124\162\165\163\164\103\157\162\040\123\171\163\164\145
-\155\163\040\123\056\040\144\145\040\122\056\114\056\061\047\060
-\045\006\003\125\004\013\014\036\124\162\165\163\164\103\157\162
-\040\103\145\162\164\151\146\151\143\141\164\145\040\101\165\164
-\150\157\162\151\164\171\061\037\060\035\006\003\125\004\003\014
-\026\124\162\165\163\164\103\157\162\040\122\157\157\164\103\145
-\162\164\040\103\101\055\061
-END
-CKA_ID UTF8 "0"
-CKA_ISSUER MULTILINE_OCTAL
-\060\201\244\061\013\060\011\006\003\125\004\006\023\002\120\101
-\061\017\060\015\006\003\125\004\010\014\006\120\141\156\141\155
-\141\061\024\060\022\006\003\125\004\007\014\013\120\141\156\141
-\155\141\040\103\151\164\171\061\044\060\042\006\003\125\004\012
-\014\033\124\162\165\163\164\103\157\162\040\123\171\163\164\145
-\155\163\040\123\056\040\144\145\040\122\056\114\056\061\047\060
-\045\006\003\125\004\013\014\036\124\162\165\163\164\103\157\162
-\040\103\145\162\164\151\146\151\143\141\164\145\040\101\165\164
-\150\157\162\151\164\171\061\037\060\035\006\003\125\004\003\014
-\026\124\162\165\163\164\103\157\162\040\122\157\157\164\103\145
-\162\164\040\103\101\055\061
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\011\000\332\233\354\161\363\003\260\031
-END
-CKA_VALUE MULTILINE_OCTAL
-\060\202\004\060\060\202\003\030\240\003\002\001\002\002\011\000
-\332\233\354\161\363\003\260\031\060\015\006\011\052\206\110\206
-\367\015\001\001\013\005\000\060\201\244\061\013\060\011\006\003
-\125\004\006\023\002\120\101\061\017\060\015\006\003\125\004\010
-\014\006\120\141\156\141\155\141\061\024\060\022\006\003\125\004
-\007\014\013\120\141\156\141\155\141\040\103\151\164\171\061\044
-\060\042\006\003\125\004\012\014\033\124\162\165\163\164\103\157
-\162\040\123\171\163\164\145\155\163\040\123\056\040\144\145\040
-\122\056\114\056\061\047\060\045\006\003\125\004\013\014\036\124
-\162\165\163\164\103\157\162\040\103\145\162\164\151\146\151\143
-\141\164\145\040\101\165\164\150\157\162\151\164\171\061\037\060
-\035\006\003\125\004\003\014\026\124\162\165\163\164\103\157\162
-\040\122\157\157\164\103\145\162\164\040\103\101\055\061\060\036
-\027\015\061\066\060\062\060\064\061\062\063\062\061\066\132\027
-\015\062\071\061\062\063\061\061\067\062\063\061\066\132\060\201
-\244\061\013\060\011\006\003\125\004\006\023\002\120\101\061\017
-\060\015\006\003\125\004\010\014\006\120\141\156\141\155\141\061
-\024\060\022\006\003\125\004\007\014\013\120\141\156\141\155\141
-\040\103\151\164\171\061\044\060\042\006\003\125\004\012\014\033
-\124\162\165\163\164\103\157\162\040\123\171\163\164\145\155\163
-\040\123\056\040\144\145\040\122\056\114\056\061\047\060\045\006
-\003\125\004\013\014\036\124\162\165\163\164\103\157\162\040\103
-\145\162\164\151\146\151\143\141\164\145\040\101\165\164\150\157
-\162\151\164\171\061\037\060\035\006\003\125\004\003\014\026\124
-\162\165\163\164\103\157\162\040\122\157\157\164\103\145\162\164
-\040\103\101\055\061\060\202\001\042\060\015\006\011\052\206\110
-\206\367\015\001\001\001\005\000\003\202\001\017\000\060\202\001
-\012\002\202\001\001\000\277\216\267\225\342\302\046\022\153\063
-\031\307\100\130\012\253\131\252\215\000\243\374\200\307\120\173
-\216\324\040\046\272\062\022\330\043\124\111\045\020\042\230\235
-\106\322\301\311\236\116\033\056\054\016\070\363\032\045\150\034
-\246\132\005\346\036\213\110\277\230\226\164\076\151\312\351\265
-\170\245\006\274\325\000\136\011\012\362\047\172\122\374\055\325
-\261\352\264\211\141\044\363\032\023\333\251\317\122\355\014\044
-\272\271\236\354\176\000\164\372\223\255\154\051\222\256\121\264
-\273\323\127\277\263\363\250\215\234\364\044\113\052\326\231\236
-\364\236\376\300\176\102\072\347\013\225\123\332\267\150\016\220
-\114\373\160\077\217\112\054\224\363\046\335\143\151\251\224\330
-\020\116\305\107\010\220\231\033\027\115\271\154\156\357\140\225
-\021\216\041\200\265\275\240\163\330\320\262\167\304\105\352\132
-\046\373\146\166\166\370\006\037\141\155\017\125\305\203\267\020
-\126\162\006\007\245\363\261\032\003\005\144\016\235\132\212\326
-\206\160\033\044\336\376\050\212\053\320\152\260\374\172\242\334
-\262\171\016\213\145\017\002\003\001\000\001\243\143\060\141\060
-\035\006\003\125\035\016\004\026\004\024\356\153\111\074\172\077
-\015\343\261\011\267\212\310\253\031\237\163\063\120\347\060\037
-\006\003\125\035\043\004\030\060\026\200\024\356\153\111\074\172
-\077\015\343\261\011\267\212\310\253\031\237\163\063\120\347\060
-\017\006\003\125\035\023\001\001\377\004\005\060\003\001\001\377
-\060\016\006\003\125\035\017\001\001\377\004\004\003\002\001\206
-\060\015\006\011\052\206\110\206\367\015\001\001\013\005\000\003
-\202\001\001\000\045\030\324\221\217\023\356\217\036\035\021\123
-\332\055\104\051\031\240\036\153\061\236\115\016\236\255\075\134
-\101\157\225\053\044\241\171\230\072\070\066\373\273\146\236\110
-\377\220\220\357\075\324\270\233\264\207\165\077\040\233\316\162
-\317\241\125\301\115\144\242\031\006\241\007\063\014\013\051\345
-\361\352\253\243\354\265\012\164\220\307\175\162\362\327\134\237
-\221\357\221\213\267\334\355\146\242\317\216\146\073\274\237\072
-\002\340\047\335\026\230\300\225\324\012\244\344\201\232\165\224
-\065\234\220\137\210\067\006\255\131\225\012\260\321\147\323\031
-\312\211\347\062\132\066\034\076\202\250\132\223\276\306\320\144
-\221\266\317\331\266\030\317\333\176\322\145\243\246\304\216\027
-\061\301\373\176\166\333\323\205\343\130\262\167\172\166\073\154
-\057\120\034\347\333\366\147\171\037\365\202\225\232\007\247\024
-\257\217\334\050\041\147\011\322\326\115\132\034\031\034\216\167
-\134\303\224\044\075\062\153\113\176\324\170\224\203\276\067\115
-\316\137\307\036\116\074\340\211\063\225\013\017\245\062\326\074
-\132\171\054\031
-END
-CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
-
-# Trust for "TrustCor RootCert CA-1"
-# Issuer: CN=TrustCor RootCert CA-1,OU=TrustCor Certificate Authority,O=TrustCor Systems S. de R.L.,L=Panama City,ST=Panama,C=PA
-# Serial Number:00:da:9b:ec:71:f3:03:b0:19
-# Subject: CN=TrustCor RootCert CA-1,OU=TrustCor Certificate Authority,O=TrustCor Systems S. de R.L.,L=Panama City,ST=Panama,C=PA
-# Not Valid Before: Thu Feb 04 12:32:16 2016
-# Not Valid After : Mon Dec 31 17:23:16 2029
-# Fingerprint (SHA-256): D4:0E:9C:86:CD:8F:E4:68:C1:77:69:59:F4:9E:A7:74:FA:54:86:84:B6:C4:06:F3:90:92:61:F4:DC:E2:57:5C
-# Fingerprint (SHA1): FF:BD:CD:E7:82:C8:43:5E:3C:6F:26:86:5C:CA:A8:3A:45:5B:C3:0A
-CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "TrustCor RootCert CA-1"
-CKA_CERT_SHA1_HASH MULTILINE_OCTAL
-\377\275\315\347\202\310\103\136\074\157\046\206\134\312\250\072
-\105\133\303\012
-END
-CKA_CERT_MD5_HASH MULTILINE_OCTAL
-\156\205\361\334\032\000\323\042\325\262\262\254\153\067\005\105
-END
-CKA_ISSUER MULTILINE_OCTAL
-\060\201\244\061\013\060\011\006\003\125\004\006\023\002\120\101
-\061\017\060\015\006\003\125\004\010\014\006\120\141\156\141\155
-\141\061\024\060\022\006\003\125\004\007\014\013\120\141\156\141
-\155\141\040\103\151\164\171\061\044\060\042\006\003\125\004\012
-\014\033\124\162\165\163\164\103\157\162\040\123\171\163\164\145
-\155\163\040\123\056\040\144\145\040\122\056\114\056\061\047\060
-\045\006\003\125\004\013\014\036\124\162\165\163\164\103\157\162
-\040\103\145\162\164\151\146\151\143\141\164\145\040\101\165\164
-\150\157\162\151\164\171\061\037\060\035\006\003\125\004\003\014
-\026\124\162\165\163\164\103\157\162\040\122\157\157\164\103\145
-\162\164\040\103\101\055\061
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\011\000\332\233\354\161\363\003\260\031
-END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-
-#
-# Certificate "TrustCor RootCert CA-2"
-#
-# Issuer: CN=TrustCor RootCert CA-2,OU=TrustCor Certificate Authority,O=TrustCor Systems S. de R.L.,L=Panama City,ST=Panama,C=PA
-# Serial Number:25:a1:df:ca:33:cb:59:02
-# Subject: CN=TrustCor RootCert CA-2,OU=TrustCor Certificate Authority,O=TrustCor Systems S. de R.L.,L=Panama City,ST=Panama,C=PA
-# Not Valid Before: Thu Feb 04 12:32:23 2016
-# Not Valid After : Sun Dec 31 17:26:39 2034
-# Fingerprint (SHA-256): 07:53:E9:40:37:8C:1B:D5:E3:83:6E:39:5D:AE:A5:CB:83:9E:50:46:F1:BD:0E:AE:19:51:CF:10:FE:C7:C9:65
-# Fingerprint (SHA1): B8:BE:6D:CB:56:F1:55:B9:63:D4:12:CA:4E:06:34:C7:94:B2:1C:C0
-CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "TrustCor RootCert CA-2"
-CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
-CKA_SUBJECT MULTILINE_OCTAL
-\060\201\244\061\013\060\011\006\003\125\004\006\023\002\120\101
-\061\017\060\015\006\003\125\004\010\014\006\120\141\156\141\155
-\141\061\024\060\022\006\003\125\004\007\014\013\120\141\156\141
-\155\141\040\103\151\164\171\061\044\060\042\006\003\125\004\012
-\014\033\124\162\165\163\164\103\157\162\040\123\171\163\164\145
-\155\163\040\123\056\040\144\145\040\122\056\114\056\061\047\060
-\045\006\003\125\004\013\014\036\124\162\165\163\164\103\157\162
-\040\103\145\162\164\151\146\151\143\141\164\145\040\101\165\164
-\150\157\162\151\164\171\061\037\060\035\006\003\125\004\003\014
-\026\124\162\165\163\164\103\157\162\040\122\157\157\164\103\145
-\162\164\040\103\101\055\062
-END
-CKA_ID UTF8 "0"
-CKA_ISSUER MULTILINE_OCTAL
-\060\201\244\061\013\060\011\006\003\125\004\006\023\002\120\101
-\061\017\060\015\006\003\125\004\010\014\006\120\141\156\141\155
-\141\061\024\060\022\006\003\125\004\007\014\013\120\141\156\141
-\155\141\040\103\151\164\171\061\044\060\042\006\003\125\004\012
-\014\033\124\162\165\163\164\103\157\162\040\123\171\163\164\145
-\155\163\040\123\056\040\144\145\040\122\056\114\056\061\047\060
-\045\006\003\125\004\013\014\036\124\162\165\163\164\103\157\162
-\040\103\145\162\164\151\146\151\143\141\164\145\040\101\165\164
-\150\157\162\151\164\171\061\037\060\035\006\003\125\004\003\014
-\026\124\162\165\163\164\103\157\162\040\122\157\157\164\103\145
-\162\164\040\103\101\055\062
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\010\045\241\337\312\063\313\131\002
-END
-CKA_VALUE MULTILINE_OCTAL
-\060\202\006\057\060\202\004\027\240\003\002\001\002\002\010\045
-\241\337\312\063\313\131\002\060\015\006\011\052\206\110\206\367
-\015\001\001\013\005\000\060\201\244\061\013\060\011\006\003\125
-\004\006\023\002\120\101\061\017\060\015\006\003\125\004\010\014
-\006\120\141\156\141\155\141\061\024\060\022\006\003\125\004\007
-\014\013\120\141\156\141\155\141\040\103\151\164\171\061\044\060
-\042\006\003\125\004\012\014\033\124\162\165\163\164\103\157\162
-\040\123\171\163\164\145\155\163\040\123\056\040\144\145\040\122
-\056\114\056\061\047\060\045\006\003\125\004\013\014\036\124\162
-\165\163\164\103\157\162\040\103\145\162\164\151\146\151\143\141
-\164\145\040\101\165\164\150\157\162\151\164\171\061\037\060\035
-\006\003\125\004\003\014\026\124\162\165\163\164\103\157\162\040
-\122\157\157\164\103\145\162\164\040\103\101\055\062\060\036\027
-\015\061\066\060\062\060\064\061\062\063\062\062\063\132\027\015
-\063\064\061\062\063\061\061\067\062\066\063\071\132\060\201\244
-\061\013\060\011\006\003\125\004\006\023\002\120\101\061\017\060
-\015\006\003\125\004\010\014\006\120\141\156\141\155\141\061\024
-\060\022\006\003\125\004\007\014\013\120\141\156\141\155\141\040
-\103\151\164\171\061\044\060\042\006\003\125\004\012\014\033\124
-\162\165\163\164\103\157\162\040\123\171\163\164\145\155\163\040
-\123\056\040\144\145\040\122\056\114\056\061\047\060\045\006\003
-\125\004\013\014\036\124\162\165\163\164\103\157\162\040\103\145
-\162\164\151\146\151\143\141\164\145\040\101\165\164\150\157\162
-\151\164\171\061\037\060\035\006\003\125\004\003\014\026\124\162
-\165\163\164\103\157\162\040\122\157\157\164\103\145\162\164\040
-\103\101\055\062\060\202\002\042\060\015\006\011\052\206\110\206
-\367\015\001\001\001\005\000\003\202\002\017\000\060\202\002\012
-\002\202\002\001\000\247\040\156\302\052\242\142\044\225\220\166
-\310\070\176\200\322\253\301\233\145\005\224\364\301\012\020\325
-\002\254\355\237\223\307\207\310\260\047\053\102\014\075\012\076
-\101\132\236\165\335\215\312\340\233\354\150\062\244\151\222\150
-\214\013\201\016\126\240\076\032\335\054\045\024\202\057\227\323
-\144\106\364\124\251\334\072\124\055\061\053\231\202\362\331\052
-\327\357\161\000\270\061\244\276\172\044\007\303\102\040\362\212
-\324\222\004\033\145\126\114\154\324\373\266\141\132\107\043\264
-\330\151\264\267\072\320\164\074\014\165\241\214\116\166\241\351
-\333\052\245\073\372\316\260\377\176\152\050\375\047\034\310\261
-\351\051\361\127\156\144\264\320\301\025\155\016\276\056\016\106
-\310\136\364\121\376\357\016\143\072\073\161\272\317\157\131\312
-\014\343\233\135\111\270\114\342\127\261\230\212\102\127\234\166
-\357\357\275\321\150\250\322\364\011\273\167\065\276\045\202\010
-\304\026\054\104\040\126\251\104\021\167\357\135\264\035\252\136
-\153\076\213\062\366\007\057\127\004\222\312\365\376\235\302\351
-\350\263\216\114\113\002\061\331\344\074\110\202\047\367\030\202
-\166\110\072\161\261\023\241\071\325\056\305\064\302\035\142\205
-\337\003\376\115\364\257\075\337\134\133\215\372\160\341\245\176
-\047\307\206\056\152\217\022\306\204\136\103\121\120\234\031\233
-\170\346\374\366\355\107\176\173\075\146\357\023\023\210\137\074
-\241\143\373\371\254\207\065\237\363\202\236\244\077\012\234\061
-\151\213\231\244\210\112\216\156\146\115\357\026\304\017\171\050
-\041\140\015\205\026\175\327\124\070\361\222\126\375\265\063\114
-\203\334\327\020\237\113\375\306\370\102\275\272\174\163\002\340
-\377\175\315\133\341\324\254\141\173\127\325\112\173\133\324\205
-\130\047\135\277\370\053\140\254\240\046\256\024\041\047\306\167
-\232\063\200\074\136\106\077\367\303\261\243\206\063\306\350\136
-\015\271\065\054\252\106\301\205\002\165\200\240\353\044\373\025
-\252\344\147\177\156\167\077\364\004\212\057\174\173\343\027\141
-\360\335\011\251\040\310\276\011\244\320\176\104\303\262\060\112
-\070\252\251\354\030\232\007\202\053\333\270\234\030\255\332\340
-\106\027\254\317\135\002\003\001\000\001\243\143\060\141\060\035
-\006\003\125\035\016\004\026\004\024\331\376\041\100\156\224\236
-\274\233\075\234\175\230\040\031\345\214\060\142\262\060\037\006
-\003\125\035\043\004\030\060\026\200\024\331\376\041\100\156\224
-\236\274\233\075\234\175\230\040\031\345\214\060\142\262\060\017
-\006\003\125\035\023\001\001\377\004\005\060\003\001\001\377\060
-\016\006\003\125\035\017\001\001\377\004\004\003\002\001\206\060
-\015\006\011\052\206\110\206\367\015\001\001\013\005\000\003\202
-\002\001\000\236\105\236\014\073\266\357\341\072\310\174\321\000
-\075\317\342\352\006\265\262\072\273\006\113\150\172\320\043\227
-\164\247\054\360\010\330\171\132\327\132\204\212\330\022\232\033
-\331\175\134\115\160\305\245\371\253\345\243\211\211\335\001\372
-\354\335\371\351\222\227\333\260\106\102\363\323\142\252\225\376
-\061\147\024\151\130\220\012\252\013\356\067\043\307\120\121\264
-\365\176\236\343\173\367\344\314\102\062\055\111\014\313\377\111
-\014\233\036\064\375\156\156\226\212\171\003\266\157\333\011\313
-\375\137\145\024\067\341\070\365\363\141\026\130\344\265\155\015
-\013\004\033\077\120\055\177\263\307\172\032\026\200\140\370\212
-\037\351\033\052\306\371\272\001\032\151\277\322\130\307\124\127
-\010\217\341\071\140\167\113\254\131\204\032\210\361\335\313\117
-\170\327\347\341\063\055\374\356\101\372\040\260\276\313\367\070
-\224\300\341\320\205\017\273\355\054\163\253\355\376\222\166\032
-\144\177\133\015\063\011\007\063\173\006\077\021\244\134\160\074
-\205\300\317\343\220\250\203\167\372\333\346\305\214\150\147\020
-\147\245\122\055\360\304\231\217\177\277\321\153\342\265\107\326
-\331\320\205\231\115\224\233\017\113\215\356\000\132\107\035\021
-\003\254\101\030\257\207\267\157\014\072\217\312\317\334\003\301
-\242\011\310\345\375\200\136\310\140\102\001\033\032\123\132\273
-\067\246\267\274\272\204\351\036\154\032\324\144\332\324\103\376
-\223\213\113\362\054\171\026\020\324\223\013\210\217\241\330\206
-\024\106\221\107\233\050\044\357\127\122\116\134\102\234\252\367
-\111\354\047\350\100\036\263\246\211\042\162\234\365\015\063\264
-\130\243\060\073\335\324\152\124\223\276\032\115\363\223\224\367
-\374\204\013\077\204\040\134\064\003\104\305\332\255\274\012\301
-\002\317\036\345\224\331\363\216\133\330\114\360\235\354\141\027
-\273\024\062\124\014\002\051\223\036\222\206\366\177\357\347\222
-\005\016\131\335\231\010\056\056\372\234\000\122\323\305\146\051
-\344\247\227\104\244\016\050\201\023\065\305\366\157\144\346\101
-\304\325\057\314\064\105\045\317\101\000\226\075\112\056\302\226
-\230\117\116\112\234\227\267\333\037\222\062\310\377\017\121\156
-\326\354\011
-END
-CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
-
-# Trust for "TrustCor RootCert CA-2"
-# Issuer: CN=TrustCor RootCert CA-2,OU=TrustCor Certificate Authority,O=TrustCor Systems S. de R.L.,L=Panama City,ST=Panama,C=PA
-# Serial Number:25:a1:df:ca:33:cb:59:02
-# Subject: CN=TrustCor RootCert CA-2,OU=TrustCor Certificate Authority,O=TrustCor Systems S. de R.L.,L=Panama City,ST=Panama,C=PA
-# Not Valid Before: Thu Feb 04 12:32:23 2016
-# Not Valid After : Sun Dec 31 17:26:39 2034
-# Fingerprint (SHA-256): 07:53:E9:40:37:8C:1B:D5:E3:83:6E:39:5D:AE:A5:CB:83:9E:50:46:F1:BD:0E:AE:19:51:CF:10:FE:C7:C9:65
-# Fingerprint (SHA1): B8:BE:6D:CB:56:F1:55:B9:63:D4:12:CA:4E:06:34:C7:94:B2:1C:C0
-CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "TrustCor RootCert CA-2"
-CKA_CERT_SHA1_HASH MULTILINE_OCTAL
-\270\276\155\313\126\361\125\271\143\324\022\312\116\006\064\307
-\224\262\034\300
-END
-CKA_CERT_MD5_HASH MULTILINE_OCTAL
-\242\341\370\030\013\272\105\325\307\101\052\273\067\122\105\144
-END
-CKA_ISSUER MULTILINE_OCTAL
-\060\201\244\061\013\060\011\006\003\125\004\006\023\002\120\101
-\061\017\060\015\006\003\125\004\010\014\006\120\141\156\141\155
-\141\061\024\060\022\006\003\125\004\007\014\013\120\141\156\141
-\155\141\040\103\151\164\171\061\044\060\042\006\003\125\004\012
-\014\033\124\162\165\163\164\103\157\162\040\123\171\163\164\145
-\155\163\040\123\056\040\144\145\040\122\056\114\056\061\047\060
-\045\006\003\125\004\013\014\036\124\162\165\163\164\103\157\162
-\040\103\145\162\164\151\146\151\143\141\164\145\040\101\165\164
-\150\157\162\151\164\171\061\037\060\035\006\003\125\004\003\014
-\026\124\162\165\163\164\103\157\162\040\122\157\157\164\103\145
-\162\164\040\103\101\055\062
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\010\045\241\337\312\063\313\131\002
-END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-
-#
-# Certificate "TrustCor ECA-1"
-#
-# Issuer: CN=TrustCor ECA-1,OU=TrustCor Certificate Authority,O=TrustCor Systems S. de R.L.,L=Panama City,ST=Panama,C=PA
-# Serial Number:00:84:82:2c:5f:1c:62:d0:40
-# Subject: CN=TrustCor ECA-1,OU=TrustCor Certificate Authority,O=TrustCor Systems S. de R.L.,L=Panama City,ST=Panama,C=PA
-# Not Valid Before: Thu Feb 04 12:32:33 2016
-# Not Valid After : Mon Dec 31 17:28:07 2029
-# Fingerprint (SHA-256): 5A:88:5D:B1:9C:01:D9:12:C5:75:93:88:93:8C:AF:BB:DF:03:1A:B2:D4:8E:91:EE:15:58:9B:42:97:1D:03:9C
-# Fingerprint (SHA1): 58:D1:DF:95:95:67:6B:63:C0:F0:5B:1C:17:4D:8B:84:0B:C8:78:BD
-CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "TrustCor ECA-1"
-CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
-CKA_SUBJECT MULTILINE_OCTAL
-\060\201\234\061\013\060\011\006\003\125\004\006\023\002\120\101
-\061\017\060\015\006\003\125\004\010\014\006\120\141\156\141\155
-\141\061\024\060\022\006\003\125\004\007\014\013\120\141\156\141
-\155\141\040\103\151\164\171\061\044\060\042\006\003\125\004\012
-\014\033\124\162\165\163\164\103\157\162\040\123\171\163\164\145
-\155\163\040\123\056\040\144\145\040\122\056\114\056\061\047\060
-\045\006\003\125\004\013\014\036\124\162\165\163\164\103\157\162
-\040\103\145\162\164\151\146\151\143\141\164\145\040\101\165\164
-\150\157\162\151\164\171\061\027\060\025\006\003\125\004\003\014
-\016\124\162\165\163\164\103\157\162\040\105\103\101\055\061
-END
-CKA_ID UTF8 "0"
-CKA_ISSUER MULTILINE_OCTAL
-\060\201\234\061\013\060\011\006\003\125\004\006\023\002\120\101
-\061\017\060\015\006\003\125\004\010\014\006\120\141\156\141\155
-\141\061\024\060\022\006\003\125\004\007\014\013\120\141\156\141
-\155\141\040\103\151\164\171\061\044\060\042\006\003\125\004\012
-\014\033\124\162\165\163\164\103\157\162\040\123\171\163\164\145
-\155\163\040\123\056\040\144\145\040\122\056\114\056\061\047\060
-\045\006\003\125\004\013\014\036\124\162\165\163\164\103\157\162
-\040\103\145\162\164\151\146\151\143\141\164\145\040\101\165\164
-\150\157\162\151\164\171\061\027\060\025\006\003\125\004\003\014
-\016\124\162\165\163\164\103\157\162\040\105\103\101\055\061
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\011\000\204\202\054\137\034\142\320\100
-END
-CKA_VALUE MULTILINE_OCTAL
-\060\202\004\040\060\202\003\010\240\003\002\001\002\002\011\000
-\204\202\054\137\034\142\320\100\060\015\006\011\052\206\110\206
-\367\015\001\001\013\005\000\060\201\234\061\013\060\011\006\003
-\125\004\006\023\002\120\101\061\017\060\015\006\003\125\004\010
-\014\006\120\141\156\141\155\141\061\024\060\022\006\003\125\004
-\007\014\013\120\141\156\141\155\141\040\103\151\164\171\061\044
-\060\042\006\003\125\004\012\014\033\124\162\165\163\164\103\157
-\162\040\123\171\163\164\145\155\163\040\123\056\040\144\145\040
-\122\056\114\056\061\047\060\045\006\003\125\004\013\014\036\124
-\162\165\163\164\103\157\162\040\103\145\162\164\151\146\151\143
-\141\164\145\040\101\165\164\150\157\162\151\164\171\061\027\060
-\025\006\003\125\004\003\014\016\124\162\165\163\164\103\157\162
-\040\105\103\101\055\061\060\036\027\015\061\066\060\062\060\064
-\061\062\063\062\063\063\132\027\015\062\071\061\062\063\061\061
-\067\062\070\060\067\132\060\201\234\061\013\060\011\006\003\125
-\004\006\023\002\120\101\061\017\060\015\006\003\125\004\010\014
-\006\120\141\156\141\155\141\061\024\060\022\006\003\125\004\007
-\014\013\120\141\156\141\155\141\040\103\151\164\171\061\044\060
-\042\006\003\125\004\012\014\033\124\162\165\163\164\103\157\162
-\040\123\171\163\164\145\155\163\040\123\056\040\144\145\040\122
-\056\114\056\061\047\060\045\006\003\125\004\013\014\036\124\162
-\165\163\164\103\157\162\040\103\145\162\164\151\146\151\143\141
-\164\145\040\101\165\164\150\157\162\151\164\171\061\027\060\025
-\006\003\125\004\003\014\016\124\162\165\163\164\103\157\162\040
-\105\103\101\055\061\060\202\001\042\060\015\006\011\052\206\110
-\206\367\015\001\001\001\005\000\003\202\001\017\000\060\202\001
-\012\002\202\001\001\000\317\217\340\021\265\237\250\166\166\333
-\337\017\124\357\163\143\051\202\255\107\306\243\153\355\376\137
-\063\370\103\121\351\032\063\221\061\027\240\164\304\324\247\001
-\346\262\222\076\152\235\355\016\371\164\230\100\323\077\003\200
-\006\202\100\350\261\342\247\121\247\035\203\046\153\253\336\372
-\027\221\053\330\306\254\036\261\236\031\001\325\227\246\352\015
-\267\304\125\037\047\174\322\010\325\166\037\051\025\207\100\071
-\335\070\105\021\165\320\232\247\064\340\277\315\310\122\035\271
-\107\176\015\270\273\306\014\366\163\127\026\132\176\103\221\037
-\125\072\306\155\104\004\252\234\251\234\247\114\211\027\203\256
-\243\004\136\122\200\213\036\022\045\021\031\327\014\175\175\061
-\104\101\352\333\257\260\034\357\201\320\054\305\232\041\233\075
-\355\102\073\120\046\362\354\316\161\141\006\142\041\124\116\177
-\301\235\076\177\040\214\200\313\052\330\227\142\310\203\063\221
-\175\260\242\132\017\127\350\073\314\362\045\262\324\174\057\354
-\115\306\241\072\025\172\347\266\135\065\365\366\110\112\066\105
-\146\324\272\230\130\301\002\003\001\000\001\243\143\060\141\060
-\035\006\003\125\035\016\004\026\004\024\104\236\110\365\314\155
-\110\324\240\113\177\376\131\044\057\203\227\231\232\206\060\037
-\006\003\125\035\043\004\030\060\026\200\024\104\236\110\365\314
-\155\110\324\240\113\177\376\131\044\057\203\227\231\232\206\060
-\017\006\003\125\035\023\001\001\377\004\005\060\003\001\001\377
-\060\016\006\003\125\035\017\001\001\377\004\004\003\002\001\206
-\060\015\006\011\052\206\110\206\367\015\001\001\013\005\000\003
-\202\001\001\000\005\076\065\134\025\160\233\311\307\163\141\157
-\162\053\324\302\217\362\103\135\002\316\304\224\271\224\021\203
-\147\135\342\147\154\165\166\277\273\014\252\066\306\255\107\223
-\143\334\036\176\326\336\056\376\351\031\062\070\003\177\024\366
-\000\163\054\131\261\041\006\341\373\254\030\225\014\243\377\231
-\226\367\053\047\233\325\044\314\035\335\301\072\340\230\104\260
-\304\344\076\167\261\163\251\144\054\366\034\001\174\077\135\105
-\205\300\205\347\045\217\225\334\027\363\074\237\032\156\260\312
-\343\035\052\351\114\143\372\044\141\142\326\332\176\266\034\154
-\365\002\035\324\052\335\125\220\353\052\021\107\074\056\136\164
-\262\202\042\245\175\123\037\105\354\047\221\175\347\042\026\350
-\300\150\066\330\306\361\117\200\104\062\371\341\321\321\035\252
-\336\250\253\234\004\257\255\040\016\144\230\115\245\153\300\110
-\130\226\151\115\334\007\214\121\223\242\337\237\017\075\213\140
-\264\202\215\252\010\116\142\105\340\371\013\322\340\340\074\133
-\336\134\161\047\045\302\346\003\201\213\020\123\343\307\125\242
-\264\237\327\346
-END
-CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
-
-# Trust for "TrustCor ECA-1"
-# Issuer: CN=TrustCor ECA-1,OU=TrustCor Certificate Authority,O=TrustCor Systems S. de R.L.,L=Panama City,ST=Panama,C=PA
-# Serial Number:00:84:82:2c:5f:1c:62:d0:40
-# Subject: CN=TrustCor ECA-1,OU=TrustCor Certificate Authority,O=TrustCor Systems S. de R.L.,L=Panama City,ST=Panama,C=PA
-# Not Valid Before: Thu Feb 04 12:32:33 2016
-# Not Valid After : Mon Dec 31 17:28:07 2029
-# Fingerprint (SHA-256): 5A:88:5D:B1:9C:01:D9:12:C5:75:93:88:93:8C:AF:BB:DF:03:1A:B2:D4:8E:91:EE:15:58:9B:42:97:1D:03:9C
-# Fingerprint (SHA1): 58:D1:DF:95:95:67:6B:63:C0:F0:5B:1C:17:4D:8B:84:0B:C8:78:BD
-CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "TrustCor ECA-1"
-CKA_CERT_SHA1_HASH MULTILINE_OCTAL
-\130\321\337\225\225\147\153\143\300\360\133\034\027\115\213\204
-\013\310\170\275
-END
-CKA_CERT_MD5_HASH MULTILINE_OCTAL
-\047\222\043\035\012\365\100\174\351\346\153\235\330\365\347\154
-END
-CKA_ISSUER MULTILINE_OCTAL
-\060\201\234\061\013\060\011\006\003\125\004\006\023\002\120\101
-\061\017\060\015\006\003\125\004\010\014\006\120\141\156\141\155
-\141\061\024\060\022\006\003\125\004\007\014\013\120\141\156\141
-\155\141\040\103\151\164\171\061\044\060\042\006\003\125\004\012
-\014\033\124\162\165\163\164\103\157\162\040\123\171\163\164\145
-\155\163\040\123\056\040\144\145\040\122\056\114\056\061\047\060
-\045\006\003\125\004\013\014\036\124\162\165\163\164\103\157\162
-\040\103\145\162\164\151\146\151\143\141\164\145\040\101\165\164
-\150\157\162\151\164\171\061\027\060\025\006\003\125\004\003\014
-\016\124\162\165\163\164\103\157\162\040\105\103\101\055\061
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\011\000\204\202\054\137\034\142\320\100
-END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-
-#
-# Certificate "SSL.com Root Certification Authority RSA"
-#
-# Issuer: CN=SSL.com Root Certification Authority RSA,O=SSL Corporation,L=Houston,ST=Texas,C=US
-# Serial Number:7b:2c:9b:d3:16:80:32:99
-# Subject: CN=SSL.com Root Certification Authority RSA,O=SSL Corporation,L=Houston,ST=Texas,C=US
-# Not Valid Before: Fri Feb 12 17:39:39 2016
-# Not Valid After : Tue Feb 12 17:39:39 2041
-# Fingerprint (SHA-256): 85:66:6A:56:2E:E0:BE:5C:E9:25:C1:D8:89:0A:6F:76:A8:7E:C1:6D:4D:7D:5F:29:EA:74:19:CF:20:12:3B:69
-# Fingerprint (SHA1): B7:AB:33:08:D1:EA:44:77:BA:14:80:12:5A:6F:BD:A9:36:49:0C:BB
-CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "SSL.com Root Certification Authority RSA"
-CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
-CKA_SUBJECT MULTILINE_OCTAL
-\060\174\061\013\060\011\006\003\125\004\006\023\002\125\123\061
-\016\060\014\006\003\125\004\010\014\005\124\145\170\141\163\061
-\020\060\016\006\003\125\004\007\014\007\110\157\165\163\164\157
-\156\061\030\060\026\006\003\125\004\012\014\017\123\123\114\040
-\103\157\162\160\157\162\141\164\151\157\156\061\061\060\057\006
-\003\125\004\003\014\050\123\123\114\056\143\157\155\040\122\157
-\157\164\040\103\145\162\164\151\146\151\143\141\164\151\157\156
-\040\101\165\164\150\157\162\151\164\171\040\122\123\101
-END
-CKA_ID UTF8 "0"
-CKA_ISSUER MULTILINE_OCTAL
-\060\174\061\013\060\011\006\003\125\004\006\023\002\125\123\061
-\016\060\014\006\003\125\004\010\014\005\124\145\170\141\163\061
-\020\060\016\006\003\125\004\007\014\007\110\157\165\163\164\157
-\156\061\030\060\026\006\003\125\004\012\014\017\123\123\114\040
-\103\157\162\160\157\162\141\164\151\157\156\061\061\060\057\006
-\003\125\004\003\014\050\123\123\114\056\143\157\155\040\122\157
-\157\164\040\103\145\162\164\151\146\151\143\141\164\151\157\156
-\040\101\165\164\150\157\162\151\164\171\040\122\123\101
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\010\173\054\233\323\026\200\062\231
-END
-CKA_VALUE MULTILINE_OCTAL
-\060\202\005\335\060\202\003\305\240\003\002\001\002\002\010\173
-\054\233\323\026\200\062\231\060\015\006\011\052\206\110\206\367
-\015\001\001\013\005\000\060\174\061\013\060\011\006\003\125\004
-\006\023\002\125\123\061\016\060\014\006\003\125\004\010\014\005
-\124\145\170\141\163\061\020\060\016\006\003\125\004\007\014\007
-\110\157\165\163\164\157\156\061\030\060\026\006\003\125\004\012
-\014\017\123\123\114\040\103\157\162\160\157\162\141\164\151\157
-\156\061\061\060\057\006\003\125\004\003\014\050\123\123\114\056
-\143\157\155\040\122\157\157\164\040\103\145\162\164\151\146\151
-\143\141\164\151\157\156\040\101\165\164\150\157\162\151\164\171
-\040\122\123\101\060\036\027\015\061\066\060\062\061\062\061\067
-\063\071\063\071\132\027\015\064\061\060\062\061\062\061\067\063
-\071\063\071\132\060\174\061\013\060\011\006\003\125\004\006\023
-\002\125\123\061\016\060\014\006\003\125\004\010\014\005\124\145
-\170\141\163\061\020\060\016\006\003\125\004\007\014\007\110\157
-\165\163\164\157\156\061\030\060\026\006\003\125\004\012\014\017
-\123\123\114\040\103\157\162\160\157\162\141\164\151\157\156\061
-\061\060\057\006\003\125\004\003\014\050\123\123\114\056\143\157
-\155\040\122\157\157\164\040\103\145\162\164\151\146\151\143\141
-\164\151\157\156\040\101\165\164\150\157\162\151\164\171\040\122
-\123\101\060\202\002\042\060\015\006\011\052\206\110\206\367\015
-\001\001\001\005\000\003\202\002\017\000\060\202\002\012\002\202
-\002\001\000\371\017\335\243\053\175\313\320\052\376\354\147\205
-\246\347\056\033\272\167\341\343\365\257\244\354\372\112\135\221
-\304\127\107\153\030\167\153\166\362\375\223\344\075\017\302\026
-\236\013\146\303\126\224\236\027\203\205\316\126\357\362\026\375
-\000\142\365\042\011\124\350\145\027\116\101\271\340\117\106\227
-\252\033\310\270\156\142\136\151\261\137\333\052\002\176\374\154
-\312\363\101\330\355\320\350\374\077\141\110\355\260\003\024\035
-\020\016\113\031\340\273\116\354\206\145\377\066\363\136\147\002
-\013\235\206\125\141\375\172\070\355\376\342\031\000\267\157\241
-\120\142\165\164\074\240\372\310\045\222\264\156\172\042\307\370
-\036\241\343\262\335\221\061\253\053\035\004\377\245\112\004\067
-\351\205\244\063\053\375\342\326\125\064\174\031\244\112\150\307
-\262\250\323\267\312\241\223\210\353\301\227\274\214\371\035\331
-\042\204\044\164\307\004\075\152\251\051\223\314\353\270\133\341
-\376\137\045\252\064\130\310\301\043\124\235\033\230\021\303\070
-\234\176\075\206\154\245\017\100\206\174\002\364\134\002\117\050
-\313\256\161\237\017\072\310\063\376\021\045\065\352\374\272\305
-\140\075\331\174\030\325\262\251\323\165\170\003\162\042\312\072
-\303\037\357\054\345\056\251\372\236\054\266\121\106\375\257\003
-\326\352\140\150\352\205\026\066\153\205\351\036\300\263\335\304
-\044\334\200\052\201\101\155\224\076\310\340\311\201\101\000\236
-\136\277\177\305\010\230\242\030\054\102\100\263\371\157\070\047
-\113\116\200\364\075\201\107\340\210\174\352\034\316\265\165\134
-\121\056\034\053\177\032\162\050\347\000\265\321\164\306\327\344
-\237\255\007\223\266\123\065\065\374\067\344\303\366\135\026\276
-\041\163\336\222\012\370\240\143\152\274\226\222\152\076\370\274
-\145\125\233\336\365\015\211\046\004\374\045\032\246\045\151\313
-\302\155\312\174\342\131\137\227\254\353\357\056\310\274\327\033
-\131\074\053\314\362\031\310\223\153\047\143\031\317\374\351\046
-\370\312\161\233\177\223\376\064\147\204\116\231\353\374\263\170
-\011\063\160\272\146\246\166\355\033\163\353\032\245\015\304\042
-\023\040\224\126\012\116\054\154\116\261\375\317\234\011\272\242
-\063\355\207\002\003\001\000\001\243\143\060\141\060\035\006\003
-\125\035\016\004\026\004\024\335\004\011\007\242\365\172\175\122
-\123\022\222\225\356\070\200\045\015\246\131\060\017\006\003\125
-\035\023\001\001\377\004\005\060\003\001\001\377\060\037\006\003
-\125\035\043\004\030\060\026\200\024\335\004\011\007\242\365\172
-\175\122\123\022\222\225\356\070\200\045\015\246\131\060\016\006
-\003\125\035\017\001\001\377\004\004\003\002\001\206\060\015\006
-\011\052\206\110\206\367\015\001\001\013\005\000\003\202\002\001
-\000\040\030\021\224\051\373\046\235\034\036\036\160\141\361\225
-\162\223\161\044\255\150\223\130\216\062\257\033\263\160\003\374
-\045\053\164\205\220\075\170\152\364\271\213\245\227\073\265\030
-\221\273\036\247\371\100\133\221\371\125\231\257\036\021\320\134
-\035\247\146\343\261\224\007\014\062\071\246\352\033\260\171\330
-\035\234\160\104\343\212\335\304\371\225\037\212\070\103\077\001
-\205\245\107\247\075\106\262\274\345\042\150\367\173\234\330\054
-\076\012\041\310\055\063\254\277\305\201\231\061\164\301\165\161
-\305\276\261\360\043\105\364\235\153\374\031\143\235\243\274\004
-\306\030\013\045\273\123\211\017\263\200\120\336\105\356\104\177
-\253\224\170\144\230\323\366\050\335\207\330\160\145\164\373\016
-\271\023\353\247\017\141\251\062\226\314\336\273\355\143\114\030
-\273\251\100\367\240\124\156\040\210\161\165\030\352\172\264\064
-\162\340\043\047\167\134\266\220\352\206\045\100\253\357\063\017
-\313\237\202\276\242\040\373\366\265\055\032\346\302\205\261\164
-\017\373\310\145\002\244\122\001\107\335\111\042\301\277\330\353
-\153\254\176\336\354\143\063\025\267\043\010\217\306\017\215\101
-\132\335\216\305\271\217\345\105\077\170\333\272\322\033\100\261
-\376\161\115\077\340\201\242\272\136\264\354\025\340\223\335\010
-\037\176\341\125\231\013\041\336\223\236\012\373\346\243\111\275
-\066\060\376\347\167\262\240\165\227\265\055\201\210\027\145\040
-\367\332\220\000\237\311\122\314\062\312\065\174\365\075\017\330
-\053\327\365\046\154\311\006\064\226\026\352\160\131\032\062\171
-\171\013\266\210\177\017\122\110\075\277\154\330\242\104\056\321
-\116\267\162\130\323\211\023\225\376\104\253\370\327\213\033\156
-\234\274\054\240\133\325\152\000\257\137\067\341\325\372\020\013
-\230\234\206\347\046\217\316\360\354\156\212\127\013\200\343\116
-\262\300\240\143\141\220\272\125\150\067\164\152\266\222\333\237
-\241\206\042\266\145\047\016\354\266\237\102\140\344\147\302\265
-\332\101\013\304\323\213\141\033\274\372\037\221\053\327\104\007
-\136\272\051\254\331\305\351\357\123\110\132\353\200\361\050\130
-\041\315\260\006\125\373\047\077\123\220\160\251\004\036\127\047
-\271
-END
-CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
-
-# Trust for "SSL.com Root Certification Authority RSA"
-# Issuer: CN=SSL.com Root Certification Authority RSA,O=SSL Corporation,L=Houston,ST=Texas,C=US
-# Serial Number:7b:2c:9b:d3:16:80:32:99
-# Subject: CN=SSL.com Root Certification Authority RSA,O=SSL Corporation,L=Houston,ST=Texas,C=US
-# Not Valid Before: Fri Feb 12 17:39:39 2016
-# Not Valid After : Tue Feb 12 17:39:39 2041
-# Fingerprint (SHA-256): 85:66:6A:56:2E:E0:BE:5C:E9:25:C1:D8:89:0A:6F:76:A8:7E:C1:6D:4D:7D:5F:29:EA:74:19:CF:20:12:3B:69
-# Fingerprint (SHA1): B7:AB:33:08:D1:EA:44:77:BA:14:80:12:5A:6F:BD:A9:36:49:0C:BB
-CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "SSL.com Root Certification Authority RSA"
-CKA_CERT_SHA1_HASH MULTILINE_OCTAL
-\267\253\063\010\321\352\104\167\272\024\200\022\132\157\275\251
-\066\111\014\273
-END
-CKA_CERT_MD5_HASH MULTILINE_OCTAL
-\206\151\022\300\160\361\354\254\254\302\325\274\245\133\241\051
-END
-CKA_ISSUER MULTILINE_OCTAL
-\060\174\061\013\060\011\006\003\125\004\006\023\002\125\123\061
-\016\060\014\006\003\125\004\010\014\005\124\145\170\141\163\061
-\020\060\016\006\003\125\004\007\014\007\110\157\165\163\164\157
-\156\061\030\060\026\006\003\125\004\012\014\017\123\123\114\040
-\103\157\162\160\157\162\141\164\151\157\156\061\061\060\057\006
-\003\125\004\003\014\050\123\123\114\056\143\157\155\040\122\157
-\157\164\040\103\145\162\164\151\146\151\143\141\164\151\157\156
-\040\101\165\164\150\157\162\151\164\171\040\122\123\101
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\010\173\054\233\323\026\200\062\231
-END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-
-#
-# Certificate "SSL.com Root Certification Authority ECC"
-#
-# Issuer: CN=SSL.com Root Certification Authority ECC,O=SSL Corporation,L=Houston,ST=Texas,C=US
-# Serial Number:75:e6:df:cb:c1:68:5b:a8
-# Subject: CN=SSL.com Root Certification Authority ECC,O=SSL Corporation,L=Houston,ST=Texas,C=US
-# Not Valid Before: Fri Feb 12 18:14:03 2016
-# Not Valid After : Tue Feb 12 18:14:03 2041
-# Fingerprint (SHA-256): 34:17:BB:06:CC:60:07:DA:1B:96:1C:92:0B:8A:B4:CE:3F:AD:82:0E:4A:A3:0B:9A:CB:C4:A7:4E:BD:CE:BC:65
-# Fingerprint (SHA1): C3:19:7C:39:24:E6:54:AF:1B:C4:AB:20:95:7A:E2:C3:0E:13:02:6A
-CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "SSL.com Root Certification Authority ECC"
-CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
-CKA_SUBJECT MULTILINE_OCTAL
-\060\174\061\013\060\011\006\003\125\004\006\023\002\125\123\061
-\016\060\014\006\003\125\004\010\014\005\124\145\170\141\163\061
-\020\060\016\006\003\125\004\007\014\007\110\157\165\163\164\157
-\156\061\030\060\026\006\003\125\004\012\014\017\123\123\114\040
-\103\157\162\160\157\162\141\164\151\157\156\061\061\060\057\006
-\003\125\004\003\014\050\123\123\114\056\143\157\155\040\122\157
-\157\164\040\103\145\162\164\151\146\151\143\141\164\151\157\156
-\040\101\165\164\150\157\162\151\164\171\040\105\103\103
-END
-CKA_ID UTF8 "0"
-CKA_ISSUER MULTILINE_OCTAL
-\060\174\061\013\060\011\006\003\125\004\006\023\002\125\123\061
-\016\060\014\006\003\125\004\010\014\005\124\145\170\141\163\061
-\020\060\016\006\003\125\004\007\014\007\110\157\165\163\164\157
-\156\061\030\060\026\006\003\125\004\012\014\017\123\123\114\040
-\103\157\162\160\157\162\141\164\151\157\156\061\061\060\057\006
-\003\125\004\003\014\050\123\123\114\056\143\157\155\040\122\157
-\157\164\040\103\145\162\164\151\146\151\143\141\164\151\157\156
-\040\101\165\164\150\157\162\151\164\171\040\105\103\103
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\010\165\346\337\313\301\150\133\250
-END
-CKA_VALUE MULTILINE_OCTAL
-\060\202\002\215\060\202\002\024\240\003\002\001\002\002\010\165
-\346\337\313\301\150\133\250\060\012\006\010\052\206\110\316\075
-\004\003\002\060\174\061\013\060\011\006\003\125\004\006\023\002
-\125\123\061\016\060\014\006\003\125\004\010\014\005\124\145\170
-\141\163\061\020\060\016\006\003\125\004\007\014\007\110\157\165
-\163\164\157\156\061\030\060\026\006\003\125\004\012\014\017\123
-\123\114\040\103\157\162\160\157\162\141\164\151\157\156\061\061
-\060\057\006\003\125\004\003\014\050\123\123\114\056\143\157\155
-\040\122\157\157\164\040\103\145\162\164\151\146\151\143\141\164
-\151\157\156\040\101\165\164\150\157\162\151\164\171\040\105\103
-\103\060\036\027\015\061\066\060\062\061\062\061\070\061\064\060
-\063\132\027\015\064\061\060\062\061\062\061\070\061\064\060\063
-\132\060\174\061\013\060\011\006\003\125\004\006\023\002\125\123
-\061\016\060\014\006\003\125\004\010\014\005\124\145\170\141\163
-\061\020\060\016\006\003\125\004\007\014\007\110\157\165\163\164
-\157\156\061\030\060\026\006\003\125\004\012\014\017\123\123\114
-\040\103\157\162\160\157\162\141\164\151\157\156\061\061\060\057
-\006\003\125\004\003\014\050\123\123\114\056\143\157\155\040\122
-\157\157\164\040\103\145\162\164\151\146\151\143\141\164\151\157
-\156\040\101\165\164\150\157\162\151\164\171\040\105\103\103\060
-\166\060\020\006\007\052\206\110\316\075\002\001\006\005\053\201
-\004\000\042\003\142\000\004\105\156\251\120\304\246\043\066\236
-\137\050\215\027\313\226\042\144\077\334\172\216\035\314\010\263
-\242\161\044\272\216\111\271\004\033\107\226\130\253\055\225\310
-\355\236\010\065\310\047\353\211\214\123\130\353\142\212\376\360
-\133\017\153\061\122\143\101\073\211\315\354\354\266\215\031\323
-\064\007\334\273\306\006\177\302\105\225\354\313\177\250\043\340
-\011\351\201\372\363\107\323\243\143\060\141\060\035\006\003\125
-\035\016\004\026\004\024\202\321\205\163\060\347\065\004\323\216
-\002\222\373\345\244\321\304\041\350\315\060\017\006\003\125\035
-\023\001\001\377\004\005\060\003\001\001\377\060\037\006\003\125
-\035\043\004\030\060\026\200\024\202\321\205\163\060\347\065\004
-\323\216\002\222\373\345\244\321\304\041\350\315\060\016\006\003
-\125\035\017\001\001\377\004\004\003\002\001\206\060\012\006\010
-\052\206\110\316\075\004\003\002\003\147\000\060\144\002\060\157
-\347\353\131\021\244\140\317\141\260\226\173\355\005\371\057\023
-\221\334\355\345\374\120\153\021\106\106\263\034\041\000\142\273
-\276\303\347\350\315\007\231\371\015\013\135\162\076\304\252\002
-\060\037\274\272\013\342\060\044\373\174\155\200\125\012\231\076
-\200\015\063\345\146\243\263\243\273\245\325\213\217\011\054\246
-\135\176\342\360\007\010\150\155\322\174\151\156\137\337\345\152
-\145
-END
-CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
-
-# Trust for "SSL.com Root Certification Authority ECC"
-# Issuer: CN=SSL.com Root Certification Authority ECC,O=SSL Corporation,L=Houston,ST=Texas,C=US
-# Serial Number:75:e6:df:cb:c1:68:5b:a8
-# Subject: CN=SSL.com Root Certification Authority ECC,O=SSL Corporation,L=Houston,ST=Texas,C=US
-# Not Valid Before: Fri Feb 12 18:14:03 2016
-# Not Valid After : Tue Feb 12 18:14:03 2041
-# Fingerprint (SHA-256): 34:17:BB:06:CC:60:07:DA:1B:96:1C:92:0B:8A:B4:CE:3F:AD:82:0E:4A:A3:0B:9A:CB:C4:A7:4E:BD:CE:BC:65
-# Fingerprint (SHA1): C3:19:7C:39:24:E6:54:AF:1B:C4:AB:20:95:7A:E2:C3:0E:13:02:6A
-CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "SSL.com Root Certification Authority ECC"
-CKA_CERT_SHA1_HASH MULTILINE_OCTAL
-\303\031\174\071\044\346\124\257\033\304\253\040\225\172\342\303
-\016\023\002\152
-END
-CKA_CERT_MD5_HASH MULTILINE_OCTAL
-\056\332\344\071\177\234\217\067\321\160\237\046\027\121\072\216
-END
-CKA_ISSUER MULTILINE_OCTAL
-\060\174\061\013\060\011\006\003\125\004\006\023\002\125\123\061
-\016\060\014\006\003\125\004\010\014\005\124\145\170\141\163\061
-\020\060\016\006\003\125\004\007\014\007\110\157\165\163\164\157
-\156\061\030\060\026\006\003\125\004\012\014\017\123\123\114\040
-\103\157\162\160\157\162\141\164\151\157\156\061\061\060\057\006
-\003\125\004\003\014\050\123\123\114\056\143\157\155\040\122\157
-\157\164\040\103\145\162\164\151\146\151\143\141\164\151\157\156
-\040\101\165\164\150\157\162\151\164\171\040\105\103\103
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\010\165\346\337\313\301\150\133\250
-END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-
-#
-# Certificate "SSL.com EV Root Certification Authority RSA R2"
-#
-# Issuer: CN=SSL.com EV Root Certification Authority RSA R2,O=SSL Corporation,L=Houston,ST=Texas,C=US
-# Serial Number:56:b6:29:cd:34:bc:78:f6
-# Subject: CN=SSL.com EV Root Certification Authority RSA R2,O=SSL Corporation,L=Houston,ST=Texas,C=US
-# Not Valid Before: Wed May 31 18:14:37 2017
-# Not Valid After : Fri May 30 18:14:37 2042
-# Fingerprint (SHA-256): 2E:7B:F1:6C:C2:24:85:A7:BB:E2:AA:86:96:75:07:61:B0:AE:39:BE:3B:2F:E9:D0:CC:6D:4E:F7:34:91:42:5C
-# Fingerprint (SHA1): 74:3A:F0:52:9B:D0:32:A0:F4:4A:83:CD:D4:BA:A9:7B:7C:2E:C4:9A
-CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "SSL.com EV Root Certification Authority RSA R2"
-CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
-CKA_SUBJECT MULTILINE_OCTAL
-\060\201\202\061\013\060\011\006\003\125\004\006\023\002\125\123
-\061\016\060\014\006\003\125\004\010\014\005\124\145\170\141\163
-\061\020\060\016\006\003\125\004\007\014\007\110\157\165\163\164
-\157\156\061\030\060\026\006\003\125\004\012\014\017\123\123\114
-\040\103\157\162\160\157\162\141\164\151\157\156\061\067\060\065
-\006\003\125\004\003\014\056\123\123\114\056\143\157\155\040\105
-\126\040\122\157\157\164\040\103\145\162\164\151\146\151\143\141
-\164\151\157\156\040\101\165\164\150\157\162\151\164\171\040\122
-\123\101\040\122\062
-END
-CKA_ID UTF8 "0"
-CKA_ISSUER MULTILINE_OCTAL
-\060\201\202\061\013\060\011\006\003\125\004\006\023\002\125\123
-\061\016\060\014\006\003\125\004\010\014\005\124\145\170\141\163
-\061\020\060\016\006\003\125\004\007\014\007\110\157\165\163\164
-\157\156\061\030\060\026\006\003\125\004\012\014\017\123\123\114
-\040\103\157\162\160\157\162\141\164\151\157\156\061\067\060\065
-\006\003\125\004\003\014\056\123\123\114\056\143\157\155\040\105
-\126\040\122\157\157\164\040\103\145\162\164\151\146\151\143\141
-\164\151\157\156\040\101\165\164\150\157\162\151\164\171\040\122
-\123\101\040\122\062
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\010\126\266\051\315\064\274\170\366
-END
-CKA_VALUE MULTILINE_OCTAL
-\060\202\005\353\060\202\003\323\240\003\002\001\002\002\010\126
-\266\051\315\064\274\170\366\060\015\006\011\052\206\110\206\367
-\015\001\001\013\005\000\060\201\202\061\013\060\011\006\003\125
-\004\006\023\002\125\123\061\016\060\014\006\003\125\004\010\014
-\005\124\145\170\141\163\061\020\060\016\006\003\125\004\007\014
-\007\110\157\165\163\164\157\156\061\030\060\026\006\003\125\004
-\012\014\017\123\123\114\040\103\157\162\160\157\162\141\164\151
-\157\156\061\067\060\065\006\003\125\004\003\014\056\123\123\114
-\056\143\157\155\040\105\126\040\122\157\157\164\040\103\145\162
-\164\151\146\151\143\141\164\151\157\156\040\101\165\164\150\157
-\162\151\164\171\040\122\123\101\040\122\062\060\036\027\015\061
-\067\060\065\063\061\061\070\061\064\063\067\132\027\015\064\062
-\060\065\063\060\061\070\061\064\063\067\132\060\201\202\061\013
-\060\011\006\003\125\004\006\023\002\125\123\061\016\060\014\006
-\003\125\004\010\014\005\124\145\170\141\163\061\020\060\016\006
-\003\125\004\007\014\007\110\157\165\163\164\157\156\061\030\060
-\026\006\003\125\004\012\014\017\123\123\114\040\103\157\162\160
-\157\162\141\164\151\157\156\061\067\060\065\006\003\125\004\003
-\014\056\123\123\114\056\143\157\155\040\105\126\040\122\157\157
-\164\040\103\145\162\164\151\146\151\143\141\164\151\157\156\040
-\101\165\164\150\157\162\151\164\171\040\122\123\101\040\122\062
-\060\202\002\042\060\015\006\011\052\206\110\206\367\015\001\001
-\001\005\000\003\202\002\017\000\060\202\002\012\002\202\002\001
-\000\217\066\145\100\341\326\115\300\327\264\351\106\332\153\352
-\063\107\315\114\371\175\175\276\275\055\075\360\333\170\341\206
-\245\331\272\011\127\150\355\127\076\240\320\010\101\203\347\050
-\101\044\037\343\162\025\320\001\032\373\136\160\043\262\313\237
-\071\343\317\305\116\306\222\155\046\306\173\273\263\332\047\235
-\012\206\351\201\067\005\376\360\161\161\354\303\034\351\143\242
-\027\024\235\357\033\147\323\205\125\002\002\326\111\311\314\132
-\341\261\367\157\062\237\311\324\073\210\101\250\234\275\313\253
-\333\155\173\011\037\242\114\162\220\332\053\010\374\317\074\124
-\316\147\017\250\317\135\226\031\013\304\343\162\353\255\321\175
-\035\047\357\222\353\020\277\133\353\073\257\317\200\335\301\322
-\226\004\133\172\176\244\251\074\070\166\244\142\216\240\071\136
-\352\167\317\135\000\131\217\146\054\076\007\242\243\005\046\021
-\151\227\352\205\267\017\226\013\113\310\100\341\120\272\056\212
-\313\367\017\232\042\347\177\232\067\023\315\362\115\023\153\041
-\321\300\314\042\362\241\106\366\104\151\234\312\141\065\007\000
-\157\326\141\010\021\352\272\270\366\351\263\140\345\115\271\354
-\237\024\146\311\127\130\333\315\207\151\370\212\206\022\003\107
-\277\146\023\166\254\167\175\064\044\205\203\315\327\252\234\220
-\032\237\041\054\177\170\267\144\270\330\350\246\364\170\263\125
-\313\204\322\062\304\170\256\243\217\141\335\316\010\123\255\354
-\210\374\025\344\232\015\346\237\032\167\316\114\217\270\024\025
-\075\142\234\206\070\006\000\146\022\344\131\166\132\123\300\002
-\230\242\020\053\150\104\173\216\171\316\063\112\166\252\133\201
-\026\033\265\212\330\320\000\173\136\142\264\011\326\206\143\016
-\246\005\225\111\272\050\213\210\223\262\064\034\330\244\125\156
-\267\034\320\336\231\125\073\043\364\042\340\371\051\146\046\354
-\040\120\167\333\112\013\217\276\345\002\140\160\101\136\324\256
-\120\071\042\024\046\313\262\073\163\164\125\107\007\171\201\071
-\250\060\023\104\345\004\212\256\226\023\045\102\017\271\123\304
-\233\374\315\344\034\336\074\372\253\326\006\112\037\147\246\230
-\060\034\335\054\333\334\030\225\127\146\306\377\134\213\126\365
-\167\002\003\001\000\001\243\143\060\141\060\017\006\003\125\035
-\023\001\001\377\004\005\060\003\001\001\377\060\037\006\003\125
-\035\043\004\030\060\026\200\024\371\140\273\324\343\325\064\366
-\270\365\006\200\045\247\163\333\106\151\250\236\060\035\006\003
-\125\035\016\004\026\004\024\371\140\273\324\343\325\064\366\270
-\365\006\200\045\247\163\333\106\151\250\236\060\016\006\003\125
-\035\017\001\001\377\004\004\003\002\001\206\060\015\006\011\052
-\206\110\206\367\015\001\001\013\005\000\003\202\002\001\000\126
-\263\216\313\012\235\111\216\277\244\304\221\273\146\027\005\121
-\230\165\373\345\120\054\172\236\361\024\372\253\323\212\076\377
-\221\051\217\143\213\330\264\251\124\001\015\276\223\206\057\371
-\112\155\307\136\365\127\371\312\125\034\022\276\107\017\066\305
-\337\152\267\333\165\302\107\045\177\271\361\143\370\150\055\125
-\004\321\362\215\260\244\317\274\074\136\037\170\347\245\240\040
-\160\260\004\305\267\367\162\247\336\042\015\275\063\045\106\214
-\144\222\046\343\076\056\143\226\332\233\214\075\370\030\011\327
-\003\314\175\206\202\340\312\004\007\121\120\327\377\222\325\014
-\357\332\206\237\231\327\353\267\257\150\342\071\046\224\272\150
-\267\277\203\323\352\172\147\075\142\147\256\045\345\162\350\342
-\344\354\256\022\366\113\053\074\237\351\260\100\363\070\124\263
-\375\267\150\310\332\306\217\121\074\262\373\221\334\034\347\233
-\235\341\267\015\162\217\342\244\304\251\170\371\353\024\254\306
-\103\005\302\145\071\050\030\002\303\202\262\235\005\276\145\355
-\226\137\145\164\074\373\011\065\056\173\234\023\375\033\017\135
-\307\155\201\072\126\017\314\073\341\257\002\057\042\254\106\312
-\106\074\240\034\114\326\104\264\136\056\134\025\146\011\341\046
-\051\376\306\122\141\272\261\163\377\303\014\234\345\154\152\224
-\077\024\312\100\026\225\204\363\131\251\254\137\114\141\223\155
-\321\073\314\242\225\014\042\246\147\147\104\056\271\331\322\212
-\101\263\146\013\132\373\175\043\245\362\032\260\377\336\233\203
-\224\056\321\077\337\222\267\221\257\005\073\145\307\240\154\261
-\315\142\022\303\220\033\343\045\316\064\274\157\167\166\261\020
-\303\367\005\032\300\326\257\164\142\110\027\167\222\151\220\141
-\034\336\225\200\164\124\217\030\034\303\363\003\320\277\244\103
-\165\206\123\030\172\012\056\011\034\066\237\221\375\202\212\042
-\113\321\016\120\045\335\313\003\014\027\311\203\000\010\116\065
-\115\212\213\355\360\002\224\146\054\104\177\313\225\047\226\027
-\255\011\060\254\266\161\027\156\213\027\366\034\011\324\055\073
-\230\245\161\323\124\023\331\140\363\365\113\146\117\372\361\356
-\040\022\215\264\254\127\261\105\143\241\254\166\251\302\373
-END
-CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
-
-# Trust for "SSL.com EV Root Certification Authority RSA R2"
-# Issuer: CN=SSL.com EV Root Certification Authority RSA R2,O=SSL Corporation,L=Houston,ST=Texas,C=US
-# Serial Number:56:b6:29:cd:34:bc:78:f6
-# Subject: CN=SSL.com EV Root Certification Authority RSA R2,O=SSL Corporation,L=Houston,ST=Texas,C=US
-# Not Valid Before: Wed May 31 18:14:37 2017
-# Not Valid After : Fri May 30 18:14:37 2042
-# Fingerprint (SHA-256): 2E:7B:F1:6C:C2:24:85:A7:BB:E2:AA:86:96:75:07:61:B0:AE:39:BE:3B:2F:E9:D0:CC:6D:4E:F7:34:91:42:5C
-# Fingerprint (SHA1): 74:3A:F0:52:9B:D0:32:A0:F4:4A:83:CD:D4:BA:A9:7B:7C:2E:C4:9A
-CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "SSL.com EV Root Certification Authority RSA R2"
-CKA_CERT_SHA1_HASH MULTILINE_OCTAL
-\164\072\360\122\233\320\062\240\364\112\203\315\324\272\251\173
-\174\056\304\232
-END
-CKA_CERT_MD5_HASH MULTILINE_OCTAL
-\341\036\061\130\032\256\124\123\002\366\027\152\021\173\115\225
-END
-CKA_ISSUER MULTILINE_OCTAL
-\060\201\202\061\013\060\011\006\003\125\004\006\023\002\125\123
-\061\016\060\014\006\003\125\004\010\014\005\124\145\170\141\163
-\061\020\060\016\006\003\125\004\007\014\007\110\157\165\163\164
-\157\156\061\030\060\026\006\003\125\004\012\014\017\123\123\114
-\040\103\157\162\160\157\162\141\164\151\157\156\061\067\060\065
-\006\003\125\004\003\014\056\123\123\114\056\143\157\155\040\105
-\126\040\122\157\157\164\040\103\145\162\164\151\146\151\143\141
-\164\151\157\156\040\101\165\164\150\157\162\151\164\171\040\122
-\123\101\040\122\062
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\010\126\266\051\315\064\274\170\366
-END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
-
-#
-# Certificate "SSL.com EV Root Certification Authority ECC"
-#
-# Issuer: CN=SSL.com EV Root Certification Authority ECC,O=SSL Corporation,L=Houston,ST=Texas,C=US
-# Serial Number:2c:29:9c:5b:16:ed:05:95
-# Subject: CN=SSL.com EV Root Certification Authority ECC,O=SSL Corporation,L=Houston,ST=Texas,C=US
-# Not Valid Before: Fri Feb 12 18:15:23 2016
-# Not Valid After : Tue Feb 12 18:15:23 2041
-# Fingerprint (SHA-256): 22:A2:C1:F7:BD:ED:70:4C:C1:E7:01:B5:F4:08:C3:10:88:0F:E9:56:B5:DE:2A:4A:44:F9:9C:87:3A:25:A7:C8
-# Fingerprint (SHA1): 4C:DD:51:A3:D1:F5:20:32:14:B0:C6:C5:32:23:03:91:C7:46:42:6D
-CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "SSL.com EV Root Certification Authority ECC"
-CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509
-CKA_SUBJECT MULTILINE_OCTAL
-\060\177\061\013\060\011\006\003\125\004\006\023\002\125\123\061
-\016\060\014\006\003\125\004\010\014\005\124\145\170\141\163\061
-\020\060\016\006\003\125\004\007\014\007\110\157\165\163\164\157
-\156\061\030\060\026\006\003\125\004\012\014\017\123\123\114\040
-\103\157\162\160\157\162\141\164\151\157\156\061\064\060\062\006
-\003\125\004\003\014\053\123\123\114\056\143\157\155\040\105\126
-\040\122\157\157\164\040\103\145\162\164\151\146\151\143\141\164
-\151\157\156\040\101\165\164\150\157\162\151\164\171\040\105\103
-\103
-END
-CKA_ID UTF8 "0"
-CKA_ISSUER MULTILINE_OCTAL
-\060\177\061\013\060\011\006\003\125\004\006\023\002\125\123\061
-\016\060\014\006\003\125\004\010\014\005\124\145\170\141\163\061
-\020\060\016\006\003\125\004\007\014\007\110\157\165\163\164\157
-\156\061\030\060\026\006\003\125\004\012\014\017\123\123\114\040
-\103\157\162\160\157\162\141\164\151\157\156\061\064\060\062\006
-\003\125\004\003\014\053\123\123\114\056\143\157\155\040\105\126
-\040\122\157\157\164\040\103\145\162\164\151\146\151\143\141\164
-\151\157\156\040\101\165\164\150\157\162\151\164\171\040\105\103
-\103
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\010\054\051\234\133\026\355\005\225
-END
-CKA_VALUE MULTILINE_OCTAL
-\060\202\002\224\060\202\002\032\240\003\002\001\002\002\010\054
-\051\234\133\026\355\005\225\060\012\006\010\052\206\110\316\075
-\004\003\002\060\177\061\013\060\011\006\003\125\004\006\023\002
-\125\123\061\016\060\014\006\003\125\004\010\014\005\124\145\170
-\141\163\061\020\060\016\006\003\125\004\007\014\007\110\157\165
-\163\164\157\156\061\030\060\026\006\003\125\004\012\014\017\123
-\123\114\040\103\157\162\160\157\162\141\164\151\157\156\061\064
-\060\062\006\003\125\004\003\014\053\123\123\114\056\143\157\155
-\040\105\126\040\122\157\157\164\040\103\145\162\164\151\146\151
-\143\141\164\151\157\156\040\101\165\164\150\157\162\151\164\171
-\040\105\103\103\060\036\027\015\061\066\060\062\061\062\061\070
-\061\065\062\063\132\027\015\064\061\060\062\061\062\061\070\061
-\065\062\063\132\060\177\061\013\060\011\006\003\125\004\006\023
-\002\125\123\061\016\060\014\006\003\125\004\010\014\005\124\145
-\170\141\163\061\020\060\016\006\003\125\004\007\014\007\110\157
-\165\163\164\157\156\061\030\060\026\006\003\125\004\012\014\017
-\123\123\114\040\103\157\162\160\157\162\141\164\151\157\156\061
-\064\060\062\006\003\125\004\003\014\053\123\123\114\056\143\157
-\155\040\105\126\040\122\157\157\164\040\103\145\162\164\151\146
-\151\143\141\164\151\157\156\040\101\165\164\150\157\162\151\164
-\171\040\105\103\103\060\166\060\020\006\007\052\206\110\316\075
-\002\001\006\005\053\201\004\000\042\003\142\000\004\252\022\107
-\220\230\033\373\357\303\100\007\203\040\116\361\060\202\242\006
-\321\362\222\206\141\362\366\041\150\312\000\304\307\352\103\000
-\124\206\334\375\037\337\000\270\101\142\134\334\160\026\062\336
-\037\231\324\314\305\007\310\010\037\141\026\007\121\075\175\134
-\007\123\343\065\070\214\337\315\237\331\056\015\112\266\031\056
-\132\160\132\006\355\276\360\241\260\312\320\011\051\243\143\060
-\141\060\035\006\003\125\035\016\004\026\004\024\133\312\136\345
-\336\322\201\252\315\250\055\144\121\266\331\162\233\227\346\117
-\060\017\006\003\125\035\023\001\001\377\004\005\060\003\001\001
-\377\060\037\006\003\125\035\043\004\030\060\026\200\024\133\312
-\136\345\336\322\201\252\315\250\055\144\121\266\331\162\233\227
-\346\117\060\016\006\003\125\035\017\001\001\377\004\004\003\002
-\001\206\060\012\006\010\052\206\110\316\075\004\003\002\003\150
-\000\060\145\002\061\000\212\346\100\211\067\353\351\325\023\331
-\312\324\153\044\363\260\075\207\106\130\032\354\261\337\157\373
-\126\272\160\153\307\070\314\350\261\214\117\017\367\361\147\166
-\016\203\320\036\121\217\002\060\075\366\043\050\046\114\306\140
-\207\223\046\233\262\065\036\272\326\367\074\321\034\316\372\045
-\074\246\032\201\025\133\363\022\017\154\356\145\212\311\207\250
-\371\007\340\142\232\214\134\112
-END
-CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE
-
-# Trust for "SSL.com EV Root Certification Authority ECC"
-# Issuer: CN=SSL.com EV Root Certification Authority ECC,O=SSL Corporation,L=Houston,ST=Texas,C=US
-# Serial Number:2c:29:9c:5b:16:ed:05:95
-# Subject: CN=SSL.com EV Root Certification Authority ECC,O=SSL Corporation,L=Houston,ST=Texas,C=US
-# Not Valid Before: Fri Feb 12 18:15:23 2016
-# Not Valid After : Tue Feb 12 18:15:23 2041
-# Fingerprint (SHA-256): 22:A2:C1:F7:BD:ED:70:4C:C1:E7:01:B5:F4:08:C3:10:88:0F:E9:56:B5:DE:2A:4A:44:F9:9C:87:3A:25:A7:C8
-# Fingerprint (SHA1): 4C:DD:51:A3:D1:F5:20:32:14:B0:C6:C5:32:23:03:91:C7:46:42:6D
-CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST
-CKA_TOKEN CK_BBOOL CK_TRUE
-CKA_PRIVATE CK_BBOOL CK_FALSE
-CKA_MODIFIABLE CK_BBOOL CK_FALSE
-CKA_LABEL UTF8 "SSL.com EV Root Certification Authority ECC"
-CKA_CERT_SHA1_HASH MULTILINE_OCTAL
-\114\335\121\243\321\365\040\062\024\260\306\305\062\043\003\221
-\307\106\102\155
-END
-CKA_CERT_MD5_HASH MULTILINE_OCTAL
-\131\123\042\145\203\102\001\124\300\316\102\271\132\174\362\220
-END
-CKA_ISSUER MULTILINE_OCTAL
-\060\177\061\013\060\011\006\003\125\004\006\023\002\125\123\061
-\016\060\014\006\003\125\004\010\014\005\124\145\170\141\163\061
-\020\060\016\006\003\125\004\007\014\007\110\157\165\163\164\157
-\156\061\030\060\026\006\003\125\004\012\014\017\123\123\114\040
-\103\157\162\160\157\162\141\164\151\157\156\061\064\060\062\006
-\003\125\004\003\014\053\123\123\114\056\143\157\155\040\105\126
-\040\122\157\157\164\040\103\145\162\164\151\146\151\143\141\164
-\151\157\156\040\101\165\164\150\157\162\151\164\171\040\105\103
-\103
-END
-CKA_SERIAL_NUMBER MULTILINE_OCTAL
-\002\010\054\051\234\133\026\355\005\225
-END
-CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR
-CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST
-CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE
diff --git a/security/nss/lib/ckfw/builtins/nssckbi.h b/security/nss/lib/ckfw/builtins/nssckbi.h
index 0189369b1b..498751d13d 100644
--- a/security/nss/lib/ckfw/builtins/nssckbi.h
+++ b/security/nss/lib/ckfw/builtins/nssckbi.h
@@ -46,8 +46,8 @@
* It's recommend to switch back to 0 after having reached version 98/99.
*/
#define NSS_BUILTINS_LIBRARY_VERSION_MAJOR 2
-#define NSS_BUILTINS_LIBRARY_VERSION_MINOR 22
-#define NSS_BUILTINS_LIBRARY_VERSION "2.22"
+#define NSS_BUILTINS_LIBRARY_VERSION_MINOR 16
+#define NSS_BUILTINS_LIBRARY_VERSION "2.16"
/* These version numbers detail the semantic changes to the ckfw engine. */
#define NSS_BUILTINS_HARDWARE_VERSION_MAJOR 1
diff --git a/security/nss/lib/ckfw/capi/cfind.c b/security/nss/lib/ckfw/capi/cfind.c
index 9c4d4f1e77..9ea7fca61c 100644
--- a/security/nss/lib/ckfw/capi/cfind.c
+++ b/security/nss/lib/ckfw/capi/cfind.c
@@ -331,7 +331,8 @@ collect_class(
nss_ZFreeIf(keyProvInfo);
if (provName &&
- (strncmp(provName, "Microsoft", sizeof("Microsoft") - 1) != 0)) {
+ (strncmp(provName, "Microsoft", sizeof("Microsoft") -
+ 1) != 0)) {
continue;
}
} else {
diff --git a/security/nss/lib/cryptohi/cryptohi.h b/security/nss/lib/cryptohi/cryptohi.h
index e529fa34f5..f658daa9ef 100644
--- a/security/nss/lib/cryptohi/cryptohi.h
+++ b/security/nss/lib/cryptohi/cryptohi.h
@@ -60,14 +60,6 @@ extern SECItem *DSAU_DecodeDerSigToLen(const SECItem *item, unsigned int len);
extern SGNContext *SGN_NewContext(SECOidTag alg, SECKEYPrivateKey *privKey);
/*
-** Create a new signature context from an algorithmID.
-** "alg" the signature algorithm to use
-** "privKey" the private key to use
-*/
-extern SGNContext *SGN_NewContextWithAlgorithmID(SECAlgorithmID *alg,
- SECKEYPrivateKey *privKey);
-
-/*
** Destroy a signature-context object
** "cx" the object
** "freeit" if PR_TRUE then free the object as well as its sub-objects
@@ -114,21 +106,6 @@ extern SECStatus SEC_SignData(SECItem *result,
SECKEYPrivateKey *pk, SECOidTag algid);
/*
-** Sign a single block of data using private key encryption and given
-** signature/hash algorithm with parameters from an algorithmID.
-** "result" the final signature data (memory is allocated)
-** "buf" the input data to sign
-** "len" the amount of data to sign
-** "pk" the private key to encrypt with
-** "algid" the signature/hash algorithm to sign with
-** (must be compatible with the key type).
-*/
-extern SECStatus SEC_SignDataWithAlgorithmID(SECItem *result,
- const unsigned char *buf, int len,
- SECKEYPrivateKey *pk,
- SECAlgorithmID *algid);
-
-/*
** Sign a pre-digested block of data using private key encryption, encoding
** The given signature/hash algorithm.
** "result" the final signature data (memory is allocated)
@@ -155,27 +132,6 @@ extern SECStatus SEC_DerSignData(PLArenaPool *arena, SECItem *result,
SECKEYPrivateKey *pk, SECOidTag algid);
/*
-** DER sign a single block of data using private key encryption and
-** the given signature/hash algorithm with parameters from an
-** algorithmID. This routine first computes a digital signature using
-** SEC_SignData, then wraps it with an CERTSignedData and then der
-** encodes the result.
-** "arena" is the memory arena to use to allocate data from
-** "result" the final der encoded data (memory is allocated)
-** "buf" the input data to sign
-** "len" the amount of data to sign
-** "pk" the private key to encrypt with
-** "algid" the signature/hash algorithm to sign with
-** (must be compatible with the key type).
-*/
-extern SECStatus SEC_DerSignDataWithAlgorithmID(PLArenaPool *arena,
- SECItem *result,
- const unsigned char *buf,
- int len,
- SECKEYPrivateKey *pk,
- SECAlgorithmID *algid);
-
-/*
** Destroy a signed-data object.
** "sd" the object
** "freeit" if PR_TRUE then free the object as well as its sub-objects
@@ -190,23 +146,6 @@ extern void SEC_DestroySignedData(CERTSignedData *sd, PRBool freeit);
extern SECOidTag SEC_GetSignatureAlgorithmOidTag(KeyType keyType,
SECOidTag hashAlgTag);
-/*
-** Create algorithm parameters for signing. Return a new item
-** allocated from arena, or NULL on failure.
-** "arena" is the memory arena to use to allocate data from
-** "result" the encoded parameters (memory is allocated)
-** "signAlgTag" is the signing algorithm
-** "hashAlgTag" is the preferred hash algorithm
-** "params" is the default parameters
-** "key" is the private key
-*/
-extern SECItem *SEC_CreateSignatureAlgorithmParameters(PLArenaPool *arena,
- SECItem *result,
- SECOidTag signAlgTag,
- SECOidTag hashAlgTag,
- const SECItem *params,
- const SECKEYPrivateKey *key);
-
/****************************************/
/*
** Signature verification operations
diff --git a/security/nss/lib/cryptohi/keyi.h b/security/nss/lib/cryptohi/keyi.h
index ee11fc905e..f8f5f7f7da 100644
--- a/security/nss/lib/cryptohi/keyi.h
+++ b/security/nss/lib/cryptohi/keyi.h
@@ -17,9 +17,6 @@ KeyType seckey_GetKeyType(SECOidTag pubKeyOid);
SECStatus sec_DecodeSigAlg(const SECKEYPublicKey *key, SECOidTag sigAlg,
const SECItem *param, SECOidTag *encalg, SECOidTag *hashalg);
-SECStatus sec_RSAPSSParamsToMechanism(CK_RSA_PKCS_PSS_PARAMS *mech,
- const SECKEYRSAPSSParams *params);
-
SEC_END_PROTOS
#endif /* _KEYHI_H_ */
diff --git a/security/nss/lib/cryptohi/seckey.c b/security/nss/lib/cryptohi/seckey.c
index 0f9353f3be..9ea48b7677 100644
--- a/security/nss/lib/cryptohi/seckey.c
+++ b/security/nss/lib/cryptohi/seckey.c
@@ -221,7 +221,8 @@ SECKEY_CreateECPrivateKey(SECKEYECParams *param, SECKEYPublicKey **pubk, void *c
PK11_ATTR_SESSION |
PK11_ATTR_INSENSITIVE |
PK11_ATTR_PUBLIC,
- CKF_DERIVE, CKF_DERIVE | CKF_SIGN,
+ CKF_DERIVE, CKF_DERIVE |
+ CKF_SIGN,
cx);
if (!privk)
privk = PK11_GenerateKeyPairWithOpFlags(slot, CKM_EC_KEY_PAIR_GEN,
@@ -229,7 +230,8 @@ SECKEY_CreateECPrivateKey(SECKEYECParams *param, SECKEYPublicKey **pubk, void *c
PK11_ATTR_SESSION |
PK11_ATTR_SENSITIVE |
PK11_ATTR_PRIVATE,
- CKF_DERIVE, CKF_DERIVE | CKF_SIGN,
+ CKF_DERIVE, CKF_DERIVE |
+ CKF_SIGN,
cx);
PK11_FreeSlot(slot);
@@ -1046,7 +1048,6 @@ SECKEY_SignatureLen(const SECKEYPublicKey *pubk)
switch (pubk->keyType) {
case rsaKey:
- case rsaPssKey:
b0 = pubk->u.rsa.modulus.data[0];
return b0 ? pubk->u.rsa.modulus.len : pubk->u.rsa.modulus.len - 1;
case dsaKey:
@@ -1973,118 +1974,3 @@ SECKEY_GetECCOid(const SECKEYECParams *params)
return oidData->offset;
}
-
-static CK_MECHANISM_TYPE
-sec_GetHashMechanismByOidTag(SECOidTag tag)
-{
- switch (tag) {
- case SEC_OID_SHA512:
- return CKM_SHA512;
- case SEC_OID_SHA384:
- return CKM_SHA384;
- case SEC_OID_SHA256:
- return CKM_SHA256;
- case SEC_OID_SHA224:
- return CKM_SHA224;
- case SEC_OID_SHA1:
- return CKM_SHA_1;
- default:
- PORT_SetError(SEC_ERROR_INVALID_ALGORITHM);
- return CKM_INVALID_MECHANISM;
- }
-}
-
-static CK_RSA_PKCS_MGF_TYPE
-sec_GetMgfTypeByOidTag(SECOidTag tag)
-{
- switch (tag) {
- case SEC_OID_SHA512:
- return CKG_MGF1_SHA512;
- case SEC_OID_SHA384:
- return CKG_MGF1_SHA384;
- case SEC_OID_SHA256:
- return CKG_MGF1_SHA256;
- case SEC_OID_SHA224:
- return CKG_MGF1_SHA224;
- case SEC_OID_SHA1:
- return CKG_MGF1_SHA1;
- default:
- PORT_SetError(SEC_ERROR_INVALID_ALGORITHM);
- return 0;
- }
-}
-
-SECStatus
-sec_RSAPSSParamsToMechanism(CK_RSA_PKCS_PSS_PARAMS *mech,
- const SECKEYRSAPSSParams *params)
-{
- SECStatus rv = SECSuccess;
- SECOidTag hashAlgTag;
- unsigned long saltLength;
- unsigned long trailerField;
-
- PORT_Memset(mech, 0, sizeof(CK_RSA_PKCS_PSS_PARAMS));
-
- if (params->hashAlg) {
- hashAlgTag = SECOID_GetAlgorithmTag(params->hashAlg);
- } else {
- hashAlgTag = SEC_OID_SHA1; /* default, SHA-1 */
- }
- mech->hashAlg = sec_GetHashMechanismByOidTag(hashAlgTag);
- if (mech->hashAlg == CKM_INVALID_MECHANISM) {
- return SECFailure;
- }
-
- if (params->maskAlg) {
- SECAlgorithmID maskHashAlg;
- SECOidTag maskHashAlgTag;
- PORTCheapArenaPool tmpArena;
-
- if (SECOID_GetAlgorithmTag(params->maskAlg) != SEC_OID_PKCS1_MGF1) {
- /* only MGF1 is known to PKCS#11 */
- PORT_SetError(SEC_ERROR_INVALID_ALGORITHM);
- return SECFailure;
- }
-
- PORT_InitCheapArena(&tmpArena, DER_DEFAULT_CHUNKSIZE);
- rv = SEC_QuickDERDecodeItem(&tmpArena.arena, &maskHashAlg,
- SEC_ASN1_GET(SECOID_AlgorithmIDTemplate),
- &params->maskAlg->parameters);
- PORT_DestroyCheapArena(&tmpArena);
- if (rv != SECSuccess) {
- return rv;
- }
- maskHashAlgTag = SECOID_GetAlgorithmTag(&maskHashAlg);
- mech->mgf = sec_GetMgfTypeByOidTag(maskHashAlgTag);
- if (mech->mgf == 0) {
- return SECFailure;
- }
- } else {
- mech->mgf = CKG_MGF1_SHA1; /* default, MGF1 with SHA-1 */
- }
-
- if (params->saltLength.data) {
- rv = SEC_ASN1DecodeInteger((SECItem *)&params->saltLength, &saltLength);
- if (rv != SECSuccess) {
- return rv;
- }
- } else {
- saltLength = 20; /* default, 20 */
- }
- mech->sLen = saltLength;
-
- if (params->trailerField.data) {
- rv = SEC_ASN1DecodeInteger((SECItem *)&params->trailerField, &trailerField);
- if (rv != SECSuccess) {
- return rv;
- }
- if (trailerField != 1) {
- /* the value must be 1, which represents the trailer field
- * with hexadecimal value 0xBC */
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- return SECFailure;
- }
- }
-
- return rv;
-}
diff --git a/security/nss/lib/cryptohi/secsign.c b/security/nss/lib/cryptohi/secsign.c
index dc10f2fa60..d06cb2e852 100644
--- a/security/nss/lib/cryptohi/secsign.c
+++ b/security/nss/lib/cryptohi/secsign.c
@@ -22,11 +22,10 @@ struct SGNContextStr {
void *hashcx;
const SECHashObject *hashobj;
SECKEYPrivateKey *key;
- SECItem *params;
};
-static SGNContext *
-sgn_NewContext(SECOidTag alg, SECItem *params, SECKEYPrivateKey *key)
+SGNContext *
+SGN_NewContext(SECOidTag alg, SECKEYPrivateKey *key)
{
SGNContext *cx;
SECOidTag hashalg, signalg;
@@ -41,7 +40,7 @@ sgn_NewContext(SECOidTag alg, SECItem *params, SECKEYPrivateKey *key)
* it may just support CKM_SHA1_RSA_PKCS and/or CKM_MD5_RSA_PKCS.
*/
/* we have a private key, not a public key, so don't pass it in */
- rv = sec_DecodeSigAlg(NULL, alg, params, &signalg, &hashalg);
+ rv = sec_DecodeSigAlg(NULL, alg, NULL, &signalg, &hashalg);
if (rv != SECSuccess) {
PORT_SetError(SEC_ERROR_INVALID_ALGORITHM);
return 0;
@@ -50,8 +49,7 @@ sgn_NewContext(SECOidTag alg, SECItem *params, SECKEYPrivateKey *key)
/* verify our key type */
if (key->keyType != keyType &&
- !((key->keyType == dsaKey) && (keyType == fortezzaKey)) &&
- !((key->keyType == rsaKey) && (keyType == rsaPssKey))) {
+ !((key->keyType == dsaKey) && (keyType == fortezzaKey))) {
PORT_SetError(SEC_ERROR_INVALID_ALGORITHM);
return 0;
}
@@ -61,24 +59,10 @@ sgn_NewContext(SECOidTag alg, SECItem *params, SECKEYPrivateKey *key)
cx->hashalg = hashalg;
cx->signalg = signalg;
cx->key = key;
- cx->params = params;
}
return cx;
}
-SGNContext *
-SGN_NewContext(SECOidTag alg, SECKEYPrivateKey *key)
-{
- return sgn_NewContext(alg, NULL, key);
-}
-
-SGNContext *
-SGN_NewContextWithAlgorithmID(SECAlgorithmID *alg, SECKEYPrivateKey *key)
-{
- SECOidTag tag = SECOID_GetAlgorithmTag(alg);
- return sgn_NewContext(tag, &alg->parameters, key);
-}
-
void
SGN_DestroyContext(SGNContext *cx, PRBool freeit)
{
@@ -164,7 +148,6 @@ SGN_End(SGNContext *cx, SECItem *result)
result->data = 0;
digder.data = 0;
- sigitem.data = 0;
/* Finish up digest function */
if (cx->hashcx == NULL) {
@@ -173,8 +156,7 @@ SGN_End(SGNContext *cx, SECItem *result)
}
(*cx->hashobj->end)(cx->hashcx, digest, &part1, sizeof(digest));
- if (privKey->keyType == rsaKey &&
- cx->signalg != SEC_OID_PKCS1_RSA_PSS_SIGNATURE) {
+ if (privKey->keyType == rsaKey) {
arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
if (!arena) {
@@ -218,65 +200,26 @@ SGN_End(SGNContext *cx, SECItem *result)
goto loser;
}
- if (cx->signalg == SEC_OID_PKCS1_RSA_PSS_SIGNATURE) {
- CK_RSA_PKCS_PSS_PARAMS mech;
- SECItem mechItem = { siBuffer, (unsigned char *)&mech, sizeof(mech) };
-
- PORT_Memset(&mech, 0, sizeof(mech));
-
- if (cx->params && cx->params->data) {
- SECKEYRSAPSSParams params;
-
- arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
- if (!arena) {
- rv = SECFailure;
- goto loser;
- }
-
- PORT_Memset(&params, 0, sizeof(params));
- rv = SEC_QuickDERDecodeItem(arena, &params,
- SECKEY_RSAPSSParamsTemplate,
- cx->params);
- if (rv != SECSuccess) {
- goto loser;
- }
- rv = sec_RSAPSSParamsToMechanism(&mech, &params);
- if (rv != SECSuccess) {
- goto loser;
- }
- } else {
- mech.hashAlg = CKM_SHA_1;
- mech.mgf = CKG_MGF1_SHA1;
- mech.sLen = digder.len;
- }
- rv = PK11_SignWithMechanism(privKey, CKM_RSA_PKCS_PSS, &mechItem,
- &sigitem, &digder);
- if (rv != SECSuccess) {
- goto loser;
- }
- } else {
- rv = PK11_Sign(privKey, &sigitem, &digder);
- if (rv != SECSuccess) {
- goto loser;
- }
+ rv = PK11_Sign(privKey, &sigitem, &digder);
+ if (rv != SECSuccess) {
+ PORT_Free(sigitem.data);
+ sigitem.data = NULL;
+ goto loser;
}
if ((cx->signalg == SEC_OID_ANSIX9_DSA_SIGNATURE) ||
(cx->signalg == SEC_OID_ANSIX962_EC_PUBLIC_KEY)) {
/* DSAU_EncodeDerSigWithLen works for DSA and ECDSA */
rv = DSAU_EncodeDerSigWithLen(result, &sigitem, sigitem.len);
+ PORT_Free(sigitem.data);
if (rv != SECSuccess)
goto loser;
- SECITEM_FreeItem(&sigitem, PR_FALSE);
} else {
result->len = sigitem.len;
result->data = sigitem.data;
}
loser:
- if (rv != SECSuccess) {
- SECITEM_FreeItem(&sigitem, PR_FALSE);
- }
SGN_DestroyDigestInfo(di);
if (arena != NULL) {
PORT_FreeArena(arena, PR_FALSE);
@@ -286,14 +229,18 @@ loser:
/************************************************************************/
-static SECStatus
-sec_SignData(SECItem *res, const unsigned char *buf, int len,
- SECKEYPrivateKey *pk, SECOidTag algid, SECItem *params)
+/*
+** Sign a block of data returning in result a bunch of bytes that are the
+** signature. Returns zero on success, an error code on failure.
+*/
+SECStatus
+SEC_SignData(SECItem *res, const unsigned char *buf, int len,
+ SECKEYPrivateKey *pk, SECOidTag algid)
{
SECStatus rv;
SGNContext *sgn;
- sgn = sgn_NewContext(algid, params, pk);
+ sgn = SGN_NewContext(algid, pk);
if (sgn == NULL)
return SECFailure;
@@ -313,25 +260,6 @@ loser:
return rv;
}
-/*
-** Sign a block of data returning in result a bunch of bytes that are the
-** signature. Returns zero on success, an error code on failure.
-*/
-SECStatus
-SEC_SignData(SECItem *res, const unsigned char *buf, int len,
- SECKEYPrivateKey *pk, SECOidTag algid)
-{
- return sec_SignData(res, buf, len, pk, algid, NULL);
-}
-
-SECStatus
-SEC_SignDataWithAlgorithmID(SECItem *res, const unsigned char *buf, int len,
- SECKEYPrivateKey *pk, SECAlgorithmID *algid)
-{
- SECOidTag tag = SECOID_GetAlgorithmTag(algid);
- return sec_SignData(res, buf, len, pk, tag, &algid->parameters);
-}
-
/************************************************************************/
DERTemplate CERTSignedDataTemplate[] =
@@ -366,10 +294,10 @@ const SEC_ASN1Template CERT_SignedDataTemplate[] =
SEC_ASN1_CHOOSER_IMPLEMENT(CERT_SignedDataTemplate)
-static SECStatus
-sec_DerSignData(PLArenaPool *arena, SECItem *result,
+SECStatus
+SEC_DerSignData(PLArenaPool *arena, SECItem *result,
const unsigned char *buf, int len, SECKEYPrivateKey *pk,
- SECOidTag algID, SECItem *params)
+ SECOidTag algID)
{
SECItem it;
CERTSignedData sd;
@@ -411,7 +339,7 @@ sec_DerSignData(PLArenaPool *arena, SECItem *result,
}
/* Sign input buffer */
- rv = sec_SignData(&it, buf, len, pk, algID, params);
+ rv = SEC_SignData(&it, buf, len, pk, algID);
if (rv)
goto loser;
@@ -421,7 +349,7 @@ sec_DerSignData(PLArenaPool *arena, SECItem *result,
sd.data.len = len;
sd.signature.data = it.data;
sd.signature.len = it.len << 3; /* convert to bit string */
- rv = SECOID_SetAlgorithmID(arena, &sd.signatureAlgorithm, algID, params);
+ rv = SECOID_SetAlgorithmID(arena, &sd.signatureAlgorithm, algID, 0);
if (rv)
goto loser;
@@ -435,24 +363,6 @@ loser:
}
SECStatus
-SEC_DerSignData(PLArenaPool *arena, SECItem *result,
- const unsigned char *buf, int len, SECKEYPrivateKey *pk,
- SECOidTag algID)
-{
- return sec_DerSignData(arena, result, buf, len, pk, algID, NULL);
-}
-
-SECStatus
-SEC_DerSignDataWithAlgorithmID(PLArenaPool *arena, SECItem *result,
- const unsigned char *buf, int len,
- SECKEYPrivateKey *pk,
- SECAlgorithmID *algID)
-{
- SECOidTag tag = SECOID_GetAlgorithmTag(algID);
- return sec_DerSignData(arena, result, buf, len, pk, tag, &algID->parameters);
-}
-
-SECStatus
SGN_Digest(SECKEYPrivateKey *privKey,
SECOidTag algtag, SECItem *result, SECItem *digest)
{
@@ -599,243 +509,3 @@ SEC_GetSignatureAlgorithmOidTag(KeyType keyType, SECOidTag hashAlgTag)
}
return sigTag;
}
-
-static SECItem *
-sec_CreateRSAPSSParameters(PLArenaPool *arena,
- SECItem *result,
- SECOidTag hashAlgTag,
- const SECItem *params,
- const SECKEYPrivateKey *key)
-{
- SECKEYRSAPSSParams pssParams;
- int modBytes, hashLength;
- unsigned long saltLength;
- PRBool defaultSHA1 = PR_FALSE;
- SECStatus rv;
-
- if (key->keyType != rsaKey && key->keyType != rsaPssKey) {
- PORT_SetError(SEC_ERROR_INVALID_ALGORITHM);
- return NULL;
- }
-
- PORT_Memset(&pssParams, 0, sizeof(pssParams));
-
- if (params && params->data) {
- /* The parameters field should either be empty or contain
- * valid RSA-PSS parameters */
- PORT_Assert(!(params->len == 2 &&
- params->data[0] == SEC_ASN1_NULL &&
- params->data[1] == 0));
- rv = SEC_QuickDERDecodeItem(arena, &pssParams,
- SECKEY_RSAPSSParamsTemplate,
- params);
- if (rv != SECSuccess) {
- return NULL;
- }
- defaultSHA1 = PR_TRUE;
- }
-
- if (pssParams.trailerField.data) {
- unsigned long trailerField;
-
- rv = SEC_ASN1DecodeInteger((SECItem *)&pssParams.trailerField,
- &trailerField);
- if (rv != SECSuccess) {
- return NULL;
- }
- if (trailerField != 1) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- return NULL;
- }
- }
-
- modBytes = PK11_GetPrivateModulusLen((SECKEYPrivateKey *)key);
-
- /* Determine the hash algorithm to use, based on hashAlgTag and
- * pssParams.hashAlg; there are four cases */
- if (hashAlgTag != SEC_OID_UNKNOWN) {
- SECOidTag tag = SEC_OID_UNKNOWN;
-
- if (pssParams.hashAlg) {
- tag = SECOID_GetAlgorithmTag(pssParams.hashAlg);
- } else if (defaultSHA1) {
- tag = SEC_OID_SHA1;
- }
-
- if (tag != SEC_OID_UNKNOWN && tag != hashAlgTag) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- return NULL;
- }
- } else if (hashAlgTag == SEC_OID_UNKNOWN) {
- if (pssParams.hashAlg) {
- hashAlgTag = SECOID_GetAlgorithmTag(pssParams.hashAlg);
- } else if (defaultSHA1) {
- hashAlgTag = SEC_OID_SHA1;
- } else {
- /* Find a suitable hash algorithm based on the NIST recommendation */
- if (modBytes <= 384) { /* 128, in NIST 800-57, Part 1 */
- hashAlgTag = SEC_OID_SHA256;
- } else if (modBytes <= 960) { /* 192, NIST 800-57, Part 1 */
- hashAlgTag = SEC_OID_SHA384;
- } else {
- hashAlgTag = SEC_OID_SHA512;
- }
- }
- }
-
- if (hashAlgTag != SEC_OID_SHA1 && hashAlgTag != SEC_OID_SHA224 &&
- hashAlgTag != SEC_OID_SHA256 && hashAlgTag != SEC_OID_SHA384 &&
- hashAlgTag != SEC_OID_SHA512) {
- PORT_SetError(SEC_ERROR_INVALID_ALGORITHM);
- return NULL;
- }
-
- /* Now that the hash algorithm is decided, check if it matches the
- * existing parameters if any */
- if (pssParams.maskAlg) {
- SECAlgorithmID maskHashAlg;
-
- if (SECOID_GetAlgorithmTag(pssParams.maskAlg) != SEC_OID_PKCS1_MGF1) {
- PORT_SetError(SEC_ERROR_INVALID_ALGORITHM);
- return NULL;
- }
-
- if (pssParams.maskAlg->parameters.data == NULL) {
- PORT_SetError(SEC_ERROR_INVALID_ALGORITHM);
- return NULL;
- }
-
- PORT_Memset(&maskHashAlg, 0, sizeof(maskHashAlg));
- rv = SEC_QuickDERDecodeItem(arena, &maskHashAlg,
- SEC_ASN1_GET(SECOID_AlgorithmIDTemplate),
- &pssParams.maskAlg->parameters);
- if (rv != SECSuccess) {
- return NULL;
- }
-
- /* Following the recommendation in RFC 4055, assume the hash
- * algorithm identical to pssParam.hashAlg */
- if (SECOID_GetAlgorithmTag(&maskHashAlg) != hashAlgTag) {
- PORT_SetError(SEC_ERROR_INVALID_ALGORITHM);
- return NULL;
- }
- } else if (defaultSHA1) {
- if (hashAlgTag != SEC_OID_SHA1) {
- PORT_SetError(SEC_ERROR_INVALID_ALGORITHM);
- return NULL;
- }
- }
-
- hashLength = HASH_ResultLenByOidTag(hashAlgTag);
-
- if (pssParams.saltLength.data) {
- rv = SEC_ASN1DecodeInteger((SECItem *)&pssParams.saltLength,
- &saltLength);
- if (rv != SECSuccess) {
- return NULL;
- }
-
- /* The specified salt length is too long */
- if (saltLength > modBytes - hashLength - 2) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- return NULL;
- }
- } else if (defaultSHA1) {
- saltLength = 20;
- }
-
- /* Fill in the parameters */
- if (pssParams.hashAlg) {
- if (hashAlgTag == SEC_OID_SHA1) {
- /* Omit hashAlg if the the algorithm is SHA-1 (default) */
- pssParams.hashAlg = NULL;
- }
- } else {
- if (hashAlgTag != SEC_OID_SHA1) {
- pssParams.hashAlg = PORT_ArenaZAlloc(arena, sizeof(SECAlgorithmID));
- if (!pssParams.hashAlg) {
- return NULL;
- }
- rv = SECOID_SetAlgorithmID(arena, pssParams.hashAlg, hashAlgTag,
- NULL);
- if (rv != SECSuccess) {
- return NULL;
- }
- }
- }
-
- if (pssParams.maskAlg) {
- if (hashAlgTag == SEC_OID_SHA1) {
- /* Omit maskAlg if the the algorithm is SHA-1 (default) */
- pssParams.maskAlg = NULL;
- }
- } else {
- if (hashAlgTag != SEC_OID_SHA1) {
- SECItem *hashAlgItem;
-
- PORT_Assert(pssParams.hashAlg != NULL);
-
- hashAlgItem = SEC_ASN1EncodeItem(arena, NULL, pssParams.hashAlg,
- SEC_ASN1_GET(SECOID_AlgorithmIDTemplate));
- if (!hashAlgItem) {
- return NULL;
- }
- pssParams.maskAlg = PORT_ArenaZAlloc(arena, sizeof(SECAlgorithmID));
- if (!pssParams.maskAlg) {
- return NULL;
- }
- rv = SECOID_SetAlgorithmID(arena, pssParams.maskAlg,
- SEC_OID_PKCS1_MGF1, hashAlgItem);
- if (rv != SECSuccess) {
- return NULL;
- }
- }
- }
-
- if (pssParams.saltLength.data) {
- if (saltLength == 20) {
- /* Omit the salt length if it is the default */
- pssParams.saltLength.data = NULL;
- }
- } else {
- /* Find a suitable length from the hash algorithm and modulus bits */
- saltLength = PR_MIN(hashLength, modBytes - hashLength - 2);
-
- if (saltLength != 20 &&
- !SEC_ASN1EncodeInteger(arena, &pssParams.saltLength, saltLength)) {
- return NULL;
- }
- }
-
- if (pssParams.trailerField.data) {
- /* Omit trailerField if the value is 1 (default) */
- pssParams.trailerField.data = NULL;
- }
-
- return SEC_ASN1EncodeItem(arena, result,
- &pssParams, SECKEY_RSAPSSParamsTemplate);
-}
-
-SECItem *
-SEC_CreateSignatureAlgorithmParameters(PLArenaPool *arena,
- SECItem *result,
- SECOidTag signAlgTag,
- SECOidTag hashAlgTag,
- const SECItem *params,
- const SECKEYPrivateKey *key)
-{
- switch (signAlgTag) {
- case SEC_OID_PKCS1_RSA_PSS_SIGNATURE:
- return sec_CreateRSAPSSParameters(arena, result,
- hashAlgTag, params, key);
-
- default:
- if (params == NULL)
- return NULL;
- if (result == NULL)
- result = SECITEM_AllocItem(arena, NULL, 0);
- if (SECITEM_CopyItem(arena, result, params) != SECSuccess)
- return NULL;
- return result;
- }
-}
diff --git a/security/nss/lib/cryptohi/secvfy.c b/security/nss/lib/cryptohi/secvfy.c
index 83c9c579da..2ac21abd4d 100644
--- a/security/nss/lib/cryptohi/secvfy.c
+++ b/security/nss/lib/cryptohi/secvfy.c
@@ -136,8 +136,6 @@ struct VFYContextStr {
unsigned char dsasig[DSA_MAX_SIGNATURE_LEN];
/* the full ECDSA signature */
unsigned char ecdsasig[2 * MAX_ECKEY_LEN];
- /* the full RSA signature, only used in RSA-PSS */
- unsigned char rsasig[(RSA_MAX_MODULUS_BITS + 7) / 8];
} u;
unsigned int pkcs1RSADigestInfoLen;
/* the encoded DigestInfo from a RSA PKCS#1 signature */
@@ -150,7 +148,6 @@ struct VFYContextStr {
* VFY_CreateContext call. If false, the
* signature must be provided with a
* VFY_EndWithSignature call. */
- SECItem *params;
};
static SECStatus
@@ -253,37 +250,8 @@ sec_DecodeSigAlg(const SECKEYPublicKey *key, SECOidTag sigAlg,
*hashalg = SEC_OID_SHA1;
break;
case SEC_OID_PKCS1_RSA_ENCRYPTION:
- *hashalg = SEC_OID_UNKNOWN; /* get it from the RSA signature */
- break;
case SEC_OID_PKCS1_RSA_PSS_SIGNATURE:
- if (param && param->data) {
- SECKEYRSAPSSParams pssParam;
- arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
- if (arena == NULL) {
- return SECFailure;
- }
- PORT_Memset(&pssParam, 0, sizeof pssParam);
- rv = SEC_QuickDERDecodeItem(arena, &pssParam,
- SECKEY_RSAPSSParamsTemplate,
- param);
- if (rv != SECSuccess) {
- PORT_FreeArena(arena, PR_FALSE);
- return rv;
- }
- if (pssParam.hashAlg) {
- *hashalg = SECOID_GetAlgorithmTag(pssParam.hashAlg);
- } else {
- *hashalg = SEC_OID_SHA1; /* default, SHA-1 */
- }
- PORT_FreeArena(arena, PR_FALSE);
- /* only accept hash algorithms */
- if (HASH_GetHashTypeByOidTag(*hashalg) == HASH_AlgNULL) {
- /* error set by HASH_GetHashTypeByOidTag */
- return SECFailure;
- }
- } else {
- *hashalg = SEC_OID_SHA1; /* default, SHA-1 */
- }
+ *hashalg = SEC_OID_UNKNOWN; /* get it from the RSA signature */
break;
case SEC_OID_ANSIX962_ECDSA_SHA224_SIGNATURE:
@@ -466,20 +434,6 @@ vfy_CreateContext(const SECKEYPublicKey *key, const SECItem *sig,
cx->key,
sig, wincx);
break;
- case rsaPssKey:
- sigLen = SECKEY_SignatureLen(key);
- if (sigLen == 0) {
- /* error set by SECKEY_SignatureLen */
- rv = SECFailure;
- break;
- }
- if (sig->len != sigLen) {
- PORT_SetError(SEC_ERROR_BAD_SIGNATURE);
- rv = SECFailure;
- break;
- }
- PORT_Memcpy(cx->u.buffer, sig->data, sigLen);
- break;
case dsaKey:
case ecKey:
sigLen = SECKEY_SignatureLen(key);
@@ -542,7 +496,6 @@ VFYContext *
VFY_CreateContextWithAlgorithmID(const SECKEYPublicKey *key, const SECItem *sig,
const SECAlgorithmID *sigAlgorithm, SECOidTag *hash, void *wincx)
{
- VFYContext *cx;
SECOidTag encAlg, hashAlg;
SECStatus rv = sec_DecodeSigAlg(key,
SECOID_GetAlgorithmTag((SECAlgorithmID *)sigAlgorithm),
@@ -550,13 +503,7 @@ VFY_CreateContextWithAlgorithmID(const SECKEYPublicKey *key, const SECItem *sig,
if (rv != SECSuccess) {
return NULL;
}
-
- cx = vfy_CreateContext(key, sig, encAlg, hashAlg, hash, wincx);
- if (sigAlgorithm->parameters.data) {
- cx->params = SECITEM_DupItem(&sigAlgorithm->parameters);
- }
-
- return cx;
+ return vfy_CreateContext(key, sig, encAlg, hashAlg, hash, wincx);
}
void
@@ -573,9 +520,6 @@ VFY_DestroyContext(VFYContext *cx, PRBool freeit)
if (cx->pkcs1RSADigestInfo) {
PORT_Free(cx->pkcs1RSADigestInfo);
}
- if (cx->params) {
- SECITEM_FreeItem(cx->params, PR_TRUE);
- }
if (freeit) {
PORT_ZFree(cx, sizeof(VFYContext));
}
@@ -618,7 +562,7 @@ VFY_EndWithSignature(VFYContext *cx, SECItem *sig)
{
unsigned char final[HASH_LENGTH_MAX];
unsigned part;
- SECItem hash, rsasig, dsasig; /* dsasig is also used for ECDSA */
+ SECItem hash, dsasig; /* dsasig is also used for ECDSA */
SECStatus rv;
if ((cx->hasSignature == PR_FALSE) && (sig == NULL)) {
@@ -654,70 +598,25 @@ VFY_EndWithSignature(VFYContext *cx, SECItem *sig)
return SECFailure;
}
break;
- case rsaKey:
- if (cx->encAlg == SEC_OID_PKCS1_RSA_PSS_SIGNATURE) {
- CK_RSA_PKCS_PSS_PARAMS mech;
- SECItem mechItem = { siBuffer, (unsigned char *)&mech, sizeof(mech) };
- SECKEYRSAPSSParams params;
- PLArenaPool *arena;
-
- arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
- if (arena == NULL) {
- return SECFailure;
- }
-
- PORT_Memset(&params, 0, sizeof(params));
- rv = SEC_QuickDERDecodeItem(arena, &params,
- SECKEY_RSAPSSParamsTemplate,
- cx->params);
- if (rv != SECSuccess) {
- PORT_FreeArena(arena, PR_FALSE);
- return SECFailure;
- }
- rv = sec_RSAPSSParamsToMechanism(&mech, &params);
- PORT_FreeArena(arena, PR_FALSE);
+ case rsaKey: {
+ SECItem digest;
+ digest.data = final;
+ digest.len = part;
+ if (sig) {
+ SECOidTag hashid;
+ PORT_Assert(cx->hashAlg != SEC_OID_UNKNOWN);
+ rv = recoverPKCS1DigestInfo(cx->hashAlg, &hashid,
+ &cx->pkcs1RSADigestInfo,
+ &cx->pkcs1RSADigestInfoLen,
+ cx->key,
+ sig, cx->wincx);
+ PORT_Assert(cx->hashAlg == hashid);
if (rv != SECSuccess) {
return SECFailure;
}
- rsasig.data = cx->u.buffer;
- rsasig.len = SECKEY_SignatureLen(cx->key);
- if (rsasig.len == 0) {
- return SECFailure;
- }
- if (sig) {
- if (sig->len != rsasig.len) {
- PORT_SetError(SEC_ERROR_BAD_SIGNATURE);
- return SECFailure;
- }
- PORT_Memcpy(rsasig.data, sig->data, rsasig.len);
- }
- hash.data = final;
- hash.len = part;
- if (PK11_VerifyWithMechanism(cx->key, CKM_RSA_PKCS_PSS, &mechItem,
- &rsasig, &hash, cx->wincx) != SECSuccess) {
- PORT_SetError(SEC_ERROR_BAD_SIGNATURE);
- return SECFailure;
- }
- } else {
- SECItem digest;
- digest.data = final;
- digest.len = part;
- if (sig) {
- SECOidTag hashid;
- PORT_Assert(cx->hashAlg != SEC_OID_UNKNOWN);
- rv = recoverPKCS1DigestInfo(cx->hashAlg, &hashid,
- &cx->pkcs1RSADigestInfo,
- &cx->pkcs1RSADigestInfoLen,
- cx->key,
- sig, cx->wincx);
- PORT_Assert(cx->hashAlg == hashid);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- }
- return verifyPKCS1DigestInfo(cx, &digest);
}
- break;
+ return verifyPKCS1DigestInfo(cx, &digest);
+ }
default:
PORT_SetError(SEC_ERROR_BAD_SIGNATURE);
return SECFailure; /* shouldn't happen */
@@ -823,7 +722,7 @@ VFY_VerifyDigestWithAlgorithmID(const SECItem *digest,
static SECStatus
vfy_VerifyData(const unsigned char *buf, int len, const SECKEYPublicKey *key,
const SECItem *sig, SECOidTag encAlg, SECOidTag hashAlg,
- const SECItem *params, SECOidTag *hash, void *wincx)
+ SECOidTag *hash, void *wincx)
{
SECStatus rv;
VFYContext *cx;
@@ -831,9 +730,6 @@ vfy_VerifyData(const unsigned char *buf, int len, const SECKEYPublicKey *key,
cx = vfy_CreateContext(key, sig, encAlg, hashAlg, hash, wincx);
if (cx == NULL)
return SECFailure;
- if (params) {
- cx->params = SECITEM_DupItem(params);
- }
rv = VFY_Begin(cx);
if (rv == SECSuccess) {
@@ -852,7 +748,7 @@ VFY_VerifyDataDirect(const unsigned char *buf, int len,
SECOidTag encAlg, SECOidTag hashAlg,
SECOidTag *hash, void *wincx)
{
- return vfy_VerifyData(buf, len, key, sig, encAlg, hashAlg, NULL, hash, wincx);
+ return vfy_VerifyData(buf, len, key, sig, encAlg, hashAlg, hash, wincx);
}
SECStatus
@@ -864,7 +760,7 @@ VFY_VerifyData(const unsigned char *buf, int len, const SECKEYPublicKey *key,
if (rv != SECSuccess) {
return rv;
}
- return vfy_VerifyData(buf, len, key, sig, encAlg, hashAlg, NULL, NULL, wincx);
+ return vfy_VerifyData(buf, len, key, sig, encAlg, hashAlg, NULL, wincx);
}
SECStatus
@@ -881,6 +777,5 @@ VFY_VerifyDataWithAlgorithmID(const unsigned char *buf, int len,
if (rv != SECSuccess) {
return rv;
}
- return vfy_VerifyData(buf, len, key, sig, encAlg, hashAlg,
- &sigAlgorithm->parameters, hash, wincx);
+ return vfy_VerifyData(buf, len, key, sig, encAlg, hashAlg, hash, wincx);
}
diff --git a/security/nss/lib/dbm/src/h_page.c b/security/nss/lib/dbm/src/h_page.c
index e5623224b3..bf1252aeb5 100644
--- a/security/nss/lib/dbm/src/h_page.c
+++ b/security/nss/lib/dbm/src/h_page.c
@@ -426,9 +426,6 @@ ugly_split(HTAB *hashp, uint32 obucket, BUFHEAD *old_bufp,
last_bfp = NULL;
scopyto = (uint16)copyto; /* ANSI */
- if (ino[0] < 1) {
- return DATABASE_CORRUPTED_ERROR;
- }
n = ino[0] - 1;
while (n < ino[0]) {
@@ -466,13 +463,7 @@ ugly_split(HTAB *hashp, uint32 obucket, BUFHEAD *old_bufp,
* Fix up the old page -- the extra 2 are the fields
* which contained the overflow information.
*/
- if (ino[0] < (moved + 2)) {
- return DATABASE_CORRUPTED_ERROR;
- }
ino[0] -= (moved + 2);
- if (scopyto < sizeof(uint16) * (ino[0] + 3)) {
- return DATABASE_CORRUPTED_ERROR;
- }
FREESPACE(ino) =
scopyto - sizeof(uint16) * (ino[0] + 3);
OFFSET(ino) = scopyto;
@@ -495,14 +486,8 @@ ugly_split(HTAB *hashp, uint32 obucket, BUFHEAD *old_bufp,
for (n = 1; (n < ino[0]) && (ino[n + 1] >= REAL_KEY); n += 2) {
cino = (char *)ino;
key.data = (uint8 *)cino + ino[n];
- if (off < ino[n]) {
- return DATABASE_CORRUPTED_ERROR;
- }
key.size = off - ino[n];
val.data = (uint8 *)cino + ino[n + 1];
- if (ino[n] < ino[n + 1]) {
- return DATABASE_CORRUPTED_ERROR;
- }
val.size = ino[n] - ino[n + 1];
off = ino[n + 1];
diff --git a/security/nss/lib/dbm/src/hash.c b/security/nss/lib/dbm/src/hash.c
index 98b1c07c73..b80aad4d37 100644
--- a/security/nss/lib/dbm/src/hash.c
+++ b/security/nss/lib/dbm/src/hash.c
@@ -704,7 +704,8 @@ hash_put(
return (DBM_ERROR);
}
- rv = hash_access(hashp, flag == R_NOOVERWRITE ? HASH_PUTNEW : HASH_PUT,
+ rv = hash_access(hashp, flag == R_NOOVERWRITE ? HASH_PUTNEW
+ : HASH_PUT,
(DBT *)key, (DBT *)data);
if (rv == DATABASE_CORRUPTED_ERROR) {
diff --git a/security/nss/lib/dev/devutil.c b/security/nss/lib/dev/devutil.c
index 42ce03c972..b8f82c810b 100644
--- a/security/nss/lib/dev/devutil.c
+++ b/security/nss/lib/dev/devutil.c
@@ -32,21 +32,15 @@ nssCryptokiObject_Create(
/* a failure here indicates a device error */
return (nssCryptokiObject *)NULL;
}
- if (cert_template[0].ulValueLen == 0) {
- nss_ZFreeIf(cert_template[1].pValue);
- return (nssCryptokiObject *)NULL;
- }
object = nss_ZNEW(NULL, nssCryptokiObject);
if (!object) {
- nss_ZFreeIf(cert_template[0].pValue);
- nss_ZFreeIf(cert_template[1].pValue);
return (nssCryptokiObject *)NULL;
}
object->handle = h;
object->token = nssToken_AddRef(t);
isTokenObject = (CK_BBOOL *)cert_template[0].pValue;
object->isTokenObject = *isTokenObject;
- nss_ZFreeIf(cert_template[0].pValue);
+ nss_ZFreeIf(isTokenObject);
NSS_CK_ATTRIBUTE_TO_UTF8(&cert_template[1], object->label);
return object;
}
diff --git a/security/nss/lib/freebl/Makefile b/security/nss/lib/freebl/Makefile
index 0b3daa2756..914a0119c2 100644
--- a/security/nss/lib/freebl/Makefile
+++ b/security/nss/lib/freebl/Makefile
@@ -110,9 +110,7 @@ endif
# NSS_X86_OR_X64 means the target is either x86 or x64
ifeq (,$(filter-out i386 x386 x86 x86_64,$(CPU_ARCH)))
DEFINES += -DNSS_X86_OR_X64
- EXTRA_SRCS += gcm-x86.c aes-x86.c
-$(OBJDIR)/gcm-x86.o: CFLAGS += -mpclmul -maes
-$(OBJDIR)/aes-x86.o: CFLAGS += -mpclmul -maes
+ CFLAGS += -mpclmul -maes
ifneq (,$(USE_64)$(USE_X32))
DEFINES += -DNSS_X64
else
@@ -492,6 +490,8 @@ else
endif # Solaris for non-sparc family CPUs
endif # target == SunO
+# poly1305-donna-x64-sse2-incremental-source.c requires __int128 support
+# in GCC 4.6.0.
ifdef USE_64
ifdef CC_IS_CLANG
HAVE_INT128_SUPPORT = 1
@@ -508,41 +508,38 @@ ifdef USE_64
endif
endif
-ifndef HAVE_INT128_SUPPORT
- DEFINES += -DKRML_NOUINT128
-endif
-
ifndef NSS_DISABLE_CHACHAPOLY
ifeq ($(CPU_ARCH),x86_64)
ifdef HAVE_INT128_SUPPORT
- EXTRA_SRCS += Hacl_Poly1305_64.c
+ EXTRA_SRCS += poly1305-donna-x64-sse2-incremental-source.c
else
EXTRA_SRCS += poly1305.c
endif
ifneq (1,$(CC_IS_GCC))
EXTRA_SRCS += chacha20.c
- VERIFIED_SRCS += Hacl_Chacha20.c
else
EXTRA_SRCS += chacha20_vec.c
endif
else
EXTRA_SRCS += poly1305.c
EXTRA_SRCS += chacha20.c
- VERIFIED_SRCS += Hacl_Chacha20.c
endif # x86_64
endif # NSS_DISABLE_CHACHAPOLY
-ifeq (,$(filter-out i386 x386 x86 x86_64 aarch64,$(CPU_ARCH)))
+ifeq (,$(filter-out i386 x386 x86 x86_64,$(CPU_ARCH)))
# All intel architectures get the 64 bit version
# With custom uint128 if necessary (faster than generic 32 bit version).
ECL_SRCS += curve25519_64.c
- VERIFIED_SRCS += Hacl_Curve25519.c FStar.c
else
# All non intel architectures get the generic 32 bit implementation (slow!)
ECL_SRCS += curve25519_32.c
endif
+ifndef HAVE_INT128_SUPPORT
+ ECL_SRCS += uint128.c
+endif
+
#######################################################################
# (5) Execute "global" rules. (OPTIONAL) #
#######################################################################
@@ -566,12 +563,12 @@ rijndael_tables:
$(DEFINES) $(INCLUDES) $(OBJDIR)/libfreebl.a
$(OBJDIR)/make_rijndael_tab
-vpath %.h mpi ecl verified
-vpath %.c mpi ecl verified
+vpath %.h mpi ecl
+vpath %.c mpi ecl
vpath %.S mpi ecl
vpath %.s mpi ecl
vpath %.asm mpi ecl
-INCLUDES += -Impi -Iecl -Iverified
+INCLUDES += -Impi -Iecl
DEFINES += -DMP_API_COMPATIBLE
@@ -590,6 +587,8 @@ ECL_OBJS += $(addprefix $(OBJDIR)/$(PROG_PREFIX), $(ECL_USERS:.c=$(OBJ_SUFFIX)))
$(ECL_OBJS): $(ECL_HDRS)
+
+
$(OBJDIR)/sysrand$(OBJ_SUFFIX): sysrand.c unix_rand.c win_rand.c
$(OBJDIR)/$(PROG_PREFIX)mpprime$(OBJ_SUFFIX): primes.c
diff --git a/security/nss/lib/freebl/aes-x86.c b/security/nss/lib/freebl/aes-x86.c
deleted file mode 100644
index 830b4782fe..0000000000
--- a/security/nss/lib/freebl/aes-x86.c
+++ /dev/null
@@ -1,157 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifdef FREEBL_NO_DEPEND
-#include "stubs.h"
-#endif
-#include "rijndael.h"
-#include "secerr.h"
-
-#include <wmmintrin.h> /* aes-ni */
-
-#define EXPAND_KEY128(k, rcon, res) \
- tmp_key = _mm_aeskeygenassist_si128(k, rcon); \
- tmp_key = _mm_shuffle_epi32(tmp_key, 0xFF); \
- tmp = _mm_xor_si128(k, _mm_slli_si128(k, 4)); \
- tmp = _mm_xor_si128(tmp, _mm_slli_si128(tmp, 4)); \
- tmp = _mm_xor_si128(tmp, _mm_slli_si128(tmp, 4)); \
- res = _mm_xor_si128(tmp, tmp_key)
-
-static void
-native_key_expansion128(AESContext *cx, const unsigned char *key)
-{
- __m128i *keySchedule = cx->keySchedule;
- pre_align __m128i tmp_key post_align;
- pre_align __m128i tmp post_align;
- keySchedule[0] = _mm_loadu_si128((__m128i *)key);
- EXPAND_KEY128(keySchedule[0], 0x01, keySchedule[1]);
- EXPAND_KEY128(keySchedule[1], 0x02, keySchedule[2]);
- EXPAND_KEY128(keySchedule[2], 0x04, keySchedule[3]);
- EXPAND_KEY128(keySchedule[3], 0x08, keySchedule[4]);
- EXPAND_KEY128(keySchedule[4], 0x10, keySchedule[5]);
- EXPAND_KEY128(keySchedule[5], 0x20, keySchedule[6]);
- EXPAND_KEY128(keySchedule[6], 0x40, keySchedule[7]);
- EXPAND_KEY128(keySchedule[7], 0x80, keySchedule[8]);
- EXPAND_KEY128(keySchedule[8], 0x1B, keySchedule[9]);
- EXPAND_KEY128(keySchedule[9], 0x36, keySchedule[10]);
-}
-
-#define EXPAND_KEY192_PART1(res, k0, kt, rcon) \
- tmp2 = _mm_slli_si128(k0, 4); \
- tmp1 = _mm_xor_si128(k0, tmp2); \
- tmp2 = _mm_slli_si128(tmp2, 4); \
- tmp1 = _mm_xor_si128(_mm_xor_si128(tmp1, tmp2), _mm_slli_si128(tmp2, 4)); \
- tmp2 = _mm_aeskeygenassist_si128(kt, rcon); \
- res = _mm_xor_si128(tmp1, _mm_shuffle_epi32(tmp2, 0x55))
-
-#define EXPAND_KEY192_PART2(res, k1, k2) \
- tmp2 = _mm_xor_si128(k1, _mm_slli_si128(k1, 4)); \
- res = _mm_xor_si128(tmp2, _mm_shuffle_epi32(k2, 0xFF))
-
-#define EXPAND_KEY192(k0, res1, res2, res3, carry, rcon1, rcon2) \
- EXPAND_KEY192_PART1(tmp3, k0, res1, rcon1); \
- EXPAND_KEY192_PART2(carry, res1, tmp3); \
- res1 = _mm_castpd_si128(_mm_shuffle_pd(_mm_castsi128_pd(res1), \
- _mm_castsi128_pd(tmp3), 0)); \
- res2 = _mm_castpd_si128(_mm_shuffle_pd(_mm_castsi128_pd(tmp3), \
- _mm_castsi128_pd(carry), 1)); \
- EXPAND_KEY192_PART1(res3, tmp3, carry, rcon2)
-
-static void
-native_key_expansion192(AESContext *cx, const unsigned char *key)
-{
- __m128i *keySchedule = cx->keySchedule;
- pre_align __m128i tmp1 post_align;
- pre_align __m128i tmp2 post_align;
- pre_align __m128i tmp3 post_align;
- pre_align __m128i carry post_align;
- keySchedule[0] = _mm_loadu_si128((__m128i *)key);
- keySchedule[1] = _mm_loadu_si128((__m128i *)(key + 16));
- EXPAND_KEY192(keySchedule[0], keySchedule[1], keySchedule[2],
- keySchedule[3], carry, 0x1, 0x2);
- EXPAND_KEY192_PART2(keySchedule[4], carry, keySchedule[3]);
- EXPAND_KEY192(keySchedule[3], keySchedule[4], keySchedule[5],
- keySchedule[6], carry, 0x4, 0x8);
- EXPAND_KEY192_PART2(keySchedule[7], carry, keySchedule[6]);
- EXPAND_KEY192(keySchedule[6], keySchedule[7], keySchedule[8],
- keySchedule[9], carry, 0x10, 0x20);
- EXPAND_KEY192_PART2(keySchedule[10], carry, keySchedule[9]);
- EXPAND_KEY192(keySchedule[9], keySchedule[10], keySchedule[11],
- keySchedule[12], carry, 0x40, 0x80);
-}
-
-#define EXPAND_KEY256_PART(res, rconx, k1x, k2x, X) \
- tmp_key = _mm_shuffle_epi32(_mm_aeskeygenassist_si128(k2x, rconx), X); \
- tmp2 = _mm_slli_si128(k1x, 4); \
- tmp1 = _mm_xor_si128(k1x, tmp2); \
- tmp2 = _mm_slli_si128(tmp2, 4); \
- tmp1 = _mm_xor_si128(_mm_xor_si128(tmp1, tmp2), _mm_slli_si128(tmp2, 4)); \
- res = _mm_xor_si128(tmp1, tmp_key);
-
-#define EXPAND_KEY256(res1, res2, k1, k2, rcon) \
- EXPAND_KEY256_PART(res1, rcon, k1, k2, 0xFF); \
- EXPAND_KEY256_PART(res2, 0x00, k2, res1, 0xAA)
-
-static void
-native_key_expansion256(AESContext *cx, const unsigned char *key)
-{
- __m128i *keySchedule = cx->keySchedule;
- pre_align __m128i tmp_key post_align;
- pre_align __m128i tmp1 post_align;
- pre_align __m128i tmp2 post_align;
- keySchedule[0] = _mm_loadu_si128((__m128i *)key);
- keySchedule[1] = _mm_loadu_si128((__m128i *)(key + 16));
- EXPAND_KEY256(keySchedule[2], keySchedule[3], keySchedule[0],
- keySchedule[1], 0x01);
- EXPAND_KEY256(keySchedule[4], keySchedule[5], keySchedule[2],
- keySchedule[3], 0x02);
- EXPAND_KEY256(keySchedule[6], keySchedule[7], keySchedule[4],
- keySchedule[5], 0x04);
- EXPAND_KEY256(keySchedule[8], keySchedule[9], keySchedule[6],
- keySchedule[7], 0x08);
- EXPAND_KEY256(keySchedule[10], keySchedule[11], keySchedule[8],
- keySchedule[9], 0x10);
- EXPAND_KEY256(keySchedule[12], keySchedule[13], keySchedule[10],
- keySchedule[11], 0x20);
- EXPAND_KEY256_PART(keySchedule[14], 0x40, keySchedule[12],
- keySchedule[13], 0xFF);
-}
-
-/*
- * AES key expansion using aes-ni instructions.
- */
-void
-rijndael_native_key_expansion(AESContext *cx, const unsigned char *key,
- unsigned int Nk)
-{
- switch (Nk) {
- case 4:
- native_key_expansion128(cx, key);
- return;
- case 6:
- native_key_expansion192(cx, key);
- return;
- case 8:
- native_key_expansion256(cx, key);
- return;
- default:
- /* This shouldn't happen (checked by the caller). */
- return;
- }
-}
-
-void
-rijndael_native_encryptBlock(AESContext *cx,
- unsigned char *output,
- const unsigned char *input)
-{
- int i;
- pre_align __m128i m post_align = _mm_loadu_si128((__m128i *)input);
- m = _mm_xor_si128(m, cx->keySchedule[0]);
- for (i = 1; i < cx->Nr; ++i) {
- m = _mm_aesenc_si128(m, cx->keySchedule[i]);
- }
- m = _mm_aesenclast_si128(m, cx->keySchedule[cx->Nr]);
- _mm_storeu_si128((__m128i *)output, m);
-}
diff --git a/security/nss/lib/freebl/blake2b.c b/security/nss/lib/freebl/blake2b.c
deleted file mode 100644
index 4099c67e01..0000000000
--- a/security/nss/lib/freebl/blake2b.c
+++ /dev/null
@@ -1,430 +0,0 @@
-/*
- * blake2b.c - definitions for the blake2b hash function
- *
- * 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/. */
-
-#ifdef FREEBL_NO_DEPEND
-#include "stubs.h"
-#endif
-
-#include "secerr.h"
-#include "blapi.h"
-#include "blake2b.h"
-#include "crypto_primitives.h"
-
-/**
- * This contains the BLAKE2b initialization vectors.
- */
-static const uint64_t iv[8] = {
- 0x6a09e667f3bcc908ULL, 0xbb67ae8584caa73bULL, 0x3c6ef372fe94f82bULL,
- 0xa54ff53a5f1d36f1ULL, 0x510e527fade682d1ULL, 0x9b05688c2b3e6c1fULL,
- 0x1f83d9abfb41bd6bULL, 0x5be0cd19137e2179ULL
-};
-
-/**
- * This contains the table of permutations for blake2b compression function.
- */
-static const uint8_t sigma[12][16] = {
- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
- { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 },
- { 11, 8, 12, 0, 5, 2, 15, 13, 10, 14, 3, 6, 7, 1, 9, 4 },
- { 7, 9, 3, 1, 13, 12, 11, 14, 2, 6, 5, 10, 4, 0, 15, 8 },
- { 9, 0, 5, 7, 2, 4, 10, 15, 14, 1, 11, 12, 6, 8, 3, 13 },
- { 2, 12, 6, 10, 0, 11, 8, 3, 4, 13, 7, 5, 15, 14, 1, 9 },
- { 12, 5, 1, 15, 14, 13, 4, 10, 0, 7, 6, 3, 9, 2, 8, 11 },
- { 13, 11, 7, 14, 12, 1, 3, 9, 5, 0, 15, 4, 8, 6, 2, 10 },
- { 6, 15, 14, 9, 11, 3, 0, 8, 12, 2, 13, 7, 1, 4, 10, 5 },
- { 10, 2, 8, 4, 7, 6, 1, 5, 15, 11, 9, 14, 3, 12, 13, 0 },
- { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 },
- { 14, 10, 4, 8, 9, 15, 13, 6, 1, 12, 0, 2, 11, 7, 5, 3 }
-};
-
-/**
- * This function increments the blake2b ctx counter.
- */
-void
-blake2b_IncrementCounter(BLAKE2BContext* ctx, const uint64_t inc)
-{
- ctx->t[0] += inc;
- ctx->t[1] += ctx->t[0] < inc;
-}
-
-/**
- * This macro implements the blake2b mixing function which mixes two 8-byte
- * words from the message into the hash.
- */
-#define G(a, b, c, d, x, y) \
- a += b + x; \
- d = ROTR64(d ^ a, 32); \
- c += d; \
- b = ROTR64(b ^ c, 24); \
- a += b + y; \
- d = ROTR64(d ^ a, 16); \
- c += d; \
- b = ROTR64(b ^ c, 63)
-
-#define ROUND(i) \
- G(v[0], v[4], v[8], v[12], m[sigma[i][0]], m[sigma[i][1]]); \
- G(v[1], v[5], v[9], v[13], m[sigma[i][2]], m[sigma[i][3]]); \
- G(v[2], v[6], v[10], v[14], m[sigma[i][4]], m[sigma[i][5]]); \
- G(v[3], v[7], v[11], v[15], m[sigma[i][6]], m[sigma[i][7]]); \
- G(v[0], v[5], v[10], v[15], m[sigma[i][8]], m[sigma[i][9]]); \
- G(v[1], v[6], v[11], v[12], m[sigma[i][10]], m[sigma[i][11]]); \
- G(v[2], v[7], v[8], v[13], m[sigma[i][12]], m[sigma[i][13]]); \
- G(v[3], v[4], v[9], v[14], m[sigma[i][14]], m[sigma[i][15]])
-
-/**
- * The blake2b compression function which takes a full 128-byte chunk of the
- * input message and mixes it into the ongoing ctx array, i.e., permute the
- * ctx while xoring in the block of data.
- */
-void
-blake2b_Compress(BLAKE2BContext* ctx, const uint8_t* block)
-{
- size_t i;
- uint64_t v[16], m[16];
-
- PORT_Memcpy(m, block, BLAKE2B_BLOCK_LENGTH);
-#if !defined(IS_LITTLE_ENDIAN)
- for (i = 0; i < 16; ++i) {
- m[i] = FREEBL_HTONLL(m[i]);
- }
-#endif
-
- PORT_Memcpy(v, ctx->h, 8 * 8);
- PORT_Memcpy(v + 8, iv, 8 * 8);
-
- v[12] ^= ctx->t[0];
- v[13] ^= ctx->t[1];
- v[14] ^= ctx->f;
-
- ROUND(0);
- ROUND(1);
- ROUND(2);
- ROUND(3);
- ROUND(4);
- ROUND(5);
- ROUND(6);
- ROUND(7);
- ROUND(8);
- ROUND(9);
- ROUND(10);
- ROUND(11);
-
- for (i = 0; i < 8; i++) {
- ctx->h[i] ^= v[i] ^ v[i + 8];
- }
-}
-
-/**
- * This function can be used for both keyed and unkeyed version.
- */
-BLAKE2BContext*
-BLAKE2B_NewContext()
-{
- return PORT_ZNew(BLAKE2BContext);
-}
-
-/**
- * Zero and free the context and can be used for both keyed and unkeyed version.
- */
-void
-BLAKE2B_DestroyContext(BLAKE2BContext* ctx, PRBool freeit)
-{
- PORT_Memset(ctx, 0, sizeof(*ctx));
- if (freeit) {
- PORT_Free(ctx);
- }
-}
-
-/**
- * This function initializes blake2b ctx and can be used for both keyed and
- * unkeyed version. It also checks ctx and sets error states.
- */
-static SECStatus
-blake2b_Begin(BLAKE2BContext* ctx, uint8_t outlen, const uint8_t* key,
- size_t keylen)
-{
- PORT_Assert(ctx != NULL);
- if (!ctx) {
- goto failure;
- }
- if (outlen == 0 || outlen > BLAKE2B512_LENGTH) {
- goto failure;
- }
- if (key && keylen > BLAKE2B_KEY_SIZE) {
- goto failure;
- }
- /* Note: key can be null if it's unkeyed. */
- if ((key == NULL && keylen > 0) || keylen > BLAKE2B_KEY_SIZE ||
- (key != NULL && keylen == 0)) {
- goto failure;
- }
-
- /* Mix key size(keylen) and desired hash length(outlen) into h0 */
- uint64_t param = outlen ^ (keylen << 8) ^ (1 << 16) ^ (1 << 24);
- PORT_Memcpy(ctx->h, iv, 8 * 8);
- ctx->h[0] ^= param;
- ctx->outlen = outlen;
-
- /* This updates the context for only the keyed version */
- if (keylen > 0 && keylen <= BLAKE2B_KEY_SIZE && key) {
- uint8_t block[BLAKE2B_BLOCK_LENGTH] = { 0 };
- PORT_Memcpy(block, key, keylen);
- BLAKE2B_Update(ctx, block, BLAKE2B_BLOCK_LENGTH);
- PORT_Memset(block, 0, BLAKE2B_BLOCK_LENGTH);
- }
-
- return SECSuccess;
-
-failure:
- PORT_Memset(&ctx, 0, sizeof(ctx));
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- return SECFailure;
-}
-
-SECStatus
-BLAKE2B_Begin(BLAKE2BContext* ctx)
-{
- return blake2b_Begin(ctx, BLAKE2B512_LENGTH, NULL, 0);
-}
-
-SECStatus
-BLAKE2B_MAC_Begin(BLAKE2BContext* ctx, const PRUint8* key, const size_t keylen)
-{
- PORT_Assert(key != NULL);
- if (!key) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- return SECFailure;
- }
- return blake2b_Begin(ctx, BLAKE2B512_LENGTH, (const uint8_t*)key, keylen);
-}
-
-static void
-blake2b_IncrementCompress(BLAKE2BContext* ctx, size_t blockLength,
- const unsigned char* input)
-{
- blake2b_IncrementCounter(ctx, blockLength);
- blake2b_Compress(ctx, input);
-}
-
-/**
- * This function updates blake2b ctx and can be used for both keyed and unkeyed
- * version.
- */
-SECStatus
-BLAKE2B_Update(BLAKE2BContext* ctx, const unsigned char* in,
- unsigned int inlen)
-{
- size_t left = ctx->buflen;
- size_t fill = BLAKE2B_BLOCK_LENGTH - left;
-
- /* Nothing to do if there's nothing. */
- if (inlen == 0) {
- return SECSuccess;
- }
-
- PORT_Assert(ctx != NULL);
- PORT_Assert(in != NULL);
- PORT_Assert(left <= BLAKE2B_BLOCK_LENGTH);
- if (!ctx || !in) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- return SECFailure;
- }
-
- /* Is this a reused context? */
- if (ctx->f) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- return SECFailure;
- }
-
- if (inlen > fill) {
- if (ctx->buflen) {
- /* There's some remaining data in ctx->buf that we have to prepend
- * to in. */
- PORT_Memcpy(ctx->buf + left, in, fill);
- ctx->buflen = 0;
- blake2b_IncrementCompress(ctx, BLAKE2B_BLOCK_LENGTH, ctx->buf);
- in += fill;
- inlen -= fill;
- }
- while (inlen > BLAKE2B_BLOCK_LENGTH) {
- blake2b_IncrementCompress(ctx, BLAKE2B_BLOCK_LENGTH, in);
- in += BLAKE2B_BLOCK_LENGTH;
- inlen -= BLAKE2B_BLOCK_LENGTH;
- }
- }
-
- /* Store the remaining data from in in ctx->buf to process later.
- * Note that ctx->buflen can be BLAKE2B_BLOCK_LENGTH. We can't process that
- * here because we have to update ctx->f before compressing the last block.
- */
- PORT_Assert(inlen <= BLAKE2B_BLOCK_LENGTH);
- PORT_Memcpy(ctx->buf + ctx->buflen, in, inlen);
- ctx->buflen += inlen;
-
- return SECSuccess;
-}
-
-/**
- * This function finalizes ctx, pads final block and stores hash.
- * It can be used for both keyed and unkeyed version.
- */
-SECStatus
-BLAKE2B_End(BLAKE2BContext* ctx, unsigned char* out,
- unsigned int* digestLen, size_t maxDigestLen)
-{
- size_t i;
- unsigned int outlen = PR_MIN(BLAKE2B512_LENGTH, maxDigestLen);
-
- /* Argument checks */
- if (!ctx || !out) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- return SECFailure;
- }
-
- /* Sanity check against outlen in context. */
- if (ctx->outlen < outlen) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- return SECFailure;
- }
-
- /* Is this a reused context? */
- if (ctx->f != 0) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- return SECFailure;
- }
-
- /* Process the remaining data from ctx->buf (padded with 0). */
- blake2b_IncrementCounter(ctx, ctx->buflen);
- /* BLAKE2B_BLOCK_LENGTH - ctx->buflen can be 0. */
- PORT_Memset(ctx->buf + ctx->buflen, 0, BLAKE2B_BLOCK_LENGTH - ctx->buflen);
- ctx->f = UINT64_MAX;
- blake2b_Compress(ctx, ctx->buf);
-
- /* Write out the blake2b context(ctx). */
- for (i = 0; i < outlen; ++i) {
- out[i] = ctx->h[i / 8] >> ((i % 8) * 8);
- }
-
- if (digestLen) {
- *digestLen = outlen;
- }
-
- return SECSuccess;
-}
-
-SECStatus
-blake2b_HashBuf(uint8_t* output, const uint8_t* input, uint8_t outlen,
- size_t inlen, const uint8_t* key, size_t keylen)
-{
- SECStatus rv = SECFailure;
- BLAKE2BContext ctx = { { 0 } };
-
- if (inlen != 0) {
- PORT_Assert(input != NULL);
- if (input == NULL) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- goto done;
- }
- }
-
- PORT_Assert(output != NULL);
- if (output == NULL) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- goto done;
- }
-
- if (blake2b_Begin(&ctx, outlen, key, keylen) != SECSuccess) {
- goto done;
- }
-
- if (BLAKE2B_Update(&ctx, input, inlen) != SECSuccess) {
- goto done;
- }
-
- if (BLAKE2B_End(&ctx, output, NULL, outlen) != SECSuccess) {
- goto done;
- }
- rv = SECSuccess;
-
-done:
- PORT_Memset(&ctx, 0, sizeof ctx);
- return rv;
-}
-
-SECStatus
-BLAKE2B_Hash(unsigned char* dest, const char* src)
-{
- return blake2b_HashBuf(dest, (const unsigned char*)src, BLAKE2B512_LENGTH,
- PORT_Strlen(src), NULL, 0);
-}
-
-SECStatus
-BLAKE2B_HashBuf(unsigned char* output, const unsigned char* input, PRUint32 inlen)
-{
- return blake2b_HashBuf(output, input, BLAKE2B512_LENGTH, inlen, NULL, 0);
-}
-
-SECStatus
-BLAKE2B_MAC_HashBuf(unsigned char* output, const unsigned char* input,
- unsigned int inlen, const unsigned char* key,
- unsigned int keylen)
-{
- PORT_Assert(key != NULL);
- if (!key && keylen <= BLAKE2B_KEY_SIZE) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- return SECFailure;
- }
- return blake2b_HashBuf(output, input, BLAKE2B512_LENGTH, inlen, key, keylen);
-}
-
-unsigned int
-BLAKE2B_FlattenSize(BLAKE2BContext* ctx)
-{
- return sizeof(BLAKE2BContext);
-}
-
-SECStatus
-BLAKE2B_Flatten(BLAKE2BContext* ctx, unsigned char* space)
-{
- PORT_Assert(space != NULL);
- if (!space) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- return SECFailure;
- }
- PORT_Memcpy(space, ctx, sizeof(BLAKE2BContext));
- return SECSuccess;
-}
-
-BLAKE2BContext*
-BLAKE2B_Resurrect(unsigned char* space, void* arg)
-{
- PORT_Assert(space != NULL);
- if (!space) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- return NULL;
- }
- BLAKE2BContext* ctx = BLAKE2B_NewContext();
- if (ctx == NULL) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- return NULL;
- }
-
- PORT_Memcpy(ctx, space, sizeof(BLAKE2BContext));
- return ctx;
-}
-
-void
-BLAKE2B_Clone(BLAKE2BContext* dest, BLAKE2BContext* src)
-{
- PORT_Assert(dest != NULL);
- PORT_Assert(src != NULL);
- if (!dest || !src) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- return;
- }
- PORT_Memcpy(dest, src, sizeof(BLAKE2BContext));
-}
diff --git a/security/nss/lib/freebl/blake2b.h b/security/nss/lib/freebl/blake2b.h
deleted file mode 100644
index d19a49f0ea..0000000000
--- a/security/nss/lib/freebl/blake2b.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * blake2b.h - header file for blake2b hash function
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef BLAKE_H
-#define BLAKE_H
-
-#include <stddef.h>
-#include <stdint.h>
-
-struct Blake2bContextStr {
- uint64_t h[8]; /* chained state */
- uint64_t t[2]; /* total number of bytes */
- uint64_t f; /* last block flag */
- uint8_t buf[BLAKE2B_BLOCK_LENGTH]; /* input buffer */
- size_t buflen; /* size of remaining bytes in buf */
- size_t outlen; /* digest size */
-};
-
-#endif /* BLAKE_H */
diff --git a/security/nss/lib/freebl/blapi.h b/security/nss/lib/freebl/blapi.h
index ca2149972b..31e471ac43 100644
--- a/security/nss/lib/freebl/blapi.h
+++ b/security/nss/lib/freebl/blapi.h
@@ -1402,84 +1402,6 @@ TLS_P_hash(HASH_HashType hashAlg, const SECItem *secret, const char *label,
/******************************************/
/*
-** Implements the Blake2b hash function.
-*/
-
-/*
-** Hash a null terminated string "src" into "dest" using Blake2b
-*/
-extern SECStatus BLAKE2B_Hash(unsigned char *dest, const char *src);
-
-/*
-** Hash a non-null terminated string "src" into "dest" using Blake2b
-*/
-extern SECStatus BLAKE2B_HashBuf(unsigned char *output,
- const unsigned char *input, PRUint32 inlen);
-
-extern SECStatus BLAKE2B_MAC_HashBuf(unsigned char *output,
- const unsigned char *input,
- unsigned int inlen,
- const unsigned char *key,
- unsigned int keylen);
-
-/*
-** Create a new Blake2b context
-*/
-extern BLAKE2BContext *BLAKE2B_NewContext();
-
-/*
-** Destroy a Blake2b secure hash context.
-** "ctx" the context
-** "freeit" if PR_TRUE then free the object as well as its sub-objects
-*/
-extern void BLAKE2B_DestroyContext(BLAKE2BContext *ctx, PRBool freeit);
-
-/*
-** Reset a Blake2b context, preparing it for a fresh round of hashing
-*/
-extern SECStatus BLAKE2B_Begin(BLAKE2BContext *ctx);
-
-extern SECStatus BLAKE2B_MAC_Begin(BLAKE2BContext *ctx, const PRUint8 *key,
- const size_t keylen);
-
-/*
-** Update the Blake hash function with more data.
-*/
-extern SECStatus BLAKE2B_Update(BLAKE2BContext *ctx, const unsigned char *in,
- unsigned int inlen);
-
-/*
-** Finish the Blake hash function. Produce the digested results in "digest"
-*/
-extern SECStatus BLAKE2B_End(BLAKE2BContext *ctx, unsigned char *out,
- unsigned int *digestLen, size_t maxDigestLen);
-
-/*
- * Return the size of a buffer needed to flatten the Blake2b Context into
- * "ctx" the context
- * returns size;
- */
-extern unsigned int BLAKE2B_FlattenSize(BLAKE2BContext *ctx);
-
-/*
- * Flatten the Blake2b Context into a buffer:
- * "ctx" the context
- * "space" the buffer to flatten to
- * returns status;
- */
-extern SECStatus BLAKE2B_Flatten(BLAKE2BContext *ctx, unsigned char *space);
-
-/*
- * Resurrect a flattened context into a Blake2b Context
- * "space" the buffer of the flattend buffer
- * "arg" ptr to void used by cryptographic resurrect
- * returns resurected context
- */
-extern BLAKE2BContext *BLAKE2B_Resurrect(unsigned char *space, void *arg);
-extern void BLAKE2B_Clone(BLAKE2BContext *dest, BLAKE2BContext *src);
-
-/******************************************/
-/*
** Pseudo Random Number Generation. FIPS compliance desirable.
*/
diff --git a/security/nss/lib/freebl/blapii.h b/security/nss/lib/freebl/blapii.h
index bcf62e9f33..b1be7bedf7 100644
--- a/security/nss/lib/freebl/blapii.h
+++ b/security/nss/lib/freebl/blapii.h
@@ -22,10 +22,8 @@ typedef void (*freeblDestroyFunc)(void *cx, PRBool freeit);
SEC_BEGIN_PROTOS
-#ifndef NSS_FIPS_DISABLED
SECStatus BL_FIPSEntryOK(PRBool freeblOnly);
PRBool BL_POSTRan(PRBool freeblOnly);
-#endif
#if defined(XP_UNIX) && !defined(NO_FORK_CHECK)
diff --git a/security/nss/lib/freebl/blapit.h b/security/nss/lib/freebl/blapit.h
index c718c6f270..2a17b5f469 100644
--- a/security/nss/lib/freebl/blapit.h
+++ b/security/nss/lib/freebl/blapit.h
@@ -91,27 +91,25 @@ typedef int __BLAPI_DEPRECATED __attribute__((deprecated));
/*
* Number of bytes each hash algorithm produces
*/
-#define MD2_LENGTH 16 /* Bytes */
-#define MD5_LENGTH 16 /* Bytes */
-#define SHA1_LENGTH 20 /* Bytes */
-#define SHA256_LENGTH 32 /* bytes */
-#define SHA384_LENGTH 48 /* bytes */
-#define SHA512_LENGTH 64 /* bytes */
-#define BLAKE2B512_LENGTH 64 /* Bytes */
+#define MD2_LENGTH 16 /* Bytes */
+#define MD5_LENGTH 16 /* Bytes */
+#define SHA1_LENGTH 20 /* Bytes */
+#define SHA256_LENGTH 32 /* bytes */
+#define SHA384_LENGTH 48 /* bytes */
+#define SHA512_LENGTH 64 /* bytes */
#define HASH_LENGTH_MAX SHA512_LENGTH
/*
* Input block size for each hash algorithm.
*/
-#define MD2_BLOCK_LENGTH 64 /* bytes */
-#define MD5_BLOCK_LENGTH 64 /* bytes */
-#define SHA1_BLOCK_LENGTH 64 /* bytes */
-#define SHA224_BLOCK_LENGTH 64 /* bytes */
-#define SHA256_BLOCK_LENGTH 64 /* bytes */
-#define SHA384_BLOCK_LENGTH 128 /* bytes */
-#define SHA512_BLOCK_LENGTH 128 /* bytes */
-#define BLAKE2B_BLOCK_LENGTH 128 /* Bytes */
+#define MD2_BLOCK_LENGTH 64 /* bytes */
+#define MD5_BLOCK_LENGTH 64 /* bytes */
+#define SHA1_BLOCK_LENGTH 64 /* bytes */
+#define SHA224_BLOCK_LENGTH 64 /* bytes */
+#define SHA256_BLOCK_LENGTH 64 /* bytes */
+#define SHA384_BLOCK_LENGTH 128 /* bytes */
+#define SHA512_BLOCK_LENGTH 128 /* bytes */
#define HASH_BLOCK_LENGTH_MAX SHA512_BLOCK_LENGTH
#define AES_KEY_WRAP_IV_BYTES 8
@@ -129,8 +127,6 @@ typedef int __BLAPI_DEPRECATED __attribute__((deprecated));
#define NSS_FREEBL_DEFAULT_CHUNKSIZE 2048
-#define BLAKE2B_KEY_SIZE 64
-
/*
* These values come from the initial key size limits from the PKCS #11
* module. They may be arbitrarily adjusted to any value freebl supports.
@@ -217,7 +213,6 @@ struct SHA512ContextStr;
struct AESKeyWrapContextStr;
struct SEEDContextStr;
struct ChaCha20Poly1305ContextStr;
-struct Blake2bContextStr;
typedef struct DESContextStr DESContext;
typedef struct RC2ContextStr RC2Context;
@@ -237,7 +232,6 @@ typedef struct SHA512ContextStr SHA384Context;
typedef struct AESKeyWrapContextStr AESKeyWrapContext;
typedef struct SEEDContextStr SEEDContext;
typedef struct ChaCha20Poly1305ContextStr ChaCha20Poly1305Context;
-typedef struct Blake2bContextStr BLAKE2BContext;
/***************************************************************************
** RSA Public and Private Key structures
diff --git a/security/nss/lib/freebl/chacha20.c b/security/nss/lib/freebl/chacha20.c
index 15ed67b5b9..f55d1e6709 100644
--- a/security/nss/lib/freebl/chacha20.c
+++ b/security/nss/lib/freebl/chacha20.c
@@ -7,13 +7,113 @@
#include <string.h>
#include <stdio.h>
+#include "prtypes.h"
+#include "secport.h"
#include "chacha20.h"
-#include "verified/Hacl_Chacha20.h"
+
+#if defined(_MSC_VER)
+#pragma intrinsic(_lrotl)
+#define ROTL32(x, n) _lrotl(x, n)
+#else
+#define ROTL32(x, n) ((x << n) | (x >> ((8 * sizeof x) - n)))
+#endif
+
+#define ROTATE(v, c) ROTL32((v), (c))
+
+#define U32TO8_LITTLE(p, v) \
+ { \
+ (p)[0] = ((v)) & 0xff; \
+ (p)[1] = ((v) >> 8) & 0xff; \
+ (p)[2] = ((v) >> 16) & 0xff; \
+ (p)[3] = ((v) >> 24) & 0xff; \
+ }
+#define U8TO32_LITTLE(p) \
+ (((PRUint32)((p)[0])) | ((PRUint32)((p)[1]) << 8) | \
+ ((PRUint32)((p)[2]) << 16) | ((PRUint32)((p)[3]) << 24))
+
+#define QUARTERROUND(x, a, b, c, d) \
+ x[a] = x[a] + x[b]; \
+ x[d] = ROTATE(x[d] ^ x[a], 16); \
+ x[c] = x[c] + x[d]; \
+ x[b] = ROTATE(x[b] ^ x[c], 12); \
+ x[a] = x[a] + x[b]; \
+ x[d] = ROTATE(x[d] ^ x[a], 8); \
+ x[c] = x[c] + x[d]; \
+ x[b] = ROTATE(x[b] ^ x[c], 7);
+
+static void
+ChaChaCore(unsigned char output[64], const PRUint32 input[16], int num_rounds)
+{
+ PRUint32 x[16];
+ int i;
+
+ PORT_Memcpy(x, input, sizeof(PRUint32) * 16);
+ for (i = num_rounds; i > 0; i -= 2) {
+ QUARTERROUND(x, 0, 4, 8, 12)
+ QUARTERROUND(x, 1, 5, 9, 13)
+ QUARTERROUND(x, 2, 6, 10, 14)
+ QUARTERROUND(x, 3, 7, 11, 15)
+ QUARTERROUND(x, 0, 5, 10, 15)
+ QUARTERROUND(x, 1, 6, 11, 12)
+ QUARTERROUND(x, 2, 7, 8, 13)
+ QUARTERROUND(x, 3, 4, 9, 14)
+ }
+
+ for (i = 0; i < 16; ++i) {
+ x[i] = x[i] + input[i];
+ }
+ for (i = 0; i < 16; ++i) {
+ U32TO8_LITTLE(output + 4 * i, x[i]);
+ }
+}
+
+static const unsigned char sigma[16] = "expand 32-byte k";
void
ChaCha20XOR(unsigned char *out, const unsigned char *in, unsigned int inLen,
const unsigned char key[32], const unsigned char nonce[12],
uint32_t counter)
{
- Hacl_Chacha20_chacha20(out, (uint8_t *)in, inLen, (uint8_t *)key, (uint8_t *)nonce, counter);
+ unsigned char block[64];
+ PRUint32 input[16];
+ unsigned int i;
+
+ input[4] = U8TO32_LITTLE(key + 0);
+ input[5] = U8TO32_LITTLE(key + 4);
+ input[6] = U8TO32_LITTLE(key + 8);
+ input[7] = U8TO32_LITTLE(key + 12);
+
+ input[8] = U8TO32_LITTLE(key + 16);
+ input[9] = U8TO32_LITTLE(key + 20);
+ input[10] = U8TO32_LITTLE(key + 24);
+ input[11] = U8TO32_LITTLE(key + 28);
+
+ input[0] = U8TO32_LITTLE(sigma + 0);
+ input[1] = U8TO32_LITTLE(sigma + 4);
+ input[2] = U8TO32_LITTLE(sigma + 8);
+ input[3] = U8TO32_LITTLE(sigma + 12);
+
+ input[12] = counter;
+ input[13] = U8TO32_LITTLE(nonce + 0);
+ input[14] = U8TO32_LITTLE(nonce + 4);
+ input[15] = U8TO32_LITTLE(nonce + 8);
+
+ while (inLen >= 64) {
+ ChaChaCore(block, input, 20);
+ for (i = 0; i < 64; i++) {
+ out[i] = in[i] ^ block[i];
+ }
+
+ input[12]++;
+ inLen -= 64;
+ in += 64;
+ out += 64;
+ }
+
+ if (inLen > 0) {
+ ChaChaCore(block, input, 20);
+ for (i = 0; i < inLen; i++) {
+ out[i] = in[i] ^ block[i];
+ }
+ }
}
diff --git a/security/nss/lib/freebl/chacha20poly1305.c b/security/nss/lib/freebl/chacha20poly1305.c
index 991fa0ca31..cd265e1ff0 100644
--- a/security/nss/lib/freebl/chacha20poly1305.c
+++ b/security/nss/lib/freebl/chacha20poly1305.c
@@ -14,11 +14,7 @@
#include "blapit.h"
#ifndef NSS_DISABLE_CHACHAPOLY
-#if defined(HAVE_INT128_SUPPORT) && (defined(NSS_X86_OR_X64) || defined(__aarch64__))
-#include "verified/Hacl_Poly1305_64.h"
-#else
#include "poly1305.h"
-#endif
#include "chacha20.h"
#include "chacha20poly1305.h"
#endif
@@ -26,49 +22,6 @@
/* Poly1305Do writes the Poly1305 authenticator of the given additional data
* and ciphertext to |out|. */
#ifndef NSS_DISABLE_CHACHAPOLY
-
-#if defined(HAVE_INT128_SUPPORT) && (defined(NSS_X86_OR_X64) || defined(__aarch64__))
-
-static void
-Poly1305PadUpdate(Hacl_Impl_Poly1305_64_State_poly1305_state state, unsigned char *block, const unsigned char *p, const unsigned int pLen)
-{
- unsigned int pRemLen = pLen % 16;
- Hacl_Poly1305_64_update(state, (uint8_t *)p, (pLen / 16));
- if (pRemLen > 0) {
- memcpy(block, p + (pLen - pRemLen), pRemLen);
- Hacl_Poly1305_64_update(state, block, 1);
- }
-}
-
-static void
-Poly1305Do(unsigned char *out, const unsigned char *ad, unsigned int adLen,
- const unsigned char *ciphertext, unsigned int ciphertextLen,
- const unsigned char key[32])
-{
- uint64_t tmp1[6U] = { 0U };
- Hacl_Impl_Poly1305_64_State_poly1305_state state = Hacl_Poly1305_64_mk_state(tmp1, tmp1 + 3);
-
- unsigned char block[16] = { 0 };
- Hacl_Poly1305_64_init(state, (uint8_t *)key);
-
- Poly1305PadUpdate(state, block, ad, adLen);
- memset(block, 0, 16);
- Poly1305PadUpdate(state, block, ciphertext, ciphertextLen);
-
- unsigned int i;
- unsigned int j;
- for (i = 0, j = adLen; i < 8; i++, j >>= 8) {
- block[i] = j;
- }
- for (i = 8, j = ciphertextLen; i < 16; i++, j >>= 8) {
- block[i] = j;
- }
-
- Hacl_Poly1305_64_update(state, block, 1);
- Hacl_Poly1305_64_finish(state, out, (uint8_t *)(key + 16));
-}
-#else
-
static void
Poly1305Do(unsigned char *out, const unsigned char *ad, unsigned int adLen,
const unsigned char *ciphertext, unsigned int ciphertextLen,
@@ -103,9 +56,7 @@ Poly1305Do(unsigned char *out, const unsigned char *ad, unsigned int adLen,
Poly1305Update(&state, lengthBytes, sizeof(lengthBytes));
Poly1305Finish(&state, out);
}
-
-#endif /* HAVE_INT128_SUPPORT */
-#endif /* NSS_DISABLE_CHACHAPOLY */
+#endif
SECStatus
ChaCha20Poly1305_InitContext(ChaCha20Poly1305Context *ctx,
diff --git a/security/nss/lib/freebl/config.mk b/security/nss/lib/freebl/config.mk
index f150770965..918a66363f 100644
--- a/security/nss/lib/freebl/config.mk
+++ b/security/nss/lib/freebl/config.mk
@@ -90,12 +90,7 @@ EXTRA_SHARED_LIBS += \
endif
endif
-ifeq ($(OS_ARCH), Linux)
-CFLAGS += -std=gnu99
-endif
-
ifeq ($(OS_ARCH), Darwin)
-CFLAGS += -std=gnu99
EXTRA_SHARED_LIBS += -dylib_file @executable_path/libplc4.dylib:$(DIST)/lib/libplc4.dylib -dylib_file @executable_path/libplds4.dylib:$(DIST)/lib/libplds4.dylib
endif
diff --git a/security/nss/lib/freebl/crypto_primitives.c b/security/nss/lib/freebl/crypto_primitives.c
deleted file mode 100644
index 49c8ca5ca6..0000000000
--- a/security/nss/lib/freebl/crypto_primitives.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifdef FREEBL_NO_DEPEND
-#include "stubs.h"
-#endif
-
-/* This file holds useful functions and macros for crypto code. */
-#include "crypto_primitives.h"
-
-/*
- * FREEBL_HTONLL(x): swap bytes in a 64-bit integer.
- */
-#if defined(__GNUC__) && (defined(__x86_64__) || defined(__x86_64))
-
-__inline__ PRUint64
-swap8b(PRUint64 value)
-{
- __asm__("bswapq %0"
- : "+r"(value));
- return (value);
-}
-
-#elif !defined(_MSC_VER)
-
-PRUint64
-swap8b(PRUint64 x)
-{
- PRUint64 t1 = x;
- t1 = ((t1 & SHA_MASK8) << 8) | ((t1 >> 8) & SHA_MASK8);
- t1 = ((t1 & SHA_MASK16) << 16) | ((t1 >> 16) & SHA_MASK16);
- return (t1 >> 32) | (t1 << 32);
-}
-
-#endif
diff --git a/security/nss/lib/freebl/crypto_primitives.h b/security/nss/lib/freebl/crypto_primitives.h
deleted file mode 100644
index f19601f4b4..0000000000
--- a/security/nss/lib/freebl/crypto_primitives.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/* This file holds useful functions and macros for crypto code. */
-
-#ifdef FREEBL_NO_DEPEND
-#include "stubs.h"
-#endif
-
-#include <stdlib.h>
-#include "prtypes.h"
-
-/* Unfortunately this isn't always set when it should be. */
-#if defined(HAVE_LONG_LONG)
-
-/*
- * ROTR64/ROTL64(x, n): rotate a 64-bit integer x by n bites to the right/left.
- */
-#if defined(_MSC_VER)
-#pragma intrinsic(_rotr64, _rotl64)
-#define ROTR64(x, n) _rotr64((x), (n))
-#define ROTL64(x, n) _rotl64((x), (n))
-#else
-#define ROTR64(x, n) (((x) >> (n)) | ((x) << (64 - (n))))
-#define ROTL64(x, n) (((x) << (n)) | ((x) >> (64 - (n))))
-#endif
-
-/*
- * FREEBL_HTONLL(x): swap bytes in a 64-bit integer.
- */
-#if defined(_MSC_VER)
-
-#pragma intrinsic(_byteswap_uint64)
-#define FREEBL_HTONLL(x) _byteswap_uint64(x)
-
-#elif defined(__GNUC__) && (defined(__x86_64__) || defined(__x86_64))
-
-PRUint64 swap8b(PRUint64 value);
-#define FREEBL_HTONLL(x) swap8b(x)
-
-#else
-
-#define SHA_MASK16 0x0000FFFF0000FFFFULL
-#define SHA_MASK8 0x00FF00FF00FF00FFULL
-PRUint64 swap8b(PRUint64 x);
-#define FREEBL_HTONLL(x) swap8b(x)
-
-#endif /* _MSC_VER */
-
-#endif /* HAVE_LONG_LONG */ \ No newline at end of file
diff --git a/security/nss/lib/freebl/det_rng.c b/security/nss/lib/freebl/det_rng.c
index 53d48bc7c6..04fce30e80 100644
--- a/security/nss/lib/freebl/det_rng.c
+++ b/security/nss/lib/freebl/det_rng.c
@@ -8,22 +8,19 @@
#include "nssilock.h"
#include "seccomon.h"
#include "secerr.h"
-#include "prinit.h"
#define GLOBAL_BYTES_SIZE 100
static PRUint8 globalBytes[GLOBAL_BYTES_SIZE];
static unsigned long globalNumCalls = 0;
static PZLock *rng_lock = NULL;
-static PRCallOnceType coRNGInit;
-static const PRCallOnceType pristineCallOnce;
-static PRStatus
-rng_init(void)
+SECStatus
+RNG_RNGInit(void)
{
rng_lock = PZ_NewLock(nssILockOther);
if (!rng_lock) {
PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return PR_FAILURE;
+ return SECFailure;
}
/* --- LOCKED --- */
PZ_Lock(rng_lock);
@@ -31,17 +28,6 @@ rng_init(void)
PZ_Unlock(rng_lock);
/* --- UNLOCKED --- */
- return PR_SUCCESS;
-}
-
-SECStatus
-RNG_RNGInit(void)
-{
- /* Allow only one call to initialize the context */
- if (PR_CallOnce(&coRNGInit, rng_init) != PR_SUCCESS) {
- return SECFailure;
- }
-
return SECSuccess;
}
@@ -111,11 +97,8 @@ RNG_GenerateGlobalRandomBytes(void *dest, size_t len)
void
RNG_RNGShutdown(void)
{
- if (rng_lock) {
- PZ_DestroyLock(rng_lock);
- rng_lock = NULL;
- }
- coRNGInit = pristineCallOnce;
+ PZ_DestroyLock(rng_lock);
+ rng_lock = NULL;
}
/* Test functions are not implemented! */
diff --git a/security/nss/lib/freebl/ec.c b/security/nss/lib/freebl/ec.c
index b28815ade9..669c9b147c 100644
--- a/security/nss/lib/freebl/ec.c
+++ b/security/nss/lib/freebl/ec.c
@@ -15,6 +15,8 @@
#include "ec.h"
#include "ecl.h"
+#ifndef NSS_DISABLE_ECC
+
static const ECMethod kMethods[] = {
{ ECCurve25519,
ec_Curve25519_pt_mul,
@@ -181,6 +183,7 @@ cleanup:
return rv;
}
+#endif /* NSS_DISABLE_ECC */
/* Generates a new EC key pair. The private key is a supplied
* value and the public key is the result of performing a scalar
@@ -191,6 +194,7 @@ ec_NewKey(ECParams *ecParams, ECPrivateKey **privKey,
const unsigned char *privKeyBytes, int privKeyLen)
{
SECStatus rv = SECFailure;
+#ifndef NSS_DISABLE_ECC
PLArenaPool *arena;
ECPrivateKey *key;
mp_int k;
@@ -305,6 +309,9 @@ cleanup:
printf("ec_NewKey returning %s\n",
(rv == SECSuccess) ? "success" : "failure");
#endif
+#else
+ PORT_SetError(SEC_ERROR_UNSUPPORTED_KEYALG);
+#endif /* NSS_DISABLE_ECC */
return rv;
}
@@ -319,10 +326,15 @@ EC_NewKeyFromSeed(ECParams *ecParams, ECPrivateKey **privKey,
const unsigned char *seed, int seedlen)
{
SECStatus rv = SECFailure;
+#ifndef NSS_DISABLE_ECC
rv = ec_NewKey(ecParams, privKey, seed, seedlen);
+#else
+ PORT_SetError(SEC_ERROR_UNSUPPORTED_KEYALG);
+#endif /* NSS_DISABLE_ECC */
return rv;
}
+#ifndef NSS_DISABLE_ECC
/* Generate a random private key using the algorithm A.4.1 of ANSI X9.62,
* modified a la FIPS 186-2 Change Notice 1 to eliminate the bias in the
* random number generator.
@@ -379,6 +391,7 @@ cleanup:
}
return privKeyBytes;
}
+#endif /* NSS_DISABLE_ECC */
/* Generates a new EC key pair. The private key is a random value and
* the public key is the result of performing a scalar point multiplication
@@ -388,6 +401,7 @@ SECStatus
EC_NewKey(ECParams *ecParams, ECPrivateKey **privKey)
{
SECStatus rv = SECFailure;
+#ifndef NSS_DISABLE_ECC
int len;
unsigned char *privKeyBytes = NULL;
@@ -411,6 +425,9 @@ cleanup:
printf("EC_NewKey returning %s\n",
(rv == SECSuccess) ? "success" : "failure");
#endif
+#else
+ PORT_SetError(SEC_ERROR_UNSUPPORTED_KEYALG);
+#endif /* NSS_DISABLE_ECC */
return rv;
}
@@ -424,6 +441,7 @@ cleanup:
SECStatus
EC_ValidatePublicKey(ECParams *ecParams, SECItem *publicValue)
{
+#ifndef NSS_DISABLE_ECC
mp_int Px, Py;
ECGroup *group = NULL;
SECStatus rv = SECFailure;
@@ -507,6 +525,10 @@ cleanup:
rv = SECFailure;
}
return rv;
+#else
+ PORT_SetError(SEC_ERROR_UNSUPPORTED_KEYALG);
+ return SECFailure;
+#endif /* NSS_DISABLE_ECC */
}
/*
@@ -527,6 +549,7 @@ ECDH_Derive(SECItem *publicValue,
SECItem *derivedSecret)
{
SECStatus rv = SECFailure;
+#ifndef NSS_DISABLE_ECC
unsigned int len = 0;
SECItem pointQ = { siBuffer, NULL, 0 };
mp_int k; /* to hold the private value */
@@ -566,11 +589,7 @@ ECDH_Derive(SECItem *publicValue,
PORT_SetError(SEC_ERROR_UNSUPPORTED_ELLIPTIC_CURVE);
return SECFailure;
}
- rv = method->mul(derivedSecret, privateValue, publicValue);
- if (rv != SECSuccess) {
- SECITEM_ZfreeItem(derivedSecret, PR_FALSE);
- }
- return rv;
+ return method->mul(derivedSecret, privateValue, publicValue);
}
/*
@@ -635,6 +654,9 @@ cleanup:
if (pointQ.data) {
PORT_ZFree(pointQ.data, pointQ.len);
}
+#else
+ PORT_SetError(SEC_ERROR_UNSUPPORTED_KEYALG);
+#endif /* NSS_DISABLE_ECC */
return rv;
}
@@ -648,6 +670,7 @@ ECDSA_SignDigestWithSeed(ECPrivateKey *key, SECItem *signature,
const SECItem *digest, const unsigned char *kb, const int kblen)
{
SECStatus rv = SECFailure;
+#ifndef NSS_DISABLE_ECC
mp_int x1;
mp_int d, k; /* private key, random integer */
mp_int r, s; /* tuple (r, s) is the signature */
@@ -876,6 +899,9 @@ cleanup:
printf("ECDSA signing with seed %s\n",
(rv == SECSuccess) ? "succeeded" : "failed");
#endif
+#else
+ PORT_SetError(SEC_ERROR_UNSUPPORTED_KEYALG);
+#endif /* NSS_DISABLE_ECC */
return rv;
}
@@ -888,6 +914,7 @@ SECStatus
ECDSA_SignDigest(ECPrivateKey *key, SECItem *signature, const SECItem *digest)
{
SECStatus rv = SECFailure;
+#ifndef NSS_DISABLE_ECC
int len;
unsigned char *kBytes = NULL;
@@ -914,6 +941,9 @@ cleanup:
printf("ECDSA signing %s\n",
(rv == SECSuccess) ? "succeeded" : "failed");
#endif
+#else
+ PORT_SetError(SEC_ERROR_UNSUPPORTED_KEYALG);
+#endif /* NSS_DISABLE_ECC */
return rv;
}
@@ -931,6 +961,7 @@ ECDSA_VerifyDigest(ECPublicKey *key, const SECItem *signature,
const SECItem *digest)
{
SECStatus rv = SECFailure;
+#ifndef NSS_DISABLE_ECC
mp_int r_, s_; /* tuple (r', s') is received signature) */
mp_int c, u1, u2, v; /* intermediate values used in verification */
mp_int x1;
@@ -1130,6 +1161,9 @@ cleanup:
printf("ECDSA verification %s\n",
(rv == SECSuccess) ? "succeeded" : "failed");
#endif
+#else
+ PORT_SetError(SEC_ERROR_UNSUPPORTED_KEYALG);
+#endif /* NSS_DISABLE_ECC */
return rv;
}
diff --git a/security/nss/lib/freebl/ecdecode.c b/security/nss/lib/freebl/ecdecode.c
index 652ad42d53..54b3e111ba 100644
--- a/security/nss/lib/freebl/ecdecode.c
+++ b/security/nss/lib/freebl/ecdecode.c
@@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+#ifndef NSS_DISABLE_ECC
+
#ifdef FREEBL_NO_DEPEND
#include "stubs.h"
#endif
@@ -250,3 +252,5 @@ EC_GetPointSize(const ECParams *params)
}
return curveParams->pointSize - 1;
}
+
+#endif /* NSS_DISABLE_ECC */
diff --git a/security/nss/lib/freebl/ecl/curve25519_64.c b/security/nss/lib/freebl/ecl/curve25519_64.c
index a2e4296bbf..65f6bd41b5 100644
--- a/security/nss/lib/freebl/ecl/curve25519_64.c
+++ b/security/nss/lib/freebl/ecl/curve25519_64.c
@@ -2,13 +2,513 @@
* 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/. */
+/*
+ * Derived from public domain C code by Adan Langley and Daniel J. Bernstein
+ */
+
+#include "uint128.h"
+
#include "ecl-priv.h"
-#include "../verified/Hacl_Curve25519.h"
+#include "mpi.h"
+
+#include <stdint.h>
+#include <stdio.h>
+#include <string.h>
+
+typedef uint8_t u8;
+typedef uint64_t felem;
+
+/* Sum two numbers: output += in */
+static void
+fsum(felem *output, const felem *in)
+{
+ unsigned i;
+ for (i = 0; i < 5; ++i) {
+ output[i] += in[i];
+ }
+}
+
+/* Find the difference of two numbers: output = in - output
+ * (note the order of the arguments!)
+ */
+static void
+fdifference_backwards(felem *ioutput, const felem *iin)
+{
+ static const int64_t twotothe51 = ((int64_t)1l << 51);
+ const int64_t *in = (const int64_t *)iin;
+ int64_t *out = (int64_t *)ioutput;
+
+ out[0] = in[0] - out[0];
+ out[1] = in[1] - out[1];
+ out[2] = in[2] - out[2];
+ out[3] = in[3] - out[3];
+ out[4] = in[4] - out[4];
+
+ // An arithmetic shift right of 63 places turns a positive number to 0 and a
+ // negative number to all 1's. This gives us a bitmask that lets us avoid
+ // side-channel prone branches.
+ int64_t t;
+
+#define NEGCHAIN(a, b) \
+ t = out[a] >> 63; \
+ out[a] += twotothe51 & t; \
+ out[b] -= 1 & t;
+
+#define NEGCHAIN19(a, b) \
+ t = out[a] >> 63; \
+ out[a] += twotothe51 & t; \
+ out[b] -= 19 & t;
+
+ NEGCHAIN(0, 1);
+ NEGCHAIN(1, 2);
+ NEGCHAIN(2, 3);
+ NEGCHAIN(3, 4);
+ NEGCHAIN19(4, 0);
+ NEGCHAIN(0, 1);
+ NEGCHAIN(1, 2);
+ NEGCHAIN(2, 3);
+ NEGCHAIN(3, 4);
+}
+
+/* Multiply a number by a scalar: output = in * scalar */
+static void
+fscalar_product(felem *output, const felem *in,
+ const felem scalar)
+{
+ uint128_t tmp, tmp2;
+
+ tmp = mul6464(in[0], scalar);
+ output[0] = mask51(tmp);
+
+ tmp2 = mul6464(in[1], scalar);
+ tmp = add128(tmp2, rshift128(tmp, 51));
+ output[1] = mask51(tmp);
+
+ tmp2 = mul6464(in[2], scalar);
+ tmp = add128(tmp2, rshift128(tmp, 51));
+ output[2] = mask51(tmp);
+
+ tmp2 = mul6464(in[3], scalar);
+ tmp = add128(tmp2, rshift128(tmp, 51));
+ output[3] = mask51(tmp);
+
+ tmp2 = mul6464(in[4], scalar);
+ tmp = add128(tmp2, rshift128(tmp, 51));
+ output[4] = mask51(tmp);
+
+ output[0] += mask_lower(rshift128(tmp, 51)) * 19;
+}
+
+/* Multiply two numbers: output = in2 * in
+ *
+ * output must be distinct to both inputs. The inputs are reduced coefficient
+ * form, the output is not.
+ */
+static void
+fmul(felem *output, const felem *in2, const felem *in)
+{
+ uint128_t t0, t1, t2, t3, t4, t5, t6, t7, t8;
+
+ t0 = mul6464(in[0], in2[0]);
+ t1 = add128(mul6464(in[1], in2[0]), mul6464(in[0], in2[1]));
+ t2 = add128(add128(mul6464(in[0], in2[2]),
+ mul6464(in[2], in2[0])),
+ mul6464(in[1], in2[1]));
+ t3 = add128(add128(add128(mul6464(in[0], in2[3]),
+ mul6464(in[3], in2[0])),
+ mul6464(in[1], in2[2])),
+ mul6464(in[2], in2[1]));
+ t4 = add128(add128(add128(add128(mul6464(in[0], in2[4]),
+ mul6464(in[4], in2[0])),
+ mul6464(in[3], in2[1])),
+ mul6464(in[1], in2[3])),
+ mul6464(in[2], in2[2]));
+ t5 = add128(add128(add128(mul6464(in[4], in2[1]),
+ mul6464(in[1], in2[4])),
+ mul6464(in[2], in2[3])),
+ mul6464(in[3], in2[2]));
+ t6 = add128(add128(mul6464(in[4], in2[2]),
+ mul6464(in[2], in2[4])),
+ mul6464(in[3], in2[3]));
+ t7 = add128(mul6464(in[3], in2[4]), mul6464(in[4], in2[3]));
+ t8 = mul6464(in[4], in2[4]);
+
+ t0 = add128(t0, mul12819(t5));
+ t1 = add128(t1, mul12819(t6));
+ t2 = add128(t2, mul12819(t7));
+ t3 = add128(t3, mul12819(t8));
+
+ t1 = add128(t1, rshift128(t0, 51));
+ t0 = mask51full(t0);
+ t2 = add128(t2, rshift128(t1, 51));
+ t1 = mask51full(t1);
+ t3 = add128(t3, rshift128(t2, 51));
+ t4 = add128(t4, rshift128(t3, 51));
+ t0 = add128(t0, mul12819(rshift128(t4, 51)));
+ t1 = add128(t1, rshift128(t0, 51));
+ t2 = mask51full(t2);
+ t2 = add128(t2, rshift128(t1, 51));
+
+ output[0] = mask51(t0);
+ output[1] = mask51(t1);
+ output[2] = mask_lower(t2);
+ output[3] = mask51(t3);
+ output[4] = mask51(t4);
+}
+
+static void
+fsquare(felem *output, const felem *in)
+{
+ uint128_t t0, t1, t2, t3, t4, t5, t6, t7, t8;
+
+ t0 = mul6464(in[0], in[0]);
+ t1 = lshift128(mul6464(in[0], in[1]), 1);
+ t2 = add128(lshift128(mul6464(in[0], in[2]), 1),
+ mul6464(in[1], in[1]));
+ t3 = add128(lshift128(mul6464(in[0], in[3]), 1),
+ lshift128(mul6464(in[1], in[2]), 1));
+ t4 = add128(add128(lshift128(mul6464(in[0], in[4]), 1),
+ lshift128(mul6464(in[3], in[1]), 1)),
+ mul6464(in[2], in[2]));
+ t5 = add128(lshift128(mul6464(in[4], in[1]), 1),
+ lshift128(mul6464(in[2], in[3]), 1));
+ t6 = add128(lshift128(mul6464(in[4], in[2]), 1),
+ mul6464(in[3], in[3]));
+ t7 = lshift128(mul6464(in[3], in[4]), 1);
+ t8 = mul6464(in[4], in[4]);
+
+ t0 = add128(t0, mul12819(t5));
+ t1 = add128(t1, mul12819(t6));
+ t2 = add128(t2, mul12819(t7));
+ t3 = add128(t3, mul12819(t8));
+
+ t1 = add128(t1, rshift128(t0, 51));
+ t0 = mask51full(t0);
+ t2 = add128(t2, rshift128(t1, 51));
+ t1 = mask51full(t1);
+ t3 = add128(t3, rshift128(t2, 51));
+ t4 = add128(t4, rshift128(t3, 51));
+ t0 = add128(t0, mul12819(rshift128(t4, 51)));
+ t1 = add128(t1, rshift128(t0, 51));
+
+ output[0] = mask51(t0);
+ output[1] = mask_lower(t1);
+ output[2] = mask51(t2);
+ output[3] = mask51(t3);
+ output[4] = mask51(t4);
+}
+
+/* Take a 32-byte number and expand it into polynomial form */
+static void NO_SANITIZE_ALIGNMENT
+fexpand(felem *output, const u8 *in)
+{
+ output[0] = *((const uint64_t *)(in)) & MASK51;
+ output[1] = (*((const uint64_t *)(in + 6)) >> 3) & MASK51;
+ output[2] = (*((const uint64_t *)(in + 12)) >> 6) & MASK51;
+ output[3] = (*((const uint64_t *)(in + 19)) >> 1) & MASK51;
+ output[4] = (*((const uint64_t *)(in + 24)) >> 12) & MASK51;
+}
+
+/* Take a fully reduced polynomial form number and contract it into a
+ * 32-byte array
+ */
+static void
+fcontract(u8 *output, const felem *input)
+{
+ uint128_t t0 = init128x(input[0]);
+ uint128_t t1 = init128x(input[1]);
+ uint128_t t2 = init128x(input[2]);
+ uint128_t t3 = init128x(input[3]);
+ uint128_t t4 = init128x(input[4]);
+ uint128_t tmp = init128x(19);
+
+ t1 = add128(t1, rshift128(t0, 51));
+ t0 = mask51full(t0);
+ t2 = add128(t2, rshift128(t1, 51));
+ t1 = mask51full(t1);
+ t3 = add128(t3, rshift128(t2, 51));
+ t2 = mask51full(t2);
+ t4 = add128(t4, rshift128(t3, 51));
+ t3 = mask51full(t3);
+ t0 = add128(t0, mul12819(rshift128(t4, 51)));
+ t4 = mask51full(t4);
+
+ t1 = add128(t1, rshift128(t0, 51));
+ t0 = mask51full(t0);
+ t2 = add128(t2, rshift128(t1, 51));
+ t1 = mask51full(t1);
+ t3 = add128(t3, rshift128(t2, 51));
+ t2 = mask51full(t2);
+ t4 = add128(t4, rshift128(t3, 51));
+ t3 = mask51full(t3);
+ t0 = add128(t0, mul12819(rshift128(t4, 51)));
+ t4 = mask51full(t4);
+
+ /* now t is between 0 and 2^255-1, properly carried. */
+ /* case 1: between 0 and 2^255-20. case 2: between 2^255-19 and 2^255-1. */
+
+ t0 = add128(t0, tmp);
+
+ t1 = add128(t1, rshift128(t0, 51));
+ t0 = mask51full(t0);
+ t2 = add128(t2, rshift128(t1, 51));
+ t1 = mask51full(t1);
+ t3 = add128(t3, rshift128(t2, 51));
+ t2 = mask51full(t2);
+ t4 = add128(t4, rshift128(t3, 51));
+ t3 = mask51full(t3);
+ t0 = add128(t0, mul12819(rshift128(t4, 51)));
+ t4 = mask51full(t4);
+
+ /* now between 19 and 2^255-1 in both cases, and offset by 19. */
+
+ t0 = add128(t0, init128x(0x8000000000000 - 19));
+ tmp = init128x(0x8000000000000 - 1);
+ t1 = add128(t1, tmp);
+ t2 = add128(t2, tmp);
+ t3 = add128(t3, tmp);
+ t4 = add128(t4, tmp);
+
+ /* now between 2^255 and 2^256-20, and offset by 2^255. */
+
+ t1 = add128(t1, rshift128(t0, 51));
+ t0 = mask51full(t0);
+ t2 = add128(t2, rshift128(t1, 51));
+ t1 = mask51full(t1);
+ t3 = add128(t3, rshift128(t2, 51));
+ t2 = mask51full(t2);
+ t4 = add128(t4, rshift128(t3, 51));
+ t3 = mask51full(t3);
+ t4 = mask51full(t4);
+
+ *((uint64_t *)(output)) = mask_lower(t0) | mask_lower(t1) << 51;
+ *((uint64_t *)(output + 8)) = (mask_lower(t1) >> 13) | (mask_lower(t2) << 38);
+ *((uint64_t *)(output + 16)) = (mask_lower(t2) >> 26) | (mask_lower(t3) << 25);
+ *((uint64_t *)(output + 24)) = (mask_lower(t3) >> 39) | (mask_lower(t4) << 12);
+}
+
+/* Input: Q, Q', Q-Q'
+ * Output: 2Q, Q+Q'
+ *
+ * x2 z3: long form
+ * x3 z3: long form
+ * x z: short form, destroyed
+ * xprime zprime: short form, destroyed
+ * qmqp: short form, preserved
+ */
+static void
+fmonty(felem *x2, felem *z2, /* output 2Q */
+ felem *x3, felem *z3, /* output Q + Q' */
+ felem *x, felem *z, /* input Q */
+ felem *xprime, felem *zprime, /* input Q' */
+ const felem *qmqp /* input Q - Q' */)
+{
+ felem origx[5], origxprime[5], zzz[5], xx[5], zz[5], xxprime[5], zzprime[5],
+ zzzprime[5];
+
+ memcpy(origx, x, 5 * sizeof(felem));
+ fsum(x, z);
+ fdifference_backwards(z, origx); // does x - z
+
+ memcpy(origxprime, xprime, sizeof(felem) * 5);
+ fsum(xprime, zprime);
+ fdifference_backwards(zprime, origxprime);
+ fmul(xxprime, xprime, z);
+ fmul(zzprime, x, zprime);
+ memcpy(origxprime, xxprime, sizeof(felem) * 5);
+ fsum(xxprime, zzprime);
+ fdifference_backwards(zzprime, origxprime);
+ fsquare(x3, xxprime);
+ fsquare(zzzprime, zzprime);
+ fmul(z3, zzzprime, qmqp);
+
+ fsquare(xx, x);
+ fsquare(zz, z);
+ fmul(x2, xx, zz);
+ fdifference_backwards(zz, xx); // does zz = xx - zz
+ fscalar_product(zzz, zz, 121665);
+ fsum(zzz, xx);
+ fmul(z2, zz, zzz);
+}
+
+// -----------------------------------------------------------------------------
+// Maybe swap the contents of two felem arrays (@a and @b), each @len elements
+// long. Perform the swap iff @swap is non-zero.
+//
+// This function performs the swap without leaking any side-channel
+// information.
+// -----------------------------------------------------------------------------
+static void
+swap_conditional(felem *a, felem *b, unsigned len, felem iswap)
+{
+ unsigned i;
+ const felem swap = 1 + ~iswap;
+
+ for (i = 0; i < len; ++i) {
+ const felem x = swap & (a[i] ^ b[i]);
+ a[i] ^= x;
+ b[i] ^= x;
+ }
+}
+
+/* Calculates nQ where Q is the x-coordinate of a point on the curve
+ *
+ * resultx/resultz: the x coordinate of the resulting curve point (short form)
+ * n: a 32-byte number
+ * q: a point of the curve (short form)
+ */
+static void
+cmult(felem *resultx, felem *resultz, const u8 *n, const felem *q)
+{
+ felem a[5] = { 0 }, b[5] = { 1 }, c[5] = { 1 }, d[5] = { 0 };
+ felem *nqpqx = a, *nqpqz = b, *nqx = c, *nqz = d, *t;
+ felem e[5] = { 0 }, f[5] = { 1 }, g[5] = { 0 }, h[5] = { 1 };
+ felem *nqpqx2 = e, *nqpqz2 = f, *nqx2 = g, *nqz2 = h;
+
+ unsigned i, j;
+
+ memcpy(nqpqx, q, sizeof(felem) * 5);
+
+ for (i = 0; i < 32; ++i) {
+ u8 byte = n[31 - i];
+ for (j = 0; j < 8; ++j) {
+ const felem bit = byte >> 7;
+
+ swap_conditional(nqx, nqpqx, 5, bit);
+ swap_conditional(nqz, nqpqz, 5, bit);
+ fmonty(nqx2, nqz2, nqpqx2, nqpqz2, nqx, nqz, nqpqx, nqpqz, q);
+ swap_conditional(nqx2, nqpqx2, 5, bit);
+ swap_conditional(nqz2, nqpqz2, 5, bit);
+
+ t = nqx;
+ nqx = nqx2;
+ nqx2 = t;
+ t = nqz;
+ nqz = nqz2;
+ nqz2 = t;
+ t = nqpqx;
+ nqpqx = nqpqx2;
+ nqpqx2 = t;
+ t = nqpqz;
+ nqpqz = nqpqz2;
+ nqpqz2 = t;
+
+ byte <<= 1;
+ }
+ }
+
+ memcpy(resultx, nqx, sizeof(felem) * 5);
+ memcpy(resultz, nqz, sizeof(felem) * 5);
+}
+
+// -----------------------------------------------------------------------------
+// Shamelessly copied from djb's code
+// -----------------------------------------------------------------------------
+static void
+crecip(felem *out, const felem *z)
+{
+ felem z2[5];
+ felem z9[5];
+ felem z11[5];
+ felem z2_5_0[5];
+ felem z2_10_0[5];
+ felem z2_20_0[5];
+ felem z2_50_0[5];
+ felem z2_100_0[5];
+ felem t0[5];
+ felem t1[5];
+ int i;
+
+ /* 2 */ fsquare(z2, z);
+ /* 4 */ fsquare(t1, z2);
+ /* 8 */ fsquare(t0, t1);
+ /* 9 */ fmul(z9, t0, z);
+ /* 11 */ fmul(z11, z9, z2);
+ /* 22 */ fsquare(t0, z11);
+ /* 2^5 - 2^0 = 31 */ fmul(z2_5_0, t0, z9);
+
+ /* 2^6 - 2^1 */ fsquare(t0, z2_5_0);
+ /* 2^7 - 2^2 */ fsquare(t1, t0);
+ /* 2^8 - 2^3 */ fsquare(t0, t1);
+ /* 2^9 - 2^4 */ fsquare(t1, t0);
+ /* 2^10 - 2^5 */ fsquare(t0, t1);
+ /* 2^10 - 2^0 */ fmul(z2_10_0, t0, z2_5_0);
+
+ /* 2^11 - 2^1 */ fsquare(t0, z2_10_0);
+ /* 2^12 - 2^2 */ fsquare(t1, t0);
+ /* 2^20 - 2^10 */ for (i = 2; i < 10; i += 2) {
+ fsquare(t0, t1);
+ fsquare(t1, t0);
+ }
+ /* 2^20 - 2^0 */ fmul(z2_20_0, t1, z2_10_0);
+
+ /* 2^21 - 2^1 */ fsquare(t0, z2_20_0);
+ /* 2^22 - 2^2 */ fsquare(t1, t0);
+ /* 2^40 - 2^20 */ for (i = 2; i < 20; i += 2) {
+ fsquare(t0, t1);
+ fsquare(t1, t0);
+ }
+ /* 2^40 - 2^0 */ fmul(t0, t1, z2_20_0);
+
+ /* 2^41 - 2^1 */ fsquare(t1, t0);
+ /* 2^42 - 2^2 */ fsquare(t0, t1);
+ /* 2^50 - 2^10 */ for (i = 2; i < 10; i += 2) {
+ fsquare(t1, t0);
+ fsquare(t0, t1);
+ }
+ /* 2^50 - 2^0 */ fmul(z2_50_0, t0, z2_10_0);
+
+ /* 2^51 - 2^1 */ fsquare(t0, z2_50_0);
+ /* 2^52 - 2^2 */ fsquare(t1, t0);
+ /* 2^100 - 2^50 */ for (i = 2; i < 50; i += 2) {
+ fsquare(t0, t1);
+ fsquare(t1, t0);
+ }
+ /* 2^100 - 2^0 */ fmul(z2_100_0, t1, z2_50_0);
+
+ /* 2^101 - 2^1 */ fsquare(t1, z2_100_0);
+ /* 2^102 - 2^2 */ fsquare(t0, t1);
+ /* 2^200 - 2^100 */ for (i = 2; i < 100; i += 2) {
+ fsquare(t1, t0);
+ fsquare(t0, t1);
+ }
+ /* 2^200 - 2^0 */ fmul(t1, t0, z2_100_0);
+
+ /* 2^201 - 2^1 */ fsquare(t0, t1);
+ /* 2^202 - 2^2 */ fsquare(t1, t0);
+ /* 2^250 - 2^50 */ for (i = 2; i < 50; i += 2) {
+ fsquare(t0, t1);
+ fsquare(t1, t0);
+ }
+ /* 2^250 - 2^0 */ fmul(t0, t1, z2_50_0);
+
+ /* 2^251 - 2^1 */ fsquare(t1, t0);
+ /* 2^252 - 2^2 */ fsquare(t0, t1);
+ /* 2^253 - 2^3 */ fsquare(t1, t0);
+ /* 2^254 - 2^4 */ fsquare(t0, t1);
+ /* 2^255 - 2^5 */ fsquare(t1, t0);
+ /* 2^255 - 21 */ fmul(out, t1, z11);
+}
SECStatus
-ec_Curve25519_mul(uint8_t *mypublic, const uint8_t *secret, const uint8_t *basepoint)
+ec_Curve25519_mul(uint8_t *mypublic, const uint8_t *secret,
+ const uint8_t *basepoint)
{
- // Note: this cast is safe because HaCl* state has a post-condition that only "mypublic" changed.
- Hacl_Curve25519_crypto_scalarmult(mypublic, (uint8_t *)secret, (uint8_t *)basepoint);
+ felem bp[5], x[5], z[5], zmone[5];
+ uint8_t e[32];
+ int i;
+
+ for (i = 0; i < 32; ++i) {
+ e[i] = secret[i];
+ }
+ e[0] &= 248;
+ e[31] &= 127;
+ e[31] |= 64;
+ fexpand(bp, basepoint);
+ cmult(x, z, e, bp);
+ crecip(zmone, z);
+ fmul(z, x, zmone);
+ fcontract(mypublic, z);
+
return 0;
}
diff --git a/security/nss/lib/freebl/ecl/ecp_25519.c b/security/nss/lib/freebl/ecl/ecp_25519.c
index 38bd34c501..1e7875fff2 100644
--- a/security/nss/lib/freebl/ecl/ecp_25519.c
+++ b/security/nss/lib/freebl/ecl/ecp_25519.c
@@ -115,9 +115,5 @@ ec_Curve25519_pt_mul(SECItem *X, SECItem *k, SECItem *P)
px = P->data;
}
- SECStatus rv = ec_Curve25519_mul(X->data, k->data, px);
- if (NSS_SecureMemcmpZero(X->data, X->len) == 0) {
- return SECFailure;
- }
- return rv;
+ return ec_Curve25519_mul(X->data, k->data, px);
}
diff --git a/security/nss/lib/freebl/exports.gyp b/security/nss/lib/freebl/exports.gyp
index ca0b6dafd5..aded6bfb6a 100644
--- a/security/nss/lib/freebl/exports.gyp
+++ b/security/nss/lib/freebl/exports.gyp
@@ -29,7 +29,6 @@
'files': [
'alghmac.h',
'blapi.h',
- 'blake2b.h',
'chacha20poly1305.h',
'ec.h',
'ecl/ecl-curve.h',
diff --git a/security/nss/lib/freebl/fipsfreebl.c b/security/nss/lib/freebl/fipsfreebl.c
index 2328a677f4..0945135605 100644
--- a/security/nss/lib/freebl/fipsfreebl.c
+++ b/security/nss/lib/freebl/fipsfreebl.c
@@ -6,7 +6,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* $Id: fipstest.c,v 1.31 2012/06/28 17:55:06 rrelyea%redhat.com Exp $ */
-#ifndef NSS_FIPS_DISABLED
#ifdef FREEBL_NO_DEPEND
#include "stubs.h"
#endif
@@ -16,7 +15,9 @@
#include "secerr.h"
#include "prtypes.h"
+#ifdef NSS_ENABLE_ECC
#include "ec.h" /* Required for ECDSA */
+#endif
/*
* different platforms have different ways of calling and initial entry point
@@ -1076,6 +1077,8 @@ rsa_loser:
return (SECFailure);
}
+#ifdef NSS_ENABLE_ECC
+
static SECStatus
freebl_fips_ECDSA_Test(ECParams *ecparams,
const PRUint8 *knownSignature,
@@ -1272,6 +1275,8 @@ freebl_fips_ECDSA_PowerUpSelfTest()
return (SECSuccess);
}
+#endif /* NSS_ENABLE_ECC */
+
static SECStatus
freebl_fips_DSA_PowerUpSelfTest(void)
{
@@ -1554,11 +1559,13 @@ freebl_fipsPowerUpSelfTest(unsigned int tests)
if (rv != SECSuccess)
return rv;
+#ifdef NSS_ENABLE_ECC
/* ECDSA Power-Up SelfTest(s). */
rv = freebl_fips_ECDSA_PowerUpSelfTest();
if (rv != SECSuccess)
return rv;
+#endif
}
/* Passed Power-Up SelfTest(s). */
return (SECSuccess);
@@ -1582,6 +1589,9 @@ static PRBool self_tests_freebl_ran = PR_FALSE;
static PRBool self_tests_ran = PR_FALSE;
static PRBool self_tests_freebl_success = PR_FALSE;
static PRBool self_tests_success = PR_FALSE;
+#if defined(DEBUG)
+static PRBool fips_mode_available = PR_FALSE;
+#endif
/*
* accessors for freebl
@@ -1634,6 +1644,7 @@ bl_startup_tests(void)
PORT_Assert(self_tests_freebl_ran == PR_FALSE);
PORT_Assert(self_tests_success == PR_FALSE);
+ PORT_Assert(fips_mode_available == PR_FALSE);
self_tests_freebl_ran = PR_TRUE; /* we are running the tests */
self_tests_success = PR_FALSE; /* force it just in case */
self_tests_freebl_success = PR_FALSE; /* force it just in case */
@@ -1702,4 +1713,3 @@ BL_FIPSEntryOK(PRBool freebl_only)
PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
return SECFailure;
}
-#endif
diff --git a/security/nss/lib/freebl/freebl.gyp b/security/nss/lib/freebl/freebl.gyp
index 8b6a546e7c..8c0d0dcd5d 100644
--- a/security/nss/lib/freebl/freebl.gyp
+++ b/security/nss/lib/freebl/freebl.gyp
@@ -23,37 +23,6 @@
]
},
{
- 'target_name': 'gcm-aes-x86_c_lib',
- 'type': 'static_library',
- 'sources': [
- 'gcm-x86.c', 'aes-x86.c'
- ],
- 'dependencies': [
- '<(DEPTH)/exports.gyp:nss_exports'
- ],
- # Enable isa option for pclmul and aes-ni; supported since gcc 4.4.
- # This is only supported by x84/x64. It's not needed for Windows,
- # unless clang-cl is used.
- 'cflags_mozilla': [
- '-mpclmul', '-maes'
- ],
- 'conditions': [
- [ 'OS=="linux" or OS=="android" or OS=="dragonfly" or OS=="freebsd" or OS=="netbsd" or OS=="openbsd"', {
- 'cflags': [
- '-mpclmul', '-maes'
- ],
- }],
- # macOS build doesn't use cflags.
- [ 'OS=="mac"', {
- 'xcode_settings': {
- 'OTHER_CFLAGS': [
- '-mpclmul', '-maes'
- ],
- },
- }]
- ]
- },
- {
'target_name': 'freebl',
'type': 'static_library',
'sources': [
@@ -76,11 +45,6 @@
'<(DEPTH)/exports.gyp:nss_exports',
],
'conditions': [
- [ 'target_arch=="ia32" or target_arch=="x64"', {
- 'dependencies': [
- 'gcm-aes-x86_c_lib'
- ],
- }],
[ 'OS=="linux"', {
'defines!': [
'FREEBL_NO_DEPEND',
@@ -112,11 +76,6 @@
'<(DEPTH)/exports.gyp:nss_exports',
],
'conditions': [
- [ 'target_arch=="ia32" or target_arch=="x64"', {
- 'dependencies': [
- 'gcm-aes-x86_c_lib'
- ]
- }],
[ 'OS!="linux" and OS!="android"', {
'conditions': [
[ 'moz_fold_libs==0', {
@@ -183,8 +142,7 @@
'target_defaults': {
'include_dirs': [
'mpi',
- 'ecl',
- 'verified',
+ 'ecl'
],
'defines': [
'SHLIB_SUFFIX=\"<(dll_suffix)\"',
@@ -195,12 +153,19 @@
'MP_API_COMPATIBLE'
],
'conditions': [
+ [ 'target_arch=="ia32" or target_arch=="x64"', {
+ 'cflags_mozilla': [
+ '-mpclmul',
+ '-maes',
+ ],
+ }],
[ 'OS=="mac"', {
'xcode_settings': {
# I'm not sure since when this is supported.
# But I hope that doesn't matter. We also assume this is x86/x64.
'OTHER_CFLAGS': [
- '-std=gnu99',
+ '-mpclmul',
+ '-maes',
],
},
}],
@@ -256,24 +221,17 @@
'HAVE_INT128_SUPPORT',
],
}, {
- 'defines': [
- 'KRML_NOUINT128',
+ 'sources': [
+ 'ecl/uint128.c',
],
}],
],
- }, {
- 'defines': [
- 'KRML_NOUINT128',
- ],
}],
[ 'OS=="linux"', {
'defines': [
'FREEBL_LOWHASH',
'FREEBL_NO_DEPEND',
],
- 'cflags': [
- '-std=gnu99',
- ],
}],
[ 'OS=="linux" or OS=="android"', {
'conditions': [
@@ -301,6 +259,14 @@
'MP_USE_UINT_DIGIT',
],
}],
+ [ 'target_arch=="ia32" or target_arch=="x64"', {
+ 'cflags': [
+ # enable isa option for pclmul am aes-ni; supported since gcc 4.4
+ # This is only support by x84/x64. It's not needed for Windows.
+ '-mpclmul',
+ '-maes',
+ ],
+ }],
[ 'target_arch=="arm"', {
'defines': [
'MP_ASSEMBLY_MULTIPLY',
diff --git a/security/nss/lib/freebl/freebl_base.gypi b/security/nss/lib/freebl/freebl_base.gypi
index 44e28963b2..027aa2702c 100644
--- a/security/nss/lib/freebl/freebl_base.gypi
+++ b/security/nss/lib/freebl/freebl_base.gypi
@@ -8,10 +8,8 @@
'alghmac.c',
'arcfive.c',
'arcfour.c',
- 'blake2b.c',
'camellia.c',
'chacha20poly1305.c',
- 'crypto_primitives.c',
'ctr.c',
'cts.c',
'des.c',
@@ -100,6 +98,10 @@
],
}],
[ 'OS=="win"', {
+ 'sources': [
+ #TODO: building with mingw should not need this.
+ 'ecl/uint128.c',
+ ],
'libraries': [
'advapi32.lib',
],
@@ -130,53 +132,29 @@
}],
],
}],
- ['target_arch=="ia32" or target_arch=="x64" or target_arch=="arm64" or target_arch=="aarch64"', {
+ ['target_arch=="ia32" or target_arch=="x64"', {
'sources': [
- # All intel and 64-bit ARM architectures get the 64 bit version.
+ # All intel architectures get the 64 bit version
'ecl/curve25519_64.c',
- 'verified/Hacl_Curve25519.c',
- 'verified/FStar.c',
],
}, {
'sources': [
- # All other architectures get the generic 32 bit implementation (slow!)
+ # All non intel architectures get the generic 32 bit implementation (slow!)
'ecl/curve25519_32.c',
],
}],
+ #TODO uint128.c
[ 'disable_chachapoly==0', {
'conditions': [
- [ 'OS!="win"', {
- 'conditions': [
- [ 'target_arch=="x64"', {
- 'sources': [
- 'chacha20_vec.c',
- 'verified/Hacl_Poly1305_64.c',
- ],
- }, {
- # !Windows & !x64
- 'conditions': [
- [ 'target_arch=="arm64" or target_arch=="aarch64"', {
- 'sources': [
- 'chacha20.c',
- 'verified/Hacl_Chacha20.c',
- 'verified/Hacl_Poly1305_64.c',
- ],
- }, {
- # !Windows & !x64 & !arm64 & !aarch64
- 'sources': [
- 'chacha20.c',
- 'verified/Hacl_Chacha20.c',
- 'poly1305.c',
- ],
- }],
- ],
- }],
+ [ 'OS!="win" and target_arch=="x64"', {
+ 'sources': [
+ 'chacha20_vec.c',
+ 'poly1305-donna-x64-sse2-incremental-source.c',
],
}, {
- # Windows
+ # not x64
'sources': [
'chacha20.c',
- 'verified/Hacl_Chacha20.c',
'poly1305.c',
],
}],
diff --git a/security/nss/lib/freebl/gcm-x86.c b/security/nss/lib/freebl/gcm-x86.c
deleted file mode 100644
index e34d633943..0000000000
--- a/security/nss/lib/freebl/gcm-x86.c
+++ /dev/null
@@ -1,127 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifdef FREEBL_NO_DEPEND
-#include "stubs.h"
-#endif
-#include "gcm.h"
-#include "secerr.h"
-
-#include <wmmintrin.h> /* clmul */
-
-#define WRITE64(x, bytes) \
- (bytes)[0] = (x) >> 56; \
- (bytes)[1] = (x) >> 48; \
- (bytes)[2] = (x) >> 40; \
- (bytes)[3] = (x) >> 32; \
- (bytes)[4] = (x) >> 24; \
- (bytes)[5] = (x) >> 16; \
- (bytes)[6] = (x) >> 8; \
- (bytes)[7] = (x);
-
-SECStatus
-gcm_HashWrite_hw(gcmHashContext *ghash, unsigned char *outbuf)
-{
- uint64_t tmp_out[2];
- _mm_storeu_si128((__m128i *)tmp_out, ghash->x);
- /* maxout must be larger than 16 byte (checked by the caller). */
- WRITE64(tmp_out[0], outbuf + 8);
- WRITE64(tmp_out[1], outbuf);
- return SECSuccess;
-}
-
-SECStatus
-gcm_HashMult_hw(gcmHashContext *ghash, const unsigned char *buf,
- unsigned int count)
-{
- size_t i;
- pre_align __m128i z_high post_align;
- pre_align __m128i z_low post_align;
- pre_align __m128i C post_align;
- pre_align __m128i D post_align;
- pre_align __m128i E post_align;
- pre_align __m128i F post_align;
- pre_align __m128i bin post_align;
- pre_align __m128i Ci post_align;
- pre_align __m128i tmp post_align;
-
- for (i = 0; i < count; i++, buf += 16) {
- bin = _mm_set_epi16(((uint16_t)buf[0] << 8) | buf[1],
- ((uint16_t)buf[2] << 8) | buf[3],
- ((uint16_t)buf[4] << 8) | buf[5],
- ((uint16_t)buf[6] << 8) | buf[7],
- ((uint16_t)buf[8] << 8) | buf[9],
- ((uint16_t)buf[10] << 8) | buf[11],
- ((uint16_t)buf[12] << 8) | buf[13],
- ((uint16_t)buf[14] << 8) | buf[15]);
- Ci = _mm_xor_si128(bin, ghash->x);
-
- /* Do binary mult ghash->X = Ci * ghash->H. */
- C = _mm_clmulepi64_si128(Ci, ghash->h, 0x00);
- D = _mm_clmulepi64_si128(Ci, ghash->h, 0x11);
- E = _mm_clmulepi64_si128(Ci, ghash->h, 0x01);
- F = _mm_clmulepi64_si128(Ci, ghash->h, 0x10);
- tmp = _mm_xor_si128(E, F);
- z_high = _mm_xor_si128(tmp, _mm_slli_si128(D, 8));
- z_high = _mm_unpackhi_epi64(z_high, D);
- z_low = _mm_xor_si128(_mm_slli_si128(tmp, 8), C);
- z_low = _mm_unpackhi_epi64(_mm_slli_si128(C, 8), z_low);
-
- /* Shift one to the left (multiply by x) as gcm spec is stupid. */
- C = _mm_slli_si128(z_low, 8);
- E = _mm_srli_epi64(C, 63);
- D = _mm_slli_si128(z_high, 8);
- F = _mm_srli_epi64(D, 63);
- /* Carry over */
- C = _mm_srli_si128(z_low, 8);
- D = _mm_srli_epi64(C, 63);
- z_low = _mm_or_si128(_mm_slli_epi64(z_low, 1), E);
- z_high = _mm_or_si128(_mm_or_si128(_mm_slli_epi64(z_high, 1), F), D);
-
- /* Reduce */
- C = _mm_slli_si128(z_low, 8);
- /* D = z_low << 127 */
- D = _mm_slli_epi64(C, 63);
- /* E = z_low << 126 */
- E = _mm_slli_epi64(C, 62);
- /* F = z_low << 121 */
- F = _mm_slli_epi64(C, 57);
- /* z_low ^= (z_low << 127) ^ (z_low << 126) ^ (z_low << 121); */
- z_low = _mm_xor_si128(_mm_xor_si128(_mm_xor_si128(z_low, D), E), F);
- C = _mm_srli_si128(z_low, 8);
- /* D = z_low >> 1 */
- D = _mm_slli_epi64(C, 63);
- D = _mm_or_si128(_mm_srli_epi64(z_low, 1), D);
- /* E = z_low >> 2 */
- E = _mm_slli_epi64(C, 62);
- E = _mm_or_si128(_mm_srli_epi64(z_low, 2), E);
- /* F = z_low >> 7 */
- F = _mm_slli_epi64(C, 57);
- F = _mm_or_si128(_mm_srli_epi64(z_low, 7), F);
- /* ghash->x ^= z_low ^ (z_low >> 1) ^ (z_low >> 2) ^ (z_low >> 7); */
- ghash->x = _mm_xor_si128(_mm_xor_si128(
- _mm_xor_si128(_mm_xor_si128(z_high, z_low), D), E),
- F);
- }
- return SECSuccess;
-}
-
-SECStatus
-gcm_HashInit_hw(gcmHashContext *ghash)
-{
- ghash->ghash_mul = gcm_HashMult_hw;
- ghash->x = _mm_setzero_si128();
- /* MSVC requires __m64 to load epi64. */
- ghash->h = _mm_set_epi32(ghash->h_high >> 32, (uint32_t)ghash->h_high,
- ghash->h_low >> 32, (uint32_t)ghash->h_low);
- ghash->hw = PR_TRUE;
- return SECSuccess;
-}
-
-SECStatus
-gcm_HashZeroX_hw(gcmHashContext *ghash)
-{
- ghash->x = _mm_setzero_si128();
- return SECSuccess;
-}
diff --git a/security/nss/lib/freebl/gcm.c b/security/nss/lib/freebl/gcm.c
index f1e16da78e..0fdb0fd487 100644
--- a/security/nss/lib/freebl/gcm.c
+++ b/security/nss/lib/freebl/gcm.c
@@ -17,50 +17,18 @@
#include <limits.h>
+#ifdef NSS_X86_OR_X64
+#include <wmmintrin.h> /* clmul */
+#endif
+
/* Forward declarations */
-SECStatus gcm_HashInit_hw(gcmHashContext *ghash);
-SECStatus gcm_HashWrite_hw(gcmHashContext *ghash, unsigned char *outbuf);
SECStatus gcm_HashMult_hw(gcmHashContext *ghash, const unsigned char *buf,
unsigned int count);
-SECStatus gcm_HashZeroX_hw(gcmHashContext *ghash);
SECStatus gcm_HashMult_sftw(gcmHashContext *ghash, const unsigned char *buf,
unsigned int count);
SECStatus gcm_HashMult_sftw32(gcmHashContext *ghash, const unsigned char *buf,
unsigned int count);
-/* Stub definitions for the above *_hw functions, which shouldn't be
- * used unless NSS_X86_OR_X64 is defined */
-#ifndef NSS_X86_OR_X64
-SECStatus
-gcm_HashWrite_hw(gcmHashContext *ghash, unsigned char *outbuf)
-{
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
-}
-
-SECStatus
-gcm_HashMult_hw(gcmHashContext *ghash, const unsigned char *buf,
- unsigned int count)
-{
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
-}
-
-SECStatus
-gcm_HashInit_hw(gcmHashContext *ghash)
-{
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
-}
-
-SECStatus
-gcm_HashZeroX_hw(gcmHashContext *ghash)
-{
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
-}
-#endif /* NSS_X86_OR_X64 */
-
uint64_t
get64(const unsigned char *bytes)
{
@@ -78,8 +46,6 @@ get64(const unsigned char *bytes)
SECStatus
gcmHash_InitContext(gcmHashContext *ghash, const unsigned char *H, PRBool sw)
{
- SECStatus rv = SECSuccess;
-
ghash->cLen = 0;
ghash->bufLen = 0;
PORT_Memset(ghash->counterBuf, 0, sizeof(ghash->counterBuf));
@@ -87,7 +53,17 @@ gcmHash_InitContext(gcmHashContext *ghash, const unsigned char *H, PRBool sw)
ghash->h_low = get64(H + 8);
ghash->h_high = get64(H);
if (clmul_support() && !sw) {
- rv = gcm_HashInit_hw(ghash);
+#ifdef NSS_X86_OR_X64
+ ghash->ghash_mul = gcm_HashMult_hw;
+ ghash->x = _mm_setzero_si128();
+ /* MSVC requires __m64 to load epi64. */
+ ghash->h = _mm_set_epi32(ghash->h_high >> 32, (uint32_t)ghash->h_high,
+ ghash->h_low >> 32, (uint32_t)ghash->h_low);
+ ghash->hw = PR_TRUE;
+#else
+ PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
+ return SECFailure;
+#endif /* NSS_X86_OR_X64 */
} else {
/* We fall back to the software implementation if we can't use / don't
* want to use pclmul. */
@@ -99,7 +75,7 @@ gcmHash_InitContext(gcmHashContext *ghash, const unsigned char *H, PRBool sw)
ghash->x_high = ghash->x_low = 0;
ghash->hw = PR_FALSE;
}
- return rv;
+ return SECSuccess;
}
#ifdef HAVE_INT128_SUPPORT
@@ -307,17 +283,102 @@ gcm_HashMult_sftw32(gcmHashContext *ghash, const unsigned char *buf,
}
#endif /* HAVE_INT128_SUPPORT */
+SECStatus
+gcm_HashMult_hw(gcmHashContext *ghash, const unsigned char *buf,
+ unsigned int count)
+{
+#ifdef NSS_X86_OR_X64
+ size_t i;
+ pre_align __m128i z_high post_align;
+ pre_align __m128i z_low post_align;
+ pre_align __m128i C post_align;
+ pre_align __m128i D post_align;
+ pre_align __m128i E post_align;
+ pre_align __m128i F post_align;
+ pre_align __m128i bin post_align;
+ pre_align __m128i Ci post_align;
+ pre_align __m128i tmp post_align;
+
+ for (i = 0; i < count; i++, buf += 16) {
+ bin = _mm_set_epi16(((uint16_t)buf[0] << 8) | buf[1],
+ ((uint16_t)buf[2] << 8) | buf[3],
+ ((uint16_t)buf[4] << 8) | buf[5],
+ ((uint16_t)buf[6] << 8) | buf[7],
+ ((uint16_t)buf[8] << 8) | buf[9],
+ ((uint16_t)buf[10] << 8) | buf[11],
+ ((uint16_t)buf[12] << 8) | buf[13],
+ ((uint16_t)buf[14] << 8) | buf[15]);
+ Ci = _mm_xor_si128(bin, ghash->x);
+
+ /* Do binary mult ghash->X = Ci * ghash->H. */
+ C = _mm_clmulepi64_si128(Ci, ghash->h, 0x00);
+ D = _mm_clmulepi64_si128(Ci, ghash->h, 0x11);
+ E = _mm_clmulepi64_si128(Ci, ghash->h, 0x01);
+ F = _mm_clmulepi64_si128(Ci, ghash->h, 0x10);
+ tmp = _mm_xor_si128(E, F);
+ z_high = _mm_xor_si128(tmp, _mm_slli_si128(D, 8));
+ z_high = _mm_unpackhi_epi64(z_high, D);
+ z_low = _mm_xor_si128(_mm_slli_si128(tmp, 8), C);
+ z_low = _mm_unpackhi_epi64(_mm_slli_si128(C, 8), z_low);
+
+ /* Shift one to the left (multiply by x) as gcm spec is stupid. */
+ C = _mm_slli_si128(z_low, 8);
+ E = _mm_srli_epi64(C, 63);
+ D = _mm_slli_si128(z_high, 8);
+ F = _mm_srli_epi64(D, 63);
+ /* Carry over */
+ C = _mm_srli_si128(z_low, 8);
+ D = _mm_srli_epi64(C, 63);
+ z_low = _mm_or_si128(_mm_slli_epi64(z_low, 1), E);
+ z_high = _mm_or_si128(_mm_or_si128(_mm_slli_epi64(z_high, 1), F), D);
+
+ /* Reduce */
+ C = _mm_slli_si128(z_low, 8);
+ /* D = z_low << 127 */
+ D = _mm_slli_epi64(C, 63);
+ /* E = z_low << 126 */
+ E = _mm_slli_epi64(C, 62);
+ /* F = z_low << 121 */
+ F = _mm_slli_epi64(C, 57);
+ /* z_low ^= (z_low << 127) ^ (z_low << 126) ^ (z_low << 121); */
+ z_low = _mm_xor_si128(_mm_xor_si128(_mm_xor_si128(z_low, D), E), F);
+ C = _mm_srli_si128(z_low, 8);
+ /* D = z_low >> 1 */
+ D = _mm_slli_epi64(C, 63);
+ D = _mm_or_si128(_mm_srli_epi64(z_low, 1), D);
+ /* E = z_low >> 2 */
+ E = _mm_slli_epi64(C, 62);
+ E = _mm_or_si128(_mm_srli_epi64(z_low, 2), E);
+ /* F = z_low >> 7 */
+ F = _mm_slli_epi64(C, 57);
+ F = _mm_or_si128(_mm_srli_epi64(z_low, 7), F);
+ /* ghash->x ^= z_low ^ (z_low >> 1) ^ (z_low >> 2) ^ (z_low >> 7); */
+ ghash->x = _mm_xor_si128(_mm_xor_si128(
+ _mm_xor_si128(_mm_xor_si128(z_high, z_low), D), E),
+ F);
+ }
+ return SECSuccess;
+#else
+ PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
+ return SECFailure;
+#endif /* NSS_X86_OR_X64 */
+}
+
static SECStatus
gcm_zeroX(gcmHashContext *ghash)
{
- SECStatus rv = SECSuccess;
-
if (ghash->hw) {
- rv = gcm_HashZeroX_hw(ghash);
+#ifdef NSS_X86_OR_X64
+ ghash->x = _mm_setzero_si128();
+ return SECSuccess;
+#else
+ PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
+ return SECFailure;
+#endif /* NSS_X86_OR_X64 */
}
ghash->x_high = ghash->x_low = 0;
- return rv;
+ return SECSuccess;
}
/*
@@ -442,10 +503,15 @@ gcmHash_Final(gcmHashContext *ghash, unsigned char *outbuf,
}
if (ghash->hw) {
- rv = gcm_HashWrite_hw(ghash, T);
- if (rv != SECSuccess) {
- goto cleanup;
- }
+#ifdef NSS_X86_OR_X64
+ uint64_t tmp_out[2];
+ _mm_storeu_si128((__m128i *)tmp_out, ghash->x);
+ WRITE64(tmp_out[0], T + 8);
+ WRITE64(tmp_out[1], T);
+#else
+ PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
+ return SECFailure;
+#endif /* NSS_X86_OR_X64 */
} else {
WRITE64(ghash->x_low, T + 8);
WRITE64(ghash->x_high, T);
@@ -529,7 +595,14 @@ GCM_CreateContext(void *context, freeblCipherFunc cipher,
if (gcm == NULL) {
return NULL;
}
- ghash = PORT_ZNewAligned(gcmHashContext, 16, mem);
+ /* aligned_alloc is C11 so we have to do it the old way. */
+ ghash = PORT_ZAlloc(sizeof(gcmHashContext) + 15);
+ if (ghash == NULL) {
+ PORT_SetError(SEC_ERROR_NO_MEMORY);
+ goto loser;
+ }
+ ghash->mem = ghash;
+ ghash = (gcmHashContext *)(((uintptr_t)ghash + 15) & ~(uintptr_t)0x0F);
/* first plug in the ghash context */
gcm->ghash_context = ghash;
diff --git a/security/nss/lib/freebl/gcm.h b/security/nss/lib/freebl/gcm.h
index 42ef0f7179..0c707a0811 100644
--- a/security/nss/lib/freebl/gcm.h
+++ b/security/nss/lib/freebl/gcm.h
@@ -9,21 +9,7 @@
#include <stdint.h>
#ifdef NSS_X86_OR_X64
-/* GCC <= 4.8 doesn't support including emmintrin.h without enabling SSE2 */
-#if !defined(__clang__) && defined(__GNUC__) && defined(__GNUC_MINOR__) && \
- (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ <= 8))
-#pragma GCC push_options
-#pragma GCC target("sse2")
-#undef NSS_DISABLE_SSE2
-#define NSS_DISABLE_SSE2 1
-#endif /* GCC <= 4.8 */
-
#include <emmintrin.h> /* __m128i */
-
-#ifdef NSS_DISABLE_SSE2
-#undef NSS_DISABLE_SSE2
-#pragma GCC pop_options
-#endif /* NSS_DISABLE_SSE2 */
#endif
SEC_BEGIN_PROTOS
diff --git a/security/nss/lib/freebl/ldvector.c b/security/nss/lib/freebl/ldvector.c
index d399652569..2447a0c9f5 100644
--- a/security/nss/lib/freebl/ldvector.c
+++ b/security/nss/lib/freebl/ldvector.c
@@ -298,25 +298,9 @@ static const struct FREEBLVectorStr vector =
/* End of Version 3.018 */
- EC_GetPointSize,
+ EC_GetPointSize
/* End of Version 3.019 */
-
- BLAKE2B_Hash,
- BLAKE2B_HashBuf,
- BLAKE2B_MAC_HashBuf,
- BLAKE2B_NewContext,
- BLAKE2B_DestroyContext,
- BLAKE2B_Begin,
- BLAKE2B_MAC_Begin,
- BLAKE2B_Update,
- BLAKE2B_End,
- BLAKE2B_FlattenSize,
- BLAKE2B_Flatten,
- BLAKE2B_Resurrect
-
- /* End of Version 3.020 */
-
};
const FREEBLVector*
@@ -336,12 +320,8 @@ FREEBL_GetVector(void)
return NULL;
}
#endif
-
-#ifndef NSS_FIPS_DISABLED
- /* In FIPS mode make sure the Full self tests have been run before
- * continuing. */
+ /* make sure the Full self tests have been run before continuing */
BL_POSTRan(PR_FALSE);
-#endif
return &vector;
}
diff --git a/security/nss/lib/freebl/loader.c b/security/nss/lib/freebl/loader.c
index fe5e0a6680..792171b086 100644
--- a/security/nss/lib/freebl/loader.c
+++ b/security/nss/lib/freebl/loader.c
@@ -2124,114 +2124,3 @@ EC_GetPointSize(const ECParams *params)
return SECFailure;
return (vector->p_EC_GetPointSize)(params);
}
-
-SECStatus
-BLAKE2B_Hash(unsigned char *dest, const char *src)
-{
- if (!vector && PR_SUCCESS != freebl_RunLoaderOnce()) {
- return SECFailure;
- }
- return (vector->p_BLAKE2B_Hash)(dest, src);
-}
-
-SECStatus
-BLAKE2B_HashBuf(unsigned char *output, const unsigned char *input, PRUint32 inlen)
-{
- if (!vector && PR_SUCCESS != freebl_RunLoaderOnce()) {
- return SECFailure;
- }
- return (vector->p_BLAKE2B_HashBuf)(output, input, inlen);
-}
-
-SECStatus
-BLAKE2B_MAC_HashBuf(unsigned char *output, const unsigned char *input,
- unsigned int inlen, const unsigned char *key,
- unsigned int keylen)
-{
- if (!vector && PR_SUCCESS != freebl_RunLoaderOnce()) {
- return SECFailure;
- }
- return (vector->p_BLAKE2B_MAC_HashBuf)(output, input, inlen, key, keylen);
-}
-
-BLAKE2BContext *
-BLAKE2B_NewContext(void)
-{
- if (!vector && PR_SUCCESS != freebl_RunLoaderOnce()) {
- return NULL;
- }
- return (vector->p_BLAKE2B_NewContext)();
-}
-
-void
-BLAKE2B_DestroyContext(BLAKE2BContext *BLAKE2BContext, PRBool freeit)
-{
- if (!vector && PR_SUCCESS != freebl_RunLoaderOnce()) {
- return;
- }
- (vector->p_BLAKE2B_DestroyContext)(BLAKE2BContext, freeit);
-}
-
-SECStatus
-BLAKE2B_Begin(BLAKE2BContext *ctx)
-{
- if (!vector && PR_SUCCESS != freebl_RunLoaderOnce()) {
- return SECFailure;
- }
- return (vector->p_BLAKE2B_Begin)(ctx);
-}
-
-SECStatus
-BLAKE2B_MAC_Begin(BLAKE2BContext *ctx, const PRUint8 *key, const size_t keylen)
-{
- if (!vector && PR_SUCCESS != freebl_RunLoaderOnce()) {
- return SECFailure;
- }
- return (vector->p_BLAKE2B_MAC_Begin)(ctx, key, keylen);
-}
-
-SECStatus
-BLAKE2B_Update(BLAKE2BContext *ctx, const unsigned char *in, unsigned int inlen)
-{
- if (!vector && PR_SUCCESS != freebl_RunLoaderOnce()) {
- return SECFailure;
- }
- return (vector->p_BLAKE2B_Update)(ctx, in, inlen);
-}
-
-SECStatus
-BLAKE2B_End(BLAKE2BContext *ctx, unsigned char *out,
- unsigned int *digestLen, size_t maxDigestLen)
-{
- if (!vector && PR_SUCCESS != freebl_RunLoaderOnce()) {
- return SECFailure;
- }
- return (vector->p_BLAKE2B_End)(ctx, out, digestLen, maxDigestLen);
-}
-
-unsigned int
-BLAKE2B_FlattenSize(BLAKE2BContext *ctx)
-{
- if (!vector && PR_SUCCESS != freebl_RunLoaderOnce()) {
- return 0;
- }
- return (vector->p_BLAKE2B_FlattenSize)(ctx);
-}
-
-SECStatus
-BLAKE2B_Flatten(BLAKE2BContext *ctx, unsigned char *space)
-{
- if (!vector && PR_SUCCESS != freebl_RunLoaderOnce()) {
- return SECFailure;
- }
- return (vector->p_BLAKE2B_Flatten)(ctx, space);
-}
-
-BLAKE2BContext *
-BLAKE2B_Resurrect(unsigned char *space, void *arg)
-{
- if (!vector && PR_SUCCESS != freebl_RunLoaderOnce()) {
- return NULL;
- }
- return (vector->p_BLAKE2B_Resurrect)(space, arg);
-}
diff --git a/security/nss/lib/freebl/loader.h b/security/nss/lib/freebl/loader.h
index ff10cf9bad..ed392cc47e 100644
--- a/security/nss/lib/freebl/loader.h
+++ b/security/nss/lib/freebl/loader.h
@@ -10,7 +10,7 @@
#include "blapi.h"
-#define FREEBL_VERSION 0x0314
+#define FREEBL_VERSION 0x0313
struct FREEBLVectorStr {
@@ -736,29 +736,6 @@ struct FREEBLVectorStr {
/* Version 3.019 came to here */
- SECStatus (*p_BLAKE2B_Hash)(unsigned char *dest, const char *src);
- SECStatus (*p_BLAKE2B_HashBuf)(unsigned char *output,
- const unsigned char *input, PRUint32 inlen);
- SECStatus (*p_BLAKE2B_MAC_HashBuf)(unsigned char *output,
- const unsigned char *input,
- unsigned int inlen,
- const unsigned char *key,
- unsigned int keylen);
- BLAKE2BContext *(*p_BLAKE2B_NewContext)();
- void (*p_BLAKE2B_DestroyContext)(BLAKE2BContext *ctx, PRBool freeit);
- SECStatus (*p_BLAKE2B_Begin)(BLAKE2BContext *ctx);
- SECStatus (*p_BLAKE2B_MAC_Begin)(BLAKE2BContext *ctx, const PRUint8 *key,
- const size_t keylen);
- SECStatus (*p_BLAKE2B_Update)(BLAKE2BContext *ctx, const unsigned char *in,
- unsigned int inlen);
- SECStatus (*p_BLAKE2B_End)(BLAKE2BContext *ctx, unsigned char *out,
- unsigned int *digestLen, size_t maxDigestLen);
- unsigned int (*p_BLAKE2B_FlattenSize)(BLAKE2BContext *ctx);
- SECStatus (*p_BLAKE2B_Flatten)(BLAKE2BContext *ctx, unsigned char *space);
- BLAKE2BContext *(*p_BLAKE2B_Resurrect)(unsigned char *space, void *arg);
-
- /* Version 3.020 came to here */
-
/* Add new function pointers at the end of this struct and bump
* FREEBL_VERSION at the beginning of this file. */
};
diff --git a/security/nss/lib/freebl/manifest.mn b/security/nss/lib/freebl/manifest.mn
index e4c9ab0b74..bf81442182 100644
--- a/security/nss/lib/freebl/manifest.mn
+++ b/security/nss/lib/freebl/manifest.mn
@@ -1,10 +1,10 @@
-#
+#
# 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: any ifdefs in this file must be defined on the gmake command line
-# (if anywhere). They cannot come from Makefile or config.mk
+# (if anywhere). They cannot come from Makefile or config.mk
CORE_DEPTH = ../..
@@ -75,7 +75,7 @@ DEFINES += -DSHLIB_SUFFIX=\"$(DLL_SUFFIX)\" -DSHLIB_PREFIX=\"$(DLL_PREFIX)\" \
-DSHLIB_VERSION=\"$(LIBRARY_VERSION)\" \
-DSOFTOKEN_SHLIB_VERSION=\"$(SOFTOKEN_LIBRARY_VERSION)\"
-REQUIRES =
+REQUIRES =
EXPORTS = \
blapit.h \
@@ -86,7 +86,6 @@ EXPORTS = \
PRIVATE_EXPORTS = \
alghmac.h \
- blake2b.h \
blapi.h \
chacha20poly1305.h \
hmacct.h \
@@ -103,13 +102,16 @@ MPI_SRCS = mpprime.c mpmontg.c mplogic.c mpi.c mp_gf2m.c
ECL_HDRS = ecl-exp.h ecl.h ecp.h ecl-priv.h
+ifndef NSS_DISABLE_ECC
ECL_SRCS = ecl.c ecl_mult.c ecl_gf.c \
ecp_aff.c ecp_jac.c ecp_mont.c \
ec_naf.c ecp_jm.c ecp_256.c ecp_384.c ecp_521.c \
ecp_256_32.c ecp_25519.c
+else
+ECL_SRCS = $(NULL)
+endif
SHA_SRCS = sha_fast.c
MPCPU_SRCS = mpcpucache.c
-VERIFIED_SRCS = $(NULL)
CSRCS = \
freeblver.c \
@@ -124,8 +126,6 @@ CSRCS = \
alg2268.c \
arcfour.c \
arcfive.c \
- crypto_primitives.c \
- blake2b.c \
desblapi.c \
des.c \
drbg.c \
@@ -153,7 +153,6 @@ CSRCS = \
$(MPI_SRCS) \
$(MPCPU_SRCS) \
$(ECL_SRCS) \
- $(VERIFIED_SRCS) \
$(STUBS_SRCS) \
$(LOWHASH_SRCS) \
$(EXTRA_SRCS) \
@@ -163,7 +162,6 @@ ALL_CSRCS := $(CSRCS)
ALL_HDRS = \
alghmac.h \
- blake2b.h \
blapi.h \
blapit.h \
des.h \
@@ -180,6 +178,12 @@ ALL_HDRS = \
$(NULL)
+ifdef AES_GEN_TBL
+DEFINES += -DRIJNDAEL_GENERATE_TABLES
+else
+ifdef AES_GEN_TBL_M
+DEFINES += -DRIJNDAEL_GENERATE_TABLES_MACRO
+else
ifdef AES_GEN_VAL
DEFINES += -DRIJNDAEL_GENERATE_VALUES
else
@@ -189,3 +193,5 @@ else
DEFINES += -DRIJNDAEL_INCLUDE_TABLES
endif
endif
+endif
+endif
diff --git a/security/nss/lib/freebl/mpi/README b/security/nss/lib/freebl/mpi/README
index cf43027580..776ba713a1 100644
--- a/security/nss/lib/freebl/mpi/README
+++ b/security/nss/lib/freebl/mpi/README
@@ -53,7 +53,7 @@ to change are:
single digit. This is just a printf() format string, so you
can adjust it appropriately.
-(3) The macros DIGIT_MAX and MP_WORD_MAX, which specify the
+(3) The macros DIGIT_MAX and MP_WORD_MAX, which specify the
largest value expressible in an mp_digit and an mp_word,
respectively.
@@ -345,7 +345,7 @@ returns values of x and y satisfying Bezout's identity. This is used
by mp_invmod() to find modular inverses. However, if you do not need
these values, you will find that mp_gcd() is MUCH more efficient,
since it doesn't need all the intermediate values that mp_xgcd()
-requires in order to compute x and y.
+requires in order to compute x and y.
The mp_gcd() (and mp_xgcd()) functions use the binary (extended) GCD
algorithm due to Josef Stein.
@@ -361,7 +361,7 @@ mp_read_radix(mp, str, r) - convert a string in radix r to an mp_int
mp_read_raw(mp, s, len) - convert a string of bytes to an mp_int
mp_radix_size(mp, r) - return length of buffer needed by mp_toradix()
mp_raw_size(mp) - return length of buffer needed by mp_toraw()
-mp_toradix(mp, str, r) - convert an mp_int to a string of radix r
+mp_toradix(mp, str, r) - convert an mp_int to a string of radix r
digits
mp_toraw(mp, str) - convert an mp_int to a string of bytes
mp_tovalue(ch, r) - convert ch to its value when taken as
@@ -387,7 +387,7 @@ The mp_read_radix() and mp_toradix() functions support bases from 2 to
than this, you will need to write them yourself (that's why mp_div_d()
is provided, after all).
-Note: mp_read_radix() will accept as digits either capital or
+Note: mp_read_radix() will accept as digits either capital or
---- lower-case letters. However, the current implementation of
mp_toradix() only outputs upper-case letters, when writing
bases betwee 10 and 36. The underlying code supports using
@@ -448,14 +448,14 @@ Note: The mpp_random() and mpp_random_size() functions use the C
to change.
mpp_divis_vector(a, v, s, w) - is a divisible by any of the s digits
- in v? If so, let w be the index of
+ in v? If so, let w be the index of
that digit
mpp_divis_primes(a, np) - is a divisible by any of the first np
- primes? If so, set np to the prime
+ primes? If so, set np to the prime
which divided a.
-mpp_fermat(a, d) - test if w^a = w (mod a). If so,
+mpp_fermat(a, d) - test if w^a = w (mod a). If so,
returns MP_YES, otherwise MP_NO.
mpp_pprime(a, nt) - perform nt iterations of the Rabin-
@@ -486,7 +486,7 @@ The file 'mpi-config.h' defines several configurable parameters for
the library, which you can adjust to suit your application. At the
time of this writing, the available options are:
-MP_IOFUNC - Define true to include the mp_print() function,
+MP_IOFUNC - Define true to include the mp_print() function,
which is moderately useful for debugging. This
implicitly includes <stdio.h>.
@@ -502,14 +502,21 @@ MP_LOGTAB - If true, the file "logtab.h" is included, which
the library includes <math.h> and uses log(). This
typically forces you to link against math libraries.
+MP_MEMSET - If true, use memset() to zero buffers. If you run
+ into weird alignment related bugs, set this to zero
+ and an explicit loop will be used.
+
+MP_MEMCPY - If true, use memcpy() to copy buffers. If you run
+ into weird alignment bugs, set this to zero and an
+ explicit loop will be used.
MP_ARGCHK - Set to 0, 1, or 2. This defines how the argument
- checking macro, ARGCHK(), gets expanded. If this
- is set to zero, ARGCHK() expands to nothing; no
+ checking macro, ARGCHK(), gets expanded. If this
+ is set to zero, ARGCHK() expands to nothing; no
argument checks are performed. If this is 1, the
ARGCHK() macro expands to code that returns MP_BADARG
- or similar at runtime. If it is 2, ARGCHK() expands
- to an assert() call that aborts the program on a
+ or similar at runtime. If it is 2, ARGCHK() expands
+ to an assert() call that aborts the program on a
bad input.
MP_DEBUG - Turns on debugging output. This is probably not at
@@ -521,14 +528,14 @@ MP_DEFPREC - The default precision of a newly-created mp_int, in
the mp_set_prec() function, but this is its initial
value.
-MP_SQUARE - If this is set to a nonzero value, the mp_sqr()
+MP_SQUARE - If this is set to a nonzero value, the mp_sqr()
function will use an alternate algorithm that takes
advantage of the redundant inner product computation
when both multiplicands are identical. Unfortunately,
with some compilers this is actually SLOWER than just
calling mp_mul() with the same argument twice. So
if you set MP_SQUARE to zero, mp_sqr() will be expan-
- ded into a call to mp_mul(). This applies to all
+ ded into a call to mp_mul(). This applies to all
the uses of mp_sqr(), including mp_sqrmod() and the
internal calls to s_mp_sqr() inside mpi.c
@@ -561,7 +568,7 @@ CFLAGS=-ansi -pedantic -Wall -O2
If all goes well, the library should compile without warnings using
this combination. You should, of course, make whatever adjustments
-you find necessary.
+you find necessary.
The MPI library distribution comes with several additional programs
which are intended to demonstrate the use of the library, and provide
@@ -573,7 +580,7 @@ directory) for manipulating large numbers. These include:
basecvt.c A radix-conversion program, supporting bases from
2 to 64 inclusive.
-bbsrand.c A BBS (quadratic residue) pseudo-random number
+bbsrand.c A BBS (quadratic residue) pseudo-random number
generator. The file 'bbsrand.c' is just the driver
for the program; the real code lives in the files
'bbs_rand.h' and 'bbs_rand.c'
@@ -619,7 +626,7 @@ Acknowledgements:
----------------
The algorithms used in this library were drawn primarily from Volume
-2 of Donald Knuth's magnum opus, _The Art of Computer Programming_,
+2 of Donald Knuth's magnum opus, _The Art of Computer Programming_,
"Semi-Numerical Methods". Barrett's algorithm for modular reduction
came from Menezes, Oorschot, and Vanstone's _Handbook of Applied
Cryptography_, Chapter 14.
diff --git a/security/nss/lib/freebl/mpi/mpi-config.h b/security/nss/lib/freebl/mpi/mpi-config.h
index 0cc868a14b..c6f72b206f 100644
--- a/security/nss/lib/freebl/mpi/mpi-config.h
+++ b/security/nss/lib/freebl/mpi/mpi-config.h
@@ -28,6 +28,14 @@
#define MP_LOGTAB 1 /* use table of logs instead of log()? */
#endif
+#ifndef MP_MEMSET
+#define MP_MEMSET 1 /* use memset() to zero buffers? */
+#endif
+
+#ifndef MP_MEMCPY
+#define MP_MEMCPY 1 /* use memcpy() to copy buffers? */
+#endif
+
#ifndef MP_ARGCHK
/*
0 = no parameter checks
diff --git a/security/nss/lib/freebl/mpi/mpi.c b/security/nss/lib/freebl/mpi/mpi.c
index ae404019d8..f7784c8d9d 100644
--- a/security/nss/lib/freebl/mpi/mpi.c
+++ b/security/nss/lib/freebl/mpi/mpi.c
@@ -2782,7 +2782,15 @@ s_mp_pad(mp_int *mp, mp_size min)
void
s_mp_setz(mp_digit *dp, mp_size count)
{
+#if MP_MEMSET == 0
+ int ix;
+
+ for (ix = 0; ix < count; ix++)
+ dp[ix] = 0;
+#else
memset(dp, 0, count * sizeof(mp_digit));
+#endif
+
} /* end s_mp_setz() */
/* }}} */
@@ -2793,7 +2801,14 @@ s_mp_setz(mp_digit *dp, mp_size count)
void
s_mp_copy(const mp_digit *sp, mp_digit *dp, mp_size count)
{
+#if MP_MEMCPY == 0
+ int ix;
+
+ for (ix = 0; ix < count; ix++)
+ dp[ix] = sp[ix];
+#else
memcpy(dp, sp, count * sizeof(mp_digit));
+#endif
} /* end s_mp_copy() */
/* }}} */
diff --git a/security/nss/lib/freebl/nsslowhash.c b/security/nss/lib/freebl/nsslowhash.c
index 22f97810f4..5ed039689c 100644
--- a/security/nss/lib/freebl/nsslowhash.c
+++ b/security/nss/lib/freebl/nsslowhash.c
@@ -22,7 +22,6 @@ struct NSSLOWHASHContextStr {
void *hashCtxt;
};
-#ifndef NSS_FIPS_DISABLED
static int
nsslow_GetFIPSEnabled(void)
{
@@ -41,10 +40,9 @@ nsslow_GetFIPSEnabled(void)
return 0;
if (d != '1')
return 0;
-#endif /* LINUX */
+#endif
return 1;
}
-#endif /* NSS_FIPS_DISABLED */
static NSSLOWInitContext dummyContext = { 0 };
static PRBool post_failed = PR_TRUE;
@@ -56,7 +54,6 @@ NSSLOW_Init(void)
(void)FREEBL_InitStubs();
#endif
-#ifndef NSS_FIPS_DISABLED
/* make sure the FIPS product is installed if we are trying to
* go into FIPS mode */
if (nsslow_GetFIPSEnabled()) {
@@ -66,7 +63,6 @@ NSSLOW_Init(void)
return NULL;
}
}
-#endif
post_failed = PR_FALSE;
return &dummyContext;
diff --git a/security/nss/lib/freebl/poly1305.h b/security/nss/lib/freebl/poly1305.h
index 125f49b3ba..0a463483fc 100644
--- a/security/nss/lib/freebl/poly1305.h
+++ b/security/nss/lib/freebl/poly1305.h
@@ -8,8 +8,6 @@
#ifndef FREEBL_POLY1305_H_
#define FREEBL_POLY1305_H_
-#include "stddef.h"
-
typedef unsigned char poly1305_state[512];
/* Poly1305Init sets up |state| so that it can be used to calculate an
diff --git a/security/nss/lib/freebl/rijndael.c b/security/nss/lib/freebl/rijndael.c
index 5de27de9ce..e4ad60388f 100644
--- a/security/nss/lib/freebl/rijndael.c
+++ b/security/nss/lib/freebl/rijndael.c
@@ -27,39 +27,16 @@
#include "intel-gcm.h"
#endif /* INTEL_GCM */
-/* Forward declarations */
-void rijndael_native_key_expansion(AESContext *cx, const unsigned char *key,
- unsigned int Nk);
-void rijndael_native_encryptBlock(AESContext *cx,
- unsigned char *output,
- const unsigned char *input);
-
-/* Stub definitions for the above rijndael_native_* functions, which
- * shouldn't be used unless NSS_X86_OR_X64 is defined */
-#ifndef NSS_X86_OR_X64
-void
-rijndael_native_key_expansion(AESContext *cx, const unsigned char *key,
- unsigned int Nk)
-{
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- PORT_Assert(0);
-}
-
-void
-rijndael_native_encryptBlock(AESContext *cx,
- unsigned char *output,
- const unsigned char *input)
-{
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- PORT_Assert(0);
-}
-#endif /* NSS_X86_OR_X64 */
-
/*
- * There are currently three ways to build this code, varying in performance
+ * There are currently five ways to build this code, varying in performance
* and code size.
*
* RIJNDAEL_INCLUDE_TABLES Include all tables from rijndael32.tab
+ * RIJNDAEL_GENERATE_TABLES Generate tables on first
+ * encryption/decryption, then store them;
+ * use the function gfm
+ * RIJNDAEL_GENERATE_TABLES_MACRO Same as above, but use macros to do
+ * the generation
* RIJNDAEL_GENERATE_VALUES Do not store tables, generate the table
* values "on-the-fly", using gfm
* RIJNDAEL_GENERATE_VALUES_MACRO Same as above, but use macros
@@ -131,7 +108,8 @@ rijndael_native_encryptBlock(AESContext *cx,
((a & 0x80) ? ((a << 1) ^ 0x1b) : (a << 1))
/* Choose GFM method (macros or function) */
-#if defined(RIJNDAEL_GENERATE_VALUES_MACRO)
+#if defined(RIJNDAEL_GENERATE_TABLES_MACRO) || \
+ defined(RIJNDAEL_GENERATE_VALUES_MACRO)
/*
* Galois field GF(2**8) multipliers, in macro form
@@ -155,7 +133,7 @@ rijndael_native_encryptBlock(AESContext *cx,
#define GFM0E(a) \
(GFM02(a) ^ GFM04(a) ^ GFM08(a)) /* a * 0E = a * (02 + 04 + 08) */
-#else /* RIJNDAEL_GENERATE_VALUES */
+#else /* RIJNDAEL_GENERATE_TABLES or RIJNDAEL_GENERATE_VALUES */
/* GF_MULTIPLY
*
@@ -266,7 +244,7 @@ gen_TInvXi(PRUint8 tx, PRUint8 i)
#define IMXC1(b) G_IMXC1(b)
#define IMXC2(b) G_IMXC2(b)
#define IMXC3(b) G_IMXC3(b)
-#else /* RIJNDAEL_GENERATE_VALUES_MACRO */
+#elif defined(RIJNDAEL_GENERATE_VALUES_MACRO)
/* generate values for the tables with macros */
#define T0(i) G_T0(i)
#define T1(i) G_T1(i)
@@ -280,10 +258,84 @@ gen_TInvXi(PRUint8 tx, PRUint8 i)
#define IMXC1(b) G_IMXC1(b)
#define IMXC2(b) G_IMXC2(b)
#define IMXC3(b) G_IMXC3(b)
+#else /* RIJNDAEL_GENERATE_TABLES or RIJNDAEL_GENERATE_TABLES_MACRO */
+/* Generate T and T**-1 table values and store, then index */
+/* The inverse mix column tables are still generated */
+#define T0(i) rijndaelTables->T0[i]
+#define T1(i) rijndaelTables->T1[i]
+#define T2(i) rijndaelTables->T2[i]
+#define T3(i) rijndaelTables->T3[i]
+#define TInv0(i) rijndaelTables->TInv0[i]
+#define TInv1(i) rijndaelTables->TInv1[i]
+#define TInv2(i) rijndaelTables->TInv2[i]
+#define TInv3(i) rijndaelTables->TInv3[i]
+#define IMXC0(b) G_IMXC0(b)
+#define IMXC1(b) G_IMXC1(b)
+#define IMXC2(b) G_IMXC2(b)
+#define IMXC3(b) G_IMXC3(b)
#endif /* choose T-table indexing method */
#endif /* not RIJNDAEL_INCLUDE_TABLES */
+#if defined(RIJNDAEL_GENERATE_TABLES) || \
+ defined(RIJNDAEL_GENERATE_TABLES_MACRO)
+
+/* Code to generate and store the tables */
+
+struct rijndael_tables_str {
+ PRUint32 T0[256];
+ PRUint32 T1[256];
+ PRUint32 T2[256];
+ PRUint32 T3[256];
+ PRUint32 TInv0[256];
+ PRUint32 TInv1[256];
+ PRUint32 TInv2[256];
+ PRUint32 TInv3[256];
+};
+
+static struct rijndael_tables_str *rijndaelTables = NULL;
+static PRCallOnceType coRTInit = { 0, 0, 0 };
+static PRStatus
+init_rijndael_tables(void)
+{
+ PRUint32 i;
+ PRUint8 si01, si02, si03, si04, si08, si09, si0B, si0D, si0E;
+ struct rijndael_tables_str *rts;
+ rts = (struct rijndael_tables_str *)
+ PORT_Alloc(sizeof(struct rijndael_tables_str));
+ if (!rts)
+ return PR_FAILURE;
+ for (i = 0; i < 256; i++) {
+ /* The forward values */
+ si01 = SBOX(i);
+ si02 = XTIME(si01);
+ si03 = si02 ^ si01;
+ rts->T0[i] = WORD4(si02, si01, si01, si03);
+ rts->T1[i] = WORD4(si03, si02, si01, si01);
+ rts->T2[i] = WORD4(si01, si03, si02, si01);
+ rts->T3[i] = WORD4(si01, si01, si03, si02);
+ /* The inverse values */
+ si01 = SINV(i);
+ si02 = XTIME(si01);
+ si04 = XTIME(si02);
+ si08 = XTIME(si04);
+ si03 = si02 ^ si01;
+ si09 = si08 ^ si01;
+ si0B = si08 ^ si03;
+ si0D = si09 ^ si04;
+ si0E = si08 ^ si04 ^ si02;
+ rts->TInv0[i] = WORD4(si0E, si09, si0D, si0B);
+ rts->TInv1[i] = WORD4(si0B, si0E, si09, si0D);
+ rts->TInv2[i] = WORD4(si0D, si0B, si0E, si09);
+ rts->TInv3[i] = WORD4(si09, si0D, si0B, si0E);
+ }
+ /* wait until all the values are in to set */
+ rijndaelTables = rts;
+ return PR_SUCCESS;
+}
+
+#endif /* code to generate tables */
+
/**************************************************************************
*
* Stuff related to the Rijndael key schedule
@@ -337,6 +389,162 @@ rijndael_key_expansion7(AESContext *cx, const unsigned char *key, unsigned int N
}
}
+#if defined(NSS_X86_OR_X64)
+#define EXPAND_KEY128(k, rcon, res) \
+ tmp_key = _mm_aeskeygenassist_si128(k, rcon); \
+ tmp_key = _mm_shuffle_epi32(tmp_key, 0xFF); \
+ tmp = _mm_xor_si128(k, _mm_slli_si128(k, 4)); \
+ tmp = _mm_xor_si128(tmp, _mm_slli_si128(tmp, 4)); \
+ tmp = _mm_xor_si128(tmp, _mm_slli_si128(tmp, 4)); \
+ res = _mm_xor_si128(tmp, tmp_key)
+
+static void
+native_key_expansion128(AESContext *cx, const unsigned char *key)
+{
+ __m128i *keySchedule = cx->keySchedule;
+ pre_align __m128i tmp_key post_align;
+ pre_align __m128i tmp post_align;
+ keySchedule[0] = _mm_loadu_si128((__m128i *)key);
+ EXPAND_KEY128(keySchedule[0], 0x01, keySchedule[1]);
+ EXPAND_KEY128(keySchedule[1], 0x02, keySchedule[2]);
+ EXPAND_KEY128(keySchedule[2], 0x04, keySchedule[3]);
+ EXPAND_KEY128(keySchedule[3], 0x08, keySchedule[4]);
+ EXPAND_KEY128(keySchedule[4], 0x10, keySchedule[5]);
+ EXPAND_KEY128(keySchedule[5], 0x20, keySchedule[6]);
+ EXPAND_KEY128(keySchedule[6], 0x40, keySchedule[7]);
+ EXPAND_KEY128(keySchedule[7], 0x80, keySchedule[8]);
+ EXPAND_KEY128(keySchedule[8], 0x1B, keySchedule[9]);
+ EXPAND_KEY128(keySchedule[9], 0x36, keySchedule[10]);
+}
+
+#define EXPAND_KEY192_PART1(res, k0, kt, rcon) \
+ tmp2 = _mm_slli_si128(k0, 4); \
+ tmp1 = _mm_xor_si128(k0, tmp2); \
+ tmp2 = _mm_slli_si128(tmp2, 4); \
+ tmp1 = _mm_xor_si128(_mm_xor_si128(tmp1, tmp2), _mm_slli_si128(tmp2, 4)); \
+ tmp2 = _mm_aeskeygenassist_si128(kt, rcon); \
+ res = _mm_xor_si128(tmp1, _mm_shuffle_epi32(tmp2, 0x55))
+
+#define EXPAND_KEY192_PART2(res, k1, k2) \
+ tmp2 = _mm_xor_si128(k1, _mm_slli_si128(k1, 4)); \
+ res = _mm_xor_si128(tmp2, _mm_shuffle_epi32(k2, 0xFF))
+
+#define EXPAND_KEY192(k0, res1, res2, res3, carry, rcon1, rcon2) \
+ EXPAND_KEY192_PART1(tmp3, k0, res1, rcon1); \
+ EXPAND_KEY192_PART2(carry, res1, tmp3); \
+ res1 = _mm_castpd_si128(_mm_shuffle_pd(_mm_castsi128_pd(res1), \
+ _mm_castsi128_pd(tmp3), 0)); \
+ res2 = _mm_castpd_si128(_mm_shuffle_pd(_mm_castsi128_pd(tmp3), \
+ _mm_castsi128_pd(carry), 1)); \
+ EXPAND_KEY192_PART1(res3, tmp3, carry, rcon2)
+
+static void
+native_key_expansion192(AESContext *cx, const unsigned char *key)
+{
+ __m128i *keySchedule = cx->keySchedule;
+ pre_align __m128i tmp1 post_align;
+ pre_align __m128i tmp2 post_align;
+ pre_align __m128i tmp3 post_align;
+ pre_align __m128i carry post_align;
+ keySchedule[0] = _mm_loadu_si128((__m128i *)key);
+ keySchedule[1] = _mm_loadu_si128((__m128i *)(key + 16));
+ EXPAND_KEY192(keySchedule[0], keySchedule[1], keySchedule[2],
+ keySchedule[3], carry, 0x1, 0x2);
+ EXPAND_KEY192_PART2(keySchedule[4], carry, keySchedule[3]);
+ EXPAND_KEY192(keySchedule[3], keySchedule[4], keySchedule[5],
+ keySchedule[6], carry, 0x4, 0x8);
+ EXPAND_KEY192_PART2(keySchedule[7], carry, keySchedule[6]);
+ EXPAND_KEY192(keySchedule[6], keySchedule[7], keySchedule[8],
+ keySchedule[9], carry, 0x10, 0x20);
+ EXPAND_KEY192_PART2(keySchedule[10], carry, keySchedule[9]);
+ EXPAND_KEY192(keySchedule[9], keySchedule[10], keySchedule[11],
+ keySchedule[12], carry, 0x40, 0x80);
+}
+
+#define EXPAND_KEY256_PART(res, rconx, k1x, k2x, X) \
+ tmp_key = _mm_shuffle_epi32(_mm_aeskeygenassist_si128(k2x, rconx), X); \
+ tmp2 = _mm_slli_si128(k1x, 4); \
+ tmp1 = _mm_xor_si128(k1x, tmp2); \
+ tmp2 = _mm_slli_si128(tmp2, 4); \
+ tmp1 = _mm_xor_si128(_mm_xor_si128(tmp1, tmp2), _mm_slli_si128(tmp2, 4)); \
+ res = _mm_xor_si128(tmp1, tmp_key);
+
+#define EXPAND_KEY256(res1, res2, k1, k2, rcon) \
+ EXPAND_KEY256_PART(res1, rcon, k1, k2, 0xFF); \
+ EXPAND_KEY256_PART(res2, 0x00, k2, res1, 0xAA)
+
+static void
+native_key_expansion256(AESContext *cx, const unsigned char *key)
+{
+ __m128i *keySchedule = cx->keySchedule;
+ pre_align __m128i tmp_key post_align;
+ pre_align __m128i tmp1 post_align;
+ pre_align __m128i tmp2 post_align;
+ keySchedule[0] = _mm_loadu_si128((__m128i *)key);
+ keySchedule[1] = _mm_loadu_si128((__m128i *)(key + 16));
+ EXPAND_KEY256(keySchedule[2], keySchedule[3], keySchedule[0],
+ keySchedule[1], 0x01);
+ EXPAND_KEY256(keySchedule[4], keySchedule[5], keySchedule[2],
+ keySchedule[3], 0x02);
+ EXPAND_KEY256(keySchedule[6], keySchedule[7], keySchedule[4],
+ keySchedule[5], 0x04);
+ EXPAND_KEY256(keySchedule[8], keySchedule[9], keySchedule[6],
+ keySchedule[7], 0x08);
+ EXPAND_KEY256(keySchedule[10], keySchedule[11], keySchedule[8],
+ keySchedule[9], 0x10);
+ EXPAND_KEY256(keySchedule[12], keySchedule[13], keySchedule[10],
+ keySchedule[11], 0x20);
+ EXPAND_KEY256_PART(keySchedule[14], 0x40, keySchedule[12],
+ keySchedule[13], 0xFF);
+}
+
+#endif /* NSS_X86_OR_X64 */
+
+/*
+ * AES key expansion using aes-ni instructions.
+ */
+static void
+native_key_expansion(AESContext *cx, const unsigned char *key, unsigned int Nk)
+{
+#ifdef NSS_X86_OR_X64
+ switch (Nk) {
+ case 4:
+ native_key_expansion128(cx, key);
+ return;
+ case 6:
+ native_key_expansion192(cx, key);
+ return;
+ case 8:
+ native_key_expansion256(cx, key);
+ return;
+ default:
+ /* This shouldn't happen. */
+ PORT_Assert(0);
+ }
+#else
+ PORT_Assert(0);
+#endif /* NSS_X86_OR_X64 */
+}
+
+static void
+native_encryptBlock(AESContext *cx,
+ unsigned char *output,
+ const unsigned char *input)
+{
+#ifdef NSS_X86_OR_X64
+ int i;
+ pre_align __m128i m post_align = _mm_loadu_si128((__m128i *)input);
+ m = _mm_xor_si128(m, cx->keySchedule[0]);
+ for (i = 1; i < cx->Nr; ++i) {
+ m = _mm_aesenc_si128(m, cx->keySchedule[i]);
+ }
+ m = _mm_aesenclast_si128(m, cx->keySchedule[cx->Nr]);
+ _mm_storeu_si128((__m128i *)output, m);
+#else
+ PORT_Assert(0);
+#endif /* NSS_X86_OR_X64 */
+}
+
/* rijndael_key_expansion
*
* Generate the expanded key from the key input by the user.
@@ -702,7 +910,7 @@ rijndael_encryptECB(AESContext *cx, unsigned char *output,
if (aesni_support()) {
/* Use hardware acceleration for normal AES parameters. */
- encryptor = &rijndael_native_encryptBlock;
+ encryptor = &native_encryptBlock;
} else {
encryptor = &rijndael_encryptBlock128;
}
@@ -809,7 +1017,14 @@ rijndael_decryptCBC(AESContext *cx, unsigned char *output,
AESContext *
AES_AllocateContext(void)
{
- return PORT_ZNewAligned(AESContext, 16, mem);
+ /* aligned_alloc is C11 so we have to do it the old way. */
+ AESContext *ctx = PORT_ZAlloc(sizeof(AESContext) + 15);
+ if (ctx == NULL) {
+ PORT_SetError(SEC_ERROR_NO_MEMORY);
+ return NULL;
+ }
+ ctx->mem = ctx;
+ return (AESContext *)(((uintptr_t)ctx + 15) & ~(uintptr_t)0x0F);
}
/*
@@ -892,13 +1107,22 @@ aes_InitContext(AESContext *cx, const unsigned char *key, unsigned int keysize,
} else
#endif
{
+
+#if defined(RIJNDAEL_GENERATE_TABLES) || \
+ defined(RIJNDAEL_GENERATE_TABLES_MACRO)
+ if (rijndaelTables == NULL) {
+ if (PR_CallOnce(&coRTInit, init_rijndael_tables) != PR_SUCCESS) {
+ return SECFailure;
+ }
+ }
+#endif
/* Generate expanded key */
if (encrypt) {
if (use_hw_aes && (cx->mode == NSS_AES_GCM || cx->mode == NSS_AES ||
cx->mode == NSS_AES_CTR)) {
PORT_Assert(keysize == 16 || keysize == 24 || keysize == 32);
/* Prepare hardware key for normal AES parameters. */
- rijndael_native_key_expansion(cx, key, Nk);
+ native_key_expansion(cx, key, Nk);
} else {
rijndael_key_expansion(cx, key, Nk);
}
diff --git a/security/nss/lib/freebl/rijndael.h b/security/nss/lib/freebl/rijndael.h
index 1b63a323da..1f4a8a9f73 100644
--- a/security/nss/lib/freebl/rijndael.h
+++ b/security/nss/lib/freebl/rijndael.h
@@ -8,22 +8,8 @@
#include "blapii.h"
#include <stdint.h>
-#if defined(NSS_X86_OR_X64)
-/* GCC <= 4.8 doesn't support including emmintrin.h without enabling SSE2 */
-#if !defined(__clang__) && defined(__GNUC__) && defined(__GNUC_MINOR__) && \
- (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ <= 8))
-#pragma GCC push_options
-#pragma GCC target("sse2")
-#undef NSS_DISABLE_SSE2
-#define NSS_DISABLE_SSE2 1
-#endif /* GCC <= 4.8 */
-
-#include <emmintrin.h> /* __m128i */
-
-#ifdef NSS_DISABLE_SSE2
-#undef NSS_DISABLE_SSE2
-#pragma GCC pop_options
-#endif /* NSS_DISABLE_SSE2 */
+#ifdef NSS_X86_OR_X64
+#include <wmmintrin.h> /* aes-ni */
#endif
typedef void AESBlockFunc(AESContext *cx,
diff --git a/security/nss/lib/freebl/rsa.c b/security/nss/lib/freebl/rsa.c
index a08636de65..7354d93179 100644
--- a/security/nss/lib/freebl/rsa.c
+++ b/security/nss/lib/freebl/rsa.c
@@ -276,10 +276,7 @@ RSAPrivateKey *
RSA_NewKey(int keySizeInBits, SECItem *publicExponent)
{
unsigned int primeLen;
- mp_int p = { 0, 0, 0, NULL };
- mp_int q = { 0, 0, 0, NULL };
- mp_int e = { 0, 0, 0, NULL };
- mp_int d = { 0, 0, 0, NULL };
+ mp_int p, q, e, d;
int kiter;
int max_attempts;
mp_err err = MP_OKAY;
@@ -293,46 +290,34 @@ RSA_NewKey(int keySizeInBits, SECItem *publicExponent)
PORT_SetError(SEC_ERROR_INVALID_ARGS);
return NULL;
}
- /* 1. Set the public exponent and check if it's uneven and greater than 2.*/
- MP_DIGITS(&e) = 0;
- CHECK_MPI_OK(mp_init(&e));
- SECITEM_TO_MPINT(*publicExponent, &e);
- if (mp_iseven(&e) || !(mp_cmp_d(&e, 2) > 0)) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- goto cleanup;
- }
-#ifndef NSS_FIPS_DISABLED
- /* Check that the exponent is not smaller than 65537 */
- if (mp_cmp_d(&e, 0x10001) < 0) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- goto cleanup;
- }
-#endif
-
- /* 2. Allocate arena & key */
+ /* 1. Allocate arena & key */
arena = PORT_NewArena(NSS_FREEBL_DEFAULT_CHUNKSIZE);
if (!arena) {
PORT_SetError(SEC_ERROR_NO_MEMORY);
- goto cleanup;
+ return NULL;
}
key = PORT_ArenaZNew(arena, RSAPrivateKey);
if (!key) {
PORT_SetError(SEC_ERROR_NO_MEMORY);
- goto cleanup;
+ PORT_FreeArena(arena, PR_TRUE);
+ return NULL;
}
key->arena = arena;
/* length of primes p and q (in bytes) */
primeLen = keySizeInBits / (2 * PR_BITS_PER_BYTE);
MP_DIGITS(&p) = 0;
MP_DIGITS(&q) = 0;
+ MP_DIGITS(&e) = 0;
MP_DIGITS(&d) = 0;
CHECK_MPI_OK(mp_init(&p));
CHECK_MPI_OK(mp_init(&q));
+ CHECK_MPI_OK(mp_init(&e));
CHECK_MPI_OK(mp_init(&d));
- /* 3. Set the version number (PKCS1 v1.5 says it should be zero) */
+ /* 2. Set the version number (PKCS1 v1.5 says it should be zero) */
SECITEM_AllocItem(arena, &key->version, 1);
key->version.data[0] = 0;
-
+ /* 3. Set the public exponent */
+ SECITEM_TO_MPINT(*publicExponent, &e);
kiter = 0;
max_attempts = 5 * (keySizeInBits / 2); /* FIPS 186-4 B.3.3 steps 4.7 and 5.8 */
do {
diff --git a/security/nss/lib/freebl/sha512.c b/security/nss/lib/freebl/sha512.c
index c1cfb73766..528f884b22 100644
--- a/security/nss/lib/freebl/sha512.c
+++ b/security/nss/lib/freebl/sha512.c
@@ -19,7 +19,6 @@
#include "secport.h" /* for PORT_XXX */
#include "blapi.h"
#include "sha256.h" /* for struct SHA256ContextStr */
-#include "crypto_primitives.h"
/* ============= Common constants and defines ======================= */
@@ -649,6 +648,15 @@ SHA224_Clone(SHA224Context *dest, SHA224Context *src)
/* common #defines for SHA512 and SHA384 */
#if defined(HAVE_LONG_LONG)
+#if defined(_MSC_VER)
+#pragma intrinsic(_rotr64, _rotl64)
+#define ROTR64(x, n) _rotr64(x, n)
+#define ROTL64(x, n) _rotl64(x, n)
+#else
+#define ROTR64(x, n) ((x >> n) | (x << (64 - n)))
+#define ROTL64(x, n) ((x << n) | (x >> (64 - n)))
+#endif
+
#define S0(x) (ROTR64(x, 28) ^ ROTR64(x, 34) ^ ROTR64(x, 39))
#define S1(x) (ROTR64(x, 14) ^ ROTR64(x, 18) ^ ROTR64(x, 41))
#define s0(x) (ROTR64(x, 1) ^ ROTR64(x, 8) ^ SHR(x, 7))
@@ -662,7 +670,36 @@ SHA224_Clone(SHA224Context *dest, SHA224Context *src)
#define ULLC(hi, lo) 0x##hi##lo##ULL
#endif
-#define BYTESWAP8(x) x = FREEBL_HTONLL(x)
+#if defined(IS_LITTLE_ENDIAN)
+#if defined(_MSC_VER)
+#pragma intrinsic(_byteswap_uint64)
+#define SHA_HTONLL(x) _byteswap_uint64(x)
+
+#elif defined(__GNUC__) && (defined(__x86_64__) || defined(__x86_64))
+static __inline__ PRUint64
+swap8b(PRUint64 value)
+{
+ __asm__("bswapq %0"
+ : "+r"(value));
+ return (value);
+}
+#define SHA_HTONLL(x) swap8b(x)
+
+#else
+#define SHA_MASK16 ULLC(0000FFFF, 0000FFFF)
+#define SHA_MASK8 ULLC(00FF00FF, 00FF00FF)
+static PRUint64
+swap8b(PRUint64 x)
+{
+ PRUint64 t1 = x;
+ t1 = ((t1 & SHA_MASK8) << 8) | ((t1 >> 8) & SHA_MASK8);
+ t1 = ((t1 & SHA_MASK16) << 16) | ((t1 >> 16) & SHA_MASK16);
+ return (t1 >> 32) | (t1 << 32);
+}
+#define SHA_HTONLL(x) swap8b(x)
+#endif
+#define BYTESWAP8(x) x = SHA_HTONLL(x)
+#endif /* defined(IS_LITTLE_ENDIAN) */
#else /* no long long */
@@ -671,8 +708,8 @@ SHA224_Clone(SHA224Context *dest, SHA224Context *src)
{ \
0x##lo##U, 0x##hi##U \
}
-#define FREEBL_HTONLL(x) (BYTESWAP4(x.lo), BYTESWAP4(x.hi), \
- x.hi ^= x.lo ^= x.hi ^= x.lo, x)
+#define SHA_HTONLL(x) (BYTESWAP4(x.lo), BYTESWAP4(x.hi), \
+ x.hi ^= x.lo ^= x.hi ^= x.lo, x)
#define BYTESWAP8(x) \
do { \
PRUint32 tmp; \
diff --git a/security/nss/lib/freebl/shvfy.c b/security/nss/lib/freebl/shvfy.c
index 98db4614bf..bd9cd1c94a 100644
--- a/security/nss/lib/freebl/shvfy.c
+++ b/security/nss/lib/freebl/shvfy.c
@@ -19,8 +19,6 @@
#include "pqg.h"
#include "blapii.h"
-#ifndef NSS_FIPS_DISABLED
-
/*
* Most modern version of Linux support a speed optimization scheme where an
* application called prelink modifies programs and shared libraries to quickly
@@ -539,23 +537,3 @@ BLAPI_VerifySelf(const char *name)
}
return blapi_SHVerify(name, (PRFuncPtr)decodeInt, PR_TRUE);
}
-
-#else /* NSS_FIPS_DISABLED */
-
-PRBool
-BLAPI_SHVerifyFile(const char *shName)
-{
- return PR_FALSE;
-}
-PRBool
-BLAPI_SHVerify(const char *name, PRFuncPtr addr)
-{
- return PR_FALSE;
-}
-PRBool
-BLAPI_VerifySelf(const char *name)
-{
- return PR_FALSE;
-}
-
-#endif /* NSS_FIPS_DISABLED */
diff --git a/security/nss/lib/freebl/stubs.c b/security/nss/lib/freebl/stubs.c
index 4d41ef975f..8e07849355 100644
--- a/security/nss/lib/freebl/stubs.c
+++ b/security/nss/lib/freebl/stubs.c
@@ -38,11 +38,6 @@
#include <blapi.h>
#include <private/pprio.h>
-/* Android API < 21 doesn't define RTLD_NOLOAD */
-#ifndef RTLD_NOLOAD
-#define RTLD_NOLOAD 0
-#endif
-
#define FREEBL_NO_WEAK 1
#define WEAK __attribute__((weak))
@@ -141,11 +136,6 @@ STUB_DECLARE(int, PORT_GetError_Util, (void));
STUB_DECLARE(PLArenaPool *, PORT_NewArena_Util, (unsigned long chunksize));
STUB_DECLARE(void, PORT_SetError_Util, (int value));
STUB_DECLARE(void *, PORT_ZAlloc_Util, (size_t len));
-STUB_DECLARE(void *, PORT_ZAllocAligned_Util, (size_t bytes, size_t alignment,
- void **mem));
-STUB_DECLARE(void *, PORT_ZAllocAlignedOffset_Util, (size_t bytes,
- size_t alignment,
- size_t offset));
STUB_DECLARE(void, PORT_ZFree_Util, (void *ptr, size_t len));
STUB_DECLARE(void, PR_Assert, (const char *s, const char *file, PRIntn ln));
@@ -184,14 +174,11 @@ STUB_DECLARE(void, SECITEM_FreeItem_Util, (SECItem * zap, PRBool freeit));
STUB_DECLARE(void, SECITEM_ZfreeItem_Util, (SECItem * zap, PRBool freeit));
STUB_DECLARE(SECOidTag, SECOID_FindOIDTag_Util, (const SECItem *oid));
STUB_DECLARE(int, NSS_SecureMemcmp, (const void *a, const void *b, size_t n));
-STUB_DECLARE(unsigned int, NSS_SecureMemcmpZero, (const void *mem, size_t n));
#define PORT_ZNew_stub(type) (type *)PORT_ZAlloc_stub(sizeof(type))
#define PORT_New_stub(type) (type *)PORT_Alloc_stub(sizeof(type))
#define PORT_ZNewArray_stub(type, num) \
(type *)PORT_ZAlloc_stub(sizeof(type) * (num))
-#define PORT_ZNewAligned_stub(type, alignment, mem) \
- (type *)PORT_ZAllocAlignedOffset_stub(sizeof(type), alignment, offsetof(type, mem))
/*
* NOTE: in order to support hashing only the memory allocation stubs,
@@ -227,52 +214,6 @@ PORT_ZAlloc_stub(size_t len)
return ptr;
}
-/* aligned_alloc is C11. This is an alternative to get aligned memory. */
-extern void *
-PORT_ZAllocAligned_stub(size_t bytes, size_t alignment, void **mem)
-{
- STUB_SAFE_CALL3(PORT_ZAllocAligned_Util, bytes, alignment, mem);
-
- /* This only works if alignement is a power of 2. */
- if ((alignment == 0) || (alignment & (alignment - 1))) {
- return NULL;
- }
-
- size_t x = alignment - 1;
- size_t len = (bytes ? bytes : 1) + x;
-
- if (!mem) {
- return NULL;
- }
-
- /* Always allocate a non-zero amount of bytes */
- *mem = malloc(len);
- if (!*mem) {
- return NULL;
- }
-
- memset(*mem, 0, len);
- return (void *)(((uintptr_t)*mem + x) & ~(uintptr_t)x);
-}
-
-extern void *
-PORT_ZAllocAlignedOffset_stub(size_t size, size_t alignment, size_t offset)
-{
- STUB_SAFE_CALL3(PORT_ZAllocAlignedOffset_Util, size, alignment, offset);
- if (offset > size) {
- return NULL;
- }
-
- void *mem = NULL;
- void *v = PORT_ZAllocAligned_stub(size, alignment, &mem);
- if (!v) {
- return NULL;
- }
-
- *((void **)((uintptr_t)v + offset)) = mem;
- return v;
-}
-
extern void
PORT_ZFree_stub(void *ptr, size_t len)
{
@@ -649,13 +590,6 @@ NSS_SecureMemcmp_stub(const void *a, const void *b, size_t n)
abort();
}
-extern unsigned int
-NSS_SecureMemcmpZero_stub(const void *mem, size_t n)
-{
- STUB_SAFE_CALL2(NSS_SecureMemcmpZero, mem, n);
- abort();
-}
-
#ifdef FREEBL_NO_WEAK
static const char *nsprLibName = SHLIB_PREFIX "nspr4." SHLIB_SUFFIX;
@@ -708,7 +642,6 @@ freebl_InitNSSUtil(void *lib)
STUB_FETCH_FUNCTION(SECITEM_ZfreeItem_Util);
STUB_FETCH_FUNCTION(SECOID_FindOIDTag_Util);
STUB_FETCH_FUNCTION(NSS_SecureMemcmp);
- STUB_FETCH_FUNCTION(NSS_SecureMemcmpZero);
return SECSuccess;
}
diff --git a/security/nss/lib/freebl/stubs.h b/security/nss/lib/freebl/stubs.h
index e63cf7a5de..25ec394ecd 100644
--- a/security/nss/lib/freebl/stubs.h
+++ b/security/nss/lib/freebl/stubs.h
@@ -30,8 +30,6 @@
#define PORT_SetError PORT_SetError_stub
#define PORT_ZAlloc PORT_ZAlloc_stub
#define PORT_ZFree PORT_ZFree_stub
-#define PORT_ZAllocAligned PORT_ZAllocAligned_stub
-#define PORT_ZAllocAlignedOffset PORT_ZAllocAlignedOffset_stub
#define SECITEM_AllocItem SECITEM_AllocItem_stub
#define SECITEM_CompareItem SECITEM_CompareItem_stub
@@ -40,7 +38,6 @@
#define SECITEM_ZfreeItem SECITEM_ZfreeItem_stub
#define SECOID_FindOIDTag SECOID_FindOIDTag_stub
#define NSS_SecureMemcmp NSS_SecureMemcmp_stub
-#define NSS_SecureMemcmpZero NSS_SecureMemcmpZero_stub
#define PR_Assert PR_Assert_stub
#define PR_Access PR_Access_stub
diff --git a/security/nss/lib/freebl/verified/FStar.c b/security/nss/lib/freebl/verified/FStar.c
deleted file mode 100644
index 4e5f6d50dd..0000000000
--- a/security/nss/lib/freebl/verified/FStar.c
+++ /dev/null
@@ -1,255 +0,0 @@
-/* Copyright 2016-2017 INRIA and Microsoft Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* This file was auto-generated by KreMLin! */
-
-#include "FStar.h"
-
-static uint64_t
-FStar_UInt128_constant_time_carry(uint64_t a, uint64_t b)
-{
- return (a ^ ((a ^ b) | ((a - b) ^ b))) >> (uint32_t)63U;
-}
-
-static uint64_t
-FStar_UInt128_carry(uint64_t a, uint64_t b)
-{
- return FStar_UInt128_constant_time_carry(a, b);
-}
-
-FStar_UInt128_uint128
-FStar_UInt128_add(FStar_UInt128_uint128 a, FStar_UInt128_uint128 b)
-{
- return (
- (FStar_UInt128_uint128){
- .low = a.low + b.low,
- .high = a.high + b.high + FStar_UInt128_carry(a.low + b.low, b.low) });
-}
-
-FStar_UInt128_uint128
-FStar_UInt128_add_mod(FStar_UInt128_uint128 a, FStar_UInt128_uint128 b)
-{
- return (
- (FStar_UInt128_uint128){
- .low = a.low + b.low,
- .high = a.high + b.high + FStar_UInt128_carry(a.low + b.low, b.low) });
-}
-
-FStar_UInt128_uint128
-FStar_UInt128_sub(FStar_UInt128_uint128 a, FStar_UInt128_uint128 b)
-{
- return (
- (FStar_UInt128_uint128){
- .low = a.low - b.low,
- .high = a.high - b.high - FStar_UInt128_carry(a.low, a.low - b.low) });
-}
-
-static FStar_UInt128_uint128
-FStar_UInt128_sub_mod_impl(FStar_UInt128_uint128 a, FStar_UInt128_uint128 b)
-{
- return (
- (FStar_UInt128_uint128){
- .low = a.low - b.low,
- .high = a.high - b.high - FStar_UInt128_carry(a.low, a.low - b.low) });
-}
-
-FStar_UInt128_uint128
-FStar_UInt128_sub_mod(FStar_UInt128_uint128 a, FStar_UInt128_uint128 b)
-{
- return FStar_UInt128_sub_mod_impl(a, b);
-}
-
-FStar_UInt128_uint128
-FStar_UInt128_logand(FStar_UInt128_uint128 a, FStar_UInt128_uint128 b)
-{
- return ((FStar_UInt128_uint128){.low = a.low & b.low, .high = a.high & b.high });
-}
-
-FStar_UInt128_uint128
-FStar_UInt128_logxor(FStar_UInt128_uint128 a, FStar_UInt128_uint128 b)
-{
- return ((FStar_UInt128_uint128){.low = a.low ^ b.low, .high = a.high ^ b.high });
-}
-
-FStar_UInt128_uint128
-FStar_UInt128_logor(FStar_UInt128_uint128 a, FStar_UInt128_uint128 b)
-{
- return ((FStar_UInt128_uint128){.low = a.low | b.low, .high = a.high | b.high });
-}
-
-FStar_UInt128_uint128
-FStar_UInt128_lognot(FStar_UInt128_uint128 a)
-{
- return ((FStar_UInt128_uint128){.low = ~a.low, .high = ~a.high });
-}
-
-static uint32_t FStar_UInt128_u32_64 = (uint32_t)64U;
-
-static uint64_t
-FStar_UInt128_add_u64_shift_left(uint64_t hi, uint64_t lo, uint32_t s)
-{
- return (hi << s) + (lo >> (FStar_UInt128_u32_64 - s));
-}
-
-static uint64_t
-FStar_UInt128_add_u64_shift_left_respec(uint64_t hi, uint64_t lo, uint32_t s)
-{
- return FStar_UInt128_add_u64_shift_left(hi, lo, s);
-}
-
-static FStar_UInt128_uint128
-FStar_UInt128_shift_left_small(FStar_UInt128_uint128 a, uint32_t s)
-{
- if (s == (uint32_t)0U)
- return a;
- else
- return (
- (FStar_UInt128_uint128){
- .low = a.low << s,
- .high = FStar_UInt128_add_u64_shift_left_respec(a.high, a.low, s) });
-}
-
-static FStar_UInt128_uint128
-FStar_UInt128_shift_left_large(FStar_UInt128_uint128 a, uint32_t s)
-{
- return ((FStar_UInt128_uint128){.low = (uint64_t)0U, .high = a.low << (s - FStar_UInt128_u32_64) });
-}
-
-FStar_UInt128_uint128
-FStar_UInt128_shift_left(FStar_UInt128_uint128 a, uint32_t s)
-{
- if (s < FStar_UInt128_u32_64)
- return FStar_UInt128_shift_left_small(a, s);
- else
- return FStar_UInt128_shift_left_large(a, s);
-}
-
-static uint64_t
-FStar_UInt128_add_u64_shift_right(uint64_t hi, uint64_t lo, uint32_t s)
-{
- return (lo >> s) + (hi << (FStar_UInt128_u32_64 - s));
-}
-
-static uint64_t
-FStar_UInt128_add_u64_shift_right_respec(uint64_t hi, uint64_t lo, uint32_t s)
-{
- return FStar_UInt128_add_u64_shift_right(hi, lo, s);
-}
-
-static FStar_UInt128_uint128
-FStar_UInt128_shift_right_small(FStar_UInt128_uint128 a, uint32_t s)
-{
- if (s == (uint32_t)0U)
- return a;
- else
- return (
- (FStar_UInt128_uint128){
- .low = FStar_UInt128_add_u64_shift_right_respec(a.high, a.low, s),
- .high = a.high >> s });
-}
-
-static FStar_UInt128_uint128
-FStar_UInt128_shift_right_large(FStar_UInt128_uint128 a, uint32_t s)
-{
- return ((FStar_UInt128_uint128){.low = a.high >> (s - FStar_UInt128_u32_64), .high = (uint64_t)0U });
-}
-
-FStar_UInt128_uint128
-FStar_UInt128_shift_right(FStar_UInt128_uint128 a, uint32_t s)
-{
- if (s < FStar_UInt128_u32_64)
- return FStar_UInt128_shift_right_small(a, s);
- else
- return FStar_UInt128_shift_right_large(a, s);
-}
-
-FStar_UInt128_uint128
-FStar_UInt128_eq_mask(FStar_UInt128_uint128 a, FStar_UInt128_uint128 b)
-{
- return (
- (FStar_UInt128_uint128){
- .low = FStar_UInt64_eq_mask(a.low, b.low) & FStar_UInt64_eq_mask(a.high, b.high),
- .high = FStar_UInt64_eq_mask(a.low, b.low) & FStar_UInt64_eq_mask(a.high, b.high) });
-}
-
-FStar_UInt128_uint128
-FStar_UInt128_gte_mask(FStar_UInt128_uint128 a, FStar_UInt128_uint128 b)
-{
- return (
- (FStar_UInt128_uint128){
- .low = (FStar_UInt64_gte_mask(a.high, b.high) & ~FStar_UInt64_eq_mask(a.high, b.high)) | (FStar_UInt64_eq_mask(a.high, b.high) & FStar_UInt64_gte_mask(a.low, b.low)),
- .high = (FStar_UInt64_gte_mask(a.high, b.high) & ~FStar_UInt64_eq_mask(a.high, b.high)) | (FStar_UInt64_eq_mask(a.high, b.high) & FStar_UInt64_gte_mask(a.low, b.low)) });
-}
-
-FStar_UInt128_uint128
-FStar_UInt128_uint64_to_uint128(uint64_t a)
-{
- return ((FStar_UInt128_uint128){.low = a, .high = (uint64_t)0U });
-}
-
-uint64_t
-FStar_UInt128_uint128_to_uint64(FStar_UInt128_uint128 a)
-{
- return a.low;
-}
-
-static uint64_t FStar_UInt128_u64_l32_mask = (uint64_t)0xffffffffU;
-
-static uint64_t
-FStar_UInt128_u64_mod_32(uint64_t a)
-{
- return a & FStar_UInt128_u64_l32_mask;
-}
-
-static uint32_t FStar_UInt128_u32_32 = (uint32_t)32U;
-
-static K___uint64_t_uint64_t_uint64_t_uint64_t
-FStar_UInt128_mul_wide_impl_t_(uint64_t x, uint64_t y)
-{
- return (
- (K___uint64_t_uint64_t_uint64_t_uint64_t){
- .fst = FStar_UInt128_u64_mod_32(x),
- .snd = FStar_UInt128_u64_mod_32(FStar_UInt128_u64_mod_32(x) * FStar_UInt128_u64_mod_32(y)),
- .thd = x >> FStar_UInt128_u32_32,
- .f3 = (x >> FStar_UInt128_u32_32) * FStar_UInt128_u64_mod_32(y) + (FStar_UInt128_u64_mod_32(x) * FStar_UInt128_u64_mod_32(y) >> FStar_UInt128_u32_32) });
-}
-
-static uint64_t
-FStar_UInt128_u32_combine_(uint64_t hi, uint64_t lo)
-{
- return lo + (hi << FStar_UInt128_u32_32);
-}
-
-static FStar_UInt128_uint128
-FStar_UInt128_mul_wide_impl(uint64_t x, uint64_t y)
-{
- K___uint64_t_uint64_t_uint64_t_uint64_t scrut = FStar_UInt128_mul_wide_impl_t_(x, y);
- uint64_t u1 = scrut.fst;
- uint64_t w3 = scrut.snd;
- uint64_t x_ = scrut.thd;
- uint64_t t_ = scrut.f3;
- return (
- (FStar_UInt128_uint128){
- .low = FStar_UInt128_u32_combine_(u1 * (y >> FStar_UInt128_u32_32) + FStar_UInt128_u64_mod_32(t_),
- w3),
- .high = x_ * (y >> FStar_UInt128_u32_32) + (t_ >> FStar_UInt128_u32_32) +
- ((u1 * (y >> FStar_UInt128_u32_32) + FStar_UInt128_u64_mod_32(t_)) >> FStar_UInt128_u32_32) });
-}
-
-FStar_UInt128_uint128
-FStar_UInt128_mul_wide(uint64_t x, uint64_t y)
-{
- return FStar_UInt128_mul_wide_impl(x, y);
-}
diff --git a/security/nss/lib/freebl/verified/FStar.h b/security/nss/lib/freebl/verified/FStar.h
deleted file mode 100644
index 7b105b8f2b..0000000000
--- a/security/nss/lib/freebl/verified/FStar.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Copyright 2016-2017 INRIA and Microsoft Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/* This file was auto-generated by KreMLin! */
-#ifndef __FStar_H
-#define __FStar_H
-
-#include "kremlib_base.h"
-
-typedef struct
-{
- uint64_t low;
- uint64_t high;
-} FStar_UInt128_uint128;
-
-typedef FStar_UInt128_uint128 FStar_UInt128_t;
-
-extern void FStar_UInt128_constant_time_carry_ok(uint64_t x0, uint64_t x1);
-
-FStar_UInt128_uint128 FStar_UInt128_add(FStar_UInt128_uint128 a, FStar_UInt128_uint128 b);
-
-FStar_UInt128_uint128 FStar_UInt128_add_mod(FStar_UInt128_uint128 a, FStar_UInt128_uint128 b);
-
-FStar_UInt128_uint128 FStar_UInt128_sub(FStar_UInt128_uint128 a, FStar_UInt128_uint128 b);
-
-FStar_UInt128_uint128 FStar_UInt128_sub_mod(FStar_UInt128_uint128 a, FStar_UInt128_uint128 b);
-
-FStar_UInt128_uint128 FStar_UInt128_logand(FStar_UInt128_uint128 a, FStar_UInt128_uint128 b);
-
-FStar_UInt128_uint128 FStar_UInt128_logxor(FStar_UInt128_uint128 a, FStar_UInt128_uint128 b);
-
-FStar_UInt128_uint128 FStar_UInt128_logor(FStar_UInt128_uint128 a, FStar_UInt128_uint128 b);
-
-FStar_UInt128_uint128 FStar_UInt128_lognot(FStar_UInt128_uint128 a);
-
-FStar_UInt128_uint128 FStar_UInt128_shift_left(FStar_UInt128_uint128 a, uint32_t s);
-
-FStar_UInt128_uint128 FStar_UInt128_shift_right(FStar_UInt128_uint128 a, uint32_t s);
-
-FStar_UInt128_uint128 FStar_UInt128_eq_mask(FStar_UInt128_uint128 a, FStar_UInt128_uint128 b);
-
-FStar_UInt128_uint128 FStar_UInt128_gte_mask(FStar_UInt128_uint128 a, FStar_UInt128_uint128 b);
-
-FStar_UInt128_uint128 FStar_UInt128_uint64_to_uint128(uint64_t a);
-
-uint64_t FStar_UInt128_uint128_to_uint64(FStar_UInt128_uint128 a);
-
-typedef struct
-{
- uint64_t fst;
- uint64_t snd;
- uint64_t thd;
- uint64_t f3;
-} K___uint64_t_uint64_t_uint64_t_uint64_t;
-
-FStar_UInt128_uint128 FStar_UInt128_mul_wide(uint64_t x, uint64_t y);
-#endif
diff --git a/security/nss/lib/freebl/verified/Hacl_Chacha20.c b/security/nss/lib/freebl/verified/Hacl_Chacha20.c
deleted file mode 100644
index 45a7430357..0000000000
--- a/security/nss/lib/freebl/verified/Hacl_Chacha20.c
+++ /dev/null
@@ -1,270 +0,0 @@
-/* Copyright 2016-2017 INRIA and Microsoft Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "Hacl_Chacha20.h"
-
-static void
-Hacl_Lib_LoadStore32_uint32s_from_le_bytes(uint32_t *output, uint8_t *input, uint32_t len)
-{
- for (uint32_t i = (uint32_t)0U; i < len; i = i + (uint32_t)1U) {
- uint8_t *x0 = input + (uint32_t)4U * i;
- uint32_t inputi = load32_le(x0);
- output[i] = inputi;
- }
-}
-
-static void
-Hacl_Lib_LoadStore32_uint32s_to_le_bytes(uint8_t *output, uint32_t *input, uint32_t len)
-{
- for (uint32_t i = (uint32_t)0U; i < len; i = i + (uint32_t)1U) {
- uint32_t hd1 = input[i];
- uint8_t *x0 = output + (uint32_t)4U * i;
- store32_le(x0, hd1);
- }
-}
-
-inline static uint32_t
-Hacl_Impl_Chacha20_rotate_left(uint32_t a, uint32_t s)
-{
- return a << s | a >> ((uint32_t)32U - s);
-}
-
-inline static void
-Hacl_Impl_Chacha20_quarter_round(uint32_t *st, uint32_t a, uint32_t b, uint32_t c, uint32_t d)
-{
- uint32_t sa = st[a];
- uint32_t sb0 = st[b];
- st[a] = sa + sb0;
- uint32_t sd = st[d];
- uint32_t sa10 = st[a];
- uint32_t sda = sd ^ sa10;
- st[d] = Hacl_Impl_Chacha20_rotate_left(sda, (uint32_t)16U);
- uint32_t sa0 = st[c];
- uint32_t sb1 = st[d];
- st[c] = sa0 + sb1;
- uint32_t sd0 = st[b];
- uint32_t sa11 = st[c];
- uint32_t sda0 = sd0 ^ sa11;
- st[b] = Hacl_Impl_Chacha20_rotate_left(sda0, (uint32_t)12U);
- uint32_t sa2 = st[a];
- uint32_t sb2 = st[b];
- st[a] = sa2 + sb2;
- uint32_t sd1 = st[d];
- uint32_t sa12 = st[a];
- uint32_t sda1 = sd1 ^ sa12;
- st[d] = Hacl_Impl_Chacha20_rotate_left(sda1, (uint32_t)8U);
- uint32_t sa3 = st[c];
- uint32_t sb = st[d];
- st[c] = sa3 + sb;
- uint32_t sd2 = st[b];
- uint32_t sa1 = st[c];
- uint32_t sda2 = sd2 ^ sa1;
- st[b] = Hacl_Impl_Chacha20_rotate_left(sda2, (uint32_t)7U);
-}
-
-inline static void
-Hacl_Impl_Chacha20_double_round(uint32_t *st)
-{
- Hacl_Impl_Chacha20_quarter_round(st, (uint32_t)0U, (uint32_t)4U, (uint32_t)8U, (uint32_t)12U);
- Hacl_Impl_Chacha20_quarter_round(st, (uint32_t)1U, (uint32_t)5U, (uint32_t)9U, (uint32_t)13U);
- Hacl_Impl_Chacha20_quarter_round(st, (uint32_t)2U, (uint32_t)6U, (uint32_t)10U, (uint32_t)14U);
- Hacl_Impl_Chacha20_quarter_round(st, (uint32_t)3U, (uint32_t)7U, (uint32_t)11U, (uint32_t)15U);
- Hacl_Impl_Chacha20_quarter_round(st, (uint32_t)0U, (uint32_t)5U, (uint32_t)10U, (uint32_t)15U);
- Hacl_Impl_Chacha20_quarter_round(st, (uint32_t)1U, (uint32_t)6U, (uint32_t)11U, (uint32_t)12U);
- Hacl_Impl_Chacha20_quarter_round(st, (uint32_t)2U, (uint32_t)7U, (uint32_t)8U, (uint32_t)13U);
- Hacl_Impl_Chacha20_quarter_round(st, (uint32_t)3U, (uint32_t)4U, (uint32_t)9U, (uint32_t)14U);
-}
-
-inline static void
-Hacl_Impl_Chacha20_rounds(uint32_t *st)
-{
- for (uint32_t i = (uint32_t)0U; i < (uint32_t)10U; i = i + (uint32_t)1U)
- Hacl_Impl_Chacha20_double_round(st);
-}
-
-inline static void
-Hacl_Impl_Chacha20_sum_states(uint32_t *st, uint32_t *st_)
-{
- for (uint32_t i = (uint32_t)0U; i < (uint32_t)16U; i = i + (uint32_t)1U) {
- uint32_t xi = st[i];
- uint32_t yi = st_[i];
- st[i] = xi + yi;
- }
-}
-
-inline static void
-Hacl_Impl_Chacha20_copy_state(uint32_t *st, uint32_t *st_)
-{
- memcpy(st, st_, (uint32_t)16U * sizeof st_[0U]);
-}
-
-inline static void
-Hacl_Impl_Chacha20_chacha20_core(uint32_t *k, uint32_t *st, uint32_t ctr)
-{
- st[12U] = ctr;
- Hacl_Impl_Chacha20_copy_state(k, st);
- Hacl_Impl_Chacha20_rounds(k);
- Hacl_Impl_Chacha20_sum_states(k, st);
-}
-
-inline static void
-Hacl_Impl_Chacha20_chacha20_block(uint8_t *stream_block, uint32_t *st, uint32_t ctr)
-{
- uint32_t st_[16U] = { 0U };
- Hacl_Impl_Chacha20_chacha20_core(st_, st, ctr);
- Hacl_Lib_LoadStore32_uint32s_to_le_bytes(stream_block, st_, (uint32_t)16U);
-}
-
-inline static void
-Hacl_Impl_Chacha20_init(uint32_t *st, uint8_t *k, uint8_t *n1)
-{
- uint32_t *stcst = st;
- uint32_t *stk = st + (uint32_t)4U;
- uint32_t *stc = st + (uint32_t)12U;
- uint32_t *stn = st + (uint32_t)13U;
- stcst[0U] = (uint32_t)0x61707865U;
- stcst[1U] = (uint32_t)0x3320646eU;
- stcst[2U] = (uint32_t)0x79622d32U;
- stcst[3U] = (uint32_t)0x6b206574U;
- Hacl_Lib_LoadStore32_uint32s_from_le_bytes(stk, k, (uint32_t)8U);
- stc[0U] = (uint32_t)0U;
- Hacl_Lib_LoadStore32_uint32s_from_le_bytes(stn, n1, (uint32_t)3U);
-}
-
-static void
-Hacl_Impl_Chacha20_update(uint8_t *output, uint8_t *plain, uint32_t *st, uint32_t ctr)
-{
- uint32_t b[48U] = { 0U };
- uint32_t *k = b;
- uint32_t *ib = b + (uint32_t)16U;
- uint32_t *ob = b + (uint32_t)32U;
- Hacl_Impl_Chacha20_chacha20_core(k, st, ctr);
- Hacl_Lib_LoadStore32_uint32s_from_le_bytes(ib, plain, (uint32_t)16U);
- for (uint32_t i = (uint32_t)0U; i < (uint32_t)16U; i = i + (uint32_t)1U) {
- uint32_t xi = ib[i];
- uint32_t yi = k[i];
- ob[i] = xi ^ yi;
- }
- Hacl_Lib_LoadStore32_uint32s_to_le_bytes(output, ob, (uint32_t)16U);
-}
-
-static void
-Hacl_Impl_Chacha20_update_last(
- uint8_t *output,
- uint8_t *plain,
- uint32_t len,
- uint32_t *st,
- uint32_t ctr)
-{
- uint8_t block[64U] = { 0U };
- Hacl_Impl_Chacha20_chacha20_block(block, st, ctr);
- uint8_t *mask = block;
- for (uint32_t i = (uint32_t)0U; i < len; i = i + (uint32_t)1U) {
- uint8_t xi = plain[i];
- uint8_t yi = mask[i];
- output[i] = xi ^ yi;
- }
-}
-
-static void
-Hacl_Impl_Chacha20_chacha20_counter_mode_blocks(
- uint8_t *output,
- uint8_t *plain,
- uint32_t num_blocks,
- uint32_t *st,
- uint32_t ctr)
-{
- for (uint32_t i = (uint32_t)0U; i < num_blocks; i = i + (uint32_t)1U) {
- uint8_t *b = plain + (uint32_t)64U * i;
- uint8_t *o = output + (uint32_t)64U * i;
- Hacl_Impl_Chacha20_update(o, b, st, ctr + i);
- }
-}
-
-static void
-Hacl_Impl_Chacha20_chacha20_counter_mode(
- uint8_t *output,
- uint8_t *plain,
- uint32_t len,
- uint32_t *st,
- uint32_t ctr)
-{
- uint32_t blocks_len = len >> (uint32_t)6U;
- uint32_t part_len = len & (uint32_t)0x3fU;
- uint8_t *output_ = output;
- uint8_t *plain_ = plain;
- uint8_t *output__ = output + (uint32_t)64U * blocks_len;
- uint8_t *plain__ = plain + (uint32_t)64U * blocks_len;
- Hacl_Impl_Chacha20_chacha20_counter_mode_blocks(output_, plain_, blocks_len, st, ctr);
- if (part_len > (uint32_t)0U)
- Hacl_Impl_Chacha20_update_last(output__, plain__, part_len, st, ctr + blocks_len);
-}
-
-static void
-Hacl_Impl_Chacha20_chacha20(
- uint8_t *output,
- uint8_t *plain,
- uint32_t len,
- uint8_t *k,
- uint8_t *n1,
- uint32_t ctr)
-{
- uint32_t buf[16U] = { 0U };
- uint32_t *st = buf;
- Hacl_Impl_Chacha20_init(st, k, n1);
- Hacl_Impl_Chacha20_chacha20_counter_mode(output, plain, len, st, ctr);
-}
-
-void
-Hacl_Chacha20_chacha20_key_block(uint8_t *block, uint8_t *k, uint8_t *n1, uint32_t ctr)
-{
- uint32_t buf[16U] = { 0U };
- uint32_t *st = buf;
- Hacl_Impl_Chacha20_init(st, k, n1);
- Hacl_Impl_Chacha20_chacha20_block(block, st, ctr);
-}
-
-/*
- This function implements Chacha20
-
- val chacha20 :
- output:uint8_p ->
- plain:uint8_p{ disjoint output plain } ->
- len:uint32_t{ v len = length output /\ v len = length plain } ->
- key:uint8_p{ length key = 32 } ->
- nonce:uint8_p{ length nonce = 12 } ->
- ctr:uint32_t{ v ctr + length plain / 64 < pow2 32 } ->
- Stack unit
- (requires
- fun h -> live h output /\ live h plain /\ live h nonce /\ live h key)
- (ensures
- fun h0 _ h1 ->
- live h1 output /\ live h0 plain /\ modifies_1 output h0 h1 /\
- live h0 nonce /\
- live h0 key /\
- h1.[ output ] ==
- chacha20_encrypt_bytes h0.[ key ] h0.[ nonce ] (v ctr) h0.[ plain ])
-*/
-void
-Hacl_Chacha20_chacha20(
- uint8_t *output,
- uint8_t *plain,
- uint32_t len,
- uint8_t *k,
- uint8_t *n1,
- uint32_t ctr)
-{
- Hacl_Impl_Chacha20_chacha20(output, plain, len, k, n1, ctr);
-}
diff --git a/security/nss/lib/freebl/verified/Hacl_Chacha20.h b/security/nss/lib/freebl/verified/Hacl_Chacha20.h
deleted file mode 100644
index f97e44b744..0000000000
--- a/security/nss/lib/freebl/verified/Hacl_Chacha20.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* Copyright 2016-2017 INRIA and Microsoft Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "kremlib.h"
-#ifndef __Hacl_Chacha20_H
-#define __Hacl_Chacha20_H
-
-typedef uint32_t Hacl_Impl_Xor_Lemmas_u32;
-
-typedef uint8_t Hacl_Impl_Xor_Lemmas_u8;
-
-typedef uint8_t *Hacl_Lib_LoadStore32_uint8_p;
-
-typedef uint32_t Hacl_Impl_Chacha20_u32;
-
-typedef uint32_t Hacl_Impl_Chacha20_h32;
-
-typedef uint8_t *Hacl_Impl_Chacha20_uint8_p;
-
-typedef uint32_t *Hacl_Impl_Chacha20_state;
-
-typedef uint32_t Hacl_Impl_Chacha20_idx;
-
-typedef struct
-{
- void *k;
- void *n;
-} Hacl_Impl_Chacha20_log_t_;
-
-typedef void *Hacl_Impl_Chacha20_log_t;
-
-typedef uint32_t Hacl_Lib_Create_h32;
-
-typedef uint8_t *Hacl_Chacha20_uint8_p;
-
-typedef uint32_t Hacl_Chacha20_uint32_t;
-
-void Hacl_Chacha20_chacha20_key_block(uint8_t *block, uint8_t *k, uint8_t *n1, uint32_t ctr);
-
-/*
- This function implements Chacha20
-
- val chacha20 :
- output:uint8_p ->
- plain:uint8_p{ disjoint output plain } ->
- len:uint32_t{ v len = length output /\ v len = length plain } ->
- key:uint8_p{ length key = 32 } ->
- nonce:uint8_p{ length nonce = 12 } ->
- ctr:uint32_t{ v ctr + length plain / 64 < pow2 32 } ->
- Stack unit
- (requires
- fun h -> live h output /\ live h plain /\ live h nonce /\ live h key)
- (ensures
- fun h0 _ h1 ->
- live h1 output /\ live h0 plain /\ modifies_1 output h0 h1 /\
- live h0 nonce /\
- live h0 key /\
- h1.[ output ] ==
- chacha20_encrypt_bytes h0.[ key ] h0.[ nonce ] (v ctr) h0.[ plain ])
-*/
-void
-Hacl_Chacha20_chacha20(
- uint8_t *output,
- uint8_t *plain,
- uint32_t len,
- uint8_t *k,
- uint8_t *n1,
- uint32_t ctr);
-#endif
diff --git a/security/nss/lib/freebl/verified/Hacl_Curve25519.c b/security/nss/lib/freebl/verified/Hacl_Curve25519.c
deleted file mode 100644
index f2dcddc571..0000000000
--- a/security/nss/lib/freebl/verified/Hacl_Curve25519.c
+++ /dev/null
@@ -1,845 +0,0 @@
-/* Copyright 2016-2017 INRIA and Microsoft Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "Hacl_Curve25519.h"
-
-static void
-Hacl_Bignum_Modulo_carry_top(uint64_t *b)
-{
- uint64_t b4 = b[4U];
- uint64_t b0 = b[0U];
- uint64_t b4_ = b4 & (uint64_t)0x7ffffffffffffU;
- uint64_t b0_ = b0 + (uint64_t)19U * (b4 >> (uint32_t)51U);
- b[4U] = b4_;
- b[0U] = b0_;
-}
-
-inline static void
-Hacl_Bignum_Fproduct_copy_from_wide_(uint64_t *output, FStar_UInt128_t *input)
-{
- {
- FStar_UInt128_t xi = input[0U];
- output[0U] = FStar_UInt128_uint128_to_uint64(xi);
- }
- {
- FStar_UInt128_t xi = input[1U];
- output[1U] = FStar_UInt128_uint128_to_uint64(xi);
- }
- {
- FStar_UInt128_t xi = input[2U];
- output[2U] = FStar_UInt128_uint128_to_uint64(xi);
- }
- {
- FStar_UInt128_t xi = input[3U];
- output[3U] = FStar_UInt128_uint128_to_uint64(xi);
- }
- {
- FStar_UInt128_t xi = input[4U];
- output[4U] = FStar_UInt128_uint128_to_uint64(xi);
- }
-}
-
-inline static void
-Hacl_Bignum_Fproduct_sum_scalar_multiplication_(
- FStar_UInt128_t *output,
- uint64_t *input,
- uint64_t s)
-{
- {
- FStar_UInt128_t xi = output[0U];
- uint64_t yi = input[0U];
- output[0U] = FStar_UInt128_add_mod(xi, FStar_UInt128_mul_wide(yi, s));
- }
- {
- FStar_UInt128_t xi = output[1U];
- uint64_t yi = input[1U];
- output[1U] = FStar_UInt128_add_mod(xi, FStar_UInt128_mul_wide(yi, s));
- }
- {
- FStar_UInt128_t xi = output[2U];
- uint64_t yi = input[2U];
- output[2U] = FStar_UInt128_add_mod(xi, FStar_UInt128_mul_wide(yi, s));
- }
- {
- FStar_UInt128_t xi = output[3U];
- uint64_t yi = input[3U];
- output[3U] = FStar_UInt128_add_mod(xi, FStar_UInt128_mul_wide(yi, s));
- }
- {
- FStar_UInt128_t xi = output[4U];
- uint64_t yi = input[4U];
- output[4U] = FStar_UInt128_add_mod(xi, FStar_UInt128_mul_wide(yi, s));
- }
-}
-
-inline static void
-Hacl_Bignum_Fproduct_carry_wide_(FStar_UInt128_t *tmp)
-{
- {
- uint32_t ctr = (uint32_t)0U;
- FStar_UInt128_t tctr = tmp[ctr];
- FStar_UInt128_t tctrp1 = tmp[ctr + (uint32_t)1U];
- uint64_t r0 = FStar_UInt128_uint128_to_uint64(tctr) & (uint64_t)0x7ffffffffffffU;
- FStar_UInt128_t c = FStar_UInt128_shift_right(tctr, (uint32_t)51U);
- tmp[ctr] = FStar_UInt128_uint64_to_uint128(r0);
- tmp[ctr + (uint32_t)1U] = FStar_UInt128_add(tctrp1, c);
- }
- {
- uint32_t ctr = (uint32_t)1U;
- FStar_UInt128_t tctr = tmp[ctr];
- FStar_UInt128_t tctrp1 = tmp[ctr + (uint32_t)1U];
- uint64_t r0 = FStar_UInt128_uint128_to_uint64(tctr) & (uint64_t)0x7ffffffffffffU;
- FStar_UInt128_t c = FStar_UInt128_shift_right(tctr, (uint32_t)51U);
- tmp[ctr] = FStar_UInt128_uint64_to_uint128(r0);
- tmp[ctr + (uint32_t)1U] = FStar_UInt128_add(tctrp1, c);
- }
- {
- uint32_t ctr = (uint32_t)2U;
- FStar_UInt128_t tctr = tmp[ctr];
- FStar_UInt128_t tctrp1 = tmp[ctr + (uint32_t)1U];
- uint64_t r0 = FStar_UInt128_uint128_to_uint64(tctr) & (uint64_t)0x7ffffffffffffU;
- FStar_UInt128_t c = FStar_UInt128_shift_right(tctr, (uint32_t)51U);
- tmp[ctr] = FStar_UInt128_uint64_to_uint128(r0);
- tmp[ctr + (uint32_t)1U] = FStar_UInt128_add(tctrp1, c);
- }
- {
- uint32_t ctr = (uint32_t)3U;
- FStar_UInt128_t tctr = tmp[ctr];
- FStar_UInt128_t tctrp1 = tmp[ctr + (uint32_t)1U];
- uint64_t r0 = FStar_UInt128_uint128_to_uint64(tctr) & (uint64_t)0x7ffffffffffffU;
- FStar_UInt128_t c = FStar_UInt128_shift_right(tctr, (uint32_t)51U);
- tmp[ctr] = FStar_UInt128_uint64_to_uint128(r0);
- tmp[ctr + (uint32_t)1U] = FStar_UInt128_add(tctrp1, c);
- }
-}
-
-inline static void
-Hacl_Bignum_Fmul_shift_reduce(uint64_t *output)
-{
- uint64_t tmp = output[4U];
- {
- uint32_t ctr = (uint32_t)5U - (uint32_t)0U - (uint32_t)1U;
- uint64_t z = output[ctr - (uint32_t)1U];
- output[ctr] = z;
- }
- {
- uint32_t ctr = (uint32_t)5U - (uint32_t)1U - (uint32_t)1U;
- uint64_t z = output[ctr - (uint32_t)1U];
- output[ctr] = z;
- }
- {
- uint32_t ctr = (uint32_t)5U - (uint32_t)2U - (uint32_t)1U;
- uint64_t z = output[ctr - (uint32_t)1U];
- output[ctr] = z;
- }
- {
- uint32_t ctr = (uint32_t)5U - (uint32_t)3U - (uint32_t)1U;
- uint64_t z = output[ctr - (uint32_t)1U];
- output[ctr] = z;
- }
- output[0U] = tmp;
- uint64_t b0 = output[0U];
- output[0U] = (uint64_t)19U * b0;
-}
-
-static void
-Hacl_Bignum_Fmul_mul_shift_reduce_(FStar_UInt128_t *output, uint64_t *input, uint64_t *input21)
-{
- {
- uint64_t input2i = input21[0U];
- Hacl_Bignum_Fproduct_sum_scalar_multiplication_(output, input, input2i);
- Hacl_Bignum_Fmul_shift_reduce(input);
- }
- {
- uint64_t input2i = input21[1U];
- Hacl_Bignum_Fproduct_sum_scalar_multiplication_(output, input, input2i);
- Hacl_Bignum_Fmul_shift_reduce(input);
- }
- {
- uint64_t input2i = input21[2U];
- Hacl_Bignum_Fproduct_sum_scalar_multiplication_(output, input, input2i);
- Hacl_Bignum_Fmul_shift_reduce(input);
- }
- {
- uint64_t input2i = input21[3U];
- Hacl_Bignum_Fproduct_sum_scalar_multiplication_(output, input, input2i);
- Hacl_Bignum_Fmul_shift_reduce(input);
- }
- uint32_t i = (uint32_t)4U;
- uint64_t input2i = input21[i];
- Hacl_Bignum_Fproduct_sum_scalar_multiplication_(output, input, input2i);
-}
-
-inline static void
-Hacl_Bignum_Fmul_fmul(uint64_t *output, uint64_t *input, uint64_t *input21)
-{
- uint64_t tmp[5U] = { 0U };
- memcpy(tmp, input, (uint32_t)5U * sizeof input[0U]);
- KRML_CHECK_SIZE(FStar_UInt128_uint64_to_uint128((uint64_t)0U), (uint32_t)5U);
- FStar_UInt128_t t[5U];
- for (uint32_t _i = 0U; _i < (uint32_t)5U; ++_i)
- t[_i] = FStar_UInt128_uint64_to_uint128((uint64_t)0U);
- Hacl_Bignum_Fmul_mul_shift_reduce_(t, tmp, input21);
- Hacl_Bignum_Fproduct_carry_wide_(t);
- FStar_UInt128_t b4 = t[4U];
- FStar_UInt128_t b0 = t[0U];
- FStar_UInt128_t
- b4_ = FStar_UInt128_logand(b4, FStar_UInt128_uint64_to_uint128((uint64_t)0x7ffffffffffffU));
- FStar_UInt128_t
- b0_ =
- FStar_UInt128_add(b0,
- FStar_UInt128_mul_wide((uint64_t)19U,
- FStar_UInt128_uint128_to_uint64(FStar_UInt128_shift_right(b4, (uint32_t)51U))));
- t[4U] = b4_;
- t[0U] = b0_;
- Hacl_Bignum_Fproduct_copy_from_wide_(output, t);
- uint64_t i0 = output[0U];
- uint64_t i1 = output[1U];
- uint64_t i0_ = i0 & (uint64_t)0x7ffffffffffffU;
- uint64_t i1_ = i1 + (i0 >> (uint32_t)51U);
- output[0U] = i0_;
- output[1U] = i1_;
-}
-
-inline static void
-Hacl_Bignum_Fsquare_fsquare__(FStar_UInt128_t *tmp, uint64_t *output)
-{
- uint64_t r0 = output[0U];
- uint64_t r1 = output[1U];
- uint64_t r2 = output[2U];
- uint64_t r3 = output[3U];
- uint64_t r4 = output[4U];
- uint64_t d0 = r0 * (uint64_t)2U;
- uint64_t d1 = r1 * (uint64_t)2U;
- uint64_t d2 = r2 * (uint64_t)2U * (uint64_t)19U;
- uint64_t d419 = r4 * (uint64_t)19U;
- uint64_t d4 = d419 * (uint64_t)2U;
- FStar_UInt128_t
- s0 =
- FStar_UInt128_add(FStar_UInt128_add(FStar_UInt128_mul_wide(r0, r0),
- FStar_UInt128_mul_wide(d4, r1)),
- FStar_UInt128_mul_wide(d2, r3));
- FStar_UInt128_t
- s1 =
- FStar_UInt128_add(FStar_UInt128_add(FStar_UInt128_mul_wide(d0, r1),
- FStar_UInt128_mul_wide(d4, r2)),
- FStar_UInt128_mul_wide(r3 * (uint64_t)19U, r3));
- FStar_UInt128_t
- s2 =
- FStar_UInt128_add(FStar_UInt128_add(FStar_UInt128_mul_wide(d0, r2),
- FStar_UInt128_mul_wide(r1, r1)),
- FStar_UInt128_mul_wide(d4, r3));
- FStar_UInt128_t
- s3 =
- FStar_UInt128_add(FStar_UInt128_add(FStar_UInt128_mul_wide(d0, r3),
- FStar_UInt128_mul_wide(d1, r2)),
- FStar_UInt128_mul_wide(r4, d419));
- FStar_UInt128_t
- s4 =
- FStar_UInt128_add(FStar_UInt128_add(FStar_UInt128_mul_wide(d0, r4),
- FStar_UInt128_mul_wide(d1, r3)),
- FStar_UInt128_mul_wide(r2, r2));
- tmp[0U] = s0;
- tmp[1U] = s1;
- tmp[2U] = s2;
- tmp[3U] = s3;
- tmp[4U] = s4;
-}
-
-inline static void
-Hacl_Bignum_Fsquare_fsquare_(FStar_UInt128_t *tmp, uint64_t *output)
-{
- Hacl_Bignum_Fsquare_fsquare__(tmp, output);
- Hacl_Bignum_Fproduct_carry_wide_(tmp);
- FStar_UInt128_t b4 = tmp[4U];
- FStar_UInt128_t b0 = tmp[0U];
- FStar_UInt128_t
- b4_ = FStar_UInt128_logand(b4, FStar_UInt128_uint64_to_uint128((uint64_t)0x7ffffffffffffU));
- FStar_UInt128_t
- b0_ =
- FStar_UInt128_add(b0,
- FStar_UInt128_mul_wide((uint64_t)19U,
- FStar_UInt128_uint128_to_uint64(FStar_UInt128_shift_right(b4, (uint32_t)51U))));
- tmp[4U] = b4_;
- tmp[0U] = b0_;
- Hacl_Bignum_Fproduct_copy_from_wide_(output, tmp);
- uint64_t i0 = output[0U];
- uint64_t i1 = output[1U];
- uint64_t i0_ = i0 & (uint64_t)0x7ffffffffffffU;
- uint64_t i1_ = i1 + (i0 >> (uint32_t)51U);
- output[0U] = i0_;
- output[1U] = i1_;
-}
-
-static void
-Hacl_Bignum_Fsquare_fsquare_times_(uint64_t *input, FStar_UInt128_t *tmp, uint32_t count1)
-{
- Hacl_Bignum_Fsquare_fsquare_(tmp, input);
- for (uint32_t i = (uint32_t)1U; i < count1; i = i + (uint32_t)1U)
- Hacl_Bignum_Fsquare_fsquare_(tmp, input);
-}
-
-inline static void
-Hacl_Bignum_Fsquare_fsquare_times(uint64_t *output, uint64_t *input, uint32_t count1)
-{
- KRML_CHECK_SIZE(FStar_UInt128_uint64_to_uint128((uint64_t)0U), (uint32_t)5U);
- FStar_UInt128_t t[5U];
- for (uint32_t _i = 0U; _i < (uint32_t)5U; ++_i)
- t[_i] = FStar_UInt128_uint64_to_uint128((uint64_t)0U);
- memcpy(output, input, (uint32_t)5U * sizeof input[0U]);
- Hacl_Bignum_Fsquare_fsquare_times_(output, t, count1);
-}
-
-inline static void
-Hacl_Bignum_Fsquare_fsquare_times_inplace(uint64_t *output, uint32_t count1)
-{
- KRML_CHECK_SIZE(FStar_UInt128_uint64_to_uint128((uint64_t)0U), (uint32_t)5U);
- FStar_UInt128_t t[5U];
- for (uint32_t _i = 0U; _i < (uint32_t)5U; ++_i)
- t[_i] = FStar_UInt128_uint64_to_uint128((uint64_t)0U);
- Hacl_Bignum_Fsquare_fsquare_times_(output, t, count1);
-}
-
-inline static void
-Hacl_Bignum_Crecip_crecip(uint64_t *out, uint64_t *z)
-{
- uint64_t buf[20U] = { 0U };
- uint64_t *a = buf;
- uint64_t *t00 = buf + (uint32_t)5U;
- uint64_t *b0 = buf + (uint32_t)10U;
- Hacl_Bignum_Fsquare_fsquare_times(a, z, (uint32_t)1U);
- Hacl_Bignum_Fsquare_fsquare_times(t00, a, (uint32_t)2U);
- Hacl_Bignum_Fmul_fmul(b0, t00, z);
- Hacl_Bignum_Fmul_fmul(a, b0, a);
- Hacl_Bignum_Fsquare_fsquare_times(t00, a, (uint32_t)1U);
- Hacl_Bignum_Fmul_fmul(b0, t00, b0);
- Hacl_Bignum_Fsquare_fsquare_times(t00, b0, (uint32_t)5U);
- uint64_t *t01 = buf + (uint32_t)5U;
- uint64_t *b1 = buf + (uint32_t)10U;
- uint64_t *c0 = buf + (uint32_t)15U;
- Hacl_Bignum_Fmul_fmul(b1, t01, b1);
- Hacl_Bignum_Fsquare_fsquare_times(t01, b1, (uint32_t)10U);
- Hacl_Bignum_Fmul_fmul(c0, t01, b1);
- Hacl_Bignum_Fsquare_fsquare_times(t01, c0, (uint32_t)20U);
- Hacl_Bignum_Fmul_fmul(t01, t01, c0);
- Hacl_Bignum_Fsquare_fsquare_times_inplace(t01, (uint32_t)10U);
- Hacl_Bignum_Fmul_fmul(b1, t01, b1);
- Hacl_Bignum_Fsquare_fsquare_times(t01, b1, (uint32_t)50U);
- uint64_t *a0 = buf;
- uint64_t *t0 = buf + (uint32_t)5U;
- uint64_t *b = buf + (uint32_t)10U;
- uint64_t *c = buf + (uint32_t)15U;
- Hacl_Bignum_Fmul_fmul(c, t0, b);
- Hacl_Bignum_Fsquare_fsquare_times(t0, c, (uint32_t)100U);
- Hacl_Bignum_Fmul_fmul(t0, t0, c);
- Hacl_Bignum_Fsquare_fsquare_times_inplace(t0, (uint32_t)50U);
- Hacl_Bignum_Fmul_fmul(t0, t0, b);
- Hacl_Bignum_Fsquare_fsquare_times_inplace(t0, (uint32_t)5U);
- Hacl_Bignum_Fmul_fmul(out, t0, a0);
-}
-
-inline static void
-Hacl_Bignum_fsum(uint64_t *a, uint64_t *b)
-{
- {
- uint64_t xi = a[0U];
- uint64_t yi = b[0U];
- a[0U] = xi + yi;
- }
- {
- uint64_t xi = a[1U];
- uint64_t yi = b[1U];
- a[1U] = xi + yi;
- }
- {
- uint64_t xi = a[2U];
- uint64_t yi = b[2U];
- a[2U] = xi + yi;
- }
- {
- uint64_t xi = a[3U];
- uint64_t yi = b[3U];
- a[3U] = xi + yi;
- }
- {
- uint64_t xi = a[4U];
- uint64_t yi = b[4U];
- a[4U] = xi + yi;
- }
-}
-
-inline static void
-Hacl_Bignum_fdifference(uint64_t *a, uint64_t *b)
-{
- uint64_t tmp[5U] = { 0U };
- memcpy(tmp, b, (uint32_t)5U * sizeof b[0U]);
- uint64_t b0 = tmp[0U];
- uint64_t b1 = tmp[1U];
- uint64_t b2 = tmp[2U];
- uint64_t b3 = tmp[3U];
- uint64_t b4 = tmp[4U];
- tmp[0U] = b0 + (uint64_t)0x3fffffffffff68U;
- tmp[1U] = b1 + (uint64_t)0x3ffffffffffff8U;
- tmp[2U] = b2 + (uint64_t)0x3ffffffffffff8U;
- tmp[3U] = b3 + (uint64_t)0x3ffffffffffff8U;
- tmp[4U] = b4 + (uint64_t)0x3ffffffffffff8U;
- {
- uint64_t xi = a[0U];
- uint64_t yi = tmp[0U];
- a[0U] = yi - xi;
- }
- {
- uint64_t xi = a[1U];
- uint64_t yi = tmp[1U];
- a[1U] = yi - xi;
- }
- {
- uint64_t xi = a[2U];
- uint64_t yi = tmp[2U];
- a[2U] = yi - xi;
- }
- {
- uint64_t xi = a[3U];
- uint64_t yi = tmp[3U];
- a[3U] = yi - xi;
- }
- {
- uint64_t xi = a[4U];
- uint64_t yi = tmp[4U];
- a[4U] = yi - xi;
- }
-}
-
-inline static void
-Hacl_Bignum_fscalar(uint64_t *output, uint64_t *b, uint64_t s)
-{
- KRML_CHECK_SIZE(FStar_UInt128_uint64_to_uint128((uint64_t)0U), (uint32_t)5U);
- FStar_UInt128_t tmp[5U];
- for (uint32_t _i = 0U; _i < (uint32_t)5U; ++_i)
- tmp[_i] = FStar_UInt128_uint64_to_uint128((uint64_t)0U);
- {
- uint64_t xi = b[0U];
- tmp[0U] = FStar_UInt128_mul_wide(xi, s);
- }
- {
- uint64_t xi = b[1U];
- tmp[1U] = FStar_UInt128_mul_wide(xi, s);
- }
- {
- uint64_t xi = b[2U];
- tmp[2U] = FStar_UInt128_mul_wide(xi, s);
- }
- {
- uint64_t xi = b[3U];
- tmp[3U] = FStar_UInt128_mul_wide(xi, s);
- }
- {
- uint64_t xi = b[4U];
- tmp[4U] = FStar_UInt128_mul_wide(xi, s);
- }
- Hacl_Bignum_Fproduct_carry_wide_(tmp);
- FStar_UInt128_t b4 = tmp[4U];
- FStar_UInt128_t b0 = tmp[0U];
- FStar_UInt128_t
- b4_ = FStar_UInt128_logand(b4, FStar_UInt128_uint64_to_uint128((uint64_t)0x7ffffffffffffU));
- FStar_UInt128_t
- b0_ =
- FStar_UInt128_add(b0,
- FStar_UInt128_mul_wide((uint64_t)19U,
- FStar_UInt128_uint128_to_uint64(FStar_UInt128_shift_right(b4, (uint32_t)51U))));
- tmp[4U] = b4_;
- tmp[0U] = b0_;
- Hacl_Bignum_Fproduct_copy_from_wide_(output, tmp);
-}
-
-inline static void
-Hacl_Bignum_fmul(uint64_t *output, uint64_t *a, uint64_t *b)
-{
- Hacl_Bignum_Fmul_fmul(output, a, b);
-}
-
-inline static void
-Hacl_Bignum_crecip(uint64_t *output, uint64_t *input)
-{
- Hacl_Bignum_Crecip_crecip(output, input);
-}
-
-static void
-Hacl_EC_Point_swap_conditional_step(uint64_t *a, uint64_t *b, uint64_t swap1, uint32_t ctr)
-{
- uint32_t i = ctr - (uint32_t)1U;
- uint64_t ai = a[i];
- uint64_t bi = b[i];
- uint64_t x = swap1 & (ai ^ bi);
- uint64_t ai1 = ai ^ x;
- uint64_t bi1 = bi ^ x;
- a[i] = ai1;
- b[i] = bi1;
-}
-
-static void
-Hacl_EC_Point_swap_conditional_(uint64_t *a, uint64_t *b, uint64_t swap1, uint32_t ctr)
-{
- if (!(ctr == (uint32_t)0U)) {
- Hacl_EC_Point_swap_conditional_step(a, b, swap1, ctr);
- uint32_t i = ctr - (uint32_t)1U;
- Hacl_EC_Point_swap_conditional_(a, b, swap1, i);
- }
-}
-
-static void
-Hacl_EC_Point_swap_conditional(uint64_t *a, uint64_t *b, uint64_t iswap)
-{
- uint64_t swap1 = (uint64_t)0U - iswap;
- Hacl_EC_Point_swap_conditional_(a, b, swap1, (uint32_t)5U);
- Hacl_EC_Point_swap_conditional_(a + (uint32_t)5U, b + (uint32_t)5U, swap1, (uint32_t)5U);
-}
-
-static void
-Hacl_EC_Point_copy(uint64_t *output, uint64_t *input)
-{
- memcpy(output, input, (uint32_t)5U * sizeof input[0U]);
- memcpy(output + (uint32_t)5U,
- input + (uint32_t)5U,
- (uint32_t)5U * sizeof(input + (uint32_t)5U)[0U]);
-}
-
-static void
-Hacl_EC_AddAndDouble_fmonty(
- uint64_t *pp,
- uint64_t *ppq,
- uint64_t *p,
- uint64_t *pq,
- uint64_t *qmqp)
-{
- uint64_t *qx = qmqp;
- uint64_t *x2 = pp;
- uint64_t *z2 = pp + (uint32_t)5U;
- uint64_t *x3 = ppq;
- uint64_t *z3 = ppq + (uint32_t)5U;
- uint64_t *x = p;
- uint64_t *z = p + (uint32_t)5U;
- uint64_t *xprime = pq;
- uint64_t *zprime = pq + (uint32_t)5U;
- uint64_t buf[40U] = { 0U };
- uint64_t *origx = buf;
- uint64_t *origxprime = buf + (uint32_t)5U;
- uint64_t *xxprime0 = buf + (uint32_t)25U;
- uint64_t *zzprime0 = buf + (uint32_t)30U;
- memcpy(origx, x, (uint32_t)5U * sizeof x[0U]);
- Hacl_Bignum_fsum(x, z);
- Hacl_Bignum_fdifference(z, origx);
- memcpy(origxprime, xprime, (uint32_t)5U * sizeof xprime[0U]);
- Hacl_Bignum_fsum(xprime, zprime);
- Hacl_Bignum_fdifference(zprime, origxprime);
- Hacl_Bignum_fmul(xxprime0, xprime, z);
- Hacl_Bignum_fmul(zzprime0, x, zprime);
- uint64_t *origxprime0 = buf + (uint32_t)5U;
- uint64_t *xx0 = buf + (uint32_t)15U;
- uint64_t *zz0 = buf + (uint32_t)20U;
- uint64_t *xxprime = buf + (uint32_t)25U;
- uint64_t *zzprime = buf + (uint32_t)30U;
- uint64_t *zzzprime = buf + (uint32_t)35U;
- memcpy(origxprime0, xxprime, (uint32_t)5U * sizeof xxprime[0U]);
- Hacl_Bignum_fsum(xxprime, zzprime);
- Hacl_Bignum_fdifference(zzprime, origxprime0);
- Hacl_Bignum_Fsquare_fsquare_times(x3, xxprime, (uint32_t)1U);
- Hacl_Bignum_Fsquare_fsquare_times(zzzprime, zzprime, (uint32_t)1U);
- Hacl_Bignum_fmul(z3, zzzprime, qx);
- Hacl_Bignum_Fsquare_fsquare_times(xx0, x, (uint32_t)1U);
- Hacl_Bignum_Fsquare_fsquare_times(zz0, z, (uint32_t)1U);
- uint64_t *zzz = buf + (uint32_t)10U;
- uint64_t *xx = buf + (uint32_t)15U;
- uint64_t *zz = buf + (uint32_t)20U;
- Hacl_Bignum_fmul(x2, xx, zz);
- Hacl_Bignum_fdifference(zz, xx);
- uint64_t scalar = (uint64_t)121665U;
- Hacl_Bignum_fscalar(zzz, zz, scalar);
- Hacl_Bignum_fsum(zzz, xx);
- Hacl_Bignum_fmul(z2, zzz, zz);
-}
-
-static void
-Hacl_EC_Ladder_SmallLoop_cmult_small_loop_step(
- uint64_t *nq,
- uint64_t *nqpq,
- uint64_t *nq2,
- uint64_t *nqpq2,
- uint64_t *q,
- uint8_t byt)
-{
- uint64_t bit = (uint64_t)(byt >> (uint32_t)7U);
- Hacl_EC_Point_swap_conditional(nq, nqpq, bit);
- Hacl_EC_AddAndDouble_fmonty(nq2, nqpq2, nq, nqpq, q);
- uint64_t bit0 = (uint64_t)(byt >> (uint32_t)7U);
- Hacl_EC_Point_swap_conditional(nq2, nqpq2, bit0);
-}
-
-static void
-Hacl_EC_Ladder_SmallLoop_cmult_small_loop_double_step(
- uint64_t *nq,
- uint64_t *nqpq,
- uint64_t *nq2,
- uint64_t *nqpq2,
- uint64_t *q,
- uint8_t byt)
-{
- Hacl_EC_Ladder_SmallLoop_cmult_small_loop_step(nq, nqpq, nq2, nqpq2, q, byt);
- uint8_t byt1 = byt << (uint32_t)1U;
- Hacl_EC_Ladder_SmallLoop_cmult_small_loop_step(nq2, nqpq2, nq, nqpq, q, byt1);
-}
-
-static void
-Hacl_EC_Ladder_SmallLoop_cmult_small_loop(
- uint64_t *nq,
- uint64_t *nqpq,
- uint64_t *nq2,
- uint64_t *nqpq2,
- uint64_t *q,
- uint8_t byt,
- uint32_t i)
-{
- if (!(i == (uint32_t)0U)) {
- uint32_t i_ = i - (uint32_t)1U;
- Hacl_EC_Ladder_SmallLoop_cmult_small_loop_double_step(nq, nqpq, nq2, nqpq2, q, byt);
- uint8_t byt_ = byt << (uint32_t)2U;
- Hacl_EC_Ladder_SmallLoop_cmult_small_loop(nq, nqpq, nq2, nqpq2, q, byt_, i_);
- }
-}
-
-static void
-Hacl_EC_Ladder_BigLoop_cmult_big_loop(
- uint8_t *n1,
- uint64_t *nq,
- uint64_t *nqpq,
- uint64_t *nq2,
- uint64_t *nqpq2,
- uint64_t *q,
- uint32_t i)
-{
- if (!(i == (uint32_t)0U)) {
- uint32_t i1 = i - (uint32_t)1U;
- uint8_t byte = n1[i1];
- Hacl_EC_Ladder_SmallLoop_cmult_small_loop(nq, nqpq, nq2, nqpq2, q, byte, (uint32_t)4U);
- Hacl_EC_Ladder_BigLoop_cmult_big_loop(n1, nq, nqpq, nq2, nqpq2, q, i1);
- }
-}
-
-static void
-Hacl_EC_Ladder_cmult(uint64_t *result, uint8_t *n1, uint64_t *q)
-{
- uint64_t point_buf[40U] = { 0U };
- uint64_t *nq = point_buf;
- uint64_t *nqpq = point_buf + (uint32_t)10U;
- uint64_t *nq2 = point_buf + (uint32_t)20U;
- uint64_t *nqpq2 = point_buf + (uint32_t)30U;
- Hacl_EC_Point_copy(nqpq, q);
- nq[0U] = (uint64_t)1U;
- Hacl_EC_Ladder_BigLoop_cmult_big_loop(n1, nq, nqpq, nq2, nqpq2, q, (uint32_t)32U);
- Hacl_EC_Point_copy(result, nq);
-}
-
-static void
-Hacl_EC_Format_fexpand(uint64_t *output, uint8_t *input)
-{
- uint64_t i0 = load64_le(input);
- uint8_t *x00 = input + (uint32_t)6U;
- uint64_t i1 = load64_le(x00);
- uint8_t *x01 = input + (uint32_t)12U;
- uint64_t i2 = load64_le(x01);
- uint8_t *x02 = input + (uint32_t)19U;
- uint64_t i3 = load64_le(x02);
- uint8_t *x0 = input + (uint32_t)24U;
- uint64_t i4 = load64_le(x0);
- uint64_t output0 = i0 & (uint64_t)0x7ffffffffffffU;
- uint64_t output1 = i1 >> (uint32_t)3U & (uint64_t)0x7ffffffffffffU;
- uint64_t output2 = i2 >> (uint32_t)6U & (uint64_t)0x7ffffffffffffU;
- uint64_t output3 = i3 >> (uint32_t)1U & (uint64_t)0x7ffffffffffffU;
- uint64_t output4 = i4 >> (uint32_t)12U & (uint64_t)0x7ffffffffffffU;
- output[0U] = output0;
- output[1U] = output1;
- output[2U] = output2;
- output[3U] = output3;
- output[4U] = output4;
-}
-
-static void
-Hacl_EC_Format_fcontract_first_carry_pass(uint64_t *input)
-{
- uint64_t t0 = input[0U];
- uint64_t t1 = input[1U];
- uint64_t t2 = input[2U];
- uint64_t t3 = input[3U];
- uint64_t t4 = input[4U];
- uint64_t t1_ = t1 + (t0 >> (uint32_t)51U);
- uint64_t t0_ = t0 & (uint64_t)0x7ffffffffffffU;
- uint64_t t2_ = t2 + (t1_ >> (uint32_t)51U);
- uint64_t t1__ = t1_ & (uint64_t)0x7ffffffffffffU;
- uint64_t t3_ = t3 + (t2_ >> (uint32_t)51U);
- uint64_t t2__ = t2_ & (uint64_t)0x7ffffffffffffU;
- uint64_t t4_ = t4 + (t3_ >> (uint32_t)51U);
- uint64_t t3__ = t3_ & (uint64_t)0x7ffffffffffffU;
- input[0U] = t0_;
- input[1U] = t1__;
- input[2U] = t2__;
- input[3U] = t3__;
- input[4U] = t4_;
-}
-
-static void
-Hacl_EC_Format_fcontract_first_carry_full(uint64_t *input)
-{
- Hacl_EC_Format_fcontract_first_carry_pass(input);
- Hacl_Bignum_Modulo_carry_top(input);
-}
-
-static void
-Hacl_EC_Format_fcontract_second_carry_pass(uint64_t *input)
-{
- uint64_t t0 = input[0U];
- uint64_t t1 = input[1U];
- uint64_t t2 = input[2U];
- uint64_t t3 = input[3U];
- uint64_t t4 = input[4U];
- uint64_t t1_ = t1 + (t0 >> (uint32_t)51U);
- uint64_t t0_ = t0 & (uint64_t)0x7ffffffffffffU;
- uint64_t t2_ = t2 + (t1_ >> (uint32_t)51U);
- uint64_t t1__ = t1_ & (uint64_t)0x7ffffffffffffU;
- uint64_t t3_ = t3 + (t2_ >> (uint32_t)51U);
- uint64_t t2__ = t2_ & (uint64_t)0x7ffffffffffffU;
- uint64_t t4_ = t4 + (t3_ >> (uint32_t)51U);
- uint64_t t3__ = t3_ & (uint64_t)0x7ffffffffffffU;
- input[0U] = t0_;
- input[1U] = t1__;
- input[2U] = t2__;
- input[3U] = t3__;
- input[4U] = t4_;
-}
-
-static void
-Hacl_EC_Format_fcontract_second_carry_full(uint64_t *input)
-{
- Hacl_EC_Format_fcontract_second_carry_pass(input);
- Hacl_Bignum_Modulo_carry_top(input);
- uint64_t i0 = input[0U];
- uint64_t i1 = input[1U];
- uint64_t i0_ = i0 & (uint64_t)0x7ffffffffffffU;
- uint64_t i1_ = i1 + (i0 >> (uint32_t)51U);
- input[0U] = i0_;
- input[1U] = i1_;
-}
-
-static void
-Hacl_EC_Format_fcontract_trim(uint64_t *input)
-{
- uint64_t a0 = input[0U];
- uint64_t a1 = input[1U];
- uint64_t a2 = input[2U];
- uint64_t a3 = input[3U];
- uint64_t a4 = input[4U];
- uint64_t mask0 = FStar_UInt64_gte_mask(a0, (uint64_t)0x7ffffffffffedU);
- uint64_t mask1 = FStar_UInt64_eq_mask(a1, (uint64_t)0x7ffffffffffffU);
- uint64_t mask2 = FStar_UInt64_eq_mask(a2, (uint64_t)0x7ffffffffffffU);
- uint64_t mask3 = FStar_UInt64_eq_mask(a3, (uint64_t)0x7ffffffffffffU);
- uint64_t mask4 = FStar_UInt64_eq_mask(a4, (uint64_t)0x7ffffffffffffU);
- uint64_t mask = (((mask0 & mask1) & mask2) & mask3) & mask4;
- uint64_t a0_ = a0 - ((uint64_t)0x7ffffffffffedU & mask);
- uint64_t a1_ = a1 - ((uint64_t)0x7ffffffffffffU & mask);
- uint64_t a2_ = a2 - ((uint64_t)0x7ffffffffffffU & mask);
- uint64_t a3_ = a3 - ((uint64_t)0x7ffffffffffffU & mask);
- uint64_t a4_ = a4 - ((uint64_t)0x7ffffffffffffU & mask);
- input[0U] = a0_;
- input[1U] = a1_;
- input[2U] = a2_;
- input[3U] = a3_;
- input[4U] = a4_;
-}
-
-static void
-Hacl_EC_Format_fcontract_store(uint8_t *output, uint64_t *input)
-{
- uint64_t t0 = input[0U];
- uint64_t t1 = input[1U];
- uint64_t t2 = input[2U];
- uint64_t t3 = input[3U];
- uint64_t t4 = input[4U];
- uint64_t o0 = t1 << (uint32_t)51U | t0;
- uint64_t o1 = t2 << (uint32_t)38U | t1 >> (uint32_t)13U;
- uint64_t o2 = t3 << (uint32_t)25U | t2 >> (uint32_t)26U;
- uint64_t o3 = t4 << (uint32_t)12U | t3 >> (uint32_t)39U;
- uint8_t *b0 = output;
- uint8_t *b1 = output + (uint32_t)8U;
- uint8_t *b2 = output + (uint32_t)16U;
- uint8_t *b3 = output + (uint32_t)24U;
- store64_le(b0, o0);
- store64_le(b1, o1);
- store64_le(b2, o2);
- store64_le(b3, o3);
-}
-
-static void
-Hacl_EC_Format_fcontract(uint8_t *output, uint64_t *input)
-{
- Hacl_EC_Format_fcontract_first_carry_full(input);
- Hacl_EC_Format_fcontract_second_carry_full(input);
- Hacl_EC_Format_fcontract_trim(input);
- Hacl_EC_Format_fcontract_store(output, input);
-}
-
-static void
-Hacl_EC_Format_scalar_of_point(uint8_t *scalar, uint64_t *point)
-{
- uint64_t *x = point;
- uint64_t *z = point + (uint32_t)5U;
- uint64_t buf[10U] = { 0U };
- uint64_t *zmone = buf;
- uint64_t *sc = buf + (uint32_t)5U;
- Hacl_Bignum_crecip(zmone, z);
- Hacl_Bignum_fmul(sc, x, zmone);
- Hacl_EC_Format_fcontract(scalar, sc);
-}
-
-void
-Hacl_EC_crypto_scalarmult(uint8_t *mypublic, uint8_t *secret, uint8_t *basepoint)
-{
- uint64_t buf0[10U] = { 0U };
- uint64_t *x0 = buf0;
- uint64_t *z = buf0 + (uint32_t)5U;
- Hacl_EC_Format_fexpand(x0, basepoint);
- z[0U] = (uint64_t)1U;
- uint64_t *q = buf0;
- uint8_t e[32U] = { 0U };
- memcpy(e, secret, (uint32_t)32U * sizeof secret[0U]);
- uint8_t e0 = e[0U];
- uint8_t e31 = e[31U];
- uint8_t e01 = e0 & (uint8_t)248U;
- uint8_t e311 = e31 & (uint8_t)127U;
- uint8_t e312 = e311 | (uint8_t)64U;
- e[0U] = e01;
- e[31U] = e312;
- uint8_t *scalar = e;
- uint64_t buf[15U] = { 0U };
- uint64_t *nq = buf;
- uint64_t *x = nq;
- x[0U] = (uint64_t)1U;
- Hacl_EC_Ladder_cmult(nq, scalar, q);
- Hacl_EC_Format_scalar_of_point(mypublic, nq);
-}
-
-void
-Hacl_Curve25519_crypto_scalarmult(uint8_t *mypublic, uint8_t *secret, uint8_t *basepoint)
-{
- Hacl_EC_crypto_scalarmult(mypublic, secret, basepoint);
-}
diff --git a/security/nss/lib/freebl/verified/Hacl_Curve25519.h b/security/nss/lib/freebl/verified/Hacl_Curve25519.h
deleted file mode 100644
index 0e443f1772..0000000000
--- a/security/nss/lib/freebl/verified/Hacl_Curve25519.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Copyright 2016-2017 INRIA and Microsoft Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "kremlib.h"
-#ifndef __Hacl_Curve25519_H
-#define __Hacl_Curve25519_H
-
-typedef uint64_t Hacl_Bignum_Constants_limb;
-
-typedef FStar_UInt128_t Hacl_Bignum_Constants_wide;
-
-typedef uint64_t Hacl_Bignum_Parameters_limb;
-
-typedef FStar_UInt128_t Hacl_Bignum_Parameters_wide;
-
-typedef uint32_t Hacl_Bignum_Parameters_ctr;
-
-typedef uint64_t *Hacl_Bignum_Parameters_felem;
-
-typedef FStar_UInt128_t *Hacl_Bignum_Parameters_felem_wide;
-
-typedef void *Hacl_Bignum_Parameters_seqelem;
-
-typedef void *Hacl_Bignum_Parameters_seqelem_wide;
-
-typedef FStar_UInt128_t Hacl_Bignum_Wide_t;
-
-typedef uint64_t Hacl_Bignum_Limb_t;
-
-extern void Hacl_Bignum_lemma_diff(Prims_int x0, Prims_int x1, Prims_pos x2);
-
-typedef uint64_t *Hacl_EC_Point_point;
-
-typedef uint8_t *Hacl_EC_Ladder_SmallLoop_uint8_p;
-
-typedef uint8_t *Hacl_EC_Ladder_uint8_p;
-
-typedef uint8_t *Hacl_EC_Format_uint8_p;
-
-void Hacl_EC_crypto_scalarmult(uint8_t *mypublic, uint8_t *secret, uint8_t *basepoint);
-
-typedef uint8_t *Hacl_Curve25519_uint8_p;
-
-void Hacl_Curve25519_crypto_scalarmult(uint8_t *mypublic, uint8_t *secret, uint8_t *basepoint);
-#endif
diff --git a/security/nss/lib/freebl/verified/Hacl_Poly1305_64.c b/security/nss/lib/freebl/verified/Hacl_Poly1305_64.c
deleted file mode 100644
index 984031ae21..0000000000
--- a/security/nss/lib/freebl/verified/Hacl_Poly1305_64.c
+++ /dev/null
@@ -1,485 +0,0 @@
-/* Copyright 2016-2017 INRIA and Microsoft Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "Hacl_Poly1305_64.h"
-
-inline static void
-Hacl_Bignum_Modulo_reduce(uint64_t *b)
-{
- uint64_t b0 = b[0U];
- b[0U] = (b0 << (uint32_t)4U) + (b0 << (uint32_t)2U);
-}
-
-inline static void
-Hacl_Bignum_Modulo_carry_top(uint64_t *b)
-{
- uint64_t b2 = b[2U];
- uint64_t b0 = b[0U];
- uint64_t b2_42 = b2 >> (uint32_t)42U;
- b[2U] = b2 & (uint64_t)0x3ffffffffffU;
- b[0U] = (b2_42 << (uint32_t)2U) + b2_42 + b0;
-}
-
-inline static void
-Hacl_Bignum_Modulo_carry_top_wide(FStar_UInt128_t *b)
-{
- FStar_UInt128_t b2 = b[2U];
- FStar_UInt128_t b0 = b[0U];
- FStar_UInt128_t
- b2_ = FStar_UInt128_logand(b2, FStar_UInt128_uint64_to_uint128((uint64_t)0x3ffffffffffU));
- uint64_t b2_42 = FStar_UInt128_uint128_to_uint64(FStar_UInt128_shift_right(b2, (uint32_t)42U));
- FStar_UInt128_t
- b0_ = FStar_UInt128_add(b0, FStar_UInt128_uint64_to_uint128((b2_42 << (uint32_t)2U) + b2_42));
- b[2U] = b2_;
- b[0U] = b0_;
-}
-
-inline static void
-Hacl_Bignum_Fproduct_copy_from_wide_(uint64_t *output, FStar_UInt128_t *input)
-{
- for (uint32_t i = (uint32_t)0U; i < (uint32_t)3U; i = i + (uint32_t)1U) {
- FStar_UInt128_t xi = input[i];
- output[i] = FStar_UInt128_uint128_to_uint64(xi);
- }
-}
-
-inline static void
-Hacl_Bignum_Fproduct_sum_scalar_multiplication_(
- FStar_UInt128_t *output,
- uint64_t *input,
- uint64_t s)
-{
- for (uint32_t i = (uint32_t)0U; i < (uint32_t)3U; i = i + (uint32_t)1U) {
- FStar_UInt128_t xi = output[i];
- uint64_t yi = input[i];
- output[i] = FStar_UInt128_add_mod(xi, FStar_UInt128_mul_wide(yi, s));
- }
-}
-
-inline static void
-Hacl_Bignum_Fproduct_carry_wide_(FStar_UInt128_t *tmp)
-{
- for (uint32_t i = (uint32_t)0U; i < (uint32_t)2U; i = i + (uint32_t)1U) {
- uint32_t ctr = i;
- FStar_UInt128_t tctr = tmp[ctr];
- FStar_UInt128_t tctrp1 = tmp[ctr + (uint32_t)1U];
- uint64_t r0 = FStar_UInt128_uint128_to_uint64(tctr) & (uint64_t)0xfffffffffffU;
- FStar_UInt128_t c = FStar_UInt128_shift_right(tctr, (uint32_t)44U);
- tmp[ctr] = FStar_UInt128_uint64_to_uint128(r0);
- tmp[ctr + (uint32_t)1U] = FStar_UInt128_add(tctrp1, c);
- }
-}
-
-inline static void
-Hacl_Bignum_Fproduct_carry_limb_(uint64_t *tmp)
-{
- for (uint32_t i = (uint32_t)0U; i < (uint32_t)2U; i = i + (uint32_t)1U) {
- uint32_t ctr = i;
- uint64_t tctr = tmp[ctr];
- uint64_t tctrp1 = tmp[ctr + (uint32_t)1U];
- uint64_t r0 = tctr & (uint64_t)0xfffffffffffU;
- uint64_t c = tctr >> (uint32_t)44U;
- tmp[ctr] = r0;
- tmp[ctr + (uint32_t)1U] = tctrp1 + c;
- }
-}
-
-inline static void
-Hacl_Bignum_Fmul_shift_reduce(uint64_t *output)
-{
- uint64_t tmp = output[2U];
- for (uint32_t i = (uint32_t)0U; i < (uint32_t)2U; i = i + (uint32_t)1U) {
- uint32_t ctr = (uint32_t)3U - i - (uint32_t)1U;
- uint64_t z = output[ctr - (uint32_t)1U];
- output[ctr] = z;
- }
- output[0U] = tmp;
- Hacl_Bignum_Modulo_reduce(output);
-}
-
-static void
-Hacl_Bignum_Fmul_mul_shift_reduce_(FStar_UInt128_t *output, uint64_t *input, uint64_t *input2)
-{
- for (uint32_t i = (uint32_t)0U; i < (uint32_t)2U; i = i + (uint32_t)1U) {
- uint64_t input2i = input2[i];
- Hacl_Bignum_Fproduct_sum_scalar_multiplication_(output, input, input2i);
- Hacl_Bignum_Fmul_shift_reduce(input);
- }
- uint32_t i = (uint32_t)2U;
- uint64_t input2i = input2[i];
- Hacl_Bignum_Fproduct_sum_scalar_multiplication_(output, input, input2i);
-}
-
-inline static void
-Hacl_Bignum_Fmul_fmul(uint64_t *output, uint64_t *input, uint64_t *input2)
-{
- uint64_t tmp[3U] = { 0U };
- memcpy(tmp, input, (uint32_t)3U * sizeof input[0U]);
- KRML_CHECK_SIZE(FStar_UInt128_uint64_to_uint128((uint64_t)0U), (uint32_t)3U);
- FStar_UInt128_t t[3U];
- for (uint32_t _i = 0U; _i < (uint32_t)3U; ++_i)
- t[_i] = FStar_UInt128_uint64_to_uint128((uint64_t)0U);
- Hacl_Bignum_Fmul_mul_shift_reduce_(t, tmp, input2);
- Hacl_Bignum_Fproduct_carry_wide_(t);
- Hacl_Bignum_Modulo_carry_top_wide(t);
- Hacl_Bignum_Fproduct_copy_from_wide_(output, t);
- uint64_t i0 = output[0U];
- uint64_t i1 = output[1U];
- uint64_t i0_ = i0 & (uint64_t)0xfffffffffffU;
- uint64_t i1_ = i1 + (i0 >> (uint32_t)44U);
- output[0U] = i0_;
- output[1U] = i1_;
-}
-
-inline static void
-Hacl_Bignum_AddAndMultiply_add_and_multiply(uint64_t *acc, uint64_t *block, uint64_t *r)
-{
- for (uint32_t i = (uint32_t)0U; i < (uint32_t)3U; i = i + (uint32_t)1U) {
- uint64_t xi = acc[i];
- uint64_t yi = block[i];
- acc[i] = xi + yi;
- }
- Hacl_Bignum_Fmul_fmul(acc, acc, r);
-}
-
-inline static void
-Hacl_Impl_Poly1305_64_poly1305_update(
- Hacl_Impl_Poly1305_64_State_poly1305_state st,
- uint8_t *m)
-{
- Hacl_Impl_Poly1305_64_State_poly1305_state scrut0 = st;
- uint64_t *h = scrut0.h;
- uint64_t *acc = h;
- Hacl_Impl_Poly1305_64_State_poly1305_state scrut = st;
- uint64_t *r = scrut.r;
- uint64_t *r3 = r;
- uint64_t tmp[3U] = { 0U };
- FStar_UInt128_t m0 = load128_le(m);
- uint64_t r0 = FStar_UInt128_uint128_to_uint64(m0) & (uint64_t)0xfffffffffffU;
- uint64_t
- r1 =
- FStar_UInt128_uint128_to_uint64(FStar_UInt128_shift_right(m0, (uint32_t)44U)) & (uint64_t)0xfffffffffffU;
- uint64_t r2 = FStar_UInt128_uint128_to_uint64(FStar_UInt128_shift_right(m0, (uint32_t)88U));
- tmp[0U] = r0;
- tmp[1U] = r1;
- tmp[2U] = r2;
- uint64_t b2 = tmp[2U];
- uint64_t b2_ = (uint64_t)0x10000000000U | b2;
- tmp[2U] = b2_;
- Hacl_Bignum_AddAndMultiply_add_and_multiply(acc, tmp, r3);
-}
-
-inline static void
-Hacl_Impl_Poly1305_64_poly1305_process_last_block_(
- uint8_t *block,
- Hacl_Impl_Poly1305_64_State_poly1305_state st,
- uint8_t *m,
- uint64_t rem_)
-{
- uint64_t tmp[3U] = { 0U };
- FStar_UInt128_t m0 = load128_le(block);
- uint64_t r0 = FStar_UInt128_uint128_to_uint64(m0) & (uint64_t)0xfffffffffffU;
- uint64_t
- r1 =
- FStar_UInt128_uint128_to_uint64(FStar_UInt128_shift_right(m0, (uint32_t)44U)) & (uint64_t)0xfffffffffffU;
- uint64_t r2 = FStar_UInt128_uint128_to_uint64(FStar_UInt128_shift_right(m0, (uint32_t)88U));
- tmp[0U] = r0;
- tmp[1U] = r1;
- tmp[2U] = r2;
- Hacl_Impl_Poly1305_64_State_poly1305_state scrut0 = st;
- uint64_t *h = scrut0.h;
- Hacl_Impl_Poly1305_64_State_poly1305_state scrut = st;
- uint64_t *r = scrut.r;
- Hacl_Bignum_AddAndMultiply_add_and_multiply(h, tmp, r);
-}
-
-inline static void
-Hacl_Impl_Poly1305_64_poly1305_process_last_block(
- Hacl_Impl_Poly1305_64_State_poly1305_state st,
- uint8_t *m,
- uint64_t rem_)
-{
- uint8_t zero1 = (uint8_t)0U;
- KRML_CHECK_SIZE(zero1, (uint32_t)16U);
- uint8_t block[16U];
- for (uint32_t _i = 0U; _i < (uint32_t)16U; ++_i)
- block[_i] = zero1;
- uint32_t i0 = (uint32_t)rem_;
- uint32_t i = (uint32_t)rem_;
- memcpy(block, m, i * sizeof m[0U]);
- block[i0] = (uint8_t)1U;
- Hacl_Impl_Poly1305_64_poly1305_process_last_block_(block, st, m, rem_);
-}
-
-static void
-Hacl_Impl_Poly1305_64_poly1305_last_pass(uint64_t *acc)
-{
- Hacl_Bignum_Fproduct_carry_limb_(acc);
- Hacl_Bignum_Modulo_carry_top(acc);
- uint64_t a0 = acc[0U];
- uint64_t a10 = acc[1U];
- uint64_t a20 = acc[2U];
- uint64_t a0_ = a0 & (uint64_t)0xfffffffffffU;
- uint64_t r0 = a0 >> (uint32_t)44U;
- uint64_t a1_ = (a10 + r0) & (uint64_t)0xfffffffffffU;
- uint64_t r1 = (a10 + r0) >> (uint32_t)44U;
- uint64_t a2_ = a20 + r1;
- acc[0U] = a0_;
- acc[1U] = a1_;
- acc[2U] = a2_;
- Hacl_Bignum_Modulo_carry_top(acc);
- uint64_t i0 = acc[0U];
- uint64_t i1 = acc[1U];
- uint64_t i0_ = i0 & (uint64_t)0xfffffffffffU;
- uint64_t i1_ = i1 + (i0 >> (uint32_t)44U);
- acc[0U] = i0_;
- acc[1U] = i1_;
- uint64_t a00 = acc[0U];
- uint64_t a1 = acc[1U];
- uint64_t a2 = acc[2U];
- uint64_t mask0 = FStar_UInt64_gte_mask(a00, (uint64_t)0xffffffffffbU);
- uint64_t mask1 = FStar_UInt64_eq_mask(a1, (uint64_t)0xfffffffffffU);
- uint64_t mask2 = FStar_UInt64_eq_mask(a2, (uint64_t)0x3ffffffffffU);
- uint64_t mask = (mask0 & mask1) & mask2;
- uint64_t a0_0 = a00 - ((uint64_t)0xffffffffffbU & mask);
- uint64_t a1_0 = a1 - ((uint64_t)0xfffffffffffU & mask);
- uint64_t a2_0 = a2 - ((uint64_t)0x3ffffffffffU & mask);
- acc[0U] = a0_0;
- acc[1U] = a1_0;
- acc[2U] = a2_0;
-}
-
-static Hacl_Impl_Poly1305_64_State_poly1305_state
-Hacl_Impl_Poly1305_64_mk_state(uint64_t *r, uint64_t *h)
-{
- return ((Hacl_Impl_Poly1305_64_State_poly1305_state){.r = r, .h = h });
-}
-
-static void
-Hacl_Standalone_Poly1305_64_poly1305_blocks(
- Hacl_Impl_Poly1305_64_State_poly1305_state st,
- uint8_t *m,
- uint64_t len1)
-{
- if (!(len1 == (uint64_t)0U)) {
- uint8_t *block = m;
- uint8_t *tail1 = m + (uint32_t)16U;
- Hacl_Impl_Poly1305_64_poly1305_update(st, block);
- uint64_t len2 = len1 - (uint64_t)1U;
- Hacl_Standalone_Poly1305_64_poly1305_blocks(st, tail1, len2);
- }
-}
-
-static void
-Hacl_Standalone_Poly1305_64_poly1305_partial(
- Hacl_Impl_Poly1305_64_State_poly1305_state st,
- uint8_t *input,
- uint64_t len1,
- uint8_t *kr)
-{
- Hacl_Impl_Poly1305_64_State_poly1305_state scrut = st;
- uint64_t *r = scrut.r;
- uint64_t *x0 = r;
- FStar_UInt128_t k1 = load128_le(kr);
- FStar_UInt128_t
- k_clamped =
- FStar_UInt128_logand(k1,
- FStar_UInt128_logor(FStar_UInt128_shift_left(FStar_UInt128_uint64_to_uint128((uint64_t)0x0ffffffc0ffffffcU),
- (uint32_t)64U),
- FStar_UInt128_uint64_to_uint128((uint64_t)0x0ffffffc0fffffffU)));
- uint64_t r0 = FStar_UInt128_uint128_to_uint64(k_clamped) & (uint64_t)0xfffffffffffU;
- uint64_t
- r1 =
- FStar_UInt128_uint128_to_uint64(FStar_UInt128_shift_right(k_clamped, (uint32_t)44U)) & (uint64_t)0xfffffffffffU;
- uint64_t
- r2 = FStar_UInt128_uint128_to_uint64(FStar_UInt128_shift_right(k_clamped, (uint32_t)88U));
- x0[0U] = r0;
- x0[1U] = r1;
- x0[2U] = r2;
- Hacl_Impl_Poly1305_64_State_poly1305_state scrut0 = st;
- uint64_t *h = scrut0.h;
- uint64_t *x00 = h;
- x00[0U] = (uint64_t)0U;
- x00[1U] = (uint64_t)0U;
- x00[2U] = (uint64_t)0U;
- Hacl_Standalone_Poly1305_64_poly1305_blocks(st, input, len1);
-}
-
-static void
-Hacl_Standalone_Poly1305_64_poly1305_complete(
- Hacl_Impl_Poly1305_64_State_poly1305_state st,
- uint8_t *m,
- uint64_t len1,
- uint8_t *k1)
-{
- uint8_t *kr = k1;
- uint64_t len16 = len1 >> (uint32_t)4U;
- uint64_t rem16 = len1 & (uint64_t)0xfU;
- uint8_t *part_input = m;
- uint8_t *last_block = m + (uint32_t)((uint64_t)16U * len16);
- Hacl_Standalone_Poly1305_64_poly1305_partial(st, part_input, len16, kr);
- if (!(rem16 == (uint64_t)0U))
- Hacl_Impl_Poly1305_64_poly1305_process_last_block(st, last_block, rem16);
- Hacl_Impl_Poly1305_64_State_poly1305_state scrut = st;
- uint64_t *h = scrut.h;
- uint64_t *acc = h;
- Hacl_Impl_Poly1305_64_poly1305_last_pass(acc);
-}
-
-static void
-Hacl_Standalone_Poly1305_64_crypto_onetimeauth_(
- uint8_t *output,
- uint8_t *input,
- uint64_t len1,
- uint8_t *k1)
-{
- uint64_t buf[6U] = { 0U };
- uint64_t *r = buf;
- uint64_t *h = buf + (uint32_t)3U;
- Hacl_Impl_Poly1305_64_State_poly1305_state st = Hacl_Impl_Poly1305_64_mk_state(r, h);
- uint8_t *key_s = k1 + (uint32_t)16U;
- Hacl_Standalone_Poly1305_64_poly1305_complete(st, input, len1, k1);
- Hacl_Impl_Poly1305_64_State_poly1305_state scrut = st;
- uint64_t *h3 = scrut.h;
- uint64_t *acc = h3;
- FStar_UInt128_t k_ = load128_le(key_s);
- uint64_t h0 = acc[0U];
- uint64_t h1 = acc[1U];
- uint64_t h2 = acc[2U];
- FStar_UInt128_t
- acc_ =
- FStar_UInt128_logor(FStar_UInt128_shift_left(FStar_UInt128_uint64_to_uint128(h2
- << (uint32_t)24U |
- h1 >> (uint32_t)20U),
- (uint32_t)64U),
- FStar_UInt128_uint64_to_uint128(h1 << (uint32_t)44U | h0));
- FStar_UInt128_t mac_ = FStar_UInt128_add_mod(acc_, k_);
- store128_le(output, mac_);
-}
-
-static void
-Hacl_Standalone_Poly1305_64_crypto_onetimeauth(
- uint8_t *output,
- uint8_t *input,
- uint64_t len1,
- uint8_t *k1)
-{
- Hacl_Standalone_Poly1305_64_crypto_onetimeauth_(output, input, len1, k1);
-}
-
-Hacl_Impl_Poly1305_64_State_poly1305_state
-Hacl_Poly1305_64_mk_state(uint64_t *r, uint64_t *acc)
-{
- return Hacl_Impl_Poly1305_64_mk_state(r, acc);
-}
-
-void
-Hacl_Poly1305_64_init(Hacl_Impl_Poly1305_64_State_poly1305_state st, uint8_t *k1)
-{
- Hacl_Impl_Poly1305_64_State_poly1305_state scrut = st;
- uint64_t *r = scrut.r;
- uint64_t *x0 = r;
- FStar_UInt128_t k10 = load128_le(k1);
- FStar_UInt128_t
- k_clamped =
- FStar_UInt128_logand(k10,
- FStar_UInt128_logor(FStar_UInt128_shift_left(FStar_UInt128_uint64_to_uint128((uint64_t)0x0ffffffc0ffffffcU),
- (uint32_t)64U),
- FStar_UInt128_uint64_to_uint128((uint64_t)0x0ffffffc0fffffffU)));
- uint64_t r0 = FStar_UInt128_uint128_to_uint64(k_clamped) & (uint64_t)0xfffffffffffU;
- uint64_t
- r1 =
- FStar_UInt128_uint128_to_uint64(FStar_UInt128_shift_right(k_clamped, (uint32_t)44U)) & (uint64_t)0xfffffffffffU;
- uint64_t
- r2 = FStar_UInt128_uint128_to_uint64(FStar_UInt128_shift_right(k_clamped, (uint32_t)88U));
- x0[0U] = r0;
- x0[1U] = r1;
- x0[2U] = r2;
- Hacl_Impl_Poly1305_64_State_poly1305_state scrut0 = st;
- uint64_t *h = scrut0.h;
- uint64_t *x00 = h;
- x00[0U] = (uint64_t)0U;
- x00[1U] = (uint64_t)0U;
- x00[2U] = (uint64_t)0U;
-}
-
-void
-Hacl_Poly1305_64_update_block(Hacl_Impl_Poly1305_64_State_poly1305_state st, uint8_t *m)
-{
- Hacl_Impl_Poly1305_64_poly1305_update(st, m);
-}
-
-void
-Hacl_Poly1305_64_update(
- Hacl_Impl_Poly1305_64_State_poly1305_state st,
- uint8_t *m,
- uint32_t num_blocks)
-{
- if (!(num_blocks == (uint32_t)0U)) {
- uint8_t *block = m;
- uint8_t *m_ = m + (uint32_t)16U;
- uint32_t n1 = num_blocks - (uint32_t)1U;
- Hacl_Poly1305_64_update_block(st, block);
- Hacl_Poly1305_64_update(st, m_, n1);
- }
-}
-
-void
-Hacl_Poly1305_64_update_last(
- Hacl_Impl_Poly1305_64_State_poly1305_state st,
- uint8_t *m,
- uint32_t len1)
-{
- if (!((uint64_t)len1 == (uint64_t)0U))
- Hacl_Impl_Poly1305_64_poly1305_process_last_block(st, m, (uint64_t)len1);
- Hacl_Impl_Poly1305_64_State_poly1305_state scrut = st;
- uint64_t *h = scrut.h;
- uint64_t *acc = h;
- Hacl_Impl_Poly1305_64_poly1305_last_pass(acc);
-}
-
-void
-Hacl_Poly1305_64_finish(
- Hacl_Impl_Poly1305_64_State_poly1305_state st,
- uint8_t *mac,
- uint8_t *k1)
-{
- Hacl_Impl_Poly1305_64_State_poly1305_state scrut = st;
- uint64_t *h = scrut.h;
- uint64_t *acc = h;
- FStar_UInt128_t k_ = load128_le(k1);
- uint64_t h0 = acc[0U];
- uint64_t h1 = acc[1U];
- uint64_t h2 = acc[2U];
- FStar_UInt128_t
- acc_ =
- FStar_UInt128_logor(FStar_UInt128_shift_left(FStar_UInt128_uint64_to_uint128(h2
- << (uint32_t)24U |
- h1 >> (uint32_t)20U),
- (uint32_t)64U),
- FStar_UInt128_uint64_to_uint128(h1 << (uint32_t)44U | h0));
- FStar_UInt128_t mac_ = FStar_UInt128_add_mod(acc_, k_);
- store128_le(mac, mac_);
-}
-
-void
-Hacl_Poly1305_64_crypto_onetimeauth(
- uint8_t *output,
- uint8_t *input,
- uint64_t len1,
- uint8_t *k1)
-{
- Hacl_Standalone_Poly1305_64_crypto_onetimeauth(output, input, len1, k1);
-}
diff --git a/security/nss/lib/freebl/verified/Hacl_Poly1305_64.h b/security/nss/lib/freebl/verified/Hacl_Poly1305_64.h
deleted file mode 100644
index 0aa9a0de38..0000000000
--- a/security/nss/lib/freebl/verified/Hacl_Poly1305_64.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* Copyright 2016-2017 INRIA and Microsoft Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "kremlib.h"
-#ifndef __Hacl_Poly1305_64_H
-#define __Hacl_Poly1305_64_H
-
-typedef uint64_t Hacl_Bignum_Constants_limb;
-
-typedef FStar_UInt128_t Hacl_Bignum_Constants_wide;
-
-typedef FStar_UInt128_t Hacl_Bignum_Wide_t;
-
-typedef uint64_t Hacl_Bignum_Limb_t;
-
-typedef void *Hacl_Impl_Poly1305_64_State_log_t;
-
-typedef uint8_t *Hacl_Impl_Poly1305_64_State_uint8_p;
-
-typedef uint64_t *Hacl_Impl_Poly1305_64_State_bigint;
-
-typedef void *Hacl_Impl_Poly1305_64_State_seqelem;
-
-typedef uint64_t *Hacl_Impl_Poly1305_64_State_elemB;
-
-typedef uint8_t *Hacl_Impl_Poly1305_64_State_wordB;
-
-typedef uint8_t *Hacl_Impl_Poly1305_64_State_wordB_16;
-
-typedef struct
-{
- uint64_t *r;
- uint64_t *h;
-} Hacl_Impl_Poly1305_64_State_poly1305_state;
-
-typedef void *Hacl_Impl_Poly1305_64_log_t;
-
-typedef uint64_t *Hacl_Impl_Poly1305_64_bigint;
-
-typedef uint8_t *Hacl_Impl_Poly1305_64_uint8_p;
-
-typedef uint64_t *Hacl_Impl_Poly1305_64_elemB;
-
-typedef uint8_t *Hacl_Impl_Poly1305_64_wordB;
-
-typedef uint8_t *Hacl_Impl_Poly1305_64_wordB_16;
-
-typedef uint8_t *Hacl_Poly1305_64_uint8_p;
-
-typedef uint64_t Hacl_Poly1305_64_uint64_t;
-
-typedef uint8_t *Hacl_Poly1305_64_key;
-
-typedef Hacl_Impl_Poly1305_64_State_poly1305_state Hacl_Poly1305_64_state;
-
-Hacl_Impl_Poly1305_64_State_poly1305_state
-Hacl_Poly1305_64_mk_state(uint64_t *r, uint64_t *acc);
-
-void Hacl_Poly1305_64_init(Hacl_Impl_Poly1305_64_State_poly1305_state st, uint8_t *k1);
-
-void Hacl_Poly1305_64_update_block(Hacl_Impl_Poly1305_64_State_poly1305_state st, uint8_t *m);
-
-void
-Hacl_Poly1305_64_update(
- Hacl_Impl_Poly1305_64_State_poly1305_state st,
- uint8_t *m,
- uint32_t num_blocks);
-
-void
-Hacl_Poly1305_64_update_last(
- Hacl_Impl_Poly1305_64_State_poly1305_state st,
- uint8_t *m,
- uint32_t len1);
-
-void
-Hacl_Poly1305_64_finish(
- Hacl_Impl_Poly1305_64_State_poly1305_state st,
- uint8_t *mac,
- uint8_t *k1);
-
-void
-Hacl_Poly1305_64_crypto_onetimeauth(
- uint8_t *output,
- uint8_t *input,
- uint64_t len1,
- uint8_t *k1);
-#endif
diff --git a/security/nss/lib/freebl/verified/kremlib.h b/security/nss/lib/freebl/verified/kremlib.h
deleted file mode 100644
index c12164e74c..0000000000
--- a/security/nss/lib/freebl/verified/kremlib.h
+++ /dev/null
@@ -1,672 +0,0 @@
-/* Copyright 2016-2017 INRIA and Microsoft Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __KREMLIB_H
-#define __KREMLIB_H
-
-#include "kremlib_base.h"
-
-/* For tests only: we might need this function to be forward-declared, because
- * the dependency on WasmSupport appears very late, after SimplifyWasm, and
- * sadly, after the topological order has been done. */
-void WasmSupport_check_buffer_size(uint32_t s);
-
-/******************************************************************************/
-/* Stubs to ease compilation of non-Low* code */
-/******************************************************************************/
-
-/* Some types that KreMLin has no special knowledge of; many of them appear in
- * signatures of ghost functions, meaning that it suffices to give them (any)
- * definition. */
-typedef void *FStar_Seq_Base_seq, *Prims_prop, *FStar_HyperStack_mem,
- *FStar_Set_set, *Prims_st_pre_h, *FStar_Heap_heap, *Prims_all_pre_h,
- *FStar_TSet_set, *Prims_list, *FStar_Map_t, *FStar_UInt63_t_,
- *FStar_Int63_t_, *FStar_UInt63_t, *FStar_Int63_t, *FStar_UInt_uint_t,
- *FStar_Int_int_t, *FStar_HyperStack_stackref, *FStar_Bytes_bytes,
- *FStar_HyperHeap_rid, *FStar_Heap_aref, *FStar_Monotonic_Heap_heap,
- *FStar_Monotonic_Heap_aref, *FStar_Monotonic_HyperHeap_rid,
- *FStar_Monotonic_HyperStack_mem, *FStar_Char_char_;
-
-typedef const char *Prims_string;
-
-/* For "bare" targets that do not have a C stdlib, the user might want to use
- * [-add-include '"mydefinitions.h"'] and override these. */
-#ifndef KRML_HOST_PRINTF
-#define KRML_HOST_PRINTF printf
-#endif
-
-#ifndef KRML_HOST_EXIT
-#define KRML_HOST_EXIT exit
-#endif
-
-#ifndef KRML_HOST_MALLOC
-#define KRML_HOST_MALLOC malloc
-#endif
-
-/* In statement position, exiting is easy. */
-#define KRML_EXIT \
- do { \
- KRML_HOST_PRINTF("Unimplemented function at %s:%d\n", __FILE__, __LINE__); \
- KRML_HOST_EXIT(254); \
- } while (0)
-
-/* In expression position, use the comma-operator and a malloc to return an
- * expression of the right size. KreMLin passes t as the parameter to the macro.
- */
-#define KRML_EABORT(t, msg) \
- (KRML_HOST_PRINTF("KreMLin abort at %s:%d\n%s\n", __FILE__, __LINE__, msg), \
- KRML_HOST_EXIT(255), *((t *)KRML_HOST_MALLOC(sizeof(t))))
-
-/* In FStar.Buffer.fst, the size of arrays is uint32_t, but it's a number of
- * *elements*. Do an ugly, run-time check (some of which KreMLin can eliminate).
- */
-#define KRML_CHECK_SIZE(elt, size) \
- if (((size_t)size) > SIZE_MAX / sizeof(elt)) { \
- KRML_HOST_PRINTF( \
- "Maximum allocatable size exceeded, aborting before overflow at " \
- "%s:%d\n", \
- __FILE__, __LINE__); \
- KRML_HOST_EXIT(253); \
- }
-
-/* A series of GCC atrocities to trace function calls (kremlin's [-d c-calls]
- * option). Useful when trying to debug, say, Wasm, to compare traces. */
-/* clang-format off */
-#ifdef __GNUC__
-#define KRML_FORMAT(X) _Generic((X), \
- uint8_t : "0x%08" PRIx8, \
- uint16_t: "0x%08" PRIx16, \
- uint32_t: "0x%08" PRIx32, \
- uint64_t: "0x%08" PRIx64, \
- int8_t : "0x%08" PRIx8, \
- int16_t : "0x%08" PRIx16, \
- int32_t : "0x%08" PRIx32, \
- int64_t : "0x%08" PRIx64, \
- default : "%s")
-
-#define KRML_FORMAT_ARG(X) _Generic((X), \
- uint8_t : X, \
- uint16_t: X, \
- uint32_t: X, \
- uint64_t: X, \
- int8_t : X, \
- int16_t : X, \
- int32_t : X, \
- int64_t : X, \
- default : "unknown")
-/* clang-format on */
-
-#define KRML_DEBUG_RETURN(X) \
- ({ \
- __auto_type _ret = (X); \
- KRML_HOST_PRINTF("returning: "); \
- KRML_HOST_PRINTF(KRML_FORMAT(_ret), KRML_FORMAT_ARG(_ret)); \
- KRML_HOST_PRINTF(" \n"); \
- _ret; \
- })
-#endif
-
-#define FStar_Buffer_eqb(b1, b2, n) \
- (memcmp((b1), (b2), (n) * sizeof((b1)[0])) == 0)
-
-/* Stubs to make ST happy. Important note: you must generate a use of the macro
- * argument, otherwise, you may have FStar_ST_recall(f) as the only use of f;
- * KreMLin will think that this is a valid use, but then the C compiler, after
- * macro expansion, will error out. */
-#define FStar_HyperHeap_root 0
-#define FStar_Pervasives_Native_fst(x) (x).fst
-#define FStar_Pervasives_Native_snd(x) (x).snd
-#define FStar_Seq_Base_createEmpty(x) 0
-#define FStar_Seq_Base_create(len, init) 0
-#define FStar_Seq_Base_upd(s, i, e) 0
-#define FStar_Seq_Base_eq(l1, l2) 0
-#define FStar_Seq_Base_length(l1) 0
-#define FStar_Seq_Base_append(x, y) 0
-#define FStar_Seq_Base_slice(x, y, z) 0
-#define FStar_Seq_Properties_snoc(x, y) 0
-#define FStar_Seq_Properties_cons(x, y) 0
-#define FStar_Seq_Base_index(x, y) 0
-#define FStar_HyperStack_is_eternal_color(x) 0
-#define FStar_Monotonic_HyperHeap_root 0
-#define FStar_Buffer_to_seq_full(x) 0
-#define FStar_Buffer_recall(x)
-#define FStar_HyperStack_ST_op_Colon_Equals(x, v) KRML_EXIT
-#define FStar_HyperStack_ST_op_Bang(x) 0
-#define FStar_HyperStack_ST_salloc(x) 0
-#define FStar_HyperStack_ST_ralloc(x, y) 0
-#define FStar_HyperStack_ST_new_region(x) (0)
-#define FStar_Monotonic_RRef_m_alloc(x) \
- { \
- 0 \
- }
-
-#define FStar_HyperStack_ST_recall(x) \
- do { \
- (void)(x); \
- } while (0)
-
-#define FStar_HyperStack_ST_recall_region(x) \
- do { \
- (void)(x); \
- } while (0)
-
-#define FStar_Monotonic_RRef_m_recall(x1, x2) \
- do { \
- (void)(x1); \
- (void)(x2); \
- } while (0)
-
-#define FStar_Monotonic_RRef_m_write(x1, x2, x3, x4, x5) \
- do { \
- (void)(x1); \
- (void)(x2); \
- (void)(x3); \
- (void)(x4); \
- (void)(x5); \
- } while (0)
-
-/******************************************************************************/
-/* Endian-ness macros that can only be implemented in C */
-/******************************************************************************/
-
-/* ... for Linux */
-#if defined(__linux__) || defined(__CYGWIN__)
-#include <endian.h>
-
-/* ... for OSX */
-#elif defined(__APPLE__)
-#include <libkern/OSByteOrder.h>
-#define htole64(x) OSSwapHostToLittleInt64(x)
-#define le64toh(x) OSSwapLittleToHostInt64(x)
-#define htobe64(x) OSSwapHostToBigInt64(x)
-#define be64toh(x) OSSwapBigToHostInt64(x)
-
-#define htole16(x) OSSwapHostToLittleInt16(x)
-#define le16toh(x) OSSwapLittleToHostInt16(x)
-#define htobe16(x) OSSwapHostToBigInt16(x)
-#define be16toh(x) OSSwapBigToHostInt16(x)
-
-#define htole32(x) OSSwapHostToLittleInt32(x)
-#define le32toh(x) OSSwapLittleToHostInt32(x)
-#define htobe32(x) OSSwapHostToBigInt32(x)
-#define be32toh(x) OSSwapBigToHostInt32(x)
-
-/* ... for Solaris */
-#elif defined(__sun__)
-#include <sys/byteorder.h>
-#define htole64(x) LE_64(x)
-#define le64toh(x) LE_64(x)
-#define htobe64(x) BE_64(x)
-#define be64toh(x) BE_64(x)
-
-#define htole16(x) LE_16(x)
-#define le16toh(x) LE_16(x)
-#define htobe16(x) BE_16(x)
-#define be16toh(x) BE_16(x)
-
-#define htole32(x) LE_32(x)
-#define le32toh(x) LE_32(x)
-#define htobe32(x) BE_32(x)
-#define be32toh(x) BE_32(x)
-
-/* ... for the BSDs */
-#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__DragonFly__)
-#include <sys/endian.h>
-#elif defined(__OpenBSD__)
-#include <endian.h>
-
-/* ... for Windows (MSVC)... not targeting XBOX 360! */
-#elif defined(_MSC_VER)
-
-#include <stdlib.h>
-#define htobe16(x) _byteswap_ushort(x)
-#define htole16(x) (x)
-#define be16toh(x) _byteswap_ushort(x)
-#define le16toh(x) (x)
-
-#define htobe32(x) _byteswap_ulong(x)
-#define htole32(x) (x)
-#define be32toh(x) _byteswap_ulong(x)
-#define le32toh(x) (x)
-
-#define htobe64(x) _byteswap_uint64(x)
-#define htole64(x) (x)
-#define be64toh(x) _byteswap_uint64(x)
-#define le64toh(x) (x)
-
-/* ... for Windows (GCC-like, e.g. mingw or clang) */
-#elif (defined(_WIN32) || defined(_WIN64)) && \
- (defined(__GNUC__) || defined(__clang__))
-
-#define htobe16(x) __builtin_bswap16(x)
-#define htole16(x) (x)
-#define be16toh(x) __builtin_bswap16(x)
-#define le16toh(x) (x)
-
-#define htobe32(x) __builtin_bswap32(x)
-#define htole32(x) (x)
-#define be32toh(x) __builtin_bswap32(x)
-#define le32toh(x) (x)
-
-#define htobe64(x) __builtin_bswap64(x)
-#define htole64(x) (x)
-#define be64toh(x) __builtin_bswap64(x)
-#define le64toh(x) (x)
-
-/* ... generic big-endian fallback code */
-#elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
-
-/* byte swapping code inspired by:
- * https://github.com/rweather/arduinolibs/blob/master/libraries/Crypto/utility/EndianUtil.h
- * */
-
-#define htobe32(x) (x)
-#define be32toh(x) (x)
-#define htole32(x) \
- (__extension__({ \
- uint32_t _temp = (x); \
- ((_temp >> 24) & 0x000000FF) | ((_temp >> 8) & 0x0000FF00) | \
- ((_temp << 8) & 0x00FF0000) | ((_temp << 24) & 0xFF000000); \
- }))
-#define le32toh(x) (htole32((x)))
-
-#define htobe64(x) (x)
-#define be64toh(x) (x)
-#define htole64(x) \
- (__extension__({ \
- uint64_t __temp = (x); \
- uint32_t __low = htobe32((uint32_t)__temp); \
- uint32_t __high = htobe32((uint32_t)(__temp >> 32)); \
- (((uint64_t)__low) << 32) | __high; \
- }))
-#define le64toh(x) (htole64((x)))
-
-/* ... generic little-endian fallback code */
-#elif defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
-
-#define htole32(x) (x)
-#define le32toh(x) (x)
-#define htobe32(x) \
- (__extension__({ \
- uint32_t _temp = (x); \
- ((_temp >> 24) & 0x000000FF) | ((_temp >> 8) & 0x0000FF00) | \
- ((_temp << 8) & 0x00FF0000) | ((_temp << 24) & 0xFF000000); \
- }))
-#define be32toh(x) (htobe32((x)))
-
-#define htole64(x) (x)
-#define le64toh(x) (x)
-#define htobe64(x) \
- (__extension__({ \
- uint64_t __temp = (x); \
- uint32_t __low = htobe32((uint32_t)__temp); \
- uint32_t __high = htobe32((uint32_t)(__temp >> 32)); \
- (((uint64_t)__low) << 32) | __high; \
- }))
-#define be64toh(x) (htobe64((x)))
-
-/* ... couldn't determine endian-ness of the target platform */
-#else
-#error "Please define __BYTE_ORDER__!"
-
-#endif /* defined(__linux__) || ... */
-
-/* Loads and stores. These avoid undefined behavior due to unaligned memory
- * accesses, via memcpy. */
-
-inline static uint16_t
-load16(uint8_t *b)
-{
- uint16_t x;
- memcpy(&x, b, 2);
- return x;
-}
-
-inline static uint32_t
-load32(uint8_t *b)
-{
- uint32_t x;
- memcpy(&x, b, 4);
- return x;
-}
-
-inline static uint64_t
-load64(uint8_t *b)
-{
- uint64_t x;
- memcpy(&x, b, 8);
- return x;
-}
-
-inline static void
-store16(uint8_t *b, uint16_t i)
-{
- memcpy(b, &i, 2);
-}
-
-inline static void
-store32(uint8_t *b, uint32_t i)
-{
- memcpy(b, &i, 4);
-}
-
-inline static void
-store64(uint8_t *b, uint64_t i)
-{
- memcpy(b, &i, 8);
-}
-
-#define load16_le(b) (le16toh(load16(b)))
-#define store16_le(b, i) (store16(b, htole16(i)))
-#define load16_be(b) (be16toh(load16(b)))
-#define store16_be(b, i) (store16(b, htobe16(i)))
-
-#define load32_le(b) (le32toh(load32(b)))
-#define store32_le(b, i) (store32(b, htole32(i)))
-#define load32_be(b) (be32toh(load32(b)))
-#define store32_be(b, i) (store32(b, htobe32(i)))
-
-#define load64_le(b) (le64toh(load64(b)))
-#define store64_le(b, i) (store64(b, htole64(i)))
-#define load64_be(b) (be64toh(load64(b)))
-#define store64_be(b, i) (store64(b, htobe64(i)))
-
-/******************************************************************************/
-/* Checked integers to ease the compilation of non-Low* code */
-/******************************************************************************/
-
-typedef int32_t Prims_pos, Prims_nat, Prims_nonzero, Prims_int,
- krml_checked_int_t;
-
-inline static bool
-Prims_op_GreaterThanOrEqual(int32_t x, int32_t y)
-{
- return x >= y;
-}
-
-inline static bool
-Prims_op_LessThanOrEqual(int32_t x, int32_t y)
-{
- return x <= y;
-}
-
-inline static bool
-Prims_op_GreaterThan(int32_t x, int32_t y)
-{
- return x > y;
-}
-
-inline static bool
-Prims_op_LessThan(int32_t x, int32_t y)
-{
- return x < y;
-}
-
-#define RETURN_OR(x) \
- do { \
- int64_t __ret = x; \
- if (__ret < INT32_MIN || INT32_MAX < __ret) { \
- KRML_HOST_PRINTF("Prims.{int,nat,pos} integer overflow at %s:%d\n", \
- __FILE__, __LINE__); \
- KRML_HOST_EXIT(252); \
- } \
- return (int32_t)__ret; \
- } while (0)
-
-inline static int32_t
-Prims_pow2(int32_t x)
-{
- RETURN_OR((int64_t)1 << (int64_t)x);
-}
-
-inline static int32_t
-Prims_op_Multiply(int32_t x, int32_t y)
-{
- RETURN_OR((int64_t)x * (int64_t)y);
-}
-
-inline static int32_t
-Prims_op_Addition(int32_t x, int32_t y)
-{
- RETURN_OR((int64_t)x + (int64_t)y);
-}
-
-inline static int32_t
-Prims_op_Subtraction(int32_t x, int32_t y)
-{
- RETURN_OR((int64_t)x - (int64_t)y);
-}
-
-inline static int32_t
-Prims_op_Division(int32_t x, int32_t y)
-{
- RETURN_OR((int64_t)x / (int64_t)y);
-}
-
-inline static int32_t
-Prims_op_Modulus(int32_t x, int32_t y)
-{
- RETURN_OR((int64_t)x % (int64_t)y);
-}
-
-inline static int8_t
-FStar_UInt8_uint_to_t(int8_t x)
-{
- return x;
-}
-inline static int16_t
-FStar_UInt16_uint_to_t(int16_t x)
-{
- return x;
-}
-inline static int32_t
-FStar_UInt32_uint_to_t(int32_t x)
-{
- return x;
-}
-inline static int64_t
-FStar_UInt64_uint_to_t(int64_t x)
-{
- return x;
-}
-
-inline static int8_t
-FStar_UInt8_v(int8_t x)
-{
- return x;
-}
-inline static int16_t
-FStar_UInt16_v(int16_t x)
-{
- return x;
-}
-inline static int32_t
-FStar_UInt32_v(int32_t x)
-{
- return x;
-}
-inline static int64_t
-FStar_UInt64_v(int64_t x)
-{
- return x;
-}
-
-/* Platform-specific 128-bit arithmetic. These are static functions in a header,
- * so that each translation unit gets its own copy and the C compiler can
- * optimize. */
-#ifndef KRML_NOUINT128
-typedef unsigned __int128 FStar_UInt128_t, FStar_UInt128_t_, uint128_t;
-
-static inline void
-print128(const char *where, uint128_t n)
-{
- KRML_HOST_PRINTF("%s: [%" PRIu64 ",%" PRIu64 "]\n", where,
- (uint64_t)(n >> 64), (uint64_t)n);
-}
-
-static inline uint128_t
-load128_le(uint8_t *b)
-{
- uint128_t l = (uint128_t)load64_le(b);
- uint128_t h = (uint128_t)load64_le(b + 8);
- return (h << 64 | l);
-}
-
-static inline void
-store128_le(uint8_t *b, uint128_t n)
-{
- store64_le(b, (uint64_t)n);
- store64_le(b + 8, (uint64_t)(n >> 64));
-}
-
-static inline uint128_t
-load128_be(uint8_t *b)
-{
- uint128_t h = (uint128_t)load64_be(b);
- uint128_t l = (uint128_t)load64_be(b + 8);
- return (h << 64 | l);
-}
-
-static inline void
-store128_be(uint8_t *b, uint128_t n)
-{
- store64_be(b, (uint64_t)(n >> 64));
- store64_be(b + 8, (uint64_t)n);
-}
-
-#define FStar_UInt128_add(x, y) ((x) + (y))
-#define FStar_UInt128_mul(x, y) ((x) * (y))
-#define FStar_UInt128_add_mod(x, y) ((x) + (y))
-#define FStar_UInt128_sub(x, y) ((x) - (y))
-#define FStar_UInt128_sub_mod(x, y) ((x) - (y))
-#define FStar_UInt128_logand(x, y) ((x) & (y))
-#define FStar_UInt128_logor(x, y) ((x) | (y))
-#define FStar_UInt128_logxor(x, y) ((x) ^ (y))
-#define FStar_UInt128_lognot(x) (~(x))
-#define FStar_UInt128_shift_left(x, y) ((x) << (y))
-#define FStar_UInt128_shift_right(x, y) ((x) >> (y))
-#define FStar_UInt128_uint64_to_uint128(x) ((uint128_t)(x))
-#define FStar_UInt128_uint128_to_uint64(x) ((uint64_t)(x))
-#define FStar_UInt128_mul_wide(x, y) ((uint128_t)(x) * (y))
-#define FStar_UInt128_op_Hat_Hat(x, y) ((x) ^ (y))
-
-static inline uint128_t
-FStar_UInt128_eq_mask(uint128_t x, uint128_t y)
-{
- uint64_t mask =
- FStar_UInt64_eq_mask((uint64_t)(x >> 64), (uint64_t)(y >> 64)) &
- FStar_UInt64_eq_mask(x, y);
- return ((uint128_t)mask) << 64 | mask;
-}
-
-static inline uint128_t
-FStar_UInt128_gte_mask(uint128_t x, uint128_t y)
-{
- uint64_t mask =
- (FStar_UInt64_gte_mask(x >> 64, y >> 64) &
- ~(FStar_UInt64_eq_mask(x >> 64, y >> 64))) |
- (FStar_UInt64_eq_mask(x >> 64, y >> 64) & FStar_UInt64_gte_mask(x, y));
- return ((uint128_t)mask) << 64 | mask;
-}
-
-#else /* !defined(KRML_NOUINT128) */
-
-/* This is a bad circular dependency... should fix it properly. */
-#include "FStar.h"
-
-typedef FStar_UInt128_uint128 FStar_UInt128_t_, uint128_t;
-
-/* A series of definitions written using pointers. */
-static inline void
-print128_(const char *where, uint128_t *n)
-{
- KRML_HOST_PRINTF("%s: [0x%08" PRIx64 ",0x%08" PRIx64 "]\n", where, n->high, n->low);
-}
-
-static inline void
-load128_le_(uint8_t *b, uint128_t *r)
-{
- r->low = load64_le(b);
- r->high = load64_le(b + 8);
-}
-
-static inline void
-store128_le_(uint8_t *b, uint128_t *n)
-{
- store64_le(b, n->low);
- store64_le(b + 8, n->high);
-}
-
-static inline void
-load128_be_(uint8_t *b, uint128_t *r)
-{
- r->high = load64_be(b);
- r->low = load64_be(b + 8);
-}
-
-static inline void
-store128_be_(uint8_t *b, uint128_t *n)
-{
- store64_be(b, n->high);
- store64_be(b + 8, n->low);
-}
-
-#ifndef KRML_NOSTRUCT_PASSING
-
-static inline void
-print128(const char *where, uint128_t n)
-{
- print128_(where, &n);
-}
-
-static inline uint128_t
-load128_le(uint8_t *b)
-{
- uint128_t r;
- load128_le_(b, &r);
- return r;
-}
-
-static inline void
-store128_le(uint8_t *b, uint128_t n)
-{
- store128_le_(b, &n);
-}
-
-static inline uint128_t
-load128_be(uint8_t *b)
-{
- uint128_t r;
- load128_be_(b, &r);
- return r;
-}
-
-static inline void
-store128_be(uint8_t *b, uint128_t n)
-{
- store128_be_(b, &n);
-}
-
-#else /* !defined(KRML_STRUCT_PASSING) */
-
-#define print128 print128_
-#define load128_le load128_le_
-#define store128_le store128_le_
-#define load128_be load128_be_
-#define store128_be store128_be_
-
-#endif /* KRML_STRUCT_PASSING */
-#endif /* KRML_UINT128 */
-#endif /* __KREMLIB_H */
diff --git a/security/nss/lib/freebl/verified/kremlib_base.h b/security/nss/lib/freebl/verified/kremlib_base.h
deleted file mode 100644
index 61bac11d41..0000000000
--- a/security/nss/lib/freebl/verified/kremlib_base.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/* Copyright 2016-2017 INRIA and Microsoft Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __KREMLIB_BASE_H
-#define __KREMLIB_BASE_H
-
-#include <inttypes.h>
-#include <stdbool.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-/******************************************************************************/
-/* Some macros to ease compatibility */
-/******************************************************************************/
-
-/* Define __cdecl and friends when using GCC, so that we can safely compile code
- * that contains __cdecl on all platforms. Note that this is in a separate
- * header so that Dafny-generated code can include just this file. */
-#ifndef _MSC_VER
-/* Use the gcc predefined macros if on a platform/architectures that set them.
- * Otherwise define them to be empty. */
-#ifndef __cdecl
-#define __cdecl
-#endif
-#ifndef __stdcall
-#define __stdcall
-#endif
-#ifndef __fastcall
-#define __fastcall
-#endif
-#endif
-
-#ifdef __GNUC__
-#define inline __inline__
-#endif
-
-/* GCC-specific attribute syntax; everyone else gets the standard C inline
- * attribute. */
-#ifdef __GNU_C__
-#ifndef __clang__
-#define force_inline inline __attribute__((always_inline))
-#else
-#define force_inline inline
-#endif
-#else
-#define force_inline inline
-#endif
-
-/******************************************************************************/
-/* Implementing C.fst */
-/******************************************************************************/
-
-/* Uppercase issue; we have to define lowercase versions of the C macros (as we
- * have no way to refer to an uppercase *variable* in F*). */
-extern int exit_success;
-extern int exit_failure;
-
-/* This one allows the user to write C.EXIT_SUCCESS. */
-typedef int exit_code;
-
-void print_string(const char *s);
-void print_bytes(uint8_t *b, uint32_t len);
-
-/* The universal null pointer defined in C.Nullity.fst */
-#define C_Nullity_null(X) 0
-
-/* If some globals need to be initialized before the main, then kremlin will
- * generate and try to link last a function with this type: */
-void kremlinit_globals(void);
-
-/******************************************************************************/
-/* Implementation of machine integers (possibly of 128-bit integers) */
-/******************************************************************************/
-
-/* Integer types */
-typedef uint64_t FStar_UInt64_t, FStar_UInt64_t_;
-typedef int64_t FStar_Int64_t, FStar_Int64_t_;
-typedef uint32_t FStar_UInt32_t, FStar_UInt32_t_;
-typedef int32_t FStar_Int32_t, FStar_Int32_t_;
-typedef uint16_t FStar_UInt16_t, FStar_UInt16_t_;
-typedef int16_t FStar_Int16_t, FStar_Int16_t_;
-typedef uint8_t FStar_UInt8_t, FStar_UInt8_t_;
-typedef int8_t FStar_Int8_t, FStar_Int8_t_;
-
-static inline uint32_t
-rotate32_left(uint32_t x, uint32_t n)
-{
- /* assert (n<32); */
- return (x << n) | (x >> (32 - n));
-}
-static inline uint32_t
-rotate32_right(uint32_t x, uint32_t n)
-{
- /* assert (n<32); */
- return (x >> n) | (x << (32 - n));
-}
-
-/* Constant time comparisons */
-static inline uint8_t
-FStar_UInt8_eq_mask(uint8_t x, uint8_t y)
-{
- x = ~(x ^ y);
- x &= x << 4;
- x &= x << 2;
- x &= x << 1;
- return (int8_t)x >> 7;
-}
-
-static inline uint8_t
-FStar_UInt8_gte_mask(uint8_t x, uint8_t y)
-{
- return ~(uint8_t)(((int32_t)x - y) >> 31);
-}
-
-static inline uint16_t
-FStar_UInt16_eq_mask(uint16_t x, uint16_t y)
-{
- x = ~(x ^ y);
- x &= x << 8;
- x &= x << 4;
- x &= x << 2;
- x &= x << 1;
- return (int16_t)x >> 15;
-}
-
-static inline uint16_t
-FStar_UInt16_gte_mask(uint16_t x, uint16_t y)
-{
- return ~(uint16_t)(((int32_t)x - y) >> 31);
-}
-
-static inline uint32_t
-FStar_UInt32_eq_mask(uint32_t x, uint32_t y)
-{
- x = ~(x ^ y);
- x &= x << 16;
- x &= x << 8;
- x &= x << 4;
- x &= x << 2;
- x &= x << 1;
- return ((int32_t)x) >> 31;
-}
-
-static inline uint32_t
-FStar_UInt32_gte_mask(uint32_t x, uint32_t y)
-{
- return ~((uint32_t)(((int64_t)x - y) >> 63));
-}
-
-static inline uint64_t
-FStar_UInt64_eq_mask(uint64_t x, uint64_t y)
-{
- x = ~(x ^ y);
- x &= x << 32;
- x &= x << 16;
- x &= x << 8;
- x &= x << 4;
- x &= x << 2;
- x &= x << 1;
- return ((int64_t)x) >> 63;
-}
-
-static inline uint64_t
-FStar_UInt64_gte_mask(uint64_t x, uint64_t y)
-{
- uint64_t low63 =
- ~((uint64_t)((int64_t)((int64_t)(x & UINT64_C(0x7fffffffffffffff)) -
- (int64_t)(y & UINT64_C(0x7fffffffffffffff))) >>
- 63));
- uint64_t high_bit =
- ~((uint64_t)((int64_t)((int64_t)(x & UINT64_C(0x8000000000000000)) -
- (int64_t)(y & UINT64_C(0x8000000000000000))) >>
- 63));
- return low63 & high_bit;
-}
-
-#endif
diff --git a/security/nss/lib/freebl/verified/specs/Spec.CTR.fst b/security/nss/lib/freebl/verified/specs/Spec.CTR.fst
deleted file mode 100644
index e411cd3535..0000000000
--- a/security/nss/lib/freebl/verified/specs/Spec.CTR.fst
+++ /dev/null
@@ -1,98 +0,0 @@
-/* Copyright 2016-2017 INRIA and Microsoft Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-module Spec.CTR
-
-module ST = FStar.HyperStack.ST
-
-open FStar.Mul
-open FStar.Seq
-open Spec.Lib
-
-#reset-options "--initial_fuel 0 --max_fuel 0 --initial_ifuel 0 --max_ifuel 0"
-
-type block_cipher_ctx = {
- keylen: nat ;
- blocklen: (x:nat{x>0});
- noncelen: nat;
- counterbits: nat;
- incr: pos}
-
-type key (c:block_cipher_ctx) = lbytes c.keylen
-type nonce (c:block_cipher_ctx) = lbytes c.noncelen
-type block (c:block_cipher_ctx) = lbytes (c.blocklen*c.incr)
-type counter (c:block_cipher_ctx) = UInt.uint_t c.counterbits
-type block_cipher (c:block_cipher_ctx) = key c -> nonce c -> counter c -> block c
-
-val xor: #len:nat -> x:lbytes len -> y:lbytes len -> Tot (lbytes len)
-let xor #len x y = map2 FStar.UInt8.(fun x y -> x ^^ y) x y
-
-
-val counter_mode_blocks:
- ctx: block_cipher_ctx ->
- bc: block_cipher ctx ->
- k:key ctx -> n:nonce ctx -> c:counter ctx ->
- plain:seq UInt8.t{c + ctx.incr * (length plain / ctx.blocklen) < pow2 ctx.counterbits /\
- length plain % (ctx.blocklen * ctx.incr) = 0} ->
- Tot (lbytes (length plain))
- (decreases (length plain))
-#reset-options "--z3rlimit 200 --max_fuel 0"
-let rec counter_mode_blocks ctx block_enc key nonce counter plain =
- let len = length plain in
- let len' = len / (ctx.blocklen * ctx.incr) in
- Math.Lemmas.lemma_div_mod len (ctx.blocklen * ctx.incr) ;
- if len = 0 then Seq.createEmpty #UInt8.t
- else (
- let prefix, block = split plain (len - ctx.blocklen * ctx.incr) in
- (* TODO: move to a single lemma for clarify *)
- Math.Lemmas.lemma_mod_plus (length prefix) 1 (ctx.blocklen * ctx.incr);
- Math.Lemmas.lemma_div_le (length prefix) len ctx.blocklen;
- Spec.CTR.Lemmas.lemma_div len (ctx.blocklen * ctx.incr);
- (* End TODO *)
- let cipher = counter_mode_blocks ctx block_enc key nonce counter prefix in
- let mask = block_enc key nonce (counter + (len / ctx.blocklen - 1) * ctx.incr) in
- let eb = xor block mask in
- cipher @| eb
- )
-
-
-val counter_mode:
- ctx: block_cipher_ctx ->
- bc: block_cipher ctx ->
- k:key ctx -> n:nonce ctx -> c:counter ctx ->
- plain:seq UInt8.t{c + ctx.incr * (length plain / ctx.blocklen) < pow2 ctx.counterbits} ->
- Tot (lbytes (length plain))
- (decreases (length plain))
-#reset-options "--z3rlimit 200 --max_fuel 0"
-let counter_mode ctx block_enc key nonce counter plain =
- let len = length plain in
- let blocks_len = (ctx.incr * ctx.blocklen) * (len / (ctx.blocklen * ctx.incr)) in
- let part_len = len % (ctx.blocklen * ctx.incr) in
- (* TODO: move to a single lemma for clarify *)
- Math.Lemmas.lemma_div_mod len (ctx.blocklen * ctx.incr);
- Math.Lemmas.multiple_modulo_lemma (len / (ctx.blocklen * ctx.incr)) (ctx.blocklen * ctx.incr);
- Math.Lemmas.lemma_div_le (blocks_len) len ctx.blocklen;
- (* End TODO *)
- let blocks, last_block = split plain blocks_len in
- let cipher_blocks = counter_mode_blocks ctx block_enc key nonce counter blocks in
- let cipher_last_block =
- if part_len > 0
- then (* encrypt final partial block(s) *)
- let mask = block_enc key nonce (counter+ctx.incr*(length plain / ctx.blocklen)) in
- let mask = slice mask 0 part_len in
- assert(length last_block = part_len);
- xor #part_len last_block mask
- else createEmpty in
- cipher_blocks @| cipher_last_block
diff --git a/security/nss/lib/freebl/verified/specs/Spec.Chacha20.fst b/security/nss/lib/freebl/verified/specs/Spec.Chacha20.fst
deleted file mode 100644
index 0bdc697254..0000000000
--- a/security/nss/lib/freebl/verified/specs/Spec.Chacha20.fst
+++ /dev/null
@@ -1,169 +0,0 @@
-/* Copyright 2016-2017 INRIA and Microsoft Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-module Spec.Chacha20
-
-module ST = FStar.HyperStack.ST
-
-open FStar.Mul
-open FStar.Seq
-open FStar.UInt32
-open FStar.Endianness
-open Spec.Lib
-open Spec.Chacha20.Lemmas
-open Seq.Create
-
-#set-options "--max_fuel 0 --z3rlimit 100"
-
-(* Constants *)
-let keylen = 32 (* in bytes *)
-let blocklen = 64 (* in bytes *)
-let noncelen = 12 (* in bytes *)
-
-type key = lbytes keylen
-type block = lbytes blocklen
-type nonce = lbytes noncelen
-type counter = UInt.uint_t 32
-
-// using @ as a functional substitute for ;
-// internally, blocks are represented as 16 x 4-byte integers
-type state = m:seq UInt32.t {length m = 16}
-type idx = n:nat{n < 16}
-type shuffle = state -> Tot state
-
-let line (a:idx) (b:idx) (d:idx) (s:t{0 < v s /\ v s < 32}) (m:state) : Tot state =
- let m = m.[a] <- (m.[a] +%^ m.[b]) in
- let m = m.[d] <- ((m.[d] ^^ m.[a]) <<< s) in m
-
-let quarter_round a b c d : shuffle =
- line a b d 16ul @
- line c d b 12ul @
- line a b d 8ul @
- line c d b 7ul
-
-let column_round : shuffle =
- quarter_round 0 4 8 12 @
- quarter_round 1 5 9 13 @
- quarter_round 2 6 10 14 @
- quarter_round 3 7 11 15
-
-let diagonal_round : shuffle =
- quarter_round 0 5 10 15 @
- quarter_round 1 6 11 12 @
- quarter_round 2 7 8 13 @
- quarter_round 3 4 9 14
-
-let double_round: shuffle =
- column_round @ diagonal_round (* 2 rounds *)
-
-let rounds : shuffle =
- iter 10 double_round (* 20 rounds *)
-
-let chacha20_core (s:state) : Tot state =
- let s' = rounds s in
- Spec.Loops.seq_map2 (fun x y -> x +%^ y) s' s
-
-(* state initialization *)
-let c0 = 0x61707865ul
-let c1 = 0x3320646eul
-let c2 = 0x79622d32ul
-let c3 = 0x6b206574ul
-
-let setup (k:key) (n:nonce) (c:counter): Tot state =
- create_4 c0 c1 c2 c3 @|
- uint32s_from_le 8 k @|
- create_1 (UInt32.uint_to_t c) @|
- uint32s_from_le 3 n
-
-let chacha20_block (k:key) (n:nonce) (c:counter): Tot block =
- let st = setup k n c in
- let st' = chacha20_core st in
- uint32s_to_le 16 st'
-
-let chacha20_ctx: Spec.CTR.block_cipher_ctx =
- let open Spec.CTR in
- {
- keylen = keylen;
- blocklen = blocklen;
- noncelen = noncelen;
- counterbits = 32;
- incr = 1
- }
-
-let chacha20_cipher: Spec.CTR.block_cipher chacha20_ctx = chacha20_block
-
-let chacha20_encrypt_bytes key nonce counter m =
- Spec.CTR.counter_mode chacha20_ctx chacha20_cipher key nonce counter m
-
-
-unfold let test_plaintext = [
- 0x4cuy; 0x61uy; 0x64uy; 0x69uy; 0x65uy; 0x73uy; 0x20uy; 0x61uy;
- 0x6euy; 0x64uy; 0x20uy; 0x47uy; 0x65uy; 0x6euy; 0x74uy; 0x6cuy;
- 0x65uy; 0x6duy; 0x65uy; 0x6euy; 0x20uy; 0x6fuy; 0x66uy; 0x20uy;
- 0x74uy; 0x68uy; 0x65uy; 0x20uy; 0x63uy; 0x6cuy; 0x61uy; 0x73uy;
- 0x73uy; 0x20uy; 0x6fuy; 0x66uy; 0x20uy; 0x27uy; 0x39uy; 0x39uy;
- 0x3auy; 0x20uy; 0x49uy; 0x66uy; 0x20uy; 0x49uy; 0x20uy; 0x63uy;
- 0x6fuy; 0x75uy; 0x6cuy; 0x64uy; 0x20uy; 0x6fuy; 0x66uy; 0x66uy;
- 0x65uy; 0x72uy; 0x20uy; 0x79uy; 0x6fuy; 0x75uy; 0x20uy; 0x6fuy;
- 0x6euy; 0x6cuy; 0x79uy; 0x20uy; 0x6fuy; 0x6euy; 0x65uy; 0x20uy;
- 0x74uy; 0x69uy; 0x70uy; 0x20uy; 0x66uy; 0x6fuy; 0x72uy; 0x20uy;
- 0x74uy; 0x68uy; 0x65uy; 0x20uy; 0x66uy; 0x75uy; 0x74uy; 0x75uy;
- 0x72uy; 0x65uy; 0x2cuy; 0x20uy; 0x73uy; 0x75uy; 0x6euy; 0x73uy;
- 0x63uy; 0x72uy; 0x65uy; 0x65uy; 0x6euy; 0x20uy; 0x77uy; 0x6fuy;
- 0x75uy; 0x6cuy; 0x64uy; 0x20uy; 0x62uy; 0x65uy; 0x20uy; 0x69uy;
- 0x74uy; 0x2euy
-]
-
-unfold let test_ciphertext = [
- 0x6euy; 0x2euy; 0x35uy; 0x9auy; 0x25uy; 0x68uy; 0xf9uy; 0x80uy;
- 0x41uy; 0xbauy; 0x07uy; 0x28uy; 0xdduy; 0x0duy; 0x69uy; 0x81uy;
- 0xe9uy; 0x7euy; 0x7auy; 0xecuy; 0x1duy; 0x43uy; 0x60uy; 0xc2uy;
- 0x0auy; 0x27uy; 0xafuy; 0xccuy; 0xfduy; 0x9fuy; 0xaeuy; 0x0buy;
- 0xf9uy; 0x1buy; 0x65uy; 0xc5uy; 0x52uy; 0x47uy; 0x33uy; 0xabuy;
- 0x8fuy; 0x59uy; 0x3duy; 0xabuy; 0xcduy; 0x62uy; 0xb3uy; 0x57uy;
- 0x16uy; 0x39uy; 0xd6uy; 0x24uy; 0xe6uy; 0x51uy; 0x52uy; 0xabuy;
- 0x8fuy; 0x53uy; 0x0cuy; 0x35uy; 0x9fuy; 0x08uy; 0x61uy; 0xd8uy;
- 0x07uy; 0xcauy; 0x0duy; 0xbfuy; 0x50uy; 0x0duy; 0x6auy; 0x61uy;
- 0x56uy; 0xa3uy; 0x8euy; 0x08uy; 0x8auy; 0x22uy; 0xb6uy; 0x5euy;
- 0x52uy; 0xbcuy; 0x51uy; 0x4duy; 0x16uy; 0xccuy; 0xf8uy; 0x06uy;
- 0x81uy; 0x8cuy; 0xe9uy; 0x1auy; 0xb7uy; 0x79uy; 0x37uy; 0x36uy;
- 0x5auy; 0xf9uy; 0x0buy; 0xbfuy; 0x74uy; 0xa3uy; 0x5buy; 0xe6uy;
- 0xb4uy; 0x0buy; 0x8euy; 0xeduy; 0xf2uy; 0x78uy; 0x5euy; 0x42uy;
- 0x87uy; 0x4duy
-]
-
-unfold let test_key = [
- 0uy; 1uy; 2uy; 3uy; 4uy; 5uy; 6uy; 7uy;
- 8uy; 9uy; 10uy; 11uy; 12uy; 13uy; 14uy; 15uy;
- 16uy; 17uy; 18uy; 19uy; 20uy; 21uy; 22uy; 23uy;
- 24uy; 25uy; 26uy; 27uy; 28uy; 29uy; 30uy; 31uy
- ]
-unfold let test_nonce = [
- 0uy; 0uy; 0uy; 0uy; 0uy; 0uy; 0uy; 0x4auy; 0uy; 0uy; 0uy; 0uy
- ]
-
-unfold let test_counter = 1
-
-let test() =
- assert_norm(List.Tot.length test_plaintext = 114);
- assert_norm(List.Tot.length test_ciphertext = 114);
- assert_norm(List.Tot.length test_key = 32);
- assert_norm(List.Tot.length test_nonce = 12);
- let test_plaintext = createL test_plaintext in
- let test_ciphertext = createL test_ciphertext in
- let test_key = createL test_key in
- let test_nonce = createL test_nonce in
- chacha20_encrypt_bytes test_key test_nonce test_counter test_plaintext
- = test_ciphertext
diff --git a/security/nss/lib/freebl/verified/specs/Spec.Curve25519.fst b/security/nss/lib/freebl/verified/specs/Spec.Curve25519.fst
deleted file mode 100644
index af4035b09f..0000000000
--- a/security/nss/lib/freebl/verified/specs/Spec.Curve25519.fst
+++ /dev/null
@@ -1,168 +0,0 @@
-/* Copyright 2016-2017 INRIA and Microsoft Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-module Spec.Curve25519
-
-module ST = FStar.HyperStack.ST
-
-open FStar.Mul
-open FStar.Seq
-open FStar.UInt8
-open FStar.Endianness
-open Spec.Lib
-open Spec.Curve25519.Lemmas
-
-#reset-options "--initial_fuel 0 --max_fuel 0 --z3rlimit 20"
-
-(* Field types and parameters *)
-let prime = pow2 255 - 19
-type elem : Type0 = e:int{e >= 0 /\ e < prime}
-let fadd e1 e2 = (e1 + e2) % prime
-let fsub e1 e2 = (e1 - e2) % prime
-let fmul e1 e2 = (e1 * e2) % prime
-let zero : elem = 0
-let one : elem = 1
-let ( +@ ) = fadd
-let ( *@ ) = fmul
-
-(** Exponentiation *)
-let rec ( ** ) (e:elem) (n:pos) : Tot elem (decreases n) =
- if n = 1 then e
- else
- if n % 2 = 0 then op_Star_Star (e `fmul` e) (n / 2)
- else e `fmul` (op_Star_Star (e `fmul` e) ((n-1)/2))
-
-(* Type aliases *)
-type scalar = lbytes 32
-type serialized_point = lbytes 32
-type proj_point = | Proj: x:elem -> z:elem -> proj_point
-
-let decodeScalar25519 (k:scalar) =
- let k = k.[0] <- (k.[0] &^ 248uy) in
- let k = k.[31] <- ((k.[31] &^ 127uy) |^ 64uy) in k
-
-let decodePoint (u:serialized_point) =
- (little_endian u % pow2 255) % prime
-
-let add_and_double qx nq nqp1 =
- let x_1 = qx in
- let x_2, z_2 = nq.x, nq.z in
- let x_3, z_3 = nqp1.x, nqp1.z in
- let a = x_2 `fadd` z_2 in
- let aa = a**2 in
- let b = x_2 `fsub` z_2 in
- let bb = b**2 in
- let e = aa `fsub` bb in
- let c = x_3 `fadd` z_3 in
- let d = x_3 `fsub` z_3 in
- let da = d `fmul` a in
- let cb = c `fmul` b in
- let x_3 = (da `fadd` cb)**2 in
- let z_3 = x_1 `fmul` ((da `fsub` cb)**2) in
- let x_2 = aa `fmul` bb in
- let z_2 = e `fmul` (aa `fadd` (121665 `fmul` e)) in
- Proj x_2 z_2, Proj x_3 z_3
-
-let ith_bit (k:scalar) (i:nat{i < 256}) =
- let q = i / 8 in let r = i % 8 in
- (v (k.[q]) / pow2 r) % 2
-
-let rec montgomery_ladder_ (init:elem) x xp1 (k:scalar) (ctr:nat{ctr<=256})
- : Tot proj_point (decreases ctr) =
- if ctr = 0 then x
- else (
- let ctr' = ctr - 1 in
- let (x', xp1') =
- if ith_bit k ctr' = 1 then (
- let nqp2, nqp1 = add_and_double init xp1 x in
- nqp1, nqp2
- ) else add_and_double init x xp1 in
- montgomery_ladder_ init x' xp1' k ctr'
- )
-
-let montgomery_ladder (init:elem) (k:scalar) : Tot proj_point =
- montgomery_ladder_ init (Proj one zero) (Proj init one) k 256
-
-let encodePoint (p:proj_point) : Tot serialized_point =
- let p = p.x `fmul` (p.z ** (prime - 2)) in
- little_bytes 32ul p
-
-let scalarmult (k:scalar) (u:serialized_point) : Tot serialized_point =
- let k = decodeScalar25519 k in
- let u = decodePoint u in
- let res = montgomery_ladder u k in
- encodePoint res
-
-
-(* ********************* *)
-(* RFC 7748 Test Vectors *)
-(* ********************* *)
-
-let scalar1 = [
- 0xa5uy; 0x46uy; 0xe3uy; 0x6buy; 0xf0uy; 0x52uy; 0x7cuy; 0x9duy;
- 0x3buy; 0x16uy; 0x15uy; 0x4buy; 0x82uy; 0x46uy; 0x5euy; 0xdduy;
- 0x62uy; 0x14uy; 0x4cuy; 0x0auy; 0xc1uy; 0xfcuy; 0x5auy; 0x18uy;
- 0x50uy; 0x6auy; 0x22uy; 0x44uy; 0xbauy; 0x44uy; 0x9auy; 0xc4uy
-]
-
-let scalar2 = [
- 0x4buy; 0x66uy; 0xe9uy; 0xd4uy; 0xd1uy; 0xb4uy; 0x67uy; 0x3cuy;
- 0x5auy; 0xd2uy; 0x26uy; 0x91uy; 0x95uy; 0x7duy; 0x6auy; 0xf5uy;
- 0xc1uy; 0x1buy; 0x64uy; 0x21uy; 0xe0uy; 0xeauy; 0x01uy; 0xd4uy;
- 0x2cuy; 0xa4uy; 0x16uy; 0x9euy; 0x79uy; 0x18uy; 0xbauy; 0x0duy
-]
-
-let input1 = [
- 0xe6uy; 0xdbuy; 0x68uy; 0x67uy; 0x58uy; 0x30uy; 0x30uy; 0xdbuy;
- 0x35uy; 0x94uy; 0xc1uy; 0xa4uy; 0x24uy; 0xb1uy; 0x5fuy; 0x7cuy;
- 0x72uy; 0x66uy; 0x24uy; 0xecuy; 0x26uy; 0xb3uy; 0x35uy; 0x3buy;
- 0x10uy; 0xa9uy; 0x03uy; 0xa6uy; 0xd0uy; 0xabuy; 0x1cuy; 0x4cuy
-]
-
-let input2 = [
- 0xe5uy; 0x21uy; 0x0fuy; 0x12uy; 0x78uy; 0x68uy; 0x11uy; 0xd3uy;
- 0xf4uy; 0xb7uy; 0x95uy; 0x9duy; 0x05uy; 0x38uy; 0xaeuy; 0x2cuy;
- 0x31uy; 0xdbuy; 0xe7uy; 0x10uy; 0x6fuy; 0xc0uy; 0x3cuy; 0x3euy;
- 0xfcuy; 0x4cuy; 0xd5uy; 0x49uy; 0xc7uy; 0x15uy; 0xa4uy; 0x93uy
-]
-
-let expected1 = [
- 0xc3uy; 0xdauy; 0x55uy; 0x37uy; 0x9duy; 0xe9uy; 0xc6uy; 0x90uy;
- 0x8euy; 0x94uy; 0xeauy; 0x4duy; 0xf2uy; 0x8duy; 0x08uy; 0x4fuy;
- 0x32uy; 0xecuy; 0xcfuy; 0x03uy; 0x49uy; 0x1cuy; 0x71uy; 0xf7uy;
- 0x54uy; 0xb4uy; 0x07uy; 0x55uy; 0x77uy; 0xa2uy; 0x85uy; 0x52uy
-]
-let expected2 = [
- 0x95uy; 0xcbuy; 0xdeuy; 0x94uy; 0x76uy; 0xe8uy; 0x90uy; 0x7duy;
- 0x7auy; 0xaduy; 0xe4uy; 0x5cuy; 0xb4uy; 0xb8uy; 0x73uy; 0xf8uy;
- 0x8buy; 0x59uy; 0x5auy; 0x68uy; 0x79uy; 0x9fuy; 0xa1uy; 0x52uy;
- 0xe6uy; 0xf8uy; 0xf7uy; 0x64uy; 0x7auy; 0xacuy; 0x79uy; 0x57uy
-]
-
-let test () =
- assert_norm(List.Tot.length scalar1 = 32);
- assert_norm(List.Tot.length scalar2 = 32);
- assert_norm(List.Tot.length input1 = 32);
- assert_norm(List.Tot.length input2 = 32);
- assert_norm(List.Tot.length expected1 = 32);
- assert_norm(List.Tot.length expected2 = 32);
- let scalar1 = createL scalar1 in
- let scalar2 = createL scalar2 in
- let input1 = createL input1 in
- let input2 = createL input2 in
- let expected1 = createL expected1 in
- let expected2 = createL expected2 in
- scalarmult scalar1 input1 = expected1
- && scalarmult scalar2 input2 = expected2
diff --git a/security/nss/lib/freebl/verified/specs/Spec.Poly1305.fst b/security/nss/lib/freebl/verified/specs/Spec.Poly1305.fst
deleted file mode 100644
index f9d8a4cb2a..0000000000
--- a/security/nss/lib/freebl/verified/specs/Spec.Poly1305.fst
+++ /dev/null
@@ -1,107 +0,0 @@
-/* Copyright 2016-2017 INRIA and Microsoft Corporation
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-module Spec.Poly1305
-
-module ST = FStar.HyperStack.ST
-
-open FStar.Math.Lib
-open FStar.Mul
-open FStar.Seq
-open FStar.UInt8
-open FStar.Endianness
-open Spec.Poly1305.Lemmas
-
-#set-options "--initial_fuel 0 --max_fuel 0 --initial_ifuel 0 --max_ifuel 0"
-
-(* Field types and parameters *)
-let prime = pow2 130 - 5
-type elem = e:int{e >= 0 /\ e < prime}
-let fadd (e1:elem) (e2:elem) = (e1 + e2) % prime
-let fmul (e1:elem) (e2:elem) = (e1 * e2) % prime
-let zero : elem = 0
-let one : elem = 1
-let op_Plus_At = fadd
-let op_Star_At = fmul
-(* Type aliases *)
-let op_Amp_Bar = UInt.logand #128
-type word = w:bytes{length w <= 16}
-type word_16 = w:bytes{length w = 16}
-type tag = word_16
-type key = lbytes 32
-type text = seq word
-
-(* Specification code *)
-let encode (w:word) =
- (pow2 (8 * length w)) `fadd` (little_endian w)
-
-let rec poly (txt:text) (r:e:elem) : Tot elem (decreases (length txt)) =
- if length txt = 0 then zero
- else
- let a = poly (Seq.tail txt) r in
- let n = encode (Seq.head txt) in
- (n `fadd` a) `fmul` r
-
-let encode_r (rb:word_16) =
- (little_endian rb) &| 0x0ffffffc0ffffffc0ffffffc0fffffff
-
-let finish (a:elem) (s:word_16) : Tot tag =
- let n = (a + little_endian s) % pow2 128 in
- little_bytes 16ul n
-
-let rec encode_bytes (txt:bytes) : Tot text (decreases (length txt)) =
- if length txt = 0 then createEmpty
- else
- let w, txt = split txt (min (length txt) 16) in
- append_last (encode_bytes txt) w
-
-let poly1305 (msg:bytes) (k:key) : Tot tag =
- let text = encode_bytes msg in
- let r = encode_r (slice k 0 16) in
- let s = slice k 16 32 in
- finish (poly text r) s
-
-
-(* ********************* *)
-(* RFC 7539 Test Vectors *)
-(* ********************* *)
-
-#reset-options "--initial_fuel 0 --max_fuel 0 --z3rlimit 20"
-
-unfold let msg = [
- 0x43uy; 0x72uy; 0x79uy; 0x70uy; 0x74uy; 0x6fuy; 0x67uy; 0x72uy;
- 0x61uy; 0x70uy; 0x68uy; 0x69uy; 0x63uy; 0x20uy; 0x46uy; 0x6fuy;
- 0x72uy; 0x75uy; 0x6duy; 0x20uy; 0x52uy; 0x65uy; 0x73uy; 0x65uy;
- 0x61uy; 0x72uy; 0x63uy; 0x68uy; 0x20uy; 0x47uy; 0x72uy; 0x6fuy;
- 0x75uy; 0x70uy ]
-
-unfold let k = [
- 0x85uy; 0xd6uy; 0xbeuy; 0x78uy; 0x57uy; 0x55uy; 0x6duy; 0x33uy;
- 0x7fuy; 0x44uy; 0x52uy; 0xfeuy; 0x42uy; 0xd5uy; 0x06uy; 0xa8uy;
- 0x01uy; 0x03uy; 0x80uy; 0x8auy; 0xfbuy; 0x0duy; 0xb2uy; 0xfduy;
- 0x4auy; 0xbfuy; 0xf6uy; 0xafuy; 0x41uy; 0x49uy; 0xf5uy; 0x1buy ]
-
-unfold let expected = [
- 0xa8uy; 0x06uy; 0x1duy; 0xc1uy; 0x30uy; 0x51uy; 0x36uy; 0xc6uy;
- 0xc2uy; 0x2buy; 0x8buy; 0xafuy; 0x0cuy; 0x01uy; 0x27uy; 0xa9uy ]
-
-let test () : Tot bool =
- assert_norm(List.Tot.length msg = 34);
- assert_norm(List.Tot.length k = 32);
- assert_norm(List.Tot.length expected = 16);
- let msg = createL msg in
- let k = createL k in
- let expected = createL expected in
- poly1305 msg k = expected
diff --git a/security/nss/lib/nss/nss.def b/security/nss/lib/nss/nss.def
index 4f0ade4d0b..e1453cc84e 100644
--- a/security/nss/lib/nss/nss.def
+++ b/security/nss/lib/nss/nss.def
@@ -1115,21 +1115,3 @@ PK11_GetTokenURI;
;+ local:
;+ *;
;+};
-;+NSS_3.33 { # NSS 3.33 release
-;+ global:
-CERT_FindCertByIssuerAndSNCX;
-CERT_FindCertByNicknameOrEmailAddrCX;
-CERT_FindCertByNicknameOrEmailAddrForUsageCX;
-;+ local:
-;+ *;
-;+};
-;+NSS_3.34 { # NSS 3.34 release
-;+ global:
-PK11_CreateManagedGenericObject;
-SGN_NewContextWithAlgorithmID;
-SEC_SignDataWithAlgorithmID;
-SEC_DerSignDataWithAlgorithmID;
-SEC_CreateSignatureAlgorithmParameters;
-;+ local:
-;+ *;
-;+};
diff --git a/security/nss/lib/nss/nss.h b/security/nss/lib/nss/nss.h
index 62cf367302..8238faca7e 100644
--- a/security/nss/lib/nss/nss.h
+++ b/security/nss/lib/nss/nss.h
@@ -22,10 +22,10 @@
* The format of the version string should be
* "<major version>.<minor version>[.<patch level>[.<build number>]][ <ECC>][ <Beta>]"
*/
-#define NSS_VERSION "3.35" _NSS_CUSTOMIZED
+#define NSS_VERSION "3.32.1" _NSS_CUSTOMIZED
#define NSS_VMAJOR 3
-#define NSS_VMINOR 35
-#define NSS_VPATCH 0
+#define NSS_VMINOR 32
+#define NSS_VPATCH 1
#define NSS_VBUILD 0
#define NSS_BETA PR_FALSE
@@ -291,15 +291,6 @@ SECStatus NSS_UnregisterShutdown(NSS_ShutdownFunc sFunc, void *appData);
#define NSS_DTLS_VERSION_MIN_POLICY 0x00a
#define NSS_DTLS_VERSION_MAX_POLICY 0x00b
-/* Until NSS 3.30, the PKCS#12 implementation used BMPString encoding
- * for all passwords. This changed to use UTF-8 for non-PKCS#12 PBEs
- * in NSS 3.31.
- *
- * For backward compatibility, this option reverts the behavior to the
- * old NSS versions. This option might be removed in the future NSS
- * releases; don't rely on it. */
-#define __NSS_PKCS12_DECODE_FORCE_UNICODE 0x00c
-
/*
* Set and get global options for the NSS library.
*/
diff --git a/security/nss/lib/nss/nssoptions.c b/security/nss/lib/nss/nssoptions.c
index 1339cede89..fc97d62787 100644
--- a/security/nss/lib/nss/nssoptions.c
+++ b/security/nss/lib/nss/nssoptions.c
@@ -23,7 +23,6 @@ struct nssOps {
PRInt32 tlsVersionMaxPolicy;
PRInt32 dtlsVersionMinPolicy;
PRInt32 dtlsVersionMaxPolicy;
- PRInt32 pkcs12DecodeForceUnicode;
};
static struct nssOps nss_ops = {
@@ -34,7 +33,6 @@ static struct nssOps nss_ops = {
0xffff, /* set TLS max to more than the largest legal SSL value */
1,
0xffff,
- PR_FALSE
};
SECStatus
@@ -64,9 +62,6 @@ NSS_OptionSet(PRInt32 which, PRInt32 value)
case NSS_DTLS_VERSION_MAX_POLICY:
nss_ops.dtlsVersionMaxPolicy = value;
break;
- case __NSS_PKCS12_DECODE_FORCE_UNICODE:
- nss_ops.pkcs12DecodeForceUnicode = value;
- break;
default:
rv = SECFailure;
}
@@ -101,9 +96,6 @@ NSS_OptionGet(PRInt32 which, PRInt32 *value)
case NSS_DTLS_VERSION_MAX_POLICY:
*value = nss_ops.dtlsVersionMaxPolicy;
break;
- case __NSS_PKCS12_DECODE_FORCE_UNICODE:
- *value = nss_ops.pkcs12DecodeForceUnicode;
- break;
default:
rv = SECFailure;
}
diff --git a/security/nss/lib/nss/utilwrap.c b/security/nss/lib/nss/utilwrap.c
index 48e147d885..938d95c0f1 100644
--- a/security/nss/lib/nss/utilwrap.c
+++ b/security/nss/lib/nss/utilwrap.c
@@ -75,8 +75,6 @@
#undef PORT_UCS2_ASCIIConversion
#undef PORT_UCS2_UTF8Conversion
#undef PORT_ZAlloc
-#undef PORT_ZAllocAligned
-#undef PORT_ZAllocAlignedOffset
#undef PORT_ZFree
#undef SEC_ASN1Decode
#undef SEC_ASN1DecodeInteger
@@ -146,18 +144,6 @@ PORT_ZAlloc(size_t bytes)
return PORT_ZAlloc_Util(bytes);
}
-void *
-PORT_ZAllocAligned(size_t bytes, size_t alignment, void **mem)
-{
- return PORT_ZAllocAligned_Util(bytes, alignment, mem);
-}
-
-void *
-PORT_ZAllocAlignedOffset(size_t bytes, size_t alignment, size_t offset)
-{
- return PORT_ZAllocAlignedOffset_Util(bytes, alignment, offset);
-}
-
void
PORT_Free(void *ptr)
{
diff --git a/security/nss/lib/pk11wrap/pk11load.c b/security/nss/lib/pk11wrap/pk11load.c
index d1f6ec442d..91339fad8f 100644
--- a/security/nss/lib/pk11wrap/pk11load.c
+++ b/security/nss/lib/pk11wrap/pk11load.c
@@ -64,7 +64,8 @@ secmodUnlockMutext(CK_VOID_PTR mutext)
static SECMODModuleID nextModuleID = 1;
static const CK_C_INITIALIZE_ARGS secmodLockFunctions = {
secmodCreateMutext, secmodDestroyMutext, secmodLockMutext,
- secmodUnlockMutext, CKF_LIBRARY_CANT_CREATE_OS_THREADS | CKF_OS_LOCKING_OK,
+ secmodUnlockMutext, CKF_LIBRARY_CANT_CREATE_OS_THREADS |
+ CKF_OS_LOCKING_OK,
NULL
};
static const CK_C_INITIALIZE_ARGS secmodNoLockArgs = {
diff --git a/security/nss/lib/pk11wrap/pk11merge.c b/security/nss/lib/pk11wrap/pk11merge.c
index b2101b8191..8c4c5129aa 100644
--- a/security/nss/lib/pk11wrap/pk11merge.c
+++ b/security/nss/lib/pk11wrap/pk11merge.c
@@ -68,11 +68,8 @@ pk11_copyAttributes(PLArenaPool *arena,
copyTemplate, copyTemplateCount);
/* if we have missing attributes, just skip them and create the object */
if (crv == CKR_ATTRIBUTE_TYPE_INVALID) {
- CK_ULONG i, j;
+ int i, j;
newTemplate = PORT_NewArray(CK_ATTRIBUTE, copyTemplateCount);
- if (!newTemplate) {
- return SECFailure;
- }
/* remove the unknown attributes. If we don't have enough attributes
* PK11_CreateNewObject() will fail */
for (i = 0, j = 0; i < copyTemplateCount; i++) {
@@ -1261,7 +1258,6 @@ pk11_newMergeLogNode(PLArenaPool *arena,
/* initialize it */
obj->slot = slot;
obj->objectID = id;
- obj->owner = PR_FALSE;
newLog->object = obj;
newLog->error = error;
diff --git a/security/nss/lib/pk11wrap/pk11obj.c b/security/nss/lib/pk11wrap/pk11obj.c
index b97caddd44..47c56154d4 100644
--- a/security/nss/lib/pk11wrap/pk11obj.c
+++ b/security/nss/lib/pk11wrap/pk11obj.c
@@ -201,6 +201,7 @@ PK11_GetAttributes(PLArenaPool *arena, PK11SlotInfo *slot,
/* make pedantic happy... note that it's only used arena != NULL */
void *mark = NULL;
CK_RV crv;
+ PORT_Assert(slot->session != CK_INVALID_SESSION);
if (slot->session == CK_INVALID_SESSION)
return CKR_SESSION_HANDLE_INVALID;
@@ -1505,7 +1506,6 @@ PK11_FindGenericObjects(PK11SlotInfo *slot, CK_OBJECT_CLASS objClass)
/* initialize it */
obj->slot = PK11_ReferenceSlot(slot);
obj->objectID = objectIDs[i];
- obj->owner = PR_FALSE;
obj->next = NULL;
obj->prev = NULL;
@@ -1586,9 +1586,6 @@ PK11_DestroyGenericObject(PK11GenericObject *object)
PK11_UnlinkGenericObject(object);
if (object->slot) {
- if (object->owner) {
- PK11_DestroyObject(object->slot, object->objectID);
- }
PK11_FreeSlot(object->slot);
}
PORT_Free(object);
@@ -1630,9 +1627,8 @@ PK11_DestroyGenericObjects(PK11GenericObject *objects)
* Hand Create a new object and return the Generic object for our new object.
*/
PK11GenericObject *
-pk11_CreateGenericObjectHelper(PK11SlotInfo *slot,
- const CK_ATTRIBUTE *pTemplate,
- int count, PRBool token, PRBool owner)
+PK11_CreateGenericObject(PK11SlotInfo *slot, const CK_ATTRIBUTE *pTemplate,
+ int count, PRBool token)
{
CK_OBJECT_HANDLE objectID;
PK11GenericObject *obj;
@@ -1656,40 +1652,11 @@ pk11_CreateGenericObjectHelper(PK11SlotInfo *slot,
/* initialize it */
obj->slot = PK11_ReferenceSlot(slot);
obj->objectID = objectID;
- obj->owner = owner;
obj->next = NULL;
obj->prev = NULL;
return obj;
}
-/* This is the classic interface. Applications would call this function to
- * create new object that would not be destroyed later. This lead to resource
- * leaks (and thus memory leaks in the PKCS #11 module). To solve this we have
- * a new interface that automatically marks objects created on the fly to be
- * destroyed later.
- * The old interface is preserved because applications like Mozilla purposefully
- * leak the reference to be found later with PK11_FindGenericObjects. New
- * applications should use the new interface PK11_CreateManagedGenericObject */
-PK11GenericObject *
-PK11_CreateGenericObject(PK11SlotInfo *slot, const CK_ATTRIBUTE *pTemplate,
- int count, PRBool token)
-{
- return pk11_CreateGenericObjectHelper(slot, pTemplate, count, token,
- PR_FALSE);
-}
-
-/* Use this interface. It will automatically destroy any temporary objects
- * (token = PR_FALSE) when the PK11GenericObject is freed. Permanent objects still
- * need to be destroyed by hand with PK11_DestroyTokenObject.
- */
-PK11GenericObject *
-PK11_CreateManagedGenericObject(PK11SlotInfo *slot,
- const CK_ATTRIBUTE *pTemplate, int count, PRBool token)
-{
- return pk11_CreateGenericObjectHelper(slot, pTemplate, count, token,
- !token);
-}
-
/*
* Change an attribute on a raw object
*/
diff --git a/security/nss/lib/pk11wrap/pk11pars.c b/security/nss/lib/pk11wrap/pk11pars.c
index fc30222b3d..ee20789cc0 100644
--- a/security/nss/lib/pk11wrap/pk11pars.c
+++ b/security/nss/lib/pk11wrap/pk11pars.c
@@ -413,7 +413,8 @@ static const policyFlagDef policyFlagList[] = {
/* add other signatures in the future */
{ CIPHER_NAME("SIGNATURE"), NSS_USE_ALG_IN_CERT_SIGNATURE },
/* enable everything */
- { CIPHER_NAME("ALL"), NSS_USE_ALG_IN_SSL | NSS_USE_ALG_IN_SSL_KX | NSS_USE_ALG_IN_CERT_SIGNATURE },
+ { CIPHER_NAME("ALL"), NSS_USE_ALG_IN_SSL | NSS_USE_ALG_IN_SSL_KX |
+ NSS_USE_ALG_IN_CERT_SIGNATURE },
{ CIPHER_NAME("NONE"), 0 }
};
diff --git a/security/nss/lib/pk11wrap/pk11pbe.c b/security/nss/lib/pk11wrap/pk11pbe.c
index 5f68f399e5..bea9333f62 100644
--- a/security/nss/lib/pk11wrap/pk11pbe.c
+++ b/security/nss/lib/pk11wrap/pk11pbe.c
@@ -367,24 +367,7 @@ sec_pkcs5v2_key_length(SECAlgorithmID *algid, SECAlgorithmID *cipherAlgId)
cipherAlg = SECOID_GetAlgorithmTag(cipherAlgId);
if (sec_pkcs5_is_algorithm_v2_aes_algorithm(cipherAlg)) {
- /* Previously, the PKCS#12 files created with the old NSS
- * releases encoded the maximum key size of AES (that is 32)
- * in the keyLength field of PBKDF2-params. That resulted in
- * always performing AES-256 even if AES-128-CBC or
- * AES-192-CBC is specified in the encryptionScheme field of
- * PBES2-params. This is wrong, but for compatibility reasons,
- * check the keyLength field and use the value if it is 32.
- */
- if (p5_param.keyLength.data != NULL) {
- length = DER_GetInteger(&p5_param.keyLength);
- }
- /* If the keyLength field is present and contains a value
- * other than 32, that means the file is created outside of
- * NSS, which we don't care about. Note that the following
- * also handles the case when the field is absent. */
- if (length != 32) {
- length = sec_pkcs5v2_aes_key_length(cipherAlg);
- }
+ length = sec_pkcs5v2_aes_key_length(cipherAlg);
} else if (p5_param.keyLength.data != NULL) {
length = DER_GetInteger(&p5_param.keyLength);
} else {
diff --git a/security/nss/lib/pk11wrap/pk11pk12.c b/security/nss/lib/pk11wrap/pk11pk12.c
index 035143af80..d753b87e58 100644
--- a/security/nss/lib/pk11wrap/pk11pk12.c
+++ b/security/nss/lib/pk11wrap/pk11pk12.c
@@ -153,6 +153,7 @@ const SEC_ASN1Template SECKEY_DHPrivateKeyExportTemplate[] = {
{ SEC_ASN1_INTEGER, offsetof(SECKEYRawPrivateKey, u.dh.prime) },
};
+#ifndef NSS_DISABLE_ECC
SEC_ASN1_MKSUB(SEC_BitStringTemplate)
SEC_ASN1_MKSUB(SEC_ObjectIDTemplate)
@@ -177,6 +178,7 @@ const SEC_ASN1Template SECKEY_ECPrivateKeyExportTemplate[] = {
SEC_ASN1_SUB(SEC_BitStringTemplate) },
{ 0 }
};
+#endif /* NSS_DISABLE_ECC */
const SEC_ASN1Template SECKEY_EncryptedPrivateKeyInfoTemplate[] = {
{ SEC_ASN1_SEQUENCE,
@@ -344,13 +346,16 @@ PK11_ImportAndReturnPrivateKey(PK11SlotInfo *slot, SECKEYRawPrivateKey *lpk,
switch (lpk->keyType) {
case rsaKey:
keyType = CKK_RSA;
- PK11_SETATTRS(attrs, CKA_UNWRAP, (keyUsage & KU_KEY_ENCIPHERMENT) ? &cktrue : &ckfalse,
+ PK11_SETATTRS(attrs, CKA_UNWRAP, (keyUsage & KU_KEY_ENCIPHERMENT) ? &cktrue
+ : &ckfalse,
sizeof(CK_BBOOL));
attrs++;
- PK11_SETATTRS(attrs, CKA_DECRYPT, (keyUsage & KU_DATA_ENCIPHERMENT) ? &cktrue : &ckfalse,
+ PK11_SETATTRS(attrs, CKA_DECRYPT, (keyUsage & KU_DATA_ENCIPHERMENT) ? &cktrue
+ : &ckfalse,
sizeof(CK_BBOOL));
attrs++;
- PK11_SETATTRS(attrs, CKA_SIGN, (keyUsage & KU_DIGITAL_SIGNATURE) ? &cktrue : &ckfalse,
+ PK11_SETATTRS(attrs, CKA_SIGN, (keyUsage & KU_DIGITAL_SIGNATURE) ? &cktrue
+ : &ckfalse,
sizeof(CK_BBOOL));
attrs++;
PK11_SETATTRS(attrs, CKA_SIGN_RECOVER,
@@ -477,6 +482,7 @@ PK11_ImportAndReturnPrivateKey(PK11SlotInfo *slot, SECKEYRawPrivateKey *lpk,
lpk->u.dh.privateValue.len);
attrs++;
break;
+#ifndef NSS_DISABLE_ECC
case ecKey:
keyType = CKK_EC;
if (lpk->u.ec.publicValue.len == 0) {
@@ -488,7 +494,8 @@ PK11_ImportAndReturnPrivateKey(PK11SlotInfo *slot, SECKEYRawPrivateKey *lpk,
lpk->u.ec.publicValue.len);
attrs++;
}
- PK11_SETATTRS(attrs, CKA_SIGN, (keyUsage & KU_DIGITAL_SIGNATURE) ? &cktrue : &ckfalse,
+ PK11_SETATTRS(attrs, CKA_SIGN, (keyUsage & KU_DIGITAL_SIGNATURE) ? &cktrue
+ : &ckfalse,
sizeof(CK_BBOOL));
attrs++;
PK11_SETATTRS(attrs, CKA_SIGN_RECOVER,
@@ -496,7 +503,8 @@ PK11_ImportAndReturnPrivateKey(PK11SlotInfo *slot, SECKEYRawPrivateKey *lpk,
: &ckfalse,
sizeof(CK_BBOOL));
attrs++;
- PK11_SETATTRS(attrs, CKA_DERIVE, (keyUsage & KU_KEY_AGREEMENT) ? &cktrue : &ckfalse,
+ PK11_SETATTRS(attrs, CKA_DERIVE, (keyUsage & KU_KEY_AGREEMENT) ? &cktrue
+ : &ckfalse,
sizeof(CK_BBOOL));
attrs++;
ck_id = PK11_MakeIDFromPubKey(&lpk->u.ec.publicValue);
@@ -517,6 +525,7 @@ PK11_ImportAndReturnPrivateKey(PK11SlotInfo *slot, SECKEYRawPrivateKey *lpk,
lpk->u.ec.publicValue.len);
attrs++;
break;
+#endif /* NSS_DISABLE_ECC */
default:
PORT_SetError(SEC_ERROR_BAD_KEY);
goto loser;
@@ -597,6 +606,7 @@ PK11_ImportPrivateKeyInfoAndReturnKey(PK11SlotInfo *slot,
paramDest = NULL;
lpk->keyType = dhKey;
break;
+#ifndef NSS_DISABLE_ECC
case SEC_OID_ANSIX962_EC_PUBLIC_KEY:
prepare_ec_priv_key_export_for_asn1(lpk);
keyTemplate = SECKEY_ECPrivateKeyExportTemplate;
@@ -604,6 +614,7 @@ PK11_ImportPrivateKeyInfoAndReturnKey(PK11SlotInfo *slot,
paramDest = NULL;
lpk->keyType = ecKey;
break;
+#endif /* NSS_DISABLE_ECC */
default:
keyTemplate = NULL;
@@ -622,6 +633,7 @@ PK11_ImportPrivateKeyInfoAndReturnKey(PK11SlotInfo *slot,
goto loser;
}
+#ifndef NSS_DISABLE_ECC
if (lpk->keyType == ecKey) {
/* Convert length in bits to length in bytes. */
lpk->u.ec.publicValue.len >>= 3;
@@ -633,6 +645,7 @@ PK11_ImportPrivateKeyInfoAndReturnKey(PK11SlotInfo *slot,
goto loser;
}
}
+#endif /* NSS_DISABLE_ECC */
if (paramDest && paramTemplate) {
rv = SEC_ASN1DecodeItem(arena, paramDest, paramTemplate,
diff --git a/security/nss/lib/pk11wrap/pk11pub.h b/security/nss/lib/pk11wrap/pk11pub.h
index dbd8da0923..edfe82f5ae 100644
--- a/security/nss/lib/pk11wrap/pk11pub.h
+++ b/security/nss/lib/pk11wrap/pk11pub.h
@@ -831,10 +831,6 @@ SECStatus PK11_LinkGenericObject(PK11GenericObject *list,
PK11GenericObject *object);
SECStatus PK11_DestroyGenericObjects(PK11GenericObject *object);
SECStatus PK11_DestroyGenericObject(PK11GenericObject *object);
-PK11GenericObject *PK11_CreateManagedGenericObject(PK11SlotInfo *slot,
- const CK_ATTRIBUTE *pTemplate,
- int count, PRBool token);
-/* deprecated */
PK11GenericObject *PK11_CreateGenericObject(PK11SlotInfo *slot,
const CK_ATTRIBUTE *pTemplate,
int count, PRBool token);
diff --git a/security/nss/lib/pk11wrap/pk11skey.c b/security/nss/lib/pk11wrap/pk11skey.c
index cf2a40a2f1..1ef53e1d76 100644
--- a/security/nss/lib/pk11wrap/pk11skey.c
+++ b/security/nss/lib/pk11wrap/pk11skey.c
@@ -182,10 +182,6 @@ PK11_FreeSymKey(PK11SymKey *symKey)
PK11SlotInfo *slot;
PRBool freeit = PR_TRUE;
- if (!symKey) {
- return;
- }
-
if (PR_ATOMIC_DECREMENT(&symKey->refCount) == 0) {
PK11SymKey *parent = symKey->parent;
diff --git a/security/nss/lib/pk11wrap/pk11slot.c b/security/nss/lib/pk11wrap/pk11slot.c
index c39abe17e6..0a6ed6c087 100644
--- a/security/nss/lib/pk11wrap/pk11slot.c
+++ b/security/nss/lib/pk11wrap/pk11slot.c
@@ -1182,7 +1182,7 @@ PK11_InitToken(PK11SlotInfo *slot, PRBool loadCerts)
/* set the slot flags to the current token values */
slot->series++; /* allow other objects to detect that the
- * slot is different */
+ * slot is different */
slot->flags = slot->tokenInfo.flags;
slot->needLogin = ((slot->tokenInfo.flags & CKF_LOGIN_REQUIRED) ? PR_TRUE : PR_FALSE);
slot->readOnly = ((slot->tokenInfo.flags & CKF_WRITE_PROTECTED) ? PR_TRUE : PR_FALSE);
@@ -1471,9 +1471,6 @@ PK11_InitSlot(SECMODModule *mod, CK_SLOT_ID slotID, PK11SlotInfo *slot)
slot->hasRootCerts = PR_TRUE;
}
}
- if ((slotInfo.flags & CKF_USER_PIN_INITIALIZED) != 0) {
- slot->flags |= CKF_USER_PIN_INITIALIZED;
- }
}
/*********************************************************************
diff --git a/security/nss/lib/pk11wrap/pk11util.c b/security/nss/lib/pk11wrap/pk11util.c
index e316f1f1a2..a962e9bb3d 100644
--- a/security/nss/lib/pk11wrap/pk11util.c
+++ b/security/nss/lib/pk11wrap/pk11util.c
@@ -437,11 +437,6 @@ SECMOD_DeleteInternalModule(const char *name)
return rv;
}
-#ifdef NSS_FIPS_DISABLED
- PORT_SetError(PR_OPERATION_NOT_SUPPORTED_ERROR);
- return rv;
-#endif
-
SECMOD_GetWriteLock(moduleLock);
for (mlpp = &modules, mlp = modules;
mlp != NULL; mlpp = &mlp->next, mlp = *mlpp) {
@@ -960,11 +955,7 @@ SECMOD_DestroyModuleList(SECMODModuleList *list)
PRBool
SECMOD_CanDeleteInternalModule(void)
{
-#ifdef NSS_FIPS_DISABLED
- return PR_FALSE;
-#else
return (PRBool)(pendingModule == NULL);
-#endif
}
/*
diff --git a/security/nss/lib/pk11wrap/secmodti.h b/security/nss/lib/pk11wrap/secmodti.h
index 260e6387d7..63c2079297 100644
--- a/security/nss/lib/pk11wrap/secmodti.h
+++ b/security/nss/lib/pk11wrap/secmodti.h
@@ -175,7 +175,6 @@ struct PK11GenericObjectStr {
PK11GenericObject *next;
PK11SlotInfo *slot;
CK_OBJECT_HANDLE objectID;
- PRBool owner;
};
#define MAX_TEMPL_ATTRS 16 /* maximum attributes in template */
diff --git a/security/nss/lib/pkcs12/p12d.c b/security/nss/lib/pkcs12/p12d.c
index dfe7015df0..57333ac371 100644
--- a/security/nss/lib/pkcs12/p12d.c
+++ b/security/nss/lib/pkcs12/p12d.c
@@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nssrenam.h"
-#include "nss.h"
#include "p12t.h"
#include "p12.h"
#include "plarena.h"
@@ -127,7 +126,6 @@ struct SEC_PKCS12DecoderContextStr {
SECKEYGetPasswordKey pwfn;
void *pwfnarg;
PRBool swapUnicodeBytes;
- PRBool forceUnicode;
/* import information */
PRBool bagsVerified;
@@ -194,18 +192,8 @@ sec_pkcs12_decoder_get_decrypt_key(void *arg, SECAlgorithmID *algid)
}
algorithm = SECOID_GetAlgorithmTag(algid);
-
- if (p12dcx->forceUnicode) {
- if (SECITEM_CopyItem(NULL, &pwitem, p12dcx->pwitem) != SECSuccess) {
- PK11_FreeSlot(slot);
- return NULL;
- }
- } else {
- if (!sec_pkcs12_decode_password(NULL, &pwitem, algorithm, p12dcx->pwitem)) {
- PK11_FreeSlot(slot);
- return NULL;
- }
- }
+ if (!sec_pkcs12_decode_password(NULL, &pwitem, algorithm, p12dcx->pwitem))
+ return NULL;
bulkKey = PK11_PBEKeyGen(slot, algid, &pwitem, PR_FALSE, p12dcx->wincx);
/* some tokens can't generate PBE keys on their own, generate the
@@ -1176,8 +1164,6 @@ SEC_PKCS12DecoderStart(SECItem *pwitem, PK11SlotInfo *slot, void *wincx,
{
SEC_PKCS12DecoderContext *p12dcx;
PLArenaPool *arena;
- PRInt32 forceUnicode = PR_FALSE;
- SECStatus rv;
arena = PORT_NewArena(2048); /* different size? */
if (!arena) {
@@ -1210,11 +1196,6 @@ SEC_PKCS12DecoderStart(SECItem *pwitem, PK11SlotInfo *slot, void *wincx,
#else
p12dcx->swapUnicodeBytes = PR_FALSE;
#endif
- rv = NSS_OptionGet(__NSS_PKCS12_DECODE_FORCE_UNICODE, &forceUnicode);
- if (rv != SECSuccess) {
- goto loser;
- }
- p12dcx->forceUnicode = forceUnicode;
p12dcx->errorValue = 0;
p12dcx->error = PR_FALSE;
@@ -2447,7 +2428,7 @@ sec_pkcs12_get_public_value_and_type(SECKEYPublicKey *pubKey, KeyType *type);
static SECStatus
sec_pkcs12_add_key(sec_PKCS12SafeBag *key, SECKEYPublicKey *pubKey,
unsigned int keyUsage,
- SECItem *nickName, PRBool forceUnicode, void *wincx)
+ SECItem *nickName, void *wincx)
{
SECStatus rv;
SECItem *publicValue = NULL;
@@ -2485,21 +2466,9 @@ sec_pkcs12_add_key(sec_PKCS12SafeBag *key, SECKEYPublicKey *pubKey,
&key->safeBagContent.pkcs8ShroudedKeyBag->algorithm;
SECOidTag algorithm = SECOID_GetAlgorithmTag(algid);
- if (forceUnicode) {
- if (SECITEM_CopyItem(NULL, &pwitem, key->pwitem) != SECSuccess) {
- key->error = SEC_ERROR_PKCS12_UNABLE_TO_IMPORT_KEY;
- key->problem = PR_TRUE;
- return SECFailure;
- }
- } else {
- if (!sec_pkcs12_decode_password(NULL, &pwitem, algorithm,
- key->pwitem)) {
- key->error = SEC_ERROR_PKCS12_UNABLE_TO_IMPORT_KEY;
- key->problem = PR_TRUE;
- return SECFailure;
- }
- }
-
+ if (!sec_pkcs12_decode_password(NULL, &pwitem, algorithm,
+ key->pwitem))
+ return SECFailure;
rv = PK11_ImportEncryptedPrivateKeyInfo(key->slot,
key->safeBagContent.pkcs8ShroudedKeyBag,
&pwitem, nickName, publicValue,
@@ -2954,8 +2923,7 @@ sec_pkcs12_get_public_value_and_type(SECKEYPublicKey *pubKey,
* two passes in sec_pkcs12_validate_bags.
*/
static SECStatus
-sec_pkcs12_install_bags(sec_PKCS12SafeBag **safeBags, PRBool forceUnicode,
- void *wincx)
+sec_pkcs12_install_bags(sec_PKCS12SafeBag **safeBags, void *wincx)
{
sec_PKCS12SafeBag **keyList;
int i;
@@ -3008,8 +2976,7 @@ sec_pkcs12_install_bags(sec_PKCS12SafeBag **safeBags, PRBool forceUnicode,
key->problem = PR_TRUE;
rv = SECFailure;
} else {
- rv = sec_pkcs12_add_key(key, pubKey, keyUsage, nickName,
- forceUnicode, wincx);
+ rv = sec_pkcs12_add_key(key, pubKey, keyUsage, nickName, wincx);
}
if (pubKey) {
SECKEY_DestroyPublicKey(pubKey);
@@ -3086,9 +3053,6 @@ sec_pkcs12_install_bags(sec_PKCS12SafeBag **safeBags, PRBool forceUnicode,
SECStatus
SEC_PKCS12DecoderImportBags(SEC_PKCS12DecoderContext *p12dcx)
{
- PRBool forceUnicode = PR_FALSE;
- SECStatus rv;
-
if (!p12dcx || p12dcx->error) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
return SECFailure;
@@ -3098,16 +3062,7 @@ SEC_PKCS12DecoderImportBags(SEC_PKCS12DecoderContext *p12dcx)
return SECFailure;
}
- /* We need to check the option here as well as in
- * SEC_PKCS12DecoderStart, because different PBE's could be used
- * for PKCS #7 and PKCS #8 */
- rv = NSS_OptionGet(__NSS_PKCS12_DECODE_FORCE_UNICODE, &forceUnicode);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- return sec_pkcs12_install_bags(p12dcx->safeBags, forceUnicode,
- p12dcx->wincx);
+ return sec_pkcs12_install_bags(p12dcx->safeBags, p12dcx->wincx);
}
PRBool
diff --git a/security/nss/lib/pkcs12/p12local.c b/security/nss/lib/pkcs12/p12local.c
index 53e3aa6bb6..a94c08be18 100644
--- a/security/nss/lib/pkcs12/p12local.c
+++ b/security/nss/lib/pkcs12/p12local.c
@@ -267,7 +267,8 @@ sec_pkcs12_generate_key_from_password(SECOidTag algorithm,
return NULL;
}
- pre_hash = (unsigned char *)PORT_ArenaZAlloc(poolp, sizeof(char) * (salt->len + password->len));
+ pre_hash = (unsigned char *)PORT_ArenaZAlloc(poolp, sizeof(char) *
+ (salt->len + password->len));
if (pre_hash == NULL) {
PORT_SetError(SEC_ERROR_NO_MEMORY);
goto loser;
diff --git a/security/nss/lib/pkcs7/p7create.c b/security/nss/lib/pkcs7/p7create.c
index a79d5aa26d..96ada5c0f5 100644
--- a/security/nss/lib/pkcs7/p7create.c
+++ b/security/nss/lib/pkcs7/p7create.c
@@ -18,13 +18,7 @@
#include "secder.h"
#include "secpkcs5.h"
-const int NSS_PBE_DEFAULT_ITERATION_COUNT = /* used in p12e.c too */
-#ifdef DEBUG
- 10000
-#else
- 1000000
-#endif
- ;
+const int NSS_PBE_DEFAULT_ITERATION_COUNT = 2000; /* used in p12e.c too */
static SECStatus
sec_pkcs7_init_content_info(SEC_PKCS7ContentInfo *cinfo, PLArenaPool *poolp,
diff --git a/security/nss/lib/pki/pki3hack.c b/security/nss/lib/pki/pki3hack.c
index fb3110a233..548853970b 100644
--- a/security/nss/lib/pki/pki3hack.c
+++ b/security/nss/lib/pki/pki3hack.c
@@ -180,18 +180,16 @@ STAN_RemoveModuleFromDefaultTrustDomain(
NSSTrustDomain *td;
int i;
td = STAN_GetDefaultTrustDomain();
+ NSSRWLock_LockWrite(td->tokensLock);
for (i = 0; i < module->slotCount; i++) {
token = PK11Slot_GetNSSToken(module->slots[i]);
if (token) {
nssToken_NotifyCertsNotVisible(token);
- NSSRWLock_LockWrite(td->tokensLock);
nssList_Remove(td->tokenList, token);
- NSSRWLock_UnlockWrite(td->tokensLock);
PK11Slot_SetNSSToken(module->slots[i], NULL);
nssToken_Destroy(token);
}
}
- NSSRWLock_LockWrite(td->tokensLock);
nssListIterator_Destroy(td->tokens);
td->tokens = nssList_CreateIterator(td->tokenList);
NSSRWLock_UnlockWrite(td->tokensLock);
diff --git a/security/nss/lib/smime/cmsdecode.c b/security/nss/lib/smime/cmsdecode.c
index 62b4ebfe54..d965111710 100644
--- a/security/nss/lib/smime/cmsdecode.c
+++ b/security/nss/lib/smime/cmsdecode.c
@@ -87,7 +87,8 @@ nss_cms_decoder_notify(void *arg, PRBool before, void *dest, int depth)
/* XXX error handling: need to set p7dcx->error */
#ifdef CMSDEBUG
- fprintf(stderr, "%6.6s, dest = 0x%08x, depth = %d\n", before ? "before" : "after",
+ fprintf(stderr, "%6.6s, dest = 0x%08x, depth = %d\n", before ? "before"
+ : "after",
dest, depth);
#endif
diff --git a/security/nss/lib/smime/cmsencode.c b/security/nss/lib/smime/cmsencode.c
index 0d723e865f..a4414e008a 100644
--- a/security/nss/lib/smime/cmsencode.c
+++ b/security/nss/lib/smime/cmsencode.c
@@ -134,7 +134,8 @@ nss_cms_encoder_notify(void *arg, PRBool before, void *dest, int depth)
rootcinfo = &(p7ecx->cmsg->contentInfo);
#ifdef CMSDEBUG
- fprintf(stderr, "%6.6s, dest = 0x%08x, depth = %d\n", before ? "before" : "after",
+ fprintf(stderr, "%6.6s, dest = 0x%08x, depth = %d\n", before ? "before"
+ : "after",
dest, depth);
#endif
diff --git a/security/nss/lib/softoken/fipstest.c b/security/nss/lib/softoken/fipstest.c
index 0cca74d6e8..3563bd2d22 100644
--- a/security/nss/lib/softoken/fipstest.c
+++ b/security/nss/lib/softoken/fipstest.c
@@ -5,7 +5,6 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#ifndef NSS_FIPS_DISABLED
#include "seccomon.h"
#include "blapi.h"
#include "softoken.h"
@@ -653,11 +652,3 @@ sftk_FIPSEntryOK()
}
return CKR_OK;
}
-#else
-#include "pkcs11t.h"
-CK_RV
-sftk_FIPSEntryOK()
-{
- return CKR_DEVICE_ERROR;
-}
-#endif /* NSS_FIPS_DISABLED */
diff --git a/security/nss/lib/softoken/fipstokn.c b/security/nss/lib/softoken/fipstokn.c
index ca7d7998ac..fd4fd4207c 100644
--- a/security/nss/lib/softoken/fipstokn.c
+++ b/security/nss/lib/softoken/fipstokn.c
@@ -540,10 +540,7 @@ FC_GetTokenInfo(CK_SLOT_ID slotID, CK_TOKEN_INFO_PTR pInfo)
crv = NSC_GetTokenInfo(slotID, pInfo);
if (crv == CKR_OK) {
- /* use the global database to figure out if we are running in
- * FIPS 140 Level 1 or Level 2 */
- if (slotID == FIPS_SLOT_ID &&
- (pInfo->flags & CKF_LOGIN_REQUIRED) == 0) {
+ if ((pInfo->flags & CKF_LOGIN_REQUIRED) == 0) {
isLevel2 = PR_FALSE;
}
}
@@ -619,8 +616,7 @@ FC_InitPIN(CK_SESSION_HANDLE hSession,
* we need to make sure the pin meets FIPS requirements */
if ((ulPinLen == 0) || ((rv = sftk_newPinCheck(pPin, ulPinLen)) == CKR_OK)) {
rv = NSC_InitPIN(hSession, pPin, ulPinLen);
- if ((rv == CKR_OK) &&
- (sftk_SlotIDFromSessionHandle(hSession) == FIPS_SLOT_ID)) {
+ if (rv == CKR_OK) {
isLevel2 = (ulPinLen > 0) ? PR_TRUE : PR_FALSE;
}
}
@@ -648,8 +644,7 @@ FC_SetPIN(CK_SESSION_HANDLE hSession, CK_CHAR_PTR pOldPin,
if ((rv = sftk_fipsCheck()) == CKR_OK &&
(rv = sftk_newPinCheck(pNewPin, usNewLen)) == CKR_OK) {
rv = NSC_SetPIN(hSession, pOldPin, usOldLen, pNewPin, usNewLen);
- if ((rv == CKR_OK) &&
- (sftk_SlotIDFromSessionHandle(hSession) == FIPS_SLOT_ID)) {
+ if (rv == CKR_OK) {
/* if we set the password in level1 we now go
* to level2. NOTE: we don't allow the user to
* go from level2 to level1 */
@@ -710,23 +705,11 @@ FC_GetSessionInfo(CK_SESSION_HANDLE hSession,
rv = NSC_GetSessionInfo(hSession, pInfo);
if (rv == CKR_OK) {
- /* handle the case where the auxilary slot doesn't require login.
- * piggy back on the main token's login state */
- if (isLoggedIn &&
- ((pInfo->state == CKS_RO_PUBLIC_SESSION) ||
- (pInfo->state == CKS_RW_PUBLIC_SESSION))) {
- CK_RV crv;
- CK_TOKEN_INFO tInfo;
- crv = NSC_GetTokenInfo(sftk_SlotIDFromSessionHandle(hSession),
- &tInfo);
- /* if the token doesn't login, use our global login state */
- if ((crv == CKR_OK) && ((tInfo.flags & CKF_LOGIN_REQUIRED) == 0)) {
- if (pInfo->state == CKS_RO_PUBLIC_SESSION) {
- pInfo->state = CKS_RO_USER_FUNCTIONS;
- } else {
- pInfo->state = CKS_RW_USER_FUNCTIONS;
- }
- }
+ if ((isLoggedIn) && (pInfo->state == CKS_RO_PUBLIC_SESSION)) {
+ pInfo->state = CKS_RO_USER_FUNCTIONS;
+ }
+ if ((isLoggedIn) && (pInfo->state == CKS_RW_PUBLIC_SESSION)) {
+ pInfo->state = CKS_RW_USER_FUNCTIONS;
}
}
return rv;
diff --git a/security/nss/lib/softoken/legacydb/keydb.c b/security/nss/lib/softoken/legacydb/keydb.c
index b4aa7754b6..178e333ec0 100644
--- a/security/nss/lib/softoken/legacydb/keydb.c
+++ b/security/nss/lib/softoken/legacydb/keydb.c
@@ -1137,10 +1137,12 @@ nsslowkey_KeyForCertExists(NSSLOWKEYDBHandle *handle, NSSLOWCERTCertificate *cer
namekey.data = pubkey->u.dh.publicValue.data;
namekey.size = pubkey->u.dh.publicValue.len;
break;
+#ifndef NSS_DISABLE_ECC
case NSSLOWKEYECKey:
namekey.data = pubkey->u.ec.publicValue.data;
namekey.size = pubkey->u.ec.publicValue.len;
break;
+#endif /* NSS_DISABLE_ECC */
default:
/* XXX We don't do Fortezza or DH yet. */
return PR_FALSE;
@@ -1465,10 +1467,12 @@ seckey_encrypt_private_key(PLArenaPool *permarena, NSSLOWKEYPrivateKey *pk,
SECItem *der_item = NULL;
SECItem *cipherText = NULL;
SECItem *dummy = NULL;
+#ifndef NSS_DISABLE_ECC
#ifdef EC_DEBUG
SECItem *fordebug = NULL;
#endif
int savelen;
+#endif
temparena = PORT_NewArena(SEC_ASN1_DEFAULT_ARENA_SIZE);
if (temparena == NULL)
@@ -1544,6 +1548,7 @@ seckey_encrypt_private_key(PLArenaPool *permarena, NSSLOWKEYPrivateKey *pk,
goto loser;
}
break;
+#ifndef NSS_DISABLE_ECC
case NSSLOWKEYECKey:
lg_prepare_low_ec_priv_key_for_asn1(pk);
/* Public value is encoded as a bit string so adjust length
@@ -1584,6 +1589,7 @@ seckey_encrypt_private_key(PLArenaPool *permarena, NSSLOWKEYPrivateKey *pk,
#endif
break;
+#endif /* NSS_DISABLE_ECC */
default:
/* We don't support DH or Fortezza private keys yet */
PORT_Assert(PR_FALSE);
@@ -1803,6 +1809,7 @@ seckey_decrypt_private_key(SECItem *epki,
lg_nsslowkey_DHPrivateKeyTemplate,
&newPrivateKey);
break;
+#ifndef NSS_DISABLE_ECC
case SEC_OID_ANSIX962_EC_PUBLIC_KEY:
pk->keyType = NSSLOWKEYECKey;
lg_prepare_low_ec_priv_key_for_asn1(pk);
@@ -1842,6 +1849,7 @@ seckey_decrypt_private_key(SECItem *epki,
}
break;
+#endif /* NSS_DISABLE_ECC */
default:
rv = SECFailure;
break;
diff --git a/security/nss/lib/softoken/legacydb/lgattr.c b/security/nss/lib/softoken/legacydb/lgattr.c
index 542b0c968c..5c2cbdbc63 100644
--- a/security/nss/lib/softoken/legacydb/lgattr.c
+++ b/security/nss/lib/softoken/legacydb/lgattr.c
@@ -133,7 +133,7 @@ lg_CopyAttribute(CK_ATTRIBUTE *attr, CK_ATTRIBUTE_TYPE type,
attr->ulValueLen = (CK_ULONG)-1;
return CKR_BUFFER_TOO_SMALL;
}
- if (len > 0 && value != NULL) {
+ if (value != NULL) {
PORT_Memcpy(attr->pValue, value, len);
}
attr->ulValueLen = len;
@@ -421,9 +421,11 @@ lg_GetPubItem(NSSLOWKEYPublicKey *pubKey)
case NSSLOWKEYDHKey:
pubItem = &pubKey->u.dh.publicValue;
break;
+#ifndef NSS_DISABLE_ECC
case NSSLOWKEYECKey:
pubItem = &pubKey->u.ec.publicValue;
break;
+#endif /* NSS_DISABLE_ECC */
default:
break;
}
@@ -542,6 +544,7 @@ lg_FindDHPublicKeyAttribute(NSSLOWKEYPublicKey *key, CK_ATTRIBUTE_TYPE type,
return lg_invalidAttribute(attribute);
}
+#ifndef NSS_DISABLE_ECC
static CK_RV
lg_FindECPublicKeyAttribute(NSSLOWKEYPublicKey *key, CK_ATTRIBUTE_TYPE type,
CK_ATTRIBUTE *attribute)
@@ -591,6 +594,7 @@ lg_FindECPublicKeyAttribute(NSSLOWKEYPublicKey *key, CK_ATTRIBUTE_TYPE type,
}
return lg_invalidAttribute(attribute);
}
+#endif /* NSS_DISABLE_ECC */
static CK_RV
lg_FindPublicKeyAttribute(LGObjectCache *obj, CK_ATTRIBUTE_TYPE type,
@@ -641,8 +645,10 @@ lg_FindPublicKeyAttribute(LGObjectCache *obj, CK_ATTRIBUTE_TYPE type,
return lg_FindDSAPublicKeyAttribute(key, type, attribute);
case NSSLOWKEYDHKey:
return lg_FindDHPublicKeyAttribute(key, type, attribute);
+#ifndef NSS_DISABLE_ECC
case NSSLOWKEYECKey:
return lg_FindECPublicKeyAttribute(key, type, attribute);
+#endif /* NSS_DISABLE_ECC */
default:
break;
}
@@ -929,6 +935,7 @@ lg_FindDHPrivateKeyAttribute(NSSLOWKEYPrivateKey *key, CK_ATTRIBUTE_TYPE type,
return lg_invalidAttribute(attribute);
}
+#ifndef NSS_DISABLE_ECC
static CK_RV
lg_FindECPrivateKeyAttribute(NSSLOWKEYPrivateKey *key, CK_ATTRIBUTE_TYPE type,
CK_ATTRIBUTE *attribute, SDB *sdbpw)
@@ -966,6 +973,7 @@ lg_FindECPrivateKeyAttribute(NSSLOWKEYPrivateKey *key, CK_ATTRIBUTE_TYPE type,
}
return lg_invalidAttribute(attribute);
}
+#endif /* NSS_DISABLE_ECC */
static CK_RV
lg_FindPrivateKeyAttribute(LGObjectCache *obj, CK_ATTRIBUTE_TYPE type,
@@ -1012,8 +1020,10 @@ lg_FindPrivateKeyAttribute(LGObjectCache *obj, CK_ATTRIBUTE_TYPE type,
return lg_FindDSAPrivateKeyAttribute(key, type, attribute, obj->sdb);
case NSSLOWKEYDHKey:
return lg_FindDHPrivateKeyAttribute(key, type, attribute, obj->sdb);
+#ifndef NSS_DISABLE_ECC
case NSSLOWKEYECKey:
return lg_FindECPrivateKeyAttribute(key, type, attribute, obj->sdb);
+#endif /* NSS_DISABLE_ECC */
default:
break;
}
diff --git a/security/nss/lib/softoken/legacydb/lgcreate.c b/security/nss/lib/softoken/legacydb/lgcreate.c
index f2b2aa6343..a0d2b2e57b 100644
--- a/security/nss/lib/softoken/legacydb/lgcreate.c
+++ b/security/nss/lib/softoken/legacydb/lgcreate.c
@@ -398,17 +398,21 @@ lg_createPublicKeyObject(SDB *sdb, CK_KEY_TYPE key_type,
NSSLOWKEYPrivateKey *priv;
SECItem pubKeySpace = { siBuffer, NULL, 0 };
SECItem *pubKey;
+#ifndef NSS_DISABLE_ECC
SECItem pubKey2Space = { siBuffer, NULL, 0 };
PLArenaPool *arena = NULL;
+#endif /* NSS_DISABLE_ECC */
NSSLOWKEYDBHandle *keyHandle = NULL;
switch (key_type) {
case CKK_RSA:
pubKeyAttr = CKA_MODULUS;
break;
+#ifndef NSS_DISABLE_ECC
case CKK_EC:
pubKeyAttr = CKA_EC_POINT;
break;
+#endif /* NSS_DISABLE_ECC */
case CKK_DSA:
case CKK_DH:
break;
@@ -421,6 +425,7 @@ lg_createPublicKeyObject(SDB *sdb, CK_KEY_TYPE key_type,
if (crv != CKR_OK)
return crv;
+#ifndef NSS_DISABLE_ECC
if (key_type == CKK_EC) {
SECStatus rv;
/*
@@ -443,6 +448,7 @@ lg_createPublicKeyObject(SDB *sdb, CK_KEY_TYPE key_type,
pubKey = &pubKey2Space;
}
}
+#endif /* NSS_DISABLE_ECC */
PORT_Assert(pubKey->data);
if (pubKey->data == NULL) {
@@ -463,12 +469,14 @@ lg_createPublicKeyObject(SDB *sdb, CK_KEY_TYPE key_type,
/* make sure the associated private key already exists */
/* only works if we are logged in */
priv = nsslowkey_FindKeyByPublicKey(keyHandle, pubKey, sdb /*password*/);
+#ifndef NSS_DISABLE_ECC
if (priv == NULL && pubKey == &pubKey2Space) {
/* no match on the decoded key, match the original pubkey */
pubKey = &pubKeySpace;
priv = nsslowkey_FindKeyByPublicKey(keyHandle, pubKey,
sdb /*password*/);
}
+#endif
if (priv == NULL) {
/* the legacy database can only 'store' public keys which already
* have their corresponding private keys in the database */
@@ -482,9 +490,10 @@ lg_createPublicKeyObject(SDB *sdb, CK_KEY_TYPE key_type,
done:
PORT_Free(pubKeySpace.data);
- if (arena) {
+#ifndef NSS_DISABLE_ECC
+ if (arena)
PORT_FreeArena(arena, PR_FALSE);
- }
+#endif
return crv;
}
@@ -604,6 +613,7 @@ lg_mkPrivKey(SDB *sdb, const CK_ATTRIBUTE *templ, CK_ULONG count,
}
break;
+#ifndef NSS_DISABLE_ECC
case CKK_EC:
privKey->keyType = NSSLOWKEYECKey;
crv = lg_Attribute2SSecItem(arena, CKA_EC_PARAMS, templ, count,
@@ -636,6 +646,7 @@ lg_mkPrivKey(SDB *sdb, const CK_ATTRIBUTE *templ, CK_ULONG count,
if (rv != SECSuccess)
crv = CKR_HOST_MEMORY;
break;
+#endif /* NSS_DISABLE_ECC */
default:
crv = CKR_KEY_TYPE_INCONSISTENT;
diff --git a/security/nss/lib/softoken/legacydb/lgfips.c b/security/nss/lib/softoken/legacydb/lgfips.c
index b991dcf8e5..b017424db4 100644
--- a/security/nss/lib/softoken/legacydb/lgfips.c
+++ b/security/nss/lib/softoken/legacydb/lgfips.c
@@ -6,8 +6,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
/* $Id: fipstest.c,v 1.31 2012/06/28 17:55:06 rrelyea%redhat.com Exp $ */
-#ifndef NSS_FIPS_DISABLED
-
#include "seccomon.h"
#include "lgdb.h"
#include "blapi.h"
@@ -115,5 +113,3 @@ lg_FIPSEntryOK()
#endif
return lg_self_tests_success;
}
-
-#endif /* NSS_FIPS_DISABLED */
diff --git a/security/nss/lib/softoken/legacydb/lginit.c b/security/nss/lib/softoken/legacydb/lginit.c
index 4f0b53f521..6913eea507 100644
--- a/security/nss/lib/softoken/legacydb/lginit.c
+++ b/security/nss/lib/softoken/legacydb/lginit.c
@@ -586,15 +586,11 @@ legacy_Open(const char *configdir, const char *certPrefix,
#define NSS_VERSION_VARIABLE __nss_dbm_version
#include "verref.h"
-#ifndef NSS_FIPS_DISABLED
if (flags & SDB_FIPS) {
- /* We shouldn't get here when FIPS is not enabled on the database. But
- * we also don't care when this NSS build doesn't support FIPS. */
if (!lg_FIPSEntryOK()) {
return CKR_DEVICE_ERROR;
}
}
-#endif
rv = SECOID_Init();
if (SECSuccess != rv) {
diff --git a/security/nss/lib/softoken/legacydb/lowcert.c b/security/nss/lib/softoken/legacydb/lowcert.c
index 5a349f0aad..2906120ee9 100644
--- a/security/nss/lib/softoken/legacydb/lowcert.c
+++ b/security/nss/lib/softoken/legacydb/lowcert.c
@@ -823,6 +823,7 @@ nsslowcert_ExtractPublicKey(NSSLOWCERTCertificate *cert)
if (rv == SECSuccess)
return pubk;
break;
+#ifndef NSS_DISABLE_ECC
case SEC_OID_ANSIX962_EC_PUBLIC_KEY:
pubk->keyType = NSSLOWKEYECKey;
/* Since PKCS#11 directly takes the DER encoding of EC params
@@ -844,6 +845,7 @@ nsslowcert_ExtractPublicKey(NSSLOWCERTCertificate *cert)
if (rv == SECSuccess)
return pubk;
break;
+#endif /* NSS_DISABLE_ECC */
default:
rv = SECFailure;
break;
diff --git a/security/nss/lib/softoken/legacydb/lowkey.c b/security/nss/lib/softoken/legacydb/lowkey.c
index a9b7cce3d4..7de4197a14 100644
--- a/security/nss/lib/softoken/legacydb/lowkey.c
+++ b/security/nss/lib/softoken/legacydb/lowkey.c
@@ -99,6 +99,8 @@ const SEC_ASN1Template lg_nsslowkey_DHPrivateKeyTemplate[] = {
{ 0 }
};
+#ifndef NSS_DISABLE_ECC
+
/* NOTE: The SECG specification allows the private key structure
* to contain curve parameters but recommends that they be stored
* in the PrivateKeyAlgorithmIdentifier field of the PrivateKeyInfo
@@ -191,6 +193,7 @@ LGEC_CopyParams(PLArenaPool *arena, ECParams *dstParams,
loser:
return SECFailure;
}
+#endif /* NSS_DISABLE_ECC */
/*
* See bugzilla bug 125359
* Since NSS (via PKCS#11) wants to handle big integers as unsigned ints,
@@ -240,6 +243,7 @@ lg_prepare_low_dh_priv_key_for_asn1(NSSLOWKEYPrivateKey *key)
key->u.dh.privateValue.type = siUnsignedInteger;
}
+#ifndef NSS_DISABLE_ECC
void
lg_prepare_low_ecparams_for_asn1(ECParams *params)
{
@@ -256,6 +260,7 @@ lg_prepare_low_ec_priv_key_for_asn1(NSSLOWKEYPrivateKey *key)
key->u.ec.privateValue.type = siUnsignedInteger;
key->u.ec.publicValue.type = siUnsignedInteger;
}
+#endif /* NSS_DISABLE_ECC */
void
lg_nsslowkey_DestroyPrivateKey(NSSLOWKEYPrivateKey *privk)
@@ -357,6 +362,7 @@ lg_nsslowkey_ConvertToPublicKey(NSSLOWKEYPrivateKey *privk)
return pubk;
}
break;
+#ifndef NSS_DISABLE_ECC
case NSSLOWKEYECKey:
pubk = (NSSLOWKEYPublicKey *)PORT_ArenaZAlloc(arena,
sizeof(NSSLOWKEYPublicKey));
@@ -377,6 +383,7 @@ lg_nsslowkey_ConvertToPublicKey(NSSLOWKEYPrivateKey *privk)
return pubk;
}
break;
+#endif /* NSS_DISABLE_ECC */
/* No Fortezza in Low Key implementations (Fortezza keys aren't
* stored in our data base */
default:
diff --git a/security/nss/lib/softoken/legacydb/lowkeyi.h b/security/nss/lib/softoken/legacydb/lowkeyi.h
index 4a5bcfa914..5136b56a5f 100644
--- a/security/nss/lib/softoken/legacydb/lowkeyi.h
+++ b/security/nss/lib/softoken/legacydb/lowkeyi.h
@@ -26,8 +26,10 @@ extern void lg_prepare_low_rsa_priv_key_for_asn1(NSSLOWKEYPrivateKey *key);
extern void lg_prepare_low_pqg_params_for_asn1(PQGParams *params);
extern void lg_prepare_low_dsa_priv_key_for_asn1(NSSLOWKEYPrivateKey *key);
extern void lg_prepare_low_dh_priv_key_for_asn1(NSSLOWKEYPrivateKey *key);
+#ifndef NSS_DISABLE_ECC
extern void lg_prepare_low_ec_priv_key_for_asn1(NSSLOWKEYPrivateKey *key);
extern void lg_prepare_low_ecparams_for_asn1(ECParams *params);
+#endif /* NSS_DISABLE_ECC */
typedef char *(*NSSLOWKEYDBNameFunc)(void *arg, int dbVersion);
@@ -132,6 +134,7 @@ extern char *
nsslowkey_FindKeyNicknameByPublicKey(NSSLOWKEYDBHandle *handle,
SECItem *modulus, SDB *sdb);
+#ifndef NSS_DISABLE_ECC
/*
* smaller version of EC_FillParams. In this code, we only need
* oid and DER data.
@@ -142,7 +145,7 @@ SECStatus LGEC_FillParams(PLArenaPool *arena, const SECItem *encodedParams,
/* Copy all of the fields from srcParams into dstParams */
SECStatus LGEC_CopyParams(PLArenaPool *arena, ECParams *dstParams,
const ECParams *srcParams);
-
+#endif
SEC_END_PROTOS
#endif /* _LOWKEYI_H_ */
diff --git a/security/nss/lib/softoken/legacydb/lowkeyti.h b/security/nss/lib/softoken/legacydb/lowkeyti.h
index 2fd5d4e293..ef92689e0a 100644
--- a/security/nss/lib/softoken/legacydb/lowkeyti.h
+++ b/security/nss/lib/softoken/legacydb/lowkeyti.h
@@ -42,8 +42,10 @@ extern const SEC_ASN1Template lg_nsslowkey_RSAPrivateKeyTemplate2[];
extern const SEC_ASN1Template lg_nsslowkey_DSAPrivateKeyTemplate[];
extern const SEC_ASN1Template lg_nsslowkey_DHPrivateKeyTemplate[];
extern const SEC_ASN1Template lg_nsslowkey_DHPrivateKeyExportTemplate[];
+#ifndef NSS_DISABLE_ECC
#define NSSLOWKEY_EC_PRIVATE_KEY_VERSION 1 /* as per SECG 1 C.4 */
extern const SEC_ASN1Template lg_nsslowkey_ECPrivateKeyTemplate[];
+#endif /* NSS_DISABLE_ECC */
extern const SEC_ASN1Template lg_nsslowkey_PrivateKeyInfoTemplate[];
extern const SEC_ASN1Template nsslowkey_EncryptedPrivateKeyInfoTemplate[];
diff --git a/security/nss/lib/softoken/legacydb/pcertdb.c b/security/nss/lib/softoken/legacydb/pcertdb.c
index 2e8b650ee9..f1444bf048 100644
--- a/security/nss/lib/softoken/legacydb/pcertdb.c
+++ b/security/nss/lib/softoken/legacydb/pcertdb.c
@@ -1854,8 +1854,6 @@ DecodeDBSMimeEntry(certDBEntrySMime *entry, SECItem *dbentry, char *emailAddr)
&dbentry->data[DB_SMIME_ENTRY_HEADER_LEN +
entry->subjectName.len],
entry->smimeOptions.len);
- } else {
- entry->smimeOptions.data = NULL;
}
if (entry->optionsDate.len) {
entry->optionsDate.data =
@@ -1870,8 +1868,6 @@ DecodeDBSMimeEntry(certDBEntrySMime *entry, SECItem *dbentry, char *emailAddr)
entry->subjectName.len +
entry->smimeOptions.len],
entry->optionsDate.len);
- } else {
- entry->optionsDate.data = NULL;
}
/* both options and options date must either exist or not exist */
@@ -2018,7 +2014,7 @@ nsslowcert_ReadDBSMimeEntry(NSSLOWCERTCertDBHandle *handle, char *emailAddr)
{
PLArenaPool *arena = NULL;
PLArenaPool *tmparena = NULL;
- certDBEntrySMime *entry = NULL;
+ certDBEntrySMime *entry;
SECItem dbkey;
SECItem dbentry;
SECStatus rv;
@@ -2035,8 +2031,8 @@ nsslowcert_ReadDBSMimeEntry(NSSLOWCERTCertDBHandle *handle, char *emailAddr)
goto loser;
}
- entry = (certDBEntrySMime *)PORT_ArenaZAlloc(arena,
- sizeof(certDBEntrySMime));
+ entry = (certDBEntrySMime *)PORT_ArenaAlloc(arena,
+ sizeof(certDBEntrySMime));
if (entry == NULL) {
PORT_SetError(SEC_ERROR_NO_MEMORY);
goto loser;
diff --git a/security/nss/lib/softoken/lowkey.c b/security/nss/lib/softoken/lowkey.c
index 295d55f40b..73b1dc9714 100644
--- a/security/nss/lib/softoken/lowkey.c
+++ b/security/nss/lib/softoken/lowkey.c
@@ -8,7 +8,10 @@
#include "base64.h"
#include "secasn1.h"
#include "secerr.h"
+
+#ifndef NSS_DISABLE_ECC
#include "softoken.h"
+#endif
SEC_ASN1_MKSUB(SEC_AnyTemplate)
SEC_ASN1_MKSUB(SEC_BitStringTemplate)
@@ -87,6 +90,8 @@ const SEC_ASN1Template nsslowkey_DHPrivateKeyTemplate[] = {
{ 0 }
};
+#ifndef NSS_DISABLE_ECC
+
/* NOTE: The SECG specification allows the private key structure
* to contain curve parameters but recommends that they be stored
* in the PrivateKeyAlgorithmIdentifier field of the PrivateKeyInfo
@@ -112,6 +117,7 @@ const SEC_ASN1Template nsslowkey_ECPrivateKeyTemplate[] = {
SEC_ASN1_SUB(SEC_BitStringTemplate) },
{ 0 }
};
+#endif /* NSS_DISABLE_ECC */
/*
* See bugzilla bug 125359
* Since NSS (via PKCS#11) wants to handle big integers as unsigned ints,
@@ -167,6 +173,7 @@ prepare_low_dh_priv_key_for_asn1(NSSLOWKEYPrivateKey *key)
key->u.dh.privateValue.type = siUnsignedInteger;
}
+#ifndef NSS_DISABLE_ECC
void
prepare_low_ecparams_for_asn1(ECParams *params)
{
@@ -183,6 +190,7 @@ prepare_low_ec_priv_key_for_asn1(NSSLOWKEYPrivateKey *key)
key->u.ec.privateValue.type = siUnsignedInteger;
key->u.ec.publicValue.type = siUnsignedInteger;
}
+#endif /* NSS_DISABLE_ECC */
void
nsslowkey_DestroyPrivateKey(NSSLOWKEYPrivateKey *privk)
@@ -317,6 +325,7 @@ nsslowkey_ConvertToPublicKey(NSSLOWKEYPrivateKey *privk)
return pubk;
}
break;
+#ifndef NSS_DISABLE_ECC
case NSSLOWKEYECKey:
pubk = (NSSLOWKEYPublicKey *)PORT_ArenaZAlloc(arena,
sizeof(NSSLOWKEYPublicKey));
@@ -337,6 +346,7 @@ nsslowkey_ConvertToPublicKey(NSSLOWKEYPrivateKey *privk)
return pubk;
}
break;
+#endif /* NSS_DISABLE_ECC */
/* No Fortezza in Low Key implementations (Fortezza keys aren't
* stored in our data base */
default:
@@ -453,6 +463,7 @@ nsslowkey_CopyPrivateKey(NSSLOWKEYPrivateKey *privKey)
if (rv != SECSuccess)
break;
break;
+#ifndef NSS_DISABLE_ECC
case NSSLOWKEYECKey:
rv = SECITEM_CopyItem(poolp, &(returnKey->u.ec.version),
&(privKey->u.ec.version));
@@ -473,6 +484,7 @@ nsslowkey_CopyPrivateKey(NSSLOWKEYPrivateKey *privKey)
if (rv != SECSuccess)
break;
break;
+#endif /* NSS_DISABLE_ECC */
default:
rv = SECFailure;
}
diff --git a/security/nss/lib/softoken/lowkeyi.h b/security/nss/lib/softoken/lowkeyi.h
index f9ba3a75f3..a5878c2f6c 100644
--- a/security/nss/lib/softoken/lowkeyi.h
+++ b/security/nss/lib/softoken/lowkeyi.h
@@ -25,8 +25,10 @@ extern void prepare_low_pqg_params_for_asn1(PQGParams *params);
extern void prepare_low_dsa_priv_key_for_asn1(NSSLOWKEYPrivateKey *key);
extern void prepare_low_dsa_priv_key_export_for_asn1(NSSLOWKEYPrivateKey *key);
extern void prepare_low_dh_priv_key_for_asn1(NSSLOWKEYPrivateKey *key);
+#ifndef NSS_DISABLE_ECC
extern void prepare_low_ec_priv_key_for_asn1(NSSLOWKEYPrivateKey *key);
extern void prepare_low_ecparams_for_asn1(ECParams *params);
+#endif /* NSS_DISABLE_ECC */
/*
** Destroy a private key object.
diff --git a/security/nss/lib/softoken/lowkeyti.h b/security/nss/lib/softoken/lowkeyti.h
index c048b33e74..2ef16405f8 100644
--- a/security/nss/lib/softoken/lowkeyti.h
+++ b/security/nss/lib/softoken/lowkeyti.h
@@ -20,8 +20,10 @@ extern const SEC_ASN1Template nsslowkey_DSAPrivateKeyTemplate[];
extern const SEC_ASN1Template nsslowkey_DSAPrivateKeyExportTemplate[];
extern const SEC_ASN1Template nsslowkey_DHPrivateKeyTemplate[];
extern const SEC_ASN1Template nsslowkey_DHPrivateKeyExportTemplate[];
+#ifndef NSS_DISABLE_ECC
#define NSSLOWKEY_EC_PRIVATE_KEY_VERSION 1 /* as per SECG 1 C.4 */
extern const SEC_ASN1Template nsslowkey_ECPrivateKeyTemplate[];
+#endif /* NSS_DISABLE_ECC */
extern const SEC_ASN1Template nsslowkey_PrivateKeyInfoTemplate[];
extern const SEC_ASN1Template nsslowkey_EncryptedPrivateKeyInfoTemplate[];
diff --git a/security/nss/lib/softoken/pkcs11.c b/security/nss/lib/softoken/pkcs11.c
index 77882a274e..a594fd501b 100644
--- a/security/nss/lib/softoken/pkcs11.c
+++ b/security/nss/lib/softoken/pkcs11.c
@@ -282,11 +282,13 @@ static const struct mechanismList mechanisms[] = {
/* no diffie hellman yet */
{ CKM_DH_PKCS_KEY_PAIR_GEN, { DH_MIN_P_BITS, DH_MAX_P_BITS, CKF_GENERATE_KEY_PAIR }, PR_TRUE },
{ CKM_DH_PKCS_DERIVE, { DH_MIN_P_BITS, DH_MAX_P_BITS, CKF_DERIVE }, PR_TRUE },
+#ifndef NSS_DISABLE_ECC
/* -------------------- Elliptic Curve Operations --------------------- */
{ CKM_EC_KEY_PAIR_GEN, { EC_MIN_KEY_BITS, EC_MAX_KEY_BITS, CKF_GENERATE_KEY_PAIR | CKF_EC_BPNU }, PR_TRUE },
{ CKM_ECDH1_DERIVE, { EC_MIN_KEY_BITS, EC_MAX_KEY_BITS, CKF_DERIVE | CKF_EC_BPNU }, PR_TRUE },
{ CKM_ECDSA, { EC_MIN_KEY_BITS, EC_MAX_KEY_BITS, CKF_SN_VR | CKF_EC_BPNU }, PR_TRUE },
{ CKM_ECDSA_SHA1, { EC_MIN_KEY_BITS, EC_MAX_KEY_BITS, CKF_SN_VR | CKF_EC_BPNU }, PR_TRUE },
+#endif /* NSS_DISABLE_ECC */
/* ------------------------- RC2 Operations --------------------------- */
{ CKM_RC2_KEY_GEN, { 1, 128, CKF_GENERATE }, PR_TRUE },
{ CKM_RC2_ECB, { 1, 128, CKF_EN_DE_WR_UN }, PR_TRUE },
@@ -421,20 +423,11 @@ static const struct mechanismList mechanisms[] = {
#endif
/* --------------------- Secret Key Operations ------------------------ */
{ CKM_GENERIC_SECRET_KEY_GEN, { 1, 32, CKF_GENERATE }, PR_TRUE },
- { CKM_CONCATENATE_BASE_AND_KEY, { 1, 32, CKF_DERIVE }, PR_FALSE },
- { CKM_CONCATENATE_BASE_AND_DATA, { 1, 32, CKF_DERIVE }, PR_FALSE },
- { CKM_CONCATENATE_DATA_AND_BASE, { 1, 32, CKF_DERIVE }, PR_FALSE },
- { CKM_XOR_BASE_AND_DATA, { 1, 32, CKF_DERIVE }, PR_FALSE },
+ { CKM_CONCATENATE_BASE_AND_KEY, { 1, 32, CKF_GENERATE }, PR_FALSE },
+ { CKM_CONCATENATE_BASE_AND_DATA, { 1, 32, CKF_GENERATE }, PR_FALSE },
+ { CKM_CONCATENATE_DATA_AND_BASE, { 1, 32, CKF_GENERATE }, PR_FALSE },
+ { CKM_XOR_BASE_AND_DATA, { 1, 32, CKF_GENERATE }, PR_FALSE },
{ CKM_EXTRACT_KEY_FROM_KEY, { 1, 32, CKF_DERIVE }, PR_FALSE },
- { CKM_DES3_ECB_ENCRYPT_DATA, { 1, 32, CKF_DERIVE }, PR_FALSE },
- { CKM_DES3_CBC_ENCRYPT_DATA, { 1, 32, CKF_DERIVE }, PR_FALSE },
- { CKM_AES_ECB_ENCRYPT_DATA, { 1, 32, CKF_DERIVE }, PR_FALSE },
- { CKM_AES_CBC_ENCRYPT_DATA, { 1, 32, CKF_DERIVE }, PR_FALSE },
- { CKM_CAMELLIA_ECB_ENCRYPT_DATA, { 1, 32, CKF_DERIVE }, PR_FALSE },
- { CKM_CAMELLIA_CBC_ENCRYPT_DATA, { 1, 32, CKF_DERIVE }, PR_FALSE },
- { CKM_SEED_ECB_ENCRYPT_DATA, { 1, 32, CKF_DERIVE }, PR_FALSE },
- { CKM_SEED_CBC_ENCRYPT_DATA, { 1, 32, CKF_DERIVE }, PR_FALSE },
-
/* ---------------------- SSL Key Derivations ------------------------- */
{ CKM_SSL3_PRE_MASTER_KEY_GEN, { 48, 48, CKF_GENERATE }, PR_FALSE },
{ CKM_SSL3_MASTER_KEY_DERIVE, { 48, 48, CKF_DERIVE }, PR_FALSE },
@@ -938,6 +931,7 @@ sftk_handlePublicKeyObject(SFTKSession *session, SFTKObject *object,
recover = CK_FALSE;
wrap = CK_FALSE;
break;
+#ifndef NSS_DISABLE_ECC
case CKK_EC:
if (!sftk_hasAttribute(object, CKA_EC_PARAMS)) {
return CKR_TEMPLATE_INCOMPLETE;
@@ -951,6 +945,7 @@ sftk_handlePublicKeyObject(SFTKSession *session, SFTKObject *object,
recover = CK_FALSE;
wrap = CK_FALSE;
break;
+#endif /* NSS_DISABLE_ECC */
default:
return CKR_ATTRIBUTE_VALUE_INVALID;
}
@@ -1119,6 +1114,7 @@ sftk_handlePrivateKeyObject(SFTKSession *session, SFTKObject *object, CK_KEY_TYP
recover = CK_FALSE;
wrap = CK_FALSE;
break;
+#ifndef NSS_DISABLE_ECC
case CKK_EC:
if (!sftk_hasAttribute(object, CKA_EC_PARAMS)) {
return CKR_TEMPLATE_INCOMPLETE;
@@ -1131,6 +1127,7 @@ sftk_handlePrivateKeyObject(SFTKSession *session, SFTKObject *object, CK_KEY_TYP
recover = CK_FALSE;
wrap = CK_FALSE;
break;
+#endif /* NSS_DISABLE_ECC */
case CKK_NSS_JPAKE_ROUND1:
if (!sftk_hasAttribute(object, CKA_PRIME) ||
!sftk_hasAttribute(object, CKA_SUBPRIME) ||
@@ -1781,6 +1778,7 @@ sftk_GetPubKey(SFTKObject *object, CK_KEY_TYPE key_type,
crv = sftk_Attribute2SSecItem(arena, &pubKey->u.dh.publicValue,
object, CKA_VALUE);
break;
+#ifndef NSS_DISABLE_ECC
case CKK_EC:
pubKey->keyType = NSSLOWKEYECKey;
crv = sftk_Attribute2SSecItem(arena,
@@ -1839,6 +1837,7 @@ sftk_GetPubKey(SFTKObject *object, CK_KEY_TYPE key_type,
crv = CKR_ATTRIBUTE_VALUE_INVALID;
}
break;
+#endif /* NSS_DISABLE_ECC */
default:
crv = CKR_KEY_TYPE_INCONSISTENT;
break;
@@ -1948,6 +1947,7 @@ sftk_mkPrivKey(SFTKObject *object, CK_KEY_TYPE key_type, CK_RV *crvp)
* if we don't set it explicitly */
break;
+#ifndef NSS_DISABLE_ECC
case CKK_EC:
privKey->keyType = NSSLOWKEYECKey;
crv = sftk_Attribute2SSecItem(arena,
@@ -1992,6 +1992,7 @@ sftk_mkPrivKey(SFTKObject *object, CK_KEY_TYPE key_type, CK_RV *crvp)
#endif
}
break;
+#endif /* NSS_DISABLE_ECC */
default:
crv = CKR_KEY_TYPE_INCONSISTENT;
@@ -2364,22 +2365,17 @@ sftk_SlotFromID(CK_SLOT_ID slotID, PRBool all)
return slot;
}
-CK_SLOT_ID
-sftk_SlotIDFromSessionHandle(CK_SESSION_HANDLE handle)
+SFTKSlot *
+sftk_SlotFromSessionHandle(CK_SESSION_HANDLE handle)
{
CK_ULONG slotIDIndex = (handle >> 24) & 0x7f;
CK_ULONG moduleIndex = (handle >> 31) & 1;
if (slotIDIndex >= nscSlotCount[moduleIndex]) {
- return (CK_SLOT_ID)-1;
+ return NULL;
}
- return nscSlotList[moduleIndex][slotIDIndex];
-}
-SFTKSlot *
-sftk_SlotFromSessionHandle(CK_SESSION_HANDLE handle)
-{
- return sftk_SlotFromID(sftk_SlotIDFromSessionHandle(handle), PR_FALSE);
+ return sftk_SlotFromID(nscSlotList[moduleIndex][slotIDIndex], PR_FALSE);
}
static CK_RV
@@ -3309,15 +3305,6 @@ NSC_GetSlotInfo(CK_SLOT_ID slotID, CK_SLOT_INFO_PTR pInfo)
}
}
- /* If there is no key database, this is for example the case when NSS was
- * initialized with NSS_NoDbInit(), then there won't be any point in
- * requesting a PIN. Set the CKF_USER_PIN_INITIALIZED bit so that
- * PK11_NeedUserInit() doesn't indicate that a PIN is needed.
- */
- if (slot->keyDB == NULL) {
- pInfo->flags |= CKF_USER_PIN_INITIALIZED;
- }
-
/* ok we really should read it out of the keydb file. */
/* pInfo->hardwareVersion.major = NSSLOWKEY_DB_FILE_VERSION; */
pInfo->hardwareVersion.major = SOFTOKEN_VMAJOR;
@@ -3579,6 +3566,7 @@ NSC_InitToken(CK_SLOT_ID slotID, CK_CHAR_PTR pPin,
{
SFTKSlot *slot = sftk_SlotFromID(slotID, PR_FALSE);
SFTKDBHandle *handle;
+ SFTKDBHandle *certHandle;
SECStatus rv;
unsigned int i;
SFTKObject *object;
@@ -3626,16 +3614,19 @@ NSC_InitToken(CK_SLOT_ID slotID, CK_CHAR_PTR pPin,
}
rv = sftkdb_ResetKeyDB(handle);
- /* clear the password */
- sftkdb_ClearPassword(handle);
- /* update slot->needLogin (should be true now since no password is set) */
- sftk_checkNeedLogin(slot, handle);
sftk_freeDB(handle);
if (rv != SECSuccess) {
return CKR_DEVICE_ERROR;
}
- return CKR_OK;
+ /* finally mark all the user certs as non-user certs */
+ certHandle = sftk_getCertDB(slot);
+ if (certHandle == NULL)
+ return CKR_OK;
+
+ sftk_freeDB(certHandle);
+
+ return CKR_OK; /*is this the right function for not implemented*/
}
/* NSC_InitPIN initializes the normal user's PIN. */
@@ -3801,10 +3792,7 @@ NSC_SetPIN(CK_SESSION_HANDLE hSession, CK_CHAR_PTR pOldPin,
/* Now update our local copy of the pin */
if (rv == SECSuccess) {
- PZ_Lock(slot->slotLock);
slot->needLogin = (PRBool)(ulNewLen != 0);
- slot->isLoggedIn = (PRBool)(sftkdb_PWCached(handle) == SECSuccess);
- PZ_Unlock(slot->slotLock);
/* Reset login flags. */
if (ulNewLen == 0) {
PRBool tokenRemoved = PR_FALSE;
diff --git a/security/nss/lib/softoken/pkcs11c.c b/security/nss/lib/softoken/pkcs11c.c
index d675d73315..0234aa4310 100644
--- a/security/nss/lib/softoken/pkcs11c.c
+++ b/security/nss/lib/softoken/pkcs11c.c
@@ -65,6 +65,7 @@ sftk_Null(void *data, PRBool freeit)
return;
}
+#ifndef NSS_DISABLE_ECC
#ifdef EC_DEBUG
#define SEC_PRINT(str1, str2, num, sitem) \
printf("pkcs11c.c:%s:%s (keytype=%d) [len=%d]\n", \
@@ -77,6 +78,7 @@ sftk_Null(void *data, PRBool freeit)
#undef EC_DEBUG
#define SEC_PRINT(a, b, c, d)
#endif
+#endif /* NSS_DISABLE_ECC */
/*
* free routines.... Free local type allocated data, and convert
@@ -122,6 +124,7 @@ sftk_MapCryptError(int error)
return CKR_KEY_SIZE_RANGE; /* the closest error code */
case SEC_ERROR_UNSUPPORTED_EC_POINT_FORM:
return CKR_TEMPLATE_INCONSISTENT;
+ /* EC functions set this error if NSS_DISABLE_ECC is defined */
case SEC_ERROR_UNSUPPORTED_KEYALG:
return CKR_MECHANISM_INVALID;
case SEC_ERROR_UNSUPPORTED_ELLIPTIC_CURVE:
@@ -1524,7 +1527,8 @@ NSC_DecryptUpdate(CK_SESSION_HANDLE hSession,
maxout -= padoutlen;
}
/* now save the final block for the next decrypt or the final */
- PORT_Memcpy(context->padBuf, &pEncryptedPart[ulEncryptedPartLen - context->blockSize],
+ PORT_Memcpy(context->padBuf, &pEncryptedPart[ulEncryptedPartLen -
+ context->blockSize],
context->blockSize);
context->padDataLength = context->blockSize;
ulEncryptedPartLen -= context->padDataLength;
@@ -2413,6 +2417,7 @@ nsc_DSA_Sign_Stub(void *ctx, void *sigBuf,
return rv;
}
+#ifndef NSS_DISABLE_ECC
static SECStatus
nsc_ECDSAVerifyStub(void *ctx, void *sigBuf, unsigned int sigLen,
void *dataBuf, unsigned int dataLen)
@@ -2447,6 +2452,7 @@ nsc_ECDSASignStub(void *ctx, void *sigBuf,
*sigLen = signature.len;
return rv;
}
+#endif /* NSS_DISABLE_ECC */
/* NSC_SignInit setups up the signing operations. There are three basic
* types of signing:
@@ -2606,6 +2612,7 @@ NSC_SignInit(CK_SESSION_HANDLE hSession,
break;
+#ifndef NSS_DISABLE_ECC
case CKM_ECDSA_SHA1:
context->multi = PR_TRUE;
crv = sftk_doSubSHA1(context);
@@ -2628,6 +2635,7 @@ NSC_SignInit(CK_SESSION_HANDLE hSession,
context->maxLen = MAX_ECKEY_LEN * 2;
break;
+#endif /* NSS_DISABLE_ECC */
#define INIT_HMAC_MECH(mmm) \
case CKM_##mmm##_HMAC_GENERAL: \
@@ -3295,6 +3303,7 @@ NSC_VerifyInit(CK_SESSION_HANDLE hSession,
context->verify = (SFTKVerify)nsc_DSA_Verify_Stub;
context->destroy = sftk_Null;
break;
+#ifndef NSS_DISABLE_ECC
case CKM_ECDSA_SHA1:
context->multi = PR_TRUE;
crv = sftk_doSubSHA1(context);
@@ -3315,6 +3324,7 @@ NSC_VerifyInit(CK_SESSION_HANDLE hSession,
context->verify = (SFTKVerify)nsc_ECDSAVerifyStub;
context->destroy = sftk_Null;
break;
+#endif /* NSS_DISABLE_ECC */
INIT_HMAC_MECH(MD2)
INIT_HMAC_MECH(MD5)
@@ -4614,10 +4624,12 @@ sftk_PairwiseConsistencyCheck(CK_SESSION_HANDLE hSession,
pairwise_digest_length = subPrimeLen;
mech.mechanism = CKM_DSA;
break;
+#ifndef NSS_DISABLE_ECC
case CKK_EC:
signature_length = MAX_ECKEY_LEN * 2;
mech.mechanism = CKM_ECDSA;
break;
+#endif
default:
return CKR_DEVICE_ERROR;
}
@@ -4734,10 +4746,12 @@ NSC_GenerateKeyPair(CK_SESSION_HANDLE hSession,
/* Diffie Hellman */
DHPrivateKey *dhPriv;
+#ifndef NSS_DISABLE_ECC
/* Elliptic Curve Cryptography */
SECItem ecEncodedParams; /* DER Encoded parameters */
ECPrivateKey *ecPriv;
ECParams *ecParams;
+#endif /* NSS_DISABLE_ECC */
CHECK_FORK();
@@ -5083,6 +5097,7 @@ NSC_GenerateKeyPair(CK_SESSION_HANDLE hSession,
PORT_FreeArena(dhPriv->arena, PR_TRUE);
break;
+#ifndef NSS_DISABLE_ECC
case CKM_EC_KEY_PAIR_GEN:
sftk_DeleteAttributeType(privateKey, CKA_EC_PARAMS);
sftk_DeleteAttributeType(privateKey, CKA_VALUE);
@@ -5151,6 +5166,7 @@ NSC_GenerateKeyPair(CK_SESSION_HANDLE hSession,
/* should zeroize, since this function doesn't. */
PORT_FreeArena(ecPriv->ecParams.arena, PR_TRUE);
break;
+#endif /* NSS_DISABLE_ECC */
default:
crv = CKR_MECHANISM_INVALID;
@@ -5280,10 +5296,12 @@ sftk_PackagePrivateKey(SFTKObject *key, CK_RV *crvp)
void *dummy, *param = NULL;
SECStatus rv = SECSuccess;
SECItem *encodedKey = NULL;
+#ifndef NSS_DISABLE_ECC
#ifdef EC_DEBUG
SECItem *fordebug;
#endif
int savelen;
+#endif
if (!key) {
*crvp = CKR_KEY_HANDLE_INVALID; /* really can't happen */
@@ -5335,6 +5353,7 @@ sftk_PackagePrivateKey(SFTKObject *key, CK_RV *crvp)
nsslowkey_PQGParamsTemplate);
algorithm = SEC_OID_ANSIX9_DSA_SIGNATURE;
break;
+#ifndef NSS_DISABLE_ECC
case NSSLOWKEYECKey:
prepare_low_ec_priv_key_for_asn1(lk);
/* Public value is encoded as a bit string so adjust length
@@ -5363,6 +5382,7 @@ sftk_PackagePrivateKey(SFTKObject *key, CK_RV *crvp)
algorithm = SEC_OID_ANSIX962_EC_PUBLIC_KEY;
break;
+#endif /* NSS_DISABLE_ECC */
case NSSLOWKEYDHKey:
default:
dummy = NULL;
@@ -5621,7 +5641,8 @@ sftk_unwrapPrivateKey(SFTKObject *key, SECItem *bpki)
prepare_low_dsa_priv_key_export_for_asn1(lpk);
prepare_low_pqg_params_for_asn1(&lpk->u.dsa.params);
break;
- /* case NSSLOWKEYDHKey: */
+/* case NSSLOWKEYDHKey: */
+#ifndef NSS_DISABLE_ECC
case SEC_OID_ANSIX962_EC_PUBLIC_KEY:
keyTemplate = nsslowkey_ECPrivateKeyTemplate;
paramTemplate = NULL;
@@ -5630,6 +5651,7 @@ sftk_unwrapPrivateKey(SFTKObject *key, SECItem *bpki)
prepare_low_ec_priv_key_for_asn1(lpk);
prepare_low_ecparams_for_asn1(&lpk->u.ec.ecParams);
break;
+#endif /* NSS_DISABLE_ECC */
default:
keyTemplate = NULL;
paramTemplate = NULL;
@@ -5644,6 +5666,7 @@ sftk_unwrapPrivateKey(SFTKObject *key, SECItem *bpki)
/* decode the private key and any algorithm parameters */
rv = SEC_QuickDERDecodeItem(arena, lpk, keyTemplate, &pki->privateKey);
+#ifndef NSS_DISABLE_ECC
if (lpk->keyType == NSSLOWKEYECKey) {
/* convert length in bits to length in bytes */
lpk->u.ec.publicValue.len >>= 3;
@@ -5654,6 +5677,7 @@ sftk_unwrapPrivateKey(SFTKObject *key, SECItem *bpki)
goto loser;
}
}
+#endif /* NSS_DISABLE_ECC */
if (rv != SECSuccess) {
goto loser;
@@ -5766,7 +5790,8 @@ sftk_unwrapPrivateKey(SFTKObject *key, SECItem *bpki)
keyType = CKK_DH;
break;
#endif
- /* what about fortezza??? */
+/* what about fortezza??? */
+#ifndef NSS_DISABLE_ECC
case NSSLOWKEYECKey:
keyType = CKK_EC;
crv = (sftk_hasAttribute(key, CKA_NETSCAPE_DB)) ? CKR_OK : CKR_KEY_TYPE_INCONSISTENT;
@@ -5798,6 +5823,7 @@ sftk_unwrapPrivateKey(SFTKObject *key, SECItem *bpki)
break;
/* XXX Do we need to decode the EC Params here ?? */
break;
+#endif /* NSS_DISABLE_ECC */
default:
crv = CKR_KEY_TYPE_INCONSISTENT;
break;
@@ -6127,6 +6153,7 @@ sftk_MapKeySize(CK_KEY_TYPE keyType)
return 0;
}
+#ifndef NSS_DISABLE_ECC
/* Inputs:
* key_len: Length of derived key to be generated.
* SharedSecret: a shared secret that is the output of a key agreement primitive.
@@ -6239,43 +6266,7 @@ sftk_ANSI_X9_63_kdf(CK_BYTE **key, CK_ULONG key_len,
else
return CKR_MECHANISM_INVALID;
}
-
-/*
- * Handle the derive from a block encryption cipher
- */
-CK_RV
-sftk_DeriveEncrypt(SFTKCipher encrypt, void *cipherInfo,
- int blockSize, SFTKObject *key, CK_ULONG keySize,
- unsigned char *data, CK_ULONG len)
-{
- /* large enough for a 512-bit key */
- unsigned char tmpdata[SFTK_MAX_DERIVE_KEY_SIZE];
- SECStatus rv;
- unsigned int outLen;
- CK_RV crv;
-
- if ((len % blockSize) != 0) {
- return CKR_MECHANISM_PARAM_INVALID;
- }
- if (len > SFTK_MAX_DERIVE_KEY_SIZE) {
- return CKR_MECHANISM_PARAM_INVALID;
- }
- if (keySize && (len < keySize)) {
- return CKR_MECHANISM_PARAM_INVALID;
- }
- if (keySize == 0) {
- keySize = len;
- }
-
- rv = (*encrypt)(cipherInfo, &tmpdata, &outLen, len, data, len);
- if (rv != SECSuccess) {
- crv = sftk_MapCryptError(PORT_GetError());
- return crv;
- }
-
- crv = sftk_forceAttribute(key, CKA_VALUE, tmpdata, keySize);
- return crv;
-}
+#endif /* NSS_DISABLE_ECC */
/*
* SSL Key generation given pre master secret
@@ -6935,172 +6926,6 @@ NSC_DeriveKey(CK_SESSION_HANDLE hSession,
break;
}
- case CKM_DES3_ECB_ENCRYPT_DATA:
- case CKM_DES3_CBC_ENCRYPT_DATA: {
- void *cipherInfo;
- unsigned char des3key[MAX_DES3_KEY_SIZE];
- CK_DES_CBC_ENCRYPT_DATA_PARAMS *desEncryptPtr;
- int mode;
- unsigned char *iv;
- unsigned char *data;
- CK_ULONG len;
-
- if (mechanism == CKM_DES3_ECB_ENCRYPT_DATA) {
- stringPtr = (CK_KEY_DERIVATION_STRING_DATA *)
- pMechanism->pParameter;
- mode = NSS_DES_EDE3;
- iv = NULL;
- data = stringPtr->pData;
- len = stringPtr->ulLen;
- } else {
- mode = NSS_DES_EDE3_CBC;
- desEncryptPtr =
- (CK_DES_CBC_ENCRYPT_DATA_PARAMS *)
- pMechanism->pParameter;
- iv = desEncryptPtr->iv;
- data = desEncryptPtr->pData;
- len = desEncryptPtr->length;
- }
- if (att->attrib.ulValueLen == 16) {
- PORT_Memcpy(des3key, att->attrib.pValue, 16);
- PORT_Memcpy(des3key + 16, des3key, 8);
- } else if (att->attrib.ulValueLen == 24) {
- PORT_Memcpy(des3key, att->attrib.pValue, 24);
- } else {
- crv = CKR_KEY_SIZE_RANGE;
- break;
- }
- cipherInfo = DES_CreateContext(des3key, iv, mode, PR_TRUE);
- PORT_Memset(des3key, 0, 24);
- if (cipherInfo == NULL) {
- crv = CKR_HOST_MEMORY;
- break;
- }
- crv = sftk_DeriveEncrypt((SFTKCipher)DES_Encrypt,
- cipherInfo, 8, key, keySize,
- data, len);
- DES_DestroyContext(cipherInfo, PR_TRUE);
- break;
- }
-
- case CKM_AES_ECB_ENCRYPT_DATA:
- case CKM_AES_CBC_ENCRYPT_DATA: {
- void *cipherInfo;
- CK_AES_CBC_ENCRYPT_DATA_PARAMS *aesEncryptPtr;
- int mode;
- unsigned char *iv;
- unsigned char *data;
- CK_ULONG len;
-
- if (mechanism == CKM_AES_ECB_ENCRYPT_DATA) {
- mode = NSS_AES;
- iv = NULL;
- stringPtr = (CK_KEY_DERIVATION_STRING_DATA *)pMechanism->pParameter;
- data = stringPtr->pData;
- len = stringPtr->ulLen;
- } else {
- aesEncryptPtr =
- (CK_AES_CBC_ENCRYPT_DATA_PARAMS *)pMechanism->pParameter;
- mode = NSS_AES_CBC;
- iv = aesEncryptPtr->iv;
- data = aesEncryptPtr->pData;
- len = aesEncryptPtr->length;
- }
-
- cipherInfo = AES_CreateContext((unsigned char *)att->attrib.pValue,
- iv, mode, PR_TRUE,
- att->attrib.ulValueLen, 16);
- if (cipherInfo == NULL) {
- crv = CKR_HOST_MEMORY;
- break;
- }
- crv = sftk_DeriveEncrypt((SFTKCipher)AES_Encrypt,
- cipherInfo, 16, key, keySize,
- data, len);
- AES_DestroyContext(cipherInfo, PR_TRUE);
- break;
- }
-
- case CKM_CAMELLIA_ECB_ENCRYPT_DATA:
- case CKM_CAMELLIA_CBC_ENCRYPT_DATA: {
- void *cipherInfo;
- CK_AES_CBC_ENCRYPT_DATA_PARAMS *aesEncryptPtr;
- int mode;
- unsigned char *iv;
- unsigned char *data;
- CK_ULONG len;
-
- if (mechanism == CKM_CAMELLIA_ECB_ENCRYPT_DATA) {
- stringPtr = (CK_KEY_DERIVATION_STRING_DATA *)
- pMechanism->pParameter;
- aesEncryptPtr = NULL;
- mode = NSS_CAMELLIA;
- data = stringPtr->pData;
- len = stringPtr->ulLen;
- iv = NULL;
- } else {
- stringPtr = NULL;
- aesEncryptPtr = (CK_AES_CBC_ENCRYPT_DATA_PARAMS *)
- pMechanism->pParameter;
- mode = NSS_CAMELLIA_CBC;
- iv = aesEncryptPtr->iv;
- data = aesEncryptPtr->pData;
- len = aesEncryptPtr->length;
- }
-
- cipherInfo = Camellia_CreateContext((unsigned char *)att->attrib.pValue,
- iv, mode, PR_TRUE,
- att->attrib.ulValueLen);
- if (cipherInfo == NULL) {
- crv = CKR_HOST_MEMORY;
- break;
- }
- crv = sftk_DeriveEncrypt((SFTKCipher)Camellia_Encrypt,
- cipherInfo, 16, key, keySize,
- data, len);
- Camellia_DestroyContext(cipherInfo, PR_TRUE);
- break;
- }
-
- case CKM_SEED_ECB_ENCRYPT_DATA:
- case CKM_SEED_CBC_ENCRYPT_DATA: {
- void *cipherInfo;
- CK_AES_CBC_ENCRYPT_DATA_PARAMS *aesEncryptPtr;
- int mode;
- unsigned char *iv;
- unsigned char *data;
- CK_ULONG len;
-
- if (mechanism == CKM_SEED_ECB_ENCRYPT_DATA) {
- mode = NSS_SEED;
- stringPtr = (CK_KEY_DERIVATION_STRING_DATA *)
- pMechanism->pParameter;
- aesEncryptPtr = NULL;
- data = stringPtr->pData;
- len = stringPtr->ulLen;
- iv = NULL;
- } else {
- mode = NSS_SEED_CBC;
- aesEncryptPtr = (CK_AES_CBC_ENCRYPT_DATA_PARAMS *)
- pMechanism->pParameter;
- iv = aesEncryptPtr->iv;
- data = aesEncryptPtr->pData;
- len = aesEncryptPtr->length;
- }
-
- cipherInfo = SEED_CreateContext((unsigned char *)att->attrib.pValue,
- iv, mode, PR_TRUE);
- if (cipherInfo == NULL) {
- crv = CKR_HOST_MEMORY;
- break;
- }
- crv = sftk_DeriveEncrypt((SFTKCipher)SEED_Encrypt,
- cipherInfo, 16, key, keySize,
- data, len);
- SEED_DestroyContext(cipherInfo, PR_TRUE);
- break;
- }
-
case CKM_CONCATENATE_BASE_AND_KEY: {
SFTKObject *newKey;
@@ -7417,6 +7242,7 @@ NSC_DeriveKey(CK_SESSION_HANDLE hSession,
break;
}
+#ifndef NSS_DISABLE_ECC
case CKM_ECDH1_DERIVE:
case CKM_ECDH1_COFACTOR_DERIVE: {
SECItem ecScalar, ecPoint;
@@ -7556,6 +7382,7 @@ NSC_DeriveKey(CK_SESSION_HANDLE hSession,
}
break;
}
+#endif /* NSS_DISABLE_ECC */
/* See RFC 5869 and CK_NSS_HKDFParams for documentation. */
case CKM_NSS_HKDF_SHA1:
diff --git a/security/nss/lib/softoken/pkcs11i.h b/security/nss/lib/softoken/pkcs11i.h
index 7e57dc5e5c..c5f21c30a5 100644
--- a/security/nss/lib/softoken/pkcs11i.h
+++ b/security/nss/lib/softoken/pkcs11i.h
@@ -667,7 +667,6 @@ extern CK_RV sftk_handleObject(SFTKObject *object, SFTKSession *session);
extern SFTKSlot *sftk_SlotFromID(CK_SLOT_ID slotID, PRBool all);
extern SFTKSlot *sftk_SlotFromSessionHandle(CK_SESSION_HANDLE handle);
-extern CK_SLOT_ID sftk_SlotIDFromSessionHandle(CK_SESSION_HANDLE handle);
extern SFTKSession *sftk_SessionFromHandle(CK_SESSION_HANDLE handle);
extern void sftk_FreeSession(SFTKSession *session);
extern SFTKSession *sftk_NewSession(CK_SLOT_ID slotID, CK_NOTIFY notify,
diff --git a/security/nss/lib/softoken/pkcs11u.c b/security/nss/lib/softoken/pkcs11u.c
index 27e411759e..c51211b6c8 100644
--- a/security/nss/lib/softoken/pkcs11u.c
+++ b/security/nss/lib/softoken/pkcs11u.c
@@ -1261,11 +1261,13 @@ static const CK_ATTRIBUTE_TYPE dhPubKeyAttrs[] = {
};
static const CK_ULONG dhPubKeyAttrsCount =
sizeof(dhPubKeyAttrs) / sizeof(dhPubKeyAttrs[0]);
+#ifndef NSS_DISABLE_ECC
static const CK_ATTRIBUTE_TYPE ecPubKeyAttrs[] = {
CKA_EC_PARAMS, CKA_EC_POINT
};
static const CK_ULONG ecPubKeyAttrsCount =
sizeof(ecPubKeyAttrs) / sizeof(ecPubKeyAttrs[0]);
+#endif
static const CK_ATTRIBUTE_TYPE commonPrivKeyAttrs[] = {
CKA_DECRYPT, CKA_SIGN, CKA_SIGN_RECOVER, CKA_UNWRAP, CKA_SUBJECT,
@@ -1292,11 +1294,13 @@ static const CK_ATTRIBUTE_TYPE dhPrivKeyAttrs[] = {
};
static const CK_ULONG dhPrivKeyAttrsCount =
sizeof(dhPrivKeyAttrs) / sizeof(dhPrivKeyAttrs[0]);
+#ifndef NSS_DISABLE_ECC
static const CK_ATTRIBUTE_TYPE ecPrivKeyAttrs[] = {
CKA_EC_PARAMS, CKA_VALUE
};
static const CK_ULONG ecPrivKeyAttrsCount =
sizeof(ecPrivKeyAttrs) / sizeof(ecPrivKeyAttrs[0]);
+#endif
static const CK_ATTRIBUTE_TYPE certAttrs[] = {
CKA_CERTIFICATE_TYPE, CKA_VALUE, CKA_SUBJECT, CKA_ISSUER, CKA_SERIAL_NUMBER
@@ -1401,10 +1405,12 @@ stfk_CopyTokenPrivateKey(SFTKObject *destObject, SFTKTokenObject *src_to)
crv = stfk_CopyTokenAttributes(destObject, src_to, dhPrivKeyAttrs,
dhPrivKeyAttrsCount);
break;
+#ifndef NSS_DISABLE_ECC
case CKK_EC:
crv = stfk_CopyTokenAttributes(destObject, src_to, ecPrivKeyAttrs,
ecPrivKeyAttrsCount);
break;
+#endif
default:
crv = CKR_DEVICE_ERROR; /* shouldn't happen unless we store more types
* of token keys into our database. */
@@ -1461,10 +1467,12 @@ stfk_CopyTokenPublicKey(SFTKObject *destObject, SFTKTokenObject *src_to)
crv = stfk_CopyTokenAttributes(destObject, src_to, dhPubKeyAttrs,
dhPubKeyAttrsCount);
break;
+#ifndef NSS_DISABLE_ECC
case CKK_EC:
crv = stfk_CopyTokenAttributes(destObject, src_to, ecPubKeyAttrs,
ecPubKeyAttrsCount);
break;
+#endif
default:
crv = CKR_DEVICE_ERROR; /* shouldn't happen unless we store more types
* of token keys into our database. */
diff --git a/security/nss/lib/softoken/sdb.c b/security/nss/lib/softoken/sdb.c
index 96717cb268..8690df34ca 100644
--- a/security/nss/lib/softoken/sdb.c
+++ b/security/nss/lib/softoken/sdb.c
@@ -37,7 +37,6 @@
#elif defined(XP_UNIX)
#include <unistd.h>
#endif
-#include "utilpars.h"
#ifdef SQLITE_UNSAFE_THREADS
#include "prlock.h"
@@ -191,34 +190,6 @@ sdb_done(int err, int *count)
return 0;
}
-#if defined(_WIN32)
-/*
- * NSPR functions and narrow CRT functions do not handle UTF-8 file paths that
- * sqlite3 expects.
- */
-
-static int
-sdb_chmod(const char *filename, int pmode)
-{
- int result;
-
- if (!filename) {
- return -1;
- }
-
- wchar_t *filenameWide = _NSSUTIL_UTF8ToWide(filename);
- if (!filenameWide) {
- return -1;
- }
- result = _wchmod(filenameWide, pmode);
- PORT_Free(filenameWide);
-
- return result;
-}
-#else
-#define sdb_chmod(filename, pmode) chmod((filename), (pmode))
-#endif
-
/*
* find out where sqlite stores the temp tables. We do this by replicating
* the logic from sqlite.
@@ -1629,7 +1600,7 @@ loser:
return error;
}
-static const char RESET_CMD[] = "DELETE FROM %s;";
+static const char RESET_CMD[] = "DROP TABLE IF EXISTS %s;";
CK_RV
sdb_Reset(SDB *sdb)
{
@@ -1650,19 +1621,17 @@ sdb_Reset(SDB *sdb)
goto loser;
}
- if (tableExists(sqlDB, sdb_p->table)) {
- /* delete the contents of the key table */
- newStr = sqlite3_mprintf(RESET_CMD, sdb_p->table);
- if (newStr == NULL) {
- error = CKR_HOST_MEMORY;
- goto loser;
- }
- sqlerr = sqlite3_exec(sqlDB, newStr, NULL, 0, NULL);
- sqlite3_free(newStr);
-
- if (sqlerr != SQLITE_OK)
- goto loser;
+ /* delete the key table */
+ newStr = sqlite3_mprintf(RESET_CMD, sdb_p->table);
+ if (newStr == NULL) {
+ error = CKR_HOST_MEMORY;
+ goto loser;
}
+ sqlerr = sqlite3_exec(sqlDB, newStr, NULL, 0, NULL);
+ sqlite3_free(newStr);
+
+ if (sqlerr != SQLITE_OK)
+ goto loser;
/* delete the password entry table */
sqlerr = sqlite3_exec(sqlDB, "DROP TABLE IF EXISTS metaData;",
@@ -1768,7 +1737,7 @@ sdb_init(char *dbname, char *table, sdbDataType type, int *inUpdate,
* sqlite3 will always create it.
*/
LOCK_SQLITE();
- create = (_NSSUTIL_Access(dbname, PR_ACCESS_EXISTS) != PR_SUCCESS);
+ create = (PR_Access(dbname, PR_ACCESS_EXISTS) != PR_SUCCESS);
if ((flags == SDB_RDONLY) && create) {
error = sdb_mapSQLError(type, SQLITE_CANTOPEN);
goto loser;
@@ -1785,7 +1754,7 @@ sdb_init(char *dbname, char *table, sdbDataType type, int *inUpdate,
*
* NO NSPR call for chmod? :(
*/
- if (create && sdb_chmod(dbname, 0600) != 0) {
+ if (create && chmod(dbname, 0600) != 0) {
error = sdb_mapSQLError(type, SQLITE_CANTOPEN);
goto loser;
}
@@ -1897,29 +1866,30 @@ sdb_init(char *dbname, char *table, sdbDataType type, int *inUpdate,
* so we use it for the cache (see sdb_buildCache for how it's done).*/
/*
- * we decide whether or not to use the cache based on the following input.
- *
- * NSS_SDB_USE_CACHE environment variable is set to anything other than
- * "yes" or "no" (for instance, "auto"): NSS will measure the performance
- * of access to the temp database versus the access to the user's
- * passed-in database location. If the temp database location is
- * "significantly" faster we will use the cache.
- *
- * NSS_SDB_USE_CACHE environment variable is nonexistent or set to "no":
- * cache will not be used.
- *
- * NSS_SDB_USE_CACHE environment variable is set to "yes": cache will
- * always be used.
- *
- * It is expected that most applications will not need this feature, and
- * thus it is disabled by default.
- */
+ * we decide whether or not to use the cache based on the following input.
+ *
+ * NSS_SDB_USE_CACHE environment variable is non-existant or set to
+ * anything other than "no" or "yes" ("auto", for instance).
+ * This is the normal case. NSS will measure the performance of access
+ * to the temp database versus the access to the users passed in
+ * database location. If the temp database location is "significantly"
+ * faster we will use the cache.
+ *
+ * NSS_SDB_USE_CACHE environment variable is set to "no": cache will not
+ * be used.
+ *
+ * NSS_SDB_USE_CACHE environment variable is set to "yes": cache will
+ * always be used.
+ *
+ * It is expected that most applications would use the "auto" selection,
+ * the environment variable is primarily to simplify testing, and to
+ * correct potential corner cases where */
env = PR_GetEnvSecure("NSS_SDB_USE_CACHE");
- if (!env || PORT_Strcasecmp(env, "no") == 0) {
+ if (env && PORT_Strcasecmp(env, "no") == 0) {
enableCache = PR_FALSE;
- } else if (PORT_Strcasecmp(env, "yes") == 0) {
+ } else if (env && PORT_Strcasecmp(env, "yes") == 0) {
enableCache = PR_TRUE;
} else {
char *tempDir = NULL;
@@ -2065,11 +2035,10 @@ s_open(const char *directory, const char *certPrefix, const char *keyPrefix,
{
char *env;
env = PR_GetEnvSecure("NSS_SDB_USE_CACHE");
- /* If the environment variable is undefined or set to yes or no,
- * sdb_init() will ignore the value of accessOps, and we can skip the
- * measuring.*/
- if (env && PORT_Strcasecmp(env, "no") != 0 &&
- PORT_Strcasecmp(env, "yes") != 0) {
+ /* If the environment variable is set to yes or no, sdb_init() will
+ * ignore the value of accessOps, and we can skip the measuring.*/
+ if (!env || ((PORT_Strcasecmp(env, "no") != 0) &&
+ (PORT_Strcasecmp(env, "yes") != 0))) {
accessOps = sdb_measureAccess(directory);
}
}
diff --git a/security/nss/lib/softoken/sdb.h b/security/nss/lib/softoken/sdb.h
index 8ff254bf71..04b873e027 100644
--- a/security/nss/lib/softoken/sdb.h
+++ b/security/nss/lib/softoken/sdb.h
@@ -83,10 +83,6 @@ CK_RV s_open(const char *directory, const char *certPrefix,
int flags, SDB **certdb, SDB **keydb, int *newInit);
CK_RV s_shutdown();
-#if defined(_WIN32)
-wchar_t *sdb_UTF8ToWide(const char *buf);
-#endif
-
/* flags */
#define SDB_RDONLY 1
#define SDB_RDWR 2
diff --git a/security/nss/lib/softoken/sftkdb.c b/security/nss/lib/softoken/sftkdb.c
index 2ae0840682..52e5161176 100644
--- a/security/nss/lib/softoken/sftkdb.c
+++ b/security/nss/lib/softoken/sftkdb.c
@@ -28,9 +28,6 @@
#include "utilpars.h"
#include "secerr.h"
#include "softoken.h"
-#if defined(_WIN32)
-#include <windows.h>
-#endif
/*
* We want all databases to have the same binary representation independent of
@@ -43,7 +40,7 @@
*/
#define BBP 8
-PRBool
+static PRBool
sftkdb_isULONGAttribute(CK_ATTRIBUTE_TYPE type)
{
switch (type) {
@@ -1373,8 +1370,7 @@ sftkdb_SetAttributeValue(SFTKDBHandle *handle, SFTKObject *object,
}
/* make sure we don't have attributes that conflict with the existing DB */
- crv = sftkdb_checkConflicts(db, object->objclass, ntemplate, count,
- objectID);
+ crv = sftkdb_checkConflicts(db, object->objclass, template, count, objectID);
if (crv != CKR_OK) {
goto loser;
}
@@ -1390,8 +1386,8 @@ sftkdb_SetAttributeValue(SFTKDBHandle *handle, SFTKObject *object,
goto loser;
}
inTransaction = PR_TRUE;
- crv = sftkdb_setAttributeValue(arena, handle, db, objectID, ntemplate,
- count);
+ crv = sftkdb_setAttributeValue(arena, handle, db,
+ objectID, template, count);
if (crv != CKR_OK) {
goto loser;
}
@@ -2315,13 +2311,6 @@ loser:
crv = (*handle->update->sdb_GetMetaData)(handle->update, "password",
&item1, &item2);
if (crv != CKR_OK) {
- /* if we get here, neither the source, nor the target has been initialized
- * with a password entry. Create a metadata table now so that we don't
- * mistake this for a partially updated database */
- item1.data[0] = 0;
- item2.data[0] = 0;
- item1.len = item2.len = 1;
- crv = (*handle->db->sdb_PutMetaData)(handle->db, "empty", &item1, &item2);
goto done;
}
crv = (*handle->db->sdb_PutMetaData)(handle->db, "password", &item1,
@@ -2512,53 +2501,6 @@ sftk_oldVersionExists(const char *dir, int version)
return PR_FALSE;
}
-#if defined(_WIN32)
-/*
- * Convert an sdb path (encoded in UTF-8) to a legacy path (encoded in the
- * current system codepage). Fails if the path contains a character outside
- * the current system codepage.
- */
-static char *
-sftk_legacyPathFromSDBPath(const char *confdir)
-{
- wchar_t *confdirWide;
- DWORD size;
- char *nconfdir;
- BOOL unmappable;
-
- if (!confdir) {
- return NULL;
- }
- confdirWide = _NSSUTIL_UTF8ToWide(confdir);
- if (!confdirWide) {
- return NULL;
- }
-
- size = WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, confdirWide, -1,
- NULL, 0, NULL, &unmappable);
- if (size == 0 || unmappable) {
- PORT_Free(confdirWide);
- return NULL;
- }
- nconfdir = PORT_Alloc(sizeof(char) * size);
- if (!nconfdir) {
- PORT_Free(confdirWide);
- return NULL;
- }
- size = WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, confdirWide, -1,
- nconfdir, size, NULL, &unmappable);
- PORT_Free(confdirWide);
- if (size == 0 || unmappable) {
- PORT_Free(nconfdir);
- return NULL;
- }
-
- return nconfdir;
-}
-#else
-#define sftk_legacyPathFromSDBPath(confdir) PORT_Strdup((confdir))
-#endif
-
static PRBool
sftk_hasLegacyDB(const char *confdir, const char *certPrefix,
const char *keyPrefix, int certVersion, int keyVersion)
@@ -2618,7 +2560,6 @@ sftk_DBInit(const char *configdir, const char *certPrefix,
int flags = SDB_RDONLY;
PRBool newInit = PR_FALSE;
PRBool needUpdate = PR_FALSE;
- char *nconfdir = NULL;
if (!readOnly) {
flags = SDB_CREATE;
@@ -2657,14 +2598,11 @@ sftk_DBInit(const char *configdir, const char *certPrefix,
* the exists.
*/
if (crv != CKR_OK) {
- if ((flags & SDB_RDONLY) == SDB_RDONLY) {
- nconfdir = sftk_legacyPathFromSDBPath(confdir);
- }
- if (nconfdir &&
- sftk_hasLegacyDB(nconfdir, certPrefix, keyPrefix, 8, 3)) {
+ if (((flags & SDB_RDONLY) == SDB_RDONLY) &&
+ sftk_hasLegacyDB(confdir, certPrefix, keyPrefix, 8, 3)) {
/* we have legacy databases, if we failed to open the new format
* DB's read only, just use the legacy ones */
- crv = sftkdbCall_open(nconfdir, certPrefix,
+ crv = sftkdbCall_open(confdir, certPrefix,
keyPrefix, 8, 3, flags,
noCertDB ? NULL : &certSDB, noKeyDB ? NULL : &keySDB);
}
@@ -2693,10 +2631,7 @@ sftk_DBInit(const char *configdir, const char *certPrefix,
/* if the new format DB was also a newly created DB, and we
* succeeded, then need to update that new database with data
* from the existing legacy DB */
- nconfdir = sftk_legacyPathFromSDBPath(confdir);
- if (nconfdir &&
- sftk_hasLegacyDB(nconfdir, certPrefix, keyPrefix, 8, 3)) {
- confdir = nconfdir;
+ if (sftk_hasLegacyDB(confdir, certPrefix, keyPrefix, 8, 3)) {
needUpdate = PR_TRUE;
}
}
@@ -2769,9 +2704,6 @@ done:
if (appName) {
PORT_Free(appName);
}
- if (nconfdir) {
- PORT_Free(nconfdir);
- }
return forceOpen ? CKR_OK : crv;
}
diff --git a/security/nss/lib/softoken/sftkdbti.h b/security/nss/lib/softoken/sftkdbti.h
index 7b1db45607..4942e1b12e 100644
--- a/security/nss/lib/softoken/sftkdbti.h
+++ b/security/nss/lib/softoken/sftkdbti.h
@@ -49,7 +49,6 @@ SECStatus sftkdb_VerifyAttribute(SECItem *passKey,
CK_ATTRIBUTE_TYPE attrType,
SECItem *plainText, SECItem *sigText);
-PRBool sftkdb_isULONGAttribute(CK_ATTRIBUTE_TYPE type);
void sftk_ULong2SDBULong(unsigned char *data, CK_ULONG value);
CK_RV sftkdb_Update(SFTKDBHandle *handle, SECItem *key);
CK_RV sftkdb_PutAttributeSignature(SFTKDBHandle *handle,
diff --git a/security/nss/lib/softoken/sftkpwd.c b/security/nss/lib/softoken/sftkpwd.c
index e0d2df9ab4..0b8c91bfda 100644
--- a/security/nss/lib/softoken/sftkpwd.c
+++ b/security/nss/lib/softoken/sftkpwd.c
@@ -926,13 +926,6 @@ sftk_updateMacs(PLArenaPool *arena, SFTKDBHandle *handle,
continue;
}
- if (authAttrs[i].ulValueLen == sizeof(CK_ULONG) &&
- sftkdb_isULONGAttribute(authAttrs[i].type)) {
- CK_ULONG value = *(CK_ULONG *)authAttrs[i].pValue;
- sftk_ULong2SDBULong(authAttrs[i].pValue, value);
- authAttrs[i].ulValueLen = SDB_ULONG_SIZE;
- }
-
plainText.data = authAttrs[i].pValue;
plainText.len = authAttrs[i].ulValueLen;
rv = sftkdb_SignAttribute(arena, newKey, id,
diff --git a/security/nss/lib/softoken/softkver.h b/security/nss/lib/softoken/softkver.h
index 9fd99a8e0b..fb2e5bda5f 100644
--- a/security/nss/lib/softoken/softkver.h
+++ b/security/nss/lib/softoken/softkver.h
@@ -8,7 +8,11 @@
#ifndef _SOFTKVER_H_
#define _SOFTKVER_H_
+#ifndef NSS_DISABLE_ECC
#define SOFTOKEN_ECC_STRING " Basic ECC"
+#else
+#define SOFTOKEN_ECC_STRING ""
+#endif
/*
* Softoken's major version, minor version, patch level, build number,
@@ -17,10 +21,10 @@
* The format of the version string should be
* "<major version>.<minor version>[.<patch level>[.<build number>]][ <ECC>][ <Beta>]"
*/
-#define SOFTOKEN_VERSION "3.35" SOFTOKEN_ECC_STRING
+#define SOFTOKEN_VERSION "3.32.1" SOFTOKEN_ECC_STRING
#define SOFTOKEN_VMAJOR 3
-#define SOFTOKEN_VMINOR 35
-#define SOFTOKEN_VPATCH 0
+#define SOFTOKEN_VMINOR 32
+#define SOFTOKEN_VPATCH 1
#define SOFTOKEN_VBUILD 0
#define SOFTOKEN_BETA PR_FALSE
diff --git a/security/nss/lib/softoken/softoknt.h b/security/nss/lib/softoken/softoknt.h
index 03c92361c0..0716898425 100644
--- a/security/nss/lib/softoken/softoknt.h
+++ b/security/nss/lib/softoken/softoknt.h
@@ -9,9 +9,6 @@
#define _SOFTOKNT_H_
#define NSS_SOFTOKEN_DEFAULT_CHUNKSIZE 2048
-#define DES_BLOCK_SIZE 8 /* bytes */
-#define MAX_DES3_KEY_SIZE 24 /* DES_BLOCK_SIZE * 3 */
-#define SFTK_MAX_DERIVE_KEY_SIZE 64
/*
* FIPS 140-2 auditing
diff --git a/security/nss/lib/ssl/SSLerrs.h b/security/nss/lib/ssl/SSLerrs.h
index c95fe661ae..b73fb6bd04 100644
--- a/security/nss/lib/ssl/SSLerrs.h
+++ b/security/nss/lib/ssl/SSLerrs.h
@@ -473,7 +473,8 @@ ER3(SSL_ERROR_RX_MALFORMED_PRE_SHARED_KEY, (SSL_ERROR_BASE + 147),
ER3(SSL_ERROR_RX_MALFORMED_EARLY_DATA, (SSL_ERROR_BASE + 148),
"SSL received an invalid EarlyData extension.")
-UNUSED_ERROR(149)
+ER3(SSL_ERROR_END_OF_EARLY_DATA_ALERT, (SSL_ERROR_BASE + 149),
+ "SSL received an unexpected end of early data alert.")
ER3(SSL_ERROR_MISSING_ALPN_EXTENSION, (SSL_ERROR_BASE + 150),
"SSL didn't receive an expected ALPN extension.")
@@ -510,33 +511,3 @@ ER3(SSL_ERROR_DOWNGRADE_WITH_EARLY_DATA, (SSL_ERROR_BASE + 160),
ER3(SSL_ERROR_TOO_MUCH_EARLY_DATA, (SSL_ERROR_BASE + 161),
"SSL received more early data than permitted.")
-
-ER3(SSL_ERROR_RX_UNEXPECTED_END_OF_EARLY_DATA, (SSL_ERROR_BASE + 162),
- "SSL received an unexpected End of Early Data message.")
-
-ER3(SSL_ERROR_RX_MALFORMED_END_OF_EARLY_DATA, (SSL_ERROR_BASE + 163),
- "SSL received a malformed End of Early Data message.")
-
-ER3(SSL_ERROR_UNSUPPORTED_EXPERIMENTAL_API, (SSL_ERROR_BASE + 164),
- "An experimental API was called, but not supported.")
-
-ER3(SSL_ERROR_APPLICATION_ABORT, (SSL_ERROR_BASE + 165),
- "SSL handshake aborted by the application.")
-
-ER3(SSL_ERROR_APP_CALLBACK_ERROR, (SSL_ERROR_BASE + 166),
- "An application callback produced an invalid response.")
-
-ER3(SSL_ERROR_NO_TIMERS_ERROR, (SSL_ERROR_BASE + 167),
- "No timers are currently running.")
-
-ER3(SSL_ERROR_MISSING_COOKIE_EXTENSION, (SSL_ERROR_BASE + 168),
- "A second ClientHello was received without a cookie extension.")
-
-ER3(SSL_ERROR_RX_UNEXPECTED_KEY_UPDATE, (SSL_ERROR_BASE + 169),
- "SSL received an unexpected key update message.")
-
-ER3(SSL_ERROR_RX_MALFORMED_KEY_UPDATE, (SSL_ERROR_BASE + 170),
- "SSL received a malformed key update message.")
-
-ER3(SSL_ERROR_TOO_MANY_KEY_UPDATES, (SSL_ERROR_BASE + 171),
- "SSL attempted too many key updates.")
diff --git a/security/nss/lib/ssl/authcert.c b/security/nss/lib/ssl/authcert.c
index 2765c83420..88c7c084ae 100644
--- a/security/nss/lib/ssl/authcert.c
+++ b/security/nss/lib/ssl/authcert.c
@@ -17,7 +17,6 @@
#include "nss.h"
#include "ssl.h"
#include "pk11func.h" /* for PK11_ function calls */
-#include "sslimpl.h"
/*
* This callback used by SSL to pull client sertificate upon
@@ -64,7 +63,7 @@ NSS_GetClientAuthData(void *arg,
if (!cert)
continue;
/* Only check unexpired certs */
- if (CERT_CheckCertValidTimes(cert, ssl_TimeUsec(), PR_TRUE) !=
+ if (CERT_CheckCertValidTimes(cert, PR_Now(), PR_TRUE) !=
secCertTimeValid) {
CERT_DestroyCertificate(cert);
continue;
diff --git a/security/nss/lib/ssl/config.mk b/security/nss/lib/ssl/config.mk
index d13613f78c..c8b053cabb 100644
--- a/security/nss/lib/ssl/config.mk
+++ b/security/nss/lib/ssl/config.mk
@@ -57,6 +57,11 @@ endif
endif
+ifdef NSS_SSL_ENABLE_ZLIB
+DEFINES += -DNSS_SSL_ENABLE_ZLIB
+include $(CORE_DEPTH)/coreconf/zlib.mk
+endif
+
ifdef NSS_DISABLE_TLS_1_3
DEFINES += -DNSS_DISABLE_TLS_1_3
endif
diff --git a/security/nss/lib/ssl/dtls13con.c b/security/nss/lib/ssl/dtls13con.c
deleted file mode 100644
index aba0f62ab8..0000000000
--- a/security/nss/lib/ssl/dtls13con.c
+++ /dev/null
@@ -1,457 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; 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/. */
-
-/*
- * DTLS 1.3 Protocol
- */
-
-#include "ssl.h"
-#include "sslimpl.h"
-#include "sslproto.h"
-
-/* DTLS 1.3 Record map for ACK processing.
- * This represents a single fragment, so a record which includes
- * multiple fragments will have one entry for each fragment on the
- * sender. We use the same structure on the receiver for convenience
- * but the only value we actually use is |record|.
- */
-typedef struct DTLSHandshakeRecordEntryStr {
- PRCList link;
- PRUint16 messageSeq; /* The handshake message sequence number. */
- PRUint32 offset; /* The offset into the handshake message. */
- PRUint32 length; /* The length of the fragment. */
- sslSequenceNumber record; /* The record (includes epoch). */
- PRBool acked; /* Has this packet been acked. */
-} DTLSHandshakeRecordEntry;
-
-/* Combine the epoch and sequence number into a single value. */
-static inline sslSequenceNumber
-dtls_CombineSequenceNumber(DTLSEpoch epoch, sslSequenceNumber seqNum)
-{
- PORT_Assert(seqNum <= RECORD_SEQ_MAX);
- return ((sslSequenceNumber)epoch << 48) | seqNum;
-}
-
-SECStatus
-dtls13_RememberFragment(sslSocket *ss,
- PRCList *list,
- PRUint32 sequence,
- PRUint32 offset,
- PRUint32 length,
- DTLSEpoch epoch,
- sslSequenceNumber record)
-{
- DTLSHandshakeRecordEntry *entry;
-
- PORT_Assert(IS_DTLS(ss));
- /* We should never send an empty fragment with offset > 0. */
- PORT_Assert(length || !offset);
-
- if (!tls13_MaybeTls13(ss)) {
- return SECSuccess;
- }
-
- SSL_TRC(20, ("%d: SSL3[%d]: %s remembering %s record=%llx msg=%d offset=%d",
- SSL_GETPID(), ss->fd,
- SSL_ROLE(ss),
- list == &ss->ssl3.hs.dtlsSentHandshake ? "sent" : "received",
- dtls_CombineSequenceNumber(epoch, record), sequence, offset));
-
- entry = PORT_ZAlloc(sizeof(DTLSHandshakeRecordEntry));
- if (!entry) {
- return SECFailure;
- }
-
- entry->messageSeq = sequence;
- entry->offset = offset;
- entry->length = length;
- entry->record = dtls_CombineSequenceNumber(epoch, record);
- entry->acked = PR_FALSE;
-
- PR_APPEND_LINK(&entry->link, list);
-
- return SECSuccess;
-}
-
-SECStatus
-dtls13_SendAck(sslSocket *ss)
-{
- sslBuffer buf = SSL_BUFFER_EMPTY;
- SECStatus rv = SECSuccess;
- PRCList *cursor;
- PRInt32 sent;
-
- SSL_TRC(10, ("%d: SSL3[%d]: Sending ACK",
- SSL_GETPID(), ss->fd));
-
- for (cursor = PR_LIST_HEAD(&ss->ssl3.hs.dtlsRcvdHandshake);
- cursor != &ss->ssl3.hs.dtlsRcvdHandshake;
- cursor = PR_NEXT_LINK(cursor)) {
- DTLSHandshakeRecordEntry *entry = (DTLSHandshakeRecordEntry *)cursor;
-
- SSL_TRC(10, ("%d: SSL3[%d]: ACK for record=%llx",
- SSL_GETPID(), ss->fd, entry->record));
- rv = sslBuffer_AppendNumber(&buf, entry->record, 8);
- if (rv != SECSuccess) {
- goto loser;
- }
- }
-
- ssl_GetXmitBufLock(ss);
- sent = ssl3_SendRecord(ss, NULL, content_ack,
- buf.buf, buf.len, 0);
- ssl_ReleaseXmitBufLock(ss);
- if (sent != buf.len) {
- rv = SECFailure;
- if (sent != -1) {
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- }
- }
-
-loser:
- sslBuffer_Clear(&buf);
- return rv;
-}
-
-void
-dtls13_SendAckCb(sslSocket *ss)
-{
- if (!IS_DTLS(ss)) {
- return;
- }
- (void)dtls13_SendAck(ss);
-}
-
-/* Zero length messages are very simple to check. */
-static PRBool
-dtls_IsEmptyMessageAcknowledged(sslSocket *ss, PRUint16 msgSeq, PRUint32 offset)
-{
- PRCList *cursor;
-
- for (cursor = PR_LIST_HEAD(&ss->ssl3.hs.dtlsSentHandshake);
- cursor != &ss->ssl3.hs.dtlsSentHandshake;
- cursor = PR_NEXT_LINK(cursor)) {
- DTLSHandshakeRecordEntry *entry = (DTLSHandshakeRecordEntry *)cursor;
- if (!entry->acked || msgSeq != entry->messageSeq) {
- continue;
- }
- /* Empty fragments are always offset 0. */
- if (entry->length == 0) {
- PORT_Assert(!entry->offset);
- return PR_TRUE;
- }
- }
- return PR_FALSE;
-}
-
-/* Take a range starting at |*start| and that start forwards based on the
- * contents of the acknowedgement in |entry|. Only move if the acknowledged
- * range overlaps |*start|. Return PR_TRUE if it moves. */
-static PRBool
-dtls_MoveUnackedStartForward(DTLSHandshakeRecordEntry *entry, PRUint32 *start)
-{
- /* This entry starts too late. */
- if (*start < entry->offset) {
- return PR_FALSE;
- }
- /* This entry ends too early. */
- if (*start >= entry->offset + entry->length) {
- return PR_FALSE;
- }
- *start = entry->offset + entry->length;
- return PR_TRUE;
-}
-
-/* Take a range ending at |*end| and move that end backwards based on the
- * contents of the acknowedgement in |entry|. Only move if the acknowledged
- * range overlaps |*end|. Return PR_TRUE if it moves. */
-static PRBool
-dtls_MoveUnackedEndBackward(DTLSHandshakeRecordEntry *entry, PRUint32 *end)
-{
- /* This entry ends too early. */
- if (*end > entry->offset + entry->length) {
- return PR_FALSE;
- }
- /* This entry starts too late. */
- if (*end <= entry->offset) {
- return PR_FALSE;
- }
- *end = entry->offset;
- return PR_TRUE;
-}
-
-/* Get the next contiguous range of unacknowledged bytes from the handshake
- * message identified by |msgSeq|. The search starts at the offset in |offset|.
- * |len| contains the full length of the message.
- *
- * Returns PR_TRUE if there is an unacknowledged range. In this case, values at
- * |start| and |end| are modified to contain the range.
- *
- * Returns PR_FALSE if the message is entirely acknowledged from |offset|
- * onwards.
- */
-PRBool
-dtls_NextUnackedRange(sslSocket *ss, PRUint16 msgSeq, PRUint32 offset,
- PRUint32 len, PRUint32 *startOut, PRUint32 *endOut)
-{
- PRCList *cur_p;
- PRBool done = PR_FALSE;
- DTLSHandshakeRecordEntry *entry;
- PRUint32 start;
- PRUint32 end;
-
- PORT_Assert(IS_DTLS(ss));
-
- *startOut = offset;
- *endOut = len;
- if (!tls13_MaybeTls13(ss)) {
- return PR_TRUE;
- }
-
- /* The message is empty. Use a simple search. */
- if (!len) {
- PORT_Assert(!offset);
- return !dtls_IsEmptyMessageAcknowledged(ss, msgSeq, offset);
- }
-
- /* This iterates multiple times over the acknowledgments and only terminates
- * when an entire iteration happens without start or end moving. If that
- * happens without start and end crossing each other, then there is a range
- * of unacknowledged data. If they meet, then the message is fully
- * acknowledged. */
- start = offset;
- end = len;
- while (!done) {
- done = PR_TRUE;
- for (cur_p = PR_LIST_HEAD(&ss->ssl3.hs.dtlsSentHandshake);
- cur_p != &ss->ssl3.hs.dtlsSentHandshake;
- cur_p = PR_NEXT_LINK(cur_p)) {
- entry = (DTLSHandshakeRecordEntry *)cur_p;
- if (!entry->acked || msgSeq != entry->messageSeq) {
- continue;
- }
-
- if (dtls_MoveUnackedStartForward(entry, &start) ||
- dtls_MoveUnackedEndBackward(entry, &end)) {
- if (start >= end) {
- /* The message is all acknowledged. */
- return PR_FALSE;
- }
- /* Start over again and keep going until we don't move either
- * start or end. */
- done = PR_FALSE;
- break;
- }
- }
- }
- PORT_Assert(start < end);
-
- *startOut = start;
- *endOut = end;
- return PR_TRUE;
-}
-
-SECStatus
-dtls13_SetupAcks(sslSocket *ss)
-{
- if (ss->version < SSL_LIBRARY_VERSION_TLS_1_3) {
- return SECSuccess;
- }
-
- if (ss->ssl3.hs.endOfFlight) {
- dtls_CancelTimer(ss, ss->ssl3.hs.ackTimer);
-
- if (ss->ssl3.hs.ws == idle_handshake && ss->sec.isServer) {
- SSL_TRC(10, ("%d: SSL3[%d]: dtls_HandleHandshake, sending ACK",
- SSL_GETPID(), ss->fd));
- return dtls13_SendAck(ss);
- }
- return SECSuccess;
- }
-
- /* We need to send an ACK. */
- if (!ss->ssl3.hs.ackTimer->cb) {
- /* We're not armed, so arm. */
- SSL_TRC(10, ("%d: SSL3[%d]: dtls_HandleHandshake, arming ack timer",
- SSL_GETPID(), ss->fd));
- return dtls_StartTimer(ss, ss->ssl3.hs.ackTimer,
- DTLS_RETRANSMIT_INITIAL_MS / 4,
- dtls13_SendAckCb);
- }
- /* The ack timer is already armed, so just return. */
- return SECSuccess;
-}
-
-/*
- * Special case processing for out-of-epoch records.
- * This can only handle ACKs for now and everything else generates
- * an error. In future, may also handle KeyUpdate.
- *
- * The error checking here is as follows:
- *
- * - If it's not encrypted, out of epoch stuff is just discarded.
- * - If it's encrypted, out of epoch stuff causes an error.
- */
-SECStatus
-dtls13_HandleOutOfEpochRecord(sslSocket *ss, const ssl3CipherSpec *spec,
- SSL3ContentType rType,
- sslBuffer *databuf)
-{
- SECStatus rv;
- sslBuffer buf = *databuf;
-
- databuf->len = 0; /* Discard data whatever happens. */
- PORT_Assert(IS_DTLS(ss));
- PORT_Assert(ss->version >= SSL_LIBRARY_VERSION_TLS_1_3);
- /* Can't happen, but double check. */
- if (!IS_DTLS(ss) || (ss->version < SSL_LIBRARY_VERSION_TLS_1_3)) {
- tls13_FatalError(ss, SEC_ERROR_LIBRARY_FAILURE, internal_error);
- return SECFailure;
- }
- SSL_TRC(10, ("%d: DTLS13[%d]: handle out of epoch record: type=%d", SSL_GETPID(),
- ss->fd, rType));
-
- if (rType == content_ack) {
- ssl_GetSSL3HandshakeLock(ss);
- rv = dtls13_HandleAck(ss, &buf);
- ssl_ReleaseSSL3HandshakeLock(ss);
- PORT_Assert(databuf->len == 0);
- return rv;
- }
-
- switch (spec->epoch) {
- case TrafficKeyClearText:
- /* Drop. */
- return SECSuccess;
-
- case TrafficKeyHandshake:
- /* Drop out of order handshake messages, but if we are the
- * server, we might have processed the client's Finished and
- * moved on to application data keys, but the client has
- * retransmitted Finished (e.g., because our ACK got lost.)
- * We just retransmit the previous Finished to let the client
- * complete. */
- if (rType == content_handshake) {
- if ((ss->sec.isServer) &&
- (ss->ssl3.hs.ws == idle_handshake)) {
- PORT_Assert(dtls_TimerActive(ss, ss->ssl3.hs.hdTimer));
- return dtls13_SendAck(ss);
- }
- return SECSuccess;
- }
-
- /* This isn't a handshake record, so shouldn't be encrypted
- * under the handshake key. */
- break;
-
- default:
- /* Any other epoch is forbidden. */
- break;
- }
-
- SSL_TRC(10, ("%d: SSL3[%d]: unexpected out of epoch record type %d", SSL_GETPID(),
- ss->fd, rType));
-
- (void)SSL3_SendAlert(ss, alert_fatal, illegal_parameter);
- PORT_SetError(SSL_ERROR_RX_UNKNOWN_RECORD_TYPE);
- return SECFailure;
-}
-
-SECStatus
-dtls13_HandleAck(sslSocket *ss, sslBuffer *databuf)
-{
- PRUint8 *b = databuf->buf;
- PRUint32 l = databuf->len;
- SECStatus rv;
-
- /* Ensure we don't loop. */
- databuf->len = 0;
-
- PORT_Assert(IS_DTLS(ss));
- if (!tls13_MaybeTls13(ss)) {
- tls13_FatalError(ss, SSL_ERROR_RX_UNKNOWN_RECORD_TYPE, illegal_parameter);
- return SECSuccess;
- }
-
- SSL_TRC(10, ("%d: SSL3[%d]: Handling ACK", SSL_GETPID(), ss->fd));
- while (l > 0) {
- PRUint64 seq;
- PRCList *cursor;
-
- rv = ssl3_ConsumeHandshakeNumber64(ss, &seq, 8, &b, &l);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- for (cursor = PR_LIST_HEAD(&ss->ssl3.hs.dtlsSentHandshake);
- cursor != &ss->ssl3.hs.dtlsSentHandshake;
- cursor = PR_NEXT_LINK(cursor)) {
- DTLSHandshakeRecordEntry *entry = (DTLSHandshakeRecordEntry *)cursor;
-
- if (entry->record == seq) {
- SSL_TRC(10, (
- "%d: SSL3[%d]: Marking record=%llx message %d offset %d length=%d as ACKed",
- SSL_GETPID(), ss->fd,
- seq, entry->messageSeq, entry->offset, entry->length));
- entry->acked = PR_TRUE;
- }
- }
- }
-
- /* Try to flush. */
- rv = dtls_TransmitMessageFlight(ss);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- /* Reset the retransmit timer. */
- if (ss->ssl3.hs.rtTimer->cb) {
- (void)dtls_RestartTimer(ss, ss->ssl3.hs.rtTimer);
- }
-
- /* If there are no more messages to send, cleanup. */
- if (PR_CLIST_IS_EMPTY(&ss->ssl3.hs.lastMessageFlight)) {
- SSL_TRC(10, ("%d: SSL3[%d]: No more unacked handshake messages",
- SSL_GETPID(), ss->fd));
-
- dtls_CancelTimer(ss, ss->ssl3.hs.rtTimer);
- ssl_ClearPRCList(&ss->ssl3.hs.dtlsSentHandshake, NULL);
- /* If the handshake is finished, and we're the client then
- * also clean up the handshake read cipher spec. Any ACKs
- * we receive will be with the application data cipher spec.
- * The server needs to keep the handshake cipher spec around
- * for the holddown period to process retransmitted Finisheds.
- */
- if (!ss->sec.isServer && (ss->ssl3.hs.ws == idle_handshake)) {
- ssl_CipherSpecReleaseByEpoch(ss, CipherSpecRead,
- TrafficKeyHandshake);
- }
- }
- return SECSuccess;
-}
-
-/* Clean up the read timer for the handshake cipher suites on the
- * server.
- *
- * In DTLS 1.3, the client speaks last (Finished), and will retransmit
- * until the server ACKs that message (using application data cipher
- * suites). I.e.,
- *
- * - The client uses the retransmit timer and retransmits using the
- * saved write handshake cipher suite.
- * - The server keeps the saved read handshake cipher suite around
- * for the holddown period in case it needs to read the Finished.
- *
- * After the holddown period, the server assumes the client is happy
- * and discards the handshake read cipher suite.
- */
-void
-dtls13_HolddownTimerCb(sslSocket *ss)
-{
- SSL_TRC(10, ("%d: SSL3[%d]: holddown timer fired",
- SSL_GETPID(), ss->fd));
- ssl_CipherSpecReleaseByEpoch(ss, CipherSpecRead, TrafficKeyHandshake);
- ssl_ClearPRCList(&ss->ssl3.hs.dtlsRcvdHandshake, NULL);
-}
diff --git a/security/nss/lib/ssl/dtls13con.h b/security/nss/lib/ssl/dtls13con.h
deleted file mode 100644
index bf14d3bd2e..0000000000
--- a/security/nss/lib/ssl/dtls13con.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is PRIVATE to SSL.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef __dtls13con_h_
-#define __dtls13con_h_
-
-SECStatus dtls13_RememberFragment(sslSocket *ss, PRCList *list,
- PRUint32 sequence, PRUint32 offset,
- PRUint32 length, DTLSEpoch epoch,
- sslSequenceNumber record);
-PRBool dtls_NextUnackedRange(sslSocket *ss, PRUint16 msgSeq, PRUint32 offset,
- PRUint32 len, PRUint32 *startOut, PRUint32 *endOut);
-SECStatus dtls13_SetupAcks(sslSocket *ss);
-SECStatus dtls13_HandleOutOfEpochRecord(sslSocket *ss, const ssl3CipherSpec *spec,
- SSL3ContentType rType,
- sslBuffer *databuf);
-SECStatus dtls13_HandleAck(sslSocket *ss, sslBuffer *databuf);
-
-SECStatus dtls13_SendAck(sslSocket *ss);
-void dtls13_SendAckCb(sslSocket *ss);
-void dtls13_HolddownTimerCb(sslSocket *ss);
-void dtls_ReceivedFirstMessageInFlight(sslSocket *ss);
-
-#endif
diff --git a/security/nss/lib/ssl/dtlscon.c b/security/nss/lib/ssl/dtlscon.c
index 2f335f9247..fbd1779dbb 100644
--- a/security/nss/lib/ssl/dtlscon.c
+++ b/security/nss/lib/ssl/dtlscon.c
@@ -10,17 +10,16 @@
#include "ssl.h"
#include "sslimpl.h"
#include "sslproto.h"
-#include "dtls13con.h"
#ifndef PR_ARRAY_SIZE
#define PR_ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
#endif
+static SECStatus dtls_TransmitMessageFlight(sslSocket *ss);
static SECStatus dtls_StartRetransmitTimer(sslSocket *ss);
static void dtls_RetransmitTimerExpiredCb(sslSocket *ss);
static SECStatus dtls_SendSavedWriteData(sslSocket *ss);
static void dtls_FinishedTimerCb(sslSocket *ss);
-static void dtls_CancelAllTimers(sslSocket *ss);
/* -28 adjusts for the IP/UDP header */
static const PRUint16 COMMON_MTU_VALUES[] = {
@@ -31,9 +30,6 @@ static const PRUint16 COMMON_MTU_VALUES[] = {
};
#define DTLS_COOKIE_BYTES 32
-/* Maximum DTLS expansion = header + IV + max CBC padding +
- * maximum MAC. */
-#define DTLS_MAX_EXPANSION (DTLS_RECORD_HEADER_LENGTH + 16 + 16 + 32)
/* List copied from ssl3con.c:cipherSuites */
static const ssl3CipherSuite nonDTLSSuites[] = {
@@ -123,9 +119,9 @@ static DTLSQueuedMessage *
dtls_AllocQueuedMessage(ssl3CipherSpec *cwSpec, SSL3ContentType type,
const unsigned char *data, PRUint32 len)
{
- DTLSQueuedMessage *msg;
+ DTLSQueuedMessage *msg = NULL;
- msg = PORT_ZNew(DTLSQueuedMessage);
+ msg = PORT_ZAlloc(sizeof(DTLSQueuedMessage));
if (!msg)
return NULL;
@@ -141,7 +137,7 @@ dtls_AllocQueuedMessage(ssl3CipherSpec *cwSpec, SSL3ContentType type,
msg->type = type;
/* Safe if we are < 1.3, since the refct is
* already very high. */
- ssl_CipherSpecAddRef(cwSpec);
+ tls13_CipherSpecAddRef(cwSpec);
return msg;
}
@@ -159,7 +155,7 @@ dtls_FreeHandshakeMessage(DTLSQueuedMessage *msg)
/* Safe if we are < 1.3, since the refct is
* already very high. */
- ssl_CipherSpecRelease(msg->cwSpec);
+ tls13_CipherSpecRelease(msg->cwSpec);
PORT_ZFree(msg->data, msg->len);
PORT_Free(msg);
}
@@ -188,38 +184,37 @@ dtls_FreeHandshakeMessages(PRCList *list)
static SECStatus
dtls_RetransmitDetected(sslSocket *ss)
{
- dtlsTimer *timer = ss->ssl3.hs.rtTimer;
SECStatus rv = SECSuccess;
PORT_Assert(ss->opt.noLocks || ssl_HaveRecvBufLock(ss));
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
- if (timer->cb == dtls_RetransmitTimerExpiredCb) {
+ if (ss->ssl3.hs.rtTimerCb == dtls_RetransmitTimerExpiredCb) {
/* Check to see if we retransmitted recently. If so,
* suppress the triggered retransmit. This avoids
* retransmit wars after packet loss.
* This is not in RFC 5346 but it should be.
*/
- if ((PR_IntervalNow() - timer->started) >
- (timer->timeout / 4)) {
+ if ((PR_IntervalNow() - ss->ssl3.hs.rtTimerStarted) >
+ (ss->ssl3.hs.rtTimeoutMs / 4)) {
SSL_TRC(30,
("%d: SSL3[%d]: Shortcutting retransmit timer",
SSL_GETPID(), ss->fd));
/* Cancel the timer and call the CB,
* which re-arms the timer */
- dtls_CancelTimer(ss, ss->ssl3.hs.rtTimer);
+ dtls_CancelTimer(ss);
dtls_RetransmitTimerExpiredCb(ss);
} else {
SSL_TRC(30,
("%d: SSL3[%d]: Ignoring retransmission: "
"last retransmission %dms ago, suppressed for %dms",
SSL_GETPID(), ss->fd,
- PR_IntervalNow() - timer->started,
- timer->timeout / 4));
+ PR_IntervalNow() - ss->ssl3.hs.rtTimerStarted,
+ ss->ssl3.hs.rtTimeoutMs / 4));
}
- } else if (timer->cb == dtls_FinishedTimerCb) {
+ } else if (ss->ssl3.hs.rtTimerCb == dtls_FinishedTimerCb) {
SSL_TRC(30, ("%d: SSL3[%d]: Retransmit detected in holddown",
SSL_GETPID(), ss->fd));
/* Retransmit the messages and re-arm the timer
@@ -227,14 +222,14 @@ dtls_RetransmitDetected(sslSocket *ss)
* The spec isn't clear and my reasoning is that this
* may be a re-ordered packet rather than slowness,
* so let's be aggressive. */
- dtls_CancelTimer(ss, ss->ssl3.hs.rtTimer);
+ dtls_CancelTimer(ss);
rv = dtls_TransmitMessageFlight(ss);
if (rv == SECSuccess) {
rv = dtls_StartHolddownTimer(ss);
}
} else {
- PORT_Assert(timer->cb == NULL);
+ PORT_Assert(ss->ssl3.hs.rtTimerCb == NULL);
/* ... and ignore it. */
}
return rv;
@@ -243,8 +238,19 @@ dtls_RetransmitDetected(sslSocket *ss)
static SECStatus
dtls_HandleHandshakeMessage(sslSocket *ss, PRUint8 *data, PRBool last)
{
+
+ /* At this point we are advancing our state machine, so we can free our last
+ * flight of messages. */
+ dtls_FreeHandshakeMessages(&ss->ssl3.hs.lastMessageFlight);
ss->ssl3.hs.recvdHighWater = -1;
+ /* Reset the timer to the initial value if the retry counter
+ * is 0, per Sec. 4.2.4.1 */
+ dtls_CancelTimer(ss);
+ if (ss->ssl3.hs.rtRetries == 0) {
+ ss->ssl3.hs.rtTimeoutMs = DTLS_RETRANSMIT_INITIAL_MS;
+ }
+
return ssl3_HandleHandshakeMessage(ss, data, ss->ssl3.hs.msg_len,
last);
}
@@ -267,8 +273,7 @@ dtls_HandleHandshakeMessage(sslSocket *ss, PRUint8 *data, PRBool last)
#define OFFSET_MASK(o) (1 << (o % 8))
SECStatus
-dtls_HandleHandshake(sslSocket *ss, DTLSEpoch epoch, sslSequenceNumber seqNum,
- sslBuffer *origBuf)
+dtls_HandleHandshake(sslSocket *ss, sslBuffer *origBuf)
{
/* XXX OK for now.
* This doesn't work properly with asynchronous certificate validation.
@@ -278,9 +283,6 @@ dtls_HandleHandshake(sslSocket *ss, DTLSEpoch epoch, sslSequenceNumber seqNum,
*/
sslBuffer buf = *origBuf;
SECStatus rv = SECSuccess;
- PRBool discarded = PR_FALSE;
-
- ss->ssl3.hs.endOfFlight = PR_FALSE;
PORT_Assert(ss->opt.noLocks || ssl_HaveRecvBufLock(ss));
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
@@ -296,7 +298,7 @@ dtls_HandleHandshake(sslSocket *ss, DTLSEpoch epoch, sslSequenceNumber seqNum,
if (buf.len < 12) {
PORT_SetError(SSL_ERROR_RX_MALFORMED_HANDSHAKE);
rv = SECFailure;
- goto loser;
+ break;
}
/* Parse the header */
@@ -321,28 +323,14 @@ dtls_HandleHandshake(sslSocket *ss, DTLSEpoch epoch, sslSequenceNumber seqNum,
if (buf.len < fragment_length) {
PORT_SetError(SSL_ERROR_RX_MALFORMED_HANDSHAKE);
rv = SECFailure;
- goto loser;
+ break;
}
/* Sanity check the packet contents */
if ((fragment_length + fragment_offset) > message_length) {
PORT_SetError(SSL_ERROR_RX_MALFORMED_HANDSHAKE);
rv = SECFailure;
- goto loser;
- }
-
- /* If we're a server and we receive what appears to be a retried
- * ClientHello, and we are expecting a ClientHello, move the receive
- * sequence number forward. This allows for a retried ClientHello if we
- * send a stateless HelloRetryRequest. */
- if (message_seq > ss->ssl3.hs.recvMessageSeq &&
- message_seq == 1 &&
- fragment_offset == 0 &&
- ss->ssl3.hs.ws == wait_client_hello &&
- (SSLHandshakeType)type == ssl_hs_client_hello) {
- SSL_TRC(5, ("%d: DTLS[%d]: Received apparent 2nd ClientHello",
- SSL_GETPID(), ss->fd));
- ss->ssl3.hs.recvMessageSeq = 1;
+ break;
}
/* There are three ways we could not be ready for this packet.
@@ -358,20 +346,20 @@ dtls_HandleHandshake(sslSocket *ss, DTLSEpoch epoch, sslSequenceNumber seqNum,
(fragment_offset == 0) &&
(fragment_length == message_length)) {
/* Complete next message. Process immediately */
- ss->ssl3.hs.msg_type = (SSLHandshakeType)type;
+ ss->ssl3.hs.msg_type = (SSL3HandshakeType)type;
ss->ssl3.hs.msg_len = message_length;
rv = dtls_HandleHandshakeMessage(ss, buf.buf,
buf.len == fragment_length);
if (rv == SECFailure) {
- goto loser;
+ break; /* Discard the remainder of the record. */
}
} else {
if (message_seq < ss->ssl3.hs.recvMessageSeq) {
/* Case 3: we do an immediate retransmit if we're
* in a waiting state. */
rv = dtls_RetransmitDetected(ss);
- goto loser;
+ break;
} else if (message_seq > ss->ssl3.hs.recvMessageSeq) {
/* Case 2
*
@@ -381,12 +369,7 @@ dtls_HandleHandshake(sslSocket *ss, DTLSEpoch epoch, sslSequenceNumber seqNum,
*
* XXX OK for now. Maybe do something smarter at some point?
*/
- SSL_TRC(10, ("%d: SSL3[%d]: dtls_HandleHandshake, discarding handshake message",
- SSL_GETPID(), ss->fd));
- discarded = PR_TRUE;
} else {
- PRInt32 end = fragment_offset + fragment_length;
-
/* Case 1
*
* Buffer the fragment for reassembly
@@ -397,18 +380,18 @@ dtls_HandleHandshake(sslSocket *ss, DTLSEpoch epoch, sslSequenceNumber seqNum,
rv = sslBuffer_Grow(&ss->ssl3.hs.msg_body, message_length);
if (rv != SECSuccess)
- goto loser;
+ break;
/* Make room for the fragment map */
rv = sslBuffer_Grow(&ss->ssl3.hs.recvdFragments,
map_length);
if (rv != SECSuccess)
- goto loser;
+ break;
/* Reset the reassembly map */
ss->ssl3.hs.recvdHighWater = 0;
PORT_Memset(ss->ssl3.hs.recvdFragments.buf, 0,
ss->ssl3.hs.recvdFragments.space);
- ss->ssl3.hs.msg_type = (SSLHandshakeType)type;
+ ss->ssl3.hs.msg_type = (SSL3HandshakeType)type;
ss->ssl3.hs.msg_len = message_length;
}
@@ -420,14 +403,14 @@ dtls_HandleHandshake(sslSocket *ss, DTLSEpoch epoch, sslSequenceNumber seqNum,
ss->ssl3.hs.recvdHighWater = -1;
PORT_SetError(SSL_ERROR_RX_MALFORMED_HANDSHAKE);
rv = SECFailure;
- goto loser;
+ break;
}
- /* Now copy this fragment into the buffer. */
- if (end > ss->ssl3.hs.recvdHighWater) {
- PORT_Memcpy(ss->ssl3.hs.msg_body.buf + fragment_offset,
- buf.buf, fragment_length);
- }
+ /* Now copy this fragment into the buffer */
+ PORT_Assert((fragment_offset + fragment_length) <=
+ ss->ssl3.hs.msg_body.space);
+ PORT_Memcpy(ss->ssl3.hs.msg_body.buf + fragment_offset,
+ buf.buf, fragment_length);
/* This logic is a bit tricky. We have two values for
* reassembly state:
@@ -443,11 +426,12 @@ dtls_HandleHandshake(sslSocket *ss, DTLSEpoch epoch, sslSequenceNumber seqNum,
if (fragment_offset <= (unsigned int)ss->ssl3.hs.recvdHighWater) {
/* Either this is the adjacent fragment or an overlapping
* fragment */
- if (end > ss->ssl3.hs.recvdHighWater) {
- ss->ssl3.hs.recvdHighWater = end;
- }
+ ss->ssl3.hs.recvdHighWater = fragment_offset +
+ fragment_length;
} else {
- for (offset = fragment_offset; offset < end; offset++) {
+ for (offset = fragment_offset;
+ offset < fragment_offset + fragment_length;
+ offset++) {
ss->ssl3.hs.recvdFragments.buf[OFFSET_BYTE(offset)] |=
OFFSET_MASK(offset);
}
@@ -473,7 +457,7 @@ dtls_HandleHandshake(sslSocket *ss, DTLSEpoch epoch, sslSequenceNumber seqNum,
buf.len == fragment_length);
if (rv == SECFailure) {
- goto loser;
+ break; /* Discard the rest of the record. */
}
}
}
@@ -483,26 +467,6 @@ dtls_HandleHandshake(sslSocket *ss, DTLSEpoch epoch, sslSequenceNumber seqNum,
buf.len -= fragment_length;
}
- // This should never happen, but belt and suspenders.
- if (rv == SECFailure) {
- PORT_Assert(0);
- goto loser;
- }
-
- /* If we processed all the fragments in this message, then mark it as remembered.
- * TODO(ekr@rtfm.com): Store out of order messages for DTLS 1.3 so ACKs work
- * better. Bug 1392620.*/
- if (!discarded && tls13_MaybeTls13(ss)) {
- rv = dtls13_RememberFragment(ss, &ss->ssl3.hs.dtlsRcvdHandshake,
- 0, 0, 0, epoch, seqNum);
- }
- if (rv != SECSuccess) {
- goto loser;
- }
-
- rv = dtls13_SetupAcks(ss);
-
-loser:
origBuf->len = 0; /* So ssl3_GatherAppDataRecord will keep looping. */
/* XXX OK for now. In future handle rv == SECWouldBlock safely in order
@@ -596,8 +560,6 @@ dtls_FlushHandshakeMessages(sslSocket *ss, PRInt32 flags)
if (!(flags & ssl_SEND_FLAG_NO_RETRANSMIT)) {
rv = dtls_StartRetransmitTimer(ss);
- } else {
- PORT_Assert(ss->version < SSL_LIBRARY_VERSION_TLS_1_3);
}
}
@@ -614,7 +576,7 @@ static void
dtls_RetransmitTimerExpiredCb(sslSocket *ss)
{
SECStatus rv;
- dtlsTimer *timer = ss->ssl3.hs.rtTimer;
+
ss->ssl3.hs.rtRetries++;
if (!(ss->ssl3.hs.rtRetries % 3)) {
@@ -627,239 +589,175 @@ dtls_RetransmitTimerExpiredCb(sslSocket *ss)
rv = dtls_TransmitMessageFlight(ss);
if (rv == SECSuccess) {
/* Re-arm the timer */
- timer->timeout *= 2;
- if (timer->timeout > DTLS_RETRANSMIT_MAX_MS) {
- timer->timeout = DTLS_RETRANSMIT_MAX_MS;
+ ss->ssl3.hs.rtTimeoutMs *= 2;
+ if (ss->ssl3.hs.rtTimeoutMs > DTLS_RETRANSMIT_MAX_MS) {
+ ss->ssl3.hs.rtTimeoutMs = DTLS_RETRANSMIT_MAX_MS;
}
- timer->started = PR_IntervalNow();
- timer->cb = dtls_RetransmitTimerExpiredCb;
+ ss->ssl3.hs.rtTimerStarted = PR_IntervalNow();
+ ss->ssl3.hs.rtTimerCb = dtls_RetransmitTimerExpiredCb;
SSL_TRC(30,
("%d: SSL3[%d]: Retransmit #%d, next in %d",
SSL_GETPID(), ss->fd,
- ss->ssl3.hs.rtRetries, timer->timeout));
+ ss->ssl3.hs.rtRetries, ss->ssl3.hs.rtTimeoutMs));
}
/* else: OK for now. In future maybe signal the stack that we couldn't
* transmit. For now, let the read handle any real network errors */
}
-#define DTLS_HS_HDR_LEN 12
-#define DTLS_MIN_FRAGMENT (DTLS_HS_HDR_LEN + 1 + DTLS_MAX_EXPANSION)
-
-/* Encrypt and encode a handshake message fragment. Flush the data out to the
- * network if there is insufficient space for any fragment. */
-static SECStatus
-dtls_SendFragment(sslSocket *ss, DTLSQueuedMessage *msg, PRUint8 *data,
- unsigned int len)
-{
- PRInt32 sent;
- SECStatus rv;
-
- PRINT_BUF(40, (ss, "dtls_SendFragment", data, len));
- sent = ssl3_SendRecord(ss, msg->cwSpec, msg->type, data, len,
- ssl_SEND_FLAG_FORCE_INTO_BUFFER);
- if (sent != len) {
- if (sent != -1) {
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- }
- return SECFailure;
- }
-
- /* If another fragment won't fit, flush. */
- if (ss->ssl3.mtu < ss->pendingBuf.len + DTLS_MIN_FRAGMENT) {
- SSL_TRC(20, ("%d: DTLS[%d]: dtls_SendFragment: flush",
- SSL_GETPID(), ss->fd));
- rv = dtls_SendSavedWriteData(ss);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- }
- return SECSuccess;
-}
-
-/* Fragment a handshake message into multiple records and send them. */
-static SECStatus
-dtls_FragmentHandshake(sslSocket *ss, DTLSQueuedMessage *msg)
-{
- PRBool fragmentWritten = PR_FALSE;
- PRUint16 msgSeq;
- PRUint8 *fragment;
- PRUint32 fragmentOffset = 0;
- PRUint32 fragmentLen;
- const PRUint8 *content = msg->data + DTLS_HS_HDR_LEN;
- PRUint32 contentLen = msg->len - DTLS_HS_HDR_LEN;
- SECStatus rv;
-
- /* The headers consume 12 bytes so the smallest possible message (i.e., an
- * empty one) is 12 bytes. */
- PORT_Assert(msg->len >= DTLS_HS_HDR_LEN);
-
- /* DTLS only supports fragmenting handshaking messages. */
- PORT_Assert(msg->type == content_handshake);
-
- msgSeq = (msg->data[4] << 8) | msg->data[5];
-
- /* do {} while() so that empty messages are sent at least once. */
- do {
- PRUint8 buf[DTLS_MAX_MTU]; /* >= than largest plausible MTU */
- PRBool hasUnackedRange;
- PRUint32 end;
-
- hasUnackedRange = dtls_NextUnackedRange(ss, msgSeq,
- fragmentOffset, contentLen,
- &fragmentOffset, &end);
- if (!hasUnackedRange) {
- SSL_TRC(20, ("%d: SSL3[%d]: FragmentHandshake %d: all acknowledged",
- SSL_GETPID(), ss->fd, msgSeq));
- break;
- }
-
- SSL_TRC(20, ("%d: SSL3[%d]: FragmentHandshake %d: unacked=%u-%u",
- SSL_GETPID(), ss->fd, msgSeq, fragmentOffset, end));
-
- /* Cut down to the data we have available. */
- PORT_Assert(fragmentOffset <= contentLen);
- PORT_Assert(fragmentOffset <= end);
- PORT_Assert(end <= contentLen);
- fragmentLen = PR_MIN(end, contentLen) - fragmentOffset;
-
- /* Reduce to the space remaining in the MTU. Allow for any existing
- * messages, record expansion, and the handshake header. */
- fragmentLen = PR_MIN(fragmentLen,
- ss->ssl3.mtu - /* MTU estimate. */
- ss->pendingBuf.len - /* Less unsent records. */
- DTLS_MAX_EXPANSION - /* Allow for expansion. */
- DTLS_HS_HDR_LEN); /* + handshake header. */
- PORT_Assert(fragmentLen > 0 || fragmentOffset == 0);
-
- /* Make totally sure that we will fit in the buffer. This should be
- * impossible; DTLS_MAX_MTU should always be more than ss->ssl3.mtu. */
- if (fragmentLen >= (DTLS_MAX_MTU - DTLS_HS_HDR_LEN)) {
- PORT_Assert(0);
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
- }
-
- if (fragmentLen == contentLen) {
- fragment = msg->data;
- } else {
- sslBuffer tmp = SSL_BUFFER_FIXED(buf, sizeof(buf));
-
- /* Construct an appropriate-sized fragment */
- /* Type, length, sequence */
- rv = sslBuffer_Append(&tmp, msg->data, 6);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- /* Offset. */
- rv = sslBuffer_AppendNumber(&tmp, fragmentOffset, 3);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- /* Length. */
- rv = sslBuffer_AppendNumber(&tmp, fragmentLen, 3);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- /* Data. */
- rv = sslBuffer_Append(&tmp, content + fragmentOffset, fragmentLen);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- fragment = SSL_BUFFER_BASE(&tmp);
- }
-
- /* Record that we are sending first, because encrypting
- * increments the sequence number. */
- rv = dtls13_RememberFragment(ss, &ss->ssl3.hs.dtlsSentHandshake,
- msgSeq, fragmentOffset, fragmentLen,
- msg->cwSpec->epoch,
- msg->cwSpec->seqNum);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- rv = dtls_SendFragment(ss, msg, fragment,
- fragmentLen + DTLS_HS_HDR_LEN);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- fragmentWritten = PR_TRUE;
- fragmentOffset += fragmentLen;
- } while (fragmentOffset < contentLen);
-
- if (!fragmentWritten) {
- /* Nothing was written if we got here, so the whole message must have
- * been acknowledged. Discard it. */
- SSL_TRC(10, ("%d: SSL3[%d]: FragmentHandshake %d: removed",
- SSL_GETPID(), ss->fd, msgSeq));
- PR_REMOVE_LINK(&msg->link);
- dtls_FreeHandshakeMessage(msg);
- }
-
- return SECSuccess;
-}
-
/* Transmit a flight of handshake messages, stuffing them
- * into as few records as seems reasonable.
- *
- * TODO: Space separate UDP packets out a little.
+ * into as few records as seems reasonable
*
* Called from:
* dtls_FlushHandshake()
* dtls_RetransmitTimerExpiredCb()
*/
-SECStatus
+static SECStatus
dtls_TransmitMessageFlight(sslSocket *ss)
{
SECStatus rv = SECSuccess;
PRCList *msg_p;
-
- SSL_TRC(10, ("%d: SSL3[%d]: dtls_TransmitMessageFlight",
- SSL_GETPID(), ss->fd));
+ PRUint16 room_left = ss->ssl3.mtu;
+ PRInt32 sent;
ssl_GetXmitBufLock(ss);
ssl_GetSpecReadLock(ss);
- /* DTLS does not buffer its handshake messages in ss->pendingBuf, but rather
- * in the lastMessageFlight structure. This is just a sanity check that some
- * programming error hasn't inadvertantly stuffed something in
- * ss->pendingBuf. This function uses ss->pendingBuf temporarily and it
- * needs to be empty to start.
+ /* DTLS does not buffer its handshake messages in
+ * ss->pendingBuf, but rather in the lastMessageFlight
+ * structure. This is just a sanity check that
+ * some programming error hasn't inadvertantly
+ * stuffed something in ss->pendingBuf
*/
PORT_Assert(!ss->pendingBuf.len);
-
for (msg_p = PR_LIST_HEAD(&ss->ssl3.hs.lastMessageFlight);
- msg_p != &ss->ssl3.hs.lastMessageFlight;) {
+ msg_p != &ss->ssl3.hs.lastMessageFlight;
+ msg_p = PR_NEXT_LINK(msg_p)) {
DTLSQueuedMessage *msg = (DTLSQueuedMessage *)msg_p;
- /* Move the pointer forward so that the functions below are free to
- * remove messages from the list. */
- msg_p = PR_NEXT_LINK(msg_p);
+ /* The logic here is:
+ *
+ * 1. If this is a message that will not fit into the remaining
+ * space, then flush.
+ * 2. If the message will now fit into the remaining space,
+ * encrypt, buffer, and loop.
+ * 3. If the message will not fit, then fragment.
+ *
+ * At the end of the function, flush.
+ */
+ if ((msg->len + SSL3_BUFFER_FUDGE) > room_left) {
+ /* The message will not fit into the remaining space, so flush */
+ rv = dtls_SendSavedWriteData(ss);
+ if (rv != SECSuccess)
+ break;
+
+ room_left = ss->ssl3.mtu;
+ }
- /* Note: This function fragments messages so that each record is close
- * to full. This produces fewer records, but it means that messages can
- * be quite fragmented. Adding an extra flush here would push new
- * messages into new records and reduce fragmentation. */
+ if ((msg->len + SSL3_BUFFER_FUDGE) <= room_left) {
+ /* The message will fit, so encrypt and then continue with the
+ * next packet */
+ sent = ssl3_SendRecord(ss, msg->cwSpec, msg->type,
+ msg->data, msg->len,
+ ssl_SEND_FLAG_FORCE_INTO_BUFFER);
+ if (sent != msg->len) {
+ rv = SECFailure;
+ if (sent != -1) {
+ PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
+ }
+ break;
+ }
- if (msg->type == content_handshake) {
- rv = dtls_FragmentHandshake(ss, msg);
+ room_left = ss->ssl3.mtu - ss->pendingBuf.len;
} else {
- PORT_Assert(!tls13_MaybeTls13(ss));
- rv = dtls_SendFragment(ss, msg, msg->data, msg->len);
- }
- if (rv != SECSuccess) {
- break;
+ /* The message will not fit, so fragment.
+ *
+ * XXX OK for now. Arrange to coalesce the last fragment
+ * of this message with the next message if possible.
+ * That would be more efficient.
+ */
+ PRUint32 fragment_offset = 0;
+ unsigned char fragment[DTLS_MAX_MTU]; /* >= than largest
+ * plausible MTU */
+
+ /* Assert that we have already flushed */
+ PORT_Assert(room_left == ss->ssl3.mtu);
+
+ /* Case 3: We now need to fragment this message
+ * DTLS only supports fragmenting handshaking messages */
+ PORT_Assert(msg->type == content_handshake);
+
+ /* The headers consume 12 bytes so the smalles possible
+ * message (i.e., an empty one) is 12 bytes
+ */
+ PORT_Assert(msg->len >= 12);
+
+ while ((fragment_offset + 12) < msg->len) {
+ PRUint32 fragment_len;
+ const unsigned char *content = msg->data + 12;
+ PRUint32 content_len = msg->len - 12;
+
+ /* The reason we use 8 here is that that's the length of
+ * the new DTLS data that we add to the header */
+ fragment_len = PR_MIN((PRUint32)room_left - (SSL3_BUFFER_FUDGE + 8),
+ content_len - fragment_offset);
+ PORT_Assert(fragment_len < DTLS_MAX_MTU - 12);
+ /* Make totally sure that we are within the buffer.
+ * Note that the only way that fragment len could get
+ * adjusted here is if
+ *
+ * (a) we are in release mode so the PORT_Assert is compiled out
+ * (b) either the MTU table is inconsistent with DTLS_MAX_MTU
+ * or ss->ssl3.mtu has become corrupt.
+ */
+ fragment_len = PR_MIN(fragment_len, DTLS_MAX_MTU - 12);
+
+ /* Construct an appropriate-sized fragment */
+ /* Type, length, sequence */
+ PORT_Memcpy(fragment, msg->data, 6);
+
+ /* Offset */
+ fragment[6] = (fragment_offset >> 16) & 0xff;
+ fragment[7] = (fragment_offset >> 8) & 0xff;
+ fragment[8] = (fragment_offset)&0xff;
+
+ /* Fragment length */
+ fragment[9] = (fragment_len >> 16) & 0xff;
+ fragment[10] = (fragment_len >> 8) & 0xff;
+ fragment[11] = (fragment_len)&0xff;
+
+ PORT_Memcpy(fragment + 12, content + fragment_offset,
+ fragment_len);
+
+ /*
+ * Send the record. We do this in two stages
+ * 1. Encrypt
+ */
+ sent = ssl3_SendRecord(ss, msg->cwSpec, msg->type,
+ fragment, fragment_len + 12,
+ ssl_SEND_FLAG_FORCE_INTO_BUFFER);
+ if (sent != (fragment_len + 12)) {
+ rv = SECFailure;
+ if (sent != -1) {
+ PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
+ }
+ break;
+ }
+
+ /* 2. Flush */
+ rv = dtls_SendSavedWriteData(ss);
+ if (rv != SECSuccess)
+ break;
+
+ fragment_offset += fragment_len;
+ }
}
}
- /* Finally, flush any data that wasn't flushed already. */
- if (rv == SECSuccess) {
+ /* Finally, we need to flush */
+ if (rv == SECSuccess)
rv = dtls_SendSavedWriteData(ss);
- }
/* Give up the locks */
ssl_ReleaseSpecReadLock(ss);
@@ -898,59 +796,23 @@ dtls_SendSavedWriteData(sslSocket *ss)
return SECSuccess;
}
-void
-dtls_InitTimers(sslSocket *ss)
-{
- unsigned int i;
- dtlsTimer **timers[PR_ARRAY_SIZE(ss->ssl3.hs.timers)] = {
- &ss->ssl3.hs.rtTimer,
- &ss->ssl3.hs.ackTimer,
- &ss->ssl3.hs.hdTimer
- };
- static const char *timerLabels[] = {
- "retransmit", "ack", "holddown"
- };
-
- PORT_Assert(PR_ARRAY_SIZE(timers) == PR_ARRAY_SIZE(timerLabels));
- for (i = 0; i < PR_ARRAY_SIZE(ss->ssl3.hs.timers); ++i) {
- *timers[i] = &ss->ssl3.hs.timers[i];
- ss->ssl3.hs.timers[i].label = timerLabels[i];
- }
-}
-
-SECStatus
-dtls_StartTimer(sslSocket *ss, dtlsTimer *timer, PRUint32 time, DTLSTimerCb cb)
+static SECStatus
+dtls_StartTimer(sslSocket *ss, PRUint32 time, DTLSTimerCb cb)
{
- PORT_Assert(timer->cb == NULL);
-
- SSL_TRC(10, ("%d: SSL3[%d]: %s dtls_StartTimer %s timeout=%d",
- SSL_GETPID(), ss->fd, SSL_ROLE(ss), timer->label, time));
-
- timer->started = PR_IntervalNow();
- timer->timeout = time;
- timer->cb = cb;
- return SECSuccess;
-}
+ PORT_Assert(ss->ssl3.hs.rtTimerCb == NULL);
-SECStatus
-dtls_RestartTimer(sslSocket *ss, dtlsTimer *timer)
-{
- timer->started = PR_IntervalNow();
+ ss->ssl3.hs.rtRetries = 0;
+ ss->ssl3.hs.rtTimerStarted = PR_IntervalNow();
+ ss->ssl3.hs.rtTimeoutMs = time;
+ ss->ssl3.hs.rtTimerCb = cb;
return SECSuccess;
}
-PRBool
-dtls_TimerActive(sslSocket *ss, dtlsTimer *timer)
-{
- return timer->cb != NULL;
-}
/* Start a timer for retransmission. */
static SECStatus
dtls_StartRetransmitTimer(sslSocket *ss)
{
- ss->ssl3.hs.rtRetries = 0;
- return dtls_StartTimer(ss, ss->ssl3.hs.rtTimer,
- DTLS_RETRANSMIT_INITIAL_MS,
+ return dtls_StartTimer(ss, DTLS_RETRANSMIT_INITIAL_MS,
dtls_RetransmitTimerExpiredCb);
}
@@ -958,9 +820,7 @@ dtls_StartRetransmitTimer(sslSocket *ss)
SECStatus
dtls_StartHolddownTimer(sslSocket *ss)
{
- ss->ssl3.hs.rtRetries = 0;
- return dtls_StartTimer(ss, ss->ssl3.hs.rtTimer,
- DTLS_RETRANSMIT_FINISHED_MS,
+ return dtls_StartTimer(ss, DTLS_RETRANSMIT_FINISHED_MS,
dtls_FinishedTimerCb);
}
@@ -971,25 +831,11 @@ dtls_StartHolddownTimer(sslSocket *ss)
* dtls_CheckTimer()
*/
void
-dtls_CancelTimer(sslSocket *ss, dtlsTimer *timer)
+dtls_CancelTimer(sslSocket *ss)
{
- SSL_TRC(30, ("%d: SSL3[%d]: %s dtls_CancelTimer %s",
- SSL_GETPID(), ss->fd, SSL_ROLE(ss),
- timer->label));
-
PORT_Assert(ss->opt.noLocks || ssl_HaveRecvBufLock(ss));
- timer->cb = NULL;
-}
-
-static void
-dtls_CancelAllTimers(sslSocket *ss)
-{
- unsigned int i;
-
- for (i = 0; i < PR_ARRAY_SIZE(ss->ssl3.hs.timers); ++i) {
- dtls_CancelTimer(ss, &ss->ssl3.hs.timers[i]);
- }
+ ss->ssl3.hs.rtTimerCb = NULL;
}
/* Check the pending timer and fire the callback if it expired
@@ -999,33 +845,22 @@ dtls_CancelAllTimers(sslSocket *ss)
void
dtls_CheckTimer(sslSocket *ss)
{
- unsigned int i;
- SSL_TRC(30, ("%d: SSL3[%d]: dtls_CheckTimer (%s)",
- SSL_GETPID(), ss->fd, ss->sec.isServer ? "server" : "client"));
-
ssl_GetSSL3HandshakeLock(ss);
+ if (!ss->ssl3.hs.rtTimerCb) {
+ ssl_ReleaseSSL3HandshakeLock(ss);
+ return;
+ }
- for (i = 0; i < PR_ARRAY_SIZE(ss->ssl3.hs.timers); ++i) {
- dtlsTimer *timer = &ss->ssl3.hs.timers[i];
- if (!timer->cb) {
- continue;
- }
-
- if ((PR_IntervalNow() - timer->started) >=
- PR_MillisecondsToInterval(timer->timeout)) {
- /* Timer has expired */
- DTLSTimerCb cb = timer->cb;
-
- SSL_TRC(10, ("%d: SSL3[%d]: %s firing timer %s",
- SSL_GETPID(), ss->fd, SSL_ROLE(ss),
- timer->label));
+ if ((PR_IntervalNow() - ss->ssl3.hs.rtTimerStarted) >
+ PR_MillisecondsToInterval(ss->ssl3.hs.rtTimeoutMs)) {
+ /* Timer has expired */
+ DTLSTimerCb cb = ss->ssl3.hs.rtTimerCb;
- /* Cancel the timer so that we can call the CB safely */
- dtls_CancelTimer(ss, timer);
+ /* Cancel the timer so that we can call the CB safely */
+ dtls_CancelTimer(ss);
- /* Now call the CB */
- cb(ss);
- }
+ /* Now call the CB */
+ cb(ss);
}
ssl_ReleaseSSL3HandshakeLock(ss);
}
@@ -1039,6 +874,9 @@ static void
dtls_FinishedTimerCb(sslSocket *ss)
{
dtls_FreeHandshakeMessages(&ss->ssl3.hs.lastMessageFlight);
+ if (ss->version < SSL_LIBRARY_VERSION_TLS_1_3) {
+ ssl3_DestroyCipherSpec(ss->ssl3.pwSpec, PR_FALSE);
+ }
}
/* Cancel the Finished hold-down timer and destroy the
@@ -1057,8 +895,8 @@ dtls_RehandshakeCleanup(sslSocket *ss)
return;
}
PORT_Assert((ss->version < SSL_LIBRARY_VERSION_TLS_1_3));
- dtls_CancelAllTimers(ss);
- dtls_FreeHandshakeMessages(&ss->ssl3.hs.lastMessageFlight);
+ dtls_CancelTimer(ss);
+ ssl3_DestroyCipherSpec(ss->ssl3.pwSpec, PR_FALSE);
ss->ssl3.hs.sendMessageSeq = 0;
ss->ssl3.hs.recvMessageSeq = 0;
}
@@ -1121,8 +959,6 @@ dtls_HandleHelloVerifyRequest(sslSocket *ss, PRUint8 *b, PRUint32 length)
goto alert_loser;
}
- dtls_ReceivedFirstMessageInFlight(ss);
-
/* The version.
*
* RFC 4347 required that you verify that the server versions
@@ -1267,53 +1103,27 @@ SECStatus
DTLS_GetHandshakeTimeout(PRFileDesc *socket, PRIntervalTime *timeout)
{
sslSocket *ss = NULL;
- PRBool found = PR_FALSE;
- PRIntervalTime now = PR_IntervalNow();
- PRIntervalTime to;
- unsigned int i;
-
- *timeout = PR_INTERVAL_NO_TIMEOUT;
+ PRIntervalTime elapsed;
+ PRIntervalTime desired;
ss = ssl_FindSocket(socket);
- if (!ss) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
+ if (!ss)
return SECFailure;
- }
- if (!IS_DTLS(ss)) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
+ if (!IS_DTLS(ss))
return SECFailure;
- }
-
- for (i = 0; i < PR_ARRAY_SIZE(ss->ssl3.hs.timers); ++i) {
- PRIntervalTime elapsed;
- PRIntervalTime desired;
- dtlsTimer *timer = &ss->ssl3.hs.timers[i];
-
- if (!timer->cb) {
- continue;
- }
- found = PR_TRUE;
-
- elapsed = now - timer->started;
- desired = PR_MillisecondsToInterval(timer->timeout);
- if (elapsed > desired) {
- /* Timer expired */
- *timeout = PR_INTERVAL_NO_WAIT;
- return SECSuccess;
- } else {
- to = desired - elapsed;
- }
-
- if (*timeout > to) {
- *timeout = to;
- }
- }
- if (!found) {
- PORT_SetError(SSL_ERROR_NO_TIMERS_FOUND);
+ if (!ss->ssl3.hs.rtTimerCb)
return SECFailure;
+
+ elapsed = PR_IntervalNow() - ss->ssl3.hs.rtTimerStarted;
+ desired = PR_MillisecondsToInterval(ss->ssl3.hs.rtTimeoutMs);
+ if (elapsed > desired) {
+ /* Timer expired */
+ *timeout = PR_INTERVAL_NO_WAIT;
+ } else {
+ *timeout = desired - elapsed;
}
return SECSuccess;
@@ -1327,50 +1137,72 @@ DTLS_GetHandshakeTimeout(PRFileDesc *socket, PRIntervalTime *timeout)
* seems like a good tradeoff for implementation effort and is
* consistent with the guidance of RFC 6347 Sections 4.1 and 4.2.4.1.
*
- * If the packet is not relevant, this function returns PR_FALSE. If the packet
- * is relevant, this function returns PR_TRUE and sets |*seqNumOut| to the
- * packet sequence number (removing the epoch).
+ * If the packet is not relevant, this function returns PR_FALSE.
+ * If the packet is relevant, this function returns PR_TRUE
+ * and sets |*seqNum| to the packet sequence number.
*/
PRBool
-dtls_IsRelevant(sslSocket *ss, const ssl3CipherSpec *spec,
- const SSL3Ciphertext *cText,
- sslSequenceNumber *seqNumOut)
+dtls_IsRelevant(sslSocket *ss, const SSL3Ciphertext *cText,
+ PRBool *sameEpoch, PRUint64 *seqNum)
{
- sslSequenceNumber seqNum = cText->seq_num & RECORD_SEQ_MASK;
- if (dtls_RecordGetRecvd(&spec->recvdRecords, seqNum) != 0) {
- SSL_TRC(10, ("%d: SSL3[%d]: dtls_IsRelevant, rejecting "
- "potentially replayed packet",
- SSL_GETPID(), ss->fd));
+ const ssl3CipherSpec *crSpec = ss->ssl3.crSpec;
+ DTLSEpoch epoch;
+ sslSequenceNumber dtls_seq_num;
+
+ epoch = cText->seq_num >> 48;
+ *sameEpoch = crSpec->epoch == epoch;
+ if (!*sameEpoch) {
+ SSL_DBG(("%d: SSL3[%d]: dtls_IsRelevant, received packet "
+ "from irrelevant epoch %d",
+ SSL_GETPID(), ss->fd, epoch));
+ return PR_FALSE;
+ }
+
+ dtls_seq_num = cText->seq_num & RECORD_SEQ_MAX;
+ if (dtls_RecordGetRecvd(&crSpec->recvdRecords, dtls_seq_num) != 0) {
+ SSL_DBG(("%d: SSL3[%d]: dtls_IsRelevant, rejecting "
+ "potentially replayed packet",
+ SSL_GETPID(), ss->fd));
return PR_FALSE;
}
- *seqNumOut = seqNum;
+ *seqNum = dtls_seq_num;
return PR_TRUE;
}
-void
-dtls_ReceivedFirstMessageInFlight(sslSocket *ss)
+/* In TLS 1.3, a client that receives a retransmission of the server's first
+ * flight will reject that message and discard it (see dtls_IsRelevant() above).
+ * However, we need to trigger retransmission to prevent loss of the client's
+ * last flight from causing the connection to fail.
+ *
+ * This only triggers for a retransmitted ServerHello. Other (encrypted)
+ * handshake messages do not trigger retransmission, so we are a little more
+ * exposed to loss than is ideal.
+ *
+ * Note: This isn't an issue in earlier versions because the second-to-last
+ * flight (sent by the server) includes the Finished message, which is not
+ * dropped because it has the same epoch that the client currently expects.
+ */
+SECStatus
+dtls_MaybeRetransmitHandshake(sslSocket *ss, const SSL3Ciphertext *cText,
+ PRBool sameEpoch)
{
- if (!IS_DTLS(ss))
- return;
+ SECStatus rv = SECSuccess;
+ DTLSEpoch messageEpoch = cText->seq_num >> 48;
- /* At this point we are advancing our state machine, so we can free our last
- * flight of messages. */
- if (ss->ssl3.hs.ws != idle_handshake ||
- ss->version >= SSL_LIBRARY_VERSION_TLS_1_3) {
- /* We need to keep our last flight around in DTLS 1.2 and below,
- * so we can retransmit it in response to other people's
- * retransmits. */
- dtls_FreeHandshakeMessages(&ss->ssl3.hs.lastMessageFlight);
-
- /* Reset the timer to the initial value if the retry counter
- * is 0, per RFC 6347, Sec. 4.2.4.1 */
- dtls_CancelTimer(ss, ss->ssl3.hs.rtTimer);
- if (ss->ssl3.hs.rtRetries == 0) {
- ss->ssl3.hs.rtTimer->timeout = DTLS_RETRANSMIT_INITIAL_MS;
- }
+ /* Drop messages from other epochs if we are ignoring things. */
+ if (!sameEpoch && ss->ssl3.hs.zeroRttIgnore != ssl_0rtt_ignore_none) {
+ return SECSuccess;
}
- /* Empty the ACK queue (TLS 1.3 only). */
- ssl_ClearPRCList(&ss->ssl3.hs.dtlsRcvdHandshake, NULL);
+ if (!ss->sec.isServer && ss->version >= SSL_LIBRARY_VERSION_TLS_1_3 &&
+ messageEpoch == 0 && cText->type == content_handshake) {
+ ssl_GetSSL3HandshakeLock(ss);
+ if (ss->ssl3.hs.rtTimerCb == dtls_FinishedTimerCb &&
+ ss->ssl3.hs.ws == idle_handshake) {
+ rv = dtls_RetransmitDetected(ss);
+ }
+ ssl_ReleaseSSL3HandshakeLock(ss);
+ }
+ return rv;
}
diff --git a/security/nss/lib/ssl/dtlscon.h b/security/nss/lib/ssl/dtlscon.h
deleted file mode 100644
index d094380f8c..0000000000
--- a/security/nss/lib/ssl/dtlscon.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is PRIVATE to SSL.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef __dtlscon_h_
-#define __dtlscon_h_
-
-extern void dtls_FreeHandshakeMessage(DTLSQueuedMessage *msg);
-extern void dtls_FreeHandshakeMessages(PRCList *lst);
-SECStatus dtls_TransmitMessageFlight(sslSocket *ss);
-void dtls_InitTimers(sslSocket *ss);
-SECStatus dtls_StartTimer(sslSocket *ss, dtlsTimer *timer,
- PRUint32 time, DTLSTimerCb cb);
-SECStatus dtls_RestartTimer(sslSocket *ss, dtlsTimer *timer);
-PRBool dtls_TimerActive(sslSocket *ss, dtlsTimer *timer);
-extern SECStatus dtls_HandleHandshake(sslSocket *ss, DTLSEpoch epoch,
- sslSequenceNumber seqNum,
- sslBuffer *origBuf);
-extern SECStatus dtls_HandleHelloVerifyRequest(sslSocket *ss,
- PRUint8 *b, PRUint32 length);
-extern SECStatus dtls_StageHandshakeMessage(sslSocket *ss);
-extern SECStatus dtls_QueueMessage(sslSocket *ss, SSL3ContentType type,
- const PRUint8 *pIn, PRInt32 nIn);
-extern SECStatus dtls_FlushHandshakeMessages(sslSocket *ss, PRInt32 flags);
-SECStatus ssl3_DisableNonDTLSSuites(sslSocket *ss);
-extern SECStatus dtls_StartHolddownTimer(sslSocket *ss);
-extern void dtls_CheckTimer(sslSocket *ss);
-extern void dtls_CancelTimer(sslSocket *ss, dtlsTimer *timer);
-extern void dtls_SetMTU(sslSocket *ss, PRUint16 advertised);
-extern void dtls_InitRecvdRecords(DTLSRecvdRecords *records);
-extern int dtls_RecordGetRecvd(const DTLSRecvdRecords *records,
- sslSequenceNumber seq);
-extern void dtls_RecordSetRecvd(DTLSRecvdRecords *records,
- sslSequenceNumber seq);
-extern void dtls_RehandshakeCleanup(sslSocket *ss);
-extern SSL3ProtocolVersion
-dtls_TLSVersionToDTLSVersion(SSL3ProtocolVersion tlsv);
-extern SSL3ProtocolVersion
-dtls_DTLSVersionToTLSVersion(SSL3ProtocolVersion dtlsv);
-extern PRBool dtls_IsRelevant(sslSocket *ss, const ssl3CipherSpec *spec,
- const SSL3Ciphertext *cText,
- sslSequenceNumber *seqNum);
-void dtls_ReceivedFirstMessageInFlight(sslSocket *ss);
-#endif
diff --git a/security/nss/lib/ssl/exports.gyp b/security/nss/lib/ssl/exports.gyp
index c3b34c6cc3..e2123af84c 100644
--- a/security/nss/lib/ssl/exports.gyp
+++ b/security/nss/lib/ssl/exports.gyp
@@ -15,7 +15,6 @@
'preenc.h',
'ssl.h',
'sslerr.h',
- 'sslexp.h',
'sslproto.h',
'sslt.h'
],
diff --git a/security/nss/lib/ssl/manifest.mn b/security/nss/lib/ssl/manifest.mn
index ca9b9ee7bd..fbb88baffa 100644
--- a/security/nss/lib/ssl/manifest.mn
+++ b/security/nss/lib/ssl/manifest.mn
@@ -10,7 +10,6 @@ EXPORTS = \
ssl.h \
sslt.h \
sslerr.h \
- sslexp.h \
sslproto.h \
preenc.h \
$(NULL)
@@ -20,15 +19,13 @@ MAPFILE = $(OBJDIR)/ssl.def
CSRCS = \
dtlscon.c \
- dtls13con.c \
prelib.c \
ssl3con.c \
ssl3gthr.c \
sslauth.c \
- sslbloom.c \
sslcon.c \
ssldef.c \
- sslencode.c \
+ ssl3encode.c \
sslenum.c \
sslerr.c \
sslerrstrs.c \
@@ -41,7 +38,6 @@ CSRCS = \
sslsecur.c \
sslsnce.c \
sslsock.c \
- sslspec.c \
ssltrace.c \
sslver.c \
authcert.c \
@@ -51,9 +47,7 @@ CSRCS = \
ssl3ecc.c \
tls13con.c \
tls13exthandle.c \
- tls13hashstate.c \
tls13hkdf.c \
- tls13replay.c \
sslcert.c \
sslgrp.c \
$(NULL)
diff --git a/security/nss/lib/ssl/selfencrypt.c b/security/nss/lib/ssl/selfencrypt.c
index 97217b4a6c..6d6e25cfc6 100644
--- a/security/nss/lib/ssl/selfencrypt.c
+++ b/security/nss/lib/ssl/selfencrypt.c
@@ -11,6 +11,7 @@
#include "pk11func.h"
#include "ssl.h"
#include "sslt.h"
+#include "ssl3encode.h"
#include "sslimpl.h"
#include "selfencrypt.h"
@@ -120,11 +121,12 @@ ssl_SelfEncryptProtectInt(
PRUint8 *out, unsigned int *outLen, unsigned int maxOutLen)
{
unsigned int len;
- unsigned int lenOffset;
unsigned char iv[AES_BLOCK_SIZE];
SECItem ivItem = { siBuffer, iv, sizeof(iv) };
- /* Write directly to out. */
- sslBuffer buf = SSL_BUFFER_FIXED(out, maxOutLen);
+ unsigned char mac[SHA256_LENGTH]; /* SHA-256 */
+ unsigned int macLen;
+ SECItem outItem = { siBuffer, out, maxOutLen };
+ SECItem lengthBytesItem;
SECStatus rv;
/* Generate a random IV */
@@ -135,54 +137,52 @@ ssl_SelfEncryptProtectInt(
}
/* Add header. */
- rv = sslBuffer_Append(&buf, keyName, SELF_ENCRYPT_KEY_NAME_LEN);
+ rv = ssl3_AppendToItem(&outItem, keyName, SELF_ENCRYPT_KEY_NAME_LEN);
if (rv != SECSuccess) {
return SECFailure;
}
- rv = sslBuffer_Append(&buf, iv, sizeof(iv));
+ rv = ssl3_AppendToItem(&outItem, iv, sizeof(iv));
if (rv != SECSuccess) {
return SECFailure;
}
- /* Leave space for the length of the ciphertext. */
- rv = sslBuffer_Skip(&buf, 2, &lenOffset);
+ /* Skip forward by two so we can encode the ciphertext in place. */
+ lengthBytesItem = outItem;
+ rv = ssl3_AppendNumberToItem(&outItem, 0, 2);
if (rv != SECSuccess) {
return SECFailure;
}
- /* Encode the ciphertext in place. */
rv = PK11_Encrypt(encKey, CKM_AES_CBC_PAD, &ivItem,
- SSL_BUFFER_NEXT(&buf), &len,
- SSL_BUFFER_SPACE(&buf), in, inLen);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- rv = sslBuffer_Skip(&buf, len, NULL);
+ outItem.data, &len, outItem.len, in, inLen);
if (rv != SECSuccess) {
return SECFailure;
}
- rv = sslBuffer_InsertLength(&buf, lenOffset, 2);
+ outItem.data += len;
+ outItem.len -= len;
+
+ /* Now encode the ciphertext length. */
+ rv = ssl3_AppendNumberToItem(&lengthBytesItem, len, 2);
if (rv != SECSuccess) {
return SECFailure;
}
- /* MAC the entire output buffer into the output. */
- PORT_Assert(buf.space - buf.len >= SHA256_LENGTH);
+ /* MAC the entire output buffer and append the MAC to the end. */
rv = ssl_MacBuffer(macKey, CKM_SHA256_HMAC,
- SSL_BUFFER_BASE(&buf), /* input */
- SSL_BUFFER_LEN(&buf),
- SSL_BUFFER_NEXT(&buf), &len, /* output */
- SHA256_LENGTH);
+ out, outItem.data - out,
+ mac, &macLen, sizeof(mac));
if (rv != SECSuccess) {
return SECFailure;
}
- rv = sslBuffer_Skip(&buf, len, NULL);
+ PORT_Assert(macLen == sizeof(mac));
+
+ rv = ssl3_AppendToItem(&outItem, mac, macLen);
if (rv != SECSuccess) {
return SECFailure;
}
- *outLen = SSL_BUFFER_LEN(&buf);
+ *outLen = outItem.data - out;
return SECSuccess;
}
@@ -269,17 +269,6 @@ ssl_SelfEncryptUnprotectInt(
}
#endif
-/* Predict the size of the encrypted data, including padding */
-unsigned int
-ssl_SelfEncryptGetProtectedSize(unsigned int inLen)
-{
- return SELF_ENCRYPT_KEY_NAME_LEN +
- AES_BLOCK_SIZE +
- 2 +
- ((inLen / AES_BLOCK_SIZE) + 1) * AES_BLOCK_SIZE + /* Padded */
- SHA256_LENGTH;
-}
-
SECStatus
ssl_SelfEncryptProtect(
sslSocket *ss, const PRUint8 *in, unsigned int inLen,
diff --git a/security/nss/lib/ssl/selfencrypt.h b/security/nss/lib/ssl/selfencrypt.h
index 5415ac09f3..5bc8e4348a 100644
--- a/security/nss/lib/ssl/selfencrypt.h
+++ b/security/nss/lib/ssl/selfencrypt.h
@@ -11,7 +11,6 @@
#include "secmodt.h"
-unsigned int ssl_SelfEncryptGetProtectedSize(unsigned int inLen);
SECStatus ssl_SelfEncryptProtect(
sslSocket *ss, const PRUint8 *in, unsigned int inLen,
PRUint8 *out, unsigned int *outLen, unsigned int maxOutLen);
diff --git a/security/nss/lib/ssl/ssl.def b/security/nss/lib/ssl/ssl.def
index 9a447dbefa..94d3042239 100644
--- a/security/nss/lib/ssl/ssl.def
+++ b/security/nss/lib/ssl/ssl.def
@@ -234,9 +234,3 @@ SSL_AlertSentCallback;
;+ local:
;+*;
;+};
-;+NSS_3.33 { # NSS 3.33 release
-;+ global:
-SSL_GetExperimentalAPI;
-;+ local:
-;+*;
-;+};
diff --git a/security/nss/lib/ssl/ssl.gyp b/security/nss/lib/ssl/ssl.gyp
index 3694ab91a5..03b2d6014a 100644
--- a/security/nss/lib/ssl/ssl.gyp
+++ b/security/nss/lib/ssl/ssl.gyp
@@ -13,20 +13,18 @@
'authcert.c',
'cmpcert.c',
'dtlscon.c',
- 'dtls13con.c',
'prelib.c',
'selfencrypt.c',
'ssl3con.c',
'ssl3ecc.c',
+ 'ssl3encode.c',
'ssl3ext.c',
'ssl3exthandle.c',
'ssl3gthr.c',
'sslauth.c',
- 'sslbloom.c',
'sslcert.c',
'sslcon.c',
'ssldef.c',
- 'sslencode.c',
'sslenum.c',
'sslerr.c',
'sslerrstrs.c',
@@ -39,14 +37,11 @@
'sslsecur.c',
'sslsnce.c',
'sslsock.c',
- 'sslspec.c',
'ssltrace.c',
'sslver.c',
'tls13con.c',
'tls13exthandle.c',
- 'tls13hashstate.c',
'tls13hkdf.c',
- 'tls13replay.c',
],
'conditions': [
[ 'OS=="win"', {
@@ -62,6 +57,14 @@
'unix_err.c'
],
}],
+ [ 'ssl_enable_zlib==1', {
+ 'dependencies': [
+ '<(DEPTH)/lib/zlib/zlib.gyp:nss_zlib'
+ ],
+ 'defines': [
+ 'NSS_SSL_ENABLE_ZLIB',
+ ],
+ }],
[ 'fuzz_tls==1', {
'defines': [
'UNSAFE_FUZZER_MODE',
diff --git a/security/nss/lib/ssl/ssl.h b/security/nss/lib/ssl/ssl.h
index 25aabbaa21..7e538ac1fc 100644
--- a/security/nss/lib/ssl/ssl.h
+++ b/security/nss/lib/ssl/ssl.h
@@ -107,7 +107,8 @@ SSL_IMPORT PRFileDesc *DTLS_ImportFD(PRFileDesc *model, PRFileDesc *fd);
#define SSL_NO_LOCKS 17 /* Don't use locks for protection */
#define SSL_ENABLE_SESSION_TICKETS 18 /* Enable TLS SessionTicket */
/* extension (off by default) */
-#define SSL_ENABLE_DEFLATE 19 /* (unsupported, deprecated, off) */
+#define SSL_ENABLE_DEFLATE 19 /* Enable TLS compression with */
+ /* DEFLATE (off by default) */
#define SSL_ENABLE_RENEGOTIATION 20 /* Values below (default: never) */
#define SSL_REQUIRE_SAFE_NEGOTIATION 21 /* Peer must send Signaling */
/* Cipher Suite Value (SCSV) or */
@@ -230,46 +231,25 @@ SSL_IMPORT PRFileDesc *DTLS_ImportFD(PRFileDesc *model, PRFileDesc *fd);
* parameters.
*
* The transition between the 0-RTT and 1-RTT modes is marked by the
- * handshake callback. However, it is possible to force the completion
- * of the handshake (and cause the handshake callback to be called)
- * prior to reading all 0-RTT data using SSL_ForceHandshake(). To
- * ensure that all early data is read before the handshake callback, any
- * time that SSL_ForceHandshake() returns a PR_WOULD_BLOCK_ERROR, use
- * PR_Read() to read all available data. If PR_Read() is called
- * multiple times, this will result in the handshake completing, but the
- * handshake callback will occur after early data has all been read.
+ * handshake callback.
*
* WARNING: 0-RTT data has different anti-replay and PFS properties than
- * the rest of the TLS data. See [draft-ietf-tls-tls13; Section 8]
+ * the rest of the TLS data. See [draft-ietf-tls-tls13; Section 6.2.3]
* for more details.
- *
- * Note: when DTLS 1.3 is in use, any 0-RTT data received after EndOfEarlyData
- * (e.g., because of reordering) is discarded.
*/
#define SSL_ENABLE_0RTT_DATA 33
-/* Enables TLS 1.3 compatibility mode. In this mode, the client includes a fake
- * session ID in the handshake and sends a ChangeCipherSpec. A server will
- * always use the setting chosen by the client, so the value of this option has
- * no effect for a server. This setting is ignored for DTLS. */
-#define SSL_ENABLE_TLS13_COMPAT_MODE 35
-
#ifdef SSL_DEPRECATED_FUNCTION
/* Old deprecated function names */
-SSL_IMPORT SECStatus SSL_Enable(PRFileDesc *fd, int option, PRIntn on);
-SSL_IMPORT SECStatus SSL_EnableDefault(int option, PRIntn on);
+SSL_IMPORT SECStatus SSL_Enable(PRFileDesc *fd, int option, PRBool on);
+SSL_IMPORT SECStatus SSL_EnableDefault(int option, PRBool on);
#endif
-/* Set (and get) options for sockets and defaults for newly created sockets.
- *
- * While the |val| parameter of these methods is PRIntn, options only support
- * two values by default: PR_TRUE or PR_FALSE. The documentation of specific
- * options will explain if other values are permitted.
- */
-SSL_IMPORT SECStatus SSL_OptionSet(PRFileDesc *fd, PRInt32 option, PRIntn val);
-SSL_IMPORT SECStatus SSL_OptionGet(PRFileDesc *fd, PRInt32 option, PRIntn *val);
-SSL_IMPORT SECStatus SSL_OptionSetDefault(PRInt32 option, PRIntn val);
-SSL_IMPORT SECStatus SSL_OptionGetDefault(PRInt32 option, PRIntn *val);
+/* New function names */
+SSL_IMPORT SECStatus SSL_OptionSet(PRFileDesc *fd, PRInt32 option, PRBool on);
+SSL_IMPORT SECStatus SSL_OptionGet(PRFileDesc *fd, PRInt32 option, PRBool *on);
+SSL_IMPORT SECStatus SSL_OptionSetDefault(PRInt32 option, PRBool on);
+SSL_IMPORT SECStatus SSL_OptionGetDefault(PRInt32 option, PRBool *on);
SSL_IMPORT SECStatus SSL_CertDBHandleSet(PRFileDesc *fd, CERTCertDBHandle *dbHandle);
/* SSLNextProtoCallback is called during the handshake for the client, when a
@@ -1394,13 +1374,6 @@ extern const char *NSSSSL_GetVersion(void);
*/
SSL_IMPORT SECStatus SSL_AuthCertificateComplete(PRFileDesc *fd,
PRErrorCode error);
-
-/*
- * This is used to access experimental APIs. Don't call this directly. This is
- * used to enable the experimental APIs that are defined in "sslexp.h".
- */
-SSL_IMPORT void *SSL_GetExperimentalAPI(const char *name);
-
SEC_END_PROTOS
#endif /* __ssl_h_ */
diff --git a/security/nss/lib/ssl/ssl3con.c b/security/nss/lib/ssl/ssl3con.c
index 61878ae997..5cbe2bd094 100644
--- a/security/nss/lib/ssl/ssl3con.c
+++ b/security/nss/lib/ssl/ssl3con.c
@@ -34,13 +34,14 @@
#include "blapi.h"
#include <stdio.h>
+#ifdef NSS_SSL_ENABLE_ZLIB
+#include "zlib.h"
+#endif
static PK11SymKey *ssl3_GenerateRSAPMS(sslSocket *ss, ssl3CipherSpec *spec,
PK11SlotInfo *serverKeySlot);
-static SECStatus ssl3_ComputeMasterSecret(sslSocket *ss, PK11SymKey *pms,
- PK11SymKey **msp);
-static SECStatus ssl3_DeriveConnectionKeys(sslSocket *ss,
- PK11SymKey *masterSecret);
+static SECStatus ssl3_DeriveMasterSecret(sslSocket *ss, PK11SymKey *pms);
+static SECStatus ssl3_DeriveConnectionKeys(sslSocket *ss);
static SECStatus ssl3_HandshakeFailure(sslSocket *ss);
static SECStatus ssl3_SendCertificate(sslSocket *ss);
static SECStatus ssl3_SendCertificateRequest(sslSocket *ss);
@@ -50,28 +51,27 @@ static SECStatus ssl3_SendServerHelloDone(sslSocket *ss);
static SECStatus ssl3_SendServerKeyExchange(sslSocket *ss);
static SECStatus ssl3_HandleClientHelloPart2(sslSocket *ss,
SECItem *suites,
- sslSessionID *sid,
- const PRUint8 *msg,
- unsigned int len);
+ SECItem *comps,
+ sslSessionID *sid);
static SECStatus ssl3_HandleServerHelloPart2(sslSocket *ss,
const SECItem *sidBytes,
int *retErrCode);
static SECStatus ssl3_HandlePostHelloHandshakeMessage(sslSocket *ss,
PRUint8 *b,
- PRUint32 length);
+ PRUint32 length,
+ SSL3Hashes *hashesPtr);
static SECStatus ssl3_FlushHandshakeMessages(sslSocket *ss, PRInt32 flags);
+static SECStatus Null_Cipher(void *ctx, unsigned char *output, int *outputLen,
+ int maxOutputLen, const unsigned char *input,
+ int inputLen);
+
static CK_MECHANISM_TYPE ssl3_GetHashMechanismByHashType(SSLHashType hashType);
static CK_MECHANISM_TYPE ssl3_GetMgfMechanismByHashType(SSLHashType hash);
PRBool ssl_IsRsaPssSignatureScheme(SSLSignatureScheme scheme);
-const PRUint8 ssl_hello_retry_random[] = {
- 0xCF, 0x21, 0xAD, 0x74, 0xE5, 0x9A, 0x61, 0x11,
- 0xBE, 0x1D, 0x8C, 0x02, 0x1E, 0x65, 0xB8, 0x91,
- 0xC2, 0xA2, 0x11, 0x16, 0x7A, 0xBB, 0x8C, 0x5E,
- 0x07, 0x9E, 0x09, 0xE2, 0xC8, 0xA8, 0x33, 0x9C
-};
-PR_STATIC_ASSERT(PR_ARRAY_SIZE(ssl_hello_retry_random) == SSL3_RANDOM_LENGTH);
+#define MAX_SEND_BUF_LENGTH 32000 /* watch for 16-bit integer overflow */
+#define MIN_SEND_BUF_LENGTH 4000
/* This list of SSL3 cipher suites is sorted in descending order of
* precedence (desirability). It only includes cipher suites we implement.
@@ -214,6 +214,52 @@ ssl3_CheckCipherSuiteOrderConsistency()
}
#endif
+/* This list of SSL3 compression methods is sorted in descending order of
+ * precedence (desirability). It only includes compression methods we
+ * implement.
+ */
+static const SSLCompressionMethod ssl_compression_methods[] = {
+#ifdef NSS_SSL_ENABLE_ZLIB
+ ssl_compression_deflate,
+#endif
+ ssl_compression_null
+};
+
+static const unsigned int ssl_compression_method_count =
+ PR_ARRAY_SIZE(ssl_compression_methods);
+
+/* compressionEnabled returns true iff the compression algorithm is enabled
+ * for the given SSL socket. */
+static PRBool
+ssl_CompressionEnabled(sslSocket *ss, SSLCompressionMethod compression)
+{
+ SSL3ProtocolVersion version;
+
+ if (compression == ssl_compression_null) {
+ return PR_TRUE; /* Always enabled */
+ }
+ if (ss->sec.isServer) {
+ /* We can't easily check that the client didn't attempt TLS 1.3,
+ * so this will have to do. */
+ PORT_Assert(ss->version < SSL_LIBRARY_VERSION_TLS_1_3);
+ version = ss->version;
+ } else {
+ version = ss->vrange.max;
+ }
+ if (version >= SSL_LIBRARY_VERSION_TLS_1_3) {
+ return PR_FALSE;
+ }
+#ifdef NSS_SSL_ENABLE_ZLIB
+ if (compression == ssl_compression_deflate) {
+ if (IS_DTLS(ss)) {
+ return PR_FALSE;
+ }
+ return ss->opt.enableDeflate;
+ }
+#endif
+ return PR_FALSE;
+}
+
static const /*SSL3ClientCertificateType */ PRUint8 certificate_types[] = {
ct_RSA_sign,
ct_ECDSA_sign,
@@ -222,125 +268,173 @@ static const /*SSL3ClientCertificateType */ PRUint8 certificate_types[] = {
static SSL3Statistics ssl3stats;
+/* Record protection algorithms, indexed by SSL3BulkCipher.
+ *
+ * The |max_records| field (|mr| below) is set to a number that is higher than
+ * recommended in some literature (esp. TLS 1.3) because we currently abort the
+ * connection when this limit is reached and we want to ensure that we only
+ * rarely hit this limit. See bug 1268745 for details.
+ */
+#define MR_MAX RECORD_SEQ_MAX /* 2^48-1 */
+#define MR_128 (0x5aULL << 28) /* For AES and similar. */
+#define MR_LOW (1ULL << 20) /* For weak ciphers. */
+/* clang-format off */
+static const ssl3BulkCipherDef bulk_cipher_defs[] = {
+ /* |--------- Lengths ---------| */
+ /* cipher calg : s : */
+ /* : e b n */
+ /* oid short_name mr : l o */
+ /* k r o t n */
+ /* e e i c a c */
+ /* y t type v k g e */
+ {cipher_null, calg_null, 0, 0, type_stream, 0, 0, 0, 0,
+ SEC_OID_NULL_CIPHER, "NULL", MR_MAX},
+ {cipher_rc4, calg_rc4, 16,16, type_stream, 0, 0, 0, 0,
+ SEC_OID_RC4, "RC4", MR_LOW},
+ {cipher_des, calg_des, 8, 8, type_block, 8, 8, 0, 0,
+ SEC_OID_DES_CBC, "DES-CBC", MR_LOW},
+ {cipher_3des, calg_3des, 24,24, type_block, 8, 8, 0, 0,
+ SEC_OID_DES_EDE3_CBC, "3DES-EDE-CBC", MR_LOW},
+ {cipher_aes_128, calg_aes, 16,16, type_block, 16,16, 0, 0,
+ SEC_OID_AES_128_CBC, "AES-128", MR_128},
+ {cipher_aes_256, calg_aes, 32,32, type_block, 16,16, 0, 0,
+ SEC_OID_AES_256_CBC, "AES-256", MR_128},
+ {cipher_camellia_128, calg_camellia, 16,16, type_block, 16,16, 0, 0,
+ SEC_OID_CAMELLIA_128_CBC, "Camellia-128", MR_128},
+ {cipher_camellia_256, calg_camellia, 32,32, type_block, 16,16, 0, 0,
+ SEC_OID_CAMELLIA_256_CBC, "Camellia-256", MR_128},
+ {cipher_seed, calg_seed, 16,16, type_block, 16,16, 0, 0,
+ SEC_OID_SEED_CBC, "SEED-CBC", MR_128},
+ {cipher_aes_128_gcm, calg_aes_gcm, 16,16, type_aead, 4, 0,16, 8,
+ SEC_OID_AES_128_GCM, "AES-128-GCM", MR_128},
+ {cipher_aes_256_gcm, calg_aes_gcm, 32,32, type_aead, 4, 0,16, 8,
+ SEC_OID_AES_256_GCM, "AES-256-GCM", MR_128},
+ {cipher_chacha20, calg_chacha20, 32,32, type_aead, 12, 0,16, 0,
+ SEC_OID_CHACHA20_POLY1305, "ChaCha20-Poly1305", MR_MAX},
+ {cipher_missing, calg_null, 0, 0, type_stream, 0, 0, 0, 0,
+ SEC_OID_UNKNOWN, "missing", 0U},
+};
+
static const ssl3KEADef kea_defs[] =
- {
- /* indexed by SSL3KeyExchangeAlgorithm */
- /* kea exchKeyType signKeyType authKeyType ephemeral oid */
- { kea_null, ssl_kea_null, nullKey, ssl_auth_null, PR_FALSE, 0 },
- { kea_rsa, ssl_kea_rsa, nullKey, ssl_auth_rsa_decrypt, PR_FALSE, SEC_OID_TLS_RSA },
- { kea_dh_dss, ssl_kea_dh, dsaKey, ssl_auth_dsa, PR_FALSE, SEC_OID_TLS_DH_DSS },
- { kea_dh_rsa, ssl_kea_dh, rsaKey, ssl_auth_rsa_sign, PR_FALSE, SEC_OID_TLS_DH_RSA },
- { kea_dhe_dss, ssl_kea_dh, dsaKey, ssl_auth_dsa, PR_TRUE, SEC_OID_TLS_DHE_DSS },
- { kea_dhe_rsa, ssl_kea_dh, rsaKey, ssl_auth_rsa_sign, PR_TRUE, SEC_OID_TLS_DHE_RSA },
- { kea_dh_anon, ssl_kea_dh, nullKey, ssl_auth_null, PR_TRUE, SEC_OID_TLS_DH_ANON },
- { kea_ecdh_ecdsa, ssl_kea_ecdh, nullKey, ssl_auth_ecdh_ecdsa, PR_FALSE, SEC_OID_TLS_ECDH_ECDSA },
- { kea_ecdhe_ecdsa, ssl_kea_ecdh, ecKey, ssl_auth_ecdsa, PR_TRUE, SEC_OID_TLS_ECDHE_ECDSA },
- { kea_ecdh_rsa, ssl_kea_ecdh, nullKey, ssl_auth_ecdh_rsa, PR_FALSE, SEC_OID_TLS_ECDH_RSA },
- { kea_ecdhe_rsa, ssl_kea_ecdh, rsaKey, ssl_auth_rsa_sign, PR_TRUE, SEC_OID_TLS_ECDHE_RSA },
- { kea_ecdh_anon, ssl_kea_ecdh, nullKey, ssl_auth_null, PR_TRUE, SEC_OID_TLS_ECDH_ANON },
- { kea_ecdhe_psk, ssl_kea_ecdh_psk, nullKey, ssl_auth_psk, PR_TRUE, SEC_OID_TLS_ECDHE_PSK },
- { kea_dhe_psk, ssl_kea_dh_psk, nullKey, ssl_auth_psk, PR_TRUE, SEC_OID_TLS_DHE_PSK },
- { kea_tls13_any, ssl_kea_tls13_any, nullKey, ssl_auth_tls13_any, PR_TRUE, SEC_OID_TLS13_KEA_ANY },
- };
+{ /* indexed by SSL3KeyExchangeAlgorithm */
+ /* kea exchKeyType signKeyType authKeyType ephemeral oid */
+ {kea_null, ssl_kea_null, nullKey, ssl_auth_null, PR_FALSE, 0},
+ {kea_rsa, ssl_kea_rsa, nullKey, ssl_auth_rsa_decrypt, PR_FALSE, SEC_OID_TLS_RSA},
+ {kea_dh_dss, ssl_kea_dh, dsaKey, ssl_auth_dsa, PR_FALSE, SEC_OID_TLS_DH_DSS},
+ {kea_dh_rsa, ssl_kea_dh, rsaKey, ssl_auth_rsa_sign, PR_FALSE, SEC_OID_TLS_DH_RSA},
+ {kea_dhe_dss, ssl_kea_dh, dsaKey, ssl_auth_dsa, PR_TRUE, SEC_OID_TLS_DHE_DSS},
+ {kea_dhe_rsa, ssl_kea_dh, rsaKey, ssl_auth_rsa_sign, PR_TRUE, SEC_OID_TLS_DHE_RSA},
+ {kea_dh_anon, ssl_kea_dh, nullKey, ssl_auth_null, PR_TRUE, SEC_OID_TLS_DH_ANON},
+ {kea_ecdh_ecdsa, ssl_kea_ecdh, nullKey, ssl_auth_ecdh_ecdsa, PR_FALSE, SEC_OID_TLS_ECDH_ECDSA},
+ {kea_ecdhe_ecdsa, ssl_kea_ecdh, ecKey, ssl_auth_ecdsa, PR_TRUE, SEC_OID_TLS_ECDHE_ECDSA},
+ {kea_ecdh_rsa, ssl_kea_ecdh, nullKey, ssl_auth_ecdh_rsa, PR_FALSE, SEC_OID_TLS_ECDH_RSA},
+ {kea_ecdhe_rsa, ssl_kea_ecdh, rsaKey, ssl_auth_rsa_sign, PR_TRUE, SEC_OID_TLS_ECDHE_RSA},
+ {kea_ecdh_anon, ssl_kea_ecdh, nullKey, ssl_auth_null, PR_TRUE, SEC_OID_TLS_ECDH_ANON},
+ {kea_ecdhe_psk, ssl_kea_ecdh_psk, nullKey, ssl_auth_psk, PR_TRUE, SEC_OID_TLS_ECDHE_PSK},
+ {kea_dhe_psk, ssl_kea_dh_psk, nullKey, ssl_auth_psk, PR_TRUE, SEC_OID_TLS_DHE_PSK},
+ {kea_tls13_any, ssl_kea_tls13_any, nullKey, ssl_auth_tls13_any, PR_TRUE, SEC_OID_TLS13_KEA_ANY},
+};
/* must use ssl_LookupCipherSuiteDef to access */
static const ssl3CipherSuiteDef cipher_suite_defs[] =
- {
- /* cipher_suite bulk_cipher_alg mac_alg key_exchange_alg prf_hash */
- /* Note that the prf_hash_alg is the hash function used by the PRF, see sslimpl.h. */
-
- { TLS_NULL_WITH_NULL_NULL, cipher_null, ssl_mac_null, kea_null, ssl_hash_none },
- { TLS_RSA_WITH_NULL_MD5, cipher_null, ssl_mac_md5, kea_rsa, ssl_hash_none },
- { TLS_RSA_WITH_NULL_SHA, cipher_null, ssl_mac_sha, kea_rsa, ssl_hash_none },
- { TLS_RSA_WITH_NULL_SHA256, cipher_null, ssl_hmac_sha256, kea_rsa, ssl_hash_sha256 },
- { TLS_RSA_WITH_RC4_128_MD5, cipher_rc4, ssl_mac_md5, kea_rsa, ssl_hash_none },
- { TLS_RSA_WITH_RC4_128_SHA, cipher_rc4, ssl_mac_sha, kea_rsa, ssl_hash_none },
- { TLS_RSA_WITH_DES_CBC_SHA, cipher_des, ssl_mac_sha, kea_rsa, ssl_hash_none },
- { TLS_RSA_WITH_3DES_EDE_CBC_SHA, cipher_3des, ssl_mac_sha, kea_rsa, ssl_hash_none },
- { TLS_DHE_DSS_WITH_DES_CBC_SHA, cipher_des, ssl_mac_sha, kea_dhe_dss, ssl_hash_none },
- { TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA,
- cipher_3des, ssl_mac_sha, kea_dhe_dss, ssl_hash_none },
- { TLS_DHE_DSS_WITH_RC4_128_SHA, cipher_rc4, ssl_mac_sha, kea_dhe_dss, ssl_hash_none },
- { TLS_DHE_RSA_WITH_DES_CBC_SHA, cipher_des, ssl_mac_sha, kea_dhe_rsa, ssl_hash_none },
- { TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA,
- cipher_3des, ssl_mac_sha, kea_dhe_rsa, ssl_hash_none },
-
- /* New TLS cipher suites */
- { TLS_RSA_WITH_AES_128_CBC_SHA, cipher_aes_128, ssl_mac_sha, kea_rsa, ssl_hash_none },
- { TLS_RSA_WITH_AES_128_CBC_SHA256, cipher_aes_128, ssl_hmac_sha256, kea_rsa, ssl_hash_sha256 },
- { TLS_DHE_DSS_WITH_AES_128_CBC_SHA, cipher_aes_128, ssl_mac_sha, kea_dhe_dss, ssl_hash_none },
- { TLS_DHE_RSA_WITH_AES_128_CBC_SHA, cipher_aes_128, ssl_mac_sha, kea_dhe_rsa, ssl_hash_none },
- { TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, cipher_aes_128, ssl_hmac_sha256, kea_dhe_rsa, ssl_hash_sha256 },
- { TLS_RSA_WITH_AES_256_CBC_SHA, cipher_aes_256, ssl_mac_sha, kea_rsa, ssl_hash_none },
- { TLS_RSA_WITH_AES_256_CBC_SHA256, cipher_aes_256, ssl_hmac_sha256, kea_rsa, ssl_hash_sha256 },
- { TLS_DHE_DSS_WITH_AES_256_CBC_SHA, cipher_aes_256, ssl_mac_sha, kea_dhe_dss, ssl_hash_none },
- { TLS_DHE_RSA_WITH_AES_256_CBC_SHA, cipher_aes_256, ssl_mac_sha, kea_dhe_rsa, ssl_hash_none },
- { TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, cipher_aes_256, ssl_hmac_sha256, kea_dhe_rsa, ssl_hash_sha256 },
- { TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, cipher_aes_256_gcm, ssl_mac_aead, kea_dhe_rsa, ssl_hash_sha384 },
-
- { TLS_RSA_WITH_SEED_CBC_SHA, cipher_seed, ssl_mac_sha, kea_rsa, ssl_hash_none },
-
- { TLS_RSA_WITH_CAMELLIA_128_CBC_SHA, cipher_camellia_128, ssl_mac_sha, kea_rsa, ssl_hash_none },
- { TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA,
- cipher_camellia_128, ssl_mac_sha, kea_dhe_dss, ssl_hash_none },
- { TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA,
- cipher_camellia_128, ssl_mac_sha, kea_dhe_rsa, ssl_hash_none },
- { TLS_RSA_WITH_CAMELLIA_256_CBC_SHA, cipher_camellia_256, ssl_mac_sha, kea_rsa, ssl_hash_none },
- { TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA,
- cipher_camellia_256, ssl_mac_sha, kea_dhe_dss, ssl_hash_none },
- { TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA,
- cipher_camellia_256, ssl_mac_sha, kea_dhe_rsa, ssl_hash_none },
-
- { TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, cipher_aes_128_gcm, ssl_mac_aead, kea_dhe_rsa, ssl_hash_sha256 },
- { TLS_RSA_WITH_AES_128_GCM_SHA256, cipher_aes_128_gcm, ssl_mac_aead, kea_rsa, ssl_hash_sha256 },
-
- { TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, cipher_aes_128_gcm, ssl_mac_aead, kea_ecdhe_rsa, ssl_hash_sha256 },
- { TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, cipher_aes_128_gcm, ssl_mac_aead, kea_ecdhe_ecdsa, ssl_hash_sha256 },
- { TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, cipher_aes_256_gcm, ssl_mac_aead, kea_ecdhe_ecdsa, ssl_hash_sha384 },
- { TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, cipher_aes_256_gcm, ssl_mac_aead, kea_ecdhe_rsa, ssl_hash_sha384 },
- { TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, cipher_aes_256, ssl_hmac_sha384, kea_ecdhe_ecdsa, ssl_hash_sha384 },
- { TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, cipher_aes_256, ssl_hmac_sha384, kea_ecdhe_rsa, ssl_hash_sha384 },
- { TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, cipher_aes_128_gcm, ssl_mac_aead, kea_dhe_dss, ssl_hash_sha256 },
- { TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, cipher_aes_128, ssl_hmac_sha256, kea_dhe_dss, ssl_hash_sha256 },
- { TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, cipher_aes_256, ssl_hmac_sha256, kea_dhe_dss, ssl_hash_sha256 },
- { TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, cipher_aes_256_gcm, ssl_mac_aead, kea_dhe_dss, ssl_hash_sha384 },
- { TLS_RSA_WITH_AES_256_GCM_SHA384, cipher_aes_256_gcm, ssl_mac_aead, kea_rsa, ssl_hash_sha384 },
-
- { TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256, cipher_chacha20, ssl_mac_aead, kea_dhe_rsa, ssl_hash_sha256 },
-
- { TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, cipher_chacha20, ssl_mac_aead, kea_ecdhe_rsa, ssl_hash_sha256 },
- { TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, cipher_chacha20, ssl_mac_aead, kea_ecdhe_ecdsa, ssl_hash_sha256 },
-
- { TLS_ECDH_ECDSA_WITH_NULL_SHA, cipher_null, ssl_mac_sha, kea_ecdh_ecdsa, ssl_hash_none },
- { TLS_ECDH_ECDSA_WITH_RC4_128_SHA, cipher_rc4, ssl_mac_sha, kea_ecdh_ecdsa, ssl_hash_none },
- { TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA, cipher_3des, ssl_mac_sha, kea_ecdh_ecdsa, ssl_hash_none },
- { TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, cipher_aes_128, ssl_mac_sha, kea_ecdh_ecdsa, ssl_hash_none },
- { TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, cipher_aes_256, ssl_mac_sha, kea_ecdh_ecdsa, ssl_hash_none },
-
- { TLS_ECDHE_ECDSA_WITH_NULL_SHA, cipher_null, ssl_mac_sha, kea_ecdhe_ecdsa, ssl_hash_none },
- { TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, cipher_rc4, ssl_mac_sha, kea_ecdhe_ecdsa, ssl_hash_none },
- { TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA, cipher_3des, ssl_mac_sha, kea_ecdhe_ecdsa, ssl_hash_none },
- { TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, cipher_aes_128, ssl_mac_sha, kea_ecdhe_ecdsa, ssl_hash_none },
- { TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, cipher_aes_128, ssl_hmac_sha256, kea_ecdhe_ecdsa, ssl_hash_sha256 },
- { TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, cipher_aes_256, ssl_mac_sha, kea_ecdhe_ecdsa, ssl_hash_none },
-
- { TLS_ECDH_RSA_WITH_NULL_SHA, cipher_null, ssl_mac_sha, kea_ecdh_rsa, ssl_hash_none },
- { TLS_ECDH_RSA_WITH_RC4_128_SHA, cipher_rc4, ssl_mac_sha, kea_ecdh_rsa, ssl_hash_none },
- { TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA, cipher_3des, ssl_mac_sha, kea_ecdh_rsa, ssl_hash_none },
- { TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, cipher_aes_128, ssl_mac_sha, kea_ecdh_rsa, ssl_hash_none },
- { TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, cipher_aes_256, ssl_mac_sha, kea_ecdh_rsa, ssl_hash_none },
-
- { TLS_ECDHE_RSA_WITH_NULL_SHA, cipher_null, ssl_mac_sha, kea_ecdhe_rsa, ssl_hash_none },
- { TLS_ECDHE_RSA_WITH_RC4_128_SHA, cipher_rc4, ssl_mac_sha, kea_ecdhe_rsa, ssl_hash_none },
- { TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, cipher_3des, ssl_mac_sha, kea_ecdhe_rsa, ssl_hash_none },
- { TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, cipher_aes_128, ssl_mac_sha, kea_ecdhe_rsa, ssl_hash_none },
- { TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, cipher_aes_128, ssl_hmac_sha256, kea_ecdhe_rsa, ssl_hash_sha256 },
- { TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, cipher_aes_256, ssl_mac_sha, kea_ecdhe_rsa, ssl_hash_none },
-
- { TLS_AES_128_GCM_SHA256, cipher_aes_128_gcm, ssl_mac_aead, kea_tls13_any, ssl_hash_sha256 },
- { TLS_CHACHA20_POLY1305_SHA256, cipher_chacha20, ssl_mac_aead, kea_tls13_any, ssl_hash_sha256 },
- { TLS_AES_256_GCM_SHA384, cipher_aes_256_gcm, ssl_mac_aead, kea_tls13_any, ssl_hash_sha384 },
- };
+{
+/* cipher_suite bulk_cipher_alg mac_alg key_exchange_alg prf_hash */
+/* Note that the prf_hash_alg is the hash function used by the PRF, see sslimpl.h. */
+
+ {TLS_NULL_WITH_NULL_NULL, cipher_null, mac_null, kea_null, ssl_hash_none},
+ {TLS_RSA_WITH_NULL_MD5, cipher_null, mac_md5, kea_rsa, ssl_hash_none},
+ {TLS_RSA_WITH_NULL_SHA, cipher_null, mac_sha, kea_rsa, ssl_hash_none},
+ {TLS_RSA_WITH_NULL_SHA256, cipher_null, hmac_sha256, kea_rsa, ssl_hash_sha256},
+ {TLS_RSA_WITH_RC4_128_MD5, cipher_rc4, mac_md5, kea_rsa, ssl_hash_none},
+ {TLS_RSA_WITH_RC4_128_SHA, cipher_rc4, mac_sha, kea_rsa, ssl_hash_none},
+ {TLS_RSA_WITH_DES_CBC_SHA, cipher_des, mac_sha, kea_rsa, ssl_hash_none},
+ {TLS_RSA_WITH_3DES_EDE_CBC_SHA, cipher_3des, mac_sha, kea_rsa, ssl_hash_none},
+ {TLS_DHE_DSS_WITH_DES_CBC_SHA, cipher_des, mac_sha, kea_dhe_dss, ssl_hash_none},
+ {TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA,
+ cipher_3des, mac_sha, kea_dhe_dss, ssl_hash_none},
+ {TLS_DHE_DSS_WITH_RC4_128_SHA, cipher_rc4, mac_sha, kea_dhe_dss, ssl_hash_none},
+ {TLS_DHE_RSA_WITH_DES_CBC_SHA, cipher_des, mac_sha, kea_dhe_rsa, ssl_hash_none},
+ {TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA,
+ cipher_3des, mac_sha, kea_dhe_rsa, ssl_hash_none},
+
+
+/* New TLS cipher suites */
+ {TLS_RSA_WITH_AES_128_CBC_SHA, cipher_aes_128, mac_sha, kea_rsa, ssl_hash_none},
+ {TLS_RSA_WITH_AES_128_CBC_SHA256, cipher_aes_128, hmac_sha256, kea_rsa, ssl_hash_sha256},
+ {TLS_DHE_DSS_WITH_AES_128_CBC_SHA, cipher_aes_128, mac_sha, kea_dhe_dss, ssl_hash_none},
+ {TLS_DHE_RSA_WITH_AES_128_CBC_SHA, cipher_aes_128, mac_sha, kea_dhe_rsa, ssl_hash_none},
+ {TLS_DHE_RSA_WITH_AES_128_CBC_SHA256, cipher_aes_128, hmac_sha256, kea_dhe_rsa, ssl_hash_sha256},
+ {TLS_RSA_WITH_AES_256_CBC_SHA, cipher_aes_256, mac_sha, kea_rsa, ssl_hash_none},
+ {TLS_RSA_WITH_AES_256_CBC_SHA256, cipher_aes_256, hmac_sha256, kea_rsa, ssl_hash_sha256},
+ {TLS_DHE_DSS_WITH_AES_256_CBC_SHA, cipher_aes_256, mac_sha, kea_dhe_dss, ssl_hash_none},
+ {TLS_DHE_RSA_WITH_AES_256_CBC_SHA, cipher_aes_256, mac_sha, kea_dhe_rsa, ssl_hash_none},
+ {TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, cipher_aes_256, hmac_sha256, kea_dhe_rsa, ssl_hash_sha256},
+ {TLS_DHE_RSA_WITH_AES_256_GCM_SHA384, cipher_aes_256_gcm, mac_aead, kea_dhe_rsa, ssl_hash_sha384},
+
+ {TLS_RSA_WITH_SEED_CBC_SHA, cipher_seed, mac_sha, kea_rsa, ssl_hash_none},
+
+ {TLS_RSA_WITH_CAMELLIA_128_CBC_SHA, cipher_camellia_128, mac_sha, kea_rsa, ssl_hash_none},
+ {TLS_DHE_DSS_WITH_CAMELLIA_128_CBC_SHA,
+ cipher_camellia_128, mac_sha, kea_dhe_dss, ssl_hash_none},
+ {TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA,
+ cipher_camellia_128, mac_sha, kea_dhe_rsa, ssl_hash_none},
+ {TLS_RSA_WITH_CAMELLIA_256_CBC_SHA, cipher_camellia_256, mac_sha, kea_rsa, ssl_hash_none},
+ {TLS_DHE_DSS_WITH_CAMELLIA_256_CBC_SHA,
+ cipher_camellia_256, mac_sha, kea_dhe_dss, ssl_hash_none},
+ {TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA,
+ cipher_camellia_256, mac_sha, kea_dhe_rsa, ssl_hash_none},
+
+ {TLS_DHE_RSA_WITH_AES_128_GCM_SHA256, cipher_aes_128_gcm, mac_aead, kea_dhe_rsa, ssl_hash_sha256},
+ {TLS_RSA_WITH_AES_128_GCM_SHA256, cipher_aes_128_gcm, mac_aead, kea_rsa, ssl_hash_sha256},
+
+ {TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256, cipher_aes_128_gcm, mac_aead, kea_ecdhe_rsa, ssl_hash_sha256},
+ {TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256, cipher_aes_128_gcm, mac_aead, kea_ecdhe_ecdsa, ssl_hash_sha256},
+ {TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384, cipher_aes_256_gcm, mac_aead, kea_ecdhe_ecdsa, ssl_hash_sha384},
+ {TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, cipher_aes_256_gcm, mac_aead, kea_ecdhe_rsa, ssl_hash_sha384},
+ {TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384, cipher_aes_256, hmac_sha384, kea_ecdhe_ecdsa, ssl_hash_sha384},
+ {TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, cipher_aes_256, hmac_sha384, kea_ecdhe_rsa, ssl_hash_sha384},
+ {TLS_DHE_DSS_WITH_AES_128_GCM_SHA256, cipher_aes_128_gcm, mac_aead, kea_dhe_dss, ssl_hash_sha256},
+ {TLS_DHE_DSS_WITH_AES_128_CBC_SHA256, cipher_aes_128, hmac_sha256, kea_dhe_dss, ssl_hash_sha256},
+ {TLS_DHE_DSS_WITH_AES_256_CBC_SHA256, cipher_aes_256, hmac_sha256, kea_dhe_dss, ssl_hash_sha256},
+ {TLS_DHE_DSS_WITH_AES_256_GCM_SHA384, cipher_aes_256_gcm, mac_aead, kea_dhe_dss, ssl_hash_sha384},
+ {TLS_RSA_WITH_AES_256_GCM_SHA384, cipher_aes_256_gcm, mac_aead, kea_rsa, ssl_hash_sha384},
+
+ {TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256, cipher_chacha20, mac_aead, kea_dhe_rsa, ssl_hash_sha256},
+
+ {TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256, cipher_chacha20, mac_aead, kea_ecdhe_rsa, ssl_hash_sha256},
+ {TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256, cipher_chacha20, mac_aead, kea_ecdhe_ecdsa, ssl_hash_sha256},
+
+ {TLS_ECDH_ECDSA_WITH_NULL_SHA, cipher_null, mac_sha, kea_ecdh_ecdsa, ssl_hash_none},
+ {TLS_ECDH_ECDSA_WITH_RC4_128_SHA, cipher_rc4, mac_sha, kea_ecdh_ecdsa, ssl_hash_none},
+ {TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA, cipher_3des, mac_sha, kea_ecdh_ecdsa, ssl_hash_none},
+ {TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA, cipher_aes_128, mac_sha, kea_ecdh_ecdsa, ssl_hash_none},
+ {TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA, cipher_aes_256, mac_sha, kea_ecdh_ecdsa, ssl_hash_none},
+
+ {TLS_ECDHE_ECDSA_WITH_NULL_SHA, cipher_null, mac_sha, kea_ecdhe_ecdsa, ssl_hash_none},
+ {TLS_ECDHE_ECDSA_WITH_RC4_128_SHA, cipher_rc4, mac_sha, kea_ecdhe_ecdsa, ssl_hash_none},
+ {TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA, cipher_3des, mac_sha, kea_ecdhe_ecdsa, ssl_hash_none},
+ {TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA, cipher_aes_128, mac_sha, kea_ecdhe_ecdsa, ssl_hash_none},
+ {TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256, cipher_aes_128, hmac_sha256, kea_ecdhe_ecdsa, ssl_hash_sha256},
+ {TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA, cipher_aes_256, mac_sha, kea_ecdhe_ecdsa, ssl_hash_none},
+
+ {TLS_ECDH_RSA_WITH_NULL_SHA, cipher_null, mac_sha, kea_ecdh_rsa, ssl_hash_none},
+ {TLS_ECDH_RSA_WITH_RC4_128_SHA, cipher_rc4, mac_sha, kea_ecdh_rsa, ssl_hash_none},
+ {TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA, cipher_3des, mac_sha, kea_ecdh_rsa, ssl_hash_none},
+ {TLS_ECDH_RSA_WITH_AES_128_CBC_SHA, cipher_aes_128, mac_sha, kea_ecdh_rsa, ssl_hash_none},
+ {TLS_ECDH_RSA_WITH_AES_256_CBC_SHA, cipher_aes_256, mac_sha, kea_ecdh_rsa, ssl_hash_none},
+
+ {TLS_ECDHE_RSA_WITH_NULL_SHA, cipher_null, mac_sha, kea_ecdhe_rsa, ssl_hash_none},
+ {TLS_ECDHE_RSA_WITH_RC4_128_SHA, cipher_rc4, mac_sha, kea_ecdhe_rsa, ssl_hash_none},
+ {TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA, cipher_3des, mac_sha, kea_ecdhe_rsa, ssl_hash_none},
+ {TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA, cipher_aes_128, mac_sha, kea_ecdhe_rsa, ssl_hash_none},
+ {TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256, cipher_aes_128, hmac_sha256, kea_ecdhe_rsa, ssl_hash_sha256},
+ {TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA, cipher_aes_256, mac_sha, kea_ecdhe_rsa, ssl_hash_none},
+
+ {TLS_AES_128_GCM_SHA256, cipher_aes_128_gcm, mac_aead, kea_tls13_any, ssl_hash_sha256},
+ {TLS_CHACHA20_POLY1305_SHA256, cipher_chacha20, mac_aead, kea_tls13_any, ssl_hash_sha256},
+ {TLS_AES_256_GCM_SHA384, cipher_aes_256_gcm, mac_aead, kea_tls13_any, ssl_hash_sha384},
+};
+/* clang-format on */
static const CK_MECHANISM_TYPE auth_alg_defs[] = {
CKM_INVALID_MECHANISM, /* ssl_auth_null */
@@ -377,20 +471,44 @@ typedef struct SSLCipher2MechStr {
/* indexed by type SSLCipherAlgorithm */
static const SSLCipher2Mech alg2Mech[] = {
/* calg, cmech */
- { ssl_calg_null, CKM_INVALID_MECHANISM },
- { ssl_calg_rc4, CKM_RC4 },
- { ssl_calg_rc2, CKM_RC2_CBC },
- { ssl_calg_des, CKM_DES_CBC },
- { ssl_calg_3des, CKM_DES3_CBC },
- { ssl_calg_idea, CKM_IDEA_CBC },
- { ssl_calg_fortezza, CKM_SKIPJACK_CBC64 },
- { ssl_calg_aes, CKM_AES_CBC },
- { ssl_calg_camellia, CKM_CAMELLIA_CBC },
- { ssl_calg_seed, CKM_SEED_CBC },
- { ssl_calg_aes_gcm, CKM_AES_GCM },
- { ssl_calg_chacha20, CKM_NSS_CHACHA20_POLY1305 },
+ { calg_null, (CK_MECHANISM_TYPE)0x80000000L },
+ { calg_rc4, CKM_RC4 },
+ { calg_rc2, CKM_RC2_CBC },
+ { calg_des, CKM_DES_CBC },
+ { calg_3des, CKM_DES3_CBC },
+ { calg_idea, CKM_IDEA_CBC },
+ { calg_fortezza, CKM_SKIPJACK_CBC64 },
+ { calg_aes, CKM_AES_CBC },
+ { calg_camellia, CKM_CAMELLIA_CBC },
+ { calg_seed, CKM_SEED_CBC },
+ { calg_aes_gcm, CKM_AES_GCM },
+ { calg_chacha20, CKM_NSS_CHACHA20_POLY1305 },
+ /* { calg_init , (CK_MECHANISM_TYPE)0x7fffffffL } */
};
+#define mmech_invalid (CK_MECHANISM_TYPE)0x80000000L
+#define mmech_md5 CKM_SSL3_MD5_MAC
+#define mmech_sha CKM_SSL3_SHA1_MAC
+#define mmech_md5_hmac CKM_MD5_HMAC
+#define mmech_sha_hmac CKM_SHA_1_HMAC
+#define mmech_sha256_hmac CKM_SHA256_HMAC
+#define mmech_sha384_hmac CKM_SHA384_HMAC
+
+/* clang-format off */
+static const ssl3MACDef mac_defs[] = { /* indexed by SSL3MACAlgorithm */
+ /* pad_size is only used for SSL 3.0 MAC. See RFC 6101 Sec. 5.2.3.1. */
+ /* mac mmech pad_size mac_size */
+ { mac_null, mmech_invalid, 0, 0 , 0},
+ { mac_md5, mmech_md5, 48, MD5_LENGTH, SEC_OID_HMAC_MD5 },
+ { mac_sha, mmech_sha, 40, SHA1_LENGTH, SEC_OID_HMAC_SHA1},
+ {hmac_md5, mmech_md5_hmac, 0, MD5_LENGTH, SEC_OID_HMAC_MD5},
+ {hmac_sha, mmech_sha_hmac, 0, SHA1_LENGTH, SEC_OID_HMAC_SHA1},
+ {hmac_sha256, mmech_sha256_hmac, 0, SHA256_LENGTH, SEC_OID_HMAC_SHA256},
+ { mac_aead, mmech_invalid, 0, 0, 0 },
+ {hmac_sha384, mmech_sha384_hmac, 0, SHA384_LENGTH, SEC_OID_HMAC_SHA384}
+};
+/* clang-format on */
+
const PRUint8 tls13_downgrade_random[] = { 0x44, 0x4F, 0x57, 0x4E,
0x47, 0x52, 0x44, 0x01 };
const PRUint8 tls12_downgrade_random[] = { 0x44, 0x4F, 0x57, 0x4E,
@@ -436,57 +554,48 @@ ssl3_DecodeHandshakeType(int msgType)
static char line[40];
switch (msgType) {
- case ssl_hs_hello_request:
+ case hello_request:
rv = "hello_request (0)";
break;
- case ssl_hs_client_hello:
+ case client_hello:
rv = "client_hello (1)";
break;
- case ssl_hs_server_hello:
+ case server_hello:
rv = "server_hello (2)";
break;
- case ssl_hs_hello_verify_request:
+ case hello_verify_request:
rv = "hello_verify_request (3)";
break;
- case ssl_hs_new_session_ticket:
- rv = "new_session_ticket (4)";
- break;
- case ssl_hs_end_of_early_data:
- rv = "end_of_early_data (5)";
+ case new_session_ticket:
+ rv = "session_ticket (4)";
break;
- case ssl_hs_hello_retry_request:
+ case hello_retry_request:
rv = "hello_retry_request (6)";
break;
- case ssl_hs_encrypted_extensions:
+ case encrypted_extensions:
rv = "encrypted_extensions (8)";
break;
- case ssl_hs_certificate:
+ case certificate:
rv = "certificate (11)";
break;
- case ssl_hs_server_key_exchange:
+ case server_key_exchange:
rv = "server_key_exchange (12)";
break;
- case ssl_hs_certificate_request:
+ case certificate_request:
rv = "certificate_request (13)";
break;
- case ssl_hs_server_hello_done:
+ case server_hello_done:
rv = "server_hello_done (14)";
break;
- case ssl_hs_certificate_verify:
+ case certificate_verify:
rv = "certificate_verify (15)";
break;
- case ssl_hs_client_key_exchange:
+ case client_key_exchange:
rv = "client_key_exchange (16)";
break;
- case ssl_hs_finished:
+ case finished:
rv = "finished (20)";
break;
- case ssl_hs_certificate_status:
- rv = "certificate_status (22)";
- break;
- case ssl_hs_key_update:
- rv = "key_update (24)";
- break;
default:
sprintf(line, "*UNKNOWN* handshake type! (%d)", msgType);
rv = line;
@@ -513,9 +622,6 @@ ssl3_DecodeContentType(int msgType)
case content_application_data:
rv = "application_data (23)";
break;
- case content_ack:
- rv = "ack (25)";
- break;
default:
sprintf(line, "*UNKNOWN* record type! (%d)", msgType);
rv = line;
@@ -768,12 +874,20 @@ ssl_HasCert(const sslSocket *ss, SSLAuthType authType)
return PR_FALSE;
}
+const ssl3BulkCipherDef *
+ssl_GetBulkCipherDef(const ssl3CipherSuiteDef *cipher_def)
+{
+ PORT_Assert(cipher_def->bulk_cipher_alg < PR_ARRAY_SIZE(bulk_cipher_defs));
+ PORT_Assert(bulk_cipher_defs[cipher_def->bulk_cipher_alg].cipher == cipher_def->bulk_cipher_alg);
+ return &bulk_cipher_defs[cipher_def->bulk_cipher_alg];
+}
+
/* Initialize the suite->isPresent value for config_match
* Returns count of enabled ciphers supported by extant tokens,
* regardless of policy or user preference.
* If this returns zero, the user cannot do SSL v3.
*/
-unsigned int
+int
ssl3_config_match_init(sslSocket *ss)
{
ssl3CipherSuiteCfg *suite;
@@ -782,9 +896,9 @@ ssl3_config_match_init(sslSocket *ss)
CK_MECHANISM_TYPE cipher_mech;
SSLAuthType authType;
SSLKEAType keaType;
- unsigned int i;
- unsigned int numPresent = 0;
- unsigned int numEnabled = 0;
+ int i;
+ int numPresent = 0;
+ int numEnabled = 0;
PORT_Assert(ss);
if (!ss) {
@@ -795,7 +909,6 @@ ssl3_config_match_init(sslSocket *ss)
return 0;
}
- ssl_FilterSupportedGroups(ss);
for (i = 0; i < ssl_V3_SUITES_IMPLEMENTED; i++) {
suite = &ss->cipherSuites[i];
if (suite->enabled) {
@@ -831,7 +944,7 @@ ssl3_config_match_init(sslSocket *ss)
suite->isPresent = PR_FALSE;
}
- if (cipher_alg != ssl_calg_null &&
+ if (cipher_alg != calg_null &&
!PK11_TokenExists(cipher_mech)) {
suite->isPresent = PR_FALSE;
}
@@ -842,7 +955,7 @@ ssl3_config_match_init(sslSocket *ss)
}
}
PORT_Assert(numPresent > 0 || numEnabled == 0);
- if (numPresent == 0) {
+ if (numPresent <= 0) {
PORT_SetError(SSL_ERROR_NO_CIPHERS_SUPPORTED);
}
return numPresent;
@@ -887,10 +1000,10 @@ config_match(const ssl3CipherSuiteCfg *suite, int policy,
/* Return the number of cipher suites that are usable. */
/* called from ssl3_SendClientHello */
-static unsigned int
+static int
count_cipher_suites(sslSocket *ss, int policy)
{
- unsigned int i, count = 0;
+ int i, count = 0;
if (SSL_ALL_VERSIONS_DISABLED(&ss->vrange)) {
return 0;
@@ -899,7 +1012,7 @@ count_cipher_suites(sslSocket *ss, int policy)
if (config_match(&ss->cipherSuites[i], policy, &ss->vrange, ss))
count++;
}
- if (count == 0) {
+ if (count <= 0) {
PORT_SetError(SSL_ERROR_SSL_DISABLED);
}
return count;
@@ -908,7 +1021,7 @@ count_cipher_suites(sslSocket *ss, int policy)
/*
* Null compression, mac and encryption functions
*/
-SECStatus
+static SECStatus
Null_Cipher(void *ctx, unsigned char *output, int *outputLen, int maxOutputLen,
const unsigned char *input, int inputLen)
{
@@ -928,19 +1041,6 @@ Null_Cipher(void *ctx, unsigned char *output, int *outputLen, int maxOutputLen,
* SSL3 Utility functions
*/
-static void
-ssl_SetSpecVersions(sslSocket *ss, ssl3CipherSpec *spec)
-{
- spec->version = ss->version;
- if (ss->version >= SSL_LIBRARY_VERSION_TLS_1_3) {
- tls13_SetSpecRecordVersion(ss, spec);
- } else if (IS_DTLS(ss)) {
- spec->recordVersion = dtls_TLSVersionToDTLSVersion(ss->version);
- } else {
- spec->recordVersion = ss->version;
- }
-}
-
/* allowLargerPeerVersion controls whether the function will select the
* highest enabled SSL version or fail when peerVersion is greater than the
* highest enabled version.
@@ -952,8 +1052,6 @@ SECStatus
ssl3_NegotiateVersion(sslSocket *ss, SSL3ProtocolVersion peerVersion,
PRBool allowLargerPeerVersion)
{
- SSL3ProtocolVersion negotiated;
-
if (SSL_ALL_VERSIONS_DISABLED(&ss->vrange)) {
PORT_SetError(SSL_ERROR_SSL_DISABLED);
return SECFailure;
@@ -965,14 +1063,9 @@ ssl3_NegotiateVersion(sslSocket *ss, SSL3ProtocolVersion peerVersion,
return SECFailure;
}
- negotiated = PR_MIN(peerVersion, ss->vrange.max);
- PORT_Assert(ssl3_VersionIsSupported(ss->protocolVariant, negotiated));
- if (ss->firstHsDone && ss->version != negotiated) {
- PORT_SetError(SSL_ERROR_UNSUPPORTED_VERSION);
- return SECFailure;
- }
+ ss->version = PR_MIN(peerVersion, ss->vrange.max);
+ PORT_Assert(ssl3_VersionIsSupported(ss->protocolVariant, ss->version));
- ss->version = negotiated;
return SECSuccess;
}
@@ -1011,16 +1104,24 @@ ssl_ClientReadVersion(sslSocket *ss, PRUint8 **b, unsigned int *len,
v = dtls_DTLSVersionToTLSVersion(v);
}
+ PORT_Assert(!SSL_ALL_VERSIONS_DISABLED(&ss->vrange));
+ if (ss->vrange.min > v || ss->vrange.max < v) {
+ (void)SSL3_SendAlert(ss, alert_fatal,
+ (v > SSL_LIBRARY_VERSION_3_0) ? protocol_version
+ : handshake_failure);
+ PORT_SetError(SSL_ERROR_UNSUPPORTED_VERSION);
+ return SECFailure;
+ }
*version = v;
return SECSuccess;
}
static SECStatus
-ssl3_GetNewRandom(SSL3Random random)
+ssl3_GetNewRandom(SSL3Random *random)
{
SECStatus rv;
- rv = PK11_GenerateRandom(random, SSL3_RANDOM_LENGTH);
+ rv = PK11_GenerateRandom(random->rand, SSL3_RANDOM_LENGTH);
if (rv != SECSuccess) {
ssl_MapLowLevelError(SSL_ERROR_GENERATE_RANDOM_FAILURE);
}
@@ -1034,7 +1135,7 @@ ssl3_SignHashes(sslSocket *ss, SSL3Hashes *hash, SECKEYPrivateKey *key,
{
SECStatus rv = SECFailure;
PRBool doDerEncode = PR_FALSE;
- PRBool isTLS = (PRBool)(ss->version > SSL_LIBRARY_VERSION_3_0);
+ PRBool isTLS = (PRBool)(ss->ssl3.pwSpec->version > SSL_LIBRARY_VERSION_3_0);
PRBool useRsaPss = ssl_IsRsaPssSignatureScheme(ss->ssl3.hs.signatureScheme);
SECItem hashItem;
@@ -1320,110 +1421,124 @@ static SECStatus
ssl3_ComputeDHKeyHash(sslSocket *ss, SSLHashType hashAlg, SSL3Hashes *hashes,
SECItem dh_p, SECItem dh_g, SECItem dh_Ys, PRBool padY)
{
- sslBuffer buf = SSL_BUFFER_EMPTY;
- SECStatus rv;
- unsigned int yLen;
- unsigned int i;
+ PRUint8 *hashBuf;
+ PRUint8 *pBuf;
+ SECStatus rv = SECSuccess;
+ unsigned int bufLen, yLen;
+ PRUint8 buf[2 * SSL3_RANDOM_LENGTH + 2 + 4096 / 8 + 2 + 4096 / 8];
PORT_Assert(dh_p.data);
PORT_Assert(dh_g.data);
PORT_Assert(dh_Ys.data);
- rv = sslBuffer_Append(&buf, ss->ssl3.hs.client_random, SSL3_RANDOM_LENGTH);
- if (rv != SECSuccess) {
- goto loser;
- }
- rv = sslBuffer_Append(&buf, ss->ssl3.hs.server_random, SSL3_RANDOM_LENGTH);
- if (rv != SECSuccess) {
- goto loser;
- }
- /* p */
- rv = sslBuffer_AppendVariable(&buf, dh_p.data, dh_p.len, 2);
- if (rv != SECSuccess) {
- goto loser;
- }
- /* g */
- rv = sslBuffer_AppendVariable(&buf, dh_g.data, dh_g.len, 2);
- if (rv != SECSuccess) {
- goto loser;
- }
- /* y - complicated by padding */
yLen = padY ? dh_p.len : dh_Ys.len;
- rv = sslBuffer_AppendNumber(&buf, yLen, 2);
- if (rv != SECSuccess) {
- goto loser;
- }
- /* If we're padding Y, dh_Ys can't be longer than dh_p. */
- PORT_Assert(!padY || dh_p.len >= dh_Ys.len);
- for (i = dh_Ys.len; i < yLen; ++i) {
- rv = sslBuffer_AppendNumber(&buf, 0, 1);
- if (rv != SECSuccess) {
- goto loser;
+ bufLen = 2 * SSL3_RANDOM_LENGTH +
+ 2 + dh_p.len +
+ 2 + dh_g.len +
+ 2 + yLen;
+ if (bufLen <= sizeof buf) {
+ hashBuf = buf;
+ } else {
+ hashBuf = PORT_Alloc(bufLen);
+ if (!hashBuf) {
+ return SECFailure;
}
}
- rv = sslBuffer_Append(&buf, dh_Ys.data, dh_Ys.len);
- if (rv != SECSuccess) {
- goto loser;
- }
- rv = ssl3_ComputeCommonKeyHash(hashAlg, SSL_BUFFER_BASE(&buf),
- SSL_BUFFER_LEN(&buf), hashes);
- if (rv != SECSuccess) {
- goto loser;
+ memcpy(hashBuf, &ss->ssl3.hs.client_random, SSL3_RANDOM_LENGTH);
+ pBuf = hashBuf + SSL3_RANDOM_LENGTH;
+ memcpy(pBuf, &ss->ssl3.hs.server_random, SSL3_RANDOM_LENGTH);
+ pBuf += SSL3_RANDOM_LENGTH;
+ pBuf = ssl_EncodeUintX(dh_p.len, 2, pBuf);
+ memcpy(pBuf, dh_p.data, dh_p.len);
+ pBuf += dh_p.len;
+ pBuf = ssl_EncodeUintX(dh_g.len, 2, pBuf);
+ memcpy(pBuf, dh_g.data, dh_g.len);
+ pBuf += dh_g.len;
+ pBuf = ssl_EncodeUintX(yLen, 2, pBuf);
+ if (padY && dh_p.len > dh_Ys.len) {
+ memset(pBuf, 0, dh_p.len - dh_Ys.len);
+ pBuf += dh_p.len - dh_Ys.len;
}
+ /* If we're padding Y, dh_Ys can't be longer than dh_p. */
+ PORT_Assert(!padY || dh_p.len >= dh_Ys.len);
+ memcpy(pBuf, dh_Ys.data, dh_Ys.len);
+ pBuf += dh_Ys.len;
+ PORT_Assert((unsigned int)(pBuf - hashBuf) == bufLen);
- PRINT_BUF(95, (NULL, "DHkey hash: ", SSL_BUFFER_BASE(&buf),
- SSL_BUFFER_LEN(&buf)));
- if (hashAlg == ssl_hash_none) {
- PRINT_BUF(95, (NULL, "DHkey hash: MD5 result",
- hashes->u.s.md5, MD5_LENGTH));
- PRINT_BUF(95, (NULL, "DHkey hash: SHA1 result",
- hashes->u.s.sha, SHA1_LENGTH));
- } else {
- PRINT_BUF(95, (NULL, "DHkey hash: result",
- hashes->u.raw, hashes->len));
- }
+ rv = ssl3_ComputeCommonKeyHash(hashAlg, hashBuf, bufLen, hashes);
- sslBuffer_Clear(&buf);
- return SECSuccess;
+ PRINT_BUF(95, (NULL, "DHkey hash: ", hashBuf, bufLen));
+ if (rv == SECSuccess) {
+ if (hashAlg == ssl_hash_none) {
+ PRINT_BUF(95, (NULL, "DHkey hash: MD5 result",
+ hashes->u.s.md5, MD5_LENGTH));
+ PRINT_BUF(95, (NULL, "DHkey hash: SHA1 result",
+ hashes->u.s.sha, SHA1_LENGTH));
+ } else {
+ PRINT_BUF(95, (NULL, "DHkey hash: result",
+ hashes->u.raw, hashes->len));
+ }
+ }
-loser:
- sslBuffer_Clear(&buf);
- return SECFailure;
+ if (hashBuf != buf && hashBuf != NULL)
+ PORT_Free(hashBuf);
+ return rv;
}
-static SECStatus
-ssl3_SetupPendingCipherSpec(sslSocket *ss, CipherSpecDirection direction,
- const ssl3CipherSuiteDef *suiteDef,
- ssl3CipherSpec **specp)
+/* Called twice, only from ssl3_DestroyCipherSpec (immediately below). */
+static void
+ssl3_CleanupKeyMaterial(ssl3KeyMaterial *mat)
{
- ssl3CipherSpec *spec;
- const ssl3CipherSpec *prev;
-
- prev = (direction == CipherSpecWrite) ? ss->ssl3.cwSpec : ss->ssl3.crSpec;
- if (prev->epoch == PR_UINT16_MAX) {
- PORT_SetError(SSL_ERROR_RENEGOTIATION_NOT_ALLOWED);
- return SECFailure;
+ if (mat->write_key != NULL) {
+ PK11_FreeSymKey(mat->write_key);
+ mat->write_key = NULL;
}
-
- spec = ssl_CreateCipherSpec(ss, direction);
- if (!spec) {
- return SECFailure;
+ if (mat->write_mac_key != NULL) {
+ PK11_FreeSymKey(mat->write_mac_key);
+ mat->write_mac_key = NULL;
}
-
- spec->cipherDef = ssl_GetBulkCipherDef(suiteDef);
- spec->macDef = ssl_GetMacDef(ss, suiteDef);
-
- spec->epoch = prev->epoch + 1;
- spec->seqNum = 0;
- if (IS_DTLS(ss) && direction == CipherSpecRead) {
- dtls_InitRecvdRecords(&spec->recvdRecords);
+ if (mat->write_mac_context != NULL) {
+ PK11_DestroyContext(mat->write_mac_context, PR_TRUE);
+ mat->write_mac_context = NULL;
}
- ssl_SetSpecVersions(ss, spec);
+}
- ssl_SaveCipherSpec(ss, spec);
- *specp = spec;
- return SECSuccess;
+/* Called from ssl3_SendChangeCipherSpecs() and
+** ssl3_HandleChangeCipherSpecs()
+** ssl3_DestroySSL3Info
+** Caller must hold SpecWriteLock.
+*/
+void
+ssl3_DestroyCipherSpec(ssl3CipherSpec *spec, PRBool freeSrvName)
+{
+ /* PORT_Assert( ss->opt.noLocks || ssl_HaveSpecWriteLock(ss)); Don't have ss! */
+ if (spec->encodeContext) {
+ PK11_DestroyContext(spec->encodeContext, PR_TRUE);
+ spec->encodeContext = NULL;
+ }
+ if (spec->decodeContext) {
+ PK11_DestroyContext(spec->decodeContext, PR_TRUE);
+ spec->decodeContext = NULL;
+ }
+ if (spec->destroyCompressContext && spec->compressContext) {
+ spec->destroyCompressContext(spec->compressContext, 1);
+ spec->compressContext = NULL;
+ }
+ if (spec->destroyDecompressContext && spec->decompressContext) {
+ spec->destroyDecompressContext(spec->decompressContext, 1);
+ spec->decompressContext = NULL;
+ }
+ if (spec->master_secret != NULL) {
+ PK11_FreeSymKey(spec->master_secret);
+ spec->master_secret = NULL;
+ }
+ spec->msItem.data = NULL;
+ spec->msItem.len = 0;
+ ssl3_CleanupKeyMaterial(&spec->client);
+ ssl3_CleanupKeyMaterial(&spec->server);
+ spec->destroyCompressContext = NULL;
+ spec->destroyDecompressContext = NULL;
}
/* Fill in the pending cipher spec with info from the selected ciphersuite.
@@ -1433,116 +1548,272 @@ ssl3_SetupPendingCipherSpec(sslSocket *ss, CipherSpecDirection direction,
** Acquires & releases SpecWriteLock.
*/
SECStatus
-ssl3_SetupBothPendingCipherSpecs(sslSocket *ss)
+ssl3_SetupPendingCipherSpec(sslSocket *ss)
{
+ ssl3CipherSpec *pwSpec;
+ ssl3CipherSpec *cwSpec;
ssl3CipherSuite suite = ss->ssl3.hs.cipher_suite;
+ SSL3MACAlgorithm mac;
SSL3KeyExchangeAlgorithm kea;
- const ssl3CipherSuiteDef *suiteDef;
- SECStatus rv;
+ const ssl3CipherSuiteDef *suite_def;
+ PRBool isTLS;
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
PORT_Assert(ss->version < SSL_LIBRARY_VERSION_TLS_1_3);
ssl_GetSpecWriteLock(ss); /*******************************/
+ pwSpec = ss->ssl3.pwSpec;
+ PORT_Assert(pwSpec == ss->ssl3.prSpec);
+
/* This hack provides maximal interoperability with SSL 3 servers. */
- if (ss->ssl3.cwSpec->macDef->mac == ssl_mac_null) {
+ cwSpec = ss->ssl3.cwSpec;
+ if (cwSpec->mac_def->mac == mac_null) {
/* SSL records are not being MACed. */
- ss->ssl3.cwSpec->version = ss->version;
+ cwSpec->version = ss->version;
}
+ pwSpec->version = ss->version;
+ isTLS = (PRBool)(pwSpec->version > SSL_LIBRARY_VERSION_3_0);
+
SSL_TRC(3, ("%d: SSL3[%d]: Set XXX Pending Cipher Suite to 0x%04x",
SSL_GETPID(), ss->fd, suite));
- suiteDef = ssl_LookupCipherSuiteDef(suite);
- if (suiteDef == NULL) {
- goto loser;
+ suite_def = ssl_LookupCipherSuiteDef(suite);
+ if (suite_def == NULL) {
+ ssl_ReleaseSpecWriteLock(ss);
+ return SECFailure; /* error code set by ssl_LookupCipherSuiteDef */
}
if (IS_DTLS(ss)) {
/* Double-check that we did not pick an RC4 suite */
- PORT_Assert(suiteDef->bulk_cipher_alg != cipher_rc4);
+ PORT_Assert(suite_def->bulk_cipher_alg != cipher_rc4);
}
- ss->ssl3.hs.suite_def = suiteDef;
+ kea = suite_def->key_exchange_alg;
+ mac = suite_def->mac_alg;
+ if (mac <= ssl_mac_sha && mac != ssl_mac_null && isTLS)
+ mac += 2;
- kea = suiteDef->key_exchange_alg;
+ ss->ssl3.hs.suite_def = suite_def;
ss->ssl3.hs.kea_def = &kea_defs[kea];
PORT_Assert(ss->ssl3.hs.kea_def->kea == kea);
- rv = ssl3_SetupPendingCipherSpec(ss, CipherSpecRead, suiteDef,
- &ss->ssl3.prSpec);
- if (rv != SECSuccess) {
- goto loser;
+ pwSpec->cipher_def = ssl_GetBulkCipherDef(suite_def);
+
+ pwSpec->mac_def = &mac_defs[mac];
+ PORT_Assert(pwSpec->mac_def->mac == mac);
+
+ pwSpec->encodeContext = NULL;
+ pwSpec->decodeContext = NULL;
+
+ pwSpec->mac_size = pwSpec->mac_def->mac_size;
+
+ pwSpec->compression_method = ss->ssl3.hs.compression;
+ pwSpec->compressContext = NULL;
+ pwSpec->decompressContext = NULL;
+
+ ssl_ReleaseSpecWriteLock(ss); /*******************************/
+ return SECSuccess;
+}
+
+#ifdef NSS_SSL_ENABLE_ZLIB
+#define SSL3_DEFLATE_CONTEXT_SIZE sizeof(z_stream)
+
+static SECStatus
+ssl3_MapZlibError(int zlib_error)
+{
+ switch (zlib_error) {
+ case Z_OK:
+ return SECSuccess;
+ default:
+ return SECFailure;
}
- rv = ssl3_SetupPendingCipherSpec(ss, CipherSpecWrite, suiteDef,
- &ss->ssl3.pwSpec);
- if (rv != SECSuccess) {
- goto loser;
+}
+
+static SECStatus
+ssl3_DeflateInit(void *void_context)
+{
+ z_stream *context = void_context;
+ context->zalloc = NULL;
+ context->zfree = NULL;
+ context->opaque = NULL;
+
+ return ssl3_MapZlibError(deflateInit(context, Z_DEFAULT_COMPRESSION));
+}
+
+static SECStatus
+ssl3_InflateInit(void *void_context)
+{
+ z_stream *context = void_context;
+ context->zalloc = NULL;
+ context->zfree = NULL;
+ context->opaque = NULL;
+ context->next_in = NULL;
+ context->avail_in = 0;
+
+ return ssl3_MapZlibError(inflateInit(context));
+}
+
+static SECStatus
+ssl3_DeflateCompress(void *void_context, unsigned char *out, int *out_len,
+ int maxout, const unsigned char *in, int inlen)
+{
+ z_stream *context = void_context;
+
+ if (!inlen) {
+ *out_len = 0;
+ return SECSuccess;
}
- ssl_ReleaseSpecWriteLock(ss); /*******************************/
+ context->next_in = (unsigned char *)in;
+ context->avail_in = inlen;
+ context->next_out = out;
+ context->avail_out = maxout;
+ if (deflate(context, Z_SYNC_FLUSH) != Z_OK) {
+ return SECFailure;
+ }
+ if (context->avail_out == 0) {
+ /* We ran out of space! */
+ SSL_TRC(3, ("%d: SSL3[%d] Ran out of buffer while compressing",
+ SSL_GETPID()));
+ return SECFailure;
+ }
+
+ *out_len = maxout - context->avail_out;
return SECSuccess;
+}
-loser:
- ssl_ReleaseSpecWriteLock(ss);
- return SECFailure;
+static SECStatus
+ssl3_DeflateDecompress(void *void_context, unsigned char *out, int *out_len,
+ int maxout, const unsigned char *in, int inlen)
+{
+ z_stream *context = void_context;
+
+ if (!inlen) {
+ *out_len = 0;
+ return SECSuccess;
+ }
+
+ context->next_in = (unsigned char *)in;
+ context->avail_in = inlen;
+ context->next_out = out;
+ context->avail_out = maxout;
+ if (inflate(context, Z_SYNC_FLUSH) != Z_OK) {
+ PORT_SetError(SSL_ERROR_DECOMPRESSION_FAILURE);
+ return SECFailure;
+ }
+
+ *out_len = maxout - context->avail_out;
+ return SECSuccess;
+}
+
+static SECStatus
+ssl3_DestroyCompressContext(void *void_context, PRBool unused)
+{
+ deflateEnd(void_context);
+ PORT_Free(void_context);
+ return SECSuccess;
}
-/* ssl3_BuildRecordPseudoHeader writes the SSL/TLS pseudo-header (the data which
- * is included in the MAC or AEAD additional data) to |buf|. See
- * https://tools.ietf.org/html/rfc5246#section-6.2.3.3 for the definition of the
- * AEAD additional data.
+static SECStatus
+ssl3_DestroyDecompressContext(void *void_context, PRBool unused)
+{
+ inflateEnd(void_context);
+ PORT_Free(void_context);
+ return SECSuccess;
+}
+
+#endif /* NSS_SSL_ENABLE_ZLIB */
+
+/* Initialize the compression functions and contexts for the given
+ * CipherSpec. */
+static SECStatus
+ssl3_InitCompressionContext(ssl3CipherSpec *pwSpec)
+{
+ /* Setup the compression functions */
+ switch (pwSpec->compression_method) {
+ case ssl_compression_null:
+ pwSpec->compressor = NULL;
+ pwSpec->decompressor = NULL;
+ pwSpec->compressContext = NULL;
+ pwSpec->decompressContext = NULL;
+ pwSpec->destroyCompressContext = NULL;
+ pwSpec->destroyDecompressContext = NULL;
+ break;
+#ifdef NSS_SSL_ENABLE_ZLIB
+ case ssl_compression_deflate:
+ pwSpec->compressor = ssl3_DeflateCompress;
+ pwSpec->decompressor = ssl3_DeflateDecompress;
+ pwSpec->compressContext = PORT_Alloc(SSL3_DEFLATE_CONTEXT_SIZE);
+ pwSpec->decompressContext = PORT_Alloc(SSL3_DEFLATE_CONTEXT_SIZE);
+ pwSpec->destroyCompressContext = ssl3_DestroyCompressContext;
+ pwSpec->destroyDecompressContext = ssl3_DestroyDecompressContext;
+ ssl3_DeflateInit(pwSpec->compressContext);
+ ssl3_InflateInit(pwSpec->decompressContext);
+ break;
+#endif /* NSS_SSL_ENABLE_ZLIB */
+ default:
+ PORT_Assert(0);
+ PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
+ return SECFailure;
+ }
+
+ return SECSuccess;
+}
+
+/* ssl3_BuildRecordPseudoHeader writes the SSL/TLS pseudo-header (the data
+ * which is included in the MAC or AEAD additional data) to |out| and returns
+ * its length. See https://tools.ietf.org/html/rfc5246#section-6.2.3.3 for the
+ * definition of the AEAD additional data.
*
* TLS pseudo-header includes the record's version field, SSL's doesn't. Which
- * pseudo-header definition to use should be decided based on the version of
+ * pseudo-header defintiion to use should be decided based on the version of
* the protocol that was negotiated when the cipher spec became current, NOT
* based on the version value in the record itself, and the decision is passed
* to this function as the |includesVersion| argument. But, the |version|
* argument should be the record's version value.
*/
-static SECStatus
-ssl3_BuildRecordPseudoHeader(DTLSEpoch epoch,
- sslSequenceNumber seqNum,
+static unsigned int
+ssl3_BuildRecordPseudoHeader(unsigned char *out,
+ sslSequenceNumber seq_num,
SSL3ContentType type,
PRBool includesVersion,
SSL3ProtocolVersion version,
PRBool isDTLS,
- int length,
- sslBuffer *buf)
-{
- SECStatus rv;
- if (isDTLS) {
- rv = sslBuffer_AppendNumber(buf, epoch, 2);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- rv = sslBuffer_AppendNumber(buf, seqNum, 6);
- } else {
- rv = sslBuffer_AppendNumber(buf, seqNum, 8);
- }
- if (rv != SECSuccess) {
- return SECFailure;
- }
- rv = sslBuffer_AppendNumber(buf, type, 1);
- if (rv != SECSuccess) {
- return SECFailure;
- }
+ int length)
+{
+ out[0] = (unsigned char)(seq_num >> 56);
+ out[1] = (unsigned char)(seq_num >> 48);
+ out[2] = (unsigned char)(seq_num >> 40);
+ out[3] = (unsigned char)(seq_num >> 32);
+ out[4] = (unsigned char)(seq_num >> 24);
+ out[5] = (unsigned char)(seq_num >> 16);
+ out[6] = (unsigned char)(seq_num >> 8);
+ out[7] = (unsigned char)(seq_num >> 0);
+ out[8] = type;
/* SSL3 MAC doesn't include the record's version field. */
- if (includesVersion) {
- /* TLS MAC and AEAD additional data include version. */
- rv = sslBuffer_AppendNumber(buf, version, 2);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- }
- rv = sslBuffer_AppendNumber(buf, length, 2);
- if (rv != SECSuccess) {
- return SECFailure;
+ if (!includesVersion) {
+ out[9] = MSB(length);
+ out[10] = LSB(length);
+ return 11;
}
- return SECSuccess;
+ /* TLS MAC and AEAD additional data include version. */
+ if (isDTLS) {
+ SSL3ProtocolVersion dtls_version;
+
+ dtls_version = dtls_TLSVersionToDTLSVersion(version);
+ out[9] = MSB(dtls_version);
+ out[10] = LSB(dtls_version);
+ } else {
+ out[9] = MSB(version);
+ out[10] = LSB(version);
+ }
+ out[11] = MSB(length);
+ out[12] = LSB(length);
+ return 13;
}
static SECStatus
@@ -1562,12 +1833,13 @@ ssl3_AESGCM(ssl3KeyMaterial *keys,
unsigned int uOutLen;
CK_GCM_PARAMS gcmParams;
- const int tagSize = 16;
- const int explicitNonceLen = 8;
+ const int tagSize = bulk_cipher_defs[cipher_aes_128_gcm].tag_size;
+ const int explicitNonceLen =
+ bulk_cipher_defs[cipher_aes_128_gcm].explicit_nonce_size;
/* See https://tools.ietf.org/html/rfc5288#section-3 for details of how the
* nonce is formed. */
- memcpy(nonce, keys->iv, 4);
+ memcpy(nonce, keys->write_iv, 4);
if (doDecrypt) {
memcpy(nonce + 4, in, explicitNonceLen);
in += explicitNonceLen;
@@ -1596,10 +1868,10 @@ ssl3_AESGCM(ssl3KeyMaterial *keys,
gcmParams.ulTagBits = tagSize * 8;
if (doDecrypt) {
- rv = PK11_Decrypt(keys->key, CKM_AES_GCM, &param, out, &uOutLen,
+ rv = PK11_Decrypt(keys->write_key, CKM_AES_GCM, &param, out, &uOutLen,
maxout, in, inlen);
} else {
- rv = PK11_Encrypt(keys->key, CKM_AES_GCM, &param, out, &uOutLen,
+ rv = PK11_Encrypt(keys->write_key, CKM_AES_GCM, &param, out, &uOutLen,
maxout, in, inlen);
}
*outlen += (int)uOutLen;
@@ -1621,12 +1893,12 @@ ssl3_ChaCha20Poly1305(ssl3KeyMaterial *keys, PRBool doDecrypt,
unsigned char nonce[12];
CK_NSS_AEAD_PARAMS aeadParams;
- const int tagSize = 16;
+ const int tagSize = bulk_cipher_defs[cipher_chacha20].tag_size;
/* See
* https://tools.ietf.org/html/draft-ietf-tls-chacha20-poly1305-04#section-2
* for details of how the nonce is formed. */
- PORT_Memcpy(nonce, keys->iv, 12);
+ PORT_Memcpy(nonce, keys->write_iv, 12);
/* XOR the last 8 bytes of the IV with the sequence number. */
PORT_Assert(additionalDataLen >= 8);
@@ -1645,10 +1917,10 @@ ssl3_ChaCha20Poly1305(ssl3KeyMaterial *keys, PRBool doDecrypt,
aeadParams.ulTagLen = tagSize;
if (doDecrypt) {
- rv = PK11_Decrypt(keys->key, CKM_NSS_CHACHA20_POLY1305, &param,
+ rv = PK11_Decrypt(keys->write_key, CKM_NSS_CHACHA20_POLY1305, &param,
out, &uOutLen, maxout, in, inlen);
} else {
- rv = PK11_Encrypt(keys->key, CKM_NSS_CHACHA20_POLY1305, &param,
+ rv = PK11_Encrypt(keys->write_key, CKM_NSS_CHACHA20_POLY1305, &param,
out, &uOutLen, maxout, in, inlen);
}
*outlen = (int)uOutLen;
@@ -1661,31 +1933,44 @@ ssl3_ChaCha20Poly1305(ssl3KeyMaterial *keys, PRBool doDecrypt,
* Caller holds Spec write lock.
*/
static SECStatus
-ssl3_InitPendingContexts(sslSocket *ss, ssl3CipherSpec *spec)
+ssl3_InitPendingContexts(sslSocket *ss)
{
- CK_MECHANISM_TYPE encMechanism;
- CK_ATTRIBUTE_TYPE encMode;
- SECItem macParam;
+ ssl3CipherSpec *pwSpec;
+ const ssl3BulkCipherDef *cipher_def;
+ PK11Context *serverContext = NULL;
+ PK11Context *clientContext = NULL;
+ SECItem *param;
+ CK_MECHANISM_TYPE mechanism;
+ CK_MECHANISM_TYPE mac_mech;
CK_ULONG macLength;
SECItem iv;
+ SECItem mac_param;
SSLCipherAlgorithm calg;
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
PORT_Assert(ss->opt.noLocks || ssl_HaveSpecWriteLock(ss));
+ PORT_Assert(ss->ssl3.prSpec == ss->ssl3.pwSpec);
- macLength = spec->macDef->mac_size;
- calg = spec->cipherDef->calg;
+ pwSpec = ss->ssl3.pwSpec;
+ cipher_def = pwSpec->cipher_def;
+ macLength = pwSpec->mac_size;
+ calg = cipher_def->calg;
PORT_Assert(alg2Mech[calg].calg == calg);
- if (spec->cipherDef->type == type_aead) {
- spec->cipher = NULL;
- spec->cipherContext = NULL;
+ pwSpec->client.write_mac_context = NULL;
+ pwSpec->server.write_mac_context = NULL;
+
+ if (cipher_def->type == type_aead) {
+ pwSpec->encode = NULL;
+ pwSpec->decode = NULL;
+ pwSpec->encodeContext = NULL;
+ pwSpec->decodeContext = NULL;
switch (calg) {
- case ssl_calg_aes_gcm:
- spec->aead = ssl3_AESGCM;
+ case calg_aes_gcm:
+ pwSpec->aead = ssl3_AESGCM;
break;
- case ssl_calg_chacha20:
- spec->aead = ssl3_ChaCha20Poly1305;
+ case calg_chacha20:
+ pwSpec->aead = ssl3_ChaCha20Poly1305;
break;
default:
PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
@@ -1698,43 +1983,128 @@ ssl3_InitPendingContexts(sslSocket *ss, ssl3CipherSpec *spec)
** Now setup the MAC contexts,
** crypto contexts are setup below.
*/
- macParam.data = (unsigned char *)&macLength;
- macParam.len = sizeof(macLength);
- macParam.type = siBuffer;
- spec->keyMaterial.macContext = PK11_CreateContextBySymKey(
- spec->macDef->mmech, CKA_SIGN, spec->keyMaterial.macKey, &macParam);
- if (!spec->keyMaterial.macContext) {
+ mac_mech = pwSpec->mac_def->mmech;
+ mac_param.data = (unsigned char *)&macLength;
+ mac_param.len = sizeof(macLength);
+ mac_param.type = 0;
+
+ pwSpec->client.write_mac_context = PK11_CreateContextBySymKey(
+ mac_mech, CKA_SIGN, pwSpec->client.write_mac_key, &mac_param);
+ if (pwSpec->client.write_mac_context == NULL) {
ssl_MapLowLevelError(SSL_ERROR_SYM_KEY_CONTEXT_FAILURE);
- return SECFailure;
+ goto fail;
+ }
+ pwSpec->server.write_mac_context = PK11_CreateContextBySymKey(
+ mac_mech, CKA_SIGN, pwSpec->server.write_mac_key, &mac_param);
+ if (pwSpec->server.write_mac_context == NULL) {
+ ssl_MapLowLevelError(SSL_ERROR_SYM_KEY_CONTEXT_FAILURE);
+ goto fail;
}
/*
** Now setup the crypto contexts.
*/
- if (calg == ssl_calg_null) {
- spec->cipher = Null_Cipher;
+
+ if (calg == calg_null) {
+ pwSpec->encode = Null_Cipher;
+ pwSpec->decode = Null_Cipher;
return SECSuccess;
}
+ mechanism = ssl3_Alg2Mech(calg);
- spec->cipher = (SSLCipher)PK11_CipherOp;
- encMechanism = ssl3_Alg2Mech(calg);
- encMode = (spec->direction == CipherSpecWrite) ? CKA_ENCRYPT : CKA_DECRYPT;
+ /*
+ * build the server context
+ */
+ iv.data = pwSpec->server.write_iv;
+ iv.len = cipher_def->iv_size;
+ param = PK11_ParamFromIV(mechanism, &iv);
+ if (param == NULL) {
+ ssl_MapLowLevelError(SSL_ERROR_IV_PARAM_FAILURE);
+ goto fail;
+ }
+ serverContext = PK11_CreateContextBySymKey(mechanism,
+ (ss->sec.isServer ? CKA_ENCRYPT
+ : CKA_DECRYPT),
+ pwSpec->server.write_key, param);
+ iv.data = PK11_IVFromParam(mechanism, param, (int *)&iv.len);
+ if (iv.data)
+ PORT_Memcpy(pwSpec->server.write_iv, iv.data, iv.len);
+ SECITEM_FreeItem(param, PR_TRUE);
+ if (serverContext == NULL) {
+ ssl_MapLowLevelError(SSL_ERROR_SYM_KEY_CONTEXT_FAILURE);
+ goto fail;
+ }
/*
- * build the context
+ * build the client context
*/
- iv.data = spec->keyMaterial.iv;
- iv.len = spec->cipherDef->iv_size;
- spec->cipherContext = PK11_CreateContextBySymKey(encMechanism, encMode,
- spec->keyMaterial.key,
- &iv);
- if (!spec->cipherContext) {
+ iv.data = pwSpec->client.write_iv;
+ iv.len = cipher_def->iv_size;
+
+ param = PK11_ParamFromIV(mechanism, &iv);
+ if (param == NULL) {
+ ssl_MapLowLevelError(SSL_ERROR_IV_PARAM_FAILURE);
+ goto fail;
+ }
+ clientContext = PK11_CreateContextBySymKey(mechanism,
+ (ss->sec.isServer ? CKA_DECRYPT
+ : CKA_ENCRYPT),
+ pwSpec->client.write_key, param);
+ iv.data = PK11_IVFromParam(mechanism, param, (int *)&iv.len);
+ if (iv.data)
+ PORT_Memcpy(pwSpec->client.write_iv, iv.data, iv.len);
+ SECITEM_FreeItem(param, PR_TRUE);
+ if (clientContext == NULL) {
ssl_MapLowLevelError(SSL_ERROR_SYM_KEY_CONTEXT_FAILURE);
- return SECFailure;
+ goto fail;
}
+ pwSpec->encode = (SSLCipher)PK11_CipherOp;
+ pwSpec->decode = (SSLCipher)PK11_CipherOp;
+
+ pwSpec->encodeContext = (ss->sec.isServer) ? serverContext : clientContext;
+ pwSpec->decodeContext = (ss->sec.isServer) ? clientContext : serverContext;
+
+ serverContext = NULL;
+ clientContext = NULL;
+
+ ssl3_InitCompressionContext(pwSpec);
return SECSuccess;
+
+fail:
+ if (serverContext != NULL)
+ PK11_DestroyContext(serverContext, PR_TRUE);
+ if (pwSpec->client.write_mac_context != NULL) {
+ PK11_DestroyContext(pwSpec->client.write_mac_context, PR_TRUE);
+ pwSpec->client.write_mac_context = NULL;
+ }
+ if (pwSpec->server.write_mac_context != NULL) {
+ PK11_DestroyContext(pwSpec->server.write_mac_context, PR_TRUE);
+ pwSpec->server.write_mac_context = NULL;
+ }
+
+ return SECFailure;
+}
+
+HASH_HashType
+ssl3_GetTls12HashType(sslSocket *ss)
+{
+ if (ss->ssl3.pwSpec->version < SSL_LIBRARY_VERSION_TLS_1_2) {
+ return HASH_AlgNULL;
+ }
+
+ switch (ss->ssl3.hs.suite_def->prf_hash) {
+ case ssl_hash_sha384:
+ return HASH_AlgSHA384;
+ case ssl_hash_sha256:
+ case ssl_hash_none:
+ /* ssl_hash_none is for pre-1.2 suites, which use SHA-256. */
+ return HASH_AlgSHA256;
+ default:
+ PORT_Assert(0);
+ }
+ return HASH_AlgSHA256;
}
/* Complete the initialization of all keys, ciphers, MACs and their contexts
@@ -1744,78 +2114,73 @@ ssl3_InitPendingContexts(sslSocket *ss, ssl3CipherSpec *spec)
* ssl3_HandleServerHello (for session restart)
* ssl3_HandleClientHello (for session restart)
* Sets error code, but caller probably should override to disambiguate.
+ * NULL pms means re-use old master_secret.
*
- * If |secret| is a master secret from a previous connection is reused, |derive|
- * is PR_FALSE. If the secret is a pre-master secret, then |derive| is PR_TRUE
- * and the master secret is derived from |secret|.
+ * If the old master secret is reused, pms is NULL and the master secret is
+ * already in pwSpec->master_secret.
*/
SECStatus
-ssl3_InitPendingCipherSpecs(sslSocket *ss, PK11SymKey *secret, PRBool derive)
+ssl3_InitPendingCipherSpec(sslSocket *ss, PK11SymKey *pms)
{
- PK11SymKey *masterSecret;
ssl3CipherSpec *pwSpec;
- ssl3CipherSpec *prSpec;
+ ssl3CipherSpec *cwSpec;
SECStatus rv;
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
- PORT_Assert(secret);
ssl_GetSpecWriteLock(ss); /**************************************/
- PORT_Assert(ss->ssl3.pwSpec);
- PORT_Assert(ss->ssl3.cwSpec->epoch == ss->ssl3.crSpec->epoch);
- prSpec = ss->ssl3.prSpec;
- pwSpec = ss->ssl3.pwSpec;
+ PORT_Assert(ss->ssl3.prSpec == ss->ssl3.pwSpec);
- if (ss->ssl3.cwSpec->epoch == PR_UINT16_MAX) {
- /* The problem here is that we have rehandshaked too many
- * times (you are not allowed to wrap the epoch). The
- * spec says you should be discarding the connection
- * and start over, so not much we can do here. */
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- goto loser;
- }
+ pwSpec = ss->ssl3.pwSpec;
+ cwSpec = ss->ssl3.cwSpec;
- if (derive) {
- rv = ssl3_ComputeMasterSecret(ss, secret, &masterSecret);
+ if (pms || (!pwSpec->msItem.len && !pwSpec->master_secret)) {
+ rv = ssl3_DeriveMasterSecret(ss, pms);
if (rv != SECSuccess) {
- goto loser;
+ goto done; /* err code set by ssl3_DeriveMasterSecret */
}
- } else {
- masterSecret = secret;
}
-
- PORT_Assert(masterSecret);
- rv = ssl3_DeriveConnectionKeys(ss, masterSecret);
- if (rv != SECSuccess) {
- if (derive) {
- /* masterSecret was created here. */
- PK11_FreeSymKey(masterSecret);
+ if (pwSpec->master_secret) {
+ rv = ssl3_DeriveConnectionKeys(ss);
+ if (rv == SECSuccess) {
+ rv = ssl3_InitPendingContexts(ss);
}
- goto loser;
+ } else {
+ PORT_Assert(pwSpec->master_secret);
+ PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
+ rv = SECFailure;
}
-
- /* Both cipher specs maintain a reference to the master secret, since each
- * is managed and freed independently. */
- prSpec->masterSecret = masterSecret;
- pwSpec->masterSecret = PK11_ReferenceSymKey(masterSecret);
- rv = ssl3_InitPendingContexts(ss, ss->ssl3.prSpec);
if (rv != SECSuccess) {
- goto loser;
+ goto done;
}
- rv = ssl3_InitPendingContexts(ss, ss->ssl3.pwSpec);
- if (rv != SECSuccess) {
- goto loser;
- }
+ /* Generic behaviors -- common to all crypto methods */
+ if (!IS_DTLS(ss)) {
+ pwSpec->read_seq_num = pwSpec->write_seq_num = 0;
+ } else {
+ if (cwSpec->epoch == PR_UINT16_MAX) {
+ /* The problem here is that we have rehandshaked too many
+ * times (you are not allowed to wrap the epoch). The
+ * spec says you should be discarding the connection
+ * and start over, so not much we can do here. */
+ PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
+ rv = SECFailure;
+ goto done;
+ }
+ /* The sequence number has the high 16 bits as the epoch. */
+ pwSpec->epoch = cwSpec->epoch + 1;
+ pwSpec->read_seq_num = pwSpec->write_seq_num =
+ (sslSequenceNumber)pwSpec->epoch << 48;
- ssl_ReleaseSpecWriteLock(ss); /******************************/
- return SECSuccess;
+ dtls_InitRecvdRecords(&pwSpec->recvdRecords);
+ }
-loser:
+done:
ssl_ReleaseSpecWriteLock(ss); /******************************/
- ssl_MapLowLevelError(SSL_ERROR_SESSION_KEY_GEN_FAILURE);
- return SECFailure;
+ if (rv != SECSuccess)
+ ssl_MapLowLevelError(SSL_ERROR_SESSION_KEY_GEN_FAILURE);
+ return rv;
}
/*
@@ -1848,33 +2213,36 @@ static const unsigned char mac_pad_2[60] = {
static SECStatus
ssl3_ComputeRecordMAC(
ssl3CipherSpec *spec,
+ PRBool useServerMacKey,
const unsigned char *header,
unsigned int headerLen,
const PRUint8 *input,
- int inputLen,
+ int inputLength,
unsigned char *outbuf,
- unsigned int *outLen)
+ unsigned int *outLength)
{
- PK11Context *context;
- int macSize = spec->macDef->mac_size;
+ const ssl3MACDef *mac_def;
SECStatus rv;
PRINT_BUF(95, (NULL, "frag hash1: header", header, headerLen));
- PRINT_BUF(95, (NULL, "frag hash1: input", input, inputLen));
+ PRINT_BUF(95, (NULL, "frag hash1: input", input, inputLength));
- if (spec->macDef->mac == ssl_mac_null) {
- *outLen = 0;
+ mac_def = spec->mac_def;
+ if (mac_def->mac == mac_null) {
+ *outLength = 0;
return SECSuccess;
}
- context = spec->keyMaterial.macContext;
- rv = PK11_DigestBegin(context);
- rv |= PK11_DigestOp(context, header, headerLen);
- rv |= PK11_DigestOp(context, input, inputLen);
- rv |= PK11_DigestFinal(context, outbuf, outLen, macSize);
- PORT_Assert(rv != SECSuccess || *outLen == (unsigned)macSize);
+ PK11Context *mac_context =
+ (useServerMacKey ? spec->server.write_mac_context
+ : spec->client.write_mac_context);
+ rv = PK11_DigestBegin(mac_context);
+ rv |= PK11_DigestOp(mac_context, header, headerLen);
+ rv |= PK11_DigestOp(mac_context, input, inputLength);
+ rv |= PK11_DigestFinal(mac_context, outbuf, outLength, spec->mac_size);
+ PORT_Assert(rv != SECSuccess || *outLength == (unsigned)spec->mac_size);
- PRINT_BUF(95, (NULL, "frag hash2: result", outbuf, *outLen));
+ PRINT_BUF(95, (NULL, "frag hash2: result", outbuf, *outLength));
if (rv != SECSuccess) {
rv = SECFailure;
@@ -1892,6 +2260,7 @@ ssl3_ComputeRecordMAC(
static SECStatus
ssl3_ComputeRecordMACConstantTime(
ssl3CipherSpec *spec,
+ PRBool useServerMacKey,
const unsigned char *header,
unsigned int headerLen,
const PRUint8 *input,
@@ -1903,13 +2272,13 @@ ssl3_ComputeRecordMACConstantTime(
CK_MECHANISM_TYPE macType;
CK_NSS_MAC_CONSTANT_TIME_PARAMS params;
SECItem param, inputItem, outputItem;
- int macSize = spec->macDef->mac_size;
SECStatus rv;
+ PK11SymKey *key;
- PORT_Assert(inputLen >= spec->macDef->mac_size);
+ PORT_Assert(inputLen >= spec->mac_size);
PORT_Assert(originalLen >= inputLen);
- if (spec->macDef->mac == ssl_mac_null) {
+ if (spec->mac_def->mac == mac_null) {
*outLen = 0;
return SECSuccess;
}
@@ -1919,7 +2288,7 @@ ssl3_ComputeRecordMACConstantTime(
macType = CKM_NSS_SSL3_MAC_CONSTANT_TIME;
}
- params.macAlg = spec->macDef->mmech;
+ params.macAlg = spec->mac_def->mmech;
params.ulBodyTotalLen = originalLen;
params.pHeader = (unsigned char *)header; /* const cast */
params.ulHeaderLen = headerLen;
@@ -1936,14 +2305,19 @@ ssl3_ComputeRecordMACConstantTime(
outputItem.len = *outLen;
outputItem.type = 0;
- rv = PK11_SignWithSymKey(spec->keyMaterial.macKey, macType, &param,
- &outputItem, &inputItem);
+ key = spec->server.write_mac_key;
+ if (!useServerMacKey) {
+ key = spec->client.write_mac_key;
+ }
+
+ rv = PK11_SignWithSymKey(key, macType, &param, &outputItem, &inputItem);
if (rv != SECSuccess) {
if (PORT_GetError() == SEC_ERROR_INVALID_ALGORITHM) {
/* ssl3_ComputeRecordMAC() expects the MAC to have been removed
* from the input length already. */
- return ssl3_ComputeRecordMAC(spec, header, headerLen,
- input, inputLen - macSize,
+ return ssl3_ComputeRecordMAC(spec, useServerMacKey,
+ header, headerLen,
+ input, inputLen - spec->mac_size,
outbuf, outLen);
}
@@ -1953,7 +2327,7 @@ ssl3_ComputeRecordMACConstantTime(
return rv;
}
- PORT_Assert(outputItem.len == (unsigned)macSize);
+ PORT_Assert(outputItem.len == (unsigned)spec->mac_size);
*outLen = outputItem.len;
return rv;
@@ -1989,30 +2363,34 @@ ssl3_ClientAuthTokenPresent(sslSessionID *sid)
/* Caller must hold the spec read lock. */
SECStatus
-ssl3_MACEncryptRecord(ssl3CipherSpec *cwSpec,
- PRBool isServer,
- PRBool isDTLS,
- SSL3ContentType type,
- const PRUint8 *pIn,
- PRUint32 contentLen,
- sslBuffer *wrBuf)
-{
+ssl3_CompressMACEncryptRecord(ssl3CipherSpec *cwSpec,
+ PRBool isServer,
+ PRBool isDTLS,
+ PRBool capRecordVersion,
+ SSL3ContentType type,
+ const PRUint8 *pIn,
+ PRUint32 contentLen,
+ sslBuffer *wrBuf)
+{
+ const ssl3BulkCipherDef *cipher_def;
SECStatus rv;
PRUint32 macLen = 0;
PRUint32 fragLen;
PRUint32 p1Len, p2Len, oddLen = 0;
unsigned int ivLen = 0;
- unsigned char pseudoHeaderBuf[13];
- sslBuffer pseudoHeader = SSL_BUFFER(pseudoHeaderBuf);
+ unsigned char pseudoHeader[13];
+ unsigned int pseudoHeaderLen;
+
+ cipher_def = cwSpec->cipher_def;
- if (cwSpec->cipherDef->type == type_block &&
+ if (cipher_def->type == type_block &&
cwSpec->version >= SSL_LIBRARY_VERSION_TLS_1_1) {
/* Prepend the per-record explicit IV using technique 2b from
* RFC 4346 section 6.2.3.2: The IV is a cryptographically
* strong random number XORed with the CBC residue from the previous
* record.
*/
- ivLen = cwSpec->cipherDef->iv_size;
+ ivLen = cipher_def->iv_size;
if (ivLen > wrBuf->space) {
PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
return SECFailure;
@@ -2022,7 +2400,7 @@ ssl3_MACEncryptRecord(ssl3CipherSpec *cwSpec,
ssl_MapLowLevelError(SSL_ERROR_GENERATE_RANDOM_FAILURE);
return rv;
}
- rv = cwSpec->cipher(cwSpec->cipherContext,
+ rv = cwSpec->encode(cwSpec->encodeContext,
wrBuf->buf, /* output */
(int *)&wrBuf->len, /* outlen */
ivLen, /* max outlen */
@@ -2034,14 +2412,24 @@ ssl3_MACEncryptRecord(ssl3CipherSpec *cwSpec,
}
}
- rv = ssl3_BuildRecordPseudoHeader(
- cwSpec->epoch, cwSpec->seqNum, type,
- cwSpec->version >= SSL_LIBRARY_VERSION_TLS_1_0, cwSpec->recordVersion,
- isDTLS, contentLen, &pseudoHeader);
- PORT_Assert(rv == SECSuccess);
- if (cwSpec->cipherDef->type == type_aead) {
- const int nonceLen = cwSpec->cipherDef->explicit_nonce_size;
- const int tagLen = cwSpec->cipherDef->tag_size;
+ if (cwSpec->compressor) {
+ int outlen;
+ rv = cwSpec->compressor(cwSpec->compressContext, wrBuf->buf + ivLen,
+ &outlen, wrBuf->space - ivLen, pIn, contentLen);
+ if (rv != SECSuccess)
+ return rv;
+ pIn = wrBuf->buf + ivLen;
+ contentLen = outlen;
+ }
+
+ pseudoHeaderLen = ssl3_BuildRecordPseudoHeader(
+ pseudoHeader, cwSpec->write_seq_num, type,
+ cwSpec->version >= SSL_LIBRARY_VERSION_TLS_1_0, cwSpec->version,
+ isDTLS, contentLen);
+ PORT_Assert(pseudoHeaderLen <= sizeof(pseudoHeader));
+ if (cipher_def->type == type_aead) {
+ const int nonceLen = cipher_def->explicit_nonce_size;
+ const int tagLen = cipher_def->tag_size;
if (nonceLen + contentLen + tagLen > wrBuf->space) {
PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
@@ -2049,26 +2437,23 @@ ssl3_MACEncryptRecord(ssl3CipherSpec *cwSpec,
}
rv = cwSpec->aead(
- &cwSpec->keyMaterial,
+ isServer ? &cwSpec->server : &cwSpec->client,
PR_FALSE, /* do encrypt */
wrBuf->buf, /* output */
(int *)&wrBuf->len, /* out len */
wrBuf->space, /* max out */
pIn, contentLen, /* input */
- SSL_BUFFER_BASE(&pseudoHeader), SSL_BUFFER_LEN(&pseudoHeader));
+ pseudoHeader, pseudoHeaderLen);
if (rv != SECSuccess) {
PORT_SetError(SSL_ERROR_ENCRYPTION_FAILURE);
return SECFailure;
}
} else {
- int blockSize = cwSpec->cipherDef->block_size;
-
/*
* Add the MAC
*/
- rv = ssl3_ComputeRecordMAC(cwSpec, SSL_BUFFER_BASE(&pseudoHeader),
- SSL_BUFFER_LEN(&pseudoHeader),
- pIn, contentLen,
+ rv = ssl3_ComputeRecordMAC(cwSpec, isServer, pseudoHeader,
+ pseudoHeaderLen, pIn, contentLen,
wrBuf->buf + ivLen + contentLen, &macLen);
if (rv != SECSuccess) {
ssl_MapLowLevelError(SSL_ERROR_MAC_COMPUTATION_FAILURE);
@@ -2083,16 +2468,16 @@ ssl3_MACEncryptRecord(ssl3CipherSpec *cwSpec,
* Pad the text (if we're doing a block cipher)
* then Encrypt it
*/
- if (cwSpec->cipherDef->type == type_block) {
+ if (cipher_def->type == type_block) {
unsigned char *pBuf;
int padding_length;
int i;
- oddLen = contentLen % blockSize;
+ oddLen = contentLen % cipher_def->block_size;
/* Assume blockSize is a power of two */
- padding_length = blockSize - 1 - ((fragLen) & (blockSize - 1));
+ padding_length = cipher_def->block_size - 1 - ((fragLen) & (cipher_def->block_size - 1));
fragLen += padding_length + 1;
- PORT_Assert((fragLen % blockSize) == 0);
+ PORT_Assert((fragLen % cipher_def->block_size) == 0);
/* Pad according to TLS rules (also acceptable to SSL3). */
pBuf = &wrBuf->buf[ivLen + fragLen - 1];
@@ -2110,13 +2495,13 @@ ssl3_MACEncryptRecord(ssl3CipherSpec *cwSpec,
}
if (oddLen) {
p2Len += oddLen;
- PORT_Assert((blockSize < 2) ||
- (p2Len % blockSize) == 0);
+ PORT_Assert((cipher_def->block_size < 2) ||
+ (p2Len % cipher_def->block_size) == 0);
memmove(wrBuf->buf + ivLen + p1Len, pIn + p1Len, oddLen);
}
if (p1Len > 0) {
int cipherBytesPart1 = -1;
- rv = cwSpec->cipher(cwSpec->cipherContext,
+ rv = cwSpec->encode(cwSpec->encodeContext,
wrBuf->buf + ivLen, /* output */
&cipherBytesPart1, /* actual outlen */
p1Len, /* max outlen */
@@ -2131,7 +2516,7 @@ ssl3_MACEncryptRecord(ssl3CipherSpec *cwSpec,
}
if (p2Len > 0) {
int cipherBytesPart2 = -1;
- rv = cwSpec->cipher(cwSpec->cipherContext,
+ rv = cwSpec->encode(cwSpec->encodeContext,
wrBuf->buf + ivLen + p1Len,
&cipherBytesPart2, /* output and actual outLen */
p2Len, /* max outlen */
@@ -2149,66 +2534,34 @@ ssl3_MACEncryptRecord(ssl3CipherSpec *cwSpec,
return SECSuccess;
}
-/* Note: though this can report failure, it shouldn't. */
-static SECStatus
-ssl_InsertRecordHeader(const sslSocket *ss, ssl3CipherSpec *cwSpec,
- SSL3ContentType contentType, unsigned int len,
- sslBuffer *wrBuf)
-{
- SECStatus rv;
-
-#ifndef UNSAFE_FUZZER_MODE
- if (cwSpec->version >= SSL_LIBRARY_VERSION_TLS_1_3 &&
- cwSpec->cipherDef->calg != ssl_calg_null) {
- contentType = content_application_data;
- }
-#endif
- rv = sslBuffer_AppendNumber(wrBuf, contentType, 1);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- rv = sslBuffer_AppendNumber(wrBuf, cwSpec->recordVersion, 2);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- if (IS_DTLS(ss)) {
- rv = sslBuffer_AppendNumber(wrBuf, cwSpec->epoch, 2);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- rv = sslBuffer_AppendNumber(wrBuf, cwSpec->seqNum, 6);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- }
- rv = sslBuffer_AppendNumber(wrBuf, len, 2);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- return SECSuccess;
-}
-
SECStatus
-ssl_ProtectRecord(sslSocket *ss, ssl3CipherSpec *cwSpec, SSL3ContentType type,
+ssl_ProtectRecord(sslSocket *ss, ssl3CipherSpec *cwSpec,
+ PRBool capRecordVersion, SSL3ContentType type,
const PRUint8 *pIn, PRUint32 contentLen, sslBuffer *wrBuf)
{
- unsigned int headerLen = IS_DTLS(ss) ? DTLS_RECORD_HEADER_LENGTH
- : SSL3_RECORD_HEADER_LENGTH;
- sslBuffer protBuf = SSL_BUFFER_FIXED(SSL_BUFFER_BASE(wrBuf) + headerLen,
- SSL_BUFFER_SPACE(wrBuf) - headerLen);
+ const ssl3BulkCipherDef *cipher_def = cwSpec->cipher_def;
+ PRUint16 headerLen;
+ sslBuffer protBuf;
+ SSL3ProtocolVersion version = cwSpec->version;
PRBool isTLS13;
+ PRUint8 *ptr = wrBuf->buf;
SECStatus rv;
- PORT_Assert(cwSpec->direction == CipherSpecWrite);
- PORT_Assert(SSL_BUFFER_LEN(wrBuf) == 0);
- PORT_Assert(cwSpec->cipherDef->max_records <= RECORD_SEQ_MAX);
- if (cwSpec->seqNum >= cwSpec->cipherDef->max_records) {
- /* We should have automatically updated before here in TLS 1.3. */
- PORT_Assert(cwSpec->version < SSL_LIBRARY_VERSION_TLS_1_3);
+ if (ss->ssl3.hs.shortHeaders) {
+ PORT_Assert(!IS_DTLS(ss));
+ PORT_Assert(ss->version >= SSL_LIBRARY_VERSION_TLS_1_3);
+ headerLen = TLS13_RECORD_HEADER_LENGTH_SHORT;
+ } else {
+ headerLen = IS_DTLS(ss) ? DTLS_RECORD_HEADER_LENGTH : SSL3_RECORD_HEADER_LENGTH;
+ }
+ protBuf.buf = wrBuf->buf + headerLen;
+ protBuf.len = 0;
+ protBuf.space = wrBuf->space - headerLen;
+
+ PORT_Assert(cipher_def->max_records <= RECORD_SEQ_MAX);
+ if ((cwSpec->write_seq_num & RECORD_SEQ_MAX) >= cipher_def->max_records) {
SSL_TRC(3, ("%d: SSL[-]: write sequence number at limit 0x%0llx",
- SSL_GETPID(), cwSpec->seqNum));
+ SSL_GETPID(), cwSpec->write_seq_num));
PORT_SetError(SSL_ERROR_TOO_MANY_RECORDS);
return SECFailure;
}
@@ -2216,22 +2569,15 @@ ssl_ProtectRecord(sslSocket *ss, ssl3CipherSpec *cwSpec, SSL3ContentType type,
isTLS13 = (PRBool)(cwSpec->version >= SSL_LIBRARY_VERSION_TLS_1_3);
#ifdef UNSAFE_FUZZER_MODE
- {
- int len;
- rv = Null_Cipher(NULL, SSL_BUFFER_BASE(&protBuf), &len,
- SSL_BUFFER_SPACE(&protBuf), pIn, contentLen);
- if (rv != SECSuccess) {
- return SECFailure; /* error was set */
- }
- rv = sslBuffer_Skip(&protBuf, len, NULL);
- PORT_Assert(rv == SECSuccess); /* Can't fail. */
- }
+ rv = Null_Cipher(NULL, protBuf.buf, (int *)&protBuf.len, protBuf.space,
+ pIn, contentLen);
#else
if (isTLS13) {
rv = tls13_ProtectRecord(ss, cwSpec, type, pIn, contentLen, &protBuf);
} else {
- rv = ssl3_MACEncryptRecord(cwSpec, ss->sec.isServer, IS_DTLS(ss), type,
- pIn, contentLen, &protBuf);
+ rv = ssl3_CompressMACEncryptRecord(cwSpec, ss->sec.isServer,
+ IS_DTLS(ss), capRecordVersion, type,
+ pIn, contentLen, &protBuf);
}
#endif
if (rv != SECSuccess) {
@@ -2239,58 +2585,40 @@ ssl_ProtectRecord(sslSocket *ss, ssl3CipherSpec *cwSpec, SSL3ContentType type,
}
PORT_Assert(protBuf.len <= MAX_FRAGMENT_LENGTH + (isTLS13 ? 256 : 1024));
+ wrBuf->len = protBuf.len + headerLen;
- rv = ssl_InsertRecordHeader(ss, cwSpec, type, SSL_BUFFER_LEN(&protBuf),
- wrBuf);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- PORT_Assert(SSL_BUFFER_LEN(wrBuf) == headerLen);
- rv = sslBuffer_Skip(wrBuf, SSL_BUFFER_LEN(&protBuf), NULL);
- if (rv != SECSuccess) {
- PORT_Assert(0); /* Can't fail. */
- return SECFailure;
- }
- ++cwSpec->seqNum;
-
- return SECSuccess;
-}
+ if (ss->ssl3.hs.shortHeaders) {
+ PORT_Assert(!IS_DTLS(ss)); /* Decoder not yet implemented. */
+ (void)ssl_EncodeUintX(0x8000 | protBuf.len, 2, ptr);
+ } else {
+#ifndef UNSAFE_FUZZER_MODE
+ if (isTLS13 && cipher_def->calg != ssl_calg_null) {
+ *ptr++ = content_application_data;
+ } else
+#endif
+ {
+ *ptr++ = type;
+ }
-SECStatus
-ssl_ProtectNextRecord(sslSocket *ss, ssl3CipherSpec *spec, SSL3ContentType type,
- const PRUint8 *pIn, unsigned int nIn,
- unsigned int *written)
-{
- sslBuffer *wrBuf = &ss->sec.writeBuf;
- unsigned int contentLen;
- unsigned int spaceNeeded;
- SECStatus rv;
+ if (IS_DTLS(ss)) {
+ version = isTLS13 ? SSL_LIBRARY_VERSION_TLS_1_1 : version;
+ version = dtls_TLSVersionToDTLSVersion(version);
- contentLen = PR_MIN(nIn, MAX_FRAGMENT_LENGTH);
- spaceNeeded = contentLen + SSL3_BUFFER_FUDGE;
- if (spec->version >= SSL_LIBRARY_VERSION_TLS_1_1 &&
- spec->cipherDef->type == type_block) {
- spaceNeeded += spec->cipherDef->iv_size;
- }
- if (spaceNeeded > SSL_BUFFER_SPACE(wrBuf)) {
- rv = sslBuffer_Grow(wrBuf, spaceNeeded);
- if (rv != SECSuccess) {
- SSL_DBG(("%d: SSL3[%d]: failed to expand write buffer to %d",
- SSL_GETPID(), ss->fd, spaceNeeded));
- return SECFailure;
+ ptr = ssl_EncodeUintX(version, 2, ptr);
+ ptr = ssl_EncodeUintX(cwSpec->write_seq_num, 8, ptr);
+ } else {
+ if (capRecordVersion || isTLS13) {
+ version = PR_MIN(SSL_LIBRARY_VERSION_TLS_1_0, version);
+ }
+ ptr = ssl_EncodeUintX(version, 2, ptr);
}
+ (void)ssl_EncodeUintX(protBuf.len, 2, ptr);
}
+ ++cwSpec->write_seq_num;
- rv = ssl_ProtectRecord(ss, spec, type, pIn, contentLen, wrBuf);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- PRINT_BUF(50, (ss, "send (encrypted) record data:",
- SSL_BUFFER_BASE(wrBuf), SSL_BUFFER_LEN(wrBuf)));
- *written = contentLen;
return SECSuccess;
}
+
/* Process the plain text before sending it.
* Returns the number of bytes of plaintext that were successfully sent
* plus the number of bytes of plaintext that were copied into the
@@ -2311,6 +2639,16 @@ ssl_ProtectNextRecord(sslSocket *ss, ssl3CipherSpec *spec, SSL3ContentType type,
* all ciphertext into the pending ciphertext buffer.
* ssl_SEND_FLAG_USE_EPOCH (for DTLS)
* Forces the use of the provided epoch
+ * ssl_SEND_FLAG_CAP_RECORD_VERSION
+ * Caps the record layer version number of TLS ClientHello to { 3, 1 }
+ * (TLS 1.0). Some TLS 1.0 servers (which seem to use F5 BIG-IP) ignore
+ * ClientHello.client_version and use the record layer version number
+ * (TLSPlaintext.version) instead when negotiating protocol versions. In
+ * addition, if the record layer version number of ClientHello is { 3, 2 }
+ * (TLS 1.1) or higher, these servers reset the TCP connections. Lastly,
+ * some F5 BIG-IP servers hang if a record containing a ClientHello has a
+ * version greater than { 3, 1 } and a length greater than 255. Set this
+ * flag to work around such servers.
*/
PRInt32
ssl3_SendRecord(sslSocket *ss,
@@ -2321,9 +2659,10 @@ ssl3_SendRecord(sslSocket *ss,
PRInt32 flags)
{
sslBuffer *wrBuf = &ss->sec.writeBuf;
- ssl3CipherSpec *spec;
SECStatus rv;
PRInt32 totalSent = 0;
+ PRBool capRecordVersion;
+ ssl3CipherSpec *spec;
SSL_TRC(3, ("%d: SSL3[%d] SendRecord type: %s nIn=%d",
SSL_GETPID(), ss->fd, ssl3_DecodeContentType(type),
@@ -2331,7 +2670,6 @@ ssl3_SendRecord(sslSocket *ss,
PRINT_BUF(50, (ss, "Send record (plain text)", pIn, nIn));
PORT_Assert(ss->opt.noLocks || ssl_HaveXmitBufLock(ss));
- PORT_Assert(SSL_BUFFER_LEN(wrBuf) == 0);
if (ss->ssl3.fatalAlertSent) {
SSL_TRC(3, ("%d: SSL3[%d] Suppress write, fatal alert already sent",
@@ -2339,41 +2677,114 @@ ssl3_SendRecord(sslSocket *ss,
return SECFailure;
}
+ capRecordVersion = ((flags & ssl_SEND_FLAG_CAP_RECORD_VERSION) != 0);
+
+ if (capRecordVersion) {
+ /* ssl_SEND_FLAG_CAP_RECORD_VERSION can only be used with the
+ * TLS initial ClientHello. */
+ PORT_Assert(!IS_DTLS(ss));
+ PORT_Assert(!ss->firstHsDone);
+ PORT_Assert(type == content_handshake);
+ PORT_Assert(ss->ssl3.hs.ws == wait_server_hello);
+ }
+
+ if (ss->ssl3.initialized == PR_FALSE) {
+ /* This can happen on a server if the very first incoming record
+ ** looks like a defective ssl3 record (e.g. too long), and we're
+ ** trying to send an alert.
+ */
+ PR_ASSERT(type == content_alert);
+ ssl3_InitState(ss);
+ }
+
/* check for Token Presence */
if (!ssl3_ClientAuthTokenPresent(ss->sec.ci.sid)) {
PORT_SetError(SSL_ERROR_TOKEN_INSERTION_REMOVAL);
return SECFailure;
}
- if (cwSpec) {
- /* cwSpec can only be set for retransmissions of the DTLS handshake. */
- PORT_Assert(IS_DTLS(ss) &&
- (type == content_handshake ||
- type == content_change_cipher_spec));
- spec = cwSpec;
- } else {
- spec = ss->ssl3.cwSpec;
- }
-
while (nIn > 0) {
- unsigned int written = 0;
- PRInt32 sent;
+ PRUint32 contentLen = PR_MIN(nIn, MAX_FRAGMENT_LENGTH);
+ unsigned int spaceNeeded;
+ unsigned int numRecords;
- ssl_GetSpecReadLock(ss);
- rv = ssl_ProtectNextRecord(ss, spec, type, pIn, nIn, &written);
- ssl_ReleaseSpecReadLock(ss);
- if (rv != SECSuccess) {
- return SECFailure;
+ ssl_GetSpecReadLock(ss); /********************************/
+
+ if (nIn > 1 && ss->opt.cbcRandomIV &&
+ ss->ssl3.cwSpec->version < SSL_LIBRARY_VERSION_TLS_1_1 &&
+ type == content_application_data &&
+ ss->ssl3.cwSpec->cipher_def->type == type_block /* CBC mode */) {
+ /* We will split the first byte of the record into its own record,
+ * as explained in the documentation for SSL_CBC_RANDOM_IV in ssl.h
+ */
+ numRecords = 2;
+ } else {
+ numRecords = 1;
}
- PORT_Assert(written > 0);
- /* DTLS should not fragment non-application data here. */
- if (IS_DTLS(ss) && type != content_application_data) {
- PORT_Assert(written == nIn);
+ spaceNeeded = contentLen + (numRecords * SSL3_BUFFER_FUDGE);
+ if (ss->ssl3.cwSpec->version >= SSL_LIBRARY_VERSION_TLS_1_1 &&
+ ss->ssl3.cwSpec->cipher_def->type == type_block) {
+ spaceNeeded += ss->ssl3.cwSpec->cipher_def->iv_size;
+ }
+ if (spaceNeeded > wrBuf->space) {
+ rv = sslBuffer_Grow(wrBuf, spaceNeeded);
+ if (rv != SECSuccess) {
+ SSL_DBG(("%d: SSL3[%d]: SendRecord, tried to get %d bytes",
+ SSL_GETPID(), ss->fd, spaceNeeded));
+ goto spec_locked_loser; /* sslBuffer_Grow set error code. */
+ }
+ }
+
+ if (numRecords == 2) {
+ sslBuffer secondRecord;
+ rv = ssl_ProtectRecord(ss, ss->ssl3.cwSpec, capRecordVersion, type,
+ pIn, 1, wrBuf);
+ if (rv != SECSuccess)
+ goto spec_locked_loser;
+
+ PRINT_BUF(50, (ss, "send (encrypted) record data [1/2]:",
+ wrBuf->buf, wrBuf->len));
+
+ secondRecord.buf = wrBuf->buf + wrBuf->len;
+ secondRecord.len = 0;
+ secondRecord.space = wrBuf->space - wrBuf->len;
+
+ rv = ssl_ProtectRecord(ss, ss->ssl3.cwSpec, capRecordVersion, type,
+ pIn + 1, contentLen - 1, &secondRecord);
+ if (rv == SECSuccess) {
+ PRINT_BUF(50, (ss, "send (encrypted) record data [2/2]:",
+ secondRecord.buf, secondRecord.len));
+ wrBuf->len += secondRecord.len;
+ }
+ } else {
+ if (cwSpec) {
+ /* cwSpec can only be set for retransmissions of DTLS handshake
+ * messages. */
+ PORT_Assert(IS_DTLS(ss) &&
+ (type == content_handshake ||
+ type == content_change_cipher_spec));
+ spec = cwSpec;
+ } else {
+ spec = ss->ssl3.cwSpec;
+ }
+
+ rv = ssl_ProtectRecord(ss, spec, !IS_DTLS(ss) && capRecordVersion,
+ type, pIn, contentLen, wrBuf);
+ if (rv == SECSuccess) {
+ PRINT_BUF(50, (ss, "send (encrypted) record data:",
+ wrBuf->buf, wrBuf->len));
+ }
}
- pIn += written;
- nIn -= written;
+ spec_locked_loser:
+ ssl_ReleaseSpecReadLock(ss); /************************************/
+
+ if (rv != SECSuccess)
+ return SECFailure;
+
+ pIn += contentLen;
+ nIn -= contentLen;
PORT_Assert(nIn >= 0);
/* If there's still some previously saved ciphertext,
@@ -2383,64 +2794,58 @@ ssl3_SendRecord(sslSocket *ss,
if ((ss->pendingBuf.len > 0) ||
(flags & ssl_SEND_FLAG_FORCE_INTO_BUFFER)) {
- rv = ssl_SaveWriteData(ss, SSL_BUFFER_BASE(wrBuf),
- SSL_BUFFER_LEN(wrBuf));
+ rv = ssl_SaveWriteData(ss, wrBuf->buf, wrBuf->len);
if (rv != SECSuccess) {
/* presumably a memory error, SEC_ERROR_NO_MEMORY */
- goto loser;
+ return SECFailure;
}
+ wrBuf->len = 0; /* All cipher text is saved away. */
if (!(flags & ssl_SEND_FLAG_FORCE_INTO_BUFFER)) {
+ PRInt32 sent;
ss->handshakeBegun = 1;
sent = ssl_SendSavedWriteData(ss);
if (sent < 0 && PR_GetError() != PR_WOULD_BLOCK_ERROR) {
ssl_MapLowLevelError(SSL_ERROR_SOCKET_WRITE_FAILURE);
- goto loser;
+ return SECFailure;
}
if (ss->pendingBuf.len) {
flags |= ssl_SEND_FLAG_FORCE_INTO_BUFFER;
}
}
- } else {
- PORT_Assert(SSL_BUFFER_LEN(wrBuf) > 0);
+ } else if (wrBuf->len > 0) {
+ PRInt32 sent;
ss->handshakeBegun = 1;
- sent = ssl_DefSend(ss, SSL_BUFFER_BASE(wrBuf),
- SSL_BUFFER_LEN(wrBuf),
+ sent = ssl_DefSend(ss, wrBuf->buf, wrBuf->len,
flags & ~ssl_SEND_FLAG_MASK);
if (sent < 0) {
- if (PORT_GetError() != PR_WOULD_BLOCK_ERROR) {
+ if (PR_GetError() != PR_WOULD_BLOCK_ERROR) {
ssl_MapLowLevelError(SSL_ERROR_SOCKET_WRITE_FAILURE);
- goto loser;
+ return SECFailure;
}
/* we got PR_WOULD_BLOCK_ERROR, which means none was sent. */
sent = 0;
}
- if (SSL_BUFFER_LEN(wrBuf) > (unsigned int)sent) {
+ wrBuf->len -= sent;
+ if (wrBuf->len) {
if (IS_DTLS(ss)) {
/* DTLS just says no in this case. No buffering */
- PORT_SetError(PR_WOULD_BLOCK_ERROR);
- goto loser;
+ PR_SetError(PR_WOULD_BLOCK_ERROR, 0);
+ return SECFailure;
}
/* now take all the remaining unsent new ciphertext and
* append it to the buffer of previously unsent ciphertext.
*/
- rv = ssl_SaveWriteData(ss, SSL_BUFFER_BASE(wrBuf) + sent,
- SSL_BUFFER_LEN(wrBuf) - sent);
+ rv = ssl_SaveWriteData(ss, wrBuf->buf + sent, wrBuf->len);
if (rv != SECSuccess) {
/* presumably a memory error, SEC_ERROR_NO_MEMORY */
- goto loser;
+ return SECFailure;
}
}
}
- wrBuf->len = 0;
- totalSent += written;
+ totalSent += contentLen;
}
return totalSent;
-
-loser:
- /* Don't leave bits of buffer lying around. */
- wrBuf->len = 0;
- return -1;
}
#define SSL3_PENDING_HIGH_WATER 1024
@@ -2454,7 +2859,6 @@ ssl3_SendApplicationData(sslSocket *ss, const unsigned char *in,
{
PRInt32 totalSent = 0;
PRInt32 discarded = 0;
- PRBool splitNeeded = PR_FALSE;
PORT_Assert(ss->opt.noLocks || ssl_HaveXmitBufLock(ss));
/* These flags for internal use only */
@@ -2481,16 +2885,6 @@ ssl3_SendApplicationData(sslSocket *ss, const unsigned char *in,
len--;
discarded = 1;
}
-
- /* We will split the first byte of the record into its own record, as
- * explained in the documentation for SSL_CBC_RANDOM_IV in ssl.h.
- */
- if (len > 1 && ss->opt.cbcRandomIV &&
- ss->version < SSL_LIBRARY_VERSION_TLS_1_1 &&
- ss->ssl3.cwSpec->cipherDef->type == type_block /* CBC */) {
- splitNeeded = PR_TRUE;
- }
-
while (len > totalSent) {
PRInt32 sent, toSend;
@@ -2505,13 +2899,7 @@ ssl3_SendApplicationData(sslSocket *ss, const unsigned char *in,
PR_Sleep(PR_INTERVAL_NO_WAIT); /* PR_Yield(); */
ssl_GetXmitBufLock(ss);
}
-
- if (splitNeeded) {
- toSend = 1;
- splitNeeded = PR_FALSE;
- } else {
- toSend = PR_MIN(len - totalSent, MAX_FRAGMENT_LENGTH);
- }
+ toSend = PR_MIN(len - totalSent, MAX_FRAGMENT_LENGTH);
/*
* Note that the 0 epoch is OK because flags will never require
@@ -2571,8 +2959,9 @@ ssl3_FlushHandshake(sslSocket *ss, PRInt32 flags)
{
if (IS_DTLS(ss)) {
return dtls_FlushHandshakeMessages(ss, flags);
+ } else {
+ return ssl3_FlushHandshakeMessages(ss, flags);
}
- return ssl3_FlushHandshakeMessages(ss, flags);
}
/* Attempt to send the content of sendBuf buffer in an SSL handshake record.
@@ -2584,7 +2973,8 @@ ssl3_FlushHandshake(sslSocket *ss, PRInt32 flags)
static SECStatus
ssl3_FlushHandshakeMessages(sslSocket *ss, PRInt32 flags)
{
- static const PRInt32 allowedFlags = ssl_SEND_FLAG_FORCE_INTO_BUFFER;
+ static const PRInt32 allowedFlags = ssl_SEND_FLAG_FORCE_INTO_BUFFER |
+ ssl_SEND_FLAG_CAP_RECORD_VERSION;
PRInt32 count = -1;
SECStatus rv;
@@ -2715,15 +3105,6 @@ SSL3_SendAlert(sslSocket *ss, SSL3AlertLevel level, SSL3AlertDescription desc)
ss->sec.uncache(ss->sec.ci.sid);
}
}
-
- rv = tls13_SetAlertCipherSpec(ss);
- if (rv != SECSuccess) {
- if (needHsLock) {
- ssl_ReleaseSSL3HandshakeLock(ss);
- }
- return rv;
- }
-
ssl_GetXmitBufLock(ss);
rv = ssl3_FlushHandshake(ss, ssl_SEND_FLAG_FORCE_INTO_BUFFER);
if (rv == SECSuccess) {
@@ -2959,6 +3340,9 @@ ssl3_HandleAlert(sslSocket *ss, sslBuffer *buf)
case bad_certificate_hash_value:
error = SSL_ERROR_BAD_CERT_HASH_VALUE_ALERT;
break;
+ case end_of_early_data:
+ error = SSL_ERROR_END_OF_EARLY_DATA_ALERT;
+ break;
default:
error = SSL_ERROR_RX_UNKNOWN_ALERT;
break;
@@ -2970,6 +3354,7 @@ ssl3_HandleAlert(sslSocket *ss, sslBuffer *buf)
switch (desc) {
case close_notify:
case user_canceled:
+ case end_of_early_data:
break;
default:
level = alert_fatal;
@@ -2989,6 +3374,9 @@ ssl3_HandleAlert(sslSocket *ss, sslBuffer *buf)
PORT_SetError(error);
return SECFailure;
}
+ if (desc == end_of_early_data) {
+ return tls13_HandleEndOfEarlyData(ss);
+ }
if ((desc == no_certificate) && (ss->ssl3.hs.ws == wait_client_cert)) {
/* I'm a server. I've requested a client cert. He hasn't got one. */
SECStatus rv;
@@ -3011,64 +3399,59 @@ ssl3_HandleAlert(sslSocket *ss, sslBuffer *buf)
* and pending write spec pointers.
*/
-SECStatus
-ssl3_SendChangeCipherSpecsInt(sslSocket *ss)
+static SECStatus
+ssl3_SendChangeCipherSpecs(sslSocket *ss)
{
PRUint8 change = change_cipher_spec_choice;
+ ssl3CipherSpec *pwSpec;
SECStatus rv;
+ PRInt32 sent;
SSL_TRC(3, ("%d: SSL3[%d]: send change_cipher_spec record",
SSL_GETPID(), ss->fd));
+ PORT_Assert(ss->opt.noLocks || ssl_HaveXmitBufLock(ss));
+ PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
+
rv = ssl3_FlushHandshake(ss, ssl_SEND_FLAG_FORCE_INTO_BUFFER);
if (rv != SECSuccess) {
- return SECFailure; /* error code set by ssl3_FlushHandshake */
+ return rv; /* error code set by ssl3_FlushHandshake */
}
-
if (!IS_DTLS(ss)) {
- PRInt32 sent;
- sent = ssl3_SendRecord(ss, NULL, content_change_cipher_spec,
- &change, 1, ssl_SEND_FLAG_FORCE_INTO_BUFFER);
+ sent = ssl3_SendRecord(ss, NULL, content_change_cipher_spec, &change, 1,
+ ssl_SEND_FLAG_FORCE_INTO_BUFFER);
if (sent < 0) {
- return SECFailure; /* error code set by ssl3_SendRecord */
+ return (SECStatus)sent; /* error code set by ssl3_SendRecord */
}
} else {
- SECStatus rv;
rv = dtls_QueueMessage(ss, content_change_cipher_spec, &change, 1);
if (rv != SECSuccess) {
- return SECFailure;
+ return rv;
}
}
- return SECSuccess;
-}
-
-static SECStatus
-ssl3_SendChangeCipherSpecs(sslSocket *ss)
-{
- SECStatus rv;
-
- PORT_Assert(ss->opt.noLocks || ssl_HaveXmitBufLock(ss));
- PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
-
- rv = ssl3_SendChangeCipherSpecsInt(ss);
- if (rv != SECSuccess) {
- return rv; /* Error code set. */
- }
/* swap the pending and current write specs. */
ssl_GetSpecWriteLock(ss); /**************************************/
+ pwSpec = ss->ssl3.pwSpec;
- ssl_CipherSpecRelease(ss->ssl3.cwSpec);
- ss->ssl3.cwSpec = ss->ssl3.pwSpec;
- ss->ssl3.pwSpec = NULL;
+ ss->ssl3.pwSpec = ss->ssl3.cwSpec;
+ ss->ssl3.cwSpec = pwSpec;
SSL_TRC(3, ("%d: SSL3[%d] Set Current Write Cipher Suite to Pending",
SSL_GETPID(), ss->fd));
- /* With DTLS, we need to set a holddown timer in case the final
- * message got lost */
- if (IS_DTLS(ss) && ss->ssl3.crSpec->epoch == ss->ssl3.cwSpec->epoch) {
- rv = dtls_StartHolddownTimer(ss);
+ /* We need to free up the contexts, keys and certs ! */
+ /* If we are really through with the old cipher spec
+ * (Both the read and write sides have changed) destroy it.
+ */
+ if (ss->ssl3.prSpec == ss->ssl3.pwSpec) {
+ if (!IS_DTLS(ss)) {
+ ssl3_DestroyCipherSpec(ss->ssl3.pwSpec, PR_FALSE /*freeSrvName*/);
+ } else {
+ /* With DTLS, we need to set a holddown timer in case the final
+ * message got lost */
+ rv = dtls_StartHolddownTimer(ss);
+ }
}
ssl_ReleaseSpecWriteLock(ss); /**************************************/
@@ -3084,6 +3467,7 @@ ssl3_SendChangeCipherSpecs(sslSocket *ss)
static SECStatus
ssl3_HandleChangeCipherSpecs(sslSocket *ss, sslBuffer *buf)
{
+ ssl3CipherSpec *prSpec;
SSL3WaitState ws = ss->ssl3.hs.ws;
SSL3ChangeCipherSpecChoice change;
@@ -3093,18 +3477,19 @@ ssl3_HandleChangeCipherSpecs(sslSocket *ss, sslBuffer *buf)
SSL_TRC(3, ("%d: SSL3[%d]: handle change_cipher_spec record",
SSL_GETPID(), ss->fd));
- /* For DTLS: Ignore this if we aren't expecting it. Don't kill a connection
- * as a result of receiving trash.
- * For TLS: Maybe ignore, but only after checking format. */
- if (ws != wait_change_cipher && IS_DTLS(ss)) {
- /* Ignore this because it's out of order. */
- SSL_TRC(3, ("%d: SSL3[%d]: discard out of order "
- "DTLS change_cipher_spec",
- SSL_GETPID(), ss->fd));
- buf->len = 0;
- return SECSuccess;
+ if (ws != wait_change_cipher) {
+ if (IS_DTLS(ss)) {
+ /* Ignore this because it's out of order. */
+ SSL_TRC(3, ("%d: SSL3[%d]: discard out of order "
+ "DTLS change_cipher_spec",
+ SSL_GETPID(), ss->fd));
+ buf->len = 0;
+ return SECSuccess;
+ }
+ (void)SSL3_SendAlert(ss, alert_fatal, unexpected_message);
+ PORT_SetError(SSL_ERROR_RX_UNEXPECTED_CHANGE_CIPHER);
+ return SECFailure;
}
-
/* Handshake messages should not span ChangeCipherSpec. */
if (ss->ssl3.hs.header_bytes) {
(void)SSL3_SendAlert(ss, alert_fatal, unexpected_message);
@@ -3123,44 +3508,26 @@ ssl3_HandleChangeCipherSpecs(sslSocket *ss, sslBuffer *buf)
PORT_SetError(SSL_ERROR_RX_MALFORMED_CHANGE_CIPHER);
return SECFailure;
}
-
buf->len = 0;
- if (ws != wait_change_cipher) {
- /* Ignore a CCS for TLS 1.3. This only happens if the server sends a
- * HelloRetryRequest. In other cases, the CCS will fail decryption and
- * will be discarded by ssl3_HandleRecord(). */
- if (ws == wait_server_hello &&
- ss->version >= SSL_LIBRARY_VERSION_TLS_1_3 &&
- ss->ssl3.hs.helloRetry) {
- PORT_Assert(!ss->sec.isServer);
- return SECSuccess;
- }
- /* Note: For a server, we can't test ss->ssl3.hs.helloRetry or
- * ss->version because the server might be stateless (and so it won't
- * have set either value yet). Set a flag so that at least we will
- * guarantee that the server will treat any ClientHello properly. */
- if (ws == wait_client_hello &&
- ss->vrange.max >= SSL_LIBRARY_VERSION_TLS_1_3 &&
- !ss->ssl3.hs.receivedCcs) {
- PORT_Assert(ss->sec.isServer);
- ss->ssl3.hs.receivedCcs = PR_TRUE;
- return SECSuccess;
- }
- (void)SSL3_SendAlert(ss, alert_fatal, unexpected_message);
- PORT_SetError(SSL_ERROR_RX_UNEXPECTED_CHANGE_CIPHER);
- return SECFailure;
- }
- SSL_TRC(3, ("%d: SSL3[%d] Set Current Read Cipher Suite to Pending",
- SSL_GETPID(), ss->fd));
+ /* Swap the pending and current read specs. */
ssl_GetSpecWriteLock(ss); /*************************************/
- PORT_Assert(ss->ssl3.prSpec);
- ssl_CipherSpecRelease(ss->ssl3.crSpec);
- ss->ssl3.crSpec = ss->ssl3.prSpec;
- ss->ssl3.prSpec = NULL;
- ssl_ReleaseSpecWriteLock(ss); /*************************************/
+ prSpec = ss->ssl3.prSpec;
+ ss->ssl3.prSpec = ss->ssl3.crSpec;
+ ss->ssl3.crSpec = prSpec;
ss->ssl3.hs.ws = wait_finished;
+
+ SSL_TRC(3, ("%d: SSL3[%d] Set Current Read Cipher Suite to Pending",
+ SSL_GETPID(), ss->fd));
+
+ /* If we are really through with the old cipher prSpec
+ * (Both the read and write sides have changed) destroy it.
+ */
+ if (ss->ssl3.prSpec == ss->ssl3.pwSpec) {
+ ssl3_DestroyCipherSpec(ss->ssl3.prSpec, PR_FALSE /*freeSrvName*/);
+ }
+ ssl_ReleaseSpecWriteLock(ss); /*************************************/
return SECSuccess;
}
@@ -3283,8 +3650,12 @@ static SECStatus
ssl3_ComputeMasterSecretInt(sslSocket *ss, PK11SymKey *pms,
PK11SymKey **msp)
{
- PRBool isTLS = (PRBool)(ss->version > SSL_LIBRARY_VERSION_3_0);
- PRBool isTLS12 = (PRBool)(ss->version >= SSL_LIBRARY_VERSION_TLS_1_2);
+ ssl3CipherSpec *pwSpec = ss->ssl3.pwSpec;
+ unsigned char *cr = (unsigned char *)&ss->ssl3.hs.client_random;
+ unsigned char *sr = (unsigned char *)&ss->ssl3.hs.server_random;
+ PRBool isTLS = (PRBool)(pwSpec->version > SSL_LIBRARY_VERSION_3_0);
+ PRBool isTLS12 =
+ (PRBool)(isTLS && pwSpec->version >= SSL_LIBRARY_VERSION_TLS_1_2);
/*
* Whenever isDH is true, we need to use CKM_TLS_MASTER_KEY_DERIVE_DH
* which, unlike CKM_TLS_MASTER_KEY_DERIVE, converts arbitrary size
@@ -3330,9 +3701,9 @@ ssl3_ComputeMasterSecretInt(sslSocket *ss, PK11SymKey *pms,
}
master_params.pVersion = pms_version_ptr;
- master_params.RandomInfo.pClientRandom = ss->ssl3.hs.client_random;
+ master_params.RandomInfo.pClientRandom = cr;
master_params.RandomInfo.ulClientRandomLen = SSL3_RANDOM_LENGTH;
- master_params.RandomInfo.pServerRandom = ss->ssl3.hs.server_random;
+ master_params.RandomInfo.pServerRandom = sr;
master_params.RandomInfo.ulServerRandomLen = SSL3_RANDOM_LENGTH;
if (isTLS12) {
master_params.prfHashMechanism = ssl3_GetPrfHashMechanism(ss);
@@ -3392,7 +3763,7 @@ tls_ComputeExtendedMasterSecretInt(sslSocket *ss, PK11SymKey *pms,
pms_version_ptr = &pms_version;
}
- if (ss->version >= SSL_LIBRARY_VERSION_TLS_1_2) {
+ if (pwSpec->version >= SSL_LIBRARY_VERSION_TLS_1_2) {
/* TLS 1.2+ */
extended_master_params.prfHashMechanism = ssl3_GetPrfHashMechanism(ss);
key_derive = CKM_TLS12_KEY_AND_MAC_DERIVE;
@@ -3424,6 +3795,7 @@ ssl3_ComputeMasterSecret(sslSocket *ss, PK11SymKey *pms,
{
PORT_Assert(pms != NULL);
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
+ PORT_Assert(ss->ssl3.prSpec == ss->ssl3.pwSpec);
if (ssl3_ExtensionNegotiated(ss, ssl_extended_master_secret_xtn)) {
return tls_ComputeExtendedMasterSecretInt(ss, pms, msp);
@@ -3432,6 +3804,36 @@ ssl3_ComputeMasterSecret(sslSocket *ss, PK11SymKey *pms,
}
}
+/* This method uses PKCS11 to derive the MS from the PMS, where PMS
+** is a PKCS11 symkey. We call ssl3_ComputeMasterSecret to do the
+** computations and then modify the pwSpec->state as a side effect.
+**
+** This is used in all cases except the "triple bypass" with RSA key
+** exchange.
+**
+** Called from ssl3_InitPendingCipherSpec. prSpec is pwSpec.
+*/
+static SECStatus
+ssl3_DeriveMasterSecret(sslSocket *ss, PK11SymKey *pms)
+{
+ SECStatus rv;
+ PK11SymKey *ms = NULL;
+ ssl3CipherSpec *pwSpec = ss->ssl3.pwSpec;
+
+ PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
+ PORT_Assert(ss->opt.noLocks || ssl_HaveSpecWriteLock(ss));
+ PORT_Assert(ss->ssl3.prSpec == ss->ssl3.pwSpec);
+
+ if (pms) {
+ rv = ssl3_ComputeMasterSecret(ss, pms, &ms);
+ pwSpec->master_secret = ms;
+ if (rv != SECSuccess)
+ return rv;
+ }
+
+ return SECSuccess;
+}
+
/*
* Derive encryption and MAC Keys (and IVs) from master secret
* Sets a useful error code when returning SECFailure.
@@ -3448,18 +3850,17 @@ ssl3_ComputeMasterSecret(sslSocket *ss, PK11SymKey *pms,
*
*/
static SECStatus
-ssl3_DeriveConnectionKeys(sslSocket *ss, PK11SymKey *masterSecret)
+ssl3_DeriveConnectionKeys(sslSocket *ss)
{
ssl3CipherSpec *pwSpec = ss->ssl3.pwSpec;
- ssl3CipherSpec *prSpec = ss->ssl3.prSpec;
- ssl3CipherSpec *clientSpec;
- ssl3CipherSpec *serverSpec;
- PRBool isTLS = (PRBool)(ss->version > SSL_LIBRARY_VERSION_3_0);
+ unsigned char *cr = (unsigned char *)&ss->ssl3.hs.client_random;
+ unsigned char *sr = (unsigned char *)&ss->ssl3.hs.server_random;
+ PRBool isTLS = (PRBool)(pwSpec->version > SSL_LIBRARY_VERSION_3_0);
PRBool isTLS12 =
- (PRBool)(isTLS && ss->version >= SSL_LIBRARY_VERSION_TLS_1_2);
- const ssl3BulkCipherDef *cipher_def = pwSpec->cipherDef;
+ (PRBool)(isTLS && pwSpec->version >= SSL_LIBRARY_VERSION_TLS_1_2);
+ const ssl3BulkCipherDef *cipher_def = pwSpec->cipher_def;
PK11SlotInfo *slot = NULL;
- PK11SymKey *derivedKeyHandle = NULL;
+ PK11SymKey *symKey = NULL;
void *pwArg = ss->pkcs11PinArg;
int keySize;
CK_TLS12_KEY_MAT_PARAMS key_material_params; /* may be used as a
@@ -3470,53 +3871,48 @@ ssl3_DeriveConnectionKeys(sslSocket *ss, PK11SymKey *masterSecret)
CK_MECHANISM_TYPE bulk_mechanism;
SSLCipherAlgorithm calg;
SECItem params;
- PRBool skipKeysAndIVs = (PRBool)(cipher_def->calg == ssl_calg_null);
+ PRBool skipKeysAndIVs = (PRBool)(cipher_def->calg == calg_null);
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
PORT_Assert(ss->opt.noLocks || ssl_HaveSpecWriteLock(ss));
- PORT_Assert(masterSecret);
+ PORT_Assert(ss->ssl3.prSpec == ss->ssl3.pwSpec);
- /* These functions operate in terms of who is writing specs. */
- if (ss->sec.isServer) {
- clientSpec = prSpec;
- serverSpec = pwSpec;
- } else {
- clientSpec = pwSpec;
- serverSpec = prSpec;
+ if (!pwSpec->master_secret) {
+ PORT_SetError(SSL_ERROR_SESSION_KEY_GEN_FAILURE);
+ return SECFailure;
}
-
/*
* generate the key material
*/
+ key_material_params.ulMacSizeInBits = pwSpec->mac_size * BPB;
+ key_material_params.ulKeySizeInBits = cipher_def->secret_key_size * BPB;
+ key_material_params.ulIVSizeInBits = cipher_def->iv_size * BPB;
if (cipher_def->type == type_block &&
- ss->version >= SSL_LIBRARY_VERSION_TLS_1_1) {
+ pwSpec->version >= SSL_LIBRARY_VERSION_TLS_1_1) {
/* Block ciphers in >= TLS 1.1 use a per-record, explicit IV. */
key_material_params.ulIVSizeInBits = 0;
- PORT_Memset(clientSpec->keyMaterial.iv, 0, cipher_def->iv_size);
- PORT_Memset(serverSpec->keyMaterial.iv, 0, cipher_def->iv_size);
+ memset(pwSpec->client.write_iv, 0, cipher_def->iv_size);
+ memset(pwSpec->server.write_iv, 0, cipher_def->iv_size);
}
key_material_params.bIsExport = PR_FALSE;
- key_material_params.RandomInfo.pClientRandom = ss->ssl3.hs.client_random;
+ key_material_params.RandomInfo.pClientRandom = cr;
key_material_params.RandomInfo.ulClientRandomLen = SSL3_RANDOM_LENGTH;
- key_material_params.RandomInfo.pServerRandom = ss->ssl3.hs.server_random;
+ key_material_params.RandomInfo.pServerRandom = sr;
key_material_params.RandomInfo.ulServerRandomLen = SSL3_RANDOM_LENGTH;
key_material_params.pReturnedKeyMaterial = &returnedKeys;
+ returnedKeys.pIVClient = pwSpec->client.write_iv;
+ returnedKeys.pIVServer = pwSpec->server.write_iv;
+ keySize = cipher_def->key_size;
+
if (skipKeysAndIVs) {
keySize = 0;
- returnedKeys.pIVClient = NULL;
- returnedKeys.pIVServer = NULL;
key_material_params.ulKeySizeInBits = 0;
key_material_params.ulIVSizeInBits = 0;
- } else {
- keySize = cipher_def->key_size;
- returnedKeys.pIVClient = clientSpec->keyMaterial.iv;
- returnedKeys.pIVServer = serverSpec->keyMaterial.iv;
- key_material_params.ulKeySizeInBits = cipher_def->secret_key_size * BPB;
- key_material_params.ulIVSizeInBits = cipher_def->iv_size * BPB;
+ returnedKeys.pIVClient = NULL;
+ returnedKeys.pIVServer = NULL;
}
- key_material_params.ulMacSizeInBits = pwSpec->macDef->mac_size * BPB;
calg = cipher_def->calg;
bulk_mechanism = ssl3_Alg2Mech(calg);
@@ -3538,9 +3934,9 @@ ssl3_DeriveConnectionKeys(sslSocket *ss, PK11SymKey *masterSecret)
/* CKM_SSL3_KEY_AND_MAC_DERIVE is defined to set ENCRYPT, DECRYPT, and
* DERIVE by DEFAULT */
- derivedKeyHandle = PK11_Derive(masterSecret, key_derive, &params,
- bulk_mechanism, CKA_ENCRYPT, keySize);
- if (!derivedKeyHandle) {
+ symKey = PK11_Derive(pwSpec->master_secret, key_derive, &params,
+ bulk_mechanism, CKA_ENCRYPT, keySize);
+ if (!symKey) {
ssl_MapLowLevelError(SSL_ERROR_SESSION_KEY_GEN_FAILURE);
return SECFailure;
}
@@ -3548,44 +3944,41 @@ ssl3_DeriveConnectionKeys(sslSocket *ss, PK11SymKey *masterSecret)
* don't because these types are used to map keytype anyway and both
* mac's map to the same keytype.
*/
- slot = PK11_GetSlotFromKey(derivedKeyHandle);
+ slot = PK11_GetSlotFromKey(symKey);
PK11_FreeSlot(slot); /* slot is held until the key is freed */
- clientSpec->keyMaterial.macKey =
- PK11_SymKeyFromHandle(slot, derivedKeyHandle, PK11_OriginDerive,
- CKM_SSL3_SHA1_MAC, returnedKeys.hClientMacSecret,
- PR_TRUE, pwArg);
- if (clientSpec->keyMaterial.macKey == NULL) {
+ pwSpec->client.write_mac_key =
+ PK11_SymKeyFromHandle(slot, symKey, PK11_OriginDerive,
+ CKM_SSL3_SHA1_MAC, returnedKeys.hClientMacSecret, PR_TRUE, pwArg);
+ if (pwSpec->client.write_mac_key == NULL) {
goto loser; /* loser sets err */
}
- serverSpec->keyMaterial.macKey =
- PK11_SymKeyFromHandle(slot, derivedKeyHandle, PK11_OriginDerive,
- CKM_SSL3_SHA1_MAC, returnedKeys.hServerMacSecret,
- PR_TRUE, pwArg);
- if (serverSpec->keyMaterial.macKey == NULL) {
+ pwSpec->server.write_mac_key =
+ PK11_SymKeyFromHandle(slot, symKey, PK11_OriginDerive,
+ CKM_SSL3_SHA1_MAC, returnedKeys.hServerMacSecret, PR_TRUE, pwArg);
+ if (pwSpec->server.write_mac_key == NULL) {
goto loser; /* loser sets err */
}
if (!skipKeysAndIVs) {
- clientSpec->keyMaterial.key =
- PK11_SymKeyFromHandle(slot, derivedKeyHandle, PK11_OriginDerive,
- bulk_mechanism, returnedKeys.hClientKey,
- PR_TRUE, pwArg);
- if (clientSpec->keyMaterial.key == NULL) {
+ pwSpec->client.write_key =
+ PK11_SymKeyFromHandle(slot, symKey, PK11_OriginDerive,
+ bulk_mechanism, returnedKeys.hClientKey, PR_TRUE, pwArg);
+ if (pwSpec->client.write_key == NULL) {
goto loser; /* loser sets err */
}
- serverSpec->keyMaterial.key =
- PK11_SymKeyFromHandle(slot, derivedKeyHandle, PK11_OriginDerive,
- bulk_mechanism, returnedKeys.hServerKey,
- PR_TRUE, pwArg);
- if (serverSpec->keyMaterial.key == NULL) {
+ pwSpec->server.write_key =
+ PK11_SymKeyFromHandle(slot, symKey, PK11_OriginDerive,
+ bulk_mechanism, returnedKeys.hServerKey, PR_TRUE, pwArg);
+ if (pwSpec->server.write_key == NULL) {
goto loser; /* loser sets err */
}
}
- PK11_FreeSymKey(derivedKeyHandle);
+ PK11_FreeSymKey(symKey);
return SECSuccess;
loser:
- PK11_FreeSymKey(derivedKeyHandle);
+ if (symKey)
+ PK11_FreeSymKey(symKey);
ssl_MapLowLevelError(SSL_ERROR_SESSION_KEY_GEN_FAILURE);
return SECFailure;
}
@@ -3629,11 +4022,11 @@ ssl3_InitHandshakeHashes(sslSocket *ss)
return SECFailure;
}
ss->ssl3.hs.hashType = handshake_hash_single;
+
if (PK11_DigestBegin(ss->ssl3.hs.sha) != SECSuccess) {
ssl_MapLowLevelError(SSL_ERROR_DIGEST_FAILURE);
return SECFailure;
}
-
} else {
/* Both ss->ssl3.hs.md5 and ss->ssl3.hs.sha should be NULL or
* created successfully. */
@@ -3724,7 +4117,7 @@ ssl3_UpdateHandshakeHashes(sslSocket *ss, const unsigned char *b, unsigned int l
return sslBuffer_Append(&ss->ssl3.hs.messages, b, l);
}
- PRINT_BUF(90, (ss, "handshake hash input:", b, l));
+ PRINT_BUF(90, (NULL, "handshake hash input:", b, l));
if (ss->ssl3.hs.hashType == handshake_hash_single) {
PORT_Assert(ss->version >= SSL_LIBRARY_VERSION_TLS_1_3);
@@ -3748,8 +4141,104 @@ ssl3_UpdateHandshakeHashes(sslSocket *ss, const unsigned char *b, unsigned int l
return rv;
}
+/**************************************************************************
+ * Append Handshake functions.
+ * All these functions set appropriate error codes.
+ * Most rely on ssl3_AppendHandshake to set the error code.
+ **************************************************************************/
+SECStatus
+ssl3_AppendHandshake(sslSocket *ss, const void *void_src, PRInt32 bytes)
+{
+ unsigned char *src = (unsigned char *)void_src;
+ int room = ss->sec.ci.sendBuf.space - ss->sec.ci.sendBuf.len;
+ SECStatus rv;
+
+ PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss)); /* protects sendBuf. */
+
+ if (!bytes)
+ return SECSuccess;
+ if (ss->sec.ci.sendBuf.space < MAX_SEND_BUF_LENGTH && room < bytes) {
+ rv = sslBuffer_Grow(&ss->sec.ci.sendBuf, PR_MAX(MIN_SEND_BUF_LENGTH,
+ PR_MIN(MAX_SEND_BUF_LENGTH, ss->sec.ci.sendBuf.len + bytes)));
+ if (rv != SECSuccess)
+ return rv; /* sslBuffer_Grow has set a memory error code. */
+ room = ss->sec.ci.sendBuf.space - ss->sec.ci.sendBuf.len;
+ }
+
+ PRINT_BUF(60, (ss, "Append to Handshake", (unsigned char *)void_src, bytes));
+ rv = ssl3_UpdateHandshakeHashes(ss, src, bytes);
+ if (rv != SECSuccess)
+ return rv; /* error code set by ssl3_UpdateHandshakeHashes */
+
+ while (bytes > room) {
+ if (room > 0)
+ PORT_Memcpy(ss->sec.ci.sendBuf.buf + ss->sec.ci.sendBuf.len, src,
+ room);
+ ss->sec.ci.sendBuf.len += room;
+ rv = ssl3_FlushHandshake(ss, ssl_SEND_FLAG_FORCE_INTO_BUFFER);
+ if (rv != SECSuccess) {
+ return rv; /* error code set by ssl3_FlushHandshake */
+ }
+ bytes -= room;
+ src += room;
+ room = ss->sec.ci.sendBuf.space;
+ PORT_Assert(ss->sec.ci.sendBuf.len == 0);
+ }
+ PORT_Memcpy(ss->sec.ci.sendBuf.buf + ss->sec.ci.sendBuf.len, src, bytes);
+ ss->sec.ci.sendBuf.len += bytes;
+ return SECSuccess;
+}
+
+SECStatus
+ssl3_AppendHandshakeNumber(sslSocket *ss, PRInt32 num, PRInt32 lenSize)
+{
+ SECStatus rv;
+ PRUint8 b[4];
+ PRUint8 *p = b;
+
+ PORT_Assert(lenSize <= 4 && lenSize > 0);
+ if (lenSize < 4 && num >= (1L << (lenSize * 8))) {
+ PORT_SetError(SSL_ERROR_TX_RECORD_TOO_LONG);
+ return SECFailure;
+ }
+
+ switch (lenSize) {
+ case 4:
+ *p++ = (num >> 24) & 0xff;
+ case 3:
+ *p++ = (num >> 16) & 0xff;
+ case 2:
+ *p++ = (num >> 8) & 0xff;
+ case 1:
+ *p = num & 0xff;
+ }
+ SSL_TRC(60, ("%d: number:", SSL_GETPID()));
+ rv = ssl3_AppendHandshake(ss, &b[0], lenSize);
+ return rv; /* error code set by AppendHandshake, if applicable. */
+}
+
+SECStatus
+ssl3_AppendHandshakeVariable(
+ sslSocket *ss, const PRUint8 *src, PRInt32 bytes, PRInt32 lenSize)
+{
+ SECStatus rv;
+
+ PORT_Assert((bytes < (1 << 8) && lenSize == 1) ||
+ (bytes < (1L << 16) && lenSize == 2) ||
+ (bytes < (1L << 24) && lenSize == 3));
+
+ SSL_TRC(60, ("%d: append variable:", SSL_GETPID()));
+ rv = ssl3_AppendHandshakeNumber(ss, bytes, lenSize);
+ if (rv != SECSuccess) {
+ return rv; /* error code set by AppendHandshake, if applicable. */
+ }
+ SSL_TRC(60, ("data:"));
+ rv = ssl3_AppendHandshake(ss, src, bytes);
+ return rv; /* error code set by AppendHandshake, if applicable. */
+}
+
SECStatus
-ssl3_AppendHandshakeHeader(sslSocket *ss, SSLHandshakeType t, PRUint32 length)
+ssl3_AppendHandshakeHeader(sslSocket *ss, SSL3HandshakeType t, PRUint32 length)
{
SECStatus rv;
@@ -3841,22 +4330,17 @@ ssl3_ConsumeHandshake(sslSocket *ss, void *v, PRUint32 bytes, PRUint8 **b,
* On error, an alert has been sent, and a generic error code has been set.
*/
SECStatus
-ssl3_ConsumeHandshakeNumber64(sslSocket *ss, PRUint64 *num, PRUint32 bytes,
- PRUint8 **b, PRUint32 *length)
+ssl3_ConsumeHandshakeNumber(sslSocket *ss, PRUint32 *num, PRUint32 bytes,
+ PRUint8 **b, PRUint32 *length)
{
PRUint8 *buf = *b;
- PRUint32 i;
+ int i;
PORT_Assert(ss->opt.noLocks || ssl_HaveRecvBufLock(ss));
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
*num = 0;
- if (bytes > sizeof(*num)) {
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
- }
-
- if (bytes > *length) {
+ if (bytes > *length || bytes > sizeof(*num)) {
return ssl3_DecodeError(ss);
}
PRINT_BUF(60, (ss, "consume bytes:", *b, bytes));
@@ -3869,26 +4353,6 @@ ssl3_ConsumeHandshakeNumber64(sslSocket *ss, PRUint64 *num, PRUint32 bytes,
return SECSuccess;
}
-SECStatus
-ssl3_ConsumeHandshakeNumber(sslSocket *ss, PRUint32 *num, PRUint32 bytes,
- PRUint8 **b, PRUint32 *length)
-{
- PRUint64 num64;
- SECStatus rv;
-
- PORT_Assert(bytes <= sizeof(*num));
- if (bytes > sizeof(*num)) {
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
- }
- rv = ssl3_ConsumeHandshakeNumber64(ss, &num64, bytes, b, length);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- *num = num64 & 0xffffffff;
- return SECSuccess;
-}
-
/* Read in two values from the incoming decrypted byte stream "b", which is
* *length bytes long. The first value is a number whose size is "bytes"
* bytes long. The second value is a byte-string whose size is the value
@@ -4298,8 +4762,6 @@ ssl3_ComputeHandshakeHashes(sslSocket *ss,
unsigned int md5StateLen, shaStateLen;
unsigned char md5StackBuf[256];
unsigned char shaStackBuf[512];
- const int md5Pad = ssl_GetMacDefByAlg(ssl_mac_md5)->pad_size;
- const int shaPad = ssl_GetMacDefByAlg(ssl_mac_sha)->pad_size;
md5StateBuf = PK11_SaveContextAlloc(ss->ssl3.hs.md5, md5StackBuf,
sizeof md5StackBuf, &md5StateLen);
@@ -4321,7 +4783,7 @@ ssl3_ComputeHandshakeHashes(sslSocket *ss,
/* compute hashes for SSL3. */
unsigned char s[4];
- if (!spec->masterSecret) {
+ if (!spec->master_secret) {
PORT_SetError(SSL_ERROR_RX_UNEXPECTED_HANDSHAKE);
rv = SECFailure;
goto loser;
@@ -4337,10 +4799,11 @@ ssl3_ComputeHandshakeHashes(sslSocket *ss,
PRINT_BUF(95, (NULL, "MD5 inner: sender", s, 4));
}
- PRINT_BUF(95, (NULL, "MD5 inner: MAC Pad 1", mac_pad_1, md5Pad));
+ PRINT_BUF(95, (NULL, "MD5 inner: MAC Pad 1", mac_pad_1,
+ mac_defs[mac_md5].pad_size));
- rv |= PK11_DigestKey(md5, spec->masterSecret);
- rv |= PK11_DigestOp(md5, mac_pad_1, md5Pad);
+ rv |= PK11_DigestKey(md5, spec->master_secret);
+ rv |= PK11_DigestOp(md5, mac_pad_1, mac_defs[mac_md5].pad_size);
rv |= PK11_DigestFinal(md5, md5_inner, &outLength, MD5_LENGTH);
PORT_Assert(rv != SECSuccess || outLength == MD5_LENGTH);
if (rv != SECSuccess) {
@@ -4356,10 +4819,11 @@ ssl3_ComputeHandshakeHashes(sslSocket *ss,
PRINT_BUF(95, (NULL, "SHA inner: sender", s, 4));
}
- PRINT_BUF(95, (NULL, "SHA inner: MAC Pad 1", mac_pad_1, shaPad));
+ PRINT_BUF(95, (NULL, "SHA inner: MAC Pad 1", mac_pad_1,
+ mac_defs[mac_sha].pad_size));
- rv |= PK11_DigestKey(sha, spec->masterSecret);
- rv |= PK11_DigestOp(sha, mac_pad_1, shaPad);
+ rv |= PK11_DigestKey(sha, spec->master_secret);
+ rv |= PK11_DigestOp(sha, mac_pad_1, mac_defs[mac_sha].pad_size);
rv |= PK11_DigestFinal(sha, sha_inner, &outLength, SHA1_LENGTH);
PORT_Assert(rv != SECSuccess || outLength == SHA1_LENGTH);
if (rv != SECSuccess) {
@@ -4370,12 +4834,13 @@ ssl3_ComputeHandshakeHashes(sslSocket *ss,
PRINT_BUF(95, (NULL, "SHA inner: result", sha_inner, outLength));
- PRINT_BUF(95, (NULL, "MD5 outer: MAC Pad 2", mac_pad_2, md5Pad));
+ PRINT_BUF(95, (NULL, "MD5 outer: MAC Pad 2", mac_pad_2,
+ mac_defs[mac_md5].pad_size));
PRINT_BUF(95, (NULL, "MD5 outer: MD5 inner", md5_inner, MD5_LENGTH));
rv |= PK11_DigestBegin(md5);
- rv |= PK11_DigestKey(md5, spec->masterSecret);
- rv |= PK11_DigestOp(md5, mac_pad_2, md5Pad);
+ rv |= PK11_DigestKey(md5, spec->master_secret);
+ rv |= PK11_DigestOp(md5, mac_pad_2, mac_defs[mac_md5].pad_size);
rv |= PK11_DigestOp(md5, md5_inner, MD5_LENGTH);
}
rv |= PK11_DigestFinal(md5, hashes->u.s.md5, &outLength, MD5_LENGTH);
@@ -4389,12 +4854,13 @@ ssl3_ComputeHandshakeHashes(sslSocket *ss,
PRINT_BUF(60, (NULL, "MD5 outer: result", hashes->u.s.md5, MD5_LENGTH));
if (!isTLS) {
- PRINT_BUF(95, (NULL, "SHA outer: MAC Pad 2", mac_pad_2, shaPad));
+ PRINT_BUF(95, (NULL, "SHA outer: MAC Pad 2", mac_pad_2,
+ mac_defs[mac_sha].pad_size));
PRINT_BUF(95, (NULL, "SHA outer: SHA inner", sha_inner, SHA1_LENGTH));
rv |= PK11_DigestBegin(sha);
- rv |= PK11_DigestKey(sha, spec->masterSecret);
- rv |= PK11_DigestOp(sha, mac_pad_2, shaPad);
+ rv |= PK11_DigestKey(sha, spec->master_secret);
+ rv |= PK11_DigestOp(sha, mac_pad_2, mac_defs[mac_sha].pad_size);
rv |= PK11_DigestOp(sha, sha_inner, SHA1_LENGTH);
}
rv |= PK11_DigestFinal(sha, hashes->u.s.sha, &outLength, SHA1_LENGTH);
@@ -4460,48 +4926,6 @@ ssl_ClientHelloTypeName(sslClientHelloType type)
#undef CHTYPE
#endif
-PR_STATIC_ASSERT(SSL3_SESSIONID_BYTES == SSL3_RANDOM_LENGTH);
-static void
-ssl_MakeFakeSid(sslSocket *ss, PRUint8 *buf)
-{
- PRUint8 x = 0x5a;
- int i;
- for (i = 0; i < SSL3_SESSIONID_BYTES; ++i) {
- x += ss->ssl3.hs.client_random[i];
- buf[i] = x;
- }
-}
-
-/* Set the version fields of the cipher spec for a ClientHello. */
-static void
-ssl_SetClientHelloSpecVersion(sslSocket *ss, ssl3CipherSpec *spec)
-{
- ssl_GetSpecWriteLock(ss);
- PORT_Assert(spec->cipherDef->cipher == cipher_null);
- /* This is - a best guess - but it doesn't matter here. */
- spec->version = ss->vrange.max;
- if (IS_DTLS(ss)) {
- spec->recordVersion = SSL_LIBRARY_VERSION_DTLS_1_0_WIRE;
- } else {
- /* For new connections, cap the record layer version number of TLS
- * ClientHello to { 3, 1 } (TLS 1.0). Some TLS 1.0 servers (which seem
- * to use F5 BIG-IP) ignore ClientHello.client_version and use the
- * record layer version number (TLSPlaintext.version) instead when
- * negotiating protocol versions. In addition, if the record layer
- * version number of ClientHello is { 3, 2 } (TLS 1.1) or higher, these
- * servers reset the TCP connections. Lastly, some F5 BIG-IP servers
- * hang if a record containing a ClientHello has a version greater than
- * { 3, 1 } and a length greater than 255. Set this flag to work around
- * such servers.
- *
- * The final version is set when a version is negotiated.
- */
- spec->recordVersion = PR_MIN(SSL_LIBRARY_VERSION_TLS_1_0,
- ss->vrange.max);
- }
- ssl_ReleaseSpecWriteLock(ss);
-}
-
/* Called from ssl3_HandleHelloRequest(),
* ssl3_RedoHandshake()
* ssl_BeginClientHandshake (when resuming ssl3 session)
@@ -4518,18 +4942,18 @@ SECStatus
ssl3_SendClientHello(sslSocket *ss, sslClientHelloType type)
{
sslSessionID *sid;
+ ssl3CipherSpec *cwSpec;
SECStatus rv;
- unsigned int i;
- unsigned int length;
- unsigned int num_suites;
- unsigned int actual_count = 0;
+ int i;
+ int length;
+ int num_suites;
+ int actual_count = 0;
PRBool isTLS = PR_FALSE;
PRBool requestingResume = PR_FALSE, fallbackSCSV = PR_FALSE;
- PRBool unlockNeeded = PR_FALSE;
- sslBuffer extensionBuf = SSL_BUFFER_EMPTY;
- PRUint16 version = ss->vrange.max;
+ PRInt32 total_exten_len = 0;
+ unsigned numCompressionMethods;
+ PRUint16 version;
PRInt32 flags;
- unsigned int cookieLen = ss->ssl3.hs.cookie.len;
SSL_TRC(3, ("%d: SSL3[%d]: send %s ClientHello handshake", SSL_GETPID(),
ss->fd, ssl_ClientHelloTypeName(type)));
@@ -4548,26 +4972,22 @@ ssl3_SendClientHello(sslSocket *ss, sslClientHelloType type)
* to maintain the handshake hashes. */
if (ss->ssl3.hs.helloRetry) {
PORT_Assert(type == client_hello_retry);
- /* This cookieLen applies to the cookie that appears in the DTLS
- ClientHello, which isn't used in DTLS 1.3. */
- cookieLen = 0;
} else {
+ ssl3_InitState(ss);
ssl3_RestartHandshakeHashes(ss);
}
- if (type == client_hello_initial) {
- ssl_SetClientHelloSpecVersion(ss, ss->ssl3.cwSpec);
- }
/* These must be reset every handshake. */
- ssl3_ResetExtensionData(&ss->xtnData, ss);
ss->ssl3.hs.sendingSCSV = PR_FALSE;
ss->ssl3.hs.preliminaryInfo = 0;
PORT_Assert(IS_DTLS(ss) || type != client_hello_retransmit);
SECITEM_FreeItem(&ss->ssl3.hs.newSessionTicket.ticket, PR_FALSE);
ss->ssl3.hs.receivedNewSessionTicket = PR_FALSE;
+ ssl3_ResetExtensionData(&ss->xtnData);
/* How many suites does our PKCS11 support (regardless of policy)? */
- if (ssl3_config_match_init(ss) == 0) {
+ num_suites = ssl3_config_match_init(ss);
+ if (!num_suites) {
return SECFailure; /* ssl3_config_match_init has set error code. */
}
@@ -4615,7 +5035,7 @@ ssl3_SendClientHello(sslSocket *ss, sslClientHelloType type)
}
/* Check that we can recover the master secret. */
- if (sidOK) {
+ if (sidOK && sid->u.ssl3.keys.msIsWrapped) {
PK11SlotInfo *slot = NULL;
if (sid->u.ssl3.masterValid) {
slot = SECMOD_LookupSlot(sid->u.ssl3.masterModuleID,
@@ -4680,6 +5100,8 @@ ssl3_SendClientHello(sslSocket *ss, sslClientHelloType type)
if (sid->version < ss->vrange.min ||
sid->version > ss->vrange.max) {
sidOK = PR_FALSE;
+ } else {
+ version = ss->vrange.max;
}
}
}
@@ -4713,6 +5135,8 @@ ssl3_SendClientHello(sslSocket *ss, sslClientHelloType type)
*/
if (ss->firstHsDone) {
version = ss->clientHelloVersion;
+ } else {
+ version = ss->vrange.max;
}
sid = ssl3_NewSessionID(ss, PR_FALSE);
@@ -4725,9 +5149,10 @@ ssl3_SendClientHello(sslSocket *ss, sslClientHelloType type)
isTLS = (version > SSL_LIBRARY_VERSION_3_0);
ssl_GetSpecWriteLock(ss);
- if (ss->ssl3.cwSpec->macDef->mac == ssl_mac_null) {
+ cwSpec = ss->ssl3.cwSpec;
+ if (cwSpec->mac_def->mac == mac_null) {
/* SSL records are not being MACed. */
- ss->ssl3.cwSpec->version = version;
+ cwSpec->version = version;
}
ssl_ReleaseSpecWriteLock(ss);
@@ -4751,10 +5176,9 @@ ssl3_SendClientHello(sslSocket *ss, sslClientHelloType type)
* NewSessionTicket that will cause the ticket in the sid to be replaced.
* Once we've copied the session ticket into our ClientHello message, it
* is OK for the ticket to change, so we just need to make sure we hold
- * the lock across the calls to ssl_ConstructExtensions.
+ * the lock across the calls to ssl3_CallHelloExtensionSenders.
*/
if (sid->u.ssl3.lock) {
- unlockNeeded = PR_TRUE;
PR_RWLock_Rlock(sid->u.ssl3.lock);
}
@@ -4762,14 +5186,24 @@ ssl3_SendClientHello(sslSocket *ss, sslClientHelloType type)
type == client_hello_initial) {
rv = tls13_SetupClientHello(ss);
if (rv != SECSuccess) {
- goto loser;
+ return SECFailure;
}
}
if (isTLS || (ss->firstHsDone && ss->peerRequestedProtection)) {
- rv = ssl_ConstructExtensions(ss, &extensionBuf, ssl_hs_client_hello);
- if (rv != SECSuccess) {
- goto loser;
+ PRUint32 maxBytes = 65535; /* 2^16 - 1 */
+ PRInt32 extLen;
+
+ extLen = ssl3_CallHelloExtensionSenders(ss, PR_FALSE, maxBytes, NULL);
+ if (extLen < 0) {
+ if (sid->u.ssl3.lock) {
+ PR_RWLock_Unlock(sid->u.ssl3.lock);
+ }
+ return SECFailure;
}
+ total_exten_len += extLen;
+
+ if (total_exten_len > 0)
+ total_exten_len += 2;
}
if (IS_DTLS(ss)) {
@@ -4779,7 +5213,10 @@ ssl3_SendClientHello(sslSocket *ss, sslClientHelloType type)
/* how many suites are permitted by policy and user preference? */
num_suites = count_cipher_suites(ss, ss->ssl3.policy);
if (!num_suites) {
- goto loser; /* count_cipher_suites has set error code. */
+ if (sid->u.ssl3.lock) {
+ PR_RWLock_Unlock(sid->u.ssl3.lock);
+ }
+ return SECFailure; /* count_cipher_suites has set error code. */
}
fallbackSCSV = ss->opt.enableFallbackSCSV && (!requestingResume ||
@@ -4792,30 +5229,37 @@ ssl3_SendClientHello(sslSocket *ss, sslClientHelloType type)
++num_suites;
}
+ /* count compression methods */
+ numCompressionMethods = 0;
+ for (i = 0; i < ssl_compression_method_count; i++) {
+ if (ssl_CompressionEnabled(ss, ssl_compression_methods[i]))
+ numCompressionMethods++;
+ }
+
length = sizeof(SSL3ProtocolVersion) + SSL3_RANDOM_LENGTH +
- 1 + /* session id */
+ 1 + (sid->version >= SSL_LIBRARY_VERSION_TLS_1_3
+ ? 0
+ : sid->u.ssl3.sessionIDLength) +
2 + num_suites * sizeof(ssl3CipherSuite) +
- 1 + 1 /* compression methods */;
- if (sid->version < SSL_LIBRARY_VERSION_TLS_1_3) {
- length += sid->u.ssl3.sessionIDLength;
- } else if (ss->opt.enableTls13CompatMode && !IS_DTLS(ss)) {
- length += SSL3_SESSIONID_BYTES;
- }
+ 1 + numCompressionMethods + total_exten_len;
if (IS_DTLS(ss)) {
- length += 1 + cookieLen;
+ length += 1 + ss->ssl3.hs.cookie.len;
}
- if (extensionBuf.len) {
- rv = ssl_InsertPaddingExtension(ss, length, &extensionBuf);
- if (rv != SECSuccess) {
- goto loser; /* err set by ssl_InsertPaddingExtension */
+ if (total_exten_len > 0) {
+ ssl3_CalculatePaddingExtLen(ss, length);
+ if (ss->xtnData.paddingLen) {
+ total_exten_len += 4 + ss->xtnData.paddingLen;
+ length += 4 + ss->xtnData.paddingLen;
}
- length += 2 + extensionBuf.len;
}
- rv = ssl3_AppendHandshakeHeader(ss, ssl_hs_client_hello, length);
+ rv = ssl3_AppendHandshakeHeader(ss, client_hello, length);
if (rv != SECSuccess) {
- goto loser; /* err set by ssl3_AppendHandshake* */
+ if (sid->u.ssl3.lock) {
+ PR_RWLock_Unlock(sid->u.ssl3.lock);
+ }
+ return rv; /* err set by ssl3_AppendHandshake* */
}
if (ss->firstHsDone) {
@@ -4833,49 +5277,60 @@ ssl3_SendClientHello(sslSocket *ss, sslClientHelloType type)
rv = ssl3_AppendHandshakeNumber(ss, ss->clientHelloVersion, 2);
}
if (rv != SECSuccess) {
- goto loser; /* err set by ssl3_AppendHandshake* */
+ if (sid->u.ssl3.lock) {
+ PR_RWLock_Unlock(sid->u.ssl3.lock);
+ }
+ return rv; /* err set by ssl3_AppendHandshake* */
}
/* Generate a new random if this is the first attempt. */
if (type == client_hello_initial) {
- rv = ssl3_GetNewRandom(ss->ssl3.hs.client_random);
+ rv = ssl3_GetNewRandom(&ss->ssl3.hs.client_random);
if (rv != SECSuccess) {
- goto loser; /* err set by GetNewRandom. */
+ if (sid->u.ssl3.lock) {
+ PR_RWLock_Unlock(sid->u.ssl3.lock);
+ }
+ return rv; /* err set by GetNewRandom. */
}
}
- rv = ssl3_AppendHandshake(ss, ss->ssl3.hs.client_random,
+ rv = ssl3_AppendHandshake(ss, &ss->ssl3.hs.client_random,
SSL3_RANDOM_LENGTH);
if (rv != SECSuccess) {
- goto loser; /* err set by ssl3_AppendHandshake* */
+ if (sid->u.ssl3.lock) {
+ PR_RWLock_Unlock(sid->u.ssl3.lock);
+ }
+ return rv; /* err set by ssl3_AppendHandshake* */
}
- if (sid->version < SSL_LIBRARY_VERSION_TLS_1_3) {
+ if (sid->version < SSL_LIBRARY_VERSION_TLS_1_3)
rv = ssl3_AppendHandshakeVariable(
ss, sid->u.ssl3.sessionID, sid->u.ssl3.sessionIDLength, 1);
- } else if (ss->opt.enableTls13CompatMode && !IS_DTLS(ss)) {
- /* We're faking session resumption, so rather than create new
- * randomness, just mix up the client random a little. */
- PRUint8 buf[SSL3_SESSIONID_BYTES];
- ssl_MakeFakeSid(ss, buf);
- rv = ssl3_AppendHandshakeVariable(ss, buf, SSL3_SESSIONID_BYTES, 1);
- } else {
+ else
rv = ssl3_AppendHandshakeNumber(ss, 0, 1);
- }
if (rv != SECSuccess) {
- goto loser; /* err set by ssl3_AppendHandshake* */
+ if (sid->u.ssl3.lock) {
+ PR_RWLock_Unlock(sid->u.ssl3.lock);
+ }
+ return rv; /* err set by ssl3_AppendHandshake* */
}
if (IS_DTLS(ss)) {
rv = ssl3_AppendHandshakeVariable(
- ss, ss->ssl3.hs.cookie.data, cookieLen, 1);
+ ss, ss->ssl3.hs.cookie.data, ss->ssl3.hs.cookie.len, 1);
if (rv != SECSuccess) {
- goto loser; /* err set by ssl3_AppendHandshake* */
+ if (sid->u.ssl3.lock) {
+ PR_RWLock_Unlock(sid->u.ssl3.lock);
+ }
+ return rv; /* err set by ssl3_AppendHandshake* */
}
}
rv = ssl3_AppendHandshakeNumber(ss, num_suites * sizeof(ssl3CipherSuite), 2);
if (rv != SECSuccess) {
- goto loser; /* err set by ssl3_AppendHandshake* */
+ if (sid->u.ssl3.lock) {
+ PR_RWLock_Unlock(sid->u.ssl3.lock);
+ }
+ return rv; /* err set by ssl3_AppendHandshake* */
}
if (ss->ssl3.hs.sendingSCSV) {
@@ -4883,7 +5338,10 @@ ssl3_SendClientHello(sslSocket *ss, sslClientHelloType type)
rv = ssl3_AppendHandshakeNumber(ss, TLS_EMPTY_RENEGOTIATION_INFO_SCSV,
sizeof(ssl3CipherSuite));
if (rv != SECSuccess) {
- goto loser; /* err set by ssl3_AppendHandshake* */
+ if (sid->u.ssl3.lock) {
+ PR_RWLock_Unlock(sid->u.ssl3.lock);
+ }
+ return rv; /* err set by ssl3_AppendHandshake* */
}
actual_count++;
}
@@ -4891,7 +5349,10 @@ ssl3_SendClientHello(sslSocket *ss, sslClientHelloType type)
rv = ssl3_AppendHandshakeNumber(ss, TLS_FALLBACK_SCSV,
sizeof(ssl3CipherSuite));
if (rv != SECSuccess) {
- goto loser; /* err set by ssl3_AppendHandshake* */
+ if (sid->u.ssl3.lock) {
+ PR_RWLock_Unlock(sid->u.ssl3.lock);
+ }
+ return rv; /* err set by ssl3_AppendHandshake* */
}
actual_count++;
}
@@ -4900,14 +5361,20 @@ ssl3_SendClientHello(sslSocket *ss, sslClientHelloType type)
if (config_match(suite, ss->ssl3.policy, &ss->vrange, ss)) {
actual_count++;
if (actual_count > num_suites) {
+ if (sid->u.ssl3.lock) {
+ PR_RWLock_Unlock(sid->u.ssl3.lock);
+ }
/* set error card removal/insertion error */
PORT_SetError(SSL_ERROR_TOKEN_INSERTION_REMOVAL);
- goto loser;
+ return SECFailure;
}
rv = ssl3_AppendHandshakeNumber(ss, suite->cipher_suite,
sizeof(ssl3CipherSuite));
if (rv != SECSuccess) {
- goto loser; /* err set by ssl3_AppendHandshake* */
+ if (sid->u.ssl3.lock) {
+ PR_RWLock_Unlock(sid->u.ssl3.lock);
+ }
+ return rv; /* err set by ssl3_AppendHandshake* */
}
}
}
@@ -4917,37 +5384,57 @@ ssl3_SendClientHello(sslSocket *ss, sslClientHelloType type)
* the server.. */
if (actual_count != num_suites) {
/* Card removal/insertion error */
+ if (sid->u.ssl3.lock) {
+ PR_RWLock_Unlock(sid->u.ssl3.lock);
+ }
PORT_SetError(SSL_ERROR_TOKEN_INSERTION_REMOVAL);
- goto loser;
+ return SECFailure;
}
- /* Compression methods: count is always 1, null compression. */
- rv = ssl3_AppendHandshakeNumber(ss, 1, 1);
+ rv = ssl3_AppendHandshakeNumber(ss, numCompressionMethods, 1);
if (rv != SECSuccess) {
- goto loser; /* err set by ssl3_AppendHandshake* */
+ if (sid->u.ssl3.lock) {
+ PR_RWLock_Unlock(sid->u.ssl3.lock);
+ }
+ return rv; /* err set by ssl3_AppendHandshake* */
}
- rv = ssl3_AppendHandshakeNumber(ss, ssl_compression_null, 1);
- if (rv != SECSuccess) {
- goto loser; /* err set by ssl3_AppendHandshake* */
+ for (i = 0; i < ssl_compression_method_count; i++) {
+ if (!ssl_CompressionEnabled(ss, ssl_compression_methods[i]))
+ continue;
+ rv = ssl3_AppendHandshakeNumber(ss, ssl_compression_methods[i], 1);
+ if (rv != SECSuccess) {
+ if (sid->u.ssl3.lock) {
+ PR_RWLock_Unlock(sid->u.ssl3.lock);
+ }
+ return rv; /* err set by ssl3_AppendHandshake* */
+ }
}
- if (extensionBuf.len) {
- /* If we are sending a PSK binder, replace the dummy value. Note that
- * we only set statelessResume on the client in TLS 1.3. */
- if (ss->statelessResume &&
- ss->xtnData.sentSessionTicketInClientHello) {
- rv = tls13_WriteExtensionsWithBinder(ss, &extensionBuf);
- } else {
- rv = ssl3_AppendBufferToHandshakeVariable(ss, &extensionBuf, 2);
- }
+ if (total_exten_len) {
+ PRUint32 maxBytes = total_exten_len - 2;
+ PRInt32 extLen;
+
+ rv = ssl3_AppendHandshakeNumber(ss, maxBytes, 2);
if (rv != SECSuccess) {
- goto loser; /* err set by AppendHandshake. */
+ if (sid->u.ssl3.lock) {
+ PR_RWLock_Unlock(sid->u.ssl3.lock);
+ }
+ return rv; /* err set by AppendHandshake. */
+ }
+
+ extLen = ssl3_CallHelloExtensionSenders(ss, PR_TRUE, maxBytes, NULL);
+ if (extLen < 0) {
+ if (sid->u.ssl3.lock) {
+ PR_RWLock_Unlock(sid->u.ssl3.lock);
+ }
+ return SECFailure;
}
+ maxBytes -= extLen;
+
+ PORT_Assert(!maxBytes);
}
- sslBuffer_Clear(&extensionBuf);
- if (unlockNeeded) {
- /* Note: goto loser can't be used past this point. */
+ if (sid->u.ssl3.lock) {
PR_RWLock_Unlock(sid->u.ssl3.lock);
}
@@ -4963,6 +5450,9 @@ ssl3_SendClientHello(sslSocket *ss, sslClientHelloType type)
}
flags = 0;
+ if (!ss->firstHsDone && !IS_DTLS(ss)) {
+ flags |= ssl_SEND_FLAG_CAP_RECORD_VERSION;
+ }
rv = ssl3_FlushHandshake(ss, flags);
if (rv != SECSuccess) {
return rv; /* error code set by ssl3_FlushHandshake */
@@ -4977,13 +5467,6 @@ ssl3_SendClientHello(sslSocket *ss, sslClientHelloType type)
ss->ssl3.hs.ws = wait_server_hello;
return SECSuccess;
-
-loser:
- if (unlockNeeded) {
- PR_RWLock_Unlock(sid->u.ssl3.lock);
- }
- sslBuffer_Clear(&extensionBuf);
- return SECFailure;
}
/* Called from ssl3_HandlePostHelloHandshakeMessage() when it has deciphered a
@@ -5535,7 +6018,7 @@ ssl3_SendRSAClientKeyExchange(sslSocket *ss, SECKEYPublicKey *svrPubKey)
/* Generate the pre-master secret ... */
ssl_GetSpecWriteLock(ss);
- isTLS = (PRBool)(ss->version > SSL_LIBRARY_VERSION_3_0);
+ isTLS = (PRBool)(ss->ssl3.pwSpec->version > SSL_LIBRARY_VERSION_3_0);
pms = ssl3_GenerateRSAPMS(ss, ss->ssl3.pwSpec, NULL);
ssl_ReleaseSpecWriteLock(ss);
@@ -5558,20 +6041,41 @@ ssl3_SendRSAClientKeyExchange(sslSocket *ss, SECKEYPublicKey *svrPubKey)
goto loser;
}
-#ifdef TRACE
- if (ssl_trace >= 100) {
+#ifdef NSS_ALLOW_SSLKEYLOGFILE
+ if (ssl_keylog_iob) {
SECStatus extractRV = PK11_ExtractKeyValue(pms);
if (extractRV == SECSuccess) {
SECItem *keyData = PK11_GetKeyData(pms);
if (keyData && keyData->data && keyData->len) {
- ssl_PrintBuf(ss, "Pre-Master Secret",
- keyData->data, keyData->len);
+#ifdef TRACE
+ if (ssl_trace >= 100) {
+ ssl_PrintBuf(ss, "Pre-Master Secret",
+ keyData->data, keyData->len);
+ }
+#endif
+ if (ssl_keylog_iob && enc_pms.len >= 8 && keyData->len == 48) {
+ /* https://developer.mozilla.org/en/NSS_Key_Log_Format */
+
+ /* There could be multiple, concurrent writers to the
+ * keylog, so we have to do everything in a single call to
+ * fwrite. */
+ char buf[4 + 8 * 2 + 1 + 48 * 2 + 1];
+
+ strcpy(buf, "RSA ");
+ hexEncode(buf + 4, enc_pms.data, 8);
+ buf[20] = ' ';
+ hexEncode(buf + 21, keyData->data, 48);
+ buf[sizeof(buf) - 1] = '\n';
+
+ fwrite(buf, sizeof(buf), 1, ssl_keylog_iob);
+ fflush(ssl_keylog_iob);
+ }
}
}
}
#endif
- rv = ssl3_AppendHandshakeHeader(ss, ssl_hs_client_key_exchange,
+ rv = ssl3_AppendHandshakeHeader(ss, client_key_exchange,
isTLS ? enc_pms.len + 2
: enc_pms.len);
if (rv != SECSuccess) {
@@ -5586,7 +6090,7 @@ ssl3_SendRSAClientKeyExchange(sslSocket *ss, SECKEYPublicKey *svrPubKey)
goto loser; /* err set by ssl3_AppendHandshake* */
}
- rv = ssl3_InitPendingCipherSpecs(ss, pms, PR_TRUE);
+ rv = ssl3_InitPendingCipherSpec(ss, pms);
PK11_FreeSymKey(pms);
pms = NULL;
@@ -5610,27 +6114,27 @@ loser:
/* DH shares need to be padded to the size of their prime. Some implementations
* require this. TLS 1.3 also requires this. */
SECStatus
-ssl_AppendPaddedDHKeyShare(sslBuffer *buf, const SECKEYPublicKey *pubKey,
+ssl_AppendPaddedDHKeyShare(const sslSocket *ss, const SECKEYPublicKey *pubKey,
PRBool appendLength)
{
SECStatus rv;
unsigned int pad = pubKey->u.dh.prime.len - pubKey->u.dh.publicValue.len;
if (appendLength) {
- rv = sslBuffer_AppendNumber(buf, pubKey->u.dh.prime.len, 2);
+ rv = ssl3_ExtAppendHandshakeNumber(ss, pubKey->u.dh.prime.len, 2);
if (rv != SECSuccess) {
return rv;
}
}
while (pad) {
- rv = sslBuffer_AppendNumber(buf, 0, 1);
+ rv = ssl3_ExtAppendHandshakeNumber(ss, 0, 1);
if (rv != SECSuccess) {
return rv;
}
--pad;
}
- rv = sslBuffer_Append(buf, pubKey->u.dh.publicValue.data,
- pubKey->u.dh.publicValue.len);
+ rv = ssl3_ExtAppendHandshake(ss, pubKey->u.dh.publicValue.data,
+ pubKey->u.dh.publicValue.len);
if (rv != SECSuccess) {
return rv;
}
@@ -5654,13 +6158,11 @@ ssl3_SendDHClientKeyExchange(sslSocket *ss, SECKEYPublicKey *svrPubKey)
};
sslEphemeralKeyPair *keyPair = NULL;
SECKEYPublicKey *pubKey;
- PRUint8 dhData[1026]; /* Enough for the 8192-bit group. */
- sslBuffer dhBuf = SSL_BUFFER(dhData);
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
PORT_Assert(ss->opt.noLocks || ssl_HaveXmitBufLock(ss));
- isTLS = (PRBool)(ss->version > SSL_LIBRARY_VERSION_3_0);
+ isTLS = (PRBool)(ss->ssl3.pwSpec->version > SSL_LIBRARY_VERSION_3_0);
/* Copy DH parameters from server key */
@@ -5715,27 +6217,22 @@ ssl3_SendDHClientKeyExchange(sslSocket *ss, SECKEYPublicKey *svrPubKey)
}
/* Note: send the DH share padded to avoid triggering bugs. */
- rv = ssl3_AppendHandshakeHeader(ss, ssl_hs_client_key_exchange,
+ rv = ssl3_AppendHandshakeHeader(ss, client_key_exchange,
params->prime.len + 2);
if (rv != SECSuccess) {
goto loser; /* err set by ssl3_AppendHandshake* */
}
- rv = ssl_AppendPaddedDHKeyShare(&dhBuf, pubKey, PR_TRUE);
+ rv = ssl_AppendPaddedDHKeyShare(ss, pubKey, PR_TRUE);
if (rv != SECSuccess) {
goto loser; /* err set by ssl_AppendPaddedDHKeyShare */
}
- rv = ssl3_AppendBufferToHandshake(ss, &dhBuf);
- if (rv != SECSuccess) {
- goto loser; /* err set by ssl3_AppendBufferToHandshake */
- }
- rv = ssl3_InitPendingCipherSpecs(ss, pms, PR_TRUE);
+ rv = ssl3_InitPendingCipherSpec(ss, pms);
if (rv != SECSuccess) {
ssl_MapLowLevelError(SSL_ERROR_CLIENT_KEY_EXCHANGE_FAILURE);
goto loser;
}
- sslBuffer_Clear(&dhBuf);
PK11_FreeSymKey(pms);
ssl_FreeEphemeralKeyPair(keyPair);
return SECSuccess;
@@ -5745,7 +6242,6 @@ loser:
PK11_FreeSymKey(pms);
if (keyPair)
ssl_FreeEphemeralKeyPair(keyPair);
- sslBuffer_Clear(&dhBuf);
return SECFailure;
}
@@ -5926,8 +6422,8 @@ ssl3_PickServerSignatureScheme(sslSocket *ss)
/* Sets error code, if needed. */
return ssl_PickSignatureScheme(ss, keyPair->pubKey, keyPair->privKey,
- ss->xtnData.sigSchemes,
- ss->xtnData.numSigSchemes,
+ ss->xtnData.clientSigSchemes,
+ ss->xtnData.numClientSigScheme,
PR_FALSE /* requireSha1 */);
}
@@ -6044,7 +6540,7 @@ ssl3_SendCertificateVerify(sslSocket *ss, SECKEYPrivateKey *privKey)
len = buf.len + 2 + (isTLS12 ? 2 : 0);
- rv = ssl3_AppendHandshakeHeader(ss, ssl_hs_certificate_verify, len);
+ rv = ssl3_AppendHandshakeHeader(ss, certificate_verify, len);
if (rv != SECSuccess) {
goto done; /* error code set by AppendHandshake */
}
@@ -6068,9 +6564,11 @@ done:
/* Once a cipher suite has been selected, make sure that the necessary secondary
* information is properly set. */
SECStatus
-ssl3_SetupCipherSuite(sslSocket *ss, PRBool initHashes)
+ssl3_SetCipherSuite(sslSocket *ss, ssl3CipherSuite chosenSuite,
+ PRBool initHashes)
{
- ss->ssl3.hs.suite_def = ssl_LookupCipherSuiteDef(ss->ssl3.hs.cipher_suite);
+ ss->ssl3.hs.cipher_suite = chosenSuite;
+ ss->ssl3.hs.suite_def = ssl_LookupCipherSuiteDef(chosenSuite);
if (!ss->ssl3.hs.suite_def) {
PORT_Assert(0);
PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
@@ -6083,53 +6581,10 @@ ssl3_SetupCipherSuite(sslSocket *ss, PRBool initHashes)
if (!initHashes) {
return SECSuccess;
}
- /* Now we have a cipher suite, initialize the handshake hashes. */
+ /* Now we've have a cipher suite, initialize the handshake hashes. */
return ssl3_InitHandshakeHashes(ss);
}
-SECStatus
-ssl_ClientSetCipherSuite(sslSocket *ss, SSL3ProtocolVersion version,
- ssl3CipherSuite suite, PRBool initHashes)
-{
- unsigned int i;
- if (ssl3_config_match_init(ss) == 0) {
- PORT_Assert(PR_FALSE);
- return SECFailure;
- }
- for (i = 0; i < ssl_V3_SUITES_IMPLEMENTED; i++) {
- ssl3CipherSuiteCfg *suiteCfg = &ss->cipherSuites[i];
- if (suite == suiteCfg->cipher_suite) {
- SSLVersionRange vrange = { version, version };
- if (!config_match(suiteCfg, ss->ssl3.policy, &vrange, ss)) {
- /* config_match already checks whether the cipher suite is
- * acceptable for the version, but the check is repeated here
- * in order to give a more precise error code. */
- if (!ssl3_CipherSuiteAllowedForVersionRange(suite, &vrange)) {
- PORT_SetError(SSL_ERROR_CIPHER_DISALLOWED_FOR_VERSION);
- } else {
- PORT_SetError(SSL_ERROR_NO_CYPHER_OVERLAP);
- }
- return SECFailure;
- }
- break;
- }
- }
- if (i >= ssl_V3_SUITES_IMPLEMENTED) {
- PORT_SetError(SSL_ERROR_NO_CYPHER_OVERLAP);
- return SECFailure;
- }
-
- /* Don't let the server change its mind. */
- if (ss->ssl3.hs.helloRetry && suite != ss->ssl3.hs.cipher_suite) {
- (void)SSL3_SendAlert(ss, alert_fatal, illegal_parameter);
- PORT_SetError(SSL_ERROR_RX_MALFORMED_SERVER_HELLO);
- return SECFailure;
- }
-
- ss->ssl3.hs.cipher_suite = (ssl3CipherSuite)suite;
- return ssl3_SetupCipherSuite(ss, initHashes);
-}
-
/* Called from ssl3_HandleHandshakeMessage() when it has deciphered a complete
* ssl3 ServerHello message.
* Caller must hold Handshake and RecvBuf locks.
@@ -6137,16 +6592,14 @@ ssl_ClientSetCipherSuite(sslSocket *ss, SSL3ProtocolVersion version,
static SECStatus
ssl3_HandleServerHello(sslSocket *ss, PRUint8 *b, PRUint32 length)
{
- PRUint32 cipher;
+ PRUint32 temp;
+ PRBool suite_found = PR_FALSE;
+ int i;
int errCode = SSL_ERROR_RX_MALFORMED_SERVER_HELLO;
- PRUint32 compression;
SECStatus rv;
SECItem sidBytes = { siBuffer, NULL, 0 };
- PRBool isHelloRetry;
+ PRBool isTLS = PR_FALSE;
SSL3AlertDescription desc = illegal_parameter;
- TLSExtension *versionExtension;
- const PRUint8 *savedMsg = b;
- const PRUint32 savedLength = length;
#ifndef TLS_1_3_DRAFT_VERSION
SSL3ProtocolVersion downgradeCheckVersion;
#endif
@@ -6155,6 +6608,7 @@ ssl3_HandleServerHello(sslSocket *ss, PRUint8 *b, PRUint32 length)
SSL_GETPID(), ss->fd));
PORT_Assert(ss->opt.noLocks || ssl_HaveRecvBufLock(ss));
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
+ PORT_Assert(ss->ssl3.initialized);
if (ss->ssl3.hs.ws != wait_server_hello) {
errCode = SSL_ERROR_RX_UNEXPECTED_SERVER_HELLO;
@@ -6176,95 +6630,11 @@ ssl3_HandleServerHello(sslSocket *ss, PRUint8 *b, PRUint32 length)
ss->ssl3.clientPrivateKey = NULL;
}
- /* Note that if the server selects TLS 1.3, this will set the version to TLS
- * 1.2. We will amend that once all other fields have been read. */
rv = ssl_ClientReadVersion(ss, &b, &length, &ss->version);
if (rv != SECSuccess) {
goto loser; /* alert has been sent */
}
- rv = ssl3_ConsumeHandshake(
- ss, ss->ssl3.hs.server_random, SSL3_RANDOM_LENGTH, &b, &length);
- if (rv != SECSuccess) {
- goto loser; /* alert has been sent */
- }
- isHelloRetry = !PORT_Memcmp(ss->ssl3.hs.server_random,
- ssl_hello_retry_random, SSL3_RANDOM_LENGTH);
-
- rv = ssl3_ConsumeHandshakeVariable(ss, &sidBytes, 1, &b, &length);
- if (rv != SECSuccess) {
- goto loser; /* alert has been sent */
- }
- if (sidBytes.len > SSL3_SESSIONID_BYTES) {
- if (ss->version >= SSL_LIBRARY_VERSION_TLS_1_0)
- desc = decode_error;
- goto alert_loser; /* malformed. */
- }
-
- /* Read the cipher suite. */
- rv = ssl3_ConsumeHandshakeNumber(ss, &cipher, 2, &b, &length);
- if (rv != SECSuccess) {
- goto loser; /* alert has been sent */
- }
-
- /* Compression method. */
- rv = ssl3_ConsumeHandshakeNumber(ss, &compression, 1, &b, &length);
- if (rv != SECSuccess) {
- goto loser; /* alert has been sent */
- }
- if (compression != ssl_compression_null) {
- desc = illegal_parameter;
- errCode = SSL_ERROR_RX_MALFORMED_SERVER_HELLO;
- goto alert_loser;
- }
-
- /* Parse extensions. */
- if (length != 0) {
- PRUint32 extensionLength;
- rv = ssl3_ConsumeHandshakeNumber(ss, &extensionLength, 2, &b, &length);
- if (rv != SECSuccess) {
- goto loser; /* alert already sent */
- }
- if (extensionLength != length) {
- desc = decode_error;
- goto alert_loser;
- }
- rv = ssl3_ParseExtensions(ss, &b, &length);
- if (rv != SECSuccess) {
- goto alert_loser; /* malformed */
- }
- }
-
- /* Update the version based on the extension, as necessary. */
- versionExtension = ssl3_FindExtension(ss, ssl_tls13_supported_versions_xtn);
- if (versionExtension) {
- rv = ssl_ClientReadVersion(ss, &versionExtension->data.data,
- &versionExtension->data.len,
- &ss->version);
- if (rv != SECSuccess) {
- errCode = PORT_GetError();
- goto loser; /* An alert is sent by ssl_ClientReadVersion */
- }
- }
-
- PORT_Assert(!SSL_ALL_VERSIONS_DISABLED(&ss->vrange));
- /* Check that the version is within the configured range. */
- if (ss->vrange.min > ss->version || ss->vrange.max < ss->version) {
- desc = (ss->version > SSL_LIBRARY_VERSION_3_0)
- ? protocol_version
- : handshake_failure;
- errCode = SSL_ERROR_UNSUPPORTED_VERSION;
- goto alert_loser;
- }
-
- if (isHelloRetry && ss->ssl3.hs.helloRetry) {
- SSL_TRC(3, ("%d: SSL3[%d]: received a second hello_retry_request",
- SSL_GETPID(), ss->fd));
- desc = unexpected_message;
- errCode = SSL_ERROR_RX_UNEXPECTED_HELLO_RETRY_REQUEST;
- goto alert_loser;
- }
-
/* The server didn't pick 1.3 although we either received a
* HelloRetryRequest, or we prepared to send early app data. */
if (ss->version < SSL_LIBRARY_VERSION_TLS_1_3) {
@@ -6287,10 +6657,18 @@ ssl3_HandleServerHello(sslSocket *ss, PRUint8 *b, PRUint32 length)
* us to be getting this version number, but it's what we have.
* (1294697). */
if (ss->firstHsDone && (ss->version != ss->ssl3.crSpec->version)) {
- desc = protocol_version;
+ desc = illegal_parameter;
errCode = SSL_ERROR_UNSUPPORTED_VERSION;
goto alert_loser;
}
+ ss->ssl3.hs.preliminaryInfo |= ssl_preinfo_version;
+ isTLS = (ss->version > SSL_LIBRARY_VERSION_3_0);
+
+ rv = ssl3_ConsumeHandshake(
+ ss, &ss->ssl3.hs.server_random, SSL3_RANDOM_LENGTH, &b, &length);
+ if (rv != SECSuccess) {
+ goto loser; /* alert has been sent */
+ }
#ifndef TLS_1_3_DRAFT_VERSION
/* Check the ServerHello.random per
@@ -6310,8 +6688,8 @@ ssl3_HandleServerHello(sslSocket *ss, PRUint8 *b, PRUint32 length)
if (downgradeCheckVersion >= SSL_LIBRARY_VERSION_TLS_1_2 &&
downgradeCheckVersion > ss->version) {
/* Both sections use the same sentinel region. */
- PRUint8 *downgrade_sentinel =
- ss->ssl3.hs.server_random +
+ unsigned char *downgrade_sentinel =
+ ss->ssl3.hs.server_random.rand +
SSL3_RANDOM_LENGTH - sizeof(tls13_downgrade_random);
if (!PORT_Memcmp(downgrade_sentinel,
tls13_downgrade_random,
@@ -6326,64 +6704,110 @@ ssl3_HandleServerHello(sslSocket *ss, PRUint8 *b, PRUint32 length)
}
#endif
- /* Finally, now all the version-related checks have passed. */
- ss->ssl3.hs.preliminaryInfo |= ssl_preinfo_version;
- /* Update the write cipher spec to match the version. But not after
- * HelloRetryRequest, because cwSpec might be a 0-RTT cipher spec. */
- if (!ss->firstHsDone && !ss->ssl3.hs.helloRetry) {
- ssl_GetSpecWriteLock(ss);
- ssl_SetSpecVersions(ss, ss->ssl3.cwSpec);
- ssl_ReleaseSpecWriteLock(ss);
- }
-
- /* Check that the session ID is as expected. */
- if (ss->version >= SSL_LIBRARY_VERSION_TLS_1_3) {
- PRUint8 buf[SSL3_SESSIONID_BYTES];
- unsigned int expectedSidLen;
- if (ss->opt.enableTls13CompatMode && !IS_DTLS(ss)) {
- expectedSidLen = SSL3_SESSIONID_BYTES;
- ssl_MakeFakeSid(ss, buf);
- } else {
- expectedSidLen = 0;
+ if (ss->version < SSL_LIBRARY_VERSION_TLS_1_3) {
+ rv = ssl3_ConsumeHandshakeVariable(ss, &sidBytes, 1, &b, &length);
+ if (rv != SECSuccess) {
+ goto loser; /* alert has been sent */
}
- if (sidBytes.len != expectedSidLen ||
- (expectedSidLen > 0 &&
- PORT_Memcmp(buf, sidBytes.data, expectedSidLen) != 0)) {
- desc = illegal_parameter;
- errCode = SSL_ERROR_RX_MALFORMED_SERVER_HELLO;
- goto alert_loser;
+ if (sidBytes.len > SSL3_SESSIONID_BYTES) {
+ if (isTLS)
+ desc = decode_error;
+ goto alert_loser; /* malformed. */
}
}
- /* Only initialize hashes if this isn't a Hello Retry. */
- rv = ssl_ClientSetCipherSuite(ss, ss->version, cipher,
- !isHelloRetry);
+ /* find selected cipher suite in our list. */
+ rv = ssl3_ConsumeHandshakeNumber(ss, &temp, 2, &b, &length);
if (rv != SECSuccess) {
- desc = illegal_parameter;
+ goto loser; /* alert has been sent */
+ }
+ i = ssl3_config_match_init(ss);
+ PORT_Assert(i > 0);
+ if (i <= 0) {
errCode = PORT_GetError();
- goto alert_loser;
+ goto loser;
}
+ for (i = 0; i < ssl_V3_SUITES_IMPLEMENTED; i++) {
+ ssl3CipherSuiteCfg *suite = &ss->cipherSuites[i];
+ if (temp == suite->cipher_suite) {
+ SSLVersionRange vrange = { ss->version, ss->version };
+ if (!config_match(suite, ss->ssl3.policy, &vrange, ss)) {
+ /* config_match already checks whether the cipher suite is
+ * acceptable for the version, but the check is repeated here
+ * in order to give a more precise error code. */
+ if (!ssl3_CipherSuiteAllowedForVersionRange(temp, &vrange)) {
+ desc = handshake_failure;
+ errCode = SSL_ERROR_CIPHER_DISALLOWED_FOR_VERSION;
+ goto alert_loser;
+ }
- dtls_ReceivedFirstMessageInFlight(ss);
+ break; /* failure */
+ }
- if (isHelloRetry) {
- rv = tls13_HandleHelloRetryRequest(ss, savedMsg, savedLength);
- if (rv != SECSuccess) {
- goto loser;
+ suite_found = PR_TRUE;
+ break; /* success */
}
- return SECSuccess;
+ }
+ if (!suite_found) {
+ desc = handshake_failure;
+ errCode = SSL_ERROR_NO_CYPHER_OVERLAP;
+ goto alert_loser;
}
- rv = ssl3_HandleParsedExtensions(ss, ssl_hs_server_hello);
- ssl3_DestroyRemoteExtensions(&ss->ssl3.hs.remoteExtensions);
+ rv = ssl3_SetCipherSuite(ss, (ssl3CipherSuite)temp, PR_TRUE);
if (rv != SECSuccess) {
+ desc = internal_error;
+ errCode = PORT_GetError();
goto alert_loser;
}
- rv = ssl_HashHandshakeMessage(ss, ssl_hs_server_hello,
- savedMsg, savedLength);
- if (rv != SECSuccess) {
- goto loser;
+ if (ss->version < SSL_LIBRARY_VERSION_TLS_1_3) {
+ /* find selected compression method in our list. */
+ rv = ssl3_ConsumeHandshakeNumber(ss, &temp, 1, &b, &length);
+ if (rv != SECSuccess) {
+ goto loser; /* alert has been sent */
+ }
+ suite_found = PR_FALSE;
+ for (i = 0; i < ssl_compression_method_count; i++) {
+ if (temp == ssl_compression_methods[i]) {
+ if (!ssl_CompressionEnabled(ss, ssl_compression_methods[i])) {
+ break; /* failure */
+ }
+ suite_found = PR_TRUE;
+ break; /* success */
+ }
+ }
+ if (!suite_found) {
+ desc = handshake_failure;
+ errCode = SSL_ERROR_NO_COMPRESSION_OVERLAP;
+ goto alert_loser;
+ }
+ ss->ssl3.hs.compression = (SSLCompressionMethod)temp;
+ } else {
+ ss->ssl3.hs.compression = ssl_compression_null;
+ }
+
+ /* Note that if !isTLS and the extra stuff is not extensions, we
+ * do NOT goto alert_loser.
+ * There are some old SSL 3.0 implementations that do send stuff
+ * after the end of the server hello, and we deliberately ignore
+ * such stuff in the interest of maximal interoperability (being
+ * "generous in what you accept").
+ * Update: Starting in NSS 3.12.6, we handle the renegotiation_info
+ * extension in SSL 3.0.
+ */
+ if (length != 0) {
+ SECItem extensions;
+ rv = ssl3_ConsumeHandshakeVariable(ss, &extensions, 2, &b, &length);
+ if (rv != SECSuccess || length != 0) {
+ if (isTLS)
+ goto alert_loser;
+ } else {
+ rv = ssl3_HandleExtensions(ss, &extensions.data,
+ &extensions.len, server_hello);
+ if (rv != SECSuccess)
+ goto alert_loser;
+ }
}
if (ss->version >= SSL_LIBRARY_VERSION_TLS_1_3) {
@@ -6411,51 +6835,6 @@ loser:
}
static SECStatus
-ssl3_UnwrapMasterSecretClient(sslSocket *ss, sslSessionID *sid, PK11SymKey **ms)
-{
- PK11SlotInfo *slot;
- PK11SymKey *wrapKey;
- CK_FLAGS keyFlags = 0;
- SECItem wrappedMS = {
- siBuffer,
- sid->u.ssl3.keys.wrapped_master_secret,
- sid->u.ssl3.keys.wrapped_master_secret_len
- };
-
- /* unwrap master secret */
- slot = SECMOD_LookupSlot(sid->u.ssl3.masterModuleID,
- sid->u.ssl3.masterSlotID);
- if (slot == NULL) {
- return SECFailure;
- }
- if (!PK11_IsPresent(slot)) {
- PK11_FreeSlot(slot);
- return SECFailure;
- }
- wrapKey = PK11_GetWrapKey(slot, sid->u.ssl3.masterWrapIndex,
- sid->u.ssl3.masterWrapMech,
- sid->u.ssl3.masterWrapSeries,
- ss->pkcs11PinArg);
- PK11_FreeSlot(slot);
- if (wrapKey == NULL) {
- return SECFailure;
- }
-
- if (ss->version > SSL_LIBRARY_VERSION_3_0) { /* isTLS */
- keyFlags = CKF_SIGN | CKF_VERIFY;
- }
-
- *ms = PK11_UnwrapSymKeyWithFlags(wrapKey, sid->u.ssl3.masterWrapMech,
- NULL, &wrappedMS, CKM_SSL3_MASTER_KEY_DERIVE,
- CKA_DERIVE, SSL3_MASTER_SECRET_LENGTH, keyFlags);
- PK11_FreeSymKey(wrapKey);
- if (!*ms) {
- return SECFailure;
- }
- return SECSuccess;
-}
-
-static SECStatus
ssl3_HandleServerHelloPart2(sslSocket *ss, const SECItem *sidBytes,
int *retErrCode)
{
@@ -6481,7 +6860,7 @@ ssl3_HandleServerHelloPart2(sslSocket *ss, const SECItem *sidBytes,
/* we need to call ssl3_SetupPendingCipherSpec here so we can check the
* key exchange algorithm. */
- rv = ssl3_SetupBothPendingCipherSpecs(ss);
+ rv = ssl3_SetupPendingCipherSpec(ss);
if (rv != SECSuccess) {
goto alert_loser; /* error code is set. */
}
@@ -6504,7 +6883,9 @@ ssl3_HandleServerHelloPart2(sslSocket *ss, const SECItem *sidBytes,
goto alert_loser;
}
do {
- PK11SymKey *masterSecret;
+ ssl3CipherSpec *pwSpec = ss->ssl3.pwSpec;
+
+ SECItem wrappedMS; /* wrapped master secret. */
/* [draft-ietf-tls-session-hash-06; Section 5.3]
*
@@ -6536,12 +6917,60 @@ ssl3_HandleServerHelloPart2(sslSocket *ss, const SECItem *sidBytes,
ss->sec.authKeyBits = sid->authKeyBits;
ss->sec.keaType = sid->keaType;
ss->sec.keaKeyBits = sid->keaKeyBits;
- ss->sec.originalKeaGroup = ssl_LookupNamedGroup(sid->keaGroup);
- ss->sec.signatureScheme = sid->sigScheme;
- rv = ssl3_UnwrapMasterSecretClient(ss, sid, &masterSecret);
- if (rv != SECSuccess) {
- break; /* not considered an error */
+ if (sid->u.ssl3.keys.msIsWrapped) {
+ PK11SlotInfo *slot;
+ PK11SymKey *wrapKey; /* wrapping key */
+ CK_FLAGS keyFlags = 0;
+
+ /* unwrap master secret */
+ slot = SECMOD_LookupSlot(sid->u.ssl3.masterModuleID,
+ sid->u.ssl3.masterSlotID);
+ if (slot == NULL) {
+ break; /* not considered an error. */
+ }
+ if (!PK11_IsPresent(slot)) {
+ PK11_FreeSlot(slot);
+ break; /* not considered an error. */
+ }
+ wrapKey = PK11_GetWrapKey(slot, sid->u.ssl3.masterWrapIndex,
+ sid->u.ssl3.masterWrapMech,
+ sid->u.ssl3.masterWrapSeries,
+ ss->pkcs11PinArg);
+ PK11_FreeSlot(slot);
+ if (wrapKey == NULL) {
+ break; /* not considered an error. */
+ }
+
+ if (ss->version > SSL_LIBRARY_VERSION_3_0) { /* isTLS */
+ keyFlags =
+ CKF_SIGN | CKF_VERIFY;
+ }
+
+ wrappedMS.data = sid->u.ssl3.keys.wrapped_master_secret;
+ wrappedMS.len = sid->u.ssl3.keys.wrapped_master_secret_len;
+ pwSpec->master_secret =
+ PK11_UnwrapSymKeyWithFlags(wrapKey, sid->u.ssl3.masterWrapMech,
+ NULL, &wrappedMS, CKM_SSL3_MASTER_KEY_DERIVE,
+ CKA_DERIVE, sizeof(SSL3MasterSecret), keyFlags);
+ errCode = PORT_GetError();
+ PK11_FreeSymKey(wrapKey);
+ if (pwSpec->master_secret == NULL) {
+ break; /* errorCode set just after call to UnwrapSymKey. */
+ }
+ } else {
+ /* need to import the raw master secret to session object */
+ PK11SlotInfo *slot = PK11_GetInternalSlot();
+ wrappedMS.data = sid->u.ssl3.keys.wrapped_master_secret;
+ wrappedMS.len = sid->u.ssl3.keys.wrapped_master_secret_len;
+ pwSpec->master_secret =
+ PK11_ImportSymKey(slot, CKM_SSL3_MASTER_KEY_DERIVE,
+ PK11_OriginUnwrap, CKA_ENCRYPT,
+ &wrappedMS, NULL);
+ PK11_FreeSlot(slot);
+ if (pwSpec->master_secret == NULL) {
+ break;
+ }
}
/* Got a Match */
@@ -6563,8 +6992,8 @@ ssl3_HandleServerHelloPart2(sslSocket *ss, const SECItem *sidBytes,
ss->sec.peerCert = CERT_DupCertificate(sid->peerCert);
}
- /* We are re-using the old MS, so no need to derive again. */
- rv = ssl3_InitPendingCipherSpecs(ss, masterSecret, PR_FALSE);
+ /* NULL value for PMS because we are reusing the old MS */
+ rv = ssl3_InitPendingCipherSpec(ss, NULL);
if (rv != SECSuccess) {
goto alert_loser; /* err code was set */
}
@@ -6669,11 +7098,11 @@ ssl_HandleDHServerKeyExchange(sslSocket *ss, PRUint8 *b, PRUint32 length)
}
rv = NSS_OptionGet(NSS_DH_MIN_KEY_SIZE, &minDH);
- if (rv != SECSuccess || minDH <= 0) {
+ if (rv != SECSuccess) {
minDH = SSL_DH_MIN_P_BITS;
}
dh_p_bits = SECKEY_BigIntegerBitLength(&dh_p);
- if (dh_p_bits < (unsigned)minDH) {
+ if (dh_p_bits < minDH) {
errCode = SSL_ERROR_WEAK_SERVER_EPHEMERAL_DH_KEY;
goto alert_loser;
}
@@ -6854,7 +7283,7 @@ typedef struct dnameNode {
*/
SECStatus
ssl3_ParseCertificateRequestCAs(sslSocket *ss, PRUint8 **b, PRUint32 *length,
- CERTDistNames *ca_list)
+ PLArenaPool *arena, CERTDistNames *ca_list)
{
PRUint32 remaining;
int nnames = 0;
@@ -6869,7 +7298,7 @@ ssl3_ParseCertificateRequestCAs(sslSocket *ss, PRUint8 **b, PRUint32 *length,
if (remaining > *length)
goto alert_loser;
- ca_list->head = node = PORT_ArenaZNew(ca_list->arena, dnameNode);
+ ca_list->head = node = PORT_ArenaZNew(arena, dnameNode);
if (node == NULL)
goto no_mem;
@@ -6895,14 +7324,14 @@ ssl3_ParseCertificateRequestCAs(sslSocket *ss, PRUint8 **b, PRUint32 *length,
if (remaining <= 0)
break; /* success */
- node->next = PORT_ArenaZNew(ca_list->arena, dnameNode);
+ node->next = PORT_ArenaZNew(arena, dnameNode);
node = node->next;
if (node == NULL)
goto no_mem;
}
ca_list->nnames = nnames;
- ca_list->names = PORT_ArenaNewArray(ca_list->arena, SECItem, nnames);
+ ca_list->names = PORT_ArenaNewArray(arena, SECItem, nnames);
if (nnames > 0 && ca_list->names == NULL)
goto no_mem;
@@ -7046,7 +7475,7 @@ ssl3_HandleCertificateRequest(sslSocket *ss, PRUint8 *b, PRUint32 length)
}
}
- rv = ssl3_ParseCertificateRequestCAs(ss, &b, &length, &ca_list);
+ rv = ssl3_ParseCertificateRequestCAs(ss, &b, &length, arena, &ca_list);
if (rv != SECSuccess)
goto done; /* alert sent in ssl3_ParseCertificateRequestCAs */
@@ -7146,7 +7575,7 @@ ssl3_CompleteHandleCertificateRequest(sslSocket *ss,
case SECFailure:
default:
send_no_certificate:
- if (ss->version > SSL_LIBRARY_VERSION_3_0) {
+ if (ss->ssl3.prSpec->version > SSL_LIBRARY_VERSION_3_0) {
ss->ssl3.sendEmptyCert = PR_TRUE;
} else {
(void)SSL3_SendAlert(ss, alert_warning, no_certificate);
@@ -7177,7 +7606,7 @@ ssl3_CheckFalseStart(sslSocket *ss)
* sufficiently strong that the attack can gain no advantage.
* Therefore we always require an 80-bit cipher. */
ssl_GetSpecReadLock(ss);
- maybeFalseStart = ss->ssl3.cwSpec->cipherDef->secret_key_size >= 10;
+ maybeFalseStart = ss->ssl3.cwSpec->cipher_def->secret_key_size >= 10;
ssl_ReleaseSpecReadLock(ss);
if (!maybeFalseStart) {
@@ -7429,7 +7858,7 @@ ssl3_SendHelloRequest(sslSocket *ss)
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
PORT_Assert(ss->opt.noLocks || ssl_HaveXmitBufLock(ss));
- rv = ssl3_AppendHandshakeHeader(ss, ssl_hs_hello_request, 0);
+ rv = ssl3_AppendHandshakeHeader(ss, hello_request, 0);
if (rv != SECSuccess) {
return rv; /* err set by AppendHandshake */
}
@@ -7498,7 +7927,6 @@ ssl3_NewSessionID(sslSocket *ss, PRBool is_server)
sid->references = 1;
sid->cached = never_cached;
sid->version = ss->version;
- sid->sigScheme = ssl_sig_none;
sid->u.ssl3.keys.resumable = PR_TRUE;
sid->u.ssl3.policy = SSL_ALLOWED;
@@ -7609,8 +8037,8 @@ SECStatus
ssl3_NegotiateCipherSuite(sslSocket *ss, const SECItem *suites,
PRBool initHashes)
{
- unsigned int j;
- unsigned int i;
+ int j;
+ int i;
for (j = 0; j < ssl_V3_SUITES_IMPLEMENTED; j++) {
ssl3CipherSuiteCfg *suite = &ss->cipherSuites[j];
@@ -7621,8 +8049,7 @@ ssl3_NegotiateCipherSuite(sslSocket *ss, const SECItem *suites,
for (i = 0; i + 1 < suites->len; i += 2) {
PRUint16 suite_i = (suites->data[i] << 8) | suites->data[i + 1];
if (suite_i == suite->cipher_suite) {
- ss->ssl3.hs.cipher_suite = suite_i;
- return ssl3_SetupCipherSuite(ss, initHashes);
+ return ssl3_SetCipherSuite(ss, suite_i, initHashes);
}
}
}
@@ -7721,6 +8148,7 @@ ssl3_ServerCallSNICallback(sslSocket *ss)
* and save the name. */
SECStatus rv;
SECItem *name = &ss->xtnData.sniNameArr[ret];
+ int configedCiphers;
SECItem *pwsName;
/* get rid of the old name and save the newly picked. */
@@ -7749,7 +8177,8 @@ ssl3_ServerCallSNICallback(sslSocket *ss)
ret = SSL_SNI_SEND_ALERT;
break;
}
- if (ssl3_config_match_init(ss) == 0) {
+ configedCiphers = ssl3_config_match_init(ss);
+ if (configedCiphers <= 0) {
/* no ciphers are working/supported */
errCode = PORT_GetError();
desc = handshake_failure;
@@ -7760,7 +8189,7 @@ ssl3_ServerCallSNICallback(sslSocket *ss)
* the name from the offered list and reconfigured the socket.
*/
ssl3_RegisterExtensionSender(ss, &ss->xtnData, ssl_server_name_xtn,
- ssl_SendEmptyExtension);
+ ssl3_SendServerNameXtn);
} else {
/* Callback returned index outside of the boundary. */
PORT_Assert((unsigned int)ret < ss->xtnData.sniNameArrSize);
@@ -7859,14 +8288,13 @@ ssl3_HandleClientHello(sslSocket *ss, PRUint8 *b, PRUint32 length)
SECItem suites = { siBuffer, NULL, 0 };
SECItem comps = { siBuffer, NULL, 0 };
PRBool isTLS13;
- const PRUint8 *savedMsg = b;
- const PRUint32 savedLen = length;
SSL_TRC(3, ("%d: SSL3[%d]: handle client_hello handshake",
SSL_GETPID(), ss->fd));
PORT_Assert(ss->opt.noLocks || ssl_HaveRecvBufLock(ss));
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
+ PORT_Assert(ss->ssl3.initialized);
ss->ssl3.hs.preliminaryInfo = 0;
if (!ss->sec.isServer ||
@@ -7891,9 +8319,6 @@ ssl3_HandleClientHello(sslSocket *ss, PRUint8 *b, PRUint32 length)
}
}
- /* We should always be in a fresh state. */
- SSL_ASSERT_HASHES_EMPTY(ss);
-
/* Get peer name of client */
rv = ssl_GetPeerInfo(ss);
if (rv != SECSuccess) {
@@ -7903,7 +8328,7 @@ ssl3_HandleClientHello(sslSocket *ss, PRUint8 *b, PRUint32 length)
/* We might be starting session renegotiation in which case we should
* clear previous state.
*/
- ssl3_ResetExtensionData(&ss->xtnData, ss);
+ ssl3_ResetExtensionData(&ss->xtnData);
ss->statelessResume = PR_FALSE;
if (IS_DTLS(ss)) {
@@ -7924,7 +8349,7 @@ ssl3_HandleClientHello(sslSocket *ss, PRUint8 *b, PRUint32 length)
/* Grab the client random data. */
rv = ssl3_ConsumeHandshake(
- ss, ss->ssl3.hs.client_random, SSL3_RANDOM_LENGTH, &b, &length);
+ ss, &ss->ssl3.hs.client_random, SSL3_RANDOM_LENGTH, &b, &length);
if (rv != SECSuccess) {
goto loser; /* malformed */
}
@@ -7941,9 +8366,6 @@ ssl3_HandleClientHello(sslSocket *ss, PRUint8 *b, PRUint32 length)
if (rv != SECSuccess) {
goto loser; /* malformed */
}
- if (cookieBytes.len != 0) {
- goto loser; /* We never send cookies in DTLS 1.2. */
- }
}
/* Grab the list of cipher suites. */
@@ -7967,15 +8389,14 @@ ssl3_HandleClientHello(sslSocket *ss, PRUint8 *b, PRUint32 length)
if (length) {
/* Get length of hello extensions */
- PRUint32 extensionLength;
- rv = ssl3_ConsumeHandshakeNumber(ss, &extensionLength, 2, &b, &length);
+ PRUint32 extension_length;
+ rv = ssl3_ConsumeHandshakeNumber(ss, &extension_length, 2, &b, &length);
if (rv != SECSuccess) {
goto loser; /* alert already sent */
}
- if (extensionLength != length) {
- errCode = SSL_ERROR_RX_MALFORMED_CLIENT_HELLO;
- desc = decode_error;
- goto alert_loser;
+ if (extension_length != length) {
+ ssl3_DecodeError(ss); /* send alert */
+ goto loser;
}
rv = ssl3_ParseExtensions(ss, &b, &length);
@@ -8006,35 +8427,17 @@ ssl3_HandleClientHello(sslSocket *ss, PRUint8 *b, PRUint32 length)
goto alert_loser;
}
}
-
- if (ss->firstHsDone && ss->version >= SSL_LIBRARY_VERSION_TLS_1_3) {
- desc = unexpected_message;
- errCode = SSL_ERROR_RENEGOTIATION_NOT_ALLOWED;
- goto alert_loser;
- }
-
isTLS13 = ss->version >= SSL_LIBRARY_VERSION_TLS_1_3;
ss->ssl3.hs.preliminaryInfo |= ssl_preinfo_version;
- /* Update the write spec to match the selected version. */
- if (!ss->firstHsDone) {
- ssl_GetSpecWriteLock(ss);
- ssl_SetSpecVersions(ss, ss->ssl3.cwSpec);
- ssl_ReleaseSpecWriteLock(ss);
- }
- if (isTLS13 && sidBytes.len > 0 && !IS_DTLS(ss)) {
- SECITEM_FreeItem(&ss->ssl3.hs.fakeSid, PR_FALSE);
- rv = SECITEM_CopyItem(NULL, &ss->ssl3.hs.fakeSid, &sidBytes);
- if (rv != SECSuccess) {
- desc = internal_error;
- errCode = PORT_GetError();
- goto alert_loser;
- }
+ /* You can't resume TLS 1.3 like this. */
+ if (isTLS13 && sidBytes.len) {
+ goto alert_loser;
}
/* Generate the Server Random now so it is available
* when we process the ClientKeyShare in TLS 1.3 */
- rv = ssl3_GetNewRandom(ss->ssl3.hs.server_random);
+ rv = ssl3_GetNewRandom(&ss->ssl3.hs.server_random);
if (rv != SECSuccess) {
errCode = SSL_ERROR_GENERATE_RANDOM_FAILURE;
goto loser;
@@ -8060,8 +8463,8 @@ ssl3_HandleClientHello(sslSocket *ss, PRUint8 *b, PRUint32 length)
* we ship the final version of TLS 1.3. Bug 1306672.
*/
if (ss->vrange.max > ss->version) {
- PRUint8 *downgrade_sentinel =
- ss->ssl3.hs.server_random +
+ unsigned char *downgrade_sentinel =
+ ss->ssl3.hs.server_random.rand +
SSL3_RANDOM_LENGTH - sizeof(tls13_downgrade_random);
switch (ss->vrange.max) {
@@ -8082,25 +8485,8 @@ ssl3_HandleClientHello(sslSocket *ss, PRUint8 *b, PRUint32 length)
}
#endif
- /* If there is a cookie, then this is a second ClientHello (TLS 1.3). */
- if (ssl3_FindExtension(ss, ssl_tls13_cookie_xtn)) {
- ss->ssl3.hs.helloRetry = PR_TRUE;
- }
-
- if (ss->ssl3.hs.receivedCcs) {
- /* This is only valid if we sent HelloRetryRequest, so we should have
- * negotiated TLS 1.3 and there should be a cookie extension. */
- if (ss->version < SSL_LIBRARY_VERSION_TLS_1_3 ||
- !ss->ssl3.hs.helloRetry) {
- desc = unexpected_message;
- errCode = SSL_ERROR_RX_UNEXPECTED_CHANGE_CIPHER;
- goto alert_loser;
- }
- }
-
/* Now parse the rest of the extensions. */
- rv = ssl3_HandleParsedExtensions(ss, ssl_hs_client_hello);
- ssl3_DestroyRemoteExtensions(&ss->ssl3.hs.remoteExtensions);
+ rv = ssl3_HandleParsedExtensions(ss, client_hello);
if (rv != SECSuccess) {
goto loser; /* malformed */
}
@@ -8123,12 +8509,6 @@ ssl3_HandleClientHello(sslSocket *ss, PRUint8 *b, PRUint32 length)
if (comps.len != 1 || comps.data[0] != ssl_compression_null) {
goto alert_loser;
}
- } else {
- /* Other versions need to include null somewhere. */
- if (comps.len < 1 ||
- !memchr(comps.data, ssl_compression_null, comps.len)) {
- goto alert_loser;
- }
}
if (!ssl3_ExtensionNegotiated(ss, ssl_renegotiation_info_xtn)) {
@@ -8141,30 +8521,34 @@ ssl3_HandleClientHello(sslSocket *ss, PRUint8 *b, PRUint32 length)
if (suite_i == TLS_EMPTY_RENEGOTIATION_INFO_SCSV) {
PRUint8 *b2 = (PRUint8 *)emptyRIext;
PRUint32 L2 = sizeof emptyRIext;
- (void)ssl3_HandleExtensions(ss, &b2, &L2, ssl_hs_client_hello);
+ (void)ssl3_HandleExtensions(ss, &b2, &L2, client_hello);
break;
}
}
}
-
- /* The check for renegotiation in TLS 1.3 is earlier. */
- if (ss->version < SSL_LIBRARY_VERSION_TLS_1_3) {
- if (ss->firstHsDone &&
- (ss->opt.enableRenegotiation == SSL_RENEGOTIATE_REQUIRES_XTN ||
- ss->opt.enableRenegotiation == SSL_RENEGOTIATE_TRANSITIONAL) &&
- !ssl3_ExtensionNegotiated(ss, ssl_renegotiation_info_xtn)) {
- desc = no_renegotiation;
- level = alert_warning;
- errCode = SSL_ERROR_RENEGOTIATION_NOT_ALLOWED;
- goto alert_loser;
- }
- if ((ss->opt.requireSafeNegotiation ||
- (ss->firstHsDone && ss->peerRequestedProtection)) &&
- !ssl3_ExtensionNegotiated(ss, ssl_renegotiation_info_xtn)) {
- desc = handshake_failure;
- errCode = SSL_ERROR_UNSAFE_NEGOTIATION;
- goto alert_loser;
- }
+ /* This is a second check for TLS 1.3 and re-handshake to stop us
+ * from re-handshake up to TLS 1.3, so it happens after version
+ * negotiation. */
+ if (ss->firstHsDone && ss->version >= SSL_LIBRARY_VERSION_TLS_1_3) {
+ desc = unexpected_message;
+ errCode = SSL_ERROR_RENEGOTIATION_NOT_ALLOWED;
+ goto alert_loser;
+ }
+ if (ss->firstHsDone &&
+ (ss->opt.enableRenegotiation == SSL_RENEGOTIATE_REQUIRES_XTN ||
+ ss->opt.enableRenegotiation == SSL_RENEGOTIATE_TRANSITIONAL) &&
+ !ssl3_ExtensionNegotiated(ss, ssl_renegotiation_info_xtn)) {
+ desc = no_renegotiation;
+ level = alert_warning;
+ errCode = SSL_ERROR_RENEGOTIATION_NOT_ALLOWED;
+ goto alert_loser;
+ }
+ if ((ss->opt.requireSafeNegotiation ||
+ (ss->firstHsDone && ss->peerRequestedProtection)) &&
+ !ssl3_ExtensionNegotiated(ss, ssl_renegotiation_info_xtn)) {
+ desc = handshake_failure;
+ errCode = SSL_ERROR_UNSAFE_NEGOTIATION;
+ goto alert_loser;
}
/* We do stateful resumes only if we are in TLS < 1.3 and
@@ -8237,14 +8621,21 @@ ssl3_HandleClientHello(sslSocket *ss, PRUint8 *b, PRUint32 length)
if (IS_DTLS(ss)) {
ssl3_DisableNonDTLSSuites(ss);
- dtls_ReceivedFirstMessageInFlight(ss);
}
+#ifdef PARANOID
+ /* Look for a matching cipher suite. */
+ j = ssl3_config_match_init(ss);
+ if (j <= 0) { /* no ciphers are working/supported by PK11 */
+ errCode = PORT_GetError(); /* error code is already set. */
+ goto alert_loser;
+ }
+#endif
+
if (ss->version >= SSL_LIBRARY_VERSION_TLS_1_3) {
- rv = tls13_HandleClientHelloPart2(ss, &suites, sid, savedMsg, savedLen);
+ rv = tls13_HandleClientHelloPart2(ss, &suites, sid);
} else {
- rv = ssl3_HandleClientHelloPart2(ss, &suites, sid,
- savedMsg, savedLen);
+ rv = ssl3_HandleClientHelloPart2(ss, &suites, &comps, sid);
}
if (rv != SECSuccess) {
errCode = PORT_GetError();
@@ -8261,60 +8652,22 @@ loser:
}
static SECStatus
-ssl3_UnwrapMasterSecretServer(sslSocket *ss, sslSessionID *sid, PK11SymKey **ms)
-{
- PK11SymKey *wrapKey;
- CK_FLAGS keyFlags = 0;
- SECItem wrappedMS = {
- siBuffer,
- sid->u.ssl3.keys.wrapped_master_secret,
- sid->u.ssl3.keys.wrapped_master_secret_len
- };
-
- wrapKey = ssl3_GetWrappingKey(ss, NULL, sid->u.ssl3.masterWrapMech,
- ss->pkcs11PinArg);
- if (!wrapKey) {
- return SECFailure;
- }
-
- if (ss->version > SSL_LIBRARY_VERSION_3_0) { /* isTLS */
- keyFlags = CKF_SIGN | CKF_VERIFY;
- }
-
- /* unwrap the master secret. */
- *ms = PK11_UnwrapSymKeyWithFlags(wrapKey, sid->u.ssl3.masterWrapMech,
- NULL, &wrappedMS, CKM_SSL3_MASTER_KEY_DERIVE,
- CKA_DERIVE, SSL3_MASTER_SECRET_LENGTH, keyFlags);
- PK11_FreeSymKey(wrapKey);
- if (!*ms) {
- return SECFailure;
- }
- return SECSuccess;
-}
-
-static SECStatus
ssl3_HandleClientHelloPart2(sslSocket *ss,
SECItem *suites,
- sslSessionID *sid,
- const PRUint8 *msg,
- unsigned int len)
+ SECItem *comps,
+ sslSessionID *sid)
{
+ PRBool haveSpecWriteLock = PR_FALSE;
PRBool haveXmitBufLock = PR_FALSE;
int errCode = SSL_ERROR_RX_MALFORMED_CLIENT_HELLO;
SSL3AlertDescription desc = illegal_parameter;
SECStatus rv;
unsigned int i;
- unsigned int j;
+ int j;
- rv = ssl_HashHandshakeMessage(ss, ssl_hs_client_hello, msg, len);
- if (rv != SECSuccess) {
- errCode = SEC_ERROR_LIBRARY_FAILURE;
- desc = internal_error;
- goto alert_loser;
- }
-
- /* If we already have a session for this client, be sure to pick the same
- ** cipher suite we picked before. This is not a loop, despite appearances.
+ /* If we already have a session for this client, be sure to pick the
+ ** same cipher suite and compression method we picked before.
+ ** This is not a loop, despite appearances.
*/
if (sid)
do {
@@ -8323,6 +8676,18 @@ ssl3_HandleClientHelloPart2(sslSocket *ss,
SSLVersionRange vrange = { ss->version, ss->version };
#endif
+ /* Check that the cached compression method is still enabled. */
+ if (!ssl_CompressionEnabled(ss, sid->u.ssl3.compression))
+ break;
+
+ /* Check that the cached compression method is in the client's list */
+ for (i = 0; i < comps->len; i++) {
+ if (comps->data[i] == sid->u.ssl3.compression)
+ break;
+ }
+ if (i == comps->len)
+ break;
+
suite = ss->cipherSuites;
/* Find the entry for the cipher suite used in the cached session. */
for (j = ssl_V3_SUITES_IMPLEMENTED; j > 0; --j, ++suite) {
@@ -8330,7 +8695,7 @@ ssl3_HandleClientHelloPart2(sslSocket *ss,
break;
}
PORT_Assert(j > 0);
- if (j == 0)
+ if (j <= 0)
break;
#ifdef PARANOID
/* Double check that the cached cipher suite is still enabled,
@@ -8349,15 +8714,17 @@ ssl3_HandleClientHelloPart2(sslSocket *ss,
for (i = 0; i + 1 < suites->len; i += 2) {
PRUint16 suite_i = (suites->data[i] << 8) | suites->data[i + 1];
if (suite_i == suite->cipher_suite) {
- ss->ssl3.hs.cipher_suite = suite_i;
- rv = ssl3_SetupCipherSuite(ss, PR_TRUE);
+ rv = ssl3_SetCipherSuite(ss, suite_i, PR_TRUE);
if (rv != SECSuccess) {
desc = internal_error;
errCode = PORT_GetError();
goto alert_loser;
}
- goto cipher_found;
+ /* Use the cached compression method. */
+ ss->ssl3.hs.compression =
+ sid->u.ssl3.compression;
+ goto compression_found;
}
}
} while (0);
@@ -8365,7 +8732,8 @@ ssl3_HandleClientHelloPart2(sslSocket *ss,
#ifndef PARANOID
/* Look for a matching cipher suite. */
- if (ssl3_config_match_init(ss) == 0) {
+ j = ssl3_config_match_init(ss);
+ if (j <= 0) { /* no ciphers are working/supported by PK11 */
desc = internal_error;
errCode = PORT_GetError(); /* error code is already set. */
goto alert_loser;
@@ -8379,8 +8747,25 @@ ssl3_HandleClientHelloPart2(sslSocket *ss,
goto alert_loser;
}
-cipher_found:
+ /* Select a compression algorithm. */
+ for (i = 0; i < comps->len; i++) {
+ SSLCompressionMethod method = (SSLCompressionMethod)comps->data[i];
+ if (!ssl_CompressionEnabled(ss, method))
+ continue;
+ for (j = 0; j < ssl_compression_method_count; j++) {
+ if (method == ssl_compression_methods[j]) {
+ ss->ssl3.hs.compression = ssl_compression_methods[j];
+ goto compression_found;
+ }
+ }
+ }
+ errCode = SSL_ERROR_NO_COMPRESSION_OVERLAP;
+ /* null compression must be supported */
+ goto alert_loser;
+
+compression_found:
suites->data = NULL;
+ comps->data = NULL;
/* If there are any failures while processing the old sid,
* we don't consider them to be errors. Instead, We just behave
@@ -8390,10 +8775,12 @@ cipher_found:
*/
if (sid != NULL)
do {
- PK11SymKey *masterSecret;
+ ssl3CipherSpec *pwSpec;
+ SECItem wrappedMS; /* wrapped key */
if (sid->version != ss->version ||
- sid->u.ssl3.cipherSuite != ss->ssl3.hs.cipher_suite) {
+ sid->u.ssl3.cipherSuite != ss->ssl3.hs.cipher_suite ||
+ sid->u.ssl3.compression != ss->ssl3.hs.compression) {
break; /* not an error */
}
@@ -8442,13 +8829,54 @@ cipher_found:
}
ss->sec.ci.sid = NULL;
}
-
/* we need to resurrect the master secret.... */
- rv = ssl3_UnwrapMasterSecretServer(ss, sid, &masterSecret);
- if (rv != SECSuccess) {
- break; /* not an error */
- }
+ ssl_GetSpecWriteLock(ss);
+ haveSpecWriteLock = PR_TRUE;
+ pwSpec = ss->ssl3.pwSpec;
+ if (sid->u.ssl3.keys.msIsWrapped) {
+ PK11SymKey *wrapKey; /* wrapping key */
+ CK_FLAGS keyFlags = 0;
+
+ wrapKey = ssl3_GetWrappingKey(ss, NULL,
+ sid->u.ssl3.masterWrapMech,
+ ss->pkcs11PinArg);
+ if (!wrapKey) {
+ /* we have a SID cache entry, but no wrapping key for it??? */
+ break;
+ }
+
+ if (ss->version > SSL_LIBRARY_VERSION_3_0) { /* isTLS */
+ keyFlags = CKF_SIGN | CKF_VERIFY;
+ }
+
+ wrappedMS.data = sid->u.ssl3.keys.wrapped_master_secret;
+ wrappedMS.len = sid->u.ssl3.keys.wrapped_master_secret_len;
+
+ /* unwrap the master secret. */
+ pwSpec->master_secret =
+ PK11_UnwrapSymKeyWithFlags(wrapKey, sid->u.ssl3.masterWrapMech,
+ NULL, &wrappedMS, CKM_SSL3_MASTER_KEY_DERIVE,
+ CKA_DERIVE, sizeof(SSL3MasterSecret), keyFlags);
+ PK11_FreeSymKey(wrapKey);
+ if (pwSpec->master_secret == NULL) {
+ break; /* not an error */
+ }
+ } else {
+ /* need to import the raw master secret to session object */
+ PK11SlotInfo *slot;
+ wrappedMS.data = sid->u.ssl3.keys.wrapped_master_secret;
+ wrappedMS.len = sid->u.ssl3.keys.wrapped_master_secret_len;
+ slot = PK11_GetInternalSlot();
+ pwSpec->master_secret =
+ PK11_ImportSymKey(slot, CKM_SSL3_MASTER_KEY_DERIVE,
+ PK11_OriginUnwrap, CKA_ENCRYPT, &wrappedMS,
+ NULL);
+ PK11_FreeSlot(slot);
+ if (pwSpec->master_secret == NULL) {
+ break; /* not an error */
+ }
+ }
ss->sec.ci.sid = sid;
if (sid->peerCert != NULL) {
ss->sec.peerCert = CERT_DupCertificate(sid->peerCert);
@@ -8456,6 +8884,8 @@ cipher_found:
/*
* Old SID passed all tests, so resume this old session.
+ *
+ * XXX make sure compression still matches
*/
SSL_AtomicIncrementLong(&ssl3stats.hch_sid_cache_hits);
if (ss->statelessResume)
@@ -8466,8 +8896,6 @@ cipher_found:
ss->sec.authKeyBits = sid->authKeyBits;
ss->sec.keaType = sid->keaType;
ss->sec.keaKeyBits = sid->keaKeyBits;
- ss->sec.originalKeaGroup = ssl_LookupNamedGroup(sid->keaGroup);
- ss->sec.signatureScheme = sid->sigScheme;
ss->sec.localCert =
CERT_DupCertificate(ss->sec.serverCert->serverCert);
@@ -8502,8 +8930,13 @@ cipher_found:
goto loser;
}
- /* We are re-using the old MS, so no need to derive again. */
- rv = ssl3_InitPendingCipherSpecs(ss, masterSecret, PR_FALSE);
+ if (haveSpecWriteLock) {
+ ssl_ReleaseSpecWriteLock(ss);
+ haveSpecWriteLock = PR_FALSE;
+ }
+
+ /* NULL value for PMS because we are re-using the old MS */
+ rv = ssl3_InitPendingCipherSpec(ss, NULL);
if (rv != SECSuccess) {
errCode = PORT_GetError();
goto loser;
@@ -8528,8 +8961,12 @@ cipher_found:
return SECSuccess;
} while (0);
+ if (haveSpecWriteLock) {
+ ssl_ReleaseSpecWriteLock(ss);
+ haveSpecWriteLock = PR_FALSE;
+ }
+
if (sid) { /* we had a sid, but it's no longer valid, free it */
- ss->statelessResume = PR_FALSE;
SSL_AtomicIncrementLong(&ssl3stats.hch_sid_cache_not_ok);
ss->sec.uncache(sid);
ssl_FreeSID(sid);
@@ -8548,8 +8985,9 @@ cipher_found:
*/
if (ssl3_ExtensionNegotiated(ss, ssl_session_ticket_xtn) &&
ssl3_KEASupportsTickets(ss->ssl3.hs.kea_def)) {
- ssl3_RegisterExtensionSender(ss, &ss->xtnData, ssl_session_ticket_xtn,
- ssl_SendEmptyExtension);
+ ssl3_RegisterExtensionSender(ss, &ss->xtnData,
+ ssl_session_ticket_xtn,
+ ssl3_SendSessionTicketXtn);
}
rv = ssl3_ServerCallSNICallback(ss);
@@ -8593,6 +9031,10 @@ cipher_found:
return SECSuccess;
alert_loser:
+ if (haveSpecWriteLock) {
+ ssl_ReleaseSpecWriteLock(ss);
+ haveSpecWriteLock = PR_FALSE;
+ }
(void)SSL3_SendAlert(ss, alert_fatal, desc);
/* FALLTHRU */
loser:
@@ -8601,6 +9043,10 @@ loser:
ssl_FreeSID(sid);
}
+ if (haveSpecWriteLock) {
+ ssl_ReleaseSpecWriteLock(ss);
+ }
+
if (haveXmitBufLock) {
ssl_ReleaseXmitBufLock(ss);
}
@@ -8614,7 +9060,7 @@ loser:
* in asking to use the V3 handshake.
*/
SECStatus
-ssl3_HandleV2ClientHello(sslSocket *ss, unsigned char *buffer, unsigned int length,
+ssl3_HandleV2ClientHello(sslSocket *ss, unsigned char *buffer, int length,
PRUint8 padding)
{
sslSessionID *sid = NULL;
@@ -8622,11 +9068,11 @@ ssl3_HandleV2ClientHello(sslSocket *ss, unsigned char *buffer, unsigned int leng
unsigned char *random;
SSL3ProtocolVersion version;
SECStatus rv;
- unsigned int i;
- unsigned int j;
- unsigned int sid_length;
- unsigned int suite_length;
- unsigned int rand_length;
+ int i;
+ int j;
+ int sid_length;
+ int suite_length;
+ int rand_length;
int errCode = SSL_ERROR_RX_MALFORMED_CLIENT_HELLO;
SSL3AlertDescription desc = handshake_failure;
unsigned int total = SSL_HL_CLIENT_HELLO_HBYTES;
@@ -8637,11 +9083,14 @@ ssl3_HandleV2ClientHello(sslSocket *ss, unsigned char *buffer, unsigned int leng
ssl_GetSSL3HandshakeLock(ss);
+ ssl3_ResetExtensionData(&ss->xtnData);
+
version = (buffer[1] << 8) | buffer[2];
if (version < SSL_LIBRARY_VERSION_3_0) {
goto loser;
}
+ ssl3_InitState(ss);
ssl3_RestartHandshakeHashes(ss);
if (ss->ssl3.hs.ws != wait_client_hello) {
@@ -8673,11 +9122,6 @@ ssl3_HandleV2ClientHello(sslSocket *ss, unsigned char *buffer, unsigned int leng
goto alert_loser;
}
ss->ssl3.hs.preliminaryInfo |= ssl_preinfo_version;
- if (!ss->firstHsDone) {
- ssl_GetSpecWriteLock(ss);
- ssl_SetSpecVersions(ss, ss->ssl3.cwSpec);
- ssl_ReleaseSpecWriteLock(ss);
- }
/* if we get a non-zero SID, just ignore it. */
if (length != total) {
@@ -8700,14 +9144,15 @@ ssl3_HandleV2ClientHello(sslSocket *ss, unsigned char *buffer, unsigned int leng
PORT_Assert(SSL_MAX_CHALLENGE_BYTES == SSL3_RANDOM_LENGTH);
- PORT_Memset(ss->ssl3.hs.client_random, 0, SSL3_RANDOM_LENGTH);
- PORT_Memcpy(&ss->ssl3.hs.client_random[SSL3_RANDOM_LENGTH - rand_length],
- random, rand_length);
+ PORT_Memset(&ss->ssl3.hs.client_random, 0, SSL3_RANDOM_LENGTH);
+ PORT_Memcpy(
+ &ss->ssl3.hs.client_random.rand[SSL3_RANDOM_LENGTH - rand_length],
+ random, rand_length);
- PRINT_BUF(60, (ss, "client random:", ss->ssl3.hs.client_random,
+ PRINT_BUF(60, (ss, "client random:", &ss->ssl3.hs.client_random.rand[0],
SSL3_RANDOM_LENGTH));
-
- if (ssl3_config_match_init(ss) == 0) {
+ i = ssl3_config_match_init(ss);
+ if (i <= 0) {
errCode = PORT_GetError(); /* error code is already set. */
goto alert_loser;
}
@@ -8716,6 +9161,8 @@ ssl3_HandleV2ClientHello(sslSocket *ss, unsigned char *buffer, unsigned int leng
**
** NOTE: This suite selection algorithm should be the same as the one in
** ssl3_HandleClientHello().
+ **
+ ** See the comments about export cipher suites in ssl3_HandleClientHello().
*/
for (j = 0; j < ssl_V3_SUITES_IMPLEMENTED; j++) {
ssl3CipherSuiteCfg *suite = &ss->cipherSuites[j];
@@ -8726,8 +9173,7 @@ ssl3_HandleV2ClientHello(sslSocket *ss, unsigned char *buffer, unsigned int leng
for (i = 0; i + 2 < suite_length; i += 3) {
PRUint32 suite_i = (suites[i] << 16) | (suites[i + 1] << 8) | suites[i + 2];
if (suite_i == suite->cipher_suite) {
- ss->ssl3.hs.cipher_suite = suite_i;
- rv = ssl3_SetupCipherSuite(ss, PR_TRUE);
+ rv = ssl3_SetCipherSuite(ss, suite_i, PR_TRUE);
if (rv != SECSuccess) {
desc = internal_error;
errCode = PORT_GetError();
@@ -8763,7 +9209,7 @@ suite_found:
if (suite_i == TLS_EMPTY_RENEGOTIATION_INFO_SCSV) {
PRUint8 *b2 = (PRUint8 *)emptyRIext;
PRUint32 L2 = sizeof emptyRIext;
- (void)ssl3_HandleExtensions(ss, &b2, &L2, ssl_hs_client_hello);
+ (void)ssl3_HandleExtensions(ss, &b2, &L2, client_hello);
break;
}
}
@@ -8775,6 +9221,8 @@ suite_found:
goto alert_loser;
}
+ ss->ssl3.hs.compression = ssl_compression_null;
+
rv = ssl3_SelectServerCert(ss);
if (rv != SECSuccess) {
errCode = PORT_GetError();
@@ -8818,64 +9266,6 @@ loser:
return SECFailure;
}
-SECStatus
-ssl_ConstructServerHello(sslSocket *ss, PRBool helloRetry,
- const sslBuffer *extensionBuf, sslBuffer *messageBuf)
-{
- SECStatus rv;
- SSL3ProtocolVersion version;
- sslSessionID *sid = ss->sec.ci.sid;
-
- if (IS_DTLS(ss) && ss->version < SSL_LIBRARY_VERSION_TLS_1_3) {
- version = dtls_TLSVersionToDTLSVersion(ss->version);
- } else {
- version = PR_MIN(ss->version, SSL_LIBRARY_VERSION_TLS_1_2);
- }
-
- rv = sslBuffer_AppendNumber(messageBuf, version, 2);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- /* Random already generated in ssl3_HandleClientHello */
- rv = sslBuffer_Append(messageBuf, helloRetry ? ssl_hello_retry_random : ss->ssl3.hs.server_random,
- SSL3_RANDOM_LENGTH);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- if (ss->version < SSL_LIBRARY_VERSION_TLS_1_3) {
- if (sid) {
- rv = sslBuffer_AppendVariable(messageBuf, sid->u.ssl3.sessionID,
- sid->u.ssl3.sessionIDLength, 1);
- } else {
- rv = sslBuffer_AppendNumber(messageBuf, 0, 1);
- }
- } else {
- rv = sslBuffer_AppendVariable(messageBuf, ss->ssl3.hs.fakeSid.data,
- ss->ssl3.hs.fakeSid.len, 1);
- }
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- rv = sslBuffer_AppendNumber(messageBuf, ss->ssl3.hs.cipher_suite, 2);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- rv = sslBuffer_AppendNumber(messageBuf, ssl_compression_null, 1);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- if (SSL_BUFFER_LEN(extensionBuf)) {
- rv = sslBuffer_AppendBufferVariable(messageBuf, extensionBuf, 2);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- }
-
- return SECSuccess;
-}
-
/* The negotiated version number has been already placed in ss->version.
**
** Called from: ssl3_HandleClientHello (resuming session),
@@ -8885,9 +9275,12 @@ ssl_ConstructServerHello(sslSocket *ss, PRBool helloRetry,
SECStatus
ssl3_SendServerHello(sslSocket *ss)
{
+ sslSessionID *sid;
SECStatus rv;
- sslBuffer extensionBuf = SSL_BUFFER_EMPTY;
- sslBuffer messageBuf = SSL_BUFFER_EMPTY;
+ PRUint32 maxBytes = 65535;
+ PRUint32 length;
+ PRInt32 extensions_len = 0;
+ SSL3ProtocolVersion version;
SSL_TRC(3, ("%d: SSL3[%d]: send server_hello handshake", SSL_GETPID(),
ss->fd));
@@ -8901,43 +9294,94 @@ ssl3_SendServerHello(sslSocket *ss)
return SECFailure;
}
- rv = ssl_ConstructExtensions(ss, &extensionBuf, ssl_hs_server_hello);
- if (rv != SECSuccess) {
- goto loser;
+ sid = ss->sec.ci.sid;
+
+ extensions_len = ssl3_CallHelloExtensionSenders(
+ ss, PR_FALSE, maxBytes, &ss->xtnData.serverHelloSenders[0]);
+ if (extensions_len > 0)
+ extensions_len += 2; /* Add sizeof total extension length */
+
+ /* TLS 1.3 doesn't use the session_id or compression_method
+ * fields in the ServerHello. */
+ length = sizeof(SSL3ProtocolVersion) + SSL3_RANDOM_LENGTH;
+ if (ss->version < SSL_LIBRARY_VERSION_TLS_1_3) {
+ length += 1 + ((sid == NULL) ? 0 : sid->u.ssl3.sessionIDLength);
}
+ length += sizeof(ssl3CipherSuite);
+ if (ss->version < SSL_LIBRARY_VERSION_TLS_1_3) {
+ length += 1; /* Compression */
+ }
+ length += extensions_len;
- rv = ssl_ConstructServerHello(ss, PR_FALSE, &extensionBuf, &messageBuf);
+ rv = ssl3_AppendHandshakeHeader(ss, server_hello, length);
if (rv != SECSuccess) {
- goto loser;
+ return rv; /* err set by AppendHandshake. */
+ }
+
+ if (IS_DTLS(ss) && ss->version < SSL_LIBRARY_VERSION_TLS_1_3) {
+ version = dtls_TLSVersionToDTLSVersion(ss->version);
+ } else {
+ version = tls13_EncodeDraftVersion(ss->version);
}
- rv = ssl3_AppendHandshakeHeader(ss, ssl_hs_server_hello,
- SSL_BUFFER_LEN(&messageBuf));
+ rv = ssl3_AppendHandshakeNumber(ss, version, 2);
if (rv != SECSuccess) {
- goto loser; /* err set by AppendHandshake. */
+ return rv; /* err set by AppendHandshake. */
+ }
+ /* Random already generated in ssl3_HandleClientHello */
+ rv = ssl3_AppendHandshake(
+ ss, &ss->ssl3.hs.server_random, SSL3_RANDOM_LENGTH);
+ if (rv != SECSuccess) {
+ return rv; /* err set by AppendHandshake. */
}
- rv = ssl3_AppendHandshake(ss, SSL_BUFFER_BASE(&messageBuf),
- SSL_BUFFER_LEN(&messageBuf));
+ if (ss->version < SSL_LIBRARY_VERSION_TLS_1_3) {
+ if (sid) {
+ rv = ssl3_AppendHandshakeVariable(
+ ss, sid->u.ssl3.sessionID, sid->u.ssl3.sessionIDLength, 1);
+ } else {
+ rv = ssl3_AppendHandshakeNumber(ss, 0, 1);
+ }
+ if (rv != SECSuccess) {
+ return rv; /* err set by AppendHandshake. */
+ }
+ }
+
+ rv = ssl3_AppendHandshakeNumber(ss, ss->ssl3.hs.cipher_suite, 2);
if (rv != SECSuccess) {
- goto loser; /* err set by AppendHandshake. */
+ return rv; /* err set by AppendHandshake. */
+ }
+ if (ss->version < SSL_LIBRARY_VERSION_TLS_1_3) {
+ rv = ssl3_AppendHandshakeNumber(ss, ss->ssl3.hs.compression, 1);
+ if (rv != SECSuccess) {
+ return rv; /* err set by AppendHandshake. */
+ }
+ }
+ if (extensions_len) {
+ PRInt32 sent_len;
+
+ extensions_len -= 2;
+ rv = ssl3_AppendHandshakeNumber(ss, extensions_len, 2);
+ if (rv != SECSuccess)
+ return rv; /* err set by ssl3_AppendHandshakeNumber */
+ sent_len = ssl3_CallHelloExtensionSenders(ss, PR_TRUE, extensions_len,
+ &ss->xtnData.serverHelloSenders[0]);
+ PORT_Assert(sent_len == extensions_len);
+ if (sent_len != extensions_len) {
+ if (sent_len >= 0)
+ PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
+ return SECFailure;
+ }
}
if (ss->version < SSL_LIBRARY_VERSION_TLS_1_3) {
- rv = ssl3_SetupBothPendingCipherSpecs(ss);
+ rv = ssl3_SetupPendingCipherSpec(ss);
if (rv != SECSuccess) {
- goto loser; /* err set */
+ return rv; /* err set by ssl3_SetupPendingCipherSpec */
}
}
- sslBuffer_Clear(&extensionBuf);
- sslBuffer_Clear(&messageBuf);
return SECSuccess;
-
-loser:
- sslBuffer_Clear(&extensionBuf);
- sslBuffer_Clear(&messageBuf);
- return SECFailure;
}
SECStatus
@@ -8994,8 +9438,6 @@ ssl3_SendDHServerKeyExchange(sslSocket *ss)
SECKEYPublicKey *pubKey;
SECKEYPrivateKey *certPrivateKey;
const sslNamedGroupDef *groupDef;
- /* Do this on the heap, this could be over 2k long. */
- sslBuffer dhBuf = SSL_BUFFER_EMPTY;
if (kea_def->kea != kea_dhe_dss && kea_def->kea != kea_dhe_rsa) {
/* TODO: Support DH_anon. It might be sufficient to drop the signature.
@@ -9019,7 +9461,7 @@ ssl3_SendDHServerKeyExchange(sslSocket *ss)
}
PR_APPEND_LINK(&keyPair->link, &ss->ephemeralKeyPairs);
- if (ss->version == SSL_LIBRARY_VERSION_TLS_1_2) {
+ if (ss->ssl3.pwSpec->version == SSL_LIBRARY_VERSION_TLS_1_2) {
hashAlg = ssl_SignatureSchemeToHashType(ss->ssl3.hs.signatureScheme);
} else {
/* Use ssl_hash_none to represent the MD5+SHA1 combo. */
@@ -9051,11 +9493,11 @@ ssl3_SendDHServerKeyExchange(sslSocket *ss)
2 + pubKey->u.dh.prime.len +
2 + signed_hash.len;
- if (ss->version >= SSL_LIBRARY_VERSION_TLS_1_2) {
+ if (ss->ssl3.pwSpec->version >= SSL_LIBRARY_VERSION_TLS_1_2) {
length += 2;
}
- rv = ssl3_AppendHandshakeHeader(ss, ssl_hs_server_key_exchange, length);
+ rv = ssl3_AppendHandshakeHeader(ss, server_key_exchange, length);
if (rv != SECSuccess) {
goto loser; /* err set by AppendHandshake. */
}
@@ -9072,16 +9514,12 @@ ssl3_SendDHServerKeyExchange(sslSocket *ss)
goto loser; /* err set by AppendHandshake. */
}
- rv = ssl_AppendPaddedDHKeyShare(&dhBuf, pubKey, PR_TRUE);
- if (rv != SECSuccess) {
- goto loser; /* err set by AppendPaddedDHKeyShare. */
- }
- rv = ssl3_AppendBufferToHandshake(ss, &dhBuf);
+ rv = ssl_AppendPaddedDHKeyShare(ss, pubKey, PR_TRUE);
if (rv != SECSuccess) {
goto loser; /* err set by AppendHandshake. */
}
- if (ss->version >= SSL_LIBRARY_VERSION_TLS_1_2) {
+ if (ss->ssl3.pwSpec->version >= SSL_LIBRARY_VERSION_TLS_1_2) {
rv = ssl3_AppendHandshakeNumber(ss, ss->ssl3.hs.signatureScheme, 2);
if (rv != SECSuccess) {
goto loser; /* err set by AppendHandshake. */
@@ -9093,15 +9531,12 @@ ssl3_SendDHServerKeyExchange(sslSocket *ss)
if (rv != SECSuccess) {
goto loser; /* err set by AppendHandshake. */
}
-
- sslBuffer_Clear(&dhBuf);
PORT_Free(signed_hash.data);
return SECSuccess;
loser:
if (signed_hash.data)
PORT_Free(signed_hash.data);
- sslBuffer_Clear(&dhBuf);
return SECFailure;
}
@@ -9136,15 +9571,14 @@ ssl3_SendServerKeyExchange(sslSocket *ss)
}
SECStatus
-ssl3_EncodeSigAlgs(const sslSocket *ss, sslBuffer *buf)
+ssl3_EncodeSigAlgs(const sslSocket *ss, PRUint8 *buf, unsigned maxLen, PRUint32 *len)
{
- unsigned int lengthOffset;
unsigned int i;
- PRBool found = PR_FALSE;
- SECStatus rv;
+ PRUint8 *p = buf;
- rv = sslBuffer_Skip(buf, 2, &lengthOffset);
- if (rv != SECSuccess) {
+ PORT_Assert(maxLen >= ss->ssl3.signatureSchemeCount * 2);
+ if (maxLen < ss->ssl3.signatureSchemeCount * 2) {
+ PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
return SECFailure;
}
@@ -9162,21 +9596,16 @@ ssl3_EncodeSigAlgs(const sslSocket *ss, sslBuffer *buf)
if ((NSS_GetAlgorithmPolicy(hashOID, &policy) != SECSuccess) ||
(policy & NSS_USE_ALG_IN_SSL_KX)) {
- rv = sslBuffer_AppendNumber(buf, ss->ssl3.signatureSchemes[i], 2);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- found = PR_TRUE;
+ p = ssl_EncodeUintX((PRUint32)ss->ssl3.signatureSchemes[i], 2, p);
}
}
- if (!found) {
+ if (p == buf) {
PORT_SetError(SSL_ERROR_NO_SUPPORTED_SIGNATURE_ALGORITHM);
return SECFailure;
}
-
- return sslBuffer_InsertLength(buf, lengthOffset, 2);
+ *len = p - buf;
+ return SECSuccess;
}
static SECStatus
@@ -9185,15 +9614,15 @@ ssl3_SendCertificateRequest(sslSocket *ss)
PRBool isTLS12;
const PRUint8 *certTypes;
SECStatus rv;
- PRUint32 length;
- const SECItem *names;
+ int length;
+ SECItem *names;
unsigned int calen;
unsigned int nnames;
- const SECItem *name;
- unsigned int i;
+ SECItem *name;
+ int i;
int certTypesLength;
- PRUint8 sigAlgs[2 + MAX_SIGNATURE_SCHEMES * 2];
- sslBuffer sigAlgsBuf = SSL_BUFFER(sigAlgs);
+ PRUint8 sigAlgs[MAX_SIGNATURE_SCHEMES * 2];
+ unsigned int sigAlgsLength = 0;
SSL_TRC(3, ("%d: SSL3[%d]: send certificate_request handshake",
SSL_GETPID(), ss->fd));
@@ -9201,7 +9630,7 @@ ssl3_SendCertificateRequest(sslSocket *ss)
PORT_Assert(ss->opt.noLocks || ssl_HaveXmitBufLock(ss));
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
- isTLS12 = (PRBool)(ss->version >= SSL_LIBRARY_VERSION_TLS_1_2);
+ isTLS12 = (PRBool)(ss->ssl3.pwSpec->version >= SSL_LIBRARY_VERSION_TLS_1_2);
rv = ssl_GetCertificateRequestCAs(ss, &calen, &names, &nnames);
if (rv != SECSuccess) {
@@ -9212,14 +9641,14 @@ ssl3_SendCertificateRequest(sslSocket *ss)
length = 1 + certTypesLength + 2 + calen;
if (isTLS12) {
- rv = ssl3_EncodeSigAlgs(ss, &sigAlgsBuf);
+ rv = ssl3_EncodeSigAlgs(ss, sigAlgs, sizeof(sigAlgs), &sigAlgsLength);
if (rv != SECSuccess) {
return rv;
}
- length += SSL_BUFFER_LEN(&sigAlgsBuf);
+ length += 2 + sigAlgsLength;
}
- rv = ssl3_AppendHandshakeHeader(ss, ssl_hs_certificate_request, length);
+ rv = ssl3_AppendHandshakeHeader(ss, certificate_request, length);
if (rv != SECSuccess) {
return rv; /* err set by AppendHandshake. */
}
@@ -9228,8 +9657,7 @@ ssl3_SendCertificateRequest(sslSocket *ss)
return rv; /* err set by AppendHandshake. */
}
if (isTLS12) {
- rv = ssl3_AppendHandshake(ss, SSL_BUFFER_BASE(&sigAlgsBuf),
- SSL_BUFFER_LEN(&sigAlgsBuf));
+ rv = ssl3_AppendHandshakeVariable(ss, sigAlgs, sigAlgsLength, 2);
if (rv != SECSuccess) {
return rv; /* err set by AppendHandshake. */
}
@@ -9259,7 +9687,7 @@ ssl3_SendServerHelloDone(sslSocket *ss)
PORT_Assert(ss->opt.noLocks || ssl_HaveXmitBufLock(ss));
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
- rv = ssl3_AppendHandshakeHeader(ss, ssl_hs_server_hello_done, 0);
+ rv = ssl3_AppendHandshakeHeader(ss, server_hello_done, 0);
if (rv != SECSuccess) {
return rv; /* err set by AppendHandshake. */
}
@@ -9275,7 +9703,8 @@ ssl3_SendServerHelloDone(sslSocket *ss)
* Caller must hold Handshake and RecvBuf locks.
*/
static SECStatus
-ssl3_HandleCertificateVerify(sslSocket *ss, PRUint8 *b, PRUint32 length)
+ssl3_HandleCertificateVerify(sslSocket *ss, PRUint8 *b, PRUint32 length,
+ SSL3Hashes *hashes)
{
SECItem signed_hash = { siBuffer, NULL, 0 };
SECStatus rv;
@@ -9283,9 +9712,9 @@ ssl3_HandleCertificateVerify(sslSocket *ss, PRUint8 *b, PRUint32 length)
SSL3AlertDescription desc = handshake_failure;
PRBool isTLS;
SSLSignatureScheme sigScheme;
- SSL3Hashes hashes;
- const PRUint8 *savedMsg = b;
- const PRUint32 savedLen = length;
+ SSLHashType hashAlg;
+ SSL3Hashes localHashes;
+ SSL3Hashes *hashesForVerify = NULL;
SSL_TRC(3, ("%d: SSL3[%d]: handle certificate_verify handshake",
SSL_GETPID(), ss->fd));
@@ -9301,8 +9730,14 @@ ssl3_HandleCertificateVerify(sslSocket *ss, PRUint8 *b, PRUint32 length)
/* TLS 1.3 is handled by tls13_HandleCertificateVerify */
PORT_Assert(ss->ssl3.prSpec->version <= SSL_LIBRARY_VERSION_TLS_1_2);
- if (ss->ssl3.prSpec->version == SSL_LIBRARY_VERSION_TLS_1_2) {
- PORT_Assert(ss->ssl3.hs.hashType == handshake_hash_record);
+ if (!hashes) {
+ PORT_Assert(0);
+ desc = internal_error;
+ errCode = SEC_ERROR_LIBRARY_FAILURE;
+ goto alert_loser;
+ }
+
+ if (ss->ssl3.hs.hashType == handshake_hash_record) {
rv = ssl_ConsumeSignatureScheme(ss, &b, &length, &sigScheme);
if (rv != SECSuccess) {
goto loser; /* malformed or unsupported. */
@@ -9315,20 +9750,25 @@ ssl3_HandleCertificateVerify(sslSocket *ss, PRUint8 *b, PRUint32 length)
goto alert_loser;
}
+ hashAlg = ssl_SignatureSchemeToHashType(sigScheme);
+
+ /* Read from the message buffer, but we need to use only up to the end
+ * of the previous handshake message. The length of the transcript up to
+ * that point is saved in |hashes->u.transcriptLen|. */
rv = ssl3_ComputeHandshakeHash(ss->ssl3.hs.messages.buf,
- ss->ssl3.hs.messages.len,
- ssl_SignatureSchemeToHashType(sigScheme),
- &hashes);
+ hashes->u.transcriptLen,
+ hashAlg, &localHashes);
+
+ if (rv == SECSuccess) {
+ hashesForVerify = &localHashes;
+ } else {
+ errCode = SSL_ERROR_DIGEST_FAILURE;
+ desc = decrypt_error;
+ goto alert_loser;
+ }
} else {
- PORT_Assert(ss->ssl3.hs.hashType != handshake_hash_record);
+ hashesForVerify = hashes;
sigScheme = ssl_sig_none;
- rv = ssl3_ComputeHandshakeHashes(ss, ss->ssl3.prSpec, &hashes, 0);
- }
-
- if (rv != SECSuccess) {
- errCode = SSL_ERROR_DIGEST_FAILURE;
- desc = decrypt_error;
- goto alert_loser;
}
rv = ssl3_ConsumeHandshakeVariable(ss, &signed_hash, 2, &b, &length);
@@ -9339,7 +9779,7 @@ ssl3_HandleCertificateVerify(sslSocket *ss, PRUint8 *b, PRUint32 length)
isTLS = (PRBool)(ss->ssl3.prSpec->version > SSL_LIBRARY_VERSION_3_0);
/* XXX verify that the key & kea match */
- rv = ssl3_VerifySignedHashes(ss, sigScheme, &hashes, &signed_hash);
+ rv = ssl3_VerifySignedHashes(ss, sigScheme, hashesForVerify, &signed_hash);
if (rv != SECSuccess) {
errCode = PORT_GetError();
desc = isTLS ? decrypt_error : handshake_failure;
@@ -9352,14 +9792,6 @@ ssl3_HandleCertificateVerify(sslSocket *ss, PRUint8 *b, PRUint32 length)
desc = isTLS ? decode_error : illegal_parameter;
goto alert_loser; /* malformed */
}
-
- rv = ssl_HashHandshakeMessage(ss, ssl_hs_certificate_verify,
- savedMsg, savedLen);
- if (rv != SECSuccess) {
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return rv;
- }
-
ss->ssl3.hs.ws = wait_change_cipher;
return SECSuccess;
@@ -9400,9 +9832,9 @@ ssl3_GenerateRSAPMS(sslSocket *ss, ssl3CipherSpec *spec,
** slot already hold the SpecWriteLock.
*/
PORT_Assert(ss->opt.noLocks || ssl_HaveSpecWriteLock(ss));
- PORT_Assert(ss->ssl3.prSpec->epoch == ss->ssl3.pwSpec->epoch);
+ PORT_Assert(ss->ssl3.prSpec == ss->ssl3.pwSpec);
- calg = spec->cipherDef->calg;
+ calg = spec->cipher_def->calg;
/* First get an appropriate slot. */
mechanism_array[0] = CKM_SSL3_PRE_MASTER_KEY_GEN;
@@ -9470,7 +9902,7 @@ ssl3_HandleRSAClientKeyExchange(sslSocket *ss,
PORT_Assert(ss->opt.noLocks || ssl_HaveRecvBufLock(ss));
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
- PORT_Assert(ss->ssl3.prSpec->epoch == ss->ssl3.pwSpec->epoch);
+ PORT_Assert(ss->ssl3.prSpec == ss->ssl3.pwSpec);
enc_pms.data = b;
enc_pms.len = length;
@@ -9567,7 +9999,7 @@ ssl3_HandleRSAClientKeyExchange(sslSocket *ss,
}
/* This step will derive the MS from the PMS, among other things. */
- rv = ssl3_InitPendingCipherSpecs(ss, currentPms, PR_TRUE);
+ rv = ssl3_InitPendingCipherSpec(ss, currentPms);
PK11_FreeSymKey(currentPms);
if (rv != SECSuccess) {
@@ -9632,7 +10064,7 @@ ssl3_HandleDHClientKeyExchange(sslSocket *ss,
return SECFailure;
}
- rv = ssl3_InitPendingCipherSpecs(ss, pms, PR_TRUE);
+ rv = ssl3_InitPendingCipherSpec(ss, pms);
PK11_FreeSymKey(pms);
ssl_FreeEphemeralKeyPairs(ss);
return rv;
@@ -9731,13 +10163,13 @@ ssl3_SendEmptyCertificate(sslSocket *ss)
const SECItem *context;
if (ss->version >= SSL_LIBRARY_VERSION_TLS_1_3) {
- PORT_Assert(ss->ssl3.hs.clientCertRequested);
- context = &ss->xtnData.certReqContext;
+ PORT_Assert(ss->ssl3.hs.certificateRequest);
+ context = &ss->ssl3.hs.certificateRequest->context;
len = context->len + 1;
isTLS13 = PR_TRUE;
}
- rv = ssl3_AppendHandshakeHeader(ss, ssl_hs_certificate, len + 3);
+ rv = ssl3_AppendHandshakeHeader(ss, certificate, len + 3);
if (rv != SECSuccess) {
return rv;
}
@@ -9763,14 +10195,13 @@ ssl3_SendNewSessionTicket(sslSocket *ss)
SECStatus rv;
NewSessionTicket nticket = { 0 };
- rv = ssl3_EncodeSessionTicket(ss, &nticket, NULL, 0,
- ss->ssl3.pwSpec->masterSecret, &ticket);
+ rv = ssl3_EncodeSessionTicket(ss, &nticket, &ticket);
if (rv != SECSuccess)
goto loser;
/* Serialize the handshake message. Length =
* lifetime (4) + ticket length (2) + ticket. */
- rv = ssl3_AppendHandshakeHeader(ss, ssl_hs_new_session_ticket,
+ rv = ssl3_AppendHandshakeHeader(ss, new_session_ticket,
4 + 2 + ticket.len);
if (rv != SECSuccess)
goto loser;
@@ -9820,7 +10251,7 @@ ssl3_HandleNewSessionTicket(sslSocket *ss, PRUint8 *b, PRUint32 length)
* until it has verified the server's Finished message." See the comment in
* ssl3_FinishHandshake for more details.
*/
- ss->ssl3.hs.newSessionTicket.received_timestamp = ssl_TimeUsec();
+ ss->ssl3.hs.newSessionTicket.received_timestamp = PR_Now();
if (length < 4) {
(void)SSL3_SendAlert(ss, alert_fatal, decode_error);
PORT_SetError(SSL_ERROR_RX_MALFORMED_NEW_SESSION_TICKET);
@@ -9962,8 +10393,8 @@ ssl3_SendCertificate(sslSocket *ss)
if (isTLS13) {
contextLen = 1; /* Size of the context length */
if (!ss->sec.isServer) {
- PORT_Assert(ss->ssl3.hs.clientCertRequested);
- context = ss->xtnData.certReqContext;
+ PORT_Assert(ss->ssl3.hs.certificateRequest);
+ context = ss->ssl3.hs.certificateRequest->context;
contextLen += context.len;
}
}
@@ -9981,7 +10412,7 @@ ssl3_SendCertificate(sslSocket *ss)
}
}
- rv = ssl3_AppendHandshakeHeader(ss, ssl_hs_certificate,
+ rv = ssl3_AppendHandshakeHeader(ss, certificate,
contextLen + certChainLen + 3);
if (rv != SECSuccess) {
return rv; /* err set by AppendHandshake. */
@@ -10056,7 +10487,7 @@ ssl3_SendCertificateStatus(sslSocket *ss)
/* Use the array's first item only (single stapling) */
len = 1 + statusToSend->items[0].len + 3;
- rv = ssl3_AppendHandshakeHeader(ss, ssl_hs_certificate_status, len);
+ rv = ssl3_AppendHandshakeHeader(ss, certificate_status, len);
if (rv != SECSuccess) {
return rv; /* err set by AppendHandshake. */
}
@@ -10187,10 +10618,6 @@ ssl3_HandleCertificate(sslSocket *ss, PRUint8 *b, PRUint32 length)
return SECFailure;
}
- if (ss->sec.isServer) {
- dtls_ReceivedFirstMessageInFlight(ss);
- }
-
return ssl3_CompleteHandleCertificate(ss, b, length);
}
@@ -10410,8 +10837,7 @@ ssl3_AuthCertificate(sslSocket *ss)
}
if (pubKey) {
KeyType pubKeyType;
- PRUint32 minKey;
- PRInt32 optval;
+ PRInt32 minKey;
/* This partly fixes Bug 124230 and may cause problems for
* callers which depend on the old (wrong) behavior. */
ss->sec.authKeyBits = SECKEY_PublicKeyStrengthInBits(pubKey);
@@ -10422,29 +10848,29 @@ ssl3_AuthCertificate(sslSocket *ss)
case rsaPssKey:
case rsaOaepKey:
rv =
- NSS_OptionGet(NSS_RSA_MIN_KEY_SIZE, &optval);
- if (rv == SECSuccess && optval > 0) {
- minKey = (PRUint32)optval;
- } else {
- minKey = SSL_RSA_MIN_MODULUS_BITS;
+ NSS_OptionGet(NSS_RSA_MIN_KEY_SIZE, &minKey);
+ if (rv !=
+ SECSuccess) {
+ minKey =
+ SSL_RSA_MIN_MODULUS_BITS;
}
break;
case dsaKey:
rv =
- NSS_OptionGet(NSS_DSA_MIN_KEY_SIZE, &optval);
- if (rv == SECSuccess && optval > 0) {
- minKey = (PRUint32)optval;
- } else {
- minKey = SSL_DSA_MIN_P_BITS;
+ NSS_OptionGet(NSS_DSA_MIN_KEY_SIZE, &minKey);
+ if (rv !=
+ SECSuccess) {
+ minKey =
+ SSL_DSA_MIN_P_BITS;
}
break;
case dhKey:
rv =
- NSS_OptionGet(NSS_DH_MIN_KEY_SIZE, &optval);
- if (rv == SECSuccess && optval > 0) {
- minKey = (PRUint32)optval;
- } else {
- minKey = SSL_DH_MIN_P_BITS;
+ NSS_OptionGet(NSS_DH_MIN_KEY_SIZE, &minKey);
+ if (rv !=
+ SECSuccess) {
+ minKey =
+ SSL_DH_MIN_P_BITS;
}
break;
default:
@@ -10603,8 +11029,8 @@ ssl3_ComputeTLSFinished(sslSocket *ss, ssl3CipherSpec *spec,
PK11Context *prf_context;
unsigned int retLen;
- PORT_Assert(spec->masterSecret);
- if (!spec->masterSecret) {
+ PORT_Assert(spec->master_secret);
+ if (!spec->master_secret) {
PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
return SECFailure;
}
@@ -10619,7 +11045,7 @@ ssl3_ComputeTLSFinished(sslSocket *ss, ssl3CipherSpec *spec,
param.data = (unsigned char *)&tls_mac_params;
param.len = sizeof(tls_mac_params);
prf_context = PK11_CreateContextBySymKey(CKM_TLS_MAC, CKA_SIGN,
- spec->masterSecret, &param);
+ spec->master_secret, &param);
if (!prf_context)
return SECFailure;
@@ -10644,39 +11070,40 @@ ssl3_TLSPRFWithMasterSecret(sslSocket *ss, ssl3CipherSpec *spec,
const unsigned char *val, unsigned int valLen,
unsigned char *out, unsigned int outLen)
{
- SECItem param = { siBuffer, NULL, 0 };
- CK_MECHANISM_TYPE mech = CKM_TLS_PRF_GENERAL;
- PK11Context *prf_context;
- unsigned int retLen;
- SECStatus rv;
+ SECStatus rv = SECSuccess;
- if (!spec->masterSecret) {
- PORT_Assert(spec->masterSecret);
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
- }
+ if (spec->master_secret) {
+ SECItem param = { siBuffer, NULL, 0 };
+ CK_MECHANISM_TYPE mech = CKM_TLS_PRF_GENERAL;
+ PK11Context *prf_context;
+ unsigned int retLen;
- if (spec->version >= SSL_LIBRARY_VERSION_TLS_1_2) {
- /* Bug 1312976 non-SHA256 exporters are broken. */
- if (ssl3_GetPrfHashMechanism(ss) != CKM_SHA256) {
- PORT_Assert(0);
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
+ if (spec->version >= SSL_LIBRARY_VERSION_TLS_1_2) {
+ /* Bug 1312976 non-SHA256 exporters are broken. */
+ if (ssl3_GetPrfHashMechanism(ss) != CKM_SHA256) {
+ PORT_Assert(0);
+ PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
+ return SECFailure;
+ }
+ mech = CKM_NSS_TLS_PRF_GENERAL_SHA256;
}
- mech = CKM_NSS_TLS_PRF_GENERAL_SHA256;
- }
- prf_context = PK11_CreateContextBySymKey(mech, CKA_SIGN,
- spec->masterSecret, &param);
- if (!prf_context)
- return SECFailure;
+ prf_context = PK11_CreateContextBySymKey(mech, CKA_SIGN,
+ spec->master_secret, &param);
+ if (!prf_context)
+ return SECFailure;
- rv = PK11_DigestBegin(prf_context);
- rv |= PK11_DigestOp(prf_context, (unsigned char *)label, labelLen);
- rv |= PK11_DigestOp(prf_context, val, valLen);
- rv |= PK11_DigestFinal(prf_context, out, &retLen, outLen);
- PORT_Assert(rv != SECSuccess || retLen == outLen);
+ rv = PK11_DigestBegin(prf_context);
+ rv |= PK11_DigestOp(prf_context, (unsigned char *)label, labelLen);
+ rv |= PK11_DigestOp(prf_context, val, valLen);
+ rv |= PK11_DigestFinal(prf_context, out, &retLen, outLen);
+ PORT_Assert(rv != SECSuccess || retLen == outLen);
- PK11_DestroyContext(prf_context, PR_TRUE);
+ PK11_DestroyContext(prf_context, PR_TRUE);
+ } else {
+ PORT_Assert(spec->master_secret);
+ PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
+ rv = SECFailure;
+ }
return rv;
}
@@ -10700,7 +11127,7 @@ ssl3_SendNextProto(sslSocket *ss)
padding_len = 32 - ((ss->xtnData.nextProto.len + 2) % 32);
- rv = ssl3_AppendHandshakeHeader(ss, ssl_hs_next_proto, ss->xtnData.nextProto.len + 2 + padding_len);
+ rv = ssl3_AppendHandshakeHeader(ss, next_proto, ss->xtnData.nextProto.len + 2 + padding_len);
if (rv != SECSuccess) {
return rv; /* error code set by AppendHandshakeHeader */
}
@@ -10716,44 +11143,40 @@ ssl3_SendNextProto(sslSocket *ss)
return rv;
}
-/* called from ssl3_SendFinished and tls13_DeriveSecret.
+/* called from ssl3_SendFinished
*
* This function is simply a debugging aid and therefore does not return a
* SECStatus. */
-void
-ssl3_RecordKeyLog(sslSocket *ss, const char *label, PK11SymKey *secret)
+static void
+ssl3_RecordKeyLog(sslSocket *ss)
{
#ifdef NSS_ALLOW_SSLKEYLOGFILE
SECStatus rv;
SECItem *keyData;
- /* Longest label is "CLIENT_HANDSHAKE_TRAFFIC_SECRET", master secret is 48
- * bytes which happens to be the largest in TLS 1.3 as well (SHA384).
- * Maximum line length: "CLIENT_HANDSHAKE_TRAFFIC_SECRET" (31) + " " (1) +
- * client_random (32*2) + " " (1) +
- * traffic_secret (48*2) + "\n" (1) = 194. */
- char buf[200];
- unsigned int offset, len;
+ char buf[14 /* "CLIENT_RANDOM " */ +
+ SSL3_RANDOM_LENGTH * 2 /* client_random */ +
+ 1 /* " " */ +
+ 48 * 2 /* master secret */ +
+ 1 /* new line */];
+ unsigned int j;
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
if (!ssl_keylog_iob)
return;
- rv = PK11_ExtractKeyValue(secret);
+ rv = PK11_ExtractKeyValue(ss->ssl3.cwSpec->master_secret);
if (rv != SECSuccess)
return;
- /* keyData does not need to be freed. */
- keyData = PK11_GetKeyData(secret);
- if (!keyData || !keyData->data)
- return;
+ ssl_GetSpecReadLock(ss);
- len = strlen(label) + 1 + /* label + space */
- SSL3_RANDOM_LENGTH * 2 + 1 + /* client random (hex) + space */
- keyData->len * 2 + 1; /* secret (hex) + newline */
- PORT_Assert(len <= sizeof(buf));
- if (len > sizeof(buf))
+ /* keyData does not need to be freed. */
+ keyData = PK11_GetKeyData(ss->ssl3.cwSpec->master_secret);
+ if (!keyData || !keyData->data || keyData->len != 48) {
+ ssl_ReleaseSpecReadLock(ss);
return;
+ }
/* https://developer.mozilla.org/en/NSS_Key_Log_Format */
@@ -10761,22 +11184,23 @@ ssl3_RecordKeyLog(sslSocket *ss, const char *label, PK11SymKey *secret)
* keylog, so we have to do everything in a single call to
* fwrite. */
- strcpy(buf, label);
- offset = strlen(label);
- buf[offset++] += ' ';
- hexEncode(buf + offset, ss->ssl3.hs.client_random, SSL3_RANDOM_LENGTH);
- offset += SSL3_RANDOM_LENGTH * 2;
- buf[offset++] = ' ';
- hexEncode(buf + offset, keyData->data, keyData->len);
- offset += keyData->len * 2;
- buf[offset++] = '\n';
-
- PORT_Assert(offset == len);
-
- PZ_Lock(ssl_keylog_lock);
- if (fwrite(buf, len, 1, ssl_keylog_iob) == 1)
- fflush(ssl_keylog_iob);
- PZ_Unlock(ssl_keylog_lock);
+ memcpy(buf, "CLIENT_RANDOM ", 14);
+ j = 14;
+ hexEncode(buf + j, ss->ssl3.hs.client_random.rand, SSL3_RANDOM_LENGTH);
+ j += SSL3_RANDOM_LENGTH * 2;
+ buf[j++] = ' ';
+ hexEncode(buf + j, keyData->data, 48);
+ j += 48 * 2;
+ buf[j++] = '\n';
+
+ PORT_Assert(j == sizeof(buf));
+
+ ssl_ReleaseSpecReadLock(ss);
+
+ if (fwrite(buf, sizeof(buf), 1, ssl_keylog_iob) != 1)
+ return;
+ fflush(ssl_keylog_iob);
+ return;
#endif
}
@@ -10818,7 +11242,7 @@ ssl3_SendFinished(sslSocket *ss, PRInt32 flags)
else
ss->ssl3.hs.finishedMsgs.tFinished[0] = tlsFinished;
ss->ssl3.hs.finishedBytes = sizeof tlsFinished;
- rv = ssl3_AppendHandshakeHeader(ss, ssl_hs_finished, sizeof tlsFinished);
+ rv = ssl3_AppendHandshakeHeader(ss, finished, sizeof tlsFinished);
if (rv != SECSuccess)
goto fail; /* err set by AppendHandshake. */
rv = ssl3_AppendHandshake(ss, &tlsFinished, sizeof tlsFinished);
@@ -10831,7 +11255,7 @@ ssl3_SendFinished(sslSocket *ss, PRInt32 flags)
ss->ssl3.hs.finishedMsgs.sFinished[0] = hashes.u.s;
PORT_Assert(hashes.len == sizeof hashes.u.s);
ss->ssl3.hs.finishedBytes = sizeof hashes.u.s;
- rv = ssl3_AppendHandshakeHeader(ss, ssl_hs_finished, sizeof hashes.u.s);
+ rv = ssl3_AppendHandshakeHeader(ss, finished, sizeof hashes.u.s);
if (rv != SECSuccess)
goto fail; /* err set by AppendHandshake. */
rv = ssl3_AppendHandshake(ss, &hashes.u.s, sizeof hashes.u.s);
@@ -10843,7 +11267,7 @@ ssl3_SendFinished(sslSocket *ss, PRInt32 flags)
goto fail; /* error code set by ssl3_FlushHandshake */
}
- ssl3_RecordKeyLog(ss, "CLIENT_RANDOM", ss->ssl3.cwSpec->masterSecret);
+ ssl3_RecordKeyLog(ss);
return SECSuccess;
@@ -10855,8 +11279,8 @@ fail:
* Caller holds the Spec read lock.
*/
SECStatus
-ssl3_CacheWrappedSecret(sslSocket *ss, sslSessionID *sid,
- PK11SymKey *secret)
+ssl3_CacheWrappedMasterSecret(sslSocket *ss, sslSessionID *sid,
+ ssl3CipherSpec *spec)
{
PK11SymKey *wrappingKey = NULL;
PK11SlotInfo *symKeySlot;
@@ -10865,7 +11289,7 @@ ssl3_CacheWrappedSecret(sslSocket *ss, sslSessionID *sid,
PRBool isServer = ss->sec.isServer;
CK_MECHANISM_TYPE mechanism = CKM_INVALID_MECHANISM;
- symKeySlot = PK11_GetSlotFromKey(secret);
+ symKeySlot = PK11_GetSlotFromKey(spec->master_secret);
if (!isServer) {
int wrapKeyIndex;
int incarnation;
@@ -10926,7 +11350,7 @@ ssl3_CacheWrappedSecret(sslSocket *ss, sslSessionID *sid,
wmsItem.data = sid->u.ssl3.keys.wrapped_master_secret;
wmsItem.len = sizeof sid->u.ssl3.keys.wrapped_master_secret;
rv = PK11_WrapSymKey(mechanism, NULL, wrappingKey,
- secret, &wmsItem);
+ spec->master_secret, &wmsItem);
/* rv is examined below. */
sid->u.ssl3.keys.wrapped_master_secret_len = wmsItem.len;
PK11_FreeSymKey(wrappingKey);
@@ -10939,13 +11363,13 @@ ssl3_CacheWrappedSecret(sslSocket *ss, sslSessionID *sid,
* Caller must hold Handshake and RecvBuf locks.
*/
static SECStatus
-ssl3_HandleFinished(sslSocket *ss, PRUint8 *b, PRUint32 length)
+ssl3_HandleFinished(sslSocket *ss, PRUint8 *b, PRUint32 length,
+ const SSL3Hashes *hashes)
{
sslSessionID *sid = ss->sec.ci.sid;
SECStatus rv = SECSuccess;
PRBool isServer = ss->sec.isServer;
PRBool isTLS;
- SSL3Hashes hashes;
PORT_Assert(ss->opt.noLocks || ssl_HaveRecvBufLock(ss));
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
@@ -10959,23 +11383,13 @@ ssl3_HandleFinished(sslSocket *ss, PRUint8 *b, PRUint32 length)
return SECFailure;
}
- if (!ss->sec.isServer || !ss->opt.requestCertificate) {
- dtls_ReceivedFirstMessageInFlight(ss);
- }
-
- rv = ssl3_ComputeHandshakeHashes(ss, ss->ssl3.crSpec, &hashes,
- isServer ? sender_client : sender_server);
- if (rv != SECSuccess) {
+ if (!hashes) {
+ PORT_Assert(0);
+ SSL3_SendAlert(ss, alert_fatal, internal_error);
PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
return SECFailure;
}
- rv = ssl_HashHandshakeMessage(ss, ssl_hs_finished, b, length);
- if (rv != SECSuccess) {
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return rv;
- }
-
isTLS = (PRBool)(ss->ssl3.crSpec->version > SSL_LIBRARY_VERSION_3_0);
if (isTLS) {
TLSFinished tlsFinished;
@@ -10988,7 +11402,7 @@ ssl3_HandleFinished(sslSocket *ss, PRUint8 *b, PRUint32 length)
#endif
}
rv = ssl3_ComputeTLSFinished(ss, ss->ssl3.crSpec, !isServer,
- &hashes, &tlsFinished);
+ hashes, &tlsFinished);
if (!isServer)
ss->ssl3.hs.finishedMsgs.tFinished[1] = tlsFinished;
else
@@ -11011,12 +11425,12 @@ ssl3_HandleFinished(sslSocket *ss, PRUint8 *b, PRUint32 length)
}
if (!isServer)
- ss->ssl3.hs.finishedMsgs.sFinished[1] = hashes.u.s;
+ ss->ssl3.hs.finishedMsgs.sFinished[1] = hashes->u.s;
else
- ss->ssl3.hs.finishedMsgs.sFinished[0] = hashes.u.s;
- PORT_Assert(hashes.len == sizeof hashes.u.s);
- ss->ssl3.hs.finishedBytes = sizeof hashes.u.s;
- if (0 != NSS_SecureMemcmp(&hashes.u.s, b, length)) {
+ ss->ssl3.hs.finishedMsgs.sFinished[0] = hashes->u.s;
+ PORT_Assert(hashes->len == sizeof hashes->u.s);
+ ss->ssl3.hs.finishedBytes = sizeof hashes->u.s;
+ if (0 != NSS_SecureMemcmp(&hashes->u.s, b, length)) {
(void)ssl3_HandshakeFailure(ss);
PORT_SetError(SSL_ERROR_BAD_HANDSHAKE_HASH_VALUE);
return SECFailure;
@@ -11086,7 +11500,7 @@ xmit_loser:
}
if (sid->cached == never_cached && !ss->opt.noCache) {
- rv = ssl3_FillInCachedSID(ss, sid, ss->ssl3.crSpec->masterSecret);
+ rv = ssl3_FillInCachedSID(ss, sid);
/* If the wrap failed, we don't cache the sid.
* The connection continues normally however.
@@ -11110,26 +11524,21 @@ xmit_loser:
}
SECStatus
-ssl3_FillInCachedSID(sslSocket *ss, sslSessionID *sid, PK11SymKey *secret)
+ssl3_FillInCachedSID(sslSocket *ss, sslSessionID *sid)
{
- PORT_Assert(secret);
+ SECStatus rv;
/* fill in the sid */
sid->u.ssl3.cipherSuite = ss->ssl3.hs.cipher_suite;
+ sid->u.ssl3.compression = ss->ssl3.hs.compression;
sid->u.ssl3.policy = ss->ssl3.policy;
sid->version = ss->version;
sid->authType = ss->sec.authType;
sid->authKeyBits = ss->sec.authKeyBits;
sid->keaType = ss->sec.keaType;
sid->keaKeyBits = ss->sec.keaKeyBits;
- if (ss->sec.keaGroup) {
- sid->keaGroup = ss->sec.keaGroup->name;
- } else {
- sid->keaGroup = ssl_grp_none;
- }
- sid->sigScheme = ss->sec.signatureScheme;
- sid->lastAccessTime = sid->creationTime = ssl_TimeUsec();
- sid->expirationTime = sid->creationTime + ssl3_sid_timeout * PR_USEC_PER_SEC;
+ sid->lastAccessTime = sid->creationTime = ssl_Time();
+ sid->expirationTime = sid->creationTime + ssl3_sid_timeout;
sid->localCert = CERT_DupCertificate(ss->sec.localCert);
if (ss->sec.isServer) {
sid->namedCurve = ss->sec.serverCert->namedCurve;
@@ -11143,8 +11552,25 @@ ssl3_FillInCachedSID(sslSocket *ss, sslSessionID *sid, PK11SymKey *secret)
}
}
+ ssl_GetSpecReadLock(ss); /*************************************/
+
/* Copy the master secret (wrapped or unwrapped) into the sid */
- return ssl3_CacheWrappedSecret(ss, ss->sec.ci.sid, secret);
+ if (ss->ssl3.crSpec->msItem.len && ss->ssl3.crSpec->msItem.data) {
+ sid->u.ssl3.keys.wrapped_master_secret_len =
+ ss->ssl3.crSpec->msItem.len;
+ memcpy(sid->u.ssl3.keys.wrapped_master_secret,
+ ss->ssl3.crSpec->msItem.data, ss->ssl3.crSpec->msItem.len);
+ sid->u.ssl3.masterValid = PR_TRUE;
+ sid->u.ssl3.keys.msIsWrapped = PR_FALSE;
+ rv = SECSuccess;
+ } else {
+ rv = ssl3_CacheWrappedMasterSecret(ss, ss->sec.ci.sid,
+ ss->ssl3.crSpec);
+ sid->u.ssl3.keys.msIsWrapped = PR_TRUE;
+ }
+ ssl_ReleaseSpecReadLock(ss); /*************************************/
+
+ return rv;
}
/* The return type is SECStatus instead of void because this function needs
@@ -11193,66 +11619,8 @@ ssl3_FinishHandshake(sslSocket *ss)
return SECSuccess;
}
-SECStatus
-ssl_HashHandshakeMessageInt(sslSocket *ss, SSLHandshakeType type,
- PRUint32 dtlsSeq,
- const PRUint8 *b, PRUint32 length)
-{
- PRUint8 hdr[4];
- PRUint8 dtlsData[8];
- SECStatus rv;
-
- PRINT_BUF(50, (ss, "Hash handshake message:", b, length));
-
- hdr[0] = (PRUint8)type;
- hdr[1] = (PRUint8)(length >> 16);
- hdr[2] = (PRUint8)(length >> 8);
- hdr[3] = (PRUint8)(length);
-
- rv = ssl3_UpdateHandshakeHashes(ss, (unsigned char *)hdr, 4);
- if (rv != SECSuccess)
- return rv; /* err code already set. */
-
- /* Extra data to simulate a complete DTLS handshake fragment */
- if (IS_DTLS(ss)) {
- /* Sequence number */
- dtlsData[0] = MSB(dtlsSeq);
- dtlsData[1] = LSB(dtlsSeq);
-
- /* Fragment offset */
- dtlsData[2] = 0;
- dtlsData[3] = 0;
- dtlsData[4] = 0;
-
- /* Fragment length */
- dtlsData[5] = (PRUint8)(length >> 16);
- dtlsData[6] = (PRUint8)(length >> 8);
- dtlsData[7] = (PRUint8)(length);
-
- rv = ssl3_UpdateHandshakeHashes(ss, (unsigned char *)dtlsData,
- sizeof(dtlsData));
- if (rv != SECSuccess)
- return rv; /* err code already set. */
- }
-
- /* The message body */
- rv = ssl3_UpdateHandshakeHashes(ss, b, length);
- if (rv != SECSuccess)
- return rv; /* err code already set. */
-
- return SECSuccess;
-}
-
-SECStatus
-ssl_HashHandshakeMessage(sslSocket *ss, SSLHandshakeType type,
- const PRUint8 *b, PRUint32 length)
-{
- return ssl_HashHandshakeMessageInt(ss, type, ss->ssl3.hs.recvMessageSeq,
- b, length);
-}
-
/* Called from ssl3_HandleHandshake() when it has gathered a complete ssl3
- * handshake message.
+ * hanshake message.
* Caller must hold Handshake and RecvBuf locks.
*/
SECStatus
@@ -11260,43 +11628,130 @@ ssl3_HandleHandshakeMessage(sslSocket *ss, PRUint8 *b, PRUint32 length,
PRBool endOfRecord)
{
SECStatus rv = SECSuccess;
+ SSL3HandshakeType type = ss->ssl3.hs.msg_type;
+ SSL3Hashes hashes; /* computed hashes are put here. */
+ SSL3Hashes *hashesPtr = NULL; /* Set when hashes are computed */
+ PRUint8 hdr[4];
+ PRUint8 dtlsData[8];
+ PRBool computeHashes = PR_FALSE;
PRUint16 epoch;
PORT_Assert(ss->opt.noLocks || ssl_HaveRecvBufLock(ss));
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
+ /*
+ * We have to compute the hashes before we update them with the
+ * current message.
+ */
+ if (ss->version < SSL_LIBRARY_VERSION_TLS_1_3) {
+ if ((type == finished) && (ss->ssl3.hs.ws == wait_finished)) {
+ computeHashes = PR_TRUE;
+ } else if ((type == certificate_verify) && (ss->ssl3.hs.ws == wait_cert_verify)) {
+ if (ss->ssl3.hs.hashType == handshake_hash_record) {
+ /* We cannot compute the hash yet. We must wait until we have
+ * decoded the certificate_verify message in
+ * ssl3_HandleCertificateVerify, which will tell us which
+ * hash function we must use.
+ *
+ * (ssl3_HandleCertificateVerify cannot simply look at the
+ * buffer length itself, because at the time we reach it,
+ * additional handshake messages will have been added to the
+ * buffer, e.g. the certificate_verify message itself.)
+ *
+ * Therefore, we use SSL3Hashes.u.transcriptLen to save how much
+ * data there is and read directly from ss->ssl3.hs.messages
+ * when calculating the hashes.
+ *
+ * ssl3_HandleCertificateVerify will detect
+ * hashType == handshake_hash_record
+ * and use that information to calculate the hash.
+ */
+ hashes.u.transcriptLen = ss->ssl3.hs.messages.len;
+ hashesPtr = &hashes;
+ } else {
+ computeHashes = PR_TRUE;
+ }
+ }
+ } else {
+ if (type == certificate_verify) {
+ computeHashes = TLS13_IN_HS_STATE(ss, wait_cert_verify);
+ } else if (type == finished) {
+ computeHashes =
+ TLS13_IN_HS_STATE(ss, wait_cert_request, wait_finished);
+ }
+ }
+ ssl_GetSpecReadLock(ss); /************************************/
+ if (computeHashes) {
+ SSL3Sender sender = (SSL3Sender)0;
+ ssl3CipherSpec *rSpec = ss->version >= SSL_LIBRARY_VERSION_TLS_1_3 ? ss->ssl3.crSpec
+ : ss->ssl3.prSpec;
+
+ if (type == finished) {
+ sender = ss->sec.isServer ? sender_client : sender_server;
+ rSpec = ss->ssl3.crSpec;
+ }
+ rv = ssl3_ComputeHandshakeHashes(ss, rSpec, &hashes, sender);
+ if (rv == SECSuccess) {
+ hashesPtr = &hashes;
+ }
+ }
+ ssl_ReleaseSpecReadLock(ss); /************************************/
+ if (rv != SECSuccess) {
+ return rv; /* error code was set by ssl3_ComputeHandshakeHashes*/
+ }
SSL_TRC(30, ("%d: SSL3[%d]: handle handshake message: %s", SSL_GETPID(),
ss->fd, ssl3_DecodeHandshakeType(ss->ssl3.hs.msg_type)));
- /* Start new handshake hashes when we start a new handshake. */
- if (ss->ssl3.hs.msg_type == ssl_hs_client_hello) {
+ hdr[0] = (PRUint8)ss->ssl3.hs.msg_type;
+ hdr[1] = (PRUint8)(length >> 16);
+ hdr[2] = (PRUint8)(length >> 8);
+ hdr[3] = (PRUint8)(length);
+
+ /* Start new handshake hashes when we start a new handshake. Unless this is
+ * TLS 1.3 and we sent a HelloRetryRequest. */
+ if (ss->ssl3.hs.msg_type == client_hello && !ss->ssl3.hs.helloRetry) {
ssl3_RestartHandshakeHashes(ss);
}
- switch (ss->ssl3.hs.msg_type) {
- case ssl_hs_hello_request:
- case ssl_hs_hello_verify_request:
- /* We don't include hello_request and hello_verify_request messages
- * in the handshake hashes */
- break;
+ /* We should not include hello_request and hello_verify_request messages
+ * in the handshake hashes */
+ if ((ss->ssl3.hs.msg_type != hello_request) &&
+ (ss->ssl3.hs.msg_type != hello_verify_request)) {
+ rv = ssl3_UpdateHandshakeHashes(ss, (unsigned char *)hdr, 4);
+ if (rv != SECSuccess)
+ return rv; /* err code already set. */
- /* Defer hashing of these messages until the message handlers. */
- case ssl_hs_client_hello:
- case ssl_hs_server_hello:
- case ssl_hs_certificate_verify:
- case ssl_hs_finished:
- break;
+ /* Extra data to simulate a complete DTLS handshake fragment */
+ if (IS_DTLS(ss)) {
+ /* Sequence number */
+ dtlsData[0] = MSB(ss->ssl3.hs.recvMessageSeq);
+ dtlsData[1] = LSB(ss->ssl3.hs.recvMessageSeq);
- default:
- rv = ssl_HashHandshakeMessage(ss, ss->ssl3.hs.msg_type, b, length);
- if (rv != SECSuccess) {
- return SECFailure;
- }
+ /* Fragment offset */
+ dtlsData[2] = 0;
+ dtlsData[3] = 0;
+ dtlsData[4] = 0;
+
+ /* Fragment length */
+ dtlsData[5] = (PRUint8)(length >> 16);
+ dtlsData[6] = (PRUint8)(length >> 8);
+ dtlsData[7] = (PRUint8)(length);
+
+ rv = ssl3_UpdateHandshakeHashes(ss, (unsigned char *)dtlsData,
+ sizeof(dtlsData));
+ if (rv != SECSuccess)
+ return rv; /* err code already set. */
+ }
+
+ /* The message body */
+ rv = ssl3_UpdateHandshakeHashes(ss, b, length);
+ if (rv != SECSuccess)
+ return rv; /* err code already set. */
}
PORT_SetError(0); /* each message starts with no error. */
if (ss->ssl3.hs.ws == wait_certificate_status &&
- ss->ssl3.hs.msg_type != ssl_hs_certificate_status) {
+ ss->ssl3.hs.msg_type != certificate_status) {
/* If we negotiated the certificate_status extension then we deferred
* certificate validation until we get the CertificateStatus messsage.
* But the CertificateStatus message is optional. If the server did
@@ -11313,7 +11768,7 @@ ssl3_HandleHandshakeMessage(sslSocket *ss, PRUint8 *b, PRUint32 length,
epoch = ss->ssl3.crSpec->epoch;
switch (ss->ssl3.hs.msg_type) {
- case ssl_hs_client_hello:
+ case client_hello:
if (!ss->sec.isServer) {
(void)SSL3_SendAlert(ss, alert_fatal, unexpected_message);
PORT_SetError(SSL_ERROR_RX_UNEXPECTED_CLIENT_HELLO);
@@ -11321,7 +11776,7 @@ ssl3_HandleHandshakeMessage(sslSocket *ss, PRUint8 *b, PRUint32 length,
}
rv = ssl3_HandleClientHello(ss, b, length);
break;
- case ssl_hs_server_hello:
+ case server_hello:
if (ss->sec.isServer) {
(void)SSL3_SendAlert(ss, alert_fatal, unexpected_message);
PORT_SetError(SSL_ERROR_RX_UNEXPECTED_SERVER_HELLO);
@@ -11331,9 +11786,10 @@ ssl3_HandleHandshakeMessage(sslSocket *ss, PRUint8 *b, PRUint32 length,
break;
default:
if (ss->version < SSL_LIBRARY_VERSION_TLS_1_3) {
- rv = ssl3_HandlePostHelloHandshakeMessage(ss, b, length);
+ rv = ssl3_HandlePostHelloHandshakeMessage(ss, b, length, hashesPtr);
} else {
- rv = tls13_HandlePostHelloHandshakeMessage(ss, b, length);
+ rv = tls13_HandlePostHelloHandshakeMessage(ss, b, length,
+ hashesPtr);
}
break;
}
@@ -11355,13 +11811,13 @@ ssl3_HandleHandshakeMessage(sslSocket *ss, PRUint8 *b, PRUint32 length,
static SECStatus
ssl3_HandlePostHelloHandshakeMessage(sslSocket *ss, PRUint8 *b,
- PRUint32 length)
+ PRUint32 length, SSL3Hashes *hashesPtr)
{
SECStatus rv;
PORT_Assert(ss->version < SSL_LIBRARY_VERSION_TLS_1_3);
switch (ss->ssl3.hs.msg_type) {
- case ssl_hs_hello_request:
+ case hello_request:
if (length != 0) {
(void)ssl3_DecodeError(ss);
PORT_SetError(SSL_ERROR_RX_MALFORMED_HELLO_REQUEST);
@@ -11375,7 +11831,13 @@ ssl3_HandlePostHelloHandshakeMessage(sslSocket *ss, PRUint8 *b,
rv = ssl3_HandleHelloRequest(ss);
break;
- case ssl_hs_hello_verify_request:
+ case hello_retry_request:
+ /* This arrives here because - as a client - we haven't received a
+ * final decision on the version from the server. */
+ rv = tls13_HandleHelloRetryRequest(ss, b, length);
+ break;
+
+ case hello_verify_request:
if (!IS_DTLS(ss) || ss->sec.isServer) {
(void)SSL3_SendAlert(ss, alert_fatal, unexpected_message);
PORT_SetError(SSL_ERROR_RX_UNEXPECTED_HELLO_VERIFY_REQUEST);
@@ -11383,13 +11845,13 @@ ssl3_HandlePostHelloHandshakeMessage(sslSocket *ss, PRUint8 *b,
}
rv = dtls_HandleHelloVerifyRequest(ss, b, length);
break;
- case ssl_hs_certificate:
+ case certificate:
rv = ssl3_HandleCertificate(ss, b, length);
break;
- case ssl_hs_certificate_status:
+ case certificate_status:
rv = ssl3_HandleCertificateStatus(ss, b, length);
break;
- case ssl_hs_server_key_exchange:
+ case server_key_exchange:
if (ss->sec.isServer) {
(void)SSL3_SendAlert(ss, alert_fatal, unexpected_message);
PORT_SetError(SSL_ERROR_RX_UNEXPECTED_SERVER_KEY_EXCH);
@@ -11397,7 +11859,7 @@ ssl3_HandlePostHelloHandshakeMessage(sslSocket *ss, PRUint8 *b,
}
rv = ssl3_HandleServerKeyExchange(ss, b, length);
break;
- case ssl_hs_certificate_request:
+ case certificate_request:
if (ss->sec.isServer) {
(void)SSL3_SendAlert(ss, alert_fatal, unexpected_message);
PORT_SetError(SSL_ERROR_RX_UNEXPECTED_CERT_REQUEST);
@@ -11405,7 +11867,7 @@ ssl3_HandlePostHelloHandshakeMessage(sslSocket *ss, PRUint8 *b,
}
rv = ssl3_HandleCertificateRequest(ss, b, length);
break;
- case ssl_hs_server_hello_done:
+ case server_hello_done:
if (length != 0) {
(void)ssl3_DecodeError(ss);
PORT_SetError(SSL_ERROR_RX_MALFORMED_HELLO_DONE);
@@ -11418,15 +11880,15 @@ ssl3_HandlePostHelloHandshakeMessage(sslSocket *ss, PRUint8 *b,
}
rv = ssl3_HandleServerHelloDone(ss);
break;
- case ssl_hs_certificate_verify:
+ case certificate_verify:
if (!ss->sec.isServer) {
(void)SSL3_SendAlert(ss, alert_fatal, unexpected_message);
PORT_SetError(SSL_ERROR_RX_UNEXPECTED_CERT_VERIFY);
return SECFailure;
}
- rv = ssl3_HandleCertificateVerify(ss, b, length);
+ rv = ssl3_HandleCertificateVerify(ss, b, length, hashesPtr);
break;
- case ssl_hs_client_key_exchange:
+ case client_key_exchange:
if (!ss->sec.isServer) {
(void)SSL3_SendAlert(ss, alert_fatal, unexpected_message);
PORT_SetError(SSL_ERROR_RX_UNEXPECTED_CLIENT_KEY_EXCH);
@@ -11434,7 +11896,7 @@ ssl3_HandlePostHelloHandshakeMessage(sslSocket *ss, PRUint8 *b,
}
rv = ssl3_HandleClientKeyExchange(ss, b, length);
break;
- case ssl_hs_new_session_ticket:
+ case new_session_ticket:
if (ss->sec.isServer) {
(void)SSL3_SendAlert(ss, alert_fatal, unexpected_message);
PORT_SetError(SSL_ERROR_RX_UNEXPECTED_NEW_SESSION_TICKET);
@@ -11442,8 +11904,8 @@ ssl3_HandlePostHelloHandshakeMessage(sslSocket *ss, PRUint8 *b,
}
rv = ssl3_HandleNewSessionTicket(ss, b, length);
break;
- case ssl_hs_finished:
- rv = ssl3_HandleFinished(ss, b, length);
+ case finished:
+ rv = ssl3_HandleFinished(ss, b, length, hashesPtr);
break;
default:
(void)SSL3_SendAlert(ss, alert_fatal, unexpected_message);
@@ -11484,7 +11946,7 @@ ssl3_HandleHandshake(sslSocket *ss, sslBuffer *origBuf)
t = *(buf->buf++);
buf->len--;
if (ss->ssl3.hs.header_bytes++ == 0)
- ss->ssl3.hs.msg_type = (SSLHandshakeType)t;
+ ss->ssl3.hs.msg_type = (SSL3HandshakeType)t;
else
ss->ssl3.hs.msg_len = (ss->ssl3.hs.msg_len << 8) + t;
if (ss->ssl3.hs.header_bytes < 4)
@@ -11814,34 +12276,31 @@ ssl_CBCExtractMAC(sslBuffer *plaintext,
*
*/
static SECStatus
-ssl3_UnprotectRecord(sslSocket *ss,
- ssl3CipherSpec *spec,
- SSL3Ciphertext *cText, sslBuffer *plaintext,
+ssl3_UnprotectRecord(sslSocket *ss, SSL3Ciphertext *cText, sslBuffer *plaintext,
SSL3AlertDescription *alert)
{
- const ssl3BulkCipherDef *cipher_def = spec->cipherDef;
+ ssl3CipherSpec *crSpec = ss->ssl3.crSpec;
+ const ssl3BulkCipherDef *cipher_def = crSpec->cipher_def;
PRBool isTLS;
unsigned int good;
unsigned int ivLen = 0;
SSL3ContentType rType;
unsigned int minLength;
unsigned int originalLen = 0;
- PRUint8 headerBuf[13];
- sslBuffer header = SSL_BUFFER(headerBuf);
+ unsigned char header[13];
+ unsigned int headerLen;
PRUint8 hash[MAX_MAC_LENGTH];
PRUint8 givenHashBuf[MAX_MAC_LENGTH];
PRUint8 *givenHash;
unsigned int hashBytes = MAX_MAC_LENGTH + 1;
SECStatus rv;
- PORT_Assert(spec->direction == CipherSpecRead);
-
good = ~0U;
- minLength = spec->macDef->mac_size;
+ minLength = crSpec->mac_size;
if (cipher_def->type == type_block) {
/* CBC records have a padding length byte at the end. */
minLength++;
- if (spec->version >= SSL_LIBRARY_VERSION_TLS_1_1) {
+ if (crSpec->version >= SSL_LIBRARY_VERSION_TLS_1_1) {
/* With >= TLS 1.1, CBC records have an explicit IV. */
minLength += cipher_def->iv_size;
}
@@ -11856,7 +12315,7 @@ ssl3_UnprotectRecord(sslSocket *ss,
}
if (cipher_def->type == type_block &&
- spec->version >= SSL_LIBRARY_VERSION_TLS_1_1) {
+ crSpec->version >= SSL_LIBRARY_VERSION_TLS_1_1) {
/* Consume the per-record explicit IV. RFC 4346 Section 6.2.3.2 states
* "The receiver decrypts the entire GenericBlockCipher structure and
* then discards the first cipher block corresponding to the IV
@@ -11879,8 +12338,8 @@ ssl3_UnprotectRecord(sslSocket *ss,
* the block it doesn't matter. The decryption of the next block
* depends only on the ciphertext of the IV block.
*/
- rv = spec->cipher(spec->cipherContext, iv, &decoded,
- sizeof(iv), cText->buf->buf, ivLen);
+ rv = crSpec->decode(crSpec->decodeContext, iv, &decoded,
+ sizeof(iv), cText->buf->buf, ivLen);
good &= SECStatusToMask(rv);
}
@@ -11888,7 +12347,7 @@ ssl3_UnprotectRecord(sslSocket *ss,
PRINT_BUF(80, (ss, "ciphertext:", cText->buf->buf + ivLen,
cText->buf->len - ivLen));
- isTLS = (PRBool)(spec->version > SSL_LIBRARY_VERSION_3_0);
+ isTLS = (PRBool)(crSpec->version > SSL_LIBRARY_VERSION_3_0);
if (isTLS && cText->buf->len - ivLen > (MAX_FRAGMENT_LENGTH + 2048)) {
*alert = record_overflow;
@@ -11905,18 +12364,19 @@ ssl3_UnprotectRecord(sslSocket *ss,
unsigned int decryptedLen =
cText->buf->len - cipher_def->explicit_nonce_size -
cipher_def->tag_size;
- rv = ssl3_BuildRecordPseudoHeader(
- spec->epoch, IS_DTLS(ss) ? cText->seq_num : spec->seqNum,
- rType, isTLS, cText->version, IS_DTLS(ss), decryptedLen, &header);
- PORT_Assert(rv == SECSuccess);
- rv = spec->aead(&spec->keyMaterial,
- PR_TRUE, /* do decrypt */
- plaintext->buf, /* out */
- (int *)&plaintext->len, /* outlen */
- plaintext->space, /* maxout */
- cText->buf->buf, /* in */
- cText->buf->len, /* inlen */
- SSL_BUFFER_BASE(&header), SSL_BUFFER_LEN(&header));
+ headerLen = ssl3_BuildRecordPseudoHeader(
+ header, IS_DTLS(ss) ? cText->seq_num : crSpec->read_seq_num,
+ rType, isTLS, cText->version, IS_DTLS(ss), decryptedLen);
+ PORT_Assert(headerLen <= sizeof(header));
+ rv = crSpec->aead(
+ ss->sec.isServer ? &crSpec->client : &crSpec->server,
+ PR_TRUE, /* do decrypt */
+ plaintext->buf, /* out */
+ (int *)&plaintext->len, /* outlen */
+ plaintext->space, /* maxout */
+ cText->buf->buf, /* in */
+ cText->buf->len, /* inlen */
+ header, headerLen);
if (rv != SECSuccess) {
good = 0;
}
@@ -11927,8 +12387,8 @@ ssl3_UnprotectRecord(sslSocket *ss,
}
/* decrypt from cText buf to plaintext. */
- rv = spec->cipher(
- spec->cipherContext, plaintext->buf, (int *)&plaintext->len,
+ rv = crSpec->decode(
+ crSpec->decodeContext, plaintext->buf, (int *)&plaintext->len,
plaintext->space, cText->buf->buf + ivLen, cText->buf->len - ivLen);
if (rv != SECSuccess) {
goto decrypt_loser;
@@ -11941,7 +12401,7 @@ ssl3_UnprotectRecord(sslSocket *ss,
/* If it's a block cipher, check and strip the padding. */
if (cipher_def->type == type_block) {
const unsigned int blockSize = cipher_def->block_size;
- const unsigned int macSize = spec->macDef->mac_size;
+ const unsigned int macSize = crSpec->mac_size;
if (!isTLS) {
good &= SECStatusToMask(ssl_RemoveSSLv3CBCPadding(
@@ -11953,32 +12413,32 @@ ssl3_UnprotectRecord(sslSocket *ss,
}
/* compute the MAC */
- rv = ssl3_BuildRecordPseudoHeader(
- spec->epoch, IS_DTLS(ss) ? cText->seq_num : spec->seqNum,
+ headerLen = ssl3_BuildRecordPseudoHeader(
+ header, IS_DTLS(ss) ? cText->seq_num : crSpec->read_seq_num,
rType, isTLS, cText->version, IS_DTLS(ss),
- plaintext->len - spec->macDef->mac_size, &header);
- PORT_Assert(rv == SECSuccess);
+ plaintext->len - crSpec->mac_size);
+ PORT_Assert(headerLen <= sizeof(header));
if (cipher_def->type == type_block) {
rv = ssl3_ComputeRecordMACConstantTime(
- spec, SSL_BUFFER_BASE(&header), SSL_BUFFER_LEN(&header),
+ crSpec, (PRBool)(!ss->sec.isServer), header, headerLen,
plaintext->buf, plaintext->len, originalLen,
hash, &hashBytes);
ssl_CBCExtractMAC(plaintext, originalLen, givenHashBuf,
- spec->macDef->mac_size);
+ crSpec->mac_size);
givenHash = givenHashBuf;
/* plaintext->len will always have enough space to remove the MAC
* because in ssl_Remove{SSLv3|TLS}CBCPadding we only adjust
* plaintext->len if the result has enough space for the MAC and we
* tested the unadjusted size against minLength, above. */
- plaintext->len -= spec->macDef->mac_size;
+ plaintext->len -= crSpec->mac_size;
} else {
/* This is safe because we checked the minLength above. */
- plaintext->len -= spec->macDef->mac_size;
+ plaintext->len -= crSpec->mac_size;
rv = ssl3_ComputeRecordMAC(
- spec, SSL_BUFFER_BASE(&header), SSL_BUFFER_LEN(&header),
+ crSpec, (PRBool)(!ss->sec.isServer), header, headerLen,
plaintext->buf, plaintext->len, hash, &hashBytes);
/* We can read the MAC directly from the record because its location
@@ -11988,8 +12448,8 @@ ssl3_UnprotectRecord(sslSocket *ss,
good &= SECStatusToMask(rv);
- if (hashBytes != (unsigned)spec->macDef->mac_size ||
- NSS_SecureMemcmp(givenHash, hash, spec->macDef->mac_size) != 0) {
+ if (hashBytes != (unsigned)crSpec->mac_size ||
+ NSS_SecureMemcmp(givenHash, hash, crSpec->mac_size) != 0) {
/* We're allowed to leak whether or not the MAC check was correct */
good = 0;
}
@@ -12005,84 +12465,7 @@ ssl3_UnprotectRecord(sslSocket *ss,
return SECSuccess;
}
-static SECStatus
-ssl3_HandleNonApplicationData(sslSocket *ss, SSL3ContentType rType,
- DTLSEpoch epoch, sslSequenceNumber seqNum,
- sslBuffer *databuf)
-{
- SECStatus rv;
-
- ssl_GetSSL3HandshakeLock(ss);
-
- /* All the functions called in this switch MUST set error code if
- ** they return SECFailure or SECWouldBlock.
- */
- switch (rType) {
- case content_change_cipher_spec:
- rv = ssl3_HandleChangeCipherSpecs(ss, databuf);
- break;
- case content_alert:
- rv = ssl3_HandleAlert(ss, databuf);
- break;
- case content_handshake:
- if (!IS_DTLS(ss)) {
- rv = ssl3_HandleHandshake(ss, databuf);
- } else {
- rv = dtls_HandleHandshake(ss, epoch, seqNum, databuf);
- }
- break;
- case content_ack:
- if (IS_DTLS(ss) && tls13_MaybeTls13(ss)) {
- rv = dtls13_HandleAck(ss, databuf);
- break;
- }
- /* Fall through. */
- default:
- SSL_DBG(("%d: SSL3[%d]: bogus content type=%d",
- SSL_GETPID(), ss->fd, rType));
- PORT_SetError(SSL_ERROR_RX_UNKNOWN_RECORD_TYPE);
- ssl3_DecodeError(ss);
- rv = SECFailure;
- break;
- }
-
- ssl_ReleaseSSL3HandshakeLock(ss);
- return rv;
-}
-
-/* Find the cipher spec to use for a given record. For TLS, this
- * is the current cipherspec. For DTLS, we look up by epoch.
- * In DTLS < 1.3 this just means the current epoch or nothing,
- * but in DTLS >= 1.3, we keep multiple reading cipherspecs.
- * Returns NULL if no appropriate cipher spec is found.
- */
-static ssl3CipherSpec *
-ssl3_GetCipherSpec(sslSocket *ss, sslSequenceNumber seq)
-{
- ssl3CipherSpec *crSpec = ss->ssl3.crSpec;
- ssl3CipherSpec *newSpec = NULL;
- DTLSEpoch epoch = seq >> 48;
-
- if (!IS_DTLS(ss)) {
- return crSpec;
- }
- if (crSpec->epoch == epoch) {
- return crSpec;
- }
- if (ss->version >= SSL_LIBRARY_VERSION_TLS_1_3) {
- /* Try to find the cipher spec. */
- newSpec = ssl_FindCipherSpecByEpoch(ss, CipherSpecRead,
- epoch);
- if (newSpec != NULL) {
- return newSpec;
- }
- }
- SSL_TRC(10, ("%d: DTLS[%d]: Couldn't find cipherspec from epoch %d",
- SSL_GETPID(), ss->fd, epoch));
- return NULL;
-}
-
-/* if cText is non-null, then decipher and check the MAC of the
+/* if cText is non-null, then decipher, check MAC, and decompress the
* SSL record from cText->buf (typically gs->inbuf)
* into databuf (typically gs->buf), and any previous contents of databuf
* is lost. Then handle databuf according to its SSL record type,
@@ -12092,8 +12475,8 @@ ssl3_GetCipherSpec(sslSocket *ss, sslSequenceNumber seq)
* checked, and is already sitting in databuf. It is processed as an SSL
* Handshake message.
*
- * DOES NOT process the decrypted application data.
- * On return, databuf contains the decrypted record.
+ * DOES NOT process the decrypted/decompressed application data.
+ * On return, databuf contains the decrypted/decompressed record.
*
* Called from ssl3_GatherCompleteHandshake
* ssl3_RestartHandshakeAfterCertReq
@@ -12109,15 +12492,20 @@ ssl3_HandleRecord(sslSocket *ss, SSL3Ciphertext *cText, sslBuffer *databuf)
{
SECStatus rv;
PRBool isTLS;
- DTLSEpoch epoch;
- sslSequenceNumber seqNum = 0;
- ssl3CipherSpec *spec = NULL;
- PRBool outOfOrderSpec = PR_FALSE;
+ sslSequenceNumber seq_num = 0;
+ ssl3CipherSpec *crSpec;
SSL3ContentType rType;
sslBuffer *plaintext;
+ sslBuffer temp_buf = { NULL, 0, 0 };
SSL3AlertDescription alert = internal_error;
PORT_Assert(ss->opt.noLocks || ssl_HaveRecvBufLock(ss));
+ if (!ss->ssl3.initialized) {
+ ssl_GetSSL3HandshakeLock(ss);
+ ssl3_InitState(ss);
+ ssl_ReleaseSSL3HandshakeLock(ss);
+ }
+
/* check for Token Presence */
if (!ssl3_ClientAuthTokenPresent(ss->sec.ci.sid)) {
PORT_SetError(SSL_ERROR_TOKEN_INSERTION_REMOVAL);
@@ -12131,48 +12519,41 @@ ssl3_HandleRecord(sslSocket *ss, SSL3Ciphertext *cText, sslBuffer *databuf)
if (cText == NULL) {
SSL_DBG(("%d: SSL3[%d]: HandleRecord, resuming handshake",
SSL_GETPID(), ss->fd));
- /* Note that this doesn't pass the epoch and sequence number of the
- * record through, which DTLS 1.3 depends on. DTLS doesn't support
- * asynchronous certificate validation, so that should be OK. */
- PORT_Assert(!IS_DTLS(ss));
- return ssl3_HandleNonApplicationData(ss, content_handshake,
- 0, 0, databuf);
+ rType = content_handshake;
+ goto process_it;
}
ssl_GetSpecReadLock(ss); /******************************************/
- spec = ssl3_GetCipherSpec(ss, cText->seq_num);
- if (!spec) {
- PORT_Assert(IS_DTLS(ss));
- ssl_ReleaseSpecReadLock(ss); /*****************************/
- databuf->len = 0; /* Needed to ensure data not left around */
- return SECSuccess;
- }
- if (spec != ss->ssl3.crSpec) {
- PORT_Assert(IS_DTLS(ss));
- SSL_TRC(3, ("%d: DTLS[%d]: Handling out-of-epoch record from epoch=%d",
- SSL_GETPID(), ss->fd, spec->epoch));
- outOfOrderSpec = PR_TRUE;
- }
- isTLS = (PRBool)(spec->version > SSL_LIBRARY_VERSION_3_0);
+ crSpec = ss->ssl3.crSpec;
+ isTLS = (PRBool)(crSpec->version > SSL_LIBRARY_VERSION_3_0);
+
if (IS_DTLS(ss)) {
- if (!dtls_IsRelevant(ss, spec, cText, &seqNum)) {
+ PRBool sameEpoch;
+ if (!dtls_IsRelevant(ss, cText, &sameEpoch, &seq_num)) {
ssl_ReleaseSpecReadLock(ss); /*****************************/
databuf->len = 0; /* Needed to ensure data not left around */
- return SECSuccess;
+ /* Maybe retransmit if needed. */
+ return dtls_MaybeRetransmitHandshake(ss, cText, sameEpoch);
}
} else {
- seqNum = spec->seqNum + 1;
+ seq_num = crSpec->read_seq_num + 1;
}
- if (seqNum >= spec->cipherDef->max_records) {
+ if (seq_num >= crSpec->cipher_def->max_records) {
ssl_ReleaseSpecReadLock(ss); /*****************************/
SSL_TRC(3, ("%d: SSL[%d]: read sequence number at limit 0x%0llx",
- SSL_GETPID(), ss->fd, seqNum));
+ SSL_GETPID(), ss->fd, seq_num));
PORT_SetError(SSL_ERROR_TOO_MANY_RECORDS);
return SECFailure;
}
- plaintext = databuf;
+ /* If we will be decompressing the buffer we need to decrypt somewhere
+ * other than into databuf */
+ if (crSpec->decompressor) {
+ plaintext = &temp_buf;
+ } else {
+ plaintext = databuf;
+ }
plaintext->len = 0; /* filled in by Unprotect call below. */
/* We're waiting for another ClientHello, which will appear unencrypted.
@@ -12207,12 +12588,12 @@ ssl3_HandleRecord(sslSocket *ss, SSL3Ciphertext *cText, sslBuffer *databuf)
/* IMPORTANT: Unprotect functions MUST NOT send alerts
* because we still hold the spec read lock. Instead, if they
* return SECFailure, they set *alert to the alert to be sent. */
- if (spec->version < SSL_LIBRARY_VERSION_TLS_1_3 ||
- spec->cipherDef->calg == ssl_calg_null) {
+ if (crSpec->version < SSL_LIBRARY_VERSION_TLS_1_3 ||
+ crSpec->cipher_def->calg == ssl_calg_null) {
/* Unencrypted TLS 1.3 records use the pre-TLS 1.3 format. */
- rv = ssl3_UnprotectRecord(ss, spec, cText, plaintext, &alert);
+ rv = ssl3_UnprotectRecord(ss, cText, plaintext, &alert);
} else {
- rv = tls13_UnprotectRecord(ss, spec, cText, plaintext, &alert);
+ rv = tls13_UnprotectRecord(ss, cText, plaintext, &alert);
}
#endif
@@ -12221,25 +12602,14 @@ ssl3_HandleRecord(sslSocket *ss, SSL3Ciphertext *cText, sslBuffer *databuf)
SSL_DBG(("%d: SSL3[%d]: decryption failed", SSL_GETPID(), ss->fd));
- /* Ensure that we don't process this data again. */
- databuf->len = 0;
+ /* Clear the temp buffer used for decompression upon failure. */
+ sslBuffer_Clear(&temp_buf);
- /* Ignore a CCS if the alternative handshake is negotiated. Note that
- * this will fail if the server fails to negotiate the alternative
- * handshake type in a 0-RTT session that is resumed from a session that
- * did negotiate it. We don't care about that corner case right now. */
- if (ss->version >= SSL_LIBRARY_VERSION_TLS_1_3 &&
- cText->type == content_change_cipher_spec &&
- ss->ssl3.hs.ws != idle_handshake &&
- cText->buf->len == 1 &&
- cText->buf->buf[0] == change_cipher_spec_choice) {
- /* Ignore the CCS. */
- return SECSuccess;
- }
if (IS_DTLS(ss) ||
(ss->sec.isServer &&
ss->ssl3.hs.zeroRttIgnore == ssl_0rtt_ignore_trial)) {
/* Silently drop the packet */
+ databuf->len = 0; /* Needed to ensure data not left around */
return SECSuccess;
} else {
int errCode = PORT_GetError();
@@ -12252,11 +12622,10 @@ ssl3_HandleRecord(sslSocket *ss, SSL3Ciphertext *cText, sslBuffer *databuf)
}
/* SECSuccess */
- spec->seqNum = PR_MAX(spec->seqNum, seqNum);
+ crSpec->read_seq_num = seq_num;
if (IS_DTLS(ss)) {
- dtls_RecordSetRecvd(&spec->recvdRecords, seqNum);
+ dtls_RecordSetRecvd(&crSpec->recvdRecords, seq_num);
}
- epoch = spec->epoch;
ssl_ReleaseSpecReadLock(ss); /*****************************************/
@@ -12266,16 +12635,70 @@ ssl3_HandleRecord(sslSocket *ss, SSL3Ciphertext *cText, sslBuffer *databuf)
rType = cText->type; /* This must go after decryption because TLS 1.3
* has encrypted content types. */
- /* IMPORTANT: We are in DTLS 1.3 mode and we have processed something
- * from the wrong epoch. Divert to a divert processing function to make
- * sure we don't accidentally use the data unsafely. */
- if (outOfOrderSpec) {
- PORT_Assert(IS_DTLS(ss) && ss->version >= SSL_LIBRARY_VERSION_TLS_1_3);
- return dtls13_HandleOutOfEpochRecord(ss, spec, rType, databuf);
+ /* possibly decompress the record. If we aren't using compression then
+ * plaintext == databuf and so the uncompressed data is already in
+ * databuf. */
+ if (crSpec->decompressor) {
+ if (databuf->space < plaintext->len + SSL3_COMPRESSION_MAX_EXPANSION) {
+ rv = sslBuffer_Grow(
+ databuf, plaintext->len + SSL3_COMPRESSION_MAX_EXPANSION);
+ if (rv != SECSuccess) {
+ SSL_DBG(("%d: SSL3[%d]: HandleRecord, tried to get %d bytes",
+ SSL_GETPID(), ss->fd,
+ plaintext->len +
+ SSL3_COMPRESSION_MAX_EXPANSION));
+ /* sslBuffer_Grow has set a memory error code. */
+ /* Perhaps we should send an alert. (but we have no memory!) */
+ sslBuffer_Clear(&temp_buf);
+ return SECFailure;
+ }
+ }
+
+ rv = crSpec->decompressor(crSpec->decompressContext,
+ databuf->buf,
+ (int *)&databuf->len,
+ databuf->space,
+ plaintext->buf,
+ plaintext->len);
+
+ if (rv != SECSuccess) {
+ int err = ssl_MapLowLevelError(SSL_ERROR_DECOMPRESSION_FAILURE);
+ SSL3_SendAlert(ss, alert_fatal,
+ isTLS ? decompression_failure
+ : bad_record_mac);
+
+ /* There appears to be a bug with (at least) Apache + OpenSSL where
+ * resumed SSLv3 connections don't actually use compression. See
+ * comments 93-95 of
+ * https://bugzilla.mozilla.org/show_bug.cgi?id=275744
+ *
+ * So, if we get a decompression error, and the record appears to
+ * be already uncompressed, then we return a more specific error
+ * code to hopefully save somebody some debugging time in the
+ * future.
+ */
+ if (plaintext->len >= 4) {
+ unsigned int len = ((unsigned int)plaintext->buf[1] << 16) |
+ ((unsigned int)plaintext->buf[2] << 8) |
+ (unsigned int)plaintext->buf[3];
+ if (len == plaintext->len - 4) {
+ /* This appears to be uncompressed already */
+ err = SSL_ERROR_RX_UNEXPECTED_UNCOMPRESSED_RECORD;
+ }
+ }
+
+ sslBuffer_Clear(&temp_buf);
+ PORT_SetError(err);
+ return SECFailure;
+ }
+
+ sslBuffer_Clear(&temp_buf);
}
- /* Check the length of the plaintext. */
- if (isTLS && databuf->len > MAX_FRAGMENT_LENGTH) {
+ /*
+ ** Having completed the decompression, check the length again.
+ */
+ if (isTLS && databuf->len > (MAX_FRAGMENT_LENGTH + 1024)) {
SSL3_SendAlert(ss, alert_fatal, record_overflow);
PORT_SetError(SSL_ERROR_RX_RECORD_TOO_LONG);
return SECFailure;
@@ -12297,7 +12720,45 @@ ssl3_HandleRecord(sslSocket *ss, SSL3Ciphertext *cText, sslBuffer *databuf)
return SECFailure;
}
- return ssl3_HandleNonApplicationData(ss, rType, epoch, seqNum, databuf);
+/* It's a record that must be handled by ssl itself, not the application.
+ */
+process_it:
+ /* XXX Get the xmit lock here. Odds are very high that we'll be xmiting
+ * data ang getting the xmit lock here prevents deadlocks.
+ */
+ ssl_GetSSL3HandshakeLock(ss);
+
+ /* All the functions called in this switch MUST set error code if
+ ** they return SECFailure or SECWouldBlock.
+ */
+ switch (rType) {
+ case content_change_cipher_spec:
+ rv = ssl3_HandleChangeCipherSpecs(ss, databuf);
+ break;
+ case content_alert:
+ rv = ssl3_HandleAlert(ss, databuf);
+ break;
+ case content_handshake:
+ if (!IS_DTLS(ss)) {
+ rv = ssl3_HandleHandshake(ss, databuf);
+ } else {
+ rv = dtls_HandleHandshake(ss, databuf);
+ }
+ break;
+ /*
+ case content_application_data is handled before this switch
+ */
+ default:
+ SSL_DBG(("%d: SSL3[%d]: bogus content type=%d",
+ SSL_GETPID(), ss->fd, cText->type));
+ PORT_SetError(SSL_ERROR_RX_UNKNOWN_RECORD_TYPE);
+ ssl3_DecodeError(ss);
+ rv = SECFailure;
+ break;
+ }
+
+ ssl_ReleaseSSL3HandshakeLock(ss);
+ return rv;
}
/*
@@ -12315,36 +12776,83 @@ ssl_InitSecState(sslSecurityInfo *sec)
sec->keaGroup = NULL;
}
-SECStatus
+/* Called from ssl3_InitState, immediately below. */
+/* Caller must hold the SpecWriteLock. */
+void
+ssl3_InitCipherSpec(ssl3CipherSpec *spec)
+{
+ spec->cipher_def = &bulk_cipher_defs[cipher_null];
+ PORT_Assert(spec->cipher_def->cipher == cipher_null);
+ spec->mac_def = &mac_defs[mac_null];
+ PORT_Assert(spec->mac_def->mac == mac_null);
+ spec->encode = Null_Cipher;
+ spec->decode = Null_Cipher;
+ spec->compressor = NULL;
+ spec->decompressor = NULL;
+ spec->destroyCompressContext = NULL;
+ spec->destroyDecompressContext = NULL;
+ spec->mac_size = 0;
+ spec->master_secret = NULL;
+
+ spec->msItem.data = NULL;
+ spec->msItem.len = 0;
+
+ spec->client.write_key = NULL;
+ spec->client.write_mac_key = NULL;
+ spec->client.write_mac_context = NULL;
+
+ spec->server.write_key = NULL;
+ spec->server.write_mac_key = NULL;
+ spec->server.write_mac_context = NULL;
+
+ spec->write_seq_num = 0;
+ spec->read_seq_num = 0;
+ spec->epoch = 0;
+
+ spec->refCt = 128; /* Arbitrarily high number to prevent
+ * non-TLS 1.3 cipherSpecs from being
+ * GCed. This will be overwritten with
+ * a valid refCt for TLS 1.3. */
+ dtls_InitRecvdRecords(&spec->recvdRecords);
+}
+
+/* Called from: ssl3_SendRecord
+** ssl3_SendClientHello()
+** ssl3_HandleV2ClientHello()
+** ssl3_HandleRecord()
+**
+** This function should perhaps acquire and release the SpecWriteLock.
+*/
+void
ssl3_InitState(sslSocket *ss)
{
- SECStatus rv;
+ PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
+
+ if (ss->ssl3.initialized)
+ return; /* Function should be idempotent */
ss->ssl3.policy = SSL_ALLOWED;
ssl_InitSecState(&ss->sec);
ssl_GetSpecWriteLock(ss);
- PR_INIT_CLIST(&ss->ssl3.hs.cipherSpecs);
- rv = ssl_SetupNullCipherSpec(ss, CipherSpecRead);
- rv |= ssl_SetupNullCipherSpec(ss, CipherSpecWrite);
- ss->ssl3.pwSpec = ss->ssl3.prSpec = NULL;
+ ss->ssl3.crSpec = ss->ssl3.cwSpec = &ss->ssl3.specs[0];
+ ss->ssl3.prSpec = ss->ssl3.pwSpec = &ss->ssl3.specs[1];
+ ssl3_InitCipherSpec(ss->ssl3.crSpec);
+ ssl3_InitCipherSpec(ss->ssl3.prSpec);
+ ss->ssl3.crSpec->version = ss->ssl3.prSpec->version = ss->vrange.max;
ssl_ReleaseSpecWriteLock(ss);
- if (rv != SECSuccess) {
- /* Rely on ssl_CreateNullCipherSpec() to set error code. */
- return SECFailure;
- }
ss->ssl3.hs.sendingSCSV = PR_FALSE;
ss->ssl3.hs.preliminaryInfo = 0;
- ss->ssl3.hs.ws = (ss->sec.isServer) ? wait_client_hello : idle_handshake;
+ ss->ssl3.hs.ws = (ss->sec.isServer) ? wait_client_hello : wait_server_hello;
- ssl3_ResetExtensionData(&ss->xtnData, ss);
+ ssl3_ResetExtensionData(&ss->xtnData);
PR_INIT_CLIST(&ss->ssl3.hs.remoteExtensions);
if (IS_DTLS(ss)) {
ss->ssl3.hs.sendMessageSeq = 0;
ss->ssl3.hs.recvMessageSeq = 0;
- ss->ssl3.hs.rtTimer->timeout = DTLS_RETRANSMIT_INITIAL_MS;
+ ss->ssl3.hs.rtTimeoutMs = DTLS_RETRANSMIT_INITIAL_MS;
ss->ssl3.hs.rtRetries = 0;
ss->ssl3.hs.recvdHighWater = -1;
PR_INIT_CLIST(&ss->ssl3.hs.lastMessageFlight);
@@ -12360,6 +12868,8 @@ ssl3_InitState(sslSocket *ss)
ss->ssl3.hs.serverHsTrafficSecret = NULL;
ss->ssl3.hs.clientTrafficSecret = NULL;
ss->ssl3.hs.serverTrafficSecret = NULL;
+ ss->ssl3.hs.certificateRequest = NULL;
+ PR_INIT_CLIST(&ss->ssl3.hs.cipherSpecs);
PORT_Assert(!ss->ssl3.hs.messages.buf && !ss->ssl3.hs.messages.space);
ss->ssl3.hs.messages.buf = NULL;
@@ -12371,7 +12881,9 @@ ssl3_InitState(sslSocket *ss)
ss->ssl3.hs.zeroRttState = ssl_0rtt_none;
- return SECSuccess;
+ ssl_FilterSupportedGroups(ss);
+
+ ss->ssl3.initialized = PR_TRUE;
}
/* record the export policy for this cipher suite */
@@ -12625,7 +13137,8 @@ ssl3_RedoHandshake(sslSocket *ss, PRBool flushCache)
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
- if (!ss->firstHsDone || (ss->ssl3.hs.ws != idle_handshake)) {
+ if (!ss->firstHsDone ||
+ (ss->ssl3.initialized && (ss->ssl3.hs.ws != idle_handshake))) {
PORT_SetError(SSL_ERROR_HANDSHAKE_NOT_COMPLETED);
return SECFailure;
}
@@ -12639,11 +13152,6 @@ ssl3_RedoHandshake(sslSocket *ss, PRBool flushCache)
PORT_SetError(SSL_ERROR_RENEGOTIATION_NOT_ALLOWED);
return SECFailure;
}
- if (ss->version > ss->vrange.max || ss->version < ss->vrange.min) {
- PORT_SetError(SSL_ERROR_UNSUPPORTED_VERSION);
- return SECFailure;
- }
-
if (sid && flushCache) {
ss->sec.uncache(sid); /* remove it from whichever cache it's in. */
ssl_FreeSID(sid); /* dec ref count and free if zero. */
@@ -12701,7 +13209,15 @@ ssl3_DestroySSL3Info(sslSocket *ss)
SECITEM_FreeItem(&ss->ssl3.hs.newSessionTicket.ticket, PR_FALSE);
SECITEM_FreeItem(&ss->ssl3.hs.srvVirtName, PR_FALSE);
- SECITEM_FreeItem(&ss->ssl3.hs.fakeSid, PR_FALSE);
+
+ if (ss->ssl3.hs.certificateRequest) {
+ PORT_FreeArena(ss->ssl3.hs.certificateRequest->arena, PR_FALSE);
+ ss->ssl3.hs.certificateRequest = NULL;
+ }
+
+ /* free up the CipherSpecs */
+ ssl3_DestroyCipherSpec(&ss->ssl3.specs[0], PR_TRUE /*freeSrvName*/);
+ ssl3_DestroyCipherSpec(&ss->ssl3.specs[1], PR_TRUE /*freeSrvName*/);
/* Destroy the DTLS data */
if (IS_DTLS(ss)) {
@@ -12713,10 +13229,10 @@ ssl3_DestroySSL3Info(sslSocket *ss)
/* Destroy remote extensions */
ssl3_DestroyRemoteExtensions(&ss->ssl3.hs.remoteExtensions);
- ssl3_DestroyExtensionData(&ss->xtnData);
+ ssl3_ResetExtensionData(&ss->xtnData);
- /* Destroy cipher specs */
- ssl_DestroyCipherSpecs(&ss->ssl3.hs.cipherSpecs);
+ /* Destroy TLS 1.3 cipher specs */
+ tls13_DestroyCipherSpecs(&ss->ssl3.hs.cipherSpecs);
/* Destroy TLS 1.3 keys */
if (ss->ssl3.hs.currentSecret)
@@ -12745,6 +13261,8 @@ ssl3_DestroySSL3Info(sslSocket *ss)
ss->ssl3.hs.zeroRttState = ssl_0rtt_none;
/* Destroy TLS 1.3 buffered early data. */
tls13_DestroyEarlyData(&ss->ssl3.hs.bufferedEarlyData);
+
+ ss->ssl3.initialized = PR_FALSE;
}
#define MAP_NULL(x) (((x) != 0) ? (x) : SEC_OID_NULL_CIPHER)
@@ -12783,7 +13301,7 @@ ssl3_ApplyNSSPolicy(void)
}
if (ssl_GetBulkCipherDef(suite)->type != type_aead) {
- policyOid = MAP_NULL(ssl_GetMacDefByAlg(suite->mac_alg)->oid);
+ policyOid = MAP_NULL(mac_defs[suite->mac_alg].oid);
rv = NSS_GetAlgorithmPolicy(policyOid, &policy);
if (rv == SECSuccess && !(policy & NSS_USE_ALG_IN_SSL)) {
ssl_CipherPrefSetDefault(suite->cipher_suite, PR_FALSE);
diff --git a/security/nss/lib/ssl/ssl3ecc.c b/security/nss/lib/ssl/ssl3ecc.c
index 913a14f637..b440b4b024 100644
--- a/security/nss/lib/ssl/ssl3ecc.c
+++ b/security/nss/lib/ssl/ssl3ecc.c
@@ -111,7 +111,7 @@ ssl_ECPubKey2NamedGroup(const SECKEYPublicKey *pubKey)
static SECStatus
ssl3_ComputeECDHKeyHash(SSLHashType hashAlg,
SECItem ec_params, SECItem server_ecpoint,
- PRUint8 *client_rand, PRUint8 *server_rand,
+ SSL3Random *client_rand, SSL3Random *server_rand,
SSL3Hashes *hashes)
{
PRUint8 *hashBuf;
@@ -175,8 +175,8 @@ ssl3_SendECDHClientKeyExchange(sslSocket *ss, SECKEYPublicKey *svrPubKey)
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
PORT_Assert(ss->opt.noLocks || ssl_HaveXmitBufLock(ss));
- isTLS = (PRBool)(ss->version > SSL_LIBRARY_VERSION_3_0);
- isTLS12 = (PRBool)(ss->version >= SSL_LIBRARY_VERSION_TLS_1_2);
+ isTLS = (PRBool)(ss->ssl3.pwSpec->version > SSL_LIBRARY_VERSION_3_0);
+ isTLS12 = (PRBool)(ss->ssl3.pwSpec->version >= SSL_LIBRARY_VERSION_TLS_1_2);
/* Generate ephemeral EC keypair */
if (svrPubKey->keyType != ecKey) {
@@ -219,7 +219,7 @@ ssl3_SendECDHClientKeyExchange(sslSocket *ss, SECKEYPublicKey *svrPubKey)
goto loser;
}
- rv = ssl3_AppendHandshakeHeader(ss, ssl_hs_client_key_exchange,
+ rv = ssl3_AppendHandshakeHeader(ss, client_key_exchange,
pubKey->u.ec.publicValue.len + 1);
if (rv != SECSuccess) {
goto loser; /* err set by ssl3_AppendHandshake* */
@@ -232,7 +232,7 @@ ssl3_SendECDHClientKeyExchange(sslSocket *ss, SECKEYPublicKey *svrPubKey)
goto loser; /* err set by ssl3_AppendHandshake* */
}
- rv = ssl3_InitPendingCipherSpecs(ss, pms, PR_TRUE);
+ rv = ssl3_InitPendingCipherSpec(ss, pms);
if (rv != SECSuccess) {
ssl_MapLowLevelError(SSL_ERROR_CLIENT_KEY_EXCHANGE_FAILURE);
goto loser;
@@ -250,6 +250,19 @@ loser:
return SECFailure;
}
+/* This function encodes the key_exchange field in
+ * the KeyShareEntry structure. */
+SECStatus
+tls13_EncodeECDHEKeyShareKEX(const sslSocket *ss, const SECKEYPublicKey *pubKey)
+{
+ PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
+ PORT_Assert(ss->opt.noLocks || ssl_HaveXmitBufLock(ss));
+ PORT_Assert(pubKey->keyType == ecKey);
+
+ return ssl3_ExtAppendHandshake(ss, pubKey->u.ec.publicValue.data,
+ pubKey->u.ec.publicValue.len);
+}
+
/*
** Called from ssl3_HandleClientKeyExchange()
*/
@@ -313,7 +326,7 @@ ssl3_HandleECDHClientKeyExchange(sslSocket *ss, PRUint8 *b,
return SECFailure;
}
- rv = ssl3_InitPendingCipherSpecs(ss, pms, PR_TRUE);
+ rv = ssl3_InitPendingCipherSpec(ss, pms);
PK11_FreeSymKey(pms);
if (rv != SECSuccess) {
/* error code set by ssl3_InitPendingCipherSpec */
@@ -584,8 +597,8 @@ ssl3_HandleECDHServerKeyExchange(sslSocket *ss, PRUint8 *b, PRUint32 length)
* check to make sure the hash is signed by right guy
*/
rv = ssl3_ComputeECDHKeyHash(hashAlg, ec_params, ec_point,
- ss->ssl3.hs.client_random,
- ss->ssl3.hs.server_random,
+ &ss->ssl3.hs.client_random,
+ &ss->ssl3.hs.server_random,
&hashes);
if (rv != SECSuccess) {
@@ -690,7 +703,7 @@ ssl3_SendECDHServerKeyExchange(sslSocket *ss)
ec_params.data[2] = keyPair->group->name & 0xff;
pubKey = keyPair->keys->pubKey;
- if (ss->version == SSL_LIBRARY_VERSION_TLS_1_2) {
+ if (ss->ssl3.pwSpec->version == SSL_LIBRARY_VERSION_TLS_1_2) {
hashAlg = ssl_SignatureSchemeToHashType(ss->ssl3.hs.signatureScheme);
} else {
/* Use ssl_hash_none to represent the MD5+SHA1 combo. */
@@ -698,15 +711,15 @@ ssl3_SendECDHServerKeyExchange(sslSocket *ss)
}
rv = ssl3_ComputeECDHKeyHash(hashAlg, ec_params,
pubKey->u.ec.publicValue,
- ss->ssl3.hs.client_random,
- ss->ssl3.hs.server_random,
+ &ss->ssl3.hs.client_random,
+ &ss->ssl3.hs.server_random,
&hashes);
if (rv != SECSuccess) {
ssl_MapLowLevelError(SSL_ERROR_SERVER_KEY_EXCHANGE_FAILURE);
goto loser;
}
- isTLS12 = (PRBool)(ss->version >= SSL_LIBRARY_VERSION_TLS_1_2);
+ isTLS12 = (PRBool)(ss->ssl3.pwSpec->version >= SSL_LIBRARY_VERSION_TLS_1_2);
rv = ssl3_SignHashes(ss, &hashes,
ss->sec.serverCert->serverKeyPair->privKey, &signed_hash);
@@ -718,7 +731,7 @@ ssl3_SendECDHServerKeyExchange(sslSocket *ss)
1 + pubKey->u.ec.publicValue.len +
(isTLS12 ? 2 : 0) + 2 + signed_hash.len;
- rv = ssl3_AppendHandshakeHeader(ss, ssl_hs_server_key_exchange, length);
+ rv = ssl3_AppendHandshakeHeader(ss, server_key_exchange, length);
if (rv != SECSuccess) {
goto loser; /* err set by AppendHandshake. */
}
@@ -857,16 +870,20 @@ ssl_IsDHEEnabled(const sslSocket *ss)
}
/* Send our Supported Groups extension. */
-SECStatus
-ssl_SendSupportedGroupsXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
+PRInt32
+ssl_SendSupportedGroupsXtn(const sslSocket *ss,
+ TLSExtensionData *xtnData,
+ PRBool append, PRUint32 maxBytes)
{
+ PRInt32 extension_length;
+ unsigned char enabledGroups[64];
+ unsigned int enabledGroupsLen = 0;
unsigned int i;
PRBool ec;
PRBool ff = PR_FALSE;
- PRBool found = PR_FALSE;
- SECStatus rv;
- unsigned int lengthOffset;
+
+ if (!ss)
+ return 0;
/* We only send FF supported groups if we require DH named groups
* or if TLS 1.3 is a possibility. */
@@ -875,19 +892,13 @@ ssl_SendSupportedGroupsXtn(const sslSocket *ss, TLSExtensionData *xtnData,
if (ss->opt.requireDHENamedGroups) {
ff = ssl_IsDHEEnabled(ss);
}
- if (!ec && !ff) {
- return SECSuccess;
- }
+ if (!ec && !ff)
+ return 0;
} else {
ec = ff = PR_TRUE;
}
- /* Mark the location of the length. */
- rv = sslBuffer_Skip(buf, 2, &lengthOffset);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
+ PORT_Assert(sizeof(enabledGroups) > SSL_NAMED_GROUP_COUNT * 2);
for (i = 0; i < SSL_NAMED_GROUP_COUNT; ++i) {
const sslNamedGroupDef *group = ss->namedGroupPreferences[i];
if (!group) {
@@ -900,53 +911,78 @@ ssl_SendSupportedGroupsXtn(const sslSocket *ss, TLSExtensionData *xtnData,
continue;
}
- found = PR_TRUE;
- rv = sslBuffer_AppendNumber(buf, group->name, 2);
- if (rv != SECSuccess) {
- return SECFailure;
+ if (append) {
+ (void)ssl_EncodeUintX(group->name, 2, &enabledGroups[enabledGroupsLen]);
+ }
+ enabledGroupsLen += 2;
+ }
+
+ if (enabledGroupsLen == 0) {
+ return 0;
+ }
+
+ extension_length =
+ 2 /* extension type */ +
+ 2 /* extension length */ +
+ 2 /* enabled groups length */ +
+ enabledGroupsLen;
+
+ if (maxBytes < (PRUint32)extension_length) {
+ return 0;
+ }
+
+ if (append) {
+ SECStatus rv;
+ rv = ssl3_ExtAppendHandshakeNumber(ss, ssl_supported_groups_xtn, 2);
+ if (rv != SECSuccess)
+ return -1;
+ rv = ssl3_ExtAppendHandshakeNumber(ss, extension_length - 4, 2);
+ if (rv != SECSuccess)
+ return -1;
+ rv = ssl3_ExtAppendHandshakeVariable(ss, enabledGroups,
+ enabledGroupsLen, 2);
+ if (rv != SECSuccess)
+ return -1;
+ if (!ss->sec.isServer) {
+ xtnData->advertised[xtnData->numAdvertised++] =
+ ssl_supported_groups_xtn;
}
}
-
- if (!found) {
- /* We added nothing, don't send the extension. */
- return SECSuccess;
- }
-
- rv = sslBuffer_InsertLength(buf, lengthOffset, 2);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- *added = PR_TRUE;
- return SECSuccess;
+ return extension_length;
}
/* Send our "canned" (precompiled) Supported Point Formats extension,
* which says that we only support uncompressed points.
*/
-SECStatus
-ssl3_SendSupportedPointFormatsXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
+PRInt32
+ssl3_SendSupportedPointFormatsXtn(
+ const sslSocket *ss,
+ TLSExtensionData *xtnData,
+ PRBool append,
+ PRUint32 maxBytes)
{
- SECStatus rv;
+ static const PRUint8 ecPtFmt[6] = {
+ 0, 11, /* Extension type */
+ 0, 2, /* octets that follow */
+ 1, /* octets that follow */
+ 0 /* uncompressed type only */
+ };
/* No point in doing this unless we have a socket that supports ECC.
* Similarly, no point if we are going to do TLS 1.3 only or we have already
* picked TLS 1.3 (server) given that it doesn't use point formats. */
if (!ss || !ssl_IsECCEnabled(ss) ||
ss->vrange.min >= SSL_LIBRARY_VERSION_TLS_1_3 ||
- (ss->sec.isServer && ss->version >= SSL_LIBRARY_VERSION_TLS_1_3)) {
- return SECSuccess;
- }
- rv = sslBuffer_AppendNumber(buf, 1, 1); /* length */
- if (rv != SECSuccess) {
- return SECFailure;
- }
- rv = sslBuffer_AppendNumber(buf, 0, 1); /* uncompressed type only */
- if (rv != SECSuccess) {
- return SECFailure;
+ (ss->sec.isServer && ss->version >= SSL_LIBRARY_VERSION_TLS_1_3))
+ return 0;
+ if (append && maxBytes >= (sizeof ecPtFmt)) {
+ SECStatus rv = ssl3_ExtAppendHandshake(ss, ecPtFmt, (sizeof ecPtFmt));
+ if (rv != SECSuccess)
+ return -1;
+ if (!ss->sec.isServer) {
+ xtnData->advertised[xtnData->numAdvertised++] =
+ ssl_ec_point_formats_xtn;
+ }
}
-
- *added = PR_TRUE;
- return SECSuccess;
+ return sizeof(ecPtFmt);
}
diff --git a/security/nss/lib/ssl/ssl3ext.c b/security/nss/lib/ssl/ssl3ext.c
index ade2809036..271084cf73 100644
--- a/security/nss/lib/ssl/ssl3ext.c
+++ b/security/nss/lib/ssl/ssl3ext.c
@@ -14,20 +14,8 @@
#include "sslimpl.h"
#include "sslproto.h"
#include "ssl3exthandle.h"
-#include "tls13err.h"
#include "tls13exthandle.h"
-/* Callback function that handles a received extension. */
-typedef SECStatus (*ssl3ExtensionHandlerFunc)(const sslSocket *ss,
- TLSExtensionData *xtnData,
- SECItem *data);
-
-/* Row in a table of hello extension handlers. */
-typedef struct {
- SSLExtensionType ex_type;
- ssl3ExtensionHandlerFunc ex_handler;
-} ssl3ExtensionHandler;
-
/* Table of handlers for received TLS hello extensions, one per extension.
* In the second generation, this table will be dynamic, and functions
* will be registered here.
@@ -43,15 +31,16 @@ static const ssl3ExtensionHandler clientHelloHandlers[] = {
{ ssl_app_layer_protocol_xtn, &ssl3_ServerHandleAppProtoXtn },
{ ssl_use_srtp_xtn, &ssl3_ServerHandleUseSRTPXtn },
{ ssl_cert_status_xtn, &ssl3_ServerHandleStatusRequestXtn },
- { ssl_signature_algorithms_xtn, &ssl3_HandleSigAlgsXtn },
+ { ssl_signature_algorithms_xtn, &ssl3_ServerHandleSigAlgsXtn },
{ ssl_extended_master_secret_xtn, &ssl3_HandleExtendedMasterSecretXtn },
{ ssl_signed_cert_timestamp_xtn, &ssl3_ServerHandleSignedCertTimestampXtn },
{ ssl_tls13_key_share_xtn, &tls13_ServerHandleKeyShareXtn },
{ ssl_tls13_pre_shared_key_xtn, &tls13_ServerHandlePreSharedKeyXtn },
{ ssl_tls13_early_data_xtn, &tls13_ServerHandleEarlyDataXtn },
- { ssl_tls13_psk_key_exchange_modes_xtn, &tls13_ServerHandlePskModesXtn },
- { ssl_tls13_cookie_xtn, &tls13_ServerHandleCookieXtn },
- { 0, NULL }
+ { ssl_tls13_psk_key_exchange_modes_xtn,
+ &tls13_ServerHandlePskKeyExchangeModesXtn },
+ { ssl_tls13_short_header_xtn, &tls13_HandleShortHeaderXtn },
+ { -1, NULL }
};
/* These two tables are used by the client, to handle server hello
@@ -70,38 +59,36 @@ static const ssl3ExtensionHandler serverHelloHandlersTLS[] = {
{ ssl_tls13_key_share_xtn, &tls13_ClientHandleKeyShareXtn },
{ ssl_tls13_pre_shared_key_xtn, &tls13_ClientHandlePreSharedKeyXtn },
{ ssl_tls13_early_data_xtn, &tls13_ClientHandleEarlyDataXtn },
- { 0, NULL }
+ { ssl_tls13_short_header_xtn, &tls13_HandleShortHeaderXtn },
+ { -1, NULL }
};
static const ssl3ExtensionHandler helloRetryRequestHandlers[] = {
{ ssl_tls13_key_share_xtn, tls13_ClientHandleKeyShareXtnHrr },
{ ssl_tls13_cookie_xtn, tls13_ClientHandleHrrCookie },
- { 0, NULL }
+ { -1, NULL }
};
static const ssl3ExtensionHandler serverHelloHandlersSSL3[] = {
{ ssl_renegotiation_info_xtn, &ssl3_HandleRenegotiationInfoXtn },
- { 0, NULL }
+ { -1, NULL }
};
static const ssl3ExtensionHandler newSessionTicketHandlers[] = {
- { ssl_tls13_early_data_xtn,
- &tls13_ClientHandleTicketEarlyDataXtn },
- { 0, NULL }
+ { ssl_tls13_ticket_early_data_info_xtn,
+ &tls13_ClientHandleTicketEarlyDataInfoXtn },
+ { -1, NULL }
};
/* This table is used by the client to handle server certificates in TLS 1.3 */
static const ssl3ExtensionHandler serverCertificateHandlers[] = {
{ ssl_signed_cert_timestamp_xtn, &ssl3_ClientHandleSignedCertTimestampXtn },
{ ssl_cert_status_xtn, &ssl3_ClientHandleStatusRequestXtn },
- { 0, NULL }
+ { -1, NULL }
};
static const ssl3ExtensionHandler certificateRequestHandlers[] = {
- { ssl_signature_algorithms_xtn, &ssl3_HandleSigAlgsXtn },
- { ssl_tls13_certificate_authorities_xtn,
- &tls13_ClientHandleCertAuthoritiesXtn },
- { 0, NULL }
+ { -1, NULL }
};
/* Tables of functions to format TLS hello extensions, one function per
@@ -114,14 +101,14 @@ static const ssl3ExtensionHandler certificateRequestHandlers[] = {
* the client hello is empty (for example, the extended master secret
* extension, if it were listed last). See bug 1243641.
*/
-static const sslExtensionBuilder clientHelloSendersTLS[] =
+static const ssl3HelloExtensionSender clientHelloSendersTLS[SSL_MAX_EXTENSIONS] =
{
- { ssl_server_name_xtn, &ssl3_ClientSendServerNameXtn },
+ { ssl_server_name_xtn, &ssl3_SendServerNameXtn },
{ ssl_extended_master_secret_xtn, &ssl3_SendExtendedMasterSecretXtn },
{ ssl_renegotiation_info_xtn, &ssl3_SendRenegotiationInfoXtn },
{ ssl_supported_groups_xtn, &ssl_SendSupportedGroupsXtn },
{ ssl_ec_point_formats_xtn, &ssl3_SendSupportedPointFormatsXtn },
- { ssl_session_ticket_xtn, &ssl3_ClientSendSessionTicketXtn },
+ { ssl_session_ticket_xtn, &ssl3_SendSessionTicketXtn },
{ ssl_next_proto_nego_xtn, &ssl3_ClientSendNextProtoNegoXtn },
{ ssl_app_layer_protocol_xtn, &ssl3_ClientSendAppProtoXtn },
{ ssl_use_srtp_xtn, &ssl3_ClientSendUseSRTPXtn },
@@ -134,155 +121,22 @@ static const sslExtensionBuilder clientHelloSendersTLS[] =
* client hello is empty. They are not intolerant of TLS 1.2, so list
* signature_algorithms at the end. See bug 1243641. */
{ ssl_tls13_supported_versions_xtn, &tls13_ClientSendSupportedVersionsXtn },
- { ssl_signature_algorithms_xtn, &ssl3_SendSigAlgsXtn },
+ { ssl_tls13_short_header_xtn, &tls13_SendShortHeaderXtn },
+ { ssl_signature_algorithms_xtn, &ssl3_ClientSendSigAlgsXtn },
{ ssl_tls13_cookie_xtn, &tls13_ClientSendHrrCookieXtn },
- { ssl_tls13_psk_key_exchange_modes_xtn, &tls13_ClientSendPskModesXtn },
+ { ssl_tls13_psk_key_exchange_modes_xtn,
+ &tls13_ClientSendPskKeyExchangeModesXtn },
+ { ssl_padding_xtn, &ssl3_ClientSendPaddingExtension },
/* The pre_shared_key extension MUST be last. */
{ ssl_tls13_pre_shared_key_xtn, &tls13_ClientSendPreSharedKeyXtn },
- { 0, NULL }
+ /* any extra entries will appear as { 0, NULL } */
};
-static const sslExtensionBuilder clientHelloSendersSSL3[] = {
- { ssl_renegotiation_info_xtn, &ssl3_SendRenegotiationInfoXtn },
- { 0, NULL }
-};
-
-static const sslExtensionBuilder tls13_cert_req_senders[] = {
- { ssl_signature_algorithms_xtn, &ssl3_SendSigAlgsXtn },
- { ssl_tls13_certificate_authorities_xtn, &tls13_SendCertAuthoritiesXtn },
- { 0, NULL }
-};
-
-static const sslExtensionBuilder tls13_hrr_senders[] = {
- { ssl_tls13_key_share_xtn, &tls13_ServerSendHrrKeyShareXtn },
- { ssl_tls13_cookie_xtn, &tls13_ServerSendHrrCookieXtn },
- { ssl_tls13_supported_versions_xtn, &tls13_ServerSendSupportedVersionsXtn },
- { 0, NULL }
-};
-
-static const struct {
- SSLExtensionType type;
- SSLExtensionSupport support;
-} ssl_supported_extensions[] = {
- { ssl_server_name_xtn, ssl_ext_native_only },
- { ssl_cert_status_xtn, ssl_ext_native },
- { ssl_supported_groups_xtn, ssl_ext_native_only },
- { ssl_ec_point_formats_xtn, ssl_ext_native },
- { ssl_signature_algorithms_xtn, ssl_ext_native_only },
- { ssl_use_srtp_xtn, ssl_ext_native },
- { ssl_app_layer_protocol_xtn, ssl_ext_native_only },
- { ssl_signed_cert_timestamp_xtn, ssl_ext_native },
- { ssl_padding_xtn, ssl_ext_native },
- { ssl_extended_master_secret_xtn, ssl_ext_native_only },
- { ssl_session_ticket_xtn, ssl_ext_native_only },
- { ssl_tls13_key_share_xtn, ssl_ext_native_only },
- { ssl_tls13_pre_shared_key_xtn, ssl_ext_native_only },
- { ssl_tls13_early_data_xtn, ssl_ext_native_only },
- { ssl_tls13_supported_versions_xtn, ssl_ext_native_only },
- { ssl_tls13_cookie_xtn, ssl_ext_native_only },
- { ssl_tls13_psk_key_exchange_modes_xtn, ssl_ext_native_only },
- { ssl_tls13_ticket_early_data_info_xtn, ssl_ext_native_only },
- { ssl_tls13_certificate_authorities_xtn, ssl_ext_native },
- { ssl_next_proto_nego_xtn, ssl_ext_none },
- { ssl_renegotiation_info_xtn, ssl_ext_native }
+static const ssl3HelloExtensionSender clientHelloSendersSSL3[SSL_MAX_EXTENSIONS] = {
+ { ssl_renegotiation_info_xtn, &ssl3_SendRenegotiationInfoXtn }
+ /* any extra entries will appear as { 0, NULL } */
};
-static SSLExtensionSupport
-ssl_GetExtensionSupport(PRUint16 type)
-{
- unsigned int i;
- for (i = 0; i < PR_ARRAY_SIZE(ssl_supported_extensions); ++i) {
- if (type == ssl_supported_extensions[i].type) {
- return ssl_supported_extensions[i].support;
- }
- }
- return ssl_ext_none;
-}
-
-SECStatus
-SSLExp_GetExtensionSupport(PRUint16 type, SSLExtensionSupport *support)
-{
- *support = ssl_GetExtensionSupport(type);
- return SECSuccess;
-}
-
-SECStatus
-SSLExp_InstallExtensionHooks(PRFileDesc *fd, PRUint16 extension,
- SSLExtensionWriter writer, void *writerArg,
- SSLExtensionHandler handler, void *handlerArg)
-{
- sslSocket *ss = ssl_FindSocket(fd);
- PRCList *cursor;
- sslCustomExtensionHooks *hook;
-
- if (!ss) {
- return SECFailure; /* Code already set. */
- }
-
- /* Need to specify both or neither, but not just one. */
- if ((writer && !handler) || (!writer && handler)) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- return SECFailure;
- }
-
- if (ssl_GetExtensionSupport(extension) == ssl_ext_native_only) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- return SECFailure;
- }
-
- if (ss->firstHsDone || ((ss->ssl3.hs.ws != idle_handshake) &&
- (ss->ssl3.hs.ws != wait_client_hello))) {
- PORT_SetError(PR_INVALID_STATE_ERROR);
- return SECFailure;
- }
-
- /* Remove any old handler. */
- for (cursor = PR_NEXT_LINK(&ss->extensionHooks);
- cursor != &ss->extensionHooks;
- cursor = PR_NEXT_LINK(cursor)) {
- hook = (sslCustomExtensionHooks *)cursor;
- if (hook->type == extension) {
- PR_REMOVE_LINK(&hook->link);
- PORT_Free(hook);
- break;
- }
- }
-
- if (!writer && !handler) {
- return SECSuccess;
- }
-
- hook = PORT_ZNew(sslCustomExtensionHooks);
- if (!hook) {
- return SECFailure; /* This removed the old one, oh well. */
- }
-
- hook->type = extension;
- hook->writer = writer;
- hook->writerArg = writerArg;
- hook->handler = handler;
- hook->handlerArg = handlerArg;
- PR_APPEND_LINK(&hook->link, &ss->extensionHooks);
- return SECSuccess;
-}
-
-static sslCustomExtensionHooks *
-ssl_FindCustomExtensionHooks(sslSocket *ss, PRUint16 extension)
-{
- PRCList *cursor;
-
- for (cursor = PR_NEXT_LINK(&ss->extensionHooks);
- cursor != &ss->extensionHooks;
- cursor = PR_NEXT_LINK(cursor)) {
- sslCustomExtensionHooks *hook = (sslCustomExtensionHooks *)cursor;
- if (hook->type == extension) {
- return hook;
- }
- }
-
- return NULL;
-}
-
static PRBool
arrayContainsExtension(const PRUint16 *array, PRUint32 len, PRUint16 ex_type)
{
@@ -302,11 +156,8 @@ ssl3_ExtensionNegotiated(const sslSocket *ss, PRUint16 ex_type)
xtnData->numNegotiated, ex_type);
}
-/* This checks for whether an extension was advertised. On the client, this
- * covers extensions that are sent in ClientHello; on the server, extensions
- * sent in CertificateRequest (TLS 1.3 only). */
PRBool
-ssl3_ExtensionAdvertised(const sslSocket *ss, PRUint16 ex_type)
+ssl3_ClientExtensionAdvertised(const sslSocket *ss, PRUint16 ex_type)
{
const TLSExtensionData *xtnData = &ss->xtnData;
return arrayContainsExtension(xtnData->advertised,
@@ -389,44 +240,6 @@ ssl3_FindExtension(sslSocket *ss, SSLExtensionType extension_type)
return NULL;
}
-static SECStatus
-ssl_CallExtensionHandler(sslSocket *ss, SSLHandshakeType handshakeMessage,
- TLSExtension *extension,
- const ssl3ExtensionHandler *handler)
-{
- SECStatus rv = SECSuccess;
- SSLAlertDescription alert = handshake_failure;
- sslCustomExtensionHooks *customHooks;
-
- customHooks = ssl_FindCustomExtensionHooks(ss, extension->type);
- if (customHooks) {
- if (customHooks->handler) {
- rv = customHooks->handler(ss->fd, handshakeMessage,
- extension->data.data,
- extension->data.len,
- &alert, customHooks->handlerArg);
- }
- } else {
- /* Find extension_type in table of Hello Extension Handlers. */
- for (; handler->ex_handler != NULL; ++handler) {
- if (handler->ex_type == extension->type) {
- rv = (*handler->ex_handler)(ss, &ss->xtnData, &extension->data);
- break;
- }
- }
- }
-
- if (rv != SECSuccess) {
- if (!ss->ssl3.fatalAlertSent) {
- /* Send an alert if the handler didn't already. */
- (void)SSL3_SendAlert(ss, alert_fatal, alert);
- }
- return SECFailure;
- }
-
- return SECSuccess;
-}
-
/* Go through the hello extensions in |ss->ssl3.hs.remoteExtensions|.
* For each one, find the extension handler in the table, and
* if present, invoke that handler.
@@ -437,46 +250,42 @@ ssl_CallExtensionHandler(sslSocket *ss, SSLHandshakeType handshakeMessage,
* right phase.
*/
SECStatus
-ssl3_HandleParsedExtensions(sslSocket *ss, SSLHandshakeType message)
+ssl3_HandleParsedExtensions(sslSocket *ss,
+ SSL3HandshakeType handshakeMessage)
{
const ssl3ExtensionHandler *handlers;
/* HelloRetryRequest doesn't set ss->version. It might be safe to
* do so, but we weren't entirely sure. TODO(ekr@rtfm.com). */
PRBool isTLS13 = (ss->version >= SSL_LIBRARY_VERSION_TLS_1_3) ||
- (message == ssl_hs_hello_retry_request);
- /* The following messages can include extensions that were not included in
- * the original ClientHello. */
- PRBool allowNotOffered = (message == ssl_hs_client_hello) ||
- (message == ssl_hs_certificate_request) ||
- (message == ssl_hs_new_session_ticket);
+ (handshakeMessage == hello_retry_request);
PRCList *cursor;
- switch (message) {
- case ssl_hs_client_hello:
+ switch (handshakeMessage) {
+ case client_hello:
handlers = clientHelloHandlers;
break;
- case ssl_hs_new_session_ticket:
+ case new_session_ticket:
PORT_Assert(ss->version >= SSL_LIBRARY_VERSION_TLS_1_3);
handlers = newSessionTicketHandlers;
break;
- case ssl_hs_hello_retry_request:
+ case hello_retry_request:
handlers = helloRetryRequestHandlers;
break;
- case ssl_hs_encrypted_extensions:
+ case encrypted_extensions:
PORT_Assert(ss->version >= SSL_LIBRARY_VERSION_TLS_1_3);
/* fall through */
- case ssl_hs_server_hello:
+ case server_hello:
if (ss->version > SSL_LIBRARY_VERSION_3_0) {
handlers = serverHelloHandlersTLS;
} else {
handlers = serverHelloHandlersSSL3;
}
break;
- case ssl_hs_certificate:
+ case certificate:
PORT_Assert(!ss->sec.isServer);
handlers = serverCertificateHandlers;
break;
- case ssl_hs_certificate_request:
+ case certificate_request:
PORT_Assert(!ss->sec.isServer);
handlers = certificateRequestHandlers;
break;
@@ -490,39 +299,28 @@ ssl3_HandleParsedExtensions(sslSocket *ss, SSLHandshakeType message)
cursor != &ss->ssl3.hs.remoteExtensions;
cursor = PR_NEXT_LINK(cursor)) {
TLSExtension *extension = (TLSExtension *)cursor;
- SECStatus rv;
+ const ssl3ExtensionHandler *handler;
/* Check whether the server sent an extension which was not advertised
- * in the ClientHello.
- *
- * Note that a TLS 1.3 server should check if CertificateRequest
- * extensions were sent. But the extensions used for CertificateRequest
- * do not have any response, so we rely on
- * ssl3_ExtensionAdvertised to return false on the server. That
- * results in the server only rejecting any extension. */
- if (!allowNotOffered && (extension->type != ssl_tls13_cookie_xtn) &&
- !ssl3_ExtensionAdvertised(ss, extension->type)) {
+ * in the ClientHello */
+ if (!ss->sec.isServer &&
+ !ssl3_ClientExtensionAdvertised(ss, extension->type) &&
+ (handshakeMessage != new_session_ticket) &&
+ (extension->type != ssl_tls13_cookie_xtn)) {
(void)SSL3_SendAlert(ss, alert_fatal, unsupported_extension);
PORT_SetError(SSL_ERROR_RX_UNEXPECTED_EXTENSION);
return SECFailure;
}
/* Check that this is a legal extension in TLS 1.3 */
- if (isTLS13 &&
- !ssl_FindCustomExtensionHooks(ss, extension->type)) {
- switch (tls13_ExtensionStatus(extension->type, message)) {
- case tls13_extension_allowed:
- break;
- case tls13_extension_unknown:
- if (allowNotOffered) {
- continue; /* Skip over unknown extensions. */
- }
- /* Fall through. */
- case tls13_extension_disallowed:
- tls13_FatalError(ss, SSL_ERROR_EXTENSION_DISALLOWED_FOR_VERSION,
- unsupported_extension);
- return SECFailure;
+ if (isTLS13 && !tls13_ExtensionAllowed(extension->type, handshakeMessage)) {
+ if (handshakeMessage == client_hello) {
+ /* Skip extensions not used in TLS 1.3 */
+ continue;
}
+ tls13_FatalError(ss, SSL_ERROR_EXTENSION_DISALLOWED_FOR_VERSION,
+ unsupported_extension);
+ return SECFailure;
}
/* Special check for this being the last extension if it's
@@ -536,9 +334,23 @@ ssl3_HandleParsedExtensions(sslSocket *ss, SSLHandshakeType message)
return SECFailure;
}
- rv = ssl_CallExtensionHandler(ss, message, extension, handlers);
- if (rv != SECSuccess) {
- return SECFailure;
+ /* find extension_type in table of Hello Extension Handlers */
+ for (handler = handlers; handler->ex_type >= 0; handler++) {
+ /* if found, call this handler */
+ if (handler->ex_type == extension->type) {
+ SECStatus rv;
+
+ rv = (*handler->ex_handler)(ss, &ss->xtnData,
+ (PRUint16)extension->type,
+ &extension->data);
+ if (rv != SECSuccess) {
+ if (!ss->ssl3.fatalAlertSent) {
+ /* send a generic alert if the handler didn't already */
+ (void)SSL3_SendAlert(ss, alert_fatal, handshake_failure);
+ }
+ return SECFailure;
+ }
+ }
}
}
return SECSuccess;
@@ -549,7 +361,7 @@ ssl3_HandleParsedExtensions(sslSocket *ss, SSLHandshakeType message)
SECStatus
ssl3_HandleExtensions(sslSocket *ss,
PRUint8 **b, PRUint32 *length,
- SSLHandshakeType handshakeMessage)
+ SSL3HandshakeType handshakeMessage)
{
SECStatus rv;
@@ -571,30 +383,21 @@ SECStatus
ssl3_RegisterExtensionSender(const sslSocket *ss,
TLSExtensionData *xtnData,
PRUint16 ex_type,
- sslExtensionBuilderFunc cb)
+ ssl3HelloExtensionSenderFunc cb)
{
int i;
- sslExtensionBuilder *sender;
+ ssl3HelloExtensionSender *sender;
if (ss->version < SSL_LIBRARY_VERSION_TLS_1_3) {
sender = &xtnData->serverHelloSenders[0];
} else {
- if (tls13_ExtensionStatus(ex_type, ssl_hs_server_hello) ==
- tls13_extension_allowed) {
- PORT_Assert(tls13_ExtensionStatus(ex_type,
- ssl_hs_encrypted_extensions) ==
- tls13_extension_disallowed);
+ if (tls13_ExtensionAllowed(ex_type, server_hello)) {
+ PORT_Assert(!tls13_ExtensionAllowed(ex_type, encrypted_extensions));
sender = &xtnData->serverHelloSenders[0];
- } else if (tls13_ExtensionStatus(ex_type,
- ssl_hs_encrypted_extensions) ==
- tls13_extension_allowed) {
- sender = &xtnData->encryptedExtensionsSenders[0];
- } else if (tls13_ExtensionStatus(ex_type, ssl_hs_certificate) ==
- tls13_extension_allowed) {
+ } else if (tls13_ExtensionAllowed(ex_type, certificate)) {
sender = &xtnData->certificateSenders[0];
} else {
- PORT_Assert(0);
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
+ PORT_Assert(tls13_ExtensionAllowed(ex_type, encrypted_extensions));
+ sender = &xtnData->encryptedExtensionsSenders[0];
}
}
for (i = 0; i < SSL_MAX_EXTENSIONS; ++i, ++sender) {
@@ -615,289 +418,32 @@ ssl3_RegisterExtensionSender(const sslSocket *ss,
return SECFailure;
}
-static SECStatus
-ssl_CallCustomExtensionSenders(sslSocket *ss, sslBuffer *buf,
- SSLHandshakeType message)
+/* call each of the extension senders and return the accumulated length */
+PRInt32
+ssl3_CallHelloExtensionSenders(sslSocket *ss, PRBool append, PRUint32 maxBytes,
+ const ssl3HelloExtensionSender *sender)
{
- sslBuffer tail = SSL_BUFFER_EMPTY;
- SECStatus rv;
- PRCList *cursor;
-
- /* Save any extensions that want to be last. */
- if (ss->xtnData.lastXtnOffset) {
- rv = sslBuffer_Append(&tail, buf->buf + ss->xtnData.lastXtnOffset,
- buf->len - ss->xtnData.lastXtnOffset);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- buf->len = ss->xtnData.lastXtnOffset;
- }
-
- /* Reserve the maximum amount of space possible. */
- rv = sslBuffer_Grow(buf, 65535);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- for (cursor = PR_NEXT_LINK(&ss->extensionHooks);
- cursor != &ss->extensionHooks;
- cursor = PR_NEXT_LINK(cursor)) {
- sslCustomExtensionHooks *hook =
- (sslCustomExtensionHooks *)cursor;
- PRBool append = PR_FALSE;
- unsigned int len = 0;
-
- if (hook->writer) {
- /* The writer writes directly into |buf|. Provide space that allows
- * for the existing extensions, any tail, plus type and length. */
- unsigned int space = buf->space - (buf->len + tail.len + 4);
- append = (*hook->writer)(ss->fd, message,
- buf->buf + buf->len + 4, &len, space,
- hook->writerArg);
- if (len > space) {
- PORT_SetError(SEC_ERROR_APPLICATION_CALLBACK_ERROR);
- goto loser;
- }
- }
- if (!append) {
- continue;
- }
-
- rv = sslBuffer_AppendNumber(buf, hook->type, 2);
- if (rv != SECSuccess) {
- goto loser; /* Code already set. */
- }
- rv = sslBuffer_AppendNumber(buf, len, 2);
- if (rv != SECSuccess) {
- goto loser; /* Code already set. */
- }
- buf->len += len;
-
- if (message == ssl_hs_client_hello ||
- message == ssl_hs_certificate_request) {
- ss->xtnData.advertised[ss->xtnData.numAdvertised++] = hook->type;
- }
- }
-
- sslBuffer_Append(buf, tail.buf, tail.len);
- sslBuffer_Clear(&tail);
- return SECSuccess;
-
-loser:
- sslBuffer_Clear(&tail);
- return SECFailure;
-}
-
-/* Call extension handlers for the given message. */
-SECStatus
-ssl_ConstructExtensions(sslSocket *ss, sslBuffer *buf, SSLHandshakeType message)
-{
- const sslExtensionBuilder *sender;
- SECStatus rv;
-
- PORT_Assert(buf->len == 0);
-
- switch (message) {
- case ssl_hs_client_hello:
- if (ss->vrange.max > SSL_LIBRARY_VERSION_3_0) {
- sender = clientHelloSendersTLS;
- } else {
- sender = clientHelloSendersSSL3;
- }
- break;
-
- case ssl_hs_server_hello:
- sender = ss->xtnData.serverHelloSenders;
- break;
-
- case ssl_hs_certificate_request:
- PORT_Assert(ss->version >= SSL_LIBRARY_VERSION_TLS_1_3);
- sender = tls13_cert_req_senders;
- break;
-
- case ssl_hs_certificate:
- PORT_Assert(ss->version >= SSL_LIBRARY_VERSION_TLS_1_3);
- sender = ss->xtnData.certificateSenders;
- break;
-
- case ssl_hs_encrypted_extensions:
- PORT_Assert(ss->version >= SSL_LIBRARY_VERSION_TLS_1_3);
- sender = ss->xtnData.encryptedExtensionsSenders;
- break;
-
- case ssl_hs_hello_retry_request:
- PORT_Assert(ss->version >= SSL_LIBRARY_VERSION_TLS_1_3);
- sender = tls13_hrr_senders;
- break;
-
- default:
- PORT_Assert(0);
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
- }
-
- for (; sender->ex_sender != NULL; ++sender) {
- PRBool append = PR_FALSE;
- unsigned int start = buf->len;
- unsigned int length;
-
- if (ssl_FindCustomExtensionHooks(ss, sender->ex_type)) {
- continue;
- }
-
- /* Save space for the extension type and length. Note that we don't grow
- * the buffer now; rely on sslBuffer_Append* to do that. */
- buf->len += 4;
- rv = (*sender->ex_sender)(ss, &ss->xtnData, buf, &append);
- if (rv != SECSuccess) {
- goto loser;
- }
-
- /* Save the length and go back to the start. */
- length = buf->len - start - 4;
- buf->len = start;
- if (!append) {
- continue;
- }
-
- buf->len = start;
- rv = sslBuffer_AppendNumber(buf, sender->ex_type, 2);
- if (rv != SECSuccess) {
- goto loser; /* Code already set. */
- }
- rv = sslBuffer_AppendNumber(buf, length, 2);
- if (rv != SECSuccess) {
- goto loser; /* Code already set. */
- }
- /* Skip over the extension body. */
- buf->len += length;
-
- if (message == ssl_hs_client_hello ||
- message == ssl_hs_certificate_request) {
- ss->xtnData.advertised[ss->xtnData.numAdvertised++] =
- sender->ex_type;
- }
- }
+ PRInt32 total_exten_len = 0;
+ int i;
- if (!PR_CLIST_IS_EMPTY(&ss->extensionHooks)) {
- rv = ssl_CallCustomExtensionSenders(ss, buf, message);
- if (rv != SECSuccess) {
- goto loser;
+ if (!sender) {
+ if (ss->vrange.max > SSL_LIBRARY_VERSION_3_0) {
+ sender = &clientHelloSendersTLS[0];
+ } else {
+ sender = &clientHelloSendersSSL3[0];
}
}
- if (buf->len > 0xffff) {
- PORT_SetError(SSL_ERROR_TX_RECORD_TOO_LONG);
- goto loser;
- }
-
- return SECSuccess;
-
-loser:
- sslBuffer_Clear(buf);
- return SECFailure;
-}
-
-/* This extension sender can be used anywhere that an always empty extension is
- * needed. Mostly that is for ServerHello where sender registration is dynamic;
- * ClientHello senders are usually conditional in some way. */
-SECStatus
-ssl_SendEmptyExtension(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *append)
-{
- *append = PR_TRUE;
- return SECSuccess;
-}
-
-/* Takes the size of the ClientHello, less the record header, and determines how
- * much padding is required. */
-static unsigned int
-ssl_CalculatePaddingExtLen(const sslSocket *ss, unsigned int clientHelloLength)
-{
- unsigned int recordLength = 1 /* handshake message type */ +
- 3 /* handshake message length */ +
- clientHelloLength;
- unsigned int extensionLen;
-
- /* Don't pad for DTLS, for SSLv3, or for renegotiation. */
- if (IS_DTLS(ss) ||
- ss->vrange.max < SSL_LIBRARY_VERSION_TLS_1_0 ||
- ss->firstHsDone) {
- return 0;
- }
-
- /* A padding extension may be included to ensure that the record containing
- * the ClientHello doesn't have a length between 256 and 511 bytes
- * (inclusive). Initial ClientHello records with such lengths trigger bugs
- * in F5 devices. */
- if (recordLength < 256 || recordLength >= 512) {
- return 0;
- }
-
- extensionLen = 512 - recordLength;
- /* Extensions take at least four bytes to encode. Always include at least
- * one byte of data if we are padding. Some servers will time out or
- * terminate the connection if the last ClientHello extension is empty. */
- if (extensionLen < 5) {
- extensionLen = 5;
- }
-
- return extensionLen - 4;
-}
-
-/* ssl3_SendPaddingExtension possibly adds an extension which ensures that a
- * ClientHello record is either < 256 bytes or is >= 512 bytes. This ensures
- * that we don't trigger bugs in F5 products.
- *
- * This takes an existing extension buffer, |buf|, and the length of the
- * remainder of the ClientHello, |prefixLen|. It modifies the extension buffer
- * to insert padding at the right place.
- */
-SECStatus
-ssl_InsertPaddingExtension(const sslSocket *ss, unsigned int prefixLen,
- sslBuffer *buf)
-{
- static unsigned char padding[252] = { 0 };
- unsigned int paddingLen;
- unsigned int tailLen;
- SECStatus rv;
-
- /* Account for the size of the header, the length field of the extensions
- * block and the size of the existing extensions. */
- paddingLen = ssl_CalculatePaddingExtLen(ss, prefixLen + 2 + buf->len);
- if (!paddingLen) {
- return SECSuccess;
- }
-
- /* Move the tail if there is one. This only happens if we are sending the
- * TLS 1.3 PSK extension, which needs to be at the end. */
- if (ss->xtnData.lastXtnOffset) {
- PORT_Assert(buf->len > ss->xtnData.lastXtnOffset);
- tailLen = buf->len - ss->xtnData.lastXtnOffset;
- rv = sslBuffer_Grow(buf, buf->len + 4 + paddingLen);
- if (rv != SECSuccess) {
- return SECFailure;
+ for (i = 0; i < SSL_MAX_EXTENSIONS; ++i, ++sender) {
+ if (sender->ex_sender) {
+ PRInt32 extLen = (*sender->ex_sender)(ss, &ss->xtnData, append, maxBytes);
+ if (extLen < 0)
+ return -1;
+ maxBytes -= extLen;
+ total_exten_len += extLen;
}
- PORT_Memmove(buf->buf + ss->xtnData.lastXtnOffset + 4 + paddingLen,
- buf->buf + ss->xtnData.lastXtnOffset,
- tailLen);
- buf->len = ss->xtnData.lastXtnOffset;
- } else {
- tailLen = 0;
}
-
- rv = sslBuffer_AppendNumber(buf, ssl_padding_xtn, 2);
- if (rv != SECSuccess) {
- return SECFailure; /* Code already set. */
- }
- rv = sslBuffer_AppendVariable(buf, padding, paddingLen, 2);
- if (rv != SECSuccess) {
- return SECFailure; /* Code already set. */
- }
-
- buf->len += tailLen;
-
- return SECSuccess;
+ return total_exten_len;
}
void
@@ -914,59 +460,52 @@ ssl3_DestroyRemoteExtensions(PRCList *list)
/* Initialize the extension data block. */
void
-ssl3_InitExtensionData(TLSExtensionData *xtnData, const sslSocket *ss)
+ssl3_InitExtensionData(TLSExtensionData *xtnData)
{
- unsigned int advertisedMax;
- PRCList *cursor;
-
/* Set things up to the right starting state. */
PORT_Memset(xtnData, 0, sizeof(*xtnData));
xtnData->peerSupportsFfdheGroups = PR_FALSE;
PR_INIT_CLIST(&xtnData->remoteKeyShares);
-
- /* Allocate enough to allow for native extensions, plus any custom ones. */
- if (ss->sec.isServer) {
- advertisedMax = PR_MAX(PR_ARRAY_SIZE(certificateRequestHandlers),
- PR_ARRAY_SIZE(tls13_cert_req_senders));
- } else {
- advertisedMax = PR_MAX(PR_ARRAY_SIZE(clientHelloHandlers),
- PR_ARRAY_SIZE(clientHelloSendersTLS));
- ++advertisedMax; /* For the RI SCSV, which we also track. */
- }
- for (cursor = PR_NEXT_LINK(&ss->extensionHooks);
- cursor != &ss->extensionHooks;
- cursor = PR_NEXT_LINK(cursor)) {
- ++advertisedMax;
- }
- xtnData->advertised = PORT_ZNewArray(PRUint16, advertisedMax);
}
+/* Free everything that has been allocated and then reset back to
+ * the starting state. */
void
-ssl3_DestroyExtensionData(TLSExtensionData *xtnData)
+ssl3_ResetExtensionData(TLSExtensionData *xtnData)
{
+ /* Clean up. */
ssl3_FreeSniNameArray(xtnData);
- PORT_Free(xtnData->sigSchemes);
+ PORT_Free(xtnData->clientSigSchemes);
SECITEM_FreeItem(&xtnData->nextProto, PR_FALSE);
tls13_DestroyKeyShares(&xtnData->remoteKeyShares);
- SECITEM_FreeItem(&xtnData->certReqContext, PR_FALSE);
- SECITEM_FreeItem(&xtnData->applicationToken, PR_FALSE);
- if (xtnData->certReqAuthorities.arena) {
- PORT_FreeArena(xtnData->certReqAuthorities.arena, PR_FALSE);
- xtnData->certReqAuthorities.arena = NULL;
- }
- PORT_Free(xtnData->advertised);
+
+ /* Now reinit. */
+ ssl3_InitExtensionData(xtnData);
}
-/* Free everything that has been allocated and then reset back to
- * the starting state. */
-void
-ssl3_ResetExtensionData(TLSExtensionData *xtnData, const sslSocket *ss)
+/* Thunks to let extension handlers operate on const sslSocket* objects. */
+SECStatus
+ssl3_ExtAppendHandshake(const sslSocket *ss, const void *void_src,
+ PRInt32 bytes)
{
- ssl3_DestroyExtensionData(xtnData);
- ssl3_InitExtensionData(xtnData, ss);
+ return ssl3_AppendHandshake((sslSocket *)ss, void_src, bytes);
+}
+
+SECStatus
+ssl3_ExtAppendHandshakeNumber(const sslSocket *ss, PRInt32 num,
+ PRInt32 lenSize)
+{
+ return ssl3_AppendHandshakeNumber((sslSocket *)ss, num, lenSize);
+}
+
+SECStatus
+ssl3_ExtAppendHandshakeVariable(const sslSocket *ss,
+ const PRUint8 *src, PRInt32 bytes,
+ PRInt32 lenSize)
+{
+ return ssl3_AppendHandshakeVariable((sslSocket *)ss, src, bytes, lenSize);
}
-/* Thunks to let extension handlers operate on const sslSocket* objects. */
void
ssl3_ExtSendAlert(const sslSocket *ss, SSL3AlertLevel level,
SSL3AlertDescription desc)
diff --git a/security/nss/lib/ssl/ssl3ext.h b/security/nss/lib/ssl/ssl3ext.h
index d0f75a599a..90407375ad 100644
--- a/security/nss/lib/ssl/ssl3ext.h
+++ b/security/nss/lib/ssl/ssl3ext.h
@@ -9,38 +9,54 @@
#ifndef __ssl3ext_h_
#define __ssl3ext_h_
-#include "sslencode.h"
-
typedef enum {
sni_nametype_hostname
} SNINameType;
typedef struct TLSExtensionDataStr TLSExtensionData;
-/* Registerable callback function that either appends extension to buffer
+/* registerable callback function that either appends extension to buffer
* or returns length of data that it would have appended.
*/
-typedef SECStatus (*sslExtensionBuilderFunc)(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added);
+typedef PRInt32 (*ssl3HelloExtensionSenderFunc)(const sslSocket *ss,
+ TLSExtensionData *xtnData,
+ PRBool append,
+ PRUint32 maxBytes);
+
+/* registerable callback function that handles a received extension,
+ * of the given type.
+ */
+typedef SECStatus (*ssl3ExtensionHandlerFunc)(const sslSocket *ss,
+ TLSExtensionData *xtnData,
+ PRUint16 ex_type,
+ SECItem *data);
/* row in a table of hello extension senders */
typedef struct {
PRInt32 ex_type;
- sslExtensionBuilderFunc ex_sender;
-} sslExtensionBuilder;
+ ssl3HelloExtensionSenderFunc ex_sender;
+} ssl3HelloExtensionSender;
+
+/* row in a table of hello extension handlers */
+typedef struct {
+ PRInt32 ex_type;
+ ssl3ExtensionHandlerFunc ex_handler;
+} ssl3ExtensionHandler;
struct TLSExtensionDataStr {
/* registered callbacks that send server hello extensions */
- sslExtensionBuilder serverHelloSenders[SSL_MAX_EXTENSIONS];
- sslExtensionBuilder encryptedExtensionsSenders[SSL_MAX_EXTENSIONS];
- sslExtensionBuilder certificateSenders[SSL_MAX_EXTENSIONS];
+ ssl3HelloExtensionSender serverHelloSenders[SSL_MAX_EXTENSIONS];
+ ssl3HelloExtensionSender encryptedExtensionsSenders[SSL_MAX_EXTENSIONS];
+ ssl3HelloExtensionSender certificateSenders[SSL_MAX_EXTENSIONS];
- /* Keep track of the extensions that are advertised or negotiated. */
+ /* Keep track of the extensions that are negotiated. */
PRUint16 numAdvertised;
- PRUint16 *advertised; /* Allocated dynamically. */
PRUint16 numNegotiated;
+ PRUint16 advertised[SSL_MAX_EXTENSIONS];
PRUint16 negotiated[SSL_MAX_EXTENSIONS];
+ /* Amount of padding we need to add. */
+ PRUint16 paddingLen;
+
/* SessionTicket Extension related data. */
PRBool ticketTimestampVerified;
PRBool emptySessionTicket;
@@ -70,13 +86,10 @@ struct TLSExtensionDataStr {
PRBool peerSupportsFfdheGroups; /* if the peer supports named ffdhe groups */
/* clientSigAndHash contains the contents of the signature_algorithms
- * extension (if any) the other side supports. This is only valid for TLS
- * 1.2 or later. In TLS 1.3, it is also used for CertificateRequest. */
- SSLSignatureScheme *sigSchemes;
- unsigned int numSigSchemes;
-
- SECItem certReqContext;
- CERTDistNames certReqAuthorities;
+ * extension (if any) from the client. This is only valid for TLS 1.2
+ * or later. */
+ SSLSignatureScheme *clientSigSchemes;
+ unsigned int numClientSigScheme;
/* In a client: if the server supports Next Protocol Negotiation, then
* this is the protocol that was negotiated.
@@ -86,18 +99,9 @@ struct TLSExtensionDataStr {
PRUint16 dtlsSRTPCipherSuite; /* 0 if not selected */
- unsigned int lastXtnOffset; /* Where to insert padding. 0 = end. */
- PRCList remoteKeyShares; /* The other side's public keys (TLS 1.3) */
-
- /* The following are used by a TLS 1.3 server. */
- SECItem pskBinder; /* The binder for the first PSK. */
- unsigned int pskBindersLen; /* The length of the binders. */
- PRUint32 ticketAge; /* Used to accept early data. */
- SECItem cookie; /* HRR Cookie. */
- const sslNamedGroupDef *selectedGroup; /* For HRR. */
- /* The application token contains a value that was passed to the client via
- * a session ticket, or the cookie in a HelloRetryRequest. */
- SECItem applicationToken;
+ SECItem pskBinder; /* The PSK binder for the first PSK (TLS 1.3) */
+ unsigned long pskBinderPrefixLen; /* The length of the binder input. */
+ PRCList remoteKeyShares; /* The other side's public keys (TLS 1.3) */
};
typedef struct TLSExtensionStr {
@@ -106,44 +110,40 @@ typedef struct TLSExtensionStr {
SECItem data; /* Pointers into the handshake data. */
} TLSExtension;
-typedef struct sslCustomExtensionHooks {
- PRCList link;
- PRUint16 type;
- SSLExtensionWriter writer;
- void *writerArg;
- SSLExtensionHandler handler;
- void *handlerArg;
-} sslCustomExtensionHooks;
-
SECStatus ssl3_HandleExtensions(sslSocket *ss,
PRUint8 **b, PRUint32 *length,
- SSLHandshakeType handshakeMessage);
+ SSL3HandshakeType handshakeMessage);
SECStatus ssl3_ParseExtensions(sslSocket *ss,
PRUint8 **b, PRUint32 *length);
SECStatus ssl3_HandleParsedExtensions(sslSocket *ss,
- SSLHandshakeType handshakeMessage);
+ SSL3HandshakeType handshakeMessage);
TLSExtension *ssl3_FindExtension(sslSocket *ss,
SSLExtensionType extension_type);
void ssl3_DestroyRemoteExtensions(PRCList *list);
-void ssl3_InitExtensionData(TLSExtensionData *xtnData, const sslSocket *ss);
-void ssl3_DestroyExtensionData(TLSExtensionData *xtnData);
-void ssl3_ResetExtensionData(TLSExtensionData *xtnData, const sslSocket *ss);
+void ssl3_InitExtensionData(TLSExtensionData *xtnData);
+void ssl3_ResetExtensionData(TLSExtensionData *xtnData);
PRBool ssl3_ExtensionNegotiated(const sslSocket *ss, PRUint16 ex_type);
-PRBool ssl3_ExtensionAdvertised(const sslSocket *ss, PRUint16 ex_type);
+PRBool ssl3_ClientExtensionAdvertised(const sslSocket *ss, PRUint16 ex_type);
SECStatus ssl3_RegisterExtensionSender(const sslSocket *ss,
TLSExtensionData *xtnData,
PRUint16 ex_type,
- sslExtensionBuilderFunc cb);
-SECStatus ssl_ConstructExtensions(sslSocket *ss, sslBuffer *buf,
- SSLHandshakeType message);
-SECStatus ssl_SendEmptyExtension(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *append);
-SECStatus ssl_InsertPaddingExtension(const sslSocket *ss, unsigned int prefixLen,
- sslBuffer *buf);
+ ssl3HelloExtensionSenderFunc cb);
+PRInt32 ssl3_CallHelloExtensionSenders(sslSocket *ss, PRBool append, PRUint32 maxBytes,
+ const ssl3HelloExtensionSender *sender);
+
+void ssl3_CalculatePaddingExtLen(sslSocket *ss,
+ unsigned int clientHelloLength);
/* Thunks to let us operate on const sslSocket* objects. */
+SECStatus ssl3_ExtAppendHandshake(const sslSocket *ss, const void *void_src,
+ PRInt32 bytes);
+SECStatus ssl3_ExtAppendHandshakeNumber(const sslSocket *ss, PRInt32 num,
+ PRInt32 lenSize);
+SECStatus ssl3_ExtAppendHandshakeVariable(const sslSocket *ss,
+ const PRUint8 *src, PRInt32 bytes,
+ PRInt32 lenSize);
void ssl3_ExtSendAlert(const sslSocket *ss, SSL3AlertLevel level,
SSL3AlertDescription desc);
void ssl3_ExtDecodeError(const sslSocket *ss);
@@ -156,10 +156,4 @@ SECStatus ssl3_ExtConsumeHandshakeVariable(const sslSocket *ss, SECItem *i,
PRUint32 bytes, PRUint8 **b,
PRUint32 *length);
-SECStatus SSLExp_GetExtensionSupport(PRUint16 type,
- SSLExtensionSupport *support);
-SECStatus SSLExp_InstallExtensionHooks(
- PRFileDesc *fd, PRUint16 extension, SSLExtensionWriter writer,
- void *writerArg, SSLExtensionHandler handler, void *handlerArg);
-
#endif
diff --git a/security/nss/lib/ssl/ssl3exthandle.c b/security/nss/lib/ssl/ssl3exthandle.c
index c0fbda7ab8..370bd8b3e4 100644
--- a/security/nss/lib/ssl/ssl3exthandle.c
+++ b/security/nss/lib/ssl/ssl3exthandle.c
@@ -13,6 +13,7 @@
#include "blapit.h"
#include "prinit.h"
#include "selfencrypt.h"
+#include "ssl3encode.h"
#include "ssl3ext.h"
#include "ssl3exthandle.h"
#include "tls13exthandle.h" /* For tls13_ServerSendStatusRequestXtn. */
@@ -21,48 +22,70 @@
* unless that name is a dotted decimal string.
* Used by client and server.
*/
-SECStatus
-ssl3_ClientSendServerNameXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
+PRInt32
+ssl3_SendServerNameXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRBool append,
+ PRUint32 maxBytes)
{
- unsigned int len;
- PRNetAddr netAddr;
SECStatus rv;
-
- /* must have a hostname */
- if (!ss->url || !ss->url[0]) {
- return SECSuccess;
- }
- /* must not be an IPv4 or IPv6 address */
- if (PR_SUCCESS == PR_StringToNetAddr(ss->url, &netAddr)) {
- /* is an IP address (v4 or v6) */
- return SECSuccess;
- }
- len = PORT_Strlen(ss->url);
- /* length of server_name_list */
- rv = sslBuffer_AppendNumber(buf, len + 3, 2);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- /* Name Type (sni_host_name) */
- rv = sslBuffer_AppendNumber(buf, 0, 1);
- if (rv != SECSuccess) {
- return SECFailure;
+ if (!ss)
+ return 0;
+ if (!ss->sec.isServer) {
+ PRUint32 len;
+ PRNetAddr netAddr;
+
+ /* must have a hostname */
+ if (!ss->url || !ss->url[0])
+ return 0;
+ /* must not be an IPv4 or IPv6 address */
+ if (PR_SUCCESS == PR_StringToNetAddr(ss->url, &netAddr)) {
+ /* is an IP address (v4 or v6) */
+ return 0;
+ }
+ len = PORT_Strlen(ss->url);
+ if (append && maxBytes >= len + 9) {
+ /* extension_type */
+ rv = ssl3_ExtAppendHandshakeNumber(ss, ssl_server_name_xtn, 2);
+ if (rv != SECSuccess)
+ return -1;
+ /* length of extension_data */
+ rv = ssl3_ExtAppendHandshakeNumber(ss, len + 5, 2);
+ if (rv != SECSuccess)
+ return -1;
+ /* length of server_name_list */
+ rv = ssl3_ExtAppendHandshakeNumber(ss, len + 3, 2);
+ if (rv != SECSuccess)
+ return -1;
+ /* Name Type (sni_host_name) */
+ rv = ssl3_ExtAppendHandshake(ss, "\0", 1);
+ if (rv != SECSuccess)
+ return -1;
+ /* HostName (length and value) */
+ rv = ssl3_ExtAppendHandshakeVariable(ss, (PRUint8 *)ss->url, len, 2);
+ if (rv != SECSuccess)
+ return -1;
+ if (!ss->sec.isServer) {
+ xtnData->advertised[xtnData->numAdvertised++] =
+ ssl_server_name_xtn;
+ }
+ }
+ return len + 9;
}
- /* HostName (length and value) */
- rv = sslBuffer_AppendVariable(buf, (const PRUint8 *)ss->url, len, 2);
- if (rv != SECSuccess) {
- return SECFailure;
+ /* Server side */
+ if (append && maxBytes >= 4) {
+ rv = ssl3_ExtAppendHandshakeNumber(ss, ssl_server_name_xtn, 2);
+ if (rv != SECSuccess)
+ return -1;
+ /* length of extension_data */
+ rv = ssl3_ExtAppendHandshakeNumber(ss, 0, 2);
+ if (rv != SECSuccess)
+ return -1;
}
-
- *added = PR_TRUE;
- return SECSuccess;
+ return 4;
}
/* Handle an incoming SNI extension. */
SECStatus
-ssl3_HandleServerNameXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- SECItem *data)
+ssl3_HandleServerNameXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type, SECItem *data)
{
SECItem *names = NULL;
PRUint32 listLenBytes = 0;
@@ -171,54 +194,88 @@ ssl3_FreeSniNameArray(TLSExtensionData *xtnData)
* sends an empty ticket. Servers always send empty tickets.
*/
PRInt32
-ssl3_ClientSendSessionTicketXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
+ssl3_SendSessionTicketXtn(
+ const sslSocket *ss,
+ TLSExtensionData *xtnData,
+ PRBool append,
+ PRUint32 maxBytes)
{
+ PRInt32 extension_length;
NewSessionTicket *session_ticket = NULL;
sslSessionID *sid = ss->sec.ci.sid;
- SECStatus rv;
-
- PORT_Assert(!ss->sec.isServer);
/* Never send an extension with a ticket for TLS 1.3, but
* OK to send the empty one in case the server does 1.2. */
if (sid->cached == in_client_cache &&
sid->version >= SSL_LIBRARY_VERSION_TLS_1_3) {
- return SECSuccess;
+ return 0;
}
/* Ignore the SessionTicket extension if processing is disabled. */
- if (!ss->opt.enableSessionTickets) {
- return SECSuccess;
- }
+ if (!ss->opt.enableSessionTickets)
+ return 0;
- /* Send a session ticket if one is available.
- *
- * The caller must be holding sid->u.ssl3.lock for reading. We cannot
- * just acquire and release the lock within this function because the
- * caller will call this function twice, and we need the inputs to be
- * consistent between the two calls. Note that currently the caller
- * will only be holding the lock when we are the client and when we're
- * attempting to resume an existing session.
+ /* Empty extension length = extension_type (2-bytes) +
+ * length(extension_data) (2-bytes)
*/
- session_ticket = &sid->u.ssl3.locked.sessionTicket;
- if (session_ticket->ticket.data &&
- (xtnData->ticketTimestampVerified ||
- ssl_TicketTimeValid(session_ticket))) {
+ extension_length = 4;
- xtnData->ticketTimestampVerified = PR_FALSE;
+ /* If we are a client then send a session ticket if one is availble.
+ * Servers that support the extension and are willing to negotiate the
+ * the extension always respond with an empty extension.
+ */
+ if (!ss->sec.isServer) {
+ /* The caller must be holding sid->u.ssl3.lock for reading. We cannot
+ * just acquire and release the lock within this function because the
+ * caller will call this function twice, and we need the inputs to be
+ * consistent between the two calls. Note that currently the caller
+ * will only be holding the lock when we are the client and when we're
+ * attempting to resume an existing session.
+ */
- rv = sslBuffer_Append(buf, session_ticket->ticket.data,
- session_ticket->ticket.len);
- if (rv != SECSuccess) {
- return SECFailure;
+ session_ticket = &sid->u.ssl3.locked.sessionTicket;
+ if (session_ticket->ticket.data) {
+ if (xtnData->ticketTimestampVerified) {
+ extension_length += session_ticket->ticket.len;
+ } else if (!append && ssl_TicketTimeValid(session_ticket)) {
+ extension_length += session_ticket->ticket.len;
+ xtnData->ticketTimestampVerified = PR_TRUE;
+ }
}
+ }
- xtnData->sentSessionTicketInClientHello = PR_TRUE;
+ if (maxBytes < (PRUint32)extension_length) {
+ PORT_Assert(0);
+ return 0;
}
+ if (append) {
+ SECStatus rv;
+ /* extension_type */
+ rv = ssl3_ExtAppendHandshakeNumber(ss, ssl_session_ticket_xtn, 2);
+ if (rv != SECSuccess)
+ goto loser;
+ if (session_ticket && session_ticket->ticket.data &&
+ xtnData->ticketTimestampVerified) {
+ rv = ssl3_ExtAppendHandshakeVariable(ss, session_ticket->ticket.data,
+ session_ticket->ticket.len, 2);
+ xtnData->ticketTimestampVerified = PR_FALSE;
+ xtnData->sentSessionTicketInClientHello = PR_TRUE;
+ } else {
+ rv = ssl3_ExtAppendHandshakeNumber(ss, 0, 2);
+ }
+ if (rv != SECSuccess)
+ goto loser;
- *added = PR_TRUE;
- return SECSuccess;
+ if (!ss->sec.isServer) {
+ xtnData->advertised[xtnData->numAdvertised++] =
+ ssl_session_ticket_xtn;
+ }
+ }
+ return extension_length;
+
+loser:
+ xtnData->ticketTimestampVerified = PR_FALSE;
+ return -1;
}
PRBool
@@ -244,18 +301,16 @@ ssl_AlpnTagAllowed(const sslSocket *ss, const SECItem *tag)
/* handle an incoming Next Protocol Negotiation extension. */
SECStatus
-ssl3_ServerHandleNextProtoNegoXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ssl3_ServerHandleNextProtoNegoXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type,
SECItem *data)
{
- PORT_Assert(ss->version < SSL_LIBRARY_VERSION_TLS_1_3);
-
if (ss->firstHsDone || data->len != 0) {
/* Clients MUST send an empty NPN extension, if any. */
PORT_SetError(SSL_ERROR_NEXT_PROTOCOL_DATA_INVALID);
return SECFailure;
}
- xtnData->negotiated[xtnData->numNegotiated++] = ssl_next_proto_nego_xtn;
+ xtnData->negotiated[xtnData->numNegotiated++] = ex_type;
/* TODO: server side NPN support would require calling
* ssl3_RegisterServerHelloExtensionSender here in order to echo the
@@ -289,7 +344,7 @@ ssl3_ValidateNextProtoNego(const unsigned char *data, unsigned int length)
/* protocol selection handler for ALPN (server side) and NPN (client side) */
static SECStatus
ssl3_SelectAppProtocol(const sslSocket *ss, TLSExtensionData *xtnData,
- PRUint16 extension, SECItem *data)
+ PRUint16 ex_type, SECItem *data)
{
SECStatus rv;
unsigned char resultBuffer[255];
@@ -326,7 +381,7 @@ ssl3_SelectAppProtocol(const sslSocket *ss, TLSExtensionData *xtnData,
SECITEM_FreeItem(&xtnData->nextProto, PR_FALSE);
- if (extension == ssl_app_layer_protocol_xtn &&
+ if (ex_type == ssl_app_layer_protocol_xtn &&
xtnData->nextProtoState != SSL_NEXT_PROTO_NEGOTIATED) {
/* The callback might say OK, but then it picks a default value - one
* that was not listed. That's OK for NPN, but not ALPN. */
@@ -335,14 +390,13 @@ ssl3_SelectAppProtocol(const sslSocket *ss, TLSExtensionData *xtnData,
return SECFailure;
}
- xtnData->negotiated[xtnData->numNegotiated++] = extension;
+ xtnData->negotiated[xtnData->numNegotiated++] = ex_type;
return SECITEM_CopyItem(NULL, &xtnData->nextProto, &result);
}
/* handle an incoming ALPN extension at the server */
SECStatus
-ssl3_ServerHandleAppProtoXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- SECItem *data)
+ssl3_ServerHandleAppProtoXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type, SECItem *data)
{
PRUint32 count;
SECStatus rv;
@@ -369,16 +423,15 @@ ssl3_ServerHandleAppProtoXtn(const sslSocket *ss, TLSExtensionData *xtnData,
return SECSuccess;
}
- rv = ssl3_SelectAppProtocol(ss, xtnData, ssl_app_layer_protocol_xtn, data);
+ rv = ssl3_SelectAppProtocol(ss, xtnData, ex_type, data);
if (rv != SECSuccess) {
return rv;
}
/* prepare to send back a response, if we negotiated */
if (xtnData->nextProtoState == SSL_NEXT_PROTO_NEGOTIATED) {
- rv = ssl3_RegisterExtensionSender(ss, xtnData,
- ssl_app_layer_protocol_xtn,
- ssl3_ServerSendAppProtoXtn);
+ rv = ssl3_RegisterExtensionSender(
+ ss, xtnData, ex_type, ssl3_ServerSendAppProtoXtn);
if (rv != SECSuccess) {
ssl3_ExtSendAlert(ss, alert_fatal, internal_error);
PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
@@ -389,10 +442,9 @@ ssl3_ServerHandleAppProtoXtn(const sslSocket *ss, TLSExtensionData *xtnData,
}
SECStatus
-ssl3_ClientHandleNextProtoNegoXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ssl3_ClientHandleNextProtoNegoXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type,
SECItem *data)
{
- PORT_Assert(ss->version < SSL_LIBRARY_VERSION_TLS_1_3);
PORT_Assert(!ss->firstHsDone);
if (ssl3_ExtensionNegotiated(ss, ssl_app_layer_protocol_xtn)) {
@@ -418,12 +470,11 @@ ssl3_ClientHandleNextProtoNegoXtn(const sslSocket *ss, TLSExtensionData *xtnData
return SECFailure;
}
- return ssl3_SelectAppProtocol(ss, xtnData, ssl_next_proto_nego_xtn, data);
+ return ssl3_SelectAppProtocol(ss, xtnData, ex_type, data);
}
SECStatus
-ssl3_ClientHandleAppProtoXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- SECItem *data)
+ssl3_ClientHandleAppProtoXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type, SECItem *data)
{
SECStatus rv;
PRUint32 list_len;
@@ -470,168 +521,265 @@ ssl3_ClientHandleAppProtoXtn(const sslSocket *ss, TLSExtensionData *xtnData,
SECITEM_FreeItem(&xtnData->nextProto, PR_FALSE);
xtnData->nextProtoState = SSL_NEXT_PROTO_SELECTED;
- xtnData->negotiated[xtnData->numNegotiated++] = ssl_app_layer_protocol_xtn;
+ xtnData->negotiated[xtnData->numNegotiated++] = ex_type;
return SECITEM_CopyItem(NULL, &xtnData->nextProto, &protocol_name);
}
-SECStatus
-ssl3_ClientSendNextProtoNegoXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
+PRInt32
+ssl3_ClientSendNextProtoNegoXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRBool append,
+ PRUint32 maxBytes)
{
+ PRInt32 extension_length;
+
/* Renegotiations do not send this extension. */
if (!ss->opt.enableNPN || !ss->nextProtoCallback || ss->firstHsDone) {
- return SECSuccess;
+ return 0;
}
- *added = PR_TRUE;
- return SECSuccess;
+ extension_length = 4;
+
+ if (maxBytes < (PRUint32)extension_length) {
+ return 0;
+ }
+ if (append) {
+ SECStatus rv;
+ rv = ssl3_ExtAppendHandshakeNumber(ss, ssl_next_proto_nego_xtn, 2);
+ if (rv != SECSuccess)
+ goto loser;
+ rv = ssl3_ExtAppendHandshakeNumber(ss, 0, 2);
+ if (rv != SECSuccess)
+ goto loser;
+ xtnData->advertised[xtnData->numAdvertised++] =
+ ssl_next_proto_nego_xtn;
+ }
+
+ return extension_length;
+
+loser:
+ return -1;
}
-SECStatus
-ssl3_ClientSendAppProtoXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
+PRInt32
+ssl3_ClientSendAppProtoXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRBool append, PRUint32 maxBytes)
{
- SECStatus rv;
- const unsigned int len = ss->opt.nextProtoNego.len;
+ PRInt32 extension_length;
+ unsigned char *alpn_protos = NULL;
/* Renegotiations do not send this extension. */
if (!ss->opt.enableALPN || !ss->opt.nextProtoNego.data || ss->firstHsDone) {
- return SECSuccess;
+ return 0;
}
- /* NPN requires that the client's fallback protocol is first in the
- * list. However, ALPN sends protocols in preference order. So move the
- * first protocol to the end of the list. */
+ extension_length = 2 /* extension type */ + 2 /* extension length */ +
+ 2 /* protocol name list length */ +
+ ss->opt.nextProtoNego.len;
- if (len > 0) {
- /* Each protocol string is prefixed with a single byte length. */
- unsigned int i;
+ if (maxBytes < (PRUint32)extension_length) {
+ return 0;
+ }
+ if (append) {
+ /* NPN requires that the client's fallback protocol is first in the
+ * list. However, ALPN sends protocols in preference order. So we
+ * allocate a buffer and move the first protocol to the end of the
+ * list. */
+ SECStatus rv;
+ const unsigned int len = ss->opt.nextProtoNego.len;
- rv = sslBuffer_AppendNumber(buf, len, 2);
- if (rv != SECSuccess) {
+ alpn_protos = PORT_Alloc(len);
+ if (alpn_protos == NULL) {
return SECFailure;
}
-
- i = ss->opt.nextProtoNego.data[0] + 1;
- if (i <= len) {
- rv = sslBuffer_Append(buf, &ss->opt.nextProtoNego.data[i], len - i);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- rv = sslBuffer_Append(buf, ss->opt.nextProtoNego.data, i);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- } else {
- /* This seems to be invalid data so we'll send as-is. */
- rv = sslBuffer_Append(buf, ss->opt.nextProtoNego.data, len);
- if (rv != SECSuccess) {
- return SECFailure;
+ if (len > 0) {
+ /* Each protocol string is prefixed with a single byte length. */
+ unsigned int i = ss->opt.nextProtoNego.data[0] + 1;
+ if (i <= len) {
+ memcpy(alpn_protos, &ss->opt.nextProtoNego.data[i], len - i);
+ memcpy(alpn_protos + len - i, ss->opt.nextProtoNego.data, i);
+ } else {
+ /* This seems to be invalid data so we'll send as-is. */
+ memcpy(alpn_protos, ss->opt.nextProtoNego.data, len);
}
}
+
+ rv = ssl3_ExtAppendHandshakeNumber(ss, ssl_app_layer_protocol_xtn, 2);
+ if (rv != SECSuccess) {
+ goto loser;
+ }
+ rv = ssl3_ExtAppendHandshakeNumber(ss, extension_length - 4, 2);
+ if (rv != SECSuccess) {
+ goto loser;
+ }
+ rv = ssl3_ExtAppendHandshakeVariable(ss, alpn_protos, len, 2);
+ PORT_Free(alpn_protos);
+ alpn_protos = NULL;
+ if (rv != SECSuccess) {
+ goto loser;
+ }
+ xtnData->advertised[xtnData->numAdvertised++] =
+ ssl_app_layer_protocol_xtn;
}
- *added = PR_TRUE;
- return SECSuccess;
+ return extension_length;
+
+loser:
+ if (alpn_protos) {
+ PORT_Free(alpn_protos);
+ }
+ return -1;
}
-SECStatus
-ssl3_ServerSendAppProtoXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
+PRInt32
+ssl3_ServerSendAppProtoXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRBool append, PRUint32 maxBytes)
{
- SECStatus rv;
+ PRInt32 extension_length;
- /* We're in over our heads if any of these fail */
+ /* we're in over our heads if any of these fail */
PORT_Assert(ss->opt.enableALPN);
PORT_Assert(xtnData->nextProto.data);
PORT_Assert(xtnData->nextProto.len > 0);
PORT_Assert(xtnData->nextProtoState == SSL_NEXT_PROTO_NEGOTIATED);
PORT_Assert(!ss->firstHsDone);
- rv = sslBuffer_AppendNumber(buf, xtnData->nextProto.len + 1, 2);
- if (rv != SECSuccess) {
- return SECFailure;
+ extension_length = 2 /* extension type */ + 2 /* extension length */ +
+ 2 /* protocol name list */ + 1 /* name length */ +
+ xtnData->nextProto.len;
+
+ if (maxBytes < (PRUint32)extension_length) {
+ return 0;
}
- rv = sslBuffer_AppendVariable(buf, xtnData->nextProto.data,
- xtnData->nextProto.len, 1);
- if (rv != SECSuccess) {
- return SECFailure;
+ if (append) {
+ SECStatus rv;
+ rv = ssl3_ExtAppendHandshakeNumber(ss, ssl_app_layer_protocol_xtn, 2);
+ if (rv != SECSuccess) {
+ return -1;
+ }
+ rv = ssl3_ExtAppendHandshakeNumber(ss, extension_length - 4, 2);
+ if (rv != SECSuccess) {
+ return -1;
+ }
+ rv = ssl3_ExtAppendHandshakeNumber(ss, xtnData->nextProto.len + 1, 2);
+ if (rv != SECSuccess) {
+ return -1;
+ }
+ rv = ssl3_ExtAppendHandshakeVariable(ss, xtnData->nextProto.data,
+ xtnData->nextProto.len, 1);
+ if (rv != SECSuccess) {
+ return -1;
+ }
}
- *added = PR_TRUE;
- return SECSuccess;
+ return extension_length;
}
SECStatus
-ssl3_ServerHandleStatusRequestXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ssl3_ServerHandleStatusRequestXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type,
SECItem *data)
{
- sslExtensionBuilderFunc sender;
+ ssl3HelloExtensionSenderFunc sender;
PORT_Assert(ss->sec.isServer);
/* remember that we got this extension. */
- xtnData->negotiated[xtnData->numNegotiated++] = ssl_cert_status_xtn;
+ xtnData->negotiated[xtnData->numNegotiated++] = ex_type;
if (ss->version >= SSL_LIBRARY_VERSION_TLS_1_3) {
sender = tls13_ServerSendStatusRequestXtn;
} else {
sender = ssl3_ServerSendStatusRequestXtn;
}
- return ssl3_RegisterExtensionSender(ss, xtnData, ssl_cert_status_xtn, sender);
+ return ssl3_RegisterExtensionSender(ss, xtnData, ex_type, sender);
}
-SECStatus
-ssl3_ServerSendStatusRequestXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
+PRInt32
+ssl3_ServerSendStatusRequestXtn(
+ const sslSocket *ss,
+ TLSExtensionData *xtnData,
+ PRBool append,
+ PRUint32 maxBytes)
{
+ PRInt32 extension_length;
const sslServerCert *serverCert = ss->sec.serverCert;
+ SECStatus rv;
if (!serverCert->certStatusArray ||
!serverCert->certStatusArray->len) {
- return SECSuccess;
+ return 0;
}
- *added = PR_TRUE;
- return SECSuccess;
+ extension_length = 2 + 2;
+ if (maxBytes < (PRUint32)extension_length) {
+ return 0;
+ }
+ if (append) {
+ /* extension_type */
+ rv = ssl3_ExtAppendHandshakeNumber(ss, ssl_cert_status_xtn, 2);
+ if (rv != SECSuccess)
+ return -1;
+ /* length of extension_data */
+ rv = ssl3_ExtAppendHandshakeNumber(ss, 0, 2);
+ if (rv != SECSuccess)
+ return -1;
+ /* The certificate status data is sent in ssl3_SendCertificateStatus. */
+ }
+
+ return extension_length;
}
/* ssl3_ClientSendStatusRequestXtn builds the status_request extension on the
* client side. See RFC 6066 section 8. */
-SECStatus
-ssl3_ClientSendStatusRequestXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
+PRInt32
+ssl3_ClientSendStatusRequestXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRBool append,
+ PRUint32 maxBytes)
{
- SECStatus rv;
+ PRInt32 extension_length;
- if (!ss->opt.enableOCSPStapling) {
- return SECSuccess;
- }
+ if (!ss->opt.enableOCSPStapling)
+ return 0;
- rv = sslBuffer_AppendNumber(buf, 1 /* status_type ocsp */, 1);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- /* A zero length responder_id_list means that the responders are
- * implicitly known to the server. */
- rv = sslBuffer_AppendNumber(buf, 0, 2);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- /* A zero length request_extensions means that there are no extensions.
- * Specifically, we don't set the id-pkix-ocsp-nonce extension. This
- * means that the server can replay a cached OCSP response to us. */
- rv = sslBuffer_AppendNumber(buf, 0, 2);
- if (rv != SECSuccess) {
- return SECFailure;
+ /* extension_type (2-bytes) +
+ * length(extension_data) (2-bytes) +
+ * status_type (1) +
+ * responder_id_list length (2) +
+ * request_extensions length (2)
+ */
+ extension_length = 9;
+
+ if (maxBytes < (PRUint32)extension_length) {
+ PORT_Assert(0);
+ return 0;
}
+ if (append) {
+ SECStatus rv;
- *added = PR_TRUE;
- return SECSuccess;
+ /* extension_type */
+ rv = ssl3_ExtAppendHandshakeNumber(ss, ssl_cert_status_xtn, 2);
+ if (rv != SECSuccess)
+ return -1;
+ rv = ssl3_ExtAppendHandshakeNumber(ss, extension_length - 4, 2);
+ if (rv != SECSuccess)
+ return -1;
+ rv = ssl3_ExtAppendHandshakeNumber(ss, 1 /* status_type ocsp */, 1);
+ if (rv != SECSuccess)
+ return -1;
+ /* A zero length responder_id_list means that the responders are
+ * implicitly known to the server. */
+ rv = ssl3_ExtAppendHandshakeNumber(ss, 0, 2);
+ if (rv != SECSuccess)
+ return -1;
+ /* A zero length request_extensions means that there are no extensions.
+ * Specifically, we don't set the id-pkix-ocsp-nonce extension. This
+ * means that the server can replay a cached OCSP response to us. */
+ rv = ssl3_ExtAppendHandshakeNumber(ss, 0, 2);
+ if (rv != SECSuccess)
+ return -1;
+
+ xtnData->advertised[xtnData->numAdvertised++] = ssl_cert_status_xtn;
+ }
+ return extension_length;
}
SECStatus
-ssl3_ClientHandleStatusRequestXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ssl3_ClientHandleStatusRequestXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type,
SECItem *data)
{
/* In TLS 1.3, the extension carries the OCSP response. */
@@ -649,32 +797,36 @@ ssl3_ClientHandleStatusRequestXtn(const sslSocket *ss, TLSExtensionData *xtnData
}
/* Keep track of negotiated extensions. */
- xtnData->negotiated[xtnData->numNegotiated++] = ssl_cert_status_xtn;
+ xtnData->negotiated[xtnData->numNegotiated++] = ex_type;
return SECSuccess;
}
PRUint32 ssl_ticket_lifetime = 2 * 24 * 60 * 60; /* 2 days in seconds */
-#define TLS_EX_SESS_TICKET_VERSION (0x010a)
+#define TLS_EX_SESS_TICKET_VERSION (0x0105)
/*
* Called from ssl3_SendNewSessionTicket, tls13_SendNewSessionTicket
*/
SECStatus
-ssl3_EncodeSessionTicket(sslSocket *ss, const NewSessionTicket *ticket,
- const PRUint8 *appToken, unsigned int appTokenLen,
- PK11SymKey *secret, SECItem *ticket_data)
+ssl3_EncodeSessionTicket(sslSocket *ss,
+ const NewSessionTicket *ticket,
+ SECItem *ticket_data)
{
SECStatus rv;
- sslBuffer plaintext = SSL_BUFFER_EMPTY;
+ SECItem plaintext;
+ SECItem plaintext_item = { 0, NULL, 0 };
+ PRUint32 plaintext_length;
SECItem ticket_buf = { 0, NULL, 0 };
- sslSessionID sid;
+ PRBool ms_is_wrapped;
unsigned char wrapped_ms[SSL3_MASTER_SECRET_LENGTH];
SECItem ms_item = { 0, NULL, 0 };
- PRTime now;
+ PRUint32 cert_length = 0;
+ PRUint32 now;
SECItem *srvName = NULL;
- CK_MECHANISM_TYPE msWrapMech;
+ CK_MECHANISM_TYPE msWrapMech = 0; /* dummy default value,
+ * must be >= 0 */
+ ssl3CipherSpec *spec;
SECItem *alpnSelection = NULL;
- PRUint32 ticketAgeBaseline;
SSL_TRC(3, ("%d: SSL3[%d]: send session_ticket handshake",
SSL_GETPID(), ss->fd));
@@ -682,69 +834,107 @@ ssl3_EncodeSessionTicket(sslSocket *ss, const NewSessionTicket *ticket,
PORT_Assert(ss->opt.noLocks || ssl_HaveXmitBufLock(ss));
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
- /* Extract the master secret wrapped. */
+ if (ss->opt.requestCertificate && ss->sec.ci.sid->peerCert) {
+ cert_length = 2 + ss->sec.ci.sid->peerCert->derCert.len;
+ }
- PORT_Memset(&sid, 0, sizeof(sslSessionID));
+ if (ss->version >= SSL_LIBRARY_VERSION_TLS_1_3) {
+ spec = ss->ssl3.cwSpec;
+ } else {
+ spec = ss->ssl3.pwSpec;
+ }
+ if (spec->msItem.len && spec->msItem.data) {
+ /* The master secret is available unwrapped. */
+ ms_item.data = spec->msItem.data;
+ ms_item.len = spec->msItem.len;
+ ms_is_wrapped = PR_FALSE;
+ } else {
+ /* Extract the master secret wrapped. */
+ sslSessionID sid;
+ PORT_Memset(&sid, 0, sizeof(sslSessionID));
- PORT_Assert(secret);
- rv = ssl3_CacheWrappedSecret(ss, &sid, secret);
- if (rv == SECSuccess) {
- if (sid.u.ssl3.keys.wrapped_master_secret_len > sizeof(wrapped_ms))
+ rv = ssl3_CacheWrappedMasterSecret(ss, &sid, spec);
+ if (rv == SECSuccess) {
+ if (sid.u.ssl3.keys.wrapped_master_secret_len > sizeof(wrapped_ms))
+ goto loser;
+ memcpy(wrapped_ms, sid.u.ssl3.keys.wrapped_master_secret,
+ sid.u.ssl3.keys.wrapped_master_secret_len);
+ ms_item.data = wrapped_ms;
+ ms_item.len = sid.u.ssl3.keys.wrapped_master_secret_len;
+ msWrapMech = sid.u.ssl3.masterWrapMech;
+ } else {
+ /* TODO: else send an empty ticket. */
goto loser;
- memcpy(wrapped_ms, sid.u.ssl3.keys.wrapped_master_secret,
- sid.u.ssl3.keys.wrapped_master_secret_len);
- ms_item.data = wrapped_ms;
- ms_item.len = sid.u.ssl3.keys.wrapped_master_secret_len;
- msWrapMech = sid.u.ssl3.masterWrapMech;
- } else {
- /* TODO: else send an empty ticket. */
- goto loser;
+ }
+ ms_is_wrapped = PR_TRUE;
}
/* Prep to send negotiated name */
srvName = &ss->sec.ci.sid->u.ssl3.srvName;
+ PORT_Assert(ss->xtnData.nextProtoState == SSL_NEXT_PROTO_SELECTED ||
+ ss->xtnData.nextProtoState == SSL_NEXT_PROTO_NEGOTIATED ||
+ ss->xtnData.nextProto.len == 0);
+ alpnSelection = &ss->xtnData.nextProto;
+
+ plaintext_length =
+ sizeof(PRUint16) /* ticket version */
+ + sizeof(SSL3ProtocolVersion) /* ssl_version */
+ + sizeof(ssl3CipherSuite) /* ciphersuite */
+ + 1 /* compression */
+ + 10 /* cipher spec parameters */
+ + 1 /* certType arguments */
+ + 1 /* SessionTicket.ms_is_wrapped */
+ + 4 /* msWrapMech */
+ + 2 /* master_secret.length */
+ + ms_item.len /* master_secret */
+ + 1 /* client_auth_type */
+ + cert_length /* cert */
+ + 2 + srvName->len /* name len + length field */
+ + 1 /* extendedMasterSecretUsed */
+ + sizeof(ticket->ticket_lifetime_hint) /* ticket lifetime hint */
+ + sizeof(ticket->flags) /* ticket flags */
+ + 1 + alpnSelection->len /* alpn value + length field */
+ + 4; /* maxEarlyData */
+
+ if (SECITEM_AllocItem(NULL, &plaintext_item, plaintext_length) == NULL)
+ goto loser;
+
+ plaintext = plaintext_item;
+
/* ticket version */
- rv = sslBuffer_AppendNumber(&plaintext, TLS_EX_SESS_TICKET_VERSION,
- sizeof(PRUint16));
+ rv = ssl3_AppendNumberToItem(&plaintext, TLS_EX_SESS_TICKET_VERSION,
+ sizeof(PRUint16));
if (rv != SECSuccess)
goto loser;
/* ssl_version */
- rv = sslBuffer_AppendNumber(&plaintext, ss->version,
- sizeof(SSL3ProtocolVersion));
+ rv = ssl3_AppendNumberToItem(&plaintext, ss->version,
+ sizeof(SSL3ProtocolVersion));
if (rv != SECSuccess)
goto loser;
/* ciphersuite */
- rv = sslBuffer_AppendNumber(&plaintext, ss->ssl3.hs.cipher_suite,
- sizeof(ssl3CipherSuite));
+ rv = ssl3_AppendNumberToItem(&plaintext, ss->ssl3.hs.cipher_suite,
+ sizeof(ssl3CipherSuite));
if (rv != SECSuccess)
goto loser;
- /* cipher spec parameters */
- rv = sslBuffer_AppendNumber(&plaintext, ss->sec.authType, 1);
+ /* compression */
+ rv = ssl3_AppendNumberToItem(&plaintext, ss->ssl3.hs.compression, 1);
if (rv != SECSuccess)
goto loser;
- rv = sslBuffer_AppendNumber(&plaintext, ss->sec.authKeyBits, 4);
+
+ /* cipher spec parameters */
+ rv = ssl3_AppendNumberToItem(&plaintext, ss->sec.authType, 1);
if (rv != SECSuccess)
goto loser;
- rv = sslBuffer_AppendNumber(&plaintext, ss->sec.keaType, 1);
+ rv = ssl3_AppendNumberToItem(&plaintext, ss->sec.authKeyBits, 4);
if (rv != SECSuccess)
goto loser;
- rv = sslBuffer_AppendNumber(&plaintext, ss->sec.keaKeyBits, 4);
+ rv = ssl3_AppendNumberToItem(&plaintext, ss->sec.keaType, 1);
if (rv != SECSuccess)
goto loser;
- if (ss->sec.keaGroup) {
- rv = sslBuffer_AppendNumber(&plaintext, ss->sec.keaGroup->name, 4);
- if (rv != SECSuccess)
- goto loser;
- } else {
- /* No kea group. Write 0 as invalid value. */
- rv = sslBuffer_AppendNumber(&plaintext, 0, 4);
- if (rv != SECSuccess)
- goto loser;
- }
- rv = sslBuffer_AppendNumber(&plaintext, ss->sec.signatureScheme, 4);
+ rv = ssl3_AppendNumberToItem(&plaintext, ss->sec.keaKeyBits, 4);
if (rv != SECSuccess)
goto loser;
@@ -755,120 +945,102 @@ ssl3_EncodeSessionTicket(sslSocket *ss, const NewSessionTicket *ticket,
PORT_Assert(cert->namedCurve);
/* EC curves only use the second of the two bytes. */
PORT_Assert(cert->namedCurve->name < 256);
- rv = sslBuffer_AppendNumber(&plaintext, cert->namedCurve->name, 1);
+ rv = ssl3_AppendNumberToItem(&plaintext, cert->namedCurve->name, 1);
} else {
- rv = sslBuffer_AppendNumber(&plaintext, 0, 1);
+ rv = ssl3_AppendNumberToItem(&plaintext, 0, 1);
}
if (rv != SECSuccess)
goto loser;
/* master_secret */
- rv = sslBuffer_AppendNumber(&plaintext, msWrapMech, 4);
+ rv = ssl3_AppendNumberToItem(&plaintext, ms_is_wrapped, 1);
+ if (rv != SECSuccess)
+ goto loser;
+ rv = ssl3_AppendNumberToItem(&plaintext, msWrapMech, 4);
if (rv != SECSuccess)
goto loser;
- rv = sslBuffer_AppendVariable(&plaintext, ms_item.data, ms_item.len, 2);
+ rv = ssl3_AppendNumberToItem(&plaintext, ms_item.len, 2);
+ if (rv != SECSuccess)
+ goto loser;
+ rv = ssl3_AppendToItem(&plaintext, ms_item.data, ms_item.len);
if (rv != SECSuccess)
goto loser;
/* client identity */
if (ss->opt.requestCertificate && ss->sec.ci.sid->peerCert) {
- rv = sslBuffer_AppendNumber(&plaintext, CLIENT_AUTH_CERTIFICATE, 1);
+ rv = ssl3_AppendNumberToItem(&plaintext, CLIENT_AUTH_CERTIFICATE, 1);
+ if (rv != SECSuccess)
+ goto loser;
+ rv = ssl3_AppendNumberToItem(&plaintext,
+ ss->sec.ci.sid->peerCert->derCert.len, 2);
if (rv != SECSuccess)
goto loser;
- rv = sslBuffer_AppendVariable(&plaintext,
- ss->sec.ci.sid->peerCert->derCert.data,
- ss->sec.ci.sid->peerCert->derCert.len, 2);
+ rv = ssl3_AppendToItem(&plaintext,
+ ss->sec.ci.sid->peerCert->derCert.data,
+ ss->sec.ci.sid->peerCert->derCert.len);
if (rv != SECSuccess)
goto loser;
} else {
- rv = sslBuffer_AppendNumber(&plaintext, 0, 1);
+ rv = ssl3_AppendNumberToItem(&plaintext, 0, 1);
if (rv != SECSuccess)
goto loser;
}
/* timestamp */
- now = ssl_TimeUsec();
- PORT_Assert(sizeof(now) == 8);
- rv = sslBuffer_AppendNumber(&plaintext, now, 8);
+ now = ssl_Time();
+ rv = ssl3_AppendNumberToItem(&plaintext, now,
+ sizeof(ticket->ticket_lifetime_hint));
if (rv != SECSuccess)
goto loser;
/* HostName (length and value) */
- rv = sslBuffer_AppendVariable(&plaintext, srvName->data, srvName->len, 2);
+ rv = ssl3_AppendNumberToItem(&plaintext, srvName->len, 2);
if (rv != SECSuccess)
goto loser;
+ if (srvName->len) {
+ rv = ssl3_AppendToItem(&plaintext, srvName->data, srvName->len);
+ if (rv != SECSuccess)
+ goto loser;
+ }
/* extendedMasterSecretUsed */
- rv = sslBuffer_AppendNumber(
+ rv = ssl3_AppendNumberToItem(
&plaintext, ss->sec.ci.sid->u.ssl3.keys.extendedMasterSecretUsed, 1);
if (rv != SECSuccess)
goto loser;
/* Flags */
- rv = sslBuffer_AppendNumber(&plaintext, ticket->flags,
- sizeof(ticket->flags));
+ rv = ssl3_AppendNumberToItem(&plaintext, ticket->flags,
+ sizeof(ticket->flags));
if (rv != SECSuccess)
goto loser;
/* ALPN value. */
- PORT_Assert(ss->xtnData.nextProtoState == SSL_NEXT_PROTO_SELECTED ||
- ss->xtnData.nextProtoState == SSL_NEXT_PROTO_NEGOTIATED ||
- ss->xtnData.nextProto.len == 0);
- alpnSelection = &ss->xtnData.nextProto;
PORT_Assert(alpnSelection->len < 256);
- rv = sslBuffer_AppendVariable(&plaintext, alpnSelection->data,
- alpnSelection->len, 1);
- if (rv != SECSuccess)
- goto loser;
-
- rv = sslBuffer_AppendNumber(&plaintext, ssl_max_early_data_size, 4);
- if (rv != SECSuccess)
- goto loser;
-
- /*
- * We store this in the ticket:
- * ticket_age_baseline = 1rtt - ticket_age_add
- *
- * When the client resumes, it will provide:
- * obfuscated_age = ticket_age_client + ticket_age_add
- *
- * We expect to receive the ticket at:
- * ticket_create + 1rtt + ticket_age_server
- *
- * We calculate the client's estimate of this as:
- * ticket_create + ticket_age_baseline + obfuscated_age
- * = ticket_create + 1rtt + ticket_age_client
- *
- * This is compared to the expected time, which should differ only as a
- * result of clock errors or errors in the RTT estimate.
- */
- ticketAgeBaseline = (ssl_TimeUsec() - ss->ssl3.hs.serverHelloTime) / PR_USEC_PER_MSEC;
- ticketAgeBaseline -= ticket->ticket_age_add;
- rv = sslBuffer_AppendNumber(&plaintext, ticketAgeBaseline, 4);
+ rv = ssl3_AppendNumberToItem(&plaintext, alpnSelection->len, 1);
if (rv != SECSuccess)
goto loser;
+ if (alpnSelection->len) {
+ rv = ssl3_AppendToItem(&plaintext, alpnSelection->data,
+ alpnSelection->len);
+ if (rv != SECSuccess)
+ goto loser;
+ }
- /* Application token */
- rv = sslBuffer_AppendVariable(&plaintext, appToken, appTokenLen, 2);
+ rv = ssl3_AppendNumberToItem(&plaintext, ssl_max_early_data_size, 4);
if (rv != SECSuccess)
goto loser;
- /* This really only happens if appTokenLen is too much, and that always
- * comes from the using application. */
- if (SSL_BUFFER_LEN(&plaintext) > 0xffff) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- goto loser;
- }
+ /* Check that we are totally full. */
+ PORT_Assert(plaintext.len == 0);
- ticket_buf.len = ssl_SelfEncryptGetProtectedSize(SSL_BUFFER_LEN(&plaintext));
- PORT_Assert(ticket_buf.len > 0);
- if (SECITEM_AllocItem(NULL, &ticket_buf, ticket_buf.len) == NULL) {
+ /* 128 just gives us enough room for overhead. */
+ if (SECITEM_AllocItem(NULL, &ticket_buf, plaintext_length + 128) == NULL) {
goto loser;
}
/* Finally, encrypt the ticket. */
- rv = ssl_SelfEncryptProtect(ss, SSL_BUFFER_BASE(&plaintext),
- SSL_BUFFER_LEN(&plaintext),
+ rv = ssl_SelfEncryptProtect(ss, plaintext_item.data, plaintext_item.len,
ticket_buf.data, &ticket_buf.len, ticket_buf.len);
if (rv != SECSuccess) {
goto loser;
@@ -877,11 +1049,13 @@ ssl3_EncodeSessionTicket(sslSocket *ss, const NewSessionTicket *ticket,
/* Give ownership of memory to caller. */
*ticket_data = ticket_buf;
- sslBuffer_Clear(&plaintext);
+ SECITEM_FreeItem(&plaintext_item, PR_FALSE);
return SECSuccess;
loser:
- sslBuffer_Clear(&plaintext);
+ if (plaintext_item.data) {
+ SECITEM_FreeItem(&plaintext_item, PR_FALSE);
+ }
if (ticket_buf.data) {
SECITEM_FreeItem(&ticket_buf, PR_FALSE);
}
@@ -893,22 +1067,18 @@ loser:
* message is expected during the handshake.
*/
SECStatus
-ssl3_ClientHandleSessionTicketXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ssl3_ClientHandleSessionTicketXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type,
SECItem *data)
{
- PORT_Assert(ss->version < SSL_LIBRARY_VERSION_TLS_1_3);
-
if (data->len != 0) {
return SECSuccess; /* Ignore the extension. */
}
/* Keep track of negotiated extensions. */
- xtnData->negotiated[xtnData->numNegotiated++] = ssl_session_ticket_xtn;
+ xtnData->negotiated[xtnData->numNegotiated++] = ex_type;
return SECSuccess;
}
-PR_STATIC_ASSERT((TLS_EX_SESS_TICKET_VERSION >> 8) == 1);
-
static SECStatus
ssl_ParseSessionTicket(sslSocket *ss, const SECItem *decryptedTicket,
SessionTicket *parsedTicket)
@@ -935,12 +1105,6 @@ ssl_ParseSessionTicket(sslSocket *ss, const SECItem *decryptedTicket,
return SECFailure;
}
- /* All ticket versions start with 0x01, so check to see if this
- * is a ticket or some other self-encrypted thing. */
- if ((temp >> 8) != 1) {
- PORT_SetError(SSL_ERROR_RX_MALFORMED_CLIENT_HELLO);
- return SECFailure;
- }
/* Skip the ticket if the version is wrong. This won't result in a
* handshake failure, just a failure to resume. */
if (temp != TLS_EX_SESS_TICKET_VERSION) {
@@ -968,6 +1132,14 @@ ssl_ParseSessionTicket(sslSocket *ss, const SECItem *decryptedTicket,
}
parsedTicket->cipher_suite = (ssl3CipherSuite)temp;
+ /* Read compression_method. */
+ rv = ssl3_ExtConsumeHandshakeNumber(ss, &temp, 1, &buffer, &len);
+ if (rv != SECSuccess) {
+ PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
+ return SECFailure;
+ }
+ parsedTicket->compression_method = (SSLCompressionMethod)temp;
+
/* Read cipher spec parameters. */
rv = ssl3_ExtConsumeHandshakeNumber(ss, &temp, 1, &buffer, &len);
if (rv != SECSuccess) {
@@ -993,18 +1165,6 @@ ssl_ParseSessionTicket(sslSocket *ss, const SECItem *decryptedTicket,
return SECFailure;
}
parsedTicket->keaKeyBits = temp;
- rv = ssl3_ExtConsumeHandshakeNumber(ss, &temp, 4, &buffer, &len);
- if (rv != SECSuccess) {
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
- }
- parsedTicket->originalKeaGroup = temp;
- rv = ssl3_ExtConsumeHandshakeNumber(ss, &temp, 4, &buffer, &len);
- if (rv != SECSuccess) {
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
- }
- parsedTicket->signatureScheme = (SSLSignatureScheme)temp;
/* Read the optional named curve. */
rv = ssl3_ExtConsumeHandshakeNumber(ss, &temp, 1, &buffer, &len);
@@ -1025,6 +1185,14 @@ ssl_ParseSessionTicket(sslSocket *ss, const SECItem *decryptedTicket,
}
/* Read the master secret (and how it is wrapped). */
+ rv = ssl3_ExtConsumeHandshakeNumber(ss, &temp, 1, &buffer, &len);
+ if (rv != SECSuccess) {
+ PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
+ return SECFailure;
+ }
+ PORT_Assert(temp == PR_TRUE || temp == PR_FALSE);
+ parsedTicket->ms_is_wrapped = (PRBool)temp;
+
rv = ssl3_ExtConsumeHandshakeNumber(ss, &temp, 4, &buffer, &len);
if (rv != SECSuccess) {
PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
@@ -1072,21 +1240,13 @@ ssl_ParseSessionTicket(sslSocket *ss, const SECItem *decryptedTicket,
PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
return SECFailure;
}
-
- /* Read timestamp. This is a 64-bit value and
- * ssl3_ExtConsumeHandshakeNumber only reads 32-bits at a time. */
- rv = ssl3_ExtConsumeHandshakeNumber(ss, &temp, 4, &buffer, &len);
- if (rv != SECSuccess) {
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
- }
- parsedTicket->timestamp = (PRTime)temp << 32;
+ /* Read timestamp. */
rv = ssl3_ExtConsumeHandshakeNumber(ss, &temp, 4, &buffer, &len);
if (rv != SECSuccess) {
PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
return SECFailure;
}
- parsedTicket->timestamp |= (PRTime)temp;
+ parsedTicket->timestamp = temp;
/* Read server name */
rv = ssl3_ExtConsumeHandshakeVariable(ss, &parsedTicket->srvName, 2,
@@ -1127,20 +1287,6 @@ ssl_ParseSessionTicket(sslSocket *ss, const SECItem *decryptedTicket,
}
parsedTicket->maxEarlyData = temp;
- rv = ssl3_ExtConsumeHandshakeNumber(ss, &temp, 4, &buffer, &len);
- if (rv != SECSuccess) {
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
- }
- parsedTicket->ticketAgeBaseline = temp;
-
- rv = ssl3_ExtConsumeHandshakeVariable(ss, &parsedTicket->applicationToken,
- 2, &buffer, &len);
- if (rv != SECSuccess) {
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
- }
-
#ifndef UNSAFE_FUZZER_MODE
/* Done parsing. Check that all bytes have been consumed. */
if (len != 0) {
@@ -1167,15 +1313,13 @@ ssl_CreateSIDFromTicket(sslSocket *ss, const SECItem *rawTicket,
/* Copy over parameters. */
sid->version = parsedTicket->ssl_version;
- sid->creationTime = parsedTicket->timestamp;
sid->u.ssl3.cipherSuite = parsedTicket->cipher_suite;
+ sid->u.ssl3.compression = parsedTicket->compression_method;
sid->authType = parsedTicket->authType;
sid->authKeyBits = parsedTicket->authKeyBits;
sid->keaType = parsedTicket->keaType;
sid->keaKeyBits = parsedTicket->keaKeyBits;
- sid->keaGroup = parsedTicket->originalKeaGroup;
sid->namedCurve = parsedTicket->namedCurve;
- sid->sigScheme = parsedTicket->signatureScheme;
rv = SECITEM_CopyItem(NULL, &sid->u.ssl3.locked.sessionTicket.ticket,
rawTicket);
@@ -1194,6 +1338,7 @@ ssl_CreateSIDFromTicket(sslSocket *ss, const SECItem *rawTicket,
parsedTicket->master_secret, parsedTicket->ms_length);
sid->u.ssl3.keys.wrapped_master_secret_len = parsedTicket->ms_length;
sid->u.ssl3.masterWrapMech = parsedTicket->msWrapMech;
+ sid->u.ssl3.keys.msIsWrapped = parsedTicket->ms_is_wrapped;
sid->u.ssl3.masterValid = PR_TRUE;
sid->u.ssl3.keys.resumable = PR_TRUE;
sid->u.ssl3.keys.extendedMasterSecretUsed = parsedTicket->extendedMasterSecretUsed;
@@ -1236,12 +1381,10 @@ loser:
/* Generic ticket processing code, common to all TLS versions. */
SECStatus
-ssl3_ProcessSessionTicketCommon(sslSocket *ss, const SECItem *ticket,
- SECItem *appToken)
+ssl3_ProcessSessionTicketCommon(sslSocket *ss, SECItem *data)
{
SECItem decryptedTicket = { siBuffer, NULL, 0 };
SessionTicket parsedTicket;
- sslSessionID *sid = NULL;
SECStatus rv;
if (ss->sec.ci.sid != NULL) {
@@ -1250,12 +1393,12 @@ ssl3_ProcessSessionTicketCommon(sslSocket *ss, const SECItem *ticket,
ss->sec.ci.sid = NULL;
}
- if (!SECITEM_AllocItem(NULL, &decryptedTicket, ticket->len)) {
+ if (!SECITEM_AllocItem(NULL, &decryptedTicket, data->len)) {
return SECFailure;
}
/* Decrypt the ticket. */
- rv = ssl_SelfEncryptUnprotect(ss, ticket->data, ticket->len,
+ rv = ssl_SelfEncryptUnprotect(ss, data->data, data->len,
decryptedTicket.data,
&decryptedTicket.len,
decryptedTicket.len);
@@ -1285,28 +1428,16 @@ ssl3_ProcessSessionTicketCommon(sslSocket *ss, const SECItem *ticket,
}
/* Use the ticket if it is valid and unexpired. */
- if (parsedTicket.timestamp + ssl_ticket_lifetime * PR_USEC_PER_SEC >
- ssl_TimeUsec()) {
+ if (parsedTicket.valid &&
+ parsedTicket.timestamp + ssl_ticket_lifetime > ssl_Time()) {
+ sslSessionID *sid;
- rv = ssl_CreateSIDFromTicket(ss, ticket, &parsedTicket, &sid);
+ rv = ssl_CreateSIDFromTicket(ss, data, &parsedTicket, &sid);
if (rv != SECSuccess) {
goto loser; /* code already set */
}
- if (appToken && parsedTicket.applicationToken.len) {
- rv = SECITEM_CopyItem(NULL, appToken,
- &parsedTicket.applicationToken);
- if (rv != SECSuccess) {
- goto loser; /* code already set */
- }
- }
-
ss->statelessResume = PR_TRUE;
ss->sec.ci.sid = sid;
-
- /* We have the baseline value for the obfuscated ticket age here. Save
- * that in xtnData temporarily. This value is updated in
- * tls13_ServerHandlePreSharedKeyXtn with the final estimate. */
- ss->xtnData.ticketAge = parsedTicket.ticketAgeBaseline;
}
SECITEM_ZfreeItem(&decryptedTicket, PR_FALSE);
@@ -1314,19 +1445,15 @@ ssl3_ProcessSessionTicketCommon(sslSocket *ss, const SECItem *ticket,
return SECSuccess;
loser:
- if (sid) {
- ssl_FreeSID(sid);
- }
SECITEM_ZfreeItem(&decryptedTicket, PR_FALSE);
PORT_Memset(&parsedTicket, 0, sizeof(parsedTicket));
return SECFailure;
}
SECStatus
-ssl3_ServerHandleSessionTicketXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ssl3_ServerHandleSessionTicketXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type,
SECItem *data)
{
- PORT_Assert(ss->version < SSL_LIBRARY_VERSION_TLS_1_3);
/* Ignore the SessionTicket extension if processing is disabled. */
if (!ss->opt.enableSessionTickets) {
@@ -1339,7 +1466,7 @@ ssl3_ServerHandleSessionTicketXtn(const sslSocket *ss, TLSExtensionData *xtnData
}
/* Keep track of negotiated extensions. */
- xtnData->negotiated[xtnData->numNegotiated++] = ssl_session_ticket_xtn;
+ xtnData->negotiated[xtnData->numNegotiated++] = ex_type;
/* Parse the received ticket sent in by the client. We are
* lenient about some parse errors, falling back to a fullshake
@@ -1350,8 +1477,7 @@ ssl3_ServerHandleSessionTicketXtn(const sslSocket *ss, TLSExtensionData *xtnData
return SECSuccess;
}
- return ssl3_ProcessSessionTicketCommon(CONST_CAST(sslSocket, ss), data,
- NULL);
+ return ssl3_ProcessSessionTicketCommon(CONST_CAST(sslSocket, ss), data);
}
/* Extension format:
@@ -1361,45 +1487,60 @@ ssl3_ServerHandleSessionTicketXtn(const sslSocket *ss, TLSExtensionData *xtnData
* Verify Data (TLS): 12 bytes (client) or 24 bytes (server)
* Verify Data (SSL): 36 bytes (client) or 72 bytes (server)
*/
-SECStatus
-ssl3_SendRenegotiationInfoXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
+PRInt32
+ssl3_SendRenegotiationInfoXtn(
+ const sslSocket *ss,
+ TLSExtensionData *xtnData,
+ PRBool append,
+ PRUint32 maxBytes)
{
PRInt32 len = 0;
- SECStatus rv;
+ PRInt32 needed;
- /* In RFC 5746, it is NOT RECOMMENDED to send both the SCSV and the empty
- * RI, so when we send SCSV in the initial handshake, we don't also send RI.
+ /* In draft-ietf-tls-renegotiation-03, it is NOT RECOMMENDED to send
+ * both the SCSV and the empty RI, so when we send SCSV in
+ * the initial handshake, we don't also send RI.
*/
- if (ss->ssl3.hs.sendingSCSV) {
+ if (!ss || ss->ssl3.hs.sendingSCSV)
return 0;
- }
if (ss->firstHsDone) {
len = ss->sec.isServer ? ss->ssl3.hs.finishedBytes * 2
: ss->ssl3.hs.finishedBytes;
}
-
- /* verify_Data from previous Finished message(s) */
- rv = sslBuffer_AppendVariable(buf,
- ss->ssl3.hs.finishedMsgs.data, len, 1);
- if (rv != SECSuccess) {
- return SECFailure;
+ needed = 5 + len;
+ if (maxBytes < (PRUint32)needed) {
+ return 0;
}
-
- *added = PR_TRUE;
- return SECSuccess;
+ if (append) {
+ SECStatus rv;
+ /* extension_type */
+ rv = ssl3_ExtAppendHandshakeNumber(ss, ssl_renegotiation_info_xtn, 2);
+ if (rv != SECSuccess)
+ return -1;
+ /* length of extension_data */
+ rv = ssl3_ExtAppendHandshakeNumber(ss, len + 1, 2);
+ if (rv != SECSuccess)
+ return -1;
+ /* verify_Data from previous Finished message(s) */
+ rv = ssl3_ExtAppendHandshakeVariable(ss,
+ ss->ssl3.hs.finishedMsgs.data, len, 1);
+ if (rv != SECSuccess)
+ return -1;
+ if (!ss->sec.isServer) {
+ xtnData->advertised[xtnData->numAdvertised++] =
+ ssl_renegotiation_info_xtn;
+ }
+ }
+ return needed;
}
/* This function runs in both the client and server. */
SECStatus
-ssl3_HandleRenegotiationInfoXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- SECItem *data)
+ssl3_HandleRenegotiationInfoXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type, SECItem *data)
{
SECStatus rv = SECSuccess;
PRUint32 len = 0;
- PORT_Assert(ss->version < SSL_LIBRARY_VERSION_TLS_1_3);
-
if (ss->firstHsDone) {
len = ss->sec.isServer ? ss->ssl3.hs.finishedBytes
: ss->ssl3.hs.finishedBytes * 2;
@@ -1417,78 +1558,97 @@ ssl3_HandleRenegotiationInfoXtn(const sslSocket *ss, TLSExtensionData *xtnData,
/* remember that we got this extension and it was correct. */
CONST_CAST(sslSocket, ss)
->peerRequestedProtection = 1;
- xtnData->negotiated[xtnData->numNegotiated++] = ssl_renegotiation_info_xtn;
+ xtnData->negotiated[xtnData->numNegotiated++] = ex_type;
if (ss->sec.isServer) {
/* prepare to send back the appropriate response */
- rv = ssl3_RegisterExtensionSender(ss, xtnData,
- ssl_renegotiation_info_xtn,
+ rv = ssl3_RegisterExtensionSender(ss, xtnData, ex_type,
ssl3_SendRenegotiationInfoXtn);
}
return rv;
}
-SECStatus
-ssl3_ClientSendUseSRTPXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
+PRInt32
+ssl3_ClientSendUseSRTPXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRBool append, PRUint32 maxBytes)
{
- unsigned int i;
+ PRUint32 ext_data_len;
+ PRInt16 i;
SECStatus rv;
- if (!IS_DTLS(ss) || !ss->ssl3.dtlsSRTPCipherCount) {
- return SECSuccess; /* Not relevant */
- }
+ if (!ss)
+ return 0;
- /* Length of the SRTP cipher list */
- rv = sslBuffer_AppendNumber(buf, 2 * ss->ssl3.dtlsSRTPCipherCount, 2);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- /* The SRTP ciphers */
- for (i = 0; i < ss->ssl3.dtlsSRTPCipherCount; i++) {
- rv = sslBuffer_AppendNumber(buf, ss->ssl3.dtlsSRTPCiphers[i], 2);
- if (rv != SECSuccess) {
- return SECFailure;
+ if (!IS_DTLS(ss) || !ss->ssl3.dtlsSRTPCipherCount)
+ return 0; /* Not relevant */
+
+ ext_data_len = 2 + 2 * ss->ssl3.dtlsSRTPCipherCount + 1;
+
+ if (append && maxBytes >= 4 + ext_data_len) {
+ /* Extension type */
+ rv = ssl3_ExtAppendHandshakeNumber(ss, ssl_use_srtp_xtn, 2);
+ if (rv != SECSuccess)
+ return -1;
+ /* Length of extension data */
+ rv = ssl3_ExtAppendHandshakeNumber(ss, ext_data_len, 2);
+ if (rv != SECSuccess)
+ return -1;
+ /* Length of the SRTP cipher list */
+ rv = ssl3_ExtAppendHandshakeNumber(ss,
+ 2 * ss->ssl3.dtlsSRTPCipherCount,
+ 2);
+ if (rv != SECSuccess)
+ return -1;
+ /* The SRTP ciphers */
+ for (i = 0; i < ss->ssl3.dtlsSRTPCipherCount; i++) {
+ rv = ssl3_ExtAppendHandshakeNumber(ss,
+ ss->ssl3.dtlsSRTPCiphers[i],
+ 2);
+ if (rv != SECSuccess)
+ return -1;
}
- }
- /* Empty MKI value */
- rv = sslBuffer_AppendNumber(buf, 0, 1);
- if (rv != SECSuccess) {
- return SECFailure;
+ /* Empty MKI value */
+ ssl3_ExtAppendHandshakeVariable(ss, NULL, 0, 1);
+
+ xtnData->advertised[xtnData->numAdvertised++] =
+ ssl_use_srtp_xtn;
}
- *added = PR_TRUE;
- return SECSuccess;
+ return 4 + ext_data_len;
}
-SECStatus
-ssl3_ServerSendUseSRTPXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
+PRInt32
+ssl3_ServerSendUseSRTPXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRBool append, PRUint32 maxBytes)
{
SECStatus rv;
- /* Length of the SRTP cipher list */
- rv = sslBuffer_AppendNumber(buf, 2, 2);
- if (rv != SECSuccess) {
- return SECFailure;
+ /* Server side */
+ if (!append || maxBytes < 9) {
+ return 9;
}
+
+ /* Extension type */
+ rv = ssl3_ExtAppendHandshakeNumber(ss, ssl_use_srtp_xtn, 2);
+ if (rv != SECSuccess)
+ return -1;
+ /* Length of extension data */
+ rv = ssl3_ExtAppendHandshakeNumber(ss, 5, 2);
+ if (rv != SECSuccess)
+ return -1;
+ /* Length of the SRTP cipher list */
+ rv = ssl3_ExtAppendHandshakeNumber(ss, 2, 2);
+ if (rv != SECSuccess)
+ return -1;
/* The selected cipher */
- rv = sslBuffer_AppendNumber(buf, xtnData->dtlsSRTPCipherSuite, 2);
- if (rv != SECSuccess) {
- return SECFailure;
- }
+ rv = ssl3_ExtAppendHandshakeNumber(ss, xtnData->dtlsSRTPCipherSuite, 2);
+ if (rv != SECSuccess)
+ return -1;
/* Empty MKI value */
- rv = sslBuffer_AppendNumber(buf, 0, 1);
- if (rv != SECSuccess) {
- return SECFailure;
- }
+ ssl3_ExtAppendHandshakeVariable(ss, NULL, 0, 1);
- *added = PR_TRUE;
- return SECSuccess;
+ return 9;
}
SECStatus
-ssl3_ClientHandleUseSRTPXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- SECItem *data)
+ssl3_ClientHandleUseSRTPXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type, SECItem *data)
{
SECStatus rv;
SECItem ciphers = { siBuffer, NULL, 0 };
@@ -1558,8 +1718,7 @@ ssl3_ClientHandleUseSRTPXtn(const sslSocket *ss, TLSExtensionData *xtnData,
}
SECStatus
-ssl3_ServerHandleUseSRTPXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- SECItem *data)
+ssl3_ServerHandleUseSRTPXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type, SECItem *data)
{
SECStatus rv;
SECItem ciphers = { siBuffer, NULL, 0 };
@@ -1630,12 +1789,11 @@ ssl3_ServerHandleUseSRTPXtn(const sslSocket *ss, TLSExtensionData *xtnData,
ssl3_ServerSendUseSRTPXtn);
}
-/* ssl3_HandleSigAlgsXtn handles the signature_algorithms extension from a
- * client. In TLS 1.3, the client uses this to parse CertificateRequest
- * extensions. See https://tools.ietf.org/html/rfc5246#section-7.4.1.4.1 */
+/* ssl3_ServerHandleSigAlgsXtn handles the signature_algorithms extension
+ * from a client.
+ * See https://tools.ietf.org/html/rfc5246#section-7.4.1.4.1 */
SECStatus
-ssl3_HandleSigAlgsXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- SECItem *data)
+ssl3_ServerHandleSigAlgsXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type, SECItem *data)
{
SECStatus rv;
@@ -1644,15 +1802,15 @@ ssl3_HandleSigAlgsXtn(const sslSocket *ss, TLSExtensionData *xtnData,
return SECSuccess;
}
- if (xtnData->sigSchemes) {
- PORT_Free(xtnData->sigSchemes);
- xtnData->sigSchemes = NULL;
+ if (xtnData->clientSigSchemes) {
+ PORT_Free(xtnData->clientSigSchemes);
+ xtnData->clientSigSchemes = NULL;
}
rv = ssl_ParseSignatureSchemes(ss, NULL,
- &xtnData->sigSchemes,
- &xtnData->numSigSchemes,
+ &xtnData->clientSigSchemes,
+ &xtnData->numClientSigScheme,
&data->data, &data->len);
- if (rv != SECSuccess || xtnData->numSigSchemes == 0) {
+ if (rv != SECSuccess || xtnData->numClientSigScheme == 0) {
ssl3_ExtSendAlert(ss, alert_fatal, decode_error);
PORT_SetError(SSL_ERROR_RX_MALFORMED_CLIENT_HELLO);
return SECFailure;
@@ -1665,52 +1823,177 @@ ssl3_HandleSigAlgsXtn(const sslSocket *ss, TLSExtensionData *xtnData,
}
/* Keep track of negotiated extensions. */
- xtnData->negotiated[xtnData->numNegotiated++] = ssl_signature_algorithms_xtn;
+ xtnData->negotiated[xtnData->numNegotiated++] = ex_type;
return SECSuccess;
}
/* ssl3_ClientSendSigAlgsXtn sends the signature_algorithm extension for TLS
* 1.2 ClientHellos. */
-SECStatus
-ssl3_SendSigAlgsXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
+PRInt32
+ssl3_ClientSendSigAlgsXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRBool append, PRUint32 maxBytes)
{
+ PRInt32 extension_length;
+ PRUint8 buf[MAX_SIGNATURE_SCHEMES * 2];
+ PRUint32 len;
SECStatus rv;
if (ss->vrange.max < SSL_LIBRARY_VERSION_TLS_1_2) {
- return SECSuccess;
+ return 0;
}
- rv = ssl3_EncodeSigAlgs(ss, buf);
+ rv = ssl3_EncodeSigAlgs(ss, buf, sizeof(buf), &len);
if (rv != SECSuccess) {
- return SECFailure;
+ return -1;
}
- *added = PR_TRUE;
- return SECSuccess;
+ extension_length =
+ 2 /* extension type */ +
+ 2 /* extension length */ +
+ 2 /* supported_signature_algorithms length */ +
+ len;
+
+ if (maxBytes < extension_length) {
+ PORT_Assert(0);
+ return 0;
+ }
+
+ if (append) {
+ SECStatus rv;
+ rv = ssl3_ExtAppendHandshakeNumber(ss, ssl_signature_algorithms_xtn, 2);
+ if (rv != SECSuccess) {
+ return -1;
+ }
+ rv = ssl3_ExtAppendHandshakeNumber(ss, len + 2, 2);
+ if (rv != SECSuccess) {
+ return -1;
+ }
+
+ rv = ssl3_ExtAppendHandshakeVariable(ss, buf, len, 2);
+ if (rv != SECSuccess) {
+ return -1;
+ }
+
+ xtnData->advertised[xtnData->numAdvertised++] =
+ ssl_signature_algorithms_xtn;
+ }
+
+ return extension_length;
}
-SECStatus
-ssl3_SendExtendedMasterSecretXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
+/* Takes the size of the ClientHello, less the record header, and determines how
+ * much padding is required. */
+void
+ssl3_CalculatePaddingExtLen(sslSocket *ss,
+ unsigned int clientHelloLength)
+{
+ unsigned int recordLength = 1 /* handshake message type */ +
+ 3 /* handshake message length */ +
+ clientHelloLength;
+ unsigned int extensionLen;
+
+ /* Don't pad for DTLS, for SSLv3, or for renegotiation. */
+ if (IS_DTLS(ss) ||
+ ss->vrange.max < SSL_LIBRARY_VERSION_TLS_1_0 ||
+ ss->firstHsDone) {
+ return;
+ }
+
+ /* A padding extension may be included to ensure that the record containing
+ * the ClientHello doesn't have a length between 256 and 511 bytes
+ * (inclusive). Initial ClientHello records with such lengths trigger bugs
+ * in F5 devices. */
+ if (recordLength < 256 || recordLength >= 512) {
+ return;
+ }
+
+ extensionLen = 512 - recordLength;
+ /* Extensions take at least four bytes to encode. Always include at least
+ * one byte of data if we are padding. Some servers will time out or
+ * terminate the connection if the last ClientHello extension is empty. */
+ if (extensionLen < 4 + 1) {
+ extensionLen = 4 + 1;
+ }
+
+ ss->xtnData.paddingLen = extensionLen - 4;
+}
+
+/* ssl3_SendPaddingExtension possibly adds an extension which ensures that a
+ * ClientHello record is either < 256 bytes or is >= 512 bytes. This ensures
+ * that we don't trigger bugs in F5 products. */
+PRInt32
+ssl3_ClientSendPaddingExtension(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRBool append, PRUint32 maxBytes)
+{
+ static unsigned char padding[252] = { 0 };
+ unsigned int extensionLen;
+ SECStatus rv;
+
+ /* On the length-calculation pass, report zero total length. The record
+ * will be larger on the second pass if needed. */
+ if (!append || !xtnData->paddingLen) {
+ return 0;
+ }
+
+ extensionLen = xtnData->paddingLen + 4;
+ if (extensionLen > maxBytes ||
+ xtnData->paddingLen > sizeof(padding)) {
+ PORT_Assert(0);
+ return -1;
+ }
+
+ rv = ssl3_ExtAppendHandshakeNumber(ss, ssl_padding_xtn, 2);
+ if (rv != SECSuccess) {
+ return -1;
+ }
+ rv = ssl3_ExtAppendHandshakeVariable(ss, padding, xtnData->paddingLen, 2);
+ if (rv != SECSuccess) {
+ return -1;
+ }
+
+ return extensionLen;
+}
+
+PRInt32
+ssl3_SendExtendedMasterSecretXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRBool append,
+ PRUint32 maxBytes)
{
+ PRInt32 extension_length;
+
if (!ss->opt.enableExtendedMS) {
- return SECSuccess;
+ return 0;
}
/* Always send the extension in this function, since the
* client always sends it and this function is only called on
* the server if we negotiated the extension. */
- *added = PR_TRUE;
- return SECSuccess;
+ extension_length = 4; /* Type + length (0) */
+ if (maxBytes < extension_length) {
+ PORT_Assert(0);
+ return 0;
+ }
+
+ if (append) {
+ SECStatus rv;
+ rv = ssl3_ExtAppendHandshakeNumber(ss, ssl_extended_master_secret_xtn, 2);
+ if (rv != SECSuccess)
+ goto loser;
+ rv = ssl3_ExtAppendHandshakeNumber(ss, 0, 2);
+ if (rv != SECSuccess)
+ goto loser;
+ xtnData->advertised[xtnData->numAdvertised++] =
+ ssl_extended_master_secret_xtn;
+ }
+
+ return extension_length;
+
+loser:
+ return -1;
}
SECStatus
-ssl3_HandleExtendedMasterSecretXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ssl3_HandleExtendedMasterSecretXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type,
SECItem *data)
{
- PORT_Assert(ss->version < SSL_LIBRARY_VERSION_TLS_1_3);
-
if (ss->version < SSL_LIBRARY_VERSION_TLS_1_0) {
return SECSuccess;
}
@@ -1730,34 +2013,54 @@ ssl3_HandleExtendedMasterSecretXtn(const sslSocket *ss, TLSExtensionData *xtnDat
SSL_GETPID(), ss->fd));
/* Keep track of negotiated extensions. */
- xtnData->negotiated[xtnData->numNegotiated++] = ssl_extended_master_secret_xtn;
+ xtnData->negotiated[xtnData->numNegotiated++] = ex_type;
if (ss->sec.isServer) {
- return ssl3_RegisterExtensionSender(ss, xtnData,
- ssl_extended_master_secret_xtn,
- ssl_SendEmptyExtension);
+ return ssl3_RegisterExtensionSender(
+ ss, xtnData, ex_type, ssl3_SendExtendedMasterSecretXtn);
}
return SECSuccess;
}
/* ssl3_ClientSendSignedCertTimestampXtn sends the signed_certificate_timestamp
* extension for TLS ClientHellos. */
-SECStatus
-ssl3_ClientSendSignedCertTimestampXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
+PRInt32
+ssl3_ClientSendSignedCertTimestampXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRBool append,
+ PRUint32 maxBytes)
{
+ PRInt32 extension_length = 2 /* extension_type */ +
+ 2 /* length(extension_data) */;
+
/* Only send the extension if processing is enabled. */
- if (!ss->opt.enableSignedCertTimestamps) {
- return SECSuccess;
+ if (!ss->opt.enableSignedCertTimestamps)
+ return 0;
+
+ if (append && maxBytes >= extension_length) {
+ SECStatus rv;
+ /* extension_type */
+ rv = ssl3_ExtAppendHandshakeNumber(ss,
+ ssl_signed_cert_timestamp_xtn,
+ 2);
+ if (rv != SECSuccess)
+ goto loser;
+ /* zero length */
+ rv = ssl3_ExtAppendHandshakeNumber(ss, 0, 2);
+ if (rv != SECSuccess)
+ goto loser;
+ xtnData->advertised[xtnData->numAdvertised++] =
+ ssl_signed_cert_timestamp_xtn;
+ } else if (maxBytes < extension_length) {
+ PORT_Assert(0);
+ return 0;
}
- *added = PR_TRUE;
- return SECSuccess;
+ return extension_length;
+loser:
+ return -1;
}
SECStatus
-ssl3_ClientHandleSignedCertTimestampXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ssl3_ClientHandleSignedCertTimestampXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type,
SECItem *data)
{
/* We do not yet know whether we'll be resuming a session or creating
@@ -1777,34 +2080,54 @@ ssl3_ClientHandleSignedCertTimestampXtn(const sslSocket *ss, TLSExtensionData *x
}
*scts = *data;
/* Keep track of negotiated extensions. */
- xtnData->negotiated[xtnData->numNegotiated++] = ssl_signed_cert_timestamp_xtn;
+ xtnData->negotiated[xtnData->numNegotiated++] = ex_type;
return SECSuccess;
}
-SECStatus
+PRInt32
ssl3_ServerSendSignedCertTimestampXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
+ PRBool append,
+ PRUint32 maxBytes)
{
+ PRInt32 extension_length;
const SECItem *scts = &ss->sec.serverCert->signedCertTimestamps;
- SECStatus rv;
if (!scts->len) {
/* No timestamps to send */
- return SECSuccess;
+ return 0;
}
- rv = sslBuffer_Append(buf, scts->data, scts->len);
- if (rv != SECSuccess) {
- return SECFailure;
+ extension_length = 2 /* extension_type */ +
+ 2 /* length(extension_data) */ +
+ scts->len;
+
+ if (maxBytes < extension_length) {
+ PORT_Assert(0);
+ return 0;
+ }
+ if (append) {
+ SECStatus rv;
+ /* extension_type */
+ rv = ssl3_ExtAppendHandshakeNumber(ss,
+ ssl_signed_cert_timestamp_xtn,
+ 2);
+ if (rv != SECSuccess) {
+ return -1;
+ }
+ /* extension_data */
+ rv = ssl3_ExtAppendHandshakeVariable(ss, scts->data, scts->len, 2);
+ if (rv != SECSuccess) {
+ return -1;
+ }
}
- *added = PR_TRUE;
- return SECSuccess;
+ return extension_length;
}
SECStatus
ssl3_ServerHandleSignedCertTimestampXtn(const sslSocket *ss,
TLSExtensionData *xtnData,
+ PRUint16 ex_type,
SECItem *data)
{
if (data->len != 0) {
@@ -1813,25 +2136,22 @@ ssl3_ServerHandleSignedCertTimestampXtn(const sslSocket *ss,
return SECFailure;
}
- xtnData->negotiated[xtnData->numNegotiated++] = ssl_signed_cert_timestamp_xtn;
+ xtnData->negotiated[xtnData->numNegotiated++] = ex_type;
PORT_Assert(ss->sec.isServer);
- return ssl3_RegisterExtensionSender(ss, xtnData,
- ssl_signed_cert_timestamp_xtn,
- ssl3_ServerSendSignedCertTimestampXtn);
+ return ssl3_RegisterExtensionSender(
+ ss, xtnData, ex_type, ssl3_ServerSendSignedCertTimestampXtn);
}
/* Just make sure that the remote client supports uncompressed points,
* Since that is all we support. Disable ECC cipher suites if it doesn't.
*/
SECStatus
-ssl3_HandleSupportedPointFormatsXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
+ssl3_HandleSupportedPointFormatsXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRUint16 ex_type,
SECItem *data)
{
int i;
- PORT_Assert(ss->version < SSL_LIBRARY_VERSION_TLS_1_3);
-
if (data->len < 2 || data->len > 255 || !data->data ||
data->len != (unsigned int)data->data[0] + 1) {
ssl3_ExtDecodeError(ss);
@@ -1840,9 +2160,10 @@ ssl3_HandleSupportedPointFormatsXtn(const sslSocket *ss,
for (i = data->len; --i > 0;) {
if (data->data[i] == 0) {
/* indicate that we should send a reply */
- return ssl3_RegisterExtensionSender(
- ss, xtnData, ssl_ec_point_formats_xtn,
- &ssl3_SendSupportedPointFormatsXtn);
+ SECStatus rv;
+ rv = ssl3_RegisterExtensionSender(ss, xtnData, ex_type,
+ &ssl3_SendSupportedPointFormatsXtn);
+ return rv;
}
}
@@ -1927,7 +2248,7 @@ ssl_UpdateSupportedGroups(sslSocket *ss, SECItem *data)
*/
SECStatus
ssl_HandleSupportedGroupsXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- SECItem *data)
+ PRUint16 ex_type, SECItem *data)
{
SECStatus rv;
@@ -1937,7 +2258,7 @@ ssl_HandleSupportedGroupsXtn(const sslSocket *ss, TLSExtensionData *xtnData,
/* TLS 1.3 permits the server to send this extension so make it so. */
if (ss->sec.isServer && ss->version >= SSL_LIBRARY_VERSION_TLS_1_3) {
- rv = ssl3_RegisterExtensionSender(ss, xtnData, ssl_supported_groups_xtn,
+ rv = ssl3_RegisterExtensionSender(ss, xtnData, ex_type,
&ssl_SendSupportedGroupsXtn);
if (rv != SECSuccess) {
return SECFailure; /* error already set. */
@@ -1945,7 +2266,7 @@ ssl_HandleSupportedGroupsXtn(const sslSocket *ss, TLSExtensionData *xtnData,
}
/* Remember that we negotiated this extension. */
- xtnData->negotiated[xtnData->numNegotiated++] = ssl_supported_groups_xtn;
+ xtnData->negotiated[xtnData->numNegotiated++] = ex_type;
return SECSuccess;
}
diff --git a/security/nss/lib/ssl/ssl3exthandle.h b/security/nss/lib/ssl/ssl3exthandle.h
index b84bd074c0..5fdbe9053a 100644
--- a/security/nss/lib/ssl/ssl3exthandle.h
+++ b/security/nss/lib/ssl/ssl3exthandle.h
@@ -9,114 +9,90 @@
#ifndef __ssl3exthandle_h_
#define __ssl3exthandle_h_
-#include "sslencode.h"
-
-SECStatus ssl3_SendRenegotiationInfoXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added);
-SECStatus ssl3_HandleRenegotiationInfoXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- SECItem *data);
-SECStatus ssl3_ClientHandleNextProtoNegoXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- SECItem *data);
-SECStatus ssl3_ClientHandleAppProtoXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- SECItem *data);
-SECStatus ssl3_ServerHandleNextProtoNegoXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- SECItem *data);
-SECStatus ssl3_ServerHandleAppProtoXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
+PRInt32 ssl3_SendRenegotiationInfoXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRBool append, PRUint32 maxBytes);
+SECStatus ssl3_HandleRenegotiationInfoXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRUint16 ex_type, SECItem *data);
+SECStatus ssl3_ClientHandleNextProtoNegoXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRUint16 ex_type, SECItem *data);
+SECStatus ssl3_ClientHandleAppProtoXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRUint16 ex_type, SECItem *data);
+SECStatus ssl3_ServerHandleNextProtoNegoXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRUint16 ex_type, SECItem *data);
+SECStatus ssl3_ServerHandleAppProtoXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type,
SECItem *data);
-SECStatus ssl3_ClientSendNextProtoNegoXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added);
-SECStatus ssl3_ClientSendAppProtoXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added);
-SECStatus ssl3_ServerSendAppProtoXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added);
-SECStatus ssl3_ClientSendUseSRTPXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added);
-SECStatus ssl3_ServerSendUseSRTPXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added);
-SECStatus ssl3_ClientHandleUseSRTPXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
+PRInt32 ssl3_ClientSendNextProtoNegoXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRBool append,
+ PRUint32 maxBytes);
+PRInt32 ssl3_ClientSendAppProtoXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRBool append,
+ PRUint32 maxBytes);
+PRInt32 ssl3_ServerSendAppProtoXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRBool append,
+ PRUint32 maxBytes);
+PRInt32 ssl3_ClientSendUseSRTPXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRBool append,
+ PRUint32 maxBytes);
+PRInt32 ssl3_ServerSendUseSRTPXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRBool append,
+ PRUint32 maxBytes);
+SECStatus ssl3_ClientHandleUseSRTPXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type,
SECItem *data);
-SECStatus ssl3_ServerHandleUseSRTPXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
+SECStatus ssl3_ServerHandleUseSRTPXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type,
SECItem *data);
-SECStatus ssl3_ServerSendStatusRequestXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added);
-SECStatus ssl3_ServerHandleStatusRequestXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- SECItem *data);
-SECStatus ssl3_ClientHandleStatusRequestXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
+PRInt32 ssl3_ServerSendStatusRequestXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRBool append, PRUint32 maxBytes);
+SECStatus ssl3_ServerHandleStatusRequestXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRUint16 ex_type, SECItem *data);
+SECStatus ssl3_ClientHandleStatusRequestXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRUint16 ex_type,
SECItem *data);
-SECStatus ssl3_ClientSendStatusRequestXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added);
-SECStatus ssl3_SendSigAlgsXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added);
-SECStatus ssl3_HandleSigAlgsXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- SECItem *data);
+PRInt32 ssl3_ClientSendStatusRequestXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRBool append,
+ PRUint32 maxBytes);
+PRInt32 ssl3_ClientSendSigAlgsXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRBool append,
+ PRUint32 maxBytes);
+SECStatus ssl3_ServerHandleSigAlgsXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type,
+ SECItem *data);
-SECStatus ssl3_ClientSendPaddingExtension(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added);
+PRInt32 ssl3_ClientSendPaddingExtension(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRBool append, PRUint32 maxBytes);
-SECStatus ssl3_ClientSendSignedCertTimestampXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added);
-SECStatus ssl3_ClientHandleSignedCertTimestampXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
+PRInt32 ssl3_ClientSendSignedCertTimestampXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRBool append,
+ PRUint32 maxBytes);
+SECStatus ssl3_ClientHandleSignedCertTimestampXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRUint16 ex_type,
SECItem *data);
-SECStatus ssl3_ServerSendSignedCertTimestampXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added);
-SECStatus ssl3_ServerHandleSignedCertTimestampXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
+PRInt32 ssl3_ServerSendSignedCertTimestampXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRBool append,
+ PRUint32 maxBytes);
+SECStatus ssl3_ServerHandleSignedCertTimestampXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRUint16 ex_type,
SECItem *data);
-SECStatus ssl3_SendExtendedMasterSecretXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added);
-SECStatus ssl3_HandleExtendedMasterSecretXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
+PRInt32 ssl3_SendExtendedMasterSecretXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRBool append,
+ PRUint32 maxBytes);
+SECStatus ssl3_HandleExtendedMasterSecretXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRUint16 ex_type,
SECItem *data);
-SECStatus ssl3_ProcessSessionTicketCommon(sslSocket *ss, const SECItem *ticket,
- /* out */ SECItem *appToken);
-SECStatus ssl3_ClientSendServerNameXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added);
-SECStatus ssl3_HandleServerNameXtn(const sslSocket *ss,
+SECStatus ssl3_ProcessSessionTicketCommon(sslSocket *ss, SECItem *data);
+PRInt32 ssl3_SendServerNameXtn(const sslSocket *ss,
+ TLSExtensionData *xtnData,
+ PRBool append,
+ PRUint32 maxBytes);
+SECStatus ssl3_HandleServerNameXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRUint16 ex_type, SECItem *data);
+SECStatus ssl_HandleSupportedGroupsXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRUint16 ex_type, SECItem *data);
+SECStatus ssl3_HandleSupportedPointFormatsXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRUint16 ex_type, SECItem *data);
+SECStatus ssl3_ClientHandleSessionTicketXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRUint16 ex_type, SECItem *data);
+SECStatus ssl3_ServerHandleSessionTicketXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRUint16 ex_type, SECItem *data);
+PRInt32 ssl3_SendSessionTicketXtn(const sslSocket *ss,
+ TLSExtensionData *xtnData,
+ PRBool append,
+ PRUint32 maxBytes);
+
+PRInt32 ssl_SendSupportedGroupsXtn(const sslSocket *ss,
TLSExtensionData *xtnData,
- SECItem *data);
-SECStatus ssl_HandleSupportedGroupsXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- SECItem *data);
-SECStatus ssl3_HandleSupportedPointFormatsXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- SECItem *data);
-SECStatus ssl3_ClientHandleSessionTicketXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- SECItem *data);
-SECStatus ssl3_ServerHandleSessionTicketXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- SECItem *data);
-SECStatus ssl3_ClientSendSessionTicketXtn(const sslSocket *ss,
+ PRBool append, PRUint32 maxBytes);
+PRInt32 ssl3_SendSupportedPointFormatsXtn(const sslSocket *ss,
TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added);
-
-SECStatus ssl_SendSupportedGroupsXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added);
-SECStatus ssl3_SendSupportedPointFormatsXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added);
+ PRBool append, PRUint32 maxBytes);
#endif
diff --git a/security/nss/lib/ssl/ssl3gthr.c b/security/nss/lib/ssl/ssl3gthr.c
index 20404f4da2..cf6f4cb33e 100644
--- a/security/nss/lib/ssl/ssl3gthr.c
+++ b/security/nss/lib/ssl/ssl3gthr.c
@@ -1,4 +1,3 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* Gather (Read) entire SSL3 records from socket into buffer.
*
@@ -99,7 +98,7 @@ ssl3_GatherData(sslSocket *ss, sslGather *gs, int flags, ssl2Gather *ssl2gs)
PORT_Assert(ss->opt.noLocks || ssl_HaveRecvBufLock(ss));
if (gs->state == GS_INIT) {
gs->state = GS_HEADER;
- gs->remainder = 5;
+ gs->remainder = ss->ssl3.hs.shortHeaders ? 2 : 5;
gs->offset = 0;
gs->writeOffset = 0;
gs->readOffset = 0;
@@ -157,7 +156,19 @@ ssl3_GatherData(sslSocket *ss, sslGather *gs, int flags, ssl2Gather *ssl2gs)
/* Should have a non-SSLv2 record header in gs->hdr. Extract
* the length of the following encrypted data, and then
* read in the rest of the record into gs->inbuf. */
- gs->remainder = (gs->hdr[3] << 8) | gs->hdr[4];
+ if (ss->ssl3.hs.shortHeaders) {
+ PRUint16 len = (gs->hdr[0] << 8) | gs->hdr[1];
+ if (!(len & 0x8000)) {
+ SSL_DBG(("%d: SSL3[%d]: incorrectly formatted header"));
+ SSL3_SendAlert(ss, alert_fatal, illegal_parameter);
+ gs->state = GS_INIT;
+ PORT_SetError(SSL_ERROR_BAD_MAC_READ);
+ return SECFailure;
+ }
+ gs->remainder = len & ~0x8000;
+ } else {
+ gs->remainder = (gs->hdr[3] << 8) | gs->hdr[4];
+ }
} else {
/* Probably an SSLv2 record header. No need to handle any
* security escapes (gs->hdr[0] & 0x40) as we wouldn't get
@@ -350,9 +361,6 @@ dtls_GatherData(sslSocket *ss, sslGather *gs, int flags)
}
}
- SSL_TRC(20, ("%d: SSL3[%d]: dtls gathered record type=%d len=%d",
- SSL_GETPID(), ss->fd, gs->hdr[0], gs->inbuf.len));
-
memcpy(gs->inbuf.buf, gs->dtlsPacket.buf + gs->dtlsPacketOffset,
gs->remainder);
gs->inbuf.len = gs->remainder;
@@ -386,8 +394,7 @@ ssl3_GatherCompleteHandshake(sslSocket *ss, int flags)
SSL3Ciphertext cText;
PRBool keepGoing = PR_TRUE;
- SSL_TRC(30, ("%d: SSL3[%d]: ssl3_GatherCompleteHandshake",
- SSL_GETPID(), ss->fd));
+ SSL_TRC(30, ("ssl3_GatherCompleteHandshake"));
/* ssl3_HandleRecord may end up eventually calling ssl_FinishHandshake,
* which requires the 1stHandshakeLock, which must be acquired before the
@@ -398,12 +405,9 @@ ssl3_GatherCompleteHandshake(sslSocket *ss, int flags)
do {
PRBool handleRecordNow = PR_FALSE;
- PRBool processingEarlyData;
ssl_GetSSL3HandshakeLock(ss);
- processingEarlyData = ss->ssl3.hs.zeroRttState == ssl_0rtt_accepted;
-
/* Without this, we may end up wrongly reporting
* SSL_ERROR_RX_UNEXPECTED_* errors if we receive any records from the
* peer while we are waiting to be restarted.
@@ -489,12 +493,18 @@ ssl3_GatherCompleteHandshake(sslSocket *ss, int flags)
* If it's a change cipher spec, alert, or handshake message,
* ss->gs.buf.len will be 0 when ssl3_HandleRecord returns SECSuccess.
*/
- cText.type = (SSL3ContentType)ss->gs.hdr[0];
- cText.version = (ss->gs.hdr[1] << 8) | ss->gs.hdr[2];
+ if (ss->ssl3.hs.shortHeaders) {
+ cText.type = content_application_data;
+ cText.version = SSL_LIBRARY_VERSION_TLS_1_0;
+ } else {
+ cText.type = (SSL3ContentType)ss->gs.hdr[0];
+ cText.version = (ss->gs.hdr[1] << 8) | ss->gs.hdr[2];
+ }
if (IS_DTLS(ss)) {
sslSequenceNumber seq_num;
+ cText.version = dtls_DTLSVersionToTLSVersion(cText.version);
/* DTLS sequence number */
PORT_Memcpy(&seq_num, &ss->gs.hdr[3], sizeof(seq_num));
cText.seq_num = PR_ntohll(seq_num);
@@ -545,22 +555,12 @@ ssl3_GatherCompleteHandshake(sslSocket *ss, int flags)
} else {
ss->ssl3.hs.canFalseStart = PR_FALSE;
}
- } else if (processingEarlyData &&
- ss->ssl3.hs.zeroRttState == ssl_0rtt_done &&
- !PR_CLIST_IS_EMPTY(&ss->ssl3.hs.bufferedEarlyData)) {
- /* If we were processing early data and we are no longer, then force
- * the handshake to block. This ensures that early data is
- * delivered to the application before the handshake completes. */
- ssl_ReleaseSSL3HandshakeLock(ss);
- PORT_SetError(PR_WOULD_BLOCK_ERROR);
- return SECWouldBlock;
}
ssl_ReleaseSSL3HandshakeLock(ss);
} while (keepGoing);
- /* Service the DTLS timer so that the post-handshake timers
- * fire. */
- if (IS_DTLS(ss) && (ss->ssl3.hs.ws == idle_handshake)) {
+ /* Service the DTLS timer so that the holddown timer eventually fires. */
+ if (IS_DTLS(ss)) {
dtls_CheckTimer(ss);
}
ss->gs.readOffset = 0;
diff --git a/security/nss/lib/ssl/ssl3prot.h b/security/nss/lib/ssl/ssl3prot.h
index d1f46db971..ac31cf2630 100644
--- a/security/nss/lib/ssl/ssl3prot.h
+++ b/security/nss/lib/ssl/ssl3prot.h
@@ -16,12 +16,13 @@ typedef PRUint16 SSL3ProtocolVersion;
/* The TLS 1.3 draft version. Used to avoid negotiating
* between incompatible pre-standard TLS 1.3 drafts.
* TODO(ekr@rtfm.com): Remove when TLS 1.3 is published. */
-#define TLS_1_3_DRAFT_VERSION 23
+#define TLS_1_3_DRAFT_VERSION 18
typedef PRUint16 ssl3CipherSuite;
/* The cipher suites are defined in sslproto.h */
#define MAX_CERT_TYPES 10
+#define MAX_COMPRESSION_METHODS 10
#define MAX_MAC_LENGTH 64
#define MAX_PADDING_LENGTH 64
#define MAX_KEY_LENGTH 64
@@ -29,6 +30,7 @@ typedef PRUint16 ssl3CipherSuite;
#define SSL3_RANDOM_LENGTH 32
#define SSL3_RECORD_HEADER_LENGTH 5
+#define TLS13_RECORD_HEADER_LENGTH_SHORT 2
/* SSL3_RECORD_HEADER_LENGTH + epoch/sequence_number */
#define DTLS_RECORD_HEADER_LENGTH 13
@@ -39,18 +41,47 @@ typedef enum {
content_change_cipher_spec = 20,
content_alert = 21,
content_handshake = 22,
- content_application_data = 23,
- content_alt_handshake = 24,
- content_ack = 25
+ content_application_data = 23
} SSL3ContentType;
+typedef struct {
+ SSL3ContentType type;
+ SSL3ProtocolVersion version;
+ PRUint16 length;
+ SECItem fragment;
+} SSL3Plaintext;
+
+typedef struct {
+ SSL3ContentType type;
+ SSL3ProtocolVersion version;
+ PRUint16 length;
+ SECItem fragment;
+} SSL3Compressed;
+
+typedef struct {
+ SECItem content;
+ PRUint8 MAC[MAX_MAC_LENGTH];
+} SSL3GenericStreamCipher;
+
+typedef struct {
+ SECItem content;
+ PRUint8 MAC[MAX_MAC_LENGTH];
+ PRUint8 padding[MAX_PADDING_LENGTH];
+ PRUint8 padding_length;
+} SSL3GenericBlockCipher;
+
typedef enum { change_cipher_spec_choice = 1 } SSL3ChangeCipherSpecChoice;
+typedef struct {
+ SSL3ChangeCipherSpecChoice choice;
+} SSL3ChangeCipherSpec;
+
typedef enum { alert_warning = 1,
alert_fatal = 2 } SSL3AlertLevel;
typedef enum {
close_notify = 0,
+ end_of_early_data = 1, /* TLS 1.3 */
unexpected_message = 10,
bad_record_mac = 20,
decryption_failed_RESERVED = 21, /* do not send; see RFC 5246 */
@@ -91,13 +122,64 @@ typedef enum {
no_alert = 256
} SSL3AlertDescription;
-typedef PRUint8 SSL3Random[SSL3_RANDOM_LENGTH];
+typedef struct {
+ SSL3AlertLevel level;
+ SSL3AlertDescription description;
+} SSL3Alert;
+
+typedef enum {
+ hello_request = 0,
+ client_hello = 1,
+ server_hello = 2,
+ hello_verify_request = 3,
+ new_session_ticket = 4,
+ hello_retry_request = 6,
+ encrypted_extensions = 8,
+ certificate = 11,
+ server_key_exchange = 12,
+ certificate_request = 13,
+ server_hello_done = 14,
+ certificate_verify = 15,
+ client_key_exchange = 16,
+ finished = 20,
+ certificate_status = 22,
+ next_proto = 67
+} SSL3HandshakeType;
+
+typedef struct {
+ PRUint8 empty;
+} SSL3HelloRequest;
+
+typedef struct {
+ PRUint8 rand[SSL3_RANDOM_LENGTH];
+} SSL3Random;
typedef struct {
PRUint8 id[32];
PRUint8 length;
} SSL3SessionID;
+typedef struct {
+ SSL3ProtocolVersion client_version;
+ SSL3Random random;
+ SSL3SessionID session_id;
+ SECItem cipher_suites;
+ PRUint8 cm_count;
+ SSLCompressionMethod compression_methods[MAX_COMPRESSION_METHODS];
+} SSL3ClientHello;
+
+typedef struct {
+ SSL3ProtocolVersion server_version;
+ SSL3Random random;
+ SSL3SessionID session_id;
+ ssl3CipherSuite cipher_suite;
+ SSLCompressionMethod compression_method;
+} SSL3ServerHello;
+
+typedef struct {
+ SECItem list;
+} SSL3Certificate;
+
/* SSL3SignType moved to ssl.h */
/* The SSL key exchange method used */
@@ -119,6 +201,24 @@ typedef enum {
kea_tls13_any,
} SSL3KeyExchangeAlgorithm;
+typedef struct {
+ SECItem modulus;
+ SECItem exponent;
+} SSL3ServerRSAParams;
+
+typedef struct {
+ SECItem p;
+ SECItem g;
+ SECItem Ys;
+} SSL3ServerDHParams;
+
+typedef struct {
+ union {
+ SSL3ServerDHParams dh;
+ SSL3ServerRSAParams rsa;
+ } u;
+} SSL3ServerParams;
+
/* SSL3HashesIndividually contains a combination MD5/SHA1 hash, as used in TLS
* prior to 1.2. */
typedef struct {
@@ -135,9 +235,17 @@ typedef struct {
union {
PRUint8 raw[64];
SSL3HashesIndividually s;
+ unsigned int transcriptLen;
} u;
} SSL3Hashes;
+typedef struct {
+ union {
+ PRUint8 anonymous;
+ SSL3Hashes certified;
+ } u;
+} SSL3ServerKeyExchange;
+
typedef enum {
ct_RSA_sign = 1,
ct_DSS_sign = 2,
@@ -148,8 +256,16 @@ typedef enum {
ct_ECDSA_sign = 64,
ct_RSA_fixed_ECDH = 65,
ct_ECDSA_fixed_ECDH = 66
+
} SSL3ClientCertificateType;
+typedef struct {
+ PRUint8 client_version[2];
+ PRUint8 random[46];
+} SSL3RSAPreMasterSecret;
+
+typedef PRUint8 SSL3MasterSecret[48];
+
typedef enum {
sender_client = 0x434c4e54,
sender_server = 0x53525652
diff --git a/security/nss/lib/ssl/sslbloom.c b/security/nss/lib/ssl/sslbloom.c
deleted file mode 100644
index 3d5f9d1f17..0000000000
--- a/security/nss/lib/ssl/sslbloom.c
+++ /dev/null
@@ -1,94 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * A bloom filter.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "sslbloom.h"
-#include "prnetdb.h"
-#include "secport.h"
-
-static inline unsigned int
-sslBloom_Size(unsigned int bits)
-{
- return (bits >= 3) ? (1 << (bits - 3)) : 1;
-}
-
-SECStatus
-sslBloom_Init(sslBloomFilter *filter, unsigned int k, unsigned int bits)
-{
- PORT_Assert(filter);
- PORT_Assert(bits > 0);
- PORT_Assert(bits <= sizeof(PRUint32) * 8);
- PORT_Assert(k > 0);
-
- filter->filter = PORT_ZNewArray(PRUint8, sslBloom_Size(bits));
- if (!filter->filter) {
- return SECFailure; /* Error code already set. */
- }
-
- filter->k = k;
- filter->bits = bits;
- return SECSuccess;
-}
-
-void
-sslBloom_Zero(sslBloomFilter *filter)
-{
- PORT_Memset(filter->filter, 0, sslBloom_Size(filter->bits));
-}
-
-void
-sslBloom_Fill(sslBloomFilter *filter)
-{
- PORT_Memset(filter->filter, 0xff, sslBloom_Size(filter->bits));
-}
-
-static PRBool
-sslBloom_AddOrCheck(sslBloomFilter *filter, const PRUint8 *hashes, PRBool add)
-{
- unsigned int iteration;
- unsigned int bitIndex;
- PRUint32 tmp = 0;
- PRUint8 mask;
- unsigned int bytes = (filter->bits + 7) / 8;
- unsigned int shift = (bytes * 8) - filter->bits;
- PRBool found = PR_TRUE;
-
- PORT_Assert(bytes <= sizeof(unsigned int));
-
- for (iteration = 0; iteration < filter->k; ++iteration) {
- PORT_Memcpy(((PRUint8 *)&tmp) + (sizeof(tmp) - bytes),
- hashes, bytes);
- hashes += bytes;
- bitIndex = PR_ntohl(tmp) >> shift;
-
- mask = 1 << (bitIndex % 8);
- found = found && filter->filter[bitIndex / 8] & mask;
- if (add) {
- filter->filter[bitIndex / 8] |= mask;
- }
- }
- return found;
-}
-
-PRBool
-sslBloom_Add(sslBloomFilter *filter, const PRUint8 *hashes)
-{
- return sslBloom_AddOrCheck(filter, hashes, PR_TRUE);
-}
-
-PRBool
-sslBloom_Check(sslBloomFilter *filter, const PRUint8 *hashes)
-{
- return sslBloom_AddOrCheck(filter, hashes, PR_FALSE);
-}
-
-void
-sslBloom_Destroy(sslBloomFilter *filter)
-{
- PORT_Free(filter->filter);
- PORT_Memset(filter, 0, sizeof(*filter));
-}
diff --git a/security/nss/lib/ssl/sslbloom.h b/security/nss/lib/ssl/sslbloom.h
deleted file mode 100644
index 032c94b0f0..0000000000
--- a/security/nss/lib/ssl/sslbloom.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * A bloom filter.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef __sslbloom_h_
-#define __sslbloom_h_
-
-#include "prtypes.h"
-#include "seccomon.h"
-
-typedef struct sslBloomFilterStr {
- unsigned int k; /* The number of hashes. */
- unsigned int bits; /* The number of bits in each hash: bits = log2(m) */
- PRUint8 *filter; /* The filter itself. */
-} sslBloomFilter;
-
-SECStatus sslBloom_Init(sslBloomFilter *filter, unsigned int k, unsigned int bits);
-void sslBloom_Zero(sslBloomFilter *filter);
-void sslBloom_Fill(sslBloomFilter *filter);
-/* Add the given hashes to the filter. It's the caller's responsibility to
- * ensure that there is at least |ceil(k*bits/8)| bytes of data available in
- * |hashes|. Returns PR_TRUE if the entry was already present or it was likely
- * to be present. */
-PRBool sslBloom_Add(sslBloomFilter *filter, const PRUint8 *hashes);
-PRBool sslBloom_Check(sslBloomFilter *filter, const PRUint8 *hashes);
-void sslBloom_Destroy(sslBloomFilter *filter);
-
-#endif /* __sslbloom_h_ */
diff --git a/security/nss/lib/ssl/sslcert.c b/security/nss/lib/ssl/sslcert.c
index 6cd02e4025..cc1d3c6830 100644
--- a/security/nss/lib/ssl/sslcert.c
+++ b/security/nss/lib/ssl/sslcert.c
@@ -46,7 +46,7 @@ ssl_SetupCAListOnce(void *arg)
}
SECStatus
-ssl_SetupCAList(const sslSocket *ss)
+ssl_SetupCAList(sslSocket *ss)
{
if (PR_SUCCESS != PR_CallOnceWithArg(&ssl_server_ca_list.setup,
&ssl_SetupCAListOnce,
@@ -58,11 +58,11 @@ ssl_SetupCAList(const sslSocket *ss)
}
SECStatus
-ssl_GetCertificateRequestCAs(const sslSocket *ss, unsigned int *calen,
- const SECItem **names, unsigned int *nnames)
+ssl_GetCertificateRequestCAs(sslSocket *ss, unsigned int *calen,
+ SECItem **names, unsigned int *nnames)
{
- const SECItem *name;
- const CERTDistNames *ca_list;
+ SECItem *name;
+ CERTDistNames *ca_list;
unsigned int i;
*calen = 0;
diff --git a/security/nss/lib/ssl/sslencode.c b/security/nss/lib/ssl/sslencode.c
deleted file mode 100644
index 2f127fe8fd..0000000000
--- a/security/nss/lib/ssl/sslencode.c
+++ /dev/null
@@ -1,296 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is PRIVATE to SSL.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nss.h"
-#include "prnetdb.h"
-#include "ssl.h"
-#include "sslimpl.h"
-
-/* Helper function to encode an unsigned integer into a buffer. */
-static void
-ssl_EncodeUintX(PRUint8 *to, PRUint64 value, unsigned int bytes)
-{
- PRUint64 encoded;
-
- PORT_Assert(bytes > 0 && bytes <= sizeof(encoded));
-
- encoded = PR_htonll(value);
- PORT_Memcpy(to, ((unsigned char *)(&encoded)) + (sizeof(encoded) - bytes),
- bytes);
-}
-
-/* Grow a buffer to hold newLen bytes of data. When used for recv/xmit buffers,
- * the caller must hold xmitBufLock or recvBufLock, as appropriate. */
-SECStatus
-sslBuffer_Grow(sslBuffer *b, unsigned int newLen)
-{
- if (b->fixed) {
- PORT_Assert(newLen <= b->space);
- if (newLen > b->space) {
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
- }
- return SECSuccess;
- }
-
- newLen = PR_MAX(newLen, b->len + 1024);
- if (newLen > b->space) {
- unsigned char *newBuf;
- if (b->buf) {
- newBuf = (unsigned char *)PORT_Realloc(b->buf, newLen);
- } else {
- newBuf = (unsigned char *)PORT_Alloc(newLen);
- }
- if (!newBuf) {
- return SECFailure;
- }
- b->buf = newBuf;
- b->space = newLen;
- }
- return SECSuccess;
-}
-
-SECStatus
-sslBuffer_Append(sslBuffer *b, const void *data, unsigned int len)
-{
- SECStatus rv = sslBuffer_Grow(b, b->len + len);
- if (rv != SECSuccess) {
- return SECFailure; /* Code already set. */
- }
- PORT_Memcpy(SSL_BUFFER_NEXT(b), data, len);
- b->len += len;
- return SECSuccess;
-}
-
-SECStatus
-sslBuffer_AppendNumber(sslBuffer *b, PRUint64 v, unsigned int size)
-{
- SECStatus rv = sslBuffer_Grow(b, b->len + size);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- ssl_EncodeUintX(SSL_BUFFER_NEXT(b), v, size);
- b->len += size;
- return SECSuccess;
-}
-
-SECStatus
-sslBuffer_AppendVariable(sslBuffer *b, const PRUint8 *data, unsigned int len,
- unsigned int size)
-{
- PORT_Assert(size <= 4 && size > 0);
- if (len >= (1ULL << (8 * size))) {
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
- }
-
- if (sslBuffer_Grow(b, b->len + len + size) != SECSuccess) {
- return SECFailure;
- }
-
- ssl_EncodeUintX(SSL_BUFFER_NEXT(b), len, size);
- b->len += size;
- PORT_Memcpy(SSL_BUFFER_NEXT(b), data, len);
- b->len += len;
- return SECSuccess;
-}
-
-SECStatus
-sslBuffer_AppendBuffer(sslBuffer *b, const sslBuffer *append)
-{
- return sslBuffer_Append(b, append->buf, append->len);
-}
-
-SECStatus
-sslBuffer_AppendBufferVariable(sslBuffer *b, const sslBuffer *append,
- unsigned int size)
-{
- return sslBuffer_AppendVariable(b, append->buf, append->len, size);
-}
-
-SECStatus
-sslBuffer_Skip(sslBuffer *b, unsigned int size, unsigned int *savedOffset)
-{
- if (sslBuffer_Grow(b, b->len + size) != SECSuccess) {
- return SECFailure;
- }
-
- if (savedOffset) {
- *savedOffset = b->len;
- }
- b->len += size;
- return SECSuccess;
-}
-
-/* A common problem is that a buffer is used to construct a variable length
- * structure of unknown length. The length field for that structure is then
- * populated afterwards. This function makes this process a little easier.
- *
- * To use this, before encoding the variable length structure, skip the spot
- * where the length would be using sslBuffer_Skip(). After encoding the
- * structure, and before encoding anything else, call this function passing the
- * value returned from sslBuffer_Skip() as |at| to have the length inserted.
- */
-SECStatus
-sslBuffer_InsertLength(sslBuffer *b, unsigned int at, unsigned int size)
-{
- unsigned int len;
-
- PORT_Assert(b->len >= at + size);
- PORT_Assert(b->space >= at + size);
- len = b->len - (at + size);
-
- PORT_Assert(size <= 4 && size > 0);
- if (len >= (1ULL << (8 * size))) {
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
- }
-
- ssl_EncodeUintX(SSL_BUFFER_BASE(b) + at, len, size);
- return SECSuccess;
-}
-
-void
-sslBuffer_Clear(sslBuffer *b)
-{
- if (!b->fixed) {
- if (b->buf) {
- PORT_Free(b->buf);
- b->buf = NULL;
- }
- b->space = 0;
- }
- b->len = 0;
-}
-
-SECStatus
-ssl3_ConsumeFromItem(SECItem *item, unsigned char **buf, unsigned int size)
-{
- if (size > item->len) {
- PORT_SetError(SEC_ERROR_BAD_DATA);
- return SECFailure;
- }
-
- *buf = item->data;
- item->data += size;
- item->len -= size;
- return SECSuccess;
-}
-
-SECStatus
-ssl3_ConsumeNumberFromItem(SECItem *item, PRUint32 *num, unsigned int size)
-{
- int i;
-
- if (size > item->len || size > sizeof(*num)) {
- PORT_SetError(SEC_ERROR_BAD_DATA);
- return SECFailure;
- }
-
- *num = 0;
- for (i = 0; i < size; i++) {
- *num = (*num << 8) + item->data[i];
- }
-
- item->data += size;
- item->len -= size;
-
- return SECSuccess;
-}
-
-/**************************************************************************
- * Append Handshake functions.
- * All these functions set appropriate error codes.
- * Most rely on ssl3_AppendHandshake to set the error code.
- **************************************************************************/
-#define MAX_SEND_BUF_LENGTH 32000 /* watch for 16-bit integer overflow */
-#define MIN_SEND_BUF_LENGTH 4000
-
-SECStatus
-ssl3_AppendHandshake(sslSocket *ss, const void *void_src, unsigned int bytes)
-{
- unsigned char *src = (unsigned char *)void_src;
- int room = ss->sec.ci.sendBuf.space - ss->sec.ci.sendBuf.len;
- SECStatus rv;
-
- PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss)); /* protects sendBuf. */
-
- if (!bytes)
- return SECSuccess;
- if (ss->sec.ci.sendBuf.space < MAX_SEND_BUF_LENGTH && room < bytes) {
- rv = sslBuffer_Grow(&ss->sec.ci.sendBuf, PR_MAX(MIN_SEND_BUF_LENGTH,
- PR_MIN(MAX_SEND_BUF_LENGTH, ss->sec.ci.sendBuf.len + bytes)));
- if (rv != SECSuccess)
- return SECFailure; /* sslBuffer_Grow sets a memory error code. */
- room = ss->sec.ci.sendBuf.space - ss->sec.ci.sendBuf.len;
- }
-
- PRINT_BUF(60, (ss, "Append to Handshake", (unsigned char *)void_src, bytes));
- rv = ssl3_UpdateHandshakeHashes(ss, src, bytes);
- if (rv != SECSuccess)
- return SECFailure; /* error code set by ssl3_UpdateHandshakeHashes */
-
- while (bytes > room) {
- if (room > 0)
- PORT_Memcpy(ss->sec.ci.sendBuf.buf + ss->sec.ci.sendBuf.len, src,
- room);
- ss->sec.ci.sendBuf.len += room;
- rv = ssl3_FlushHandshake(ss, ssl_SEND_FLAG_FORCE_INTO_BUFFER);
- if (rv != SECSuccess) {
- return SECFailure; /* error code set by ssl3_FlushHandshake */
- }
- bytes -= room;
- src += room;
- room = ss->sec.ci.sendBuf.space;
- PORT_Assert(ss->sec.ci.sendBuf.len == 0);
- }
- PORT_Memcpy(ss->sec.ci.sendBuf.buf + ss->sec.ci.sendBuf.len, src, bytes);
- ss->sec.ci.sendBuf.len += bytes;
- return SECSuccess;
-}
-
-SECStatus
-ssl3_AppendHandshakeNumber(sslSocket *ss, PRUint64 num, unsigned int lenSize)
-{
- PRUint8 b[sizeof(num)];
- SSL_TRC(60, ("%d: number:", SSL_GETPID()));
- ssl_EncodeUintX(b, num, lenSize);
- return ssl3_AppendHandshake(ss, b, lenSize);
-}
-
-SECStatus
-ssl3_AppendHandshakeVariable(sslSocket *ss, const PRUint8 *src,
- unsigned int bytes, unsigned int lenSize)
-{
- SECStatus rv;
-
- PORT_Assert((bytes < (1 << 8) && lenSize == 1) ||
- (bytes < (1L << 16) && lenSize == 2) ||
- (bytes < (1L << 24) && lenSize == 3));
-
- SSL_TRC(60, ("%d: append variable:", SSL_GETPID()));
- rv = ssl3_AppendHandshakeNumber(ss, bytes, lenSize);
- if (rv != SECSuccess) {
- return SECFailure; /* error code set by AppendHandshake. */
- }
- SSL_TRC(60, ("data:"));
- return ssl3_AppendHandshake(ss, src, bytes);
-}
-
-SECStatus
-ssl3_AppendBufferToHandshake(sslSocket *ss, sslBuffer *buf)
-{
- return ssl3_AppendHandshake(ss, buf->buf, buf->len);
-}
-
-SECStatus
-ssl3_AppendBufferToHandshakeVariable(sslSocket *ss, sslBuffer *buf,
- unsigned int lenSize)
-{
- return ssl3_AppendHandshakeVariable(ss, buf->buf, buf->len, lenSize);
-}
diff --git a/security/nss/lib/ssl/sslencode.h b/security/nss/lib/ssl/sslencode.h
deleted file mode 100644
index a1b04d88f6..0000000000
--- a/security/nss/lib/ssl/sslencode.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is PRIVATE to SSL.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef __sslencode_h_
-#define __sslencode_h_
-
-/* A buffer object, used for assembling messages. */
-typedef struct sslBufferStr {
- PRUint8 *buf;
- unsigned int len;
- unsigned int space;
- /* Set to true if the storage for the buffer is fixed, such as a stack
- * variable or a view on another buffer. Growing a fixed buffer fails. */
- PRBool fixed;
-} sslBuffer;
-
-#define SSL_BUFFER_EMPTY \
- { \
- NULL, 0, 0, PR_FALSE \
- }
-#define SSL_BUFFER_FIXED(b, maxlen) \
- { \
- b, 0, maxlen, PR_TRUE \
- }
-#define SSL_BUFFER(b) SSL_BUFFER_FIXED(b, sizeof(b))
-#define SSL_BUFFER_BASE(b) ((b)->buf)
-#define SSL_BUFFER_LEN(b) ((b)->len)
-#define SSL_BUFFER_NEXT(b) ((b)->buf + (b)->len)
-#define SSL_BUFFER_SPACE(b) ((b)->space - (b)->len)
-
-SECStatus sslBuffer_Grow(sslBuffer *b, unsigned int newLen);
-SECStatus sslBuffer_Append(sslBuffer *b, const void *data, unsigned int len);
-SECStatus sslBuffer_AppendNumber(sslBuffer *b, PRUint64 v, unsigned int size);
-SECStatus sslBuffer_AppendVariable(sslBuffer *b, const PRUint8 *data,
- unsigned int len, unsigned int size);
-SECStatus sslBuffer_AppendBuffer(sslBuffer *b, const sslBuffer *append);
-SECStatus sslBuffer_AppendBufferVariable(sslBuffer *b, const sslBuffer *append,
- unsigned int size);
-SECStatus sslBuffer_Skip(sslBuffer *b, unsigned int size,
- unsigned int *savedOffset);
-SECStatus sslBuffer_InsertLength(sslBuffer *b, unsigned int at,
- unsigned int size);
-void sslBuffer_Clear(sslBuffer *b);
-
-/* All of these functions modify the underlying SECItem, and so should
- * be performed on a shallow copy.*/
-SECStatus ssl3_ConsumeFromItem(SECItem *item,
- PRUint8 **buf, unsigned int size);
-SECStatus ssl3_ConsumeNumberFromItem(SECItem *item,
- PRUint32 *num, unsigned int size);
-
-SECStatus ssl3_AppendHandshake(sslSocket *ss, const void *void_src,
- unsigned int bytes);
-SECStatus ssl3_AppendHandshakeHeader(sslSocket *ss,
- SSLHandshakeType t, unsigned int length);
-SECStatus ssl3_AppendHandshakeNumber(sslSocket *ss, PRUint64 num,
- unsigned int lenSize);
-SECStatus ssl3_AppendHandshakeVariable(sslSocket *ss, const PRUint8 *src,
- unsigned int bytes, unsigned int lenSize);
-SECStatus ssl3_AppendBufferToHandshake(sslSocket *ss, sslBuffer *buf);
-SECStatus ssl3_AppendBufferToHandshakeVariable(sslSocket *ss, sslBuffer *buf,
- unsigned int lenSize);
-
-#endif /* __sslencode_h_ */
diff --git a/security/nss/lib/ssl/sslerr.h b/security/nss/lib/ssl/sslerr.h
index 90815dd79d..865077cda6 100644
--- a/security/nss/lib/ssl/sslerr.h
+++ b/security/nss/lib/ssl/sslerr.h
@@ -234,7 +234,6 @@ typedef enum {
SSL_ERROR_MALFORMED_PRE_SHARED_KEY = (SSL_ERROR_BASE + 147),
SSL_ERROR_MALFORMED_EARLY_DATA = (SSL_ERROR_BASE + 148),
SSL_ERROR_END_OF_EARLY_DATA_ALERT = (SSL_ERROR_BASE + 149),
- /* error 149 is obsolete */
SSL_ERROR_MISSING_ALPN_EXTENSION = (SSL_ERROR_BASE + 150),
SSL_ERROR_RX_UNEXPECTED_EXTENSION = (SSL_ERROR_BASE + 151),
SSL_ERROR_MISSING_SUPPORTED_GROUPS_EXTENSION = (SSL_ERROR_BASE + 152),
@@ -247,19 +246,6 @@ typedef enum {
SSL_ERROR_MISSING_PSK_KEY_EXCHANGE_MODES = (SSL_ERROR_BASE + 159),
SSL_ERROR_DOWNGRADE_WITH_EARLY_DATA = (SSL_ERROR_BASE + 160),
SSL_ERROR_TOO_MUCH_EARLY_DATA = (SSL_ERROR_BASE + 161),
- SSL_ERROR_RX_UNEXPECTED_END_OF_EARLY_DATA = (SSL_ERROR_BASE + 162),
- SSL_ERROR_RX_MALFORMED_END_OF_EARLY_DATA = (SSL_ERROR_BASE + 163),
-
- SSL_ERROR_UNSUPPORTED_EXPERIMENTAL_API = (SSL_ERROR_BASE + 164),
-
- SSL_ERROR_APPLICATION_ABORT = (SSL_ERROR_BASE + 165),
- SSL_ERROR_APP_CALLBACK_ERROR = (SSL_ERROR_BASE + 166),
- SSL_ERROR_NO_TIMERS_FOUND = (SSL_ERROR_BASE + 167),
- SSL_ERROR_MISSING_COOKIE_EXTENSION = (SSL_ERROR_BASE + 168),
-
- SSL_ERROR_RX_UNEXPECTED_KEY_UPDATE = (SSL_ERROR_BASE + 169),
- SSL_ERROR_RX_MALFORMED_KEY_UPDATE = (SSL_ERROR_BASE + 170),
- SSL_ERROR_TOO_MANY_KEY_UPDATES = (SSL_ERROR_BASE + 171),
SSL_ERROR_END_OF_LIST /* let the c compiler determine the value of this. */
} SSLErrorCodes;
#endif /* NO_SECURITY_ERROR_ENUM */
diff --git a/security/nss/lib/ssl/sslexp.h b/security/nss/lib/ssl/sslexp.h
deleted file mode 100644
index 569add8610..0000000000
--- a/security/nss/lib/ssl/sslexp.h
+++ /dev/null
@@ -1,358 +0,0 @@
-/*
- * This file contains prototypes for experimental SSL functions.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef __sslexp_h_
-#define __sslexp_h_
-
-#include "ssl.h"
-#include "sslerr.h"
-
-SEC_BEGIN_PROTOS
-
-/* The functions in this header file are not guaranteed to remain available in
- * future NSS versions. Code that uses these functions needs to safeguard
- * against the function not being available. */
-
-#define SSL_EXPERIMENTAL_API(name, arglist, args) \
- (SSL_GetExperimentalAPI(name) \
- ? ((SECStatus(*) arglist)SSL_GetExperimentalAPI(name))args \
- : SECFailure)
-#define SSL_DEPRECATED_EXPERIMENTAL_API \
- (PR_SetError(SSL_ERROR_UNSUPPORTED_EXPERIMENTAL_API, 0), SECFailure)
-
-/*
- * SSL_GetExtensionSupport() returns whether NSS supports a particular TLS
- * extension.
- *
- * - ssl_ext_none indicates that NSS does not support the extension and
- * extension hooks can be installed.
- *
- * - ssl_ext_native indicates that NSS supports the extension natively, but
- * allows an application to override that support and install its own
- * extension hooks.
- *
- * - ssl_ext_native_only indicates that NSS supports the extension natively
- * and does not permit custom extension hooks to be installed. These
- * extensions are critical to the functioning of NSS.
- */
-typedef enum {
- ssl_ext_none,
- ssl_ext_native,
- ssl_ext_native_only
-} SSLExtensionSupport;
-
-#define SSL_GetExtensionSupport(extension, support) \
- SSL_EXPERIMENTAL_API("SSL_GetExtensionSupport", \
- (PRUint16 _extension, \
- SSLExtensionSupport * _support), \
- (extension, support))
-
-/*
- * Custom extension hooks.
- *
- * The SSL_InstallExtensionHooks() registers two callback functions for use
- * with the identified extension type.
- *
- * Installing extension hooks disables the checks in TLS 1.3 that ensure that
- * extensions are only added to the correct messages. The application is
- * responsible for ensuring that extensions are only sent with the right message
- * or messages.
- *
- * Installing an extension handler does not disable checks for whether an
- * extension can be used in a message that is a response to an extension in
- * another message. Extensions in ServerHello, EncryptedExtensions and the
- * server Certificate messages are rejected unless the client sends an extension
- * in the ClientHello. Similarly, a client Certificate message cannot contain
- * extensions that don't appear in a CertificateRequest (in TLS 1.3).
- *
- * Setting both |writer| and |handler| to NULL removes any existing hooks for
- * that extension.
- *
- * == SSLExtensionWriter
- *
- * An SSLExtensionWriter function is responsible for constructing the contents
- * of an extension. This function is called during the construction of all
- * handshake messages where an extension might be included.
- *
- * - The |fd| argument is the socket file descriptor.
- *
- * - The |message| argument is the TLS handshake message type. The writer will
- * be called for every handshake message that NSS sends. Most extensions
- * should only be sent in a subset of messages. NSS doesn’t check that
- * extension writers don’t violate protocol rules regarding which message an
- * extension can be sent in.
- *
- * - The |data| argument is a pointer to a buffer that should be written to with
- * any data for the extension.
- *
- * - The |len| argument is an outparam indicating how many bytes were written to
- * |data|. The value referenced by |len| is initialized to zero, so an
- * extension that is empty does not need to write to this value.
- *
- * - The |maxLen| indicates the maximum number of bytes that can be written to
- * |data|.
- *
- * - The |arg| argument is the value of the writerArg that was passed during
- * installation.
- *
- * An SSLExtensionWriter function returns PR_TRUE if an extension should be
- * written, and PR_FALSE otherwise.
- *
- * If there is an error, return PR_FALSE; if the error is truly fatal, the
- * application can mark the connection as failed. However, recursively calling
- * functions that alter the file descriptor in the callback - such as PR_Close()
- * - should be avoided.
- *
- * Note: The ClientHello message can be sent twice in TLS 1.3. An
- * SSLExtensionWriter will be called twice with the same arguments in that case;
- * NSS does not distinguish between a first and second ClientHello. It is up to
- * the application to track this if it needs to act differently each time. In
- * most cases the correct behaviour is to provide an identical extension on each
- * invocation.
- *
- * == SSLExtensionHandler
- *
- * An SSLExtensionHandler function consumes a handshake message. This function
- * is called when an extension is present.
- *
- * - The |fd| argument is the socket file descriptor.
- *
- * - The |message| argument is the TLS handshake message type. This can be used
- * to validate that the extension was included in the correct handshake
- * message.
- *
- * - The |data| argument points to the contents of the extension.
- *
- * - The |len| argument contains the length of the extension.
- *
- * - The |alert| argument is an outparam that allows an application to choose
- * which alert is sent in the case of a fatal error.
- *
- * - The |arg| argument is the value of the handlerArg that was passed during
- * installation.
- *
- * An SSLExtensionHandler function returns SECSuccess when the extension is
- * process successfully. It can return SECFailure to cause the handshake to
- * fail. If the value of alert is written to, NSS will generate a fatal alert
- * using the provided alert code. The value of |alert| is otherwise not used.
- */
-typedef PRBool(PR_CALLBACK *SSLExtensionWriter)(
- PRFileDesc *fd, SSLHandshakeType message,
- PRUint8 *data, unsigned int *len, unsigned int maxLen, void *arg);
-
-typedef SECStatus(PR_CALLBACK *SSLExtensionHandler)(
- PRFileDesc *fd, SSLHandshakeType message,
- const PRUint8 *data, unsigned int len,
- SSLAlertDescription *alert, void *arg);
-
-#define SSL_InstallExtensionHooks(fd, extension, writer, writerArg, \
- handler, handlerArg) \
- SSL_EXPERIMENTAL_API("SSL_InstallExtensionHooks", \
- (PRFileDesc * _fd, PRUint16 _extension, \
- SSLExtensionWriter _writer, void *_writerArg, \
- SSLExtensionHandler _handler, void *_handlerArg), \
- (fd, extension, writer, writerArg, \
- handler, handlerArg))
-
-/*
- * Setup the anti-replay buffer for supporting 0-RTT in TLS 1.3 on servers.
- *
- * To use 0-RTT on a server, you must call this function. Failing to call this
- * function will result in all 0-RTT being rejected. Connections will complete,
- * but early data will be rejected.
- *
- * NSS uses a Bloom filter to track the ClientHello messages that it receives
- * (specifically, it uses the PSK binder). This function initializes a pair of
- * Bloom filters. The two filters are alternated over time, with new
- * ClientHello messages recorded in the current filter and, if they are not
- * already present, being checked against the previous filter. If the
- * ClientHello is found, then early data is rejected, but the handshake is
- * allowed to proceed.
- *
- * The false-positive probability of Bloom filters means that some valid
- * handshakes will be marked as potential replays. Early data will be rejected
- * for a false positive. To minimize this and to allow a trade-off of space
- * against accuracy, the size of the Bloom filter can be set by this function.
- *
- * The first tuning parameter to consider is |window|, which determines the
- * window over which ClientHello messages will be tracked. This also causes
- * early data to be rejected if a ClientHello contains a ticket age parameter
- * that is outside of this window (see Section 4.2.10.4 of
- * draft-ietf-tls-tls13-20 for details). Set |window| to account for any
- * potential sources of clock error. |window| is the entire width of the
- * window, which is symmetrical. Therefore to allow 5 seconds of clock error in
- * both directions, set the value to 10 seconds (i.e., 10 * PR_USEC_PER_SEC).
- *
- * After calling this function, early data will be rejected until |window|
- * elapses. This prevents replay across crashes and restarts. Only call this
- * function once to avoid inadvertently disabling 0-RTT (use PR_CallOnce() to
- * avoid this problem).
- *
- * The primary tuning parameter is |bits| which determines the amount of memory
- * allocated to each Bloom filter. NSS will allocate two Bloom filters, each
- * |2^(bits - 3)| octets in size. The value of |bits| is primarily driven by
- * the number of connections that are expected in any time window. Note that
- * this needs to account for there being two filters both of which have
- * (presumably) independent false positive rates. The following formulae can be
- * used to find a value of |bits| and |k| given a chosen false positive
- * probability |p| and the number of requests expected in a given window |n|:
- *
- * bits = log2(n) + log2(-ln(1 - sqrt(1 - p))) + 1.0575327458897952
- * k = -log2(p)
- *
- * ... where log2 and ln are base 2 and e logarithms respectively. For a target
- * false positive rate of 1% and 1000 handshake attempts, this produces bits=14
- * and k=7. This results in two Bloom filters that are 2kB each in size. Note
- * that rounding |k| and |bits| up causes the false positive probability for
- * these values to be a much lower 0.123%.
- *
- * IMPORTANT: This anti-replay scheme has several weaknesses. See the TLS 1.3
- * specification for the details of the generic problems with this technique.
- *
- * In addition to the generic anti-replay weaknesses, the state that the server
- * maintains is in local memory only. Servers that operate in a cluster, even
- * those that use shared memory for tickets, will not share anti-replay state.
- * Early data can be replayed at least once with every server instance that will
- * accept tickets that are encrypted with the same key.
- */
-#define SSL_SetupAntiReplay(window, k, bits) \
- SSL_EXPERIMENTAL_API("SSL_SetupAntiReplay", \
- (PRTime _window, unsigned int _k, unsigned int _bits), \
- (window, k, bits))
-
-/*
- * This function allows a server application to generate a session ticket that
- * will embed the provided token.
- *
- * This function will cause a NewSessionTicket message to be sent by a server.
- * This happens even if SSL_ENABLE_SESSION_TICKETS is disabled. This allows a
- * server to suppress the usually automatic generation of a session ticket at
- * the completion of the handshake - which do not include any token - and to
- * control when session tickets are transmitted.
- *
- * This function will fail unless the socket has an active TLS 1.3 session.
- * Earlier versions of TLS do not support the spontaneous sending of the
- * NewSessionTicket message.
- */
-#define SSL_SendSessionTicket(fd, appToken, appTokenLen) \
- SSL_EXPERIMENTAL_API("SSL_SendSessionTicket", \
- (PRFileDesc * _fd, const PRUint8 *_appToken, \
- unsigned int _appTokenLen), \
- (fd, appToken, appTokenLen))
-
-/*
- * A stateless retry handler gives an application some control over NSS handling
- * of ClientHello messages.
- *
- * SSL_HelloRetryRequestCallback() installs a callback that allows an
- * application to control how NSS sends HelloRetryRequest messages. This
- * handler is only used on servers and will only be called if the server selects
- * TLS 1.3. Support for older TLS versions could be added in other releases.
- *
- * The SSLHelloRetryRequestCallback is invoked during the processing of a
- * TLS 1.3 ClientHello message. It takes the following arguments:
- *
- * - |firstHello| indicates if the NSS believes that this is an initial
- * ClientHello. An initial ClientHello will never include a cookie extension,
- * though it may contain a session ticket.
- *
- * - |clientToken| includes a token previously provided by the application. If
- * |clientTokenLen| is 0, then |clientToken| may be NULL.
- *
- * - If |firstHello| is PR_FALSE, the value that was provided in the
- * |retryToken| outparam of previous invocations of this callback will be
- * present here.
- *
- * - If |firstHello| is PR_TRUE, and the handshake is resuming a session, then
- * this will contain any value that was passed in the |token| parameter of
- * SSL_SendNewSessionTicket() method (see below). If this is not resuming a
- * session, then the token will be empty (and this value could be NULL).
- *
- * - |clientTokenLen| is the length of |clientToken|.
- *
- * - |retryToken| is an item that callback can write to. This provides NSS with
- * a token. This token is encrypted and integrity protected and embedded in
- * the cookie extension of a HelloRetryRequest. The value of this field is
- * only used if the handler returns ssl_stateless_retry_check. NSS allocates
- * space for this value.
- *
- * - |retryTokenLen| is an outparam for the length of the token. If this value
- * is not set, or set to 0, an empty token will be sent.
- *
- * - |retryTokenMax| is the size of the space allocated for retryToken. An
- * application cannot write more than this many bytes to retryToken.
- *
- * - |arg| is the same value that was passed to
- * SSL_InstallStatelessRetryHandler().
- *
- * The handler can validate any the value of |clientToken|, query the socket
- * status (using SSL_GetPreliminaryChannelInfo() for example) and decide how to
- * proceed:
- *
- * - Returning ssl_hello_retry_fail causes the handshake to fail. This might be
- * used if the token is invalid or the application wishes to abort the
- * handshake.
- *
- * - Returning ssl_hello_retry_accept causes the handshake to proceed.
- *
- * - Returning ssl_hello_retry_request causes NSS to send a HelloRetryRequest
- * message and request a second ClientHello. NSS generates a cookie extension
- * and embeds the value of |retryToken|. The value of |retryToken| value may
- * be left empty if the application does not require any additional context to
- * validate a second ClientHello attempt. This return code cannot be used to
- * reject a second ClientHello (i.e., when firstHello is PR_FALSE); NSS will
- * abort the handshake if this value is returned from a second call.
- *
- * An application that chooses to perform a stateless retry can discard the
- * server socket. All necessary state to continue the TLS handshake will be
- * included in the cookie extension. This makes it possible to use a new socket
- * to handle the remainder of the handshake. The existing socket can be safely
- * discarded.
- *
- * If the same socket is retained, the information in the cookie will be checked
- * for consistency against the existing state of the socket. Any discrepancy
- * will result in the connection being closed.
- *
- * Tokens should be kept as small as possible. NSS sets a limit on the size of
- * tokens, which it passes in |retryTokenMax|. Depending on circumstances,
- * observing a smaller limit might be desirable or even necessary. For
- * instance, having HelloRetryRequest and ClientHello fit in a single packet has
- * significant performance benefits.
- */
-typedef enum {
- ssl_hello_retry_fail,
- ssl_hello_retry_accept,
- ssl_hello_retry_request
-} SSLHelloRetryRequestAction;
-
-typedef SSLHelloRetryRequestAction(PR_CALLBACK *SSLHelloRetryRequestCallback)(
- PRBool firstHello, const PRUint8 *clientToken, unsigned int clientTokenLen,
- PRUint8 *retryToken, unsigned int *retryTokenLen, unsigned int retryTokMax,
- void *arg);
-
-#define SSL_HelloRetryRequestCallback(fd, cb, arg) \
- SSL_EXPERIMENTAL_API("SSL_HelloRetryRequestCallback", \
- (PRFileDesc * _fd, \
- SSLHelloRetryRequestCallback _cb, void *_arg), \
- (fd, cb, arg))
-
-/* Update traffic keys (TLS 1.3 only).
- *
- * The |requestUpdate| flag determines whether to request an update from the
- * remote peer.
- */
-#define SSL_KeyUpdate(fd, requestUpdate) \
- SSL_EXPERIMENTAL_API("SSL_KeyUpdate", \
- (PRFileDesc * _fd, PRBool _requestUpdate), \
- (fd, requestUpdate))
-
-#define SSL_UseAltServerHelloType(fd, enable) \
- SSL_DEPRECATED_EXPERIMENTAL_API
-
-SEC_END_PROTOS
-
-#endif /* __sslexp_h_ */
diff --git a/security/nss/lib/ssl/sslimpl.h b/security/nss/lib/ssl/sslimpl.h
index dee9aa20fe..64694b0df9 100644
--- a/security/nss/lib/ssl/sslimpl.h
+++ b/security/nss/lib/ssl/sslimpl.h
@@ -19,7 +19,6 @@
#include "secport.h"
#include "secerr.h"
#include "sslerr.h"
-#include "sslexp.h"
#include "ssl3prot.h"
#include "hasht.h"
#include "nssilock.h"
@@ -35,11 +34,36 @@
#include "sslt.h" /* for some formerly private types, now public */
typedef struct sslSocketStr sslSocket;
-typedef struct sslNamedGroupDefStr sslNamedGroupDef;
-#include "sslencode.h"
-#include "sslexp.h"
+typedef struct ssl3CipherSpecStr ssl3CipherSpec;
#include "ssl3ext.h"
-#include "sslspec.h"
+
+/* to make some of these old enums public without namespace pollution,
+** it was necessary to prepend ssl_ to the names.
+** These #defines preserve compatibility with the old code here in libssl.
+*/
+typedef SSLMACAlgorithm SSL3MACAlgorithm;
+
+#define calg_null ssl_calg_null
+#define calg_rc4 ssl_calg_rc4
+#define calg_rc2 ssl_calg_rc2
+#define calg_des ssl_calg_des
+#define calg_3des ssl_calg_3des
+#define calg_idea ssl_calg_idea
+#define calg_fortezza ssl_calg_fortezza /* deprecated, must preserve */
+#define calg_aes ssl_calg_aes
+#define calg_camellia ssl_calg_camellia
+#define calg_seed ssl_calg_seed
+#define calg_aes_gcm ssl_calg_aes_gcm
+#define calg_chacha20 ssl_calg_chacha20
+
+#define mac_null ssl_mac_null
+#define mac_md5 ssl_mac_md5
+#define mac_sha ssl_mac_sha
+#define hmac_md5 ssl_hmac_md5
+#define hmac_sha ssl_hmac_sha
+#define hmac_sha256 ssl_hmac_sha256
+#define hmac_sha384 ssl_hmac_sha384
+#define mac_aead ssl_mac_aead
#if defined(DEBUG) || defined(TRACE)
#ifdef __cplusplus
@@ -136,7 +160,7 @@ typedef enum {
ticket_allow_psk_sign_auth = 16
} TLS13SessionTicketFlags;
-struct sslNamedGroupDefStr {
+typedef struct {
/* The name is the value that is encoded on the wire in TLS. */
SSLNamedGroup name;
/* The number of bits in the group. */
@@ -148,8 +172,9 @@ struct sslNamedGroupDefStr {
SECOidTag oidTag;
/* Assume that the group is always supported. */
PRBool assumeSupported;
-};
+} sslNamedGroupDef;
+typedef struct sslBufferStr sslBuffer;
typedef struct sslConnectInfoStr sslConnectInfo;
typedef struct sslGatherStr sslGather;
typedef struct sslSecurityInfoStr sslSecurityInfo;
@@ -158,6 +183,8 @@ typedef struct sslSocketOpsStr sslSocketOps;
typedef struct ssl3StateStr ssl3State;
typedef struct ssl3CertNodeStr ssl3CertNode;
+typedef struct ssl3BulkCipherDefStr ssl3BulkCipherDef;
+typedef struct ssl3MACDefStr ssl3MACDef;
typedef struct sslKeyPairStr sslKeyPair;
typedef struct ssl3DHParamsStr ssl3DHParams;
@@ -174,6 +201,9 @@ typedef sslSessionID *(*sslSessionIDLookupFunc)(const PRIPv6Addr *addr,
unsigned char *sid,
unsigned int sidLen,
CERTCertDBHandle *dbHandle);
+typedef void (*sslCipherSpecChangedFunc)(void *arg,
+ PRBool sending,
+ ssl3CipherSpec *newSpec);
/* Socket ops */
struct sslSocketOpsStr {
@@ -199,9 +229,20 @@ struct sslSocketOpsStr {
#define ssl_SEND_FLAG_FORCE_INTO_BUFFER 0x40000000
#define ssl_SEND_FLAG_NO_BUFFER 0x20000000
#define ssl_SEND_FLAG_NO_RETRANSMIT 0x08000000 /* DTLS only */
+#define ssl_SEND_FLAG_CAP_RECORD_VERSION \
+ 0x04000000 /* TLS only */
#define ssl_SEND_FLAG_MASK 0x7f000000
/*
+** A buffer object.
+*/
+struct sslBufferStr {
+ unsigned char *buf;
+ unsigned int len;
+ unsigned int space;
+};
+
+/*
** SSL3 cipher suite policy and preference struct.
*/
typedef struct {
@@ -241,7 +282,7 @@ typedef struct sslOptionsStr {
unsigned int detectRollBack : 1;
unsigned int noLocks : 1;
unsigned int enableSessionTickets : 1;
- unsigned int enableDeflate : 1; /* Deprecated. */
+ unsigned int enableDeflate : 1;
unsigned int enableRenegotiation : 2;
unsigned int requireSafeNegotiation : 1;
unsigned int enableFalseStart : 1;
@@ -256,7 +297,7 @@ typedef struct sslOptionsStr {
unsigned int enableSignedCertTimestamps : 1;
unsigned int requireDHENamedGroups : 1;
unsigned int enable0RttData : 1;
- unsigned int enableTls13CompatMode : 1;
+ unsigned int enableShortHeaders : 1;
} sslOptions;
typedef enum { sslHandshakingUndetermined = 0,
@@ -341,13 +382,136 @@ struct sslGatherStr {
#define GS_HEADER 1
#define GS_DATA 2
+/*
+** ssl3State and CipherSpec structs
+*/
+
+/* The SSL bulk cipher definition */
+typedef enum {
+ cipher_null,
+ cipher_rc4,
+ cipher_des,
+ cipher_3des,
+ cipher_aes_128,
+ cipher_aes_256,
+ cipher_camellia_128,
+ cipher_camellia_256,
+ cipher_seed,
+ cipher_aes_128_gcm,
+ cipher_aes_256_gcm,
+ cipher_chacha20,
+ cipher_missing /* reserved for no such supported cipher */
+ /* This enum must match ssl3_cipherName[] in ssl3con.c. */
+} SSL3BulkCipher;
+
+typedef enum { type_stream,
+ type_block,
+ type_aead } CipherType;
+
+#define MAX_IV_LENGTH 24
+
+typedef PRUint64 sslSequenceNumber;
+typedef PRUint16 DTLSEpoch;
+
+typedef void (*DTLSTimerCb)(sslSocket *);
+
typedef struct {
PRUint8 wrapped_master_secret[48];
PRUint16 wrapped_master_secret_len;
+ PRUint8 msIsWrapped;
PRUint8 resumable;
PRUint8 extendedMasterSecretUsed;
} ssl3SidKeys; /* 52 bytes */
+typedef struct {
+ PK11SymKey *write_key;
+ PK11SymKey *write_mac_key;
+ PK11Context *write_mac_context;
+ SECItem write_key_item;
+ SECItem write_iv_item;
+ SECItem write_mac_key_item;
+ PRUint8 write_iv[MAX_IV_LENGTH];
+} ssl3KeyMaterial;
+
+typedef SECStatus (*SSLCipher)(void *context,
+ unsigned char *out,
+ int *outlen,
+ int maxout,
+ const unsigned char *in,
+ int inlen);
+typedef SECStatus (*SSLAEADCipher)(
+ ssl3KeyMaterial *keys,
+ PRBool doDecrypt,
+ unsigned char *out,
+ int *outlen,
+ int maxout,
+ const unsigned char *in,
+ int inlen,
+ const unsigned char *additionalData,
+ int additionalDataLen);
+typedef SECStatus (*SSLCompressor)(void *context,
+ unsigned char *out,
+ int *outlen,
+ int maxout,
+ const unsigned char *in,
+ int inlen);
+typedef SECStatus (*SSLDestroy)(void *context, PRBool freeit);
+
+/* The DTLS anti-replay window in number of packets. Defined here because we
+ * need it in the cipher spec. Note that this is a ring buffer but left and
+ * right represent the true window, with modular arithmetic used to map them
+ * onto the buffer.
+ */
+#define DTLS_RECVD_RECORDS_WINDOW 1024
+#define RECORD_SEQ_MAX ((1ULL << 48) - 1)
+PR_STATIC_ASSERT(DTLS_RECVD_RECORDS_WINDOW % 8 == 0);
+
+typedef struct DTLSRecvdRecordsStr {
+ unsigned char data[DTLS_RECVD_RECORDS_WINDOW / 8];
+ sslSequenceNumber left;
+ sslSequenceNumber right;
+} DTLSRecvdRecords;
+
+/*
+** These are the "specs" in the "ssl3" struct.
+** Access to the pointers to these specs, and all the specs' contents
+** (direct and indirect) is protected by the reader/writer lock ss->specLock.
+*/
+struct ssl3CipherSpecStr {
+ PRCList link;
+ const ssl3BulkCipherDef *cipher_def;
+ const ssl3MACDef *mac_def;
+ SSLCompressionMethod compression_method;
+ int mac_size;
+ SSLCipher encode;
+ SSLCipher decode;
+ SSLAEADCipher aead;
+ void *encodeContext;
+ void *decodeContext;
+ SSLCompressor compressor; /* Don't name these fields compress */
+ SSLCompressor decompressor; /* and uncompress because zconf.h */
+ /* may define them as macros. */
+ SSLDestroy destroyCompressContext;
+ void *compressContext;
+ SSLDestroy destroyDecompressContext;
+ void *decompressContext;
+ PK11SymKey *master_secret;
+ sslSequenceNumber write_seq_num;
+ sslSequenceNumber read_seq_num;
+ SSL3ProtocolVersion version;
+ ssl3KeyMaterial client;
+ ssl3KeyMaterial server;
+ SECItem msItem;
+ DTLSEpoch epoch;
+ DTLSRecvdRecords recvdRecords;
+ /* The number of 0-RTT bytes that can be sent or received in TLS 1.3. This
+ * will be zero for everything but 0-RTT. */
+ PRUint32 earlyDataRemaining;
+
+ PRUint8 refCt;
+ const char *phase;
+};
+
typedef enum { never_cached,
in_client_cache,
in_server_cache,
@@ -363,7 +527,7 @@ struct sslSessionIDStr {
sslSessionID *next; /* chain used for client sockets, only */
Cached cached;
int references;
- PRTime lastAccessTime;
+ PRUint32 lastAccessTime; /* seconds since Jan 1, 1970 */
/* The rest of the members, except for the members of u.ssl3.locked, may
* be modified only when the sid is not in any cache.
@@ -381,15 +545,13 @@ struct sslSessionIDStr {
SSL3ProtocolVersion version;
- PRTime creationTime;
- PRTime expirationTime;
+ PRUint32 creationTime; /* seconds since Jan 1, 1970 */
+ PRUint32 expirationTime; /* seconds since Jan 1, 1970 */
SSLAuthType authType;
PRUint32 authKeyBits;
SSLKEAType keaType;
PRUint32 keaKeyBits;
- SSLNamedGroup keaGroup;
- SSLSignatureScheme sigScheme;
union {
struct {
@@ -398,6 +560,7 @@ struct sslSessionIDStr {
PRUint8 sessionID[SSL3_SESSIONID_BYTES];
ssl3CipherSuite cipherSuite;
+ SSLCompressionMethod compression;
int policy;
ssl3SidKeys keys;
/* mechanism used to wrap master secret */
@@ -464,13 +627,13 @@ struct sslSessionIDStr {
} u;
};
-struct ssl3CipherSuiteDefStr {
+typedef struct ssl3CipherSuiteDefStr {
ssl3CipherSuite cipher_suite;
SSL3BulkCipher bulk_cipher_alg;
SSL3MACAlgorithm mac_alg;
SSL3KeyExchangeAlgorithm key_exchange_alg;
SSLHashType prf_hash;
-};
+} ssl3CipherSuiteDef;
/*
** There are tables of these, all const.
@@ -493,6 +656,37 @@ typedef struct {
SECOidTag oid;
} ssl3KEADef;
+/*
+** There are tables of these, all const.
+*/
+struct ssl3BulkCipherDefStr {
+ SSL3BulkCipher cipher;
+ SSLCipherAlgorithm calg;
+ unsigned int key_size;
+ unsigned int secret_key_size;
+ CipherType type;
+ unsigned int iv_size;
+ unsigned int block_size;
+ unsigned int tag_size; /* for AEAD ciphers. */
+ unsigned int explicit_nonce_size; /* for AEAD ciphers. */
+ SECOidTag oid;
+ const char *short_name;
+ /* The maximum number of records that can be sent/received with the same
+ * symmetric key before the connection will be terminated. */
+ PRUint64 max_records;
+};
+
+/*
+** There are tables of these, all const.
+*/
+struct ssl3MACDefStr {
+ SSL3MACAlgorithm mac;
+ CK_MECHANISM_TYPE mmech;
+ int pad_size;
+ int mac_size;
+ SECOidTag oid;
+};
+
typedef enum {
ssl_0rtt_none, /* 0-RTT not present */
ssl_0rtt_sent, /* 0-RTT sent (no decision yet) */
@@ -510,7 +704,6 @@ typedef enum {
typedef enum {
idle_handshake,
wait_client_hello,
- wait_end_of_early_data,
wait_client_cert,
wait_client_key,
wait_cert_verify,
@@ -567,15 +760,14 @@ typedef enum {
handshake_hash_record
} SSL3HandshakeHashType;
-// A DTLS Timer.
-typedef void (*DTLSTimerCb)(sslSocket *);
-
-typedef struct {
- const char *label;
- DTLSTimerCb cb;
- PRIntervalTime started;
- PRUint32 timeout;
-} dtlsTimer;
+/* This holds state for TLS 1.3 CertificateRequest handling. */
+typedef struct TLS13CertificateRequestStr {
+ PLArenaPool *arena;
+ SECItem context;
+ SSLSignatureScheme *signatureSchemes;
+ unsigned int signatureSchemeCount;
+ CERTDistNames ca_list;
+} TLS13CertificateRequest;
/*
** This is the "hs" member of the "ssl3" struct.
@@ -599,12 +791,13 @@ typedef struct SSL3HandshakeStateStr {
const ssl3KEADef *kea_def;
ssl3CipherSuite cipher_suite;
const ssl3CipherSuiteDef *suite_def;
+ SSLCompressionMethod compression;
sslBuffer msg_body; /* protected by recvBufLock */
/* partial handshake message from record layer */
unsigned int header_bytes;
/* number of bytes consumed from handshake */
/* message for message type and header length */
- SSLHandshakeType msg_type;
+ SSL3HandshakeType msg_type;
unsigned long msg_len;
PRBool isResuming; /* we are resuming (not used in TLS 1.3) */
PRBool sendingSCSV; /* instead of empty RI */
@@ -641,25 +834,25 @@ typedef struct SSL3HandshakeStateStr {
PRCList remoteExtensions; /* Parsed incoming extensions */
/* This group of values is used for DTLS */
- PRUint16 sendMessageSeq; /* The sending message sequence
+ PRUint16 sendMessageSeq; /* The sending message sequence
* number */
- PRCList lastMessageFlight; /* The last message flight we
+ PRCList lastMessageFlight; /* The last message flight we
* sent */
- PRUint16 maxMessageSent; /* The largest message we sent */
- PRUint16 recvMessageSeq; /* The receiving message sequence
+ PRUint16 maxMessageSent; /* The largest message we sent */
+ PRUint16 recvMessageSeq; /* The receiving message sequence
* number */
- sslBuffer recvdFragments; /* The fragments we have received in
+ sslBuffer recvdFragments; /* The fragments we have received in
* a bitmask */
- PRInt32 recvdHighWater; /* The high water mark for fragments
+ PRInt32 recvdHighWater; /* The high water mark for fragments
* received. -1 means no reassembly
* in progress. */
- SECItem cookie; /* The Hello(Retry|Verify)Request cookie. */
- dtlsTimer timers[3]; /* Holder for timers. */
- dtlsTimer *rtTimer; /* Retransmit timer. */
- dtlsTimer *ackTimer; /* Ack timer (DTLS 1.3 only). */
- dtlsTimer *hdTimer; /* Read cipher holddown timer (DLTS 1.3 only) */
- PRUint32 rtRetries; /* The retry counter */
- SECItem srvVirtName; /* for server: name that was negotiated
+ SECItem cookie; /* The Hello(Retry|Verify)Request cookie. */
+ PRIntervalTime rtTimerStarted; /* When the timer was started */
+ DTLSTimerCb rtTimerCb; /* The function to call on expiry */
+ PRUint32 rtTimeoutMs; /* The length of the current timeout
+ * used for backoff (in ms) */
+ PRUint32 rtRetries; /* The retry counter */
+ SECItem srvVirtName; /* for server: name that was negotiated
* with a client. For client - is
* always set to NULL.*/
@@ -676,37 +869,22 @@ typedef struct SSL3HandshakeStateStr {
PK11SymKey *serverTrafficSecret; /* traffic keys */
PK11SymKey *earlyExporterSecret; /* for 0-RTT exporters */
PK11SymKey *exporterSecret; /* for exporters */
- PRCList cipherSpecs; /* The cipher specs in the sequence they
- * will be applied. */
- sslZeroRttState zeroRttState; /* Are we doing a 0-RTT handshake? */
- sslZeroRttIgnore zeroRttIgnore; /* Are we ignoring 0-RTT? */
- ssl3CipherSuite zeroRttSuite; /* The cipher suite we used for 0-RTT. */
- PRCList bufferedEarlyData; /* Buffered TLS 1.3 early data
- * on server.*/
- PRBool helloRetry; /* True if HelloRetryRequest has been sent
- * or received. */
- PRBool receivedCcs; /* A server received ChangeCipherSpec
- * before the handshake started. */
- PRBool clientCertRequested; /* True if CertificateRequest received. */
- ssl3KEADef kea_def_mutable; /* Used to hold the writable kea_def
- * we use for TLS 1.3 */
- PRTime serverHelloTime; /* Time the ServerHello flight was sent. */
- PRUint16 ticketNonce; /* A counter we use for tickets. */
- SECItem fakeSid; /* ... (server) the SID the client used. */
- PRBool endOfFlight; /* Processed a full flight (DTLS 1.3). */
-
- /* The following lists contain DTLSHandshakeRecordEntry */
- PRCList dtlsSentHandshake; /* Used to map records to handshake fragments. */
- PRCList dtlsRcvdHandshake; /* Handshake records we have received
- * used to generate ACKs. */
+ /* The certificate request from the server. */
+ TLS13CertificateRequest *certificateRequest;
+ PRCList cipherSpecs; /* The cipher specs in the sequence they
+ * will be applied. */
+ sslZeroRttState zeroRttState; /* Are we doing a 0-RTT handshake? */
+ sslZeroRttIgnore zeroRttIgnore; /* Are we ignoring 0-RTT? */
+ ssl3CipherSuite zeroRttSuite; /* The cipher suite we used for 0-RTT. */
+ PRCList bufferedEarlyData; /* Buffered TLS 1.3 early data
+ * on server.*/
+ PRBool helloRetry; /* True if HelloRetryRequest has been sent
+ * or received. */
+ ssl3KEADef kea_def_mutable; /* Used to hold the writable kea_def
+ * we use for TLS 1.3 */
+ PRBool shortHeaders; /* Assigned if we are doing short headers. */
} SSL3HandshakeState;
-#define SSL_ASSERT_HASHES_EMPTY(ss) \
- do { \
- PORT_Assert(ss->ssl3.hs.hashType == handshake_hash_unknown); \
- PORT_Assert(ss->ssl3.hs.messages.len == 0); \
- } while (0)
-
/*
** This is the "ssl3" struct, as in "ss->ssl3".
** note:
@@ -726,10 +904,6 @@ struct ssl3StateStr {
ssl3CipherSpec *cwSpec; /* current write spec. */
ssl3CipherSpec *pwSpec; /* pending write spec. */
- /* This is true after the peer requests a key update; false after a key
- * update is initiated locally. */
- PRBool peerRequestedKeyUpdate;
-
/* Internal callback for when we do a cipher suite change. Used for
* debugging in TLS 1.3. This can only be set by non-public functions. */
sslCipherSpecChangedFunc changedCipherSpecFunc;
@@ -750,7 +924,9 @@ struct ssl3StateStr {
/* chain while we are trying to validate it. */
CERTDistNames *ca_list;
/* used by server. trusted CAs for this socket. */
+ PRBool initialized;
SSL3HandshakeState hs;
+ ssl3CipherSpec specs[2]; /* one is current, one is pending. */
PRUint16 mtu; /* Our estimate of the MTU */
@@ -819,12 +995,11 @@ typedef struct SessionTicketStr {
PRBool valid;
SSL3ProtocolVersion ssl_version;
ssl3CipherSuite cipher_suite;
+ SSLCompressionMethod compression_method;
SSLAuthType authType;
PRUint32 authKeyBits;
SSLKEAType keaType;
PRUint32 keaKeyBits;
- SSLNamedGroup originalKeaGroup;
- SSLSignatureScheme signatureScheme;
const sslNamedGroupDef *namedCurve; /* For certificate lookup. */
/*
@@ -837,13 +1012,11 @@ typedef struct SessionTicketStr {
PRBool extendedMasterSecretUsed;
ClientAuthenticationType client_auth_type;
SECItem peer_cert;
- PRTime timestamp;
+ PRUint32 timestamp;
PRUint32 flags;
SECItem srvName; /* negotiated server name */
SECItem alpnSelection;
PRUint32 maxEarlyData;
- PRUint32 ticketAgeBaseline;
- SECItem applicationToken;
} SessionTicket;
/*
@@ -893,7 +1066,6 @@ struct sslSecurityInfoStr {
SSLKEAType keaType;
PRUint32 keaKeyBits;
const sslNamedGroupDef *keaGroup;
- const sslNamedGroupDef *originalKeaGroup;
/* The selected certificate (for servers only). */
const sslServerCert *serverCert;
@@ -979,9 +1151,6 @@ struct sslSocketStr {
void *pkcs11PinArg;
SSLNextProtoCallback nextProtoCallback;
void *nextProtoArg;
- SSLHelloRetryRequestCallback hrrCallback;
- void *hrrCallbackArg;
- PRCList extensionHooks;
PRIntervalTime rTimeout; /* timeout for NSPR I/O */
PRIntervalTime wTimeout; /* timeout for NSPR I/O */
@@ -1072,7 +1241,6 @@ extern char ssl_debug;
extern char ssl_trace;
extern FILE *ssl_trace_iob;
extern FILE *ssl_keylog_iob;
-extern PZLock *ssl_keylog_lock;
extern PRUint32 ssl3_sid_timeout;
extern PRUint32 ssl_ticket_lifetime;
extern PRUint32 ssl_max_early_data_size;
@@ -1163,10 +1331,14 @@ extern SECStatus ssl_BeginClientHandshake(sslSocket *ss);
extern SECStatus ssl_BeginServerHandshake(sslSocket *ss);
extern int ssl_Do1stHandshake(sslSocket *ss);
+extern SECStatus sslBuffer_Grow(sslBuffer *b, unsigned int newLen);
+extern SECStatus sslBuffer_Append(sslBuffer *b, const void *data,
+ unsigned int len);
+extern void sslBuffer_Clear(sslBuffer *b);
+
extern void ssl_ChooseSessionIDProcs(sslSecurityInfo *sec);
-extern SECStatus ssl3_InitPendingCipherSpecs(sslSocket *ss, PK11SymKey *secret,
- PRBool derive);
+extern void ssl3_InitCipherSpec(ssl3CipherSpec *spec);
extern sslSessionID *ssl3_NewSessionID(sslSocket *ss, PRBool is_server);
extern sslSessionID *ssl_LookupSID(const PRIPv6Addr *addr, PRUint16 port,
const char *peerID, const char *urlSvrName);
@@ -1191,20 +1363,11 @@ extern SECStatus ssl_CipherPrefSetDefault(PRInt32 which, PRBool enabled);
extern SECStatus ssl3_ConstrainRangeByPolicy(void);
-extern SECStatus ssl3_InitState(sslSocket *ss);
-extern SECStatus Null_Cipher(void *ctx, unsigned char *output, int *outputLen,
- int maxOutputLen, const unsigned char *input,
- int inputLen);
+extern void ssl3_InitState(sslSocket *ss);
extern void ssl3_RestartHandshakeHashes(sslSocket *ss);
extern SECStatus ssl3_UpdateHandshakeHashes(sslSocket *ss,
const unsigned char *b,
unsigned int l);
-SECStatus
-ssl_HashHandshakeMessageInt(sslSocket *ss, SSLHandshakeType type,
- PRUint32 dtlsSeq,
- const PRUint8 *b, PRUint32 length);
-SECStatus ssl_HashHandshakeMessage(sslSocket *ss, SSLHandshakeType type,
- const PRUint8 *b, PRUint32 length);
/* Returns PR_TRUE if we are still waiting for the server to complete its
* response to our client second round. Once we've received the Finished from
@@ -1217,14 +1380,21 @@ extern PRInt32 ssl3_SendRecord(sslSocket *ss, ssl3CipherSpec *cwSpec,
const PRUint8 *pIn, PRInt32 nIn,
PRInt32 flags);
-/* Clear any PRCList, optionally calling f on the value. */
-void ssl_ClearPRCList(PRCList *list, void (*f)(void *));
+#ifdef NSS_SSL_ENABLE_ZLIB
+/*
+ * The DEFLATE algorithm can result in an expansion of 0.1% + 12 bytes. For a
+ * maximum TLS record payload of 2**14 bytes, that's 29 bytes.
+ */
+#define SSL3_COMPRESSION_MAX_EXPANSION 29
+#else /* !NSS_SSL_ENABLE_ZLIB */
+#define SSL3_COMPRESSION_MAX_EXPANSION 0
+#endif
/*
- * Make sure there is room in the write buffer for padding and
- * cryptographic expansions.
+ * make sure there is room in the write buffer for padding and
+ * other compression and cryptographic expansions.
*/
-#define SSL3_BUFFER_FUDGE 100
+#define SSL3_BUFFER_FUDGE 100 + SSL3_COMPRESSION_MAX_EXPANSION
#define SSL_LOCK_READER(ss) \
if (ss->recvLock) \
@@ -1377,7 +1547,7 @@ extern SECStatus ssl3_AuthCertificateComplete(sslSocket *ss, PRErrorCode error);
* for dealing with SSL 3.0 clients sending SSL 2.0 format hellos
*/
extern SECStatus ssl3_HandleV2ClientHello(
- sslSocket *ss, unsigned char *buffer, unsigned int length, PRUint8 padding);
+ sslSocket *ss, unsigned char *buffer, int length, PRUint8 padding);
SECStatus ssl3_SendClientHello(sslSocket *ss, sslClientHelloType type);
@@ -1413,7 +1583,7 @@ extern PRBool ssl_HaveEphemeralKeyPair(const sslSocket *ss,
const sslNamedGroupDef *groupDef);
extern void ssl_FreeEphemeralKeyPairs(sslSocket *ss);
-extern SECStatus ssl_AppendPaddedDHKeyShare(sslBuffer *buf,
+extern SECStatus ssl_AppendPaddedDHKeyShare(const sslSocket *ss,
const SECKEYPublicKey *pubKey,
PRBool appendLength);
extern const ssl3DHParams *ssl_GetDHEParams(const sslNamedGroupDef *groupDef);
@@ -1475,10 +1645,6 @@ extern SECStatus ssl_ClientReadVersion(sslSocket *ss, PRUint8 **b,
extern SECStatus ssl3_NegotiateVersion(sslSocket *ss,
SSL3ProtocolVersion peerVersion,
PRBool allowLargerPeerVersion);
-extern SECStatus ssl_ClientSetCipherSuite(sslSocket *ss,
- SSL3ProtocolVersion version,
- ssl3CipherSuite suite,
- PRBool initHashes);
extern SECStatus ssl_GetPeerInfo(sslSocket *ss);
@@ -1494,11 +1660,23 @@ extern SECStatus ssl3_SendECDHServerKeyExchange(sslSocket *ss);
extern SECStatus ssl_ImportECDHKeyShare(
sslSocket *ss, SECKEYPublicKey *peerKey,
PRUint8 *b, PRUint32 length, const sslNamedGroupDef *curve);
+SECStatus tls13_EncodeECDHEKeyShareKEX(const sslSocket *ss,
+ const SECKEYPublicKey *pubKey);
extern SECStatus ssl3_ComputeCommonKeyHash(SSLHashType hashAlg,
PRUint8 *hashBuf,
unsigned int bufLen,
SSL3Hashes *hashes);
+extern void ssl3_DestroyCipherSpec(ssl3CipherSpec *spec, PRBool freeSrvName);
+extern SECStatus ssl3_InitPendingCipherSpec(sslSocket *ss, PK11SymKey *pms);
+extern SECStatus ssl3_AppendHandshake(sslSocket *ss, const void *void_src,
+ PRInt32 bytes);
+extern SECStatus ssl3_AppendHandshakeHeader(sslSocket *ss,
+ SSL3HandshakeType t, PRUint32 length);
+extern SECStatus ssl3_AppendHandshakeNumber(sslSocket *ss, PRInt32 num,
+ PRInt32 lenSize);
+extern SECStatus ssl3_AppendHandshakeVariable(sslSocket *ss,
+ const PRUint8 *src, PRInt32 bytes, PRInt32 lenSize);
extern SECStatus ssl3_AppendSignatureAndHashAlgorithm(
sslSocket *ss, const SSLSignatureAndHashAlg *sigAndHash);
extern SECStatus ssl3_ConsumeHandshake(sslSocket *ss, void *v, PRUint32 bytes,
@@ -1506,12 +1684,11 @@ extern SECStatus ssl3_ConsumeHandshake(sslSocket *ss, void *v, PRUint32 bytes,
extern SECStatus ssl3_ConsumeHandshakeNumber(sslSocket *ss, PRUint32 *num,
PRUint32 bytes, PRUint8 **b,
PRUint32 *length);
-extern SECStatus ssl3_ConsumeHandshakeNumber64(sslSocket *ss, PRUint64 *num,
- PRUint32 bytes, PRUint8 **b,
- PRUint32 *length);
extern SECStatus ssl3_ConsumeHandshakeVariable(sslSocket *ss, SECItem *i,
PRUint32 bytes, PRUint8 **b,
PRUint32 *length);
+extern PRUint8 *ssl_EncodeUintX(PRUint64 value, unsigned int bytes,
+ PRUint8 *to);
extern PRBool ssl_IsSupportedSignatureScheme(SSLSignatureScheme scheme);
extern SECStatus ssl_CheckSignatureSchemeConsistency(
sslSocket *ss, SSLSignatureScheme scheme, CERTCertificate *cert);
@@ -1526,20 +1703,16 @@ extern SECStatus ssl3_SignHashes(sslSocket *ss, SSL3Hashes *hash,
SECKEYPrivateKey *key, SECItem *buf);
extern SECStatus ssl3_VerifySignedHashes(sslSocket *ss, SSLSignatureScheme scheme,
SSL3Hashes *hash, SECItem *buf);
-extern SECStatus ssl3_CacheWrappedSecret(sslSocket *ss, sslSessionID *sid,
- PK11SymKey *secret);
+extern SECStatus ssl3_CacheWrappedMasterSecret(
+ sslSocket *ss, sslSessionID *sid, ssl3CipherSpec *spec);
extern void ssl3_FreeSniNameArray(TLSExtensionData *xtnData);
/* Hello Extension related routines. */
extern void ssl3_SetSIDSessionTicket(sslSessionID *sid,
/*in/out*/ NewSessionTicket *session_ticket);
SECStatus ssl3_EncodeSessionTicket(sslSocket *ss,
- const NewSessionTicket *ticket,
- const PRUint8 *appToken,
- unsigned int appTokenLen,
- PK11SymKey *secret, SECItem *ticket_data);
-SECStatus SSLExp_SendSessionTicket(PRFileDesc *fd, const PRUint8 *token,
- unsigned int tokenLen);
+ const NewSessionTicket *ticket_input,
+ SECItem *ticket_data);
SECStatus ssl_MaybeSetSelfEncryptKeyPair(const sslKeyPair *keyPair);
SECStatus ssl_GetSelfEncryptKeys(sslSocket *ss, unsigned char *keyName,
@@ -1555,7 +1728,7 @@ extern void ssl_FreePRSocket(PRFileDesc *fd);
/* Internal config function so SSL3 can initialize the present state of
* various ciphers */
-extern unsigned int ssl3_config_match_init(sslSocket *);
+extern int ssl3_config_match_init(sslSocket *);
/* calls for accessing wrapping keys across processes. */
extern SECStatus
@@ -1585,11 +1758,44 @@ extern SECStatus ssl_InitSessionCacheLocks(PRBool lazyInit);
extern SECStatus ssl_FreeSessionCacheLocks(void);
+/**************** DTLS-specific functions **************/
+extern void dtls_FreeHandshakeMessage(DTLSQueuedMessage *msg);
+extern void dtls_FreeHandshakeMessages(PRCList *lst);
+
+extern SECStatus dtls_HandleHandshake(sslSocket *ss, sslBuffer *origBuf);
+extern SECStatus dtls_HandleHelloVerifyRequest(sslSocket *ss,
+ PRUint8 *b, PRUint32 length);
+extern SECStatus dtls_StageHandshakeMessage(sslSocket *ss);
+extern SECStatus dtls_QueueMessage(sslSocket *ss, SSL3ContentType type,
+ const PRUint8 *pIn, PRInt32 nIn);
+extern SECStatus dtls_FlushHandshakeMessages(sslSocket *ss, PRInt32 flags);
+SECStatus ssl3_DisableNonDTLSSuites(sslSocket *ss);
+extern SECStatus dtls_StartHolddownTimer(sslSocket *ss);
+extern void dtls_CheckTimer(sslSocket *ss);
+extern void dtls_CancelTimer(sslSocket *ss);
+extern void dtls_SetMTU(sslSocket *ss, PRUint16 advertised);
+extern void dtls_InitRecvdRecords(DTLSRecvdRecords *records);
+extern int dtls_RecordGetRecvd(const DTLSRecvdRecords *records,
+ sslSequenceNumber seq);
+extern void dtls_RecordSetRecvd(DTLSRecvdRecords *records,
+ sslSequenceNumber seq);
+extern void dtls_RehandshakeCleanup(sslSocket *ss);
+extern SSL3ProtocolVersion
+dtls_TLSVersionToDTLSVersion(SSL3ProtocolVersion tlsv);
+extern SSL3ProtocolVersion
+dtls_DTLSVersionToTLSVersion(SSL3ProtocolVersion dtlsv);
+extern PRBool dtls_IsRelevant(sslSocket *ss, const SSL3Ciphertext *cText,
+ PRBool *sameEpoch, PRUint64 *seqNum);
+extern SECStatus dtls_MaybeRetransmitHandshake(sslSocket *ss,
+ const SSL3Ciphertext *cText,
+ PRBool sameEpoch);
+
CK_MECHANISM_TYPE ssl3_Alg2Mech(SSLCipherAlgorithm calg);
SECStatus ssl3_NegotiateCipherSuite(sslSocket *ss, const SECItem *suites,
PRBool initHashes);
SECStatus ssl3_InitHandshakeHashes(sslSocket *ss);
SECStatus ssl3_ServerCallSNICallback(sslSocket *ss);
+SECStatus ssl3_SetupPendingCipherSpec(sslSocket *ss);
SECStatus ssl3_FlushHandshake(sslSocket *ss, PRInt32 flags);
SECStatus ssl3_CompleteHandleCertificate(sslSocket *ss,
PRUint8 *b, PRUint32 length);
@@ -1601,21 +1807,17 @@ SECStatus ssl3_SendCertificateStatus(sslSocket *ss);
SECStatus ssl3_AuthCertificate(sslSocket *ss);
SECStatus ssl_ReadCertificateStatus(sslSocket *ss, PRUint8 *b,
PRUint32 length);
-SECStatus ssl3_EncodeSigAlgs(const sslSocket *ss, sslBuffer *buf);
-SECStatus ssl_GetCertificateRequestCAs(const sslSocket *ss,
- unsigned int *calenp,
- const SECItem **namesp,
- unsigned int *nnamesp);
+SECStatus ssl3_EncodeSigAlgs(const sslSocket *ss, PRUint8 *buf,
+ unsigned maxLen, PRUint32 *len);
+SECStatus ssl_GetCertificateRequestCAs(sslSocket *ss, unsigned int *calenp,
+ SECItem **namesp, unsigned int *nnamesp);
SECStatus ssl3_ParseCertificateRequestCAs(sslSocket *ss, PRUint8 **b,
- PRUint32 *length, CERTDistNames *ca_list);
+ PRUint32 *length, PLArenaPool *arena,
+ CERTDistNames *ca_list);
SECStatus ssl3_CompleteHandleCertificateRequest(
sslSocket *ss, const SSLSignatureScheme *signatureSchemes,
unsigned int signatureSchemeCount, CERTDistNames *ca_list);
-SECStatus ssl_ConstructServerHello(sslSocket *ss, PRBool helloRetry,
- const sslBuffer *extensionBuf,
- sslBuffer *messageBuf);
SECStatus ssl3_SendServerHello(sslSocket *ss);
-SECStatus ssl3_SendChangeCipherSpecsInt(sslSocket *ss);
SECStatus ssl3_ComputeHandshakeHashes(sslSocket *ss,
ssl3CipherSpec *spec,
SSL3Hashes *hashes,
@@ -1630,9 +1832,10 @@ PK11SymKey *ssl3_GetWrappingKey(sslSocket *ss,
PK11SlotInfo *masterSecretSlot,
CK_MECHANISM_TYPE masterWrapMech,
void *pwArg);
-SECStatus ssl3_FillInCachedSID(sslSocket *ss, sslSessionID *sid,
- PK11SymKey *secret);
+SECStatus ssl3_FillInCachedSID(sslSocket *ss, sslSessionID *sid);
const ssl3CipherSuiteDef *ssl_LookupCipherSuiteDef(ssl3CipherSuite suite);
+const ssl3BulkCipherDef *
+ssl_GetBulkCipherDef(const ssl3CipherSuiteDef *cipher_def);
SECStatus ssl3_SelectServerCert(sslSocket *ss);
SECStatus ssl_PickSignatureScheme(sslSocket *ss,
SECKEYPublicKey *pubKey,
@@ -1644,14 +1847,11 @@ SECOidTag ssl3_HashTypeToOID(SSLHashType hashType);
SSLHashType ssl_SignatureSchemeToHashType(SSLSignatureScheme scheme);
KeyType ssl_SignatureSchemeToKeyType(SSLSignatureScheme scheme);
-SECStatus ssl3_SetupCipherSuite(sslSocket *ss, PRBool initHashes);
-
-/* Pull in DTLS functions */
-#include "dtlscon.h"
+SECStatus ssl3_SetCipherSuite(sslSocket *ss, ssl3CipherSuite chosenSuite,
+ PRBool initHashes);
/* Pull in TLS 1.3 functions */
#include "tls13con.h"
-#include "dtls13con.h"
/********************** misc calls *********************/
@@ -1661,27 +1861,22 @@ extern void ssl3_CheckCipherSuiteOrderConsistency();
extern int ssl_MapLowLevelError(int hiLevelError);
-extern PRUint32 ssl_TimeSec(void);
-#ifdef UNSAFE_FUZZER_MODE
-#define ssl_TimeUsec() ((PRTime)12345678)
-#else
-#define ssl_TimeUsec() (PR_Now())
-#endif
+extern PRUint32 ssl_Time(void);
extern PRBool ssl_TicketTimeValid(const NewSessionTicket *ticket);
extern void SSL_AtomicIncrementLong(long *x);
SECStatus ssl3_ApplyNSSPolicy(void);
+extern HASH_HashType
+ssl3_GetTls12HashType(sslSocket *ss);
+
extern SECStatus
ssl3_TLSPRFWithMasterSecret(sslSocket *ss, ssl3CipherSpec *spec,
const char *label, unsigned int labelLen,
const unsigned char *val, unsigned int valLen,
unsigned char *out, unsigned int outLen);
-extern void
-ssl3_RecordKeyLog(sslSocket *ss, const char *label, PK11SymKey *secret);
-
PRBool ssl_AlpnTagAllowed(const sslSocket *ss, const SECItem *tag);
#ifdef TRACE
diff --git a/security/nss/lib/ssl/sslinfo.c b/security/nss/lib/ssl/sslinfo.c
index 4e58c5ae7c..88162d8146 100644
--- a/security/nss/lib/ssl/sslinfo.c
+++ b/security/nss/lib/ssl/sslinfo.c
@@ -2,12 +2,26 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#include "pk11pub.h"
#include "ssl.h"
#include "sslimpl.h"
#include "sslproto.h"
#include "tls13hkdf.h"
+static const char *
+ssl_GetCompressionMethodName(SSLCompressionMethod compression)
+{
+ switch (compression) {
+ case ssl_compression_null:
+ return "NULL";
+#ifdef NSS_ENABLE_ZLIB
+ case ssl_compression_deflate:
+ return "DEFLATE";
+#endif
+ default:
+ return "???";
+ }
+}
+
SECStatus
SSL_GetChannelInfo(PRFileDesc *fd, SSLChannelInfo *info, PRUintn len)
{
@@ -34,58 +48,48 @@ SSL_GetChannelInfo(PRFileDesc *fd, SSLChannelInfo *info, PRUintn len)
inf.length = PR_MIN(sizeof inf, len);
if (ss->opt.useSecurity && ss->enoughFirstHsDone) {
- SSLCipherSuiteInfo cinfo;
- SECStatus rv;
-
sid = ss->sec.ci.sid;
inf.protocolVersion = ss->version;
inf.authKeyBits = ss->sec.authKeyBits;
inf.keaKeyBits = ss->sec.keaKeyBits;
-
- ssl_GetSpecReadLock(ss);
- /* XXX The cipher suite should be in the specs and this
- * function should get it from cwSpec rather than from the "hs".
- * See bug 275744 comment 69 and bug 766137.
- */
- inf.cipherSuite = ss->ssl3.hs.cipher_suite;
- ssl_ReleaseSpecReadLock(ss);
- inf.compressionMethod = ssl_compression_null;
- inf.compressionMethodName = "NULL";
-
- /* Fill in the cipher details from the cipher suite. */
- rv = SSL_GetCipherSuiteInfo(inf.cipherSuite,
- &cinfo, sizeof(cinfo));
- if (rv != SECSuccess) {
- return SECFailure; /* Error code already set. */
- }
- inf.symCipher = cinfo.symCipher;
- inf.macAlgorithm = cinfo.macAlgorithm;
- /* Get these fromm |ss->sec| because that is accurate
- * even with TLS 1.3 disaggregated cipher suites. */
- inf.keaType = ss->sec.keaType;
- inf.originalKeaGroup = ss->sec.originalKeaGroup
- ? ss->sec.originalKeaGroup->name
- : ssl_grp_none;
- inf.keaGroup = ss->sec.keaGroup
- ? ss->sec.keaGroup->name
- : ssl_grp_none;
- inf.keaKeyBits = ss->sec.keaKeyBits;
- inf.authType = ss->sec.authType;
- inf.authKeyBits = ss->sec.authKeyBits;
- inf.signatureScheme = ss->sec.signatureScheme;
- /* If this is a resumed session, signatureScheme isn't set in ss->sec.
- * Use the signature scheme from the previous handshake. */
- if (inf.signatureScheme == ssl_sig_none && sid->sigScheme) {
- inf.signatureScheme = sid->sigScheme;
+ if (ss->ssl3.initialized) {
+ SSLCipherSuiteInfo cinfo;
+ SECStatus rv;
+
+ ssl_GetSpecReadLock(ss);
+ /* XXX The cipher suite should be in the specs and this
+ * function should get it from cwSpec rather than from the "hs".
+ * See bug 275744 comment 69 and bug 766137.
+ */
+ inf.cipherSuite = ss->ssl3.hs.cipher_suite;
+ inf.compressionMethod = ss->ssl3.cwSpec->compression_method;
+ ssl_ReleaseSpecReadLock(ss);
+ inf.compressionMethodName =
+ ssl_GetCompressionMethodName(inf.compressionMethod);
+
+ /* Fill in the cipher details from the cipher suite. */
+ rv = SSL_GetCipherSuiteInfo(inf.cipherSuite,
+ &cinfo, sizeof(cinfo));
+ if (rv != SECSuccess) {
+ return SECFailure; /* Error code already set. */
+ }
+ inf.symCipher = cinfo.symCipher;
+ inf.macAlgorithm = cinfo.macAlgorithm;
+ /* Get these fromm |ss->sec| because that is accurate
+ * even with TLS 1.3 disaggregated cipher suites. */
+ inf.keaType = ss->sec.keaType;
+ inf.keaGroup = ss->sec.keaGroup ? ss->sec.keaGroup->name : ssl_grp_none;
+ inf.keaKeyBits = ss->sec.keaKeyBits;
+ inf.authType = ss->sec.authType;
+ inf.authKeyBits = ss->sec.authKeyBits;
+ inf.signatureScheme = ss->sec.signatureScheme;
}
- inf.resumed = ss->statelessResume || ss->ssl3.hs.isResuming;
-
if (sid) {
unsigned int sidLen;
- inf.creationTime = sid->creationTime / PR_USEC_PER_SEC;
- inf.lastAccessTime = sid->lastAccessTime / PR_USEC_PER_SEC;
- inf.expirationTime = sid->expirationTime / PR_USEC_PER_SEC;
+ inf.creationTime = sid->creationTime;
+ inf.lastAccessTime = sid->lastAccessTime;
+ inf.expirationTime = sid->expirationTime;
inf.extendedMasterSecretUsed =
(ss->version >= SSL_LIBRARY_VERSION_TLS_1_3 ||
sid->u.ssl3.keys.extendedMasterSecretUsed)
@@ -192,17 +196,17 @@ SSL_GetPreliminaryChannelInfo(PRFileDesc *fd,
#define K_ANY "TLS 1.3", ssl_kea_tls13_any
/* record protection cipher */
-#define C_SEED "SEED", ssl_calg_seed
-#define C_CAMELLIA "CAMELLIA", ssl_calg_camellia
-#define C_AES "AES", ssl_calg_aes
-#define C_RC4 "RC4", ssl_calg_rc4
-#define C_RC2 "RC2", ssl_calg_rc2
-#define C_DES "DES", ssl_calg_des
-#define C_3DES "3DES", ssl_calg_3des
-#define C_NULL "NULL", ssl_calg_null
-#define C_SJ "SKIPJACK", ssl_calg_sj
-#define C_AESGCM "AES-GCM", ssl_calg_aes_gcm
-#define C_CHACHA20 "CHACHA20POLY1305", ssl_calg_chacha20
+#define C_SEED "SEED", calg_seed
+#define C_CAMELLIA "CAMELLIA", calg_camellia
+#define C_AES "AES", calg_aes
+#define C_RC4 "RC4", calg_rc4
+#define C_RC2 "RC2", calg_rc2
+#define C_DES "DES", calg_des
+#define C_3DES "3DES", calg_3des
+#define C_NULL "NULL", calg_null
+#define C_SJ "SKIPJACK", calg_sj
+#define C_AESGCM "AES-GCM", calg_aes_gcm
+#define C_CHACHA20 "CHACHA20POLY1305", calg_chacha20
/* "block cipher" sizes */
#define B_256 256, 256, 256
@@ -363,7 +367,8 @@ SSL_GetNegotiatedHostInfo(PRFileDesc *fd)
}
if (ss->sec.isServer) {
- if (ss->version > SSL_LIBRARY_VERSION_3_0) { /* TLS */
+ if (ss->version > SSL_LIBRARY_VERSION_3_0 &&
+ ss->ssl3.initialized) { /* TLS */
SECItem *crsName;
ssl_GetSpecReadLock(ss); /*********************************/
crsName = &ss->ssl3.hs.srvVirtName;
@@ -387,47 +392,22 @@ SSL_GetNegotiatedHostInfo(PRFileDesc *fd)
return sniName;
}
-/*
- * HKDF-Expand-Label(Derive-Secret(Secret, label, ""),
- * "exporter", Hash(context_value), key_length)
- */
static SECStatus
tls13_Exporter(sslSocket *ss, PK11SymKey *secret,
const char *label, unsigned int labelLen,
const unsigned char *context, unsigned int contextLen,
unsigned char *out, unsigned int outLen)
{
- SSL3Hashes contextHash;
- PK11SymKey *innerSecret = NULL;
- SECStatus rv;
-
- static const char *kExporterInnerLabel = "exporter";
-
if (!secret) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
return SECFailure;
}
- /* Pre-hash the context. */
- rv = tls13_ComputeHash(ss, &contextHash, context, contextLen);
- if (rv != SECSuccess) {
- return rv;
- }
-
- rv = tls13_DeriveSecretNullHash(ss, secret, label, labelLen,
- &innerSecret);
- if (rv != SECSuccess) {
- return rv;
- }
-
- rv = tls13_HkdfExpandLabelRaw(innerSecret,
- tls13_GetHash(ss),
- contextHash.u.raw, contextHash.len,
- kExporterInnerLabel,
- strlen(kExporterInnerLabel),
- out, outLen);
- PK11_FreeSymKey(innerSecret);
- return rv;
+ return tls13_HkdfExpandLabelRaw(secret,
+ tls13_GetHash(ss),
+ context, contextLen,
+ label, labelLen,
+ out, outLen);
}
SECStatus
@@ -477,9 +457,9 @@ SSL_ExportKeyingMaterial(PRFileDesc *fd,
return SECFailure;
}
i = 0;
- PORT_Memcpy(val + i, ss->ssl3.hs.client_random, SSL3_RANDOM_LENGTH);
+ PORT_Memcpy(val + i, &ss->ssl3.hs.client_random.rand, SSL3_RANDOM_LENGTH);
i += SSL3_RANDOM_LENGTH;
- PORT_Memcpy(val + i, ss->ssl3.hs.server_random, SSL3_RANDOM_LENGTH);
+ PORT_Memcpy(val + i, &ss->ssl3.hs.server_random.rand, SSL3_RANDOM_LENGTH);
i += SSL3_RANDOM_LENGTH;
if (hasContext) {
val[i++] = contextLen >> 8;
@@ -493,7 +473,7 @@ SSL_ExportKeyingMaterial(PRFileDesc *fd,
* secret is available and we have sent ChangeCipherSpec.
*/
ssl_GetSpecReadLock(ss);
- if (!ss->ssl3.cwSpec->masterSecret) {
+ if (!ss->ssl3.cwSpec->master_secret && !ss->ssl3.cwSpec->msItem.len) {
PORT_SetError(SSL_ERROR_HANDSHAKE_NOT_COMPLETED);
rv = SECFailure;
} else {
diff --git a/security/nss/lib/ssl/sslnonce.c b/security/nss/lib/ssl/sslnonce.c
index 228834e3db..7ad1c6bc7a 100644
--- a/security/nss/lib/ssl/sslnonce.c
+++ b/security/nss/lib/ssl/sslnonce.c
@@ -256,7 +256,7 @@ ssl_LookupSID(const PRIPv6Addr *addr, PRUint16 port, const char *peerID,
if (!urlSvrName)
return NULL;
- now = ssl_TimeSec();
+ now = ssl_Time();
LOCK_CACHE;
sidp = &cache;
while ((sid = *sidp) != 0) {
@@ -306,6 +306,8 @@ ssl_LookupSID(const PRIPv6Addr *addr, PRUint16 port, const char *peerID,
static void
CacheSID(sslSessionID *sid)
{
+ PRUint32 expirationPeriod;
+
PORT_Assert(sid->cached == never_cached);
SSL_TRC(8, ("SSL: Cache: sid=0x%x cached=%d addr=0x%08x%08x%08x%08x port=0x%04x "
@@ -333,6 +335,7 @@ CacheSID(sslSessionID *sid)
return;
sid->u.ssl3.sessionIDLength = SSL3_SESSIONID_BYTES;
}
+ expirationPeriod = ssl3_sid_timeout;
PRINT_BUF(8, (0, "sessionID:",
sid->u.ssl3.sessionID, sid->u.ssl3.sessionIDLength));
@@ -342,9 +345,9 @@ CacheSID(sslSessionID *sid)
}
PORT_Assert(sid->creationTime != 0 && sid->expirationTime != 0);
if (!sid->creationTime)
- sid->lastAccessTime = sid->creationTime = ssl_TimeUsec();
+ sid->lastAccessTime = sid->creationTime = ssl_Time();
if (!sid->expirationTime)
- sid->expirationTime = sid->creationTime + ssl3_sid_timeout * PR_USEC_PER_SEC;
+ sid->expirationTime = sid->creationTime + expirationPeriod;
/*
* Put sid into the cache. Bump reference count to indicate that
@@ -435,7 +438,7 @@ SSL_ClearSessionCache(void)
/* returns an unsigned int containing the number of seconds in PR_Now() */
PRUint32
-ssl_TimeSec(void)
+ssl_Time(void)
{
#ifdef UNSAFE_FUZZER_MODE
return 1234;
@@ -468,7 +471,7 @@ ssl_TicketTimeValid(const NewSessionTicket *ticket)
endTime = ticket->received_timestamp +
(PRTime)(ticket->ticket_lifetime_hint * PR_USEC_PER_SEC);
- return endTime > ssl_TimeUsec();
+ return endTime > PR_Now();
}
void
diff --git a/security/nss/lib/ssl/sslreveal.c b/security/nss/lib/ssl/sslreveal.c
index cc16f574db..4c124a1dc0 100644
--- a/security/nss/lib/ssl/sslreveal.c
+++ b/security/nss/lib/ssl/sslreveal.c
@@ -92,16 +92,18 @@ SSL_HandshakeNegotiatedExtension(PRFileDesc *socket,
/* according to public API SSL_GetChannelInfo, this doesn't need a lock */
if (sslsocket->opt.useSecurity) {
- /* now we know this socket went through ssl3_InitState() and
- * ss->xtnData got initialized, which is the only member accessed by
- * ssl3_ExtensionNegotiated();
- * Member xtnData appears to get accessed in functions that handle
- * the handshake (hello messages and extension sending),
- * therefore the handshake lock should be sufficient.
- */
- ssl_GetSSL3HandshakeLock(sslsocket);
- *pYes = ssl3_ExtensionNegotiated(sslsocket, extId);
- ssl_ReleaseSSL3HandshakeLock(sslsocket);
+ if (sslsocket->ssl3.initialized) { /* SSL3 and TLS */
+ /* now we know this socket went through ssl3_InitState() and
+ * ss->xtnData got initialized, which is the only member accessed by
+ * ssl3_ExtensionNegotiated();
+ * Member xtnData appears to get accessed in functions that handle
+ * the handshake (hello messages and extension sending),
+ * therefore the handshake lock should be sufficient.
+ */
+ ssl_GetSSL3HandshakeLock(sslsocket);
+ *pYes = ssl3_ExtensionNegotiated(sslsocket, extId);
+ ssl_ReleaseSSL3HandshakeLock(sslsocket);
+ }
}
return SECSuccess;
diff --git a/security/nss/lib/ssl/sslsecur.c b/security/nss/lib/ssl/sslsecur.c
index 3f7060f224..8bec3d327a 100644
--- a/security/nss/lib/ssl/sslsecur.c
+++ b/security/nss/lib/ssl/sslsecur.c
@@ -1,4 +1,3 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* Various SSL functions.
*
@@ -201,7 +200,7 @@ SSL_ResetHandshake(PRFileDesc *s, PRBool asServer)
ssl_Release1stHandshakeLock(ss);
ssl3_DestroyRemoteExtensions(&ss->ssl3.hs.remoteExtensions);
- ssl3_ResetExtensionData(&ss->xtnData, ss);
+ ssl3_ResetExtensionData(&ss->xtnData);
if (!ss->TCPconnected)
ss->TCPconnected = (PR_SUCCESS == ssl_DefGetpeername(ss, &addr));
@@ -343,6 +342,11 @@ SSL_RecommendedCanFalseStart(PRFileDesc *fd, PRBool *canFalseStart)
return SECFailure;
}
+ if (!ss->ssl3.initialized) {
+ PORT_SetError(SEC_ERROR_INVALID_ARGS);
+ return SECFailure;
+ }
+
/* Require a forward-secret key exchange. */
*canFalseStart = ss->ssl3.hs.kea_def->kea == kea_dhe_dss ||
ss->ssl3.hs.kea_def->kea == kea_dhe_rsa ||
@@ -431,6 +435,58 @@ SSL_ForceHandshakeWithTimeout(PRFileDesc *fd,
/************************************************************************/
/*
+** Grow a buffer to hold newLen bytes of data.
+** Called for both recv buffers and xmit buffers.
+** Caller must hold xmitBufLock or recvBufLock, as appropriate.
+*/
+SECStatus
+sslBuffer_Grow(sslBuffer *b, unsigned int newLen)
+{
+ newLen = PR_MAX(newLen, MAX_FRAGMENT_LENGTH + 2048);
+ if (newLen > b->space) {
+ unsigned char *newBuf;
+ if (b->buf) {
+ newBuf = (unsigned char *)PORT_Realloc(b->buf, newLen);
+ } else {
+ newBuf = (unsigned char *)PORT_Alloc(newLen);
+ }
+ if (!newBuf) {
+ return SECFailure;
+ }
+ SSL_TRC(10, ("%d: SSL: grow buffer from %d to %d",
+ SSL_GETPID(), b->space, newLen));
+ b->buf = newBuf;
+ b->space = newLen;
+ }
+ return SECSuccess;
+}
+
+SECStatus
+sslBuffer_Append(sslBuffer *b, const void *data, unsigned int len)
+{
+ unsigned int newLen = b->len + len;
+ SECStatus rv;
+
+ rv = sslBuffer_Grow(b, newLen);
+ if (rv != SECSuccess)
+ return rv;
+ PORT_Memcpy(b->buf + b->len, data, len);
+ b->len += len;
+ return SECSuccess;
+}
+
+void
+sslBuffer_Clear(sslBuffer *b)
+{
+ if (b->buf) {
+ PORT_Free(b->buf);
+ b->buf = NULL;
+ b->len = 0;
+ b->space = 0;
+ }
+}
+
+/*
** Save away write data that is trying to be written before the security
** handshake has been completed. When the handshake is completed, we will
** flush this data out.
@@ -718,7 +774,8 @@ ssl_SecureClose(sslSocket *ss)
if (!(ss->shutdownHow & ssl_SHUTDOWN_SEND) &&
ss->firstHsDone &&
- !ss->recvdCloseNotify) {
+ !ss->recvdCloseNotify &&
+ ss->ssl3.initialized) {
/* We don't want the final alert to be Nagle delayed. */
if (!ss->delayDisabled) {
@@ -748,7 +805,8 @@ ssl_SecureShutdown(sslSocket *ss, int nsprHow)
if ((sslHow & ssl_SHUTDOWN_SEND) != 0 &&
!(ss->shutdownHow & ssl_SHUTDOWN_SEND) &&
ss->firstHsDone &&
- !ss->recvdCloseNotify) {
+ !ss->recvdCloseNotify &&
+ ss->ssl3.initialized) {
(void)SSL3_SendAlert(ss, alert_warning, close_notify);
}
@@ -762,55 +820,6 @@ ssl_SecureShutdown(sslSocket *ss, int nsprHow)
/************************************************************************/
-static SECStatus
-tls13_CheckKeyUpdate(sslSocket *ss, CipherSpecDirection dir)
-{
- PRBool keyUpdate;
- ssl3CipherSpec *spec;
- sslSequenceNumber seqNum;
- sslSequenceNumber margin;
- SECStatus rv;
-
- /* Bug 1413368: enable for DTLS */
- if (ss->version < SSL_LIBRARY_VERSION_TLS_1_3 || IS_DTLS(ss)) {
- return SECSuccess;
- }
-
- /* If both sides update at the same number, then this will cause two updates
- * to happen at once. The problem is that the KeyUpdate itself consumes a
- * sequence number, and that will trigger the reading side to request an
- * update.
- *
- * If we have the writing side update first, the writer will be the one that
- * drives the update. An update by the writer doesn't need a response, so
- * it is more efficient overall. The margins here are pretty arbitrary, but
- * having the write margin larger reduces the number of times that a
- * KeyUpdate is sent by a reader. */
- ssl_GetSpecReadLock(ss);
- if (dir == CipherSpecRead) {
- spec = ss->ssl3.crSpec;
- margin = spec->cipherDef->max_records / 8;
- } else {
- spec = ss->ssl3.cwSpec;
- margin = spec->cipherDef->max_records / 4;
- }
- seqNum = spec->seqNum;
- keyUpdate = seqNum > spec->cipherDef->max_records - margin;
- ssl_ReleaseSpecReadLock(ss);
- if (!keyUpdate) {
- return SECSuccess;
- }
-
- SSL_TRC(5, ("%d: SSL[%d]: automatic key update at %llx for %s cipher spec",
- SSL_GETPID(), ss->fd, seqNum,
- (dir == CipherSpecRead) ? "read" : "write"));
- ssl_GetSSL3HandshakeLock(ss);
- rv = tls13_SendKeyUpdate(ss, (dir == CipherSpecRead) ? update_requested : update_not_requested,
- dir == CipherSpecWrite /* buffer */);
- ssl_ReleaseSSL3HandshakeLock(ss);
- return rv;
-}
-
int
ssl_SecureRecv(sslSocket *ss, unsigned char *buf, int len, int flags)
{
@@ -850,17 +859,8 @@ ssl_SecureRecv(sslSocket *ss, unsigned char *buf, int len, int flags)
rv = ssl_Do1stHandshake(ss);
}
ssl_Release1stHandshakeLock(ss);
- } else {
- if (tls13_CheckKeyUpdate(ss, CipherSpecRead) != SECSuccess) {
- rv = PR_FAILURE;
- }
}
if (rv < 0) {
- if (PORT_GetError() == PR_WOULD_BLOCK_ERROR &&
- !PR_CLIST_IS_EMPTY(&ss->ssl3.hs.bufferedEarlyData)) {
- PORT_Assert(ss->version >= SSL_LIBRARY_VERSION_TLS_1_3);
- return tls13_Read0RttData(ss, buf, len);
- }
return rv;
}
@@ -942,19 +942,11 @@ ssl_SecureSend(sslSocket *ss, const unsigned char *buf, int len, int flags)
}
ssl_Release1stHandshakeLock(ss);
}
-
if (rv < 0) {
ss->writerThread = NULL;
goto done;
}
- if (ss->firstHsDone) {
- if (tls13_CheckKeyUpdate(ss, CipherSpecWrite) != SECSuccess) {
- rv = PR_FAILURE;
- goto done;
- }
- }
-
if (zeroRtt) {
/* There's a limit to the number of early data octets we can send.
*
@@ -1249,7 +1241,14 @@ SSL_AuthCertificateComplete(PRFileDesc *fd, PRErrorCode error)
}
ssl_Get1stHandshakeLock(ss);
- rv = ssl3_AuthCertificateComplete(ss, error);
+
+ if (!ss->ssl3.initialized) {
+ PORT_SetError(SEC_ERROR_INVALID_ARGS);
+ rv = SECFailure;
+ } else {
+ rv = ssl3_AuthCertificateComplete(ss, error);
+ }
+
ssl_Release1stHandshakeLock(ss);
return rv;
diff --git a/security/nss/lib/ssl/sslsnce.c b/security/nss/lib/ssl/sslsnce.c
index 279f3c0154..3ef11f7a73 100644
--- a/security/nss/lib/ssl/sslsnce.c
+++ b/security/nss/lib/ssl/sslsnce.c
@@ -85,12 +85,11 @@
/*
** Format of a cache entry in the shared memory.
*/
-PR_STATIC_ASSERT(sizeof(PRTime) == 8);
struct sidCacheEntryStr {
/* 16 */ PRIPv6Addr addr; /* client's IP address */
- /* 8 */ PRTime creationTime;
- /* 8 */ PRTime lastAccessTime;
- /* 8 */ PRTime expirationTime;
+ /* 4 */ PRUint32 creationTime;
+ /* 4 */ PRUint32 lastAccessTime;
+ /* 4 */ PRUint32 expirationTime;
/* 2 */ PRUint16 version;
/* 1 */ PRUint8 valid;
/* 1 */ PRUint8 sessionIDLength;
@@ -99,25 +98,25 @@ struct sidCacheEntryStr {
/* 2 */ PRUint16 authKeyBits;
/* 2 */ PRUint16 keaType;
/* 2 */ PRUint16 keaKeyBits;
- /* 4 */ PRUint32 signatureScheme;
- /* 4 */ PRUint32 keaGroup;
- /* 92 - common header total */
+ /* 72 - common header total */
union {
struct {
/* 2 */ ssl3CipherSuite cipherSuite;
- /* 52 */ ssl3SidKeys keys; /* keys, wrapped as needed. */
+ /* 2 */ PRUint16 compression; /* SSLCompressionMethod */
+
+ /* 54 */ ssl3SidKeys keys; /* keys, wrapped as needed. */
/* 4 */ PRUint32 masterWrapMech;
/* 4 */ PRInt32 certIndex;
/* 4 */ PRInt32 srvNameIndex;
/* 32 */ PRUint8 srvNameHash[SHA256_LENGTH]; /* SHA256 name hash */
/* 2 */ PRUint16 namedCurve;
-/*100 */} ssl3;
+/*104 */} ssl3;
/* force sizeof(sidCacheEntry) to be a multiple of cache line size */
struct {
- /*116 */ PRUint8 filler[116]; /* 92+116==208, a multiple of 16 */
+ /*120 */ PRUint8 filler[120]; /* 72+120==192, a multiple of 16 */
} forceSize;
} u;
};
@@ -283,7 +282,7 @@ LockSidCacheLock(sidCacheLock *lock, PRUint32 now)
if (rv != SECSuccess)
return 0;
if (!now)
- now = ssl_TimeSec();
+ now = ssl_Time();
lock->timeStamp = now;
lock->pid = myPid;
return now;
@@ -299,7 +298,7 @@ UnlockSidCacheLock(sidCacheLock *lock)
return rv;
}
-/* returns the value of ssl_TimeSec on success, zero on failure. */
+/* returns the value of ssl_Time on success, zero on failure. */
static PRUint32
LockSet(cacheDesc *cache, PRUint32 set, PRUint32 now)
{
@@ -433,10 +432,9 @@ ConvertFromSID(sidCacheEntry *to, sslSessionID *from)
to->authKeyBits = from->authKeyBits;
to->keaType = from->keaType;
to->keaKeyBits = from->keaKeyBits;
- to->keaGroup = from->keaGroup;
- to->signatureScheme = from->sigScheme;
to->u.ssl3.cipherSuite = from->u.ssl3.cipherSuite;
+ to->u.ssl3.compression = (PRUint16)from->u.ssl3.compression;
to->u.ssl3.keys = from->u.ssl3.keys;
to->u.ssl3.masterWrapMech = from->u.ssl3.masterWrapMech;
to->sessionIDLength = from->u.ssl3.sessionIDLength;
@@ -454,10 +452,9 @@ ConvertFromSID(sidCacheEntry *to, sslSessionID *from)
SSL_TRC(8, ("%d: SSL3: ConvertSID: time=%d addr=0x%08x%08x%08x%08x "
"cipherSuite=%d",
- myPid, to->creationTime / PR_USEC_PER_SEC,
- to->addr.pr_s6_addr32[0], to->addr.pr_s6_addr32[1],
- to->addr.pr_s6_addr32[2], to->addr.pr_s6_addr32[3],
- to->u.ssl3.cipherSuite));
+ myPid, to->creationTime, to->addr.pr_s6_addr32[0],
+ to->addr.pr_s6_addr32[1], to->addr.pr_s6_addr32[2],
+ to->addr.pr_s6_addr32[3], to->u.ssl3.cipherSuite));
}
/*
@@ -479,6 +476,7 @@ ConvertToSID(sidCacheEntry *from,
to->u.ssl3.sessionIDLength = from->sessionIDLength;
to->u.ssl3.cipherSuite = from->u.ssl3.cipherSuite;
+ to->u.ssl3.compression = (SSLCompressionMethod)from->u.ssl3.compression;
to->u.ssl3.keys = from->u.ssl3.keys;
to->u.ssl3.masterWrapMech = from->u.ssl3.masterWrapMech;
if (from->u.ssl3.srvNameIndex != -1 && psnce) {
@@ -543,8 +541,6 @@ ConvertToSID(sidCacheEntry *from,
to->authKeyBits = from->authKeyBits;
to->keaType = from->keaType;
to->keaKeyBits = from->keaKeyBits;
- to->keaGroup = from->keaGroup;
- to->sigScheme = from->signatureScheme;
return to;
@@ -752,19 +748,17 @@ ServerSessionIDCache(sslSessionID *sid)
PORT_Assert(sid->creationTime != 0);
if (!sid->creationTime)
- sid->lastAccessTime = sid->creationTime = ssl_TimeUsec();
+ sid->lastAccessTime = sid->creationTime = ssl_Time();
/* override caller's expiration time, which uses client timeout
* duration, not server timeout duration.
*/
- sid->expirationTime =
- sid->creationTime + cache->ssl3Timeout * PR_USEC_PER_SEC;
+ sid->expirationTime = sid->creationTime + cache->ssl3Timeout;
SSL_TRC(8, ("%d: SSL: CacheMT: cached=%d addr=0x%08x%08x%08x%08x time=%x "
"cipherSuite=%d",
myPid, sid->cached,
sid->addr.pr_s6_addr32[0], sid->addr.pr_s6_addr32[1],
sid->addr.pr_s6_addr32[2], sid->addr.pr_s6_addr32[3],
- sid->creationTime / PR_USEC_PER_SEC,
- sid->u.ssl3.cipherSuite));
+ sid->creationTime, sid->u.ssl3.cipherSuite));
PRINT_BUF(8, (0, "sessionID:", sid->u.ssl3.sessionID,
sid->u.ssl3.sessionIDLength));
@@ -826,8 +820,7 @@ ServerSessionIDUncache(sslSessionID *sid)
myPid, sid->cached,
sid->addr.pr_s6_addr32[0], sid->addr.pr_s6_addr32[1],
sid->addr.pr_s6_addr32[2], sid->addr.pr_s6_addr32[3],
- sid->creationTime / PR_USEC_PER_SEC,
- sid->u.ssl3.cipherSuite));
+ sid->creationTime, sid->u.ssl3.cipherSuite));
PRINT_BUF(8, (0, "sessionID:", sessionID, sessionIDLength));
set = SIDindex(cache, &sid->addr, sessionID, sessionIDLength);
now = LockSet(cache, set, 0);
@@ -1093,7 +1086,7 @@ InitCache(cacheDesc *cache, int maxCacheEntries, int maxCertCacheEntries,
cache->srvNameCacheData = (srvNameCacheEntry *)(cache->cacheMem + (ptrdiff_t)cache->srvNameCacheData);
/* initialize the locks */
- init_time = ssl_TimeSec();
+ init_time = ssl_Time();
pLock = cache->sidCacheLocks;
for (locks_to_initialize = cache->numSIDCacheLocks + 3;
locks_initialized < locks_to_initialize;
@@ -1141,10 +1134,6 @@ SSL_SetMaxServerCacheLocks(PRUint32 maxLocks)
return SECSuccess;
}
-PR_STATIC_ASSERT(sizeof(sidCacheEntry) % 16 == 0);
-PR_STATIC_ASSERT(sizeof(certCacheEntry) == 4096);
-PR_STATIC_ASSERT(sizeof(srvNameCacheEntry) == 1072);
-
static SECStatus
ssl_ConfigServerSessionIDCacheInstanceWithOpt(cacheDesc *cache,
PRUint32 ssl3_timeout,
@@ -1156,6 +1145,10 @@ ssl_ConfigServerSessionIDCacheInstanceWithOpt(cacheDesc *cache,
{
SECStatus rv;
+ PORT_Assert(sizeof(sidCacheEntry) == 192);
+ PORT_Assert(sizeof(certCacheEntry) == 4096);
+ PORT_Assert(sizeof(srvNameCacheEntry) == 1072);
+
rv = ssl_Init();
if (rv != SECSuccess) {
return rv;
@@ -1526,7 +1519,7 @@ LockPoller(void *arg)
if (sharedCache->stopPolling)
break;
- now = ssl_TimeSec();
+ now = ssl_Time();
then = now - expiration;
for (pLock = cache->sidCacheLocks, locks_polled = 0;
locks_to_poll > locks_polled && !sharedCache->stopPolling;
diff --git a/security/nss/lib/ssl/sslsock.c b/security/nss/lib/ssl/sslsock.c
index 4893cb9f92..99828c85b1 100644
--- a/security/nss/lib/ssl/sslsock.c
+++ b/security/nss/lib/ssl/sslsock.c
@@ -11,7 +11,6 @@
#include "cert.h"
#include "keyhi.h"
#include "ssl.h"
-#include "sslexp.h"
#include "sslimpl.h"
#include "sslproto.h"
#include "nspr.h"
@@ -80,7 +79,11 @@ static sslOptions ssl_defaults = {
PR_FALSE, /* enableSignedCertTimestamps */
PR_FALSE, /* requireDHENamedGroups */
PR_FALSE, /* enable0RttData */
- PR_FALSE /* enableTls13CompatMode */
+#ifdef NSS_ENABLE_TLS13_SHORT_HEADERS
+ PR_TRUE /* enableShortHeaders */
+#else
+ PR_FALSE /* enableShortHeaders */
+#endif
};
/*
@@ -107,6 +110,7 @@ sslSessionIDLookupFunc ssl_sid_lookup;
sslSessionIDCacheFunc ssl_sid_cache;
sslSessionIDUncacheFunc ssl_sid_uncache;
+static PRBool ssl_inited = PR_FALSE;
static PRDescIdentity ssl_layer_id;
PRBool locksEverDisabled; /* implicitly PR_FALSE */
@@ -118,7 +122,6 @@ FILE *ssl_trace_iob;
#ifdef NSS_ALLOW_SSLKEYLOGFILE
FILE *ssl_keylog_iob;
-PZLock *ssl_keylog_lock;
#endif
char lockStatus[] = "Locks are ENABLED. ";
@@ -297,7 +300,6 @@ ssl_DupSocket(sslSocket *os)
if (ss->opt.useSecurity) {
PRCList *cursor;
-
for (cursor = PR_NEXT_LINK(&os->serverCerts);
cursor != &os->serverCerts;
cursor = PR_NEXT_LINK(cursor)) {
@@ -307,6 +309,7 @@ ssl_DupSocket(sslSocket *os)
PR_APPEND_LINK(&sc->link, &ss->serverCerts);
}
+ PR_INIT_CLIST(&ss->ephemeralKeyPairs);
for (cursor = PR_NEXT_LINK(&os->ephemeralKeyPairs);
cursor != &os->ephemeralKeyPairs;
cursor = PR_NEXT_LINK(cursor)) {
@@ -317,18 +320,6 @@ ssl_DupSocket(sslSocket *os)
PR_APPEND_LINK(&skp->link, &ss->ephemeralKeyPairs);
}
- for (cursor = PR_NEXT_LINK(&os->extensionHooks);
- cursor != &os->extensionHooks;
- cursor = PR_NEXT_LINK(cursor)) {
- sslCustomExtensionHooks *oh = (sslCustomExtensionHooks *)cursor;
- sslCustomExtensionHooks *sh = PORT_ZNew(sslCustomExtensionHooks);
- if (!sh) {
- goto loser;
- }
- *sh = *oh;
- PR_APPEND_LINK(&sh->link, &ss->extensionHooks);
- }
-
/*
* XXX the preceding CERT_ and SECKEY_ functions can fail and return NULL.
* XXX We should detect this, and not just march on with NULL pointers.
@@ -363,7 +354,6 @@ ssl_DupSocket(sslSocket *os)
goto loser;
}
}
-
return ss;
loser:
@@ -432,16 +422,9 @@ ssl_DestroySocketContents(sslSocket *ss)
PR_REMOVE_LINK(cursor);
ssl_FreeServerCert((sslServerCert *)cursor);
}
-
- /* Remove extension handlers. */
- ssl_ClearPRCList(&ss->extensionHooks, NULL);
-
ssl_FreeEphemeralKeyPairs(ss);
SECITEM_FreeItem(&ss->opt.nextProtoNego, PR_FALSE);
ssl3_FreeSniNameArray(&ss->xtnData);
-
- ssl_ClearPRCList(&ss->ssl3.hs.dtlsSentHandshake, NULL);
- ssl_ClearPRCList(&ss->ssl3.hs.dtlsRcvdHandshake, NULL);
}
/*
@@ -518,7 +501,7 @@ PrepareSocket(sslSocket *ss)
}
SECStatus
-SSL_Enable(PRFileDesc *fd, int which, PRIntn on)
+SSL_Enable(PRFileDesc *fd, int which, PRBool on)
{
return SSL_OptionSet(fd, which, on);
}
@@ -530,9 +513,9 @@ static PRBool ssl_VersionIsSupportedByPolicy(
* ssl.h in the section "SSL version range setting API".
*/
static void
-ssl_EnableTLS(SSLVersionRange *vrange, PRIntn enable)
+ssl_EnableTLS(SSLVersionRange *vrange, PRBool on)
{
- if (enable) {
+ if (on) {
/* don't turn it on if tls1.0 disallowed by by policy */
if (!ssl_VersionIsSupportedByPolicy(ssl_variant_stream,
SSL_LIBRARY_VERSION_TLS_1_0)) {
@@ -540,14 +523,14 @@ ssl_EnableTLS(SSLVersionRange *vrange, PRIntn enable)
}
}
if (SSL_ALL_VERSIONS_DISABLED(vrange)) {
- if (enable) {
+ if (on) {
vrange->min = SSL_LIBRARY_VERSION_TLS_1_0;
vrange->max = SSL_LIBRARY_VERSION_TLS_1_0;
} /* else don't change anything */
return;
}
- if (enable) {
+ if (on) {
/* Expand the range of enabled version to include TLS 1.0 */
vrange->min = PR_MIN(vrange->min, SSL_LIBRARY_VERSION_TLS_1_0);
vrange->max = PR_MAX(vrange->max, SSL_LIBRARY_VERSION_TLS_1_0);
@@ -567,9 +550,9 @@ ssl_EnableTLS(SSLVersionRange *vrange, PRIntn enable)
* ssl.h in the section "SSL version range setting API".
*/
static void
-ssl_EnableSSL3(SSLVersionRange *vrange, PRIntn enable)
+ssl_EnableSSL3(SSLVersionRange *vrange, PRBool on)
{
- if (enable) {
+ if (on) {
/* don't turn it on if ssl3 disallowed by by policy */
if (!ssl_VersionIsSupportedByPolicy(ssl_variant_stream,
SSL_LIBRARY_VERSION_3_0)) {
@@ -577,14 +560,14 @@ ssl_EnableSSL3(SSLVersionRange *vrange, PRIntn enable)
}
}
if (SSL_ALL_VERSIONS_DISABLED(vrange)) {
- if (enable) {
+ if (on) {
vrange->min = SSL_LIBRARY_VERSION_3_0;
vrange->max = SSL_LIBRARY_VERSION_3_0;
} /* else don't change anything */
return;
}
- if (enable) {
+ if (on) {
/* Expand the range of enabled versions to include SSL 3.0. We know
* SSL 3.0 or some version of TLS is already enabled at this point, so
* we don't need to change vrange->max.
@@ -603,7 +586,7 @@ ssl_EnableSSL3(SSLVersionRange *vrange, PRIntn enable)
}
SECStatus
-SSL_OptionSet(PRFileDesc *fd, PRInt32 which, PRIntn val)
+SSL_OptionSet(PRFileDesc *fd, PRInt32 which, PRBool on)
{
sslSocket *ss = ssl_FindSocket(fd);
SECStatus rv = SECSuccess;
@@ -622,63 +605,63 @@ SSL_OptionSet(PRFileDesc *fd, PRInt32 which, PRIntn val)
case SSL_SOCKS:
ss->opt.useSocks = PR_FALSE;
rv = PrepareSocket(ss);
- if (val) {
+ if (on) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
rv = SECFailure;
}
break;
case SSL_SECURITY:
- ss->opt.useSecurity = val;
+ ss->opt.useSecurity = on;
rv = PrepareSocket(ss);
break;
case SSL_REQUEST_CERTIFICATE:
- ss->opt.requestCertificate = val;
+ ss->opt.requestCertificate = on;
break;
case SSL_REQUIRE_CERTIFICATE:
- ss->opt.requireCertificate = val;
+ ss->opt.requireCertificate = on;
break;
case SSL_HANDSHAKE_AS_CLIENT:
- if (ss->opt.handshakeAsServer && val) {
+ if (ss->opt.handshakeAsServer && on) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
rv = SECFailure;
break;
}
- ss->opt.handshakeAsClient = val;
+ ss->opt.handshakeAsClient = on;
break;
case SSL_HANDSHAKE_AS_SERVER:
- if (ss->opt.handshakeAsClient && val) {
+ if (ss->opt.handshakeAsClient && on) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
rv = SECFailure;
break;
}
- ss->opt.handshakeAsServer = val;
+ ss->opt.handshakeAsServer = on;
break;
case SSL_ENABLE_TLS:
if (IS_DTLS(ss)) {
- if (val) {
+ if (on) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
rv = SECFailure; /* not allowed */
}
break;
}
- ssl_EnableTLS(&ss->vrange, val);
+ ssl_EnableTLS(&ss->vrange, on);
break;
case SSL_ENABLE_SSL3:
if (IS_DTLS(ss)) {
- if (val) {
+ if (on) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
rv = SECFailure; /* not allowed */
}
break;
}
- ssl_EnableSSL3(&ss->vrange, val);
+ ssl_EnableSSL3(&ss->vrange, on);
break;
case SSL_ENABLE_SSL2:
@@ -687,26 +670,26 @@ SSL_OptionSet(PRFileDesc *fd, PRInt32 which, PRIntn val)
* However, if an old application requests to disable SSL v2,
* we shouldn't fail.
*/
- if (val) {
+ if (on) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
rv = SECFailure;
}
break;
case SSL_NO_CACHE:
- ss->opt.noCache = val;
+ ss->opt.noCache = on;
break;
case SSL_ENABLE_FDX:
- if (val && ss->opt.noLocks) {
+ if (on && ss->opt.noLocks) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
rv = SECFailure;
}
- ss->opt.fdx = val;
+ ss->opt.fdx = on;
break;
case SSL_ROLLBACK_DETECTION:
- ss->opt.detectRollBack = val;
+ ss->opt.detectRollBack = on;
break;
case SSL_NO_STEP_DOWN:
@@ -716,14 +699,14 @@ SSL_OptionSet(PRFileDesc *fd, PRInt32 which, PRIntn val)
break;
case SSL_NO_LOCKS:
- if (val && ss->opt.fdx) {
+ if (on && ss->opt.fdx) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
rv = SECFailure;
}
- if (val && ssl_force_locks)
- val = PR_FALSE; /* silent override */
- ss->opt.noLocks = val;
- if (val) {
+ if (on && ssl_force_locks)
+ on = PR_FALSE; /* silent override */
+ ss->opt.noLocks = on;
+ if (on) {
locksEverDisabled = PR_TRUE;
strcpy(lockStatus + LOCKSTATUS_OFFSET, "DISABLED.");
} else if (!holdingLocks) {
@@ -735,75 +718,71 @@ SSL_OptionSet(PRFileDesc *fd, PRInt32 which, PRIntn val)
break;
case SSL_ENABLE_SESSION_TICKETS:
- ss->opt.enableSessionTickets = val;
+ ss->opt.enableSessionTickets = on;
break;
case SSL_ENABLE_DEFLATE:
- ss->opt.enableDeflate = val;
+ ss->opt.enableDeflate = on;
break;
case SSL_ENABLE_RENEGOTIATION:
- if (IS_DTLS(ss) && val != SSL_RENEGOTIATE_NEVER) {
+ if (IS_DTLS(ss) && on != SSL_RENEGOTIATE_NEVER) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
rv = SECFailure;
break;
}
- ss->opt.enableRenegotiation = val;
+ ss->opt.enableRenegotiation = on;
break;
case SSL_REQUIRE_SAFE_NEGOTIATION:
- ss->opt.requireSafeNegotiation = val;
+ ss->opt.requireSafeNegotiation = on;
break;
case SSL_ENABLE_FALSE_START:
- ss->opt.enableFalseStart = val;
+ ss->opt.enableFalseStart = on;
break;
case SSL_CBC_RANDOM_IV:
- ss->opt.cbcRandomIV = val;
+ ss->opt.cbcRandomIV = on;
break;
case SSL_ENABLE_OCSP_STAPLING:
- ss->opt.enableOCSPStapling = val;
+ ss->opt.enableOCSPStapling = on;
break;
case SSL_ENABLE_NPN:
break;
case SSL_ENABLE_ALPN:
- ss->opt.enableALPN = val;
+ ss->opt.enableALPN = on;
break;
case SSL_REUSE_SERVER_ECDHE_KEY:
- ss->opt.reuseServerECDHEKey = val;
+ ss->opt.reuseServerECDHEKey = on;
break;
case SSL_ENABLE_FALLBACK_SCSV:
- ss->opt.enableFallbackSCSV = val;
+ ss->opt.enableFallbackSCSV = on;
break;
case SSL_ENABLE_SERVER_DHE:
- ss->opt.enableServerDhe = val;
+ ss->opt.enableServerDhe = on;
break;
case SSL_ENABLE_EXTENDED_MASTER_SECRET:
- ss->opt.enableExtendedMS = val;
+ ss->opt.enableExtendedMS = on;
break;
case SSL_ENABLE_SIGNED_CERT_TIMESTAMPS:
- ss->opt.enableSignedCertTimestamps = val;
+ ss->opt.enableSignedCertTimestamps = on;
break;
case SSL_REQUIRE_DH_NAMED_GROUPS:
- ss->opt.requireDHENamedGroups = val;
+ ss->opt.requireDHENamedGroups = on;
break;
case SSL_ENABLE_0RTT_DATA:
- ss->opt.enable0RttData = val;
- break;
-
- case SSL_ENABLE_TLS13_COMPAT_MODE:
- ss->opt.enableTls13CompatMode = val;
+ ss->opt.enable0RttData = on;
break;
default:
@@ -825,19 +804,19 @@ SSL_OptionSet(PRFileDesc *fd, PRInt32 which, PRIntn val)
}
SECStatus
-SSL_OptionGet(PRFileDesc *fd, PRInt32 which, PRIntn *pVal)
+SSL_OptionGet(PRFileDesc *fd, PRInt32 which, PRBool *pOn)
{
sslSocket *ss = ssl_FindSocket(fd);
SECStatus rv = SECSuccess;
- PRIntn val = PR_FALSE;
+ PRBool on = PR_FALSE;
- if (!pVal) {
+ if (!pOn) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
return SECFailure;
}
if (!ss) {
SSL_DBG(("%d: SSL[%d]: bad socket in Enable", SSL_GETPID(), fd));
- *pVal = PR_FALSE;
+ *pOn = PR_FALSE;
return SECFailure;
}
@@ -846,101 +825,98 @@ SSL_OptionGet(PRFileDesc *fd, PRInt32 which, PRIntn *pVal)
switch (which) {
case SSL_SOCKS:
- val = PR_FALSE;
+ on = PR_FALSE;
break;
case SSL_SECURITY:
- val = ss->opt.useSecurity;
+ on = ss->opt.useSecurity;
break;
case SSL_REQUEST_CERTIFICATE:
- val = ss->opt.requestCertificate;
+ on = ss->opt.requestCertificate;
break;
case SSL_REQUIRE_CERTIFICATE:
- val = ss->opt.requireCertificate;
+ on = ss->opt.requireCertificate;
break;
case SSL_HANDSHAKE_AS_CLIENT:
- val = ss->opt.handshakeAsClient;
+ on = ss->opt.handshakeAsClient;
break;
case SSL_HANDSHAKE_AS_SERVER:
- val = ss->opt.handshakeAsServer;
+ on = ss->opt.handshakeAsServer;
break;
case SSL_ENABLE_TLS:
- val = ss->vrange.max >= SSL_LIBRARY_VERSION_TLS_1_0;
+ on = ss->vrange.max >= SSL_LIBRARY_VERSION_TLS_1_0;
break;
case SSL_ENABLE_SSL3:
- val = ss->vrange.min == SSL_LIBRARY_VERSION_3_0;
+ on = ss->vrange.min == SSL_LIBRARY_VERSION_3_0;
break;
case SSL_ENABLE_SSL2:
case SSL_V2_COMPATIBLE_HELLO:
- val = PR_FALSE;
+ on = PR_FALSE;
break;
case SSL_NO_CACHE:
- val = ss->opt.noCache;
+ on = ss->opt.noCache;
break;
case SSL_ENABLE_FDX:
- val = ss->opt.fdx;
+ on = ss->opt.fdx;
break;
case SSL_ROLLBACK_DETECTION:
- val = ss->opt.detectRollBack;
+ on = ss->opt.detectRollBack;
break;
case SSL_NO_STEP_DOWN:
- val = PR_FALSE;
+ on = PR_FALSE;
break;
case SSL_BYPASS_PKCS11:
- val = PR_FALSE;
+ on = PR_FALSE;
break;
case SSL_NO_LOCKS:
- val = ss->opt.noLocks;
+ on = ss->opt.noLocks;
break;
case SSL_ENABLE_SESSION_TICKETS:
- val = ss->opt.enableSessionTickets;
+ on = ss->opt.enableSessionTickets;
break;
case SSL_ENABLE_DEFLATE:
- val = ss->opt.enableDeflate;
+ on = ss->opt.enableDeflate;
break;
case SSL_ENABLE_RENEGOTIATION:
- val = ss->opt.enableRenegotiation;
+ on = ss->opt.enableRenegotiation;
break;
case SSL_REQUIRE_SAFE_NEGOTIATION:
- val = ss->opt.requireSafeNegotiation;
+ on = ss->opt.requireSafeNegotiation;
break;
case SSL_ENABLE_FALSE_START:
- val = ss->opt.enableFalseStart;
+ on = ss->opt.enableFalseStart;
break;
case SSL_CBC_RANDOM_IV:
- val = ss->opt.cbcRandomIV;
+ on = ss->opt.cbcRandomIV;
break;
case SSL_ENABLE_OCSP_STAPLING:
- val = ss->opt.enableOCSPStapling;
+ on = ss->opt.enableOCSPStapling;
break;
case SSL_ENABLE_NPN:
- val = ss->opt.enableNPN;
+ on = ss->opt.enableNPN;
break;
case SSL_ENABLE_ALPN:
- val = ss->opt.enableALPN;
+ on = ss->opt.enableALPN;
break;
case SSL_REUSE_SERVER_ECDHE_KEY:
- val = ss->opt.reuseServerECDHEKey;
+ on = ss->opt.reuseServerECDHEKey;
break;
case SSL_ENABLE_FALLBACK_SCSV:
- val = ss->opt.enableFallbackSCSV;
+ on = ss->opt.enableFallbackSCSV;
break;
case SSL_ENABLE_SERVER_DHE:
- val = ss->opt.enableServerDhe;
+ on = ss->opt.enableServerDhe;
break;
case SSL_ENABLE_EXTENDED_MASTER_SECRET:
- val = ss->opt.enableExtendedMS;
+ on = ss->opt.enableExtendedMS;
break;
case SSL_ENABLE_SIGNED_CERT_TIMESTAMPS:
- val = ss->opt.enableSignedCertTimestamps;
+ on = ss->opt.enableSignedCertTimestamps;
break;
case SSL_REQUIRE_DH_NAMED_GROUPS:
- val = ss->opt.requireDHENamedGroups;
+ on = ss->opt.requireDHENamedGroups;
break;
case SSL_ENABLE_0RTT_DATA:
- val = ss->opt.enable0RttData;
- break;
- case SSL_ENABLE_TLS13_COMPAT_MODE:
- val = ss->opt.enableTls13CompatMode;
+ on = ss->opt.enable0RttData;
break;
default:
PORT_SetError(SEC_ERROR_INVALID_ARGS);
@@ -950,17 +926,17 @@ SSL_OptionGet(PRFileDesc *fd, PRInt32 which, PRIntn *pVal)
ssl_ReleaseSSL3HandshakeLock(ss);
ssl_Release1stHandshakeLock(ss);
- *pVal = val;
+ *pOn = on;
return rv;
}
SECStatus
-SSL_OptionGetDefault(PRInt32 which, PRIntn *pVal)
+SSL_OptionGetDefault(PRInt32 which, PRBool *pOn)
{
SECStatus rv = SECSuccess;
- PRIntn val = PR_FALSE;
+ PRBool on = PR_FALSE;
- if (!pVal) {
+ if (!pOn) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
return SECFailure;
}
@@ -969,117 +945,114 @@ SSL_OptionGetDefault(PRInt32 which, PRIntn *pVal)
switch (which) {
case SSL_SOCKS:
- val = PR_FALSE;
+ on = PR_FALSE;
break;
case SSL_SECURITY:
- val = ssl_defaults.useSecurity;
+ on = ssl_defaults.useSecurity;
break;
case SSL_REQUEST_CERTIFICATE:
- val = ssl_defaults.requestCertificate;
+ on = ssl_defaults.requestCertificate;
break;
case SSL_REQUIRE_CERTIFICATE:
- val = ssl_defaults.requireCertificate;
+ on = ssl_defaults.requireCertificate;
break;
case SSL_HANDSHAKE_AS_CLIENT:
- val = ssl_defaults.handshakeAsClient;
+ on = ssl_defaults.handshakeAsClient;
break;
case SSL_HANDSHAKE_AS_SERVER:
- val = ssl_defaults.handshakeAsServer;
+ on = ssl_defaults.handshakeAsServer;
break;
case SSL_ENABLE_TLS:
- val = versions_defaults_stream.max >= SSL_LIBRARY_VERSION_TLS_1_0;
+ on = versions_defaults_stream.max >= SSL_LIBRARY_VERSION_TLS_1_0;
break;
case SSL_ENABLE_SSL3:
- val = versions_defaults_stream.min == SSL_LIBRARY_VERSION_3_0;
+ on = versions_defaults_stream.min == SSL_LIBRARY_VERSION_3_0;
break;
case SSL_ENABLE_SSL2:
case SSL_V2_COMPATIBLE_HELLO:
- val = PR_FALSE;
+ on = PR_FALSE;
break;
case SSL_NO_CACHE:
- val = ssl_defaults.noCache;
+ on = ssl_defaults.noCache;
break;
case SSL_ENABLE_FDX:
- val = ssl_defaults.fdx;
+ on = ssl_defaults.fdx;
break;
case SSL_ROLLBACK_DETECTION:
- val = ssl_defaults.detectRollBack;
+ on = ssl_defaults.detectRollBack;
break;
case SSL_NO_STEP_DOWN:
- val = PR_FALSE;
+ on = PR_FALSE;
break;
case SSL_BYPASS_PKCS11:
- val = PR_FALSE;
+ on = PR_FALSE;
break;
case SSL_NO_LOCKS:
- val = ssl_defaults.noLocks;
+ on = ssl_defaults.noLocks;
break;
case SSL_ENABLE_SESSION_TICKETS:
- val = ssl_defaults.enableSessionTickets;
+ on = ssl_defaults.enableSessionTickets;
break;
case SSL_ENABLE_DEFLATE:
- val = ssl_defaults.enableDeflate;
+ on = ssl_defaults.enableDeflate;
break;
case SSL_ENABLE_RENEGOTIATION:
- val = ssl_defaults.enableRenegotiation;
+ on = ssl_defaults.enableRenegotiation;
break;
case SSL_REQUIRE_SAFE_NEGOTIATION:
- val = ssl_defaults.requireSafeNegotiation;
+ on = ssl_defaults.requireSafeNegotiation;
break;
case SSL_ENABLE_FALSE_START:
- val = ssl_defaults.enableFalseStart;
+ on = ssl_defaults.enableFalseStart;
break;
case SSL_CBC_RANDOM_IV:
- val = ssl_defaults.cbcRandomIV;
+ on = ssl_defaults.cbcRandomIV;
break;
case SSL_ENABLE_OCSP_STAPLING:
- val = ssl_defaults.enableOCSPStapling;
+ on = ssl_defaults.enableOCSPStapling;
break;
case SSL_ENABLE_NPN:
- val = ssl_defaults.enableNPN;
+ on = ssl_defaults.enableNPN;
break;
case SSL_ENABLE_ALPN:
- val = ssl_defaults.enableALPN;
+ on = ssl_defaults.enableALPN;
break;
case SSL_REUSE_SERVER_ECDHE_KEY:
- val = ssl_defaults.reuseServerECDHEKey;
+ on = ssl_defaults.reuseServerECDHEKey;
break;
case SSL_ENABLE_FALLBACK_SCSV:
- val = ssl_defaults.enableFallbackSCSV;
+ on = ssl_defaults.enableFallbackSCSV;
break;
case SSL_ENABLE_SERVER_DHE:
- val = ssl_defaults.enableServerDhe;
+ on = ssl_defaults.enableServerDhe;
break;
case SSL_ENABLE_EXTENDED_MASTER_SECRET:
- val = ssl_defaults.enableExtendedMS;
+ on = ssl_defaults.enableExtendedMS;
break;
case SSL_ENABLE_SIGNED_CERT_TIMESTAMPS:
- val = ssl_defaults.enableSignedCertTimestamps;
+ on = ssl_defaults.enableSignedCertTimestamps;
break;
case SSL_ENABLE_0RTT_DATA:
- val = ssl_defaults.enable0RttData;
- break;
- case SSL_ENABLE_TLS13_COMPAT_MODE:
- val = ssl_defaults.enableTls13CompatMode;
+ on = ssl_defaults.enable0RttData;
break;
default:
PORT_SetError(SEC_ERROR_INVALID_ARGS);
rv = SECFailure;
}
- *pVal = val;
+ *pOn = on;
return rv;
}
/* XXX Use Global Lock to protect this stuff. */
SECStatus
-SSL_EnableDefault(int which, PRIntn val)
+SSL_EnableDefault(int which, PRBool on)
{
- return SSL_OptionSetDefault(which, val);
+ return SSL_OptionSetDefault(which, on);
}
SECStatus
-SSL_OptionSetDefault(PRInt32 which, PRIntn val)
+SSL_OptionSetDefault(PRInt32 which, PRBool on)
{
SECStatus status = ssl_Init();
@@ -1092,46 +1065,46 @@ SSL_OptionSetDefault(PRInt32 which, PRIntn val)
switch (which) {
case SSL_SOCKS:
ssl_defaults.useSocks = PR_FALSE;
- if (val) {
+ if (on) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
return SECFailure;
}
break;
case SSL_SECURITY:
- ssl_defaults.useSecurity = val;
+ ssl_defaults.useSecurity = on;
break;
case SSL_REQUEST_CERTIFICATE:
- ssl_defaults.requestCertificate = val;
+ ssl_defaults.requestCertificate = on;
break;
case SSL_REQUIRE_CERTIFICATE:
- ssl_defaults.requireCertificate = val;
+ ssl_defaults.requireCertificate = on;
break;
case SSL_HANDSHAKE_AS_CLIENT:
- if (ssl_defaults.handshakeAsServer && val) {
+ if (ssl_defaults.handshakeAsServer && on) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
return SECFailure;
}
- ssl_defaults.handshakeAsClient = val;
+ ssl_defaults.handshakeAsClient = on;
break;
case SSL_HANDSHAKE_AS_SERVER:
- if (ssl_defaults.handshakeAsClient && val) {
+ if (ssl_defaults.handshakeAsClient && on) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
return SECFailure;
}
- ssl_defaults.handshakeAsServer = val;
+ ssl_defaults.handshakeAsServer = on;
break;
case SSL_ENABLE_TLS:
- ssl_EnableTLS(&versions_defaults_stream, val);
+ ssl_EnableTLS(&versions_defaults_stream, on);
break;
case SSL_ENABLE_SSL3:
- ssl_EnableSSL3(&versions_defaults_stream, val);
+ ssl_EnableSSL3(&versions_defaults_stream, on);
break;
case SSL_ENABLE_SSL2:
@@ -1140,26 +1113,26 @@ SSL_OptionSetDefault(PRInt32 which, PRIntn val)
* However, if an old application requests to disable SSL v2,
* we shouldn't fail.
*/
- if (val) {
+ if (on) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
return SECFailure;
}
break;
case SSL_NO_CACHE:
- ssl_defaults.noCache = val;
+ ssl_defaults.noCache = on;
break;
case SSL_ENABLE_FDX:
- if (val && ssl_defaults.noLocks) {
+ if (on && ssl_defaults.noLocks) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
return SECFailure;
}
- ssl_defaults.fdx = val;
+ ssl_defaults.fdx = on;
break;
case SSL_ROLLBACK_DETECTION:
- ssl_defaults.detectRollBack = val;
+ ssl_defaults.detectRollBack = on;
break;
case SSL_NO_STEP_DOWN:
@@ -1169,80 +1142,76 @@ SSL_OptionSetDefault(PRInt32 which, PRIntn val)
break;
case SSL_NO_LOCKS:
- if (val && ssl_defaults.fdx) {
+ if (on && ssl_defaults.fdx) {
PORT_SetError(SEC_ERROR_INVALID_ARGS);
return SECFailure;
}
- if (val && ssl_force_locks)
- val = PR_FALSE; /* silent override */
- ssl_defaults.noLocks = val;
- if (val) {
+ if (on && ssl_force_locks)
+ on = PR_FALSE; /* silent override */
+ ssl_defaults.noLocks = on;
+ if (on) {
locksEverDisabled = PR_TRUE;
strcpy(lockStatus + LOCKSTATUS_OFFSET, "DISABLED.");
}
break;
case SSL_ENABLE_SESSION_TICKETS:
- ssl_defaults.enableSessionTickets = val;
+ ssl_defaults.enableSessionTickets = on;
break;
case SSL_ENABLE_DEFLATE:
- ssl_defaults.enableDeflate = val;
+ ssl_defaults.enableDeflate = on;
break;
case SSL_ENABLE_RENEGOTIATION:
- ssl_defaults.enableRenegotiation = val;
+ ssl_defaults.enableRenegotiation = on;
break;
case SSL_REQUIRE_SAFE_NEGOTIATION:
- ssl_defaults.requireSafeNegotiation = val;
+ ssl_defaults.requireSafeNegotiation = on;
break;
case SSL_ENABLE_FALSE_START:
- ssl_defaults.enableFalseStart = val;
+ ssl_defaults.enableFalseStart = on;
break;
case SSL_CBC_RANDOM_IV:
- ssl_defaults.cbcRandomIV = val;
+ ssl_defaults.cbcRandomIV = on;
break;
case SSL_ENABLE_OCSP_STAPLING:
- ssl_defaults.enableOCSPStapling = val;
+ ssl_defaults.enableOCSPStapling = on;
break;
case SSL_ENABLE_NPN:
break;
case SSL_ENABLE_ALPN:
- ssl_defaults.enableALPN = val;
+ ssl_defaults.enableALPN = on;
break;
case SSL_REUSE_SERVER_ECDHE_KEY:
- ssl_defaults.reuseServerECDHEKey = val;
+ ssl_defaults.reuseServerECDHEKey = on;
break;
case SSL_ENABLE_FALLBACK_SCSV:
- ssl_defaults.enableFallbackSCSV = val;
+ ssl_defaults.enableFallbackSCSV = on;
break;
case SSL_ENABLE_SERVER_DHE:
- ssl_defaults.enableServerDhe = val;
+ ssl_defaults.enableServerDhe = on;
break;
case SSL_ENABLE_EXTENDED_MASTER_SECRET:
- ssl_defaults.enableExtendedMS = val;
+ ssl_defaults.enableExtendedMS = on;
break;
case SSL_ENABLE_SIGNED_CERT_TIMESTAMPS:
- ssl_defaults.enableSignedCertTimestamps = val;
+ ssl_defaults.enableSignedCertTimestamps = on;
break;
case SSL_ENABLE_0RTT_DATA:
- ssl_defaults.enable0RttData = val;
- break;
-
- case SSL_ENABLE_TLS13_COMPAT_MODE:
- ssl_defaults.enableTls13CompatMode = val;
+ ssl_defaults.enable0RttData = on;
break;
default:
@@ -2155,25 +2124,6 @@ SSL_ReconfigFD(PRFileDesc *model, PRFileDesc *fd)
return NULL;
PR_APPEND_LINK(&skp->link, &ss->ephemeralKeyPairs);
}
-
- while (!PR_CLIST_IS_EMPTY(&ss->extensionHooks)) {
- cursor = PR_LIST_TAIL(&ss->extensionHooks);
- PR_REMOVE_LINK(cursor);
- PORT_Free(cursor);
- }
- for (cursor = PR_NEXT_LINK(&sm->extensionHooks);
- cursor != &sm->extensionHooks;
- cursor = PR_NEXT_LINK(cursor)) {
- SECStatus rv;
- sslCustomExtensionHooks *hook = (sslCustomExtensionHooks *)cursor;
- rv = SSL_InstallExtensionHooks(ss->fd, hook->type,
- hook->writer, hook->writerArg,
- hook->handler, hook->handlerArg);
- if (rv != SECSuccess) {
- return NULL;
- }
- }
-
PORT_Memcpy((void *)ss->namedGroupPreferences,
sm->namedGroupPreferences,
sizeof(ss->namedGroupPreferences));
@@ -2264,7 +2214,7 @@ ssl3_GetEffectiveVersionPolicy(SSLProtocolVariant variant,
return SECSuccess;
}
-/*
+/*
* Assumes that rangeParam values are within the supported boundaries,
* but should contain all potentially allowed versions, even if they contain
* conflicting versions.
@@ -3174,7 +3124,7 @@ ssl_WriteV(PRFileDesc *fd, const PRIOVec *iov, PRInt32 vectors,
}
blocking = ssl_FdIsBlocking(fd);
-#define K16 ((int)sizeof(buf))
+#define K16 sizeof(buf)
#define KILL_VECTORS \
while (vectors && !iov->iov_len) { \
++iov; \
@@ -3461,6 +3411,7 @@ ssl_InitIOLayer(void)
{
ssl_layer_id = PR_GetUniqueIdentity("SSL");
ssl_SetupIOMethods();
+ ssl_inited = PR_TRUE;
return PR_SUCCESS;
}
@@ -3470,13 +3421,15 @@ ssl_PushIOLayer(sslSocket *ns, PRFileDesc *stack, PRDescIdentity id)
PRFileDesc *layer = NULL;
PRStatus status;
- status = PR_CallOnce(&initIoLayerOnce, &ssl_InitIOLayer);
- if (status != PR_SUCCESS) {
- goto loser;
+ if (!ssl_inited) {
+ status = PR_CallOnce(&initIoLayerOnce, &ssl_InitIOLayer);
+ if (status != PR_SUCCESS)
+ goto loser;
}
- if (ns == NULL) {
+
+ if (ns == NULL)
goto loser;
- }
+
layer = PR_CreateIOLayerStub(ssl_layer_id, &combined_methods);
if (layer == NULL)
goto loser;
@@ -3589,12 +3542,6 @@ ssl_SetDefaultsFromEnvironment(void)
ssl_keylog_iob);
}
SSL_TRACE(("SSL: logging SSL/TLS secrets to %s", ev));
- ssl_keylog_lock = PR_NewLock();
- if (!ssl_keylog_lock) {
- SSL_TRACE(("SSL: failed to create key log lock"));
- fclose(ssl_keylog_iob);
- ssl_keylog_iob = NULL;
- }
}
}
#endif
@@ -3799,6 +3746,7 @@ ssl_NewSocket(PRBool makeLocks, SSLProtocolVariant protocolVariant)
SECStatus rv;
sslSocket *ss;
int i;
+
ssl_SetDefaultsFromEnvironment();
if (ssl_force_locks)
@@ -3829,7 +3777,6 @@ ssl_NewSocket(PRBool makeLocks, SSLProtocolVariant protocolVariant)
PR_INIT_CLIST(&ss->serverCerts);
PR_INIT_CLIST(&ss->ephemeralKeyPairs);
- PR_INIT_CLIST(&ss->extensionHooks);
ss->dbHandle = CERT_GetDefaultCertDB();
@@ -3857,11 +3804,7 @@ ssl_NewSocket(PRBool makeLocks, SSLProtocolVariant protocolVariant)
PR_INIT_CLIST(&ss->ssl3.hs.lastMessageFlight);
PR_INIT_CLIST(&ss->ssl3.hs.cipherSpecs);
PR_INIT_CLIST(&ss->ssl3.hs.bufferedEarlyData);
- ssl3_InitExtensionData(&ss->xtnData, ss);
- PR_INIT_CLIST(&ss->ssl3.hs.dtlsSentHandshake);
- PR_INIT_CLIST(&ss->ssl3.hs.dtlsRcvdHandshake);
- dtls_InitTimers(ss);
-
+ ssl3_InitExtensionData(&ss->xtnData);
if (makeLocks) {
rv = ssl_MakeLocks(ss);
if (rv != SECSuccess)
@@ -3873,10 +3816,6 @@ ssl_NewSocket(PRBool makeLocks, SSLProtocolVariant protocolVariant)
rv = ssl3_InitGather(&ss->gs);
if (rv != SECSuccess)
goto loser;
- rv = ssl3_InitState(ss);
- if (rv != SECSuccess) {
- goto loser;
- }
return ss;
loser:
@@ -3901,69 +3840,3 @@ SSL_CanBypass(CERTCertificate *cert, SECKEYPrivateKey *srvPrivkey,
*pcanbypass = PR_FALSE;
return SECSuccess;
}
-
-/* Functions that are truly experimental use EXP, functions that are no longer
- * experimental use PUB.
- *
- * When initially defining a new API, add that API here using the EXP() macro
- * and name the function with a SSLExp_ prefix. Define the experimental API as
- * a macro in sslexp.h using the SSL_EXPERIMENTAL_API() macro defined there.
- *
- * Once an API is stable and proven, move the macro definition in sslexp.h to a
- * proper function declaration in ssl.h. Keeping the function in this list
- * ensures that code built against the release that contained the experimental
- * API will continue to work; use PUB() to reference the public function.
- */
-#define EXP(n) \
- { \
- "SSL_" #n, SSLExp_##n \
- }
-#define PUB(n) \
- { \
- "SSL_" #n, SSL_##n \
- }
-struct {
- const char *const name;
- void *function;
-} ssl_experimental_functions[] = {
-#ifndef SSL_DISABLE_EXPERIMENTAL_API
- EXP(GetExtensionSupport),
- EXP(HelloRetryRequestCallback),
- EXP(InstallExtensionHooks),
- EXP(KeyUpdate),
- EXP(SendSessionTicket),
- EXP(SetupAntiReplay),
-#endif
- { "", NULL }
-};
-#undef EXP
-#undef PUB
-
-void *
-SSL_GetExperimentalAPI(const char *name)
-{
- unsigned int i;
- for (i = 0; i < PR_ARRAY_SIZE(ssl_experimental_functions); ++i) {
- if (strcmp(name, ssl_experimental_functions[i].name) == 0) {
- return ssl_experimental_functions[i].function;
- }
- }
- PORT_SetError(SSL_ERROR_UNSUPPORTED_EXPERIMENTAL_API);
- return NULL;
-}
-
-void
-ssl_ClearPRCList(PRCList *list, void (*f)(void *))
-{
- PRCList *cursor;
-
- while (!PR_CLIST_IS_EMPTY(list)) {
- cursor = PR_LIST_TAIL(list);
-
- PR_REMOVE_LINK(cursor);
- if (f) {
- f(cursor);
- }
- PORT_Free(cursor);
- }
-}
diff --git a/security/nss/lib/ssl/sslspec.c b/security/nss/lib/ssl/sslspec.c
deleted file mode 100644
index 26c3eb5462..0000000000
--- a/security/nss/lib/ssl/sslspec.c
+++ /dev/null
@@ -1,273 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * Handling of cipher specs.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "ssl.h"
-#include "sslproto.h"
-#include "pk11func.h"
-#include "secitem.h"
-
-#include "sslimpl.h"
-
-/* Record protection algorithms, indexed by SSL3BulkCipher.
- *
- * The |max_records| field (|mr| below) is set to a number that is higher than
- * recommended in some literature (esp. TLS 1.3) because we currently abort the
- * connection when this limit is reached and we want to ensure that we only
- * rarely hit this limit. See bug 1268745 for details.
- */
-#define MR_MAX RECORD_SEQ_MAX /* 2^48-1 */
-#define MR_128 (0x5aULL << 28) /* For AES and similar. */
-#define MR_LOW (1ULL << 20) /* For weak ciphers. */
-/* clang-format off */
-static const ssl3BulkCipherDef ssl_bulk_cipher_defs[] = {
- /* |--------- Lengths ---------| */
- /* cipher calg : s : */
- /* : e b n */
- /* oid short_name mr : c l o */
- /* k r o t n */
- /* e e i c a c */
- /* y t type v k g e */
- {cipher_null, ssl_calg_null, 0, 0, type_stream, 0, 0, 0, 0,
- SEC_OID_NULL_CIPHER, "NULL", MR_MAX},
- {cipher_rc4, ssl_calg_rc4, 16,16, type_stream, 0, 0, 0, 0,
- SEC_OID_RC4, "RC4", MR_LOW},
- {cipher_des, ssl_calg_des, 8, 8, type_block, 8, 8, 0, 0,
- SEC_OID_DES_CBC, "DES-CBC", MR_LOW},
- {cipher_3des, ssl_calg_3des, 24,24, type_block, 8, 8, 0, 0,
- SEC_OID_DES_EDE3_CBC, "3DES-EDE-CBC", MR_LOW},
- {cipher_aes_128, ssl_calg_aes, 16,16, type_block, 16,16, 0, 0,
- SEC_OID_AES_128_CBC, "AES-128", MR_128},
- {cipher_aes_256, ssl_calg_aes, 32,32, type_block, 16,16, 0, 0,
- SEC_OID_AES_256_CBC, "AES-256", MR_128},
- {cipher_camellia_128, ssl_calg_camellia, 16,16, type_block, 16,16, 0, 0,
- SEC_OID_CAMELLIA_128_CBC, "Camellia-128", MR_128},
- {cipher_camellia_256, ssl_calg_camellia, 32,32, type_block, 16,16, 0, 0,
- SEC_OID_CAMELLIA_256_CBC, "Camellia-256", MR_128},
- {cipher_seed, ssl_calg_seed, 16,16, type_block, 16,16, 0, 0,
- SEC_OID_SEED_CBC, "SEED-CBC", MR_128},
- {cipher_aes_128_gcm, ssl_calg_aes_gcm, 16,16, type_aead, 4, 0,16, 8,
- SEC_OID_AES_128_GCM, "AES-128-GCM", MR_128},
- {cipher_aes_256_gcm, ssl_calg_aes_gcm, 32,32, type_aead, 4, 0,16, 8,
- SEC_OID_AES_256_GCM, "AES-256-GCM", MR_128},
- {cipher_chacha20, ssl_calg_chacha20, 32,32, type_aead, 12, 0,16, 0,
- SEC_OID_CHACHA20_POLY1305, "ChaCha20-Poly1305", MR_MAX},
- {cipher_missing, ssl_calg_null, 0, 0, type_stream, 0, 0, 0, 0,
- SEC_OID_UNKNOWN, "missing", 0U},
-};
-/* clang-format on */
-
-const ssl3BulkCipherDef *
-ssl_GetBulkCipherDef(const ssl3CipherSuiteDef *suiteDef)
-{
- SSL3BulkCipher bulkCipher = suiteDef->bulk_cipher_alg;
- PORT_Assert(bulkCipher < PR_ARRAY_SIZE(ssl_bulk_cipher_defs));
- PORT_Assert(ssl_bulk_cipher_defs[bulkCipher].cipher == bulkCipher);
- return &ssl_bulk_cipher_defs[bulkCipher];
-}
-
-/* indexed by SSL3MACAlgorithm */
-static const ssl3MACDef ssl_mac_defs[] = {
- /* pad_size is only used for SSL 3.0 MAC. See RFC 6101 Sec. 5.2.3.1. */
- /* mac mmech pad_size mac_size */
- { ssl_mac_null, CKM_INVALID_MECHANISM, 0, 0, 0 },
- { ssl_mac_md5, CKM_SSL3_MD5_MAC, 48, MD5_LENGTH, SEC_OID_HMAC_MD5 },
- { ssl_mac_sha, CKM_SSL3_SHA1_MAC, 40, SHA1_LENGTH, SEC_OID_HMAC_SHA1 },
- { ssl_hmac_md5, CKM_MD5_HMAC, 0, MD5_LENGTH, SEC_OID_HMAC_MD5 },
- { ssl_hmac_sha, CKM_SHA_1_HMAC, 0, SHA1_LENGTH, SEC_OID_HMAC_SHA1 },
- { ssl_hmac_sha256, CKM_SHA256_HMAC, 0, SHA256_LENGTH, SEC_OID_HMAC_SHA256 },
- { ssl_mac_aead, CKM_INVALID_MECHANISM, 0, 0, 0 },
- { ssl_hmac_sha384, CKM_SHA384_HMAC, 0, SHA384_LENGTH, SEC_OID_HMAC_SHA384 }
-};
-
-const ssl3MACDef *
-ssl_GetMacDefByAlg(SSL3MACAlgorithm mac)
-{
- /* Cast here for clang: https://bugs.llvm.org/show_bug.cgi?id=16154 */
- PORT_Assert((size_t)mac < PR_ARRAY_SIZE(ssl_mac_defs));
- PORT_Assert(ssl_mac_defs[mac].mac == mac);
- return &ssl_mac_defs[mac];
-}
-
-const ssl3MACDef *
-ssl_GetMacDef(const sslSocket *ss, const ssl3CipherSuiteDef *suiteDef)
-{
- SSL3MACAlgorithm mac = suiteDef->mac_alg;
- if (ss->version > SSL_LIBRARY_VERSION_3_0) {
- switch (mac) {
- case ssl_mac_md5:
- mac = ssl_hmac_md5;
- break;
- case ssl_mac_sha:
- mac = ssl_hmac_sha;
- break;
- default:
- break;
- }
- }
- return ssl_GetMacDefByAlg(mac);
-}
-
-ssl3CipherSpec *
-ssl_FindCipherSpecByEpoch(sslSocket *ss, CipherSpecDirection direction,
- DTLSEpoch epoch)
-{
- PRCList *cur_p;
- for (cur_p = PR_LIST_HEAD(&ss->ssl3.hs.cipherSpecs);
- cur_p != &ss->ssl3.hs.cipherSpecs;
- cur_p = PR_NEXT_LINK(cur_p)) {
- ssl3CipherSpec *spec = (ssl3CipherSpec *)cur_p;
-
- if (spec->epoch != epoch) {
- continue;
- }
- if (direction != spec->direction) {
- continue;
- }
- return spec;
- }
- return NULL;
-}
-
-ssl3CipherSpec *
-ssl_CreateCipherSpec(sslSocket *ss, CipherSpecDirection direction)
-{
- ssl3CipherSpec *spec = PORT_ZNew(ssl3CipherSpec);
- if (!spec) {
- return NULL;
- }
- spec->refCt = 1;
- spec->version = ss->version;
- spec->direction = direction;
- SSL_TRC(10, ("%d: SSL[%d]: new %s spec %d ct=%d",
- SSL_GETPID(), ss->fd, SPEC_DIR(spec), spec,
- spec->refCt));
- return spec;
-}
-
-void
-ssl_SaveCipherSpec(sslSocket *ss, ssl3CipherSpec *spec)
-{
- PR_APPEND_LINK(&spec->link, &ss->ssl3.hs.cipherSpecs);
-}
-
-/* Called from ssl3_InitState. */
-/* Caller must hold the SpecWriteLock. */
-SECStatus
-ssl_SetupNullCipherSpec(sslSocket *ss, CipherSpecDirection dir)
-{
- ssl3CipherSpec *spec;
-
- PORT_Assert(ss->opt.noLocks || ssl_HaveSpecWriteLock(ss));
-
- spec = ssl_CreateCipherSpec(ss, dir);
- if (!spec) {
- return SECFailure;
- }
-
- /* Set default versions. This value will be used to generate and send
- * alerts if a version is not negotiated. These values are overridden when
- * sending a ClientHello and when a version is negotiated. */
- spec->version = SSL_LIBRARY_VERSION_TLS_1_0;
- spec->recordVersion = IS_DTLS(ss)
- ? SSL_LIBRARY_VERSION_DTLS_1_0_WIRE
- : SSL_LIBRARY_VERSION_TLS_1_0;
- spec->cipherDef = &ssl_bulk_cipher_defs[cipher_null];
- PORT_Assert(spec->cipherDef->cipher == cipher_null);
- spec->macDef = &ssl_mac_defs[ssl_mac_null];
- PORT_Assert(spec->macDef->mac == ssl_mac_null);
- spec->cipher = Null_Cipher;
-
- spec->phase = "cleartext";
- dtls_InitRecvdRecords(&spec->recvdRecords);
-
- ssl_SaveCipherSpec(ss, spec);
- if (dir == CipherSpecRead) {
- ss->ssl3.crSpec = spec;
- } else {
- ss->ssl3.cwSpec = spec;
- }
- return SECSuccess;
-}
-
-void
-ssl_CipherSpecAddRef(ssl3CipherSpec *spec)
-{
- ++spec->refCt;
- SSL_TRC(10, ("%d: SSL[-]: Increment ref ct for %s spec %d. new ct = %d",
- SSL_GETPID(), SPEC_DIR(spec), spec, spec->refCt));
-}
-
-static void
-ssl_DestroyKeyMaterial(ssl3KeyMaterial *keyMaterial)
-{
- PK11_FreeSymKey(keyMaterial->key);
- PK11_FreeSymKey(keyMaterial->macKey);
- if (keyMaterial->macContext != NULL) {
- PK11_DestroyContext(keyMaterial->macContext, PR_TRUE);
- }
-}
-
-static void
-ssl_FreeCipherSpec(ssl3CipherSpec *spec)
-{
- SSL_TRC(10, ("%d: SSL[-]: Freeing %s spec %d. epoch=%d",
- SSL_GETPID(), SPEC_DIR(spec), spec, spec->epoch));
-
- PR_REMOVE_LINK(&spec->link);
-
- /* PORT_Assert( ss->opt.noLocks || ssl_HaveSpecWriteLock(ss)); Don't have ss! */
- if (spec->cipherContext) {
- PK11_DestroyContext(spec->cipherContext, PR_TRUE);
- }
- PK11_FreeSymKey(spec->masterSecret);
- ssl_DestroyKeyMaterial(&spec->keyMaterial);
-
- PORT_ZFree(spec, sizeof(*spec));
-}
-
-/* This function is never called on a spec which is on the
- * cipherSpecs list. */
-void
-ssl_CipherSpecRelease(ssl3CipherSpec *spec)
-{
- if (!spec) {
- return;
- }
-
- PORT_Assert(spec->refCt > 0);
- --spec->refCt;
- SSL_TRC(10, ("%d: SSL[-]: decrement refct for %s spec %d. epoch=%d new ct = %d",
- SSL_GETPID(), SPEC_DIR(spec), spec, spec->epoch, spec->refCt));
- if (!spec->refCt) {
- ssl_FreeCipherSpec(spec);
- }
-}
-
-void
-ssl_DestroyCipherSpecs(PRCList *list)
-{
- while (!PR_CLIST_IS_EMPTY(list)) {
- ssl3CipherSpec *spec = (ssl3CipherSpec *)PR_LIST_TAIL(list);
- ssl_FreeCipherSpec(spec);
- }
-}
-
-void
-ssl_CipherSpecReleaseByEpoch(sslSocket *ss, CipherSpecDirection dir,
- DTLSEpoch epoch)
-{
- ssl3CipherSpec *spec;
- SSL_TRC(10, ("%d: SSL[%d]: releasing %s cipher spec for epoch %d",
- SSL_GETPID(), ss->fd,
- (dir == CipherSpecRead) ? "read" : "write", epoch));
-
- spec = ssl_FindCipherSpecByEpoch(ss, dir, epoch);
- if (spec) {
- ssl_CipherSpecRelease(spec);
- }
-}
diff --git a/security/nss/lib/ssl/sslspec.h b/security/nss/lib/ssl/sslspec.h
deleted file mode 100644
index 729ac1006f..0000000000
--- a/security/nss/lib/ssl/sslspec.h
+++ /dev/null
@@ -1,194 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is PRIVATE to SSL.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef __sslspec_h_
-#define __sslspec_h_
-
-#include "sslexp.h"
-#include "prclist.h"
-
-typedef enum {
- TrafficKeyClearText = 0,
- TrafficKeyEarlyApplicationData = 1,
- TrafficKeyHandshake = 2,
- TrafficKeyApplicationData = 3
-} TrafficKeyType;
-
-typedef enum {
- CipherSpecRead,
- CipherSpecWrite,
-} CipherSpecDirection;
-
-#define SPEC_DIR(spec) \
- ((spec->direction == CipherSpecRead) ? "read" : "write")
-
-typedef struct ssl3CipherSpecStr ssl3CipherSpec;
-typedef struct ssl3BulkCipherDefStr ssl3BulkCipherDef;
-typedef struct ssl3MACDefStr ssl3MACDef;
-typedef struct ssl3CipherSuiteDefStr ssl3CipherSuiteDef;
-typedef PRUint64 sslSequenceNumber;
-typedef PRUint16 DTLSEpoch;
-
-/* The SSL bulk cipher definition */
-typedef enum {
- cipher_null,
- cipher_rc4,
- cipher_des,
- cipher_3des,
- cipher_aes_128,
- cipher_aes_256,
- cipher_camellia_128,
- cipher_camellia_256,
- cipher_seed,
- cipher_aes_128_gcm,
- cipher_aes_256_gcm,
- cipher_chacha20,
- cipher_missing /* reserved for no such supported cipher */
- /* This enum must match ssl3_cipherName[] in ssl3con.c. */
-} SSL3BulkCipher;
-
-typedef enum {
- type_stream,
- type_block,
- type_aead
-} CipherType;
-
-/*
-** There are tables of these, all const.
-*/
-struct ssl3BulkCipherDefStr {
- SSL3BulkCipher cipher;
- SSLCipherAlgorithm calg;
- unsigned int key_size;
- unsigned int secret_key_size;
- CipherType type;
- unsigned int iv_size;
- unsigned int block_size;
- unsigned int tag_size; /* for AEAD ciphers. */
- unsigned int explicit_nonce_size; /* for AEAD ciphers. */
- SECOidTag oid;
- const char *short_name;
- /* The maximum number of records that can be sent/received with the same
- * symmetric key before the connection will be terminated. */
- PRUint64 max_records;
-};
-
-/* to make some of these old enums public without namespace pollution,
-** it was necessary to prepend ssl_ to the names.
-** These #defines preserve compatibility with the old code here in libssl.
-*/
-typedef SSLMACAlgorithm SSL3MACAlgorithm;
-
-/*
- * There are tables of these, all const.
- */
-struct ssl3MACDefStr {
- SSL3MACAlgorithm mac;
- CK_MECHANISM_TYPE mmech;
- int pad_size;
- int mac_size;
- SECOidTag oid;
-};
-
-#define MAX_IV_LENGTH 24
-
-typedef struct {
- PK11SymKey *key;
- PK11SymKey *macKey;
- PK11Context *macContext;
- PRUint8 iv[MAX_IV_LENGTH];
-} ssl3KeyMaterial;
-
-typedef SECStatus (*SSLCipher)(void *context,
- unsigned char *out,
- int *outlen,
- int maxout,
- const unsigned char *in,
- int inlen);
-typedef SECStatus (*SSLAEADCipher)(
- ssl3KeyMaterial *keys,
- PRBool doDecrypt,
- unsigned char *out,
- int *outlen,
- int maxout,
- const unsigned char *in,
- int inlen,
- const unsigned char *additionalData,
- int additionalDataLen);
-
-/* The DTLS anti-replay window in number of packets. Defined here because we
- * need it in the cipher spec. Note that this is a ring buffer but left and
- * right represent the true window, with modular arithmetic used to map them
- * onto the buffer.
- */
-#define DTLS_RECVD_RECORDS_WINDOW 1024
-#define RECORD_SEQ_MASK ((1ULL << 48) - 1)
-#define RECORD_SEQ_MAX RECORD_SEQ_MASK
-PR_STATIC_ASSERT(DTLS_RECVD_RECORDS_WINDOW % 8 == 0);
-
-typedef struct DTLSRecvdRecordsStr {
- unsigned char data[DTLS_RECVD_RECORDS_WINDOW / 8];
- sslSequenceNumber left;
- sslSequenceNumber right;
-} DTLSRecvdRecords;
-
-/*
- * These are the "specs" used for reading and writing records. Access to the
- * pointers to these specs, and all the specs' contents (direct and indirect) is
- * protected by the reader/writer lock ss->specLock.
- */
-struct ssl3CipherSpecStr {
- PRCList link;
- PRUint8 refCt;
-
- CipherSpecDirection direction;
- SSL3ProtocolVersion version;
- SSL3ProtocolVersion recordVersion;
-
- const ssl3BulkCipherDef *cipherDef;
- const ssl3MACDef *macDef;
-
- SSLCipher cipher;
- SSLAEADCipher aead;
- void *cipherContext;
-
- PK11SymKey *masterSecret;
- ssl3KeyMaterial keyMaterial;
-
- DTLSEpoch epoch;
- const char *phase;
- sslSequenceNumber seqNum;
- DTLSRecvdRecords recvdRecords;
-
- /* The number of 0-RTT bytes that can be sent or received in TLS 1.3. This
- * will be zero for everything but 0-RTT. */
- PRUint32 earlyDataRemaining;
-};
-
-typedef void (*sslCipherSpecChangedFunc)(void *arg,
- PRBool sending,
- ssl3CipherSpec *newSpec);
-
-const ssl3BulkCipherDef *ssl_GetBulkCipherDef(const ssl3CipherSuiteDef *cipher_def);
-const ssl3MACDef *ssl_GetMacDefByAlg(SSL3MACAlgorithm mac);
-const ssl3MACDef *ssl_GetMacDef(const sslSocket *ss, const ssl3CipherSuiteDef *suiteDef);
-
-ssl3CipherSpec *ssl_CreateCipherSpec(sslSocket *ss, CipherSpecDirection direction);
-void ssl_SaveCipherSpec(sslSocket *ss, ssl3CipherSpec *spec);
-void ssl_CipherSpecAddRef(ssl3CipherSpec *spec);
-void ssl_CipherSpecRelease(ssl3CipherSpec *spec);
-void ssl_DestroyCipherSpecs(PRCList *list);
-SECStatus ssl_SetupNullCipherSpec(sslSocket *ss, CipherSpecDirection dir);
-
-ssl3CipherSpec *ssl_FindCipherSpecByEpoch(sslSocket *ss,
- CipherSpecDirection direction,
- DTLSEpoch epoch);
-void ssl_CipherSpecReleaseByEpoch(sslSocket *ss, CipherSpecDirection direction,
- DTLSEpoch epoch);
-
-#endif /* __sslspec_h_ */
diff --git a/security/nss/lib/ssl/sslt.h b/security/nss/lib/ssl/sslt.h
index ce8f6e281e..bd9a2ae88a 100644
--- a/security/nss/lib/ssl/sslt.h
+++ b/security/nss/lib/ssl/sslt.h
@@ -13,28 +13,6 @@
#include "secitem.h"
#include "certt.h"
-typedef enum {
- ssl_hs_hello_request = 0,
- ssl_hs_client_hello = 1,
- ssl_hs_server_hello = 2,
- ssl_hs_hello_verify_request = 3,
- ssl_hs_new_session_ticket = 4,
- ssl_hs_end_of_early_data = 5,
- ssl_hs_hello_retry_request = 6,
- ssl_hs_encrypted_extensions = 8,
- ssl_hs_certificate = 11,
- ssl_hs_server_key_exchange = 12,
- ssl_hs_certificate_request = 13,
- ssl_hs_server_hello_done = 14,
- ssl_hs_certificate_verify = 15,
- ssl_hs_client_key_exchange = 16,
- ssl_hs_finished = 20,
- ssl_hs_certificate_status = 22,
- ssl_hs_key_update = 24,
- ssl_hs_next_proto = 67,
- ssl_hs_message_hash = 254, /* Not a real message. */
-} SSLHandshakeType;
-
typedef struct SSL3StatisticsStr {
/* statistics from ssl3_SendClientHello (sch) */
long sch_sid_cache_hits;
@@ -297,14 +275,6 @@ typedef struct SSLChannelInfoStr {
SSLAuthType authType;
SSLSignatureScheme signatureScheme;
- /* The following fields were added in NSS 3.34. */
- /* When the session was resumed this holds the key exchange group of the
- * original handshake. */
- SSLNamedGroup originalKeaGroup;
- /* This field is PR_TRUE when the session is resumed and PR_FALSE
- * otherwise. */
- PRBool resumed;
-
/* When adding new fields to this structure, please document the
* NSS version in which they were added. */
} SSLChannelInfo;
@@ -425,19 +395,16 @@ typedef enum {
ssl_padding_xtn = 21,
ssl_extended_master_secret_xtn = 23,
ssl_session_ticket_xtn = 35,
- /* 40 was used in draft versions of TLS 1.3; it is now reserved. */
+ ssl_tls13_key_share_xtn = 40,
ssl_tls13_pre_shared_key_xtn = 41,
ssl_tls13_early_data_xtn = 42,
ssl_tls13_supported_versions_xtn = 43,
ssl_tls13_cookie_xtn = 44,
ssl_tls13_psk_key_exchange_modes_xtn = 45,
- ssl_tls13_ticket_early_data_info_xtn = 46, /* Deprecated. */
- ssl_tls13_certificate_authorities_xtn = 47,
- ssl_signature_algorithms_cert_xtn = 50,
- ssl_tls13_key_share_xtn = 51,
- ssl_next_proto_nego_xtn = 13172, /* Deprecated. */
+ ssl_tls13_ticket_early_data_info_xtn = 46,
+ ssl_next_proto_nego_xtn = 13172,
ssl_renegotiation_info_xtn = 0xff01,
- ssl_tls13_short_header_xtn = 0xff03 /* Deprecated. */
+ ssl_tls13_short_header_xtn = 0xff03
} SSLExtensionType;
/* This is the old name for the supported_groups extensions. */
diff --git a/security/nss/lib/ssl/tls13con.c b/security/nss/lib/ssl/tls13con.c
index 1fecaf3f8a..560493848b 100644
--- a/security/nss/lib/ssl/tls13con.c
+++ b/security/nss/lib/ssl/tls13con.c
@@ -17,14 +17,23 @@
#include "sslimpl.h"
#include "sslproto.h"
#include "sslerr.h"
-#include "ssl3exthandle.h"
#include "tls13hkdf.h"
#include "tls13con.h"
-#include "tls13err.h"
#include "tls13exthandle.h"
-#include "tls13hashstate.h"
-static SECStatus tls13_SetCipherSpec(sslSocket *ss, PRUint16 epoch,
+typedef enum {
+ TrafficKeyClearText = 0,
+ TrafficKeyEarlyApplicationData = 1,
+ TrafficKeyHandshake = 2,
+ TrafficKeyApplicationData = 3
+} TrafficKeyType;
+
+typedef enum {
+ CipherSpecRead,
+ CipherSpecWrite,
+} CipherSpecDirection;
+
+static SECStatus tls13_SetCipherSpec(sslSocket *ss, TrafficKeyType type,
CipherSpecDirection install,
PRBool deleteSecret);
static SECStatus tls13_AESGCM(
@@ -44,9 +53,8 @@ static SECStatus tls13_SendEncryptedExtensions(sslSocket *ss);
static void tls13_SetKeyExchangeType(sslSocket *ss, const sslNamedGroupDef *group);
static SECStatus tls13_HandleClientKeyShare(sslSocket *ss,
TLS13KeyShareEntry *peerShare);
-static SECStatus tls13_SendHelloRetryRequest(
- sslSocket *ss, const sslNamedGroupDef *selectedGroup,
- const PRUint8 *token, unsigned int tokenLen);
+static SECStatus tls13_SendHelloRetryRequest(sslSocket *ss,
+ const sslNamedGroupDef *selectedGroup);
static SECStatus tls13_HandleServerKeyShare(sslSocket *ss);
static SECStatus tls13_HandleEncryptedExtensions(sslSocket *ss, PRUint8 *b,
@@ -54,46 +62,40 @@ static SECStatus tls13_HandleEncryptedExtensions(sslSocket *ss, PRUint8 *b,
static SECStatus tls13_SendCertificate(sslSocket *ss);
static SECStatus tls13_HandleCertificate(
sslSocket *ss, PRUint8 *b, PRUint32 length);
-static SECStatus tls13_ReinjectHandshakeTranscript(sslSocket *ss);
static SECStatus tls13_HandleCertificateRequest(sslSocket *ss, PRUint8 *b,
PRUint32 length);
static SECStatus
tls13_SendCertificateVerify(sslSocket *ss, SECKEYPrivateKey *privKey);
static SECStatus tls13_HandleCertificateVerify(
- sslSocket *ss, PRUint8 *b, PRUint32 length);
+ sslSocket *ss, PRUint8 *b, PRUint32 length,
+ SSL3Hashes *hashes);
static SECStatus tls13_RecoverWrappedSharedSecret(sslSocket *ss,
sslSessionID *sid);
static SECStatus
-tls13_DeriveSecretWrap(sslSocket *ss, PK11SymKey *key,
- const char *prefix,
- const char *suffix,
- const char *keylogLabel,
- PK11SymKey **dest);
-static SECStatus
tls13_DeriveSecret(sslSocket *ss, PK11SymKey *key,
- const char *label,
- unsigned int labelLen,
+ const char *prefix,
+ const char *suffix,
const SSL3Hashes *hashes,
PK11SymKey **dest);
static SECStatus tls13_SendEndOfEarlyData(sslSocket *ss);
-static SECStatus tls13_HandleEndOfEarlyData(sslSocket *ss, PRUint8 *b,
- PRUint32 length);
static SECStatus tls13_SendFinished(sslSocket *ss, PK11SymKey *baseKey);
-static SECStatus tls13_ComputePskBinderHash(sslSocket *ss, unsigned int prefix,
+static SECStatus tls13_ComputePskBinderHash(sslSocket *ss,
+ unsigned long prefixLength,
SSL3Hashes *hashes);
-static SECStatus tls13_VerifyFinished(sslSocket *ss, SSLHandshakeType message,
+static SECStatus tls13_VerifyFinished(sslSocket *ss, SSL3HandshakeType message,
PK11SymKey *secret,
PRUint8 *b, PRUint32 length,
const SSL3Hashes *hashes);
static SECStatus tls13_ClientHandleFinished(sslSocket *ss,
- PRUint8 *b, PRUint32 length);
+ PRUint8 *b, PRUint32 length,
+ const SSL3Hashes *hashes);
static SECStatus tls13_ServerHandleFinished(sslSocket *ss,
- PRUint8 *b, PRUint32 length);
-static SECStatus tls13_SendNewSessionTicket(sslSocket *ss,
- const PRUint8 *appToken,
- unsigned int appTokenLen);
+ PRUint8 *b, PRUint32 length,
+ const SSL3Hashes *hashes);
static SECStatus tls13_HandleNewSessionTicket(sslSocket *ss, PRUint8 *b,
PRUint32 length);
+static SECStatus tls13_ComputeHandshakeHashes(sslSocket *ss,
+ SSL3Hashes *hashes);
static SECStatus tls13_ComputeEarlySecrets(sslSocket *ss);
static SECStatus tls13_ComputeHandshakeSecrets(sslSocket *ss);
static SECStatus tls13_ComputeApplicationSecrets(sslSocket *ss);
@@ -105,28 +107,26 @@ static SECStatus tls13_ComputeFinished(
static SECStatus tls13_SendClientSecondRound(sslSocket *ss);
static SECStatus tls13_FinishHandshake(sslSocket *ss);
-const char kHkdfLabelClient[] = "c";
-const char kHkdfLabelServer[] = "s";
-const char kHkdfLabelDerivedSecret[] = "derived";
-const char kHkdfLabelPskBinderKey[] = "res binder";
-const char kHkdfLabelEarlyTrafficSecret[] = "e traffic";
-const char kHkdfLabelEarlyExporterSecret[] = "e exp master";
-const char kHkdfLabelHandshakeTrafficSecret[] = "hs traffic";
-const char kHkdfLabelApplicationTrafficSecret[] = "ap traffic";
+const char kHkdfLabelClient[] = "client";
+const char kHkdfLabelServer[] = "server";
+const char kHkdfLabelPskBinderKey[] = "resumption psk binder key";
+const char kHkdfLabelEarlyTrafficSecret[] = "early traffic secret";
+const char kHkdfLabelEarlyExporterSecret[] = "early exporter master secret";
+const char kHkdfLabelHandshakeTrafficSecret[] = "handshake traffic secret";
+const char kHkdfLabelApplicationTrafficSecret[] = "application traffic secret";
const char kHkdfLabelFinishedSecret[] = "finished";
-const char kHkdfLabelResumptionMasterSecret[] = "res master";
-const char kHkdfLabelExporterMasterSecret[] = "exp master";
-const char kHkdfLabelResumption[] = "resumption";
+const char kHkdfLabelResumptionMasterSecret[] = "resumption master secret";
+const char kHkdfLabelExporterMasterSecret[] = "exporter master secret";
const char kHkdfPurposeKey[] = "key";
const char kHkdfPurposeIv[] = "iv";
-const char keylogLabelClientEarlyTrafficSecret[] = "CLIENT_EARLY_TRAFFIC_SECRET";
-const char keylogLabelClientHsTrafficSecret[] = "CLIENT_HANDSHAKE_TRAFFIC_SECRET";
-const char keylogLabelServerHsTrafficSecret[] = "SERVER_HANDSHAKE_TRAFFIC_SECRET";
-const char keylogLabelClientTrafficSecret[] = "CLIENT_TRAFFIC_SECRET_0";
-const char keylogLabelServerTrafficSecret[] = "SERVER_TRAFFIC_SECRET_0";
-const char keylogLabelEarlyExporterSecret[] = "EARLY_EXPORTER_SECRET";
-const char keylogLabelExporterSecret[] = "EXPORTER_SECRET";
+#define TRAFFIC_SECRET(ss, dir, name) ((ss->sec.isServer ^ \
+ (dir == CipherSpecWrite)) \
+ ? ss->ssl3.hs.client##name \
+ : ss->ssl3.hs.server##name)
+
+const SSL3ProtocolVersion kTlsRecordVersion = SSL_LIBRARY_VERSION_TLS_1_0;
+const SSL3ProtocolVersion kDtlsRecordVersion = SSL_LIBRARY_VERSION_TLS_1_1;
/* Belt and suspenders in case we ever add a TLS 1.4. */
PR_STATIC_ASSERT(SSL_LIBRARY_VERSION_MAX_SUPPORTED <=
@@ -165,7 +165,6 @@ tls13_HandshakeState(SSL3WaitState st)
switch (st) {
STATE_CASE(idle_handshake);
STATE_CASE(wait_client_hello);
- STATE_CASE(wait_end_of_early_data);
STATE_CASE(wait_client_cert);
STATE_CASE(wait_client_key);
STATE_CASE(wait_cert_verify);
@@ -337,23 +336,6 @@ tls13_GetHmacMechanism(sslSocket *ss)
}
SECStatus
-tls13_ComputeHash(sslSocket *ss, SSL3Hashes *hashes,
- const PRUint8 *buf, unsigned int len)
-{
- SECStatus rv;
-
- rv = PK11_HashBuf(ssl3_HashTypeToOID(tls13_GetHash(ss)),
- hashes->u.raw, buf, len);
- if (rv != SECSuccess) {
- FATAL_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE, internal_error);
- return SECFailure;
- }
- hashes->len = tls13_GetHashSize(ss);
-
- return SECSuccess;
-}
-
-SECStatus
tls13_CreateKeyShare(sslSocket *ss, const sslNamedGroupDef *groupDef)
{
SECStatus rv;
@@ -468,8 +450,7 @@ tls13_SetupClientHello(sslSocket *ss)
return SECFailure;
}
- ss->ssl3.hs.cipher_suite = ss->sec.ci.sid->u.ssl3.cipherSuite;
- rv = ssl3_SetupCipherSuite(ss, PR_FALSE);
+ rv = ssl3_SetCipherSuite(ss, ss->sec.ci.sid->u.ssl3.cipherSuite, PR_FALSE);
if (rv != SECSuccess) {
FATAL_ERROR(ss, PORT_GetError(), internal_error);
return SECFailure;
@@ -577,241 +558,9 @@ loser:
return SECFailure;
}
-static PRBool
-tls13_UseServerSecret(sslSocket *ss, CipherSpecDirection direction)
-{
- return ss->sec.isServer == (direction == CipherSpecWrite);
-}
-
-static PK11SymKey **
-tls13_TrafficSecretRef(sslSocket *ss, CipherSpecDirection direction)
-{
- if (tls13_UseServerSecret(ss, direction)) {
- return &ss->ssl3.hs.serverTrafficSecret;
- }
- return &ss->ssl3.hs.clientTrafficSecret;
-}
-
-SECStatus
-tls13_UpdateTrafficKeys(sslSocket *ss, CipherSpecDirection direction)
-{
- PK11SymKey **secret;
- PK11SymKey *updatedSecret;
- PRUint16 epoch;
- SECStatus rv;
-
- secret = tls13_TrafficSecretRef(ss, direction);
- rv = tls13_HkdfExpandLabel(*secret, tls13_GetHash(ss),
- NULL, 0,
- kHkdfLabelApplicationTrafficSecret,
- strlen(kHkdfLabelApplicationTrafficSecret),
- tls13_GetHmacMechanism(ss),
- tls13_GetHashSize(ss),
- &updatedSecret);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- PK11_FreeSymKey(*secret);
- *secret = updatedSecret;
-
- ssl_GetSpecReadLock(ss);
- if (direction == CipherSpecRead) {
- epoch = ss->ssl3.crSpec->epoch;
- } else {
- epoch = ss->ssl3.cwSpec->epoch;
- }
- ssl_ReleaseSpecReadLock(ss);
-
- if (epoch == PR_UINT16_MAX) {
- /* Good chance that this is an overflow from too many updates. */
- FATAL_ERROR(ss, SSL_ERROR_TOO_MANY_KEY_UPDATES, internal_error);
- return SECFailure;
- }
- ++epoch;
-
- rv = tls13_SetCipherSpec(ss, epoch, direction, PR_FALSE);
- if (rv != SECSuccess) {
- FATAL_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE, internal_error);
- return SECFailure;
- }
-
- return SECSuccess;
-}
-
-SECStatus
-tls13_SendKeyUpdate(sslSocket *ss, tls13KeyUpdateRequest request, PRBool buffer)
-{
- SECStatus rv;
-
- SSL_TRC(3, ("%d: TLS13[%d]: %s send key update, response %s",
- SSL_GETPID(), ss->fd, SSL_ROLE(ss),
- (request == update_requested) ? "requested"
- : "not requested"));
-
- PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
-
- if (!ss->firstHsDone) {
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
- }
-
- rv = TLS13_CHECK_HS_STATE(ss, SEC_ERROR_LIBRARY_FAILURE,
- idle_handshake);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- /* Not supported. */
- if (IS_DTLS(ss)) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- return SECFailure;
- }
-
- ssl_GetXmitBufLock(ss);
- rv = ssl3_AppendHandshakeHeader(ss, ssl_hs_key_update, 1);
- if (rv != SECSuccess) {
- FATAL_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE, internal_error);
- goto loser;
- }
- rv = ssl3_AppendHandshakeNumber(ss, request, 1);
- if (rv != SECSuccess) {
- FATAL_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE, internal_error);
- goto loser;
- }
-
- /* If we have been asked to buffer, then do so. This allows us to coalesce
- * a KeyUpdate with a pending write. */
- rv = ssl3_FlushHandshake(ss, buffer ? ssl_SEND_FLAG_FORCE_INTO_BUFFER : 0);
- if (rv != SECSuccess) {
- goto loser; /* error code set by ssl3_FlushHandshake */
- }
- ssl_ReleaseXmitBufLock(ss);
-
- rv = tls13_UpdateTrafficKeys(ss, CipherSpecWrite);
- if (rv != SECSuccess) {
- goto loser; /* error code set by tls13_UpdateTrafficKeys */
- }
-
- return SECSuccess;
-
-loser:
- ssl_ReleaseXmitBufLock(ss);
- return SECFailure;
-}
-
-SECStatus
-SSLExp_KeyUpdate(PRFileDesc *fd, PRBool requestUpdate)
-{
- SECStatus rv;
- sslSocket *ss = ssl_FindSocket(fd);
- if (!ss) {
- return SECFailure;
- }
-
- if (!ss->firstHsDone) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- return SECFailure;
- }
-
- rv = TLS13_CHECK_HS_STATE(ss, SEC_ERROR_INVALID_ARGS,
- idle_handshake);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- ssl_GetSSL3HandshakeLock(ss);
- rv = tls13_SendKeyUpdate(ss, requestUpdate ? update_requested : update_not_requested,
- PR_FALSE /* don't buffer */);
-
- /* Remember that we are the ones that initiated this KeyUpdate. */
- if (rv == SECSuccess) {
- ss->ssl3.peerRequestedKeyUpdate = PR_FALSE;
- }
- ssl_ReleaseSSL3HandshakeLock(ss);
- return rv;
-}
-
-/*
- * enum {
- * update_not_requested(0), update_requested(1), (255)
- * } KeyUpdateRequest;
- *
- * struct {
- * KeyUpdateRequest request_update;
- * } KeyUpdate;
- */
-static SECStatus
-tls13_HandleKeyUpdate(sslSocket *ss, PRUint8 *b, unsigned int length)
-{
- SECStatus rv;
- PRUint32 update;
-
- SSL_TRC(3, ("%d: TLS13[%d]: %s handle key update",
- SSL_GETPID(), ss->fd, SSL_ROLE(ss)));
-
- PORT_Assert(ss->opt.noLocks || ssl_HaveRecvBufLock(ss));
- PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
-
- PORT_Assert(ss->firstHsDone);
- if (!ss->firstHsDone) {
- FATAL_ERROR(ss, SSL_ERROR_RX_UNEXPECTED_KEY_UPDATE, unexpected_message);
- return SECFailure;
- }
-
- rv = TLS13_CHECK_HS_STATE(ss, SSL_ERROR_RX_UNEXPECTED_KEY_UPDATE,
- idle_handshake);
- if (rv != SECSuccess) {
- /* We should never be idle_handshake prior to firstHsDone. */
- FATAL_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE, internal_error);
- return SECFailure;
- }
-
- rv = ssl3_ConsumeHandshakeNumber(ss, &update, 1, &b, &length);
- if (rv != SECSuccess) {
- return SECFailure; /* Error code set already. */
- }
- if (length != 0) {
- FATAL_ERROR(ss, SSL_ERROR_RX_MALFORMED_KEY_UPDATE, decode_error);
- return SECFailure;
- }
- if (!(update == update_requested ||
- update == update_not_requested)) {
- FATAL_ERROR(ss, SSL_ERROR_RX_MALFORMED_KEY_UPDATE, decode_error);
- return SECFailure;
- }
-
- rv = tls13_UpdateTrafficKeys(ss, CipherSpecRead);
- if (rv != SECSuccess) {
- return SECFailure; /* Error code set by tls13_UpdateTrafficKeys. */
- }
-
- if (update == update_requested) {
- PRBool sendUpdate;
- if (ss->ssl3.peerRequestedKeyUpdate) {
- /* Only send an update if we have sent with the current spec. This
- * prevents us from being forced to crank forward pointlessly. */
- ssl_GetSpecReadLock(ss);
- sendUpdate = ss->ssl3.cwSpec->seqNum > 0;
- ssl_ReleaseSpecReadLock(ss);
- } else {
- sendUpdate = PR_TRUE;
- }
- if (sendUpdate) {
- /* Respond immediately (don't buffer). */
- rv = tls13_SendKeyUpdate(ss, update_not_requested, PR_FALSE);
- if (rv != SECSuccess) {
- return SECFailure; /* Error already set. */
- }
- }
- ss->ssl3.peerRequestedKeyUpdate = PR_TRUE;
- }
-
- return SECSuccess;
-}
-
SECStatus
-tls13_HandlePostHelloHandshakeMessage(sslSocket *ss, PRUint8 *b, PRUint32 length)
+tls13_HandlePostHelloHandshakeMessage(sslSocket *ss, PRUint8 *b,
+ PRUint32 length, SSL3Hashes *hashesPtr)
{
if (ss->sec.isServer && ss->ssl3.hs.zeroRttIgnore != ssl_0rtt_ignore_none) {
SSL_TRC(3, ("%d: TLS13[%d]: %s successfully decrypted handshake after"
@@ -822,34 +571,36 @@ tls13_HandlePostHelloHandshakeMessage(sslSocket *ss, PRUint8 *b, PRUint32 length
/* TODO(ekr@rtfm.com): Would it be better to check all the states here? */
switch (ss->ssl3.hs.msg_type) {
- case ssl_hs_certificate:
+ case certificate:
return tls13_HandleCertificate(ss, b, length);
- case ssl_hs_certificate_request:
+ case certificate_request:
return tls13_HandleCertificateRequest(ss, b, length);
- case ssl_hs_certificate_verify:
- return tls13_HandleCertificateVerify(ss, b, length);
+ case certificate_verify:
+ if (!hashesPtr) {
+ FATAL_ERROR(ss, SSL_ERROR_RX_UNEXPECTED_CERT_VERIFY, unexpected_message);
+ return SECFailure;
+ }
+ return tls13_HandleCertificateVerify(ss, b, length, hashesPtr);
- case ssl_hs_encrypted_extensions:
+ case encrypted_extensions:
return tls13_HandleEncryptedExtensions(ss, b, length);
- case ssl_hs_new_session_ticket:
+ case new_session_ticket:
return tls13_HandleNewSessionTicket(ss, b, length);
- case ssl_hs_finished:
+ case finished:
+ if (!hashesPtr) {
+ FATAL_ERROR(ss, SSL_ERROR_RX_UNEXPECTED_FINISHED, unexpected_message);
+ return SECFailure;
+ }
if (ss->sec.isServer) {
- return tls13_ServerHandleFinished(ss, b, length);
+ return tls13_ServerHandleFinished(ss, b, length, hashesPtr);
} else {
- return tls13_ClientHandleFinished(ss, b, length);
+ return tls13_ClientHandleFinished(ss, b, length, hashesPtr);
}
- case ssl_hs_end_of_early_data:
- return tls13_HandleEndOfEarlyData(ss, b, length);
-
- case ssl_hs_key_update:
- return tls13_HandleKeyUpdate(ss, b, length);
-
default:
FATAL_ERROR(ss, SSL_ERROR_RX_UNKNOWN_HANDSHAKE, unexpected_message);
return SECFailure;
@@ -868,6 +619,10 @@ tls13_RecoverWrappedSharedSecret(sslSocket *ss, sslSessionID *sid)
SSL_TRC(3, ("%d: TLS13[%d]: recovering static secret (%s)",
SSL_GETPID(), ss->fd, SSL_ROLE(ss)));
+ if (!sid->u.ssl3.keys.msIsWrapped) {
+ PORT_Assert(0); /* I think this can't happen. */
+ return SECFailure;
+ }
/* Now find the hash used as the PRF for the previous handshake. */
hashType = tls13_GetHashForCipherSuite(sid->u.ssl3.cipherSuite);
@@ -918,55 +673,53 @@ tls13_RecoverWrappedSharedSecret(sslSocket *ss, sslSessionID *sid)
/* Key Derivation Functions.
*
+ * Below is the key schedule from [draft-ietf-tls-tls13].
+ *
+ * * The relevant functions from this file are indicated by tls13_Foo().
* 0
* |
* v
- * PSK -> HKDF-Extract = Early Secret
+ * PSK -> HKDF-Extract
* |
- * +-----> Derive-Secret(., "ext binder" | "res binder", "")
- * | = binder_key
- * |
- * +-----> Derive-Secret(., "c e traffic",
- * | ClientHello)
- * | = client_early_traffic_secret
- * |
- * +-----> Derive-Secret(., "e exp master",
- * | ClientHello)
- * | = early_exporter_secret
* v
- * Derive-Secret(., "derived", "")
+ * Early Secret ---> Derive-Secret(., "client early traffic secret",
+ * | ClientHello)
+ * | = client_early_traffic_secret
+ * v
+ * (EC)DHE -> HKDF-Extract
* |
* v
- *(EC)DHE -> HKDF-Extract = Handshake Secret
+ * Handshake Secret
* |
- * +-----> Derive-Secret(., "c hs traffic",
- * | ClientHello...ServerHello)
- * | = client_handshake_traffic_secret
+ * +---------> Derive-Secret(., "client handshake traffic secret",
+ * | ClientHello...ServerHello)
+ * | = client_handshake_traffic_secret
+ * |
+ * +---------> Derive-Secret(., "server handshake traffic secret",
+ * | ClientHello...ServerHello)
+ * | = server_handshake_traffic_secret
* |
- * +-----> Derive-Secret(., "s hs traffic",
- * | ClientHello...ServerHello)
- * | = server_handshake_traffic_secret
* v
- * Derive-Secret(., "derived", "")
+ * 0 -> HKDF-Extract
* |
* v
- * 0 -> HKDF-Extract = Master Secret
+ * Master Secret
* |
- * +-----> Derive-Secret(., "c ap traffic",
- * | ClientHello...Server Finished)
- * | = client_traffic_secret_0
+ * +---------> Derive-Secret(., "client application traffic secret",
+ * | ClientHello...Server Finished)
+ * | = client_traffic_secret_0
* |
- * +-----> Derive-Secret(., "s ap traffic",
- * | ClientHello...Server Finished)
- * | = server_traffic_secret_0
+ * +---------> Derive-Secret(., "server application traffic secret",
+ * | ClientHello...Server Finished)
+ * | = server_traffic_secret_0
* |
- * +-----> Derive-Secret(., "exp master",
- * | ClientHello...Server Finished)
- * | = exporter_secret
+ * +---------> Derive-Secret(., "exporter master secret",
+ * | ClientHello...Client Finished)
+ * | = exporter_secret
* |
- * +-----> Derive-Secret(., "res master",
- * ClientHello...Client Finished)
- * = resumption_master_secret
+ * +---------> Derive-Secret(., "resumption master secret",
+ * ClientHello...Client Finished)
+ * = resumption_secret
*
*/
@@ -989,43 +742,35 @@ tls13_ComputeEarlySecrets(sslSocket *ss)
PORT_Assert(ss->statelessResume == (ss->ssl3.hs.resumptionMasterSecret != NULL));
if (ss->statelessResume) {
+ PRUint8 buf[1] = { 0 };
+ SSL3Hashes hashes;
+
PK11_FreeSymKey(ss->ssl3.hs.resumptionMasterSecret);
ss->ssl3.hs.resumptionMasterSecret = NULL;
- rv = tls13_DeriveSecretNullHash(ss, ss->ssl3.hs.currentSecret,
- kHkdfLabelPskBinderKey,
- strlen(kHkdfLabelPskBinderKey),
- &ss->ssl3.hs.pskBinderKey);
+ rv = PK11_HashBuf(ssl3_HashTypeToOID(tls13_GetHash(ss)),
+ hashes.u.raw, buf, 0);
if (rv != SECSuccess) {
+ FATAL_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE, internal_error);
return SECFailure;
}
- }
- PORT_Assert(!ss->ssl3.hs.resumptionMasterSecret);
-
- return SECSuccess;
-}
+ hashes.len = tls13_GetHashSize(ss);
-/* This derives the early traffic and early exporter secrets. */
-static SECStatus
-tls13_DeriveEarlySecrets(sslSocket *ss)
-{
- SECStatus rv;
-
- rv = tls13_DeriveSecretWrap(ss, ss->ssl3.hs.currentSecret,
- kHkdfLabelClient,
- kHkdfLabelEarlyTrafficSecret,
- keylogLabelClientEarlyTrafficSecret,
- &ss->ssl3.hs.clientEarlyTrafficSecret);
- if (rv != SECSuccess) {
- return SECFailure;
- }
+ rv = tls13_DeriveSecret(ss, ss->ssl3.hs.currentSecret,
+ NULL, kHkdfLabelPskBinderKey, &hashes,
+ &ss->ssl3.hs.pskBinderKey);
+ if (rv != SECSuccess) {
+ return SECFailure;
+ }
- rv = tls13_DeriveSecretWrap(ss, ss->ssl3.hs.currentSecret,
+ rv = tls13_DeriveSecret(ss, ss->ssl3.hs.currentSecret,
NULL, kHkdfLabelEarlyExporterSecret,
- keylogLabelEarlyExporterSecret,
- &ss->ssl3.hs.earlyExporterSecret);
- if (rv != SECSuccess) {
- return SECFailure;
+ &hashes, &ss->ssl3.hs.earlyExporterSecret);
+ if (rv != SECSuccess) {
+ return SECFailure;
+ }
+ } else {
+ PORT_Assert(!ss->ssl3.hs.resumptionMasterSecret);
}
return SECSuccess;
@@ -1035,7 +780,6 @@ static SECStatus
tls13_ComputeHandshakeSecrets(sslSocket *ss)
{
SECStatus rv;
- PK11SymKey *derivedSecret = NULL;
PK11SymKey *newSecret = NULL;
SSL_TRC(5, ("%d: TLS13[%d]: compute handshake secrets (%s)",
@@ -1044,21 +788,8 @@ tls13_ComputeHandshakeSecrets(sslSocket *ss)
/* First update |currentSecret| to add |dheSecret|, if any. */
PORT_Assert(ss->ssl3.hs.currentSecret);
PORT_Assert(ss->ssl3.hs.dheSecret);
-
- /* Expand before we extract. */
- rv = tls13_DeriveSecretNullHash(ss, ss->ssl3.hs.currentSecret,
- kHkdfLabelDerivedSecret,
- strlen(kHkdfLabelDerivedSecret),
- &derivedSecret);
- if (rv != SECSuccess) {
- LOG_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE);
- return rv;
- }
-
- rv = tls13_HkdfExtract(derivedSecret, ss->ssl3.hs.dheSecret,
+ rv = tls13_HkdfExtract(ss->ssl3.hs.currentSecret, ss->ssl3.hs.dheSecret,
tls13_GetHash(ss), &newSecret);
- PK11_FreeSymKey(derivedSecret);
-
if (rv != SECSuccess) {
LOG_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE);
return rv;
@@ -1069,20 +800,18 @@ tls13_ComputeHandshakeSecrets(sslSocket *ss)
ss->ssl3.hs.currentSecret = newSecret;
/* Now compute |*HsTrafficSecret| */
- rv = tls13_DeriveSecretWrap(ss, ss->ssl3.hs.currentSecret,
- kHkdfLabelClient,
- kHkdfLabelHandshakeTrafficSecret,
- keylogLabelClientHsTrafficSecret,
- &ss->ssl3.hs.clientHsTrafficSecret);
+ rv = tls13_DeriveSecret(ss, ss->ssl3.hs.currentSecret,
+ kHkdfLabelClient,
+ kHkdfLabelHandshakeTrafficSecret, NULL,
+ &ss->ssl3.hs.clientHsTrafficSecret);
if (rv != SECSuccess) {
LOG_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE);
return rv;
}
- rv = tls13_DeriveSecretWrap(ss, ss->ssl3.hs.currentSecret,
- kHkdfLabelServer,
- kHkdfLabelHandshakeTrafficSecret,
- keylogLabelServerHsTrafficSecret,
- &ss->ssl3.hs.serverHsTrafficSecret);
+ rv = tls13_DeriveSecret(ss, ss->ssl3.hs.currentSecret,
+ kHkdfLabelServer,
+ kHkdfLabelHandshakeTrafficSecret, NULL,
+ &ss->ssl3.hs.serverHsTrafficSecret);
if (rv != SECSuccess) {
LOG_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE);
return rv;
@@ -1093,19 +822,11 @@ tls13_ComputeHandshakeSecrets(sslSocket *ss)
/* Crank HKDF forward to make master secret, which we
* stuff in current secret. */
- rv = tls13_DeriveSecretNullHash(ss, ss->ssl3.hs.currentSecret,
- kHkdfLabelDerivedSecret,
- strlen(kHkdfLabelDerivedSecret),
- &derivedSecret);
- if (rv != SECSuccess) {
- LOG_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE);
- return rv;
- }
- rv = tls13_HkdfExtract(derivedSecret,
+ rv = tls13_HkdfExtract(ss->ssl3.hs.currentSecret,
NULL,
tls13_GetHash(ss),
&newSecret);
- PK11_FreeSymKey(derivedSecret);
+
if (rv != SECSuccess) {
LOG_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE);
return SECFailure;
@@ -1121,27 +842,26 @@ tls13_ComputeApplicationSecrets(sslSocket *ss)
{
SECStatus rv;
- rv = tls13_DeriveSecretWrap(ss, ss->ssl3.hs.currentSecret,
- kHkdfLabelClient,
- kHkdfLabelApplicationTrafficSecret,
- keylogLabelClientTrafficSecret,
- &ss->ssl3.hs.clientTrafficSecret);
+ rv = tls13_DeriveSecret(ss, ss->ssl3.hs.currentSecret,
+ kHkdfLabelClient,
+ kHkdfLabelApplicationTrafficSecret,
+ NULL,
+ &ss->ssl3.hs.clientTrafficSecret);
if (rv != SECSuccess) {
return SECFailure;
}
- rv = tls13_DeriveSecretWrap(ss, ss->ssl3.hs.currentSecret,
- kHkdfLabelServer,
- kHkdfLabelApplicationTrafficSecret,
- keylogLabelServerTrafficSecret,
- &ss->ssl3.hs.serverTrafficSecret);
+ rv = tls13_DeriveSecret(ss, ss->ssl3.hs.currentSecret,
+ kHkdfLabelServer,
+ kHkdfLabelApplicationTrafficSecret,
+ NULL,
+ &ss->ssl3.hs.serverTrafficSecret);
if (rv != SECSuccess) {
return SECFailure;
}
- rv = tls13_DeriveSecretWrap(ss, ss->ssl3.hs.currentSecret,
- NULL, kHkdfLabelExporterMasterSecret,
- keylogLabelExporterSecret,
- &ss->ssl3.hs.exporterSecret);
+ rv = tls13_DeriveSecret(ss, ss->ssl3.hs.currentSecret,
+ NULL, kHkdfLabelExporterMasterSecret,
+ NULL, &ss->ssl3.hs.exporterSecret);
if (rv != SECSuccess) {
return SECFailure;
}
@@ -1153,20 +873,30 @@ static SECStatus
tls13_ComputeFinalSecrets(sslSocket *ss)
{
SECStatus rv;
+ PK11SymKey *resumptionMasterSecret = NULL;
- PORT_Assert(!ss->ssl3.crSpec->masterSecret);
- PORT_Assert(!ss->ssl3.cwSpec->masterSecret);
+ PORT_Assert(!ss->ssl3.crSpec->master_secret);
+ PORT_Assert(!ss->ssl3.cwSpec->master_secret);
- rv = tls13_DeriveSecretWrap(ss, ss->ssl3.hs.currentSecret,
- NULL, kHkdfLabelResumptionMasterSecret,
- NULL,
- &ss->ssl3.hs.resumptionMasterSecret);
+ rv = tls13_DeriveSecret(ss, ss->ssl3.hs.currentSecret,
+ NULL, kHkdfLabelResumptionMasterSecret,
+ NULL, &resumptionMasterSecret);
PK11_FreeSymKey(ss->ssl3.hs.currentSecret);
ss->ssl3.hs.currentSecret = NULL;
if (rv != SECSuccess) {
return SECFailure;
}
+ /* This is pretty gross. TLS 1.3 uses a number of master secrets:
+ * The master secret to generate the keys and then the resumption
+ * master secret for future connections. To make this work without
+ * refactoring too much of the SSLv3 code, we store the RMS in
+ * |crSpec->master_secret| and |cwSpec->master_secret|.
+ */
+ ss->ssl3.crSpec->master_secret = resumptionMasterSecret;
+ ss->ssl3.cwSpec->master_secret =
+ PK11_ReferenceSymKey(ss->ssl3.crSpec->master_secret);
+
return SECSuccess;
}
@@ -1179,8 +909,6 @@ tls13_RestoreCipherInfo(sslSocket *ss, sslSessionID *sid)
*/
ss->sec.authType = sid->authType;
ss->sec.authKeyBits = sid->authKeyBits;
- ss->sec.originalKeaGroup = ssl_LookupNamedGroup(sid->keaGroup);
- ss->sec.signatureScheme = sid->sigScheme;
}
/* Check whether resumption-PSK is allowed. */
@@ -1233,10 +961,6 @@ tls13_CanNegotiateZeroRtt(sslSocket *ss, const sslSessionID *sid)
&sid->u.ssl3.alpnSelection) != 0)
return PR_FALSE;
- if (tls13_IsReplay(ss, sid)) {
- return PR_FALSE;
- }
-
return PR_TRUE;
}
@@ -1322,9 +1046,7 @@ tls13_FindKeyShareEntry(sslSocket *ss, const sslNamedGroupDef *group)
}
static SECStatus
-tls13_NegotiateKeyExchange(sslSocket *ss,
- const sslNamedGroupDef **requestedGroup,
- TLS13KeyShareEntry **clientShare)
+tls13_NegotiateKeyExchange(sslSocket *ss, TLS13KeyShareEntry **clientShare)
{
unsigned int index;
TLS13KeyShareEntry *entry = NULL;
@@ -1404,16 +1126,13 @@ tls13_NegotiateKeyExchange(sslSocket *ss,
SSL_TRC(3, ("%d: TLS13[%d]: group = %d", SSL_GETPID(), ss->fd,
preferredGroup->name));
- /* Either provide a share, or provide a group that should be requested in a
- * HelloRetryRequest, but not both. */
- if (entry) {
- PORT_Assert(preferredGroup == entry->group);
- *clientShare = entry;
- *requestedGroup = NULL;
- } else {
- *clientShare = NULL;
- *requestedGroup = preferredGroup;
+ if (!entry) {
+ return tls13_SendHelloRetryRequest(ss, preferredGroup);
}
+
+ PORT_Assert(preferredGroup == entry->group);
+ *clientShare = entry;
+
return SECSuccess;
}
@@ -1471,8 +1190,8 @@ tls13_SelectServerCert(sslSocket *ss)
rv = ssl_PickSignatureScheme(ss,
cert->serverKeyPair->pubKey,
cert->serverKeyPair->privKey,
- ss->xtnData.sigSchemes,
- ss->xtnData.numSigSchemes,
+ ss->xtnData.clientSigSchemes,
+ ss->xtnData.numClientSigScheme,
PR_FALSE);
if (rv == SECSuccess) {
/* Found one. */
@@ -1489,62 +1208,6 @@ tls13_SelectServerCert(sslSocket *ss)
return SECFailure;
}
-/* Note: |requestedGroup| is non-NULL when we send a key_share extension. */
-static SECStatus
-tls13_MaybeSendHelloRetry(sslSocket *ss, const sslNamedGroupDef *requestedGroup,
- PRBool *hrrSent)
-{
- SSLHelloRetryRequestAction action = ssl_hello_retry_accept;
- PRUint8 token[256] = { 0 };
- unsigned int tokenLen = 0;
- SECStatus rv;
-
- if (ss->hrrCallback) {
- action = ss->hrrCallback(!ss->ssl3.hs.helloRetry,
- ss->xtnData.applicationToken.data,
- ss->xtnData.applicationToken.len,
- token, &tokenLen, sizeof(token),
- ss->hrrCallbackArg);
- }
-
- /* These use SSL3_SendAlert directly to avoid an assertion in
- * tls13_FatalError(), which is ordinarily OK. */
- if (action == ssl_hello_retry_request && ss->ssl3.hs.helloRetry) {
- (void)SSL3_SendAlert(ss, alert_fatal, internal_error);
- PORT_SetError(SSL_ERROR_APP_CALLBACK_ERROR);
- return SECFailure;
- }
-
- if (action != ssl_hello_retry_request && tokenLen) {
- (void)SSL3_SendAlert(ss, alert_fatal, internal_error);
- PORT_SetError(SSL_ERROR_APP_CALLBACK_ERROR);
- return SECFailure;
- }
-
- if (tokenLen > sizeof(token)) {
- (void)SSL3_SendAlert(ss, alert_fatal, internal_error);
- PORT_SetError(SSL_ERROR_APP_CALLBACK_ERROR);
- return SECFailure;
- }
-
- if (action == ssl_hello_retry_fail) {
- FATAL_ERROR(ss, SSL_ERROR_APPLICATION_ABORT, handshake_failure);
- return SECFailure;
- }
-
- if (!requestedGroup && action != ssl_hello_retry_request) {
- return SECSuccess;
- }
-
- rv = tls13_SendHelloRetryRequest(ss, requestedGroup, token, tokenLen);
- if (rv != SECSuccess) {
- return SECFailure; /* Code already set. */
- }
-
- *hrrSent = PR_TRUE;
- return SECSuccess;
-}
-
static SECStatus
tls13_NegotiateAuthentication(sslSocket *ss)
{
@@ -1574,19 +1237,13 @@ tls13_NegotiateAuthentication(sslSocket *ss)
SECStatus
tls13_HandleClientHelloPart2(sslSocket *ss,
const SECItem *suites,
- sslSessionID *sid,
- const PRUint8 *msg,
- unsigned int len)
+ sslSessionID *sid)
{
SECStatus rv;
SSL3Statistics *ssl3stats = SSL_GetStatistics();
- const sslNamedGroupDef *requestedGroup = NULL;
TLS13KeyShareEntry *clientShare = NULL;
- ssl3CipherSuite previousCipherSuite = 0;
- const sslNamedGroupDef *previousGroup = NULL;
- PRBool hrr = PR_FALSE;
-
- ss->ssl3.hs.endOfFlight = PR_TRUE;
+ int j;
+ ssl3CipherSuite previousCipherSuite;
if (ssl3_ExtensionNegotiated(ss, ssl_tls13_early_data_xtn)) {
ss->ssl3.hs.zeroRttState = ssl_0rtt_sent;
@@ -1594,59 +1251,24 @@ tls13_HandleClientHelloPart2(sslSocket *ss,
#ifndef PARANOID
/* Look for a matching cipher suite. */
- if (ssl3_config_match_init(ss) == 0) { /* no ciphers are working/supported by PK11 */
+ j = ssl3_config_match_init(ss);
+ if (j <= 0) { /* no ciphers are working/supported by PK11 */
FATAL_ERROR(ss, PORT_GetError(), internal_error);
goto loser;
}
#endif
- /* Negotiate cipher suite. */
+ previousCipherSuite = ss->ssl3.hs.cipher_suite;
rv = ssl3_NegotiateCipherSuite(ss, suites, PR_FALSE);
if (rv != SECSuccess) {
FATAL_ERROR(ss, SSL_ERROR_NO_CYPHER_OVERLAP, handshake_failure);
goto loser;
}
-
/* If we are going around again, then we should make sure that the cipher
* suite selection doesn't change. That's a sign of client shennanigans. */
- if (ss->ssl3.hs.helloRetry) {
-
- /* Update sequence numbers before checking the cookie so that any alerts
- * we generate are sent with the right sequence numbers. */
- if (IS_DTLS(ss)) {
- /* Count the first ClientHello and the HelloRetryRequest. */
- ss->ssl3.hs.sendMessageSeq = 1;
- ss->ssl3.hs.recvMessageSeq = 1;
- ssl_GetSpecWriteLock(ss);
- /* Increase the write sequence number. The read sequence number
- * will be reset after this to early data or handshake. */
- ss->ssl3.cwSpec->seqNum = 1;
- ssl_ReleaseSpecWriteLock(ss);
- }
-
- if (!ssl3_ExtensionNegotiated(ss, ssl_tls13_cookie_xtn) ||
- !ss->xtnData.cookie.len) {
- FATAL_ERROR(ss, SSL_ERROR_MISSING_COOKIE_EXTENSION,
- missing_extension);
- goto loser;
- }
- PRINT_BUF(50, (ss, "Client sent cookie",
- ss->xtnData.cookie.data, ss->xtnData.cookie.len));
-
- rv = tls13_RecoverHashState(ss, ss->xtnData.cookie.data,
- ss->xtnData.cookie.len,
- &previousCipherSuite,
- &previousGroup);
- if (rv != SECSuccess) {
- FATAL_ERROR(ss, SSL_ERROR_BAD_2ND_CLIENT_HELLO, illegal_parameter);
- goto loser;
- }
- }
-
- /* Now merge the ClientHello into the hash state. */
- rv = ssl_HashHandshakeMessage(ss, ssl_hs_client_hello, msg, len);
- if (rv != SECSuccess) {
- FATAL_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE, internal_error);
+ if (ss->ssl3.hs.helloRetry &&
+ ss->ssl3.hs.cipher_suite != previousCipherSuite) {
+ FATAL_ERROR(ss, SSL_ERROR_RX_MALFORMED_CLIENT_HELLO, handshake_failure);
goto loser;
}
@@ -1674,50 +1296,13 @@ tls13_HandleClientHelloPart2(sslSocket *ss,
}
/* Select key exchange. */
- rv = tls13_NegotiateKeyExchange(ss, &requestedGroup, &clientShare);
+ rv = tls13_NegotiateKeyExchange(ss, &clientShare);
if (rv != SECSuccess) {
goto loser;
}
- /* We should get either one of these, but not both. */
- PORT_Assert((requestedGroup && !clientShare) ||
- (!requestedGroup && clientShare));
- /* After HelloRetryRequest, check consistency of cipher and group. */
- if (ss->ssl3.hs.helloRetry) {
- PORT_Assert(previousCipherSuite);
- if (ss->ssl3.hs.cipher_suite != previousCipherSuite) {
- FATAL_ERROR(ss, SSL_ERROR_BAD_2ND_CLIENT_HELLO,
- illegal_parameter);
- goto loser;
- }
- if (!clientShare) {
- FATAL_ERROR(ss, SSL_ERROR_BAD_2ND_CLIENT_HELLO,
- illegal_parameter);
- goto loser;
- }
-
- /* If we requested a new key share, check that the client provided just
- * one of the right type. */
- if (previousGroup) {
- if (PR_PREV_LINK(&ss->xtnData.remoteKeyShares) !=
- PR_NEXT_LINK(&ss->xtnData.remoteKeyShares)) {
- FATAL_ERROR(ss, SSL_ERROR_BAD_2ND_CLIENT_HELLO,
- illegal_parameter);
- goto loser;
- }
- if (clientShare->group != previousGroup) {
- FATAL_ERROR(ss, SSL_ERROR_BAD_2ND_CLIENT_HELLO,
- illegal_parameter);
- goto loser;
- }
- }
- }
-
- rv = tls13_MaybeSendHelloRetry(ss, requestedGroup, &hrr);
- if (rv != SECSuccess) {
- goto loser;
- }
- if (hrr) {
+ /* If we didn't find a client key share, we have to retry. */
+ if (!clientShare) {
if (sid) { /* Free the sid. */
ss->sec.uncache(sid);
ssl_FreeSID(sid);
@@ -1788,17 +1373,14 @@ tls13_HandleClientHelloPart2(sslSocket *ss,
if (ss->statelessResume) {
SSL3Hashes hashes;
- PORT_Assert(ss->ssl3.hs.messages.len > ss->xtnData.pskBindersLen);
- rv = tls13_ComputePskBinderHash(
- ss,
- ss->ssl3.hs.messages.len - ss->xtnData.pskBindersLen,
- &hashes);
+ rv = tls13_ComputePskBinderHash(ss, ss->xtnData.pskBinderPrefixLen,
+ &hashes);
if (rv != SECSuccess) {
FATAL_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE, internal_error);
goto loser;
}
- rv = tls13_VerifyFinished(ss, ssl_hs_client_hello,
+ rv = tls13_VerifyFinished(ss, client_hello,
ss->ssl3.hs.pskBinderKey,
ss->xtnData.pskBinder.data,
ss->xtnData.pskBinder.len,
@@ -1847,7 +1429,11 @@ tls13_HandleClientHelloPart2(sslSocket *ss,
sid = NULL;
if (ss->ssl3.hs.zeroRttState == ssl_0rtt_accepted) {
- rv = tls13_DeriveEarlySecrets(ss);
+ rv = tls13_DeriveSecret(ss, ss->ssl3.hs.currentSecret,
+ kHkdfLabelClient,
+ kHkdfLabelEarlyTrafficSecret,
+ NULL, /* Current running hash. */
+ &ss->ssl3.hs.clientEarlyTrafficSecret);
if (rv != SECSuccess) {
FATAL_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE, internal_error);
return SECFailure;
@@ -1872,143 +1458,70 @@ loser:
return SECFailure;
}
-SECStatus
-SSLExp_HelloRetryRequestCallback(PRFileDesc *fd,
- SSLHelloRetryRequestCallback cb, void *arg)
+static SECStatus
+tls13_SendHelloRetryRequest(sslSocket *ss, const sslNamedGroupDef *selectedGroup)
{
- sslSocket *ss = ssl_FindSocket(fd);
- if (!ss) {
- return SECFailure; /* Code already set. */
- }
+ SECStatus rv;
- ss->hrrCallback = cb;
- ss->hrrCallbackArg = arg;
- return SECSuccess;
-}
+ SSL_TRC(3, ("%d: TLS13[%d]: send hello retry request handshake",
+ SSL_GETPID(), ss->fd));
-/*
- * struct {
- * ProtocolVersion server_version;
- * CipherSuite cipher_suite;
- * Extension extensions<2..2^16-1>;
- * } HelloRetryRequest;
- *
- * Note: this function takes an empty buffer and returns
- * a non-empty one on success, in which case the caller must
- * eventually clean up.
- */
-SECStatus
-tls13_ConstructHelloRetryRequest(sslSocket *ss,
- ssl3CipherSuite cipherSuite,
- const sslNamedGroupDef *selectedGroup,
- PRUint8 *cookie, unsigned int cookieLen,
- sslBuffer *buffer)
-{
- SECStatus rv;
- sslBuffer extensionsBuf = SSL_BUFFER_EMPTY;
- PORT_Assert(buffer->len == 0);
-
- /* Note: cookie is pointing to a stack variable, so is only valid
- * now. */
- ss->xtnData.selectedGroup = selectedGroup;
- ss->xtnData.cookie.data = cookie;
- ss->xtnData.cookie.len = cookieLen;
- rv = ssl_ConstructExtensions(ss, &extensionsBuf,
- ssl_hs_hello_retry_request);
+ PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
+
+ /* We asked already, but made no progress. */
+ if (ss->ssl3.hs.helloRetry) {
+ FATAL_ERROR(ss, SSL_ERROR_BAD_2ND_CLIENT_HELLO, illegal_parameter);
+ return SECFailure;
+ }
+
+ ssl_GetXmitBufLock(ss);
+ rv = ssl3_AppendHandshakeHeader(ss, hello_retry_request,
+ 2 + /* version */
+ 2 + /* extension length */
+ 2 + /* group extension id */
+ 2 + /* group extension length */
+ 2 /* group */);
if (rv != SECSuccess) {
+ FATAL_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE, internal_error);
goto loser;
}
- /* These extensions can't be empty. */
- PORT_Assert(SSL_BUFFER_LEN(&extensionsBuf) > 0);
- /* Clean up cookie so we're not pointing at random memory. */
- ss->xtnData.cookie.data = NULL;
- ss->xtnData.cookie.len = 0;
-
- rv = ssl_ConstructServerHello(ss, PR_TRUE, &extensionsBuf, buffer);
+ rv = ssl3_AppendHandshakeNumber(
+ ss, tls13_EncodeDraftVersion(ss->version), 2);
if (rv != SECSuccess) {
+ FATAL_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE, internal_error);
goto loser;
}
- sslBuffer_Clear(&extensionsBuf);
- return SECSuccess;
-
-loser:
- sslBuffer_Clear(&extensionsBuf);
- sslBuffer_Clear(buffer);
- return SECFailure;
-}
-
-static SECStatus
-tls13_SendHelloRetryRequest(sslSocket *ss,
- const sslNamedGroupDef *requestedGroup,
- const PRUint8 *appToken, unsigned int appTokenLen)
-{
- SECStatus rv;
- unsigned int cookieLen;
- PRUint8 cookie[1024];
- sslBuffer messageBuf = SSL_BUFFER_EMPTY;
- SSL_TRC(3, ("%d: TLS13[%d]: send hello retry request handshake",
- SSL_GETPID(), ss->fd));
-
- PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
-
- /* Compute the cookie we are going to need. */
- rv = tls13_MakeHrrCookie(ss, requestedGroup,
- appToken, appTokenLen,
- cookie, &cookieLen, sizeof(cookie));
+ /* Length of extensions. */
+ rv = ssl3_AppendHandshakeNumber(ss, 2 + 2 + 2, 2);
if (rv != SECSuccess) {
FATAL_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE, internal_error);
- return SECFailure;
+ goto loser;
}
- /* Now build the body of the message. */
- rv = tls13_ConstructHelloRetryRequest(ss, ss->ssl3.hs.cipher_suite,
- requestedGroup,
- cookie, cookieLen, &messageBuf);
+ /* Key share extension - currently the only reason we send this. */
+ rv = ssl3_AppendHandshakeNumber(ss, ssl_tls13_key_share_xtn, 2);
if (rv != SECSuccess) {
FATAL_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE, internal_error);
- return SECFailure;
+ goto loser;
}
-
- /* And send it. */
- ssl_GetXmitBufLock(ss);
- rv = ssl3_AppendHandshakeHeader(ss, ssl_hs_server_hello,
- SSL_BUFFER_LEN(&messageBuf));
+ /* Key share extension length. */
+ rv = ssl3_AppendHandshakeNumber(ss, 2, 2);
if (rv != SECSuccess) {
+ FATAL_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE, internal_error);
goto loser;
}
- rv = ssl3_AppendBufferToHandshake(ss, &messageBuf);
+ rv = ssl3_AppendHandshakeNumber(ss, selectedGroup->name, 2);
if (rv != SECSuccess) {
+ FATAL_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE, internal_error);
goto loser;
}
- sslBuffer_Clear(&messageBuf); /* Done with messageBuf */
-
- if (ss->ssl3.hs.fakeSid.len) {
- PRInt32 sent;
- PORT_Assert(!IS_DTLS(ss));
- rv = ssl3_SendChangeCipherSpecsInt(ss);
- if (rv != SECSuccess) {
- goto loser;
- }
- /* ssl3_SendChangeCipherSpecsInt() only flushes to the output buffer, so we
- * have to force a send. */
- sent = ssl_SendSavedWriteData(ss);
- if (sent < 0 && PORT_GetError() != PR_WOULD_BLOCK_ERROR) {
- PORT_SetError(SSL_ERROR_SOCKET_WRITE_FAILURE);
- goto loser;
- }
- } else {
- rv = ssl3_FlushHandshake(ss, 0);
- if (rv != SECSuccess) {
- goto loser; /* error code set by ssl3_FlushHandshake */
- }
+ rv = ssl3_FlushHandshake(ss, 0);
+ if (rv != SECSuccess) {
+ goto loser; /* error code set by ssl3_FlushHandshake */
}
-
- /* We depend on this being exactly one record and one message. */
- PORT_Assert(!IS_DTLS(ss) || (ss->ssl3.hs.sendMessageSeq == 1 &&
- ss->ssl3.cwSpec->seqNum == 1));
ssl_ReleaseXmitBufLock(ss);
ss->ssl3.hs.helloRetry = PR_TRUE;
@@ -2022,7 +1535,6 @@ tls13_SendHelloRetryRequest(sslSocket *ss,
return SECSuccess;
loser:
- sslBuffer_Clear(&messageBuf);
ssl_ReleaseXmitBufLock(ss);
return SECFailure;
}
@@ -2094,96 +1606,67 @@ static SECStatus
tls13_SendCertificateRequest(sslSocket *ss)
{
SECStatus rv;
- sslBuffer extensionBuf = SSL_BUFFER_EMPTY;
+ unsigned int calen;
+ SECItem *names;
+ unsigned int nnames;
+ SECItem *name;
+ int i;
+ PRUint8 sigSchemes[MAX_SIGNATURE_SCHEMES * 2];
+ unsigned int sigSchemesLength = 0;
+ int length;
SSL_TRC(3, ("%d: TLS13[%d]: begin send certificate_request",
SSL_GETPID(), ss->fd));
- rv = ssl_ConstructExtensions(ss, &extensionBuf, ssl_hs_certificate_request);
+ rv = ssl3_EncodeSigAlgs(ss, sigSchemes, sizeof(sigSchemes),
+ &sigSchemesLength);
if (rv != SECSuccess) {
- return SECFailure; /* Code already set. */
+ return rv;
}
- /* We should always have at least one of these. */
- PORT_Assert(SSL_BUFFER_LEN(&extensionBuf) > 0);
- rv = ssl3_AppendHandshakeHeader(ss, ssl_hs_certificate_request,
- 1 + 0 + /* empty request context */
- 2 + /* extension length */
- SSL_BUFFER_LEN(&extensionBuf));
+ rv = ssl_GetCertificateRequestCAs(ss, &calen, &names, &nnames);
if (rv != SECSuccess) {
- goto loser; /* err set by AppendHandshake. */
+ return rv;
}
+ length = 1 + 0 /* length byte for empty request context */ +
+ 2 + sigSchemesLength + 2 + calen + 2;
- /* Context. */
+ rv = ssl3_AppendHandshakeHeader(ss, certificate_request, length);
+ if (rv != SECSuccess) {
+ return rv; /* err set by AppendHandshake. */
+ }
rv = ssl3_AppendHandshakeNumber(ss, 0, 1);
if (rv != SECSuccess) {
- goto loser; /* err set by AppendHandshake. */
+ return rv; /* err set by AppendHandshake. */
}
- /* Extensions. */
- rv = ssl3_AppendBufferToHandshakeVariable(ss, &extensionBuf, 2);
+ rv = ssl3_AppendHandshakeVariable(ss, sigSchemes, sigSchemesLength, 2);
if (rv != SECSuccess) {
- goto loser; /* err set by AppendHandshake. */
+ return rv; /* err set by AppendHandshake. */
}
-
- sslBuffer_Clear(&extensionBuf);
- return SECSuccess;
-
-loser:
- sslBuffer_Clear(&extensionBuf);
- return SECFailure;
-}
-
-/* [draft-ietf-tls-tls13; S 4.4.1] says:
- *
- * Transcript-Hash(ClientHello1, HelloRetryRequest, ... MN) =
- * Hash(message_hash || // Handshake type
- * 00 00 Hash.length || // Handshake message length
- * Hash(ClientHello1) || // Hash of ClientHello1
- * HelloRetryRequest ... MN)
- */
-static SECStatus
-tls13_ReinjectHandshakeTranscript(sslSocket *ss)
-{
- SSL3Hashes hashes;
- SECStatus rv;
-
- // First compute the hash.
- rv = tls13_ComputeHash(ss, &hashes,
- ss->ssl3.hs.messages.buf,
- ss->ssl3.hs.messages.len);
+ rv = ssl3_AppendHandshakeNumber(ss, calen, 2);
if (rv != SECSuccess) {
- return SECFailure;
+ return rv; /* err set by AppendHandshake. */
}
-
- // Now re-init the handshake.
- ssl3_RestartHandshakeHashes(ss);
-
- // And reinject the message.
- rv = ssl_HashHandshakeMessage(ss, ssl_hs_message_hash,
- hashes.u.raw, hashes.len);
+ for (i = 0, name = names; i < nnames; i++, name++) {
+ rv = ssl3_AppendHandshakeVariable(ss, name->data, name->len, 2);
+ if (rv != SECSuccess) {
+ return rv; /* err set by AppendHandshake. */
+ }
+ }
+ rv = ssl3_AppendHandshakeNumber(ss, 0, 2);
if (rv != SECSuccess) {
- return SECFailure;
+ return rv; /* err set by AppendHandshake. */
}
return SECSuccess;
}
-static unsigned int
-ssl_ListCount(PRCList *list)
-{
- unsigned int c = 0;
- PRCList *cur;
- for (cur = PR_NEXT_LINK(list); cur != list; cur = PR_NEXT_LINK(cur)) {
- ++c;
- }
- return c;
-}
-
SECStatus
-tls13_HandleHelloRetryRequest(sslSocket *ss, const PRUint8 *savedMsg,
- PRUint32 savedLength)
+tls13_HandleHelloRetryRequest(sslSocket *ss, PRUint8 *b, PRUint32 length)
{
SECStatus rv;
+ PRUint32 tmp;
+ SSL3ProtocolVersion version;
SSL_TRC(3, ("%d: TLS13[%d]: handle hello retry request",
SSL_GETPID(), ss->fd));
@@ -2196,77 +1679,84 @@ tls13_HandleHelloRetryRequest(sslSocket *ss, const PRUint8 *savedMsg,
unexpected_message);
return SECFailure;
}
- PORT_Assert(ss->ssl3.hs.ws == wait_server_hello);
+
+ /* Client only. */
+ rv = TLS13_CHECK_HS_STATE(ss, SSL_ERROR_RX_UNEXPECTED_HELLO_RETRY_REQUEST,
+ wait_server_hello);
+ if (rv != SECSuccess) {
+ return SECFailure;
+ }
+
+ /* Fool me once, shame on you; fool me twice... */
+ if (ss->ssl3.hs.helloRetry) {
+ FATAL_ERROR(ss, SSL_ERROR_RX_UNEXPECTED_HELLO_RETRY_REQUEST,
+ unexpected_message);
+ return SECFailure;
+ }
if (ss->ssl3.hs.zeroRttState == ssl_0rtt_sent) {
ss->ssl3.hs.zeroRttState = ssl_0rtt_ignored;
/* Restore the null cipher spec for writing. */
ssl_GetSpecWriteLock(ss);
- ssl_CipherSpecRelease(ss->ssl3.cwSpec);
- ss->ssl3.cwSpec = ssl_FindCipherSpecByEpoch(ss, CipherSpecWrite,
- TrafficKeyClearText);
- PORT_Assert(ss->ssl3.cwSpec);
+ tls13_CipherSpecRelease(ss->ssl3.cwSpec);
+ ss->ssl3.cwSpec = ss->ssl3.crSpec;
+ PORT_Assert(ss->ssl3.cwSpec->cipher_def->cipher == cipher_null);
ssl_ReleaseSpecWriteLock(ss);
} else {
PORT_Assert(ss->ssl3.hs.zeroRttState == ssl_0rtt_none);
}
- /* Extensions must contain more than just supported_versions. This will
- * ensure that a HelloRetryRequest isn't a no-op: we must have at least two
- * extensions, supported_versions plus one other. That other must be one
- * that we understand and recognize as being valid for HelloRetryRequest,
- * and all the extensions we permit cause us to modify our second
- * ClientHello in some meaningful way. */
- if (ssl_ListCount(&ss->ssl3.hs.remoteExtensions) <= 1) {
+ /* Version. */
+ rv = ssl_ClientReadVersion(ss, &b, &length, &version);
+ if (rv != SECSuccess) {
+ return SECFailure; /* alert already sent */
+ }
+ if (version > ss->vrange.max || version < SSL_LIBRARY_VERSION_TLS_1_3) {
FATAL_ERROR(ss, SSL_ERROR_RX_MALFORMED_HELLO_RETRY_REQUEST,
- decode_error);
+ protocol_version);
return SECFailure;
}
- rv = ssl3_HandleParsedExtensions(ss, ssl_hs_hello_retry_request);
- ssl3_DestroyRemoteExtensions(&ss->ssl3.hs.remoteExtensions);
+ /* Extensions. */
+ rv = ssl3_ConsumeHandshakeNumber(ss, &tmp, 2, &b, &length);
if (rv != SECSuccess) {
- return SECFailure; /* Error code set below */
+ return SECFailure; /* error code already set */
}
-
- ss->ssl3.hs.helloRetry = PR_TRUE;
- rv = tls13_ReinjectHandshakeTranscript(ss);
- if (rv != SECSuccess) {
- return rv;
+ /* Extensions must be non-empty and use the remainder of the message.
+ * This means that a HelloRetryRequest cannot be a no-op: we must have an
+ * extension, it must be one that we understand and recognize as being valid
+ * for HelloRetryRequest, and all the extensions we permit cause us to
+ * modify our ClientHello in some way. */
+ if (!tmp || tmp != length) {
+ FATAL_ERROR(ss, SSL_ERROR_RX_MALFORMED_HELLO_RETRY_REQUEST,
+ decode_error);
+ return SECFailure;
}
- rv = ssl_HashHandshakeMessage(ss, ssl_hs_server_hello,
- savedMsg, savedLength);
+ rv = ssl3_HandleExtensions(ss, &b, &length, hello_retry_request);
if (rv != SECSuccess) {
- return SECFailure;
+ return SECFailure; /* Error code set below */
}
+ ss->ssl3.hs.helloRetry = PR_TRUE;
+
ssl_GetXmitBufLock(ss);
- if (ss->opt.enableTls13CompatMode && !IS_DTLS(ss) &&
- ss->ssl3.hs.zeroRttState == ssl_0rtt_none) {
- rv = ssl3_SendChangeCipherSpecsInt(ss);
- if (rv != SECSuccess) {
- goto loser;
- }
- }
rv = ssl3_SendClientHello(ss, client_hello_retry);
+ ssl_ReleaseXmitBufLock(ss);
if (rv != SECSuccess) {
- goto loser;
+ return SECFailure;
}
- ssl_ReleaseXmitBufLock(ss);
return SECSuccess;
-
-loser:
- ssl_ReleaseXmitBufLock(ss);
- return SECFailure;
}
static SECStatus
tls13_HandleCertificateRequest(sslSocket *ss, PRUint8 *b, PRUint32 length)
{
SECStatus rv;
+ TLS13CertificateRequest *certRequest = NULL;
SECItem context = { siBuffer, NULL, 0 };
+ PLArenaPool *arena;
SECItem extensionsData = { siBuffer, NULL, 0 };
SSL_TRC(3, ("%d: TLS13[%d]: handle certificate_request sequence",
@@ -2285,51 +1775,71 @@ tls13_HandleCertificateRequest(sslSocket *ss, PRUint8 *b, PRUint32 length)
PORT_Assert(ss->ssl3.clientCertChain == NULL);
PORT_Assert(ss->ssl3.clientCertificate == NULL);
PORT_Assert(ss->ssl3.clientPrivateKey == NULL);
- PORT_Assert(!ss->ssl3.hs.clientCertRequested);
+ PORT_Assert(ss->ssl3.hs.certificateRequest == NULL);
- rv = ssl3_ConsumeHandshakeVariable(ss, &context, 1, &b, &length);
- if (rv != SECSuccess) {
+ arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
+ if (!arena) {
+ FATAL_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE, internal_error);
return SECFailure;
}
+ rv = ssl3_ConsumeHandshakeVariable(ss, &context, 1, &b, &length);
+ if (rv != SECSuccess)
+ goto loser;
+
/* We don't support post-handshake client auth, the certificate request
- * context must always be empty. */
+ * context must always be null. */
if (context.len > 0) {
FATAL_ERROR(ss, SSL_ERROR_RX_MALFORMED_CERT_REQUEST, illegal_parameter);
- return SECFailure;
+ goto loser;
}
- rv = ssl3_ConsumeHandshakeVariable(ss, &extensionsData, 2, &b, &length);
- if (rv != SECSuccess) {
- return SECFailure;
+ certRequest = PORT_ArenaZNew(arena, TLS13CertificateRequest);
+ if (!certRequest)
+ goto loser;
+ certRequest->arena = arena;
+ certRequest->ca_list.arena = arena;
+
+ rv = ssl_ParseSignatureSchemes(ss, arena,
+ &certRequest->signatureSchemes,
+ &certRequest->signatureSchemeCount,
+ &b, &length);
+ if (rv != SECSuccess || certRequest->signatureSchemeCount == 0) {
+ FATAL_ERROR(ss, SSL_ERROR_RX_MALFORMED_CERT_REQUEST,
+ decode_error);
+ goto loser;
}
- if (length) {
- FATAL_ERROR(ss, SSL_ERROR_RX_MALFORMED_CERT_REQUEST, decode_error);
- return SECFailure;
- }
+ rv = ssl3_ParseCertificateRequestCAs(ss, &b, &length, arena,
+ &certRequest->ca_list);
+ if (rv != SECSuccess)
+ goto loser; /* alert already sent */
- /* Process all the extensions. */
- rv = ssl3_HandleExtensions(ss, &extensionsData.data, &extensionsData.len,
- ssl_hs_certificate_request);
+ /* Verify that the extensions are sane. */
+ rv = ssl3_ConsumeHandshakeVariable(ss, &extensionsData, 2, &b, &length);
if (rv != SECSuccess) {
- return SECFailure;
- }
-
- if (!ss->xtnData.numSigSchemes) {
- FATAL_ERROR(ss, SSL_ERROR_MISSING_SIGNATURE_ALGORITHMS_EXTENSION,
- missing_extension);
- return SECFailure;
+ goto loser;
}
- rv = SECITEM_CopyItem(NULL, &ss->xtnData.certReqContext, &context);
+ /* Process all the extensions (note: currently a no-op). */
+ rv = ssl3_HandleExtensions(ss, &extensionsData.data, &extensionsData.len,
+ certificate_request);
if (rv != SECSuccess) {
- return SECFailure;
+ goto loser;
}
- ss->ssl3.hs.clientCertRequested = PR_TRUE;
+ rv = SECITEM_CopyItem(arena, &certRequest->context, &context);
+ if (rv != SECSuccess)
+ goto loser;
+
TLS13_SET_HS_STATE(ss, wait_server_cert);
+ ss->ssl3.hs.certificateRequest = certRequest;
+
return SECSuccess;
+
+loser:
+ PORT_FreeArena(arena, PR_FALSE);
+ return SECFailure;
}
static SECStatus
@@ -2349,10 +1859,12 @@ tls13_SendEncryptedServerSequence(sslSocket *ss)
return SECFailure;
}
+ ss->ssl3.hs.shortHeaders = ssl3_ExtensionNegotiated(
+ ss, ssl_tls13_short_header_xtn);
+
if (ss->ssl3.hs.zeroRttState == ssl_0rtt_accepted) {
- rv = ssl3_RegisterExtensionSender(ss, &ss->xtnData,
- ssl_tls13_early_data_xtn,
- ssl_SendEmptyExtension);
+ rv = ssl3_RegisterExtensionSender(ss, &ss->xtnData, ssl_tls13_early_data_xtn,
+ tls13_ServerSendEarlyDataXtn);
if (rv != SECSuccess) {
return SECFailure; /* Error code set already. */
}
@@ -2405,29 +1917,11 @@ tls13_SendServerHelloSequence(sslSocket *ss)
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
PORT_Assert(ss->opt.noLocks || ssl_HaveXmitBufLock(ss));
- rv = ssl3_RegisterExtensionSender(ss, &ss->xtnData,
- ssl_tls13_supported_versions_xtn,
- tls13_ServerSendSupportedVersionsXtn);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
rv = ssl3_SendServerHello(ss);
if (rv != SECSuccess) {
return rv; /* err code is set. */
}
- if (ss->ssl3.hs.fakeSid.len) {
- PORT_Assert(!IS_DTLS(ss));
- SECITEM_FreeItem(&ss->ssl3.hs.fakeSid, PR_FALSE);
- if (!ss->ssl3.hs.helloRetry) {
- rv = ssl3_SendChangeCipherSpecsInt(ss);
- if (rv != SECSuccess) {
- return rv;
- }
- }
- }
-
rv = tls13_SendEncryptedServerSequence(ss);
if (rv != SECSuccess) {
err = PORT_GetError();
@@ -2459,18 +1953,14 @@ tls13_SendServerHelloSequence(sslSocket *ss)
return SECFailure;
}
- if (IS_DTLS(ss)) {
- /* We need this for reading ACKs. */
- ssl_CipherSpecAddRef(ss->ssl3.crSpec);
- }
if (ss->ssl3.hs.zeroRttState == ssl_0rtt_accepted) {
- rv = tls13_SetCipherSpec(ss, TrafficKeyEarlyApplicationData,
+ rv = tls13_SetCipherSpec(ss,
+ TrafficKeyEarlyApplicationData,
CipherSpecRead, PR_TRUE);
if (rv != SECSuccess) {
LOG_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE);
return SECFailure;
}
- TLS13_SET_HS_STATE(ss, wait_end_of_early_data);
} else {
PORT_Assert(ss->ssl3.hs.zeroRttState == ssl_0rtt_none ||
ss->ssl3.hs.zeroRttState == ssl_0rtt_ignored);
@@ -2482,12 +1972,11 @@ tls13_SendServerHelloSequence(sslSocket *ss)
LOG_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE);
return SECFailure;
}
- TLS13_SET_HS_STATE(ss,
- ss->opt.requestCertificate ? wait_client_cert
- : wait_finished);
}
- ss->ssl3.hs.serverHelloTime = ssl_TimeUsec();
+ TLS13_SET_HS_STATE(ss,
+ ss->opt.requestCertificate ? wait_client_cert
+ : wait_finished);
return SECSuccess;
}
@@ -2534,7 +2023,7 @@ tls13_HandleServerHelloPart2(sslSocket *ss)
SSL_AtomicIncrementLong(&ssl3stats->hsh_sid_stateless_resumes);
} else {
/* !PSK */
- if (ssl3_ExtensionAdvertised(ss, ssl_tls13_pre_shared_key_xtn)) {
+ if (ssl3_ClientExtensionAdvertised(ss, ssl_tls13_pre_shared_key_xtn)) {
SSL_AtomicIncrementLong(&ssl3stats->hsh_sid_cache_misses);
}
if (sid->cached == in_client_cache) {
@@ -2579,12 +2068,8 @@ tls13_HandleServerHelloPart2(sslSocket *ss)
return SECFailure; /* error code is set. */
}
- if (ss->ssl3.hs.zeroRttState == ssl_0rtt_sent) {
- /* When we send 0-RTT, we saved the null spec in case we needed it to
- * send another ClientHello in response to a HelloRetryRequest. Now
- * that we won't be receiving a HelloRetryRequest, release the spec. */
- ssl_CipherSpecReleaseByEpoch(ss, CipherSpecWrite, TrafficKeyClearText);
- }
+ ss->ssl3.hs.shortHeaders = ssl3_ExtensionNegotiated(
+ ss, ssl_tls13_short_header_xtn);
rv = tls13_SetCipherSpec(ss, TrafficKeyHandshake,
CipherSpecRead, PR_FALSE);
@@ -2686,7 +2171,8 @@ tls13_SendCertificate(sslSocket *ss)
int certChainLen = 0;
int i;
SECItem context = { siBuffer, NULL, 0 };
- sslBuffer extensionBuf = SSL_BUFFER_EMPTY;
+ PRInt32 extensionsLen = 0;
+ PRUint32 maxBytes = 65535;
SSL_TRC(3, ("%d: TLS1.3[%d]: send certificate handshake",
SSL_GETPID(), ss->fd));
@@ -2709,28 +2195,26 @@ tls13_SendCertificate(sslSocket *ss)
ss->sec.localCert = CERT_DupCertificate(ss->ssl3.clientCertificate);
}
+ /* Get the extensions length. This only applies to the leaf cert,
+ * because we don't yet send extensions for non-leaf certs. */
+ extensionsLen = ssl3_CallHelloExtensionSenders(
+ ss, PR_FALSE, maxBytes, &ss->xtnData.certificateSenders[0]);
+
if (!ss->sec.isServer) {
- PORT_Assert(ss->ssl3.hs.clientCertRequested);
- context = ss->xtnData.certReqContext;
+ PORT_Assert(ss->ssl3.hs.certificateRequest);
+ context = ss->ssl3.hs.certificateRequest->context;
}
if (certChain) {
for (i = 0; i < certChain->len; i++) {
- /* Each cert is 3 octet length, cert, and extensions */
- certChainLen += 3 + certChain->certs[i].len + 2;
- }
-
- /* Build the extensions. This only applies to the leaf cert, because we
- * don't yet send extensions for non-leaf certs. */
- rv = ssl_ConstructExtensions(ss, &extensionBuf, ssl_hs_certificate);
- if (rv != SECSuccess) {
- return SECFailure; /* code already set */
+ certChainLen +=
+ 3 + certChain->certs[i].len + /* cert length + cert */
+ 2 + (!i ? extensionsLen : 0); /* extensions length + extensions */
}
- /* extensionBuf.len is only added once, for the leaf cert. */
- certChainLen += SSL_BUFFER_LEN(&extensionBuf);
}
- rv = ssl3_AppendHandshakeHeader(ss, ssl_hs_certificate,
- 1 + context.len + 3 + certChainLen);
+ rv = ssl3_AppendHandshakeHeader(ss, certificate,
+ 1 + context.len +
+ 3 + certChainLen);
if (rv != SECSuccess) {
return SECFailure; /* err set by AppendHandshake. */
}
@@ -2738,44 +2222,50 @@ tls13_SendCertificate(sslSocket *ss)
rv = ssl3_AppendHandshakeVariable(ss, context.data,
context.len, 1);
if (rv != SECSuccess) {
- goto loser; /* err set by AppendHandshake. */
+ return SECFailure; /* err set by AppendHandshake. */
}
rv = ssl3_AppendHandshakeNumber(ss, certChainLen, 3);
if (rv != SECSuccess) {
- goto loser; /* err set by AppendHandshake. */
+ return SECFailure; /* err set by AppendHandshake. */
}
if (certChain) {
for (i = 0; i < certChain->len; i++) {
+ PRInt32 sentLen;
+
rv = ssl3_AppendHandshakeVariable(ss, certChain->certs[i].data,
certChain->certs[i].len, 3);
if (rv != SECSuccess) {
- goto loser; /* err set by AppendHandshake. */
+ return SECFailure; /* err set by AppendHandshake. */
}
if (i) {
/* Not end-entity. */
rv = ssl3_AppendHandshakeNumber(ss, 0, 2);
if (rv != SECSuccess) {
- goto loser; /* err set by AppendHandshake. */
+ return SECFailure; /* err set by AppendHandshake. */
}
continue;
}
/* End-entity, send extensions. */
- rv = ssl3_AppendBufferToHandshakeVariable(ss, &extensionBuf, 2);
+ rv = ssl3_AppendHandshakeNumber(ss, extensionsLen, 2);
if (rv != SECSuccess) {
- goto loser; /* err set by AppendHandshake. */
+ return SECFailure; /* err set by AppendHandshake. */
+ }
+
+ sentLen = ssl3_CallHelloExtensionSenders(
+ ss, PR_TRUE, extensionsLen,
+ &ss->xtnData.certificateSenders[0]);
+ PORT_Assert(sentLen == extensionsLen);
+ if (sentLen != extensionsLen) {
+ LOG_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE);
+ return SECFailure;
}
}
}
- sslBuffer_Clear(&extensionBuf);
return SECSuccess;
-
-loser:
- sslBuffer_Clear(&extensionBuf);
- return SECFailure;
}
static SECStatus
@@ -2803,7 +2293,7 @@ tls13_HandleCertificateEntry(sslSocket *ss, SECItem *data, PRBool first,
if (first && !ss->sec.isServer) {
rv = ssl3_HandleExtensions(ss, &extensionsData.data,
&extensionsData.len,
- ssl_hs_certificate);
+ certificate);
if (rv != SECSuccess) {
return SECFailure;
}
@@ -2861,11 +2351,6 @@ tls13_HandleCertificate(sslSocket *ss, PRUint8 *b, PRUint32 length)
if (rv != SECSuccess)
return SECFailure;
- /* We can ignore any other cleartext from the client. */
- if (ss->sec.isServer && IS_DTLS(ss)) {
- ssl_CipherSpecReleaseByEpoch(ss, CipherSpecRead, TrafficKeyClearText);
- dtls_ReceivedFirstMessageInFlight(ss);
- }
/* Process the context string */
rv = ssl3_ConsumeHandshakeVariable(ss, &context, 1, &b, &length);
if (rv != SECSuccess)
@@ -2960,6 +2445,32 @@ tls13_HandleCertificate(sslSocket *ss, PRUint8 *b, PRUint32 length)
return ssl3_AuthCertificate(ss); /* sets ss->ssl3.hs.ws */
}
+void
+tls13_CipherSpecAddRef(ssl3CipherSpec *spec)
+{
+ ++spec->refCt;
+ SSL_TRC(10, ("%d: TLS13[-]: Increment ref ct for spec %d. new ct = %d",
+ SSL_GETPID(), spec, spec->refCt));
+}
+
+/* This function is never called on a spec which is on the
+ * cipherSpecs list. */
+void
+tls13_CipherSpecRelease(ssl3CipherSpec *spec)
+{
+ PORT_Assert(spec->refCt > 0);
+ --spec->refCt;
+ SSL_TRC(10, ("%d: TLS13[-]: decrement refct for spec %d. phase=%s new ct = %d",
+ SSL_GETPID(), spec, spec->phase, spec->refCt));
+ if (!spec->refCt) {
+ SSL_TRC(10, ("%d: TLS13[-]: Freeing spec %d. phase=%s",
+ SSL_GETPID(), spec, spec->phase));
+ PR_REMOVE_LINK(&spec->link);
+ ssl3_DestroyCipherSpec(spec, PR_TRUE);
+ PORT_Free(spec);
+ }
+}
+
/* Add context to the hash functions as described in
[draft-ietf-tls-tls13; Section 4.9.1] */
SECStatus
@@ -3028,56 +2539,15 @@ loser:
* HKDF-Expand-Label(Secret, Label,
* Hash(Messages) + Hash(resumption_context), L))
*/
-SECStatus
+static SECStatus
tls13_DeriveSecret(sslSocket *ss, PK11SymKey *key,
- const char *label,
- unsigned int labelLen,
+ const char *prefix,
+ const char *suffix,
const SSL3Hashes *hashes,
PK11SymKey **dest)
{
SECStatus rv;
-
- rv = tls13_HkdfExpandLabel(key, tls13_GetHash(ss),
- hashes->u.raw, hashes->len,
- label, labelLen,
- tls13_GetHkdfMechanism(ss),
- tls13_GetHashSize(ss), dest);
- if (rv != SECSuccess) {
- LOG_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
- }
- return SECSuccess;
-}
-
-/* Convenience wrapper for the empty hash. */
-SECStatus
-tls13_DeriveSecretNullHash(sslSocket *ss, PK11SymKey *key,
- const char *label,
- unsigned int labelLen,
- PK11SymKey **dest)
-{
- SSL3Hashes hashes;
- SECStatus rv;
- PRUint8 buf[] = { 0 };
-
- rv = tls13_ComputeHash(ss, &hashes, buf, 0);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- return tls13_DeriveSecret(ss, key, label, labelLen, &hashes, dest);
-}
-
-/* Convenience wrapper that lets us supply a separate prefix and suffix. */
-static SECStatus
-tls13_DeriveSecretWrap(sslSocket *ss, PK11SymKey *key,
- const char *prefix,
- const char *suffix,
- const char *keylogLabel,
- PK11SymKey **dest)
-{
- SECStatus rv;
- SSL3Hashes hashes;
+ SSL3Hashes hashesTmp;
char buf[100];
const char *label;
@@ -3096,22 +2566,25 @@ tls13_DeriveSecretWrap(sslSocket *ss, PK11SymKey *key,
SSL_TRC(3, ("%d: TLS13[%d]: deriving secret '%s'",
SSL_GETPID(), ss->fd, label));
- rv = tls13_ComputeHandshakeHashes(ss, &hashes);
- if (rv != SECSuccess) {
- PORT_Assert(0); /* Should never fail */
- ssl_MapLowLevelError(SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
+ if (!hashes) {
+ rv = tls13_ComputeHandshakeHashes(ss, &hashesTmp);
+ if (rv != SECSuccess) {
+ PORT_Assert(0); /* Should never fail */
+ ssl_MapLowLevelError(SEC_ERROR_LIBRARY_FAILURE);
+ return SECFailure;
+ }
+ hashes = &hashesTmp;
}
- rv = tls13_DeriveSecret(ss, key, label, strlen(label),
- &hashes, dest);
+ rv = tls13_HkdfExpandLabel(key, tls13_GetHash(ss),
+ hashes->u.raw, hashes->len,
+ label, strlen(label),
+ tls13_GetHkdfMechanism(ss),
+ tls13_GetHashSize(ss), dest);
if (rv != SECSuccess) {
+ LOG_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE);
return SECFailure;
}
-
- if (keylogLabel) {
- ssl3_RecordKeyLog(ss, keylogLabel, *dest);
- }
return SECSuccess;
}
@@ -3119,41 +2592,49 @@ tls13_DeriveSecretWrap(sslSocket *ss, PK11SymKey *key,
static SECStatus
tls13_DeriveTrafficKeys(sslSocket *ss, ssl3CipherSpec *spec,
TrafficKeyType type,
+ CipherSpecDirection direction,
PRBool deleteSecret)
{
- size_t keySize = spec->cipherDef->key_size;
- size_t ivSize = spec->cipherDef->iv_size +
- spec->cipherDef->explicit_nonce_size; /* This isn't always going to
- * work, but it does for
- * AES-GCM */
- CK_MECHANISM_TYPE bulkAlgorithm = ssl3_Alg2Mech(spec->cipherDef->calg);
+ size_t keySize = spec->cipher_def->key_size;
+ size_t ivSize = spec->cipher_def->iv_size +
+ spec->cipher_def->explicit_nonce_size; /* This isn't always going to
+ * work, but it does for
+ * AES-GCM */
+ CK_MECHANISM_TYPE bulkAlgorithm = ssl3_Alg2Mech(spec->cipher_def->calg);
PK11SymKey **prkp = NULL;
PK11SymKey *prk = NULL;
- PRBool clientSecret;
+ PRBool clientKey;
+ ssl3KeyMaterial *target;
+ const char *phase;
SECStatus rv;
/* These labels are just used for debugging. */
static const char kHkdfPhaseEarlyApplicationDataKeys[] = "early application data";
static const char kHkdfPhaseHandshakeKeys[] = "handshake data";
static const char kHkdfPhaseApplicationDataKeys[] = "application data";
+ if (ss->sec.isServer ^ (direction == CipherSpecWrite)) {
+ clientKey = PR_TRUE;
+ target = &spec->client;
+ } else {
+ clientKey = PR_FALSE;
+ target = &spec->server;
+ }
+
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
- clientSecret = !tls13_UseServerSecret(ss, spec->direction);
switch (type) {
case TrafficKeyEarlyApplicationData:
- PORT_Assert(clientSecret);
+ PORT_Assert(clientKey);
+ phase = kHkdfPhaseEarlyApplicationDataKeys;
prkp = &ss->ssl3.hs.clientEarlyTrafficSecret;
- spec->phase = kHkdfPhaseEarlyApplicationDataKeys;
break;
case TrafficKeyHandshake:
- prkp = clientSecret ? &ss->ssl3.hs.clientHsTrafficSecret
- : &ss->ssl3.hs.serverHsTrafficSecret;
- spec->phase = kHkdfPhaseHandshakeKeys;
+ phase = kHkdfPhaseHandshakeKeys;
+ prkp = clientKey ? &ss->ssl3.hs.clientHsTrafficSecret : &ss->ssl3.hs.serverHsTrafficSecret;
break;
case TrafficKeyApplicationData:
- prkp = clientSecret ? &ss->ssl3.hs.clientTrafficSecret
- : &ss->ssl3.hs.serverTrafficSecret;
- spec->phase = kHkdfPhaseApplicationDataKeys;
+ phase = kHkdfPhaseApplicationDataKeys;
+ prkp = clientKey ? &ss->ssl3.hs.clientTrafficSecret : &ss->ssl3.hs.serverTrafficSecret;
break;
default:
LOG_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE);
@@ -3163,15 +2644,17 @@ tls13_DeriveTrafficKeys(sslSocket *ss, ssl3CipherSpec *spec,
PORT_Assert(prkp != NULL);
prk = *prkp;
- SSL_TRC(3, ("%d: TLS13[%d]: deriving %s traffic keys epoch=%d (%s)",
- SSL_GETPID(), ss->fd, SPEC_DIR(spec),
- spec->epoch, spec->phase));
+ SSL_TRC(3, ("%d: TLS13[%d]: deriving %s traffic keys phase='%s'",
+ SSL_GETPID(), ss->fd,
+ (direction == CipherSpecWrite) ? "write" : "read", phase));
+ PORT_Assert(phase);
+ spec->phase = phase;
rv = tls13_HkdfExpandLabel(prk, tls13_GetHash(ss),
NULL, 0,
kHkdfPurposeKey, strlen(kHkdfPurposeKey),
bulkAlgorithm, keySize,
- &spec->keyMaterial.key);
+ &target->write_key);
if (rv != SECSuccess) {
LOG_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE);
PORT_Assert(0);
@@ -3181,7 +2664,7 @@ tls13_DeriveTrafficKeys(sslSocket *ss, ssl3CipherSpec *spec,
rv = tls13_HkdfExpandLabelRaw(prk, tls13_GetHash(ss),
NULL, 0,
kHkdfPurposeIv, strlen(kHkdfPurposeIv),
- spec->keyMaterial.iv, ivSize);
+ target->write_iv, ivSize);
if (rv != SECSuccess) {
LOG_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE);
PORT_Assert(0);
@@ -3198,111 +2681,38 @@ loser:
return SECFailure;
}
-void
-tls13_SetSpecRecordVersion(sslSocket *ss, ssl3CipherSpec *spec)
-{
- /* Set the record version to pretend to be (D)TLS 1.2. */
- if (IS_DTLS(ss)) {
- spec->recordVersion = SSL_LIBRARY_VERSION_DTLS_1_2_WIRE;
- } else {
- spec->recordVersion = SSL_LIBRARY_VERSION_TLS_1_2;
- }
- SSL_TRC(10, ("%d: TLS13[%d]: set spec=%d record version to 0x%04x",
- SSL_GETPID(), ss->fd, spec, spec->recordVersion));
-}
-
static SECStatus
-tls13_SetupPendingCipherSpec(sslSocket *ss, ssl3CipherSpec *spec)
+tls13_SetupPendingCipherSpec(sslSocket *ss)
{
+ ssl3CipherSpec *pSpec;
ssl3CipherSuite suite = ss->ssl3.hs.cipher_suite;
+ const ssl3BulkCipherDef *bulk = ssl_GetBulkCipherDef(
+ ssl_LookupCipherSuiteDef(suite));
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
- PORT_Assert(spec->epoch);
- /* Version isn't set when we send 0-RTT data. */
- spec->version = PR_MAX(SSL_LIBRARY_VERSION_TLS_1_3, ss->version);
+ ssl_GetSpecWriteLock(ss); /*******************************/
- ssl_SaveCipherSpec(ss, spec);
- /* We want to keep read cipher specs around longer because
- * there are cases where we might get either epoch N or
- * epoch N+1. */
- if (IS_DTLS(ss) && spec->direction == CipherSpecRead) {
- ssl_CipherSpecAddRef(spec);
- }
+ pSpec = ss->ssl3.pwSpec;
+ /* Version isn't set when we send 0-RTT data. */
+ pSpec->version = PR_MAX(SSL_LIBRARY_VERSION_TLS_1_3, ss->version);
SSL_TRC(3, ("%d: TLS13[%d]: Set Pending Cipher Suite to 0x%04x",
SSL_GETPID(), ss->fd, suite));
+ pSpec->cipher_def = bulk;
- spec->cipherDef = ssl_GetBulkCipherDef(ssl_LookupCipherSuiteDef(suite));
- switch (spec->cipherDef->calg) {
- case ssl_calg_aes_gcm:
- spec->aead = tls13_AESGCM;
- break;
- case ssl_calg_chacha20:
- spec->aead = tls13_ChaCha20Poly1305;
- break;
- default:
- PORT_Assert(0);
- return SECFailure;
- }
-
- if (spec->epoch == TrafficKeyEarlyApplicationData) {
- spec->earlyDataRemaining =
- ss->sec.ci.sid->u.ssl3.locked.sessionTicket.max_early_data_size;
- }
-
- tls13_SetSpecRecordVersion(ss, spec);
- return SECSuccess;
-}
-
-/*
- * Called before sending alerts to set up the right key on the client.
- * We might encounter errors during the handshake where the current
- * key is ClearText or EarlyApplicationData. This
- * function switches to the Handshake key if possible.
- */
-SECStatus
-tls13_SetAlertCipherSpec(sslSocket *ss)
-{
- SECStatus rv;
-
- if (ss->sec.isServer) {
- return SECSuccess;
- }
- if (ss->version < SSL_LIBRARY_VERSION_TLS_1_3) {
- return SECSuccess;
- }
- if (TLS13_IN_HS_STATE(ss, wait_server_hello)) {
- return SECSuccess;
- }
- if ((ss->ssl3.cwSpec->epoch != TrafficKeyClearText) &&
- (ss->ssl3.cwSpec->epoch != TrafficKeyEarlyApplicationData)) {
- return SECSuccess;
- }
-
- rv = tls13_SetCipherSpec(ss, TrafficKeyHandshake,
- CipherSpecWrite, PR_FALSE);
- if (rv != SECSuccess) {
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
- }
+ ssl_ReleaseSpecWriteLock(ss); /*******************************/
return SECSuccess;
}
-/* Install a new cipher spec for this direction.
- *
- * During the handshake, the values for |epoch| take values from the
- * TrafficKeyType enum. Afterwards, key update increments them.
- */
+/* Install a new cipher spec for this direction. */
static SECStatus
-tls13_SetCipherSpec(sslSocket *ss, PRUint16 epoch,
+tls13_SetCipherSpec(sslSocket *ss, TrafficKeyType type,
CipherSpecDirection direction, PRBool deleteSecret)
{
- TrafficKeyType type;
SECStatus rv;
ssl3CipherSpec *spec = NULL;
- ssl3CipherSpec **specp;
-
+ ssl3CipherSpec **specp = (direction == CipherSpecRead) ? &ss->ssl3.crSpec : &ss->ssl3.cwSpec;
/* Flush out old handshake data. */
ssl_GetXmitBufLock(ss);
rv = ssl3_FlushHandshake(ss, ssl_SEND_FLAG_FORCE_INTO_BUFFER);
@@ -3312,52 +2722,81 @@ tls13_SetCipherSpec(sslSocket *ss, PRUint16 epoch,
}
/* Create the new spec. */
- spec = ssl_CreateCipherSpec(ss, direction);
+ spec = PORT_ZNew(ssl3CipherSpec);
if (!spec) {
+ PORT_SetError(SEC_ERROR_NO_MEMORY);
return SECFailure;
}
- spec->epoch = epoch;
- spec->seqNum = 0;
- if (IS_DTLS(ss)) {
- dtls_InitRecvdRecords(&spec->recvdRecords);
+ spec->refCt = 1;
+ PR_APPEND_LINK(&spec->link, &ss->ssl3.hs.cipherSpecs);
+ ss->ssl3.pwSpec = ss->ssl3.prSpec = spec;
+
+ rv = tls13_SetupPendingCipherSpec(ss);
+ if (rv != SECSuccess)
+ return SECFailure;
+
+ switch (spec->cipher_def->calg) {
+ case calg_aes_gcm:
+ spec->aead = tls13_AESGCM;
+ break;
+ case calg_chacha20:
+ spec->aead = tls13_ChaCha20Poly1305;
+ break;
+ default:
+ PORT_Assert(0);
+ return SECFailure;
+ break;
}
- /* This depends on spec having a valid direction and epoch. */
- rv = tls13_SetupPendingCipherSpec(ss, spec);
+ rv = tls13_DeriveTrafficKeys(ss, spec, type, direction,
+ deleteSecret);
if (rv != SECSuccess) {
- goto loser;
+ return SECFailure;
}
- type = (TrafficKeyType)PR_MIN(TrafficKeyApplicationData, epoch);
- rv = tls13_DeriveTrafficKeys(ss, spec, type, deleteSecret);
- if (rv != SECSuccess) {
- goto loser;
+ /* We use the epoch for cipher suite identification, so increment
+ * it in both TLS and DTLS. */
+ if ((*specp)->epoch == PR_UINT16_MAX) {
+ return SECFailure;
+ }
+ spec->epoch = (PRUint16)type;
+
+ if (!IS_DTLS(ss)) {
+ spec->read_seq_num = spec->write_seq_num = 0;
+ } else {
+ /* The sequence number has the high 16 bits as the epoch. */
+ spec->read_seq_num = spec->write_seq_num =
+ (sslSequenceNumber)spec->epoch << 48;
+
+ dtls_InitRecvdRecords(&spec->recvdRecords);
+ }
+
+ if (type == TrafficKeyEarlyApplicationData) {
+ spec->earlyDataRemaining =
+ ss->sec.ci.sid->u.ssl3.locked.sessionTicket.max_early_data_size;
}
/* Now that we've set almost everything up, finally cut over. */
- specp = (direction == CipherSpecRead) ? &ss->ssl3.crSpec : &ss->ssl3.cwSpec;
ssl_GetSpecWriteLock(ss);
- ssl_CipherSpecRelease(*specp); /* May delete old cipher. */
- *specp = spec; /* Overwrite. */
+ tls13_CipherSpecRelease(*specp); /* May delete old cipher. */
+ *specp = spec; /* Overwrite. */
ssl_ReleaseSpecWriteLock(ss);
- SSL_TRC(3, ("%d: TLS13[%d]: %s installed key for epoch=%d (%s) dir=%s",
- SSL_GETPID(), ss->fd, SSL_ROLE(ss), spec->epoch,
- spec->phase, SPEC_DIR(spec)));
+ SSL_TRC(3, ("%d: TLS13[%d]: %s installed key for phase='%s'.%d dir=%s",
+ SSL_GETPID(), ss->fd, SSL_ROLE(ss),
+ spec->phase, spec->epoch,
+ direction == CipherSpecRead ? "read" : "write"));
if (ss->ssl3.changedCipherSpecFunc) {
ss->ssl3.changedCipherSpecFunc(ss->ssl3.changedCipherSpecArg,
direction == CipherSpecWrite, spec);
}
return SECSuccess;
-
-loser:
- ssl_CipherSpecRelease(spec);
- return SECFailure;
}
-SECStatus
-tls13_ComputeHandshakeHashes(sslSocket *ss, SSL3Hashes *hashes)
+static SECStatus
+tls13_ComputeHandshakeHashes(sslSocket *ss,
+ SSL3Hashes *hashes)
{
SECStatus rv;
PK11Context *ctx = NULL;
@@ -3377,7 +2816,7 @@ tls13_ComputeHandshakeHashes(sslSocket *ss, SSL3Hashes *hashes)
goto loser;
}
- PRINT_BUF(10, (ss, "Handshake hash computed over saved messages",
+ PRINT_BUF(10, (NULL, "Handshake hash computed over saved messages",
ss->ssl3.hs.messages.buf,
ss->ssl3.hs.messages.len));
@@ -3402,8 +2841,6 @@ tls13_ComputeHandshakeHashes(sslSocket *ss, SSL3Hashes *hashes)
ssl_MapLowLevelError(SSL_ERROR_DIGEST_FAILURE);
goto loser;
}
-
- PRINT_BUF(10, (ss, "Handshake hash", hashes->u.raw, hashes->len));
PORT_Assert(hashes->len == tls13_GetHashSize(ss));
PK11_DestroyContext(ctx, PR_TRUE);
@@ -3453,6 +2890,19 @@ tls13_DestroyEarlyData(PRCList *list)
}
}
+void
+tls13_DestroyCipherSpecs(PRCList *list)
+{
+ PRCList *cur_p;
+
+ while (!PR_CLIST_IS_EMPTY(list)) {
+ cur_p = PR_LIST_TAIL(list);
+ PR_REMOVE_LINK(cur_p);
+ ssl3_DestroyCipherSpec((ssl3CipherSpec *)cur_p, PR_FALSE);
+ PORT_Free(cur_p);
+ }
+}
+
/* draft-ietf-tls-tls13 Section 5.2.2 specifies the following
* nonce algorithm:
*
@@ -3482,7 +2932,7 @@ tls13_WriteNonce(ssl3KeyMaterial *keys,
size_t i;
PORT_Assert(nonceLen == 12);
- memcpy(nonce, keys->iv, 12);
+ memcpy(nonce, keys->write_iv, 12);
/* XOR the last 8 bytes of the IV with the sequence number. */
PORT_Assert(seqNumLen == 8);
@@ -3512,10 +2962,10 @@ tls13_AEAD(ssl3KeyMaterial *keys, PRBool doDecrypt,
};
if (doDecrypt) {
- rv = PK11_Decrypt(keys->key, mechanism, &param,
+ rv = PK11_Decrypt(keys->write_key, mechanism, &param,
out, &uOutLen, maxout, in, inlen);
} else {
- rv = PK11_Encrypt(keys->key, mechanism, &param,
+ rv = PK11_Encrypt(keys->write_key, mechanism, &param,
out, &uOutLen, maxout, in, inlen);
}
*outlen = (int)uOutLen;
@@ -3612,7 +3062,7 @@ tls13_HandleEncryptedExtensions(sslSocket *ss, PRUint8 *b, PRUint32 length)
ss->xtnData.nextProto.data = NULL;
ss->xtnData.nextProtoState = SSL_NEXT_PROTO_NO_SUPPORT;
}
- rv = ssl3_HandleExtensions(ss, &b, &length, ssl_hs_encrypted_extensions);
+ rv = ssl3_HandleExtensions(ss, &b, &length, encrypted_extensions);
if (rv != SECSuccess) {
return SECFailure; /* Error code set below */
}
@@ -3664,8 +3114,10 @@ tls13_HandleEncryptedExtensions(sslSocket *ss, PRUint8 *b, PRUint32 length)
static SECStatus
tls13_SendEncryptedExtensions(sslSocket *ss)
{
- sslBuffer extensions = SSL_BUFFER_EMPTY;
SECStatus rv;
+ PRInt32 extensions_len = 0;
+ PRInt32 sent_len = 0;
+ PRUint32 maxBytes = 65535;
SSL_TRC(3, ("%d: TLS13[%d]: send encrypted extensions handshake",
SSL_GETPID(), ss->fd));
@@ -3673,28 +3125,31 @@ tls13_SendEncryptedExtensions(sslSocket *ss)
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
PORT_Assert(ss->opt.noLocks || ssl_HaveXmitBufLock(ss));
- rv = ssl_ConstructExtensions(ss, &extensions, ssl_hs_encrypted_extensions);
+ extensions_len = ssl3_CallHelloExtensionSenders(
+ ss, PR_FALSE, maxBytes, &ss->xtnData.encryptedExtensionsSenders[0]);
+
+ rv = ssl3_AppendHandshakeHeader(ss, encrypted_extensions,
+ extensions_len + 2);
if (rv != SECSuccess) {
+ LOG_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE);
return SECFailure;
}
-
- rv = ssl3_AppendHandshakeHeader(ss, ssl_hs_encrypted_extensions,
- SSL_BUFFER_LEN(&extensions) + 2);
+ rv = ssl3_AppendHandshakeNumber(ss, extensions_len, 2);
if (rv != SECSuccess) {
LOG_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE);
- goto loser;
+ return SECFailure;
}
- rv = ssl3_AppendBufferToHandshakeVariable(ss, &extensions, 2);
- if (rv != SECSuccess) {
+ sent_len = ssl3_CallHelloExtensionSenders(
+ ss, PR_TRUE, extensions_len,
+ &ss->xtnData.encryptedExtensionsSenders[0]);
+ PORT_Assert(sent_len == extensions_len);
+ if (sent_len != extensions_len) {
LOG_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE);
- goto loser;
+ PORT_Assert(sent_len == 0);
+ return SECFailure;
}
- sslBuffer_Clear(&extensions);
- return SECSuccess;
-loser:
- sslBuffer_Clear(&extensions);
- return SECFailure;
+ return SECSuccess;
}
SECStatus
@@ -3755,7 +3210,7 @@ tls13_SendCertificateVerify(sslSocket *ss, SECKEYPrivateKey *privKey)
len = buf.len + 2 + 2;
- rv = ssl3_AppendHandshakeHeader(ss, ssl_hs_certificate_verify, len);
+ rv = ssl3_AppendHandshakeHeader(ss, certificate_verify, len);
if (rv != SECSuccess) {
goto done; /* error code set by AppendHandshake */
}
@@ -3783,14 +3238,14 @@ done:
* Caller must hold Handshake and RecvBuf locks.
*/
SECStatus
-tls13_HandleCertificateVerify(sslSocket *ss, PRUint8 *b, PRUint32 length)
+tls13_HandleCertificateVerify(sslSocket *ss, PRUint8 *b, PRUint32 length,
+ SSL3Hashes *hashes)
{
SECItem signed_hash = { siBuffer, NULL, 0 };
SECStatus rv;
SSLSignatureScheme sigScheme;
SSLHashType hashAlg;
SSL3Hashes tbsHash;
- SSL3Hashes hashes;
SSL_TRC(3, ("%d: TLS13[%d]: handle certificate_verify handshake",
SSL_GETPID(), ss->fd));
@@ -3802,17 +3257,7 @@ tls13_HandleCertificateVerify(sslSocket *ss, PRUint8 *b, PRUint32 length)
if (rv != SECSuccess) {
return SECFailure;
}
-
- rv = tls13_ComputeHandshakeHashes(ss, &hashes);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- rv = ssl_HashHandshakeMessage(ss, ssl_hs_certificate_verify, b, length);
- if (rv != SECSuccess) {
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
- }
+ PORT_Assert(hashes);
rv = ssl_ConsumeSignatureScheme(ss, &b, &length, &sigScheme);
if (rv != SECSuccess) {
@@ -3827,7 +3272,7 @@ tls13_HandleCertificateVerify(sslSocket *ss, PRUint8 *b, PRUint32 length)
}
hashAlg = ssl_SignatureSchemeToHashType(sigScheme);
- rv = tls13_AddContextToHashes(ss, &hashes, hashAlg, PR_FALSE, &tbsHash);
+ rv = tls13_AddContextToHashes(ss, hashes, hashAlg, PR_FALSE, &tbsHash);
if (rv != SECSuccess) {
FATAL_ERROR(ss, SSL_ERROR_DIGEST_FAILURE, internal_error);
return SECFailure;
@@ -3856,11 +3301,13 @@ tls13_HandleCertificateVerify(sslSocket *ss, PRUint8 *b, PRUint32 length)
}
/* Request a client certificate now if one was requested. */
- if (ss->ssl3.hs.clientCertRequested) {
+ if (ss->ssl3.hs.certificateRequest) {
+ TLS13CertificateRequest *req = ss->ssl3.hs.certificateRequest;
+
PORT_Assert(!ss->sec.isServer);
- rv = ssl3_CompleteHandleCertificateRequest(
- ss, ss->xtnData.sigSchemes, ss->xtnData.numSigSchemes,
- &ss->xtnData.certReqAuthorities);
+ rv = ssl3_CompleteHandleCertificateRequest(ss, req->signatureSchemes,
+ req->signatureSchemeCount,
+ &req->ca_list);
if (rv != SECSuccess) {
FATAL_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE, internal_error);
return rv;
@@ -3873,7 +3320,7 @@ tls13_HandleCertificateVerify(sslSocket *ss, PRUint8 *b, PRUint32 length)
}
static SECStatus
-tls13_ComputePskBinderHash(sslSocket *ss, unsigned int prefixLength,
+tls13_ComputePskBinderHash(sslSocket *ss, unsigned long prefixLength,
SSL3Hashes *hashes)
{
SECStatus rv;
@@ -3885,75 +3332,38 @@ tls13_ComputePskBinderHash(sslSocket *ss, unsigned int prefixLength,
PRINT_BUF(10, (NULL, "Handshake hash computed over ClientHello prefix",
ss->ssl3.hs.messages.buf, prefixLength));
rv = PK11_HashBuf(ssl3_HashTypeToOID(tls13_GetHash(ss)),
- hashes->u.raw, ss->ssl3.hs.messages.buf, prefixLength);
+ hashes->u.raw,
+ ss->ssl3.hs.messages.buf, prefixLength);
if (rv != SECSuccess) {
ssl_MapLowLevelError(SSL_ERROR_SHA_DIGEST_FAILURE);
- return SECFailure;
+ goto loser;
}
-
hashes->len = tls13_GetHashSize(ss);
- PRINT_BUF(10, (NULL, "PSK Binder hash", hashes->u.raw, hashes->len));
+
+ PRINT_BUF(10, (NULL, "PSK Binder hash",
+ hashes->u.raw, hashes->len));
return SECSuccess;
-}
-/* Compute and inject the PSK Binder for sending.
- *
- * When sending a ClientHello, we construct all the extensions with a dummy
- * value for the binder. To construct the binder, we commit the entire message
- * up to the point where the binders start. Then we calculate the hash using
- * the saved message (in ss->ssl3.hs.messages). This is written over the dummy
- * binder, after which we write the remainder of the binder extension. */
+loser:
+ return SECFailure;
+}
+/* Compute the PSK Binder This is kind of sneaky.*/
SECStatus
-tls13_WriteExtensionsWithBinder(sslSocket *ss, sslBuffer *extensions)
+tls13_ComputePskBinder(sslSocket *ss, PRBool sending,
+ unsigned int prefixLength,
+ PRUint8 *output, unsigned int *outputLen,
+ unsigned int maxOutputLen)
{
SSL3Hashes hashes;
SECStatus rv;
- unsigned int size = tls13_GetHashSize(ss);
- unsigned int prefixLen = extensions->len - size - 3;
- unsigned int finishedLen;
- PORT_Assert(extensions->len >= size + 3);
-
- rv = ssl3_AppendHandshakeNumber(ss, extensions->len, 2);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- /* Only write the extension up to the point before the binders. Assume that
- * the pre_shared_key extension is at the end of the buffer. Don't write
- * the binder, or the lengths that precede it (a 2 octet length for the list
- * of all binders, plus a 1 octet length for the binder length). */
- rv = ssl3_AppendHandshake(ss, extensions->buf, prefixLen);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- /* Calculate the binder based on what has been written out. */
- rv = tls13_ComputePskBinderHash(ss, ss->ssl3.hs.messages.len, &hashes);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- /* Write the binder into the extensions buffer, over the zeros we reserved
- * previously. This avoids an allocation and means that we don't need a
- * separate write for the extra bits that precede the binder. */
- rv = tls13_ComputeFinished(ss, ss->ssl3.hs.pskBinderKey, &hashes, PR_TRUE,
- extensions->buf + extensions->len - size,
- &finishedLen, size);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- PORT_Assert(finishedLen == size);
-
- /* Write out the remainder of the extension. */
- rv = ssl3_AppendHandshake(ss, extensions->buf + prefixLen,
- extensions->len - prefixLen);
- if (rv != SECSuccess) {
+ rv = tls13_ComputePskBinderHash(ss, prefixLength, &hashes);
+ if (rv != SECSuccess)
return SECFailure;
- }
- return SECSuccess;
+ return tls13_ComputeFinished(ss, ss->ssl3.hs.pskBinderKey, &hashes,
+ sending, output, outputLen, maxOutputLen);
}
static SECStatus
@@ -4052,7 +3462,7 @@ tls13_SendFinished(sslSocket *ss, PK11SymKey *baseKey)
return SECFailure;
}
- rv = ssl3_AppendHandshakeHeader(ss, ssl_hs_finished, finishedLen);
+ rv = ssl3_AppendHandshakeHeader(ss, finished, finishedLen);
if (rv != SECSuccess) {
return SECFailure; /* Error code already set. */
}
@@ -4067,7 +3477,7 @@ tls13_SendFinished(sslSocket *ss, PK11SymKey *baseKey)
}
static SECStatus
-tls13_VerifyFinished(sslSocket *ss, SSLHandshakeType message,
+tls13_VerifyFinished(sslSocket *ss, SSL3HandshakeType message,
PK11SymKey *secret,
PRUint8 *b, PRUint32 length,
const SSL3Hashes *hashes)
@@ -4090,7 +3500,7 @@ tls13_VerifyFinished(sslSocket *ss, SSLHandshakeType message,
if (length != finishedLen) {
#ifndef UNSAFE_FUZZER_MODE
- FATAL_ERROR(ss, message == ssl_hs_finished ? SSL_ERROR_RX_MALFORMED_FINISHED : SSL_ERROR_RX_MALFORMED_CLIENT_HELLO, illegal_parameter);
+ FATAL_ERROR(ss, message == finished ? SSL_ERROR_RX_MALFORMED_FINISHED : SSL_ERROR_RX_MALFORMED_CLIENT_HELLO, illegal_parameter);
return SECFailure;
#endif
}
@@ -4107,37 +3517,8 @@ tls13_VerifyFinished(sslSocket *ss, SSLHandshakeType message,
}
static SECStatus
-tls13_CommonHandleFinished(sslSocket *ss, PK11SymKey *key,
- PRUint8 *b, PRUint32 length)
-{
- SECStatus rv;
- SSL3Hashes hashes;
-
- rv = TLS13_CHECK_HS_STATE(ss, SSL_ERROR_RX_UNEXPECTED_FINISHED,
- wait_finished);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- ss->ssl3.hs.endOfFlight = PR_TRUE;
-
- rv = tls13_ComputeHandshakeHashes(ss, &hashes);
- if (rv != SECSuccess) {
- LOG_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
- }
-
- rv = ssl_HashHandshakeMessage(ss, ssl_hs_finished, b, length);
- if (rv != SECSuccess) {
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
- }
-
- return tls13_VerifyFinished(ss, ssl_hs_finished,
- key, b, length, &hashes);
-}
-
-static SECStatus
-tls13_ClientHandleFinished(sslSocket *ss, PRUint8 *b, PRUint32 length)
+tls13_ClientHandleFinished(sslSocket *ss, PRUint8 *b, PRUint32 length,
+ const SSL3Hashes *hashes)
{
SECStatus rv;
@@ -4147,19 +3528,27 @@ tls13_ClientHandleFinished(sslSocket *ss, PRUint8 *b, PRUint32 length)
SSL_TRC(3, ("%d: TLS13[%d]: client handle finished handshake",
SSL_GETPID(), ss->fd));
- rv = tls13_CommonHandleFinished(ss, ss->ssl3.hs.serverHsTrafficSecret,
- b, length);
+ rv = TLS13_CHECK_HS_STATE(ss, SSL_ERROR_RX_UNEXPECTED_FINISHED,
+ wait_finished);
if (rv != SECSuccess) {
return SECFailure;
}
+ rv = tls13_VerifyFinished(ss, finished,
+ ss->ssl3.hs.serverHsTrafficSecret,
+ b, length, hashes);
+ if (rv != SECSuccess)
+ return SECFailure;
+
return tls13_SendClientSecondRound(ss);
}
static SECStatus
-tls13_ServerHandleFinished(sslSocket *ss, PRUint8 *b, PRUint32 length)
+tls13_ServerHandleFinished(sslSocket *ss, PRUint8 *b, PRUint32 length,
+ const SSL3Hashes *hashes)
{
SECStatus rv;
+ PK11SymKey *secret;
PORT_Assert(ss->opt.noLocks || ssl_HaveRecvBufLock(ss));
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
@@ -4167,68 +3556,61 @@ tls13_ServerHandleFinished(sslSocket *ss, PRUint8 *b, PRUint32 length)
SSL_TRC(3, ("%d: TLS13[%d]: server handle finished handshake",
SSL_GETPID(), ss->fd));
- rv = tls13_CommonHandleFinished(ss, ss->ssl3.hs.clientHsTrafficSecret,
- b, length);
+ rv = TLS13_CHECK_HS_STATE(ss, SSL_ERROR_RX_UNEXPECTED_FINISHED, wait_finished);
if (rv != SECSuccess) {
return SECFailure;
}
- if (!ss->opt.requestCertificate &&
- (ss->ssl3.hs.zeroRttState != ssl_0rtt_done)) {
- dtls_ReceivedFirstMessageInFlight(ss);
+ if (TLS13_IN_HS_STATE(ss, wait_finished)) {
+ secret = ss->ssl3.hs.clientHsTrafficSecret;
+ } else {
+ secret = ss->ssl3.hs.clientEarlyTrafficSecret;
}
+ rv = tls13_VerifyFinished(ss, finished, secret, b, length, hashes);
+ if (rv != SECSuccess)
+ return SECFailure;
+
rv = tls13_SetCipherSpec(ss, TrafficKeyApplicationData,
- CipherSpecRead, PR_FALSE);
+ CipherSpecRead, PR_TRUE);
if (rv != SECSuccess) {
FATAL_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE, internal_error);
return SECFailure;
}
- if (IS_DTLS(ss)) {
- ssl_CipherSpecReleaseByEpoch(ss, CipherSpecRead, TrafficKeyClearText);
- /* We need to keep the handshake cipher spec so we can
- * read re-transmitted client Finished. */
- rv = dtls_StartTimer(ss, ss->ssl3.hs.hdTimer,
- DTLS_RETRANSMIT_FINISHED_MS,
- dtls13_HolddownTimerCb);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- }
-
- rv = tls13_ComputeFinalSecrets(ss);
+ rv = tls13_FinishHandshake(ss);
if (rv != SECSuccess) {
- return SECFailure;
+ return SECFailure; /* Error code and alerts handled below */
}
-
ssl_GetXmitBufLock(ss);
if (ss->opt.enableSessionTickets) {
- rv = tls13_SendNewSessionTicket(ss, NULL, 0);
+ rv = tls13_SendNewSessionTicket(ss);
if (rv != SECSuccess) {
- goto loser;
+ ssl_ReleaseXmitBufLock(ss);
+ return SECFailure; /* Error code and alerts handled below */
}
rv = ssl3_FlushHandshake(ss, 0);
- if (rv != SECSuccess) {
- goto loser;
- }
}
ssl_ReleaseXmitBufLock(ss);
+ if (rv != SECSuccess)
+ return SECFailure;
- return tls13_FinishHandshake(ss);
-
-loser:
- ssl_ReleaseXmitBufLock(ss);
- return SECFailure;
+ return SECSuccess;
}
static SECStatus
tls13_FinishHandshake(sslSocket *ss)
{
+ SECStatus rv;
+
PORT_Assert(ss->opt.noLocks || ssl_HaveRecvBufLock(ss));
PORT_Assert(ss->opt.noLocks || ssl_HaveSSL3HandshakeLock(ss));
PORT_Assert(ss->ssl3.hs.restartTarget == NULL);
+ rv = tls13_ComputeFinalSecrets(ss);
+ if (rv != SECSuccess)
+ return SECFailure;
+
/* The first handshake is now completed. */
ss->handshake = NULL;
@@ -4270,15 +3652,9 @@ tls13_SendClientSecondFlight(sslSocket *ss, PRBool sendClientCert,
return SECFailure; /* error code is set. */
}
}
- if (ss->ssl3.hs.clientCertRequested) {
- SECITEM_FreeItem(&ss->xtnData.certReqContext, PR_FALSE);
- if (ss->xtnData.certReqAuthorities.arena) {
- PORT_FreeArena(ss->xtnData.certReqAuthorities.arena, PR_FALSE);
- ss->xtnData.certReqAuthorities.arena = NULL;
- }
- PORT_Memset(&ss->xtnData.certReqAuthorities, 0,
- sizeof(ss->xtnData.certReqAuthorities));
- ss->ssl3.hs.clientCertRequested = PR_FALSE;
+ if (ss->ssl3.hs.certificateRequest) {
+ PORT_FreeArena(ss->ssl3.hs.certificateRequest->arena, PR_FALSE);
+ ss->ssl3.hs.certificateRequest = NULL;
}
if (sendClientCert) {
@@ -4294,7 +3670,7 @@ tls13_SendClientSecondFlight(sslSocket *ss, PRBool sendClientCert,
if (rv != SECSuccess) {
return SECFailure; /* err code was set. */
}
- rv = ssl3_FlushHandshake(ss, 0);
+ rv = ssl3_FlushHandshake(ss, IS_DTLS(ss) ? ssl_SEND_FLAG_NO_RETRANSMIT : 0);
if (rv != SECSuccess) {
/* No point in sending an alert here because we're not going to
* be able to send it if we couldn't flush the handshake. */
@@ -4302,6 +3678,11 @@ tls13_SendClientSecondFlight(sslSocket *ss, PRBool sendClientCert,
return SECFailure;
}
+ rv = dtls_StartHolddownTimer(ss);
+ if (rv != SECSuccess) {
+ return SECFailure; /* err code was set. */
+ }
+
return SECSuccess;
}
@@ -4336,28 +3717,11 @@ tls13_SendClientSecondRound(sslSocket *ss)
return SECWouldBlock;
}
- rv = tls13_ComputeApplicationSecrets(ss);
- if (rv != SECSuccess) {
- FATAL_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE, internal_error);
- return SECFailure;
- }
-
if (ss->ssl3.hs.zeroRttState == ssl_0rtt_accepted) {
- ssl_GetXmitBufLock(ss); /*******************************/
rv = tls13_SendEndOfEarlyData(ss);
- ssl_ReleaseXmitBufLock(ss); /*******************************/
if (rv != SECSuccess) {
return SECFailure; /* Error code already set. */
}
- } else if (ss->opt.enableTls13CompatMode && !IS_DTLS(ss) &&
- ss->ssl3.hs.zeroRttState == ssl_0rtt_none &&
- !ss->ssl3.hs.helloRetry) {
- ssl_GetXmitBufLock(ss); /*******************************/
- rv = ssl3_SendChangeCipherSpecsInt(ss);
- ssl_ReleaseXmitBufLock(ss); /*******************************/
- if (rv != SECSuccess) {
- return rv;
- }
}
rv = tls13_SetCipherSpec(ss, TrafficKeyHandshake,
@@ -4367,6 +3731,12 @@ tls13_SendClientSecondRound(sslSocket *ss)
return SECFailure;
}
+ rv = tls13_ComputeApplicationSecrets(ss);
+ if (rv != SECSuccess) {
+ FATAL_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE, internal_error);
+ return SECFailure;
+ }
+
rv = tls13_SetCipherSpec(ss, TrafficKeyApplicationData,
CipherSpecRead, PR_FALSE);
if (rv != SECSuccess) {
@@ -4386,17 +3756,12 @@ tls13_SendClientSecondRound(sslSocket *ss)
return SECFailure;
}
rv = tls13_SetCipherSpec(ss, TrafficKeyApplicationData,
- CipherSpecWrite, PR_FALSE);
+ CipherSpecWrite, PR_TRUE);
if (rv != SECSuccess) {
PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
return SECFailure;
}
- rv = tls13_ComputeFinalSecrets(ss);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
/* The handshake is now finished */
return tls13_FinishHandshake(ss);
}
@@ -4412,7 +3777,6 @@ tls13_SendClientSecondRound(sslSocket *ss)
* struct {
* uint32 ticket_lifetime;
* uint32 ticket_age_add;
- * opaque ticket_nonce<1..255>;
* opaque ticket<1..2^16-1>;
* TicketExtension extensions<0..2^16-2>;
* } NewSessionTicket;
@@ -4420,22 +3784,14 @@ tls13_SendClientSecondRound(sslSocket *ss)
PRUint32 ssl_max_early_data_size = (2 << 16); /* Arbitrary limit. */
-static SECStatus
-tls13_SendNewSessionTicket(sslSocket *ss, const PRUint8 *appToken,
- unsigned int appTokenLen)
+SECStatus
+tls13_SendNewSessionTicket(sslSocket *ss)
{
PRUint16 message_length;
- PK11SymKey *secret;
SECItem ticket_data = { 0, NULL, 0 };
SECStatus rv;
NewSessionTicket ticket = { 0 };
PRUint32 max_early_data_size_len = 0;
- PRUint8 ticketNonce[sizeof(ss->ssl3.hs.ticketNonce)];
- sslBuffer ticketNonceBuf = SSL_BUFFER(ticketNonce);
-
- SSL_TRC(3, ("%d: TLS13[%d]: send new session ticket message %d",
- SSL_GETPID(), ss->fd, ss->ssl3.hs.ticketNonce));
-
ticket.flags = 0;
if (ss->opt.enable0RttData) {
ticket.flags |= ticket_allow_early_data;
@@ -4443,44 +3799,18 @@ tls13_SendNewSessionTicket(sslSocket *ss, const PRUint8 *appToken,
}
ticket.ticket_lifetime_hint = ssl_ticket_lifetime;
- /* The ticket age obfuscator. */
- rv = PK11_GenerateRandom((PRUint8 *)&ticket.ticket_age_add,
- sizeof(ticket.ticket_age_add));
- if (rv != SECSuccess)
- goto loser;
-
- rv = sslBuffer_AppendNumber(&ticketNonceBuf, ss->ssl3.hs.ticketNonce,
- sizeof(ticketNonce));
- if (rv != SECSuccess) {
- goto loser;
- }
- ++ss->ssl3.hs.ticketNonce;
- rv = tls13_HkdfExpandLabel(ss->ssl3.hs.resumptionMasterSecret,
- tls13_GetHash(ss),
- ticketNonce, sizeof(ticketNonce),
- kHkdfLabelResumption,
- strlen(kHkdfLabelResumption),
- tls13_GetHkdfMechanism(ss),
- tls13_GetHashSize(ss), &secret);
- if (rv != SECSuccess) {
- goto loser;
- }
-
- rv = ssl3_EncodeSessionTicket(ss, &ticket, appToken, appTokenLen,
- secret, &ticket_data);
- PK11_FreeSymKey(secret);
+ rv = ssl3_EncodeSessionTicket(ss, &ticket, &ticket_data);
if (rv != SECSuccess)
goto loser;
message_length =
4 + /* lifetime */
4 + /* ticket_age_add */
- 1 + sizeof(ticketNonce) + /* ticket_nonce */
2 + max_early_data_size_len + /* max_early_data_size_len */
2 + /* ticket length */
ticket_data.len;
- rv = ssl3_AppendHandshakeHeader(ss, ssl_hs_new_session_ticket,
+ rv = ssl3_AppendHandshakeHeader(ss, new_session_ticket,
message_length);
if (rv != SECSuccess)
goto loser;
@@ -4490,12 +3820,13 @@ tls13_SendNewSessionTicket(sslSocket *ss, const PRUint8 *appToken,
if (rv != SECSuccess)
goto loser;
- rv = ssl3_AppendHandshakeNumber(ss, ticket.ticket_age_add, 4);
+ /* The ticket age obfuscator. */
+ rv = PK11_GenerateRandom((PRUint8 *)&ticket.ticket_age_add,
+ sizeof(ticket.ticket_age_add));
if (rv != SECSuccess)
goto loser;
- /* The ticket nonce. */
- rv = ssl3_AppendHandshakeVariable(ss, ticketNonce, sizeof(ticketNonce), 1);
+ rv = ssl3_AppendHandshakeNumber(ss, ticket.ticket_age_add, 4);
if (rv != SECSuccess)
goto loser;
@@ -4512,7 +3843,7 @@ tls13_SendNewSessionTicket(sslSocket *ss, const PRUint8 *appToken,
if (max_early_data_size_len) {
rv = ssl3_AppendHandshakeNumber(
- ss, ssl_tls13_early_data_xtn, 2);
+ ss, ssl_tls13_ticket_early_data_info_xtn, 2);
if (rv != SECSuccess)
goto loser;
@@ -4536,42 +3867,6 @@ loser:
return SECFailure;
}
-SECStatus
-SSLExp_SendSessionTicket(PRFileDesc *fd, const PRUint8 *token,
- unsigned int tokenLen)
-{
- sslSocket *ss;
- SECStatus rv;
-
- ss = ssl_FindSocket(fd);
- if (!ss) {
- return SECFailure;
- }
-
- if (IS_DTLS(ss)) {
- PORT_SetError(SSL_ERROR_FEATURE_NOT_SUPPORTED_FOR_VERSION);
- return SECFailure;
- }
-
- if (!ss->sec.isServer || !ss->firstHsDone ||
- ss->version < SSL_LIBRARY_VERSION_TLS_1_3 ||
- tokenLen > 0xffff) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- return SECFailure;
- }
-
- ssl_GetSSL3HandshakeLock(ss);
- ssl_GetXmitBufLock(ss);
- rv = tls13_SendNewSessionTicket(ss, token, tokenLen);
- if (rv == SECSuccess) {
- rv = ssl3_FlushHandshake(ss, 0);
- }
- ssl_ReleaseXmitBufLock(ss);
- ssl_ReleaseSSL3HandshakeLock(ss);
-
- return rv;
-}
-
static SECStatus
tls13_HandleNewSessionTicket(sslSocket *ss, PRUint8 *b, PRUint32 length)
{
@@ -4579,7 +3874,6 @@ tls13_HandleNewSessionTicket(sslSocket *ss, PRUint8 *b, PRUint32 length)
PRUint32 utmp;
NewSessionTicket ticket = { 0 };
SECItem data;
- SECItem ticket_nonce;
SECItem ticket_data;
SSL_TRC(3, ("%d: TLS13[%d]: handle new session ticket message",
@@ -4596,7 +3890,7 @@ tls13_HandleNewSessionTicket(sslSocket *ss, PRUint8 *b, PRUint32 length)
return SECFailure;
}
- ticket.received_timestamp = ssl_TimeUsec();
+ ticket.received_timestamp = PR_Now();
rv = ssl3_ConsumeHandshakeNumber(ss, &ticket.ticket_lifetime_hint, 4, &b,
&length);
if (rv != SECSuccess) {
@@ -4614,14 +3908,6 @@ tls13_HandleNewSessionTicket(sslSocket *ss, PRUint8 *b, PRUint32 length)
}
ticket.ticket_age_add = PR_ntohl(utmp);
- /* The nonce. */
- rv = ssl3_ConsumeHandshakeVariable(ss, &ticket_nonce, 1, &b, &length);
- if (rv != SECSuccess) {
- FATAL_ERROR(ss, SSL_ERROR_RX_MALFORMED_NEW_SESSION_TICKET,
- decode_error);
- return SECFailure;
- }
-
/* Get the ticket value. */
rv = ssl3_ConsumeHandshakeVariable(ss, &ticket_data, 2, &b, &length);
if (rv != SECSuccess || !ticket_data.len) {
@@ -4632,14 +3918,14 @@ tls13_HandleNewSessionTicket(sslSocket *ss, PRUint8 *b, PRUint32 length)
/* Parse extensions. */
rv = ssl3_ConsumeHandshakeVariable(ss, &data, 2, &b, &length);
- if (rv != SECSuccess || length) {
+ if (rv != SECSuccess) {
FATAL_ERROR(ss, SSL_ERROR_RX_MALFORMED_NEW_SESSION_TICKET,
decode_error);
return SECFailure;
}
rv = ssl3_HandleExtensions(ss, &data.data,
- &data.len, ssl_hs_new_session_ticket);
+ &data.len, new_session_ticket);
if (rv != SECSuccess) {
FATAL_ERROR(ss, SSL_ERROR_RX_MALFORMED_NEW_SESSION_TICKET,
decode_error);
@@ -4650,9 +3936,13 @@ tls13_HandleNewSessionTicket(sslSocket *ss, PRUint8 *b, PRUint32 length)
ticket.max_early_data_size = ss->xtnData.max_early_data_size;
}
- if (!ss->opt.noCache) {
- PK11SymKey *secret;
+ if (length != 0) {
+ FATAL_ERROR(ss, SSL_ERROR_RX_MALFORMED_NEW_SESSION_TICKET,
+ decode_error);
+ return SECFailure;
+ }
+ if (!ss->opt.noCache) {
PORT_Assert(ss->sec.ci.sid);
rv = SECITEM_CopyItem(NULL, &ticket.ticket, &ticket_data);
if (rv != SECSuccess) {
@@ -4689,22 +3979,9 @@ tls13_HandleNewSessionTicket(sslSocket *ss, PRUint8 *b, PRUint32 length)
ssl3_SetSIDSessionTicket(ss->sec.ci.sid, &ticket);
PORT_Assert(!ticket.ticket.data);
- rv = tls13_HkdfExpandLabel(ss->ssl3.hs.resumptionMasterSecret,
- tls13_GetHash(ss),
- ticket_nonce.data, ticket_nonce.len,
- kHkdfLabelResumption,
- strlen(kHkdfLabelResumption),
- tls13_GetHkdfMechanism(ss),
- tls13_GetHashSize(ss), &secret);
- if (rv != SECSuccess) {
+ rv = ssl3_FillInCachedSID(ss, ss->sec.ci.sid);
+ if (rv != SECSuccess)
return SECFailure;
- }
-
- rv = ssl3_FillInCachedSID(ss, ss->sec.ci.sid, secret);
- PK11_FreeSymKey(secret);
- if (rv != SECSuccess) {
- return SECFailure;
- }
/* Cache the session. */
ss->sec.cache(ss->sec.ci.sid);
@@ -4713,103 +3990,111 @@ tls13_HandleNewSessionTicket(sslSocket *ss, PRUint8 *b, PRUint32 length)
return SECSuccess;
}
-#define _M(a) (1 << PR_MIN(a, 31))
-#define _M1(a) (_M(ssl_hs_##a))
-#define _M2(a, b) (_M1(a) | _M1(b))
-#define _M3(a, b, c) (_M1(a) | _M2(b, c))
+typedef enum {
+ ExtensionNotUsed,
+ ExtensionClientOnly,
+ ExtensionSendClear,
+ ExtensionSendClearOrHrr,
+ ExtensionSendHrr,
+ ExtensionSendEncrypted,
+ ExtensionSendCertificate,
+ ExtensionNewSessionTicket
+} Tls13ExtensionStatus;
static const struct {
PRUint16 ex_value;
- PRUint32 messages;
+ Tls13ExtensionStatus status;
} KnownExtensions[] = {
- { ssl_server_name_xtn, _M2(client_hello, encrypted_extensions) },
- { ssl_supported_groups_xtn, _M2(client_hello, encrypted_extensions) },
- { ssl_signature_algorithms_xtn, _M2(client_hello, certificate_request) },
- { ssl_signature_algorithms_cert_xtn, _M2(client_hello,
- certificate_request) },
- { ssl_use_srtp_xtn, _M2(client_hello, encrypted_extensions) },
- { ssl_app_layer_protocol_xtn, _M2(client_hello, encrypted_extensions) },
- { ssl_padding_xtn, _M1(client_hello) },
- { ssl_tls13_key_share_xtn, _M3(client_hello, server_hello,
- hello_retry_request) },
- { ssl_tls13_pre_shared_key_xtn, _M2(client_hello, server_hello) },
- { ssl_tls13_psk_key_exchange_modes_xtn, _M1(client_hello) },
- { ssl_tls13_early_data_xtn, _M3(client_hello, encrypted_extensions,
- new_session_ticket) },
- { ssl_signed_cert_timestamp_xtn, _M3(client_hello, certificate_request,
- certificate) },
- { ssl_cert_status_xtn, _M3(client_hello, certificate_request,
- certificate) },
- { ssl_tls13_cookie_xtn, _M2(client_hello, hello_retry_request) },
- { ssl_tls13_certificate_authorities_xtn, _M1(certificate_request) },
- { ssl_tls13_supported_versions_xtn, _M3(client_hello, server_hello,
- hello_retry_request) }
+ { ssl_server_name_xtn, ExtensionSendEncrypted },
+ { ssl_supported_groups_xtn, ExtensionSendEncrypted },
+ { ssl_ec_point_formats_xtn, ExtensionNotUsed },
+ { ssl_signature_algorithms_xtn, ExtensionClientOnly },
+ { ssl_use_srtp_xtn, ExtensionSendEncrypted },
+ { ssl_app_layer_protocol_xtn, ExtensionSendEncrypted },
+ { ssl_padding_xtn, ExtensionNotUsed },
+ { ssl_extended_master_secret_xtn, ExtensionNotUsed },
+ { ssl_session_ticket_xtn, ExtensionClientOnly },
+ { ssl_tls13_key_share_xtn, ExtensionSendClearOrHrr },
+ { ssl_tls13_pre_shared_key_xtn, ExtensionSendClear },
+ { ssl_tls13_early_data_xtn, ExtensionSendEncrypted },
+ { ssl_next_proto_nego_xtn, ExtensionNotUsed },
+ { ssl_renegotiation_info_xtn, ExtensionNotUsed },
+ { ssl_signed_cert_timestamp_xtn, ExtensionSendCertificate },
+ { ssl_cert_status_xtn, ExtensionSendCertificate },
+ { ssl_tls13_ticket_early_data_info_xtn, ExtensionNewSessionTicket },
+ { ssl_tls13_cookie_xtn, ExtensionSendHrr },
+ { ssl_tls13_short_header_xtn, ExtensionSendClear }
};
-tls13ExtensionStatus
-tls13_ExtensionStatus(PRUint16 extension, SSLHandshakeType message)
+PRBool
+tls13_ExtensionAllowed(PRUint16 extension, SSL3HandshakeType message)
{
unsigned int i;
- PORT_Assert((message == ssl_hs_client_hello) ||
- (message == ssl_hs_server_hello) ||
- (message == ssl_hs_hello_retry_request) ||
- (message == ssl_hs_encrypted_extensions) ||
- (message == ssl_hs_new_session_ticket) ||
- (message == ssl_hs_certificate) ||
- (message == ssl_hs_certificate_request));
+ PORT_Assert((message == client_hello) ||
+ (message == server_hello) ||
+ (message == hello_retry_request) ||
+ (message == encrypted_extensions) ||
+ (message == new_session_ticket) ||
+ (message == certificate) ||
+ (message == certificate_request));
for (i = 0; i < PR_ARRAY_SIZE(KnownExtensions); i++) {
- /* Hacky check for message numbers > 30. */
- PORT_Assert(!(KnownExtensions[i].messages & (1U << 31)));
- if (KnownExtensions[i].ex_value == extension) {
+ if (KnownExtensions[i].ex_value == extension)
break;
- }
}
- if (i >= PR_ARRAY_SIZE(KnownExtensions)) {
- return tls13_extension_unknown;
+ if (i == PR_ARRAY_SIZE(KnownExtensions)) {
+ /* We have never heard of this extension which is OK
+ * in client_hello and new_session_ticket. */
+ return (message == client_hello) ||
+ (message == new_session_ticket);
+ }
+
+ switch (KnownExtensions[i].status) {
+ case ExtensionNotUsed:
+ return PR_FALSE;
+ case ExtensionClientOnly:
+ return message == client_hello;
+ case ExtensionSendClear:
+ return message == client_hello ||
+ message == server_hello;
+ case ExtensionSendClearOrHrr:
+ return message == client_hello ||
+ message == server_hello ||
+ message == hello_retry_request;
+ case ExtensionSendHrr:
+ return message == client_hello ||
+ message == hello_retry_request;
+ case ExtensionSendEncrypted:
+ return message == client_hello ||
+ message == encrypted_extensions;
+ case ExtensionNewSessionTicket:
+ return message == new_session_ticket;
+ case ExtensionSendCertificate:
+ return message == client_hello ||
+ message == certificate;
}
- /* Return "disallowed" if the message mask bit isn't set. */
- if (!(_M(message) & KnownExtensions[i].messages)) {
- SSL_TRC(3, ("%d: TLS13: unexpected extension %d in message %d",
- SSL_GETPID(), extension, message));
-
- return tls13_extension_disallowed;
- }
+ PORT_Assert(0);
- return tls13_extension_allowed;
+ /* Not reached */
+ return PR_TRUE;
}
-#undef _M
-#undef _M1
-#undef _M2
-#undef _M3
-
/* TLS 1.3 doesn't actually have additional data but the aead function
* signature overloads additional data to carry the record sequence
* number and that's what we put here. The TLS 1.3 AEAD functions
* just use this input as the sequence number and not as additional
* data. */
-static SECStatus
-tls13_FormatAdditionalData(sslSocket *ss, PRUint8 *aad, unsigned int length,
- DTLSEpoch epoch, sslSequenceNumber seqNum)
+static void
+tls13_FormatAdditionalData(PRUint8 *aad, unsigned int length,
+ sslSequenceNumber seqNum)
{
- SECStatus rv;
- sslBuffer buf = SSL_BUFFER_FIXED(aad, length);
+ PRUint8 *ptr = aad;
PORT_Assert(length == 8);
- if (IS_DTLS(ss)) {
- rv = sslBuffer_AppendNumber(&buf, epoch, 2);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- }
- rv = sslBuffer_AppendNumber(&buf, seqNum, IS_DTLS(ss) ? 6 : 8);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- return SECSuccess;
+ ptr = ssl_EncodeUintX(seqNum, 8, ptr);
+ PORT_Assert((ptr - aad) == length);
}
PRInt32
@@ -4842,14 +4127,13 @@ tls13_ProtectRecord(sslSocket *ss,
PRUint32 contentLen,
sslBuffer *wrBuf)
{
- const ssl3BulkCipherDef *cipher_def = cwSpec->cipherDef;
+ const ssl3BulkCipherDef *cipher_def = cwSpec->cipher_def;
const int tagLen = cipher_def->tag_size;
SECStatus rv;
- PORT_Assert(cwSpec->direction == CipherSpecWrite);
- SSL_TRC(3, ("%d: TLS13[%d]: spec=%d epoch=%d (%s) protect 0x%0llx len=%u",
- SSL_GETPID(), ss->fd, cwSpec, cwSpec->epoch, cwSpec->phase,
- cwSpec->seqNum, contentLen));
+ SSL_TRC(3, ("%d: TLS13[%d]: spec=%d (%s) protect record 0x%0llx len=%u",
+ SSL_GETPID(), ss->fd, cwSpec, cwSpec->phase,
+ cwSpec->write_seq_num, contentLen));
if (contentLen + 1 + tagLen > wrBuf->space) {
PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
@@ -4870,18 +4154,15 @@ tls13_ProtectRecord(sslSocket *ss,
/* Add the content type at the end. */
wrBuf->buf[contentLen] = type;
- rv = tls13_FormatAdditionalData(ss, aad, sizeof(aad), cwSpec->epoch,
- cwSpec->seqNum);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- rv = cwSpec->aead(&cwSpec->keyMaterial,
- PR_FALSE, /* do encrypt */
- wrBuf->buf, /* output */
- (int *)&wrBuf->len, /* out len */
- wrBuf->space, /* max out */
- wrBuf->buf, contentLen + 1, /* input */
- aad, sizeof(aad));
+ tls13_FormatAdditionalData(aad, sizeof(aad), cwSpec->write_seq_num);
+ rv = cwSpec->aead(
+ ss->sec.isServer ? &cwSpec->server : &cwSpec->client,
+ PR_FALSE, /* do encrypt */
+ wrBuf->buf, /* output */
+ (int *)&wrBuf->len, /* out len */
+ wrBuf->space, /* max out */
+ wrBuf->buf, contentLen + 1, /* input */
+ aad, sizeof(aad));
if (rv != SECSuccess) {
PORT_SetError(SSL_ERROR_ENCRYPTION_FAILURE);
return SECFailure;
@@ -4901,27 +4182,19 @@ tls13_ProtectRecord(sslSocket *ss,
* 2. Call PORT_SetError() witn an appropriate code.
*/
SECStatus
-tls13_UnprotectRecord(sslSocket *ss,
- ssl3CipherSpec *spec,
- SSL3Ciphertext *cText, sslBuffer *plaintext,
+tls13_UnprotectRecord(sslSocket *ss, SSL3Ciphertext *cText, sslBuffer *plaintext,
SSL3AlertDescription *alert)
{
- const ssl3BulkCipherDef *cipher_def = spec->cipherDef;
- sslSequenceNumber seqNum;
+ ssl3CipherSpec *crSpec = ss->ssl3.crSpec;
+ const ssl3BulkCipherDef *cipher_def = crSpec->cipher_def;
PRUint8 aad[8];
SECStatus rv;
*alert = bad_record_mac; /* Default alert for most issues. */
- PORT_Assert(spec->direction == CipherSpecRead);
- if (IS_DTLS(ss)) {
- seqNum = cText->seq_num & RECORD_SEQ_MASK;
- } else {
- seqNum = spec->seqNum;
- }
- SSL_TRC(3, ("%d: TLS13[%d]: spec=%d epoch=%d (%s) unprotect 0x%0llx len=%u",
- SSL_GETPID(), ss->fd, spec, spec->epoch, spec->phase, seqNum,
- cText->buf->len));
+ SSL_TRC(3, ("%d: TLS13[%d]: spec=%d (%s) unprotect record 0x%0llx len=%u",
+ SSL_GETPID(), ss->fd, crSpec, crSpec->phase,
+ crSpec->read_seq_num, cText->buf->len));
/* We can perform this test in variable time because the record's total
* length and the ciphersuite are both public knowledge. */
@@ -4943,8 +4216,9 @@ tls13_UnprotectRecord(sslSocket *ss,
return SECFailure;
}
- /* Check the version number in the record. */
- if (cText->version != spec->recordVersion) {
+ /* Check the version number in the record */
+ if ((IS_DTLS(ss) && cText->version != kDtlsRecordVersion) ||
+ (!IS_DTLS(ss) && cText->version != kTlsRecordVersion)) {
/* Do we need a better error here? */
SSL_TRC(3,
("%d: TLS13[%d]: record has bogus version",
@@ -4954,18 +4228,18 @@ tls13_UnprotectRecord(sslSocket *ss,
/* Decrypt */
PORT_Assert(cipher_def->type == type_aead);
- rv = tls13_FormatAdditionalData(ss, aad, sizeof(aad), spec->epoch, seqNum);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- rv = spec->aead(&spec->keyMaterial,
- PR_TRUE, /* do decrypt */
- plaintext->buf, /* out */
- (int *)&plaintext->len, /* outlen */
- plaintext->space, /* maxout */
- cText->buf->buf, /* in */
- cText->buf->len, /* inlen */
- aad, sizeof(aad));
+ tls13_FormatAdditionalData(aad, sizeof(aad),
+ IS_DTLS(ss) ? cText->seq_num
+ : crSpec->read_seq_num);
+ rv = crSpec->aead(
+ ss->sec.isServer ? &crSpec->client : &crSpec->server,
+ PR_TRUE, /* do decrypt */
+ plaintext->buf, /* out */
+ (int *)&plaintext->len, /* outlen */
+ plaintext->space, /* maxout */
+ cText->buf->buf, /* in */
+ cText->buf->len, /* inlen */
+ aad, sizeof(aad));
if (rv != SECSuccess) {
SSL_TRC(3,
("%d: TLS13[%d]: record has bogus MAC",
@@ -4997,14 +4271,14 @@ tls13_UnprotectRecord(sslSocket *ss,
--plaintext->len;
/* Check that we haven't received too much 0-RTT data. */
- if (spec->epoch == TrafficKeyEarlyApplicationData &&
+ if (crSpec->epoch == TrafficKeyEarlyApplicationData &&
cText->type == content_application_data) {
- if (plaintext->len > spec->earlyDataRemaining) {
+ if (plaintext->len > crSpec->earlyDataRemaining) {
*alert = unexpected_message;
PORT_SetError(SSL_ERROR_TOO_MUCH_EARLY_DATA);
return SECFailure;
}
- spec->earlyDataRemaining -= plaintext->len;
+ crSpec->earlyDataRemaining -= plaintext->len;
}
SSL_TRC(10,
@@ -5052,7 +4326,7 @@ tls13_MaybeDo0RTTHandshake(sslSocket *ss)
/* Don't do anything if there is no early_data xtn, which means we're
* not doing early data. */
- if (!ssl3_ExtensionAdvertised(ss, ssl_tls13_early_data_xtn)) {
+ if (!ssl3_ClientExtensionAdvertised(ss, ssl_tls13_early_data_xtn)) {
return SECSuccess;
}
@@ -5067,41 +4341,25 @@ tls13_MaybeDo0RTTHandshake(sslSocket *ss)
ss->xtnData.nextProtoState = SSL_NEXT_PROTO_EARLY_VALUE;
rv = SECITEM_CopyItem(NULL, &ss->xtnData.nextProto,
&ss->sec.ci.sid->u.ssl3.alpnSelection);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- }
-
- if (ss->opt.enableTls13CompatMode && !IS_DTLS(ss)) {
- /* Pretend that this is a proper ChangeCipherSpec even though it is sent
- * before receiving the ServerHello. */
- ssl_GetSpecWriteLock(ss);
- tls13_SetSpecRecordVersion(ss, ss->ssl3.cwSpec);
- ssl_ReleaseSpecWriteLock(ss);
- ssl_GetXmitBufLock(ss);
- rv = ssl3_SendChangeCipherSpecsInt(ss);
- ssl_ReleaseXmitBufLock(ss);
- if (rv != SECSuccess) {
- return SECFailure;
- }
+ if (rv != SECSuccess)
+ return rv;
}
/* Cipher suite already set in tls13_SetupClientHello. */
ss->ssl3.hs.preliminaryInfo = 0;
- rv = tls13_DeriveEarlySecrets(ss);
- if (rv != SECSuccess) {
+ rv = tls13_DeriveSecret(ss, ss->ssl3.hs.currentSecret,
+ kHkdfLabelClient,
+ kHkdfLabelEarlyTrafficSecret,
+ NULL,
+ &ss->ssl3.hs.clientEarlyTrafficSecret);
+ if (rv != SECSuccess)
return SECFailure;
- }
-
- /* Save cwSpec in case we get a HelloRetryRequest and have to send another
- * ClientHello. */
- ssl_CipherSpecAddRef(ss->ssl3.cwSpec);
rv = tls13_SetCipherSpec(ss, TrafficKeyEarlyApplicationData,
CipherSpecWrite, PR_TRUE);
if (rv != SECSuccess) {
- return SECFailure;
+ return rv;
}
return SECSuccess;
@@ -5134,45 +4392,32 @@ tls13_SendEndOfEarlyData(sslSocket *ss)
{
SECStatus rv;
- SSL_TRC(3, ("%d: TLS13[%d]: send EndOfEarlyData", SSL_GETPID(), ss->fd));
- PORT_Assert(ss->opt.noLocks || ssl_HaveXmitBufLock(ss));
+ SSL_TRC(3, ("%d: TLS13[%d]: send end_of_early_data extension",
+ SSL_GETPID(), ss->fd));
- rv = ssl3_AppendHandshakeHeader(ss, ssl_hs_end_of_early_data, 0);
+ rv = SSL3_SendAlert(ss, alert_warning, end_of_early_data);
if (rv != SECSuccess) {
- return rv; /* err set by AppendHandshake. */
+ FATAL_ERROR(ss, SEC_ERROR_LIBRARY_FAILURE, internal_error);
+ return SECFailure;
}
ss->ssl3.hs.zeroRttState = ssl_0rtt_done;
return SECSuccess;
}
-static SECStatus
-tls13_HandleEndOfEarlyData(sslSocket *ss, PRUint8 *b, PRUint32 length)
+SECStatus
+tls13_HandleEndOfEarlyData(sslSocket *ss)
{
SECStatus rv;
- PORT_Assert(ss->version >= SSL_LIBRARY_VERSION_TLS_1_3);
-
- rv = TLS13_CHECK_HS_STATE(ss, SSL_ERROR_RX_UNEXPECTED_END_OF_EARLY_DATA,
- wait_end_of_early_data);
- if (rv != SECSuccess) {
+ if (ss->version < SSL_LIBRARY_VERSION_TLS_1_3 ||
+ ss->ssl3.hs.zeroRttState != ssl_0rtt_accepted) {
+ (void)SSL3_SendAlert(ss, alert_fatal, unexpected_message);
+ PORT_SetError(SSL_ERROR_END_OF_EARLY_DATA_ALERT);
return SECFailure;
}
- /* We shouldn't be getting any more early data, and if we do,
- * it is because of reordering and we drop it. */
- if (IS_DTLS(ss)) {
- ssl_CipherSpecReleaseByEpoch(ss, CipherSpecRead,
- TrafficKeyEarlyApplicationData);
- dtls_ReceivedFirstMessageInFlight(ss);
- }
-
- PORT_Assert(ss->ssl3.hs.zeroRttState == ssl_0rtt_accepted);
-
- if (length) {
- FATAL_ERROR(ss, SSL_ERROR_RX_MALFORMED_END_OF_EARLY_DATA, decode_error);
- return SECFailure;
- }
+ PORT_Assert(TLS13_IN_HS_STATE(ss, ss->opt.requestCertificate ? wait_client_cert : wait_finished));
rv = tls13_SetCipherSpec(ss, TrafficKeyHandshake,
CipherSpecRead, PR_FALSE);
@@ -5182,9 +4427,6 @@ tls13_HandleEndOfEarlyData(sslSocket *ss, PRUint8 *b, PRUint32 length)
}
ss->ssl3.hs.zeroRttState = ssl_0rtt_done;
- TLS13_SET_HS_STATE(ss,
- ss->opt.requestCertificate ? wait_client_cert
- : wait_finished);
return SECSuccess;
}
@@ -5235,11 +4477,11 @@ tls13_EncodeDraftVersion(SSL3ProtocolVersion version)
/* Pick the highest version we support that is also advertised. */
SECStatus
-tls13_NegotiateVersion(sslSocket *ss, const TLSExtension *supportedVersions)
+tls13_NegotiateVersion(sslSocket *ss, const TLSExtension *supported_versions)
{
PRUint16 version;
- /* Make a copy so we're nondestructive. */
- SECItem data = supportedVersions->data;
+ /* Make a copy so we're nondestructive*/
+ SECItem data = supported_versions->data;
SECItem versions;
SECStatus rv;
@@ -5269,22 +4511,3 @@ tls13_NegotiateVersion(sslSocket *ss, const TLSExtension *supportedVersions)
FATAL_ERROR(ss, SSL_ERROR_UNSUPPORTED_VERSION, protocol_version);
return SECFailure;
}
-
-/* This is TLS 1.3 or might negotiate to it. */
-PRBool
-tls13_MaybeTls13(sslSocket *ss)
-{
- if (ss->version >= SSL_LIBRARY_VERSION_TLS_1_3) {
- return PR_TRUE;
- }
-
- if (ss->vrange.max < SSL_LIBRARY_VERSION_TLS_1_3) {
- return PR_FALSE;
- }
-
- if (!(ss->ssl3.hs.preliminaryInfo & ssl_preinfo_version)) {
- return PR_TRUE;
- }
-
- return PR_FALSE;
-}
diff --git a/security/nss/lib/ssl/tls13con.h b/security/nss/lib/ssl/tls13con.h
index 1aaffb651d..92eb545b00 100644
--- a/security/nss/lib/ssl/tls13con.h
+++ b/security/nss/lib/ssl/tls13con.h
@@ -9,25 +9,15 @@
#ifndef __tls13con_h_
#define __tls13con_h_
-#include "sslexp.h"
-#include "sslspec.h"
-
-typedef enum {
- tls13_extension_allowed,
- tls13_extension_disallowed,
- tls13_extension_unknown
-} tls13ExtensionStatus;
-
typedef enum {
- update_not_requested = 0,
- update_requested = 1
-} tls13KeyUpdateRequest;
+ StaticSharedSecret,
+ EphemeralSharedSecret
+} SharedSecretType;
#define TLS13_MAX_FINISHED_SIZE 64
SECStatus tls13_UnprotectRecord(
- sslSocket *ss, ssl3CipherSpec *spec,
- SSL3Ciphertext *cText, sslBuffer *plaintext,
+ sslSocket *ss, SSL3Ciphertext *cText, sslBuffer *plaintext,
SSL3AlertDescription *alert);
#if defined(WIN32)
@@ -51,14 +41,6 @@ SSLHashType tls13_GetHash(const sslSocket *ss);
unsigned int tls13_GetHashSizeForHash(SSLHashType hash);
unsigned int tls13_GetHashSize(const sslSocket *ss);
CK_MECHANISM_TYPE tls13_GetHkdfMechanism(sslSocket *ss);
-SECStatus tls13_ComputeHash(sslSocket *ss, SSL3Hashes *hashes,
- const PRUint8 *buf, unsigned int len);
-SECStatus tls13_ComputeHandshakeHashes(sslSocket *ss,
- SSL3Hashes *hashes);
-SECStatus tls13_DeriveSecretNullHash(sslSocket *ss, PK11SymKey *key,
- const char *label,
- unsigned int labelLen,
- PK11SymKey **dest);
void tls13_FatalError(sslSocket *ss, PRErrorCode prError,
SSL3AlertDescription desc);
SECStatus tls13_SetupClientHello(sslSocket *ss);
@@ -67,30 +49,27 @@ PRInt32 tls13_LimitEarlyData(sslSocket *ss, SSL3ContentType type, PRInt32 toSend
PRBool tls13_AllowPskCipher(const sslSocket *ss,
const ssl3CipherSuiteDef *cipher_def);
PRBool tls13_PskSuiteEnabled(sslSocket *ss);
-SECStatus tls13_WriteExtensionsWithBinder(sslSocket *ss, sslBuffer *extensions);
+SECStatus tls13_ComputePskBinder(sslSocket *ss, PRBool sending,
+ unsigned int prefixLength,
+ PRUint8 *output, unsigned int *outputLen,
+ unsigned int maxOutputLen);
SECStatus tls13_HandleClientHelloPart2(sslSocket *ss,
const SECItem *suites,
- sslSessionID *sid,
- const PRUint8 *msg,
- unsigned int len);
+ sslSessionID *sid);
SECStatus tls13_HandleServerHelloPart2(sslSocket *ss);
SECStatus tls13_HandlePostHelloHandshakeMessage(sslSocket *ss, PRUint8 *b,
- PRUint32 length);
-SECStatus tls13_ConstructHelloRetryRequest(sslSocket *ss,
- ssl3CipherSuite cipherSuite,
- const sslNamedGroupDef *selectedGroup,
- PRUint8 *cookie,
- unsigned int cookieLen,
- sslBuffer *buffer);
-SECStatus tls13_HandleHelloRetryRequest(sslSocket *ss, const PRUint8 *b,
+ PRUint32 length,
+ SSL3Hashes *hashesPtr);
+SECStatus tls13_HandleHelloRetryRequest(sslSocket *ss, PRUint8 *b,
PRUint32 length);
void tls13_DestroyKeyShareEntry(TLS13KeyShareEntry *entry);
void tls13_DestroyKeyShares(PRCList *list);
SECStatus tls13_CreateKeyShare(sslSocket *ss, const sslNamedGroupDef *groupDef);
void tls13_DestroyEarlyData(PRCList *list);
-SECStatus tls13_SetAlertCipherSpec(sslSocket *ss);
-tls13ExtensionStatus tls13_ExtensionStatus(PRUint16 extension,
- SSLHandshakeType message);
+void tls13_CipherSpecAddRef(ssl3CipherSpec *spec);
+void tls13_CipherSpecRelease(ssl3CipherSpec *spec);
+void tls13_DestroyCipherSpecs(PRCList *list);
+PRBool tls13_ExtensionAllowed(PRUint16 extension, SSL3HandshakeType message);
SECStatus tls13_ProtectRecord(sslSocket *ss,
ssl3CipherSpec *cwSpec,
SSL3ContentType type,
@@ -98,25 +77,13 @@ SECStatus tls13_ProtectRecord(sslSocket *ss,
PRUint32 contentLen,
sslBuffer *wrBuf);
PRInt32 tls13_Read0RttData(sslSocket *ss, void *buf, PRInt32 len);
+SECStatus tls13_HandleEndOfEarlyData(sslSocket *ss);
SECStatus tls13_HandleEarlyApplicationData(sslSocket *ss, sslBuffer *origBuf);
PRBool tls13_ClientAllow0Rtt(const sslSocket *ss, const sslSessionID *sid);
PRUint16 tls13_EncodeDraftVersion(SSL3ProtocolVersion version);
+PRUint16 tls13_DecodeDraftVersion(PRUint16 version);
SECStatus tls13_NegotiateVersion(sslSocket *ss,
const TLSExtension *supported_versions);
-
-PRBool tls13_IsReplay(const sslSocket *ss, const sslSessionID *sid);
-void tls13_AntiReplayRollover(PRTime now);
-
-SECStatus SSLExp_SetupAntiReplay(PRTime window, unsigned int k,
- unsigned int bits);
-
-SECStatus SSLExp_HelloRetryRequestCallback(PRFileDesc *fd,
- SSLHelloRetryRequestCallback cb,
- void *arg);
-SECStatus tls13_SendKeyUpdate(sslSocket *ss, tls13KeyUpdateRequest request,
- PRBool buffer);
-SECStatus SSLExp_KeyUpdate(PRFileDesc *fd, PRBool requestUpdate);
-PRBool tls13_MaybeTls13(sslSocket *ss);
-void tls13_SetSpecRecordVersion(sslSocket *ss, ssl3CipherSpec *spec);
+SECStatus tls13_SendNewSessionTicket(sslSocket *ss);
#endif /* __tls13con_h_ */
diff --git a/security/nss/lib/ssl/tls13err.h b/security/nss/lib/ssl/tls13err.h
deleted file mode 100644
index 8cdeb12eb2..0000000000
--- a/security/nss/lib/ssl/tls13err.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is PRIVATE to SSL.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef __tls13err_h_
-#define __tls13err_h_
-
-/* Use this instead of FATAL_ERROR when an alert isn't possible. */
-#define LOG_ERROR(ss, prError) \
- do { \
- SSL_TRC(3, ("%d: TLS13[%d]: fatal error %d in %s (%s:%d)", \
- SSL_GETPID(), ss->fd, prError, __func__, __FILE__, __LINE__)); \
- PORT_SetError(prError); \
- } while (0)
-
-/* Log an error and generate an alert because something is irreparably wrong. */
-#define FATAL_ERROR(ss, prError, desc) \
- do { \
- LOG_ERROR(ss, prError); \
- tls13_FatalError(ss, prError, desc); \
- } while (0)
-
-void tls13_FatalError(sslSocket *ss, PRErrorCode prError, SSL3AlertDescription desc);
-#endif
diff --git a/security/nss/lib/ssl/tls13exthandle.c b/security/nss/lib/ssl/tls13exthandle.c
index 899f238276..c2ce390fff 100644
--- a/security/nss/lib/ssl/tls13exthandle.c
+++ b/security/nss/lib/ssl/tls13exthandle.c
@@ -14,35 +14,50 @@
#include "ssl3exthandle.h"
#include "tls13exthandle.h"
-SECStatus
-tls13_ServerSendStatusRequestXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
+PRInt32
+tls13_ServerSendStatusRequestXtn(
+ const sslSocket *ss,
+ TLSExtensionData *xtnData,
+ PRBool append,
+ PRUint32 maxBytes)
{
+ PRInt32 extension_length;
const sslServerCert *serverCert = ss->sec.serverCert;
const SECItem *item;
SECStatus rv;
if (!serverCert->certStatusArray ||
!serverCert->certStatusArray->len) {
- return SECSuccess;
+ return 0;
}
item = &serverCert->certStatusArray->items[0];
/* Only send the first entry. */
- /* status_type == ocsp */
- rv = sslBuffer_AppendNumber(buf, 1 /*ocsp*/, 1);
- if (rv != SECSuccess) {
- return SECFailure;
+ extension_length = 2 + 2 + 1 /* status_type */ + 3 + item->len;
+ if (maxBytes < (PRUint32)extension_length) {
+ return 0;
}
- /* opaque OCSPResponse<1..2^24-1> */
- rv = sslBuffer_AppendVariable(buf, item->data, item->len, 3);
- if (rv != SECSuccess) {
- return SECFailure;
+ if (append) {
+ /* extension_type */
+ rv = ssl3_ExtAppendHandshakeNumber(ss, ssl_cert_status_xtn, 2);
+ if (rv != SECSuccess)
+ return -1;
+ /* length of extension_data */
+ rv = ssl3_ExtAppendHandshakeNumber(ss, extension_length - 4, 2);
+ if (rv != SECSuccess)
+ return -1;
+ /* status_type == ocsp */
+ rv = ssl3_ExtAppendHandshakeNumber(ss, 1 /*ocsp*/, 1);
+ if (rv != SECSuccess)
+ return rv; /* err set by AppendHandshake. */
+ /* opaque OCSPResponse<1..2^24-1> */
+ rv = ssl3_ExtAppendHandshakeVariable(ss, item->data, item->len, 3);
+ if (rv != SECSuccess)
+ return rv; /* err set by AppendHandshake. */
}
- *added = PR_TRUE;
- return SECSuccess;
+ return extension_length;
}
/*
@@ -86,27 +101,41 @@ tls13_SizeOfKeyShareEntry(const SECKEYPublicKey *pubKey)
return 0;
}
+static PRUint32
+tls13_SizeOfClientKeyShareExtension(const sslSocket *ss)
+{
+ PRCList *cursor;
+ /* Size is: extension(2) + extension_len(2) + client_shares(2) */
+ PRUint32 size = 2 + 2 + 2;
+ for (cursor = PR_NEXT_LINK(&ss->ephemeralKeyPairs);
+ cursor != &ss->ephemeralKeyPairs;
+ cursor = PR_NEXT_LINK(cursor)) {
+ sslEphemeralKeyPair *keyPair = (sslEphemeralKeyPair *)cursor;
+ size += tls13_SizeOfKeyShareEntry(keyPair->keys->pubKey);
+ }
+ return size;
+}
+
static SECStatus
-tls13_EncodeKeyShareEntry(sslBuffer *buf, const sslEphemeralKeyPair *keyPair)
+tls13_EncodeKeyShareEntry(const sslSocket *ss, const sslEphemeralKeyPair *keyPair)
{
SECStatus rv;
SECKEYPublicKey *pubKey = keyPair->keys->pubKey;
unsigned int size = tls13_SizeOfKeyShareEntry(pubKey);
- rv = sslBuffer_AppendNumber(buf, keyPair->group->name, 2);
+ rv = ssl3_ExtAppendHandshakeNumber(ss, keyPair->group->name, 2);
if (rv != SECSuccess)
return rv;
- rv = sslBuffer_AppendNumber(buf, size - 4, 2);
+ rv = ssl3_ExtAppendHandshakeNumber(ss, size - 4, 2);
if (rv != SECSuccess)
return rv;
switch (pubKey->keyType) {
case ecKey:
- rv = sslBuffer_Append(buf, pubKey->u.ec.publicValue.data,
- pubKey->u.ec.publicValue.len);
+ rv = tls13_EncodeECDHEKeyShareKEX(ss, pubKey);
break;
case dhKey:
- rv = ssl_AppendPaddedDHKeyShare(buf, pubKey, PR_FALSE);
+ rv = ssl_AppendPaddedDHKeyShare(ss, pubKey, PR_FALSE);
break;
default:
PORT_Assert(0);
@@ -117,16 +146,14 @@ tls13_EncodeKeyShareEntry(sslBuffer *buf, const sslEphemeralKeyPair *keyPair)
return rv;
}
-SECStatus
-tls13_ClientSendKeyShareXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
+PRInt32
+tls13_ClientSendKeyShareXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRBool append,
+ PRUint32 maxBytes)
{
- SECStatus rv;
- PRCList *cursor;
- unsigned int lengthOffset;
+ PRUint32 extension_length;
if (ss->vrange.max < SSL_LIBRARY_VERSION_TLS_1_3) {
- return SECSuccess;
+ return 0;
}
/* Optimistically try to send an ECDHE key using the
@@ -134,28 +161,47 @@ tls13_ClientSendKeyShareXtn(const sslSocket *ss, TLSExtensionData *xtnData,
SSL_TRC(3, ("%d: TLS13[%d]: send client key share xtn",
SSL_GETPID(), ss->fd));
- /* Save the offset to the length. */
- rv = sslBuffer_Skip(buf, 2, &lengthOffset);
- if (rv != SECSuccess) {
- return SECFailure;
+ extension_length = tls13_SizeOfClientKeyShareExtension(ss);
+ if (maxBytes < extension_length) {
+ PORT_Assert(0);
+ return 0;
}
- for (cursor = PR_NEXT_LINK(&ss->ephemeralKeyPairs);
- cursor != &ss->ephemeralKeyPairs;
- cursor = PR_NEXT_LINK(cursor)) {
- sslEphemeralKeyPair *keyPair = (sslEphemeralKeyPair *)cursor;
- rv = tls13_EncodeKeyShareEntry(buf, keyPair);
- if (rv != SECSuccess) {
- return SECFailure;
+ if (append) {
+ SECStatus rv;
+ PRCList *cursor;
+
+ rv = ssl3_ExtAppendHandshakeNumber(ss, ssl_tls13_key_share_xtn, 2);
+ if (rv != SECSuccess)
+ goto loser;
+
+ /* The extension length */
+ rv = ssl3_ExtAppendHandshakeNumber(ss, extension_length - 4, 2);
+ if (rv != SECSuccess)
+ goto loser;
+
+ /* The length of KeyShares */
+ rv = ssl3_ExtAppendHandshakeNumber(ss, extension_length - 6, 2);
+ if (rv != SECSuccess)
+ goto loser;
+
+ for (cursor = PR_NEXT_LINK(&ss->ephemeralKeyPairs);
+ cursor != &ss->ephemeralKeyPairs;
+ cursor = PR_NEXT_LINK(cursor)) {
+ sslEphemeralKeyPair *keyPair = (sslEphemeralKeyPair *)cursor;
+ rv = tls13_EncodeKeyShareEntry(ss, keyPair);
+ if (rv != SECSuccess)
+ goto loser;
}
- }
- rv = sslBuffer_InsertLength(buf, lengthOffset, 2);
- if (rv != SECSuccess) {
- return SECFailure;
+
+ xtnData->advertised[xtnData->numAdvertised++] =
+ ssl_tls13_key_share_xtn;
}
- *added = PR_TRUE;
- return SECSuccess;
+ return extension_length;
+
+loser:
+ return -1;
}
static SECStatus
@@ -204,8 +250,7 @@ loser:
* |xtnData->remoteKeyShares| for future use. The key
* share is processed in tls13_HandleServerKeyShare(). */
SECStatus
-tls13_ClientHandleKeyShareXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- SECItem *data)
+tls13_ClientHandleKeyShareXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type, SECItem *data)
{
SECStatus rv;
PORT_Assert(PR_CLIST_IS_EMPTY(&xtnData->remoteKeyShares));
@@ -236,8 +281,7 @@ tls13_ClientHandleKeyShareXtn(const sslSocket *ss, TLSExtensionData *xtnData,
}
SECStatus
-tls13_ClientHandleKeyShareXtnHrr(const sslSocket *ss, TLSExtensionData *xtnData,
- SECItem *data)
+tls13_ClientHandleKeyShareXtnHrr(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type, SECItem *data)
{
SECStatus rv;
PRUint32 tmp;
@@ -287,8 +331,7 @@ tls13_ClientHandleKeyShareXtnHrr(const sslSocket *ss, TLSExtensionData *xtnData,
* |xtnData->remoteKeyShares| for future use. The key
* share is processed in tls13_HandleClientKeyShare(). */
SECStatus
-tls13_ServerHandleKeyShareXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- SECItem *data)
+tls13_ServerHandleKeyShareXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type, SECItem *data)
{
SECStatus rv;
PRUint32 length;
@@ -321,6 +364,16 @@ tls13_ServerHandleKeyShareXtn(const sslSocket *ss, TLSExtensionData *xtnData,
goto loser;
}
+ /* Check that the client only offered one share if this is
+ * after HRR. */
+ if (ss->ssl3.hs.helloRetry) {
+ if (PR_PREV_LINK(&xtnData->remoteKeyShares) !=
+ PR_NEXT_LINK(&xtnData->remoteKeyShares)) {
+ PORT_SetError(SSL_ERROR_RX_MALFORMED_CLIENT_HELLO);
+ goto loser;
+ }
+ }
+
return SECSuccess;
loser:
@@ -328,10 +381,12 @@ loser:
return SECFailure;
}
-SECStatus
-tls13_ServerSendKeyShareXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
+PRInt32
+tls13_ServerSendKeyShareXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRBool append,
+ PRUint32 maxBytes)
{
+ PRUint32 extension_length;
+ PRUint32 entry_length;
SECStatus rv;
sslEphemeralKeyPair *keyPair;
@@ -342,13 +397,31 @@ tls13_ServerSendKeyShareXtn(const sslSocket *ss, TLSExtensionData *xtnData,
keyPair = (sslEphemeralKeyPair *)PR_NEXT_LINK(&ss->ephemeralKeyPairs);
- rv = tls13_EncodeKeyShareEntry(buf, keyPair);
- if (rv != SECSuccess) {
- return SECFailure;
+ entry_length = tls13_SizeOfKeyShareEntry(keyPair->keys->pubKey);
+ extension_length = 2 + 2 + entry_length; /* Type + length + entry_length */
+ if (maxBytes < extension_length) {
+ PORT_Assert(0);
+ return 0;
}
- *added = PR_TRUE;
- return SECSuccess;
+ if (append) {
+ rv = ssl3_ExtAppendHandshakeNumber(ss, ssl_tls13_key_share_xtn, 2);
+ if (rv != SECSuccess)
+ goto loser;
+
+ rv = ssl3_ExtAppendHandshakeNumber(ss, entry_length, 2);
+ if (rv != SECSuccess)
+ goto loser;
+
+ rv = tls13_EncodeKeyShareEntry(ss, keyPair);
+ if (rv != SECSuccess)
+ goto loser;
+ }
+
+ return extension_length;
+
+loser:
+ return -1;
}
/* Called by clients.
@@ -375,83 +448,113 @@ tls13_ServerSendKeyShareXtn(const sslSocket *ss, TLSExtensionData *xtnData,
* Presently the only way to get a PSK is by resumption, so this is
* really a ticket label and there will be at most one.
*/
-SECStatus
+PRInt32
tls13_ClientSendPreSharedKeyXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
+ PRBool append,
+ PRUint32 maxBytes)
{
+ PRInt32 extension_length;
+ PRInt32 identities_length;
+ PRInt32 binders_length;
NewSessionTicket *session_ticket;
- PRTime age;
- const static PRUint8 binder[TLS13_MAX_FINISHED_SIZE] = { 0 };
- unsigned int binderLen;
- SECStatus rv;
/* We only set statelessResume on the client in TLS 1.3 code. */
- if (!ss->statelessResume) {
- return SECSuccess;
- }
-
- /* Save where this extension starts so that if we have to add padding, it
- * can be inserted before this extension. */
- PORT_Assert(buf->len >= 4);
- xtnData->lastXtnOffset = buf->len - 4;
+ if (!ss->statelessResume)
+ return 0;
PORT_Assert(ss->vrange.max >= SSL_LIBRARY_VERSION_TLS_1_3);
- /* Send a single ticket identity. */
+ /* The length computations are simplified by the fact that there
+ * is just one ticket at most. */
session_ticket = &ss->sec.ci.sid->u.ssl3.locked.sessionTicket;
- rv = sslBuffer_AppendNumber(buf, 2 + /* identity length */
- session_ticket->ticket.len + /* ticket */
- 4 /* obfuscated_ticket_age */,
- 2);
- if (rv != SECSuccess)
- goto loser;
- rv = sslBuffer_AppendVariable(buf, session_ticket->ticket.data,
- session_ticket->ticket.len, 2);
- if (rv != SECSuccess)
- goto loser;
+ identities_length =
+ 2 + /* vector length */
+ 2 + session_ticket->ticket.len + /* identity length + ticket len */
+ 4; /* obfuscated_ticket_age */
+ binders_length =
+ 2 + /* vector length */
+ 1 + tls13_GetHashSizeForHash(
+ tls13_GetHashForCipherSuite(ss->sec.ci.sid->u.ssl3.cipherSuite));
+ extension_length =
+ 2 + 2 + /* Type + length */
+ identities_length + binders_length;
+
+ if (maxBytes < (PRUint32)extension_length) {
+ PORT_Assert(0);
+ return 0;
+ }
+
+ if (append) {
+ SECStatus rv;
+ PRTime age;
+ unsigned int prefixLength;
+ PRUint8 binder[TLS13_MAX_FINISHED_SIZE];
+ unsigned int binderLen;
+
+ /* extension_type */
+ rv = ssl3_ExtAppendHandshakeNumber(ss, ssl_tls13_pre_shared_key_xtn, 2);
+ if (rv != SECSuccess)
+ goto loser;
+ rv = ssl3_ExtAppendHandshakeNumber(ss, extension_length - 4, 2);
+ if (rv != SECSuccess)
+ goto loser;
+ rv = ssl3_ExtAppendHandshakeNumber(ss, identities_length - 2, 2);
+ if (rv != SECSuccess)
+ goto loser;
+ rv = ssl3_ExtAppendHandshakeVariable(ss, session_ticket->ticket.data,
+ session_ticket->ticket.len, 2);
+ if (rv != SECSuccess)
+ goto loser;
- /* Obfuscated age. */
- age = ssl_TimeUsec() - session_ticket->received_timestamp;
- age /= PR_USEC_PER_MSEC;
- age += session_ticket->ticket_age_add;
- rv = sslBuffer_AppendNumber(buf, age, 4);
- if (rv != SECSuccess)
- goto loser;
+ /* Obfuscated age. */
+ age = PR_Now() - session_ticket->received_timestamp;
+ age /= PR_USEC_PER_MSEC;
+ age += session_ticket->ticket_age_add;
+ rv = ssl3_ExtAppendHandshakeNumber(ss, age, 4);
+ if (rv != SECSuccess)
+ goto loser;
- /* Write out the binder list length. */
- binderLen = tls13_GetHashSize(ss);
- rv = sslBuffer_AppendNumber(buf, binderLen + 1, 2);
- if (rv != SECSuccess)
- goto loser;
- /* Write zeroes for the binder for the moment. */
- rv = sslBuffer_AppendVariable(buf, binder, binderLen, 1);
- if (rv != SECSuccess)
- goto loser;
+ /* Now the binders. */
+ prefixLength = ss->ssl3.hs.messages.len;
+ rv = tls13_ComputePskBinder(CONST_CAST(sslSocket, ss), PR_TRUE,
+ prefixLength, binder, &binderLen,
+ sizeof(binder));
+ if (rv != SECSuccess)
+ goto loser;
+ PORT_Assert(binderLen == tls13_GetHashSize(ss));
+ rv = ssl3_ExtAppendHandshakeNumber(ss, binders_length - 2, 2);
+ if (rv != SECSuccess)
+ goto loser;
+ rv = ssl3_ExtAppendHandshakeVariable(ss,
+ binder, binderLen, 1);
+ if (rv != SECSuccess)
+ goto loser;
- PRINT_BUF(50, (ss, "Sending PreSharedKey value",
- session_ticket->ticket.data,
- session_ticket->ticket.len));
+ PRINT_BUF(50, (ss, "Sending PreSharedKey value",
+ session_ticket->ticket.data,
+ session_ticket->ticket.len));
- xtnData->sentSessionTicketInClientHello = PR_TRUE;
- *added = PR_TRUE;
- return SECSuccess;
+ xtnData->sentSessionTicketInClientHello = PR_TRUE;
+ xtnData->advertised[xtnData->numAdvertised++] =
+ ssl_tls13_pre_shared_key_xtn;
+ }
+ return extension_length;
loser:
xtnData->ticketTimestampVerified = PR_FALSE;
- return SECFailure;
+ return -1;
}
/* Handle a TLS 1.3 PreSharedKey Extension. We only accept PSKs
* that contain session tickets. */
SECStatus
-tls13_ServerHandlePreSharedKeyXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+tls13_ServerHandlePreSharedKeyXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type,
SECItem *data)
{
SECItem inner;
SECStatus rv;
unsigned int numIdentities = 0;
unsigned int numBinders = 0;
- SECItem *appToken;
SSL_TRC(3, ("%d: SSL3[%d]: handle pre_shared_key extension",
SSL_GETPID(), ss->fd));
@@ -461,26 +564,16 @@ tls13_ServerHandlePreSharedKeyXtn(const sslSocket *ss, TLSExtensionData *xtnData
return SECSuccess;
}
- /* The application token is set via the cookie extension if this is the
- * second ClientHello. Don't set it twice. The cookie extension handler
- * sets |helloRetry| and that will have been called already because this
- * extension always comes last. */
- if (!ss->ssl3.hs.helloRetry) {
- appToken = &xtnData->applicationToken;
- } else {
- appToken = NULL;
- }
-
/* Parse the identities list. */
- rv = ssl3_ExtConsumeHandshakeVariable(ss, &inner, 2,
- &data->data, &data->len);
+ rv = ssl3_ExtConsumeHandshakeVariable(ss,
+ &inner, 2, &data->data, &data->len);
if (rv != SECSuccess) {
return SECFailure;
}
while (inner.len) {
SECItem label;
- PRUint32 obfuscatedAge;
+ PRUint32 utmp;
rv = ssl3_ExtConsumeHandshakeVariable(ss, &label, 2,
&inner.data, &inner.len);
@@ -490,8 +583,9 @@ tls13_ServerHandlePreSharedKeyXtn(const sslSocket *ss, TLSExtensionData *xtnData
goto alert_loser;
}
- rv = ssl3_ExtConsumeHandshakeNumber(ss, &obfuscatedAge, 4,
- &inner.data, &inner.len);
+ /* Read and discard session ticket age. Bug 1295163 */
+ rv = ssl3_ExtConsumeHandshake(ss, &utmp, 4,
+ &inner.data, &inner.len);
if (rv != SECSuccess)
return rv;
@@ -499,29 +593,17 @@ tls13_ServerHandlePreSharedKeyXtn(const sslSocket *ss, TLSExtensionData *xtnData
PRINT_BUF(50, (ss, "Handling PreSharedKey value",
label.data, label.len));
rv = ssl3_ProcessSessionTicketCommon(
- CONST_CAST(sslSocket, ss), &label, appToken);
+ CONST_CAST(sslSocket, ss), &label);
/* This only happens if we have an internal error, not
* a malformed ticket. Bogus tickets just don't resume
* and return SECSuccess. */
if (rv != SECSuccess)
return SECFailure;
-
- if (ss->sec.ci.sid) {
- /* xtnData->ticketAge contains the baseline we use for
- * calculating the ticket age (i.e., our RTT estimate less the
- * value of ticket_age_add).
- *
- * Add that to the obfuscated ticket age to recover the client's
- * view of the ticket age plus the estimated RTT.
- *
- * See ssl3_EncodeSessionTicket() for details. */
- xtnData->ticketAge += obfuscatedAge;
- }
}
++numIdentities;
}
- xtnData->pskBindersLen = data->len;
+ xtnData->pskBinderPrefixLen = ss->ssl3.hs.messages.len - data->len;
/* Parse the binders list. */
rv = ssl3_ExtConsumeHandshakeVariable(ss,
@@ -553,7 +635,7 @@ tls13_ServerHandlePreSharedKeyXtn(const sslSocket *ss, TLSExtensionData *xtnData
/* Keep track of negotiated extensions. Note that this does not
* mean we are resuming. */
- xtnData->negotiated[xtnData->numNegotiated++] = ssl_tls13_pre_shared_key_xtn;
+ xtnData->negotiated[xtnData->numNegotiated++] = ex_type;
return SECSuccess;
@@ -563,27 +645,43 @@ alert_loser:
return SECFailure;
}
-SECStatus
+PRInt32
tls13_ServerSendPreSharedKeyXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
+ PRBool append,
+ PRUint32 maxBytes)
{
+ PRInt32 extension_length =
+ 2 + 2 + 2; /* type + len + index */
SECStatus rv;
- /* We only process the first session ticket the client sends,
- * so the index is always 0. */
- rv = sslBuffer_AppendNumber(buf, 0, 2);
- if (rv != SECSuccess) {
- return SECFailure;
+ if (maxBytes < (PRUint32)extension_length) {
+ PORT_Assert(0);
+ return 0;
}
- *added = PR_TRUE;
- return SECSuccess;
+ if (append) {
+ rv = ssl3_ExtAppendHandshakeNumber(ss, ssl_tls13_pre_shared_key_xtn, 2);
+ if (rv != SECSuccess)
+ return -1;
+
+ rv = ssl3_ExtAppendHandshakeNumber(ss, 2, 2);
+ if (rv != SECSuccess)
+ return -1;
+
+ /* We only process the first session ticket the client sends,
+ * so the index is always 0. */
+ rv = ssl3_ExtAppendHandshakeNumber(ss, 0, 2);
+ if (rv != SECSuccess)
+ return -1;
+ }
+
+ return extension_length;
}
/* Handle a TLS 1.3 PreSharedKey Extension. We only accept PSKs
* that contain session tickets. */
SECStatus
-tls13_ClientHandlePreSharedKeyXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+tls13_ClientHandlePreSharedKeyXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type,
SECItem *data)
{
PRUint32 index;
@@ -615,7 +713,7 @@ tls13_ClientHandlePreSharedKeyXtn(const sslSocket *ss, TLSExtensionData *xtnData
}
/* Keep track of negotiated extensions. */
- xtnData->negotiated[xtnData->numNegotiated++] = ssl_tls13_pre_shared_key_xtn;
+ xtnData->negotiated[xtnData->numNegotiated++] = ex_type;
return SECSuccess;
}
@@ -623,20 +721,43 @@ tls13_ClientHandlePreSharedKeyXtn(const sslSocket *ss, TLSExtensionData *xtnData
/*
* struct { } EarlyDataIndication;
*/
-SECStatus
+PRInt32
tls13_ClientSendEarlyDataXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
+ PRBool append,
+ PRUint32 maxBytes)
{
- if (!tls13_ClientAllow0Rtt(ss, ss->sec.ci.sid)) {
- return SECSuccess;
+ SECStatus rv;
+ PRInt32 extension_length;
+
+ if (!tls13_ClientAllow0Rtt(ss, ss->sec.ci.sid))
+ return 0;
+
+ /* type + length */
+ extension_length = 2 + 2;
+
+ if (maxBytes < (PRUint32)extension_length) {
+ PORT_Assert(0);
+ return 0;
}
- *added = PR_TRUE;
- return SECSuccess;
+ if (append) {
+ rv = ssl3_ExtAppendHandshakeNumber(ss, ssl_tls13_early_data_xtn, 2);
+ if (rv != SECSuccess)
+ return -1;
+
+ rv = ssl3_ExtAppendHandshakeNumber(ss, 0, 2);
+ if (rv != SECSuccess)
+ return -1;
+
+ xtnData->advertised[xtnData->numAdvertised++] =
+ ssl_tls13_early_data_xtn;
+ }
+
+ return extension_length;
}
SECStatus
-tls13_ServerHandleEarlyDataXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+tls13_ServerHandleEarlyDataXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type,
SECItem *data)
{
SSL_TRC(3, ("%d: TLS13[%d]: handle early_data extension",
@@ -658,14 +779,44 @@ tls13_ServerHandleEarlyDataXtn(const sslSocket *ss, TLSExtensionData *xtnData,
return SECFailure;
}
- xtnData->negotiated[xtnData->numNegotiated++] = ssl_tls13_early_data_xtn;
+ xtnData->negotiated[xtnData->numNegotiated++] = ex_type;
return SECSuccess;
}
+/* This is only registered if we are sending it. */
+PRInt32
+tls13_ServerSendEarlyDataXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRBool append,
+ PRUint32 maxBytes)
+{
+ SSL_TRC(3, ("%d: TLS13[%d]: send early_data extension",
+ SSL_GETPID(), ss->fd));
+
+ PORT_Assert(ss->ssl3.hs.zeroRttState == ssl_0rtt_accepted);
+ if (maxBytes < 4) {
+ PORT_Assert(0);
+ return 0;
+ }
+
+ if (append) {
+ SECStatus rv;
+
+ rv = ssl3_ExtAppendHandshakeNumber(ss, ssl_tls13_early_data_xtn, 2);
+ if (rv != SECSuccess)
+ return -1;
+
+ rv = ssl3_ExtAppendHandshakeNumber(ss, 0, 2);
+ if (rv != SECSuccess)
+ return -1;
+ }
+
+ return 4;
+}
+
/* This will only be called if we also offered the extension. */
SECStatus
-tls13_ClientHandleEarlyDataXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+tls13_ClientHandleEarlyDataXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type,
SECItem *data)
{
SSL_TRC(3, ("%d: TLS13[%d]: handle early_data extension",
@@ -683,19 +834,19 @@ tls13_ClientHandleEarlyDataXtn(const sslSocket *ss, TLSExtensionData *xtnData,
}
/* Keep track of negotiated extensions. */
- xtnData->negotiated[xtnData->numNegotiated++] = ssl_tls13_early_data_xtn;
+ xtnData->negotiated[xtnData->numNegotiated++] = ex_type;
return SECSuccess;
}
SECStatus
-tls13_ClientHandleTicketEarlyDataXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- SECItem *data)
+tls13_ClientHandleTicketEarlyDataInfoXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type,
+ SECItem *data)
{
PRUint32 utmp;
SECStatus rv;
- SSL_TRC(3, ("%d: TLS13[%d]: handle ticket early_data extension",
+ SSL_TRC(3, ("%d: TLS13[%d]: handle early_data_info extension",
SSL_GETPID(), ss->fd));
/* The server must not send this extension when negotiating < TLS 1.3. */
@@ -722,71 +873,59 @@ tls13_ClientHandleTicketEarlyDataXtn(const sslSocket *ss, TLSExtensionData *xtnD
/*
* struct {
- * select (Handshake.msg_type) {
- * case client_hello:
* ProtocolVersion versions<2..254>;
- * case server_hello:
- * ProtocolVersion version;
- * };
* } SupportedVersions;
*/
-SECStatus
-tls13_ClientSendSupportedVersionsXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
+PRInt32
+tls13_ClientSendSupportedVersionsXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRBool append,
+ PRUint32 maxBytes)
{
+ PRInt32 extensions_len;
PRUint16 version;
- unsigned int lengthOffset;
SECStatus rv;
if (ss->vrange.max < SSL_LIBRARY_VERSION_TLS_1_3) {
- return SECSuccess;
+ return 0;
}
- SSL_TRC(3, ("%d: TLS13[%d]: client send supported_versions extension",
+ SSL_TRC(3, ("%d: TLS13[%d]: send supported_versions extension",
SSL_GETPID(), ss->fd));
- rv = sslBuffer_Skip(buf, 1, &lengthOffset);
- if (rv != SECSuccess) {
- return SECFailure;
- }
+ /* Extension type, extension len fiels, vector len field,
+ * length of the values. */
+ extensions_len = 2 + 2 + 1 +
+ 2 * (ss->vrange.max - ss->vrange.min + 1);
- for (version = ss->vrange.max; version >= ss->vrange.min; --version) {
- rv = sslBuffer_AppendNumber(buf, tls13_EncodeDraftVersion(version), 2);
- if (rv != SECSuccess) {
- return SECFailure;
- }
+ if (maxBytes < (PRUint32)extensions_len) {
+ PORT_Assert(0);
+ return 0;
}
- rv = sslBuffer_InsertLength(buf, lengthOffset, 1);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- *added = PR_TRUE;
- return SECSuccess;
-}
+ if (append) {
+ rv = ssl3_ExtAppendHandshakeNumber(ss, ssl_tls13_supported_versions_xtn, 2);
+ if (rv != SECSuccess)
+ return -1;
-SECStatus
-tls13_ServerSendSupportedVersionsXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
-{
- SECStatus rv;
+ rv = ssl3_ExtAppendHandshakeNumber(ss, extensions_len - 4, 2);
+ if (rv != SECSuccess)
+ return -1;
- if (ss->version < SSL_LIBRARY_VERSION_TLS_1_3) {
- return SECSuccess;
- }
+ rv = ssl3_ExtAppendHandshakeNumber(ss, extensions_len - 5, 1);
+ if (rv != SECSuccess)
+ return -1;
- SSL_TRC(3, ("%d: TLS13[%d]: server send supported_versions extension",
- SSL_GETPID(), ss->fd));
+ for (version = ss->vrange.max; version >= ss->vrange.min; --version) {
+ rv = ssl3_ExtAppendHandshakeNumber(
+ ss, tls13_EncodeDraftVersion(version), 2);
+ if (rv != SECSuccess)
+ return -1;
+ }
- rv = sslBuffer_AppendNumber(
- buf, tls13_EncodeDraftVersion(SSL_LIBRARY_VERSION_TLS_1_3), 2);
- if (rv != SECSuccess) {
- return SECFailure;
+ xtnData->advertised[xtnData->numAdvertised++] =
+ ssl_tls13_supported_versions_xtn;
}
- *added = PR_TRUE;
- return SECSuccess;
+ return extensions_len;
}
/*
@@ -795,8 +934,7 @@ tls13_ServerSendSupportedVersionsXtn(const sslSocket *ss, TLSExtensionData *xtnD
* } Cookie;
*/
SECStatus
-tls13_ClientHandleHrrCookie(const sslSocket *ss, TLSExtensionData *xtnData,
- SECItem *data)
+tls13_ClientHandleHrrCookie(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type, SECItem *data)
{
SECStatus rv;
@@ -822,57 +960,41 @@ tls13_ClientHandleHrrCookie(const sslSocket *ss, TLSExtensionData *xtnData,
return SECSuccess;
}
-SECStatus
-tls13_ClientSendHrrCookieXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
+PRInt32
+tls13_ClientSendHrrCookieXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRBool append, PRUint32 maxBytes)
{
- SECStatus rv;
+ PRInt32 extension_len;
if (ss->vrange.max < SSL_LIBRARY_VERSION_TLS_1_3 ||
!ss->ssl3.hs.cookie.len) {
- return SECSuccess;
+ return 0;
}
SSL_TRC(3, ("%d: TLS13[%d]: send cookie extension", SSL_GETPID(), ss->fd));
- rv = sslBuffer_AppendVariable(buf, ss->ssl3.hs.cookie.data,
- ss->ssl3.hs.cookie.len, 2);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- *added = PR_TRUE;
- return SECSuccess;
-}
-SECStatus
-tls13_ServerHandleCookieXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- SECItem *data)
-{
- SECStatus rv;
+ /* Extension type, length, cookie length, cookie value. */
+ extension_len = 2 + 2 + 2 + ss->ssl3.hs.cookie.len;
- SSL_TRC(3, ("%d: TLS13[%d]: handle cookie extension",
- SSL_GETPID(), ss->fd));
-
- rv = ssl3_ExtConsumeHandshakeVariable(ss, &xtnData->cookie, 2,
- &data->data, &data->len);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- if (xtnData->cookie.len == 0) {
- PORT_SetError(SSL_ERROR_RX_MALFORMED_SERVER_HELLO);
- return SECFailure;
+ if (maxBytes < (PRUint32)extension_len) {
+ PORT_Assert(0);
+ return 0;
}
- if (data->len) {
- PORT_SetError(SSL_ERROR_RX_MALFORMED_SERVER_HELLO);
- return SECFailure;
- }
+ if (append) {
+ SECStatus rv = ssl3_ExtAppendHandshakeNumber(ss, ssl_tls13_cookie_xtn, 2);
+ if (rv != SECSuccess)
+ return -1;
- /* Keep track of negotiated extensions. */
- xtnData->negotiated[xtnData->numNegotiated++] = ssl_tls13_cookie_xtn;
+ rv = ssl3_ExtAppendHandshakeNumber(ss, extension_len - 4, 2);
+ if (rv != SECSuccess)
+ return -1;
- return SECSuccess;
+ rv = ssl3_ExtAppendHandshakeVariable(ss, ss->ssl3.hs.cookie.data,
+ ss->ssl3.hs.cookie.len, 2);
+ if (rv != SECSuccess)
+ return -1;
+ }
+ return extension_len;
}
/*
@@ -882,33 +1004,54 @@ tls13_ServerHandleCookieXtn(const sslSocket *ss, TLSExtensionData *xtnData,
* PskKeyExchangeMode ke_modes<1..255>;
* } PskKeyExchangeModes;
*/
-SECStatus
-tls13_ClientSendPskModesXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
+PRInt32
+tls13_ClientSendPskKeyExchangeModesXtn(const sslSocket *ss,
+ TLSExtensionData *xtnData,
+ PRBool append, PRUint32 maxBytes)
{
static const PRUint8 ke_modes[] = { tls13_psk_dh_ke };
- SECStatus rv;
+ static const unsigned long ke_modes_len = sizeof(ke_modes);
+ PRInt32 extension_len;
if (ss->vrange.max < SSL_LIBRARY_VERSION_TLS_1_3 ||
ss->opt.noCache) {
- return SECSuccess;
+ return 0;
}
+ extension_len =
+ 2 + 2 + /* Type + length */
+ 1 + ke_modes_len; /* key exchange modes vector */
+
SSL_TRC(3, ("%d: TLS13[%d]: send psk key exchange modes extension",
SSL_GETPID(), ss->fd));
- rv = sslBuffer_AppendVariable(buf, ke_modes, sizeof(ke_modes), 1);
- if (rv != SECSuccess) {
- return SECFailure;
+ if (maxBytes < (PRUint32)extension_len) {
+ PORT_Assert(0);
+ return 0;
}
- *added = PR_TRUE;
- return SECSuccess;
+ if (append) {
+ SECStatus rv = ssl3_ExtAppendHandshakeNumber(
+ ss, ssl_tls13_psk_key_exchange_modes_xtn, 2);
+ if (rv != SECSuccess)
+ return -1;
+
+ rv = ssl3_ExtAppendHandshakeNumber(ss, extension_len - 4, 2);
+ if (rv != SECSuccess)
+ return -1;
+
+ rv = ssl3_ExtAppendHandshakeVariable(
+ ss, ke_modes, ke_modes_len, 1);
+ if (rv != SECSuccess)
+ return -1;
+ }
+ return extension_len;
}
SECStatus
-tls13_ServerHandlePskModesXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- SECItem *data)
+tls13_ServerHandlePskKeyExchangeModesXtn(const sslSocket *ss,
+ TLSExtensionData *xtnData,
+ PRUint16 ex_type, SECItem *data)
{
SECStatus rv;
@@ -933,126 +1076,112 @@ tls13_ServerHandlePskModesXtn(const sslSocket *ss, TLSExtensionData *xtnData,
}
/* Keep track of negotiated extensions. */
- xtnData->negotiated[xtnData->numNegotiated++] =
- ssl_tls13_psk_key_exchange_modes_xtn;
+ xtnData->negotiated[xtnData->numNegotiated++] = ex_type;
return SECSuccess;
}
-SECStatus
-tls13_SendCertAuthoritiesXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
+PRInt32
+tls13_SendShortHeaderXtn(const sslSocket *ss,
+ TLSExtensionData *xtnData,
+ PRBool append, PRUint32 maxBytes)
{
- unsigned int calen;
- const SECItem *name;
- unsigned int nnames;
- SECStatus rv;
+ PRUint32 extension_len = 2 + 2; /* Type + length (0). */
- PORT_Assert(ss->version >= SSL_LIBRARY_VERSION_TLS_1_3);
-
- rv = ssl_GetCertificateRequestCAs(ss, &calen, &name, &nnames);
- if (rv != SECSuccess) {
- return SECFailure;
+ if (!ss->opt.enableShortHeaders) {
+ return 0;
}
- if (!calen) {
- return SECSuccess;
+ /* Presently this is incompatible with 0-RTT. We will fix if
+ * it becomes more than an experiment. */
+ if (ss->opt.enable0RttData) {
+ return 0;
}
- rv = sslBuffer_AppendNumber(buf, calen, 2);
- if (rv != SECSuccess) {
- return SECFailure;
+ if (IS_DTLS(ss)) {
+ return 0;
}
- while (nnames) {
- rv = sslBuffer_AppendVariable(buf, name->data, name->len, 2);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- ++name;
- --nnames;
+ /* Don't send this if TLS 1.3 isn't at least possible. */
+ if (ss->vrange.max < SSL_LIBRARY_VERSION_TLS_1_3) {
+ /* This should only happen on the client. */
+ PORT_Assert(!ss->sec.isServer);
+ return 0;
}
- *added = PR_TRUE;
- return SECSuccess;
-}
-
-SECStatus
-tls13_ClientHandleCertAuthoritiesXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- SECItem *data)
-{
- SECStatus rv;
- PLArenaPool *arena;
+ SSL_TRC(3, ("%d: TLS13[%d]: send short_header extension",
+ SSL_GETPID(), ss->fd));
- if (!data->len) {
- ssl3_ExtSendAlert(ss, alert_fatal, decode_error);
- PORT_SetError(SSL_ERROR_RX_MALFORMED_CERT_REQUEST);
- return SECFailure;
+ if (maxBytes < extension_len) {
+ PORT_Assert(0);
+ return 0;
}
- arena = PORT_NewArena(DER_DEFAULT_CHUNKSIZE);
- if (!arena) {
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
- }
+ if (append) {
+ SECStatus rv;
- xtnData->certReqAuthorities.arena = arena;
- rv = ssl3_ParseCertificateRequestCAs((sslSocket *)ss,
- &data->data, &data->len,
- &xtnData->certReqAuthorities);
- if (rv != SECSuccess) {
- goto loser;
- }
- if (data->len) {
- ssl3_ExtSendAlert(ss, alert_fatal, decode_error);
- PORT_SetError(SSL_ERROR_RX_MALFORMED_CERT_REQUEST);
- goto loser;
+ rv = ssl3_ExtAppendHandshakeNumber(ss, ssl_tls13_short_header_xtn, 2);
+ if (rv != SECSuccess)
+ return -1;
+
+ rv = ssl3_ExtAppendHandshakeNumber(ss, 0, 2);
+ if (rv != SECSuccess)
+ return -1;
+
+ xtnData->advertised[xtnData->numAdvertised++] =
+ ssl_tls13_short_header_xtn;
}
- return SECSuccess;
-loser:
- PORT_FreeArena(arena, PR_FALSE);
- xtnData->certReqAuthorities.arena = NULL;
- return SECFailure;
+ return extension_len;
}
SECStatus
-tls13_ServerSendHrrKeyShareXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
+tls13_HandleShortHeaderXtn(
+ const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type,
+ SECItem *data)
{
- SECStatus rv;
+ SSL_TRC(3, ("%d: TLS13[%d]: handle short_header extension",
+ SSL_GETPID(), ss->fd));
- PORT_Assert(ss->version >= SSL_LIBRARY_VERSION_TLS_1_3);
+ /* The client might have asked for this, but we didn't negotiate TLS 1.3. */
+ if (ss->version < SSL_LIBRARY_VERSION_TLS_1_3) {
+ return SECSuccess;
+ }
- if (!xtnData->selectedGroup) {
+ /* Presently this is incompatible with 0-RTT. We will fix if
+ * it becomes more than an experiment. */
+ if (ss->opt.enable0RttData) {
return SECSuccess;
}
- rv = sslBuffer_AppendNumber(buf, xtnData->selectedGroup->name, 2);
- if (rv != SECSuccess) {
+ if (IS_DTLS(ss)) {
+ PORT_SetError(SSL_ERROR_EXTENSION_DISALLOWED_FOR_VERSION);
return SECFailure;
}
- *added = PR_TRUE;
- return SECSuccess;
-}
+ if (data->len) {
+ PORT_SetError(SSL_ERROR_RX_MALFORMED_HANDSHAKE);
+ return SECFailure;
+ }
-SECStatus
-tls13_ServerSendHrrCookieXtn(const sslSocket *ss, TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added)
-{
- SECStatus rv;
+ if (!ss->opt.enableShortHeaders) {
+ /* Ignore. */
+ return SECSuccess;
+ }
- PORT_Assert(ss->version >= SSL_LIBRARY_VERSION_TLS_1_3);
- PORT_Assert(xtnData->cookie.len > 0);
+ /* Keep track of negotiated extensions. */
+ xtnData->negotiated[xtnData->numNegotiated++] = ex_type;
- rv = sslBuffer_AppendVariable(buf,
- xtnData->cookie.data, xtnData->cookie.len, 2);
- if (rv != SECSuccess) {
- return SECFailure;
+ if (ss->sec.isServer) {
+ SECStatus rv;
+
+ rv = ssl3_RegisterExtensionSender(ss, xtnData,
+ ssl_tls13_short_header_xtn,
+ tls13_SendShortHeaderXtn);
+ if (rv != SECSuccess) {
+ return SECFailure;
+ }
}
- *added = PR_TRUE;
return SECSuccess;
}
diff --git a/security/nss/lib/ssl/tls13exthandle.h b/security/nss/lib/ssl/tls13exthandle.h
index edce94d831..b798c6b552 100644
--- a/security/nss/lib/ssl/tls13exthandle.h
+++ b/security/nss/lib/ssl/tls13exthandle.h
@@ -9,80 +9,66 @@
#ifndef __tls13exthandle_h_
#define __tls13exthandle_h_
-SECStatus tls13_ServerSendStatusRequestXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *append);
-SECStatus tls13_ClientSendKeyShareXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *append);
-SECStatus tls13_ClientHandleKeyShareXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
+PRInt32 tls13_ServerSendStatusRequestXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRBool append, PRUint32 maxBytes);
+PRInt32 tls13_ClientSendKeyShareXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRBool append,
+ PRUint32 maxBytes);
+SECStatus tls13_ClientHandleKeyShareXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRUint16 ex_type,
SECItem *data);
-SECStatus tls13_ClientHandleKeyShareXtnHrr(const sslSocket *ss,
- TLSExtensionData *xtnData,
+SECStatus tls13_ClientHandleKeyShareXtnHrr(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRUint16 ex_type,
SECItem *data);
-SECStatus tls13_ServerHandleKeyShareXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
+SECStatus tls13_ServerHandleKeyShareXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRUint16 ex_type,
SECItem *data);
-SECStatus tls13_ServerSendKeyShareXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *append);
-SECStatus tls13_ClientSendPreSharedKeyXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *append);
-SECStatus tls13_ServerHandlePreSharedKeyXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
+PRInt32 tls13_ServerSendKeyShareXtn(const sslSocket *ss,
+ TLSExtensionData *xtnData,
+ PRBool append,
+ PRUint32 maxBytes);
+PRInt32 tls13_ClientSendPreSharedKeyXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRBool append,
+ PRUint32 maxBytes);
+SECStatus tls13_ServerHandlePreSharedKeyXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRUint16 ex_type,
SECItem *data);
-SECStatus tls13_ClientHandlePreSharedKeyXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
+SECStatus tls13_ClientHandlePreSharedKeyXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRUint16 ex_type,
SECItem *data);
-SECStatus tls13_ServerSendPreSharedKeyXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *append);
-SECStatus tls13_ClientSendEarlyDataXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *append);
-SECStatus tls13_ServerHandleEarlyDataXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
+PRInt32 tls13_ServerSendPreSharedKeyXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRBool append,
+ PRUint32 maxBytes);
+PRInt32 tls13_ClientSendEarlyDataXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRBool append,
+ PRUint32 maxBytes);
+SECStatus tls13_ServerHandleEarlyDataXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type,
SECItem *data);
-SECStatus tls13_ClientHandleEarlyDataXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
+SECStatus tls13_ClientHandleEarlyDataXtn(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type,
SECItem *data);
-SECStatus tls13_ClientHandleTicketEarlyDataXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- SECItem *data);
-SECStatus tls13_ClientSendSupportedVersionsXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *append);
-SECStatus tls13_ServerSendSupportedVersionsXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added);
-SECStatus tls13_ClientHandleHrrCookie(const sslSocket *ss,
- TLSExtensionData *xtnData,
+PRInt32 tls13_ServerSendEarlyDataXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRBool append,
+ PRUint32 maxBytes);
+SECStatus tls13_ClientHandleTicketEarlyDataInfoXtn(
+ const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type,
+ SECItem *data);
+PRInt32 tls13_ClientSendSupportedVersionsXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRBool append,
+ PRUint32 maxBytes);
+SECStatus tls13_ClientHandleHrrCookie(const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type,
SECItem *data);
-SECStatus tls13_ClientSendHrrCookieXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *append);
-SECStatus tls13_ClientSendPskModesXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *append);
-SECStatus tls13_ServerHandlePskModesXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- SECItem *data);
-SECStatus tls13_SendCertAuthoritiesXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *append);
-SECStatus tls13_ClientHandleCertAuthoritiesXtn(const sslSocket *ss,
+PRInt32 tls13_ClientSendHrrCookieXtn(const sslSocket *ss, TLSExtensionData *xtnData,
+ PRBool append,
+ PRUint32 maxBytes);
+PRInt32 tls13_ClientSendPskKeyExchangeModesXtn(const sslSocket *ss,
TLSExtensionData *xtnData,
- SECItem *data);
-SECStatus tls13_ServerHandleCookieXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- SECItem *data);
-SECStatus tls13_ServerSendHrrKeyShareXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added);
-SECStatus tls13_ServerSendHrrCookieXtn(const sslSocket *ss,
- TLSExtensionData *xtnData,
- sslBuffer *buf, PRBool *added);
+ PRBool append, PRUint32 maxBytes);
+SECStatus tls13_ServerHandlePskKeyExchangeModesXtn(const sslSocket *ss,
+ TLSExtensionData *xtnData,
+ PRUint16 ex_type, SECItem *data);
+PRInt32 tls13_SendShortHeaderXtn(const sslSocket *ss,
+ TLSExtensionData *xtnData,
+ PRBool append, PRUint32 maxBytes);
+SECStatus tls13_HandleShortHeaderXtn(
+ const sslSocket *ss, TLSExtensionData *xtnData, PRUint16 ex_type,
+ SECItem *data);
#endif
diff --git a/security/nss/lib/ssl/tls13hashstate.c b/security/nss/lib/ssl/tls13hashstate.c
deleted file mode 100644
index e3232f524e..0000000000
--- a/security/nss/lib/ssl/tls13hashstate.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is PRIVATE to SSL.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "pk11func.h"
-#include "ssl.h"
-#include "sslt.h"
-#include "sslimpl.h"
-#include "selfencrypt.h"
-#include "tls13con.h"
-#include "tls13err.h"
-#include "tls13hashstate.h"
-
-/*
- * The cookie is structured as a self-encrypted structure with the
- * inner value being.
- *
- * struct {
- * uint8 indicator = 0xff; // To disambiguate from tickets.
- * uint16 cipherSuite; // Selected cipher suite.
- * uint16 keyShare; // Requested key share group (0=none)
- * opaque applicationToken<0..65535>; // Application token
- * opaque ch_hash[rest_of_buffer]; // H(ClientHello)
- * } CookieInner;
- */
-SECStatus
-tls13_MakeHrrCookie(sslSocket *ss, const sslNamedGroupDef *selectedGroup,
- const PRUint8 *appToken, unsigned int appTokenLen,
- PRUint8 *buf, unsigned int *len, unsigned int maxlen)
-{
- SECStatus rv;
- SSL3Hashes hashes;
- PRUint8 cookie[1024];
- sslBuffer cookieBuf = SSL_BUFFER(cookie);
- static const PRUint8 indicator = 0xff;
-
- /* Encode header. */
- rv = sslBuffer_Append(&cookieBuf, &indicator, 1);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- rv = sslBuffer_AppendNumber(&cookieBuf, ss->ssl3.hs.cipher_suite, 2);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- rv = sslBuffer_AppendNumber(&cookieBuf,
- selectedGroup ? selectedGroup->name : 0, 2);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- /* Application token. */
- rv = sslBuffer_AppendVariable(&cookieBuf, appToken, appTokenLen, 2);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- /* Compute and encode hashes. */
- rv = tls13_ComputeHandshakeHashes(ss, &hashes);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- rv = sslBuffer_Append(&cookieBuf, hashes.u.raw, hashes.len);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- /* Encrypt right into the buffer. */
- rv = ssl_SelfEncryptProtect(ss, cookieBuf.buf, cookieBuf.len,
- buf, len, maxlen);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- return SECSuccess;
-}
-
-/* Recover the hash state from the cookie. */
-SECStatus
-tls13_RecoverHashState(sslSocket *ss,
- unsigned char *cookie, unsigned int cookieLen,
- ssl3CipherSuite *previousCipherSuite,
- const sslNamedGroupDef **previousGroup)
-{
- SECStatus rv;
- unsigned char plaintext[1024];
- SECItem ptItem = { siBuffer, plaintext, 0 };
- sslBuffer messageBuf = SSL_BUFFER_EMPTY;
- PRUint32 sentinel;
- PRUint32 cipherSuite;
- PRUint32 group;
- const sslNamedGroupDef *selectedGroup;
- PRUint32 appTokenLen;
- PRUint8 *appToken;
-
- rv = ssl_SelfEncryptUnprotect(ss, cookie, cookieLen,
- ptItem.data, &ptItem.len, sizeof(plaintext));
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- /* Should start with 0xff. */
- rv = ssl3_ConsumeNumberFromItem(&ptItem, &sentinel, 1);
- if ((rv != SECSuccess) || (sentinel != 0xff)) {
- FATAL_ERROR(ss, SSL_ERROR_RX_MALFORMED_CLIENT_HELLO, illegal_parameter);
- return SECFailure;
- }
- /* The cipher suite should be the same or there are some shenanigans. */
- rv = ssl3_ConsumeNumberFromItem(&ptItem, &cipherSuite, 2);
- if (rv != SECSuccess) {
- FATAL_ERROR(ss, SSL_ERROR_RX_MALFORMED_CLIENT_HELLO, illegal_parameter);
- return SECFailure;
- }
-
- /* The named group, if any. */
- rv = ssl3_ConsumeNumberFromItem(&ptItem, &group, 2);
- if (rv != SECSuccess) {
- FATAL_ERROR(ss, SSL_ERROR_RX_MALFORMED_CLIENT_HELLO, illegal_parameter);
- return SECFailure;
- }
- selectedGroup = ssl_LookupNamedGroup(group);
-
- /* Application token. */
- PORT_Assert(ss->xtnData.applicationToken.len == 0);
- rv = ssl3_ConsumeNumberFromItem(&ptItem, &appTokenLen, 2);
- if (rv != SECSuccess) {
- FATAL_ERROR(ss, SSL_ERROR_RX_MALFORMED_CLIENT_HELLO, illegal_parameter);
- return SECFailure;
- }
- if (SECITEM_AllocItem(NULL, &ss->xtnData.applicationToken,
- appTokenLen) == NULL) {
- FATAL_ERROR(ss, PORT_GetError(), internal_error);
- return SECFailure;
- }
- ss->xtnData.applicationToken.len = appTokenLen;
- rv = ssl3_ConsumeFromItem(&ptItem, &appToken, appTokenLen);
- if (rv != SECSuccess) {
- FATAL_ERROR(ss, SSL_ERROR_RX_MALFORMED_CLIENT_HELLO, illegal_parameter);
- return SECFailure;
- }
- PORT_Memcpy(ss->xtnData.applicationToken.data, appToken, appTokenLen);
-
- /* The remainder is the hash. */
- if (ptItem.len != tls13_GetHashSize(ss)) {
- FATAL_ERROR(ss, SSL_ERROR_RX_MALFORMED_CLIENT_HELLO, illegal_parameter);
- return SECFailure;
- }
-
- /* Now reinject the message. */
- SSL_ASSERT_HASHES_EMPTY(ss);
- rv = ssl_HashHandshakeMessageInt(ss, ssl_hs_message_hash, 0,
- ptItem.data, ptItem.len);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- /* And finally reinject the HRR. */
- rv = tls13_ConstructHelloRetryRequest(ss, cipherSuite,
- selectedGroup,
- cookie, cookieLen,
- &messageBuf);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- rv = ssl_HashHandshakeMessageInt(ss, ssl_hs_server_hello, 0,
- SSL_BUFFER_BASE(&messageBuf),
- SSL_BUFFER_LEN(&messageBuf));
- sslBuffer_Clear(&messageBuf);
- if (rv != SECSuccess) {
- return SECFailure;
- }
-
- *previousCipherSuite = cipherSuite;
- *previousGroup = selectedGroup;
- return SECSuccess;
-}
diff --git a/security/nss/lib/ssl/tls13hashstate.h b/security/nss/lib/ssl/tls13hashstate.h
deleted file mode 100644
index e9a4aa84f3..0000000000
--- a/security/nss/lib/ssl/tls13hashstate.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * This file is PRIVATE to SSL.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef __tls13hashstate_h_
-#define __tls13hashstate_h_
-
-#include "ssl.h"
-#include "sslt.h"
-#include "sslimpl.h"
-
-SECStatus tls13_MakeHrrCookie(sslSocket *ss, const sslNamedGroupDef *selectedGroup,
- const PRUint8 *appToken, unsigned int appTokenLen,
- PRUint8 *buf, unsigned int *len, unsigned int maxlen);
-SECStatus tls13_GetHrrCookieLength(sslSocket *ss, unsigned int *length);
-SECStatus tls13_RecoverHashState(sslSocket *ss,
- unsigned char *cookie,
- unsigned int cookieLen,
- ssl3CipherSuite *previousCipherSuite,
- const sslNamedGroupDef **previousGroup);
-#endif
diff --git a/security/nss/lib/ssl/tls13hkdf.c b/security/nss/lib/ssl/tls13hkdf.c
index 8fa3375c63..7e69bb8827 100644
--- a/security/nss/lib/ssl/tls13hkdf.c
+++ b/security/nss/lib/ssl/tls13hkdf.c
@@ -134,10 +134,10 @@ tls13_HkdfExpandLabel(PK11SymKey *prk, SSLHashType baseHash,
* Label, plus HandshakeHash. If it's ever to small, the code will abort.
*/
PRUint8 info[256];
- sslBuffer infoBuf = SSL_BUFFER(info);
+ PRUint8 *ptr = info;
+ unsigned int infoLen;
PK11SymKey *derived;
- SECStatus rv;
- const char *kLabelPrefix = "tls13 ";
+ const char *kLabelPrefix = "TLS 1.3, ";
const unsigned int kLabelPrefixLen = strlen(kLabelPrefix);
if (handshakeHash) {
@@ -170,31 +170,29 @@ tls13_HkdfExpandLabel(PK11SymKey *prk, SSLHashType baseHash,
* - HkdfLabel.label is "TLS 1.3, " + Label
*
*/
- rv = sslBuffer_AppendNumber(&infoBuf, keySize, 2);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- rv = sslBuffer_AppendNumber(&infoBuf, labelLen + kLabelPrefixLen, 1);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- rv = sslBuffer_Append(&infoBuf, kLabelPrefix, kLabelPrefixLen);
- if (rv != SECSuccess) {
- return SECFailure;
- }
- rv = sslBuffer_Append(&infoBuf, label, labelLen);
- if (rv != SECSuccess) {
- return SECFailure;
+ infoLen = 2 + 1 + kLabelPrefixLen + labelLen + 1 + handshakeHashLen;
+ if (infoLen > sizeof(info)) {
+ PORT_Assert(0);
+ goto abort;
}
- rv = sslBuffer_AppendVariable(&infoBuf, handshakeHash, handshakeHashLen, 1);
- if (rv != SECSuccess) {
- return SECFailure;
+
+ ptr = ssl_EncodeUintX(keySize, 2, ptr);
+ ptr = ssl_EncodeUintX(labelLen + kLabelPrefixLen, 1, ptr);
+ PORT_Memcpy(ptr, kLabelPrefix, kLabelPrefixLen);
+ ptr += kLabelPrefixLen;
+ PORT_Memcpy(ptr, label, labelLen);
+ ptr += labelLen;
+ ptr = ssl_EncodeUintX(handshakeHashLen, 1, ptr);
+ if (handshakeHash) {
+ PORT_Memcpy(ptr, handshakeHash, handshakeHashLen);
+ ptr += handshakeHashLen;
}
+ PORT_Assert((ptr - info) == infoLen);
params.bExtract = CK_FALSE;
params.bExpand = CK_TRUE;
- params.pInfo = SSL_BUFFER_BASE(&infoBuf);
- params.ulInfoLen = SSL_BUFFER_LEN(&infoBuf);
+ params.pInfo = info;
+ params.ulInfoLen = infoLen;
paramsi.data = (unsigned char *)&params;
paramsi.len = sizeof(params);
@@ -213,17 +211,20 @@ tls13_HkdfExpandLabel(PK11SymKey *prk, SSLHashType baseHash,
char labelStr[100];
PORT_Memcpy(labelStr, label, labelLen);
labelStr[labelLen] = 0;
- SSL_TRC(50, ("HKDF Expand: label='tls13 %s',requested length=%d",
+ SSL_TRC(50, ("HKDF Expand: label=[TLS 1.3, ] + '%s',requested length=%d",
labelStr, keySize));
}
PRINT_KEY(50, (NULL, "PRK", prk));
PRINT_BUF(50, (NULL, "Hash", handshakeHash, handshakeHashLen));
- PRINT_BUF(50, (NULL, "Info", SSL_BUFFER_BASE(&infoBuf),
- SSL_BUFFER_LEN(&infoBuf)));
+ PRINT_BUF(50, (NULL, "Info", info, infoLen));
PRINT_KEY(50, (NULL, "Derived key", derived));
#endif
return SECSuccess;
+
+abort:
+ PORT_SetError(SSL_ERROR_SYM_KEY_CONTEXT_FAILURE);
+ return SECFailure;
}
SECStatus
diff --git a/security/nss/lib/ssl/tls13replay.c b/security/nss/lib/ssl/tls13replay.c
deleted file mode 100644
index b090f9bca7..0000000000
--- a/security/nss/lib/ssl/tls13replay.c
+++ /dev/null
@@ -1,276 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*
- * Anti-replay measures for TLS 1.3.
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nss.h" /* for NSS_RegisterShutdown */
-#include "nssilock.h" /* for PZMonitor */
-#include "pk11pub.h"
-#include "prinit.h" /* for PR_CallOnce */
-#include "prmon.h"
-#include "prtime.h"
-#include "secerr.h"
-#include "ssl.h"
-#include "sslbloom.h"
-#include "sslimpl.h"
-#include "tls13hkdf.h"
-
-static struct {
- /* Used to ensure that we only initialize the cleanup function once. */
- PRCallOnceType init;
- /* Used to serialize access to the filters. */
- PZMonitor *lock;
- /* The filters, use of which alternates. */
- sslBloomFilter filters[2];
- /* Which of the two filters is active (0 or 1). */
- PRUint8 current;
- /* The time that we will next update. */
- PRTime nextUpdate;
- /* The width of the window; i.e., the period of updates. */
- PRTime window;
- /* This key ensures that the bloom filter index is unpredictable. */
- PK11SymKey *key;
-} ssl_anti_replay;
-
-/* Clear the current state and free any resources we allocated. The signature
- * here is odd to allow this to be called during shutdown. */
-static SECStatus
-tls13_AntiReplayReset(void *appData, void *nssData)
-{
- if (ssl_anti_replay.key) {
- PK11_FreeSymKey(ssl_anti_replay.key);
- ssl_anti_replay.key = NULL;
- }
- if (ssl_anti_replay.lock) {
- PZ_DestroyMonitor(ssl_anti_replay.lock);
- ssl_anti_replay.lock = NULL;
- }
- sslBloom_Destroy(&ssl_anti_replay.filters[0]);
- sslBloom_Destroy(&ssl_anti_replay.filters[1]);
- return SECSuccess;
-}
-
-static PRStatus
-tls13_AntiReplayInit(void)
-{
- SECStatus rv = NSS_RegisterShutdown(tls13_AntiReplayReset, NULL);
- if (rv != SECSuccess) {
- return PR_FAILURE;
- }
- return PR_SUCCESS;
-}
-
-static SECStatus
-tls13_AntiReplayKeyGen()
-{
- PRUint8 buf[32];
- SECItem keyItem = { siBuffer, buf, sizeof(buf) };
- PK11SlotInfo *slot;
- SECStatus rv;
-
- slot = PK11_GetInternalSlot();
- if (!slot) {
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
- }
- rv = PK11_GenerateRandomOnSlot(slot, buf, sizeof(buf));
- if (rv != SECSuccess) {
- goto loser;
- }
-
- ssl_anti_replay.key = PK11_ImportSymKey(slot, CKM_NSS_HKDF_SHA256,
- PK11_OriginUnwrap, CKA_DERIVE,
- &keyItem, NULL);
- if (!ssl_anti_replay.key) {
- goto loser;
- }
-
- PK11_FreeSlot(slot);
- return SECSuccess;
-
-loser:
- PK11_FreeSlot(slot);
- return SECFailure;
-}
-
-/* Set a limit on the combination of number of hashes and bits in each hash. */
-#define SSL_MAX_BLOOM_FILTER_SIZE 64
-
-/*
- * The structures created by this function can be called concurrently on
- * multiple threads if the server is multi-threaded. A monitor is used to
- * ensure that only one thread can access the structures that change over time,
- * but no such guarantee is provided for configuration data.
- *
- * Functions that read from static configuration data depend on there being a
- * memory barrier between the setup and use of this function.
- */
-SECStatus
-SSLExp_SetupAntiReplay(PRTime window, unsigned int k, unsigned int bits)
-{
- SECStatus rv;
-
- if (k == 0 || bits == 0) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- return SECFailure;
- }
- if ((k * (bits + 7) / 8) > SSL_MAX_BLOOM_FILTER_SIZE) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- return SECFailure;
- }
-
- if (PR_SUCCESS != PR_CallOnce(&ssl_anti_replay.init,
- tls13_AntiReplayInit)) {
- PORT_SetError(SEC_ERROR_LIBRARY_FAILURE);
- return SECFailure;
- }
-
- (void)tls13_AntiReplayReset(NULL, NULL);
-
- ssl_anti_replay.lock = PZ_NewMonitor(nssILockSSL);
- if (!ssl_anti_replay.lock) {
- goto loser; /* Code already set. */
- }
-
- rv = tls13_AntiReplayKeyGen();
- if (rv != SECSuccess) {
- goto loser; /* Code already set. */
- }
-
- rv = sslBloom_Init(&ssl_anti_replay.filters[0], k, bits);
- if (rv != SECSuccess) {
- goto loser; /* Code already set. */
- }
- rv = sslBloom_Init(&ssl_anti_replay.filters[1], k, bits);
- if (rv != SECSuccess) {
- goto loser; /* Code already set. */
- }
- /* When starting out, ensure that 0-RTT is not accepted until the window is
- * updated. A ClientHello might have been accepted prior to a restart. */
- sslBloom_Fill(&ssl_anti_replay.filters[1]);
-
- ssl_anti_replay.current = 0;
- ssl_anti_replay.nextUpdate = ssl_TimeUsec() + window;
- ssl_anti_replay.window = window;
- return SECSuccess;
-
-loser:
- (void)tls13_AntiReplayReset(NULL, NULL);
- return SECFailure;
-}
-
-/* This is exposed to tests. Though it could, this doesn't take the lock on the
- * basis that those tests use thread confinement. */
-void
-tls13_AntiReplayRollover(PRTime now)
-{
- ssl_anti_replay.current ^= 1;
- ssl_anti_replay.nextUpdate = now + ssl_anti_replay.window;
- sslBloom_Zero(ssl_anti_replay.filters + ssl_anti_replay.current);
-}
-
-static void
-tls13_AntiReplayUpdate()
-{
- PRTime now;
-
- PR_ASSERT_CURRENT_THREAD_IN_MONITOR(ssl_anti_replay.lock);
-
- now = ssl_TimeUsec();
- if (now < ssl_anti_replay.nextUpdate) {
- return;
- }
-
- tls13_AntiReplayRollover(now);
-}
-
-PRBool
-tls13_InWindow(const sslSocket *ss, const sslSessionID *sid)
-{
- PRInt32 timeDelta;
-
- /* Calculate the difference between the client's view of the age of the
- * ticket (in |ss->xtnData.ticketAge|) and the server's view, which we now
- * calculate. The result should be close to zero. timeDelta is signed to
- * make the comparisons below easier. */
- timeDelta = ss->xtnData.ticketAge -
- ((ssl_TimeUsec() - sid->creationTime) / PR_USEC_PER_MSEC);
-
- /* Only allow the time delta to be at most half of our window. This is
- * symmetrical, though it doesn't need to be; this assumes that clock errors
- * on server and client will tend to cancel each other out.
- *
- * There are two anti-replay filters that roll over each window. In the
- * worst case, immediately after a rollover of the filters, we only have a
- * single window worth of recorded 0-RTT attempts. Thus, the period in
- * which we can accept 0-RTT is at most one window wide. This uses PR_ABS()
- * and half the window so that the first attempt can be up to half a window
- * early and then replays will be caught until the attempts are half a
- * window late.
- *
- * For example, a 0-RTT attempt arrives early, but near the end of window 1.
- * The attempt is then recorded in window 1. Rollover to window 2 could
- * occur immediately afterwards. Window 1 is still checked for new 0-RTT
- * attempts for the remainder of window 2. Therefore, attempts to replay
- * are detected because the value is recorded in window 1. When rollover
- * occurs again, window 1 is erased and window 3 instated. If we allowed an
- * attempt to be late by more than half a window, then this check would not
- * prevent the same 0-RTT attempt from being accepted during window 1 and
- * later window 3.
- */
- return PR_ABS(timeDelta) < (ssl_anti_replay.window / 2);
-}
-
-/* Checks for a duplicate in the two filters we have. Performs maintenance on
- * the filters as a side-effect. This only detects a probable replay, it's
- * possible that this will return true when the 0-RTT attempt is not genuinely a
- * replay. In that case, we reject 0-RTT unnecessarily, but that's OK because
- * no client expects 0-RTT to work every time. */
-PRBool
-tls13_IsReplay(const sslSocket *ss, const sslSessionID *sid)
-{
- PRBool replay;
- unsigned int size;
- PRUint8 index;
- SECStatus rv;
- static const char *label = "tls13 anti-replay";
- PRUint8 buf[SSL_MAX_BLOOM_FILTER_SIZE];
-
- /* If SSL_SetupAntiReplay hasn't been called, then treat all attempts at
- * 0-RTT as a replay. */
- if (!ssl_anti_replay.init.initialized) {
- return PR_TRUE;
- }
-
- if (!tls13_InWindow(ss, sid)) {
- return PR_TRUE;
- }
-
- size = ssl_anti_replay.filters[0].k *
- (ssl_anti_replay.filters[0].bits + 7) / 8;
- PORT_Assert(size <= SSL_MAX_BLOOM_FILTER_SIZE);
- rv = tls13_HkdfExpandLabelRaw(ssl_anti_replay.key, ssl_hash_sha256,
- ss->xtnData.pskBinder.data,
- ss->xtnData.pskBinder.len,
- label, strlen(label),
- buf, size);
- if (rv != SECSuccess) {
- return PR_TRUE;
- }
-
- PZ_EnterMonitor(ssl_anti_replay.lock);
- tls13_AntiReplayUpdate();
-
- index = ssl_anti_replay.current;
- replay = sslBloom_Add(&ssl_anti_replay.filters[index], buf);
- if (!replay) {
- replay = sslBloom_Check(&ssl_anti_replay.filters[index ^ 1],
- buf);
- }
-
- PZ_ExitMonitor(ssl_anti_replay.lock);
- return replay;
-}
diff --git a/security/nss/lib/util/nssb64d.c b/security/nss/lib/util/nssb64d.c
index e4bb20a3ea..886ce21c04 100644
--- a/security/nss/lib/util/nssb64d.c
+++ b/security/nss/lib/util/nssb64d.c
@@ -249,7 +249,7 @@ pl_base64_decode_buffer(PLBase64Decoder *data, const unsigned char *in,
}
i = 0;
- PR_ASSERT((PRUint32)(out - data->output_buffer + 3) <= data->output_buflen);
+ PR_ASSERT((out - data->output_buffer + 3) <= data->output_buflen);
/*
* Assume we are not at the end; the following function only works
diff --git a/security/nss/lib/util/nssrwlk.c b/security/nss/lib/util/nssrwlk.c
index 5af0217628..dbaeca24b4 100644
--- a/security/nss/lib/util/nssrwlk.c
+++ b/security/nss/lib/util/nssrwlk.c
@@ -120,8 +120,6 @@ NSSRWLock_Destroy(NSSRWLock *rwlock)
{
PR_ASSERT(rwlock != NULL);
PR_ASSERT(rwlock->rw_waiting_readers == 0);
- PR_ASSERT(rwlock->rw_writer_locks == 0);
- PR_ASSERT(rwlock->rw_reader_locks == 0);
/* XXX Shouldn't we lock the PZLock before destroying this?? */
diff --git a/security/nss/lib/util/nssutil.def b/security/nss/lib/util/nssutil.def
index 936455f6e7..f4b9ef7ba3 100644
--- a/security/nss/lib/util/nssutil.def
+++ b/security/nss/lib/util/nssutil.def
@@ -307,19 +307,3 @@ PK11URI_GetQueryAttribute;
;+ local:
;+ *;
;+};
-;+NSSUTIL_3.33 { # NSS Utilities 3.33 release
-;+ global:
-PORT_ZAllocAligned_Util;
-PORT_ZAllocAlignedOffset_Util;
-NSS_SecureMemcmpZero;
-;+ local:
-;+ *;
-;+};
-;-NSSUTIL_3.35 { # NSS Utilities 3.35 release
-;- global:
-;-# private exports for softoken
-_NSSUTIL_UTF8ToWide;-
-_NSSUTIL_Access;-
-;- local:
-;- *;
-;-};
diff --git a/security/nss/lib/util/nssutil.h b/security/nss/lib/util/nssutil.h
index f86dfa91eb..e8cb52aed9 100644
--- a/security/nss/lib/util/nssutil.h
+++ b/security/nss/lib/util/nssutil.h
@@ -19,10 +19,10 @@
* The format of the version string should be
* "<major version>.<minor version>[.<patch level>[.<build number>]][ <Beta>]"
*/
-#define NSSUTIL_VERSION "3.35"
+#define NSSUTIL_VERSION "3.32.1"
#define NSSUTIL_VMAJOR 3
-#define NSSUTIL_VMINOR 35
-#define NSSUTIL_VPATCH 0
+#define NSSUTIL_VMINOR 32
+#define NSSUTIL_VPATCH 1
#define NSSUTIL_VBUILD 0
#define NSSUTIL_BETA PR_FALSE
diff --git a/security/nss/lib/util/pkcs11uri.c b/security/nss/lib/util/pkcs11uri.c
index 94b00171e9..4534402938 100644
--- a/security/nss/lib/util/pkcs11uri.c
+++ b/security/nss/lib/util/pkcs11uri.c
@@ -242,7 +242,7 @@ static int
pk11uri_CompareByPosition(const char *a, const char *b,
const char **attr_names, size_t num_attr_names)
{
- size_t i, j;
+ int i, j;
for (i = 0; i < num_attr_names; i++) {
if (strcmp(a, attr_names[i]) == 0) {
diff --git a/security/nss/lib/util/quickder.c b/security/nss/lib/util/quickder.c
index 7a6ac1c53e..1b474822e3 100644
--- a/security/nss/lib/util/quickder.c
+++ b/security/nss/lib/util/quickder.c
@@ -520,7 +520,8 @@ DecodeGroup(void* dest,
if (SECSuccess == rv) {
/* allocate room for pointer array and entries */
/* we want to allocate the array even if there is 0 entry */
- entries = (void**)PORT_ArenaZAlloc(arena, sizeof(void*) * (totalEntries + 1) + /* the extra one is for NULL termination */
+ entries = (void**)PORT_ArenaZAlloc(arena, sizeof(void*) *
+ (totalEntries + 1) + /* the extra one is for NULL termination */
subTemplate->size * totalEntries);
if (entries) {
diff --git a/security/nss/lib/util/secasn1d.c b/security/nss/lib/util/secasn1d.c
index 4c5f0ce4b2..e6abb5fd50 100644
--- a/security/nss/lib/util/secasn1d.c
+++ b/security/nss/lib/util/secasn1d.c
@@ -2721,7 +2721,9 @@ dump_states(SEC_ASN1DecoderContext *cx)
(state == cx->current) ? "STATE" : "State",
state->theTemplate,
kindBuf);
- printf(" %s", (state->place >= 0 && state->place <= notInUse) ? place_names[state->place] : "(undefined)");
+ printf(" %s", (state->place >= 0 && state->place <= notInUse)
+ ? place_names[state->place]
+ : "(undefined)");
if (!i)
printf(", expect 0x%02x",
state->expect_tag_number | state->expect_tag_modifiers);
diff --git a/security/nss/lib/util/secoid.c b/security/nss/lib/util/secoid.c
index a05621c59e..da03b7c06e 100644
--- a/security/nss/lib/util/secoid.c
+++ b/security/nss/lib/util/secoid.c
@@ -1841,11 +1841,13 @@ secoid_FindDynamic(const SECItem *key)
{
SECOidData *ret = NULL;
- NSSRWLock_LockRead(dynOidLock);
if (dynOidHash) {
- ret = (SECOidData *)PL_HashTableLookup(dynOidHash, key);
+ NSSRWLock_LockRead(dynOidLock);
+ if (dynOidHash) { /* must check it again with lock held. */
+ ret = (SECOidData *)PL_HashTableLookup(dynOidHash, key);
+ }
+ NSSRWLock_UnlockRead(dynOidLock);
}
- NSSRWLock_UnlockRead(dynOidLock);
if (ret == NULL) {
PORT_SetError(SEC_ERROR_UNRECOGNIZED_OID);
}
@@ -1864,12 +1866,14 @@ secoid_FindDynamicByTag(SECOidTag tagnum)
}
tagNumDiff = tagnum - SEC_OID_TOTAL;
- NSSRWLock_LockRead(dynOidLock);
- if (dynOidTable != NULL &&
- tagNumDiff < dynOidEntriesUsed) {
- dxo = dynOidTable[tagNumDiff];
+ if (dynOidTable) {
+ NSSRWLock_LockRead(dynOidLock);
+ if (dynOidTable != NULL && /* must check it again with lock held. */
+ tagNumDiff < dynOidEntriesUsed) {
+ dxo = dynOidTable[tagNumDiff];
+ }
+ NSSRWLock_UnlockRead(dynOidLock);
}
- NSSRWLock_UnlockRead(dynOidLock);
if (dxo == NULL) {
PORT_SetError(SEC_ERROR_UNRECOGNIZED_OID);
}
diff --git a/security/nss/lib/util/secport.c b/security/nss/lib/util/secport.c
index e5bd4c1bbb..01a7d0834e 100644
--- a/security/nss/lib/util/secport.c
+++ b/security/nss/lib/util/secport.c
@@ -21,8 +21,6 @@
#include "prenv.h"
#include "prinit.h"
-#include <stdint.h>
-
#ifdef DEBUG
#define THREADMARK
#endif /* DEBUG */
@@ -121,51 +119,6 @@ PORT_ZAlloc(size_t bytes)
return rv;
}
-/* aligned_alloc is C11. This is an alternative to get aligned memory. */
-void *
-PORT_ZAllocAligned(size_t bytes, size_t alignment, void **mem)
-{
- size_t x = alignment - 1;
-
- /* This only works if alignment is a power of 2. */
- if ((alignment == 0) || (alignment & (alignment - 1))) {
- PORT_SetError(SEC_ERROR_INVALID_ARGS);
- return NULL;
- }
-
- if (!mem) {
- return NULL;
- }
-
- /* Always allocate a non-zero amount of bytes */
- *mem = PORT_ZAlloc((bytes ? bytes : 1) + x);
- if (!*mem) {
- PORT_SetError(SEC_ERROR_NO_MEMORY);
- return NULL;
- }
-
- return (void *)(((uintptr_t)*mem + x) & ~(uintptr_t)x);
-}
-
-void *
-PORT_ZAllocAlignedOffset(size_t size, size_t alignment, size_t offset)
-{
- PORT_Assert(offset < size);
- if (offset > size) {
- return NULL;
- }
-
- void *mem = NULL;
- void *v = PORT_ZAllocAligned(size, alignment, &mem);
- if (!v) {
- return NULL;
- }
-
- PORT_Assert(mem);
- *((void **)((uintptr_t)v + offset)) = mem;
- return v;
-}
-
void
PORT_Free(void *ptr)
{
@@ -780,18 +733,3 @@ NSS_SecureMemcmp(const void *ia, const void *ib, size_t n)
return r;
}
-
-/*
- * Perform a constant-time check if a memory region is all 0. The return value
- * is 0 if the memory region is all zero.
- */
-unsigned int
-NSS_SecureMemcmpZero(const void *mem, size_t n)
-{
- PRUint8 zero = 0;
- size_t i;
- for (i = 0; i < n; ++i) {
- zero |= *(PRUint8 *)((uintptr_t)mem + i);
- }
- return zero;
-}
diff --git a/security/nss/lib/util/secport.h b/security/nss/lib/util/secport.h
index f1665a2f5e..fb9ff4ebb5 100644
--- a/security/nss/lib/util/secport.h
+++ b/security/nss/lib/util/secport.h
@@ -45,7 +45,6 @@
#include <string.h>
#include <stddef.h>
#include <stdlib.h>
-#include <stdint.h>
#include "prtypes.h"
#include "prlog.h" /* for PR_ASSERT */
#include "plarena.h"
@@ -89,9 +88,6 @@ SEC_BEGIN_PROTOS
extern void *PORT_Alloc(size_t len);
extern void *PORT_Realloc(void *old, size_t len);
extern void *PORT_ZAlloc(size_t len);
-extern void *PORT_ZAllocAligned(size_t bytes, size_t alignment, void **mem);
-extern void *PORT_ZAllocAlignedOffset(size_t bytes, size_t alignment,
- size_t offset);
extern void PORT_Free(void *ptr);
extern void PORT_ZFree(void *ptr, size_t len);
extern char *PORT_Strdup(const char *s);
@@ -135,8 +131,6 @@ SEC_END_PROTOS
#define PORT_CheckSuccess(f) (f)
#endif
#define PORT_ZNew(type) (type *)PORT_ZAlloc(sizeof(type))
-#define PORT_ZNewAligned(type, alignment, mem) \
- (type *)PORT_ZAllocAlignedOffset(sizeof(type), alignment, offsetof(type, mem))
#define PORT_New(type) (type *)PORT_Alloc(sizeof(type))
#define PORT_ArenaNew(poolp, type) \
(type *)PORT_ArenaAlloc(poolp, sizeof(type))
@@ -252,7 +246,6 @@ sec_port_iso88591_utf8_conversion_function(
extern int NSS_PutEnv(const char *envVarName, const char *envValue);
extern int NSS_SecureMemcmp(const void *a, const void *b, size_t n);
-extern unsigned int NSS_SecureMemcmpZero(const void *mem, size_t n);
/*
* Load a shared library called "newShLibName" in the same directory as
diff --git a/security/nss/lib/util/utilmod.c b/security/nss/lib/util/utilmod.c
index 7d3fcda819..971b6c1dca 100644
--- a/security/nss/lib/util/utilmod.c
+++ b/security/nss/lib/util/utilmod.c
@@ -24,7 +24,6 @@
#if defined(_WIN32)
#include <io.h>
-#include <windows.h>
#endif
#ifdef XP_UNIX
#include <unistd.h>
@@ -35,184 +34,15 @@
#include <fcntl.h>
#if defined(_WIN32)
+#define os_open _open
#define os_fdopen _fdopen
+#define os_stat _stat
#define os_truncate_open_flags _O_CREAT | _O_RDWR | _O_TRUNC
#define os_append_open_flags _O_CREAT | _O_RDWR | _O_APPEND
#define os_open_permissions_type int
#define os_open_permissions_default _S_IREAD | _S_IWRITE
#define os_stat_type struct _stat
-
-/*
- * Convert a UTF8 string to Unicode wide character
- */
-LPWSTR
-_NSSUTIL_UTF8ToWide(const char *buf)
-{
- DWORD size;
- LPWSTR wide;
-
- if (!buf) {
- return NULL;
- }
-
- size = MultiByteToWideChar(CP_UTF8, 0, buf, -1, NULL, 0);
- if (size == 0) {
- return NULL;
- }
- wide = PORT_Alloc(sizeof(WCHAR) * size);
- if (!wide) {
- return NULL;
- }
- size = MultiByteToWideChar(CP_UTF8, 0, buf, -1, wide, size);
- if (size == 0) {
- PORT_Free(wide);
- return NULL;
- }
- return wide;
-}
-
-static int
-os_open(const char *filename, int oflag, int pmode)
-{
- int fd;
-
- if (!filename) {
- return -1;
- }
-
- wchar_t *filenameWide = _NSSUTIL_UTF8ToWide(filename);
- if (!filenameWide) {
- return -1;
- }
- fd = _wopen(filenameWide, oflag, pmode);
- PORT_Free(filenameWide);
-
- return fd;
-}
-
-static int
-os_stat(const char *path, os_stat_type *buffer)
-{
- int result;
-
- if (!path) {
- return -1;
- }
-
- wchar_t *pathWide = _NSSUTIL_UTF8ToWide(path);
- if (!pathWide) {
- return -1;
- }
- result = _wstat(pathWide, buffer);
- PORT_Free(pathWide);
-
- return result;
-}
-
-static FILE *
-os_fopen(const char *filename, const char *mode)
-{
- FILE *fp;
-
- if (!filename || !mode) {
- return NULL;
- }
-
- wchar_t *filenameWide = _NSSUTIL_UTF8ToWide(filename);
- if (!filenameWide) {
- return NULL;
- }
- wchar_t *modeWide = _NSSUTIL_UTF8ToWide(mode);
- if (!modeWide) {
- PORT_Free(filenameWide);
- return NULL;
- }
- fp = _wfopen(filenameWide, modeWide);
- PORT_Free(filenameWide);
- PORT_Free(modeWide);
-
- return fp;
-}
-
-PRStatus
-_NSSUTIL_Access(const char *path, PRAccessHow how)
-{
- int result;
-
- if (!path) {
- return PR_FAILURE;
- }
-
- int mode;
- switch (how) {
- case PR_ACCESS_WRITE_OK:
- mode = 2;
- break;
- case PR_ACCESS_READ_OK:
- mode = 4;
- break;
- case PR_ACCESS_EXISTS:
- mode = 0;
- break;
- default:
- return PR_FAILURE;
- }
-
- wchar_t *pathWide = _NSSUTIL_UTF8ToWide(path);
- if (!pathWide) {
- return PR_FAILURE;
- }
- result = _waccess(pathWide, mode);
- PORT_Free(pathWide);
-
- return result < 0 ? PR_FAILURE : PR_SUCCESS;
-}
-
-static PRStatus
-nssutil_Delete(const char *name)
-{
- BOOL result;
-
- if (!name) {
- return PR_FAILURE;
- }
-
- wchar_t *nameWide = _NSSUTIL_UTF8ToWide(name);
- if (!nameWide) {
- return PR_FAILURE;
- }
- result = DeleteFileW(nameWide);
- PORT_Free(nameWide);
-
- return result ? PR_SUCCESS : PR_FAILURE;
-}
-
-static PRStatus
-nssutil_Rename(const char *from, const char *to)
-{
- BOOL result;
-
- if (!from || !to) {
- return PR_FAILURE;
- }
-
- wchar_t *fromWide = _NSSUTIL_UTF8ToWide(from);
- if (!fromWide) {
- return PR_FAILURE;
- }
- wchar_t *toWide = _NSSUTIL_UTF8ToWide(to);
- if (!toWide) {
- PORT_Free(fromWide);
- return PR_FAILURE;
- }
- result = MoveFileW(fromWide, toWide);
- PORT_Free(fromWide);
- PORT_Free(toWide);
-
- return result ? PR_SUCCESS : PR_FAILURE;
-}
#else
-#define os_fopen fopen
#define os_open open
#define os_fdopen fdopen
#define os_stat stat
@@ -221,8 +51,6 @@ nssutil_Rename(const char *from, const char *to)
#define os_open_permissions_type mode_t
#define os_open_permissions_default 0600
#define os_stat_type struct stat
-#define nssutil_Delete PR_Delete
-#define nssutil_Rename PR_Rename
#endif
/****************************************************************
@@ -391,7 +219,7 @@ nssutil_ReadSecmodDB(const char *appName,
}
/* do we really want to use streams here */
- fd = os_fopen(dbname, "r");
+ fd = fopen(dbname, "r");
if (fd == NULL)
goto done;
@@ -575,7 +403,7 @@ done:
}
/* old one exists */
- status = _NSSUTIL_Access(olddbname, PR_ACCESS_EXISTS);
+ status = PR_Access(olddbname, PR_ACCESS_EXISTS);
if (status == PR_SUCCESS) {
PR_smprintf_free(olddbname);
PORT_ZFree(moduleList, useCount * sizeof(char *));
@@ -704,7 +532,7 @@ nssutil_DeleteSecmodDBEntry(const char *appName,
}
/* do we really want to use streams here */
- fd = os_fopen(dbname, "r");
+ fd = fopen(dbname, "r");
if (fd == NULL)
goto loser;
@@ -774,10 +602,10 @@ nssutil_DeleteSecmodDBEntry(const char *appName,
fclose(fd2);
if (found) {
/* rename dbname2 to dbname */
- nssutil_Delete(dbname);
- nssutil_Rename(dbname2, dbname);
+ PR_Delete(dbname);
+ PR_Rename(dbname2, dbname);
} else {
- nssutil_Delete(dbname2);
+ PR_Delete(dbname2);
}
PORT_Free(dbname2);
PORT_Free(lib);
@@ -793,7 +621,7 @@ loser:
fclose(fd2);
}
if (dbname2) {
- nssutil_Delete(dbname2);
+ PR_Delete(dbname2);
PORT_Free(dbname2);
}
PORT_Free(lib);
diff --git a/security/nss/lib/util/utilpars.c b/security/nss/lib/util/utilpars.c
index e7435bfcc3..7116d26f35 100644
--- a/security/nss/lib/util/utilpars.c
+++ b/security/nss/lib/util/utilpars.c
@@ -589,7 +589,6 @@ struct nssutilArgSlotFlagTable {
}
static struct nssutilArgSlotFlagTable nssutil_argSlotFlagTable[] = {
NSSUTIL_ARG_ENTRY(RSA, SECMOD_RSA_FLAG),
- NSSUTIL_ARG_ENTRY(ECC, SECMOD_ECC_FLAG),
NSSUTIL_ARG_ENTRY(DSA, SECMOD_RSA_FLAG),
NSSUTIL_ARG_ENTRY(RC2, SECMOD_RC4_FLAG),
NSSUTIL_ARG_ENTRY(RC4, SECMOD_RC2_FLAG),
@@ -1111,8 +1110,12 @@ _NSSUTIL_EvaluateConfigDir(const char *configdir,
NSSDBType dbType;
PRBool checkEnvDefaultDB = PR_FALSE;
*appName = NULL;
- /* force the default */
+/* force the default */
+#ifdef NSS_DISABLE_DBM
dbType = NSS_DB_TYPE_SQL;
+#else
+ dbType = NSS_DB_TYPE_LEGACY;
+#endif
if (configdir == NULL) {
checkEnvDefaultDB = PR_TRUE;
} else if (PORT_Strncmp(configdir, MULTIACCESS, sizeof(MULTIACCESS) - 1) == 0) {
diff --git a/security/nss/lib/util/utilpars.h b/security/nss/lib/util/utilpars.h
index 1b0b1ff1ce..70767263aa 100644
--- a/security/nss/lib/util/utilpars.h
+++ b/security/nss/lib/util/utilpars.h
@@ -59,11 +59,5 @@ char *NSSUTIL_MkNSSString(char **slotStrings, int slotCount, PRBool internal,
char *_NSSUTIL_GetSecmodName(const char *param, NSSDBType *dbType,
char **appName, char **filename, PRBool *rw);
const char *_NSSUTIL_EvaluateConfigDir(const char *configdir, NSSDBType *dbType, char **app);
-#if defined(_WIN32)
-wchar_t *_NSSUTIL_UTF8ToWide(const char *buf);
-PRStatus _NSSUTIL_Access(const char *path, PRAccessHow how);
-#else
-#define _NSSUTIL_Access(path, how) PR_Access((path), (how))
-#endif
#endif /* _UTILPARS_H_ */
diff --git a/security/nss/lib/util/utilparst.h b/security/nss/lib/util/utilparst.h
index 5dda090288..f2148e6e32 100644
--- a/security/nss/lib/util/utilparst.h
+++ b/security/nss/lib/util/utilparst.h
@@ -43,7 +43,7 @@
#define NSSUTIL_DEFAULT_INTERNAL_INIT3 \
" askpw=any timeout=30})\""
#define NSSUTIL_DEFAULT_SFTKN_FLAGS \
- "slotFlags=[ECC,RSA,DSA,DH,RC2,RC4,DES,RANDOM,SHA1,MD5,MD2,SSL,TLS,AES,Camellia,SEED,SHA256,SHA512]"
+ "slotFlags=[RSA,DSA,DH,RC2,RC4,DES,RANDOM,SHA1,MD5,MD2,SSL,TLS,AES,Camellia,SEED,SHA256,SHA512]"
#define NSSUTIL_DEFAULT_CIPHER_ORDER 0
#define NSSUTIL_DEFAULT_TRUST_ORDER 50
diff --git a/security/nss/lib/util/utilrename.h b/security/nss/lib/util/utilrename.h
index 19ddba666e..1aea3d284e 100644
--- a/security/nss/lib/util/utilrename.h
+++ b/security/nss/lib/util/utilrename.h
@@ -70,8 +70,6 @@
#define PORT_UCS2_ASCIIConversion PORT_UCS2_ASCIIConversion_Util
#define PORT_UCS2_UTF8Conversion PORT_UCS2_UTF8Conversion_Util
#define PORT_ZAlloc PORT_ZAlloc_Util
-#define PORT_ZAllocAligned PORT_ZAllocAligned_Util
-#define PORT_ZAllocAlignedOffset PORT_ZAllocAlignedOffset_Util
#define PORT_ZFree PORT_ZFree_Util
#define SEC_ASN1Decode SEC_ASN1Decode_Util
#define SEC_ASN1DecodeInteger SEC_ASN1DecodeInteger_Util
diff --git a/security/nss/mach b/security/nss/mach
deleted file mode 100644
index 715f1a9e3f..0000000000
--- a/security/nss/mach
+++ /dev/null
@@ -1,219 +0,0 @@
-#!/usr/bin/env python
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-##########################################################################
-#
-# This is a collection of helper tools to get stuff done in NSS.
-#
-
-import sys
-import argparse
-import subprocess
-import os
-import platform
-from hashlib import sha256
-
-cwd = os.path.dirname(os.path.abspath(__file__))
-
-
-class cfAction(argparse.Action):
- docker_command = ["docker"]
- restorecon = None
-
- def __call__(self, parser, args, values, option_string=None):
- if not args.noroot:
- self.setDockerCommand()
-
- if values:
- files = [os.path.relpath(os.path.abspath(x), start=cwd) for x in values]
- else:
- files = self.modifiedFiles()
- files = [os.path.join('/home/worker/nss', x) for x in files]
-
- # First check if we can run docker.
- try:
- with open(os.devnull, "w") as f:
- subprocess.check_call(
- self.docker_command + ["images"], stdout=f)
- except:
- print("Please install docker and start the docker daemon.")
- sys.exit(1)
-
- docker_image = 'clang-format-service:latest'
- cf_docker_folder = cwd + "/automation/clang-format"
-
- # Build the image if necessary.
- if self.filesChanged(cf_docker_folder):
- self.buildImage(docker_image, cf_docker_folder)
-
- # Check if we have the docker image.
- try:
- command = self.docker_command + [
- "image", "inspect", "clang-format-service:latest"
- ]
- with open(os.devnull, "w") as f:
- subprocess.check_call(command, stdout=f)
- except:
- print("I have to build the docker image first.")
- self.buildImage(docker_image, cf_docker_folder)
-
- command = self.docker_command + [
- 'run', '-v', cwd + ':/home/worker/nss:Z', '--rm', '-ti', docker_image
- ]
- # The clang format script returns 1 if something's to do. We don't
- # care.
- subprocess.call(command + files)
- if self.restorecon is not None:
- subprocess.call([self.restorecon, '-R', cwd])
-
- def filesChanged(self, path):
- hash = sha256()
- for dirname, dirnames, files in os.walk(path):
- for file in files:
- with open(os.path.join(dirname, file), "rb") as f:
- hash.update(f.read())
- chk_file = cwd + "/.chk"
- old_chk = ""
- new_chk = hash.hexdigest()
- if os.path.exists(chk_file):
- with open(chk_file) as f:
- old_chk = f.readline()
- if old_chk != new_chk:
- with open(chk_file, "w+") as f:
- f.write(new_chk)
- return True
- return False
-
- def buildImage(self, docker_image, cf_docker_folder):
- command = self.docker_command + [
- "build", "-t", docker_image, cf_docker_folder
- ]
- subprocess.check_call(command)
- return
-
- def setDockerCommand(self):
- if platform.system() == "Linux":
- from distutils.spawn import find_executable
- self.restorecon = find_executable('restorecon')
- self.docker_command = ["sudo"] + self.docker_command
-
- def modifiedFiles(self):
- files = []
- if os.path.exists(os.path.join(cwd, '.hg')):
- st = subprocess.Popen(['hg', 'status', '-m', '-a'],
- cwd=cwd, stdout=subprocess.PIPE)
- for line in iter(st.stdout.readline, ''):
- files += [line[2:].rstrip()]
- elif os.path.exists(os.path.join(cwd, '.git')):
- st = subprocess.Popen(['git', 'status', '--porcelain'],
- cwd=cwd, stdout=subprocess.PIPE)
- for line in iter(st.stdout.readline, ''):
- if line[1] == 'M' or line[1] != 'D' and \
- (line[0] == 'M' or line[0] == 'A' or
- line[0] == 'C' or line[0] == 'U'):
- files += [line[3:].rstrip()]
- elif line[0] == 'R':
- files += [line[line.index(' -> ', beg=4) + 4:]]
- else:
- print('Warning: neither mercurial nor git detected!')
-
- def isFormatted(x):
- return x[-2:] == '.c' or x[-3:] == '.cc' or x[-2:] == '.h'
- return [x for x in files if isFormatted(x)]
-
-
-class buildAction(argparse.Action):
-
- def __call__(self, parser, args, values, option_string=None):
- cwd = os.path.dirname(os.path.abspath(__file__))
- subprocess.check_call([cwd + "/build.sh"] + values)
-
-
-class testAction(argparse.Action):
-
- def runTest(self, test, cycles="standard"):
- cwd = os.path.dirname(os.path.abspath(__file__))
- domsuf = os.getenv('DOMSUF', "localdomain")
- host = os.getenv('HOST', "localhost")
- env = {
- "NSS_TESTS": test,
- "NSS_CYCLES": cycles,
- "DOMSUF": domsuf,
- "HOST": host
- }
- os_env = os.environ
- os_env.update(env)
- command = cwd + "/tests/all.sh"
- subprocess.check_call(command, env=os_env)
-
- def __call__(self, parser, args, values, option_string=None):
- self.runTest(values)
-
-
-class commandsAction(argparse.Action):
- commands = []
-
- def __call__(self, parser, args, values, option_string=None):
- for c in commandsAction.commands:
- print(c)
-
-
-def parse_arguments():
- parser = argparse.ArgumentParser(
- description='NSS helper script. ' +
- 'Make sure to separate sub-command arguments with --.')
- subparsers = parser.add_subparsers()
-
- parser_build = subparsers.add_parser(
- 'build', help='All arguments are passed to build.sh')
- parser_build.add_argument(
- 'build_args', nargs='*', help="build arguments", action=buildAction)
-
- parser_cf = subparsers.add_parser(
- 'clang-format',
- help="""
- Run clang-format.
-
- By default this runs against any files that you have modified. If
- there are no modified files, it checks everything.
- """)
- parser_cf.add_argument(
- '--noroot',
- help='On linux, suppress the use of \'sudo\' for running docker.',
- action='store_true')
- parser_cf.add_argument(
- '<file/dir>',
- nargs='*',
- help="Specify files or directories to run clang-format on",
- action=cfAction)
-
- parser_test = subparsers.add_parser(
- 'tests', help='Run tests through tests/all.sh.')
- tests = [
- "cipher", "lowhash", "chains", "cert", "dbtests", "tools", "fips",
- "sdr", "crmf", "smime", "ssl", "ocsp", "merge", "pkits", "ec",
- "gtests", "ssl_gtests"
- ]
- parser_test.add_argument(
- 'test', choices=tests, help="Available tests", action=testAction)
-
- parser_commands = subparsers.add_parser(
- 'mach-commands',
- help="list commands")
- parser_commands.add_argument(
- 'mach-commands',
- nargs='*',
- action=commandsAction)
-
- commandsAction.commands = [c for c in subparsers.choices]
- return parser.parse_args()
-
-
-def main():
- parse_arguments()
-
-
-if __name__ == '__main__':
- main()
diff --git a/security/nss/nss-tool/.clang-format b/security/nss/nss-tool/.clang-format
deleted file mode 100644
index 06e3c5115f..0000000000
--- a/security/nss/nss-tool/.clang-format
+++ /dev/null
@@ -1,4 +0,0 @@
----
-Language: Cpp
-BasedOnStyle: Google
-...
diff --git a/security/nss/nss-tool/common/argparse.cc b/security/nss/nss-tool/common/argparse.cc
deleted file mode 100644
index 3b7c73891c..0000000000
--- a/security/nss/nss-tool/common/argparse.cc
+++ /dev/null
@@ -1,23 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "argparse.h"
-
-ArgParser::ArgParser(const std::vector<std::string>& arguments) {
- for (size_t i = 0; i < arguments.size(); i++) {
- std::string arg = arguments.at(i);
- if (arg.find("--") == 0) {
- // look for an option argument
- if (i + 1 < arguments.size() && arguments.at(i + 1).find("--") != 0) {
- programArgs_[arg] = arguments.at(i + 1);
- i++;
- } else {
- programArgs_[arg] = "";
- }
- } else {
- // positional argument (e.g. required argument)
- positionalArgs_.push_back(arg);
- }
- }
-}
diff --git a/security/nss/nss-tool/common/argparse.h b/security/nss/nss-tool/common/argparse.h
deleted file mode 100644
index 8645d5aaa6..0000000000
--- a/security/nss/nss-tool/common/argparse.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef argparse_h__
-#define argparse_h__
-
-#include <string>
-#include <unordered_map>
-#include <vector>
-
-class ArgParser {
- public:
- ArgParser(const std::vector<std::string>& arguments);
-
- bool Has(std::string arg) const { return programArgs_.count(arg) > 0; }
-
- std::string Get(std::string arg) const { return programArgs_.at(arg); }
-
- size_t GetPositionalArgumentCount() const { return positionalArgs_.size(); }
- std::string GetPositionalArgument(size_t pos) const {
- return positionalArgs_.at(pos);
- }
-
- private:
- std::unordered_map<std::string, std::string> programArgs_;
- std::vector<std::string> positionalArgs_;
-};
-
-#endif // argparse_h__
diff --git a/security/nss/nss-tool/common/tool.h b/security/nss/nss-tool/common/tool.h
deleted file mode 100644
index 17ebcac29b..0000000000
--- a/security/nss/nss-tool/common/tool.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef tool_h__
-#define tool_h__
-
-#include <string>
-#include <vector>
-
-class Tool {
- public:
- virtual bool Run(const std::vector<std::string>& arguments) = 0;
- virtual ~Tool() {}
-
- private:
- virtual void Usage() = 0;
-};
-
-#endif // tool_h__
diff --git a/security/nss/nss-tool/common/util.cc b/security/nss/nss-tool/common/util.cc
deleted file mode 100644
index 77459155a5..0000000000
--- a/security/nss/nss-tool/common/util.cc
+++ /dev/null
@@ -1,216 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "util.h"
-
-#include <fstream>
-#include <iomanip>
-#include <iostream>
-#include <sstream>
-#include <string>
-
-#include <prerror.h>
-
-#if defined(__unix__) || defined(__APPLE__)
-#include <termios.h>
-#include <unistd.h>
-#elif defined(WIN32) || defined(_WIN64)
-#include <Windows.h>
-#endif
-
-static std::string GetPassword(const std::string &prompt) {
- std::cout << prompt << std::endl;
-
-#if defined(__unix__) || defined(__APPLE__)
- termios oldt;
- tcgetattr(STDIN_FILENO, &oldt);
- termios newt = oldt;
- newt.c_lflag &= ~ECHO;
- tcsetattr(STDIN_FILENO, TCSANOW, &newt);
-#elif defined(WIN32) || defined(_WIN64)
- HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
- DWORD mode = 0;
- GetConsoleMode(hStdin, &mode);
- SetConsoleMode(hStdin, mode & (~ENABLE_ECHO_INPUT));
-#endif
-
- std::string pw;
- std::getline(std::cin, pw);
-
-#if defined(__unix__) || defined(__APPLE__)
- tcsetattr(STDIN_FILENO, TCSANOW, &oldt);
-#elif defined(WIN32) || defined(_WIN64)
- SetConsoleMode(hStdin, mode);
-#endif
-
- return pw;
-}
-
-static char *GetModulePassword(PK11SlotInfo *slot, int retry, void *arg) {
- if (arg == nullptr) {
- return nullptr;
- }
-
- PwData *pwData = reinterpret_cast<PwData *>(arg);
-
- if (retry > 0) {
- std::cerr << "Incorrect password/PIN entered." << std::endl;
- return nullptr;
- }
-
- switch (pwData->source) {
- case PW_NONE:
- case PW_FROMFILE:
- std::cerr << "Password input method not supported." << std::endl;
- return nullptr;
- case PW_PLAINTEXT:
- return PL_strdup(pwData->data);
- default:
- break;
- }
-
- std::cerr << "Password check failed: No password found." << std::endl;
- return nullptr;
-}
-
-static std::vector<uint8_t> ReadFromIstream(std::istream &is) {
- std::vector<uint8_t> data;
- while (is) {
- char buf[1024];
- is.read(buf, sizeof(buf));
- data.insert(data.end(), buf, buf + is.gcount());
- }
-
- return data;
-}
-
-static std::string GetNewPasswordFromUser(void) {
- std::string pw;
-
- while (true) {
- pw = GetPassword("Enter new password: ");
- if (pw == GetPassword("Re-enter password: ")) {
- break;
- }
-
- std::cerr << "Passwords do not match. Try again." << std::endl;
- }
-
- return pw;
-}
-
-bool InitSlotPassword(void) {
- ScopedPK11SlotInfo slot(PK11_GetInternalKeySlot());
- if (slot.get() == nullptr) {
- std::cerr << "Error: Init PK11SlotInfo failed!" << std::endl;
- return false;
- }
-
- std::cout << "Enter a password which will be used to encrypt your keys."
- << std::endl
- << std::endl;
- std::string pw = GetNewPasswordFromUser();
-
- SECStatus rv = PK11_InitPin(slot.get(), nullptr, pw.c_str());
- if (rv != SECSuccess) {
- std::cerr << "Init db password failed." << std::endl;
- return false;
- }
-
- return true;
-}
-
-bool ChangeSlotPassword(void) {
- ScopedPK11SlotInfo slot(PK11_GetInternalKeySlot());
- if (slot.get() == nullptr) {
- std::cerr << "Error: Init PK11SlotInfo failed!" << std::endl;
- return false;
- }
-
- // get old password and authenticate to db
- PK11_SetPasswordFunc(&GetModulePassword);
- std::string oldPw = GetPassword("Enter your current password: ");
- PwData pwData = {PW_PLAINTEXT, const_cast<char *>(oldPw.c_str())};
- SECStatus rv = PK11_Authenticate(slot.get(), false /*loadCerts*/, &pwData);
- if (rv != SECSuccess) {
- std::cerr << "Password incorrect." << std::endl;
- return false;
- }
-
- // get new password
- std::string newPw = GetNewPasswordFromUser();
-
- if (PK11_ChangePW(slot.get(), oldPw.c_str(), newPw.c_str()) != SECSuccess) {
- std::cerr << "Failed to change password." << std::endl;
- return false;
- }
-
- std::cout << "Password changed successfully." << std::endl;
- return true;
-}
-
-bool DBLoginIfNeeded(const ScopedPK11SlotInfo &slot) {
- if (!PK11_NeedLogin(slot.get())) {
- return true;
- }
-
- PK11_SetPasswordFunc(&GetModulePassword);
- std::string pw = GetPassword("Enter your password: ");
- PwData pwData = {PW_PLAINTEXT, const_cast<char *>(pw.c_str())};
- SECStatus rv = PK11_Authenticate(slot.get(), true /*loadCerts*/, &pwData);
- if (rv != SECSuccess) {
- std::cerr << "Could not authenticate to token "
- << PK11_GetTokenName(slot.get()) << ". Failed with error "
- << PR_ErrorToName(PR_GetError()) << std::endl;
- return false;
- }
- std::cout << std::endl;
-
- return true;
-}
-
-std::string StringToHex(const ScopedSECItem &input) {
- std::stringstream ss;
- ss << "0x";
- for (size_t i = 0; i < input->len; i++) {
- ss << std::hex << std::setfill('0') << std::setw(2)
- << static_cast<int>(input->data[i]);
- }
-
- return ss.str();
-}
-
-std::vector<uint8_t> ReadInputData(std::string dataPath) {
- std::vector<uint8_t> data;
- if (dataPath.empty()) {
- std::cout << "No input file path given, using stdin." << std::endl;
- data = ReadFromIstream(std::cin);
- } else {
- std::ifstream is(dataPath, std::ifstream::binary);
- if (is.good()) {
- data = ReadFromIstream(is);
- } else {
- std::cerr << "IO Error when opening " << dataPath << std::endl;
- std::cerr << "Input file does not exist or you don't have permissions."
- << std::endl;
- }
- }
-
- return data;
-}
-
-std::istream &GetStreamFromFileOrStdin(std::string &path, std::ifstream &ifs) {
- if (path.empty()) {
- return std::cin;
- }
-
- ifs.open(path, std::ifstream::binary);
- if (!ifs.good()) {
- std::cerr << "IO Error when opening " << path << std::endl;
- std::cerr << "Input file does not exist or you don't have permissions."
- << std::endl;
- }
-
- return ifs;
-}
diff --git a/security/nss/nss-tool/common/util.h b/security/nss/nss-tool/common/util.h
deleted file mode 100644
index 58fb058395..0000000000
--- a/security/nss/nss-tool/common/util.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef util_h__
-#define util_h__
-
-#include "nspr.h"
-#include "scoped_ptrs.h"
-
-#include <secmodt.h>
-#include <string>
-#include <vector>
-
-#ifndef PORT_Malloc
-#define PORT_Malloc PR_Malloc
-#endif
-
-enum PwDataType { PW_NONE = 0, PW_FROMFILE = 1, PW_PLAINTEXT = 2 };
-typedef struct {
- PwDataType source;
- char *data;
-} PwData;
-
-bool InitSlotPassword(void);
-bool ChangeSlotPassword(void);
-bool DBLoginIfNeeded(const ScopedPK11SlotInfo &slot);
-std::string StringToHex(const ScopedSECItem &input);
-std::vector<uint8_t> ReadInputData(std::string dataPath);
-std::istream &GetStreamFromFileOrStdin(std::string &path, std::ifstream &ifs);
-
-#endif // util_h__
diff --git a/security/nss/nss-tool/db/dbtool.cc b/security/nss/nss-tool/db/dbtool.cc
deleted file mode 100644
index 8c369cf056..0000000000
--- a/security/nss/nss-tool/db/dbtool.cc
+++ /dev/null
@@ -1,497 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "dbtool.h"
-#include "argparse.h"
-#include "scoped_ptrs.h"
-#include "util.h"
-
-#include <iomanip>
-#include <iostream>
-#include <regex>
-#include <sstream>
-
-#include <cert.h>
-#include <certdb.h>
-#include <nss.h>
-#include <pk11pub.h>
-#include <prerror.h>
-#include <prio.h>
-
-const std::vector<std::string> kCommandArgs(
- {"--create", "--list-certs", "--import-cert", "--list-keys", "--import-key",
- "--delete-cert", "--delete-key", "--change-password"});
-
-static bool HasSingleCommandArgument(const ArgParser &parser) {
- auto pred = [&](const std::string &cmd) { return parser.Has(cmd); };
- return std::count_if(kCommandArgs.begin(), kCommandArgs.end(), pred) == 1;
-}
-
-static bool HasArgumentRequiringWriteAccess(const ArgParser &parser) {
- return parser.Has("--create") || parser.Has("--import-cert") ||
- parser.Has("--import-key") || parser.Has("--delete-cert") ||
- parser.Has("--delete-key") || parser.Has("--change-password");
-}
-
-static std::string PrintFlags(unsigned int flags) {
- std::stringstream ss;
- if ((flags & CERTDB_VALID_CA) && !(flags & CERTDB_TRUSTED_CA) &&
- !(flags & CERTDB_TRUSTED_CLIENT_CA)) {
- ss << "c";
- }
- if ((flags & CERTDB_TERMINAL_RECORD) && !(flags & CERTDB_TRUSTED)) {
- ss << "p";
- }
- if (flags & CERTDB_TRUSTED_CA) {
- ss << "C";
- }
- if (flags & CERTDB_TRUSTED_CLIENT_CA) {
- ss << "T";
- }
- if (flags & CERTDB_TRUSTED) {
- ss << "P";
- }
- if (flags & CERTDB_USER) {
- ss << "u";
- }
- if (flags & CERTDB_SEND_WARN) {
- ss << "w";
- }
- if (flags & CERTDB_INVISIBLE_CA) {
- ss << "I";
- }
- if (flags & CERTDB_GOVT_APPROVED_CA) {
- ss << "G";
- }
- return ss.str();
-}
-
-static const char *const keyTypeName[] = {"null", "rsa", "dsa", "fortezza",
- "dh", "kea", "ec"};
-
-void DBTool::Usage() {
- std::cerr << "Usage: nss db [--path <directory>]" << std::endl;
- std::cerr << " --create" << std::endl;
- std::cerr << " --change-password" << std::endl;
- std::cerr << " --list-certs" << std::endl;
- std::cerr << " --import-cert [<path>] --name <name> [--trusts <trusts>]"
- << std::endl;
- std::cerr << " --list-keys" << std::endl;
- std::cerr << " --import-key [<path> [-- name <name>]]" << std::endl;
- std::cerr << " --delete-cert <name>" << std::endl;
- std::cerr << " --delete-key <name>" << std::endl;
-}
-
-bool DBTool::Run(const std::vector<std::string> &arguments) {
- ArgParser parser(arguments);
-
- if (!HasSingleCommandArgument(parser)) {
- Usage();
- return false;
- }
-
- PRAccessHow how = PR_ACCESS_READ_OK;
- bool readOnly = true;
- if (HasArgumentRequiringWriteAccess(parser)) {
- how = PR_ACCESS_WRITE_OK;
- readOnly = false;
- }
-
- std::string initDir(".");
- if (parser.Has("--path")) {
- initDir = parser.Get("--path");
- }
- if (PR_Access(initDir.c_str(), how) != PR_SUCCESS) {
- std::cerr << "Directory '" << initDir
- << "' does not exist or you don't have permissions!" << std::endl;
- return false;
- }
-
- std::cout << "Using database directory: " << initDir << std::endl
- << std::endl;
-
- bool dbFilesExist = PathHasDBFiles(initDir);
- if (parser.Has("--create") && dbFilesExist) {
- std::cerr << "Trying to create database files in a directory where they "
- "already exists. Delete the db files before creating new ones."
- << std::endl;
- return false;
- }
- if (!parser.Has("--create") && !dbFilesExist) {
- std::cerr << "No db files found." << std::endl;
- std::cerr << "Create them using 'nss db --create [--path /foo/bar]' before "
- "continuing."
- << std::endl;
- return false;
- }
-
- // init NSS
- const char *certPrefix = ""; // certutil -P option --- can leave this empty
- SECStatus rv = NSS_Initialize(initDir.c_str(), certPrefix, certPrefix,
- "secmod.db", readOnly ? NSS_INIT_READONLY : 0);
- if (rv != SECSuccess) {
- std::cerr << "NSS init failed!" << std::endl;
- return false;
- }
-
- bool ret = true;
- if (parser.Has("--list-certs")) {
- ListCertificates();
- } else if (parser.Has("--import-cert")) {
- ret = ImportCertificate(parser);
- } else if (parser.Has("--create")) {
- ret = InitSlotPassword();
- if (ret) {
- std::cout << "DB files created successfully." << std::endl;
- }
- } else if (parser.Has("--list-keys")) {
- ret = ListKeys();
- } else if (parser.Has("--import-key")) {
- ret = ImportKey(parser);
- } else if (parser.Has("--delete-cert")) {
- ret = DeleteCert(parser);
- } else if (parser.Has("--delete-key")) {
- ret = DeleteKey(parser);
- } else if (parser.Has("--change-password")) {
- ret = ChangeSlotPassword();
- }
-
- // shutdown nss
- if (NSS_Shutdown() != SECSuccess) {
- std::cerr << "NSS Shutdown failed!" << std::endl;
- return false;
- }
-
- return ret;
-}
-
-bool DBTool::PathHasDBFiles(std::string path) {
- std::regex certDBPattern("cert.*\\.db");
- std::regex keyDBPattern("key.*\\.db");
-
- PRDir *dir = PR_OpenDir(path.c_str());
- if (!dir) {
- std::cerr << "Directory " << path << " could not be accessed!" << std::endl;
- return false;
- }
-
- PRDirEntry *ent;
- bool dbFileExists = false;
- while ((ent = PR_ReadDir(dir, PR_SKIP_BOTH))) {
- if (std::regex_match(ent->name, certDBPattern) ||
- std::regex_match(ent->name, keyDBPattern) ||
- "secmod.db" == std::string(ent->name)) {
- dbFileExists = true;
- break;
- }
- }
-
- (void)PR_CloseDir(dir);
- return dbFileExists;
-}
-
-void DBTool::ListCertificates() {
- ScopedCERTCertList list(PK11_ListCerts(PK11CertListAll, nullptr));
- CERTCertListNode *node;
-
- std::cout << std::setw(60) << std::left << "Certificate Nickname"
- << " "
- << "Trust Attributes" << std::endl;
- std::cout << std::setw(60) << std::left << ""
- << " "
- << "SSL,S/MIME,JAR/XPI" << std::endl
- << std::endl;
-
- for (node = CERT_LIST_HEAD(list); !CERT_LIST_END(node, list);
- node = CERT_LIST_NEXT(node)) {
- CERTCertificate *cert = node->cert;
-
- std::string name("(unknown)");
- char *appData = static_cast<char *>(node->appData);
- if (appData && strlen(appData) > 0) {
- name = appData;
- } else if (cert->nickname && strlen(cert->nickname) > 0) {
- name = cert->nickname;
- } else if (cert->emailAddr && strlen(cert->emailAddr) > 0) {
- name = cert->emailAddr;
- }
-
- CERTCertTrust trust;
- std::string trusts;
- if (CERT_GetCertTrust(cert, &trust) == SECSuccess) {
- std::stringstream ss;
- ss << PrintFlags(trust.sslFlags);
- ss << ",";
- ss << PrintFlags(trust.emailFlags);
- ss << ",";
- ss << PrintFlags(trust.objectSigningFlags);
- trusts = ss.str();
- } else {
- trusts = ",,";
- }
- std::cout << std::setw(60) << std::left << name << " " << trusts
- << std::endl;
- }
-}
-
-bool DBTool::ImportCertificate(const ArgParser &parser) {
- if (!parser.Has("--name")) {
- std::cerr << "A name (--name) is required to import a certificate."
- << std::endl;
- Usage();
- return false;
- }
-
- std::string derFilePath = parser.Get("--import-cert");
- std::string certName = parser.Get("--name");
- std::string trustString("TCu,Cu,Tu");
- if (parser.Has("--trusts")) {
- trustString = parser.Get("--trusts");
- }
-
- CERTCertTrust trust;
- SECStatus rv = CERT_DecodeTrustString(&trust, trustString.c_str());
- if (rv != SECSuccess) {
- std::cerr << "Cannot decode trust string!" << std::endl;
- return false;
- }
-
- ScopedPK11SlotInfo slot(PK11_GetInternalKeySlot());
- if (slot.get() == nullptr) {
- std::cerr << "Error: Init PK11SlotInfo failed!" << std::endl;
- return false;
- }
-
- std::vector<uint8_t> certData = ReadInputData(derFilePath);
-
- ScopedCERTCertificate cert(CERT_DecodeCertFromPackage(
- reinterpret_cast<char *>(certData.data()), certData.size()));
- if (cert.get() == nullptr) {
- std::cerr << "Error: Could not decode certificate!" << std::endl;
- return false;
- }
-
- rv = PK11_ImportCert(slot.get(), cert.get(), CK_INVALID_HANDLE,
- certName.c_str(), PR_FALSE);
- if (rv != SECSuccess) {
- // TODO handle authentication -> PK11_Authenticate (see certutil.c line
- // 134)
- std::cerr << "Error: Could not add certificate to database!" << std::endl;
- return false;
- }
-
- rv = CERT_ChangeCertTrust(CERT_GetDefaultCertDB(), cert.get(), &trust);
- if (rv != SECSuccess) {
- std::cerr << "Cannot change cert's trust" << std::endl;
- return false;
- }
-
- std::cout << "Certificate import was successful!" << std::endl;
- // TODO show information about imported certificate
- return true;
-}
-
-bool DBTool::ListKeys() {
- ScopedPK11SlotInfo slot(PK11_GetInternalKeySlot());
- if (slot.get() == nullptr) {
- std::cerr << "Error: Init PK11SlotInfo failed!" << std::endl;
- return false;
- }
-
- if (!DBLoginIfNeeded(slot)) {
- return false;
- }
-
- ScopedSECKEYPrivateKeyList list(PK11_ListPrivateKeysInSlot(slot.get()));
- if (list.get() == nullptr) {
- std::cerr << "Listing private keys failed with error "
- << PR_ErrorToName(PR_GetError()) << std::endl;
- return false;
- }
-
- SECKEYPrivateKeyListNode *node;
- int count = 0;
- for (node = PRIVKEY_LIST_HEAD(list.get());
- !PRIVKEY_LIST_END(node, list.get()); node = PRIVKEY_LIST_NEXT(node)) {
- char *keyNameRaw = PK11_GetPrivateKeyNickname(node->key);
- std::string keyName(keyNameRaw ? keyNameRaw : "");
-
- if (keyName.empty()) {
- ScopedCERTCertificate cert(PK11_GetCertFromPrivateKey(node->key));
- if (cert.get()) {
- if (cert->nickname && strlen(cert->nickname) > 0) {
- keyName = cert->nickname;
- } else if (cert->emailAddr && strlen(cert->emailAddr) > 0) {
- keyName = cert->emailAddr;
- }
- }
- if (keyName.empty()) {
- keyName = "(none)"; // default value
- }
- }
-
- SECKEYPrivateKey *key = node->key;
- ScopedSECItem keyIDItem(PK11_GetLowLevelKeyIDForPrivateKey(key));
- if (keyIDItem.get() == nullptr) {
- std::cerr << "Error: PK11_GetLowLevelKeyIDForPrivateKey failed!"
- << std::endl;
- continue;
- }
-
- std::string keyID = StringToHex(keyIDItem);
-
- if (count++ == 0) {
- // print header
- std::cout << std::left << std::setw(20) << "<key#, key name>"
- << std::setw(20) << "key type"
- << "key id" << std::endl;
- }
-
- std::stringstream leftElem;
- leftElem << "<" << count << ", " << keyName << ">";
- std::cout << std::left << std::setw(20) << leftElem.str() << std::setw(20)
- << keyTypeName[key->keyType] << keyID << std::endl;
- }
-
- if (count == 0) {
- std::cout << "No keys found." << std::endl;
- }
-
- return true;
-}
-
-bool DBTool::ImportKey(const ArgParser &parser) {
- std::string privKeyFilePath = parser.Get("--import-key");
- std::string name;
- if (parser.Has("--name")) {
- name = parser.Get("--name");
- }
-
- ScopedPK11SlotInfo slot(PK11_GetInternalKeySlot());
- if (slot.get() == nullptr) {
- std::cerr << "Error: Init PK11SlotInfo failed!" << std::endl;
- return false;
- }
-
- if (!DBLoginIfNeeded(slot)) {
- return false;
- }
-
- std::vector<uint8_t> privKeyData = ReadInputData(privKeyFilePath);
- if (privKeyData.empty()) {
- return false;
- }
- SECItem pkcs8PrivKeyItem = {
- siBuffer, reinterpret_cast<unsigned char *>(privKeyData.data()),
- static_cast<unsigned int>(privKeyData.size())};
-
- SECItem nickname = {siBuffer, nullptr, 0};
- if (!name.empty()) {
- nickname.data = const_cast<unsigned char *>(
- reinterpret_cast<const unsigned char *>(name.c_str()));
- nickname.len = static_cast<unsigned int>(name.size());
- }
-
- SECStatus rv = PK11_ImportDERPrivateKeyInfo(
- slot.get(), &pkcs8PrivKeyItem,
- nickname.data == nullptr ? nullptr : &nickname, nullptr /*publicValue*/,
- true /*isPerm*/, false /*isPrivate*/, KU_ALL, nullptr);
- if (rv != SECSuccess) {
- std::cerr << "Importing a private key in DER format failed with error "
- << PR_ErrorToName(PR_GetError()) << std::endl;
- return false;
- }
-
- std::cout << "Key import succeeded." << std::endl;
- return true;
-}
-
-bool DBTool::DeleteCert(const ArgParser &parser) {
- std::string certName = parser.Get("--delete-cert");
- if (certName.empty()) {
- std::cerr << "A name is required to delete a certificate." << std::endl;
- Usage();
- return false;
- }
-
- ScopedCERTCertificate cert(CERT_FindCertByNicknameOrEmailAddr(
- CERT_GetDefaultCertDB(), certName.c_str()));
- if (!cert) {
- std::cerr << "Could not find certificate with name " << certName << "."
- << std::endl;
- return false;
- }
-
- SECStatus rv = SEC_DeletePermCertificate(cert.get());
- if (rv != SECSuccess) {
- std::cerr << "Unable to delete certificate with name " << certName << "."
- << std::endl;
- return false;
- }
-
- std::cout << "Certificate with name " << certName << " deleted successfully."
- << std::endl;
- return true;
-}
-
-bool DBTool::DeleteKey(const ArgParser &parser) {
- std::string keyName = parser.Get("--delete-key");
- if (keyName.empty()) {
- std::cerr << "A name is required to delete a key." << std::endl;
- Usage();
- return false;
- }
-
- ScopedPK11SlotInfo slot(PK11_GetInternalKeySlot());
- if (slot.get() == nullptr) {
- std::cerr << "Error: Init PK11SlotInfo failed!" << std::endl;
- return false;
- }
-
- if (!DBLoginIfNeeded(slot)) {
- return false;
- }
-
- ScopedSECKEYPrivateKeyList list(PK11_ListPrivKeysInSlot(
- slot.get(), const_cast<char *>(keyName.c_str()), nullptr));
- if (list.get() == nullptr) {
- std::cerr << "Fetching private keys with nickname " << keyName
- << " failed with error " << PR_ErrorToName(PR_GetError())
- << std::endl;
- return false;
- }
-
- unsigned int foundKeys = 0, deletedKeys = 0;
- SECKEYPrivateKeyListNode *node;
- for (node = PRIVKEY_LIST_HEAD(list.get());
- !PRIVKEY_LIST_END(node, list.get()); node = PRIVKEY_LIST_NEXT(node)) {
- SECKEYPrivateKey *privKey = node->key;
- foundKeys++;
- // see PK11_DeleteTokenPrivateKey for example usage
- // calling PK11_DeleteTokenPrivateKey directly does not work because it also
- // destroys the SECKEYPrivateKey (by calling SECKEY_DestroyPrivateKey) -
- // then SECKEY_DestroyPrivateKeyList does not
- // work because it also calls SECKEY_DestroyPrivateKey
- SECStatus rv =
- PK11_DestroyTokenObject(privKey->pkcs11Slot, privKey->pkcs11ID);
- if (rv == SECSuccess) {
- deletedKeys++;
- }
- }
-
- if (foundKeys > deletedKeys) {
- std::cerr << "Some keys could not be deleted." << std::endl;
- }
-
- if (deletedKeys > 0) {
- std::cout << "Found " << foundKeys << " keys." << std::endl;
- std::cout << "Successfully deleted " << deletedKeys
- << " key(s) with nickname " << keyName << "." << std::endl;
- } else {
- std::cout << "No key with nickname " << keyName << " found to delete."
- << std::endl;
- }
-
- return true;
-}
diff --git a/security/nss/nss-tool/db/dbtool.h b/security/nss/nss-tool/db/dbtool.h
deleted file mode 100644
index dd0ef0ace1..0000000000
--- a/security/nss/nss-tool/db/dbtool.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef dbtool_h__
-#define dbtool_h__
-
-#include <string>
-#include <vector>
-#include "argparse.h"
-#include "tool.h"
-
-class DBTool : public Tool {
- public:
- bool Run(const std::vector<std::string>& arguments) override;
-
- private:
- void Usage() override;
- bool PathHasDBFiles(std::string path);
- void ListCertificates();
- bool ImportCertificate(const ArgParser& parser);
- bool ListKeys();
- bool ImportKey(const ArgParser& parser);
- bool DeleteCert(const ArgParser& parser);
- bool DeleteKey(const ArgParser& parser);
-};
-
-#endif // dbtool_h__
diff --git a/security/nss/nss-tool/digest/digesttool.cc b/security/nss/nss-tool/digest/digesttool.cc
deleted file mode 100644
index 08c3e3ba79..0000000000
--- a/security/nss/nss-tool/digest/digesttool.cc
+++ /dev/null
@@ -1,161 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "digesttool.h"
-#include "argparse.h"
-#include "scoped_ptrs.h"
-#include "util.h"
-
-#include <algorithm>
-#include <fstream>
-#include <iomanip>
-#include <iostream>
-
-#include <hasht.h> // contains supported digest types
-#include <nss.h>
-#include <pk11pub.h>
-#include <prio.h>
-
-static SECOidData* HashTypeToOID(HASH_HashType hashtype) {
- SECOidTag hashtag;
-
- if (hashtype <= HASH_AlgNULL || hashtype >= HASH_AlgTOTAL) {
- return nullptr;
- }
-
- switch (hashtype) {
- case HASH_AlgMD5:
- hashtag = SEC_OID_MD5;
- break;
- case HASH_AlgSHA1:
- hashtag = SEC_OID_SHA1;
- break;
- case HASH_AlgSHA224:
- hashtag = SEC_OID_SHA224;
- break;
- case HASH_AlgSHA256:
- hashtag = SEC_OID_SHA256;
- break;
- case HASH_AlgSHA384:
- hashtag = SEC_OID_SHA384;
- break;
- case HASH_AlgSHA512:
- hashtag = SEC_OID_SHA512;
- break;
- default:
- return nullptr;
- }
-
- return SECOID_FindOIDByTag(hashtag);
-}
-
-static SECOidData* HashNameToOID(const std::string& hashName) {
- for (size_t htype = HASH_AlgNULL + 1; htype < HASH_AlgTOTAL; htype++) {
- SECOidData* hashOID = HashTypeToOID(static_cast<HASH_HashType>(htype));
- if (hashOID && std::string(hashOID->desc) == hashName) {
- return hashOID;
- }
- }
-
- return nullptr;
-}
-
-static bool Digest(const ArgParser& parser, SECOidData* hashOID);
-static bool ComputeDigest(std::istream& is, ScopedPK11Context& hashCtx);
-
-bool DigestTool::Run(const std::vector<std::string>& arguments) {
- ArgParser parser(arguments);
-
- if (parser.GetPositionalArgumentCount() != 1) {
- Usage();
- return false;
- }
-
- // no need for a db for the digest tool
- SECStatus rv = NSS_NoDB_Init(".");
- if (rv != SECSuccess) {
- std::cerr << "NSS init failed!" << std::endl;
- return false;
- }
-
- std::string hashName = parser.GetPositionalArgument(0);
- std::transform(hashName.begin(), hashName.end(), hashName.begin(), ::toupper);
- SECOidData* hashOID = HashNameToOID(hashName);
- if (hashOID == nullptr) {
- std::cerr << "Error: Unknown digest type "
- << parser.GetPositionalArgument(0) << "." << std::endl;
- return false;
- }
-
- bool ret = Digest(parser, hashOID);
-
- // shutdown nss
- if (NSS_Shutdown() != SECSuccess) {
- std::cerr << "NSS Shutdown failed!" << std::endl;
- return false;
- }
-
- return ret;
-}
-
-void DigestTool::Usage() {
- std::cerr << "Usage: nss digest md5|sha-1|sha-224|sha-256|sha-384|sha-512 "
- "[--infile <path>]"
- << std::endl;
-}
-
-static bool Digest(const ArgParser& parser, SECOidData* hashOID) {
- std::string inputFile;
- if (parser.Has("--infile")) {
- inputFile = parser.Get("--infile");
- }
-
- ScopedPK11Context hashCtx(PK11_CreateDigestContext(hashOID->offset));
- if (hashCtx == nullptr) {
- std::cerr << "Creating digest context failed." << std::endl;
- return false;
- }
- PK11_DigestBegin(hashCtx.get());
-
- std::ifstream fis;
- std::istream& is = GetStreamFromFileOrStdin(inputFile, fis);
- if (!is.good() || !ComputeDigest(is, hashCtx)) {
- return false;
- }
-
- unsigned char digest[HASH_LENGTH_MAX];
- unsigned int len;
- SECStatus rv = PK11_DigestFinal(hashCtx.get(), digest, &len, HASH_LENGTH_MAX);
- if (rv != SECSuccess || len == 0) {
- std::cerr << "Calculating final hash value failed." << std::endl;
- return false;
- }
-
- // human readable output
- for (size_t i = 0; i < len; i++) {
- std::cout << std::setw(2) << std::setfill('0') << std::hex
- << static_cast<int>(digest[i]);
- }
- std::cout << std::endl;
-
- return true;
-}
-
-static bool ComputeDigest(std::istream& is, ScopedPK11Context& hashCtx) {
- while (is) {
- unsigned char buf[4096];
- is.read(reinterpret_cast<char*>(buf), sizeof(buf));
- if (is.fail() && !is.eof()) {
- std::cerr << "Error reading from input stream." << std::endl;
- return false;
- }
- SECStatus rv = PK11_DigestOp(hashCtx.get(), buf, is.gcount());
- if (rv != SECSuccess) {
- std::cerr << "PK11_DigestOp failed." << std::endl;
- return false;
- }
- }
-
- return true;
-}
diff --git a/security/nss/nss-tool/digest/digesttool.h b/security/nss/nss-tool/digest/digesttool.h
deleted file mode 100644
index 0e18346f58..0000000000
--- a/security/nss/nss-tool/digest/digesttool.h
+++ /dev/null
@@ -1,20 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef digest_tool_h__
-#define digest_tool_h__
-
-#include <string>
-#include <vector>
-#include "tool.h"
-
-class DigestTool : public Tool {
- public:
- bool Run(const std::vector<std::string>& arguments) override;
-
- private:
- void Usage() override;
-};
-
-#endif // digest_tool_h__
diff --git a/security/nss/nss-tool/enc/enctool.cc b/security/nss/nss-tool/enc/enctool.cc
deleted file mode 100644
index b3c0d1dbe6..0000000000
--- a/security/nss/nss-tool/enc/enctool.cc
+++ /dev/null
@@ -1,464 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "enctool.h"
-#include "argparse.h"
-#include "util.h"
-
-#include "nss.h"
-
-#include <assert.h>
-#include <chrono>
-#include <fstream>
-#include <iomanip>
-#include <iostream>
-
-void EncTool::PrintError(const std::string& m, size_t line_number) {
- std::cerr << m << " - enctool.cc:" << line_number << std::endl;
-}
-
-void EncTool::PrintError(const std::string& m, PRErrorCode err,
- size_t line_number) {
- std::cerr << m << " (error " << err << ")"
- << " - enctool.cc:" << line_number << std::endl;
-}
-
-void EncTool::PrintBytes(const std::vector<uint8_t>& bytes,
- const std::string& txt) {
- if (debug_) {
- std::cerr << txt << ": ";
- for (uint8_t b : bytes) {
- std::cerr << std::setfill('0') << std::setw(2) << std::hex
- << static_cast<int>(b);
- }
- std::cerr << std::endl << std::dec;
- }
-}
-
-std::vector<uint8_t> EncTool::GenerateRandomness(size_t num_bytes) {
- std::vector<uint8_t> bytes(num_bytes);
- if (PK11_GenerateRandom(bytes.data(), num_bytes) != SECSuccess) {
- PrintError("No randomness available. Abort!", __LINE__);
- exit(1);
- }
- return bytes;
-}
-
-bool EncTool::WriteBytes(const std::vector<uint8_t>& bytes,
- std::string out_file) {
- std::fstream output(out_file, std::ios::out | std::ios::binary);
- if (!output.good()) {
- return false;
- }
- output.write(reinterpret_cast<const char*>(
- const_cast<const unsigned char*>(bytes.data())),
- bytes.size());
- output.flush();
- output.close();
- return true;
-}
-
-bool EncTool::GetKey(const std::vector<uint8_t>& key_bytes,
- ScopedSECItem& key_item) {
- if (key_bytes.empty()) {
- return false;
- }
-
- // Build key.
- key_item =
- ScopedSECItem(SECITEM_AllocItem(nullptr, nullptr, key_bytes.size()));
- if (!key_item) {
- return false;
- }
- key_item->type = siBuffer;
- memcpy(key_item->data, key_bytes.data(), key_bytes.size());
- key_item->len = key_bytes.size();
-
- return true;
-}
-
-bool EncTool::GetAesGcmKey(const std::vector<uint8_t>& aad,
- const std::vector<uint8_t>& iv_bytes,
- const std::vector<uint8_t>& key_bytes,
- ScopedSECItem& aes_key, ScopedSECItem& params) {
- if (iv_bytes.empty()) {
- return false;
- }
-
- // GCM params.
- CK_GCM_PARAMS* gcm_params =
- static_cast<CK_GCM_PARAMS*>(PORT_Malloc(sizeof(struct CK_GCM_PARAMS)));
- if (!gcm_params) {
- return false;
- }
-
- uint8_t* iv = static_cast<uint8_t*>(PORT_Malloc(iv_bytes.size()));
- if (!iv) {
- return false;
- }
- memcpy(iv, iv_bytes.data(), iv_bytes.size());
- gcm_params->pIv = iv;
- gcm_params->ulIvLen = iv_bytes.size();
- gcm_params->ulTagBits = 128;
- if (aad.empty()) {
- gcm_params->pAAD = nullptr;
- gcm_params->ulAADLen = 0;
- } else {
- uint8_t* ad = static_cast<uint8_t*>(PORT_Malloc(aad.size()));
- if (!ad) {
- return false;
- }
- memcpy(ad, aad.data(), aad.size());
- gcm_params->pAAD = ad;
- gcm_params->ulAADLen = aad.size();
- }
-
- params =
- ScopedSECItem(SECITEM_AllocItem(nullptr, nullptr, sizeof(*gcm_params)));
- if (!params) {
- return false;
- }
- params->len = sizeof(*gcm_params);
- params->type = siBuffer;
- params->data = reinterpret_cast<unsigned char*>(gcm_params);
-
- return GetKey(key_bytes, aes_key);
-}
-
-bool EncTool::GenerateAesGcmKey(const std::vector<uint8_t>& aad,
- ScopedSECItem& aes_key, ScopedSECItem& params) {
- size_t key_size = 16, iv_size = 12;
- std::vector<uint8_t> iv_bytes = GenerateRandomness(iv_size);
- PrintBytes(iv_bytes, "IV");
- std::vector<uint8_t> key_bytes = GenerateRandomness(key_size);
- PrintBytes(key_bytes, "key");
- // Maybe write out the key and parameters.
- if (write_key_ && !WriteBytes(key_bytes, key_file_)) {
- return false;
- }
- if (write_iv_ && !WriteBytes(iv_bytes, iv_file_)) {
- return false;
- }
- return GetAesGcmKey(aad, iv_bytes, key_bytes, aes_key, params);
-}
-
-bool EncTool::ReadAesGcmKey(const std::vector<uint8_t>& aad,
- ScopedSECItem& aes_key, ScopedSECItem& params) {
- std::vector<uint8_t> iv_bytes = ReadInputData(iv_file_);
- PrintBytes(iv_bytes, "IV");
- std::vector<uint8_t> key_bytes = ReadInputData(key_file_);
- PrintBytes(key_bytes, "key");
- return GetAesGcmKey(aad, iv_bytes, key_bytes, aes_key, params);
-}
-
-bool EncTool::GetChachaKey(const std::vector<uint8_t>& aad,
- const std::vector<uint8_t>& iv_bytes,
- const std::vector<uint8_t>& key_bytes,
- ScopedSECItem& chacha_key, ScopedSECItem& params) {
- if (iv_bytes.empty()) {
- return false;
- }
-
- // AEAD params.
- CK_NSS_AEAD_PARAMS* aead_params = static_cast<CK_NSS_AEAD_PARAMS*>(
- PORT_Malloc(sizeof(struct CK_NSS_AEAD_PARAMS)));
- if (!aead_params) {
- return false;
- }
-
- uint8_t* iv = static_cast<uint8_t*>(PORT_Malloc(iv_bytes.size()));
- if (!iv) {
- return false;
- }
- memcpy(iv, iv_bytes.data(), iv_bytes.size());
- aead_params->pNonce = iv;
- aead_params->ulNonceLen = iv_bytes.size();
- aead_params->ulTagLen = 16;
- if (aad.empty()) {
- aead_params->pAAD = nullptr;
- aead_params->ulAADLen = 0;
- } else {
- uint8_t* ad = static_cast<uint8_t*>(PORT_Malloc(aad.size()));
- if (!ad) {
- return false;
- }
- memcpy(ad, aad.data(), aad.size());
- aead_params->pAAD = ad;
- aead_params->ulAADLen = aad.size();
- }
-
- params =
- ScopedSECItem(SECITEM_AllocItem(nullptr, nullptr, sizeof(*aead_params)));
- if (!params) {
- return false;
- }
- params->len = sizeof(*aead_params);
- params->type = siBuffer;
- params->data = reinterpret_cast<unsigned char*>(aead_params);
-
- return GetKey(key_bytes, chacha_key);
-}
-
-bool EncTool::GenerateChachaKey(const std::vector<uint8_t>& aad,
- ScopedSECItem& chacha_key,
- ScopedSECItem& params) {
- size_t key_size = 32, iv_size = 12;
- std::vector<uint8_t> iv_bytes = GenerateRandomness(iv_size);
- PrintBytes(iv_bytes, "IV");
- std::vector<uint8_t> key_bytes = GenerateRandomness(key_size);
- PrintBytes(key_bytes, "key");
- // Maybe write out the key and parameters.
- if (write_key_ && !WriteBytes(key_bytes, key_file_)) {
- return false;
- }
- if (write_iv_ && !WriteBytes(iv_bytes, iv_file_)) {
- return false;
- }
- return GetChachaKey(aad, iv_bytes, key_bytes, chacha_key, params);
-}
-
-bool EncTool::ReadChachaKey(const std::vector<uint8_t>& aad,
- ScopedSECItem& chacha_key, ScopedSECItem& params) {
- std::vector<uint8_t> iv_bytes = ReadInputData(iv_file_);
- PrintBytes(iv_bytes, "IV");
- std::vector<uint8_t> key_bytes = ReadInputData(key_file_);
- PrintBytes(key_bytes, "key");
- return GetChachaKey(aad, iv_bytes, key_bytes, chacha_key, params);
-}
-
-bool EncTool::DoCipher(std::string file_name, std::string out_file,
- bool encrypt, key_func_t get_params) {
- SECStatus rv;
- unsigned int outLen = 0, chunkSize = 1024;
- char buffer[1040];
- const unsigned char* bufferStart =
- reinterpret_cast<const unsigned char*>(buffer);
-
- ScopedPK11SlotInfo slot(PK11_GetInternalSlot());
- if (!slot) {
- PrintError("Unable to find security device", PR_GetError(), __LINE__);
- return false;
- }
-
- ScopedSECItem key, params;
- if (!(this->*get_params)(std::vector<uint8_t>(), key, params)) {
- PrintError("Geting keys and params failed.", __LINE__);
- return false;
- }
-
- ScopedPK11SymKey symKey(
- PK11_ImportSymKey(slot.get(), cipher_mech_, PK11_OriginUnwrap,
- CKA_DECRYPT | CKA_ENCRYPT, key.get(), nullptr));
- if (!symKey) {
- PrintError("Failure to import key into NSS", PR_GetError(), __LINE__);
- return false;
- }
-
- std::streambuf* buf;
- std::ofstream output_file(out_file, std::ios::out | std::ios::binary);
- if (!out_file.empty()) {
- if (!output_file.good()) {
- return false;
- }
- buf = output_file.rdbuf();
- } else {
- buf = std::cout.rdbuf();
- }
- std::ostream output(buf);
-
- // Read from stdin.
- if (file_name.empty()) {
- std::vector<uint8_t> data = ReadInputData("");
- std::vector<uint8_t> out(data.size() + 16);
- SECStatus rv;
- if (encrypt) {
- rv = PK11_Encrypt(symKey.get(), cipher_mech_, params.get(), out.data(),
- &outLen, data.size() + 16, data.data(), data.size());
- } else {
- rv = PK11_Decrypt(symKey.get(), cipher_mech_, params.get(), out.data(),
- &outLen, data.size() + 16, data.data(), data.size());
- }
- if (rv != SECSuccess) {
- PrintError(encrypt ? "Error encrypting" : "Error decrypting",
- PR_GetError(), __LINE__);
- return false;
- };
- output.write(reinterpret_cast<char*>(out.data()), outLen);
- output.flush();
- if (output_file.good()) {
- output_file.close();
- } else {
- output << std::endl;
- }
-
- std::cerr << "Done " << (encrypt ? "encrypting" : "decrypting")
- << std::endl;
- return true;
- }
-
- // Read file from file_name.
- std::ifstream input(file_name, std::ios::binary);
- if (!input.good()) {
- return false;
- }
- uint8_t out[1040];
- while (input) {
- if (encrypt) {
- input.read(buffer, chunkSize);
- rv = PK11_Encrypt(symKey.get(), cipher_mech_, params.get(), out, &outLen,
- chunkSize + 16, bufferStart, input.gcount());
- } else {
- // We have to read the tag when decrypting.
- input.read(buffer, chunkSize + 16);
- rv = PK11_Decrypt(symKey.get(), cipher_mech_, params.get(), out, &outLen,
- chunkSize + 16, bufferStart, input.gcount());
- }
- if (rv != SECSuccess) {
- PrintError(encrypt ? "Error encrypting" : "Error decrypting",
- PR_GetError(), __LINE__);
- return false;
- };
- output.write(reinterpret_cast<const char*>(out), outLen);
- output.flush();
- }
- if (output_file.good()) {
- output_file.close();
- } else {
- output << std::endl;
- }
- std::cerr << "Done " << (encrypt ? "encrypting" : "decrypting") << std::endl;
-
- return true;
-}
-
-size_t EncTool::PrintFileSize(std::string file_name) {
- std::ifstream input(file_name, std::ifstream::ate | std::ifstream::binary);
- auto size = input.tellg();
- std::cerr << "Size of file to encrypt: " << size / 1024 / 1024 << " MB"
- << std::endl;
- return size;
-}
-
-bool EncTool::IsValidCommand(ArgParser arguments) {
- // Either encrypt or decrypt is fine.
- bool valid = arguments.Has("--encrypt") != arguments.Has("--decrypt");
- // An input file is required for decryption only.
- valid &= arguments.Has("--in") || arguments.Has("--encrypt");
- // An output file is required for encryption only.
- valid &= arguments.Has("--out") || arguments.Has("--decrypt");
- // Files holding the IV and key are required for decryption.
- valid &= arguments.Has("--iv") || arguments.Has("--encrypt");
- valid &= arguments.Has("--key") || arguments.Has("--encrypt");
- // Cipher is always required.
- valid &= arguments.Has("--cipher");
- return valid;
-}
-
-bool EncTool::Run(const std::vector<std::string>& arguments) {
- ArgParser parser(arguments);
-
- if (!IsValidCommand(parser)) {
- Usage();
- return false;
- }
-
- if (NSS_NoDB_Init(nullptr) != SECSuccess) {
- PrintError("NSS initialization failed", PR_GetError(), __LINE__);
- return false;
- }
-
- if (parser.Has("--debug")) {
- debug_ = 1;
- }
- if (parser.Has("--iv")) {
- iv_file_ = parser.Get("--iv");
- } else {
- write_iv_ = false;
- }
- if (parser.Has("--key")) {
- key_file_ = parser.Get("--key");
- } else {
- write_key_ = false;
- }
-
- key_func_t get_params;
- bool encrypt = parser.Has("--encrypt");
- if (parser.Get("--cipher") == kAESCommand) {
- cipher_mech_ = CKM_AES_GCM;
- if (encrypt) {
- get_params = &EncTool::GenerateAesGcmKey;
- } else {
- get_params = &EncTool::ReadAesGcmKey;
- }
- } else if (parser.Get("--cipher") == kChaChaCommand) {
- cipher_mech_ = CKM_NSS_CHACHA20_POLY1305;
- if (encrypt) {
- get_params = &EncTool::GenerateChachaKey;
- } else {
- get_params = &EncTool::ReadChachaKey;
- }
- } else {
- Usage();
- return false;
- }
- // Don't write out key and iv when decrypting.
- if (!encrypt) {
- write_key_ = false;
- write_iv_ = false;
- }
-
- std::string input_file = parser.Has("--in") ? parser.Get("--in") : "";
- std::string output_file = parser.Has("--out") ? parser.Get("--out") : "";
- size_t file_size = 0;
- if (!input_file.empty()) {
- file_size = PrintFileSize(input_file);
- }
- auto begin = std::chrono::high_resolution_clock::now();
- if (!DoCipher(input_file, output_file, encrypt, get_params)) {
- (void)NSS_Shutdown();
- return false;
- }
- auto end = std::chrono::high_resolution_clock::now();
- auto ns =
- std::chrono::duration_cast<std::chrono::nanoseconds>(end - begin).count();
- auto seconds = ns / 1000000000;
- std::cerr << ns << " ns (~" << seconds << " s) and " << std::endl;
- std::cerr << "That's approximately " << (double)file_size / ns << " b/ns"
- << std::endl;
-
- if (NSS_Shutdown() != SECSuccess) {
- return false;
- }
-
- return true;
-}
-
-void EncTool::Usage() {
- std::string const txt = R"~(
-Usage: nss encrypt|decrypt --cipher aes|chacha [--in <file>] [--out <file>]
- [--key <file>] [--iv <file>]
-
- --cipher Set the cipher to use.
- --cipher aes: Use AES-GCM to encrypt/decrypt.
- --cipher chacha: Use ChaCha20/Poly1305 to encrypt/decrypt.
- --in The file to encrypt/decrypt. If no file is given, we read
- from stdin (only when encrypting).
- --out The file to write the ciphertext/plaintext to. If no file
- is given we write the plaintext to stdout (only when
- decrypting).
- --key The file to write the used key to/to read the key
- from. Optional parameter. When not given, don't write out
- the key.
- --iv The file to write the used IV to/to read the IV
- from. Optional parameter. When not given, don't write out
- the IV.
-
- Examples:
- nss encrypt --cipher aes --iv iv --key key --out ciphertext
- nss decrypt --cipher chacha --iv iv --key key --in ciphertex
-
- Note: This tool overrides files without asking.
-)~";
- std::cerr << txt << std::endl;
-}
diff --git a/security/nss/nss-tool/enc/enctool.h b/security/nss/nss-tool/enc/enctool.h
deleted file mode 100644
index 5a6a5a1640..0000000000
--- a/security/nss/nss-tool/enc/enctool.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef enctool_h__
-#define enctool_h__
-
-#include <string>
-#include <vector>
-#include "argparse.h"
-#include "prerror.h"
-#include "scoped_ptrs.h"
-#include "tool.h"
-
-class EncTool : public Tool {
- public:
- bool Run(const std::vector<std::string>& arguments) override;
- void Usage() override;
-
- private:
- typedef bool (EncTool::*key_func_t)(const std::vector<uint8_t>& aad,
- ScopedSECItem& chacha_key,
- ScopedSECItem& params);
- void PrintBytes(const std::vector<uint8_t>& bytes, const std::string& txt);
- bool WriteBytes(const std::vector<uint8_t>& bytes, std::string out_file);
- void PrintError(const std::string& m, PRErrorCode err, size_t line_number);
- void PrintError(const std::string& m, size_t line_number);
- bool GetKey(const std::vector<uint8_t>& key_bytes, ScopedSECItem& key_item);
- bool GetAesGcmKey(const std::vector<uint8_t>& aad,
- const std::vector<uint8_t>& iv_bytes,
- const std::vector<uint8_t>& key_bytes,
- ScopedSECItem& aes_key, ScopedSECItem& params);
- bool GetChachaKey(const std::vector<uint8_t>& aad,
- const std::vector<uint8_t>& iv_bytes,
- const std::vector<uint8_t>& key_bytes,
- ScopedSECItem& chacha_key, ScopedSECItem& params);
- bool GenerateAesGcmKey(const std::vector<uint8_t>& aad,
- ScopedSECItem& aes_key, ScopedSECItem& params);
- bool ReadAesGcmKey(const std::vector<uint8_t>& aad, ScopedSECItem& aes_key,
- ScopedSECItem& params);
- std::vector<uint8_t> GenerateRandomness(size_t num_bytes);
- bool GenerateChachaKey(const std::vector<uint8_t>& aad,
- ScopedSECItem& chacha_key, ScopedSECItem& params);
- bool ReadChachaKey(const std::vector<uint8_t>& aad, ScopedSECItem& chacha_key,
- ScopedSECItem& params);
- bool DoCipher(std::string fileName, std::string outFile, bool encrypt,
- key_func_t get_params);
- size_t PrintFileSize(std::string fileName);
- bool IsValidCommand(ArgParser arguments);
-
- bool debug_ = false;
- bool write_key_ = true;
- bool write_iv_ = true;
- std::string key_file_ = "/tmp/key";
- std::string iv_file_ = "/tmp/iv";
- CK_MECHANISM_TYPE cipher_mech_;
-
- const std::string kAESCommand = "aes";
- const std::string kChaChaCommand = "chacha";
-};
-
-#endif // enctool_h__
diff --git a/security/nss/nss-tool/nss_tool.cc b/security/nss/nss-tool/nss_tool.cc
deleted file mode 100644
index 8864f140da..0000000000
--- a/security/nss/nss-tool/nss_tool.cc
+++ /dev/null
@@ -1,70 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include <algorithm>
-#include <cstring>
-#include <iostream>
-#include <memory>
-#include <string>
-#include <vector>
-
-#include <prinit.h>
-
-#include "argparse.h"
-#include "db/dbtool.h"
-#include "digest/digesttool.h"
-#include "enc/enctool.h"
-#include "tool.h"
-
-static void Usage() {
- std::cerr << "Usage: nss <command> <subcommand> [options]" << std::endl;
- std::cerr << " nss db [--path <directory>] <commands>" << std::endl;
- std::cerr << " nss encrypt <options>" << std::endl;
- std::cerr << " nss decrypt <options>" << std::endl;
- std::cerr << " nss digest <options>" << std::endl;
-}
-
-static const std::string kDbCommand = "db";
-static const std::string kEncryptCommand = "encrypt";
-static const std::string kDecryptCommand = "decrypt";
-static const std::string kDigestCommand = "digest";
-
-int main(int argc, char **argv) {
- if (argc < 2) {
- Usage();
- return 1;
- }
- std::vector<std::string> arguments(argv + 2, argv + argc);
-
- std::unique_ptr<Tool> tool = nullptr;
- if (argv[1] == kDbCommand) {
- tool = std::unique_ptr<Tool>(new DBTool());
- }
- if (argv[1] == kEncryptCommand) {
- tool = std::unique_ptr<Tool>(new EncTool());
- arguments.push_back("--encrypt");
- }
- if (argv[1] == kDecryptCommand) {
- tool = std::unique_ptr<Tool>(new EncTool());
- arguments.push_back("--decrypt");
- }
- if (argv[1] == kDigestCommand) {
- tool = std::unique_ptr<Tool>(new DigestTool());
- }
- if (!tool) {
- Usage();
- return 1;
- }
-
- int exit_code = 0;
- PR_Init(PR_SYSTEM_THREAD, PR_PRIORITY_NORMAL, 1);
-
- if (!tool->Run(arguments)) {
- exit_code = 1;
- }
-
- PR_Cleanup();
-
- return exit_code;
-}
diff --git a/security/nss/nss-tool/nss_tool.gyp b/security/nss/nss-tool/nss_tool.gyp
deleted file mode 100644
index a5d03fcf92..0000000000
--- a/security/nss/nss-tool/nss_tool.gyp
+++ /dev/null
@@ -1,31 +0,0 @@
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-{
- 'includes' : [
- '../coreconf/config.gypi',
- '../cmd/platlibs.gypi',
- ],
- 'targets' : [
- {
- 'target_name' : 'nss',
- 'type' : 'executable',
- 'sources' : [
- 'nss_tool.cc',
- 'common/argparse.cc',
- 'common/util.cc',
- 'db/dbtool.cc',
- 'enc/enctool.cc',
- 'digest/digesttool.cc'
- ],
- 'include_dirs': [
- 'common',
- ],
- 'dependencies' : [
- '<(DEPTH)/cpputil/cpputil.gyp:cpputil',
- '<(DEPTH)/exports.gyp:dbm_exports',
- '<(DEPTH)/exports.gyp:nss_exports',
- ],
- }
- ],
-}
diff --git a/security/nss/nss.gyp b/security/nss/nss.gyp
index 9e9b49f7ff..e62d28449d 100644
--- a/security/nss/nss.gyp
+++ b/security/nss/nss.gyp
@@ -131,6 +131,7 @@
'cmd/digest/digest.gyp:digest',
'cmd/ecperf/ecperf.gyp:ecperf',
'cmd/fbectest/fbectest.gyp:fbectest',
+ 'cmd/fipstest/fipstest.gyp:fipstest',
'cmd/httpserv/httpserv.gyp:httpserv',
'cmd/listsuites/listsuites.gyp:listsuites',
'cmd/makepqg/makepqg.gyp:makepqg',
@@ -148,7 +149,6 @@
'cmd/pk1sign/pk1sign.gyp:pk1sign',
'cmd/pp/pp.gyp:pp',
'cmd/rsaperf/rsaperf.gyp:rsaperf',
- 'cmd/rsapoptst/rsapoptst.gyp:rsapoptst',
'cmd/sdrtest/sdrtest.gyp:sdrtest',
'cmd/selfserv/selfserv.gyp:selfserv',
'cmd/shlibsign/mangle/mangle.gyp:mangle',
@@ -164,13 +164,10 @@
'cmd/vfychain/vfychain.gyp:vfychain',
'cmd/vfyserv/vfyserv.gyp:vfyserv',
'gtests/certhigh_gtest/certhigh_gtest.gyp:certhigh_gtest',
- 'gtests/cryptohi_gtest/cryptohi_gtest.gyp:cryptohi_gtest',
'gtests/der_gtest/der_gtest.gyp:der_gtest',
'gtests/certdb_gtest/certdb_gtest.gyp:certdb_gtest',
'gtests/freebl_gtest/freebl_gtest.gyp:prng_gtest',
- 'gtests/freebl_gtest/freebl_gtest.gyp:blake2b_gtest',
'gtests/pk11_gtest/pk11_gtest.gyp:pk11_gtest',
- 'gtests/softoken_gtest/softoken_gtest.gyp:softoken_gtest',
'gtests/ssl_gtest/ssl_gtest.gyp:ssl_gtest',
'gtests/util_gtest/util_gtest.gyp:util_gtest',
'gtests/nss_bogo_shim/nss_bogo_shim.gyp:nss_bogo_shim',
@@ -192,11 +189,6 @@
'gtests/freebl_gtest/freebl_gtest.gyp:freebl_gtest',
],
}],
- [ 'disable_fips==0', {
- 'dependencies': [
- 'cmd/fipstest/fipstest.gyp:fipstest',
- ],
- }],
],
},
],
diff --git a/security/nss/readme.md b/security/nss/readme.md
index 17b99e805c..b75bfe7dd2 100644
--- a/security/nss/readme.md
+++ b/security/nss/readme.md
@@ -41,8 +41,49 @@ directory `lib`, and tools in directory `bin`. In order to run the tools, set
your system environment to use the libraries of your build from the "lib"
directory, e.g., using the `LD_LIBRARY_PATH` or `DYLD_LIBRARY_PATH`.
-See [help.txt](https://hg.mozilla.org/projects/nss/raw-file/tip/help.txt) for
-more information on using build.sh.
+ Usage: build.sh [-hcv] [-j <n>] [--nspr] [--gyp|-g] [--opt|-o] [-m32]
+ [--test] [--pprof] [--scan-build[=output]] [--ct-verif]
+ [--asan] [--ubsan] [--msan] [--sancov[=edge|bb|func|...]]
+ [--disable-tests] [--fuzz[=tls|oss]] [--system-sqlite]
+ [--no-zdefs] [--with-nspr] [--system-nspr] [--enable-libpkix]
+
+ This script builds NSS with gyp and ninja.
+
+ This build system is still under development. It does not yet support all
+ the features or platforms that NSS supports.
+
+ NSS build tool options:
+
+ -h display this help and exit
+ -c clean before build
+ -v verbose build
+ -j <n> run at most <n> concurrent jobs
+ --nspr force a rebuild of NSPR
+ --gyp|-g force a rerun of gyp
+ --opt|-o do an opt build
+ -m32 do a 32-bit build on a 64-bit system
+ --test ignore map files and export everything we have
+ --fuzz build fuzzing targets (this always enables test builds)
+ --fuzz=tls to enable TLS fuzzing mode
+ --fuzz=oss to build for OSS-Fuzz
+ --pprof build with gperftool support
+ --ct-verif build with valgrind for ct-verif
+ --scan-build run the build with scan-build (scan-build has to be in the path)
+ --scan-build=/out/path sets the output path for scan-build
+ --asan do an asan build
+ --ubsan do an ubsan build
+ --ubsan=bool,shift,... sets specific UB sanitizers
+ --msan do an msan build
+ --sancov do sanitize coverage builds
+ --sancov=func sets coverage to function level for example
+ --disable-tests don't build tests and corresponding cmdline utils
+ --system-sqlite use system sqlite
+ --no-zdefs don't set -Wl,-z,defs
+ --with-nspr don't build NSPR but use the one at the given location, e.g.
+ --with-nspr=/path/to/nspr/include:/path/to/nspr/lib
+ --system-nspr use system nspr. This requires an installation of NSPR and
+ might not work on all systems.
+ --enable-libpkix make libpkix part of the build.
## Building NSS (legacy build system)
@@ -81,6 +122,10 @@ set or export:
Note that you might have to add `nss.local` to `/etc/hosts` if it's not
there. The entry should look something like `127.0.0.1 nss.local nss`.
+If you get name resolution errors, try to ensure that you are using an IPv4
+address; IPv6 is the default on many systems for the loopback device which
+doesn't work.
+
### Running tests
**Runnning all tests will take a while!**
@@ -137,50 +182,3 @@ The nss directory contains the following important subdirectories:
A more comprehensible overview of the NSS folder structure and API guidelines
can be found
[here](https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/NSS_API_Guidelines).
-
-## Build mechanisms related to FIPS compliance
-
-NSS supports build configurations for FIPS-140 compliance, and alternative build
-configurations that disable functionality specific to FIPS-140 compliance.
-
-This section documents the environment variables and build parameters that
-control these configurations.
-
-### Build FIPS startup tests
-
-The C macro NSS_NO_INIT_SUPPORT controls the FIPS startup self tests.
-If NSS_NO_INIT_SUPPORT is defined, the startup tests are disabled.
-
-The legacy build system (make) by default disables these tests.
-To enable these tests, set environment variable NSS_FORCE_FIPS=1 at build time.
-
-The gyp build system by default disables these tests.
-To enable these tests, pass parameter --enable-fips to build.sh.
-
-### Building either FIPS compliant or alternative compliant code
-
-The C macro NSS_FIPS_DISABLED can be used to disable some FIPS compliant code
-and enable alternative implementations.
-
-The legacy build system (make) never defines NSS_FIPS_DISABLED and always uses
-the FIPS compliant code.
-
-The gyp build system by default defines NSS_FIPS_DISABLED.
-To use the FIPS compliant code, pass parameter --enable-fips to build.sh.
-
-### Test execution
-
-The NSS test suite may contain tests that are included, excluded, or are
-different based on the FIPS build configuration. To execute the correct tests,
-it's necessary to determine which build configuration was used.
-
-The legacy build system (make) uses environment variables to control all
-aspects of the build configuration, including FIPS build configuration.
-
-Because the gyp build system doesn't use environment variables to control the
-build configuration, the NSS tests cannot rely on environment variables to
-determine the build configuration.
-
-A helper binary named nss-build-flags is produced as part of the NSS build,
-which prints the C macro symbols that were defined at build time, and which are
-relevant to test execution.
diff --git a/security/nss/tests/all.sh b/security/nss/tests/all.sh
index 8d5bd2dbba..833817f4aa 100755
--- a/security/nss/tests/all.sh
+++ b/security/nss/tests/all.sh
@@ -63,6 +63,10 @@
# BUILT_OPT - use optimized/debug build
# USE_64 - use 64bit/32bit build
#
+# Optional environment variables to enable specific NSS features:
+# ---------------------------------------------------------------
+# NSS_DISABLE_ECC - disable ECC
+#
# Optional environment variables to select which cycles/suites to test:
# ---------------------------------------------------------------------
# NSS_CYCLES - list of cycles to run (separated by space
@@ -103,16 +107,12 @@
#
########################################################################
-RUN_FIPS=""
-
############################## run_tests ###############################
# run test suites defined in TESTS variable, skip scripts defined in
# TESTS_SKIP variable
########################################################################
run_tests()
{
- echo "Running test cycle: ${TEST_MODE} ----------------------"
- echo "List of tests that will be executed: ${TESTS}"
for TEST in ${TESTS}
do
# NOTE: the spaces are important. If you don't include
@@ -132,20 +132,14 @@ run_tests()
}
########################## run_cycle_standard ##########################
-# run test suites with dbm database (no PKIX, no sharedb)
+# run test suites with defaults settings (no PKIX, no sharedb)
########################################################################
run_cycle_standard()
{
TEST_MODE=STANDARD
TESTS="${ALL_TESTS}"
- TESTS_SKIP="cipher libpkix sdr ocsp pkits"
-
- NSS_DEFAULT_DB_TYPE="dbm"
- export NSS_DEFAULT_DB_TYPE
-
- NSS_SSL_TESTS=`echo "${NSS_SSL_TESTS}" | sed -e "s/normal//g" -e "s/fips//g" -e "s/_//g"`
- NSS_SSL_RUN=`echo "${NSS_SSL_RUN}" | sed -e "s/cov//g" -e "s/auth//g"`
+ TESTS_SKIP=
run_tests
}
@@ -170,13 +164,7 @@ run_cycle_pkix()
TESTS="${ALL_TESTS}"
TESTS_SKIP="cipher dbtests sdr crmf smime merge multinit"
-
NSS_SSL_TESTS=`echo "${NSS_SSL_TESTS}" | sed -e "s/normal//g" -e "s/fips//g" -e "s/_//g"`
- export -n NSS_SSL_RUN
-
- # use the default format. (unset for the shell, export -n for binaries)
- export -n NSS_DEFAULT_DB_TYPE
- unset NSS_DEFAULT_DB_TYPE
run_tests
}
@@ -199,7 +187,7 @@ run_cycle_upgrade_db()
init_directories
if [ -r "${OLDHOSTDIR}/cert.log" ]; then
- DIRS="alicedir bobdir CA cert_extensions client clientCA dave eccurves eve ext_client ext_server $RUN_FIPS SDR server serverCA stapling tools/copydir cert.log cert.done tests.*"
+ DIRS="alicedir bobdir CA cert_extensions client clientCA dave eccurves eve ext_client ext_server fips SDR server serverCA stapling tools/copydir cert.log cert.done tests.*"
for i in $DIRS
do
cp -r ${OLDHOSTDIR}/${i} ${HOSTDIR} #2> /dev/null
@@ -245,10 +233,10 @@ run_cycle_shared_db()
# run the tests for native sharedb support
TESTS="${ALL_TESTS}"
- TESTS_SKIP="dbupgrade"
+ TESTS_SKIP="cipher libpkix dbupgrade sdr ocsp pkits"
- export -n NSS_SSL_TESTS
- export -n NSS_SSL_RUN
+ NSS_SSL_TESTS=`echo "${NSS_SSL_TESTS}" | sed -e "s/normal//g" -e "s/fips//g" -e "s/_//g"`
+ NSS_SSL_RUN=`echo "${NSS_SSL_RUN}" | sed -e "s/cov//g" -e "s/auth//g"`
run_tests
}
@@ -282,25 +270,10 @@ run_cycles()
############################## main code ###############################
-SCRIPTNAME=all.sh
-CLEANUP="${SCRIPTNAME}"
-cd `dirname $0`
-
-# all.sh should be the first one to try to source the init
-if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then
- cd common
- . ./init.sh
-fi
-
cycles="standard pkix upgradedb sharedb"
CYCLES=${NSS_CYCLES:-$cycles}
-NO_INIT_SUPPORT=`certutil --build-flags |grep -cw NSS_NO_INIT_SUPPORT`
-if [ $NO_INIT_SUPPORT -eq 0 ]; then
- RUN_FIPS="fips"
-fi
-
-tests="cipher lowhash libpkix cert dbtests tools $RUN_FIPS sdr crmf smime ssl ocsp merge pkits ec gtests ssl_gtests"
+tests="cipher lowhash libpkix cert dbtests tools fips sdr crmf smime ssl ocsp merge pkits ec gtests ssl_gtests"
# Don't run chains tests when we have a gyp build.
if [ "$OBJDIR" != "Debug" -a "$OBJDIR" != "Release" ]; then
tests="$tests chains"
@@ -309,15 +282,22 @@ TESTS=${NSS_TESTS:-$tests}
ALL_TESTS=${TESTS}
-nss_ssl_tests="crl iopr policy"
-if [ $NO_INIT_SUPPORT -eq 0 ]; then
- nss_ssl_tests="$nss_ssl_tests fips_normal normal_fips"
-fi
+nss_ssl_tests="crl fips_normal normal_fips iopr policy"
NSS_SSL_TESTS="${NSS_SSL_TESTS:-$nss_ssl_tests}"
nss_ssl_run="cov auth stapling stress"
NSS_SSL_RUN="${NSS_SSL_RUN:-$nss_ssl_run}"
+SCRIPTNAME=all.sh
+CLEANUP="${SCRIPTNAME}"
+cd `dirname $0`
+
+# all.sh should be the first one to try to source the init
+if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then
+ cd common
+ . ./init.sh
+fi
+
# NOTE:
# Lists of enabled tests and other settings are stored to ${ENV_BACKUP}
# file and are are restored after every test cycle.
diff --git a/security/nss/tests/cert/TestCA-bogus-rsa-pss1.crt b/security/nss/tests/cert/TestCA-bogus-rsa-pss1.crt
deleted file mode 100644
index e3c8fcdcf3..0000000000
--- a/security/nss/tests/cert/TestCA-bogus-rsa-pss1.crt
+++ /dev/null
@@ -1,26 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIEbDCCAxqgAwIBAgIBATBHBgkqhkiG9w0BAQowOqAPMA0GCWCGSAFlAwQCAQUA
-oRwwGgYJKoZIhvcNAQEIMA0GCWCGSAFlAwQCAQUAogMCASCjBAICEmcwgYMxCzAJ
-BgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFp
-biBWaWV3MRIwEAYDVQQKEwlCT0dVUyBOU1MxMzAxBgNVBAMTKk5TUyBUZXN0IENB
-IChSU0EtUFNTIGludmFsaWQgdHJhaWxlckZpZWxkKTAgFw0xNzEyMDcxMjU3NDBa
-GA8yMDY3MTIwNzEyNTc0MFowgYMxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxp
-Zm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRIwEAYDVQQKEwlCT0dVUyBO
-U1MxMzAxBgNVBAMTKk5TUyBUZXN0IENBIChSU0EtUFNTIGludmFsaWQgdHJhaWxl
-ckZpZWxkKTCCAVwwRwYJKoZIhvcNAQEKMDqgDzANBglghkgBZQMEAgEFAKEcMBoG
-CSqGSIb3DQEBCDANBglghkgBZQMEAgEFAKIDAgEgowQCAhJnA4IBDwAwggEKAoIB
-AQDgkKJk+PoFpESak7kMQ0w147/xilUZCG7hDGG2uuGTbX8jqy9N9pxzB9sJjgJX
-yYND0XEmrUQ2Memmy8jufhXML5DekW1tr3Gi2L3VivbIReJZfXk1xDMvNbB/Gjjo
-SoPyu8C4hnevjgMlmqG3KdMkB+eN6PnBG64YFyki3vnLO5iTNHEBTgFYo0gTX4uK
-xl0hLtiDL+4K5l7BwVgxZwQF6uHoHjrjjlhkzR0FwjjqR8U0pH20Pb6IlRsFMv07
-/1GHf+jm34pKb/1ZNzAbiKxYv7YAQUWEZ7e/GSXgA6gbTpV9ueiLkVucUeXN/mXK
-Tqb4zivi5FaSGVl8SJnqsJXJAgMBAAGjOTA3MBQGCWCGSAGG+EIBAQEB/wQEAwIC
-BDAPBgNVHRMECDAGAQH/AgEAMA4GA1UdDwEB/wQEAwICBDBHBgkqhkiG9w0BAQow
-OqAPMA0GCWCGSAFlAwQCAQUAoRwwGgYJKoZIhvcNAQEIMA0GCWCGSAFlAwQCAQUA
-ogMCASCjBAICEmcDggEBAJht9t9p/dlhJtx7ShDvUXyq8N4tCoGKdREM83K/jlW8
-HxdHOz5PuvZx+UMlaUtqZVIriSCnRtEWkoSo0hWmcv1rp80it2G1zLfLPYdyrPba
-nQmE1iFb69Wr9dwrX7o/CII+WHQgoIGeFGntZ8YRZTe5+JeiGAlAyZCqUKbl9lhh
-pCpf1YYxb3VI8mAGVi0jwabWBEbInGBZYH9HP0nK7/Tflk6UY3f4h4Fbkk5D4WZA
-hFfkebx6Wh90QGiKQhp4/N+dYira8bKvWqqn0VqwzBoJBU/RmMaJVpwqFFvcaUJh
-uEKUPeQbqkYvj1WJYmy4ettVwi4OZU50+kCaRQhMsFA=
------END CERTIFICATE-----
diff --git a/security/nss/tests/cert/TestCA-bogus-rsa-pss2.crt b/security/nss/tests/cert/TestCA-bogus-rsa-pss2.crt
deleted file mode 100644
index d46442dc4e..0000000000
--- a/security/nss/tests/cert/TestCA-bogus-rsa-pss2.crt
+++ /dev/null
@@ -1,24 +0,0 @@
------BEGIN CERTIFICATE-----
-MIIEFzCCAs2gAwIBAgIBATA/BgkqhkiG9w0BAQowMqAOMAwGCCqGSIb3DQIFBQCh
-GzAZBgkqhkiG9w0BAQgwDAYIKoZIhvcNAgUFAKIDAgEgMH4xCzAJBgNVBAYTAlVT
-MRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRIw
-EAYDVQQKEwlCT0dVUyBOU1MxLjAsBgNVBAMTJU5TUyBUZXN0IENBIChSU0EtUFNT
-IGludmFsaWQgaGFzaEFsZykwIBcNMTcxMjA3MTQwNjQ0WhgPMjA2ODAxMDcxNDA2
-NDRaMH4xCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQH
-Ew1Nb3VudGFpbiBWaWV3MRIwEAYDVQQKEwlCT0dVUyBOU1MxLjAsBgNVBAMTJU5T
-UyBUZXN0IENBIChSU0EtUFNTIGludmFsaWQgaGFzaEFsZykwggEgMAsGCSqGSIb3
-DQEBCgOCAQ8AMIIBCgKCAQEAtDXA73yTOgs8zVYNMCtuQ9a07UgbfeQbjHp3pkF6
-7rsC/Q28mrLh+zLkht5e7qU/Qf/8a2ZkcYhPOBAjCzjgIXOdE2lsWvdVujOJLR0x
-Fesd3hDLRmL6f6momc+j1/Tw3bKyZinaeJ9BFRv9c94SayB3QUe+6+TNJKASwlhj
-sx6mUsND+h3DkuL77gi7hIUpUXfFSwa+zM69VLhIu+/WRZfG8gfKkCAIGUC3WYJa
-eU1HgQKfVSXW0ok4ototXWEe9ohU+Z1tO9LJStcY8mMpig7EU9zbpObhG46Sykfu
-aKsubB9J+gFgwP5Tb85tRYT6SbHeHR6U/N8GBrKdRcomWwIDAQABozwwOjAUBglg
-hkgBhvhCAQEBAf8EBAMCAgQwEgYDVR0TAQH/BAgwBgEB/wIBADAOBgNVHQ8BAf8E
-BAMCAgQwPwYJKoZIhvcNAQEKMDKgDjAMBggqhkiG9w0CBQUAoRswGQYJKoZIhvcN
-AQEIMAwGCCqGSIb3DQIFBQCiAwIBIAOCAQEAjeemeTxh2xrMUJ6Z5Yn2nH2FbcPY
-fTHJcdfXjfNBkrMl5pe2/lk0JyNuACTuTYFCxdWNRL1coN//h9DSUbF3dpF1ex6D
-difo+6PwxkO2aPVGPYw4DSivt4SFbn5dKGgVqBQfnmNK7p/iT91AcErg/grRrNL+
-4jeT0UiRjQYeX9xKJArv+ocIidNpQL3QYxXuBLZxVC92Af69ol7WG8QBRLnFi1p2
-g6q8hOHqOfB29qnsSo3PkI1yuShOl50tRLbNgyotEfZdk1N3oXvapoBsm/jlcdCT
-0aKelCSQYYAfyl5PKCpa1lgBm7zfcHSDStMhEEFu/fbnJhqO9g9znj3STQ==
------END CERTIFICATE-----
diff --git a/security/nss/tests/cert/cert.sh b/security/nss/tests/cert/cert.sh
index d1a9148a97..9b3455747d 100755
--- a/security/nss/tests/cert/cert.sh
+++ b/security/nss/tests/cert/cert.sh
@@ -46,7 +46,11 @@ cert_init()
fi
SCRIPTNAME="cert.sh"
CRL_GRP_DATE=`date -u "+%Y%m%d%H%M%SZ"`
- html_head "Certutil and Crlutil Tests"
+ if [ -z "$NSS_DISABLE_ECC" ] ; then
+ html_head "Certutil and Crlutil Tests with ECC"
+ else
+ html_head "Certutil and Crlutil Tests"
+ fi
LIBDIR="${DIST}/${OBJDIR}/lib"
@@ -296,12 +300,14 @@ cert_create_cert()
fi
+ if [ -z "$NSS_DISABLE_ECC" ] ; then
CU_ACTION="Import EC Root CA for $CERTNAME"
certu -A -n "TestCA-ec" -t "TC,TC,TC" -f "${R_PWFILE}" \
-d "${PROFILEDIR}" -i "${R_CADIR}/TestCA-ec.ca.cert" 2>&1
if [ "$RET" -ne 0 ]; then
return $RET
fi
+ fi
cert_add_cert "$5"
return $?
@@ -396,6 +402,7 @@ cert_add_cert()
#
# Generate and add EC cert
#
+ if [ -z "$NSS_DISABLE_ECC" ] ; then
CURVE="secp384r1"
CU_ACTION="Generate EC Cert Request for $CERTNAME"
CU_SUBJECT="CN=$CERTNAME, E=${CERTNAME}-ec@bogus.com, O=BOGUS NSS, L=Mountain View, ST=California, C=US"
@@ -447,6 +454,7 @@ cert_add_cert()
return $RET
fi
cert_log "SUCCESS: $CERTNAME's mixed EC Cert Created"
+ fi
return 0
}
@@ -459,7 +467,6 @@ cert_add_cert()
cert_all_CA()
{
echo nss > ${PWFILE}
- echo > ${EMPTY_FILE}
ALL_CU_SUBJECT="CN=NSS Test CA, O=BOGUS NSS, L=Mountain View, ST=California, C=US"
cert_CA $CADIR TestCA -x "CTu,CTu,CTu" ${D_CA} "1"
@@ -510,16 +517,10 @@ cert_all_CA()
# dsaroot.cert in $CLIENT_CADIR and in $SERVER_CADIR is one of the last
# in the chain
-#
-# Create RSA-PSS version of TestCA
- ALL_CU_SUBJECT="CN=NSS Test CA (RSA-PSS), O=BOGUS NSS, L=Mountain View, ST=California, C=US"
- cert_rsa_pss_CA $CADIR TestCA-rsa-pss -x "CTu,CTu,CTu" ${D_CA} "1" SHA256
- rm $CADIR/rsapssroot.cert
- ALL_CU_SUBJECT="CN=NSS Test CA (RSA-PSS-SHA1), O=BOGUS NSS, L=Mountain View, ST=California, C=US"
- cert_rsa_pss_CA $CADIR TestCA-rsa-pss-sha1 -x "CTu,CTu,CTu" ${D_CA} "1" SHA1
- rm $CADIR/rsapssroot.cert
+
+ if [ -z "$NSS_DISABLE_ECC" ] ; then
#
# Create EC version of TestCA
CA_CURVE="secp521r1"
@@ -544,6 +545,8 @@ cert_all_CA()
rm $CLIENT_CADIR/ecroot.cert $SERVER_CADIR/ecroot.cert
# ecroot.cert in $CLIENT_CADIR and in $SERVER_CADIR is one of the last
# in the chain
+
+ fi
}
################################# cert_CA ################################
@@ -634,7 +637,7 @@ CERTSCRIPT
################################ cert_dsa_CA #############################
# local shell function to build the Temp. Certificate Authority (CA)
# used for testing purposes, creating a CA Certificate and a root cert
-# This is the DSA version of cert_CA.
+# This is the ECC version of cert_CA.
##########################################################################
cert_dsa_CA()
{
@@ -645,7 +648,7 @@ cert_dsa_CA()
DOMAIN=$5
CERTSERIAL=$6
- echo "$SCRIPTNAME: Creating a DSA CA Certificate $NICKNAME =========================="
+ echo "$SCRIPTNAME: Creating an DSA CA Certificate $NICKNAME =========================="
if [ ! -d "${CUR_CADIR}" ]; then
mkdir -p "${CUR_CADIR}"
@@ -658,7 +661,7 @@ cert_dsa_CA()
LPROFILE="multiaccess:${DOMAIN}"
fi
- ################# Creating a DSA CA Cert ###############################
+ ################# Creating an DSA CA Cert ###############################
#
CU_ACTION="Creating DSA CA Cert $NICKNAME "
CU_SUBJECT=$ALL_CU_SUBJECT
@@ -697,79 +700,6 @@ CERTSCRIPT
-
-################################ cert_rsa_pss_CA #############################
-# local shell function to build the Temp. Certificate Authority (CA)
-# used for testing purposes, creating a CA Certificate and a root cert
-# This is the RSA-PSS version of cert_CA.
-##########################################################################
-cert_rsa_pss_CA()
-{
- CUR_CADIR=$1
- NICKNAME=$2
- SIGNER=$3
- TRUSTARG=$4
- DOMAIN=$5
- CERTSERIAL=$6
- HASHALG=$7
-
- echo "$SCRIPTNAME: Creating an RSA-PSS CA Certificate $NICKNAME =========================="
-
- if [ ! -d "${CUR_CADIR}" ]; then
- mkdir -p "${CUR_CADIR}"
- fi
- cd ${CUR_CADIR}
- pwd
-
- LPROFILE=.
- if [ -n "${MULTIACCESS_DBM}" ]; then
- LPROFILE="multiaccess:${DOMAIN}"
- fi
-
- HASHOPT=
- if [ -n "$HASHALG" ]; then
- HASHOPT="-Z $HASHALG"
- fi
-
- ################# Creating an RSA-PSS CA Cert ###############################
- #
- CU_ACTION="Creating RSA-PSS CA Cert $NICKNAME "
- CU_SUBJECT=$ALL_CU_SUBJECT
- certu -S -n $NICKNAME -k rsa --pss $HASHOPT -t $TRUSTARG -v 600 $SIGNER \
- -d ${LPROFILE} -1 -2 -5 -f ${R_PWFILE} -z ${R_NOISE_FILE} \
- -m $CERTSERIAL 2>&1 <<CERTSCRIPT
-5
-6
-9
-n
-y
--1
-n
-5
-6
-7
-9
-n
-CERTSCRIPT
-
- if [ "$RET" -ne 0 ]; then
- echo "return value is $RET"
- Exit 6 "Fatal - failed to create RSA-PSS CA cert"
- fi
-
- ################# Exporting RSA-PSS Root Cert ###############################
- #
- CU_ACTION="Exporting RSA-PSS Root Cert"
- certu -L -n $NICKNAME -r -d ${LPROFILE} -o rsapssroot.cert
- if [ "$RET" -ne 0 ]; then
- Exit 7 "Fatal - failed to export RSA-PSS root cert"
- fi
- cp rsapssroot.cert ${NICKNAME}.ca.cert
-}
-
-
-
-
################################ cert_ec_CA ##############################
# local shell function to build the Temp. Certificate Authority (CA)
# used for testing purposes, creating a CA Certificate and a root cert
@@ -901,6 +831,7 @@ cert_smime_client()
certu -E -t ",," -d ${P_R_BOBDIR} -f ${R_PWFILE} \
-i ${R_EVEDIR}/Eve.cert 2>&1
+ if [ -z "$NSS_DISABLE_ECC" ] ; then
echo "$SCRIPTNAME: Importing EC Certificates =============================="
CU_ACTION="Import Bob's EC cert into Alice's db"
certu -E -t ",," -d ${P_R_ALICEDIR} -f ${R_PWFILE} \
@@ -924,6 +855,7 @@ cert_smime_client()
# CU_ACTION="Import Eve's EC cert into Bob's DB"
# certu -E -t ",," -d ${P_R_BOBDIR} -f ${R_PWFILE} \
# -i ${R_EVEDIR}/Eve-ec.cert 2>&1
+ fi
if [ "$CERTFAILED" != 0 ] ; then
cert_log "ERROR: SMIME failed $RET"
@@ -1014,6 +946,7 @@ cert_extended_ssl()
# -d "${PROFILEDIR}" -i "${CLIENT_CADIR}/clientCA-dsamixed.ca.cert" \
# 2>&1
+ if [ -z "$NSS_DISABLE_ECC" ] ; then
#
# Repeat the above for EC certs
#
@@ -1059,6 +992,7 @@ cert_extended_ssl()
# certu -A -n "clientCA-ecmixed" -t "T,," -f "${R_PWFILE}" \
# -d "${PROFILEDIR}" -i "${CLIENT_CADIR}/clientCA-ecmixed.ca.cert" \
# 2>&1
+ fi
echo "Importing all the server's own CA chain into the servers DB"
for CA in `find ${SERVER_CADIR} -name "?*.ca.cert"` ;
@@ -1147,6 +1081,7 @@ cert_extended_ssl()
# done with mixed DSA certs
#
+ if [ -z "$NSS_DISABLE_ECC" ] ; then
#
# Repeat the above for EC certs
#
@@ -1193,6 +1128,7 @@ cert_extended_ssl()
#
# done with mixed EC certs
#
+ fi
echo "Importing all the client's own CA chain into the servers DB"
for CA in `find ${CLIENT_CADIR} -name "?*.ca.cert"` ;
@@ -1239,8 +1175,10 @@ cert_ssl()
CU_ACTION="Modify trust attributes of DSA Root CA -t TC,TC,TC"
certu -M -n "TestCA-dsa" -t "TC,TC,TC" -d ${PROFILEDIR} -f "${R_PWFILE}"
- CU_ACTION="Modify trust attributes of EC Root CA -t TC,TC,TC"
- certu -M -n "TestCA-ec" -t "TC,TC,TC" -d ${PROFILEDIR} -f "${R_PWFILE}"
+ if [ -z "$NSS_DISABLE_ECC" ] ; then
+ CU_ACTION="Modify trust attributes of EC Root CA -t TC,TC,TC"
+ certu -M -n "TestCA-ec" -t "TC,TC,TC" -d ${PROFILEDIR} -f "${R_PWFILE}"
+ fi
# cert_init_cert ${SERVERDIR} "${HOSTADDR}" 1 ${D_SERVER}
# echo "************* Copying CA files to ${SERVERDIR}"
# cp ${CADIR}/*.db .
@@ -1261,12 +1199,6 @@ cert_ssl()
cp -r ${R_SERVERDIR} ${R_STAPLINGDIR}
pk12u -o ${R_STAPLINGDIR}/ca.p12 -n TestCA -k ${R_PWFILE} -w ${R_PWFILE} -d ${R_CADIR}
pk12u -i ${R_STAPLINGDIR}/ca.p12 -k ${R_PWFILE} -w ${R_PWFILE} -d ${R_STAPLINGDIR}
-
- echo "$SCRIPTNAME: Creating database for strsclnt no login tests ==============="
- echo "cp -r ${CLIENTDIR} ${NOLOGINDIR}"
- cp -r ${R_CLIENTDIR} ${R_NOLOGINDIR}
- # change the password to empty
- certu -W -d "${R_NOLOGINDIR}" -f "${R_PWFILE}" -@ "${R_EMPTY_FILE}" 2>&1
}
############################## cert_stresscerts ################################
@@ -1337,35 +1269,12 @@ MODSCRIPT
html_passed "${CU_ACTION}"
fi
- CU_ACTION="Setting invalid database password in FIPS mode"
- RETEXPECTED=255
- certu -W -d "${PROFILEDIR}" -f "${R_FIPSPWFILE}" -@ "${R_FIPSBADPWFILE}" 2>&1
- CU_ACTION="Attempt to generate a key with exponent of 3 (too small)"
- certu -G -k rsa -g 2048 -y 3 -d "${PROFILEDIR}" -z ${R_NOISE_FILE} -f "${R_FIPSPWFILE}"
- CU_ACTION="Attempt to generate a key with exponent of 17 (too small)"
- certu -G -k rsa -g 2048 -y 17 -d "${PROFILEDIR}" -z ${R_NOISE_FILE} -f "${R_FIPSPWFILE}"
- RETEXPECTED=0
-
CU_ACTION="Generate Certificate for ${CERTNAME}"
CU_SUBJECT="CN=${CERTNAME}, E=fips@bogus.com, O=BOGUS NSS, OU=FIPS PUB 140, L=Mountain View, ST=California, C=US"
certu -S -n ${FIPSCERTNICK} -x -t "Cu,Cu,Cu" -d "${PROFILEDIR}" -f "${R_FIPSPWFILE}" -k dsa -v 600 -m 500 -z "${R_NOISE_FILE}" 2>&1
if [ "$RET" -eq 0 ]; then
cert_log "SUCCESS: FIPS passed"
fi
-
-}
-
-########################## cert_rsa_exponent #################################
-# local shell function to verify small rsa exponent can be used (only
-# run if FIPS has not been turned on in the build).
-##############################################################################
-cert_rsa_exponent_nonfips()
-{
- echo "$SCRIPTNAME: Verify that small RSA exponents still work =============="
- CU_ACTION="Attempt to generate a key with exponent of 3"
- certu -G -k rsa -g 2048 -y 3 -d "${CLIENTDIR}" -z ${R_NOISE_FILE} -f "${R_PWFILE}"
- CU_ACTION="Attempt to generate a key with exponent of 17"
- certu -G -k rsa -g 2048 -y 17 -d "${CLIENTDIR}" -z ${R_NOISE_FILE} -f "${R_PWFILE}"
}
############################## cert_eccurves ###########################
@@ -1375,6 +1284,7 @@ cert_eccurves()
{
################# Creating Certs for EC curves test ########################
#
+ if [ -z "$NSS_DISABLE_ECC" ] ; then
echo "$SCRIPTNAME: Creating Server CA Issued Certificate for "
echo " EC Curves Test Certificates ------------------------------------"
@@ -1415,6 +1325,8 @@ cert_eccurves()
-f "${R_PWFILE}" -i "${CERTNAME}-ec.cert" 2>&1
fi
done
+
+ fi # $NSS_DISABLE_ECC
}
########################### cert_extensions_test #############################
@@ -1766,6 +1678,7 @@ EOF_CRLINI
+ if [ -z "$NSS_DISABLE_ECC" ] ; then
CU_ACTION="Generating CRL (ECC) for range ${CRL_GRP_1_BEGIN}-${CRL_GRP_END} TestCA-ec authority"
# Until Bug 292285 is resolved, do not encode x400 Addresses. After
@@ -1780,6 +1693,7 @@ addext issuerAltNames 0 "rfc822Name:ca-ecemail@ca.com|dnsName:ca-ec.com|director
EOF_CRLINI
CRL_GEN_RES=`expr $? + $CRL_GEN_RES`
chmod 600 ${CRL_FILE_GRP_1}_or-ec
+ fi
echo test > file
############################# Modification ##################################
@@ -1810,6 +1724,7 @@ EOF_CRLINI
TEMPFILES="$TEMPFILES ${CRL_FILE_GRP_1}_or-dsa"
+ if [ -z "$NSS_DISABLE_ECC" ] ; then
CU_ACTION="Modify CRL (ECC) by adding one more cert"
crlu -d $CADIR -M -n "TestCA-ec" -f ${R_PWFILE} \
-o ${CRL_FILE_GRP_1}_or1-ec -i ${CRL_FILE_GRP_1}_or-ec <<EOF_CRLINI
@@ -1819,6 +1734,7 @@ EOF_CRLINI
CRL_GEN_RES=`expr $? + $CRL_GEN_RES`
chmod 600 ${CRL_FILE_GRP_1}_or1-ec
TEMPFILES="$TEMPFILES ${CRL_FILE_GRP_1}_or-ec"
+ fi
########### Removing one cert ${UNREVOKED_CERT_GRP_1} #######################
echo "$SCRIPTNAME: Modifying CA CRL by removing one cert ==============="
@@ -1847,6 +1763,7 @@ EOF_CRLINI
+ if [ -z "$NSS_DISABLE_ECC" ] ; then
CU_ACTION="Modify CRL (ECC) by removing one cert"
crlu -d $CADIR -M -n "TestCA-ec" -f ${R_PWFILE} -o ${CRL_FILE_GRP_1}-ec \
-i ${CRL_FILE_GRP_1}_or1-ec <<EOF_CRLINI
@@ -1855,6 +1772,7 @@ rmcert ${UNREVOKED_CERT_GRP_1}
EOF_CRLINI
chmod 600 ${CRL_FILE_GRP_1}-ec
TEMPFILES="$TEMPFILES ${CRL_FILE_GRP_1}_or1-ec"
+ fi
########### Creating second CRL which includes groups 1 and 2 ##############
CRL_GRP_END=`expr ${CRL_GRP_2_BEGIN} + ${CRL_GRP_2_RANGE} - 1`
@@ -1874,6 +1792,7 @@ rmcert ${UNREVOKED_CERT_GRP_2}
EOF_CRLINI
CRL_GEN_RES=`expr $? + $CRL_GEN_RES`
chmod 600 ${CRL_FILE_GRP_2}
+ if [ -z "$NSS_DISABLE_ECC" ] ; then
CU_ACTION="Creating CRL (ECC) for groups 1 and 2"
crlu -d $CADIR -M -n "TestCA-ec" -f ${R_PWFILE} -o ${CRL_FILE_GRP_2}-ec \
-i ${CRL_FILE_GRP_1}-ec <<EOF_CRLINI
@@ -1884,6 +1803,7 @@ rmcert ${UNREVOKED_CERT_GRP_2}
EOF_CRLINI
CRL_GEN_RES=`expr $? + $CRL_GEN_RES`
chmod 600 ${CRL_FILE_GRP_2}-ec
+ fi
########### Creating second CRL which includes groups 1, 2 and 3 ##############
CRL_GRP_END=`expr ${CRL_GRP_3_BEGIN} + ${CRL_GRP_3_RANGE} - 1`
@@ -1905,6 +1825,7 @@ addext crlNumber 0 2
EOF_CRLINI
CRL_GEN_RES=`expr $? + $CRL_GEN_RES`
chmod 600 ${CRL_FILE_GRP_3}
+ if [ -z "$NSS_DISABLE_ECC" ] ; then
CU_ACTION="Creating CRL (ECC) for groups 1, 2 and 3"
crlu -d $CADIR -M -n "TestCA-ec" -f ${R_PWFILE} -o ${CRL_FILE_GRP_3}-ec \
-i ${CRL_FILE_GRP_2}-ec <<EOF_CRLINI
@@ -1915,6 +1836,7 @@ addext crlNumber 0 2
EOF_CRLINI
CRL_GEN_RES=`expr $? + $CRL_GEN_RES`
chmod 600 ${CRL_FILE_GRP_3}-ec
+ fi
############ Importing Server CA Issued CRL for certs of first group #######
@@ -1923,11 +1845,13 @@ EOF_CRLINI
crlu -D -n TestCA -f "${R_PWFILE}" -d "${R_SERVERDIR}"
crlu -I -i ${CRL_FILE} -n "TestCA" -f "${R_PWFILE}" -d "${R_SERVERDIR}"
CRL_GEN_RES=`expr $? + $CRL_GEN_RES`
+ if [ -z "$NSS_DISABLE_ECC" ] ; then
CU_ACTION="Importing CRL (ECC) for groups 1"
crlu -D -n TestCA-ec -f "${R_PWFILE}" -d "${R_SERVERDIR}"
crlu -I -i ${CRL_FILE}-ec -n "TestCA-ec" -f "${R_PWFILE}" \
-d "${R_SERVERDIR}"
CRL_GEN_RES=`expr $? + $CRL_GEN_RES`
+ fi
if [ "$CERTFAILED" != 0 -o "$CRL_GEN_RES" != 0 ] ; then
cert_log "ERROR: SSL CRL prep failed $CERTFAILED : $CRL_GEN_RES"
@@ -2044,387 +1968,6 @@ cert_test_ocspresp()
ocspr ${SERVER_CADIR} "serverCA" "chain-1-serverCA" -f "${R_PWFILE}" 2>&1
}
-cert_test_implicit_db_init()
-{
- echo "$SCRIPTNAME: test implicit database init"
-
- CU_ACTION="Add cert with trust flags to db with implicit init"
- mkdir ${IMPLICIT_INIT_DIR}
- certu -A -n ca -t 'C,C,C' -d ${P_R_IMPLICIT_INIT_DIR} -i "${SERVER_CADIR}/serverCA.ca.cert"
-}
-
-check_sign_algo()
-{
- certu -L -n "$CERTNAME" -d "${PROFILEDIR}" -f "${R_PWFILE}" | \
- sed -n '/^ *Data:/,/^$/{
-/^ Signature Algorithm/,/^ *Salt length/s/^ //p
-}' > ${TMP}/signalgo.txt
-
- diff ${TMP}/signalgo.exp ${TMP}/signalgo.txt
- RET=$?
- if [ "$RET" -ne 0 ]; then
- CERTFAILED=$RET
- html_failed "${CU_ACTION} ($RET) "
- cert_log "ERROR: ${CU_ACTION} failed $RET"
- else
- html_passed "${CU_ACTION}"
- fi
-}
-
-cert_test_rsapss()
-{
- TEMPFILES="$TEMPFILES ${TMP}/signalgo.exp ${TMP}/signalgo.txt"
-
- cert_init_cert "${RSAPSSDIR}" "RSA-PSS Test Cert" 1000 "${D_RSAPSS}"
-
- CU_ACTION="Initialize Cert DB"
- certu -N -d "${PROFILEDIR}" -f "${R_PWFILE}" 2>&1
-
- CU_ACTION="Import RSA CA Cert"
- certu -A -n "TestCA" -t "C,," -d "${PROFILEDIR}" -f "${R_PWFILE}" \
- -i "${R_CADIR}/TestCA.ca.cert" 2>&1
-
- CU_ACTION="Import RSA-PSS CA Cert"
- certu -A -n "TestCA-rsa-pss" -t "C,," -d "${PROFILEDIR}" -f "${R_PWFILE}" \
- -i "${R_CADIR}/TestCA-rsa-pss.ca.cert" 2>&1
-
- CU_ACTION="Verify RSA-PSS CA Cert"
- certu -V -u L -e -n "TestCA-rsa-pss" -d "${PROFILEDIR}" -f "${R_PWFILE}"
-
- CU_ACTION="Import RSA-PSS CA Cert (SHA1)"
- certu -A -n "TestCA-rsa-pss-sha1" -t "C,," -d "${PROFILEDIR}" -f "${R_PWFILE}" \
- -i "${R_CADIR}/TestCA-rsa-pss-sha1.ca.cert" 2>&1
-
- CU_ACTION="Import Bogus RSA-PSS CA Cert (invalid trailerField)"
- certu -A -n "TestCA-bogus-rsa-pss1" -t "C,," -d "${PROFILEDIR}" -f "${R_PWFILE}" \
- -i "${QADIR}/cert/TestCA-bogus-rsa-pss1.crt" 2>&1
- RETEXPECTED=255
- certu -V -b 1712101010Z -n TestCA-bogus-rsa-pss1 -u L -e -d "${PROFILEDIR}" -f "${R_PWFILE}" 2>&1
- RETEXPECTED=0
-
- CU_ACTION="Import Bogus RSA-PSS CA Cert (invalid hashAlg)"
- certu -A -n "TestCA-bogus-rsa-pss2" -t "C,," -d "${PROFILEDIR}" -f "${R_PWFILE}" \
- -i "${QADIR}/cert/TestCA-bogus-rsa-pss2.crt" 2>&1
- RETEXPECTED=255
- certu -V -b 1712101010Z -n TestCA-bogus-rsa-pss2 -u L -e -d "${PROFILEDIR}" -f "${R_PWFILE}" 2>&1
- RETEXPECTED=0
-
- CERTSERIAL=200
-
- # Subject certificate: RSA
- # Issuer certificate: RSA
- # Signature: RSA-PSS (explicit, with --pss-sign)
- CERTNAME="TestUser-rsa-pss1"
-
- CU_ACTION="Generate Cert Request for $CERTNAME"
- CU_SUBJECT="CN=$CERTNAME, E=${CERTNAME}@bogus.com, O=BOGUS NSS, L=Mountain View, ST=California, C=US"
- certu -R -d "${PROFILEDIR}" -f "${R_PWFILE}" -z "${R_NOISE_FILE}" -o req 2>&1
-
- CU_ACTION="Sign ${CERTNAME}'s Request"
- certu -C -c "TestCA" --pss-sign -m "${CERTSERIAL}" -v 60 -d "${P_R_CADIR}" \
- -i req -o "${CERTNAME}.cert" -f "${R_PWFILE}" "$1" 2>&1
-
- CU_ACTION="Import $CERTNAME's Cert"
- certu -A -n "$CERTNAME" -t ",," -d "${PROFILEDIR}" -f "${R_PWFILE}" \
- -i "${CERTNAME}.cert" 2>&1
-
- CU_ACTION="Verify $CERTNAME's Cert"
- certu -V -u V -e -n "$CERTNAME" -d "${PROFILEDIR}" -f "${R_PWFILE}"
- cat > ${TMP}/signalgo.exp <<EOF
-Signature Algorithm: PKCS #1 RSA-PSS Signature
- Parameters:
- Hash algorithm: SHA-256
- Mask algorithm: PKCS #1 MGF1 Mask Generation Function
- Mask hash algorithm: SHA-256
- Salt length: 32 (0x20)
-EOF
- check_sign_algo
-
- CERTSERIAL=`expr $CERTSERIAL + 1`
-
- # Subject certificate: RSA
- # Issuer certificate: RSA
- # Signature: RSA-PSS (explict, with --pss-sign -Z SHA512)
- CERTNAME="TestUser-rsa-pss2"
-
- CU_ACTION="Generate Cert Request for $CERTNAME"
- CU_SUBJECT="CN=$CERTNAME, E=${CERTNAME}@bogus.com, O=BOGUS NSS, L=Mountain View, ST=California, C=US"
- certu -R -d "${PROFILEDIR}" -f "${R_PWFILE}" -z "${R_NOISE_FILE}" -o req 2>&1
-
- CU_ACTION="Sign ${CERTNAME}'s Request"
- certu -C -c "TestCA" --pss-sign -Z SHA512 -m "${CERTSERIAL}" -v 60 -d "${P_R_CADIR}" \
- -i req -o "${CERTNAME}.cert" -f "${R_PWFILE}" "$1" 2>&1
-
- CU_ACTION="Import $CERTNAME's Cert"
- certu -A -n "$CERTNAME" -t ",," -d "${PROFILEDIR}" -f "${R_PWFILE}" \
- -i "${CERTNAME}.cert" 2>&1
-
- CU_ACTION="Verify $CERTNAME's Cert"
- certu -V -u V -e -n "$CERTNAME" -d "${PROFILEDIR}" -f "${R_PWFILE}"
- cat > ${TMP}/signalgo.exp <<EOF
-Signature Algorithm: PKCS #1 RSA-PSS Signature
- Parameters:
- Hash algorithm: SHA-512
- Mask algorithm: PKCS #1 MGF1 Mask Generation Function
- Mask hash algorithm: SHA-512
- Salt length: 64 (0x40)
-EOF
- check_sign_algo
-
- CERTSERIAL=`expr $CERTSERIAL + 1`
-
- # Subject certificate: RSA
- # Issuer certificate: RSA-PSS
- # Signature: RSA-PSS
- CERTNAME="TestUser-rsa-pss3"
-
- CU_ACTION="Generate Cert Request for $CERTNAME"
- CU_SUBJECT="CN=$CERTNAME, E=${CERTNAME}@bogus.com, O=BOGUS NSS, L=Mountain View, ST=California, C=US"
- certu -R -d "${PROFILEDIR}" -f "${R_PWFILE}" -z "${R_NOISE_FILE}" -o req 2>&1
-
- CU_ACTION="Sign ${CERTNAME}'s Request"
- certu -C -c "TestCA-rsa-pss" -m "${CERTSERIAL}" -v 60 -d "${P_R_CADIR}" \
- -i req -o "${CERTNAME}.cert" -f "${R_PWFILE}" "$1" 2>&1
-
- CU_ACTION="Import $CERTNAME's Cert"
- certu -A -n "$CERTNAME" -t ",," -d "${PROFILEDIR}" -f "${R_PWFILE}" \
- -i "${CERTNAME}.cert" 2>&1
-
- CU_ACTION="Verify $CERTNAME's Cert"
- certu -V -u V -e -n "$CERTNAME" -d "${PROFILEDIR}" -f "${R_PWFILE}"
- cat > ${TMP}/signalgo.exp <<EOF
-Signature Algorithm: PKCS #1 RSA-PSS Signature
- Parameters:
- Hash algorithm: SHA-256
- Mask algorithm: PKCS #1 MGF1 Mask Generation Function
- Mask hash algorithm: SHA-256
- Salt length: 32 (0x20)
-EOF
- check_sign_algo
-
- CERTSERIAL=`expr $CERTSERIAL + 1`
-
- # Subject certificate: RSA-PSS
- # Issuer certificate: RSA
- # Signature: RSA-PSS (explicit, with --pss-sign)
- CERTNAME="TestUser-rsa-pss4"
-
- CU_ACTION="Generate Cert Request for $CERTNAME"
- CU_SUBJECT="CN=$CERTNAME, E=${CERTNAME}@bogus.com, O=BOGUS NSS, L=Mountain View, ST=California, C=US"
- certu -R -d "${PROFILEDIR}" -f "${R_PWFILE}" -z "${R_NOISE_FILE}" --pss -o req 2>&1
-
- CU_ACTION="Sign ${CERTNAME}'s Request"
- certu -C -c "TestCA" --pss-sign -m "${CERTSERIAL}" -v 60 -d "${P_R_CADIR}" \
- -i req -o "${CERTNAME}.cert" -f "${R_PWFILE}" "$1" 2>&1
-
- CU_ACTION="Import $CERTNAME's Cert"
- certu -A -n "$CERTNAME" -t ",," -d "${PROFILEDIR}" -f "${R_PWFILE}" \
- -i "${CERTNAME}.cert" 2>&1
-
- CU_ACTION="Verify $CERTNAME's Cert"
- certu -V -u V -e -n "$CERTNAME" -d "${PROFILEDIR}" -f "${R_PWFILE}"
- cat > ${TMP}/signalgo.exp <<EOF
-Signature Algorithm: PKCS #1 RSA-PSS Signature
- Parameters:
- Hash algorithm: SHA-256
- Mask algorithm: PKCS #1 MGF1 Mask Generation Function
- Mask hash algorithm: SHA-256
- Salt length: 32 (0x20)
-EOF
- check_sign_algo
-
- CERTSERIAL=`expr $CERTSERIAL + 1`
-
- # Subject certificate: RSA-PSS
- # Issuer certificate: RSA-PSS
- # Signature: RSA-PSS (explicit, with --pss-sign)
- CERTNAME="TestUser-rsa-pss5"
-
- CU_ACTION="Generate Cert Request for $CERTNAME"
- CU_SUBJECT="CN=$CERTNAME, E=${CERTNAME}@bogus.com, O=BOGUS NSS, L=Mountain View, ST=California, C=US"
- certu -R -d "${PROFILEDIR}" -f "${R_PWFILE}" -z "${R_NOISE_FILE}" --pss -o req 2>&1
-
- CU_ACTION="Sign ${CERTNAME}'s Request"
- certu -C -c "TestCA-rsa-pss" --pss-sign -m "${CERTSERIAL}" -v 60 -d "${P_R_CADIR}" \
- -i req -o "${CERTNAME}.cert" -f "${R_PWFILE}" "$1" 2>&1
-
- CU_ACTION="Import $CERTNAME's Cert"
- certu -A -n "$CERTNAME" -t ",," -d "${PROFILEDIR}" -f "${R_PWFILE}" \
- -i "${CERTNAME}.cert" 2>&1
-
- CU_ACTION="Verify $CERTNAME's Cert"
- certu -V -u V -e -n "$CERTNAME" -d "${PROFILEDIR}" -f "${R_PWFILE}"
- cat > ${TMP}/signalgo.exp <<EOF
-Signature Algorithm: PKCS #1 RSA-PSS Signature
- Parameters:
- Hash algorithm: SHA-256
- Mask algorithm: PKCS #1 MGF1 Mask Generation Function
- Mask hash algorithm: SHA-256
- Salt length: 32 (0x20)
-EOF
- check_sign_algo
-
- CERTSERIAL=`expr $CERTSERIAL + 1`
-
- # Subject certificate: RSA-PSS
- # Issuer certificate: RSA-PSS
- # Signature: RSA-PSS (implicit, without --pss-sign)
- CERTNAME="TestUser-rsa-pss6"
-
- CU_ACTION="Generate Cert Request for $CERTNAME"
- CU_SUBJECT="CN=$CERTNAME, E=${CERTNAME}@bogus.com, O=BOGUS NSS, L=Mountain View, ST=California, C=US"
- certu -R -d "${PROFILEDIR}" -f "${R_PWFILE}" -z "${R_NOISE_FILE}" --pss -o req 2>&1
-
- CU_ACTION="Sign ${CERTNAME}'s Request"
- # Sign without --pss-sign nor -Z option
- certu -C -c "TestCA-rsa-pss" -m "${CERTSERIAL}" -v 60 -d "${P_R_CADIR}" \
- -i req -o "${CERTNAME}.cert" -f "${R_PWFILE}" "$1" 2>&1
-
- CU_ACTION="Import $CERTNAME's Cert"
- certu -A -n "$CERTNAME" -t ",," -d "${PROFILEDIR}" -f "${R_PWFILE}" \
- -i "${CERTNAME}.cert" 2>&1
-
- CU_ACTION="Verify $CERTNAME's Cert"
- certu -V -u V -e -n "$CERTNAME" -d "${PROFILEDIR}" -f "${R_PWFILE}"
- cat > ${TMP}/signalgo.exp <<EOF
-Signature Algorithm: PKCS #1 RSA-PSS Signature
- Parameters:
- Hash algorithm: SHA-256
- Mask algorithm: PKCS #1 MGF1 Mask Generation Function
- Mask hash algorithm: SHA-256
- Salt length: 32 (0x20)
-EOF
- check_sign_algo
-
- CERTSERIAL=`expr $CERTSERIAL + 1`
-
- # Subject certificate: RSA-PSS
- # Issuer certificate: RSA-PSS
- # Signature: RSA-PSS (with conflicting hash algorithm)
- CERTNAME="TestUser-rsa-pss7"
-
- CU_ACTION="Generate Cert Request for $CERTNAME"
- CU_SUBJECT="CN=$CERTNAME, E=${CERTNAME}@bogus.com, O=BOGUS NSS, L=Mountain View, ST=California, C=US"
- certu -R -d "${PROFILEDIR}" -f "${R_PWFILE}" -z "${R_NOISE_FILE}" --pss -o req 2>&1
-
- CU_ACTION="Sign ${CERTNAME}'s Request"
- RETEXPECTED=255
- certu -C -c "TestCA-rsa-pss" --pss-sign -Z SHA512 -m "${CERTSERIAL}" -v 60 -d "${P_R_CADIR}" \
- -i req -o "${CERTNAME}.cert" -f "${R_PWFILE}" "$1" 2>&1
- RETEXPECTED=0
-
- CERTSERIAL=`expr $CERTSERIAL + 1`
-
- # Subject certificate: RSA-PSS
- # Issuer certificate: RSA-PSS
- # Signature: RSA-PSS (with compatible hash algorithm)
- CERTNAME="TestUser-rsa-pss8"
-
- CU_ACTION="Generate Cert Request for $CERTNAME"
- CU_SUBJECT="CN=$CERTNAME, E=${CERTNAME}@bogus.com, O=BOGUS NSS, L=Mountain View, ST=California, C=US"
- certu -R -d "${PROFILEDIR}" -f "${R_PWFILE}" -z "${R_NOISE_FILE}" --pss -o req 2>&1
-
- CU_ACTION="Sign ${CERTNAME}'s Request"
- certu -C -c "TestCA-rsa-pss" --pss-sign -Z SHA256 -m "${CERTSERIAL}" -v 60 -d "${P_R_CADIR}" \
- -i req -o "${CERTNAME}.cert" -f "${R_PWFILE}" "$1" 2>&1
-
- CU_ACTION="Import $CERTNAME's Cert"
- certu -A -n "$CERTNAME" -t ",," -d "${PROFILEDIR}" -f "${R_PWFILE}" \
- -i "${CERTNAME}.cert" 2>&1
-
- CU_ACTION="Verify $CERTNAME's Cert"
- certu -V -u V -e -n "$CERTNAME" -d "${PROFILEDIR}" -f "${R_PWFILE}"
- cat > ${TMP}/signalgo.exp <<EOF
-Signature Algorithm: PKCS #1 RSA-PSS Signature
- Parameters:
- Hash algorithm: SHA-256
- Mask algorithm: PKCS #1 MGF1 Mask Generation Function
- Mask hash algorithm: SHA-256
- Salt length: 32 (0x20)
-EOF
- check_sign_algo
-
- CERTSERIAL=`expr $CERTSERIAL + 1`
-
- # Subject certificate: RSA
- # Issuer certificate: RSA
- # Signature: RSA-PSS (explict, with --pss-sign -Z SHA1)
- CERTNAME="TestUser-rsa-pss9"
-
- CU_ACTION="Generate Cert Request for $CERTNAME"
- CU_SUBJECT="CN=$CERTNAME, E=${CERTNAME}@bogus.com, O=BOGUS NSS, L=Mountain View, ST=California, C=US"
- certu -R -d "${PROFILEDIR}" -f "${R_PWFILE}" -z "${R_NOISE_FILE}" -o req 2>&1
-
- CU_ACTION="Sign ${CERTNAME}'s Request"
- certu -C -c "TestCA" --pss-sign -Z SHA1 -m "${CERTSERIAL}" -v 60 -d "${P_R_CADIR}" \
- -i req -o "${CERTNAME}.cert" -f "${R_PWFILE}" "$1" 2>&1
-
- CU_ACTION="Import $CERTNAME's Cert"
- certu -A -n "$CERTNAME" -t ",," -d "${PROFILEDIR}" -f "${R_PWFILE}" \
- -i "${CERTNAME}.cert" 2>&1
-
- CU_ACTION="Verify $CERTNAME's Cert"
- certu -V -u V -e -n "$CERTNAME" -d "${PROFILEDIR}" -f "${R_PWFILE}"
- cat > ${TMP}/signalgo.exp <<EOF
-Signature Algorithm: PKCS #1 RSA-PSS Signature
- Parameters:
- Hash algorithm: default, SHA-1
- Mask algorithm: default, MGF1
- Mask hash algorithm: default, SHA-1
- Salt length: default, 20 (0x14)
-EOF
- check_sign_algo
-
- CERTSERIAL=`expr $CERTSERIAL + 1`
-
- # Subject certificate: RSA-PSS
- # Issuer certificate: RSA-PSS
- # Signature: RSA-PSS (implicit, without --pss-sign, default parameters)
- CERTNAME="TestUser-rsa-pss10"
-
- CU_ACTION="Generate Cert Request for $CERTNAME"
- CU_SUBJECT="CN=$CERTNAME, E=${CERTNAME}@bogus.com, O=BOGUS NSS, L=Mountain View, ST=California, C=US"
- certu -R -d "${PROFILEDIR}" -f "${R_PWFILE}" -z "${R_NOISE_FILE}" -o req 2>&1
-
- CU_ACTION="Sign ${CERTNAME}'s Request"
- # Sign without --pss-sign nor -Z option
- certu -C -c "TestCA-rsa-pss-sha1" -m "${CERTSERIAL}" -v 60 -d "${P_R_CADIR}" \
- -i req -o "${CERTNAME}.cert" -f "${R_PWFILE}" "$1" 2>&1
-
- CU_ACTION="Import $CERTNAME's Cert"
- certu -A -n "$CERTNAME" -t ",," -d "${PROFILEDIR}" -f "${R_PWFILE}" \
- -i "${CERTNAME}.cert" 2>&1
-
- CU_ACTION="Verify $CERTNAME's Cert"
- certu -V -u V -e -n "$CERTNAME" -d "${PROFILEDIR}" -f "${R_PWFILE}"
- cat > ${TMP}/signalgo.exp <<EOF
-Signature Algorithm: PKCS #1 RSA-PSS Signature
- Parameters:
- Hash algorithm: default, SHA-1
- Mask algorithm: default, MGF1
- Mask hash algorithm: default, SHA-1
- Salt length: default, 20 (0x14)
-EOF
- check_sign_algo
-
- CERTSERIAL=`expr $CERTSERIAL + 1`
-
- # Subject certificate: RSA-PSS
- # Issuer certificate: RSA-PSS
- # Signature: RSA-PSS (with conflicting hash algorithm, default parameters)
- CERTNAME="TestUser-rsa-pss11"
-
- CU_ACTION="Generate Cert Request for $CERTNAME"
- CU_SUBJECT="CN=$CERTNAME, E=${CERTNAME}@bogus.com, O=BOGUS NSS, L=Mountain View, ST=California, C=US"
- certu -R -d "${PROFILEDIR}" -f "${R_PWFILE}" -z "${R_NOISE_FILE}" --pss -o req 2>&1
-
- CU_ACTION="Sign ${CERTNAME}'s Request"
- RETEXPECTED=255
- certu -C -c "TestCA-rsa-pss-sha1" --pss-sign -Z SHA256 -m "${CERTSERIAL}" -v 60 -d "${P_R_CADIR}" \
- -i req -o "${CERTNAME}.cert" -f "${R_PWFILE}" "$1" 2>&1
- RETEXPECTED=0
-}
-
############################## cert_cleanup ############################
# local shell function to finish this script (no exit since it might be
# sourced)
@@ -2432,24 +1975,20 @@ EOF
cert_cleanup()
{
cert_log "$SCRIPTNAME: finished $SCRIPTNAME"
- html "</TABLE><BR>"
+ html "</TABLE><BR>"
cd ${QADIR}
. common/cleanup.sh
}
################## main #################################################
-cert_init
+cert_init
cert_all_CA
-cert_test_implicit_db_init
-cert_extended_ssl
-cert_ssl
-cert_smime_client
-IS_FIPS_DISABLED=`certutil --build-flags |grep -cw NSS_FIPS_DISABLED`
-if [ $IS_FIPS_DISABLED -ne 0 ]; then
- cert_rsa_exponent_nonfips
-else
- cert_fips
+cert_extended_ssl
+cert_ssl
+cert_smime_client
+if [ -z "$NSS_TEST_DISABLE_FIPS" ]; then
+ cert_fips
fi
cert_eccurves
cert_extensions
@@ -2457,7 +1996,6 @@ cert_san_and_generic_extensions
cert_test_password
cert_test_distrust
cert_test_ocspresp
-cert_test_rsapss
if [ -z "$NSS_TEST_DISABLE_CRL" ] ; then
cert_crl_ssl
@@ -2466,7 +2004,7 @@ else
fi
if [ -n "$DO_DIST_ST" -a "$DO_DIST_ST" = "TRUE" ] ; then
- cert_stresscerts
+ cert_stresscerts
fi
cert_iopr_setup
diff --git a/security/nss/tests/cipher/cipher.sh b/security/nss/tests/cipher/cipher.sh
index 11a621815e..1d2561d9c0 100755
--- a/security/nss/tests/cipher/cipher.sh
+++ b/security/nss/tests/cipher/cipher.sh
@@ -107,21 +107,6 @@ cipher_gcm()
done < ${GCM_TXT}
}
-###################### cipher_rsa_populate ############################
-# Test the ability to reconstruct rsa private key reconstruction
-# also test the PK11GenericObject interface
-###################################################################
-cipher_rsa_populate()
-{
- TESTNAME="RSA Reconstruct Private Keys Test"
- echo "$SCRIPTNAME: $TESTNAME --------------------------------"
- echo "rsapoptst -t all -r 10"
-# skip e_d_q. It isn't reliable, and can return incorrect data. e_d_q should
-# be turned off.
- ${PROFTOOL} ${BINDIR}/rsapoptst -t e_n_p,d_n_q,d_p_q,e_d_n -r 10
- html_msg $? 0 "$TESTNAME"
-}
-
############################## cipher_cleanup ############################
# local shell function to finish this script (no exit since it might be
# sourced)
@@ -151,6 +136,5 @@ fi
# Skip cipher_gcm if this is a softoken only build.
if [ "${NSS_BUILD_SOFTOKEN_ONLY}" != "1" ]; then
cipher_gcm
- cipher_rsa_populate
fi
cipher_cleanup
diff --git a/security/nss/tests/common/init.sh b/security/nss/tests/common/init.sh
index 933551e834..caf3013e69 100644
--- a/security/nss/tests/common/init.sh
+++ b/security/nss/tests/common/init.sh
@@ -63,13 +63,11 @@ if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then
DBPASSDIR=${HOSTDIR}/dbpass
ECCURVES_DIR=${HOSTDIR}/eccurves
DISTRUSTDIR=${HOSTDIR}/distrust
- RSAPSSDIR=${HOSTDIR}/rsapss
SERVER_CADIR=${HOSTDIR}/serverCA
CLIENT_CADIR=${HOSTDIR}/clientCA
EXT_SERVERDIR=${HOSTDIR}/ext_server
EXT_CLIENTDIR=${HOSTDIR}/ext_client
- IMPLICIT_INIT_DIR=${HOSTDIR}/implicit_init
IOPR_CADIR=${HOSTDIR}/CA_iopr
IOPR_SSL_SERVERDIR=${HOSTDIR}/server_ssl_iopr
@@ -78,12 +76,10 @@ if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then
CERT_EXTENSIONS_DIR=${HOSTDIR}/cert_extensions
STAPLINGDIR=${HOSTDIR}/stapling
- NOLOGINDIR=${HOSTDIR}/nologin
SSLGTESTDIR=${HOSTDIR}/ssl_gtests
GTESTDIR=${HOSTDIR}/gtests
PWFILE=${HOSTDIR}/tests.pw
- EMPTY_FILE=${HOSTDIR}/tests_empty
NOISE_FILE=${HOSTDIR}/tests_noise
CORELIST_FILE=${HOSTDIR}/clist
@@ -532,16 +528,13 @@ if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then
D_CLIENT_CA="ClientCA.$version"
D_SERVER="Server.$version"
D_CLIENT="Client.$version"
- D_NOLOGIN="NoLogin.$version"
D_FIPS="FIPS.$version"
D_DBPASS="DBPASS.$version"
D_ECCURVES="ECCURVES.$version"
D_EXT_SERVER="ExtendedServer.$version"
D_EXT_CLIENT="ExtendedClient.$version"
- D_IMPLICIT_INIT="ImplicitInit.$version"
D_CERT_EXTENSTIONS="CertExtensions.$version"
D_DISTRUST="Distrust.$version"
- D_RSAPSS="RSAPSS.$version"
# we need relative pathnames of these files abd directories, since our
# tools can't handle the unix style absolut pathnames on cygnus
@@ -559,10 +552,8 @@ if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then
R_EVEDIR=../eve
R_EXT_SERVERDIR=../ext_server
R_EXT_CLIENTDIR=../ext_client
- R_IMPLICIT_INIT_DIR=../implicit_init
R_CERT_EXT=../cert_extensions
R_STAPLINGDIR=../stapling
- R_NOLOGINDIR=../nologin
R_SSLGTESTDIR=../ssl_gtests
R_GTESTDIR=../gtests
@@ -577,10 +568,8 @@ if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then
P_R_EVEDIR=${R_EVEDIR}
P_R_SERVERDIR=${R_SERVERDIR}
P_R_CLIENTDIR=${R_CLIENTDIR}
- P_R_NOLOGINDIR=${R_NOLOGINDIR}
P_R_EXT_SERVERDIR=${R_EXT_SERVERDIR}
P_R_EXT_CLIENTDIR=${R_EXT_CLIENTDIR}
- P_R_IMPLICIT_INIT_DIR=${R_IMPLICIT_INIT_DIR}
if [ -n "${MULTIACCESS_DBM}" ]; then
P_R_CADIR="multiaccess:${D_CA}"
P_R_ALICEDIR="multiaccess:${D_ALICE}"
@@ -589,14 +578,11 @@ if [ -z "${INIT_SOURCED}" -o "${INIT_SOURCED}" != "TRUE" ]; then
P_R_EVEDIR="multiaccess:${D_EVE}"
P_R_SERVERDIR="multiaccess:${D_SERVER}"
P_R_CLIENTDIR="multiaccess:${D_CLIENT}"
- P_R_NOLOGINDIR="multiaccess:${D_NOLOGIN}"
P_R_EXT_SERVERDIR="multiaccess:${D_EXT_SERVER}"
P_R_EXT_CLIENTDIR="multiaccess:${D_EXT_CLIENT}"
- P_R_IMPLICIT_INIT_DIR="multiaccess:${D_IMPLICIT_INIT}"
fi
R_PWFILE=../tests.pw
- R_EMPTY_FILE=../tests_empty
R_NOISE_FILE=../tests_noise
R_FIPSPWFILE=../tests.fipspw
diff --git a/security/nss/tests/gtests/gtests.sh b/security/nss/tests/gtests/gtests.sh
index 6606b59e77..c785241c4e 100755
--- a/security/nss/tests/gtests/gtests.sh
+++ b/security/nss/tests/gtests/gtests.sh
@@ -83,7 +83,7 @@ gtest_cleanup()
}
################## main #################################################
-GTESTS="prng_gtest certhigh_gtest certdb_gtest der_gtest pk11_gtest util_gtest freebl_gtest softoken_gtest blake2b_gtest"
+GTESTS="prng_gtest certhigh_gtest certdb_gtest der_gtest pk11_gtest util_gtest freebl_gtest"
SOURCE_DIR="$PWD"/../..
gtest_init $0
gtest_start
diff --git a/security/nss/tests/merge/merge.sh b/security/nss/tests/merge/merge.sh
index d17a8c4ef3..1929b12c81 100755
--- a/security/nss/tests/merge/merge.sh
+++ b/security/nss/tests/merge/merge.sh
@@ -98,7 +98,7 @@ merge_init()
# are dbm databases.
if [ "${TEST_MODE}" = "UPGRADE_DB" ]; then
save=${NSS_DEFAULT_DB_TYPE}
- NSS_DEFAULT_DB_TYPE=dbm ; export NSS_DEFAULT_DB_TYPE
+ NSS_DEFAULT_DB_TYPE= ; export NSS_DEFAULT_DB_TYPE
fi
certutil -N -d ${CONFLICT1DIR} -f ${R_PWFILE}
diff --git a/security/nss/tests/pkits/pkits.sh b/security/nss/tests/pkits/pkits.sh
index e79fdd3823..ecf0077369 100755
--- a/security/nss/tests/pkits/pkits.sh
+++ b/security/nss/tests/pkits/pkits.sh
@@ -93,7 +93,7 @@ pkits_init()
${BINDIR}/certutil -N -d ${PKITSdb} -f ${PKITSdb}/pw
${BINDIR}/certutil -A -n TrustAnchorRootCertificate -t "C,C,C" -i \
- $certs/TrustAnchorRootCertificate.crt -d $PKITSdb -f ${PKITSdb}/pw
+ $certs/TrustAnchorRootCertificate.crt -d $PKITSdb
if [ -z "$NSS_NO_PKITS_CRLS" ]; then
${BINDIR}/crlutil -I -i $crls/TrustAnchorRootCRL.crl -d ${PKITSdb} -f ${PKITSdb}/pw
else
diff --git a/security/nss/tests/remote/Makefile b/security/nss/tests/remote/Makefile
index 4635bccc5b..6c6e5bd553 100644
--- a/security/nss/tests/remote/Makefile
+++ b/security/nss/tests/remote/Makefile
@@ -80,6 +80,7 @@ package_for_testing:
echo 'export USE_64=$(USE_64)' >> $(RTSH)
echo 'export BUILD_OPT=$(BUILD_OPT)' >> $(RTSH)
echo 'export PKITS_DATA=$(PKITS_DATA)' >> $(RTSH)
+ echo 'export NSS_DISABLE_ECC=$(NSS_DISABLE_ECC)' >> $(RTSH)
echo 'export NSPR_LOG_MODULES=$(NSPR_LOG_MODULES)' >> $(RTSH)
ifeq ($(OS_TARGET),Android)
# Android doesn't support FIPS tests, because
diff --git a/security/nss/tests/smime/smime.sh b/security/nss/tests/smime/smime.sh
index 9cdc0875bd..2360100de1 100755
--- a/security/nss/tests/smime/smime.sh
+++ b/security/nss/tests/smime/smime.sh
@@ -40,7 +40,11 @@ smime_init()
fi
SCRIPTNAME=smime.sh
- html_head "S/MIME Tests"
+ if [ -z "$NSS_DISABLE_ECC" ] ; then
+ html_head "S/MIME Tests with ECC"
+ else
+ html_head "S/MIME Tests"
+ fi
grep "SUCCESS: SMIME passed" $CERT_LOG_FILE >/dev/null || {
Exit 11 "Fatal - S/MIME of cert.sh needs to pass first"
@@ -81,27 +85,29 @@ smime_sign()
html_msg $? 0 "Compare Attached Signed Data and Original (${HASH})" "."
# Test ECDSA signing for all hash algorithms.
- echo "$SCRIPTNAME: Signing Detached Message ECDSA w/ {$HASH} ------------------"
- echo "cmsutil -S -T -N Alice-ec ${HASH_CMD} -i alice.txt -d ${P_R_ALICEDIR} -p nss -o alice-ec.d${SIG}"
- ${PROFTOOL} ${BINDIR}/cmsutil -S -T -N Alice-ec ${HASH_CMD} -i alice.txt -d ${P_R_ALICEDIR} -p nss -o alice-ec.d${SIG}
- html_msg $? 0 "Create Detached Signature Alice (ECDSA w/ ${HASH})" "."
-
- echo "cmsutil -D -i alice-ec.d${SIG} -c alice.txt -d ${P_R_BOBDIR} "
- ${PROFTOOL} ${BINDIR}/cmsutil -D -i alice-ec.d${SIG} -c alice.txt -d ${P_R_BOBDIR}
- html_msg $? 0 "Verifying Alice's Detached Signature (ECDSA w/ ${HASH})" "."
-
- echo "$SCRIPTNAME: Signing Attached Message (ECDSA w/ ${HASH}) ------------------"
- echo "cmsutil -S -N Alice-ec ${HASH_CMD} -i alice.txt -d ${P_R_ALICEDIR} -p nss -o alice-ec.${SIG}"
- ${PROFTOOL} ${BINDIR}/cmsutil -S -N Alice-ec ${HASH_CMD} -i alice.txt -d ${P_R_ALICEDIR} -p nss -o alice-ec.${SIG}
- html_msg $? 0 "Create Attached Signature Alice (ECDSA w/ ${HASH})" "."
-
- echo "cmsutil -D -i alice-ec.${SIG} -d ${P_R_BOBDIR} -o alice-ec.data.${HASH}"
- ${PROFTOOL} ${BINDIR}/cmsutil -D -i alice-ec.${SIG} -d ${P_R_BOBDIR} -o alice-ec.data.${HASH}
- html_msg $? 0 "Decode Alice's Attached Signature (ECDSA w/ ${HASH})" "."
-
- echo "diff alice.txt alice-ec.data.${HASH}"
- diff alice.txt alice-ec.data.${HASH}
- html_msg $? 0 "Compare Attached Signed Data and Original (ECDSA w/ ${HASH})" "."
+ if [ -z "$NSS_DISABLE_ECC" ] ; then
+ echo "$SCRIPTNAME: Signing Detached Message ECDSA w/ {$HASH} ------------------"
+ echo "cmsutil -S -T -N Alice-ec ${HASH_CMD} -i alice.txt -d ${P_R_ALICEDIR} -p nss -o alice-ec.d${SIG}"
+ ${PROFTOOL} ${BINDIR}/cmsutil -S -T -N Alice-ec ${HASH_CMD} -i alice.txt -d ${P_R_ALICEDIR} -p nss -o alice-ec.d${SIG}
+ html_msg $? 0 "Create Detached Signature Alice (ECDSA w/ ${HASH})" "."
+
+ echo "cmsutil -D -i alice-ec.d${SIG} -c alice.txt -d ${P_R_BOBDIR} "
+ ${PROFTOOL} ${BINDIR}/cmsutil -D -i alice-ec.d${SIG} -c alice.txt -d ${P_R_BOBDIR}
+ html_msg $? 0 "Verifying Alice's Detached Signature (ECDSA w/ ${HASH})" "."
+
+ echo "$SCRIPTNAME: Signing Attached Message (ECDSA w/ ${HASH}) ------------------"
+ echo "cmsutil -S -N Alice-ec ${HASH_CMD} -i alice.txt -d ${P_R_ALICEDIR} -p nss -o alice-ec.${SIG}"
+ ${PROFTOOL} ${BINDIR}/cmsutil -S -N Alice-ec ${HASH_CMD} -i alice.txt -d ${P_R_ALICEDIR} -p nss -o alice-ec.${SIG}
+ html_msg $? 0 "Create Attached Signature Alice (ECDSA w/ ${HASH})" "."
+
+ echo "cmsutil -D -i alice-ec.${SIG} -d ${P_R_BOBDIR} -o alice-ec.data.${HASH}"
+ ${PROFTOOL} ${BINDIR}/cmsutil -D -i alice-ec.${SIG} -d ${P_R_BOBDIR} -o alice-ec.data.${HASH}
+ html_msg $? 0 "Decode Alice's Attached Signature (ECDSA w/ ${HASH})" "."
+
+ echo "diff alice.txt alice-ec.data.${HASH}"
+ diff alice.txt alice-ec.data.${HASH}
+ html_msg $? 0 "Compare Attached Signed Data and Original (ECDSA w/ ${HASH})" "."
+ fi
}
diff --git a/security/nss/tests/ssl/ssl.sh b/security/nss/tests/ssl/ssl.sh
index de867a4bda..944849ad38 100755
--- a/security/nss/tests/ssl/ssl.sh
+++ b/security/nss/tests/ssl/ssl.sh
@@ -57,16 +57,10 @@ ssl_init()
fi
PORT=${PORT-8443}
- # Avoid port conflicts when multiple tests are running on the same machine.
- if [ -n "$NSS_TASKCLUSTER_MAC" ]; then
- cwd=$(cd $(dirname $0); pwd -P)
- padd=$(echo $cwd | cut -d "/" -f4 | sed 's/[^0-9]//g')
- PORT=$(($PORT + $padd))
- fi
NSS_SSL_TESTS=${NSS_SSL_TESTS:-normal_normal}
- nss_ssl_run="stapling signed_cert_timestamps cov auth stress dtls"
+ nss_ssl_run="stapling signed_cert_timestamps cov auth stress"
NSS_SSL_RUN=${NSS_SSL_RUN:-$nss_ssl_run}
-
+
# Test case files
SSLCOV=${QADIR}/ssl/sslcov.txt
SSLAUTH=${QADIR}/ssl/sslauth.txt
@@ -96,8 +90,15 @@ ssl_init()
NON_EC_SUITES=":0016:0032:0033:0038:0039:003B:003C:003D:0040:0041:0067:006A:006B"
NON_EC_SUITES="${NON_EC_SUITES}:0084:009C:009D:009E:009F:00A2:00A3:CCAAcdeinvyz"
- # List of cipher suites to test, including ECC cipher suites.
- CIPHER_SUITES="-c ${EC_SUITES}${NON_EC_SUITES}"
+ if [ -z "$NSS_DISABLE_ECC" ] ; then
+ ECC_STRING=" - with ECC"
+ # List of cipher suites to test, including ECC cipher suites.
+ CIPHER_SUITES="-c ${EC_SUITES}${NON_EC_SUITES}"
+ else
+ ECC_STRING=""
+ # List of cipher suites to test, excluding ECC cipher suites.
+ CIPHER_SUITES="-c ${NON_EC_SUITES}"
+ fi
if [ "${OS_ARCH}" != "WINNT" ]; then
ulimit -n 1000 # make sure we have enough file descriptors
@@ -140,16 +141,16 @@ wait_for_selfserv()
{
#verbose="-v"
echo "trying to connect to selfserv at `date`"
- echo "tstclnt -4 -p ${PORT} -h ${HOSTADDR} ${CLIENT_OPTIONS} -q \\"
+ echo "tstclnt -p ${PORT} -h ${HOSTADDR} ${CLIENT_OPTIONS} -q \\"
echo " -d ${P_R_CLIENTDIR} $verbose < ${REQUEST_FILE}"
- ${BINDIR}/tstclnt -4 -p ${PORT} -h ${HOSTADDR} ${CLIENT_OPTIONS} -q \
+ ${BINDIR}/tstclnt -p ${PORT} -h ${HOSTADDR} ${CLIENT_OPTIONS} -q \
-d ${P_R_CLIENTDIR} $verbose < ${REQUEST_FILE}
if [ $? -ne 0 ]; then
sleep 5
echo "retrying to connect to selfserv at `date`"
echo "tstclnt -p ${PORT} -h ${HOSTADDR} ${CLIENT_OPTIONS} -q \\"
echo " -d ${P_R_CLIENTDIR} $verbose < ${REQUEST_FILE}"
- ${BINDIR}/tstclnt -4 -p ${PORT} -h ${HOSTADDR} ${CLIENT_OPTIONS} -q \
+ ${BINDIR}/tstclnt -p ${PORT} -h ${HOSTADDR} ${CLIENT_OPTIONS} -q \
-d ${P_R_CLIENTDIR} $verbose < ${REQUEST_FILE}
if [ $? -ne 0 ]; then
html_failed "Waiting for Server"
@@ -211,7 +212,8 @@ start_selfserv()
echo "$SCRIPTNAME: $testname ----"
fi
sparam=`echo $sparam | sed -e 's;_; ;g'`
- if [ -z "$NO_ECC_CERTS" -o "$NO_ECC_CERTS" != "1" ] ; then
+ if [ -z "$NSS_DISABLE_ECC" ] && \
+ [ -z "$NO_ECC_CERTS" -o "$NO_ECC_CERTS" != "1" ] ; then
ECC_OPTIONS="-e ${HOSTADDR}-ecmixed -e ${HOSTADDR}-ec"
else
ECC_OPTIONS=""
@@ -256,18 +258,13 @@ start_selfserv()
echo "selfserv with PID ${PID} started at `date`"
}
-ignore_blank_lines()
-{
- LC_ALL=C grep -v '^[[:space:]]*\(#\|$\)' "$1"
-}
-
############################## ssl_cov #################################
# local shell function to perform SSL Cipher Coverage tests
########################################################################
ssl_cov()
{
#verbose="-v"
- html_head "SSL Cipher Coverage $NORM_EXT - server $SERVER_MODE/client $CLIENT_MODE"
+ html_head "SSL Cipher Coverage $NORM_EXT - server $SERVER_MODE/client $CLIENT_MODE $ECC_STRING"
testname=""
sparam="$CIPHER_SUITES"
@@ -277,15 +274,15 @@ ssl_cov()
VMIN="ssl3"
VMAX="tls1.1"
- ignore_blank_lines ${SSLCOV} | \
+ exec < ${SSLCOV}
while read ectype testmax param testname
do
echo "${testname}" | grep "EXPORT" > /dev/null
EXP=$?
- if [ "$ectype" = "ECC" ] ; then
+ if [ "$ectype" = "ECC" -a -n "$NSS_DISABLE_ECC" ] ; then
echo "$SCRIPTNAME: skipping $testname (ECC only)"
- else
+ elif [ "`echo $ectype | cut -b 1`" != "#" ] ; then
echo "$SCRIPTNAME: running $testname ----------------------------"
VMAX="ssl3"
if [ "$testmax" = "TLS10" ]; then
@@ -298,11 +295,11 @@ ssl_cov()
VMAX="tls1.2"
fi
- echo "tstclnt -4 -p ${PORT} -h ${HOSTADDR} -c ${param} -V ${VMIN}:${VMAX} ${CLIENT_OPTIONS} \\"
+ echo "tstclnt -p ${PORT} -h ${HOSTADDR} -c ${param} -V ${VMIN}:${VMAX} ${CLIENT_OPTIONS} \\"
echo " -f -d ${P_R_CLIENTDIR} $verbose -w nss < ${REQUEST_FILE}"
rm ${TMP}/$HOST.tmp.$$ 2>/dev/null
- ${PROFTOOL} ${BINDIR}/tstclnt -4 -p ${PORT} -h ${HOSTADDR} -c ${param} -V ${VMIN}:${VMAX} ${CLIENT_OPTIONS} -f \
+ ${PROFTOOL} ${BINDIR}/tstclnt -p ${PORT} -h ${HOSTADDR} -c ${param} -V ${VMIN}:${VMAX} ${CLIENT_OPTIONS} -f \
-d ${P_R_CLIENTDIR} $verbose -w nss < ${REQUEST_FILE} \
>${TMP}/$HOST.tmp.$$ 2>&1
ret=$?
@@ -323,11 +320,12 @@ ssl_cov()
ssl_auth()
{
#verbose="-v"
- html_head "SSL Client Authentication $NORM_EXT - server $SERVER_MODE/client $CLIENT_MODE"
+ html_head "SSL Client Authentication $NORM_EXT - server $SERVER_MODE/client $CLIENT_MODE $ECC_STRING"
- ignore_blank_lines ${SSLAUTH} | \
+ exec < ${SSLAUTH}
while read ectype value sparam cparam testname
do
+ [ -z "$ectype" ] && continue
echo "${testname}" | grep "don't require client auth" > /dev/null
CAUTH=$?
@@ -335,9 +333,9 @@ ssl_auth()
echo "$SCRIPTNAME: skipping $testname (non-FIPS only)"
elif [ "$ectype" = "SNI" -a "$NORM_EXT" = "Extended Test" ] ; then
echo "$SCRIPTNAME: skipping $testname for $NORM_EXT"
- elif [ "$ectype" = "ECC" ] ; then
+ elif [ "$ectype" = "ECC" -a -n "$NSS_DISABLE_ECC" ] ; then
echo "$SCRIPTNAME: skipping $testname (ECC only)"
- else
+ elif [ "`echo $ectype | cut -b 1`" != "#" ]; then
cparam=`echo $cparam | sed -e 's;_; ;g' -e "s/TestUser/$USER_NICKNAME/g" `
if [ "$ectype" = "SNI" ]; then
cparam=`echo $cparam | sed -e "s/Host/$HOST/g" -e "s/Dom/$DOMSUF/g" `
@@ -345,10 +343,10 @@ ssl_auth()
fi
start_selfserv
- echo "tstclnt -4 -p ${PORT} -h ${HOSTADDR} -f -d ${P_R_CLIENTDIR} $verbose ${CLIENT_OPTIONS} \\"
+ echo "tstclnt -p ${PORT} -h ${HOSTADDR} -f -d ${P_R_CLIENTDIR} $verbose ${CLIENT_OPTIONS} \\"
echo " ${cparam} < ${REQUEST_FILE}"
rm ${TMP}/$HOST.tmp.$$ 2>/dev/null
- ${PROFTOOL} ${BINDIR}/tstclnt -4 -p ${PORT} -h ${HOSTADDR} -f ${cparam} $verbose ${CLIENT_OPTIONS} \
+ ${PROFTOOL} ${BINDIR}/tstclnt -p ${PORT} -h ${HOSTADDR} -f ${cparam} $verbose ${CLIENT_OPTIONS} \
-d ${P_R_CLIENTDIR} < ${REQUEST_FILE} \
>${TMP}/$HOST.tmp.$$ 2>&1
ret=$?
@@ -397,10 +395,10 @@ ssl_stapling_sub()
start_selfserv
- echo "tstclnt -4 -p ${PORT} -h ${HOSTADDR} -f -d ${P_R_CLIENTDIR} $verbose ${CLIENT_OPTIONS} \\"
+ echo "tstclnt -p ${PORT} -h ${HOSTADDR} -f -d ${P_R_CLIENTDIR} $verbose ${CLIENT_OPTIONS} \\"
echo " -c v -T -O -F -M 1 -V ssl3:tls1.2 < ${REQUEST_FILE}"
rm ${TMP}/$HOST.tmp.$$ 2>/dev/null
- ${PROFTOOL} ${BINDIR}/tstclnt -4 -p ${PORT} -h ${HOSTADDR} -f ${CLIENT_OPTIONS} \
+ ${PROFTOOL} ${BINDIR}/tstclnt -p ${PORT} -h ${HOSTADDR} -f ${CLIENT_OPTIONS} \
-d ${P_R_CLIENTDIR} $verbose -c v -T -O -F -M 1 -V ssl3:tls1.2 < ${REQUEST_FILE} \
>${TMP}/$HOST.tmp.$$ 2>&1
ret=$?
@@ -467,7 +465,7 @@ ssl_stapling_stress()
########################################################################
ssl_stapling()
{
- html_head "SSL Cert Status (OCSP Stapling) $NORM_EXT - server $SERVER_MODE/client $CLIENT_MODE"
+ html_head "SSL Cert Status (OCSP Stapling) $NORM_EXT - server $SERVER_MODE/client $CLIENT_MODE $ECC_STRING"
# tstclnt Exit code:
# 0: have fresh and valid revocation data, status good
@@ -500,7 +498,7 @@ ssl_stapling()
ssl_signed_cert_timestamps()
{
#verbose="-v"
- html_head "SSL Signed Certificate Timestamps $NORM_EXT - server $SERVER_MODE/client $CLIENT_MODE"
+ html_head "SSL Signed Certificate Timestamps $NORM_EXT - server $SERVER_MODE/client $CLIENT_MODE $ECC_STRING"
testname="ssl_signed_cert_timestamps"
value=0
@@ -516,10 +514,10 @@ ssl_signed_cert_timestamps()
# Since we don't have server-side support, this test only covers advertising the
# extension in the client hello.
- echo "tstclnt -4 -p ${PORT} -h ${HOSTADDR} -f -d ${P_R_CLIENTDIR} $verbose ${CLIENT_OPTIONS} \\"
+ echo "tstclnt -p ${PORT} -h ${HOSTADDR} -f -d ${P_R_CLIENTDIR} $verbose ${CLIENT_OPTIONS} \\"
echo " -U -V tls1.0:tls1.2 < ${REQUEST_FILE}"
rm ${TMP}/$HOST.tmp.$$ 2>/dev/null
- ${PROFTOOL} ${BINDIR}/tstclnt -4 -p ${PORT} -h ${HOSTADDR} -f ${CLIENT_OPTIONS} \
+ ${PROFTOOL} ${BINDIR}/tstclnt -p ${PORT} -h ${HOSTADDR} -f ${CLIENT_OPTIONS} \
-d ${P_R_CLIENTDIR} $verbose -U -V tls1.0:tls1.2 < ${REQUEST_FILE} \
>${TMP}/$HOST.tmp.$$ 2>&1
ret=$?
@@ -538,26 +536,26 @@ ssl_signed_cert_timestamps()
########################################################################
ssl_stress()
{
- html_head "SSL Stress Test $NORM_EXT - server $SERVER_MODE/client $CLIENT_MODE"
+ html_head "SSL Stress Test $NORM_EXT - server $SERVER_MODE/client $CLIENT_MODE $ECC_STRING"
- ignore_blank_lines ${SSLSTRESS} | \
+ exec < ${SSLSTRESS}
while read ectype value sparam cparam testname
do
+ if [ -z "$ectype" ]; then
+ # silently ignore blank lines
+ continue
+ fi
+
echo "${testname}" | grep "client auth" > /dev/null
CAUTH=$?
- echo "${testname}" | grep "no login" > /dev/null
- NOLOGIN=$?
if [ "$ectype" = "SNI" -a "$NORM_EXT" = "Extended Test" ] ; then
echo "$SCRIPTNAME: skipping $testname for $NORM_EXT"
- elif [ "$ectype" = "ECC" ] ; then
+ elif [ "$ectype" = "ECC" -a -n "$NSS_DISABLE_ECC" ] ; then
echo "$SCRIPTNAME: skipping $testname (ECC only)"
elif [ "${CLIENT_MODE}" = "fips" -a "${CAUTH}" -ne 0 ] ; then
echo "$SCRIPTNAME: skipping $testname (non-FIPS only)"
- elif [ "${NOLOGIN}" -eq 0 ] && \
- [ "${CLIENT_MODE}" = "fips" -o "$NORM_EXT" = "Extended Test" ] ; then
- echo "$SCRIPTNAME: skipping $testname for $NORM_EXT"
- else
+ elif [ "`echo $ectype | cut -b 1`" != "#" ]; then
cparam=`echo $cparam | sed -e 's;_; ;g' -e "s/TestUser/$USER_NICKNAME/g" `
if [ "$ectype" = "SNI" ]; then
cparam=`echo $cparam | sed -e "s/Host/$HOST/g" -e "s/Dom/$DOMSUF/g" `
@@ -571,16 +569,10 @@ ssl_stress()
ps -ef | grep selfserv
fi
- if [ "${NOLOGIN}" -eq 0 ] ; then
- dbdir=${P_R_NOLOGINDIR}
- else
- dbdir=${P_R_CLIENTDIR}
- fi
-
- echo "strsclnt -q -p ${PORT} -d ${dbdir} ${CLIENT_OPTIONS} -w nss $cparam \\"
+ echo "strsclnt -q -p ${PORT} -d ${P_R_CLIENTDIR} ${CLIENT_OPTIONS} -w nss $cparam \\"
echo " -V ssl3:tls1.2 $verbose ${HOSTADDR}"
echo "strsclnt started at `date`"
- ${PROFTOOL} ${BINDIR}/strsclnt -q -p ${PORT} -d ${dbdir} ${CLIENT_OPTIONS} -w nss $cparam \
+ ${PROFTOOL} ${BINDIR}/strsclnt -q -p ${PORT} -d ${P_R_CLIENTDIR} ${CLIENT_OPTIONS} -w nss $cparam \
-V ssl3:tls1.2 $verbose ${HOSTADDR}
ret=$?
echo "strsclnt completed at `date`"
@@ -604,7 +596,7 @@ ssl_stress()
ssl_crl_ssl()
{
#verbose="-v"
- html_head "CRL SSL Client Tests $NORM_EXT"
+ html_head "CRL SSL Client Tests $NORM_EXT $ECC_STRING"
# Using First CRL Group for this test. There are $CRL_GRP_1_RANGE certs in it.
# Cert number $UNREVOKED_CERT_GRP_1 was not revoked
@@ -612,14 +604,15 @@ ssl_crl_ssl()
CRL_GROUP_RANGE=$CRL_GRP_1_RANGE
UNREVOKED_CERT=$UNREVOKED_CERT_GRP_1
- ignore_blank_lines ${SSLAUTH} | \
+ exec < ${SSLAUTH}
while read ectype value sparam cparam testname
do
- if [ "$ectype" = "ECC" ] ; then
+ [ "$ectype" = "" ] && continue
+ if [ "$ectype" = "ECC" -a -n "$NSS_DISABLE_ECC" ] ; then
echo "$SCRIPTNAME: skipping $testname (ECC only)"
elif [ "$ectype" = "SNI" ]; then
continue
- else
+ elif [ "`echo $ectype | cut -b 1`" != "#" ]; then
servarg=`echo $sparam | awk '{r=split($0,a,"-r") - 1;print r;}'`
pwd=`echo $cparam | grep nss`
user=`echo $cparam | grep TestUser`
@@ -649,10 +642,10 @@ ssl_crl_ssl()
cparam=`echo $_cparam | sed -e 's;_; ;g' -e "s/TestUser/$USER_NICKNAME/g" `
start_selfserv
- echo "tstclnt -4 -p ${PORT} -h ${HOSTADDR} -f -d ${R_CLIENTDIR} $verbose \\"
+ echo "tstclnt -p ${PORT} -h ${HOSTADDR} -f -d ${R_CLIENTDIR} $verbose \\"
echo " ${cparam} < ${REQUEST_FILE}"
rm ${TMP}/$HOST.tmp.$$ 2>/dev/null
- ${PROFTOOL} ${BINDIR}/tstclnt -4 -p ${PORT} -h ${HOSTADDR} -f ${cparam} \
+ ${PROFTOOL} ${BINDIR}/tstclnt -p ${PORT} -h ${HOSTADDR} -f ${cparam} \
-d ${R_CLIENTDIR} $verbose < ${REQUEST_FILE} \
>${TMP}/$HOST.tmp.$$ 2>&1
ret=$?
@@ -676,47 +669,19 @@ ssl_crl_ssl()
html "</TABLE><BR>"
}
-############################# setup_policy #############################
-# local shell function to create policy configuration
-########################################################################
-setup_policy()
-{
- policy="$1"
- outdir="$2"
- OUTFILE="${outdir}/pkcs11.txt"
- cat > "$OUTFILE" << ++EOF++
-library=
-name=NSS Internal PKCS #11 Module
-parameters=configdir='./client' certPrefix='' keyPrefix='' secmod='secmod.db' flags= updatedir='' updateCertPrefix='' updateKeyPrefix='' updateid='' updateTokenDescription=''
-NSS=Flags=internal,critical trustOrder=75 cipherOrder=100 slotParams=(1={slotFlags=[RSA,DSA,DH,RC2,RC4,DES,RANDOM,SHA1,MD5,MD2,SSL,TLS,AES,Camellia,SEED,SHA256,SHA512] askpw=any timeout=30})
-++EOF++
- echo "config=${policy}" >> "$OUTFILE"
- echo "" >> "$OUTFILE"
- echo "library=${DIST}/${OBJDIR}/lib/libnssckbi.so" >> "$OUTFILE"
- cat >> "$OUTFILE" << ++EOF++
-name=RootCerts
-NSS=trustOrder=100
-++EOF++
-
- echo "******************************Testing with: "
- cat "$OUTFILE"
- echo "******************************"
-}
-
-############################## ssl_policy ##############################
+############################## ssl_cov #################################
# local shell function to perform SSL Policy tests
########################################################################
ssl_policy()
{
#verbose="-v"
- html_head "SSL POLICY $NORM_EXT - server $SERVER_MODE/client $CLIENT_MODE"
+ html_head "SSL POLICY $NORM_EXT - server $SERVER_MODE/client $CLIENT_MODE $ECC_STRING"
testname=""
sparam="$CIPHER_SUITES"
if [ ! -f "${P_R_CLIENTDIR}/pkcs11.txt" ] ; then
- html_failed "${SCRIPTNAME}: ${P_R_CLIENTDIR} is not initialized"
- return 1;
+ return;
fi
echo "Saving pkcs11.txt"
@@ -724,14 +689,17 @@ ssl_policy()
start_selfserv # Launch the server
- ignore_blank_lines ${SSLPOLICY} | \
+ VMIN="ssl3"
+ VMAX="tls1.2"
+
+ exec < ${SSLPOLICY}
while read value ectype testmax param policy testname
do
VMIN="ssl3"
- if [ "$ectype" = "ECC" ] ; then
+ if [ "$ectype" = "ECC" -a -n "$NSS_DISABLE_ECC" ] ; then
echo "$SCRIPTNAME: skipping $testname (ECC only)"
- else
+ elif [ "`echo $value | cut -b 1`" != "#" ] ; then
echo "$SCRIPTNAME: running $testname ----------------------------"
VMAX="ssl3"
if [ "$testmax" = "TLS10" ]; then
@@ -746,13 +714,30 @@ ssl_policy()
# load the policy
policy=`echo ${policy} | sed -e 's;_; ;g'`
- setup_policy "$policy" ${P_R_CLIENTDIR}
- echo "tstclnt -4 -p ${PORT} -h ${HOSTADDR} -c ${param} -V ${VMIN}:${VMAX} ${CLIENT_OPTIONS} \\"
+ cat > ${P_R_CLIENTDIR}/pkcs11.txt << ++EOF++
+library=
+name=NSS Internal PKCS #11 Module
+parameters=configdir='./client' certPrefix='' keyPrefix='' secmod='secmod.db' flags= updatedir='' updateCertPrefix='' updateKeyPrefix='' updateid='' updateTokenDescription=''
+NSS=Flags=internal,critical trustOrder=75 cipherOrder=100 slotParams=(1={slotFlags=[RSA,DSA,DH,RC2,RC4,DES,RANDOM,SHA1,MD5,MD2,SSL,TLS,AES,Camellia,SEED,SHA256,SHA512] askpw=any timeout=30})
+++EOF++
+ echo "config=${policy}" >> ${P_R_CLIENTDIR}/pkcs11.txt
+ echo "" >> ${P_R_CLIENTDIR}/pkcs11.txt
+ echo "library=${DIST}/${OBJDIR}/lib/libnssckbi.so" >> ${P_R_CLIENTDIR}/pkcs11.txt >> ${P_R_CLIENTDIR}/pkcs11.txt
+ cat >> ${P_R_CLIENTDIR}/pkcs11.txt << ++EOF++
+name=RootCerts
+NSS=trustOrder=100
+++EOF++
+
+ echo "******************************Testing with: "
+ cat ${P_R_CLIENTDIR}/pkcs11.txt
+ echo "******************************"
+
+ echo "tstclnt -p ${PORT} -h ${HOSTADDR} -c ${param} -V ${VMIN}:${VMAX} ${CLIENT_OPTIONS} \\"
echo " -f -d ${P_R_CLIENTDIR} $verbose -w nss < ${REQUEST_FILE}"
rm ${TMP}/$HOST.tmp.$$ 2>/dev/null
- ${PROFTOOL} ${BINDIR}/tstclnt -4 -p ${PORT} -h ${HOSTADDR} -c ${param} -V ${VMIN}:${VMAX} ${CLIENT_OPTIONS} -f \
+ ${PROFTOOL} ${BINDIR}/tstclnt -p ${PORT} -h ${HOSTADDR} -c ${param} -V ${VMIN}:${VMAX} ${CLIENT_OPTIONS} -f \
-d ${P_R_CLIENTDIR} $verbose -w nss < ${REQUEST_FILE} \
>${TMP}/$HOST.tmp.$$ 2>&1
ret=$?
@@ -772,103 +757,6 @@ ssl_policy()
kill_selfserv
html "</TABLE><BR>"
}
-
-list_enabled_suites()
-{
- echo "SSL_DIR=${P_R_CLIENTDIR} ${BINDIR}/listsuites"
- SSL_DIR="${P_R_CLIENTDIR}" ${BINDIR}/listsuites | tail -n+3 | \
- sed -n -e '/^TLS_/h' -e '/^ .*Enabled.*/{g;p}' | sed 's/:$//'
-}
-
-############################## ssl_policy_listsuites ###################
-# local shell function to perform SSL Policy tests, using listsuites
-########################################################################
-ssl_policy_listsuites()
-{
- #verbose="-v"
- html_head "SSL POLICY LISTSUITES $NORM_EXT - server $SERVER_MODE/client $CLIENT_MODE"
-
- testname=""
- sparam="$CIPHER_SUITES"
-
- if [ ! -f "${P_R_CLIENTDIR}/pkcs11.txt" ] ; then
- html_failed "${SCRIPTNAME}: ${P_R_CLIENTDIR} is not initialized"
- return 1;
- fi
-
- echo "Saving pkcs11.txt"
- cp ${P_R_CLIENTDIR}/pkcs11.txt ${P_R_CLIENTDIR}/pkcs11.txt.sav
-
- # Disallow all explicitly
- setup_policy "disallow=all" ${P_R_CLIENTDIR}
- RET_EXP=1
- list_enabled_suites | grep '^TLS_'
- RET=$?
- html_msg $RET $RET_EXP "${testname}" \
- "produced a returncode of $RET, expected is $RET_EXP"
-
- # Disallow RSA in key exchange explicitly
- setup_policy "disallow=rsa/ssl-key-exchange" ${P_R_CLIENTDIR}
- RET_EXP=1
- list_enabled_suites | grep '^TLS_RSA_'
- RET=$?
- html_msg $RET $RET_EXP "${testname}" \
- "produced a returncode of $RET, expected is $RET_EXP"
-
- cp ${P_R_CLIENTDIR}/pkcs11.txt.sav ${P_R_CLIENTDIR}/pkcs11.txt
-
- html "</TABLE><BR>"
-}
-
-############################## ssl_policy_selfserv #####################
-# local shell function to perform SSL Policy tests, using selfserv
-########################################################################
-ssl_policy_selfserv()
-{
- #verbose="-v"
- html_head "SSL POLICY SELFSERV $NORM_EXT - server $SERVER_MODE/client $CLIENT_MODE"
-
- testname=""
- sparam="$CIPHER_SUITES"
-
- if [ ! -f "${P_R_SERVERDIR}/pkcs11.txt" ] ; then
- html_failed "${SCRIPTNAME}: ${P_R_SERVERDIR} is not initialized"
- return 1;
- fi
-
- echo "Saving pkcs11.txt"
- cp ${P_R_SERVERDIR}/pkcs11.txt ${P_R_SERVERDIR}/pkcs11.txt.sav
-
- # Disallow RSA in key exchange explicitly
- setup_policy "disallow=rsa/ssl-key-exchange" ${P_R_SERVERDIR}
-
- start_selfserv # Launch the server
-
- VMIN="ssl3"
- VMAX="tls1.2"
-
- # Try to connect to the server with a ciphersuite using RSA in key exchange
- echo "tstclnt -4 -p ${PORT} -h ${HOSTADDR} -c d -V ${VMIN}:${VMAX} ${CLIENT_OPTIONS} \\"
- echo " -f -d ${P_R_CLIENTDIR} $verbose -w nss < ${REQUEST_FILE}"
-
- rm ${TMP}/$HOST.tmp.$$ 2>/dev/null
- RET_EXP=254
- ${PROFTOOL} ${BINDIR}/tstclnt -4 -p ${PORT} -h ${HOSTADDR} -c d -V ${VMIN}:${VMAX} ${CLIENT_OPTIONS} -f \
- -d ${P_R_CLIENTDIR} $verbose -w nss < ${REQUEST_FILE} \
- >${TMP}/$HOST.tmp.$$ 2>&1
- RET=$?
- cat ${TMP}/$HOST.tmp.$$
- rm ${TMP}/$HOST.tmp.$$ 2>/dev/null
-
- html_msg $RET $RET_EXP "${testname}" \
- "produced a returncode of $RET, expected is $RET_EXP"
-
- cp ${P_R_SERVERDIR}/pkcs11.txt.sav ${P_R_SERVERDIR}/pkcs11.txt
-
- kill_selfserv
- html "</TABLE><BR>"
-}
-
############################# is_revoked ###############################
# local shell function to check if certificate is revoked
########################################################################
@@ -938,7 +826,7 @@ load_group_crl() {
fi
echo "================= Reloading ${eccomment}CRL for group $grpBegin - $grpEnd ============="
- echo "tstclnt -4 -p ${PORT} -h ${HOSTADDR} -f -d ${R_CLIENTDIR} $verbose \\"
+ echo "tstclnt -p ${PORT} -h ${HOSTADDR} -f -d ${R_CLIENTDIR} $verbose \\"
echo " -V ssl3:tls1.2 -w nss -n TestUser${UNREVOKED_CERT_GRP_1}${ecsuffix}"
echo "Request:"
echo "GET crl://${SERVERDIR}/root.crl_${grpBegin}-${grpEnd}${ecsuffix}"
@@ -951,7 +839,7 @@ GET crl://${SERVERDIR}/root.crl_${grpBegin}-${grpEnd}${ecsuffix}
_EOF_REQUEST_
- ${PROFTOOL} ${BINDIR}/tstclnt -4 -p ${PORT} -h ${HOSTADDR} -f \
+ ${PROFTOOL} ${BINDIR}/tstclnt -p ${PORT} -h ${HOSTADDR} -f \
-d ${R_CLIENTDIR} $verbose -V ssl3:tls1.2 -w nss -n TestUser${UNREVOKED_CERT_GRP_1}${ecsuffix} \
>${OUTFILE_TMP} 2>&1 < ${REQF}
@@ -988,7 +876,7 @@ _EOF_REQUEST_
ssl_crl_cache()
{
#verbose="-v"
- html_head "Cache CRL SSL Client Tests $NORM_EXT"
+ html_head "Cache CRL SSL Client Tests $NORM_EXT $ECC_STRING"
SSLAUTH_TMP=${TMP}/authin.tl.tmp
SERV_ARG=-r_-r
rm -f ${SSLAUTH_TMP}
@@ -1004,7 +892,7 @@ ssl_crl_cache()
while read ectype value sparam cparam testname
do
[ "$ectype" = "" ] && continue
- if [ "$ectype" = "ECC" ] ; then
+ if [ "$ectype" = "ECC" -a -n "$NSS_DISABLE_ECC" ] ; then
echo "$SCRIPTNAME: skipping $testname (ECC only)"
elif [ "$ectype" = "SNI" ]; then
continue
@@ -1042,10 +930,10 @@ ssl_crl_cache()
cparam=`echo $_cparam | sed -e 's;_; ;g' -e "s/TestUser/$USER_NICKNAME/g" `
echo "Server Args: $SERV_ARG"
- echo "tstclnt -4 -p ${PORT} -h ${HOSTADDR} -f -d ${R_CLIENTDIR} $verbose \\"
+ echo "tstclnt -p ${PORT} -h ${HOSTADDR} -f -d ${R_CLIENTDIR} $verbose \\"
echo " ${cparam} < ${REQUEST_FILE}"
rm ${TMP}/$HOST.tmp.$$ 2>/dev/null
- ${PROFTOOL} ${BINDIR}/tstclnt -4 -p ${PORT} -h ${HOSTADDR} -f ${cparam} \
+ ${PROFTOOL} ${BINDIR}/tstclnt -p ${PORT} -h ${HOSTADDR} -f ${cparam} \
-d ${R_CLIENTDIR} $verbose < ${REQUEST_FILE} \
>${TMP}/$HOST.tmp.$$ 2>&1
ret=$?
@@ -1097,47 +985,6 @@ ssl_crl_cache()
html "</TABLE><BR>"
}
-############################ ssl_dtls ###################################
-# local shell function to test tstclnt acting as client and server for DTLS
-#########################################################################
-ssl_dtls()
-{
- #verbose="-v"
- html_head "SSL DTLS $NORM_EXT - server $SERVER_MODE/client $CLIENT_MODE"
-
- testname="ssl_dtls"
- value=0
-
- if [ "$SERVER_MODE" = "fips" -o "$CLIENT_MODE" = "fips" ] ; then
- echo "$SCRIPTNAME: skipping $testname (non-FIPS only)"
- return 0
- fi
-
- echo "${testname}"
-
- echo "tstclnt -4 -p ${PORT} -h ${HOSTADDR} -f -d ${P_R_SERVERDIR} $verbose ${SERVER_OPTIONS} \\"
- echo " -U -V tls1.1:tls1.2 -P server -Q < ${REQUEST_FILE} &"
-
- ${PROFTOOL} ${BINDIR}/tstclnt -4 -p ${PORT} -h ${HOSTADDR} -f ${SERVER_OPTIONS} \
- -d ${P_R_SERVERDIR} $verbose -U -V tls1.1:tls1.2 -P server -n ${HOSTADDR} -w nss < ${REQUEST_FILE} 2>&1 &
-
- PID=$!
-
- sleep 1
-
- echo "tstclnt -4 -p ${PORT} -h ${HOSTADDR} -f -d ${P_R_CLIENTDIR} $verbose ${CLIENT_OPTIONS} \\"
- echo " -U -V tls1.1:tls1.2 -P client -Q < ${REQUEST_FILE}"
- ${PROFTOOL} ${BINDIR}/tstclnt -4 -p ${PORT} -h ${HOSTADDR} -f ${CLIENT_OPTIONS} \
- -d ${P_R_CLIENTDIR} $verbose -U -V tls1.1:tls1.2 -P client -Q < ${REQUEST_FILE} 2>&1
- ret=$?
- html_msg $ret $value "${testname}" \
- "produced a returncode of $ret, expected is $value"
-
- kill ${PID}
-
- html "</TABLE><BR>"
-}
-
############################## ssl_cleanup #############################
# local shell function to finish this script (no exit since it might be
@@ -1175,9 +1022,6 @@ ssl_run()
"stress")
ssl_stress
;;
- "dtls")
- ssl_dtls
- ;;
esac
done
}
@@ -1299,9 +1143,7 @@ ssl_run_tests()
case "${SSL_TEST}" in
"policy")
if [ "${TEST_MODE}" = "SHARED_DB" ] ; then
- ssl_policy_listsuites
- ssl_policy_selfserv
- ssl_policy
+ ssl_policy
fi
;;
"crl")
@@ -1324,8 +1166,8 @@ ssl_run_tests()
ssl_set_fips server on
;;
*)
- html_failed "${SCRIPTNAME}: Error: Unknown server mode ${SERVER_MODE}"
- return 1
+ echo "${SCRIPTNAME}: Error: Unknown server mode ${SERVER_MODE}"
+ continue
;;
esac
@@ -1338,8 +1180,8 @@ ssl_run_tests()
ssl_set_fips client on
;;
*)
- html_failed "${SCRIPTNAME}: Error: Unknown client mode ${CLIENT_MODE}"
- return 1
+ echo "${SCRIPTNAME}: Error: Unknown client mode ${CLIENT_MODE}"
+ continue
;;
esac
diff --git a/security/nss/tests/ssl/sslstress.txt b/security/nss/tests/ssl/sslstress.txt
index a87eedad72..e9defc502e 100644
--- a/security/nss/tests/ssl/sslstress.txt
+++ b/security/nss/tests/ssl/sslstress.txt
@@ -21,7 +21,6 @@
# add client auth versions here...
#
noECC 0 -r_-r -c_100_-C_c_-V_ssl3:ssl3_-N_-n_TestUser Stress SSL3 RC4 128 with MD5 (no reuse, client auth)
- noECC 0 -r_-r -c_100_-C_c_-V_ssl3:ssl3_-N_-n_TestUser Stress SSL3 RC4 128 with MD5 (no reuse, client auth, no login)
noECC 0 -r_-r -c_100_-C_c_-N_-n_TestUser Stress TLS RC4 128 with MD5 (no reuse, client auth)
noECC 0 -r_-r_-u -V_ssl3:tls1.2_-c_100_-C_c_-n_TestUser_-u Stress TLS RC4 128 with MD5 (session ticket, client auth)
noECC 0 -r_-r_-z -V_ssl3:tls1.2_-c_100_-C_c_-n_TestUser_-z Stress TLS RC4 128 with MD5 (compression, client auth)
diff --git a/security/nss/tests/ssl_gtests/ssl_gtests.sh b/security/nss/tests/ssl_gtests/ssl_gtests.sh
index fd678bf594..ac39f212ce 100755
--- a/security/nss/tests/ssl_gtests/ssl_gtests.sh
+++ b/security/nss/tests/ssl_gtests/ssl_gtests.sh
@@ -21,17 +21,16 @@
# Generate input to certutil
certscript() {
- ca=n
while [ $# -gt 0 ]; do
case $1 in
sign) echo 0 ;;
kex) echo 2 ;;
- ca) echo 5;echo 6;ca=y ;;
+ ca) echo 5;echo 6 ;;
esac; shift
done;
echo 9
echo n
- echo $ca
+ echo ${ca:-n}
echo
echo n
}
@@ -42,7 +41,6 @@ certscript() {
make_cert() {
name=$1
type=$2
- unset type_args trust sign
case $type in
dsa) type_args='-g 1024' ;;
rsa) type_args='-g 1024' ;;
@@ -51,11 +49,8 @@ make_cert() {
p256) type_args='-q nistp256';type=ec ;;
p384) type_args='-q secp384r1';type=ec ;;
p521) type_args='-q secp521r1';type=ec ;;
- rsa_ca) type_args='-g 1024';trust='CT,CT,CT';type=rsa ;;
+ rsa_ca) type_args='-g 1024';trust='CT,CT,CT';ca=y;type=rsa ;;
rsa_chain) type_args='-g 1024';sign='-c rsa_ca';type=rsa;;
- rsapss_ca) type_args='-g 1024 --pss';trust='CT,CT,CT';type=rsa ;;
- rsapss_chain) type_args='-g 1024';sign='-c rsa_pss_ca';type=rsa;;
- rsa_ca_rsapss_chain) type_args='-g 1024 --pss-sign';sign='-c rsa_ca';type=rsa;;
ecdh_rsa) type_args='-q nistp256';sign='-c rsa_ca';type=ec ;;
esac
shift 2
@@ -92,9 +87,6 @@ ssl_gtest_certs() {
make_cert ecdh_ecdsa p256 kex
make_cert rsa_ca rsa_ca ca
make_cert rsa_chain rsa_chain sign
- make_cert rsa_pss_ca rsapss_ca ca
- make_cert rsa_pss_chain rsapss_chain sign
- make_cert rsa_ca_rsa_pss_chain rsa_ca_rsapss_chain sign
make_cert ecdh_rsa ecdh_rsa kex
make_cert dsa dsa sign
}
diff --git a/security/nss/tests/tools/TestOldAES128CA.p12 b/security/nss/tests/tools/TestOldAES128CA.p12
deleted file mode 100644
index a05be8bdeb..0000000000
--- a/security/nss/tests/tools/TestOldAES128CA.p12
+++ /dev/null
Binary files differ
diff --git a/security/nss/tests/tools/TestOldCA.p12 b/security/nss/tests/tools/TestOldCA.p12
deleted file mode 100644
index 40d5671b9d..0000000000
--- a/security/nss/tests/tools/TestOldCA.p12
+++ /dev/null
Binary files differ
diff --git a/security/nss/tests/tools/tools.sh b/security/nss/tests/tools/tools.sh
index 11be23e051..769bafa00d 100644
--- a/security/nss/tests/tools/tools.sh
+++ b/security/nss/tests/tools/tools.sh
@@ -76,7 +76,11 @@ tools_init()
fi
SCRIPTNAME=tools.sh
- html_head "Tools Tests"
+ if [ -z "$NSS_DISABLE_ECC" ] ; then
+ html_head "Tools Tests with ECC"
+ else
+ html_head "Tools Tests"
+ fi
grep "SUCCESS: SMIME passed" $CERT_LOG_FILE >/dev/null || {
Exit 15 "Fatal - S/MIME of cert.sh needs to pass first"
@@ -102,9 +106,6 @@ tools_init()
cp ${ALICEDIR}/* ${SIGNDIR}/
mkdir -p ${TOOLSDIR}/html
cp ${QADIR}/tools/sign*.html ${TOOLSDIR}/html
- mkdir -p ${TOOLSDIR}/data
- cp ${QADIR}/tools/TestOldCA.p12 ${TOOLSDIR}/data
- cp ${QADIR}/tools/TestOldAES128CA.p12 ${TOOLSDIR}/data
cd ${TOOLSDIR}
}
@@ -396,44 +397,30 @@ tools_p12_export_list_import_with_default_ciphers()
export_list_import "DEFAULT" "DEFAULT"
- echo "$SCRIPTNAME: Exporting Alice's email EC cert & key---------------"
- echo "pk12util -o Alice-ec.p12 -n \"Alice-ec\" -d ${P_R_ALICEDIR} -k ${R_PWFILE} \\"
- echo " -w ${R_PWFILE}"
- ${BINDIR}/pk12util -o Alice-ec.p12 -n "Alice-ec" -d ${P_R_ALICEDIR} -k ${R_PWFILE} \
- -w ${R_PWFILE} 2>&1
- ret=$?
- html_msg $ret 0 "Exporting Alice's email EC cert & key (pk12util -o)"
- check_tmpfile
-
- echo "$SCRIPTNAME: Importing Alice's email EC cert & key --------------"
- echo "pk12util -i Alice-ec.p12 -d ${P_R_COPYDIR} -k ${R_PWFILE} -w ${R_PWFILE}"
- ${BINDIR}/pk12util -i Alice-ec.p12 -d ${P_R_COPYDIR} -k ${R_PWFILE} -w ${R_PWFILE} 2>&1
- ret=$?
- html_msg $ret 0 "Importing Alice's email EC cert & key (pk12util -i)"
- check_tmpfile
-
- echo "$SCRIPTNAME: Listing Alice's pk12 EC file -----------------"
- echo "pk12util -l Alice-ec.p12 -w ${R_PWFILE}"
- ${BINDIR}/pk12util -l Alice-ec.p12 -w ${R_PWFILE} 2>&1
- ret=$?
- html_msg $ret 0 "Listing Alice's pk12 EC file (pk12util -l)"
- check_tmpfile
-}
-
-tools_p12_import_old_files()
-{
- echo "$SCRIPTNAME: Importing PKCS#12 files created with older NSS --------------"
- echo "pk12util -i TestOldCA.p12 -d ${P_R_COPYDIR} -k ${R_PWFILE} -w ${R_PWFILE}"
- ${BINDIR}/pk12util -i ${TOOLSDIR}/data/TestOldCA.p12 -d ${P_R_COPYDIR} -k ${R_PWFILE} -w ${R_PWFILE} 2>&1
- ret=$?
- html_msg $ret 0 "Importing PKCS#12 file created with NSS 3.21 (PBES2 with BMPString password)"
- check_tmpfile
-
- echo "pk12util -i TestOldAES128CA.p12 -d ${P_R_COPYDIR} -k ${R_PWFILE} -w ${R_PWFILE}"
- ${BINDIR}/pk12util -i ${TOOLSDIR}/data/TestOldAES128CA.p12 -d ${P_R_COPYDIR} -k ${R_PWFILE} -w ${R_PWFILE} 2>&1
- ret=$?
- html_msg $ret 0 "Importing PKCS#12 file created with NSS 3.29.5 (PBES2 with incorrect AES-128-CBC algorithm ID)"
- check_tmpfile
+ if [ -z "$NSS_DISABLE_ECC" ] ; then
+ echo "$SCRIPTNAME: Exporting Alice's email EC cert & key---------------"
+ echo "pk12util -o Alice-ec.p12 -n \"Alice-ec\" -d ${P_R_ALICEDIR} -k ${R_PWFILE} \\"
+ echo " -w ${R_PWFILE}"
+ ${BINDIR}/pk12util -o Alice-ec.p12 -n "Alice-ec" -d ${P_R_ALICEDIR} -k ${R_PWFILE} \
+ -w ${R_PWFILE} 2>&1
+ ret=$?
+ html_msg $ret 0 "Exporting Alice's email EC cert & key (pk12util -o)"
+ check_tmpfile
+
+ echo "$SCRIPTNAME: Importing Alice's email EC cert & key --------------"
+ echo "pk12util -i Alice-ec.p12 -d ${P_R_COPYDIR} -k ${R_PWFILE} -w ${R_PWFILE}"
+ ${BINDIR}/pk12util -i Alice-ec.p12 -d ${P_R_COPYDIR} -k ${R_PWFILE} -w ${R_PWFILE} 2>&1
+ ret=$?
+ html_msg $ret 0 "Importing Alice's email EC cert & key (pk12util -i)"
+ check_tmpfile
+
+ echo "$SCRIPTNAME: Listing Alice's pk12 EC file -----------------"
+ echo "pk12util -l Alice-ec.p12 -w ${R_PWFILE}"
+ ${BINDIR}/pk12util -l Alice-ec.p12 -w ${R_PWFILE} 2>&1
+ ret=$?
+ html_msg $ret 0 "Listing Alice's pk12 EC file (pk12util -l)"
+ check_tmpfile
+ fi
}
############################## tools_p12 ###############################
@@ -447,7 +434,6 @@ tools_p12()
tools_p12_export_list_import_all_pkcs12v2pbe_ciphers
tools_p12_export_with_none_ciphers
tools_p12_export_with_invalid_ciphers
- tools_p12_import_old_files
}
############################## tools_sign ##############################
@@ -517,21 +503,6 @@ SIGNSCRIPT
}
-tools_modutil()
-{
- echo "$SCRIPTNAME: Test if DB created by modutil -create is initialized"
- mkdir -p ${R_TOOLSDIR}/moddir
- # copied from modu function in cert.sh
- # echo is used to press Enter expected by modutil
- echo | ${BINDIR}/modutil -create -dbdir "${R_TOOLSDIR}/moddir" 2>&1
- ret=$?
- ${BINDIR}/certutil -S -s 'CN=TestUser' -d "${TOOLSDIR}/moddir" -n TestUser \
- -x -t ',,' -z "${R_NOISE_FILE}"
- ret=$?
- html_msg $ret 0 "Test if DB created by modutil -create is initialized"
- check_tmpfile
-}
-
############################## tools_cleanup ###########################
# local shell function to finish this script (no exit since it might be
# sourced)
@@ -548,7 +519,6 @@ tools_cleanup()
tools_init
tools_p12
tools_sign
-tools_modutil
tools_cleanup
diff --git a/security/sandbox/linux/glue/SandboxCrash.cpp b/security/sandbox/linux/glue/SandboxCrash.cpp
index 87a75e8452..8ead16bdf2 100644
--- a/security/sandbox/linux/glue/SandboxCrash.cpp
+++ b/security/sandbox/linux/glue/SandboxCrash.cpp
@@ -18,9 +18,6 @@
#include "mozilla/Unused.h"
#include "mozilla/dom/Exceptions.h"
#include "nsContentUtils.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
#include "mozilla/StackWalk.h"
#include "nsString.h"
#include "nsThreadUtils.h"
@@ -109,9 +106,6 @@ SandboxCrash(int nr, siginfo_t *info, void *void_context)
pid_t pid = getpid(), tid = syscall(__NR_gettid);
bool dumped = false;
-#ifdef MOZ_CRASHREPORTER
- dumped = CrashReporter::WriteMinidumpForSigInfo(nr, info, void_context);
-#endif
if (!dumped) {
SANDBOX_LOG_ERROR("crash reporter is disabled (or failed);"
" trying stack trace:");
diff --git a/services/fxaccounts/tests/xpcshell/test_oauth_grant_client.js b/services/fxaccounts/tests/xpcshell/test_oauth_grant_client.js
index 244b79a5ee..710a65ee56 100644
--- a/services/fxaccounts/tests/xpcshell/test_oauth_grant_client.js
+++ b/services/fxaccounts/tests/xpcshell/test_oauth_grant_client.js
@@ -143,7 +143,7 @@ add_test(function serverErrorResponse () {
add_test(function networkErrorResponse () {
let client = new FxAccountsOAuthGrantClient({
- serverURL: "http://",
+ serverURL: "http://domain.dummy",
client_id: "abc123"
});
Services.prefs.setBoolPref("identity.fxaccounts.skipDeviceRegistration", true);
diff --git a/services/fxaccounts/tests/xpcshell/test_profile_client.js b/services/fxaccounts/tests/xpcshell/test_profile_client.js
index 2243da3aab..20ff6efc61 100644
--- a/services/fxaccounts/tests/xpcshell/test_profile_client.js
+++ b/services/fxaccounts/tests/xpcshell/test_profile_client.js
@@ -268,7 +268,7 @@ add_test(function server401ResponsePersists () {
add_test(function networkErrorResponse () {
let client = new FxAccountsProfileClient({
- serverURL: "http://",
+ serverURL: "http://domain.dummy",
fxa: mockFxa,
});
client.fetchProfile()
diff --git a/services/sync/tests/unit/test_service_login.js b/services/sync/tests/unit/test_service_login.js
index 42c163915f..2ecb0a377b 100644
--- a/services/sync/tests/unit/test_service_login.js
+++ b/services/sync/tests/unit/test_service_login.js
@@ -206,7 +206,7 @@ add_test(function test_login_on_sync() {
_("Old passphrase function is " + oldGetter);
Service.identity.__defineGetter__("syncKey",
function() {
- throw "User canceled Master Password entry";
+ throw "User canceled master password entry";
});
let oldClearSyncTriggers = Service.scheduler.clearSyncTriggers;
diff --git a/services/sync/tests/unit/test_syncscheduler.js b/services/sync/tests/unit/test_syncscheduler.js
index b066eae827..730a3f996d 100644
--- a/services/sync/tests/unit/test_syncscheduler.js
+++ b/services/sync/tests/unit/test_syncscheduler.js
@@ -535,7 +535,7 @@ add_task(function* test_autoconnect_mp_locked() {
delete Service.identity.syncKey;
Service.identity.__defineGetter__("syncKey", function() {
_("Faking Master Password entry cancelation.");
- throw "User canceled Master Password entry";
+ throw "User canceled master password entry";
});
let deferred = Promise.defer();
diff --git a/storage/moz.build b/storage/moz.build
index 8863105c9d..216a1cf742 100644
--- a/storage/moz.build
+++ b/storage/moz.build
@@ -98,8 +98,7 @@ FINAL_LIBRARY = 'xul'
# Note: On Windows our sqlite build assumes we use jemalloc. If you disable
# MOZ_STORAGE_MEMORY on Windows, you will also need to change the "ifdef
# MOZ_MEMORY" options in db/sqlite3/src/Makefile.in.
-if CONFIG['MOZ_MEMORY'] and (not CONFIG['MOZ_SYSTEM_SQLITE']
- or CONFIG['MOZ_SYSTEM_JEMALLOC']):
+if CONFIG['MOZ_MEMORY'] and not CONFIG['MOZ_SYSTEM_SQLITE']:
if CONFIG['OS_TARGET'] != 'Android':
DEFINES['MOZ_STORAGE_MEMORY'] = True
diff --git a/taskcluster/scripts/builder/build-l10n.sh b/taskcluster/scripts/builder/build-l10n.sh
index be16955a54..d337bbfe31 100755
--- a/taskcluster/scripts/builder/build-l10n.sh
+++ b/taskcluster/scripts/builder/build-l10n.sh
@@ -32,7 +32,6 @@ fail() {
exit 1
}
-export MOZ_CRASHREPORTER_NO_REPORT=1
export MOZ_OBJDIR=obj-firefox
export TINDERBOX_OUTPUT=1
diff --git a/taskcluster/scripts/builder/build-linux.sh b/taskcluster/scripts/builder/build-linux.sh
index 8885abdec2..d1e7e77cfe 100755
--- a/taskcluster/scripts/builder/build-linux.sh
+++ b/taskcluster/scripts/builder/build-linux.sh
@@ -36,7 +36,6 @@ fail() {
exit 1
}
-export MOZ_CRASHREPORTER_NO_REPORT=1
export MOZ_OBJDIR=obj-firefox
export TINDERBOX_OUTPUT=1
diff --git a/testing/gtest/mozilla/GTestRunner.cpp b/testing/gtest/mozilla/GTestRunner.cpp
index 0864db8cb8..544de81da9 100644
--- a/testing/gtest/mozilla/GTestRunner.cpp
+++ b/testing/gtest/mozilla/GTestRunner.cpp
@@ -6,9 +6,6 @@
#include "GTestRunner.h"
#include "gtest/gtest.h"
#include "mozilla/Attributes.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsICrashReporter.h"
-#endif
#include "testing/TestHarness.h"
#include "prenv.h"
#ifdef XP_WIN
@@ -92,28 +89,6 @@ int RunGTestFunc()
#ifdef XP_WIN
mozilla::ipc::windows::InitUIThread();
#endif
-#ifdef MOZ_CRASHREPORTER
- nsCOMPtr<nsICrashReporter> crashreporter;
- char *crashreporterStr = PR_GetEnv("MOZ_CRASHREPORTER");
- if (crashreporterStr && !strcmp(crashreporterStr, "1")) {
- //TODO: move this to an even-more-common location to use in all
- // C++ unittests
- crashreporter = do_GetService("@mozilla.org/toolkit/crash-reporter;1");
- if (crashreporter) {
- std::cerr << "Setting up crash reporting" << std::endl;
-
- nsCOMPtr<nsIProperties> dirsvc =
- do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID);
- nsCOMPtr<nsIFile> cwd;
- nsresult rv = dirsvc->Get(NS_OS_CURRENT_WORKING_DIR,
- NS_GET_IID(nsIFile),
- getter_AddRefs(cwd));
- MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv));
- crashreporter->SetEnabled(true);
- crashreporter->SetMinidumpPath(cwd);
- }
- }
-#endif
return RUN_ALL_TESTS();
}
diff --git a/testing/gtest/rungtests.py b/testing/gtest/rungtests.py
index e9e33cca2c..4999086800 100644
--- a/testing/gtest/rungtests.py
+++ b/testing/gtest/rungtests.py
@@ -89,7 +89,6 @@ class GTests(object):
)
env["XPCOM_DEBUG_BREAK"] = "stack-and-abort"
env["MOZ_CRASHREPORTER_NO_REPORT"] = "1"
- env["MOZ_CRASHREPORTER"] = "1"
env["MOZ_RUN_GTEST"] = "1"
# Normally we run with GTest default output, override this to use the TBPL test format.
env["MOZ_TBPL_PARSER"] = "1"
diff --git a/testing/marionette/client/marionette_driver/geckoinstance.py b/testing/marionette/client/marionette_driver/geckoinstance.py
index 7e2048187e..174168ed23 100644
--- a/testing/marionette/client/marionette_driver/geckoinstance.py
+++ b/testing/marionette/client/marionette_driver/geckoinstance.py
@@ -226,8 +226,7 @@ class GeckoInstance(object):
# environment variables needed for crashreporting
# https://developer.mozilla.org/docs/Environment_variables_affecting_crash_reporting
- env.update({"MOZ_CRASHREPORTER": "1",
- "MOZ_CRASHREPORTER_NO_REPORT": "1",
+ env.update({"MOZ_CRASHREPORTER_NO_REPORT": "1",
"MOZ_CRASHREPORTER_SHUTDOWN": "1",
})
diff --git a/testing/marionette/element.js b/testing/marionette/element.js
index 8e66ee6df9..9687fb27d4 100644
--- a/testing/marionette/element.js
+++ b/testing/marionette/element.js
@@ -953,6 +953,12 @@ element.getContainer = function (el) {
* pointer-interactable, if it is found somewhere in the
* |elementsFromPoint| list at |el|'s in-view centre coordinates.
*
+ * Before running the check, we change |el|'s pointerEvents style property
+ * to "auto", since elements without pointer events enabled do not turn
+ * up in the paint tree we get from document.elementsFromPoint. This is
+ * a specialisation that is only relevant when checking if the element is
+ * in view.
+ *
* @param {Element} el
* Element to check if is in view.
*
@@ -960,8 +966,14 @@ element.getContainer = function (el) {
* True if |el| is inside the viewport, or false otherwise.
*/
element.isInView = function (el) {
- let tree = element.getPointerInteractablePaintTree(el);
- return tree.includes(el);
+ let originalPointerEvents = el.style.pointerEvents;
+ try {
+ el.style.pointerEvents = "auto";
+ const tree = element.getPointerInteractablePaintTree(el);
+ return tree.includes(el);
+ } finally {
+ el.style.pointerEvents = originalPointerEvents;
+ }
};
/**
diff --git a/testing/marionette/error.js b/testing/marionette/error.js
index 97cc3fb258..c36dace256 100644
--- a/testing/marionette/error.js
+++ b/testing/marionette/error.js
@@ -260,10 +260,23 @@ class ElementClickInterceptedError extends WebDriverError {
if (obscuredEl && coords) {
const doc = obscuredEl.ownerDocument;
const overlayingEl = doc.elementFromPoint(coords.x, coords.y);
- msg = error.pprint`Element ${obscuredEl} is not clickable ` +
- `at point (${coords.x},${coords.y}) ` +
- error.pprint`because another element ${overlayingEl} ` +
- `obscures it`;
+
+ switch (obscuredEl.style.pointerEvents) {
+ case "none":
+ msg = error.pprint`Element ${obscuredEl} is not clickable ` +
+ `at point (${coords.x},${coords.y}) ` +
+ `because it does not have pointer events enabled, ` +
+ error.pprint`and element ${overlayingEl} ` +
+ `would receive the click instead`;
+ break;
+
+ default:
+ msg = error.pprint`Element ${obscuredEl} is not clickable ` +
+ `at point (${coords.x},${coords.y}) ` +
+ error.pprint`because another element ${overlayingEl} ` +
+ `obscures it`;
+ break;
+ }
}
super(msg);
diff --git a/testing/marionette/harness/marionette_harness/tests/unit/test_click.py b/testing/marionette/harness/marionette_harness/tests/unit/test_click.py
index d03062e85f..06019834a3 100644
--- a/testing/marionette/harness/marionette_harness/tests/unit/test_click.py
+++ b/testing/marionette/harness/marionette_harness/tests/unit/test_click.py
@@ -252,3 +252,20 @@ class TestClick(TestLegacyClick):
with self.assertRaises(errors.ElementClickInterceptedException):
obscured.click()
self.assertFalse(self.marionette.execute_script("return window.clicked", sandbox=None))
+
+ def test_pointer_events_none(self):
+ self.marionette.navigate(inline("""
+ <button style="pointer-events: none">click me</button>
+ <script>
+ window.clicked = false;
+ let button = document.querySelector("button");
+ button.addEventListener("click", () => window.clicked = true);
+ </script>
+ """))
+ button = self.marionette.find_element(By.TAG_NAME, "button")
+ self.assertEqual("none", button.value_of_css_property("pointer-events"))
+
+ with self.assertRaisesRegexp(errors.ElementClickInterceptedException,
+ "does not have pointer events enabled"):
+ button.click()
+ self.assertFalse(self.marionette.execute_script("return window.clicked", sandbox=None))
diff --git a/testing/marionette/interaction.js b/testing/marionette/interaction.js
index c8275665da..2392485d73 100644
--- a/testing/marionette/interaction.js
+++ b/testing/marionette/interaction.js
@@ -76,6 +76,30 @@ const SELECTED_PROPERTY_SUPPORTED_XUL = new Set([
"TAB",
]);
+/**
+ * Common form controls that user can change the value property interactively.
+ */
+const COMMON_FORM_CONTROLS = new Set([
+ "input",
+ "textarea",
+ "select",
+]);
+
+/**
+ * Input elements that do not fire "input" and "change" events when value
+ * property changes.
+ */
+const INPUT_TYPES_NO_EVENT = new Set([
+ "checkbox",
+ "radio",
+ "file",
+ "hidden",
+ "image",
+ "reset",
+ "button",
+ "submit",
+]);
+
this.interaction = {};
/**
@@ -339,6 +363,32 @@ interaction.uploadFile = function (el, path) {
};
/**
+ * Sets a form element's value.
+ *
+ * @param {DOMElement} el
+ * An form element, e.g. input, textarea, etc.
+ * @param {string} value
+ * The value to be set.
+ *
+ * @throws TypeError
+ * If |el| is not an supported form element.
+ */
+interaction.setFormControlValue = function* (el, value) {
+ if (!COMMON_FORM_CONTROLS.has(el.localName)) {
+ throw new TypeError("This function is for form elements only");
+ }
+
+ el.value = value;
+
+ if (INPUT_TYPES_NO_EVENT.has(el.type)) {
+ return;
+ }
+
+ event.input(el);
+ event.change(el);
+};
+
+/**
* Send keys to element.
*
* @param {DOMElement|XULElement} el
diff --git a/testing/marionette/listener.js b/testing/marionette/listener.js
index b64eb378df..619ac249d1 100644
--- a/testing/marionette/listener.js
+++ b/testing/marionette/listener.js
@@ -30,6 +30,7 @@ Cu.import("chrome://marionette/content/session.js");
Cu.import("chrome://marionette/content/simpletest.js");
Cu.import("resource://gre/modules/FileUtils.jsm");
+Cu.import("resource://gre/modules/Preferences.jsm");
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
@@ -1465,6 +1466,9 @@ function* sendKeysToElement(id, val) {
if (el.type == "file") {
let path = val.join("");
yield interaction.uploadFile(el, path);
+ } else if ((el.type == "date" || el.type == "time") &&
+ Preferences.get("dom.forms.datetime")) {
+ yield interaction.setFormControlValue(el, val);
} else {
yield interaction.sendKeysToElement(
el, val, false, capabilities.get("moz:accessibilityChecks"));
diff --git a/testing/marionette/test_error.js b/testing/marionette/test_error.js
index f272126373..a905f02f06 100644
--- a/testing/marionette/test_error.js
+++ b/testing/marionette/test_error.js
@@ -209,15 +209,25 @@ add_test(function test_ElementClickInterceptedError() {
return otherEl;
},
},
+ style: {
+ pointerEvents: "auto",
+ }
};
- let err = new ElementClickInterceptedError(obscuredEl, {x: 1, y: 2});
- equal("ElementClickInterceptedError", err.name);
+ let err1 = new ElementClickInterceptedError(obscuredEl, {x: 1, y: 2});
+ equal("ElementClickInterceptedError", err1.name);
equal("Element <b> is not clickable at point (1,2) " +
"because another element <a> obscures it",
- err.message);
- equal("element click intercepted", err.status);
- ok(err instanceof WebDriverError);
+ err1.message);
+ equal("element click intercepted", err1.status);
+ ok(err1 instanceof WebDriverError);
+
+ obscuredEl.style.pointerEvents = "none";
+ let err2 = new ElementClickInterceptedError(obscuredEl, {x: 1, y: 2});
+ equal("Element <b> is not clickable at point (1,2) " +
+ "because it does not have pointer events enabled, " +
+ "and element <a> would receive the click instead",
+ err2.message);
run_next_test();
});
diff --git a/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm b/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
index eebcbb6bbd..d6cd836e77 100644
--- a/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
+++ b/testing/mochitest/BrowserTestUtils/BrowserTestUtils.jsm
@@ -851,9 +851,6 @@ this.BrowserTestUtils = {
crashBrowser: Task.async(function*(browser, shouldShowTabCrashPage=true) {
let extra = {};
let KeyValueParser = {};
- if (AppConstants.MOZ_CRASHREPORTER) {
- Cu.import("resource://gre/modules/KeyValueParser.jsm", KeyValueParser);
- }
if (!browser.isRemoteBrowser) {
throw new Error("<xul:browser> needs to be remote in order to crash");
@@ -938,11 +935,7 @@ this.BrowserTestUtils = {
extrafile.append(dumpID + '.extra');
if (extrafile.exists()) {
dump(`\nNo .extra file for dumpID: ${dumpID}\n`);
- if (AppConstants.MOZ_CRASHREPORTER) {
- extra = KeyValueParser.parseKeyValuePairsFromFile(extrafile);
- } else {
- dump('\nCrashReporter not enabled - will not return any extra data\n');
- }
+ dump('\nWill not return any extra data\n');
}
removeFile(minidumpDirectory, dumpID + '.dmp');
diff --git a/testing/mozbase/mozrunner/mozrunner/base/browser.py b/testing/mozbase/mozrunner/mozrunner/base/browser.py
index 998e4ccc5e..6fc7348d58 100644
--- a/testing/mozbase/mozrunner/mozrunner/base/browser.py
+++ b/testing/mozbase/mozrunner/mozrunner/base/browser.py
@@ -75,6 +75,5 @@ class GeckoRuntimeRunner(BaseRunner):
if not self.show_crash_reporter:
# hide the crash reporter window
self.env["MOZ_CRASHREPORTER_NO_REPORT"] = "1"
- self.env["MOZ_CRASHREPORTER"] = "1"
BaseRunner.start(self, *args, **kwargs)
diff --git a/testing/mozbase/mozrunner/mozrunner/base/device.py b/testing/mozbase/mozrunner/mozrunner/base/device.py
index 2252203d16..6eeef042f4 100644
--- a/testing/mozbase/mozrunner/mozrunner/base/device.py
+++ b/testing/mozbase/mozrunner/mozrunner/base/device.py
@@ -22,8 +22,7 @@ class DeviceRunner(BaseRunner):
The base runner class used for running gecko on
remote devices (or emulators), such as B2G.
"""
- env = {'MOZ_CRASHREPORTER': '1',
- 'MOZ_CRASHREPORTER_NO_REPORT': '1',
+ env = {'MOZ_CRASHREPORTER_NO_REPORT': '1',
'MOZ_CRASHREPORTER_SHUTDOWN': '1',
'MOZ_HIDE_RESULTS_TABLE': '1',
'MOZ_LOG': 'signaling:3,mtransport:4,DataChannel:4,jsep:4,MediaPipelineFactory:4',
diff --git a/testing/mozbase/mozrunner/mozrunner/utils.py b/testing/mozbase/mozrunner/mozrunner/utils.py
index f96c94398d..79f26b8f29 100755
--- a/testing/mozbase/mozrunner/mozrunner/utils.py
+++ b/testing/mozbase/mozrunner/mozrunner/utils.py
@@ -132,7 +132,6 @@ def test_environment(xrePath, env=None, crashreporter=True, debugger=False,
if crashreporter and not debugger:
env['MOZ_CRASHREPORTER_NO_REPORT'] = '1'
- env['MOZ_CRASHREPORTER'] = '1'
else:
env['MOZ_CRASHREPORTER_DISABLE'] = '1'
diff --git a/testing/profiles/prefs_general.js b/testing/profiles/prefs_general.js
index 91218b5f39..ac2c1e077e 100644
--- a/testing/profiles/prefs_general.js
+++ b/testing/profiles/prefs_general.js
@@ -12,6 +12,7 @@ user_pref("dom.experimental_forms", true); // on for testing
user_pref("dom.forms.number", true); // on for testing
user_pref("dom.forms.color", true); // on for testing
user_pref("dom.forms.datetime", true); // on for testing
+user_pref("dom.forms.datetime.others", true); // on for testing
user_pref("dom.max_script_run_time", 0); // no slow script dialogs
user_pref("hangmonitor.timeout", 0); // no hang monitor
user_pref("dom.max_chrome_script_run_time", 0);
diff --git a/testing/runcppunittests.py b/testing/runcppunittests.py
index d8b79f68f7..fdd6abc1f6 100755
--- a/testing/runcppunittests.py
+++ b/testing/runcppunittests.py
@@ -90,7 +90,6 @@ class CPPUnitTests(object):
# been fixed to enable crash reporting
env["XPCOM_DEBUG_BREAK"] = "stack-and-abort"
env["MOZ_CRASHREPORTER_NO_REPORT"] = "1"
- env["MOZ_CRASHREPORTER"] = "1"
return env
def build_environment(self):
diff --git a/testing/talos/talos/ffsetup.py b/testing/talos/talos/ffsetup.py
index 22a9dea07f..14ff576d54 100644
--- a/testing/talos/talos/ffsetup.py
+++ b/testing/talos/talos/ffsetup.py
@@ -67,10 +67,7 @@ class FFSetup(object):
# for winxp e10s logging:
# https://bugzilla.mozilla.org/show_bug.cgi?id=1037445
self.env['MOZ_WIN_INHERIT_STD_HANDLES_PRE_VISTA'] = '1'
- if self.browser_config['symbols_path']:
- self.env['MOZ_CRASHREPORTER'] = '1'
- else:
- self.env['MOZ_CRASHREPORTER_DISABLE'] = '1'
+ self.env['MOZ_CRASHREPORTER_DISABLE'] = '1'
self.env['MOZ_DISABLE_NONLOCAL_CONNECTIONS'] = '1'
diff --git a/testing/web-platform/meta/MANIFEST.json b/testing/web-platform/meta/MANIFEST.json
index 65626d6b8c..496f8e3cb4 100644
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -31100,6 +31100,10 @@
"url": "/user-timing/test_user_timing_mark.html"
},
{
+ "path": "user-timing/test_user_timing_mark_and_measure_exception_when_invoke_with_timing_attributes.html",
+ "url": "/user-timing/test_user_timing_mark_and_measure_exception_when_invoke_with_timing_attributes.html"
+ },
+ {
"path": "user-timing/test_user_timing_mark_and_measure_exception_when_invoke_without_parameter.html",
"url": "/user-timing/test_user_timing_mark_and_measure_exception_when_invoke_without_parameter.html"
},
@@ -38674,6 +38678,12 @@
"url": "/html/webappapis/idle-callbacks/callback-multiple-calls.html"
}
],
+ "html/webappapis/idle-callbacks/callback-suspended.html": [
+ {
+ "path": "html/webappapis/idle-callbacks/callback-suspended.html",
+ "url": "/html/webappapis/idle-callbacks/callback-suspended.html"
+ }
+ ],
"html/webappapis/idle-callbacks/callback-timeout.html": [
{
"path": "html/webappapis/idle-callbacks/callback-timeout.html",
@@ -39138,6 +39148,18 @@
"url": "/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_9.html"
}
],
+ "2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1.html": [
+ {
+ "path": "2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1.html",
+ "references": [
+ [
+ "/2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1_ref.html",
+ "=="
+ ]
+ ],
+ "url": "/2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1.html"
+ }
+ ],
"2dcontext/line-styles/canvas_linestyles_linecap_001.htm": [
{
"path": "2dcontext/line-styles/canvas_linestyles_linecap_001.htm",
diff --git a/testing/web-platform/meta/XMLHttpRequest/open-url-bogus.htm.ini b/testing/web-platform/meta/XMLHttpRequest/open-url-bogus.htm.ini
deleted file mode 100644
index ef7b5d9100..0000000000
--- a/testing/web-platform/meta/XMLHttpRequest/open-url-bogus.htm.ini
+++ /dev/null
@@ -1,11 +0,0 @@
-[open-url-bogus.htm]
- type: testharness
- [XMLHttpRequest: open() - bogus URLs (http:)]
- expected: FAIL
-
- [XMLHttpRequest: open() - bogus URLs (ftp:)]
- expected: FAIL
-
- [XMLHttpRequest: open() - bogus URLs (http:////////////)]
- expected: FAIL
-
diff --git a/testing/web-platform/meta/dom/events/EventTarget-dispatchEvent.html.ini b/testing/web-platform/meta/dom/events/EventTarget-dispatchEvent.html.ini
index d62b521c52..0d489b03db 100644
--- a/testing/web-platform/meta/dom/events/EventTarget-dispatchEvent.html.ini
+++ b/testing/web-platform/meta/dom/events/EventTarget-dispatchEvent.html.ini
@@ -12,10 +12,6 @@
expected: FAIL
bug: https://github.com/whatwg/dom/issues/362, 1314303
- [If the event's initialized flag is not set, an InvalidStateError must be thrown (FocusEvent).]
- expected: FAIL
- bug: https://github.com/whatwg/dom/issues/362, 1314303
-
[If the event's initialized flag is not set, an InvalidStateError must be thrown (IDBVersionChangeEvent).]
expected: FAIL
bug: https://github.com/whatwg/dom/issues/362, 1314303
diff --git a/testing/web-platform/meta/dom/nodes/Document-createEvent.html.ini b/testing/web-platform/meta/dom/nodes/Document-createEvent.html.ini
index 1d92f01aeb..a1c822113c 100644
--- a/testing/web-platform/meta/dom/nodes/Document-createEvent.html.ini
+++ b/testing/web-platform/meta/dom/nodes/Document-createEvent.html.ini
@@ -76,30 +76,6 @@
expected: FAIL
bug: https://github.com/whatwg/dom/issues/362, 1314303
- [FocusEvent should be an alias for FocusEvent.]
- expected: FAIL
- bug: https://github.com/whatwg/dom/issues/362, 1314303
-
- [createEvent('FocusEvent') should be initialized correctly.]
- expected: FAIL
- bug: https://github.com/whatwg/dom/issues/362, 1314303
-
- [focusevent should be an alias for FocusEvent.]
- expected: FAIL
- bug: https://github.com/whatwg/dom/issues/362, 1314303
-
- [createEvent('focusevent') should be initialized correctly.]
- expected: FAIL
- bug: https://github.com/whatwg/dom/issues/362, 1314303
-
- [FOCUSEVENT should be an alias for FocusEvent.]
- expected: FAIL
- bug: https://github.com/whatwg/dom/issues/362, 1314303
-
- [createEvent('FOCUSEVENT') should be initialized correctly.]
- expected: FAIL
- bug: https://github.com/whatwg/dom/issues/362, 1314303
-
[IDBVersionChangeEvent should be an alias for IDBVersionChangeEvent.]
expected: FAIL
bug: https://github.com/whatwg/dom/issues/362, 1314303
diff --git a/testing/web-platform/meta/fetch/api/headers/headers-basic.html.ini b/testing/web-platform/meta/fetch/api/headers/headers-basic.html.ini
index 27927b1e92..8c4cddf9c8 100644
--- a/testing/web-platform/meta/fetch/api/headers/headers-basic.html.ini
+++ b/testing/web-platform/meta/fetch/api/headers/headers-basic.html.ini
@@ -1,17 +1,3 @@
[headers-basic.html]
type: testharness
- [Check keys method]
- expected: FAIL
-
- [Check values method]
- expected: FAIL
-
- [Check entries method]
- expected: FAIL
-
- [Check Symbol.iterator method]
- expected: FAIL
-
- [Check forEach method]
- expected: FAIL
diff --git a/testing/web-platform/meta/fetch/nosniff/worker.html.ini b/testing/web-platform/meta/fetch/nosniff/worker.html.ini
deleted file mode 100644
index 011ad15b81..0000000000
--- a/testing/web-platform/meta/fetch/nosniff/worker.html.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[worker.html]
- type: testharness
- expected: ERROR
diff --git a/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-checkValidity.html.ini b/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-checkValidity.html.ini
index a8247d5a09..23bd8642ca 100644
--- a/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-checkValidity.html.ini
+++ b/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-checkValidity.html.ini
@@ -32,25 +32,3 @@
[[INPUT in DATETIME status\] The datetime type must be supported.]
expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] The datetime-local type must be supported.]
- expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] suffering from an overflow]
- expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] suffering from an overflow (in a form)]
- expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] suffering from an underflow]
- expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] suffering from an underflow (in a form)]
- expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] suffering from a step mismatch]
- expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] suffering from a step mismatch (in a form)]
- expected: FAIL
-
diff --git a/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-reportValidity.html.ini b/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-reportValidity.html.ini
index 2236679978..5b373cfeee 100644
--- a/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-reportValidity.html.ini
+++ b/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-reportValidity.html.ini
@@ -39,24 +39,3 @@
[[INPUT in DATETIME status\] The datetime type must be supported.]
expected: FAIL
- [[INPUT in DATETIME-LOCAL status\] The datetime-local type must be supported.]
- expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] suffering from an overflow]
- expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] suffering from an overflow (in a form)]
- expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] suffering from an underflow]
- expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] suffering from an underflow (in a form)]
- expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] suffering from a step mismatch]
- expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] suffering from a step mismatch (in a form)]
- expected: FAIL
-
diff --git a/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-rangeOverflow.html.ini b/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-rangeOverflow.html.ini
index 6af2a360ea..d8c650632b 100644
--- a/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-rangeOverflow.html.ini
+++ b/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-rangeOverflow.html.ini
@@ -3,21 +3,3 @@
[[INPUT in DATETIME status\] The datetime type must be supported.]
expected: FAIL
- [[INPUT in DATETIME-LOCAL status\] The datetime-local type must be supported.]
- expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] The value is greater than max]
- expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] The value is greater than max(with millisecond in 1 digit)]
- expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] The value is greater than max(with millisecond in 2 digits)]
- expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] The value is greater than max(with millisecond in 3 digits)]
- expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] The value is greater than max(Year is 10000 should be valid)]
- expected: FAIL
-
diff --git a/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-rangeUnderflow.html.ini b/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-rangeUnderflow.html.ini
index 344ee0039f..87f6f964ef 100644
--- a/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-rangeUnderflow.html.ini
+++ b/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-rangeUnderflow.html.ini
@@ -3,21 +3,3 @@
[[INPUT in DATETIME status\] The datetime type must be supported.]
expected: FAIL
- [[INPUT in DATETIME-LOCAL status\] The datetime-local type must be supported.]
- expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] The value is less than min]
- expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] The value is less than min(with millisecond in 1 digit)]
- expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] The value is less than min(with millisecond in 2 digits)]
- expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] The value is less than min(with millisecond in 3 digits)]
- expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] The value is less than min(Year is 10000 should be valid)]
- expected: FAIL
-
diff --git a/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-stepMismatch.html.ini b/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-stepMismatch.html.ini
index 0c33bdcbea..527760e600 100644
--- a/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-stepMismatch.html.ini
+++ b/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-stepMismatch.html.ini
@@ -2,7 +2,3 @@
type: testharness
[[INPUT in DATETIME status\] The datetime type must be supported.]
expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] The value must mismatch the step]
- expected: FAIL
-
diff --git a/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-valid.html.ini b/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-valid.html.ini
index 1cddcd0338..8eb7940d95 100644
--- a/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-valid.html.ini
+++ b/testing/web-platform/meta/html/semantics/forms/constraints/form-validation-validity-valid.html.ini
@@ -23,16 +23,3 @@
[[INPUT in MONTH status\] validity.valid must be false if validity.stepMismatch is true]
expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] The datetime-local type must be supported.]
- expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] validity.valid must be false if validity.rangeOverflow is true]
- expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] validity.valid must be false if validity.rangeUnderflow is true]
- expected: FAIL
-
- [[INPUT in DATETIME-LOCAL status\] validity.valid must be false if validity.stepMismatch is true]
- expected: FAIL
-
diff --git a/testing/web-platform/meta/html/semantics/selectors/pseudo-classes/inrange-outofrange.html.ini b/testing/web-platform/meta/html/semantics/selectors/pseudo-classes/inrange-outofrange.html.ini
deleted file mode 100644
index 5e2525ac28..0000000000
--- a/testing/web-platform/meta/html/semantics/selectors/pseudo-classes/inrange-outofrange.html.ini
+++ /dev/null
@@ -1,20 +0,0 @@
-[inrange-outofrange.html]
- type: testharness
- [':in-range' matches all elements that are candidates for constraint validation, have range limitations, and that are neither suffering from an underflow nor suffering from an overflow]
- expected: FAIL
-
- [':in-range' update number1's value < min]
- expected: FAIL
-
- [':in-range' update number3's min < value]
- expected: FAIL
-
- [':out-of-range' matches all elements that are candidates for constraint validation, have range limitations, and that are either suffering from an underflow or suffering from an overflow]
- expected: FAIL
-
- [':out-of-range' update number1's value < min]
- expected: FAIL
-
- [':out-of-range' update number3's min < value]
- expected: FAIL
-
diff --git a/testing/web-platform/meta/media-source/mediasource-getvideoplaybackquality.html.ini b/testing/web-platform/meta/media-source/mediasource-getvideoplaybackquality.html.ini
index b32cf59129..05e68a3014 100644..100755
--- a/testing/web-platform/meta/media-source/mediasource-getvideoplaybackquality.html.ini
+++ b/testing/web-platform/meta/media-source/mediasource-getvideoplaybackquality.html.ini
@@ -2,4 +2,6 @@
type: testharness
[Test the totalFrameDelay attribute of HTMLVideoElement.getVideoPlaybackQuality() with MediaSource API]
expected: FAIL
+ [Test HTMLVideoElement.getVideoPlaybackQuality() with MediaSource API]
+ disabled: Because we do timer rounding, sometimes the test passes, othertimes it fails
diff --git a/testing/web-platform/meta/selection/getSelection.html.ini b/testing/web-platform/meta/selection/getSelection.html.ini
index 4db5721ae4..672b837703 100644
--- a/testing/web-platform/meta/selection/getSelection.html.ini
+++ b/testing/web-platform/meta/selection/getSelection.html.ini
@@ -1,14 +1,5 @@
[getSelection.html]
type: testharness
- [getSelection() on HTML document with null defaultView must be null]
- expected: FAIL
-
- [getSelection() on XML document with null defaultView must be null]
- expected: FAIL
-
- [getSelection() on HTML document with null defaultView must be null inside an iframe onload]
- expected: FAIL
-
[window.getSelection() instanceof Selection in an iframe immediately after appendChild]
expected: FAIL
diff --git a/testing/web-platform/meta/service-workers/service-worker/performance-timeline.https.html.ini b/testing/web-platform/meta/service-workers/service-worker/performance-timeline.https.html.ini
index e37f8696f6..430f4c60c7 100644..100755
--- a/testing/web-platform/meta/service-workers/service-worker/performance-timeline.https.html.ini
+++ b/testing/web-platform/meta/service-workers/service-worker/performance-timeline.https.html.ini
@@ -2,4 +2,6 @@
type: testharness
[Resource Timing]
expected: FAIL
+ [User Timing]
+ disabled: Because we do timer rounding, sometimes the test passes, othertimes it fails
diff --git a/testing/web-platform/meta/service-workers/service-worker/resource-timing.https.html.ini b/testing/web-platform/meta/service-workers/service-worker/resource-timing.https.html.ini
index b399d5f386..b6f02262b6 100644
--- a/testing/web-platform/meta/service-workers/service-worker/resource-timing.https.html.ini
+++ b/testing/web-platform/meta/service-workers/service-worker/resource-timing.https.html.ini
@@ -1,9 +1,2 @@
[resource-timing.https.html]
type: testharness
- disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1178713
- [Controlled resource loads]
- expected: FAIL
-
- [Non-controlled resource loads]
- expected: FAIL
-
diff --git a/testing/web-platform/meta/url/url-constructor.html.ini b/testing/web-platform/meta/url/url-constructor.html.ini
index 6da03043b2..22fddbc15e 100644
--- a/testing/web-platform/meta/url/url-constructor.html.ini
+++ b/testing/web-platform/meta/url/url-constructor.html.ini
@@ -219,6 +219,3 @@
[Parsing: <http://example.com/foo/%2e./%2e%2e/.%2e/%2e.bar> against <about:blank>]
expected: FAIL
- [Parsing: <http:> against <https://example.org/foo/bar>]
- expected: FAIL
-
diff --git a/testing/web-platform/meta/webaudio/the-audio-api/the-audioparam-interface/retrospective-setValueAtTime.html.ini b/testing/web-platform/meta/webaudio/the-audio-api/the-audioparam-interface/retrospective-setValueAtTime.html.ini
new file mode 100755
index 0000000000..a565e0109a
--- /dev/null
+++ b/testing/web-platform/meta/webaudio/the-audio-api/the-audioparam-interface/retrospective-setValueAtTime.html.ini
@@ -0,0 +1,3 @@
+[retrospective-setValueAtTime.html]
+ [Test setValueAtTime with startTime in the past]
+ disabled: Because we do timer rounding, sometimes the test passes, othertimes it fails
diff --git a/testing/web-platform/meta/webaudio/the-audio-api/the-offlineaudiocontext-interface/current-time-block-size.html.ini b/testing/web-platform/meta/webaudio/the-audio-api/the-offlineaudiocontext-interface/current-time-block-size.html.ini
new file mode 100755
index 0000000000..26fb23c0f9
--- /dev/null
+++ b/testing/web-platform/meta/webaudio/the-audio-api/the-offlineaudiocontext-interface/current-time-block-size.html.ini
@@ -0,0 +1,3 @@
+[current-time-block-size.html]
+ [Test currentTime at completion of OfflineAudioContext rendering]
+ disabled: Because we do timer rounding, sometimes the test passes, othertimes it fails
diff --git a/testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_1.html b/testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_1.html
deleted file mode 100644
index b9de85a977..0000000000
--- a/testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_1.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE html>
-<meta charset="utf-8">
-<link rel=match href=drawimage_html_image_1_ref.html>
-<style>
- html, body {
- margin: 0;
- }
-</style>
-<canvas id="dest" height="100" width="100"></canvas>
-<script>
-
-var sourceWidth = 100;
-var sourceHeight = 100;
-var smoothingEnabled = false;
-var destCanvas = document.getElementById('dest');
-var sourceImg = document.createElement('img');
-sourceImg.src = '../2x2.png'
-sourceImg.width = sourceWidth;
-sourceImg.height = sourceHeight;
-
-sourceImg.onload = function() {
- var destCtx = destCanvas.getContext('2d');
- destCtx.fillStyle = "#FF0000";
- destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
- destCtx.imageSmoothingEnabled = smoothingEnabled;
- // 2 arguments, the dest origin is 0,0
- // The source canvas will copied to the 0,0 position of the destination canvas
- destCtx.drawImage(sourceImg, 0, 0);
-}
-</script>
diff --git a/testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1.html b/testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1.html
new file mode 100644
index 0000000000..74a00e037d
--- /dev/null
+++ b/testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1.html
@@ -0,0 +1,30 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<link rel=match href=drawimage_svg_image_1_ref.html>
+<style>
+ html, body {
+ margin: 0;
+ }
+</style>
+<canvas id="dest" height="100" width="100"></canvas>
+<script>
+
+var sourceWidth = 100;
+var sourceHeight = 100;
+var smoothingEnabled = false;
+var destCanvas = document.getElementById('dest');
+var sourceImg = document.createElementNS('http://www.w3.org/2000/svg', 'image');
+sourceImg.setAttributeNS('http://www.w3.org/1999/xlink', 'href', '../2x2.png');
+sourceImg.width = sourceWidth;
+sourceImg.height = sourceHeight;
+
+sourceImg.onload = function() {
+ var destCtx = destCanvas.getContext('2d');
+ destCtx.fillStyle = "#FF0000";
+ destCtx.fillRect(0, 0, destCanvas.width, destCanvas.height);
+ destCtx.imageSmoothingEnabled = smoothingEnabled;
+ // 2 arguments, the dest origin is 0,0
+ // The source canvas will copied to the 0,0 position of the destination canvas
+ destCtx.drawImage(sourceImg, 0, 0);
+}
+</script>
diff --git a/testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_1_ref.html b/testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1_ref.html
index 60545df17f..60545df17f 100644
--- a/testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_html_image_1_ref.html
+++ b/testing/web-platform/tests/2dcontext/drawing-images-to-the-canvas/drawimage_svg_image_1_ref.html
diff --git a/testing/web-platform/tests/fetch/api/response/response-init-002.html b/testing/web-platform/tests/fetch/api/response/response-init-002.html
index 0bb2e8d0b3..a48af83364 100644
--- a/testing/web-platform/tests/fetch/api/response/response-init-002.html
+++ b/testing/web-platform/tests/fetch/api/response/response-init-002.html
@@ -65,6 +65,11 @@
});
}, "Testing empty Response Content-Type header");
+ test(function() {
+ var response = new Response(null, {status: 204});
+ assert_equals(response.body, null);
+ }, "Testing null Response body");
+
</script>
</body>
</html>
diff --git a/testing/web-platform/tests/fetch/nosniff/script.html b/testing/web-platform/tests/fetch/nosniff/script.html
index 667f3c99a6..c5c5167f57 100644
--- a/testing/web-platform/tests/fetch/nosniff/script.html
+++ b/testing/web-platform/tests/fetch/nosniff/script.html
@@ -4,8 +4,8 @@
<script>
var log = function() {}, // see comment below
p = function() {}, // see comment below
- fails = ["", "?type=", "?type=x", "?type=x/x"],
- passes = ["?type=text/javascript", "?type=text/ecmascript", "?type=text/ecmascript;blah"]
+ fails = ["", "?type=", "?type=x", "?type=x/x", "?type=text/json"],
+ passes = ["?type=text/javascript", "?type=text/ecmascript", "?type=text/ecmascript;blah", "?type=text/javascript1.0"]
// Ideally we'd also check whether the scripts in fact execute, but that would involve
// timers and might get a bit racy without cross-browser support for the execute events.
diff --git a/testing/web-platform/tests/html/webappapis/idle-callbacks/callback-suspended.html b/testing/web-platform/tests/html/webappapis/idle-callbacks/callback-suspended.html
new file mode 100644
index 0000000000..6040de922f
--- /dev/null
+++ b/testing/web-platform/tests/html/webappapis/idle-callbacks/callback-suspended.html
@@ -0,0 +1,93 @@
+<!doctype html>
+<meta charset=utf-8>
+<title>Dispatching idle callbacks should be able to be suspended and then resumed</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<div id="log"></div>
+<script>
+ function withEventListener(target, event, handler) {
+ handler = handler || (e => e);
+ return new Promise(resolve => {
+ let wrapper = function(e) {
+ let result = handler(e);
+ if (!result) {
+ return;
+ }
+
+ resolve(result);
+ }
+ target.addEventListener(event, wrapper, { once: true });
+ });
+ }
+
+ function makePostBackUrl(name) {
+ return new URL('resources/post_name_on_load.html?name=' + name,
+ window.location).href;
+ }
+
+ function waitForMessage(message, handler) {
+ return withEventListener(window, 'message', e => (e.data === message) && handler(e));;
+ }
+
+ function withWindow(name) {
+ let win = window.open(makePostBackUrl(name))
+ return waitForMessage(name, _ => win);
+ }
+
+ function navigateWindow(win, name) {
+ win.location = makePostBackUrl(name);
+ return waitForMessage(name, _ => win);
+ }
+
+ function waitDuration(delay) {
+ return new Promise(resolve => {
+ setTimeout(resolve, delay);
+ })
+ }
+
+ function goBack(win) {
+ var p = withEventListener(win, 'pagehide');
+ win.history.back();
+ return p;
+ }
+
+ promise_test(t => {
+ let idleCalled = false;
+ let running = true;
+ return withWindow('foo')
+ .then(win => {
+ let callback = function(d) {
+ idleCalled = true;
+ if (running) {
+ win.requestIdleCallback(callback);
+ }
+ };
+
+ win.requestIdleCallback(callback);
+
+ return navigateWindow(win, 'bar')
+ .then(_ => idleCalled = false)
+ .then(_ => waitDuration(2000))
+ .then(_ => {
+ assert_false(idleCalled, "idle callback shouldn't have been called yet");
+ return goBack(win);
+ })
+ .then(_ => Promise.race([
+ // At this point it's a matter of having bfcache ...
+ waitDuration(2000)
+ .then(_ => {
+ assert_true(idleCalled, "idle callback should've been called by now");
+ running = false;
+ }),
+ // ... or not. If not, we expect a load event.
+ waitForMessage("foo")
+ ]))
+ .then(_ => win.close())
+ .catch(e => {
+ win.close();
+ throw e;
+ })
+ });
+ });
+
+</script>
diff --git a/testing/web-platform/tests/html/webappapis/idle-callbacks/callback-timeout.html b/testing/web-platform/tests/html/webappapis/idle-callbacks/callback-timeout.html
index 823d5f5db4..cc2660a190 100644
--- a/testing/web-platform/tests/html/webappapis/idle-callbacks/callback-timeout.html
+++ b/testing/web-platform/tests/html/webappapis/idle-callbacks/callback-timeout.html
@@ -25,4 +25,19 @@
}
window.requestIdleCallback(t.step_func(f));
}, "requestIdleCallback callback should time out");
+
+ async_test(function (t) {
+ assert_false(document.hidden, "document.hidden must exist and be false to run this test properly");
+ function g(deadline) {
+ assert_false(deadline.didTimeout)
+ t.done();
+ }
+
+ function f(deadline) {
+ assert_false(deadline.didTimeout);
+ window.requestIdleCallback(t.step_func(g), {timeout:100000});
+ }
+ window.requestIdleCallback(t.step_func(f));
+ }, "requestIdleCallback callback should not time out");
+
</script>
diff --git a/testing/web-platform/tests/html/webappapis/idle-callbacks/cancel-invoked.html b/testing/web-platform/tests/html/webappapis/idle-callbacks/cancel-invoked.html
index 8956b8709d..9fb77d65dc 100644
--- a/testing/web-platform/tests/html/webappapis/idle-callbacks/cancel-invoked.html
+++ b/testing/web-platform/tests/html/webappapis/idle-callbacks/cancel-invoked.html
@@ -23,4 +23,10 @@
t.done();
}, 2000);
}, "A cancelled callback is never invoked");
+
+ async_test(function (t) {
+ var handle = requestIdleCallback(t.step_func_done(function () {
+ cancelIdleCallback(handle);
+ }));
+ }, "Cancelling the currently executing idle callback should be allowed");
</script>
diff --git a/testing/web-platform/tests/html/webappapis/idle-callbacks/resources/post_name_on_load.html b/testing/web-platform/tests/html/webappapis/idle-callbacks/resources/post_name_on_load.html
new file mode 100644
index 0000000000..4679a6e6ec
--- /dev/null
+++ b/testing/web-platform/tests/html/webappapis/idle-callbacks/resources/post_name_on_load.html
@@ -0,0 +1,7 @@
+<!doctype html>
+<script>
+ addEventListener('load', _ => {
+ let params = new URLSearchParams(window.location.search);
+ window.opener.postMessage(params.get('name'), '*');
+ });
+</script>
diff --git a/testing/web-platform/tests/service-workers/service-worker/resource-timing.https.html b/testing/web-platform/tests/service-workers/service-worker/resource-timing.https.html
index f33c41d715..3a1adfa486 100644
--- a/testing/web-platform/tests/service-workers/service-worker/resource-timing.https.html
+++ b/testing/web-platform/tests/service-workers/service-worker/resource-timing.https.html
@@ -13,6 +13,10 @@ function verify(performance, resource, description) {
assert_greater_than(entry.workerStart, 0, description);
assert_greater_than_equal(entry.workerStart, entry.startTime, description);
assert_less_than_equal(entry.workerStart, entry.fetchStart, description);
+ assert_greater_than_equal(entry.responseStart, entry.fetchStart, description);
+ assert_greater_than_equal(entry.responseEnd, entry.responseStart, description);
+ assert_greater_than(entry.responseEnd, entry.fetchStart, description);
+ assert_greater_than(entry.duration, 0, description);
if (resource.indexOf('redirect.py') != -1) {
assert_less_than_equal(entry.workerStart, entry.redirectStart,
description);
diff --git a/testing/web-platform/tests/service-workers/service-worker/resources/resource-timing-worker.js b/testing/web-platform/tests/service-workers/service-worker/resources/resource-timing-worker.js
index 481a6536af..452876838f 100644
--- a/testing/web-platform/tests/service-workers/service-worker/resources/resource-timing-worker.js
+++ b/testing/web-platform/tests/service-workers/service-worker/resources/resource-timing-worker.js
@@ -1,5 +1,9 @@
self.addEventListener('fetch', function(event) {
if (event.request.url.indexOf('dummy.js') != -1) {
- event.respondWith(new Response());
+ event.respondWith(new Promise(resolve => {
+ // Slightly delay the response so we ensure we get a non-zero
+ // duration.
+ setTimeout(_ => resolve(new Response()), 100);
+ }));
}
});
diff --git a/testing/web-platform/tests/user-timing/resources/webperftestharness.js b/testing/web-platform/tests/user-timing/resources/webperftestharness.js
index 750946dde2..f1597bbe7f 100644
--- a/testing/web-platform/tests/user-timing/resources/webperftestharness.js
+++ b/testing/web-platform/tests/user-timing/resources/webperftestharness.js
@@ -12,7 +12,7 @@ policies and contribution forms [3].
// Helper Functions for NavigationTiming W3C tests
//
-var performanceNamespace = window.performance;
+var performanceNamespace = self.performance;
var timingAttributes = [
'connectEnd',
'connectStart',
diff --git a/testing/web-platform/tests/user-timing/test_user_timing_mark_and_measure_exception_when_invoke_with_timing_attributes.html b/testing/web-platform/tests/user-timing/test_user_timing_mark_and_measure_exception_when_invoke_with_timing_attributes.html
new file mode 100644
index 0000000000..aea8cb6e98
--- /dev/null
+++ b/testing/web-platform/tests/user-timing/test_user_timing_mark_and_measure_exception_when_invoke_with_timing_attributes.html
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta charset="utf-8" />
+ <title>exception test of performance.mark and performance.measure</title>
+ <meta rel="help" href="http://www.w3.org/TR/user-timing/#extensions-performance-interface"/>
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+ <script src="resources/webperftestharness.js"></script>
+ </head>
+ <body>
+ <script>
+ setup({explicit_done: true});
+ test_namespace();
+
+ test(function() {
+ for (var i in timingAttributes) {
+ assert_throws("SyntaxError", function() { window.performance.mark(timingAttributes[i]); });
+ assert_throws("SyntaxError", function() { window.performance.measure(timingAttributes[i]); });
+ }
+ }, "performance.mark and performance.measure should throw if used with timing attribute values");
+
+ fetch_tests_from_worker(new Worker("test_user_timing_mark_and_measure_exception_when_invoke_with_timing_attributes.js"));
+
+ done();
+
+ </script>
+ <h1>Description</h1>
+ <p>This test validates exception scenarios of invoking mark() and measure() with timing attributes as value.</p>
+ <div id="log"></div>
+ </body>
+</html>
diff --git a/testing/web-platform/tests/user-timing/test_user_timing_mark_and_measure_exception_when_invoke_with_timing_attributes.js b/testing/web-platform/tests/user-timing/test_user_timing_mark_and_measure_exception_when_invoke_with_timing_attributes.js
new file mode 100644
index 0000000000..f015402f9d
--- /dev/null
+++ b/testing/web-platform/tests/user-timing/test_user_timing_mark_and_measure_exception_when_invoke_with_timing_attributes.js
@@ -0,0 +1,14 @@
+importScripts("/resources/testharness.js");
+importScripts("resources/webperftestharness.js");
+
+test(function() {
+ for (var i in timingAttributes) {
+ performance.mark(timingAttributes[i]);
+ performance.clearMarks(timingAttributes[i]);
+
+ performance.measure(timingAttributes[i]);
+ performance.clearMeasures(timingAttributes[i]);
+ }
+}, "performance.mark and performance.measure should not throw if used with timing attribute values in workers");
+
+done();
diff --git a/testing/web-platform/tests/workers/Worker_cross_origin_security_err.htm b/testing/web-platform/tests/workers/Worker_cross_origin_security_err.htm
index 647a8b81e2..d57dc29d55 100644
--- a/testing/web-platform/tests/workers/Worker_cross_origin_security_err.htm
+++ b/testing/web-platform/tests/workers/Worker_cross_origin_security_err.htm
@@ -8,7 +8,7 @@ async_test(function(t) {
try {
var w = new Worker("ftp://example.org/support/WorkerBasic.js");
w.onerror = t.step_func_done(function(e) {
- assert_true(e instanceof ErrorEvent);
+ assert_true(e instanceof Event);
});
} catch (e) {
t.step_func_done(function(e) { assert_true(true); });
diff --git a/testing/web-platform/tests/workers/constructors/SharedWorker/same-origin.html b/testing/web-platform/tests/workers/constructors/SharedWorker/same-origin.html
index 2e0dd8db33..78d53164e6 100644
--- a/testing/web-platform/tests/workers/constructors/SharedWorker/same-origin.html
+++ b/testing/web-platform/tests/workers/constructors/SharedWorker/same-origin.html
@@ -16,7 +16,7 @@ function testSharedWorkerHelper(t, script) {
try {
var worker = new SharedWorker(script, '');
worker.onerror = t.step_func_done(function(e) {
- assert_true(e instanceof ErrorEvent);
+ assert_true(e instanceof Event);
});
} catch (e) {
t.step_func_done(function(e) { assert_true(true); });
diff --git a/testing/web-platform/tests/workers/constructors/Worker/same-origin.html b/testing/web-platform/tests/workers/constructors/Worker/same-origin.html
index 9b0148da3a..bbc4382d0b 100644
--- a/testing/web-platform/tests/workers/constructors/Worker/same-origin.html
+++ b/testing/web-platform/tests/workers/constructors/Worker/same-origin.html
@@ -14,7 +14,7 @@ function testSharedWorkerHelper(t, script) {
try {
var worker = new SharedWorker(script, '');
worker.onerror = t.step_func_done(function(e) {
- assert_true(e instanceof ErrorEvent);
+ assert_true(e instanceof Event);
});
} catch (e) {
t.step_func_done(function(e) { assert_true(true); });
diff --git a/testing/xpcshell/head.js b/testing/xpcshell/head.js
index 74fd482cf0..e204a4512d 100644
--- a/testing/xpcshell/head.js
+++ b/testing/xpcshell/head.js
@@ -95,23 +95,6 @@ try {
}
catch (e) { }
-// Configure crash reporting, if possible
-// We rely on the Python harness to set MOZ_CRASHREPORTER,
-// MOZ_CRASHREPORTER_NO_REPORT, and handle checking for minidumps.
-// Note that if we're in a child process, we don't want to init the
-// crashreporter component.
-try {
- if (runningInParent &&
- "@mozilla.org/toolkit/crash-reporter;1" in Components.classes) {
- let crashReporter =
- Components.classes["@mozilla.org/toolkit/crash-reporter;1"]
- .getService(Components.interfaces.nsICrashReporter);
- crashReporter.UpdateCrashEventsDir();
- crashReporter.minidumpPath = do_get_minidumpdir();
- }
-}
-catch (e) { }
-
// Configure a console listener so messages sent to it are logged as part
// of the test.
try {
diff --git a/testing/xpcshell/runxpcshelltests.py b/testing/xpcshell/runxpcshelltests.py
index 7c88343dc9..34af6639fb 100755
--- a/testing/xpcshell/runxpcshelltests.py
+++ b/testing/xpcshell/runxpcshelltests.py
@@ -910,9 +910,6 @@ class XPCShellTests(object):
"""
# Make assertions fatal
self.env["XPCOM_DEBUG_BREAK"] = "stack-and-abort"
- # Crash reporting interferes with debugging
- if not self.debuggerInfo:
- self.env["MOZ_CRASHREPORTER"] = "1"
# Don't launch the crash reporter client
self.env["MOZ_CRASHREPORTER_NO_REPORT"] = "1"
# Don't permit remote connections by default.
diff --git a/toolkit/components/aboutcache/content/aboutCache.js b/toolkit/components/aboutcache/content/aboutCache.js
index 07067cce36..e945d683e0 100644
--- a/toolkit/components/aboutcache/content/aboutCache.js
+++ b/toolkit/components/aboutcache/content/aboutCache.js
@@ -40,5 +40,9 @@ function navigate()
if ($('priv').checked)
context += 'p,';
+ if (storage == null) {
+ storage = "";
+ }
+
window.location.href = 'about:cache?storage=' + storage + '&context=' + context;
}
diff --git a/toolkit/components/alerts/resources/content/alert.css b/toolkit/components/alerts/resources/content/alert.css
index c4d94a543b..81e5cdd352 100644
--- a/toolkit/components/alerts/resources/content/alert.css
+++ b/toolkit/components/alerts/resources/content/alert.css
@@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#alertBox[animate] {
- animation-duration: 20s;
animation-fill-mode: both;
animation-name: alert-animation;
}
diff --git a/toolkit/components/alerts/resources/content/alert.js b/toolkit/components/alerts/resources/content/alert.js
index ead4d503f8..ce60ab0fa9 100644
--- a/toolkit/components/alerts/resources/content/alert.js
+++ b/toolkit/components/alerts/resources/content/alert.js
@@ -166,7 +166,12 @@ function prefillAlertInfo() {
}
function onAlertLoad() {
- const ALERT_DURATION_IMMEDIATE = 20000;
+ const ALERT_DURATION_IMMEDIATE_MIN = 4000;
+ const ALERT_DURATION_IMMEDIATE_MAX = 60000;
+ let alertDurationImmediate = Services.prefs.getIntPref("alerts.durationImmediate", ALERT_DURATION_IMMEDIATE_MIN);
+ alertDurationImmediate = alertDurationImmediate >= ALERT_DURATION_IMMEDIATE_MIN
+ && alertDurationImmediate <= ALERT_DURATION_IMMEDIATE_MAX
+ ? alertDurationImmediate : ALERT_DURATION_IMMEDIATE_MIN;
let alertTextBox = document.getElementById("alertTextBox");
let alertImageBox = document.getElementById("alertImageBox");
alertImageBox.style.minHeight = alertTextBox.scrollHeight + "px";
@@ -186,7 +191,7 @@ function onAlertLoad() {
// If the require interaction flag is set, prevent auto-closing the notification.
if (!gRequireInteraction) {
if (Services.prefs.getBoolPref("alerts.disableSlidingEffect")) {
- setTimeout(function() { window.close(); }, ALERT_DURATION_IMMEDIATE);
+ setTimeout(function() { window.close(); }, alertDurationImmediate);
} else {
let alertBox = document.getElementById("alertBox");
alertBox.addEventListener("animationend", function hideAlert(event) {
@@ -197,6 +202,7 @@ function onAlertLoad() {
window.close();
}
}, false);
+ alertBox.style.animationDuration = Math.round(alertDurationImmediate / 1000).toString() + "s";
alertBox.setAttribute("animate", true);
}
}
diff --git a/toolkit/components/autocomplete/nsAutoCompleteController.cpp b/toolkit/components/autocomplete/nsAutoCompleteController.cpp
index 5d69ea1a32..9ca382fe5e 100644
--- a/toolkit/components/autocomplete/nsAutoCompleteController.cpp
+++ b/toolkit/components/autocomplete/nsAutoCompleteController.cpp
@@ -1637,58 +1637,72 @@ nsAutoCompleteController::ProcessResult(int32_t aSearchIndex, nsIAutoCompleteRes
MOZ_ASSERT(mResults.Count() >= aSearchIndex + 1,
"aSearchIndex should always be valid for mResults");
- uint32_t oldRowCount = mRowCount;
- // If the search failed, increase the match count to include the error
- // description.
- if (searchResult == nsIAutoCompleteResult::RESULT_FAILURE) {
- nsAutoString error;
- aResult->GetErrorDescription(error);
- if (!error.IsEmpty()) {
- ++mRowCount;
- if (mTree) {
- mTree->RowCountChanged(oldRowCount, 1);
+ bool isTypeAheadResult = false;
+ aResult->GetTypeAheadResult(&isTypeAheadResult);
+
+ if (!isTypeAheadResult) {
+ uint32_t oldRowCount = mRowCount;
+ // If the search failed, increase the match count to include the error
+ // description.
+ if (searchResult == nsIAutoCompleteResult::RESULT_FAILURE) {
+ nsAutoString error;
+ aResult->GetErrorDescription(error);
+ if (!error.IsEmpty()) {
+ ++mRowCount;
+ if (mTree) {
+ mTree->RowCountChanged(oldRowCount, 1);
+ }
}
- }
- } else if (searchResult == nsIAutoCompleteResult::RESULT_SUCCESS ||
- searchResult == nsIAutoCompleteResult::RESULT_SUCCESS_ONGOING) {
- // Increase the match count for all matches in this result.
- uint32_t totalMatchCount = 0;
- for (uint32_t i = 0; i < mResults.Length(); i++) {
- nsIAutoCompleteResult* result = mResults.SafeObjectAt(i);
- if (result) {
- uint32_t matchCount = 0;
- result->GetMatchCount(&matchCount);
- totalMatchCount += matchCount;
+ } else if (searchResult == nsIAutoCompleteResult::RESULT_SUCCESS ||
+ searchResult == nsIAutoCompleteResult::RESULT_SUCCESS_ONGOING) {
+ // Increase the match count for all matches in this result.
+ uint32_t totalMatchCount = 0;
+ for (uint32_t i = 0; i < mResults.Length(); i++) {
+ nsIAutoCompleteResult* result = mResults.SafeObjectAt(i);
+ if (result) {
+ // not all results implement this, so it can likely fail.
+ bool typeAhead = false;
+ result->GetTypeAheadResult(&typeAhead);
+ if (!typeAhead) {
+ uint32_t matchCount = 0;
+ result->GetMatchCount(&matchCount);
+ totalMatchCount += matchCount;
+ }
+ }
}
- }
- uint32_t delta = totalMatchCount - oldRowCount;
+ uint32_t delta = totalMatchCount - oldRowCount;
- mRowCount += delta;
- if (mTree) {
- mTree->RowCountChanged(oldRowCount, delta);
+ mRowCount += delta;
+ if (mTree) {
+ mTree->RowCountChanged(oldRowCount, delta);
+ }
}
- }
- // Try to autocomplete the default index for this search.
- // Do this before invalidating so the binding knows about it.
- CompleteDefaultIndex(aSearchIndex);
+ // Try to autocomplete the default index for this search.
+ // Do this before invalidating so the binding knows about it.
+ CompleteDefaultIndex(aSearchIndex);
- // Refresh the popup view to display the new search results
- nsCOMPtr<nsIAutoCompletePopup> popup;
- input->GetPopup(getter_AddRefs(popup));
- NS_ENSURE_TRUE(popup != nullptr, NS_ERROR_FAILURE);
- popup->Invalidate(nsIAutoCompletePopup::INVALIDATE_REASON_NEW_RESULT);
+ // Refresh the popup view to display the new search results
+ nsCOMPtr<nsIAutoCompletePopup> popup;
+ input->GetPopup(getter_AddRefs(popup));
+ NS_ENSURE_TRUE(popup != nullptr, NS_ERROR_FAILURE);
+ popup->Invalidate(nsIAutoCompletePopup::INVALIDATE_REASON_NEW_RESULT);
- uint32_t minResults;
- input->GetMinResultsForPopup(&minResults);
+ uint32_t minResults;
+ input->GetMinResultsForPopup(&minResults);
- // Make sure the popup is open, if necessary, since we now have at least one
- // search result ready to display. Don't force the popup closed if we might
- // get results in the future to avoid unnecessarily canceling searches.
- if (mRowCount || !minResults) {
- OpenPopup();
- } else if (mSearchesOngoing == 0) {
- ClosePopup();
+ // Make sure the popup is open, if necessary, since we now have at least one
+ // search result ready to display. Don't force the popup closed if we might
+ // get results in the future to avoid unnecessarily canceling searches.
+ if (mRowCount || !minResults) {
+ OpenPopup();
+ } else if (mSearchesOngoing == 0) {
+ ClosePopup();
+ }
+ } else if (searchResult == nsIAutoCompleteResult::RESULT_SUCCESS ||
+ searchResult == nsIAutoCompleteResult::RESULT_SUCCESS_ONGOING) {
+ // Try to autocomplete the default index for this search.
+ CompleteDefaultIndex(aSearchIndex);
}
return NS_OK;
@@ -2033,14 +2047,20 @@ nsAutoCompleteController::RowIndexToSearch(int32_t aRowIndex, int32_t *aSearchIn
uint32_t rowCount = 0;
- uint16_t searchResult;
- result->GetSearchResult(&searchResult);
+ // Skip past the result completely if it is marked as hidden
+ bool isTypeAheadResult = false;
+ result->GetTypeAheadResult(&isTypeAheadResult);
- // Find out how many results were provided by the
- // current nsIAutoCompleteSearch.
- if (searchResult == nsIAutoCompleteResult::RESULT_SUCCESS ||
- searchResult == nsIAutoCompleteResult::RESULT_SUCCESS_ONGOING) {
- result->GetMatchCount(&rowCount);
+ if (!isTypeAheadResult) {
+ uint16_t searchResult;
+ result->GetSearchResult(&searchResult);
+
+ // Find out how many results were provided by the
+ // current nsIAutoCompleteSearch.
+ if (searchResult == nsIAutoCompleteResult::RESULT_SUCCESS ||
+ searchResult == nsIAutoCompleteResult::RESULT_SUCCESS_ONGOING) {
+ result->GetMatchCount(&rowCount);
+ }
}
// If the given row index is within the results range
diff --git a/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.cpp b/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.cpp
index 9fd2c00228..683ac462a4 100644
--- a/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.cpp
+++ b/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.cpp
@@ -43,7 +43,8 @@ struct AutoCompleteSimpleResultMatch
nsAutoCompleteSimpleResult::nsAutoCompleteSimpleResult() :
mDefaultIndex(-1),
- mSearchResult(RESULT_NOMATCH)
+ mSearchResult(RESULT_NOMATCH),
+ mTypeAheadResult(false)
{
}
@@ -66,6 +67,12 @@ nsAutoCompleteSimpleResult::AppendResult(nsIAutoCompleteResult* aResult)
mErrorDescription = errorDescription;
}
+ bool typeAheadResult = false;
+ if (NS_SUCCEEDED(aResult->GetTypeAheadResult(&typeAheadResult)) &&
+ typeAheadResult) {
+ mTypeAheadResult = typeAheadResult;
+ }
+
int32_t defaultIndex = -1;
if (NS_SUCCEEDED(aResult->GetDefaultIndex(&defaultIndex)) &&
defaultIndex >= 0) {
@@ -166,6 +173,20 @@ nsAutoCompleteSimpleResult::SetErrorDescription(
return NS_OK;
}
+// typeAheadResult
+NS_IMETHODIMP
+nsAutoCompleteSimpleResult::GetTypeAheadResult(bool *aTypeAheadResult)
+{
+ *aTypeAheadResult = mTypeAheadResult;
+ return NS_OK;
+}
+NS_IMETHODIMP
+nsAutoCompleteSimpleResult::SetTypeAheadResult(bool aTypeAheadResult)
+{
+ mTypeAheadResult = aTypeAheadResult;
+ return NS_OK;
+}
+
NS_IMETHODIMP
nsAutoCompleteSimpleResult::InsertMatchAt(int32_t aIndex,
const nsAString& aValue,
diff --git a/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.h b/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.h
index 28968aa570..61ee542e47 100644
--- a/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.h
+++ b/toolkit/components/autocomplete/nsAutoCompleteSimpleResult.h
@@ -38,6 +38,8 @@ protected:
int32_t mDefaultIndex;
uint32_t mSearchResult;
+ bool mTypeAheadResult;
+
nsCOMPtr<nsIAutoCompleteSimpleResultListener> mListener;
};
diff --git a/toolkit/components/autocomplete/nsIAutoCompleteResult.idl b/toolkit/components/autocomplete/nsIAutoCompleteResult.idl
index c719d94272..9ae22ade75 100644
--- a/toolkit/components/autocomplete/nsIAutoCompleteResult.idl
+++ b/toolkit/components/autocomplete/nsIAutoCompleteResult.idl
@@ -50,6 +50,13 @@ interface nsIAutoCompleteResult : nsISupports
readonly attribute unsigned long matchCount;
/**
+ * If true, the results will not be displayed in the popup. However,
+ * if a default index is specified, the default item will still be
+ * completed in the input.
+ */
+ readonly attribute boolean typeAheadResult;
+
+ /**
* Get the value of the result at the given index
*/
AString getValueAt(in long index);
diff --git a/toolkit/components/autocomplete/nsIAutoCompleteSimpleResult.idl b/toolkit/components/autocomplete/nsIAutoCompleteSimpleResult.idl
index 5e92e037ae..6a8827ab84 100644
--- a/toolkit/components/autocomplete/nsIAutoCompleteSimpleResult.idl
+++ b/toolkit/components/autocomplete/nsIAutoCompleteSimpleResult.idl
@@ -42,6 +42,12 @@ interface nsIAutoCompleteSimpleResult : nsIAutoCompleteResult
void setSearchResult(in unsigned short aSearchResult);
/**
+ * A writer for the readonly attribute 'typeAheadResult', typically set
+ * because a result is only intended for type-ahead completion.
+ */
+ void setTypeAheadResult(in boolean aHidden);
+
+ /**
* Inserts a match consisting of the given value, comment, image, style and
* the value to use for defaultIndex completion at a given position.
* @param aIndex
diff --git a/toolkit/components/autocomplete/tests/unit/head_autocomplete.js b/toolkit/components/autocomplete/tests/unit/head_autocomplete.js
index 1443879f09..5a458bdf49 100644
--- a/toolkit/components/autocomplete/tests/unit/head_autocomplete.js
+++ b/toolkit/components/autocomplete/tests/unit/head_autocomplete.js
@@ -85,6 +85,11 @@ AutoCompleteResultBase.prototype = {
defaultIndex: -1,
+ _typeAheadResult: false,
+ get typeAheadResult() {
+ return this._typeAheadResult;
+ },
+
get matchCount() {
return this._values.length;
},
diff --git a/toolkit/components/autocomplete/tests/unit/test_hiddenResult.js b/toolkit/components/autocomplete/tests/unit/test_hiddenResult.js
new file mode 100644
index 0000000000..8e24857165
--- /dev/null
+++ b/toolkit/components/autocomplete/tests/unit/test_hiddenResult.js
@@ -0,0 +1,76 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+function AutoCompleteResult(aValues) {
+ this._values = aValues;
+ this.defaultIndex = -1;
+ this._typeAheadResult = false;
+}
+AutoCompleteResult.prototype = Object.create(AutoCompleteResultBase.prototype);
+
+function AutoCompleteTypeAheadResult(aValues) {
+ this._values = aValues;
+ this.defaultIndex = 0;
+ this._typeAheadResult = true;
+}
+AutoCompleteTypeAheadResult.prototype = Object.create(AutoCompleteResultBase.prototype);
+
+
+/**
+ * Test AutoComplete with multiple AutoCompleteSearch sources, with one of them
+ * being hidden from the popup, but can still do typeahead completion.
+ */
+function run_test() {
+ do_test_pending();
+
+ var inputStr = "moz";
+
+ // Type ahead result
+ var searchTypeAhead = new AutoCompleteSearchBase("search1",
+ new AutoCompleteTypeAheadResult(["mozillaTest1"]));
+ // Regular result
+ var searchNormal = new AutoCompleteSearchBase("search2",
+ new AutoCompleteResult(["mozillaTest2"]));
+
+ // Register searches so AutoCompleteController can find them
+ registerAutoCompleteSearch(searchNormal);
+ registerAutoCompleteSearch(searchTypeAhead);
+
+ // Make an AutoCompleteInput that uses our searches
+ // and confirms results on search complete.
+ var input = new AutoCompleteInputBase([searchTypeAhead.name, searchNormal.name]);
+ input.completeDefaultIndex = true;
+ input.textValue = inputStr;
+
+ // Caret must be at the end. Autofill doesn't happen unless you're typing
+ // characters at the end.
+ var strLen = inputStr.length;
+ input.selectTextRange(strLen, strLen);
+ do_check_eq(input.selectionStart, strLen);
+ do_check_eq(input.selectionEnd, strLen);
+
+ var controller = Cc["@mozilla.org/autocomplete/controller;1"].
+ getService(Ci.nsIAutoCompleteController);
+
+ controller.input = input;
+ controller.startSearch(inputStr);
+
+ input.onSearchComplete = function() {
+ // Hidden results should still be able to do inline autocomplete
+ do_check_eq(input.textValue, "mozillaTest1");
+
+ // Now, let's fill the textbox with the first result of the popup.
+ // The first search is marked as hidden, so we must always get the
+ // second search.
+ controller.handleEnter(true);
+ do_check_eq(input.textValue, "mozillaTest2");
+
+ // Only one item in the popup.
+ do_check_eq(controller.matchCount, 1);
+
+ // Unregister searches
+ unregisterAutoCompleteSearch(searchNormal);
+ unregisterAutoCompleteSearch(searchTypeAhead);
+ do_test_finished();
+ };
+}
diff --git a/toolkit/components/autocomplete/tests/unit/test_popupSelectionVsDefaultCompleteValue.js b/toolkit/components/autocomplete/tests/unit/test_popupSelectionVsDefaultCompleteValue.js
new file mode 100644
index 0000000000..fb41533558
--- /dev/null
+++ b/toolkit/components/autocomplete/tests/unit/test_popupSelectionVsDefaultCompleteValue.js
@@ -0,0 +1,71 @@
+/* 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/. */
+
+function AutoCompleteTypeAheadResult(aValues, aFinalCompleteValues) {
+ this._values = aValues;
+ this._finalCompleteValues = aFinalCompleteValues;
+ this.defaultIndex = 0;
+ this._typeAheadResult = true;
+}
+AutoCompleteTypeAheadResult.prototype = Object.create(AutoCompleteResultBase.prototype);
+
+function AutoCompleteResult(aValues) {
+ this._values = aValues;
+}
+AutoCompleteResult.prototype = Object.create(AutoCompleteResultBase.prototype);
+
+function AutoCompleteInput(aSearches) {
+ this.searches = aSearches;
+ this.popupOpen = true;
+ this.completeDefaultIndex = true;
+ this.completeSelectedIndex = true;
+}
+AutoCompleteInput.prototype = Object.create(AutoCompleteInputBase.prototype);
+
+function run_test() {
+ run_next_test();
+}
+
+add_test(function test_handleEnter() {
+ doSearch("moz", function(aController) {
+ do_check_eq(aController.input.textValue, "mozilla.com");
+ aController.handleEnter(true);
+ do_check_eq(aController.input.textValue, "mozilla.org");
+ });
+});
+
+function doSearch(aSearchString, aOnCompleteCallback) {
+ let typeAheadSearch = new AutoCompleteSearchBase(
+ "typeAheadSearch",
+ new AutoCompleteTypeAheadResult([ "mozilla.com" ], [ "http://www.mozilla.com" ])
+ );
+ registerAutoCompleteSearch(typeAheadSearch);
+
+ let search = new AutoCompleteSearchBase(
+ "search",
+ new AutoCompleteResult([ "mozilla.org" ])
+ );
+ registerAutoCompleteSearch(search);
+
+ let controller = Cc["@mozilla.org/autocomplete/controller;1"].
+ getService(Ci.nsIAutoCompleteController);
+
+ // Make an AutoCompleteInput that uses our searches and confirms results.
+ let input = new AutoCompleteInput([ typeAheadSearch.name, search.name ]);
+ input.textValue = aSearchString;
+
+ // Caret must be at the end for autofill to happen.
+ let strLen = aSearchString.length;
+ input.selectTextRange(strLen, strLen);
+ controller.input = input;
+ controller.startSearch(aSearchString);
+
+ input.onSearchComplete = function onSearchComplete() {
+ aOnCompleteCallback(controller);
+
+ // Clean up.
+ unregisterAutoCompleteSearch(search);
+ run_next_test();
+ };
+}
diff --git a/toolkit/components/autocomplete/tests/unit/xpcshell.ini b/toolkit/components/autocomplete/tests/unit/xpcshell.ini
index 4d193965cb..daf89db173 100644
--- a/toolkit/components/autocomplete/tests/unit/xpcshell.ini
+++ b/toolkit/components/autocomplete/tests/unit/xpcshell.ini
@@ -18,7 +18,9 @@ tail =
[test_finalCompleteValue_forceComplete.js]
[test_finalCompleteValueSelectedIndex.js]
[test_finalDefaultCompleteValue.js]
+[test_hiddenResult.js]
[test_immediate_search.js]
[test_insertMatchAt.js]
+[test_popupSelectionVsDefaultCompleteValue.js]
[test_previousResult.js]
[test_stopSearch.js]
diff --git a/toolkit/components/filepicker/nsFileView.cpp b/toolkit/components/filepicker/nsFileView.cpp
index ad4471e862..9a82784967 100644
--- a/toolkit/components/filepicker/nsFileView.cpp
+++ b/toolkit/components/filepicker/nsFileView.cpp
@@ -133,6 +133,13 @@ NS_IMETHODIMP nsFileResult::GetMatchCount(uint32_t *aMatchCount)
return NS_OK;
}
+NS_IMETHODIMP nsFileResult::GetTypeAheadResult(bool *aTypeAheadResult)
+{
+ NS_ENSURE_ARG_POINTER(aTypeAheadResult);
+ *aTypeAheadResult = false;
+ return NS_OK;
+}
+
NS_IMETHODIMP nsFileResult::GetValueAt(int32_t index, nsAString & aValue)
{
aValue = mValues[index];
diff --git a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
index 1c30599f5a..7439d9d11e 100644
--- a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
+++ b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm
@@ -530,20 +530,34 @@ this.DownloadIntegration = {
* @return true if files should be marked
*/
_shouldSaveZoneInformation() {
- let key = Cc["@mozilla.org/windows-registry-key;1"]
- .createInstance(Ci.nsIWindowsRegKey);
+ let zonePref = 2;
try {
- key.open(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
- "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Attachments",
- Ci.nsIWindowsRegKey.ACCESS_QUERY_VALUE);
- try {
- return key.readIntValue("SaveZoneInformation") != 1;
- } finally {
- key.close();
- }
- } catch (ex) {
- // If the key is not present, files should be marked by default.
- return true;
+ zonePref = Services.prefs.getIntPref("browser.download.saveZoneInformation");
+ } catch (ex) {}
+
+ switch (zonePref) {
+ case 0: // Never
+ return false;
+ case 1: // Always
+ return true;
+ case 2: // System-defined
+ let key = Cc["@mozilla.org/windows-registry-key;1"]
+ .createInstance(Ci.nsIWindowsRegKey);
+ try {
+ key.open(Ci.nsIWindowsRegKey.ROOT_KEY_CURRENT_USER,
+ "Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Attachments",
+ Ci.nsIWindowsRegKey.ACCESS_QUERY_VALUE);
+ try {
+ return key.readIntValue("SaveZoneInformation") != 1;
+ } finally {
+ key.close();
+ }
+ } catch (ex) {
+ // If the key is not present, files should be marked by default.
+ return true;
+ }
+ default: // Invalid pref value defaults marking files.
+ return true;
}
},
#endif
diff --git a/toolkit/components/moz.build b/toolkit/components/moz.build
index 12e1748e95..5dba09a32f 100644
--- a/toolkit/components/moz.build
+++ b/toolkit/components/moz.build
@@ -79,9 +79,6 @@ if not CONFIG['MOZ_FENNEC']:
if CONFIG['NS_PRINTING']:
DIRS += ['printing']
-if CONFIG['MOZ_CRASHREPORTER']:
- DIRS += ['crashes']
-
if CONFIG['BUILD_CTYPES']:
DIRS += ['ctypes']
diff --git a/toolkit/components/mozintl/MozIntl.cpp b/toolkit/components/mozintl/MozIntl.cpp
index 9c393c2960..9c61c73a62 100644
--- a/toolkit/components/mozintl/MozIntl.cpp
+++ b/toolkit/components/mozintl/MozIntl.cpp
@@ -48,6 +48,32 @@ MozIntl::AddGetCalendarInfo(JS::Handle<JS::Value> val, JSContext* cx)
return NS_OK;
}
+NS_IMETHODIMP
+MozIntl::AddGetDisplayNames(JS::Handle<JS::Value> val, JSContext* cx)
+{
+ if (!val.isObject()) {
+ return NS_ERROR_INVALID_ARG;
+ }
+
+ JS::Rooted<JSObject*> realIntlObj(cx, js::CheckedUnwrap(&val.toObject()));
+ if (!realIntlObj) {
+ return NS_ERROR_INVALID_ARG;
+ }
+
+ JSAutoCompartment ac(cx, realIntlObj);
+
+ static const JSFunctionSpec funcs[] = {
+ JS_SELF_HOSTED_FN("getDisplayNames", "Intl_getDisplayNames", 2, 0),
+ JS_FS_END
+ };
+
+ if (!JS_DefineFunctions(cx, realIntlObj, funcs)) {
+ return NS_ERROR_FAILURE;
+ }
+
+ return NS_OK;
+}
+
NS_GENERIC_FACTORY_CONSTRUCTOR(MozIntl)
NS_DEFINE_NAMED_CID(MOZ_MOZINTL_CID);
diff --git a/toolkit/components/mozintl/mozIMozIntl.idl b/toolkit/components/mozintl/mozIMozIntl.idl
index 67be184d4e..f28824d47b 100644
--- a/toolkit/components/mozintl/mozIMozIntl.idl
+++ b/toolkit/components/mozintl/mozIMozIntl.idl
@@ -9,4 +9,5 @@
interface mozIMozIntl : nsISupports
{
[implicit_jscontext] void addGetCalendarInfo(in jsval intlObject);
+ [implicit_jscontext] void addGetDisplayNames(in jsval intlObject);
};
diff --git a/toolkit/components/mozintl/test/test_mozintl.js b/toolkit/components/mozintl/test/test_mozintl.js
index 0eca2c67e5..8d2720bf01 100644
--- a/toolkit/components/mozintl/test/test_mozintl.js
+++ b/toolkit/components/mozintl/test/test_mozintl.js
@@ -7,6 +7,7 @@ function run_test() {
test_this_global(mozIntl);
test_cross_global(mozIntl);
+ test_methods_presence(mozIntl);
ok(true);
}
@@ -30,3 +31,16 @@ function test_cross_global(mozIntl) {
equal(waivedX.getCalendarInfo() instanceof Object, false);
equal(waivedX.getCalendarInfo() instanceof global.Object, true);
}
+
+function test_methods_presence(mozIntl) {
+ equal(mozIntl.addGetCalendarInfo instanceof Function, true);
+ equal(mozIntl.addGetDisplayNames instanceof Function, true);
+
+ let x = {};
+
+ mozIntl.addGetCalendarInfo(x);
+ equal(x.getCalendarInfo instanceof Function, true);
+
+ mozIntl.addGetDisplayNames(x);
+ equal(x.getDisplayNames instanceof Function, true);
+}
diff --git a/toolkit/components/passwordmgr/content/passwordManager.js b/toolkit/components/passwordmgr/content/passwordManager.js
index 333dc1d245..da63d7de83 100644
--- a/toolkit/components/passwordmgr/content/passwordManager.js
+++ b/toolkit/components/passwordmgr/content/passwordManager.js
@@ -80,6 +80,8 @@ function Startup() {
togglePasswordsButton.label = kSignonBundle.getString("showPasswords");
togglePasswordsButton.accessKey = kSignonBundle.getString("showPasswordsAccessKey");
signonsIntro.textContent = kSignonBundle.getString("loginsDescriptionAll");
+ removeAllButton.setAttribute("label", kSignonBundle.getString("removeAll.label"));
+ removeAllButton.setAttribute("accesskey", kSignonBundle.getString("removeAll.accesskey"));
document.getElementsByTagName("treecols")[0].addEventListener("click", (event) => {
let { target, button } = event;
let sortField = target.getAttribute("data-field-name");
@@ -555,6 +557,8 @@ function SignonClearFilter() {
signonsTreeView._lastSelectedRanges = [];
signonsIntro.textContent = kSignonBundle.getString("loginsDescriptionAll");
+ removeAllButton.setAttribute("label", kSignonBundle.getString("removeAll.label"));
+ removeAllButton.setAttribute("accesskey", kSignonBundle.getString("removeAll.accesskey"));
}
function FocusFilterBox() {
@@ -623,6 +627,8 @@ function FilterPasswords() {
signonsTreeView.selection.select(0);
signonsIntro.textContent = kSignonBundle.getString("loginsDescriptionFiltered");
+ removeAllButton.setAttribute("label", kSignonBundle.getString("removeAllShown.label"));
+ removeAllButton.setAttribute("accesskey", kSignonBundle.getString("removeAllShown.accesskey"));
}
function CopyPassword() {
@@ -721,8 +727,10 @@ function escapeKeyHandler() {
window.close();
}
+#if defined(MC_BASILISK) && defined(XP_WIN)
function OpenMigrator() {
const { MigrationUtils } = Cu.import("resource:///modules/MigrationUtils.jsm", {});
// We pass in the type of source we're using for use in telemetry:
MigrationUtils.showMigrationWizard(window, [MigrationUtils.MIGRATION_ENTRYPOINT_PASSWORDS]);
}
+#endif
diff --git a/toolkit/components/passwordmgr/content/passwordManager.xul b/toolkit/components/passwordmgr/content/passwordManager.xul
index d248283b67..c0a10bf8e6 100644
--- a/toolkit/components/passwordmgr/content/passwordManager.xul
+++ b/toolkit/components/passwordmgr/content/passwordManager.xul
@@ -110,10 +110,9 @@
label="&remove.label;" accesskey="&remove.accesskey;"
oncommand="DeleteSignon();"/>
<button id="removeAllSignons" icon="clear"
- label="&removeall.label;" accesskey="&removeall.accesskey;"
oncommand="DeleteAllSignons();"/>
<spacer flex="1"/>
-#if defined(MOZ_BUILD_APP_IS_BROWSER) && defined(XP_WIN)
+#if defined(MC_BASILISK) && defined(XP_WIN)
<button accesskey="&import.accesskey;"
label="&import.label;"
oncommand="OpenMigrator();"/>
diff --git a/toolkit/components/passwordmgr/jar.mn b/toolkit/components/passwordmgr/jar.mn
index 9fa574e493..db6d7ffefa 100644
--- a/toolkit/components/passwordmgr/jar.mn
+++ b/toolkit/components/passwordmgr/jar.mn
@@ -5,5 +5,5 @@
toolkit.jar:
% content passwordmgr %content/passwordmgr/
* content/passwordmgr/passwordManager.xul (content/passwordManager.xul)
- content/passwordmgr/passwordManager.js (content/passwordManager.js)
+* content/passwordmgr/passwordManager.js (content/passwordManager.js)
content/passwordmgr/recipes.json (content/recipes.json)
diff --git a/toolkit/components/passwordmgr/nsLoginManagerPrompter.js b/toolkit/components/passwordmgr/nsLoginManagerPrompter.js
index b66489234a..720e80446b 100644
--- a/toolkit/components/passwordmgr/nsLoginManagerPrompter.js
+++ b/toolkit/components/passwordmgr/nsLoginManagerPrompter.js
@@ -808,6 +808,9 @@ LoginManagerPrompter.prototype = {
*/
_showLoginCaptureDoorhanger(login, type) {
let { browser } = this._getNotifyWindow();
+ if (!browser) {
+ return;
+ }
let saveMsgNames = {
prompt: login.username === "" ? "rememberLoginMsgNoUser"
@@ -1405,10 +1408,34 @@ LoginManagerPrompter.prototype = {
* Given a content DOM window, returns the chrome window and browser it's in.
*/
_getChromeWindow: function (aWindow) {
+ // Handle non-e10s toolkit consumers.
+ if (!Cu.isCrossProcessWrapper(aWindow)) {
+ let chromeWin = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
+ .getInterface(Ci.nsIWebNavigation)
+ .QueryInterface(Ci.nsIDocShell)
+ .chromeEventHandler.ownerGlobal;
+ if (!chromeWin) {
+ return null;
+ }
+
+ // gBrowser only exists on some apps, like Firefox.
+ let tabbrowser = chromeWin.gBrowser ||
+ (typeof chromeWin.getBrowser == "function" ? chromeWin.getBrowser() : null);
+ // At least serve the chrome window if getBrowser()
+ // or getBrowserForContentWindow() are not supported.
+ if (!tabbrowser || typeof tabbrowser.getBrowserForContentWindow != "function") {
+ return { win: chromeWin };
+ }
+
+ let browser = tabbrowser.getBrowserForContentWindow(aWindow);
+ return { win: chromeWin, browser };
+ }
+
let windows = Services.wm.getEnumerator(null);
while (windows.hasMoreElements()) {
let win = windows.getNext();
- let browser = win.gBrowser.getBrowserForContentWindow(aWindow);
+ let tabbrowser = win.gBrowser || win.getBrowser();
+ let browser = tabbrowser.getBrowserForContentWindow(aWindow);
if (browser) {
return { win, browser };
}
diff --git a/toolkit/components/passwordmgr/test/unit/test_logins_search.js b/toolkit/components/passwordmgr/test/unit/test_logins_search.js
index 188c75039d..7307719812 100644
--- a/toolkit/components/passwordmgr/test/unit/test_logins_search.js
+++ b/toolkit/components/passwordmgr/test/unit/test_logins_search.js
@@ -192,7 +192,6 @@ add_task(function test_search_all_full_case_sensitive()
{
checkAllSearches({ hostname: "http://www.example.com" }, 1);
checkAllSearches({ hostname: "http://www.example.com/" }, 0);
- checkAllSearches({ hostname: "http://" }, 0);
checkAllSearches({ hostname: "example.com" }, 0);
checkAllSearches({ formSubmitURL: "http://www.example.com" }, 2);
diff --git a/toolkit/components/places/UnifiedComplete.js b/toolkit/components/places/UnifiedComplete.js
index ad3d35aab7..acd358b116 100644
--- a/toolkit/components/places/UnifiedComplete.js
+++ b/toolkit/components/places/UnifiedComplete.js
@@ -1245,7 +1245,7 @@ Search.prototype = {
// * If the protocol differs we should not match. For example if the user
// searched https we should not return http.
try {
- let prefixURI = NetUtil.newURI(this._strippedPrefix);
+ let prefixURI = NetUtil.newURI(this._strippedPrefix + match.token);
let finalURI = NetUtil.newURI(match.url);
if (prefixURI.scheme != finalURI.scheme)
return false;
diff --git a/toolkit/components/places/moz.build b/toolkit/components/places/moz.build
index adac79cba4..85e1e93e1e 100644
--- a/toolkit/components/places/moz.build
+++ b/toolkit/components/places/moz.build
@@ -78,6 +78,8 @@ if CONFIG['MOZ_PLACES']:
EXTRA_COMPONENTS += [
'ColorAnalyzer.js',
'nsLivemarkService.js',
+ 'nsPlacesAutoComplete.js',
+ 'nsPlacesAutoComplete.manifest',
'nsPlacesExpiration.js',
'nsTaggingService.js',
'PageIconProtocolHandler.js',
diff --git a/toolkit/components/places/nsNavBookmarks.cpp b/toolkit/components/places/nsNavBookmarks.cpp
index 74707be994..693aaf5db0 100644
--- a/toolkit/components/places/nsNavBookmarks.cpp
+++ b/toolkit/components/places/nsNavBookmarks.cpp
@@ -2518,8 +2518,6 @@ nsNavBookmarks::GetURIForKeyword(const nsAString& aUserCasedKeyword,
NS_ENSURE_TRUE(!aUserCasedKeyword.IsEmpty(), NS_ERROR_INVALID_ARG);
*aURI = nullptr;
- PLACES_WARN_DEPRECATED();
-
// Shortcuts are always lowercased internally.
nsAutoString keyword(aUserCasedKeyword);
ToLowerCase(keyword);
diff --git a/toolkit/components/places/nsNavHistory.cpp b/toolkit/components/places/nsNavHistory.cpp
index 8cf3a2e324..49d911d655 100644
--- a/toolkit/components/places/nsNavHistory.cpp
+++ b/toolkit/components/places/nsNavHistory.cpp
@@ -949,6 +949,10 @@ nsresult // static
nsNavHistory::AsciiHostNameFromHostString(const nsACString& aHostName,
nsACString& aAscii)
{
+ aAscii.Truncate();
+ if (aHostName.IsEmpty()) {
+ return NS_OK;
+ }
// To properly generate a uri we must provide a protocol.
nsAutoCString fakeURL("http://");
fakeURL.Append(aHostName);
@@ -2792,8 +2796,6 @@ nsNavHistory::MarkPageAsFollowedLink(nsIURI *aURI)
NS_IMETHODIMP
nsNavHistory::GetPageTitle(nsIURI* aURI, nsAString& aTitle)
{
- PLACES_WARN_DEPRECATED();
-
NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread");
NS_ENSURE_ARG(aURI);
diff --git a/toolkit/components/places/nsPlacesAutoComplete.js b/toolkit/components/places/nsPlacesAutoComplete.js
new file mode 100644
index 0000000000..29bdae4c1a
--- /dev/null
+++ b/toolkit/components/places/nsPlacesAutoComplete.js
@@ -0,0 +1,1778 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
+ * vim: sw=2 ts=2 sts=2 expandtab
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
+Components.utils.import("resource://gre/modules/Services.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
+ "resource://gre/modules/PlacesUtils.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
+ "resource://gre/modules/TelemetryStopwatch.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "NetUtil",
+ "resource://gre/modules/NetUtil.jsm");
+XPCOMUtils.defineLazyModuleGetter(this, "Task",
+ "resource://gre/modules/Task.jsm");
+
+////////////////////////////////////////////////////////////////////////////////
+//// Constants
+
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+const Cr = Components.results;
+
+// This SQL query fragment provides the following:
+// - whether the entry is bookmarked (kQueryIndexBookmarked)
+// - the bookmark title, if it is a bookmark (kQueryIndexBookmarkTitle)
+// - the tags associated with a bookmarked entry (kQueryIndexTags)
+const kBookTagSQLFragment =
+ `EXISTS(SELECT 1 FROM moz_bookmarks WHERE fk = h.id) AS bookmarked,
+ (
+ SELECT title FROM moz_bookmarks WHERE fk = h.id AND title NOTNULL
+ ORDER BY lastModified DESC LIMIT 1
+ ) AS btitle,
+ (
+ SELECT GROUP_CONCAT(t.title, ',')
+ FROM moz_bookmarks b
+ JOIN moz_bookmarks t ON t.id = +b.parent AND t.parent = :parent
+ WHERE b.fk = h.id
+ ) AS tags`;
+
+// observer topics
+const kTopicShutdown = "places-shutdown";
+const kPrefChanged = "nsPref:changed";
+
+// Match type constants. These indicate what type of search function we should
+// be using.
+const MATCH_ANYWHERE = Ci.mozIPlacesAutoComplete.MATCH_ANYWHERE;
+const MATCH_BOUNDARY_ANYWHERE = Ci.mozIPlacesAutoComplete.MATCH_BOUNDARY_ANYWHERE;
+const MATCH_BOUNDARY = Ci.mozIPlacesAutoComplete.MATCH_BOUNDARY;
+const MATCH_BEGINNING = Ci.mozIPlacesAutoComplete.MATCH_BEGINNING;
+const MATCH_BEGINNING_CASE_SENSITIVE = Ci.mozIPlacesAutoComplete.MATCH_BEGINNING_CASE_SENSITIVE;
+
+// AutoComplete index constants. All AutoComplete queries will provide these
+// columns in this order.
+const kQueryIndexURL = 0;
+const kQueryIndexTitle = 1;
+const kQueryIndexFaviconURL = 2;
+const kQueryIndexBookmarked = 3;
+const kQueryIndexBookmarkTitle = 4;
+const kQueryIndexTags = 5;
+const kQueryIndexVisitCount = 6;
+const kQueryIndexTyped = 7;
+const kQueryIndexPlaceId = 8;
+const kQueryIndexQueryType = 9;
+const kQueryIndexOpenPageCount = 10;
+
+// AutoComplete query type constants. Describes the various types of queries
+// that we can process.
+const kQueryTypeKeyword = 0;
+const kQueryTypeFiltered = 1;
+
+// This separator is used as an RTL-friendly way to split the title and tags.
+// It can also be used by an nsIAutoCompleteResult consumer to re-split the
+// "comment" back into the title and the tag.
+const kTitleTagsSeparator = " \u2013 ";
+
+const kBrowserUrlbarBranch = "browser.urlbar.";
+// Toggle autocomplete.
+const kBrowserUrlbarAutocompleteEnabledPref = "autocomplete.enabled";
+// Toggle autoFill.
+const kBrowserUrlbarAutofillPref = "autoFill";
+// Whether to search only typed entries.
+const kBrowserUrlbarAutofillTypedPref = "autoFill.typed";
+
+// The Telemetry histogram for urlInlineComplete query on domain
+const DOMAIN_QUERY_TELEMETRY = "PLACES_AUTOCOMPLETE_URLINLINE_DOMAIN_QUERY_TIME_MS";
+
+////////////////////////////////////////////////////////////////////////////////
+//// Globals
+
+XPCOMUtils.defineLazyServiceGetter(this, "gTextURIService",
+ "@mozilla.org/intl/texttosuburi;1",
+ "nsITextToSubURI");
+
+////////////////////////////////////////////////////////////////////////////////
+//// Helpers
+
+/**
+ * Initializes our temporary table on a given database.
+ *
+ * @param aDatabase
+ * The mozIStorageConnection to set up the temp table on.
+ */
+function initTempTable(aDatabase)
+{
+ // Note: this should be kept up-to-date with the definition in
+ // nsPlacesTables.h.
+ let stmt = aDatabase.createAsyncStatement(
+ `CREATE TEMP TABLE moz_openpages_temp (
+ url TEXT PRIMARY KEY
+ , open_count INTEGER
+ )`
+ );
+ stmt.executeAsync();
+ stmt.finalize();
+
+ // Note: this should be kept up-to-date with the definition in
+ // nsPlacesTriggers.h.
+ stmt = aDatabase.createAsyncStatement(
+ `CREATE TEMPORARY TRIGGER moz_openpages_temp_afterupdate_trigger
+ AFTER UPDATE OF open_count ON moz_openpages_temp FOR EACH ROW
+ WHEN NEW.open_count = 0
+ BEGIN
+ DELETE FROM moz_openpages_temp
+ WHERE url = NEW.url;
+ END`
+ );
+ stmt.executeAsync();
+ stmt.finalize();
+}
+
+/**
+ * Used to unescape encoded URI strings, and drop information that we do not
+ * care about for searching.
+ *
+ * @param aURIString
+ * The text to unescape and modify.
+ * @return the modified uri.
+ */
+function fixupSearchText(aURIString)
+{
+ let uri = stripPrefix(aURIString);
+ return gTextURIService.unEscapeURIForUI("UTF-8", uri);
+}
+
+/**
+ * Strip prefixes from the URI that we don't care about for searching.
+ *
+ * @param aURIString
+ * The text to modify.
+ * @return the modified uri.
+ */
+function stripPrefix(aURIString)
+{
+ let uri = aURIString;
+
+ if (uri.indexOf("http://") == 0) {
+ uri = uri.slice(7);
+ }
+ else if (uri.indexOf("https://") == 0) {
+ uri = uri.slice(8);
+ }
+ else if (uri.indexOf("ftp://") == 0) {
+ uri = uri.slice(6);
+ }
+
+ if (uri.indexOf("www.") == 0) {
+ uri = uri.slice(4);
+ }
+ return uri;
+}
+
+/**
+ * safePrefGetter get the pref with type safety.
+ * This will return the default value provided if no pref is set.
+ *
+ * @param aPrefBranch
+ * The nsIPrefBranch containing the required preference
+ * @param aName
+ * A preference name
+ * @param aDefault
+ * The preference's default value
+ * @return the preference value or provided default
+ */
+
+function safePrefGetter(aPrefBranch, aName, aDefault) {
+ let types = {
+ boolean: "Bool",
+ number: "Int",
+ string: "Char"
+ };
+ let type = types[typeof(aDefault)];
+ if (!type) {
+ throw "Unknown type!";
+ }
+
+ // If the pref isn't set, we want to use the default.
+ if (aPrefBranch.getPrefType(aName) == Ci.nsIPrefBranch.PREF_INVALID) {
+ return aDefault;
+ }
+ try {
+ return aPrefBranch["get" + type + "Pref"](aName);
+ }
+ catch (e) {
+ return aDefault;
+ }
+}
+
+/**
+ * Whether UnifiedComplete is alive.
+ */
+function isUnifiedCompleteInstantiated() {
+ try {
+ return Components.manager.QueryInterface(Ci.nsIServiceManager)
+ .isServiceInstantiated(Cc["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"],
+ Ci.mozIPlacesAutoComplete);
+ } catch (ex) {
+ return false;
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+//// AutoCompleteStatementCallbackWrapper class
+
+/**
+ * Wraps a callback and ensures that handleCompletion is not dispatched if the
+ * query is no longer tracked.
+ *
+ * @param aAutocomplete
+ * A reference to a nsPlacesAutoComplete.
+ * @param aCallback
+ * A reference to a mozIStorageStatementCallback
+ * @param aDBConnection
+ * The database connection to execute the queries on.
+ */
+function AutoCompleteStatementCallbackWrapper(aAutocomplete, aCallback,
+ aDBConnection)
+{
+ this._autocomplete = aAutocomplete;
+ this._callback = aCallback;
+ this._db = aDBConnection;
+}
+
+AutoCompleteStatementCallbackWrapper.prototype = {
+ //////////////////////////////////////////////////////////////////////////////
+ //// mozIStorageStatementCallback
+
+ handleResult: function ACSCW_handleResult(aResultSet)
+ {
+ this._callback.handleResult.apply(this._callback, arguments);
+ },
+
+ handleError: function ACSCW_handleError(aError)
+ {
+ this._callback.handleError.apply(this._callback, arguments);
+ },
+
+ handleCompletion: function ACSCW_handleCompletion(aReason)
+ {
+ // Only dispatch handleCompletion if we are not done searching and are a
+ // pending search.
+ if (!this._autocomplete.isSearchComplete() &&
+ this._autocomplete.isPendingSearch(this._handle)) {
+ this._callback.handleCompletion.apply(this._callback, arguments);
+ }
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// AutoCompleteStatementCallbackWrapper
+
+ /**
+ * Executes the specified query asynchronously. This object will notify
+ * this._callback if we should notify (logic explained in handleCompletion).
+ *
+ * @param aQueries
+ * The queries to execute asynchronously.
+ * @return a mozIStoragePendingStatement that can be used to cancel the
+ * queries.
+ */
+ executeAsync: function ACSCW_executeAsync(aQueries)
+ {
+ return this._handle = this._db.executeAsync(aQueries, aQueries.length,
+ this);
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// nsISupports
+
+ QueryInterface: XPCOMUtils.generateQI([
+ Ci.mozIStorageStatementCallback,
+ ])
+};
+
+////////////////////////////////////////////////////////////////////////////////
+//// nsPlacesAutoComplete class
+//// @mozilla.org/autocomplete/search;1?name=history
+
+function nsPlacesAutoComplete()
+{
+ //////////////////////////////////////////////////////////////////////////////
+ //// Shared Constants for Smart Getters
+
+ // TODO bug 412736 in case of a frecency tie, break it with h.typed and
+ // h.visit_count which is better than nothing. This is slow, so not doing it
+ // yet...
+ function baseQuery(conditions = "") {
+ let query = `SELECT h.url, h.title, f.url, ${kBookTagSQLFragment},
+ h.visit_count, h.typed, h.id, :query_type,
+ t.open_count
+ FROM moz_places h
+ LEFT JOIN moz_favicons f ON f.id = h.favicon_id
+ LEFT JOIN moz_openpages_temp t ON t.url = h.url
+ WHERE h.frecency <> 0
+ AND AUTOCOMPLETE_MATCH(:searchString, h.url,
+ IFNULL(btitle, h.title), tags,
+ h.visit_count, h.typed,
+ bookmarked, t.open_count,
+ :matchBehavior, :searchBehavior)
+ ${conditions}
+ ORDER BY h.frecency DESC, h.id DESC
+ LIMIT :maxResults`;
+ return query;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// Smart Getters
+
+ XPCOMUtils.defineLazyGetter(this, "_db", function() {
+ // Get a cloned, read-only version of the database. We'll only ever write
+ // to our own in-memory temp table, and having a cloned copy means we do not
+ // run the risk of our queries taking longer due to the main database
+ // connection performing a long-running task.
+ let db = PlacesUtils.history.DBConnection.clone(true);
+
+ // Autocomplete often fallbacks to a table scan due to lack of text indices.
+ // In such cases a larger cache helps reducing IO. The default Storage
+ // value is MAX_CACHE_SIZE_BYTES in storage/mozStorageConnection.cpp.
+ let stmt = db.createAsyncStatement("PRAGMA cache_size = -6144"); // 6MiB
+ stmt.executeAsync();
+ stmt.finalize();
+
+ // Create our in-memory tables for tab tracking.
+ initTempTable(db);
+
+ // Populate the table with current open pages cache contents.
+ if (this._openPagesCache.length > 0) {
+ // Avoid getter re-entrance from the _registerOpenPageQuery lazy getter.
+ let stmt = this._registerOpenPageQuery =
+ db.createAsyncStatement(this._registerOpenPageQuerySQL);
+ let params = stmt.newBindingParamsArray();
+ for (let i = 0; i < this._openPagesCache.length; i++) {
+ let bp = params.newBindingParams();
+ bp.bindByName("page_url", this._openPagesCache[i]);
+ params.addParams(bp);
+ }
+ stmt.bindParameters(params);
+ stmt.executeAsync();
+ stmt.finalize();
+ delete this._openPagesCache;
+ }
+
+ return db;
+ });
+
+ this._customQuery = (conditions = "") => {
+ return this._db.createAsyncStatement(baseQuery(conditions));
+ };
+
+ XPCOMUtils.defineLazyGetter(this, "_defaultQuery", function() {
+ return this._db.createAsyncStatement(baseQuery());
+ });
+
+ XPCOMUtils.defineLazyGetter(this, "_historyQuery", function() {
+ // Enforce ignoring the visit_count index, since the frecency one is much
+ // faster in this case. ANALYZE helps the query planner to figure out the
+ // faster path, but it may not have run yet.
+ return this._db.createAsyncStatement(baseQuery("AND +h.visit_count > 0"));
+ });
+
+ XPCOMUtils.defineLazyGetter(this, "_bookmarkQuery", function() {
+ return this._db.createAsyncStatement(baseQuery("AND bookmarked"));
+ });
+
+ XPCOMUtils.defineLazyGetter(this, "_tagsQuery", function() {
+ return this._db.createAsyncStatement(baseQuery("AND tags IS NOT NULL"));
+ });
+
+ XPCOMUtils.defineLazyGetter(this, "_openPagesQuery", function() {
+ return this._db.createAsyncStatement(
+ `SELECT t.url, t.url, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ :query_type, t.open_count, NULL
+ FROM moz_openpages_temp t
+ LEFT JOIN moz_places h ON h.url = t.url
+ WHERE h.id IS NULL
+ AND AUTOCOMPLETE_MATCH(:searchString, t.url, t.url, NULL,
+ NULL, NULL, NULL, t.open_count,
+ :matchBehavior, :searchBehavior)
+ ORDER BY t.ROWID DESC
+ LIMIT :maxResults`
+ );
+ });
+
+ XPCOMUtils.defineLazyGetter(this, "_typedQuery", function() {
+ return this._db.createAsyncStatement(baseQuery("AND h.typed = 1"));
+ });
+
+ XPCOMUtils.defineLazyGetter(this, "_adaptiveQuery", function() {
+ return this._db.createAsyncStatement(
+ `/* do not warn (bug 487789) */
+ SELECT h.url, h.title, f.url, ${kBookTagSQLFragment},
+ h.visit_count, h.typed, h.id, :query_type, t.open_count
+ FROM (
+ SELECT ROUND(
+ MAX(use_count) * (1 + (input = :search_string)), 1
+ ) AS rank, place_id
+ FROM moz_inputhistory
+ WHERE input BETWEEN :search_string AND :search_string || X'FFFF'
+ GROUP BY place_id
+ ) AS i
+ JOIN moz_places h ON h.id = i.place_id
+ LEFT JOIN moz_favicons f ON f.id = h.favicon_id
+ LEFT JOIN moz_openpages_temp t ON t.url = h.url
+ WHERE AUTOCOMPLETE_MATCH(NULL, h.url,
+ IFNULL(btitle, h.title), tags,
+ h.visit_count, h.typed, bookmarked,
+ t.open_count,
+ :matchBehavior, :searchBehavior)
+ ORDER BY rank DESC, h.frecency DESC`
+ );
+ });
+
+ XPCOMUtils.defineLazyGetter(this, "_keywordQuery", function() {
+ return this._db.createAsyncStatement(
+ `/* do not warn (bug 487787) */
+ SELECT REPLACE(h.url, '%s', :query_string) AS search_url, h.title,
+ IFNULL(f.url, (SELECT f.url
+ FROM moz_places
+ JOIN moz_favicons f ON f.id = favicon_id
+ WHERE rev_host = h.rev_host
+ ORDER BY frecency DESC
+ LIMIT 1)
+ ), 1, NULL, NULL, h.visit_count, h.typed, h.id,
+ :query_type, t.open_count
+ FROM moz_keywords k
+ JOIN moz_places h ON k.place_id = h.id
+ LEFT JOIN moz_favicons f ON f.id = h.favicon_id
+ LEFT JOIN moz_openpages_temp t ON t.url = search_url
+ WHERE k.keyword = LOWER(:keyword)`
+ );
+ });
+
+ this._registerOpenPageQuerySQL =
+ `INSERT OR REPLACE INTO moz_openpages_temp (url, open_count)
+ VALUES (:page_url,
+ IFNULL(
+ (
+ SELECT open_count + 1
+ FROM moz_openpages_temp
+ WHERE url = :page_url
+ ),
+ 1
+ )
+ )`;
+ XPCOMUtils.defineLazyGetter(this, "_registerOpenPageQuery", function() {
+ return this._db.createAsyncStatement(this._registerOpenPageQuerySQL);
+ });
+
+ XPCOMUtils.defineLazyGetter(this, "_unregisterOpenPageQuery", function() {
+ return this._db.createAsyncStatement(
+ `UPDATE moz_openpages_temp
+ SET open_count = open_count - 1
+ WHERE url = :page_url`
+ );
+ });
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// Initialization
+
+ // load preferences
+ this._prefs = Cc["@mozilla.org/preferences-service;1"].
+ getService(Ci.nsIPrefService).
+ getBranch(kBrowserUrlbarBranch);
+ this._syncEnabledPref();
+ this._loadPrefs(true);
+
+ // register observers
+ this._os = Cc["@mozilla.org/observer-service;1"].
+ getService(Ci.nsIObserverService);
+ this._os.addObserver(this, kTopicShutdown, false);
+
+}
+
+nsPlacesAutoComplete.prototype = {
+ //////////////////////////////////////////////////////////////////////////////
+ //// nsIAutoCompleteSearch
+
+ startSearch: function PAC_startSearch(aSearchString, aSearchParam,
+ aPreviousResult, aListener)
+ {
+ // Stop the search in case the controller has not taken care of it.
+ this.stopSearch();
+
+ // Note: We don't use aPreviousResult to make sure ordering of results are
+ // consistent. See bug 412730 for more details.
+
+ // We want to store the original string with no leading or trailing
+ // whitespace for case sensitive searches.
+ this._originalSearchString = aSearchString.trim();
+
+ this._currentSearchString =
+ fixupSearchText(this._originalSearchString.toLowerCase());
+
+ let params = new Set(aSearchParam.split(" "));
+ this._enableActions = params.has("enable-actions");
+ this._disablePrivateActions = params.has("disable-private-actions");
+
+ this._listener = aListener;
+ let result = Cc["@mozilla.org/autocomplete/simple-result;1"].
+ createInstance(Ci.nsIAutoCompleteSimpleResult);
+ result.setSearchString(aSearchString);
+ result.setListener(this);
+ this._result = result;
+
+ // If we are not enabled, we need to return now.
+ if (!this._enabled) {
+ this._finishSearch(true);
+ return;
+ }
+
+ // Reset our search behavior to the default.
+ if (this._currentSearchString) {
+ this._behavior = this._defaultBehavior;
+ }
+ else {
+ this._behavior = this._emptySearchDefaultBehavior;
+ }
+ // For any given search, we run up to four queries:
+ // 1) keywords (this._keywordQuery)
+ // 2) adaptive learning (this._adaptiveQuery)
+ // 3) open pages not supported by history (this._openPagesQuery)
+ // 4) query from this._getSearch
+ // (1) only gets ran if we get any filtered tokens from this._getSearch,
+ // since if there are no tokens, there is nothing to match, so there is no
+ // reason to run the query).
+ let {query, tokens} =
+ this._getSearch(this._getUnfilteredSearchTokens(this._currentSearchString));
+ let queries = tokens.length ?
+ [this._getBoundKeywordQuery(tokens), this._getBoundAdaptiveQuery()] :
+ [this._getBoundAdaptiveQuery()];
+
+ if (this._hasBehavior("openpage")) {
+ queries.push(this._getBoundOpenPagesQuery(tokens));
+ }
+ queries.push(query);
+
+ // Start executing our queries.
+ this._telemetryStartTime = Date.now();
+ this._executeQueries(queries);
+
+ // Set up our persistent state for the duration of the search.
+ this._searchTokens = tokens;
+ this._usedPlaces = {};
+ },
+
+ stopSearch: function PAC_stopSearch()
+ {
+ // We need to cancel our searches so we do not get any [more] results.
+ // However, it's possible we haven't actually started any searches, so this
+ // method may throw because this._pendingQuery may be undefined.
+ if (this._pendingQuery) {
+ this._stopActiveQuery();
+ }
+
+ this._finishSearch(false);
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// nsIAutoCompleteSimpleResultListener
+
+ onValueRemoved: function PAC_onValueRemoved(aResult, aURISpec, aRemoveFromDB)
+ {
+ if (aRemoveFromDB) {
+ PlacesUtils.history.removePage(NetUtil.newURI(aURISpec));
+ }
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// mozIPlacesAutoComplete
+
+ // If the connection has not yet been started, use this local cache. This
+ // prevents autocomplete from initing the database till the first search.
+ _openPagesCache: [],
+ registerOpenPage: function PAC_registerOpenPage(aURI)
+ {
+ if (!this._databaseInitialized) {
+ this._openPagesCache.push(aURI.spec);
+ return;
+ }
+
+ let stmt = this._registerOpenPageQuery;
+ stmt.params.page_url = aURI.spec;
+ stmt.executeAsync();
+ },
+
+ unregisterOpenPage: function PAC_unregisterOpenPage(aURI)
+ {
+ if (!this._databaseInitialized) {
+ let index = this._openPagesCache.indexOf(aURI.spec);
+ if (index != -1) {
+ this._openPagesCache.splice(index, 1);
+ }
+ return;
+ }
+
+ let stmt = this._unregisterOpenPageQuery;
+ stmt.params.page_url = aURI.spec;
+ stmt.executeAsync();
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// mozIStorageStatementCallback
+
+ handleResult: function PAC_handleResult(aResultSet)
+ {
+ let row, haveMatches = false;
+ while ((row = aResultSet.getNextRow())) {
+ let match = this._processRow(row);
+ haveMatches = haveMatches || match;
+
+ if (this._result.matchCount == this._maxRichResults) {
+ // We have enough results, so stop running our search.
+ this._stopActiveQuery();
+
+ // And finish our search.
+ this._finishSearch(true);
+ return;
+ }
+
+ }
+
+ // Notify about results if we've gotten them.
+ if (haveMatches) {
+ this._notifyResults(true);
+ }
+ },
+
+ handleError: function PAC_handleError(aError)
+ {
+ Components.utils.reportError("Places AutoComplete: An async statement encountered an " +
+ "error: " + aError.result + ", '" + aError.message + "'");
+ },
+
+ handleCompletion: function PAC_handleCompletion(aReason)
+ {
+ // If we have already finished our search, we should bail out early.
+ if (this.isSearchComplete()) {
+ return;
+ }
+
+ // If we do not have enough results, and our match type is
+ // MATCH_BOUNDARY_ANYWHERE, search again with MATCH_ANYWHERE to get more
+ // results.
+ if (this._matchBehavior == MATCH_BOUNDARY_ANYWHERE &&
+ this._result.matchCount < this._maxRichResults && !this._secondPass) {
+ this._secondPass = true;
+ let queries = [
+ this._getBoundAdaptiveQuery(MATCH_ANYWHERE),
+ this._getBoundSearchQuery(MATCH_ANYWHERE, this._searchTokens),
+ ];
+ this._executeQueries(queries);
+ return;
+ }
+
+ this._finishSearch(true);
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// nsIObserver
+
+ observe: function PAC_observe(aSubject, aTopic, aData)
+ {
+ if (aTopic == kTopicShutdown) {
+ this._os.removeObserver(this, kTopicShutdown);
+
+ // Remove our preference observer.
+ this._prefs.removeObserver("", this);
+ delete this._prefs;
+
+ // Finalize the statements that we have used.
+ let stmts = [
+ "_defaultQuery",
+ "_historyQuery",
+ "_bookmarkQuery",
+ "_tagsQuery",
+ "_openPagesQuery",
+ "_typedQuery",
+ "_adaptiveQuery",
+ "_keywordQuery",
+ "_registerOpenPageQuery",
+ "_unregisterOpenPageQuery",
+ ];
+ for (let i = 0; i < stmts.length; i++) {
+ // We do not want to create any query we haven't already created, so
+ // see if it is a getter first.
+ if (Object.getOwnPropertyDescriptor(this, stmts[i]).value !== undefined) {
+ this[stmts[i]].finalize();
+ }
+ }
+
+ if (this._databaseInitialized) {
+ this._db.asyncClose();
+ }
+ }
+ else if (aTopic == kPrefChanged) {
+ // Avoid re-entrancy when flipping linked preferences.
+ if (this._ignoreNotifications)
+ return;
+ this._ignoreNotifications = true;
+ this._loadPrefs(false, aTopic, aData);
+ this._ignoreNotifications = false;
+ }
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// nsPlacesAutoComplete
+
+ get _databaseInitialized() {
+ return Object.getOwnPropertyDescriptor(this, "_db").value !== undefined;
+ },
+
+ /**
+ * Generates the tokens used in searching from a given string.
+ *
+ * @param aSearchString
+ * The string to generate tokens from.
+ * @return an array of tokens.
+ */
+ _getUnfilteredSearchTokens: function PAC_unfilteredSearchTokens(aSearchString)
+ {
+ // Calling split on an empty string will return an array containing one
+ // empty string. We don't want that, as it'll break our logic, so return an
+ // empty array then.
+ return aSearchString.length ? aSearchString.split(" ") : [];
+ },
+
+ /**
+ * Properly cleans up when searching is completed.
+ *
+ * @param aNotify
+ * Indicates if we should notify the AutoComplete listener about our
+ * results or not.
+ */
+ _finishSearch: function PAC_finishSearch(aNotify)
+ {
+ // Notify about results if we are supposed to.
+ if (aNotify) {
+ this._notifyResults(false);
+ }
+
+ // Clear our state
+ delete this._originalSearchString;
+ delete this._currentSearchString;
+ delete this._strippedPrefix;
+ delete this._searchTokens;
+ delete this._listener;
+ delete this._result;
+ delete this._usedPlaces;
+ delete this._pendingQuery;
+ this._secondPass = false;
+ this._enableActions = false;
+ },
+
+ /**
+ * Executes the given queries asynchronously.
+ *
+ * @param aQueries
+ * The queries to execute.
+ */
+ _executeQueries: function PAC_executeQueries(aQueries)
+ {
+ // Because we might get a handleCompletion for canceled queries, we want to
+ // filter out queries we no longer care about (described in the
+ // handleCompletion implementation of AutoCompleteStatementCallbackWrapper).
+
+ // Create our wrapper object and execute the queries.
+ let wrapper = new AutoCompleteStatementCallbackWrapper(this, this, this._db);
+ this._pendingQuery = wrapper.executeAsync(aQueries);
+ },
+
+ /**
+ * Stops executing our active query.
+ */
+ _stopActiveQuery: function PAC_stopActiveQuery()
+ {
+ this._pendingQuery.cancel();
+ delete this._pendingQuery;
+ },
+
+ /**
+ * Notifies the listener about results.
+ *
+ * @param aSearchOngoing
+ * Indicates if the search is ongoing or not.
+ */
+ _notifyResults: function PAC_notifyResults(aSearchOngoing)
+ {
+ let result = this._result;
+ let resultCode = result.matchCount ? "RESULT_SUCCESS" : "RESULT_NOMATCH";
+ if (aSearchOngoing) {
+ resultCode += "_ONGOING";
+ }
+ result.setSearchResult(Ci.nsIAutoCompleteResult[resultCode]);
+ this._listener.onSearchResult(this, result);
+ if (this._telemetryStartTime) {
+ let elapsed = Date.now() - this._telemetryStartTime;
+ if (elapsed > 50) {
+ try {
+ Services.telemetry
+ .getHistogramById("PLACES_AUTOCOMPLETE_1ST_RESULT_TIME_MS")
+ .add(elapsed);
+ } catch (ex) {
+ Components.utils.reportError("Unable to report telemetry.");
+ }
+ }
+ this._telemetryStartTime = null;
+ }
+ },
+
+ /**
+ * Synchronize suggest.* prefs with autocomplete.enabled.
+ */
+ _syncEnabledPref: function PAC_syncEnabledPref()
+ {
+ let suggestPrefs = ["suggest.history", "suggest.bookmark", "suggest.openpage"];
+ let types = ["History", "Bookmark", "Openpage"];
+
+ this._enabled = safePrefGetter(this._prefs, kBrowserUrlbarAutocompleteEnabledPref,
+ true);
+ this._suggestHistory = safePrefGetter(this._prefs, "suggest.history", true);
+ this._suggestBookmark = safePrefGetter(this._prefs, "suggest.bookmark", true);
+ this._suggestOpenpage = safePrefGetter(this._prefs, "suggest.openpage", true);
+
+ if (this._enabled) {
+ // If the autocomplete preference is active, activate all suggest
+ // preferences only if all of them are false.
+ if (types.every(type => this["_suggest" + type] == false)) {
+ for (let type of suggestPrefs) {
+ this._prefs.setBoolPref(type, true);
+ }
+ }
+ } else {
+ // If the preference was deactivated, deactivate all suggest preferences.
+ for (let type of suggestPrefs) {
+ this._prefs.setBoolPref(type, false);
+ }
+ }
+ },
+
+ /**
+ * Loads the preferences that we care about.
+ *
+ * @param [optional] aRegisterObserver
+ * Indicates if the preference observer should be added or not. The
+ * default value is false.
+ * @param [optional] aTopic
+ * Observer's topic, if any.
+ * @param [optional] aSubject
+ * Observer's subject, if any.
+ */
+ _loadPrefs: function PAC_loadPrefs(aRegisterObserver, aTopic, aData)
+ {
+ // Avoid race conditions with UnifiedComplete component.
+ if (aData && !isUnifiedCompleteInstantiated()) {
+ // Synchronize suggest.* prefs with autocomplete.enabled.
+ if (aData == kBrowserUrlbarAutocompleteEnabledPref) {
+ this._syncEnabledPref();
+ } else if (aData.startsWith("suggest.")) {
+ let suggestPrefs = ["suggest.history", "suggest.bookmark", "suggest.openpage"];
+ this._prefs.setBoolPref(kBrowserUrlbarAutocompleteEnabledPref,
+ suggestPrefs.some(pref => safePrefGetter(this._prefs, pref, true)));
+ }
+ }
+
+ this._enabled = safePrefGetter(this._prefs,
+ kBrowserUrlbarAutocompleteEnabledPref,
+ true);
+ this._matchBehavior = safePrefGetter(this._prefs,
+ "matchBehavior",
+ MATCH_BOUNDARY_ANYWHERE);
+ this._filterJavaScript = safePrefGetter(this._prefs, "filter.javascript", true);
+ this._maxRichResults = safePrefGetter(this._prefs, "maxRichResults", 25);
+ this._restrictHistoryToken = safePrefGetter(this._prefs,
+ "restrict.history", "^");
+ this._restrictBookmarkToken = safePrefGetter(this._prefs,
+ "restrict.bookmark", "*");
+ this._restrictTypedToken = safePrefGetter(this._prefs, "restrict.typed", "~");
+ this._restrictTagToken = safePrefGetter(this._prefs, "restrict.tag", "+");
+ this._restrictOpenPageToken = safePrefGetter(this._prefs,
+ "restrict.openpage", "%");
+ this._matchTitleToken = safePrefGetter(this._prefs, "match.title", "#");
+ this._matchURLToken = safePrefGetter(this._prefs, "match.url", "@");
+
+ this._suggestHistory = safePrefGetter(this._prefs, "suggest.history", true);
+ this._suggestBookmark = safePrefGetter(this._prefs, "suggest.bookmark", true);
+ this._suggestOpenpage = safePrefGetter(this._prefs, "suggest.openpage", true);
+ this._suggestTyped = safePrefGetter(this._prefs, "suggest.history.onlyTyped", false);
+
+ // If history is not set, onlyTyped value should be ignored.
+ if (!this._suggestHistory) {
+ this._suggestTyped = false;
+ }
+ let types = ["History", "Bookmark", "Openpage", "Typed"];
+ this._defaultBehavior = types.reduce((memo, type) => {
+ let prefValue = this["_suggest" + type];
+ return memo | (prefValue &&
+ Ci.mozIPlacesAutoComplete["BEHAVIOR_" + type.toUpperCase()]);
+ }, 0);
+
+ // Further restrictions to apply for "empty searches" (i.e. searches for "").
+ // The empty behavior is typed history, if history is enabled. Otherwise,
+ // it is bookmarks, if they are enabled. If both history and bookmarks are disabled,
+ // it defaults to open pages.
+ this._emptySearchDefaultBehavior = Ci.mozIPlacesAutoComplete.BEHAVIOR_RESTRICT;
+ if (this._suggestHistory) {
+ this._emptySearchDefaultBehavior |= Ci.mozIPlacesAutoComplete.BEHAVIOR_HISTORY |
+ Ci.mozIPlacesAutoComplete.BEHAVIOR_TYPED;
+ } else if (this._suggestBookmark) {
+ this._emptySearchDefaultBehavior |= Ci.mozIPlacesAutoComplete.BEHAVIOR_BOOKMARK;
+ } else {
+ this._emptySearchDefaultBehavior |= Ci.mozIPlacesAutoComplete.BEHAVIOR_OPENPAGE;
+ }
+
+ // Validate matchBehavior; default to MATCH_BOUNDARY_ANYWHERE.
+ if (this._matchBehavior != MATCH_ANYWHERE &&
+ this._matchBehavior != MATCH_BOUNDARY &&
+ this._matchBehavior != MATCH_BEGINNING) {
+ this._matchBehavior = MATCH_BOUNDARY_ANYWHERE;
+ }
+ // register observer
+ if (aRegisterObserver) {
+ this._prefs.addObserver("", this, false);
+ }
+ },
+
+ /**
+ * Given an array of tokens, this function determines which query should be
+ * ran. It also removes any special search tokens.
+ *
+ * @param aTokens
+ * An array of search tokens.
+ * @return an object with two properties:
+ * query: the correctly optimized, bound query to search the database
+ * with.
+ * tokens: the filtered list of tokens to search with.
+ */
+ _getSearch: function PAC_getSearch(aTokens)
+ {
+ let foundToken = false;
+ let restrict = (behavior) => {
+ if (!foundToken) {
+ this._behavior = 0;
+ this._setBehavior("restrict");
+ foundToken = true;
+ }
+ this._setBehavior(behavior);
+ };
+
+ // Set the proper behavior so our call to _getBoundSearchQuery gives us the
+ // correct query.
+ for (let i = aTokens.length - 1; i >= 0; i--) {
+ switch (aTokens[i]) {
+ case this._restrictHistoryToken:
+ restrict("history");
+ break;
+ case this._restrictBookmarkToken:
+ restrict("bookmark");
+ break;
+ case this._restrictTagToken:
+ restrict("tag");
+ break;
+ case this._restrictOpenPageToken:
+ if (!this._enableActions) {
+ continue;
+ }
+ restrict("openpage");
+ break;
+ case this._matchTitleToken:
+ restrict("title");
+ break;
+ case this._matchURLToken:
+ restrict("url");
+ break;
+ case this._restrictTypedToken:
+ restrict("typed");
+ break;
+ default:
+ // We do not want to remove the token if we did not match.
+ continue;
+ }
+
+ aTokens.splice(i, 1);
+ }
+
+ // Set the right JavaScript behavior based on our preference. Note that the
+ // preference is whether or not we should filter JavaScript, and the
+ // behavior is if we should search it or not.
+ if (!this._filterJavaScript) {
+ this._setBehavior("javascript");
+ }
+
+ return {
+ query: this._getBoundSearchQuery(this._matchBehavior, aTokens),
+ tokens: aTokens
+ };
+ },
+
+ /**
+ * @return a string consisting of the search query to be used based on the
+ * previously set urlbar suggestion preferences.
+ */
+ _getSuggestionPrefQuery: function PAC_getSuggestionPrefQuery()
+ {
+ if (!this._hasBehavior("restrict") && this._hasBehavior("history") &&
+ this._hasBehavior("bookmark")) {
+ return this._hasBehavior("typed") ? this._customQuery("AND h.typed = 1")
+ : this._defaultQuery;
+ }
+ let conditions = [];
+ if (this._hasBehavior("history")) {
+ // Enforce ignoring the visit_count index, since the frecency one is much
+ // faster in this case. ANALYZE helps the query planner to figure out the
+ // faster path, but it may not have up-to-date information yet.
+ conditions.push("+h.visit_count > 0");
+ }
+ if (this._hasBehavior("typed")) {
+ conditions.push("h.typed = 1");
+ }
+ if (this._hasBehavior("bookmark")) {
+ conditions.push("bookmarked");
+ }
+ if (this._hasBehavior("tag")) {
+ conditions.push("tags NOTNULL");
+ }
+
+ return conditions.length ? this._customQuery("AND " + conditions.join(" AND "))
+ : this._defaultQuery;
+ },
+
+ /**
+ * Obtains the search query to be used based on the previously set search
+ * behaviors (accessed by this._hasBehavior). The query is bound and ready to
+ * execute.
+ *
+ * @param aMatchBehavior
+ * How this query should match its tokens to the search string.
+ * @param aTokens
+ * An array of search tokens.
+ * @return the correctly optimized query to search the database with and the
+ * new list of tokens to search with. The query has all the needed
+ * parameters bound, so consumers can execute it without doing any
+ * additional work.
+ */
+ _getBoundSearchQuery: function PAC_getBoundSearchQuery(aMatchBehavior,
+ aTokens)
+ {
+ let query = this._getSuggestionPrefQuery();
+
+ // Bind the needed parameters to the query so consumers can use it.
+ let params = query.params;
+ params.parent = PlacesUtils.tagsFolderId;
+ params.query_type = kQueryTypeFiltered;
+ params.matchBehavior = aMatchBehavior;
+ params.searchBehavior = this._behavior;
+
+ // We only want to search the tokens that we are left with - not the
+ // original search string.
+ params.searchString = aTokens.join(" ");
+
+ // Limit the query to the the maximum number of desired results.
+ // This way we can avoid doing more work than needed.
+ params.maxResults = this._maxRichResults;
+
+ return query;
+ },
+
+ _getBoundOpenPagesQuery: function PAC_getBoundOpenPagesQuery(aTokens)
+ {
+ let query = this._openPagesQuery;
+
+ // Bind the needed parameters to the query so consumers can use it.
+ let params = query.params;
+ params.query_type = kQueryTypeFiltered;
+ params.matchBehavior = this._matchBehavior;
+ params.searchBehavior = this._behavior;
+
+ // We only want to search the tokens that we are left with - not the
+ // original search string.
+ params.searchString = aTokens.join(" ");
+ params.maxResults = this._maxRichResults;
+
+ return query;
+ },
+
+ /**
+ * Obtains the keyword query with the properly bound parameters.
+ *
+ * @param aTokens
+ * The array of search tokens to check against.
+ * @return the bound keyword query.
+ */
+ _getBoundKeywordQuery: function PAC_getBoundKeywordQuery(aTokens)
+ {
+ // The keyword is the first word in the search string, with the parameters
+ // following it.
+ let searchString = this._originalSearchString;
+ let queryString = "";
+ let queryIndex = searchString.indexOf(" ");
+ if (queryIndex != -1) {
+ queryString = searchString.substring(queryIndex + 1);
+ }
+ // We need to escape the parameters as if they were the query in a URL
+ queryString = encodeURIComponent(queryString).replace(/%20/g, "+");
+
+ // The first word could be a keyword, so that's what we'll search.
+ let keyword = aTokens[0];
+
+ let query = this._keywordQuery;
+ let params = query.params;
+ params.keyword = keyword;
+ params.query_string = queryString;
+ params.query_type = kQueryTypeKeyword;
+
+ return query;
+ },
+
+ /**
+ * Obtains the adaptive query with the properly bound parameters.
+ *
+ * @return the bound adaptive query.
+ */
+ _getBoundAdaptiveQuery: function PAC_getBoundAdaptiveQuery(aMatchBehavior)
+ {
+ // If we were not given a match behavior, use the stored match behavior.
+ if (arguments.length == 0) {
+ aMatchBehavior = this._matchBehavior;
+ }
+
+ let query = this._adaptiveQuery;
+ let params = query.params;
+ params.parent = PlacesUtils.tagsFolderId;
+ params.search_string = this._currentSearchString;
+ params.query_type = kQueryTypeFiltered;
+ params.matchBehavior = aMatchBehavior;
+ params.searchBehavior = this._behavior;
+
+ return query;
+ },
+
+ /**
+ * Processes a mozIStorageRow to generate the proper data for the AutoComplete
+ * result. This will add an entry to the current result if it matches the
+ * criteria.
+ *
+ * @param aRow
+ * The row to process.
+ * @return true if the row is accepted, and false if not.
+ */
+ _processRow: function PAC_processRow(aRow)
+ {
+ // Before we do any work, make sure this entry isn't already in our results.
+ let entryId = aRow.getResultByIndex(kQueryIndexPlaceId);
+ let escapedEntryURL = aRow.getResultByIndex(kQueryIndexURL);
+ let openPageCount = aRow.getResultByIndex(kQueryIndexOpenPageCount) || 0;
+
+ // If actions are enabled and the page is open, add only the switch-to-tab
+ // result. Otherwise, add the normal result.
+ let [url, action] = this._enableActions && openPageCount > 0 && this._hasBehavior("openpage") ?
+ ["moz-action:switchtab," + escapedEntryURL, "action "] :
+ [escapedEntryURL, ""];
+
+ if (this._inResults(entryId, url)) {
+ return false;
+ }
+
+ let entryTitle = aRow.getResultByIndex(kQueryIndexTitle) || "";
+ let entryFavicon = aRow.getResultByIndex(kQueryIndexFaviconURL) || "";
+ let entryBookmarked = aRow.getResultByIndex(kQueryIndexBookmarked);
+ let entryBookmarkTitle = entryBookmarked ?
+ aRow.getResultByIndex(kQueryIndexBookmarkTitle) : null;
+ let entryTags = aRow.getResultByIndex(kQueryIndexTags) || "";
+
+ // Always prefer the bookmark title unless it is empty
+ let title = entryBookmarkTitle || entryTitle;
+
+ let style;
+ if (aRow.getResultByIndex(kQueryIndexQueryType) == kQueryTypeKeyword) {
+ style = "keyword";
+ title = NetUtil.newURI(escapedEntryURL).host;
+ }
+
+ // We will always prefer to show tags if we have them.
+ let showTags = !!entryTags;
+
+ // However, we'll act as if a page is not bookmarked if the user wants
+ // only history and not bookmarks and there are no tags.
+ if (this._hasBehavior("history") && !this._hasBehavior("bookmark") &&
+ !showTags) {
+ showTags = false;
+ style = "favicon";
+ }
+
+ // If we have tags and should show them, we need to add them to the title.
+ if (showTags) {
+ title += kTitleTagsSeparator + entryTags;
+ }
+ // We have to determine the right style to display. Tags show the tag icon,
+ // bookmarks get the bookmark icon, and keywords get the keyword icon. If
+ // the result does not fall into any of those, it just gets the favicon.
+ if (!style) {
+ // It is possible that we already have a style set (from a keyword
+ // search or because of the user's preferences), so only set it if we
+ // haven't already done so.
+ if (showTags) {
+ style = "tag";
+ }
+ else if (entryBookmarked) {
+ style = "bookmark";
+ }
+ else {
+ style = "favicon";
+ }
+ }
+
+ this._addToResults(entryId, url, title, entryFavicon, action + style);
+ return true;
+ },
+
+ /**
+ * Checks to see if the given place has already been added to the results.
+ *
+ * @param aPlaceId
+ * The place id to check for, may be null.
+ * @param aUrl
+ * The url to check for.
+ * @return true if the place has been added, false otherwise.
+ *
+ * @note Must check both the id and the url for a negative match, since
+ * autocomplete may run in the middle of a new page addition. In such
+ * a case the switch-to-tab query would hash the page by url, then a
+ * next query, running after the page addition, would hash it by id.
+ * It's not possible to just rely on url though, since keywords
+ * dynamically modify the url to include their search string.
+ */
+ _inResults: function PAC_inResults(aPlaceId, aUrl)
+ {
+ if (aPlaceId && aPlaceId in this._usedPlaces) {
+ return true;
+ }
+ return aUrl in this._usedPlaces;
+ },
+
+ /**
+ * Adds a result to the AutoComplete results. Also tracks that we've added
+ * this place_id into the result set.
+ *
+ * @param aPlaceId
+ * The place_id of the item to be added to the result set. This is
+ * used by _inResults.
+ * @param aURISpec
+ * The URI spec for the entry.
+ * @param aTitle
+ * The title to give the entry.
+ * @param aFaviconSpec
+ * The favicon to give to the entry.
+ * @param aStyle
+ * Indicates how the entry should be styled when displayed.
+ */
+ _addToResults: function PAC_addToResults(aPlaceId, aURISpec, aTitle,
+ aFaviconSpec, aStyle)
+ {
+ // Add this to our internal tracker to ensure duplicates do not end up in
+ // the result. _usedPlaces is an Object that is being used as a set.
+ // Not all entries have a place id, thus we fallback to the url for them.
+ // We cannot use only the url since keywords entries are modified to
+ // include the search string, and would be returned multiple times. Ids
+ // are faster too.
+ this._usedPlaces[aPlaceId || aURISpec] = true;
+
+ // Obtain the favicon for this URI.
+ let favicon;
+ if (aFaviconSpec) {
+ let uri = NetUtil.newURI(aFaviconSpec);
+ favicon = PlacesUtils.favicons.getFaviconLinkForIcon(uri).spec;
+ }
+ favicon = favicon || PlacesUtils.favicons.defaultFavicon.spec;
+
+ this._result.appendMatch(aURISpec, aTitle, favicon, aStyle);
+ },
+
+ /**
+ * Determines if the specified AutoComplete behavior is set.
+ *
+ * @param aType
+ * The behavior type to test for.
+ * @return true if the behavior is set, false otherwise.
+ */
+ _hasBehavior: function PAC_hasBehavior(aType)
+ {
+ let behavior = Ci.mozIPlacesAutoComplete["BEHAVIOR_" + aType.toUpperCase()];
+
+ if (this._disablePrivateActions &&
+ behavior == Ci.mozIPlacesAutoComplete.BEHAVIOR_OPENPAGE) {
+ return false;
+ }
+
+ return this._behavior & behavior;
+ },
+
+ /**
+ * Enables the desired AutoComplete behavior.
+ *
+ * @param aType
+ * The behavior type to set.
+ */
+ _setBehavior: function PAC_setBehavior(aType)
+ {
+ this._behavior |=
+ Ci.mozIPlacesAutoComplete["BEHAVIOR_" + aType.toUpperCase()];
+ },
+
+ /**
+ * Determines if we are done searching or not.
+ *
+ * @return true if we have completed searching, false otherwise.
+ */
+ isSearchComplete: function PAC_isSearchComplete()
+ {
+ // If _pendingQuery is null, we should no longer do any work since we have
+ // already called _finishSearch. This means we completed our search.
+ return this._pendingQuery == null;
+ },
+
+ /**
+ * Determines if the given handle of a pending statement is a pending search
+ * or not.
+ *
+ * @param aHandle
+ * A mozIStoragePendingStatement to check and see if we are waiting for
+ * results from it still.
+ * @return true if it is a pending query, false otherwise.
+ */
+ isPendingSearch: function PAC_isPendingSearch(aHandle)
+ {
+ return this._pendingQuery == aHandle;
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// nsISupports
+
+ classID: Components.ID("d0272978-beab-4adc-a3d4-04b76acfa4e7"),
+
+ _xpcom_factory: XPCOMUtils.generateSingletonFactory(nsPlacesAutoComplete),
+
+ QueryInterface: XPCOMUtils.generateQI([
+ Ci.nsIAutoCompleteSearch,
+ Ci.nsIAutoCompleteSimpleResultListener,
+ Ci.mozIPlacesAutoComplete,
+ Ci.mozIStorageStatementCallback,
+ Ci.nsIObserver,
+ Ci.nsISupportsWeakReference,
+ ])
+};
+
+////////////////////////////////////////////////////////////////////////////////
+//// urlInlineComplete class
+//// component @mozilla.org/autocomplete/search;1?name=urlinline
+
+function urlInlineComplete()
+{
+ this._loadPrefs(true);
+ Services.obs.addObserver(this, kTopicShutdown, true);
+}
+
+urlInlineComplete.prototype = {
+
+/////////////////////////////////////////////////////////////////////////////////
+//// Database and query getters
+
+ __db: null,
+
+ get _db()
+ {
+ if (!this.__db && this._autofillEnabled) {
+ this.__db = PlacesUtils.history.DBConnection.clone(true);
+ }
+ return this.__db;
+ },
+
+ __hostQuery: null,
+
+ get _hostQuery()
+ {
+ if (!this.__hostQuery) {
+ // Add a trailing slash at the end of the hostname, since we always
+ // want to complete up to and including a URL separator.
+ this.__hostQuery = this._db.createAsyncStatement(
+ `/* do not warn (bug no): could index on (typed,frecency) but not worth it */
+ SELECT host || '/', prefix || host || '/'
+ FROM moz_hosts
+ WHERE host BETWEEN :search_string AND :search_string || X'FFFF'
+ AND frecency <> 0
+ ${this._autofillTyped ? "AND typed = 1" : ""}
+ ORDER BY frecency DESC
+ LIMIT 1`
+ );
+ }
+ return this.__hostQuery;
+ },
+
+ __urlQuery: null,
+
+ get _urlQuery()
+ {
+ if (!this.__urlQuery) {
+ this.__urlQuery = this._db.createAsyncStatement(
+ `/* do not warn (bug no): can't use an index */
+ SELECT h.url
+ FROM moz_places h
+ WHERE h.frecency <> 0
+ ${this._autofillTyped ? "AND h.typed = 1 " : ""}
+ AND AUTOCOMPLETE_MATCH(:searchString, h.url,
+ h.title, '',
+ h.visit_count, h.typed, 0, 0,
+ :matchBehavior, :searchBehavior)
+ ORDER BY h.frecency DESC, h.id DESC
+ LIMIT 1`
+ );
+ }
+ return this.__urlQuery;
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// nsIAutoCompleteSearch
+
+ startSearch: function UIC_startSearch(aSearchString, aSearchParam,
+ aPreviousResult, aListener)
+ {
+ // Stop the search in case the controller has not taken care of it.
+ if (this._pendingQuery) {
+ this.stopSearch();
+ }
+
+ let pendingSearch = this._pendingSearch = {};
+
+ // We want to store the original string with no leading or trailing
+ // whitespace for case sensitive searches.
+ this._originalSearchString = aSearchString;
+ this._currentSearchString =
+ fixupSearchText(this._originalSearchString.toLowerCase());
+ // The protocol and the host are lowercased by nsIURI, so it's fine to
+ // lowercase the typed prefix to add it back to the results later.
+ this._strippedPrefix = this._originalSearchString.slice(
+ 0, this._originalSearchString.length - this._currentSearchString.length
+ ).toLowerCase();
+
+ this._result = Cc["@mozilla.org/autocomplete/simple-result;1"].
+ createInstance(Ci.nsIAutoCompleteSimpleResult);
+ this._result.setSearchString(aSearchString);
+ this._result.setTypeAheadResult(true);
+
+ this._listener = aListener;
+
+ Task.spawn(function* () {
+ // Don't autoFill if the search term is recognized as a keyword, otherwise
+ // it will override default keywords behavior. Note that keywords are
+ // hashed on first use, so while the first query may delay a little bit,
+ // next ones will just hit the memory hash.
+ let dontAutoFill = this._currentSearchString.length == 0 || !this._db ||
+ (yield PlacesUtils.keywords.fetch(this._currentSearchString));
+ if (this._pendingSearch != pendingSearch)
+ return;
+ if (dontAutoFill) {
+ this._finishSearch();
+ return;
+ }
+
+ // Don't try to autofill if the search term includes any whitespace.
+ // This may confuse completeDefaultIndex cause the AUTOCOMPLETE_MATCH
+ // tokenizer ends up trimming the search string and returning a value
+ // that doesn't match it, or is even shorter.
+ if (/\s/.test(this._currentSearchString)) {
+ this._finishSearch();
+ return;
+ }
+
+ // Hosts have no "/" in them.
+ let lastSlashIndex = this._currentSearchString.lastIndexOf("/");
+
+ // Search only URLs if there's a slash in the search string...
+ if (lastSlashIndex != -1) {
+ // ...but not if it's exactly at the end of the search string.
+ if (lastSlashIndex < this._currentSearchString.length - 1)
+ this._queryURL();
+ else
+ this._finishSearch();
+ return;
+ }
+
+ // Do a synchronous search on the table of hosts.
+ let query = this._hostQuery;
+ query.params.search_string = this._currentSearchString.toLowerCase();
+ // This is just to measure the delay to reach the UI, not the query time.
+ TelemetryStopwatch.start(DOMAIN_QUERY_TELEMETRY);
+ let wrapper = new AutoCompleteStatementCallbackWrapper(this, {
+ handleResult: aResultSet => {
+ if (this._pendingSearch != pendingSearch)
+ return;
+ let row = aResultSet.getNextRow();
+ let trimmedHost = row.getResultByIndex(0);
+ let untrimmedHost = row.getResultByIndex(1);
+ // If the untrimmed value doesn't preserve the user's input just
+ // ignore it and complete to the found host.
+ if (untrimmedHost &&
+ !untrimmedHost.toLowerCase().includes(this._originalSearchString.toLowerCase())) {
+ untrimmedHost = null;
+ }
+
+ this._result.appendMatch(this._strippedPrefix + trimmedHost, "", "", "", untrimmedHost);
+
+ // handleCompletion() will cause the result listener to be called, and
+ // will display the result in the UI.
+ },
+
+ handleError: aError => {
+ Components.utils.reportError(
+ "URL Inline Complete: An async statement encountered an " +
+ "error: " + aError.result + ", '" + aError.message + "'");
+ },
+
+ handleCompletion: aReason => {
+ if (this._pendingSearch != pendingSearch)
+ return;
+ TelemetryStopwatch.finish(DOMAIN_QUERY_TELEMETRY);
+ this._finishSearch();
+ }
+ }, this._db);
+ this._pendingQuery = wrapper.executeAsync([query]);
+ }.bind(this));
+ },
+
+ /**
+ * Execute an asynchronous search through places, and complete
+ * up to the next URL separator.
+ */
+ _queryURL: function UIC__queryURL()
+ {
+ // The URIs in the database are fixed up, so we can match on a lowercased
+ // host, but the path must be matched in a case sensitive way.
+ let pathIndex =
+ this._originalSearchString.indexOf("/", this._strippedPrefix.length);
+ this._currentSearchString = fixupSearchText(
+ this._originalSearchString.slice(0, pathIndex).toLowerCase() +
+ this._originalSearchString.slice(pathIndex)
+ );
+
+ // Within the standard autocomplete query, we only search the beginning
+ // of URLs for 1 result.
+ let query = this._urlQuery;
+ let params = query.params;
+ params.matchBehavior = MATCH_BEGINNING_CASE_SENSITIVE;
+ params.searchBehavior |= Ci.mozIPlacesAutoComplete.BEHAVIOR_HISTORY |
+ Ci.mozIPlacesAutoComplete.BEHAVIOR_TYPED |
+ Ci.mozIPlacesAutoComplete.BEHAVIOR_URL;
+ params.searchString = this._currentSearchString;
+
+ // Execute the query.
+ let wrapper = new AutoCompleteStatementCallbackWrapper(this, {
+ handleResult: aResultSet => {
+ let row = aResultSet.getNextRow();
+ let value = row.getResultByIndex(0);
+ let url = fixupSearchText(value);
+
+ let prefix = value.slice(0, value.length - stripPrefix(value).length);
+
+ // We must complete the URL up to the next separator (which is /, ? or #).
+ let separatorIndex = url.slice(this._currentSearchString.length)
+ .search(/[\/\?\#]/);
+ if (separatorIndex != -1) {
+ separatorIndex += this._currentSearchString.length;
+ if (url[separatorIndex] == "/") {
+ separatorIndex++; // Include the "/" separator
+ }
+ url = url.slice(0, separatorIndex);
+ }
+
+ // Add the result.
+ // If the untrimmed value doesn't preserve the user's input just
+ // ignore it and complete to the found url.
+ let untrimmedURL = prefix + url;
+ if (untrimmedURL &&
+ !untrimmedURL.toLowerCase().includes(this._originalSearchString.toLowerCase())) {
+ untrimmedURL = null;
+ }
+
+ this._result.appendMatch(this._strippedPrefix + url, "", "", "", untrimmedURL);
+
+ // handleCompletion() will cause the result listener to be called, and
+ // will display the result in the UI.
+ },
+
+ handleError: aError => {
+ Components.utils.reportError(
+ "URL Inline Complete: An async statement encountered an " +
+ "error: " + aError.result + ", '" + aError.message + "'");
+ },
+
+ handleCompletion: aReason => {
+ this._finishSearch();
+ }
+ }, this._db);
+ this._pendingQuery = wrapper.executeAsync([query]);
+ },
+
+ stopSearch: function UIC_stopSearch()
+ {
+ delete this._originalSearchString;
+ delete this._currentSearchString;
+ delete this._result;
+ delete this._listener;
+ delete this._pendingSearch;
+
+ if (this._pendingQuery) {
+ this._pendingQuery.cancel();
+ delete this._pendingQuery;
+ }
+ },
+
+ /**
+ * Loads the preferences that we care about.
+ *
+ * @param [optional] aRegisterObserver
+ * Indicates if the preference observer should be added or not. The
+ * default value is false.
+ */
+ _loadPrefs: function UIC_loadPrefs(aRegisterObserver)
+ {
+ let prefBranch = Services.prefs.getBranch(kBrowserUrlbarBranch);
+ let autocomplete = safePrefGetter(prefBranch,
+ kBrowserUrlbarAutocompleteEnabledPref,
+ true);
+ let autofill = safePrefGetter(prefBranch,
+ kBrowserUrlbarAutofillPref,
+ true);
+ this._autofillEnabled = autocomplete && autofill;
+ this._autofillTyped = safePrefGetter(prefBranch,
+ kBrowserUrlbarAutofillTypedPref,
+ true);
+ if (aRegisterObserver) {
+ Services.prefs.addObserver(kBrowserUrlbarBranch, this, true);
+ }
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// nsIAutoCompleteSearchDescriptor
+
+ get searchType() {
+ return Ci.nsIAutoCompleteSearchDescriptor.SEARCH_TYPE_IMMEDIATE;
+ },
+
+ get clearingAutoFillSearchesAgain() {
+ return false;
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// nsIObserver
+
+ observe: function UIC_observe(aSubject, aTopic, aData)
+ {
+ if (aTopic == kTopicShutdown) {
+ this._closeDatabase();
+ }
+ else if (aTopic == kPrefChanged &&
+ (aData.substr(kBrowserUrlbarBranch.length) == kBrowserUrlbarAutofillPref ||
+ aData.substr(kBrowserUrlbarBranch.length) == kBrowserUrlbarAutocompleteEnabledPref ||
+ aData.substr(kBrowserUrlbarBranch.length) == kBrowserUrlbarAutofillTypedPref)) {
+ let previousAutofillTyped = this._autofillTyped;
+ this._loadPrefs();
+ if (!this._autofillEnabled) {
+ this.stopSearch();
+ this._closeDatabase();
+ }
+ else if (this._autofillTyped != previousAutofillTyped) {
+ // Invalidate the statements to update them for the new typed status.
+ this._invalidateStatements();
+ }
+ }
+ },
+
+ /**
+ * Finalizes and invalidates cached statements.
+ */
+ _invalidateStatements: function UIC_invalidateStatements()
+ {
+ // Finalize the statements that we have used.
+ let stmts = [
+ "__hostQuery",
+ "__urlQuery",
+ ];
+ for (let i = 0; i < stmts.length; i++) {
+ // We do not want to create any query we haven't already created, so
+ // see if it is a getter first.
+ if (this[stmts[i]]) {
+ this[stmts[i]].finalize();
+ this[stmts[i]] = null;
+ }
+ }
+ },
+
+ /**
+ * Closes the database.
+ */
+ _closeDatabase: function UIC_closeDatabase()
+ {
+ this._invalidateStatements();
+ if (this.__db) {
+ this._db.asyncClose();
+ this.__db = null;
+ }
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// urlInlineComplete
+
+ _finishSearch: function UIC_finishSearch()
+ {
+ // Notify the result object
+ let result = this._result;
+
+ if (result.matchCount) {
+ result.setDefaultIndex(0);
+ result.setSearchResult(Ci.nsIAutoCompleteResult["RESULT_SUCCESS"]);
+ } else {
+ result.setDefaultIndex(-1);
+ result.setSearchResult(Ci.nsIAutoCompleteResult["RESULT_NOMATCH"]);
+ }
+
+ this._listener.onSearchResult(this, result);
+ this.stopSearch();
+ },
+
+ isSearchComplete: function UIC_isSearchComplete()
+ {
+ return this._pendingQuery == null;
+ },
+
+ isPendingSearch: function UIC_isPendingSearch(aHandle)
+ {
+ return this._pendingQuery == aHandle;
+ },
+
+ //////////////////////////////////////////////////////////////////////////////
+ //// nsISupports
+
+ classID: Components.ID("c88fae2d-25cf-4338-a1f4-64a320ea7440"),
+
+ _xpcom_factory: XPCOMUtils.generateSingletonFactory(urlInlineComplete),
+
+ QueryInterface: XPCOMUtils.generateQI([
+ Ci.nsIAutoCompleteSearch,
+ Ci.nsIAutoCompleteSearchDescriptor,
+ Ci.nsIObserver,
+ Ci.nsISupportsWeakReference,
+ ])
+};
+
+var components = [nsPlacesAutoComplete, urlInlineComplete];
+this.NSGetFactory = XPCOMUtils.generateNSGetFactory(components);
diff --git a/toolkit/components/places/nsPlacesAutoComplete.manifest b/toolkit/components/places/nsPlacesAutoComplete.manifest
new file mode 100644
index 0000000000..eb704f4491
--- /dev/null
+++ b/toolkit/components/places/nsPlacesAutoComplete.manifest
@@ -0,0 +1,6 @@
+component {d0272978-beab-4adc-a3d4-04b76acfa4e7} nsPlacesAutoComplete.js
+contract @mozilla.org/autocomplete/search;1?name=history {d0272978-beab-4adc-a3d4-04b76acfa4e7}
+
+component {c88fae2d-25cf-4338-a1f4-64a320ea7440} nsPlacesAutoComplete.js
+contract @mozilla.org/autocomplete/search;1?name=urlinline {c88fae2d-25cf-4338-a1f4-64a320ea7440}
+
diff --git a/toolkit/components/places/nsTaggingService.js b/toolkit/components/places/nsTaggingService.js
index 1fad67a829..e367e6cb30 100644
--- a/toolkit/components/places/nsTaggingService.js
+++ b/toolkit/components/places/nsTaggingService.js
@@ -528,6 +528,10 @@ TagAutoCompleteResult.prototype = {
return this._results.length;
},
+ get typeAheadResult() {
+ return false;
+ },
+
/**
* Get the value of the result at the given index
*/
diff --git a/toolkit/components/places/tests/cpp/places_test_harness_tail.h b/toolkit/components/places/tests/cpp/places_test_harness_tail.h
index 4bbd45ccbb..9e57c37244 100644
--- a/toolkit/components/places/tests/cpp/places_test_harness_tail.h
+++ b/toolkit/components/places/tests/cpp/places_test_harness_tail.h
@@ -6,9 +6,6 @@
#include "nsWidgetsCID.h"
#include "nsIComponentRegistrar.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsICrashReporter.h"
-#endif
#ifndef TEST_NAME
#error "Must #define TEST_NAME before including places_test_harness_tail.h"
@@ -94,32 +91,6 @@ main(int aArgc,
return -1;
}
-#ifdef MOZ_CRASHREPORTER
- char* enabled = PR_GetEnv("MOZ_CRASHREPORTER");
- if (enabled && !strcmp(enabled, "1")) {
- // bug 787458: move this to an even-more-common location to use in all
- // C++ unittests
- nsCOMPtr<nsICrashReporter> crashreporter =
- do_GetService("@mozilla.org/toolkit/crash-reporter;1");
- if (crashreporter) {
- fprintf(stderr, "Setting up crash reporting\n");
-
- nsCOMPtr<nsIProperties> dirsvc =
- do_GetService(NS_DIRECTORY_SERVICE_CONTRACTID);
- if (!dirsvc)
- NS_RUNTIMEABORT("Couldn't get directory service");
- nsCOMPtr<nsIFile> cwd;
- nsresult rv = dirsvc->Get(NS_OS_CURRENT_WORKING_DIR,
- NS_GET_IID(nsIFile),
- getter_AddRefs(cwd));
- if (NS_FAILED(rv))
- NS_RUNTIMEABORT("Couldn't get CWD");
- crashreporter->SetEnabled(true);
- crashreporter->SetMinidumpPath(cwd);
- }
- }
-#endif
-
RefPtr<WaitForConnectionClosed> spinClose = new WaitForConnectionClosed();
// Tinderboxes are constantly on idle. Since idle tasks can interact with
diff --git a/toolkit/components/protobuf/moz.build b/toolkit/components/protobuf/moz.build
index b5015eb678..8cca3514c5 100644
--- a/toolkit/components/protobuf/moz.build
+++ b/toolkit/components/protobuf/moz.build
@@ -117,10 +117,13 @@ DEFINES['GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER'] = True
# Suppress warnings in third-party code.
if CONFIG['GNU_CXX']:
CXXFLAGS += [
- '-Wno-null-conversion',
'-Wno-return-type',
'-Wno-sign-compare',
]
+ if CONFIG['CLANG_CXX']:
+ CXXFLAGS += [
+ '-Wno-null-conversion',
+ ]
elif CONFIG['_MSC_VER']:
CXXFLAGS += [
'-wd4005', # 'WIN32_LEAN_AND_MEAN' : macro redefinition
diff --git a/toolkit/components/satchel/test/test_form_autocomplete.html b/toolkit/components/satchel/test/test_form_autocomplete.html
index 4cf09117a0..d2c22a3db0 100644
--- a/toolkit/components/satchel/test/test_form_autocomplete.html
+++ b/toolkit/components/satchel/test/test_form_autocomplete.html
@@ -172,7 +172,7 @@ function setupFormHistory(aCallback) {
{ op : "add", fieldname : "field8", value : "value" },
{ op : "add", fieldname : "field9", value : "value" },
{ op : "add", fieldname : "field10", value : "42" },
- { op : "add", fieldname : "field11", value : "2010-10-10" },
+ { op : "add", fieldname : "field11", value : "2010-10-10" }, // not used, since type=date doesn't have autocomplete currently
{ op : "add", fieldname : "field12", value : "21:21" }, // not used, since type=time doesn't have autocomplete currently
{ op : "add", fieldname : "field13", value : "32" }, // not used, since type=range doesn't have a drop down menu
{ op : "add", fieldname : "field14", value : "#ffffff" }, // not used, since type=color doesn't have autocomplete currently
@@ -899,15 +899,13 @@ function runTest() {
input = $_(14, "field11");
restoreForm();
- expectPopup();
- doKey("down");
+ waitForMenuChange(0);
break;
case 405:
- checkMenuEntries(["2010-10-10"]);
- doKey("down");
- doKey("return");
- checkForm("2010-10-10");
+ checkMenuEntries([]); // type=date with it's own control frame does not
+ // have a drop down menu for now
+ checkForm("");
input = $_(15, "field12");
restoreForm();
diff --git a/toolkit/components/telemetry/TelemetryEnvironment.jsm b/toolkit/components/telemetry/TelemetryEnvironment.jsm
index 2f4ac81baa..910d804ae8 100644
--- a/toolkit/components/telemetry/TelemetryEnvironment.jsm
+++ b/toolkit/components/telemetry/TelemetryEnvironment.jsm
@@ -153,7 +153,6 @@ const DEFAULT_ENVIRONMENT_PREFS = new Map([
["dom.ipc.plugins.enabled", {what: RECORD_PREF_VALUE}],
["dom.ipc.processCount", {what: RECORD_PREF_VALUE, requiresRestart: true}],
["dom.max_script_run_time", {what: RECORD_PREF_VALUE}],
- ["experiments.manifest.uri", {what: RECORD_PREF_VALUE}],
["extensions.autoDisableScopes", {what: RECORD_PREF_VALUE}],
["extensions.enabledScopes", {what: RECORD_PREF_VALUE}],
["extensions.blocklist.enabled", {what: RECORD_PREF_VALUE}],
@@ -209,7 +208,6 @@ const PREF_E10S_COHORT = "e10s.rollout.cohort";
const COMPOSITOR_CREATED_TOPIC = "compositor:created";
const DISTRIBUTION_CUSTOMIZATION_COMPLETE_TOPIC = "distribution-customization-complete";
-const EXPERIMENTS_CHANGED_TOPIC = "experiments-changed";
const GFX_FEATURES_READY_TOPIC = "gfx-features-ready";
const SEARCH_ENGINE_MODIFIED_TOPIC = "browser-search-engine-modified";
const SEARCH_SERVICE_TOPIC = "browser-search-service";
@@ -465,7 +463,6 @@ EnvironmentAddonBuilder.prototype = {
watchForChanges: function() {
this._loaded = true;
AddonManager.addAddonListener(this);
- Services.obs.addObserver(this, EXPERIMENTS_CHANGED_TOPIC, false);
},
// AddonListener
@@ -490,7 +487,6 @@ EnvironmentAddonBuilder.prototype = {
// nsIObserver
observe: function (aSubject, aTopic, aData) {
this._environment._log.trace("observe - Topic " + aTopic);
- this._checkForChanges("experiment-changed");
},
_checkForChanges: function(changeReason) {
@@ -515,7 +511,6 @@ EnvironmentAddonBuilder.prototype = {
_shutdownBlocker: function() {
if (this._loaded) {
AddonManager.removeAddonListener(this);
- Services.obs.removeObserver(this, EXPERIMENTS_CHANGED_TOPIC);
}
return this._pendingTask;
},
@@ -545,7 +540,6 @@ EnvironmentAddonBuilder.prototype = {
theme: yield this._getActiveTheme(),
activePlugins: this._getActivePlugins(),
activeGMPlugins: yield this._getActiveGMPlugins(),
- activeExperiment: this._getActiveExperiment(),
persona: personaId,
};
@@ -718,29 +712,7 @@ EnvironmentAddonBuilder.prototype = {
}
return activeGMPlugins;
- }),
-
- /**
- * Get the active experiment data in object form.
- * @return Object containing the active experiment data.
- */
- _getActiveExperiment: function () {
- let experimentInfo = {};
- try {
- let scope = {};
- Cu.import("resource:///modules/experiments/Experiments.jsm", scope);
- let experiments = scope.Experiments.instance();
- let activeExperiment = experiments.getActiveExperimentID();
- if (activeExperiment) {
- experimentInfo.id = activeExperiment;
- experimentInfo.branch = experiments.getActiveExperimentBranch();
- }
- } catch (e) {
- // If this is not Firefox, the import will fail.
- }
-
- return experimentInfo;
- },
+ })
};
function EnvironmentCache() {
diff --git a/toolkit/components/terminator/nsTerminator.cpp b/toolkit/components/terminator/nsTerminator.cpp
index f9459cc5d6..91e8728213 100644
--- a/toolkit/components/terminator/nsTerminator.cpp
+++ b/toolkit/components/terminator/nsTerminator.cpp
@@ -29,9 +29,6 @@
#include "nsIObserverService.h"
#include "nsIPrefService.h"
-#if defined(MOZ_CRASHREPORTER)
-#include "nsExceptionHandler.h"
-#endif
#if defined(XP_WIN)
#include <windows.h>
@@ -541,13 +538,7 @@ nsTerminator::UpdateTelemetry()
void
nsTerminator::UpdateCrashReport(const char* aTopic)
{
-#if defined(MOZ_CRASHREPORTER)
- // In case of crash, we wish to know where in shutdown we are
- nsAutoCString report(aTopic);
-
- Unused << CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ShutdownProgress"),
- report);
-#endif // defined(MOZ_CRASH_REPORTER)
+ /*** STUB ***/
}
diff --git a/toolkit/components/url-classifier/HashStore.cpp b/toolkit/components/url-classifier/HashStore.cpp
index c298612aa4..77bf3cbd4d 100644
--- a/toolkit/components/url-classifier/HashStore.cpp
+++ b/toolkit/components/url-classifier/HashStore.cpp
@@ -964,8 +964,7 @@ HashStore::WriteFile()
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIOutputStream> out;
- rv = NS_NewCheckSummedOutputStream(getter_AddRefs(out), storeFile,
- PR_WRONLY | PR_TRUNCATE | PR_CREATE_FILE);
+ rv = NS_NewCheckSummedOutputStream(getter_AddRefs(out), storeFile);
NS_ENSURE_SUCCESS(rv, rv);
uint32_t written;
diff --git a/toolkit/components/url-classifier/nsCheckSummedOutputStream.cpp b/toolkit/components/url-classifier/nsCheckSummedOutputStream.cpp
index 68f9f1f6f4..0e89fd20c5 100644
--- a/toolkit/components/url-classifier/nsCheckSummedOutputStream.cpp
+++ b/toolkit/components/url-classifier/nsCheckSummedOutputStream.cpp
@@ -13,14 +13,11 @@
// nsCheckSummedOutputStream
NS_IMPL_ISUPPORTS_INHERITED(nsCheckSummedOutputStream,
- nsSafeFileOutputStream,
- nsISafeOutputStream,
- nsIOutputStream,
- nsIFileOutputStream)
+ nsBufferedOutputStream,
+ nsISafeOutputStream)
NS_IMETHODIMP
-nsCheckSummedOutputStream::Init(nsIFile* file, int32_t ioFlags, int32_t perm,
- int32_t behaviorFlags)
+nsCheckSummedOutputStream::Init(nsIOutputStream* stream, uint32_t bufferSize)
{
nsresult rv;
mHash = do_CreateInstance(NS_CRYPTO_HASH_CONTRACTID, &rv);
@@ -29,7 +26,7 @@ nsCheckSummedOutputStream::Init(nsIFile* file, int32_t ioFlags, int32_t perm,
rv = mHash->Init(nsICryptoHash::MD5);
NS_ENSURE_SUCCESS(rv, rv);
- return nsSafeFileOutputStream::Init(file, ioFlags, perm, behaviorFlags);
+ return nsBufferedOutputStream::Init(stream, bufferSize);
}
NS_IMETHODIMP
@@ -39,12 +36,12 @@ nsCheckSummedOutputStream::Finish()
NS_ENSURE_SUCCESS(rv, rv);
uint32_t written;
- rv = nsSafeFileOutputStream::Write(reinterpret_cast<const char*>(mCheckSum.BeginReading()),
+ rv = nsBufferedOutputStream::Write(reinterpret_cast<const char*>(mCheckSum.BeginReading()),
mCheckSum.Length(), &written);
NS_ASSERTION(written == mCheckSum.Length(), "Error writing stream checksum");
NS_ENSURE_SUCCESS(rv, rv);
- return nsSafeFileOutputStream::Finish();
+ return nsBufferedOutputStream::Finish();
}
NS_IMETHODIMP
@@ -53,7 +50,7 @@ nsCheckSummedOutputStream::Write(const char *buf, uint32_t count, uint32_t *resu
nsresult rv = mHash->Update(reinterpret_cast<const uint8_t*>(buf), count);
NS_ENSURE_SUCCESS(rv, rv);
- return nsSafeFileOutputStream::Write(buf, count, result);
+ return nsBufferedOutputStream::Write(buf, count, result);
}
////////////////////////////////////////////////////////////////////////////////
diff --git a/toolkit/components/url-classifier/nsCheckSummedOutputStream.h b/toolkit/components/url-classifier/nsCheckSummedOutputStream.h
index c2fe26b5f5..b72c7da869 100644
--- a/toolkit/components/url-classifier/nsCheckSummedOutputStream.h
+++ b/toolkit/components/url-classifier/nsCheckSummedOutputStream.h
@@ -12,25 +12,27 @@
#include "nsICryptoHash.h"
#include "nsNetCID.h"
#include "nsString.h"
-#include "../../../netwerk/base/nsFileStreams.h"
#include "nsToolkitCompsCID.h"
+#include "../../../netwerk/base/nsBufferedStreams.h"
+#include "prio.h"
-class nsCheckSummedOutputStream : public nsSafeFileOutputStream
+class nsCheckSummedOutputStream : public nsBufferedOutputStream
{
public:
NS_DECL_ISUPPORTS_INHERITED
// Size of MD5 hash in bytes
static const uint32_t CHECKSUM_SIZE = 16;
+ static const uint32_t MAX_BUFFER_SIZE = 64 * 1024;
nsCheckSummedOutputStream() {}
NS_IMETHOD Finish() override;
NS_IMETHOD Write(const char *buf, uint32_t count, uint32_t *result) override;
- NS_IMETHOD Init(nsIFile* file, int32_t ioFlags, int32_t perm, int32_t behaviorFlags) override;
+ NS_IMETHOD Init(nsIOutputStream* stream, uint32_t bufferSize) override;
protected:
- virtual ~nsCheckSummedOutputStream() { nsSafeFileOutputStream::Close(); }
+ virtual ~nsCheckSummedOutputStream() { nsBufferedOutputStream::Close(); }
nsCOMPtr<nsICryptoHash> mHash;
nsCString mCheckSum;
@@ -39,13 +41,15 @@ protected:
// returns a file output stream which can be QI'ed to nsIFileOutputStream.
inline nsresult
NS_NewCheckSummedOutputStream(nsIOutputStream **result,
- nsIFile *file,
- int32_t ioFlags = -1,
- int32_t perm = -1,
- int32_t behaviorFlags = 0)
+ nsIFile *file)
{
- nsCOMPtr<nsIFileOutputStream> out = new nsCheckSummedOutputStream();
- nsresult rv = out->Init(file, ioFlags, perm, behaviorFlags);
+ nsCOMPtr<nsIOutputStream> localOutFile;
+ nsresult rv = NS_NewSafeLocalFileOutputStream(getter_AddRefs(localOutFile), file,
+ PR_WRONLY | PR_TRUNCATE | PR_CREATE_FILE);
+ NS_ENSURE_SUCCESS(rv, rv);
+
+ nsCOMPtr<nsIBufferedOutputStream> out = new nsCheckSummedOutputStream();
+ rv = out->Init(localOutFile, nsCheckSummedOutputStream::CHECKSUM_SIZE);
if (NS_SUCCEEDED(rv)) {
out.forget(result);
}
diff --git a/toolkit/components/webextensions/ExtensionChild.jsm b/toolkit/components/webextensions/ExtensionChild.jsm
index c953dd685b..5dc4e22779 100644
--- a/toolkit/components/webextensions/ExtensionChild.jsm
+++ b/toolkit/components/webextensions/ExtensionChild.jsm
@@ -325,7 +325,7 @@ class Messenger {
return this.sendMessage(messageManager, msg, recipient, responseCallback);
}
- onMessage(name) {
+ _onMessage(name, filter) {
return new SingletonEventManager(this.context, name, callback => {
let listener = {
messageFilterPermissive: this.optionalFilter,
@@ -333,7 +333,8 @@ class Messenger {
filterMessage: (sender, recipient) => {
// Ignore the message if it was sent by this Messenger.
- return sender.contextId !== this.context.contextId;
+ return (sender.contextId !== this.context.contextId &&
+ filter(sender, recipient));
},
receiveMessage: ({target, data: message, sender, recipient}) => {
@@ -373,6 +374,14 @@ class Messenger {
}).api();
}
+ onMessage(name) {
+ return this._onMessage(name, sender => sender.id === this.sender.id);
+ }
+
+ onMessageExternal(name) {
+ return this._onMessage(name, sender => sender.id !== this.sender.id);
+ }
+
_connect(messageManager, port, recipient) {
let msg = {
name: port.name,
@@ -407,7 +416,7 @@ class Messenger {
return this._connect(messageManager, port, recipient);
}
- onConnect(name) {
+ _onConnect(name, filter) {
return new SingletonEventManager(this.context, name, callback => {
let listener = {
messageFilterPermissive: this.optionalFilter,
@@ -415,7 +424,8 @@ class Messenger {
filterMessage: (sender, recipient) => {
// Ignore the port if it was created by this Messenger.
- return sender.contextId !== this.context.contextId;
+ return (sender.contextId !== this.context.contextId &&
+ filter(sender, recipient));
},
receiveMessage: ({target, data: message, sender}) => {
@@ -438,6 +448,14 @@ class Messenger {
};
}).api();
}
+
+ onConnect(name) {
+ return this._onConnect(name, sender => sender.id === this.sender.id);
+ }
+
+ onConnectExternal(name) {
+ return this._onConnect(name, sender => sender.id !== this.sender.id);
+ }
}
var apiManager = new class extends SchemaAPIManager {
@@ -745,7 +763,7 @@ class ExtensionPageContextChild extends BaseContext {
// This is the MessageSender property passed to extension.
// It can be augmented by the "page-open" hook.
- let sender = {id: extension.uuid};
+ let sender = {id: extension.id};
if (viewType == "tab") {
sender.tabId = tabId;
this.tabId = tabId;
diff --git a/toolkit/components/webextensions/ExtensionCommon.jsm b/toolkit/components/webextensions/ExtensionCommon.jsm
index a339fb27e6..9ec84b5c76 100644
--- a/toolkit/components/webextensions/ExtensionCommon.jsm
+++ b/toolkit/components/webextensions/ExtensionCommon.jsm
@@ -197,10 +197,9 @@ class BaseContext {
* @returns {Promise}
*/
sendMessage(target, messageName, data, options = {}) {
- options.recipient = options.recipient || {};
+ options.recipient = Object.assign({extensionId: this.extension.id}, options.recipient);
options.sender = options.sender || {};
- options.recipient.extensionId = this.extension.id;
options.sender.extensionId = this.extension.id;
options.sender.contextId = this.contextId;
diff --git a/toolkit/components/webextensions/ExtensionContent.jsm b/toolkit/components/webextensions/ExtensionContent.jsm
index 9b9a02091e..5f9b88f35c 100644
--- a/toolkit/components/webextensions/ExtensionContent.jsm
+++ b/toolkit/components/webextensions/ExtensionContent.jsm
@@ -344,6 +344,7 @@ class ContentScriptContextChild extends BaseContext {
// because it enables us to create the APIs object in this sandbox object and then copying it
// into the iframe's window, see Bug 1214658 for rationale)
this.sandbox = Cu.Sandbox(contentWindow, {
+ sandboxName: `Web-Accessible Extension Page ${this.extension.id}`,
sandboxPrototype: contentWindow,
sameZoneAs: contentWindow,
wantXrays: false,
@@ -360,6 +361,7 @@ class ContentScriptContextChild extends BaseContext {
this.sandbox = Cu.Sandbox(principal, {
metadata,
+ sandboxName: `Content Script ${this.extension.id}`,
sandboxPrototype: contentWindow,
sameZoneAs: contentWindow,
wantXrays: true,
@@ -456,7 +458,7 @@ class ContentScriptContextChild extends BaseContext {
defineLazyGetter(ContentScriptContextChild.prototype, "messenger", function() {
// The |sender| parameter is passed directly to the extension.
- let sender = {id: this.extension.uuid, frameId: this.frameId, url: this.url};
+ let sender = {id: this.extension.id, frameId: this.frameId, url: this.url};
let filter = {extensionId: this.extension.id};
let optionalFilter = {frameId: this.frameId};
diff --git a/toolkit/components/webextensions/LegacyExtensionsUtils.jsm b/toolkit/components/webextensions/LegacyExtensionsUtils.jsm
index 7632548e30..e8d276fe9c 100644
--- a/toolkit/components/webextensions/LegacyExtensionsUtils.jsm
+++ b/toolkit/components/webextensions/LegacyExtensionsUtils.jsm
@@ -64,7 +64,7 @@ var LegacyExtensionContext = class extends BaseContext {
{value: cloneScope, enumerable: true, configurable: true, writable: true}
);
- let sender = {id: targetExtension.uuid};
+ let sender = {id: targetExtension.id};
let filter = {extensionId: targetExtension.id};
// Legacy addons live in the main process. Messages from other addons are
// Messages from WebExtensions are sent to the main process and forwarded via
diff --git a/toolkit/components/webextensions/ext-c-runtime.js b/toolkit/components/webextensions/ext-c-runtime.js
index 8adca60ca3..1dcac35da7 100644
--- a/toolkit/components/webextensions/ext-c-runtime.js
+++ b/toolkit/components/webextensions/ext-c-runtime.js
@@ -9,6 +9,10 @@ function runtimeApiFactory(context) {
onMessage: context.messenger.onMessage("runtime.onMessage"),
+ onConnectExternal: context.messenger.onConnectExternal("runtime.onConnectExternal"),
+
+ onMessageExternal: context.messenger.onMessageExternal("runtime.onMessageExternal"),
+
connect: function(extensionId, connectInfo) {
let name = connectInfo !== null && connectInfo.name || "";
extensionId = extensionId || extension.id;
@@ -47,7 +51,6 @@ function runtimeApiFactory(context) {
if (options != null && typeof options != "object") {
return Promise.reject({message: "runtime.sendMessage's options argument is invalid"});
}
- // TODO(robwu): Validate option keys and values when we support it.
extensionId = extensionId || extension.id;
let recipient = {extensionId};
diff --git a/toolkit/components/webextensions/schemas/runtime.json b/toolkit/components/webextensions/schemas/runtime.json
index b3f12a768b..575df7d278 100644
--- a/toolkit/components/webextensions/schemas/runtime.json
+++ b/toolkit/components/webextensions/schemas/runtime.json
@@ -535,7 +535,6 @@
},
{
"name": "onConnectExternal",
- "unsupported": true,
"type": "function",
"description": "Fired when a connection is made from another extension.",
"parameters": [
@@ -560,7 +559,6 @@
},
{
"name": "onMessageExternal",
- "unsupported": true,
"type": "function",
"description": "Fired when a message is sent from another extension/app. Cannot be used in a content script.",
"parameters": [
diff --git a/toolkit/components/webextensions/test/mochitest/mochitest.ini b/toolkit/components/webextensions/test/mochitest/mochitest.ini
index 45586237e6..1f61060add 100644
--- a/toolkit/components/webextensions/test/mochitest/mochitest.ini
+++ b/toolkit/components/webextensions/test/mochitest/mochitest.ini
@@ -59,6 +59,7 @@ skip-if = os == 'android' # Android does not support tabs API. Bug 1260250
[test_ext_contentscript_teardown.html]
skip-if = (os == 'android') # Android does not support tabs API. Bug 1260250
[test_ext_exclude_include_globs.html]
+[test_ext_external_messaging.html]
[test_ext_i18n_css.html]
[test_ext_generate.html]
[test_ext_notifications.html]
diff --git a/toolkit/components/webextensions/test/mochitest/test_ext_all_apis.js b/toolkit/components/webextensions/test/mochitest/test_ext_all_apis.js
index 0f617c37e6..25d04b36b6 100644
--- a/toolkit/components/webextensions/test/mochitest/test_ext_all_apis.js
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_all_apis.js
@@ -75,7 +75,9 @@ let expectedBackgroundApis = [
"runtime.getBackgroundPage",
"runtime.getBrowserInfo",
"runtime.getPlatformInfo",
+ "runtime.onConnectExternal",
"runtime.onInstalled",
+ "runtime.onMessageExternal",
"runtime.onStartup",
"runtime.onUpdateAvailable",
"runtime.openOptionsPage",
diff --git a/toolkit/components/webextensions/test/mochitest/test_ext_external_messaging.html b/toolkit/components/webextensions/test/mochitest/test_ext_external_messaging.html
new file mode 100644
index 0000000000..dfc1f9427a
--- /dev/null
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_external_messaging.html
@@ -0,0 +1,111 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <title>WebExtension external messaging</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <script type="text/javascript" src="/tests/SimpleTest/SpawnTask.js"></script>
+ <script type="text/javascript" src="/tests/SimpleTest/ExtensionTestUtils.js"></script>
+ <script type="text/javascript" src="head.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body>
+
+<script type="text/javascript">
+"use strict";
+
+function backgroundScript(id, otherId) {
+ browser.runtime.onMessage.addListener((msg, sender) => {
+ browser.test.fail(`Got unexpected message: ${uneval(msg)} ${uneval(sender)}`);
+ });
+
+ browser.runtime.onConnect.addListener(port => {
+ browser.test.fail(`Got unexpected connection: ${uneval(port.sender)}`);
+ });
+
+ browser.runtime.onMessageExternal.addListener((msg, sender) => {
+ browser.test.assertEq(otherId, sender.id, `${id}: Got expected external sender ID`);
+ browser.test.assertEq(`helo-${id}`, msg, "Got expected message");
+
+ browser.test.sendMessage("onMessage-done");
+
+ return Promise.resolve(`ehlo-${otherId}`);
+ });
+
+ browser.runtime.onConnectExternal.addListener(port => {
+ browser.test.assertEq(otherId, port.sender.id, `${id}: Got expected external connecter ID`);
+
+ port.onMessage.addListener(msg => {
+ browser.test.assertEq(`helo-${id}`, msg, "Got expected port message");
+
+ port.postMessage(`ehlo-${otherId}`);
+
+ browser.test.sendMessage("onConnect-done");
+ });
+ });
+
+ browser.test.onMessage.addListener(msg => {
+ if (msg === "go") {
+ browser.runtime.sendMessage(otherId, `helo-${otherId}`).then(result => {
+ browser.test.assertEq(`ehlo-${id}`, result, "Got expected reply");
+ browser.test.sendMessage("sendMessage-done");
+ });
+
+ let port = browser.runtime.connect(otherId);
+ port.postMessage(`helo-${otherId}`);
+
+ port.onMessage.addListener(msg => {
+ port.disconnect();
+
+ browser.test.assertEq(msg, `ehlo-${id}`, "Got expected port reply");
+ browser.test.sendMessage("connect-done");
+ });
+ }
+ });
+}
+
+function makeExtension(id, otherId) {
+ let args = `${JSON.stringify(id)}, ${JSON.stringify(otherId)}`;
+
+ let extensionData = {
+ background: `(${backgroundScript})(${args})`,
+ manifest: {
+ "applications": {"gecko": {id}},
+ },
+ };
+
+ return ExtensionTestUtils.loadExtension(extensionData);
+}
+
+add_task(function* test_contentscript() {
+ const ID1 = "foo-message@mochitest.mozilla.org";
+ const ID2 = "bar-message@mochitest.mozilla.org";
+
+ let extension1 = makeExtension(ID1, ID2);
+ let extension2 = makeExtension(ID2, ID1);
+
+ yield Promise.all([extension1.startup(), extension2.startup()]);
+
+ extension1.sendMessage("go");
+ extension2.sendMessage("go");
+
+ yield Promise.all([
+ extension1.awaitMessage("sendMessage-done"),
+ extension2.awaitMessage("sendMessage-done"),
+
+ extension1.awaitMessage("onMessage-done"),
+ extension2.awaitMessage("onMessage-done"),
+
+ extension1.awaitMessage("connect-done"),
+ extension2.awaitMessage("connect-done"),
+
+ extension1.awaitMessage("onConnect-done"),
+ extension2.awaitMessage("onConnect-done"),
+ ]);
+
+ yield extension1.unload();
+ yield extension2.unload();
+});
+</script>
+
+</body>
+</html>
diff --git a/toolkit/components/webextensions/test/mochitest/test_ext_sendmessage_reply2.html b/toolkit/components/webextensions/test/mochitest/test_ext_sendmessage_reply2.html
index 1ebc1b40fd..5c350be2fe 100644
--- a/toolkit/components/webextensions/test/mochitest/test_ext_sendmessage_reply2.html
+++ b/toolkit/components/webextensions/test/mochitest/test_ext_sendmessage_reply2.html
@@ -13,48 +13,119 @@
<script type="text/javascript">
"use strict";
-function backgroundScript(token) {
+function backgroundScript(token, id, otherId) {
+ browser.tabs.create({url: "tab.html"});
+
browser.runtime.onMessage.addListener((msg, sender, sendReply) => {
- browser.test.assertTrue(sender.tab.url.endsWith("file_sample.html"), "sender url correct");
+ browser.test.assertEq(id, sender.id, `${id}: Got expected sender ID`);
- if (msg == "done") {
- browser.test.notifyPass("sendmessage_reply");
- return;
+ if (msg === `content-${token}`) {
+ browser.test.assertTrue(sender.tab.url.endsWith("file_sample.html"),
+ `${id}: sender url correct`);
+
+ let tabId = sender.tab.id;
+ browser.tabs.sendMessage(tabId, `${token}-contentMessage`);
+
+ sendReply(`${token}-done`);
+ } else if (msg === `tab-${token}`) {
+ browser.runtime.sendMessage(otherId, `${otherId}-tabMessage`);
+ browser.runtime.sendMessage(`${token}-tabMessage`);
+
+ sendReply(`${token}-done`);
+ } else {
+ browser.test.fail(`${id}: Unexpected runtime message received: ${msg} ${uneval(sender)}`);
}
+ });
+
+ browser.runtime.onMessageExternal.addListener((msg, sender, sendReply) => {
+ browser.test.assertEq(otherId, sender.id, `${id}: Got expected external sender ID`);
+
+ if (msg === `content-${id}`) {
+ browser.test.assertTrue(sender.tab.url.endsWith("file_sample.html"),
+ `${id}: external sender url correct`);
+
+ sendReply(`${otherId}-done`);
+ } else if (msg === `tab-${id}`) {
+ sendReply(`${otherId}-done`);
+ } else if (msg !== `${id}-tabMessage`) {
+ browser.test.fail(`${id}: Unexpected runtime external message received: ${msg} ${uneval(sender)}`);
+ }
+ });
+}
+
+function contentScript(token, id, otherId) {
+ let gotContentMessage = false;
+ browser.runtime.onMessage.addListener((msg, sender, sendReply) => {
+ browser.test.assertEq(id, sender.id, `${id}: Got expected sender ID`);
+
+ browser.test.assertEq(`${token}-contentMessage`, msg,
+ `${id}: Correct content script message`);
+ if (msg === `${token}-contentMessage`) {
+ gotContentMessage = true;
+ }
+ });
+
+ Promise.all([
+ browser.runtime.sendMessage(otherId, `content-${otherId}`).then(resp => {
+ browser.test.assertEq(`${id}-done`, resp, `${id}: Correct content script external response token`);
+ }),
- let tabId = sender.tab.id;
- browser.tabs.sendMessage(tabId, `${token}-tabMessage`);
+ browser.runtime.sendMessage(`content-${token}`).then(resp => {
+ browser.test.assertEq(`${token}-done`, resp, `${id}: Correct content script response token`);
+ }),
+ ]).then(() => {
+ browser.test.assertTrue(gotContentMessage, `${id}: Got content script message`);
- browser.test.assertEq(msg, token, "token matches");
- sendReply(`${token}-done`);
+ browser.test.sendMessage("content-script-done");
});
}
-function contentScript(token) {
+function tabScript(token, id, otherId) {
let gotTabMessage = false;
- let badTabMessage = false;
browser.runtime.onMessage.addListener((msg, sender, sendReply) => {
- if (msg == `${token}-tabMessage`) {
+ browser.test.assertEq(id, sender.id, `${id}: Got expected sender ID`);
+
+ if (String(msg).startsWith("content-")) {
+ return;
+ }
+
+ browser.test.assertEq(`${token}-tabMessage`, msg,
+ `${id}: Correct tab script message`);
+ if (msg === `${token}-tabMessage`) {
gotTabMessage = true;
- } else {
- badTabMessage = true;
}
});
- browser.runtime.sendMessage(token, function(resp) {
- if (resp != `${token}-done` || !gotTabMessage || badTabMessage) {
- return; // test failed
- }
- browser.runtime.sendMessage("done");
+ Promise.all([
+ browser.runtime.sendMessage(otherId, `tab-${otherId}`).then(resp => {
+ browser.test.assertEq(`${id}-done`, resp, `${id}: Correct tab script external response token`);
+ }),
+
+ browser.runtime.sendMessage(`tab-${token}`).then(resp => {
+ browser.test.assertEq(`${token}-done`, resp, `${id}: Correct tab script response token`);
+ }),
+ ]).then(() => {
+ browser.test.assertTrue(gotTabMessage, `${id}: Got tab script message`);
+
+ window.close();
+
+ browser.test.sendMessage("tab-script-done");
});
}
-function makeExtension() {
+function makeExtension(id, otherId) {
let token = Math.random();
+
+ let args = `${token}, ${JSON.stringify(id)}, ${JSON.stringify(otherId)}`;
+
let extensionData = {
- background: `(${backgroundScript})(${token})`,
+ background: `(${backgroundScript})(${args})`,
manifest: {
+ "applications": {"gecko": {id}},
+
"permissions": ["tabs"],
+
+
"content_scripts": [{
"matches": ["http://mochi.test/*/file_sample.html"],
"js": ["content_script.js"],
@@ -63,29 +134,46 @@ function makeExtension() {
},
files: {
- "content_script.js": `(${contentScript})(${token})`,
+ "tab.html": `<!DOCTYPE html>
+ <html>
+ <head>
+ <meta charset="utf-8">
+ <script src="tab.js"><\/script>
+ </head>
+ </html>`,
+
+ "tab.js": `(${tabScript})(${args})`,
+
+ "content_script.js": `(${contentScript})(${args})`,
},
};
return extensionData;
}
add_task(function* test_contentscript() {
- let extension1 = ExtensionTestUtils.loadExtension(makeExtension());
- let extension2 = ExtensionTestUtils.loadExtension(makeExtension());
+ const ID1 = "sendmessage1@mochitest.mozilla.org";
+ const ID2 = "sendmessage2@mochitest.mozilla.org";
+
+ let extension1 = ExtensionTestUtils.loadExtension(makeExtension(ID1, ID2));
+ let extension2 = ExtensionTestUtils.loadExtension(makeExtension(ID2, ID1));
yield Promise.all([extension1.startup(), extension2.startup()]);
let win = window.open("file_sample.html");
- yield Promise.all([waitForLoad(win),
- extension1.awaitFinish("sendmessage_reply"),
- extension2.awaitFinish("sendmessage_reply")]);
+ yield waitForLoad(win);
+
+ yield Promise.all([
+ extension1.awaitMessage("content-script-done"),
+ extension2.awaitMessage("content-script-done"),
+ extension1.awaitMessage("tab-script-done"),
+ extension2.awaitMessage("tab-script-done"),
+ ]);
win.close();
yield extension1.unload();
yield extension2.unload();
- info("extensions unloaded");
});
</script>
diff --git a/toolkit/components/webextensions/test/xpcshell/test_ext_legacy_extension_context.js b/toolkit/components/webextensions/test/xpcshell/test_ext_legacy_extension_context.js
index 63d5361a1e..7708514724 100644
--- a/toolkit/components/webextensions/test/xpcshell/test_ext_legacy_extension_context.js
+++ b/toolkit/components/webextensions/test/xpcshell/test_ext_legacy_extension_context.js
@@ -108,7 +108,7 @@ add_task(function* test_legacy_extension_context() {
"Got the expected message");
ok(msgSender, "Got a message sender object");
- equal(msgSender.id, extensionInfo.uuid, "The sender has the expected id property");
+ equal(msgSender.id, extension.id, "The sender has the expected id property");
equal(msgSender.url, extensionInfo.bgURL, "The sender has the expected url property");
// Wait confirmation that the reply has been received.
@@ -136,7 +136,7 @@ add_task(function* test_legacy_extension_context() {
ok(port, "Got the Port API object");
ok(port.sender, "The port has a sender property");
- equal(port.sender.id, extensionInfo.uuid,
+ equal(port.sender.id, extension.id,
"The port sender has the expected id property");
equal(port.sender.url, extensionInfo.bgURL,
"The port sender has the expected url property");
diff --git a/toolkit/components/xulstore/XULStore.js b/toolkit/components/xulstore/XULStore.js
index c2721327c2..8b5bc13131 100644
--- a/toolkit/components/xulstore/XULStore.js
+++ b/toolkit/components/xulstore/XULStore.js
@@ -63,11 +63,21 @@ XULStore.prototype = {
load: function () {
Services.obs.addObserver(this, "profile-before-change", true);
- this._storeFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
+ let profileType = "ProfD";
+ try {
+ this._storeFile = Services.dirsvc.get(profileType, Ci.nsIFile);
+ } catch (ex) {
+ try {
+ profileType = "ProfDS";
+ this._storeFile = Services.dirsvc.get(profileType, Ci.nsIFile);
+ } catch (ex) {
+ throw new Error("Can't find profile directory.");
+ }
+ }
this._storeFile.append(STOREDB_FILENAME);
if (!this._storeFile.exists()) {
- this.import();
+ this.import(profileType);
} else {
this.readFile();
}
@@ -90,8 +100,8 @@ XULStore.prototype = {
Services.console.logStringMessage("XULStore: " + message);
},
- import: function() {
- let localStoreFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
+ import(profileType) {
+ let localStoreFile = Services.dirsvc.get(profileType || "ProfD", Ci.nsIFile);
localStoreFile.append("localstore.rdf");
if (!localStoreFile.exists()) {
diff --git a/toolkit/content/about.js b/toolkit/content/about.js
index ae467d07ad..c27916c106 100644
--- a/toolkit/content/about.js
+++ b/toolkit/content/about.js
@@ -5,14 +5,24 @@
// get release notes and vendor URL from prefs
var formatter = Components.classes["@mozilla.org/toolkit/URLFormatterService;1"]
.getService(Components.interfaces.nsIURLFormatter);
-var releaseNotesURL = formatter.formatURLPref("app.releaseNotesURL");
+var releaseNotesURL;
+try {
+ releaseNotesURL = formatter.formatURLPref("app.releaseNotesURL");
+} catch(e) {
+ releaseNotesURL = "about:blank";
+}
if (releaseNotesURL != "about:blank") {
var relnotes = document.getElementById("releaseNotesURL");
relnotes.setAttribute("href", releaseNotesURL);
relnotes.parentNode.removeAttribute("hidden");
}
-var vendorURL = formatter.formatURLPref("app.vendorURL");
+var vendorURL;
+try {
+ vendorURL = formatter.formatURLPref("app.vendorURL");
+} catch(e) {
+ vendorURL = "about:blank";
+}
if (vendorURL != "about:blank") {
var vendor = document.getElementById("vendorURL");
vendor.setAttribute("href", vendorURL);
@@ -25,8 +35,15 @@ var versionNum = Components.classes["@mozilla.org/xre/app-info;1"]
var version = document.getElementById("version");
version.textContent += " " + versionNum;
+// insert the buildid of the XUL application
+var BuildIDVal = Components.classes["@mozilla.org/xre/app-info;1"]
+ .getService(Components.interfaces.nsIXULAppInfo)
+ .appBuildID;
+var buildID = document.getElementById("buildID");
+buildID.textContent += " " + BuildIDVal.slice(0,-6);
+
// append user agent
var ua = navigator.userAgent;
if (ua) {
- document.getElementById("buildID").textContent += " " + ua;
+ document.getElementById("userAgent").textContent += " " + ua;
}
diff --git a/toolkit/content/about.xhtml b/toolkit/content/about.xhtml
index d5245928f2..1f57ddcc3c 100644
--- a/toolkit/content/about.xhtml
+++ b/toolkit/content/about.xhtml
@@ -24,7 +24,6 @@
<div id="aboutLogoContainer">
<a id="vendorURL">
<img src="about:logo" alt="&brandShortName;"/>
- <p id="version">&about.version;</p>
</a>
</div>
@@ -33,7 +32,9 @@
<li>&about.license.beforeTheLink;<a href="about:license">&about.license.linkTitle;</a>&about.license.afterTheLink;</li>
<li hidden="true">&about.relnotes.beforeTheLink;<a id="releaseNotesURL">&about.relnotes.linkTitle;</a>&about.relnotes.afterTheLink;</li>
<li>&about.buildconfig.beforeTheLink;<a href="about:buildconfig">&about.buildconfig.linkTitle;</a>&about.buildconfig.afterTheLink;</li>
+ <li id="version">&about.version;</li>
<li id="buildID">&about.buildIdentifier;</li>
+ <li id="userAgent">&about.userAgent;</li>
<script type="application/javascript" src="chrome://global/content/about.js"/>
</ul>
diff --git a/toolkit/content/aboutSupport.js b/toolkit/content/aboutSupport.js
index 5daf6d189d..e9087dfcb0 100644
--- a/toolkit/content/aboutSupport.js
+++ b/toolkit/content/aboutSupport.js
@@ -75,69 +75,7 @@ var snapshotFormatters = {
},
crashes: function crashes(data) {
- if (!AppConstants.MOZ_CRASHREPORTER)
- return;
-
- let strings = stringBundle();
- let daysRange = Troubleshoot.kMaxCrashAge / (24 * 60 * 60 * 1000);
- $("crashes-title").textContent =
- PluralForm.get(daysRange, strings.GetStringFromName("crashesTitle"))
- .replace("#1", daysRange);
- let reportURL;
- try {
- reportURL = Services.prefs.getCharPref("breakpad.reportURL");
- // Ignore any non http/https urls
- if (!/^https?:/i.test(reportURL))
- reportURL = null;
- }
- catch (e) { }
- if (!reportURL) {
- $("crashes-noConfig").style.display = "block";
- $("crashes-noConfig").classList.remove("no-copy");
- return;
- }
- $("crashes-allReports").style.display = "block";
- $("crashes-allReports").classList.remove("no-copy");
-
- if (data.pending > 0) {
- $("crashes-allReportsWithPending").textContent =
- PluralForm.get(data.pending, strings.GetStringFromName("pendingReports"))
- .replace("#1", data.pending);
- }
-
- let dateNow = new Date();
- $.append($("crashes-tbody"), data.submitted.map(function (crash) {
- let date = new Date(crash.date);
- let timePassed = dateNow - date;
- let formattedDate;
- if (timePassed >= 24 * 60 * 60 * 1000)
- {
- let daysPassed = Math.round(timePassed / (24 * 60 * 60 * 1000));
- let daysPassedString = strings.GetStringFromName("crashesTimeDays");
- formattedDate = PluralForm.get(daysPassed, daysPassedString)
- .replace("#1", daysPassed);
- }
- else if (timePassed >= 60 * 60 * 1000)
- {
- let hoursPassed = Math.round(timePassed / (60 * 60 * 1000));
- let hoursPassedString = strings.GetStringFromName("crashesTimeHours");
- formattedDate = PluralForm.get(hoursPassed, hoursPassedString)
- .replace("#1", hoursPassed);
- }
- else
- {
- let minutesPassed = Math.max(Math.round(timePassed / (60 * 1000)), 1);
- let minutesPassedString = strings.GetStringFromName("crashesTimeMinutes");
- formattedDate = PluralForm.get(minutesPassed, minutesPassedString)
- .replace("#1", minutesPassed);
- }
- return $.new("tr", [
- $.new("td", [
- $.new("a", crash.id, null, {href : reportURL + crash.id})
- ]),
- $.new("td", formattedDate)
- ]);
- }));
+ return;
},
extensions: function extensions(data) {
@@ -151,22 +89,6 @@ var snapshotFormatters = {
}));
},
- experiments: function experiments(data) {
- $.append($("experiments-tbody"), data.map(function (experiment) {
- return $.new("tr", [
- $.new("td", experiment.name),
- $.new("td", experiment.id),
- $.new("td", experiment.description),
- $.new("td", experiment.active),
- $.new("td", experiment.endDate),
- $.new("td", [
- $.new("a", experiment.detailURL, null, {href : experiment.detailURL, })
- ]),
- $.new("td", experiment.branch),
- ]);
- }));
- },
-
modifiedPreferences: function modifiedPreferences(data) {
$.append($("prefs-tbody"), sortedArrayFromObject(data).map(
function ([name, value]) {
@@ -793,7 +715,8 @@ Serializer.prototype = {
let hasText = false;
for (let child of elem.childNodes) {
if (child.nodeType == Node.TEXT_NODE) {
- let text = this._nodeText(child);
+ let text = this._nodeText(
+ child, (child.classList && child.classList.contains("endline")));
this._appendText(text);
hasText = hasText || !!text.trim();
}
@@ -820,7 +743,7 @@ Serializer.prototype = {
}
},
- _startNewLine: function (lines) {
+ _startNewLine: function () {
let currLine = this._currentLine;
if (currLine) {
// The current line is not empty. Trim it.
@@ -832,7 +755,7 @@ Serializer.prototype = {
this._lines.push("");
},
- _appendText: function (text, lines) {
+ _appendText: function (text) {
this._currentLine += text;
},
@@ -855,7 +778,8 @@ Serializer.prototype = {
let col = tableHeadingCols[i];
if (col.localName != "th" || col.classList.contains("title-column"))
break;
- colHeadings[i] = this._nodeText(col).trim();
+ colHeadings[i] = this._nodeText(
+ col, (col.classList && col.classList.contains("endline"))).trim();
}
}
let hasColHeadings = Object.keys(colHeadings).length > 0;
@@ -882,7 +806,10 @@ Serializer.prototype = {
let text = "";
if (colHeadings[j])
text += colHeadings[j] + ": ";
- text += this._nodeText(children[j]).trim();
+ text += this._nodeText(
+ children[j],
+ (children[j].classList &&
+ children[j].classList.contains("endline"))).trim();
this._appendText(text);
this._startNewLine();
}
@@ -898,7 +825,10 @@ Serializer.prototype = {
if (this._ignoreElement(trs[i]))
continue;
let children = trs[i].querySelectorAll("th,td");
- let rowHeading = this._nodeText(children[0]).trim();
+ let rowHeading = this._nodeText(
+ children[0],
+ (children[0].classList &&
+ children[0].classList.contains("endline"))).trim();
if (children[0].classList.contains("title-column")) {
if (!this._isHiddenSubHeading(children[0]))
this._appendText(rowHeading);
@@ -912,7 +842,10 @@ Serializer.prototype = {
// queued up from querySelectorAll earlier.
this._appendText(rowHeading + ": ");
} else {
- this._appendText(rowHeading + ": " + this._nodeText(children[1]).trim());
+ this._appendText(rowHeading + ": " + this._nodeText(
+ children[1],
+ (children[1].classList &&
+ children[1].classList.contains("endline"))).trim());
}
}
this._startNewLine();
@@ -924,8 +857,16 @@ Serializer.prototype = {
return elem.classList.contains("no-copy");
},
- _nodeText: function (node) {
- return node.textContent.replace(/\s+/g, " ");
+ _nodeText: function (node, endline) {
+ let whiteChars = /\s+/g
+ let whiteCharsButNoEndline = /(?!\n)[\s]+/g;
+ let _node = node.cloneNode(true);
+ if (_node.firstElementChild &&
+ (_node.firstElementChild.nodeName.toLowerCase() == "button")) {
+ _node.removeChild(_node.firstElementChild);
+ }
+ return _node.textContent.replace(
+ endline ? whiteCharsButNoEndline : whiteChars, " ");
},
};
@@ -997,7 +938,7 @@ function setupEventListeners() {
PlacesDBUtils.checkAndFixDatabase(function(aLog) {
let msg = aLog.join("\n");
$("verify-place-result").style.display = "block";
- $("verify-place-result").classList.remove("no-copy");
+ $("verify-place-result-parent").classList.remove("no-copy");
$("verify-place-result").textContent = msg;
});
});
diff --git a/toolkit/content/aboutSupport.xhtml b/toolkit/content/aboutSupport.xhtml
index e2885c8b80..9574365a34 100644
--- a/toolkit/content/aboutSupport.xhtml
+++ b/toolkit/content/aboutSupport.xhtml
@@ -253,34 +253,6 @@
</table>
<!-- - - - - - - - - - - - - - - - - - - - - -->
-#ifdef MOZ_CRASHREPORTER
-
- <h2 class="major-section" id="crashes-title">
- &aboutSupport.crashes.title;
- </h2>
-
- <table id="crashes-table">
- <thead>
- <tr>
- <th>
- &aboutSupport.crashes.id;
- </th>
- <th>
- &aboutSupport.crashes.sendDate;
- </th>
- </tr>
- </thead>
- <tbody id="crashes-tbody">
- </tbody>
- </table>
- <p id="crashes-allReports" class="hidden no-copy">
- <a href="about:crashes" id="crashes-allReportsWithPending" class="block">&aboutSupport.crashes.allReports;</a>
- </p>
- <p id="crashes-noConfig" class="hidden no-copy">&aboutSupport.crashes.noConfig;</p>
-
-#endif
- <!-- - - - - - - - - - - - - - - - - - - - - -->
-
<h2 class="major-section">
&aboutSupport.extensionsTitle;
</h2>
@@ -435,16 +407,16 @@
</h2>
<table>
- <tr class="no-copy">
+ <tr id="verify-place-result-parent" class="no-copy">
<th class="column">
&aboutSupport.placeDatabaseIntegrity;
</th>
- <td>
+ <td class="endline">
<button id="verify-place-integrity-button">
&aboutSupport.placeDatabaseVerifyIntegrity;
</button>
- <pre id="verify-place-result" class="hidden no-copy"></pre>
+ <pre id="verify-place-result" class="hidden"></pre>
</td>
</tr>
</table>
@@ -504,39 +476,6 @@
</table>
- <h2 class="major-section">
- &aboutSupport.experimentsTitle;
- </h2>
-
- <table>
- <thead>
- <tr>
- <th>
- &aboutSupport.experimentName;
- </th>
- <th>
- &aboutSupport.experimentId;
- </th>
- <th>
- &aboutSupport.experimentDescription;
- </th>
- <th>
- &aboutSupport.experimentActive;
- </th>
- <th>
- &aboutSupport.experimentEndDate;
- </th>
- <th>
- &aboutSupport.experimentHomepage;
- </th>
- <th>
- &aboutSupport.experimentBranch;
- </th>
- </tr>
- </thead>
- <tbody id="experiments-tbody">
- </tbody>
- </table>
<!-- - - - - - - - - - - - - - - - - - - - - -->
#if defined(MOZ_SANDBOX)
diff --git a/toolkit/content/browser-child.js b/toolkit/content/browser-child.js
index c819e3db65..7d0fe18c5f 100644
--- a/toolkit/content/browser-child.js
+++ b/toolkit/content/browser-child.js
@@ -17,12 +17,6 @@ Cu.import("resource://gre/modules/Timer.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PageThumbUtils",
"resource://gre/modules/PageThumbUtils.jsm");
-if (AppConstants.MOZ_CRASHREPORTER) {
- XPCOMUtils.defineLazyServiceGetter(this, "CrashReporter",
- "@mozilla.org/xre/app-info;1",
- "nsICrashReporter");
-}
-
function makeInputStream(aString) {
let stream = Cc["@mozilla.org/io/string-input-stream;1"].
createInstance(Ci.nsISupportsCString);
@@ -174,15 +168,6 @@ var WebProgressListener = {
json.principal = content.document.nodePrincipal;
json.synthetic = content.document.mozSyntheticDocument;
json.inLoadURI = WebNavigation.inLoadURI;
-
- if (AppConstants.MOZ_CRASHREPORTER && CrashReporter.enabled) {
- let uri = aLocationURI.clone();
- try {
- // If the current URI contains a username/password, remove it.
- uri.userPass = "";
- } catch (ex) { /* Ignore failures on about: URIs. */ }
- CrashReporter.annotateCrashReport("URL", uri.spec);
- }
}
this._send("Content:LocationChange", json, objects);
@@ -310,17 +295,6 @@ var WebNavigation = {
},
loadURI: function(uri, flags, referrer, referrerPolicy, postData, headers, baseURI) {
- if (AppConstants.MOZ_CRASHREPORTER && CrashReporter.enabled) {
- let annotation = uri;
- try {
- let url = Services.io.newURI(uri, null, null);
- // If the current URI contains a username/password, remove it.
- url.userPass = "";
- annotation = url.spec;
- } catch (ex) { /* Ignore failures to parse and failures
- on about: URIs. */ }
- CrashReporter.annotateCrashReport("URL", annotation);
- }
if (referrer)
referrer = Services.io.newURI(referrer, null, null);
if (postData)
diff --git a/toolkit/content/browser-content.js b/toolkit/content/browser-content.js
index 4ae798fbdc..1376f70a3a 100644
--- a/toolkit/content/browser-content.js
+++ b/toolkit/content/browser-content.js
@@ -1714,6 +1714,14 @@ let DateTimePickerListener = {
(aEvent.originalTarget.type == "time" && !this.getTimePickerPref())) {
return;
}
+
+ if (this._inputElement) {
+ // This happens when we're trying to open a picker when another picker
+ // is still open. We ignore this request to let the first picker
+ // close gracefully.
+ return;
+ }
+
this._inputElement = aEvent.originalTarget;
this._inputElement.setDateTimePickerState(true);
this.addListeners();
@@ -1728,15 +1736,17 @@ let DateTimePickerListener = {
// element's value.
value: Object.keys(value).length > 0 ? value
: this._inputElement.value,
- step: this._inputElement.step,
- min: this._inputElement.min,
- max: this._inputElement.max,
+ min: this._inputElement.getMinimum(),
+ max: this._inputElement.getMaximum(),
+ step: this._inputElement.getStep(),
+ stepBase: this._inputElement.getStepBase(),
},
});
break;
}
case "MozUpdateDateTimePicker": {
let value = this._inputElement.getDateTimeInputBoxValue();
+ value.type = this._inputElement.type;
sendAsyncMessage("FormDateTime:UpdatePicker", { value });
break;
}
diff --git a/toolkit/content/customizeToolbar.js b/toolkit/content/customizeToolbar.js
index b96b60b987..7400aaadc6 100644
--- a/toolkit/content/customizeToolbar.js
+++ b/toolkit/content/customizeToolbar.js
@@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+const gToolbarInfoSeparators = ["|", "-"];
+
var gToolboxDocument = null;
var gToolbox = null;
var gCurrentDragOverItem = null;
@@ -173,9 +175,20 @@ function persistCurrentSets()
// Remove custom toolbars whose contents have been removed.
gToolbox.removeChild(toolbar);
} else if (gToolbox.toolbarset) {
+ var hidingAttribute = toolbar.getAttribute("type") == "menubar" ?
+ "autohide" : "collapsed";
// Persist custom toolbar info on the <toolbarset/>
- gToolbox.toolbarset.setAttribute("toolbar"+(++customCount),
- toolbar.toolbarName + ":" + currentSet);
+ // Attributes:
+ // Names: "toolbarX" (X - the number of the toolbar)
+ // Values: "Name|HidingAttributeName-HidingAttributeValue|CurrentSet"
+ gToolbox.toolbarset.setAttribute("toolbar" + (++customCount),
+ toolbar.toolbarName
+ + gToolbarInfoSeparators[0]
+ + hidingAttribute
+ + gToolbarInfoSeparators[1]
+ + toolbar.getAttribute(hidingAttribute)
+ + gToolbarInfoSeparators[0]
+ + currentSet);
gToolboxDocument.persist(gToolbox.toolbarset.id, "toolbar"+customCount);
}
}
@@ -485,6 +498,11 @@ function addNewToolbar()
continue;
}
+ if (name.value.includes(gToolbarInfoSeparators[0])) {
+ message = stringBundle.getFormattedString("enterToolbarIllegalChars", [name.value]);
+ continue;
+ }
+
var dupeFound = false;
// Check for an existing toolbar with the same display name
@@ -506,7 +524,7 @@ function addNewToolbar()
message = stringBundle.getFormattedString("enterToolbarDup", [name.value]);
}
- gToolbox.appendCustomToolbar(name.value, "");
+ gToolbox.appendCustomToolbar(name.value, "", [null, null]);
toolboxChanged();
diff --git a/toolkit/content/datepicker.xhtml b/toolkit/content/datepicker.xhtml
new file mode 100644
index 0000000000..4da6e398f8
--- /dev/null
+++ b/toolkit/content/datepicker.xhtml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE html [
+ <!ENTITY % htmlDTD PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
+ %htmlDTD;
+]>
+<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
+<head>
+ <title>Date Picker</title>
+ <link rel="stylesheet" href="chrome://global/skin/datetimeinputpickers.css"/>
+ <script type="application/javascript" src="chrome://global/content/bindings/datekeeper.js"></script>
+ <script type="application/javascript" src="chrome://global/content/bindings/spinner.js"></script>
+ <script type="application/javascript" src="chrome://global/content/bindings/calendar.js"></script>
+ <script type="application/javascript" src="chrome://global/content/bindings/datepicker.js"></script>
+</head>
+<body>
+ <div id="date-picker">
+ <div class="calendar-container">
+ <div class="nav">
+ <button class="left"/>
+ <button class="right"/>
+ </div>
+ <div class="week-header"></div>
+ <div class="days-viewport">
+ <div class="days-view"></div>
+ </div>
+ </div>
+ <div class="month-year-container">
+ <button class="month-year"/>
+ </div>
+ <div class="month-year-view"></div>
+ </div>
+ <template id="spinner-template">
+ <div class="spinner-container">
+ <button class="up"/>
+ <div class="spinner"></div>
+ <button class="down"/>
+ </div>
+ </template>
+ <script type="application/javascript">
+ // We need to hide the scroll bar but maintain its scrolling
+ // capability, so using |overflow: hidden| is not an option.
+ // Instead, we are inserting a user agent stylesheet that is
+ // capable of selecting scrollbars, and do |display: none|.
+ var domWinUtls = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
+ getInterface(Components.interfaces.nsIDOMWindowUtils);
+ domWinUtls.loadSheetUsingURIString('data:text/css,@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"); scrollbar { display: none; }', domWinUtls.AGENT_SHEET);
+ // Create a DatePicker instance and prepare to be
+ // initialized by the "DatePickerInit" event from datetimepopup.xml
+ const root = document.getElementById("date-picker");
+ new DatePicker({
+ monthYear: root.querySelector(".month-year"),
+ monthYearView: root.querySelector(".month-year-view"),
+ buttonLeft: root.querySelector(".left"),
+ buttonRight: root.querySelector(".right"),
+ weekHeader: root.querySelector(".week-header"),
+ daysView: root.querySelector(".days-view")
+ });
+ </script>
+</body>
+</html> \ No newline at end of file
diff --git a/toolkit/content/jar.mn b/toolkit/content/jar.mn
index 0a0f0253b2..f0d4a62a4f 100644
--- a/toolkit/content/jar.mn
+++ b/toolkit/content/jar.mn
@@ -12,7 +12,7 @@ toolkit.jar:
content/global/about.xhtml
content/global/aboutAbout.js
content/global/aboutAbout.xhtml
-#ifdef MOZILLA_OFFICIAL
+#ifdef MC_OFFICIAL
content/global/aboutRights.xhtml
#else
content/global/aboutRights.xhtml (aboutRights-unbranded.xhtml)
@@ -28,7 +28,7 @@ toolkit.jar:
content/global/aboutwebrtc/aboutWebrtc.css (aboutwebrtc/aboutWebrtc.css)
content/global/aboutwebrtc/aboutWebrtc.js (aboutwebrtc/aboutWebrtc.js)
content/global/aboutwebrtc/aboutWebrtc.html (aboutwebrtc/aboutWebrtc.html)
- content/global/aboutSupport.js
+* content/global/aboutSupport.js
* content/global/aboutSupport.xhtml
content/global/aboutTelemetry.js
content/global/aboutTelemetry.xhtml
@@ -45,6 +45,7 @@ toolkit.jar:
content/global/customizeToolbar.js
content/global/customizeToolbar.xul
#endif
+ content/global/datepicker.xhtml
#ifndef MOZ_FENNEC
content/global/editMenuOverlay.js
* content/global/editMenuOverlay.xul
@@ -54,7 +55,12 @@ toolkit.jar:
#endif
content/global/filepicker.properties
content/global/globalOverlay.js
+ content/global/memoriam.xhtml
+* content/global/mozilla.css
content/global/mozilla.xhtml
+#ifdef MOZ_PHOENIX
+ content/global/logopage.xhtml
+#endif
content/global/process-content.js
content/global/resetProfile.css
content/global/resetProfile.js
@@ -75,8 +81,11 @@ toolkit.jar:
content/global/bindings/autocomplete.xml (widgets/autocomplete.xml)
content/global/bindings/browser.xml (widgets/browser.xml)
content/global/bindings/button.xml (widgets/button.xml)
+ content/global/bindings/calendar.js (widgets/calendar.js)
content/global/bindings/checkbox.xml (widgets/checkbox.xml)
content/global/bindings/colorpicker.xml (widgets/colorpicker.xml)
+ content/global/bindings/datekeeper.js (widgets/datekeeper.js)
+ content/global/bindings/datepicker.js (widgets/datepicker.js)
content/global/bindings/datetimepicker.xml (widgets/datetimepicker.xml)
content/global/bindings/datetimepopup.xml (widgets/datetimepopup.xml)
content/global/bindings/datetimebox.xml (widgets/datetimebox.xml)
diff --git a/toolkit/content/license.html b/toolkit/content/license.html
index 99ee42fde1..a348fdfa60 100644
--- a/toolkit/content/license.html
+++ b/toolkit/content/license.html
@@ -87,7 +87,7 @@
<li><a href="about:license#dtoa">dtoa License</a></li>
<li><a href="about:license#hunspell-nl">Dutch Spellchecking Dictionary License</a></li>
#if defined(XP_WIN) || defined(XP_LINUX)
- <li><a href="about:license#emojione">EmojiOne License</a></li>
+ <li><a href="about:license#twemoji">Twemoji License</a></li>
#endif
<li><a href="about:license#hunspell-ee">Estonian Spellchecking Dictionary License</a></li>
<li><a href="about:license#expat">Expat License</a></li>
@@ -103,7 +103,6 @@
<li><a href="about:license#icu">ICU License</a></li>
<li><a href="about:license#immutable">Immutable.js License</a></li>
<li><a href="about:license#jpnic">Japan Network Information Center License</a></li>
- <li><a href="about:license#jemalloc">jemalloc License</a></li>
<li><a href="about:license#jquery">jQuery License</a></li>
<li><a href="about:license#k_exp">k_exp License</a></li>
<li><a href="about:license#khronos">Khronos group License</a></li>
@@ -2911,14 +2910,13 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<hr>
#if defined(XP_WIN) || defined(XP_LINUX)
- <h1><a id="emojione"></a>EmojiOne License</h1>
+ <h1><a id="twemoji"></a>Twemoji License</h1>
<p>This license applies to the emoji art contained within the bundled
emoji font file.</p>
<pre>
-Copyright (c) 2016 Ranks.com Inc.
-Copyright (c) 2014 Twitter, Inc and other contributors.
+Copyright (c) 2018 Twitter, Inc and other contributors.
Creative Commons Attribution 4.0 International (CC BY 4.0)
@@ -3528,46 +3526,6 @@ Chiyoda-ku, Tokyo 101-0047, Japan.
<hr>
- <h1><a id="jemalloc"></a>jemalloc License</h1>
-
- <p>This license applies to files in the directories
- <span class="path">memory/mozjemalloc/</span> and
- <span class="path">memory/jemalloc/</span>.
- </p>
-
-<pre>
-Copyright (C) 2002-2012 Jason Evans &lt;jasone@canonware.com&gt;.
-All rights reserved.
-Copyright (C) 2007-2012 Mozilla Foundation. All rights reserved.
-Copyright (C) 2009-2012 Facebook, Inc. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-1. Redistributions of source code must retain the above copyright
- notice(s), this list of conditions and the following disclaimer as
- the first lines of this file unmodified other than the possible
- addition of one or more copyright notices.
-2. Redistributions in binary form must reproduce the above copyright
- notice(s), this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER(S) ``AS IS'' AND ANY
-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
-EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-</pre>
-
- <hr>
-
<h1><a id="jquery"></a>jQuery License</h1>
<p>This license applies to all copies of jQuery in the code.</p>
diff --git a/toolkit/content/logopage.xhtml b/toolkit/content/logopage.xhtml
new file mode 100644
index 0000000000..bcf1da0f00
--- /dev/null
+++ b/toolkit/content/logopage.xhtml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd" [
+]>
+
+<!-- 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 xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title></title>
+ <style type="text/css">
+ body {
+ background: Menu;
+ color: MenuText;
+ }
+
+ img {
+ text-align: center;
+ position: absolute;
+ margin: auto;
+ top: 0;
+ right: 0;
+ bottom: 0;
+ left: 0;
+ opacity: 0.2;
+ }
+ </style>
+</head>
+
+<body>
+ <img src="about:logo" alt=""/>
+</body>
+</html>
diff --git a/toolkit/content/memoriam.xhtml b/toolkit/content/memoriam.xhtml
new file mode 100644
index 0000000000..f1a1b474d5
--- /dev/null
+++ b/toolkit/content/memoriam.xhtml
@@ -0,0 +1,76 @@
+<!DOCTYPE html
+[
+ <!ENTITY % directionDTD SYSTEM "chrome://global/locale/global.dtd" >
+ %directionDTD;
+ <!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
+ %brandDTD;
+]>
+
+<!-- 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 xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <meta charset='utf-8' />
+ <title>Mozilla: In Memoriam</title>
+
+<style>
+html {
+ background: maroon radial-gradient( circle, #a01010 0%, #800000 80%) center center / cover no-repeat;
+ color: white;
+ font-style: italic;
+ text-rendering: optimizeLegibility;
+ min-height: 100%;
+}
+
+#moztext {
+ margin-top: 15%;
+ font-size: 1.1em;
+ font-family: serif;
+ text-align: center;
+ line-height: 1.5;
+}
+
+#from {
+ font-size: 1.0em;
+ font-family: serif;
+ text-align: right;
+}
+
+em {
+ font-size: 1.3em;
+ line-height: 0;
+}
+
+a {
+ text-decoration: none;
+ color: white;
+}
+</style>
+</head>
+
+<body dir="&locale.dir;">
+
+<section>
+ <p id="moztext">
+ <h1>Mozilla: In Memoriam</h1>
+ <br/>
+ Dedicated to the tireless developers who have come and gone.<br/>
+ To those who have put their heart and soul into Mozilla products.<br/>
+ To those who have seen their good intentions and hard work squandered.<br/>
+ To those who really cared about the user, and cared about usability.<br/>
+ To those who truly understood us and desired freedom, but were unheard.<br/>
+ To those who knew that change is inevitable, but loss of vision is not.<br/>
+ To those who were forced to give up the good fight.<br/>
+ <br/>
+ <em>Thank you.</em> &brandFullName; would not have been possible without you.<br/>
+ <br/>
+ </p>
+
+ <p id="from">
+ </p>
+</section>
+
+</body>
+</html> \ No newline at end of file
diff --git a/toolkit/content/mozilla.css b/toolkit/content/mozilla.css
new file mode 100644
index 0000000000..d5eae6415c
--- /dev/null
+++ b/toolkit/content/mozilla.css
@@ -0,0 +1,36 @@
+html {
+%ifdef MC_PALEMOON
+ background: #333399 radial-gradient( circle at 75% 25%, #6666b0 0%, #333399 40%, #111177 80%) center center / cover no-repeat;
+%else
+ background: maroon radial-gradient( circle, #a01010 0%, #800000 80%) center center / cover no-repeat;
+%endif
+
+ color: white;
+ font-style: italic;
+ text-rendering: optimizeLegibility;
+ min-height: 100%;
+}
+
+#moztext {
+ margin-top: 15%;
+ font-size: 1.1em;
+ font-family: serif;
+ text-align: center;
+ line-height: 1.5;
+}
+
+#from {
+ font-size: 1.95em;
+ font-family: serif;
+ text-align: right;
+}
+
+em {
+ font-size: 1.3em;
+ line-height: 0;
+}
+
+a {
+ text-decoration: none;
+ color: white;
+} \ No newline at end of file
diff --git a/toolkit/content/mozilla.xhtml b/toolkit/content/mozilla.xhtml
index 2acfc9f5d0..8c79b5ff99 100644
--- a/toolkit/content/mozilla.xhtml
+++ b/toolkit/content/mozilla.xhtml
@@ -15,39 +15,8 @@
<meta charset='utf-8' />
<title>&chronicles.title.55.2;</title>
-<style>
-html {
- background: maroon radial-gradient( circle, #a01010 0%, #800000 80%) center center / cover no-repeat;
- color: white;
- font-style: italic;
- text-rendering: optimizeLegibility;
- min-height: 100%;
-}
-
-#moztext {
- margin-top: 15%;
- font-size: 1.1em;
- font-family: serif;
- text-align: center;
- line-height: 1.5;
-}
-
-#from {
- font-size: 1.95em;
- font-family: serif;
- text-align: right;
-}
-
-em {
- font-size: 1.3em;
- line-height: 0;
-}
-
-a {
- text-decoration: none;
- color: white;
-}
-</style>
+ <link rel="stylesheet" href="chrome://global/content/mozilla.css"
+ type="text/css"/>
</head>
<body dir="&locale.dir;">
diff --git a/toolkit/content/plugins.html b/toolkit/content/plugins.html
index 84cbba596a..15bbed9bbd 100644
--- a/toolkit/content/plugins.html
+++ b/toolkit/content/plugins.html
@@ -10,6 +10,7 @@
"use strict";
Components.utils.import("resource://gre/modules/Services.jsm");
+ Components.utils.import("resource://gre/modules/AddonManager.jsm");
var Ci = Components.interfaces;
var strBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"].getService(Ci.nsIStringBundleService);
@@ -57,7 +58,7 @@
*/
navigator.plugins.refresh(false);
- addMessageListener("PluginList", function({ data: aPlugins }) {
+ AddonManager.getAddonsByTypes(["plugin"], function (aPlugins) {
var fragment = document.createDocumentFragment();
// "Installed plugins"
@@ -74,15 +75,6 @@
enabledplugins.appendChild(document.createTextNode(pluginsbundle.GetStringFromName(label)));
fragment.appendChild(enabledplugins);
- var deprecation = document.createElement("p");
- deprecation.setAttribute("class", "notice");
- deprecation.textContent = pluginsbundle.GetStringFromName("deprecation_description") + " \u00A0 ";
- var deprecationLink = document.createElement("a");
- deprecationLink.textContent = pluginsbundle.GetStringFromName("deprecation_learn_more");
- deprecationLink.href = Services.urlFormatter.formatURLPref("app.support.baseURL") + "npapi";
- deprecation.appendChild(deprecationLink);
- fragment.appendChild(deprecation);
-
var stateNames = {};
["STATE_SOFTBLOCKED",
"STATE_BLOCKED",
@@ -209,8 +201,6 @@
document.getElementById("outside").appendChild(fragment);
});
-
- sendAsyncMessage("RequestPlugins");
</script>
</div>
</body>
diff --git a/toolkit/content/tests/browser/browser.ini b/toolkit/content/tests/browser/browser.ini
index 278b2ffe02..67ba2f850c 100644
--- a/toolkit/content/tests/browser/browser.ini
+++ b/toolkit/content/tests/browser/browser.ini
@@ -26,6 +26,7 @@ skip-if = !e10s
[browser_contentTitle.js]
[browser_crash_previous_frameloader.js]
run-if = e10s && crashreporter
+[browser_datetime_datepicker.js]
[browser_default_image_filename.js]
[browser_f7_caret_browsing.js]
[browser_findbar.js]
diff --git a/toolkit/content/tests/browser/browser_datetime_datepicker.js b/toolkit/content/tests/browser/browser_datetime_datepicker.js
new file mode 100644
index 0000000000..966a74e7a7
--- /dev/null
+++ b/toolkit/content/tests/browser/browser_datetime_datepicker.js
@@ -0,0 +1,284 @@
+/* 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";
+
+const MONTH_YEAR = ".month-year",
+ DAYS_VIEW = ".days-view",
+ BTN_PREV_MONTH = ".prev",
+ BTN_NEXT_MONTH = ".next";
+const DATE_FORMAT = new Intl.DateTimeFormat("en-US", { year: "numeric", month: "long", timeZone: "UTC" }).format;
+
+// Create a list of abbreviations for calendar class names
+const W = "weekend",
+ O = "outside",
+ S = "selection",
+ R = "out-of-range",
+ T = "today",
+ P = "off-step";
+
+// Calendar classlist for 2016-12. Used to verify the classNames are correct.
+const calendarClasslist_201612 = [
+ [W, O], [O], [O], [O], [], [], [W],
+ [W], [], [], [], [], [], [W],
+ [W], [], [], [], [S], [], [W],
+ [W], [], [], [], [], [], [W],
+ [W], [], [], [], [], [], [W],
+ [W, O], [O], [O], [O], [O], [O], [W, O],
+];
+
+function getCalendarText() {
+ return helper.getChildren(DAYS_VIEW).map(child => child.textContent);
+}
+
+function getCalendarClassList() {
+ return helper.getChildren(DAYS_VIEW).map(child => Array.from(child.classList));
+}
+
+function mergeArrays(a, b) {
+ return a.map((classlist, index) => classlist.concat(b[index]));
+}
+
+let helper = new DateTimeTestHelper();
+
+registerCleanupFunction(() => {
+ helper.cleanup();
+});
+
+/**
+ * Test that date picker opens to today's date when input field is blank
+ */
+add_task(async function test_datepicker_today() {
+ const date = new Date();
+
+ await helper.openPicker("data:text/html, <input type='date'>");
+
+ Assert.equal(helper.getElement(MONTH_YEAR).textContent, DATE_FORMAT(date));
+
+ await helper.tearDown();
+});
+
+/**
+ * Test that date picker opens to the correct month, with calendar days
+ * displayed correctly, given a date value is set.
+ */
+add_task(async function test_datepicker_open() {
+ const inputValue = "2016-12-15";
+
+ await helper.openPicker(`data:text/html, <input type="date" value="${inputValue}">`);
+
+ Assert.equal(helper.getElement(MONTH_YEAR).textContent, DATE_FORMAT(new Date(inputValue)));
+ Assert.deepEqual(
+ getCalendarText(),
+ [
+ "27", "28", "29", "30", "1", "2", "3",
+ "4", "5", "6", "7", "8", "9", "10",
+ "11", "12", "13", "14", "15", "16", "17",
+ "18", "19", "20", "21", "22", "23", "24",
+ "25", "26", "27", "28", "29", "30", "31",
+ "1", "2", "3", "4", "5", "6", "7",
+ ],
+ "2016-12",
+ );
+ Assert.deepEqual(
+ getCalendarClassList(),
+ calendarClasslist_201612,
+ "2016-12 classNames"
+ );
+
+ await helper.tearDown();
+});
+
+/**
+ * When the prev month button is clicked, calendar should display the dates for
+ * the previous month.
+ */
+add_task(async function test_datepicker_prev_month_btn() {
+ const inputValue = "2016-12-15";
+ const prevMonth = "2016-11-01";
+
+ await helper.openPicker(`data:text/html, <input type="date" value="${inputValue}">`);
+ helper.click(helper.getElement(BTN_PREV_MONTH));
+
+ Assert.equal(helper.getElement(MONTH_YEAR).textContent, DATE_FORMAT(new Date(prevMonth)));
+ Assert.deepEqual(
+ getCalendarText(),
+ [
+ "30", "31", "1", "2", "3", "4", "5",
+ "6", "7", "8", "9", "10", "11", "12",
+ "13", "14", "15", "16", "17", "18", "19",
+ "20", "21", "22", "23", "24", "25", "26",
+ "27", "28", "29", "30", "1", "2", "3",
+ "4", "5", "6", "7", "8", "9", "10",
+ ],
+ "2016-11",
+ );
+
+ await helper.tearDown();
+});
+
+/**
+ * When the next month button is clicked, calendar should display the dates for
+ * the next month.
+ */
+add_task(async function test_datepicker_next_month_btn() {
+ const inputValue = "2016-12-15";
+ const nextMonth = "2017-01-01";
+
+ await helper.openPicker(`data:text/html, <input type="date" value="${inputValue}">`);
+ helper.click(helper.getElement(BTN_NEXT_MONTH));
+
+ Assert.equal(helper.getElement(MONTH_YEAR).textContent, DATE_FORMAT(new Date(nextMonth)));
+ Assert.deepEqual(
+ getCalendarText(),
+ [
+ "25", "26", "27", "28", "29", "30", "31",
+ "1", "2", "3", "4", "5", "6", "7",
+ "8", "9", "10", "11", "12", "13", "14",
+ "15", "16", "17", "18", "19", "20", "21",
+ "22", "23", "24", "25", "26", "27", "28",
+ "29", "30", "31", "1", "2", "3", "4",
+ ],
+ "2017-01",
+ );
+
+ await helper.tearDown();
+});
+
+/**
+ * When a date on the calendar is clicked, date picker should close and set
+ * value to the input box.
+ */
+add_task(async function test_datepicker_clicked() {
+ const inputValue = "2016-12-15";
+ const firstDayOnCalendar = "2016-11-27";
+
+ await helper.openPicker(`data:text/html, <input type="date" value="${inputValue}">`);
+ // Click the first item (top-left corner) of the calendar
+ helper.click(helper.getElement(DAYS_VIEW).children[0]);
+ await ContentTask.spawn(helper.tab.linkedBrowser, {}, async function() {
+ let inputEl = content.document.querySelector("input");
+ await ContentTaskUtils.waitForEvent(inputEl, "input");
+ });
+
+ Assert.equal(content.document.querySelector("input").value, firstDayOnCalendar);
+
+ await helper.tearDown();
+});
+
+/**
+ * Make sure picker is in correct state when it is reopened.
+ */
+add_task(async function test_datepicker_reopen_state() {
+ const inputValue = "2016-12-15";
+ const nextMonth = "2017-01-01";
+
+ await helper.openPicker(`data:text/html, <input type="date" value="${inputValue}">`);
+ // Navigate to the next month but does not commit the change
+ Assert.equal(helper.getElement(MONTH_YEAR).textContent, DATE_FORMAT(new Date(inputValue)));
+ helper.click(helper.getElement(BTN_NEXT_MONTH));
+ Assert.equal(helper.getElement(MONTH_YEAR).textContent, DATE_FORMAT(new Date(nextMonth)));
+ EventUtils.synthesizeKey("VK_ESCAPE", {}, window);
+
+ // Ensures the picker opens to the month of the input value
+ await BrowserTestUtils.synthesizeMouseAtCenter("input", {}, gBrowser.selectedBrowser);
+ await helper.waitForPickerReady();
+ Assert.equal(helper.getElement(MONTH_YEAR).textContent, DATE_FORMAT(new Date(inputValue)));
+
+ await helper.tearDown();
+});
+
+/**
+ * When min and max attributes are set, calendar should show some dates as
+ * out-of-range.
+ */
+add_task(async function test_datepicker_min_max() {
+ const inputValue = "2016-12-15";
+ const inputMin = "2016-12-05";
+ const inputMax = "2016-12-25";
+
+ await helper.openPicker(`data:text/html, <input type="date" value="${inputValue}" min="${inputMin}" max="${inputMax}">`);
+
+ Assert.deepEqual(
+ getCalendarClassList(),
+ mergeArrays(calendarClasslist_201612, [
+ // R denotes out-of-range
+ [R], [R], [R], [R], [R], [R], [R],
+ [R], [], [], [], [], [], [],
+ [], [], [], [], [], [], [],
+ [], [], [], [], [], [], [],
+ [], [R], [R], [R], [R], [R], [R],
+ [R], [R], [R], [R], [R], [R], [R],
+ ]),
+ "2016-12 with min & max",
+ );
+
+ await helper.tearDown();
+});
+
+/**
+ * When step attribute is set, calendar should show some dates as off-step.
+ */
+add_task(async function test_datepicker_step() {
+ const inputValue = "2016-12-15";
+ const inputStep = "5";
+
+ await helper.openPicker(`data:text/html, <input type="date" value="${inputValue}" step="${inputStep}">`);
+
+ Assert.deepEqual(
+ getCalendarClassList(),
+ mergeArrays(calendarClasslist_201612, [
+ // P denotes off-step
+ [P], [P], [P], [], [P], [P], [P],
+ [P], [], [P], [P], [P], [P], [],
+ [P], [P], [P], [P], [], [P], [P],
+ [P], [P], [], [P], [P], [P], [P],
+ [], [P], [P], [P], [P], [], [P],
+ [P], [P], [P], [], [P], [P], [P],
+ ]),
+ "2016-12 with step",
+ );
+
+ await helper.tearDown();
+});
+
+add_task(async function test_datepicker_abs_min() {
+ const inputValue = "0001-01-01";
+ await helper.openPicker(`data:text/html, <input type="date" value="${inputValue}">`);
+
+ Assert.deepEqual(
+ getCalendarText(),
+ [
+ "", "1", "2", "3", "4", "5", "6",
+ "7", "8", "9", "10", "11", "12", "13",
+ "14", "15", "16", "17", "18", "19", "20",
+ "21", "22", "23", "24", "25", "26", "27",
+ "28", "29", "30", "31", "1", "2", "3",
+ "4", "5", "6", "7", "8", "9", "10",
+ ],
+ "0001-01",
+ );
+
+ await helper.tearDown();
+});
+
+add_task(async function test_datepicker_abs_max() {
+ const inputValue = "275760-09-13";
+ await helper.openPicker(`data:text/html, <input type="date" value="${inputValue}">`);
+
+ Assert.deepEqual(
+ getCalendarText(),
+ [
+ "31", "1", "2", "3", "4", "5", "6",
+ "7", "8", "9", "10", "11", "12", "13",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ "", "", "", "", "", "", "",
+ ],
+ "275760-09",
+ );
+
+ await helper.tearDown();
+});
diff --git a/toolkit/content/tests/browser/head.js b/toolkit/content/tests/browser/head.js
index 1c6c2b54f7..d7ed7a9ff3 100644
--- a/toolkit/content/tests/browser/head.js
+++ b/toolkit/content/tests/browser/head.js
@@ -31,3 +31,93 @@ function pushPrefs(...aPrefs) {
SpecialPowers.pushPrefEnv({"set": aPrefs}, deferred.resolve);
return deferred.promise;
}
+
+/**
+ * Helper class for testing datetime input picker widget
+ */
+class DateTimeTestHelper {
+ constructor() {
+ this.panel = document.getElementById("DateTimePickerPanel");
+ this.panel.setAttribute("animate", false);
+ this.tab = null;
+ this.frame = null;
+ }
+
+ /**
+ * Opens a new tab with the URL of the test page, and make sure the picker is
+ * ready for testing.
+ *
+ * @param {String} pageUrl
+ */
+ async openPicker(pageUrl) {
+ this.tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, pageUrl);
+ await BrowserTestUtils.synthesizeMouseAtCenter("input", {}, gBrowser.selectedBrowser);
+ // If dateTimePopupFrame doesn't exist yet, wait for the binding to be attached
+ if (!this.panel.dateTimePopupFrame) {
+ await BrowserTestUtils.waitForEvent(this.panel, "DateTimePickerBindingReady")
+ }
+ this.frame = this.panel.dateTimePopupFrame;
+ await this.waitForPickerReady();
+ }
+
+ async waitForPickerReady() {
+ await BrowserTestUtils.waitForEvent(this.frame, "load", true);
+ // Wait for picker elements to be ready
+ await BrowserTestUtils.waitForEvent(this.frame.contentDocument, "PickerReady");
+ }
+
+ /**
+ * Find an element on the picker.
+ *
+ * @param {String} selector
+ * @return {DOMElement}
+ */
+ getElement(selector) {
+ return this.frame.contentDocument.querySelector(selector);
+ }
+
+ /**
+ * Find the children of an element on the picker.
+ *
+ * @param {String} selector
+ * @return {Array<DOMElement>}
+ */
+ getChildren(selector) {
+ return Array.from(this.getElement(selector).children);
+ }
+
+ /**
+ * Click on an element
+ *
+ * @param {DOMElement} element
+ */
+ click(element) {
+ EventUtils.synthesizeMouseAtCenter(element, {}, this.frame.contentWindow);
+ }
+
+ /**
+ * Close the panel and the tab
+ */
+ async tearDown() {
+ if (!this.panel.hidden) {
+ let pickerClosePromise = new Promise(resolve => {
+ this.panel.addEventListener("popuphidden", resolve, {once: true});
+ });
+ this.panel.hidePopup();
+ this.panel.closePicker();
+ await pickerClosePromise;
+ }
+ await BrowserTestUtils.removeTab(this.tab);
+ this.tab = null;
+ }
+
+ /**
+ * Clean up after tests. Remove the frame to prevent leak.
+ */
+ cleanup() {
+ this.frame.remove();
+ this.frame = null;
+ this.panel.removeAttribute("animate");
+ this.panel = null;
+ }
+}
diff --git a/toolkit/content/tests/widgets/test_videocontrols.html b/toolkit/content/tests/widgets/test_videocontrols.html
index 191aaef580..146c63a72b 100644
--- a/toolkit/content/tests/widgets/test_videocontrols.html
+++ b/toolkit/content/tests/widgets/test_videocontrols.html
@@ -229,7 +229,7 @@ function runTest(event) {
is(event.type, "seeked", "checking event type");
ok(true, "video position is at " + video.currentTime);
var expectedTime = videoDuration / 2;
- ok(Math.abs(video.currentTime - expectedTime) < 0.1, "checking expected playback position");
+ ok(Math.abs(video.currentTime - expectedTime) < 0.1, "checking expected playback position Math.abs(" + video.currentTime + " - " + expectedTime + ") < .1");
SimpleTest.executeSoon(() => {
synthesizeMouse(video, scrubberOffsetX + (scrubberWidth / 4), scrubberCenterY, { });
diff --git a/toolkit/content/timepicker.xhtml b/toolkit/content/timepicker.xhtml
index 1396223f1b..77b9fba410 100644
--- a/toolkit/content/timepicker.xhtml
+++ b/toolkit/content/timepicker.xhtml
@@ -6,7 +6,7 @@
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<head>
<title>Time Picker</title>
- <link rel="stylesheet" href="chrome://global/skin/timepicker.css"/>
+ <link rel="stylesheet" href="chrome://global/skin/datetimeinputpickers.css"/>
<script type="application/javascript" src="chrome://global/content/bindings/timekeeper.js"></script>
<script type="application/javascript" src="chrome://global/content/bindings/spinner.js"></script>
<script type="application/javascript" src="chrome://global/content/bindings/timepicker.js"></script>
diff --git a/toolkit/content/widgets/calendar.js b/toolkit/content/widgets/calendar.js
new file mode 100644
index 0000000000..44ba675014
--- /dev/null
+++ b/toolkit/content/widgets/calendar.js
@@ -0,0 +1,171 @@
+/* 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";
+
+/**
+ * Initialize the Calendar and generate nodes for week headers and days, and
+ * attach event listeners.
+ *
+ * @param {Object} options
+ * {
+ * {Number} calViewSize: Number of days to appear on a calendar view
+ * {Function} getDayString: Transform day number to string
+ * {Function} getWeekHeaderString: Transform day of week number to string
+ * {Function} setSelection: Set selection for dateKeeper
+ * }
+ * @param {Object} context
+ * {
+ * {DOMElement} weekHeader
+ * {DOMElement} daysView
+ * }
+ */
+function Calendar(options, context) {
+ const DAYS_IN_A_WEEK = 7;
+
+ this.context = context;
+ this.state = {
+ days: [],
+ weekHeaders: [],
+ setSelection: options.setSelection,
+ getDayString: options.getDayString,
+ getWeekHeaderString: options.getWeekHeaderString
+ };
+ this.elements = {
+ weekHeaders: this._generateNodes(DAYS_IN_A_WEEK, context.weekHeader),
+ daysView: this._generateNodes(options.calViewSize, context.daysView)
+ };
+
+ this._attachEventListeners();
+}
+
+{
+ Calendar.prototype = {
+
+ /**
+ * Set new properties and render them.
+ *
+ * @param {Object} props
+ * {
+ * {Boolean} isVisible: Whether or not the calendar is in view
+ * {Array<Object>} days: Data for days
+ * {
+ * {Date} dateObj
+ * {Number} content
+ * {Array<String>} classNames
+ * {Boolean} enabled
+ * }
+ * {Array<Object>} weekHeaders: Data for weekHeaders
+ * {
+ * {Number} content
+ * {Array<String>} classNames
+ * }
+ * }
+ */
+ setProps(props) {
+ if (props.isVisible) {
+ // Transform the days and weekHeaders array for rendering
+ const days = props.days.map(({ dateObj, content, classNames, enabled }) => {
+ return {
+ dateObj,
+ textContent: this.state.getDayString(content),
+ className: classNames.join(" "),
+ enabled
+ };
+ });
+ const weekHeaders = props.weekHeaders.map(({ content, classNames }) => {
+ return {
+ textContent: this.state.getWeekHeaderString(content),
+ className: classNames.join(" ")
+ };
+ });
+ // Update the DOM nodes states
+ this._render({
+ elements: this.elements.daysView,
+ items: days,
+ prevState: this.state.days
+ });
+ this._render({
+ elements: this.elements.weekHeaders,
+ items: weekHeaders,
+ prevState: this.state.weekHeaders,
+ });
+ // Update the state to current
+ this.state.days = days;
+ this.state.weekHeaders = weekHeaders;
+ }
+ },
+
+ /**
+ * Render the items onto the DOM nodes
+ * @param {Object}
+ * {
+ * {Array<DOMElement>} elements
+ * {Array<Object>} items
+ * {Array<Object>} prevState: state of items from last render
+ * }
+ */
+ _render({ elements, items, prevState }) {
+ for (let i = 0, l = items.length; i < l; i++) {
+ let el = elements[i];
+
+ // Check if state from last render has changed, if so, update the elements
+ if (!prevState[i] || prevState[i].textContent != items[i].textContent) {
+ el.textContent = items[i].textContent;
+ }
+ if (!prevState[i] || prevState[i].className != items[i].className) {
+ el.className = items[i].className;
+ }
+ }
+ },
+
+ /**
+ * Generate DOM nodes
+ *
+ * @param {Number} size: Number of nodes to generate
+ * @param {DOMElement} context: Element to append the nodes to
+ * @return {Array<DOMElement>}
+ */
+ _generateNodes(size, context) {
+ let frag = document.createDocumentFragment();
+ let refs = [];
+
+ for (let i = 0; i < size; i++) {
+ let el = document.createElement("div");
+ el.dataset.id = i;
+ refs.push(el);
+ frag.appendChild(el);
+ }
+ context.appendChild(frag);
+
+ return refs;
+ },
+
+ /**
+ * Handle events
+ * @param {DOMEvent} event
+ */
+ handleEvent(event) {
+ switch (event.type) {
+ case "click": {
+ if (event.target.parentNode == this.context.daysView) {
+ let targetId = event.target.dataset.id;
+ let targetObj = this.state.days[targetId];
+ if (targetObj.enabled) {
+ this.state.setSelection(targetObj.dateObj);
+ }
+ }
+ break;
+ }
+ }
+ },
+
+ /**
+ * Attach event listener to daysView
+ */
+ _attachEventListeners() {
+ this.context.daysView.addEventListener("click", this);
+ }
+ };
+}
diff --git a/toolkit/content/widgets/datekeeper.js b/toolkit/content/widgets/datekeeper.js
new file mode 100644
index 0000000000..5d70416a93
--- /dev/null
+++ b/toolkit/content/widgets/datekeeper.js
@@ -0,0 +1,336 @@
+/* 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";
+
+/**
+ * DateKeeper keeps track of the date states.
+ */
+function DateKeeper(props) {
+ this.init(props);
+}
+
+{
+ const DAYS_IN_A_WEEK = 7,
+ MONTHS_IN_A_YEAR = 12,
+ YEAR_VIEW_SIZE = 200,
+ YEAR_BUFFER_SIZE = 10,
+ // The min value is 0001-01-01 based on HTML spec:
+ // https://html.spec.whatwg.org/#valid-date-string
+ MIN_DATE = -62135596800000,
+ // The max value is derived from the ECMAScript spec (275760-09-13):
+ // http://ecma-international.org/ecma-262/5.1/#sec-15.9.1.1
+ MAX_DATE = 8640000000000000,
+ MAX_YEAR = 275760,
+ MAX_MONTH = 9;
+
+ DateKeeper.prototype = {
+ get year() {
+ return this.state.dateObj.getUTCFullYear();
+ },
+
+ get month() {
+ return this.state.dateObj.getUTCMonth();
+ },
+
+ get selection() {
+ return this.state.selection;
+ },
+
+ /**
+ * Initialize DateKeeper
+ * @param {Number} year
+ * @param {Number} month
+ * @param {Number} day
+ * @param {Number} min
+ * @param {Number} max
+ * @param {Number} step
+ * @param {Number} stepBase
+ * @param {Number} firstDayOfWeek
+ * @param {Array<Number>} weekends
+ * @param {Number} calViewSize
+ */
+ init({ year, month, day, min, max, step, stepBase, firstDayOfWeek = 0, weekends = [0], calViewSize = 42 }) {
+ const today = new Date();
+
+ this.state = {
+ step, firstDayOfWeek, weekends, calViewSize,
+ // min & max are NaN if empty or invalid
+ min: new Date(Number.isNaN(min) ? MIN_DATE : min),
+ max: new Date(Number.isNaN(max) ? MAX_DATE : max),
+ stepBase: new Date(stepBase),
+ today: this._newUTCDate(today.getFullYear(), today.getMonth(), today.getDate()),
+ weekHeaders: this._getWeekHeaders(firstDayOfWeek, weekends),
+ years: [],
+ dateObj: new Date(0),
+ selection: { year, month, day },
+ };
+
+ this.setCalendarMonth({
+ year: year === undefined ? today.getFullYear() : year,
+ month: month === undefined ? today.getMonth() : month
+ });
+ },
+ /**
+ * Set new calendar month. The year is always treated as full year, so the
+ * short-form is not supported.
+ * @param {Object} date parts
+ * {
+ * {Number} year [optional]
+ * {Number} month [optional]
+ * }
+ */
+ setCalendarMonth({ year = this.year, month = this.month }) {
+ // Make sure the date is valid before setting.
+ // Use setUTCFullYear so that year 99 doesn't get parsed as 1999
+ if (year > MAX_YEAR || year === MAX_YEAR && month >= MAX_MONTH) {
+ this.state.dateObj.setUTCFullYear(MAX_YEAR, MAX_MONTH - 1, 1);
+ } else if (year < 1 || year === 1 && month < 0) {
+ this.state.dateObj.setUTCFullYear(1, 0, 1);
+ } else {
+ this.state.dateObj.setUTCFullYear(year, month, 1);
+ }
+ },
+
+ /**
+ * Set selection date
+ * @param {Number} year
+ * @param {Number} month
+ * @param {Number} day
+ */
+ setSelection({ year, month, day }) {
+ this.state.selection.year = year;
+ this.state.selection.month = month;
+ this.state.selection.day = day;
+ },
+
+ /**
+ * Set month. Makes sure the day is <= the last day of the month
+ * @param {Number} month
+ */
+ setMonth(month) {
+ this.setCalendarMonth({ year: this.year, month });
+ },
+
+ /**
+ * Set year. Makes sure the day is <= the last day of the month
+ * @param {Number} year
+ */
+ setYear(year) {
+ this.setCalendarMonth({ year, month: this.month });
+ },
+
+ /**
+ * Set month by offset. Makes sure the day is <= the last day of the month
+ * @param {Number} offset
+ */
+ setMonthByOffset(offset) {
+ this.setCalendarMonth({ year: this.year, month: this.month + offset });
+ },
+
+ /**
+ * Generate the array of months
+ * @return {Array<Object>}
+ * {
+ * {Number} value: Month in int
+ * {Boolean} enabled
+ * }
+ */
+ getMonths() {
+ let months = [];
+
+ for (let i = 0; i < MONTHS_IN_A_YEAR; i++) {
+ months.push({
+ value: i,
+ enabled: true
+ });
+ }
+
+ return months;
+ },
+
+ /**
+ * Generate the array of years
+ * @return {Array<Object>}
+ * {
+ * {Number} value: Year in int
+ * {Boolean} enabled
+ * }
+ */
+ getYears() {
+ let years = [];
+
+ const firstItem = this.state.years[0];
+ const lastItem = this.state.years[this.state.years.length - 1];
+ const currentYear = this.year;
+
+ // Generate new years array when the year is outside of the first &
+ // last item range. If not, return the cached result.
+ if (!firstItem || !lastItem ||
+ currentYear <= firstItem.value + YEAR_BUFFER_SIZE ||
+ currentYear >= lastItem.value - YEAR_BUFFER_SIZE) {
+ // The year is set in the middle with items on both directions
+ for (let i = -(YEAR_VIEW_SIZE / 2); i < YEAR_VIEW_SIZE / 2; i++) {
+ const year = currentYear + i;
+ if (year >= 1 && year <= MAX_YEAR) {
+ years.push({
+ value: year,
+ enabled: true
+ });
+ }
+ }
+ this.state.years = years;
+ }
+ return this.state.years;
+ },
+
+ /**
+ * Get days for calendar
+ * @return {Array<Object>}
+ * {
+ * {Date} dateObj
+ * {Number} content
+ * {Array<String>} classNames
+ * {Boolean} enabled
+ * }
+ */
+ getDays() {
+ const firstDayOfMonth = this._getFirstCalendarDate(this.state.dateObj, this.state.firstDayOfWeek);
+ const month = this.month;
+ let days = [];
+
+ for (let i = 0; i < this.state.calViewSize; i++) {
+ const dateObj = this._newUTCDate(firstDayOfMonth.getUTCFullYear(),
+ firstDayOfMonth.getUTCMonth(),
+ firstDayOfMonth.getUTCDate() + i);
+
+ let classNames = [];
+ let enabled = true;
+
+ const isValid = dateObj.getTime() >= MIN_DATE && dateObj.getTime() <= MAX_DATE;
+ if (!isValid) {
+ classNames.push("out-of-range");
+ enabled = false;
+
+ days.push({
+ classNames,
+ enabled,
+ });
+ continue;
+ }
+
+ const isWeekend = this.state.weekends.includes(dateObj.getUTCDay());
+ const isCurrentMonth = month == dateObj.getUTCMonth();
+ const isSelection = this.state.selection.year == dateObj.getUTCFullYear() &&
+ this.state.selection.month == dateObj.getUTCMonth() &&
+ this.state.selection.day == dateObj.getUTCDate();
+ const isOutOfRange = dateObj.getTime() < this.state.min.getTime() ||
+ dateObj.getTime() > this.state.max.getTime();
+ const isToday = this.state.today.getTime() == dateObj.getTime();
+ const isOffStep = this._checkIsOffStep(dateObj,
+ this._newUTCDate(dateObj.getUTCFullYear(),
+ dateObj.getUTCMonth(),
+ dateObj.getUTCDate() + 1));
+
+ if (isWeekend) {
+ classNames.push("weekend");
+ }
+ if (!isCurrentMonth) {
+ classNames.push("outside");
+ }
+ if (isSelection && !isOutOfRange && !isOffStep) {
+ classNames.push("selection");
+ }
+ if (isOutOfRange) {
+ classNames.push("out-of-range");
+ enabled = false;
+ }
+ if (isToday) {
+ classNames.push("today");
+ }
+ if (isOffStep) {
+ classNames.push("off-step");
+ enabled = false;
+ }
+ days.push({
+ dateObj,
+ content: dateObj.getUTCDate(),
+ classNames,
+ enabled,
+ });
+ }
+ return days;
+ },
+
+ /**
+ * Check if a date is off step given a starting point and the next increment
+ * @param {Date} start
+ * @param {Date} next
+ * @return {Boolean}
+ */
+ _checkIsOffStep(start, next) {
+ // If the increment is larger or equal to the step, it must not be off-step.
+ if (next - start >= this.state.step) {
+ return false;
+ }
+ // Calculate the last valid date
+ const lastValidStep = Math.floor((next - 1 - this.state.stepBase) / this.state.step);
+ const lastValidTimeInMs = lastValidStep * this.state.step + this.state.stepBase.getTime();
+ // The date is off-step if the last valid date is smaller than the start date
+ return lastValidTimeInMs < start.getTime();
+ },
+
+ /**
+ * Get week headers for calendar
+ * @param {Number} firstDayOfWeek
+ * @param {Array<Number>} weekends
+ * @return {Array<Object>}
+ * {
+ * {Number} content
+ * {Array<String>} classNames
+ * }
+ */
+ _getWeekHeaders(firstDayOfWeek, weekends) {
+ let headers = [];
+ let dayOfWeek = firstDayOfWeek;
+
+ for (let i = 0; i < DAYS_IN_A_WEEK; i++) {
+ headers.push({
+ content: dayOfWeek % DAYS_IN_A_WEEK,
+ classNames: weekends.includes(dayOfWeek % DAYS_IN_A_WEEK) ? ["weekend"] : []
+ });
+ dayOfWeek++;
+ }
+ return headers;
+ },
+
+ /**
+ * Get the first day on a calendar month
+ * @param {Date} dateObj
+ * @param {Number} firstDayOfWeek
+ * @return {Date}
+ */
+ _getFirstCalendarDate(dateObj, firstDayOfWeek) {
+ const daysOffset = 1 - DAYS_IN_A_WEEK;
+ let firstDayOfMonth = this._newUTCDate(dateObj.getUTCFullYear(), dateObj.getUTCMonth());
+ let dayOfWeek = firstDayOfMonth.getUTCDay();
+
+ return this._newUTCDate(
+ firstDayOfMonth.getUTCFullYear(),
+ firstDayOfMonth.getUTCMonth(),
+ // When first calendar date is the same as first day of the week, add
+ // another row on top of it.
+ firstDayOfWeek == dayOfWeek ? daysOffset : (firstDayOfWeek - dayOfWeek + daysOffset) % DAYS_IN_A_WEEK);
+ },
+
+ /**
+ * Helper function for creating UTC dates
+ * @param {...[Number]} parts
+ * @return {Date}
+ */
+ _newUTCDate(...parts) {
+ return new Date(new Date(0).setUTCFullYear(...parts));
+ },
+ };
+}
diff --git a/toolkit/content/widgets/datepicker.js b/toolkit/content/widgets/datepicker.js
new file mode 100644
index 0000000000..0e9c9a6e62
--- /dev/null
+++ b/toolkit/content/widgets/datepicker.js
@@ -0,0 +1,376 @@
+/* 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";
+
+function DatePicker(context) {
+ this.context = context;
+ this._attachEventListeners();
+}
+
+{
+ const CAL_VIEW_SIZE = 42;
+
+ DatePicker.prototype = {
+ /**
+ * Initializes the date picker. Set the default states and properties.
+ * @param {Object} props
+ * {
+ * {Number} year [optional]
+ * {Number} month [optional]
+ * {Number} date [optional]
+ * {Number} min
+ * {Number} max
+ * {Number} step
+ * {Number} stepBase
+ * {Number} firstDayOfWeek
+ * {Array<Number>} weekends
+ * {Array<String>} monthStrings
+ * {Array<String>} weekdayStrings
+ * {String} locale [optional]: User preferred locale
+ * }
+ */
+ init(props = {}) {
+ this.props = props;
+ this._setDefaultState();
+ this._createComponents();
+ this._update();
+ document.dispatchEvent(new CustomEvent("PickerReady"));
+ },
+
+ /*
+ * Set initial date picker states.
+ */
+ _setDefaultState() {
+ const { year, month, day, min, max, step, stepBase, firstDayOfWeek, weekends,
+ monthStrings, weekdayStrings, locale } = this.props;
+ const dateKeeper = new DateKeeper({
+ year, month, day, min, max, step, stepBase, firstDayOfWeek, weekends,
+ calViewSize: CAL_VIEW_SIZE
+ });
+
+ this.state = {
+ dateKeeper,
+ locale,
+ isMonthPickerVisible: false,
+ getDayString: day => day ? new Intl.NumberFormat(locale).format(day) : "",
+ getWeekHeaderString: weekday => weekdayStrings[weekday],
+ getMonthString: month => monthStrings[month],
+ setSelection: date => {
+ dateKeeper.setSelection({
+ year: date.getUTCFullYear(),
+ month: date.getUTCMonth(),
+ day: date.getUTCDate(),
+ });
+ this._update();
+ this._dispatchState();
+ this._closePopup();
+ },
+ setYear: year => {
+ dateKeeper.setYear(year);
+ dateKeeper.setSelection({
+ year,
+ month: dateKeeper.selection.month,
+ day: dateKeeper.selection.day,
+ });
+ this._update();
+ this._dispatchState();
+ },
+ setMonth: month => {
+ dateKeeper.setMonth(month);
+ dateKeeper.setSelection({
+ year: dateKeeper.selection.year,
+ month,
+ day: dateKeeper.selection.day,
+ });
+ this._update();
+ this._dispatchState();
+ },
+ toggleMonthPicker: () => {
+ this.state.isMonthPickerVisible = !this.state.isMonthPickerVisible;
+ this._update();
+ }
+ };
+ },
+
+ /**
+ * Initalize the date picker components.
+ */
+ _createComponents() {
+ this.components = {
+ calendar: new Calendar({
+ calViewSize: CAL_VIEW_SIZE,
+ locale: this.state.locale,
+ setSelection: this.state.setSelection,
+ getDayString: this.state.getDayString,
+ getWeekHeaderString: this.state.getWeekHeaderString
+ }, {
+ weekHeader: this.context.weekHeader,
+ daysView: this.context.daysView
+ }),
+ monthYear: new MonthYear({
+ setYear: this.state.setYear,
+ setMonth: this.state.setMonth,
+ getMonthString: this.state.getMonthString,
+ locale: this.state.locale
+ }, {
+ monthYear: this.context.monthYear,
+ monthYearView: this.context.monthYearView
+ })
+ };
+ },
+
+ /**
+ * Update date picker and its components.
+ */
+ _update(options = {}) {
+ const { dateKeeper, isMonthPickerVisible } = this.state;
+
+ if (isMonthPickerVisible) {
+ this.state.months = dateKeeper.getMonths();
+ this.state.years = dateKeeper.getYears();
+ } else {
+ this.state.days = dateKeeper.getDays();
+ }
+
+ this.components.monthYear.setProps({
+ isVisible: isMonthPickerVisible,
+ dateObj: dateKeeper.state.dateObj,
+ months: this.state.months,
+ years: this.state.years,
+ toggleMonthPicker: this.state.toggleMonthPicker,
+ noSmoothScroll: options.noSmoothScroll
+ });
+ this.components.calendar.setProps({
+ isVisible: !isMonthPickerVisible,
+ days: this.state.days,
+ weekHeaders: dateKeeper.state.weekHeaders
+ });
+
+ isMonthPickerVisible ?
+ this.context.monthYearView.classList.remove("hidden") :
+ this.context.monthYearView.classList.add("hidden");
+ },
+
+ /**
+ * Use postMessage to close the picker.
+ */
+ _closePopup() {
+ window.postMessage({
+ name: "ClosePopup"
+ }, "*");
+ },
+
+ /**
+ * Use postMessage to pass the state of picker to the panel.
+ */
+ _dispatchState() {
+ const { year, month, day } = this.state.dateKeeper.selection;
+ // The panel is listening to window for postMessage event, so we
+ // do postMessage to itself to send data to input boxes.
+ window.postMessage({
+ name: "PickerPopupChanged",
+ detail: {
+ year,
+ month,
+ day,
+ }
+ }, "*");
+ },
+
+ /**
+ * Attach event listeners
+ */
+ _attachEventListeners() {
+ window.addEventListener("message", this);
+ document.addEventListener("mouseup", this, { passive: true });
+ document.addEventListener("mousedown", this);
+ },
+
+ /**
+ * Handle events.
+ *
+ * @param {Event} event
+ */
+ handleEvent(event) {
+ switch (event.type) {
+ case "message": {
+ this.handleMessage(event);
+ break;
+ }
+ case "mousedown": {
+ // Use preventDefault to keep focus on input boxes
+ event.preventDefault();
+ event.target.setCapture();
+
+ if (event.target == this.context.buttonLeft) {
+ event.target.classList.add("active");
+ this.state.dateKeeper.setMonthByOffset(-1);
+ this._update();
+ } else if (event.target == this.context.buttonRight) {
+ event.target.classList.add("active");
+ this.state.dateKeeper.setMonthByOffset(1);
+ this._update();
+ }
+ break;
+ }
+ case "mouseup": {
+ if (event.target == this.context.buttonLeft || event.target == this.context.buttonRight) {
+ event.target.classList.remove("active");
+ }
+
+ }
+ }
+ },
+
+ /**
+ * Handle postMessage events.
+ *
+ * @param {Event} event
+ */
+ handleMessage(event) {
+ switch (event.data.name) {
+ case "PickerSetValue": {
+ this.set(event.data.detail);
+ break;
+ }
+ case "PickerInit": {
+ this.init(event.data.detail);
+ break;
+ }
+ }
+ },
+
+ /**
+ * Set the date state and update the components with the new state.
+ *
+ * @param {Object} dateState
+ * {
+ * {Number} year [optional]
+ * {Number} month [optional]
+ * {Number} date [optional]
+ * }
+ */
+ set({ year, month, day }) {
+ const { dateKeeper } = this.state;
+
+ dateKeeper.setCalendarMonth({
+ year, month
+ });
+ dateKeeper.setSelection({
+ year, month, day
+ });
+ this._update({ noSmoothScroll: true });
+ }
+ };
+
+ /**
+ * MonthYear is a component that handles the month & year spinners
+ *
+ * @param {Object} options
+ * {
+ * {String} locale
+ * {Function} setYear
+ * {Function} setMonth
+ * {Function} getMonthString
+ * }
+ * @param {DOMElement} context
+ */
+ function MonthYear(options, context) {
+ const spinnerSize = 5;
+ const yearFormat = new Intl.DateTimeFormat(options.locale, { year: "numeric",
+ timeZone: "UTC" }).format;
+ const dateFormat = new Intl.DateTimeFormat(options.locale, { year: "numeric",
+ month: "long",
+ timeZone: "UTC" }).format;
+ this.context = context;
+ this.state = { dateFormat };
+ this.props = {};
+ this.components = {
+ month: new Spinner({
+ setValue: month => {
+ this.state.isMonthSet = true;
+ options.setMonth(month);
+ },
+ getDisplayString: options.getMonthString,
+ viewportSize: spinnerSize
+ }, context.monthYearView),
+ year: new Spinner({
+ setValue: year => {
+ this.state.isYearSet = true;
+ options.setYear(year);
+ },
+ getDisplayString: year => yearFormat(new Date(new Date(0).setUTCFullYear(year))),
+ viewportSize: spinnerSize
+ }, context.monthYearView)
+ };
+
+ this._attachEventListeners();
+ }
+
+ MonthYear.prototype = {
+
+ /**
+ * Set new properties and pass them to components
+ *
+ * @param {Object} props
+ * {
+ * {Boolean} isVisible
+ * {Date} dateObj
+ * {Array<Object>} months
+ * {Array<Object>} years
+ * {Function} toggleMonthPicker
+ * }
+ */
+ setProps(props) {
+ this.context.monthYear.textContent = this.state.dateFormat(props.dateObj);
+
+ if (props.isVisible) {
+ this.context.monthYear.classList.add("active");
+ this.components.month.setState({
+ value: props.dateObj.getUTCMonth(),
+ items: props.months,
+ isInfiniteScroll: true,
+ isValueSet: this.state.isMonthSet,
+ smoothScroll: !(this.state.firstOpened || props.noSmoothScroll)
+ });
+ this.components.year.setState({
+ value: props.dateObj.getUTCFullYear(),
+ items: props.years,
+ isInfiniteScroll: false,
+ isValueSet: this.state.isYearSet,
+ smoothScroll: !(this.state.firstOpened || props.noSmoothScroll)
+ });
+ this.state.firstOpened = false;
+ } else {
+ this.context.monthYear.classList.remove("active");
+ this.state.isMonthSet = false;
+ this.state.isYearSet = false;
+ this.state.firstOpened = true;
+ }
+
+ this.props = Object.assign(this.props, props);
+ },
+
+ /**
+ * Handle events
+ * @param {DOMEvent} event
+ */
+ handleEvent(event) {
+ switch (event.type) {
+ case "click": {
+ this.props.toggleMonthPicker();
+ break;
+ }
+ }
+ },
+
+ /**
+ * Attach event listener to monthYear button
+ */
+ _attachEventListeners() {
+ this.context.monthYear.addEventListener("click", this);
+ }
+ };
+}
diff --git a/toolkit/content/widgets/datetimebox.css b/toolkit/content/widgets/datetimebox.css
index 4a9593a697..ce638078fa 100644
--- a/toolkit/content/widgets/datetimebox.css
+++ b/toolkit/content/widgets/datetimebox.css
@@ -8,9 +8,17 @@
.datetime-input-box-wrapper {
-moz-appearance: none;
display: inline-flex;
+ flex: 1;
cursor: default;
background-color: inherit;
color: inherit;
+ min-width: 0;
+ justify-content: space-between;
+}
+
+.datetime-input-edit-wrapper {
+ overflow: hidden;
+ white-space: nowrap;
}
.datetime-input {
@@ -20,6 +28,8 @@
border: 0;
margin: 0;
ime-mode: disabled;
+ cursor: default;
+ -moz-user-select: none;
}
.datetime-separator {
@@ -41,5 +51,5 @@
height: 12px;
width: 12px;
align-self: center;
- justify-content: flex-end;
+ flex: none;
}
diff --git a/toolkit/content/widgets/datetimebox.xml b/toolkit/content/widgets/datetimebox.xml
index 05591e65ad..94574038a5 100644
--- a/toolkit/content/widgets/datetimebox.xml
+++ b/toolkit/content/widgets/datetimebox.xml
@@ -4,12 +4,466 @@
- 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/. -->
+<!DOCTYPE bindings [
+<!ENTITY % datetimeboxDTD SYSTEM "chrome://global/locale/datetimebox.dtd">
+%datetimeboxDTD;
+]>
+
+<!--
+TODO
+Bug 1446342:
+Input type="date" not working if the other form elements has name="document"
+
+Any alternative solution:
+document === window.document
+document === this.ownerDocument
+-->
+
<bindings id="datetimeboxBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl">
+ <binding id="date-input"
+ extends="chrome://global/content/bindings/datetimebox.xml#datetime-input-base">
+ <resources>
+ <stylesheet src="chrome://global/content/textbox.css"/>
+ <stylesheet src="chrome://global/skin/textbox.css"/>
+ <stylesheet src="chrome://global/content/bindings/datetimebox.css"/>
+ </resources>
+
+ <implementation>
+ <constructor>
+ <![CDATA[
+ /* eslint-disable no-multi-spaces */
+ this.mYearPlaceHolder = ]]>"&date.year.placeholder;"<![CDATA[;
+ this.mMonthPlaceHolder = ]]>"&date.month.placeholder;"<![CDATA[;
+ this.mDayPlaceHolder = ]]>"&date.day.placeholder;"<![CDATA[;
+ this.mSeparatorText = "/";
+ /* eslint-enable no-multi-spaces */
+
+ this.mMinMonth = 1;
+ this.mMaxMonth = 12;
+ this.mMinDay = 1;
+ this.mMaxDay = 31;
+ this.mMinYear = 1;
+ // Maximum year limited by ECMAScript date object range, year <= 275760.
+ this.mMaxYear = 275760;
+ this.mMonthDayLength = 2;
+ this.mYearLength = 4;
+ this.mMonthPageUpDownInterval = 3;
+ this.mDayPageUpDownInterval = 7;
+ this.mYearPageUpDownInterval = 10;
+
+ // Default to en-US, month-day-year order.
+ this.mMonthField =
+ window.document.getAnonymousElementByAttribute(this, "anonid", "input-one");
+ this.mDayField =
+ window.document.getAnonymousElementByAttribute(this, "anonid", "input-two");
+ this.mYearField =
+ window.document.getAnonymousElementByAttribute(this, "anonid", "input-three");
+ this.mYearField.size = this.mYearLength;
+ this.mYearField.maxLength = this.mMaxYear.toString().length;
+
+ this.mMonthField.placeholder = this.mMonthPlaceHolder;
+ this.mDayField.placeholder = this.mDayPlaceHolder;
+ this.mYearField.placeholder = this.mYearPlaceHolder;
+
+ this.mMonthField.setAttribute("min", this.mMinMonth);
+ this.mMonthField.setAttribute("max", this.mMaxMonth);
+ this.mMonthField.setAttribute("pginterval",
+ this.mMonthPageUpDownInterval);
+ this.mDayField.setAttribute("min", this.mMinDay);
+ this.mDayField.setAttribute("max", this.mMaxDay);
+ this.mDayField.setAttribute("pginterval", this.mDayPageUpDownInterval);
+ this.mYearField.setAttribute("min", this.mMinYear);
+ this.mYearField.setAttribute("max", this.mMaxYear);
+ this.mYearField.setAttribute("pginterval",
+ this.mYearPageUpDownInterval);
+
+ this.mDaySeparator =
+ window.document.getAnonymousElementByAttribute(this, "anonid", "sep-first");
+ this.mDaySeparator.textContent = this.mSeparatorText;
+ this.mYearSeparator =
+ window.document.getAnonymousElementByAttribute(this, "anonid", "sep-second");
+ this.mYearSeparator.textContent = this.mSeparatorText;
+
+ if (this.mInputElement.value) {
+ this.setFieldsFromInputValue();
+ }
+ this.updateResetButtonVisibility();
+ ]]>
+ </constructor>
+
+ <method name="clearInputFields">
+ <parameter name="aFromInputElement"/>
+ <body>
+ <![CDATA[
+ this.log("clearInputFields");
+
+ if (this.isDisabled() || this.isReadonly()) {
+ return;
+ }
+
+ if (this.mMonthField && !this.mMonthField.disabled &&
+ !this.mMonthField.readOnly) {
+ this.mMonthField.value = "";
+ this.mMonthField.setAttribute("typeBuffer", "");
+ }
+
+ if (this.mDayField && !this.mDayField.disabled &&
+ !this.mDayField.readOnly) {
+ this.mDayField.value = "";
+ this.mDayField.setAttribute("typeBuffer", "");
+ }
+
+ if (this.mYearField && !this.mYearField.disabled &&
+ !this.mYearField.readOnly) {
+ this.mYearField.value = "";
+ this.mYearField.setAttribute("typeBuffer", "");
+ }
+
+ if (!aFromInputElement && this.mInputElement.value) {
+ this.mInputElement.setUserInput("");
+ }
+
+ this.updateResetButtonVisibility();
+ ]]>
+ </body>
+ </method>
+
+ <method name="setFieldsFromInputValue">
+ <body>
+ <![CDATA[
+ let value = this.mInputElement.value;
+ if (!value) {
+ this.clearInputFields(true);
+ return;
+ }
+
+ this.log("setFieldsFromInputValue: " + value);
+ let [year, month, day] = value.split("-");
+
+ this.setFieldValue(this.mYearField, year);
+ this.setFieldValue(this.mMonthField, month);
+ this.setFieldValue(this.mDayField, day);
+
+ this.notifyPicker();
+ ]]>
+ </body>
+ </method>
+
+ <method name="getDaysInMonth">
+ <parameter name="aMonth"/>
+ <parameter name="aYear"/>
+ <body>
+ <![CDATA[
+ // Javascript's month is 0-based, so this means last day of the
+ // previous month.
+ return new Date(aYear, aMonth, 0).getDate();
+ ]]>
+ </body>
+ </method>
+
+ <method name="isFieldInvalid">
+ <parameter name="aField"/>
+ <body>
+ <![CDATA[
+ if (this.isEmpty(aField.value)) {
+ return true;
+ }
+
+ let min = Number(aField.getAttribute("min"));
+ let max = Number(aField.getAttribute("max"));
+
+ if (Number(aField.value) < min || Number(aField.value) > max) {
+ return true;
+ }
+
+ return false;
+ ]]>
+ </body>
+ </method>
+
+ <method name="setInputValueFromFields">
+ <body>
+ <![CDATA[
+ if (!this.isAnyValueAvailable(false) && this.mInputElement.value) {
+ // Values in the input box was cleared, clear the input element's
+ // value if not empty.
+ this.mInputElement.setUserInput("");
+ return;
+ }
+
+ if (this.isFieldInvalid(this.mYearField) ||
+ this.isFieldInvalid(this.mMonthField) ||
+ this.isFieldInvalid(this.mDayField)) {
+ // We still need to notify picker in case any of the field has
+ // changed. If we can set input element value, then notifyPicker
+ // will be called in setFieldsFromInputValue().
+ this.notifyPicker();
+ return;
+ }
+
+ let year = this.mYearField.value;
+ let month = this.mMonthField.value;
+ let day = this.mDayField.value;
+
+ if (day > this.getDaysInMonth(month, year)) {
+ // Don't set invalid date, otherwise input element's value will be
+ // set to empty.
+ return;
+ }
+
+ let date = [year, month, day].join("-");
+
+ if (date == this.mInputElement.value) {
+ return;
+ }
+
+ this.log("setInputValueFromFields: " + date);
+ this.mInputElement.setUserInput(date);
+ ]]>
+ </body>
+ </method>
+
+ <method name="setFieldsFromPicker">
+ <parameter name="aValue"/>
+ <body>
+ <![CDATA[
+ let year = aValue.year;
+ let month = aValue.month;
+ let day = aValue.day;
+
+ if (!this.isEmpty(year)) {
+ this.setFieldValue(this.mYearField, year);
+ }
+
+ if (!this.isEmpty(month)) {
+ this.setFieldValue(this.mMonthField, month);
+ }
+
+ if (!this.isEmpty(day)) {
+ this.setFieldValue(this.mDayField, day);
+ }
+
+ // Update input element's .value if needed.
+ this.setInputValueFromFields();
+ ]]>
+ </body>
+ </method>
+
+ <method name="handleKeypress">
+ <parameter name="aEvent"/>
+ <body>
+ <![CDATA[
+ if (this.isDisabled() || this.isReadonly()) {
+ return;
+ }
+
+ let targetField = aEvent.originalTarget;
+ let key = aEvent.key;
+
+ if (targetField.classList.contains("numeric") && key.match(/[0-9]/)) {
+ let buffer = targetField.getAttribute("typeBuffer") || "";
+
+ buffer = buffer.concat(key);
+ this.setFieldValue(targetField, buffer);
+ targetField.select();
+
+ let n = Number(buffer);
+ let max = targetField.getAttribute("max");
+ if (buffer.length >= targetField.maxLength || n * 10 > max) {
+ buffer = "";
+ this.advanceToNextField();
+ }
+ targetField.setAttribute("typeBuffer", buffer);
+ }
+ ]]>
+ </body>
+ </method>
+
+ <method name="incrementFieldValue">
+ <parameter name="aTargetField"/>
+ <parameter name="aTimes"/>
+ <body>
+ <![CDATA[
+ let value;
+
+ // Use current date if field is empty.
+ if (this.isEmpty(aTargetField.value)) {
+ let now = new Date();
+
+ if (aTargetField == this.mYearField) {
+ value = now.getFullYear();
+ } else if (aTargetField == this.mMonthField) {
+ value = now.getMonth() + 1;
+ } else if (aTargetField == this.mDayField) {
+ value = now.getDate();
+ } else {
+ this.log("Field not supported in incrementFieldValue.");
+ return;
+ }
+ } else {
+ value = Number(aTargetField.value);
+ }
+
+ let min = Number(aTargetField.getAttribute("min"));
+ let max = Number(aTargetField.getAttribute("max"));
+
+ value += Number(aTimes);
+ if (value > max) {
+ value -= (max - min + 1);
+ } else if (value < min) {
+ value += (max - min + 1);
+ }
+ this.setFieldValue(aTargetField, value);
+ aTargetField.select();
+ ]]>
+ </body>
+ </method>
+
+ <method name="handleKeyboardNav">
+ <parameter name="aEvent"/>
+ <body>
+ <![CDATA[
+ if (this.isDisabled() || this.isReadonly()) {
+ return;
+ }
+
+ let targetField = aEvent.originalTarget;
+ let key = aEvent.key;
+
+ // Home/End key does nothing on year field.
+ if (targetField == this.mYearField && (key == "Home" ||
+ key == "End")) {
+ return;
+ }
+
+ switch (key) {
+ case "ArrowUp":
+ this.incrementFieldValue(targetField, 1);
+ break;
+ case "ArrowDown":
+ this.incrementFieldValue(targetField, -1);
+ break;
+ case "PageUp": {
+ let interval = targetField.getAttribute("pginterval");
+ this.incrementFieldValue(targetField, interval);
+ break;
+ }
+ case "PageDown": {
+ let interval = targetField.getAttribute("pginterval");
+ this.incrementFieldValue(targetField, 0 - interval);
+ break;
+ }
+ case "Home":
+ let min = targetField.getAttribute("min");
+ this.setFieldValue(targetField, min);
+ targetField.select();
+ break;
+ case "End":
+ let max = targetField.getAttribute("max");
+ this.setFieldValue(targetField, max);
+ targetField.select();
+ break;
+ }
+ this.setInputValueFromFields();
+ ]]>
+ </body>
+ </method>
+
+ <method name="getCurrentValue">
+ <body>
+ <![CDATA[
+ let year;
+ if (!this.isEmpty(this.mYearField.value)) {
+ year = Number(this.mYearField.value);
+ }
+
+ let month;
+ if (!this.isEmpty(this.mMonthField.value)) {
+ month = Number(this.mMonthField.value);
+ }
+
+ let day;
+ if (!this.isEmpty(this.mDayField.value)) {
+ day = Number(this.mDayField.value);
+ }
+
+ let date = { year, month, day };
+
+ this.log("getCurrentValue: " + JSON.stringify(date));
+ return date;
+ ]]>
+ </body>
+ </method>
+
+ <method name="setFieldValue">
+ <parameter name="aField"/>
+ <parameter name="aValue"/>
+ <body>
+ <![CDATA[
+ let value = Number(aValue);
+ if (isNaN(value)) {
+ this.log("NaN on setFieldValue!");
+ return;
+ }
+
+ if (aValue.length == aField.maxLength) {
+ let min = Number(aField.getAttribute("min"));
+ let max = Number(aField.getAttribute("max"));
+
+ if (aValue < min) {
+ value = min;
+ } else if (aValue > max) {
+ value = max;
+ }
+ }
+
+ if (aField == this.mMonthField ||
+ aField == this.mDayField) {
+ // prepend zero
+ if (value < 10) {
+ value = "0" + value;
+ }
+ } else {
+ // prepend zeroes
+ if (value < 10) {
+ value = "000" + value;
+ } else if (value < 100) {
+ value = "00" + value;
+ } else if (value < 1000) {
+ value = "0" + value;
+ }
+
+ if (value.toString().length > this.mYearLength &&
+ value.toString().length <= this.mMaxYear.toString().length) {
+ this.mYearField.size = value.toString().length;
+ }
+ }
+
+ aField.value = value;
+ this.updateResetButtonVisibility();
+ ]]>
+ </body>
+ </method>
+
+ <method name="isAnyValueAvailable">
+ <parameter name="aForPicker"/>
+ <body>
+ <![CDATA[
+ return !this.isEmpty(this.mMonthField.value) ||
+ !this.isEmpty(this.mDayField.value) ||
+ !this.isEmpty(this.mYearField.value);
+ ]]>
+ </body>
+ </method>
+
+ </implementation>
+ </binding>
+
<binding id="time-input"
extends="chrome://global/content/bindings/datetimebox.xml#datetime-input-base">
<resources>
@@ -45,13 +499,13 @@
this.mMinSecPageUpDownInterval = 10;
this.mHourField =
- document.getAnonymousElementByAttribute(this, "anonid", "input-one");
+ window.document.getAnonymousElementByAttribute(this, "anonid", "input-one");
this.mHourField.setAttribute("typeBuffer", "");
this.mMinuteField =
- document.getAnonymousElementByAttribute(this, "anonid", "input-two");
+ window.document.getAnonymousElementByAttribute(this, "anonid", "input-two");
this.mMinuteField.setAttribute("typeBuffer", "");
this.mDayPeriodField =
- document.getAnonymousElementByAttribute(this, "anonid", "input-three");
+ window.document.getAnonymousElementByAttribute(this, "anonid", "input-three");
this.mDayPeriodField.classList.remove("numeric");
this.mHourField.placeholder = this.mPlaceHolder;
@@ -64,10 +518,10 @@
this.mMinuteField.setAttribute("max", this.mMaxMinute);
this.mMinuteSeparator =
- document.getAnonymousElementByAttribute(this, "anonid", "sep-first");
+ window.document.getAnonymousElementByAttribute(this, "anonid", "sep-first");
this.mMinuteSeparator.textContent = this.mSeparatorText;
this.mSpaceSeparator =
- document.getAnonymousElementByAttribute(this, "anonid", "sep-second");
+ window.document.getAnonymousElementByAttribute(this, "anonid", "sep-second");
// space between time and am/pm field
this.mSpaceSeparator.textContent = " ";
@@ -79,6 +533,7 @@
if (this.mInputElement.value) {
this.setFieldsFromInputValue();
}
+ this.updateResetButtonVisibility();
]]>
</constructor>
@@ -138,7 +593,7 @@
}
this.log("setFieldsFromInputValue: " + value);
- let [hour, minute, second] = value.split(':');
+ let [hour, minute, second] = value.split(":");
this.setFieldValue(this.mHourField, hour);
this.setFieldValue(this.mMinuteField, minute);
@@ -204,6 +659,13 @@
<method name="setInputValueFromFields">
<body>
<![CDATA[
+ if (!this.isAnyValueAvailable(false) && this.mInputElement.value) {
+ // Values in the input box was cleared, clear the input element's
+ // value if not empty.
+ this.mInputElement.setUserInput("");
+ return;
+ }
+
if (this.isEmpty(this.mHourField.value) ||
this.isEmpty(this.mMinuteField.value) ||
(this.mDayPeriodField && this.isEmpty(this.mDayPeriodField.value)) ||
@@ -239,6 +701,10 @@
time += "." + this.mMillisecField.value;
}
+ if (time == this.mInputElement.value) {
+ return;
+ }
+
this.log("setInputValueFromFields: " + time);
this.mInputElement.setUserInput(time);
]]>
@@ -265,6 +731,9 @@
if (!this.isEmpty(minute)) {
this.setFieldValue(this.mMinuteField, minute);
}
+
+ // Update input element's .value if needed.
+ this.setInputValueFromFields();
]]>
</body>
</method>
@@ -282,21 +751,25 @@
if (this.mHourField && !this.mHourField.disabled &&
!this.mHourField.readOnly) {
this.mHourField.value = "";
+ this.mHourField.setAttribute("typeBuffer", "");
}
if (this.mMinuteField && !this.mMinuteField.disabled &&
!this.mMinuteField.readOnly) {
this.mMinuteField.value = "";
+ this.mMinuteField.setAttribute("typeBuffer", "");
}
if (this.mSecondField && !this.mSecondField.disabled &&
!this.mSecondField.readOnly) {
this.mSecondField.value = "";
+ this.mSecondField.setAttribute("typeBuffer", "");
}
if (this.mMillisecField && !this.mMillisecField.disabled &&
!this.mMillisecField.readOnly) {
this.mMillisecField.value = "";
+ this.mMillisecField.setAttribute("typeBuffer", "");
}
if (this.mDayPeriodField && !this.mDayPeriodField.disabled &&
@@ -304,9 +777,11 @@
this.mDayPeriodField.value = "";
}
- if (!aFromInputElement) {
+ if (!aFromInputElement && this.mInputElement.value) {
this.mInputElement.setUserInput("");
}
+
+ this.updateResetButtonVisibility();
]]>
</body>
</method>
@@ -376,6 +851,7 @@
this.mDayPeriodField.value == this.mAMIndicator ?
this.mPMIndicator : this.mAMIndicator;
this.mDayPeriodField.select();
+ this.updateResetButtonVisibility();
this.setInputValueFromFields();
return;
}
@@ -433,6 +909,7 @@
this.mDayPeriodField.value = this.mPMIndicator;
this.mDayPeriodField.select();
}
+ this.updateResetButtonVisibility();
return;
}
@@ -488,16 +965,30 @@
}
aField.value = value;
+ this.updateResetButtonVisibility();
]]>
</body>
</method>
- <method name="isValueAvailable">
+ <method name="isAnyValueAvailable">
+ <parameter name="aForPicker"/>
<body>
<![CDATA[
+ let available = !this.isEmpty(this.mHourField.value) ||
+ !this.isEmpty(this.mMinuteField.value);
+
+ if (available) {
+ return true;
+ }
+
// Picker only cares about hour:minute.
- return !this.isEmpty(this.mHourField.value) ||
- !this.isEmpty(this.mMinuteField.value);
+ if (aForPicker) {
+ return false;
+ }
+
+ return (this.mDayPeriodField && !this.isEmpty(this.mDayPeriodField.value)) ||
+ (this.mSecondField && !this.isEmpty(this.mSecondField.value)) ||
+ (this.mMillisecField && !this.isEmpty(this.mMillisecField.value));
]]>
</body>
</method>
@@ -546,7 +1037,8 @@
<content>
<html:div class="datetime-input-box-wrapper"
xbl:inherits="context,disabled,readonly">
- <html:span>
+ <html:span class="datetime-input-edit-wrapper"
+ anonid="edit-wrapper">
<html:input anonid="input-one"
class="textbox-input datetime-input numeric"
size="2" maxlength="2"
@@ -563,9 +1055,8 @@
xbl:inherits="disabled,readonly,tabindex"/>
</html:span>
- <html:button class="datetime-reset-button" anoid="reset-button"
- tabindex="-1" xbl:inherits="disabled"
- onclick="document.getBindingParent(this).clearInputFields(false);"/>
+ <html:button class="datetime-reset-button" anonid="reset-button"
+ tabindex="-1" xbl:inherits="disabled"/>
</html:div>
</content>
@@ -579,9 +1070,49 @@
this.mMax = this.mInputElement.max;
this.mStep = this.mInputElement.step;
this.mIsPickerOpen = false;
+
+ this.mResetButton =
+ window.document.getAnonymousElementByAttribute(this, "anonid", "reset-button");
+
+ this.EVENTS.forEach((eventName) => {
+ this.addEventListener(eventName, this, { mozSystemGroup: true });
+ });
+ // Handle keypress separately since we need to catch it on capturing.
+ this.addEventListener("keypress", this, {
+ capture: true,
+ mozSystemGroup: true
+ });
+ // This is to open the picker when input element is clicked (this
+ // includes padding area).
+ this.mInputElement.addEventListener("click", this,
+ { mozSystemGroup: true });
]]>
</constructor>
+ <destructor>
+ <![CDATA[
+ this.EVENTS.forEach((eventName) => {
+ this.removeEventListener(eventName, this, { mozSystemGroup: true });
+ });
+ this.removeEventListener("keypress", this, {
+ capture: true,
+ mozSystemGroup: true
+ });
+ this.mInputElement.removeEventListener("click", this,
+ { mozSystemGroup: true });
+
+ this.mInputElement = null;
+ ]]>
+ </destructor>
+
+ <property name="EVENTS" readonly="true">
+ <getter>
+ <![CDATA[
+ return ["focus", "blur", "copy", "cut", "paste", "mousedown"];
+ ]]>
+ </getter>
+ </property>
+
<method name="log">
<parameter name="aMsg"/>
<body>
@@ -593,11 +1124,23 @@
</body>
</method>
+ <method name="updateResetButtonVisibility">
+ <body>
+ <![CDATA[
+ if (this.isAnyValueAvailable(false)) {
+ this.mResetButton.style.visibility = "visible";
+ } else {
+ this.mResetButton.style.visibility = "hidden";
+ }
+ ]]>
+ </body>
+ </method>
+
<method name="focusInnerTextBox">
<body>
<![CDATA[
this.log("focusInnerTextBox");
- document.getAnonymousElementByAttribute(this, "anonid", "input-one").focus();
+ window.document.getAnonymousElementByAttribute(this, "anonid", "input-one").focus();
]]>
</body>
</method>
@@ -710,10 +1253,22 @@
</body>
</method>
+ <method name="getCurrentValue">
+ <body>
+ throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+ </body>
+ </method>
+
+ <method name="isAnyValueAvailable">
+ <body>
+ throw Components.results.NS_ERROR_NOT_IMPLEMENTED;
+ </body>
+ </method>
+
<method name="notifyPicker">
<body>
<![CDATA[
- if (this.mIsPickerOpen && this.isValueAvailable()) {
+ if (this.mIsPickerOpen && this.isAnyValueAvailable(true)) {
this.mInputElement.updateDateTimePicker(this.getCurrentValue());
}
]]>
@@ -736,72 +1291,153 @@
</body>
</method>
- </implementation>
-
- <handlers>
- <handler event="focus">
- <![CDATA[
- this.log("focus on: " + event.originalTarget);
+ <method name="handleEvent">
+ <parameter name="aEvent"/>
+ <body>
+ <![CDATA[
+ this.log("handleEvent: " + aEvent.type);
- let target = event.originalTarget;
- if (target.type == "text") {
- this.mLastFocusedField = target;
- target.select();
- }
- ]]>
- </handler>
+ switch (aEvent.type) {
+ case "keypress": {
+ this.onKeyPress(aEvent);
+ break;
+ }
+ case "click": {
+ this.onClick(aEvent);
+ break;
+ }
+ case "focus": {
+ this.onFocus(aEvent);
+ break;
+ }
+ case "blur": {
+ this.onBlur(aEvent);
+ break;
+ }
+ case "mousedown": {
+ if (aEvent.originalTarget == this.mResetButton) {
+ aEvent.preventDefault();
+ }
+ break;
+ }
+ case "copy":
+ case "cut":
+ case "paste": {
+ aEvent.preventDefault();
+ break;
+ }
+ default:
+ break;
+ }
+ ]]>
+ </body>
+ </method>
- <handler event="blur">
- <![CDATA[
- this.setInputValueFromFields();
- ]]>
- </handler>
+ <method name="onFocus">
+ <parameter name="aEvent"/>
+ <body>
+ <![CDATA[
+ this.log("onFocus originalTarget: " + aEvent.originalTarget);
- <handler event="click">
- <![CDATA[
- // XXX: .originalTarget is not expected.
- // When clicking on one of the inner text boxes, the .originalTarget is
- // a HTMLDivElement and when clicking on the reset button, it's a
- // HTMLButtonElement but it's not equal to our reset-button.
- this.log("click on: " + event.originalTarget);
- if (event.defaultPrevented || this.isDisabled() || this.isReadonly()) {
- return;
- }
+ let target = aEvent.originalTarget;
+ if ((target instanceof HTMLInputElement) && target.type == "text") {
+ this.mLastFocusedField = target;
+ target.select();
+ }
+ ]]>
+ </body>
+ </method>
- if (!(event.originalTarget instanceof HTMLButtonElement)) {
- this.mInputElement.openDateTimePicker(this.getCurrentValue());
- }
- ]]>
- </handler>
+ <method name="onBlur">
+ <parameter name="aEvent"/>
+ <body>
+ <![CDATA[
+ this.log("onBlur originalTarget: " + aEvent.originalTarget +
+ " target: " + aEvent.target);
- <handler event="keypress" phase="capturing">
- <![CDATA[
- let key = event.key;
- this.log("keypress: " + key);
+ let target = aEvent.originalTarget;
+ target.setAttribute("typeBuffer", "");
+ this.setInputValueFromFields();
+ ]]>
+ </body>
+ </method>
- if (key == "Backspace" || key == "Tab") {
- return;
- }
+ <method name="onKeyPress">
+ <parameter name="aEvent"/>
+ <body>
+ <![CDATA[
+ this.log("onKeyPress key: " + aEvent.key);
+
+ switch (aEvent.key) {
+ // Close picker on Enter, Escape or Space key.
+ case "Enter":
+ case "Escape":
+ case " ": {
+ if (this.mIsPickerOpen) {
+ this.mInputElement.closeDateTimePicker();
+ aEvent.preventDefault();
+ }
+ break;
+ }
+ case "Backspace": {
+ let targetField = aEvent.originalTarget;
+ targetField.value = "";
+ targetField.setAttribute("typeBuffer", "");
+ this.updateResetButtonVisibility();
+ this.setInputValueFromFields();
+ aEvent.preventDefault();
+ break;
+ }
+ case "ArrowRight":
+ case "ArrowLeft": {
+ this.advanceToNextField(aEvent.key == "ArrowRight" ? false : true);
+ aEvent.preventDefault();
+ break;
+ }
+ case "ArrowUp":
+ case "ArrowDown":
+ case "PageUp":
+ case "PageDown":
+ case "Home":
+ case "End": {
+ this.handleKeyboardNav(aEvent);
+ aEvent.preventDefault();
+ break;
+ }
+ default: {
+ // printable characters
+ if (aEvent.keyCode == 0 &&
+ !(aEvent.ctrlKey || aEvent.altKey || aEvent.metaKey)) {
+ this.handleKeypress(aEvent);
+ aEvent.preventDefault();
+ }
+ break;
+ }
+ }
+ ]]>
+ </body>
+ </method>
- if (key == "Enter" || key == " ") {
- // Close picker on Enter and Space.
- this.mInputElement.closeDateTimePicker();
- }
+ <method name="onClick">
+ <parameter name="aEvent"/>
+ <body>
+ <![CDATA[
+ this.log("onClick originalTarget: " + aEvent.originalTarget +
+ " target: " + aEvent.target);
- if (key == "ArrowUp" || key == "ArrowDown" ||
- key == "PageUp" || key == "PageDown" ||
- key == "Home" || key == "End") {
- this.handleKeyboardNav(event);
- } else if (key == "ArrowRight" || key == "ArrowLeft") {
- this.advanceToNextField((key == "ArrowRight" ? false : true));
- } else {
- this.handleKeypress(event);
- }
+ if (aEvent.defaultPrevented || this.isDisabled() || this.isReadonly()) {
+ return;
+ }
- event.preventDefault();
- ]]>
- </handler>
- </handlers>
+ if (aEvent.originalTarget == this.mResetButton) {
+ this.clearInputFields(false);
+ } else if (!this.mIsPickerOpen) {
+ this.mInputElement.openDateTimePicker(this.getCurrentValue());
+ }
+ ]]>
+ </body>
+ </method>
+ </implementation>
</binding>
</bindings>
diff --git a/toolkit/content/widgets/datetimepicker.xml b/toolkit/content/widgets/datetimepicker.xml
index 5f16f1ff0c..1d6a5e7722 100644
--- a/toolkit/content/widgets/datetimepicker.xml
+++ b/toolkit/content/widgets/datetimepicker.xml
@@ -999,13 +999,13 @@
<body>
<![CDATA[
var locale = Intl.DateTimeFormat().resolvedOptions().locale + "-u-ca-gregory";
- var dtfMonth = Intl.DateTimeFormat(locale, {month: "long"});
+ var dtfMonth = Intl.DateTimeFormat(locale, {month: "long", timeZone: "UTC"});
var dtfWeekday = Intl.DateTimeFormat(locale, {weekday: "narrow"});
var monthLabel = this.monthField.firstChild;
- var tempDate = new Date(2005, 0, 1);
+ var tempDate = new Date(Date.UTC(2005, 0, 1));
for (var month = 0; month < 12; month++) {
- tempDate.setMonth(month);
+ tempDate.setUTCMonth(month);
monthLabel.setAttribute("value", dtfMonth.format(tempDate));
monthLabel = monthLabel.nextSibling;
}
diff --git a/toolkit/content/widgets/datetimepopup.xml b/toolkit/content/widgets/datetimepopup.xml
index 327f453684..b4335e1ced 100644
--- a/toolkit/content/widgets/datetimepopup.xml
+++ b/toolkit/content/widgets/datetimepopup.xml
@@ -11,17 +11,31 @@
xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="datetime-popup"
extends="chrome://global/content/bindings/popup.xml#arrowpanel">
+ <resources>
+ <stylesheet src="chrome://global/skin/datetimepopup.css"/>
+ </resources>
<implementation>
<field name="dateTimePopupFrame">
this.querySelector("#dateTimePopupFrame");
</field>
<field name="TIME_PICKER_WIDTH" readonly="true">"12em"</field>
<field name="TIME_PICKER_HEIGHT" readonly="true">"21em"</field>
- <method name="loadPicker">
+ <field name="DATE_PICKER_WIDTH" readonly="true">"23.1em"</field>
+ <field name="DATE_PICKER_HEIGHT" readonly="true">"20.7em"</field>
+ <constructor><![CDATA[
+ this.l10n = {};
+ const mozIntl = Components.classes["@mozilla.org/mozintl;1"]
+ .getService(Components.interfaces.mozIMozIntl);
+ mozIntl.addGetCalendarInfo(l10n);
+ mozIntl.addGetDisplayNames(l10n);
+ // Notify DateTimePickerHelper.jsm that binding is ready.
+ this.dispatchEvent(new CustomEvent("DateTimePickerBindingReady"));
+ ]]></constructor>
+ <method name="openPicker">
<parameter name="type"/>
+ <parameter name="anchor"/>
<parameter name="detail"/>
<body><![CDATA[
- this.hidden = false;
this.type = type;
this.pickerState = {};
// TODO: Resize picker according to content zoom level
@@ -35,18 +49,28 @@
this.dateTimePopupFrame.style.height = this.TIME_PICKER_HEIGHT;
break;
}
+ case "date": {
+ this.detail = detail;
+ this.dateTimePopupFrame.addEventListener("load", this, true);
+ this.dateTimePopupFrame.setAttribute("src", "chrome://global/content/datepicker.xhtml");
+ this.dateTimePopupFrame.style.width = this.DATE_PICKER_WIDTH;
+ this.dateTimePopupFrame.style.height = this.DATE_PICKER_HEIGHT;
+ break;
+ }
}
+ this.hidden = false;
+ this.openPopup(anchor, "after_start", 0, 0);
]]></body>
</method>
<method name="closePicker">
<body><![CDATA[
- this.hidden = true;
this.setInputBoxValue(true);
this.pickerState = {};
this.type = undefined;
this.dateTimePopupFrame.removeEventListener("load", this, true);
- this.dateTimePopupFrame.contentDocument.removeEventListener("TimePickerPopupChanged", this, false);
+ this.dateTimePopupFrame.contentDocument.removeEventListener("message", this, false);
this.dateTimePopupFrame.setAttribute("src", "");
+ this.hidden = true;
]]></body>
</method>
<method name="setPopupValue">
@@ -55,25 +79,39 @@
switch (this.type) {
case "time": {
this.postMessageToPicker({
- name: "TimePickerSetValue",
+ name: "PickerSetValue",
detail: data.value
});
break;
}
+ case "date": {
+ const { year, month, day } = data.value;
+ this.postMessageToPicker({
+ name: "PickerSetValue",
+ detail: {
+ year,
+ // Month value from input box starts from 1 instead of 0
+ month: month == undefined ? undefined : month - 1,
+ day
+ }
+ });
+ break;
+ }
}
]]></body>
</method>
<method name="initPicker">
<parameter name="detail"/>
<body><![CDATA[
+ const locale = Components.classes["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIXULChromeRegistry).getSelectedLocale("global");
+
switch (this.type) {
case "time": {
const { hour, minute } = detail.value;
const format = detail.format || "12";
- const locale = Components.classes["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIXULChromeRegistry).getSelectedLocale("global");
this.postMessageToPicker({
- name: "TimePickerInit",
+ name: "PickerInit",
detail: {
hour,
minute,
@@ -86,6 +124,56 @@
});
break;
}
+ case "date": {
+ const { year, month, day } = detail.value;
+ const { firstDayOfWeek, weekends } =
+ this.getCalendarInfo(locale);
+ const monthStrings = this.getDisplayNames(
+ locale, [
+ "dates/gregorian/months/january",
+ "dates/gregorian/months/february",
+ "dates/gregorian/months/march",
+ "dates/gregorian/months/april",
+ "dates/gregorian/months/may",
+ "dates/gregorian/months/june",
+ "dates/gregorian/months/july",
+ "dates/gregorian/months/august",
+ "dates/gregorian/months/september",
+ "dates/gregorian/months/october",
+ "dates/gregorian/months/november",
+ "dates/gregorian/months/december",
+ ], "short");
+ const weekdayStrings = this.getDisplayNames(
+ locale, [
+ "dates/gregorian/weekdays/sunday",
+ "dates/gregorian/weekdays/monday",
+ "dates/gregorian/weekdays/tuesday",
+ "dates/gregorian/weekdays/wednesday",
+ "dates/gregorian/weekdays/thursday",
+ "dates/gregorian/weekdays/friday",
+ "dates/gregorian/weekdays/saturday",
+ ], "short");
+
+ this.postMessageToPicker({
+ name: "PickerInit",
+ detail: {
+ year,
+ // Month value from input box starts from 1 instead of 0
+ month: month == undefined ? undefined : month - 1,
+ day,
+ firstDayOfWeek,
+ weekends,
+ monthStrings,
+ weekdayStrings,
+ locale,
+ min: detail.min,
+ max: detail.max,
+ step: detail.step,
+ stepBase: detail.stepBase,
+ }
+ });
+ break;
+ }
}
]]></body>
</method>
@@ -109,6 +197,10 @@
}
break;
}
+ case "date": {
+ this.sendPickerValueChanged(this.pickerState);
+ break;
+ }
}
]]></body>
</method>
@@ -125,9 +217,60 @@
}));
break;
}
+ case "date": {
+ this.dispatchEvent(new CustomEvent("DateTimePickerValueChanged", {
+ detail: {
+ year: value.year,
+ // Month value from input box starts from 1 instead of 0
+ month: value.month == undefined ? undefined : value.month + 1,
+ day: value.day
+ }
+ }));
+ break;
+ }
}
]]></body>
</method>
+ <method name="getCalendarInfo">
+ <parameter name="locale"/>
+ <body><![CDATA[
+ const calendarInfo = this.l10n.getCalendarInfo(locale);
+
+ // Day of week from calendarInfo starts from 1 as Sunday to 7 as Saturday,
+ // so they need to be mapped to JavaScript convention with 0 as Sunday
+ // and 6 as Saturday
+ let firstDayOfWeek = calendarInfo.firstDayOfWeek - 1,
+ weekendStart = calendarInfo.weekendStart - 1,
+ weekendEnd = calendarInfo.weekendEnd - 1;
+
+ let weekends = [];
+
+ // Make sure weekendEnd is greater than weekendStart
+ if (weekendEnd < weekendStart) {
+ weekendEnd += 7;
+ }
+
+ // We get the weekends by incrementing weekendStart up to weekendEnd.
+ // If the start and end is the same day, then weekends only has one day.
+ for (let day = weekendStart; day <= weekendEnd; day++) {
+ weekends.push(day % 7);
+ }
+
+ return {
+ firstDayOfWeek,
+ weekends
+ }
+ ]]></body>
+ </method>
+ <method name="getDisplayNames">
+ <parameter name="locale"/>
+ <parameter name="keys"/>
+ <parameter name="style"/>
+ <body><![CDATA[
+ const displayNames = this.l10n.getDisplayNames(locale, {keys, style});
+ return keys.map(key => displayNames.values[key]);
+ ]]></body>
+ </method>
<method name="handleEvent">
<parameter name="aEvent"/>
<body><![CDATA[
@@ -152,11 +295,16 @@
}
switch (aEvent.data.name) {
- case "TimePickerPopupChanged": {
+ case "PickerPopupChanged": {
this.pickerState = aEvent.data.detail;
this.setInputBoxValue();
break;
}
+ case "ClosePopup": {
+ this.hidePopup();
+ this.closePicker();
+ break;
+ }
}
]]></body>
</method>
@@ -170,12 +318,5 @@
</method>
</implementation>
- <handlers>
- <handler event="popuphiding">
- <![CDATA[
- this.closePicker();
- ]]>
- </handler>
- </handlers>
</binding>
</bindings>
diff --git a/toolkit/content/widgets/findbar.xml b/toolkit/content/widgets/findbar.xml
index f90d412275..b92fb1d051 100644
--- a/toolkit/content/widgets/findbar.xml
+++ b/toolkit/content/widgets/findbar.xml
@@ -162,21 +162,29 @@
<content hidden="true">
<xul:hbox anonid="findbar-container" class="findbar-container" flex="1" align="center">
<xul:hbox anonid="findbar-textbox-wrapper" align="stretch">
+ <xul:toolbarbutton anonid="find-closebutton"
+ class="findbar-closebutton close-icon"
+ tooltiptext="&findCloseButton.tooltip;"
+ oncommand="close();"/>
<xul:textbox anonid="findbar-textbox"
class="findbar-textbox findbar-find-fast"
xbl:inherits="flash"/>
- <xul:toolbarbutton anonid="find-previous"
- class="findbar-find-previous tabbable"
- tooltiptext="&previous.tooltip;"
- oncommand="onFindAgainCommand(true);"
- disabled="true"
- xbl:inherits="accesskey=findpreviousaccesskey"/>
- <xul:toolbarbutton anonid="find-next"
+ <xul:toolbarbutton anonid="find-next"
class="findbar-find-next tabbable"
+ label="&next.label;"
+ accesskey="&next.accesskey;"
tooltiptext="&next.tooltip;"
oncommand="onFindAgainCommand(false);"
disabled="true"
xbl:inherits="accesskey=findnextaccesskey"/>
+ <xul:toolbarbutton anonid="find-previous"
+ class="findbar-find-previous tabbable"
+ label="&previous.label;"
+ accesskey="&previous.accesskey;"
+ tooltiptext="&previous.tooltip;"
+ oncommand="onFindAgainCommand(true);"
+ disabled="true"
+ xbl:inherits="accesskey=findpreviousaccesskey"/>
</xul:hbox>
<xul:toolbarbutton anonid="highlight"
class="findbar-highlight findbar-button tabbable"
@@ -186,22 +194,22 @@
oncommand="toggleHighlight(this.checked);"
type="checkbox"
xbl:inherits="accesskey=highlightaccesskey"/>
- <xul:toolbarbutton anonid="find-case-sensitive"
- class="findbar-case-sensitive findbar-button tabbable"
- label="&caseSensitive.label;"
- accesskey="&caseSensitive.accesskey;"
- tooltiptext="&caseSensitive.tooltiptext;"
- oncommand="_setCaseSensitivity(this.checked ? 1 : 0);"
- type="checkbox"
- xbl:inherits="accesskey=matchcaseaccesskey"/>
- <xul:toolbarbutton anonid="find-entire-word"
- class="findbar-entire-word findbar-button tabbable"
- label="&entireWord.label;"
- accesskey="&entireWord.accesskey;"
- tooltiptext="&entireWord.tooltiptext;"
- oncommand="toggleEntireWord(this.checked);"
- type="checkbox"
- xbl:inherits="accesskey=entirewordaccesskey"/>
+ <xul:checkbox anonid="find-case-sensitive"
+ class="findbar-case-sensitive findbar-button tabbable"
+ label="&caseSensitive.label;"
+ accesskey="&caseSensitive.accesskey;"
+ tooltiptext="&caseSensitive.tooltiptext;"
+ oncommand="_setCaseSensitivity(this.checked ? 1 : 0);"
+ type="checkbox"
+ xbl:inherits="accesskey=matchcaseaccesskey"/>
+ <xul:checkbox anonid="find-entire-word"
+ class="findbar-entire-word findbar-button tabbable"
+ label="&entireWord.label;"
+ accesskey="&entireWord.accesskey;"
+ tooltiptext="&entireWord.tooltiptext;"
+ oncommand="toggleEntireWord(this.checked);"
+ type="checkbox"
+ xbl:inherits="accesskey=entirewordaccesskey"/>
<xul:label anonid="match-case-status" class="findbar-find-fast"/>
<xul:label anonid="entire-word-status" class="findbar-find-fast"/>
<xul:label anonid="found-matches" class="findbar-find-fast found-matches" hidden="true"/>
@@ -212,10 +220,6 @@
<!-- Do not use value, first child is used because it provides a11y with text change events -->
</xul:description>
</xul:hbox>
- <xul:toolbarbutton anonid="find-closebutton"
- class="findbar-closebutton close-icon"
- tooltiptext="&findCloseButton.tooltip;"
- oncommand="close();"/>
</content>
<implementation implements="nsIMessageListener, nsIEditActionListener">
diff --git a/toolkit/content/widgets/menulist.xml b/toolkit/content/widgets/menulist.xml
index ccdf3bd26d..96c011809e 100644
--- a/toolkit/content/widgets/menulist.xml
+++ b/toolkit/content/widgets/menulist.xml
@@ -129,8 +129,22 @@
<property name="label" readonly="true" onget="return this.getAttribute('label');"/>
<property name="description" onset="this.setAttribute('description',val); return val;"
onget="return this.getAttribute('description');"/>
- <property name="editable" onset="this.setAttribute('editable',val); return val;"
- onget="return this.getAttribute('editable') == 'true';"/>
+
+ <property name="editable" onget="return this.getAttribute('editable') == 'true';">
+ <setter>
+ <![CDATA[
+ if (!val && this.editable) {
+ // If we were focused and transition from editable to not editable,
+ // focus the parent menulist so that the focus does not get stuck.
+ if (this.inputField == document.activeElement)
+ window.setTimeout(() => this.focus(), 0);
+ }
+
+ this.setAttribute("editable", val);
+ return val;
+ ]]>
+ </setter>
+ </property>
<property name="open" onset="this.menuBoxObject.openMenu(val);
return val;"
diff --git a/toolkit/content/widgets/spinner.js b/toolkit/content/widgets/spinner.js
index 208ab1931b..4901320b58 100644
--- a/toolkit/content/widgets/spinner.js
+++ b/toolkit/content/widgets/spinner.js
@@ -98,7 +98,7 @@ function Spinner(props, context) {
setState(newState) {
const { spinner } = this.elements;
const { value, items } = this.state;
- const { value: newValue, items: newItems, isValueSet, isInvalid } = newState;
+ const { value: newValue, items: newItems, isValueSet, isInvalid, smoothScroll = true } = newState;
if (this._isArrayDiff(newItems, items)) {
this.state = Object.assign(this.state, newState);
@@ -106,23 +106,23 @@ function Spinner(props, context) {
this._scrollTo(newValue, true);
} else if (newValue != value) {
this.state = Object.assign(this.state, newState);
- this._smoothScrollTo(newValue);
- }
-
- if (isValueSet) {
- if (isInvalid) {
- this._removeSelection();
+ if (smoothScroll) {
+ this._smoothScrollTo(newValue, true);
} else {
- this._updateSelection();
+ this._scrollTo(newValue, true);
}
}
+
+ if (isValueSet && !isInvalid) {
+ this._updateSelection();
+ } else {
+ this._removeSelection();
+ }
},
/**
* Whenever scroll event is detected:
* - Update the index state
- * - If a smooth scroll has reached its destination, set [isScrolling] state
- * to false
* - If the value has changed, update the [value] state and call [setValue]
* - If infinite scrolling is on, reset the scrolling position if necessary
*/
@@ -135,14 +135,8 @@ function Spinner(props, context) {
const value = itemsView[this.state.index + viewportTopOffset].value;
- // Check if smooth scrolling has reached its destination.
- // This prevents input box jump when input box changes values.
- if (this.state.value == value && this.state.isScrolling) {
- this.state.isScrolling = false;
- }
-
- // Call setValue if value has changed, and is not smooth scrolling
- if (this.state.value != value && !this.state.isScrolling) {
+ // Call setValue if value has changed
+ if (this.state.value != value) {
this.state.value = value;
this.props.setValue(value);
}
@@ -266,11 +260,11 @@ function Spinner(props, context) {
* Attach event listeners to the spinner and buttons.
*/
_attachEventListeners() {
- const { spinner } = this.elements;
+ const { spinner, container } = this.elements;
spinner.addEventListener("scroll", this, { passive: true });
- document.addEventListener("mouseup", this, { passive: true });
- document.addEventListener("mousedown", this);
+ container.addEventListener("mouseup", this, { passive: true });
+ container.addEventListener("mousedown", this, { passive: true });
},
/**
@@ -288,9 +282,6 @@ function Spinner(props, context) {
break;
}
case "mousedown": {
- // Use preventDefault to keep focus on input boxes
- event.preventDefault();
- event.target.setCapture();
this.state.mouseState = {
down: true,
layerX: event.layerX,
@@ -300,11 +291,11 @@ function Spinner(props, context) {
// An "active" class is needed to simulate :active pseudo-class
// because element is not focused.
event.target.classList.add("active");
- this._smoothScrollToIndex(index + 1);
+ this._smoothScrollToIndex(index - 1);
}
if (event.target == down) {
event.target.classList.add("active");
- this._smoothScrollToIndex(index - 1);
+ this._smoothScrollToIndex(index + 1);
}
if (event.target.parentNode == spinner) {
// Listen to dragging events
@@ -444,10 +435,6 @@ function Spinner(props, context) {
_smoothScrollToIndex(index) {
const element = this.elements.spinner.children[index];
if (element) {
- // Set the isScrolling flag before smooth scrolling begins
- // and remove it when it has reached the destination.
- // This prevents input box jump when input box changes values
- this.state.isScrolling = true;
element.scrollIntoView({
behavior: "smooth", block: "start"
});
diff --git a/toolkit/content/widgets/timekeeper.js b/toolkit/content/widgets/timekeeper.js
index 2234c9e509..3b4e7eb0a3 100644
--- a/toolkit/content/widgets/timekeeper.js
+++ b/toolkit/content/widgets/timekeeper.js
@@ -14,7 +14,7 @@
* {
* {Date} min
* {Date} max
- * {Number} stepInMs
+ * {Number} step
* {String} format: Either "12" or "24"
* }
*/
@@ -286,15 +286,15 @@ function TimeKeeper(props) {
* }
*/
_getSteps(startValue, endValue, minStep, formatter) {
- const { min, max, stepInMs } = this.props;
+ const { min, max, step } = this.props;
// The timeStep should be big enough so that there won't be
// duplications. Ex: minimum step for minute should be 60000ms,
// if smaller than that, next step might return the same minute.
- const timeStep = Math.max(minStep, stepInMs);
+ const timeStep = Math.max(minStep, step);
// Make sure the starting point and end point is not off step
let time = min.valueOf() + Math.ceil((startValue - min.valueOf()) / timeStep) * timeStep;
- let maxValue = min.valueOf() + Math.floor((max.valueOf() - min.valueOf()) / stepInMs) * stepInMs;
+ let maxValue = min.valueOf() + Math.floor((max.valueOf() - min.valueOf()) / step) * step;
let steps = [];
// Increment by timeStep until reaching the end of the range.
@@ -410,9 +410,9 @@ function TimeKeeper(props) {
* @return {Boolean}
*/
_isOffStep(time) {
- const { min, stepInMs } = this.props;
+ const { min, step } = this.props;
- return (time.valueOf() - min.valueOf()) % stepInMs != 0;
+ return (time.valueOf() - min.valueOf()) % step != 0;
}
};
}
diff --git a/toolkit/content/widgets/timepicker.js b/toolkit/content/widgets/timepicker.js
index f438e9ec60..1f0463fe42 100644
--- a/toolkit/content/widgets/timepicker.js
+++ b/toolkit/content/widgets/timepicker.js
@@ -13,8 +13,6 @@ function TimePicker(context) {
const debug = 0 ? console.log.bind(console, "[timepicker]") : function() {};
const DAY_PERIOD_IN_HOURS = 12,
- SECOND_IN_MS = 1000,
- MINUTE_IN_MS = 60000,
DAY_IN_MS = 86400000;
TimePicker.prototype = {
@@ -24,9 +22,9 @@ function TimePicker(context) {
* {
* {Number} hour [optional]: Hour in 24 hours format (0~23), default is current hour
* {Number} minute [optional]: Minute (0~59), default is current minute
- * {String} min [optional]: Minimum time, in 24 hours format. ex: "05:45"
- * {String} max [optional]: Maximum time, in 24 hours format. ex: "23:00"
- * {Number} step [optional]: Step size in minutes. Default is 60.
+ * {Number} min: Minimum time, in ms
+ * {Number} max: Maximum time, in ms
+ * {Number} step: Step size in ms
* {String} format [optional]: "12" for 12 hours, "24" for 24 hours format
* {String} locale [optional]: User preferred locale
* }
@@ -51,11 +49,10 @@ function TimePicker(context) {
let timerHour = hour == undefined ? now.getHours() : hour;
let timerMinute = minute == undefined ? now.getMinutes() : minute;
- // The spec defines 1 step == 1 second, need to convert to ms for timekeeper
let timeKeeper = new TimeKeeper({
- min: this._parseTimeString(min) || new Date(0),
- max: this._parseTimeString(max) || new Date(DAY_IN_MS - 1),
- stepInMs: step ? step * SECOND_IN_MS : MINUTE_IN_MS,
+ min: new Date(Number.isNaN(min) ? 0 : min),
+ max: new Date(Number.isNaN(max) ? DAY_IN_MS - 1 : max),
+ step,
format: format || "12"
});
timeKeeper.setState({ hour: timerHour, minute: timerMinute });
@@ -64,17 +61,6 @@ function TimePicker(context) {
},
/**
- * Convert a time string from DOM attribute to a date object.
- *
- * @param {String} timeString: (ex. "10:30", "23:55", "12:34:56.789")
- * @return {Date/Boolean} Date object or false if date is invalid.
- */
- _parseTimeString(timeString) {
- let time = new Date("1970-01-01T" + timeString + "Z");
- return time.toString() == "Invalid Date" ? false : time;
- },
-
- /**
* Initalize the spinner components.
*/
_createComponents() {
@@ -206,7 +192,7 @@ function TimePicker(context) {
// The panel is listening to window for postMessage event, so we
// do postMessage to itself to send data to input boxes.
window.postMessage({
- name: "TimePickerPopupChanged",
+ name: "PickerPopupChanged",
detail: {
hour,
minute,
@@ -218,6 +204,7 @@ function TimePicker(context) {
},
_attachEventListeners() {
window.addEventListener("message", this);
+ document.addEventListener("mousedown", this);
},
/**
@@ -231,6 +218,12 @@ function TimePicker(context) {
this.handleMessage(event);
break;
}
+ case "mousedown": {
+ // Use preventDefault to keep focus on input boxes
+ event.preventDefault();
+ event.target.setCapture();
+ break;
+ }
}
},
@@ -241,11 +234,11 @@ function TimePicker(context) {
*/
handleMessage(event) {
switch (event.data.name) {
- case "TimePickerSetValue": {
+ case "PickerSetValue": {
this.set(event.data.detail);
break;
}
- case "TimePickerInit": {
+ case "PickerInit": {
this.init(event.data.detail);
break;
}
diff --git a/toolkit/content/widgets/toolbar.xml b/toolkit/content/widgets/toolbar.xml
index 548504e24a..55cef8244b 100644
--- a/toolkit/content/widgets/toolbar.xml
+++ b/toolkit/content/widgets/toolbar.xml
@@ -30,7 +30,7 @@
</field>
<field name="externalToolbars">
- []
+ []
</field>
<!-- Set by customizeToolbar.js -->
@@ -49,18 +49,54 @@
<constructor>
<![CDATA[
+ this.toolbarInfoSeparators = ["|", "-"];
+ this.toolbarInfoLegacySeparator = ":";
// Look to see if there is a toolbarset.
this.toolbarset = this.firstChild;
- while (this.toolbarset && this.toolbarset.localName != "toolbarset")
- this.toolbarset = toolbarset.nextSibling;
+ while (this.toolbarset && this.toolbarset.localName != "toolbarset") {
+ this.toolbarset = this.toolbarset.nextSibling;
+ }
if (this.toolbarset) {
// Create each toolbar described by the toolbarset.
var index = 0;
- while (toolbarset.hasAttribute("toolbar"+(++index))) {
- var toolbarInfo = toolbarset.getAttribute("toolbar"+index);
- var infoSplit = toolbarInfo.split(":");
- this.appendCustomToolbar(infoSplit[0], infoSplit[1]);
+ while (this.toolbarset.hasAttribute("toolbar" + (++index))) {
+ let hiddingAttribute =
+ this.toolbarset.getAttribute("type") == "menubar"
+ ? "autohide" : "collapsed";
+ let toolbarInfo = this.toolbarset.getAttribute("toolbar" + index);
+ let infoSplit = toolbarInfo.split(this.toolbarInfoSeparators[0]);
+ if (infoSplit.length == 1) {
+ infoSplit = toolbarInfo.split(this.toolbarInfoLegacySeparator);
+ }
+ let infoName = infoSplit[0];
+ let infoHidingAttribute = [null, null];
+ let infoCurrentSet = "";
+ let infoSplitLen = infoSplit.length;
+ switch (infoSplitLen) {
+ case 3:
+ // Pale Moon 27.2+
+ // Basilisk (UXP)
+ infoHidingAttribute = infoSplit[1]
+ .split(this.toolbarInfoSeparators[1]);
+ infoCurrentSet = infoSplit[2];
+ break;
+ case 2:
+ // Legacy:
+ // - toolbars from Pale Moon 27.0 - 27.1.x
+ // - Basilisk (moebius)
+ // The previous value (hiddingAttribute) isn't stored.
+ infoHidingAttribute = [hiddingAttribute, "false"];
+ infoCurrentSet = infoSplit[1];
+ break;
+ default:
+ Components.utils.reportError(
+ "Customizable toolbars - an invalid value:" + "\n"
+ + '"toolbar' + index + '" = "' + toolbarInfo + '"');
+ break;
+ }
+ this.appendCustomToolbar(
+ infoName, infoCurrentSet, infoHidingAttribute);
}
}
]]>
@@ -69,6 +105,7 @@
<method name="appendCustomToolbar">
<parameter name="aName"/>
<parameter name="aCurrentSet"/>
+ <parameter name="aHidingAttribute"/>
<body>
<![CDATA[
if (!this.toolbarset)
@@ -84,6 +121,10 @@
toolbar.setAttribute("iconsize", this.getAttribute("iconsize"));
toolbar.setAttribute("context", this.toolbarset.getAttribute("context"));
toolbar.setAttribute("class", "chromeclass-toolbar");
+ // Restore persist the hiding attribute.
+ if (aHidingAttribute[0]) {
+ toolbar.setAttribute(aHidingAttribute[0], aHidingAttribute[1]);
+ }
this.insertBefore(toolbar, this.toolbarset);
return toolbar;
diff --git a/toolkit/forgetaboutsite/ForgetAboutSite.jsm b/toolkit/forgetaboutsite/ForgetAboutSite.jsm
index 5250ca75d4..8c78253922 100644
--- a/toolkit/forgetaboutsite/ForgetAboutSite.jsm
+++ b/toolkit/forgetaboutsite/ForgetAboutSite.jsm
@@ -45,175 +45,201 @@ const Ci = Components.interfaces;
const Cu = Components.utils;
this.ForgetAboutSite = {
- removeDataFromDomain: function CRH_removeDataFromDomain(aDomain)
+ removeDataFromDomain: Task.async(function* (aDomain)
{
PlacesUtils.history.removePagesFromHost(aDomain, true);
+ let promises = [];
// Cache
- let cs = Cc["@mozilla.org/netwerk/cache-storage-service;1"].
- getService(Ci.nsICacheStorageService);
- // NOTE: there is no way to clear just that domain, so we clear out
- // everything)
- try {
+ promises.push(Task.spawn(function*() {
+ let cs = Cc["@mozilla.org/netwerk/cache-storage-service;1"].
+ getService(Ci.nsICacheStorageService);
+ // NOTE: there is no way to clear just that domain, so we clear out
+ // everything)
cs.clear();
- } catch (ex) {
- Cu.reportError("Exception thrown while clearing the cache: " +
- ex.toString());
- }
+ }).catch(ex => {
+ throw new Error("Exception thrown while clearing the cache: " + ex);
+ }));
// Image Cache
- let imageCache = Cc["@mozilla.org/image/tools;1"].
- getService(Ci.imgITools).getImgCacheForDocument(null);
- try {
+ promises.push(Task.spawn(function*() {
+ let imageCache = Cc["@mozilla.org/image/tools;1"].
+ getService(Ci.imgITools).getImgCacheForDocument(null);
imageCache.clearCache(false); // true=chrome, false=content
- } catch (ex) {
- Cu.reportError("Exception thrown while clearing the image cache: " +
- ex.toString());
- }
+ }).catch(ex => {
+ throw new Error("Exception thrown while clearing the image cache: " + ex);
+ }));
// Cookies
- let cm = Cc["@mozilla.org/cookiemanager;1"].
- getService(Ci.nsICookieManager2);
- let enumerator = cm.getCookiesWithOriginAttributes(JSON.stringify({}), aDomain);
- while (enumerator.hasMoreElements()) {
- let cookie = enumerator.getNext().QueryInterface(Ci.nsICookie);
- cm.remove(cookie.host, cookie.name, cookie.path, false, cookie.originAttributes);
- }
+ // Need to maximize the number of cookies cleaned here
+ promises.push(Task.spawn(function*() {
+ let cm = Cc["@mozilla.org/cookiemanager;1"].
+ getService(Ci.nsICookieManager2);
+ let enumerator = cm.getCookiesWithOriginAttributes(JSON.stringify({}), aDomain);
+ while (enumerator.hasMoreElements()) {
+ let cookie = enumerator.getNext().QueryInterface(Ci.nsICookie);
+ cm.remove(cookie.host, cookie.name, cookie.path, false, cookie.originAttributes);
+ }
+ }).catch(ex => {
+ throw new Error("Exception thrown while clearning cookies: " + ex);
+ }));
// EME
- let mps = Cc["@mozilla.org/gecko-media-plugin-service;1"].
- getService(Ci.mozIGeckoMediaPluginChromeService);
- mps.forgetThisSite(aDomain, JSON.stringify({}));
+ promises.push(Task.spawn(function*() {
+ let mps = Cc["@mozilla.org/gecko-media-plugin-service;1"].
+ getService(Ci.mozIGeckoMediaPluginChromeService);
+ mps.forgetThisSite(aDomain, JSON.stringify({}));
+ }).catch(ex => {
+ throw new Error("Exception thrown while clearing Encrypted Media Extensions: " + ex);
+ }));
// Plugin data
const phInterface = Ci.nsIPluginHost;
const FLAG_CLEAR_ALL = phInterface.FLAG_CLEAR_ALL;
let ph = Cc["@mozilla.org/plugin/host;1"].getService(phInterface);
let tags = ph.getPluginTags();
- let promises = [];
for (let i = 0; i < tags.length; i++) {
- let promise = new Promise(resolve => {
- let tag = tags[i];
+ promises.push(new Promise(resolve => {
try {
- ph.clearSiteData(tags[i], aDomain, FLAG_CLEAR_ALL, -1, function(rv) {
- resolve();
- });
+ ph.clearSiteData(tags[i], aDomain, FLAG_CLEAR_ALL, -1, resolve);
} catch (e) {
// Ignore errors from the plugin, but resolve the promise
+ // We cannot check if something is a bailout or an error
resolve();
}
- });
- promises.push(promise);
+ }));
}
// Downloads
- Task.spawn(function*() {
+ promises.push(Task.spawn(function*() {
let list = yield Downloads.getList(Downloads.ALL);
list.removeFinished(download => hasRootDomain(
- NetUtil.newURI(download.source.url).host, aDomain));
- }).then(null, Cu.reportError);
+ NetUtil.newURI(download.source.url).host, aDomain));
+ }).catch(ex => {
+ throw new Error("Exception in clearing Downloads: " + ex);
+ }));
// Passwords
- let lm = Cc["@mozilla.org/login-manager;1"].
- getService(Ci.nsILoginManager);
- // Clear all passwords for domain
- try {
+ promises.push(Task.spawn(function*() {
+ let lm = Cc["@mozilla.org/login-manager;1"].
+ getService(Ci.nsILoginManager);
+ // Clear all passwords for domain
let logins = lm.getAllLogins();
- for (let i = 0; i < logins.length; i++)
- if (hasRootDomain(logins[i].hostname, aDomain))
+ for (let i = 0; i < logins.length; i++) {
+ if (hasRootDomain(logins[i].hostname, aDomain)) {
lm.removeLogin(logins[i]);
- }
- // XXXehsan: is there a better way to do this rather than this
- // hacky comparison?
- catch (ex) {
- if (!ex.message.includes("User canceled Master Password entry")) {
- throw ex;
+ }
}
- }
+ }).catch(ex => {
+ // XXX:
+ // Is there a better way to do this rather than this hacky comparison?
+ // Copied this from toolkit/components/passwordmgr/crypto-SDR.js
+ if (!ex.message.includes("User canceled master password entry")) {
+ throw new Error("Exception occured in clearing passwords: " + ex);
+ }
+ }));
// Permissions
let pm = Cc["@mozilla.org/permissionmanager;1"].
getService(Ci.nsIPermissionManager);
// Enumerate all of the permissions, and if one matches, remove it
- enumerator = pm.enumerator;
+ let enumerator = pm.enumerator;
while (enumerator.hasMoreElements()) {
let perm = enumerator.getNext().QueryInterface(Ci.nsIPermission);
- try {
- if (hasRootDomain(perm.principal.URI.host, aDomain)) {
- pm.removePermission(perm);
+ promises.push(new Promise((resolve, reject) => {
+ try {
+ if (hasRootDomain(perm.principal.URI.host, aDomain)) {
+ pm.removePermission(perm);
+ }
+ } catch (ex) {
+ // Ignore entry
+ } finally {
+ resolve();
}
- } catch (e) {
- /* Ignore entry */
- }
+ }));
}
// Offline Storages
- let qms = Cc["@mozilla.org/dom/quota-manager-service;1"].
- getService(Ci.nsIQuotaManagerService);
- // delete data from both HTTP and HTTPS sites
- let caUtils = {};
- let scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
- getService(Ci.mozIJSSubScriptLoader);
- scriptLoader.loadSubScript("chrome://global/content/contentAreaUtils.js",
- caUtils);
- let httpURI = caUtils.makeURI("http://" + aDomain);
- let httpsURI = caUtils.makeURI("https://" + aDomain);
- // Following code section has been reverted to the state before Bug 1238183,
- // but added a new argument to clearStoragesForPrincipal() for indicating
- // clear all storages under a given origin.
- let httpPrincipal = Services.scriptSecurityManager
- .createCodebasePrincipal(httpURI, {});
- let httpsPrincipal = Services.scriptSecurityManager
- .createCodebasePrincipal(httpsURI, {});
- qms.clearStoragesForPrincipal(httpPrincipal, null, true);
- qms.clearStoragesForPrincipal(httpsPrincipal, null, true);
-
-
- function onContentPrefsRemovalFinished() {
- // Everybody else (including extensions)
- Services.obs.notifyObservers(null, "browser:purge-domain-data", aDomain);
- }
+ promises.push(Task.spawn(function*() {
+ let qms = Cc["@mozilla.org/dom/quota-manager-service;1"].
+ getService(Ci.nsIQuotaManagerService);
+ // delete data from both HTTP and HTTPS sites
+ let httpURI = NetUtil.newURI("http://" + aDomain);
+ let httpsURI = NetUtil.newURI("https://" + aDomain);
+ // Following code section has been reverted to the state before Bug 1238183,
+ // but added a new argument to clearStoragesForPrincipal() for indicating
+ // clear all storages under a given origin.
+ let httpPrincipal = Services.scriptSecurityManager
+ .createCodebasePrincipal(httpURI, {});
+ let httpsPrincipal = Services.scriptSecurityManager
+ .createCodebasePrincipal(httpsURI, {});
+ qms.clearStoragesForPrincipal(httpPrincipal, null, true);
+ qms.clearStoragesForPrincipal(httpsPrincipal, null, true);
+ }).catch(ex => {
+ throw new Error("Exception occured while clearing offline storages: " + ex);
+ }));
// Content Preferences
- let cps2 = Cc["@mozilla.org/content-pref/service;1"].
- getService(Ci.nsIContentPrefService2);
- cps2.removeBySubdomain(aDomain, null, {
- handleCompletion: () => onContentPrefsRemovalFinished(),
- handleError: function() {}
- });
+ promises.push(Task.spawn(function*() {
+ let cps2 = Cc["@mozilla.org/content-pref/service;1"].
+ getService(Ci.nsIContentPrefService2);
+ cps2.removeBySubdomain(aDomain, null, {
+ handleCompletion: (reason) => {
+ // Notify other consumers, including extensions
+ Services.obs.notifyObservers(null, "browser:purge-domain-data", aDomain);
+ if (reason === cps2.COMPLETE_ERROR) {
+ throw new Error("Exception occured while clearing content preferences");
+ }
+ },
+ handleError() {}
+ });
+ }));
// Predictive network data - like cache, no way to clear this per
// domain, so just trash it all
- let np = Cc["@mozilla.org/network/predictor;1"].
- getService(Ci.nsINetworkPredictor);
- np.reset();
-
- // Push notifications.
- promises.push(new Promise(resolve => {
- var push = Cc["@mozilla.org/push/Service;1"]
- .getService(Ci.nsIPushService);
+ promises.push(Task.spawn(function*() {
+ let np = Cc["@mozilla.org/network/predictor;1"].
+ getService(Ci.nsINetworkPredictor);
+ np.reset();
+ }).catch(ex => {
+ throw new Error("Exception occured while clearing predictive network data: " + ex);
+ }));
+
+ // Push notifications
+ promises.push(Task.spawn(function*() {
+ var push = Cc["@mozilla.org/push/Service;1"].
+ getService(Ci.nsIPushService);
push.clearForDomain(aDomain, status => {
- (Components.isSuccessCode(status) ? resolve : reject)(status);
+ if (!Components.isSuccessCode(status)) {
+ throw new Error("Exception occured while clearing push notifications: " + status);
+ }
});
- }).catch(e => {
- Cu.reportError("Exception thrown while clearing Push notifications: " +
- e.toString());
}));
// HSTS and HPKP
// TODO (bug 1290529): also remove HSTS/HPKP information for subdomains.
// Since we can't enumerate the information in the site security service
// (bug 1115712), we can't implement this right now.
- try {
+ promises.push(Task.spawn(function*() {
let sss = Cc["@mozilla.org/ssservice;1"].
getService(Ci.nsISiteSecurityService);
+ let httpsURI = NetUtil.newURI("https://" + aDomain);
sss.removeState(Ci.nsISiteSecurityService.HEADER_HSTS, httpsURI, 0);
sss.removeState(Ci.nsISiteSecurityService.HEADER_HPKP, httpsURI, 0);
- } catch (e) {
- Cu.reportError("Exception thrown while clearing HSTS/HPKP: " +
- e.toString());
- }
+ }).catch(ex => {
+ throw new Error("Exception thrown while clearing HSTS/HPKP: " + ex);
+ }));
- return Promise.all(promises);
- }
-};
+ let ErrorCount = 0;
+ for (let promise of promises) {
+ try {
+ yield promise;
+ } catch (ex) {
+ Cu.reportError(ex);
+ ErrorCount++;
+ }
+ }
+ if (ErrorCount !== 0)
+ throw new Error(`There were a total of ${ErrorCount} errors during removal`);
+ })
+}
diff --git a/toolkit/forgetaboutsite/test/browser/browser_clearplugindata.js b/toolkit/forgetaboutsite/test/browser/browser_clearplugindata.js
index ec0a70228a..ca0d394c3f 100644
--- a/toolkit/forgetaboutsite/test/browser/browser_clearplugindata.js
+++ b/toolkit/forgetaboutsite/test/browser/browser_clearplugindata.js
@@ -37,7 +37,7 @@ function setTestPluginEnabledState(newEnabledState, plugin) {
});
}
-add_task(function* setup() {
+add_task(function* () {
var tags = pluginHost.getPluginTags();
// Find the test plugin
@@ -50,12 +50,9 @@ add_task(function* setup() {
}
if (!pluginTag) {
ok(false, "Test Plug-in not available, can't run test");
- finish();
+ return;
}
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_ENABLED, pluginTag);
-});
-
-add_task(function* () {
yield BrowserTestUtils.openNewForegroundTab(gBrowser, testURL);
// Set data for the plugin after the page load.
@@ -87,5 +84,3 @@ add_task(function* () {
gBrowser.removeCurrentTab();
});
-
-
diff --git a/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js b/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js
index f6ace1e649..d2db95e6a3 100644
--- a/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js
+++ b/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js
@@ -257,7 +257,7 @@ function* test_history_cleared_with_direct_match()
do_check_false(yield promiseIsURIVisited(TEST_URI));
yield PlacesTestUtils.addVisits(TEST_URI);
do_check_true(yield promiseIsURIVisited(TEST_URI));
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
do_check_false(yield promiseIsURIVisited(TEST_URI));
}
@@ -267,7 +267,7 @@ function* test_history_cleared_with_subdomain()
do_check_false(yield promiseIsURIVisited(TEST_URI));
yield PlacesTestUtils.addVisits(TEST_URI);
do_check_true(yield promiseIsURIVisited(TEST_URI));
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
do_check_false(yield promiseIsURIVisited(TEST_URI));
}
@@ -277,7 +277,7 @@ function* test_history_not_cleared_with_uri_contains_domain()
do_check_false(yield promiseIsURIVisited(TEST_URI));
yield PlacesTestUtils.addVisits(TEST_URI);
do_check_true(yield promiseIsURIVisited(TEST_URI));
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
do_check_true(yield promiseIsURIVisited(TEST_URI));
// Clear history since we left something there from this test.
@@ -285,52 +285,52 @@ function* test_history_not_cleared_with_uri_contains_domain()
}
// Cookie Service
-function test_cookie_cleared_with_direct_match()
+function* test_cookie_cleared_with_direct_match()
{
const TEST_DOMAIN = "mozilla.org";
add_cookie(TEST_DOMAIN);
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
check_cookie_exists(TEST_DOMAIN, false);
}
-function test_cookie_cleared_with_subdomain()
+function* test_cookie_cleared_with_subdomain()
{
const TEST_DOMAIN = "www.mozilla.org";
add_cookie(TEST_DOMAIN);
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
check_cookie_exists(TEST_DOMAIN, false);
}
-function test_cookie_not_cleared_with_uri_contains_domain()
+function* test_cookie_not_cleared_with_uri_contains_domain()
{
const TEST_DOMAIN = "ilovemozilla.org";
add_cookie(TEST_DOMAIN);
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
check_cookie_exists(TEST_DOMAIN, true);
}
// Login Manager
-function test_login_manager_disabled_hosts_cleared_with_direct_match()
+function* test_login_manager_disabled_hosts_cleared_with_direct_match()
{
const TEST_HOST = "http://mozilla.org";
add_disabled_host(TEST_HOST);
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
check_disabled_host(TEST_HOST, false);
}
-function test_login_manager_disabled_hosts_cleared_with_subdomain()
+function* test_login_manager_disabled_hosts_cleared_with_subdomain()
{
const TEST_HOST = "http://www.mozilla.org";
add_disabled_host(TEST_HOST);
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
check_disabled_host(TEST_HOST, false);
}
-function test_login_manager_disabled_hosts_not_cleared_with_uri_contains_domain()
+function* test_login_manager_disabled_hosts_not_cleared_with_uri_contains_domain()
{
const TEST_HOST = "http://ilovemozilla.org";
add_disabled_host(TEST_HOST);
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
check_disabled_host(TEST_HOST, true);
// Reset state
@@ -340,27 +340,27 @@ function test_login_manager_disabled_hosts_not_cleared_with_uri_contains_domain(
check_disabled_host(TEST_HOST, false);
}
-function test_login_manager_logins_cleared_with_direct_match()
+function* test_login_manager_logins_cleared_with_direct_match()
{
const TEST_HOST = "http://mozilla.org";
add_login(TEST_HOST);
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
check_login_exists(TEST_HOST, false);
}
-function test_login_manager_logins_cleared_with_subdomain()
+function* test_login_manager_logins_cleared_with_subdomain()
{
const TEST_HOST = "http://www.mozilla.org";
add_login(TEST_HOST);
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
check_login_exists(TEST_HOST, false);
}
-function test_login_manager_logins_not_cleared_with_uri_contains_domain()
+function* test_login_manager_logins_not_cleared_with_uri_contains_domain()
{
const TEST_HOST = "http://ilovemozilla.org";
add_login(TEST_HOST);
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
check_login_exists(TEST_HOST, true);
let lm = Cc["@mozilla.org/login-manager;1"].
@@ -370,27 +370,27 @@ function test_login_manager_logins_not_cleared_with_uri_contains_domain()
}
// Permission Manager
-function test_permission_manager_cleared_with_direct_match()
+function* test_permission_manager_cleared_with_direct_match()
{
const TEST_URI = uri("http://mozilla.org");
add_permission(TEST_URI);
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
check_permission_exists(TEST_URI, false);
}
-function test_permission_manager_cleared_with_subdomain()
+function* test_permission_manager_cleared_with_subdomain()
{
const TEST_URI = uri("http://www.mozilla.org");
add_permission(TEST_URI);
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
check_permission_exists(TEST_URI, false);
}
-function test_permission_manager_not_cleared_with_uri_contains_domain()
+function* test_permission_manager_not_cleared_with_uri_contains_domain()
{
const TEST_URI = uri("http://ilovemozilla.org");
add_permission(TEST_URI);
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
check_permission_exists(TEST_URI, true);
// Reset state
@@ -427,7 +427,7 @@ function* test_content_preferences_cleared_with_direct_match()
do_check_false(yield preference_exists(TEST_URI));
yield add_preference(TEST_URI);
do_check_true(yield preference_exists(TEST_URI));
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
yield waitForPurgeNotification();
do_check_false(yield preference_exists(TEST_URI));
}
@@ -438,7 +438,7 @@ function* test_content_preferences_cleared_with_subdomain()
do_check_false(yield preference_exists(TEST_URI));
yield add_preference(TEST_URI);
do_check_true(yield preference_exists(TEST_URI));
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
yield waitForPurgeNotification();
do_check_false(yield preference_exists(TEST_URI));
}
@@ -449,12 +449,12 @@ function* test_content_preferences_not_cleared_with_uri_contains_domain()
do_check_false(yield preference_exists(TEST_URI));
yield add_preference(TEST_URI);
do_check_true(yield preference_exists(TEST_URI));
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
yield waitForPurgeNotification();
do_check_true(yield preference_exists(TEST_URI));
// Reset state
- ForgetAboutSite.removeDataFromDomain("ilovemozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("ilovemozilla.org");
yield waitForPurgeNotification();
do_check_false(yield preference_exists(TEST_URI));
}
@@ -535,7 +535,7 @@ function* test_push_cleared()
}
// Cache
-function test_cache_cleared()
+function* test_cache_cleared()
{
// Because this test is asynchronous, it should be the last test
do_check_true(tests[tests.length - 1] == arguments.callee);
@@ -557,7 +557,7 @@ function test_cache_cleared()
}
};
os.addObserver(observer, "cacheservice:empty-cache", false);
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
do_test_pending();
}
@@ -588,7 +588,7 @@ function* test_storage_cleared()
do_check_eq(storage.getItem("test"), "value" + i);
}
- ForgetAboutSite.removeDataFromDomain("mozilla.org");
+ yield ForgetAboutSite.removeDataFromDomain("mozilla.org");
yield waitForPurgeNotification();
do_check_eq(s[0].getItem("test"), null);
diff --git a/toolkit/jetpack/modules/system/Startup.js b/toolkit/jetpack/modules/system/Startup.js
index b9e5d88b3b..89eeac3bc0 100644
--- a/toolkit/jetpack/modules/system/Startup.js
+++ b/toolkit/jetpack/modules/system/Startup.js
@@ -15,6 +15,7 @@ const appStartupSrv = Cc["@mozilla.org/toolkit/app-startup;1"]
.getService(Ci.nsIAppStartup);
const NAME2TOPIC = {
+ 'Palemoon': 'sessionstore-windows-restored',
'Firefox': 'sessionstore-windows-restored',
'Fennec': 'sessionstore-windows-restored',
'SeaMonkey': 'sessionstore-windows-restored',
diff --git a/toolkit/jetpack/moz.build b/toolkit/jetpack/moz.build
index 2024e6a7c6..2e5dbe5e81 100644
--- a/toolkit/jetpack/moz.build
+++ b/toolkit/jetpack/moz.build
@@ -85,10 +85,18 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] != "gonk":
'sdk/ui/toolbar.js',
]
+ if CONFIG['MC_PALEMOON']:
+ EXTRA_JS_MODULES.commonjs.sdk.ui += [
+ 'sdk/ui/buttons.js',
+ ]
+
EXTRA_JS_MODULES.commonjs.sdk.ui.button += [
'sdk/ui/button/action.js',
'sdk/ui/button/contract.js',
'sdk/ui/button/toggle.js',
+ ]
+
+ EXTRA_PP_JS_MODULES.commonjs.sdk.ui.button += [
'sdk/ui/button/view.js',
]
@@ -120,9 +128,10 @@ EXTRA_JS_MODULES.commonjs += [
'test.js',
]
-EXTRA_JS_MODULES.commonjs.sdk += [
- 'sdk/webextension.js',
-]
+if CONFIG['MOZ_WEBEXTENSIONS']:
+ EXTRA_JS_MODULES.commonjs.sdk += [
+ 'sdk/webextension.js',
+ ]
EXTRA_JS_MODULES.commonjs.dev += [
'dev/debuggee.js',
@@ -211,13 +220,15 @@ EXTRA_JS_MODULES.commonjs.sdk += [
'sdk/tabs.js',
'sdk/test.js',
'sdk/timers.js',
- 'sdk/ui.js',
'sdk/url.js',
'sdk/windows.js',
]
+EXTRA_PP_JS_MODULES.commonjs.sdk += [
+ 'sdk/ui.js',
+]
+
EXTRA_JS_MODULES.commonjs.sdk.addon += [
- 'sdk/addon/bootstrap.js',
'sdk/addon/events.js',
'sdk/addon/host.js',
'sdk/addon/installer.js',
@@ -226,6 +237,10 @@ EXTRA_JS_MODULES.commonjs.sdk.addon += [
'sdk/addon/window.js',
]
+EXTRA_PP_JS_MODULES.commonjs.sdk.addon += [
+ 'sdk/addon/bootstrap.js',
+]
+
EXTRA_JS_MODULES.commonjs.sdk.browser += [
'sdk/browser/events.js',
]
diff --git a/toolkit/jetpack/sdk/addon/bootstrap.js b/toolkit/jetpack/sdk/addon/bootstrap.js
index 0397d91e51..6c5827f1eb 100644
--- a/toolkit/jetpack/sdk/addon/bootstrap.js
+++ b/toolkit/jetpack/sdk/addon/bootstrap.js
@@ -134,8 +134,10 @@ Bootstrap.prototype = {
const main = command === "test" ? "sdk/test/runner" : null;
const prefsURI = `${baseURI}defaults/preferences/prefs.js`;
+#ifdef MOZ_WEBEXTENSIONS
// Init the 'sdk/webextension' module from the bootstrap addon parameter.
require("sdk/webextension").initFromBootstrapAddonParam(addon);
+#endif
const { startup } = require("sdk/addon/runner");
startup(reason, {loader, main, prefsURI});
diff --git a/toolkit/jetpack/sdk/clipboard.js b/toolkit/jetpack/sdk/clipboard.js
index 048d5f2f13..c6b3c46fe9 100644
--- a/toolkit/jetpack/sdk/clipboard.js
+++ b/toolkit/jetpack/sdk/clipboard.js
@@ -8,6 +8,7 @@ module.metadata = {
"stability": "stable",
"engines": {
// TODO Fennec Support 789757
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*",
"Thunderbird": "*"
diff --git a/toolkit/jetpack/sdk/context-menu.js b/toolkit/jetpack/sdk/context-menu.js
index 004c642d4e..e00f41d790 100644
--- a/toolkit/jetpack/sdk/context-menu.js
+++ b/toolkit/jetpack/sdk/context-menu.js
@@ -7,6 +7,7 @@ module.metadata = {
"stability": "stable",
"engines": {
// TODO Fennec support Bug 788334
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/panel.js b/toolkit/jetpack/sdk/panel.js
index 4b625799d7..34cde2eddd 100644
--- a/toolkit/jetpack/sdk/panel.js
+++ b/toolkit/jetpack/sdk/panel.js
@@ -8,6 +8,7 @@
module.metadata = {
"stability": "stable",
"engines": {
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/places/bookmarks.js b/toolkit/jetpack/sdk/places/bookmarks.js
index c4f9528f19..e8fdae4f48 100644
--- a/toolkit/jetpack/sdk/places/bookmarks.js
+++ b/toolkit/jetpack/sdk/places/bookmarks.js
@@ -7,6 +7,7 @@
module.metadata = {
"stability": "unstable",
"engines": {
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/places/events.js b/toolkit/jetpack/sdk/places/events.js
index a3f95ee034..c5e7280399 100644
--- a/toolkit/jetpack/sdk/places/events.js
+++ b/toolkit/jetpack/sdk/places/events.js
@@ -7,6 +7,7 @@
module.metadata = {
'stability': 'experimental',
'engines': {
+ 'Palemoon': '*',
'Firefox': '*',
"SeaMonkey": '*'
}
diff --git a/toolkit/jetpack/sdk/places/favicon.js b/toolkit/jetpack/sdk/places/favicon.js
index 05b057db11..7a74aa5171 100644
--- a/toolkit/jetpack/sdk/places/favicon.js
+++ b/toolkit/jetpack/sdk/places/favicon.js
@@ -7,6 +7,7 @@
module.metadata = {
"stability": "unstable",
"engines": {
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/places/history.js b/toolkit/jetpack/sdk/places/history.js
index b243b024ca..f7fc3ed573 100644
--- a/toolkit/jetpack/sdk/places/history.js
+++ b/toolkit/jetpack/sdk/places/history.js
@@ -7,6 +7,7 @@
module.metadata = {
"stability": "unstable",
"engines": {
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/places/host/host-bookmarks.js b/toolkit/jetpack/sdk/places/host/host-bookmarks.js
index 3245c40702..f6dec40692 100644
--- a/toolkit/jetpack/sdk/places/host/host-bookmarks.js
+++ b/toolkit/jetpack/sdk/places/host/host-bookmarks.js
@@ -7,6 +7,7 @@
module.metadata = {
"stability": "experimental",
"engines": {
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/places/host/host-query.js b/toolkit/jetpack/sdk/places/host/host-query.js
index f2dbd6550c..a2cd4cd354 100644
--- a/toolkit/jetpack/sdk/places/host/host-query.js
+++ b/toolkit/jetpack/sdk/places/host/host-query.js
@@ -6,6 +6,7 @@
module.metadata = {
"stability": "experimental",
"engines": {
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/places/host/host-tags.js b/toolkit/jetpack/sdk/places/host/host-tags.js
index 929a5d5af0..b943425492 100644
--- a/toolkit/jetpack/sdk/places/host/host-tags.js
+++ b/toolkit/jetpack/sdk/places/host/host-tags.js
@@ -7,6 +7,7 @@
module.metadata = {
"stability": "experimental",
"engines": {
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/places/utils.js b/toolkit/jetpack/sdk/places/utils.js
index 44366d2aab..fe928c4ea8 100644
--- a/toolkit/jetpack/sdk/places/utils.js
+++ b/toolkit/jetpack/sdk/places/utils.js
@@ -7,6 +7,7 @@
module.metadata = {
"stability": "experimental",
"engines": {
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/selection.js b/toolkit/jetpack/sdk/selection.js
index 8682e8c6d7..e393aae061 100644
--- a/toolkit/jetpack/sdk/selection.js
+++ b/toolkit/jetpack/sdk/selection.js
@@ -7,6 +7,7 @@
module.metadata = {
"stability": "stable",
"engines": {
+ "Palemoon": "*",
"Firefox": "*",
"SeaMonkey": "*"
}
diff --git a/toolkit/jetpack/sdk/system/xul-app.jsm b/toolkit/jetpack/sdk/system/xul-app.jsm
index 90681bb1b0..ed760c3a48 100644
--- a/toolkit/jetpack/sdk/system/xul-app.jsm
+++ b/toolkit/jetpack/sdk/system/xul-app.jsm
@@ -41,6 +41,7 @@ var platformVersion = exports.platformVersion = appInfo.platformVersion;
// GUID.
var ids = exports.ids = {
+ Palemoon: "{8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4}",
Firefox: "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}",
Mozilla: "{86c18b42-e466-45a9-ae7a-9b95ba6f5640}",
SeaMonkey: "{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}",
diff --git a/toolkit/jetpack/sdk/ui.js b/toolkit/jetpack/sdk/ui.js
index 7f9110b266..d1ff7ceb84 100644
--- a/toolkit/jetpack/sdk/ui.js
+++ b/toolkit/jetpack/sdk/ui.js
@@ -6,12 +6,15 @@
module.metadata = {
'stability': 'experimental',
'engines': {
+ 'Palemoon': '> 27',
'Firefox': '> 28'
}
};
exports.ActionButton = require('./ui/button/action').ActionButton;
exports.ToggleButton = require('./ui/button/toggle').ToggleButton;
+#ifndef MC_PALEMOON
exports.Sidebar = require('./ui/sidebar').Sidebar;
exports.Frame = require('./ui/frame').Frame;
exports.Toolbar = require('./ui/toolbar').Toolbar;
+#endif
diff --git a/toolkit/jetpack/sdk/ui/button/action.js b/toolkit/jetpack/sdk/ui/button/action.js
index dfb092d0c3..5355705be0 100644
--- a/toolkit/jetpack/sdk/ui/button/action.js
+++ b/toolkit/jetpack/sdk/ui/button/action.js
@@ -6,6 +6,7 @@
module.metadata = {
'stability': 'experimental',
'engines': {
+ 'Palemoon': '> 27',
'Firefox': '> 28'
}
};
diff --git a/toolkit/jetpack/sdk/ui/button/toggle.js b/toolkit/jetpack/sdk/ui/button/toggle.js
index a226b32126..d8a3d1758e 100644
--- a/toolkit/jetpack/sdk/ui/button/toggle.js
+++ b/toolkit/jetpack/sdk/ui/button/toggle.js
@@ -6,6 +6,7 @@
module.metadata = {
'stability': 'experimental',
'engines': {
+ 'Palemoon': '> 27',
'Firefox': '> 28'
}
};
diff --git a/toolkit/jetpack/sdk/ui/button/view.js b/toolkit/jetpack/sdk/ui/button/view.js
index 63b7aea31b..dcc3be59dc 100644
--- a/toolkit/jetpack/sdk/ui/button/view.js
+++ b/toolkit/jetpack/sdk/ui/button/view.js
@@ -6,6 +6,7 @@
module.metadata = {
'stability': 'experimental',
'engines': {
+ 'Palemoon': '> 27',
'Firefox': '> 28'
}
};
@@ -19,14 +20,19 @@ const { isObject, isNil } = require('../../lang/type');
const { getMostRecentBrowserWindow } = require('../../window/utils');
const { ignoreWindow } = require('../../private-browsing/utils');
+#ifdef MC_PALEMOON
+const { buttons } = require('../buttons');
+#else
const { CustomizableUI } = Cu.import('resource:///modules/CustomizableUI.jsm', {});
const { AREA_PANEL, AREA_NAVBAR } = CustomizableUI;
+#endif
const { events: viewEvents } = require('./view/events');
const XUL_NS = 'http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul';
const views = new Map();
+#ifndef MC_PALEMOON
const customizedWindows = new WeakMap();
const buttonListener = {
@@ -64,19 +70,25 @@ CustomizableUI.addListener(buttonListener);
require('../../system/unload').when( _ =>
CustomizableUI.removeListener(buttonListener)
);
+#endif
function getNode(id, window) {
return !views.has(id) || ignoreWindow(window)
? null
+#ifdef MC_PALEMOON
+ : buttons.getNode(id, window);
+#else
: CustomizableUI.getWidget(id).forWindow(window).node
+#endif
};
+#ifndef MC_PALEMOON
function isInToolbar(id) {
let placement = CustomizableUI.getPlacementOfWidget(id);
return placement && CustomizableUI.getAreaType(placement.area) === 'toolbar';
}
-
+#endif
function getImage(icon, isInToolbar, pixelRatio) {
let targetSize = (isInToolbar ? 18 : 32) * pixelRatio;
@@ -109,7 +121,11 @@ function getImage(icon, isInToolbar, pixelRatio) {
}
function nodeFor(id, window=getMostRecentBrowserWindow()) {
+#ifdef MC_PALEMOON
+ return getNode(id, window);
+#else
return customizedWindows.has(window) ? null : getNode(id, window);
+#endif
};
exports.nodeFor = nodeFor;
@@ -119,14 +135,23 @@ function create(options) {
if (views.has(id))
throw new Error('The ID "' + id + '" seems already used.');
+#ifdef MC_PALEMOON
+ buttons.createButton({
+#else
CustomizableUI.createWidget({
+#endif
id: id,
type: 'custom',
+#ifdef MC_PALEMOON
+
+ onBuild: function(document, _id) {
+#else
removable: true,
defaultArea: AREA_NAVBAR,
allowedAreas: [ AREA_PANEL, AREA_NAVBAR ],
onBuild: function(document) {
+#endif
let window = document.defaultView;
let node = document.createElementNS(XUL_NS, 'toolbarbutton');
@@ -136,16 +161,26 @@ function create(options) {
if (ignoreWindow(window))
node.style.display = 'none';
+#ifdef MC_PALEMOON
+ node.setAttribute('id', _id);
+#else
node.setAttribute('id', this.id);
+#endif
node.setAttribute('class', 'toolbarbutton-1 chromeclass-toolbar-additional badged-button');
node.setAttribute('type', type);
node.setAttribute('label', label);
node.setAttribute('tooltiptext', label);
node.setAttribute('image', image);
+#ifdef MC_PALEMOON
+ node.setAttribute('pmkit-button', 'true');
+#else
node.setAttribute('constrain-size', 'true');
+#endif
views.set(id, {
+#ifndef MC_PALEMOON
area: this.currentArea,
+#endif
icon: icon,
label: label
});
@@ -171,7 +206,11 @@ function dispose(id) {
if (!views.has(id)) return;
views.delete(id);
+#ifdef MC_PALEMOON
+ buttons.destroyButton(id);
+#else
CustomizableUI.destroyWidget(id);
+#endif
}
exports.dispose = dispose;
@@ -179,8 +218,12 @@ function setIcon(id, window, icon) {
let node = getNode(id, window);
if (node) {
+#ifdef MC_PALEMOON
+ let image = getImage(icon, true, window.devicePixelRatio);
+#else
icon = customizedWindows.has(window) ? views.get(id).icon : icon;
let image = getImage(icon, isInToolbar(id), window.devicePixelRatio);
+#endif
node.setAttribute('image', image);
}
diff --git a/toolkit/jetpack/sdk/ui/button/view/events.js b/toolkit/jetpack/sdk/ui/button/view/events.js
index 98909656a6..34d14be3ab 100644
--- a/toolkit/jetpack/sdk/ui/button/view/events.js
+++ b/toolkit/jetpack/sdk/ui/button/view/events.js
@@ -7,6 +7,7 @@
module.metadata = {
'stability': 'experimental',
'engines': {
+ 'Palemoon': '*',
'Firefox': '*',
'SeaMonkey': '*',
'Thunderbird': '*'
diff --git a/toolkit/jetpack/sdk/ui/buttons.js b/toolkit/jetpack/sdk/ui/buttons.js
new file mode 100644
index 0000000000..66e0fd742d
--- /dev/null
+++ b/toolkit/jetpack/sdk/ui/buttons.js
@@ -0,0 +1,198 @@
+/* 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/.
+ * PMkit shim for 'sdk/ui/button', (c) JustOff, 2017 */
+"use strict";
+
+module.metadata = {
+ "stability": "experimental",
+ "engines": {
+ "Palemoon": "> 27"
+ }
+};
+
+const { Ci, Cc } = require('chrome');
+const prefs = require('../preferences/service');
+
+const buttonsList = new Map();
+const LOCATION_PREF_ROOT = "extensions.sdk-button-location.";
+
+let gWindowListener;
+
+function getLocation(id) {
+ let toolbarId = "nav-bar", nextItemId = "";
+ let location = prefs.get(LOCATION_PREF_ROOT + id);
+ if (location && location.indexOf(",") !== -1) {
+ [toolbarId, nextItemId] = location.split(",");
+ }
+ return [toolbarId, nextItemId];
+}
+
+function saveLocation(id, toolbarId, nextItemId) {
+ let _toolbarId = toolbarId || "";
+ let _nextItemId = nextItemId || "";
+ prefs.set(LOCATION_PREF_ROOT + id, [_toolbarId, _nextItemId].join(","));
+}
+
+// Insert button into window
+function insertButton(aWindow, id, onBuild) {
+ // Build button and save reference to it
+ let doc = aWindow.document;
+ let b = onBuild(doc, id);
+ aWindow[id] = b;
+
+ // Add to the customization palette
+ let toolbox = doc.getElementById("navigator-toolbox");
+ toolbox.palette.appendChild(b);
+
+ // Retrieve button location from preferences
+ let [toolbarId, nextItemId] = getLocation(id);
+ let toolbar = toolbarId != "" && doc.getElementById(toolbarId);
+
+ if (toolbar) {
+ let nextItem = doc.getElementById(nextItemId);
+ // If nextItem not in toolbar then retrieve it by reading currentset attribute
+ if (!(nextItem && nextItem.parentNode && nextItem.parentNode.id == toolbarId)) {
+ nextItem = null;
+ let currentSet = toolbar.getAttribute("currentset");
+ let ids = (currentSet == "__empty") ? [] : currentSet.split(",");
+ let idx = ids.indexOf(id);
+ if (idx != -1) {
+ for (let i = idx; i < ids.length; i++) {
+ nextItem = doc.getElementById(ids[i]);
+ if (nextItem)
+ break;
+ }
+ }
+ }
+ // Finally insert button in the right toolbar and in the right position
+ toolbar.insertItem(id, nextItem, null, false);
+ }
+}
+
+// Remove button from window
+function removeButton(aWindow, id) {
+ let b = aWindow[id];
+ b.parentNode.removeChild(b);
+ delete aWindow[id];
+}
+
+// Save locations of buttons after customization
+function afterCustomize(e) {
+ for (let [id] of buttonsList) {
+ let toolbox = e.target;
+ let b = toolbox.parentNode.querySelector("#" + id);
+ let toolbarId = null, nextItemId = null;
+ if (b) {
+ let parent = b.parentNode;
+ let nextItem = b.nextSibling;
+ if (parent && parent.localName == "toolbar") {
+ toolbarId = parent.id;
+ nextItemId = nextItem && nextItem.id;
+ }
+ }
+ saveLocation(id, toolbarId, nextItemId);
+ }
+}
+
+// Global window observer
+function browserWindowObserver(handlers) {
+ this.handlers = handlers;
+}
+
+browserWindowObserver.prototype = {
+ observe: function(aSubject, aTopic, aData) {
+ if (aTopic == "domwindowopened") {
+ aSubject.QueryInterface(Ci.nsIDOMWindow).addEventListener("load", this, false);
+ } else if (aTopic == "domwindowclosed") {
+ if (aSubject.document.documentElement.getAttribute("windowtype") == "navigator:browser") {
+ this.handlers.onShutdown(aSubject);
+ }
+ }
+ },
+
+ handleEvent: function(aEvent) {
+ let aWindow = aEvent.currentTarget;
+ aWindow.removeEventListener(aEvent.type, this, false);
+
+ if (aWindow.document.documentElement.getAttribute("windowtype") == "navigator:browser") {
+ this.handlers.onStartup(aWindow);
+ }
+ }
+};
+
+// Run on every window startup
+function browserWindowStartup(aWindow) {
+ for (let [id, onBuild] of buttonsList) {
+ insertButton(aWindow, id, onBuild);
+ }
+ aWindow.addEventListener("aftercustomization", afterCustomize, false);
+};
+
+// Run on every window shutdown
+function browserWindowShutdown(aWindow) {
+ for (let [id, onBuild] of buttonsList) {
+ removeButton(aWindow, id);
+ }
+ aWindow.removeEventListener("aftercustomization", afterCustomize, false);
+}
+
+// Main object
+const buttons = {
+ createButton: function(aProperties) {
+ // If no buttons were inserted yet, setup global window observer
+ if (buttonsList.size == 0) {
+ let ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].getService(Ci.nsIWindowWatcher);
+ gWindowListener = new browserWindowObserver({
+ onStartup: browserWindowStartup,
+ onShutdown: browserWindowShutdown
+ });
+ ww.registerNotification(gWindowListener);
+ }
+
+ // Add button to list
+ buttonsList.set(aProperties.id, aProperties.onBuild);
+
+ // Inster button to all open windows
+ let wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
+ let winenu = wm.getEnumerator("navigator:browser");
+ while (winenu.hasMoreElements()) {
+ let win = winenu.getNext();
+ insertButton(win, aProperties.id, aProperties.onBuild);
+ // When first button inserted, add afterCustomize listener
+ if (buttonsList.size == 1) {
+ win.addEventListener("aftercustomization", afterCustomize, false);
+ }
+ }
+ },
+
+ destroyButton: function(id) {
+ // Remove button from list
+ buttonsList.delete(id);
+
+ // If no more buttons exist, remove global window observer
+ if (buttonsList.size == 0) {
+ let ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].getService(Ci.nsIWindowWatcher);
+ ww.unregisterNotification(gWindowListener);
+ gWindowListener = null;
+ }
+
+ // Remove button from all open windows
+ let wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
+ let winenu = wm.getEnumerator("navigator:browser");
+ while (winenu.hasMoreElements()) {
+ let win = winenu.getNext();
+ removeButton(win, id);
+ // If no more buttons exist, remove afterCustomize listener
+ if (buttonsList.size == 0) {
+ win.removeEventListener("aftercustomization", afterCustomize, false);
+ }
+ }
+ },
+
+ getNode: function(id, window) {
+ return window[id];
+ }
+};
+
+exports.buttons = buttons;
diff --git a/toolkit/jetpack/sdk/ui/state.js b/toolkit/jetpack/sdk/ui/state.js
index 152ce696d7..c90d4283da 100644
--- a/toolkit/jetpack/sdk/ui/state.js
+++ b/toolkit/jetpack/sdk/ui/state.js
@@ -8,6 +8,7 @@
module.metadata = {
'stability': 'experimental',
'engines': {
+ 'Palemoon': '*',
'Firefox': '*',
'SeaMonkey': '*',
'Thunderbird': '*'
diff --git a/toolkit/jetpack/sdk/ui/state/events.js b/toolkit/jetpack/sdk/ui/state/events.js
index 98909656a6..34d14be3ab 100644
--- a/toolkit/jetpack/sdk/ui/state/events.js
+++ b/toolkit/jetpack/sdk/ui/state/events.js
@@ -7,6 +7,7 @@
module.metadata = {
'stability': 'experimental',
'engines': {
+ 'Palemoon': '*',
'Firefox': '*',
'SeaMonkey': '*',
'Thunderbird': '*'
diff --git a/toolkit/locales/Makefile.in b/toolkit/locales/Makefile.in
index e201286110..189e0b1b0e 100644
--- a/toolkit/locales/Makefile.in
+++ b/toolkit/locales/Makefile.in
@@ -30,11 +30,3 @@ chrome-%:
libs:: update.locale
sed -e 's/%AB_CD%/$(AB_CD)/' $< > $(FINAL_TARGET)/update.locale
-ifdef MOZ_CRASHREPORTER
-libs:: crashreporter.ini
-ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
- $(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)/crashreporter.app/Contents/Resources
-else
- $(SYSINSTALL) $(IFLAGS1) $^ $(FINAL_TARGET)
-endif
-endif
diff --git a/toolkit/locales/en-US/chrome/global/about.dtd b/toolkit/locales/en-US/chrome/global/about.dtd
index 6df6857476..85c1a6d252 100644
--- a/toolkit/locales/en-US/chrome/global/about.dtd
+++ b/toolkit/locales/en-US/chrome/global/about.dtd
@@ -1,13 +1,13 @@
<!-- This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
-<!ENTITY about.version "version">
+<!ENTITY about.version "Version">
<!-- LOCALIZATION NOTE (about.credits.beforeLink): note that there is no space between this phrase and the linked about.credits.linkTitle phrase, so if your locale needs a space between words, add it at the end of this entity. -->
<!ENTITY about.credits.beforeLink "See a list of ">
<!ENTITY about.credits.linkTitle "contributors">
<!-- LOCALIZATION NOTE (about.credits.afterLink): note that there is no space between the linked about.credits.linkTitle phrase and this phrase, so if your locale needs a space between words, add it at the start of this entity. -->
-<!ENTITY about.credits.afterLink " to the Mozilla Project.">
+<!ENTITY about.credits.afterLink " to the project.">
<!-- LOCALIZATION NOTE (about.license.beforeTheLink): note that there is no space between this phrase and the linked about.license.linkTitle phrase, so if your locale needs a space between words, add it at the end of this entity. -->
<!ENTITY about.license.beforeTheLink "Read the ">
@@ -27,4 +27,5 @@
<!-- LOCALIZATION NOTE (about.buildconfig.afterTheLink): note that there is no space between the linked about.buildconfig.linkTitle phrase and this phrase, so if your locale needs a space between words, add it at the start of this entity. -->
<!ENTITY about.buildconfig.afterTheLink " used for this version.">
-<!ENTITY about.buildIdentifier "Build identifier: ">
+<!ENTITY about.buildIdentifier "Build identifier:">
+<!ENTITY about.userAgent "User-agent:">
diff --git a/toolkit/locales/en-US/chrome/global/aboutRights.dtd b/toolkit/locales/en-US/chrome/global/aboutRights.dtd
index 319984d41f..28b24e1d82 100644
--- a/toolkit/locales/en-US/chrome/global/aboutRights.dtd
+++ b/toolkit/locales/en-US/chrome/global/aboutRights.dtd
@@ -19,12 +19,12 @@
<!ENTITY rights.intro-point1b "Mozilla Public License">
<!ENTITY rights.intro-point1c ". This means you may use, copy and distribute &brandShortName; to others. You are also welcome to modify the source code of &brandShortName; as you want to meet your needs. The Mozilla Public License also gives you the right to distribute your modified versions.">
-<!ENTITY rights.intro-point2-a "You are not granted any trademark rights or licenses to the trademarks of the Mozilla Foundation or any party, including without limitation the Firefox name or logo. Additional information on trademarks may be found ">
+<!ENTITY rights.intro-point2-a "You are not granted any trademark rights or licenses to the trademarks of Moonchild Productions or any other party, including without limitation the Basilisk and Pale Moon names or logos. Additional information on trademarks may be found ">
<!ENTITY rights.intro-point2-b "here">
<!ENTITY rights.intro-point2-c ".">
<!-- point 2.5 text for official branded builds -->
-<!ENTITY rights.intro-point2.5 "Some features in &brandShortName;, such as the Crash Reporter, give you the option to provide feedback to &vendorShortName;. By choosing to submit feedback, you give &vendorShortName; permission to use the feedback to improve its products, to publish the feedback on its websites, and to distribute the feedback.">
+<!ENTITY rights.intro-point2.5 "Some features in &brandShortName; give you the option to provide feedback to the publishers of this software. By choosing to submit feedback, you give the publishers in question permission to use the feedback to improve their products, to publish the feedback on their websites, and to distribute the feedback.">
<!-- point 3 text for official branded builds -->
<!ENTITY rights2.intro-point3a "How we use your personal information and feedback submitted to &vendorShortName; through &brandShortName; is described in the ">
@@ -47,7 +47,7 @@
<!ENTITY rights2.webservices-header "&brandFullName; Web-Based Information Services">
<!-- point 5 -->
-<!ENTITY rights.intro-point5 "In order to play back certain types of video content, &brandShortName; downloads certain content decryption modules from third parties.">
+<!ENTITY rights.intro-point5 "In order to play back certain types of video content, &brandShortName; may download certain content decryption modules from third parties, if playback of DRM content is enabled or available.">
<!-- Note that this paragraph references a couple of entities from
preferences/security.dtd, so that we can refer to text the user sees in
@@ -59,6 +59,8 @@
<!ENTITY rights3.webservices-c ". Other features and Services can be disabled in the application preferences.">
<!-- safe browsing points for branded builds -->
+<!-- Google SafeBrowsing requires an API key; this should always remain disabled unless
+ an API key is obtained. Official builds do not use SafeBrowsing. -->
<!ENTITY rights.safebrowsing-a "SafeBrowsing: ">
<!ENTITY rights.safebrowsing-b "Disabling the Safe Browsing feature is not recommended as it may result in you going to unsafe sites. If you wish to disable the feature completely, follow these steps:">
<!ENTITY rights.safebrowsing-term1 "Open the application preferences">
@@ -67,6 +69,7 @@
<!ENTITY rights.safebrowsing-term4 "Safe Browsing is now disabled">
<!-- location aware browsing points for branded builds -->
+<!-- Official builds use IP-API.com -->
<!ENTITY rights.locationawarebrowsing-a "Location Aware Browsing: ">
<!ENTITY rights.locationawarebrowsing-b "is always opt-in. No location information is ever sent without your permission. If you wish to disable the feature completely, follow these steps:">
<!ENTITY rights.locationawarebrowsing-term1a "In the URL bar, type ">
@@ -82,10 +85,10 @@
<!ENTITY rights.webservices-term1-unbranded "Any applicable service terms for this product should be listed here.">
<!-- points 1-7 text for branded builds -->
-<!ENTITY rights2.webservices-term1 "&vendorShortName; and its contributors, licensors and partners work to provide the most accurate and up-to-date Services. However, we cannot guarantee that this information is comprehensive and error-free. For example, the Safe Browsing Service may not identify some risky sites and may identify some safe sites in error and the Location Aware Service all locations returned by our service providers are estimates only and neither we nor our service providers guarantee the accuracy of the locations provided.">
+<!ENTITY rights2.webservices-term1 "&vendorShortName; and its contributors, licensors and partners work to provide the most accurate and up-to-date Services. However, we cannot guarantee that this information is comprehensive and error-free. For example, for the Location Aware Service all locations returned by our service provider are estimates only and neither we nor our service provider guarantee the accuracy of the locations provided.">
<!ENTITY rights.webservices-term2 "&vendorShortName; may discontinue or change the Services at its discretion.">
-<!ENTITY rights2.webservices-term3 "You are welcome to use these Services with the accompanying version of &brandShortName;, and &vendorShortName; grants you its rights to do so. &vendorShortName; and its licensors reserve all other rights in the Services. These terms are not intended to limit any rights granted under open source licenses applicable to &brandShortName; and to corresponding source code versions of &brandShortName;.">
-<!ENTITY rights.webservices-term4 "The Services are provided &quot;as-is.&quot; &vendorShortName;, its contributors, licensors, and distributors, disclaim all warranties, whether express or implied, including without limitation, warranties that the Services are merchantable and fit for your particular purposes. You bear the entire risk as to selecting the Services for your purposes and as to the quality and performance of the Services. Some jurisdictions do not allow the exclusion or limitation of implied warranties, so this disclaimer may not apply to you.">
-<!ENTITY rights.webservices-term5 "Except as required by law, &vendorShortName;, its contributors, licensors, and distributors will not be liable for any indirect, special, incidental, consequential, punitive, or exemplary damages arising out of or in any way relating to the use of &brandShortName; and the Services. The collective liability under these terms will not exceed $500 (five hundred dollars). Some jurisdictions do not allow the exclusion or limitation of certain damages, so this exclusion and limitation may not apply to you.">
+<!ENTITY rights2.webservices-term3 "You are welcome to use these Services with the accompanying version of &brandShortName;, and &vendorShortName; grants you its rights to do so. &vendorShortName; and its licensors reserve all other rights in the Services. These terms are not intended to limit any rights granted under open source licenses applicable to &brandShortName; and to corresponding source code versions of &brandShortName;, however these (optional) services are provided asa convenience to you, and in no way extend your software rights to the Services.">
+<!ENTITY rights.webservices-term4 "The Services are provided &quot;as-is&quot; and &quot;as-available&quot;. &vendorShortName;, its contributors, licensors and distributors disclaim all warranties, whether express or implied, including without limitation warranties that the Services are merchantable and fit for your particular purposes. You bear the entire risk as to selecting the Services for your purposes and as to the quality and performance of the Services. If your jurisdiction does not allow disclaiming of warranties, then you should not use &brandShortName; or Services.">
+<!ENTITY rights.webservices-term5 "Except as required by law, &vendorShortName;, its contributors, licensors, and distributors will not be liable for any indirect, special, incidental, consequential, punitive, or exemplary damages arising out of or in any way relating to the use of &brandShortName; and the Services. The collective liability under these terms will not exceed $500 (five hundred dollars). If your jurisdiction does not allow the exclusion or limitation of damages, then you should not use &brandShortName; or Services.">
<!ENTITY rights.webservices-term6 "&vendorShortName; may update these terms as necessary from time to time. These terms may not be modified or canceled without &vendorShortName;'s written agreement.">
-<!ENTITY rights.webservices-term7 "These terms are governed by the laws of the state of California, U.S.A., excluding its conflict of law provisions. If any portion of these terms is held to be invalid or unenforceable, the remaining portions will remain in full force and effect. In the event of a conflict between a translated version of these terms and the English language version, the English language version shall control.">
+<!ENTITY rights.webservices-term7 "These terms are governed by the laws of Sweden, excluding any conflict of law provisions. If any portion of these terms is held to be invalid or unenforceable, the remaining portions will remain in full force and effect. In the event of a conflict between a translated version of these terms and the English language version, the English language version shall take precedence.">
diff --git a/toolkit/locales/en-US/chrome/global/autocomplete.properties b/toolkit/locales/en-US/chrome/global/autocomplete.properties
index 5c7c84b96a..44da643ac0 100644
--- a/toolkit/locales/en-US/chrome/global/autocomplete.properties
+++ b/toolkit/locales/en-US/chrome/global/autocomplete.properties
@@ -1,6 +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/.
+switchToTab = Switch to tab
+
+# LOCALIZATION NOTE (visitURL):
+# %S is the URL to visit.
+visitURL = Visit %S
# LOCALIZATION NOTE (searchWithEngine): %S will be replaced with
# the search engine provider's name. This format was chosen because
diff --git a/toolkit/locales/en-US/chrome/global/customizeToolbar.properties b/toolkit/locales/en-US/chrome/global/customizeToolbar.properties
index 0ec6d2c1db..b19152fab7 100644
--- a/toolkit/locales/en-US/chrome/global/customizeToolbar.properties
+++ b/toolkit/locales/en-US/chrome/global/customizeToolbar.properties
@@ -5,6 +5,7 @@
enterToolbarTitle=New Toolbar
enterToolbarName=Enter a name for this toolbar:
enterToolbarDup=There is already a toolbar with the name “%S”. Please enter a different name.
+enterToolbarIllegalChars=The name contains illegal character "|". Please enter a different name.
enterToolbarBlank=You must enter a name to create a new toolbar.
separatorTitle=Separator
springTitle=Flexible Space
diff --git a/toolkit/locales/en-US/chrome/global/datetimebox.dtd b/toolkit/locales/en-US/chrome/global/datetimebox.dtd
new file mode 100644
index 0000000000..0deffa6b31
--- /dev/null
+++ b/toolkit/locales/en-US/chrome/global/datetimebox.dtd
@@ -0,0 +1,9 @@
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+
+<!-- Placeholders for input type=date -->
+
+<!ENTITY date.year.placeholder "yyyy">
+<!ENTITY date.month.placeholder "mm">
+<!ENTITY date.day.placeholder "dd">
diff --git a/toolkit/locales/en-US/chrome/global/findbar.dtd b/toolkit/locales/en-US/chrome/global/findbar.dtd
index ad77130bca..a90c77c7ec 100644
--- a/toolkit/locales/en-US/chrome/global/findbar.dtd
+++ b/toolkit/locales/en-US/chrome/global/findbar.dtd
@@ -5,7 +5,11 @@
<!-- LOCALIZATION NOTE : FILE This file contains the entities needed to -->
<!-- LOCALIZATION NOTE : FILE use the Find Bar. -->
+<!ENTITY next.label "Next">
+<!ENTITY next.accesskey "N">
<!ENTITY next.tooltip "Find the next occurrence of the phrase">
+<!ENTITY previous.label "Previous">
+<!ENTITY previous.accesskey "P">
<!ENTITY previous.tooltip "Find the previous occurrence of the phrase">
<!ENTITY findCloseButton.tooltip "Close find bar">
<!ENTITY highlightAll.label "Highlight All">
diff --git a/toolkit/locales/en-US/chrome/mozapps/preferences/changemp.dtd b/toolkit/locales/en-US/chrome/mozapps/preferences/changemp.dtd
index 1cc7b9621e..1b1d5ac55b 100644
--- a/toolkit/locales/en-US/chrome/mozapps/preferences/changemp.dtd
+++ b/toolkit/locales/en-US/chrome/mozapps/preferences/changemp.dtd
@@ -9,5 +9,5 @@
<!ENTITY setPassword.reenterPassword.label "Re-enter password:">
<!ENTITY setPassword.meter.label "Password quality meter">
<!ENTITY setPassword.meter.loading "Loading">
-<!ENTITY masterPasswordDescription.label "A Master Password is used to protect sensitive information like site passwords. If you create a Master Password you will be asked to enter it once per session when &brandShortName; retrieves saved information protected by the password.">
+<!ENTITY masterPasswordDescription.label "A Master Password is used to protect sensitive information like site passwords. If you create a Master Password you will be asked to enter it once per session when &brandShortName; retrieves saved information protected by the password. A master password must be 8 characters or longer; longer is better.">
<!ENTITY masterPasswordWarning.label "Please make sure you remember the Master Password you have set. If you forget your Master Password, you will be unable to access any of the information protected by it.">
diff --git a/toolkit/locales/en-US/chrome/passwordmgr/passwordManager.dtd b/toolkit/locales/en-US/chrome/passwordmgr/passwordManager.dtd
index 36a61cfd9a..84e4ff69c4 100644
--- a/toolkit/locales/en-US/chrome/passwordmgr/passwordManager.dtd
+++ b/toolkit/locales/en-US/chrome/passwordmgr/passwordManager.dtd
@@ -17,8 +17,6 @@
<!ENTITY remove.label "Remove">
<!ENTITY remove.accesskey "R">
-<!ENTITY removeall.label "Remove All">
-<!ENTITY removeall.accesskey "A">
<!ENTITY addLogin.label "Add Login">
<!ENTITY addLogin.accesskey "L">
diff --git a/toolkit/locales/en-US/chrome/passwordmgr/passwordmgr.properties b/toolkit/locales/en-US/chrome/passwordmgr/passwordmgr.properties
index 96190a2d76..6a399bbfce 100644
--- a/toolkit/locales/en-US/chrome/passwordmgr/passwordmgr.properties
+++ b/toolkit/locales/en-US/chrome/passwordmgr/passwordmgr.properties
@@ -68,3 +68,14 @@ duplicateLogin=A duplicate login already exists.
insecureFieldWarningDescription = This connection is not secure. Logins entered here could be compromised.
insecureFieldWarningLearnMore = Learn More
+
+# LOCALIZATION NOTE (removeAll, removeAllShown):
+# removeAll and removeAllShown are both used on the same one button,
+# never displayed together and can share the same accesskey.
+# When only partial sites are shown as a result of keyword search,
+# removeAllShown is displayed as button label.
+# removeAll is displayed when no keyword search and all sites are shown.
+removeAll.label=Remove All
+removeAll.accesskey=A
+removeAllShown.label=Remove All Shown
+removeAllShown.accesskey=A
diff --git a/toolkit/locales/en-US/chrome/places/places.properties b/toolkit/locales/en-US/chrome/places/places.properties
index f9edeeff07..5c01341804 100644
--- a/toolkit/locales/en-US/chrome/places/places.properties
+++ b/toolkit/locales/en-US/chrome/places/places.properties
@@ -4,6 +4,7 @@
BookmarksMenuFolderTitle=Bookmarks Menu
BookmarksToolbarFolderTitle=Bookmarks Toolbar
+UnsortedBookmarksFolderTitle=Unsorted Bookmarks
OtherBookmarksFolderTitle=Other Bookmarks
TagsFolderTitle=Tags
MobileBookmarksFolderTitle=Mobile Bookmarks
diff --git a/toolkit/locales/jar.mn b/toolkit/locales/jar.mn
index e49e978f51..abc96086f5 100644
--- a/toolkit/locales/jar.mn
+++ b/toolkit/locales/jar.mn
@@ -39,6 +39,7 @@
locale/@AB_CD@/global/customizeToolbar.dtd (%chrome/global/customizeToolbar.dtd)
locale/@AB_CD@/global/customizeToolbar.properties (%chrome/global/customizeToolbar.properties)
#endif
+ locale/@AB_CD@/global/datetimebox.dtd (%chrome/global/datetimebox.dtd)
locale/@AB_CD@/global/datetimepicker.dtd (%chrome/global/datetimepicker.dtd)
locale/@AB_CD@/global/dateFormat.properties (%chrome/global/dateFormat.properties)
locale/@AB_CD@/global/dialogOverlay.dtd (%chrome/global/dialogOverlay.dtd)
diff --git a/toolkit/locales/l10n.mk b/toolkit/locales/l10n.mk
index 34d78d33c9..05bda0b564 100644
--- a/toolkit/locales/l10n.mk
+++ b/toolkit/locales/l10n.mk
@@ -120,14 +120,6 @@ ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
ifneq (en,$(LPROJ_ROOT))
mv $(STAGEDIST)/en.lproj $(STAGEDIST)/$(LPROJ_ROOT).lproj
endif
-ifdef MOZ_CRASHREPORTER
-# On Mac OS X, the crashreporter.ini file needs to be moved from under the
-# application bundle's Resources directory where all other l10n files are
-# located to the crash reporter bundle's Resources directory.
- mv $(STAGEDIST)/crashreporter.app/Contents/Resources/crashreporter.ini \
- $(STAGEDIST)/../MacOS/crashreporter.app/Contents/Resources/crashreporter.ini
- $(RM) -rf $(STAGEDIST)/crashreporter.app
-endif
endif
$(NSINSTALL) -D $(DIST)/l10n-stage/$(PKG_PATH)
diff --git a/toolkit/modules/AppConstants.jsm b/toolkit/modules/AppConstants.jsm
index ba5d82c015..2b18f3c1aa 100644
--- a/toolkit/modules/AppConstants.jsm
+++ b/toolkit/modules/AppConstants.jsm
@@ -36,11 +36,18 @@ this.AppConstants = Object.freeze({
false,
#endif
- // Official corresponds, roughly, to whether this build is performed
- // on Mozilla's continuous integration infrastructure. You should
+ // Official corresponds to whether this build is considered an
+ // official, branded release for the public. You should
// disable developer-only functionality when this flag is set.
+ // MOZILLA_OFFICIAL is deprecated but kept for extension compatibility.
MOZILLA_OFFICIAL:
-#ifdef MOZILLA_OFFICIAL
+#ifdef MC_OFFICIAL
+ true,
+#else
+ false,
+#endif
+ MC_OFFICIAL:
+#ifdef MC_OFFICIAL
true,
#else
false,
@@ -183,13 +190,6 @@ this.AppConstants = Object.freeze({
Services.vc.compare(platformVersion, version) <= 0;
},
- MOZ_CRASHREPORTER:
-#ifdef MOZ_CRASHREPORTER
- true,
-#else
- false,
-#endif
-
MOZ_VERIFY_MAR_SIGNATURE:
#ifdef MOZ_VERIFY_MAR_SIGNATURE
true,
diff --git a/toolkit/modules/DateTimePickerHelper.jsm b/toolkit/modules/DateTimePickerHelper.jsm
index 3986879886..b509742b0d 100644
--- a/toolkit/modules/DateTimePickerHelper.jsm
+++ b/toolkit/modules/DateTimePickerHelper.jsm
@@ -21,6 +21,7 @@ this.EXPORTED_SYMBOLS = [
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
+Cu.import("resource://gre/modules/Task.jsm");
/*
* DateTimePickerHelper receives message from content side (input box) and
@@ -63,9 +64,13 @@ this.DateTimePickerHelper = {
return;
}
this.picker.closePicker();
+ this.close();
break;
}
case "FormDateTime:UpdatePicker": {
+ if (!this.picker) {
+ return;
+ }
this.picker.setPopupValue(aMessage.data);
break;
}
@@ -87,6 +92,7 @@ this.DateTimePickerHelper = {
if (browser) {
browser.messageManager.sendAsyncMessage("FormDateTime:PickerClosed");
}
+ this.picker.closePicker();
this.close();
break;
}
@@ -97,18 +103,15 @@ this.DateTimePickerHelper = {
// Called when picker value has changed, notify input box about it.
updateInputBoxValue: function(aEvent) {
- // TODO: parse data based on input type.
- const { hour, minute } = aEvent.detail;
- debug("hour: " + hour + ", minute: " + minute);
let browser = this.weakBrowser ? this.weakBrowser.get() : null;
if (browser) {
browser.messageManager.sendAsyncMessage(
- "FormDateTime:PickerValueChanged", { hour, minute });
+ "FormDateTime:PickerValueChanged", aEvent.detail);
}
},
// Get picker from browser and show it anchored to the input box.
- showPicker: function(aBrowser, aData) {
+ showPicker: Task.async(function* (aBrowser, aData) {
let rect = aData.rect;
let dir = aData.dir;
let type = aData.type;
@@ -138,13 +141,23 @@ this.DateTimePickerHelper = {
debug("aBrowser.dateTimePicker not found, exiting now.");
return;
}
- this.picker.loadPicker(type, detail);
+ // The datetimepopup binding is only attached when it is needed.
+ // Check if openPicker method is present to determine if binding has
+ // been attached. If not, attach the binding first before calling it.
+ if (!this.picker.openPicker) {
+ let bindingPromise = new Promise(resolve => {
+ this.picker.addEventListener("DateTimePickerBindingReady",
+ resolve, {once: true});
+ });
+ this.picker.setAttribute("active", true);
+ yield bindingPromise;
+ }
// The arrow panel needs an anchor to work. The popupAnchor (this._anchor)
// is a transparent div that the arrow can point to.
- this.picker.openPopup(this._anchor, "after_start", rect.left, rect.top);
+ this.picker.openPicker(type, this._anchor, detail);
this.addPickerListeners();
- },
+ }),
// Picker is closed, do some cleanup.
close: function() {
diff --git a/toolkit/modules/ResetProfile.jsm b/toolkit/modules/ResetProfile.jsm
index fe0d1cfe8e..c1839af4ff 100644
--- a/toolkit/modules/ResetProfile.jsm
+++ b/toolkit/modules/ResetProfile.jsm
@@ -11,7 +11,11 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/AppConstants.jsm");
-const MOZ_APP_NAME = AppConstants.MOZ_APP_NAME;
+// For Basilisk and Pale Moon
+// Hard-code MOZ_APP_NAME to firefox because of hard-coded type in migrator.
+const MOZ_APP_NAME = (((AppConstants.MOZ_APP_NAME == "basilisk")
+ || (AppConstants.MOZ_APP_NAME == "palemoon"))
+ ? "firefox" : AppConstants.MOZ_APP_NAME);
const MOZ_BUILD_APP = AppConstants.MOZ_BUILD_APP;
this.ResetProfile = {
diff --git a/toolkit/modules/Services.jsm b/toolkit/modules/Services.jsm
index 1bf1a89fe1..58d87ffb1b 100644
--- a/toolkit/modules/Services.jsm
+++ b/toolkit/modules/Services.jsm
@@ -39,15 +39,6 @@ XPCOMUtils.defineLazyGetter(Services, "dirsvc", function () {
.QueryInterface(Ci.nsIProperties);
});
-#ifdef MOZ_CRASHREPORTER
-XPCOMUtils.defineLazyGetter(Services, "crashmanager", () => {
- let ns = {};
- Components.utils.import("resource://gre/modules/CrashManager.jsm", ns);
-
- return ns.CrashManager.Singleton;
-});
-#endif
-
XPCOMUtils.defineLazyGetter(Services, "mm", () => {
return Cc["@mozilla.org/globalmessagemanager;1"]
.getService(Ci.nsIMessageBroadcaster)
diff --git a/toolkit/modules/Troubleshoot.jsm b/toolkit/modules/Troubleshoot.jsm
index cc545b4c40..60f7e86667 100644
--- a/toolkit/modules/Troubleshoot.jsm
+++ b/toolkit/modules/Troubleshoot.jsm
@@ -12,13 +12,6 @@ Cu.import("resource://gre/modules/AddonManager.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/AppConstants.jsm");
-var Experiments;
-try {
- Experiments = Cu.import("resource:///modules/experiments/Experiments.jsm").Experiments;
-}
-catch (e) {
-}
-
// We use a preferences whitelist to make sure we only show preferences that
// are useful for support and won't compromise the user's privacy. Note that
// entries are *prefixes*: for example, "accessibility." applies to all prefs
@@ -263,18 +256,6 @@ var dataProviders = {
});
},
- experiments: function experiments(done) {
- if (Experiments === undefined) {
- done([]);
- return;
- }
-
- // getExperiments promises experiment history
- Experiments.instance().getExperiments().then(
- experiments => done(experiments)
- );
- },
-
modifiedPreferences: function modifiedPreferences(done) {
done(getPrefList(name => Services.prefs.prefHasUserValue(name)));
},
@@ -549,19 +530,6 @@ var dataProviders = {
}
};
-if (AppConstants.MOZ_CRASHREPORTER) {
- dataProviders.crashes = function crashes(done) {
- let CrashReports = Cu.import("resource://gre/modules/CrashReports.jsm").CrashReports;
- let reports = CrashReports.getReports();
- let now = new Date();
- let reportsNew = reports.filter(report => (now - report.date < Troubleshoot.kMaxCrashAge));
- let reportsSubmitted = reportsNew.filter(report => (!report.pending));
- let reportsPendingCount = reportsNew.length - reportsSubmitted.length;
- let data = {submitted : reportsSubmitted, pending : reportsPendingCount};
- done(data);
- }
-}
-
if (AppConstants.MOZ_SANDBOX) {
dataProviders.sandbox = function sandbox(done) {
let data = {};
diff --git a/toolkit/modules/addons/WebRequestContent.js b/toolkit/modules/addons/WebRequestContent.js
index 219675e5b9..f044a1cd4e 100644
--- a/toolkit/modules/addons/WebRequestContent.js
+++ b/toolkit/modules/addons/WebRequestContent.js
@@ -80,6 +80,16 @@ var ContentPolicy = {
shouldLoad(policyType, contentLocation, requestOrigin,
node, mimeTypeGuess, extra, requestPrincipal) {
+
+ // Loads of TYPE_DOCUMENT and TYPE_SUBDOCUMENT perform a ConPol check
+ // within docshell as well as within the ContentSecurityManager. To avoid
+ // duplicate evaluations we ignore ConPol checks performed within docShell.
+ if (extra instanceof Ci.nsISupportsString) {
+ if (extra.data === "conPolCheckFromDocShell") {
+ return Ci.nsIContentPolicy.ACCEPT;
+ }
+ }
+
if (requestPrincipal &&
Services.scriptSecurityManager.isSystemPrincipal(requestPrincipal)) {
return Ci.nsIContentPolicy.ACCEPT;
diff --git a/toolkit/modules/sessionstore/FormData.jsm b/toolkit/modules/sessionstore/FormData.jsm
index f90ba5825e..d4fb08d939 100644
--- a/toolkit/modules/sessionstore/FormData.jsm
+++ b/toolkit/modules/sessionstore/FormData.jsm
@@ -216,7 +216,7 @@ var FormDataInternal = {
// We want to avoid saving data for about:sessionrestore as a string.
// Since it's stored in the form as stringified JSON, stringifying further
// causes an explosion of escape characters. cf. bug 467409
- if (isRestorationPage(ret.url)) {
+ if (isRestorationPage(ret.url) && ret.id && ret.id.sessionData) {
ret.id.sessionData = JSON.parse(ret.id.sessionData);
}
diff --git a/toolkit/moz.build b/toolkit/moz.build
index d9becc9c65..778f1c0dea 100644
--- a/toolkit/moz.build
+++ b/toolkit/moz.build
@@ -54,9 +54,6 @@ elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'android':
DIRS += ['system/androidproxy']
-if CONFIG['MOZ_CRASHREPORTER']:
- DIRS += ['crashreporter']
-
TEST_HARNESS_FILES.testing.mochitest.browser.toolkit.crashreporter.test.browser += [
'crashreporter/test/browser/crashreport.sjs',
]
diff --git a/toolkit/moz.configure b/toolkit/moz.configure
index 4717af022d..c1e0880c93 100644
--- a/toolkit/moz.configure
+++ b/toolkit/moz.configure
@@ -444,34 +444,10 @@ def omnijar_name(toolkit):
set_config('OMNIJAR_NAME', omnijar_name)
-project_flag('MOZ_PLACES',
- help='Build Places if required',
- set_as_define=True)
-
-project_flag('MOZ_SOCIAL',
- help='Build SocialAPI if required',
- default=True)
-
-project_flag('MOZ_SERVICES_HEALTHREPORT',
- help='Build Firefox Health Reporter Service',
- set_for_old_configure=True,
- set_as_define=True)
-
-project_flag('MOZ_SERVICES_SYNC',
- help='Build Sync Services if required')
-
-project_flag('MOZ_SERVICES_CLOUDSYNC',
- help='Build Services/CloudSync if required')
-
project_flag('MOZ_ANDROID_HISTORY',
help='Enable Android History instead of Places',
set_as_define=True)
-@depends('MOZ_PLACES', 'MOZ_ANDROID_HISTORY')
-def check_places_and_android_history(places, android_history):
- if places and android_history:
- die('Cannot use MOZ_ANDROID_HISTORY alongside MOZ_PLACES.')
-
# Permissions system
# ==============================================================
option(name='--disable-permissions',
diff --git a/toolkit/mozapps/extensions/AddonManager.jsm b/toolkit/mozapps/extensions/AddonManager.jsm
index 681c4240af..3913c2088f 100644
--- a/toolkit/mozapps/extensions/AddonManager.jsm
+++ b/toolkit/mozapps/extensions/AddonManager.jsm
@@ -88,9 +88,9 @@ Cu.import("resource://gre/modules/Log.jsm");
// Configure a logger at the parent 'addons' level to format
// messages for all the modules under addons.*
const PARENT_LOGGER_ID = "addons";
-let parentLogger = Log.repository.getLogger(PARENT_LOGGER_ID);
+var parentLogger = Log.repository.getLogger(PARENT_LOGGER_ID);
parentLogger.level = Log.Level.Warn;
-let formatter = new Log.BasicFormatter();
+var formatter = new Log.BasicFormatter();
// Set parent logger (and its children) to append to
// the Javascript section of the Browser Console
parentLogger.addAppender(new Log.ConsoleAppender(formatter));
@@ -101,7 +101,7 @@ parentLogger.addAppender(new Log.DumpAppender(formatter));
// Create a new logger (child of 'addons' logger)
// for use by the Addons Manager
const LOGGER_ID = "addons.manager";
-let logger = Log.repository.getLogger(LOGGER_ID);
+var logger = Log.repository.getLogger(LOGGER_ID);
// Provide the ability to enable/disable logging
// messages at runtime.
diff --git a/toolkit/mozapps/extensions/AddonPathService.cpp b/toolkit/mozapps/extensions/AddonPathService.cpp
index 0061491005..ddfdbe8171 100644
--- a/toolkit/mozapps/extensions/AddonPathService.cpp
+++ b/toolkit/mozapps/extensions/AddonPathService.cpp
@@ -128,6 +128,16 @@ AddonPathService::InsertPath(const nsAString& path, const nsAString& addonIdStri
return NS_OK;
}
+NS_IMETHODIMP
+AddonPathService::MapURIToAddonId(nsIURI* aURI, nsAString& addonIdString)
+{
+ if (JSAddonId* id = MapURIToAddonID(aURI)) {
+ JSFlatString* flat = JS_ASSERT_STRING_IS_FLAT(JS::StringOfAddonId(id));
+ AssignJSFlatString(addonIdString, flat);
+ }
+ return NS_OK;
+}
+
static nsresult
ResolveURI(nsIURI* aURI, nsAString& out)
{
diff --git a/toolkit/mozapps/extensions/DeferredSave.jsm b/toolkit/mozapps/extensions/DeferredSave.jsm
index d7f5b88642..7587ce83bc 100644
--- a/toolkit/mozapps/extensions/DeferredSave.jsm
+++ b/toolkit/mozapps/extensions/DeferredSave.jsm
@@ -12,7 +12,7 @@ Cu.import("resource://gre/modules/osfile.jsm");
Cu.import("resource://gre/modules/Promise.jsm");
// Make it possible to mock out timers for testing
-let MakeTimer = () => Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
+var MakeTimer = () => Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
this.EXPORTED_SYMBOLS = ["DeferredSave"];
@@ -23,9 +23,9 @@ Cu.import("resource://gre/modules/Log.jsm");
//Configure a logger at the parent 'DeferredSave' level to format
//messages for all the modules under DeferredSave.*
const DEFERREDSAVE_PARENT_LOGGER_ID = "DeferredSave";
-let parentLogger = Log.repository.getLogger(DEFERREDSAVE_PARENT_LOGGER_ID);
+var parentLogger = Log.repository.getLogger(DEFERREDSAVE_PARENT_LOGGER_ID);
parentLogger.level = Log.Level.Warn;
-let formatter = new Log.BasicFormatter();
+var formatter = new Log.BasicFormatter();
//Set parent logger (and its children) to append to
//the Javascript section of the Browser Console
parentLogger.addAppender(new Log.ConsoleAppender(formatter));
diff --git a/toolkit/mozapps/extensions/addonManager.js b/toolkit/mozapps/extensions/addonManager.js
index 862b1ea69e..731e70c6c4 100644
--- a/toolkit/mozapps/extensions/addonManager.js
+++ b/toolkit/mozapps/extensions/addonManager.js
@@ -31,9 +31,9 @@ const CHILD_SCRIPT = "resource://gre/modules/addons/Content.js";
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
-let gSingleton = null;
+var gSingleton = null;
-let gParentMM = null;
+var gParentMM = null;
function amManager() {
diff --git a/toolkit/mozapps/extensions/amIAddonPathService.idl b/toolkit/mozapps/extensions/amIAddonPathService.idl
index 8636898585..9c9197a61c 100644
--- a/toolkit/mozapps/extensions/amIAddonPathService.idl
+++ b/toolkit/mozapps/extensions/amIAddonPathService.idl
@@ -5,6 +5,8 @@
#include "nsISupports.idl"
+interface nsIURI;
+
/**
* This service maps file system paths where add-ons reside to the ID
* of the add-on. Paths are added by the add-on manager. They can
@@ -26,4 +28,10 @@ interface amIAddonPathService : nsISupports
* associated with the given add-on ID.
*/
void insertPath(in AString path, in AString addonId);
+
+ /**
+ * Given a URI to a file, return the ID of the add-on that the file belongs
+ * to. Returns an empty string if there is no add-on there.
+ */
+ AString mapURIToAddonId(in nsIURI aURI);
};
diff --git a/toolkit/mozapps/extensions/amInstallTrigger.js b/toolkit/mozapps/extensions/amInstallTrigger.js
index b83cbe60be..a18fe84c4d 100644
--- a/toolkit/mozapps/extensions/amInstallTrigger.js
+++ b/toolkit/mozapps/extensions/amInstallTrigger.js
@@ -18,7 +18,7 @@ const MSG_INSTALL_ADDONS = "WebInstallerInstallAddonsFromWebpage";
const MSG_INSTALL_CALLBACK = "WebInstallerInstallCallback";
-let log = Log.repository.getLogger("AddonManager.InstallTrigger");
+var log = Log.repository.getLogger("AddonManager.InstallTrigger");
log.level = Log.Level[Preferences.get("extensions.logging.enabled", false) ? "Warn" : "Trace"];
function CallbackObject(id, callback, urls, mediator) {
diff --git a/toolkit/mozapps/extensions/amWebInstallListener.js b/toolkit/mozapps/extensions/amWebInstallListener.js
index 901beef07d..ac6e2495de 100644
--- a/toolkit/mozapps/extensions/amWebInstallListener.js
+++ b/toolkit/mozapps/extensions/amWebInstallListener.js
@@ -37,7 +37,7 @@ const LOGGER_ID = "addons.weblistener";
// Create a new logger for use by the Addons Web Listener
// (Requires AddonManager.jsm)
-let logger = Log.repository.getLogger(LOGGER_ID);
+var logger = Log.repository.getLogger(LOGGER_ID);
function notifyObservers(aTopic, aBrowser, aUri, aInstalls) {
let info = {
diff --git a/toolkit/mozapps/extensions/content/extensions.js b/toolkit/mozapps/extensions/content/extensions.js
index a799eeebbe..8d9c132e61 100644
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -19,11 +19,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
"resource://gre/modules/PluralForm.jsm");
XPCOMUtils.defineLazyGetter(this, "BrowserToolboxProcess", function () {
- return Cu.import("resource://gre/modules/devtools/ToolboxProcess.jsm", {}).
+ return Cu.import("resource://devtools/client/framework/ToolboxProcess.jsm", {}).
BrowserToolboxProcess;
});
-XPCOMUtils.defineLazyModuleGetter(this, "Experiments",
- "resource:///modules/experiments/Experiments.jsm");
const PREF_DISCOVERURL = "extensions.webservice.discoverURL";
const PREF_DISCOVER_ENABLED = "extensions.getAddons.showPane";
@@ -216,23 +214,6 @@ function isDiscoverEnabled() {
return true;
}
-function getExperimentEndDate(aAddon) {
- if (!("@mozilla.org/browser/experiments-service;1" in Cc)) {
- return 0;
- }
-
- if (!aAddon.isActive) {
- return aAddon.endDate;
- }
-
- let experiment = Experiments.instance().getActiveExperiment();
- if (!experiment) {
- return 0;
- }
-
- return experiment.endDate;
-}
-
/**
* Obtain the main DOMWindow for the current context.
*/
@@ -1316,28 +1297,7 @@ var gViewController = {
doCommand: function cmd_neverActivateItem_doCommand(aAddon) {
aAddon.userDisabled = true;
}
- },
-
- cmd_experimentsLearnMore: {
- isEnabled: function cmd_experimentsLearnMore_isEnabled() {
- let mainWindow = getMainWindow();
- return mainWindow && "switchToTabHavingURI" in mainWindow;
- },
- doCommand: function cmd_experimentsLearnMore_doCommand() {
- let url = Services.prefs.getCharPref("toolkit.telemetry.infoURL");
- openOptionsInTab(url);
- },
- },
-
- cmd_experimentsOpenTelemetryPreferences: {
- isEnabled: function cmd_experimentsOpenTelemetryPreferences_isEnabled() {
- return !!getMainWindowWithPreferencesPane();
- },
- doCommand: function cmd_experimentsOpenTelemetryPreferences_doCommand() {
- let mainWindow = getMainWindowWithPreferencesPane();
- mainWindow.openAdvancedPreferences("dataChoicesTab");
- },
- },
+ }
},
supportsCommand: function gVC_supportsCommand(aCommand) {
@@ -1468,10 +1428,6 @@ function createItem(aObj, aIsInstall, aIsRemote) {
// the binding handles the rest
item.setAttribute("value", aObj.id);
- if (aObj.type == "experiment") {
- item.endDate = getExperimentEndDate(aObj);
- }
-
return item;
}
@@ -2500,7 +2456,7 @@ var gSearchView = {
this._allResultsLink.setAttribute("href",
AddonRepository.getSearchURL(this._lastQuery));
this._allResultsLink.hidden = false;
- },
+ },
updateListAttributes: function gSearchView_updateListAttributes() {
var item = this._listBox.querySelector("richlistitem[remote='true'][first]");
@@ -2679,13 +2635,6 @@ var gListView = {
// the existing item
if (aInstall.existingAddon)
this.removeItem(aInstall, true);
-
- if (aInstall.addon.type == "experiment") {
- let item = this.getListItemForID(aInstall.addon.id);
- if (item) {
- item.endDate = getExperimentEndDate(aInstall.addon);
- }
- }
},
addItem: function gListView_addItem(aObj, aIsInstall) {
@@ -2945,34 +2894,6 @@ var gDetailView = {
}
}
- if (this._addon.type == "experiment") {
- let prefix = "details.experiment.";
- let active = this._addon.isActive;
-
- let stateKey = prefix + "state." + (active ? "active" : "complete");
- let node = document.getElementById("detail-experiment-state");
- node.value = gStrings.ext.GetStringFromName(stateKey);
-
- let now = Date.now();
- let end = getExperimentEndDate(this._addon);
- let days = Math.abs(end - now) / (24 * 60 * 60 * 1000);
-
- let timeKey = prefix + "time.";
- let timeMessage;
- if (days < 1) {
- timeKey += (active ? "endsToday" : "endedToday");
- timeMessage = gStrings.ext.GetStringFromName(timeKey);
- } else {
- timeKey += (active ? "daysRemaining" : "daysPassed");
- days = Math.round(days);
- let timeString = gStrings.ext.GetStringFromName(timeKey);
- timeMessage = PluralForm.get(days, timeString)
- .replace("#1", days);
- }
-
- document.getElementById("detail-experiment-time").value = timeMessage;
- }
-
this.fillSettingsRows(aScrollToPreferences, (function updateView_fillSettingsRows() {
this.updateState();
gViewController.notifyViewChanged();
diff --git a/toolkit/mozapps/extensions/content/update.js b/toolkit/mozapps/extensions/content/update.js
index 3d87f4d4b1..afc74dca8e 100644
--- a/toolkit/mozapps/extensions/content/update.js
+++ b/toolkit/mozapps/extensions/content/update.js
@@ -22,7 +22,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "AddonRepository", "resource://gre/modul
XPCOMUtils.defineLazyModuleGetter(this, "Task", "resource://gre/modules/Task.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Promise", "resource://gre/modules/Promise.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Log", "resource://gre/modules/Log.jsm");
-let logger = null;
+var logger = null;
var gUpdateWizard = {
// When synchronizing app compatibility info this contains all installed
@@ -169,7 +169,7 @@ var gOfflinePage = {
}
// Addon listener to count addons enabled/disabled by metadata checks
-let listener = {
+var listener = {
onDisabled: function listener_onDisabled(aAddon) {
gUpdateWizard.affectedAddonIDs.add(aAddon.id);
gUpdateWizard.metadataDisabled++;
diff --git a/toolkit/mozapps/extensions/internal/AddonRepository.jsm b/toolkit/mozapps/extensions/internal/AddonRepository.jsm
index adcecbee7f..76a7528c73 100644
--- a/toolkit/mozapps/extensions/internal/AddonRepository.jsm
+++ b/toolkit/mozapps/extensions/internal/AddonRepository.jsm
@@ -72,7 +72,7 @@ const LOGGER_ID = "addons.repository";
// Create a new logger for use by the Addons Repository
// (Requires AddonManager.jsm)
-let logger = Log.repository.getLogger(LOGGER_ID);
+var logger = Log.repository.getLogger(LOGGER_ID);
// A map between XML keys to AddonSearchResult keys for string values
// that require no extra parsing from XML
@@ -101,7 +101,7 @@ const INTEGER_KEY_MAP = {
};
// Wrap the XHR factory so that tests can override with a mock
-let XHRequest = Components.Constructor("@mozilla.org/xmlextras/xmlhttprequest;1",
+var XHRequest = Components.Constructor("@mozilla.org/xmlextras/xmlhttprequest;1",
"nsIXMLHttpRequest");
function convertHTMLToPlainText(html) {
diff --git a/toolkit/mozapps/extensions/internal/AddonRepository_SQLiteMigrator.jsm b/toolkit/mozapps/extensions/internal/AddonRepository_SQLiteMigrator.jsm
index 128146bbe6..66147b9aa4 100644
--- a/toolkit/mozapps/extensions/internal/AddonRepository_SQLiteMigrator.jsm
+++ b/toolkit/mozapps/extensions/internal/AddonRepository_SQLiteMigrator.jsm
@@ -30,7 +30,7 @@ const LOGGER_ID = "addons.repository.sqlmigrator";
// Create a new logger for use by the Addons Repository SQL Migrator
// (Requires AddonManager.jsm)
-let logger = Log.repository.getLogger(LOGGER_ID);
+var logger = Log.repository.getLogger(LOGGER_ID);
this.EXPORTED_SYMBOLS = ["AddonRepository_SQLiteMigrator"];
@@ -60,7 +60,11 @@ this.AddonRepository_SQLiteMigrator = {
this._retrieveStoredData((results) => {
this._closeConnection();
- let resultArray = [addon for ([,addon] of Iterator(results))];
+ // Tycho: let resultArray = [addon for ([,addon] of Iterator(results))];
+ let resultArray = [];
+ for (let [,addon] of Iterator(results)) {
+ resultArray.push(addon);
+ }
logger.debug(resultArray.length + " addons imported.")
aCallback(resultArray);
});
diff --git a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm
index d68a0f1759..939e2e269b 100644
--- a/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm
+++ b/toolkit/mozapps/extensions/internal/AddonUpdateChecker.jsm
@@ -52,7 +52,7 @@ const LOGGER_ID = "addons.update-checker";
// Create a new logger for use by the Addons Update Checker
// (Requires AddonManager.jsm)
-let logger = Log.repository.getLogger(LOGGER_ID);
+var logger = Log.repository.getLogger(LOGGER_ID);
/**
* A serialisation method for RDF data that produces an identical string
diff --git a/toolkit/mozapps/extensions/internal/Content.js b/toolkit/mozapps/extensions/internal/Content.js
index 29c0ed8cef..61a8b0323f 100644
--- a/toolkit/mozapps/extensions/internal/Content.js
+++ b/toolkit/mozapps/extensions/internal/Content.js
@@ -8,9 +8,9 @@
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
-let {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
+var {Services} = Cu.import("resource://gre/modules/Services.jsm", {});
-let nsIFile = Components.Constructor("@mozilla.org/file/local;1", "nsIFile",
+var nsIFile = Components.Constructor("@mozilla.org/file/local;1", "nsIFile",
"initWithPath");
const MSG_JAR_FLUSH = "AddonJarFlush";
diff --git a/toolkit/mozapps/extensions/internal/GMPProvider.jsm b/toolkit/mozapps/extensions/internal/GMPProvider.jsm
index a55457f6e1..52affa9ba8 100644
--- a/toolkit/mozapps/extensions/internal/GMPProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/GMPProvider.jsm
@@ -64,11 +64,11 @@ XPCOMUtils.defineLazyGetter(this, "pluginsBundle",
XPCOMUtils.defineLazyGetter(this, "gmpService",
() => Cc["@mozilla.org/gecko-media-plugin-service;1"].getService(Ci.mozIGeckoMediaPluginChromeService));
-let messageManager = Cc["@mozilla.org/globalmessagemanager;1"]
+var messageManager = Cc["@mozilla.org/globalmessagemanager;1"]
.getService(Ci.nsIMessageListenerManager);
-let gLogger;
-let gLogAppenderDump = null;
+var gLogger;
+var gLogAppenderDump = null;
function configureLogging() {
if (!gLogger) {
@@ -443,7 +443,7 @@ GMPWrapper.prototype = {
},
};
-let GMPProvider = {
+var GMPProvider = {
get name() { return "GMPProvider"; },
_plugins: null,
diff --git a/toolkit/mozapps/extensions/internal/LightweightThemeImageOptimizer.jsm b/toolkit/mozapps/extensions/internal/LightweightThemeImageOptimizer.jsm
index fccde9a81d..1e7d6b0d8e 100644
--- a/toolkit/mozapps/extensions/internal/LightweightThemeImageOptimizer.jsm
+++ b/toolkit/mozapps/extensions/internal/LightweightThemeImageOptimizer.jsm
@@ -49,7 +49,7 @@ this.LightweightThemeImageOptimizer = {
Object.freeze(LightweightThemeImageOptimizer);
-let ImageCropper = {
+var ImageCropper = {
_inProgress: {},
getCroppedImageURL:
@@ -119,7 +119,7 @@ let ImageCropper = {
}
};
-let ImageFile = {
+var ImageFile = {
read: function ImageFile_read(aURI, aCallback) {
this._netUtil.asyncFetch2(
aURI,
@@ -158,7 +158,7 @@ let ImageFile = {
XPCOMUtils.defineLazyModuleGetter(ImageFile, "_netUtil",
"resource://gre/modules/NetUtil.jsm", "NetUtil");
-let ImageTools = {
+var ImageTools = {
decode: function ImageTools_decode(aInputStream, aContentType) {
let outParam = {value: null};
@@ -187,7 +187,7 @@ let ImageTools = {
XPCOMUtils.defineLazyServiceGetter(ImageTools, "_imgTools",
"@mozilla.org/image/tools;1", "imgITools");
-let Utils = {
+var Utils = {
createCopy: function Utils_createCopy(aData) {
let copy = {};
for (let [k, v] in Iterator(aData)) {
diff --git a/toolkit/mozapps/extensions/internal/PluginProvider.jsm b/toolkit/mozapps/extensions/internal/PluginProvider.jsm
index 04a4f9d7cc..cb07dcb129 100644
--- a/toolkit/mozapps/extensions/internal/PluginProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/PluginProvider.jsm
@@ -23,7 +23,7 @@ const LOGGER_ID = "addons.plugins";
// Create a new logger for use by the Addons Plugin Provider
// (Requires AddonManager.jsm)
-let logger = Log.repository.getLogger(LOGGER_ID);
+var logger = Log.repository.getLogger(LOGGER_ID);
function getIDHashForString(aStr) {
// return the two-digit hexadecimal code for a byte
diff --git a/toolkit/mozapps/extensions/internal/XPIProvider.jsm b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
index 54b86edc44..8b49c66001 100644
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -37,9 +37,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "Task",
XPCOMUtils.defineLazyModuleGetter(this, "OS",
"resource://gre/modules/osfile.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "BrowserToolboxProcess",
- "resource://gre/modules/devtools/ToolboxProcess.jsm");
+ "resource://devtools/client/framework/ToolboxProcess.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ConsoleAPI",
- "resource://gre/modules/devtools/Console.jsm");
+ "resource://gre/modules/Console.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "Blocklist",
"@mozilla.org/extensions/blocklist;1",
@@ -52,6 +52,10 @@ XPCOMUtils.defineLazyServiceGetter(this,
"ResProtocolHandler",
"@mozilla.org/network/protocol;1?name=resource",
"nsIResProtocolHandler");
+XPCOMUtils.defineLazyServiceGetter(this,
+ "AddonPathService",
+ "@mozilla.org/addon-path-service;1",
+ "amIAddonPathService");
const nsIFile = Components.Constructor("@mozilla.org/file/local;1", "nsIFile",
"initWithPath");
@@ -129,7 +133,7 @@ const PREFIX_NS_EM = "http://www.mozilla.org/2004/em-rdf#";
const TOOLKIT_ID = "toolkit@mozilla.org";
#ifdef MOZ_PHOENIX_EXTENSIONS
const FIREFOX_ID = "{ec8030f7-c20a-464f-9b0e-13a3a9e97384}"
-const FIREFOX_APPCOMPATVERSION = "27.9"
+const FIREFOX_APPCOMPATVERSION = "56.9"
#endif
// The value for this is in Makefile.in
@@ -222,7 +226,7 @@ const LOGGER_ID = "addons.xpi";
// Create a new logger for use by all objects in this Addons XPI Provider module
// (Requires AddonManager.jsm)
-let logger = Log.repository.getLogger(LOGGER_ID);
+var logger = Log.repository.getLogger(LOGGER_ID);
const LAZY_OBJECTS = ["XPIDatabase"];
@@ -1887,8 +1891,7 @@ this.XPIProvider = {
logger.info("Mapping " + aID + " to " + aFile.path);
this._addonFileMap.set(aID, aFile.path);
- let service = Cc["@mozilla.org/addon-path-service;1"].getService(Ci.amIAddonPathService);
- service.insertPath(aFile.path, aID);
+ AddonPathService.insertPath(aFile.path, aID);
},
/**
@@ -1931,12 +1934,10 @@ this.XPIProvider = {
let chan;
try {
- chan = Services.io.newChannelFromURI2(aURI,
- null, // aLoadingNode
- Services.scriptSecurityManager.getSystemPrincipal(),
- null, // aTriggeringPrincipal
- Ci.nsILoadInfo.SEC_NORMAL,
- Ci.nsIContentPolicy.TYPE_OTHER);
+ chan = NetUtil.newChannel({
+ uri: aURI,
+ loadUsingSystemPrincipal: true
+ });
}
catch (ex) {
return null;
@@ -2082,7 +2083,7 @@ this.XPIProvider = {
Services.prefs.addObserver(PREF_EM_MIN_COMPAT_APP_VERSION, this, false);
Services.prefs.addObserver(PREF_EM_MIN_COMPAT_PLATFORM_VERSION, this, false);
Services.obs.addObserver(this, NOTIFICATION_FLUSH_PERMISSIONS, false);
- if (Cu.isModuleLoaded("resource://gre/modules/devtools/ToolboxProcess.jsm")) {
+ if (Cu.isModuleLoaded("resource://devtools/client/framework/ToolboxProcess.jsm")) {
// If BrowserToolboxProcess is already loaded, set the boolean to true
// and do whatever is needed
this._toolboxProcessLoaded = true;
@@ -3918,16 +3919,8 @@ this.XPIProvider = {
* @see amIAddonManager.mapURIToAddonID
*/
mapURIToAddonID: function XPI_mapURIToAddonID(aURI) {
- let resolved = this._resolveURIToFile(aURI);
- if (!resolved || !(resolved instanceof Ci.nsIFileURL))
- return null;
-
- for (let [id, path] of this._addonFileMap) {
- if (resolved.file.path.startsWith(path))
- return id;
- }
-
- return null;
+ // Returns `null` instead of empty string if the URI can't be mapped.
+ return AddonPathService.mapURIToAddonId(aURI) || null;
},
/**
@@ -4438,7 +4431,18 @@ this.XPIProvider = {
if (aAddon.type == "locale")
return;
- if (!(aMethod in this.bootstrapScopes[aAddon.id])) {
+ let method = undefined;
+ try {
+ method = Components.utils.evalInSandbox(`${aMethod};`,
+ this.bootstrapScopes[aAddon.id],
+ "ECMAv5");
+ }
+ catch (e) {
+ // An exception will be caught if the expected method is not defined.
+ // That will be logged below.
+ }
+
+ if (!method) {
logger.warn("Add-on " + aAddon.id + " is missing bootstrap method " + aMethod);
return;
}
@@ -4457,9 +4461,9 @@ this.XPIProvider = {
}
logger.debug("Calling bootstrap method " + aMethod + " on " + aAddon.id + " version " +
- aAddon.version);
+ aAddon.version);
try {
- this.bootstrapScopes[aAddon.id][aMethod](params, aReason);
+ method(params, aReason);
}
catch (e) {
logger.warn("Exception running bootstrap method " + aMethod + " on " + aAddon.id, e);
@@ -5456,21 +5460,17 @@ AddonInstall.prototype = {
let requireBuiltIn = Preferences.get(PREF_INSTALL_REQUIREBUILTINCERTS, true);
this.badCertHandler = new BadCertHandler(!requireBuiltIn);
- this.channel = NetUtil.newChannel2(this.sourceURI,
- null,
- null,
- null, // aLoadingNode
- Services.scriptSecurityManager.getSystemPrincipal(),
- null, // aTriggeringPrincipal
- Ci.nsILoadInfo.SEC_NORMAL,
- Ci.nsIContentPolicy.TYPE_OTHER);
+ this.channel = NetUtil.newChannel({
+ uri: this.sourceURI,
+ loadUsingSystemPrincipal: true
+ });
this.channel.notificationCallbacks = this;
if (this.channel instanceof Ci.nsIHttpChannel) {
this.channel.setRequestHeader("Moz-XPI-Update", "1", true);
if (this.channel instanceof Ci.nsIHttpChannelInternal)
this.channel.forceAllowThirdPartyCookie = true;
}
- this.channel.asyncOpen(listener, null);
+ this.channel.asyncOpen2(listener);
Services.obs.addObserver(this, "network:offline-about-to-go-offline", false);
}
@@ -7822,7 +7822,7 @@ WinRegInstallLocation.prototype = {
};
#endif
-let addonTypes = [
+var addonTypes = [
new AddonManagerPrivate.AddonType("extension", URI_EXTENSION_STRINGS,
STRING_TYPE_NAME,
AddonManager.VIEW_TYPE_LIST, 4000,
diff --git a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
index 2cef907f1a..d260294557 100644
--- a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
+++ b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
@@ -29,7 +29,7 @@ const LOGGER_ID = "addons.xpi-utils";
// Create a new logger for use by the Addons XPI Provider Utils
// (Requires AddonManager.jsm)
-let logger = Log.repository.getLogger(LOGGER_ID);
+var logger = Log.repository.getLogger(LOGGER_ID);
const KEY_PROFILEDIR = "ProfD";
const FILE_DATABASE = "extensions.sqlite";
diff --git a/toolkit/mozapps/extensions/nsBlocklistService.js b/toolkit/mozapps/extensions/nsBlocklistService.js
index 936c9d1b51..487dae8e54 100644
--- a/toolkit/mozapps/extensions/nsBlocklistService.js
+++ b/toolkit/mozapps/extensions/nsBlocklistService.js
@@ -910,7 +910,7 @@ Blocklist.prototype = {
let issuer = blocklistElement.getAttribute("issuerName");
for (let snElement of blocklistElement.children) {
try {
- gCertBlocklistService.addRevokedCert(issuer, snElement.textContent);
+ gCertBlocklistService.revokeCertByIssuerAndSerial(issuer, snElement.textContent);
} catch (e) {
// we want to keep trying other elements since missing all items
// is worse than missing one
diff --git a/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/bootstrap.js b/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/bootstrap.js
new file mode 100644
index 0000000000..498b76526f
--- /dev/null
+++ b/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/bootstrap.js
@@ -0,0 +1,5 @@
+Components.utils.import("resource://gre/modules/Services.jsm");
+
+const install = function() {
+ Services.obs.notifyObservers(null, "addon-install", "");
+} \ No newline at end of file
diff --git a/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/install.rdf b/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/install.rdf
new file mode 100644
index 0000000000..af3a749cef
--- /dev/null
+++ b/toolkit/mozapps/extensions/test/addons/test_bootstrap_const/install.rdf
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+
+ <Description about="urn:mozilla:install-manifest">
+ <em:id>bootstrap@tests.mozilla.org</em:id>
+ <em:version>1.0</em:version>
+ <em:bootstrap>true</em:bootstrap>
+
+ <!-- Front End MetaData -->
+ <em:name>Test Bootstrap</em:name>
+ <em:description>Test Description</em:description>
+
+ <em:targetApplication>
+ <Description>
+ <em:id>xpcshell@tests.mozilla.org</em:id>
+ <em:minVersion>1</em:minVersion>
+ <em:maxVersion>1</em:maxVersion>
+ </Description>
+ </em:targetApplication>
+
+ </Description>
+</RDF> \ No newline at end of file
diff --git a/toolkit/mozapps/extensions/test/browser/browser-common.ini b/toolkit/mozapps/extensions/test/browser/browser-common.ini
index eaab29f759..3e88833ef3 100644
--- a/toolkit/mozapps/extensions/test/browser/browser-common.ini
+++ b/toolkit/mozapps/extensions/test/browser/browser-common.ini
@@ -39,8 +39,6 @@ skip-if = true # Bug 1093190 - Disabled due to leak
[browser_discovery.js]
skip-if = e10s # Bug ?????? - test times out on try on all platforms, but works locally for markh!
[browser_dragdrop.js]
-skip-if = buildapp == 'mulet'
-[browser_experiments.js]
skip-if = e10s
[browser_list.js]
[browser_metadataTimeout.js]
diff --git a/toolkit/mozapps/extensions/test/browser/browser_experiments.js b/toolkit/mozapps/extensions/test/browser/browser_experiments.js
deleted file mode 100644
index 72d0ca83e9..0000000000
--- a/toolkit/mozapps/extensions/test/browser/browser_experiments.js
+++ /dev/null
@@ -1,645 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-Components.utils.import("resource://gre/modules/Promise.jsm", this);
-
-let {AddonTestUtils} = Components.utils.import("resource://testing-common/AddonManagerTesting.jsm", {});
-let {HttpServer} = Components.utils.import("resource://testing-common/httpd.js", {});
-
-let gManagerWindow;
-let gCategoryUtilities;
-let gExperiments;
-let gHttpServer;
-
-let gSavedManifestURI;
-let gIsEnUsLocale;
-
-const SEC_IN_ONE_DAY = 24 * 60 * 60;
-const MS_IN_ONE_DAY = SEC_IN_ONE_DAY * 1000;
-
-function getExperimentAddons() {
- let deferred = Promise.defer();
- AddonManager.getAddonsByTypes(["experiment"], (addons) => {
- deferred.resolve(addons);
- });
- return deferred.promise;
-}
-
-function getInstallItem() {
- let doc = gManagerWindow.document;
- let view = doc.getElementById("view-port").selectedPanel;
- let list = doc.getElementById("addon-list");
-
- let node = list.firstChild;
- while (node) {
- if (node.getAttribute("status") == "installing") {
- return node;
- }
- node = node.nextSibling;
- }
-
- return null;
-}
-
-function patchPolicy(policy, data) {
- for (let key of Object.keys(data)) {
- Object.defineProperty(policy, key, {
- value: data[key],
- writable: true,
- });
- }
-}
-
-function defineNow(policy, time) {
- patchPolicy(policy, { now: () => new Date(time) });
-}
-
-function openDetailsView(aId) {
- let item = get_addon_element(gManagerWindow, aId);
- Assert.ok(item, "Should have got add-on element.");
- is_element_visible(item, "Add-on element should be visible.");
-
- EventUtils.synthesizeMouseAtCenter(item, { clickCount: 1 }, gManagerWindow);
- EventUtils.synthesizeMouseAtCenter(item, { clickCount: 2 }, gManagerWindow);
-
- let deferred = Promise.defer();
- wait_for_view_load(gManagerWindow, deferred.resolve);
- return deferred.promise;
-}
-
-function clickRemoveButton(addonElement) {
- let btn = gManagerWindow.document.getAnonymousElementByAttribute(addonElement, "anonid", "remove-btn");
- if (!btn) {
- return Promise.reject();
- }
-
- EventUtils.synthesizeMouseAtCenter(btn, { clickCount: 1 }, gManagerWindow);
- let deferred = Promise.defer();
- setTimeout(deferred.resolve, 0);
- return deferred;
-}
-
-function clickUndoButton(addonElement) {
- let btn = gManagerWindow.document.getAnonymousElementByAttribute(addonElement, "anonid", "undo-btn");
- if (!btn) {
- return Promise.reject();
- }
-
- EventUtils.synthesizeMouseAtCenter(btn, { clickCount: 1 }, gManagerWindow);
- let deferred = Promise.defer();
- setTimeout(deferred.resolve, 0);
- return deferred;
-}
-
-add_task(function* initializeState() {
- gManagerWindow = yield open_manager();
- gCategoryUtilities = new CategoryUtilities(gManagerWindow);
-
- registerCleanupFunction(() => {
- Services.prefs.clearUserPref("experiments.enabled");
- if (gHttpServer) {
- gHttpServer.stop(() => {});
- if (gSavedManifestURI !== undefined) {
- Services.prefs.setCharPref("experments.manifest.uri", gSavedManifestURI);
- }
- }
- if (gExperiments) {
- let tmp = {};
- Cu.import("resource:///modules/experiments/Experiments.jsm", tmp);
- gExperiments._policy = new tmp.Experiments.Policy();
- }
- });
-
- let chrome = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIXULChromeRegistry);
- gIsEnUsLocale = chrome.getSelectedLocale("global") == "en-US";
-
- // The Experiments Manager will interfere with us by preventing installs
- // of experiments it doesn't know about. We remove it from the equation
- // because here we are only concerned with core Addon Manager operation,
- // not the superset Experiments Manager has imposed.
- if ("@mozilla.org/browser/experiments-service;1" in Components.classes) {
- let tmp = {};
- Cu.import("resource:///modules/experiments/Experiments.jsm", tmp);
- // There is a race condition between XPCOM service initialization and
- // this test running. We have to initialize the instance first, then
- // uninitialize it to prevent this.
- gExperiments = tmp.Experiments.instance();
- yield gExperiments._mainTask;
- yield gExperiments.uninit();
- }
-});
-
-// On an empty profile with no experiments, the experiment category
-// should be hidden.
-add_task(function* testInitialState() {
- Assert.ok(gCategoryUtilities.get("experiment", false), "Experiment tab is defined.");
- Assert.ok(!gCategoryUtilities.isTypeVisible("experiment"), "Experiment tab hidden by default.");
-});
-
-add_task(function* testExperimentInfoNotVisible() {
- yield gCategoryUtilities.openType("extension");
- let el = gManagerWindow.document.getElementsByClassName("experiment-info-container")[0];
- is_element_hidden(el, "Experiment info not visible on other types.");
-});
-
-// If we have an active experiment, we should see the experiments tab
-// and that tab should have some messages.
-add_task(function* testActiveExperiment() {
- let addon = yield install_addon("addons/browser_experiment1.xpi");
-
- Assert.ok(addon.userDisabled, "Add-on is disabled upon initial install.");
- Assert.equal(addon.isActive, false, "Add-on is not active.");
-
- Assert.ok(gCategoryUtilities.isTypeVisible("experiment"), "Experiment tab visible.");
-
- yield gCategoryUtilities.openType("experiment");
- let el = gManagerWindow.document.getElementsByClassName("experiment-info-container")[0];
- is_element_visible(el, "Experiment info is visible on experiment tab.");
-});
-
-add_task(function* testExperimentLearnMore() {
- // Actual URL is irrelevant.
- Services.prefs.setCharPref("toolkit.telemetry.infoURL",
- "http://mochi.test:8888/server.js");
-
- yield gCategoryUtilities.openType("experiment");
- let btn = gManagerWindow.document.getElementById("experiments-learn-more");
-
- if (!gUseInContentUI) {
- is_element_hidden(btn, "Learn more button hidden if not using in-content UI.");
- Services.prefs.clearUserPref("toolkit.telemetry.infoURL");
-
- return;
- }
-
- is_element_visible(btn, "Learn more button visible.");
-
- let deferred = Promise.defer();
- window.addEventListener("DOMContentLoaded", function onLoad(event) {
- info("Telemetry privacy policy window opened.");
- window.removeEventListener("DOMContentLoaded", onLoad, false);
-
- let browser = gBrowser.selectedBrowser;
- let expected = Services.prefs.getCharPref("toolkit.telemetry.infoURL");
- Assert.equal(browser.currentURI.spec, expected, "New tab should have loaded privacy policy.");
- browser.contentWindow.close();
-
- Services.prefs.clearUserPref("toolkit.telemetry.infoURL");
-
- deferred.resolve();
- }, false);
-
- info("Opening telemetry privacy policy.");
- EventUtils.synthesizeMouseAtCenter(btn, {}, gManagerWindow);
-
- yield deferred.promise;
-});
-
-add_task(function* testOpenPreferences() {
- yield gCategoryUtilities.openType("experiment");
- let btn = gManagerWindow.document.getElementById("experiments-change-telemetry");
- if (!gUseInContentUI) {
- is_element_hidden(btn, "Change telemetry button not enabled in out of window UI.");
- info("Skipping preferences open test because not using in-content UI.");
- return;
- }
-
- is_element_visible(btn, "Change telemetry button visible in in-content UI.");
-
- let deferred = Promise.defer();
- Services.obs.addObserver(function observer(prefWin, topic, data) {
- Services.obs.removeObserver(observer, "advanced-pane-loaded");
- info("Advanced preference pane opened.");
- executeSoon(function() {
- // We want this test to fail if the preferences pane changes.
- let el = prefWin.document.getElementById("dataChoicesPanel");
- is_element_visible(el);
-
- prefWin.close();
- info("Closed preferences pane.");
-
- deferred.resolve();
- });
- }, "advanced-pane-loaded", false);
-
- info("Loading preferences pane.");
- EventUtils.synthesizeMouseAtCenter(btn, {}, gManagerWindow);
-
- yield deferred.promise;
-});
-
-add_task(function* testButtonPresence() {
- yield gCategoryUtilities.openType("experiment");
- let item = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
- Assert.ok(item, "Got add-on element.");
- item.parentNode.ensureElementIsVisible(item);
-
- let el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
- // Corresponds to the uninstall permission.
- is_element_visible(el, "Remove button is visible.");
- // Corresponds to lack of disable permission.
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "disable-btn");
- is_element_hidden(el, "Disable button not visible.");
- // Corresponds to lack of enable permission.
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "enable-btn");
- is_element_hidden(el, "Enable button not visible.");
-});
-
-// Remove the add-on we've been testing with.
-add_task(function* testCleanup() {
- yield AddonTestUtils.uninstallAddonByID("test-experiment1@experiments.mozilla.org");
- // Verify some conditions, just in case.
- let addons = yield getExperimentAddons();
- Assert.equal(addons.length, 0, "No experiment add-ons are installed.");
-});
-
-// The following tests should ideally live in browser/experiments/. However,
-// they rely on some of the helper functions from head.js, which can't easily
-// be consumed from other directories. So, they live here.
-
-add_task(function* testActivateExperiment() {
- if (!gExperiments) {
- info("Skipping experiments test because that feature isn't available.");
- return;
- }
-
- gHttpServer = new HttpServer();
- gHttpServer.start(-1);
- let root = "http://localhost:" + gHttpServer.identity.primaryPort + "/";
- gHttpServer.registerPathHandler("/manifest", (request, response) => {
- response.setStatusLine(null, 200, "OK");
- response.write(JSON.stringify({
- "version": 1,
- "experiments": [
- {
- id: "experiment-1",
- xpiURL: TESTROOT + "addons/browser_experiment1.xpi",
- xpiHash: "IRRELEVANT",
- startTime: Date.now() / 1000 - 3600,
- endTime: Date.now() / 1000 + 3600,
- maxActiveSeconds: 600,
- appName: [Services.appinfo.name],
- channel: [gExperiments._policy.updatechannel()],
- },
- ],
- }));
- response.processAsync();
- response.finish();
- });
-
- gSavedManifestURI = Services.prefs.getCharPref("experiments.manifest.uri");
- Services.prefs.setCharPref("experiments.manifest.uri", root + "manifest");
-
- // We need to remove the cache file to help ensure consistent state.
- yield OS.File.remove(gExperiments._cacheFilePath);
-
- Services.prefs.setBoolPref("experiments.enabled", true);
-
- info("Initializing experiments service.");
- yield gExperiments.init();
- info("Experiments service finished first run.");
-
- // Check conditions, just to be sure.
- let experiments = yield gExperiments.getExperiments();
- Assert.equal(experiments.length, 0, "No experiments known to the service.");
-
- // This makes testing easier.
- gExperiments._policy.ignoreHashes = true;
-
- info("Manually updating experiments manifest.");
- yield gExperiments.updateManifest();
- info("Experiments update complete.");
-
- let deferred = Promise.defer();
- gHttpServer.stop(() => {
- gHttpServer = null;
-
- info("getting experiment by ID");
- AddonManager.getAddonByID("test-experiment1@experiments.mozilla.org", (addon) => {
- Assert.ok(addon, "Add-on installed via Experiments manager.");
-
- deferred.resolve();
- });
- });
-
- yield deferred.promise;
-
- Assert.ok(gCategoryUtilities.isTypeVisible, "experiment", "Experiment tab visible.");
- yield gCategoryUtilities.openType("experiment");
- let el = gManagerWindow.document.getElementsByClassName("experiment-info-container")[0];
- is_element_visible(el, "Experiment info is visible on experiment tab.");
-});
-
-add_task(function testDeactivateExperiment() {
- if (!gExperiments) {
- return;
- }
-
- // Fake an empty manifest to purge data from previous manifest.
- yield gExperiments._updateExperiments({
- "version": 1,
- "experiments": [],
- });
-
- yield gExperiments.disableExperiment("testing");
-
- // We should have a record of the previously-active experiment.
- let experiments = yield gExperiments.getExperiments();
- Assert.equal(experiments.length, 1, "1 experiment is known.");
- Assert.equal(experiments[0].active, false, "Experiment is not active.");
-
- // We should have a previous experiment in the add-ons manager.
- let deferred = Promise.defer();
- AddonManager.getAddonsByTypes(["experiment"], (addons) => {
- deferred.resolve(addons);
- });
- let addons = yield deferred.promise;
- Assert.equal(addons.length, 1, "1 experiment add-on known.");
- Assert.ok(addons[0].appDisabled, "It is a previous experiment.");
- Assert.equal(addons[0].id, "experiment-1", "Add-on ID matches expected.");
-
- // Verify the UI looks sane.
-
- Assert.ok(gCategoryUtilities.isTypeVisible("experiment"), "Experiment tab visible.");
- let item = get_addon_element(gManagerWindow, "experiment-1");
- Assert.ok(item, "Got add-on element.");
- Assert.ok(!item.active, "Element should not be active.");
- item.parentNode.ensureElementIsVisible(item);
-
- // User control buttons should not be present because previous experiments
- // should have no permissions.
- let el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
- is_element_hidden(el, "Remove button is not visible.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "disable-btn");
- is_element_hidden(el, "Disable button is not visible.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "enable-btn");
- is_element_hidden(el, "Enable button is not visible.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "preferences-btn");
- is_element_hidden(el, "Preferences button is not visible.");
-});
-
-add_task(function testActivateRealExperiments() {
- if (!gExperiments) {
- info("Skipping experiments test because that feature isn't available.");
- return;
- }
-
- yield gExperiments._updateExperiments({
- "version": 1,
- "experiments": [
- {
- id: "experiment-2",
- xpiURL: TESTROOT + "addons/browser_experiment1.xpi",
- xpiHash: "IRRELEVANT",
- startTime: Date.now() / 1000 - 3600,
- endTime: Date.now() / 1000 + 3600,
- maxActiveSeconds: 600,
- appName: [Services.appinfo.name],
- channel: [gExperiments._policy.updatechannel()],
- },
- ],
- });
- yield gExperiments._run();
-
- // Check the active experiment.
-
- let item = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
- Assert.ok(item, "Got add-on element.");
- item.parentNode.ensureElementIsVisible(item);
-
- let el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Active");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Less than a day remaining");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "error-container");
- is_element_hidden(el, "error-container should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "warning-container");
- is_element_hidden(el, "warning-container should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "pending-container");
- is_element_hidden(el, "pending-container should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "version");
- is_element_hidden(el, "version should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "disabled-postfix");
- is_element_hidden(el, "disabled-postfix should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "update-postfix");
- is_element_hidden(el, "update-postfix should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "experiment-bullet");
- is_element_visible(el, "experiment-bullet should be visible.");
-
- // Check the previous experiment.
-
- item = get_addon_element(gManagerWindow, "experiment-1");
- Assert.ok(item, "Got add-on element.");
- item.parentNode.ensureElementIsVisible(item);
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Complete");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Less than a day ago");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "error-container");
- is_element_hidden(el, "error-container should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "warning-container");
- is_element_hidden(el, "warning-container should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "pending-container");
- is_element_hidden(el, "pending-container should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "version");
- is_element_hidden(el, "version should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "disabled-postfix");
- is_element_hidden(el, "disabled-postfix should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "update-postfix");
- is_element_hidden(el, "update-postfix should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "experiment-bullet");
- is_element_visible(el, "experiment-bullet should be visible.");
-
- // Install an "older" experiment.
-
- yield gExperiments.disableExperiment("experiment-2");
-
- let now = Date.now();
- let fakeNow = now - 5 * MS_IN_ONE_DAY;
- defineNow(gExperiments._policy, fakeNow);
-
- yield gExperiments._updateExperiments({
- "version": 1,
- "experiments": [
- {
- id: "experiment-3",
- xpiURL: TESTROOT + "addons/browser_experiment1.xpi",
- xpiHash: "IRRELEVANT",
- startTime: fakeNow / 1000 - SEC_IN_ONE_DAY,
- endTime: now / 1000 + 10 * SEC_IN_ONE_DAY,
- maxActiveSeconds: 100 * SEC_IN_ONE_DAY,
- appName: [Services.appinfo.name],
- channel: [gExperiments._policy.updatechannel()],
- },
- ],
- });
- yield gExperiments._run();
-
- // Check the active experiment.
-
- item = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
- Assert.ok(item, "Got add-on element.");
- item.parentNode.ensureElementIsVisible(item);
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Active");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "10 days remaining");
- }
-
- // Disable it and check it's previous experiment entry.
-
- yield gExperiments.disableExperiment("experiment-3");
-
- item = get_addon_element(gManagerWindow, "experiment-3");
- Assert.ok(item, "Got add-on element.");
- item.parentNode.ensureElementIsVisible(item);
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Complete");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "5 days ago");
- }
-});
-
-add_task(function testDetailView() {
- if (!gExperiments) {
- info("Skipping experiments test because that feature isn't available.");
- return;
- }
-
- defineNow(gExperiments._policy, Date.now());
- yield gExperiments._updateExperiments({
- "version": 1,
- "experiments": [
- {
- id: "experiment-4",
- xpiURL: TESTROOT + "addons/browser_experiment1.xpi",
- xpiHash: "IRRELEVANT",
- startTime: Date.now() / 1000 - 3600,
- endTime: Date.now() / 1000 + 3600,
- maxActiveSeconds: 600,
- appName: [Services.appinfo.name],
- channel: [gExperiments._policy.updatechannel()],
- },
- ],
- });
- yield gExperiments._run();
-
- // Check active experiment.
-
- yield openDetailsView("test-experiment1@experiments.mozilla.org");
-
- let el = gManagerWindow.document.getElementById("detail-experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Active");
- }
-
- el = gManagerWindow.document.getElementById("detail-experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Less than a day remaining");
- }
-
- el = gManagerWindow.document.getElementById("detail-version");
- is_element_hidden(el, "detail-version should be hidden.");
- el = gManagerWindow.document.getElementById("detail-creator");
- is_element_hidden(el, "detail-creator should be hidden.");
- el = gManagerWindow.document.getElementById("detail-experiment-bullet");
- is_element_visible(el, "experiment-bullet should be visible.");
-
- // Check previous experiment.
-
- yield gCategoryUtilities.openType("experiment");
- yield openDetailsView("experiment-3");
-
- el = gManagerWindow.document.getElementById("detail-experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Complete");
- }
-
- el = gManagerWindow.document.getElementById("detail-experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "5 days ago");
- }
-
- el = gManagerWindow.document.getElementById("detail-version");
- is_element_hidden(el, "detail-version should be hidden.");
- el = gManagerWindow.document.getElementById("detail-creator");
- is_element_hidden(el, "detail-creator should be hidden.");
- el = gManagerWindow.document.getElementById("detail-experiment-bullet");
- is_element_visible(el, "experiment-bullet should be visible.");
-});
-
-add_task(function* testRemoveAndUndo() {
- if (!gExperiments) {
- info("Skipping experiments test because that feature isn't available.");
- return;
- }
-
- yield gCategoryUtilities.openType("experiment");
-
- let addon = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
- Assert.ok(addon, "Got add-on element.");
-
- yield clickRemoveButton(addon);
- addon.parentNode.ensureElementIsVisible(addon);
-
- let el = gManagerWindow.document.getAnonymousElementByAttribute(addon, "class", "pending");
- is_element_visible(el, "Uninstall undo information should be visible.");
-
- yield clickUndoButton(addon);
- addon = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
- Assert.ok(addon, "Got add-on element.");
-});
-
-add_task(function* testCleanup() {
- if (gExperiments) {
- Services.prefs.clearUserPref("experiments.enabled");
- Services.prefs.setCharPref("experiments.manifest.uri", gSavedManifestURI);
-
- // We perform the uninit/init cycle to purge any leftover state.
- yield OS.File.remove(gExperiments._cacheFilePath);
- yield gExperiments.uninit();
- yield gExperiments.init();
- }
-
- // Check post-conditions.
- let addons = yield getExperimentAddons();
- Assert.equal(addons.length, 0, "No experiment add-ons are installed.");
-
- yield close_manager(gManagerWindow);
-});
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_const.js b/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_const.js
new file mode 100644
index 0000000000..fb02b59be9
--- /dev/null
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bootstrap_const.js
@@ -0,0 +1,17 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1");
+startupManager();
+
+add_task(function*() {
+ let sawInstall = false;
+ Services.obs.addObserver(function() {
+ sawInstall = true;
+ }, "addon-install", false);
+
+ yield promiseInstallAllFiles([do_get_addon("test_bootstrap_const")]);
+
+ ok(sawInstall);
+}); \ No newline at end of file
diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_mapURIToAddonID.js b/toolkit/mozapps/extensions/test/xpcshell/test_mapURIToAddonID.js
index a6f9c80523..a153256dcf 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/test_mapURIToAddonID.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_mapURIToAddonID.js
@@ -95,8 +95,10 @@ function run_test_early() {
"resource://gre/modules/addons/XPIProvider.jsm", {});
// Make the early API call.
- do_check_null(s.XPIProvider.mapURIToAddonID(uri));
+ // AddonManager still misses its provider and so doesn't work yet.
do_check_null(AddonManager.mapURIToAddonID(uri));
+ // But calling XPIProvider directly works immediately
+ do_check_eq(s.XPIProvider.mapURIToAddonID(uri), id);
// Actually start up the manager.
startupManager(false);
diff --git a/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini b/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini
index bab072e830..2a12f147a6 100644
--- a/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini
+++ b/toolkit/mozapps/extensions/test/xpcshell/xpcshell-shared.ini
@@ -29,6 +29,7 @@ skip-if = os == "android"
[test_bootstrap.js]
# Bug 676992: test consistently hangs on Android
skip-if = os == "android"
+[test_bootstrap_const.js]
[test_bootstrap_resource.js]
[test_bug299716.js]
# Bug 676992: test consistently hangs on Android
diff --git a/toolkit/mozapps/installer/find-dupes.py b/toolkit/mozapps/installer/find-dupes.py
index bd0561c97e..34ef675f49 100644
--- a/toolkit/mozapps/installer/find-dupes.py
+++ b/toolkit/mozapps/installer/find-dupes.py
@@ -4,15 +4,8 @@
import sys
import hashlib
-import re
-from mozbuild.preprocessor import Preprocessor
-from mozbuild.util import DefinesAction
from mozpack.packager.unpack import UnpackFinder
-from mozpack.files import DeflatedFile
from collections import OrderedDict
-from StringIO import StringIO
-import argparse
-import buildconfig
'''
Find files duplicated in a given packaged directory, independently of its
@@ -20,116 +13,36 @@ package format.
'''
-def normalize_osx_path(p):
- '''
- Strips the first 3 elements of an OSX app path
-
- >>> normalize_osx_path('Nightly.app/foo/bar/baz')
- 'baz'
- '''
- bits = p.split('/')
- if len(bits) > 3 and bits[0].endswith('.app'):
- return '/'.join(bits[3:])
- return p
-
-
-def normalize_l10n_path(p):
- '''
- Normalizes localized paths to en-US
-
- >>> normalize_l10n_path('chrome/es-ES/locale/branding/brand.properties')
- 'chrome/en-US/locale/branding/brand.properties'
- >>> normalize_l10n_path('chrome/fr/locale/fr/browser/aboutHome.dtd')
- 'chrome/en-US/locale/en-US/browser/aboutHome.dtd'
- '''
- # Keep a trailing slash here! e.g. locales like 'br' can transform
- # 'chrome/br/locale/branding/' into 'chrome/en-US/locale/en-USanding/'
- p = re.sub(r'chrome/(\S+)/locale/\1/',
- 'chrome/en-US/locale/en-US/',
- p)
- p = re.sub(r'chrome/(\S+)/locale/',
- 'chrome/en-US/locale/',
- p)
- return p
-
-
-def normalize_path(p):
- return normalize_osx_path(normalize_l10n_path(p))
-
-
-def find_dupes(source, allowed_dupes, bail=True):
- allowed_dupes = set(allowed_dupes)
+def find_dupes(source):
md5s = OrderedDict()
for p, f in UnpackFinder(source):
content = f.open().read()
m = hashlib.md5(content).digest()
- if m not in md5s:
- if isinstance(f, DeflatedFile):
- compressed = f.file.compressed_size
- else:
- compressed = len(content)
- md5s[m] = (len(content), compressed, [])
- md5s[m][2].append(p)
+ if not m in md5s:
+ md5s[m] = (len(content), [])
+ md5s[m][1].append(p)
total = 0
- total_compressed = 0
num_dupes = 0
- unexpected_dupes = []
- for m, (size, compressed, paths) in sorted(md5s.iteritems(),
- key=lambda x: x[1][1]):
+ for m, (size, paths) in md5s.iteritems():
if len(paths) > 1:
- print 'Duplicates %d bytes%s%s:' % (size,
- ' (%d compressed)' % compressed if compressed != size else '',
+ print 'Duplicates %d bytes%s:' % (size,
' (%d times)' % (len(paths) - 1) if len(paths) > 2 else '')
print ''.join(' %s\n' % p for p in paths)
total += (len(paths) - 1) * size
- total_compressed += (len(paths) - 1) * compressed
num_dupes += 1
-
- unexpected_dupes.extend([p for p in paths if normalize_path(p) not in allowed_dupes])
-
if num_dupes:
- print "WARNING: Found %d duplicated files taking %d bytes (%s)" % \
- (num_dupes, total,
- '%d compressed' % total_compressed if total_compressed != total
- else 'uncompressed')
-
- if unexpected_dupes:
- errortype = "ERROR" if bail else "WARNING"
- print "%s: The following duplicated files are not allowed:" % errortype
- print "\n".join(unexpected_dupes)
- if bail:
- sys.exit(1)
+ print "WARNING: Found %d duplicated files taking %d bytes" % \
+ (num_dupes, total) + " (uncompressed)"
def main():
- parser = argparse.ArgumentParser(description='Find duplicate files in directory.')
- parser.add_argument('--warning', '-w', action='store_true',
- help='Only warn about duplicates, do not exit with an error')
- parser.add_argument('--file', '-f', action='append', dest='dupes_files', default=[],
- help='Add exceptions to the duplicate list from this file')
- parser.add_argument('-D', action=DefinesAction)
- parser.add_argument('-U', action='append', default=[])
- parser.add_argument('directory',
- help='The directory to check for duplicates in')
-
- args = parser.parse_args()
-
- allowed_dupes = []
- for filename in args.dupes_files:
- pp = Preprocessor()
- pp.context.update(buildconfig.defines)
- if args.D:
- pp.context.update(args.D)
- for undefine in args.U:
- if undefine in pp.context:
- del pp.context[undefine]
- pp.out = StringIO()
- pp.do_filter('substitution')
- pp.do_include(filename)
- allowed_dupes.extend([line.partition('#')[0].rstrip()
- for line in pp.out.getvalue().splitlines()])
+ if len(sys.argv) != 2:
+ import os
+ print >>sys.stderr, "Usage: %s directory" % \
+ os.path.basename(sys.argv[0])
+ sys.exit(1)
- find_dupes(args.directory, bail=not args.warning, allowed_dupes=allowed_dupes)
+ find_dupes(sys.argv[1])
if __name__ == "__main__":
main()
diff --git a/toolkit/mozapps/installer/packager.mk b/toolkit/mozapps/installer/packager.mk
index 68247e7df9..71a956aa46 100644
--- a/toolkit/mozapps/installer/packager.mk
+++ b/toolkit/mozapps/installer/packager.mk
@@ -54,7 +54,7 @@ stage-package: $(MOZ_PKG_MANIFEST) $(MOZ_PKG_MANIFEST_DEPS)
$(addprefix --unify ,$(UNIFY_DIST)) \
$(MOZ_PKG_MANIFEST) $(DIST) $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)$(if $(MOZ_PKG_MANIFEST),,$(_BINPATH)) \
$(if $(filter omni,$(MOZ_PACKAGER_FORMAT)),$(if $(NON_OMNIJAR_FILES),--non-resource $(NON_OMNIJAR_FILES)))
- $(PYTHON) $(MOZILLA_DIR)/toolkit/mozapps/installer/find-dupes.py $(DEFINES) $(ACDEFINES) $(MOZ_PKG_DUPEFLAGS) $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)
+ $(PYTHON) $(MOZILLA_DIR)/toolkit/mozapps/installer/find-dupes.py $(DIST)/$(STAGEPATH)$(MOZ_PKG_DIR)
ifdef MOZ_PACKAGE_JSSHELL
# Package JavaScript Shell
@echo 'Packaging JavaScript Shell...'
diff --git a/toolkit/mozapps/preferences/changemp.js b/toolkit/mozapps/preferences/changemp.js
index 82dd201287..71664b3e15 100644
--- a/toolkit/mozapps/preferences/changemp.js
+++ b/toolkit/mozapps/preferences/changemp.js
@@ -167,8 +167,8 @@ function setPasswordStrength()
// length of the password
var pwlength=(pw.length);
- if (pwlength>5)
- pwlength=5;
+ if (pwlength>10)
+ pwlength=10;
// use of numbers in the password
@@ -190,7 +190,7 @@ function setPasswordStrength()
upper=3;
- var pwstrength=((pwlength*10)-20) + (numeric*10) + (numsymbols*15) + (upper*10);
+ var pwstrength=((pwlength*5)-20) + (numeric*10) + (numsymbols*15) + (upper*10);
// make sure we're give a value between 0 and 100
if ( pwstrength < 0 ) {
@@ -227,6 +227,12 @@ function checkPasswords()
}
}
+ // Never accept short passwords < 8 chars
+ if (pw1.length < 8) {
+ ok.setAttribute("disabled", "true");
+ return;
+ }
+
if (pw1 == pw2) {
ok.setAttribute("disabled", "false");
} else
diff --git a/toolkit/mozapps/preferences/changemp.xul b/toolkit/mozapps/preferences/changemp.xul
index 14d02295e0..b316fa42b0 100644
--- a/toolkit/mozapps/preferences/changemp.xul
+++ b/toolkit/mozapps/preferences/changemp.xul
@@ -34,7 +34,7 @@
<rows>
<row>
<label control="oldpw">&setPassword.oldPassword.label;</label>
- <textbox id="oldpw" type="password"/>
+ <textbox id="oldpw" type="password" size="18"/>
<!-- This textbox is inserted as a workaround to the fact that making the 'type'
& 'disabled' property of the 'oldpw' textbox toggle between ['password' &
'false'] and ['text' & 'true'] - as would be necessary if the menu has more
@@ -46,12 +46,13 @@
</row>
<row>
<label control="pw1">&setPassword.newPassword.label;</label>
- <textbox id="pw1" type="password"
+ <textbox id="pw1" type="password" size="18"
oninput="setPasswordStrength(); checkPasswords();"/>
</row>
<row>
<label control="pw2">&setPassword.reenterPassword.label;</label>
- <textbox id="pw2" type="password" oninput="checkPasswords();"/>
+ <textbox id="pw2" type="password" size="18"
+ oninput="checkPasswords();"/>
</row>
</rows>
</grid>
diff --git a/toolkit/mozapps/webextensions/content/extensions.js b/toolkit/mozapps/webextensions/content/extensions.js
index 5e428fe175..3159eb1e14 100644
--- a/toolkit/mozapps/webextensions/content/extensions.js
+++ b/toolkit/mozapps/webextensions/content/extensions.js
@@ -29,9 +29,6 @@ XPCOMUtils.defineLazyModuleGetter(this, "PluralForm",
XPCOMUtils.defineLazyModuleGetter(this, "Preferences",
"resource://gre/modules/Preferences.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "Experiments",
- "resource:///modules/experiments/Experiments.jsm");
-
const PREF_DISCOVERURL = "extensions.webservice.discoverURL";
const PREF_DISCOVER_ENABLED = "extensions.getAddons.showPane";
const PREF_XPI_ENABLED = "xpinstall.enabled";
@@ -297,23 +294,6 @@ function isDiscoverEnabled() {
return true;
}
-function getExperimentEndDate(aAddon) {
- if (!("@mozilla.org/browser/experiments-service;1" in Cc)) {
- return 0;
- }
-
- if (!aAddon.isActive) {
- return aAddon.endDate;
- }
-
- let experiment = Experiments.instance().getActiveExperiment();
- if (!experiment) {
- return 0;
- }
-
- return experiment.endDate;
-}
-
/**
* Obtain the main DOMWindow for the current context.
*/
@@ -1444,27 +1424,6 @@ var gViewController = {
}
},
- cmd_experimentsLearnMore: {
- isEnabled: function() {
- let mainWindow = getMainWindow();
- return mainWindow && "switchToTabHavingURI" in mainWindow;
- },
- doCommand: function() {
- let url = Services.prefs.getCharPref("toolkit.telemetry.infoURL");
- openOptionsInTab(url);
- },
- },
-
- cmd_experimentsOpenTelemetryPreferences: {
- isEnabled: function() {
- return !!getMainWindowWithPreferencesPane();
- },
- doCommand: function() {
- let mainWindow = getMainWindowWithPreferencesPane();
- mainWindow.openAdvancedPreferences("dataChoicesTab");
- },
- },
-
cmd_showUnsignedExtensions: {
isEnabled: function() {
return true;
@@ -1577,10 +1536,6 @@ function shouldShowVersionNumber(aAddon) {
if (!aAddon.version)
return false;
- // The version number is hidden for experiments.
- if (aAddon.type == "experiment")
- return false;
-
// The version number is hidden for lightweight themes.
if (aAddon.type == "theme")
return !/@personas\.mozilla\.org$/.test(aAddon.id);
@@ -1614,10 +1569,6 @@ function createItem(aObj, aIsInstall, aIsRemote) {
// the binding handles the rest
item.setAttribute("value", aObj.id);
- if (aObj.type == "experiment") {
- item.endDate = getExperimentEndDate(aObj);
- }
-
return item;
}
@@ -2861,13 +2812,6 @@ var gListView = {
// the existing item
if (aInstall.existingAddon)
this.removeItem(aInstall, true);
-
- if (aInstall.addon.type == "experiment") {
- let item = this.getListItemForID(aInstall.addon.id);
- if (item) {
- item.endDate = getExperimentEndDate(aInstall.addon);
- }
- }
},
addItem: function(aObj, aIsInstall) {
@@ -3126,34 +3070,6 @@ var gDetailView = {
}
}
- if (this._addon.type == "experiment") {
- let prefix = "details.experiment.";
- let active = this._addon.isActive;
-
- let stateKey = prefix + "state." + (active ? "active" : "complete");
- let node = document.getElementById("detail-experiment-state");
- node.value = gStrings.ext.GetStringFromName(stateKey);
-
- let now = Date.now();
- let end = getExperimentEndDate(this._addon);
- let days = Math.abs(end - now) / (24 * 60 * 60 * 1000);
-
- let timeKey = prefix + "time.";
- let timeMessage;
- if (days < 1) {
- timeKey += (active ? "endsToday" : "endedToday");
- timeMessage = gStrings.ext.GetStringFromName(timeKey);
- } else {
- timeKey += (active ? "daysRemaining" : "daysPassed");
- days = Math.round(days);
- let timeString = gStrings.ext.GetStringFromName(timeKey);
- timeMessage = PluralForm.get(days, timeString)
- .replace("#1", days);
- }
-
- document.getElementById("detail-experiment-time").value = timeMessage;
- }
-
this.fillSettingsRows(aScrollToPreferences, (function() {
this.updateState();
gViewController.notifyViewChanged();
diff --git a/toolkit/mozapps/webextensions/internal/XPIProvider.jsm b/toolkit/mozapps/webextensions/internal/XPIProvider.jsm
index 87e09cef18..7c3cb6763b 100644
--- a/toolkit/mozapps/webextensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/webextensions/internal/XPIProvider.jsm
@@ -175,6 +175,8 @@ const RDFURI_INSTALL_MANIFEST_ROOT = "urn:mozilla:install-manifest";
const PREFIX_NS_EM = "http://www.mozilla.org/2004/em-rdf#";
const TOOLKIT_ID = "toolkit@mozilla.org";
+const WEBEXTENSIONS_ID = "webextensions@mozilla.org";
+const WEBEXTENSIONS_VERSION = "52.0";
const XPI_SIGNATURE_CHECK_PERIOD = 24 * 60 * 60;
@@ -1037,7 +1039,7 @@ var loadManifestFromWebManifest = Task.async(function*(aUri) {
delete addon.defaultLocale.locales;
addon.targetApplications = [{
- id: TOOLKIT_ID,
+ id: WEBEXTENSIONS_ID,
minVersion: bss.strict_min_version,
maxVersion: bss.strict_max_version,
}];
@@ -7228,6 +7230,8 @@ AddonInternal.prototype = {
version = aAppVersion;
else if (app.id == TOOLKIT_ID)
version = aPlatformVersion
+ else if (app.id == WEBEXTENSIONS_ID)
+ version = WEBEXTENSIONS_VERSION
// Only extensions and dictionaries can be compatible by default; themes
// and language packs always use strict compatibility checking.
@@ -7250,7 +7254,7 @@ AddonInternal.prototype = {
let minCompatVersion;
if (app.id == Services.appinfo.ID)
minCompatVersion = XPIProvider.minCompatibleAppVersion;
- else if (app.id == TOOLKIT_ID)
+ else if (app.id == TOOLKIT_ID || app.id == WEBEXTENSIONS_ID)
minCompatVersion = XPIProvider.minCompatiblePlatformVersion;
if (minCompatVersion &&
@@ -7269,7 +7273,7 @@ AddonInternal.prototype = {
for (let targetApp of this.targetApplications) {
if (targetApp.id == Services.appinfo.ID)
return targetApp;
- if (targetApp.id == TOOLKIT_ID)
+ if (targetApp.id == TOOLKIT_ID || targetApp.id == WEBEXTENSIONS_ID)
app = targetApp;
}
return app;
diff --git a/toolkit/mozapps/webextensions/test/browser/browser-common.ini b/toolkit/mozapps/webextensions/test/browser/browser-common.ini
index eda266e2f3..83920465b6 100644
--- a/toolkit/mozapps/webextensions/test/browser/browser-common.ini
+++ b/toolkit/mozapps/webextensions/test/browser/browser-common.ini
@@ -34,7 +34,6 @@ skip-if = true # Bug 1093190 - Disabled due to leak
[browser_discovery.js]
[browser_dragdrop.js]
skip-if = buildapp == 'mulet'
-[browser_experiments.js]
[browser_list.js]
[browser_metadataTimeout.js]
[browser_searching.js]
diff --git a/toolkit/mozapps/webextensions/test/browser/browser_experiments.js b/toolkit/mozapps/webextensions/test/browser/browser_experiments.js
deleted file mode 100644
index 18a548de55..0000000000
--- a/toolkit/mozapps/webextensions/test/browser/browser_experiments.js
+++ /dev/null
@@ -1,654 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-Components.utils.import("resource://gre/modules/Promise.jsm", this);
-
-var {AddonManagerTesting} = Components.utils.import("resource://testing-common/AddonManagerTesting.jsm", {});
-var {HttpServer} = Components.utils.import("resource://testing-common/httpd.js", {});
-
-var gManagerWindow;
-var gCategoryUtilities;
-var gExperiments;
-var gHttpServer;
-
-var gSavedManifestURI;
-var gIsEnUsLocale;
-
-const SEC_IN_ONE_DAY = 24 * 60 * 60;
-const MS_IN_ONE_DAY = SEC_IN_ONE_DAY * 1000;
-
-function getExperimentAddons() {
- let deferred = Promise.defer();
- AddonManager.getAddonsByTypes(["experiment"], (addons) => {
- deferred.resolve(addons);
- });
- return deferred.promise;
-}
-
-function getInstallItem() {
- let doc = gManagerWindow.document;
- let view = get_current_view(gManagerWindow);
- let list = doc.getElementById("addon-list");
-
- let node = list.firstChild;
- while (node) {
- if (node.getAttribute("status") == "installing") {
- return node;
- }
- node = node.nextSibling;
- }
-
- return null;
-}
-
-function patchPolicy(policy, data) {
- for (let key of Object.keys(data)) {
- Object.defineProperty(policy, key, {
- value: data[key],
- writable: true,
- });
- }
-}
-
-function defineNow(policy, time) {
- patchPolicy(policy, { now: () => new Date(time) });
-}
-
-function openDetailsView(aId) {
- let item = get_addon_element(gManagerWindow, aId);
- Assert.ok(item, "Should have got add-on element.");
- is_element_visible(item, "Add-on element should be visible.");
-
- EventUtils.synthesizeMouseAtCenter(item, { clickCount: 1 }, gManagerWindow);
- EventUtils.synthesizeMouseAtCenter(item, { clickCount: 2 }, gManagerWindow);
-
- let deferred = Promise.defer();
- wait_for_view_load(gManagerWindow, deferred.resolve);
- return deferred.promise;
-}
-
-function clickRemoveButton(addonElement) {
- let btn = gManagerWindow.document.getAnonymousElementByAttribute(addonElement, "anonid", "remove-btn");
- if (!btn) {
- return Promise.reject();
- }
-
- EventUtils.synthesizeMouseAtCenter(btn, { clickCount: 1 }, gManagerWindow);
- let deferred = Promise.defer();
- setTimeout(deferred.resolve, 0);
- return deferred;
-}
-
-function clickUndoButton(addonElement) {
- let btn = gManagerWindow.document.getAnonymousElementByAttribute(addonElement, "anonid", "undo-btn");
- if (!btn) {
- return Promise.reject();
- }
-
- EventUtils.synthesizeMouseAtCenter(btn, { clickCount: 1 }, gManagerWindow);
- let deferred = Promise.defer();
- setTimeout(deferred.resolve, 0);
- return deferred;
-}
-
-add_task(function* initializeState() {
- gManagerWindow = yield open_manager();
- gCategoryUtilities = new CategoryUtilities(gManagerWindow);
-
- registerCleanupFunction(() => {
- Services.prefs.clearUserPref("experiments.enabled");
- Services.prefs.clearUserPref("toolkit.telemetry.enabled");
- if (gHttpServer) {
- gHttpServer.stop(() => {});
- if (gSavedManifestURI !== undefined) {
- Services.prefs.setCharPref("experments.manifest.uri", gSavedManifestURI);
- }
- }
- if (gExperiments) {
- let tmp = {};
- Cu.import("resource:///modules/experiments/Experiments.jsm", tmp);
- gExperiments._policy = new tmp.Experiments.Policy();
- }
- });
-
- let chrome = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIXULChromeRegistry);
- gIsEnUsLocale = chrome.getSelectedLocale("global") == "en-US";
-
- // The Experiments Manager will interfere with us by preventing installs
- // of experiments it doesn't know about. We remove it from the equation
- // because here we are only concerned with core Addon Manager operation,
- // not the superset Experiments Manager has imposed.
- if ("@mozilla.org/browser/experiments-service;1" in Components.classes) {
- let tmp = {};
- Cu.import("resource:///modules/experiments/Experiments.jsm", tmp);
- // There is a race condition between XPCOM service initialization and
- // this test running. We have to initialize the instance first, then
- // uninitialize it to prevent this.
- gExperiments = tmp.Experiments.instance();
- yield gExperiments._mainTask;
- yield gExperiments.uninit();
- }
-});
-
-// On an empty profile with no experiments, the experiment category
-// should be hidden.
-add_task(function* testInitialState() {
- Assert.ok(gCategoryUtilities.get("experiment", false), "Experiment tab is defined.");
- Assert.ok(!gCategoryUtilities.isTypeVisible("experiment"), "Experiment tab hidden by default.");
-});
-
-add_task(function* testExperimentInfoNotVisible() {
- yield gCategoryUtilities.openType("extension");
- let el = gManagerWindow.document.getElementsByClassName("experiment-info-container")[0];
- is_element_hidden(el, "Experiment info not visible on other types.");
-});
-
-// If we have an active experiment, we should see the experiments tab
-// and that tab should have some messages.
-add_task(function* testActiveExperiment() {
- let addon = yield install_addon("addons/browser_experiment1.xpi");
-
- Assert.ok(addon.userDisabled, "Add-on is disabled upon initial install.");
- Assert.equal(addon.isActive, false, "Add-on is not active.");
-
- Assert.ok(gCategoryUtilities.isTypeVisible("experiment"), "Experiment tab visible.");
-
- yield gCategoryUtilities.openType("experiment");
- let el = gManagerWindow.document.getElementsByClassName("experiment-info-container")[0];
- is_element_visible(el, "Experiment info is visible on experiment tab.");
-});
-
-add_task(function* testExperimentLearnMore() {
- // Actual URL is irrelevant.
- Services.prefs.setCharPref("toolkit.telemetry.infoURL",
- "http://mochi.test:8888/server.js");
-
- yield gCategoryUtilities.openType("experiment");
- let btn = gManagerWindow.document.getElementById("experiments-learn-more");
-
- if (!gUseInContentUI) {
- is_element_hidden(btn, "Learn more button hidden if not using in-content UI.");
- Services.prefs.clearUserPref("toolkit.telemetry.infoURL");
-
- return;
- }
-
- is_element_visible(btn, "Learn more button visible.");
-
- let deferred = Promise.defer();
- window.addEventListener("DOMContentLoaded", function onLoad(event) {
- info("Telemetry privacy policy window opened.");
- window.removeEventListener("DOMContentLoaded", onLoad, false);
-
- let browser = gBrowser.selectedBrowser;
- let expected = Services.prefs.getCharPref("toolkit.telemetry.infoURL");
- Assert.equal(browser.currentURI.spec, expected, "New tab should have loaded privacy policy.");
- browser.contentWindow.close();
-
- Services.prefs.clearUserPref("toolkit.telemetry.infoURL");
-
- deferred.resolve();
- }, false);
-
- info("Opening telemetry privacy policy.");
- EventUtils.synthesizeMouseAtCenter(btn, {}, gManagerWindow);
-
- yield deferred.promise;
-});
-
-add_task(function* testOpenPreferences() {
- yield gCategoryUtilities.openType("experiment");
- let btn = gManagerWindow.document.getElementById("experiments-change-telemetry");
- if (!gUseInContentUI) {
- is_element_hidden(btn, "Change telemetry button not enabled in out of window UI.");
- info("Skipping preferences open test because not using in-content UI.");
- return;
- }
-
- is_element_visible(btn, "Change telemetry button visible in in-content UI.");
-
- let deferred = Promise.defer();
- Services.obs.addObserver(function observer(prefWin, topic, data) {
- Services.obs.removeObserver(observer, "advanced-pane-loaded");
- info("Advanced preference pane opened.");
- executeSoon(function() {
- // We want this test to fail if the preferences pane changes.
- let el = prefWin.document.getElementById("dataChoicesPanel");
- is_element_visible(el);
-
- prefWin.close();
- info("Closed preferences pane.");
-
- deferred.resolve();
- });
- }, "advanced-pane-loaded", false);
-
- info("Loading preferences pane.");
- // We need to focus before synthesizing the mouse event (bug 1240052) as
- // synthesizeMouseAtCenter currently only synthesizes the mouse in the child process.
- // This can cause some subtle differences if the child isn't focused.
- yield SimpleTest.promiseFocus();
- yield BrowserTestUtils.synthesizeMouseAtCenter("#experiments-change-telemetry", {},
- gBrowser.selectedBrowser);
-
- yield deferred.promise;
-});
-
-add_task(function* testButtonPresence() {
- yield gCategoryUtilities.openType("experiment");
- let item = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
- Assert.ok(item, "Got add-on element.");
- item.parentNode.ensureElementIsVisible(item);
-
- let el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
- // Corresponds to the uninstall permission.
- is_element_visible(el, "Remove button is visible.");
- // Corresponds to lack of disable permission.
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "disable-btn");
- is_element_hidden(el, "Disable button not visible.");
- // Corresponds to lack of enable permission.
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "enable-btn");
- is_element_hidden(el, "Enable button not visible.");
-});
-
-// Remove the add-on we've been testing with.
-add_task(function* testCleanup() {
- yield AddonManagerTesting.uninstallAddonByID("test-experiment1@experiments.mozilla.org");
- // Verify some conditions, just in case.
- let addons = yield getExperimentAddons();
- Assert.equal(addons.length, 0, "No experiment add-ons are installed.");
-});
-
-// The following tests should ideally live in browser/experiments/. However,
-// they rely on some of the helper functions from head.js, which can't easily
-// be consumed from other directories. So, they live here.
-
-add_task(function* testActivateExperiment() {
- if (!gExperiments) {
- info("Skipping experiments test because that feature isn't available.");
- return;
- }
-
- gHttpServer = new HttpServer();
- gHttpServer.start(-1);
- let root = "http://localhost:" + gHttpServer.identity.primaryPort + "/";
- gHttpServer.registerPathHandler("/manifest", (request, response) => {
- response.setStatusLine(null, 200, "OK");
- response.write(JSON.stringify({
- "version": 1,
- "experiments": [
- {
- id: "experiment-1",
- xpiURL: TESTROOT + "addons/browser_experiment1.xpi",
- xpiHash: "IRRELEVANT",
- startTime: Date.now() / 1000 - 3600,
- endTime: Date.now() / 1000 + 3600,
- maxActiveSeconds: 600,
- appName: [Services.appinfo.name],
- channel: [gExperiments._policy.updatechannel()],
- },
- ],
- }));
- response.processAsync();
- response.finish();
- });
-
- gSavedManifestURI = Services.prefs.getCharPref("experiments.manifest.uri");
- Services.prefs.setCharPref("experiments.manifest.uri", root + "manifest");
-
- // We need to remove the cache file to help ensure consistent state.
- yield OS.File.remove(gExperiments._cacheFilePath);
-
- Services.prefs.setBoolPref("toolkit.telemetry.enabled", true);
- Services.prefs.setBoolPref("experiments.enabled", true);
-
- info("Initializing experiments service.");
- yield gExperiments.init();
- info("Experiments service finished first run.");
-
- // Check conditions, just to be sure.
- let experiments = yield gExperiments.getExperiments();
- Assert.equal(experiments.length, 0, "No experiments known to the service.");
-
- // This makes testing easier.
- gExperiments._policy.ignoreHashes = true;
-
- info("Manually updating experiments manifest.");
- yield gExperiments.updateManifest();
- info("Experiments update complete.");
-
- let deferred = Promise.defer();
- gHttpServer.stop(() => {
- gHttpServer = null;
-
- info("getting experiment by ID");
- AddonManager.getAddonByID("test-experiment1@experiments.mozilla.org", (addon) => {
- Assert.ok(addon, "Add-on installed via Experiments manager.");
-
- deferred.resolve();
- });
- });
-
- yield deferred.promise;
-
- Assert.ok(gCategoryUtilities.isTypeVisible, "experiment", "Experiment tab visible.");
- yield gCategoryUtilities.openType("experiment");
- let el = gManagerWindow.document.getElementsByClassName("experiment-info-container")[0];
- is_element_visible(el, "Experiment info is visible on experiment tab.");
-});
-
-add_task(function* testDeactivateExperiment() {
- if (!gExperiments) {
- return;
- }
-
- // Fake an empty manifest to purge data from previous manifest.
- yield gExperiments._updateExperiments({
- "version": 1,
- "experiments": [],
- });
-
- yield gExperiments.disableExperiment("testing");
-
- // We should have a record of the previously-active experiment.
- let experiments = yield gExperiments.getExperiments();
- Assert.equal(experiments.length, 1, "1 experiment is known.");
- Assert.equal(experiments[0].active, false, "Experiment is not active.");
-
- // We should have a previous experiment in the add-ons manager.
- let deferred = Promise.defer();
- AddonManager.getAddonsByTypes(["experiment"], (addons) => {
- deferred.resolve(addons);
- });
- let addons = yield deferred.promise;
- Assert.equal(addons.length, 1, "1 experiment add-on known.");
- Assert.ok(addons[0].appDisabled, "It is a previous experiment.");
- Assert.equal(addons[0].id, "experiment-1", "Add-on ID matches expected.");
-
- // Verify the UI looks sane.
-
- Assert.ok(gCategoryUtilities.isTypeVisible("experiment"), "Experiment tab visible.");
- let item = get_addon_element(gManagerWindow, "experiment-1");
- Assert.ok(item, "Got add-on element.");
- Assert.ok(!item.active, "Element should not be active.");
- item.parentNode.ensureElementIsVisible(item);
-
- // User control buttons should not be present because previous experiments
- // should have no permissions.
- let el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "remove-btn");
- is_element_hidden(el, "Remove button is not visible.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "disable-btn");
- is_element_hidden(el, "Disable button is not visible.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "enable-btn");
- is_element_hidden(el, "Enable button is not visible.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "preferences-btn");
- is_element_hidden(el, "Preferences button is not visible.");
-});
-
-add_task(function* testActivateRealExperiments() {
- if (!gExperiments) {
- info("Skipping experiments test because that feature isn't available.");
- return;
- }
-
- yield gExperiments._updateExperiments({
- "version": 1,
- "experiments": [
- {
- id: "experiment-2",
- xpiURL: TESTROOT + "addons/browser_experiment1.xpi",
- xpiHash: "IRRELEVANT",
- startTime: Date.now() / 1000 - 3600,
- endTime: Date.now() / 1000 + 3600,
- maxActiveSeconds: 600,
- appName: [Services.appinfo.name],
- channel: [gExperiments._policy.updatechannel()],
- },
- ],
- });
- yield gExperiments._run();
-
- // Check the active experiment.
-
- let item = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
- Assert.ok(item, "Got add-on element.");
- item.parentNode.ensureElementIsVisible(item);
-
- let el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Active");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Less than a day remaining");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "error-container");
- is_element_hidden(el, "error-container should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "warning-container");
- is_element_hidden(el, "warning-container should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "pending-container");
- is_element_hidden(el, "pending-container should be hidden.");
- let { version } = yield get_tooltip_info(item);
- Assert.equal(version, undefined, "version should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "disabled-postfix");
- is_element_hidden(el, "disabled-postfix should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "update-postfix");
- is_element_hidden(el, "update-postfix should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "experiment-bullet");
- is_element_visible(el, "experiment-bullet should be visible.");
-
- // Check the previous experiment.
-
- item = get_addon_element(gManagerWindow, "experiment-1");
- Assert.ok(item, "Got add-on element.");
- item.parentNode.ensureElementIsVisible(item);
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Complete");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Less than a day ago");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "error-container");
- is_element_hidden(el, "error-container should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "warning-container");
- is_element_hidden(el, "warning-container should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "pending-container");
- is_element_hidden(el, "pending-container should be hidden.");
- ({ version } = yield get_tooltip_info(item));
- Assert.equal(version, undefined, "version should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "disabled-postfix");
- is_element_hidden(el, "disabled-postfix should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "update-postfix");
- is_element_hidden(el, "update-postfix should be hidden.");
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "class", "experiment-bullet");
- is_element_visible(el, "experiment-bullet should be visible.");
-
- // Install an "older" experiment.
-
- yield gExperiments.disableExperiment("experiment-2");
-
- let now = Date.now();
- let fakeNow = now - 5 * MS_IN_ONE_DAY;
- defineNow(gExperiments._policy, fakeNow);
-
- yield gExperiments._updateExperiments({
- "version": 1,
- "experiments": [
- {
- id: "experiment-3",
- xpiURL: TESTROOT + "addons/browser_experiment1.xpi",
- xpiHash: "IRRELEVANT",
- startTime: fakeNow / 1000 - SEC_IN_ONE_DAY,
- endTime: now / 1000 + 10 * SEC_IN_ONE_DAY,
- maxActiveSeconds: 100 * SEC_IN_ONE_DAY,
- appName: [Services.appinfo.name],
- channel: [gExperiments._policy.updatechannel()],
- },
- ],
- });
- yield gExperiments._run();
-
- // Check the active experiment.
-
- item = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
- Assert.ok(item, "Got add-on element.");
- item.parentNode.ensureElementIsVisible(item);
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Active");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "10 days remaining");
- }
-
- // Disable it and check it's previous experiment entry.
-
- yield gExperiments.disableExperiment("experiment-3");
-
- item = get_addon_element(gManagerWindow, "experiment-3");
- Assert.ok(item, "Got add-on element.");
- item.parentNode.ensureElementIsVisible(item);
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Complete");
- }
-
- el = item.ownerDocument.getAnonymousElementByAttribute(item, "anonid", "experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "5 days ago");
- }
-});
-
-add_task(function* testDetailView() {
- if (!gExperiments) {
- info("Skipping experiments test because that feature isn't available.");
- return;
- }
-
- defineNow(gExperiments._policy, Date.now());
- yield gExperiments._updateExperiments({
- "version": 1,
- "experiments": [
- {
- id: "experiment-4",
- xpiURL: TESTROOT + "addons/browser_experiment1.xpi",
- xpiHash: "IRRELEVANT",
- startTime: Date.now() / 1000 - 3600,
- endTime: Date.now() / 1000 + 3600,
- maxActiveSeconds: 600,
- appName: [Services.appinfo.name],
- channel: [gExperiments._policy.updatechannel()],
- },
- ],
- });
- yield gExperiments._run();
-
- // Check active experiment.
-
- yield openDetailsView("test-experiment1@experiments.mozilla.org");
-
- let el = gManagerWindow.document.getElementById("detail-experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Active");
- }
-
- el = gManagerWindow.document.getElementById("detail-experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Less than a day remaining");
- }
-
- el = gManagerWindow.document.getElementById("detail-version");
- is_element_hidden(el, "detail-version should be hidden.");
- el = gManagerWindow.document.getElementById("detail-creator");
- is_element_hidden(el, "detail-creator should be hidden.");
- el = gManagerWindow.document.getElementById("detail-experiment-bullet");
- is_element_visible(el, "experiment-bullet should be visible.");
-
- // Check previous experiment.
-
- yield gCategoryUtilities.openType("experiment");
- yield openDetailsView("experiment-3");
-
- el = gManagerWindow.document.getElementById("detail-experiment-state");
- is_element_visible(el, "Experiment state label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "Complete");
- }
-
- el = gManagerWindow.document.getElementById("detail-experiment-time");
- is_element_visible(el, "Experiment time label should be visible.");
- if (gIsEnUsLocale) {
- Assert.equal(el.value, "5 days ago");
- }
-
- el = gManagerWindow.document.getElementById("detail-version");
- is_element_hidden(el, "detail-version should be hidden.");
- el = gManagerWindow.document.getElementById("detail-creator");
- is_element_hidden(el, "detail-creator should be hidden.");
- el = gManagerWindow.document.getElementById("detail-experiment-bullet");
- is_element_visible(el, "experiment-bullet should be visible.");
-});
-
-add_task(function* testRemoveAndUndo() {
- if (!gExperiments) {
- info("Skipping experiments test because that feature isn't available.");
- return;
- }
-
- yield gCategoryUtilities.openType("experiment");
-
- let addon = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
- Assert.ok(addon, "Got add-on element.");
-
- yield clickRemoveButton(addon);
- addon.parentNode.ensureElementIsVisible(addon);
-
- let el = gManagerWindow.document.getAnonymousElementByAttribute(addon, "class", "pending");
- is_element_visible(el, "Uninstall undo information should be visible.");
-
- yield clickUndoButton(addon);
- addon = get_addon_element(gManagerWindow, "test-experiment1@experiments.mozilla.org");
- Assert.ok(addon, "Got add-on element.");
-});
-
-add_task(function* testCleanup() {
- if (gExperiments) {
- Services.prefs.clearUserPref("experiments.enabled");
- Services.prefs.setCharPref("experiments.manifest.uri", gSavedManifestURI);
-
- // We perform the uninit/init cycle to purge any leftover state.
- yield OS.File.remove(gExperiments._cacheFilePath);
- yield gExperiments.uninit();
- yield gExperiments.init();
-
- Services.prefs.clearUserPref("toolkit.telemetry.enabled");
- }
-
- // Check post-conditions.
- let addons = yield getExperimentAddons();
- Assert.equal(addons.length, 0, "No experiment add-ons are installed.");
-
- yield close_manager(gManagerWindow);
-});
diff --git a/toolkit/pluginproblem/content/pluginProblemBinding.css b/toolkit/pluginproblem/content/pluginProblemBinding.css
index 48506de344..a545e3ebae 100644
--- a/toolkit/pluginproblem/content/pluginProblemBinding.css
+++ b/toolkit/pluginproblem/content/pluginProblemBinding.css
@@ -19,6 +19,11 @@ object:-moz-handler-crashed,
object:-moz-handler-clicktoplay,
object:-moz-handler-vulnerable-updatable,
object:-moz-handler-vulnerable-no-update {
+%ifdef MC_PALEMOON
+ /* Initialize the overlay with visibility:hidden to prevent flickering if
+ * the plugin is too small to show the overlay */
+ visibility: hidden;
+%endif
display: inline-block;
overflow: hidden;
opacity: 1 !important;
diff --git a/toolkit/pluginproblem/content/pluginProblemContent.css b/toolkit/pluginproblem/content/pluginProblemContent.css
index 43a9f52dcb..cf8755635c 100644
--- a/toolkit/pluginproblem/content/pluginProblemContent.css
+++ b/toolkit/pluginproblem/content/pluginProblemContent.css
@@ -51,6 +51,7 @@ a .mainBox:focus,
line-height: initial;
}
+%ifndef MC_PALEMOON
/* Initialize the overlay with visibility:hidden to prevent flickering if
* the plugin is too small to show the overlay */
.mainBox > .hoverBox,
@@ -62,6 +63,7 @@ a .mainBox:focus,
.visible > .closeIcon {
visibility: visible;
}
+%endif
.mainBox[chromedir="rtl"] {
direction: rtl;
@@ -97,6 +99,10 @@ a .msgTapToPlay,
:-moz-handler-blocked .msgBlocked,
:-moz-handler-crashed .msgCrashed {
display: block;
+ position: relative;
+ left: 0;
+ top: 0;
+ z-index: 9999;
}
.submitStatus[status] {
diff --git a/toolkit/pluginproblem/jar.mn b/toolkit/pluginproblem/jar.mn
index d0af1c82fb..c027793ded 100644
--- a/toolkit/pluginproblem/jar.mn
+++ b/toolkit/pluginproblem/jar.mn
@@ -5,6 +5,6 @@
toolkit.jar:
% content pluginproblem %pluginproblem/ contentaccessible=yes
pluginproblem/pluginProblem.xml (content/pluginProblem.xml)
- pluginproblem/pluginProblemContent.css (content/pluginProblemContent.css)
- pluginproblem/pluginProblemBinding.css (content/pluginProblemBinding.css)
+* pluginproblem/pluginProblemContent.css (content/pluginProblemContent.css)
+* pluginproblem/pluginProblemBinding.css (content/pluginProblemBinding.css)
pluginproblem/pluginReplaceBinding.css (content/pluginReplaceBinding.css)
diff --git a/toolkit/profile/nsProfileLock.cpp b/toolkit/profile/nsProfileLock.cpp
index 08d1092241..cc9ecb62eb 100644
--- a/toolkit/profile/nsProfileLock.cpp
+++ b/toolkit/profile/nsProfileLock.cpp
@@ -30,7 +30,7 @@
#include "prenv.h"
#endif
-#if defined(MOZ_WIDGET_GONK) && !defined(MOZ_CRASHREPORTER)
+#if defined(MOZ_WIDGET_GONK)
#include <sys/syscall.h>
#endif
@@ -198,7 +198,6 @@ void nsProfileLock::FatalSignalHandler(int signo
case SIGILL:
case SIGABRT:
case SIGSEGV:
-#ifndef MOZ_CRASHREPORTER
// Retrigger the signal for those that can generate a core dump
signal(signo, SIG_DFL);
if (info->si_code <= 0) {
@@ -206,7 +205,6 @@ void nsProfileLock::FatalSignalHandler(int signo
break;
}
}
-#endif
return;
default:
break;
diff --git a/toolkit/themes/linux/global/findBar.css b/toolkit/themes/linux/global/findBar.css
index f049114024..e3e2ad0865 100644
--- a/toolkit/themes/linux/global/findBar.css
+++ b/toolkit/themes/linux/global/findBar.css
@@ -7,6 +7,7 @@
findbar {
border-top: 2px solid;
-moz-border-top-colors: ThreeDShadow ThreeDHighlight;
+ padding-bottom: 1px;
min-width: 1px;
transition-property: margin-bottom, opacity, visibility;
transition-duration: 150ms, 150ms, 0s;
@@ -22,138 +23,66 @@ findbar[hidden] {
transition-delay: 0s, 0s, 150ms;
}
-findbar[noanim] {
- transition-duration: 0s !important;
- transition-delay: 0s !important;
-}
-
-.findbar-container {
- padding-inline-start: 8px;
- padding-top: 4px;
- padding-bottom: 4px;
-}
-
-.findbar-closebutton {
- -moz-appearance: none;
- width: 16px;
- height: 16px;
- margin: 0 8px;
-}
-
-/* Search field */
-
-.findbar-textbox {
- -moz-appearance: none;
- border: 1px solid ThreeDShadow;
- box-shadow: 0 0 1px 0 ThreeDShadow inset;
- margin: 0;
- padding: 5px;
- width: 14em;
-}
-
-.findbar-textbox:-moz-locale-dir(ltr) {
- border-radius: 3px 0 0 3px;
- border-right-width: 0;
-}
-
-.findbar-textbox:-moz-locale-dir(rtl) {
- border-radius: 0 3px 3px 0;
- border-left-width: 0;
-}
-
-.findbar-textbox[focused="true"] {
- border-color: Highlight;
- box-shadow: 0 0 1px 0 Highlight inset;
-}
-
-.findbar-textbox[status="notfound"] {
- background-color: #f66;
- color: white;
-}
-
-.findbar-textbox[flash="true"] {
- background-color: yellow;
- color: black;
-}
-
-.findbar-textbox.minimal {
- border-width: 1px;
- border-radius: 3px;
-}
-
-.findbar-find-previous,
-.findbar-find-next {
- margin-inline-start: 0;
- -moz-appearance: none;
- background: linear-gradient(rgba(255,255,255,.8) 1px, rgba(255,255,255,.4) 1px, rgba(255,255,255,.1));
- border: 1px solid ThreeDShadow;
- padding: 5px 9px;
- line-height: 1em;
-}
+/* find-next button */
-.findbar-find-previous:focus,
-.findbar-find-next:focus {
- border-color: Highlight;
- box-shadow: 0 0 1px 0 Highlight inset;
+.findbar-find-next > .toolbarbutton-icon {
+ -moz-appearance: button-arrow-next;
}
-.findbar-find-previous:not([disabled]):active,
-.findbar-find-next:not([disabled]):active {
- background: rgba(23,50,76,.2);
- border: 1px solid ThreeDShadow;
- box-shadow: 0 1px 2px rgba(10,31,51,.2) inset;
-}
+/* find-previous button */
-.findbar-find-previous {
- list-style-image: url(chrome://global/skin/icons/find-arrows.svg#glyph-find-previous);
- border-inline-end-width: 0;
+.findbar-find-previous > .toolbarbutton-icon {
+ -moz-appearance: button-arrow-previous;
}
-.findbar-find-next {
- list-style-image: url(chrome://global/skin/icons/find-arrows.svg#glyph-find-next);
-}
+/* highlight button */
-.findbar-find-previous > .toolbarbutton-icon,
-.findbar-find-next > .toolbarbutton-icon {
- margin: 0;
+.findbar-highlight {
+ list-style-image: url("chrome://global/skin/icons/find.png");
+ -moz-image-region: rect(0px, 16px, 16px, 0px);
}
-.findbar-find-previous[disabled="true"] > .toolbarbutton-icon,
-.findbar-find-next[disabled="true"] > .toolbarbutton-icon {
- opacity: .5;
+.findbar-highlight[disabled="true"] {
+ -moz-image-region: rect(16px, 16px, 32px, 0px);
}
-.findbar-find-next:-moz-locale-dir(ltr) {
- border-top-right-radius: 2px;
- border-bottom-right-radius: 2px;
+.find-status-icon {
+ list-style-image: none;
+ margin-top: 2px;
+ margin-bottom: 0;
+ -moz-margin-start: 12px;
+ -moz-margin-end: 0;
+ width: 16px;
+ height: 16px;
}
-.findbar-find-next:-moz-locale-dir(rtl) {
- border-top-left-radius: 2px;
- border-bottom-left-radius: 2px;
+.findbar-find-status,
+.findbar-matches {
+ margin-top: 0 !important;
+ margin-bottom: 0 !important;
+ -moz-margin-start: 3px !important;
+ -moz-margin-end: 0 !important;
+ padding: 2px !important;
}
-.findbar-find-previous:focus + .findbar-find-next {
- border-inline-start-width: 0;
+.find-status-icon[status="notfound"] {
+ list-style-image: url("moz-icon://stock/gtk-dialog-error?size=menu");
}
-.findbar-find-previous:focus {
- border-inline-end-width: 1px;
+.find-status-icon[status="pending"] {
+ list-style-image: url("chrome://global/skin/icons/loading_16.png");
}
-.findbar-highlight,
-.findbar-case-sensitive,
-.findbar-entire-word {
- margin-inline-start: 5px;
+.findbar-textbox[status="notfound"] {
+ box-shadow: 0 0 0 1em #f66 inset;
+ color: white;
}
-.findbar-find-status,
-.findbar-matches {
- color: GrayText;
- margin: 0 !important;
- margin-inline-start: 12px !important;
+.findbar-textbox[flash="true"] {
+ box-shadow: 0 0 0 1em yellow inset;
+ color: black;
}
-.find-status-icon[status="pending"] {
- list-style-image: url("chrome://global/skin/icons/loading.png");
+.find-status-icon[status="wrapped"] {
+ list-style-image: url("chrome://global/skin/icons/wrap.png");
}
diff --git a/toolkit/themes/linux/global/icons/find.png b/toolkit/themes/linux/global/icons/find.png
new file mode 100644
index 0000000000..cceed403e5
--- /dev/null
+++ b/toolkit/themes/linux/global/icons/find.png
Binary files differ
diff --git a/toolkit/themes/linux/global/inContentUI.css b/toolkit/themes/linux/global/inContentUI.css
new file mode 100644
index 0000000000..afcef9274e
--- /dev/null
+++ b/toolkit/themes/linux/global/inContentUI.css
@@ -0,0 +1,41 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/*
+ * The default namespace for this file is XUL. Be sure to prefix rules that
+ * are applicable to both XUL and HTML with '*|'.
+ */
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+@namespace html url("http://www.w3.org/1999/xhtml");
+
+/* Page background */
+*|*:root {
+ -moz-appearance: none;
+ padding: 18px;
+ background-color: Window;
+ background-image: /* Texture */
+ url("chrome://global/skin/inContentUI/background-texture.png");
+ color: WindowText;
+}
+
+/* Use the new in-content colors for #contentAreaDownloadsView. After landing
+ of bug 989469 the colors can be moved to *|*:root */
+*|*#contentAreaDownloadsView {
+ background: #f1f1f1;
+ color: #424e5a;
+}
+
+html|html {
+ font: message-box;
+}
+
+/* Content */
+*|*.main-content {
+ /* Needed to allow the radius to clip the inner content, see bug 595656 */
+ overflow: hidden;
+ background-color: -moz-Field;
+ color: -moz-FieldText;
+ border: 1px solid ThreeDShadow;
+ border-radius: 5px;
+}
diff --git a/toolkit/themes/linux/global/jar.mn b/toolkit/themes/linux/global/jar.mn
index 5bde219fdd..0efc8c5cf8 100644
--- a/toolkit/themes/linux/global/jar.mn
+++ b/toolkit/themes/linux/global/jar.mn
@@ -16,6 +16,7 @@ toolkit.jar:
skin/classic/global/findBar.css
skin/classic/global/global.css
skin/classic/global/groupbox.css
+ skin/classic/global/inContentUI.css
skin/classic/global/listbox.css
skin/classic/global/menu.css
skin/classic/global/menulist.css
@@ -43,6 +44,7 @@ toolkit.jar:
skin/classic/global/icons/blacklist_favicon.png (icons/blacklist_favicon.png)
skin/classic/global/icons/blacklist_large.png (icons/blacklist_large.png)
skin/classic/global/icons/close.svg (icons/close.svg)
+ skin/classic/global/icons/find.png (icons/find.png)
skin/classic/global/icons/resizer.png (icons/resizer.png)
skin/classic/global/icons/sslWarning.png (icons/sslWarning.png)
@@ -52,6 +54,6 @@ toolkit.jar:
skin/classic/global/tree/twisty-clsd.png (tree/twisty-clsd.png)
skin/classic/global/tree/twisty-open.png (tree/twisty-open.png)
- skin/classic/global/console/console.css (console/console.css)
- skin/classic/global/console/console.png (console/console.png)
- skin/classic/global/console/console-toolbar.png (console/console-toolbar.png)
+ skin/classic/global/console/console.css (console/console.css)
+ skin/classic/global/console/console.png (console/console.png)
+ skin/classic/global/console/console-toolbar.png (console/console-toolbar.png)
diff --git a/toolkit/themes/linux/mozapps/jar.mn b/toolkit/themes/linux/mozapps/jar.mn
index d4997d36ce..37325c0bec 100644
--- a/toolkit/themes/linux/mozapps/jar.mn
+++ b/toolkit/themes/linux/mozapps/jar.mn
@@ -23,30 +23,33 @@ toolkit.jar:
* skin/classic/mozapps/extensions/newaddon.css (webextensions/newaddon.css)
skin/classic/mozapps/extensions/heart.png (webextensions/heart.png)
#else
-+ skin/classic/mozapps/extensions/extensions.css (extensions/extensions.css)
-+ skin/classic/mozapps/extensions/category-search.png (extensions/category-search.png)
-+ skin/classic/mozapps/extensions/category-discover.png (extensions/category-discover.png)
-+ skin/classic/mozapps/extensions/category-languages.png (extensions/localeGeneric.png)
-+ skin/classic/mozapps/extensions/category-extensions.png (extensions/extensionGeneric.png)
-+ skin/classic/mozapps/extensions/category-themes.png (extensions/themeGeneric.png)
-+ skin/classic/mozapps/extensions/category-plugins.png (extensions/category-plugins.png)
-+ skin/classic/mozapps/extensions/category-service.png (extensions/category-service.png)
-+ skin/classic/mozapps/extensions/category-dictionaries.png (extensions/category-dictionaries.png)
-+ skin/classic/mozapps/extensions/category-experiments.png (extensions/category-experiments.png)
-+ skin/classic/mozapps/extensions/category-recent.png (extensions/category-recent.png)
-+ skin/classic/mozapps/extensions/category-available.png (extensions/category-available.png)
-+ skin/classic/mozapps/extensions/extensionGeneric.png (extensions/extensionGeneric.png)
-+ skin/classic/mozapps/extensions/extensionGeneric-16.png (extensions/extensionGeneric-16.png)
-+ skin/classic/mozapps/extensions/dictionaryGeneric.png (extensions/dictionaryGeneric.png)
-+ skin/classic/mozapps/extensions/dictionaryGeneric-16.png (extensions/dictionaryGeneric-16.png)
-+ skin/classic/mozapps/extensions/experimentGeneric.png (extensions/experimentGeneric.png)
-+ skin/classic/mozapps/extensions/themeGeneric.png (extensions/themeGeneric.png)
-+ skin/classic/mozapps/extensions/themeGeneric-16.png (extensions/themeGeneric-16.png)
-+ skin/classic/mozapps/extensions/localeGeneric.png (extensions/localeGeneric.png)
-+ skin/classic/mozapps/extensions/newaddon.css (extensions/newaddon.css)
-+ skin/classic/mozapps/extensions/selectAddons.css (extensions/selectAddons.css)
-+ skin/classic/mozapps/xpinstall/xpinstallItemGeneric.png (extensions/extensionGeneric.png)
+ skin/classic/mozapps/extensions/extensions.css (extensions/extensions.css)
+ skin/classic/mozapps/extensions/category-search.png (extensions/category-search.png)
+ skin/classic/mozapps/extensions/category-discover.png (extensions/category-discover.png)
+ skin/classic/mozapps/extensions/category-languages.png (extensions/localeGeneric.png)
+ skin/classic/mozapps/extensions/category-extensions.png (extensions/extensionGeneric.png)
+ skin/classic/mozapps/extensions/category-themes.png (extensions/themeGeneric.png)
+ skin/classic/mozapps/extensions/category-plugins.png (extensions/category-plugins.png)
+ skin/classic/mozapps/extensions/category-service.png (extensions/category-service.png)
+ skin/classic/mozapps/extensions/category-dictionaries.png (extensions/category-dictionaries.png)
+ skin/classic/mozapps/extensions/category-experiments.png (extensions/category-experiments.png)
+ skin/classic/mozapps/extensions/category-recent.png (extensions/category-recent.png)
+ skin/classic/mozapps/extensions/category-available.png (extensions/category-available.png)
+ skin/classic/mozapps/extensions/extensionGeneric.png (extensions/extensionGeneric.png)
+ skin/classic/mozapps/extensions/extensionGeneric-16.png (extensions/extensionGeneric-16.png)
+ skin/classic/mozapps/extensions/dictionaryGeneric.png (extensions/dictionaryGeneric.png)
+ skin/classic/mozapps/extensions/dictionaryGeneric-16.png (extensions/dictionaryGeneric-16.png)
+ skin/classic/mozapps/extensions/experimentGeneric.png (extensions/experimentGeneric.png)
+ skin/classic/mozapps/extensions/themeGeneric.png (extensions/themeGeneric.png)
+ skin/classic/mozapps/extensions/themeGeneric-16.png (extensions/themeGeneric-16.png)
+ skin/classic/mozapps/extensions/localeGeneric.png (extensions/localeGeneric.png)
+ skin/classic/mozapps/extensions/newaddon.css (extensions/newaddon.css)
+ skin/classic/mozapps/extensions/selectAddons.css (extensions/selectAddons.css)
+ skin/classic/mozapps/xpinstall/xpinstallItemGeneric.png (extensions/extensionGeneric.png)
#endif
+ skin/classic/mozapps/passwordmgr/key.png (passwordmgr/key.png)
+ skin/classic/mozapps/passwordmgr/key-16.png (passwordmgr/key-16.png)
+ skin/classic/mozapps/passwordmgr/key-64.png (passwordmgr/key-64.png)
skin/classic/mozapps/plugins/pluginGeneric.png (plugins/pluginGeneric.png)
skin/classic/mozapps/plugins/pluginBlocked.png (plugins/pluginBlocked.png)
skin/classic/mozapps/plugins/pluginGeneric-16.png (plugins/pluginGeneric-16.png)
diff --git a/toolkit/themes/linux/mozapps/passwordmgr/key-16.png b/toolkit/themes/linux/mozapps/passwordmgr/key-16.png
new file mode 100644
index 0000000000..ac135b847e
--- /dev/null
+++ b/toolkit/themes/linux/mozapps/passwordmgr/key-16.png
Binary files differ
diff --git a/toolkit/themes/linux/mozapps/passwordmgr/key-64.png b/toolkit/themes/linux/mozapps/passwordmgr/key-64.png
new file mode 100644
index 0000000000..0fb69f3828
--- /dev/null
+++ b/toolkit/themes/linux/mozapps/passwordmgr/key-64.png
Binary files differ
diff --git a/toolkit/themes/linux/mozapps/passwordmgr/key.png b/toolkit/themes/linux/mozapps/passwordmgr/key.png
new file mode 100644
index 0000000000..b5e8afefca
--- /dev/null
+++ b/toolkit/themes/linux/mozapps/passwordmgr/key.png
Binary files differ
diff --git a/toolkit/themes/osx/global/findBar.css b/toolkit/themes/osx/global/findBar.css
index 4e775292f7..44983d80fa 100644
--- a/toolkit/themes/osx/global/findBar.css
+++ b/toolkit/themes/osx/global/findBar.css
@@ -9,6 +9,7 @@ findbar {
background: @scopeBarBackground@;
border-top: @scopeBarSeparatorBorder@;
min-width: 1px;
+ padding: 4px 2px;
transition-property: margin-bottom, opacity, visibility;
transition-duration: 150ms, 150ms, 0s;
transition-timing-function: ease-in-out, ease-in-out, linear;
@@ -23,27 +24,16 @@ findbar[hidden] {
transition-delay: 0s, 0s, 150ms;
}
-findbar[noanim] {
- transition-duration: 0s !important;
- transition-delay: 0s !important;
-}
-
findbar:-moz-lwtheme {
-moz-appearance: none;
background: none;
border-style: none;
}
-.findbar-container {
- padding-inline-start: 2px;
- padding-top: 4px;
- padding-bottom: 4px;
-}
-
label.findbar-find-fast {
+ margin: 1px 3px 0 !important;
color: @scopeBarTitleColor@;
- margin: 0;
- margin-inline-start: 12px;
+ font-weight: bold;
text-shadow: @loweredShadow@;
}
@@ -54,15 +44,20 @@ label.findbar-find-fast:-moz-lwtheme,
}
.findbar-closebutton {
- margin-inline-start: 4px;
- padding-inline-start: 0;
- padding-inline-end: 8px;
+ padding: 0;
+ margin: 0 4px;
border: none;
- /* make sure the closebutton is displayed as the first element in the bar: */
- -moz-box-ordinal-group: 0;
+}
+
+.findbar-closebutton:-moz-lwtheme-brighttext {
+ list-style-image: url("chrome://global/skin/icons/close-inverted.png");
}
@media (min-resolution: 2dppx) {
+ .findbar-closebutton:-moz-lwtheme-brighttext {
+ list-style-image: url("chrome://global/skin/icons/close-inverted@2x.png");
+ }
+
.findbar-closebutton > .toolbarbutton-icon {
width: 16px;
}
@@ -70,109 +65,124 @@ label.findbar-find-fast:-moz-lwtheme,
.findbar-find-next,
.findbar-find-previous,
-.findbar-highlight,
-.findbar-case-sensitive,
-.findbar-entire-word {
+.findbar-highlight {
+ margin: 0 4px;
+ padding: 1px 3px;
-moz-appearance: none;
border-radius: 10000px;
border: @roundButtonBorder@;
background: @roundButtonBackground@;
box-shadow: @roundButtonShadow@;
color: buttontext;
- margin: 0;
}
-@media (-moz-mac-yosemite-theme) {
- .findbar-find-previous,
- .findbar-find-next {
- border-radius: 3px;
- box-shadow: none;
- }
-}
-
-.findbar-highlight,
-.findbar-case-sensitive,
-.findbar-entire-word {
- margin-inline-end: 5px;
- padding: 2px 9px;
-}
-
-.findbar-highlight {
- margin-inline-start: 8px;
-}
-
-.findbar-container > toolbarbutton:-moz-focusring,
-.findbar-find-next:-moz-focusring,
-.findbar-find-previous:-moz-focusring {
+.findbar-container > toolbarbutton:-moz-focusring {
position: relative;
box-shadow: @focusRingShadow@, @roundButtonShadow@;
}
+.findbar-container > toolbarbutton > .toolbarbutton-text {
+ margin: 0 6px !important;
+}
+
.findbar-container > toolbarbutton[disabled] {
color: GrayText !important;
}
.findbar-find-next:not([disabled]):hover:active,
.findbar-find-previous:not([disabled]):hover:active,
-.findbar-highlight:not([disabled]):hover:active,
-.findbar-case-sensitive:not([disabled]):hover:active,
-.findbar-entire-word:not([disabled]):hover:active,
-.findbar-highlight:not([disabled])[checked="true"],
-.findbar-case-sensitive:not([disabled])[checked="true"],
-.findbar-entire-word:not([disabled])[checked="true"] {
+.findbar-highlight:not([disabled]):hover:active {
text-shadow: @loweredShadow@;
background: @roundButtonPressedBackground@;
box-shadow: @roundButtonPressedShadow@;
}
-.findbar-find-next:hover:active:-moz-focusring,
-.findbar-find-previous:hover:active:-moz-focusring {
+.findbar-container > toolbarbutton:hover:active:-moz-focusring {
text-shadow: @loweredShadow@;
background: @roundButtonPressedBackground@;
box-shadow: @focusRingShadow@, @roundButtonPressedShadow@;
}
-@media (-moz-mac-yosemite-theme) {
- .findbar-container > toolbarbutton:-moz-focusring,
- .findbar-find-next:-moz-focusring,
- .findbar-find-previous:-moz-focusring {
- box-shadow: @yosemiteFocusRingShadow@, @roundButtonShadow@;
+.findbar-closebutton > .toolbarbutton-text {
+ display: none;
+}
+
+/* Match case checkbox */
+
+.findbar-container > checkbox {
+ list-style-image: url("chrome://global/skin/icons/checkbox.png");
+ -moz-image-region: rect(0px 16px 16px 0px);
+ -moz-appearance: none;
+ margin: 0 2px;
+ -moz-margin-start: 7px;
+}
+
+.findbar-container > checkbox:hover:active {
+ -moz-image-region: rect(0px 32px 16px 16px);
+}
+.findbar-container > checkbox[checked] {
+ -moz-image-region: rect(0px 48px 16px 32px);
+}
+.findbar-container > checkbox[checked]:hover:active {
+ -moz-image-region: rect(0px 64px 16px 48px);
+}
+
+@media (min-resolution: 2dppx) {
+ .findbar-container > checkbox {
+ list-style-image: url("chrome://global/skin/icons/checkbox@2x.png");
+ -moz-image-region: rect(0px 32px 32px 0px);
}
- .findbar-find-next:hover:active:-moz-focusring,
- .findbar-find-previous:hover:active:-moz-focusring {
- box-shadow: @yosemiteFocusRingShadow@, @roundButtonPressedShadow@;
+ .findbar-container > checkbox:hover:active {
+ -moz-image-region: rect(0px 64px 32px 32px);
+ }
+ .findbar-container > checkbox[checked] {
+ -moz-image-region: rect(0px 96px 32px 64px);
+ }
+ .findbar-container > checkbox[checked]:hover:active {
+ -moz-image-region: rect(0px 128px 32px 96px);
}
}
-/* Search field */
-.findbar-textbox {
- position: relative;
- -moz-appearance: none;
- border: @roundButtonBorder@;
- border-radius: 10000px 0 0 10000px;
- box-shadow: @roundButtonShadow@;
- background: url("chrome://global/skin/icons/search-textbox.svg") -moz-Field no-repeat 5px center;
- margin: 0;
- padding: 2px 8px;
- padding-inline-start: 19px;
+
+.findbar-container > checkbox > .checkbox-check {
+ display: none;
}
-.findbar-textbox:-moz-locale-dir(rtl) {
- border-radius: 0 10000px 10000px 0;
+.findbar-container > checkbox > .checkbox-label-box > .checkbox-label {
+ margin: 0 !important;
+ padding: 2px 0 0;
}
-@media (-moz-mac-yosemite-theme) {
- .findbar-textbox {
- border-top-left-radius: 3px;
- border-bottom-left-radius: 3px;
- box-shadow: none;
+.findbar-container > checkbox > .checkbox-label-box > .checkbox-icon {
+ -moz-padding-start: 1px;
+ padding-bottom: 1px;
+}
+@media (min-resolution: 2dppx) {
+ .findbar-container > checkbox > .checkbox-label-box > .checkbox-icon {
+ width: 17px;
+ height: 17px;
}
+}
- .findbar-textbox:-moz-locale-dir(rtl) {
- border-radius: 0 3px 3px 0;
- }
+.findbar-container > checkbox:-moz-focusring > .checkbox-label-box > .checkbox-icon {
+ border-radius: 4px;
+ box-shadow: @focusRingShadow@;
+}
+
+/* Search field */
+
+.findbar-textbox {
+ -moz-appearance: none;
+ border-radius: 10000px;
+ border: none;
+ box-shadow: 0 1px 1.5px rgba(0, 0, 0, .7) inset,
+ 0 0 0 1px rgba(0, 0, 0, .17) inset;
+ background: url("chrome://global/skin/icons/search-textbox.png") -moz-Field no-repeat 5px center;
+ margin: 0 4px -1px;
+ padding: 3px 8px 2px;
+ -moz-padding-start: 19px;
}
.findbar-textbox:not([focused="true"]):-moz-lwtheme {
@@ -180,13 +190,8 @@ label.findbar-find-fast:-moz-lwtheme,
}
.findbar-textbox[focused="true"] {
- box-shadow: @focusRingShadow@;
-}
-
-@media (-moz-mac-yosemite-theme) {
- .findbar-textbox[focused="true"] {
- box-shadow: @yosemiteFocusRingShadow@;
- }
+ box-shadow: @focusRingShadow@,
+ 0 1px 1.5px rgba(0, 0, 0, .8) inset;
}
.findbar-textbox[flash="true"] {
@@ -198,48 +203,52 @@ label.findbar-find-fast:-moz-lwtheme,
color: #FFF;
}
-.findbar-textbox.minimal {
- border-radius: 10000px;
- margin-inline-start: 5px;
-}
-
-/* Find previous/next buttons */
+/* find-next button */
-.findbar-find-previous,
.findbar-find-next {
- margin-inline-start: 0;
- padding: 3px 6px 1px;
+ -moz-border-end: none;
+ -moz-margin-end: 0 !important;
}
-.findbar-find-previous > .toolbarbutton-icon,
-.findbar-find-next > .toolbarbutton-icon {
- margin: 0;
+.findbar-find-next:-moz-locale-dir(ltr),
+.findbar-find-previous:-moz-locale-dir(rtl) {
+ border-top-right-radius: 0px;
+ border-bottom-right-radius: 0px;
}
+/* find-previous button */
+
.findbar-find-previous {
- border-left: none;
- border-right: none;
- margin-inline-end: 0;
- list-style-image: url(chrome://global/skin/icons/find-arrows.svg#glyph-find-previous);
- border-radius: 0;
+ -moz-margin-start: 0 !important;
}
-.findbar-find-next {
- list-style-image: url(chrome://global/skin/icons/find-arrows.svg#glyph-find-next);
- padding-inline-end: 7px;
+.findbar-find-previous:-moz-locale-dir(ltr),
+.findbar-find-next:-moz-locale-dir(rtl) {
+ border-top-left-radius: 0px;
+ border-bottom-left-radius: 0px;
}
-.findbar-find-next:-moz-locale-dir(ltr) {
- border-top-left-radius: 0;
- border-bottom-left-radius: 0;
+/* highlight button */
+
+.findbar-highlight {
+ -moz-margin-start: 8px;
}
-.findbar-find-next:-moz-locale-dir(rtl) {
- border-top-right-radius: 0;
- border-bottom-right-radius: 0;
+.findbar-highlight > .toolbarbutton-icon {
+ width: 13px;
+ height: 8px;
+ margin: 0 4px;
+ -moz-margin-end: 0;
+ border: 1px solid #818181;
+ border-radius: 4px;
+ background-color: #F4F4F3;
}
-/* Status description */
+
+.findbar-highlight[checked="true"] > .toolbarbutton-icon {
+ background-color: #FFFF00;
+ border-color: #818100;
+}
.find-status-icon {
display: none;
@@ -247,20 +256,14 @@ label.findbar-find-fast:-moz-lwtheme,
.find-status-icon[status="pending"] {
display: block;
- list-style-image: url("chrome://global/skin/icons/loading.png");
-}
-
-@media (min-resolution: 2dppx) {
- .find-status-icon[status="pending"] {
- width: 16px;
- list-style-image: url("chrome://global/skin/icons/loading@2x.png");
- }
+ list-style-image: url("chrome://global/skin/icons/loading_16.png");
}
.findbar-find-status,
.found-matches {
- color: rgba(0,0,0,.5);
- margin: 0 !important;
- margin-inline-start: 12px !important;
- text-shadow: 0 1px rgba(255,255,255,.4);
+ color: #436599;
+ font-weight: bold;
+ text-shadow: 0 1px rgba(255, 255, 255, .4);
+ margin: 1px 1px 0 !important;
+ -moz-margin-start: 12px !important;
}
diff --git a/toolkit/themes/osx/global/inContentUI.css b/toolkit/themes/osx/global/inContentUI.css
new file mode 100644
index 0000000000..17e2e6ae33
--- /dev/null
+++ b/toolkit/themes/osx/global/inContentUI.css
@@ -0,0 +1,144 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+%include shared.inc
+
+/*
+ * The default namespace for this file is XUL. Be sure to prefix rules that
+ * are applicable to both XUL and HTML with '*|'.
+ */
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+@namespace html url("http://www.w3.org/1999/xhtml");
+
+/* Page background */
+*|*:root {
+ -moz-appearance: none;
+ padding: 18px;
+ background-image: /* Texture */
+ url("chrome://global/skin/inContentUI/background-texture.png"),
+ /* Gradient */
+ linear-gradient(#ADB5C2, #BFC6D1);
+}
+
+/* Use the new in-content colors for #contentAreaDownloadsView. After landing
+ of bug 989469 the colors can be moved to *|*:root */
+*|*#contentAreaDownloadsView {
+ background: #f1f1f1;
+ color: #424e5a;
+}
+
+html|html {
+ font: message-box;
+}
+
+/* Content */
+*|*.main-content {
+ /* Needed to allow the radius to clip the inner content, see bug 595656 */
+ overflow: hidden;
+ background-image: linear-gradient(rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.25) 50%, rgba(255, 255, 255, 0.05));
+ border: 1px solid rgba(50, 65, 92, 0.4);
+ border-radius: 5px;
+}
+
+/* Buttons */
+*|button,
+menulist,
+colorpicker[type="button"] {
+ -moz-appearance: none;
+ padding: 1px 4px;
+ min-width: 60px;
+ border-radius: 3px;
+ border: 1px solid rgba(60,73,97,0.5);
+ box-shadow: inset 0 1px rgba(255,255,255,0.25), 0 1px rgba(255,255,255,0.25);
+ background-color: transparent;
+ background-image: linear-gradient(rgba(255,255,255,0.45), rgba(255,255,255,0.2));
+ background-clip: padding-box;
+ color: #252F3B;
+ text-shadow: @loweredShadow@;
+}
+
+button:-moz-focusring > .button-box,
+menulist:-moz-focusring:not([open="true"]) > .menulist-label-box,
+colorpicker[type="button"]:-moz-focusring:not([open="true"]) > .colorpicker-button-colorbox {
+ outline: 1px dotted #252F3B;
+}
+
+html|button[disabled],
+button[disabled="true"],
+menulist[disabled="true"],
+colorpicker[type="button"][disabled="true"] {
+ opacity: 0.8;
+ color: #505050;
+}
+
+html|button:not([disabled]):active:hover,
+button:not([disabled="true"]):active:hover,
+menulist[open="true"]:not([disabled="true"]),
+colorpicker[type="button"][open="true"]:not([disabled="true"]) {
+ box-shadow: inset 0 1px 3px rgba(0,0,0,.2), 0 1px rgba(255,255,255,0.25);
+ background-image: linear-gradient(rgba(45,54,71,0.3), rgba(45,54,71,0.1));
+ border-color: rgba(60,73,97,0.7);
+}
+
+menulist {
+ -moz-padding-end: 0;
+ margin-left: 5px;
+ margin-right: 5px;
+}
+
+/* Tweak margins so the focus ring is in the right place. */
+menulist > .menulist-label-box {
+ -moz-margin-end: 3px;
+ margin-top: 1px;
+}
+
+menulist > .menulist-label-box > .menulist-label {
+ margin-top: 0px !important;
+ margin-bottom: 0px !important;
+}
+
+menulist > .menulist-dropmarker {
+ -moz-appearance: none;
+ display: -moz-box;
+ background: transparent;
+ border: none;
+ -moz-border-start: 1px solid rgba(60,73,97,0.5);
+ margin-top: -1px;
+ margin-bottom: -1px;
+}
+
+colorpicker[type="button"] {
+ margin: 1px 5px 2px 5px;
+ padding: 3px;
+ height: 25px;
+}
+
+spinbuttons {
+ -moz-appearance: none;
+}
+
+spinbuttons > .spinbuttons-box > .spinbuttons-button {
+ min-width: 12px;
+}
+
+.spinbuttons-button > .button-box > .button-text {
+ display: none;
+}
+
+.spinbuttons-button[disabled="true"] > .button-box > .button-icon {
+ opacity: 0.5;
+}
+
+spinbuttons > .spinbuttons-box > .spinbuttons-up {
+ list-style-image: url("chrome://global/skin/arrow/arrow-up.gif");
+ border-bottom-width: 0;
+ border-bottom-left-radius: 0;
+ border-bottom-right-radius: 0;
+}
+
+spinbuttons > .spinbuttons-box > .spinbuttons-down {
+ list-style-image: url("chrome://global/skin/arrow/arrow-dn.gif");
+ border-top-left-radius: 0;
+ border-top-right-radius: 0;
+}
diff --git a/toolkit/themes/osx/global/jar.mn b/toolkit/themes/osx/global/jar.mn
index 79bb062ab9..9407ccee52 100644
--- a/toolkit/themes/osx/global/jar.mn
+++ b/toolkit/themes/osx/global/jar.mn
@@ -21,6 +21,7 @@ toolkit.jar:
* skin/classic/global/findBar.css
* skin/classic/global/global.css
skin/classic/global/groupbox.css
+* skin/classic/global/inContentUI.css
skin/classic/global/linkTree.css
skin/classic/global/listbox.css
skin/classic/global/menu.css
diff --git a/toolkit/themes/osx/mozapps/jar.mn b/toolkit/themes/osx/mozapps/jar.mn
index 35927755bd..f8ade11d91 100644
--- a/toolkit/themes/osx/mozapps/jar.mn
+++ b/toolkit/themes/osx/mozapps/jar.mn
@@ -83,6 +83,9 @@ toolkit.jar:
skin/classic/mozapps/extensions/blocklist.css (extensions/blocklist.css)
* skin/classic/mozapps/extensions/newaddon.css (extensions/newaddon.css)
#endif
+ skin/classic/mozapps/passwordmgr/key.png (passwordmgr/key.png)
+ skin/classic/mozapps/passwordmgr/key-16.png (passwordmgr/key-16.png)
+ skin/classic/mozapps/passwordmgr/key-64.png (passwordmgr/key-64.png)
skin/classic/mozapps/plugins/notifyPluginGeneric.png (plugins/notifyPluginGeneric.png)
skin/classic/mozapps/plugins/pluginGeneric.png (plugins/pluginGeneric.png)
skin/classic/mozapps/plugins/pluginBlocked.png (plugins/pluginBlocked.png)
diff --git a/toolkit/themes/osx/mozapps/passwordmgr/key-16.png b/toolkit/themes/osx/mozapps/passwordmgr/key-16.png
new file mode 100644
index 0000000000..ac135b847e
--- /dev/null
+++ b/toolkit/themes/osx/mozapps/passwordmgr/key-16.png
Binary files differ
diff --git a/toolkit/themes/osx/mozapps/passwordmgr/key-64.png b/toolkit/themes/osx/mozapps/passwordmgr/key-64.png
new file mode 100644
index 0000000000..0fb69f3828
--- /dev/null
+++ b/toolkit/themes/osx/mozapps/passwordmgr/key-64.png
Binary files differ
diff --git a/toolkit/themes/osx/mozapps/passwordmgr/key.png b/toolkit/themes/osx/mozapps/passwordmgr/key.png
new file mode 100644
index 0000000000..b5e8afefca
--- /dev/null
+++ b/toolkit/themes/osx/mozapps/passwordmgr/key.png
Binary files differ
diff --git a/toolkit/themes/shared/about.css b/toolkit/themes/shared/about.css
index 25f52992a8..5c40dbfeae 100644
--- a/toolkit/themes/shared/about.css
+++ b/toolkit/themes/shared/about.css
@@ -26,8 +26,8 @@ body {
}
#aboutLogoContainer {
- border: 1px solid ThreeDLightShadow;
width: 300px;
+ margin: 0 auto;
margin-bottom: 2em;
}
@@ -35,12 +35,6 @@ img {
border: 0;
}
-#version {
- font-weight: bold;
- color: #909090;
- margin: -24px 0 9px 17px;
-}
-
ul {
margin: 0;
margin-inline-start: 1.5em;
diff --git a/toolkit/themes/shared/datetimeinputpickers.css b/toolkit/themes/shared/datetimeinputpickers.css
new file mode 100644
index 0000000000..f0c4315e5b
--- /dev/null
+++ b/toolkit/themes/shared/datetimeinputpickers.css
@@ -0,0 +1,377 @@
+/* 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/. */
+
+:root {
+ --font-size-default: 1.1rem;
+ --spinner-width: 3rem;
+ --spinner-margin-top-bottom: 0.4rem;
+ --spinner-item-height: 2.4rem;
+ --spinner-item-margin-bottom: 0.1rem;
+ --spinner-button-height: 1.2rem;
+ --colon-width: 2rem;
+ --day-period-spacing-width: 1rem;
+ --calendar-width: 23.1rem;
+ --date-picker-item-height: 2.5rem;
+ --date-picker-item-width: 3.3rem;
+
+ --border: 0.1rem solid #D6D6D6;
+ --border-radius: 0.3rem;
+ --border-active-color: #B1B1B1;
+
+ --font-color: #191919;
+ --fill-color: #EBEBEB;
+
+ --today-fill-color: rgb(212, 212, 212);
+
+ --selected-font-color: #FFFFFF;
+ --selected-fill-color: #0996F8;
+
+ --button-font-color: #858585;
+ --button-font-color-hover: #4D4D4D;
+ --button-font-color-active: #191919;
+ --button-fill-color-active: #D4D4D4;
+
+ --weekday-header-font-color: #6C6C6C;
+ --weekend-header-font-color: rgb(218, 78, 68);
+
+ --weekend-font-color: rgb(218, 78, 68);
+ --weekday-outside-font-color: rgb(153, 153, 153);
+ --weekend-outside-font-color: rgb(255, 152, 143);
+
+ --weekday-disabled-font-color: rgba(25, 25, 25, 0.2);
+ --weekend-disabled-font-color: rgba(218, 78, 68, 0.2);
+ --disabled-fill-color: rgba(235, 235, 235, 0.8);
+
+ --disabled-opacity: 0.2;
+}
+
+html {
+ font-size: 10px;
+}
+
+body {
+ margin: 0;
+ color: var(--font-color);
+ font: message-box;
+ font-size: var(--font-size-default);
+}
+
+button {
+ -moz-appearance: none;
+ background: none;
+ border: none;
+}
+
+.nav {
+ display: flex;
+ width: var(--calendar-width);
+ height: 2.4rem;
+ margin-bottom: 0.8rem;
+ justify-content: space-between;
+}
+
+.nav > button {
+ width: 3rem;
+ height: var(--date-picker-item-height);
+ background-color: var(--button-font-color);
+}
+
+.nav > button:hover {
+ background-color: var(--button-font-color-hover);
+}
+
+.nav > button.active {
+ background-color: var(--button-font-color-active);
+}
+
+.nav > button.left {
+ background: url("chrome://global/skin/icons/calendar-arrows.svg#left") no-repeat 50% 50%;
+}
+
+.nav > button.right {
+ background: url("chrome://global/skin/icons/calendar-arrows.svg#right") no-repeat 50% 50%;
+}
+
+.month-year-container {
+ position: absolute;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ top: 0;
+ left: 3rem;
+ width: 17.1rem;
+ height: var(--date-picker-item-height);
+ z-index: 10;
+}
+
+button.month-year {
+ font-size: 1.3rem;
+ border: var(--border);
+ border-radius: 0.3rem;
+ padding: 0.2rem 2.6rem 0.2rem 1.2rem;
+}
+
+button.month-year:hover {
+ background: var(--fill-color);
+}
+
+button.month-year.active {
+ border-color: var(--border-active-color);
+ background: var(--button-fill-color-active);
+}
+
+button.month-year::after {
+ position: absolute;
+ content: "";
+ width: 2.6rem;
+ height: 1.6rem;
+ background: url("chrome://global/skin/icons/spinner-arrows.svg#down") no-repeat 50% 50%;
+}
+
+button.month-year.active::after {
+ background: url("chrome://global/skin/icons/spinner-arrows.svg#up") no-repeat 50% 50%;
+}
+
+.month-year-view {
+ position: absolute;
+ z-index: 5;
+ padding-top: 3.2rem;
+ top: 0;
+ left: 0;
+ bottom: 0;
+ width: var(--calendar-width);
+ background: window;
+ opacity: 1;
+ transition: opacity 0.15s;
+}
+
+.month-year-view.hidden {
+ visibility: hidden;
+ opacity: 0;
+}
+
+.month-year-view > .spinner-container {
+ width: 5.5rem;
+ margin: 0 0.5rem;
+}
+
+.month-year-view .spinner {
+ transform: scaleY(1);
+ transform-origin: top;
+ transition: transform 0.15s;
+}
+
+.month-year-view.hidden .spinner {
+ transform: scaleY(0);
+ transition: none;
+}
+
+.month-year-view .spinner > div {
+ transform: scaleY(1);
+ transition: transform 0.15s;
+}
+
+.month-year-view.hidden .spinner > div {
+ transform: scaleY(2.5);
+ transition: none;
+}
+
+.calendar-container {
+ cursor: default;
+ display: flex;
+ flex-direction: column;
+ width: var(--calendar-width);
+}
+
+.week-header {
+ display: flex;
+}
+
+.week-header > div {
+ color: var(--weekday-header-font-color);
+}
+
+.week-header > div.weekend {
+ color: var(--weekend-header-font-color);
+}
+
+.days-viewport {
+ height: 15rem;
+ overflow: hidden;
+ position: relative;
+}
+
+.days-view {
+ position: absolute;
+ display: flex;
+ flex-wrap: wrap;
+ flex-direction: row;
+}
+
+.week-header > div,
+.days-view > div {
+ align-items: center;
+ display: flex;
+ height: var(--date-picker-item-height);
+ position: relative;
+ justify-content: center;
+ width: var(--date-picker-item-width);
+}
+
+.days-view > .outside {
+ color: var(--weekday-outside-font-color);
+}
+
+.days-view > .weekend {
+ color: var(--weekend-font-color);
+}
+
+.days-view > .weekend.outside {
+ color: var(--weekend-outside-font-color);
+}
+
+.days-view > .out-of-range,
+.days-view > .off-step {
+ color: var(--weekday-disabled-font-color);
+ background: var(--disabled-fill-color);
+}
+
+.days-view > .out-of-range.weekend,
+.days-view > .off-step.weekend {
+ color: var(--weekend-disabled-font-color);
+}
+
+.days-view > .today {
+ font-weight: bold;
+}
+
+.days-view > .out-of-range::before,
+.days-view > .off-step::before {
+ display: none;
+}
+
+.days-view > div:hover::before,
+.days-view > .select::before,
+.days-view > .today::before {
+ top: 5%;
+ bottom: 5%;
+ left: 5%;
+ right: 5%;
+}
+
+#time-picker,
+.month-year-view {
+ display: flex;
+ flex-direction: row;
+ justify-content: center;
+}
+
+.spinner-container {
+ display: flex;
+ flex-direction: column;
+ width: var(--spinner-width);
+}
+
+.spinner-container > button {
+ background-color: var(--button-font-color);
+ height: var(--spinner-button-height);
+}
+
+.spinner-container > button:hover {
+ background-color: var(--button-font-color-hover);
+}
+
+.spinner-container > button.active {
+ background-color: var(--button-font-color-active);
+}
+
+.spinner-container > button.up {
+ background: url("chrome://global/skin/icons/spinner-arrows.svg#up") no-repeat 50% 50%;
+}
+
+.spinner-container > button.down {
+ background: url("chrome://global/skin/icons/spinner-arrows.svg#down") no-repeat 50% 50%;
+}
+
+.spinner-container.hide-buttons > button {
+ visibility: hidden;
+}
+
+.spinner-container > .spinner {
+ position: relative;
+ width: 100%;
+ margin: var(--spinner-margin-top-bottom) 0;
+ cursor: default;
+ overflow-y: scroll;
+ scroll-snap-type: mandatory;
+ scroll-snap-points-y: repeat(100%);
+}
+
+.spinner-container > .spinner > div {
+ box-sizing: border-box;
+ position: relative;
+ text-align: center;
+ padding: calc((var(--spinner-item-height) - var(--font-size-default)) / 2) 0;
+ margin-bottom: var(--spinner-item-margin-bottom);
+ height: var(--spinner-item-height);
+ -moz-user-select: none;
+ scroll-snap-coordinate: 0 0;
+}
+
+.spinner-container > .spinner > div::before,
+.calendar-container .days-view > div::before {
+ position: absolute;
+ top: 5%;
+ bottom: 5%;
+ left: 5%;
+ right: 5%;
+ z-index: -10;
+ border-radius: var(--border-radius);
+}
+
+.spinner-container > .spinner > div:hover::before,
+.calendar-container .days-view > div:hover::before {
+ background: var(--fill-color);
+ border: var(--border);
+ content: "";
+}
+
+.calendar-container .days-view > div.today::before {
+ background: var(--today-fill-color);
+ content: "";
+}
+
+.spinner-container > .spinner:not(.scrolling) > div.selection,
+.calendar-container .days-view > div.selection {
+ color: var(--selected-font-color);
+}
+
+.spinner-container > .spinner > div.selection::before,
+.calendar-container .days-view > div.selection::before {
+ background: var(--selected-fill-color);
+ border: none;
+ content: "";
+}
+
+.spinner-container > .spinner > div.disabled::before,
+.spinner-container > .spinner.scrolling > div.selection::before,
+.spinner-container > .spinner.scrolling > div:hover::before {
+ display: none;
+}
+
+.spinner-container > .spinner > div.disabled {
+ opacity: var(--disabled-opacity);
+}
+
+.colon {
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ width: var(--colon-width);
+ margin-bottom: 0.3rem;
+}
+
+.spacer {
+ width: var(--day-period-spacing-width);
+} \ No newline at end of file
diff --git a/toolkit/themes/shared/datetimepopup.css b/toolkit/themes/shared/datetimepopup.css
new file mode 100644
index 0000000000..52f6fc7a2d
--- /dev/null
+++ b/toolkit/themes/shared/datetimepopup.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/. */
+
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+
+panel[type="arrow"][side="top"],
+panel[type="arrow"][side="bottom"] {
+ margin-left: 0;
+ margin-right: 0;
+}
diff --git a/toolkit/themes/shared/icons/calendar-arrows.svg b/toolkit/themes/shared/icons/calendar-arrows.svg
new file mode 100644
index 0000000000..858676f55b
--- /dev/null
+++ b/toolkit/themes/shared/icons/calendar-arrows.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 14 14">
+ <style>
+ path:not(:target) {
+ display: none;
+ }
+ </style>
+ <path id="right" d="M4.8 14L3 12.3 8.5 7 3 1.7 4.8 0 12 7"/>
+ <path id="left" d="M9.2 0L11 1.7 5.5 7 11 12.3 9.2 14 2 7"/>
+</svg>
diff --git a/toolkit/themes/shared/icons/spinner-arrows.svg b/toolkit/themes/shared/icons/spinner-arrows.svg
new file mode 100644
index 0000000000..a8ba72d6b5
--- /dev/null
+++ b/toolkit/themes/shared/icons/spinner-arrows.svg
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- This Source Code Form is subject to the terms of the Mozilla Public
+ - License, v. 2.0. If a copy of the MPL was not distributed with this
+ - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
+<svg xmlns="http://www.w3.org/2000/svg" width="10" height="6" viewBox="0 0 10 6">
+ <style>
+ path:not(:target) {
+ display: none;
+ }
+ </style>
+ <path id="down" d="M0 1l1-1 4 4 4-4 1 1-5 5"/>
+ <path id="up" d="M0 5l1 1 4-4 4 4 1-1-5-5"/>
+</svg>
diff --git a/toolkit/themes/shared/jar.inc.mn b/toolkit/themes/shared/jar.inc.mn
index 9c3d86a40d..bdfca2a051 100644
--- a/toolkit/themes/shared/jar.inc.mn
+++ b/toolkit/themes/shared/jar.inc.mn
@@ -21,12 +21,15 @@ toolkit.jar:
skin/classic/global/aboutSupport.css (../../shared/aboutSupport.css)
skin/classic/global/appPicker.css (../../shared/appPicker.css)
skin/classic/global/config.css (../../shared/config.css)
- skin/classic/global/timepicker.css (../../shared/timepicker.css)
+ skin/classic/global/datetimeinputpickers.css (../../shared/datetimeinputpickers.css)
+ skin/classic/global/datetimepopup.css (../../shared/datetimepopup.css)
+ skin/classic/global/icons/calendar-arrows.svg (../../shared/icons/calendar-arrows.svg)
skin/classic/global/icons/find-arrows.svg (../../shared/icons/find-arrows.svg)
skin/classic/global/icons/info.svg (../../shared/incontent-icons/info.svg)
skin/classic/global/icons/input-clear.svg (../../shared/icons/input-clear.svg)
skin/classic/global/icons/loading.png (../../shared/icons/loading.png)
skin/classic/global/icons/loading@2x.png (../../shared/icons/loading@2x.png)
+ skin/classic/global/icons/spinner-arrows.svg (../../shared/icons/spinner-arrows.svg)
skin/classic/global/icons/warning.svg (../../shared/incontent-icons/warning.svg)
skin/classic/global/icons/blocked.svg (../../shared/incontent-icons/blocked.svg)
skin/classic/global/alerts/alert-common.css (../../shared/alert-common.css)
diff --git a/toolkit/themes/shared/non-mac.jar.inc.mn b/toolkit/themes/shared/non-mac.jar.inc.mn
index a783bbb3c0..637537d9d7 100644
--- a/toolkit/themes/shared/non-mac.jar.inc.mn
+++ b/toolkit/themes/shared/non-mac.jar.inc.mn
@@ -77,6 +77,8 @@
skin/classic/global/icons/Landscape.png (../../windows/global/icons/Landscape.png)
skin/classic/global/icons/Question.png (../../windows/global/icons/Question.png)
skin/classic/global/icons/question-16.png (../../windows/global/icons/question-16.png)
+ skin/classic/global/icons/question-32.png (../../windows/global/icons/question-32.png)
+ skin/classic/global/icons/question-48.png (../../windows/global/icons/question-48.png)
skin/classic/global/icons/question-64.png (../../windows/global/icons/question-64.png)
skin/classic/global/icons/resizer-rtl.png (../../windows/global/icons/resizer-rtl.png)
skin/classic/global/icons/Restore.gif (../../windows/global/icons/Restore.gif)
diff --git a/toolkit/themes/shared/timepicker.css b/toolkit/themes/shared/timepicker.css
deleted file mode 100644
index e8d081b301..0000000000
--- a/toolkit/themes/shared/timepicker.css
+++ /dev/null
@@ -1,153 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-:root {
- --font-size-default: 1.1rem;
- --spinner-width: 3rem;
- --spinner-margin-top-bottom: 0.4rem;
- --spinner-item-height: 2.4rem;
- --spinner-item-margin-bottom: 0.1rem;
- --spinner-button-height: 1.2rem;
- --colon-width: 2rem;
- --day-period-spacing-width: 1rem;
-
- --border: 0.1rem solid #D6D6D6;
- --border-radius: 0.3rem;
-
- --font-color: #191919;
- --fill-color: #EBEBEB;
-
- --selected-font-color: #FFFFFF;
- --selected-fill-color: #0996F8;
-
- --button-font-color: #858585;
- --button-font-color-hover: #4D4D4D;
- --button-font-color-active: #191919;
-
- --disabled-opacity: 0.2;
-}
-
-html {
- font-size: 10px;
-}
-
-body {
- margin: 0;
- color: var(--font-color);
- font-size: var(--font-size-default);
-}
-
-#time-picker {
- display: flex;
- flex-direction: row;
- justify-content: space-around;
-}
-
-.spinner-container {
- font-family: sans-serif;
- display: flex;
- flex-direction: column;
- width: var(--spinner-width);
-}
-
-.spinner-container > button {
- -moz-appearance: none;
- border: none;
- background: none;
- background-color: var(--button-font-color);
- height: var(--spinner-button-height);
-}
-
-.spinner-container > button:hover {
- background-color: var(--button-font-color-hover);
-}
-
-.spinner-container > button.active {
- background-color: var(--button-font-color-active);
-}
-
-.spinner-container > button.up {
- mask: url("chrome://global/skin/icons/find-arrows.svg#glyph-find-previous") no-repeat 50% 50%;
-}
-
-.spinner-container > button.down {
- mask: url("chrome://global/skin/icons/find-arrows.svg#glyph-find-next") no-repeat 50% 50%;
-}
-
-.spinner-container.hide-buttons > button {
- visibility: hidden;
-}
-
-.spinner-container > .spinner {
- position: relative;
- width: 100%;
- margin: var(--spinner-margin-top-bottom) 0;
- cursor: default;
- overflow-y: scroll;
- scroll-snap-type: mandatory;
- scroll-snap-points-y: repeat(100%);
-}
-
-.spinner-container > .spinner > div {
- box-sizing: border-box;
- position: relative;
- text-align: center;
- padding: calc((var(--spinner-item-height) - var(--font-size-default)) / 2) 0;
- margin-bottom: var(--spinner-item-margin-bottom);
- height: var(--spinner-item-height);
- -moz-user-select: none;
- scroll-snap-coordinate: 0 0;
-}
-
-.spinner-container > .spinner > div:hover::before {
- background: var(--fill-color);
- border: var(--border);
- border-radius: var(--border-radius);
- content: "";
- position: absolute;
- top: 0%;
- bottom: 0%;
- left: 0%;
- right: 0%;
- z-index: -10;
-}
-
-.spinner-container > .spinner:not(.scrolling) > div.selection {
- color: var(--selected-font-color);
-}
-
-.spinner-container > .spinner > div.selection::before {
- background: var(--selected-fill-color);
- border: none;
- border-radius: var(--border-radius);
- content: "";
- position: absolute;
- top: 0%;
- bottom: 0%;
- left: 0%;
- right: 0%;
- z-index: -10;
-}
-
-.spinner-container > .spinner > div.disabled::before,
-.spinner-container > .spinner.scrolling > div.selection::before,
-.spinner-container > .spinner.scrolling > div:hover::before {
- display: none;
-}
-
-.spinner-container > .spinner > div.disabled {
- opacity: var(--disabled-opacity);
-}
-
-.colon {
- display: flex;
- justify-content: center;
- align-items: center;
- width: var(--colon-width);
- margin-bottom: 0.3rem;
-}
-
-.spacer {
- width: var(--day-period-spacing-width);
-} \ No newline at end of file
diff --git a/toolkit/themes/windows/global/findBar.css b/toolkit/themes/windows/global/findBar.css
index 96115f1938..34b3ae49b8 100644
--- a/toolkit/themes/windows/global/findBar.css
+++ b/toolkit/themes/windows/global/findBar.css
@@ -4,8 +4,18 @@
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+.findbar-closebutton {
+ border: none;
+ padding: 3px 5px;
+ -moz-appearance: none;
+}
+
+.findbar-closebutton:-moz-lwtheme-brighttext {
+ list-style-image: url("chrome://global/skin/icons/close-inverted.png");
+}
+
findbar {
- box-shadow: 0 1px 1px rgba(0,0,0,.1) inset;
+ padding-top: 1px;
background-image: linear-gradient(rgba(0,0,0,.15) 1px, rgba(255,255,255,.15) 1px);
background-size: 100% 2px;
background-repeat: no-repeat;
@@ -24,137 +34,94 @@ findbar[hidden] {
transition-delay: 0s, 0s, 150ms;
}
-findbar[noanim] {
- transition-duration: 0s !important;
- transition-delay: 0s !important;
-}
+/* find-next button */
-.findbar-container {
- padding-inline-start: 8px;
- padding-top: 4px;
- padding-bottom: 4px;
+.findbar-find-next {
+ list-style-image: url("chrome://global/skin/icons/find.png");
+ -moz-image-region: rect(0px 16px 16px 0px);
}
-.findbar-closebutton {
- margin-inline-start: 4px;
- padding-inline-start: 0;
- padding-inline-end: 8px;
- border: none;
- -moz-appearance: none;
+.findbar-find-next:hover {
+ -moz-image-region: rect(16px 16px 32px 0px);
}
-
-/* Search field */
-
-.findbar-textbox {
- -moz-appearance: none;
- border: 1px solid ThreeDShadow;
- border-radius: 2px 0 0 2px;
- margin: 0;
- padding: 1px 5px;
- width: 14em;
+.findbar-find-next[disabled="true"] {
+ -moz-image-region: rect(32px 16px 48px 0px) !important;
}
-.findbar-textbox:-moz-locale-dir(rtl) {
- border-radius: 0 2px 2px 0;
-}
+/* find-previous button */
-.findbar-textbox[focused="true"] {
- border-color: Highlight;
+.findbar-find-previous {
+ list-style-image: url("chrome://global/skin/icons/find.png");
+ -moz-image-region: rect(0px 32px 16px 16px);
}
-.findbar-textbox[status="notfound"] {
- background-color: #f66;
- color: white;
+.findbar-find-previous:hover {
+ -moz-image-region: rect(16px 32px 32px 16px);
}
-.findbar-textbox[flash="true"] {
- background-color: yellow;
- color: black;
+.findbar-find-previous[disabled="true"] {
+ -moz-image-region: rect(32px 32px 48px 16px) !important;
}
-.findbar-textbox.minimal {
- border-radius: 2px;
-}
-
-/* Buttons */
-
-.findbar-find-previous,
-.findbar-find-next {
- margin-inline-start: 0;
- -moz-appearance: none;
- background: linear-gradient(rgba(255,255,255,.8) 1px, rgba(255,255,255,.4) 1px, rgba(255,255,255,.1));
- border: 1px solid ThreeDShadow;
- padding: 1px 5px;
- line-height: 1em;
-}
+/* highlight button */
-.findbar-find-previous:not([disabled]):active,
-.findbar-find-next:not([disabled]):active {
- background: rgba(23,50,76,.2);
- box-shadow: 0 1px 2px rgba(10,31,51,.2) inset;
+.findbar-highlight {
+ list-style-image: url("chrome://global/skin/icons/find.png");
+ -moz-image-region: rect(0px 48px 16px 32px);
}
-.findbar-find-previous {
- list-style-image: url(chrome://global/skin/icons/find-arrows.svg#glyph-find-previous);
+.findbar-highlight:hover {
+ -moz-image-region: rect(16px 48px 32px 32px);
}
-.findbar-find-next {
- list-style-image: url(chrome://global/skin/icons/find-arrows.svg#glyph-find-next);
+.findbar-highlight[disabled="true"] {
+ -moz-image-region: rect(32px 48px 48px 32px) !important;
}
-.findbar-find-previous,
-.findbar-find-previous:not([disabled]):active {
- border-right: none;
- border-left: none;
+.findbar-highlight:active, .findbar-highlight[checked="true"] {
+ -moz-image-region: rect(48px 48px 64px 32px);
}
-.findbar-find-previous > .toolbarbutton-icon,
-.findbar-find-next > .toolbarbutton-icon {
- margin: 0;
+.findbar-highlight[checked="true"]:hover {
+ -moz-image-region: rect(64px 48px 80px 32px);
}
-.findbar-find-previous[disabled="true"] > .toolbarbutton-icon,
-.findbar-find-next[disabled="true"] > .toolbarbutton-icon {
- opacity: .5;
+.find-status-icon {
+ list-style-image: none;
+ margin-top: 2px;
+ margin-bottom: 0px;
+ -moz-margin-start: 12px;
+ -moz-margin-end: 0px;
+ width: 16px;
+ height: 16px;
}
-.findbar-find-next:-moz-locale-dir(ltr) {
- border-top-right-radius: 2px;
- border-bottom-right-radius: 2px;
+.findbar-find-status,
+.found-matches {
+ margin: 0 !important;
+ -moz-margin-start: 3px !important;
+ padding: 2px !important;
}
-.findbar-find-next:-moz-locale-dir(rtl) {
- border-top-left-radius: 2px;
- border-bottom-left-radius: 2px;
+.find-status-icon[status="notfound"] {
+ list-style-image: url("chrome://global/skin/icons/information-16.png");
}
-.findbar-highlight,
-.findbar-case-sensitive,
-.findbar-entire-word {
- margin-inline-start: 5px;
+.findbar-textbox[status="notfound"] {
+ box-shadow: 0 0 0 1em #f66 inset;
+ color: white;
}
-.findbar-highlight > .toolbarbutton-icon,
-.findbar-case-sensitive > .toolbarbutton-icon,
-.findbar-entire-word > .toolbarbutton-icon {
- display: none;
+.findbar-textbox[flash="true"] {
+ box-shadow: 0 0 0 1em yellow inset;
+ color: black;
}
-.findbar-find-status,
-.found-matches {
- color: GrayText;
- margin: 0 !important;
- margin-inline-start: 12px !important;
+.find-status-icon[status="wrapped"] {
+ list-style-image: url("chrome://global/skin/icons/wrap.png");
}
.find-status-icon[status="pending"] {
- list-style-image: url("chrome://global/skin/icons/loading.png");
-}
-
-@media (min-resolution: 1.1dppx) {
- .find-status-icon[status="pending"] {
- width: 16px;
- list-style-image: url("chrome://global/skin/icons/loading@2x.png");
- }
+ list-style-image: url("chrome://global/skin/icons/loading_16.png");
}
diff --git a/toolkit/themes/windows/global/icons/find.png b/toolkit/themes/windows/global/icons/find.png
new file mode 100644
index 0000000000..60d6da97ec
--- /dev/null
+++ b/toolkit/themes/windows/global/icons/find.png
Binary files differ
diff --git a/toolkit/themes/windows/global/icons/question-32.png b/toolkit/themes/windows/global/icons/question-32.png
new file mode 100644
index 0000000000..7c80831b04
--- /dev/null
+++ b/toolkit/themes/windows/global/icons/question-32.png
Binary files differ
diff --git a/toolkit/themes/windows/global/icons/question-48.png b/toolkit/themes/windows/global/icons/question-48.png
new file mode 100644
index 0000000000..dd2b21874b
--- /dev/null
+++ b/toolkit/themes/windows/global/icons/question-48.png
Binary files differ
diff --git a/toolkit/themes/windows/global/inContentUI.css b/toolkit/themes/windows/global/inContentUI.css
new file mode 100644
index 0000000000..a3bca7b06b
--- /dev/null
+++ b/toolkit/themes/windows/global/inContentUI.css
@@ -0,0 +1,159 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/*
+ * The default namespace for this file is XUL. Be sure to prefix rules that
+ * are applicable to both XUL and HTML with '*|'.
+ */
+@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
+@namespace html url("http://www.w3.org/1999/xhtml");
+
+/* Page background */
+*|*:root {
+ -moz-appearance: none;
+ padding: 18px;
+ background-repeat: repeat;
+ color: -moz-dialogText;
+ background-color: -moz-dialog;
+ background-image: /* Texture */
+ url("chrome://global/skin/inContentUI/background-texture.png");
+}
+
+html|html {
+ font: message-box;
+}
+
+@media (-moz-windows-default-theme) and (-moz-os-version: windows-vista),
+ (-moz-windows-default-theme) and (-moz-os-version: windows-win7) {
+ *|*:root {
+ color: #000;
+ background-color: #CCD9EA;
+ }
+}
+
+@media (-moz-windows-glass) {
+ *|*:root {
+ /* Blame shorlander for this monstrosity. */
+ background-image: /* Side gradients */
+ linear-gradient(to right,
+ rgba(255,255,255,0.2), transparent 40%,
+ transparent 60%, rgba(255,255,255,0.2)),
+ /* Aero-style light beams */
+ -moz-linear-gradient(left 32deg,
+ /* First light beam */
+ transparent 19.5%, rgba(255,255,255,0.1) 20%,
+ rgba(255,255,255,0.1) 21.5%, rgba(255,255,255,0.2) 22%,
+ rgba(255,255,255,0.2) 25.5%, rgba(255,255,255,0.1) 26%,
+ rgba(255,255,255,0.1) 27.5%, transparent 28%,
+ /* Second light beam */
+ transparent 49.5%, rgba(255,255,255,0.1) 50%,
+ rgba(255,255,255,0.1) 52.5%, rgba(255,255,255,0.2) 53%,
+ rgba(255,255,255,0.2) 54.5%, rgba(255,255,255,0.1) 55%,
+ rgba(255,255,255,0.1) 57.5%, transparent 58%,
+ /* Third light beam */
+ transparent 87%, rgba(255,255,255,0.2) 90%),
+ /* Texture */
+ url("chrome://global/skin/inContentUI/background-texture.png");
+ }
+}
+
+/* Use the new in-content colors for #contentAreaDownloadsView. After landing
+ of bug 989469 the colors can be moved to *|*:root */
+*|*#contentAreaDownloadsView {
+ background: #f1f1f1;
+ color: #424e5a;
+}
+
+/* Content */
+*|*.main-content {
+ /* Needed to allow the radius to clip the inner content, see bug 595656 */
+ overflow: hidden;
+ background-color: rgba(255, 255, 255, 0.35);
+ background-image: linear-gradient(rgba(255, 255, 255, 0),
+ rgba(255, 255, 255, 0.75));
+ border: 1px solid #C3CEDF;
+}
+
+%ifdef XP_WIN
+@media (-moz-os-version: windows-vista),
+ (-moz-os-version: windows-win7) {
+%endif
+ *|*.main-content {
+ border-radius: 5px;
+ }
+%ifdef XP_WIN
+}
+%endif
+
+@media (-moz-windows-glass) {
+ /* Buttons */
+ *|button,
+ menulist,
+ colorpicker[type="button"] {
+ -moz-appearance: none;
+ color: black;
+ padding: 0 5px;
+ background: linear-gradient(rgba(251, 252, 253, 0.95), transparent 49%,
+ rgba(211, 212, 213, 0.45) 51%, rgba(225, 226, 229, 0.3));
+ background-clip: padding-box;
+ border-radius: 3px;
+ border: 1px solid rgba(31, 64, 100, 0.4);
+ border-top-color: rgba(31, 64, 100, 0.3);
+ box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.25) inset,
+ 0 0 2px 1px rgba(255, 255, 255, 0.25) inset;
+ }
+
+ menulist {
+ -moz-padding-end: 0;
+ }
+
+ colorpicker[type="button"]:-moz-focusring:not([open="true"]) > .colorpicker-button-colorbox {
+ outline: 1px dotted ThreeDDarkShadow;
+ }
+
+ html|button[disabled],
+ button[disabled="true"],
+ menulist[disabled="true"],
+ colorpicker[type="button"][disabled="true"] {
+ -moz-border-top-colors: rgba(31, 64, 100, 0.3) !important;
+ -moz-border-right-colors: rgba(31, 64, 100, 0.4) !important;
+ -moz-border-bottom-colors: rgba(31, 64, 100, 0.4) !important;
+ -moz-border-left-colors: rgba(31, 64, 100, 0.4) !important;
+ opacity: 0.8;
+ color: #505050;
+ }
+
+ html|button:not([disabled]):active:hover,
+ button:not([disabled="true"]):active:hover,
+ menulist[open="true"]:not([disabled="true"]),
+ colorpicker[type="button"][open="true"]:not([disabled="true"]) {
+ background-color: rgba(61, 76, 92, 0.2);
+ border-color: rgba(39, 53, 68, 0.5);
+ box-shadow: 0 0 3px 1px rgba(39, 53, 68, 0.2) inset;
+ }
+
+ button > .button-box {
+ padding: 1px !important;
+ }
+
+ spinbuttons > .spinbuttons-box > .spinbuttons-button {
+ border-radius: 0;
+ padding: 0 4px;
+ }
+
+ spinbuttons > .spinbuttons-box > .spinbuttons-up {
+ list-style-image: url("chrome://global/skin/arrow/arrow-up.gif");
+ border-bottom-width: 0;
+ }
+
+ spinbuttons > .spinbuttons-box > .spinbuttons-down {
+ list-style-image: url("chrome://global/skin/arrow/arrow-dn.gif");
+ }
+}
+
+colorpicker[type="button"] {
+ margin: 1px 5px 2px 5px;
+ padding: 3px;
+ height: 25px;
+}
diff --git a/toolkit/themes/windows/global/jar.mn b/toolkit/themes/windows/global/jar.mn
index 7f2f29942f..8c5d5de5af 100644
--- a/toolkit/themes/windows/global/jar.mn
+++ b/toolkit/themes/windows/global/jar.mn
@@ -27,6 +27,7 @@ toolkit.jar:
skin/classic/global/console/itemSelected.png (console/itemSelected.png)
skin/classic/global/findBar.css
* skin/classic/global/global.css
+* skin/classic/global/inContentUI.css
skin/classic/global/listbox.css
skin/classic/global/netError.css
skin/classic/global/numberbox.css
@@ -48,6 +49,7 @@ toolkit.jar:
skin/classic/global/icons/close-win7@2x.png (icons/close-win7@2x.png)
skin/classic/global/icons/close-inverted-win7.png (icons/close-inverted-win7.png)
skin/classic/global/icons/close-inverted-win7@2x.png (icons/close-inverted-win7@2x.png)
+ skin/classic/global/icons/find.png (icons/find.png)
skin/classic/global/icons/resizer.png (icons/resizer.png)
skin/classic/global/icons/sslWarning.png (icons/sslWarning.png)
* skin/classic/global/in-content/common.css (in-content/common.css)
diff --git a/toolkit/themes/windows/mozapps/jar.mn b/toolkit/themes/windows/mozapps/jar.mn
index 29203811f3..0d77a4e798 100644
--- a/toolkit/themes/windows/mozapps/jar.mn
+++ b/toolkit/themes/windows/mozapps/jar.mn
@@ -68,9 +68,13 @@ toolkit.jar:
* skin/classic/mozapps/xpinstall/xpinstallConfirm.css (extensions/xpinstallConfirm.css)
skin/classic/mozapps/xpinstall/xpinstallItemGeneric.png (extensions/extensionGeneric.png)
#endif
+ skin/classic/mozapps/passwordmgr/key.png (passwordmgr/key.png)
+ skin/classic/mozapps/passwordmgr/key-16.png (passwordmgr/key-16.png)
+ skin/classic/mozapps/passwordmgr/key-64.png (passwordmgr/key-64.png)
skin/classic/mozapps/plugins/pluginGeneric.png (plugins/pluginGeneric.png)
skin/classic/mozapps/plugins/pluginBlocked.png (plugins/pluginBlocked.png)
skin/classic/mozapps/plugins/pluginGeneric-16.png (plugins/pluginGeneric-16.png)
+ skin/classic/mozapps/plugins/pluginGeneric-48.png (plugins/pluginGeneric-48.png)
skin/classic/mozapps/profile/profileicon.png (profile/profileicon.png)
skin/classic/mozapps/update/updates.css (update/updates.css)
skin/classic/mozapps/viewsource/viewsource.css (viewsource/viewsource.css)
diff --git a/toolkit/themes/windows/mozapps/passwordmgr/key-16.png b/toolkit/themes/windows/mozapps/passwordmgr/key-16.png
new file mode 100644
index 0000000000..ac135b847e
--- /dev/null
+++ b/toolkit/themes/windows/mozapps/passwordmgr/key-16.png
Binary files differ
diff --git a/toolkit/themes/windows/mozapps/passwordmgr/key-64.png b/toolkit/themes/windows/mozapps/passwordmgr/key-64.png
new file mode 100644
index 0000000000..0fb69f3828
--- /dev/null
+++ b/toolkit/themes/windows/mozapps/passwordmgr/key-64.png
Binary files differ
diff --git a/toolkit/themes/windows/mozapps/passwordmgr/key.png b/toolkit/themes/windows/mozapps/passwordmgr/key.png
new file mode 100644
index 0000000000..b5e8afefca
--- /dev/null
+++ b/toolkit/themes/windows/mozapps/passwordmgr/key.png
Binary files differ
diff --git a/toolkit/themes/windows/mozapps/plugins/pluginGeneric-16.png b/toolkit/themes/windows/mozapps/plugins/pluginGeneric-16.png
index 5d796cc4c5..080b0e5028 100644
--- a/toolkit/themes/windows/mozapps/plugins/pluginGeneric-16.png
+++ b/toolkit/themes/windows/mozapps/plugins/pluginGeneric-16.png
Binary files differ
diff --git a/toolkit/themes/windows/mozapps/plugins/pluginGeneric-48.png b/toolkit/themes/windows/mozapps/plugins/pluginGeneric-48.png
new file mode 100644
index 0000000000..173679448d
--- /dev/null
+++ b/toolkit/themes/windows/mozapps/plugins/pluginGeneric-48.png
Binary files differ
diff --git a/toolkit/themes/windows/mozapps/plugins/pluginGeneric.png b/toolkit/themes/windows/mozapps/plugins/pluginGeneric.png
index d8b270ae52..1fcbf154ed 100644
--- a/toolkit/themes/windows/mozapps/plugins/pluginGeneric.png
+++ b/toolkit/themes/windows/mozapps/plugins/pluginGeneric.png
Binary files differ
diff --git a/toolkit/toolkit.mozbuild b/toolkit/toolkit.mozbuild
index a782acd3ab..3b3bf80ae4 100644
--- a/toolkit/toolkit.mozbuild
+++ b/toolkit/toolkit.mozbuild
@@ -181,10 +181,6 @@ if CONFIG['ENABLE_TESTS']:
'/testing/web-platform',
]
- # The file id utility requires breakpad libraries.
- if CONFIG['MOZ_CRASHREPORTER']:
- DIRS += ['/testing/tools/fileid']
-
if CONFIG['MOZ_MEMORY']:
DIRS += ['/memory/gtest']
diff --git a/toolkit/xre/MozMeegoAppService.h b/toolkit/xre/MozMeegoAppService.h
deleted file mode 100644
index 063d03e02b..0000000000
--- a/toolkit/xre/MozMeegoAppService.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=2 et sw=2 tw=80: */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef MOZMEEGOAPPSERVICE_H
-#define MOZMEEGOAPPSERVICE_H
-
-#include <MApplicationService>
-
-/**
- * App service class, which prevents registration to d-bus
- * and allows multiple instances of application. This is
- * required for Mozillas remote service to work, because
- * it is initialized after MApplication.
- */
-class MozMeegoAppService: public MApplicationService
-{
- Q_OBJECT
-public:
- MozMeegoAppService(): MApplicationService(QString()) {}
-public Q_SLOTS:
- virtual QString registeredName() { return QString(); }
- virtual bool isRegistered() { return false; }
- virtual bool registerService() { return true; }
-};
-#endif // MOZMEEGOAPPSERVICE_H
diff --git a/toolkit/xre/ProfileReset.cpp b/toolkit/xre/ProfileReset.cpp
index aef2d7746d..c9e2ef8d42 100644
--- a/toolkit/xre/ProfileReset.cpp
+++ b/toolkit/xre/ProfileReset.cpp
@@ -31,13 +31,19 @@ static const char kProfileProperties[] =
* Creates a new profile with a timestamp in the name to use for profile reset.
*/
nsresult
-CreateResetProfile(nsIToolkitProfileService* aProfileSvc, nsIToolkitProfile* *aNewProfile)
+CreateResetProfile(nsIToolkitProfileService* aProfileSvc, const nsACString& aOldProfileName, nsIToolkitProfile* *aNewProfile)
{
MOZ_ASSERT(aProfileSvc, "NULL profile service");
nsCOMPtr<nsIToolkitProfile> newProfile;
- // Make the new profile "default-" + the time in seconds since epoch for uniqueness.
- nsAutoCString newProfileName("default-");
+ // Make the new profile the old profile (or "default-") + the time in seconds since epoch for uniqueness.
+ nsAutoCString newProfileName;
+ if (!aOldProfileName.IsEmpty()) {
+ newProfileName.Assign(aOldProfileName);
+ newProfileName.Append("-");
+ } else {
+ newProfileName.Assign("default-");
+ }
newProfileName.Append(nsPrintfCString("%lld", PR_Now() / 1000));
nsresult rv = aProfileSvc->CreateProfile(nullptr, // choose a default dir for us
newProfileName,
diff --git a/toolkit/xre/ProfileReset.h b/toolkit/xre/ProfileReset.h
index 7b5efbc4ea..a164fe0751 100644
--- a/toolkit/xre/ProfileReset.h
+++ b/toolkit/xre/ProfileReset.h
@@ -11,6 +11,7 @@ static bool gProfileResetCleanupCompleted = false;
static const char kResetProgressURL[] = "chrome://global/content/resetProfileProgress.xul";
nsresult CreateResetProfile(nsIToolkitProfileService* aProfileSvc,
+ const nsACString& aOldProfileName,
nsIToolkitProfile* *aNewProfile);
nsresult ProfileResetCleanup(nsIToolkitProfile* aOldProfile);
diff --git a/toolkit/xre/nsAndroidStartup.cpp b/toolkit/xre/nsAndroidStartup.cpp
index a88c58e5d9..47b9ec6e52 100644
--- a/toolkit/xre/nsAndroidStartup.cpp
+++ b/toolkit/xre/nsAndroidStartup.cpp
@@ -26,15 +26,6 @@ GeckoStart(JNIEnv* env, char* data, const nsXREAppData* appData)
{
mozilla::jni::SetGeckoThreadEnv(env);
-#ifdef MOZ_CRASHREPORTER
- const struct mapping_info *info = getLibraryMapping();
- while (info->name) {
- CrashReporter::AddLibraryMapping(info->name, info->base,
- info->len, info->offset);
- info++;
- }
-#endif
-
if (!data) {
LOG("Failed to get arguments for GeckoStart\n");
return;
diff --git a/toolkit/xre/nsAppRunner.cpp b/toolkit/xre/nsAppRunner.cpp
index 1b5c2ed75b..3493cd8374 100644
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -190,17 +190,6 @@
#include "jprof.h"
#endif
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#include "nsICrashReporter.h"
-#define NS_CRASHREPORTER_CONTRACTID "@mozilla.org/toolkit/crash-reporter;1"
-#include "nsIPrefService.h"
-#include "nsIMemoryInfoDumper.h"
-#if defined(XP_LINUX) && !defined(ANDROID)
-#include "mozilla/widget/LSBUtils.h"
-#endif
-#endif
-
#include "base/command_line.h"
#include "GTestRunner.h"
@@ -646,10 +635,6 @@ class nsXULAppInfo : public nsIXULAppInfo,
#ifdef XP_WIN
public nsIWinAppHelper,
#endif
-#ifdef MOZ_CRASHREPORTER
- public nsICrashReporter,
- public nsIFinishDumpingCallback,
-#endif
public nsIXULRuntime
{
@@ -660,10 +645,6 @@ public:
NS_DECL_NSIXULAPPINFO
NS_DECL_NSIXULRUNTIME
NS_DECL_NSIOBSERVER
-#ifdef MOZ_CRASHREPORTER
- NS_DECL_NSICRASHREPORTER
- NS_DECL_NSIFINISHDUMPINGCALLBACK
-#endif
#ifdef XP_WIN
NS_DECL_NSIWINAPPHELPER
#endif
@@ -676,10 +657,6 @@ NS_INTERFACE_MAP_BEGIN(nsXULAppInfo)
#ifdef XP_WIN
NS_INTERFACE_MAP_ENTRY(nsIWinAppHelper)
#endif
-#ifdef MOZ_CRASHREPORTER
- NS_INTERFACE_MAP_ENTRY(nsICrashReporter)
- NS_INTERFACE_MAP_ENTRY(nsIFinishDumpingCallback)
-#endif
NS_INTERFACE_MAP_ENTRY(nsIPlatformInfo)
NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIXULAppInfo, gAppData ||
XRE_IsContentProcess())
@@ -1004,12 +981,7 @@ nsXULAppInfo::GetReplacedLockTime(PRTime *aReplacedLockTime)
NS_IMETHODIMP
nsXULAppInfo::GetLastRunCrashID(nsAString &aLastRunCrashID)
{
-#ifdef MOZ_CRASHREPORTER
- CrashReporter::GetLastRunCrashID(aLastRunCrashID);
- return NS_OK;
-#else
return NS_ERROR_NOT_IMPLEMENTED;
-#endif
}
NS_IMETHODIMP
@@ -1051,7 +1023,7 @@ nsXULAppInfo::GetDistributionID(nsACString& aResult)
NS_IMETHODIMP
nsXULAppInfo::GetIsOfficial(bool* aResult)
{
-#ifdef MOZILLA_OFFICIAL
+#ifdef MC_OFFICIAL
*aResult = true;
#else
*aResult = false;
@@ -1117,219 +1089,6 @@ nsXULAppInfo::GetUserCanElevate(bool *aUserCanElevate)
}
#endif
-#ifdef MOZ_CRASHREPORTER
-NS_IMETHODIMP
-nsXULAppInfo::GetEnabled(bool *aEnabled)
-{
- *aEnabled = CrashReporter::GetEnabled();
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::SetEnabled(bool aEnabled)
-{
- if (aEnabled) {
- if (CrashReporter::GetEnabled()) {
- // no point in erroring for double-enabling
- return NS_OK;
- }
-
- nsCOMPtr<nsIFile> greBinDir;
- NS_GetSpecialDirectory(NS_GRE_BIN_DIR, getter_AddRefs(greBinDir));
- if (!greBinDir) {
- return NS_ERROR_FAILURE;
- }
-
- nsCOMPtr<nsIFile> xreBinDirectory = do_QueryInterface(greBinDir);
- if (!xreBinDirectory) {
- return NS_ERROR_FAILURE;
- }
-
- return CrashReporter::SetExceptionHandler(xreBinDirectory, true);
- }
- else {
- if (!CrashReporter::GetEnabled()) {
- // no point in erroring for double-disabling
- return NS_OK;
- }
-
- return CrashReporter::UnsetExceptionHandler();
- }
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::GetServerURL(nsIURL** aServerURL)
-{
- if (!CrashReporter::GetEnabled())
- return NS_ERROR_NOT_INITIALIZED;
-
- nsAutoCString data;
- if (!CrashReporter::GetServerURL(data)) {
- return NS_ERROR_FAILURE;
- }
- nsCOMPtr<nsIURI> uri;
- NS_NewURI(getter_AddRefs(uri), data);
- if (!uri)
- return NS_ERROR_FAILURE;
-
- nsCOMPtr<nsIURL> url;
- url = do_QueryInterface(uri);
- NS_ADDREF(*aServerURL = url);
-
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::SetServerURL(nsIURL* aServerURL)
-{
- bool schemeOk;
- // only allow https or http URLs
- nsresult rv = aServerURL->SchemeIs("https", &schemeOk);
- NS_ENSURE_SUCCESS(rv, rv);
- if (!schemeOk) {
- rv = aServerURL->SchemeIs("http", &schemeOk);
- NS_ENSURE_SUCCESS(rv, rv);
-
- if (!schemeOk)
- return NS_ERROR_INVALID_ARG;
- }
- nsAutoCString spec;
- rv = aServerURL->GetSpec(spec);
- NS_ENSURE_SUCCESS(rv, rv);
-
- return CrashReporter::SetServerURL(spec);
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::GetMinidumpPath(nsIFile** aMinidumpPath)
-{
- if (!CrashReporter::GetEnabled())
- return NS_ERROR_NOT_INITIALIZED;
-
- nsAutoString path;
- if (!CrashReporter::GetMinidumpPath(path))
- return NS_ERROR_FAILURE;
-
- nsresult rv = NS_NewLocalFile(path, false, aMinidumpPath);
- NS_ENSURE_SUCCESS(rv, rv);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::SetMinidumpPath(nsIFile* aMinidumpPath)
-{
- nsAutoString path;
- nsresult rv = aMinidumpPath->GetPath(path);
- NS_ENSURE_SUCCESS(rv, rv);
- return CrashReporter::SetMinidumpPath(path);
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::AnnotateCrashReport(const nsACString& key,
- const nsACString& data)
-{
- return CrashReporter::AnnotateCrashReport(key, data);
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::AppendAppNotesToCrashReport(const nsACString& data)
-{
- return CrashReporter::AppendAppNotesToCrashReport(data);
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::RegisterAppMemory(uint64_t pointer,
- uint64_t len)
-{
- return CrashReporter::RegisterAppMemory((void *)pointer, len);
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::WriteMinidumpForException(void* aExceptionInfo)
-{
-#ifdef XP_WIN32
- return CrashReporter::WriteMinidumpForException(static_cast<EXCEPTION_POINTERS*>(aExceptionInfo));
-#else
- return NS_ERROR_NOT_IMPLEMENTED;
-#endif
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::AppendObjCExceptionInfoToAppNotes(void* aException)
-{
-#ifdef XP_MACOSX
- return CrashReporter::AppendObjCExceptionInfoToAppNotes(aException);
-#else
- return NS_ERROR_NOT_IMPLEMENTED;
-#endif
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::GetSubmitReports(bool* aEnabled)
-{
- return CrashReporter::GetSubmitReports(aEnabled);
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::SetSubmitReports(bool aEnabled)
-{
- return CrashReporter::SetSubmitReports(aEnabled);
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::UpdateCrashEventsDir()
-{
- CrashReporter::UpdateCrashEventsDir();
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::SaveMemoryReport()
-{
- if (!CrashReporter::GetEnabled()) {
- return NS_ERROR_NOT_INITIALIZED;
- }
- nsCOMPtr<nsIFile> file;
- nsresult rv = CrashReporter::GetDefaultMemoryReportFile(getter_AddRefs(file));
- if (NS_WARN_IF(NS_FAILED(rv))) {
- return rv;
- }
-
- nsString path;
- file->GetPath(path);
-
- nsCOMPtr<nsIMemoryInfoDumper> dumper =
- do_GetService("@mozilla.org/memory-info-dumper;1");
- if (NS_WARN_IF(!dumper)) {
- return NS_ERROR_UNEXPECTED;
- }
-
- rv = dumper->DumpMemoryReportsToNamedFile(path, this, file, true /* anonymize */);
- if (NS_WARN_IF(NS_FAILED(rv))) {
- return rv;
- }
- return NS_OK;
-}
-
-NS_IMETHODIMP
-nsXULAppInfo::SetTelemetrySessionId(const nsACString& id)
-{
- CrashReporter::SetTelemetrySessionId(id);
- return NS_OK;
-}
-
-// This method is from nsIFInishDumpingCallback.
-NS_IMETHODIMP
-nsXULAppInfo::Callback(nsISupports* aData)
-{
- nsCOMPtr<nsIFile> file = do_QueryInterface(aData);
- MOZ_ASSERT(file);
-
- CrashReporter::SetMemoryReportFile(file);
- return NS_OK;
-}
-#endif
-
static const nsXULAppInfo kAppInfo;
static nsresult AppInfoConstructor(nsISupports* aOuter,
REFNSIID aIID, void **aResult)
@@ -1434,9 +1193,6 @@ static const mozilla::Module::CIDEntry kXRECIDs[] = {
static const mozilla::Module::ContractIDEntry kXREContracts[] = {
{ XULAPPINFO_SERVICE_CONTRACTID, &kAPPINFO_CID },
{ XULRUNTIME_SERVICE_CONTRACTID, &kAPPINFO_CID },
-#ifdef MOZ_CRASHREPORTER
- { NS_CRASHREPORTER_CONTRACTID, &kAPPINFO_CID },
-#endif
{ NS_PROFILESERVICE_CONTRACTID, &kProfileServiceCID },
{ NS_NATIVEAPPSUPPORT_CONTRACTID, &kNativeAppSupportCID },
{ nullptr }
@@ -1601,7 +1357,9 @@ DumpHelp()
" -v or --version Print %s version.\n"
" -P <profile> Start with <profile>.\n"
" --profile <path> Start with profile at <path>.\n"
+#ifdef MC_BASILISK
" --migration Start with migration wizard.\n"
+#endif
" --ProfileManager Start with ProfileManager.\n"
" --no-remote Do not accept or send remote commands;\n"
" implies --new-instance.\n"
@@ -2130,17 +1888,20 @@ ShowProfileManager(nsIToolkitProfileService* aProfileSvc,
}
/**
- * Set the currently running profile as the default/selected one.
+ * Get the currently running profile using its root directory.
*
+ * @param aProfileSvc The profile service
* @param aCurrentProfileRoot The root directory of the current profile.
- * @return an error if aCurrentProfileRoot is not found or the profile could not
- * be set as the default.
+ * @param aProfile Out-param that returns the profile object.
+ * @return an error if aCurrentProfileRoot is not found
*/
static nsresult
-SetCurrentProfileAsDefault(nsIToolkitProfileService* aProfileSvc,
- nsIFile* aCurrentProfileRoot)
+GetCurrentProfile(nsIToolkitProfileService* aProfileSvc,
+ nsIFile* aCurrentProfileRoot,
+ nsIToolkitProfile** aProfile)
{
NS_ENSURE_ARG_POINTER(aProfileSvc);
+ NS_ENSURE_ARG_POINTER(aProfile);
nsCOMPtr<nsISimpleEnumerator> profiles;
nsresult rv = aProfileSvc->GetProfiles(getter_AddRefs(profiles));
@@ -2156,7 +1917,8 @@ SetCurrentProfileAsDefault(nsIToolkitProfileService* aProfileSvc,
profile->GetRootDir(getter_AddRefs(profileRoot));
profileRoot->Equals(aCurrentProfileRoot, &foundMatchingProfile);
if (foundMatchingProfile) {
- return aProfileSvc->SetSelectedProfile(profile);
+ profile.forget(aProfile);
+ return NS_OK;
}
rv = profiles->GetNext(getter_AddRefs(supports));
}
@@ -2244,7 +2006,7 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n
if (gDoProfileReset) {
// If we're resetting a profile, create a new one and use it to startup.
nsCOMPtr<nsIToolkitProfile> newProfile;
- rv = CreateResetProfile(aProfileSvc, getter_AddRefs(newProfile));
+ rv = CreateResetProfile(aProfileSvc, gResetOldProfileName, getter_AddRefs(newProfile));
if (NS_SUCCEEDED(rv)) {
rv = newProfile->GetRootDir(getter_AddRefs(lf));
NS_ENSURE_SUCCESS(rv, rv);
@@ -2390,20 +2152,20 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n
return ProfileLockedDialog(profile, unlocker, aNative, &tempProfileLock);
}
- nsCOMPtr<nsIToolkitProfile> newProfile;
- rv = CreateResetProfile(aProfileSvc, getter_AddRefs(newProfile));
- if (NS_FAILED(rv)) {
- NS_WARNING("Failed to create a profile to reset to.");
- gDoProfileReset = false;
- } else {
- nsresult gotName = profile->GetName(gResetOldProfileName);
- if (NS_SUCCEEDED(gotName)) {
- profile = newProfile;
- } else {
- NS_WARNING("Failed to get the name of the profile we're resetting, so aborting reset.");
- gResetOldProfileName.Truncate(0);
+ nsresult gotName = profile->GetName(gResetOldProfileName);
+ if (NS_SUCCEEDED(gotName)) {
+ nsCOMPtr<nsIToolkitProfile> newProfile;
+ rv = CreateResetProfile(aProfileSvc, gResetOldProfileName, getter_AddRefs(newProfile));
+ if (NS_FAILED(rv)) {
+ NS_WARNING("Failed to create a profile to reset to.");
gDoProfileReset = false;
+ } else {
+ profile = newProfile;
}
+ } else {
+ NS_WARNING("Failed to get the name of the profile we're resetting, so aborting reset.");
+ gResetOldProfileName.Truncate(0);
+ gDoProfileReset = false;
}
}
@@ -2498,20 +2260,22 @@ SelectProfile(nsIProfileLock* *aResult, nsIToolkitProfileService* aProfileSvc, n
return ProfileLockedDialog(profile, unlocker, aNative, &tempProfileLock);
}
- nsCOMPtr<nsIToolkitProfile> newProfile;
- rv = CreateResetProfile(aProfileSvc, getter_AddRefs(newProfile));
- if (NS_FAILED(rv)) {
- NS_WARNING("Failed to create a profile to reset to.");
- gDoProfileReset = false;
- } else {
- nsresult gotName = profile->GetName(gResetOldProfileName);
- if (NS_SUCCEEDED(gotName)) {
- profile = newProfile;
- } else {
- NS_WARNING("Failed to get the name of the profile we're resetting, so aborting reset.");
- gResetOldProfileName.Truncate(0);
+ nsresult gotName = profile->GetName(gResetOldProfileName);
+ if (NS_SUCCEEDED(gotName)) {
+ nsCOMPtr<nsIToolkitProfile> newProfile;
+ rv = CreateResetProfile(aProfileSvc, gResetOldProfileName, getter_AddRefs(newProfile));
+ if (NS_FAILED(rv)) {
+ NS_WARNING("Failed to create a profile to reset to.");
gDoProfileReset = false;
}
+ else {
+ profile = newProfile;
+ }
+ }
+ else {
+ NS_WARNING("Failed to get the name of the profile we're resetting, so aborting reset.");
+ gResetOldProfileName.Truncate(0);
+ gDoProfileReset = false;
}
}
@@ -2763,33 +2527,6 @@ static void RestoreStateForAppInitiatedRestart()
}
}
-#ifdef MOZ_CRASHREPORTER
-// When we first initialize the crash reporter we don't have a profile,
-// so we set the minidump path to $TEMP. Once we have a profile,
-// we set it to $PROFILE/minidumps, creating the directory
-// if needed.
-static void MakeOrSetMinidumpPath(nsIFile* profD)
-{
- nsCOMPtr<nsIFile> dumpD;
- profD->Clone(getter_AddRefs(dumpD));
-
- if (dumpD) {
- bool fileExists;
- //XXX: do some more error checking here
- dumpD->Append(NS_LITERAL_STRING("minidumps"));
- dumpD->Exists(&fileExists);
- if (!fileExists) {
- nsresult rv = dumpD->Create(nsIFile::DIRECTORY_TYPE, 0700);
- NS_ENSURE_SUCCESS_VOID(rv);
- }
-
- nsAutoString pathStr;
- if (NS_SUCCEEDED(dumpD->GetPath(pathStr)))
- CrashReporter::SetMinidumpPath(pathStr);
- }
-}
-#endif
-
const nsXREAppData* gAppData = nullptr;
#ifdef MOZ_WIDGET_GTK
@@ -3215,94 +2952,6 @@ XREMain::XRE_mainInit(bool* aExitFlag)
if (NS_FAILED(rv))
return 1;
-#ifdef MOZ_CRASHREPORTER
- if (EnvHasValue("MOZ_CRASHREPORTER")) {
- mAppData->flags |= NS_XRE_ENABLE_CRASH_REPORTER;
- }
-
- nsCOMPtr<nsIFile> xreBinDirectory;
- xreBinDirectory = mDirProvider.GetGREBinDir();
-
- if ((mAppData->flags & NS_XRE_ENABLE_CRASH_REPORTER) &&
- NS_SUCCEEDED(
- CrashReporter::SetExceptionHandler(xreBinDirectory))) {
- nsCOMPtr<nsIFile> file;
- rv = mDirProvider.GetUserAppDataDirectory(getter_AddRefs(file));
- if (NS_SUCCEEDED(rv)) {
- CrashReporter::SetUserAppDataDirectory(file);
- }
- if (mAppData->crashReporterURL)
- CrashReporter::SetServerURL(nsDependentCString(mAppData->crashReporterURL));
-
- // We overwrite this once we finish starting up.
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("StartupCrash"),
- NS_LITERAL_CSTRING("1"));
-
- // pass some basic info from the app data
- if (mAppData->vendor)
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Vendor"),
- nsDependentCString(mAppData->vendor));
- if (mAppData->name)
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProductName"),
- nsDependentCString(mAppData->name));
- if (mAppData->ID)
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ProductID"),
- nsDependentCString(mAppData->ID));
- if (mAppData->version)
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Version"),
- nsDependentCString(mAppData->version));
- if (mAppData->buildID)
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("BuildID"),
- nsDependentCString(mAppData->buildID));
-
- nsDependentCString releaseChannel(NS_STRINGIFY(MOZ_UPDATE_CHANNEL));
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ReleaseChannel"),
- releaseChannel);
-#ifdef MOZ_LINKER
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("CrashAddressLikelyWrong"),
- IsSignalHandlingBroken() ? NS_LITERAL_CSTRING("1")
- : NS_LITERAL_CSTRING("0"));
-#endif
-
-#ifdef XP_WIN
- nsAutoString appInitDLLs;
- if (widget::WinUtils::GetAppInitDLLs(appInitDLLs)) {
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AppInitDLLs"),
- NS_ConvertUTF16toUTF8(appInitDLLs));
- }
-#endif
-
- CrashReporter::SetRestartArgs(gArgc, gArgv);
-
- // annotate other data (user id etc)
- nsCOMPtr<nsIFile> userAppDataDir;
- if (NS_SUCCEEDED(mDirProvider.GetUserAppDataDirectory(
- getter_AddRefs(userAppDataDir)))) {
- CrashReporter::SetupExtraData(userAppDataDir,
- nsDependentCString(mAppData->buildID));
-
- // see if we have a crashreporter-override.ini in the application directory
- nsCOMPtr<nsIFile> overrideini;
- bool exists;
- if (NS_SUCCEEDED(mDirProvider.GetAppDir()->Clone(getter_AddRefs(overrideini))) &&
- NS_SUCCEEDED(overrideini->AppendNative(NS_LITERAL_CSTRING("crashreporter-override.ini"))) &&
- NS_SUCCEEDED(overrideini->Exists(&exists)) &&
- exists) {
-#ifdef XP_WIN
- nsAutoString overridePathW;
- overrideini->GetPath(overridePathW);
- NS_ConvertUTF16toUTF8 overridePath(overridePathW);
-#else
- nsAutoCString overridePath;
- overrideini->GetNativePath(overridePath);
-#endif
-
- SaveWordToEnv("MOZ_CRASHREPORTER_STRINGS_OVERRIDE", overridePath);
- }
- }
- }
-#endif
-
#if defined(MOZ_SANDBOX) && defined(XP_WIN)
if (mAppData->sandboxBrokerServices) {
SandboxBroker::Initialize(mAppData->sandboxBrokerServices);
@@ -3448,22 +3097,9 @@ XREMain::XRE_mainInit(bool* aExitFlag)
}
}
-#ifdef MOZ_CRASHREPORTER
- if (cpuUpdateRevision > 0) {
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("CPUMicrocodeVersion"),
- nsPrintfCString("0x%x",
- cpuUpdateRevision));
- }
-#endif
}
#endif
-#ifdef MOZ_CRASHREPORTER
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("SafeMode"),
- gSafeMode ? NS_LITERAL_CSTRING("1") :
- NS_LITERAL_CSTRING("0"));
-#endif
-
// Handle --no-remote and --new-instance command line arguments. Setup
// the environment to better accommodate other components and various
// restart scenarios.
@@ -3523,102 +3159,6 @@ XREMain::XRE_mainInit(bool* aExitFlag)
return 0;
}
-#ifdef MOZ_CRASHREPORTER
-#ifdef XP_WIN
-/**
- * Uses WMI to read some manufacturer information that may be useful for
- * diagnosing hardware-specific crashes. This function is best-effort; failures
- * shouldn't burden the caller. COM must be initialized before calling.
- */
-static void AnnotateSystemManufacturer()
-{
- RefPtr<IWbemLocator> locator;
-
- HRESULT hr = CoCreateInstance(CLSID_WbemLocator, nullptr, CLSCTX_INPROC_SERVER,
- IID_IWbemLocator, getter_AddRefs(locator));
-
- if (FAILED(hr)) {
- return;
- }
-
- RefPtr<IWbemServices> services;
-
- hr = locator->ConnectServer(_bstr_t(L"ROOT\\CIMV2"), nullptr, nullptr, nullptr,
- 0, nullptr, nullptr, getter_AddRefs(services));
-
- if (FAILED(hr)) {
- return;
- }
-
- hr = CoSetProxyBlanket(services, RPC_C_AUTHN_WINNT, RPC_C_AUTHZ_NONE, nullptr,
- RPC_C_AUTHN_LEVEL_CALL, RPC_C_IMP_LEVEL_IMPERSONATE,
- nullptr, EOAC_NONE);
-
- if (FAILED(hr)) {
- return;
- }
-
- RefPtr<IEnumWbemClassObject> enumerator;
-
- hr = services->ExecQuery(_bstr_t(L"WQL"), _bstr_t(L"SELECT * FROM Win32_BIOS"),
- WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
- nullptr, getter_AddRefs(enumerator));
-
- if (FAILED(hr) || !enumerator) {
- return;
- }
-
- RefPtr<IWbemClassObject> classObject;
- ULONG results;
-
- hr = enumerator->Next(WBEM_INFINITE, 1, getter_AddRefs(classObject), &results);
-
- if (FAILED(hr) || results == 0) {
- return;
- }
-
- VARIANT value;
- VariantInit(&value);
-
- hr = classObject->Get(L"Manufacturer", 0, &value, 0, 0);
-
- if (SUCCEEDED(hr) && V_VT(&value) == VT_BSTR) {
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("BIOS_Manufacturer"),
- NS_ConvertUTF16toUTF8(V_BSTR(&value)));
- }
-
- VariantClear(&value);
-}
-
-static void PR_CALLBACK AnnotateSystemManufacturer_ThreadStart(void*)
-{
- HRESULT hr = CoInitialize(nullptr);
-
- if (FAILED(hr)) {
- return;
- }
-
- AnnotateSystemManufacturer();
-
- CoUninitialize();
-}
-#endif // XP_WIN
-
-#if defined(XP_LINUX) && !defined(ANDROID)
-
-static void
-AnnotateLSBRelease(void*)
-{
- nsCString dist, desc, release, codename;
- if (widget::lsb::GetLSBRelease(dist, desc, release, codename)) {
- CrashReporter::AppendAppNotesToCrashReport(desc);
- }
-}
-
-#endif // defined(XP_LINUX) && !defined(ANDROID)
-
-#endif
-
namespace mozilla {
ShutdownChecksMode gShutdownChecks = SCM_NOTHING;
} // namespace mozilla
@@ -4007,13 +3547,6 @@ XREMain::XRE_mainStartup(bool* aExitFlag)
mozilla::Telemetry::SetProfileDir(mProfD);
-#ifdef MOZ_CRASHREPORTER
- if (mAppData->flags & NS_XRE_ENABLE_CRASH_REPORTER)
- MakeOrSetMinidumpPath(mProfD);
-
- CrashReporter::SetProfileDirectory(mProfD);
-#endif
-
nsAutoCString version;
BuildVersion(version);
@@ -4103,39 +3636,6 @@ XREMain::XRE_mainStartup(bool* aExitFlag)
return 0;
}
-#if defined(MOZ_CRASHREPORTER)
-#if defined(MOZ_CONTENT_SANDBOX) && !defined(MOZ_WIDGET_GONK)
-void AddSandboxAnnotations()
-{
- // Include the sandbox content level, regardless of platform
- int level = Preferences::GetInt("security.sandbox.content.level");
-
- nsAutoCString levelString;
- levelString.AppendInt(level);
-
- CrashReporter::AnnotateCrashReport(
- NS_LITERAL_CSTRING("ContentSandboxLevel"), levelString);
-
- // Include whether or not this instance is capable of content sandboxing
- bool sandboxCapable = false;
-
-#if defined(XP_WIN)
- // All supported Windows versions support some level of content sandboxing
- sandboxCapable = true;
-#elif defined(XP_MACOSX)
- // All supported OS X versions are capable
- sandboxCapable = true;
-#elif defined(XP_LINUX)
- sandboxCapable = SandboxInfo::Get().CanSandboxContent();
-#endif
-
- CrashReporter::AnnotateCrashReport(
- NS_LITERAL_CSTRING("ContentSandboxCapable"),
- sandboxCapable ? NS_LITERAL_CSTRING("1") : NS_LITERAL_CSTRING("0"));
-}
-#endif /* MOZ_CONTENT_SANDBOX && !MOZ_WIDGET_GONK */
-#endif /* MOZ_CRASHREPORTER */
-
/*
* XRE_mainRun - Command line startup, profile migration, and
* the calling of appStartup->Run().
@@ -4169,40 +3669,6 @@ XREMain::XRE_mainRun()
rv = mScopedXPCOM->SetWindowCreator(mNativeApp);
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
-#ifdef MOZ_CRASHREPORTER
- // tell the crash reporter to also send the release channel
- nsCOMPtr<nsIPrefService> prefs = do_GetService("@mozilla.org/preferences-service;1", &rv);
- if (NS_SUCCEEDED(rv)) {
- nsCOMPtr<nsIPrefBranch> defaultPrefBranch;
- rv = prefs->GetDefaultBranch(nullptr, getter_AddRefs(defaultPrefBranch));
-
- if (NS_SUCCEEDED(rv)) {
- nsXPIDLCString sval;
- rv = defaultPrefBranch->GetCharPref("app.update.channel", getter_Copies(sval));
- if (NS_SUCCEEDED(rv)) {
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("ReleaseChannel"),
- sval);
- }
- }
- }
- // Needs to be set after xpcom initialization.
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("FramePoisonBase"),
- nsPrintfCString("%.16llx", uint64_t(gMozillaPoisonBase)));
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("FramePoisonSize"),
- nsPrintfCString("%lu", uint32_t(gMozillaPoisonSize)));
-
-#ifdef XP_WIN
- PR_CreateThread(PR_USER_THREAD, AnnotateSystemManufacturer_ThreadStart, 0,
- PR_PRIORITY_LOW, PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 0);
-#endif
-
-#if defined(XP_LINUX) && !defined(ANDROID)
- PR_CreateThread(PR_USER_THREAD, AnnotateLSBRelease, 0, PR_PRIORITY_LOW,
- PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 0);
-#endif
-
-#endif
-
if (mStartOffline) {
nsCOMPtr<nsIIOService2> io (do_GetService("@mozilla.org/network/io-service;1"));
NS_ENSURE_TRUE(io, NS_ERROR_FAILURE);
@@ -4281,7 +3747,12 @@ XREMain::XRE_mainRun()
if (gDoProfileReset) {
// Automatically migrate from the current application if we just
// reset the profile.
- aKey = MOZ_APP_NAME;
+ // For Basilisk and Pale Moon:
+ // Hard-code MOZ_APP_NAME to firefox because of hard-coded type in migrator.
+ aKey = (((MOZ_APP_NAME == "basilisk")
+ || (MOZ_APP_NAME == "palemoon"))
+ ? "firefox" : MOZ_APP_NAME);
+
}
pm->Migrate(&mDirProvider, aKey, gResetOldProfileName);
}
@@ -4291,15 +3762,23 @@ XREMain::XRE_mainRun()
nsresult backupCreated = ProfileResetCleanup(profileBeingReset);
if (NS_FAILED(backupCreated)) NS_WARNING("Could not cleanup the profile that was reset");
- // Set the new profile as the default after we're done cleaning up the old profile,
- // iff that profile was already the default
- if (profileWasSelected) {
- // this is actually "broken" - see bug 1122124
- rv = SetCurrentProfileAsDefault(mProfileSvc, mProfD);
- if (NS_FAILED(rv)) NS_WARNING("Could not set current profile as the default");
+ nsCOMPtr<nsIToolkitProfile> newProfile;
+ rv = GetCurrentProfile(mProfileSvc, mProfD, getter_AddRefs(newProfile));
+ if (NS_SUCCEEDED(rv)) {
+ newProfile->SetName(gResetOldProfileName);
+ mProfileName.Assign(gResetOldProfileName);
+ // Set the new profile as the default after we're done cleaning up the old profile,
+ // iff that profile was already the default
+ if (profileWasSelected) {
+ rv = mProfileSvc->SetDefaultProfile(newProfile);
+ if (NS_FAILED(rv)) NS_WARNING("Could not set current profile as the default");
+ }
+ } else {
+ NS_WARNING("Could not find current profile to set as default / change name.");
}
- // Need to write out the fact that the profile has been removed and potentially
- // that the selected/default profile changed.
+
+ // Need to write out the fact that the profile has been removed, the new profile
+ // renamed, and potentially that the selected/default profile changed.
mProfileSvc->Flush();
}
}
@@ -4308,17 +3787,6 @@ XREMain::XRE_mainRun()
OverrideDefaultLocaleIfNeeded();
-#ifdef MOZ_CRASHREPORTER
- nsCString userAgentLocale;
- // Try a localized string first. This pref is always a localized string in
- // Fennec, and might be elsewhere, too.
- if (NS_SUCCEEDED(Preferences::GetLocalizedCString("general.useragent.locale", &userAgentLocale))) {
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("useragent_locale"), userAgentLocale);
- } else if (NS_SUCCEEDED(Preferences::GetCString("general.useragent.locale", &userAgentLocale))) {
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("useragent_locale"), userAgentLocale);
- }
-#endif
-
appStartup->GetShuttingDown(&mShuttingDown);
nsCOMPtr<nsICommandLineRunner> cmdLine;
@@ -4411,11 +3879,6 @@ XREMain::XRE_mainRun()
(void)appStartup->DoneStartingUp();
-#ifdef MOZ_CRASHREPORTER
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("StartupCrash"),
- NS_LITERAL_CSTRING("0"));
-#endif
-
appStartup->GetShuttingDown(&mShuttingDown);
}
@@ -4466,21 +3929,8 @@ XREMain::XRE_mainRun()
sandboxInfo.Test(SandboxInfo::kEnabledForContent));
Telemetry::Accumulate(Telemetry::SANDBOX_MEDIA_ENABLED,
sandboxInfo.Test(SandboxInfo::kEnabledForMedia));
-#if defined(MOZ_CRASHREPORTER)
- nsAutoCString flagsString;
- flagsString.AppendInt(sandboxInfo.AsInteger());
-
- CrashReporter::AnnotateCrashReport(
- NS_LITERAL_CSTRING("ContentSandboxCapabilities"), flagsString);
-#endif /* MOZ_CRASHREPORTER */
#endif /* MOZ_SANDBOX && XP_LINUX && !MOZ_WIDGET_GONK */
-#if defined(MOZ_CRASHREPORTER)
-#if defined(MOZ_CONTENT_SANDBOX) && !defined(MOZ_WIDGET_GONK)
- AddSandboxAnnotations();
-#endif /* MOZ_CONTENT_SANDBOX && !MOZ_WIDGET_GONK */
-#endif /* MOZ_CRASHREPORTER */
-
{
rv = appStartup->Run();
if (NS_FAILED(rv)) {
@@ -4673,10 +4123,6 @@ XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
rv = LaunchChild(mNativeApp, true);
}
-#ifdef MOZ_CRASHREPORTER
- if (mAppData->flags & NS_XRE_ENABLE_CRASH_REPORTER)
- CrashReporter::UnsetExceptionHandler();
-#endif
return rv == NS_ERROR_LAUNCHED_CHILD_PROCESS ? 0 : 1;
}
@@ -4686,11 +4132,6 @@ XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
MOZ_gdk_display_close(mGdkDisplay);
#endif
-#ifdef MOZ_CRASHREPORTER
- if (mAppData->flags & NS_XRE_ENABLE_CRASH_REPORTER)
- CrashReporter::UnsetExceptionHandler();
-#endif
-
XRE_DeinitCommandLine();
return NS_FAILED(rv) ? 1 : 0;
@@ -4863,15 +4304,8 @@ MultiprocessBlockPolicy() {
bool addonsCanDisable = Preferences::GetBool("extensions.e10sBlocksEnabling", false);
bool disabledByAddons = Preferences::GetBool("extensions.e10sBlockedByAddons", false);
-#ifdef MOZ_CRASHREPORTER
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AddonsShouldHaveBlockedE10s"),
- disabledByAddons ? NS_LITERAL_CSTRING("1")
- : NS_LITERAL_CSTRING("0"));
-#endif
-
if (addonsCanDisable && disabledByAddons) {
gMultiprocessBlockPolicy = kE10sDisabledForAddons;
- return gMultiprocessBlockPolicy;
}
#if defined(XP_WIN)
@@ -4905,16 +4339,13 @@ MultiprocessBlockPolicy() {
if (disabledForA11y) {
gMultiprocessBlockPolicy = kE10sDisabledForAccessibility;
- return gMultiprocessBlockPolicy;
}
#endif
+
+ // We do not support E10S, block by policy.
+ gMultiprocessBlockPolicy = kE10sForceDisabled;
- /*
- * None of the blocking policies matched, so e10s is allowed to run.
- * Cache the information and return 0, indicating success.
- */
- gMultiprocessBlockPolicy = 0;
- return 0;
+ return gMultiprocessBlockPolicy;
}
bool
diff --git a/toolkit/xre/nsEmbedFunctions.cpp b/toolkit/xre/nsEmbedFunctions.cpp
index 1e67ea7ce4..4a612e4958 100644
--- a/toolkit/xre/nsEmbedFunctions.cpp
+++ b/toolkit/xre/nsEmbedFunctions.cpp
@@ -239,30 +239,6 @@ XRE_SetProcessType(const char* aProcessTypeString)
}
}
-#if defined(MOZ_CRASHREPORTER)
-// FIXME/bug 539522: this out-of-place function is stuck here because
-// IPDL wants access to this crashreporter interface, and
-// crashreporter is built in such a way to make that awkward
-bool
-XRE_TakeMinidumpForChild(uint32_t aChildPid, nsIFile** aDump,
- uint32_t* aSequence)
-{
- return CrashReporter::TakeMinidumpForChild(aChildPid, aDump, aSequence);
-}
-
-bool
-XRE_SetRemoteExceptionHandler(const char* aPipe/*= 0*/)
-{
-#if defined(XP_WIN) || defined(XP_MACOSX)
- return CrashReporter::SetRemoteExceptionHandler(nsDependentCString(aPipe));
-#elif defined(OS_LINUX)
- return CrashReporter::SetRemoteExceptionHandler();
-#else
-# error "OOP crash reporter unsupported on this platform"
-#endif
-}
-#endif // if defined(MOZ_CRASHREPORTER)
-
#if defined(XP_WIN)
void
SetTaskbarGroupId(const nsString& aId)
@@ -273,22 +249,6 @@ SetTaskbarGroupId(const nsString& aId)
}
#endif
-#if defined(MOZ_CRASHREPORTER)
-#if defined(MOZ_CONTENT_SANDBOX) && !defined(MOZ_WIDGET_GONK)
-void
-AddContentSandboxLevelAnnotation()
-{
- if (XRE_GetProcessType() == GeckoProcessType_Content) {
- int level = Preferences::GetInt("security.sandbox.content.level");
- nsAutoCString levelString;
- levelString.AppendInt(level);
- CrashReporter::AnnotateCrashReport(
- NS_LITERAL_CSTRING("ContentSandboxLevel"), levelString);
- }
-}
-#endif /* MOZ_CONTENT_SANDBOX && !MOZ_WIDGET_GONK */
-#endif /* MOZ_CRASHREPORTER */
-
nsresult
XRE_InitChildProcess(int aArgc,
char* aArgv[],
@@ -442,33 +402,6 @@ XRE_InitChildProcess(int aArgc,
SetupErrorHandling(aArgv[0]);
-#if defined(MOZ_CRASHREPORTER)
- if (aArgc < 1)
- return NS_ERROR_FAILURE;
- const char* const crashReporterArg = aArgv[--aArgc];
-
-# if defined(XP_WIN) || defined(XP_MACOSX)
- // on windows and mac, |crashReporterArg| is the named pipe on which the
- // server is listening for requests, or "-" if crash reporting is
- // disabled.
- if (0 != strcmp("-", crashReporterArg) &&
- !XRE_SetRemoteExceptionHandler(crashReporterArg)) {
- // Bug 684322 will add better visibility into this condition
- NS_WARNING("Could not setup crash reporting\n");
- }
-# elif defined(OS_LINUX)
- // on POSIX, |crashReporterArg| is "true" if crash reporting is
- // enabled, false otherwise
- if (0 != strcmp("false", crashReporterArg) &&
- !XRE_SetRemoteExceptionHandler(nullptr)) {
- // Bug 684322 will add better visibility into this condition
- NS_WARNING("Could not setup crash reporting\n");
- }
-# else
-# error "OOP crash reporting unsupported on this platform"
-# endif
-#endif // if defined(MOZ_CRASHREPORTER)
-
gArgv = aArgv;
gArgc = aArgc;
@@ -647,12 +580,6 @@ XRE_InitChildProcess(int aArgc,
return NS_ERROR_FAILURE;
}
-#ifdef MOZ_CRASHREPORTER
-#if defined(XP_WIN) || defined(XP_MACOSX)
- CrashReporter::InitChildProcessTmpDir();
-#endif
-#endif
-
#if defined(XP_WIN)
// Set child processes up such that they will get killed after the
// chrome process is killed in cases where the user shuts the system
@@ -668,12 +595,6 @@ XRE_InitChildProcess(int aArgc,
OverrideDefaultLocaleIfNeeded();
-#if defined(MOZ_CRASHREPORTER)
-#if defined(MOZ_CONTENT_SANDBOX) && !defined(MOZ_WIDGET_GONK)
- AddContentSandboxLevelAnnotation();
-#endif
-#endif
-
// Run the UI event loop on the main thread.
uiMessageLoop.MessageLoop::Run();
diff --git a/toolkit/xre/nsWindowsWMain.cpp b/toolkit/xre/nsWindowsWMain.cpp
index 788d25a900..e282374cc1 100644
--- a/toolkit/xre/nsWindowsWMain.cpp
+++ b/toolkit/xre/nsWindowsWMain.cpp
@@ -18,10 +18,6 @@
#include "nsSetDllDirectory.h"
#endif
-#if defined(__GNUC__)
-#define XRE_DONT_SUPPORT_XPSP2
-#endif
-
#ifdef __MINGW32__
/* MingW currently does not implement a wide version of the
diff --git a/toolkit/xre/nsX11ErrorHandler.cpp b/toolkit/xre/nsX11ErrorHandler.cpp
index 0db24e58be..0fb0d29c5d 100644
--- a/toolkit/xre/nsX11ErrorHandler.cpp
+++ b/toolkit/xre/nsX11ErrorHandler.cpp
@@ -117,18 +117,6 @@ X11Error(Display *display, XErrorEvent *event) {
}
}
-#ifdef MOZ_CRASHREPORTER
- switch (XRE_GetProcessType()) {
- case GeckoProcessType_Default:
- case GeckoProcessType_Plugin:
- case GeckoProcessType_Content:
- CrashReporter::AppendAppNotesToCrashReport(notes);
- break;
- default:
- ; // crash report notes not supported.
- }
-#endif
-
#ifdef DEBUG
// The resource id is unlikely to be useful in a crash report without
// context of other ids, but add it to the debug console output.
diff --git a/tools/profiler/moz.build b/tools/profiler/moz.build
index e48ae8f94a..08103f126d 100644
--- a/tools/profiler/moz.build
+++ b/tools/profiler/moz.build
@@ -60,14 +60,13 @@ if CONFIG['MOZ_ENABLE_PROFILER_SPS']:
'core/platform-linux.cc',
'core/shared-libraries-linux.cc',
]
- if not CONFIG['MOZ_CRASHREPORTER']:
- SOURCES += [
- '/toolkit/crashreporter/google-breakpad/src/common/linux/elfutils.cc',
- '/toolkit/crashreporter/google-breakpad/src/common/linux/file_id.cc',
- '/toolkit/crashreporter/google-breakpad/src/common/linux/guid_creator.cc',
- '/toolkit/crashreporter/google-breakpad/src/common/linux/linux_libc_support.cc',
- '/toolkit/crashreporter/google-breakpad/src/common/linux/memory_mapped_file.cc',
- ]
+ SOURCES += [
+ '/toolkit/crashreporter/google-breakpad/src/common/linux/elfutils.cc',
+ '/toolkit/crashreporter/google-breakpad/src/common/linux/file_id.cc',
+ '/toolkit/crashreporter/google-breakpad/src/common/linux/guid_creator.cc',
+ '/toolkit/crashreporter/google-breakpad/src/common/linux/linux_libc_support.cc',
+ '/toolkit/crashreporter/google-breakpad/src/common/linux/memory_mapped_file.cc',
+ ]
if CONFIG['CPU_ARCH'] == 'arm':
SOURCES += [
'core/EHABIStackWalk.cpp',
@@ -100,7 +99,7 @@ if CONFIG['MOZ_ENABLE_PROFILER_SPS']:
'/toolkit/crashreporter/google-breakpad/src/common/android/include',
]
- if not CONFIG['MOZ_CRASHREPORTER'] and CONFIG['OS_TARGET'] == 'Android':
+ if CONFIG['OS_TARGET'] == 'Android':
SOURCES += ['/toolkit/crashreporter/google-breakpad/src/common/android/breakpad_getcontext.S']
if CONFIG['ANDROID_CPU_ARCH'] == 'armeabi':
diff --git a/tools/rewriting/ThirdPartyPaths.txt b/tools/rewriting/ThirdPartyPaths.txt
index fb644e3508..a5822c9819 100644
--- a/tools/rewriting/ThirdPartyPaths.txt
+++ b/tools/rewriting/ThirdPartyPaths.txt
@@ -42,7 +42,6 @@ media/openmax_dl/
media/pocketsphinx/
media/sphinxbase/
media/webrtc/trunk/
-memory/jemalloc/src/
mfbt/decimal/
mfbt/double-conversion/
mfbt/lz4
diff --git a/widget/BasicEvents.h b/widget/BasicEvents.h
index da8d819ef4..a6228f179f 100644
--- a/widget/BasicEvents.h
+++ b/widget/BasicEvents.h
@@ -585,6 +585,7 @@ public:
case eMouseEventClass:
mFlags.mComposed = mMessage == eMouseClick ||
mMessage == eMouseDoubleClick ||
+ mMessage == eMouseAuxClick ||
mMessage == eMouseDown || mMessage == eMouseUp ||
mMessage == eMouseEnter || mMessage == eMouseLeave ||
mMessage == eMouseOver || mMessage == eMouseOut ||
diff --git a/widget/EventMessageList.h b/widget/EventMessageList.h
index 7903f6a267..2eed7e618e 100644
--- a/widget/EventMessageList.h
+++ b/widget/EventMessageList.h
@@ -84,6 +84,7 @@ NS_EVENT_MESSAGE(eMouseEnterIntoWidget)
NS_EVENT_MESSAGE(eMouseExitFromWidget)
NS_EVENT_MESSAGE(eMouseDoubleClick)
NS_EVENT_MESSAGE(eMouseClick)
+NS_EVENT_MESSAGE(eMouseAuxClick)
// eMouseActivate is fired when the widget is activated by a click.
NS_EVENT_MESSAGE(eMouseActivate)
NS_EVENT_MESSAGE(eMouseOver)
diff --git a/widget/GfxInfoBase.cpp b/widget/GfxInfoBase.cpp
index 5c8693957c..c937f50999 100644
--- a/widget/GfxInfoBase.cpp
+++ b/widget/GfxInfoBase.cpp
@@ -37,10 +37,6 @@
#include "gfxConfig.h"
#include "DriverCrashGuard.h"
-#if defined(MOZ_CRASHREPORTER)
-#include "nsExceptionHandler.h"
-#endif
-
using namespace mozilla::widget;
using namespace mozilla;
using mozilla::MutexAutoLock;
diff --git a/widget/GfxInfoX11.cpp b/widget/GfxInfoX11.cpp
index f490bed521..48fc3dbb5b 100644
--- a/widget/GfxInfoX11.cpp
+++ b/widget/GfxInfoX11.cpp
@@ -15,11 +15,6 @@
#include "GfxInfoX11.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#include "nsICrashReporter.h"
-#endif
-
namespace mozilla {
namespace widget {
@@ -28,7 +23,7 @@ NS_IMPL_ISUPPORTS_INHERITED(GfxInfo, GfxInfoBase, nsIGfxInfoDebug)
#endif
// these global variables will be set when firing the glxtest process
-int glxtest_pipe = 0;
+int glxtest_pipe = -1;
pid_t glxtest_pid = 0;
nsresult
@@ -55,8 +50,8 @@ GfxInfo::GetData()
// to understand this function, see bug 639842. We retrieve the OpenGL driver information in a
// separate process to protect against bad drivers.
- // if glxtest_pipe == 0, that means that we already read the information
- if (!glxtest_pipe)
+ // if glxtest_pipe == -1, that means that we already read the information
+ if (glxtest_pipe == -1)
return;
enum { buf_size = 1024 };
@@ -65,7 +60,7 @@ GfxInfo::GetData()
&buf,
buf_size-1); // -1 because we'll append a zero
close(glxtest_pipe);
- glxtest_pipe = 0;
+ glxtest_pipe = -1;
// bytesread < 0 would mean that the above read() call failed.
// This should never happen. If it did, the outcome would be to blacklist anyway.
@@ -176,9 +171,6 @@ GfxInfo::GetData()
mAdapterDescription.Append(nsDependentCString(buf));
mAdapterDescription.Append('\n');
}
-#ifdef MOZ_CRASHREPORTER
- CrashReporter::AppendAppNotesToCrashReport(mAdapterDescription);
-#endif
return;
}
@@ -194,9 +186,6 @@ GfxInfo::GetData()
if (mHasTextureFromPixmap)
note.AppendLiteral(" -- texture_from_pixmap");
note.Append('\n');
-#ifdef MOZ_CRASHREPORTER
- CrashReporter::AppendAppNotesToCrashReport(note);
-#endif
// determine the major OpenGL version. That's the first integer in the version string.
mGLMajorVersion = strtol(mVersion.get(), 0, 10);
diff --git a/widget/MouseEvents.h b/widget/MouseEvents.h
index 643132618f..442ac41e82 100644
--- a/widget/MouseEvents.h
+++ b/widget/MouseEvents.h
@@ -43,22 +43,31 @@ namespace dom {
class WidgetPointerHelper
{
public:
- bool convertToPointer;
uint32_t pointerId;
uint32_t tiltX;
uint32_t tiltY;
- bool retargetedByPointerCapture;
+ uint32_t twist;
+ float tangentialPressure;
+ bool convertToPointer;
- WidgetPointerHelper() : convertToPointer(true), pointerId(0), tiltX(0), tiltY(0),
- retargetedByPointerCapture(false) {}
+ WidgetPointerHelper()
+ : pointerId(0)
+ , tiltX(0)
+ , tiltY(0)
+ , twist(0)
+ , tangentialPressure(0)
+ , convertToPointer(true)
+ {
+ }
void AssignPointerHelperData(const WidgetPointerHelper& aEvent)
{
- convertToPointer = aEvent.convertToPointer;
pointerId = aEvent.pointerId;
tiltX = aEvent.tiltX;
tiltY = aEvent.tiltY;
- retargetedByPointerCapture = aEvent.retargetedByPointerCapture;
+ twist = aEvent.twist;
+ tangentialPressure = aEvent.tangentialPressure;
+ convertToPointer = aEvent.convertToPointer;
}
};
diff --git a/widget/WidgetEventImpl.cpp b/widget/WidgetEventImpl.cpp
index 52e2b9b40e..7dd292cb0d 100644
--- a/widget/WidgetEventImpl.cpp
+++ b/widget/WidgetEventImpl.cpp
@@ -236,6 +236,7 @@ WidgetEvent::HasMouseEventMessage() const
case eMouseUp:
case eMouseClick:
case eMouseDoubleClick:
+ case eMouseAuxClick:
case eMouseEnterIntoWidget:
case eMouseExitFromWidget:
case eMouseActivate:
diff --git a/widget/android/GfxInfo.cpp b/widget/android/GfxInfo.cpp
index af63184a73..181629e96f 100644
--- a/widget/android/GfxInfo.cpp
+++ b/widget/android/GfxInfo.cpp
@@ -15,12 +15,6 @@
#include "nsIWindowWatcher.h"
#include "nsServiceManagerUtils.h"
-#if defined(MOZ_CRASHREPORTER)
-#include "nsExceptionHandler.h"
-#include "nsICrashReporter.h"
-#define NS_CRASHREPORTER_CONTRACTID "@mozilla.org/toolkit/crash-reporter;1"
-#endif
-
namespace mozilla {
namespace widget {
@@ -351,21 +345,7 @@ GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active)
void
GfxInfo::AddCrashReportAnnotations()
{
-#if defined(MOZ_CRASHREPORTER)
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterVendorID"),
- mGLStrings->Vendor());
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDeviceID"),
- mGLStrings->Renderer());
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDriverVersion"),
- mGLStrings->Version());
-
- /* Add an App Note for now so that we get the data immediately. These
- * can go away after we store the above in the socorro db */
- nsAutoCString note;
- note.AppendPrintf("AdapterDescription: '%s'\n", mAdapterDescription.get());
-
- CrashReporter::AppendAppNotesToCrashReport(note);
-#endif
+ /*** STUB ***/
}
const nsTArray<GfxDriverInfo>&
diff --git a/widget/android/jni/Utils.cpp b/widget/android/jni/Utils.cpp
index 145f7e9eab..9195888512 100644
--- a/widget/android/jni/Utils.cpp
+++ b/widget/android/jni/Utils.cpp
@@ -9,10 +9,6 @@
#include "GeneratedJNIWrappers.h"
#include "nsAppShell.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
-
namespace mozilla {
namespace jni {
@@ -192,12 +188,6 @@ bool ReportException(JNIEnv* aEnv, jthrowable aExc, jstring aStack)
{
bool result = true;
-#ifdef MOZ_CRASHREPORTER
- result &= NS_SUCCEEDED(CrashReporter::AnnotateCrashReport(
- NS_LITERAL_CSTRING("JavaStackTrace"),
- String::Ref::From(aStack)->ToCString()));
-#endif // MOZ_CRASHREPORTER
-
if (sOOMErrorClass && aEnv->IsInstanceOf(aExc, sOOMErrorClass)) {
NS_ABORT_OOM(0); // Unknown OOM size
}
diff --git a/widget/android/nsAppShell.cpp b/widget/android/nsAppShell.cpp
index fefd711d0b..09548c27b3 100644
--- a/widget/android/nsAppShell.cpp
+++ b/widget/android/nsAppShell.cpp
@@ -53,11 +53,6 @@
#include "mozilla/Logging.h"
#endif
-#ifdef MOZ_CRASHREPORTER
-#include "nsICrashReporter.h"
-#include "nsExceptionHandler.h"
-#endif
-
#include "AndroidAlerts.h"
#include "ANRReporter.h"
#include "GeckoBatteryManager.h"
diff --git a/widget/cocoa/GfxInfo.mm b/widget/cocoa/GfxInfo.mm
index 6789ae8b23..74333c514b 100644
--- a/widget/cocoa/GfxInfo.mm
+++ b/widget/cocoa/GfxInfo.mm
@@ -18,12 +18,6 @@
#import <IOKit/IOKitLib.h>
#import <Cocoa/Cocoa.h>
-#if defined(MOZ_CRASHREPORTER)
-#include "nsExceptionHandler.h"
-#include "nsICrashReporter.h"
-#define NS_CRASHREPORTER_CONTRACTID "@mozilla.org/toolkit/crash-reporter;1"
-#endif
-
using namespace mozilla;
using namespace mozilla::widget;
@@ -273,33 +267,7 @@ GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active)
void
GfxInfo::AddCrashReportAnnotations()
{
-#if defined(MOZ_CRASHREPORTER)
- nsString deviceID, vendorID, driverVersion;
- nsAutoCString narrowDeviceID, narrowVendorID, narrowDriverVersion;
-
- GetAdapterDeviceID(deviceID);
- CopyUTF16toUTF8(deviceID, narrowDeviceID);
- GetAdapterVendorID(vendorID);
- CopyUTF16toUTF8(vendorID, narrowVendorID);
- GetAdapterDriverVersion(driverVersion);
- CopyUTF16toUTF8(driverVersion, narrowDriverVersion);
-
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterVendorID"),
- narrowVendorID);
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDeviceID"),
- narrowDeviceID);
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDriverVersion"),
- narrowDriverVersion);
- /* Add an App Note for now so that we get the data immediately. These
- * can go away after we store the above in the socorro db */
- nsAutoCString note;
- /* AppendPrintf only supports 32 character strings, mrghh. */
- note.Append("AdapterVendorID: ");
- note.Append(narrowVendorID);
- note.Append(", AdapterDeviceID: ");
- note.Append(narrowDeviceID);
- CrashReporter::AppendAppNotesToCrashReport(note);
-#endif
+ /*** STUB ***/
}
// We don't support checking driver versions on Mac.
diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm
index 92ccd8b6c1..8f72a81bec 100644
--- a/widget/cocoa/nsChildView.mm
+++ b/widget/cocoa/nsChildView.mm
@@ -77,9 +77,6 @@
#include "nsAccessibilityService.h"
#include "mozilla/a11y/Platform.h"
#endif
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
#include "mozilla/Preferences.h"
@@ -5373,31 +5370,14 @@ GetIntegerDeltaForEvent(NSEvent* aEvent)
#if !defined(RELEASE_OR_BETA) || defined(DEBUG)
if (!Preferences::GetBool("intl.allow-insecure-text-input", false) &&
mGeckoChild && mTextInputHandler && mTextInputHandler->IsFocused()) {
-#ifdef MOZ_CRASHREPORTER
- NSWindow* window = [self window];
- NSString* info = [NSString stringWithFormat:@"\nview [%@], window [%@], window is key %i, is fullscreen %i, app is active %i",
- self, window, [window isKeyWindow], ([window styleMask] & (1 << 14)) != 0,
- [NSApp isActive]];
- nsAutoCString additionalInfo([info UTF8String]);
-#endif
if (mGeckoChild->GetInputContext().IsPasswordEditor() &&
!TextInputHandler::IsSecureEventInputEnabled()) {
#define CRASH_MESSAGE "A password editor has focus, but not in secure input mode"
-#ifdef MOZ_CRASHREPORTER
- CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("\nBug 893973: ") +
- NS_LITERAL_CSTRING(CRASH_MESSAGE));
- CrashReporter::AppendAppNotesToCrashReport(additionalInfo);
-#endif
MOZ_CRASH(CRASH_MESSAGE);
#undef CRASH_MESSAGE
} else if (!mGeckoChild->GetInputContext().IsPasswordEditor() &&
TextInputHandler::IsSecureEventInputEnabled()) {
#define CRASH_MESSAGE "A non-password editor has focus, but in secure input mode"
-#ifdef MOZ_CRASHREPORTER
- CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("\nBug 893973: ") +
- NS_LITERAL_CSTRING(CRASH_MESSAGE));
- CrashReporter::AppendAppNotesToCrashReport(additionalInfo);
-#endif
MOZ_CRASH(CRASH_MESSAGE);
#undef CRASH_MESSAGE
}
diff --git a/widget/gtk/WidgetStyleCache.cpp b/widget/gtk/WidgetStyleCache.cpp
index fd099681f5..f35a451aa6 100644
--- a/widget/gtk/WidgetStyleCache.cpp
+++ b/widget/gtk/WidgetStyleCache.cpp
@@ -434,15 +434,6 @@ CreateScrolledWindowWidget()
}
static GtkWidget*
-CreateTextViewWidget()
-{
- GtkWidget* widget = gtk_text_view_new();
- gtk_container_add(GTK_CONTAINER(GetWidget(MOZ_GTK_SCROLLED_WINDOW)),
- widget);
- return widget;
-}
-
-static GtkWidget*
CreateMenuSeparatorWidget()
{
GtkWidget* widget = gtk_separator_menu_item_new();
@@ -591,8 +582,6 @@ CreateWidget(WidgetNodeType aWidgetType)
return CreateEntryWidget();
case MOZ_GTK_SCROLLED_WINDOW:
return CreateScrolledWindowWidget();
- case MOZ_GTK_TEXT_VIEW:
- return CreateTextViewWidget();
case MOZ_GTK_TREEVIEW:
return CreateTreeViewWidget();
case MOZ_GTK_TREE_HEADER_CELL:
@@ -637,6 +626,24 @@ GetWidget(WidgetNodeType aWidgetType)
GtkWidget* widget = sWidgetStorage[aWidgetType];
if (!widget) {
widget = CreateWidget(aWidgetType);
+ // Some widgets (MOZ_GTK_COMBOBOX_SEPARATOR for instance) may not be
+ // available or implemented.
+ if (!widget)
+ return nullptr;
+ // In GTK versions prior to 3.18, automatic invalidation of style contexts
+ // for widgets was delayed until the next resize event. Gecko however,
+ // typically uses the style context before the resize event runs and so an
+ // explicit invalidation may be required. This is necessary if a style
+ // property was retrieved before all changes were made to the style
+ // context. One such situation is where gtk_button_construct_child()
+ // retrieves the style property "image-spacing" during construction of the
+ // GtkButton, before its parent is set to provide inheritance of ancestor
+ // properties. More recent GTK versions do not need this, but do not
+ // re-resolve until required and so invalidation does not trigger
+ // unnecessary resolution in general.
+ GtkStyleContext* style = gtk_widget_get_style_context(widget);
+ gtk_style_context_invalidate(style);
+
sWidgetStorage[aWidgetType] = widget;
}
return widget;
@@ -725,6 +732,21 @@ CreateCSSNode(const char* aName, GtkStyleContext* aParentStyle, GType aType)
gtk_style_context_set_parent(context, aParentStyle);
gtk_widget_path_unref(path);
+ // In GTK 3.4, gtk_render_* functions use |theming_engine| on the style
+ // context without ensuring any style resolution sets it appropriately
+ // in style_data_lookup(). e.g.
+ // https://git.gnome.org/browse/gtk+/tree/gtk/gtkstylecontext.c?h=3.4.4#n3847
+ //
+ // That can result in incorrect drawing on first draw. To work around this,
+ // force a style look-up to set |theming_engine|. It is sufficient to do
+ // this only on context creation, instead of after every modification to the
+ // context, because themes typically (Ambiance and oxygen-gtk, at least) set
+ // the "engine" property with the '*' selector.
+ if (GTK_MAJOR_VERSION == 3 && gtk_get_minor_version() < 6) {
+ GdkRGBA unused;
+ gtk_style_context_get_color(context, GTK_STATE_FLAG_NORMAL, &unused);
+ }
+
return context;
}
@@ -747,13 +769,38 @@ GetWidgetRootStyle(WidgetNodeType aNodeType)
case MOZ_GTK_IMAGEMENUITEM:
style = CreateStyleForWidget(gtk_image_menu_item_new(), MOZ_GTK_MENUPOPUP);
break;
- case MOZ_GTK_CHECKMENUITEM_CONTAINER:
+ case MOZ_GTK_CHECKMENUITEM:
style = CreateStyleForWidget(gtk_check_menu_item_new(), MOZ_GTK_MENUPOPUP);
break;
- case MOZ_GTK_RADIOMENUITEM_CONTAINER:
+ case MOZ_GTK_RADIOMENUITEM:
style = CreateStyleForWidget(gtk_radio_menu_item_new(nullptr),
MOZ_GTK_MENUPOPUP);
break;
+ case MOZ_GTK_TEXT_VIEW:
+ style = CreateStyleForWidget(gtk_text_view_new(),
+ MOZ_GTK_SCROLLED_WINDOW);
+ break;
+ case MOZ_GTK_TOOLTIP:
+ if (gtk_check_version(3, 20, 0) != nullptr) {
+ // The tooltip style class is added first in CreateTooltipWidget()
+ // and transfered to style in CreateStyleForWidget().
+ GtkWidget* tooltipWindow = CreateTooltipWidget();
+ style = CreateStyleForWidget(tooltipWindow, nullptr);
+ gtk_widget_destroy(tooltipWindow); // Release GtkWindow self-reference.
+ } else {
+ // We create this from the path because GtkTooltipWindow is not public.
+ style = CreateCSSNode("tooltip", nullptr, GTK_TYPE_TOOLTIP);
+ gtk_style_context_add_class(style, GTK_STYLE_CLASS_BACKGROUND);
+ }
+ break;
+ case MOZ_GTK_TOOLTIP_BOX:
+ style = CreateStyleForWidget(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0),
+ MOZ_GTK_TOOLTIP);
+ break;
+ case MOZ_GTK_TOOLTIP_BOX_LABEL:
+ style = CreateStyleForWidget(gtk_label_new(nullptr),
+ MOZ_GTK_TOOLTIP_BOX);
+ break;
default:
GtkWidget* widget = GetWidget(aNodeType);
MOZ_ASSERT(widget);
@@ -827,13 +874,13 @@ GetCssNodeStyleInternal(WidgetNodeType aNodeType)
style = CreateChildCSSNode(GTK_STYLE_CLASS_CHECK,
MOZ_GTK_CHECKBUTTON_CONTAINER);
break;
- case MOZ_GTK_RADIOMENUITEM:
+ case MOZ_GTK_RADIOMENUITEM_INDICATOR:
style = CreateChildCSSNode(GTK_STYLE_CLASS_RADIO,
- MOZ_GTK_RADIOMENUITEM_CONTAINER);
+ MOZ_GTK_RADIOMENUITEM);
break;
- case MOZ_GTK_CHECKMENUITEM:
+ case MOZ_GTK_CHECKMENUITEM_INDICATOR:
style = CreateChildCSSNode(GTK_STYLE_CLASS_CHECK,
- MOZ_GTK_CHECKMENUITEM_CONTAINER);
+ MOZ_GTK_CHECKMENUITEM);
break;
case MOZ_GTK_PROGRESS_TROUGH:
/* Progress bar background (trough) */
@@ -844,11 +891,6 @@ GetCssNodeStyleInternal(WidgetNodeType aNodeType)
style = CreateChildCSSNode("progress",
MOZ_GTK_PROGRESS_TROUGH);
break;
- case MOZ_GTK_TOOLTIP:
- // We create this from the path because GtkTooltipWindow is not public.
- style = CreateCSSNode("tooltip", nullptr, GTK_TYPE_TOOLTIP);
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_BACKGROUND);
- break;
case MOZ_GTK_GRIPPER:
// TODO - create from CSS node
return GetWidgetStyleWithClass(MOZ_GTK_GRIPPER,
@@ -865,10 +907,28 @@ GetCssNodeStyleInternal(WidgetNodeType aNodeType)
// TODO - create from CSS node
return GetWidgetStyleWithClass(MOZ_GTK_SCROLLED_WINDOW,
GTK_STYLE_CLASS_FRAME);
- case MOZ_GTK_TEXT_VIEW:
- // TODO - create from CSS node
- return GetWidgetStyleWithClass(MOZ_GTK_TEXT_VIEW,
- GTK_STYLE_CLASS_VIEW);
+ case MOZ_GTK_TEXT_VIEW_TEXT:
+ case MOZ_GTK_RESIZER:
+ style = CreateChildCSSNode("text", MOZ_GTK_TEXT_VIEW);
+ if (aNodeType == MOZ_GTK_RESIZER) {
+ // The "grip" class provides the correct builtin icon from
+ // gtk_render_handle(). The icon is drawn with shaded variants of
+ // the background color, and so a transparent background would lead to
+ // a transparent resizer. gtk_render_handle() also uses the
+ // background color to draw a background, and so this style otherwise
+ // matches what is used in GtkTextView to match the background with
+ // textarea elements.
+ GdkRGBA color;
+ gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL,
+ &color);
+ if (color.alpha == 0.0) {
+ g_object_unref(style);
+ style = CreateStyleForWidget(gtk_text_view_new(),
+ MOZ_GTK_SCROLLED_WINDOW);
+ }
+ gtk_style_context_add_class(style, GTK_STYLE_CLASS_GRIP);
+ }
+ break;
case MOZ_GTK_FRAME_BORDER:
style = CreateChildCSSNode("border", MOZ_GTK_FRAME);
break;
@@ -971,27 +1031,20 @@ GetWidgetStyleInternal(WidgetNodeType aNodeType)
case MOZ_GTK_CHECKBUTTON:
return GetWidgetStyleWithClass(MOZ_GTK_CHECKBUTTON_CONTAINER,
GTK_STYLE_CLASS_CHECK);
- case MOZ_GTK_RADIOMENUITEM:
- return GetWidgetStyleWithClass(MOZ_GTK_RADIOMENUITEM_CONTAINER,
+ case MOZ_GTK_RADIOMENUITEM_INDICATOR:
+ return GetWidgetStyleWithClass(MOZ_GTK_RADIOMENUITEM,
GTK_STYLE_CLASS_RADIO);
- case MOZ_GTK_CHECKMENUITEM:
- return GetWidgetStyleWithClass(MOZ_GTK_CHECKMENUITEM_CONTAINER,
+ case MOZ_GTK_CHECKMENUITEM_INDICATOR:
+ return GetWidgetStyleWithClass(MOZ_GTK_CHECKMENUITEM,
GTK_STYLE_CLASS_CHECK);
case MOZ_GTK_PROGRESS_TROUGH:
return GetWidgetStyleWithClass(MOZ_GTK_PROGRESSBAR,
GTK_STYLE_CLASS_TROUGH);
- case MOZ_GTK_TOOLTIP: {
- GtkStyleContext* style = sStyleStorage[aNodeType];
- if (style)
- return style;
-
- // The tooltip style class is added first in CreateTooltipWidget() so
- // that gtk_widget_path_append_for_widget() in CreateStyleForWidget()
- // will find it.
- GtkWidget* tooltipWindow = CreateTooltipWidget();
- style = CreateStyleForWidget(tooltipWindow, nullptr);
- gtk_widget_destroy(tooltipWindow); // Release GtkWindow self-reference.
- sStyleStorage[aNodeType] = style;
+ case MOZ_GTK_PROGRESS_CHUNK: {
+ GtkStyleContext* style =
+ GetWidgetStyleWithClass(MOZ_GTK_PROGRESSBAR,
+ GTK_STYLE_CLASS_PROGRESSBAR);
+ gtk_style_context_remove_class(style, GTK_STYLE_CLASS_TROUGH);
return style;
}
case MOZ_GTK_GRIPPER:
@@ -1006,9 +1059,25 @@ GetWidgetStyleInternal(WidgetNodeType aNodeType)
case MOZ_GTK_SCROLLED_WINDOW:
return GetWidgetStyleWithClass(MOZ_GTK_SCROLLED_WINDOW,
GTK_STYLE_CLASS_FRAME);
- case MOZ_GTK_TEXT_VIEW:
- return GetWidgetStyleWithClass(MOZ_GTK_TEXT_VIEW,
- GTK_STYLE_CLASS_VIEW);
+ case MOZ_GTK_TEXT_VIEW_TEXT:
+ case MOZ_GTK_RESIZER: {
+ // GTK versions prior to 3.20 do not have the view class on the root
+ // node, but add this to determine the background for the text window.
+ GtkStyleContext* style =
+ GetWidgetStyleWithClass(MOZ_GTK_TEXT_VIEW, GTK_STYLE_CLASS_VIEW);
+ if (aNodeType == MOZ_GTK_RESIZER) {
+ // The "grip" class provides the correct builtin icon from
+ // gtk_render_handle(). The icon is drawn with shaded variants of
+ // the background color, and so a transparent background would lead to
+ // a transparent resizer. gtk_render_handle() also uses the
+ // background color to draw a background, and so this style otherwise
+ // matches MOZ_GTK_TEXT_VIEW_TEXT to match the background with
+ // textarea elements. GtkTextView creates a separate text window and
+ // so the background should not be transparent.
+ gtk_style_context_add_class(style, GTK_STYLE_CLASS_GRIP);
+ }
+ return style;
+ }
case MOZ_GTK_FRAME_BORDER:
return GetWidgetRootStyle(MOZ_GTK_FRAME);
case MOZ_GTK_TREEVIEW_VIEW:
diff --git a/widget/gtk/gtk3drawing.cpp b/widget/gtk/gtk3drawing.cpp
index fb95b4cc4a..c592fa51c9 100644
--- a/widget/gtk/gtk3drawing.cpp
+++ b/widget/gtk/gtk3drawing.cpp
@@ -36,6 +36,10 @@ static gboolean is_initialized;
static gint
moz_gtk_get_tab_thickness(GtkStyleContext *style);
+static gint
+moz_gtk_menu_item_paint(WidgetNodeType widget, cairo_t *cr, GdkRectangle* rect,
+ GtkWidgetState* state, GtkTextDirection direction);
+
// GetStateFlagsFromGtkWidgetState() can be safely used for the specific
// GtkWidgets that set both prelight and active flags. For other widgets,
// either the GtkStateFlags or Gecko's GtkWidgetState need to be carefully
@@ -167,7 +171,7 @@ moz_gtk_menuitem_get_horizontal_padding(gint* horizontal_padding)
gint
moz_gtk_checkmenuitem_get_horizontal_padding(gint* horizontal_padding)
{
- GtkStyleContext *style = ClaimStyleContext(MOZ_GTK_CHECKMENUITEM_CONTAINER);
+ GtkStyleContext *style = ClaimStyleContext(MOZ_GTK_CHECKMENUITEM);
gtk_style_context_get_style(style,
"horizontal-padding", horizontal_padding,
nullptr);
@@ -463,7 +467,7 @@ moz_gtk_get_widget_min_size(WidgetNodeType aGtkWidgetType, int* width,
}
static void
-moz_gtk_rectangle_inset(GdkRectangle* rect, GtkBorder& aBorder)
+Inset(GdkRectangle* rect, GtkBorder& aBorder)
{
MOZ_ASSERT(rect);
rect->x += aBorder.left;
@@ -472,17 +476,29 @@ moz_gtk_rectangle_inset(GdkRectangle* rect, GtkBorder& aBorder)
rect->height -= aBorder.top + aBorder.bottom;
}
-/* Subtracting margin is used to inset drawing of element which can have margins,
- * like scrollbar, scrollbar's trough, thumb and scrollbar's button */
+// Inset a rectangle by the margins specified in a style context.
static void
-moz_gtk_subtract_margin(GtkStyleContext* style, GdkRectangle* rect)
+InsetByMargin(GdkRectangle* rect, GtkStyleContext* style)
{
MOZ_ASSERT(rect);
GtkBorder margin;
gtk_style_context_get_margin(style, gtk_style_context_get_state(style),
&margin);
- moz_gtk_rectangle_inset(rect, margin);
+ Inset(rect, margin);
+}
+
+// Inset a rectangle by the border and padding specified in a style context.
+static void
+InsetByBorderPadding(GdkRectangle* rect, GtkStyleContext* style)
+{
+ GtkStateFlags state = gtk_style_context_get_state(style);
+ GtkBorder padding, border;
+
+ gtk_style_context_get_padding(style, state, &padding);
+ Inset(rect, padding);
+ gtk_style_context_get_border(style, state, &border);
+ Inset(rect, border);
}
static gint
@@ -528,7 +544,7 @@ moz_gtk_scrollbar_button_paint(cairo_t *cr, const GdkRectangle* aRect,
if (gtk_check_version(3,20,0) == nullptr) {
// The "trough-border" is not used since GTK 3.20. The stepper margin
// box occupies the full width of the "contents" gadget content box.
- moz_gtk_subtract_margin(style, &rect);
+ InsetByMargin(&rect, style);
} else {
// Scrollbar button has to be inset by trough_border because its DOM
// element is filling width of vertical scrollbar's track (or height
@@ -601,7 +617,7 @@ moz_gtk_draw_styled_frame(GtkStyleContext* style, cairo_t *cr,
{
GdkRectangle rect = *aRect;
if (gtk_check_version(3, 6, 0) == nullptr) {
- moz_gtk_subtract_margin(style, &rect);
+ InsetByMargin(&rect, style);
}
gtk_render_background(style, cr, rect.x, rect.y, rect.width, rect.height);
gtk_render_frame(style, cr, rect.x, rect.y, rect.width, rect.height);
@@ -656,7 +672,7 @@ moz_gtk_scrollbar_thumb_paint(WidgetNodeType widget,
GdkRectangle rect = *aRect;
GtkStyleContext* style = ClaimStyleContext(widget, direction, state_flags);
- moz_gtk_subtract_margin(style, &rect);
+ InsetByMargin(&rect, style);
gtk_render_slider(style, cr,
rect.x,
@@ -857,7 +873,7 @@ moz_gtk_entry_paint(cairo_t *cr, GdkRectangle* rect,
}
static gint
-moz_gtk_text_view_paint(cairo_t *cr, GdkRectangle* rect,
+moz_gtk_text_view_paint(cairo_t *cr, GdkRectangle* aRect,
GtkWidgetState* state,
GtkTextDirection direction)
{
@@ -874,24 +890,24 @@ moz_gtk_text_view_paint(cairo_t *cr, GdkRectangle* rect,
GtkStyleContext* style_frame =
ClaimStyleContext(MOZ_GTK_SCROLLED_WINDOW, direction, state_flags);
- gtk_render_frame(style_frame, cr, rect->x, rect->y, rect->width, rect->height);
+ gtk_render_frame(style_frame, cr,
+ aRect->x, aRect->y, aRect->width, aRect->height);
+
+ GdkRectangle rect = *aRect;
+ InsetByBorderPadding(&rect, style_frame);
- GtkBorder border, padding;
- gtk_style_context_get_border(style_frame, state_flags, &border);
- gtk_style_context_get_padding(style_frame, state_flags, &padding);
ReleaseStyleContext(style_frame);
GtkStyleContext* style =
ClaimStyleContext(MOZ_GTK_TEXT_VIEW, direction, state_flags);
-
- gint xthickness = border.left + padding.left;
- gint ythickness = border.top + padding.top;
-
- gtk_render_background(style, cr,
- rect->x + xthickness, rect->y + ythickness,
- rect->width - 2 * xthickness,
- rect->height - 2 * ythickness);
-
+ gtk_render_background(style, cr, rect.x, rect.y, rect.width, rect.height);
+ ReleaseStyleContext(style);
+ // There is a separate "text" window, which usually provides the
+ // background behind the text. However, this is transparent in Ambiance
+ // for GTK 3.20, in which case the MOZ_GTK_TEXT_VIEW background is
+ // visible.
+ style = ClaimStyleContext(MOZ_GTK_TEXT_VIEW_TEXT, direction, state_flags);
+ gtk_render_background(style, cr, rect.x, rect.y, rect.width, rect.height);
ReleaseStyleContext(style);
return MOZ_GTK_SUCCESS;
@@ -1013,8 +1029,7 @@ moz_gtk_treeview_expander_paint(cairo_t *cr, GdkRectangle* rect,
return MOZ_GTK_SUCCESS;
}
-/* See gtk_separator_draw() for reference.
-*/
+/* See gtk_separator_draw() for reference. */
static gint
moz_gtk_combo_box_paint(cairo_t *cr, GdkRectangle* rect,
GtkWidgetState* state,
@@ -1283,6 +1298,7 @@ moz_gtk_tooltip_paint(cairo_t *cr, const GdkRectangle* aRect,
GdkRectangle rect = *aRect;
gtk_render_background(style, cr, rect.x, rect.y, rect.width, rect.height);
gtk_render_frame(style, cr, rect.x, rect.y, rect.width, rect.height);
+ ReleaseStyleContext(style);
// Horizontal Box drawing
//
@@ -1292,33 +1308,26 @@ moz_gtk_tooltip_paint(cairo_t *cr, const GdkRectangle* aRect,
// 6px margin.
// For drawing Horizontal Box we have to inset drawing area by that 6px
// plus its CSS margin.
- GtkStyleContext* boxStyle =
- CreateStyleForWidget(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0), style);
+ GtkStyleContext* boxStyle = ClaimStyleContext(MOZ_GTK_TOOLTIP_BOX, direction);
rect.x += 6;
rect.y += 6;
rect.width -= 12;
rect.height -= 12;
- moz_gtk_subtract_margin(boxStyle, &rect);
+ InsetByMargin(&rect, boxStyle);
gtk_render_background(boxStyle, cr, rect.x, rect.y, rect.width, rect.height);
gtk_render_frame(boxStyle, cr, rect.x, rect.y, rect.width, rect.height);
// Label drawing
- GtkBorder padding, border;
- gtk_style_context_get_padding(boxStyle, GTK_STATE_FLAG_NORMAL, &padding);
- moz_gtk_rectangle_inset(&rect, padding);
- gtk_style_context_get_border(boxStyle, GTK_STATE_FLAG_NORMAL, &border);
- moz_gtk_rectangle_inset(&rect, border);
+ InsetByBorderPadding(&rect, boxStyle);
+ ReleaseStyleContext(boxStyle);
GtkStyleContext* labelStyle =
- CreateStyleForWidget(gtk_label_new(nullptr), boxStyle);
+ ClaimStyleContext(MOZ_GTK_TOOLTIP_BOX_LABEL, direction);
moz_gtk_draw_styled_frame(labelStyle, cr, &rect, false);
- g_object_unref(labelStyle);
-
- g_object_unref(boxStyle);
+ ReleaseStyleContext(labelStyle);
- ReleaseStyleContext(style);
return MOZ_GTK_SUCCESS;
}
@@ -1327,17 +1336,9 @@ moz_gtk_resizer_paint(cairo_t *cr, GdkRectangle* rect,
GtkWidgetState* state,
GtkTextDirection direction)
{
- GtkStyleContext* style;
-
- // gtk_render_handle() draws a background, so use GtkTextView and its
- // GTK_STYLE_CLASS_VIEW to match the background with textarea elements.
- // The resizer is drawn with shaded variants of the background color, and
- // so a transparent background would lead to a transparent resizer.
- style = ClaimStyleContext(MOZ_GTK_TEXT_VIEW, GTK_TEXT_DIR_LTR,
- GetStateFlagsFromGtkWidgetState(state));
- // TODO - we need to save/restore style when gtk 3.20 CSS node path
- // is used
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_GRIP);
+ GtkStyleContext* style =
+ ClaimStyleContext(MOZ_GTK_RESIZER, GTK_TEXT_DIR_LTR,
+ GetStateFlagsFromGtkWidgetState(state));
// Workaround unico not respecting the text direction for resizers.
// See bug 1174248.
@@ -1384,17 +1385,8 @@ moz_gtk_progress_chunk_paint(cairo_t *cr, GdkRectangle* rect,
GtkTextDirection direction,
WidgetNodeType widget)
{
- GtkStyleContext* style;
-
- if (gtk_check_version(3, 20, 0) != nullptr) {
- /* Ask for MOZ_GTK_PROGRESS_TROUGH instead of MOZ_GTK_PROGRESSBAR
- * because ClaimStyleContext() saves/restores that style */
- style = ClaimStyleContext(MOZ_GTK_PROGRESS_TROUGH, direction);
- gtk_style_context_remove_class(style, GTK_STYLE_CLASS_TROUGH);
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_PROGRESSBAR);
- } else {
- style = ClaimStyleContext(MOZ_GTK_PROGRESS_CHUNK, direction);
- }
+ GtkStyleContext* style =
+ ClaimStyleContext(MOZ_GTK_PROGRESS_CHUNK, direction);
if (widget == MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE ||
widget == MOZ_GTK_PROGRESS_CHUNK_VERTICAL_INDETERMINATE) {
@@ -1778,6 +1770,13 @@ static gint
moz_gtk_menu_separator_paint(cairo_t *cr, GdkRectangle* rect,
GtkTextDirection direction)
{
+ GtkWidgetState defaultState = { 0 };
+ moz_gtk_menu_item_paint(MOZ_GTK_MENUSEPARATOR, cr, rect,
+ &defaultState, direction);
+
+ if (gtk_get_minor_version() >= 20)
+ return MOZ_GTK_SUCCESS;
+
GtkStyleContext* style;
gboolean wide_separators;
gint separator_height;
@@ -1825,36 +1824,39 @@ moz_gtk_menu_item_paint(WidgetNodeType widget, cairo_t *cr, GdkRectangle* rect,
GtkWidgetState* state, GtkTextDirection direction)
{
gint x, y, w, h;
+ guint minorVersion = gtk_get_minor_version();
+ GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
- if (state->inHover && !state->disabled) {
- GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
- GtkStyleContext* style =
- ClaimStyleContext(widget, direction, state_flags);
-
- bool pre_3_6 = gtk_check_version(3, 6, 0) != nullptr;
- if (pre_3_6) {
- // GTK+ 3.4 saves the style context and adds the menubar class to
- // menubar children, but does each of these only when drawing, not
- // during layout.
- gtk_style_context_save(style);
- if (widget == MOZ_GTK_MENUBARITEM) {
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_MENUBAR);
- }
+ // GTK versions prior to 3.8 render the background and frame only when not
+ // a separator and in hover prelight.
+ if (minorVersion < 8 && (widget == MOZ_GTK_MENUSEPARATOR ||
+ !(state_flags & GTK_STATE_FLAG_PRELIGHT)))
+ return MOZ_GTK_SUCCESS;
+
+ GtkStyleContext* style = ClaimStyleContext(widget, direction, state_flags);
+
+ if (minorVersion < 6) {
+ // GTK+ 3.4 saves the style context and adds the menubar class to
+ // menubar children, but does each of these only when drawing, not
+ // during layout.
+ gtk_style_context_save(style);
+ if (widget == MOZ_GTK_MENUBARITEM) {
+ gtk_style_context_add_class(style, GTK_STYLE_CLASS_MENUBAR);
}
+ }
- x = rect->x;
- y = rect->y;
- w = rect->width;
- h = rect->height;
+ x = rect->x;
+ y = rect->y;
+ w = rect->width;
+ h = rect->height;
- gtk_render_background(style, cr, x, y, w, h);
- gtk_render_frame(style, cr, x, y, w, h);
+ gtk_render_background(style, cr, x, y, w, h);
+ gtk_render_frame(style, cr, x, y, w, h);
- if (pre_3_6) {
- gtk_style_context_restore(style);
- }
- ReleaseStyleContext(style);
+ if (minorVersion < 6) {
+ gtk_style_context_restore(style);
}
+ ReleaseStyleContext(style);
return MOZ_GTK_SUCCESS;
}
@@ -1874,16 +1876,16 @@ moz_gtk_menu_arrow_paint(cairo_t *cr, GdkRectangle* rect,
return MOZ_GTK_SUCCESS;
}
-// See gtk_real_check_menu_item_draw_indicator() for reference.
+// For reference, see gtk_check_menu_item_size_allocate() in GTK versions after
+// 3.20 and gtk_real_check_menu_item_draw_indicator() in earlier versions.
static gint
-moz_gtk_check_menu_item_paint(cairo_t *cr, GdkRectangle* rect,
+moz_gtk_check_menu_item_paint(WidgetNodeType widgetType,
+ cairo_t *cr, GdkRectangle* rect,
GtkWidgetState* state,
- gboolean checked, gboolean isradio,
- GtkTextDirection direction)
+ gboolean checked, GtkTextDirection direction)
{
GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
GtkStyleContext* style;
- GtkBorder padding;
gint indicator_size, horizontal_padding;
gint x, y;
@@ -1893,35 +1895,44 @@ moz_gtk_check_menu_item_paint(cairo_t *cr, GdkRectangle* rect,
state_flags = static_cast<GtkStateFlags>(state_flags|checkbox_check_state);
}
- style = ClaimStyleContext(isradio ? MOZ_GTK_RADIOMENUITEM_CONTAINER :
- MOZ_GTK_CHECKMENUITEM_CONTAINER,
- direction);
+ bool pre_3_20 = gtk_get_minor_version() < 20;
+ gint offset;
+ style = ClaimStyleContext(widgetType, direction);
gtk_style_context_get_style(style,
"indicator-size", &indicator_size,
"horizontal-padding", &horizontal_padding,
NULL);
+ if (pre_3_20) {
+ GtkBorder padding;
+ gtk_style_context_get_padding(style, state_flags, &padding);
+ offset = horizontal_padding + padding.left + 2;
+ } else {
+ GdkRectangle r = { 0 };
+ InsetByMargin(&r, style);
+ InsetByBorderPadding(&r, style);
+ offset = r.x;
+ }
ReleaseStyleContext(style);
- style = ClaimStyleContext(isradio ? MOZ_GTK_RADIOMENUITEM :
- MOZ_GTK_CHECKMENUITEM,
- direction, state_flags);
- gtk_style_context_get_padding(style, state_flags, &padding);
- gint offset = padding.left + 2;
+ bool isRadio = (widgetType == MOZ_GTK_RADIOMENUITEM);
+ WidgetNodeType indicatorType = isRadio ? MOZ_GTK_RADIOMENUITEM_INDICATOR
+ : MOZ_GTK_CHECKMENUITEM_INDICATOR;
+ style = ClaimStyleContext(indicatorType, direction, state_flags);
if (direction == GTK_TEXT_DIR_RTL) {
- x = rect->width - indicator_size - offset - horizontal_padding;
+ x = rect->width - indicator_size - offset;
}
else {
- x = rect->x + offset + horizontal_padding;
+ x = rect->x + offset;
}
y = rect->y + (rect->height - indicator_size) / 2;
- if (gtk_check_version(3, 20, 0) == nullptr) {
+ if (!pre_3_20) {
gtk_render_background(style, cr, x, y, indicator_size, indicator_size);
gtk_render_frame(style, cr, x, y, indicator_size, indicator_size);
}
- if (isradio) {
+ if (isRadio) {
gtk_render_option(style, cr, x, y, indicator_size, indicator_size);
} else {
gtk_render_check(style, cr, x, y, indicator_size, indicator_size);
@@ -2166,12 +2177,15 @@ moz_gtk_get_widget_border(WidgetNodeType widget, gint* left, gint* top,
{
// Bug 1274143 for MOZ_GTK_MENUBARITEM
WidgetNodeType type =
- widget == MOZ_GTK_MENUBARITEM || widget == MOZ_GTK_MENUITEM ?
- MOZ_GTK_MENUITEM : MOZ_GTK_CHECKMENUITEM_CONTAINER;
+ widget == MOZ_GTK_MENUBARITEM ? MOZ_GTK_MENUITEM : widget;
style = ClaimStyleContext(type);
- moz_gtk_add_style_padding(style, left, top, right, bottom);
-
+ if (gtk_get_minor_version() < 20) {
+ moz_gtk_add_style_padding(style, left, top, right, bottom);
+ } else {
+ moz_gtk_add_margin_border_padding(style,
+ left, top, right, bottom);
+ }
ReleaseStyleContext(style);
return MOZ_GTK_SUCCESS;
}
@@ -2180,7 +2194,6 @@ moz_gtk_get_widget_border(WidgetNodeType widget, gint* left, gint* top,
break;
case MOZ_GTK_TOOLTIP:
{
- style = ClaimStyleContext(MOZ_GTK_TOOLTIP);
// In GTK 3 there are 6 pixels of additional margin around the box.
// See details there:
// https://github.com/GNOME/gtk/blob/5ea69a136bd7e4970b3a800390e20314665aaed2/gtk/ui/gtktooltipwindow.ui#L11
@@ -2189,21 +2202,16 @@ moz_gtk_get_widget_border(WidgetNodeType widget, gint* left, gint* top,
// We also need to add margin/padding/borders from Tooltip content.
// Tooltip contains horizontal box, where icon and label is put.
// We ignore icon as long as we don't have support for it.
- GtkStyleContext* boxStyle =
- CreateStyleForWidget(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0),
- style);
+ GtkStyleContext* boxStyle = ClaimStyleContext(MOZ_GTK_TOOLTIP_BOX);
moz_gtk_add_margin_border_padding(boxStyle,
left, top, right, bottom);
+ ReleaseStyleContext(boxStyle);
- GtkStyleContext* labelStyle =
- CreateStyleForWidget(gtk_label_new(nullptr), boxStyle);
+ GtkStyleContext* labelStyle = ClaimStyleContext(MOZ_GTK_TOOLTIP_BOX_LABEL);
moz_gtk_add_margin_border_padding(labelStyle,
left, top, right, bottom);
+ ReleaseStyleContext(labelStyle);
- g_object_unref(labelStyle);
- g_object_unref(boxStyle);
-
- ReleaseStyleContext(style);
return MOZ_GTK_SUCCESS;
}
case MOZ_GTK_SCROLLBAR_VERTICAL:
@@ -2492,11 +2500,11 @@ void
moz_gtk_get_scale_metrics(GtkOrientation orient, gint* scale_width,
gint* scale_height)
{
- WidgetNodeType widget = (orient == GTK_ORIENTATION_HORIZONTAL) ?
- MOZ_GTK_SCALE_HORIZONTAL :
- MOZ_GTK_SCALE_VERTICAL;
-
if (gtk_check_version(3, 20, 0) != nullptr) {
+ WidgetNodeType widget = (orient == GTK_ORIENTATION_HORIZONTAL) ?
+ MOZ_GTK_SCALE_HORIZONTAL :
+ MOZ_GTK_SCALE_VERTICAL;
+
gint thumb_length, thumb_height, trough_border;
moz_gtk_get_scalethumb_metrics(orient, &thumb_length, &thumb_height);
@@ -2512,12 +2520,10 @@ moz_gtk_get_scale_metrics(GtkOrientation orient, gint* scale_width,
}
ReleaseStyleContext(style);
} else {
- GtkStyleContext* style = ClaimStyleContext(widget);
- gtk_style_context_get(style, gtk_style_context_get_state(style),
- "min-width", scale_width,
- "min-height", scale_height,
- nullptr);
- ReleaseStyleContext(style);
+ WidgetNodeType widget = (orient == GTK_ORIENTATION_HORIZONTAL) ?
+ MOZ_GTK_SCALE_TROUGH_HORIZONTAL :
+ MOZ_GTK_SCALE_TROUGH_VERTICAL;
+ moz_gtk_get_widget_min_size(widget, scale_width, scale_height);
}
}
@@ -2540,10 +2546,27 @@ moz_gtk_get_scalethumb_metrics(GtkOrientation orient, gint* thumb_length, gint*
MOZ_GTK_SCALE_THUMB_HORIZONTAL:
MOZ_GTK_SCALE_THUMB_VERTICAL;
GtkStyleContext* style = ClaimStyleContext(widget);
- gtk_style_context_get(style, gtk_style_context_get_state(style),
- "min-width", thumb_length,
- "min-height", thumb_height,
+ gint min_width, min_height;
+ GtkStateFlags state = gtk_style_context_get_state(style);
+ gtk_style_context_get(style, state,
+ "min-width", &min_width,
+ "min-height", &min_height,
nullptr);
+ GtkBorder margin;
+ gtk_style_context_get_margin(style, state, &margin);
+ gint margin_width = margin.left + margin.right;
+ gint margin_height = margin.top + margin.bottom;
+
+ // Negative margin of slider element also determines its minimal size
+ // so use bigger of those two values.
+ if (min_width < -margin_width)
+ min_width = -margin_width;
+ if (min_height < -margin_height)
+ min_height = -margin_height;
+
+ *thumb_length = min_width;
+ *thumb_height = min_height;
+
ReleaseStyleContext(style);
}
@@ -2786,10 +2809,8 @@ moz_gtk_widget_paint(WidgetNodeType widget, cairo_t *cr,
break;
case MOZ_GTK_CHECKMENUITEM:
case MOZ_GTK_RADIOMENUITEM:
- return moz_gtk_check_menu_item_paint(cr, rect, state,
- (gboolean) flags,
- (widget == MOZ_GTK_RADIOMENUITEM),
- direction);
+ return moz_gtk_check_menu_item_paint(widget, cr, rect, state,
+ (gboolean) flags, direction);
break;
case MOZ_GTK_SPLITTER_HORIZONTAL:
return moz_gtk_vpaned_paint(cr, rect, state);
diff --git a/widget/gtk/gtkdrawing.h b/widget/gtk/gtkdrawing.h
index 9bbfdefe96..7db5db043a 100644
--- a/widget/gtk/gtkdrawing.h
+++ b/widget/gtk/gtkdrawing.h
@@ -145,8 +145,11 @@ typedef enum {
MOZ_GTK_ENTRY,
/* Paints a GtkExpander. */
MOZ_GTK_EXPANDER,
- /* Paints a GtkTextView. */
+ /* Paints a GtkTextView or gets the style context corresponding to the
+ root node of a GtkTextView. */
MOZ_GTK_TEXT_VIEW,
+ /* The "text" window or node of a GtkTextView */
+ MOZ_GTK_TEXT_VIEW_TEXT,
/* Paints a GtkOptionMenu. */
MOZ_GTK_DROPDOWN,
/* Paints a dropdown arrow (a GtkButton containing a down GtkArrow). */
@@ -160,11 +163,15 @@ typedef enum {
MOZ_GTK_TOOLBAR_SEPARATOR,
/* Paints a GtkToolTip */
MOZ_GTK_TOOLTIP,
+ /* Paints a GtkBox from GtkToolTip */
+ MOZ_GTK_TOOLTIP_BOX,
+ /* Paints a GtkLabel of GtkToolTip */
+ MOZ_GTK_TOOLTIP_BOX_LABEL,
/* Paints a GtkFrame (e.g. a status bar panel). */
MOZ_GTK_FRAME,
/* Paints the border of a GtkFrame */
MOZ_GTK_FRAME_BORDER,
- /* Paints a resize grip for a GtkWindow */
+ /* Paints a resize grip for a GtkTextView */
MOZ_GTK_RESIZER,
/* Paints a GtkProgressBar. */
MOZ_GTK_PROGRESSBAR,
@@ -211,10 +218,13 @@ typedef enum {
/* Paints items of popup menus. */
MOZ_GTK_MENUITEM,
MOZ_GTK_IMAGEMENUITEM,
- MOZ_GTK_CHECKMENUITEM_CONTAINER,
- MOZ_GTK_RADIOMENUITEM_CONTAINER,
+ /* Paints a menuitem with check indicator, or the gets the style context for
+ a menuitem that contains a checkbox. */
MOZ_GTK_CHECKMENUITEM,
+ /* Gets the style context for a checkbox in a check menuitem. */
+ MOZ_GTK_CHECKMENUITEM_INDICATOR,
MOZ_GTK_RADIOMENUITEM,
+ MOZ_GTK_RADIOMENUITEM_INDICATOR,
MOZ_GTK_MENUSEPARATOR,
/* GtkVPaned base class */
MOZ_GTK_SPLITTER_HORIZONTAL,
diff --git a/widget/gtk/nsLookAndFeel.cpp b/widget/gtk/nsLookAndFeel.cpp
index 53430dfbb8..d2b82e4957 100644
--- a/widget/gtk/nsLookAndFeel.cpp
+++ b/widget/gtk/nsLookAndFeel.cpp
@@ -47,9 +47,6 @@ nsLookAndFeel::nsLookAndFeel()
: nsXPLookAndFeel(),
#if (MOZ_WIDGET_GTK == 2)
mStyle(nullptr),
-#else
- mBackgroundStyle(nullptr),
- mButtonStyle(nullptr),
#endif
mDefaultFontCached(false), mButtonFontCached(false),
mFieldFontCached(false), mMenuFontCached(false)
@@ -61,13 +58,27 @@ nsLookAndFeel::~nsLookAndFeel()
{
#if (MOZ_WIDGET_GTK == 2)
g_object_unref(mStyle);
-#else
- g_object_unref(mBackgroundStyle);
- g_object_unref(mButtonStyle);
#endif
}
#if MOZ_WIDGET_GTK != 2
+// Modifies color |*aDest| as if a pattern of color |aSource| was painted with
+// CAIRO_OPERATOR_OVER to a surface with color |*aDest|.
+static void
+ApplyColorOver(const GdkRGBA& aSource, GdkRGBA* aDest) {
+ gdouble sourceCoef = aSource.alpha;
+ gdouble destCoef = aDest->alpha * (1.0 - sourceCoef);
+ gdouble resultAlpha = sourceCoef + destCoef;
+ if (resultAlpha != 0.0) { // don't divide by zero
+ destCoef /= resultAlpha;
+ sourceCoef /= resultAlpha;
+ aDest->red = sourceCoef * aSource.red + destCoef * aDest->red;
+ aDest->green = sourceCoef * aSource.green + destCoef * aDest->green;
+ aDest->blue = sourceCoef * aSource.blue + destCoef * aDest->blue;
+ aDest->alpha = resultAlpha;
+ }
+}
+
static void
GetLightAndDarkness(const GdkRGBA& aColor,
double* aLightness, double* aDarkness)
@@ -377,30 +388,39 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor)
break;
#else
// css2 http://www.w3.org/TR/REC-CSS2/ui.html#system-colors
- case eColorID_activeborder:
+ case eColorID_activeborder: {
// active window border
- gtk_style_context_get_border_color(mBackgroundStyle,
+ GtkStyleContext *style = ClaimStyleContext(MOZ_GTK_WINDOW);
+ gtk_style_context_get_border_color(style,
GTK_STATE_FLAG_NORMAL, &gdk_color);
aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
+ ReleaseStyleContext(style);
break;
- case eColorID_inactiveborder:
+ }
+ case eColorID_inactiveborder: {
// inactive window border
- gtk_style_context_get_border_color(mBackgroundStyle,
- GTK_STATE_FLAG_INSENSITIVE,
+ GtkStyleContext *style = ClaimStyleContext(MOZ_GTK_WINDOW);
+ gtk_style_context_get_border_color(style,
+ GTK_STATE_FLAG_INSENSITIVE,
&gdk_color);
aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
+ ReleaseStyleContext(style);
break;
+ }
case eColorID_graytext: // disabled text in windows, menus, etc.
case eColorID_inactivecaptiontext: // text in inactive window caption
aColor = sMenuTextInactive;
break;
- case eColorID_inactivecaption:
+ case eColorID_inactivecaption: {
// inactive window caption
- gtk_style_context_get_background_color(mBackgroundStyle,
+ GtkStyleContext *style = ClaimStyleContext(MOZ_GTK_WINDOW);
+ gtk_style_context_get_background_color(style,
GTK_STATE_FLAG_INSENSITIVE,
&gdk_color);
aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
+ ReleaseStyleContext(style);
break;
+ }
#endif
case eColorID_infobackground:
// tooltip background color
@@ -521,18 +541,24 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor)
case eColorID__moz_fieldtext:
aColor = sMozFieldText;
break;
- case eColorID__moz_buttondefault:
- // default button border color
- gtk_style_context_get_border_color(mButtonStyle,
+ case eColorID__moz_buttondefault: {
+ // default button border color
+ GtkStyleContext *style = ClaimStyleContext(MOZ_GTK_BUTTON);
+ gtk_style_context_get_border_color(style,
GTK_STATE_FLAG_NORMAL, &gdk_color);
aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
+ ReleaseStyleContext(style);
break;
- case eColorID__moz_buttonhoverface:
- gtk_style_context_get_background_color(mButtonStyle,
+ }
+ case eColorID__moz_buttonhoverface: {
+ GtkStyleContext *style = ClaimStyleContext(MOZ_GTK_BUTTON);
+ gtk_style_context_get_background_color(style,
GTK_STATE_FLAG_PRELIGHT,
&gdk_color);
aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
+ ReleaseStyleContext(style);
break;
+ }
case eColorID__moz_buttonhovertext:
aColor = sButtonHoverText;
break;
@@ -1029,16 +1055,6 @@ nsLookAndFeel::GetFontImpl(FontID aID, nsString& aFontName,
return true;
}
-#if (MOZ_WIDGET_GTK == 3)
-static GtkStyleContext*
-create_context(GtkWidgetPath *path)
-{
- GtkStyleContext *style = gtk_style_context_new();
- gtk_style_context_set_path(style, path);
- return(style);
-}
-#endif
-
void
nsLookAndFeel::Init()
{
@@ -1129,78 +1145,55 @@ nsLookAndFeel::Init()
g_object_set(settings, dark_setting, FALSE, nullptr);
}
- GtkWidgetPath *path = gtk_widget_path_new();
- gtk_widget_path_append_type(path, GTK_TYPE_WINDOW);
-
- mBackgroundStyle = create_context(path);
- gtk_style_context_add_class(mBackgroundStyle, GTK_STYLE_CLASS_BACKGROUND);
-
- mButtonStyle = create_context(path);
- gtk_style_context_add_class(mButtonStyle, GTK_STYLE_CLASS_BUTTON);
-
// Scrollbar colors
- style = create_context(path);
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_SCROLLBAR);
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_TROUGH);
+ style = ClaimStyleContext(MOZ_GTK_SCROLLBAR_TROUGH_VERTICAL);
gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
sMozScrollbar = GDK_RGBA_TO_NS_RGBA(color);
- g_object_unref(style);
+ ReleaseStyleContext(style);
// Window colors
- style = create_context(path);
- gtk_style_context_save(style);
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_BACKGROUND);
+ style = ClaimStyleContext(MOZ_GTK_WINDOW);
gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
sMozWindowBackground = GDK_RGBA_TO_NS_RGBA(color);
gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
sMozWindowText = GDK_RGBA_TO_NS_RGBA(color);
- gtk_style_context_restore(style);
- g_object_unref(style);
+ ReleaseStyleContext(style);
// tooltip foreground and background
style = ClaimStyleContext(MOZ_GTK_TOOLTIP);
gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
sInfoBackground = GDK_RGBA_TO_NS_RGBA(color);
- {
- GtkStyleContext* boxStyle =
- CreateStyleForWidget(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0),
- style);
- GtkStyleContext* labelStyle =
- CreateStyleForWidget(gtk_label_new(nullptr), boxStyle);
- gtk_style_context_get_color(labelStyle, GTK_STATE_FLAG_NORMAL, &color);
- g_object_unref(labelStyle);
- g_object_unref(boxStyle);
- }
- sInfoText = GDK_RGBA_TO_NS_RGBA(color);
ReleaseStyleContext(style);
- // menu foreground & menu background
- GtkWidget *accel_label = gtk_accel_label_new("M");
- GtkWidget *menuitem = gtk_menu_item_new();
- GtkWidget *menu = gtk_menu_new();
-
- g_object_ref_sink(menu);
-
- gtk_container_add(GTK_CONTAINER(menuitem), accel_label);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
-
- style = gtk_widget_get_style_context(accel_label);
+ style = ClaimStyleContext(MOZ_GTK_TOOLTIP_BOX_LABEL);
gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
- sMenuText = GDK_RGBA_TO_NS_RGBA(color);
- gtk_style_context_get_color(style, GTK_STATE_FLAG_INSENSITIVE, &color);
- sMenuTextInactive = GDK_RGBA_TO_NS_RGBA(color);
+ sInfoText = GDK_RGBA_TO_NS_RGBA(color);
+ ReleaseStyleContext(style);
- style = gtk_widget_get_style_context(menu);
+ style = ClaimStyleContext(MOZ_GTK_MENUITEM);
+ {
+ GtkStyleContext* accelStyle =
+ CreateStyleForWidget(gtk_accel_label_new("M"), style);
+ gtk_style_context_get_color(accelStyle, GTK_STATE_FLAG_NORMAL, &color);
+ sMenuText = GDK_RGBA_TO_NS_RGBA(color);
+ gtk_style_context_get_color(accelStyle, GTK_STATE_FLAG_INSENSITIVE, &color);
+ sMenuTextInactive = GDK_RGBA_TO_NS_RGBA(color);
+ g_object_unref(accelStyle);
+ }
+ ReleaseStyleContext(style);
+
+ style = ClaimStyleContext(MOZ_GTK_MENUPOPUP);
gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
sMenuBackground = GDK_RGBA_TO_NS_RGBA(color);
+ ReleaseStyleContext(style);
- style = gtk_widget_get_style_context(menuitem);
+ style = ClaimStyleContext(MOZ_GTK_MENUITEM);
gtk_style_context_get_background_color(style, GTK_STATE_FLAG_PRELIGHT, &color);
sMenuHover = GDK_RGBA_TO_NS_RGBA(color);
gtk_style_context_get_color(style, GTK_STATE_FLAG_PRELIGHT, &color);
sMenuHoverText = GDK_RGBA_TO_NS_RGBA(color);
- g_object_unref(menu);
+ ReleaseStyleContext(style);
#endif
// button styles
@@ -1211,9 +1204,6 @@ nsLookAndFeel::Init()
GtkWidget *combobox = gtk_combo_box_new();
GtkWidget *comboboxLabel = gtk_label_new("M");
gtk_container_add(GTK_CONTAINER(combobox), comboboxLabel);
-#else
- GtkWidget *combobox = gtk_combo_box_new_with_entry();
- GtkWidget *comboboxLabel = gtk_bin_get_child(GTK_BIN(combobox));
#endif
GtkWidget *window = gtk_window_new(GTK_WINDOW_POPUP);
GtkWidget *treeView = gtk_tree_view_new();
@@ -1227,7 +1217,9 @@ nsLookAndFeel::Init()
gtk_container_add(GTK_CONTAINER(parent), button);
gtk_container_add(GTK_CONTAINER(parent), treeView);
gtk_container_add(GTK_CONTAINER(parent), linkButton);
+#if (MOZ_WIDGET_GTK == 2)
gtk_container_add(GTK_CONTAINER(parent), combobox);
+#endif
gtk_container_add(GTK_CONTAINER(parent), menuBar);
gtk_menu_shell_append(GTK_MENU_SHELL(menuBar), menuBarItem);
gtk_container_add(GTK_CONTAINER(window), parent);
@@ -1310,11 +1302,19 @@ nsLookAndFeel::Init()
}
#else
// Text colors
- style = gtk_widget_get_style_context(textView);
- gtk_style_context_save(style);
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_VIEW);
- gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
- sMozFieldBackground = GDK_RGBA_TO_NS_RGBA(color);
+ GdkRGBA bgColor;
+ // If the text window background is translucent, then the background of
+ // the textview root node is visible.
+ style = ClaimStyleContext(MOZ_GTK_TEXT_VIEW);
+ gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL,
+ &bgColor);
+ ReleaseStyleContext(style);
+
+ style = ClaimStyleContext(MOZ_GTK_TEXT_VIEW_TEXT);
+ gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL,
+ &color);
+ ApplyColorOver(color, &bgColor);
+ sMozFieldBackground = GDK_RGBA_TO_NS_RGBA(bgColor);
gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
sMozFieldText = GDK_RGBA_TO_NS_RGBA(color);
@@ -1327,26 +1327,34 @@ nsLookAndFeel::Init()
static_cast<GtkStateFlags>(GTK_STATE_FLAG_FOCUSED|GTK_STATE_FLAG_SELECTED),
&color);
sTextSelectedText = GDK_RGBA_TO_NS_RGBA(color);
- gtk_style_context_restore(style);
+ ReleaseStyleContext(style);
- // Button text, background, border
- style = gtk_widget_get_style_context(label);
- gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
- sButtonText = GDK_RGBA_TO_NS_RGBA(color);
- gtk_style_context_get_color(style, GTK_STATE_FLAG_PRELIGHT, &color);
- sButtonHoverText = GDK_RGBA_TO_NS_RGBA(color);
+ // Button text color
+ style = ClaimStyleContext(MOZ_GTK_BUTTON);
+ {
+ GtkStyleContext* labelStyle =
+ CreateStyleForWidget(gtk_label_new("M"), style);
+ gtk_style_context_get_color(labelStyle, GTK_STATE_FLAG_NORMAL, &color);
+ sButtonText = GDK_RGBA_TO_NS_RGBA(color);
+ gtk_style_context_get_color(labelStyle, GTK_STATE_FLAG_PRELIGHT, &color);
+ sButtonHoverText = GDK_RGBA_TO_NS_RGBA(color);
+ g_object_unref(labelStyle);
+ }
+ ReleaseStyleContext(style);
// Combobox text color
- style = gtk_widget_get_style_context(comboboxLabel);
+ style = ClaimStyleContext(MOZ_GTK_COMBOBOX_ENTRY_TEXTAREA);
gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
sComboBoxText = GDK_RGBA_TO_NS_RGBA(color);
+ ReleaseStyleContext(style);
// Menubar text and hover text colors
- style = gtk_widget_get_style_context(menuBarItem);
+ style = ClaimStyleContext(MOZ_GTK_MENUBARITEM);
gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
sMenuBarText = GDK_RGBA_TO_NS_RGBA(color);
gtk_style_context_get_color(style, GTK_STATE_FLAG_PRELIGHT, &color);
sMenuBarHoverText = GDK_RGBA_TO_NS_RGBA(color);
+ ReleaseStyleContext(style);
// GTK's guide to fancy odd row background colors:
// 1) Check if a theme explicitly defines an odd row color
@@ -1354,7 +1362,7 @@ nsLookAndFeel::Init()
// slightly by a hardcoded value (gtkstyle.c)
// 3) If neither are defined, take the base background color and
// darken that by a hardcoded value
- style = gtk_widget_get_style_context(treeView);
+ style = ClaimStyleContext(MOZ_GTK_TREEVIEW);
// Get odd row background color
gtk_style_context_save(style);
@@ -1362,8 +1370,7 @@ nsLookAndFeel::Init()
gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
sOddCellBackground = GDK_RGBA_TO_NS_RGBA(color);
gtk_style_context_restore(style);
-
- gtk_widget_path_free(path);
+ ReleaseStyleContext(style);
// GtkFrame has a "border" subnode on which Adwaita draws the border.
// Some themes do not draw on this node but draw a border on the widget
@@ -1448,12 +1455,6 @@ nsLookAndFeel::RefreshImpl()
#if (MOZ_WIDGET_GTK == 2)
g_object_unref(mStyle);
mStyle = nullptr;
-#else
- g_object_unref(mBackgroundStyle);
- g_object_unref(mButtonStyle);
-
- mBackgroundStyle = nullptr;
- mButtonStyle = nullptr;
#endif
Init();
diff --git a/widget/gtk/nsLookAndFeel.h b/widget/gtk/nsLookAndFeel.h
index 9058250b9a..726859b419 100644
--- a/widget/gtk/nsLookAndFeel.h
+++ b/widget/gtk/nsLookAndFeel.h
@@ -33,9 +33,6 @@ public:
protected:
#if (MOZ_WIDGET_GTK == 2)
struct _GtkStyle *mStyle;
-#else
- struct _GtkStyleContext *mBackgroundStyle;
- struct _GtkStyleContext *mButtonStyle;
#endif
// Cached fonts
diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
index d97b35002c..e4e69c1b4d 100644
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -6627,6 +6627,22 @@ nsWindow::GetDragInfo(WidgetMouseEvent* aMouseEvent,
return false;
}
+ if (mIsX11Display) {
+ // Workaround for https://bugzilla.gnome.org/show_bug.cgi?id=789054
+ // To avoid crashes disable double-click on WM without _NET_WM_MOVERESIZE.
+ // See _should_perform_ewmh_drag() at gdkwindow-x11.c
+ GdkScreen* screen = gdk_window_get_screen(gdk_window);
+ GdkAtom atom = gdk_atom_intern("_NET_WM_MOVERESIZE", FALSE);
+ if (!gdk_x11_screen_supports_net_wm_hint(screen, atom)) {
+ static unsigned int lastTimeStamp = 0;
+ if (lastTimeStamp != aMouseEvent->mTime) {
+ lastTimeStamp = aMouseEvent->mTime;
+ } else {
+ return false;
+ }
+ }
+ }
+
// FIXME: It would be nice to have the widget position at the time
// of the event, but it's relatively unlikely that the widget has
// moved since the mousedown. (On the other hand, it's quite likely
diff --git a/widget/moz.build b/widget/moz.build
index 09192179ff..f69f2d87ca 100644
--- a/widget/moz.build
+++ b/widget/moz.build
@@ -65,7 +65,6 @@ XPIDL_SOURCES += [
'nsIClipboardHelper.idl',
'nsIClipboardOwner.idl',
'nsIColorPicker.idl',
- 'nsIDatePicker.idl',
'nsIDisplayInfo.idl',
'nsIDragService.idl',
'nsIDragSession.idl',
@@ -151,7 +150,6 @@ UNIFIED_SOURCES += [
'nsClipboardProxy.cpp',
'nsColorPickerProxy.cpp',
'nsContentProcessWidgetFactory.cpp',
- 'nsDatePickerProxy.cpp',
'nsDragServiceProxy.cpp',
'nsFilePickerProxy.cpp',
'nsHTMLFormatConverter.cpp',
diff --git a/widget/nsBaseAppShell.cpp b/widget/nsBaseAppShell.cpp
index 1557498b71..c6b88cba03 100644
--- a/widget/nsBaseAppShell.cpp
+++ b/widget/nsBaseAppShell.cpp
@@ -6,9 +6,6 @@
#include "base/message_loop.h"
#include "nsBaseAppShell.h"
-#if defined(MOZ_CRASHREPORTER)
-#include "nsExceptionHandler.h"
-#endif
#include "nsThreadUtils.h"
#include "nsIObserverService.h"
#include "nsServiceManagerUtils.h"
@@ -317,18 +314,12 @@ void
nsBaseAppShell::IncrementEventloopNestingLevel()
{
++mEventloopNestingLevel;
-#if defined(MOZ_CRASHREPORTER)
- CrashReporter::SetEventloopNestingLevel(mEventloopNestingLevel);
-#endif
}
void
nsBaseAppShell::DecrementEventloopNestingLevel()
{
--mEventloopNestingLevel;
-#if defined(MOZ_CRASHREPORTER)
- CrashReporter::SetEventloopNestingLevel(mEventloopNestingLevel);
-#endif
}
// Called from the main thread
diff --git a/widget/nsBaseWidget.cpp b/widget/nsBaseWidget.cpp
index b820fed3cc..909660f715 100644
--- a/widget/nsBaseWidget.cpp
+++ b/widget/nsBaseWidget.cpp
@@ -3086,6 +3086,7 @@ case _value: eventName.AssignLiteral(_name) ; break
_ASSIGN_eventName(eMouseDown,"eMouseDown");
_ASSIGN_eventName(eMouseUp,"eMouseUp");
_ASSIGN_eventName(eMouseClick,"eMouseClick");
+ _ASSIGN_eventName(eMouseAuxClick,"eMouseAuxClick");
_ASSIGN_eventName(eMouseDoubleClick,"eMouseDoubleClick");
_ASSIGN_eventName(eMouseMove,"eMouseMove");
_ASSIGN_eventName(eLoad,"eLoad");
diff --git a/widget/nsContentProcessWidgetFactory.cpp b/widget/nsContentProcessWidgetFactory.cpp
index f8eaee2506..2f00f1c832 100644
--- a/widget/nsContentProcessWidgetFactory.cpp
+++ b/widget/nsContentProcessWidgetFactory.cpp
@@ -9,7 +9,6 @@
#include "nsWidgetsCID.h"
#include "nsClipboardProxy.h"
#include "nsColorPickerProxy.h"
-#include "nsDatePickerProxy.h"
#include "nsDragServiceProxy.h"
#include "nsFilePickerProxy.h"
#include "nsScreenManagerProxy.h"
@@ -22,7 +21,6 @@ using namespace mozilla::widget;
NS_GENERIC_FACTORY_CONSTRUCTOR(nsClipboardProxy)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsColorPickerProxy)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsDatePickerProxy)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDragServiceProxy)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsFilePickerProxy)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsScreenManagerProxy)
@@ -30,7 +28,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(PuppetBidiKeyboard)
NS_DEFINE_NAMED_CID(NS_CLIPBOARD_CID);
NS_DEFINE_NAMED_CID(NS_COLORPICKER_CID);
-NS_DEFINE_NAMED_CID(NS_DATEPICKER_CID);
NS_DEFINE_NAMED_CID(NS_DRAGSERVICE_CID);
NS_DEFINE_NAMED_CID(NS_FILEPICKER_CID);
NS_DEFINE_NAMED_CID(PUPPETBIDIKEYBOARD_CID);
@@ -41,8 +38,6 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
Module::CONTENT_PROCESS_ONLY },
{ &kNS_COLORPICKER_CID, false, nullptr, nsColorPickerProxyConstructor,
Module::CONTENT_PROCESS_ONLY },
- { &kNS_DATEPICKER_CID, false, nullptr, nsDatePickerProxyConstructor,
- Module::CONTENT_PROCESS_ONLY },
{ &kNS_DRAGSERVICE_CID, false, nullptr, nsDragServiceProxyConstructor,
Module::CONTENT_PROCESS_ONLY },
{ &kNS_FILEPICKER_CID, false, nullptr, nsFilePickerProxyConstructor,
@@ -57,7 +52,6 @@ static const mozilla::Module::CIDEntry kWidgetCIDs[] = {
static const mozilla::Module::ContractIDEntry kWidgetContracts[] = {
{ "@mozilla.org/widget/clipboard;1", &kNS_CLIPBOARD_CID, Module::CONTENT_PROCESS_ONLY },
{ "@mozilla.org/colorpicker;1", &kNS_COLORPICKER_CID, Module::CONTENT_PROCESS_ONLY },
- { "@mozilla.org/datepicker;1", &kNS_DATEPICKER_CID, Module::CONTENT_PROCESS_ONLY },
{ "@mozilla.org/filepicker;1", &kNS_FILEPICKER_CID, Module::CONTENT_PROCESS_ONLY },
{ "@mozilla.org/gfx/screenmanager;1", &kNS_SCREENMANAGER_CID, Module::CONTENT_PROCESS_ONLY },
{ "@mozilla.org/widget/dragservice;1", &kNS_DRAGSERVICE_CID, Module::CONTENT_PROCESS_ONLY },
diff --git a/widget/nsDatePickerProxy.cpp b/widget/nsDatePickerProxy.cpp
deleted file mode 100644
index e6b88f1be3..0000000000
--- a/widget/nsDatePickerProxy.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C++; 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/. */
-
-#include "nsDatePickerProxy.h"
-
-#include "mozilla/dom/TabChild.h"
-
-using namespace mozilla::dom;
-
-NS_IMPL_ISUPPORTS(nsDatePickerProxy, nsIDatePicker)
-
-/* void init (in nsIDOMWindow parent, in AString title, in short mode); */
-NS_IMETHODIMP
-nsDatePickerProxy::Init(mozIDOMWindowProxy* aParent, const nsAString& aTitle,
- const nsAString& aInitialDate)
-{
- TabChild* tabChild = TabChild::GetFrom(aParent);
- if (!tabChild) {
- return NS_ERROR_FAILURE;
- }
-
- tabChild->SendPDatePickerConstructor(this,
- nsString(aTitle),
- nsString(aInitialDate));
- NS_ADDREF_THIS(); //Released in DeallocPDatePickerChild
- return NS_OK;
-}
-
-/* void open (in nsIDatePickerShownCallback aDatePickerShownCallback); */
-NS_IMETHODIMP
-nsDatePickerProxy::Open(nsIDatePickerShownCallback* aDatePickerShownCallback)
-{
- NS_ENSURE_STATE(!mCallback);
- mCallback = aDatePickerShownCallback;
-
- SendOpen();
- return NS_OK;
-}
-
-bool
-nsDatePickerProxy::RecvCancel()
-{
- if (mCallback) {
- mCallback->Cancel();
- mCallback = nullptr;
- }
- return true;
-}
-
-bool
-nsDatePickerProxy::Recv__delete__(const nsString& aDate)
-{
- if (mCallback) {
- mCallback->Done(aDate);
- mCallback = nullptr;
- }
- return true;
-}
diff --git a/widget/nsDatePickerProxy.h b/widget/nsDatePickerProxy.h
deleted file mode 100644
index 71475932c5..0000000000
--- a/widget/nsDatePickerProxy.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#ifndef nsDatePickerProxy_h
-#define nsDatePickerProxy_h
-
-#include "nsIDatePicker.h"
-
-#include "mozilla/dom/PDatePickerChild.h"
-
-class nsDatePickerProxy final : public nsIDatePicker,
- public mozilla::dom::PDatePickerChild
-{
-public:
- NS_DECL_ISUPPORTS
- NS_DECL_NSIDATEPICKER
-
- nsDatePickerProxy() {}
-
- virtual bool RecvCancel() override;
- virtual bool Recv__delete__(const nsString& aDate) override;
-
-private:
- ~nsDatePickerProxy() {}
-
- nsCOMPtr<nsIDatePickerShownCallback> mCallback;
- nsString mTitle;
- nsString mInitialDate;
-};
-
-#endif // nsDatePickerProxy_h
diff --git a/widget/nsGUIEventIPC.h b/widget/nsGUIEventIPC.h
index 7a9d870d9a..e45189bb10 100644
--- a/widget/nsGUIEventIPC.h
+++ b/widget/nsGUIEventIPC.h
@@ -219,6 +219,34 @@ struct ParamTraits<mozilla::WidgetWheelEvent>
};
template<>
+struct ParamTraits<mozilla::WidgetPointerHelper>
+{
+ typedef mozilla::WidgetPointerHelper paramType;
+
+ static void Write(Message* aMsg, const paramType& aParam)
+ {
+ WriteParam(aMsg, aParam.pointerId);
+ WriteParam(aMsg, aParam.tiltX);
+ WriteParam(aMsg, aParam.tiltY);
+ WriteParam(aMsg, aParam.twist);
+ WriteParam(aMsg, aParam.tangentialPressure);
+ // We don't serialize convertToPointer since it's temporarily variable and
+ // should be reset to default.
+ }
+
+ static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
+ {
+ bool rv;
+ rv = ReadParam(aMsg, aIter, &aResult->pointerId) &&
+ ReadParam(aMsg, aIter, &aResult->tiltX) &&
+ ReadParam(aMsg, aIter, &aResult->tiltY) &&
+ ReadParam(aMsg, aIter, &aResult->twist) &&
+ ReadParam(aMsg, aIter, &aResult->tangentialPressure);
+ return rv;
+ }
+};
+
+template<>
struct ParamTraits<mozilla::WidgetMouseEvent>
{
typedef mozilla::WidgetMouseEvent paramType;
@@ -226,13 +254,13 @@ struct ParamTraits<mozilla::WidgetMouseEvent>
static void Write(Message* aMsg, const paramType& aParam)
{
WriteParam(aMsg, static_cast<mozilla::WidgetMouseEventBase>(aParam));
+ WriteParam(aMsg, static_cast<mozilla::WidgetPointerHelper>(aParam));
WriteParam(aMsg, aParam.mIgnoreRootScrollFrame);
WriteParam(aMsg, static_cast<paramType::ReasonType>(aParam.mReason));
WriteParam(aMsg, static_cast<paramType::ContextMenuTriggerType>(
aParam.mContextMenuTrigger));
WriteParam(aMsg, static_cast<paramType::ExitFromType>(aParam.mExitFrom));
WriteParam(aMsg, aParam.mClickCount);
- WriteParam(aMsg, aParam.pointerId);
}
static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
@@ -243,12 +271,13 @@ struct ParamTraits<mozilla::WidgetMouseEvent>
paramType::ExitFromType exitFrom = 0;
rv = ReadParam(aMsg, aIter,
static_cast<mozilla::WidgetMouseEventBase*>(aResult)) &&
+ ReadParam(aMsg, aIter,
+ static_cast<mozilla::WidgetPointerHelper*>(aResult)) &&
ReadParam(aMsg, aIter, &aResult->mIgnoreRootScrollFrame) &&
ReadParam(aMsg, aIter, &reason) &&
ReadParam(aMsg, aIter, &contextMenuTrigger) &&
ReadParam(aMsg, aIter, &exitFrom) &&
- ReadParam(aMsg, aIter, &aResult->mClickCount) &&
- ReadParam(aMsg, aIter, &aResult->pointerId);
+ ReadParam(aMsg, aIter, &aResult->mClickCount);
aResult->mReason = static_cast<paramType::Reason>(reason);
aResult->mContextMenuTrigger =
static_cast<paramType::ContextMenuTrigger>(contextMenuTrigger);
@@ -290,8 +319,6 @@ struct ParamTraits<mozilla::WidgetPointerEvent>
WriteParam(aMsg, static_cast<mozilla::WidgetMouseEvent>(aParam));
WriteParam(aMsg, aParam.mWidth);
WriteParam(aMsg, aParam.mHeight);
- WriteParam(aMsg, aParam.tiltX);
- WriteParam(aMsg, aParam.tiltY);
WriteParam(aMsg, aParam.mIsPrimary);
}
@@ -301,8 +328,6 @@ struct ParamTraits<mozilla::WidgetPointerEvent>
ReadParam(aMsg, aIter, static_cast<mozilla::WidgetMouseEvent*>(aResult)) &&
ReadParam(aMsg, aIter, &aResult->mWidth) &&
ReadParam(aMsg, aIter, &aResult->mHeight) &&
- ReadParam(aMsg, aIter, &aResult->tiltX) &&
- ReadParam(aMsg, aIter, &aResult->tiltY) &&
ReadParam(aMsg, aIter, &aResult->mIsPrimary);
return rv;
}
diff --git a/widget/nsIDatePicker.idl b/widget/nsIDatePicker.idl
deleted file mode 100644
index d6be60c957..0000000000
--- a/widget/nsIDatePicker.idl
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- *
- * This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsISupports.idl"
-
-interface mozIDOMWindowProxy;
-
-[scriptable, uuid(13388a28-1b0b-4218-a31b-588f7a4ec26c)]
-interface nsIDatePickerShownCallback : nsISupports
-{
- /**
- * Callback called when the user selects cancel in the date picker
- * This callback can not be called after done() is called.
- */
- void cancel();
-
- /**
- * Callback called when the user has finished selecting the date
- *
- * @param date The new selected date value following the format "YYYY-MM-DD"
- */
- void done(in AString date);
-};
-
-[scriptable, uuid(7becfc64-966b-4d53-87d2-9161f36bd3b3)]
-interface nsIDatePicker : nsISupports
-{
- /**
- * Initialize the date picker widget. The date picker will not be shown until
- * open() is called.
- * If the initialDate parameter does not follow the format "YYYY-MM-DD" then
- * the behavior will be unspecified.
- *
- * @param parent nsIDOMWindow parent. This dialog will be dependent
- * on this parent. parent may be null.
- * @param title The title for the date picker widget.
- * @param initialDate The date to show when the widget is opened. The
- * parameter has to follow the format "YYYY-MM-DD"
- */
- void init(in mozIDOMWindowProxy parent, in AString title, in AString initialDate);
-
- /**
- * Opens the date dialog asynchrounously.
- * The results are provided via the callback object.
- */
- void open(in nsIDatePickerShownCallback callback);
-};
diff --git a/widget/nsWidgetsCID.h b/widget/nsWidgetsCID.h
index 2589b59e02..54ebe63abc 100644
--- a/widget/nsWidgetsCID.h
+++ b/widget/nsWidgetsCID.h
@@ -33,11 +33,6 @@
{ 0x0f872c8c, 0x3ee6, 0x46bd, \
{ 0x92, 0xa2, 0x69, 0x65, 0x2c, 0x6b, 0x47, 0x4e } }
-/* 0ca832f8-978a-4dc7-a57d-adb803925d39 */
-#define NS_DATEPICKER_CID \
-{ 0x0ca832f8, 0x978a, 0x4dc7, \
- { 0xa5, 0x7d, 0xad, 0xb8, 0x03, 0x92, 0x5d, 0x39 } }
-
/* 2d96b3df-c051-11d1-a827-0040959a28c9 */
#define NS_APPSHELL_CID \
{ 0x2d96b3df, 0xc051, 0x11d1, \
diff --git a/widget/windows/GfxInfo.cpp b/widget/windows/GfxInfo.cpp
index bfea418510..8a429ad321 100644
--- a/widget/windows/GfxInfo.cpp
+++ b/widget/windows/GfxInfo.cpp
@@ -21,12 +21,6 @@
#include "nsPrintfCString.h"
#include "jsapi.h"
-#if defined(MOZ_CRASHREPORTER)
-#include "nsExceptionHandler.h"
-#include "nsICrashReporter.h"
-#define NS_CRASHREPORTER_CONTRACTID "@mozilla.org/toolkit/crash-reporter;1"
-#endif
-
using namespace mozilla;
using namespace mozilla::gfx;
using namespace mozilla::widget;
@@ -721,102 +715,10 @@ GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active)
return NS_OK;
}
-#if defined(MOZ_CRASHREPORTER)
-/* Cisco's VPN software can cause corruption of the floating point state.
- * Make a note of this in our crash reports so that some weird crashes
- * make more sense */
-static void
-CheckForCiscoVPN() {
- LONG result;
- HKEY key;
- /* This will give false positives, but hopefully no false negatives */
- result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\Cisco Systems\\VPN Client", 0, KEY_QUERY_VALUE, &key);
- if (result == ERROR_SUCCESS) {
- RegCloseKey(key);
- CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("Cisco VPN\n"));
- }
-}
-#endif
-
void
GfxInfo::AddCrashReportAnnotations()
{
-#if defined(MOZ_CRASHREPORTER)
- CheckForCiscoVPN();
-
- if (mHasDriverVersionMismatch) {
- CrashReporter::AppendAppNotesToCrashReport(NS_LITERAL_CSTRING("DriverVersionMismatch\n"));
- }
-
- nsString deviceID, vendorID, driverVersion, subsysID;
- nsCString narrowDeviceID, narrowVendorID, narrowDriverVersion, narrowSubsysID;
-
- GetAdapterDeviceID(deviceID);
- CopyUTF16toUTF8(deviceID, narrowDeviceID);
- GetAdapterVendorID(vendorID);
- CopyUTF16toUTF8(vendorID, narrowVendorID);
- GetAdapterDriverVersion(driverVersion);
- CopyUTF16toUTF8(driverVersion, narrowDriverVersion);
- GetAdapterSubsysID(subsysID);
- CopyUTF16toUTF8(subsysID, narrowSubsysID);
-
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterVendorID"),
- narrowVendorID);
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDeviceID"),
- narrowDeviceID);
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterDriverVersion"),
- narrowDriverVersion);
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AdapterSubsysID"),
- narrowSubsysID);
-
- /* Add an App Note for now so that we get the data immediately. These
- * can go away after we store the above in the socorro db */
- nsAutoCString note;
- /* AppendPrintf only supports 32 character strings, mrghh. */
- note.AppendLiteral("AdapterVendorID: ");
- note.Append(narrowVendorID);
- note.AppendLiteral(", AdapterDeviceID: ");
- note.Append(narrowDeviceID);
- note.AppendLiteral(", AdapterSubsysID: ");
- note.Append(narrowSubsysID);
- note.AppendLiteral(", AdapterDriverVersion: ");
- note.Append(NS_LossyConvertUTF16toASCII(driverVersion));
-
- if (vendorID == GfxDriverInfo::GetDeviceVendor(VendorAll)) {
- /* if we didn't find a valid vendorID lets append the mDeviceID string to try to find out why */
- note.AppendLiteral(", ");
- LossyAppendUTF16toASCII(mDeviceID, note);
- note.AppendLiteral(", ");
- LossyAppendUTF16toASCII(mDeviceKeyDebug, note);
- LossyAppendUTF16toASCII(mDeviceKeyDebug, note);
- }
- note.Append("\n");
-
- if (mHasDualGPU) {
- nsString deviceID2, vendorID2, subsysID2;
- nsAutoString adapterDriverVersionString2;
- nsCString narrowDeviceID2, narrowVendorID2, narrowSubsysID2;
-
- note.AppendLiteral("Has dual GPUs. GPU #2: ");
- GetAdapterDeviceID2(deviceID2);
- CopyUTF16toUTF8(deviceID2, narrowDeviceID2);
- GetAdapterVendorID2(vendorID2);
- CopyUTF16toUTF8(vendorID2, narrowVendorID2);
- GetAdapterDriverVersion2(adapterDriverVersionString2);
- GetAdapterSubsysID(subsysID2);
- CopyUTF16toUTF8(subsysID2, narrowSubsysID2);
- note.AppendLiteral("AdapterVendorID2: ");
- note.Append(narrowVendorID2);
- note.AppendLiteral(", AdapterDeviceID2: ");
- note.Append(narrowDeviceID2);
- note.AppendLiteral(", AdapterSubsysID2: ");
- note.Append(narrowSubsysID2);
- note.AppendLiteral(", AdapterDriverVersion2: ");
- note.Append(NS_LossyConvertUTF16toASCII(adapterDriverVersionString2));
- }
- CrashReporter::AppendAppNotesToCrashReport(note);
-
-#endif
+ /*** STUB ***/
}
static OperatingSystem
diff --git a/widget/windows/KeyboardLayout.cpp b/widget/windows/KeyboardLayout.cpp
index 341a40c18d..9166d97d77 100644
--- a/widget/windows/KeyboardLayout.cpp
+++ b/widget/windows/KeyboardLayout.cpp
@@ -13,9 +13,6 @@
#include "mozilla/WindowsVersion.h"
#include "nsAlgorithm.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
#include "nsGkAtoms.h"
#include "nsIDOMKeyEvent.h"
#include "nsIIdleServiceInternal.h"
@@ -2740,42 +2737,6 @@ NativeKey::NeedsToHandleWithoutFollowingCharMessages() const
return mIsPrintableKey;
}
-#ifdef MOZ_CRASHREPORTER
-
-static nsCString
-GetResultOfInSendMessageEx()
-{
- DWORD ret = ::InSendMessageEx(nullptr);
- if (!ret) {
- return NS_LITERAL_CSTRING("ISMEX_NOSEND");
- }
- nsAutoCString result;
- if (ret & ISMEX_CALLBACK) {
- result = "ISMEX_CALLBACK";
- }
- if (ret & ISMEX_NOTIFY) {
- if (!result.IsEmpty()) {
- result += " | ";
- }
- result += "ISMEX_NOTIFY";
- }
- if (ret & ISMEX_REPLIED) {
- if (!result.IsEmpty()) {
- result += " | ";
- }
- result += "ISMEX_REPLIED";
- }
- if (ret & ISMEX_SEND) {
- if (!result.IsEmpty()) {
- result += " | ";
- }
- result += "ISMEX_SEND";
- }
- return result;
-}
-
-#endif // #ifdef MOZ_CRASHREPORTER
-
bool
NativeKey::MayBeSameCharMessage(const MSG& aCharMsg1,
const MSG& aCharMsg2) const
@@ -3019,33 +2980,6 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg)
}
if (doCrash) {
-#ifdef MOZ_CRASHREPORTER
- nsPrintfCString info("\nPeekMessage() failed to remove char message! "
- "\nActive keyboard layout=0x%08X (%s), "
- "\nHandling message: %s, InSendMessageEx()=%s, "
- "\nFound message: %s, "
- "\nWM_NULL has been removed: %d, "
- "\nNext key message in all windows: %s, "
- "time=%d, ",
- KeyboardLayout::GetActiveLayout(),
- KeyboardLayout::GetActiveLayoutName().get(),
- ToString(mMsg).get(),
- GetResultOfInSendMessageEx().get(),
- ToString(kFoundCharMsg).get(), i,
- ToString(nextKeyMsgInAllWindows).get(),
- nextKeyMsgInAllWindows.time);
- CrashReporter::AppendAppNotesToCrashReport(info);
- MSG nextMsg;
- if (WinUtils::PeekMessage(&nextMsg, 0, 0, 0,
- PM_NOREMOVE | PM_NOYIELD)) {
- nsPrintfCString info("\nNext message in all windows: %s, time=%d",
- ToString(nextMsg).get(), nextMsg.time);
- CrashReporter::AppendAppNotesToCrashReport(info);
- } else {
- CrashReporter::AppendAppNotesToCrashReport(
- NS_LITERAL_CSTRING("\nThere is no message in any window"));
- }
-#endif // #ifdef MOZ_CRASHREPORTER
MOZ_CRASH("We lost the following char message");
}
@@ -3164,63 +3098,12 @@ NativeKey::GetFollowingCharMessage(MSG& aCharMsg)
"nextKeyMsg=%s, kFoundCharMsg=%s",
this, ToString(removedMsg).get(), ToString(nextKeyMsg).get(),
ToString(kFoundCharMsg).get()));
-#ifdef MOZ_CRASHREPORTER
- nsPrintfCString info("\nPeekMessage() removed unexpcted char message! "
- "\nActive keyboard layout=0x%08X (%s), "
- "\nHandling message: %s, InSendMessageEx()=%s, "
- "\nFound message: %s, "
- "\nRemoved message: %s, ",
- KeyboardLayout::GetActiveLayout(),
- KeyboardLayout::GetActiveLayoutName().get(),
- ToString(mMsg).get(),
- GetResultOfInSendMessageEx().get(),
- ToString(kFoundCharMsg).get(),
- ToString(removedMsg).get());
- CrashReporter::AppendAppNotesToCrashReport(info);
- // What's the next key message?
- MSG nextKeyMsgAfter;
- if (WinUtils::PeekMessage(&nextKeyMsgAfter, mMsg.hwnd,
- WM_KEYFIRST, WM_KEYLAST,
- PM_NOREMOVE | PM_NOYIELD)) {
- nsPrintfCString info("\nNext key message after unexpected char message "
- "removed: %s, ",
- ToString(nextKeyMsgAfter).get());
- CrashReporter::AppendAppNotesToCrashReport(info);
- } else {
- CrashReporter::AppendAppNotesToCrashReport(
- NS_LITERAL_CSTRING("\nThere is no key message after unexpected char "
- "message removed, "));
- }
- // Another window has a key message?
- if (WinUtils::PeekMessage(&nextKeyMsgInAllWindows, 0,
- WM_KEYFIRST, WM_KEYLAST,
- PM_NOREMOVE | PM_NOYIELD)) {
- nsPrintfCString info("\nNext key message in all windows: %s.",
- ToString(nextKeyMsgInAllWindows).get());
- CrashReporter::AppendAppNotesToCrashReport(info);
- } else {
- CrashReporter::AppendAppNotesToCrashReport(
- NS_LITERAL_CSTRING("\nThere is no key message in any windows."));
- }
-#endif // #ifdef MOZ_CRASHREPORTER
MOZ_CRASH("PeekMessage() removed unexpected message");
}
MOZ_LOG(sNativeKeyLogger, LogLevel::Error,
("%p NativeKey::GetFollowingCharMessage(), FAILED, removed messages "
"are all WM_NULL, nextKeyMsg=%s",
this, ToString(nextKeyMsg).get()));
-#ifdef MOZ_CRASHREPORTER
- nsPrintfCString info("\nWe lost following char message! "
- "\nActive keyboard layout=0x%08X (%s), "
- "\nHandling message: %s, InSendMessageEx()=%s, \n"
- "Found message: %s, removed a lot of WM_NULL",
- KeyboardLayout::GetActiveLayout(),
- KeyboardLayout::GetActiveLayoutName().get(),
- ToString(mMsg).get(),
- GetResultOfInSendMessageEx().get(),
- ToString(kFoundCharMsg).get());
- CrashReporter::AppendAppNotesToCrashReport(info);
-#endif // #ifdef MOZ_CRASHREPORTER
MOZ_CRASH("We lost the following char message");
return false;
}
diff --git a/widget/windows/LSPAnnotator.cpp b/widget/windows/LSPAnnotator.cpp
deleted file mode 100644
index 97f6e5b505..0000000000
--- a/widget/windows/LSPAnnotator.cpp
+++ /dev/null
@@ -1,156 +0,0 @@
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-/**
- * LSPs are evil little bits of code that are allowed to inject into our
- * networking stack by Windows. Once they have wormed into our process
- * they gnaw at our innards until we crash. Here we force the buggers
- * into the light by recording them in our crash information.
- * We do the enumeration on a thread because I'm concerned about startup perf
- * on machines with several LSPs.
- */
-
-#include "nsICrashReporter.h"
-#include "nsISupportsImpl.h"
-#include "nsServiceManagerUtils.h"
-#include "nsThreadUtils.h"
-#include "nsQueryObject.h"
-#include "nsWindowsHelpers.h"
-#include <windows.h>
-#include <rpc.h>
-#include <ws2spi.h>
-
-namespace mozilla {
-namespace crashreporter {
-
-class LSPAnnotationGatherer : public Runnable
-{
- ~LSPAnnotationGatherer() {}
-
-public:
- NS_DECL_THREADSAFE_ISUPPORTS
- NS_DECL_NSIRUNNABLE
-
- void Annotate();
- nsCString mString;
- nsCOMPtr<nsIThread> mThread;
-};
-
-NS_IMPL_ISUPPORTS(LSPAnnotationGatherer, nsIRunnable)
-
-void
-LSPAnnotationGatherer::Annotate()
-{
- nsCOMPtr<nsICrashReporter> cr =
- do_GetService("@mozilla.org/toolkit/crash-reporter;1");
- bool enabled;
- if (cr && NS_SUCCEEDED(cr->GetEnabled(&enabled)) && enabled) {
- cr->AnnotateCrashReport(NS_LITERAL_CSTRING("Winsock_LSP"), mString);
- }
- mThread->AsyncShutdown();
-}
-
-NS_IMETHODIMP
-LSPAnnotationGatherer::Run()
-{
- PR_SetCurrentThreadName("LSP Annotator");
-
- mThread = NS_GetCurrentThread();
-
- DWORD size = 0;
- int err;
- // Get the size of the buffer we need
- if (SOCKET_ERROR != WSCEnumProtocols(nullptr, nullptr, &size, &err) ||
- err != WSAENOBUFS) {
- // Er, what?
- NS_NOTREACHED("WSCEnumProtocols suceeded when it should have failed ...");
- return NS_ERROR_FAILURE;
- }
-
- auto byteArray = MakeUnique<char[]>(size);
- WSAPROTOCOL_INFOW* providers =
- reinterpret_cast<WSAPROTOCOL_INFOW*>(byteArray.get());
-
- int n = WSCEnumProtocols(nullptr, providers, &size, &err);
- if (n == SOCKET_ERROR) {
- // Lame. We provided the right size buffer; we'll just give up now.
- NS_WARNING("Could not get LSP list");
- return NS_ERROR_FAILURE;
- }
-
- nsCString str;
- for (int i = 0; i < n; i++) {
- AppendUTF16toUTF8(nsDependentString(providers[i].szProtocol), str);
- str.AppendLiteral(" : ");
- str.AppendInt(providers[i].iVersion);
- str.AppendLiteral(" : ");
- str.AppendInt(providers[i].iAddressFamily);
- str.AppendLiteral(" : ");
- str.AppendInt(providers[i].iSocketType);
- str.AppendLiteral(" : ");
- str.AppendInt(providers[i].iProtocol);
- str.AppendLiteral(" : ");
- str.AppendPrintf("0x%x", providers[i].dwServiceFlags1);
- str.AppendLiteral(" : ");
- str.AppendPrintf("0x%x", providers[i].dwProviderFlags);
- str.AppendLiteral(" : ");
-
- wchar_t path[MAX_PATH];
- int pathLen = MAX_PATH;
- if (!WSCGetProviderPath(&providers[i].ProviderId, path, &pathLen, &err)) {
- AppendUTF16toUTF8(nsDependentString(path), str);
- }
-
- str.AppendLiteral(" : ");
- // If WSCGetProviderInfo is available, we should call it to obtain the
- // category flags for this provider. When present, these flags inform
- // Windows as to which order to chain the providers.
- nsModuleHandle ws2_32(LoadLibraryW(L"ws2_32.dll"));
- if (ws2_32) {
- decltype(WSCGetProviderInfo)* pWSCGetProviderInfo =
- reinterpret_cast<decltype(WSCGetProviderInfo)*>(
- GetProcAddress(ws2_32, "WSCGetProviderInfo"));
- if (pWSCGetProviderInfo) {
- DWORD categoryInfo;
- size_t categoryInfoSize = sizeof(categoryInfo);
- if (!pWSCGetProviderInfo(&providers[i].ProviderId,
- ProviderInfoLspCategories,
- (PBYTE)&categoryInfo, &categoryInfoSize, 0,
- &err)) {
- str.AppendPrintf("0x%x", categoryInfo);
- }
- }
- }
-
- str.AppendLiteral(" : ");
- if (providers[i].ProtocolChain.ChainLen <= BASE_PROTOCOL) {
- // If we're dealing with a catalog entry that identifies an individual
- // base or layer provider, log its provider GUID.
- RPC_CSTR provIdStr = nullptr;
- if (UuidToStringA(&providers[i].ProviderId, &provIdStr) == RPC_S_OK) {
- str.Append(reinterpret_cast<char*>(provIdStr));
- RpcStringFreeA(&provIdStr);
- }
- }
-
- if (i + 1 != n) {
- str.AppendLiteral(" \n ");
- }
- }
-
- mString = str;
- NS_DispatchToMainThread(NewRunnableMethod(this, &LSPAnnotationGatherer::Annotate));
- return NS_OK;
-}
-
-void LSPAnnotate()
-{
- nsCOMPtr<nsIThread> thread;
- nsCOMPtr<nsIRunnable> runnable =
- do_QueryObject(new LSPAnnotationGatherer());
- NS_NewThread(getter_AddRefs(thread), runnable);
-}
-
-} // namespace crashreporter
-} // namespace mozilla
diff --git a/widget/windows/WinUtils.cpp b/widget/windows/WinUtils.cpp
index 0a57ad4393..bd42e78f66 100644
--- a/widget/windows/WinUtils.cpp
+++ b/widget/windows/WinUtils.cpp
@@ -1138,7 +1138,8 @@ WinUtils::GetIsMouseFromTouch(EventMessage aEventMessage)
const uint32_t MOZ_T_I_SIGNATURE = TABLET_INK_TOUCH | TABLET_INK_SIGNATURE;
const uint32_t MOZ_T_I_CHECK_TCH = TABLET_INK_TOUCH | TABLET_INK_CHECK;
return ((aEventMessage == eMouseMove || aEventMessage == eMouseDown ||
- aEventMessage == eMouseUp || aEventMessage == eMouseDoubleClick) &&
+ aEventMessage == eMouseUp || aEventMessage == eMouseAuxClick ||
+ aEventMessage == eMouseDoubleClick) &&
(GetMessageExtraInfo() & MOZ_T_I_SIGNATURE) == MOZ_T_I_CHECK_TCH);
}
diff --git a/widget/windows/moz.build b/widget/windows/moz.build
index d4f089eeac..1e7fc4b021 100644
--- a/widget/windows/moz.build
+++ b/widget/windows/moz.build
@@ -79,11 +79,6 @@ SOURCES += [
'WinMouseScrollHandler.cpp',
]
-if CONFIG['MOZ_CRASHREPORTER']:
- UNIFIED_SOURCES += [
- 'LSPAnnotator.cpp',
- ]
-
if CONFIG['NS_PRINTING']:
UNIFIED_SOURCES += [
'nsDeviceContextSpecWin.cpp',
diff --git a/widget/windows/nsAppShell.cpp b/widget/windows/nsAppShell.cpp
index c8820e7d17..c3e99b2d3d 100644
--- a/widget/windows/nsAppShell.cpp
+++ b/widget/windows/nsAppShell.cpp
@@ -213,10 +213,6 @@ nsAppShell::~nsAppShell()
nsresult
nsAppShell::Init()
{
-#ifdef MOZ_CRASHREPORTER
- LSPAnnotate();
-#endif
-
mLastNativeEventScheduled = TimeStamp::NowLoRes();
mozilla::ipc::windows::InitUIThread();
diff --git a/widget/windows/nsClipboard.cpp b/widget/windows/nsClipboard.cpp
index 1afee34961..0db1dd3424 100644
--- a/widget/windows/nsClipboard.cpp
+++ b/widget/windows/nsClipboard.cpp
@@ -65,7 +65,7 @@ nsClipboard::nsClipboard() : nsBaseClipboard()
nsCOMPtr<nsIObserverService> observerService =
do_GetService("@mozilla.org/observer-service;1");
if (observerService)
- observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, PR_FALSE);
+ observerService->AddObserver(this, NS_XPCOM_WILL_SHUTDOWN_OBSERVER_ID, PR_FALSE);
}
//-------------------------------------------------------------------------
diff --git a/widget/windows/nsDataObj.cpp b/widget/windows/nsDataObj.cpp
index 02ec3b2fea..977a87c08c 100644
--- a/widget/windows/nsDataObj.cpp
+++ b/widget/windows/nsDataObj.cpp
@@ -443,6 +443,82 @@ STDMETHODIMP_(ULONG) nsDataObj::AddRef()
return m_cRef;
}
+namespace {
+class RemoveTempFileHelper : public nsIObserver
+{
+public:
+ explicit RemoveTempFileHelper(nsIFile* aTempFile)
+ : mTempFile(aTempFile)
+ {
+ MOZ_ASSERT(mTempFile);
+ }
+
+ // The attach method is seperate from the constructor as we may be addref-ing
+ // ourself, and we want to be sure someone has a strong reference to us.
+ void Attach()
+ {
+ // We need to listen to both the xpcom shutdown message and our timer, and
+ // fire when the first of either of these two messages is received.
+ nsresult rv;
+ mTimer = do_CreateInstance(NS_TIMER_CONTRACTID, &rv);
+ if (NS_WARN_IF(NS_FAILED(rv))) {
+ return;
+ }
+ mTimer->Init(this, 500, nsITimer::TYPE_ONE_SHOT);
+
+ nsCOMPtr<nsIObserverService> observerService =
+ do_GetService("@mozilla.org/observer-service;1");
+ if (NS_WARN_IF(!observerService)) {
+ mTimer->Cancel();
+ mTimer = nullptr;
+ return;
+ }
+ observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
+ }
+
+ NS_DECL_ISUPPORTS
+ NS_DECL_NSIOBSERVER
+
+private:
+ ~RemoveTempFileHelper()
+ {
+ if (mTempFile) {
+ mTempFile->Remove(false);
+ }
+ }
+
+ nsCOMPtr<nsIFile> mTempFile;
+ nsCOMPtr<nsITimer> mTimer;
+};
+
+NS_IMPL_ISUPPORTS(RemoveTempFileHelper, nsIObserver);
+
+NS_IMETHODIMP
+RemoveTempFileHelper::Observe(nsISupports* aSubject, const char* aTopic, const char16_t* aData)
+{
+ // Let's be careful and make sure that we don't die immediately
+ RefPtr<RemoveTempFileHelper> grip = this;
+
+ // Make sure that we aren't called again by destroying references to ourself.
+ nsCOMPtr<nsIObserverService> observerService =
+ do_GetService("@mozilla.org/observer-service;1");
+ if (observerService) {
+ observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
+ }
+
+ if (mTimer) {
+ mTimer->Cancel();
+ mTimer = nullptr;
+ }
+
+ // Remove the tempfile
+ if (mTempFile) {
+ mTempFile->Remove(false);
+ mTempFile = nullptr;
+ }
+ return NS_OK;
+}
+} // namespace
//-----------------------------------------------------
STDMETHODIMP_(ULONG) nsDataObj::Release()
@@ -456,17 +532,12 @@ STDMETHODIMP_(ULONG) nsDataObj::Release()
// We have released our last ref on this object and need to delete the
// temp file. External app acting as drop target may still need to open the
// temp file. Addref a timer so it can delay deleting file and destroying
- // this object. Delete file anyway and destroy this obj if there's a problem.
+ // this object.
if (mCachedTempFile) {
- nsresult rv;
- mTimer = do_CreateInstance(NS_TIMER_CONTRACTID, &rv);
- if (NS_SUCCEEDED(rv)) {
- mTimer->InitWithFuncCallback(nsDataObj::RemoveTempFile, this,
- 500, nsITimer::TYPE_ONE_SHOT);
- return AddRef();
- }
- mCachedTempFile->Remove(false);
+ RefPtr<RemoveTempFileHelper> helper =
+ new RemoveTempFileHelper(mCachedTempFile);
mCachedTempFile = nullptr;
+ helper->Attach();
}
delete this;
@@ -2153,13 +2224,3 @@ HRESULT nsDataObj::GetFileContents_IStream(FORMATETC& aFE, STGMEDIUM& aSTG)
return S_OK;
}
-
-void nsDataObj::RemoveTempFile(nsITimer* aTimer, void* aClosure)
-{
- nsDataObj *timedDataObj = static_cast<nsDataObj *>(aClosure);
- if (timedDataObj->mCachedTempFile) {
- timedDataObj->mCachedTempFile->Remove(false);
- timedDataObj->mCachedTempFile = nullptr;
- }
- timedDataObj->Release();
-}
diff --git a/widget/windows/nsDataObj.h b/widget/windows/nsDataObj.h
index 2d7fb75ee6..61f209e857 100644
--- a/widget/windows/nsDataObj.h
+++ b/widget/windows/nsDataObj.h
@@ -289,7 +289,6 @@ protected:
bool LookupArbitraryFormat(FORMATETC *aFormat, LPDATAENTRY *aDataEntry, BOOL aAddorUpdate);
bool CopyMediumData(STGMEDIUM *aMediumDst, STGMEDIUM *aMediumSrc, LPFORMATETC aFormat, BOOL aSetData);
- static void RemoveTempFile(nsITimer* aTimer, void* aClosure);
};
diff --git a/xpcom/base/CycleCollectedJSContext.cpp b/xpcom/base/CycleCollectedJSContext.cpp
index 87e123078b..4af8fe4dd0 100644
--- a/xpcom/base/CycleCollectedJSContext.cpp
+++ b/xpcom/base/CycleCollectedJSContext.cpp
@@ -82,10 +82,6 @@
#include "nsJSUtils.h"
#include "nsWrapperCache.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
-
#include "nsIException.h"
#include "nsIPlatformInfo.h"
#include "nsThread.h"
@@ -539,10 +535,6 @@ CycleCollectedJSContext::Initialize(JSContext* aParentContext,
JS_SetSweepZoneCallback(mJSContext, XPCStringConvert::ClearZoneCache);
JS::SetBuildIdOp(mJSContext, GetBuildId);
JS::SetWarningReporter(mJSContext, MozCrashWarningReporter);
-#ifdef MOZ_CRASHREPORTER
- js::AutoEnterOOMUnsafeRegion::setAnnotateOOMAllocationSizeCallback(
- CrashReporter::AnnotateOOMAllocationSize);
-#endif
static js::DOMCallbacks DOMcallbacks = {
InstanceClassHasProtoAtDepth
@@ -1607,16 +1599,6 @@ CycleCollectedJSContext::AnnotateAndSetOutOfMemory(OOMState* aStatePtr,
MOZ_ASSERT(mJSContext);
*aStatePtr = aNewState;
-#ifdef MOZ_CRASHREPORTER
- CrashReporter::AnnotateCrashReport(aStatePtr == &mOutOfMemoryState
- ? NS_LITERAL_CSTRING("JSOutOfMemory")
- : NS_LITERAL_CSTRING("JSLargeAllocationFailure"),
- aNewState == OOMState::Reporting
- ? NS_LITERAL_CSTRING("Reporting")
- : aNewState == OOMState::Reported
- ? NS_LITERAL_CSTRING("Reported")
- : NS_LITERAL_CSTRING("Recovered"));
-#endif
}
void
@@ -1630,14 +1612,6 @@ CycleCollectedJSContext::OnGC(JSGCStatus aStatus)
mZonesWaitingForGC.Clear();
break;
case JSGC_END: {
-#ifdef MOZ_CRASHREPORTER
- if (mOutOfMemoryState == OOMState::Reported) {
- AnnotateAndSetOutOfMemory(&mOutOfMemoryState, OOMState::Recovered);
- }
- if (mLargeAllocationFailureState == OOMState::Reported) {
- AnnotateAndSetOutOfMemory(&mLargeAllocationFailureState, OOMState::Recovered);
- }
-#endif
// Do any deferred finalization of native objects.
FinalizeDeferredThings(JS::WasIncrementalGC(mJSContext) ? FinalizeIncrementally :
diff --git a/xpcom/base/nsCrashOnException.cpp b/xpcom/base/nsCrashOnException.cpp
index 0f8042531f..06c48738f1 100644
--- a/xpcom/base/nsCrashOnException.cpp
+++ b/xpcom/base/nsCrashOnException.cpp
@@ -8,22 +8,11 @@
#include "nsCOMPtr.h"
#include "nsServiceManagerUtils.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsICrashReporter.h"
-#endif
-
namespace mozilla {
static int
ReportException(EXCEPTION_POINTERS* aExceptionInfo)
{
-#ifdef MOZ_CRASHREPORTER
- nsCOMPtr<nsICrashReporter> cr =
- do_GetService("@mozilla.org/toolkit/crash-reporter;1");
- if (cr) {
- cr->WriteMinidumpForException(aExceptionInfo);
- }
-#endif
return EXCEPTION_EXECUTE_HANDLER;
}
diff --git a/xpcom/base/nsCycleCollector.cpp b/xpcom/base/nsCycleCollector.cpp
index ca7057628c..b2c15a1dd4 100644
--- a/xpcom/base/nsCycleCollector.cpp
+++ b/xpcom/base/nsCycleCollector.cpp
@@ -188,10 +188,6 @@
#include "mozilla/Telemetry.h"
#include "mozilla/ThreadLocal.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
-
using namespace mozilla;
//#define COLLECT_TIME_DEBUG
@@ -2690,7 +2686,7 @@ public:
void* aClosure) const override
{
const JS::Value& val = aValue->unbarrieredGet();
- if (val.isMarkable() && ValueIsGrayCCThing(val)) {
+ if (val.isGCThing() && ValueIsGrayCCThing(val)) {
MOZ_ASSERT(!js::gc::IsInsideNursery(val.toGCThing()));
mCollector->GetJSPurpleBuffer()->mValues.InfallibleAppend(val);
}
@@ -3150,14 +3146,6 @@ nsCycleCollector::ScanWhiteNodes(bool aFullySynchGraphBuild)
}
if (pi->mInternalRefs > pi->mRefCount) {
-#ifdef MOZ_CRASHREPORTER
- const char* piName = "Unknown";
- if (pi->mParticipant) {
- piName = pi->mParticipant->ClassName();
- }
- nsPrintfCString msg("More references to an object than its refcount, for class %s", piName);
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("CycleCollector"), msg);
-#endif
MOZ_CRASH();
}
diff --git a/xpcom/base/nsCycleCollectorTraceJSHelpers.cpp b/xpcom/base/nsCycleCollectorTraceJSHelpers.cpp
index eb06a389c1..7c48002e30 100644
--- a/xpcom/base/nsCycleCollectorTraceJSHelpers.cpp
+++ b/xpcom/base/nsCycleCollectorTraceJSHelpers.cpp
@@ -36,7 +36,7 @@ void
TraceCallbackFunc::Trace(JS::Heap<JS::Value>* aPtr, const char* aName,
void* aClosure) const
{
- if (aPtr->unbarrieredGet().isMarkable()) {
+ if (aPtr->unbarrieredGet().isGCThing()) {
mCallback(JS::GCCellPtr(aPtr->unbarrieredGet()), aName, aClosure);
}
}
diff --git a/xpcom/base/nsDebugImpl.cpp b/xpcom/base/nsDebugImpl.cpp
index 36288d2037..96487acda9 100644
--- a/xpcom/base/nsDebugImpl.cpp
+++ b/xpcom/base/nsDebugImpl.cpp
@@ -11,9 +11,6 @@
#include "nsDebugImpl.h"
#include "nsDebug.h"
-#ifdef MOZ_CRASHREPORTER
-# include "nsExceptionHandler.h"
-#endif
#include "nsString.h"
#include "nsXULAppAPI.h"
#include "prprf.h"
@@ -380,22 +377,6 @@ NS_DebugBreak(uint32_t aSeverity, const char* aStr, const char* aExpr,
return;
case NS_DEBUG_ABORT: {
-#if defined(MOZ_CRASHREPORTER)
- // Updating crash annotations in the child causes us to do IPC. This can
- // really cause trouble if we're asserting from within IPC code. So we
- // have to do without the annotations in that case.
- if (XRE_IsParentProcess()) {
- // Don't include the PID in the crash report annotation to
- // allow faceting on crash-stats.mozilla.org.
- nsCString note("xpcom_runtime_abort(");
- note += nonPIDBuf.buffer;
- note += ")";
- CrashReporter::AppendAppNotesToCrashReport(note);
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AbortMessage"),
- nsDependentCString(nonPIDBuf.buffer));
- }
-#endif // MOZ_CRASHREPORTER
-
#if defined(DEBUG) && defined(_WIN32)
RealBreak();
#endif
@@ -600,8 +581,5 @@ NS_ErrorAccordingToNSPR()
void
NS_ABORT_OOM(size_t aSize)
{
-#if defined(MOZ_CRASHREPORTER)
- CrashReporter::AnnotateOOMAllocationSize(aSize);
-#endif
MOZ_CRASH("OOM");
}
diff --git a/xpcom/base/nsMemoryReporterManager.cpp b/xpcom/base/nsMemoryReporterManager.cpp
index aa3d74dfd5..616eefbdc5 100644
--- a/xpcom/base/nsMemoryReporterManager.cpp
+++ b/xpcom/base/nsMemoryReporterManager.cpp
@@ -439,13 +439,11 @@ static MOZ_MUST_USE nsresult
ResidentDistinguishedAmountHelper(int64_t* aN, bool aDoPurge)
{
#ifdef HAVE_JEMALLOC_STATS
-#ifndef MOZ_JEMALLOC4
if (aDoPurge) {
Telemetry::AutoTimer<Telemetry::MEMORY_FREE_PURGED_PAGES_MS> timer;
jemalloc_purge_freed_pages();
}
#endif
-#endif
task_basic_info ti;
if (!GetTaskBasicInfo(&ti)) {
diff --git a/xpcom/base/nsObjCExceptions.h b/xpcom/base/nsObjCExceptions.h
index e63c92af57..b3ed532ec4 100644
--- a/xpcom/base/nsObjCExceptions.h
+++ b/xpcom/base/nsObjCExceptions.h
@@ -17,12 +17,6 @@
#import <ExceptionHandling/NSExceptionHandler.h>
#endif
-#if defined(MOZ_CRASHREPORTER) && defined(__cplusplus)
-#include "nsICrashReporter.h"
-#include "nsCOMPtr.h"
-#include "nsServiceManagerUtils.h"
-#endif
-
#include <unistd.h>
#include <signal.h>
#include "nsError.h"
@@ -47,15 +41,6 @@ nsObjCExceptionLog(NSException* aException)
NSLog(@"Mozilla has caught an Obj-C exception [%@: %@]",
[aException name], [aException reason]);
-#if defined(MOZ_CRASHREPORTER) && defined(__cplusplus)
- // Attach exception info to the crash report.
- nsCOMPtr<nsICrashReporter> crashReporter =
- do_GetService("@mozilla.org/toolkit/crash-reporter;1");
- if (crashReporter) {
- crashReporter->AppendObjCExceptionInfoToAppNotes(static_cast<void*>(aException));
- }
-#endif
-
#ifdef DEBUG
@try {
// Try to get stack information out of the exception. 10.5 returns the stack
diff --git a/xpcom/build/nsXULAppAPI.h b/xpcom/build/nsXULAppAPI.h
index 426a58f063..aae248ca1a 100644
--- a/xpcom/build/nsXULAppAPI.h
+++ b/xpcom/build/nsXULAppAPI.h
@@ -426,17 +426,6 @@ XRE_API(const char*,
XRE_API(void,
XRE_SetProcessType, (const char* aProcessTypeString))
-#if defined(MOZ_CRASHREPORTER)
-// Used in the "master" parent process hosting the crash server
-XRE_API(bool,
- XRE_TakeMinidumpForChild, (uint32_t aChildPid, nsIFile** aDump,
- uint32_t* aSequence))
-
-// Used in child processes.
-XRE_API(bool,
- XRE_SetRemoteExceptionHandler, (const char* aPipe))
-#endif
-
namespace mozilla {
namespace gmp {
class GMPLoader;
diff --git a/xpcom/glue/PLDHashTable.cpp b/xpcom/glue/PLDHashTable.cpp
index 6152e90003..5e932ccb2a 100644
--- a/xpcom/glue/PLDHashTable.cpp
+++ b/xpcom/glue/PLDHashTable.cpp
@@ -216,17 +216,17 @@ PLDHashTable::operator=(PLDHashTable&& aOther)
return *this;
}
- // Destruct |this|.
- this->~PLDHashTable();
-
- // |mOps| and |mEntrySize| are const so we can't assign them. Instead, we
- // require that they are equal. The justification for this is that they're
+ // |mOps| and |mEntrySize| are required to stay the same, they're
// conceptually part of the type -- indeed, if PLDHashTable was a templated
// type like nsTHashtable, they *would* be part of the type -- so it only
// makes sense to assign in cases where they match.
MOZ_RELEASE_ASSERT(mOps == aOther.mOps);
MOZ_RELEASE_ASSERT(mEntrySize == aOther.mEntrySize);
+ // Reconstruct |this|.
+ this->~PLDHashTable();
+ new (KnownNotNull, this) PLDHashTable(aOther.mOps, aOther.mEntrySize, 0);
+
// Move non-const pieces over.
mHashShift = Move(aOther.mHashShift);
mEntryCount = Move(aOther.mEntryCount);
diff --git a/xpcom/io/nsEscape.cpp b/xpcom/io/nsEscape.cpp
index f16edc4ce7..117e20d601 100644
--- a/xpcom/io/nsEscape.cpp
+++ b/xpcom/io/nsEscape.cpp
@@ -346,7 +346,7 @@ static const uint32_t EscapeChars[256] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 1x
- 0,1023, 0, 512,1023, 0,1023, 112,1023,1023,1023,1023,1023,1023, 953, 784, // 2x !"#$%&'()*+,-./
+ 0,1023, 0, 512,1023, 0,1023, 624,1023,1023,1023,1023,1023,1023, 953, 784, // 2x !"#$%&'()*+,-./
1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1008,1008, 0,1008, 0, 768, // 3x 0123456789:;<=>?
1008,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023, // 4x @ABCDEFGHIJKLMNO
1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1023,1008, 896,1008, 896,1023, // 5x PQRSTUVWXYZ[\]^_
diff --git a/xpcom/reflect/xptcall/md/unix/Makefile.in b/xpcom/reflect/xptcall/md/unix/Makefile.in
index e4cdc389bb..716d79623a 100644
--- a/xpcom/reflect/xptcall/md/unix/Makefile.in
+++ b/xpcom/reflect/xptcall/md/unix/Makefile.in
@@ -7,17 +7,6 @@
# HPPA
######################################################################
#
-# HP-UX/PA32
-#
-# for gas and gcc, check comment in xptcinvoke_asm_pa32.s
-ifeq ($(OS_ARCH),HP-UX)
-ifneq ($(CC),gcc)
-# #18875 Building the CPP's (CXX) optimized causes a crash
-CXXFLAGS := $(filter-out $(MOZ_OPTIMIZE_FLAGS), $(CXXFLAGS))
-endif
-endif
-
-#
# Linux/HPPA/gcc
#
ifeq ($(OS_ARCH),Linux)
diff --git a/xpcom/reflect/xptcall/md/unix/moz.build b/xpcom/reflect/xptcall/md/unix/moz.build
index 1d182bbd6f..148d3bf351 100644
--- a/xpcom/reflect/xptcall/md/unix/moz.build
+++ b/xpcom/reflect/xptcall/md/unix/moz.build
@@ -108,23 +108,6 @@ if CONFIG['CPU_ARCH'] == 'arm' and CONFIG['OS_ARCH'] in ('Bitrig', 'OpenBSD'):
'xptcstubs_arm_openbsd.cpp',
]
-if CONFIG['OS_ARCH'] == 'HP-UX':
- if CONFIG['CC'] != 'gcc':
- if CONFIG['OS_TEST'] == 'ia64':
- SOURCES += [
- 'xptcinvoke_asm_ipf32.s',
- 'xptcinvoke_ipf32.cpp',
- 'xptcstubs_asm_ipf32.s',
- 'xptcstubs_ipf32.cpp',
- ]
- else:
- SOURCES += [
- 'xptcinvoke_asm_pa32.s',
- 'xptcinvoke_pa32.cpp',
- 'xptcstubs_asm_pa32.s',
- 'xptcstubs_pa32.cpp'
- ]
-
if CONFIG['OS_ARCH'] == 'Linux':
if CONFIG['OS_TEST'] in ('hppa', 'hppa2.0', 'hppa1.1'):
if CONFIG['GNU_CXX']:
diff --git a/xpcom/reflect/xptcall/status.html b/xpcom/reflect/xptcall/status.html
index 65de205960..7f8e54a0c4 100644
--- a/xpcom/reflect/xptcall/status.html
+++ b/xpcom/reflect/xptcall/status.html
@@ -255,21 +255,6 @@ The word I hear is that this is working and done
<TR>
<TD bgcolor="green"><font color="white"><b>Done</b></font></TD>
-<TD>HP-UX</TD>
-<TD>
-<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
-<a href="mailto:wang@cup.hp.com">Thomas Wang &lt;wang@cup.hp.com&gt;</a><BR>
-<img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
-<a href="mailto:mgleeson1@netscape.com">Mike Gleeson &lt;mgleeson1@netscape.com&gt;</a>
-</TD>
-<TD>I hear that this code is checked in and working. Though, there is some
-doubt - see bug
-#<a href="http://bugzilla.mozilla.org/show_bug.cgi?id=17997">17997</a>
-</TD>
-</TR>
-
-<TR>
-<TD bgcolor="green"><font color="white"><b>Done</b></font></TD>
<TD>AIX PPC</TD>
<TD><img alt="Contributed code!" title="Contributed code!" src="http://tinderbox.mozilla.org/star.gif">
<a href="mailto:jdunn@netscape.com">Jim Dunn &lt;jdunn@netscape.com&gt;</a></TD>
diff --git a/xpcom/reflect/xptcall/xptcall.h b/xpcom/reflect/xptcall/xptcall.h
index 1f2367b5db..304787635b 100644
--- a/xpcom/reflect/xptcall/xptcall.h
+++ b/xpcom/reflect/xptcall/xptcall.h
@@ -39,7 +39,7 @@ struct nsXPTCMiniVariant
// Types below here are unknown to the assembly implementations, and
// therefore _must_ be passed with indirect semantics. We put them in
// the union here for type safety, so that we can avoid void* tricks.
- JS::Value j;
+ JS::UninitializedValue j;
} val;
};
diff --git a/xpcom/system/moz.build b/xpcom/system/moz.build
index 8a4f88efe5..1d8e7ea1f0 100644
--- a/xpcom/system/moz.build
+++ b/xpcom/system/moz.build
@@ -18,9 +18,4 @@ XPIDL_SOURCES += [
'nsIXULRuntime.idl',
]
-if CONFIG['MOZ_CRASHREPORTER']:
- XPIDL_SOURCES += [
- 'nsICrashReporter.idl',
- ]
-
XPIDL_MODULE = 'xpcom_system'
diff --git a/xpcom/system/nsIXULRuntime.idl b/xpcom/system/nsIXULRuntime.idl
index fda0e696fe..994084c0a4 100644
--- a/xpcom/system/nsIXULRuntime.idl
+++ b/xpcom/system/nsIXULRuntime.idl
@@ -164,7 +164,7 @@ interface nsIXULRuntime : nsISupports
readonly attribute AUTF8String distributionID;
/**
- * True if this is an official build (MOZILLA_OFFICIAL).
+ * True if this is an official build (MC_OFFICIAL).
*/
readonly attribute boolean isOfficial;
diff --git a/xpcom/tests/gtest/TestDeadlockDetector.cpp b/xpcom/tests/gtest/TestDeadlockDetector.cpp
index 646ee3e1d4..877c5f5c36 100644
--- a/xpcom/tests/gtest/TestDeadlockDetector.cpp
+++ b/xpcom/tests/gtest/TestDeadlockDetector.cpp
@@ -15,12 +15,6 @@
#include "mozilla/ReentrantMonitor.h"
#include "mozilla/Mutex.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsCOMPtr.h"
-#include "nsICrashReporter.h"
-#include "nsServiceManagerUtils.h"
-#endif
-
#include "gtest/gtest.h"
using namespace mozilla;
@@ -62,13 +56,7 @@ private:
void DisableCrashReporter()
{
-#ifdef MOZ_CRASHREPORTER
- nsCOMPtr<nsICrashReporter> crashreporter =
- do_GetService("@mozilla.org/toolkit/crash-reporter;1");
- if (crashreporter) {
- crashreporter->SetEnabled(false);
- }
-#endif
+ /*** STUB ***/
}
//-----------------------------------------------------------------------------
diff --git a/xpcom/tests/gtest/TestPLDHash.cpp b/xpcom/tests/gtest/TestPLDHash.cpp
index e7a73ae1bb..4405b102c8 100644
--- a/xpcom/tests/gtest/TestPLDHash.cpp
+++ b/xpcom/tests/gtest/TestPLDHash.cpp
@@ -21,10 +21,6 @@
extern unsigned int _gdb_sleep_duration;
#endif
-#ifdef MOZ_CRASHREPORTER
-#include "nsICrashReporter.h"
-#endif
-
// We can test that certain operations cause expected aborts by forking
// and then checking that the child aborted in the expected way (i.e. via
// MOZ_CRASH). We skip this for the following configurations.
@@ -46,17 +42,6 @@ TestCrashyOperation(void (*aCrashyOperation)())
ASSERT_NE(pid, -1);
if (pid == 0) {
- // Disable the crashreporter -- writing a crash dump in the child will
- // prevent the parent from writing a subsequent dump. Crashes here are
- // expected, so we don't want their stacks to show up in the log anyway.
-#ifdef MOZ_CRASHREPORTER
- nsCOMPtr<nsICrashReporter> crashreporter =
- do_GetService("@mozilla.org/toolkit/crash-reporter;1");
- if (crashreporter) {
- crashreporter->SetEnabled(false);
- }
-#endif
-
// Child: perform the crashy operation.
fprintf(stderr, "TestCrashyOperation: The following crash is expected. Do not panic.\n");
aCrashyOperation();
diff --git a/xpcom/tests/gtest/TestSTLWrappers.cpp b/xpcom/tests/gtest/TestSTLWrappers.cpp
index 9559548a31..295aa74342 100644
--- a/xpcom/tests/gtest/TestSTLWrappers.cpp
+++ b/xpcom/tests/gtest/TestSTLWrappers.cpp
@@ -10,12 +10,6 @@
# error "failed to wrap <vector>"
#endif
-#ifdef MOZ_CRASHREPORTER
-#include "nsCOMPtr.h"
-#include "nsICrashReporter.h"
-#include "nsServiceManagerUtils.h"
-#endif
-
// gcc errors out if we |try ... catch| with -fno-exceptions, but we
// can still test on windows
#ifdef _MSC_VER
@@ -40,14 +34,6 @@ void ShouldAbort()
_gdb_sleep_duration = 0;
#endif
-#ifdef MOZ_CRASHREPORTER
- nsCOMPtr<nsICrashReporter> crashreporter =
- do_GetService("@mozilla.org/toolkit/crash-reporter;1");
- if (crashreporter) {
- crashreporter->SetEnabled(false);
- }
-#endif
-
std::vector<int> v;
int rv = 1;
diff --git a/xpcom/threads/HangMonitor.cpp b/xpcom/threads/HangMonitor.cpp
index 71cc67ca4b..bd415be50e 100644
--- a/xpcom/threads/HangMonitor.cpp
+++ b/xpcom/threads/HangMonitor.cpp
@@ -22,10 +22,6 @@
#include "nsThreadUtils.h"
#include "nsXULAppAPI.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsExceptionHandler.h"
-#endif
-
#ifdef XP_WIN
#include <windows.h>
#endif
@@ -111,15 +107,6 @@ Crash()
}
#endif
-#ifdef MOZ_CRASHREPORTER
- // If you change this, you must also deal with the threadsafety of AnnotateCrashReport in
- // non-chrome processes!
- if (GeckoProcessType_Default == XRE_GetProcessType()) {
- CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("Hang"),
- NS_LITERAL_CSTRING("1"));
- }
-#endif
-
NS_RUNTIMEABORT("HangMonitor triggered");
}
diff --git a/xpcom/threads/nsThread.cpp b/xpcom/threads/nsThread.cpp
index 63bd28ca38..7c1af08f48 100644
--- a/xpcom/threads/nsThread.cpp
+++ b/xpcom/threads/nsThread.cpp
@@ -39,12 +39,6 @@
#include "nsThreadSyncDispatch.h"
#include "LeakRefPtr.h"
-#ifdef MOZ_CRASHREPORTER
-#include "nsServiceManagerUtils.h"
-#include "nsICrashReporter.h"
-#include "mozilla/dom/ContentChild.h"
-#endif
-
#ifdef XP_LINUX
#include <sys/time.h>
#include <sys/resource.h>
@@ -520,73 +514,6 @@ nsThread::ThreadFunc(void* aArg)
//-----------------------------------------------------------------------------
-#ifdef MOZ_CRASHREPORTER
-// Tell the crash reporter to save a memory report if our heuristics determine
-// that an OOM failure is likely to occur soon.
-// Memory usage will not be checked more than every 30 seconds or saved more
-// than every 3 minutes
-// If |aShouldSave == kForceReport|, a report will be saved regardless of
-// whether the process is low on memory or not. However, it will still not be
-// saved if a report was saved less than 3 minutes ago.
-bool
-nsThread::SaveMemoryReportNearOOM(ShouldSaveMemoryReport aShouldSave)
-{
- // Keep an eye on memory usage (cheap, ~7ms) somewhat frequently,
- // but save memory reports (expensive, ~75ms) less frequently.
- const size_t kLowMemoryCheckSeconds = 30;
- const size_t kLowMemorySaveSeconds = 3 * 60;
-
- static TimeStamp nextCheck = TimeStamp::NowLoRes()
- + TimeDuration::FromSeconds(kLowMemoryCheckSeconds);
- static bool recentlySavedReport = false; // Keeps track of whether a report
- // was saved last time we checked
-
- // Are we checking again too soon?
- TimeStamp now = TimeStamp::NowLoRes();
- if ((aShouldSave == ShouldSaveMemoryReport::kMaybeReport ||
- recentlySavedReport) && now < nextCheck) {
- return false;
- }
-
- bool needMemoryReport = (aShouldSave == ShouldSaveMemoryReport::kForceReport);
-#ifdef XP_WIN // XXX implement on other platforms as needed
- // If the report is forced there is no need to check whether it is necessary
- if (aShouldSave != ShouldSaveMemoryReport::kForceReport) {
- const size_t LOWMEM_THRESHOLD_VIRTUAL = 200 * 1024 * 1024;
- MEMORYSTATUSEX statex;
- statex.dwLength = sizeof(statex);
- if (GlobalMemoryStatusEx(&statex)) {
- if (statex.ullAvailVirtual < LOWMEM_THRESHOLD_VIRTUAL) {
- needMemoryReport = true;
- }
- }
- }
-#endif
-
- if (needMemoryReport) {
- if (XRE_IsContentProcess()) {
- dom::ContentChild* cc = dom::ContentChild::GetSingleton();
- if (cc) {
- cc->SendNotifyLowMemory();
- }
- } else {
- nsCOMPtr<nsICrashReporter> cr =
- do_GetService("@mozilla.org/toolkit/crash-reporter;1");
- if (cr) {
- cr->SaveMemoryReport();
- }
- }
- recentlySavedReport = true;
- nextCheck = now + TimeDuration::FromSeconds(kLowMemorySaveSeconds);
- } else {
- recentlySavedReport = false;
- nextCheck = now + TimeDuration::FromSeconds(kLowMemoryCheckSeconds);
- }
-
- return recentlySavedReport;
-}
-#endif
-
#ifdef MOZ_CANARY
int sCanaryOutputFD = -1;
#endif
@@ -1459,12 +1386,6 @@ nsThread::DoMainThreadSpecificProcessing(bool aReallyWait)
}
}
}
-
-#ifdef MOZ_CRASHREPORTER
- if (!ShuttingDown()) {
- SaveMemoryReportNearOOM(ShouldSaveMemoryReport::kMaybeReport);
- }
-#endif
}
//-----------------------------------------------------------------------------
diff --git a/xpcom/threads/nsThread.h b/xpcom/threads/nsThread.h
index 836123747a..037ef1952f 100644
--- a/xpcom/threads/nsThread.h
+++ b/xpcom/threads/nsThread.h
@@ -83,16 +83,6 @@ public:
void WaitForAllAsynchronousShutdowns();
-#ifdef MOZ_CRASHREPORTER
- enum class ShouldSaveMemoryReport
- {
- kMaybeReport,
- kForceReport
- };
-
- static bool SaveMemoryReportNearOOM(ShouldSaveMemoryReport aShouldSave);
-#endif
-
private:
void DoMainThreadSpecificProcessing(bool aReallyWait);